From: support Date: Mon, 20 Jun 2022 15:41:44 +0000 (+0000) Subject: Built motion from commit e515d77c.|2.6.11 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=7be0697c7ec4dbae9067a7cea9bc6a21d2a612a4;p=motion2.git Built motion from commit e515d77c.|2.6.11 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index f6bb600..6a453cc 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-06-20T15:18:40.055Z", + "time": "2022-06-20T15:33:31.928Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 21b37ad..bb4d5ef 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-06-20T15:18:40.055Z", + "time": "2022-06-20T15:33:31.928Z", "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 7b07a4e..502b63c 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 _0xc076=['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','STRING','contactManager','integration','motionbar','jscripty','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xc076,0x84));var _0x6c07=function(_0x4ac076,_0x36fee5){_0x4ac076=_0x4ac076-0x0;var _0x303566=_0xc076[_0x4ac076];return _0x303566;};'use strict';var Sequelize=require(_0x6c07('0x0'));module[_0x6c07('0x1')]={'name':{'type':Sequelize[_0x6c07('0x2')],'get':function(_0x55b13c){return this[_0x6c07('0x3')](_0x6c07('0x4'));}},'action':{'type':Sequelize[_0x6c07('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x6c07('0x6'),_0x6c07('0x7'),_0x6c07('0x8'),_0x6c07('0x9'),'urlForward',_0x6c07('0xa'),'bot',_0x6c07('0xb')]],'msg':_0x6c07('0xc')}},'comment':_0x6c07('0xc')},'data1':{'type':Sequelize[_0x6c07('0x5')](0x1000),'comment':_0x6c07('0xd')},'data2':{'type':Sequelize[_0x6c07('0x5')](0x1000),'comment':_0x6c07('0xe')},'data3':{'type':Sequelize[_0x6c07('0x5')](0x1000),'comment':_0x6c07('0xf')},'data4':{'type':Sequelize[_0x6c07('0x5')](0x1000),'comments':_0x6c07('0x10')},'data5':{'type':Sequelize[_0x6c07('0x5')](0x1000),'comments':_0x6c07('0x11')},'data6':{'type':Sequelize[_0x6c07('0x5')],'comments':_0x6c07('0x12')},'data7':{'type':Sequelize[_0x6c07('0x13')],'comments':_0x6c07('0x14')}}; \ No newline at end of file +var _0x2c75=['browser','script','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize','exports','getDataValue','action','STRING','integration','motionbar','jscripty','urlForward'];(function(_0x482214,_0x2550ff){var _0x38d0cb=function(_0x2ba281){while(--_0x2ba281){_0x482214['push'](_0x482214['shift']());}};_0x38d0cb(++_0x2550ff);}(_0x2c75,0x127));var _0x52c7=function(_0xfc406a,_0x4479e1){_0xfc406a=_0xfc406a-0x0;var _0x395473=_0x2c75[_0xfc406a];return _0x395473;};'use strict';var Sequelize=require(_0x52c7('0x0'));module[_0x52c7('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0xa17760){return this[_0x52c7('0x2')](_0x52c7('0x3'));}},'action':{'type':Sequelize[_0x52c7('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x52c7('0x5'),_0x52c7('0x6'),_0x52c7('0x7'),_0x52c7('0x8'),_0x52c7('0x9'),'bot',_0x52c7('0xa')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x52c7('0x4')](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[_0x52c7('0x4')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x52c7('0xb')},'data4':{'type':Sequelize[_0x52c7('0x4')](0x1000),'comments':_0x52c7('0xc')},'data5':{'type':Sequelize[_0x52c7('0x4')](0x1000),'comments':_0x52c7('0xd')},'data6':{'type':Sequelize[_0x52c7('0x4')],'comments':_0x52c7('0xe')},'data7':{'type':Sequelize[_0x52c7('0xf')],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index a100b1f..3da5555 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 _0x9576=['then','destroy','stack','name','send','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','count','set','Content-Range','json','reject','save','update'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x9576,0x182));var _0x6957=function(_0x40a211,_0x4a0d3c){_0x40a211=_0x40a211-0x0;var _0x5d2a02=_0x9576[_0x40a211];return _0x5d2a02;};'use strict';var emlformat=require(_0x6957('0x0'));var rimraf=require(_0x6957('0x1'));var zipdir=require(_0x6957('0x2'));var jsonpatch=require(_0x6957('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6957('0x4'));var Mustache=require(_0x6957('0x5'));var util=require(_0x6957('0x6'));var path=require(_0x6957('0x7'));var sox=require(_0x6957('0x8'));var csv=require(_0x6957('0x9'));var ejs=require(_0x6957('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6957('0xb'));var squel=require(_0x6957('0xc'));var crypto=require(_0x6957('0xd'));var jsforce=require(_0x6957('0xe'));var deskjs=require(_0x6957('0xf'));var toCsv=require(_0x6957('0x9'));var querystring=require('querystring');var Papa=require(_0x6957('0x10'));var Redis=require(_0x6957('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6957('0x12'));var hardwareService=require(_0x6957('0x13'));var logger=require(_0x6957('0x14'))(_0x6957('0x15'));var utils=require(_0x6957('0x16'));var config=require(_0x6957('0x17'));var licenseUtil=require(_0x6957('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5888d6,_0x548647){_0x548647=_0x548647||0xcc;return function(_0x3f40f0){if(_0x3f40f0){return _0x5888d6[_0x6957('0x19')](_0x548647);}return _0x5888d6[_0x6957('0x1a')](_0x548647)[_0x6957('0x1b')]();};}function respondWithResult(_0x345c3e,_0x1fd3d9){_0x1fd3d9=_0x1fd3d9||0xc8;return function(_0x25d32e){if(_0x25d32e){return _0x345c3e['status'](_0x1fd3d9)['json'](_0x25d32e);}};}function respondWithFilteredResult(_0x4f82cb,_0x35fffc){return function(_0x256ac7){if(_0x256ac7){var _0x228f76=typeof _0x35fffc[_0x6957('0x1c')]==='undefined'&&typeof _0x35fffc[_0x6957('0x1d')]==='undefined';var _0x2a39b5=_0x256ac7[_0x6957('0x1e')];var _0x49aa31=_0x228f76?0x0:_0x35fffc[_0x6957('0x1c')];var _0x448ff6=_0x228f76?_0x256ac7[_0x6957('0x1e')]:_0x35fffc['offset']+_0x35fffc[_0x6957('0x1d')];var _0x2c103c;if(_0x448ff6>=_0x2a39b5){_0x448ff6=_0x2a39b5;_0x2c103c=0xc8;}else{_0x2c103c=0xce;}_0x4f82cb[_0x6957('0x1a')](_0x2c103c);return _0x4f82cb[_0x6957('0x1f')](_0x6957('0x20'),_0x49aa31+'-'+_0x448ff6+'/'+_0x2a39b5)[_0x6957('0x21')](_0x256ac7);}return null;};}function patchUpdates(_0x35ee5b){return function(_0x3081b2){try{jsonpatch['apply'](_0x3081b2,_0x35ee5b,!![]);}catch(_0x5ee3f8){return BPromise[_0x6957('0x22')](_0x5ee3f8);}return _0x3081b2[_0x6957('0x23')]();};}function saveUpdates(_0x18037f,_0x2569f4){return function(_0x3591fa){if(_0x3591fa){return _0x3591fa[_0x6957('0x24')](_0x18037f)[_0x6957('0x25')](function(_0x310a5e){return _0x310a5e;});}return null;};}function removeEntity(_0x56b0ba,_0x2b2dcd){return function(_0x3c9de7){if(_0x3c9de7){return _0x3c9de7[_0x6957('0x26')]()[_0x6957('0x25')](function(){_0x56b0ba['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa1e6af,_0x2a57b6){return function(_0x5c4e49){if(!_0x5c4e49){_0xa1e6af['sendStatus'](0x194);}return _0x5c4e49;};}function handleError(_0x320e7d,_0xa2f92f){_0xa2f92f=_0xa2f92f||0x1f4;return function(_0x3bc22f){logger['error'](_0x3bc22f[_0x6957('0x27')]);if(_0x3bc22f[_0x6957('0x28')]){delete _0x3bc22f[_0x6957('0x28')];}_0x320e7d[_0x6957('0x1a')](_0xa2f92f)[_0x6957('0x29')](_0x3bc22f);};}exports[_0x6957('0x24')]=function(_0x2d33ef,_0x320e1a){if(_0x2d33ef['body']['id']){delete _0x2d33ef[_0x6957('0x2a')]['id'];}return db[_0x6957('0x2b')][_0x6957('0x2c')]({'where':{'id':_0x2d33ef[_0x6957('0x2d')]['id']}})[_0x6957('0x25')](handleEntityNotFound(_0x320e1a,null))[_0x6957('0x25')](saveUpdates(_0x2d33ef[_0x6957('0x2a')],null))[_0x6957('0x25')](respondWithResult(_0x320e1a,null))[_0x6957('0x2e')](handleError(_0x320e1a,null));};exports[_0x6957('0x26')]=function(_0x3de770,_0x4950eb){return db['Action'][_0x6957('0x2c')]({'where':{'id':_0x3de770[_0x6957('0x2d')]['id']}})[_0x6957('0x25')](handleEntityNotFound(_0x4950eb,null))[_0x6957('0x25')](removeEntity(_0x4950eb,null))['catch'](handleError(_0x4950eb,null));}; \ No newline at end of file +var _0x4ee1=['rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','desk.js','to-csv','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','name','send','body','destroy','catch'];(function(_0x40af8d,_0x4ba09d){var _0x39d1a9=function(_0x322d56){while(--_0x322d56){_0x40af8d['push'](_0x40af8d['shift']());}};_0x39d1a9(++_0x4ba09d);}(_0x4ee1,0x1ae));var _0x14ee=function(_0x4946b9,_0x4ca322){_0x4946b9=_0x4946b9-0x0;var _0x9cce5e=_0x4ee1[_0x4946b9];return _0x9cce5e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x14ee('0x0'));var zipdir=require(_0x14ee('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x14ee('0x2'));var moment=require(_0x14ee('0x3'));var BPromise=require(_0x14ee('0x4'));var Mustache=require(_0x14ee('0x5'));var util=require(_0x14ee('0x6'));var path=require(_0x14ee('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x14ee('0x8'));var fs=require('fs');var fs_extra=require(_0x14ee('0x9'));var _=require(_0x14ee('0xa'));var squel=require(_0x14ee('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x14ee('0xc'));var toCsv=require(_0x14ee('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x14ee('0xe'));var hardwareService=require(_0x14ee('0xf'));var logger=require(_0x14ee('0x10'))(_0x14ee('0x11'));var utils=require(_0x14ee('0x12'));var config=require(_0x14ee('0x13'));var licenseUtil=require(_0x14ee('0x14'));var db=require(_0x14ee('0x15'))['db'];function respondWithStatusCode(_0x1683af,_0x20564c){_0x20564c=_0x20564c||0xcc;return function(_0x5a68da){if(_0x5a68da){return _0x1683af[_0x14ee('0x16')](_0x20564c);}return _0x1683af[_0x14ee('0x17')](_0x20564c)[_0x14ee('0x18')]();};}function respondWithResult(_0x2d1e52,_0x5d1521){_0x5d1521=_0x5d1521||0xc8;return function(_0x47a755){if(_0x47a755){return _0x2d1e52['status'](_0x5d1521)[_0x14ee('0x19')](_0x47a755);}};}function respondWithFilteredResult(_0x4882c8,_0x40ab08){return function(_0x4cbe4f){if(_0x4cbe4f){var _0x37361b=typeof _0x40ab08['offset']===_0x14ee('0x1a')&&typeof _0x40ab08[_0x14ee('0x1b')]===_0x14ee('0x1a');var _0x184607=_0x4cbe4f[_0x14ee('0x1c')];var _0x3fa71c=_0x37361b?0x0:_0x40ab08[_0x14ee('0x1d')];var _0x2b5983=_0x37361b?_0x4cbe4f[_0x14ee('0x1c')]:_0x40ab08[_0x14ee('0x1d')]+_0x40ab08[_0x14ee('0x1b')];var _0x4758a5;if(_0x2b5983>=_0x184607){_0x2b5983=_0x184607;_0x4758a5=0xc8;}else{_0x4758a5=0xce;}_0x4882c8[_0x14ee('0x17')](_0x4758a5);return _0x4882c8[_0x14ee('0x1e')](_0x14ee('0x1f'),_0x3fa71c+'-'+_0x2b5983+'/'+_0x184607)[_0x14ee('0x19')](_0x4cbe4f);}return null;};}function patchUpdates(_0x530acb){return function(_0x38bc16){try{jsonpatch[_0x14ee('0x20')](_0x38bc16,_0x530acb,!![]);}catch(_0x34d3f7){return BPromise[_0x14ee('0x21')](_0x34d3f7);}return _0x38bc16[_0x14ee('0x22')]();};}function saveUpdates(_0x2afc82,_0x29a392){return function(_0x46bdac){if(_0x46bdac){return _0x46bdac[_0x14ee('0x23')](_0x2afc82)['then'](function(_0x4379be){return _0x4379be;});}return null;};}function removeEntity(_0x116c45,_0x154b45){return function(_0x52315d){if(_0x52315d){return _0x52315d['destroy']()[_0x14ee('0x24')](function(){_0x116c45[_0x14ee('0x17')](0xcc)[_0x14ee('0x18')]();});}};}function handleEntityNotFound(_0x5b5fd2,_0x2083f3){return function(_0x4fd41b){if(!_0x4fd41b){_0x5b5fd2[_0x14ee('0x16')](0x194);}return _0x4fd41b;};}function handleError(_0x397d88,_0x283711){_0x283711=_0x283711||0x1f4;return function(_0x4c3c2d){logger[_0x14ee('0x25')](_0x4c3c2d['stack']);if(_0x4c3c2d[_0x14ee('0x26')]){delete _0x4c3c2d['name'];}_0x397d88[_0x14ee('0x17')](_0x283711)[_0x14ee('0x27')](_0x4c3c2d);};}exports['update']=function(_0x108bac,_0x455744){if(_0x108bac[_0x14ee('0x28')]['id']){delete _0x108bac[_0x14ee('0x28')]['id'];}return db['Action']['find']({'where':{'id':_0x108bac['params']['id']}})['then'](handleEntityNotFound(_0x455744,null))[_0x14ee('0x24')](saveUpdates(_0x108bac[_0x14ee('0x28')],null))[_0x14ee('0x24')](respondWithResult(_0x455744,null))['catch'](handleError(_0x455744,null));};exports[_0x14ee('0x29')]=function(_0x4a2590,_0x54cd6b){return db['Action']['find']({'where':{'id':_0x4a2590['params']['id']}})[_0x14ee('0x24')](handleEntityNotFound(_0x54cd6b,null))[_0x14ee('0x24')](removeEntity(_0x54cd6b,null))[_0x14ee('0x2a')](handleError(_0x54cd6b,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 629c9f8..fb43fe0 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 _0xd137=['moment','bluebird','request-promise','rimraf','../../config/environment','./action.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0x163cab,_0xae05a6){var _0x22d4c8=function(_0x3b0232){while(--_0x3b0232){_0x163cab['push'](_0x163cab['shift']());}};_0x22d4c8(++_0xae05a6);}(_0xd137,0x140));var _0x7d13=function(_0x26781a,_0x5d2070){_0x26781a=_0x26781a-0x0;var _0x37d270=_0xd137[_0x26781a];return _0x37d270;};'use strict';var _=require(_0x7d13('0x0'));var util=require(_0x7d13('0x1'));var logger=require(_0x7d13('0x2'))(_0x7d13('0x3'));var moment=require(_0x7d13('0x4'));var BPromise=require(_0x7d13('0x5'));var rp=require(_0x7d13('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d13('0x7'));var config=require(_0x7d13('0x8'));var attributes=require(_0x7d13('0x9'));module[_0x7d13('0xa')]=function(_0x4e0c6f,_0x3d2817){return _0x4e0c6f[_0x7d13('0xb')]('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1113=['rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','util','../../config/logger','api','request-promise','path'];(function(_0x113f61,_0x2d3081){var _0x1e8cf6=function(_0x3dc374){while(--_0x3dc374){_0x113f61['push'](_0x113f61['shift']());}};_0x1e8cf6(++_0x2d3081);}(_0x1113,0x16f));var _0x3111=function(_0x5aedea,_0xf4a7f){_0x5aedea=_0x5aedea-0x0;var _0xe35173=_0x1113[_0x5aedea];return _0xe35173;};'use strict';var _=require('lodash');var util=require(_0x3111('0x0'));var logger=require(_0x3111('0x1'))(_0x3111('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3111('0x3'));var fs=require('fs');var path=require(_0x3111('0x4'));var rimraf=require(_0x3111('0x5'));var config=require(_0x3111('0x6'));var attributes=require(_0x3111('0x7'));module[_0x3111('0x8')]=function(_0x482746,_0x48ba8a){return _0x482746[_0x3111('0x9')](_0x3111('0xa'),attributes,{'tableName':_0x3111('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 5867e55..a195ef9 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x53ec,0x192));var _0xc53e=function(_0x30e804,_0x8d453b){_0x30e804=_0x30e804-0x0;var _0x529374=_0x53ec[_0x30e804];return _0x529374;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file +var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x4975,0x86));var _0x5497=function(_0x2f59c9,_0x1b8c20){_0x2f59c9=_0x2f59c9-0x0;var _0x31c216=_0x4975[_0x2f59c9];return _0x31c216;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('Action,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 1ea9316..96bde74 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 _0xe3ca=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update','delete','destroy'];(function(_0x326ea9,_0x1baad3){var _0x20f4a3=function(_0x22c934){while(--_0x22c934){_0x326ea9['push'](_0x326ea9['shift']());}};_0x20f4a3(++_0x1baad3);}(_0xe3ca,0x187));var _0xae3c=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xe3ca[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0xae3c('0x0'));var util=require(_0xae3c('0x1'));var path=require(_0xae3c('0x2'));var timeout=require(_0xae3c('0x3'));var express=require('express');var router=express[_0xae3c('0x4')]();var fs_extra=require(_0xae3c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xae3c('0x6'));var config=require(_0xae3c('0x7'));var controller=require('./action.controller');router[_0xae3c('0x8')](_0xae3c('0x9'),auth[_0xae3c('0xa')](),controller[_0xae3c('0xb')]);router[_0xae3c('0xc')](_0xae3c('0x9'),auth[_0xae3c('0xa')](),controller[_0xae3c('0xd')]);module[_0xae3c('0xe')]=router; \ No newline at end of file +var _0x2218=['../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x2218,0x1cb));var _0x8221=function(_0x5e1e25,_0xdc1421){_0x5e1e25=_0x5e1e25-0x0;var _0x548e5f=_0x2218[_0x5e1e25];return _0x548e5f;};'use strict';var multer=require(_0x8221('0x0'));var util=require(_0x8221('0x1'));var path=require(_0x8221('0x2'));var timeout=require(_0x8221('0x3'));var express=require(_0x8221('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8221('0x5'));var interaction=require(_0x8221('0x6'));var config=require(_0x8221('0x7'));var controller=require(_0x8221('0x8'));router[_0x8221('0x9')](_0x8221('0xa'),auth[_0x8221('0xb')](),controller[_0x8221('0xc')]);router[_0x8221('0xd')](_0x8221('0xa'),auth[_0x8221('0xb')](),controller[_0x8221('0xe')]);module[_0x8221('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 5d26080..d06c46a 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 _0x5d58=['TEXT','STRING'];(function(_0xc37fd1,_0x21fc8b){var _0x2f23e6=function(_0x476d91){while(--_0x476d91){_0xc37fd1['push'](_0xc37fd1['shift']());}};_0x2f23e6(++_0x21fc8b);}(_0x5d58,0x187));var _0x85d5=function(_0x410a90,_0x494e8d){_0x410a90=_0x410a90-0x0;var _0x5a745f=_0x5d58[_0x410a90];return _0x5a745f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x85d5('0x0')]},'conditions':{'type':Sequelize[_0x85d5('0x1')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xda19=['exports','STRING','TEXT'];(function(_0x72ad60,_0x2392a3){var _0x3ebc2e=function(_0x3b6905){while(--_0x3b6905){_0x72ad60['push'](_0x72ad60['shift']());}};_0x3ebc2e(++_0x2392a3);}(_0xda19,0xd5));var _0x9da1=function(_0xcc4dfc,_0x296d80){_0xcc4dfc=_0xcc4dfc-0x0;var _0x377146=_0xda19[_0xcc4dfc];return _0x377146;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'name':{'type':Sequelize[_0x9da1('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x9da1('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x9da1('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index c6883ad..db34426 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 _0x649c=['set','Content-Range','apply','reject','update','then','destroy','name','send','index','map','AnalyticCustomReport','type','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','rawAttributes','length','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Reports','UserProfileSection','userProfileId','CustomReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','replace','function','format','groupBy','orderBy','alias','joins','includes','parentKey','foreignTable','foreignKey','conditions','parse','clone','debug','sequelize','QueryTypes','SELECT','SUM(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','ROUND(%s)','IS\x20NULL','IS\x20NOT\x20NULL','value','order','%s.%s\x20=\x20%s.%s','output','web','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','toString','../../files/reports','savename','countTable','runReport','AVG(%s)','metric','DESC','Limited\x20Query:','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','dbH','status','end','json','offset','undefined','count','limit'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x649c,0x1cf));var _0xc649=function(_0x776936,_0x4a698f){_0x776936=_0x776936-0x0;var _0x3b26b0=_0x649c[_0x776936];return _0x3b26b0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc649('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc649('0x1'));var rp=require(_0xc649('0x2'));var moment=require(_0xc649('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc649('0x4'));var util=require(_0xc649('0x5'));var path=require(_0xc649('0x6'));var sox=require(_0xc649('0x7'));var csv=require(_0xc649('0x8'));var ejs=require(_0xc649('0x9'));var fs=require('fs');var fs_extra=require(_0xc649('0xa'));var _=require(_0xc649('0xb'));var squel=require(_0xc649('0xc'));var crypto=require(_0xc649('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc649('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc649('0xf'));var Papa=require(_0xc649('0x10'));var Redis=require(_0xc649('0x11'));var authService=require(_0xc649('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc649('0x13'));var hardwareService=require(_0xc649('0x14'));var logger=require(_0xc649('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc649('0x16'));var db=require(_0xc649('0x17'))['db'];var dbH=require('../../mysqldb')[_0xc649('0x18')];function respondWithStatusCode(_0x15aa38,_0x134050){_0x134050=_0x134050||0xcc;return function(_0x43cede){if(_0x43cede){return _0x15aa38['sendStatus'](_0x134050);}return _0x15aa38[_0xc649('0x19')](_0x134050)[_0xc649('0x1a')]();};}function respondWithResult(_0x332931,_0x4cf996){_0x4cf996=_0x4cf996||0xc8;return function(_0x4bc2b9){if(_0x4bc2b9){return _0x332931['status'](_0x4cf996)[_0xc649('0x1b')](_0x4bc2b9);}};}function respondWithFilteredResult(_0x45c254,_0x124104){return function(_0x37c8cd){if(_0x37c8cd){var _0x159815=typeof _0x124104[_0xc649('0x1c')]==='undefined'&&typeof _0x124104['limit']===_0xc649('0x1d');var _0x18dcaa=_0x37c8cd['count'];var _0x4820ee=_0x159815?0x0:_0x124104['offset'];var _0x189f8d=_0x159815?_0x37c8cd[_0xc649('0x1e')]:_0x124104[_0xc649('0x1c')]+_0x124104[_0xc649('0x1f')];var _0x5b581b;if(_0x189f8d>=_0x18dcaa){_0x189f8d=_0x18dcaa;_0x5b581b=0xc8;}else{_0x5b581b=0xce;}_0x45c254['status'](_0x5b581b);return _0x45c254[_0xc649('0x20')](_0xc649('0x21'),_0x4820ee+'-'+_0x189f8d+'/'+_0x18dcaa)['json'](_0x37c8cd);}return null;};}function patchUpdates(_0x52928b){return function(_0x384aff){try{jsonpatch[_0xc649('0x22')](_0x384aff,_0x52928b,!![]);}catch(_0x518379){return BPromise[_0xc649('0x23')](_0x518379);}return _0x384aff['save']();};}function saveUpdates(_0xaf4028,_0x1d32ef){return function(_0x4a18af){if(_0x4a18af){return _0x4a18af[_0xc649('0x24')](_0xaf4028)[_0xc649('0x25')](function(_0x149580){return _0x149580;});}return null;};}function removeEntity(_0x4374a2,_0x39da86){return function(_0x900010){if(_0x900010){return _0x900010[_0xc649('0x26')]()[_0xc649('0x25')](function(){var _0x328b4f=_0x900010['get']({'plain':!![]});var _0x5302e2='CustomReports';return db['UserProfileResource'][_0xc649('0x26')]({'where':{'type':_0x5302e2,'resourceId':_0x328b4f['id']}})[_0xc649('0x25')](function(){return _0x900010;});})[_0xc649('0x25')](function(){_0x4374a2[_0xc649('0x19')](0xcc)[_0xc649('0x1a')]();});}};}function handleEntityNotFound(_0xfef499,_0x573a61){return function(_0x5f1141){if(!_0x5f1141){_0xfef499['sendStatus'](0x194);}return _0x5f1141;};}function handleError(_0x4e74f0,_0x3c5fbe){_0x3c5fbe=_0x3c5fbe||0x1f4;return function(_0xe9319d){logger['error'](_0xe9319d['stack']);if(_0xe9319d[_0xc649('0x27')]){delete _0xe9319d[_0xc649('0x27')];}_0x4e74f0['status'](_0x3c5fbe)[_0xc649('0x28')](_0xe9319d);};}exports[_0xc649('0x29')]=function(_0x2990da,_0x1038a9){var _0x404b24={},_0xedd296={},_0x115722={'count':0x0,'rows':[]};var _0x203a5c=_[_0xc649('0x2a')](db[_0xc649('0x2b')]['rawAttributes'],function(_0x34e791){return{'name':_0x34e791['fieldName'],'type':_0x34e791[_0xc649('0x2c')]['key']};});_0xedd296[_0xc649('0x2d')]=_[_0xc649('0x2a')](_0x203a5c,_0xc649('0x27'));_0xedd296[_0xc649('0x2e')]=_['keys'](_0x2990da['query']);_0xedd296['filters']=_[_0xc649('0x2f')](_0xedd296[_0xc649('0x2d')],_0xedd296['query']);_0x404b24[_0xc649('0x30')]=_[_0xc649('0x2f')](_0xedd296[_0xc649('0x2d')],qs[_0xc649('0x31')](_0x2990da[_0xc649('0x2e')][_0xc649('0x31')]));_0x404b24['attributes']=_0x404b24[_0xc649('0x30')]['length']?_0x404b24[_0xc649('0x30')]:_0xedd296['model'];if(!_0x2990da[_0xc649('0x2e')][_0xc649('0x32')](_0xc649('0x33'))){_0x404b24['limit']=qs[_0xc649('0x1f')](_0x2990da[_0xc649('0x2e')]['limit']);_0x404b24[_0xc649('0x1c')]=qs[_0xc649('0x1c')](_0x2990da['query'][_0xc649('0x1c')]);}_0x404b24['order']=qs[_0xc649('0x34')](_0x2990da[_0xc649('0x2e')]['sort']);_0x404b24[_0xc649('0x35')]=qs[_0xc649('0x36')](_[_0xc649('0x37')](_0x2990da[_0xc649('0x2e')],_0xedd296[_0xc649('0x36')]),_0x203a5c);if(_0x2990da[_0xc649('0x2e')][_0xc649('0x38')]){_0x404b24[_0xc649('0x35')]=_[_0xc649('0x39')](_0x404b24[_0xc649('0x35')],{'$or':_[_0xc649('0x2a')](_0x203a5c,function(_0x5525c9){if(_0x5525c9[_0xc649('0x2c')]!==_0xc649('0x3a')){var _0x4ad7a6={};_0x4ad7a6[_0x5525c9[_0xc649('0x27')]]={'$like':'%'+_0x2990da[_0xc649('0x2e')][_0xc649('0x38')]+'%'};return _0x4ad7a6;}})});}_0x404b24=_[_0xc649('0x39')]({},_0x404b24,_0x2990da[_0xc649('0x3b')]);var _0x535c33={'where':_0x404b24[_0xc649('0x35')]};return db[_0xc649('0x2b')][_0xc649('0x1e')](_0x535c33)['then'](function(_0xe2695f){_0x115722['count']=_0xe2695f;if(_0x2990da[_0xc649('0x2e')][_0xc649('0x3c')]){_0x404b24['include']=[{'all':!![]}];}return db[_0xc649('0x2b')][_0xc649('0x3d')](_0x404b24);})['then'](function(_0xd7c0d0){_0x115722['rows']=_0xd7c0d0;return _0x115722;})['then'](respondWithFilteredResult(_0x1038a9,_0x404b24))[_0xc649('0x3e')](handleError(_0x1038a9,null));};exports[_0xc649('0x3f')]=function(_0x29ccdb,_0x941bb9){var _0x1d3aad={'raw':![],'where':{'id':_0x29ccdb[_0xc649('0x40')]['id']}},_0x323003={};_0x323003[_0xc649('0x2d')]=_[_0xc649('0x41')](db[_0xc649('0x2b')][_0xc649('0x42')]);_0x323003[_0xc649('0x2e')]=_[_0xc649('0x41')](_0x29ccdb['query']);_0x323003[_0xc649('0x36')]=_[_0xc649('0x2f')](_0x323003[_0xc649('0x2d')],_0x323003[_0xc649('0x2e')]);_0x1d3aad['attributes']=_[_0xc649('0x2f')](_0x323003[_0xc649('0x2d')],qs[_0xc649('0x31')](_0x29ccdb[_0xc649('0x2e')][_0xc649('0x31')]));_0x1d3aad[_0xc649('0x30')]=_0x1d3aad[_0xc649('0x30')][_0xc649('0x43')]?_0x1d3aad[_0xc649('0x30')]:_0x323003[_0xc649('0x2d')];if(_0x29ccdb['query'][_0xc649('0x3c')]){_0x1d3aad[_0xc649('0x44')]=[{'all':!![]}];}_0x1d3aad=_[_0xc649('0x39')]({},_0x1d3aad,_0x29ccdb[_0xc649('0x3b')]);return db[_0xc649('0x2b')][_0xc649('0x45')](_0x1d3aad)[_0xc649('0x25')](handleEntityNotFound(_0x941bb9,null))['then'](respondWithResult(_0x941bb9,null))[_0xc649('0x3e')](handleError(_0x941bb9,null));};exports[_0xc649('0x46')]=function(_0x1868e1,_0x2c1f8c){return db[_0xc649('0x2b')][_0xc649('0x46')](_0x1868e1[_0xc649('0x47')],{})[_0xc649('0x25')](function(_0x42669b){var _0x32d9b5=_0x1868e1['user'][_0xc649('0x48')]({'plain':!![]});if(!_0x32d9b5)throw new Error(_0xc649('0x49'));if(_0x32d9b5['role']===_0xc649('0x4a')){var _0x3c75ac=_0x42669b[_0xc649('0x48')]({'plain':!![]});var _0x501308=_0xc649('0x4b');return db[_0xc649('0x4c')]['find']({'where':{'name':_0x501308,'userProfileId':_0x32d9b5[_0xc649('0x4d')]},'raw':!![]})['then'](function(_0x10b102){if(_0x10b102&&_0x10b102['autoAssociation']===0x0){return db['UserProfileResource'][_0xc649('0x46')]({'name':_0x3c75ac[_0xc649('0x27')],'resourceId':_0x3c75ac['id'],'type':_0xc649('0x4e'),'sectionId':_0x10b102['id']},{})[_0xc649('0x25')](function(){return _0x42669b;});}else{return _0x42669b;}})[_0xc649('0x3e')](function(_0x42f346){logger[_0xc649('0x4f')](_0xc649('0x50'),_0x42f346);throw _0x42f346;});}return _0x42669b;})[_0xc649('0x25')](respondWithResult(_0x2c1f8c,0xc9))[_0xc649('0x3e')](handleError(_0x2c1f8c,null));};exports[_0xc649('0x24')]=function(_0x4f26f3,_0x54b15a){if(_0x4f26f3[_0xc649('0x47')]['id']){delete _0x4f26f3[_0xc649('0x47')]['id'];}return db[_0xc649('0x2b')][_0xc649('0x45')]({'where':{'id':_0x4f26f3[_0xc649('0x40')]['id']}})[_0xc649('0x25')](handleEntityNotFound(_0x54b15a,null))[_0xc649('0x25')](saveUpdates(_0x4f26f3[_0xc649('0x47')],null))[_0xc649('0x25')](respondWithResult(_0x54b15a,null))[_0xc649('0x3e')](handleError(_0x54b15a,null));};exports[_0xc649('0x26')]=function(_0x5acbca,_0x574045){return db[_0xc649('0x2b')][_0xc649('0x45')]({'where':{'id':_0x5acbca[_0xc649('0x40')]['id']}})['then'](handleEntityNotFound(_0x574045,null))[_0xc649('0x25')](removeEntity(_0x574045,null))['catch'](handleError(_0x574045,null));};exports[_0xc649('0x51')]=function(_0x303d44,_0x763325){var _0x58f999=0xa;var _0x6851c2=[_0xc649('0x52'),_0xc649('0x53'),_0xc649('0x54'),_0xc649('0x55')];var _0x3fe388={'SUM':'SUM(%s)','COUNT':_0xc649('0x56'),'COUNT DISTINCT':_0xc649('0x57'),'MAX':_0xc649('0x58'),'MIN':_0xc649('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xc649('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5be926={'SEC_TO_TIME':_0xc649('0x5b'),'DATE':_0xc649('0x5c'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xc649('0x5d')};var _0x56f486=function(_0x45d186){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0xc649('0x5e'),_0xc649('0x5f')],_0x45d186);};var _0xd99c74=function(_0x128ce2){if(!_0x128ce2||!_0x128ce2[_0xc649('0x60')][_0xc649('0x43')]){return'';}for(var _0x3bdf31='(',_0x50ee92=0x0;_0x50ee92<_0x128ce2[_0xc649('0x60')][_0xc649('0x43')];_0x50ee92+=0x1){_0x50ee92>0x0&&(_0x3bdf31+='\x20'+_0x128ce2[_0xc649('0x61')]+'\x20');_0x3bdf31+=_0x128ce2[_0xc649('0x60')][_0x50ee92][_0xc649('0x62')]?_0xd99c74(_0x128ce2[_0xc649('0x60')][_0x50ee92][_0xc649('0x62')]):_0x128ce2['rules'][_0x50ee92][_0xc649('0x63')]+'\x20'+_0x128ce2[_0xc649('0x60')][_0x50ee92][_0xc649('0x64')]+(_0x56f486(_0x128ce2[_0xc649('0x60')][_0x50ee92][_0xc649('0x64')])?'\x20'+_0x128ce2[_0xc649('0x60')][_0x50ee92]['value']:'');}return _0x3bdf31+')';};var _0x6b99e5={'where':{'id':_0x303d44['params']['id']}},_0x27af66,_0x5406c0,_0x5eec34,_0x3bf7c5,_0x194236;_0x6b99e5=_[_0xc649('0x39')]({},_0x6b99e5,_0x303d44[_0xc649('0x3b')]);return db[_0xc649('0x2b')]['find'](_0x6b99e5)['then'](function(_0x8f73bc){if(_0x8f73bc){_0x27af66=_0x8f73bc;return _0x8f73bc[_0xc649('0x65')]();}return null;})[_0xc649('0x25')](function(_0x4b9823){if(_0x4b9823){if(!_0x4b9823[_0xc649('0x43')]){throw new db[(_0xc649('0x66'))][(_0xc649('0x67'))](_0xc649('0x68'),0x193);}_0x5406c0=_0x4b9823;return db[_0xc649('0x69')][_0xc649('0x3d')]({'raw':!![]});}return null;})[_0xc649('0x25')](function(_0x30b1a8){if(_0x30b1a8){_0x5eec34=_[_0xc649('0x6a')](_0x30b1a8,'id');var _0x3f9a0d;var _0x750537=squel[_0xc649('0x6b')]();_0x750537[_0xc649('0x6c')](_0x27af66[_0xc649('0x6d')]);for(var _0x3f2977=0x0;_0x3f2977<_0x5406c0[_0xc649('0x43')];_0x3f2977+=0x1){_0x3f9a0d=_0x5406c0[_0x3f2977][_0xc649('0x6e')]?_0x5eec34[_0x5406c0[_0x3f2977][_0xc649('0x6e')]]['metric']:_0x5406c0[_0x3f2977][_0xc649('0x63')];_0x3f9a0d=_0x5406c0[_0x3f2977]['function']?_[_0xc649('0x6f')](_0x3fe388[_0x5406c0[_0x3f2977][_0xc649('0x70')]],'%s',_0x3f9a0d):_0x3f9a0d;_0x3f9a0d=_0x5406c0[_0x3f2977][_0xc649('0x71')]?_[_0xc649('0x6f')](_0x5be926[_0x5406c0[_0x3f2977][_0xc649('0x71')]],'%s',_0x3f9a0d):_0x3f9a0d;if(_0x5406c0[_0x3f2977][_0xc649('0x72')]){_0x750537[_0xc649('0x62')](_0x3f9a0d);}_0x5406c0[_0x3f2977][_0xc649('0x73')]&&_0x750537['order'](_0x3f9a0d,_0x5406c0[_0x3f2977][_0xc649('0x73')]==='DESC'?![]:!![]);_0x750537[_0xc649('0x63')](_0x3f9a0d,_0x5406c0[_0x3f2977][_0xc649('0x74')]||_0x3f9a0d);}if(_0x27af66[_0xc649('0x75')]){_0x27af66['joins']=JSON['parse'](_0x27af66[_0xc649('0x75')]);for(var _0x2381c3=0x0;_0x2381c3<_0x27af66['joins'][_0xc649('0x43')];_0x2381c3+=0x1){if(_0x27af66[_0xc649('0x75')][_0x2381c3][_0xc649('0x2c')]&&_[_0xc649('0x76')](_0x6851c2,_0x27af66[_0xc649('0x75')][_0x2381c3][_0xc649('0x2c')])&&_0x27af66[_0xc649('0x75')][_0x2381c3][_0xc649('0x77')]&&_0x27af66[_0xc649('0x75')][_0x2381c3][_0xc649('0x78')]&&_0x27af66[_0xc649('0x75')][_0x2381c3][_0xc649('0x79')]){_0x750537[_0x27af66['joins'][_0x2381c3][_0xc649('0x2c')]](_0x27af66['joins'][_0x2381c3][_0xc649('0x78')],null,util[_0xc649('0x71')]('%s.%s\x20=\x20%s.%s',_0x27af66[_0xc649('0x6d')],_0x27af66[_0xc649('0x75')][_0x2381c3][_0xc649('0x77')],_0x27af66[_0xc649('0x75')][_0x2381c3][_0xc649('0x78')],_0x27af66['joins'][_0x2381c3][_0xc649('0x79')]));}}}if(_0x27af66[_0xc649('0x7a')]){_0x27af66['conditions']=JSON[_0xc649('0x7b')](_0x27af66['conditions']);_0x750537[_0xc649('0x35')](_0xd99c74(_0x27af66['conditions']['group']));}_0x194236=_0x750537[_0xc649('0x7c')]();_0x750537['limit'](_0x58f999);_0x750537[_0xc649('0x1c')](0x0);logger[_0xc649('0x7d')]('Limited\x20Query:',_0x750537['toString']());return dbH[_0xc649('0x7e')][_0xc649('0x2e')](_0x750537['toString'](),{'type':dbH[_0xc649('0x7e')][_0xc649('0x7f')][_0xc649('0x80')]});}})[_0xc649('0x25')](respondWithResult(_0x763325,null))[_0xc649('0x3e')](handleError(_0x763325,null));};function runReport(_0x62ba8e,_0x27a4e0,_0x46114a){var _0x10ea27=_0x27a4e0['name'];var _0x137e46=0xa;var _0x3a321c=['join','left_join','right_join',_0xc649('0x55')];var _0x401e37={'SUM':_0xc649('0x81'),'COUNT':_0xc649('0x56'),'COUNT DISTINCT':_0xc649('0x57'),'MAX':_0xc649('0x58'),'MIN':_0xc649('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc649('0x82'),'GROUP_CONCAT DESC':_0xc649('0x83')};var _0x112b2b={'SEC_TO_TIME':_0xc649('0x5b'),'DATE':_0xc649('0x5c'),'HOUR':_0xc649('0x84'),'ROUND':_0xc649('0x85'),'UNIX_TIMESTAMP':_0xc649('0x5d')};var _0x2a7125=function(_0x2c0c93){return!_[_0xc649('0x76')]([_0xc649('0x86'),_0xc649('0x87'),_0xc649('0x5e'),_0xc649('0x5f')],_0x2c0c93);};var _0x240f80=function(_0x2f1a18){if(!_0x2f1a18||!_0x2f1a18[_0xc649('0x60')]['length']){return'';}for(var _0x468467='(',_0x336ac2=0x0;_0x336ac2<_0x2f1a18[_0xc649('0x60')]['length'];_0x336ac2+=0x1){_0x336ac2>0x0&&(_0x468467+='\x20'+_0x2f1a18[_0xc649('0x61')]+'\x20');_0x468467+=_0x2f1a18[_0xc649('0x60')][_0x336ac2][_0xc649('0x62')]?_0x240f80(_0x2f1a18[_0xc649('0x60')][_0x336ac2]['group']):_0x2f1a18[_0xc649('0x60')][_0x336ac2][_0xc649('0x63')]+'\x20'+_0x2f1a18['rules'][_0x336ac2][_0xc649('0x64')]+(_0x2a7125(_0x2f1a18[_0xc649('0x60')][_0x336ac2][_0xc649('0x64')])?'\x20'+_0x2f1a18['rules'][_0x336ac2][_0xc649('0x88')]:'');}return _0x468467+')';};var _0x63c35a={'where':{'id':_0x62ba8e['id']}},_0x46d4c2,_0x78bfb4,_0x27ddad,_0xd92bf9,_0x13931d;_0x63c35a=_[_0xc649('0x39')]({},_0x63c35a,_0x46114a);return db[_0xc649('0x2b')][_0xc649('0x45')](_0x63c35a)[_0xc649('0x25')](function(_0x8419da){if(_0x8419da){_0x46d4c2=_0x8419da;return _0x8419da[_0xc649('0x65')]();}return null;})[_0xc649('0x25')](function(_0xef7261){if(_0xef7261){if(!_0xef7261['length']){throw new db['Sequelize'][(_0xc649('0x67'))](_0xc649('0x68'),0x193);}_0x78bfb4=_0xef7261;return db[_0xc649('0x69')][_0xc649('0x3d')]({'raw':!![]});}return null;})[_0xc649('0x25')](function(_0x3beca5){if(_0x3beca5){_0x27ddad=_[_0xc649('0x6a')](_0x3beca5,'id');var _0x255ce3;var _0x1fe615=squel[_0xc649('0x6b')]();_0x1fe615[_0xc649('0x6c')](_0x46d4c2[_0xc649('0x6d')]);for(var _0x4d8733=0x0;_0x4d8733<_0x78bfb4[_0xc649('0x43')];_0x4d8733+=0x1){_0x255ce3=_0x78bfb4[_0x4d8733][_0xc649('0x6e')]?_0x27ddad[_0x78bfb4[_0x4d8733][_0xc649('0x6e')]]['metric']:_0x78bfb4[_0x4d8733][_0xc649('0x63')];_0x255ce3=_0x78bfb4[_0x4d8733][_0xc649('0x70')]?_['replace'](_0x401e37[_0x78bfb4[_0x4d8733][_0xc649('0x70')]],'%s',_0x255ce3):_0x255ce3;_0x255ce3=_0x78bfb4[_0x4d8733][_0xc649('0x71')]?_[_0xc649('0x6f')](_0x112b2b[_0x78bfb4[_0x4d8733]['format']],'%s',_0x255ce3):_0x255ce3;if(_0x78bfb4[_0x4d8733][_0xc649('0x72')]){_0x1fe615['group'](_0x255ce3);}_0x78bfb4[_0x4d8733][_0xc649('0x73')]&&_0x1fe615[_0xc649('0x89')](_0x255ce3,_0x78bfb4[_0x4d8733][_0xc649('0x73')]==='DESC'?![]:!![]);_0x1fe615[_0xc649('0x63')](_0x255ce3,_0x78bfb4[_0x4d8733]['alias']||_0x255ce3);}if(_0x46d4c2[_0xc649('0x75')]){_0x46d4c2[_0xc649('0x75')]=JSON[_0xc649('0x7b')](_0x46d4c2[_0xc649('0x75')]);for(var _0x51b8b0=0x0;_0x51b8b0<_0x46d4c2[_0xc649('0x75')][_0xc649('0x43')];_0x51b8b0+=0x1){if(_0x46d4c2['joins'][_0x51b8b0]['type']&&_['includes'](_0x3a321c,_0x46d4c2['joins'][_0x51b8b0][_0xc649('0x2c')])&&_0x46d4c2[_0xc649('0x75')][_0x51b8b0]['parentKey']&&_0x46d4c2['joins'][_0x51b8b0]['foreignTable']&&_0x46d4c2[_0xc649('0x75')][_0x51b8b0][_0xc649('0x79')]){_0x1fe615[_0x46d4c2[_0xc649('0x75')][_0x51b8b0]['type']](_0x46d4c2[_0xc649('0x75')][_0x51b8b0][_0xc649('0x78')],null,util[_0xc649('0x71')](_0xc649('0x8a'),_0x46d4c2[_0xc649('0x6d')],_0x46d4c2[_0xc649('0x75')][_0x51b8b0]['parentKey'],_0x46d4c2[_0xc649('0x75')][_0x51b8b0][_0xc649('0x78')],_0x46d4c2[_0xc649('0x75')][_0x51b8b0][_0xc649('0x79')]));}}}if(_0x46d4c2[_0xc649('0x7a')]){_0x46d4c2[_0xc649('0x7a')]=JSON[_0xc649('0x7b')](_0x46d4c2['conditions']);_0x1fe615['where'](_0x240f80(_0x46d4c2[_0xc649('0x7a')]['group']));}_0x13931d=_0x1fe615[_0xc649('0x7c')]();_0x1fe615[_0xc649('0x1f')](_0x137e46);_0x1fe615[_0xc649('0x1c')](0x0);return;}})['then'](function(){if(_0x27a4e0[_0xc649('0x8b')]===_0xc649('0x8c')){return null;}var _0x416cb8=_[_0xc649('0x39')](_0x27a4e0,{'name':_0x27a4e0['fullPath']||_0x27a4e0[_0xc649('0x27')]||_0x46d4c2['name'],'basename':_0x10ea27,'savename':util[_0xc649('0x71')](_0xc649('0x8d'),_0x27a4e0[_0xc649('0x27')]||_0x46d4c2['name'],require(_0xc649('0x8e'))[_0xc649('0x8f')](0x4),_0x27a4e0[_0xc649('0x8b')]||_0xc649('0x90')),'reportId':_0x46d4c2['id'],'reportType':_0xc649('0x91')});return db[_0xc649('0x92')][_0xc649('0x46')](_0x416cb8,{'raw':!![]});})[_0xc649('0x25')](function(_0x28b04b){if(_0x46d4c2[_0xc649('0x6d')]===_0xc649('0x93')){_0x13931d[_0xc649('0x35')](_0x46d4c2['table']+_0xc649('0x94'),_0x27a4e0[_0xc649('0x95')],_0x27a4e0[_0xc649('0x96')]);}else{_0x13931d[_0xc649('0x35')](_0x46d4c2[_0xc649('0x6d')]+_0xc649('0x97'),_0x27a4e0[_0xc649('0x95')],_0x27a4e0[_0xc649('0x96')]);}if(_0x28b04b){logger[_0xc649('0x98')]('Run\x20Query:',_0x13931d['toString']());require(_0xc649('0x99'))[_0xc649('0x9a')](path[_0xc649('0x52')](__dirname,_0xc649('0x9b'),_0x28b04b[_0xc649('0x8b')]),[_0x28b04b['id'],_0x13931d[_0xc649('0x9c')](),path[_0xc649('0x52')](__dirname,_0xc649('0x9d'),_0x28b04b[_0xc649('0x9e')]),_0x10ea27]);return _0x28b04b;}else{var _0x258ea8=squel[_0xc649('0x6b')]();_0x258ea8['from']('('+_0x13931d['toString']()+')',_0xc649('0x9f'));_0x258ea8['field']('COUNT(*)',_0xc649('0x1e'));_0x13931d[_0xc649('0x1f')](_0x27a4e0[_0xc649('0x1f')]||_0x137e46);_0x13931d['offset'](_0x27a4e0[_0xc649('0x1c')]||0x0);return dbH[_0xc649('0x7e')]['query'](_0x258ea8[_0xc649('0x9c')](),{'type':dbH['sequelize'][_0xc649('0x7f')][_0xc649('0x80')]})[_0xc649('0x25')](function(_0x41f575){if(!_0x41f575['length']){_0xd92bf9=0x0;}else{_0xd92bf9=_0x41f575[0x0][_0xc649('0x1e')]||0x0;}return dbH['sequelize']['query'](_0x13931d[_0xc649('0x9c')](),{'type':dbH['sequelize'][_0xc649('0x7f')][_0xc649('0x80')]});})['then'](function(_0x25cf6a){return{'rows':_0x25cf6a||[],'count':_0xd92bf9};});}});}exports['run']=function(_0x46e901,_0x50b363){return runReport(_0x46e901['params'],_0x46e901[_0xc649('0x2e')],_0x46e901[_0xc649('0x3b')])['then'](respondWithResult(_0x50b363,null))[_0xc649('0x3e')](handleError(_0x50b363,null));};exports[_0xc649('0xa0')]=runReport;exports[_0xc649('0x2e')]=function(_0x8e9542,_0x1f0f15){var _0x53f30a=0xa;var _0x31ed41=[_0xc649('0x52'),_0xc649('0x53'),_0xc649('0x54'),'cross_join'];var _0x582f5a={'SUM':_0xc649('0x81'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc649('0x57'),'MAX':_0xc649('0x58'),'MIN':_0xc649('0x59'),'AVG':_0xc649('0xa1'),'GROUP_CONCAT':_0xc649('0x5a'),'GROUP_CONCAT ASC':_0xc649('0x82'),'GROUP_CONCAT DESC':_0xc649('0x83')};var _0x2d5424={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xc649('0x5c'),'HOUR':_0xc649('0x84'),'ROUND':_0xc649('0x85'),'UNIX_TIMESTAMP':_0xc649('0x5d')};var _0x1af908=function(_0x19c760){return!_[_0xc649('0x76')]([_0xc649('0x86'),_0xc649('0x87'),_0xc649('0x5e'),_0xc649('0x5f')],_0x19c760);};var _0x5b819c=function(_0x477496){if(!_0x477496||!_0x477496['rules'][_0xc649('0x43')]){return'';}for(var _0x1279ad='(',_0x2f5456=0x0;_0x2f5456<_0x477496[_0xc649('0x60')]['length'];_0x2f5456+=0x1){_0x2f5456>0x0&&(_0x1279ad+='\x20'+_0x477496[_0xc649('0x61')]+'\x20');_0x1279ad+=_0x477496['rules'][_0x2f5456]['group']?_0x5b819c(_0x477496['rules'][_0x2f5456]['group']):_0x477496['rules'][_0x2f5456][_0xc649('0x63')]+'\x20'+_0x477496[_0xc649('0x60')][_0x2f5456][_0xc649('0x64')]+(_0x1af908(_0x477496[_0xc649('0x60')][_0x2f5456]['condition'])?'\x20'+_0x477496['rules'][_0x2f5456][_0xc649('0x88')]:'');}return _0x1279ad+')';};var _0x56d113={'where':{'id':_0x8e9542['params']['id']}},_0x33cb19,_0x53d525,_0x26ed09,_0x35cd28,_0x5cb9e9;_0x56d113=_[_0xc649('0x39')]({},_0x56d113,_0x8e9542[_0xc649('0x3b')]);return db[_0xc649('0x2b')][_0xc649('0x45')](_0x56d113)[_0xc649('0x25')](function(_0xd033a8){if(_0xd033a8){_0x33cb19=_0xd033a8;return _0xd033a8['getFields']();}return null;})['then'](function(_0x12c93c){if(_0x12c93c){if(!_0x12c93c[_0xc649('0x43')]){throw new db['Sequelize'][(_0xc649('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x53d525=_0x12c93c;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x41ec39){if(_0x41ec39){_0x26ed09=_[_0xc649('0x6a')](_0x41ec39,'id');var _0x1e624f;var _0x520d86=squel[_0xc649('0x6b')]();_0x520d86['from'](_0x33cb19[_0xc649('0x6d')]);for(var _0x8bcf2f=0x0;_0x8bcf2f<_0x53d525['length'];_0x8bcf2f+=0x1){_0x1e624f=_0x53d525[_0x8bcf2f][_0xc649('0x6e')]?_0x26ed09[_0x53d525[_0x8bcf2f][_0xc649('0x6e')]][_0xc649('0xa2')]:_0x53d525[_0x8bcf2f][_0xc649('0x63')];_0x1e624f=_0x53d525[_0x8bcf2f][_0xc649('0x70')]?_['replace'](_0x582f5a[_0x53d525[_0x8bcf2f][_0xc649('0x70')]],'%s',_0x1e624f):_0x1e624f;_0x1e624f=_0x53d525[_0x8bcf2f]['format']?_[_0xc649('0x6f')](_0x2d5424[_0x53d525[_0x8bcf2f][_0xc649('0x71')]],'%s',_0x1e624f):_0x1e624f;if(_0x53d525[_0x8bcf2f][_0xc649('0x72')]){_0x520d86['group'](_0x1e624f);}_0x53d525[_0x8bcf2f]['orderBy']&&_0x520d86[_0xc649('0x89')](_0x1e624f,_0x53d525[_0x8bcf2f][_0xc649('0x73')]===_0xc649('0xa3')?![]:!![]);_0x520d86[_0xc649('0x63')](_0x1e624f,_0x53d525[_0x8bcf2f][_0xc649('0x74')]||_0x1e624f);}if(_0x33cb19[_0xc649('0x75')]){_0x33cb19[_0xc649('0x75')]=JSON[_0xc649('0x7b')](_0x33cb19['joins']);for(var _0x4801c4=0x0;_0x4801c4<_0x33cb19[_0xc649('0x75')][_0xc649('0x43')];_0x4801c4+=0x1){if(_0x33cb19[_0xc649('0x75')][_0x4801c4][_0xc649('0x2c')]&&_[_0xc649('0x76')](_0x31ed41,_0x33cb19[_0xc649('0x75')][_0x4801c4][_0xc649('0x2c')])&&_0x33cb19[_0xc649('0x75')][_0x4801c4][_0xc649('0x77')]&&_0x33cb19[_0xc649('0x75')][_0x4801c4][_0xc649('0x78')]&&_0x33cb19[_0xc649('0x75')][_0x4801c4]['foreignKey']){_0x520d86[_0x33cb19[_0xc649('0x75')][_0x4801c4][_0xc649('0x2c')]](_0x33cb19['joins'][_0x4801c4][_0xc649('0x78')],null,util[_0xc649('0x71')](_0xc649('0x8a'),_0x33cb19['table'],_0x33cb19['joins'][_0x4801c4][_0xc649('0x77')],_0x33cb19[_0xc649('0x75')][_0x4801c4]['foreignTable'],_0x33cb19[_0xc649('0x75')][_0x4801c4][_0xc649('0x79')]));}}}if(_0x33cb19[_0xc649('0x7a')]){_0x33cb19[_0xc649('0x7a')]=JSON[_0xc649('0x7b')](_0x33cb19[_0xc649('0x7a')]);_0x520d86[_0xc649('0x35')](_0x5b819c(_0x33cb19[_0xc649('0x7a')][_0xc649('0x62')]));}_0x5cb9e9=_0x520d86['clone']();_0x520d86['limit'](_0x53f30a);_0x520d86[_0xc649('0x1c')](0x0);logger[_0xc649('0x7d')](_0xc649('0xa4'),_0x520d86[_0xc649('0x9c')]());return dbH['sequelize'][_0xc649('0x2e')](_0x520d86['toString'](),{'type':dbH[_0xc649('0x7e')][_0xc649('0x7f')][_0xc649('0x80')]});}})[_0xc649('0x25')](function(){return{'sql':_0x5cb9e9['toString']()};})[_0xc649('0x25')](respondWithResult(_0x1f0f15,null))[_0xc649('0x3e')](handleError(_0x1f0f15,null));}; \ No newline at end of file +var _0x8254=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','CustomReports','UserProfileResource','destroy','error','name','send','index','AnalyticCustomReport','rawAttributes','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','map','type','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','catch','body','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','function','format','replace','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','left_join','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','value','parentKey','web','%s-%s.%s','randomstring','generate','output','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','run','runReport','MAX(%s)','metric','%s.%s\x20=\x20%s.%s','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4b817c,_0x8099e3){var _0x5ccf31=function(_0x5c37c5){while(--_0x5c37c5){_0x4b817c['push'](_0x4b817c['shift']());}};_0x5ccf31(++_0x8099e3);}(_0x8254,0x95));var _0x4825=function(_0xb12148,_0xe8d5c1){_0xb12148=_0xb12148-0x0;var _0x4570fd=_0x8254[_0xb12148];return _0x4570fd;};'use strict';var emlformat=require(_0x4825('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4825('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4825('0x2'));var moment=require(_0x4825('0x3'));var BPromise=require(_0x4825('0x4'));var Mustache=require('mustache');var util=require(_0x4825('0x5'));var path=require(_0x4825('0x6'));var sox=require(_0x4825('0x7'));var csv=require(_0x4825('0x8'));var ejs=require(_0x4825('0x9'));var fs=require('fs');var fs_extra=require(_0x4825('0xa'));var _=require('lodash');var squel=require(_0x4825('0xb'));var crypto=require(_0x4825('0xc'));var jsforce=require(_0x4825('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4825('0x8'));var querystring=require(_0x4825('0xe'));var Papa=require(_0x4825('0xf'));var Redis=require(_0x4825('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4825('0x11'));var as=require(_0x4825('0x12'));var hardwareService=require(_0x4825('0x13'));var logger=require('../../config/logger')(_0x4825('0x14'));var utils=require(_0x4825('0x15'));var config=require(_0x4825('0x16'));var licenseUtil=require(_0x4825('0x17'));var db=require(_0x4825('0x18'))['db'];var dbH=require('../../mysqldb')[_0x4825('0x19')];function respondWithStatusCode(_0x37cb62,_0x3d544d){_0x3d544d=_0x3d544d||0xcc;return function(_0x3bc633){if(_0x3bc633){return _0x37cb62[_0x4825('0x1a')](_0x3d544d);}return _0x37cb62[_0x4825('0x1b')](_0x3d544d)[_0x4825('0x1c')]();};}function respondWithResult(_0x1c903c,_0x7ac2e2){_0x7ac2e2=_0x7ac2e2||0xc8;return function(_0x483d0e){if(_0x483d0e){return _0x1c903c[_0x4825('0x1b')](_0x7ac2e2)[_0x4825('0x1d')](_0x483d0e);}};}function respondWithFilteredResult(_0x264845,_0x29628e){return function(_0x5b63d0){if(_0x5b63d0){var _0x52101e=typeof _0x29628e['offset']===_0x4825('0x1e')&&typeof _0x29628e[_0x4825('0x1f')]===_0x4825('0x1e');var _0xfe92ce=_0x5b63d0[_0x4825('0x20')];var _0x3b3a52=_0x52101e?0x0:_0x29628e[_0x4825('0x21')];var _0x1de7ae=_0x52101e?_0x5b63d0['count']:_0x29628e[_0x4825('0x21')]+_0x29628e[_0x4825('0x1f')];var _0xdf1083;if(_0x1de7ae>=_0xfe92ce){_0x1de7ae=_0xfe92ce;_0xdf1083=0xc8;}else{_0xdf1083=0xce;}_0x264845[_0x4825('0x1b')](_0xdf1083);return _0x264845[_0x4825('0x22')](_0x4825('0x23'),_0x3b3a52+'-'+_0x1de7ae+'/'+_0xfe92ce)[_0x4825('0x1d')](_0x5b63d0);}return null;};}function patchUpdates(_0x843363){return function(_0x147b7c){try{jsonpatch[_0x4825('0x24')](_0x147b7c,_0x843363,!![]);}catch(_0x147b1a){return BPromise[_0x4825('0x25')](_0x147b1a);}return _0x147b7c['save']();};}function saveUpdates(_0x53b6cd,_0x45a011){return function(_0x3abcf6){if(_0x3abcf6){return _0x3abcf6[_0x4825('0x26')](_0x53b6cd)[_0x4825('0x27')](function(_0x13bbb6){return _0x13bbb6;});}return null;};}function removeEntity(_0x185d41,_0x2a6890){return function(_0xb9c7cc){if(_0xb9c7cc){return _0xb9c7cc['destroy']()[_0x4825('0x27')](function(){var _0x5027d6=_0xb9c7cc['get']({'plain':!![]});var _0x5585c7=_0x4825('0x28');return db[_0x4825('0x29')][_0x4825('0x2a')]({'where':{'type':_0x5585c7,'resourceId':_0x5027d6['id']}})[_0x4825('0x27')](function(){return _0xb9c7cc;});})[_0x4825('0x27')](function(){_0x185d41[_0x4825('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ce5ef,_0x348cea){return function(_0x505a8e){if(!_0x505a8e){_0x5ce5ef[_0x4825('0x1a')](0x194);}return _0x505a8e;};}function handleError(_0x36b5a5,_0x5d0812){_0x5d0812=_0x5d0812||0x1f4;return function(_0x3344d8){logger[_0x4825('0x2b')](_0x3344d8['stack']);if(_0x3344d8['name']){delete _0x3344d8[_0x4825('0x2c')];}_0x36b5a5['status'](_0x5d0812)[_0x4825('0x2d')](_0x3344d8);};}exports[_0x4825('0x2e')]=function(_0x278e61,_0x805e85){var _0x3a2801={},_0x365484={},_0x4b5ba8={'count':0x0,'rows':[]};var _0x310a83=_['map'](db[_0x4825('0x2f')][_0x4825('0x30')],function(_0x22aa67){return{'name':_0x22aa67['fieldName'],'type':_0x22aa67['type']['key']};});_0x365484[_0x4825('0x31')]=_['map'](_0x310a83,'name');_0x365484[_0x4825('0x32')]=_[_0x4825('0x33')](_0x278e61[_0x4825('0x32')]);_0x365484['filters']=_[_0x4825('0x34')](_0x365484[_0x4825('0x31')],_0x365484[_0x4825('0x32')]);_0x3a2801[_0x4825('0x35')]=_[_0x4825('0x34')](_0x365484[_0x4825('0x31')],qs['fields'](_0x278e61['query'][_0x4825('0x36')]));_0x3a2801[_0x4825('0x35')]=_0x3a2801['attributes'][_0x4825('0x37')]?_0x3a2801['attributes']:_0x365484[_0x4825('0x31')];if(!_0x278e61[_0x4825('0x32')][_0x4825('0x38')]('nolimit')){_0x3a2801[_0x4825('0x1f')]=qs[_0x4825('0x1f')](_0x278e61[_0x4825('0x32')]['limit']);_0x3a2801[_0x4825('0x21')]=qs[_0x4825('0x21')](_0x278e61['query'][_0x4825('0x21')]);}_0x3a2801[_0x4825('0x39')]=qs[_0x4825('0x3a')](_0x278e61[_0x4825('0x32')][_0x4825('0x3a')]);_0x3a2801[_0x4825('0x3b')]=qs[_0x4825('0x3c')](_[_0x4825('0x3d')](_0x278e61[_0x4825('0x32')],_0x365484[_0x4825('0x3c')]),_0x310a83);if(_0x278e61[_0x4825('0x32')][_0x4825('0x3e')]){_0x3a2801[_0x4825('0x3b')]=_[_0x4825('0x3f')](_0x3a2801[_0x4825('0x3b')],{'$or':_[_0x4825('0x40')](_0x310a83,function(_0x313ea8){if(_0x313ea8[_0x4825('0x41')]!==_0x4825('0x42')){var _0x39d285={};_0x39d285[_0x313ea8[_0x4825('0x2c')]]={'$like':'%'+_0x278e61[_0x4825('0x32')][_0x4825('0x3e')]+'%'};return _0x39d285;}})});}_0x3a2801=_[_0x4825('0x3f')]({},_0x3a2801,_0x278e61[_0x4825('0x43')]);var _0xbbd5f0={'where':_0x3a2801[_0x4825('0x3b')]};return db[_0x4825('0x2f')][_0x4825('0x20')](_0xbbd5f0)[_0x4825('0x27')](function(_0x4133b9){_0x4b5ba8[_0x4825('0x20')]=_0x4133b9;if(_0x278e61[_0x4825('0x32')][_0x4825('0x44')]){_0x3a2801['include']=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x4825('0x45')](_0x3a2801);})[_0x4825('0x27')](function(_0x439f5e){_0x4b5ba8[_0x4825('0x46')]=_0x439f5e;return _0x4b5ba8;})['then'](respondWithFilteredResult(_0x805e85,_0x3a2801))['catch'](handleError(_0x805e85,null));};exports[_0x4825('0x47')]=function(_0x3fa83b,_0xb480f){var _0x44eeb8={'raw':![],'where':{'id':_0x3fa83b[_0x4825('0x48')]['id']}},_0x7c57d9={};_0x7c57d9[_0x4825('0x31')]=_[_0x4825('0x33')](db['AnalyticCustomReport'][_0x4825('0x30')]);_0x7c57d9[_0x4825('0x32')]=_[_0x4825('0x33')](_0x3fa83b[_0x4825('0x32')]);_0x7c57d9['filters']=_['intersection'](_0x7c57d9[_0x4825('0x31')],_0x7c57d9[_0x4825('0x32')]);_0x44eeb8['attributes']=_['intersection'](_0x7c57d9[_0x4825('0x31')],qs[_0x4825('0x36')](_0x3fa83b[_0x4825('0x32')][_0x4825('0x36')]));_0x44eeb8[_0x4825('0x35')]=_0x44eeb8['attributes'][_0x4825('0x37')]?_0x44eeb8[_0x4825('0x35')]:_0x7c57d9[_0x4825('0x31')];if(_0x3fa83b[_0x4825('0x32')][_0x4825('0x44')]){_0x44eeb8[_0x4825('0x49')]=[{'all':!![]}];}_0x44eeb8=_[_0x4825('0x3f')]({},_0x44eeb8,_0x3fa83b['options']);return db[_0x4825('0x2f')][_0x4825('0x4a')](_0x44eeb8)[_0x4825('0x27')](handleEntityNotFound(_0xb480f,null))['then'](respondWithResult(_0xb480f,null))['catch'](handleError(_0xb480f,null));};exports['create']=function(_0x769163,_0x13ccb1){return db[_0x4825('0x2f')][_0x4825('0x4b')](_0x769163['body'],{})['then'](function(_0x84358a){var _0x31cdde=_0x769163[_0x4825('0x4c')][_0x4825('0x4d')]({'plain':!![]});if(!_0x31cdde)throw new Error(_0x4825('0x4e'));if(_0x31cdde[_0x4825('0x4f')]===_0x4825('0x4c')){var _0x4fa7b3=_0x84358a[_0x4825('0x4d')]({'plain':!![]});var _0xf8eaf1=_0x4825('0x50');return db['UserProfileSection'][_0x4825('0x4a')]({'where':{'name':_0xf8eaf1,'userProfileId':_0x31cdde[_0x4825('0x51')]},'raw':!![]})[_0x4825('0x27')](function(_0x337d63){if(_0x337d63&&_0x337d63['autoAssociation']===0x0){return db[_0x4825('0x29')][_0x4825('0x4b')]({'name':_0x4fa7b3[_0x4825('0x2c')],'resourceId':_0x4fa7b3['id'],'type':_0x4825('0x28'),'sectionId':_0x337d63['id']},{})[_0x4825('0x27')](function(){return _0x84358a;});}else{return _0x84358a;}})['catch'](function(_0x52d70d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52d70d);throw _0x52d70d;});}return _0x84358a;})[_0x4825('0x27')](respondWithResult(_0x13ccb1,0xc9))[_0x4825('0x52')](handleError(_0x13ccb1,null));};exports[_0x4825('0x26')]=function(_0x1dbe4a,_0x32dd8e){if(_0x1dbe4a[_0x4825('0x53')]['id']){delete _0x1dbe4a['body']['id'];}return db[_0x4825('0x2f')][_0x4825('0x4a')]({'where':{'id':_0x1dbe4a[_0x4825('0x48')]['id']}})[_0x4825('0x27')](handleEntityNotFound(_0x32dd8e,null))[_0x4825('0x27')](saveUpdates(_0x1dbe4a['body'],null))[_0x4825('0x27')](respondWithResult(_0x32dd8e,null))[_0x4825('0x52')](handleError(_0x32dd8e,null));};exports['destroy']=function(_0x39dc7e,_0x163464){return db[_0x4825('0x2f')][_0x4825('0x4a')]({'where':{'id':_0x39dc7e['params']['id']}})[_0x4825('0x27')](handleEntityNotFound(_0x163464,null))[_0x4825('0x27')](removeEntity(_0x163464,null))[_0x4825('0x52')](handleError(_0x163464,null));};exports[_0x4825('0x54')]=function(_0x4bd836,_0x28a474){var _0x14834f=0xa;var _0x29b98b=[_0x4825('0x55'),'left_join',_0x4825('0x56'),_0x4825('0x57')];var _0x54882f={'SUM':_0x4825('0x58'),'COUNT':_0x4825('0x59'),'COUNT DISTINCT':_0x4825('0x5a'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x4825('0x5b'),'GROUP_CONCAT':_0x4825('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4825('0x5d')};var _0x31aec7={'SEC_TO_TIME':_0x4825('0x5e'),'DATE':_0x4825('0x5f'),'HOUR':_0x4825('0x60'),'ROUND':_0x4825('0x61'),'UNIX_TIMESTAMP':_0x4825('0x62')};var _0x427b9b=function(_0x2f2405){return!_[_0x4825('0x63')](['IS\x20NULL',_0x4825('0x64'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x2f2405);};var _0x3e5d3f=function(_0xac2ab6){if(!_0xac2ab6||!_0xac2ab6[_0x4825('0x65')][_0x4825('0x37')]){return'';}for(var _0x3bb0f3='(',_0x1d2a4d=0x0;_0x1d2a4d<_0xac2ab6[_0x4825('0x65')][_0x4825('0x37')];_0x1d2a4d+=0x1){_0x1d2a4d>0x0&&(_0x3bb0f3+='\x20'+_0xac2ab6[_0x4825('0x66')]+'\x20');_0x3bb0f3+=_0xac2ab6[_0x4825('0x65')][_0x1d2a4d][_0x4825('0x67')]?_0x3e5d3f(_0xac2ab6[_0x4825('0x65')][_0x1d2a4d]['group']):_0xac2ab6[_0x4825('0x65')][_0x1d2a4d][_0x4825('0x68')]+'\x20'+_0xac2ab6[_0x4825('0x65')][_0x1d2a4d][_0x4825('0x69')]+(_0x427b9b(_0xac2ab6[_0x4825('0x65')][_0x1d2a4d]['condition'])?'\x20'+_0xac2ab6[_0x4825('0x65')][_0x1d2a4d]['value']:'');}return _0x3bb0f3+')';};var _0x25b04c={'where':{'id':_0x4bd836[_0x4825('0x48')]['id']}},_0x16e9e2,_0x321136,_0xf1edb1,_0x193ac0,_0x25509a;_0x25b04c=_[_0x4825('0x3f')]({},_0x25b04c,_0x4bd836[_0x4825('0x43')]);return db[_0x4825('0x2f')]['find'](_0x25b04c)['then'](function(_0x42854a){if(_0x42854a){_0x16e9e2=_0x42854a;return _0x42854a[_0x4825('0x6a')]();}return null;})[_0x4825('0x27')](function(_0x53e86d){if(_0x53e86d){if(!_0x53e86d['length']){throw new db[(_0x4825('0x6b'))][(_0x4825('0x6c'))](_0x4825('0x6d'),0x193);}_0x321136=_0x53e86d;return db[_0x4825('0x6e')]['findAll']({'raw':!![]});}return null;})[_0x4825('0x27')](function(_0x5a3178){if(_0x5a3178){_0xf1edb1=_[_0x4825('0x6f')](_0x5a3178,'id');var _0x51ec41;var _0x4a6b1f=squel[_0x4825('0x70')]();_0x4a6b1f[_0x4825('0x71')](_0x16e9e2[_0x4825('0x72')]);for(var _0x5b6b03=0x0;_0x5b6b03<_0x321136[_0x4825('0x37')];_0x5b6b03+=0x1){_0x51ec41=_0x321136[_0x5b6b03][_0x4825('0x73')]?_0xf1edb1[_0x321136[_0x5b6b03]['MetricId']]['metric']:_0x321136[_0x5b6b03]['field'];_0x51ec41=_0x321136[_0x5b6b03][_0x4825('0x74')]?_['replace'](_0x54882f[_0x321136[_0x5b6b03][_0x4825('0x74')]],'%s',_0x51ec41):_0x51ec41;_0x51ec41=_0x321136[_0x5b6b03][_0x4825('0x75')]?_[_0x4825('0x76')](_0x31aec7[_0x321136[_0x5b6b03][_0x4825('0x75')]],'%s',_0x51ec41):_0x51ec41;if(_0x321136[_0x5b6b03][_0x4825('0x77')]){_0x4a6b1f[_0x4825('0x67')](_0x51ec41);}_0x321136[_0x5b6b03][_0x4825('0x78')]&&_0x4a6b1f[_0x4825('0x39')](_0x51ec41,_0x321136[_0x5b6b03][_0x4825('0x78')]===_0x4825('0x79')?![]:!![]);_0x4a6b1f['field'](_0x51ec41,_0x321136[_0x5b6b03][_0x4825('0x7a')]||_0x51ec41);}if(_0x16e9e2['joins']){_0x16e9e2[_0x4825('0x7b')]=JSON[_0x4825('0x7c')](_0x16e9e2[_0x4825('0x7b')]);for(var _0x3cec21=0x0;_0x3cec21<_0x16e9e2['joins'][_0x4825('0x37')];_0x3cec21+=0x1){if(_0x16e9e2[_0x4825('0x7b')][_0x3cec21][_0x4825('0x41')]&&_[_0x4825('0x63')](_0x29b98b,_0x16e9e2[_0x4825('0x7b')][_0x3cec21]['type'])&&_0x16e9e2[_0x4825('0x7b')][_0x3cec21]['parentKey']&&_0x16e9e2[_0x4825('0x7b')][_0x3cec21][_0x4825('0x7d')]&&_0x16e9e2[_0x4825('0x7b')][_0x3cec21]['foreignKey']){_0x4a6b1f[_0x16e9e2['joins'][_0x3cec21][_0x4825('0x41')]](_0x16e9e2[_0x4825('0x7b')][_0x3cec21]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x16e9e2['table'],_0x16e9e2[_0x4825('0x7b')][_0x3cec21]['parentKey'],_0x16e9e2['joins'][_0x3cec21][_0x4825('0x7d')],_0x16e9e2[_0x4825('0x7b')][_0x3cec21][_0x4825('0x7e')]));}}}if(_0x16e9e2[_0x4825('0x7f')]){_0x16e9e2[_0x4825('0x7f')]=JSON['parse'](_0x16e9e2[_0x4825('0x7f')]);_0x4a6b1f['where'](_0x3e5d3f(_0x16e9e2[_0x4825('0x7f')]['group']));}_0x25509a=_0x4a6b1f[_0x4825('0x80')]();_0x4a6b1f[_0x4825('0x1f')](_0x14834f);_0x4a6b1f[_0x4825('0x21')](0x0);logger[_0x4825('0x81')](_0x4825('0x82'),_0x4a6b1f[_0x4825('0x83')]());return dbH['sequelize'][_0x4825('0x32')](_0x4a6b1f[_0x4825('0x83')](),{'type':dbH[_0x4825('0x84')]['QueryTypes'][_0x4825('0x85')]});}})[_0x4825('0x27')](respondWithResult(_0x28a474,null))[_0x4825('0x52')](handleError(_0x28a474,null));};function runReport(_0x664198,_0x44f8a1,_0xf9487b){var _0x5e703e=_0x44f8a1[_0x4825('0x2c')];var _0x257248=0xa;var _0x5ca46f=[_0x4825('0x55'),_0x4825('0x86'),_0x4825('0x56'),_0x4825('0x57')];var _0x2025a0={'SUM':_0x4825('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4825('0x5a'),'MAX':'MAX(%s)','MIN':_0x4825('0x87'),'AVG':_0x4825('0x5b'),'GROUP_CONCAT':_0x4825('0x5c'),'GROUP_CONCAT ASC':_0x4825('0x88'),'GROUP_CONCAT DESC':_0x4825('0x5d')};var _0x2cccf2={'SEC_TO_TIME':_0x4825('0x5e'),'DATE':_0x4825('0x5f'),'HOUR':_0x4825('0x60'),'ROUND':_0x4825('0x61'),'UNIX_TIMESTAMP':_0x4825('0x62')};var _0x4284fc=function(_0x567c86){return!_['includes']([_0x4825('0x89'),_0x4825('0x64'),_0x4825('0x8a'),_0x4825('0x8b')],_0x567c86);};var _0x44a7a5=function(_0x113aec){if(!_0x113aec||!_0x113aec['rules'][_0x4825('0x37')]){return'';}for(var _0x51e687='(',_0x4c803c=0x0;_0x4c803c<_0x113aec[_0x4825('0x65')][_0x4825('0x37')];_0x4c803c+=0x1){_0x4c803c>0x0&&(_0x51e687+='\x20'+_0x113aec[_0x4825('0x66')]+'\x20');_0x51e687+=_0x113aec[_0x4825('0x65')][_0x4c803c][_0x4825('0x67')]?_0x44a7a5(_0x113aec[_0x4825('0x65')][_0x4c803c]['group']):_0x113aec[_0x4825('0x65')][_0x4c803c][_0x4825('0x68')]+'\x20'+_0x113aec['rules'][_0x4c803c][_0x4825('0x69')]+(_0x4284fc(_0x113aec[_0x4825('0x65')][_0x4c803c][_0x4825('0x69')])?'\x20'+_0x113aec[_0x4825('0x65')][_0x4c803c][_0x4825('0x8c')]:'');}return _0x51e687+')';};var _0x2e2ae9={'where':{'id':_0x664198['id']}},_0x24c83b,_0x221de7,_0x5055c5,_0x4bd0a2,_0x11356d;_0x2e2ae9=_[_0x4825('0x3f')]({},_0x2e2ae9,_0xf9487b);return db[_0x4825('0x2f')]['find'](_0x2e2ae9)[_0x4825('0x27')](function(_0x1b83dd){if(_0x1b83dd){_0x24c83b=_0x1b83dd;return _0x1b83dd['getFields']();}return null;})['then'](function(_0x13c874){if(_0x13c874){if(!_0x13c874[_0x4825('0x37')]){throw new db[(_0x4825('0x6b'))][(_0x4825('0x6c'))](_0x4825('0x6d'),0x193);}_0x221de7=_0x13c874;return db['AnalyticMetric'][_0x4825('0x45')]({'raw':!![]});}return null;})[_0x4825('0x27')](function(_0x583cd1){if(_0x583cd1){_0x5055c5=_[_0x4825('0x6f')](_0x583cd1,'id');var _0x2784ba;var _0x5c2164=squel[_0x4825('0x70')]();_0x5c2164[_0x4825('0x71')](_0x24c83b['table']);for(var _0x1c8ce1=0x0;_0x1c8ce1<_0x221de7[_0x4825('0x37')];_0x1c8ce1+=0x1){_0x2784ba=_0x221de7[_0x1c8ce1][_0x4825('0x73')]?_0x5055c5[_0x221de7[_0x1c8ce1][_0x4825('0x73')]]['metric']:_0x221de7[_0x1c8ce1][_0x4825('0x68')];_0x2784ba=_0x221de7[_0x1c8ce1][_0x4825('0x74')]?_['replace'](_0x2025a0[_0x221de7[_0x1c8ce1][_0x4825('0x74')]],'%s',_0x2784ba):_0x2784ba;_0x2784ba=_0x221de7[_0x1c8ce1][_0x4825('0x75')]?_['replace'](_0x2cccf2[_0x221de7[_0x1c8ce1]['format']],'%s',_0x2784ba):_0x2784ba;if(_0x221de7[_0x1c8ce1][_0x4825('0x77')]){_0x5c2164['group'](_0x2784ba);}_0x221de7[_0x1c8ce1][_0x4825('0x78')]&&_0x5c2164[_0x4825('0x39')](_0x2784ba,_0x221de7[_0x1c8ce1][_0x4825('0x78')]===_0x4825('0x79')?![]:!![]);_0x5c2164['field'](_0x2784ba,_0x221de7[_0x1c8ce1][_0x4825('0x7a')]||_0x2784ba);}if(_0x24c83b['joins']){_0x24c83b['joins']=JSON[_0x4825('0x7c')](_0x24c83b[_0x4825('0x7b')]);for(var _0x580585=0x0;_0x580585<_0x24c83b[_0x4825('0x7b')][_0x4825('0x37')];_0x580585+=0x1){if(_0x24c83b['joins'][_0x580585][_0x4825('0x41')]&&_[_0x4825('0x63')](_0x5ca46f,_0x24c83b['joins'][_0x580585][_0x4825('0x41')])&&_0x24c83b[_0x4825('0x7b')][_0x580585][_0x4825('0x8d')]&&_0x24c83b[_0x4825('0x7b')][_0x580585][_0x4825('0x7d')]&&_0x24c83b[_0x4825('0x7b')][_0x580585]['foreignKey']){_0x5c2164[_0x24c83b[_0x4825('0x7b')][_0x580585]['type']](_0x24c83b[_0x4825('0x7b')][_0x580585][_0x4825('0x7d')],null,util[_0x4825('0x75')]('%s.%s\x20=\x20%s.%s',_0x24c83b[_0x4825('0x72')],_0x24c83b[_0x4825('0x7b')][_0x580585][_0x4825('0x8d')],_0x24c83b['joins'][_0x580585][_0x4825('0x7d')],_0x24c83b[_0x4825('0x7b')][_0x580585][_0x4825('0x7e')]));}}}if(_0x24c83b[_0x4825('0x7f')]){_0x24c83b[_0x4825('0x7f')]=JSON['parse'](_0x24c83b['conditions']);_0x5c2164['where'](_0x44a7a5(_0x24c83b[_0x4825('0x7f')][_0x4825('0x67')]));}_0x11356d=_0x5c2164[_0x4825('0x80')]();_0x5c2164['limit'](_0x257248);_0x5c2164['offset'](0x0);return;}})[_0x4825('0x27')](function(){if(_0x44f8a1['output']===_0x4825('0x8e')){return null;}var _0x2dc4df=_[_0x4825('0x3f')](_0x44f8a1,{'name':_0x44f8a1['fullPath']||_0x44f8a1['name']||_0x24c83b[_0x4825('0x2c')],'basename':_0x5e703e,'savename':util[_0x4825('0x75')](_0x4825('0x8f'),_0x44f8a1[_0x4825('0x2c')]||_0x24c83b[_0x4825('0x2c')],require(_0x4825('0x90'))[_0x4825('0x91')](0x4),_0x44f8a1[_0x4825('0x92')]||_0x4825('0x93')),'reportId':_0x24c83b['id'],'reportType':_0x4825('0x94')});return db[_0x4825('0x95')][_0x4825('0x4b')](_0x2dc4df,{'raw':!![]});})[_0x4825('0x27')](function(_0x1ae768){if(_0x24c83b[_0x4825('0x72')]===_0x4825('0x96')){_0x11356d[_0x4825('0x3b')](_0x24c83b[_0x4825('0x72')]+_0x4825('0x97'),_0x44f8a1[_0x4825('0x98')],_0x44f8a1[_0x4825('0x99')]);}else{_0x11356d['where'](_0x24c83b[_0x4825('0x72')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x44f8a1[_0x4825('0x98')],_0x44f8a1[_0x4825('0x99')]);}if(_0x1ae768){logger[_0x4825('0x9a')]('Run\x20Query:',_0x11356d['toString']());require(_0x4825('0x9b'))[_0x4825('0x9c')](path[_0x4825('0x55')](__dirname,_0x4825('0x9d'),_0x1ae768[_0x4825('0x92')]),[_0x1ae768['id'],_0x11356d[_0x4825('0x83')](),path[_0x4825('0x55')](__dirname,_0x4825('0x9e'),_0x1ae768[_0x4825('0x9f')]),_0x5e703e]);return _0x1ae768;}else{var _0x1a63c7=squel['select']();_0x1a63c7[_0x4825('0x71')]('('+_0x11356d['toString']()+')',_0x4825('0xa0'));_0x1a63c7[_0x4825('0x68')](_0x4825('0xa1'),_0x4825('0x20'));_0x11356d['limit'](_0x44f8a1[_0x4825('0x1f')]||_0x257248);_0x11356d[_0x4825('0x21')](_0x44f8a1['offset']||0x0);return dbH[_0x4825('0x84')]['query'](_0x1a63c7[_0x4825('0x83')](),{'type':dbH[_0x4825('0x84')]['QueryTypes'][_0x4825('0x85')]})['then'](function(_0xe3bba){if(!_0xe3bba['length']){_0x4bd0a2=0x0;}else{_0x4bd0a2=_0xe3bba[0x0][_0x4825('0x20')]||0x0;}return dbH[_0x4825('0x84')][_0x4825('0x32')](_0x11356d[_0x4825('0x83')](),{'type':dbH[_0x4825('0x84')][_0x4825('0xa2')][_0x4825('0x85')]});})[_0x4825('0x27')](function(_0x4073cf){return{'rows':_0x4073cf||[],'count':_0x4bd0a2};});}});}exports[_0x4825('0xa3')]=function(_0x3d6e76,_0xaf1048){return runReport(_0x3d6e76['params'],_0x3d6e76[_0x4825('0x32')],_0x3d6e76[_0x4825('0x43')])[_0x4825('0x27')](respondWithResult(_0xaf1048,null))[_0x4825('0x52')](handleError(_0xaf1048,null));};exports[_0x4825('0xa4')]=runReport;exports[_0x4825('0x32')]=function(_0x1ccb72,_0x53d9c7){var _0x31d02e=0xa;var _0x435592=[_0x4825('0x55'),_0x4825('0x86'),_0x4825('0x56'),'cross_join'];var _0x428df7={'SUM':_0x4825('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4825('0x5a'),'MAX':_0x4825('0xa5'),'MIN':_0x4825('0x87'),'AVG':_0x4825('0x5b'),'GROUP_CONCAT':_0x4825('0x5c'),'GROUP_CONCAT ASC':_0x4825('0x88'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x21f97b={'SEC_TO_TIME':_0x4825('0x5e'),'DATE':_0x4825('0x5f'),'HOUR':_0x4825('0x60'),'ROUND':_0x4825('0x61'),'UNIX_TIMESTAMP':_0x4825('0x62')};var _0x4d43af=function(_0x8bfa67){return!_[_0x4825('0x63')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x4825('0x8a'),_0x4825('0x8b')],_0x8bfa67);};var _0x53bfe7=function(_0x1bb77c){if(!_0x1bb77c||!_0x1bb77c[_0x4825('0x65')][_0x4825('0x37')]){return'';}for(var _0x4e398c='(',_0x9bf3df=0x0;_0x9bf3df<_0x1bb77c[_0x4825('0x65')][_0x4825('0x37')];_0x9bf3df+=0x1){_0x9bf3df>0x0&&(_0x4e398c+='\x20'+_0x1bb77c[_0x4825('0x66')]+'\x20');_0x4e398c+=_0x1bb77c[_0x4825('0x65')][_0x9bf3df][_0x4825('0x67')]?_0x53bfe7(_0x1bb77c[_0x4825('0x65')][_0x9bf3df][_0x4825('0x67')]):_0x1bb77c[_0x4825('0x65')][_0x9bf3df][_0x4825('0x68')]+'\x20'+_0x1bb77c[_0x4825('0x65')][_0x9bf3df][_0x4825('0x69')]+(_0x4d43af(_0x1bb77c[_0x4825('0x65')][_0x9bf3df][_0x4825('0x69')])?'\x20'+_0x1bb77c[_0x4825('0x65')][_0x9bf3df][_0x4825('0x8c')]:'');}return _0x4e398c+')';};var _0x3a91c7={'where':{'id':_0x1ccb72[_0x4825('0x48')]['id']}},_0x4203ed,_0x10c1b9,_0x39a714,_0x20b212,_0xf4efab;_0x3a91c7=_[_0x4825('0x3f')]({},_0x3a91c7,_0x1ccb72['options']);return db[_0x4825('0x2f')][_0x4825('0x4a')](_0x3a91c7)['then'](function(_0xd78be1){if(_0xd78be1){_0x4203ed=_0xd78be1;return _0xd78be1[_0x4825('0x6a')]();}return null;})[_0x4825('0x27')](function(_0x40efcd){if(_0x40efcd){if(!_0x40efcd[_0x4825('0x37')]){throw new db['Sequelize'][(_0x4825('0x6c'))](_0x4825('0x6d'),0x193);}_0x10c1b9=_0x40efcd;return db[_0x4825('0x6e')][_0x4825('0x45')]({'raw':!![]});}return null;})[_0x4825('0x27')](function(_0x286560){if(_0x286560){_0x39a714=_[_0x4825('0x6f')](_0x286560,'id');var _0x845681;var _0x11266a=squel['select']();_0x11266a['from'](_0x4203ed[_0x4825('0x72')]);for(var _0x44408b=0x0;_0x44408b<_0x10c1b9[_0x4825('0x37')];_0x44408b+=0x1){_0x845681=_0x10c1b9[_0x44408b][_0x4825('0x73')]?_0x39a714[_0x10c1b9[_0x44408b]['MetricId']][_0x4825('0xa6')]:_0x10c1b9[_0x44408b][_0x4825('0x68')];_0x845681=_0x10c1b9[_0x44408b][_0x4825('0x74')]?_[_0x4825('0x76')](_0x428df7[_0x10c1b9[_0x44408b][_0x4825('0x74')]],'%s',_0x845681):_0x845681;_0x845681=_0x10c1b9[_0x44408b]['format']?_['replace'](_0x21f97b[_0x10c1b9[_0x44408b][_0x4825('0x75')]],'%s',_0x845681):_0x845681;if(_0x10c1b9[_0x44408b][_0x4825('0x77')]){_0x11266a[_0x4825('0x67')](_0x845681);}_0x10c1b9[_0x44408b]['orderBy']&&_0x11266a['order'](_0x845681,_0x10c1b9[_0x44408b][_0x4825('0x78')]===_0x4825('0x79')?![]:!![]);_0x11266a[_0x4825('0x68')](_0x845681,_0x10c1b9[_0x44408b]['alias']||_0x845681);}if(_0x4203ed['joins']){_0x4203ed[_0x4825('0x7b')]=JSON[_0x4825('0x7c')](_0x4203ed[_0x4825('0x7b')]);for(var _0x5beb28=0x0;_0x5beb28<_0x4203ed[_0x4825('0x7b')][_0x4825('0x37')];_0x5beb28+=0x1){if(_0x4203ed[_0x4825('0x7b')][_0x5beb28][_0x4825('0x41')]&&_[_0x4825('0x63')](_0x435592,_0x4203ed[_0x4825('0x7b')][_0x5beb28]['type'])&&_0x4203ed[_0x4825('0x7b')][_0x5beb28]['parentKey']&&_0x4203ed[_0x4825('0x7b')][_0x5beb28][_0x4825('0x7d')]&&_0x4203ed[_0x4825('0x7b')][_0x5beb28][_0x4825('0x7e')]){_0x11266a[_0x4203ed['joins'][_0x5beb28][_0x4825('0x41')]](_0x4203ed[_0x4825('0x7b')][_0x5beb28][_0x4825('0x7d')],null,util['format'](_0x4825('0xa7'),_0x4203ed[_0x4825('0x72')],_0x4203ed['joins'][_0x5beb28]['parentKey'],_0x4203ed[_0x4825('0x7b')][_0x5beb28][_0x4825('0x7d')],_0x4203ed['joins'][_0x5beb28][_0x4825('0x7e')]));}}}if(_0x4203ed[_0x4825('0x7f')]){_0x4203ed[_0x4825('0x7f')]=JSON[_0x4825('0x7c')](_0x4203ed[_0x4825('0x7f')]);_0x11266a[_0x4825('0x3b')](_0x53bfe7(_0x4203ed[_0x4825('0x7f')][_0x4825('0x67')]));}_0xf4efab=_0x11266a[_0x4825('0x80')]();_0x11266a[_0x4825('0x1f')](_0x31d02e);_0x11266a['offset'](0x0);logger[_0x4825('0x81')](_0x4825('0x82'),_0x11266a['toString']());return dbH[_0x4825('0x84')][_0x4825('0x32')](_0x11266a[_0x4825('0x83')](),{'type':dbH[_0x4825('0x84')][_0x4825('0xa2')][_0x4825('0x85')]});}})[_0x4825('0x27')](function(){return{'sql':_0xf4efab['toString']()};})[_0x4825('0x27')](respondWithResult(_0x53d9c7,null))[_0x4825('0x52')](handleError(_0x53d9c7,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 3eb363d..7682945 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 _0x1705=['./analyticCustomReport.attributes','exports','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment'];(function(_0x58fd67,_0x4bf710){var _0x5628fd=function(_0x5a1e09){while(--_0x5a1e09){_0x58fd67['push'](_0x58fd67['shift']());}};_0x5628fd(++_0x4bf710);}(_0x1705,0x77));var _0x5170=function(_0x49052b,_0x3ba709){_0x49052b=_0x49052b-0x0;var _0x48c045=_0x1705[_0x49052b];return _0x48c045;};'use strict';var _=require(_0x5170('0x0'));var util=require(_0x5170('0x1'));var logger=require(_0x5170('0x2'))(_0x5170('0x3'));var moment=require(_0x5170('0x4'));var BPromise=require('bluebird');var rp=require(_0x5170('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5170('0x6'));var attributes=require(_0x5170('0x7'));module[_0x5170('0x8')]=function(_0x593e87,_0x133113){return _0x593e87['define']('AnalyticCustomReport',attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e65=['request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','analytics_custom_reports','util','../../config/logger','moment','bluebird'];(function(_0x80d2ee,_0x1f46d3){var _0x1b5e38=function(_0x50ab8b){while(--_0x50ab8b){_0x80d2ee['push'](_0x80d2ee['shift']());}};_0x1b5e38(++_0x1f46d3);}(_0x8e65,0x1a9));var _0x58e6=function(_0x388d0a,_0x3ed289){_0x388d0a=_0x388d0a-0x0;var _0x1b4cc4=_0x8e65[_0x388d0a];return _0x1b4cc4;};'use strict';var _=require('lodash');var util=require(_0x58e6('0x0'));var logger=require(_0x58e6('0x1'))('api');var moment=require(_0x58e6('0x2'));var BPromise=require(_0x58e6('0x3'));var rp=require(_0x58e6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x58e6('0x5'));var config=require(_0x58e6('0x6'));var attributes=require(_0x58e6('0x7'));module[_0x58e6('0x8')]=function(_0xc0a08e,_0x283c72){return _0xc0a08e[_0x58e6('0x9')]('AnalyticCustomReport',attributes,{'tableName':_0x58e6('0xa'),'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 14a5fd2..3cd82ea 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 _0x8618=['then','info','request\x20sent','debug','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8618,0x16a));var _0x8861=function(_0x417b5a,_0xb886e4){_0x417b5a=_0x417b5a-0x0;var _0x2eafbe=_0x8618[_0x417b5a];return _0x2eafbe;};'use strict';var _=require('lodash');var util=require(_0x8861('0x0'));var moment=require(_0x8861('0x1'));var BPromise=require(_0x8861('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8861('0x3'))['db'];var utils=require(_0x8861('0x4'));var logger=require(_0x8861('0x5'))(_0x8861('0x6'));var config=require(_0x8861('0x7'));var jayson=require(_0x8861('0x8'));var client=jayson[_0x8861('0x9')][_0x8861('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12cf22,_0xc0053a,_0x6a3e1e){return new BPromise(function(_0x59b413,_0x39dd4c){return client[_0x8861('0xb')](_0x12cf22,_0x6a3e1e)[_0x8861('0xc')](function(_0x779b7){logger[_0x8861('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0xc0053a,_0x8861('0xe'));logger[_0x8861('0xf')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0xc0053a,_0x8861('0xe'),JSON['stringify'](_0x779b7));if(_0x779b7[_0x8861('0x10')]){if(_0x779b7[_0x8861('0x10')][_0x8861('0x11')]===0x1f4){logger['error'](_0x8861('0x12'),_0xc0053a,_0x779b7[_0x8861('0x10')][_0x8861('0x13')]);return _0x39dd4c(_0x779b7['error'][_0x8861('0x13')]);}logger[_0x8861('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0xc0053a,_0x779b7[_0x8861('0x10')]['message']);return _0x59b413(_0x779b7[_0x8861('0x10')][_0x8861('0x13')]);}else{logger[_0x8861('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0xc0053a,_0x8861('0xe'));_0x59b413(_0x779b7[_0x8861('0x14')][_0x8861('0x13')]);}})[_0x8861('0x15')](function(_0x5ccd0a){logger[_0x8861('0x10')](_0x8861('0x12'),_0xc0053a,_0x5ccd0a);_0x39dd4c(_0x5ccd0a);});});} \ No newline at end of file +var _0x49a0=['AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info'];(function(_0x59263b,_0x4d4ddd){var _0x41bed9=function(_0x30e91e){while(--_0x30e91e){_0x59263b['push'](_0x59263b['shift']());}};_0x41bed9(++_0x4d4ddd);}(_0x49a0,0x1ed));var _0x049a=function(_0x4ead23,_0x537fec){_0x4ead23=_0x4ead23-0x0;var _0x36bcae=_0x49a0[_0x4ead23];return _0x36bcae;};'use strict';var _=require(_0x049a('0x0'));var util=require(_0x049a('0x1'));var moment=require('moment');var BPromise=require(_0x049a('0x2'));var rs=require(_0x049a('0x3'));var fs=require('fs');var Redis=require(_0x049a('0x4'));var db=require(_0x049a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x049a('0x6'))(_0x049a('0x7'));var config=require('../../config/environment');var jayson=require(_0x049a('0x8'));var client=jayson['client'][_0x049a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xdb0341,_0x38ed8c,_0x58a94c){return new BPromise(function(_0x557495,_0x307ddd){return client[_0x049a('0xa')](_0xdb0341,_0x58a94c)[_0x049a('0xb')](function(_0x1f79d8){logger[_0x049a('0xc')](_0x049a('0xd'),_0x38ed8c,'request\x20sent');logger[_0x049a('0xe')](_0x049a('0xf'),_0x38ed8c,_0x049a('0x10'),JSON[_0x049a('0x11')](_0x1f79d8));if(_0x1f79d8[_0x049a('0x12')]){if(_0x1f79d8[_0x049a('0x12')][_0x049a('0x13')]===0x1f4){logger[_0x049a('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x38ed8c,_0x1f79d8[_0x049a('0x12')][_0x049a('0x14')]);return _0x307ddd(_0x1f79d8[_0x049a('0x12')][_0x049a('0x14')]);}logger[_0x049a('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x38ed8c,_0x1f79d8['error'][_0x049a('0x14')]);return _0x557495(_0x1f79d8[_0x049a('0x12')][_0x049a('0x14')]);}else{logger['info'](_0x049a('0xd'),_0x38ed8c,_0x049a('0x10'));_0x557495(_0x1f79d8[_0x049a('0x15')]['message']);}})[_0x049a('0x16')](function(_0x4c6f59){logger[_0x049a('0x12')](_0x049a('0xd'),_0x38ed8c,_0x4c6f59);_0x307ddd(_0x4c6f59);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index d044199..db96fd6 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 _0x4b49=['/:id/query','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./analyticCustomReport.controller','isAuthenticated','index','get','/:id','show','/:id/preview','preview','run'];(function(_0x102f97,_0x5bda2f){var _0xd22058=function(_0x2ccc1f){while(--_0x2ccc1f){_0x102f97['push'](_0x102f97['shift']());}};_0xd22058(++_0x5bda2f);}(_0x4b49,0x7a));var _0x94b4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b49[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x94b4('0x0'));var util=require(_0x94b4('0x1'));var path=require(_0x94b4('0x2'));var timeout=require(_0x94b4('0x3'));var express=require('express');var router=express[_0x94b4('0x4')]();var fs_extra=require(_0x94b4('0x5'));var auth=require(_0x94b4('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x94b4('0x7'));router['get']('/',auth[_0x94b4('0x8')](),controller[_0x94b4('0x9')]);router[_0x94b4('0xa')](_0x94b4('0xb'),auth[_0x94b4('0x8')](),controller[_0x94b4('0xc')]);router[_0x94b4('0xa')](_0x94b4('0xd'),auth[_0x94b4('0x8')](),controller[_0x94b4('0xe')]);router['get']('/:id/run',auth[_0x94b4('0x8')](),controller[_0x94b4('0xf')]);router[_0x94b4('0xa')](_0x94b4('0x10'),auth['isAuthenticated'](),controller['query']);router[_0x94b4('0x11')]('/',auth[_0x94b4('0x8')](),controller[_0x94b4('0x12')]);router[_0x94b4('0x13')](_0x94b4('0xb'),auth[_0x94b4('0x8')](),controller[_0x94b4('0x14')]);router[_0x94b4('0x15')](_0x94b4('0xb'),auth[_0x94b4('0x8')](),controller['destroy']);module[_0x94b4('0x16')]=router; \ No newline at end of file +var _0x248a=['/:id/query','query','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','get','/:id','show','/:id/preview','preview','/:id/run'];(function(_0xb47d1e,_0x1a306b){var _0x5180aa=function(_0x4d7294){while(--_0x4d7294){_0xb47d1e['push'](_0xb47d1e['shift']());}};_0x5180aa(++_0x1a306b);}(_0x248a,0x74));var _0xa248=function(_0x1021ea,_0x577e92){_0x1021ea=_0x1021ea-0x0;var _0x1b18ee=_0x248a[_0x1021ea];return _0x1b18ee;};'use strict';var multer=require(_0xa248('0x0'));var util=require(_0xa248('0x1'));var path=require(_0xa248('0x2'));var timeout=require(_0xa248('0x3'));var express=require(_0xa248('0x4'));var router=express[_0xa248('0x5')]();var fs_extra=require(_0xa248('0x6'));var auth=require(_0xa248('0x7'));var interaction=require(_0xa248('0x8'));var config=require(_0xa248('0x9'));var controller=require(_0xa248('0xa'));router['get']('/',auth[_0xa248('0xb')](),controller[_0xa248('0xc')]);router[_0xa248('0xd')](_0xa248('0xe'),auth[_0xa248('0xb')](),controller[_0xa248('0xf')]);router[_0xa248('0xd')](_0xa248('0x10'),auth[_0xa248('0xb')](),controller[_0xa248('0x11')]);router[_0xa248('0xd')](_0xa248('0x12'),auth[_0xa248('0xb')](),controller['run']);router[_0xa248('0xd')](_0xa248('0x13'),auth['isAuthenticated'](),controller[_0xa248('0x14')]);router[_0xa248('0x15')]('/',auth[_0xa248('0xb')](),controller[_0xa248('0x16')]);router[_0xa248('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xa248('0x18')]);router[_0xa248('0x19')](_0xa248('0xe'),auth[_0xa248('0xb')](),controller[_0xa248('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index a5ffe0a..43b021a 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 _0xac9d=['TEXT','sequelize','exports','STRING'];(function(_0x3b36df,_0x3a1ac8){var _0x27c050=function(_0x2ff75a){while(--_0x2ff75a){_0x3b36df['push'](_0x3b36df['shift']());}};_0x27c050(++_0x3a1ac8);}(_0xac9d,0x14d));var _0xdac9=function(_0xf3897e,_0x3ac8b7){_0xf3897e=_0xf3897e-0x0;var _0x26b187=_0xac9d[_0xf3897e];return _0x26b187;};'use strict';var Sequelize=require(_0xdac9('0x0'));module[_0xdac9('0x1')]={'name':{'type':Sequelize[_0xdac9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdac9('0x2')]},'parent':{'type':Sequelize[_0xdac9('0x2')]},'table':{'type':Sequelize[_0xdac9('0x2')]},'conditions':{'type':Sequelize[_0xdac9('0x3')]},'joins':{'type':Sequelize[_0xdac9('0x3')]}}; \ No newline at end of file +var _0xfdbd=['sequelize','exports','STRING','TEXT'];(function(_0x4ca288,_0x254dd8){var _0x2362c1=function(_0x5504d8){while(--_0x5504d8){_0x4ca288['push'](_0x4ca288['shift']());}};_0x2362c1(++_0x254dd8);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x19cfac,_0x3745dc){_0x19cfac=_0x19cfac-0x0;var _0x25d2a5=_0xfdbd[_0x19cfac];return _0x25d2a5;};'use strict';var Sequelize=require(_0xdfdb('0x0'));module[_0xdfdb('0x1')]={'name':{'type':Sequelize[_0xdfdb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdfdb('0x2')]},'parent':{'type':Sequelize[_0xdfdb('0x2')]},'table':{'type':Sequelize[_0xdfdb('0x2')]},'conditions':{'type':Sequelize[_0xdfdb('0x3')]},'joins':{'type':Sequelize[_0xdfdb('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 84c83ab..277ced9 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 _0xc4aa=['Content-Range','apply','reject','save','update','then','destroy','get','DefaultReports','UserProfileResource','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','AnalyticDefaultReport','findAll','rows','catch','show','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(%s)','MAX(%s)','AVG(%s)','SEC_TO_TIME(%s)','IS\x20NOT\x20EMPTY','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','groupBy','alias','includes','foreignKey','output','web','fullPath','%s-%s.%s','randomstring','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','child_process','fork','countTable','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0xf35bd4,_0x51ff64){var _0x47912b=function(_0x269818){while(--_0x269818){_0xf35bd4['push'](_0xf35bd4['shift']());}};_0x47912b(++_0x51ff64);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xc4aa[_0x88cd7b];return _0x56fcc8;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];var dbH=require(_0xac4a('0x16'))['dbH'];function respondWithStatusCode(_0x21a79,_0x68424a){_0x68424a=_0x68424a||0xcc;return function(_0x247b78){if(_0x247b78){return _0x21a79[_0xac4a('0x17')](_0x68424a);}return _0x21a79[_0xac4a('0x18')](_0x68424a)[_0xac4a('0x19')]();};}function respondWithResult(_0x34bc01,_0x33c287){_0x33c287=_0x33c287||0xc8;return function(_0x190418){if(_0x190418){return _0x34bc01[_0xac4a('0x18')](_0x33c287)[_0xac4a('0x1a')](_0x190418);}};}function respondWithFilteredResult(_0x26dbb8,_0x4a2119){return function(_0x402fff){if(_0x402fff){var _0x34d797=typeof _0x4a2119[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x4a2119[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x28e304=_0x402fff[_0xac4a('0x1e')];var _0x546c5d=_0x34d797?0x0:_0x4a2119['offset'];var _0x21a729=_0x34d797?_0x402fff[_0xac4a('0x1e')]:_0x4a2119[_0xac4a('0x1b')]+_0x4a2119['limit'];var _0x39e83e;if(_0x21a729>=_0x28e304){_0x21a729=_0x28e304;_0x39e83e=0xc8;}else{_0x39e83e=0xce;}_0x26dbb8[_0xac4a('0x18')](_0x39e83e);return _0x26dbb8[_0xac4a('0x1f')](_0xac4a('0x20'),_0x546c5d+'-'+_0x21a729+'/'+_0x28e304)[_0xac4a('0x1a')](_0x402fff);}return null;};}function patchUpdates(_0x3e829c){return function(_0xe38996){try{jsonpatch[_0xac4a('0x21')](_0xe38996,_0x3e829c,!![]);}catch(_0x534092){return BPromise[_0xac4a('0x22')](_0x534092);}return _0xe38996[_0xac4a('0x23')]();};}function saveUpdates(_0x599787,_0x3d7ce0){return function(_0x4169c0){if(_0x4169c0){return _0x4169c0[_0xac4a('0x24')](_0x599787)[_0xac4a('0x25')](function(_0x4d2d6c){return _0x4d2d6c;});}return null;};}function removeEntity(_0x1b7998,_0x2503d8){return function(_0x15435c){if(_0x15435c){return _0x15435c[_0xac4a('0x26')]()[_0xac4a('0x25')](function(){var _0x2b0dc2=_0x15435c[_0xac4a('0x27')]({'plain':!![]});var _0x36054a=_0xac4a('0x28');return db[_0xac4a('0x29')][_0xac4a('0x26')]({'where':{'type':_0x36054a,'resourceId':_0x2b0dc2['id']}})[_0xac4a('0x25')](function(){return _0x15435c;});})[_0xac4a('0x25')](function(){_0x1b7998[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x20202c,_0x4e17ce){return function(_0x23b061){if(!_0x23b061){_0x20202c[_0xac4a('0x17')](0x194);}return _0x23b061;};}function handleError(_0x42a33c,_0x2772fe){_0x2772fe=_0x2772fe||0x1f4;return function(_0x116700){logger['error'](_0x116700['stack']);if(_0x116700[_0xac4a('0x2a')]){delete _0x116700[_0xac4a('0x2a')];}_0x42a33c[_0xac4a('0x18')](_0x2772fe)['send'](_0x116700);};}exports['index']=function(_0x355755,_0x2896bc){var _0x228629={},_0x432066={},_0x17118e={'count':0x0,'rows':[]};var _0x53d3a5=_[_0xac4a('0x2b')](db['AnalyticDefaultReport'][_0xac4a('0x2c')],function(_0x57adcf){return{'name':_0x57adcf[_0xac4a('0x2d')],'type':_0x57adcf[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x432066[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0x53d3a5,_0xac4a('0x2a'));_0x432066[_0xac4a('0x31')]=_[_0xac4a('0x32')](_0x355755[_0xac4a('0x31')]);_0x432066[_0xac4a('0x33')]=_[_0xac4a('0x34')](_0x432066[_0xac4a('0x30')],_0x432066[_0xac4a('0x31')]);_0x228629[_0xac4a('0x35')]=_['intersection'](_0x432066[_0xac4a('0x30')],qs[_0xac4a('0x36')](_0x355755['query'][_0xac4a('0x36')]));_0x228629[_0xac4a('0x35')]=_0x228629['attributes']['length']?_0x228629[_0xac4a('0x35')]:_0x432066[_0xac4a('0x30')];if(!_0x355755[_0xac4a('0x31')][_0xac4a('0x37')]('nolimit')){_0x228629[_0xac4a('0x1d')]=qs[_0xac4a('0x1d')](_0x355755['query'][_0xac4a('0x1d')]);_0x228629[_0xac4a('0x1b')]=qs[_0xac4a('0x1b')](_0x355755['query'][_0xac4a('0x1b')]);}_0x228629[_0xac4a('0x38')]=qs[_0xac4a('0x39')](_0x355755['query'][_0xac4a('0x39')]);_0x228629[_0xac4a('0x3a')]=qs['filters'](_['pick'](_0x355755[_0xac4a('0x31')],_0x432066['filters']),_0x53d3a5);if(_0x355755['query']['filter']){_0x228629['where']=_[_0xac4a('0x3b')](_0x228629[_0xac4a('0x3a')],{'$or':_[_0xac4a('0x2b')](_0x53d3a5,function(_0x472484){if(_0x472484[_0xac4a('0x2e')]!==_0xac4a('0x3c')){var _0x4220e2={};_0x4220e2[_0x472484[_0xac4a('0x2a')]]={'$like':'%'+_0x355755[_0xac4a('0x31')][_0xac4a('0x3d')]+'%'};return _0x4220e2;}})});}_0x228629=_[_0xac4a('0x3b')]({},_0x228629,_0x355755[_0xac4a('0x3e')]);var _0x4e4994={'where':_0x228629['where']};return db['AnalyticDefaultReport'][_0xac4a('0x1e')](_0x4e4994)[_0xac4a('0x25')](function(_0x14e80b){_0x17118e[_0xac4a('0x1e')]=_0x14e80b;if(_0x355755[_0xac4a('0x31')][_0xac4a('0x3f')]){_0x228629[_0xac4a('0x40')]=[{'all':!![]}];}return db[_0xac4a('0x41')][_0xac4a('0x42')](_0x228629);})[_0xac4a('0x25')](function(_0x561cb7){_0x17118e[_0xac4a('0x43')]=_0x561cb7;return _0x17118e;})[_0xac4a('0x25')](respondWithFilteredResult(_0x2896bc,_0x228629))[_0xac4a('0x44')](handleError(_0x2896bc,null));};exports[_0xac4a('0x45')]=function(_0x1a96cf,_0x57b879){var _0x8700b4={'raw':!![],'where':{'id':_0x1a96cf['params']['id']}},_0x1b77bb={};_0x1b77bb[_0xac4a('0x30')]=_['keys'](db[_0xac4a('0x41')][_0xac4a('0x2c')]);_0x1b77bb[_0xac4a('0x31')]=_[_0xac4a('0x32')](_0x1a96cf[_0xac4a('0x31')]);_0x1b77bb[_0xac4a('0x33')]=_[_0xac4a('0x34')](_0x1b77bb[_0xac4a('0x30')],_0x1b77bb[_0xac4a('0x31')]);_0x8700b4[_0xac4a('0x35')]=_[_0xac4a('0x34')](_0x1b77bb[_0xac4a('0x30')],qs['fields'](_0x1a96cf[_0xac4a('0x31')][_0xac4a('0x36')]));_0x8700b4[_0xac4a('0x35')]=_0x8700b4['attributes'][_0xac4a('0x46')]?_0x8700b4[_0xac4a('0x35')]:_0x1b77bb['model'];if(_0x1a96cf[_0xac4a('0x31')]['includeAll']){_0x8700b4[_0xac4a('0x40')]=[{'all':!![]}];}_0x8700b4=_[_0xac4a('0x3b')]({},_0x8700b4,_0x1a96cf[_0xac4a('0x3e')]);return db['AnalyticDefaultReport']['find'](_0x8700b4)[_0xac4a('0x25')](handleEntityNotFound(_0x57b879,null))['then'](respondWithResult(_0x57b879,null))[_0xac4a('0x44')](handleError(_0x57b879,null));};exports['create']=function(_0x3d2aaf,_0x530bbb){return db[_0xac4a('0x41')][_0xac4a('0x47')](_0x3d2aaf[_0xac4a('0x48')],{})[_0xac4a('0x25')](function(_0x54782f){var _0x31c794=_0x3d2aaf[_0xac4a('0x49')][_0xac4a('0x27')]({'plain':!![]});if(!_0x31c794)throw new Error(_0xac4a('0x4a'));if(_0x31c794[_0xac4a('0x4b')]===_0xac4a('0x49')){var _0x187306=_0x54782f['get']({'plain':!![]});var _0x35dee5=_0xac4a('0x4c');return db['UserProfileSection'][_0xac4a('0x4d')]({'where':{'name':_0x35dee5,'userProfileId':_0x31c794[_0xac4a('0x4e')]},'raw':!![]})[_0xac4a('0x25')](function(_0x3ac36e){if(_0x3ac36e&&_0x3ac36e['autoAssociation']===0x0){return db[_0xac4a('0x29')][_0xac4a('0x47')]({'name':_0x187306[_0xac4a('0x2a')],'resourceId':_0x187306['id'],'type':_0xac4a('0x28'),'sectionId':_0x3ac36e['id']},{})[_0xac4a('0x25')](function(){return _0x54782f;});}else{return _0x54782f;}})['catch'](function(_0x179373){logger['error'](_0xac4a('0x4f'),_0x179373);throw _0x179373;});}return _0x54782f;})[_0xac4a('0x25')](respondWithResult(_0x530bbb,0xc9))['catch'](handleError(_0x530bbb,null));};exports['update']=function(_0x437466,_0x70fdc3){if(_0x437466['body']['id']){delete _0x437466[_0xac4a('0x48')]['id'];}return db[_0xac4a('0x41')][_0xac4a('0x4d')]({'where':{'id':_0x437466[_0xac4a('0x50')]['id']}})['then'](handleEntityNotFound(_0x70fdc3,null))[_0xac4a('0x25')](saveUpdates(_0x437466[_0xac4a('0x48')],null))[_0xac4a('0x25')](respondWithResult(_0x70fdc3,null))[_0xac4a('0x44')](handleError(_0x70fdc3,null));};exports[_0xac4a('0x26')]=function(_0x411547,_0x36179a){return db['AnalyticDefaultReport'][_0xac4a('0x4d')]({'where':{'id':_0x411547[_0xac4a('0x50')]['id']}})[_0xac4a('0x25')](handleEntityNotFound(_0x36179a,null))[_0xac4a('0x25')](removeEntity(_0x36179a,null))[_0xac4a('0x44')](handleError(_0x36179a,null));};exports[_0xac4a('0x51')]=function(_0x213df2,_0x236f57){var _0x159e43=0xa;var _0x786d9=[_0xac4a('0x52'),_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0x5222f3={'SUM':_0xac4a('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xac4a('0x57'),'MAX':'MAX(%s)','MIN':_0xac4a('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0x5cac9b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xac4a('0x5b'),'HOUR':_0xac4a('0x5c'),'ROUND':_0xac4a('0x5d'),'UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x2f9940=function(_0xb7b884){return!_['includes']([_0xac4a('0x5f'),'IS\x20NOT\x20NULL',_0xac4a('0x60'),'IS\x20NOT\x20EMPTY'],_0xb7b884);};var _0x347880=function(_0x19ce2c){if(!_0x19ce2c||!_0x19ce2c[_0xac4a('0x61')][_0xac4a('0x46')]){return'';}for(var _0x429273='(',_0x2bc39a=0x0;_0x2bc39a<_0x19ce2c[_0xac4a('0x61')][_0xac4a('0x46')];_0x2bc39a+=0x1){_0x2bc39a>0x0&&(_0x429273+='\x20'+_0x19ce2c[_0xac4a('0x62')]+'\x20');_0x429273+=_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x63')]?_0x347880(_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x63')]):_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x64')]+'\x20'+_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x65')]+(_0x2f9940(_0x19ce2c['rules'][_0x2bc39a][_0xac4a('0x65')])?'\x20'+_0x19ce2c[_0xac4a('0x61')][_0x2bc39a]['value']:'');}return _0x429273+')';};var _0x3c3576={'where':{'id':_0x213df2['params']['id']}},_0x34bd1c,_0x2d24c7,_0x2b8562,_0x357cac,_0x4d1440;_0x3c3576=_[_0xac4a('0x3b')]({},_0x3c3576,_0x213df2[_0xac4a('0x3e')]);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0x3c3576)[_0xac4a('0x25')](function(_0x21ef8b){if(_0x21ef8b){_0x34bd1c=_0x21ef8b;return _0x21ef8b[_0xac4a('0x66')]();}return null;})[_0xac4a('0x25')](function(_0x44c60b){if(_0x44c60b){if(!_0x44c60b[_0xac4a('0x46')]){throw new db[(_0xac4a('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d24c7=_0x44c60b;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x423f70){if(_0x423f70){_0x2b8562=_[_0xac4a('0x69')](_0x423f70,'id');var _0x283107;var _0x1d24bb=squel[_0xac4a('0x6a')]();_0x1d24bb[_0xac4a('0x6b')](_0x34bd1c[_0xac4a('0x6c')]);for(var _0xb09b89=0x0;_0xb09b89<_0x2d24c7[_0xac4a('0x46')];_0xb09b89+=0x1){_0x283107=_0x2d24c7[_0xb09b89]['MetricId']?_0x2b8562[_0x2d24c7[_0xb09b89][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x2d24c7[_0xb09b89][_0xac4a('0x64')];_0x283107=_0x2d24c7[_0xb09b89][_0xac4a('0x6f')]?_['replace'](_0x5222f3[_0x2d24c7[_0xb09b89][_0xac4a('0x6f')]],'%s',_0x283107):_0x283107;_0x283107=_0x2d24c7[_0xb09b89]['format']?_[_0xac4a('0x70')](_0x5cac9b[_0x2d24c7[_0xb09b89][_0xac4a('0x71')]],'%s',_0x283107):_0x283107;if(_0x2d24c7[_0xb09b89]['groupBy']){_0x1d24bb['group'](_0x283107);}_0x2d24c7[_0xb09b89][_0xac4a('0x72')]&&_0x1d24bb[_0xac4a('0x38')](_0x283107,_0x2d24c7[_0xb09b89][_0xac4a('0x72')]==='DESC'?![]:!![]);_0x1d24bb[_0xac4a('0x64')](_0x283107,_0x2d24c7[_0xb09b89]['alias']||_0x283107);}if(_0x34bd1c[_0xac4a('0x73')]){_0x34bd1c['joins']=JSON['parse'](_0x34bd1c[_0xac4a('0x73')]);for(var _0x56ef2a=0x0;_0x56ef2a<_0x34bd1c[_0xac4a('0x73')]['length'];_0x56ef2a+=0x1){if(_0x34bd1c[_0xac4a('0x73')][_0x56ef2a][_0xac4a('0x2e')]&&_['includes'](_0x786d9,_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['type'])&&_0x34bd1c[_0xac4a('0x73')][_0x56ef2a][_0xac4a('0x74')]&&_0x34bd1c['joins'][_0x56ef2a][_0xac4a('0x75')]&&_0x34bd1c['joins'][_0x56ef2a]['foreignKey']){_0x1d24bb[_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['type']](_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['foreignTable'],null,util['format'](_0xac4a('0x76'),_0x34bd1c[_0xac4a('0x6c')],_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['parentKey'],_0x34bd1c['joins'][_0x56ef2a][_0xac4a('0x75')],_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['foreignKey']));}}}if(_0x34bd1c['conditions']){_0x34bd1c[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x34bd1c[_0xac4a('0x77')]);_0x1d24bb[_0xac4a('0x3a')](_0x347880(_0x34bd1c[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x4d1440=_0x1d24bb[_0xac4a('0x79')]();_0x1d24bb[_0xac4a('0x1d')](_0x159e43);_0x1d24bb[_0xac4a('0x1b')](0x0);logger['debug'](_0xac4a('0x7a'),_0x1d24bb[_0xac4a('0x7b')]());return dbH[_0xac4a('0x7c')]['query'](_0x1d24bb[_0xac4a('0x7b')](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')][_0xac4a('0x7e')]});}})[_0xac4a('0x25')](respondWithResult(_0x236f57,null))['catch'](handleError(_0x236f57,null));};function runReport(_0x290a73,_0x19ce24,_0xc9d040){var _0x37e519=_0x19ce24[_0xac4a('0x2a')];var _0x451248=0xa;var _0xd7bdd6=['join',_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0x35a97c={'SUM':_0xac4a('0x56'),'COUNT':_0xac4a('0x7f'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xac4a('0x80'),'MIN':_0xac4a('0x58'),'AVG':_0xac4a('0x81'),'GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0x56a934={'SEC_TO_TIME':_0xac4a('0x82'),'DATE':_0xac4a('0x5b'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x212a22=function(_0x1fe86a){return!_['includes']([_0xac4a('0x5f'),'IS\x20NOT\x20NULL',_0xac4a('0x60'),_0xac4a('0x83')],_0x1fe86a);};var _0x406b64=function(_0x35328e){if(!_0x35328e||!_0x35328e[_0xac4a('0x61')]['length']){return'';}for(var _0x50f471='(',_0x31cda0=0x0;_0x31cda0<_0x35328e[_0xac4a('0x61')][_0xac4a('0x46')];_0x31cda0+=0x1){_0x31cda0>0x0&&(_0x50f471+='\x20'+_0x35328e[_0xac4a('0x62')]+'\x20');_0x50f471+=_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x63')]?_0x406b64(_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x63')]):_0x35328e['rules'][_0x31cda0]['field']+'\x20'+_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x65')]+(_0x212a22(_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x65')])?'\x20'+_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x84')]:'');}return _0x50f471+')';};var _0xdaa2ef={'where':{'id':_0x290a73['id']}},_0x2e704b,_0x540d8e,_0x5e0be4,_0x32fd0c,_0x168f30;_0xdaa2ef=_[_0xac4a('0x3b')]({},_0xdaa2ef,_0xc9d040);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0xdaa2ef)[_0xac4a('0x25')](function(_0x338af3){if(_0x338af3){_0x2e704b=_0x338af3;return _0x338af3['getFields']();}return null;})[_0xac4a('0x25')](function(_0x1bacf2){if(_0x1bacf2){if(!_0x1bacf2[_0xac4a('0x46')]){throw new db['Sequelize'][(_0xac4a('0x85'))](_0xac4a('0x86'),0x193);}_0x540d8e=_0x1bacf2;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x27d023){if(_0x27d023){_0x5e0be4=_[_0xac4a('0x69')](_0x27d023,'id');var _0x2ef42a;var _0x322465=squel['select']();_0x322465[_0xac4a('0x6b')](_0x2e704b['table']);for(var _0x203321=0x0;_0x203321<_0x540d8e[_0xac4a('0x46')];_0x203321+=0x1){_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x6d')]?_0x5e0be4[_0x540d8e[_0x203321][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x540d8e[_0x203321][_0xac4a('0x64')];_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x6f')]?_['replace'](_0x35a97c[_0x540d8e[_0x203321][_0xac4a('0x6f')]],'%s',_0x2ef42a):_0x2ef42a;_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x71')]?_[_0xac4a('0x70')](_0x56a934[_0x540d8e[_0x203321][_0xac4a('0x71')]],'%s',_0x2ef42a):_0x2ef42a;if(_0x540d8e[_0x203321][_0xac4a('0x87')]){_0x322465['group'](_0x2ef42a);}_0x540d8e[_0x203321][_0xac4a('0x72')]&&_0x322465[_0xac4a('0x38')](_0x2ef42a,_0x540d8e[_0x203321]['orderBy']==='DESC'?![]:!![]);_0x322465[_0xac4a('0x64')](_0x2ef42a,_0x540d8e[_0x203321][_0xac4a('0x88')]||_0x2ef42a);}if(_0x2e704b['joins']){_0x2e704b[_0xac4a('0x73')]=JSON[_0xac4a('0x78')](_0x2e704b[_0xac4a('0x73')]);for(var _0x37657e=0x0;_0x37657e<_0x2e704b[_0xac4a('0x73')][_0xac4a('0x46')];_0x37657e+=0x1){if(_0x2e704b['joins'][_0x37657e][_0xac4a('0x2e')]&&_[_0xac4a('0x89')](_0xd7bdd6,_0x2e704b[_0xac4a('0x73')][_0x37657e]['type'])&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x74')]&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x75')]&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x8a')]){_0x322465[_0x2e704b['joins'][_0x37657e][_0xac4a('0x2e')]](_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignTable'],null,util[_0xac4a('0x71')]('%s.%s\x20=\x20%s.%s',_0x2e704b[_0xac4a('0x6c')],_0x2e704b[_0xac4a('0x73')][_0x37657e]['parentKey'],_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignTable'],_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignKey']));}}}if(_0x2e704b[_0xac4a('0x77')]){_0x2e704b[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x2e704b[_0xac4a('0x77')]);_0x322465[_0xac4a('0x3a')](_0x406b64(_0x2e704b[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x168f30=_0x322465[_0xac4a('0x79')]();_0x322465[_0xac4a('0x1d')](_0x451248);_0x322465[_0xac4a('0x1b')](0x0);return;}})[_0xac4a('0x25')](function(){if(_0x19ce24[_0xac4a('0x8b')]===_0xac4a('0x8c')){return null;}var _0x4217df=_['merge'](_0x19ce24,{'name':_0x19ce24[_0xac4a('0x8d')]||_0x19ce24[_0xac4a('0x2a')]||_0x2e704b['name'],'basename':_0x37e519,'savename':util[_0xac4a('0x71')](_0xac4a('0x8e'),_0x19ce24[_0xac4a('0x2a')]||_0x2e704b[_0xac4a('0x2a')],require(_0xac4a('0x8f'))['generate'](0x4),_0x19ce24[_0xac4a('0x8b')]||'csv'),'reportId':_0x2e704b['id'],'reportType':_0xac4a('0x90')});return db[_0xac4a('0x91')][_0xac4a('0x47')](_0x4217df,{'raw':!![]});})[_0xac4a('0x25')](function(_0x53f23d){if(_0x2e704b[_0xac4a('0x6c')]==='cdr'){_0x168f30[_0xac4a('0x3a')](_0x2e704b[_0xac4a('0x6c')]+_0xac4a('0x92'),_0x19ce24['startDate'],_0x19ce24[_0xac4a('0x93')]);}else{_0x168f30[_0xac4a('0x3a')](_0x2e704b[_0xac4a('0x6c')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x19ce24[_0xac4a('0x94')],_0x19ce24[_0xac4a('0x93')]);}if(_0x53f23d){logger[_0xac4a('0x95')](_0xac4a('0x96'),_0x168f30[_0xac4a('0x7b')]());require(_0xac4a('0x97'))[_0xac4a('0x98')](path[_0xac4a('0x52')](__dirname,'../../components/export/',_0x53f23d[_0xac4a('0x8b')]),[_0x53f23d['id'],_0x168f30['toString'](),path['join'](__dirname,'../../files/reports',_0x53f23d['savename']),_0x37e519]);return _0x53f23d;}else{var _0x502275=squel[_0xac4a('0x6a')]();_0x502275[_0xac4a('0x6b')]('('+_0x168f30[_0xac4a('0x7b')]()+')',_0xac4a('0x99'));_0x502275[_0xac4a('0x64')]('COUNT(*)',_0xac4a('0x1e'));_0x168f30[_0xac4a('0x1d')](_0x19ce24[_0xac4a('0x1d')]||_0x451248);_0x168f30[_0xac4a('0x1b')](_0x19ce24[_0xac4a('0x1b')]||0x0);return dbH[_0xac4a('0x7c')][_0xac4a('0x31')](_0x502275[_0xac4a('0x7b')](),{'type':dbH['sequelize'][_0xac4a('0x7d')][_0xac4a('0x7e')]})[_0xac4a('0x25')](function(_0x25331f){if(!_0x25331f[_0xac4a('0x46')]){_0x32fd0c=0x0;}else{_0x32fd0c=_0x25331f[0x0][_0xac4a('0x1e')]||0x0;}return dbH[_0xac4a('0x7c')]['query'](_0x168f30['toString'](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')]['SELECT']});})[_0xac4a('0x25')](function(_0x366f5a){return{'rows':_0x366f5a||[],'count':_0x32fd0c};});}});}exports['run']=function(_0x5bd013,_0x2fe103){return runReport(_0x5bd013[_0xac4a('0x50')],_0x5bd013[_0xac4a('0x31')],_0x5bd013[_0xac4a('0x3e')])[_0xac4a('0x25')](respondWithResult(_0x2fe103,null))['catch'](handleError(_0x2fe103,null));};exports[_0xac4a('0x9a')]=runReport;exports['query']=function(_0x4f2d85,_0x538cfd){var _0x63c30=0xa;var _0x4301c3=[_0xac4a('0x52'),_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0xcad25d={'SUM':_0xac4a('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xac4a('0x58'),'AVG':_0xac4a('0x81'),'GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':_0xac4a('0x9b'),'GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0xcd140e={'SEC_TO_TIME':_0xac4a('0x82'),'DATE':_0xac4a('0x5b'),'HOUR':_0xac4a('0x5c'),'ROUND':_0xac4a('0x5d'),'UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x37cb49=function(_0xe0fd57){return!_[_0xac4a('0x89')]([_0xac4a('0x5f'),_0xac4a('0x9c'),_0xac4a('0x60'),_0xac4a('0x83')],_0xe0fd57);};var _0x41cdb5=function(_0x172d03){if(!_0x172d03||!_0x172d03[_0xac4a('0x61')][_0xac4a('0x46')]){return'';}for(var _0x3e2575='(',_0x4cc581=0x0;_0x4cc581<_0x172d03[_0xac4a('0x61')][_0xac4a('0x46')];_0x4cc581+=0x1){_0x4cc581>0x0&&(_0x3e2575+='\x20'+_0x172d03[_0xac4a('0x62')]+'\x20');_0x3e2575+=_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x63')]?_0x41cdb5(_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x63')]):_0x172d03[_0xac4a('0x61')][_0x4cc581]['field']+'\x20'+_0x172d03['rules'][_0x4cc581][_0xac4a('0x65')]+(_0x37cb49(_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x65')])?'\x20'+_0x172d03['rules'][_0x4cc581]['value']:'');}return _0x3e2575+')';};var _0x5de198={'where':{'id':_0x4f2d85[_0xac4a('0x50')]['id']}},_0x2b6773,_0x52df82,_0x59e82c,_0x216055,_0x52963c;_0x5de198=_['merge']({},_0x5de198,_0x4f2d85[_0xac4a('0x3e')]);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0x5de198)[_0xac4a('0x25')](function(_0x403a16){if(_0x403a16){_0x2b6773=_0x403a16;return _0x403a16[_0xac4a('0x66')]();}return null;})['then'](function(_0x25bf23){if(_0x25bf23){if(!_0x25bf23[_0xac4a('0x46')]){throw new db[(_0xac4a('0x67'))]['ValidationErrorItem'](_0xac4a('0x86'),0x193);}_0x52df82=_0x25bf23;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x5bb911){if(_0x5bb911){_0x59e82c=_[_0xac4a('0x69')](_0x5bb911,'id');var _0x403f5a;var _0x3eae2f=squel[_0xac4a('0x6a')]();_0x3eae2f[_0xac4a('0x6b')](_0x2b6773[_0xac4a('0x6c')]);for(var _0x4a0cd9=0x0;_0x4a0cd9<_0x52df82['length'];_0x4a0cd9+=0x1){_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x6d')]?_0x59e82c[_0x52df82[_0x4a0cd9][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x52df82[_0x4a0cd9][_0xac4a('0x64')];_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x6f')]?_[_0xac4a('0x70')](_0xcad25d[_0x52df82[_0x4a0cd9]['function']],'%s',_0x403f5a):_0x403f5a;_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x71')]?_['replace'](_0xcd140e[_0x52df82[_0x4a0cd9][_0xac4a('0x71')]],'%s',_0x403f5a):_0x403f5a;if(_0x52df82[_0x4a0cd9]['groupBy']){_0x3eae2f[_0xac4a('0x63')](_0x403f5a);}_0x52df82[_0x4a0cd9][_0xac4a('0x72')]&&_0x3eae2f[_0xac4a('0x38')](_0x403f5a,_0x52df82[_0x4a0cd9][_0xac4a('0x72')]==='DESC'?![]:!![]);_0x3eae2f[_0xac4a('0x64')](_0x403f5a,_0x52df82[_0x4a0cd9][_0xac4a('0x88')]||_0x403f5a);}if(_0x2b6773[_0xac4a('0x73')]){_0x2b6773[_0xac4a('0x73')]=JSON[_0xac4a('0x78')](_0x2b6773['joins']);for(var _0x3dd60a=0x0;_0x3dd60a<_0x2b6773[_0xac4a('0x73')][_0xac4a('0x46')];_0x3dd60a+=0x1){if(_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x2e')]&&_['includes'](_0x4301c3,_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x2e')])&&_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x74')]&&_0x2b6773[_0xac4a('0x73')][_0x3dd60a]['foreignTable']&&_0x2b6773['joins'][_0x3dd60a]['foreignKey']){_0x3eae2f[_0x2b6773['joins'][_0x3dd60a][_0xac4a('0x2e')]](_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x75')],null,util[_0xac4a('0x71')](_0xac4a('0x76'),_0x2b6773['table'],_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x74')],_0x2b6773['joins'][_0x3dd60a][_0xac4a('0x75')],_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x8a')]));}}}if(_0x2b6773['conditions']){_0x2b6773[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x2b6773[_0xac4a('0x77')]);_0x3eae2f[_0xac4a('0x3a')](_0x41cdb5(_0x2b6773[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x52963c=_0x3eae2f[_0xac4a('0x79')]();_0x3eae2f[_0xac4a('0x1d')](_0x63c30);_0x3eae2f[_0xac4a('0x1b')](0x0);logger['debug'](_0xac4a('0x7a'),_0x3eae2f[_0xac4a('0x7b')]());return dbH['sequelize'][_0xac4a('0x31')](_0x3eae2f['toString'](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')]['SELECT']});}})[_0xac4a('0x25')](function(){return{'sql':_0x52963c[_0xac4a('0x7b')]()};})[_0xac4a('0x25')](respondWithResult(_0x538cfd,null))[_0xac4a('0x44')](handleError(_0x538cfd,null));}; \ No newline at end of file +var _0xabce=['where','findAll','show','includeAll','options','find','catch','create','body','user','role','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','table','MetricId','field','function','replace','format','groupBy','orderBy','joins','parse','includes','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','SELECT','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','ValidationErrorItem','AnalyticMetric','keyBy','select','metric','DESC','foreignKey','output','web','%s-%s.%s','default','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','from','countTable','COUNT(*)','sequelize','QueryTypes','run','runReport','Sequelize','alias','clone','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','limit','undefined','count','set','json','apply','save','update','then','get','DefaultReports','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','filter','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabce,0x103));var _0xeabc=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xabce[_0x92c450];return _0x2a9599;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];var dbH=require(_0xeabc('0x19'))[_0xeabc('0x1a')];function respondWithStatusCode(_0xcfbf06,_0x53df9c){_0x53df9c=_0x53df9c||0xcc;return function(_0x235c2d){if(_0x235c2d){return _0xcfbf06[_0xeabc('0x1b')](_0x53df9c);}return _0xcfbf06[_0xeabc('0x1c')](_0x53df9c)['end']();};}function respondWithResult(_0x5f4ee8,_0x3170ea){_0x3170ea=_0x3170ea||0xc8;return function(_0x3ae954){if(_0x3ae954){return _0x5f4ee8[_0xeabc('0x1c')](_0x3170ea)['json'](_0x3ae954);}};}function respondWithFilteredResult(_0xf913d7,_0x638976){return function(_0x49f2d8){if(_0x49f2d8){var _0x53fe28=typeof _0x638976[_0xeabc('0x1d')]==='undefined'&&typeof _0x638976[_0xeabc('0x1e')]===_0xeabc('0x1f');var _0x58a3c0=_0x49f2d8[_0xeabc('0x20')];var _0x31dd53=_0x53fe28?0x0:_0x638976[_0xeabc('0x1d')];var _0x384be5=_0x53fe28?_0x49f2d8[_0xeabc('0x20')]:_0x638976['offset']+_0x638976[_0xeabc('0x1e')];var _0x4d68ea;if(_0x384be5>=_0x58a3c0){_0x384be5=_0x58a3c0;_0x4d68ea=0xc8;}else{_0x4d68ea=0xce;}_0xf913d7[_0xeabc('0x1c')](_0x4d68ea);return _0xf913d7[_0xeabc('0x21')]('Content-Range',_0x31dd53+'-'+_0x384be5+'/'+_0x58a3c0)[_0xeabc('0x22')](_0x49f2d8);}return null;};}function patchUpdates(_0x41d67a){return function(_0x254590){try{jsonpatch[_0xeabc('0x23')](_0x254590,_0x41d67a,!![]);}catch(_0x3c9611){return BPromise['reject'](_0x3c9611);}return _0x254590[_0xeabc('0x24')]();};}function saveUpdates(_0x10c675,_0x91ab00){return function(_0x5bdd57){if(_0x5bdd57){return _0x5bdd57[_0xeabc('0x25')](_0x10c675)[_0xeabc('0x26')](function(_0x214953){return _0x214953;});}return null;};}function removeEntity(_0x319119,_0x5b8838){return function(_0x109e1d){if(_0x109e1d){return _0x109e1d['destroy']()[_0xeabc('0x26')](function(){var _0x4d4e29=_0x109e1d[_0xeabc('0x27')]({'plain':!![]});var _0x12acbd=_0xeabc('0x28');return db[_0xeabc('0x29')][_0xeabc('0x2a')]({'where':{'type':_0x12acbd,'resourceId':_0x4d4e29['id']}})[_0xeabc('0x26')](function(){return _0x109e1d;});})[_0xeabc('0x26')](function(){_0x319119['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x459c8a,_0x5bf8f2){return function(_0x3c1b5b){if(!_0x3c1b5b){_0x459c8a[_0xeabc('0x1b')](0x194);}return _0x3c1b5b;};}function handleError(_0x48fb52,_0x2163e6){_0x2163e6=_0x2163e6||0x1f4;return function(_0x38572d){logger[_0xeabc('0x2b')](_0x38572d[_0xeabc('0x2c')]);if(_0x38572d[_0xeabc('0x2d')]){delete _0x38572d[_0xeabc('0x2d')];}_0x48fb52[_0xeabc('0x1c')](_0x2163e6)[_0xeabc('0x2e')](_0x38572d);};}exports[_0xeabc('0x2f')]=function(_0x5ebb86,_0x5b34dd){var _0x5bb1f1={},_0x2f03e8={},_0x2d027e={'count':0x0,'rows':[]};var _0x98b445=_[_0xeabc('0x30')](db[_0xeabc('0x31')][_0xeabc('0x32')],function(_0x61c0af){return{'name':_0x61c0af['fieldName'],'type':_0x61c0af[_0xeabc('0x33')][_0xeabc('0x34')]};});_0x2f03e8[_0xeabc('0x35')]=_['map'](_0x98b445,_0xeabc('0x2d'));_0x2f03e8[_0xeabc('0x36')]=_[_0xeabc('0x37')](_0x5ebb86['query']);_0x2f03e8[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0x2f03e8[_0xeabc('0x35')],_0x2f03e8['query']);_0x5bb1f1[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0x2f03e8['model'],qs['fields'](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x5bb1f1['attributes']=_0x5bb1f1[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x5bb1f1[_0xeabc('0x3a')]:_0x2f03e8[_0xeabc('0x35')];if(!_0x5ebb86[_0xeabc('0x36')]['hasOwnProperty'](_0xeabc('0x3d'))){_0x5bb1f1['limit']=qs[_0xeabc('0x1e')](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x1e')]);_0x5bb1f1['offset']=qs['offset'](_0x5ebb86[_0xeabc('0x36')]['offset']);}_0x5bb1f1[_0xeabc('0x3e')]=qs['sort'](_0x5ebb86['query']['sort']);_0x5bb1f1['where']=qs[_0xeabc('0x38')](_['pick'](_0x5ebb86[_0xeabc('0x36')],_0x2f03e8[_0xeabc('0x38')]),_0x98b445);if(_0x5ebb86['query'][_0xeabc('0x3f')]){_0x5bb1f1['where']=_[_0xeabc('0x40')](_0x5bb1f1['where'],{'$or':_[_0xeabc('0x30')](_0x98b445,function(_0xf1b7ef){if(_0xf1b7ef[_0xeabc('0x33')]!=='VIRTUAL'){var _0x5a00d0={};_0x5a00d0[_0xf1b7ef['name']]={'$like':'%'+_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3f')]+'%'};return _0x5a00d0;}})});}_0x5bb1f1=_[_0xeabc('0x40')]({},_0x5bb1f1,_0x5ebb86['options']);var _0x4f1897={'where':_0x5bb1f1[_0xeabc('0x41')]};return db[_0xeabc('0x31')]['count'](_0x4f1897)[_0xeabc('0x26')](function(_0x5e0b78){_0x2d027e[_0xeabc('0x20')]=_0x5e0b78;if(_0x5ebb86['query']['includeAll']){_0x5bb1f1['include']=[{'all':!![]}];}return db[_0xeabc('0x31')][_0xeabc('0x42')](_0x5bb1f1);})[_0xeabc('0x26')](function(_0x3eeeb5){_0x2d027e['rows']=_0x3eeeb5;return _0x2d027e;})[_0xeabc('0x26')](respondWithFilteredResult(_0x5b34dd,_0x5bb1f1))['catch'](handleError(_0x5b34dd,null));};exports[_0xeabc('0x43')]=function(_0x1a4bbe,_0x3a7807){var _0x17a0df={'raw':!![],'where':{'id':_0x1a4bbe['params']['id']}},_0xc849c9={};_0xc849c9['model']=_[_0xeabc('0x37')](db['AnalyticDefaultReport'][_0xeabc('0x32')]);_0xc849c9[_0xeabc('0x36')]=_['keys'](_0x1a4bbe[_0xeabc('0x36')]);_0xc849c9[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0xc849c9[_0xeabc('0x35')],_0xc849c9[_0xeabc('0x36')]);_0x17a0df[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0xc849c9['model'],qs[_0xeabc('0x3b')](_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x17a0df[_0xeabc('0x3a')]=_0x17a0df[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x17a0df[_0xeabc('0x3a')]:_0xc849c9[_0xeabc('0x35')];if(_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x44')]){_0x17a0df['include']=[{'all':!![]}];}_0x17a0df=_[_0xeabc('0x40')]({},_0x17a0df,_0x1a4bbe[_0xeabc('0x45')]);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x17a0df)[_0xeabc('0x26')](handleEntityNotFound(_0x3a7807,null))[_0xeabc('0x26')](respondWithResult(_0x3a7807,null))[_0xeabc('0x47')](handleError(_0x3a7807,null));};exports['create']=function(_0x766743,_0x32e09b){return db[_0xeabc('0x31')][_0xeabc('0x48')](_0x766743[_0xeabc('0x49')],{})['then'](function(_0x305946){var _0x2b2b9c=_0x766743[_0xeabc('0x4a')][_0xeabc('0x27')]({'plain':!![]});if(!_0x2b2b9c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b2b9c[_0xeabc('0x4b')]===_0xeabc('0x4a')){var _0x568847=_0x305946[_0xeabc('0x27')]({'plain':!![]});var _0x5a0d4d=_0xeabc('0x4c');return db['UserProfileSection'][_0xeabc('0x46')]({'where':{'name':_0x5a0d4d,'userProfileId':_0x2b2b9c[_0xeabc('0x4d')]},'raw':!![]})[_0xeabc('0x26')](function(_0x1524c3){if(_0x1524c3&&_0x1524c3[_0xeabc('0x4e')]===0x0){return db[_0xeabc('0x29')][_0xeabc('0x48')]({'name':_0x568847[_0xeabc('0x2d')],'resourceId':_0x568847['id'],'type':_0xeabc('0x28'),'sectionId':_0x1524c3['id']},{})[_0xeabc('0x26')](function(){return _0x305946;});}else{return _0x305946;}})['catch'](function(_0x180a14){logger[_0xeabc('0x2b')](_0xeabc('0x4f'),_0x180a14);throw _0x180a14;});}return _0x305946;})[_0xeabc('0x26')](respondWithResult(_0x32e09b,0xc9))['catch'](handleError(_0x32e09b,null));};exports[_0xeabc('0x25')]=function(_0x392913,_0x10d56f){if(_0x392913[_0xeabc('0x49')]['id']){delete _0x392913['body']['id'];}return db[_0xeabc('0x31')][_0xeabc('0x46')]({'where':{'id':_0x392913[_0xeabc('0x50')]['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x10d56f,null))[_0xeabc('0x26')](saveUpdates(_0x392913[_0xeabc('0x49')],null))[_0xeabc('0x26')](respondWithResult(_0x10d56f,null))[_0xeabc('0x47')](handleError(_0x10d56f,null));};exports[_0xeabc('0x2a')]=function(_0x58ab08,_0x4546c4){return db['AnalyticDefaultReport']['find']({'where':{'id':_0x58ab08['params']['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x4546c4,null))[_0xeabc('0x26')](removeEntity(_0x4546c4,null))[_0xeabc('0x47')](handleError(_0x4546c4,null));};exports[_0xeabc('0x51')]=function(_0xe89728,_0x2f78f3){var _0x4a2ad6=0xa;var _0x4358d7=[_0xeabc('0x52'),_0xeabc('0x53'),_0xeabc('0x54'),_0xeabc('0x55')];var _0x2c7b4e={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x536f42={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x26c784=function(_0xc2ef0c){return!_['includes']([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0xc2ef0c);};var _0x11cc1f=function(_0x514787){if(!_0x514787||!_0x514787['rules'][_0xeabc('0x3c')]){return'';}for(var _0x7b659f='(',_0x1b6675=0x0;_0x1b6675<_0x514787[_0xeabc('0x64')][_0xeabc('0x3c')];_0x1b6675+=0x1){_0x1b6675>0x0&&(_0x7b659f+='\x20'+_0x514787[_0xeabc('0x65')]+'\x20');_0x7b659f+=_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x66')]?_0x11cc1f(_0x514787[_0xeabc('0x64')][_0x1b6675]['group']):_0x514787[_0xeabc('0x64')][_0x1b6675]['field']+'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')]+(_0x26c784(_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')])?'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x68')]:'');}return _0x7b659f+')';};var _0xf48062={'where':{'id':_0xe89728[_0xeabc('0x50')]['id']}},_0xb59a2a,_0x5d4bc2,_0x24d0e5,_0x5702cb,_0x3fa31b;_0xf48062=_[_0xeabc('0x40')]({},_0xf48062,_0xe89728[_0xeabc('0x45')]);return db['AnalyticDefaultReport'][_0xeabc('0x46')](_0xf48062)['then'](function(_0x54e7d6){if(_0x54e7d6){_0xb59a2a=_0x54e7d6;return _0x54e7d6[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x23270a){if(_0x23270a){if(!_0x23270a[_0xeabc('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0xeabc('0x6a'),0x193);}_0x5d4bc2=_0x23270a;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xeabc('0x26')](function(_0x4f1a4f){if(_0x4f1a4f){_0x24d0e5=_['keyBy'](_0x4f1a4f,'id');var _0xa44f2d;var _0x1c84b5=squel['select']();_0x1c84b5['from'](_0xb59a2a[_0xeabc('0x6b')]);for(var _0x5d183a=0x0;_0x5d183a<_0x5d4bc2[_0xeabc('0x3c')];_0x5d183a+=0x1){_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6c')]?_0x24d0e5[_0x5d4bc2[_0x5d183a]['MetricId']]['metric']:_0x5d4bc2[_0x5d183a][_0xeabc('0x6d')];_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x2c7b4e[_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]],'%s',_0xa44f2d):_0xa44f2d;_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x70')]?_['replace'](_0x536f42[_0x5d4bc2[_0x5d183a]['format']],'%s',_0xa44f2d):_0xa44f2d;if(_0x5d4bc2[_0x5d183a][_0xeabc('0x71')]){_0x1c84b5['group'](_0xa44f2d);}_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]&&_0x1c84b5['order'](_0xa44f2d,_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]==='DESC'?![]:!![]);_0x1c84b5[_0xeabc('0x6d')](_0xa44f2d,_0x5d4bc2[_0x5d183a]['alias']||_0xa44f2d);}if(_0xb59a2a[_0xeabc('0x73')]){_0xb59a2a[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x73')]);for(var _0x5e121c=0x0;_0x5e121c<_0xb59a2a[_0xeabc('0x73')]['length'];_0x5e121c+=0x1){if(_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x4358d7,_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')])&&_0xb59a2a['joins'][_0x5e121c][_0xeabc('0x76')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']){_0x1c84b5[_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]](_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')],null,util['format'](_0xeabc('0x78'),_0xb59a2a[_0xeabc('0x6b')],_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x76')],_0xb59a2a['joins'][_0x5e121c]['foreignTable'],_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']));}}}if(_0xb59a2a['conditions']){_0xb59a2a[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x79')]);_0x1c84b5['where'](_0x11cc1f(_0xb59a2a[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3fa31b=_0x1c84b5['clone']();_0x1c84b5[_0xeabc('0x1e')](_0x4a2ad6);_0x1c84b5[_0xeabc('0x1d')](0x0);logger[_0xeabc('0x7a')](_0xeabc('0x7b'),_0x1c84b5[_0xeabc('0x7c')]());return dbH['sequelize'][_0xeabc('0x36')](_0x1c84b5['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](respondWithResult(_0x2f78f3,null))[_0xeabc('0x47')](handleError(_0x2f78f3,null));};function runReport(_0x4424ce,_0x33fa74,_0x51368f){var _0x39f961=_0x33fa74['name'];var _0x1795fe=0xa;var _0x2f95c7=['join',_0xeabc('0x53'),'right_join','cross_join'];var _0x952dc7={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':'MIN(%s)','AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x348064={'SEC_TO_TIME':_0xeabc('0x81'),'DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x522c6e=function(_0x436f8e){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xeabc('0x63')],_0x436f8e);};var _0x273ca5=function(_0xe90200){if(!_0xe90200||!_0xe90200[_0xeabc('0x64')][_0xeabc('0x3c')]){return'';}for(var _0x5f5a47='(',_0x289f98=0x0;_0x289f98<_0xe90200['rules']['length'];_0x289f98+=0x1){_0x289f98>0x0&&(_0x5f5a47+='\x20'+_0xe90200[_0xeabc('0x65')]+'\x20');_0x5f5a47+=_0xe90200[_0xeabc('0x64')][_0x289f98]['group']?_0x273ca5(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x66')]):_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x6d')]+'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')]+(_0x522c6e(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')])?'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x68')]:'');}return _0x5f5a47+')';};var _0x1f8197={'where':{'id':_0x4424ce['id']}},_0x485c13,_0xb54c35,_0x5c9d6f,_0x1caaa7,_0x3e764a;_0x1f8197=_[_0xeabc('0x40')]({},_0x1f8197,_0x51368f);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x1f8197)[_0xeabc('0x26')](function(_0x40f51e){if(_0x40f51e){_0x485c13=_0x40f51e;return _0x40f51e[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x156e20){if(_0x156e20){if(!_0x156e20[_0xeabc('0x3c')]){throw new db['Sequelize'][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0xb54c35=_0x156e20;return db[_0xeabc('0x83')][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x26c595){if(_0x26c595){_0x5c9d6f=_[_0xeabc('0x84')](_0x26c595,'id');var _0x580661;var _0x3de927=squel[_0xeabc('0x85')]();_0x3de927['from'](_0x485c13['table']);for(var _0x489b1d=0x0;_0x489b1d<_0xb54c35['length'];_0x489b1d+=0x1){_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6c')]?_0x5c9d6f[_0xb54c35[_0x489b1d][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0xb54c35[_0x489b1d][_0xeabc('0x6d')];_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x952dc7[_0xb54c35[_0x489b1d][_0xeabc('0x6e')]],'%s',_0x580661):_0x580661;_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x348064[_0xb54c35[_0x489b1d][_0xeabc('0x70')]],'%s',_0x580661):_0x580661;if(_0xb54c35[_0x489b1d]['groupBy']){_0x3de927[_0xeabc('0x66')](_0x580661);}_0xb54c35[_0x489b1d][_0xeabc('0x72')]&&_0x3de927['order'](_0x580661,_0xb54c35[_0x489b1d][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x3de927[_0xeabc('0x6d')](_0x580661,_0xb54c35[_0x489b1d]['alias']||_0x580661);}if(_0x485c13[_0xeabc('0x73')]){_0x485c13['joins']=JSON[_0xeabc('0x74')](_0x485c13[_0xeabc('0x73')]);for(var _0x1841f0=0x0;_0x1841f0<_0x485c13[_0xeabc('0x73')][_0xeabc('0x3c')];_0x1841f0+=0x1){if(_0x485c13['joins'][_0x1841f0]['type']&&_['includes'](_0x2f95c7,_0x485c13['joins'][_0x1841f0][_0xeabc('0x33')])&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')]&&_0x485c13['joins'][_0x1841f0][_0xeabc('0x77')]&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x88')]){_0x3de927[_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x33')]](_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x77')],null,util[_0xeabc('0x70')](_0xeabc('0x78'),_0x485c13[_0xeabc('0x6b')],_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')],_0x485c13['joins'][_0x1841f0]['foreignTable'],_0x485c13[_0xeabc('0x73')][_0x1841f0]['foreignKey']));}}}if(_0x485c13[_0xeabc('0x79')]){_0x485c13[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x485c13['conditions']);_0x3de927[_0xeabc('0x41')](_0x273ca5(_0x485c13[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3e764a=_0x3de927['clone']();_0x3de927['limit'](_0x1795fe);_0x3de927[_0xeabc('0x1d')](0x0);return;}})[_0xeabc('0x26')](function(){if(_0x33fa74[_0xeabc('0x89')]===_0xeabc('0x8a')){return null;}var _0x2cc9b3=_[_0xeabc('0x40')](_0x33fa74,{'name':_0x33fa74['fullPath']||_0x33fa74['name']||_0x485c13[_0xeabc('0x2d')],'basename':_0x39f961,'savename':util[_0xeabc('0x70')](_0xeabc('0x8b'),_0x33fa74[_0xeabc('0x2d')]||_0x485c13['name'],require('randomstring')['generate'](0x4),_0x33fa74[_0xeabc('0x89')]||'csv'),'reportId':_0x485c13['id'],'reportType':_0xeabc('0x8c')});return db['AnalyticExtractedReport'][_0xeabc('0x48')](_0x2cc9b3,{'raw':!![]});})['then'](function(_0x6e6ab2){if(_0x485c13[_0xeabc('0x6b')]===_0xeabc('0x8d')){_0x3e764a[_0xeabc('0x41')](_0x485c13[_0xeabc('0x6b')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}else{_0x3e764a[_0xeabc('0x41')](_0x485c13['table']+_0xeabc('0x90'),_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}if(_0x6e6ab2){logger[_0xeabc('0x91')](_0xeabc('0x92'),_0x3e764a['toString']());require(_0xeabc('0x93'))[_0xeabc('0x94')](path['join'](__dirname,_0xeabc('0x95'),_0x6e6ab2[_0xeabc('0x89')]),[_0x6e6ab2['id'],_0x3e764a['toString'](),path[_0xeabc('0x52')](__dirname,_0xeabc('0x96'),_0x6e6ab2[_0xeabc('0x97')]),_0x39f961]);return _0x6e6ab2;}else{var _0x307d26=squel[_0xeabc('0x85')]();_0x307d26[_0xeabc('0x98')]('('+_0x3e764a[_0xeabc('0x7c')]()+')',_0xeabc('0x99'));_0x307d26[_0xeabc('0x6d')](_0xeabc('0x9a'),_0xeabc('0x20'));_0x3e764a[_0xeabc('0x1e')](_0x33fa74[_0xeabc('0x1e')]||_0x1795fe);_0x3e764a['offset'](_0x33fa74['offset']||0x0);return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x307d26[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')]['QueryTypes'][_0xeabc('0x7d')]})['then'](function(_0x49fba2){if(!_0x49fba2['length']){_0x1caaa7=0x0;}else{_0x1caaa7=_0x49fba2[0x0]['count']||0x0;}return dbH['sequelize']['query'](_0x3e764a[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});})[_0xeabc('0x26')](function(_0xe27492){return{'rows':_0xe27492||[],'count':_0x1caaa7};});}});}exports[_0xeabc('0x9d')]=function(_0x3eaedf,_0x44dc85){return runReport(_0x3eaedf['params'],_0x3eaedf[_0xeabc('0x36')],_0x3eaedf[_0xeabc('0x45')])[_0xeabc('0x26')](respondWithResult(_0x44dc85,null))[_0xeabc('0x47')](handleError(_0x44dc85,null));};exports[_0xeabc('0x9e')]=runReport;exports[_0xeabc('0x36')]=function(_0x2a29d7,_0x5bb5d6){var _0x3513ce=0xa;var _0x58cb5d=[_0xeabc('0x52'),_0xeabc('0x53'),'right_join',_0xeabc('0x55')];var _0x4c8bf3={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x484c75={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x580f72=function(_0x37907a){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0x37907a);};var _0x57db6d=function(_0x13cc55){if(!_0x13cc55||!_0x13cc55['rules'][_0xeabc('0x3c')]){return'';}for(var _0x43b88e='(',_0x1fa464=0x0;_0x1fa464<_0x13cc55[_0xeabc('0x64')]['length'];_0x1fa464+=0x1){_0x1fa464>0x0&&(_0x43b88e+='\x20'+_0x13cc55[_0xeabc('0x65')]+'\x20');_0x43b88e+=_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x66')]?_0x57db6d(_0x13cc55['rules'][_0x1fa464][_0xeabc('0x66')]):_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x6d')]+'\x20'+_0x13cc55['rules'][_0x1fa464]['condition']+(_0x580f72(_0x13cc55['rules'][_0x1fa464]['condition'])?'\x20'+_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x68')]:'');}return _0x43b88e+')';};var _0x52e84f={'where':{'id':_0x2a29d7[_0xeabc('0x50')]['id']}},_0x12f024,_0x1d35da,_0x2695a4,_0x199251,_0x1899d6;_0x52e84f=_[_0xeabc('0x40')]({},_0x52e84f,_0x2a29d7[_0xeabc('0x45')]);return db[_0xeabc('0x31')]['find'](_0x52e84f)[_0xeabc('0x26')](function(_0x5bb015){if(_0x5bb015){_0x12f024=_0x5bb015;return _0x5bb015[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x438ce3){if(_0x438ce3){if(!_0x438ce3[_0xeabc('0x3c')]){throw new db[(_0xeabc('0x9f'))][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0x1d35da=_0x438ce3;return db['AnalyticMetric'][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x475160){if(_0x475160){_0x2695a4=_['keyBy'](_0x475160,'id');var _0x10d66b;var _0x12a042=squel[_0xeabc('0x85')]();_0x12a042[_0xeabc('0x98')](_0x12f024[_0xeabc('0x6b')]);for(var _0x49bf0f=0x0;_0x49bf0f<_0x1d35da[_0xeabc('0x3c')];_0x49bf0f+=0x1){_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]?_0x2695a4[_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0x1d35da[_0x49bf0f][_0xeabc('0x6d')];_0x10d66b=_0x1d35da[_0x49bf0f]['function']?_[_0xeabc('0x6f')](_0x4c8bf3[_0x1d35da[_0x49bf0f][_0xeabc('0x6e')]],'%s',_0x10d66b):_0x10d66b;_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x484c75[_0x1d35da[_0x49bf0f][_0xeabc('0x70')]],'%s',_0x10d66b):_0x10d66b;if(_0x1d35da[_0x49bf0f]['groupBy']){_0x12a042[_0xeabc('0x66')](_0x10d66b);}_0x1d35da[_0x49bf0f]['orderBy']&&_0x12a042[_0xeabc('0x3e')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x12a042[_0xeabc('0x6d')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0xa0')]||_0x10d66b);}if(_0x12f024[_0xeabc('0x73')]){_0x12f024[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x73')]);for(var _0x223a3=0x0;_0x223a3<_0x12f024['joins'][_0xeabc('0x3c')];_0x223a3+=0x1){if(_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x58cb5d,_0x12f024['joins'][_0x223a3][_0xeabc('0x33')])&&_0x12f024['joins'][_0x223a3]['parentKey']&&_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')]&&_0x12f024[_0xeabc('0x73')][_0x223a3]['foreignKey']){_0x12a042[_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]](_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')],null,util[_0xeabc('0x70')]('%s.%s\x20=\x20%s.%s',_0x12f024[_0xeabc('0x6b')],_0x12f024[_0xeabc('0x73')][_0x223a3]['parentKey'],_0x12f024['joins'][_0x223a3][_0xeabc('0x77')],_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x88')]));}}}if(_0x12f024[_0xeabc('0x79')]){_0x12f024[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x79')]);_0x12a042[_0xeabc('0x41')](_0x57db6d(_0x12f024[_0xeabc('0x79')]['group']));}_0x1899d6=_0x12a042[_0xeabc('0xa1')]();_0x12a042['limit'](_0x3513ce);_0x12a042[_0xeabc('0x1d')](0x0);logger['debug'](_0xeabc('0x7b'),_0x12a042[_0xeabc('0x7c')]());return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x12a042[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](function(){return{'sql':_0x1899d6[_0xeabc('0x7c')]()};})['then'](respondWithResult(_0x5bb5d6,null))['catch'](handleError(_0x5bb5d6,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 41da25e..c3b7f48 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 _0xbf13=['api','moment','bluebird','path','rimraf','../../config/environment','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger'];(function(_0x24ad5f,_0x4fcf81){var _0xabb54e=function(_0x3b4e86){while(--_0x3b4e86){_0x24ad5f['push'](_0x24ad5f['shift']());}};_0xabb54e(++_0x4fcf81);}(_0xbf13,0x169));var _0x3bf1=function(_0x11bd35,_0x34dd08){_0x11bd35=_0x11bd35-0x0;var _0xab3fe7=_0xbf13[_0x11bd35];return _0xab3fe7;};'use strict';var _=require(_0x3bf1('0x0'));var util=require(_0x3bf1('0x1'));var logger=require(_0x3bf1('0x2'))(_0x3bf1('0x3'));var moment=require(_0x3bf1('0x4'));var BPromise=require(_0x3bf1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3bf1('0x6'));var rimraf=require(_0x3bf1('0x7'));var config=require(_0x3bf1('0x8'));var attributes=require('./analyticDefaultReport.attributes');module[_0x3bf1('0x9')]=function(_0x5b9693,_0x24ef94){return _0x5b9693[_0x3bf1('0xa')](_0x3bf1('0xb'),attributes,{'tableName':_0x3bf1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x16d1=['analytics_default_reports','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticDefaultReport'];(function(_0x17727b,_0x16ac94){var _0x2c0c61=function(_0x1f1a82){while(--_0x1f1a82){_0x17727b['push'](_0x17727b['shift']());}};_0x2c0c61(++_0x16ac94);}(_0x16d1,0x15d));var _0x116d=function(_0x563739,_0x4b9199){_0x563739=_0x563739-0x0;var _0x1f326a=_0x16d1[_0x563739];return _0x1f326a;};'use strict';var _=require(_0x116d('0x0'));var util=require(_0x116d('0x1'));var logger=require('../../config/logger')(_0x116d('0x2'));var moment=require('moment');var BPromise=require(_0x116d('0x3'));var rp=require(_0x116d('0x4'));var fs=require('fs');var path=require(_0x116d('0x5'));var rimraf=require(_0x116d('0x6'));var config=require(_0x116d('0x7'));var attributes=require('./analyticDefaultReport.attributes');module[_0x116d('0x8')]=function(_0x437602,_0x2fd8ed){return _0x437602[_0x116d('0x9')](_0x116d('0xa'),attributes,{'tableName':_0x116d('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 cf43dcf..5c0bfbe 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 _0x8f8a=['result','catch','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message'];(function(_0x4d2010,_0x1cdaf1){var _0x5ce455=function(_0x34ea58){while(--_0x34ea58){_0x4d2010['push'](_0x4d2010['shift']());}};_0x5ce455(++_0x1cdaf1);}(_0x8f8a,0x1f0));var _0xa8f8=function(_0x40f888,_0x1ae281){_0x40f888=_0x40f888-0x0;var _0x575a50=_0x8f8a[_0x40f888];return _0x575a50;};'use strict';var _=require('lodash');var util=require(_0xa8f8('0x0'));var moment=require(_0xa8f8('0x1'));var BPromise=require(_0xa8f8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa8f8('0x3'));var db=require(_0xa8f8('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa8f8('0x5'));var config=require(_0xa8f8('0x6'));var jayson=require(_0xa8f8('0x7'));var client=jayson['client'][_0xa8f8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc790da,_0x25b724,_0x33561f){return new BPromise(function(_0x4f4911,_0x30d768){return client['request'](_0xc790da,_0x33561f)[_0xa8f8('0x9')](function(_0x562f5c){logger[_0xa8f8('0xa')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x25b724,_0xa8f8('0xb'));logger['debug'](_0xa8f8('0xc'),_0x25b724,'request\x20sent',JSON['stringify'](_0x562f5c));if(_0x562f5c[_0xa8f8('0xd')]){if(_0x562f5c[_0xa8f8('0xd')][_0xa8f8('0xe')]===0x1f4){logger[_0xa8f8('0xd')](_0xa8f8('0xf'),_0x25b724,_0x562f5c[_0xa8f8('0xd')][_0xa8f8('0x10')]);return _0x30d768(_0x562f5c['error'][_0xa8f8('0x10')]);}logger[_0xa8f8('0xd')](_0xa8f8('0xf'),_0x25b724,_0x562f5c[_0xa8f8('0xd')][_0xa8f8('0x10')]);return _0x4f4911(_0x562f5c[_0xa8f8('0xd')][_0xa8f8('0x10')]);}else{logger[_0xa8f8('0xa')](_0xa8f8('0xf'),_0x25b724,'request\x20sent');_0x4f4911(_0x562f5c[_0xa8f8('0x11')]['message']);}})[_0xa8f8('0x12')](function(_0x9ae9f4){logger[_0xa8f8('0xd')](_0xa8f8('0xf'),_0x25b724,_0x9ae9f4);_0x30d768(_0x9ae9f4);});});} \ No newline at end of file +var _0x8a94=['../../config/logger','jayson/promise','client','then','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils'];(function(_0x1e9140,_0x44060d){var _0xf84e09=function(_0x257f57){while(--_0x257f57){_0x1e9140['push'](_0x1e9140['shift']());}};_0xf84e09(++_0x44060d);}(_0x8a94,0x13f));var _0x48a9=function(_0x576d65,_0x232150){_0x576d65=_0x576d65-0x0;var _0x5ba053=_0x8a94[_0x576d65];return _0x5ba053;};'use strict';var _=require(_0x48a9('0x0'));var util=require(_0x48a9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x48a9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x48a9('0x3'))['db'];var utils=require(_0x48a9('0x4'));var logger=require(_0x48a9('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x48a9('0x6'));var client=jayson[_0x48a9('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50b32e,_0x27da97,_0x329de5){return new BPromise(function(_0x1aa1c4,_0x5c2788){return client['request'](_0x50b32e,_0x329de5)[_0x48a9('0x8')](function(_0x44c7e7){logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x27da97,_0x48a9('0x9'));logger[_0x48a9('0xa')](_0x48a9('0xb'),_0x27da97,_0x48a9('0x9'),JSON[_0x48a9('0xc')](_0x44c7e7));if(_0x44c7e7[_0x48a9('0xd')]){if(_0x44c7e7[_0x48a9('0xd')]['code']===0x1f4){logger[_0x48a9('0xd')](_0x48a9('0xe'),_0x27da97,_0x44c7e7[_0x48a9('0xd')]['message']);return _0x5c2788(_0x44c7e7[_0x48a9('0xd')][_0x48a9('0xf')]);}logger[_0x48a9('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x27da97,_0x44c7e7[_0x48a9('0xd')][_0x48a9('0xf')]);return _0x1aa1c4(_0x44c7e7[_0x48a9('0xd')][_0x48a9('0xf')]);}else{logger['info'](_0x48a9('0xe'),_0x27da97,_0x48a9('0x9'));_0x1aa1c4(_0x44c7e7[_0x48a9('0x10')]['message']);}})[_0x48a9('0x11')](function(_0x453c1c){logger[_0x48a9('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x27da97,_0x453c1c);_0x5c2788(_0x453c1c);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index fc65471..3f0dcf5 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 _0x49c7=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','/:id','show','get','/:id/preview','preview','/:id/run','/:id/query','query','update','delete','destroy','exports'];(function(_0x38feda,_0x34d3ca){var _0x13eccb=function(_0x524b8f){while(--_0x524b8f){_0x38feda['push'](_0x38feda['shift']());}};_0x13eccb(++_0x34d3ca);}(_0x49c7,0x111));var _0x749c=function(_0x45aa87,_0x2342ab){_0x45aa87=_0x45aa87-0x0;var _0x340892=_0x49c7[_0x45aa87];return _0x340892;};'use strict';var multer=require(_0x749c('0x0'));var util=require(_0x749c('0x1'));var path=require(_0x749c('0x2'));var timeout=require(_0x749c('0x3'));var express=require(_0x749c('0x4'));var router=express[_0x749c('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x749c('0x6'));var config=require(_0x749c('0x7'));var controller=require('./analyticDefaultReport.controller');router['get']('/',auth[_0x749c('0x8')](),controller['index']);router['get'](_0x749c('0x9'),auth[_0x749c('0x8')](),controller[_0x749c('0xa')]);router[_0x749c('0xb')](_0x749c('0xc'),auth[_0x749c('0x8')](),controller[_0x749c('0xd')]);router[_0x749c('0xb')](_0x749c('0xe'),auth[_0x749c('0x8')](),controller['run']);router[_0x749c('0xb')](_0x749c('0xf'),auth[_0x749c('0x8')](),controller[_0x749c('0x10')]);router['post']('/',auth[_0x749c('0x8')](),controller['create']);router['put']('/:id',auth[_0x749c('0x8')](),controller[_0x749c('0x11')]);router[_0x749c('0x12')]('/:id',auth[_0x749c('0x8')](),controller[_0x749c('0x13')]);module[_0x749c('0x14')]=router; \ No newline at end of file +var _0x8c61=['Router','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','query','post','create','update','delete','multer','path','connect-timeout','express'];(function(_0x338805,_0x13788c){var _0x3f4f1f=function(_0xed0f6d){while(--_0xed0f6d){_0x338805['push'](_0x338805['shift']());}};_0x3f4f1f(++_0x13788c);}(_0x8c61,0x88));var _0x18c6=function(_0x282c51,_0x3b3fd5){_0x282c51=_0x282c51-0x0;var _0x4c54aa=_0x8c61[_0x282c51];return _0x4c54aa;};'use strict';var multer=require(_0x18c6('0x0'));var util=require('util');var path=require(_0x18c6('0x1'));var timeout=require(_0x18c6('0x2'));var express=require(_0x18c6('0x3'));var router=express[_0x18c6('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x18c6('0x5'));var config=require(_0x18c6('0x6'));var controller=require(_0x18c6('0x7'));router[_0x18c6('0x8')]('/',auth[_0x18c6('0x9')](),controller[_0x18c6('0xa')]);router[_0x18c6('0x8')](_0x18c6('0xb'),auth[_0x18c6('0x9')](),controller['show']);router[_0x18c6('0x8')](_0x18c6('0xc'),auth[_0x18c6('0x9')](),controller[_0x18c6('0xd')]);router['get'](_0x18c6('0xe'),auth[_0x18c6('0x9')](),controller['run']);router[_0x18c6('0x8')]('/:id/query',auth[_0x18c6('0x9')](),controller[_0x18c6('0xf')]);router[_0x18c6('0x10')]('/',auth[_0x18c6('0x9')](),controller[_0x18c6('0x11')]);router['put'](_0x18c6('0xb'),auth['isAuthenticated'](),controller[_0x18c6('0x12')]);router[_0x18c6('0x13')](_0x18c6('0xb'),auth[_0x18c6('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 29bfa97..8f291d0 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 _0x7108=['csv','pdf','Loading','scheduled','manual','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x2c02db,_0x4e46ad){var _0x1623f8=function(_0x2aeb3b){while(--_0x2aeb3b){_0x2c02db['push'](_0x2c02db['shift']());}};_0x1623f8(++_0x4e46ad);}(_0x7108,0xd8));var _0x8710=function(_0x33973e,_0x4bc984){_0x33973e=_0x33973e-0x0;var _0x2e10d7=_0x7108[_0x33973e];return _0x2e10d7;};'use strict';var Sequelize=require(_0x8710('0x0'));var moment=require('moment');module[_0x8710('0x1')]={'name':{'type':Sequelize[_0x8710('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x8710('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x8710('0x3')](_0x8710('0x4'),_0x8710('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0x8710('0x4')},'savename':{'type':Sequelize[_0x8710('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x8710('0x2')],'defaultValue':_0x8710('0x6')},'type':{'type':Sequelize[_0x8710('0x3')]('manual',_0x8710('0x7')),'allowNull':![],'defaultValue':_0x8710('0x8')},'reportId':{'type':Sequelize[_0x8710('0x9')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x8710('0x2')]}}; \ No newline at end of file +var _0x6b26=['INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','DATE','Loading','manual','scheduled'];(function(_0x5a2b99,_0x352dd7){var _0x167c87=function(_0xbd4900){while(--_0xbd4900){_0x5a2b99['push'](_0x5a2b99['shift']());}};_0x167c87(++_0x352dd7);}(_0x6b26,0x152));var _0x66b2=function(_0x3b9ffd,_0x9c8e5b){_0x3b9ffd=_0x3b9ffd-0x0;var _0x4bdb61=_0x6b26[_0x3b9ffd];return _0x4bdb61;};'use strict';var Sequelize=require(_0x66b2('0x0'));var moment=require(_0x66b2('0x1'));module[_0x66b2('0x2')]={'name':{'type':Sequelize[_0x66b2('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x66b2('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x66b2('0x4')]('csv','pdf','xlsx'),'allowNull':![],'defaultValue':_0x66b2('0x5')},'savename':{'type':Sequelize[_0x66b2('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x66b2('0x6')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x66b2('0x7')},'type':{'type':Sequelize['ENUM'](_0x66b2('0x8'),_0x66b2('0x9')),'allowNull':![],'defaultValue':_0x66b2('0x8')},'reportId':{'type':Sequelize[_0x66b2('0xa')](0xb)[_0x66b2('0xb')]},'reportType':{'type':Sequelize[_0x66b2('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 6e7921b..93814a5 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 _0x5c4d=['jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','count','set','reject','save','update','then','destroy','get','error','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','params','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','basename','savename','output','existsSync','join','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','root','toLowerCase','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto'];(function(_0x31797a,_0x3274d4){var _0x2490e1=function(_0x1303a7){while(--_0x1303a7){_0x31797a['push'](_0x31797a['shift']());}};_0x2490e1(++_0x3274d4);}(_0x5c4d,0x16e));var _0xd5c4=function(_0x27dba4,_0x419253){_0x27dba4=_0x27dba4-0x0;var _0x35ec9d=_0x5c4d[_0x27dba4];return _0x35ec9d;};'use strict';var emlformat=require(_0xd5c4('0x0'));var rimraf=require(_0xd5c4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd5c4('0x2'));var moment=require(_0xd5c4('0x3'));var BPromise=require(_0xd5c4('0x4'));var Mustache=require(_0xd5c4('0x5'));var util=require(_0xd5c4('0x6'));var path=require(_0xd5c4('0x7'));var sox=require(_0xd5c4('0x8'));var csv=require('to-csv');var ejs=require(_0xd5c4('0x9'));var fs=require('fs');var fs_extra=require(_0xd5c4('0xa'));var _=require(_0xd5c4('0xb'));var squel=require(_0xd5c4('0xc'));var crypto=require(_0xd5c4('0xd'));var jsforce=require(_0xd5c4('0xe'));var deskjs=require(_0xd5c4('0xf'));var toCsv=require(_0xd5c4('0x10'));var querystring=require(_0xd5c4('0x11'));var Papa=require(_0xd5c4('0x12'));var Redis=require(_0xd5c4('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xd5c4('0x14'));var as=require(_0xd5c4('0x15'));var hardwareService=require(_0xd5c4('0x16'));var logger=require('../../config/logger')(_0xd5c4('0x17'));var utils=require(_0xd5c4('0x18'));var config=require(_0xd5c4('0x19'));var licenseUtil=require(_0xd5c4('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49a25b,_0x3a6463){_0x3a6463=_0x3a6463||0xcc;return function(_0x3ec6ae){if(_0x3ec6ae){return _0x49a25b[_0xd5c4('0x1b')](_0x3a6463);}return _0x49a25b[_0xd5c4('0x1c')](_0x3a6463)['end']();};}function respondWithResult(_0x32a397,_0x456e1a){_0x456e1a=_0x456e1a||0xc8;return function(_0x827ad4){if(_0x827ad4){return _0x32a397[_0xd5c4('0x1c')](_0x456e1a)[_0xd5c4('0x1d')](_0x827ad4);}};}function respondWithFilteredResult(_0x1328a5,_0x17a405){return function(_0x43aeb3){if(_0x43aeb3){var _0x9f4f9b=typeof _0x17a405[_0xd5c4('0x1e')]==='undefined'&&typeof _0x17a405[_0xd5c4('0x1f')]==='undefined';var _0x328f1f=_0x43aeb3[_0xd5c4('0x20')];var _0x3a6a68=_0x9f4f9b?0x0:_0x17a405[_0xd5c4('0x1e')];var _0x4373c4=_0x9f4f9b?_0x43aeb3[_0xd5c4('0x20')]:_0x17a405[_0xd5c4('0x1e')]+_0x17a405['limit'];var _0x161961;if(_0x4373c4>=_0x328f1f){_0x4373c4=_0x328f1f;_0x161961=0xc8;}else{_0x161961=0xce;}_0x1328a5[_0xd5c4('0x1c')](_0x161961);return _0x1328a5[_0xd5c4('0x21')]('Content-Range',_0x3a6a68+'-'+_0x4373c4+'/'+_0x328f1f)[_0xd5c4('0x1d')](_0x43aeb3);}return null;};}function patchUpdates(_0x2fb867){return function(_0x28f4e1){try{jsonpatch['apply'](_0x28f4e1,_0x2fb867,!![]);}catch(_0x41c882){return BPromise[_0xd5c4('0x22')](_0x41c882);}return _0x28f4e1[_0xd5c4('0x23')]();};}function saveUpdates(_0x523fa9,_0x31b3de){return function(_0x1892e5){if(_0x1892e5){return _0x1892e5[_0xd5c4('0x24')](_0x523fa9)[_0xd5c4('0x25')](function(_0x39776f){return _0x39776f;});}return null;};}function removeEntity(_0x5ac428,_0x15c4dc){return function(_0x3304c0){if(_0x3304c0){return _0x3304c0[_0xd5c4('0x26')]()[_0xd5c4('0x25')](function(){var _0x126224=_0x3304c0[_0xd5c4('0x27')]({'plain':!![]});var _0x5a62e8='ExtractedReports';return db['UserProfileResource'][_0xd5c4('0x26')]({'where':{'type':_0x5a62e8,'resourceId':_0x126224['id']}})[_0xd5c4('0x25')](function(){return _0x3304c0;});})[_0xd5c4('0x25')](function(){_0x5ac428[_0xd5c4('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3df2c4,_0x4dca86){return function(_0x311749){if(!_0x311749){_0x3df2c4[_0xd5c4('0x1b')](0x194);}return _0x311749;};}function handleError(_0x314da7,_0x4e6388){_0x4e6388=_0x4e6388||0x1f4;return function(_0x370b97){logger[_0xd5c4('0x28')](_0x370b97['stack']);if(_0x370b97[_0xd5c4('0x29')]){delete _0x370b97[_0xd5c4('0x29')];}_0x314da7[_0xd5c4('0x1c')](_0x4e6388)[_0xd5c4('0x2a')](_0x370b97);};}exports[_0xd5c4('0x2b')]=function(_0x1ae462,_0x6f2f2){var _0x1c4cdc={},_0xa67098={},_0x393654={'count':0x0,'rows':[]};var _0x5cb3e4=_[_0xd5c4('0x2c')](db[_0xd5c4('0x2d')][_0xd5c4('0x2e')],function(_0x518f2b){return{'name':_0x518f2b[_0xd5c4('0x2f')],'type':_0x518f2b['type'][_0xd5c4('0x30')]};});_0xa67098[_0xd5c4('0x31')]=_['map'](_0x5cb3e4,_0xd5c4('0x29'));_0xa67098[_0xd5c4('0x32')]=_[_0xd5c4('0x33')](_0x1ae462['query']);_0xa67098[_0xd5c4('0x34')]=_[_0xd5c4('0x35')](_0xa67098['model'],_0xa67098[_0xd5c4('0x32')]);_0x1c4cdc[_0xd5c4('0x36')]=_[_0xd5c4('0x35')](_0xa67098['model'],qs[_0xd5c4('0x37')](_0x1ae462[_0xd5c4('0x32')][_0xd5c4('0x37')]));_0x1c4cdc[_0xd5c4('0x36')]=_0x1c4cdc[_0xd5c4('0x36')][_0xd5c4('0x38')]?_0x1c4cdc['attributes']:_0xa67098[_0xd5c4('0x31')];if(!_0x1ae462[_0xd5c4('0x32')][_0xd5c4('0x39')](_0xd5c4('0x3a'))){_0x1c4cdc[_0xd5c4('0x1f')]=qs[_0xd5c4('0x1f')](_0x1ae462['query']['limit']);_0x1c4cdc[_0xd5c4('0x1e')]=qs[_0xd5c4('0x1e')](_0x1ae462[_0xd5c4('0x32')][_0xd5c4('0x1e')]);}_0x1c4cdc['order']=qs['sort'](_0x1ae462[_0xd5c4('0x32')][_0xd5c4('0x3b')]);_0x1c4cdc['where']=qs[_0xd5c4('0x34')](_[_0xd5c4('0x3c')](_0x1ae462[_0xd5c4('0x32')],_0xa67098['filters']),_0x5cb3e4);if(_0x1ae462[_0xd5c4('0x32')][_0xd5c4('0x3d')]){_0x1c4cdc[_0xd5c4('0x3e')]=_[_0xd5c4('0x3f')](_0x1c4cdc[_0xd5c4('0x3e')],{'$or':_[_0xd5c4('0x2c')](_0x5cb3e4,function(_0x31543f){if(_0x31543f[_0xd5c4('0x40')]!==_0xd5c4('0x41')){var _0x705dfc={};_0x705dfc[_0x31543f[_0xd5c4('0x29')]]={'$like':'%'+_0x1ae462[_0xd5c4('0x32')][_0xd5c4('0x3d')]+'%'};return _0x705dfc;}})});}_0x1c4cdc=_[_0xd5c4('0x3f')]({},_0x1c4cdc,_0x1ae462['options']);var _0x232ab7={'where':_0x1c4cdc[_0xd5c4('0x3e')]};return db[_0xd5c4('0x2d')][_0xd5c4('0x20')](_0x232ab7)[_0xd5c4('0x25')](function(_0x475c3f){_0x393654[_0xd5c4('0x20')]=_0x475c3f;if(_0x1ae462['query'][_0xd5c4('0x42')]){_0x1c4cdc[_0xd5c4('0x43')]=[{'all':!![]}];}return db[_0xd5c4('0x2d')]['findAll'](_0x1c4cdc);})[_0xd5c4('0x25')](function(_0x3a2dec){_0x393654['rows']=_0x3a2dec;return _0x393654;})[_0xd5c4('0x25')](respondWithFilteredResult(_0x6f2f2,_0x1c4cdc))['catch'](handleError(_0x6f2f2,null));};exports['show']=function(_0x2399bd,_0x2579e3){var _0x1e508e={'raw':!![],'where':{'id':_0x2399bd[_0xd5c4('0x44')]['id']}},_0x1c1887={};_0x1c1887[_0xd5c4('0x31')]=_[_0xd5c4('0x33')](db[_0xd5c4('0x2d')][_0xd5c4('0x2e')]);_0x1c1887[_0xd5c4('0x32')]=_[_0xd5c4('0x33')](_0x2399bd['query']);_0x1c1887[_0xd5c4('0x34')]=_[_0xd5c4('0x35')](_0x1c1887[_0xd5c4('0x31')],_0x1c1887[_0xd5c4('0x32')]);_0x1e508e[_0xd5c4('0x36')]=_['intersection'](_0x1c1887['model'],qs[_0xd5c4('0x37')](_0x2399bd['query']['fields']));_0x1e508e['attributes']=_0x1e508e[_0xd5c4('0x36')]['length']?_0x1e508e['attributes']:_0x1c1887['model'];if(_0x2399bd[_0xd5c4('0x32')][_0xd5c4('0x42')]){_0x1e508e['include']=[{'all':!![]}];}_0x1e508e=_[_0xd5c4('0x3f')]({},_0x1e508e,_0x2399bd[_0xd5c4('0x45')]);return db[_0xd5c4('0x2d')][_0xd5c4('0x46')](_0x1e508e)[_0xd5c4('0x25')](handleEntityNotFound(_0x2579e3,null))[_0xd5c4('0x25')](respondWithResult(_0x2579e3,null))[_0xd5c4('0x47')](handleError(_0x2579e3,null));};exports[_0xd5c4('0x48')]=function(_0x331070,_0x228d82){return db[_0xd5c4('0x2d')][_0xd5c4('0x48')](_0x331070['body'],{})[_0xd5c4('0x25')](function(_0x2d5006){var _0x42ac05=_0x331070[_0xd5c4('0x49')][_0xd5c4('0x27')]({'plain':!![]});if(!_0x42ac05)throw new Error(_0xd5c4('0x4a'));if(_0x42ac05[_0xd5c4('0x4b')]===_0xd5c4('0x49')){var _0x649d15=_0x2d5006[_0xd5c4('0x27')]({'plain':!![]});var _0x55a593=_0xd5c4('0x4c');return db[_0xd5c4('0x4d')][_0xd5c4('0x46')]({'where':{'name':_0x55a593,'userProfileId':_0x42ac05[_0xd5c4('0x4e')]},'raw':!![]})['then'](function(_0x486ffd){if(_0x486ffd&&_0x486ffd[_0xd5c4('0x4f')]===0x0){return db[_0xd5c4('0x50')][_0xd5c4('0x48')]({'name':_0x649d15[_0xd5c4('0x29')],'resourceId':_0x649d15['id'],'type':_0x486ffd[_0xd5c4('0x29')],'sectionId':_0x486ffd['id']},{})[_0xd5c4('0x25')](function(){return _0x2d5006;});}else{return _0x2d5006;}})[_0xd5c4('0x47')](function(_0x2a8dde){logger[_0xd5c4('0x28')](_0xd5c4('0x51'),_0x2a8dde);throw _0x2a8dde;});}return _0x2d5006;})[_0xd5c4('0x25')](respondWithResult(_0x228d82,0xc9))[_0xd5c4('0x47')](handleError(_0x228d82,null));};exports[_0xd5c4('0x24')]=function(_0x5cf2c3,_0x1d22c0){if(_0x5cf2c3[_0xd5c4('0x52')]['id']){delete _0x5cf2c3[_0xd5c4('0x52')]['id'];}return db[_0xd5c4('0x2d')][_0xd5c4('0x46')]({'where':{'id':_0x5cf2c3[_0xd5c4('0x44')]['id']}})[_0xd5c4('0x25')](handleEntityNotFound(_0x1d22c0,null))['then'](saveUpdates(_0x5cf2c3[_0xd5c4('0x52')],null))[_0xd5c4('0x25')](respondWithResult(_0x1d22c0,null))[_0xd5c4('0x47')](handleError(_0x1d22c0,null));};exports[_0xd5c4('0x26')]=function(_0x48be42,_0x548302){return db[_0xd5c4('0x2d')]['find']({'where':{'id':_0x48be42[_0xd5c4('0x44')]['id']}})[_0xd5c4('0x25')](handleEntityNotFound(_0x548302,null))['then'](removeEntity(_0x548302,null))[_0xd5c4('0x47')](handleError(_0x548302,null));};exports[_0xd5c4('0x53')]=function(_0x59d80f,_0x3e66d6,_0x300057){return db[_0xd5c4('0x2d')][_0xd5c4('0x46')]({'where':{'id':_0x59d80f[_0xd5c4('0x44')]['id']},'attributes':[_0xd5c4('0x29'),_0xd5c4('0x54'),_0xd5c4('0x55'),_0xd5c4('0x56')],'raw':!![]})[_0xd5c4('0x25')](handleEntityNotFound(_0x3e66d6,null))[_0xd5c4('0x25')](function(_0x5624ed){if(_0x5624ed){if(!fs[_0xd5c4('0x57')](path[_0xd5c4('0x58')](config['root'],_0xd5c4('0x59'),_0x5624ed[_0xd5c4('0x55')]))){throw new db['Sequelize'][(_0xd5c4('0x5a'))](_0xd5c4('0x5b'));}if(_0x59d80f[_0xd5c4('0x32')][_0xd5c4('0x5c')]){return _0x3e66d6['sendStatus'](0xc8);}return _0x3e66d6['download'](path[_0xd5c4('0x58')](config[_0xd5c4('0x5d')],'server/files/reports',_0x5624ed['savename']),util['format']('%s.%s',_0x5624ed[_0xd5c4('0x54')]||_0x5624ed[_0xd5c4('0x29')],_0x5624ed['output'][_0xd5c4('0x5e')]()));}})[_0xd5c4('0x47')](handleError(_0x3e66d6,null));}; \ No newline at end of file +var _0xc28f=['../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','error','name','map','AnalyticExtractedReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0xd6b4a0,_0x1c4b83){var _0xd9048f=function(_0x926056){while(--_0x926056){_0xd6b4a0['push'](_0xd6b4a0['shift']());}};_0xd9048f(++_0x1c4b83);}(_0xc28f,0x109));var _0xfc28=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xc28f[_0x2b10c6];return _0x3789d2;};'use strict';var emlformat=require(_0xfc28('0x0'));var rimraf=require(_0xfc28('0x1'));var zipdir=require(_0xfc28('0x2'));var jsonpatch=require(_0xfc28('0x3'));var rp=require(_0xfc28('0x4'));var moment=require(_0xfc28('0x5'));var BPromise=require(_0xfc28('0x6'));var Mustache=require('mustache');var util=require(_0xfc28('0x7'));var path=require(_0xfc28('0x8'));var sox=require(_0xfc28('0x9'));var csv=require(_0xfc28('0xa'));var ejs=require(_0xfc28('0xb'));var fs=require('fs');var fs_extra=require(_0xfc28('0xc'));var _=require(_0xfc28('0xd'));var squel=require(_0xfc28('0xe'));var crypto=require(_0xfc28('0xf'));var jsforce=require(_0xfc28('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xfc28('0xa'));var querystring=require(_0xfc28('0x11'));var Papa=require(_0xfc28('0x12'));var Redis=require(_0xfc28('0x13'));var authService=require(_0xfc28('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc28('0x15'));var logger=require(_0xfc28('0x16'))(_0xfc28('0x17'));var utils=require(_0xfc28('0x18'));var config=require(_0xfc28('0x19'));var licenseUtil=require(_0xfc28('0x1a'));var db=require(_0xfc28('0x1b'))['db'];function respondWithStatusCode(_0x475dfa,_0x392f46){_0x392f46=_0x392f46||0xcc;return function(_0x281146){if(_0x281146){return _0x475dfa[_0xfc28('0x1c')](_0x392f46);}return _0x475dfa['status'](_0x392f46)[_0xfc28('0x1d')]();};}function respondWithResult(_0x3c3ad9,_0x3678aa){_0x3678aa=_0x3678aa||0xc8;return function(_0x5336f7){if(_0x5336f7){return _0x3c3ad9[_0xfc28('0x1e')](_0x3678aa)[_0xfc28('0x1f')](_0x5336f7);}};}function respondWithFilteredResult(_0x59f8d5,_0x5144cb){return function(_0x4cd437){if(_0x4cd437){var _0x4ac0bc=typeof _0x5144cb[_0xfc28('0x20')]==='undefined'&&typeof _0x5144cb[_0xfc28('0x21')]===_0xfc28('0x22');var _0x254235=_0x4cd437[_0xfc28('0x23')];var _0x2a7014=_0x4ac0bc?0x0:_0x5144cb['offset'];var _0x3c5be0=_0x4ac0bc?_0x4cd437['count']:_0x5144cb['offset']+_0x5144cb[_0xfc28('0x21')];var _0x2b1220;if(_0x3c5be0>=_0x254235){_0x3c5be0=_0x254235;_0x2b1220=0xc8;}else{_0x2b1220=0xce;}_0x59f8d5[_0xfc28('0x1e')](_0x2b1220);return _0x59f8d5[_0xfc28('0x24')](_0xfc28('0x25'),_0x2a7014+'-'+_0x3c5be0+'/'+_0x254235)[_0xfc28('0x1f')](_0x4cd437);}return null;};}function patchUpdates(_0x32cf4a){return function(_0x2f9ce4){try{jsonpatch['apply'](_0x2f9ce4,_0x32cf4a,!![]);}catch(_0x3ba24c){return BPromise[_0xfc28('0x26')](_0x3ba24c);}return _0x2f9ce4[_0xfc28('0x27')]();};}function saveUpdates(_0x17d1e2,_0x245052){return function(_0x51e3dc){if(_0x51e3dc){return _0x51e3dc[_0xfc28('0x28')](_0x17d1e2)[_0xfc28('0x29')](function(_0x36d4af){return _0x36d4af;});}return null;};}function removeEntity(_0x3f7c28,_0x4d40f7){return function(_0x226c47){if(_0x226c47){return _0x226c47[_0xfc28('0x2a')]()[_0xfc28('0x29')](function(){var _0x1073f3=_0x226c47[_0xfc28('0x2b')]({'plain':!![]});var _0x4657cf=_0xfc28('0x2c');return db[_0xfc28('0x2d')][_0xfc28('0x2a')]({'where':{'type':_0x4657cf,'resourceId':_0x1073f3['id']}})[_0xfc28('0x29')](function(){return _0x226c47;});})['then'](function(){_0x3f7c28[_0xfc28('0x1e')](0xcc)[_0xfc28('0x1d')]();});}};}function handleEntityNotFound(_0x5a50a1,_0x3129ae){return function(_0x1c36e7){if(!_0x1c36e7){_0x5a50a1[_0xfc28('0x1c')](0x194);}return _0x1c36e7;};}function handleError(_0x3688f9,_0x159108){_0x159108=_0x159108||0x1f4;return function(_0x2514f3){logger[_0xfc28('0x2e')](_0x2514f3['stack']);if(_0x2514f3[_0xfc28('0x2f')]){delete _0x2514f3[_0xfc28('0x2f')];}_0x3688f9['status'](_0x159108)['send'](_0x2514f3);};}exports['index']=function(_0x365ecc,_0x5992b6){var _0x34cd29={},_0x133085={},_0x446e45={'count':0x0,'rows':[]};var _0x2b9ab5=_[_0xfc28('0x30')](db[_0xfc28('0x31')]['rawAttributes'],function(_0x1530f5){return{'name':_0x1530f5[_0xfc28('0x32')],'type':_0x1530f5[_0xfc28('0x33')][_0xfc28('0x34')]};});_0x133085[_0xfc28('0x35')]=_[_0xfc28('0x30')](_0x2b9ab5,_0xfc28('0x2f'));_0x133085[_0xfc28('0x36')]=_[_0xfc28('0x37')](_0x365ecc[_0xfc28('0x36')]);_0x133085[_0xfc28('0x38')]=_[_0xfc28('0x39')](_0x133085[_0xfc28('0x35')],_0x133085[_0xfc28('0x36')]);_0x34cd29[_0xfc28('0x3a')]=_[_0xfc28('0x39')](_0x133085['model'],qs[_0xfc28('0x3b')](_0x365ecc[_0xfc28('0x36')][_0xfc28('0x3b')]));_0x34cd29[_0xfc28('0x3a')]=_0x34cd29[_0xfc28('0x3a')][_0xfc28('0x3c')]?_0x34cd29[_0xfc28('0x3a')]:_0x133085['model'];if(!_0x365ecc[_0xfc28('0x36')]['hasOwnProperty'](_0xfc28('0x3d'))){_0x34cd29[_0xfc28('0x21')]=qs['limit'](_0x365ecc['query'][_0xfc28('0x21')]);_0x34cd29[_0xfc28('0x20')]=qs['offset'](_0x365ecc[_0xfc28('0x36')][_0xfc28('0x20')]);}_0x34cd29['order']=qs['sort'](_0x365ecc[_0xfc28('0x36')]['sort']);_0x34cd29[_0xfc28('0x3e')]=qs[_0xfc28('0x38')](_[_0xfc28('0x3f')](_0x365ecc[_0xfc28('0x36')],_0x133085[_0xfc28('0x38')]),_0x2b9ab5);if(_0x365ecc['query'][_0xfc28('0x40')]){_0x34cd29[_0xfc28('0x3e')]=_['merge'](_0x34cd29[_0xfc28('0x3e')],{'$or':_[_0xfc28('0x30')](_0x2b9ab5,function(_0x45c22a){if(_0x45c22a[_0xfc28('0x33')]!==_0xfc28('0x41')){var _0x4459cd={};_0x4459cd[_0x45c22a[_0xfc28('0x2f')]]={'$like':'%'+_0x365ecc[_0xfc28('0x36')]['filter']+'%'};return _0x4459cd;}})});}_0x34cd29=_[_0xfc28('0x42')]({},_0x34cd29,_0x365ecc[_0xfc28('0x43')]);var _0x4dd8eb={'where':_0x34cd29[_0xfc28('0x3e')]};return db[_0xfc28('0x31')][_0xfc28('0x23')](_0x4dd8eb)['then'](function(_0x461b55){_0x446e45['count']=_0x461b55;if(_0x365ecc[_0xfc28('0x36')]['includeAll']){_0x34cd29[_0xfc28('0x44')]=[{'all':!![]}];}return db[_0xfc28('0x31')][_0xfc28('0x45')](_0x34cd29);})[_0xfc28('0x29')](function(_0x96897b){_0x446e45[_0xfc28('0x46')]=_0x96897b;return _0x446e45;})[_0xfc28('0x29')](respondWithFilteredResult(_0x5992b6,_0x34cd29))['catch'](handleError(_0x5992b6,null));};exports['show']=function(_0x1a40e1,_0x11c315){var _0x1f21bf={'raw':!![],'where':{'id':_0x1a40e1[_0xfc28('0x47')]['id']}},_0x3cf1f0={};_0x3cf1f0[_0xfc28('0x35')]=_[_0xfc28('0x37')](db['AnalyticExtractedReport']['rawAttributes']);_0x3cf1f0['query']=_[_0xfc28('0x37')](_0x1a40e1[_0xfc28('0x36')]);_0x3cf1f0[_0xfc28('0x38')]=_['intersection'](_0x3cf1f0[_0xfc28('0x35')],_0x3cf1f0[_0xfc28('0x36')]);_0x1f21bf[_0xfc28('0x3a')]=_[_0xfc28('0x39')](_0x3cf1f0[_0xfc28('0x35')],qs['fields'](_0x1a40e1[_0xfc28('0x36')]['fields']));_0x1f21bf['attributes']=_0x1f21bf['attributes'][_0xfc28('0x3c')]?_0x1f21bf[_0xfc28('0x3a')]:_0x3cf1f0[_0xfc28('0x35')];if(_0x1a40e1['query'][_0xfc28('0x48')]){_0x1f21bf['include']=[{'all':!![]}];}_0x1f21bf=_['merge']({},_0x1f21bf,_0x1a40e1[_0xfc28('0x43')]);return db[_0xfc28('0x31')][_0xfc28('0x49')](_0x1f21bf)[_0xfc28('0x29')](handleEntityNotFound(_0x11c315,null))[_0xfc28('0x29')](respondWithResult(_0x11c315,null))['catch'](handleError(_0x11c315,null));};exports['create']=function(_0x475fbc,_0x420ade){return db[_0xfc28('0x31')][_0xfc28('0x4a')](_0x475fbc['body'],{})[_0xfc28('0x29')](function(_0x1ca9a6){var _0x486d61=_0x475fbc[_0xfc28('0x4b')]['get']({'plain':!![]});if(!_0x486d61)throw new Error(_0xfc28('0x4c'));if(_0x486d61['role']===_0xfc28('0x4b')){var _0x3d9d54=_0x1ca9a6[_0xfc28('0x2b')]({'plain':!![]});var _0x7dc80a=_0xfc28('0x2c');return db[_0xfc28('0x4d')]['find']({'where':{'name':_0x7dc80a,'userProfileId':_0x486d61[_0xfc28('0x4e')]},'raw':!![]})[_0xfc28('0x29')](function(_0x358a95){if(_0x358a95&&_0x358a95[_0xfc28('0x4f')]===0x0){return db[_0xfc28('0x2d')][_0xfc28('0x4a')]({'name':_0x3d9d54[_0xfc28('0x2f')],'resourceId':_0x3d9d54['id'],'type':_0x358a95['name'],'sectionId':_0x358a95['id']},{})['then'](function(){return _0x1ca9a6;});}else{return _0x1ca9a6;}})[_0xfc28('0x50')](function(_0x2a9543){logger[_0xfc28('0x2e')](_0xfc28('0x51'),_0x2a9543);throw _0x2a9543;});}return _0x1ca9a6;})['then'](respondWithResult(_0x420ade,0xc9))[_0xfc28('0x50')](handleError(_0x420ade,null));};exports['update']=function(_0x17e5cf,_0x59d51b){if(_0x17e5cf[_0xfc28('0x52')]['id']){delete _0x17e5cf[_0xfc28('0x52')]['id'];}return db[_0xfc28('0x31')][_0xfc28('0x49')]({'where':{'id':_0x17e5cf[_0xfc28('0x47')]['id']}})[_0xfc28('0x29')](handleEntityNotFound(_0x59d51b,null))[_0xfc28('0x29')](saveUpdates(_0x17e5cf[_0xfc28('0x52')],null))[_0xfc28('0x29')](respondWithResult(_0x59d51b,null))[_0xfc28('0x50')](handleError(_0x59d51b,null));};exports[_0xfc28('0x2a')]=function(_0x259e6e,_0xc228fb){return db[_0xfc28('0x31')][_0xfc28('0x49')]({'where':{'id':_0x259e6e['params']['id']}})[_0xfc28('0x29')](handleEntityNotFound(_0xc228fb,null))['then'](removeEntity(_0xc228fb,null))[_0xfc28('0x50')](handleError(_0xc228fb,null));};exports[_0xfc28('0x53')]=function(_0x3c99ff,_0x108c99,_0x54fdb6){return db[_0xfc28('0x31')][_0xfc28('0x49')]({'where':{'id':_0x3c99ff['params']['id']},'attributes':['name',_0xfc28('0x54'),_0xfc28('0x55'),_0xfc28('0x56')],'raw':!![]})[_0xfc28('0x29')](handleEntityNotFound(_0x108c99,null))[_0xfc28('0x29')](function(_0x4d6d2a){if(_0x4d6d2a){if(!fs[_0xfc28('0x57')](path[_0xfc28('0x58')](config[_0xfc28('0x59')],_0xfc28('0x5a'),_0x4d6d2a['savename']))){throw new db[(_0xfc28('0x5b'))][(_0xfc28('0x5c'))](_0xfc28('0x5d'));}if(_0x3c99ff[_0xfc28('0x36')][_0xfc28('0x5e')]){return _0x108c99[_0xfc28('0x1c')](0xc8);}return _0x108c99[_0xfc28('0x53')](path[_0xfc28('0x58')](config[_0xfc28('0x59')],_0xfc28('0x5a'),_0x4d6d2a[_0xfc28('0x55')]),util['format'](_0xfc28('0x5f'),_0x4d6d2a[_0xfc28('0x54')]||_0x4d6d2a[_0xfc28('0x2f')],_0x4d6d2a[_0xfc28('0x56')][_0xfc28('0x60')]()));}})[_0xfc28('0x50')](handleError(_0x108c99,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 3e4e5e4..e24b4dd 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 _0xe8ea=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api'];(function(_0x29f203,_0x555b42){var _0x50ebb3=function(_0x3bd2ec){while(--_0x3bd2ec){_0x29f203['push'](_0x29f203['shift']());}};_0x50ebb3(++_0x555b42);}(_0xe8ea,0x96));var _0xae8e=function(_0x30e56e,_0x133fea){_0x30e56e=_0x30e56e-0x0;var _0x36f9cb=_0xe8ea[_0x30e56e];return _0x36f9cb;};'use strict';var _=require(_0xae8e('0x0'));var util=require(_0xae8e('0x1'));var logger=require(_0xae8e('0x2'))(_0xae8e('0x3'));var moment=require(_0xae8e('0x4'));var BPromise=require(_0xae8e('0x5'));var rp=require(_0xae8e('0x6'));var fs=require('fs');var path=require(_0xae8e('0x7'));var rimraf=require(_0xae8e('0x8'));var config=require(_0xae8e('0x9'));var attributes=require(_0xae8e('0xa'));module[_0xae8e('0xb')]=function(_0x2e018a,_0x190c15){return _0x2e018a['define'](_0xae8e('0xc'),attributes,{'tableName':_0xae8e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe912=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash'];(function(_0x5dc755,_0x3254d0){var _0x24ce81=function(_0x3c8315){while(--_0x3c8315){_0x5dc755['push'](_0x5dc755['shift']());}};_0x24ce81(++_0x3254d0);}(_0xe912,0xb5));var _0x2e91=function(_0x5e9f46,_0x4967c9){_0x5e9f46=_0x5e9f46-0x0;var _0x3ad20c=_0xe912[_0x5e9f46];return _0x3ad20c;};'use strict';var _=require(_0x2e91('0x0'));var util=require(_0x2e91('0x1'));var logger=require(_0x2e91('0x2'))(_0x2e91('0x3'));var moment=require(_0x2e91('0x4'));var BPromise=require('bluebird');var rp=require(_0x2e91('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e91('0x6'));var config=require(_0x2e91('0x7'));var attributes=require(_0x2e91('0x8'));module[_0x2e91('0x9')]=function(_0x2a7583,_0x29080e){return _0x2a7583[_0x2e91('0xa')](_0x2e91('0xb'),attributes,{'tableName':_0x2e91('0xc'),'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 ebd91db..6655d4b 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 _0xed65=['randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment','bluebird'];(function(_0x30a204,_0x48370f){var _0x1a1350=function(_0x5844db){while(--_0x5844db){_0x30a204['push'](_0x30a204['shift']());}};_0x1a1350(++_0x48370f);}(_0xed65,0xcf));var _0x5ed6=function(_0x30b057,_0x1d1505){_0x30b057=_0x30b057-0x0;var _0x331671=_0xed65[_0x30b057];return _0x331671;};'use strict';var _=require(_0x5ed6('0x0'));var util=require('util');var moment=require(_0x5ed6('0x1'));var BPromise=require(_0x5ed6('0x2'));var rs=require(_0x5ed6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5ed6('0x4'));var logger=require('../../config/logger')(_0x5ed6('0x5'));var config=require(_0x5ed6('0x6'));var jayson=require(_0x5ed6('0x7'));var client=jayson[_0x5ed6('0x8')][_0x5ed6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c46e2,_0x136e67,_0x2ce5cc){return new BPromise(function(_0x3a7d74,_0x102f8d){return client[_0x5ed6('0xa')](_0x1c46e2,_0x2ce5cc)[_0x5ed6('0xb')](function(_0x4f9990){logger[_0x5ed6('0xc')](_0x5ed6('0xd'),_0x136e67,_0x5ed6('0xe'));logger[_0x5ed6('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x136e67,'request\x20sent',JSON[_0x5ed6('0x10')](_0x4f9990));if(_0x4f9990[_0x5ed6('0x11')]){if(_0x4f9990[_0x5ed6('0x11')]['code']===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x136e67,_0x4f9990[_0x5ed6('0x11')]['message']);return _0x102f8d(_0x4f9990['error'][_0x5ed6('0x12')]);}logger['error'](_0x5ed6('0xd'),_0x136e67,_0x4f9990[_0x5ed6('0x11')][_0x5ed6('0x12')]);return _0x3a7d74(_0x4f9990[_0x5ed6('0x11')][_0x5ed6('0x12')]);}else{logger[_0x5ed6('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x136e67,_0x5ed6('0xe'));_0x3a7d74(_0x4f9990[_0x5ed6('0x13')]['message']);}})[_0x5ed6('0x14')](function(_0x3e6d14){logger[_0x5ed6('0x11')](_0x5ed6('0xd'),_0x136e67,_0x3e6d14);_0x102f8d(_0x3e6d14);});});} \ No newline at end of file +var _0x3bc4=['error','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code'];(function(_0x3b2191,_0x13dba7){var _0x2c6233=function(_0x1247fb){while(--_0x1247fb){_0x3b2191['push'](_0x3b2191['shift']());}};_0x2c6233(++_0x13dba7);}(_0x3bc4,0xc9));var _0x43bc=function(_0x41930d,_0x478ed3){_0x41930d=_0x41930d-0x0;var _0x455ade=_0x3bc4[_0x41930d];return _0x455ade;};'use strict';var _=require('lodash');var util=require(_0x43bc('0x0'));var moment=require(_0x43bc('0x1'));var BPromise=require(_0x43bc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x43bc('0x3'));var db=require(_0x43bc('0x4'))['db'];var utils=require(_0x43bc('0x5'));var logger=require(_0x43bc('0x6'))(_0x43bc('0x7'));var config=require(_0x43bc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x43bc('0x9')][_0x43bc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3037ba,_0x2cb9a8,_0x22a9fc){return new BPromise(function(_0x3926a4,_0x18cdef){return client[_0x43bc('0xb')](_0x3037ba,_0x22a9fc)[_0x43bc('0xc')](function(_0x1088d9){logger[_0x43bc('0xd')](_0x43bc('0xe'),_0x2cb9a8,'request\x20sent');logger['debug'](_0x43bc('0xf'),_0x2cb9a8,_0x43bc('0x10'),JSON[_0x43bc('0x11')](_0x1088d9));if(_0x1088d9['error']){if(_0x1088d9['error'][_0x43bc('0x12')]===0x1f4){logger[_0x43bc('0x13')](_0x43bc('0xe'),_0x2cb9a8,_0x1088d9[_0x43bc('0x13')][_0x43bc('0x14')]);return _0x18cdef(_0x1088d9[_0x43bc('0x13')][_0x43bc('0x14')]);}logger[_0x43bc('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2cb9a8,_0x1088d9['error'][_0x43bc('0x14')]);return _0x3926a4(_0x1088d9[_0x43bc('0x13')][_0x43bc('0x14')]);}else{logger[_0x43bc('0xd')](_0x43bc('0xe'),_0x2cb9a8,_0x43bc('0x10'));_0x3926a4(_0x1088d9['result'][_0x43bc('0x14')]);}})[_0x43bc('0x15')](function(_0x17e0e0){logger[_0x43bc('0x13')](_0x43bc('0xe'),_0x2cb9a8,_0x17e0e0);_0x18cdef(_0x17e0e0);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 7b18461..0c496cb 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 _0x52fc=['delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','create','put','update'];(function(_0xa060e7,_0x15768f){var _0x15b6c5=function(_0x4420f4){while(--_0x4420f4){_0xa060e7['push'](_0xa060e7['shift']());}};_0x15b6c5(++_0x15768f);}(_0x52fc,0x153));var _0xc52f=function(_0x274ed1,_0x5b0590){_0x274ed1=_0x274ed1-0x0;var _0x48433b=_0x52fc[_0x274ed1];return _0x48433b;};'use strict';var multer=require('multer');var util=require(_0xc52f('0x0'));var path=require(_0xc52f('0x1'));var timeout=require(_0xc52f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc52f('0x3'));var auth=require(_0xc52f('0x4'));var interaction=require(_0xc52f('0x5'));var config=require(_0xc52f('0x6'));var controller=require(_0xc52f('0x7'));router[_0xc52f('0x8')]('/',auth[_0xc52f('0x9')](),controller[_0xc52f('0xa')]);router[_0xc52f('0x8')](_0xc52f('0xb'),auth['isAuthenticated'](),controller[_0xc52f('0xc')]);router[_0xc52f('0x8')](_0xc52f('0xd'),auth[_0xc52f('0x9')](),controller[_0xc52f('0xe')]);router['post']('/',auth[_0xc52f('0x9')](),controller[_0xc52f('0xf')]);router[_0xc52f('0x10')](_0xc52f('0xb'),auth[_0xc52f('0x9')](),controller[_0xc52f('0x11')]);router[_0xc52f('0x12')](_0xc52f('0xb'),auth[_0xc52f('0x9')](),controller[_0xc52f('0x13')]);module[_0xc52f('0x14')]=router; \ No newline at end of file +var _0xd12f=['../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','put','delete','destroy','multer','util','express','fs-extra'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xd12f,0x13f));var _0xfd12=function(_0x20261c,_0x215fa9){_0x20261c=_0x20261c-0x0;var _0x44b50=_0xd12f[_0x20261c];return _0x44b50;};'use strict';var multer=require(_0xfd12('0x0'));var util=require(_0xfd12('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfd12('0x2'));var router=express['Router']();var fs_extra=require(_0xfd12('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xfd12('0x4'));var config=require(_0xfd12('0x5'));var controller=require(_0xfd12('0x6'));router[_0xfd12('0x7')]('/',auth[_0xfd12('0x8')](),controller[_0xfd12('0x9')]);router[_0xfd12('0x7')](_0xfd12('0xa'),auth['isAuthenticated'](),controller[_0xfd12('0xb')]);router[_0xfd12('0x7')](_0xfd12('0xc'),auth[_0xfd12('0x8')](),controller[_0xfd12('0xd')]);router['post']('/',auth[_0xfd12('0x8')](),controller['create']);router[_0xfd12('0xe')](_0xfd12('0xa'),auth[_0xfd12('0x8')](),controller['update']);router[_0xfd12('0xf')](_0xfd12('0xa'),auth[_0xfd12('0x8')](),controller[_0xfd12('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 5195fd8..e7d7fa1 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 _0xeffc=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x3ad940,_0x15749a){var _0x1f3e62=function(_0x3cfe2b){while(--_0x3cfe2b){_0x3ad940['push'](_0x3ad940['shift']());}};_0x1f3e62(++_0x15749a);}(_0xeffc,0xf6));var _0xceff=function(_0x2dad18,_0x4af20d){_0x2dad18=_0x2dad18-0x0;var _0x1a78eb=_0xeffc[_0x2dad18];return _0x1a78eb;};'use strict';var Sequelize=require(_0xceff('0x0'));module[_0xceff('0x1')]={'field':{'type':Sequelize[_0xceff('0x2')]},'alias':{'type':Sequelize[_0xceff('0x3')]},'function':{'type':Sequelize[_0xceff('0x3')]},'format':{'type':Sequelize[_0xceff('0x3')]},'groupBy':{'type':Sequelize[_0xceff('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xceff('0x3')]},'custom':{'type':Sequelize[_0xceff('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x4cf5=['TEXT','STRING','BOOLEAN','sequelize'];(function(_0x3a7a9c,_0x24f7d6){var _0x59156e=function(_0x5bc930){while(--_0x5bc930){_0x3a7a9c['push'](_0x3a7a9c['shift']());}};_0x59156e(++_0x24f7d6);}(_0x4cf5,0x17f));var _0x54cf=function(_0x44f1d6,_0x1f9336){_0x44f1d6=_0x44f1d6-0x0;var _0x49a030=_0x4cf5[_0x44f1d6];return _0x49a030;};'use strict';var Sequelize=require(_0x54cf('0x0'));module['exports']={'field':{'type':Sequelize[_0x54cf('0x1')]},'alias':{'type':Sequelize[_0x54cf('0x2')]},'function':{'type':Sequelize[_0x54cf('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x54cf('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x54cf('0x2')]},'custom':{'type':Sequelize[_0x54cf('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 29d0325..9b33b84 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 _0x3f1f=['util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','error','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','merge','options','find','create','body','bulkCreate','params','ids','addFields','findOne','sequelize','destroy','CustomReportId','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x2bf680,_0x3baa21){var _0x4f4391=function(_0x471934){while(--_0x471934){_0x2bf680['push'](_0x2bf680['shift']());}};_0x4f4391(++_0x3baa21);}(_0x3f1f,0x1e6));var _0xf3f1=function(_0xd5dac7,_0x26b807){_0xd5dac7=_0xd5dac7-0x0;var _0x47b7e8=_0x3f1f[_0xd5dac7];return _0x47b7e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf3f1('0x0'));var zipdir=require(_0xf3f1('0x1'));var jsonpatch=require(_0xf3f1('0x2'));var rp=require(_0xf3f1('0x3'));var moment=require(_0xf3f1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf3f1('0x5'));var util=require(_0xf3f1('0x6'));var path=require(_0xf3f1('0x7'));var sox=require(_0xf3f1('0x8'));var csv=require(_0xf3f1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf3f1('0xa'));var _=require('lodash');var squel=require(_0xf3f1('0xb'));var crypto=require(_0xf3f1('0xc'));var jsforce=require(_0xf3f1('0xd'));var deskjs=require(_0xf3f1('0xe'));var toCsv=require(_0xf3f1('0x9'));var querystring=require(_0xf3f1('0xf'));var Papa=require('papaparse');var Redis=require(_0xf3f1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf3f1('0x11'));var as=require(_0xf3f1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf3f1('0x13'))('api');var utils=require(_0xf3f1('0x14'));var config=require(_0xf3f1('0x15'));var licenseUtil=require(_0xf3f1('0x16'));var db=require(_0xf3f1('0x17'))['db'];function respondWithStatusCode(_0x4d8217,_0x54ce57){_0x54ce57=_0x54ce57||0xcc;return function(_0x2e3dc1){if(_0x2e3dc1){return _0x4d8217[_0xf3f1('0x18')](_0x54ce57);}return _0x4d8217[_0xf3f1('0x19')](_0x54ce57)[_0xf3f1('0x1a')]();};}function respondWithResult(_0x1ee17e,_0x3a649e){_0x3a649e=_0x3a649e||0xc8;return function(_0x42adc2){if(_0x42adc2){return _0x1ee17e['status'](_0x3a649e)['json'](_0x42adc2);}};}function respondWithFilteredResult(_0x4ec9d3,_0x5cd68f){return function(_0x176090){if(_0x176090){var _0x16f708=typeof _0x5cd68f[_0xf3f1('0x1b')]==='undefined'&&typeof _0x5cd68f[_0xf3f1('0x1c')]===_0xf3f1('0x1d');var _0x1ed1f3=_0x176090['count'];var _0x53180a=_0x16f708?0x0:_0x5cd68f[_0xf3f1('0x1b')];var _0x83d2d0=_0x16f708?_0x176090[_0xf3f1('0x1e')]:_0x5cd68f['offset']+_0x5cd68f[_0xf3f1('0x1c')];var _0x197477;if(_0x83d2d0>=_0x1ed1f3){_0x83d2d0=_0x1ed1f3;_0x197477=0xc8;}else{_0x197477=0xce;}_0x4ec9d3[_0xf3f1('0x19')](_0x197477);return _0x4ec9d3[_0xf3f1('0x1f')](_0xf3f1('0x20'),_0x53180a+'-'+_0x83d2d0+'/'+_0x1ed1f3)[_0xf3f1('0x21')](_0x176090);}return null;};}function patchUpdates(_0x553002){return function(_0x594164){try{jsonpatch[_0xf3f1('0x22')](_0x594164,_0x553002,!![]);}catch(_0x3998b0){return BPromise['reject'](_0x3998b0);}return _0x594164[_0xf3f1('0x23')]();};}function saveUpdates(_0x2809f4,_0x5ad1d6){return function(_0x5a0a9b){if(_0x5a0a9b){return _0x5a0a9b[_0xf3f1('0x24')](_0x2809f4)[_0xf3f1('0x25')](function(_0xaee686){return _0xaee686;});}return null;};}function removeEntity(_0x44d647,_0x23a216){return function(_0x46ab1b){if(_0x46ab1b){return _0x46ab1b['destroy']()[_0xf3f1('0x25')](function(){_0x44d647[_0xf3f1('0x19')](0xcc)[_0xf3f1('0x1a')]();});}};}function handleEntityNotFound(_0x2f23f2,_0xb3dd5d){return function(_0x3c5c8b){if(!_0x3c5c8b){_0x2f23f2[_0xf3f1('0x18')](0x194);}return _0x3c5c8b;};}function handleError(_0xc6ae69,_0x219bf1){_0x219bf1=_0x219bf1||0x1f4;return function(_0x489e2c){logger[_0xf3f1('0x26')](_0x489e2c['stack']);if(_0x489e2c[_0xf3f1('0x27')]){delete _0x489e2c[_0xf3f1('0x27')];}_0xc6ae69['status'](_0x219bf1)[_0xf3f1('0x28')](_0x489e2c);};}exports[_0xf3f1('0x29')]=function(_0x1c6ad0,_0x410305){var _0x1988c3={},_0x6a5b7e={},_0x5f0262={'count':0x0,'rows':[]};var _0x92f75b=_[_0xf3f1('0x2a')](db[_0xf3f1('0x2b')][_0xf3f1('0x2c')],function(_0x583672){return{'name':_0x583672[_0xf3f1('0x2d')],'type':_0x583672[_0xf3f1('0x2e')]['key']};});_0x6a5b7e[_0xf3f1('0x2f')]=_[_0xf3f1('0x2a')](_0x92f75b,_0xf3f1('0x27'));_0x6a5b7e['query']=_[_0xf3f1('0x30')](_0x1c6ad0['query']);_0x6a5b7e[_0xf3f1('0x31')]=_['intersection'](_0x6a5b7e[_0xf3f1('0x2f')],_0x6a5b7e[_0xf3f1('0x32')]);_0x1988c3[_0xf3f1('0x33')]=_[_0xf3f1('0x34')](_0x6a5b7e[_0xf3f1('0x2f')],qs['fields'](_0x1c6ad0['query'][_0xf3f1('0x35')]));_0x1988c3[_0xf3f1('0x33')]=_0x1988c3['attributes'][_0xf3f1('0x36')]?_0x1988c3[_0xf3f1('0x33')]:_0x6a5b7e[_0xf3f1('0x2f')];if(!_0x1c6ad0[_0xf3f1('0x32')][_0xf3f1('0x37')](_0xf3f1('0x38'))){_0x1988c3['limit']=qs[_0xf3f1('0x1c')](_0x1c6ad0[_0xf3f1('0x32')][_0xf3f1('0x1c')]);_0x1988c3['offset']=qs[_0xf3f1('0x1b')](_0x1c6ad0[_0xf3f1('0x32')][_0xf3f1('0x1b')]);}_0x1988c3[_0xf3f1('0x39')]=qs['sort'](_0x1c6ad0['query'][_0xf3f1('0x3a')]);_0x1988c3['where']=qs[_0xf3f1('0x31')](_[_0xf3f1('0x3b')](_0x1c6ad0[_0xf3f1('0x32')],_0x6a5b7e[_0xf3f1('0x31')]),_0x92f75b);if(_0x1c6ad0['query']['filter']){_0x1988c3[_0xf3f1('0x3c')]=_['merge'](_0x1988c3[_0xf3f1('0x3c')],{'$or':_[_0xf3f1('0x2a')](_0x92f75b,function(_0x29af81){if(_0x29af81[_0xf3f1('0x2e')]!==_0xf3f1('0x3d')){var _0x5b38ec={};_0x5b38ec[_0x29af81[_0xf3f1('0x27')]]={'$like':'%'+_0x1c6ad0[_0xf3f1('0x32')][_0xf3f1('0x3e')]+'%'};return _0x5b38ec;}})});}_0x1988c3=_['merge']({},_0x1988c3,_0x1c6ad0['options']);var _0x40ed92={'where':_0x1988c3[_0xf3f1('0x3c')]};return db[_0xf3f1('0x2b')][_0xf3f1('0x1e')](_0x40ed92)[_0xf3f1('0x25')](function(_0x1cdf88){_0x5f0262[_0xf3f1('0x1e')]=_0x1cdf88;if(_0x1c6ad0['query'][_0xf3f1('0x3f')]){_0x1988c3[_0xf3f1('0x40')]=[{'all':!![]}];}return db[_0xf3f1('0x2b')][_0xf3f1('0x41')](_0x1988c3);})['then'](function(_0x24cc5d){_0x5f0262[_0xf3f1('0x42')]=_0x24cc5d;return _0x5f0262;})['then'](respondWithFilteredResult(_0x410305,_0x1988c3))[_0xf3f1('0x43')](handleError(_0x410305,null));};exports[_0xf3f1('0x44')]=function(_0x324126,_0x377af3){var _0x324dbc={'raw':![],'where':{'id':_0x324126['params']['id']}},_0x30dbb7={};_0x30dbb7[_0xf3f1('0x2f')]=_[_0xf3f1('0x30')](db[_0xf3f1('0x2b')]['rawAttributes']);_0x30dbb7[_0xf3f1('0x32')]=_[_0xf3f1('0x30')](_0x324126[_0xf3f1('0x32')]);_0x30dbb7[_0xf3f1('0x31')]=_[_0xf3f1('0x34')](_0x30dbb7[_0xf3f1('0x2f')],_0x30dbb7[_0xf3f1('0x32')]);_0x324dbc[_0xf3f1('0x33')]=_[_0xf3f1('0x34')](_0x30dbb7[_0xf3f1('0x2f')],qs[_0xf3f1('0x35')](_0x324126[_0xf3f1('0x32')][_0xf3f1('0x35')]));_0x324dbc[_0xf3f1('0x33')]=_0x324dbc[_0xf3f1('0x33')][_0xf3f1('0x36')]?_0x324dbc[_0xf3f1('0x33')]:_0x30dbb7[_0xf3f1('0x2f')];if(_0x324126[_0xf3f1('0x32')][_0xf3f1('0x3f')]){_0x324dbc['include']=[{'all':!![]}];}_0x324dbc=_[_0xf3f1('0x45')]({},_0x324dbc,_0x324126[_0xf3f1('0x46')]);return db[_0xf3f1('0x2b')][_0xf3f1('0x47')](_0x324dbc)[_0xf3f1('0x25')](handleEntityNotFound(_0x377af3,null))['then'](respondWithResult(_0x377af3,null))[_0xf3f1('0x43')](handleError(_0x377af3,null));};exports[_0xf3f1('0x48')]=function(_0x33f7fb,_0x21df9b){return db[_0xf3f1('0x2b')][_0xf3f1('0x48')](_0x33f7fb[_0xf3f1('0x49')],{})[_0xf3f1('0x25')](respondWithResult(_0x21df9b,0xc9))['catch'](handleError(_0x21df9b,null));};exports[_0xf3f1('0x4a')]=function(_0x30b785,_0x10fddc){return db[_0xf3f1('0x2b')][_0xf3f1('0x4a')](_0x30b785[_0xf3f1('0x49')],{'raw':![],'individualHooks':!![]})[_0xf3f1('0x25')](respondWithResult(_0x10fddc,0xc9))[_0xf3f1('0x43')](handleError(_0x10fddc,null));};exports[_0xf3f1('0x24')]=function(_0x177ec5,_0x22c40b){if(_0x177ec5[_0xf3f1('0x49')]['id']){delete _0x177ec5[_0xf3f1('0x49')]['id'];}return db[_0xf3f1('0x2b')][_0xf3f1('0x47')]({'where':{'id':_0x177ec5['params']['id']}})[_0xf3f1('0x25')](handleEntityNotFound(_0x22c40b,null))[_0xf3f1('0x25')](saveUpdates(_0x177ec5[_0xf3f1('0x49')],null))['then'](respondWithResult(_0x22c40b,null))[_0xf3f1('0x43')](handleError(_0x22c40b,null));};exports['destroy']=function(_0x181644,_0x210eeb){return db[_0xf3f1('0x2b')][_0xf3f1('0x47')]({'where':{'id':_0x181644[_0xf3f1('0x4b')]['id']}})[_0xf3f1('0x25')](handleEntityNotFound(_0x210eeb,null))[_0xf3f1('0x25')](removeEntity(_0x210eeb,null))['catch'](handleError(_0x210eeb,null));};exports['bulkDestroy']=function(_0x52f57d,_0x45f390){return db[_0xf3f1('0x2b')]['destroy']({'where':{'id':_0x52f57d[_0xf3f1('0x32')][_0xf3f1('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0xf3f1('0x25')](respondWithResult(_0x45f390,0xcc))[_0xf3f1('0x43')](handleError(_0x45f390,null));};exports[_0xf3f1('0x4d')]=function(_0x154e52,_0x250db0,_0x29384c){return db['AnalyticCustomReport'][_0xf3f1('0x4e')]({'where':{'id':_0x154e52[_0xf3f1('0x4b')]['id']}})[_0xf3f1('0x25')](handleEntityNotFound(_0x250db0,null))['then'](function(_0x8eae8a){if(_0x8eae8a){return db[_0xf3f1('0x4f')]['transaction'](function(_0x39102e){return db[_0xf3f1('0x2b')][_0xf3f1('0x50')]({'where':{'CustomReportId':_0x154e52[_0xf3f1('0x4b')]['id']},'transaction':_0x39102e})[_0xf3f1('0x25')](function(_0x210757){var _0x4f9c17=_[_0xf3f1('0x2a')](_0x154e52[_0xf3f1('0x49')],function(_0x5077f9){delete _0x5077f9['id'];_0x5077f9[_0xf3f1('0x51')]=_0x154e52[_0xf3f1('0x4b')]['id'];return _0x5077f9;});return db[_0xf3f1('0x2b')][_0xf3f1('0x4a')](_0x4f9c17,{'transaction':_0x39102e});});})[_0xf3f1('0x25')](function(){return db['AnalyticFieldReport'][_0xf3f1('0x41')]({'where':{'CustomReportId':_0x154e52[_0xf3f1('0x4b')]['id']}});});}})[_0xf3f1('0x25')](respondWithResult(_0x250db0,null))['catch'](handleError(_0x250db0,null));}; \ No newline at end of file +var _0x5937=['pick','filter','where','merge','type','VIRTUAL','AnalyticFieldReport','include','findAll','rows','show','params','keys','filters','intersection','fields','includeAll','options','find','catch','create','bulkCreate','body','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','attributes','length','hasOwnProperty','nolimit','sort'];(function(_0x31417e,_0x424f9a){var _0x3a7cee=function(_0x6024fd){while(--_0x6024fd){_0x31417e['push'](_0x31417e['shift']());}};_0x3a7cee(++_0x424f9a);}(_0x5937,0x1c3));var _0x7593=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5937[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x7593('0x0'));var rimraf=require(_0x7593('0x1'));var zipdir=require(_0x7593('0x2'));var jsonpatch=require(_0x7593('0x3'));var rp=require('request-promise');var moment=require(_0x7593('0x4'));var BPromise=require(_0x7593('0x5'));var Mustache=require('mustache');var util=require(_0x7593('0x6'));var path=require('path');var sox=require(_0x7593('0x7'));var csv=require(_0x7593('0x8'));var ejs=require(_0x7593('0x9'));var fs=require('fs');var fs_extra=require(_0x7593('0xa'));var _=require('lodash');var squel=require(_0x7593('0xb'));var crypto=require(_0x7593('0xc'));var jsforce=require(_0x7593('0xd'));var deskjs=require(_0x7593('0xe'));var toCsv=require(_0x7593('0x8'));var querystring=require(_0x7593('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7593('0x10'));var qs=require(_0x7593('0x11'));var as=require(_0x7593('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7593('0x13'))(_0x7593('0x14'));var utils=require('../../config/utils');var config=require(_0x7593('0x15'));var licenseUtil=require(_0x7593('0x16'));var db=require(_0x7593('0x17'))['db'];function respondWithStatusCode(_0x9bf4b7,_0x187f40){_0x187f40=_0x187f40||0xcc;return function(_0x18a1f0){if(_0x18a1f0){return _0x9bf4b7[_0x7593('0x18')](_0x187f40);}return _0x9bf4b7['status'](_0x187f40)['end']();};}function respondWithResult(_0x483def,_0x27e0aa){_0x27e0aa=_0x27e0aa||0xc8;return function(_0x4e2a2e){if(_0x4e2a2e){return _0x483def[_0x7593('0x19')](_0x27e0aa)[_0x7593('0x1a')](_0x4e2a2e);}};}function respondWithFilteredResult(_0x3ede67,_0x12718b){return function(_0x36746b){if(_0x36746b){var _0x5a1ede=typeof _0x12718b[_0x7593('0x1b')]===_0x7593('0x1c')&&typeof _0x12718b['limit']==='undefined';var _0x556d06=_0x36746b[_0x7593('0x1d')];var _0x549969=_0x5a1ede?0x0:_0x12718b[_0x7593('0x1b')];var _0x554b75=_0x5a1ede?_0x36746b['count']:_0x12718b[_0x7593('0x1b')]+_0x12718b[_0x7593('0x1e')];var _0x2ec661;if(_0x554b75>=_0x556d06){_0x554b75=_0x556d06;_0x2ec661=0xc8;}else{_0x2ec661=0xce;}_0x3ede67['status'](_0x2ec661);return _0x3ede67['set'](_0x7593('0x1f'),_0x549969+'-'+_0x554b75+'/'+_0x556d06)[_0x7593('0x1a')](_0x36746b);}return null;};}function patchUpdates(_0x26369f){return function(_0x62e291){try{jsonpatch[_0x7593('0x20')](_0x62e291,_0x26369f,!![]);}catch(_0x5c2dac){return BPromise[_0x7593('0x21')](_0x5c2dac);}return _0x62e291['save']();};}function saveUpdates(_0x9fc481,_0x5206a3){return function(_0x25d6c1){if(_0x25d6c1){return _0x25d6c1[_0x7593('0x22')](_0x9fc481)[_0x7593('0x23')](function(_0x41cee8){return _0x41cee8;});}return null;};}function removeEntity(_0x266055,_0x12ae02){return function(_0x3e911f){if(_0x3e911f){return _0x3e911f[_0x7593('0x24')]()['then'](function(){_0x266055[_0x7593('0x19')](0xcc)[_0x7593('0x25')]();});}};}function handleEntityNotFound(_0x19106a,_0x57066a){return function(_0x3ee81d){if(!_0x3ee81d){_0x19106a['sendStatus'](0x194);}return _0x3ee81d;};}function handleError(_0x26c88d,_0x53efc1){_0x53efc1=_0x53efc1||0x1f4;return function(_0x5576fa){logger[_0x7593('0x26')](_0x5576fa[_0x7593('0x27')]);if(_0x5576fa['name']){delete _0x5576fa[_0x7593('0x28')];}_0x26c88d[_0x7593('0x19')](_0x53efc1)[_0x7593('0x29')](_0x5576fa);};}exports[_0x7593('0x2a')]=function(_0x390d11,_0x47acee){var _0x11696a={},_0x5abe56={},_0x15e682={'count':0x0,'rows':[]};var _0xa69d73=_[_0x7593('0x2b')](db['AnalyticFieldReport'][_0x7593('0x2c')],function(_0x307845){return{'name':_0x307845[_0x7593('0x2d')],'type':_0x307845['type']['key']};});_0x5abe56[_0x7593('0x2e')]=_[_0x7593('0x2b')](_0xa69d73,'name');_0x5abe56[_0x7593('0x2f')]=_['keys'](_0x390d11[_0x7593('0x2f')]);_0x5abe56['filters']=_['intersection'](_0x5abe56[_0x7593('0x2e')],_0x5abe56[_0x7593('0x2f')]);_0x11696a['attributes']=_['intersection'](_0x5abe56[_0x7593('0x2e')],qs['fields'](_0x390d11[_0x7593('0x2f')]['fields']));_0x11696a[_0x7593('0x30')]=_0x11696a['attributes'][_0x7593('0x31')]?_0x11696a['attributes']:_0x5abe56[_0x7593('0x2e')];if(!_0x390d11[_0x7593('0x2f')][_0x7593('0x32')](_0x7593('0x33'))){_0x11696a[_0x7593('0x1e')]=qs['limit'](_0x390d11['query']['limit']);_0x11696a[_0x7593('0x1b')]=qs['offset'](_0x390d11[_0x7593('0x2f')]['offset']);}_0x11696a['order']=qs[_0x7593('0x34')](_0x390d11[_0x7593('0x2f')][_0x7593('0x34')]);_0x11696a['where']=qs['filters'](_[_0x7593('0x35')](_0x390d11['query'],_0x5abe56['filters']),_0xa69d73);if(_0x390d11[_0x7593('0x2f')][_0x7593('0x36')]){_0x11696a[_0x7593('0x37')]=_[_0x7593('0x38')](_0x11696a[_0x7593('0x37')],{'$or':_[_0x7593('0x2b')](_0xa69d73,function(_0x5909ba){if(_0x5909ba[_0x7593('0x39')]!==_0x7593('0x3a')){var _0x21f027={};_0x21f027[_0x5909ba[_0x7593('0x28')]]={'$like':'%'+_0x390d11[_0x7593('0x2f')]['filter']+'%'};return _0x21f027;}})});}_0x11696a=_['merge']({},_0x11696a,_0x390d11['options']);var _0x33b1c7={'where':_0x11696a[_0x7593('0x37')]};return db[_0x7593('0x3b')][_0x7593('0x1d')](_0x33b1c7)[_0x7593('0x23')](function(_0x37826c){_0x15e682[_0x7593('0x1d')]=_0x37826c;if(_0x390d11[_0x7593('0x2f')]['includeAll']){_0x11696a[_0x7593('0x3c')]=[{'all':!![]}];}return db[_0x7593('0x3b')][_0x7593('0x3d')](_0x11696a);})[_0x7593('0x23')](function(_0x2509bf){_0x15e682[_0x7593('0x3e')]=_0x2509bf;return _0x15e682;})['then'](respondWithFilteredResult(_0x47acee,_0x11696a))['catch'](handleError(_0x47acee,null));};exports[_0x7593('0x3f')]=function(_0x27aac6,_0x198626){var _0x32c862={'raw':![],'where':{'id':_0x27aac6[_0x7593('0x40')]['id']}},_0xfbbdf1={};_0xfbbdf1[_0x7593('0x2e')]=_[_0x7593('0x41')](db[_0x7593('0x3b')][_0x7593('0x2c')]);_0xfbbdf1[_0x7593('0x2f')]=_['keys'](_0x27aac6[_0x7593('0x2f')]);_0xfbbdf1[_0x7593('0x42')]=_[_0x7593('0x43')](_0xfbbdf1[_0x7593('0x2e')],_0xfbbdf1[_0x7593('0x2f')]);_0x32c862['attributes']=_[_0x7593('0x43')](_0xfbbdf1['model'],qs[_0x7593('0x44')](_0x27aac6[_0x7593('0x2f')][_0x7593('0x44')]));_0x32c862[_0x7593('0x30')]=_0x32c862[_0x7593('0x30')][_0x7593('0x31')]?_0x32c862[_0x7593('0x30')]:_0xfbbdf1[_0x7593('0x2e')];if(_0x27aac6[_0x7593('0x2f')][_0x7593('0x45')]){_0x32c862['include']=[{'all':!![]}];}_0x32c862=_[_0x7593('0x38')]({},_0x32c862,_0x27aac6[_0x7593('0x46')]);return db[_0x7593('0x3b')][_0x7593('0x47')](_0x32c862)[_0x7593('0x23')](handleEntityNotFound(_0x198626,null))[_0x7593('0x23')](respondWithResult(_0x198626,null))[_0x7593('0x48')](handleError(_0x198626,null));};exports[_0x7593('0x49')]=function(_0x122a46,_0x4094c0){return db[_0x7593('0x3b')][_0x7593('0x49')](_0x122a46['body'],{})['then'](respondWithResult(_0x4094c0,0xc9))[_0x7593('0x48')](handleError(_0x4094c0,null));};exports[_0x7593('0x4a')]=function(_0x3ffed5,_0x5f0186){return db[_0x7593('0x3b')][_0x7593('0x4a')](_0x3ffed5['body'],{'raw':![],'individualHooks':!![]})[_0x7593('0x23')](respondWithResult(_0x5f0186,0xc9))[_0x7593('0x48')](handleError(_0x5f0186,null));};exports[_0x7593('0x22')]=function(_0x17e271,_0x13b8b0){if(_0x17e271['body']['id']){delete _0x17e271[_0x7593('0x4b')]['id'];}return db[_0x7593('0x3b')]['find']({'where':{'id':_0x17e271[_0x7593('0x40')]['id']}})[_0x7593('0x23')](handleEntityNotFound(_0x13b8b0,null))[_0x7593('0x23')](saveUpdates(_0x17e271[_0x7593('0x4b')],null))[_0x7593('0x23')](respondWithResult(_0x13b8b0,null))[_0x7593('0x48')](handleError(_0x13b8b0,null));};exports['destroy']=function(_0x39395a,_0x2741b7){return db['AnalyticFieldReport'][_0x7593('0x47')]({'where':{'id':_0x39395a[_0x7593('0x40')]['id']}})[_0x7593('0x23')](handleEntityNotFound(_0x2741b7,null))[_0x7593('0x23')](removeEntity(_0x2741b7,null))[_0x7593('0x48')](handleError(_0x2741b7,null));};exports[_0x7593('0x4c')]=function(_0x1663ee,_0x27a2a6){return db[_0x7593('0x3b')][_0x7593('0x24')]({'where':{'id':_0x1663ee[_0x7593('0x2f')][_0x7593('0x4d')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x27a2a6,0xcc))[_0x7593('0x48')](handleError(_0x27a2a6,null));};exports[_0x7593('0x4e')]=function(_0x4f5f56,_0x57bd3f,_0x5a653b){return db[_0x7593('0x4f')][_0x7593('0x50')]({'where':{'id':_0x4f5f56[_0x7593('0x40')]['id']}})[_0x7593('0x23')](handleEntityNotFound(_0x57bd3f,null))['then'](function(_0x440c67){if(_0x440c67){return db[_0x7593('0x51')][_0x7593('0x52')](function(_0x2b050c){return db[_0x7593('0x3b')]['destroy']({'where':{'CustomReportId':_0x4f5f56[_0x7593('0x40')]['id']},'transaction':_0x2b050c})[_0x7593('0x23')](function(_0x13d5d8){var _0x5b25c7=_['map'](_0x4f5f56[_0x7593('0x4b')],function(_0xdeb4ca){delete _0xdeb4ca['id'];_0xdeb4ca[_0x7593('0x53')]=_0x4f5f56[_0x7593('0x40')]['id'];return _0xdeb4ca;});return db[_0x7593('0x3b')]['bulkCreate'](_0x5b25c7,{'transaction':_0x2b050c});});})[_0x7593('0x23')](function(){return db[_0x7593('0x3b')]['findAll']({'where':{'CustomReportId':_0x4f5f56[_0x7593('0x40')]['id']}});});}})[_0x7593('0x23')](respondWithResult(_0x57bd3f,null))[_0x7593('0x48')](handleError(_0x57bd3f,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index cc43942..b928b2b 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 _0x1d71=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','AnalyticFieldReport'];(function(_0x444563,_0x311d82){var _0x3f5867=function(_0x5b9a65){while(--_0x5b9a65){_0x444563['push'](_0x444563['shift']());}};_0x3f5867(++_0x311d82);}(_0x1d71,0xc6));var _0x11d7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d71[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x11d7('0x0'));var logger=require(_0x11d7('0x1'))(_0x11d7('0x2'));var moment=require(_0x11d7('0x3'));var BPromise=require(_0x11d7('0x4'));var rp=require(_0x11d7('0x5'));var fs=require('fs');var path=require(_0x11d7('0x6'));var rimraf=require(_0x11d7('0x7'));var config=require(_0x11d7('0x8'));var attributes=require(_0x11d7('0x9'));module['exports']=function(_0x3a1c11,_0x379c9b){return _0x3a1c11['define'](_0x11d7('0xa'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcec5=['define','AnalyticFieldReport','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports'];(function(_0x338b5c,_0x1a4fec){var _0x2f9a67=function(_0x15015e){while(--_0x15015e){_0x338b5c['push'](_0x338b5c['shift']());}};_0x2f9a67(++_0x1a4fec);}(_0xcec5,0x11a));var _0x5cec=function(_0x3d244b,_0x34a8ce){_0x3d244b=_0x3d244b-0x0;var _0x1c7af2=_0xcec5[_0x3d244b];return _0x1c7af2;};'use strict';var _=require('lodash');var util=require(_0x5cec('0x0'));var logger=require(_0x5cec('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5cec('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5cec('0x3'));var rimraf=require(_0x5cec('0x4'));var config=require(_0x5cec('0x5'));var attributes=require(_0x5cec('0x6'));module[_0x5cec('0x7')]=function(_0x16d881,_0x2bc1a8){return _0x16d881[_0x5cec('0x8')](_0x5cec('0x9'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 371df02..4549ecf 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 _0x6ddd=['info','debug','request\x20sent','stringify','code','error','AnalyticFieldReport,\x20%s,\x20%s','message','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x51a97a,_0xdcd82a){var _0x497189=function(_0x380472){while(--_0x380472){_0x51a97a['push'](_0x51a97a['shift']());}};_0x497189(++_0xdcd82a);}(_0x6ddd,0x1ec));var _0xd6dd=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x6ddd[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd6dd('0x0'));var BPromise=require(_0xd6dd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd6dd('0x2'));var db=require(_0xd6dd('0x3'))['db'];var utils=require(_0xd6dd('0x4'));var logger=require(_0xd6dd('0x5'))(_0xd6dd('0x6'));var config=require(_0xd6dd('0x7'));var jayson=require(_0xd6dd('0x8'));var client=jayson[_0xd6dd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x498a6c,_0xd09a0f,_0x485fc1){return new BPromise(function(_0x28bf4b,_0xdd7ea2){return client[_0xd6dd('0xa')](_0x498a6c,_0x485fc1)[_0xd6dd('0xb')](function(_0x3cbf83){logger[_0xd6dd('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0xd09a0f,'request\x20sent');logger[_0xd6dd('0xd')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0xd09a0f,_0xd6dd('0xe'),JSON[_0xd6dd('0xf')](_0x3cbf83));if(_0x3cbf83['error']){if(_0x3cbf83['error'][_0xd6dd('0x10')]===0x1f4){logger[_0xd6dd('0x11')](_0xd6dd('0x12'),_0xd09a0f,_0x3cbf83['error'][_0xd6dd('0x13')]);return _0xdd7ea2(_0x3cbf83[_0xd6dd('0x11')]['message']);}logger[_0xd6dd('0x11')](_0xd6dd('0x12'),_0xd09a0f,_0x3cbf83[_0xd6dd('0x11')]['message']);return _0x28bf4b(_0x3cbf83['error']['message']);}else{logger[_0xd6dd('0xc')](_0xd6dd('0x12'),_0xd09a0f,_0xd6dd('0xe'));_0x28bf4b(_0x3cbf83['result'][_0xd6dd('0x13')]);}})[_0xd6dd('0x14')](function(_0x5220c1){logger['error'](_0xd6dd('0x12'),_0xd09a0f,_0x5220c1);_0xdd7ea2(_0x5220c1);});});} \ No newline at end of file +var _0x69ea=['debug','stringify','error','code','message','result','catch','util','moment','../../config/environment','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent'];(function(_0xb66f92,_0x301f99){var _0x344d2d=function(_0x34378c){while(--_0x34378c){_0xb66f92['push'](_0xb66f92['shift']());}};_0x344d2d(++_0x301f99);}(_0x69ea,0x142));var _0xa69e=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x69ea[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0xa69e('0x0'));var moment=require(_0xa69e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa69e('0x2'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x400c4b,_0x42b759,_0x8c4e38){return new BPromise(function(_0x5be6f4,_0x4d4d33){return client[_0xa69e('0x3')](_0x400c4b,_0x8c4e38)[_0xa69e('0x4')](function(_0x5b9440){logger[_0xa69e('0x5')](_0xa69e('0x6'),_0x42b759,_0xa69e('0x7'));logger[_0xa69e('0x8')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x42b759,_0xa69e('0x7'),JSON[_0xa69e('0x9')](_0x5b9440));if(_0x5b9440[_0xa69e('0xa')]){if(_0x5b9440[_0xa69e('0xa')][_0xa69e('0xb')]===0x1f4){logger[_0xa69e('0xa')](_0xa69e('0x6'),_0x42b759,_0x5b9440[_0xa69e('0xa')][_0xa69e('0xc')]);return _0x4d4d33(_0x5b9440['error'][_0xa69e('0xc')]);}logger[_0xa69e('0xa')](_0xa69e('0x6'),_0x42b759,_0x5b9440['error']['message']);return _0x5be6f4(_0x5b9440[_0xa69e('0xa')][_0xa69e('0xc')]);}else{logger[_0xa69e('0x5')](_0xa69e('0x6'),_0x42b759,'request\x20sent');_0x5be6f4(_0x5b9440[_0xa69e('0xd')][_0xa69e('0xc')]);}})[_0xa69e('0xe')](function(_0x5d20f3){logger[_0xa69e('0xa')](_0xa69e('0x6'),_0x42b759,_0x5d20f3);_0x4d4d33(_0x5d20f3);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 50b05d7..fea20cc 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(_0x5882a3,_0x2f1f36){var _0x1ea409=function(_0x56f2c3){while(--_0x56f2c3){_0x5882a3['push'](_0x5882a3['shift']());}};_0x1ea409(++_0x2f1f36);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x26eb68,_0x87ffb2){var _0x4074e5=function(_0xd901d3){while(--_0xd901d3){_0x26eb68['push'](_0x26eb68['shift']());}};_0x4074e5(++_0x87ffb2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 98a1a08..8ab037f 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 _0x5525=['exports','STRING','name','TEXT','sequelize'];(function(_0x11af33,_0x3d0c69){var _0x55e8d9=function(_0xedac13){while(--_0xedac13){_0x11af33['push'](_0x11af33['shift']());}};_0x55e8d9(++_0x3d0c69);}(_0x5525,0xd1));var _0x5552=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5525[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x5552('0x0'));module[_0x5552('0x1')]={'name':{'type':Sequelize[_0x5552('0x2')],'allowNull':![],'unique':_0x5552('0x3')},'table':{'type':Sequelize[_0x5552('0x2')]},'metric':{'type':Sequelize[_0x5552('0x4')]},'description':{'type':Sequelize[_0x5552('0x2')]}}; \ No newline at end of file +var _0xee4f=['TEXT','sequelize','name','STRING'];(function(_0x2c94af,_0x179897){var _0x9d1bf6=function(_0x11499c){while(--_0x11499c){_0x2c94af['push'](_0x2c94af['shift']());}};_0x9d1bf6(++_0x179897);}(_0xee4f,0xad));var _0xfee4=function(_0xea6b6a,_0x5de9e5){_0xea6b6a=_0xea6b6a-0x0;var _0x1eeab2=_0xee4f[_0xea6b6a];return _0x1eeab2;};'use strict';var Sequelize=require(_0xfee4('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xfee4('0x1')},'table':{'type':Sequelize[_0xfee4('0x2')]},'metric':{'type':Sequelize[_0xfee4('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 3f0a143..ebda695 100644 --- a/server/api/analyticMetric/analyticMetric.controller.js +++ b/server/api/analyticMetric/analyticMetric.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c5a=['update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','length','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save'];(function(_0x8dec24,_0x903de0){var _0x381de1=function(_0x1aceb4){while(--_0x1aceb4){_0x8dec24['push'](_0x8dec24['shift']());}};_0x381de1(++_0x903de0);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x4e37ef,_0x118b36){_0x4e37ef=_0x4e37ef-0x0;var _0x2cd882=_0x9c5a[_0x4e37ef];return _0x2cd882;};'use strict';var emlformat=require(_0xa9c5('0x0'));var rimraf=require(_0xa9c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9c5('0x2'));var rp=require(_0xa9c5('0x3'));var moment=require(_0xa9c5('0x4'));var BPromise=require(_0xa9c5('0x5'));var Mustache=require('mustache');var util=require(_0xa9c5('0x6'));var path=require(_0xa9c5('0x7'));var sox=require('sox');var csv=require(_0xa9c5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9c5('0x9'));var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];function respondWithStatusCode(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xcc;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0x17')](_0x42d5cf);}return _0x51c8d['status'](_0x42d5cf)[_0xa9c5('0x18')]();};}function respondWithResult(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0xc8;return function(_0x3806c4){if(_0x3806c4){return _0x1276d2[_0xa9c5('0x19')](_0x7df76d)[_0xa9c5('0x1a')](_0x3806c4);}};}function respondWithFilteredResult(_0x251099,_0x40b001){return function(_0x19a43e){if(_0x19a43e){var _0xcf13f2=typeof _0x40b001['offset']===_0xa9c5('0x1b')&&typeof _0x40b001[_0xa9c5('0x1c')]===_0xa9c5('0x1b');var _0x55cce5=_0x19a43e[_0xa9c5('0x1d')];var _0x1142d9=_0xcf13f2?0x0:_0x40b001[_0xa9c5('0x1e')];var _0x3b8cf7=_0xcf13f2?_0x19a43e[_0xa9c5('0x1d')]:_0x40b001[_0xa9c5('0x1e')]+_0x40b001[_0xa9c5('0x1c')];var _0x1e5ce6;if(_0x3b8cf7>=_0x55cce5){_0x3b8cf7=_0x55cce5;_0x1e5ce6=0xc8;}else{_0x1e5ce6=0xce;}_0x251099[_0xa9c5('0x19')](_0x1e5ce6);return _0x251099[_0xa9c5('0x1f')](_0xa9c5('0x20'),_0x1142d9+'-'+_0x3b8cf7+'/'+_0x55cce5)[_0xa9c5('0x1a')](_0x19a43e);}return null;};}function patchUpdates(_0x54f8b9){return function(_0x1115ad){try{jsonpatch[_0xa9c5('0x21')](_0x1115ad,_0x54f8b9,!![]);}catch(_0x541c77){return BPromise['reject'](_0x541c77);}return _0x1115ad[_0xa9c5('0x22')]();};}function saveUpdates(_0x366f5c,_0x10b208){return function(_0x3b497a){if(_0x3b497a){return _0x3b497a[_0xa9c5('0x23')](_0x366f5c)[_0xa9c5('0x24')](function(_0x48e2cb){return _0x48e2cb;});}return null;};}function removeEntity(_0x4fa280,_0x3d4e1b){return function(_0x11d395){if(_0x11d395){return _0x11d395['destroy']()[_0xa9c5('0x24')](function(){var _0x424b4c=_0x11d395[_0xa9c5('0x25')]({'plain':!![]});var _0x32fc7d=_0xa9c5('0x26');return db[_0xa9c5('0x27')][_0xa9c5('0x28')]({'where':{'type':_0x32fc7d,'resourceId':_0x424b4c['id']}})['then'](function(){return _0x11d395;});})['then'](function(){_0x4fa280[_0xa9c5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1762ac,_0x830bad){return function(_0x4caefa){if(!_0x4caefa){_0x1762ac[_0xa9c5('0x17')](0x194);}return _0x4caefa;};}function handleError(_0x320dc0,_0x5f468b){_0x5f468b=_0x5f468b||0x1f4;return function(_0x413edf){logger[_0xa9c5('0x29')](_0x413edf[_0xa9c5('0x2a')]);if(_0x413edf[_0xa9c5('0x2b')]){delete _0x413edf[_0xa9c5('0x2b')];}_0x320dc0['status'](_0x5f468b)[_0xa9c5('0x2c')](_0x413edf);};}exports['index']=function(_0x3c3da7,_0x1ef388){var _0x2eeed1={},_0x541475={},_0xc6d0c1={'count':0x0,'rows':[]};var _0xbe29c5=_['map'](db[_0xa9c5('0x2d')][_0xa9c5('0x2e')],function(_0x431e07){return{'name':_0x431e07[_0xa9c5('0x2f')],'type':_0x431e07[_0xa9c5('0x30')][_0xa9c5('0x31')]};});_0x541475[_0xa9c5('0x32')]=_['map'](_0xbe29c5,_0xa9c5('0x2b'));_0x541475[_0xa9c5('0x33')]=_[_0xa9c5('0x34')](_0x3c3da7[_0xa9c5('0x33')]);_0x541475[_0xa9c5('0x35')]=_[_0xa9c5('0x36')](_0x541475[_0xa9c5('0x32')],_0x541475[_0xa9c5('0x33')]);_0x2eeed1['attributes']=_['intersection'](_0x541475[_0xa9c5('0x32')],qs[_0xa9c5('0x37')](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x37')]));_0x2eeed1[_0xa9c5('0x38')]=_0x2eeed1[_0xa9c5('0x38')]['length']?_0x2eeed1['attributes']:_0x541475['model'];if(!_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x39')]('nolimit')){_0x2eeed1[_0xa9c5('0x1c')]=qs['limit'](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x1c')]);_0x2eeed1[_0xa9c5('0x1e')]=qs[_0xa9c5('0x1e')](_0x3c3da7['query'][_0xa9c5('0x1e')]);}_0x2eeed1[_0xa9c5('0x3a')]=qs[_0xa9c5('0x3b')](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3b')]);_0x2eeed1[_0xa9c5('0x3c')]=qs[_0xa9c5('0x35')](_[_0xa9c5('0x3d')](_0x3c3da7['query'],_0x541475[_0xa9c5('0x35')]),_0xbe29c5);if(_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3e')]){_0x2eeed1[_0xa9c5('0x3c')]=_[_0xa9c5('0x3f')](_0x2eeed1[_0xa9c5('0x3c')],{'$or':_['map'](_0xbe29c5,function(_0x307736){if(_0x307736['type']!==_0xa9c5('0x40')){var _0x5c89e7={};_0x5c89e7[_0x307736[_0xa9c5('0x2b')]]={'$like':'%'+_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3e')]+'%'};return _0x5c89e7;}})});}_0x2eeed1=_['merge']({},_0x2eeed1,_0x3c3da7[_0xa9c5('0x41')]);var _0x1ddd72={'where':_0x2eeed1[_0xa9c5('0x3c')]};return db[_0xa9c5('0x2d')]['count'](_0x1ddd72)[_0xa9c5('0x24')](function(_0x97803f){_0xc6d0c1[_0xa9c5('0x1d')]=_0x97803f;if(_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x42')]){_0x2eeed1['include']=[{'all':!![]}];}return db[_0xa9c5('0x2d')]['findAll'](_0x2eeed1);})[_0xa9c5('0x24')](function(_0x397614){_0xc6d0c1[_0xa9c5('0x43')]=_0x397614;return _0xc6d0c1;})[_0xa9c5('0x24')](respondWithFilteredResult(_0x1ef388,_0x2eeed1))[_0xa9c5('0x44')](handleError(_0x1ef388,null));};exports[_0xa9c5('0x45')]=function(_0xf35cb3,_0x3e8633){var _0x1f895a={'raw':!![],'where':{'id':_0xf35cb3['params']['id']}},_0xc28b1a={};_0xc28b1a[_0xa9c5('0x32')]=_[_0xa9c5('0x34')](db[_0xa9c5('0x2d')][_0xa9c5('0x2e')]);_0xc28b1a[_0xa9c5('0x33')]=_[_0xa9c5('0x34')](_0xf35cb3['query']);_0xc28b1a[_0xa9c5('0x35')]=_[_0xa9c5('0x36')](_0xc28b1a['model'],_0xc28b1a['query']);_0x1f895a['attributes']=_['intersection'](_0xc28b1a['model'],qs[_0xa9c5('0x37')](_0xf35cb3[_0xa9c5('0x33')][_0xa9c5('0x37')]));_0x1f895a[_0xa9c5('0x38')]=_0x1f895a[_0xa9c5('0x38')][_0xa9c5('0x46')]?_0x1f895a[_0xa9c5('0x38')]:_0xc28b1a[_0xa9c5('0x32')];if(_0xf35cb3[_0xa9c5('0x33')][_0xa9c5('0x42')]){_0x1f895a[_0xa9c5('0x47')]=[{'all':!![]}];}_0x1f895a=_[_0xa9c5('0x3f')]({},_0x1f895a,_0xf35cb3[_0xa9c5('0x41')]);return db['AnalyticMetric'][_0xa9c5('0x48')](_0x1f895a)['then'](handleEntityNotFound(_0x3e8633,null))[_0xa9c5('0x24')](respondWithResult(_0x3e8633,null))[_0xa9c5('0x44')](handleError(_0x3e8633,null));};exports['create']=function(_0x5cbd33,_0xf00970){return db[_0xa9c5('0x2d')][_0xa9c5('0x49')](_0x5cbd33['body'],{})['then'](function(_0x2333c4){var _0xd03cec=_0x5cbd33['user'][_0xa9c5('0x25')]({'plain':!![]});if(!_0xd03cec)throw new Error(_0xa9c5('0x4a'));if(_0xd03cec[_0xa9c5('0x4b')]===_0xa9c5('0x4c')){var _0x34020f=_0x2333c4[_0xa9c5('0x25')]({'plain':!![]});var _0x4b6fc9='Metrics';return db['UserProfileSection'][_0xa9c5('0x48')]({'where':{'name':_0x4b6fc9,'userProfileId':_0xd03cec[_0xa9c5('0x4d')]},'raw':!![]})[_0xa9c5('0x24')](function(_0xef4d2){if(_0xef4d2&&_0xef4d2[_0xa9c5('0x4e')]===0x0){return db[_0xa9c5('0x27')]['create']({'name':_0x34020f[_0xa9c5('0x2b')],'resourceId':_0x34020f['id'],'type':_0xef4d2[_0xa9c5('0x2b')],'sectionId':_0xef4d2['id']},{})[_0xa9c5('0x24')](function(){return _0x2333c4;});}else{return _0x2333c4;}})[_0xa9c5('0x44')](function(_0xa0b458){logger[_0xa9c5('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa0b458);throw _0xa0b458;});}return _0x2333c4;})['then'](respondWithResult(_0xf00970,0xc9))[_0xa9c5('0x44')](handleError(_0xf00970,null));};exports['update']=function(_0x1b158f,_0x5ea9b0){if(_0x1b158f[_0xa9c5('0x4f')]['id']){delete _0x1b158f[_0xa9c5('0x4f')]['id'];}return db[_0xa9c5('0x2d')]['find']({'where':{'id':_0x1b158f[_0xa9c5('0x50')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x5ea9b0,null))[_0xa9c5('0x24')](saveUpdates(_0x1b158f[_0xa9c5('0x4f')],null))['then'](respondWithResult(_0x5ea9b0,null))['catch'](handleError(_0x5ea9b0,null));};exports[_0xa9c5('0x28')]=function(_0x2b66ee,_0x3205f2){return db['AnalyticMetric'][_0xa9c5('0x48')]({'where':{'id':_0x2b66ee[_0xa9c5('0x50')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x3205f2,null))[_0xa9c5('0x24')](removeEntity(_0x3205f2,null))[_0xa9c5('0x44')](handleError(_0x3205f2,null));}; \ No newline at end of file +var _0x7da7=['model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','merge','options','where','AnalyticMetric','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','json','apply','reject','update','then','destroy','get','Metrics','UserProfileResource','end','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x7da7,0x10d));var _0x77da=function(_0x285800,_0x26765e){_0x285800=_0x285800-0x0;var _0x4b809e=_0x7da7[_0x285800];return _0x4b809e;};'use strict';var emlformat=require(_0x77da('0x0'));var rimraf=require(_0x77da('0x1'));var zipdir=require(_0x77da('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x77da('0x3'));var BPromise=require(_0x77da('0x4'));var Mustache=require('mustache');var util=require(_0x77da('0x5'));var path=require(_0x77da('0x6'));var sox=require('sox');var csv=require(_0x77da('0x7'));var ejs=require(_0x77da('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x77da('0x9'));var squel=require('squel');var crypto=require(_0x77da('0xa'));var jsforce=require(_0x77da('0xb'));var deskjs=require(_0x77da('0xc'));var toCsv=require(_0x77da('0x7'));var querystring=require(_0x77da('0xd'));var Papa=require('papaparse');var Redis=require(_0x77da('0xe'));var authService=require(_0x77da('0xf'));var qs=require(_0x77da('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77da('0x11'));var logger=require(_0x77da('0x12'))(_0x77da('0x13'));var utils=require(_0x77da('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x77da('0x15'));var db=require(_0x77da('0x16'))['db'];function respondWithStatusCode(_0x2acc65,_0x5d6e2f){_0x5d6e2f=_0x5d6e2f||0xcc;return function(_0x4a7748){if(_0x4a7748){return _0x2acc65[_0x77da('0x17')](_0x5d6e2f);}return _0x2acc65[_0x77da('0x18')](_0x5d6e2f)['end']();};}function respondWithResult(_0x3b0ff2,_0x369df0){_0x369df0=_0x369df0||0xc8;return function(_0x355719){if(_0x355719){return _0x3b0ff2[_0x77da('0x18')](_0x369df0)['json'](_0x355719);}};}function respondWithFilteredResult(_0x2172d0,_0x4e130c){return function(_0x29cd7b){if(_0x29cd7b){var _0x366443=typeof _0x4e130c[_0x77da('0x19')]===_0x77da('0x1a')&&typeof _0x4e130c['limit']==='undefined';var _0x514016=_0x29cd7b['count'];var _0x103e46=_0x366443?0x0:_0x4e130c[_0x77da('0x19')];var _0x289887=_0x366443?_0x29cd7b[_0x77da('0x1b')]:_0x4e130c[_0x77da('0x19')]+_0x4e130c[_0x77da('0x1c')];var _0x1d325c;if(_0x289887>=_0x514016){_0x289887=_0x514016;_0x1d325c=0xc8;}else{_0x1d325c=0xce;}_0x2172d0[_0x77da('0x18')](_0x1d325c);return _0x2172d0['set']('Content-Range',_0x103e46+'-'+_0x289887+'/'+_0x514016)[_0x77da('0x1d')](_0x29cd7b);}return null;};}function patchUpdates(_0x4d1512){return function(_0x507979){try{jsonpatch[_0x77da('0x1e')](_0x507979,_0x4d1512,!![]);}catch(_0x304a2b){return BPromise[_0x77da('0x1f')](_0x304a2b);}return _0x507979['save']();};}function saveUpdates(_0x58270c,_0x3e6cfe){return function(_0x58f6c1){if(_0x58f6c1){return _0x58f6c1[_0x77da('0x20')](_0x58270c)[_0x77da('0x21')](function(_0xc52f0e){return _0xc52f0e;});}return null;};}function removeEntity(_0x27b6c7,_0x10399a){return function(_0x270318){if(_0x270318){return _0x270318[_0x77da('0x22')]()['then'](function(){var _0x4885ec=_0x270318[_0x77da('0x23')]({'plain':!![]});var _0x2d009f=_0x77da('0x24');return db[_0x77da('0x25')]['destroy']({'where':{'type':_0x2d009f,'resourceId':_0x4885ec['id']}})[_0x77da('0x21')](function(){return _0x270318;});})[_0x77da('0x21')](function(){_0x27b6c7[_0x77da('0x18')](0xcc)[_0x77da('0x26')]();});}};}function handleEntityNotFound(_0x446ae7,_0x5997b6){return function(_0xce24b8){if(!_0xce24b8){_0x446ae7[_0x77da('0x17')](0x194);}return _0xce24b8;};}function handleError(_0x1f2279,_0x2913f7){_0x2913f7=_0x2913f7||0x1f4;return function(_0x496ecd){logger['error'](_0x496ecd['stack']);if(_0x496ecd[_0x77da('0x27')]){delete _0x496ecd[_0x77da('0x27')];}_0x1f2279[_0x77da('0x18')](_0x2913f7)[_0x77da('0x28')](_0x496ecd);};}exports[_0x77da('0x29')]=function(_0x4eeb99,_0x350b4e){var _0x26f5a0={},_0x356bfb={},_0x1d381b={'count':0x0,'rows':[]};var _0x1e7853=_[_0x77da('0x2a')](db['AnalyticMetric'][_0x77da('0x2b')],function(_0x228851){return{'name':_0x228851[_0x77da('0x2c')],'type':_0x228851[_0x77da('0x2d')][_0x77da('0x2e')]};});_0x356bfb[_0x77da('0x2f')]=_[_0x77da('0x2a')](_0x1e7853,_0x77da('0x27'));_0x356bfb['query']=_['keys'](_0x4eeb99[_0x77da('0x30')]);_0x356bfb[_0x77da('0x31')]=_['intersection'](_0x356bfb[_0x77da('0x2f')],_0x356bfb[_0x77da('0x30')]);_0x26f5a0[_0x77da('0x32')]=_[_0x77da('0x33')](_0x356bfb[_0x77da('0x2f')],qs[_0x77da('0x34')](_0x4eeb99[_0x77da('0x30')]['fields']));_0x26f5a0[_0x77da('0x32')]=_0x26f5a0['attributes']['length']?_0x26f5a0['attributes']:_0x356bfb[_0x77da('0x2f')];if(!_0x4eeb99['query'][_0x77da('0x35')](_0x77da('0x36'))){_0x26f5a0[_0x77da('0x1c')]=qs[_0x77da('0x1c')](_0x4eeb99[_0x77da('0x30')][_0x77da('0x1c')]);_0x26f5a0[_0x77da('0x19')]=qs['offset'](_0x4eeb99[_0x77da('0x30')][_0x77da('0x19')]);}_0x26f5a0[_0x77da('0x37')]=qs[_0x77da('0x38')](_0x4eeb99[_0x77da('0x30')][_0x77da('0x38')]);_0x26f5a0['where']=qs[_0x77da('0x31')](_[_0x77da('0x39')](_0x4eeb99[_0x77da('0x30')],_0x356bfb['filters']),_0x1e7853);if(_0x4eeb99[_0x77da('0x30')]['filter']){_0x26f5a0['where']=_['merge'](_0x26f5a0['where'],{'$or':_[_0x77da('0x2a')](_0x1e7853,function(_0x1adba5){if(_0x1adba5[_0x77da('0x2d')]!=='VIRTUAL'){var _0x21d337={};_0x21d337[_0x1adba5['name']]={'$like':'%'+_0x4eeb99[_0x77da('0x30')]['filter']+'%'};return _0x21d337;}})});}_0x26f5a0=_[_0x77da('0x3a')]({},_0x26f5a0,_0x4eeb99[_0x77da('0x3b')]);var _0x290667={'where':_0x26f5a0[_0x77da('0x3c')]};return db[_0x77da('0x3d')]['count'](_0x290667)[_0x77da('0x21')](function(_0x1f48bd){_0x1d381b[_0x77da('0x1b')]=_0x1f48bd;if(_0x4eeb99[_0x77da('0x30')][_0x77da('0x3e')]){_0x26f5a0[_0x77da('0x3f')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x77da('0x40')](_0x26f5a0);})[_0x77da('0x21')](function(_0x21de41){_0x1d381b[_0x77da('0x41')]=_0x21de41;return _0x1d381b;})[_0x77da('0x21')](respondWithFilteredResult(_0x350b4e,_0x26f5a0))[_0x77da('0x42')](handleError(_0x350b4e,null));};exports['show']=function(_0x10957b,_0x5abcd9){var _0x1ae806={'raw':!![],'where':{'id':_0x10957b[_0x77da('0x43')]['id']}},_0x373fb2={};_0x373fb2['model']=_[_0x77da('0x44')](db[_0x77da('0x3d')][_0x77da('0x2b')]);_0x373fb2[_0x77da('0x30')]=_[_0x77da('0x44')](_0x10957b[_0x77da('0x30')]);_0x373fb2[_0x77da('0x31')]=_[_0x77da('0x33')](_0x373fb2[_0x77da('0x2f')],_0x373fb2['query']);_0x1ae806[_0x77da('0x32')]=_[_0x77da('0x33')](_0x373fb2[_0x77da('0x2f')],qs[_0x77da('0x34')](_0x10957b[_0x77da('0x30')][_0x77da('0x34')]));_0x1ae806['attributes']=_0x1ae806['attributes'][_0x77da('0x45')]?_0x1ae806[_0x77da('0x32')]:_0x373fb2[_0x77da('0x2f')];if(_0x10957b[_0x77da('0x30')][_0x77da('0x3e')]){_0x1ae806[_0x77da('0x3f')]=[{'all':!![]}];}_0x1ae806=_['merge']({},_0x1ae806,_0x10957b[_0x77da('0x3b')]);return db[_0x77da('0x3d')][_0x77da('0x46')](_0x1ae806)[_0x77da('0x21')](handleEntityNotFound(_0x5abcd9,null))['then'](respondWithResult(_0x5abcd9,null))[_0x77da('0x42')](handleError(_0x5abcd9,null));};exports['create']=function(_0x518fd5,_0x36263b){return db[_0x77da('0x3d')][_0x77da('0x47')](_0x518fd5[_0x77da('0x48')],{})['then'](function(_0x16bf4b){var _0x1e36ee=_0x518fd5['user'][_0x77da('0x23')]({'plain':!![]});if(!_0x1e36ee)throw new Error(_0x77da('0x49'));if(_0x1e36ee['role']===_0x77da('0x4a')){var _0x3aaf5b=_0x16bf4b[_0x77da('0x23')]({'plain':!![]});var _0xef2496=_0x77da('0x24');return db[_0x77da('0x4b')][_0x77da('0x46')]({'where':{'name':_0xef2496,'userProfileId':_0x1e36ee[_0x77da('0x4c')]},'raw':!![]})[_0x77da('0x21')](function(_0x3a34a8){if(_0x3a34a8&&_0x3a34a8['autoAssociation']===0x0){return db[_0x77da('0x25')]['create']({'name':_0x3aaf5b[_0x77da('0x27')],'resourceId':_0x3aaf5b['id'],'type':_0x3a34a8[_0x77da('0x27')],'sectionId':_0x3a34a8['id']},{})[_0x77da('0x21')](function(){return _0x16bf4b;});}else{return _0x16bf4b;}})[_0x77da('0x42')](function(_0x374179){logger[_0x77da('0x4d')](_0x77da('0x4e'),_0x374179);throw _0x374179;});}return _0x16bf4b;})['then'](respondWithResult(_0x36263b,0xc9))[_0x77da('0x42')](handleError(_0x36263b,null));};exports[_0x77da('0x20')]=function(_0x1a7115,_0x353be9){if(_0x1a7115['body']['id']){delete _0x1a7115[_0x77da('0x48')]['id'];}return db[_0x77da('0x3d')][_0x77da('0x46')]({'where':{'id':_0x1a7115['params']['id']}})['then'](handleEntityNotFound(_0x353be9,null))[_0x77da('0x21')](saveUpdates(_0x1a7115[_0x77da('0x48')],null))[_0x77da('0x21')](respondWithResult(_0x353be9,null))[_0x77da('0x42')](handleError(_0x353be9,null));};exports[_0x77da('0x22')]=function(_0x528a32,_0x50437b){return db[_0x77da('0x3d')][_0x77da('0x46')]({'where':{'id':_0x528a32['params']['id']}})[_0x77da('0x21')](handleEntityNotFound(_0x50437b,null))[_0x77da('0x21')](removeEntity(_0x50437b,null))[_0x77da('0x42')](handleError(_0x50437b,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 37262e0..e297f4b 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 _0x9c5a=['define','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x911cb9,_0x69e3f){var _0x59c239=function(_0x1c918e){while(--_0x1c918e){_0x911cb9['push'](_0x911cb9['shift']());}};_0x59c239(++_0x69e3f);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x351380,_0x44bd1c){_0x351380=_0x351380-0x0;var _0x4e29f2=_0x9c5a[_0x351380];return _0x4e29f2;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var logger=require('../../config/logger')(_0xa9c5('0x2'));var moment=require(_0xa9c5('0x3'));var BPromise=require(_0xa9c5('0x4'));var rp=require(_0xa9c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var attributes=require('./analyticMetric.attributes');module[_0xa9c5('0x8')]=function(_0x4d9c7a,_0x394d84){return _0x4d9c7a[_0xa9c5('0x9')]('AnalyticMetric',attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbac8=['lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','define','AnalyticMetric','analytics_metrics'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0xbac8,0x140));var _0x8bac=function(_0x13ad5d,_0x4b071b){_0x13ad5d=_0x13ad5d-0x0;var _0x213ef8=_0xbac8[_0x13ad5d];return _0x213ef8;};'use strict';var _=require(_0x8bac('0x0'));var util=require(_0x8bac('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8bac('0x2'));var BPromise=require(_0x8bac('0x3'));var rp=require(_0x8bac('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8bac('0x5'));var config=require(_0x8bac('0x6'));var attributes=require('./analyticMetric.attributes');module['exports']=function(_0x28b1d1,_0x36f5b4){return _0x28b1d1[_0x8bac('0x7')](_0x8bac('0x8'),attributes,{'tableName':_0x8bac('0x9'),'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 8067aa8..5819c5b 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 _0x1d8c=['request','then','info','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client'];(function(_0x1deee5,_0x1d4485){var _0x1d6c3a=function(_0x433abf){while(--_0x433abf){_0x1deee5['push'](_0x1deee5['shift']());}};_0x1d6c3a(++_0x1d4485);}(_0x1d8c,0x1af));var _0xc1d8=function(_0x3a2f66,_0x16c55a){_0x3a2f66=_0x3a2f66-0x0;var _0x5b8a76=_0x1d8c[_0x3a2f66];return _0x5b8a76;};'use strict';var _=require(_0xc1d8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc1d8('0x1'));var rs=require(_0xc1d8('0x2'));var fs=require('fs');var Redis=require(_0xc1d8('0x3'));var db=require(_0xc1d8('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc1d8('0x5'));var config=require(_0xc1d8('0x6'));var jayson=require(_0xc1d8('0x7'));var client=jayson[_0xc1d8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x149196,_0x2621d7,_0x2c739f){return new BPromise(function(_0x260ee2,_0x14daa7){return client[_0xc1d8('0x9')](_0x149196,_0x2c739f)[_0xc1d8('0xa')](function(_0x421544){logger[_0xc1d8('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x2621d7,_0xc1d8('0xc'));logger['debug'](_0xc1d8('0xd'),_0x2621d7,_0xc1d8('0xc'),JSON[_0xc1d8('0xe')](_0x421544));if(_0x421544[_0xc1d8('0xf')]){if(_0x421544[_0xc1d8('0xf')][_0xc1d8('0x10')]===0x1f4){logger[_0xc1d8('0xf')](_0xc1d8('0x11'),_0x2621d7,_0x421544[_0xc1d8('0xf')]['message']);return _0x14daa7(_0x421544[_0xc1d8('0xf')][_0xc1d8('0x12')]);}logger['error'](_0xc1d8('0x11'),_0x2621d7,_0x421544[_0xc1d8('0xf')]['message']);return _0x260ee2(_0x421544[_0xc1d8('0xf')][_0xc1d8('0x12')]);}else{logger[_0xc1d8('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x2621d7,_0xc1d8('0xc'));_0x260ee2(_0x421544['result']['message']);}})[_0xc1d8('0x13')](function(_0x5ff1a2){logger[_0xc1d8('0xf')](_0xc1d8('0x11'),_0x2621d7,_0x5ff1a2);_0x14daa7(_0x5ff1a2);});});} \ No newline at end of file +var _0x4572=['then','info','AnalyticMetric,\x20%s,\x20%s','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request'];(function(_0x227f59,_0xeecf9d){var _0x2da8c0=function(_0xb5319e){while(--_0xb5319e){_0x227f59['push'](_0x227f59['shift']());}};_0x2da8c0(++_0xeecf9d);}(_0x4572,0x106));var _0x2457=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x4572[_0xa6cc5c];return _0x44803d;};'use strict';var _=require(_0x2457('0x0'));var util=require(_0x2457('0x1'));var moment=require(_0x2457('0x2'));var BPromise=require(_0x2457('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2457('0x4'));var db=require(_0x2457('0x5'))['db'];var utils=require(_0x2457('0x6'));var logger=require(_0x2457('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2457('0x8'));var client=jayson['client'][_0x2457('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa34ed6,_0x4c10ca,_0x16ce42){return new BPromise(function(_0x44b5a5,_0xb7cecc){return client[_0x2457('0xa')](_0xa34ed6,_0x16ce42)[_0x2457('0xb')](function(_0x47e881){logger[_0x2457('0xc')](_0x2457('0xd'),_0x4c10ca,'request\x20sent');logger['debug'](_0x2457('0xe'),_0x4c10ca,_0x2457('0xf'),JSON[_0x2457('0x10')](_0x47e881));if(_0x47e881[_0x2457('0x11')]){if(_0x47e881[_0x2457('0x11')][_0x2457('0x12')]===0x1f4){logger['error'](_0x2457('0xd'),_0x4c10ca,_0x47e881[_0x2457('0x11')][_0x2457('0x13')]);return _0xb7cecc(_0x47e881[_0x2457('0x11')][_0x2457('0x13')]);}logger[_0x2457('0x11')](_0x2457('0xd'),_0x4c10ca,_0x47e881[_0x2457('0x11')][_0x2457('0x13')]);return _0x44b5a5(_0x47e881[_0x2457('0x11')]['message']);}else{logger[_0x2457('0xc')](_0x2457('0xd'),_0x4c10ca,_0x2457('0xf'));_0x44b5a5(_0x47e881['result'][_0x2457('0x13')]);}})[_0x2457('0x14')](function(_0x2079e7){logger[_0x2457('0x11')](_0x2457('0xd'),_0x4c10ca,_0x2079e7);_0xb7cecc(_0x2079e7);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index e2fe15b..49f3eb3 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 _0xcddb=['post','put','delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','isAuthenticated','get','/:id','show'];(function(_0x3cef3b,_0xf2c24f){var _0x35b6bb=function(_0x1d5175){while(--_0x1d5175){_0x3cef3b['push'](_0x3cef3b['shift']());}};_0x35b6bb(++_0xf2c24f);}(_0xcddb,0x1c4));var _0xbcdd=function(_0x305734,_0x106e4e){_0x305734=_0x305734-0x0;var _0x131b90=_0xcddb[_0x305734];return _0x131b90;};'use strict';var multer=require(_0xbcdd('0x0'));var util=require(_0xbcdd('0x1'));var path=require(_0xbcdd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbcdd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbcdd('0x4'));var interaction=require(_0xbcdd('0x5'));var config=require(_0xbcdd('0x6'));var controller=require(_0xbcdd('0x7'));router['get']('/',auth[_0xbcdd('0x8')](),controller['index']);router[_0xbcdd('0x9')](_0xbcdd('0xa'),auth['isAuthenticated'](),controller[_0xbcdd('0xb')]);router[_0xbcdd('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbcdd('0xd')](_0xbcdd('0xa'),auth[_0xbcdd('0x8')](),controller['update']);router[_0xbcdd('0xe')](_0xbcdd('0xa'),auth[_0xbcdd('0x8')](),controller[_0xbcdd('0xf')]);module['exports']=router; \ No newline at end of file +var _0x88b0=['../../config/environment','./analyticMetric.controller','get','/:id','isAuthenticated','show','post','create','update','multer','util','express','Router','fs-extra','../../components/auth/service'];(function(_0x16dfb3,_0x1613fc){var _0x1d8030=function(_0x1bd5da){while(--_0x1bd5da){_0x16dfb3['push'](_0x16dfb3['shift']());}};_0x1d8030(++_0x1613fc);}(_0x88b0,0x1cb));var _0x088b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x88b0[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x088b('0x0'));var util=require(_0x088b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x088b('0x2'));var router=express[_0x088b('0x3')]();var fs_extra=require(_0x088b('0x4'));var auth=require(_0x088b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x088b('0x6'));var controller=require(_0x088b('0x7'));router[_0x088b('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x088b('0x8')](_0x088b('0x9'),auth[_0x088b('0xa')](),controller[_0x088b('0xb')]);router[_0x088b('0xc')]('/',auth[_0x088b('0xa')](),controller[_0x088b('0xd')]);router['put'](_0x088b('0x9'),auth['isAuthenticated'](),controller[_0x088b('0xe')]);router['delete'](_0x088b('0x9'),auth[_0x088b('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index ac30666..d956770 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 _0x35fe=['exports','TEXT','sequelize'];(function(_0x2ae2ad,_0xac5b0c){var _0x26dbd7=function(_0x5e685b){while(--_0x5e685b){_0x2ae2ad['push'](_0x2ae2ad['shift']());}};_0x26dbd7(++_0xac5b0c);}(_0x35fe,0x158));var _0xe35f=function(_0xf0bc07,_0x510ebf){_0xf0bc07=_0xf0bc07-0x0;var _0x1c50c2=_0x35fe[_0xf0bc07];return _0x1c50c2;};'use strict';var Sequelize=require(_0xe35f('0x0'));module[_0xe35f('0x1')]={'tree':{'type':Sequelize[_0xe35f('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xbc8b=['exports'];(function(_0x509dfd,_0x52d06c){var _0x469a63=function(_0x399f29){while(--_0x399f29){_0x509dfd['push'](_0x509dfd['shift']());}};_0x469a63(++_0x52d06c);}(_0xbc8b,0x16b));var _0xbbc8=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xbc8b[_0x550d12];return _0x12103d;};'use strict';var Sequelize=require('sequelize');module[_0xbbc8('0x0')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 60abff2..3aa6bde 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 _0x66c2=['type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','stack','name','index','AnalyticTreeReport','rawAttributes','fieldName'];(function(_0x105abe,_0x55545c){var _0xc77aa4=function(_0x5c80e0){while(--_0x5c80e0){_0x105abe['push'](_0x105abe['shift']());}};_0xc77aa4(++_0x55545c);}(_0x66c2,0xfe));var _0x266c=function(_0x5e238d,_0x39ff2d){_0x5e238d=_0x5e238d-0x0;var _0x371d83=_0x66c2[_0x5e238d];return _0x371d83;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x266c('0x0'));var zipdir=require(_0x266c('0x1'));var jsonpatch=require(_0x266c('0x2'));var rp=require(_0x266c('0x3'));var moment=require(_0x266c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x266c('0x5'));var util=require(_0x266c('0x6'));var path=require('path');var sox=require(_0x266c('0x7'));var csv=require(_0x266c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x266c('0x9'));var squel=require(_0x266c('0xa'));var crypto=require(_0x266c('0xb'));var jsforce=require(_0x266c('0xc'));var deskjs=require(_0x266c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x266c('0xe'));var Papa=require(_0x266c('0xf'));var Redis=require(_0x266c('0x10'));var authService=require(_0x266c('0x11'));var qs=require(_0x266c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x266c('0x13'))(_0x266c('0x14'));var utils=require(_0x266c('0x15'));var config=require(_0x266c('0x16'));var licenseUtil=require(_0x266c('0x17'));var db=require(_0x266c('0x18'))['db'];function respondWithStatusCode(_0x280625,_0x443203){_0x443203=_0x443203||0xcc;return function(_0x213321){if(_0x213321){return _0x280625[_0x266c('0x19')](_0x443203);}return _0x280625[_0x266c('0x1a')](_0x443203)[_0x266c('0x1b')]();};}function respondWithResult(_0x2f927d,_0x813c93){_0x813c93=_0x813c93||0xc8;return function(_0x4f1999){if(_0x4f1999){return _0x2f927d['status'](_0x813c93)['json'](_0x4f1999);}};}function respondWithFilteredResult(_0xbe7b26,_0x242d40){return function(_0x18bb02){if(_0x18bb02){var _0x4a688c=typeof _0x242d40[_0x266c('0x1c')]==='undefined'&&typeof _0x242d40['limit']===_0x266c('0x1d');var _0x5dec3c=_0x18bb02[_0x266c('0x1e')];var _0x24900d=_0x4a688c?0x0:_0x242d40[_0x266c('0x1c')];var _0x54af08=_0x4a688c?_0x18bb02[_0x266c('0x1e')]:_0x242d40[_0x266c('0x1c')]+_0x242d40[_0x266c('0x1f')];var _0x3e8569;if(_0x54af08>=_0x5dec3c){_0x54af08=_0x5dec3c;_0x3e8569=0xc8;}else{_0x3e8569=0xce;}_0xbe7b26['status'](_0x3e8569);return _0xbe7b26[_0x266c('0x20')](_0x266c('0x21'),_0x24900d+'-'+_0x54af08+'/'+_0x5dec3c)[_0x266c('0x22')](_0x18bb02);}return null;};}function patchUpdates(_0x2db091){return function(_0x44600b){try{jsonpatch[_0x266c('0x23')](_0x44600b,_0x2db091,!![]);}catch(_0x4c9058){return BPromise['reject'](_0x4c9058);}return _0x44600b[_0x266c('0x24')]();};}function saveUpdates(_0x7a3071,_0x4e9a1a){return function(_0x407da5){if(_0x407da5){return _0x407da5[_0x266c('0x25')](_0x7a3071)[_0x266c('0x26')](function(_0x3f9b79){return _0x3f9b79;});}return null;};}function removeEntity(_0x3175b8,_0x5419d0){return function(_0x27b645){if(_0x27b645){return _0x27b645[_0x266c('0x27')]()[_0x266c('0x26')](function(){_0x3175b8[_0x266c('0x1a')](0xcc)[_0x266c('0x1b')]();});}};}function handleEntityNotFound(_0xc53783,_0x1352ca){return function(_0xbcf8c9){if(!_0xbcf8c9){_0xc53783[_0x266c('0x19')](0x194);}return _0xbcf8c9;};}function handleError(_0x2cf20c,_0x4c447a){_0x4c447a=_0x4c447a||0x1f4;return function(_0x151ea1){logger['error'](_0x151ea1[_0x266c('0x28')]);if(_0x151ea1['name']){delete _0x151ea1[_0x266c('0x29')];}_0x2cf20c[_0x266c('0x1a')](_0x4c447a)['send'](_0x151ea1);};}exports[_0x266c('0x2a')]=function(_0x7816eb,_0x3e930c){var _0x1eec4c={},_0x5d69f1={},_0x248962={'count':0x0,'rows':[]};var _0x2e3ba7=_['map'](db[_0x266c('0x2b')][_0x266c('0x2c')],function(_0x4191a3){return{'name':_0x4191a3[_0x266c('0x2d')],'type':_0x4191a3[_0x266c('0x2e')][_0x266c('0x2f')]};});_0x5d69f1[_0x266c('0x30')]=_[_0x266c('0x31')](_0x2e3ba7,_0x266c('0x29'));_0x5d69f1[_0x266c('0x32')]=_[_0x266c('0x33')](_0x7816eb[_0x266c('0x32')]);_0x5d69f1['filters']=_[_0x266c('0x34')](_0x5d69f1[_0x266c('0x30')],_0x5d69f1['query']);_0x1eec4c[_0x266c('0x35')]=_[_0x266c('0x34')](_0x5d69f1[_0x266c('0x30')],qs[_0x266c('0x36')](_0x7816eb[_0x266c('0x32')][_0x266c('0x36')]));_0x1eec4c['attributes']=_0x1eec4c[_0x266c('0x35')][_0x266c('0x37')]?_0x1eec4c[_0x266c('0x35')]:_0x5d69f1[_0x266c('0x30')];if(!_0x7816eb[_0x266c('0x32')]['hasOwnProperty'](_0x266c('0x38'))){_0x1eec4c[_0x266c('0x1f')]=qs[_0x266c('0x1f')](_0x7816eb[_0x266c('0x32')][_0x266c('0x1f')]);_0x1eec4c[_0x266c('0x1c')]=qs[_0x266c('0x1c')](_0x7816eb[_0x266c('0x32')]['offset']);}_0x1eec4c['order']=qs[_0x266c('0x39')](_0x7816eb[_0x266c('0x32')]['sort']);_0x1eec4c[_0x266c('0x3a')]=qs[_0x266c('0x3b')](_[_0x266c('0x3c')](_0x7816eb[_0x266c('0x32')],_0x5d69f1[_0x266c('0x3b')]),_0x2e3ba7);if(_0x7816eb[_0x266c('0x32')][_0x266c('0x3d')]){_0x1eec4c[_0x266c('0x3a')]=_[_0x266c('0x3e')](_0x1eec4c[_0x266c('0x3a')],{'$or':_[_0x266c('0x31')](_0x2e3ba7,function(_0x1cd94a){if(_0x1cd94a['type']!==_0x266c('0x3f')){var _0x3e7fcf={};_0x3e7fcf[_0x1cd94a[_0x266c('0x29')]]={'$like':'%'+_0x7816eb[_0x266c('0x32')][_0x266c('0x3d')]+'%'};return _0x3e7fcf;}})});}_0x1eec4c=_['merge']({},_0x1eec4c,_0x7816eb[_0x266c('0x40')]);var _0x334803={'where':_0x1eec4c[_0x266c('0x3a')]};return db[_0x266c('0x2b')][_0x266c('0x1e')](_0x334803)[_0x266c('0x26')](function(_0x3473c2){_0x248962[_0x266c('0x1e')]=_0x3473c2;if(_0x7816eb[_0x266c('0x32')]['includeAll']){_0x1eec4c[_0x266c('0x41')]=[{'all':!![]}];}return db[_0x266c('0x2b')][_0x266c('0x42')](_0x1eec4c);})[_0x266c('0x26')](function(_0x104a5b){_0x248962[_0x266c('0x43')]=_0x104a5b;return _0x248962;})[_0x266c('0x26')](respondWithFilteredResult(_0x3e930c,_0x1eec4c))[_0x266c('0x44')](handleError(_0x3e930c,null));};exports[_0x266c('0x45')]=function(_0x98218c,_0xb70874){var _0x480db0={'raw':!![],'where':{'id':_0x98218c[_0x266c('0x46')]['id']}},_0x5c57e5={};_0x5c57e5[_0x266c('0x30')]=_['keys'](db[_0x266c('0x2b')]['rawAttributes']);_0x5c57e5['query']=_['keys'](_0x98218c[_0x266c('0x32')]);_0x5c57e5[_0x266c('0x3b')]=_[_0x266c('0x34')](_0x5c57e5[_0x266c('0x30')],_0x5c57e5[_0x266c('0x32')]);_0x480db0[_0x266c('0x35')]=_[_0x266c('0x34')](_0x5c57e5[_0x266c('0x30')],qs[_0x266c('0x36')](_0x98218c[_0x266c('0x32')][_0x266c('0x36')]));_0x480db0[_0x266c('0x35')]=_0x480db0['attributes'][_0x266c('0x37')]?_0x480db0[_0x266c('0x35')]:_0x5c57e5[_0x266c('0x30')];if(_0x98218c[_0x266c('0x32')][_0x266c('0x47')]){_0x480db0[_0x266c('0x41')]=[{'all':!![]}];}_0x480db0=_[_0x266c('0x3e')]({},_0x480db0,_0x98218c[_0x266c('0x40')]);return db[_0x266c('0x2b')][_0x266c('0x48')](_0x480db0)[_0x266c('0x26')](handleEntityNotFound(_0xb70874,null))[_0x266c('0x26')](respondWithResult(_0xb70874,null))[_0x266c('0x44')](handleError(_0xb70874,null));};exports[_0x266c('0x49')]=function(_0x48fd56,_0x51259a){return db[_0x266c('0x2b')][_0x266c('0x49')](_0x48fd56[_0x266c('0x4a')],{})['then'](respondWithResult(_0x51259a,0xc9))['catch'](handleError(_0x51259a,null));};exports[_0x266c('0x25')]=function(_0x38fee5,_0x31a2ca){if(_0x38fee5[_0x266c('0x4a')]['id']){delete _0x38fee5[_0x266c('0x4a')]['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x38fee5['params']['id']}})[_0x266c('0x26')](handleEntityNotFound(_0x31a2ca,null))['then'](saveUpdates(_0x38fee5[_0x266c('0x4a')],null))[_0x266c('0x26')](respondWithResult(_0x31a2ca,null))[_0x266c('0x44')](handleError(_0x31a2ca,null));};exports[_0x266c('0x27')]=function(_0x4ee5c6,_0x4e09fd){return db[_0x266c('0x2b')][_0x266c('0x48')]({'where':{'id':_0x4ee5c6[_0x266c('0x46')]['id']}})[_0x266c('0x26')](handleEntityNotFound(_0x4e09fd,null))[_0x266c('0x26')](removeEntity(_0x4e09fd,null))[_0x266c('0x44')](handleError(_0x4e09fd,null));}; \ No newline at end of file +var _0x9c21=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','update','destroy','then','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','keys','include','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox'];(function(_0x3ccd40,_0x538726){var _0x45baf0=function(_0x5d6c70){while(--_0x5d6c70){_0x3ccd40['push'](_0x3ccd40['shift']());}};_0x45baf0(++_0x538726);}(_0x9c21,0x178));var _0x19c2=function(_0xc137,_0x3011df){_0xc137=_0xc137-0x0;var _0x36ace7=_0x9c21[_0xc137];return _0x36ace7;};'use strict';var emlformat=require(_0x19c2('0x0'));var rimraf=require(_0x19c2('0x1'));var zipdir=require(_0x19c2('0x2'));var jsonpatch=require(_0x19c2('0x3'));var rp=require('request-promise');var moment=require(_0x19c2('0x4'));var BPromise=require(_0x19c2('0x5'));var Mustache=require(_0x19c2('0x6'));var util=require('util');var path=require(_0x19c2('0x7'));var sox=require(_0x19c2('0x8'));var csv=require('to-csv');var ejs=require(_0x19c2('0x9'));var fs=require('fs');var fs_extra=require(_0x19c2('0xa'));var _=require(_0x19c2('0xb'));var squel=require(_0x19c2('0xc'));var crypto=require(_0x19c2('0xd'));var jsforce=require(_0x19c2('0xe'));var deskjs=require(_0x19c2('0xf'));var toCsv=require(_0x19c2('0x10'));var querystring=require(_0x19c2('0x11'));var Papa=require(_0x19c2('0x12'));var Redis=require(_0x19c2('0x13'));var authService=require(_0x19c2('0x14'));var qs=require(_0x19c2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x19c2('0x16'));var utils=require(_0x19c2('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x19c2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbd62fd,_0x5cb7cf){_0x5cb7cf=_0x5cb7cf||0xcc;return function(_0x166c4e){if(_0x166c4e){return _0xbd62fd[_0x19c2('0x19')](_0x5cb7cf);}return _0xbd62fd[_0x19c2('0x1a')](_0x5cb7cf)[_0x19c2('0x1b')]();};}function respondWithResult(_0x3407b8,_0x3fa1bc){_0x3fa1bc=_0x3fa1bc||0xc8;return function(_0x5b016a){if(_0x5b016a){return _0x3407b8[_0x19c2('0x1a')](_0x3fa1bc)[_0x19c2('0x1c')](_0x5b016a);}};}function respondWithFilteredResult(_0x5ef532,_0x382cdd){return function(_0x84dc58){if(_0x84dc58){var _0x4ce53f=typeof _0x382cdd['offset']==='undefined'&&typeof _0x382cdd['limit']===_0x19c2('0x1d');var _0x717670=_0x84dc58[_0x19c2('0x1e')];var _0x4e16e2=_0x4ce53f?0x0:_0x382cdd[_0x19c2('0x1f')];var _0x4908f6=_0x4ce53f?_0x84dc58[_0x19c2('0x1e')]:_0x382cdd[_0x19c2('0x1f')]+_0x382cdd[_0x19c2('0x20')];var _0x658752;if(_0x4908f6>=_0x717670){_0x4908f6=_0x717670;_0x658752=0xc8;}else{_0x658752=0xce;}_0x5ef532[_0x19c2('0x1a')](_0x658752);return _0x5ef532[_0x19c2('0x21')](_0x19c2('0x22'),_0x4e16e2+'-'+_0x4908f6+'/'+_0x717670)['json'](_0x84dc58);}return null;};}function patchUpdates(_0x471576){return function(_0x49358f){try{jsonpatch[_0x19c2('0x23')](_0x49358f,_0x471576,!![]);}catch(_0xca76d4){return BPromise['reject'](_0xca76d4);}return _0x49358f['save']();};}function saveUpdates(_0x159252,_0xebf064){return function(_0x510153){if(_0x510153){return _0x510153[_0x19c2('0x24')](_0x159252)['then'](function(_0x53095a){return _0x53095a;});}return null;};}function removeEntity(_0x166272,_0x244298){return function(_0x17b7af){if(_0x17b7af){return _0x17b7af[_0x19c2('0x25')]()[_0x19c2('0x26')](function(){_0x166272[_0x19c2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bc883,_0x36daee){return function(_0x2e6ba4){if(!_0x2e6ba4){_0x1bc883[_0x19c2('0x19')](0x194);}return _0x2e6ba4;};}function handleError(_0xeaf4ef,_0x16d750){_0x16d750=_0x16d750||0x1f4;return function(_0x24a6cc){logger[_0x19c2('0x27')](_0x24a6cc[_0x19c2('0x28')]);if(_0x24a6cc[_0x19c2('0x29')]){delete _0x24a6cc[_0x19c2('0x29')];}_0xeaf4ef[_0x19c2('0x1a')](_0x16d750)[_0x19c2('0x2a')](_0x24a6cc);};}exports[_0x19c2('0x2b')]=function(_0x58d51b,_0x4cbc3c){var _0x5f1f0f={},_0x4f6c72={},_0x59790b={'count':0x0,'rows':[]};var _0x5e44cf=_[_0x19c2('0x2c')](db[_0x19c2('0x2d')][_0x19c2('0x2e')],function(_0x3a7baa){return{'name':_0x3a7baa[_0x19c2('0x2f')],'type':_0x3a7baa[_0x19c2('0x30')][_0x19c2('0x31')]};});_0x4f6c72[_0x19c2('0x32')]=_[_0x19c2('0x2c')](_0x5e44cf,_0x19c2('0x29'));_0x4f6c72[_0x19c2('0x33')]=_['keys'](_0x58d51b[_0x19c2('0x33')]);_0x4f6c72[_0x19c2('0x34')]=_['intersection'](_0x4f6c72[_0x19c2('0x32')],_0x4f6c72['query']);_0x5f1f0f[_0x19c2('0x35')]=_[_0x19c2('0x36')](_0x4f6c72[_0x19c2('0x32')],qs[_0x19c2('0x37')](_0x58d51b[_0x19c2('0x33')][_0x19c2('0x37')]));_0x5f1f0f['attributes']=_0x5f1f0f[_0x19c2('0x35')][_0x19c2('0x38')]?_0x5f1f0f[_0x19c2('0x35')]:_0x4f6c72['model'];if(!_0x58d51b[_0x19c2('0x33')][_0x19c2('0x39')](_0x19c2('0x3a'))){_0x5f1f0f[_0x19c2('0x20')]=qs['limit'](_0x58d51b[_0x19c2('0x33')][_0x19c2('0x20')]);_0x5f1f0f[_0x19c2('0x1f')]=qs[_0x19c2('0x1f')](_0x58d51b[_0x19c2('0x33')][_0x19c2('0x1f')]);}_0x5f1f0f[_0x19c2('0x3b')]=qs[_0x19c2('0x3c')](_0x58d51b[_0x19c2('0x33')]['sort']);_0x5f1f0f[_0x19c2('0x3d')]=qs[_0x19c2('0x34')](_[_0x19c2('0x3e')](_0x58d51b[_0x19c2('0x33')],_0x4f6c72[_0x19c2('0x34')]),_0x5e44cf);if(_0x58d51b[_0x19c2('0x33')][_0x19c2('0x3f')]){_0x5f1f0f[_0x19c2('0x3d')]=_[_0x19c2('0x40')](_0x5f1f0f[_0x19c2('0x3d')],{'$or':_[_0x19c2('0x2c')](_0x5e44cf,function(_0x3f21da){if(_0x3f21da[_0x19c2('0x30')]!==_0x19c2('0x41')){var _0x39accb={};_0x39accb[_0x3f21da[_0x19c2('0x29')]]={'$like':'%'+_0x58d51b[_0x19c2('0x33')]['filter']+'%'};return _0x39accb;}})});}_0x5f1f0f=_['merge']({},_0x5f1f0f,_0x58d51b[_0x19c2('0x42')]);var _0x55722a={'where':_0x5f1f0f['where']};return db['AnalyticTreeReport'][_0x19c2('0x1e')](_0x55722a)[_0x19c2('0x26')](function(_0x3622e2){_0x59790b['count']=_0x3622e2;if(_0x58d51b[_0x19c2('0x33')][_0x19c2('0x43')]){_0x5f1f0f['include']=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x19c2('0x44')](_0x5f1f0f);})[_0x19c2('0x26')](function(_0x4cba6a){_0x59790b[_0x19c2('0x45')]=_0x4cba6a;return _0x59790b;})[_0x19c2('0x26')](respondWithFilteredResult(_0x4cbc3c,_0x5f1f0f))['catch'](handleError(_0x4cbc3c,null));};exports['show']=function(_0x14a328,_0x2fcf6b){var _0x1ddcd7={'raw':!![],'where':{'id':_0x14a328[_0x19c2('0x46')]['id']}},_0x15bbb2={};_0x15bbb2[_0x19c2('0x32')]=_[_0x19c2('0x47')](db['AnalyticTreeReport']['rawAttributes']);_0x15bbb2['query']=_[_0x19c2('0x47')](_0x14a328[_0x19c2('0x33')]);_0x15bbb2[_0x19c2('0x34')]=_['intersection'](_0x15bbb2[_0x19c2('0x32')],_0x15bbb2['query']);_0x1ddcd7[_0x19c2('0x35')]=_['intersection'](_0x15bbb2[_0x19c2('0x32')],qs['fields'](_0x14a328[_0x19c2('0x33')]['fields']));_0x1ddcd7[_0x19c2('0x35')]=_0x1ddcd7[_0x19c2('0x35')][_0x19c2('0x38')]?_0x1ddcd7['attributes']:_0x15bbb2['model'];if(_0x14a328[_0x19c2('0x33')]['includeAll']){_0x1ddcd7[_0x19c2('0x48')]=[{'all':!![]}];}_0x1ddcd7=_[_0x19c2('0x40')]({},_0x1ddcd7,_0x14a328['options']);return db[_0x19c2('0x2d')]['find'](_0x1ddcd7)['then'](handleEntityNotFound(_0x2fcf6b,null))[_0x19c2('0x26')](respondWithResult(_0x2fcf6b,null))[_0x19c2('0x49')](handleError(_0x2fcf6b,null));};exports[_0x19c2('0x4a')]=function(_0x50d60a,_0x1e3f5a){return db[_0x19c2('0x2d')][_0x19c2('0x4a')](_0x50d60a[_0x19c2('0x4b')],{})[_0x19c2('0x26')](respondWithResult(_0x1e3f5a,0xc9))['catch'](handleError(_0x1e3f5a,null));};exports[_0x19c2('0x24')]=function(_0x2c82b4,_0x27ad7f){if(_0x2c82b4[_0x19c2('0x4b')]['id']){delete _0x2c82b4[_0x19c2('0x4b')]['id'];}return db['AnalyticTreeReport'][_0x19c2('0x4c')]({'where':{'id':_0x2c82b4[_0x19c2('0x46')]['id']}})[_0x19c2('0x26')](handleEntityNotFound(_0x27ad7f,null))['then'](saveUpdates(_0x2c82b4['body'],null))[_0x19c2('0x26')](respondWithResult(_0x27ad7f,null))[_0x19c2('0x49')](handleError(_0x27ad7f,null));};exports[_0x19c2('0x25')]=function(_0x2658e6,_0x403259){return db[_0x19c2('0x2d')][_0x19c2('0x4c')]({'where':{'id':_0x2658e6[_0x19c2('0x46')]['id']}})['then'](handleEntityNotFound(_0x403259,null))[_0x19c2('0x26')](removeEntity(_0x403259,null))['catch'](handleError(_0x403259,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index fbea1b3..90314b9 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 _0xe685=['exports','define','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes'];(function(_0x8d3032,_0x38cac2){var _0x237394=function(_0xc821b3){while(--_0xc821b3){_0x8d3032['push'](_0x8d3032['shift']());}};_0x237394(++_0x38cac2);}(_0xe685,0x1b2));var _0x5e68=function(_0x394ecd,_0x1f65dc){_0x394ecd=_0x394ecd-0x0;var _0x173e46=_0xe685[_0x394ecd];return _0x173e46;};'use strict';var _=require(_0x5e68('0x0'));var util=require(_0x5e68('0x1'));var logger=require(_0x5e68('0x2'))(_0x5e68('0x3'));var moment=require(_0x5e68('0x4'));var BPromise=require('bluebird');var rp=require(_0x5e68('0x5'));var fs=require('fs');var path=require(_0x5e68('0x6'));var rimraf=require(_0x5e68('0x7'));var config=require(_0x5e68('0x8'));var attributes=require(_0x5e68('0x9'));module[_0x5e68('0xa')]=function(_0xa5ff2,_0x5c68de){return _0xa5ff2[_0x5e68('0xb')]('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1eba=['request-promise','path','../../config/environment','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x598a3d,_0x3728b8){var _0x303e9e=function(_0x2fca75){while(--_0x2fca75){_0x598a3d['push'](_0x598a3d['shift']());}};_0x303e9e(++_0x3728b8);}(_0x1eba,0x132));var _0xa1eb=function(_0x460150,_0x232949){_0x460150=_0x460150-0x0;var _0x340677=_0x1eba[_0x460150];return _0x340677;};'use strict';var _=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var logger=require(_0xa1eb('0x2'))(_0xa1eb('0x3'));var moment=require(_0xa1eb('0x4'));var BPromise=require(_0xa1eb('0x5'));var rp=require(_0xa1eb('0x6'));var fs=require('fs');var path=require(_0xa1eb('0x7'));var rimraf=require('rimraf');var config=require(_0xa1eb('0x8'));var attributes=require('./analyticTreeReport.attributes');module[_0xa1eb('0x9')]=function(_0x5c912b,_0x14d519){return _0x5c912b[_0xa1eb('0xa')](_0xa1eb('0xb'),attributes,{'tableName':_0xa1eb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index da583b6..b690c8f 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0xdd188d,_0x3ee3d0){var _0x4081d8=function(_0x33ee77){while(--_0x33ee77){_0xdd188d['push'](_0xdd188d['shift']());}};_0x4081d8(++_0x3ee3d0);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x3cf964,_0x50417c){var _0x13581e=function(_0x36bf73){while(--_0x36bf73){_0x3cf964['push'](_0x3cf964['shift']());}};_0x13581e(++_0x50417c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1ab638,_0x43c800){_0x1ab638=_0x1ab638-0x0;var _0x169e3d=_0x5f2f[_0x1ab638];return _0x169e3d;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index b3e69fa..038efc1 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 _0xe20a=['update','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','index','/:id','isAuthenticated','show','post','put'];(function(_0x403007,_0xd4d4d8){var _0x5354a8=function(_0xf1a73e){while(--_0xf1a73e){_0x403007['push'](_0x403007['shift']());}};_0x5354a8(++_0xd4d4d8);}(_0xe20a,0x1ac));var _0xae20=function(_0x50247c,_0x1b2c43){_0x50247c=_0x50247c-0x0;var _0x17b2c5=_0xe20a[_0x50247c];return _0x17b2c5;};'use strict';var multer=require('multer');var util=require(_0xae20('0x0'));var path=require('path');var timeout=require(_0xae20('0x1'));var express=require('express');var router=express[_0xae20('0x2')]();var fs_extra=require(_0xae20('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xae20('0x4'));var config=require(_0xae20('0x5'));var controller=require(_0xae20('0x6'));router[_0xae20('0x7')]('/',auth['isAuthenticated'](),controller[_0xae20('0x8')]);router[_0xae20('0x7')](_0xae20('0x9'),auth[_0xae20('0xa')](),controller[_0xae20('0xb')]);router[_0xae20('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xae20('0xd')](_0xae20('0x9'),auth['isAuthenticated'](),controller[_0xae20('0xe')]);router['delete'](_0xae20('0x9'),auth[_0xae20('0xa')](),controller[_0xae20('0xf')]);module[_0xae20('0x10')]=router; \ No newline at end of file +var _0xda89=['/:id','show','create','update','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xda89,0x19e));var _0x9da8=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xda89[_0x36ed48];return _0x51c63a;};'use strict';var multer=require(_0x9da8('0x0'));var util=require(_0x9da8('0x1'));var path=require('path');var timeout=require(_0x9da8('0x2'));var express=require(_0x9da8('0x3'));var router=express['Router']();var fs_extra=require(_0x9da8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9da8('0x5'));var config=require(_0x9da8('0x6'));var controller=require(_0x9da8('0x7'));router[_0x9da8('0x8')]('/',auth[_0x9da8('0x9')](),controller[_0x9da8('0xa')]);router[_0x9da8('0x8')](_0x9da8('0xb'),auth['isAuthenticated'](),controller[_0x9da8('0xc')]);router['post']('/',auth[_0x9da8('0x9')](),controller[_0x9da8('0xd')]);router['put'](_0x9da8('0xb'),auth[_0x9da8('0x9')](),controller[_0x9da8('0xe')]);router[_0x9da8('0xf')]('/:id',auth[_0x9da8('0x9')](),controller['destroy']);module[_0x9da8('0x10')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index c6d62df..30f6d73 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 _0x8a9c=['STRING','sequelize','exports'];(function(_0x39cbb4,_0x3bb936){var _0x2cdd2f=function(_0x5bca4a){while(--_0x5bca4a){_0x39cbb4['push'](_0x39cbb4['shift']());}};_0x2cdd2f(++_0x3bb936);}(_0x8a9c,0x12d));var _0xc8a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a9c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc8a9('0x0'));module[_0xc8a9('0x1')]={'name':{'type':Sequelize[_0xc8a9('0x2')]},'basename':{'type':Sequelize[_0xc8a9('0x2')]},'type':{'type':Sequelize[_0xc8a9('0x2')]}}; \ No newline at end of file +var _0xdfcc=['sequelize','exports','STRING'];(function(_0x53f6d4,_0xa61cc2){var _0x5d9a2d=function(_0x6fc0fa){while(--_0x6fc0fa){_0x53f6d4['push'](_0x53f6d4['shift']());}};_0x5d9a2d(++_0xa61cc2);}(_0xdfcc,0x8d));var _0xcdfc=function(_0x34bc6c,_0x10d089){_0x34bc6c=_0x34bc6c-0x0;var _0x168820=_0xdfcc[_0x34bc6c];return _0x168820;};'use strict';var Sequelize=require(_0xcdfc('0x0'));module[_0xcdfc('0x1')]={'name':{'type':Sequelize[_0xcdfc('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xcdfc('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 18daba2..69818f4 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 _0xa0e3=['../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','update','then','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','length','clone','params','find','get','createdAt','updatedAt','body','omit','create','file','originalname','basename','filename','download','ChatOfflineMessageId','join','root','offline-chat/','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs'];(function(_0x9391df,_0x2bebda){var _0x59255b=function(_0x1db709){while(--_0x1db709){_0x9391df['push'](_0x9391df['shift']());}};_0x59255b(++_0x2bebda);}(_0xa0e3,0xe7));var _0x3a0e=function(_0x17ba23,_0x1f321c){_0x17ba23=_0x17ba23-0x0;var _0x204fce=_0xa0e3[_0x17ba23];return _0x204fce;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3a0e('0x0'));var rp=require(_0x3a0e('0x1'));var moment=require(_0x3a0e('0x2'));var BPromise=require(_0x3a0e('0x3'));var Mustache=require('mustache');var util=require(_0x3a0e('0x4'));var path=require(_0x3a0e('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3a0e('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3a0e('0x7'));var squel=require(_0x3a0e('0x8'));var crypto=require(_0x3a0e('0x9'));var jsforce=require(_0x3a0e('0xa'));var deskjs=require(_0x3a0e('0xb'));var toCsv=require(_0x3a0e('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3a0e('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x3a0e('0xe'));var as=require(_0x3a0e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3a0e('0x10'));var utils=require(_0x3a0e('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x3a0e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47560e,_0x7d941e){_0x7d941e=_0x7d941e||0xcc;return function(_0x167a38){if(_0x167a38){return _0x47560e[_0x3a0e('0x13')](_0x7d941e);}return _0x47560e[_0x3a0e('0x14')](_0x7d941e)[_0x3a0e('0x15')]();};}function respondWithResult(_0x46d1e2,_0x139b6e){_0x139b6e=_0x139b6e||0xc8;return function(_0x5c064b){if(_0x5c064b){return _0x46d1e2['status'](_0x139b6e)[_0x3a0e('0x16')](_0x5c064b);}};}function respondWithFilteredResult(_0x24c3a2,_0x5b7ef8){return function(_0x5abd8e){if(_0x5abd8e){var _0x5e28e3=typeof _0x5b7ef8[_0x3a0e('0x17')]===_0x3a0e('0x18')&&typeof _0x5b7ef8['limit']===_0x3a0e('0x18');var _0x10de8c=_0x5abd8e['count'];var _0xb3cfa8=_0x5e28e3?0x0:_0x5b7ef8['offset'];var _0x35164f=_0x5e28e3?_0x5abd8e[_0x3a0e('0x19')]:_0x5b7ef8[_0x3a0e('0x17')]+_0x5b7ef8[_0x3a0e('0x1a')];var _0x3c931d;if(_0x35164f>=_0x10de8c){_0x35164f=_0x10de8c;_0x3c931d=0xc8;}else{_0x3c931d=0xce;}_0x24c3a2[_0x3a0e('0x14')](_0x3c931d);return _0x24c3a2[_0x3a0e('0x1b')]('Content-Range',_0xb3cfa8+'-'+_0x35164f+'/'+_0x10de8c)[_0x3a0e('0x16')](_0x5abd8e);}return null;};}function patchUpdates(_0x589286){return function(_0x2b3842){try{jsonpatch['apply'](_0x2b3842,_0x589286,!![]);}catch(_0x3e8c02){return BPromise[_0x3a0e('0x1c')](_0x3e8c02);}return _0x2b3842['save']();};}function saveUpdates(_0xe8f158,_0x5c38a6){return function(_0x4a736e){if(_0x4a736e){return _0x4a736e[_0x3a0e('0x1d')](_0xe8f158)[_0x3a0e('0x1e')](function(_0xca718){return _0xca718;});}return null;};}function removeEntity(_0x1395d6,_0xb70032){return function(_0x326c77){if(_0x326c77){return _0x326c77['destroy']()[_0x3a0e('0x1e')](function(){_0x1395d6[_0x3a0e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2696d4,_0x320827){return function(_0x3962cd){if(!_0x3962cd){_0x2696d4[_0x3a0e('0x13')](0x194);}return _0x3962cd;};}function handleError(_0x49cfa1,_0x45830a){_0x45830a=_0x45830a||0x1f4;return function(_0x3b7ed6){logger[_0x3a0e('0x1f')](_0x3b7ed6[_0x3a0e('0x20')]);if(_0x3b7ed6[_0x3a0e('0x21')]){delete _0x3b7ed6[_0x3a0e('0x21')];}_0x49cfa1['status'](_0x45830a)[_0x3a0e('0x22')](_0x3b7ed6);};}exports[_0x3a0e('0x23')]=function(_0x23000e,_0x1eefb8){var _0x519c41={},_0x115bd9={},_0x5d532c={'count':0x0,'rows':[]};var _0x3b6aea=_[_0x3a0e('0x24')](db[_0x3a0e('0x25')][_0x3a0e('0x26')],function(_0x1b452e){return{'name':_0x1b452e[_0x3a0e('0x27')],'type':_0x1b452e[_0x3a0e('0x28')][_0x3a0e('0x29')]};});_0x115bd9[_0x3a0e('0x2a')]=_['map'](_0x3b6aea,_0x3a0e('0x21'));_0x115bd9[_0x3a0e('0x2b')]=_[_0x3a0e('0x2c')](_0x23000e[_0x3a0e('0x2b')]);_0x115bd9[_0x3a0e('0x2d')]=_[_0x3a0e('0x2e')](_0x115bd9[_0x3a0e('0x2a')],_0x115bd9[_0x3a0e('0x2b')]);_0x519c41['attributes']=_[_0x3a0e('0x2e')](_0x115bd9[_0x3a0e('0x2a')],qs[_0x3a0e('0x2f')](_0x23000e[_0x3a0e('0x2b')][_0x3a0e('0x2f')]));_0x519c41[_0x3a0e('0x30')]=_0x519c41[_0x3a0e('0x30')]['length']?_0x519c41[_0x3a0e('0x30')]:_0x115bd9['model'];if(!_0x23000e[_0x3a0e('0x2b')][_0x3a0e('0x31')](_0x3a0e('0x32'))){_0x519c41[_0x3a0e('0x1a')]=qs['limit'](_0x23000e[_0x3a0e('0x2b')][_0x3a0e('0x1a')]);_0x519c41[_0x3a0e('0x17')]=qs[_0x3a0e('0x17')](_0x23000e['query'][_0x3a0e('0x17')]);}_0x519c41['order']=qs[_0x3a0e('0x33')](_0x23000e[_0x3a0e('0x2b')]['sort']);_0x519c41['where']=qs[_0x3a0e('0x2d')](_['pick'](_0x23000e[_0x3a0e('0x2b')],_0x115bd9[_0x3a0e('0x2d')]),_0x3b6aea);if(_0x23000e['query']['filter']){_0x519c41[_0x3a0e('0x34')]=_[_0x3a0e('0x35')](_0x519c41[_0x3a0e('0x34')],{'$or':_[_0x3a0e('0x24')](_0x3b6aea,function(_0x580a42){if(_0x580a42['type']!==_0x3a0e('0x36')){var _0x2d2396={};_0x2d2396[_0x580a42[_0x3a0e('0x21')]]={'$like':'%'+_0x23000e[_0x3a0e('0x2b')][_0x3a0e('0x37')]+'%'};return _0x2d2396;}})});}_0x519c41=_['merge']({},_0x519c41,_0x23000e[_0x3a0e('0x38')]);var _0x28d6ef={'where':_0x519c41[_0x3a0e('0x34')]};return db[_0x3a0e('0x25')][_0x3a0e('0x19')](_0x28d6ef)['then'](function(_0x3929ad){_0x5d532c[_0x3a0e('0x19')]=_0x3929ad;if(_0x23000e[_0x3a0e('0x2b')][_0x3a0e('0x39')]){_0x519c41[_0x3a0e('0x3a')]=[{'all':!![]}];}return db[_0x3a0e('0x25')][_0x3a0e('0x3b')](_0x519c41);})[_0x3a0e('0x1e')](function(_0x277316){_0x5d532c[_0x3a0e('0x3c')]=_0x277316;return _0x5d532c;})[_0x3a0e('0x1e')](respondWithFilteredResult(_0x1eefb8,_0x519c41))[_0x3a0e('0x3d')](handleError(_0x1eefb8,null));};exports[_0x3a0e('0x3e')]=function(_0x3690f8,_0x3c1b7c){var _0x353016={'raw':!![],'where':{'id':_0x3690f8['params']['id']}},_0x32f3b8={};_0x32f3b8[_0x3a0e('0x2a')]=_['keys'](db['Attachment'][_0x3a0e('0x26')]);_0x32f3b8['query']=_[_0x3a0e('0x2c')](_0x3690f8['query']);_0x32f3b8[_0x3a0e('0x2d')]=_[_0x3a0e('0x2e')](_0x32f3b8[_0x3a0e('0x2a')],_0x32f3b8[_0x3a0e('0x2b')]);_0x353016[_0x3a0e('0x30')]=_['intersection'](_0x32f3b8[_0x3a0e('0x2a')],qs['fields'](_0x3690f8['query']['fields']));_0x353016['attributes']=_0x353016[_0x3a0e('0x30')][_0x3a0e('0x3f')]?_0x353016[_0x3a0e('0x30')]:_0x32f3b8['model'];if(_0x3690f8['query'][_0x3a0e('0x39')]){_0x353016['include']=[{'all':!![]}];}_0x353016=_['merge']({},_0x353016,_0x3690f8[_0x3a0e('0x38')]);return db[_0x3a0e('0x25')]['find'](_0x353016)[_0x3a0e('0x1e')](handleEntityNotFound(_0x3c1b7c,null))[_0x3a0e('0x1e')](respondWithResult(_0x3c1b7c,null))['catch'](handleError(_0x3c1b7c,null));};exports[_0x3a0e('0x40')]=function(_0x24c60c,_0x38da68){var _0x55c2ea={'where':{'id':_0x24c60c[_0x3a0e('0x41')]['id']}},_0x58e27f={};_0x58e27f[_0x3a0e('0x2a')]=_['keys'](db[_0x3a0e('0x25')][_0x3a0e('0x26')]);_0x55c2ea[_0x3a0e('0x30')]=_[_0x3a0e('0x2e')](_0x58e27f[_0x3a0e('0x2a')],qs['fields'](_0x24c60c[_0x3a0e('0x2b')][_0x3a0e('0x2f')]));_0x55c2ea[_0x3a0e('0x30')]=_0x55c2ea[_0x3a0e('0x30')][_0x3a0e('0x3f')]?_0x55c2ea[_0x3a0e('0x30')]:_0x58e27f[_0x3a0e('0x2a')];if(_0x24c60c['query']['includeAll']){_0x55c2ea['include']=[{'all':!![]}];}_0x55c2ea=_[_0x3a0e('0x35')]({},_0x55c2ea,_0x24c60c[_0x3a0e('0x38')]);return db[_0x3a0e('0x25')][_0x3a0e('0x42')](_0x55c2ea)[_0x3a0e('0x1e')](handleEntityNotFound(_0x38da68,null))[_0x3a0e('0x1e')](function(_0x5a38e0){if(_0x5a38e0){var _0x1fd5f7=_0x5a38e0[_0x3a0e('0x43')]({'plain':!![]});_0x1fd5f7=qs['omit'](_0x1fd5f7,['id',_0x3a0e('0x44'),_0x3a0e('0x45')]);_0x24c60c[_0x3a0e('0x46')]=_[_0x3a0e('0x47')](_0x24c60c['body'],['id','createdAt','updatedAt']);return db[_0x3a0e('0x25')][_0x3a0e('0x48')](_[_0x3a0e('0x35')](_0x1fd5f7,_0x24c60c['body']),{'include':_0x24c60c[_0x3a0e('0x2b')][_0x3a0e('0x39')]?[{'all':!![]}]:undefined});}})[_0x3a0e('0x1e')](respondWithResult(_0x38da68,0xc9))[_0x3a0e('0x3d')](handleError(_0x38da68,null));};exports[_0x3a0e('0x1d')]=function(_0x32d65d,_0x49f35f){if(_0x32d65d['body']['id']){delete _0x32d65d['body']['id'];}return db[_0x3a0e('0x25')][_0x3a0e('0x42')]({'where':{'id':_0x32d65d['params']['id']}})[_0x3a0e('0x1e')](handleEntityNotFound(_0x49f35f,null))['then'](saveUpdates(_0x32d65d['body'],null))[_0x3a0e('0x1e')](respondWithResult(_0x49f35f,null))[_0x3a0e('0x3d')](handleError(_0x49f35f,null));};exports['destroy']=function(_0x4d68cd,_0x5e16cc){return db[_0x3a0e('0x25')][_0x3a0e('0x42')]({'where':{'id':_0x4d68cd[_0x3a0e('0x41')]['id']}})[_0x3a0e('0x1e')](handleEntityNotFound(_0x5e16cc,null))[_0x3a0e('0x1e')](removeEntity(_0x5e16cc,null))['catch'](handleError(_0x5e16cc,null));};exports[_0x3a0e('0x48')]=function(_0x2ec262,_0x2427ba,_0x36cf49){_0x2ec262[_0x3a0e('0x46')][_0x3a0e('0x21')]=_0x2ec262[_0x3a0e('0x49')][_0x3a0e('0x4a')];_0x2ec262[_0x3a0e('0x46')][_0x3a0e('0x4b')]=_0x2ec262[_0x3a0e('0x49')][_0x3a0e('0x4c')];_0x2ec262[_0x3a0e('0x46')][_0x3a0e('0x28')]=_0x2ec262[_0x3a0e('0x49')]['mimetype'];return db[_0x3a0e('0x25')][_0x3a0e('0x48')](_0x2ec262['body'])[_0x3a0e('0x1e')](respondWithResult(_0x2427ba,0xc9))['catch'](handleError(_0x2427ba,null));};exports[_0x3a0e('0x4d')]=function(_0x48153a,_0x5ea421,_0x5993c2){return db[_0x3a0e('0x25')]['findOne']({'where':{'id':_0x48153a[_0x3a0e('0x41')]['id']},'raw':!![]})[_0x3a0e('0x1e')](handleEntityNotFound(_0x5ea421,null))[_0x3a0e('0x1e')](function(_0x4c2c2c){if(_0x4c2c2c){var _0x3a76d1=_0x4c2c2c[_0x3a0e('0x4e')]!==null;var _0xeac9b6=path[_0x3a0e('0x4f')](config[_0x3a0e('0x50')],'server/files/attachments/');if(_0x3a76d1){_0xeac9b6=path[_0x3a0e('0x4f')](_0xeac9b6,_0x3a0e('0x51'));}var _0x3eed3c=path[_0x3a0e('0x4f')](_0xeac9b6,_0x4c2c2c['basename']);return _0x5ea421[_0x3a0e('0x4d')](_0x3eed3c);}})[_0x3a0e('0x3d')](handleError(_0x5ea421,null));}; \ No newline at end of file +var _0x60be=['get','omit','createdAt','updatedAt','body','update','create','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','params','keys','include','options','find'];(function(_0x366fb4,_0x397abd){var _0x352234=function(_0x21f574){while(--_0x21f574){_0x366fb4['push'](_0x366fb4['shift']());}};_0x352234(++_0x397abd);}(_0x60be,0x1d0));var _0xe60b=function(_0x3005a6,_0x320826){_0x3005a6=_0x3005a6-0x0;var _0x2f7399=_0x60be[_0x3005a6];return _0x2f7399;};'use strict';var emlformat=require(_0xe60b('0x0'));var rimraf=require(_0xe60b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe60b('0x2'));var rp=require(_0xe60b('0x3'));var moment=require(_0xe60b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe60b('0x5'));var util=require(_0xe60b('0x6'));var path=require(_0xe60b('0x7'));var sox=require(_0xe60b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe60b('0x9'));var _=require(_0xe60b('0xa'));var squel=require('squel');var crypto=require(_0xe60b('0xb'));var jsforce=require(_0xe60b('0xc'));var deskjs=require(_0xe60b('0xd'));var toCsv=require(_0xe60b('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe60b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe60b('0x10'));var hardwareService=require(_0xe60b('0x11'));var logger=require(_0xe60b('0x12'))('api');var utils=require(_0xe60b('0x13'));var config=require(_0xe60b('0x14'));var licenseUtil=require(_0xe60b('0x15'));var db=require(_0xe60b('0x16'))['db'];function respondWithStatusCode(_0x452782,_0xc33cd3){_0xc33cd3=_0xc33cd3||0xcc;return function(_0x4b8fa3){if(_0x4b8fa3){return _0x452782[_0xe60b('0x17')](_0xc33cd3);}return _0x452782[_0xe60b('0x18')](_0xc33cd3)[_0xe60b('0x19')]();};}function respondWithResult(_0x5adbdd,_0x3efe6b){_0x3efe6b=_0x3efe6b||0xc8;return function(_0x5ccf7a){if(_0x5ccf7a){return _0x5adbdd[_0xe60b('0x18')](_0x3efe6b)[_0xe60b('0x1a')](_0x5ccf7a);}};}function respondWithFilteredResult(_0x4af477,_0x347874){return function(_0x291e4c){if(_0x291e4c){var _0x3eb74e=typeof _0x347874[_0xe60b('0x1b')]==='undefined'&&typeof _0x347874[_0xe60b('0x1c')]===_0xe60b('0x1d');var _0x5e8eb5=_0x291e4c[_0xe60b('0x1e')];var _0x1c9481=_0x3eb74e?0x0:_0x347874[_0xe60b('0x1b')];var _0x51f709=_0x3eb74e?_0x291e4c['count']:_0x347874['offset']+_0x347874[_0xe60b('0x1c')];var _0x5566e4;if(_0x51f709>=_0x5e8eb5){_0x51f709=_0x5e8eb5;_0x5566e4=0xc8;}else{_0x5566e4=0xce;}_0x4af477['status'](_0x5566e4);return _0x4af477[_0xe60b('0x1f')](_0xe60b('0x20'),_0x1c9481+'-'+_0x51f709+'/'+_0x5e8eb5)[_0xe60b('0x1a')](_0x291e4c);}return null;};}function patchUpdates(_0x56558d){return function(_0x21cc96){try{jsonpatch['apply'](_0x21cc96,_0x56558d,!![]);}catch(_0x19f784){return BPromise[_0xe60b('0x21')](_0x19f784);}return _0x21cc96[_0xe60b('0x22')]();};}function saveUpdates(_0xb2c8d9,_0x1955d5){return function(_0x4c75e7){if(_0x4c75e7){return _0x4c75e7['update'](_0xb2c8d9)[_0xe60b('0x23')](function(_0x2a0a9f){return _0x2a0a9f;});}return null;};}function removeEntity(_0x2562d1,_0x512401){return function(_0x408ba9){if(_0x408ba9){return _0x408ba9['destroy']()[_0xe60b('0x23')](function(){_0x2562d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa15c8a,_0x44f332){return function(_0x1519ce){if(!_0x1519ce){_0xa15c8a[_0xe60b('0x17')](0x194);}return _0x1519ce;};}function handleError(_0x27cebb,_0x1715b6){_0x1715b6=_0x1715b6||0x1f4;return function(_0x18426f){logger[_0xe60b('0x24')](_0x18426f[_0xe60b('0x25')]);if(_0x18426f[_0xe60b('0x26')]){delete _0x18426f[_0xe60b('0x26')];}_0x27cebb[_0xe60b('0x18')](_0x1715b6)[_0xe60b('0x27')](_0x18426f);};}exports[_0xe60b('0x28')]=function(_0x298e99,_0xf13d92){var _0xa6c9e7={},_0x3789dd={},_0x551922={'count':0x0,'rows':[]};var _0x287204=_[_0xe60b('0x29')](db[_0xe60b('0x2a')][_0xe60b('0x2b')],function(_0x37f439){return{'name':_0x37f439[_0xe60b('0x2c')],'type':_0x37f439[_0xe60b('0x2d')][_0xe60b('0x2e')]};});_0x3789dd[_0xe60b('0x2f')]=_[_0xe60b('0x29')](_0x287204,_0xe60b('0x26'));_0x3789dd[_0xe60b('0x30')]=_['keys'](_0x298e99[_0xe60b('0x30')]);_0x3789dd[_0xe60b('0x31')]=_[_0xe60b('0x32')](_0x3789dd[_0xe60b('0x2f')],_0x3789dd[_0xe60b('0x30')]);_0xa6c9e7['attributes']=_[_0xe60b('0x32')](_0x3789dd['model'],qs[_0xe60b('0x33')](_0x298e99[_0xe60b('0x30')][_0xe60b('0x33')]));_0xa6c9e7[_0xe60b('0x34')]=_0xa6c9e7[_0xe60b('0x34')][_0xe60b('0x35')]?_0xa6c9e7['attributes']:_0x3789dd[_0xe60b('0x2f')];if(!_0x298e99[_0xe60b('0x30')][_0xe60b('0x36')](_0xe60b('0x37'))){_0xa6c9e7[_0xe60b('0x1c')]=qs[_0xe60b('0x1c')](_0x298e99[_0xe60b('0x30')]['limit']);_0xa6c9e7[_0xe60b('0x1b')]=qs[_0xe60b('0x1b')](_0x298e99[_0xe60b('0x30')][_0xe60b('0x1b')]);}_0xa6c9e7[_0xe60b('0x38')]=qs['sort'](_0x298e99[_0xe60b('0x30')]['sort']);_0xa6c9e7[_0xe60b('0x39')]=qs['filters'](_[_0xe60b('0x3a')](_0x298e99[_0xe60b('0x30')],_0x3789dd[_0xe60b('0x31')]),_0x287204);if(_0x298e99[_0xe60b('0x30')][_0xe60b('0x3b')]){_0xa6c9e7['where']=_[_0xe60b('0x3c')](_0xa6c9e7[_0xe60b('0x39')],{'$or':_[_0xe60b('0x29')](_0x287204,function(_0x1d9daa){if(_0x1d9daa[_0xe60b('0x2d')]!==_0xe60b('0x3d')){var _0x523e5a={};_0x523e5a[_0x1d9daa['name']]={'$like':'%'+_0x298e99[_0xe60b('0x30')][_0xe60b('0x3b')]+'%'};return _0x523e5a;}})});}_0xa6c9e7=_[_0xe60b('0x3c')]({},_0xa6c9e7,_0x298e99['options']);var _0x8da81c={'where':_0xa6c9e7[_0xe60b('0x39')]};return db['Attachment']['count'](_0x8da81c)[_0xe60b('0x23')](function(_0x565d09){_0x551922[_0xe60b('0x1e')]=_0x565d09;if(_0x298e99['query'][_0xe60b('0x3e')]){_0xa6c9e7['include']=[{'all':!![]}];}return db['Attachment']['findAll'](_0xa6c9e7);})[_0xe60b('0x23')](function(_0x7b88a9){_0x551922[_0xe60b('0x3f')]=_0x7b88a9;return _0x551922;})[_0xe60b('0x23')](respondWithFilteredResult(_0xf13d92,_0xa6c9e7))[_0xe60b('0x40')](handleError(_0xf13d92,null));};exports['show']=function(_0x411de8,_0x399886){var _0x4829c8={'raw':!![],'where':{'id':_0x411de8[_0xe60b('0x41')]['id']}},_0x1881b5={};_0x1881b5[_0xe60b('0x2f')]=_[_0xe60b('0x42')](db[_0xe60b('0x2a')][_0xe60b('0x2b')]);_0x1881b5[_0xe60b('0x30')]=_['keys'](_0x411de8[_0xe60b('0x30')]);_0x1881b5['filters']=_[_0xe60b('0x32')](_0x1881b5[_0xe60b('0x2f')],_0x1881b5[_0xe60b('0x30')]);_0x4829c8['attributes']=_[_0xe60b('0x32')](_0x1881b5['model'],qs[_0xe60b('0x33')](_0x411de8[_0xe60b('0x30')][_0xe60b('0x33')]));_0x4829c8['attributes']=_0x4829c8[_0xe60b('0x34')]['length']?_0x4829c8[_0xe60b('0x34')]:_0x1881b5[_0xe60b('0x2f')];if(_0x411de8[_0xe60b('0x30')][_0xe60b('0x3e')]){_0x4829c8[_0xe60b('0x43')]=[{'all':!![]}];}_0x4829c8=_['merge']({},_0x4829c8,_0x411de8[_0xe60b('0x44')]);return db[_0xe60b('0x2a')][_0xe60b('0x45')](_0x4829c8)[_0xe60b('0x23')](handleEntityNotFound(_0x399886,null))[_0xe60b('0x23')](respondWithResult(_0x399886,null))['catch'](handleError(_0x399886,null));};exports['clone']=function(_0x110ec3,_0x2ae69f){var _0x1c1968={'where':{'id':_0x110ec3[_0xe60b('0x41')]['id']}},_0x5ecc76={};_0x5ecc76[_0xe60b('0x2f')]=_['keys'](db[_0xe60b('0x2a')][_0xe60b('0x2b')]);_0x1c1968['attributes']=_[_0xe60b('0x32')](_0x5ecc76[_0xe60b('0x2f')],qs['fields'](_0x110ec3['query'][_0xe60b('0x33')]));_0x1c1968[_0xe60b('0x34')]=_0x1c1968['attributes'][_0xe60b('0x35')]?_0x1c1968[_0xe60b('0x34')]:_0x5ecc76[_0xe60b('0x2f')];if(_0x110ec3[_0xe60b('0x30')]['includeAll']){_0x1c1968[_0xe60b('0x43')]=[{'all':!![]}];}_0x1c1968=_[_0xe60b('0x3c')]({},_0x1c1968,_0x110ec3[_0xe60b('0x44')]);return db[_0xe60b('0x2a')][_0xe60b('0x45')](_0x1c1968)['then'](handleEntityNotFound(_0x2ae69f,null))[_0xe60b('0x23')](function(_0x3c2253){if(_0x3c2253){var _0x31f5f6=_0x3c2253[_0xe60b('0x46')]({'plain':!![]});_0x31f5f6=qs[_0xe60b('0x47')](_0x31f5f6,['id',_0xe60b('0x48'),_0xe60b('0x49')]);_0x110ec3[_0xe60b('0x4a')]=_[_0xe60b('0x47')](_0x110ec3[_0xe60b('0x4a')],['id',_0xe60b('0x48'),_0xe60b('0x49')]);return db[_0xe60b('0x2a')]['create'](_[_0xe60b('0x3c')](_0x31f5f6,_0x110ec3[_0xe60b('0x4a')]),{'include':_0x110ec3[_0xe60b('0x30')][_0xe60b('0x3e')]?[{'all':!![]}]:undefined});}})[_0xe60b('0x23')](respondWithResult(_0x2ae69f,0xc9))[_0xe60b('0x40')](handleError(_0x2ae69f,null));};exports[_0xe60b('0x4b')]=function(_0x59e4fd,_0x44e324){if(_0x59e4fd[_0xe60b('0x4a')]['id']){delete _0x59e4fd[_0xe60b('0x4a')]['id'];}return db[_0xe60b('0x2a')][_0xe60b('0x45')]({'where':{'id':_0x59e4fd[_0xe60b('0x41')]['id']}})[_0xe60b('0x23')](handleEntityNotFound(_0x44e324,null))[_0xe60b('0x23')](saveUpdates(_0x59e4fd['body'],null))[_0xe60b('0x23')](respondWithResult(_0x44e324,null))[_0xe60b('0x40')](handleError(_0x44e324,null));};exports['destroy']=function(_0x46f330,_0x3f9a2b){return db['Attachment'][_0xe60b('0x45')]({'where':{'id':_0x46f330[_0xe60b('0x41')]['id']}})['then'](handleEntityNotFound(_0x3f9a2b,null))['then'](removeEntity(_0x3f9a2b,null))[_0xe60b('0x40')](handleError(_0x3f9a2b,null));};exports[_0xe60b('0x4c')]=function(_0x4f2ad5,_0x50017e,_0x17383e){_0x4f2ad5[_0xe60b('0x4a')][_0xe60b('0x26')]=_0x4f2ad5[_0xe60b('0x4d')][_0xe60b('0x4e')];_0x4f2ad5['body'][_0xe60b('0x4f')]=_0x4f2ad5[_0xe60b('0x4d')][_0xe60b('0x50')];_0x4f2ad5['body'][_0xe60b('0x2d')]=_0x4f2ad5[_0xe60b('0x4d')][_0xe60b('0x51')];return db[_0xe60b('0x2a')][_0xe60b('0x4c')](_0x4f2ad5['body'])[_0xe60b('0x23')](respondWithResult(_0x50017e,0xc9))[_0xe60b('0x40')](handleError(_0x50017e,null));};exports[_0xe60b('0x52')]=function(_0x3490bd,_0x148c9a,_0x42ef5c){return db[_0xe60b('0x2a')][_0xe60b('0x53')]({'where':{'id':_0x3490bd[_0xe60b('0x41')]['id']},'raw':!![]})[_0xe60b('0x23')](handleEntityNotFound(_0x148c9a,null))['then'](function(_0x299a14){if(_0x299a14){var _0x159c00=_0x299a14[_0xe60b('0x54')]!==null;var _0x336611=path[_0xe60b('0x55')](config[_0xe60b('0x56')],_0xe60b('0x57'));if(_0x159c00){_0x336611=path[_0xe60b('0x55')](_0x336611,_0xe60b('0x58'));}var _0x541caa=path[_0xe60b('0x55')](_0x336611,_0x299a14['basename']);return _0x148c9a[_0xe60b('0x52')](_0x541caa);}})[_0xe60b('0x40')](handleError(_0x148c9a,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index a93e3ff..14489b6 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 _0xc3d0=['rimraf','../../config/environment','define','Attachment','attachments','lodash','util','api','moment','bluebird','request-promise'];(function(_0x45f8ce,_0x1631e3){var _0x47019a=function(_0x1a05c0){while(--_0x1a05c0){_0x45f8ce['push'](_0x45f8ce['shift']());}};_0x47019a(++_0x1631e3);}(_0xc3d0,0x123));var _0x0c3d=function(_0x557c9e,_0x3f5795){_0x557c9e=_0x557c9e-0x0;var _0xcb704=_0xc3d0[_0x557c9e];return _0xcb704;};'use strict';var _=require(_0x0c3d('0x0'));var util=require(_0x0c3d('0x1'));var logger=require('../../config/logger')(_0x0c3d('0x2'));var moment=require(_0x0c3d('0x3'));var BPromise=require(_0x0c3d('0x4'));var rp=require(_0x0c3d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0c3d('0x6'));var config=require(_0x0c3d('0x7'));var attributes=require('./attachment.attributes');module['exports']=function(_0x2c6981,_0x1743a9){return _0x2c6981[_0x0c3d('0x8')](_0x0c3d('0x9'),attributes,{'tableName':_0x0c3d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc23=['util','moment','bluebird','rimraf','../../config/environment','exports','define','attachments','lodash'];(function(_0x496ca0,_0x5c8eb1){var _0x109004=function(_0x157eab){while(--_0x157eab){_0x496ca0['push'](_0x496ca0['shift']());}};_0x109004(++_0x5c8eb1);}(_0xcc23,0x167));var _0x3cc2=function(_0x1780f8,_0x11ba93){_0x1780f8=_0x1780f8-0x0;var _0x33a410=_0xcc23[_0x1780f8];return _0x33a410;};'use strict';var _=require(_0x3cc2('0x0'));var util=require(_0x3cc2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3cc2('0x2'));var BPromise=require(_0x3cc2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3cc2('0x4'));var config=require(_0x3cc2('0x5'));var attributes=require('./attachment.attributes');module[_0x3cc2('0x6')]=function(_0x35653b,_0x21b593){return _0x35653b[_0x3cc2('0x7')]('Attachment',attributes,{'tableName':_0x3cc2('0x8'),'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 56eb13a..2d9c537 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 _0x1be1=['Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateAttachment','body','options','raw','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Attachment,\x20%s,\x20%s','debug'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0x1be1,0x192));var _0x11be=function(_0x204c47,_0x211675){_0x204c47=_0x204c47-0x0;var _0x5e5e92=_0x1be1[_0x204c47];return _0x5e5e92;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x11be('0x0'));var BPromise=require(_0x11be('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11be('0x2'));var db=require(_0x11be('0x3'))['db'];var utils=require(_0x11be('0x4'));var logger=require(_0x11be('0x5'))('rpc');var config=require(_0x11be('0x6'));var jayson=require(_0x11be('0x7'));var client=jayson[_0x11be('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfe8c62,_0x497730,_0x18f661){return new BPromise(function(_0x11fc15,_0x246772){return client[_0x11be('0x9')](_0xfe8c62,_0x18f661)[_0x11be('0xa')](function(_0x5f3d04){logger[_0x11be('0xb')](_0x11be('0xc'),_0x497730,'request\x20sent');logger[_0x11be('0xd')](_0x11be('0xe'),_0x497730,_0x11be('0xf'),JSON[_0x11be('0x10')](_0x5f3d04));if(_0x5f3d04['error']){if(_0x5f3d04[_0x11be('0x11')][_0x11be('0x12')]===0x1f4){logger[_0x11be('0x11')]('Attachment,\x20%s,\x20%s',_0x497730,_0x5f3d04[_0x11be('0x11')][_0x11be('0x13')]);return _0x246772(_0x5f3d04['error'][_0x11be('0x13')]);}logger['error']('Attachment,\x20%s,\x20%s',_0x497730,_0x5f3d04['error']['message']);return _0x11fc15(_0x5f3d04['error']['message']);}else{logger['info'](_0x11be('0xc'),_0x497730,'request\x20sent');_0x11fc15(_0x5f3d04[_0x11be('0x14')][_0x11be('0x13')]);}})[_0x11be('0x15')](function(_0x216b8c){logger['error'](_0x11be('0xc'),_0x497730,_0x216b8c);_0x246772(_0x216b8c);});});}exports[_0x11be('0x16')]=function(_0x56ab61){var _0x299f45=this;return new Promise(function(_0xc3263c,_0x23aa5f){return db['Attachment']['create'](_0x56ab61[_0x11be('0x17')],{'raw':_0x56ab61[_0x11be('0x18')]?_0x56ab61[_0x11be('0x18')][_0x11be('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x12a5bd){logger[_0x11be('0xb')](_0x11be('0x16'),_0x56ab61);logger[_0x11be('0xd')](_0x11be('0x16'),_0x56ab61,JSON[_0x11be('0x10')](_0x12a5bd));_0xc3263c(_0x12a5bd);})[_0x11be('0x15')](function(_0x17678d){logger[_0x11be('0x11')](_0x11be('0x16'),_0x17678d['message'],_0x56ab61);_0x23aa5f(_0x299f45[_0x11be('0x11')](0x1f4,_0x17678d[_0x11be('0x13')]));});});}; \ No newline at end of file +var _0x3ee5=['body','options','raw','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateAttachment','Attachment','create'];(function(_0x179c7b,_0x12bd08){var _0x5b9496=function(_0x37d098){while(--_0x37d098){_0x179c7b['push'](_0x179c7b['shift']());}};_0x5b9496(++_0x12bd08);}(_0x3ee5,0x1b6));var _0x53ee=function(_0x50707b,_0x485f24){_0x50707b=_0x50707b-0x0;var _0x423e5c=_0x3ee5[_0x50707b];return _0x423e5c;};'use strict';var _=require('lodash');var util=require(_0x53ee('0x0'));var moment=require(_0x53ee('0x1'));var BPromise=require('bluebird');var rs=require(_0x53ee('0x2'));var fs=require('fs');var Redis=require(_0x53ee('0x3'));var db=require(_0x53ee('0x4'))['db'];var utils=require(_0x53ee('0x5'));var logger=require(_0x53ee('0x6'))(_0x53ee('0x7'));var config=require(_0x53ee('0x8'));var jayson=require(_0x53ee('0x9'));var client=jayson[_0x53ee('0xa')][_0x53ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3173b2,_0x48bc62,_0x299b23){return new BPromise(function(_0x235c9f,_0x1ec296){return client[_0x53ee('0xc')](_0x3173b2,_0x299b23)[_0x53ee('0xd')](function(_0x3b1252){logger[_0x53ee('0xe')](_0x53ee('0xf'),_0x48bc62,_0x53ee('0x10'));logger[_0x53ee('0x11')](_0x53ee('0x12'),_0x48bc62,_0x53ee('0x10'),JSON['stringify'](_0x3b1252));if(_0x3b1252['error']){if(_0x3b1252[_0x53ee('0x13')][_0x53ee('0x14')]===0x1f4){logger[_0x53ee('0x13')](_0x53ee('0xf'),_0x48bc62,_0x3b1252[_0x53ee('0x13')]['message']);return _0x1ec296(_0x3b1252['error'][_0x53ee('0x15')]);}logger[_0x53ee('0x13')]('Attachment,\x20%s,\x20%s',_0x48bc62,_0x3b1252['error'][_0x53ee('0x15')]);return _0x235c9f(_0x3b1252[_0x53ee('0x13')][_0x53ee('0x15')]);}else{logger['info'](_0x53ee('0xf'),_0x48bc62,_0x53ee('0x10'));_0x235c9f(_0x3b1252[_0x53ee('0x16')][_0x53ee('0x15')]);}})[_0x53ee('0x17')](function(_0x2fb3cd){logger['error'](_0x53ee('0xf'),_0x48bc62,_0x2fb3cd);_0x1ec296(_0x2fb3cd);});});}exports[_0x53ee('0x18')]=function(_0x3d788e){var _0x17c3cb=this;return new Promise(function(_0x708604,_0x29a4b4){return db[_0x53ee('0x19')][_0x53ee('0x1a')](_0x3d788e[_0x53ee('0x1b')],{'raw':_0x3d788e[_0x53ee('0x1c')]?_0x3d788e[_0x53ee('0x1c')][_0x53ee('0x1d')]===undefined?!![]:![]:!![]})[_0x53ee('0xd')](function(_0x2cbd98){logger['info'](_0x53ee('0x18'),_0x3d788e);logger['debug']('CreateAttachment',_0x3d788e,JSON[_0x53ee('0x1e')](_0x2cbd98));_0x708604(_0x2cbd98);})[_0x53ee('0x17')](function(_0x4105d6){logger['error'](_0x53ee('0x18'),_0x4105d6[_0x53ee('0x15')],_0x3d788e);_0x29a4b4(_0x17c3cb[_0x53ee('0x13')](0x1f4,_0x4105d6[_0x53ee('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index c44efd4..b38080e 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x3610f6,_0x52f821){var _0x45ff1b=function(_0x2af7a5){while(--_0x2af7a5){_0x3610f6['push'](_0x3610f6['shift']());}};_0x45ff1b(++_0x52f821);}(_0x5f2f,0x73));var _0xf5f2=function(_0x292526,_0x2d3480){_0x292526=_0x292526-0x0;var _0x563dfd=_0x5f2f[_0x292526];return _0x563dfd;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file +var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xdb28,0x106));var _0x8db2=function(_0xc98284,_0xfbb179){_0xc98284=_0xc98284-0x0;var _0x3f9ad2=_0xdb28[_0xc98284];return _0x3f9ad2;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./attachment.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 65c0c4c..6236748 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 _0x8390=['login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','use','passport','passport-local','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/environment','api','undefined','activedirectory','baseDN','domain','error','Error\x20authenticate\x20%s:\x20%s','inspect','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','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','role','blocked','blockedAt','admin','user','agent','disabled','add','minutes','getLicense','send','message'];(function(_0x10d098,_0x66d37){var _0x4d8848=function(_0x3466c8){while(--_0x3466c8){_0x10d098['push'](_0x10d098['shift']());}};_0x4d8848(++_0x66d37);}(_0x8390,0xf8));var _0x0839=function(_0x3aeb36,_0x312dc9){_0x3aeb36=_0x3aeb36-0x0;var _0xa2ef21=_0x8390[_0x3aeb36];return _0xa2ef21;};'use strict';var passport=require(_0x0839('0x0'));var LocalStrategy=require(_0x0839('0x1'))['Strategy'];var moment=require(_0x0839('0x2'));var ActiveDirectory=require(_0x0839('0x3'));var BPromise=require(_0x0839('0x4'));var util=require(_0x0839('0x5'));var db=require(_0x0839('0x6'))['db'];var authService=require(_0x0839('0x7'));var utils=require('../../config/utils');var config=require(_0x0839('0x8'));var logger=require('../../config/logger')(_0x0839('0x9'));function isActiveDirectoryConfigured(_0x54e7b7){var _0x12f31c=![];if(typeof _0x54e7b7['activedirectory']!==_0x0839('0xa')){_0x12f31c=_0x54e7b7[_0x0839('0xb')][_0x0839('0xc')]&&_0x54e7b7[_0x0839('0xb')]['url']&&_0x54e7b7[_0x0839('0xb')][_0x0839('0xd')];}return _0x12f31c;}function adAuthenticate(_0x3444c6,_0x20a158,_0x2c8b2c){return new BPromise(function(_0x68c675,_0x567582){try{var _0x4cbcca=new ActiveDirectory(_0x3444c6);_0x4cbcca['authenticate'](_0x20a158,_0x2c8b2c,function(_0x550977,_0x5775a9){if(_0x550977){logger[_0x0839('0xe')](_0x0839('0xf'),_0x20a158,util[_0x0839('0x10')](_0x550977,{'showHidden':![],'depth':null}));_0x567582('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x5775a9){logger[_0x0839('0xe')](_0x0839('0x11'),_0x20a158);_0x567582(_0x0839('0x12'));}else{_0x68c675(_0x5775a9);}});}catch(_0x46c1f3){_0x567582(_0x46c1f3);}});}function ActiveDirectoryAuthenticate(_0x2b8b48,_0x11a3ff,_0xd32e4a,_0xbf87a3){var _0x3f7226,_0x5a9ebb;if(!isActiveDirectoryConfigured(config)){logger[_0x0839('0xe')](_0x0839('0x13'),_0x11a3ff);return _0xbf87a3(null,![],{'message':_0x0839('0x12')});}return db[_0x0839('0x14')][_0x0839('0x15')]({'where':{'id':0x1},'attributes':[_0x0839('0x16'),_0x0839('0x17')],'raw':!![]})[_0x0839('0x18')](function(_0xf5d2d2){_0x3f7226=_0xf5d2d2;if(!_0x3f7226[_0x0839('0x16')]){logger[_0x0839('0xe')](_0x0839('0x19'),_0x11a3ff);throw new Error(_0x0839('0x12'));}return _0x2b8b48['findOne']({'attributes':['id',_0x0839('0x1a'),_0x0839('0x1b'),'salt',_0x0839('0x1c'),'disabled',_0x0839('0x1d'),_0x0839('0x1e'),'online'],'where':{'name':_0x11a3ff,'role':{'$or':[_0x0839('0x1f'),_0x0839('0x20'),_0x0839('0x21')]},'adSsoEnabled':!![]}});})[_0x0839('0x18')](function(_0x31b98d){if(!_0x31b98d||_0x31b98d&&_0x31b98d[_0x0839('0x1a')]!==_0x11a3ff){throw new Error(_0x0839('0x12'));}_0x5a9ebb=_0x31b98d;var _0x393193=_0x5a9ebb[_0x0839('0x1a')]+'@'+config[_0x0839('0xb')][_0x0839('0xd')];return adAuthenticate(config[_0x0839('0xb')],_0x393193,_0xd32e4a);})['then'](function(_0x48e42c){if(_0x5a9ebb[_0x0839('0x22')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x3f7226[_0x0839('0x17')]>0x0){if(_0x5a9ebb[_0x0839('0x1d')]){if(moment(_0x5a9ebb[_0x0839('0x1e')])[_0x0839('0x23')](_0x3f7226[_0x0839('0x17')],_0x0839('0x24'))>moment()){throw new Error(_0x0839('0x12'));}return utils['clearBlockUser'](_0x5a9ebb,0x0,![],null)[_0x0839('0x18')](function(){return utils[_0x0839('0x25')](_0x5a9ebb);})[_0x0839('0x18')](function(){return _0xbf87a3(null,_0x5a9ebb);});}else{return utils[_0x0839('0x25')](_0x5a9ebb)[_0x0839('0x18')](function(){return _0xbf87a3(null,_0x5a9ebb);});}}else{return utils['getLicense'](_0x5a9ebb)['then'](function(){return _0xbf87a3(null,_0x5a9ebb);});}})['catch'](function(_0x1f5389){return _0xbf87a3(null,![],_0x1f5389);});}function handleError(_0x5d833c,_0x444353,_0x567f11){return _0x5d833c['status'](_0x444353||0x1f4)[_0x0839('0x26')]({'message':_0x567f11?_0x567f11[_0x0839('0x27')]||_0x567f11:''});}exports[_0x0839('0x28')]=function(_0x3273e5,_0x24c740,_0x4eb7fe){passport[_0x0839('0x29')](_0x0839('0x2a'),function(_0x59fe62,_0x301a49,_0x40a495){var _0x4733eb=_0x59fe62||_0x40a495;if(_0x4733eb){return handleError(_0x24c740,0x191,_0x4733eb);}if(!_0x301a49){return handleError(_0x24c740,0x194,{'message':_0x0839('0x2b')});}else{var _0x27e15a={'payload':{'id':_0x301a49['id'],'role':_0x301a49[_0x0839('0x1c')]},'options':{'expiresIn':0x15180}};return authService[_0x0839('0x2c')](_0x27e15a)[_0x0839('0x18')](function(_0x2fd00f){_0x24c740[_0x0839('0x2d')]({'id':_0x301a49['id'],'token':_0x2fd00f,'statusCall':'','isAlreadyLogged':_0x301a49[_0x0839('0x2e')]});});}})(_0x3273e5,_0x24c740,_0x4eb7fe);};passport[_0x0839('0x2f')](_0x0839('0x2a'),new LocalStrategy({'usernameField':_0x0839('0x1a'),'passwordField':_0x0839('0x1b')},function(_0x34d2a0,_0x523a1c,_0x3ee66e){return ActiveDirectoryAuthenticate(db['User'],_0x34d2a0,_0x523a1c,_0x3ee66e);})); \ No newline at end of file +var _0x395b=['signToken','json','use','User','passport','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/environment','../../config/logger','api','undefined','activedirectory','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Setting','findOne','adSsoEnabled','blockDuration','then','name','password','salt','disabled','online','user','blockedAt','add','clearBlockUser','getLicense','catch','status','role'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x395b,0x79));var _0xb395=function(_0x5d7803,_0x30e9aa){_0x5d7803=_0x5d7803-0x0;var _0x1a43b2=_0x395b[_0x5d7803];return _0x1a43b2;};'use strict';var passport=require(_0xb395('0x0'));var LocalStrategy=require('passport-local')['Strategy'];var moment=require('moment');var ActiveDirectory=require(_0xb395('0x1'));var BPromise=require(_0xb395('0x2'));var util=require(_0xb395('0x3'));var db=require(_0xb395('0x4'))['db'];var authService=require(_0xb395('0x5'));var utils=require('../../config/utils');var config=require(_0xb395('0x6'));var logger=require(_0xb395('0x7'))(_0xb395('0x8'));function isActiveDirectoryConfigured(_0x4bb8fa){var _0x24018e=![];if(typeof _0x4bb8fa['activedirectory']!==_0xb395('0x9')){_0x24018e=_0x4bb8fa[_0xb395('0xa')]['baseDN']&&_0x4bb8fa[_0xb395('0xa')]['url']&&_0x4bb8fa['activedirectory'][_0xb395('0xb')];}return _0x24018e;}function adAuthenticate(_0x558d5e,_0x5e36a3,_0x183cb4){return new BPromise(function(_0x3d5282,_0x7bc91e){try{var _0x2e1cda=new ActiveDirectory(_0x558d5e);_0x2e1cda[_0xb395('0xc')](_0x5e36a3,_0x183cb4,function(_0x144e61,_0x1a19d6){if(_0x144e61){logger[_0xb395('0xd')](_0xb395('0xe'),_0x5e36a3,util['inspect'](_0x144e61,{'showHidden':![],'depth':null}));_0x7bc91e(_0xb395('0xf'));}else if(!_0x1a19d6){logger[_0xb395('0xd')](_0xb395('0x10'),_0x5e36a3);_0x7bc91e(_0xb395('0xf'));}else{_0x3d5282(_0x1a19d6);}});}catch(_0x2b2554){_0x7bc91e(_0x2b2554);}});}function ActiveDirectoryAuthenticate(_0x563616,_0x27f0c0,_0x12f760,_0x5e727d){var _0x5201a6,_0x5ee56c;if(!isActiveDirectoryConfigured(config)){logger[_0xb395('0xd')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x27f0c0);return _0x5e727d(null,![],{'message':_0xb395('0xf')});}return db[_0xb395('0x11')][_0xb395('0x12')]({'where':{'id':0x1},'attributes':[_0xb395('0x13'),_0xb395('0x14')],'raw':!![]})[_0xb395('0x15')](function(_0x2c0414){_0x5201a6=_0x2c0414;if(!_0x5201a6['adSsoEnabled']){logger[_0xb395('0xd')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x27f0c0);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x563616['findOne']({'attributes':['id',_0xb395('0x16'),_0xb395('0x17'),_0xb395('0x18'),'role',_0xb395('0x19'),'blocked','blockedAt',_0xb395('0x1a')],'where':{'name':_0x27f0c0,'role':{'$or':['admin',_0xb395('0x1b'),'agent']},'adSsoEnabled':!![]}});})['then'](function(_0x37a60c){if(!_0x37a60c||_0x37a60c&&_0x37a60c['name']!==_0x27f0c0){throw new Error(_0xb395('0xf'));}_0x5ee56c=_0x37a60c;var _0x2a1000=_0x5ee56c['name']+'@'+config[_0xb395('0xa')][_0xb395('0xb')];return adAuthenticate(config['activedirectory'],_0x2a1000,_0x12f760);})['then'](function(_0x22c7a3){if(_0x5ee56c[_0xb395('0x19')]){throw new Error(_0xb395('0xf'));}if(_0x5201a6[_0xb395('0x14')]>0x0){if(_0x5ee56c['blocked']){if(moment(_0x5ee56c[_0xb395('0x1c')])[_0xb395('0x1d')](_0x5201a6[_0xb395('0x14')],'minutes')>moment()){throw new Error(_0xb395('0xf'));}return utils[_0xb395('0x1e')](_0x5ee56c,0x0,![],null)[_0xb395('0x15')](function(){return utils['getLicense'](_0x5ee56c);})[_0xb395('0x15')](function(){return _0x5e727d(null,_0x5ee56c);});}else{return utils[_0xb395('0x1f')](_0x5ee56c)[_0xb395('0x15')](function(){return _0x5e727d(null,_0x5ee56c);});}}else{return utils[_0xb395('0x1f')](_0x5ee56c)[_0xb395('0x15')](function(){return _0x5e727d(null,_0x5ee56c);});}})[_0xb395('0x20')](function(_0x214af8){return _0x5e727d(null,![],_0x214af8);});}function handleError(_0x7b29c8,_0x2fba5e,_0x127bb5){return _0x7b29c8[_0xb395('0x21')](_0x2fba5e||0x1f4)['send']({'message':_0x127bb5?_0x127bb5['message']||_0x127bb5:''});}exports['login']=function(_0x47be48,_0x3c7c4b,_0x1ecc90){passport[_0xb395('0xc')]('ad-login',function(_0x2af13c,_0xb19c59,_0x3c51ad){var _0x4ca032=_0x2af13c||_0x3c51ad;if(_0x4ca032){return handleError(_0x3c7c4b,0x191,_0x4ca032);}if(!_0xb19c59){return handleError(_0x3c7c4b,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x362bff={'payload':{'id':_0xb19c59['id'],'role':_0xb19c59[_0xb395('0x22')]},'options':{'expiresIn':0x15180}};return authService[_0xb395('0x23')](_0x362bff)[_0xb395('0x15')](function(_0x2d1441){_0x3c7c4b[_0xb395('0x24')]({'id':_0xb19c59['id'],'token':_0x2d1441,'statusCall':'','isAlreadyLogged':_0xb19c59[_0xb395('0x1a')]});});}})(_0x47be48,_0x3c7c4b,_0x1ecc90);};passport[_0xb395('0x25')]('ad-login',new LocalStrategy({'usernameField':_0xb395('0x16'),'passwordField':_0xb395('0x17')},function(_0x1720a1,_0x38b4d6,_0x102059){return ActiveDirectoryAuthenticate(db[_0xb395('0x26')],_0x1720a1,_0x38b4d6,_0x102059);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index fd2ab9a..ac844ce 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 _0x2982=['post','login','exports','Router','./authActiveDirectory.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2982,0x8f));var _0x2298=function(_0x437956,_0xb80d14){_0x437956=_0x437956-0x0;var _0xc59bf6=_0x2982[_0x437956];return _0xc59bf6;};'use strict';var express=require('express');var router=express[_0x2298('0x0')]();var controller=require(_0x2298('0x1'));router[_0x2298('0x2')]('/',controller[_0x2298('0x3')]);module[_0x2298('0x4')]=router; \ No newline at end of file +var _0x0f2e=['post','exports','express','Router','./authActiveDirectory.controller'];(function(_0x4529df,_0x1b9abd){var _0x41e9d3=function(_0x569224){while(--_0x569224){_0x4529df['push'](_0x4529df['shift']());}};_0x41e9d3(++_0x1b9abd);}(_0x0f2e,0x6b));var _0xe0f2=function(_0x1075b8,_0xd606e2){_0x1075b8=_0x1075b8-0x0;var _0x5d047f=_0x0f2e[_0x1075b8];return _0x5d047f;};'use strict';var express=require(_0xe0f2('0x0'));var router=express[_0xe0f2('0x1')]();var controller=require(_0xe0f2('0x2'));router[_0xe0f2('0x3')]('/',controller['login']);module[_0xe0f2('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 0410aa4..d11bfb0 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x7a54,0x106));var _0x47a5=function(_0x2a9910,_0x22a2ab){_0x2a9910=_0x2a9910-0x0;var _0x426cf4=_0x7a54[_0x2a9910];return _0x426cf4;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x7a54,0x106));var _0x47a5=function(_0x7e7377,_0x3301ec){_0x7e7377=_0x7e7377-0x0;var _0x3978b5=_0x7a54[_0x7e7377];return _0x3978b5;};'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 bfcc599..ec03671 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 _0x01e3=['isMiddleware','login','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','get','/callback'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x01e3,0x122));var _0x301e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x01e3[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x301e('0x0'));var passport=require(_0x301e('0x1'));var router=express[_0x301e('0x2')]();var controller=require(_0x301e('0x3'));var userController=require(_0x301e('0x4'));var authService=require('../../components/auth/service');router[_0x301e('0x5')]('/',controller['login']);router['get'](_0x301e('0x6'),controller['callback'],authService[_0x301e('0x7')],userController[_0x301e('0x8')],authService[_0x301e('0x9')]);module[_0x301e('0xa')]=router; \ No newline at end of file +var _0x0060=['setTokenCookie','exports','passport','Router','./authGoogle.controller','../user/user.controller.js','get','/callback','callback'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0060,0xda));var _0x0006=function(_0x32a81f,_0x4eee66){_0x32a81f=_0x32a81f-0x0;var _0x5b67a2=_0x0060[_0x32a81f];return _0x5b67a2;};'use strict';var express=require('express');var passport=require(_0x0006('0x0'));var router=express[_0x0006('0x1')]();var controller=require(_0x0006('0x2'));var userController=require(_0x0006('0x3'));var authService=require('../../components/auth/service');router[_0x0006('0x4')]('/',controller['login']);router[_0x0006('0x4')](_0x0006('0x5'),controller[_0x0006('0x6')],authService['isMiddleware'],userController['login'],authService[_0x0006('0x7')]);module[_0x0006('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 b8541a9..4d65026 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 _0x4265=['Setting','securePassword','enforcePasswordHistory','previousPasswords','validatePasswordHistory','save','Password\x20reset!','use','local-login','util','passport','passport-local','jayson/promise','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','client','http','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','add','minutes','clearBlockUser','blockedAt','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','user','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','Email\x20parameter\x20is\x20missing','generate','body','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset'];(function(_0x278698,_0x4bf078){var _0x4e5a64=function(_0x3eead7){while(--_0x3eead7){_0x278698['push'](_0x278698['shift']());}};_0x4e5a64(++_0x4bf078);}(_0x4265,0xb1));var _0x5426=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4265[_0x4a9fb1];return _0x348672;};'use strict';var util=require(_0x5426('0x0'));var passport=require(_0x5426('0x1'));var LocalStrategy=require(_0x5426('0x2'))['Strategy'];var jayson=require(_0x5426('0x3'));var _=require('lodash');var rs=require(_0x5426('0x4'));var moment=require('moment');var db=require(_0x5426('0x5'))['db'];var authService=require(_0x5426('0x6'));var utils=require(_0x5426('0x7'));var client=jayson[_0x5426('0x8')][_0x5426('0x9')]({'port':0x232b});function localAuthenticate(_0x31a3b7,_0x5aec23,_0x1ab3b2,_0x1f12da){var _0x213a5d,_0x32af87;return db['Setting'][_0x5426('0xa')]({'where':{'id':0x1},'attributes':[_0x5426('0xb'),_0x5426('0xc')],'raw':!![]})[_0x5426('0xd')](function(_0x16c269){_0x213a5d=_0x16c269;return _0x31a3b7[_0x5426('0xa')]({'attributes':['id',_0x5426('0xe'),_0x5426('0xf'),_0x5426('0x10'),_0x5426('0x11'),_0x5426('0x12'),_0x5426('0x13'),'blockedAt','loginAttempts'],'where':{'name':_0x5aec23,'role':{'$or':[_0x5426('0x14'),'user',_0x5426('0x15')]}}});})['then'](function(_0x2bd666){if(!_0x2bd666||_0x2bd666&&_0x2bd666[_0x5426('0xe')]!==_0x5aec23){throw new Error(_0x5426('0x16'));}else{_0x32af87=_0x2bd666;return _0x32af87;}})[_0x5426('0xd')](function(){_0x32af87[_0x5426('0x17')](_0x1ab3b2,function(_0x548a55,_0x18959c){var _0x50e0ca=_0x32af87[_0x5426('0x18')]+0x1;if(_0x548a55){return _0x1f12da(_0x548a55);}else if(!_0x18959c){if(_0x32af87[_0x5426('0x12')]){return _0x1f12da(null,![],{'message':_0x5426('0x16')});}else if(_0x213a5d[_0x5426('0xb')]>0x0){if(_0x32af87[_0x5426('0x13')]){if(_0x213a5d[_0x5426('0xc')]>0x0){if(moment(_0x32af87['blockedAt'])[_0x5426('0x19')](_0x213a5d['blockDuration'],_0x5426('0x1a'))>moment()){return _0x1f12da(null,![],{'message':_0x5426('0x16')});}else{return utils['clearBlockUser'](_0x32af87,_0x50e0ca,![],null)[_0x5426('0xd')](function(){return _0x1f12da(null,![],{'message':_0x5426('0x16')});});}}else{return _0x1f12da(null,![],{'message':_0x5426('0x16')});}}else{if(_0x50e0ca>=_0x213a5d['allowedLoginAttempts']){return utils[_0x5426('0x1b')](_0x32af87,0x0,!![],moment())['then'](function(){return _0x1f12da(null,![],{'message':_0x5426('0x16')});});}else{return utils[_0x5426('0x1b')](_0x32af87,_0x50e0ca,![],null)[_0x5426('0xd')](function(){return _0x1f12da(null,![],{'message':_0x5426('0x16')});});}}}else{return _0x1f12da(null,![],{'message':_0x5426('0x16')});}}else{if(_0x32af87[_0x5426('0x12')]){return _0x1f12da(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x213a5d['allowedLoginAttempts']>0x0){if(_0x32af87[_0x5426('0x13')]){if(_0x213a5d[_0x5426('0xc')]>0x0){if(moment(_0x32af87[_0x5426('0x1c')])['add'](_0x213a5d[_0x5426('0xc')],_0x5426('0x1a'))>moment()){return _0x1f12da(null,![],{'message':_0x5426('0x16')});}else{return utils['clearBlockUser'](_0x32af87,0x0,![],null)[_0x5426('0xd')](function(){return utils['getLicense'](_0x32af87);})[_0x5426('0xd')](function(){return _0x1f12da(null,_0x32af87);});}}else{return _0x1f12da(null,![],{'message':_0x5426('0x16')});}}else{return utils[_0x5426('0x1b')](_0x32af87,0x0,![],null)[_0x5426('0xd')](function(){return utils[_0x5426('0x1d')](_0x32af87);})[_0x5426('0xd')](function(){return _0x1f12da(null,_0x32af87);})['catch'](function(_0x3e832d){return _0x1f12da(null,![],_0x3e832d);});}}else{if(_0x32af87[_0x5426('0x13')]){return _0x1f12da(null,![],{'message':_0x5426('0x16')});}else{return utils[_0x5426('0x1d')](_0x32af87)[_0x5426('0xd')](function(){return _0x1f12da(null,_0x32af87);});}}}});})[_0x5426('0x1e')](function(_0x384ccf){return _0x1f12da(null,![],_0x384ccf);});}function sendServiceMail(_0x1a1e94){return db[_0x5426('0x1f')][_0x5426('0x20')]({'where':{'service':!![]},'attributes':['id','name',_0x5426('0x21')],'include':[{'model':db[_0x5426('0x22')],'as':_0x5426('0x23'),'include':[{'model':db['CloudProvider'],'as':_0x5426('0x24')}]}]})['then'](function(_0x2e2157){if(!_0x2e2157){throw new Error(_0x5426('0x25'));}var _0xa54679=_0x2e2157[_0x5426('0x26')]();var _0x243038={'account':_0xa54679,'message':_[_0x5426('0x27')]({'from':util[_0x5426('0x28')](_0x5426('0x29'),_0x2e2157[_0x5426('0xe')],_0x2e2157['email']||_0x2e2157[_0x5426('0x23')][_0x5426('0x2a')])},_0x1a1e94)};return client[_0x5426('0x2b')](_0x5426('0x2c'),_0x243038);})[_0x5426('0xd')](function(_0x47400d){if(_0x47400d[_0x5426('0x2d')]){throw new Error(util[_0x5426('0x28')](_0x5426('0x2e'),_0x47400d['error'][_0x5426('0x2f')]||JSON[_0x5426('0x30')](_0x47400d['error'])));}return!![];});}function handleError(_0x284e38,_0x590323,_0x5cf6eb){return _0x284e38[_0x5426('0x31')](_0x590323||0x1f4)[_0x5426('0x32')]({'message':_0x5cf6eb?_0x5cf6eb['message']||_0x5cf6eb:''});}exports[_0x5426('0x33')]=function(_0x37cb64,_0x445d56,_0x13ba94){passport['authenticate']('local-login',function(_0x2aa6bb,_0x12fc8e,_0x1ce218){var _0x2fdbbb=_0x2aa6bb||_0x1ce218;if(_0x2fdbbb){return handleError(_0x445d56,0x191,_0x2fdbbb);}if(!_0x12fc8e){return handleError(_0x445d56,0x194,{'message':_0x5426('0x34')});}else{var _0x371b5b={'payload':{'id':_0x12fc8e['id'],'role':_0x12fc8e[_0x5426('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0x5426('0x35')](_0x371b5b)['then'](function(_0x51f2ee){_0x445d56[_0x5426('0x36')]({'id':_0x12fc8e['id'],'token':_0x51f2ee,'statusCall':'','isAlreadyLogged':_0x12fc8e[_0x5426('0x37')]});});}})(_0x37cb64,_0x445d56,_0x13ba94);};exports['forgot']=function(_0x57019f,_0x1f255e){if(!_0x57019f['body'][_0x5426('0x21')]){return handleError(_0x1f255e,0x1f4,{'message':_0x5426('0x38')});}var _0x16d6c0=rs[_0x5426('0x39')]();_0x57019f[_0x5426('0x3a')][_0x5426('0x21')]=_0x57019f[_0x5426('0x3a')]['email']['trim']()[_0x5426('0x3b')]();var _0x582e1a;return db['Setting'][_0x5426('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x5426('0xc')],'raw':!![]})[_0x5426('0xd')](function(_0x1169ab){_0x582e1a=_0x1169ab;return db[_0x5426('0x3c')][_0x5426('0x20')]({'where':{'email':_0x57019f[_0x5426('0x3a')][_0x5426('0x21')]}});})['then'](function(_0x30575d){if(!_0x30575d){throw new Error(_0x5426('0x3d'));}if(_0x30575d[_0x5426('0x12')]){throw new Error(_0x5426('0x3e'));}if(_0x30575d['blocked']){if(moment(_0x30575d[_0x5426('0x1c')])[_0x5426('0x19')](_0x582e1a[_0x5426('0xc')],_0x5426('0x1a'))>moment()){throw new Error(_0x5426('0x3f'));}else{_0x30575d[_0x5426('0x13')]=![];_0x30575d['blockedAt']=null;}}_0x30575d[_0x5426('0x40')]=_0x16d6c0;_0x30575d[_0x5426('0x41')]=Date[_0x5426('0x42')]()+0x36ee80;return _0x30575d['save']();})[_0x5426('0xd')](function(){return sendServiceMail({'to':_0x57019f[_0x5426('0x3a')]['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x5426('0x43')+_0x5426('0x44')+_0x57019f[_0x5426('0x45')][_0x5426('0x46')]+_0x5426('0x47')+_0x16d6c0+'\x0a\x0a'+_0x5426('0x48')});})[_0x5426('0xd')](function(){_0x1f255e[_0x5426('0x31')](0xc8)[_0x5426('0x32')]({'message':_0x5426('0x49')});})['catch'](function(_0x3ed169){return handleError(_0x1f255e,0x1f4,_0x3ed169);});};exports[_0x5426('0x4a')]=function(_0x587251,_0x1dbd8a){return db[_0x5426('0x3c')][_0x5426('0x20')]({'where':{'resetPasswordToken':_0x587251['params']['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x5426('0xd')](function(_0x9c3029){if(!_0x9c3029){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x5426('0x4b')][_0x5426('0xa')]({'attributes':['id',_0x5426('0x4c'),_0x5426('0x4d'),'passwordHistoryLimit']})[_0x5426('0xd')](function(_0x45b9db){if(_0x45b9db[_0x5426('0x4c')])authService['validatePasswordPattern'](_0x587251['body'][_0x5426('0xf')]);if(!_0x45b9db[_0x5426('0x4d')]||!_0x9c3029[_0x5426('0x4e')])return _0x9c3029;authService[_0x5426('0x4f')](_0x587251[_0x5426('0x3a')][_0x5426('0xf')],_0x9c3029[_0x5426('0x4e')],_0x45b9db['passwordHistoryLimit']);return _0x9c3029;})[_0x5426('0xd')](function(){_0x9c3029[_0x5426('0xf')]=_0x587251[_0x5426('0x3a')][_0x5426('0xf')];_0x9c3029[_0x5426('0x40')]=null;_0x9c3029[_0x5426('0x41')]=null;return _0x9c3029[_0x5426('0x50')]();});})[_0x5426('0xd')](function(){_0x1dbd8a[_0x5426('0x31')](0xc8)[_0x5426('0x32')]({'message':_0x5426('0x51')});})[_0x5426('0x1e')](function(_0x887bec){return handleError(_0x1dbd8a,0x1f4,_0x887bec);});};passport[_0x5426('0x52')](_0x5426('0x53'),new LocalStrategy({'usernameField':_0x5426('0xe'),'passwordField':'password'},function(_0x4b7475,_0x101d8e,_0x23112b){return localAuthenticate(db['User'],_0x4b7475,_0x101d8e,_0x23112b);})); \ No newline at end of file +var _0x7a73=['Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','host','/reset/','Reset\x20Email\x20sent!','reset','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','password','previousPasswords','resetPasswordToken','save','Password\x20reset!','catch','use','local-login','util','passport','passport-local','Strategy','randomstring','moment','../../mysqldb','../../components/auth/service','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','salt','role','blocked','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','minutes','clearBlockUser','blockedAt','add','getLicense','MailAccount','find','email','Smtp','CloudProvider'];(function(_0x3bd5cd,_0x284a33){var _0x1e9ad2=function(_0xbe0d4e){while(--_0xbe0d4e){_0x3bd5cd['push'](_0x3bd5cd['shift']());}};_0x1e9ad2(++_0x284a33);}(_0x7a73,0xd9));var _0x37a7=function(_0x334b82,_0x56030f){_0x334b82=_0x334b82-0x0;var _0x713ad6=_0x7a73[_0x334b82];return _0x713ad6;};'use strict';var util=require(_0x37a7('0x0'));var passport=require(_0x37a7('0x1'));var LocalStrategy=require(_0x37a7('0x2'))[_0x37a7('0x3')];var jayson=require('jayson/promise');var _=require('lodash');var rs=require(_0x37a7('0x4'));var moment=require(_0x37a7('0x5'));var db=require(_0x37a7('0x6'))['db'];var authService=require(_0x37a7('0x7'));var utils=require('../../config/utils');var client=jayson[_0x37a7('0x8')][_0x37a7('0x9')]({'port':0x232b});function localAuthenticate(_0x1be633,_0x55fe84,_0x2a1de0,_0x4e445a){var _0x5d0e0c,_0x13c767;return db[_0x37a7('0xa')][_0x37a7('0xb')]({'where':{'id':0x1},'attributes':[_0x37a7('0xc'),_0x37a7('0xd')],'raw':!![]})[_0x37a7('0xe')](function(_0x2cbbbe){_0x5d0e0c=_0x2cbbbe;return _0x1be633[_0x37a7('0xb')]({'attributes':['id',_0x37a7('0xf'),'password',_0x37a7('0x10'),_0x37a7('0x11'),'disabled',_0x37a7('0x12'),'blockedAt','loginAttempts'],'where':{'name':_0x55fe84,'role':{'$or':[_0x37a7('0x13'),_0x37a7('0x14'),_0x37a7('0x15')]}}});})[_0x37a7('0xe')](function(_0x3d38cc){if(!_0x3d38cc||_0x3d38cc&&_0x3d38cc[_0x37a7('0xf')]!==_0x55fe84){throw new Error(_0x37a7('0x16'));}else{_0x13c767=_0x3d38cc;return _0x13c767;}})['then'](function(){_0x13c767[_0x37a7('0x17')](_0x2a1de0,function(_0x5924fc,_0x4419cd){var _0x5ca1e6=_0x13c767['loginAttempts']+0x1;if(_0x5924fc){return _0x4e445a(_0x5924fc);}else if(!_0x4419cd){if(_0x13c767[_0x37a7('0x18')]){return _0x4e445a(null,![],{'message':_0x37a7('0x16')});}else if(_0x5d0e0c[_0x37a7('0xc')]>0x0){if(_0x13c767[_0x37a7('0x12')]){if(_0x5d0e0c[_0x37a7('0xd')]>0x0){if(moment(_0x13c767['blockedAt'])['add'](_0x5d0e0c[_0x37a7('0xd')],_0x37a7('0x19'))>moment()){return _0x4e445a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x37a7('0x1a')](_0x13c767,_0x5ca1e6,![],null)[_0x37a7('0xe')](function(){return _0x4e445a(null,![],{'message':_0x37a7('0x16')});});}}else{return _0x4e445a(null,![],{'message':_0x37a7('0x16')});}}else{if(_0x5ca1e6>=_0x5d0e0c[_0x37a7('0xc')]){return utils[_0x37a7('0x1a')](_0x13c767,0x0,!![],moment())[_0x37a7('0xe')](function(){return _0x4e445a(null,![],{'message':_0x37a7('0x16')});});}else{return utils[_0x37a7('0x1a')](_0x13c767,_0x5ca1e6,![],null)[_0x37a7('0xe')](function(){return _0x4e445a(null,![],{'message':_0x37a7('0x16')});});}}}else{return _0x4e445a(null,![],{'message':_0x37a7('0x16')});}}else{if(_0x13c767[_0x37a7('0x18')]){return _0x4e445a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x5d0e0c[_0x37a7('0xc')]>0x0){if(_0x13c767['blocked']){if(_0x5d0e0c[_0x37a7('0xd')]>0x0){if(moment(_0x13c767[_0x37a7('0x1b')])[_0x37a7('0x1c')](_0x5d0e0c['blockDuration'],'minutes')>moment()){return _0x4e445a(null,![],{'message':_0x37a7('0x16')});}else{return utils[_0x37a7('0x1a')](_0x13c767,0x0,![],null)[_0x37a7('0xe')](function(){return utils[_0x37a7('0x1d')](_0x13c767);})[_0x37a7('0xe')](function(){return _0x4e445a(null,_0x13c767);});}}else{return _0x4e445a(null,![],{'message':_0x37a7('0x16')});}}else{return utils[_0x37a7('0x1a')](_0x13c767,0x0,![],null)[_0x37a7('0xe')](function(){return utils[_0x37a7('0x1d')](_0x13c767);})[_0x37a7('0xe')](function(){return _0x4e445a(null,_0x13c767);})['catch'](function(_0x43a310){return _0x4e445a(null,![],_0x43a310);});}}else{if(_0x13c767[_0x37a7('0x12')]){return _0x4e445a(null,![],{'message':_0x37a7('0x16')});}else{return utils['getLicense'](_0x13c767)[_0x37a7('0xe')](function(){return _0x4e445a(null,_0x13c767);});}}}});})['catch'](function(_0x106aa6){return _0x4e445a(null,![],_0x106aa6);});}function sendServiceMail(_0x5cf880){return db[_0x37a7('0x1e')][_0x37a7('0x1f')]({'where':{'service':!![]},'attributes':['id','name',_0x37a7('0x20')],'include':[{'model':db['MailServerOut'],'as':_0x37a7('0x21'),'include':[{'model':db[_0x37a7('0x22')],'as':_0x37a7('0x22')}]}]})['then'](function(_0x14f66c){if(!_0x14f66c){throw new Error(_0x37a7('0x23'));}var _0x43d273=_0x14f66c[_0x37a7('0x24')]();var _0x89f81={'account':_0x43d273,'message':_['merge']({'from':util[_0x37a7('0x25')](_0x37a7('0x26'),_0x14f66c[_0x37a7('0xf')],_0x14f66c['email']||_0x14f66c[_0x37a7('0x21')][_0x37a7('0x14')])},_0x5cf880)};return client[_0x37a7('0x27')](_0x37a7('0x28'),_0x89f81);})[_0x37a7('0xe')](function(_0x2b54e1){if(_0x2b54e1[_0x37a7('0x29')]){throw new Error(util[_0x37a7('0x25')](_0x37a7('0x2a'),_0x2b54e1[_0x37a7('0x29')][_0x37a7('0x2b')]||JSON[_0x37a7('0x2c')](_0x2b54e1[_0x37a7('0x29')])));}return!![];});}function handleError(_0x261fa3,_0x5eede9,_0x214cda){return _0x261fa3[_0x37a7('0x2d')](_0x5eede9||0x1f4)[_0x37a7('0x2e')]({'message':_0x214cda?_0x214cda[_0x37a7('0x2b')]||_0x214cda:''});}exports[_0x37a7('0x2f')]=function(_0x3eed76,_0x47ce23,_0x16e678){passport[_0x37a7('0x17')]('local-login',function(_0x365d8f,_0x538113,_0x25d820){var _0x12e72e=_0x365d8f||_0x25d820;if(_0x12e72e){return handleError(_0x47ce23,0x191,_0x12e72e);}if(!_0x538113){return handleError(_0x47ce23,0x194,{'message':_0x37a7('0x30')});}else{var _0x2153c8={'payload':{'id':_0x538113['id'],'role':_0x538113['role']},'options':{'expiresIn':0x15180}};return authService[_0x37a7('0x31')](_0x2153c8)[_0x37a7('0xe')](function(_0x564ee5){_0x47ce23[_0x37a7('0x32')]({'id':_0x538113['id'],'token':_0x564ee5,'statusCall':'','isAlreadyLogged':_0x538113[_0x37a7('0x33')]});});}})(_0x3eed76,_0x47ce23,_0x16e678);};exports['forgot']=function(_0x479157,_0x45cc55){if(!_0x479157[_0x37a7('0x34')][_0x37a7('0x20')]){return handleError(_0x45cc55,0x1f4,{'message':_0x37a7('0x35')});}var _0x2811fe=rs[_0x37a7('0x36')]();_0x479157['body'][_0x37a7('0x20')]=_0x479157[_0x37a7('0x34')][_0x37a7('0x20')][_0x37a7('0x37')]()[_0x37a7('0x38')]();var _0x5919df;return db['Setting'][_0x37a7('0xb')]({'where':{'id':0x1},'attributes':[_0x37a7('0xc'),_0x37a7('0xd')],'raw':!![]})[_0x37a7('0xe')](function(_0x2edaa5){_0x5919df=_0x2edaa5;return db['User'][_0x37a7('0x1f')]({'where':{'email':_0x479157[_0x37a7('0x34')][_0x37a7('0x20')]}});})[_0x37a7('0xe')](function(_0x503a53){if(!_0x503a53){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x503a53['disabled']){throw new Error(_0x37a7('0x39'));}if(_0x503a53['blocked']){if(moment(_0x503a53['blockedAt'])[_0x37a7('0x1c')](_0x5919df[_0x37a7('0xd')],'minutes')>moment()){throw new Error(_0x37a7('0x3a'));}else{_0x503a53[_0x37a7('0x12')]=![];_0x503a53[_0x37a7('0x1b')]=null;}}_0x503a53['resetPasswordToken']=_0x2811fe;_0x503a53[_0x37a7('0x3b')]=Date[_0x37a7('0x3c')]()+0x36ee80;return _0x503a53['save']();})[_0x37a7('0xe')](function(){return sendServiceMail({'to':_0x479157['body'][_0x37a7('0x20')],'subject':_0x37a7('0x3d'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x37a7('0x3e')+'https://'+_0x479157[_0x37a7('0x3f')][_0x37a7('0x40')]+_0x37a7('0x41')+_0x2811fe+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x37a7('0xe')](function(){_0x45cc55[_0x37a7('0x2d')](0xc8)[_0x37a7('0x2e')]({'message':_0x37a7('0x42')});})['catch'](function(_0x132464){return handleError(_0x45cc55,0x1f4,_0x132464);});};exports[_0x37a7('0x43')]=function(_0x8d61e0,_0x588c27){return db[_0x37a7('0x44')][_0x37a7('0x1f')]({'where':{'resetPasswordToken':_0x8d61e0[_0x37a7('0x45')][_0x37a7('0x46')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x37a7('0xe')](function(_0x5eb4cc){if(!_0x5eb4cc){throw new Error(_0x37a7('0x47'));}return db[_0x37a7('0xa')][_0x37a7('0xb')]({'attributes':['id',_0x37a7('0x48'),_0x37a7('0x49'),_0x37a7('0x4a')]})[_0x37a7('0xe')](function(_0x4e5518){if(_0x4e5518['securePassword'])authService[_0x37a7('0x4b')](_0x8d61e0[_0x37a7('0x34')][_0x37a7('0x4c')]);if(!_0x4e5518[_0x37a7('0x49')]||!_0x5eb4cc[_0x37a7('0x4d')])return _0x5eb4cc;authService['validatePasswordHistory'](_0x8d61e0[_0x37a7('0x34')]['password'],_0x5eb4cc[_0x37a7('0x4d')],_0x4e5518[_0x37a7('0x4a')]);return _0x5eb4cc;})['then'](function(){_0x5eb4cc[_0x37a7('0x4c')]=_0x8d61e0[_0x37a7('0x34')][_0x37a7('0x4c')];_0x5eb4cc[_0x37a7('0x4e')]=null;_0x5eb4cc[_0x37a7('0x3b')]=null;return _0x5eb4cc[_0x37a7('0x4f')]();});})[_0x37a7('0xe')](function(){_0x588c27['status'](0xc8)['send']({'message':_0x37a7('0x50')});})[_0x37a7('0x51')](function(_0x37034f){return handleError(_0x588c27,0x1f4,_0x37034f);});};passport[_0x37a7('0x52')](_0x37a7('0x53'),new LocalStrategy({'usernameField':_0x37a7('0xf'),'passwordField':_0x37a7('0x4c')},function(_0x1b0ffa,_0x21bd51,_0x1e1366){return localAuthenticate(db[_0x37a7('0x44')],_0x1b0ffa,_0x21bd51,_0x1e1366);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 62f89d2..f41082e 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 _0x77e1=['./authLocal.controller','post','forgot','/reset/:token','reset','exports','express','Router'];(function(_0x1b70e3,_0x3a15b1){var _0x1452ab=function(_0x692883){while(--_0x692883){_0x1b70e3['push'](_0x1b70e3['shift']());}};_0x1452ab(++_0x3a15b1);}(_0x77e1,0x13e));var _0x177e=function(_0x1a064a,_0x3fedcf){_0x1a064a=_0x1a064a-0x0;var _0x5abbc8=_0x77e1[_0x1a064a];return _0x5abbc8;};'use strict';var express=require(_0x177e('0x0'));var router=express[_0x177e('0x1')]();var controller=require(_0x177e('0x2'));router[_0x177e('0x3')]('/',controller['login']);router[_0x177e('0x3')]('/forgot',controller[_0x177e('0x4')]);router[_0x177e('0x3')](_0x177e('0x5'),controller[_0x177e('0x6')]);module[_0x177e('0x7')]=router; \ No newline at end of file +var _0xc784=['forgot','reset','exports','express','./authLocal.controller','post','login','/forgot'];(function(_0x587fb5,_0x59cb3b){var _0x551105=function(_0x5bbef4){while(--_0x5bbef4){_0x587fb5['push'](_0x587fb5['shift']());}};_0x551105(++_0x59cb3b);}(_0xc784,0xb3));var _0x4c78=function(_0x46cf00,_0x457a43){_0x46cf00=_0x46cf00-0x0;var _0x3974dc=_0xc784[_0x46cf00];return _0x3974dc;};'use strict';var express=require(_0x4c78('0x0'));var router=express['Router']();var controller=require(_0x4c78('0x1'));router[_0x4c78('0x2')]('/',controller[_0x4c78('0x3')]);router['post'](_0x4c78('0x4'),controller[_0x4c78('0x5')]);router['post']('/reset/:token',controller[_0x4c78('0x6')]);module[_0x4c78('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 cf168e6..adf19af 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 _0x6d15=['STRING','INTEGER','sequelize','exports'];(function(_0x226e53,_0x26ed06){var _0x571b89=function(_0x288163){while(--_0x288163){_0x226e53['push'](_0x226e53['shift']());}};_0x571b89(++_0x26ed06);}(_0x6d15,0x10a));var _0x56d1=function(_0x46eed4,_0x23d556){_0x46eed4=_0x46eed4-0x0;var _0x1a6d1b=_0x6d15[_0x46eed4];return _0x1a6d1b;};'use strict';var Sequelize=require(_0x56d1('0x0'));module[_0x56d1('0x1')]={'name':{'type':Sequelize[_0x56d1('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x56d1('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x56d1('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x90b2=['STRING','INTEGER','sequelize','exports'];(function(_0x5a852b,_0x1694c2){var _0xd74d84=function(_0x170a6d){while(--_0x170a6d){_0x5a852b['push'](_0x5a852b['shift']());}};_0xd74d84(++_0x1694c2);}(_0x90b2,0x1b2));var _0x290b=function(_0x1a212a,_0x64496b){_0x1a212a=_0x1a212a-0x0;var _0x22d075=_0x90b2[_0x1a212a];return _0x22d075;};'use strict';var Sequelize=require(_0x290b('0x0'));module[_0x290b('0x1')]={'name':{'type':Sequelize[_0x290b('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x290b('0x2')]},'description':{'type':Sequelize[_0x290b('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x290b('0x3')],'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 d6478f4..df0160d 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 _0xb8b4=['eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','set','Content-Range','apply','reject','save','destroy','end','error','name','send','index','map','Automation','fieldName','type','query','keys','model','attributes','fields','length','nolimit','limit','where','filters','pick','VIRTUAL','filter','merge','options','then','includeAll','catch','show','rawAttributes','intersection','create','body','update','find','params','addConditions','Condition','ids','omit','getConditions','findOne','order','sort','hasOwnProperty','Action','addActions','getActions'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xb8b4,0x148));var _0x4b8b=function(_0x535029,_0x13c8e2){_0x535029=_0x535029-0x0;var _0x594f33=_0xb8b4[_0x535029];return _0x594f33;};'use strict';var emlformat=require(_0x4b8b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4b8b('0x1'));var jsonpatch=require(_0x4b8b('0x2'));var rp=require('request-promise');var moment=require(_0x4b8b('0x3'));var BPromise=require(_0x4b8b('0x4'));var Mustache=require(_0x4b8b('0x5'));var util=require(_0x4b8b('0x6'));var path=require(_0x4b8b('0x7'));var sox=require(_0x4b8b('0x8'));var csv=require(_0x4b8b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4b8b('0xa'));var squel=require('squel');var crypto=require(_0x4b8b('0xb'));var jsforce=require(_0x4b8b('0xc'));var deskjs=require(_0x4b8b('0xd'));var toCsv=require(_0x4b8b('0x9'));var querystring=require(_0x4b8b('0xe'));var Papa=require(_0x4b8b('0xf'));var Redis=require(_0x4b8b('0x10'));var authService=require(_0x4b8b('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b8b('0x12'))(_0x4b8b('0x13'));var utils=require(_0x4b8b('0x14'));var config=require(_0x4b8b('0x15'));var licenseUtil=require(_0x4b8b('0x16'));var db=require(_0x4b8b('0x17'))['db'];function respondWithStatusCode(_0x21bbea,_0x4cda0f){_0x4cda0f=_0x4cda0f||0xcc;return function(_0x496e6e){if(_0x496e6e){return _0x21bbea[_0x4b8b('0x18')](_0x4cda0f);}return _0x21bbea[_0x4b8b('0x19')](_0x4cda0f)['end']();};}function respondWithResult(_0x159cc9,_0x1ebfc6){_0x1ebfc6=_0x1ebfc6||0xc8;return function(_0x5dc1c7){if(_0x5dc1c7){return _0x159cc9[_0x4b8b('0x19')](_0x1ebfc6)['json'](_0x5dc1c7);}};}function respondWithFilteredResult(_0x53a50f,_0x1c203b){return function(_0x938563){if(_0x938563){var _0x28c776=typeof _0x1c203b['offset']===_0x4b8b('0x1a')&&typeof _0x1c203b['limit']==='undefined';var _0x5aa664=_0x938563[_0x4b8b('0x1b')];var _0x1a9e94=_0x28c776?0x0:_0x1c203b[_0x4b8b('0x1c')];var _0x5a0642=_0x28c776?_0x938563[_0x4b8b('0x1b')]:_0x1c203b[_0x4b8b('0x1c')]+_0x1c203b['limit'];var _0x43c633;if(_0x5a0642>=_0x5aa664){_0x5a0642=_0x5aa664;_0x43c633=0xc8;}else{_0x43c633=0xce;}_0x53a50f[_0x4b8b('0x19')](_0x43c633);return _0x53a50f[_0x4b8b('0x1d')](_0x4b8b('0x1e'),_0x1a9e94+'-'+_0x5a0642+'/'+_0x5aa664)['json'](_0x938563);}return null;};}function patchUpdates(_0x12a297){return function(_0x45322d){try{jsonpatch[_0x4b8b('0x1f')](_0x45322d,_0x12a297,!![]);}catch(_0x431150){return BPromise[_0x4b8b('0x20')](_0x431150);}return _0x45322d[_0x4b8b('0x21')]();};}function saveUpdates(_0x1c0e7f,_0x1a289a){return function(_0x563085){if(_0x563085){return _0x563085['update'](_0x1c0e7f)['then'](function(_0x45a26f){return _0x45a26f;});}return null;};}function removeEntity(_0x1d039c,_0x4479f2){return function(_0x2cfbe4){if(_0x2cfbe4){return _0x2cfbe4[_0x4b8b('0x22')]()['then'](function(){_0x1d039c[_0x4b8b('0x19')](0xcc)[_0x4b8b('0x23')]();});}};}function handleEntityNotFound(_0x7a291d,_0xaf6cd4){return function(_0x205eac){if(!_0x205eac){_0x7a291d['sendStatus'](0x194);}return _0x205eac;};}function handleError(_0x1c4ac7,_0x38da1b){_0x38da1b=_0x38da1b||0x1f4;return function(_0x4c7855){logger[_0x4b8b('0x24')](_0x4c7855['stack']);if(_0x4c7855[_0x4b8b('0x25')]){delete _0x4c7855['name'];}_0x1c4ac7[_0x4b8b('0x19')](_0x38da1b)[_0x4b8b('0x26')](_0x4c7855);};}exports[_0x4b8b('0x27')]=function(_0x413456,_0x158b59){var _0x3f1bd3={},_0x3a7209={},_0x1fe0e7={'count':0x0,'rows':[]};var _0xd3dd02=_[_0x4b8b('0x28')](db[_0x4b8b('0x29')]['rawAttributes'],function(_0x1d6779){return{'name':_0x1d6779[_0x4b8b('0x2a')],'type':_0x1d6779[_0x4b8b('0x2b')]['key']};});_0x3a7209['model']=_[_0x4b8b('0x28')](_0xd3dd02,'name');_0x3a7209[_0x4b8b('0x2c')]=_[_0x4b8b('0x2d')](_0x413456[_0x4b8b('0x2c')]);_0x3a7209['filters']=_['intersection'](_0x3a7209[_0x4b8b('0x2e')],_0x3a7209['query']);_0x3f1bd3[_0x4b8b('0x2f')]=_['intersection'](_0x3a7209['model'],qs[_0x4b8b('0x30')](_0x413456[_0x4b8b('0x2c')]['fields']));_0x3f1bd3[_0x4b8b('0x2f')]=_0x3f1bd3[_0x4b8b('0x2f')][_0x4b8b('0x31')]?_0x3f1bd3['attributes']:_0x3a7209[_0x4b8b('0x2e')];if(!_0x413456[_0x4b8b('0x2c')]['hasOwnProperty'](_0x4b8b('0x32'))){_0x3f1bd3[_0x4b8b('0x33')]=qs[_0x4b8b('0x33')](_0x413456[_0x4b8b('0x2c')][_0x4b8b('0x33')]);_0x3f1bd3[_0x4b8b('0x1c')]=qs[_0x4b8b('0x1c')](_0x413456[_0x4b8b('0x2c')]['offset']);}_0x3f1bd3['order']=qs['sort'](_0x413456['query']['sort']);_0x3f1bd3[_0x4b8b('0x34')]=qs[_0x4b8b('0x35')](_[_0x4b8b('0x36')](_0x413456[_0x4b8b('0x2c')],_0x3a7209[_0x4b8b('0x35')]),_0xd3dd02);if(_0x413456[_0x4b8b('0x2c')]['filter']){_0x3f1bd3['where']=_['merge'](_0x3f1bd3['where'],{'$or':_[_0x4b8b('0x28')](_0xd3dd02,function(_0x2e9419){if(_0x2e9419[_0x4b8b('0x2b')]!==_0x4b8b('0x37')){var _0x5df97b={};_0x5df97b[_0x2e9419[_0x4b8b('0x25')]]={'$like':'%'+_0x413456[_0x4b8b('0x2c')][_0x4b8b('0x38')]+'%'};return _0x5df97b;}})});}_0x3f1bd3=_[_0x4b8b('0x39')]({},_0x3f1bd3,_0x413456[_0x4b8b('0x3a')]);var _0x2d9c2a={'where':_0x3f1bd3[_0x4b8b('0x34')]};return db['Automation'][_0x4b8b('0x1b')](_0x2d9c2a)[_0x4b8b('0x3b')](function(_0x2bc4a1){_0x1fe0e7[_0x4b8b('0x1b')]=_0x2bc4a1;if(_0x413456[_0x4b8b('0x2c')][_0x4b8b('0x3c')]){_0x3f1bd3['include']=[{'all':!![]}];}return db[_0x4b8b('0x29')]['findAll'](_0x3f1bd3);})['then'](function(_0x1a3288){_0x1fe0e7['rows']=_0x1a3288;return _0x1fe0e7;})[_0x4b8b('0x3b')](respondWithFilteredResult(_0x158b59,_0x3f1bd3))[_0x4b8b('0x3d')](handleError(_0x158b59,null));};exports[_0x4b8b('0x3e')]=function(_0xd6a59b,_0x5483ed){var _0xbec1b9={'raw':![],'where':{'id':_0xd6a59b['params']['id']}},_0x318e8c={};_0x318e8c[_0x4b8b('0x2e')]=_['keys'](db[_0x4b8b('0x29')][_0x4b8b('0x3f')]);_0x318e8c[_0x4b8b('0x2c')]=_[_0x4b8b('0x2d')](_0xd6a59b[_0x4b8b('0x2c')]);_0x318e8c['filters']=_['intersection'](_0x318e8c[_0x4b8b('0x2e')],_0x318e8c[_0x4b8b('0x2c')]);_0xbec1b9[_0x4b8b('0x2f')]=_[_0x4b8b('0x40')](_0x318e8c[_0x4b8b('0x2e')],qs[_0x4b8b('0x30')](_0xd6a59b[_0x4b8b('0x2c')][_0x4b8b('0x30')]));_0xbec1b9[_0x4b8b('0x2f')]=_0xbec1b9['attributes'][_0x4b8b('0x31')]?_0xbec1b9[_0x4b8b('0x2f')]:_0x318e8c[_0x4b8b('0x2e')];if(_0xd6a59b['query'][_0x4b8b('0x3c')]){_0xbec1b9['include']=[{'all':!![]}];}_0xbec1b9=_[_0x4b8b('0x39')]({},_0xbec1b9,_0xd6a59b[_0x4b8b('0x3a')]);return db[_0x4b8b('0x29')]['find'](_0xbec1b9)[_0x4b8b('0x3b')](handleEntityNotFound(_0x5483ed,null))['then'](respondWithResult(_0x5483ed,null))['catch'](handleError(_0x5483ed,null));};exports[_0x4b8b('0x41')]=function(_0x54da42,_0x36c580){return db[_0x4b8b('0x29')][_0x4b8b('0x41')](_0x54da42[_0x4b8b('0x42')],{})[_0x4b8b('0x3b')](respondWithResult(_0x36c580,0xc9))['catch'](handleError(_0x36c580,null));};exports[_0x4b8b('0x43')]=function(_0x28eee2,_0x49c2a5){if(_0x28eee2[_0x4b8b('0x42')]['id']){delete _0x28eee2[_0x4b8b('0x42')]['id'];}return db[_0x4b8b('0x29')]['find']({'where':{'id':_0x28eee2['params']['id']}})[_0x4b8b('0x3b')](handleEntityNotFound(_0x49c2a5,null))[_0x4b8b('0x3b')](saveUpdates(_0x28eee2[_0x4b8b('0x42')],null))[_0x4b8b('0x3b')](respondWithResult(_0x49c2a5,null))[_0x4b8b('0x3d')](handleError(_0x49c2a5,null));};exports[_0x4b8b('0x22')]=function(_0x4b19ad,_0xb823b0){return db['Automation'][_0x4b8b('0x44')]({'where':{'id':_0x4b19ad[_0x4b8b('0x45')]['id']}})[_0x4b8b('0x3b')](handleEntityNotFound(_0xb823b0,null))[_0x4b8b('0x3b')](removeEntity(_0xb823b0,null))[_0x4b8b('0x3d')](handleError(_0xb823b0,null));};exports[_0x4b8b('0x46')]=function(_0x28b82d,_0x8126ed,_0x4acffd){return db[_0x4b8b('0x47')][_0x4b8b('0x44')]({'where':{'id':_0x28b82d[_0x4b8b('0x45')]['id']}})[_0x4b8b('0x3b')](handleEntityNotFound(_0x8126ed,null))['then'](function(_0x4cddf6){if(_0x4cddf6){return _0x4cddf6['addConditions'](_0x28b82d[_0x4b8b('0x42')][_0x4b8b('0x48')],_[_0x4b8b('0x49')](_0x28b82d['body'],['ids','id'])||{});}})[_0x4b8b('0x3b')](respondWithResult(_0x8126ed,null))['catch'](handleError(_0x8126ed,null));};exports[_0x4b8b('0x4a')]=function(_0x1bdbd6,_0x31896c,_0x1ae4fe){var _0x39b279={};var _0x284353={};var _0x3fcbc2;var _0x1a4dc8;return db[_0x4b8b('0x29')][_0x4b8b('0x4b')]({'where':{'id':_0x1bdbd6[_0x4b8b('0x45')]['id']}})[_0x4b8b('0x3b')](handleEntityNotFound(_0x31896c,null))['then'](function(_0x7a1093){if(_0x7a1093){_0x3fcbc2=_0x7a1093;_0x284353[_0x4b8b('0x2e')]=_[_0x4b8b('0x2d')](db[_0x4b8b('0x47')][_0x4b8b('0x3f')]);_0x284353['query']=_[_0x4b8b('0x2d')](_0x1bdbd6[_0x4b8b('0x2c')]);_0x284353[_0x4b8b('0x35')]=_[_0x4b8b('0x40')](_0x284353[_0x4b8b('0x2e')],_0x284353[_0x4b8b('0x2c')]);_0x39b279[_0x4b8b('0x2f')]=_[_0x4b8b('0x40')](_0x284353[_0x4b8b('0x2e')],qs[_0x4b8b('0x30')](_0x1bdbd6['query'][_0x4b8b('0x30')]));_0x39b279[_0x4b8b('0x2f')]=_0x39b279[_0x4b8b('0x2f')][_0x4b8b('0x31')]?_0x39b279['attributes']:_0x284353['model'];_0x39b279[_0x4b8b('0x4c')]=qs[_0x4b8b('0x4d')](_0x1bdbd6['query'][_0x4b8b('0x4d')]);_0x39b279[_0x4b8b('0x34')]=qs[_0x4b8b('0x35')](_[_0x4b8b('0x36')](_0x1bdbd6[_0x4b8b('0x2c')],_0x284353[_0x4b8b('0x35')]));if(_0x1bdbd6['query'][_0x4b8b('0x38')]){_0x39b279[_0x4b8b('0x34')]=_[_0x4b8b('0x39')](_0x39b279[_0x4b8b('0x34')],{'$or':_[_0x4b8b('0x28')](_0x39b279[_0x4b8b('0x2f')],function(_0x401b57){var _0x10cb78={};_0x10cb78[_0x401b57]={'$like':'%'+_0x1bdbd6[_0x4b8b('0x2c')]['filter']+'%'};return _0x10cb78;})});}_0x39b279=_['merge']({},_0x39b279,_0x1bdbd6[_0x4b8b('0x3a')]);return _0x3fcbc2[_0x4b8b('0x4a')](_0x39b279);}})['then'](function(_0x550ce7){if(_0x550ce7){_0x1a4dc8=_0x550ce7[_0x4b8b('0x31')];if(!_0x1bdbd6['query'][_0x4b8b('0x4e')](_0x4b8b('0x32'))){_0x39b279[_0x4b8b('0x33')]=qs['limit'](_0x1bdbd6[_0x4b8b('0x2c')]['limit']);_0x39b279[_0x4b8b('0x1c')]=qs['offset'](_0x1bdbd6[_0x4b8b('0x2c')]['offset']);}return _0x3fcbc2[_0x4b8b('0x4a')](_0x39b279);}})[_0x4b8b('0x3b')](function(_0x2e9cb8){if(_0x2e9cb8){return _0x2e9cb8?{'count':_0x1a4dc8,'rows':_0x2e9cb8}:null;}})[_0x4b8b('0x3b')](respondWithResult(_0x31896c,null))['catch'](handleError(_0x31896c,null));};exports['addActions']=function(_0x4a4acc,_0x4cb674,_0x33f261){return db[_0x4b8b('0x4f')][_0x4b8b('0x44')]({'where':{'id':_0x4a4acc[_0x4b8b('0x45')]['id']}})[_0x4b8b('0x3b')](handleEntityNotFound(_0x4cb674,null))[_0x4b8b('0x3b')](function(_0x48801f){if(_0x48801f){return _0x48801f[_0x4b8b('0x50')](_0x4a4acc[_0x4b8b('0x42')][_0x4b8b('0x48')],_[_0x4b8b('0x49')](_0x4a4acc[_0x4b8b('0x42')],[_0x4b8b('0x48'),'id'])||{});}})[_0x4b8b('0x3b')](respondWithResult(_0x4cb674,null))[_0x4b8b('0x3d')](handleError(_0x4cb674,null));};exports['getActions']=function(_0x2e9a53,_0x186a48,_0x4ff1a6){var _0x489d2b={};var _0x2c3023={};var _0x37e623;var _0x30b680;return db[_0x4b8b('0x29')][_0x4b8b('0x4b')]({'where':{'id':_0x2e9a53[_0x4b8b('0x45')]['id']}})[_0x4b8b('0x3b')](handleEntityNotFound(_0x186a48,null))[_0x4b8b('0x3b')](function(_0x48cdde){if(_0x48cdde){_0x37e623=_0x48cdde;_0x2c3023[_0x4b8b('0x2e')]=_['keys'](db[_0x4b8b('0x4f')][_0x4b8b('0x3f')]);_0x2c3023['query']=_[_0x4b8b('0x2d')](_0x2e9a53[_0x4b8b('0x2c')]);_0x2c3023[_0x4b8b('0x35')]=_[_0x4b8b('0x40')](_0x2c3023[_0x4b8b('0x2e')],_0x2c3023['query']);_0x489d2b[_0x4b8b('0x2f')]=_[_0x4b8b('0x40')](_0x2c3023['model'],qs[_0x4b8b('0x30')](_0x2e9a53[_0x4b8b('0x2c')][_0x4b8b('0x30')]));_0x489d2b[_0x4b8b('0x2f')]=_0x489d2b[_0x4b8b('0x2f')][_0x4b8b('0x31')]?_0x489d2b[_0x4b8b('0x2f')]:_0x2c3023[_0x4b8b('0x2e')];_0x489d2b[_0x4b8b('0x4c')]=qs[_0x4b8b('0x4d')](_0x2e9a53[_0x4b8b('0x2c')][_0x4b8b('0x4d')]);_0x489d2b[_0x4b8b('0x34')]=qs[_0x4b8b('0x35')](_[_0x4b8b('0x36')](_0x2e9a53[_0x4b8b('0x2c')],_0x2c3023['filters']));if(_0x2e9a53[_0x4b8b('0x2c')][_0x4b8b('0x38')]){_0x489d2b[_0x4b8b('0x34')]=_[_0x4b8b('0x39')](_0x489d2b[_0x4b8b('0x34')],{'$or':_[_0x4b8b('0x28')](_0x489d2b[_0x4b8b('0x2f')],function(_0xd8e609){var _0x2c225d={};_0x2c225d[_0xd8e609]={'$like':'%'+_0x2e9a53['query'][_0x4b8b('0x38')]+'%'};return _0x2c225d;})});}_0x489d2b=_[_0x4b8b('0x39')]({},_0x489d2b,_0x2e9a53[_0x4b8b('0x3a')]);return _0x37e623[_0x4b8b('0x51')](_0x489d2b);}})['then'](function(_0x17b62d){if(_0x17b62d){_0x30b680=_0x17b62d['length'];if(!_0x2e9a53['query'][_0x4b8b('0x4e')](_0x4b8b('0x32'))){_0x489d2b[_0x4b8b('0x33')]=qs[_0x4b8b('0x33')](_0x2e9a53[_0x4b8b('0x2c')][_0x4b8b('0x33')]);_0x489d2b['offset']=qs[_0x4b8b('0x1c')](_0x2e9a53[_0x4b8b('0x2c')]['offset']);}return _0x37e623[_0x4b8b('0x51')](_0x489d2b);}})[_0x4b8b('0x3b')](function(_0x1a709a){if(_0x1a709a){return _0x1a709a?{'count':_0x30b680,'rows':_0x1a709a}:null;}})[_0x4b8b('0x3b')](respondWithResult(_0x186a48,null))[_0x4b8b('0x3d')](handleError(_0x186a48,null));}; \ No newline at end of file +var _0x68f2=['order','hasOwnProperty','addActions','omit','Action','getActions','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','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/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','Automation','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','addConditions','Condition','ids','getConditions','findOne'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x68f2,0x1b4));var _0x268f=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x68f2[_0x12d033];return _0x3b4e80;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x268f('0x0'));var zipdir=require(_0x268f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x268f('0x2'));var moment=require(_0x268f('0x3'));var BPromise=require(_0x268f('0x4'));var Mustache=require(_0x268f('0x5'));var util=require(_0x268f('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x268f('0x7'));var ejs=require(_0x268f('0x8'));var fs=require('fs');var fs_extra=require(_0x268f('0x9'));var _=require(_0x268f('0xa'));var squel=require(_0x268f('0xb'));var crypto=require(_0x268f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x268f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x268f('0xe'));var Papa=require(_0x268f('0xf'));var Redis=require(_0x268f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x268f('0x11'));var as=require(_0x268f('0x12'));var hardwareService=require(_0x268f('0x13'));var logger=require(_0x268f('0x14'))(_0x268f('0x15'));var utils=require(_0x268f('0x16'));var config=require(_0x268f('0x17'));var licenseUtil=require(_0x268f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3eaa,_0xec56b0){_0xec56b0=_0xec56b0||0xcc;return function(_0x302719){if(_0x302719){return _0x3eaa[_0x268f('0x19')](_0xec56b0);}return _0x3eaa[_0x268f('0x1a')](_0xec56b0)[_0x268f('0x1b')]();};}function respondWithResult(_0x13ceaa,_0x53e6fc){_0x53e6fc=_0x53e6fc||0xc8;return function(_0x59b19d){if(_0x59b19d){return _0x13ceaa[_0x268f('0x1a')](_0x53e6fc)['json'](_0x59b19d);}};}function respondWithFilteredResult(_0x4b0d02,_0x315d7d){return function(_0xd01f57){if(_0xd01f57){var _0x37a3a9=typeof _0x315d7d['offset']===_0x268f('0x1c')&&typeof _0x315d7d[_0x268f('0x1d')]===_0x268f('0x1c');var _0x59bb8e=_0xd01f57[_0x268f('0x1e')];var _0x1897b7=_0x37a3a9?0x0:_0x315d7d[_0x268f('0x1f')];var _0x79eae5=_0x37a3a9?_0xd01f57[_0x268f('0x1e')]:_0x315d7d[_0x268f('0x1f')]+_0x315d7d[_0x268f('0x1d')];var _0x41d2ff;if(_0x79eae5>=_0x59bb8e){_0x79eae5=_0x59bb8e;_0x41d2ff=0xc8;}else{_0x41d2ff=0xce;}_0x4b0d02['status'](_0x41d2ff);return _0x4b0d02[_0x268f('0x20')](_0x268f('0x21'),_0x1897b7+'-'+_0x79eae5+'/'+_0x59bb8e)['json'](_0xd01f57);}return null;};}function patchUpdates(_0x359044){return function(_0x4ecd27){try{jsonpatch[_0x268f('0x22')](_0x4ecd27,_0x359044,!![]);}catch(_0xd03ebe){return BPromise[_0x268f('0x23')](_0xd03ebe);}return _0x4ecd27[_0x268f('0x24')]();};}function saveUpdates(_0x4c3e59,_0x167ff4){return function(_0x1e472d){if(_0x1e472d){return _0x1e472d[_0x268f('0x25')](_0x4c3e59)[_0x268f('0x26')](function(_0x385093){return _0x385093;});}return null;};}function removeEntity(_0x4793a3,_0x3ea423){return function(_0x16fa7d){if(_0x16fa7d){return _0x16fa7d[_0x268f('0x27')]()[_0x268f('0x26')](function(){_0x4793a3[_0x268f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b51d9,_0x57d1f1){return function(_0x3875f6){if(!_0x3875f6){_0x3b51d9[_0x268f('0x19')](0x194);}return _0x3875f6;};}function handleError(_0x3cb9f1,_0xb08117){_0xb08117=_0xb08117||0x1f4;return function(_0x178d7e){logger['error'](_0x178d7e[_0x268f('0x28')]);if(_0x178d7e[_0x268f('0x29')]){delete _0x178d7e['name'];}_0x3cb9f1[_0x268f('0x1a')](_0xb08117)['send'](_0x178d7e);};}exports[_0x268f('0x2a')]=function(_0x4b3808,_0x5b6438){var _0xf455da={},_0x2e0b1e={},_0x59b081={'count':0x0,'rows':[]};var _0x3fd7cf=_[_0x268f('0x2b')](db[_0x268f('0x2c')][_0x268f('0x2d')],function(_0x4450ee){return{'name':_0x4450ee[_0x268f('0x2e')],'type':_0x4450ee[_0x268f('0x2f')][_0x268f('0x30')]};});_0x2e0b1e['model']=_['map'](_0x3fd7cf,'name');_0x2e0b1e[_0x268f('0x31')]=_[_0x268f('0x32')](_0x4b3808[_0x268f('0x31')]);_0x2e0b1e['filters']=_[_0x268f('0x33')](_0x2e0b1e['model'],_0x2e0b1e['query']);_0xf455da[_0x268f('0x34')]=_[_0x268f('0x33')](_0x2e0b1e[_0x268f('0x35')],qs[_0x268f('0x36')](_0x4b3808['query']['fields']));_0xf455da[_0x268f('0x34')]=_0xf455da[_0x268f('0x34')][_0x268f('0x37')]?_0xf455da[_0x268f('0x34')]:_0x2e0b1e[_0x268f('0x35')];if(!_0x4b3808[_0x268f('0x31')]['hasOwnProperty'](_0x268f('0x38'))){_0xf455da['limit']=qs[_0x268f('0x1d')](_0x4b3808[_0x268f('0x31')][_0x268f('0x1d')]);_0xf455da['offset']=qs['offset'](_0x4b3808[_0x268f('0x31')][_0x268f('0x1f')]);}_0xf455da['order']=qs[_0x268f('0x39')](_0x4b3808[_0x268f('0x31')][_0x268f('0x39')]);_0xf455da[_0x268f('0x3a')]=qs[_0x268f('0x3b')](_[_0x268f('0x3c')](_0x4b3808['query'],_0x2e0b1e['filters']),_0x3fd7cf);if(_0x4b3808['query'][_0x268f('0x3d')]){_0xf455da[_0x268f('0x3a')]=_[_0x268f('0x3e')](_0xf455da[_0x268f('0x3a')],{'$or':_[_0x268f('0x2b')](_0x3fd7cf,function(_0x4d9f8e){if(_0x4d9f8e[_0x268f('0x2f')]!==_0x268f('0x3f')){var _0x33f293={};_0x33f293[_0x4d9f8e[_0x268f('0x29')]]={'$like':'%'+_0x4b3808[_0x268f('0x31')][_0x268f('0x3d')]+'%'};return _0x33f293;}})});}_0xf455da=_[_0x268f('0x3e')]({},_0xf455da,_0x4b3808[_0x268f('0x40')]);var _0x4178e1={'where':_0xf455da['where']};return db['Automation']['count'](_0x4178e1)[_0x268f('0x26')](function(_0x3e0b17){_0x59b081[_0x268f('0x1e')]=_0x3e0b17;if(_0x4b3808[_0x268f('0x31')][_0x268f('0x41')]){_0xf455da[_0x268f('0x42')]=[{'all':!![]}];}return db[_0x268f('0x2c')][_0x268f('0x43')](_0xf455da);})[_0x268f('0x26')](function(_0x5b4c17){_0x59b081[_0x268f('0x44')]=_0x5b4c17;return _0x59b081;})[_0x268f('0x26')](respondWithFilteredResult(_0x5b6438,_0xf455da))[_0x268f('0x45')](handleError(_0x5b6438,null));};exports[_0x268f('0x46')]=function(_0x1ac90f,_0x710c72){var _0x7eb11f={'raw':![],'where':{'id':_0x1ac90f[_0x268f('0x47')]['id']}},_0x1728b5={};_0x1728b5[_0x268f('0x35')]=_['keys'](db[_0x268f('0x2c')][_0x268f('0x2d')]);_0x1728b5['query']=_['keys'](_0x1ac90f[_0x268f('0x31')]);_0x1728b5['filters']=_[_0x268f('0x33')](_0x1728b5[_0x268f('0x35')],_0x1728b5['query']);_0x7eb11f['attributes']=_[_0x268f('0x33')](_0x1728b5['model'],qs['fields'](_0x1ac90f['query'][_0x268f('0x36')]));_0x7eb11f['attributes']=_0x7eb11f[_0x268f('0x34')]['length']?_0x7eb11f[_0x268f('0x34')]:_0x1728b5[_0x268f('0x35')];if(_0x1ac90f[_0x268f('0x31')]['includeAll']){_0x7eb11f[_0x268f('0x42')]=[{'all':!![]}];}_0x7eb11f=_[_0x268f('0x3e')]({},_0x7eb11f,_0x1ac90f['options']);return db[_0x268f('0x2c')][_0x268f('0x48')](_0x7eb11f)[_0x268f('0x26')](handleEntityNotFound(_0x710c72,null))[_0x268f('0x26')](respondWithResult(_0x710c72,null))[_0x268f('0x45')](handleError(_0x710c72,null));};exports[_0x268f('0x49')]=function(_0x7cdf6b,_0x181dfb){return db[_0x268f('0x2c')][_0x268f('0x49')](_0x7cdf6b[_0x268f('0x4a')],{})[_0x268f('0x26')](respondWithResult(_0x181dfb,0xc9))['catch'](handleError(_0x181dfb,null));};exports[_0x268f('0x25')]=function(_0x3225b4,_0x4f8783){if(_0x3225b4[_0x268f('0x4a')]['id']){delete _0x3225b4[_0x268f('0x4a')]['id'];}return db[_0x268f('0x2c')][_0x268f('0x48')]({'where':{'id':_0x3225b4[_0x268f('0x47')]['id']}})['then'](handleEntityNotFound(_0x4f8783,null))['then'](saveUpdates(_0x3225b4[_0x268f('0x4a')],null))[_0x268f('0x26')](respondWithResult(_0x4f8783,null))[_0x268f('0x45')](handleError(_0x4f8783,null));};exports[_0x268f('0x27')]=function(_0x4c7033,_0x53d857){return db['Automation'][_0x268f('0x48')]({'where':{'id':_0x4c7033[_0x268f('0x47')]['id']}})[_0x268f('0x26')](handleEntityNotFound(_0x53d857,null))[_0x268f('0x26')](removeEntity(_0x53d857,null))[_0x268f('0x45')](handleError(_0x53d857,null));};exports[_0x268f('0x4b')]=function(_0x1a0494,_0x1fe275,_0x2b6c20){return db[_0x268f('0x4c')][_0x268f('0x48')]({'where':{'id':_0x1a0494[_0x268f('0x47')]['id']}})['then'](handleEntityNotFound(_0x1fe275,null))['then'](function(_0x297849){if(_0x297849){return _0x297849[_0x268f('0x4b')](_0x1a0494[_0x268f('0x4a')][_0x268f('0x4d')],_['omit'](_0x1a0494[_0x268f('0x4a')],[_0x268f('0x4d'),'id'])||{});}})[_0x268f('0x26')](respondWithResult(_0x1fe275,null))[_0x268f('0x45')](handleError(_0x1fe275,null));};exports[_0x268f('0x4e')]=function(_0x1e0d85,_0x508727,_0x471986){var _0x518635={};var _0x30556a={};var _0x51fd49;var _0x44a8d7;return db['Automation'][_0x268f('0x4f')]({'where':{'id':_0x1e0d85[_0x268f('0x47')]['id']}})[_0x268f('0x26')](handleEntityNotFound(_0x508727,null))[_0x268f('0x26')](function(_0x565e88){if(_0x565e88){_0x51fd49=_0x565e88;_0x30556a[_0x268f('0x35')]=_[_0x268f('0x32')](db['Condition'][_0x268f('0x2d')]);_0x30556a[_0x268f('0x31')]=_[_0x268f('0x32')](_0x1e0d85['query']);_0x30556a[_0x268f('0x3b')]=_[_0x268f('0x33')](_0x30556a['model'],_0x30556a[_0x268f('0x31')]);_0x518635[_0x268f('0x34')]=_[_0x268f('0x33')](_0x30556a[_0x268f('0x35')],qs[_0x268f('0x36')](_0x1e0d85[_0x268f('0x31')][_0x268f('0x36')]));_0x518635[_0x268f('0x34')]=_0x518635[_0x268f('0x34')][_0x268f('0x37')]?_0x518635[_0x268f('0x34')]:_0x30556a[_0x268f('0x35')];_0x518635[_0x268f('0x50')]=qs[_0x268f('0x39')](_0x1e0d85['query'][_0x268f('0x39')]);_0x518635['where']=qs[_0x268f('0x3b')](_[_0x268f('0x3c')](_0x1e0d85['query'],_0x30556a[_0x268f('0x3b')]));if(_0x1e0d85[_0x268f('0x31')][_0x268f('0x3d')]){_0x518635[_0x268f('0x3a')]=_['merge'](_0x518635['where'],{'$or':_['map'](_0x518635[_0x268f('0x34')],function(_0x17d146){var _0x3179c7={};_0x3179c7[_0x17d146]={'$like':'%'+_0x1e0d85[_0x268f('0x31')][_0x268f('0x3d')]+'%'};return _0x3179c7;})});}_0x518635=_['merge']({},_0x518635,_0x1e0d85[_0x268f('0x40')]);return _0x51fd49['getConditions'](_0x518635);}})[_0x268f('0x26')](function(_0x5c22ad){if(_0x5c22ad){_0x44a8d7=_0x5c22ad['length'];if(!_0x1e0d85['query'][_0x268f('0x51')](_0x268f('0x38'))){_0x518635[_0x268f('0x1d')]=qs[_0x268f('0x1d')](_0x1e0d85[_0x268f('0x31')][_0x268f('0x1d')]);_0x518635[_0x268f('0x1f')]=qs[_0x268f('0x1f')](_0x1e0d85['query']['offset']);}return _0x51fd49[_0x268f('0x4e')](_0x518635);}})['then'](function(_0x1ed14c){if(_0x1ed14c){return _0x1ed14c?{'count':_0x44a8d7,'rows':_0x1ed14c}:null;}})[_0x268f('0x26')](respondWithResult(_0x508727,null))[_0x268f('0x45')](handleError(_0x508727,null));};exports[_0x268f('0x52')]=function(_0x536adc,_0x542cae,_0x19858a){return db['Action'][_0x268f('0x48')]({'where':{'id':_0x536adc[_0x268f('0x47')]['id']}})['then'](handleEntityNotFound(_0x542cae,null))['then'](function(_0x38e5bf){if(_0x38e5bf){return _0x38e5bf[_0x268f('0x52')](_0x536adc[_0x268f('0x4a')][_0x268f('0x4d')],_[_0x268f('0x53')](_0x536adc[_0x268f('0x4a')],[_0x268f('0x4d'),'id'])||{});}})['then'](respondWithResult(_0x542cae,null))[_0x268f('0x45')](handleError(_0x542cae,null));};exports['getActions']=function(_0x34da6e,_0x480e31,_0x13af3c){var _0x1d6c0a={};var _0x4709de={};var _0x4748ba;var _0xb37e67;return db[_0x268f('0x2c')][_0x268f('0x4f')]({'where':{'id':_0x34da6e[_0x268f('0x47')]['id']}})[_0x268f('0x26')](handleEntityNotFound(_0x480e31,null))[_0x268f('0x26')](function(_0x4aef8a){if(_0x4aef8a){_0x4748ba=_0x4aef8a;_0x4709de[_0x268f('0x35')]=_[_0x268f('0x32')](db[_0x268f('0x54')][_0x268f('0x2d')]);_0x4709de[_0x268f('0x31')]=_[_0x268f('0x32')](_0x34da6e[_0x268f('0x31')]);_0x4709de[_0x268f('0x3b')]=_['intersection'](_0x4709de[_0x268f('0x35')],_0x4709de[_0x268f('0x31')]);_0x1d6c0a['attributes']=_['intersection'](_0x4709de['model'],qs[_0x268f('0x36')](_0x34da6e['query']['fields']));_0x1d6c0a[_0x268f('0x34')]=_0x1d6c0a[_0x268f('0x34')][_0x268f('0x37')]?_0x1d6c0a['attributes']:_0x4709de[_0x268f('0x35')];_0x1d6c0a[_0x268f('0x50')]=qs[_0x268f('0x39')](_0x34da6e[_0x268f('0x31')]['sort']);_0x1d6c0a[_0x268f('0x3a')]=qs[_0x268f('0x3b')](_['pick'](_0x34da6e['query'],_0x4709de[_0x268f('0x3b')]));if(_0x34da6e[_0x268f('0x31')][_0x268f('0x3d')]){_0x1d6c0a['where']=_['merge'](_0x1d6c0a[_0x268f('0x3a')],{'$or':_['map'](_0x1d6c0a[_0x268f('0x34')],function(_0x2f0c5c){var _0x16609c={};_0x16609c[_0x2f0c5c]={'$like':'%'+_0x34da6e[_0x268f('0x31')][_0x268f('0x3d')]+'%'};return _0x16609c;})});}_0x1d6c0a=_[_0x268f('0x3e')]({},_0x1d6c0a,_0x34da6e[_0x268f('0x40')]);return _0x4748ba[_0x268f('0x55')](_0x1d6c0a);}})[_0x268f('0x26')](function(_0x439f8f){if(_0x439f8f){_0xb37e67=_0x439f8f[_0x268f('0x37')];if(!_0x34da6e[_0x268f('0x31')]['hasOwnProperty'](_0x268f('0x38'))){_0x1d6c0a[_0x268f('0x1d')]=qs[_0x268f('0x1d')](_0x34da6e[_0x268f('0x31')][_0x268f('0x1d')]);_0x1d6c0a[_0x268f('0x1f')]=qs[_0x268f('0x1f')](_0x34da6e['query'][_0x268f('0x1f')]);}return _0x4748ba[_0x268f('0x55')](_0x1d6c0a);}})['then'](function(_0x46c76f){if(_0x46c76f){return _0x46c76f?{'count':_0xb37e67,'rows':_0x46c76f}:null;}})[_0x268f('0x26')](respondWithResult(_0x480e31,null))[_0x268f('0x45')](handleError(_0x480e31,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 17bed9d..0c38671 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 _0xc429=['api','moment','bluebird','rimraf','../../config/environment','./automation.attributes','exports','define','lodash','util'];(function(_0x1b89fd,_0x106d96){var _0x21aadb=function(_0x3e4377){while(--_0x3e4377){_0x1b89fd['push'](_0x1b89fd['shift']());}};_0x21aadb(++_0x106d96);}(_0xc429,0x184));var _0x9c42=function(_0x2525f1,_0x47034f){_0x2525f1=_0x2525f1-0x0;var _0x13c1b5=_0xc429[_0x2525f1];return _0x13c1b5;};'use strict';var _=require(_0x9c42('0x0'));var util=require(_0x9c42('0x1'));var logger=require('../../config/logger')(_0x9c42('0x2'));var moment=require(_0x9c42('0x3'));var BPromise=require(_0x9c42('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9c42('0x5'));var config=require(_0x9c42('0x6'));var attributes=require(_0x9c42('0x7'));module[_0x9c42('0x8')]=function(_0x56139f,_0x2cce7c){return _0x56139f[_0x9c42('0x9')]('Automation',attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf36=['exports','define','Automation','tools_automations','moment','request-promise','path','./automation.attributes'];(function(_0x1eab4a,_0x1aebee){var _0x10b991=function(_0x416dba){while(--_0x416dba){_0x1eab4a['push'](_0x1eab4a['shift']());}};_0x10b991(++_0x1aebee);}(_0xaf36,0xb4));var _0x6af3=function(_0x127a60,_0x37f33a){_0x127a60=_0x127a60-0x0;var _0xc1f6a3=_0xaf36[_0x127a60];return _0xc1f6a3;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x6af3('0x0'));var BPromise=require('bluebird');var rp=require(_0x6af3('0x1'));var fs=require('fs');var path=require(_0x6af3('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6af3('0x3'));module[_0x6af3('0x4')]=function(_0x4ac981,_0x23d387){return _0x4ac981[_0x6af3('0x5')](_0x6af3('0x6'),attributes,{'tableName':_0x6af3('0x7'),'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 3146461..84bb1a4 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 _0xa413=['result','catch','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s','message','info'];(function(_0x761b6d,_0x7c7fa8){var _0x3a1639=function(_0x33b90a){while(--_0x33b90a){_0x761b6d['push'](_0x761b6d['shift']());}};_0x3a1639(++_0x7c7fa8);}(_0xa413,0x1e5));var _0x3a41=function(_0x2bf41b,_0x3f739c){_0x2bf41b=_0x2bf41b-0x0;var _0x5627ab=_0xa413[_0x2bf41b];return _0x5627ab;};'use strict';var _=require(_0x3a41('0x0'));var util=require('util');var moment=require(_0x3a41('0x1'));var BPromise=require('bluebird');var rs=require(_0x3a41('0x2'));var fs=require('fs');var Redis=require(_0x3a41('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3a41('0x4'))(_0x3a41('0x5'));var config=require(_0x3a41('0x6'));var jayson=require(_0x3a41('0x7'));var client=jayson[_0x3a41('0x8')][_0x3a41('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45f6d2,_0x407d52,_0xca7253){return new BPromise(function(_0x473cd2,_0x27c2e5){return client['request'](_0x45f6d2,_0xca7253)[_0x3a41('0xa')](function(_0x570304){logger['info']('Automation,\x20%s,\x20%s',_0x407d52,_0x3a41('0xb'));logger['debug'](_0x3a41('0xc'),_0x407d52,'request\x20sent',JSON[_0x3a41('0xd')](_0x570304));if(_0x570304[_0x3a41('0xe')]){if(_0x570304['error'][_0x3a41('0xf')]===0x1f4){logger[_0x3a41('0xe')](_0x3a41('0x10'),_0x407d52,_0x570304[_0x3a41('0xe')][_0x3a41('0x11')]);return _0x27c2e5(_0x570304['error'][_0x3a41('0x11')]);}logger[_0x3a41('0xe')](_0x3a41('0x10'),_0x407d52,_0x570304[_0x3a41('0xe')][_0x3a41('0x11')]);return _0x473cd2(_0x570304[_0x3a41('0xe')][_0x3a41('0x11')]);}else{logger[_0x3a41('0x12')](_0x3a41('0x10'),_0x407d52,_0x3a41('0xb'));_0x473cd2(_0x570304[_0x3a41('0x13')]['message']);}})[_0x3a41('0x14')](function(_0x30d675){logger['error']('Automation,\x20%s,\x20%s',_0x407d52,_0x30d675);_0x27c2e5(_0x30d675);});});} \ No newline at end of file +var _0x2f56=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x1e55d9,_0x5ce14a){var _0x6dc799=function(_0x383e7b){while(--_0x383e7b){_0x1e55d9['push'](_0x1e55d9['shift']());}};_0x6dc799(++_0x5ce14a);}(_0x2f56,0xb5));var _0x62f5=function(_0x40d8f2,_0x303920){_0x40d8f2=_0x40d8f2-0x0;var _0x32d122=_0x2f56[_0x40d8f2];return _0x32d122;};'use strict';var _=require(_0x62f5('0x0'));var util=require(_0x62f5('0x1'));var moment=require(_0x62f5('0x2'));var BPromise=require(_0x62f5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x62f5('0x4'));var db=require(_0x62f5('0x5'))['db'];var utils=require(_0x62f5('0x6'));var logger=require(_0x62f5('0x7'))(_0x62f5('0x8'));var config=require('../../config/environment');var jayson=require(_0x62f5('0x9'));var client=jayson[_0x62f5('0xa')][_0x62f5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x387150,_0x58ae99,_0x3ee814){return new BPromise(function(_0xc11beb,_0x505bfd){return client[_0x62f5('0xc')](_0x387150,_0x3ee814)[_0x62f5('0xd')](function(_0x4a3621){logger[_0x62f5('0xe')](_0x62f5('0xf'),_0x58ae99,_0x62f5('0x10'));logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0x58ae99,_0x62f5('0x10'),JSON[_0x62f5('0x11')](_0x4a3621));if(_0x4a3621[_0x62f5('0x12')]){if(_0x4a3621[_0x62f5('0x12')][_0x62f5('0x13')]===0x1f4){logger[_0x62f5('0x12')](_0x62f5('0xf'),_0x58ae99,_0x4a3621['error'][_0x62f5('0x14')]);return _0x505bfd(_0x4a3621['error'][_0x62f5('0x14')]);}logger[_0x62f5('0x12')](_0x62f5('0xf'),_0x58ae99,_0x4a3621[_0x62f5('0x12')]['message']);return _0xc11beb(_0x4a3621[_0x62f5('0x12')]['message']);}else{logger[_0x62f5('0xe')](_0x62f5('0xf'),_0x58ae99,_0x62f5('0x10'));_0xc11beb(_0x4a3621[_0x62f5('0x15')][_0x62f5('0x14')]);}})[_0x62f5('0x16')](function(_0x2756cb){logger[_0x62f5('0x12')]('Automation,\x20%s,\x20%s',_0x58ae99,_0x2756cb);_0x505bfd(_0x2756cb);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index dca53da..755f971 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 _0x2fb5=['post','put','update','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','get','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','create','addConditions'];(function(_0x2f8805,_0x2f1d21){var _0xa16375=function(_0x1c5bcc){while(--_0x1c5bcc){_0x2f8805['push'](_0x2f8805['shift']());}};_0xa16375(++_0x2f1d21);}(_0x2fb5,0xff));var _0x52fb=function(_0x4eec9b,_0x4aea09){_0x4eec9b=_0x4eec9b-0x0;var _0x2e3849=_0x2fb5[_0x4eec9b];return _0x2e3849;};'use strict';var multer=require(_0x52fb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x52fb('0x1'));var express=require(_0x52fb('0x2'));var router=express[_0x52fb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x52fb('0x4'));var interaction=require(_0x52fb('0x5'));var config=require(_0x52fb('0x6'));var controller=require(_0x52fb('0x7'));router['get']('/',auth[_0x52fb('0x8')](),controller['index']);router[_0x52fb('0x9')](_0x52fb('0xa'),auth[_0x52fb('0x8')](),controller[_0x52fb('0xb')]);router[_0x52fb('0x9')](_0x52fb('0xc'),auth['isAuthenticated'](),controller[_0x52fb('0xd')]);router['get'](_0x52fb('0xe'),auth[_0x52fb('0x8')](),controller[_0x52fb('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x52fb('0x10')]);router['post'](_0x52fb('0xc'),auth['isAuthenticated'](),controller[_0x52fb('0x11')]);router[_0x52fb('0x12')](_0x52fb('0xe'),auth[_0x52fb('0x8')](),controller['addActions']);router[_0x52fb('0x13')](_0x52fb('0xa'),auth[_0x52fb('0x8')](),controller[_0x52fb('0x14')]);router['delete'](_0x52fb('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbe27=['get','show','/:id/conditions','getConditions','/:id/actions','getActions','post','addConditions','addActions','put','/:id','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','index'];(function(_0x33418c,_0x342219){var _0x1d2264=function(_0x379fed){while(--_0x379fed){_0x33418c['push'](_0x33418c['shift']());}};_0x1d2264(++_0x342219);}(_0xbe27,0x12d));var _0x7be2=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xbe27[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require('multer');var util=require(_0x7be2('0x0'));var path=require(_0x7be2('0x1'));var timeout=require('connect-timeout');var express=require(_0x7be2('0x2'));var router=express[_0x7be2('0x3')]();var fs_extra=require(_0x7be2('0x4'));var auth=require(_0x7be2('0x5'));var interaction=require(_0x7be2('0x6'));var config=require(_0x7be2('0x7'));var controller=require(_0x7be2('0x8'));router['get']('/',auth[_0x7be2('0x9')](),controller[_0x7be2('0xa')]);router[_0x7be2('0xb')]('/:id',auth[_0x7be2('0x9')](),controller[_0x7be2('0xc')]);router['get'](_0x7be2('0xd'),auth[_0x7be2('0x9')](),controller[_0x7be2('0xe')]);router[_0x7be2('0xb')](_0x7be2('0xf'),auth[_0x7be2('0x9')](),controller[_0x7be2('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x7be2('0x11')](_0x7be2('0xd'),auth[_0x7be2('0x9')](),controller[_0x7be2('0x12')]);router['post'](_0x7be2('0xf'),auth['isAuthenticated'](),controller[_0x7be2('0x13')]);router[_0x7be2('0x14')](_0x7be2('0x15'),auth[_0x7be2('0x9')](),controller[_0x7be2('0x16')]);router[_0x7be2('0x17')](_0x7be2('0x15'),auth['isAuthenticated'](),controller[_0x7be2('0x18')]);module[_0x7be2('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 2a6ec1e..663dc2e 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 _0x8f9d=['#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','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)'];(function(_0x3ffebc,_0x5c25a7){var _0x5346f4=function(_0xa1d3b2){while(--_0xa1d3b2){_0x3ffebc['push'](_0x3ffebc['shift']());}};_0x5346f4(++_0x5c25a7);}(_0x8f9d,0x1d6));var _0xd8f9=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8f9d[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0xd8f9('0x0'));module[_0xd8f9('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd8f9('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xd8f9('0x3')]('ivr'),'allowNull':![],'defaultValue':_0xd8f9('0x4')},'description':{'type':Sequelize[_0xd8f9('0x5')]},'active':{'type':Sequelize[_0xd8f9('0x6')],'defaultValue':0x0,'comment':_0xd8f9('0x7')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xd8f9('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xd8f9('0x9')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xd8f9('0xa')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xd8f9('0xa')](0x3)[_0xd8f9('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd8f9('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xd8f9('0xa')](0x5)[_0xd8f9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd8f9('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0xd8f9('0xa')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd8f9('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0xd8f9('0xa')](0x5)[_0xd8f9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd8f9('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd8f9('0x8')],'defaultValue':0x3,'comment':_0xd8f9('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd8f9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd8f9('0x10')},'dialGlobalMaxRetry':{'type':Sequelize[_0xd8f9('0xa')](0x3)[_0xd8f9('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xd8f9('0x11')},'dialTimezone':{'type':Sequelize[_0xd8f9('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xd8f9('0x5')],'defaultValue':_0xd8f9('0x12')},'dialCheckDuplicateType':{'type':Sequelize[_0xd8f9('0x3')](_0xd8f9('0x13'),'never',_0xd8f9('0x14')),'defaultValue':_0xd8f9('0x13')},'dialAMDActive':{'type':Sequelize[_0xd8f9('0x6')],'defaultValue':0x0,'comment':_0xd8f9('0x15')},'dialAMDInitialSilence':{'type':Sequelize[_0xd8f9('0xa')](0x9)[_0xd8f9('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xd8f9('0x16')},'dialAMDGreeting':{'type':Sequelize[_0xd8f9('0xa')](0x9)[_0xd8f9('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xd8f9('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xd8f9('0xa')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xd8f9('0xa')](0x9)[_0xd8f9('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xd8f9('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xd8f9('0xa')](0x9)[_0xd8f9('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xd8f9('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xd8f9('0xa')](0x9)[_0xd8f9('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xd8f9('0xa')](0x5)[_0xd8f9('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd8f9('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xd8f9('0xa')](0x9)[_0xd8f9('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xd8f9('0x3')]('DESC',_0xd8f9('0x1b')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xd8f9('0xa')](0x3)[_0xd8f9('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd8f9('0x1c')},'dialCutDigit':{'type':Sequelize[_0xd8f9('0xa')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd8f9('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd8f9('0xa')](0x3)[_0xd8f9('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd8f9('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xd8f9('0xa')](0x5)[_0xd8f9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xd8f9('0xa')](0x3)[_0xd8f9('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd8f9('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0xd8f9('0xa')](0x5)[_0xd8f9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd8f9('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xd8f9('0xa')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd8f9('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xd8f9('0xa')](0x5)[_0xd8f9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd8f9('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0xd8f9('0xa')](0x3)[_0xd8f9('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd8f9('0x23')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd8f9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd8f9('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xd8f9('0xa')](0x3)[_0xd8f9('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd8f9('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xd8f9('0xa')](0x5)[_0xd8f9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd8f9('0x26')}}; \ No newline at end of file +var _0x2b65=['ivr','BOOLEAN','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','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)','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)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM'];(function(_0x10f2d6,_0x2813e2){var _0x54eebb=function(_0x25dbb2){while(--_0x25dbb2){_0x10f2d6['push'](_0x10f2d6['shift']());}};_0x54eebb(++_0x2813e2);}(_0x2b65,0xc3));var _0x52b6=function(_0x334570,_0x23d405){_0x334570=_0x334570-0x0;var _0x45c6dc=_0x2b65[_0x334570];return _0x45c6dc;};'use strict';var Sequelize=require(_0x52b6('0x0'));module[_0x52b6('0x1')]={'name':{'type':Sequelize[_0x52b6('0x2')],'unique':_0x52b6('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x52b6('0x4')](_0x52b6('0x5')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x52b6('0x2')]},'active':{'type':Sequelize[_0x52b6('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x52b6('0x7')](0x4)[_0x52b6('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x52b6('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x52b6('0x7')](0x3)[_0x52b6('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x52b6('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x52b6('0x7')](0x3)[_0x52b6('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x52b6('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x52b6('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x52b6('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x52b6('0x7')](0x3)[_0x52b6('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x52b6('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x52b6('0x7')](0x5)[_0x52b6('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x52b6('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x52b6('0x7')](0x3)[_0x52b6('0x8')],'defaultValue':0x3,'comment':_0x52b6('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x52b6('0x7')](0x3)[_0x52b6('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x52b6('0xf')},'dialTimezone':{'type':Sequelize[_0x52b6('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x52b6('0x2')],'defaultValue':_0x52b6('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x52b6('0x4')](_0x52b6('0x11'),_0x52b6('0x12'),_0x52b6('0x13')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x52b6('0x6')],'defaultValue':0x0,'comment':_0x52b6('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x52b6('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x52b6('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x52b6('0x7')](0x9)[_0x52b6('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x52b6('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x52b6('0x7')](0x9)[_0x52b6('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x52b6('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x52b6('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x52b6('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0x52b6('0x7')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x52b6('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x52b6('0x7')](0x9)[_0x52b6('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x52b6('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x52b6('0x7')](0x9)[_0x52b6('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x52b6('0x1b')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x52b6('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x52b6('0x1c')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x52b6('0x7')](0x9)[_0x52b6('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x52b6('0x1d'),_0x52b6('0x1e')),'defaultValue':_0x52b6('0x1d')},'dialPrefix':{'type':Sequelize[_0x52b6('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x52b6('0x7')](0x3)[_0x52b6('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x52b6('0x1f')},'dialCutDigit':{'type':Sequelize[_0x52b6('0x7')](0x3)[_0x52b6('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x52b6('0x20')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x52b6('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x52b6('0x21')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x52b6('0x7')](0x5)[_0x52b6('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x52b6('0x22')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x52b6('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x52b6('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x52b6('0x23')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x52b6('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x52b6('0x24')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x52b6('0x7')](0x5)[_0x52b6('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x52b6('0x25')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x52b6('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x52b6('0x7')](0x3)[_0x52b6('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x52b6('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x52b6('0x7')](0x5)[_0x52b6('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x52b6('0x27')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index c9b5118..42e5218 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 _0xa1bf=['YYYY-MM-DD\x20HH:mm:ss','cm_hopper_black','removeBlackLists','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','save','then','destroy','get','IvrCampaigns','error','stack','name','send','index','map','Campaign','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','catch','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','keys','omit','createdAt','updatedAt','UserProfileResource','update','findOne','CmHopper','pick','rows','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','CampaignId','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','phone','scheduledAt','select','field','ContactId','toString','cm_contacts','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_hopper','fromQuery','ListId','NOW()','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','format'];(function(_0x4fad2c,_0x22cacc){var _0x1bb1b7=function(_0x4914a4){while(--_0x4914a4){_0x4fad2c['push'](_0x4fad2c['shift']());}};_0x1bb1b7(++_0x22cacc);}(_0xa1bf,0x91));var _0xfa1b=function(_0x513dde,_0x27b9c2){_0x513dde=_0x513dde-0x0;var _0x592532=_0xa1bf[_0x513dde];return _0x592532;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfa1b('0x0'));var zipdir=require(_0xfa1b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfa1b('0x2'));var moment=require(_0xfa1b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfa1b('0x4'));var util=require(_0xfa1b('0x5'));var path=require(_0xfa1b('0x6'));var sox=require('sox');var csv=require(_0xfa1b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa1b('0x8'));var _=require(_0xfa1b('0x9'));var squel=require(_0xfa1b('0xa'));var crypto=require(_0xfa1b('0xb'));var jsforce=require(_0xfa1b('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfa1b('0xd'));var Redis=require(_0xfa1b('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfa1b('0xf'));var hardwareService=require(_0xfa1b('0x10'));var logger=require('../../config/logger')(_0xfa1b('0x11'));var utils=require(_0xfa1b('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xfa1b('0x13'));var db=require(_0xfa1b('0x14'))['db'];function respondWithStatusCode(_0x48e55d,_0x1c5188){_0x1c5188=_0x1c5188||0xcc;return function(_0x495990){if(_0x495990){return _0x48e55d[_0xfa1b('0x15')](_0x1c5188);}return _0x48e55d[_0xfa1b('0x16')](_0x1c5188)[_0xfa1b('0x17')]();};}function respondWithResult(_0x5a4759,_0x5df8d5){_0x5df8d5=_0x5df8d5||0xc8;return function(_0x203e42){if(_0x203e42){return _0x5a4759[_0xfa1b('0x16')](_0x5df8d5)[_0xfa1b('0x18')](_0x203e42);}};}function respondWithFilteredResult(_0x22f72c,_0x34f8cf){return function(_0x4abc7e){if(_0x4abc7e){var _0xd7c372=typeof _0x34f8cf['offset']==='undefined'&&typeof _0x34f8cf['limit']===_0xfa1b('0x19');var _0x4afde3=_0x4abc7e[_0xfa1b('0x1a')];var _0x477f6d=_0xd7c372?0x0:_0x34f8cf['offset'];var _0xe79c2f=_0xd7c372?_0x4abc7e['count']:_0x34f8cf[_0xfa1b('0x1b')]+_0x34f8cf[_0xfa1b('0x1c')];var _0x4dab20;if(_0xe79c2f>=_0x4afde3){_0xe79c2f=_0x4afde3;_0x4dab20=0xc8;}else{_0x4dab20=0xce;}_0x22f72c[_0xfa1b('0x16')](_0x4dab20);return _0x22f72c[_0xfa1b('0x1d')]('Content-Range',_0x477f6d+'-'+_0xe79c2f+'/'+_0x4afde3)[_0xfa1b('0x18')](_0x4abc7e);}return null;};}function patchUpdates(_0x555a06){return function(_0x4be457){try{jsonpatch[_0xfa1b('0x1e')](_0x4be457,_0x555a06,!![]);}catch(_0x1a3453){return BPromise['reject'](_0x1a3453);}return _0x4be457[_0xfa1b('0x1f')]();};}function saveUpdates(_0x493051,_0x57783c){return function(_0x5a54d3){if(_0x5a54d3){return _0x5a54d3['update'](_0x493051)[_0xfa1b('0x20')](function(_0x517354){return _0x517354;});}return null;};}function removeEntity(_0xf2d345,_0xd753c7){return function(_0x124eaf){if(_0x124eaf){return _0x124eaf[_0xfa1b('0x21')]()[_0xfa1b('0x20')](function(){var _0x4a4560=_0x124eaf[_0xfa1b('0x22')]({'plain':!![]});var _0x3b32c3=_0xfa1b('0x23');return db['UserProfileResource'][_0xfa1b('0x21')]({'where':{'type':_0x3b32c3,'resourceId':_0x4a4560['id']}})['then'](function(){return _0x124eaf;});})[_0xfa1b('0x20')](function(){_0xf2d345['status'](0xcc)[_0xfa1b('0x17')]();});}};}function handleEntityNotFound(_0x454e1b,_0x46c651){return function(_0x467f02){if(!_0x467f02){_0x454e1b[_0xfa1b('0x15')](0x194);}return _0x467f02;};}function handleError(_0x451508,_0x10644b){_0x10644b=_0x10644b||0x1f4;return function(_0x55d028){logger[_0xfa1b('0x24')](_0x55d028[_0xfa1b('0x25')]);if(_0x55d028[_0xfa1b('0x26')]){delete _0x55d028[_0xfa1b('0x26')];}_0x451508[_0xfa1b('0x16')](_0x10644b)[_0xfa1b('0x27')](_0x55d028);};}exports[_0xfa1b('0x28')]=function(_0x27b5b8,_0x15d1fc){var _0x16d5ab={},_0x11a4dc={},_0x1b2bcf={'count':0x0,'rows':[]};var _0x3d8f55=_[_0xfa1b('0x29')](db[_0xfa1b('0x2a')][_0xfa1b('0x2b')],function(_0x2d9cd5){return{'name':_0x2d9cd5['fieldName'],'type':_0x2d9cd5[_0xfa1b('0x2c')][_0xfa1b('0x2d')]};});_0x11a4dc[_0xfa1b('0x2e')]=_[_0xfa1b('0x29')](_0x3d8f55,'name');_0x11a4dc[_0xfa1b('0x2f')]=_['keys'](_0x27b5b8['query']);_0x11a4dc[_0xfa1b('0x30')]=_[_0xfa1b('0x31')](_0x11a4dc[_0xfa1b('0x2e')],_0x11a4dc[_0xfa1b('0x2f')]);_0x16d5ab[_0xfa1b('0x32')]=_[_0xfa1b('0x31')](_0x11a4dc[_0xfa1b('0x2e')],qs[_0xfa1b('0x33')](_0x27b5b8[_0xfa1b('0x2f')][_0xfa1b('0x33')]));_0x16d5ab[_0xfa1b('0x32')]=_0x16d5ab['attributes'][_0xfa1b('0x34')]?_0x16d5ab[_0xfa1b('0x32')]:_0x11a4dc['model'];if(!_0x27b5b8[_0xfa1b('0x2f')][_0xfa1b('0x35')](_0xfa1b('0x36'))){_0x16d5ab[_0xfa1b('0x1c')]=qs[_0xfa1b('0x1c')](_0x27b5b8['query'][_0xfa1b('0x1c')]);_0x16d5ab[_0xfa1b('0x1b')]=qs[_0xfa1b('0x1b')](_0x27b5b8[_0xfa1b('0x2f')][_0xfa1b('0x1b')]);}_0x16d5ab[_0xfa1b('0x37')]=qs[_0xfa1b('0x38')](_0x27b5b8[_0xfa1b('0x2f')]['sort']);_0x16d5ab[_0xfa1b('0x39')]=qs[_0xfa1b('0x30')](_['pick'](_0x27b5b8[_0xfa1b('0x2f')],_0x11a4dc[_0xfa1b('0x30')]),_0x3d8f55);if(_0x27b5b8[_0xfa1b('0x2f')][_0xfa1b('0x3a')]){_0x16d5ab['where']=_[_0xfa1b('0x3b')](_0x16d5ab[_0xfa1b('0x39')],{'$or':_[_0xfa1b('0x29')](_0x3d8f55,function(_0x1a3b99){if(_0x1a3b99[_0xfa1b('0x2c')]!=='VIRTUAL'){var _0x21b588={};_0x21b588[_0x1a3b99[_0xfa1b('0x26')]]={'$like':'%'+_0x27b5b8[_0xfa1b('0x2f')][_0xfa1b('0x3a')]+'%'};return _0x21b588;}})});}_0x16d5ab=_[_0xfa1b('0x3b')]({},_0x16d5ab,_0x27b5b8[_0xfa1b('0x3c')]);var _0x35ff3b={'where':_0x16d5ab[_0xfa1b('0x39')]};return db[_0xfa1b('0x2a')]['count'](_0x35ff3b)[_0xfa1b('0x20')](function(_0x378979){_0x1b2bcf[_0xfa1b('0x1a')]=_0x378979;if(_0x27b5b8[_0xfa1b('0x2f')][_0xfa1b('0x3d')]){_0x16d5ab[_0xfa1b('0x3e')]=[{'all':!![]}];}return db['Campaign'][_0xfa1b('0x3f')](_0x16d5ab);})[_0xfa1b('0x20')](function(_0x11cdad){_0x1b2bcf['rows']=_0x11cdad;return _0x1b2bcf;})[_0xfa1b('0x20')](respondWithFilteredResult(_0x15d1fc,_0x16d5ab))[_0xfa1b('0x40')](handleError(_0x15d1fc,null));};exports[_0xfa1b('0x41')]=function(_0x389433,_0x2b6e80){var _0x29fa0e={'raw':![],'where':{'id':_0x389433['params']['id']}},_0xd96416={};_0xd96416['model']=_['keys'](db[_0xfa1b('0x2a')][_0xfa1b('0x2b')]);_0xd96416[_0xfa1b('0x2f')]=_['keys'](_0x389433['query']);_0xd96416[_0xfa1b('0x30')]=_[_0xfa1b('0x31')](_0xd96416[_0xfa1b('0x2e')],_0xd96416[_0xfa1b('0x2f')]);_0x29fa0e[_0xfa1b('0x32')]=_[_0xfa1b('0x31')](_0xd96416['model'],qs[_0xfa1b('0x33')](_0x389433[_0xfa1b('0x2f')][_0xfa1b('0x33')]));_0x29fa0e[_0xfa1b('0x32')]=_0x29fa0e[_0xfa1b('0x32')][_0xfa1b('0x34')]?_0x29fa0e[_0xfa1b('0x32')]:_0xd96416['model'];if(_0x389433[_0xfa1b('0x2f')][_0xfa1b('0x3d')]){_0x29fa0e[_0xfa1b('0x3e')]=[{'all':!![]}];}_0x29fa0e=_[_0xfa1b('0x3b')]({},_0x29fa0e,_0x389433[_0xfa1b('0x3c')]);return db[_0xfa1b('0x2a')][_0xfa1b('0x42')](_0x29fa0e)[_0xfa1b('0x20')](handleEntityNotFound(_0x2b6e80,null))[_0xfa1b('0x20')](respondWithResult(_0x2b6e80,null))['catch'](handleError(_0x2b6e80,null));};exports[_0xfa1b('0x43')]=function(_0x12cf87,_0xc04d24){return db[_0xfa1b('0x2a')][_0xfa1b('0x43')](_0x12cf87[_0xfa1b('0x44')],{})[_0xfa1b('0x20')](function(_0xadffd){var _0x49ee1a=_0x12cf87['user'][_0xfa1b('0x22')]({'plain':!![]});if(!_0x49ee1a)throw new Error(_0xfa1b('0x45'));if(_0x49ee1a[_0xfa1b('0x46')]===_0xfa1b('0x47')){var _0x1bcc53=_0xadffd[_0xfa1b('0x22')]({'plain':!![]});var _0x436bc4=_0xfa1b('0x23');return db[_0xfa1b('0x48')][_0xfa1b('0x42')]({'where':{'name':_0x436bc4,'userProfileId':_0x49ee1a[_0xfa1b('0x49')]},'raw':!![]})['then'](function(_0xe37180){if(_0xe37180&&_0xe37180[_0xfa1b('0x4a')]===0x0){return db['UserProfileResource']['create']({'name':_0x1bcc53[_0xfa1b('0x26')],'resourceId':_0x1bcc53['id'],'type':_0xe37180[_0xfa1b('0x26')],'sectionId':_0xe37180['id']},{})[_0xfa1b('0x20')](function(){return _0xadffd;});}else{return _0xadffd;}})['catch'](function(_0x4c2862){logger[_0xfa1b('0x24')](_0xfa1b('0x4b'),_0x4c2862);throw _0x4c2862;});}return _0xadffd;})[_0xfa1b('0x20')](respondWithResult(_0xc04d24,0xc9))['catch'](handleError(_0xc04d24,null));};exports[_0xfa1b('0x4c')]=function(_0x197177,_0x4912d8){var _0x432e80={'where':{'id':_0x197177[_0xfa1b('0x4d')]['id']}},_0x546daf={};_0x546daf['model']=_[_0xfa1b('0x4e')](db[_0xfa1b('0x2a')]['rawAttributes']);_0x432e80[_0xfa1b('0x32')]=_['intersection'](_0x546daf['model'],qs['fields'](_0x197177[_0xfa1b('0x2f')][_0xfa1b('0x33')]));_0x432e80['attributes']=_0x432e80['attributes'][_0xfa1b('0x34')]?_0x432e80[_0xfa1b('0x32')]:_0x546daf[_0xfa1b('0x2e')];if(_0x197177[_0xfa1b('0x2f')][_0xfa1b('0x3d')]){_0x432e80[_0xfa1b('0x3e')]=[{'all':!![]}];}_0x432e80=_[_0xfa1b('0x3b')]({},_0x432e80,_0x197177[_0xfa1b('0x3c')]);return db[_0xfa1b('0x2a')]['find'](_0x432e80)[_0xfa1b('0x20')](handleEntityNotFound(_0x4912d8,null))[_0xfa1b('0x20')](function(_0x5d6169){if(_0x5d6169){var _0x1cf88e=_0x5d6169[_0xfa1b('0x22')]({'plain':!![]});_0x1cf88e=qs[_0xfa1b('0x4f')](_0x1cf88e,['id',_0xfa1b('0x50'),'updatedAt']);_0x197177[_0xfa1b('0x44')]=_[_0xfa1b('0x4f')](_0x197177['body'],['id',_0xfa1b('0x50'),_0xfa1b('0x51')]);return db[_0xfa1b('0x2a')][_0xfa1b('0x43')](_['merge'](_0x1cf88e,_0x197177['body']),{'include':_0x197177['query']['includeAll']?[{'all':!![]}]:undefined})[_0xfa1b('0x20')](function(_0x26cd17){var _0x5e93fe=_0x197177[_0xfa1b('0x47')][_0xfa1b('0x22')]({'plain':!![]});if(!_0x5e93fe)throw new Error(_0xfa1b('0x45'));if(_0x5e93fe['role']===_0xfa1b('0x47')){var _0x2a2e41=_0x26cd17[_0xfa1b('0x22')]({'plain':!![]});var _0x15e01d=_0xfa1b('0x23');return db[_0xfa1b('0x48')][_0xfa1b('0x42')]({'where':{'name':_0x15e01d,'userProfileId':_0x5e93fe['userProfileId']},'raw':!![]})['then'](function(_0x3293ce){if(_0x3293ce&&_0x3293ce[_0xfa1b('0x4a')]===0x0){return db[_0xfa1b('0x52')][_0xfa1b('0x43')]({'name':_0x2a2e41[_0xfa1b('0x26')],'resourceId':_0x2a2e41['id'],'type':_0x3293ce[_0xfa1b('0x26')],'sectionId':_0x3293ce['id']},{})[_0xfa1b('0x20')](function(){return _0x26cd17;});}else{return _0x26cd17;}})[_0xfa1b('0x40')](function(_0x20215b){logger[_0xfa1b('0x24')](_0xfa1b('0x4b'),_0x20215b);throw _0x20215b;});}return _0x26cd17;});}})['then'](respondWithResult(_0x4912d8,0xc9))['catch'](handleError(_0x4912d8,null));};exports[_0xfa1b('0x53')]=function(_0x3e3fc2,_0x31f52f){if(_0x3e3fc2['body']['id']){delete _0x3e3fc2[_0xfa1b('0x44')]['id'];}return db['Campaign'][_0xfa1b('0x42')]({'where':{'id':_0x3e3fc2[_0xfa1b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x31f52f,null))[_0xfa1b('0x20')](saveUpdates(_0x3e3fc2[_0xfa1b('0x44')],null))[_0xfa1b('0x20')](respondWithResult(_0x31f52f,null))[_0xfa1b('0x40')](handleError(_0x31f52f,null));};exports[_0xfa1b('0x21')]=function(_0x53dcea,_0x3ef2e2){return db['Campaign']['find']({'where':{'id':_0x53dcea[_0xfa1b('0x4d')]['id']}})[_0xfa1b('0x20')](handleEntityNotFound(_0x3ef2e2,null))[_0xfa1b('0x20')](removeEntity(_0x3ef2e2,null))['catch'](handleError(_0x3ef2e2,null));};exports['getHoppers']=function(_0x4eb4e2,_0x389222,_0x39b11b){var _0x552c7b={'raw':!![],'where':{}};var _0x3a4fe6={};var _0x333a8c={'count':0x0,'rows':[]};return db[_0xfa1b('0x2a')][_0xfa1b('0x54')]({'where':{'id':_0x4eb4e2[_0xfa1b('0x4d')]['id']}})[_0xfa1b('0x20')](handleEntityNotFound(_0x389222,null))[_0xfa1b('0x20')](function(_0x519e0e){if(_0x519e0e){_0x3a4fe6['model']=_[_0xfa1b('0x4e')](db[_0xfa1b('0x55')][_0xfa1b('0x2b')]);_0x3a4fe6[_0xfa1b('0x2f')]=_[_0xfa1b('0x4e')](_0x4eb4e2[_0xfa1b('0x2f')]);_0x3a4fe6['filters']=_[_0xfa1b('0x31')](_0x3a4fe6[_0xfa1b('0x2e')],_0x3a4fe6['query']);_0x552c7b[_0xfa1b('0x32')]=_[_0xfa1b('0x31')](_0x3a4fe6[_0xfa1b('0x2e')],qs[_0xfa1b('0x33')](_0x4eb4e2[_0xfa1b('0x2f')]['fields']));_0x552c7b['attributes']=_0x552c7b[_0xfa1b('0x32')][_0xfa1b('0x34')]?_0x552c7b[_0xfa1b('0x32')]:_0x3a4fe6[_0xfa1b('0x2e')];if(!_0x4eb4e2[_0xfa1b('0x2f')][_0xfa1b('0x35')](_0xfa1b('0x36'))){_0x552c7b['limit']=qs[_0xfa1b('0x1c')](_0x4eb4e2[_0xfa1b('0x2f')][_0xfa1b('0x1c')]);_0x552c7b[_0xfa1b('0x1b')]=qs[_0xfa1b('0x1b')](_0x4eb4e2[_0xfa1b('0x2f')]['offset']);}_0x552c7b['order']=qs[_0xfa1b('0x38')](_0x4eb4e2['query'][_0xfa1b('0x38')]);_0x552c7b['where']=qs[_0xfa1b('0x30')](_[_0xfa1b('0x56')](_0x4eb4e2[_0xfa1b('0x2f')],_0x3a4fe6['filters']));_0x552c7b[_0xfa1b('0x39')]['CampaignId']=_0x519e0e['id'];if(_0x4eb4e2[_0xfa1b('0x2f')][_0xfa1b('0x3a')]){_0x552c7b['where']=_[_0xfa1b('0x3b')](_0x552c7b[_0xfa1b('0x39')],{'$or':_[_0xfa1b('0x29')](_0x552c7b[_0xfa1b('0x32')],function(_0x3dcbf1){var _0x3cac24={};_0x3cac24[_0x3dcbf1]={'$like':'%'+_0x4eb4e2[_0xfa1b('0x2f')]['filter']+'%'};return _0x3cac24;})});}_0x552c7b=_['merge']({},_0x552c7b,_0x4eb4e2[_0xfa1b('0x3c')]);return db['CmHopper']['count']({'where':_0x552c7b[_0xfa1b('0x39')]})[_0xfa1b('0x20')](function(_0x9ff210){_0x333a8c[_0xfa1b('0x1a')]=_0x9ff210;if(_0x4eb4e2['query'][_0xfa1b('0x3d')]){_0x552c7b[_0xfa1b('0x3e')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x552c7b);})['then'](function(_0x364b4b){_0x333a8c[_0xfa1b('0x57')]=_0x364b4b;return _0x333a8c;});}})[_0xfa1b('0x20')](respondWithFilteredResult(_0x389222,_0x552c7b))[_0xfa1b('0x40')](handleError(_0x389222,null));};exports[_0xfa1b('0x58')]=function(_0x385fc0,_0x5cd2af,_0x36e539){var _0x268dad={'raw':!![],'where':{}};var _0x28e105={};var _0x32bfde={'count':0x0,'rows':[]};return db[_0xfa1b('0x2a')][_0xfa1b('0x54')]({'where':{'id':_0x385fc0[_0xfa1b('0x4d')]['id']}})[_0xfa1b('0x20')](handleEntityNotFound(_0x5cd2af,null))['then'](function(_0x3412f9){if(_0x3412f9){_0x28e105[_0xfa1b('0x2e')]=_[_0xfa1b('0x4e')](db[_0xfa1b('0x59')]['rawAttributes']);_0x28e105['query']=_[_0xfa1b('0x4e')](_0x385fc0[_0xfa1b('0x2f')]);_0x28e105[_0xfa1b('0x30')]=_['intersection'](_0x28e105[_0xfa1b('0x2e')],_0x28e105[_0xfa1b('0x2f')]);_0x268dad[_0xfa1b('0x32')]=_[_0xfa1b('0x31')](_0x28e105[_0xfa1b('0x2e')],qs[_0xfa1b('0x33')](_0x385fc0['query'][_0xfa1b('0x33')]));_0x268dad['attributes']=_0x268dad['attributes'][_0xfa1b('0x34')]?_0x268dad[_0xfa1b('0x32')]:_0x28e105[_0xfa1b('0x2e')];if(!_0x385fc0[_0xfa1b('0x2f')][_0xfa1b('0x35')](_0xfa1b('0x36'))){_0x268dad[_0xfa1b('0x1c')]=qs[_0xfa1b('0x1c')](_0x385fc0['query'][_0xfa1b('0x1c')]);_0x268dad['offset']=qs[_0xfa1b('0x1b')](_0x385fc0[_0xfa1b('0x2f')][_0xfa1b('0x1b')]);}_0x268dad['order']=qs[_0xfa1b('0x38')](_0x385fc0['query'][_0xfa1b('0x38')]);_0x268dad[_0xfa1b('0x39')]=qs[_0xfa1b('0x30')](_[_0xfa1b('0x56')](_0x385fc0[_0xfa1b('0x2f')],_0x28e105[_0xfa1b('0x30')]));_0x268dad[_0xfa1b('0x39')]['CampaignId']=_0x3412f9['id'];if(_0x385fc0[_0xfa1b('0x2f')]['filter']){_0x268dad['where']=_[_0xfa1b('0x3b')](_0x268dad['where'],{'$or':_[_0xfa1b('0x29')](_0x268dad['attributes'],function(_0x3f95d6){var _0x3e4ff6={};_0x3e4ff6[_0x3f95d6]={'$like':'%'+_0x385fc0[_0xfa1b('0x2f')][_0xfa1b('0x3a')]+'%'};return _0x3e4ff6;})});}_0x268dad=_[_0xfa1b('0x3b')]({},_0x268dad,_0x385fc0[_0xfa1b('0x3c')]);return db[_0xfa1b('0x59')][_0xfa1b('0x1a')]({'where':_0x268dad[_0xfa1b('0x39')]})[_0xfa1b('0x20')](function(_0xd2190f){_0x32bfde['count']=_0xd2190f;if(_0x385fc0['query'][_0xfa1b('0x3d')]){_0x268dad[_0xfa1b('0x3e')]=[{'all':!![]}];}return db[_0xfa1b('0x59')]['findAll'](_0x268dad);})[_0xfa1b('0x20')](function(_0x399f54){_0x32bfde[_0xfa1b('0x57')]=_0x399f54;return _0x32bfde;});}})[_0xfa1b('0x20')](respondWithFilteredResult(_0x5cd2af,_0x268dad))[_0xfa1b('0x40')](handleError(_0x5cd2af,null));};exports['getHopperFinals']=function(_0x28164c,_0x39267e,_0x4395a2){var _0x2d4e7d={'raw':!![],'where':{}};var _0x183e79={};var _0x53be52={'count':0x0,'rows':[]};return db[_0xfa1b('0x2a')][_0xfa1b('0x54')]({'where':{'id':_0x28164c['params']['id']}})[_0xfa1b('0x20')](handleEntityNotFound(_0x39267e,null))[_0xfa1b('0x20')](function(_0x21dd98){if(_0x21dd98){_0x183e79[_0xfa1b('0x2e')]=_[_0xfa1b('0x4e')](db[_0xfa1b('0x5a')][_0xfa1b('0x2b')]);_0x183e79['query']=_[_0xfa1b('0x4e')](_0x28164c[_0xfa1b('0x2f')]);_0x183e79[_0xfa1b('0x30')]=_[_0xfa1b('0x31')](_0x183e79[_0xfa1b('0x2e')],_0x183e79[_0xfa1b('0x2f')]);_0x2d4e7d['attributes']=_[_0xfa1b('0x31')](_0x183e79[_0xfa1b('0x2e')],qs['fields'](_0x28164c['query'][_0xfa1b('0x33')]));_0x2d4e7d[_0xfa1b('0x32')]=_0x2d4e7d[_0xfa1b('0x32')][_0xfa1b('0x34')]?_0x2d4e7d[_0xfa1b('0x32')]:_0x183e79[_0xfa1b('0x2e')];if(!_0x28164c['query'][_0xfa1b('0x35')](_0xfa1b('0x36'))){_0x2d4e7d[_0xfa1b('0x1c')]=qs[_0xfa1b('0x1c')](_0x28164c[_0xfa1b('0x2f')][_0xfa1b('0x1c')]);_0x2d4e7d[_0xfa1b('0x1b')]=qs['offset'](_0x28164c[_0xfa1b('0x2f')]['offset']);}_0x2d4e7d['order']=qs[_0xfa1b('0x38')](_0x28164c[_0xfa1b('0x2f')][_0xfa1b('0x38')]);_0x2d4e7d[_0xfa1b('0x39')]=qs[_0xfa1b('0x30')](_['pick'](_0x28164c[_0xfa1b('0x2f')],_0x183e79[_0xfa1b('0x30')]));_0x2d4e7d[_0xfa1b('0x39')]['CampaignId']=_0x21dd98['id'];if(_0x28164c[_0xfa1b('0x2f')][_0xfa1b('0x3a')]){_0x2d4e7d['where']=_['merge'](_0x2d4e7d[_0xfa1b('0x39')],{'$or':_[_0xfa1b('0x29')](_0x2d4e7d['attributes'],function(_0x2e6ce4){var _0x5fc1a2={};_0x5fc1a2[_0x2e6ce4]={'$like':'%'+_0x28164c[_0xfa1b('0x2f')][_0xfa1b('0x3a')]+'%'};return _0x5fc1a2;})});}_0x2d4e7d=_[_0xfa1b('0x3b')]({},_0x2d4e7d,_0x28164c[_0xfa1b('0x3c')]);return db[_0xfa1b('0x5a')][_0xfa1b('0x1a')]({'where':_0x2d4e7d[_0xfa1b('0x39')]})['then'](function(_0x2e1f60){_0x53be52[_0xfa1b('0x1a')]=_0x2e1f60;if(_0x28164c[_0xfa1b('0x2f')]['includeAll']){_0x2d4e7d[_0xfa1b('0x3e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xfa1b('0x3f')](_0x2d4e7d);})[_0xfa1b('0x20')](function(_0x5c8b97){_0x53be52[_0xfa1b('0x57')]=_0x5c8b97;return _0x53be52;});}})['then'](respondWithFilteredResult(_0x39267e,_0x2d4e7d))['catch'](handleError(_0x39267e,null));};exports[_0xfa1b('0x5b')]=function(_0x472997,_0x220c65,_0x236f63){var _0x34cc40={'raw':!![],'where':{}};var _0x3f8e0c={};var _0x5078d3={'count':0x0,'rows':[]};return db['Campaign'][_0xfa1b('0x54')]({'where':{'id':_0x472997[_0xfa1b('0x4d')]['id']}})[_0xfa1b('0x20')](handleEntityNotFound(_0x220c65,null))[_0xfa1b('0x20')](function(_0x31d8e6){if(_0x31d8e6){_0x3f8e0c['model']=_['keys'](db[_0xfa1b('0x5c')][_0xfa1b('0x2b')]);_0x3f8e0c['query']=_[_0xfa1b('0x4e')](_0x472997['query']);_0x3f8e0c[_0xfa1b('0x30')]=_[_0xfa1b('0x31')](_0x3f8e0c['model'],_0x3f8e0c[_0xfa1b('0x2f')]);_0x34cc40['attributes']=_[_0xfa1b('0x31')](_0x3f8e0c[_0xfa1b('0x2e')],qs[_0xfa1b('0x33')](_0x472997[_0xfa1b('0x2f')]['fields']));_0x34cc40[_0xfa1b('0x32')]=_0x34cc40[_0xfa1b('0x32')][_0xfa1b('0x34')]?_0x34cc40[_0xfa1b('0x32')]:_0x3f8e0c[_0xfa1b('0x2e')];if(!_0x472997[_0xfa1b('0x2f')]['hasOwnProperty']('nolimit')){_0x34cc40[_0xfa1b('0x1c')]=qs['limit'](_0x472997[_0xfa1b('0x2f')][_0xfa1b('0x1c')]);_0x34cc40['offset']=qs[_0xfa1b('0x1b')](_0x472997['query'][_0xfa1b('0x1b')]);}_0x34cc40[_0xfa1b('0x37')]=qs[_0xfa1b('0x38')](_0x472997[_0xfa1b('0x2f')][_0xfa1b('0x38')]);_0x34cc40[_0xfa1b('0x39')]=qs[_0xfa1b('0x30')](_['pick'](_0x472997[_0xfa1b('0x2f')],_0x3f8e0c[_0xfa1b('0x30')]));_0x34cc40[_0xfa1b('0x39')][_0xfa1b('0x5d')]=_0x31d8e6['id'];if(_0x472997[_0xfa1b('0x2f')][_0xfa1b('0x3a')]){_0x34cc40[_0xfa1b('0x39')]=_[_0xfa1b('0x3b')](_0x34cc40[_0xfa1b('0x39')],{'$or':_['map'](_0x34cc40[_0xfa1b('0x32')],function(_0x18397d){var _0x43b550={};_0x43b550[_0x18397d]={'$like':'%'+_0x472997[_0xfa1b('0x2f')]['filter']+'%'};return _0x43b550;})});}_0x34cc40=_[_0xfa1b('0x3b')]({},_0x34cc40,_0x472997[_0xfa1b('0x3c')]);return db[_0xfa1b('0x5c')]['count']({'where':_0x34cc40[_0xfa1b('0x39')]})[_0xfa1b('0x20')](function(_0x2b0984){_0x5078d3[_0xfa1b('0x1a')]=_0x2b0984;if(_0x472997['query'][_0xfa1b('0x3d')]){_0x34cc40['include']=[{'all':!![]}];}return db[_0xfa1b('0x5c')][_0xfa1b('0x3f')](_0x34cc40);})[_0xfa1b('0x20')](function(_0x467c72){_0x5078d3['rows']=_0x467c72;return _0x5078d3;});}})[_0xfa1b('0x20')](respondWithFilteredResult(_0x220c65,_0x34cc40))['catch'](handleError(_0x220c65,null));};exports[_0xfa1b('0x5e')]=function(_0x130085,_0x1d26bf,_0x379693){var _0x246002={};var _0x4fc6c0={};var _0x507952;var _0xfb6667;return db[_0xfa1b('0x2a')][_0xfa1b('0x54')]({'where':{'id':_0x130085[_0xfa1b('0x4d')]['id']}})[_0xfa1b('0x20')](handleEntityNotFound(_0x1d26bf,null))[_0xfa1b('0x20')](function(_0x2b392c){if(_0x2b392c){_0x507952=_0x2b392c;_0x4fc6c0['model']=_[_0xfa1b('0x4e')](db[_0xfa1b('0x5f')][_0xfa1b('0x2b')]);_0x4fc6c0[_0xfa1b('0x2f')]=_[_0xfa1b('0x4e')](_0x130085[_0xfa1b('0x2f')]);_0x4fc6c0[_0xfa1b('0x30')]=_['intersection'](_0x4fc6c0[_0xfa1b('0x2e')],_0x4fc6c0[_0xfa1b('0x2f')]);_0x246002[_0xfa1b('0x32')]=_[_0xfa1b('0x31')](_0x4fc6c0[_0xfa1b('0x2e')],qs[_0xfa1b('0x33')](_0x130085['query'][_0xfa1b('0x33')]));_0x246002[_0xfa1b('0x32')]=_0x246002[_0xfa1b('0x32')][_0xfa1b('0x34')]?_0x246002[_0xfa1b('0x32')]:_0x4fc6c0[_0xfa1b('0x2e')];_0x246002[_0xfa1b('0x37')]=qs[_0xfa1b('0x38')](_0x130085['query'][_0xfa1b('0x38')]);_0x246002['where']=qs[_0xfa1b('0x30')](_[_0xfa1b('0x56')](_0x130085[_0xfa1b('0x2f')],_0x4fc6c0[_0xfa1b('0x30')]));if(_0x130085['query'][_0xfa1b('0x3a')]){_0x246002[_0xfa1b('0x39')]=_[_0xfa1b('0x3b')](_0x246002[_0xfa1b('0x39')],{'$or':_[_0xfa1b('0x29')](_0x246002['attributes'],function(_0x4c1d06){var _0x4ca01e={};_0x4ca01e[_0x4c1d06]={'$like':'%'+_0x130085[_0xfa1b('0x2f')][_0xfa1b('0x3a')]+'%'};return _0x4ca01e;})});}_0x246002=_[_0xfa1b('0x3b')]({},_0x246002,_0x130085[_0xfa1b('0x3c')]);return _0x507952[_0xfa1b('0x5e')](_0x246002);}})[_0xfa1b('0x20')](function(_0x5edf79){if(_0x5edf79){_0xfb6667=_0x5edf79[_0xfa1b('0x34')];if(!_0x130085[_0xfa1b('0x2f')][_0xfa1b('0x35')](_0xfa1b('0x36'))){_0x246002[_0xfa1b('0x1c')]=qs[_0xfa1b('0x1c')](_0x130085[_0xfa1b('0x2f')][_0xfa1b('0x1c')]);_0x246002[_0xfa1b('0x1b')]=qs['offset'](_0x130085[_0xfa1b('0x2f')][_0xfa1b('0x1b')]);}return _0x507952[_0xfa1b('0x5e')](_0x246002);}})['then'](function(_0x2224a5){if(_0x2224a5){return _0x2224a5?{'count':_0xfb6667,'rows':_0x2224a5}:null;}})[_0xfa1b('0x20')](respondWithResult(_0x1d26bf,null))[_0xfa1b('0x40')](handleError(_0x1d26bf,null));};exports['addLists']=function(_0xd77725,_0x490794,_0x359e1b){var _0x2bec59,_0x3218ba;var _0x1817df=[];var _0x2885aa=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return db[_0xfa1b('0x2a')][_0xfa1b('0x42')]({'where':{'id':_0xd77725[_0xfa1b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x490794,null))[_0xfa1b('0x20')](function(_0x4f3caa){if(_0x4f3caa){_0x3218ba=_0x4f3caa;return _0x4f3caa[_0xfa1b('0x60')](_0xd77725[_0xfa1b('0x44')][_0xfa1b('0x61')],_[_0xfa1b('0x4f')](_0xd77725[_0xfa1b('0x44')],['ids','id'])||{});}return null;})[_0xfa1b('0x62')](function(_0x2b2be1){var _0x29bb42;var _0x175cdd;_0x2bec59=_0x2b2be1||[];var _0x2f3f00=[];if(_0x2b2be1){for(var _0xa110d8=0x0;_0xa110d8<_0x2b2be1[_0xfa1b('0x34')];_0xa110d8+=0x1){var _0x603e1e=_0x2b2be1[_0xa110d8]['get']({'plain':!![]});_0x3218ba[_0xfa1b('0x63')]=_0xd77725[_0xfa1b('0x44')]['dialCheckDuplicateType']?_0xd77725[_0xfa1b('0x44')][_0xfa1b('0x63')]:_0x3218ba[_0xfa1b('0x63')];switch(_0x3218ba['dialCheckDuplicateType']){case _0xfa1b('0x64'):_0x29bb42=squel[_0xfa1b('0x65')]()[_0xfa1b('0x66')]('cm_hopper')['fromQuery']([_0xfa1b('0x67'),_0xfa1b('0x68'),'ContactId','ListId',_0xfa1b('0x5d'),_0xfa1b('0x50'),'updatedAt'],squel[_0xfa1b('0x69')]()[_0xfa1b('0x6a')](_0xfa1b('0x67'),_0xfa1b('0x67'))[_0xfa1b('0x6a')]('NOW()','scheduledAt')[_0xfa1b('0x6a')]('id',_0xfa1b('0x6b'))['field'](_0x603e1e['CmListId'][_0xfa1b('0x6c')](),'ListId')['field'](_0xd77725[_0xfa1b('0x4d')]['id'][_0xfa1b('0x6c')](),'CampaignId')[_0xfa1b('0x6a')]('\x27'+_0x2885aa+'\x27',_0xfa1b('0x50'))['field']('\x27'+_0x2885aa+'\x27','updatedAt')['from'](_0xfa1b('0x6d'))[_0xfa1b('0x39')]('deletedAt\x20IS\x20NULL')[_0xfa1b('0x39')](_0xfa1b('0x6e'),_0x603e1e[_0xfa1b('0x6f')]['toString']())[_0xfa1b('0x39')](_0xfa1b('0x70'))['where'](_0xfa1b('0x71'),squel[_0xfa1b('0x69')]()[_0xfa1b('0x6a')]('COALESCE(calleridnum,\x27\x27)')[_0xfa1b('0x72')]('cm_hopper_final')[_0xfa1b('0x39')](_0xfa1b('0x73'),_0xd77725['params']['id'][_0xfa1b('0x6c')]()))[_0xfa1b('0x39')](_0xfa1b('0x71'),squel[_0xfa1b('0x69')]()[_0xfa1b('0x6a')](_0xfa1b('0x74'))[_0xfa1b('0x72')]('cm_hopper')[_0xfa1b('0x39')](_0xfa1b('0x73'),_0xd77725[_0xfa1b('0x4d')]['id'][_0xfa1b('0x6c')]())))[_0xfa1b('0x6c')]();break;case _0xfa1b('0x75'):_0x29bb42=squel[_0xfa1b('0x65')]()['into'](_0xfa1b('0x76'))[_0xfa1b('0x77')]([_0xfa1b('0x67'),_0xfa1b('0x68'),_0xfa1b('0x6b'),_0xfa1b('0x78'),_0xfa1b('0x5d'),_0xfa1b('0x50'),'updatedAt'],squel[_0xfa1b('0x69')]()[_0xfa1b('0x6a')]('phone',_0xfa1b('0x67'))[_0xfa1b('0x6a')](_0xfa1b('0x79'),_0xfa1b('0x68'))['field']('id',_0xfa1b('0x6b'))[_0xfa1b('0x6a')](_0x603e1e[_0xfa1b('0x6f')][_0xfa1b('0x6c')](),_0xfa1b('0x78'))['field'](_0xd77725[_0xfa1b('0x4d')]['id'][_0xfa1b('0x6c')](),'CampaignId')[_0xfa1b('0x6a')]('\x27'+_0x2885aa+'\x27',_0xfa1b('0x50'))[_0xfa1b('0x6a')]('\x27'+_0x2885aa+'\x27','updatedAt')['from']('cm_contacts')[_0xfa1b('0x39')]('deletedAt\x20IS\x20NULL')[_0xfa1b('0x39')](_0xfa1b('0x6e'),_0x603e1e[_0xfa1b('0x6f')]['toString']())[_0xfa1b('0x39')](_0xfa1b('0x70'))[_0xfa1b('0x39')](_0xfa1b('0x71'),squel[_0xfa1b('0x69')]()[_0xfa1b('0x6a')](_0xfa1b('0x74'))['from']('cm_hopper')['where']('CampaignId\x20=\x20?',_0xd77725[_0xfa1b('0x4d')]['id'][_0xfa1b('0x6c')]())))[_0xfa1b('0x6c')]();break;default:_0x29bb42=squel['insert']()['into'](_0xfa1b('0x76'))[_0xfa1b('0x77')]([_0xfa1b('0x67'),_0xfa1b('0x68'),_0xfa1b('0x6b'),'ListId',_0xfa1b('0x5d'),_0xfa1b('0x50'),_0xfa1b('0x51')],squel[_0xfa1b('0x69')]()['field'](_0xfa1b('0x67'),_0xfa1b('0x67'))[_0xfa1b('0x6a')](_0xfa1b('0x79'),_0xfa1b('0x68'))[_0xfa1b('0x6a')]('id',_0xfa1b('0x6b'))['field'](_0x603e1e[_0xfa1b('0x6f')][_0xfa1b('0x6c')](),_0xfa1b('0x78'))[_0xfa1b('0x6a')](_0xd77725[_0xfa1b('0x4d')]['id'][_0xfa1b('0x6c')](),'CampaignId')[_0xfa1b('0x6a')]('\x27'+_0x2885aa+'\x27',_0xfa1b('0x50'))[_0xfa1b('0x6a')]('\x27'+_0x2885aa+'\x27','updatedAt')[_0xfa1b('0x72')](_0xfa1b('0x6d'))['where'](_0xfa1b('0x7a'))[_0xfa1b('0x39')]('ListId\x20=\x20?',_0x603e1e[_0xfa1b('0x6f')][_0xfa1b('0x6c')]())[_0xfa1b('0x39')](_0xfa1b('0x70')))[_0xfa1b('0x6c')]();}_0x175cdd=squel[_0xfa1b('0x65')]()[_0xfa1b('0x66')](_0xfa1b('0x7b'))[_0xfa1b('0x77')]([_0xfa1b('0x7c'),_0xfa1b('0x68'),_0xfa1b('0x67'),_0xfa1b('0x7d'),_0xfa1b('0x50'),_0xfa1b('0x51')],squel['select']()[_0xfa1b('0x6a')](_0xfa1b('0x7e'),'id')[_0xfa1b('0x6a')](_0xfa1b('0x79'),_0xfa1b('0x68'))[_0xfa1b('0x6a')](_0xfa1b('0x7f'),'phone')[_0xfa1b('0x6a')](_0xfa1b('0x80'),'OrderBy')['field']('\x27'+_0x2885aa+'\x27','createdAt')[_0xfa1b('0x6a')]('\x27'+_0x2885aa+'\x27',_0xfa1b('0x51'))[_0xfa1b('0x72')](_0xfa1b('0x81'),'ci')[_0xfa1b('0x82')]('cm_hopper','h','h.ContactId\x20=\x20ci.CmContactId')[_0xfa1b('0x39')]('h.ListId\x20=\x20?',_0x603e1e['CmListId'][_0xfa1b('0x6c')]())[_0xfa1b('0x39')]('h.CampaignId=?',_0xd77725[_0xfa1b('0x4d')]['id'][_0xfa1b('0x6c')]())['where'](_0xfa1b('0x83'),_0x2885aa))[_0xfa1b('0x6c')]();_0x2f3f00[_0xfa1b('0x84')](db[_0xfa1b('0x85')][_0xfa1b('0x2f')](_0x29bb42));_0x1817df[_0xfa1b('0x84')](db[_0xfa1b('0x85')][_0xfa1b('0x2f')](_0x175cdd));}return BPromise['all'](_0x2f3f00);}})[_0xfa1b('0x20')](function(){return BPromise[_0xfa1b('0x86')](_0x1817df);})[_0xfa1b('0x20')](function(){return _0x2bec59;})['then'](respondWithResult(_0x490794,null))[_0xfa1b('0x40')](handleError(_0x490794,null));};exports[_0xfa1b('0x87')]=function(_0xa61450,_0x539d5b,_0x24a533){return db[_0xfa1b('0x2a')][_0xfa1b('0x42')]({'where':{'id':_0xa61450['params']['id']}})['then'](handleEntityNotFound(_0x539d5b,null))[_0xfa1b('0x20')](function(_0x3a7364){if(_0x3a7364){return _0x3a7364[_0xfa1b('0x87')](_0xa61450['query']['ids']);}})[_0xfa1b('0x20')](function(_0x3a0e83){if(_0x3a0e83){return db['CmHopper'][_0xfa1b('0x21')]({'where':{'ListId':_0xa61450[_0xfa1b('0x2f')]['ids'],'CampaignId':_0xa61450['params']['id']}})[_0xfa1b('0x20')](function(){return _0x3a0e83;});}})['then'](respondWithStatusCode(_0x539d5b,null))['catch'](handleError(_0x539d5b,null));};exports[_0xfa1b('0x88')]=function(_0x4f73cf,_0x981621,_0x54fc11){var _0x31d6eb={};var _0x593822={};var _0xf78934;var _0x27b880;return db[_0xfa1b('0x2a')][_0xfa1b('0x54')]({'where':{'id':_0x4f73cf[_0xfa1b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x981621,null))[_0xfa1b('0x20')](function(_0x570863){if(_0x570863){_0xf78934=_0x570863;_0x593822[_0xfa1b('0x2e')]=_['keys'](db[_0xfa1b('0x5f')]['rawAttributes']);_0x593822[_0xfa1b('0x2f')]=_['keys'](_0x4f73cf['query']);_0x593822[_0xfa1b('0x30')]=_[_0xfa1b('0x31')](_0x593822[_0xfa1b('0x2e')],_0x593822['query']);_0x31d6eb[_0xfa1b('0x32')]=_[_0xfa1b('0x31')](_0x593822[_0xfa1b('0x2e')],qs[_0xfa1b('0x33')](_0x4f73cf['query'][_0xfa1b('0x33')]));_0x31d6eb[_0xfa1b('0x32')]=_0x31d6eb[_0xfa1b('0x32')][_0xfa1b('0x34')]?_0x31d6eb[_0xfa1b('0x32')]:_0x593822['model'];_0x31d6eb[_0xfa1b('0x37')]=qs[_0xfa1b('0x38')](_0x4f73cf[_0xfa1b('0x2f')][_0xfa1b('0x38')]);_0x31d6eb['where']=qs[_0xfa1b('0x30')](_[_0xfa1b('0x56')](_0x4f73cf[_0xfa1b('0x2f')],_0x593822[_0xfa1b('0x30')]));if(_0x4f73cf['query'][_0xfa1b('0x3a')]){_0x31d6eb[_0xfa1b('0x39')]=_[_0xfa1b('0x3b')](_0x31d6eb[_0xfa1b('0x39')],{'$or':_['map'](_0x31d6eb[_0xfa1b('0x32')],function(_0x484d9d){var _0x189250={};_0x189250[_0x484d9d]={'$like':'%'+_0x4f73cf[_0xfa1b('0x2f')]['filter']+'%'};return _0x189250;})});}_0x31d6eb=_[_0xfa1b('0x3b')]({},_0x31d6eb,_0x4f73cf[_0xfa1b('0x3c')]);return _0xf78934[_0xfa1b('0x88')](_0x31d6eb);}})['then'](function(_0x3259e5){if(_0x3259e5){_0x27b880=_0x3259e5[_0xfa1b('0x34')];if(!_0x4f73cf[_0xfa1b('0x2f')][_0xfa1b('0x35')](_0xfa1b('0x36'))){_0x31d6eb['limit']=qs[_0xfa1b('0x1c')](_0x4f73cf['query'][_0xfa1b('0x1c')]);_0x31d6eb[_0xfa1b('0x1b')]=qs['offset'](_0x4f73cf[_0xfa1b('0x2f')][_0xfa1b('0x1b')]);}return _0xf78934['getBlackLists'](_0x31d6eb);}})[_0xfa1b('0x20')](function(_0x5e8f1d){if(_0x5e8f1d){return _0x5e8f1d?{'count':_0x27b880,'rows':_0x5e8f1d}:null;}})[_0xfa1b('0x20')](respondWithResult(_0x981621,null))[_0xfa1b('0x40')](handleError(_0x981621,null));};exports[_0xfa1b('0x89')]=function(_0x127608,_0x24e386,_0x28ae57){var _0x518cb6,_0xcf8904;var _0x2d2e46=[];var _0x41b6a0=moment()[_0xfa1b('0x8a')](_0xfa1b('0x8b'));return db[_0xfa1b('0x2a')]['find']({'where':{'id':_0x127608['params']['id']}})[_0xfa1b('0x20')](handleEntityNotFound(_0x24e386,null))['then'](function(_0x495ac6){if(_0x495ac6){_0xcf8904=_0x495ac6;return _0x495ac6[_0xfa1b('0x89')](_0x127608[_0xfa1b('0x44')][_0xfa1b('0x61')],_[_0xfa1b('0x4f')](_0x127608[_0xfa1b('0x44')],[_0xfa1b('0x61'),'id'])||{});}return null;})[_0xfa1b('0x62')](function(_0x5b26a1){var _0xbf80b9;var _0x1f9998;_0x518cb6=_0x5b26a1||[];var _0x14032c=[];if(_0x5b26a1){for(var _0x7f7945=0x0;_0x7f7945<_0x5b26a1[_0xfa1b('0x34')];_0x7f7945+=0x1){var _0x133ce7=_0x5b26a1[_0x7f7945][_0xfa1b('0x22')]({'plain':!![]});_0xbf80b9=squel[_0xfa1b('0x65')]()[_0xfa1b('0x66')](_0xfa1b('0x8c'))[_0xfa1b('0x77')](['phone',_0xfa1b('0x6b'),_0xfa1b('0x78'),'CampaignId','createdAt',_0xfa1b('0x51')],squel['select']()['field'](_0xfa1b('0x67'),_0xfa1b('0x67'))[_0xfa1b('0x6a')]('id',_0xfa1b('0x6b'))[_0xfa1b('0x6a')](_0x133ce7['CmListId'][_0xfa1b('0x6c')](),_0xfa1b('0x78'))['field'](_0x127608['params']['id'][_0xfa1b('0x6c')](),'CampaignId')['field'](_0xfa1b('0x79'),'createdAt')[_0xfa1b('0x6a')](_0xfa1b('0x79'),_0xfa1b('0x51'))[_0xfa1b('0x72')]('cm_contacts')['where'](_0xfa1b('0x7a'))[_0xfa1b('0x39')](_0xfa1b('0x6e'),_0x133ce7[_0xfa1b('0x6f')][_0xfa1b('0x6c')]())['where'](_0xfa1b('0x70')))['toString']();_0x14032c[_0xfa1b('0x84')](db[_0xfa1b('0x85')][_0xfa1b('0x2f')](_0xbf80b9));}return BPromise[_0xfa1b('0x86')](_0x14032c);}})[_0xfa1b('0x20')](function(){return _0x518cb6;})[_0xfa1b('0x20')](respondWithResult(_0x24e386,null))[_0xfa1b('0x40')](handleError(_0x24e386,null));};exports[_0xfa1b('0x8d')]=function(_0xcfe024,_0x5bb839,_0x46b627){return db['Campaign'][_0xfa1b('0x42')]({'where':{'id':_0xcfe024[_0xfa1b('0x4d')]['id']}})[_0xfa1b('0x20')](handleEntityNotFound(_0x5bb839,null))[_0xfa1b('0x20')](function(_0x1758d5){if(_0x1758d5){return _0x1758d5[_0xfa1b('0x8d')](_0xcfe024[_0xfa1b('0x2f')][_0xfa1b('0x61')]);}})[_0xfa1b('0x20')](function(_0x3e23e0){if(_0x3e23e0){return db[_0xfa1b('0x5c')][_0xfa1b('0x21')]({'where':{'ListId':_0xcfe024['query'][_0xfa1b('0x61')],'CampaignId':_0xcfe024[_0xfa1b('0x4d')]['id']}})[_0xfa1b('0x20')](function(){return _0x3e23e0;});}})[_0xfa1b('0x20')](respondWithStatusCode(_0x5bb839,null))[_0xfa1b('0x40')](handleError(_0x5bb839,null));}; \ No newline at end of file +var _0xb57d=['index','map','Campaign','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','includeAll','include','findAll','show','params','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','getHoppers','findOne','pick','CmHopper','rows','getHopperHistories','CmHopperHistory','CampaignId','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','fromQuery','scheduledAt','ContactId','ListId','phone','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','select','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','format','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','IvrCampaigns','UserProfileResource','error','name','send'];(function(_0xce014b,_0x2c69f4){var _0x1a7d81=function(_0x51b2bb){while(--_0x51b2bb){_0xce014b['push'](_0xce014b['shift']());}};_0x1a7d81(++_0x2c69f4);}(_0xb57d,0x18d));var _0xdb57=function(_0x55b7b0,_0x2df366){_0x55b7b0=_0x55b7b0-0x0;var _0x231f56=_0xb57d[_0x55b7b0];return _0x231f56;};'use strict';var emlformat=require(_0xdb57('0x0'));var rimraf=require(_0xdb57('0x1'));var zipdir=require(_0xdb57('0x2'));var jsonpatch=require(_0xdb57('0x3'));var rp=require(_0xdb57('0x4'));var moment=require('moment');var BPromise=require(_0xdb57('0x5'));var Mustache=require(_0xdb57('0x6'));var util=require(_0xdb57('0x7'));var path=require(_0xdb57('0x8'));var sox=require('sox');var csv=require(_0xdb57('0x9'));var ejs=require(_0xdb57('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdb57('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdb57('0xc'));var deskjs=require(_0xdb57('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdb57('0xe'));var Redis=require(_0xdb57('0xf'));var authService=require(_0xdb57('0x10'));var qs=require(_0xdb57('0x11'));var as=require(_0xdb57('0x12'));var hardwareService=require(_0xdb57('0x13'));var logger=require('../../config/logger')(_0xdb57('0x14'));var utils=require('../../config/utils');var config=require(_0xdb57('0x15'));var licenseUtil=require(_0xdb57('0x16'));var db=require(_0xdb57('0x17'))['db'];function respondWithStatusCode(_0x1f83a7,_0x52fcf9){_0x52fcf9=_0x52fcf9||0xcc;return function(_0x5c8870){if(_0x5c8870){return _0x1f83a7[_0xdb57('0x18')](_0x52fcf9);}return _0x1f83a7[_0xdb57('0x19')](_0x52fcf9)[_0xdb57('0x1a')]();};}function respondWithResult(_0x5f311a,_0x201fde){_0x201fde=_0x201fde||0xc8;return function(_0x25a660){if(_0x25a660){return _0x5f311a[_0xdb57('0x19')](_0x201fde)[_0xdb57('0x1b')](_0x25a660);}};}function respondWithFilteredResult(_0x3c5178,_0x4fae19){return function(_0x42924f){if(_0x42924f){var _0x42f86a=typeof _0x4fae19[_0xdb57('0x1c')]===_0xdb57('0x1d')&&typeof _0x4fae19['limit']===_0xdb57('0x1d');var _0x54e7b4=_0x42924f[_0xdb57('0x1e')];var _0x14b4f0=_0x42f86a?0x0:_0x4fae19[_0xdb57('0x1c')];var _0x3858b2=_0x42f86a?_0x42924f['count']:_0x4fae19[_0xdb57('0x1c')]+_0x4fae19[_0xdb57('0x1f')];var _0x2df673;if(_0x3858b2>=_0x54e7b4){_0x3858b2=_0x54e7b4;_0x2df673=0xc8;}else{_0x2df673=0xce;}_0x3c5178['status'](_0x2df673);return _0x3c5178['set'](_0xdb57('0x20'),_0x14b4f0+'-'+_0x3858b2+'/'+_0x54e7b4)[_0xdb57('0x1b')](_0x42924f);}return null;};}function patchUpdates(_0x4ee3af){return function(_0x48b941){try{jsonpatch[_0xdb57('0x21')](_0x48b941,_0x4ee3af,!![]);}catch(_0x579614){return BPromise[_0xdb57('0x22')](_0x579614);}return _0x48b941[_0xdb57('0x23')]();};}function saveUpdates(_0x416fc6,_0x582607){return function(_0x1f4c0d){if(_0x1f4c0d){return _0x1f4c0d[_0xdb57('0x24')](_0x416fc6)[_0xdb57('0x25')](function(_0x43841f){return _0x43841f;});}return null;};}function removeEntity(_0x3a1755,_0x436f76){return function(_0x141768){if(_0x141768){return _0x141768[_0xdb57('0x26')]()[_0xdb57('0x25')](function(){var _0x55e28a=_0x141768['get']({'plain':!![]});var _0x528ac8=_0xdb57('0x27');return db[_0xdb57('0x28')]['destroy']({'where':{'type':_0x528ac8,'resourceId':_0x55e28a['id']}})[_0xdb57('0x25')](function(){return _0x141768;});})[_0xdb57('0x25')](function(){_0x3a1755[_0xdb57('0x19')](0xcc)[_0xdb57('0x1a')]();});}};}function handleEntityNotFound(_0x38216c,_0x53fba1){return function(_0x3c9d8f){if(!_0x3c9d8f){_0x38216c[_0xdb57('0x18')](0x194);}return _0x3c9d8f;};}function handleError(_0x2185b9,_0x2a9311){_0x2a9311=_0x2a9311||0x1f4;return function(_0x51d0f0){logger[_0xdb57('0x29')](_0x51d0f0['stack']);if(_0x51d0f0[_0xdb57('0x2a')]){delete _0x51d0f0['name'];}_0x2185b9[_0xdb57('0x19')](_0x2a9311)[_0xdb57('0x2b')](_0x51d0f0);};}exports[_0xdb57('0x2c')]=function(_0x445a78,_0x2aee4f){var _0x1c1895={},_0x563ed9={},_0x17af2c={'count':0x0,'rows':[]};var _0x30817e=_[_0xdb57('0x2d')](db[_0xdb57('0x2e')][_0xdb57('0x2f')],function(_0x185499){return{'name':_0x185499['fieldName'],'type':_0x185499[_0xdb57('0x30')][_0xdb57('0x31')]};});_0x563ed9[_0xdb57('0x32')]=_[_0xdb57('0x2d')](_0x30817e,_0xdb57('0x2a'));_0x563ed9['query']=_[_0xdb57('0x33')](_0x445a78[_0xdb57('0x34')]);_0x563ed9['filters']=_[_0xdb57('0x35')](_0x563ed9[_0xdb57('0x32')],_0x563ed9[_0xdb57('0x34')]);_0x1c1895[_0xdb57('0x36')]=_['intersection'](_0x563ed9[_0xdb57('0x32')],qs[_0xdb57('0x37')](_0x445a78[_0xdb57('0x34')][_0xdb57('0x37')]));_0x1c1895[_0xdb57('0x36')]=_0x1c1895[_0xdb57('0x36')][_0xdb57('0x38')]?_0x1c1895[_0xdb57('0x36')]:_0x563ed9['model'];if(!_0x445a78['query'][_0xdb57('0x39')](_0xdb57('0x3a'))){_0x1c1895[_0xdb57('0x1f')]=qs[_0xdb57('0x1f')](_0x445a78[_0xdb57('0x34')][_0xdb57('0x1f')]);_0x1c1895[_0xdb57('0x1c')]=qs[_0xdb57('0x1c')](_0x445a78[_0xdb57('0x34')][_0xdb57('0x1c')]);}_0x1c1895[_0xdb57('0x3b')]=qs[_0xdb57('0x3c')](_0x445a78[_0xdb57('0x34')][_0xdb57('0x3c')]);_0x1c1895[_0xdb57('0x3d')]=qs[_0xdb57('0x3e')](_['pick'](_0x445a78['query'],_0x563ed9[_0xdb57('0x3e')]),_0x30817e);if(_0x445a78[_0xdb57('0x34')]['filter']){_0x1c1895[_0xdb57('0x3d')]=_[_0xdb57('0x3f')](_0x1c1895[_0xdb57('0x3d')],{'$or':_[_0xdb57('0x2d')](_0x30817e,function(_0x409397){if(_0x409397['type']!==_0xdb57('0x40')){var _0x155d4c={};_0x155d4c[_0x409397[_0xdb57('0x2a')]]={'$like':'%'+_0x445a78[_0xdb57('0x34')][_0xdb57('0x41')]+'%'};return _0x155d4c;}})});}_0x1c1895=_[_0xdb57('0x3f')]({},_0x1c1895,_0x445a78['options']);var _0x453be5={'where':_0x1c1895[_0xdb57('0x3d')]};return db[_0xdb57('0x2e')]['count'](_0x453be5)[_0xdb57('0x25')](function(_0x4bbf26){_0x17af2c[_0xdb57('0x1e')]=_0x4bbf26;if(_0x445a78[_0xdb57('0x34')][_0xdb57('0x42')]){_0x1c1895[_0xdb57('0x43')]=[{'all':!![]}];}return db[_0xdb57('0x2e')][_0xdb57('0x44')](_0x1c1895);})[_0xdb57('0x25')](function(_0x3889d3){_0x17af2c['rows']=_0x3889d3;return _0x17af2c;})[_0xdb57('0x25')](respondWithFilteredResult(_0x2aee4f,_0x1c1895))['catch'](handleError(_0x2aee4f,null));};exports[_0xdb57('0x45')]=function(_0x3632f4,_0x307914){var _0x93b61a={'raw':![],'where':{'id':_0x3632f4[_0xdb57('0x46')]['id']}},_0x32f7fa={};_0x32f7fa[_0xdb57('0x32')]=_[_0xdb57('0x33')](db[_0xdb57('0x2e')][_0xdb57('0x2f')]);_0x32f7fa[_0xdb57('0x34')]=_[_0xdb57('0x33')](_0x3632f4[_0xdb57('0x34')]);_0x32f7fa['filters']=_[_0xdb57('0x35')](_0x32f7fa['model'],_0x32f7fa[_0xdb57('0x34')]);_0x93b61a[_0xdb57('0x36')]=_[_0xdb57('0x35')](_0x32f7fa[_0xdb57('0x32')],qs[_0xdb57('0x37')](_0x3632f4[_0xdb57('0x34')][_0xdb57('0x37')]));_0x93b61a[_0xdb57('0x36')]=_0x93b61a[_0xdb57('0x36')]['length']?_0x93b61a['attributes']:_0x32f7fa[_0xdb57('0x32')];if(_0x3632f4['query']['includeAll']){_0x93b61a[_0xdb57('0x43')]=[{'all':!![]}];}_0x93b61a=_[_0xdb57('0x3f')]({},_0x93b61a,_0x3632f4[_0xdb57('0x47')]);return db[_0xdb57('0x2e')][_0xdb57('0x48')](_0x93b61a)[_0xdb57('0x25')](handleEntityNotFound(_0x307914,null))['then'](respondWithResult(_0x307914,null))['catch'](handleError(_0x307914,null));};exports[_0xdb57('0x49')]=function(_0x45a990,_0x5f3653){return db[_0xdb57('0x2e')][_0xdb57('0x49')](_0x45a990[_0xdb57('0x4a')],{})[_0xdb57('0x25')](function(_0x1c2df0){var _0xdd5329=_0x45a990[_0xdb57('0x4b')][_0xdb57('0x4c')]({'plain':!![]});if(!_0xdd5329)throw new Error(_0xdb57('0x4d'));if(_0xdd5329[_0xdb57('0x4e')]===_0xdb57('0x4b')){var _0x230d68=_0x1c2df0[_0xdb57('0x4c')]({'plain':!![]});var _0x78202b='IvrCampaigns';return db[_0xdb57('0x4f')][_0xdb57('0x48')]({'where':{'name':_0x78202b,'userProfileId':_0xdd5329['userProfileId']},'raw':!![]})[_0xdb57('0x25')](function(_0x196be2){if(_0x196be2&&_0x196be2[_0xdb57('0x50')]===0x0){return db[_0xdb57('0x28')][_0xdb57('0x49')]({'name':_0x230d68[_0xdb57('0x2a')],'resourceId':_0x230d68['id'],'type':_0x196be2[_0xdb57('0x2a')],'sectionId':_0x196be2['id']},{})[_0xdb57('0x25')](function(){return _0x1c2df0;});}else{return _0x1c2df0;}})[_0xdb57('0x51')](function(_0x30868b){logger[_0xdb57('0x29')](_0xdb57('0x52'),_0x30868b);throw _0x30868b;});}return _0x1c2df0;})['then'](respondWithResult(_0x5f3653,0xc9))[_0xdb57('0x51')](handleError(_0x5f3653,null));};exports['clone']=function(_0x32c7a2,_0x1ff555){var _0x22ab41={'where':{'id':_0x32c7a2[_0xdb57('0x46')]['id']}},_0x4f283c={};_0x4f283c['model']=_[_0xdb57('0x33')](db[_0xdb57('0x2e')][_0xdb57('0x2f')]);_0x22ab41[_0xdb57('0x36')]=_[_0xdb57('0x35')](_0x4f283c[_0xdb57('0x32')],qs['fields'](_0x32c7a2[_0xdb57('0x34')][_0xdb57('0x37')]));_0x22ab41[_0xdb57('0x36')]=_0x22ab41['attributes'][_0xdb57('0x38')]?_0x22ab41[_0xdb57('0x36')]:_0x4f283c[_0xdb57('0x32')];if(_0x32c7a2[_0xdb57('0x34')]['includeAll']){_0x22ab41[_0xdb57('0x43')]=[{'all':!![]}];}_0x22ab41=_[_0xdb57('0x3f')]({},_0x22ab41,_0x32c7a2[_0xdb57('0x47')]);return db[_0xdb57('0x2e')][_0xdb57('0x48')](_0x22ab41)[_0xdb57('0x25')](handleEntityNotFound(_0x1ff555,null))['then'](function(_0x19820e){if(_0x19820e){var _0x44f5c4=_0x19820e[_0xdb57('0x4c')]({'plain':!![]});_0x44f5c4=qs[_0xdb57('0x53')](_0x44f5c4,['id',_0xdb57('0x54'),_0xdb57('0x55')]);_0x32c7a2[_0xdb57('0x4a')]=_['omit'](_0x32c7a2[_0xdb57('0x4a')],['id',_0xdb57('0x54'),_0xdb57('0x55')]);return db[_0xdb57('0x2e')]['create'](_[_0xdb57('0x3f')](_0x44f5c4,_0x32c7a2[_0xdb57('0x4a')]),{'include':_0x32c7a2[_0xdb57('0x34')]['includeAll']?[{'all':!![]}]:undefined})[_0xdb57('0x25')](function(_0x4d5262){var _0x49bce4=_0x32c7a2[_0xdb57('0x4b')][_0xdb57('0x4c')]({'plain':!![]});if(!_0x49bce4)throw new Error(_0xdb57('0x4d'));if(_0x49bce4[_0xdb57('0x4e')]===_0xdb57('0x4b')){var _0x49524e=_0x4d5262[_0xdb57('0x4c')]({'plain':!![]});var _0xa53c2c=_0xdb57('0x27');return db[_0xdb57('0x4f')]['find']({'where':{'name':_0xa53c2c,'userProfileId':_0x49bce4['userProfileId']},'raw':!![]})[_0xdb57('0x25')](function(_0xc456b6){if(_0xc456b6&&_0xc456b6[_0xdb57('0x50')]===0x0){return db[_0xdb57('0x28')][_0xdb57('0x49')]({'name':_0x49524e[_0xdb57('0x2a')],'resourceId':_0x49524e['id'],'type':_0xc456b6['name'],'sectionId':_0xc456b6['id']},{})[_0xdb57('0x25')](function(){return _0x4d5262;});}else{return _0x4d5262;}})[_0xdb57('0x51')](function(_0x5f4194){logger[_0xdb57('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5f4194);throw _0x5f4194;});}return _0x4d5262;});}})[_0xdb57('0x25')](respondWithResult(_0x1ff555,0xc9))[_0xdb57('0x51')](handleError(_0x1ff555,null));};exports[_0xdb57('0x24')]=function(_0x32fffe,_0x11918e){if(_0x32fffe[_0xdb57('0x4a')]['id']){delete _0x32fffe['body']['id'];}return db['Campaign'][_0xdb57('0x48')]({'where':{'id':_0x32fffe[_0xdb57('0x46')]['id']}})[_0xdb57('0x25')](handleEntityNotFound(_0x11918e,null))['then'](saveUpdates(_0x32fffe[_0xdb57('0x4a')],null))[_0xdb57('0x25')](respondWithResult(_0x11918e,null))['catch'](handleError(_0x11918e,null));};exports[_0xdb57('0x26')]=function(_0x5db407,_0x29da48){return db['Campaign']['find']({'where':{'id':_0x5db407[_0xdb57('0x46')]['id']}})[_0xdb57('0x25')](handleEntityNotFound(_0x29da48,null))['then'](removeEntity(_0x29da48,null))[_0xdb57('0x51')](handleError(_0x29da48,null));};exports[_0xdb57('0x56')]=function(_0x4a704d,_0x1256c0,_0xa3d3d3){var _0x9b6fd4={'raw':!![],'where':{}};var _0x2ed7cc={};var _0x54411f={'count':0x0,'rows':[]};return db[_0xdb57('0x2e')][_0xdb57('0x57')]({'where':{'id':_0x4a704d[_0xdb57('0x46')]['id']}})[_0xdb57('0x25')](handleEntityNotFound(_0x1256c0,null))[_0xdb57('0x25')](function(_0x5a6acd){if(_0x5a6acd){_0x2ed7cc['model']=_[_0xdb57('0x33')](db['CmHopper']['rawAttributes']);_0x2ed7cc[_0xdb57('0x34')]=_[_0xdb57('0x33')](_0x4a704d['query']);_0x2ed7cc['filters']=_[_0xdb57('0x35')](_0x2ed7cc[_0xdb57('0x32')],_0x2ed7cc[_0xdb57('0x34')]);_0x9b6fd4[_0xdb57('0x36')]=_[_0xdb57('0x35')](_0x2ed7cc['model'],qs[_0xdb57('0x37')](_0x4a704d[_0xdb57('0x34')][_0xdb57('0x37')]));_0x9b6fd4[_0xdb57('0x36')]=_0x9b6fd4[_0xdb57('0x36')][_0xdb57('0x38')]?_0x9b6fd4[_0xdb57('0x36')]:_0x2ed7cc['model'];if(!_0x4a704d[_0xdb57('0x34')]['hasOwnProperty']('nolimit')){_0x9b6fd4['limit']=qs[_0xdb57('0x1f')](_0x4a704d[_0xdb57('0x34')]['limit']);_0x9b6fd4[_0xdb57('0x1c')]=qs[_0xdb57('0x1c')](_0x4a704d[_0xdb57('0x34')]['offset']);}_0x9b6fd4['order']=qs['sort'](_0x4a704d['query'][_0xdb57('0x3c')]);_0x9b6fd4[_0xdb57('0x3d')]=qs[_0xdb57('0x3e')](_[_0xdb57('0x58')](_0x4a704d[_0xdb57('0x34')],_0x2ed7cc['filters']));_0x9b6fd4[_0xdb57('0x3d')]['CampaignId']=_0x5a6acd['id'];if(_0x4a704d[_0xdb57('0x34')][_0xdb57('0x41')]){_0x9b6fd4['where']=_['merge'](_0x9b6fd4[_0xdb57('0x3d')],{'$or':_[_0xdb57('0x2d')](_0x9b6fd4[_0xdb57('0x36')],function(_0x588446){var _0x18bb07={};_0x18bb07[_0x588446]={'$like':'%'+_0x4a704d[_0xdb57('0x34')][_0xdb57('0x41')]+'%'};return _0x18bb07;})});}_0x9b6fd4=_[_0xdb57('0x3f')]({},_0x9b6fd4,_0x4a704d[_0xdb57('0x47')]);return db[_0xdb57('0x59')][_0xdb57('0x1e')]({'where':_0x9b6fd4['where']})[_0xdb57('0x25')](function(_0x18db6d){_0x54411f[_0xdb57('0x1e')]=_0x18db6d;if(_0x4a704d['query'][_0xdb57('0x42')]){_0x9b6fd4[_0xdb57('0x43')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x9b6fd4);})[_0xdb57('0x25')](function(_0xfe2999){_0x54411f[_0xdb57('0x5a')]=_0xfe2999;return _0x54411f;});}})['then'](respondWithFilteredResult(_0x1256c0,_0x9b6fd4))[_0xdb57('0x51')](handleError(_0x1256c0,null));};exports[_0xdb57('0x5b')]=function(_0x12f90d,_0x8aa5ea,_0x3ee8b5){var _0x3f803d={'raw':!![],'where':{}};var _0xa04e91={};var _0x56d69f={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x12f90d[_0xdb57('0x46')]['id']}})[_0xdb57('0x25')](handleEntityNotFound(_0x8aa5ea,null))[_0xdb57('0x25')](function(_0x2430aa){if(_0x2430aa){_0xa04e91[_0xdb57('0x32')]=_[_0xdb57('0x33')](db[_0xdb57('0x5c')][_0xdb57('0x2f')]);_0xa04e91[_0xdb57('0x34')]=_[_0xdb57('0x33')](_0x12f90d['query']);_0xa04e91[_0xdb57('0x3e')]=_['intersection'](_0xa04e91[_0xdb57('0x32')],_0xa04e91[_0xdb57('0x34')]);_0x3f803d[_0xdb57('0x36')]=_[_0xdb57('0x35')](_0xa04e91['model'],qs[_0xdb57('0x37')](_0x12f90d['query'][_0xdb57('0x37')]));_0x3f803d[_0xdb57('0x36')]=_0x3f803d[_0xdb57('0x36')]['length']?_0x3f803d[_0xdb57('0x36')]:_0xa04e91[_0xdb57('0x32')];if(!_0x12f90d[_0xdb57('0x34')]['hasOwnProperty'](_0xdb57('0x3a'))){_0x3f803d['limit']=qs[_0xdb57('0x1f')](_0x12f90d[_0xdb57('0x34')]['limit']);_0x3f803d[_0xdb57('0x1c')]=qs[_0xdb57('0x1c')](_0x12f90d[_0xdb57('0x34')][_0xdb57('0x1c')]);}_0x3f803d['order']=qs[_0xdb57('0x3c')](_0x12f90d[_0xdb57('0x34')][_0xdb57('0x3c')]);_0x3f803d['where']=qs[_0xdb57('0x3e')](_[_0xdb57('0x58')](_0x12f90d[_0xdb57('0x34')],_0xa04e91[_0xdb57('0x3e')]));_0x3f803d[_0xdb57('0x3d')][_0xdb57('0x5d')]=_0x2430aa['id'];if(_0x12f90d[_0xdb57('0x34')][_0xdb57('0x41')]){_0x3f803d[_0xdb57('0x3d')]=_['merge'](_0x3f803d[_0xdb57('0x3d')],{'$or':_['map'](_0x3f803d[_0xdb57('0x36')],function(_0x3b7c42){var _0x22d5b5={};_0x22d5b5[_0x3b7c42]={'$like':'%'+_0x12f90d[_0xdb57('0x34')]['filter']+'%'};return _0x22d5b5;})});}_0x3f803d=_[_0xdb57('0x3f')]({},_0x3f803d,_0x12f90d['options']);return db[_0xdb57('0x5c')]['count']({'where':_0x3f803d[_0xdb57('0x3d')]})[_0xdb57('0x25')](function(_0x4381a6){_0x56d69f[_0xdb57('0x1e')]=_0x4381a6;if(_0x12f90d[_0xdb57('0x34')][_0xdb57('0x42')]){_0x3f803d['include']=[{'all':!![]}];}return db[_0xdb57('0x5c')][_0xdb57('0x44')](_0x3f803d);})[_0xdb57('0x25')](function(_0x4f775e){_0x56d69f[_0xdb57('0x5a')]=_0x4f775e;return _0x56d69f;});}})[_0xdb57('0x25')](respondWithFilteredResult(_0x8aa5ea,_0x3f803d))[_0xdb57('0x51')](handleError(_0x8aa5ea,null));};exports['getHopperFinals']=function(_0xc6113b,_0x18009a,_0x111b78){var _0x4a6ee1={'raw':!![],'where':{}};var _0x2b49cc={};var _0x4534d1={'count':0x0,'rows':[]};return db[_0xdb57('0x2e')][_0xdb57('0x57')]({'where':{'id':_0xc6113b['params']['id']}})[_0xdb57('0x25')](handleEntityNotFound(_0x18009a,null))['then'](function(_0x352b35){if(_0x352b35){_0x2b49cc[_0xdb57('0x32')]=_[_0xdb57('0x33')](db[_0xdb57('0x5e')]['rawAttributes']);_0x2b49cc[_0xdb57('0x34')]=_[_0xdb57('0x33')](_0xc6113b[_0xdb57('0x34')]);_0x2b49cc[_0xdb57('0x3e')]=_[_0xdb57('0x35')](_0x2b49cc[_0xdb57('0x32')],_0x2b49cc[_0xdb57('0x34')]);_0x4a6ee1[_0xdb57('0x36')]=_[_0xdb57('0x35')](_0x2b49cc[_0xdb57('0x32')],qs['fields'](_0xc6113b[_0xdb57('0x34')][_0xdb57('0x37')]));_0x4a6ee1[_0xdb57('0x36')]=_0x4a6ee1['attributes'][_0xdb57('0x38')]?_0x4a6ee1[_0xdb57('0x36')]:_0x2b49cc[_0xdb57('0x32')];if(!_0xc6113b['query'][_0xdb57('0x39')](_0xdb57('0x3a'))){_0x4a6ee1[_0xdb57('0x1f')]=qs[_0xdb57('0x1f')](_0xc6113b['query'][_0xdb57('0x1f')]);_0x4a6ee1[_0xdb57('0x1c')]=qs[_0xdb57('0x1c')](_0xc6113b[_0xdb57('0x34')][_0xdb57('0x1c')]);}_0x4a6ee1[_0xdb57('0x3b')]=qs[_0xdb57('0x3c')](_0xc6113b[_0xdb57('0x34')][_0xdb57('0x3c')]);_0x4a6ee1[_0xdb57('0x3d')]=qs[_0xdb57('0x3e')](_['pick'](_0xc6113b[_0xdb57('0x34')],_0x2b49cc['filters']));_0x4a6ee1[_0xdb57('0x3d')]['CampaignId']=_0x352b35['id'];if(_0xc6113b['query'][_0xdb57('0x41')]){_0x4a6ee1[_0xdb57('0x3d')]=_[_0xdb57('0x3f')](_0x4a6ee1[_0xdb57('0x3d')],{'$or':_[_0xdb57('0x2d')](_0x4a6ee1[_0xdb57('0x36')],function(_0x34bf2d){var _0x2a6503={};_0x2a6503[_0x34bf2d]={'$like':'%'+_0xc6113b[_0xdb57('0x34')][_0xdb57('0x41')]+'%'};return _0x2a6503;})});}_0x4a6ee1=_[_0xdb57('0x3f')]({},_0x4a6ee1,_0xc6113b[_0xdb57('0x47')]);return db[_0xdb57('0x5e')]['count']({'where':_0x4a6ee1['where']})[_0xdb57('0x25')](function(_0x132ebf){_0x4534d1[_0xdb57('0x1e')]=_0x132ebf;if(_0xc6113b[_0xdb57('0x34')][_0xdb57('0x42')]){_0x4a6ee1['include']=[{'all':!![]}];}return db[_0xdb57('0x5e')][_0xdb57('0x44')](_0x4a6ee1);})[_0xdb57('0x25')](function(_0x3b6235){_0x4534d1['rows']=_0x3b6235;return _0x4534d1;});}})[_0xdb57('0x25')](respondWithFilteredResult(_0x18009a,_0x4a6ee1))[_0xdb57('0x51')](handleError(_0x18009a,null));};exports[_0xdb57('0x5f')]=function(_0x421427,_0x7e346b,_0x101ee5){var _0x29696e={'raw':!![],'where':{}};var _0x44f717={};var _0x55a690={'count':0x0,'rows':[]};return db['Campaign'][_0xdb57('0x57')]({'where':{'id':_0x421427[_0xdb57('0x46')]['id']}})['then'](handleEntityNotFound(_0x7e346b,null))[_0xdb57('0x25')](function(_0x195ccc){if(_0x195ccc){_0x44f717[_0xdb57('0x32')]=_[_0xdb57('0x33')](db[_0xdb57('0x60')]['rawAttributes']);_0x44f717[_0xdb57('0x34')]=_[_0xdb57('0x33')](_0x421427[_0xdb57('0x34')]);_0x44f717['filters']=_[_0xdb57('0x35')](_0x44f717['model'],_0x44f717[_0xdb57('0x34')]);_0x29696e[_0xdb57('0x36')]=_['intersection'](_0x44f717[_0xdb57('0x32')],qs[_0xdb57('0x37')](_0x421427[_0xdb57('0x34')][_0xdb57('0x37')]));_0x29696e[_0xdb57('0x36')]=_0x29696e[_0xdb57('0x36')][_0xdb57('0x38')]?_0x29696e[_0xdb57('0x36')]:_0x44f717['model'];if(!_0x421427[_0xdb57('0x34')][_0xdb57('0x39')](_0xdb57('0x3a'))){_0x29696e['limit']=qs[_0xdb57('0x1f')](_0x421427[_0xdb57('0x34')][_0xdb57('0x1f')]);_0x29696e[_0xdb57('0x1c')]=qs[_0xdb57('0x1c')](_0x421427[_0xdb57('0x34')][_0xdb57('0x1c')]);}_0x29696e['order']=qs[_0xdb57('0x3c')](_0x421427[_0xdb57('0x34')]['sort']);_0x29696e[_0xdb57('0x3d')]=qs[_0xdb57('0x3e')](_[_0xdb57('0x58')](_0x421427[_0xdb57('0x34')],_0x44f717[_0xdb57('0x3e')]));_0x29696e[_0xdb57('0x3d')]['CampaignId']=_0x195ccc['id'];if(_0x421427[_0xdb57('0x34')][_0xdb57('0x41')]){_0x29696e[_0xdb57('0x3d')]=_[_0xdb57('0x3f')](_0x29696e[_0xdb57('0x3d')],{'$or':_[_0xdb57('0x2d')](_0x29696e['attributes'],function(_0x3d0609){var _0x20423c={};_0x20423c[_0x3d0609]={'$like':'%'+_0x421427[_0xdb57('0x34')][_0xdb57('0x41')]+'%'};return _0x20423c;})});}_0x29696e=_['merge']({},_0x29696e,_0x421427[_0xdb57('0x47')]);return db[_0xdb57('0x60')]['count']({'where':_0x29696e[_0xdb57('0x3d')]})[_0xdb57('0x25')](function(_0x5c420b){_0x55a690[_0xdb57('0x1e')]=_0x5c420b;if(_0x421427[_0xdb57('0x34')]['includeAll']){_0x29696e['include']=[{'all':!![]}];}return db[_0xdb57('0x60')]['findAll'](_0x29696e);})[_0xdb57('0x25')](function(_0x16e446){_0x55a690[_0xdb57('0x5a')]=_0x16e446;return _0x55a690;});}})[_0xdb57('0x25')](respondWithFilteredResult(_0x7e346b,_0x29696e))[_0xdb57('0x51')](handleError(_0x7e346b,null));};exports[_0xdb57('0x61')]=function(_0x39de79,_0x42c2a8,_0x425f50){var _0x182af6={};var _0x7b47c5={};var _0x4a08ad;var _0x23412f;return db[_0xdb57('0x2e')][_0xdb57('0x57')]({'where':{'id':_0x39de79[_0xdb57('0x46')]['id']}})[_0xdb57('0x25')](handleEntityNotFound(_0x42c2a8,null))[_0xdb57('0x25')](function(_0x5f2655){if(_0x5f2655){_0x4a08ad=_0x5f2655;_0x7b47c5['model']=_[_0xdb57('0x33')](db[_0xdb57('0x62')]['rawAttributes']);_0x7b47c5[_0xdb57('0x34')]=_[_0xdb57('0x33')](_0x39de79[_0xdb57('0x34')]);_0x7b47c5[_0xdb57('0x3e')]=_[_0xdb57('0x35')](_0x7b47c5[_0xdb57('0x32')],_0x7b47c5['query']);_0x182af6[_0xdb57('0x36')]=_[_0xdb57('0x35')](_0x7b47c5[_0xdb57('0x32')],qs[_0xdb57('0x37')](_0x39de79[_0xdb57('0x34')][_0xdb57('0x37')]));_0x182af6[_0xdb57('0x36')]=_0x182af6['attributes'][_0xdb57('0x38')]?_0x182af6[_0xdb57('0x36')]:_0x7b47c5[_0xdb57('0x32')];_0x182af6[_0xdb57('0x3b')]=qs[_0xdb57('0x3c')](_0x39de79['query'][_0xdb57('0x3c')]);_0x182af6[_0xdb57('0x3d')]=qs[_0xdb57('0x3e')](_[_0xdb57('0x58')](_0x39de79['query'],_0x7b47c5['filters']));if(_0x39de79['query'][_0xdb57('0x41')]){_0x182af6['where']=_[_0xdb57('0x3f')](_0x182af6[_0xdb57('0x3d')],{'$or':_[_0xdb57('0x2d')](_0x182af6['attributes'],function(_0x57c22e){var _0x253030={};_0x253030[_0x57c22e]={'$like':'%'+_0x39de79[_0xdb57('0x34')]['filter']+'%'};return _0x253030;})});}_0x182af6=_[_0xdb57('0x3f')]({},_0x182af6,_0x39de79[_0xdb57('0x47')]);return _0x4a08ad['getLists'](_0x182af6);}})[_0xdb57('0x25')](function(_0x491b1b){if(_0x491b1b){_0x23412f=_0x491b1b[_0xdb57('0x38')];if(!_0x39de79[_0xdb57('0x34')]['hasOwnProperty'](_0xdb57('0x3a'))){_0x182af6['limit']=qs[_0xdb57('0x1f')](_0x39de79['query']['limit']);_0x182af6[_0xdb57('0x1c')]=qs[_0xdb57('0x1c')](_0x39de79[_0xdb57('0x34')]['offset']);}return _0x4a08ad[_0xdb57('0x61')](_0x182af6);}})[_0xdb57('0x25')](function(_0x340816){if(_0x340816){return _0x340816?{'count':_0x23412f,'rows':_0x340816}:null;}})[_0xdb57('0x25')](respondWithResult(_0x42c2a8,null))['catch'](handleError(_0x42c2a8,null));};exports[_0xdb57('0x63')]=function(_0xd5ccc1,_0x21a30f,_0x2788fc){var _0x4f04c0,_0x2c6762;var _0x104ca7=[];var _0x34e895=moment()['format'](_0xdb57('0x64'));return db[_0xdb57('0x2e')][_0xdb57('0x48')]({'where':{'id':_0xd5ccc1[_0xdb57('0x46')]['id']}})[_0xdb57('0x25')](handleEntityNotFound(_0x21a30f,null))['then'](function(_0x50d4ad){if(_0x50d4ad){_0x2c6762=_0x50d4ad;return _0x50d4ad[_0xdb57('0x63')](_0xd5ccc1[_0xdb57('0x4a')][_0xdb57('0x65')],_['omit'](_0xd5ccc1[_0xdb57('0x4a')],[_0xdb57('0x65'),'id'])||{});}return null;})[_0xdb57('0x66')](function(_0x856af6){var _0x49dc5d;var _0x9f4eb0;_0x4f04c0=_0x856af6||[];var _0x246468=[];if(_0x856af6){for(var _0x12df8d=0x0;_0x12df8d<_0x856af6['length'];_0x12df8d+=0x1){var _0x55f617=_0x856af6[_0x12df8d][_0xdb57('0x4c')]({'plain':!![]});_0x2c6762['dialCheckDuplicateType']=_0xd5ccc1[_0xdb57('0x4a')][_0xdb57('0x67')]?_0xd5ccc1['body']['dialCheckDuplicateType']:_0x2c6762[_0xdb57('0x67')];switch(_0x2c6762['dialCheckDuplicateType']){case _0xdb57('0x68'):_0x49dc5d=squel[_0xdb57('0x69')]()[_0xdb57('0x6a')]('cm_hopper')[_0xdb57('0x6b')](['phone',_0xdb57('0x6c'),_0xdb57('0x6d'),_0xdb57('0x6e'),_0xdb57('0x5d'),_0xdb57('0x54'),'updatedAt'],squel['select']()['field'](_0xdb57('0x6f'),_0xdb57('0x6f'))[_0xdb57('0x70')](_0xdb57('0x71'),_0xdb57('0x6c'))['field']('id',_0xdb57('0x6d'))[_0xdb57('0x70')](_0x55f617[_0xdb57('0x72')][_0xdb57('0x73')](),_0xdb57('0x6e'))['field'](_0xd5ccc1[_0xdb57('0x46')]['id'][_0xdb57('0x73')](),_0xdb57('0x5d'))[_0xdb57('0x70')]('\x27'+_0x34e895+'\x27',_0xdb57('0x54'))[_0xdb57('0x70')]('\x27'+_0x34e895+'\x27',_0xdb57('0x55'))[_0xdb57('0x74')](_0xdb57('0x75'))['where'](_0xdb57('0x76'))['where'](_0xdb57('0x77'),_0x55f617['CmListId'][_0xdb57('0x73')]())[_0xdb57('0x3d')](_0xdb57('0x78'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xdb57('0x79')]()[_0xdb57('0x70')](_0xdb57('0x7a'))[_0xdb57('0x74')]('cm_hopper_final')[_0xdb57('0x3d')](_0xdb57('0x7b'),_0xd5ccc1['params']['id']['toString']()))[_0xdb57('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel[_0xdb57('0x79')]()[_0xdb57('0x70')](_0xdb57('0x7c'))[_0xdb57('0x74')](_0xdb57('0x7d'))[_0xdb57('0x3d')](_0xdb57('0x7b'),_0xd5ccc1[_0xdb57('0x46')]['id']['toString']())))[_0xdb57('0x73')]();break;case'onlyIfOpen':_0x49dc5d=squel[_0xdb57('0x69')]()[_0xdb57('0x6a')](_0xdb57('0x7d'))[_0xdb57('0x6b')](['phone','scheduledAt',_0xdb57('0x6d'),_0xdb57('0x6e'),_0xdb57('0x5d'),_0xdb57('0x54'),_0xdb57('0x55')],squel['select']()[_0xdb57('0x70')](_0xdb57('0x6f'),_0xdb57('0x6f'))[_0xdb57('0x70')](_0xdb57('0x71'),_0xdb57('0x6c'))['field']('id',_0xdb57('0x6d'))[_0xdb57('0x70')](_0x55f617[_0xdb57('0x72')][_0xdb57('0x73')](),_0xdb57('0x6e'))[_0xdb57('0x70')](_0xd5ccc1['params']['id'][_0xdb57('0x73')](),_0xdb57('0x5d'))[_0xdb57('0x70')]('\x27'+_0x34e895+'\x27',_0xdb57('0x54'))[_0xdb57('0x70')]('\x27'+_0x34e895+'\x27',_0xdb57('0x55'))[_0xdb57('0x74')](_0xdb57('0x75'))[_0xdb57('0x3d')](_0xdb57('0x76'))[_0xdb57('0x3d')](_0xdb57('0x77'),_0x55f617[_0xdb57('0x72')][_0xdb57('0x73')]())[_0xdb57('0x3d')](_0xdb57('0x78'))[_0xdb57('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xdb57('0x70')](_0xdb57('0x7c'))[_0xdb57('0x74')](_0xdb57('0x7d'))['where'](_0xdb57('0x7b'),_0xd5ccc1[_0xdb57('0x46')]['id'][_0xdb57('0x73')]())))[_0xdb57('0x73')]();break;default:_0x49dc5d=squel[_0xdb57('0x69')]()['into']('cm_hopper')['fromQuery']([_0xdb57('0x6f'),_0xdb57('0x6c'),_0xdb57('0x6d'),'ListId',_0xdb57('0x5d'),_0xdb57('0x54'),_0xdb57('0x55')],squel[_0xdb57('0x79')]()[_0xdb57('0x70')]('phone',_0xdb57('0x6f'))[_0xdb57('0x70')](_0xdb57('0x71'),'scheduledAt')[_0xdb57('0x70')]('id','ContactId')[_0xdb57('0x70')](_0x55f617[_0xdb57('0x72')][_0xdb57('0x73')](),_0xdb57('0x6e'))[_0xdb57('0x70')](_0xd5ccc1[_0xdb57('0x46')]['id'][_0xdb57('0x73')](),_0xdb57('0x5d'))[_0xdb57('0x70')]('\x27'+_0x34e895+'\x27',_0xdb57('0x54'))[_0xdb57('0x70')]('\x27'+_0x34e895+'\x27',_0xdb57('0x55'))[_0xdb57('0x74')](_0xdb57('0x75'))[_0xdb57('0x3d')](_0xdb57('0x76'))['where'](_0xdb57('0x77'),_0x55f617[_0xdb57('0x72')][_0xdb57('0x73')]())[_0xdb57('0x3d')](_0xdb57('0x78')))[_0xdb57('0x73')]();}_0x9f4eb0=squel[_0xdb57('0x69')]()['into'](_0xdb57('0x7e'))[_0xdb57('0x6b')]([_0xdb57('0x7f'),_0xdb57('0x6c'),_0xdb57('0x6f'),_0xdb57('0x80'),_0xdb57('0x54'),'updatedAt'],squel[_0xdb57('0x79')]()[_0xdb57('0x70')](_0xdb57('0x81'),'id')['field'](_0xdb57('0x71'),_0xdb57('0x6c'))['field'](_0xdb57('0x82'),_0xdb57('0x6f'))[_0xdb57('0x70')](_0xdb57('0x83'),_0xdb57('0x80'))['field']('\x27'+_0x34e895+'\x27',_0xdb57('0x54'))[_0xdb57('0x70')]('\x27'+_0x34e895+'\x27',_0xdb57('0x55'))[_0xdb57('0x74')](_0xdb57('0x84'),'ci')[_0xdb57('0x85')]('cm_hopper','h',_0xdb57('0x86'))[_0xdb57('0x3d')](_0xdb57('0x87'),_0x55f617['CmListId'][_0xdb57('0x73')]())[_0xdb57('0x3d')](_0xdb57('0x88'),_0xd5ccc1[_0xdb57('0x46')]['id'][_0xdb57('0x73')]())['where'](_0xdb57('0x89'),_0x34e895))['toString']();_0x246468[_0xdb57('0x8a')](db[_0xdb57('0x8b')]['query'](_0x49dc5d));_0x104ca7[_0xdb57('0x8a')](db['sequelize'][_0xdb57('0x34')](_0x9f4eb0));}return BPromise[_0xdb57('0x8c')](_0x246468);}})['then'](function(){return BPromise[_0xdb57('0x8c')](_0x104ca7);})[_0xdb57('0x25')](function(){return _0x4f04c0;})[_0xdb57('0x25')](respondWithResult(_0x21a30f,null))[_0xdb57('0x51')](handleError(_0x21a30f,null));};exports['removeLists']=function(_0x479ea7,_0x3c0ec1,_0xe5a4be){return db[_0xdb57('0x2e')][_0xdb57('0x48')]({'where':{'id':_0x479ea7[_0xdb57('0x46')]['id']}})['then'](handleEntityNotFound(_0x3c0ec1,null))['then'](function(_0xac1323){if(_0xac1323){return _0xac1323[_0xdb57('0x8d')](_0x479ea7[_0xdb57('0x34')][_0xdb57('0x65')]);}})['then'](function(_0x434563){if(_0x434563){return db['CmHopper'][_0xdb57('0x26')]({'where':{'ListId':_0x479ea7[_0xdb57('0x34')][_0xdb57('0x65')],'CampaignId':_0x479ea7[_0xdb57('0x46')]['id']}})[_0xdb57('0x25')](function(){return _0x434563;});}})[_0xdb57('0x25')](respondWithStatusCode(_0x3c0ec1,null))[_0xdb57('0x51')](handleError(_0x3c0ec1,null));};exports[_0xdb57('0x8e')]=function(_0x70266f,_0x26b5c9,_0x1b6bf0){var _0x3bb8eb={};var _0x27a4ca={};var _0x4ed971;var _0x3e78cd;return db[_0xdb57('0x2e')][_0xdb57('0x57')]({'where':{'id':_0x70266f[_0xdb57('0x46')]['id']}})[_0xdb57('0x25')](handleEntityNotFound(_0x26b5c9,null))[_0xdb57('0x25')](function(_0x16d08c){if(_0x16d08c){_0x4ed971=_0x16d08c;_0x27a4ca[_0xdb57('0x32')]=_[_0xdb57('0x33')](db[_0xdb57('0x62')]['rawAttributes']);_0x27a4ca[_0xdb57('0x34')]=_['keys'](_0x70266f[_0xdb57('0x34')]);_0x27a4ca[_0xdb57('0x3e')]=_[_0xdb57('0x35')](_0x27a4ca[_0xdb57('0x32')],_0x27a4ca[_0xdb57('0x34')]);_0x3bb8eb[_0xdb57('0x36')]=_['intersection'](_0x27a4ca[_0xdb57('0x32')],qs[_0xdb57('0x37')](_0x70266f[_0xdb57('0x34')][_0xdb57('0x37')]));_0x3bb8eb[_0xdb57('0x36')]=_0x3bb8eb[_0xdb57('0x36')][_0xdb57('0x38')]?_0x3bb8eb[_0xdb57('0x36')]:_0x27a4ca[_0xdb57('0x32')];_0x3bb8eb[_0xdb57('0x3b')]=qs[_0xdb57('0x3c')](_0x70266f[_0xdb57('0x34')][_0xdb57('0x3c')]);_0x3bb8eb[_0xdb57('0x3d')]=qs[_0xdb57('0x3e')](_['pick'](_0x70266f[_0xdb57('0x34')],_0x27a4ca[_0xdb57('0x3e')]));if(_0x70266f[_0xdb57('0x34')]['filter']){_0x3bb8eb[_0xdb57('0x3d')]=_[_0xdb57('0x3f')](_0x3bb8eb['where'],{'$or':_[_0xdb57('0x2d')](_0x3bb8eb[_0xdb57('0x36')],function(_0x4b0a39){var _0x562018={};_0x562018[_0x4b0a39]={'$like':'%'+_0x70266f[_0xdb57('0x34')][_0xdb57('0x41')]+'%'};return _0x562018;})});}_0x3bb8eb=_[_0xdb57('0x3f')]({},_0x3bb8eb,_0x70266f[_0xdb57('0x47')]);return _0x4ed971['getBlackLists'](_0x3bb8eb);}})[_0xdb57('0x25')](function(_0x4e4dd5){if(_0x4e4dd5){_0x3e78cd=_0x4e4dd5[_0xdb57('0x38')];if(!_0x70266f[_0xdb57('0x34')]['hasOwnProperty']('nolimit')){_0x3bb8eb[_0xdb57('0x1f')]=qs[_0xdb57('0x1f')](_0x70266f[_0xdb57('0x34')][_0xdb57('0x1f')]);_0x3bb8eb[_0xdb57('0x1c')]=qs[_0xdb57('0x1c')](_0x70266f['query'][_0xdb57('0x1c')]);}return _0x4ed971['getBlackLists'](_0x3bb8eb);}})[_0xdb57('0x25')](function(_0x5e295f){if(_0x5e295f){return _0x5e295f?{'count':_0x3e78cd,'rows':_0x5e295f}:null;}})[_0xdb57('0x25')](respondWithResult(_0x26b5c9,null))[_0xdb57('0x51')](handleError(_0x26b5c9,null));};exports[_0xdb57('0x8f')]=function(_0xa4d460,_0x3dc5cc,_0x41b295){var _0x4ef27d,_0x5165c2;var _0x2b3fcf=[];var _0x3e6eaa=moment()[_0xdb57('0x90')](_0xdb57('0x64'));return db['Campaign'][_0xdb57('0x48')]({'where':{'id':_0xa4d460[_0xdb57('0x46')]['id']}})['then'](handleEntityNotFound(_0x3dc5cc,null))[_0xdb57('0x25')](function(_0x155a24){if(_0x155a24){_0x5165c2=_0x155a24;return _0x155a24[_0xdb57('0x8f')](_0xa4d460[_0xdb57('0x4a')]['ids'],_[_0xdb57('0x53')](_0xa4d460[_0xdb57('0x4a')],[_0xdb57('0x65'),'id'])||{});}return null;})['spread'](function(_0x42a946){var _0x477eb3;var _0x1b8e0b;_0x4ef27d=_0x42a946||[];var _0x411c40=[];if(_0x42a946){for(var _0x2e77f2=0x0;_0x2e77f2<_0x42a946[_0xdb57('0x38')];_0x2e77f2+=0x1){var _0x44ccde=_0x42a946[_0x2e77f2][_0xdb57('0x4c')]({'plain':!![]});_0x477eb3=squel[_0xdb57('0x69')]()[_0xdb57('0x6a')](_0xdb57('0x91'))[_0xdb57('0x6b')](['phone',_0xdb57('0x6d'),_0xdb57('0x6e'),'CampaignId',_0xdb57('0x54'),'updatedAt'],squel[_0xdb57('0x79')]()[_0xdb57('0x70')](_0xdb57('0x6f'),_0xdb57('0x6f'))['field']('id','ContactId')[_0xdb57('0x70')](_0x44ccde[_0xdb57('0x72')][_0xdb57('0x73')](),_0xdb57('0x6e'))[_0xdb57('0x70')](_0xa4d460[_0xdb57('0x46')]['id'][_0xdb57('0x73')](),_0xdb57('0x5d'))[_0xdb57('0x70')](_0xdb57('0x71'),_0xdb57('0x54'))['field'](_0xdb57('0x71'),_0xdb57('0x55'))[_0xdb57('0x74')]('cm_contacts')[_0xdb57('0x3d')](_0xdb57('0x76'))[_0xdb57('0x3d')](_0xdb57('0x77'),_0x44ccde['CmListId']['toString']())[_0xdb57('0x3d')](_0xdb57('0x78')))[_0xdb57('0x73')]();_0x411c40[_0xdb57('0x8a')](db[_0xdb57('0x8b')][_0xdb57('0x34')](_0x477eb3));}return BPromise[_0xdb57('0x8c')](_0x411c40);}})[_0xdb57('0x25')](function(){return _0x4ef27d;})[_0xdb57('0x25')](respondWithResult(_0x3dc5cc,null))['catch'](handleError(_0x3dc5cc,null));};exports['removeBlackLists']=function(_0x5f0d8c,_0xb81699,_0x1e5bf4){return db[_0xdb57('0x2e')]['find']({'where':{'id':_0x5f0d8c[_0xdb57('0x46')]['id']}})[_0xdb57('0x25')](handleEntityNotFound(_0xb81699,null))[_0xdb57('0x25')](function(_0x4d3126){if(_0x4d3126){return _0x4d3126[_0xdb57('0x92')](_0x5f0d8c[_0xdb57('0x34')]['ids']);}})[_0xdb57('0x25')](function(_0xf3b9d3){if(_0xf3b9d3){return db[_0xdb57('0x60')]['destroy']({'where':{'ListId':_0x5f0d8c['query'][_0xdb57('0x65')],'CampaignId':_0x5f0d8c[_0xdb57('0x46')]['id']}})[_0xdb57('0x25')](function(){return _0xf3b9d3;});}})[_0xdb57('0x25')](respondWithStatusCode(_0xb81699,null))['catch'](handleError(_0xb81699,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 3ec9c6a..49e04f2 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x22fe70,_0x6e1a47){var _0x93d0b4=function(_0x413e0f){while(--_0x413e0f){_0x22fe70['push'](_0x22fe70['shift']());}};_0x93d0b4(++_0x6e1a47);}(_0x7a54,0x106));var _0x47a5=function(_0x515d93,_0x48c6e0){_0x515d93=_0x515d93-0x0;var _0xe6e697=_0x7a54[_0x515d93];return _0xe6e697;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x3ec333,_0x26bcbe){var _0x15ccb8=function(_0x2c4d0c){while(--_0x2c4d0c){_0x3ec333['push'](_0x3ec333['shift']());}};_0x15ccb8(++_0x26bcbe);}(_0x7a54,0x106));var _0x47a5=function(_0x56a8ee,_0x3b1ccd){_0x56a8ee=_0x56a8ee-0x0;var _0x813043=_0x7a54[_0x56a8ee];return _0x813043;};'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 3fe60f4..6a667ac 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 _0xe13e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetCampaign','Campaign','options','where','attributes','limit','include','model','map','moment','bluebird'];(function(_0x5a130d,_0x5a9e96){var _0x1822f2=function(_0x335bcd){while(--_0x335bcd){_0x5a130d['push'](_0x5a130d['shift']());}};_0x1822f2(++_0x5a9e96);}(_0xe13e,0xde));var _0xee13=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe13e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xee13('0x0'));var BPromise=require(_0xee13('0x1'));var rs=require(_0xee13('0x2'));var fs=require('fs');var Redis=require(_0xee13('0x3'));var db=require(_0xee13('0x4'))['db'];var utils=require(_0xee13('0x5'));var logger=require(_0xee13('0x6'))(_0xee13('0x7'));var config=require(_0xee13('0x8'));var jayson=require(_0xee13('0x9'));var client=jayson[_0xee13('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8f606d,_0x3ae6e2,_0xfdb836){return new BPromise(function(_0x64ee02,_0x4810bd){return client[_0xee13('0xb')](_0x8f606d,_0xfdb836)[_0xee13('0xc')](function(_0x1cc55b){logger[_0xee13('0xd')](_0xee13('0xe'),_0x3ae6e2,'request\x20sent');logger[_0xee13('0xf')](_0xee13('0x10'),_0x3ae6e2,'request\x20sent',JSON[_0xee13('0x11')](_0x1cc55b));if(_0x1cc55b['error']){if(_0x1cc55b['error']['code']===0x1f4){logger[_0xee13('0x12')]('Campaign,\x20%s,\x20%s',_0x3ae6e2,_0x1cc55b[_0xee13('0x12')][_0xee13('0x13')]);return _0x4810bd(_0x1cc55b[_0xee13('0x12')][_0xee13('0x13')]);}logger[_0xee13('0x12')](_0xee13('0xe'),_0x3ae6e2,_0x1cc55b[_0xee13('0x12')]['message']);return _0x64ee02(_0x1cc55b[_0xee13('0x12')][_0xee13('0x13')]);}else{logger[_0xee13('0xd')]('Campaign,\x20%s,\x20%s',_0x3ae6e2,_0xee13('0x14'));_0x64ee02(_0x1cc55b[_0xee13('0x15')]['message']);}})[_0xee13('0x16')](function(_0xcd1482){logger[_0xee13('0x12')](_0xee13('0xe'),_0x3ae6e2,_0xcd1482);_0x4810bd(_0xcd1482);});});}exports[_0xee13('0x17')]=function(_0x3a5819){var _0xd353d0=this;return new Promise(function(_0x33bd9c,_0x3806b0){return db[_0xee13('0x18')]['findAll']({'raw':_0x3a5819[_0xee13('0x19')]?_0x3a5819[_0xee13('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3a5819[_0xee13('0x19')]?_0x3a5819['options'][_0xee13('0x1a')]||null:null,'attributes':_0x3a5819['options']?_0x3a5819[_0xee13('0x19')][_0xee13('0x1b')]||null:null,'limit':_0x3a5819['options']?_0x3a5819[_0xee13('0x19')][_0xee13('0x1c')]||null:null,'include':_0x3a5819[_0xee13('0x19')]?_0x3a5819[_0xee13('0x19')][_0xee13('0x1d')]?_['map'](_0x3a5819[_0xee13('0x19')][_0xee13('0x1d')],function(_0x4c705c){return{'model':db[_0x4c705c[_0xee13('0x1e')]],'as':_0x4c705c['as'],'attributes':_0x4c705c['attributes'],'include':_0x4c705c[_0xee13('0x1d')]?_['map'](_0x4c705c['include'],function(_0x381508){return{'model':db[_0x381508[_0xee13('0x1e')]],'as':_0x381508['as'],'attributes':_0x381508['attributes'],'include':_0x381508[_0xee13('0x1d')]?_[_0xee13('0x1f')](_0x381508[_0xee13('0x1d')],function(_0x48b604){return{'model':db[_0x48b604['model']],'as':_0x48b604['as'],'attributes':_0x48b604[_0xee13('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xee13('0xc')](function(_0x257323){logger[_0xee13('0xd')](_0xee13('0x17'),_0x3a5819);logger[_0xee13('0xf')](_0xee13('0x17'),_0x3a5819,JSON[_0xee13('0x11')](_0x257323));_0x33bd9c(_0x257323);})[_0xee13('0x16')](function(_0x458e12){logger[_0xee13('0x12')](_0xee13('0x17'),_0x458e12[_0xee13('0x13')],_0x3a5819);_0x3806b0(_0xd353d0[_0xee13('0x12')](0x1f4,_0x458e12[_0xee13('0x13')]));});});}; \ No newline at end of file +var _0xf958=['message','catch','Campaign','findAll','options','where','limit','map','model','include','attributes','GetCampaign','stringify','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x4ecb9b,_0xb2c16b){var _0x451ffb=function(_0x377db2){while(--_0x377db2){_0x4ecb9b['push'](_0x4ecb9b['shift']());}};_0x451ffb(++_0xb2c16b);}(_0xf958,0xe6));var _0x8f95=function(_0x2aa68f,_0x809c6c){_0x2aa68f=_0x2aa68f-0x0;var _0x2a6472=_0xf958[_0x2aa68f];return _0x2a6472;};'use strict';var _=require(_0x8f95('0x0'));var util=require('util');var moment=require(_0x8f95('0x1'));var BPromise=require('bluebird');var rs=require(_0x8f95('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f95('0x3'))['db'];var utils=require(_0x8f95('0x4'));var logger=require(_0x8f95('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8f95('0x6'));var client=jayson[_0x8f95('0x7')][_0x8f95('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c2af8,_0x5cfc04,_0x1ae9c4){return new BPromise(function(_0x109bed,_0x435b5b){return client[_0x8f95('0x9')](_0x5c2af8,_0x1ae9c4)[_0x8f95('0xa')](function(_0x585025){logger[_0x8f95('0xb')](_0x8f95('0xc'),_0x5cfc04,'request\x20sent');logger[_0x8f95('0xd')](_0x8f95('0xe'),_0x5cfc04,_0x8f95('0xf'),JSON['stringify'](_0x585025));if(_0x585025[_0x8f95('0x10')]){if(_0x585025[_0x8f95('0x10')][_0x8f95('0x11')]===0x1f4){logger['error'](_0x8f95('0xc'),_0x5cfc04,_0x585025[_0x8f95('0x10')][_0x8f95('0x12')]);return _0x435b5b(_0x585025['error'][_0x8f95('0x12')]);}logger[_0x8f95('0x10')](_0x8f95('0xc'),_0x5cfc04,_0x585025[_0x8f95('0x10')][_0x8f95('0x12')]);return _0x109bed(_0x585025[_0x8f95('0x10')][_0x8f95('0x12')]);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x5cfc04,'request\x20sent');_0x109bed(_0x585025['result']['message']);}})[_0x8f95('0x13')](function(_0x2f01cd){logger[_0x8f95('0x10')](_0x8f95('0xc'),_0x5cfc04,_0x2f01cd);_0x435b5b(_0x2f01cd);});});}exports['GetCampaign']=function(_0x5da758){var _0x14d21f=this;return new Promise(function(_0x17b85b,_0x55ba7f){return db[_0x8f95('0x14')][_0x8f95('0x15')]({'raw':_0x5da758[_0x8f95('0x16')]?_0x5da758[_0x8f95('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5da758[_0x8f95('0x16')]?_0x5da758[_0x8f95('0x16')][_0x8f95('0x17')]||null:null,'attributes':_0x5da758[_0x8f95('0x16')]?_0x5da758['options']['attributes']||null:null,'limit':_0x5da758[_0x8f95('0x16')]?_0x5da758[_0x8f95('0x16')][_0x8f95('0x18')]||null:null,'include':_0x5da758[_0x8f95('0x16')]?_0x5da758[_0x8f95('0x16')]['include']?_[_0x8f95('0x19')](_0x5da758[_0x8f95('0x16')]['include'],function(_0x205c3e){return{'model':db[_0x205c3e[_0x8f95('0x1a')]],'as':_0x205c3e['as'],'attributes':_0x205c3e['attributes'],'include':_0x205c3e[_0x8f95('0x1b')]?_[_0x8f95('0x19')](_0x205c3e[_0x8f95('0x1b')],function(_0xb00b6f){return{'model':db[_0xb00b6f['model']],'as':_0xb00b6f['as'],'attributes':_0xb00b6f[_0x8f95('0x1c')],'include':_0xb00b6f['include']?_['map'](_0xb00b6f[_0x8f95('0x1b')],function(_0x5dabb6){return{'model':db[_0x5dabb6[_0x8f95('0x1a')]],'as':_0x5dabb6['as'],'attributes':_0x5dabb6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x312658){logger['info'](_0x8f95('0x1d'),_0x5da758);logger['debug'](_0x8f95('0x1d'),_0x5da758,JSON[_0x8f95('0x1e')](_0x312658));_0x17b85b(_0x312658);})[_0x8f95('0x13')](function(_0x2bb4ea){logger[_0x8f95('0x10')](_0x8f95('0x1d'),_0x2bb4ea[_0x8f95('0x12')],_0x5da758);_0x55ba7f(_0x14d21f[_0x8f95('0x10')](0x1f4,_0x2bb4ea[_0x8f95('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index a5e9247..84998eb 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 _0x9366=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','/:id/blacklists','post','create','/:id/clone','clone','addBlackLists','put','delete','/:id','destroy','removeLists','removeBlackLists','exports'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0x9366,0x14a));var _0x6936=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9366[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x6936('0x0'));var path=require(_0x6936('0x1'));var timeout=require(_0x6936('0x2'));var express=require(_0x6936('0x3'));var router=express[_0x6936('0x4')]();var fs_extra=require(_0x6936('0x5'));var auth=require(_0x6936('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6936('0x7'));var controller=require(_0x6936('0x8'));router[_0x6936('0x9')]('/',auth[_0x6936('0xa')](),controller[_0x6936('0xb')]);router['get']('/:id',auth[_0x6936('0xa')](),controller[_0x6936('0xc')]);router['get']('/:id/hoppers',auth['isAuthenticated'](),controller[_0x6936('0xd')]);router[_0x6936('0x9')](_0x6936('0xe'),auth[_0x6936('0xa')](),controller[_0x6936('0xf')]);router['get'](_0x6936('0x10'),auth['isAuthenticated'](),controller[_0x6936('0x11')]);router[_0x6936('0x9')]('/:id/hopper_black',auth[_0x6936('0xa')](),controller[_0x6936('0x12')]);router[_0x6936('0x9')](_0x6936('0x13'),auth[_0x6936('0xa')](),controller['getLists']);router[_0x6936('0x9')](_0x6936('0x14'),auth[_0x6936('0xa')](),controller['getBlackLists']);router[_0x6936('0x15')]('/',auth['isAuthenticated'](),controller[_0x6936('0x16')]);router[_0x6936('0x15')](_0x6936('0x17'),auth[_0x6936('0xa')](),controller[_0x6936('0x18')]);router[_0x6936('0x15')](_0x6936('0x13'),auth[_0x6936('0xa')](),controller['addLists']);router['post'](_0x6936('0x14'),auth['isAuthenticated'](),controller[_0x6936('0x19')]);router[_0x6936('0x1a')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x6936('0x1b')](_0x6936('0x1c'),auth[_0x6936('0xa')](),controller[_0x6936('0x1d')]);router[_0x6936('0x1b')](_0x6936('0x13'),auth[_0x6936('0xa')](),controller[_0x6936('0x1e')]);router[_0x6936('0x1b')](_0x6936('0x14'),auth[_0x6936('0xa')](),controller[_0x6936('0x1f')]);module[_0x6936('0x20')]=router; \ No newline at end of file +var _0x4c62=['removeBlackLists','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','getHoppers','/:id/hopper_histories','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','clone','addLists','addBlackLists','update','delete','destroy','removeLists'];(function(_0x14ea32,_0x262909){var _0x137bbb=function(_0x4a36ab){while(--_0x4a36ab){_0x14ea32['push'](_0x14ea32['shift']());}};_0x137bbb(++_0x262909);}(_0x4c62,0x18e));var _0x24c6=function(_0x53278c,_0x358eab){_0x53278c=_0x53278c-0x0;var _0x35ebb2=_0x4c62[_0x53278c];return _0x35ebb2;};'use strict';var multer=require(_0x24c6('0x0'));var util=require(_0x24c6('0x1'));var path=require(_0x24c6('0x2'));var timeout=require('connect-timeout');var express=require(_0x24c6('0x3'));var router=express[_0x24c6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x24c6('0x5'));var interaction=require(_0x24c6('0x6'));var config=require(_0x24c6('0x7'));var controller=require(_0x24c6('0x8'));router[_0x24c6('0x9')]('/',auth[_0x24c6('0xa')](),controller[_0x24c6('0xb')]);router['get'](_0x24c6('0xc'),auth[_0x24c6('0xa')](),controller[_0x24c6('0xd')]);router['get']('/:id/hoppers',auth[_0x24c6('0xa')](),controller[_0x24c6('0xe')]);router[_0x24c6('0x9')](_0x24c6('0xf'),auth[_0x24c6('0xa')](),controller['getHopperHistories']);router[_0x24c6('0x9')]('/:id/hopper_finals',auth[_0x24c6('0xa')](),controller[_0x24c6('0x10')]);router[_0x24c6('0x9')](_0x24c6('0x11'),auth[_0x24c6('0xa')](),controller['getHopperBlacks']);router[_0x24c6('0x9')](_0x24c6('0x12'),auth[_0x24c6('0xa')](),controller[_0x24c6('0x13')]);router[_0x24c6('0x9')](_0x24c6('0x14'),auth[_0x24c6('0xa')](),controller['getBlackLists']);router[_0x24c6('0x15')]('/',auth[_0x24c6('0xa')](),controller[_0x24c6('0x16')]);router[_0x24c6('0x15')](_0x24c6('0x17'),auth['isAuthenticated'](),controller[_0x24c6('0x18')]);router[_0x24c6('0x15')](_0x24c6('0x12'),auth[_0x24c6('0xa')](),controller[_0x24c6('0x19')]);router[_0x24c6('0x15')](_0x24c6('0x14'),auth['isAuthenticated'](),controller[_0x24c6('0x1a')]);router['put'](_0x24c6('0xc'),auth['isAuthenticated'](),controller[_0x24c6('0x1b')]);router[_0x24c6('0x1c')](_0x24c6('0xc'),auth[_0x24c6('0xa')](),controller[_0x24c6('0x1d')]);router[_0x24c6('0x1c')](_0x24c6('0x12'),auth[_0x24c6('0xa')](),controller[_0x24c6('0x1e')]);router['delete'](_0x24c6('0x14'),auth[_0x24c6('0xa')](),controller[_0x24c6('0x1f')]);module[_0x24c6('0x20')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index d796c65..d3b9dfb 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 _0x286f=['VIRTUAL','key','sequelize','exports','STRING'];(function(_0x8cb836,_0x426bb3){var _0x4547cd=function(_0x4afc54){while(--_0x4afc54){_0x8cb836['push'](_0x8cb836['shift']());}};_0x4547cd(++_0x426bb3);}(_0x286f,0x101));var _0xf286=function(_0x1a50f3,_0x2d185f){_0x1a50f3=_0x1a50f3-0x0;var _0x5edfe1=_0x286f[_0x1a50f3];return _0x5edfe1;};'use strict';var Sequelize=require(_0xf286('0x0'));module[_0xf286('0x1')]={'key':{'type':Sequelize[_0xf286('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0xf286('0x2')]},'name':{'type':Sequelize[_0xf286('0x3')],'get':function(){return this['getDataValue'](_0xf286('0x4'));}}}; \ No newline at end of file +var _0x84c2=['VIRTUAL','getDataValue','key','STRING'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x84c2,0x1eb));var _0x284c=function(_0x42e873,_0xff4f2a){_0x42e873=_0x42e873-0x0;var _0xc90c74=_0x84c2[_0x42e873];return _0xc90c74;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize[_0x284c('0x0')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x284c('0x0')]},'name':{'type':Sequelize[_0x284c('0x1')],'get':function(){return this[_0x284c('0x2')](_0x284c('0x3'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 8d12264..bb96097 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 _0x4e88=['save','update','then','destroy','get','CannedAnswers','UserProfileResource','end','error','name','send','index','rawAttributes','fieldName','type','key','model','map','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','CannedAnswer','includeAll','include','findAll','rows','catch','keys','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0x4e88,0x1f1));var _0x84e8=function(_0x4bc45f,_0x682fc5){_0x4bc45f=_0x4bc45f-0x0;var _0x56bc3b=_0x4e88[_0x4bc45f];return _0x56bc3b;};'use strict';var emlformat=require(_0x84e8('0x0'));var rimraf=require(_0x84e8('0x1'));var zipdir=require(_0x84e8('0x2'));var jsonpatch=require(_0x84e8('0x3'));var rp=require(_0x84e8('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x84e8('0x5'));var util=require(_0x84e8('0x6'));var path=require(_0x84e8('0x7'));var sox=require('sox');var csv=require(_0x84e8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x84e8('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x84e8('0xa'));var jsforce=require(_0x84e8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x84e8('0x8'));var querystring=require(_0x84e8('0xc'));var Papa=require(_0x84e8('0xd'));var Redis=require(_0x84e8('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x84e8('0xf'));var as=require(_0x84e8('0x10'));var hardwareService=require(_0x84e8('0x11'));var logger=require('../../config/logger')(_0x84e8('0x12'));var utils=require(_0x84e8('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x84e8('0x14'))['db'];function respondWithStatusCode(_0x70a241,_0x317fe7){_0x317fe7=_0x317fe7||0xcc;return function(_0x4cd47b){if(_0x4cd47b){return _0x70a241[_0x84e8('0x15')](_0x317fe7);}return _0x70a241[_0x84e8('0x16')](_0x317fe7)['end']();};}function respondWithResult(_0x4ea428,_0x49cc09){_0x49cc09=_0x49cc09||0xc8;return function(_0x1d3a45){if(_0x1d3a45){return _0x4ea428[_0x84e8('0x16')](_0x49cc09)[_0x84e8('0x17')](_0x1d3a45);}};}function respondWithFilteredResult(_0x599de9,_0x46532a){return function(_0x2c69f8){if(_0x2c69f8){var _0x12e0e1=typeof _0x46532a['offset']===_0x84e8('0x18')&&typeof _0x46532a[_0x84e8('0x19')]==='undefined';var _0x12026e=_0x2c69f8[_0x84e8('0x1a')];var _0x197b43=_0x12e0e1?0x0:_0x46532a[_0x84e8('0x1b')];var _0x40d76e=_0x12e0e1?_0x2c69f8[_0x84e8('0x1a')]:_0x46532a[_0x84e8('0x1b')]+_0x46532a[_0x84e8('0x19')];var _0x3d5328;if(_0x40d76e>=_0x12026e){_0x40d76e=_0x12026e;_0x3d5328=0xc8;}else{_0x3d5328=0xce;}_0x599de9[_0x84e8('0x16')](_0x3d5328);return _0x599de9[_0x84e8('0x1c')]('Content-Range',_0x197b43+'-'+_0x40d76e+'/'+_0x12026e)[_0x84e8('0x17')](_0x2c69f8);}return null;};}function patchUpdates(_0x3d0888){return function(_0x1d9162){try{jsonpatch[_0x84e8('0x1d')](_0x1d9162,_0x3d0888,!![]);}catch(_0x593865){return BPromise[_0x84e8('0x1e')](_0x593865);}return _0x1d9162[_0x84e8('0x1f')]();};}function saveUpdates(_0x31352f,_0x23b441){return function(_0x470697){if(_0x470697){return _0x470697[_0x84e8('0x20')](_0x31352f)[_0x84e8('0x21')](function(_0x1c1f84){return _0x1c1f84;});}return null;};}function removeEntity(_0x42ad7a,_0x5d7e54){return function(_0x4657b9){if(_0x4657b9){return _0x4657b9[_0x84e8('0x22')]()[_0x84e8('0x21')](function(){var _0xc1cd19=_0x4657b9[_0x84e8('0x23')]({'plain':!![]});var _0x45cda2=_0x84e8('0x24');return db[_0x84e8('0x25')]['destroy']({'where':{'type':_0x45cda2,'resourceId':_0xc1cd19['id']}})[_0x84e8('0x21')](function(){return _0x4657b9;});})[_0x84e8('0x21')](function(){_0x42ad7a['status'](0xcc)[_0x84e8('0x26')]();});}};}function handleEntityNotFound(_0xf0cf15,_0x145bc4){return function(_0x7dd3d1){if(!_0x7dd3d1){_0xf0cf15[_0x84e8('0x15')](0x194);}return _0x7dd3d1;};}function handleError(_0x19f4b0,_0xbb4224){_0xbb4224=_0xbb4224||0x1f4;return function(_0x1bac72){logger[_0x84e8('0x27')](_0x1bac72['stack']);if(_0x1bac72[_0x84e8('0x28')]){delete _0x1bac72[_0x84e8('0x28')];}_0x19f4b0[_0x84e8('0x16')](_0xbb4224)[_0x84e8('0x29')](_0x1bac72);};}exports[_0x84e8('0x2a')]=function(_0x1e6406,_0x3382a2){var _0x1904d9={},_0x75bfe8={},_0x1b9766={'count':0x0,'rows':[]};var _0x59d051=_['map'](db['CannedAnswer'][_0x84e8('0x2b')],function(_0xbe037d){return{'name':_0xbe037d[_0x84e8('0x2c')],'type':_0xbe037d[_0x84e8('0x2d')][_0x84e8('0x2e')]};});_0x75bfe8[_0x84e8('0x2f')]=_[_0x84e8('0x30')](_0x59d051,_0x84e8('0x28'));_0x75bfe8['query']=_['keys'](_0x1e6406['query']);_0x75bfe8['filters']=_[_0x84e8('0x31')](_0x75bfe8['model'],_0x75bfe8[_0x84e8('0x32')]);_0x1904d9[_0x84e8('0x33')]=_[_0x84e8('0x31')](_0x75bfe8[_0x84e8('0x2f')],qs[_0x84e8('0x34')](_0x1e6406['query'][_0x84e8('0x34')]));_0x1904d9['attributes']=_0x1904d9[_0x84e8('0x33')][_0x84e8('0x35')]?_0x1904d9['attributes']:_0x75bfe8[_0x84e8('0x2f')];if(!_0x1e6406[_0x84e8('0x32')][_0x84e8('0x36')](_0x84e8('0x37'))){_0x1904d9[_0x84e8('0x19')]=qs[_0x84e8('0x19')](_0x1e6406[_0x84e8('0x32')][_0x84e8('0x19')]);_0x1904d9[_0x84e8('0x1b')]=qs[_0x84e8('0x1b')](_0x1e6406[_0x84e8('0x32')]['offset']);}_0x1904d9[_0x84e8('0x38')]=qs[_0x84e8('0x39')](_0x1e6406[_0x84e8('0x32')][_0x84e8('0x39')]);_0x1904d9[_0x84e8('0x3a')]=qs[_0x84e8('0x3b')](_[_0x84e8('0x3c')](_0x1e6406[_0x84e8('0x32')],_0x75bfe8[_0x84e8('0x3b')]),_0x59d051);if(_0x1e6406[_0x84e8('0x32')][_0x84e8('0x3d')]){_0x1904d9[_0x84e8('0x3a')]=_[_0x84e8('0x3e')](_0x1904d9[_0x84e8('0x3a')],{'$or':[{'key':{'$like':'%'+_0x1e6406[_0x84e8('0x32')][_0x84e8('0x3d')]+'%'}},{'value':{'$like':'%'+_0x1e6406[_0x84e8('0x32')][_0x84e8('0x3d')]+'%'}}]});}_0x1904d9=_[_0x84e8('0x3e')]({},_0x1904d9,_0x1e6406[_0x84e8('0x3f')]);var _0x44b0cc={'where':_0x1904d9[_0x84e8('0x3a')]};return db[_0x84e8('0x40')]['count'](_0x44b0cc)[_0x84e8('0x21')](function(_0x14893f){_0x1b9766['count']=_0x14893f;if(_0x1e6406[_0x84e8('0x32')][_0x84e8('0x41')]){_0x1904d9[_0x84e8('0x42')]=[{'all':!![]}];}return db[_0x84e8('0x40')][_0x84e8('0x43')](_0x1904d9);})['then'](function(_0x33a5ae){_0x1b9766[_0x84e8('0x44')]=_0x33a5ae;return _0x1b9766;})[_0x84e8('0x21')](respondWithFilteredResult(_0x3382a2,_0x1904d9))[_0x84e8('0x45')](handleError(_0x3382a2,null));};exports['show']=function(_0x808383,_0x1d9d4c){var _0x4ce24a={'raw':!![],'where':{'id':_0x808383['params']['id']}},_0x2ed02b={};_0x2ed02b[_0x84e8('0x2f')]=_['keys'](db[_0x84e8('0x40')][_0x84e8('0x2b')]);_0x2ed02b[_0x84e8('0x32')]=_[_0x84e8('0x46')](_0x808383['query']);_0x2ed02b['filters']=_[_0x84e8('0x31')](_0x2ed02b[_0x84e8('0x2f')],_0x2ed02b['query']);_0x4ce24a[_0x84e8('0x33')]=_[_0x84e8('0x31')](_0x2ed02b['model'],qs[_0x84e8('0x34')](_0x808383[_0x84e8('0x32')][_0x84e8('0x34')]));_0x4ce24a[_0x84e8('0x33')]=_0x4ce24a[_0x84e8('0x33')][_0x84e8('0x35')]?_0x4ce24a[_0x84e8('0x33')]:_0x2ed02b['model'];if(_0x808383[_0x84e8('0x32')][_0x84e8('0x41')]){_0x4ce24a['include']=[{'all':!![]}];}_0x4ce24a=_[_0x84e8('0x3e')]({},_0x4ce24a,_0x808383[_0x84e8('0x3f')]);return db['CannedAnswer'][_0x84e8('0x47')](_0x4ce24a)[_0x84e8('0x21')](handleEntityNotFound(_0x1d9d4c,null))[_0x84e8('0x21')](respondWithResult(_0x1d9d4c,null))[_0x84e8('0x45')](handleError(_0x1d9d4c,null));};exports[_0x84e8('0x20')]=function(_0x13a3f1,_0x297dae){if(_0x13a3f1[_0x84e8('0x48')]['id']){delete _0x13a3f1['body']['id'];}return db[_0x84e8('0x40')][_0x84e8('0x47')]({'where':{'id':_0x13a3f1[_0x84e8('0x49')]['id']}})[_0x84e8('0x21')](handleEntityNotFound(_0x297dae,null))['then'](saveUpdates(_0x13a3f1['body'],null))['then'](respondWithResult(_0x297dae,null))[_0x84e8('0x45')](handleError(_0x297dae,null));};exports[_0x84e8('0x22')]=function(_0x26d2b6,_0x560a89){return db[_0x84e8('0x40')]['find']({'where':{'id':_0x26d2b6[_0x84e8('0x49')]['id']}})[_0x84e8('0x21')](handleEntityNotFound(_0x560a89,null))[_0x84e8('0x21')](removeEntity(_0x560a89,null))['catch'](handleError(_0x560a89,null));};exports[_0x84e8('0x4a')]=function(_0x58c0e5,_0x42c1e2){var _0x1b1c34={'key':_0x58c0e5[_0x84e8('0x48')]['key']};if(_0x58c0e5[_0x84e8('0x48')][_0x84e8('0x4b')]){_0x1b1c34[_0x84e8('0x4b')]=_0x58c0e5[_0x84e8('0x48')][_0x84e8('0x4b')];}else if(_0x58c0e5[_0x84e8('0x48')]['SmsAccountId']){_0x1b1c34[_0x84e8('0x4c')]=_0x58c0e5[_0x84e8('0x48')][_0x84e8('0x4c')];}else if(_0x58c0e5[_0x84e8('0x48')][_0x84e8('0x4d')]){_0x1b1c34[_0x84e8('0x4d')]=_0x58c0e5[_0x84e8('0x48')][_0x84e8('0x4d')];}else if(_0x58c0e5[_0x84e8('0x48')]['ChatWebsiteId']){_0x1b1c34[_0x84e8('0x4e')]=_0x58c0e5['body'][_0x84e8('0x4e')];}return db[_0x84e8('0x40')][_0x84e8('0x47')]({'where':_0x1b1c34})[_0x84e8('0x21')](function(_0x3e5e84){if(_0x3e5e84){throw new db[(_0x84e8('0x4f'))][(_0x84e8('0x50'))](_0x84e8('0x51'));}return db[_0x84e8('0x40')][_0x84e8('0x4a')](_0x58c0e5[_0x84e8('0x48')]);})[_0x84e8('0x21')](function(_0x39916d){var _0x3c8bbd=_0x58c0e5[_0x84e8('0x52')][_0x84e8('0x23')]({'plain':!![]});if(!_0x3c8bbd)throw new Error(_0x84e8('0x53'));if(_0x3c8bbd[_0x84e8('0x54')]===_0x84e8('0x52')){var _0x3338fa=_0x39916d[_0x84e8('0x23')]({'plain':!![]});return db[_0x84e8('0x55')][_0x84e8('0x47')]({'where':{'name':_0x84e8('0x24'),'userProfileId':_0x3c8bbd['userProfileId']},'raw':!![]})['then'](function(_0x1034b5){if(_0x1034b5&&_0x1034b5[_0x84e8('0x56')]===0x0){return db[_0x84e8('0x25')][_0x84e8('0x4a')]({'name':_0x3338fa[_0x84e8('0x28')],'resourceId':_0x3338fa['id'],'type':_0x1034b5[_0x84e8('0x28')],'sectionId':_0x1034b5['id']},{})[_0x84e8('0x21')](function(){return _0x39916d;});}else{return _0x39916d;}})['catch'](function(_0x22e4d7){logger[_0x84e8('0x27')](_0x84e8('0x57'),_0x22e4d7);throw _0x22e4d7;});}return _0x39916d;})[_0x84e8('0x21')](respondWithResult(_0x42c1e2,0xc9))['catch'](handleError(_0x42c1e2,null));}; \ No newline at end of file +var _0x6b98=['autoAssociation','error','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','get','UserProfileResource','stack','name','send','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','CannedAnswer','includeAll','include','findAll','rows','catch','rawAttributes','update','body','params','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','CannedAnswers','userProfileId'];(function(_0x323970,_0x5bde6f){var _0x3217da=function(_0x4dcdf3){while(--_0x4dcdf3){_0x323970['push'](_0x323970['shift']());}};_0x3217da(++_0x5bde6f);}(_0x6b98,0x110));var _0x86b9=function(_0x4e9f1a,_0x35e3f3){_0x4e9f1a=_0x4e9f1a-0x0;var _0x441f20=_0x6b98[_0x4e9f1a];return _0x441f20;};'use strict';var emlformat=require(_0x86b9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x86b9('0x1'));var rp=require(_0x86b9('0x2'));var moment=require(_0x86b9('0x3'));var BPromise=require(_0x86b9('0x4'));var Mustache=require(_0x86b9('0x5'));var util=require('util');var path=require(_0x86b9('0x6'));var sox=require(_0x86b9('0x7'));var csv=require(_0x86b9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x86b9('0x9'));var _=require('lodash');var squel=require(_0x86b9('0xa'));var crypto=require(_0x86b9('0xb'));var jsforce=require(_0x86b9('0xc'));var deskjs=require(_0x86b9('0xd'));var toCsv=require(_0x86b9('0x8'));var querystring=require(_0x86b9('0xe'));var Papa=require(_0x86b9('0xf'));var Redis=require('ioredis');var authService=require(_0x86b9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x86b9('0x11'));var hardwareService=require(_0x86b9('0x12'));var logger=require(_0x86b9('0x13'))(_0x86b9('0x14'));var utils=require(_0x86b9('0x15'));var config=require(_0x86b9('0x16'));var licenseUtil=require(_0x86b9('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59cfd8,_0x2ef526){_0x2ef526=_0x2ef526||0xcc;return function(_0x213f50){if(_0x213f50){return _0x59cfd8[_0x86b9('0x18')](_0x2ef526);}return _0x59cfd8[_0x86b9('0x19')](_0x2ef526)[_0x86b9('0x1a')]();};}function respondWithResult(_0x357003,_0x590ca0){_0x590ca0=_0x590ca0||0xc8;return function(_0x82173c){if(_0x82173c){return _0x357003[_0x86b9('0x19')](_0x590ca0)['json'](_0x82173c);}};}function respondWithFilteredResult(_0x1926d4,_0x55a60d){return function(_0xfc7202){if(_0xfc7202){var _0x243e2a=typeof _0x55a60d['offset']==='undefined'&&typeof _0x55a60d['limit']===_0x86b9('0x1b');var _0x458c8c=_0xfc7202[_0x86b9('0x1c')];var _0x21f44d=_0x243e2a?0x0:_0x55a60d[_0x86b9('0x1d')];var _0x56e428=_0x243e2a?_0xfc7202['count']:_0x55a60d['offset']+_0x55a60d[_0x86b9('0x1e')];var _0x17ef11;if(_0x56e428>=_0x458c8c){_0x56e428=_0x458c8c;_0x17ef11=0xc8;}else{_0x17ef11=0xce;}_0x1926d4[_0x86b9('0x19')](_0x17ef11);return _0x1926d4[_0x86b9('0x1f')](_0x86b9('0x20'),_0x21f44d+'-'+_0x56e428+'/'+_0x458c8c)['json'](_0xfc7202);}return null;};}function patchUpdates(_0x7602b9){return function(_0x5c48de){try{jsonpatch[_0x86b9('0x21')](_0x5c48de,_0x7602b9,!![]);}catch(_0x34e18b){return BPromise[_0x86b9('0x22')](_0x34e18b);}return _0x5c48de[_0x86b9('0x23')]();};}function saveUpdates(_0x1f7c73,_0x587439){return function(_0x33b590){if(_0x33b590){return _0x33b590['update'](_0x1f7c73)['then'](function(_0x47140b){return _0x47140b;});}return null;};}function removeEntity(_0x49295b,_0x416a7f){return function(_0xe73706){if(_0xe73706){return _0xe73706[_0x86b9('0x24')]()[_0x86b9('0x25')](function(){var _0x56d0f7=_0xe73706[_0x86b9('0x26')]({'plain':!![]});var _0x10af5d='CannedAnswers';return db[_0x86b9('0x27')]['destroy']({'where':{'type':_0x10af5d,'resourceId':_0x56d0f7['id']}})['then'](function(){return _0xe73706;});})['then'](function(){_0x49295b[_0x86b9('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x410aae,_0x40a31a){return function(_0x206eea){if(!_0x206eea){_0x410aae[_0x86b9('0x18')](0x194);}return _0x206eea;};}function handleError(_0x20ee75,_0x530f2b){_0x530f2b=_0x530f2b||0x1f4;return function(_0x45ec73){logger['error'](_0x45ec73[_0x86b9('0x28')]);if(_0x45ec73[_0x86b9('0x29')]){delete _0x45ec73[_0x86b9('0x29')];}_0x20ee75[_0x86b9('0x19')](_0x530f2b)[_0x86b9('0x2a')](_0x45ec73);};}exports['index']=function(_0x29396a,_0x4b5feb){var _0xd80aab={},_0x59a69e={},_0x3ceaa9={'count':0x0,'rows':[]};var _0x3742c4=_['map'](db['CannedAnswer']['rawAttributes'],function(_0x4f2abd){return{'name':_0x4f2abd[_0x86b9('0x2b')],'type':_0x4f2abd[_0x86b9('0x2c')][_0x86b9('0x2d')]};});_0x59a69e[_0x86b9('0x2e')]=_[_0x86b9('0x2f')](_0x3742c4,_0x86b9('0x29'));_0x59a69e['query']=_[_0x86b9('0x30')](_0x29396a[_0x86b9('0x31')]);_0x59a69e[_0x86b9('0x32')]=_[_0x86b9('0x33')](_0x59a69e['model'],_0x59a69e['query']);_0xd80aab[_0x86b9('0x34')]=_[_0x86b9('0x33')](_0x59a69e[_0x86b9('0x2e')],qs[_0x86b9('0x35')](_0x29396a['query'][_0x86b9('0x35')]));_0xd80aab['attributes']=_0xd80aab['attributes'][_0x86b9('0x36')]?_0xd80aab['attributes']:_0x59a69e[_0x86b9('0x2e')];if(!_0x29396a['query'][_0x86b9('0x37')](_0x86b9('0x38'))){_0xd80aab[_0x86b9('0x1e')]=qs[_0x86b9('0x1e')](_0x29396a[_0x86b9('0x31')][_0x86b9('0x1e')]);_0xd80aab[_0x86b9('0x1d')]=qs[_0x86b9('0x1d')](_0x29396a['query'][_0x86b9('0x1d')]);}_0xd80aab[_0x86b9('0x39')]=qs[_0x86b9('0x3a')](_0x29396a[_0x86b9('0x31')][_0x86b9('0x3a')]);_0xd80aab[_0x86b9('0x3b')]=qs['filters'](_[_0x86b9('0x3c')](_0x29396a[_0x86b9('0x31')],_0x59a69e['filters']),_0x3742c4);if(_0x29396a[_0x86b9('0x31')]['filter']){_0xd80aab[_0x86b9('0x3b')]=_[_0x86b9('0x3d')](_0xd80aab[_0x86b9('0x3b')],{'$or':[{'key':{'$like':'%'+_0x29396a[_0x86b9('0x31')][_0x86b9('0x3e')]+'%'}},{'value':{'$like':'%'+_0x29396a['query'][_0x86b9('0x3e')]+'%'}}]});}_0xd80aab=_[_0x86b9('0x3d')]({},_0xd80aab,_0x29396a[_0x86b9('0x3f')]);var _0x2d62aa={'where':_0xd80aab[_0x86b9('0x3b')]};return db[_0x86b9('0x40')]['count'](_0x2d62aa)['then'](function(_0xcfc673){_0x3ceaa9[_0x86b9('0x1c')]=_0xcfc673;if(_0x29396a['query'][_0x86b9('0x41')]){_0xd80aab[_0x86b9('0x42')]=[{'all':!![]}];}return db[_0x86b9('0x40')][_0x86b9('0x43')](_0xd80aab);})[_0x86b9('0x25')](function(_0x549b9d){_0x3ceaa9[_0x86b9('0x44')]=_0x549b9d;return _0x3ceaa9;})[_0x86b9('0x25')](respondWithFilteredResult(_0x4b5feb,_0xd80aab))[_0x86b9('0x45')](handleError(_0x4b5feb,null));};exports['show']=function(_0x64f8ae,_0xa1fe18){var _0x4b152e={'raw':!![],'where':{'id':_0x64f8ae['params']['id']}},_0x1367d3={};_0x1367d3[_0x86b9('0x2e')]=_[_0x86b9('0x30')](db['CannedAnswer'][_0x86b9('0x46')]);_0x1367d3[_0x86b9('0x31')]=_[_0x86b9('0x30')](_0x64f8ae[_0x86b9('0x31')]);_0x1367d3[_0x86b9('0x32')]=_[_0x86b9('0x33')](_0x1367d3[_0x86b9('0x2e')],_0x1367d3[_0x86b9('0x31')]);_0x4b152e[_0x86b9('0x34')]=_[_0x86b9('0x33')](_0x1367d3[_0x86b9('0x2e')],qs[_0x86b9('0x35')](_0x64f8ae[_0x86b9('0x31')][_0x86b9('0x35')]));_0x4b152e['attributes']=_0x4b152e['attributes'][_0x86b9('0x36')]?_0x4b152e[_0x86b9('0x34')]:_0x1367d3[_0x86b9('0x2e')];if(_0x64f8ae[_0x86b9('0x31')]['includeAll']){_0x4b152e[_0x86b9('0x42')]=[{'all':!![]}];}_0x4b152e=_[_0x86b9('0x3d')]({},_0x4b152e,_0x64f8ae[_0x86b9('0x3f')]);return db['CannedAnswer']['find'](_0x4b152e)[_0x86b9('0x25')](handleEntityNotFound(_0xa1fe18,null))['then'](respondWithResult(_0xa1fe18,null))[_0x86b9('0x45')](handleError(_0xa1fe18,null));};exports[_0x86b9('0x47')]=function(_0x17747c,_0xfed46a){if(_0x17747c[_0x86b9('0x48')]['id']){delete _0x17747c[_0x86b9('0x48')]['id'];}return db[_0x86b9('0x40')]['find']({'where':{'id':_0x17747c[_0x86b9('0x49')]['id']}})[_0x86b9('0x25')](handleEntityNotFound(_0xfed46a,null))[_0x86b9('0x25')](saveUpdates(_0x17747c[_0x86b9('0x48')],null))['then'](respondWithResult(_0xfed46a,null))['catch'](handleError(_0xfed46a,null));};exports['destroy']=function(_0x471974,_0x1f6f08){return db[_0x86b9('0x40')][_0x86b9('0x4a')]({'where':{'id':_0x471974[_0x86b9('0x49')]['id']}})[_0x86b9('0x25')](handleEntityNotFound(_0x1f6f08,null))[_0x86b9('0x25')](removeEntity(_0x1f6f08,null))[_0x86b9('0x45')](handleError(_0x1f6f08,null));};exports[_0x86b9('0x4b')]=function(_0x10f819,_0x51d51e){var _0x5ee328={'key':_0x10f819[_0x86b9('0x48')][_0x86b9('0x2d')]};if(_0x10f819[_0x86b9('0x48')][_0x86b9('0x4c')]){_0x5ee328[_0x86b9('0x4c')]=_0x10f819['body'][_0x86b9('0x4c')];}else if(_0x10f819[_0x86b9('0x48')]['SmsAccountId']){_0x5ee328['SmsAccountId']=_0x10f819['body'][_0x86b9('0x4d')];}else if(_0x10f819['body'][_0x86b9('0x4e')]){_0x5ee328[_0x86b9('0x4e')]=_0x10f819[_0x86b9('0x48')][_0x86b9('0x4e')];}else if(_0x10f819[_0x86b9('0x48')][_0x86b9('0x4f')]){_0x5ee328['ChatWebsiteId']=_0x10f819[_0x86b9('0x48')][_0x86b9('0x4f')];}return db[_0x86b9('0x40')][_0x86b9('0x4a')]({'where':_0x5ee328})[_0x86b9('0x25')](function(_0x2d3880){if(_0x2d3880){throw new db[(_0x86b9('0x50'))][(_0x86b9('0x51'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x86b9('0x40')][_0x86b9('0x4b')](_0x10f819['body']);})[_0x86b9('0x25')](function(_0x60891){var _0x56bbd0=_0x10f819[_0x86b9('0x52')][_0x86b9('0x26')]({'plain':!![]});if(!_0x56bbd0)throw new Error(_0x86b9('0x53'));if(_0x56bbd0[_0x86b9('0x54')]===_0x86b9('0x52')){var _0x1392ba=_0x60891['get']({'plain':!![]});return db[_0x86b9('0x55')]['find']({'where':{'name':_0x86b9('0x56'),'userProfileId':_0x56bbd0[_0x86b9('0x57')]},'raw':!![]})[_0x86b9('0x25')](function(_0x5636d6){if(_0x5636d6&&_0x5636d6[_0x86b9('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x1392ba[_0x86b9('0x29')],'resourceId':_0x1392ba['id'],'type':_0x5636d6[_0x86b9('0x29')],'sectionId':_0x5636d6['id']},{})['then'](function(){return _0x60891;});}else{return _0x60891;}})[_0x86b9('0x45')](function(_0x2142a3){logger[_0x86b9('0x59')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2142a3);throw _0x2142a3;});}return _0x60891;})['then'](respondWithResult(_0x51d51e,0xc9))[_0x86b9('0x45')](handleError(_0x51d51e,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 315ed82..b1e7d7c 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 _0xf3f2=['exports','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes'];(function(_0x3fb166,_0x4eb985){var _0x5e91be=function(_0x53f4d9){while(--_0x53f4d9){_0x3fb166['push'](_0x3fb166['shift']());}};_0x5e91be(++_0x4eb985);}(_0xf3f2,0x140));var _0x2f3f=function(_0xd255a7,_0x3c688f){_0xd255a7=_0xd255a7-0x0;var _0x30273f=_0xf3f2[_0xd255a7];return _0x30273f;};'use strict';var _=require(_0x2f3f('0x0'));var util=require(_0x2f3f('0x1'));var logger=require(_0x2f3f('0x2'))(_0x2f3f('0x3'));var moment=require(_0x2f3f('0x4'));var BPromise=require(_0x2f3f('0x5'));var rp=require(_0x2f3f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2f3f('0x7'));var config=require(_0x2f3f('0x8'));var attributes=require(_0x2f3f('0x9'));module[_0x2f3f('0xa')]=function(_0x361aff,_0x47d0d4){return _0x361aff['define'](_0x2f3f('0xb'),attributes,{'tableName':_0x2f3f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2f3f('0xd'),'collate':_0x2f3f('0xe')});}; \ No newline at end of file +var _0x3354=['utf8mb4','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers'];(function(_0x5ca7dd,_0x31cff4){var _0x44aa57=function(_0x106f69){while(--_0x106f69){_0x5ca7dd['push'](_0x5ca7dd['shift']());}};_0x44aa57(++_0x31cff4);}(_0x3354,0x189));var _0x4335=function(_0x3297a3,_0x220dc1){_0x3297a3=_0x3297a3-0x0;var _0x5aa51f=_0x3354[_0x3297a3];return _0x5aa51f;};'use strict';var _=require(_0x4335('0x0'));var util=require(_0x4335('0x1'));var logger=require('../../config/logger')(_0x4335('0x2'));var moment=require(_0x4335('0x3'));var BPromise=require(_0x4335('0x4'));var rp=require(_0x4335('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4335('0x6'));var config=require(_0x4335('0x7'));var attributes=require(_0x4335('0x8'));module[_0x4335('0x9')]=function(_0x1facac,_0x46ec7b){return _0x1facac[_0x4335('0xa')](_0x4335('0xb'),attributes,{'tableName':_0x4335('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4335('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 2e58a0e..40db582 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(_0x2ebcd1,_0x5b1f6a){var _0x48eb0c=function(_0x51997a){while(--_0x51997a){_0x2ebcd1['push'](_0x2ebcd1['shift']());}};_0x48eb0c(++_0x5b1f6a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +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(_0x271ec9,_0xefbaf){var _0x2b153a=function(_0x3c5e3c){while(--_0x3c5e3c){_0x271ec9['push'](_0x271ec9['shift']());}};_0x2b153a(++_0xefbaf);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 40825d1..1c04a61 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 _0x0a7e=['../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','isAuthenticated','index','get','show','post','put','/:id','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x3f3cc0,_0x10a90d){var _0x47963f=function(_0x33dad0){while(--_0x33dad0){_0x3f3cc0['push'](_0x3f3cc0['shift']());}};_0x47963f(++_0x10a90d);}(_0x0a7e,0x13e));var _0xe0a7=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x0a7e[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0xe0a7('0x0'));var util=require(_0xe0a7('0x1'));var path=require(_0xe0a7('0x2'));var timeout=require('connect-timeout');var express=require(_0xe0a7('0x3'));var router=express[_0xe0a7('0x4')]();var fs_extra=require(_0xe0a7('0x5'));var auth=require(_0xe0a7('0x6'));var interaction=require(_0xe0a7('0x7'));var config=require('../../config/environment');var controller=require(_0xe0a7('0x8'));router['get']('/',auth[_0xe0a7('0x9')](),controller[_0xe0a7('0xa')]);router[_0xe0a7('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xe0a7('0xc')]);router[_0xe0a7('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe0a7('0xe')](_0xe0a7('0xf'),auth[_0xe0a7('0x9')](),controller['update']);router['delete']('/:id',auth[_0xe0a7('0x9')](),controller[_0xe0a7('0x10')]);module[_0xe0a7('0x11')]=router; \ No newline at end of file +var _0xcc49=['show','post','create','put','update','destroy','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id'];(function(_0x3e4924,_0x3c25b0){var _0x724fe5=function(_0x29aeba){while(--_0x29aeba){_0x3e4924['push'](_0x3e4924['shift']());}};_0x724fe5(++_0x3c25b0);}(_0xcc49,0x84));var _0x9cc4=function(_0x5aef17,_0x592cd4){_0x5aef17=_0x5aef17-0x0;var _0x43f9d0=_0xcc49[_0x5aef17];return _0x43f9d0;};'use strict';var multer=require(_0x9cc4('0x0'));var util=require(_0x9cc4('0x1'));var path=require(_0x9cc4('0x2'));var timeout=require(_0x9cc4('0x3'));var express=require(_0x9cc4('0x4'));var router=express['Router']();var fs_extra=require(_0x9cc4('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9cc4('0x6'));var controller=require(_0x9cc4('0x7'));router[_0x9cc4('0x8')]('/',auth[_0x9cc4('0x9')](),controller[_0x9cc4('0xa')]);router[_0x9cc4('0x8')](_0x9cc4('0xb'),auth[_0x9cc4('0x9')](),controller[_0x9cc4('0xc')]);router[_0x9cc4('0xd')]('/',auth[_0x9cc4('0x9')](),controller[_0x9cc4('0xe')]);router[_0x9cc4('0xf')](_0x9cc4('0xb'),auth[_0x9cc4('0x9')](),controller[_0x9cc4('0x10')]);router['delete'](_0x9cc4('0xb'),auth[_0x9cc4('0x9')](),controller[_0x9cc4('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index d928f22..a011708 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 _0x138d=['STRING','INTEGER','sequelize','exports','1970-01-01\x2000:00:01'];(function(_0x25ae2e,_0x91a20b){var _0x3fc64f=function(_0x2d00ca){while(--_0x2d00ca){_0x25ae2e['push'](_0x25ae2e['shift']());}};_0x3fc64f(++_0x91a20b);}(_0x138d,0x1ab));var _0xd138=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x138d[_0x4e6ae6];return _0x23c108;};'use strict';var Sequelize=require(_0xd138('0x0'));module[_0xd138('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xd138('0x2')},'clid':{'type':Sequelize[_0xd138('0x3')]},'src':{'type':Sequelize[_0xd138('0x3')]},'dst':{'type':Sequelize[_0xd138('0x3')]},'dcontext':{'type':Sequelize[_0xd138('0x3')]},'channel':{'type':Sequelize[_0xd138('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0xd138('0x3')]},'lastdata':{'type':Sequelize[_0xd138('0x3')]},'duration':{'type':Sequelize[_0xd138('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xd138('0x3')]},'amaflags':{'type':Sequelize[_0xd138('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xd138('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xd138('0x3')]},'sequence':{'type':Sequelize[_0xd138('0x3')]},'peeraccount':{'type':Sequelize[_0xd138('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xd138('0x3')]}}; \ No newline at end of file +var _0xfe57=['INTEGER','sequelize','exports','STRING'];(function(_0x3f6e26,_0x811a34){var _0x474345=function(_0x4a0cbe){while(--_0x4a0cbe){_0x3f6e26['push'](_0x3f6e26['shift']());}};_0x474345(++_0x811a34);}(_0xfe57,0x195));var _0x7fe5=function(_0x146a97,_0x2d8483){_0x146a97=_0x146a97-0x0;var _0x259d5c=_0xfe57[_0x146a97];return _0x259d5c;};'use strict';var Sequelize=require(_0x7fe5('0x0'));module[_0x7fe5('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x7fe5('0x2')]},'src':{'type':Sequelize[_0x7fe5('0x2')]},'dst':{'type':Sequelize[_0x7fe5('0x2')]},'dcontext':{'type':Sequelize[_0x7fe5('0x2')]},'channel':{'type':Sequelize[_0x7fe5('0x2')]},'dstchannel':{'type':Sequelize[_0x7fe5('0x2')]},'lastapp':{'type':Sequelize[_0x7fe5('0x2')]},'lastdata':{'type':Sequelize[_0x7fe5('0x2')]},'duration':{'type':Sequelize[_0x7fe5('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x7fe5('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x7fe5('0x2')]},'amaflags':{'type':Sequelize[_0x7fe5('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x7fe5('0x2')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7fe5('0x2')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x7fe5('0x2')]},'peeraccount':{'type':Sequelize[_0x7fe5('0x2')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 7b9e6fc..59eb17b 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 _0xc3b5=['destroy','error','stack','name','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','find','create','body','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','then'];(function(_0x3bd555,_0x2081bf){var _0xdd3a1b=function(_0x3b6f87){while(--_0x3b6f87){_0x3bd555['push'](_0x3bd555['shift']());}};_0xdd3a1b(++_0x2081bf);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x3e4134,_0x2df961){_0x3e4134=_0x3e4134-0x0;var _0x32674d=_0xc3b5[_0x3e4134];return _0x32674d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5c3b('0x0'));var jsonpatch=require(_0x5c3b('0x1'));var rp=require(_0x5c3b('0x2'));var moment=require(_0x5c3b('0x3'));var BPromise=require(_0x5c3b('0x4'));var Mustache=require(_0x5c3b('0x5'));var util=require(_0x5c3b('0x6'));var path=require(_0x5c3b('0x7'));var sox=require('sox');var csv=require(_0x5c3b('0x8'));var ejs=require(_0x5c3b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5c3b('0xa'));var squel=require(_0x5c3b('0xb'));var crypto=require(_0x5c3b('0xc'));var jsforce=require(_0x5c3b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5c3b('0x8'));var querystring=require(_0x5c3b('0xe'));var Papa=require(_0x5c3b('0xf'));var Redis=require(_0x5c3b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5c3b('0x11'));var as=require(_0x5c3b('0x12'));var hardwareService=require(_0x5c3b('0x13'));var logger=require(_0x5c3b('0x14'))(_0x5c3b('0x15'));var utils=require('../../config/utils');var config=require(_0x5c3b('0x16'));var licenseUtil=require(_0x5c3b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b2815,_0x3b953d){_0x3b953d=_0x3b953d||0xcc;return function(_0x507c2e){if(_0x507c2e){return _0x1b2815[_0x5c3b('0x18')](_0x3b953d);}return _0x1b2815[_0x5c3b('0x19')](_0x3b953d)[_0x5c3b('0x1a')]();};}function respondWithResult(_0x2384b9,_0x315e68){_0x315e68=_0x315e68||0xc8;return function(_0x3fef28){if(_0x3fef28){return _0x2384b9[_0x5c3b('0x19')](_0x315e68)['json'](_0x3fef28);}};}function respondWithFilteredResult(_0x2f7ab2,_0x5b55be){return function(_0x4cf80d){if(_0x4cf80d){var _0x195c1e=typeof _0x5b55be[_0x5c3b('0x1b')]===_0x5c3b('0x1c')&&typeof _0x5b55be['limit']===_0x5c3b('0x1c');var _0x229e28=_0x4cf80d[_0x5c3b('0x1d')];var _0x59f71b=_0x195c1e?0x0:_0x5b55be[_0x5c3b('0x1b')];var _0x34144d=_0x195c1e?_0x4cf80d['count']:_0x5b55be[_0x5c3b('0x1b')]+_0x5b55be[_0x5c3b('0x1e')];var _0x2b2307;if(_0x34144d>=_0x229e28){_0x34144d=_0x229e28;_0x2b2307=0xc8;}else{_0x2b2307=0xce;}_0x2f7ab2[_0x5c3b('0x19')](_0x2b2307);return _0x2f7ab2[_0x5c3b('0x1f')](_0x5c3b('0x20'),_0x59f71b+'-'+_0x34144d+'/'+_0x229e28)[_0x5c3b('0x21')](_0x4cf80d);}return null;};}function patchUpdates(_0x1af39c){return function(_0xc63307){try{jsonpatch[_0x5c3b('0x22')](_0xc63307,_0x1af39c,!![]);}catch(_0x4ec8c1){return BPromise['reject'](_0x4ec8c1);}return _0xc63307[_0x5c3b('0x23')]();};}function saveUpdates(_0x143022,_0x5942f1){return function(_0x439d8e){if(_0x439d8e){return _0x439d8e['update'](_0x143022)[_0x5c3b('0x24')](function(_0xb8006){return _0xb8006;});}return null;};}function removeEntity(_0x2bb9dc,_0xe9261d){return function(_0x529c39){if(_0x529c39){return _0x529c39[_0x5c3b('0x25')]()[_0x5c3b('0x24')](function(){_0x2bb9dc['status'](0xcc)[_0x5c3b('0x1a')]();});}};}function handleEntityNotFound(_0x2c8682,_0x3a8141){return function(_0x3c3991){if(!_0x3c3991){_0x2c8682['sendStatus'](0x194);}return _0x3c3991;};}function handleError(_0x15ae38,_0x20469d){_0x20469d=_0x20469d||0x1f4;return function(_0x2099dc){logger[_0x5c3b('0x26')](_0x2099dc[_0x5c3b('0x27')]);if(_0x2099dc[_0x5c3b('0x28')]){delete _0x2099dc['name'];}_0x15ae38['status'](_0x20469d)['send'](_0x2099dc);};}exports[_0x5c3b('0x29')]=function(_0x3e6832,_0x59b640){var _0xd93418={},_0x15044e={},_0x421d96={'count':0x0,'rows':[]};var _0x2a26df=_[_0x5c3b('0x2a')](db[_0x5c3b('0x2b')][_0x5c3b('0x2c')],function(_0x292266){return{'name':_0x292266[_0x5c3b('0x2d')],'type':_0x292266[_0x5c3b('0x2e')][_0x5c3b('0x2f')]};});_0x15044e[_0x5c3b('0x30')]=_['map'](_0x2a26df,_0x5c3b('0x28'));_0x15044e[_0x5c3b('0x31')]=_[_0x5c3b('0x32')](_0x3e6832[_0x5c3b('0x31')]);_0x15044e[_0x5c3b('0x33')]=_[_0x5c3b('0x34')](_0x15044e[_0x5c3b('0x30')],_0x15044e[_0x5c3b('0x31')]);_0xd93418[_0x5c3b('0x35')]=_[_0x5c3b('0x34')](_0x15044e[_0x5c3b('0x30')],qs[_0x5c3b('0x36')](_0x3e6832[_0x5c3b('0x31')][_0x5c3b('0x36')]));_0xd93418[_0x5c3b('0x35')]=_0xd93418[_0x5c3b('0x35')][_0x5c3b('0x37')]?_0xd93418['attributes']:_0x15044e[_0x5c3b('0x30')];if(!_0x3e6832[_0x5c3b('0x31')][_0x5c3b('0x38')](_0x5c3b('0x39'))){_0xd93418['limit']=qs[_0x5c3b('0x1e')](_0x3e6832[_0x5c3b('0x31')]['limit']);_0xd93418[_0x5c3b('0x1b')]=qs[_0x5c3b('0x1b')](_0x3e6832[_0x5c3b('0x31')][_0x5c3b('0x1b')]);}_0xd93418[_0x5c3b('0x3a')]=qs[_0x5c3b('0x3b')](_0x3e6832[_0x5c3b('0x31')][_0x5c3b('0x3b')]);_0xd93418[_0x5c3b('0x3c')]=qs['filters'](_[_0x5c3b('0x3d')](_0x3e6832[_0x5c3b('0x31')],_0x15044e['filters']),_0x2a26df);if(_0x3e6832['query'][_0x5c3b('0x3e')]){_0xd93418[_0x5c3b('0x3c')]=_[_0x5c3b('0x3f')](_0xd93418[_0x5c3b('0x3c')],{'$or':_[_0x5c3b('0x2a')](_0x2a26df,function(_0x406bf9){if(_0x406bf9[_0x5c3b('0x2e')]!=='VIRTUAL'){var _0x499335={};_0x499335[_0x406bf9[_0x5c3b('0x28')]]={'$like':'%'+_0x3e6832[_0x5c3b('0x31')][_0x5c3b('0x3e')]+'%'};return _0x499335;}})});}_0xd93418=_[_0x5c3b('0x3f')]({},_0xd93418,_0x3e6832['options']);var _0x16400b={'where':_0xd93418['where']};return db[_0x5c3b('0x2b')][_0x5c3b('0x1d')](_0x16400b)[_0x5c3b('0x24')](function(_0xea3ae1){_0x421d96[_0x5c3b('0x1d')]=_0xea3ae1;if(_0x3e6832[_0x5c3b('0x31')][_0x5c3b('0x40')]){_0xd93418[_0x5c3b('0x41')]=[{'all':!![]}];}return db[_0x5c3b('0x2b')]['findAll'](_0xd93418);})['then'](function(_0x345149){_0x421d96[_0x5c3b('0x42')]=_0x345149;return _0x421d96;})[_0x5c3b('0x24')](respondWithFilteredResult(_0x59b640,_0xd93418))[_0x5c3b('0x43')](handleError(_0x59b640,null));};exports[_0x5c3b('0x44')]=function(_0x22fd28,_0x2cec5d){var _0x1d9427={'raw':!![],'where':{'id':_0x22fd28['params']['id']}},_0x29ffdc={};_0x29ffdc[_0x5c3b('0x30')]=_[_0x5c3b('0x32')](db[_0x5c3b('0x2b')]['rawAttributes']);_0x29ffdc[_0x5c3b('0x31')]=_[_0x5c3b('0x32')](_0x22fd28[_0x5c3b('0x31')]);_0x29ffdc[_0x5c3b('0x33')]=_[_0x5c3b('0x34')](_0x29ffdc[_0x5c3b('0x30')],_0x29ffdc[_0x5c3b('0x31')]);_0x1d9427[_0x5c3b('0x35')]=_[_0x5c3b('0x34')](_0x29ffdc[_0x5c3b('0x30')],qs[_0x5c3b('0x36')](_0x22fd28['query'][_0x5c3b('0x36')]));_0x1d9427['attributes']=_0x1d9427[_0x5c3b('0x35')][_0x5c3b('0x37')]?_0x1d9427['attributes']:_0x29ffdc[_0x5c3b('0x30')];if(_0x22fd28[_0x5c3b('0x31')][_0x5c3b('0x40')]){_0x1d9427['include']=[{'all':!![]}];}_0x1d9427=_[_0x5c3b('0x3f')]({},_0x1d9427,_0x22fd28['options']);return db[_0x5c3b('0x2b')][_0x5c3b('0x45')](_0x1d9427)[_0x5c3b('0x24')](handleEntityNotFound(_0x2cec5d,null))[_0x5c3b('0x24')](respondWithResult(_0x2cec5d,null))[_0x5c3b('0x43')](handleError(_0x2cec5d,null));};exports[_0x5c3b('0x46')]=function(_0x2dd72c,_0x3d6034){return db[_0x5c3b('0x2b')][_0x5c3b('0x46')](_0x2dd72c[_0x5c3b('0x47')],{})['then'](respondWithResult(_0x3d6034,0xc9))[_0x5c3b('0x43')](handleError(_0x3d6034,null));};exports['update']=function(_0x155b22,_0x11bf0a){if(_0x155b22[_0x5c3b('0x47')]['id']){delete _0x155b22['body']['id'];}return db[_0x5c3b('0x2b')][_0x5c3b('0x45')]({'where':{'id':_0x155b22['params']['id']}})[_0x5c3b('0x24')](handleEntityNotFound(_0x11bf0a,null))[_0x5c3b('0x24')](saveUpdates(_0x155b22[_0x5c3b('0x47')],null))[_0x5c3b('0x24')](respondWithResult(_0x11bf0a,null))[_0x5c3b('0x43')](handleError(_0x11bf0a,null));};exports[_0x5c3b('0x25')]=function(_0x37870f,_0x21e430){return db[_0x5c3b('0x2b')][_0x5c3b('0x45')]({'where':{'id':_0x37870f[_0x5c3b('0x48')]['id']}})['then'](handleEntityNotFound(_0x21e430,null))['then'](removeEntity(_0x21e430,null))['catch'](handleError(_0x21e430,null));};exports[_0x5c3b('0x49')]=function(_0x203ae2,_0x5f14fa){return db[_0x5c3b('0x2b')][_0x5c3b('0x49')]()[_0x5c3b('0x24')](respondWithResult(_0x5f14fa,null))[_0x5c3b('0x43')](handleError(_0x5f14fa,null));}; \ No newline at end of file +var _0xd6d2=['../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','Cdr','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','catch','show','params','rawAttributes','includeAll','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x13b4c9,_0x146baf){var _0x15a9a0=function(_0xbfe8f6){while(--_0xbfe8f6){_0x13b4c9['push'](_0x13b4c9['shift']());}};_0x15a9a0(++_0x146baf);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x374acb,_0x52f395){_0x374acb=_0x374acb-0x0;var _0x58c788=_0xd6d2[_0x374acb];return _0x58c788;};'use strict';var emlformat=require(_0x2d6d('0x0'));var rimraf=require(_0x2d6d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d6d('0x2'));var rp=require(_0x2d6d('0x3'));var moment=require('moment');var BPromise=require(_0x2d6d('0x4'));var Mustache=require('mustache');var util=require(_0x2d6d('0x5'));var path=require(_0x2d6d('0x6'));var sox=require(_0x2d6d('0x7'));var csv=require('to-csv');var ejs=require(_0x2d6d('0x8'));var fs=require('fs');var fs_extra=require(_0x2d6d('0x9'));var _=require(_0x2d6d('0xa'));var squel=require(_0x2d6d('0xb'));var crypto=require(_0x2d6d('0xc'));var jsforce=require(_0x2d6d('0xd'));var deskjs=require(_0x2d6d('0xe'));var toCsv=require(_0x2d6d('0xf'));var querystring=require(_0x2d6d('0x10'));var Papa=require(_0x2d6d('0x11'));var Redis=require(_0x2d6d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2d6d('0x13'));var as=require(_0x2d6d('0x14'));var hardwareService=require(_0x2d6d('0x15'));var logger=require(_0x2d6d('0x16'))(_0x2d6d('0x17'));var utils=require('../../config/utils');var config=require(_0x2d6d('0x18'));var licenseUtil=require(_0x2d6d('0x19'));var db=require(_0x2d6d('0x1a'))['db'];function respondWithStatusCode(_0x2ad9fc,_0x5c4bf6){_0x5c4bf6=_0x5c4bf6||0xcc;return function(_0x5ef174){if(_0x5ef174){return _0x2ad9fc[_0x2d6d('0x1b')](_0x5c4bf6);}return _0x2ad9fc[_0x2d6d('0x1c')](_0x5c4bf6)[_0x2d6d('0x1d')]();};}function respondWithResult(_0x3528de,_0x58bd29){_0x58bd29=_0x58bd29||0xc8;return function(_0x1ec6aa){if(_0x1ec6aa){return _0x3528de[_0x2d6d('0x1c')](_0x58bd29)['json'](_0x1ec6aa);}};}function respondWithFilteredResult(_0x586085,_0x370096){return function(_0x17340f){if(_0x17340f){var _0x109b49=typeof _0x370096['offset']===_0x2d6d('0x1e')&&typeof _0x370096['limit']==='undefined';var _0x4c3092=_0x17340f[_0x2d6d('0x1f')];var _0x4179f2=_0x109b49?0x0:_0x370096[_0x2d6d('0x20')];var _0x3c527e=_0x109b49?_0x17340f[_0x2d6d('0x1f')]:_0x370096[_0x2d6d('0x20')]+_0x370096[_0x2d6d('0x21')];var _0xa2c4a7;if(_0x3c527e>=_0x4c3092){_0x3c527e=_0x4c3092;_0xa2c4a7=0xc8;}else{_0xa2c4a7=0xce;}_0x586085[_0x2d6d('0x1c')](_0xa2c4a7);return _0x586085['set'](_0x2d6d('0x22'),_0x4179f2+'-'+_0x3c527e+'/'+_0x4c3092)[_0x2d6d('0x23')](_0x17340f);}return null;};}function patchUpdates(_0x5b0c61){return function(_0x227e44){try{jsonpatch[_0x2d6d('0x24')](_0x227e44,_0x5b0c61,!![]);}catch(_0x15cb80){return BPromise[_0x2d6d('0x25')](_0x15cb80);}return _0x227e44[_0x2d6d('0x26')]();};}function saveUpdates(_0x59234a,_0x4aaa62){return function(_0x42c2f2){if(_0x42c2f2){return _0x42c2f2[_0x2d6d('0x27')](_0x59234a)[_0x2d6d('0x28')](function(_0x585b54){return _0x585b54;});}return null;};}function removeEntity(_0x47eb0e,_0x3ae8ad){return function(_0x4e7ec8){if(_0x4e7ec8){return _0x4e7ec8['destroy']()['then'](function(){_0x47eb0e[_0x2d6d('0x1c')](0xcc)[_0x2d6d('0x1d')]();});}};}function handleEntityNotFound(_0x3da83d,_0x3f89dd){return function(_0x3e5a92){if(!_0x3e5a92){_0x3da83d['sendStatus'](0x194);}return _0x3e5a92;};}function handleError(_0x16634d,_0x1b4964){_0x1b4964=_0x1b4964||0x1f4;return function(_0x455e71){logger[_0x2d6d('0x29')](_0x455e71[_0x2d6d('0x2a')]);if(_0x455e71[_0x2d6d('0x2b')]){delete _0x455e71[_0x2d6d('0x2b')];}_0x16634d[_0x2d6d('0x1c')](_0x1b4964)[_0x2d6d('0x2c')](_0x455e71);};}exports['index']=function(_0x1016e1,_0x26d299){var _0x2e7b32={},_0x34d485={},_0x486963={'count':0x0,'rows':[]};var _0x317bde=_['map'](db[_0x2d6d('0x2d')]['rawAttributes'],function(_0x58bfc7){return{'name':_0x58bfc7[_0x2d6d('0x2e')],'type':_0x58bfc7['type'][_0x2d6d('0x2f')]};});_0x34d485[_0x2d6d('0x30')]=_['map'](_0x317bde,_0x2d6d('0x2b'));_0x34d485['query']=_[_0x2d6d('0x31')](_0x1016e1[_0x2d6d('0x32')]);_0x34d485[_0x2d6d('0x33')]=_[_0x2d6d('0x34')](_0x34d485[_0x2d6d('0x30')],_0x34d485[_0x2d6d('0x32')]);_0x2e7b32[_0x2d6d('0x35')]=_[_0x2d6d('0x34')](_0x34d485['model'],qs[_0x2d6d('0x36')](_0x1016e1[_0x2d6d('0x32')]['fields']));_0x2e7b32[_0x2d6d('0x35')]=_0x2e7b32[_0x2d6d('0x35')][_0x2d6d('0x37')]?_0x2e7b32[_0x2d6d('0x35')]:_0x34d485[_0x2d6d('0x30')];if(!_0x1016e1['query']['hasOwnProperty']('nolimit')){_0x2e7b32[_0x2d6d('0x21')]=qs[_0x2d6d('0x21')](_0x1016e1[_0x2d6d('0x32')]['limit']);_0x2e7b32[_0x2d6d('0x20')]=qs[_0x2d6d('0x20')](_0x1016e1[_0x2d6d('0x32')][_0x2d6d('0x20')]);}_0x2e7b32['order']=qs[_0x2d6d('0x38')](_0x1016e1[_0x2d6d('0x32')][_0x2d6d('0x38')]);_0x2e7b32[_0x2d6d('0x39')]=qs[_0x2d6d('0x33')](_[_0x2d6d('0x3a')](_0x1016e1[_0x2d6d('0x32')],_0x34d485['filters']),_0x317bde);if(_0x1016e1[_0x2d6d('0x32')][_0x2d6d('0x3b')]){_0x2e7b32[_0x2d6d('0x39')]=_[_0x2d6d('0x3c')](_0x2e7b32[_0x2d6d('0x39')],{'$or':_['map'](_0x317bde,function(_0x1cad57){if(_0x1cad57[_0x2d6d('0x3d')]!==_0x2d6d('0x3e')){var _0x4616df={};_0x4616df[_0x1cad57[_0x2d6d('0x2b')]]={'$like':'%'+_0x1016e1[_0x2d6d('0x32')][_0x2d6d('0x3b')]+'%'};return _0x4616df;}})});}_0x2e7b32=_[_0x2d6d('0x3c')]({},_0x2e7b32,_0x1016e1[_0x2d6d('0x3f')]);var _0x38cce8={'where':_0x2e7b32[_0x2d6d('0x39')]};return db[_0x2d6d('0x2d')][_0x2d6d('0x1f')](_0x38cce8)[_0x2d6d('0x28')](function(_0x34fc23){_0x486963[_0x2d6d('0x1f')]=_0x34fc23;if(_0x1016e1[_0x2d6d('0x32')]['includeAll']){_0x2e7b32[_0x2d6d('0x40')]=[{'all':!![]}];}return db[_0x2d6d('0x2d')][_0x2d6d('0x41')](_0x2e7b32);})[_0x2d6d('0x28')](function(_0x246d6e){_0x486963['rows']=_0x246d6e;return _0x486963;})[_0x2d6d('0x28')](respondWithFilteredResult(_0x26d299,_0x2e7b32))[_0x2d6d('0x42')](handleError(_0x26d299,null));};exports[_0x2d6d('0x43')]=function(_0x41ab2e,_0x543b4b){var _0x3b62b1={'raw':!![],'where':{'id':_0x41ab2e[_0x2d6d('0x44')]['id']}},_0x7f76ad={};_0x7f76ad[_0x2d6d('0x30')]=_[_0x2d6d('0x31')](db['Cdr'][_0x2d6d('0x45')]);_0x7f76ad[_0x2d6d('0x32')]=_['keys'](_0x41ab2e[_0x2d6d('0x32')]);_0x7f76ad[_0x2d6d('0x33')]=_[_0x2d6d('0x34')](_0x7f76ad['model'],_0x7f76ad[_0x2d6d('0x32')]);_0x3b62b1[_0x2d6d('0x35')]=_['intersection'](_0x7f76ad['model'],qs['fields'](_0x41ab2e[_0x2d6d('0x32')][_0x2d6d('0x36')]));_0x3b62b1['attributes']=_0x3b62b1[_0x2d6d('0x35')][_0x2d6d('0x37')]?_0x3b62b1[_0x2d6d('0x35')]:_0x7f76ad[_0x2d6d('0x30')];if(_0x41ab2e['query'][_0x2d6d('0x46')]){_0x3b62b1[_0x2d6d('0x40')]=[{'all':!![]}];}_0x3b62b1=_['merge']({},_0x3b62b1,_0x41ab2e[_0x2d6d('0x3f')]);return db[_0x2d6d('0x2d')][_0x2d6d('0x47')](_0x3b62b1)[_0x2d6d('0x28')](handleEntityNotFound(_0x543b4b,null))[_0x2d6d('0x28')](respondWithResult(_0x543b4b,null))[_0x2d6d('0x42')](handleError(_0x543b4b,null));};exports[_0x2d6d('0x48')]=function(_0x5ac5e9,_0xe6b038){return db[_0x2d6d('0x2d')][_0x2d6d('0x48')](_0x5ac5e9['body'],{})['then'](respondWithResult(_0xe6b038,0xc9))[_0x2d6d('0x42')](handleError(_0xe6b038,null));};exports[_0x2d6d('0x27')]=function(_0x422198,_0x4e5203){if(_0x422198[_0x2d6d('0x49')]['id']){delete _0x422198[_0x2d6d('0x49')]['id'];}return db['Cdr'][_0x2d6d('0x47')]({'where':{'id':_0x422198[_0x2d6d('0x44')]['id']}})[_0x2d6d('0x28')](handleEntityNotFound(_0x4e5203,null))[_0x2d6d('0x28')](saveUpdates(_0x422198[_0x2d6d('0x49')],null))[_0x2d6d('0x28')](respondWithResult(_0x4e5203,null))[_0x2d6d('0x42')](handleError(_0x4e5203,null));};exports[_0x2d6d('0x4a')]=function(_0x42c125,_0x1ca9a2){return db['Cdr'][_0x2d6d('0x47')]({'where':{'id':_0x42c125[_0x2d6d('0x44')]['id']}})[_0x2d6d('0x28')](handleEntityNotFound(_0x1ca9a2,null))['then'](removeEntity(_0x1ca9a2,null))[_0x2d6d('0x42')](handleError(_0x1ca9a2,null));};exports[_0x2d6d('0x4b')]=function(_0x3738b3,_0x2dbcdc){return db[_0x2d6d('0x2d')][_0x2d6d('0x4b')]()[_0x2d6d('0x28')](respondWithResult(_0x2dbcdc,null))['catch'](handleError(_0x2dbcdc,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 3c7ca1c..f2e0cc1 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x147ae8,_0x284102){var _0x7cc0ec=function(_0x1daf2b){while(--_0x1daf2b){_0x147ae8['push'](_0x147ae8['shift']());}};_0x7cc0ec(++_0x284102);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x1eb400,_0x3c9483){var _0x320d9f=function(_0x56597a){while(--_0x56597a){_0x1eb400['push'](_0x1eb400['shift']());}};_0x320d9f(++_0x3c9483);}(_0x7a54,0x106));var _0x47a5=function(_0x24df01,_0x9a49e3){_0x24df01=_0x24df01-0x0;var _0x2aed6b=_0x7a54[_0x24df01];return _0x2aed6b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 66acda6..2a1699e 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 _0xb523=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x581960,_0x1232ff){var _0x4ee892=function(_0x2a920d){while(--_0x2a920d){_0x581960['push'](_0x581960['shift']());}};_0x4ee892(++_0x1232ff);}(_0xb523,0x139));var _0x3b52=function(_0x449f76,_0x1c6ebc){_0x449f76=_0x449f76-0x0;var _0x417aa7=_0xb523[_0x449f76];return _0x417aa7;};'use strict';var _=require(_0x3b52('0x0'));var util=require(_0x3b52('0x1'));var moment=require(_0x3b52('0x2'));var BPromise=require(_0x3b52('0x3'));var rs=require(_0x3b52('0x4'));var fs=require('fs');var Redis=require(_0x3b52('0x5'));var db=require(_0x3b52('0x6'))['db'];var utils=require(_0x3b52('0x7'));var logger=require(_0x3b52('0x8'))(_0x3b52('0x9'));var config=require(_0x3b52('0xa'));var jayson=require(_0x3b52('0xb'));var client=jayson['client'][_0x3b52('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x161711,_0x41258a,_0xbebdb9){return new BPromise(function(_0x544bef,_0x5f43c7){return client[_0x3b52('0xd')](_0x161711,_0xbebdb9)[_0x3b52('0xe')](function(_0x30b849){logger[_0x3b52('0xf')](_0x3b52('0x10'),_0x41258a,_0x3b52('0x11'));logger[_0x3b52('0x12')]('Cdr,\x20%s,\x20%s,\x20%s',_0x41258a,_0x3b52('0x11'),JSON[_0x3b52('0x13')](_0x30b849));if(_0x30b849[_0x3b52('0x14')]){if(_0x30b849['error'][_0x3b52('0x15')]===0x1f4){logger[_0x3b52('0x14')](_0x3b52('0x10'),_0x41258a,_0x30b849['error']['message']);return _0x5f43c7(_0x30b849['error'][_0x3b52('0x16')]);}logger[_0x3b52('0x14')](_0x3b52('0x10'),_0x41258a,_0x30b849[_0x3b52('0x14')][_0x3b52('0x16')]);return _0x544bef(_0x30b849[_0x3b52('0x14')]['message']);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x41258a,_0x3b52('0x11'));_0x544bef(_0x30b849['result']['message']);}})[_0x3b52('0x17')](function(_0x5ee682){logger[_0x3b52('0x14')](_0x3b52('0x10'),_0x41258a,_0x5ee682);_0x5f43c7(_0x5ee682);});});} \ No newline at end of file +var _0x5a26=['jayson/promise','client','http','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x118e90,_0x45b88b){var _0x105d8c=function(_0x238ad6){while(--_0x238ad6){_0x118e90['push'](_0x118e90['shift']());}};_0x105d8c(++_0x45b88b);}(_0x5a26,0x1f2));var _0x65a2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a26[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x65a2('0x0'));var util=require('util');var moment=require(_0x65a2('0x1'));var BPromise=require('bluebird');var rs=require(_0x65a2('0x2'));var fs=require('fs');var Redis=require(_0x65a2('0x3'));var db=require(_0x65a2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x65a2('0x5'))(_0x65a2('0x6'));var config=require(_0x65a2('0x7'));var jayson=require(_0x65a2('0x8'));var client=jayson[_0x65a2('0x9')][_0x65a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e9020,_0x537664,_0x54f2ed){return new BPromise(function(_0x510b87,_0x6d18b){return client['request'](_0x4e9020,_0x54f2ed)[_0x65a2('0xb')](function(_0x23dc19){logger[_0x65a2('0xc')](_0x65a2('0xd'),_0x537664,_0x65a2('0xe'));logger['debug'](_0x65a2('0xf'),_0x537664,_0x65a2('0xe'),JSON[_0x65a2('0x10')](_0x23dc19));if(_0x23dc19[_0x65a2('0x11')]){if(_0x23dc19['error'][_0x65a2('0x12')]===0x1f4){logger[_0x65a2('0x11')](_0x65a2('0xd'),_0x537664,_0x23dc19[_0x65a2('0x11')][_0x65a2('0x13')]);return _0x6d18b(_0x23dc19[_0x65a2('0x11')][_0x65a2('0x13')]);}logger[_0x65a2('0x11')](_0x65a2('0xd'),_0x537664,_0x23dc19[_0x65a2('0x11')]['message']);return _0x510b87(_0x23dc19['error']['message']);}else{logger['info'](_0x65a2('0xd'),_0x537664,_0x65a2('0xe'));_0x510b87(_0x23dc19[_0x65a2('0x14')][_0x65a2('0x13')]);}})[_0x65a2('0x15')](function(_0x125bdc){logger['error'](_0x65a2('0xd'),_0x537664,_0x125bdc);_0x6d18b(_0x125bdc);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index d13e3f0..0324ead 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(_0x4cbdb7,_0x1b82f6){var _0x4ecb18=function(_0x48271f){while(--_0x48271f){_0x4cbdb7['push'](_0x4cbdb7['shift']());}};_0x4ecb18(++_0x1b82f6);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +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(_0x271d02,_0x5cd222){var _0x14112d=function(_0x43c775){while(--_0x43c775){_0x271d02['push'](_0x271d02['shift']());}};_0x14112d(++_0x5cd222);}(_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 952df99..b4bd554 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 _0xaf34=['STRING','*,*,*,*','exports','INTEGER'];(function(_0x4ff7d2,_0x25629b){var _0x6df362=function(_0x497b1b){while(--_0x497b1b){_0x4ff7d2['push'](_0x4ff7d2['shift']());}};_0x6df362(++_0x25629b);}(_0xaf34,0x1de));var _0x4af3=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xaf34[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require('sequelize');module[_0x4af3('0x0')]={'priority':{'type':Sequelize[_0x4af3('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4af3('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x4af3('0x2')]},'interval':{'type':Sequelize[_0x4af3('0x2')],'defaultValue':_0x4af3('0x3')}}; \ No newline at end of file +var _0x6e87=['TEXT','exports','INTEGER','STRING','noop'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x6e87,0x7e));var _0x76e8=function(_0x52c8f8,_0x5b141b){_0x52c8f8=_0x52c8f8-0x0;var _0x3193ba=_0x6e87[_0x52c8f8];return _0x3193ba;};'use strict';var Sequelize=require('sequelize');module[_0x76e8('0x0')]={'priority':{'type':Sequelize[_0x76e8('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x76e8('0x2')],'allowNull':![],'defaultValue':_0x76e8('0x3')},'appdata':{'type':Sequelize[_0x76e8('0x4')]()},'description':{'type':Sequelize[_0x76e8('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 737ce6b..ce0d984 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 _0x9234=['query','intersection','attributes','fields','includeAll','include','merge','catch','update','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes'];(function(_0x4c8b00,_0x16c38a){var _0x406a86=function(_0x93805a){while(--_0x93805a){_0x4c8b00['push'](_0x4c8b00['shift']());}};_0x406a86(++_0x16c38a);}(_0x9234,0x1bd));var _0x4923=function(_0x32d414,_0x4d23da){_0x32d414=_0x32d414-0x0;var _0x4e0bca=_0x9234[_0x32d414];return _0x4e0bca;};'use strict';var emlformat=require(_0x4923('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4923('0x1'));var jsonpatch=require(_0x4923('0x2'));var rp=require(_0x4923('0x3'));var moment=require(_0x4923('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4923('0x5'));var util=require(_0x4923('0x6'));var path=require('path');var sox=require(_0x4923('0x7'));var csv=require(_0x4923('0x8'));var ejs=require(_0x4923('0x9'));var fs=require('fs');var fs_extra=require(_0x4923('0xa'));var _=require(_0x4923('0xb'));var squel=require(_0x4923('0xc'));var crypto=require(_0x4923('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4923('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4923('0xf'));var Papa=require(_0x4923('0x10'));var Redis=require(_0x4923('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4923('0x12'));var as=require(_0x4923('0x13'));var hardwareService=require(_0x4923('0x14'));var logger=require(_0x4923('0x15'))(_0x4923('0x16'));var utils=require(_0x4923('0x17'));var config=require(_0x4923('0x18'));var licenseUtil=require(_0x4923('0x19'));var db=require(_0x4923('0x1a'))['db'];function respondWithStatusCode(_0x1e04b7,_0x5b950f){_0x5b950f=_0x5b950f||0xcc;return function(_0x4d6fda){if(_0x4d6fda){return _0x1e04b7[_0x4923('0x1b')](_0x5b950f);}return _0x1e04b7[_0x4923('0x1c')](_0x5b950f)[_0x4923('0x1d')]();};}function respondWithResult(_0x4c9289,_0x31a469){_0x31a469=_0x31a469||0xc8;return function(_0x27a52b){if(_0x27a52b){return _0x4c9289[_0x4923('0x1c')](_0x31a469)[_0x4923('0x1e')](_0x27a52b);}};}function respondWithFilteredResult(_0x27dbb2,_0x29a354){return function(_0x1f8375){if(_0x1f8375){var _0x2897da=typeof _0x29a354[_0x4923('0x1f')]===_0x4923('0x20')&&typeof _0x29a354['limit']===_0x4923('0x20');var _0x260e53=_0x1f8375[_0x4923('0x21')];var _0x1be04d=_0x2897da?0x0:_0x29a354['offset'];var _0x50fd18=_0x2897da?_0x1f8375[_0x4923('0x21')]:_0x29a354['offset']+_0x29a354[_0x4923('0x22')];var _0x1ab861;if(_0x50fd18>=_0x260e53){_0x50fd18=_0x260e53;_0x1ab861=0xc8;}else{_0x1ab861=0xce;}_0x27dbb2['status'](_0x1ab861);return _0x27dbb2[_0x4923('0x23')](_0x4923('0x24'),_0x1be04d+'-'+_0x50fd18+'/'+_0x260e53)[_0x4923('0x1e')](_0x1f8375);}return null;};}function patchUpdates(_0x8a9ab7){return function(_0x528b6b){try{jsonpatch[_0x4923('0x25')](_0x528b6b,_0x8a9ab7,!![]);}catch(_0x39039f){return BPromise['reject'](_0x39039f);}return _0x528b6b[_0x4923('0x26')]();};}function saveUpdates(_0x522753,_0x3de8f5){return function(_0x168bb4){if(_0x168bb4){return _0x168bb4['update'](_0x522753)[_0x4923('0x27')](function(_0xb1b3d3){return _0xb1b3d3;});}return null;};}function removeEntity(_0x2eb1b7,_0x161cf9){return function(_0x3aaede){if(_0x3aaede){return _0x3aaede[_0x4923('0x28')]()[_0x4923('0x27')](function(){_0x2eb1b7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23ec97,_0x36cc38){return function(_0xdb893b){if(!_0xdb893b){_0x23ec97[_0x4923('0x1b')](0x194);}return _0xdb893b;};}function handleError(_0x2ea650,_0x4473a3){_0x4473a3=_0x4473a3||0x1f4;return function(_0x13681b){logger[_0x4923('0x29')](_0x13681b[_0x4923('0x2a')]);if(_0x13681b[_0x4923('0x2b')]){delete _0x13681b[_0x4923('0x2b')];}_0x2ea650['status'](_0x4473a3)[_0x4923('0x2c')](_0x13681b);};}exports[_0x4923('0x2d')]=function(_0x7944b2,_0x39decd){var _0x21c229={'raw':!![],'where':{'id':_0x7944b2[_0x4923('0x2e')]['id']}},_0x47158c={};_0x47158c[_0x4923('0x2f')]=_[_0x4923('0x30')](db[_0x4923('0x31')][_0x4923('0x32')]);_0x47158c[_0x4923('0x33')]=_[_0x4923('0x30')](_0x7944b2[_0x4923('0x33')]);_0x47158c['filters']=_[_0x4923('0x34')](_0x47158c[_0x4923('0x2f')],_0x47158c[_0x4923('0x33')]);_0x21c229[_0x4923('0x35')]=_[_0x4923('0x34')](_0x47158c[_0x4923('0x2f')],qs[_0x4923('0x36')](_0x7944b2[_0x4923('0x33')]['fields']));_0x21c229['attributes']=_0x21c229[_0x4923('0x35')]['length']?_0x21c229['attributes']:_0x47158c['model'];if(_0x7944b2[_0x4923('0x33')][_0x4923('0x37')]){_0x21c229[_0x4923('0x38')]=[{'all':!![]}];}_0x21c229=_[_0x4923('0x39')]({},_0x21c229,_0x7944b2['options']);return db[_0x4923('0x31')]['find'](_0x21c229)[_0x4923('0x27')](handleEntityNotFound(_0x39decd,null))[_0x4923('0x27')](respondWithResult(_0x39decd,null))[_0x4923('0x3a')](handleError(_0x39decd,null));};exports[_0x4923('0x3b')]=function(_0x542fc,_0x56259c){if(_0x542fc[_0x4923('0x3c')]['id']){delete _0x542fc['body']['id'];}return db['ChatApplication'][_0x4923('0x3d')]({'where':{'id':_0x542fc[_0x4923('0x2e')]['id']}})[_0x4923('0x27')](handleEntityNotFound(_0x56259c,null))[_0x4923('0x27')](saveUpdates(_0x542fc[_0x4923('0x3c')],null))[_0x4923('0x27')](respondWithResult(_0x56259c,null))[_0x4923('0x3a')](handleError(_0x56259c,null));};exports['destroy']=function(_0x1f41b6,_0x547682){return db['ChatApplication'][_0x4923('0x3d')]({'where':{'id':_0x1f41b6[_0x4923('0x2e')]['id']}})['then'](handleEntityNotFound(_0x547682,null))[_0x4923('0x27')](removeEntity(_0x547682,null))[_0x4923('0x3a')](handleError(_0x547682,null));}; \ No newline at end of file +var _0x3013=['body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','apply','then','destroy','error','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','options','catch','update'];(function(_0x383dbb,_0x17d41b){var _0x6e8bde=function(_0x2740f1){while(--_0x2740f1){_0x383dbb['push'](_0x383dbb['shift']());}};_0x6e8bde(++_0x17d41b);}(_0x3013,0xea));var _0x3301=function(_0x12aaa9,_0x71ed9c){_0x12aaa9=_0x12aaa9-0x0;var _0x6da6d8=_0x3013[_0x12aaa9];return _0x6da6d8;};'use strict';var emlformat=require(_0x3301('0x0'));var rimraf=require(_0x3301('0x1'));var zipdir=require(_0x3301('0x2'));var jsonpatch=require(_0x3301('0x3'));var rp=require('request-promise');var moment=require(_0x3301('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3301('0x5'));var util=require(_0x3301('0x6'));var path=require(_0x3301('0x7'));var sox=require(_0x3301('0x8'));var csv=require('to-csv');var ejs=require(_0x3301('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3301('0xa'));var squel=require(_0x3301('0xb'));var crypto=require(_0x3301('0xc'));var jsforce=require(_0x3301('0xd'));var deskjs=require(_0x3301('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3301('0xf'));var Papa=require(_0x3301('0x10'));var Redis=require(_0x3301('0x11'));var authService=require(_0x3301('0x12'));var qs=require(_0x3301('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3301('0x14'));var logger=require(_0x3301('0x15'))(_0x3301('0x16'));var utils=require(_0x3301('0x17'));var config=require(_0x3301('0x18'));var licenseUtil=require(_0x3301('0x19'));var db=require(_0x3301('0x1a'))['db'];function respondWithStatusCode(_0x2c8df9,_0x427c22){_0x427c22=_0x427c22||0xcc;return function(_0x40dad9){if(_0x40dad9){return _0x2c8df9[_0x3301('0x1b')](_0x427c22);}return _0x2c8df9[_0x3301('0x1c')](_0x427c22)[_0x3301('0x1d')]();};}function respondWithResult(_0x3dcf1d,_0x52a56c){_0x52a56c=_0x52a56c||0xc8;return function(_0x3d182e){if(_0x3d182e){return _0x3dcf1d[_0x3301('0x1c')](_0x52a56c)['json'](_0x3d182e);}};}function respondWithFilteredResult(_0x49bc8e,_0x8f280d){return function(_0x225e94){if(_0x225e94){var _0x5e7d09=typeof _0x8f280d[_0x3301('0x1e')]===_0x3301('0x1f')&&typeof _0x8f280d['limit']===_0x3301('0x1f');var _0x6e88ec=_0x225e94[_0x3301('0x20')];var _0x4b3eea=_0x5e7d09?0x0:_0x8f280d[_0x3301('0x1e')];var _0xd3d931=_0x5e7d09?_0x225e94[_0x3301('0x20')]:_0x8f280d[_0x3301('0x1e')]+_0x8f280d[_0x3301('0x21')];var _0x2a15b9;if(_0xd3d931>=_0x6e88ec){_0xd3d931=_0x6e88ec;_0x2a15b9=0xc8;}else{_0x2a15b9=0xce;}_0x49bc8e['status'](_0x2a15b9);return _0x49bc8e['set']('Content-Range',_0x4b3eea+'-'+_0xd3d931+'/'+_0x6e88ec)['json'](_0x225e94);}return null;};}function patchUpdates(_0x23dcc8){return function(_0x2b2005){try{jsonpatch[_0x3301('0x22')](_0x2b2005,_0x23dcc8,!![]);}catch(_0x2490d7){return BPromise['reject'](_0x2490d7);}return _0x2b2005['save']();};}function saveUpdates(_0x4e65c9,_0x3ebe89){return function(_0x54c291){if(_0x54c291){return _0x54c291['update'](_0x4e65c9)[_0x3301('0x23')](function(_0x21edb4){return _0x21edb4;});}return null;};}function removeEntity(_0x258d28,_0xef67c4){return function(_0x1d89b2){if(_0x1d89b2){return _0x1d89b2[_0x3301('0x24')]()['then'](function(){_0x258d28[_0x3301('0x1c')](0xcc)[_0x3301('0x1d')]();});}};}function handleEntityNotFound(_0x13fb21,_0x39d766){return function(_0x54ec21){if(!_0x54ec21){_0x13fb21[_0x3301('0x1b')](0x194);}return _0x54ec21;};}function handleError(_0x2f821,_0x150f73){_0x150f73=_0x150f73||0x1f4;return function(_0x2febe1){logger[_0x3301('0x25')](_0x2febe1['stack']);if(_0x2febe1['name']){delete _0x2febe1['name'];}_0x2f821['status'](_0x150f73)[_0x3301('0x26')](_0x2febe1);};}exports[_0x3301('0x27')]=function(_0x1684a9,_0x48f661){var _0x31d585={'raw':!![],'where':{'id':_0x1684a9[_0x3301('0x28')]['id']}},_0x3d1d80={};_0x3d1d80[_0x3301('0x29')]=_[_0x3301('0x2a')](db[_0x3301('0x2b')][_0x3301('0x2c')]);_0x3d1d80[_0x3301('0x2d')]=_['keys'](_0x1684a9['query']);_0x3d1d80[_0x3301('0x2e')]=_[_0x3301('0x2f')](_0x3d1d80[_0x3301('0x29')],_0x3d1d80[_0x3301('0x2d')]);_0x31d585[_0x3301('0x30')]=_[_0x3301('0x2f')](_0x3d1d80[_0x3301('0x29')],qs['fields'](_0x1684a9['query'][_0x3301('0x31')]));_0x31d585[_0x3301('0x30')]=_0x31d585[_0x3301('0x30')][_0x3301('0x32')]?_0x31d585[_0x3301('0x30')]:_0x3d1d80[_0x3301('0x29')];if(_0x1684a9[_0x3301('0x2d')][_0x3301('0x33')]){_0x31d585[_0x3301('0x34')]=[{'all':!![]}];}_0x31d585=_['merge']({},_0x31d585,_0x1684a9[_0x3301('0x35')]);return db['ChatApplication']['find'](_0x31d585)[_0x3301('0x23')](handleEntityNotFound(_0x48f661,null))[_0x3301('0x23')](respondWithResult(_0x48f661,null))[_0x3301('0x36')](handleError(_0x48f661,null));};exports[_0x3301('0x37')]=function(_0x115b72,_0x137f48){if(_0x115b72[_0x3301('0x38')]['id']){delete _0x115b72['body']['id'];}return db[_0x3301('0x2b')][_0x3301('0x39')]({'where':{'id':_0x115b72[_0x3301('0x28')]['id']}})[_0x3301('0x23')](handleEntityNotFound(_0x137f48,null))[_0x3301('0x23')](saveUpdates(_0x115b72[_0x3301('0x38')],null))[_0x3301('0x23')](respondWithResult(_0x137f48,null))['catch'](handleError(_0x137f48,null));};exports[_0x3301('0x24')]=function(_0x37b3a3,_0x563392){return db['ChatApplication'][_0x3301('0x39')]({'where':{'id':_0x37b3a3[_0x3301('0x28')]['id']}})['then'](handleEntityNotFound(_0x563392,null))[_0x3301('0x23')](removeEntity(_0x563392,null))['catch'](handleError(_0x563392,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index f6cd6dc..d32a895 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 _0x28e6=['utf8mb4_unicode_ci','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','define','ChatApplication','chat_applications','utf8mb4'];(function(_0x252fbf,_0x59126d){var _0x102b85=function(_0x536e59){while(--_0x536e59){_0x252fbf['push'](_0x252fbf['shift']());}};_0x102b85(++_0x59126d);}(_0x28e6,0x181));var _0x628e=function(_0x4a2130,_0x3e5628){_0x4a2130=_0x4a2130-0x0;var _0x3b5d53=_0x28e6[_0x4a2130];return _0x3b5d53;};'use strict';var _=require('lodash');var util=require(_0x628e('0x0'));var logger=require(_0x628e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x628e('0x2'));var rp=require(_0x628e('0x3'));var fs=require('fs');var path=require(_0x628e('0x4'));var rimraf=require(_0x628e('0x5'));var config=require(_0x628e('0x6'));var attributes=require('./chatApplication.attributes');module['exports']=function(_0x20c439,_0x3d0064){return _0x20c439[_0x628e('0x7')](_0x628e('0x8'),attributes,{'tableName':_0x628e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x628e('0xa'),'collate':_0x628e('0xb')});}; \ No newline at end of file +var _0xbdfd=['bluebird','request-promise','rimraf','../../config/environment','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment'];(function(_0x4f6e7f,_0x22d8b1){var _0x3d919b=function(_0xad4db3){while(--_0xad4db3){_0x4f6e7f['push'](_0x4f6e7f['shift']());}};_0x3d919b(++_0x22d8b1);}(_0xbdfd,0x135));var _0xdbdf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbdfd[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xdbdf('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdbdf('0x1'));var moment=require(_0xdbdf('0x2'));var BPromise=require(_0xdbdf('0x3'));var rp=require(_0xdbdf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdbdf('0x5'));var config=require(_0xdbdf('0x6'));var attributes=require('./chatApplication.attributes');module[_0xdbdf('0x7')]=function(_0xa743ff,_0x484034){return _0xa743ff[_0xdbdf('0x8')](_0xdbdf('0x9'),attributes,{'tableName':_0xdbdf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdbdf('0xb'),'collate':_0xdbdf('0xc')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index e6b28a6..670ed91 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 _0x81f8=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ChatApplication,\x20%s,\x20%s','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result'];(function(_0x5d5f6e,_0x3cacab){var _0xe1fe8d=function(_0x76427){while(--_0x76427){_0x5d5f6e['push'](_0x5d5f6e['shift']());}};_0xe1fe8d(++_0x3cacab);}(_0x81f8,0xd2));var _0x881f=function(_0x499729,_0x195f21){_0x499729=_0x499729-0x0;var _0x5342d4=_0x81f8[_0x499729];return _0x5342d4;};'use strict';var _=require(_0x881f('0x0'));var util=require(_0x881f('0x1'));var moment=require('moment');var BPromise=require(_0x881f('0x2'));var rs=require(_0x881f('0x3'));var fs=require('fs');var Redis=require(_0x881f('0x4'));var db=require(_0x881f('0x5'))['db'];var utils=require(_0x881f('0x6'));var logger=require(_0x881f('0x7'))(_0x881f('0x8'));var config=require(_0x881f('0x9'));var jayson=require(_0x881f('0xa'));var client=jayson['client'][_0x881f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42b4ae,_0x3e77f0,_0x2c4f3a){return new BPromise(function(_0x1b7bf6,_0x3e8cbe){return client[_0x881f('0xc')](_0x42b4ae,_0x2c4f3a)[_0x881f('0xd')](function(_0x4c16ef){logger['info'](_0x881f('0xe'),_0x3e77f0,'request\x20sent');logger['debug'](_0x881f('0xf'),_0x3e77f0,'request\x20sent',JSON['stringify'](_0x4c16ef));if(_0x4c16ef[_0x881f('0x10')]){if(_0x4c16ef[_0x881f('0x10')][_0x881f('0x11')]===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x3e77f0,_0x4c16ef[_0x881f('0x10')][_0x881f('0x12')]);return _0x3e8cbe(_0x4c16ef[_0x881f('0x10')][_0x881f('0x12')]);}logger['error'](_0x881f('0xe'),_0x3e77f0,_0x4c16ef['error'][_0x881f('0x12')]);return _0x1b7bf6(_0x4c16ef['error'][_0x881f('0x12')]);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x3e77f0,_0x881f('0x13'));_0x1b7bf6(_0x4c16ef[_0x881f('0x14')][_0x881f('0x12')]);}})['catch'](function(_0x2907f3){logger[_0x881f('0x10')](_0x881f('0xe'),_0x3e77f0,_0x2907f3);_0x3e8cbe(_0x2907f3);});});} \ No newline at end of file +var _0x36fc=['stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s'];(function(_0x389722,_0x2cb8ac){var _0x2c41f5=function(_0x471ba9){while(--_0x471ba9){_0x389722['push'](_0x389722['shift']());}};_0x2c41f5(++_0x2cb8ac);}(_0x36fc,0x6e));var _0xc36f=function(_0x1bd332,_0x536135){_0x1bd332=_0x1bd332-0x0;var _0x3227cd=_0x36fc[_0x1bd332];return _0x3227cd;};'use strict';var _=require('lodash');var util=require(_0xc36f('0x0'));var moment=require(_0xc36f('0x1'));var BPromise=require(_0xc36f('0x2'));var rs=require(_0xc36f('0x3'));var fs=require('fs');var Redis=require(_0xc36f('0x4'));var db=require(_0xc36f('0x5'))['db'];var utils=require(_0xc36f('0x6'));var logger=require(_0xc36f('0x7'))(_0xc36f('0x8'));var config=require(_0xc36f('0x9'));var jayson=require(_0xc36f('0xa'));var client=jayson['client'][_0xc36f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x306d78,_0x4cd1f3,_0x5bc3d0){return new BPromise(function(_0x561393,_0x57937c){return client['request'](_0x306d78,_0x5bc3d0)[_0xc36f('0xc')](function(_0x27bbb5){logger['info'](_0xc36f('0xd'),_0x4cd1f3,_0xc36f('0xe'));logger['debug'](_0xc36f('0xf'),_0x4cd1f3,'request\x20sent',JSON[_0xc36f('0x10')](_0x27bbb5));if(_0x27bbb5[_0xc36f('0x11')]){if(_0x27bbb5['error'][_0xc36f('0x12')]===0x1f4){logger[_0xc36f('0x11')]('ChatApplication,\x20%s,\x20%s',_0x4cd1f3,_0x27bbb5[_0xc36f('0x11')]['message']);return _0x57937c(_0x27bbb5['error'][_0xc36f('0x13')]);}logger[_0xc36f('0x11')]('ChatApplication,\x20%s,\x20%s',_0x4cd1f3,_0x27bbb5[_0xc36f('0x11')][_0xc36f('0x13')]);return _0x561393(_0x27bbb5[_0xc36f('0x11')][_0xc36f('0x13')]);}else{logger['info'](_0xc36f('0xd'),_0x4cd1f3,_0xc36f('0xe'));_0x561393(_0x27bbb5[_0xc36f('0x14')]['message']);}})['catch'](function(_0x3911c6){logger[_0xc36f('0x11')](_0xc36f('0xd'),_0x4cd1f3,_0x3911c6);_0x57937c(_0x3911c6);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 0e496cd..46fd3f9 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 _0xc669=['exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','isAuthenticated','show','/:id','update','delete','destroy'];(function(_0x467c35,_0x36cf32){var _0x4b5547=function(_0x546798){while(--_0x546798){_0x467c35['push'](_0x467c35['shift']());}};_0x4b5547(++_0x36cf32);}(_0xc669,0x144));var _0x9c66=function(_0x5acafb,_0x289611){_0x5acafb=_0x5acafb-0x0;var _0x11fb89=_0xc669[_0x5acafb];return _0x11fb89;};'use strict';var multer=require(_0x9c66('0x0'));var util=require(_0x9c66('0x1'));var path=require(_0x9c66('0x2'));var timeout=require('connect-timeout');var express=require(_0x9c66('0x3'));var router=express[_0x9c66('0x4')]();var fs_extra=require(_0x9c66('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9c66('0x6'));var config=require(_0x9c66('0x7'));var controller=require(_0x9c66('0x8'));router[_0x9c66('0x9')]('/:id',auth[_0x9c66('0xa')](),controller[_0x9c66('0xb')]);router['put'](_0x9c66('0xc'),auth[_0x9c66('0xa')](),controller[_0x9c66('0xd')]);router[_0x9c66('0xe')](_0x9c66('0xc'),auth[_0x9c66('0xa')](),controller[_0x9c66('0xf')]);module[_0x9c66('0x10')]=router; \ No newline at end of file +var _0xcbe4=['delete','isAuthenticated','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','./chatApplication.controller','/:id','put'];(function(_0x16f117,_0x1a0bf9){var _0x169b4d=function(_0x562314){while(--_0x562314){_0x16f117['push'](_0x16f117['shift']());}};_0x169b4d(++_0x1a0bf9);}(_0xcbe4,0x153));var _0x4cbe=function(_0x1ab479,_0x2a2ed6){_0x1ab479=_0x1ab479-0x0;var _0x43aa53=_0xcbe4[_0x1ab479];return _0x43aa53;};'use strict';var multer=require(_0x4cbe('0x0'));var util=require(_0x4cbe('0x1'));var path=require(_0x4cbe('0x2'));var timeout=require(_0x4cbe('0x3'));var express=require(_0x4cbe('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4cbe('0x5'));var config=require('../../config/environment');var controller=require(_0x4cbe('0x6'));router['get'](_0x4cbe('0x7'),auth['isAuthenticated'](),controller['show']);router[_0x4cbe('0x8')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x4cbe('0x9')](_0x4cbe('0x7'),auth[_0x4cbe('0xa')](),controller['destroy']);module[_0x4cbe('0xb')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index d64e127..4f3fc49 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 _0x9e2e=['STRING','BOOLEAN','sequelize','exports'];(function(_0x100815,_0x4279a7){var _0x14d54d=function(_0x38ced6){while(--_0x38ced6){_0x100815['push'](_0x100815['shift']());}};_0x14d54d(++_0x4279a7);}(_0x9e2e,0xd6));var _0xe9e2=function(_0x5effcf,_0x47af59){_0x5effcf=_0x5effcf-0x0;var _0x4d123c=_0x9e2e[_0x5effcf];return _0x4d123c;};'use strict';var Sequelize=require(_0xe9e2('0x0'));module[_0xe9e2('0x1')]={'name':{'type':Sequelize[_0xe9e2('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xe9e2('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xe63f=['BOOLEAN','sequelize','STRING'];(function(_0x1bb58c,_0x2c8a4d){var _0x277586=function(_0x11fd4c){while(--_0x11fd4c){_0x1bb58c['push'](_0x1bb58c['shift']());}};_0x277586(++_0x2c8a4d);}(_0xe63f,0x163));var _0xfe63=function(_0xdc6179,_0x228c8d){_0xdc6179=_0xdc6179-0x0;var _0x3c24c4=_0xe63f[_0xdc6179];return _0x3c24c4;};'use strict';var Sequelize=require(_0xfe63('0x0'));module['exports']={'name':{'type':Sequelize[_0xfe63('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xfe63('0x1')]},'write':{'type':Sequelize[_0xfe63('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 90824ca..096f0fb 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 _0x40f8=['register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','ChatGroup','includeAll','include','rows','catch','show','params','keys','create','body','find','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket'];(function(_0x2a8860,_0x2da926){var _0x2f47a4=function(_0x3b7f54){while(--_0x3b7f54){_0x2a8860['push'](_0x2a8860['shift']());}};_0x2f47a4(++_0x2da926);}(_0x40f8,0x10a));var _0x840f=function(_0x1cf418,_0x115f58){_0x1cf418=_0x1cf418-0x0;var _0x456ddf=_0x40f8[_0x1cf418];return _0x456ddf;};'use strict';var emlformat=require(_0x840f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x840f('0x1'));var rp=require(_0x840f('0x2'));var moment=require(_0x840f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x840f('0x4'));var util=require(_0x840f('0x5'));var path=require(_0x840f('0x6'));var sox=require(_0x840f('0x7'));var csv=require(_0x840f('0x8'));var ejs=require(_0x840f('0x9'));var fs=require('fs');var fs_extra=require(_0x840f('0xa'));var _=require('lodash');var squel=require(_0x840f('0xb'));var crypto=require('crypto');var jsforce=require(_0x840f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x840f('0x8'));var querystring=require(_0x840f('0xd'));var Papa=require(_0x840f('0xe'));var Redis=require(_0x840f('0xf'));var authService=require(_0x840f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x840f('0x11'));var hardwareService=require(_0x840f('0x12'));var logger=require(_0x840f('0x13'))(_0x840f('0x14'));var utils=require('../../config/utils');var config=require(_0x840f('0x15'));var licenseUtil=require(_0x840f('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x840f('0x17')](config[_0x840f('0x18')],{'host':_0x840f('0x19'),'port':0x18eb});var socket=require(_0x840f('0x1a'))(new Redis(config[_0x840f('0x18')]));require(_0x840f('0x1b'))[_0x840f('0x1c')](socket);function respondWithStatusCode(_0x2c9e14,_0x7392fd){_0x7392fd=_0x7392fd||0xcc;return function(_0x43c727){if(_0x43c727){return _0x2c9e14[_0x840f('0x1d')](_0x7392fd);}return _0x2c9e14[_0x840f('0x1e')](_0x7392fd)[_0x840f('0x1f')]();};}function respondWithResult(_0x52b1c6,_0x152c97){_0x152c97=_0x152c97||0xc8;return function(_0x120edc){if(_0x120edc){return _0x52b1c6['status'](_0x152c97)[_0x840f('0x20')](_0x120edc);}};}function respondWithFilteredResult(_0x1414d8,_0x5eae07){return function(_0x4c721e){if(_0x4c721e){var _0x253856=typeof _0x5eae07[_0x840f('0x21')]===_0x840f('0x22')&&typeof _0x5eae07[_0x840f('0x23')]==='undefined';var _0x4aa2af=_0x4c721e[_0x840f('0x24')];var _0x41e376=_0x253856?0x0:_0x5eae07['offset'];var _0x1e6e68=_0x253856?_0x4c721e[_0x840f('0x24')]:_0x5eae07['offset']+_0x5eae07['limit'];var _0x45b029;if(_0x1e6e68>=_0x4aa2af){_0x1e6e68=_0x4aa2af;_0x45b029=0xc8;}else{_0x45b029=0xce;}_0x1414d8['status'](_0x45b029);return _0x1414d8['set'](_0x840f('0x25'),_0x41e376+'-'+_0x1e6e68+'/'+_0x4aa2af)[_0x840f('0x20')](_0x4c721e);}return null;};}function patchUpdates(_0x4b2287){return function(_0x30e41a){try{jsonpatch['apply'](_0x30e41a,_0x4b2287,!![]);}catch(_0x43952d){return BPromise['reject'](_0x43952d);}return _0x30e41a[_0x840f('0x26')]();};}function saveUpdates(_0x83fa9,_0x222b61){return function(_0x10f6ab){if(_0x10f6ab){return _0x10f6ab[_0x840f('0x27')](_0x83fa9)[_0x840f('0x28')](function(_0x2efdd0){return _0x2efdd0;});}return null;};}function removeEntity(_0x9a6c6b,_0x5c3c7c){return function(_0x4fe326){if(_0x4fe326){return _0x4fe326[_0x840f('0x29')]()[_0x840f('0x28')](function(){_0x9a6c6b[_0x840f('0x1e')](0xcc)[_0x840f('0x1f')]();});}};}function handleEntityNotFound(_0x2a32a8,_0x4c5736){return function(_0xc1b10e){if(!_0xc1b10e){_0x2a32a8[_0x840f('0x1d')](0x194);}return _0xc1b10e;};}function handleError(_0x45f1e1,_0x2e5010){_0x2e5010=_0x2e5010||0x1f4;return function(_0x19b441){logger['error'](_0x19b441[_0x840f('0x2a')]);if(_0x19b441[_0x840f('0x2b')]){delete _0x19b441[_0x840f('0x2b')];}_0x45f1e1['status'](_0x2e5010)[_0x840f('0x2c')](_0x19b441);};}exports[_0x840f('0x2d')]=function(_0x5ac58e,_0x519bc4){var _0x537383={},_0x2fb007={},_0x2d5302={'count':0x0,'rows':[]};var _0x4f8fd9=_[_0x840f('0x2e')](db['ChatGroup'][_0x840f('0x2f')],function(_0x524937){return{'name':_0x524937[_0x840f('0x30')],'type':_0x524937[_0x840f('0x31')][_0x840f('0x32')]};});_0x2fb007[_0x840f('0x33')]=_[_0x840f('0x2e')](_0x4f8fd9,'name');_0x2fb007['query']=_['keys'](_0x5ac58e[_0x840f('0x34')]);_0x2fb007[_0x840f('0x35')]=_['intersection'](_0x2fb007[_0x840f('0x33')],_0x2fb007[_0x840f('0x34')]);_0x537383['attributes']=_[_0x840f('0x36')](_0x2fb007[_0x840f('0x33')],qs[_0x840f('0x37')](_0x5ac58e[_0x840f('0x34')][_0x840f('0x37')]));_0x537383['attributes']=_0x537383[_0x840f('0x38')][_0x840f('0x39')]?_0x537383['attributes']:_0x2fb007[_0x840f('0x33')];if(!_0x5ac58e[_0x840f('0x34')][_0x840f('0x3a')](_0x840f('0x3b'))){_0x537383[_0x840f('0x23')]=qs[_0x840f('0x23')](_0x5ac58e[_0x840f('0x34')]['limit']);_0x537383[_0x840f('0x21')]=qs[_0x840f('0x21')](_0x5ac58e[_0x840f('0x34')]['offset']);}_0x537383[_0x840f('0x3c')]=qs[_0x840f('0x3d')](_0x5ac58e[_0x840f('0x34')][_0x840f('0x3d')]);_0x537383['where']=qs[_0x840f('0x35')](_[_0x840f('0x3e')](_0x5ac58e[_0x840f('0x34')],_0x2fb007['filters']),_0x4f8fd9);if(_0x5ac58e[_0x840f('0x34')][_0x840f('0x3f')]){_0x537383[_0x840f('0x40')]=_[_0x840f('0x41')](_0x537383[_0x840f('0x40')],{'$or':_[_0x840f('0x2e')](_0x4f8fd9,function(_0x1665e5){if(_0x1665e5[_0x840f('0x31')]!==_0x840f('0x42')){var _0x1634f2={};_0x1634f2[_0x1665e5[_0x840f('0x2b')]]={'$like':'%'+_0x5ac58e['query'][_0x840f('0x3f')]+'%'};return _0x1634f2;}})});}_0x537383=_[_0x840f('0x41')]({},_0x537383,_0x5ac58e[_0x840f('0x43')]);var _0x401222={'where':_0x537383[_0x840f('0x40')]};return db[_0x840f('0x44')][_0x840f('0x24')](_0x401222)[_0x840f('0x28')](function(_0x59feee){_0x2d5302[_0x840f('0x24')]=_0x59feee;if(_0x5ac58e[_0x840f('0x34')][_0x840f('0x45')]){_0x537383[_0x840f('0x46')]=[{'all':!![]}];}return db[_0x840f('0x44')]['findAll'](_0x537383);})[_0x840f('0x28')](function(_0x4aa74a){_0x2d5302[_0x840f('0x47')]=_0x4aa74a;return _0x2d5302;})[_0x840f('0x28')](respondWithFilteredResult(_0x519bc4,_0x537383))[_0x840f('0x48')](handleError(_0x519bc4,null));};exports[_0x840f('0x49')]=function(_0x2f6a32,_0x53d792){var _0x42bfb8={'raw':!![],'where':{'id':_0x2f6a32[_0x840f('0x4a')]['id']}},_0x1baf1d={};_0x1baf1d[_0x840f('0x33')]=_[_0x840f('0x4b')](db[_0x840f('0x44')][_0x840f('0x2f')]);_0x1baf1d[_0x840f('0x34')]=_[_0x840f('0x4b')](_0x2f6a32['query']);_0x1baf1d['filters']=_[_0x840f('0x36')](_0x1baf1d[_0x840f('0x33')],_0x1baf1d['query']);_0x42bfb8[_0x840f('0x38')]=_[_0x840f('0x36')](_0x1baf1d['model'],qs[_0x840f('0x37')](_0x2f6a32[_0x840f('0x34')][_0x840f('0x37')]));_0x42bfb8[_0x840f('0x38')]=_0x42bfb8['attributes'][_0x840f('0x39')]?_0x42bfb8[_0x840f('0x38')]:_0x1baf1d[_0x840f('0x33')];if(_0x2f6a32[_0x840f('0x34')]['includeAll']){_0x42bfb8[_0x840f('0x46')]=[{'all':!![]}];}_0x42bfb8=_['merge']({},_0x42bfb8,_0x2f6a32[_0x840f('0x43')]);return db[_0x840f('0x44')]['find'](_0x42bfb8)['then'](handleEntityNotFound(_0x53d792,null))['then'](respondWithResult(_0x53d792,null))[_0x840f('0x48')](handleError(_0x53d792,null));};exports[_0x840f('0x4c')]=function(_0x75fb81,_0x3570f4){return db['ChatGroup'][_0x840f('0x4c')](_0x75fb81['body'],{})[_0x840f('0x28')](respondWithResult(_0x3570f4,0xc9))[_0x840f('0x48')](handleError(_0x3570f4,null));};exports[_0x840f('0x27')]=function(_0x227e80,_0x1dc164){if(_0x227e80['body']['id']){delete _0x227e80[_0x840f('0x4d')]['id'];}return db[_0x840f('0x44')]['find']({'where':{'id':_0x227e80[_0x840f('0x4a')]['id']}})[_0x840f('0x28')](handleEntityNotFound(_0x1dc164,null))[_0x840f('0x28')](saveUpdates(_0x227e80[_0x840f('0x4d')],null))[_0x840f('0x28')](respondWithResult(_0x1dc164,null))[_0x840f('0x48')](handleError(_0x1dc164,null));};exports[_0x840f('0x29')]=function(_0x247875,_0x4bf215){return db['ChatGroup'][_0x840f('0x4e')]({'where':{'id':_0x247875['params']['id']}})[_0x840f('0x28')](handleEntityNotFound(_0x4bf215,null))[_0x840f('0x28')](removeEntity(_0x4bf215,null))[_0x840f('0x48')](handleError(_0x4bf215,null));};exports[_0x840f('0x4f')]=function(_0x15d6a9,_0x12e969){return db['ChatGroup'][_0x840f('0x4f')]()[_0x840f('0x28')](respondWithResult(_0x12e969,null))[_0x840f('0x48')](handleError(_0x12e969,null));};exports[_0x840f('0x50')]=function(_0x148c2b,_0x31e44f,_0x3a621b){return db[_0x840f('0x51')][_0x840f('0x24')]({'where':{'ChatGroupId':_0x148c2b[_0x840f('0x4a')]['id'],'ToId':_0x148c2b[_0x840f('0x52')]['id'],'read':![]}})[_0x840f('0x28')](function(_0x11275d){return{'id':_[_0x840f('0x53')](_0x148c2b[_0x840f('0x4a')]['id']),'count':_0x11275d};})[_0x840f('0x28')](respondWithResult(_0x31e44f,null))['catch'](handleError(_0x31e44f,null));};exports['addMembers']=function(_0x4e6ead,_0x8ebfec,_0x538d45){return db[_0x840f('0x44')][_0x840f('0x4e')]({'where':{'id':_0x4e6ead[_0x840f('0x4a')]['id']}})[_0x840f('0x28')](handleEntityNotFound(_0x8ebfec,null))[_0x840f('0x28')](function(_0x58cd4f){if(_0x58cd4f){return _0x58cd4f[_0x840f('0x54')](_0x4e6ead[_0x840f('0x4d')][_0x840f('0x55')],_[_0x840f('0x56')](_0x4e6ead[_0x840f('0x4d')],['ids','id'])||{});}})[_0x840f('0x28')](respondWithResult(_0x8ebfec,null))[_0x840f('0x48')](handleError(_0x8ebfec,null));};exports[_0x840f('0x57')]=function(_0x43c8f5,_0x1bdb8c,_0x30742){var _0x52673a={};var _0x41561b={};var _0xf98d96;var _0x44c072;return db[_0x840f('0x44')][_0x840f('0x58')]({'where':{'id':_0x43c8f5['params']['id']}})[_0x840f('0x28')](handleEntityNotFound(_0x1bdb8c,null))[_0x840f('0x28')](function(_0x2b934e){if(_0x2b934e){_0xf98d96=_0x2b934e;_0x41561b[_0x840f('0x33')]=_[_0x840f('0x4b')](db[_0x840f('0x59')][_0x840f('0x2f')]);_0x41561b[_0x840f('0x34')]=_[_0x840f('0x4b')](_0x43c8f5['query']);_0x41561b[_0x840f('0x35')]=_[_0x840f('0x36')](_0x41561b[_0x840f('0x33')],_0x41561b[_0x840f('0x34')]);_0x52673a[_0x840f('0x38')]=_[_0x840f('0x36')](_0x41561b[_0x840f('0x33')],qs['fields'](_0x43c8f5['query'][_0x840f('0x37')]));_0x52673a[_0x840f('0x38')]=_0x52673a['attributes']['length']?_0x52673a[_0x840f('0x38')]:_0x41561b[_0x840f('0x33')];_0x52673a[_0x840f('0x3c')]=qs[_0x840f('0x3d')](_0x43c8f5[_0x840f('0x34')][_0x840f('0x3d')]);_0x52673a[_0x840f('0x40')]=qs['filters'](_[_0x840f('0x3e')](_0x43c8f5[_0x840f('0x34')],_0x41561b['filters']));if(_0x43c8f5[_0x840f('0x34')][_0x840f('0x3f')]){_0x52673a[_0x840f('0x40')]=_[_0x840f('0x41')](_0x52673a[_0x840f('0x40')],{'$or':_[_0x840f('0x2e')](_0x52673a[_0x840f('0x38')],function(_0x3fe6bf){var _0x1ecc51={};_0x1ecc51[_0x3fe6bf]={'$like':'%'+_0x43c8f5[_0x840f('0x34')]['filter']+'%'};return _0x1ecc51;})});}_0x52673a=_[_0x840f('0x41')]({},_0x52673a,_0x43c8f5['options']);return _0xf98d96['getMembers'](_0x52673a);}})[_0x840f('0x28')](function(_0x47d308){if(_0x47d308){_0x44c072=_0x47d308['length'];if(!_0x43c8f5[_0x840f('0x34')][_0x840f('0x3a')](_0x840f('0x3b'))){_0x52673a[_0x840f('0x23')]=qs[_0x840f('0x23')](_0x43c8f5[_0x840f('0x34')][_0x840f('0x23')]);_0x52673a['offset']=qs[_0x840f('0x21')](_0x43c8f5[_0x840f('0x34')]['offset']);}return _0xf98d96['getMembers'](_0x52673a);}})[_0x840f('0x28')](function(_0x512943){if(_0x512943){return _0x512943?{'count':_0x44c072,'rows':_0x512943}:null;}})[_0x840f('0x28')](respondWithResult(_0x1bdb8c,null))[_0x840f('0x48')](handleError(_0x1bdb8c,null));};exports['removeMembers']=function(_0x3e7781,_0x5c7f65,_0xdfd21f){return db['ChatGroup'][_0x840f('0x4e')]({'where':{'id':_0x3e7781[_0x840f('0x4a')]['id']}})[_0x840f('0x28')](handleEntityNotFound(_0x5c7f65,null))[_0x840f('0x28')](function(_0x1aa33b){if(_0x1aa33b){return _0x1aa33b[_0x840f('0x5a')](_0x3e7781[_0x840f('0x34')][_0x840f('0x55')]);}})['then'](respondWithStatusCode(_0x5c7f65,null))[_0x840f('0x48')](handleError(_0x5c7f65,null));};exports[_0x840f('0x5b')]=function(_0x1a4932,_0x3976c2,_0x524a0d){if(_0x1a4932[_0x840f('0x4d')]['id']){delete _0x1a4932[_0x840f('0x4d')]['id'];}return db[_0x840f('0x44')]['find']({'where':{'id':_0x1a4932[_0x840f('0x4a')]['id']}})[_0x840f('0x28')](handleEntityNotFound(_0x3976c2,null))['then'](function(_0x30dc0b){if(_0x30dc0b){_0x1a4932[_0x840f('0x4d')][_0x840f('0x5c')]=_0x30dc0b['id'];return db[_0x840f('0x51')]['create'](_0x1a4932[_0x840f('0x4d')]);}})[_0x840f('0x28')](respondWithResult(_0x3976c2,null))[_0x840f('0x48')](handleError(_0x3976c2,null));};exports['getMessages']=function(_0x2e93d0,_0x1a0d44,_0x337a7f){var _0x19417c={};var _0x35d7eb={};var _0x3e3c7a;var _0x2bba51;return db[_0x840f('0x44')]['findOne']({'where':{'id':_0x2e93d0['params']['id']}})[_0x840f('0x28')](handleEntityNotFound(_0x1a0d44,null))[_0x840f('0x28')](function(_0x20592a){if(_0x20592a){_0x3e3c7a=_0x20592a;_0x35d7eb[_0x840f('0x33')]=_[_0x840f('0x4b')](db[_0x840f('0x51')][_0x840f('0x2f')]);_0x35d7eb[_0x840f('0x34')]=_[_0x840f('0x4b')](_0x2e93d0[_0x840f('0x34')]);_0x35d7eb[_0x840f('0x35')]=_['intersection'](_0x35d7eb[_0x840f('0x33')],_0x35d7eb['query']);_0x19417c[_0x840f('0x38')]=_[_0x840f('0x36')](_0x35d7eb[_0x840f('0x33')],qs['fields'](_0x2e93d0[_0x840f('0x34')]['fields']));_0x19417c[_0x840f('0x38')]=_0x19417c['attributes'][_0x840f('0x39')]?_0x19417c['attributes']:_0x35d7eb['model'];_0x19417c['order']=qs[_0x840f('0x3d')](_0x2e93d0[_0x840f('0x34')]['sort']);_0x19417c[_0x840f('0x40')]=qs[_0x840f('0x35')](_[_0x840f('0x3e')](_0x2e93d0[_0x840f('0x34')],_0x35d7eb['filters']));if(_0x2e93d0[_0x840f('0x34')][_0x840f('0x3f')]){_0x19417c[_0x840f('0x40')]=_[_0x840f('0x41')](_0x19417c[_0x840f('0x40')],{'$or':_[_0x840f('0x2e')](_0x19417c['attributes'],function(_0x55ca47){var _0xd87d5d={};_0xd87d5d[_0x55ca47]={'$like':'%'+_0x2e93d0[_0x840f('0x34')][_0x840f('0x3f')]+'%'};return _0xd87d5d;})});}if(_0x2e93d0['query'][_0x840f('0x5d')]){var _0x223317=_0x2e93d0[_0x840f('0x34')][_0x840f('0x5d')][_0x840f('0x5e')](',');var _0x46bda9={};_0x46bda9[_0x223317[0x0]]={'$gte':moment(_0x223317[0x1])[_0x840f('0x5f')](_0x840f('0x60'))};_0x19417c[_0x840f('0x40')]=_[_0x840f('0x41')](_0x19417c[_0x840f('0x40')],_0x46bda9);}_0x19417c=_[_0x840f('0x41')]({},_0x19417c,_0x2e93d0[_0x840f('0x43')]);return _0x3e3c7a[_0x840f('0x61')](_0x19417c);}})[_0x840f('0x28')](function(_0x5ca88b){if(_0x5ca88b){_0x2bba51=_0x5ca88b[_0x840f('0x39')];if(!_0x2e93d0[_0x840f('0x34')][_0x840f('0x3a')](_0x840f('0x3b'))){_0x19417c[_0x840f('0x23')]=qs[_0x840f('0x23')](_0x2e93d0[_0x840f('0x34')][_0x840f('0x23')]);_0x19417c['offset']=qs[_0x840f('0x21')](_0x2e93d0[_0x840f('0x34')][_0x840f('0x21')]);}return _0x3e3c7a[_0x840f('0x61')](_0x19417c);}})['then'](function(_0x2527ff){if(_0x2527ff){return _0x2527ff?{'count':_0x2bba51,'rows':_0x2527ff}:null;}})['then'](respondWithResult(_0x1a0d44,null))[_0x840f('0x48')](handleError(_0x1a0d44,null));}; \ No newline at end of file +var _0xb6be=['destroy','error','name','map','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','ChatGroup','include','findAll','rows','show','includeAll','find','catch','create','body','update','params','describe','toInteger','addMembers','ids','omit','getMembers','User','order','removeMembers','addMessage','getMessages','findOne','$gte','split','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','end','offset','limit','count','status','set','Content-Range','apply','reject','save','then'];(function(_0x5efa14,_0x470ee0){var _0x580121=function(_0xa354b4){while(--_0xa354b4){_0x5efa14['push'](_0x5efa14['shift']());}};_0x580121(++_0x470ee0);}(_0xb6be,0x141));var _0xeb6b=function(_0x4bd06e,_0x593701){_0x4bd06e=_0x4bd06e-0x0;var _0x85ebb=_0xb6be[_0x4bd06e];return _0x85ebb;};'use strict';var emlformat=require(_0xeb6b('0x0'));var rimraf=require(_0xeb6b('0x1'));var zipdir=require(_0xeb6b('0x2'));var jsonpatch=require(_0xeb6b('0x3'));var rp=require(_0xeb6b('0x4'));var moment=require('moment');var BPromise=require(_0xeb6b('0x5'));var Mustache=require(_0xeb6b('0x6'));var util=require(_0xeb6b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xeb6b('0x8'));var ejs=require(_0xeb6b('0x9'));var fs=require('fs');var fs_extra=require(_0xeb6b('0xa'));var _=require(_0xeb6b('0xb'));var squel=require(_0xeb6b('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xeb6b('0xd'));var toCsv=require('to-csv');var querystring=require(_0xeb6b('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xeb6b('0xf'));var as=require(_0xeb6b('0x10'));var hardwareService=require(_0xeb6b('0x11'));var logger=require(_0xeb6b('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xeb6b('0x13'));var db=require(_0xeb6b('0x14'))['db'];config[_0xeb6b('0x15')]=_[_0xeb6b('0x16')](config[_0xeb6b('0x15')],{'host':_0xeb6b('0x17'),'port':0x18eb});var socket=require(_0xeb6b('0x18'))(new Redis(config[_0xeb6b('0x15')]));require(_0xeb6b('0x19'))[_0xeb6b('0x1a')](socket);function respondWithStatusCode(_0x1c3ce0,_0x49d031){_0x49d031=_0x49d031||0xcc;return function(_0x4ddaea){if(_0x4ddaea){return _0x1c3ce0[_0xeb6b('0x1b')](_0x49d031);}return _0x1c3ce0['status'](_0x49d031)[_0xeb6b('0x1c')]();};}function respondWithResult(_0x4f8ba6,_0x40a23e){_0x40a23e=_0x40a23e||0xc8;return function(_0x373854){if(_0x373854){return _0x4f8ba6['status'](_0x40a23e)['json'](_0x373854);}};}function respondWithFilteredResult(_0x286b18,_0x5cb770){return function(_0x425c90){if(_0x425c90){var _0x58cfb6=typeof _0x5cb770[_0xeb6b('0x1d')]==='undefined'&&typeof _0x5cb770[_0xeb6b('0x1e')]==='undefined';var _0x258703=_0x425c90['count'];var _0x5a2100=_0x58cfb6?0x0:_0x5cb770['offset'];var _0x34ac6f=_0x58cfb6?_0x425c90[_0xeb6b('0x1f')]:_0x5cb770[_0xeb6b('0x1d')]+_0x5cb770[_0xeb6b('0x1e')];var _0x34343f;if(_0x34ac6f>=_0x258703){_0x34ac6f=_0x258703;_0x34343f=0xc8;}else{_0x34343f=0xce;}_0x286b18[_0xeb6b('0x20')](_0x34343f);return _0x286b18[_0xeb6b('0x21')](_0xeb6b('0x22'),_0x5a2100+'-'+_0x34ac6f+'/'+_0x258703)['json'](_0x425c90);}return null;};}function patchUpdates(_0x1c63a8){return function(_0x4ca340){try{jsonpatch[_0xeb6b('0x23')](_0x4ca340,_0x1c63a8,!![]);}catch(_0x20e021){return BPromise[_0xeb6b('0x24')](_0x20e021);}return _0x4ca340[_0xeb6b('0x25')]();};}function saveUpdates(_0x35c988,_0xf9d3d){return function(_0x2ca1e0){if(_0x2ca1e0){return _0x2ca1e0['update'](_0x35c988)[_0xeb6b('0x26')](function(_0x50f60a){return _0x50f60a;});}return null;};}function removeEntity(_0x54ba40,_0x2cc6f3){return function(_0x1bb3e8){if(_0x1bb3e8){return _0x1bb3e8[_0xeb6b('0x27')]()[_0xeb6b('0x26')](function(){_0x54ba40[_0xeb6b('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f4c57,_0x441d32){return function(_0x20ceb2){if(!_0x20ceb2){_0x4f4c57[_0xeb6b('0x1b')](0x194);}return _0x20ceb2;};}function handleError(_0x48e55e,_0x296247){_0x296247=_0x296247||0x1f4;return function(_0x5caf77){logger[_0xeb6b('0x28')](_0x5caf77['stack']);if(_0x5caf77[_0xeb6b('0x29')]){delete _0x5caf77['name'];}_0x48e55e[_0xeb6b('0x20')](_0x296247)['send'](_0x5caf77);};}exports['index']=function(_0xc16b66,_0x1b39d5){var _0x34f1c5={},_0x5a6ec9={},_0x3e9c80={'count':0x0,'rows':[]};var _0xe93ad4=_[_0xeb6b('0x2a')](db['ChatGroup'][_0xeb6b('0x2b')],function(_0x171e39){return{'name':_0x171e39[_0xeb6b('0x2c')],'type':_0x171e39[_0xeb6b('0x2d')][_0xeb6b('0x2e')]};});_0x5a6ec9['model']=_[_0xeb6b('0x2a')](_0xe93ad4,'name');_0x5a6ec9['query']=_[_0xeb6b('0x2f')](_0xc16b66['query']);_0x5a6ec9[_0xeb6b('0x30')]=_[_0xeb6b('0x31')](_0x5a6ec9[_0xeb6b('0x32')],_0x5a6ec9[_0xeb6b('0x33')]);_0x34f1c5[_0xeb6b('0x34')]=_['intersection'](_0x5a6ec9['model'],qs[_0xeb6b('0x35')](_0xc16b66[_0xeb6b('0x33')][_0xeb6b('0x35')]));_0x34f1c5[_0xeb6b('0x34')]=_0x34f1c5[_0xeb6b('0x34')][_0xeb6b('0x36')]?_0x34f1c5[_0xeb6b('0x34')]:_0x5a6ec9[_0xeb6b('0x32')];if(!_0xc16b66['query'][_0xeb6b('0x37')](_0xeb6b('0x38'))){_0x34f1c5[_0xeb6b('0x1e')]=qs[_0xeb6b('0x1e')](_0xc16b66[_0xeb6b('0x33')]['limit']);_0x34f1c5['offset']=qs[_0xeb6b('0x1d')](_0xc16b66['query'][_0xeb6b('0x1d')]);}_0x34f1c5['order']=qs[_0xeb6b('0x39')](_0xc16b66[_0xeb6b('0x33')][_0xeb6b('0x39')]);_0x34f1c5[_0xeb6b('0x3a')]=qs[_0xeb6b('0x30')](_[_0xeb6b('0x3b')](_0xc16b66[_0xeb6b('0x33')],_0x5a6ec9[_0xeb6b('0x30')]),_0xe93ad4);if(_0xc16b66['query']['filter']){_0x34f1c5[_0xeb6b('0x3a')]=_[_0xeb6b('0x3c')](_0x34f1c5['where'],{'$or':_['map'](_0xe93ad4,function(_0x235d0c){if(_0x235d0c[_0xeb6b('0x2d')]!==_0xeb6b('0x3d')){var _0x4debc4={};_0x4debc4[_0x235d0c[_0xeb6b('0x29')]]={'$like':'%'+_0xc16b66[_0xeb6b('0x33')][_0xeb6b('0x3e')]+'%'};return _0x4debc4;}})});}_0x34f1c5=_[_0xeb6b('0x3c')]({},_0x34f1c5,_0xc16b66[_0xeb6b('0x3f')]);var _0x5aa2bb={'where':_0x34f1c5[_0xeb6b('0x3a')]};return db[_0xeb6b('0x40')][_0xeb6b('0x1f')](_0x5aa2bb)[_0xeb6b('0x26')](function(_0x3a887c){_0x3e9c80[_0xeb6b('0x1f')]=_0x3a887c;if(_0xc16b66[_0xeb6b('0x33')]['includeAll']){_0x34f1c5[_0xeb6b('0x41')]=[{'all':!![]}];}return db[_0xeb6b('0x40')][_0xeb6b('0x42')](_0x34f1c5);})[_0xeb6b('0x26')](function(_0x4f4f4c){_0x3e9c80[_0xeb6b('0x43')]=_0x4f4f4c;return _0x3e9c80;})['then'](respondWithFilteredResult(_0x1b39d5,_0x34f1c5))['catch'](handleError(_0x1b39d5,null));};exports[_0xeb6b('0x44')]=function(_0x2cf9b5,_0x273b56){var _0x5b32dc={'raw':!![],'where':{'id':_0x2cf9b5['params']['id']}},_0x48972b={};_0x48972b[_0xeb6b('0x32')]=_['keys'](db['ChatGroup'][_0xeb6b('0x2b')]);_0x48972b[_0xeb6b('0x33')]=_[_0xeb6b('0x2f')](_0x2cf9b5['query']);_0x48972b[_0xeb6b('0x30')]=_['intersection'](_0x48972b[_0xeb6b('0x32')],_0x48972b['query']);_0x5b32dc['attributes']=_[_0xeb6b('0x31')](_0x48972b[_0xeb6b('0x32')],qs['fields'](_0x2cf9b5[_0xeb6b('0x33')]['fields']));_0x5b32dc[_0xeb6b('0x34')]=_0x5b32dc[_0xeb6b('0x34')][_0xeb6b('0x36')]?_0x5b32dc['attributes']:_0x48972b[_0xeb6b('0x32')];if(_0x2cf9b5['query'][_0xeb6b('0x45')]){_0x5b32dc[_0xeb6b('0x41')]=[{'all':!![]}];}_0x5b32dc=_[_0xeb6b('0x3c')]({},_0x5b32dc,_0x2cf9b5[_0xeb6b('0x3f')]);return db[_0xeb6b('0x40')][_0xeb6b('0x46')](_0x5b32dc)['then'](handleEntityNotFound(_0x273b56,null))[_0xeb6b('0x26')](respondWithResult(_0x273b56,null))[_0xeb6b('0x47')](handleError(_0x273b56,null));};exports[_0xeb6b('0x48')]=function(_0x105c03,_0xc0f572){return db[_0xeb6b('0x40')]['create'](_0x105c03[_0xeb6b('0x49')],{})[_0xeb6b('0x26')](respondWithResult(_0xc0f572,0xc9))['catch'](handleError(_0xc0f572,null));};exports[_0xeb6b('0x4a')]=function(_0x44ec46,_0x2a43bc){if(_0x44ec46[_0xeb6b('0x49')]['id']){delete _0x44ec46['body']['id'];}return db[_0xeb6b('0x40')][_0xeb6b('0x46')]({'where':{'id':_0x44ec46[_0xeb6b('0x4b')]['id']}})[_0xeb6b('0x26')](handleEntityNotFound(_0x2a43bc,null))[_0xeb6b('0x26')](saveUpdates(_0x44ec46[_0xeb6b('0x49')],null))[_0xeb6b('0x26')](respondWithResult(_0x2a43bc,null))[_0xeb6b('0x47')](handleError(_0x2a43bc,null));};exports[_0xeb6b('0x27')]=function(_0x5ee0a0,_0x5d12e3){return db[_0xeb6b('0x40')][_0xeb6b('0x46')]({'where':{'id':_0x5ee0a0[_0xeb6b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5d12e3,null))[_0xeb6b('0x26')](removeEntity(_0x5d12e3,null))['catch'](handleError(_0x5d12e3,null));};exports[_0xeb6b('0x4c')]=function(_0x35c187,_0x2c9841){return db['ChatGroup'][_0xeb6b('0x4c')]()[_0xeb6b('0x26')](respondWithResult(_0x2c9841,null))[_0xeb6b('0x47')](handleError(_0x2c9841,null));};exports['getUnread']=function(_0x3df0a3,_0x115ee3,_0x17f2e0){return db['ChatInternalMessage'][_0xeb6b('0x1f')]({'where':{'ChatGroupId':_0x3df0a3[_0xeb6b('0x4b')]['id'],'ToId':_0x3df0a3['user']['id'],'read':![]}})[_0xeb6b('0x26')](function(_0x1a33c6){return{'id':_[_0xeb6b('0x4d')](_0x3df0a3[_0xeb6b('0x4b')]['id']),'count':_0x1a33c6};})[_0xeb6b('0x26')](respondWithResult(_0x115ee3,null))[_0xeb6b('0x47')](handleError(_0x115ee3,null));};exports['addMembers']=function(_0x3b5b0d,_0x5c2e70,_0x2bd1cd){return db[_0xeb6b('0x40')][_0xeb6b('0x46')]({'where':{'id':_0x3b5b0d[_0xeb6b('0x4b')]['id']}})[_0xeb6b('0x26')](handleEntityNotFound(_0x5c2e70,null))[_0xeb6b('0x26')](function(_0x3b27b8){if(_0x3b27b8){return _0x3b27b8[_0xeb6b('0x4e')](_0x3b5b0d[_0xeb6b('0x49')][_0xeb6b('0x4f')],_[_0xeb6b('0x50')](_0x3b5b0d[_0xeb6b('0x49')],[_0xeb6b('0x4f'),'id'])||{});}})[_0xeb6b('0x26')](respondWithResult(_0x5c2e70,null))[_0xeb6b('0x47')](handleError(_0x5c2e70,null));};exports[_0xeb6b('0x51')]=function(_0x34ca1e,_0x4a2760,_0x3f76de){var _0x5c2d0b={};var _0x1d85f4={};var _0x569722;var _0x59e762;return db['ChatGroup']['findOne']({'where':{'id':_0x34ca1e[_0xeb6b('0x4b')]['id']}})[_0xeb6b('0x26')](handleEntityNotFound(_0x4a2760,null))[_0xeb6b('0x26')](function(_0x464ad7){if(_0x464ad7){_0x569722=_0x464ad7;_0x1d85f4[_0xeb6b('0x32')]=_[_0xeb6b('0x2f')](db[_0xeb6b('0x52')][_0xeb6b('0x2b')]);_0x1d85f4[_0xeb6b('0x33')]=_[_0xeb6b('0x2f')](_0x34ca1e[_0xeb6b('0x33')]);_0x1d85f4[_0xeb6b('0x30')]=_[_0xeb6b('0x31')](_0x1d85f4[_0xeb6b('0x32')],_0x1d85f4['query']);_0x5c2d0b[_0xeb6b('0x34')]=_[_0xeb6b('0x31')](_0x1d85f4[_0xeb6b('0x32')],qs[_0xeb6b('0x35')](_0x34ca1e[_0xeb6b('0x33')][_0xeb6b('0x35')]));_0x5c2d0b[_0xeb6b('0x34')]=_0x5c2d0b[_0xeb6b('0x34')]['length']?_0x5c2d0b['attributes']:_0x1d85f4[_0xeb6b('0x32')];_0x5c2d0b[_0xeb6b('0x53')]=qs['sort'](_0x34ca1e[_0xeb6b('0x33')][_0xeb6b('0x39')]);_0x5c2d0b[_0xeb6b('0x3a')]=qs[_0xeb6b('0x30')](_[_0xeb6b('0x3b')](_0x34ca1e[_0xeb6b('0x33')],_0x1d85f4[_0xeb6b('0x30')]));if(_0x34ca1e[_0xeb6b('0x33')][_0xeb6b('0x3e')]){_0x5c2d0b[_0xeb6b('0x3a')]=_[_0xeb6b('0x3c')](_0x5c2d0b['where'],{'$or':_[_0xeb6b('0x2a')](_0x5c2d0b[_0xeb6b('0x34')],function(_0x15d06f){var _0x33c0c2={};_0x33c0c2[_0x15d06f]={'$like':'%'+_0x34ca1e[_0xeb6b('0x33')][_0xeb6b('0x3e')]+'%'};return _0x33c0c2;})});}_0x5c2d0b=_[_0xeb6b('0x3c')]({},_0x5c2d0b,_0x34ca1e[_0xeb6b('0x3f')]);return _0x569722[_0xeb6b('0x51')](_0x5c2d0b);}})[_0xeb6b('0x26')](function(_0x5cd385){if(_0x5cd385){_0x59e762=_0x5cd385['length'];if(!_0x34ca1e[_0xeb6b('0x33')]['hasOwnProperty'](_0xeb6b('0x38'))){_0x5c2d0b[_0xeb6b('0x1e')]=qs['limit'](_0x34ca1e['query'][_0xeb6b('0x1e')]);_0x5c2d0b['offset']=qs[_0xeb6b('0x1d')](_0x34ca1e[_0xeb6b('0x33')]['offset']);}return _0x569722[_0xeb6b('0x51')](_0x5c2d0b);}})['then'](function(_0x3a8590){if(_0x3a8590){return _0x3a8590?{'count':_0x59e762,'rows':_0x3a8590}:null;}})['then'](respondWithResult(_0x4a2760,null))[_0xeb6b('0x47')](handleError(_0x4a2760,null));};exports[_0xeb6b('0x54')]=function(_0x3352ce,_0x46f69f,_0x1e0a10){return db[_0xeb6b('0x40')][_0xeb6b('0x46')]({'where':{'id':_0x3352ce[_0xeb6b('0x4b')]['id']}})[_0xeb6b('0x26')](handleEntityNotFound(_0x46f69f,null))[_0xeb6b('0x26')](function(_0x24f2db){if(_0x24f2db){return _0x24f2db[_0xeb6b('0x54')](_0x3352ce[_0xeb6b('0x33')]['ids']);}})[_0xeb6b('0x26')](respondWithStatusCode(_0x46f69f,null))[_0xeb6b('0x47')](handleError(_0x46f69f,null));};exports[_0xeb6b('0x55')]=function(_0x462b81,_0x1d5dd4,_0x5e3759){if(_0x462b81[_0xeb6b('0x49')]['id']){delete _0x462b81[_0xeb6b('0x49')]['id'];}return db['ChatGroup'][_0xeb6b('0x46')]({'where':{'id':_0x462b81[_0xeb6b('0x4b')]['id']}})[_0xeb6b('0x26')](handleEntityNotFound(_0x1d5dd4,null))['then'](function(_0x220fc1){if(_0x220fc1){_0x462b81['body']['ChatGroupId']=_0x220fc1['id'];return db['ChatInternalMessage'][_0xeb6b('0x48')](_0x462b81[_0xeb6b('0x49')]);}})[_0xeb6b('0x26')](respondWithResult(_0x1d5dd4,null))[_0xeb6b('0x47')](handleError(_0x1d5dd4,null));};exports[_0xeb6b('0x56')]=function(_0x3bf135,_0x3e27a8,_0xe624fd){var _0xdb5070={};var _0x4bc246={};var _0x492430;var _0x32af51;return db[_0xeb6b('0x40')][_0xeb6b('0x57')]({'where':{'id':_0x3bf135[_0xeb6b('0x4b')]['id']}})[_0xeb6b('0x26')](handleEntityNotFound(_0x3e27a8,null))[_0xeb6b('0x26')](function(_0x3d0a5e){if(_0x3d0a5e){_0x492430=_0x3d0a5e;_0x4bc246[_0xeb6b('0x32')]=_[_0xeb6b('0x2f')](db['ChatInternalMessage'][_0xeb6b('0x2b')]);_0x4bc246[_0xeb6b('0x33')]=_['keys'](_0x3bf135[_0xeb6b('0x33')]);_0x4bc246[_0xeb6b('0x30')]=_[_0xeb6b('0x31')](_0x4bc246[_0xeb6b('0x32')],_0x4bc246[_0xeb6b('0x33')]);_0xdb5070[_0xeb6b('0x34')]=_[_0xeb6b('0x31')](_0x4bc246[_0xeb6b('0x32')],qs[_0xeb6b('0x35')](_0x3bf135[_0xeb6b('0x33')]['fields']));_0xdb5070['attributes']=_0xdb5070['attributes'][_0xeb6b('0x36')]?_0xdb5070[_0xeb6b('0x34')]:_0x4bc246[_0xeb6b('0x32')];_0xdb5070[_0xeb6b('0x53')]=qs[_0xeb6b('0x39')](_0x3bf135[_0xeb6b('0x33')]['sort']);_0xdb5070[_0xeb6b('0x3a')]=qs[_0xeb6b('0x30')](_[_0xeb6b('0x3b')](_0x3bf135['query'],_0x4bc246[_0xeb6b('0x30')]));if(_0x3bf135['query'][_0xeb6b('0x3e')]){_0xdb5070[_0xeb6b('0x3a')]=_[_0xeb6b('0x3c')](_0xdb5070[_0xeb6b('0x3a')],{'$or':_[_0xeb6b('0x2a')](_0xdb5070[_0xeb6b('0x34')],function(_0x37824c){var _0x534e78={};_0x534e78[_0x37824c]={'$like':'%'+_0x3bf135[_0xeb6b('0x33')][_0xeb6b('0x3e')]+'%'};return _0x534e78;})});}if(_0x3bf135[_0xeb6b('0x33')]['$gte']){var _0x245d17=_0x3bf135[_0xeb6b('0x33')][_0xeb6b('0x58')][_0xeb6b('0x59')](',');var _0x466b0f={};_0x466b0f[_0x245d17[0x0]]={'$gte':moment(_0x245d17[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0xdb5070[_0xeb6b('0x3a')]=_[_0xeb6b('0x3c')](_0xdb5070[_0xeb6b('0x3a')],_0x466b0f);}_0xdb5070=_[_0xeb6b('0x3c')]({},_0xdb5070,_0x3bf135[_0xeb6b('0x3f')]);return _0x492430['getMessages'](_0xdb5070);}})['then'](function(_0xb2e145){if(_0xb2e145){_0x32af51=_0xb2e145[_0xeb6b('0x36')];if(!_0x3bf135['query'][_0xeb6b('0x37')]('nolimit')){_0xdb5070['limit']=qs['limit'](_0x3bf135[_0xeb6b('0x33')][_0xeb6b('0x1e')]);_0xdb5070[_0xeb6b('0x1d')]=qs[_0xeb6b('0x1d')](_0x3bf135[_0xeb6b('0x33')][_0xeb6b('0x1d')]);}return _0x492430[_0xeb6b('0x56')](_0xdb5070);}})[_0xeb6b('0x26')](function(_0x4c95df){if(_0x4c95df){return _0x4c95df?{'count':_0x32af51,'rows':_0x4c95df}:null;}})[_0xeb6b('0x26')](respondWithResult(_0x3e27a8,null))[_0xeb6b('0x47')](handleError(_0x3e27a8,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 3dd021b..eaee435 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 _0x1ddf=['emit','hasOwnProperty','hook','events','../../mysqldb','save','update','remove'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x1ddf,0x1ab));var _0xf1dd=function(_0x40a4ee,_0x515400){_0x40a4ee=_0x40a4ee-0x0;var _0x57c3cc=_0x1ddf[_0x40a4ee];return _0x57c3cc;};'use strict';var EventEmitter=require(_0xf1dd('0x0'));var ChatGroup=require(_0xf1dd('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf1dd('0x2'),'afterUpdate':_0xf1dd('0x3'),'afterDestroy':_0xf1dd('0x4')};function emitEvent(_0x52a8d6){return function(_0x53271b,_0x370ac3,_0x17f7da){ChatGroupEvents[_0xf1dd('0x5')](_0x52a8d6+':'+_0x53271b['id'],_0x53271b);ChatGroupEvents[_0xf1dd('0x5')](_0x52a8d6,_0x53271b);_0x17f7da(null);};}for(var e in events){if(events[_0xf1dd('0x6')](e)){var event=events[e];ChatGroup[_0xf1dd('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x394d=['update','emit','hook','events','save'];(function(_0xf20f37,_0x435fb0){var _0x5185dd=function(_0x4e56ad){while(--_0x4e56ad){_0xf20f37['push'](_0xf20f37['shift']());}};_0x5185dd(++_0x435fb0);}(_0x394d,0x12a));var _0xd394=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x394d[_0x565ed7];return _0x183ad7;};'use strict';var EventEmitter=require(_0xd394('0x0'));var ChatGroup=require('../../mysqldb')['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd394('0x1'),'afterUpdate':_0xd394('0x2'),'afterDestroy':'remove'};function emitEvent(_0x410368){return function(_0x499c7c,_0x278b36,_0x5c765b){ChatGroupEvents['emit'](_0x410368+':'+_0x499c7c['id'],_0x499c7c);ChatGroupEvents[_0xd394('0x3')](_0x410368,_0x499c7c);_0x5c765b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xd394('0x4')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 488a2d3..368b288 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 _0x8b1c=['rimraf','../../config/environment','define','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5118ed,_0x5815e6){var _0x4855da=function(_0x46f834){while(--_0x46f834){_0x5118ed['push'](_0x5118ed['shift']());}};_0x4855da(++_0x5815e6);}(_0x8b1c,0xf6));var _0xc8b1=function(_0x32cd82,_0x545328){_0x32cd82=_0x32cd82-0x0;var _0x52af6f=_0x8b1c[_0x32cd82];return _0x52af6f;};'use strict';var _=require(_0xc8b1('0x0'));var util=require(_0xc8b1('0x1'));var logger=require(_0xc8b1('0x2'))(_0xc8b1('0x3'));var moment=require(_0xc8b1('0x4'));var BPromise=require(_0xc8b1('0x5'));var rp=require(_0xc8b1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc8b1('0x7'));var config=require(_0xc8b1('0x8'));var attributes=require('./chatGroup.attributes');module['exports']=function(_0xf9a2e2,_0x5b8db3){return _0xf9a2e2[_0xc8b1('0x9')]('ChatGroup',attributes,{'tableName':_0xc8b1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e48=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./chatGroup.attributes','exports','define','ChatGroup'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x0e48,0x120));var _0x80e4=function(_0x9fe87c,_0x1e9f2c){_0x9fe87c=_0x9fe87c-0x0;var _0x4822c5=_0x0e48[_0x9fe87c];return _0x4822c5;};'use strict';var _=require(_0x80e4('0x0'));var util=require(_0x80e4('0x1'));var logger=require(_0x80e4('0x2'))('api');var moment=require(_0x80e4('0x3'));var BPromise=require(_0x80e4('0x4'));var rp=require(_0x80e4('0x5'));var fs=require('fs');var path=require(_0x80e4('0x6'));var rimraf=require(_0x80e4('0x7'));var config=require('../../config/environment');var attributes=require(_0x80e4('0x8'));module[_0x80e4('0x9')]=function(_0x418f2a,_0x244386){return _0x418f2a[_0x80e4('0xa')](_0x80e4('0xb'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 55c4a64..83beb49 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 _0x38fb=['register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatGroup.socket'];(function(_0x33a308,_0x5ceed8){var _0x362c75=function(_0x16c5e1){while(--_0x16c5e1){_0x33a308['push'](_0x33a308['shift']());}};_0x362c75(++_0x5ceed8);}(_0x38fb,0x1b0));var _0xb38f=function(_0x802997,_0x5534a2){_0x802997=_0x802997-0x0;var _0x35c641=_0x38fb[_0x802997];return _0x35c641;};'use strict';var _=require(_0xb38f('0x0'));var util=require(_0xb38f('0x1'));var moment=require(_0xb38f('0x2'));var BPromise=require(_0xb38f('0x3'));var rs=require(_0xb38f('0x4'));var fs=require('fs');var Redis=require(_0xb38f('0x5'));var db=require(_0xb38f('0x6'))['db'];var utils=require(_0xb38f('0x7'));var logger=require(_0xb38f('0x8'))(_0xb38f('0x9'));var config=require(_0xb38f('0xa'));var jayson=require(_0xb38f('0xb'));var client=jayson[_0xb38f('0xc')][_0xb38f('0xd')]({'port':0x232a});config[_0xb38f('0xe')]=_[_0xb38f('0xf')](config[_0xb38f('0xe')],{'host':_0xb38f('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb38f('0xe')]));require(_0xb38f('0x11'))[_0xb38f('0x12')](socket);function respondWithRpcPromise(_0x5e037a,_0x3a5441,_0x1252b6){return new BPromise(function(_0xc17932,_0x331549){return client[_0xb38f('0x13')](_0x5e037a,_0x1252b6)[_0xb38f('0x14')](function(_0x3eb027){logger[_0xb38f('0x15')](_0xb38f('0x16'),_0x3a5441,_0xb38f('0x17'));logger[_0xb38f('0x18')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x3a5441,'request\x20sent',JSON['stringify'](_0x3eb027));if(_0x3eb027['error']){if(_0x3eb027[_0xb38f('0x19')][_0xb38f('0x1a')]===0x1f4){logger[_0xb38f('0x19')](_0xb38f('0x16'),_0x3a5441,_0x3eb027[_0xb38f('0x19')][_0xb38f('0x1b')]);return _0x331549(_0x3eb027[_0xb38f('0x19')][_0xb38f('0x1b')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x3a5441,_0x3eb027[_0xb38f('0x19')]['message']);return _0xc17932(_0x3eb027[_0xb38f('0x19')][_0xb38f('0x1b')]);}else{logger[_0xb38f('0x15')](_0xb38f('0x16'),_0x3a5441,_0xb38f('0x17'));_0xc17932(_0x3eb027[_0xb38f('0x1c')][_0xb38f('0x1b')]);}})[_0xb38f('0x1d')](function(_0x57c380){logger[_0xb38f('0x19')](_0xb38f('0x16'),_0x3a5441,_0x57c380);_0x331549(_0x57c380);});});} \ No newline at end of file +var _0x6b6d=['redis','defaults','localhost','socket.io-emitter','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x15a833,_0x5092d6){var _0x371593=function(_0x53b66b){while(--_0x53b66b){_0x15a833['push'](_0x15a833['shift']());}};_0x371593(++_0x5092d6);}(_0x6b6d,0xbd));var _0xd6b6=function(_0x4bb145,_0x3e7d33){_0x4bb145=_0x4bb145-0x0;var _0x4db596=_0x6b6d[_0x4bb145];return _0x4db596;};'use strict';var _=require(_0xd6b6('0x0'));var util=require(_0xd6b6('0x1'));var moment=require(_0xd6b6('0x2'));var BPromise=require(_0xd6b6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd6b6('0x4'));var db=require(_0xd6b6('0x5'))['db'];var utils=require(_0xd6b6('0x6'));var logger=require(_0xd6b6('0x7'))('rpc');var config=require(_0xd6b6('0x8'));var jayson=require(_0xd6b6('0x9'));var client=jayson[_0xd6b6('0xa')]['http']({'port':0x232a});config[_0xd6b6('0xb')]=_[_0xd6b6('0xc')](config[_0xd6b6('0xb')],{'host':_0xd6b6('0xd'),'port':0x18eb});var socket=require(_0xd6b6('0xe'))(new Redis(config[_0xd6b6('0xb')]));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0x362edc,_0x72ece2,_0x4d918d){return new BPromise(function(_0x3a5bf,_0x212d48){return client[_0xd6b6('0xf')](_0x362edc,_0x4d918d)[_0xd6b6('0x10')](function(_0x1d002b){logger[_0xd6b6('0x11')](_0xd6b6('0x12'),_0x72ece2,_0xd6b6('0x13'));logger[_0xd6b6('0x14')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x72ece2,_0xd6b6('0x13'),JSON[_0xd6b6('0x15')](_0x1d002b));if(_0x1d002b[_0xd6b6('0x16')]){if(_0x1d002b[_0xd6b6('0x16')]['code']===0x1f4){logger[_0xd6b6('0x16')](_0xd6b6('0x12'),_0x72ece2,_0x1d002b[_0xd6b6('0x16')][_0xd6b6('0x17')]);return _0x212d48(_0x1d002b[_0xd6b6('0x16')][_0xd6b6('0x17')]);}logger[_0xd6b6('0x16')](_0xd6b6('0x12'),_0x72ece2,_0x1d002b[_0xd6b6('0x16')][_0xd6b6('0x17')]);return _0x3a5bf(_0x1d002b[_0xd6b6('0x16')][_0xd6b6('0x17')]);}else{logger[_0xd6b6('0x11')](_0xd6b6('0x12'),_0x72ece2,_0xd6b6('0x13'));_0x3a5bf(_0x1d002b['result'][_0xd6b6('0x17')]);}})[_0xd6b6('0x18')](function(_0x13023b){logger[_0xd6b6('0x16')]('ChatGroup,\x20%s,\x20%s',_0x72ece2,_0x13023b);_0x212d48(_0x13023b);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 382c1ee..a74d961 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 _0x4d08=['chatGroup:','./chatGroup.events','save','remove','emit','register','length'];(function(_0x1d6302,_0x582df7){var _0x1f8f5c=function(_0xe4ddc2){while(--_0xe4ddc2){_0x1d6302['push'](_0x1d6302['shift']());}};_0x1f8f5c(++_0x582df7);}(_0x4d08,0x94));var _0x84d0=function(_0x10f68e,_0xf198ea){_0x10f68e=_0x10f68e-0x0;var _0x4c8372=_0x4d08[_0x10f68e];return _0x4c8372;};'use strict';var ChatGroupEvents=require(_0x84d0('0x0'));var events=[_0x84d0('0x1'),_0x84d0('0x2'),'update'];function createListener(_0x3036b6,_0x2392bd){return function(_0x584efe){_0x2392bd[_0x84d0('0x3')](_0x3036b6,_0x584efe);};}function removeListener(_0x4281d7,_0x445c6b){return function(){ChatGroupEvents['removeListener'](_0x4281d7,_0x445c6b);};}exports[_0x84d0('0x4')]=function(_0x66bf0e){for(var _0x329ef6=0x0,_0x118ef2=events[_0x84d0('0x5')];_0x329ef6<_0x118ef2;_0x329ef6++){var _0x268c7d=events[_0x329ef6];var _0x2f2397=createListener(_0x84d0('0x6')+_0x268c7d,_0x66bf0e);ChatGroupEvents['on'](_0x268c7d,_0x2f2397);}}; \ No newline at end of file +var _0xa016=['chatGroup:','save','remove','update','emit','removeListener','register','length'];(function(_0xe033e7,_0x561a6d){var _0x63031f=function(_0x246e1f){while(--_0x246e1f){_0xe033e7['push'](_0xe033e7['shift']());}};_0x63031f(++_0x561a6d);}(_0xa016,0x119));var _0x6a01=function(_0x42e328,_0x144e7a){_0x42e328=_0x42e328-0x0;var _0x10292f=_0xa016[_0x42e328];return _0x10292f;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x6a01('0x0'),_0x6a01('0x1'),_0x6a01('0x2')];function createListener(_0x362315,_0x5cc973){return function(_0x3f1ba9){_0x5cc973[_0x6a01('0x3')](_0x362315,_0x3f1ba9);};}function removeListener(_0x5ab575,_0x5961d2){return function(){ChatGroupEvents[_0x6a01('0x4')](_0x5ab575,_0x5961d2);};}exports[_0x6a01('0x5')]=function(_0x273c9e){for(var _0x48fa8f=0x0,_0x10b044=events[_0x6a01('0x6')];_0x48fa8f<_0x10b044;_0x48fa8f++){var _0x3dc5a2=events[_0x48fa8f];var _0x5c19ae=createListener(_0x6a01('0x7')+_0x3dc5a2,_0x273c9e);ChatGroupEvents['on'](_0x3dc5a2,_0x5c19ae);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 6752733..c5e4643 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 _0xf8c9=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMessage','put','update','destroy','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf8c9,0x106));var _0x9f8c=function(_0x47f71f,_0x152fd8){_0x47f71f=_0x47f71f-0x0;var _0x41e749=_0xf8c9[_0x47f71f];return _0x41e749;};'use strict';var multer=require(_0x9f8c('0x0'));var util=require(_0x9f8c('0x1'));var path=require(_0x9f8c('0x2'));var timeout=require(_0x9f8c('0x3'));var express=require(_0x9f8c('0x4'));var router=express[_0x9f8c('0x5')]();var fs_extra=require(_0x9f8c('0x6'));var auth=require(_0x9f8c('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9f8c('0x8'));router[_0x9f8c('0x9')]('/',auth[_0x9f8c('0xa')](),controller[_0x9f8c('0xb')]);router[_0x9f8c('0x9')](_0x9f8c('0xc'),auth['isAuthenticated'](),controller[_0x9f8c('0xd')]);router[_0x9f8c('0x9')](_0x9f8c('0xe'),auth[_0x9f8c('0xa')](),controller[_0x9f8c('0xf')]);router[_0x9f8c('0x9')]('/:id/unread',auth[_0x9f8c('0xa')](),controller[_0x9f8c('0x10')]);router[_0x9f8c('0x9')](_0x9f8c('0x11'),auth[_0x9f8c('0xa')](),controller[_0x9f8c('0x12')]);router[_0x9f8c('0x9')](_0x9f8c('0x13'),auth[_0x9f8c('0xa')](),controller[_0x9f8c('0x14')]);router[_0x9f8c('0x15')]('/',auth[_0x9f8c('0xa')](),controller[_0x9f8c('0x16')]);router['post'](_0x9f8c('0x11'),auth['isAuthenticated'](),controller['addMembers']);router[_0x9f8c('0x15')](_0x9f8c('0x13'),auth[_0x9f8c('0xa')](),controller[_0x9f8c('0x17')]);router[_0x9f8c('0x18')](_0x9f8c('0xe'),auth[_0x9f8c('0xa')](),controller[_0x9f8c('0x19')]);router['delete']('/:id',auth[_0x9f8c('0xa')](),controller[_0x9f8c('0x1a')]);router[_0x9f8c('0x1b')]('/:id/members',auth[_0x9f8c('0xa')](),controller['removeMembers']);module[_0x9f8c('0x1c')]=router; \ No newline at end of file +var _0x1c87=['index','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','./chatGroup.controller','get','isAuthenticated'];(function(_0x41352a,_0x246ea2){var _0x3e392f=function(_0x11a5a6){while(--_0x11a5a6){_0x41352a['push'](_0x41352a['shift']());}};_0x3e392f(++_0x246ea2);}(_0x1c87,0x155));var _0x71c8=function(_0x2f5bf7,_0x428282){_0x2f5bf7=_0x2f5bf7-0x0;var _0x42128a=_0x1c87[_0x2f5bf7];return _0x42128a;};'use strict';var multer=require(_0x71c8('0x0'));var util=require(_0x71c8('0x1'));var path=require(_0x71c8('0x2'));var timeout=require('connect-timeout');var express=require(_0x71c8('0x3'));var router=express[_0x71c8('0x4')]();var fs_extra=require(_0x71c8('0x5'));var auth=require(_0x71c8('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x71c8('0x7'));router[_0x71c8('0x8')]('/',auth[_0x71c8('0x9')](),controller[_0x71c8('0xa')]);router[_0x71c8('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x71c8('0x8')](_0x71c8('0xb'),auth['isAuthenticated'](),controller[_0x71c8('0xc')]);router[_0x71c8('0x8')](_0x71c8('0xd'),auth[_0x71c8('0x9')](),controller[_0x71c8('0xe')]);router[_0x71c8('0x8')](_0x71c8('0xf'),auth['isAuthenticated'](),controller[_0x71c8('0x10')]);router[_0x71c8('0x8')](_0x71c8('0x11'),auth[_0x71c8('0x9')](),controller[_0x71c8('0x12')]);router[_0x71c8('0x13')]('/',auth[_0x71c8('0x9')](),controller[_0x71c8('0x14')]);router[_0x71c8('0x13')](_0x71c8('0xf'),auth[_0x71c8('0x9')](),controller[_0x71c8('0x15')]);router['post'](_0x71c8('0x11'),auth['isAuthenticated'](),controller[_0x71c8('0x16')]);router['put'](_0x71c8('0xb'),auth[_0x71c8('0x9')](),controller[_0x71c8('0x17')]);router[_0x71c8('0x18')](_0x71c8('0xb'),auth[_0x71c8('0x9')](),controller[_0x71c8('0x19')]);router[_0x71c8('0x18')](_0x71c8('0xf'),auth[_0x71c8('0x9')](),controller['removeMembers']);module[_0x71c8('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 92b4bc6..fc89997 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 _0xeb74=['exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long','out','sequelize'];(function(_0x5dede5,_0x22c5ca){var _0x3f8b62=function(_0xf4333){while(--_0xf4333){_0x5dede5['push'](_0x5dede5['shift']());}};_0x3f8b62(++_0x22c5ca);}(_0xeb74,0xe3));var _0x4eb7=function(_0x46e7af,_0x485859){_0x46e7af=_0x46e7af-0x0;var _0x1efc66=_0xeb74[_0x46e7af];return _0x1efc66;};'use strict';var Sequelize=require(_0x4eb7('0x0'));module[_0x4eb7('0x1')]={'closed':{'type':Sequelize[_0x4eb7('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x4eb7('0x3')]},'ratingType':{'type':Sequelize[_0x4eb7('0x4')](_0x4eb7('0x5'),_0x4eb7('0x6')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x4eb7('0x7')]},'pathTranscript':{'type':Sequelize[_0x4eb7('0x7')]},'mailTranscript':{'type':Sequelize[_0x4eb7('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x4eb7('0x9')]},'disposition':{'type':Sequelize[_0x4eb7('0x8')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x4eb7('0x8')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x4eb7('0x8')]},'browserVersion':{'type':Sequelize[_0x4eb7('0x8')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x4eb7('0x8')]},'deviceVendor':{'type':Sequelize[_0x4eb7('0x8')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x4eb7('0x7')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x4eb7('0x7')](_0x4eb7('0xa'))},'read1stAt':{'type':Sequelize[_0x4eb7('0x9')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x4eb7('0x4')]('in',_0x4eb7('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x4eb7('0x8')]},'customerPort':{'type':Sequelize[_0x4eb7('0x8')]},'vidaooSessionId':{'type':Sequelize[_0x4eb7('0x7')]},'autoreplyExecuted':{'type':Sequelize[_0x4eb7('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xf7b4=['ENUM','star','TEXT','STRING','DATE','long','out','BOOLEAN','sequelize','INTEGER'];(function(_0x408e07,_0x4d1a56){var _0x5c7fb7=function(_0x1b4031){while(--_0x1b4031){_0x408e07['push'](_0x408e07['shift']());}};_0x5c7fb7(++_0x4d1a56);}(_0xf7b4,0x152));var _0x4f7b=function(_0xe9f4a2,_0x50f0c4){_0xe9f4a2=_0xe9f4a2-0x0;var _0x25e066=_0xf7b4[_0xe9f4a2];return _0x25e066;};'use strict';var Sequelize=require(_0x4f7b('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x4f7b('0x1')]},'ratingType':{'type':Sequelize[_0x4f7b('0x2')]('star','thumb'),'defaultValue':_0x4f7b('0x3')},'ratingMessage':{'type':Sequelize[_0x4f7b('0x4')]},'pathTranscript':{'type':Sequelize[_0x4f7b('0x4')]},'mailTranscript':{'type':Sequelize[_0x4f7b('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x4f7b('0x6')]},'disposition':{'type':Sequelize[_0x4f7b('0x5')]},'secondDisposition':{'type':Sequelize[_0x4f7b('0x5')]},'thirdDisposition':{'type':Sequelize[_0x4f7b('0x5')]},'note':{'type':Sequelize[_0x4f7b('0x5')]},'browserName':{'type':Sequelize[_0x4f7b('0x5')]},'browserVersion':{'type':Sequelize[_0x4f7b('0x5')]},'osName':{'type':Sequelize[_0x4f7b('0x5')]},'osVersion':{'type':Sequelize[_0x4f7b('0x5')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x4f7b('0x5')]},'deviceType':{'type':Sequelize[_0x4f7b('0x5')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x4f7b('0x5')]},'formData':{'type':Sequelize[_0x4f7b('0x4')](_0x4f7b('0x7'))},'read1stAt':{'type':Sequelize[_0x4f7b('0x6')]},'lastMsgAt':{'type':Sequelize[_0x4f7b('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x4f7b('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x4f7b('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x4f7b('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index b3fdd30..3743b38 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 _0x8903=['now','Messages','User','ChatWebsiteId','ContactId','agentAlias','System','customer','%s%d','website_alias','alias','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','mailTranscript','addMessage','ids','omit','length','hasOwnProperty','nolimit','sort','pick','where','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','merge','rows','order','map','include','push','spread','emit','chatInteractionTags:save','removeTags','toString','server','files','tmp','transcript-%d-%s.zip','firstName','lastName','attachments','direction','read','Account','mkdirSync','Chat','Owner','closedAt','osName','referer','customerIp','customerPort','N.A.','existsSync','createReadStream','pipe','createWriteStream','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','rimraf','zip-dir','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','register','jayson/promise','client','http','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatInteraction,\x20%s,\x20%s','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','update','then','stack','name','send','contact','interaction','index','ChatInteraction','rawAttributes','key','getOptions','findAll','chat','query','show','params','model','keys','filters','intersection','attributes','fields','includeAll','options','find','create','body','destroy','createVidaooSession','ChatWebsite','vidaooApiKey','vidaooTopic','vidaooMetadata','user','fullname','email','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooNote','isNull','parse','metadata','ValidationError','Sequelize','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','originalname','basename','filename','type','attachmentDownload','findOne','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','download','close','root','format','transcript-%s.txt'];(function(_0x365919,_0x130223){var _0x12d60c=function(_0x1eae09){while(--_0x1eae09){_0x365919['push'](_0x365919['shift']());}};_0x12d60c(++_0x130223);}(_0x8903,0x1e1));var _0x3890=function(_0x313d6f,_0x122c8d){_0x313d6f=_0x313d6f-0x0;var _0x2059ac=_0x8903[_0x313d6f];return _0x2059ac;};'use strict';var rimraf=require(_0x3890('0x0'));var zipdir=require(_0x3890('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3890('0x2'));var Mustache=require('mustache');var util=require(_0x3890('0x3'));var path=require(_0x3890('0x4'));var ejs=require(_0x3890('0x5'));var fs=require('fs');var _=require(_0x3890('0x6'));var Redis=require(_0x3890('0x7'));var interaction=require(_0x3890('0x8'));var qs=require(_0x3890('0x9'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x3890('0xa'));var config=require(_0x3890('0xb'));var db=require(_0x3890('0xc'))['db'];config[_0x3890('0xd')]=_[_0x3890('0xe')](config[_0x3890('0xd')],{'host':_0x3890('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3890('0xd')]));require(_0x3890('0x10'))[_0x3890('0x11')](socket);var jayson=require(_0x3890('0x12'));var client=jayson[_0x3890('0x13')]['http']({'port':0x232b});var client9004=jayson[_0x3890('0x13')][_0x3890('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x411af3,_0x58c2af,_0xdc51a4,_0x3c9111){return new BPromise(function(_0xc269d3,_0x585bea){var _0x5221c6=_0x3c9111||client;return _0x5221c6['request'](_0x411af3,_0xdc51a4)['then'](function(_0x279884){logger[_0x3890('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x58c2af,_0x3890('0x16'));logger[_0x3890('0x17')](_0x3890('0x18'),_0x58c2af,'request\x20sent',JSON[_0x3890('0x19')](_0x279884));if(_0x279884['error']){if(_0x279884[_0x3890('0x1a')][_0x3890('0x1b')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x58c2af,_0x279884['error'][_0x3890('0x1c')]);return _0x585bea(_0x279884[_0x3890('0x1a')][_0x3890('0x1c')]);}logger[_0x3890('0x1a')](_0x3890('0x1d'),_0x58c2af,_0x279884['error'][_0x3890('0x1c')]);return _0xc269d3(_0x279884[_0x3890('0x1a')][_0x3890('0x1c')]);}else{logger[_0x3890('0x15')](_0x3890('0x1d'),_0x58c2af,'request\x20sent');_0xc269d3(_0x279884[_0x3890('0x1e')][_0x3890('0x1c')]);}})[_0x3890('0x1f')](function(_0x2a896d){logger['error'](_0x3890('0x1d'),_0x58c2af,_0x2a896d);_0x585bea(_0x2a896d);});});}function respondWithStatusCode(_0x2491cc,_0x5541b9){_0x5541b9=_0x5541b9||0xcc;return function(_0x3a12cd){if(_0x3a12cd){return _0x2491cc[_0x3890('0x20')](_0x5541b9);}return _0x2491cc['status'](_0x5541b9)[_0x3890('0x21')]();};}function respondWithResult(_0x2e3ccb,_0x4652e3){_0x4652e3=_0x4652e3||0xc8;return function(_0x2504dd){if(_0x2504dd){return _0x2e3ccb['status'](_0x4652e3)[_0x3890('0x22')](_0x2504dd);}};}function respondWithFilteredResult(_0x33c161,_0x499657){return function(_0xa3cb39){if(_0xa3cb39){var _0x54f3c3=typeof _0x499657[_0x3890('0x23')]===_0x3890('0x24')&&typeof _0x499657[_0x3890('0x25')]===_0x3890('0x24');var _0x109d47=_0xa3cb39[_0x3890('0x26')];var _0x6c44f9=_0x54f3c3?0x0:_0x499657['offset'];var _0x4b7b1c=_0x54f3c3?_0xa3cb39[_0x3890('0x26')]:_0x499657['offset']+_0x499657[_0x3890('0x25')];var _0x24b0fc;if(_0x4b7b1c>=_0x109d47){_0x4b7b1c=_0x109d47;_0x24b0fc=0xc8;}else{_0x24b0fc=0xce;}_0x33c161[_0x3890('0x27')](_0x24b0fc);return _0x33c161[_0x3890('0x28')]('Content-Range',_0x6c44f9+'-'+_0x4b7b1c+'/'+_0x109d47)[_0x3890('0x22')](_0xa3cb39);}return null;};}function saveUpdates(_0x53d6a9){return function(_0xc7ae26){if(_0xc7ae26){return _0xc7ae26[_0x3890('0x29')](_0x53d6a9)[_0x3890('0x2a')](function(_0x8c68c3){return _0x8c68c3;});}return null;};}function removeEntity(_0x1fef71){return function(_0x4094b0){if(_0x4094b0){return _0x4094b0['destroy']()[_0x3890('0x2a')](function(){_0x1fef71[_0x3890('0x27')](0xcc)[_0x3890('0x21')]();});}};}function handleEntityNotFound(_0x48a345){return function(_0xf260dd){if(!_0xf260dd){_0x48a345['sendStatus'](0x194);}return _0xf260dd;};}function handleError(_0x443d08,_0x4f1efb){_0x4f1efb=_0x4f1efb||0x1f4;return function(_0x4b312b){logger['error'](_0x4b312b[_0x3890('0x2b')]);if(_0x4b312b[_0x3890('0x2c')]){delete _0x4b312b[_0x3890('0x2c')];}_0x443d08[_0x3890('0x27')](_0x4f1efb)[_0x3890('0x2d')](_0x4b312b);};}function getMustacheRender(_0x1c7cec,_0xf97cfe){return Mustache['render'](_0x1c7cec,_['merge'](_0xf97cfe['body'],{'contact':_0xf97cfe[_0x3890('0x2e')],'message':_0xf97cfe[_0x3890('0x1c')],'agent':_0xf97cfe['agent'],'interaction':_0xf97cfe[_0x3890('0x2f')],'account':_0xf97cfe['account']}))||'';}exports[_0x3890('0x30')]=function(_0x580a8b,_0x5713ce){var _0x583edb={};var _0x58688b=_['map'](db[_0x3890('0x31')][_0x3890('0x32')],function(_0x46229e){return{'name':_0x46229e['fieldName'],'type':_0x46229e['type'][_0x3890('0x33')]};});_0x583edb=qs[_0x3890('0x34')](_0x58688b,_0x580a8b);return interaction[_0x3890('0x35')](_0x3890('0x36'),_0x580a8b[_0x3890('0x37')],_0x580a8b['user'],_0x583edb,_0x58688b)['then'](respondWithFilteredResult(_0x5713ce,_0x583edb))[_0x3890('0x1f')](handleError(_0x5713ce,null));};exports[_0x3890('0x38')]=function(_0x5c03ef,_0x70485c){var _0x1c8083={'raw':![],'where':{'id':_0x5c03ef[_0x3890('0x39')]['id']}},_0x4dc614={};_0x4dc614[_0x3890('0x3a')]=_[_0x3890('0x3b')](db[_0x3890('0x31')][_0x3890('0x32')]);_0x4dc614[_0x3890('0x37')]=_[_0x3890('0x3b')](_0x5c03ef[_0x3890('0x37')]);_0x4dc614[_0x3890('0x3c')]=_[_0x3890('0x3d')](_0x4dc614[_0x3890('0x3a')],_0x4dc614[_0x3890('0x37')]);_0x1c8083[_0x3890('0x3e')]=_[_0x3890('0x3d')](_0x4dc614[_0x3890('0x3a')],qs[_0x3890('0x3f')](_0x5c03ef['query'][_0x3890('0x3f')]));_0x1c8083[_0x3890('0x3e')]=_0x1c8083[_0x3890('0x3e')]['length']?_0x1c8083[_0x3890('0x3e')]:_0x4dc614[_0x3890('0x3a')];if(_0x5c03ef['query'][_0x3890('0x40')]){_0x1c8083['include']=[{'all':!![]}];}_0x1c8083=_['merge']({},_0x1c8083,_0x5c03ef[_0x3890('0x41')]);return db[_0x3890('0x31')][_0x3890('0x42')](_0x1c8083)[_0x3890('0x2a')](handleEntityNotFound(_0x70485c,null))[_0x3890('0x2a')](respondWithResult(_0x70485c,null))[_0x3890('0x1f')](handleError(_0x70485c,null));};exports['create']=function(_0x5cceae,_0x58e6ef){return db[_0x3890('0x31')][_0x3890('0x43')](_0x5cceae[_0x3890('0x44')],{})[_0x3890('0x2a')](respondWithResult(_0x58e6ef,0xc9))['catch'](handleError(_0x58e6ef,null));};exports[_0x3890('0x29')]=function(_0x166b19,_0xc815a5){if(_0x166b19[_0x3890('0x44')]['id']){delete _0x166b19[_0x3890('0x44')]['id'];}return db['ChatInteraction'][_0x3890('0x42')]({'where':{'id':_0x166b19[_0x3890('0x39')]['id']}})[_0x3890('0x2a')](handleEntityNotFound(_0xc815a5,null))[_0x3890('0x2a')](saveUpdates(_0x166b19[_0x3890('0x44')],null))['then'](respondWithResult(_0xc815a5,null))[_0x3890('0x1f')](handleError(_0xc815a5,null));};exports[_0x3890('0x45')]=function(_0xe11f64,_0x1ca01b){return db['ChatInteraction'][_0x3890('0x42')]({'where':{'id':_0xe11f64[_0x3890('0x39')]['id']}})[_0x3890('0x2a')](handleEntityNotFound(_0x1ca01b,null))['then'](removeEntity(_0x1ca01b,null))['catch'](handleError(_0x1ca01b,null));};exports['describe']=function(_0x2c85aa,_0x5aadb8){return db[_0x3890('0x31')]['describe']()[_0x3890('0x2a')](respondWithResult(_0x5aadb8,null))[_0x3890('0x1f')](handleError(_0x5aadb8,null));};exports[_0x3890('0x46')]=function(_0x5f17d0,_0x414f81){var _0x1bb7dd=_0x5f17d0['params']['id'];var _0x4eb267;var _0x95b561;var _0x1c0983;return db[_0x3890('0x31')]['findOne']({'where':{'id':_0x1bb7dd}})['then'](function(_0x4303d3){_0x4eb267=_0x4303d3;return db[_0x3890('0x47')]['findOne']({'where':{'id':_0x4303d3['ChatWebsiteId']},'attributes':['id',_0x3890('0x48'),'vidaooEscalation',_0x3890('0x49'),'vidaooNote',_0x3890('0x4a')],'raw':!![]});})[_0x3890('0x2a')](function(_0x393882){if(_0x393882&&_0x393882['vidaooApiKey']&&_0x393882['vidaooEscalation']){_0x95b561=_0x393882;var _0x16e93a={'interaction':{'id':_0x1bb7dd},'agent':{'id':_0x5f17d0[_0x3890('0x4b')]['id'],'name':_0x5f17d0[_0x3890('0x4b')]['name'],'fullname':_0x5f17d0[_0x3890('0x4b')][_0x3890('0x4c')],'email':_0x5f17d0[_0x3890('0x4b')][_0x3890('0x4d')]},'contact':_0x5f17d0['body'][_0x3890('0x2e')],'account':_0x5f17d0[_0x3890('0x44')][_0x3890('0x4e')]};var _0x20aaa0={'rejectUnauthorized':![],'method':_0x3890('0x4f'),'url':_0x3890('0x50'),'headers':{'X-APIKEY':_0x393882[_0x3890('0x48')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5f17d0['user'][_0x3890('0x4d')]],'buttons':null,'topic':_0x95b561[_0x3890('0x49')],'note':_['isNull'](_0x95b561[_0x3890('0x51')])?null:getMustacheRender(_0x95b561['vidaooNote'],_0x16e93a),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x3890('0x52')](_0x95b561['vidaooMetadata'])){var _0xcd8ee0=getMustacheRender(_0x95b561[_0x3890('0x4a')],_0x16e93a);var _0x5761fd=JSON[_0x3890('0x53')](_0xcd8ee0);_0x20aaa0[_0x3890('0x44')][_0x3890('0x54')]=_0x5761fd;}}catch(_0x41f2f4){throw new db['Sequelize'][(_0x3890('0x55'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x20aaa0);}else{throw new db[(_0x3890('0x56'))]['ValidationError'](_0x3890('0x57'));}})['then'](function(_0x52119f){_0x1c0983=_0x52119f;if(_0x1c0983['id']){var _0x567fb5={'body':_0x1c0983[_0x3890('0x58')],'ChatWebsiteId':_0x95b561['id'],'ChatInteractionId':_0x4eb267['id'],'direction':_0x3890('0x59'),'UserId':_0x5f17d0[_0x3890('0x4b')]['id']};return db[_0x3890('0x5a')][_0x3890('0x43')](_0x567fb5,{});}else{throw new db['Sequelize']['ValidationError'](_0x3890('0x5b'));}})['then'](function(){return _0x4eb267[_0x3890('0x5c')]({'vidaooSessionId':_0x1c0983['id']});})[_0x3890('0x2a')](respondWithResult(_0x414f81,null))[_0x3890('0x1f')](handleError(_0x414f81,null));};exports[_0x3890('0x5d')]=function(_0x1df945,_0x35b82d){if(_0x1df945['body']['id']){delete _0x1df945[_0x3890('0x44')]['id'];}return db[_0x3890('0x31')]['find']({'where':{'id':_0x1df945[_0x3890('0x39')]['id']},'include':[{'model':db[_0x3890('0x5e')],'as':_0x3890('0x5f')}]})[_0x3890('0x2a')](handleEntityNotFound(_0x35b82d,null))['then'](saveUpdates(_0x1df945[_0x3890('0x44')],null))[_0x3890('0x2a')](respondWithResult(_0x35b82d,null))[_0x3890('0x1f')](handleError(_0x35b82d,null));};exports[_0x3890('0x60')]=function(_0x1d8f28,_0x2df05d){if(_0x1d8f28[_0x3890('0x44')]['id']){delete _0x1d8f28['body']['id'];}return db[_0x3890('0x31')][_0x3890('0x42')]({'where':{'id':_0x1d8f28[_0x3890('0x39')]['id']}})[_0x3890('0x2a')](function(_0x483ee6){if(!_0x483ee6){logger[_0x3890('0x1a')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x3890('0x60'),0x194,_0x3890('0x61'));_0x2df05d[_0x3890('0x20')](0x194);}else{if(_0x483ee6[_0x3890('0x62')]){throw new db[(_0x3890('0x56'))]['ValidationError'](_0x3890('0x63'));}}return _0x483ee6;})[_0x3890('0x2a')](function(_0xf9b4b9){if(_0xf9b4b9){return _0xf9b4b9[_0x3890('0x29')]({'closed':_0x1d8f28[_0x3890('0x44')][_0x3890('0x64')],'disposition':_0x1d8f28[_0x3890('0x44')][_0x3890('0x65')]})[_0x3890('0x2a')](function(_0x5dc246){return _0x5dc246;});}})[_0x3890('0x2a')](function(){return respondWithRpcPromise(_0x3890('0x66'),'abandon',_0x1d8f28[_0x3890('0x44')],client9004);})[_0x3890('0x2a')](respondWithResult(_0x2df05d,null))[_0x3890('0x1f')](handleError(_0x2df05d,null));};exports['attachmentUpload']=function(_0x12290d,_0x929a2a){_0x12290d[_0x3890('0x44')][_0x3890('0x2c')]=_0x12290d[_0x3890('0x67')][_0x3890('0x68')];_0x12290d['body'][_0x3890('0x69')]=_0x12290d[_0x3890('0x67')][_0x3890('0x6a')];_0x12290d['body'][_0x3890('0x6b')]=_0x12290d[_0x3890('0x67')]['mimetype'];return db['Attachment']['create'](_0x12290d[_0x3890('0x44')])[_0x3890('0x2a')](respondWithResult(_0x929a2a,0xc9))[_0x3890('0x1f')](handleError(_0x929a2a,null));};exports[_0x3890('0x6c')]=function(_0x3fb537,_0x1c75c2){return db[_0x3890('0x31')][_0x3890('0x6d')]({'where':{'id':_0x3fb537[_0x3890('0x39')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x1c75c2,null))[_0x3890('0x2a')](function(_0x5b3222){if(_0x5b3222){if(_0x5b3222[_0x3890('0x64')]){return _0x1c75c2[_0x3890('0x27')](0x193)[_0x3890('0x22')]({'status':0x193,'message':_0x3890('0x6e')});}return db[_0x3890('0x6f')][_0x3890('0x6d')]({'where':{'id':_0x3fb537[_0x3890('0x37')][_0x3890('0x70')]},'raw':!![]})['then'](handleEntityNotFound(_0x1c75c2,null));}})[_0x3890('0x2a')](function(_0x1197c2){if(_0x1197c2){var _0x5c1a2f=_0x1197c2[_0x3890('0x71')]!==null;var _0xad562c=path[_0x3890('0x72')](config['root'],_0x3890('0x73'));if(_0x5c1a2f){_0xad562c=path[_0x3890('0x72')](_0xad562c,_0x3890('0x74'));}var _0x2a0312=path['join'](_0xad562c,_0x1197c2['basename']);return _0x1c75c2[_0x3890('0x75')](_0x2a0312);}})[_0x3890('0x1f')](handleError(_0x1c75c2,null));};exports[_0x3890('0x76')]=function(_0xb9e3c8,_0x3024c5){var _0x3aeb7b=null;var _0x163731=null;var _0x52e9b0=null;if(_0xb9e3c8[_0x3890('0x44')]['id']){delete _0xb9e3c8[_0x3890('0x44')]['id'];}if(_0xb9e3c8[_0x3890('0x44')]['mailTranscript']){_0x52e9b0=path['join'](config[_0x3890('0x77')],'server/files/chat/upload/',util[_0x3890('0x78')](_0x3890('0x79'),Date[_0x3890('0x7a')]()));_0xb9e3c8[_0x3890('0x44')]['pathTranscript']=_0x52e9b0;}return db[_0x3890('0x31')]['find']({'where':{'id':_0xb9e3c8[_0x3890('0x39')]['id']},'include':[{'model':db[_0x3890('0x5a')],'as':_0x3890('0x7b'),'include':[{'model':db[_0x3890('0x7c')],'as':_0x3890('0x7c')}]}]})['then'](handleEntityNotFound(_0x3024c5,null))['then'](saveUpdates(_0xb9e3c8['body'],null))[_0x3890('0x2a')](function(_0x34bdc1){if(_0x34bdc1){_0x3aeb7b=_0x34bdc1;return db[_0x3890('0x47')][_0x3890('0x42')]({'where':{'id':_0x3aeb7b[_0x3890('0x7d')]}});}})[_0x3890('0x2a')](function(_0xcbe0c4){if(_0xcbe0c4){_0x163731=_0xcbe0c4;return db['CmContact'][_0x3890('0x42')]({'where':{'id':_0x3aeb7b[_0x3890('0x7e')]}});}})[_0x3890('0x2a')](function(_0x5693a0){if(_0x5693a0){if(_0x52e9b0){var _0x5d4913=null;for(var _0xa72199=0x1;_0xa72199<_0x3aeb7b[_0x3890('0x7b')]['length'];++_0xa72199){_0x5d4913=_0x3aeb7b['Messages'][_0xa72199];var _0x2084a4=_0x5d4913[_0x3890('0x62')]?util[_0x3890('0x78')]('%s%d',_0x163731[_0x3890('0x7f')],_0x5d4913['UserId']):_0x3890('0x80');var _0x2a06cb=_0xb9e3c8['body'][_0x3890('0x81')]||util[_0x3890('0x78')](_0x3890('0x82'),'Visitor',_0x5d4913['ContactId']);switch(_0x163731['agentIdentifier']){case _0x3890('0x83'):_0x2084a4=_0x5d4913['UserId']?util['format'](_0x3890('0x82'),_0x163731[_0x3890('0x7f')],_0x5d4913[_0x3890('0x62')]):_0x3890('0x80');break;case'agent_alias':_0x2084a4=_0x5d4913[_0x3890('0x62')]?_0x5d4913['User'][_0x3890('0x84')]||_0x5d4913['User'][_0x3890('0x4c')]:_0x3890('0x80');break;case'agent_fullname':_0x2084a4=_0x5d4913[_0x3890('0x62')]?_0x5d4913[_0x3890('0x7c')][_0x3890('0x4c')]:_0x3890('0x80');break;default:_0x2084a4=_0x5d4913[_0x3890('0x62')]?util['format'](_0x3890('0x82'),_0x163731[_0x3890('0x7f')],_0x5d4913[_0x3890('0x62')]):_0x3890('0x80');}var _0x2679d3=util[_0x3890('0x78')]('[%s]\x20%s:\x20%s\x0a',moment(_0x5d4913[_0x3890('0x85')])[_0x3890('0x78')](_0x3890('0x86')),_0x5d4913['direction']==='in'?_0x2a06cb:_0x2084a4,_0x5d4913[_0x3890('0x44')]);if(!_0x5d4913[_0x3890('0x87')]){fs[_0x3890('0x88')](_0x52e9b0,_0x2679d3);}}return db[_0x3890('0x89')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x3890('0x8a')],'as':_0x3890('0x8b'),'raw':!![],'include':[{'model':db[_0x3890('0x8c')],'as':_0x3890('0x8c'),'raw':!![]}]}]});}}})[_0x3890('0x2a')](function(_0x22c668){if(!_0x22c668||!_0x22c668[_0x3890('0x8b')]||!_0xb9e3c8[_0x3890('0x44')])return _0x3aeb7b;var _0x555730=_0x22c668[_0x3890('0x8d')]();return respondWithRpcPromise(_0x3890('0x8e'),_0x3890('0x8f'),{'account':_0x555730,'message':{'from':util['format'](_0x3890('0x90'),_0x22c668[_0x3890('0x2c')],_0x22c668['email']||_0x22c668[_0x3890('0x8b')][_0x3890('0x4b')]),'to':_0xb9e3c8[_0x3890('0x44')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util[_0x3890('0x78')](_0x3890('0x91'),_0xb9e3c8['body'][_0x3890('0x92')]),'attachments':[{'path':_0x52e9b0}]}})['then'](function(){return _0x3aeb7b;})[_0x3890('0x1f')](function(_0xf05698){logger[_0x3890('0x1a')](_0xf05698);});})[_0x3890('0x2a')](respondWithStatusCode(_0x3024c5,0xc8))[_0x3890('0x1f')](handleError(_0x3024c5,null));};exports[_0x3890('0x93')]=function(_0x1ddbb5,_0x5ac0e6){return db['ChatMessage'][_0x3890('0x42')]({'where':{'id':_0x1ddbb5[_0x3890('0x39')]['id']}})[_0x3890('0x2a')](handleEntityNotFound(_0x5ac0e6,null))[_0x3890('0x2a')](function(_0x5ed9c0){if(_0x5ed9c0){return _0x5ed9c0['addMessage'](_0x1ddbb5[_0x3890('0x44')][_0x3890('0x94')],_[_0x3890('0x95')](_0x1ddbb5[_0x3890('0x44')],[_0x3890('0x94'),'id'])||{});}})[_0x3890('0x2a')](respondWithResult(_0x5ac0e6,null))[_0x3890('0x1f')](handleError(_0x5ac0e6,null));};exports['getMessages']=function(_0x2de9d3,_0x17e938){var _0x379e4b={'raw':![],'where':{}};var _0x1cd0eb={};var _0xd3aab7={'count':0x0,'rows':[]};return db[_0x3890('0x31')][_0x3890('0x6d')]({'where':{'id':_0x2de9d3[_0x3890('0x39')]['id']}})[_0x3890('0x2a')](handleEntityNotFound(_0x17e938,null))[_0x3890('0x2a')](function(_0x58774f){if(_0x58774f){_0x1cd0eb['model']=_['keys'](db[_0x3890('0x5a')][_0x3890('0x32')]);_0x1cd0eb[_0x3890('0x37')]=_[_0x3890('0x3b')](_0x2de9d3[_0x3890('0x37')]);_0x1cd0eb[_0x3890('0x3c')]=_[_0x3890('0x3d')](_0x1cd0eb[_0x3890('0x3a')],_0x1cd0eb[_0x3890('0x37')]);_0x379e4b[_0x3890('0x3e')]=_[_0x3890('0x3d')](_0x1cd0eb[_0x3890('0x3a')],qs[_0x3890('0x3f')](_0x2de9d3['query'][_0x3890('0x3f')]));_0x379e4b[_0x3890('0x3e')]=_0x379e4b[_0x3890('0x3e')][_0x3890('0x96')]?_0x379e4b[_0x3890('0x3e')]:_0x1cd0eb['model'];if(!_0x2de9d3[_0x3890('0x37')][_0x3890('0x97')](_0x3890('0x98'))){_0x379e4b[_0x3890('0x25')]=qs[_0x3890('0x25')](_0x2de9d3['query'][_0x3890('0x25')]);_0x379e4b[_0x3890('0x23')]=qs[_0x3890('0x23')](_0x2de9d3[_0x3890('0x37')][_0x3890('0x23')]);}_0x379e4b['order']=qs['sort'](_0x2de9d3[_0x3890('0x37')][_0x3890('0x99')]);_0x379e4b['where']=qs[_0x3890('0x3c')](_[_0x3890('0x9a')](_0x2de9d3['query'],_0x1cd0eb[_0x3890('0x3c')]));_0x379e4b[_0x3890('0x9b')][_0x3890('0x9c')]=_0x58774f['id'];if(_0x2de9d3[_0x3890('0x37')]['filter']){_0x379e4b['where']=_['merge'](_0x379e4b[_0x3890('0x9b')],{'$or':_['map'](_0x379e4b[_0x3890('0x3e')],function(_0x3671ec){var _0x53b08e={};_0x53b08e[_0x3671ec]={'$like':'%'+_0x2de9d3['query'][_0x3890('0x9d')]+'%'};return _0x53b08e;})});}if(_0x2de9d3[_0x3890('0x37')][_0x3890('0x9e')]){var _0x28a48f=_0x2de9d3[_0x3890('0x37')][_0x3890('0x9e')][_0x3890('0x9f')](',');var _0x3fb1f7={};_0x3fb1f7[_0x28a48f[0x0]]={'$gte':moment(_0x28a48f[0x1])[_0x3890('0x78')](_0x3890('0xa0'))};_0x379e4b['where']=_['merge'](_0x379e4b[_0x3890('0x9b')],_0x3fb1f7);}_0x379e4b=_[_0x3890('0xa1')]({},_0x379e4b,_0x2de9d3[_0x3890('0x41')]);return db['ChatMessage']['count']({'where':_0x379e4b[_0x3890('0x9b')]})['then'](function(_0x18328d){_0xd3aab7[_0x3890('0x26')]=_0x18328d;if(_0x2de9d3['query'][_0x3890('0x40')]){_0x379e4b['include']=[{'all':!![]}];}return db[_0x3890('0x5a')][_0x3890('0x35')](_0x379e4b);})['then'](function(_0x30eee6){_0xd3aab7[_0x3890('0xa2')]=_0x30eee6;return _0xd3aab7;});}})[_0x3890('0x2a')](respondWithFilteredResult(_0x17e938,_0x379e4b))['catch'](handleError(_0x17e938,null));};exports['getMyMessages']=function(_0x2cf557,_0x370929){var _0x2158b6={'where':{}},_0x7ef32f={},_0x96dd98={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x3890('0x6d')]({'where':{'id':_0x2cf557[_0x3890('0x39')]['id']}})[_0x3890('0x2a')](handleEntityNotFound(_0x370929,null))[_0x3890('0x2a')](function(_0x318d2e){if(_0x318d2e){_0x7ef32f['model']=_[_0x3890('0x3b')](db[_0x3890('0x5a')][_0x3890('0x32')]);_0x7ef32f[_0x3890('0x37')]=_[_0x3890('0x3b')](_0x2cf557[_0x3890('0x37')]);_0x7ef32f[_0x3890('0x3c')]=_['intersection'](_0x7ef32f[_0x3890('0x3a')],_0x7ef32f[_0x3890('0x37')]);_0x2158b6[_0x3890('0x3e')]=_['intersection'](_0x7ef32f['model'],qs['fields'](_0x2cf557[_0x3890('0x37')][_0x3890('0x3f')]));_0x2158b6['attributes']=_0x2158b6[_0x3890('0x3e')][_0x3890('0x96')]?_0x2158b6[_0x3890('0x3e')]:_0x7ef32f[_0x3890('0x3a')];if(!_0x2cf557[_0x3890('0x37')][_0x3890('0x97')](_0x3890('0x98'))){_0x2158b6[_0x3890('0x25')]=qs['limit'](_0x2cf557[_0x3890('0x37')][_0x3890('0x25')]);_0x2158b6['offset']=qs['offset'](_0x2cf557[_0x3890('0x37')][_0x3890('0x23')]);}_0x2158b6[_0x3890('0xa3')]=qs[_0x3890('0x99')](_0x2cf557[_0x3890('0x37')][_0x3890('0x99')]);_0x2158b6[_0x3890('0x9b')]=qs['filters'](_[_0x3890('0x9a')](_0x2cf557[_0x3890('0x37')],_0x7ef32f['filters']));_0x2158b6['where'][_0x3890('0x9c')]=_0x318d2e['id'];if(_0x2cf557[_0x3890('0x37')][_0x3890('0x9d')]){_0x2158b6[_0x3890('0x9b')]=_['merge'](_0x2158b6[_0x3890('0x9b')],{'$or':_[_0x3890('0xa4')](_0x2158b6[_0x3890('0x3e')],function(_0x2fc64d){var _0x3325f7={};_0x3325f7[_0x2fc64d]={'$like':'%'+_0x2cf557[_0x3890('0x37')][_0x3890('0x9d')]+'%'};return _0x3325f7;})});}_0x2158b6['where'][_0x3890('0x87')]=![];if(_0x2cf557['query']['id']){_0x2158b6[_0x3890('0x9b')]['id']={'$gt':_0x2cf557[_0x3890('0x37')]['id']};}_0x2158b6=_[_0x3890('0xa1')]({},_0x2158b6,_0x2cf557[_0x3890('0x41')]);return db['ChatMessage'][_0x3890('0x26')]({'where':_0x2158b6[_0x3890('0x9b')]})['then'](function(_0x5831c7){_0x96dd98[_0x3890('0x26')]=_0x5831c7;_0x2158b6[_0x3890('0xa5')]=[];if(_0x2cf557[_0x3890('0x37')]['includeAgent']){_0x2158b6[_0x3890('0xa5')][_0x3890('0xa6')]({'model':db[_0x3890('0x7c')],'as':'User','attributes':['id',_0x3890('0x4c'),_0x3890('0x84')]});}if(_0x2cf557[_0x3890('0x37')][_0x3890('0x40')]){_0x2158b6[_0x3890('0xa5')]=[{'all':!![]}];}return db[_0x3890('0x5a')][_0x3890('0x35')](_0x2158b6);})['then'](function(_0x39a53c){_0x96dd98[_0x3890('0xa2')]=_0x39a53c;return _0x96dd98;});}})[_0x3890('0x2a')](respondWithFilteredResult(_0x370929,_0x2158b6))[_0x3890('0x1f')](handleError(_0x370929,null));};exports['addTags']=function(_0x586783,_0x44a6ea){return db['ChatInteraction']['find']({'where':{'id':_0x586783[_0x3890('0x39')]['id']}})[_0x3890('0x2a')](handleEntityNotFound(_0x44a6ea,null))['then'](function(_0x4a8080){if(_0x4a8080){return _0x4a8080['setTags'](_0x586783[_0x3890('0x44')][_0x3890('0x94')],_[_0x3890('0x95')](_0x586783[_0x3890('0x44')],[_0x3890('0x94'),'id'])||{})[_0x3890('0xa7')](function(){return db['Tag']['findAll']({'attributes':['id',_0x3890('0x2c'),'color'],'where':{'id':_0x586783[_0x3890('0x44')][_0x3890('0x94')]}});})[_0x3890('0x2a')](function(_0x4f3718){socket[_0x3890('0xa8')](_0x3890('0xa9'),{'id':Number(_0x586783[_0x3890('0x39')]['id']),'tags':_0x4f3718||[]});return{'id':Number(_0x586783[_0x3890('0x39')]['id']),'tags':_0x4f3718||[]};});}})['then'](respondWithResult(_0x44a6ea,null))['catch'](handleError(_0x44a6ea,null));};exports[_0x3890('0xaa')]=function(_0x5efb95,_0x170798){return db[_0x3890('0x31')][_0x3890('0x42')]({'where':{'id':_0x5efb95[_0x3890('0x39')]['id']}})[_0x3890('0x2a')](handleEntityNotFound(_0x170798,null))[_0x3890('0x2a')](function(_0x2ed436){if(_0x2ed436){return _0x2ed436[_0x3890('0xaa')](_0x5efb95['query'][_0x3890('0x94')]);}})[_0x3890('0x2a')](respondWithStatusCode(_0x170798,null))['catch'](handleError(_0x170798,null));};exports[_0x3890('0x75')]=function(_0x49779c,_0x4d5400){var _0x5e705b=moment()['unix']()[_0x3890('0xab')]();var _0x5c8837=path['join'](config[_0x3890('0x77')],_0x3890('0xac'),_0x3890('0xad'),_0x3890('0xae'));var _0x304c69=path[_0x3890('0x72')](config['root'],_0x3890('0xac'),_0x3890('0xad'),'attachments');var _0x5a9a29=path[_0x3890('0x72')](_0x5c8837,_0x5e705b);var _0x58b8a5=util[_0x3890('0x78')](_0x3890('0xaf'),_0x49779c[_0x3890('0x39')]['id'],_0x5e705b);var _0x122bce=path[_0x3890('0x72')](_0x5c8837,_0x58b8a5);var _0x16c10d=[];_0x16c10d[_0x3890('0xa6')]({'model':db[_0x3890('0x7c')],'as':_0x3890('0x7c'),'attributes':['id',_0x3890('0x4c')],'raw':!![]});_0x16c10d[_0x3890('0xa6')]({'model':db[_0x3890('0x5e')],'as':'Contact','attributes':['id',_0x3890('0xb0'),_0x3890('0xb1')],'raw':!![]});if(_0x49779c[_0x3890('0x37')][_0x3890('0xb2')]){_0x16c10d[_0x3890('0xa6')]({'model':db[_0x3890('0x6f')],'as':_0x3890('0x6f'),'raw':!![]});}var _0xccea7d=[{'model':db['ChatMessage'],'as':_0x3890('0x7b'),'attributes':['id',_0x3890('0x44'),'createdAt',_0x3890('0xb3'),_0x3890('0x87'),_0x3890('0xb4')],'include':_0x16c10d}];_0xccea7d[_0x3890('0xa6')]({'model':db[_0x3890('0x47')],'as':_0x3890('0xb5'),'attributes':['id',_0x3890('0x2c')]});_0xccea7d[_0x3890('0xa6')]({'model':db[_0x3890('0x7c')],'as':'Owner','attributes':['id',_0x3890('0x4c')]});return db[_0x3890('0x31')][_0x3890('0x42')]({'where':{'id':_0x49779c['params']['id']},'include':_0xccea7d})['then'](handleEntityNotFound(_0x4d5400,null))[_0x3890('0x2a')](function(_0x434ad5){if(_0x434ad5){var _0x458f79=_0x434ad5['get']({'plain':!![]});fs[_0x3890('0xb6')](_0x5a9a29);var _0x136218={'channel':_0x3890('0xb7'),'account':_0x458f79['Account']['name'],'agent':_0x458f79[_0x3890('0xb8')]?_0x458f79[_0x3890('0xb8')][_0x3890('0x4c')]:'N.A.','createdAt':moment(_0x458f79[_0x3890('0x85')])[_0x3890('0x78')](_0x3890('0xa0'))[_0x3890('0xab')](),'closedAt':_0x458f79['closed']?moment(_0x458f79[_0x3890('0xb9')])[_0x3890('0x78')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3890('0xab')]():'','disposition':_0x458f79['disposition'],'chatInfo':{'browser':_0x458f79['browserName'],'os':_0x458f79[_0x3890('0xba')],'referer':_0x458f79[_0x3890('0xbb')],'customerIp':_0x458f79[_0x3890('0xbc')],'customerPort':_0x458f79['customerPort']?_0x458f79[_0x3890('0xbd')]:_0x3890('0xbe')},'messages':_(_0x458f79['Messages'])['tail']()[_0x3890('0x9d')]({'secret':![]})['map'](function(_0x3b635d){if(_0x3b635d[_0x3890('0x6f')]){var _0x3923b5=path[_0x3890('0x72')](_0x304c69,_0x3b635d[_0x3890('0x6f')][_0x3890('0x69')]);if(fs[_0x3890('0xbf')](_0x3923b5)){fs[_0x3890('0xc0')](_0x3923b5)[_0x3890('0xc1')](fs[_0x3890('0xc2')](path[_0x3890('0x72')](_0x5a9a29,_0x3b635d[_0x3890('0x6f')][_0x3890('0x69')])));}}return{'date':moment(_0x3b635d['createdAt'])['format'](_0x3890('0xa0'))['toString'](),'sender':_0x3b635d['direction']===_0x3890('0x59')?_0x3b635d[_0x3890('0x7c')]?_0x3b635d[_0x3890('0x7c')][_0x3890('0x4c')]:_0x3890('0x80'):_0x3b635d[_0x3890('0x5f')][_0x3890('0xb0')]+(_0x3b635d[_0x3890('0x5f')][_0x3890('0xb1')]?'\x20'+_0x3b635d[_0x3890('0x5f')][_0x3890('0xb1')]:''),'body':_0x3b635d[_0x3890('0x6f')]?_0x3b635d[_0x3890('0x6f')][_0x3890('0x69')]:_0x3b635d[_0x3890('0x44')],'direction':_0x3b635d[_0x3890('0xb3')]===_0x3890('0x59')?'A':'C','secret':_0x3b635d[_0x3890('0x87')],'read':_0x3b635d[_0x3890('0xb4')],'attachment':_0x3b635d['Attachment']};})['value']()};return ejs[_0x3890('0xc3')](path['join'](config[_0x3890('0x77')],'server',_0x3890('0xc4'),_0x3890('0xc5')),{'interaction':_0x136218})[_0x3890('0x2a')](function(_0x1d9f65){var _0x3e348c=path[_0x3890('0x72')](_0x5a9a29,'transcript-'+_0x458f79['id']+'-'+_0x5e705b+_0x3890('0xc6'));var _0x4a38a2={'path':_0x3e348c,'channel':_0x3890('0xb7'),'interactionId':_0x458f79['id']};return pdf[_0x3890('0xc7')](_0x1d9f65,_0x4a38a2);})[_0x3890('0x2a')](function(){return new Promise(function(_0x5b3d1c,_0x1e90c1){zipdir(_0x5a9a29,{'saveTo':_0x122bce},function(_0x2be5d6,_0x5db3a5){if(_0x2be5d6)return _0x1e90c1(_0x2be5d6);return _0x5b3d1c(_0x5db3a5);});})[_0x3890('0x2a')](function(){return new BPromise(function(_0x3c6296,_0x22e0b4){rimraf(_0x5a9a29,function(_0x435a83){if(_0x435a83)_0x22e0b4(_0x435a83);return _0x3c6296();});});})['then'](function(){return _0x4d5400[_0x3890('0x75')](_0x122bce,_0x58b8a5,function(_0x381926){if(_0x381926){logger[_0x3890('0x1a')](_0x3890('0xc8'),_0x381926);}else{fs['unlinkSync'](_0x122bce);}});});});}else{return _0x4d5400[_0x3890('0x20')](0xc8);}})['catch'](handleError(_0x4d5400,null));}; \ No newline at end of file +var _0x7815=['body','describe','createVidaooSession','findOne','ChatWebsite','vidaooTopic','vidaooMetadata','vidaooApiKey','user','name','fullname','email','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooNote','follow','isNull','parse','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','ValidationError','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','originalname','filename','mimetype','attachmentDownload','Attachment','attachId','ChatOfflineMessageId','join','root','offline-chat/','basename','download','close','server/files/chat/upload/','format','now','pathTranscript','Messages','User','ChatWebsiteId','ContactId','%s%d','agentAlias','UserId','Visitor','website_alias','System','agent_alias','alias','agent_fullname','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','CloudProvider','Smtp','SendMail','sendMail','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','intersection','hasOwnProperty','nolimit','sort','where','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','include','rows','getMyMessages','order','pick','includeAgent','push','setTags','omit','spread','Tag','emit','removeTags','unix','toString','server','tmp','files','attachments','transcript-%d-%s.zip','read','Account','Owner','Chat','browserName','osName','referer','customerIp','customerPort','N.A.','existsSync','createReadStream','createWriteStream','firstName','lastName','value','renderFile','downloadInteraction.ejs','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','offset','limit','undefined','count','json','destroy','end','stack','send','render','merge','contact','agent','interaction','account','index','map','rawAttributes','fieldName','type','key','getOptions','findAll','chat','show','params','model','keys','ChatInteraction','query','filters','fields','attributes','length','includeAll','find','create','update'];(function(_0x26f03d,_0x4866c2){var _0x42dc9f=function(_0x110528){while(--_0x110528){_0x26f03d['push'](_0x26f03d['shift']());}};_0x42dc9f(++_0x4866c2);}(_0x7815,0x15c));var _0x5781=function(_0x231717,_0x280141){_0x231717=_0x231717-0x0;var _0x9a8e7b=_0x7815[_0x231717];return _0x9a8e7b;};'use strict';var rimraf=require(_0x5781('0x0'));var zipdir=require(_0x5781('0x1'));var rp=require('request-promise');var moment=require(_0x5781('0x2'));var BPromise=require(_0x5781('0x3'));var Mustache=require('mustache');var util=require(_0x5781('0x4'));var path=require(_0x5781('0x5'));var ejs=require(_0x5781('0x6'));var fs=require('fs');var _=require(_0x5781('0x7'));var Redis=require('ioredis');var interaction=require(_0x5781('0x8'));var qs=require(_0x5781('0x9'));var pdf=require(_0x5781('0xa'));var logger=require(_0x5781('0xb'))(_0x5781('0xc'));var config=require(_0x5781('0xd'));var db=require(_0x5781('0xe'))['db'];config[_0x5781('0xf')]=_[_0x5781('0x10')](config[_0x5781('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0x5781('0x11'))(new Redis(config[_0x5781('0xf')]));require(_0x5781('0x12'))[_0x5781('0x13')](socket);var jayson=require(_0x5781('0x14'));var client=jayson[_0x5781('0x15')][_0x5781('0x16')]({'port':0x232b});var client9004=jayson[_0x5781('0x15')]['http']({'port':0x232c});function respondWithRpcPromise(_0x19f607,_0x14c0ef,_0x3d1445,_0x32b9fa){return new BPromise(function(_0x5bb0c7,_0x1147b2){var _0x457586=_0x32b9fa||client;return _0x457586['request'](_0x19f607,_0x3d1445)[_0x5781('0x17')](function(_0x2242c1){logger[_0x5781('0x18')](_0x5781('0x19'),_0x14c0ef,_0x5781('0x1a'));logger[_0x5781('0x1b')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x14c0ef,_0x5781('0x1a'),JSON[_0x5781('0x1c')](_0x2242c1));if(_0x2242c1['error']){if(_0x2242c1[_0x5781('0x1d')][_0x5781('0x1e')]===0x1f4){logger[_0x5781('0x1d')](_0x5781('0x19'),_0x14c0ef,_0x2242c1[_0x5781('0x1d')][_0x5781('0x1f')]);return _0x1147b2(_0x2242c1[_0x5781('0x1d')]['message']);}logger[_0x5781('0x1d')](_0x5781('0x19'),_0x14c0ef,_0x2242c1[_0x5781('0x1d')]['message']);return _0x5bb0c7(_0x2242c1['error'][_0x5781('0x1f')]);}else{logger['info'](_0x5781('0x19'),_0x14c0ef,_0x5781('0x1a'));_0x5bb0c7(_0x2242c1[_0x5781('0x20')]['message']);}})[_0x5781('0x21')](function(_0x5156e1){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x14c0ef,_0x5156e1);_0x1147b2(_0x5156e1);});});}function respondWithStatusCode(_0xb3835e,_0x2e0252){_0x2e0252=_0x2e0252||0xcc;return function(_0x3d2c12){if(_0x3d2c12){return _0xb3835e[_0x5781('0x22')](_0x2e0252);}return _0xb3835e[_0x5781('0x23')](_0x2e0252)['end']();};}function respondWithResult(_0x12220c,_0x102d43){_0x102d43=_0x102d43||0xc8;return function(_0x3a211e){if(_0x3a211e){return _0x12220c['status'](_0x102d43)['json'](_0x3a211e);}};}function respondWithFilteredResult(_0x2943c6,_0x3f6a94){return function(_0x2dc69d){if(_0x2dc69d){var _0x50671b=typeof _0x3f6a94[_0x5781('0x24')]==='undefined'&&typeof _0x3f6a94[_0x5781('0x25')]===_0x5781('0x26');var _0x3740e8=_0x2dc69d[_0x5781('0x27')];var _0x1d108d=_0x50671b?0x0:_0x3f6a94['offset'];var _0x3166f8=_0x50671b?_0x2dc69d['count']:_0x3f6a94[_0x5781('0x24')]+_0x3f6a94[_0x5781('0x25')];var _0x13a4a0;if(_0x3166f8>=_0x3740e8){_0x3166f8=_0x3740e8;_0x13a4a0=0xc8;}else{_0x13a4a0=0xce;}_0x2943c6['status'](_0x13a4a0);return _0x2943c6['set']('Content-Range',_0x1d108d+'-'+_0x3166f8+'/'+_0x3740e8)[_0x5781('0x28')](_0x2dc69d);}return null;};}function saveUpdates(_0x4da3a5){return function(_0x19eb31){if(_0x19eb31){return _0x19eb31['update'](_0x4da3a5)[_0x5781('0x17')](function(_0x4e98d6){return _0x4e98d6;});}return null;};}function removeEntity(_0x4cf40a){return function(_0x4d3367){if(_0x4d3367){return _0x4d3367[_0x5781('0x29')]()['then'](function(){_0x4cf40a[_0x5781('0x23')](0xcc)[_0x5781('0x2a')]();});}};}function handleEntityNotFound(_0x5db684){return function(_0x2216b5){if(!_0x2216b5){_0x5db684[_0x5781('0x22')](0x194);}return _0x2216b5;};}function handleError(_0x21bdfb,_0x15b46e){_0x15b46e=_0x15b46e||0x1f4;return function(_0x15f309){logger['error'](_0x15f309[_0x5781('0x2b')]);if(_0x15f309['name']){delete _0x15f309['name'];}_0x21bdfb['status'](_0x15b46e)[_0x5781('0x2c')](_0x15f309);};}function getMustacheRender(_0x153f99,_0x65b51){return Mustache[_0x5781('0x2d')](_0x153f99,_[_0x5781('0x2e')](_0x65b51['body'],{'contact':_0x65b51[_0x5781('0x2f')],'message':_0x65b51[_0x5781('0x1f')],'agent':_0x65b51[_0x5781('0x30')],'interaction':_0x65b51[_0x5781('0x31')],'account':_0x65b51[_0x5781('0x32')]}))||'';}exports[_0x5781('0x33')]=function(_0x5ccff4,_0x578616){var _0x2c4398={};var _0x11ceb7=_[_0x5781('0x34')](db['ChatInteraction'][_0x5781('0x35')],function(_0x43c61d){return{'name':_0x43c61d[_0x5781('0x36')],'type':_0x43c61d[_0x5781('0x37')][_0x5781('0x38')]};});_0x2c4398=qs[_0x5781('0x39')](_0x11ceb7,_0x5ccff4);return interaction[_0x5781('0x3a')](_0x5781('0x3b'),_0x5ccff4['query'],_0x5ccff4['user'],_0x2c4398,_0x11ceb7)[_0x5781('0x17')](respondWithFilteredResult(_0x578616,_0x2c4398))[_0x5781('0x21')](handleError(_0x578616,null));};exports[_0x5781('0x3c')]=function(_0x5a1fd1,_0xb83d0d){var _0x24dded={'raw':![],'where':{'id':_0x5a1fd1[_0x5781('0x3d')]['id']}},_0x493d2e={};_0x493d2e[_0x5781('0x3e')]=_[_0x5781('0x3f')](db[_0x5781('0x40')]['rawAttributes']);_0x493d2e[_0x5781('0x41')]=_[_0x5781('0x3f')](_0x5a1fd1[_0x5781('0x41')]);_0x493d2e[_0x5781('0x42')]=_['intersection'](_0x493d2e[_0x5781('0x3e')],_0x493d2e[_0x5781('0x41')]);_0x24dded['attributes']=_['intersection'](_0x493d2e[_0x5781('0x3e')],qs['fields'](_0x5a1fd1[_0x5781('0x41')][_0x5781('0x43')]));_0x24dded[_0x5781('0x44')]=_0x24dded['attributes'][_0x5781('0x45')]?_0x24dded[_0x5781('0x44')]:_0x493d2e[_0x5781('0x3e')];if(_0x5a1fd1[_0x5781('0x41')][_0x5781('0x46')]){_0x24dded['include']=[{'all':!![]}];}_0x24dded=_[_0x5781('0x2e')]({},_0x24dded,_0x5a1fd1['options']);return db[_0x5781('0x40')][_0x5781('0x47')](_0x24dded)[_0x5781('0x17')](handleEntityNotFound(_0xb83d0d,null))[_0x5781('0x17')](respondWithResult(_0xb83d0d,null))[_0x5781('0x21')](handleError(_0xb83d0d,null));};exports[_0x5781('0x48')]=function(_0x888371,_0x34d05f){return db[_0x5781('0x40')][_0x5781('0x48')](_0x888371['body'],{})[_0x5781('0x17')](respondWithResult(_0x34d05f,0xc9))[_0x5781('0x21')](handleError(_0x34d05f,null));};exports[_0x5781('0x49')]=function(_0x50d713,_0x49c9ce){if(_0x50d713[_0x5781('0x4a')]['id']){delete _0x50d713[_0x5781('0x4a')]['id'];}return db[_0x5781('0x40')][_0x5781('0x47')]({'where':{'id':_0x50d713[_0x5781('0x3d')]['id']}})[_0x5781('0x17')](handleEntityNotFound(_0x49c9ce,null))[_0x5781('0x17')](saveUpdates(_0x50d713['body'],null))['then'](respondWithResult(_0x49c9ce,null))[_0x5781('0x21')](handleError(_0x49c9ce,null));};exports[_0x5781('0x29')]=function(_0x946f34,_0x32419d){return db[_0x5781('0x40')][_0x5781('0x47')]({'where':{'id':_0x946f34[_0x5781('0x3d')]['id']}})[_0x5781('0x17')](handleEntityNotFound(_0x32419d,null))[_0x5781('0x17')](removeEntity(_0x32419d,null))[_0x5781('0x21')](handleError(_0x32419d,null));};exports[_0x5781('0x4b')]=function(_0x36e4fb,_0x36b276){return db['ChatInteraction'][_0x5781('0x4b')]()[_0x5781('0x17')](respondWithResult(_0x36b276,null))[_0x5781('0x21')](handleError(_0x36b276,null));};exports[_0x5781('0x4c')]=function(_0x5a2600,_0x10ca02){var _0x205adf=_0x5a2600[_0x5781('0x3d')]['id'];var _0x30c77e;var _0x3552a4;var _0x3b9ada;return db[_0x5781('0x40')][_0x5781('0x4d')]({'where':{'id':_0x205adf}})['then'](function(_0x1b845b){_0x30c77e=_0x1b845b;return db[_0x5781('0x4e')][_0x5781('0x4d')]({'where':{'id':_0x1b845b['ChatWebsiteId']},'attributes':['id','vidaooApiKey','vidaooEscalation',_0x5781('0x4f'),'vidaooNote',_0x5781('0x50')],'raw':!![]});})[_0x5781('0x17')](function(_0x5d2515){if(_0x5d2515&&_0x5d2515[_0x5781('0x51')]&&_0x5d2515['vidaooEscalation']){_0x3552a4=_0x5d2515;var _0x139c42={'interaction':{'id':_0x205adf},'agent':{'id':_0x5a2600[_0x5781('0x52')]['id'],'name':_0x5a2600[_0x5781('0x52')][_0x5781('0x53')],'fullname':_0x5a2600[_0x5781('0x52')][_0x5781('0x54')],'email':_0x5a2600[_0x5781('0x52')][_0x5781('0x55')]},'contact':_0x5a2600[_0x5781('0x4a')][_0x5781('0x2f')],'account':_0x5a2600[_0x5781('0x4a')][_0x5781('0x32')]};var _0x340f35={'rejectUnauthorized':![],'method':'POST','url':_0x5781('0x56'),'headers':{'X-APIKEY':_0x5d2515['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5a2600[_0x5781('0x52')][_0x5781('0x55')]],'buttons':null,'topic':_0x3552a4[_0x5781('0x4f')],'note':_['isNull'](_0x3552a4[_0x5781('0x57')])?null:getMustacheRender(_0x3552a4['vidaooNote'],_0x139c42),'metadata':null},'redirect':_0x5781('0x58'),'json':!![]};try{if(!_[_0x5781('0x59')](_0x3552a4[_0x5781('0x50')])){var _0x2751ee=getMustacheRender(_0x3552a4[_0x5781('0x50')],_0x139c42);var _0x4670b1=JSON[_0x5781('0x5a')](_0x2751ee);_0x340f35[_0x5781('0x4a')]['metadata']=_0x4670b1;}}catch(_0x56bfc6){throw new db[(_0x5781('0x5b'))]['ValidationError'](_0x5781('0x5c'));}return rp(_0x340f35);}else{throw new db[(_0x5781('0x5b'))]['ValidationError'](_0x5781('0x5d'));}})[_0x5781('0x17')](function(_0x54796f){_0x3b9ada=_0x54796f;if(_0x3b9ada['id']){var _0x1f7731={'body':_0x3b9ada[_0x5781('0x5e')],'ChatWebsiteId':_0x3552a4['id'],'ChatInteractionId':_0x30c77e['id'],'direction':_0x5781('0x5f'),'UserId':_0x5a2600[_0x5781('0x52')]['id']};return db[_0x5781('0x60')][_0x5781('0x48')](_0x1f7731,{});}else{throw new db[(_0x5781('0x5b'))][(_0x5781('0x61'))](_0x5781('0x62'));}})[_0x5781('0x17')](function(){return _0x30c77e[_0x5781('0x63')]({'vidaooSessionId':_0x3b9ada['id']});})[_0x5781('0x17')](respondWithResult(_0x10ca02,null))[_0x5781('0x21')](handleError(_0x10ca02,null));};exports[_0x5781('0x64')]=function(_0x546adc,_0x49c2d8){if(_0x546adc[_0x5781('0x4a')]['id']){delete _0x546adc[_0x5781('0x4a')]['id'];}return db[_0x5781('0x40')][_0x5781('0x47')]({'where':{'id':_0x546adc[_0x5781('0x3d')]['id']},'include':[{'model':db[_0x5781('0x65')],'as':_0x5781('0x66')}]})['then'](handleEntityNotFound(_0x49c2d8,null))[_0x5781('0x17')](saveUpdates(_0x546adc[_0x5781('0x4a')],null))['then'](respondWithResult(_0x49c2d8,null))[_0x5781('0x21')](handleError(_0x49c2d8,null));};exports[_0x5781('0x67')]=function(_0x53deff,_0x4ba5b9){if(_0x53deff[_0x5781('0x4a')]['id']){delete _0x53deff[_0x5781('0x4a')]['id'];}return db[_0x5781('0x40')][_0x5781('0x47')]({'where':{'id':_0x53deff[_0x5781('0x3d')]['id']}})[_0x5781('0x17')](function(_0x26246b){if(!_0x26246b){logger[_0x5781('0x1d')](_0x5781('0x68'),_0x5781('0x67'),0x194,_0x5781('0x69'));_0x4ba5b9[_0x5781('0x22')](0x194);}else{if(_0x26246b['UserId']){throw new db[(_0x5781('0x5b'))]['ValidationError'](_0x5781('0x6a'));}}return _0x26246b;})[_0x5781('0x17')](function(_0x3fb290){if(_0x3fb290){return _0x3fb290[_0x5781('0x49')]({'closed':_0x53deff[_0x5781('0x4a')][_0x5781('0x6b')],'disposition':_0x53deff['body'][_0x5781('0x6c')]})['then'](function(_0x4dfdeb){return _0x4dfdeb;});}})[_0x5781('0x17')](function(){return respondWithRpcPromise(_0x5781('0x6d'),_0x5781('0x67'),_0x53deff[_0x5781('0x4a')],client9004);})['then'](respondWithResult(_0x4ba5b9,null))[_0x5781('0x21')](handleError(_0x4ba5b9,null));};exports['attachmentUpload']=function(_0x5bdf8b,_0x43d196){_0x5bdf8b[_0x5781('0x4a')]['name']=_0x5bdf8b[_0x5781('0x6e')][_0x5781('0x6f')];_0x5bdf8b[_0x5781('0x4a')]['basename']=_0x5bdf8b[_0x5781('0x6e')][_0x5781('0x70')];_0x5bdf8b[_0x5781('0x4a')][_0x5781('0x37')]=_0x5bdf8b['file'][_0x5781('0x71')];return db['Attachment'][_0x5781('0x48')](_0x5bdf8b[_0x5781('0x4a')])[_0x5781('0x17')](respondWithResult(_0x43d196,0xc9))[_0x5781('0x21')](handleError(_0x43d196,null));};exports[_0x5781('0x72')]=function(_0x5c2c5b,_0x28e8d4){return db[_0x5781('0x40')]['findOne']({'where':{'id':_0x5c2c5b[_0x5781('0x3d')]['id']},'raw':!![]})[_0x5781('0x17')](handleEntityNotFound(_0x28e8d4,null))['then'](function(_0x5479dc){if(_0x5479dc){if(_0x5479dc[_0x5781('0x6b')]){return _0x28e8d4[_0x5781('0x23')](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db[_0x5781('0x73')]['findOne']({'where':{'id':_0x5c2c5b[_0x5781('0x41')][_0x5781('0x74')]},'raw':!![]})[_0x5781('0x17')](handleEntityNotFound(_0x28e8d4,null));}})[_0x5781('0x17')](function(_0x16e01e){if(_0x16e01e){var _0x248d65=_0x16e01e[_0x5781('0x75')]!==null;var _0x5e576f=path[_0x5781('0x76')](config[_0x5781('0x77')],'server/files/attachments/');if(_0x248d65){_0x5e576f=path['join'](_0x5e576f,_0x5781('0x78'));}var _0x504b1a=path[_0x5781('0x76')](_0x5e576f,_0x16e01e[_0x5781('0x79')]);return _0x28e8d4[_0x5781('0x7a')](_0x504b1a);}})['catch'](handleError(_0x28e8d4,null));};exports[_0x5781('0x7b')]=function(_0x548f92,_0x532e56){var _0x4403a3=null;var _0x250cdd=null;var _0x5a59d5=null;if(_0x548f92['body']['id']){delete _0x548f92[_0x5781('0x4a')]['id'];}if(_0x548f92[_0x5781('0x4a')]['mailTranscript']){_0x5a59d5=path[_0x5781('0x76')](config[_0x5781('0x77')],_0x5781('0x7c'),util[_0x5781('0x7d')]('transcript-%s.txt',Date[_0x5781('0x7e')]()));_0x548f92[_0x5781('0x4a')][_0x5781('0x7f')]=_0x5a59d5;}return db[_0x5781('0x40')][_0x5781('0x47')]({'where':{'id':_0x548f92[_0x5781('0x3d')]['id']},'include':[{'model':db[_0x5781('0x60')],'as':_0x5781('0x80'),'include':[{'model':db[_0x5781('0x81')],'as':_0x5781('0x81')}]}]})[_0x5781('0x17')](handleEntityNotFound(_0x532e56,null))[_0x5781('0x17')](saveUpdates(_0x548f92[_0x5781('0x4a')],null))[_0x5781('0x17')](function(_0x28b242){if(_0x28b242){_0x4403a3=_0x28b242;return db['ChatWebsite']['find']({'where':{'id':_0x4403a3[_0x5781('0x82')]}});}})[_0x5781('0x17')](function(_0xbbb5a1){if(_0xbbb5a1){_0x250cdd=_0xbbb5a1;return db['CmContact'][_0x5781('0x47')]({'where':{'id':_0x4403a3[_0x5781('0x83')]}});}})['then'](function(_0x27341a){if(_0x27341a){if(_0x5a59d5){var _0x4b9a19=null;for(var _0x21b498=0x1;_0x21b498<_0x4403a3[_0x5781('0x80')][_0x5781('0x45')];++_0x21b498){_0x4b9a19=_0x4403a3[_0x5781('0x80')][_0x21b498];var _0x20bd97=_0x4b9a19['UserId']?util['format'](_0x5781('0x84'),_0x250cdd[_0x5781('0x85')],_0x4b9a19[_0x5781('0x86')]):'System';var _0x455697=_0x548f92[_0x5781('0x4a')]['customer']||util[_0x5781('0x7d')](_0x5781('0x84'),_0x5781('0x87'),_0x4b9a19[_0x5781('0x83')]);switch(_0x250cdd['agentIdentifier']){case _0x5781('0x88'):_0x20bd97=_0x4b9a19[_0x5781('0x86')]?util[_0x5781('0x7d')](_0x5781('0x84'),_0x250cdd[_0x5781('0x85')],_0x4b9a19[_0x5781('0x86')]):_0x5781('0x89');break;case _0x5781('0x8a'):_0x20bd97=_0x4b9a19['UserId']?_0x4b9a19[_0x5781('0x81')][_0x5781('0x8b')]||_0x4b9a19[_0x5781('0x81')][_0x5781('0x54')]:'System';break;case _0x5781('0x8c'):_0x20bd97=_0x4b9a19[_0x5781('0x86')]?_0x4b9a19[_0x5781('0x81')][_0x5781('0x54')]:_0x5781('0x89');break;default:_0x20bd97=_0x4b9a19[_0x5781('0x86')]?util[_0x5781('0x7d')]('%s%d',_0x250cdd[_0x5781('0x85')],_0x4b9a19[_0x5781('0x86')]):_0x5781('0x89');}var _0x350232=util[_0x5781('0x7d')]('[%s]\x20%s:\x20%s\x0a',moment(_0x4b9a19[_0x5781('0x8d')])[_0x5781('0x7d')](_0x5781('0x8e')),_0x4b9a19[_0x5781('0x8f')]==='in'?_0x455697:_0x20bd97,_0x4b9a19[_0x5781('0x4a')]);if(!_0x4b9a19[_0x5781('0x90')]){fs[_0x5781('0x91')](_0x5a59d5,_0x350232);}}return db[_0x5781('0x92')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x5781('0x93')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x5781('0x94'),'raw':!![]}]}]});}}})[_0x5781('0x17')](function(_0xc9f0eb){if(!_0xc9f0eb||!_0xc9f0eb[_0x5781('0x95')]||!_0x548f92[_0x5781('0x4a')])return _0x4403a3;var _0x4cf994=_0xc9f0eb['getSmtpOptions']();return respondWithRpcPromise(_0x5781('0x96'),_0x5781('0x97'),{'account':_0x4cf994,'message':{'from':util['format'](_0x5781('0x98'),_0xc9f0eb[_0x5781('0x53')],_0xc9f0eb[_0x5781('0x55')]||_0xc9f0eb[_0x5781('0x95')][_0x5781('0x52')]),'to':_0x548f92[_0x5781('0x4a')][_0x5781('0x99')],'subject':_0x5781('0x9a'),'text':util[_0x5781('0x7d')](_0x5781('0x9b'),_0x548f92['body'][_0x5781('0x99')]),'attachments':[{'path':_0x5a59d5}]}})[_0x5781('0x17')](function(){return _0x4403a3;})[_0x5781('0x21')](function(_0x679381){logger['error'](_0x679381);});})[_0x5781('0x17')](respondWithStatusCode(_0x532e56,0xc8))['catch'](handleError(_0x532e56,null));};exports['addMessage']=function(_0x1a8028,_0x2685d5){return db[_0x5781('0x60')][_0x5781('0x47')]({'where':{'id':_0x1a8028[_0x5781('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2685d5,null))[_0x5781('0x17')](function(_0x52557d){if(_0x52557d){return _0x52557d[_0x5781('0x9c')](_0x1a8028[_0x5781('0x4a')][_0x5781('0x9d')],_['omit'](_0x1a8028[_0x5781('0x4a')],[_0x5781('0x9d'),'id'])||{});}})[_0x5781('0x17')](respondWithResult(_0x2685d5,null))[_0x5781('0x21')](handleError(_0x2685d5,null));};exports[_0x5781('0x9e')]=function(_0x5cc144,_0x5df9ee){var _0x12eafc={'raw':![],'where':{}};var _0xe0fd38={};var _0x5cdf2f={'count':0x0,'rows':[]};return db[_0x5781('0x40')][_0x5781('0x4d')]({'where':{'id':_0x5cc144[_0x5781('0x3d')]['id']}})[_0x5781('0x17')](handleEntityNotFound(_0x5df9ee,null))[_0x5781('0x17')](function(_0x470b87){if(_0x470b87){_0xe0fd38[_0x5781('0x3e')]=_[_0x5781('0x3f')](db[_0x5781('0x60')][_0x5781('0x35')]);_0xe0fd38[_0x5781('0x41')]=_['keys'](_0x5cc144[_0x5781('0x41')]);_0xe0fd38[_0x5781('0x42')]=_[_0x5781('0x9f')](_0xe0fd38[_0x5781('0x3e')],_0xe0fd38[_0x5781('0x41')]);_0x12eafc[_0x5781('0x44')]=_[_0x5781('0x9f')](_0xe0fd38[_0x5781('0x3e')],qs[_0x5781('0x43')](_0x5cc144[_0x5781('0x41')]['fields']));_0x12eafc[_0x5781('0x44')]=_0x12eafc[_0x5781('0x44')]['length']?_0x12eafc[_0x5781('0x44')]:_0xe0fd38[_0x5781('0x3e')];if(!_0x5cc144['query'][_0x5781('0xa0')](_0x5781('0xa1'))){_0x12eafc['limit']=qs[_0x5781('0x25')](_0x5cc144[_0x5781('0x41')]['limit']);_0x12eafc[_0x5781('0x24')]=qs[_0x5781('0x24')](_0x5cc144['query'][_0x5781('0x24')]);}_0x12eafc['order']=qs['sort'](_0x5cc144[_0x5781('0x41')][_0x5781('0xa2')]);_0x12eafc[_0x5781('0xa3')]=qs[_0x5781('0x42')](_['pick'](_0x5cc144[_0x5781('0x41')],_0xe0fd38['filters']));_0x12eafc[_0x5781('0xa3')][_0x5781('0xa4')]=_0x470b87['id'];if(_0x5cc144[_0x5781('0x41')]['filter']){_0x12eafc[_0x5781('0xa3')]=_[_0x5781('0x2e')](_0x12eafc[_0x5781('0xa3')],{'$or':_[_0x5781('0x34')](_0x12eafc['attributes'],function(_0x9c1c5){var _0x287f30={};_0x287f30[_0x9c1c5]={'$like':'%'+_0x5cc144['query'][_0x5781('0xa5')]+'%'};return _0x287f30;})});}if(_0x5cc144[_0x5781('0x41')][_0x5781('0xa6')]){var _0x42845f=_0x5cc144['query']['$gte'][_0x5781('0xa7')](',');var _0x9a2e0a={};_0x9a2e0a[_0x42845f[0x0]]={'$gte':moment(_0x42845f[0x1])[_0x5781('0x7d')](_0x5781('0xa8'))};_0x12eafc['where']=_['merge'](_0x12eafc[_0x5781('0xa3')],_0x9a2e0a);}_0x12eafc=_['merge']({},_0x12eafc,_0x5cc144[_0x5781('0xa9')]);return db[_0x5781('0x60')]['count']({'where':_0x12eafc[_0x5781('0xa3')]})['then'](function(_0x2b2f3e){_0x5cdf2f[_0x5781('0x27')]=_0x2b2f3e;if(_0x5cc144[_0x5781('0x41')][_0x5781('0x46')]){_0x12eafc[_0x5781('0xaa')]=[{'all':!![]}];}return db[_0x5781('0x60')][_0x5781('0x3a')](_0x12eafc);})[_0x5781('0x17')](function(_0x1755f7){_0x5cdf2f[_0x5781('0xab')]=_0x1755f7;return _0x5cdf2f;});}})[_0x5781('0x17')](respondWithFilteredResult(_0x5df9ee,_0x12eafc))[_0x5781('0x21')](handleError(_0x5df9ee,null));};exports[_0x5781('0xac')]=function(_0x7acc46,_0x9f9544){var _0x1c157a={'where':{}},_0x24791d={},_0x3e9bcc={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x7acc46['params']['id']}})['then'](handleEntityNotFound(_0x9f9544,null))[_0x5781('0x17')](function(_0x3a195e){if(_0x3a195e){_0x24791d[_0x5781('0x3e')]=_[_0x5781('0x3f')](db[_0x5781('0x60')][_0x5781('0x35')]);_0x24791d['query']=_[_0x5781('0x3f')](_0x7acc46['query']);_0x24791d[_0x5781('0x42')]=_[_0x5781('0x9f')](_0x24791d['model'],_0x24791d[_0x5781('0x41')]);_0x1c157a[_0x5781('0x44')]=_[_0x5781('0x9f')](_0x24791d[_0x5781('0x3e')],qs[_0x5781('0x43')](_0x7acc46['query'][_0x5781('0x43')]));_0x1c157a[_0x5781('0x44')]=_0x1c157a[_0x5781('0x44')][_0x5781('0x45')]?_0x1c157a[_0x5781('0x44')]:_0x24791d[_0x5781('0x3e')];if(!_0x7acc46[_0x5781('0x41')][_0x5781('0xa0')](_0x5781('0xa1'))){_0x1c157a[_0x5781('0x25')]=qs[_0x5781('0x25')](_0x7acc46[_0x5781('0x41')][_0x5781('0x25')]);_0x1c157a['offset']=qs['offset'](_0x7acc46[_0x5781('0x41')][_0x5781('0x24')]);}_0x1c157a[_0x5781('0xad')]=qs[_0x5781('0xa2')](_0x7acc46[_0x5781('0x41')]['sort']);_0x1c157a['where']=qs[_0x5781('0x42')](_[_0x5781('0xae')](_0x7acc46[_0x5781('0x41')],_0x24791d[_0x5781('0x42')]));_0x1c157a[_0x5781('0xa3')]['ChatInteractionId']=_0x3a195e['id'];if(_0x7acc46[_0x5781('0x41')][_0x5781('0xa5')]){_0x1c157a[_0x5781('0xa3')]=_[_0x5781('0x2e')](_0x1c157a[_0x5781('0xa3')],{'$or':_['map'](_0x1c157a[_0x5781('0x44')],function(_0x51ff80){var _0x4cbad2={};_0x4cbad2[_0x51ff80]={'$like':'%'+_0x7acc46[_0x5781('0x41')][_0x5781('0xa5')]+'%'};return _0x4cbad2;})});}_0x1c157a[_0x5781('0xa3')][_0x5781('0x90')]=![];if(_0x7acc46['query']['id']){_0x1c157a[_0x5781('0xa3')]['id']={'$gt':_0x7acc46[_0x5781('0x41')]['id']};}_0x1c157a=_['merge']({},_0x1c157a,_0x7acc46[_0x5781('0xa9')]);return db[_0x5781('0x60')][_0x5781('0x27')]({'where':_0x1c157a[_0x5781('0xa3')]})['then'](function(_0x536b4e){_0x3e9bcc[_0x5781('0x27')]=_0x536b4e;_0x1c157a[_0x5781('0xaa')]=[];if(_0x7acc46[_0x5781('0x41')][_0x5781('0xaf')]){_0x1c157a[_0x5781('0xaa')][_0x5781('0xb0')]({'model':db[_0x5781('0x81')],'as':_0x5781('0x81'),'attributes':['id',_0x5781('0x54'),_0x5781('0x8b')]});}if(_0x7acc46[_0x5781('0x41')][_0x5781('0x46')]){_0x1c157a[_0x5781('0xaa')]=[{'all':!![]}];}return db[_0x5781('0x60')][_0x5781('0x3a')](_0x1c157a);})[_0x5781('0x17')](function(_0x399066){_0x3e9bcc['rows']=_0x399066;return _0x3e9bcc;});}})[_0x5781('0x17')](respondWithFilteredResult(_0x9f9544,_0x1c157a))[_0x5781('0x21')](handleError(_0x9f9544,null));};exports['addTags']=function(_0x1620f8,_0x356f20){return db[_0x5781('0x40')][_0x5781('0x47')]({'where':{'id':_0x1620f8['params']['id']}})[_0x5781('0x17')](handleEntityNotFound(_0x356f20,null))[_0x5781('0x17')](function(_0x553f89){if(_0x553f89){return _0x553f89[_0x5781('0xb1')](_0x1620f8['body']['ids'],_[_0x5781('0xb2')](_0x1620f8[_0x5781('0x4a')],['ids','id'])||{})[_0x5781('0xb3')](function(){return db[_0x5781('0xb4')][_0x5781('0x3a')]({'attributes':['id',_0x5781('0x53'),'color'],'where':{'id':_0x1620f8[_0x5781('0x4a')]['ids']}});})[_0x5781('0x17')](function(_0x33ccc3){socket[_0x5781('0xb5')]('chatInteractionTags:save',{'id':Number(_0x1620f8[_0x5781('0x3d')]['id']),'tags':_0x33ccc3||[]});return{'id':Number(_0x1620f8['params']['id']),'tags':_0x33ccc3||[]};});}})[_0x5781('0x17')](respondWithResult(_0x356f20,null))['catch'](handleError(_0x356f20,null));};exports['removeTags']=function(_0x5395b5,_0x3589a9){return db[_0x5781('0x40')][_0x5781('0x47')]({'where':{'id':_0x5395b5[_0x5781('0x3d')]['id']}})[_0x5781('0x17')](handleEntityNotFound(_0x3589a9,null))[_0x5781('0x17')](function(_0x5e1d53){if(_0x5e1d53){return _0x5e1d53[_0x5781('0xb6')](_0x5395b5['query'][_0x5781('0x9d')]);}})[_0x5781('0x17')](respondWithStatusCode(_0x3589a9,null))[_0x5781('0x21')](handleError(_0x3589a9,null));};exports['download']=function(_0x1fd201,_0x5916e2){var _0x42ee87=moment()[_0x5781('0xb7')]()[_0x5781('0xb8')]();var _0x40c21d=path[_0x5781('0x76')](config[_0x5781('0x77')],_0x5781('0xb9'),'files',_0x5781('0xba'));var _0x770fef=path[_0x5781('0x76')](config[_0x5781('0x77')],_0x5781('0xb9'),_0x5781('0xbb'),_0x5781('0xbc'));var _0x591502=path['join'](_0x40c21d,_0x42ee87);var _0x544a55=util[_0x5781('0x7d')](_0x5781('0xbd'),_0x1fd201[_0x5781('0x3d')]['id'],_0x42ee87);var _0x4a4be0=path[_0x5781('0x76')](_0x40c21d,_0x544a55);var _0x5867e9=[];_0x5867e9['push']({'model':db[_0x5781('0x81')],'as':_0x5781('0x81'),'attributes':['id',_0x5781('0x54')],'raw':!![]});_0x5867e9[_0x5781('0xb0')]({'model':db[_0x5781('0x65')],'as':_0x5781('0x66'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x1fd201[_0x5781('0x41')][_0x5781('0xbc')]){_0x5867e9[_0x5781('0xb0')]({'model':db[_0x5781('0x73')],'as':_0x5781('0x73'),'raw':!![]});}var _0x48f307=[{'model':db['ChatMessage'],'as':_0x5781('0x80'),'attributes':['id',_0x5781('0x4a'),'createdAt',_0x5781('0x8f'),_0x5781('0x90'),_0x5781('0xbe')],'include':_0x5867e9}];_0x48f307[_0x5781('0xb0')]({'model':db[_0x5781('0x4e')],'as':_0x5781('0xbf'),'attributes':['id',_0x5781('0x53')]});_0x48f307[_0x5781('0xb0')]({'model':db[_0x5781('0x81')],'as':_0x5781('0xc0'),'attributes':['id',_0x5781('0x54')]});return db[_0x5781('0x40')][_0x5781('0x47')]({'where':{'id':_0x1fd201[_0x5781('0x3d')]['id']},'include':_0x48f307})[_0x5781('0x17')](handleEntityNotFound(_0x5916e2,null))[_0x5781('0x17')](function(_0x3e30b9){if(_0x3e30b9){var _0x5222ec=_0x3e30b9['get']({'plain':!![]});fs['mkdirSync'](_0x591502);var _0x39aec2={'channel':_0x5781('0xc1'),'account':_0x5222ec[_0x5781('0xbf')]['name'],'agent':_0x5222ec['Owner']?_0x5222ec[_0x5781('0xc0')]['fullname']:'N.A.','createdAt':moment(_0x5222ec[_0x5781('0x8d')])[_0x5781('0x7d')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5781('0xb8')](),'closedAt':_0x5222ec[_0x5781('0x6b')]?moment(_0x5222ec['closedAt'])[_0x5781('0x7d')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5781('0xb8')]():'','disposition':_0x5222ec['disposition'],'chatInfo':{'browser':_0x5222ec[_0x5781('0xc2')],'os':_0x5222ec[_0x5781('0xc3')],'referer':_0x5222ec[_0x5781('0xc4')],'customerIp':_0x5222ec[_0x5781('0xc5')],'customerPort':_0x5222ec[_0x5781('0xc6')]?_0x5222ec[_0x5781('0xc6')]:_0x5781('0xc7')},'messages':_(_0x5222ec['Messages'])['tail']()[_0x5781('0xa5')]({'secret':![]})[_0x5781('0x34')](function(_0x235993){if(_0x235993['Attachment']){var _0x1b33a4=path['join'](_0x770fef,_0x235993[_0x5781('0x73')][_0x5781('0x79')]);if(fs[_0x5781('0xc8')](_0x1b33a4)){fs[_0x5781('0xc9')](_0x1b33a4)['pipe'](fs[_0x5781('0xca')](path[_0x5781('0x76')](_0x591502,_0x235993['Attachment'][_0x5781('0x79')])));}}return{'date':moment(_0x235993[_0x5781('0x8d')])['format'](_0x5781('0xa8'))[_0x5781('0xb8')](),'sender':_0x235993['direction']===_0x5781('0x5f')?_0x235993['User']?_0x235993[_0x5781('0x81')][_0x5781('0x54')]:_0x5781('0x89'):_0x235993[_0x5781('0x66')][_0x5781('0xcb')]+(_0x235993[_0x5781('0x66')][_0x5781('0xcc')]?'\x20'+_0x235993[_0x5781('0x66')][_0x5781('0xcc')]:''),'body':_0x235993[_0x5781('0x73')]?_0x235993[_0x5781('0x73')][_0x5781('0x79')]:_0x235993[_0x5781('0x4a')],'direction':_0x235993[_0x5781('0x8f')]===_0x5781('0x5f')?'A':'C','secret':_0x235993[_0x5781('0x90')],'read':_0x235993[_0x5781('0xbe')],'attachment':_0x235993[_0x5781('0x73')]};})[_0x5781('0xcd')]()};return ejs[_0x5781('0xce')](path[_0x5781('0x76')](config[_0x5781('0x77')],_0x5781('0xb9'),'views',_0x5781('0xcf')),{'interaction':_0x39aec2})[_0x5781('0x17')](function(_0x1c6c71){var _0x4410cb=path[_0x5781('0x76')](_0x591502,'transcript-'+_0x5222ec['id']+'-'+_0x42ee87+'.pdf');var _0x22e106={'path':_0x4410cb,'channel':_0x5781('0xc1'),'interactionId':_0x5222ec['id']};return pdf[_0x5781('0xd0')](_0x1c6c71,_0x22e106);})[_0x5781('0x17')](function(){return new Promise(function(_0x278d8e,_0x21d868){zipdir(_0x591502,{'saveTo':_0x4a4be0},function(_0x48510c,_0x2c343e){if(_0x48510c)return _0x21d868(_0x48510c);return _0x278d8e(_0x2c343e);});})[_0x5781('0x17')](function(){return new BPromise(function(_0x54dfe2,_0x299bf5){rimraf(_0x591502,function(_0x2516ce){if(_0x2516ce)_0x299bf5(_0x2516ce);return _0x54dfe2();});});})[_0x5781('0x17')](function(){return _0x5916e2['download'](_0x4a4be0,_0x544a55,function(_0x43e2b3){if(_0x43e2b3){logger['error'](_0x5781('0xd1'),_0x43e2b3);}else{fs[_0x5781('0xd2')](_0x4a4be0);}});});});}else{return _0x5916e2[_0x5781('0x22')](0xc8);}})['catch'](handleError(_0x5916e2,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 974d2d2..64bed95 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 _0x40f8=['setMaxListeners','save','update','getUsers','then','setDataValue','map','findAll','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','ChatMessage'];(function(_0x209603,_0x351b88){var _0x3e06d4=function(_0x4e9655){while(--_0x4e9655){_0x209603['push'](_0x209603['shift']());}};_0x3e06d4(++_0x351b88);}(_0x40f8,0x17e));var _0x840f=function(_0x299686,_0x39ac7e){_0x299686=_0x299686-0x0;var _0x444c00=_0x40f8[_0x299686];return _0x444c00;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x840f('0x0'))['db']['ChatInteraction'];var ChatMessage=require(_0x840f('0x0'))['db'][_0x840f('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x840f('0x2')](0x0);var events={'afterCreate':_0x840f('0x3'),'afterUpdate':_0x840f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x6b3a15){return function(_0x41c58d,_0x270d0e,_0x1f0271){_0x41c58d[_0x840f('0x5')]({'attributes':['id'],'raw':!![]})[_0x840f('0x6')](function(_0x359906){_0x41c58d[_0x840f('0x7')]('Users',_0x359906[_0x840f('0x8')](function(_0x246e15){return{'id':_0x246e15['id']};}));return ChatMessage[_0x840f('0x9')]({'where':{'ChatInteractionId':_0x41c58d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x840f('0x6')](function(_0x5151cf){_0x41c58d['setDataValue']('unreadMessages',_0x5151cf[_0x840f('0xa')]);ChatInteractionEvents[_0x840f('0xb')](_0x6b3a15+':'+_0x41c58d['id'],_0x41c58d);ChatInteractionEvents[_0x840f('0xb')](_0x6b3a15,_0x41c58d);_0x1f0271(null);})[_0x840f('0xc')](_0x1f0271(null));};}for(var e in events){if(events[_0x840f('0xd')](e)){var event=events[e];ChatInteraction[_0x840f('0xe')](e,emitEvent(event));}}module[_0x840f('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0x3e96=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','ChatInteraction','../../mysqldb','ChatMessage','save'];(function(_0x994307,_0x2e2762){var _0x503ced=function(_0x1c46f2){while(--_0x1c46f2){_0x994307['push'](_0x994307['shift']());}};_0x503ced(++_0x2e2762);}(_0x3e96,0x1c7));var _0x63e9=function(_0x29df9a,_0x42aff3){_0x29df9a=_0x29df9a-0x0;var _0x3a8e96=_0x3e96[_0x29df9a];return _0x3a8e96;};'use strict';var EventEmitter=require(_0x63e9('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x63e9('0x1')];var ChatMessage=require(_0x63e9('0x2'))['db'][_0x63e9('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x63e9('0x4'),'afterUpdate':_0x63e9('0x5'),'afterDestroy':_0x63e9('0x6')};function emitEvent(_0x24a618){return function(_0x55f85c,_0x465743,_0x950b16){_0x55f85c[_0x63e9('0x7')]({'attributes':['id'],'raw':!![]})[_0x63e9('0x8')](function(_0x3fae4b){_0x55f85c[_0x63e9('0x9')](_0x63e9('0xa'),_0x3fae4b[_0x63e9('0xb')](function(_0x31757d){return{'id':_0x31757d['id']};}));return ChatMessage[_0x63e9('0xc')]({'where':{'ChatInteractionId':_0x55f85c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x63e9('0x8')](function(_0x37992e){_0x55f85c[_0x63e9('0x9')](_0x63e9('0xd'),_0x37992e[_0x63e9('0xe')]);ChatInteractionEvents[_0x63e9('0xf')](_0x24a618+':'+_0x55f85c['id'],_0x55f85c);ChatInteractionEvents['emit'](_0x24a618,_0x55f85c);_0x950b16(null);})[_0x63e9('0x10')](_0x950b16(null));};}for(var e in events){if(events[_0x63e9('0x11')](e)){var event=events[e];ChatInteraction[_0x63e9('0x12')](e,emitEvent(event));}}module[_0x63e9('0x13')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index b579789..ee41cfa 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 _0x7ddb=['YYYY-MM-DD\x20HH:mm:ss','utf8mb4','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format'];(function(_0x11b58d,_0x555c55){var _0xc2811b=function(_0x396d22){while(--_0x396d22){_0x11b58d['push'](_0x11b58d['shift']());}};_0xc2811b(++_0x555c55);}(_0x7ddb,0x1c4));var _0xb7dd=function(_0x2450f3,_0x287cbf){_0x2450f3=_0x2450f3-0x0;var _0x537258=_0x7ddb[_0x2450f3];return _0x537258;};'use strict';var _=require('lodash');var util=require(_0xb7dd('0x0'));var logger=require(_0xb7dd('0x1'))(_0xb7dd('0x2'));var moment=require(_0xb7dd('0x3'));var BPromise=require(_0xb7dd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb7dd('0x5'));var rimraf=require('rimraf');var config=require(_0xb7dd('0x6'));var attributes=require(_0xb7dd('0x7'));module[_0xb7dd('0x8')]=function(_0x377682,_0x5650ca){return _0x377682[_0xb7dd('0x9')](_0xb7dd('0xa'),attributes,{'tableName':_0xb7dd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x264aa7,_0xd56b1,_0x412561){if(_0x264aa7[_0xb7dd('0xc')](_0xb7dd('0xd'))){_0x264aa7[_0xb7dd('0xe')]=moment()[_0xb7dd('0xf')](_0xb7dd('0x10'));}_0x412561(null,_0x264aa7);}},'charset':_0xb7dd('0x11'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3be1=['changed','closed','format','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','ChatInteraction','chat_interactions'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3be1,0xc7));var _0x13be=function(_0x1204e8,_0x56d4d2){_0x1204e8=_0x1204e8-0x0;var _0x4f7b9e=_0x3be1[_0x1204e8];return _0x4f7b9e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x13be('0x0'))(_0x13be('0x1'));var moment=require(_0x13be('0x2'));var BPromise=require(_0x13be('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x13be('0x4'));var rimraf=require(_0x13be('0x5'));var config=require(_0x13be('0x6'));var attributes=require('./chatInteraction.attributes');module[_0x13be('0x7')]=function(_0x1dae8b,_0x54f4df){return _0x1dae8b[_0x13be('0x8')](_0x13be('0x9'),attributes,{'tableName':_0x13be('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d496d,_0x34dec1,_0x5c94ab){if(_0x2d496d[_0x13be('0xb')](_0x13be('0xc'))){_0x2d496d['closedAt']=moment()[_0x13be('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5c94ab(null,_0x2d496d);}},'charset':'utf8mb4','collate':_0x13be('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index a628812..76e8d75 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 _0x1e9c=['message','result','catch','ChatInteraction','update','body','options','raw','where','attributes','limit','then','UpdateChatInteraction','AddTagsToChatInteraction','find','addTags','omit','ids','spread','AddTags','lodash','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','register','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x1e9c,0x133));var _0xc1e9=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x1e9c[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0xc1e9('0x0'));var util=require('util');var moment=require(_0xc1e9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc1e9('0x2'));var db=require(_0xc1e9('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc1e9('0x4'));var config=require(_0xc1e9('0x5'));var jayson=require(_0xc1e9('0x6'));var client=jayson['client'][_0xc1e9('0x7')]({'port':0x232a});config[_0xc1e9('0x8')]=_[_0xc1e9('0x9')](config[_0xc1e9('0x8')],{'host':_0xc1e9('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc1e9('0x8')]));require('./chatInteraction.socket')[_0xc1e9('0xb')](socket);function respondWithRpcPromise(_0x34a936,_0x2430f3,_0x36ae0e){return new BPromise(function(_0x16b827,_0x5c785b){return client[_0xc1e9('0xc')](_0x34a936,_0x36ae0e)['then'](function(_0x256eb9){logger[_0xc1e9('0xd')](_0xc1e9('0xe'),_0x2430f3,_0xc1e9('0xf'));logger[_0xc1e9('0x10')](_0xc1e9('0x11'),_0x2430f3,'request\x20sent',JSON[_0xc1e9('0x12')](_0x256eb9));if(_0x256eb9['error']){if(_0x256eb9[_0xc1e9('0x13')][_0xc1e9('0x14')]===0x1f4){logger[_0xc1e9('0x13')](_0xc1e9('0xe'),_0x2430f3,_0x256eb9[_0xc1e9('0x13')][_0xc1e9('0x15')]);return _0x5c785b(_0x256eb9['error']['message']);}logger[_0xc1e9('0x13')](_0xc1e9('0xe'),_0x2430f3,_0x256eb9[_0xc1e9('0x13')][_0xc1e9('0x15')]);return _0x16b827(_0x256eb9[_0xc1e9('0x13')][_0xc1e9('0x15')]);}else{logger[_0xc1e9('0xd')](_0xc1e9('0xe'),_0x2430f3,_0xc1e9('0xf'));_0x16b827(_0x256eb9[_0xc1e9('0x16')][_0xc1e9('0x15')]);}})[_0xc1e9('0x17')](function(_0x5b6404){logger['error'](_0xc1e9('0xe'),_0x2430f3,_0x5b6404);_0x5c785b(_0x5b6404);});});}exports['UpdateChatInteraction']=function(_0x51b6cc){var _0x42167d=this;return new Promise(function(_0x4c342f,_0x4e923d){return db[_0xc1e9('0x18')][_0xc1e9('0x19')](_0x51b6cc[_0xc1e9('0x1a')],{'raw':_0x51b6cc['options']?_0x51b6cc[_0xc1e9('0x1b')][_0xc1e9('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51b6cc['options']?_0x51b6cc['options'][_0xc1e9('0x1d')]||null:null,'attributes':_0x51b6cc[_0xc1e9('0x1b')]?_0x51b6cc['options'][_0xc1e9('0x1e')]||null:null,'limit':_0x51b6cc['options']?_0x51b6cc[_0xc1e9('0x1b')][_0xc1e9('0x1f')]||null:null})[_0xc1e9('0x20')](function(_0x2829bb){logger[_0xc1e9('0xd')](_0xc1e9('0x21'),_0x51b6cc);logger[_0xc1e9('0x10')](_0xc1e9('0x21'),_0x51b6cc,JSON['stringify'](_0x2829bb));_0x4c342f(_0x2829bb);})['catch'](function(_0xd93223){logger[_0xc1e9('0x13')](_0xc1e9('0x21'),_0xd93223[_0xc1e9('0x15')],_0x51b6cc);_0x4e923d(_0x42167d['error'](0x1f4,_0xd93223['message']));});});};exports[_0xc1e9('0x22')]=function(_0x495481){return new Promise(function(_0x1fe49e,_0x363c39){return db[_0xc1e9('0x18')][_0xc1e9('0x23')]({'where':_0x495481[_0xc1e9('0x1b')]?_0x495481[_0xc1e9('0x1b')][_0xc1e9('0x1d')]||null:null})[_0xc1e9('0x20')](function(_0x2a3fd3){if(_0x2a3fd3){return _0x2a3fd3[_0xc1e9('0x24')](_0x495481[_0xc1e9('0x1a')]['ids'],_[_0xc1e9('0x25')](_0x495481[_0xc1e9('0x1a')],[_0xc1e9('0x26'),'id'])||{});}})[_0xc1e9('0x27')](function(_0x2af7bc){logger['info'](_0xc1e9('0x28'),_0x495481);logger[_0xc1e9('0x10')](_0xc1e9('0x28'),_0x495481,JSON[_0xc1e9('0x12')](_0x2af7bc));_0x1fe49e(_0x2af7bc);})['catch'](function(_0xb3f29d){logger[_0xc1e9('0x13')](_0xc1e9('0x28'),_0xb3f29d[_0xc1e9('0x15')],_0x495481);_0x363c39(_this[_0xc1e9('0x13')](0x1f4,_0xb3f29d[_0xc1e9('0x15')]));});});}; \ No newline at end of file +var _0x3432=['code','message','result','catch','options','raw','attributes','limit','then','UpdateChatInteraction','debug','AddTagsToChatInteraction','ChatInteraction','find','where','ids','omit','body','spread','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','socket.io-emitter','./chatInteraction.socket','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1ff911,_0x1d2823){var _0x557082=function(_0x247a45){while(--_0x247a45){_0x1ff911['push'](_0x1ff911['shift']());}};_0x557082(++_0x1d2823);}(_0x3432,0x1c1));var _0x2343=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3432[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x2343('0x0'));var util=require(_0x2343('0x1'));var moment=require(_0x2343('0x2'));var BPromise=require('bluebird');var rs=require(_0x2343('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2343('0x4'))['db'];var utils=require(_0x2343('0x5'));var logger=require('../../config/logger')(_0x2343('0x6'));var config=require('../../config/environment');var jayson=require(_0x2343('0x7'));var client=jayson['client'][_0x2343('0x8')]({'port':0x232a});config[_0x2343('0x9')]=_['defaults'](config[_0x2343('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x2343('0xa'))(new Redis(config[_0x2343('0x9')]));require(_0x2343('0xb'))['register'](socket);function respondWithRpcPromise(_0x37bfdd,_0x1609cd,_0x26fe67){return new BPromise(function(_0x9c5f3b,_0x39d702){return client[_0x2343('0xc')](_0x37bfdd,_0x26fe67)['then'](function(_0x271f6b){logger[_0x2343('0xd')](_0x2343('0xe'),_0x1609cd,_0x2343('0xf'));logger['debug'](_0x2343('0x10'),_0x1609cd,'request\x20sent',JSON[_0x2343('0x11')](_0x271f6b));if(_0x271f6b[_0x2343('0x12')]){if(_0x271f6b[_0x2343('0x12')][_0x2343('0x13')]===0x1f4){logger[_0x2343('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x1609cd,_0x271f6b[_0x2343('0x12')][_0x2343('0x14')]);return _0x39d702(_0x271f6b['error'][_0x2343('0x14')]);}logger[_0x2343('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x1609cd,_0x271f6b[_0x2343('0x12')][_0x2343('0x14')]);return _0x9c5f3b(_0x271f6b['error'][_0x2343('0x14')]);}else{logger[_0x2343('0xd')](_0x2343('0xe'),_0x1609cd,_0x2343('0xf'));_0x9c5f3b(_0x271f6b[_0x2343('0x15')][_0x2343('0x14')]);}})[_0x2343('0x16')](function(_0x525829){logger[_0x2343('0x12')](_0x2343('0xe'),_0x1609cd,_0x525829);_0x39d702(_0x525829);});});}exports['UpdateChatInteraction']=function(_0x34665a){var _0x539412=this;return new Promise(function(_0x2d7b6e,_0x376174){return db['ChatInteraction']['update'](_0x34665a['body'],{'raw':_0x34665a[_0x2343('0x17')]?_0x34665a['options'][_0x2343('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34665a[_0x2343('0x17')]?_0x34665a[_0x2343('0x17')]['where']||null:null,'attributes':_0x34665a[_0x2343('0x17')]?_0x34665a[_0x2343('0x17')][_0x2343('0x19')]||null:null,'limit':_0x34665a[_0x2343('0x17')]?_0x34665a[_0x2343('0x17')][_0x2343('0x1a')]||null:null})[_0x2343('0x1b')](function(_0x4e0b28){logger[_0x2343('0xd')](_0x2343('0x1c'),_0x34665a);logger[_0x2343('0x1d')](_0x2343('0x1c'),_0x34665a,JSON[_0x2343('0x11')](_0x4e0b28));_0x2d7b6e(_0x4e0b28);})[_0x2343('0x16')](function(_0x843a6){logger['error'](_0x2343('0x1c'),_0x843a6['message'],_0x34665a);_0x376174(_0x539412['error'](0x1f4,_0x843a6['message']));});});};exports[_0x2343('0x1e')]=function(_0x2ccabe){return new Promise(function(_0x51449a,_0x54407e){return db[_0x2343('0x1f')][_0x2343('0x20')]({'where':_0x2ccabe[_0x2343('0x17')]?_0x2ccabe[_0x2343('0x17')][_0x2343('0x21')]||null:null})[_0x2343('0x1b')](function(_0x25b706){if(_0x25b706){return _0x25b706['addTags'](_0x2ccabe['body'][_0x2343('0x22')],_[_0x2343('0x23')](_0x2ccabe[_0x2343('0x24')],['ids','id'])||{});}})[_0x2343('0x25')](function(_0x43b6a6){logger[_0x2343('0xd')](_0x2343('0x26'),_0x2ccabe);logger[_0x2343('0x1d')](_0x2343('0x26'),_0x2ccabe,JSON[_0x2343('0x11')](_0x43b6a6));_0x51449a(_0x43b6a6);})['catch'](function(_0x477147){logger['error'](_0x2343('0x26'),_0x477147[_0x2343('0x14')],_0x2ccabe);_0x54407e(_this['error'](0x1f4,_0x477147[_0x2343('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 34fc617..f2ac622 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 _0x22c5=['remove','removeListener','register','length','chatInteraction:'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x22c5,0x6e));var _0x522c=function(_0x156098,_0x3bf5e4){_0x156098=_0x156098-0x0;var _0x146fae=_0x22c5[_0x156098];return _0x146fae;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0x522c('0x0'),'update'];function createListener(_0x4a314d,_0x26aaf5){return function(_0x510943){_0x26aaf5['emit'](_0x4a314d,_0x510943);};}function removeListener(_0x561452,_0x549f75){return function(){ChatInteractionEvents[_0x522c('0x1')](_0x561452,_0x549f75);};}exports[_0x522c('0x2')]=function(_0x84e973){for(var _0x3be57e=0x0,_0x1ecf19=events[_0x522c('0x3')];_0x3be57e<_0x1ecf19;_0x3be57e++){var _0x484e03=events[_0x3be57e];var _0x4d495e=createListener(_0x522c('0x4')+_0x484e03,_0x84e973);ChatInteractionEvents['on'](_0x484e03,_0x4d495e);}}; \ No newline at end of file +var _0x564c=['save','remove','update','emit','register','length','chatInteraction:','./chatInteraction.events'];(function(_0x2f29a5,_0x486f4a){var _0x1bbfae=function(_0x22652e){while(--_0x22652e){_0x2f29a5['push'](_0x2f29a5['shift']());}};_0x1bbfae(++_0x486f4a);}(_0x564c,0xe7));var _0xc564=function(_0x200045,_0x4e5da1){_0x200045=_0x200045-0x0;var _0x566a8d=_0x564c[_0x200045];return _0x566a8d;};'use strict';var ChatInteractionEvents=require(_0xc564('0x0'));var events=[_0xc564('0x1'),_0xc564('0x2'),_0xc564('0x3')];function createListener(_0x363ba3,_0x5597df){return function(_0x58ad7b){_0x5597df[_0xc564('0x4')](_0x363ba3,_0x58ad7b);};}function removeListener(_0x38a70c,_0x1fceee){return function(){ChatInteractionEvents['removeListener'](_0x38a70c,_0x1fceee);};}exports[_0xc564('0x5')]=function(_0x32bbc9){for(var _0x147c03=0x0,_0x149eec=events[_0xc564('0x6')];_0x147c03<_0x149eec;_0x147c03++){var _0x19ca48=events[_0x147c03];var _0xe00518=createListener(_0xc564('0x7')+_0x19ca48,_0x32bbc9);ChatInteractionEvents['on'](_0x19ca48,_0xe00518);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 72707df..0b4803a 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 _0x6d3e=['../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','isChatInteractionAuthorized','/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','post','/:id/vidaoo','join','format','originalname','file','/:id/tags','tracked','chat','addTags','put','/:id','chatinteraction:update','/:id/custom_update','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','removeTags','exports','multer','Router','fs-extra','../../components/auth/service'];(function(_0x344f5c,_0x20945c){var _0x40ff5f=function(_0x2323bd){while(--_0x2323bd){_0x344f5c['push'](_0x344f5c['shift']());}};_0x40ff5f(++_0x20945c);}(_0x6d3e,0x196));var _0xe6d3=function(_0x4ce479,_0x116f2a){_0x4ce479=_0x4ce479-0x0;var _0x38bb9d=_0x6d3e[_0x4ce479];return _0x38bb9d;};'use strict';var multer=require(_0xe6d3('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe6d3('0x1')]();var fs_extra=require(_0xe6d3('0x2'));var auth=require(_0xe6d3('0x3'));var interaction=require(_0xe6d3('0x4'));var config=require(_0xe6d3('0x5'));var controller=require(_0xe6d3('0x6'));router[_0xe6d3('0x7')]('/',auth[_0xe6d3('0x8')](),controller[_0xe6d3('0x9')]);router[_0xe6d3('0x7')](_0xe6d3('0xa'),auth['isAuthenticated'](),controller[_0xe6d3('0xb')]);router[_0xe6d3('0x7')]('/:id',auth[_0xe6d3('0xc')](),controller['show']);router[_0xe6d3('0x7')](_0xe6d3('0xd'),auth[_0xe6d3('0xc')](),controller['attachmentDownload']);router['get'](_0xe6d3('0xe'),auth[_0xe6d3('0x8')](),controller[_0xe6d3('0xf')]);router[_0xe6d3('0x7')](_0xe6d3('0x10'),auth['isChatInteractionAuthorized'](),controller[_0xe6d3('0x11')]);router[_0xe6d3('0x7')](_0xe6d3('0x12'),auth[_0xe6d3('0x8')](),controller['download']);router['post']('/',auth[_0xe6d3('0x8')](),controller['create']);router[_0xe6d3('0x13')](_0xe6d3('0x14'),auth[_0xe6d3('0x8')](),controller['createVidaooSession']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x39ee23,_0x11dfb5,_0x152d24){_0x152d24(null,path[_0xe6d3('0x15')](config['root'],'server/files/attachments/'));},'filename':function(_0x59719d,_0x25c5b6,_0x128401){_0x128401(null,util[_0xe6d3('0x16')]('%s-%s',Date['now'](),_0x25c5b6[_0xe6d3('0x17')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload['single'](_0xe6d3('0x18')),controller['attachmentUpload']);router[_0xe6d3('0x13')](_0xe6d3('0xe'),auth[_0xe6d3('0xc')](),controller['addMessage']);router[_0xe6d3('0x13')](_0xe6d3('0x19'),auth['isAuthenticated'](),interaction[_0xe6d3('0x1a')](_0xe6d3('0x1b'),'chatinteraction:addtags'),controller[_0xe6d3('0x1c')]);router[_0xe6d3('0x1d')](_0xe6d3('0x1e'),auth[_0xe6d3('0x8')](),interaction[_0xe6d3('0x1a')](_0xe6d3('0x1b'),_0xe6d3('0x1f')),controller['update']);router[_0xe6d3('0x1d')](_0xe6d3('0x20'),controller['customUpdate']);router[_0xe6d3('0x1d')](_0xe6d3('0x21'),auth[_0xe6d3('0xc')](),controller[_0xe6d3('0x22')]);router[_0xe6d3('0x1d')](_0xe6d3('0x23'),controller[_0xe6d3('0x24')]);router[_0xe6d3('0x25')](_0xe6d3('0x1e'),auth['isAuthenticated'](),interaction[_0xe6d3('0x1a')](_0xe6d3('0x1b'),_0xe6d3('0x26')),controller['destroy']);router['delete'](_0xe6d3('0x19'),auth[_0xe6d3('0x8')](),controller[_0xe6d3('0x27')]);module[_0xe6d3('0x28')]=router; \ No newline at end of file +var _0x4a4f=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','getMyMessages','post','/:id/vidaoo','createVidaooSession','diskStorage','root','server/files/attachments/','format','%s-%s','replace','/:id/attachment_upload','single','file','/:id/messages','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','/:id','chatinteraction:update','update','customUpdate','/:id/abandon','close','chatinteraction:destroy','destroy','delete','exports','multer','util'];(function(_0x256bfc,_0x26e6ff){var _0x5cdd26=function(_0x51b296){while(--_0x51b296){_0x256bfc['push'](_0x256bfc['shift']());}};_0x5cdd26(++_0x26e6ff);}(_0x4a4f,0x1a5));var _0xf4a4=function(_0xb6dab7,_0x209af0){_0xb6dab7=_0xb6dab7-0x0;var _0x9d51a7=_0x4a4f[_0xb6dab7];return _0x9d51a7;};'use strict';var multer=require(_0xf4a4('0x0'));var util=require(_0xf4a4('0x1'));var path=require('path');var timeout=require(_0xf4a4('0x2'));var express=require(_0xf4a4('0x3'));var router=express['Router']();var fs_extra=require(_0xf4a4('0x4'));var auth=require(_0xf4a4('0x5'));var interaction=require(_0xf4a4('0x6'));var config=require(_0xf4a4('0x7'));var controller=require(_0xf4a4('0x8'));router[_0xf4a4('0x9')]('/',auth[_0xf4a4('0xa')](),controller[_0xf4a4('0xb')]);router[_0xf4a4('0x9')](_0xf4a4('0xc'),auth[_0xf4a4('0xa')](),controller['describe']);router[_0xf4a4('0x9')]('/:id',auth[_0xf4a4('0xd')](),controller['show']);router[_0xf4a4('0x9')](_0xf4a4('0xe'),auth[_0xf4a4('0xd')](),controller[_0xf4a4('0xf')]);router[_0xf4a4('0x9')]('/:id/messages',auth[_0xf4a4('0xa')](),controller['getMessages']);router[_0xf4a4('0x9')]('/:id/my_messages',auth[_0xf4a4('0xd')](),controller[_0xf4a4('0x10')]);router[_0xf4a4('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xf4a4('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf4a4('0x11')](_0xf4a4('0x12'),auth[_0xf4a4('0xa')](),controller[_0xf4a4('0x13')]);var upload=multer({'storage':multer[_0xf4a4('0x14')]({'destination':function(_0x3cbf7e,_0x4befe6,_0x433b87){_0x433b87(null,path['join'](config[_0xf4a4('0x15')],_0xf4a4('0x16')));},'filename':function(_0x2f6823,_0xc8bd3f,_0x50b35d){_0x50b35d(null,util[_0xf4a4('0x17')](_0xf4a4('0x18'),Date['now'](),_0xc8bd3f['originalname'][_0xf4a4('0x19')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xf4a4('0x1a'),upload[_0xf4a4('0x1b')](_0xf4a4('0x1c')),controller['attachmentUpload']);router[_0xf4a4('0x11')](_0xf4a4('0x1d'),auth[_0xf4a4('0xd')](),controller[_0xf4a4('0x1e')]);router['post'](_0xf4a4('0x1f'),auth[_0xf4a4('0xa')](),interaction[_0xf4a4('0x20')](_0xf4a4('0x21'),_0xf4a4('0x22')),controller[_0xf4a4('0x23')]);router[_0xf4a4('0x24')](_0xf4a4('0x25'),auth[_0xf4a4('0xa')](),interaction[_0xf4a4('0x20')](_0xf4a4('0x21'),_0xf4a4('0x26')),controller[_0xf4a4('0x27')]);router[_0xf4a4('0x24')]('/:id/custom_update',controller[_0xf4a4('0x28')]);router[_0xf4a4('0x24')](_0xf4a4('0x29'),auth[_0xf4a4('0xd')](),controller['abandon']);router['put']('/:id/close',controller[_0xf4a4('0x2a')]);router['delete'](_0xf4a4('0x25'),auth['isAuthenticated'](),interaction[_0xf4a4('0x20')]('chat',_0xf4a4('0x2b')),controller[_0xf4a4('0x2c')]);router[_0xf4a4('0x2d')](_0xf4a4('0x1f'),auth[_0xf4a4('0xa')](),controller['removeTags']);module[_0xf4a4('0x2e')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 592c4ac..9e38a22 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 _0x137a=['TEXT','medium','INTEGER','exports'];(function(_0x153279,_0x390c38){var _0x344843=function(_0x32fa22){while(--_0x32fa22){_0x153279['push'](_0x153279['shift']());}};_0x344843(++_0x390c38);}(_0x137a,0x177));var _0xa137=function(_0x1ebf92,_0x5c3ce0){_0x1ebf92=_0x1ebf92-0x0;var _0x554e1c=_0x137a[_0x1ebf92];return _0x554e1c;};'use strict';var Sequelize=require('sequelize');module[_0xa137('0x0')]={'body':{'type':Sequelize[_0xa137('0x1')](_0xa137('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa137('0x3')]}}; \ No newline at end of file +var _0xef83=['medium','BOOLEAN','INTEGER','exports','TEXT'];(function(_0x4989ce,_0x2c420d){var _0x4d5c47=function(_0x596edf){while(--_0x596edf){_0x4989ce['push'](_0x4989ce['shift']());}};_0x4d5c47(++_0x2c420d);}(_0xef83,0x161));var _0x3ef8=function(_0x1fc3aa,_0x1b92fd){_0x1fc3aa=_0x1fc3aa-0x0;var _0x11dd40=_0xef83[_0x1fc3aa];return _0x11dd40;};'use strict';var Sequelize=require('sequelize');module[_0x3ef8('0x0')]={'body':{'type':Sequelize[_0x3ef8('0x1')](_0x3ef8('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x3ef8('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x3ef8('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 67cf2fd..87511eb 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 _0x3013=['index','map','ChatInternalMessage','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','include','findAll','then','rows','catch','params','rawAttributes','includeAll','options','find','create','body','describe','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','admin','fullname','role','userpic','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','UserProfileResource','agent','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name'];(function(_0x44feb5,_0x3f7964){var _0x45e3b8=function(_0x2848be){while(--_0x2848be){_0x44feb5['push'](_0x44feb5['shift']());}};_0x45e3b8(++_0x3f7964);}(_0x3013,0x128));var _0x3301=function(_0x3e7a88,_0x3c9aa0){_0x3e7a88=_0x3e7a88-0x0;var _0x307a3b=_0x3013[_0x3e7a88];return _0x307a3b;};'use strict';var emlformat=require(_0x3301('0x0'));var rimraf=require(_0x3301('0x1'));var zipdir=require(_0x3301('0x2'));var jsonpatch=require(_0x3301('0x3'));var rp=require(_0x3301('0x4'));var moment=require(_0x3301('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3301('0x6'));var path=require(_0x3301('0x7'));var sox=require(_0x3301('0x8'));var csv=require('to-csv');var ejs=require(_0x3301('0x9'));var fs=require('fs');var fs_extra=require(_0x3301('0xa'));var _=require(_0x3301('0xb'));var squel=require(_0x3301('0xc'));var crypto=require(_0x3301('0xd'));var jsforce=require(_0x3301('0xe'));var deskjs=require(_0x3301('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3301('0x10'));var Papa=require('papaparse');var Redis=require(_0x3301('0x11'));var authService=require(_0x3301('0x12'));var qs=require(_0x3301('0x13'));var as=require(_0x3301('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3301('0x15'))(_0x3301('0x16'));var utils=require(_0x3301('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3301('0x18'));var db=require(_0x3301('0x19'))['db'];config[_0x3301('0x1a')]=_['defaults'](config[_0x3301('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x3301('0x1b'))(new Redis(config[_0x3301('0x1a')]));require(_0x3301('0x1c'))['register'](socket);function respondWithStatusCode(_0x4e1f97,_0x233cd5){_0x233cd5=_0x233cd5||0xcc;return function(_0x4003f5){if(_0x4003f5){return _0x4e1f97[_0x3301('0x1d')](_0x233cd5);}return _0x4e1f97[_0x3301('0x1e')](_0x233cd5)[_0x3301('0x1f')]();};}function respondWithResult(_0x328842,_0x1349d5){_0x1349d5=_0x1349d5||0xc8;return function(_0xc7a6a7){if(_0xc7a6a7){return _0x328842[_0x3301('0x1e')](_0x1349d5)[_0x3301('0x20')](_0xc7a6a7);}};}function respondWithFilteredResult(_0x2d0082,_0x4e27db){return function(_0x6a09eb){if(_0x6a09eb){var _0x23a78c=typeof _0x4e27db[_0x3301('0x21')]===_0x3301('0x22')&&typeof _0x4e27db[_0x3301('0x23')]===_0x3301('0x22');var _0x46fdd9=_0x6a09eb[_0x3301('0x24')];var _0x237b5e=_0x23a78c?0x0:_0x4e27db[_0x3301('0x21')];var _0x27e957=_0x23a78c?_0x6a09eb['count']:_0x4e27db[_0x3301('0x21')]+_0x4e27db[_0x3301('0x23')];var _0x4df357;if(_0x27e957>=_0x46fdd9){_0x27e957=_0x46fdd9;_0x4df357=0xc8;}else{_0x4df357=0xce;}_0x2d0082['status'](_0x4df357);return _0x2d0082[_0x3301('0x25')](_0x3301('0x26'),_0x237b5e+'-'+_0x27e957+'/'+_0x46fdd9)[_0x3301('0x20')](_0x6a09eb);}return null;};}function patchUpdates(_0x4c8534){return function(_0x7ce5ce){try{jsonpatch[_0x3301('0x27')](_0x7ce5ce,_0x4c8534,!![]);}catch(_0x493134){return BPromise[_0x3301('0x28')](_0x493134);}return _0x7ce5ce[_0x3301('0x29')]();};}function saveUpdates(_0x44b423,_0x3524c8){return function(_0x26659b){if(_0x26659b){return _0x26659b[_0x3301('0x2a')](_0x44b423)['then'](function(_0x5410f3){return _0x5410f3;});}return null;};}function removeEntity(_0x2a1324,_0x31a0d3){return function(_0x4920ae){if(_0x4920ae){return _0x4920ae[_0x3301('0x2b')]()['then'](function(){_0x2a1324[_0x3301('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c293a,_0xbdc072){return function(_0x54b25e){if(!_0x54b25e){_0x4c293a['sendStatus'](0x194);}return _0x54b25e;};}function handleError(_0x4b6ca0,_0x5ed27a){_0x5ed27a=_0x5ed27a||0x1f4;return function(_0xe97b9b){logger['error'](_0xe97b9b[_0x3301('0x2c')]);if(_0xe97b9b[_0x3301('0x2d')]){delete _0xe97b9b['name'];}_0x4b6ca0[_0x3301('0x1e')](_0x5ed27a)['send'](_0xe97b9b);};}exports[_0x3301('0x2e')]=function(_0x56d7a1,_0x1be18e){var _0x30d525={},_0x52cf43={},_0x599d7d={'count':0x0,'rows':[]};var _0x59a2be=_[_0x3301('0x2f')](db[_0x3301('0x30')]['rawAttributes'],function(_0x2c6bcc){return{'name':_0x2c6bcc[_0x3301('0x31')],'type':_0x2c6bcc[_0x3301('0x32')][_0x3301('0x33')]};});_0x52cf43[_0x3301('0x34')]=_[_0x3301('0x2f')](_0x59a2be,_0x3301('0x2d'));_0x52cf43[_0x3301('0x35')]=_[_0x3301('0x36')](_0x56d7a1['query']);_0x52cf43['filters']=_[_0x3301('0x37')](_0x52cf43['model'],_0x52cf43['query']);_0x30d525['attributes']=_[_0x3301('0x37')](_0x52cf43[_0x3301('0x34')],qs[_0x3301('0x38')](_0x56d7a1[_0x3301('0x35')][_0x3301('0x38')]));_0x30d525[_0x3301('0x39')]=_0x30d525[_0x3301('0x39')][_0x3301('0x3a')]?_0x30d525[_0x3301('0x39')]:_0x52cf43['model'];if(!_0x56d7a1[_0x3301('0x35')][_0x3301('0x3b')]('nolimit')){_0x30d525[_0x3301('0x23')]=qs[_0x3301('0x23')](_0x56d7a1['query'][_0x3301('0x23')]);_0x30d525[_0x3301('0x21')]=qs['offset'](_0x56d7a1[_0x3301('0x35')][_0x3301('0x21')]);}_0x30d525[_0x3301('0x3c')]=qs['sort'](_0x56d7a1[_0x3301('0x35')][_0x3301('0x3d')]);_0x30d525[_0x3301('0x3e')]=qs[_0x3301('0x3f')](_[_0x3301('0x40')](_0x56d7a1[_0x3301('0x35')],_0x52cf43[_0x3301('0x3f')]),_0x59a2be);if(_0x56d7a1[_0x3301('0x35')]['filter']){_0x30d525['where']=_[_0x3301('0x41')](_0x30d525[_0x3301('0x3e')],{'$or':_[_0x3301('0x2f')](_0x59a2be,function(_0x31cd89){if(_0x31cd89['type']!==_0x3301('0x42')){var _0x457762={};_0x457762[_0x31cd89[_0x3301('0x2d')]]={'$like':'%'+_0x56d7a1[_0x3301('0x35')][_0x3301('0x43')]+'%'};return _0x457762;}})});}_0x30d525=_[_0x3301('0x41')]({},_0x30d525,_0x56d7a1['options']);var _0x182a06={'where':_0x30d525['where']};return db[_0x3301('0x30')]['count'](_0x182a06)['then'](function(_0x5a908c){_0x599d7d[_0x3301('0x24')]=_0x5a908c;if(_0x56d7a1[_0x3301('0x35')]['includeAll']){_0x30d525[_0x3301('0x44')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x3301('0x45')](_0x30d525);})[_0x3301('0x46')](function(_0x5a9d88){_0x599d7d[_0x3301('0x47')]=_0x5a9d88;return _0x599d7d;})['then'](respondWithFilteredResult(_0x1be18e,_0x30d525))[_0x3301('0x48')](handleError(_0x1be18e,null));};exports['show']=function(_0x3d19d4,_0x3f8b42){var _0x5cb2cd={'raw':!![],'where':{'id':_0x3d19d4[_0x3301('0x49')]['id']}},_0x251677={};_0x251677[_0x3301('0x34')]=_['keys'](db['ChatInternalMessage'][_0x3301('0x4a')]);_0x251677[_0x3301('0x35')]=_[_0x3301('0x36')](_0x3d19d4[_0x3301('0x35')]);_0x251677[_0x3301('0x3f')]=_[_0x3301('0x37')](_0x251677[_0x3301('0x34')],_0x251677[_0x3301('0x35')]);_0x5cb2cd[_0x3301('0x39')]=_[_0x3301('0x37')](_0x251677[_0x3301('0x34')],qs[_0x3301('0x38')](_0x3d19d4[_0x3301('0x35')][_0x3301('0x38')]));_0x5cb2cd[_0x3301('0x39')]=_0x5cb2cd[_0x3301('0x39')][_0x3301('0x3a')]?_0x5cb2cd[_0x3301('0x39')]:_0x251677[_0x3301('0x34')];if(_0x3d19d4[_0x3301('0x35')][_0x3301('0x4b')]){_0x5cb2cd['include']=[{'all':!![]}];}_0x5cb2cd=_[_0x3301('0x41')]({},_0x5cb2cd,_0x3d19d4[_0x3301('0x4c')]);return db[_0x3301('0x30')][_0x3301('0x4d')](_0x5cb2cd)[_0x3301('0x46')](handleEntityNotFound(_0x3f8b42,null))[_0x3301('0x46')](respondWithResult(_0x3f8b42,null))[_0x3301('0x48')](handleError(_0x3f8b42,null));};exports[_0x3301('0x4e')]=function(_0x2f4fed,_0x411333){return db[_0x3301('0x30')][_0x3301('0x4e')](_0x2f4fed[_0x3301('0x4f')],{})['then'](respondWithResult(_0x411333,0xc9))['catch'](handleError(_0x411333,null));};exports[_0x3301('0x2a')]=function(_0x4d5d20,_0x277af9){if(_0x4d5d20[_0x3301('0x4f')]['id']){delete _0x4d5d20[_0x3301('0x4f')]['id'];}return db[_0x3301('0x30')][_0x3301('0x4d')]({'where':{'id':_0x4d5d20[_0x3301('0x49')]['id']}})[_0x3301('0x46')](handleEntityNotFound(_0x277af9,null))[_0x3301('0x46')](saveUpdates(_0x4d5d20[_0x3301('0x4f')],null))['then'](respondWithResult(_0x277af9,null))[_0x3301('0x48')](handleError(_0x277af9,null));};exports[_0x3301('0x2b')]=function(_0xd18192,_0x4ba3f5){return db[_0x3301('0x30')][_0x3301('0x4d')]({'where':{'id':_0xd18192['params']['id']}})[_0x3301('0x46')](handleEntityNotFound(_0x4ba3f5,null))['then'](removeEntity(_0x4ba3f5,null))[_0x3301('0x48')](handleError(_0x4ba3f5,null));};exports[_0x3301('0x50')]=function(_0x52c704,_0x5976c3){return db['ChatInternalMessage']['describe']()[_0x3301('0x46')](respondWithResult(_0x5976c3,null))[_0x3301('0x48')](handleError(_0x5976c3,null));};function wrapUser(_0x1020ae){return function(_0xf25db4){var _0xd13eb1=_0x1020ae['get']({'plain':!![]});_0xd13eb1[_0x3301('0x51')]=[];if(_0xf25db4){_0xd13eb1[_0x3301('0x52')]=_0xf25db4[_0x3301('0x53')];_0xd13eb1[_0x3301('0x54')]=_0xf25db4;}else{_0xd13eb1[_0x3301('0x52')]=moment(0x0)[_0x3301('0x55')](_0x3301('0x56'));_0xd13eb1['lastMessage']={};}return _0xd13eb1;};}exports[_0x3301('0x57')]=function(_0x12c212,_0x5e73c8,_0x7beca){var _0x4b505a=[];return db[_0x3301('0x58')][_0x3301('0x45')]({'where':{'role':['agent',_0x3301('0x59'),'user']},'attributes':['id',_0x3301('0x5a'),_0x3301('0x2d'),_0x3301('0x5b'),_0x3301('0x5c'),'internal',_0x3301('0x5d'),_0x3301('0x5e'),_0x3301('0x5f'),_0x3301('0x60')],'order':qs['sort'](_0x3301('0x61')),'include':[{'model':db[_0x3301('0x62')],'as':_0x3301('0x63'),'attributes':['id',_0x3301('0x2d'),'type'],'through':{'attributes':[]}}]})[_0x3301('0x46')](function(_0x14e2d8){if(_0x14e2d8){var _0x527a40=_0x12c212[_0x3301('0x64')][_0x3301('0x65')]({'plain':!![]});if(!_0x527a40)throw new Error(_0x3301('0x66'));if(_0x527a40[_0x3301('0x5b')]==='user'){return db[_0x3301('0x67')]['find']({'where':{'name':_0x3301('0x68'),'userProfileId':_0x527a40['userProfileId']},'raw':!![]})[_0x3301('0x46')](function(_0x37783f){if(_0x37783f){if(_0x37783f[_0x3301('0x69')]===0x0){return db[_0x3301('0x6a')][_0x3301('0x45')]({'where':{'sectionId':_0x37783f['id']},'raw':!![]})[_0x3301('0x46')](function(_0x167ad6){var _0xd0bca7=[];if(_['isEmpty'](_0x167ad6)){_0xd0bca7=_['filter'](_0x14e2d8,function(_0x525b31){if(_0x525b31[_0x3301('0x5b')]!==_0x3301('0x6b')){return _0x525b31;}});return _0xd0bca7;}else{for(var _0x10e212=0x0;_0x10e212<_0x14e2d8[_0x3301('0x3a')];_0x10e212++){var _0x5bd3e3=_0x14e2d8[_0x10e212];if(_0x5bd3e3[_0x3301('0x5b')]==='agent'){var _0x3808a3=_['find'](_0x167ad6,function(_0x53ba89){return _0x53ba89['resourceId']===_0x5bd3e3['id'];});if(_0x3808a3)_0xd0bca7[_0x3301('0x6c')](_0x5bd3e3);}else{_0xd0bca7[_0x3301('0x6c')](_0x5bd3e3);}}return _0xd0bca7;}});}else{return _0x14e2d8;}}else{var _0x501f85=_[_0x3301('0x43')](_0x14e2d8,function(_0x3b125f){if(_0x3b125f[_0x3301('0x5b')]!==_0x3301('0x6b')){return _0x3b125f;}});return _0x501f85;}});}else{return _0x14e2d8;}}})[_0x3301('0x46')](function(_0x3a454a){var _0x26372a=[];if(_0x3a454a){_0x4b505a=_0x3a454a;for(var _0x545263=0x0;_0x545263<_0x3a454a[_0x3301('0x3a')];_0x545263+=0x1){_0x4b505a[_0x545263][_0x3301('0x51')]=[];_0x26372a['push'](db[_0x3301('0x30')][_0x3301('0x4d')]({'where':{'FromId':[_0x12c212[_0x3301('0x64')]['id'],_0x3a454a[_0x545263]['id']],'ToId':[_0x12c212[_0x3301('0x64')]['id'],_0x3a454a[_0x545263]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x3301('0x6d'),_0x3301('0x6e'),_0x3301('0x6f'),_0x3301('0x4f')],'order':qs['sort'](_0x3301('0x70')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x3301('0x46')](wrapUser(_0x3a454a[_0x545263])));}return BPromise[_0x3301('0x71')](_0x26372a);}return[];})['then'](function(_0x4d6447){return{'rows':_0x4d6447,'count':_0x4d6447['length']};})['then'](respondWithResult(_0x5e73c8,null))['catch'](handleError(_0x5e73c8,null));}; \ No newline at end of file +var _0x3ac8=['agent','user','fullname','online','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','filter','resourceId','push','createdAt','FromId','read','-createdAt','all','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','index','map','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','options','ChatInternalMessage','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','find','create','body','get','messages','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','User'];(function(_0xe7281f,_0x2d77c3){var _0x90dc99=function(_0x1e335b){while(--_0x1e335b){_0xe7281f['push'](_0xe7281f['shift']());}};_0x90dc99(++_0x2d77c3);}(_0x3ac8,0x1d4));var _0x83ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ac8[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x83ac('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x83ac('0x1'));var jsonpatch=require(_0x83ac('0x2'));var rp=require(_0x83ac('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x83ac('0x4'));var util=require(_0x83ac('0x5'));var path=require(_0x83ac('0x6'));var sox=require(_0x83ac('0x7'));var csv=require(_0x83ac('0x8'));var ejs=require(_0x83ac('0x9'));var fs=require('fs');var fs_extra=require(_0x83ac('0xa'));var _=require(_0x83ac('0xb'));var squel=require(_0x83ac('0xc'));var crypto=require(_0x83ac('0xd'));var jsforce=require(_0x83ac('0xe'));var deskjs=require(_0x83ac('0xf'));var toCsv=require(_0x83ac('0x8'));var querystring=require(_0x83ac('0x10'));var Papa=require(_0x83ac('0x11'));var Redis=require(_0x83ac('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x83ac('0x13'));var as=require(_0x83ac('0x14'));var hardwareService=require(_0x83ac('0x15'));var logger=require('../../config/logger')(_0x83ac('0x16'));var utils=require(_0x83ac('0x17'));var config=require(_0x83ac('0x18'));var licenseUtil=require(_0x83ac('0x19'));var db=require(_0x83ac('0x1a'))['db'];config[_0x83ac('0x1b')]=_[_0x83ac('0x1c')](config[_0x83ac('0x1b')],{'host':_0x83ac('0x1d'),'port':0x18eb});var socket=require(_0x83ac('0x1e'))(new Redis(config[_0x83ac('0x1b')]));require(_0x83ac('0x1f'))['register'](socket);function respondWithStatusCode(_0x5db060,_0x34d5a1){_0x34d5a1=_0x34d5a1||0xcc;return function(_0x5a9b3a){if(_0x5a9b3a){return _0x5db060['sendStatus'](_0x34d5a1);}return _0x5db060[_0x83ac('0x20')](_0x34d5a1)[_0x83ac('0x21')]();};}function respondWithResult(_0x873d48,_0x5e7463){_0x5e7463=_0x5e7463||0xc8;return function(_0x3d6b52){if(_0x3d6b52){return _0x873d48['status'](_0x5e7463)[_0x83ac('0x22')](_0x3d6b52);}};}function respondWithFilteredResult(_0x2127b9,_0x50a88d){return function(_0x40824d){if(_0x40824d){var _0x13f03a=typeof _0x50a88d[_0x83ac('0x23')]===_0x83ac('0x24')&&typeof _0x50a88d[_0x83ac('0x25')]===_0x83ac('0x24');var _0x254815=_0x40824d[_0x83ac('0x26')];var _0x103ed8=_0x13f03a?0x0:_0x50a88d[_0x83ac('0x23')];var _0x5f4a38=_0x13f03a?_0x40824d[_0x83ac('0x26')]:_0x50a88d[_0x83ac('0x23')]+_0x50a88d['limit'];var _0x42d2e1;if(_0x5f4a38>=_0x254815){_0x5f4a38=_0x254815;_0x42d2e1=0xc8;}else{_0x42d2e1=0xce;}_0x2127b9[_0x83ac('0x20')](_0x42d2e1);return _0x2127b9['set'](_0x83ac('0x27'),_0x103ed8+'-'+_0x5f4a38+'/'+_0x254815)[_0x83ac('0x22')](_0x40824d);}return null;};}function patchUpdates(_0x1e4db8){return function(_0x4dc24c){try{jsonpatch[_0x83ac('0x28')](_0x4dc24c,_0x1e4db8,!![]);}catch(_0x65e78d){return BPromise[_0x83ac('0x29')](_0x65e78d);}return _0x4dc24c[_0x83ac('0x2a')]();};}function saveUpdates(_0x230feb,_0x49d514){return function(_0x36b13b){if(_0x36b13b){return _0x36b13b['update'](_0x230feb)[_0x83ac('0x2b')](function(_0x4a8173){return _0x4a8173;});}return null;};}function removeEntity(_0x4bb49d,_0x4d9b57){return function(_0x5bf2d2){if(_0x5bf2d2){return _0x5bf2d2[_0x83ac('0x2c')]()[_0x83ac('0x2b')](function(){_0x4bb49d[_0x83ac('0x20')](0xcc)[_0x83ac('0x21')]();});}};}function handleEntityNotFound(_0x338bac,_0x395b68){return function(_0x404d76){if(!_0x404d76){_0x338bac[_0x83ac('0x2d')](0x194);}return _0x404d76;};}function handleError(_0x392c6b,_0x189103){_0x189103=_0x189103||0x1f4;return function(_0x53b4cf){logger[_0x83ac('0x2e')](_0x53b4cf['stack']);if(_0x53b4cf[_0x83ac('0x2f')]){delete _0x53b4cf[_0x83ac('0x2f')];}_0x392c6b[_0x83ac('0x20')](_0x189103)['send'](_0x53b4cf);};}exports[_0x83ac('0x30')]=function(_0x12e4b6,_0x2275a2){var _0x13d300={},_0x239910={},_0x5512cc={'count':0x0,'rows':[]};var _0x2637ed=_[_0x83ac('0x31')](db['ChatInternalMessage']['rawAttributes'],function(_0x544672){return{'name':_0x544672[_0x83ac('0x32')],'type':_0x544672[_0x83ac('0x33')]['key']};});_0x239910['model']=_[_0x83ac('0x31')](_0x2637ed,_0x83ac('0x2f'));_0x239910[_0x83ac('0x34')]=_['keys'](_0x12e4b6[_0x83ac('0x34')]);_0x239910[_0x83ac('0x35')]=_[_0x83ac('0x36')](_0x239910[_0x83ac('0x37')],_0x239910[_0x83ac('0x34')]);_0x13d300[_0x83ac('0x38')]=_[_0x83ac('0x36')](_0x239910[_0x83ac('0x37')],qs[_0x83ac('0x39')](_0x12e4b6[_0x83ac('0x34')][_0x83ac('0x39')]));_0x13d300['attributes']=_0x13d300[_0x83ac('0x38')][_0x83ac('0x3a')]?_0x13d300[_0x83ac('0x38')]:_0x239910['model'];if(!_0x12e4b6['query'][_0x83ac('0x3b')]('nolimit')){_0x13d300[_0x83ac('0x25')]=qs[_0x83ac('0x25')](_0x12e4b6[_0x83ac('0x34')][_0x83ac('0x25')]);_0x13d300[_0x83ac('0x23')]=qs[_0x83ac('0x23')](_0x12e4b6['query'][_0x83ac('0x23')]);}_0x13d300[_0x83ac('0x3c')]=qs[_0x83ac('0x3d')](_0x12e4b6[_0x83ac('0x34')]['sort']);_0x13d300['where']=qs[_0x83ac('0x35')](_[_0x83ac('0x3e')](_0x12e4b6['query'],_0x239910[_0x83ac('0x35')]),_0x2637ed);if(_0x12e4b6['query']['filter']){_0x13d300[_0x83ac('0x3f')]=_[_0x83ac('0x40')](_0x13d300[_0x83ac('0x3f')],{'$or':_[_0x83ac('0x31')](_0x2637ed,function(_0x2b8621){if(_0x2b8621[_0x83ac('0x33')]!==_0x83ac('0x41')){var _0x258df4={};_0x258df4[_0x2b8621['name']]={'$like':'%'+_0x12e4b6[_0x83ac('0x34')]['filter']+'%'};return _0x258df4;}})});}_0x13d300=_[_0x83ac('0x40')]({},_0x13d300,_0x12e4b6[_0x83ac('0x42')]);var _0x518d38={'where':_0x13d300[_0x83ac('0x3f')]};return db[_0x83ac('0x43')][_0x83ac('0x26')](_0x518d38)['then'](function(_0x127242){_0x5512cc[_0x83ac('0x26')]=_0x127242;if(_0x12e4b6[_0x83ac('0x34')][_0x83ac('0x44')]){_0x13d300['include']=[{'all':!![]}];}return db[_0x83ac('0x43')][_0x83ac('0x45')](_0x13d300);})[_0x83ac('0x2b')](function(_0x12020e){_0x5512cc[_0x83ac('0x46')]=_0x12020e;return _0x5512cc;})[_0x83ac('0x2b')](respondWithFilteredResult(_0x2275a2,_0x13d300))[_0x83ac('0x47')](handleError(_0x2275a2,null));};exports[_0x83ac('0x48')]=function(_0x50deae,_0x1aacd0){var _0x1c05da={'raw':!![],'where':{'id':_0x50deae[_0x83ac('0x49')]['id']}},_0xb0a04e={};_0xb0a04e['model']=_[_0x83ac('0x4a')](db[_0x83ac('0x43')][_0x83ac('0x4b')]);_0xb0a04e['query']=_[_0x83ac('0x4a')](_0x50deae['query']);_0xb0a04e[_0x83ac('0x35')]=_[_0x83ac('0x36')](_0xb0a04e[_0x83ac('0x37')],_0xb0a04e[_0x83ac('0x34')]);_0x1c05da[_0x83ac('0x38')]=_['intersection'](_0xb0a04e[_0x83ac('0x37')],qs[_0x83ac('0x39')](_0x50deae['query']['fields']));_0x1c05da[_0x83ac('0x38')]=_0x1c05da[_0x83ac('0x38')][_0x83ac('0x3a')]?_0x1c05da[_0x83ac('0x38')]:_0xb0a04e[_0x83ac('0x37')];if(_0x50deae[_0x83ac('0x34')][_0x83ac('0x44')]){_0x1c05da[_0x83ac('0x4c')]=[{'all':!![]}];}_0x1c05da=_['merge']({},_0x1c05da,_0x50deae['options']);return db[_0x83ac('0x43')][_0x83ac('0x4d')](_0x1c05da)['then'](handleEntityNotFound(_0x1aacd0,null))[_0x83ac('0x2b')](respondWithResult(_0x1aacd0,null))['catch'](handleError(_0x1aacd0,null));};exports['create']=function(_0x2aed74,_0x5b3182){return db[_0x83ac('0x43')][_0x83ac('0x4e')](_0x2aed74[_0x83ac('0x4f')],{})[_0x83ac('0x2b')](respondWithResult(_0x5b3182,0xc9))[_0x83ac('0x47')](handleError(_0x5b3182,null));};exports['update']=function(_0x1292cf,_0x2e62f4){if(_0x1292cf[_0x83ac('0x4f')]['id']){delete _0x1292cf[_0x83ac('0x4f')]['id'];}return db[_0x83ac('0x43')][_0x83ac('0x4d')]({'where':{'id':_0x1292cf[_0x83ac('0x49')]['id']}})[_0x83ac('0x2b')](handleEntityNotFound(_0x2e62f4,null))[_0x83ac('0x2b')](saveUpdates(_0x1292cf[_0x83ac('0x4f')],null))[_0x83ac('0x2b')](respondWithResult(_0x2e62f4,null))[_0x83ac('0x47')](handleError(_0x2e62f4,null));};exports[_0x83ac('0x2c')]=function(_0x115b79,_0x1db189){return db[_0x83ac('0x43')][_0x83ac('0x4d')]({'where':{'id':_0x115b79['params']['id']}})['then'](handleEntityNotFound(_0x1db189,null))[_0x83ac('0x2b')](removeEntity(_0x1db189,null))[_0x83ac('0x47')](handleError(_0x1db189,null));};exports['describe']=function(_0x31b004,_0x243fbd){return db['ChatInternalMessage']['describe']()['then'](respondWithResult(_0x243fbd,null))['catch'](handleError(_0x243fbd,null));};function wrapUser(_0x3d1667){return function(_0xb5a1e){var _0x436f09=_0x3d1667[_0x83ac('0x50')]({'plain':!![]});_0x436f09[_0x83ac('0x51')]=[];if(_0xb5a1e){_0x436f09[_0x83ac('0x52')]=_0xb5a1e['createdAt'];_0x436f09['lastMessage']=_0xb5a1e;}else{_0x436f09[_0x83ac('0x52')]=moment(0x0)[_0x83ac('0x53')](_0x83ac('0x54'));_0x436f09[_0x83ac('0x55')]={};}return _0x436f09;};}exports['getUsers']=function(_0x347d6e,_0x50ff2c,_0x4dda24){var _0x45b505=[];return db[_0x83ac('0x56')][_0x83ac('0x45')]({'where':{'role':[_0x83ac('0x57'),'admin',_0x83ac('0x58')]},'attributes':['id',_0x83ac('0x59'),_0x83ac('0x2f'),'role','userpic','internal',_0x83ac('0x5a'),'lastLoginAt','allowmessenger',_0x83ac('0x5b')],'order':qs['sort'](_0x83ac('0x5c')),'include':[{'model':db[_0x83ac('0x5d')],'as':_0x83ac('0x5e'),'attributes':['id',_0x83ac('0x2f'),_0x83ac('0x33')],'through':{'attributes':[]}}]})[_0x83ac('0x2b')](function(_0x3aa34e){if(_0x3aa34e){var _0x5e642a=_0x347d6e[_0x83ac('0x58')][_0x83ac('0x50')]({'plain':!![]});if(!_0x5e642a)throw new Error(_0x83ac('0x5f'));if(_0x5e642a[_0x83ac('0x60')]==='user'){return db[_0x83ac('0x61')][_0x83ac('0x4d')]({'where':{'name':_0x83ac('0x62'),'userProfileId':_0x5e642a[_0x83ac('0x63')]},'raw':!![]})['then'](function(_0x7b6b94){if(_0x7b6b94){if(_0x7b6b94[_0x83ac('0x64')]===0x0){return db[_0x83ac('0x65')]['findAll']({'where':{'sectionId':_0x7b6b94['id']},'raw':!![]})[_0x83ac('0x2b')](function(_0x4f969f){var _0x207a77=[];if(_[_0x83ac('0x66')](_0x4f969f)){_0x207a77=_[_0x83ac('0x67')](_0x3aa34e,function(_0x27b815){if(_0x27b815[_0x83ac('0x60')]!==_0x83ac('0x57')){return _0x27b815;}});return _0x207a77;}else{for(var _0x3fc14c=0x0;_0x3fc14c<_0x3aa34e['length'];_0x3fc14c++){var _0x1b13f7=_0x3aa34e[_0x3fc14c];if(_0x1b13f7[_0x83ac('0x60')]===_0x83ac('0x57')){var _0x5b180b=_[_0x83ac('0x4d')](_0x4f969f,function(_0x113577){return _0x113577[_0x83ac('0x68')]===_0x1b13f7['id'];});if(_0x5b180b)_0x207a77[_0x83ac('0x69')](_0x1b13f7);}else{_0x207a77[_0x83ac('0x69')](_0x1b13f7);}}return _0x207a77;}});}else{return _0x3aa34e;}}else{var _0x574904=_[_0x83ac('0x67')](_0x3aa34e,function(_0x4fe3b4){if(_0x4fe3b4[_0x83ac('0x60')]!==_0x83ac('0x57')){return _0x4fe3b4;}});return _0x574904;}});}else{return _0x3aa34e;}}})[_0x83ac('0x2b')](function(_0x22f1bd){var _0x5ac14d=[];if(_0x22f1bd){_0x45b505=_0x22f1bd;for(var _0x4fe513=0x0;_0x4fe513<_0x22f1bd['length'];_0x4fe513+=0x1){_0x45b505[_0x4fe513]['messages']=[];_0x5ac14d[_0x83ac('0x69')](db[_0x83ac('0x43')][_0x83ac('0x4d')]({'where':{'FromId':[_0x347d6e[_0x83ac('0x58')]['id'],_0x22f1bd[_0x4fe513]['id']],'ToId':[_0x347d6e[_0x83ac('0x58')]['id'],_0x22f1bd[_0x4fe513]['id']],'ChatGroupId':null},'attributes':['id',_0x83ac('0x6a'),_0x83ac('0x6b'),'ToId',_0x83ac('0x6c'),_0x83ac('0x4f')],'order':qs['sort'](_0x83ac('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x83ac('0x2b')](wrapUser(_0x22f1bd[_0x4fe513])));}return BPromise[_0x83ac('0x6e')](_0x5ac14d);}return[];})[_0x83ac('0x2b')](function(_0x2795f5){return{'rows':_0x2795f5,'count':_0x2795f5[_0x83ac('0x3a')]};})['then'](respondWithResult(_0x50ff2c,null))[_0x83ac('0x47')](handleError(_0x50ff2c,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index c4e50c4..fd99a13 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 _0x77cb=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','remove'];(function(_0x1c9b78,_0xc1ba53){var _0x4ac5e7=function(_0x2fecdc){while(--_0x2fecdc){_0x1c9b78['push'](_0x1c9b78['shift']());}};_0x4ac5e7(++_0xc1ba53);}(_0x77cb,0x1e1));var _0xb77c=function(_0x512ead,_0x1f8b25){_0x512ead=_0x512ead-0x0;var _0x250bb0=_0x77cb[_0x512ead];return _0x250bb0;};'use strict';var EventEmitter=require(_0xb77c('0x0'));var ChatInternalMessage=require(_0xb77c('0x1'))['db'][_0xb77c('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xb77c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb77c('0x4')};function emitEvent(_0x24ae55){return function(_0x5533c8,_0x236c21,_0x5ced87){ChatInternalMessageEvents[_0xb77c('0x5')](_0x24ae55+':'+_0x5533c8['id'],_0x5533c8);ChatInternalMessageEvents[_0xb77c('0x5')](_0x24ae55,_0x5533c8);_0x5ced87(null);};}for(var e in events){if(events[_0xb77c('0x6')](e)){var event=events[e];ChatInternalMessage[_0xb77c('0x7')](e,emitEvent(event));}}module[_0xb77c('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xb7b9=['save','emit','hasOwnProperty','ChatInternalMessage'];(function(_0x22a633,_0x19707f){var _0x24e275=function(_0x5eb720){while(--_0x5eb720){_0x22a633['push'](_0x22a633['shift']());}};_0x24e275(++_0x19707f);}(_0xb7b9,0xcf));var _0x9b7b=function(_0x4cb660,_0x4c2f2c){_0x4cb660=_0x4cb660-0x0;var _0x476e24=_0xb7b9[_0x4cb660];return _0x476e24;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require('../../mysqldb')['db'][_0x9b7b('0x0')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9b7b('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x32a53d){return function(_0x4815ad,_0x4ad0f4,_0x2e1e13){ChatInternalMessageEvents[_0x9b7b('0x2')](_0x32a53d+':'+_0x4815ad['id'],_0x4815ad);ChatInternalMessageEvents[_0x9b7b('0x2')](_0x32a53d,_0x4815ad);_0x2e1e13(null);};}for(var e in events){if(events[_0x9b7b('0x3')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index c4a3641..89819ea 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 _0x3e86=['moment','bluebird','request-promise','path','rimraf','./chatInternalMessage.attributes','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x2b49bc,_0x47b636){var _0x43cc65=function(_0x236ec3){while(--_0x236ec3){_0x2b49bc['push'](_0x2b49bc['shift']());}};_0x43cc65(++_0x47b636);}(_0x3e86,0x106));var _0x63e8=function(_0x1eea83,_0x472b27){_0x1eea83=_0x1eea83-0x0;var _0x2902a3=_0x3e86[_0x1eea83];return _0x2902a3;};'use strict';var _=require(_0x63e8('0x0'));var util=require(_0x63e8('0x1'));var logger=require(_0x63e8('0x2'))(_0x63e8('0x3'));var moment=require(_0x63e8('0x4'));var BPromise=require(_0x63e8('0x5'));var rp=require(_0x63e8('0x6'));var fs=require('fs');var path=require(_0x63e8('0x7'));var rimraf=require(_0x63e8('0x8'));var config=require('../../config/environment');var attributes=require(_0x63e8('0x9'));module['exports']=function(_0x33b6a1,_0x2306ff){return _0x33b6a1['define'](_0x63e8('0xa'),attributes,{'tableName':_0x63e8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x63e8('0xc'),'collate':_0x63e8('0xd')});}; \ No newline at end of file +var _0xf048=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x5d5024,_0x4b13ca){var _0x26618e=function(_0x5a4ceb){while(--_0x5a4ceb){_0x5d5024['push'](_0x5d5024['shift']());}};_0x26618e(++_0x4b13ca);}(_0xf048,0x1a1));var _0x8f04=function(_0x5b7ba9,_0x4d437d){_0x5b7ba9=_0x5b7ba9-0x0;var _0xd17602=_0xf048[_0x5b7ba9];return _0xd17602;};'use strict';var _=require(_0x8f04('0x0'));var util=require('util');var logger=require(_0x8f04('0x1'))(_0x8f04('0x2'));var moment=require(_0x8f04('0x3'));var BPromise=require(_0x8f04('0x4'));var rp=require(_0x8f04('0x5'));var fs=require('fs');var path=require(_0x8f04('0x6'));var rimraf=require(_0x8f04('0x7'));var config=require(_0x8f04('0x8'));var attributes=require(_0x8f04('0x9'));module[_0x8f04('0xa')]=function(_0x54dac2,_0x5310aa){return _0x54dac2['define'](_0x8f04('0xb'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8f04('0xc'),'collate':_0x8f04('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index e0e4296..ddfb7b9 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 _0xfafd=['then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request'];(function(_0x1ff454,_0x12372d){var _0x5dcf92=function(_0x2f026a){while(--_0x2f026a){_0x1ff454['push'](_0x1ff454['shift']());}};_0x5dcf92(++_0x12372d);}(_0xfafd,0xcc));var _0xdfaf=function(_0x1b7933,_0x1fefc2){_0x1b7933=_0x1b7933-0x0;var _0x32e824=_0xfafd[_0x1b7933];return _0x32e824;};'use strict';var _=require('lodash');var util=require(_0xdfaf('0x0'));var moment=require(_0xdfaf('0x1'));var BPromise=require(_0xdfaf('0x2'));var rs=require(_0xdfaf('0x3'));var fs=require('fs');var Redis=require(_0xdfaf('0x4'));var db=require(_0xdfaf('0x5'))['db'];var utils=require(_0xdfaf('0x6'));var logger=require(_0xdfaf('0x7'))(_0xdfaf('0x8'));var config=require(_0xdfaf('0x9'));var jayson=require(_0xdfaf('0xa'));var client=jayson[_0xdfaf('0xb')][_0xdfaf('0xc')]({'port':0x232a});config[_0xdfaf('0xd')]=_[_0xdfaf('0xe')](config['redis'],{'host':_0xdfaf('0xf'),'port':0x18eb});var socket=require(_0xdfaf('0x10'))(new Redis(config[_0xdfaf('0xd')]));require(_0xdfaf('0x11'))[_0xdfaf('0x12')](socket);function respondWithRpcPromise(_0x23712a,_0x466923,_0x26fd47){return new BPromise(function(_0x5092d6,_0x3747ce){return client[_0xdfaf('0x13')](_0x23712a,_0x26fd47)[_0xdfaf('0x14')](function(_0x42ea9f){logger[_0xdfaf('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x466923,_0xdfaf('0x16'));logger[_0xdfaf('0x17')](_0xdfaf('0x18'),_0x466923,_0xdfaf('0x16'),JSON[_0xdfaf('0x19')](_0x42ea9f));if(_0x42ea9f[_0xdfaf('0x1a')]){if(_0x42ea9f[_0xdfaf('0x1a')][_0xdfaf('0x1b')]===0x1f4){logger[_0xdfaf('0x1a')](_0xdfaf('0x1c'),_0x466923,_0x42ea9f['error'][_0xdfaf('0x1d')]);return _0x3747ce(_0x42ea9f[_0xdfaf('0x1a')][_0xdfaf('0x1d')]);}logger['error'](_0xdfaf('0x1c'),_0x466923,_0x42ea9f[_0xdfaf('0x1a')][_0xdfaf('0x1d')]);return _0x5092d6(_0x42ea9f['error']['message']);}else{logger[_0xdfaf('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x466923,'request\x20sent');_0x5092d6(_0x42ea9f[_0xdfaf('0x1e')][_0xdfaf('0x1d')]);}})[_0xdfaf('0x1f')](function(_0x120e5d){logger[_0xdfaf('0x1a')](_0xdfaf('0x1c'),_0x466923,_0x120e5d);_0x3747ce(_0x120e5d);});});} \ No newline at end of file +var _0x899a=['error','code','ChatInternalMessage,\x20%s,\x20%s','message','info','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x573e59,_0x38748d){var _0x40ae80=function(_0x4c3616){while(--_0x4c3616){_0x573e59['push'](_0x573e59['shift']());}};_0x40ae80(++_0x38748d);}(_0x899a,0x1b6));var _0xa899=function(_0x174531,_0x14049a){_0x174531=_0x174531-0x0;var _0x41b887=_0x899a[_0x174531];return _0x41b887;};'use strict';var _=require(_0xa899('0x0'));var util=require(_0xa899('0x1'));var moment=require('moment');var BPromise=require(_0xa899('0x2'));var rs=require(_0xa899('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa899('0x4'))['db'];var utils=require(_0xa899('0x5'));var logger=require(_0xa899('0x6'))(_0xa899('0x7'));var config=require('../../config/environment');var jayson=require(_0xa899('0x8'));var client=jayson[_0xa899('0x9')][_0xa899('0xa')]({'port':0x232a});config[_0xa899('0xb')]=_['defaults'](config[_0xa899('0xb')],{'host':_0xa899('0xc'),'port':0x18eb});var socket=require(_0xa899('0xd'))(new Redis(config[_0xa899('0xb')]));require(_0xa899('0xe'))[_0xa899('0xf')](socket);function respondWithRpcPromise(_0x30954d,_0x184920,_0x1fbfa6){return new BPromise(function(_0x34282a,_0x5a6582){return client[_0xa899('0x10')](_0x30954d,_0x1fbfa6)['then'](function(_0x4eb704){logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x184920,_0xa899('0x11'));logger[_0xa899('0x12')](_0xa899('0x13'),_0x184920,'request\x20sent',JSON[_0xa899('0x14')](_0x4eb704));if(_0x4eb704[_0xa899('0x15')]){if(_0x4eb704['error'][_0xa899('0x16')]===0x1f4){logger[_0xa899('0x15')](_0xa899('0x17'),_0x184920,_0x4eb704[_0xa899('0x15')]['message']);return _0x5a6582(_0x4eb704[_0xa899('0x15')][_0xa899('0x18')]);}logger['error'](_0xa899('0x17'),_0x184920,_0x4eb704[_0xa899('0x15')][_0xa899('0x18')]);return _0x34282a(_0x4eb704['error']['message']);}else{logger[_0xa899('0x19')](_0xa899('0x17'),_0x184920,_0xa899('0x11'));_0x34282a(_0x4eb704[_0xa899('0x1a')][_0xa899('0x18')]);}})['catch'](function(_0x332ced){logger['error'](_0xa899('0x17'),_0x184920,_0x332ced);_0x5a6582(_0x332ced);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 43aa16b..edc8a61 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 _0xa5fb=['./chatInternalMessage.events','remove','emit','removeListener','register','length','chatInternalMessage:'];(function(_0x1bdaf7,_0x1f89fd){var _0x4f0b16=function(_0x5c3c60){while(--_0x5c3c60){_0x1bdaf7['push'](_0x1bdaf7['shift']());}};_0x4f0b16(++_0x1f89fd);}(_0xa5fb,0xc4));var _0xba5f=function(_0x344438,_0x409de0){_0x344438=_0x344438-0x0;var _0x19c4f9=_0xa5fb[_0x344438];return _0x19c4f9;};'use strict';var ChatInternalMessageEvents=require(_0xba5f('0x0'));var events=['save',_0xba5f('0x1'),'update'];function createListener(_0x410f84,_0x5b9d0d){return function(_0x429193){_0x5b9d0d[_0xba5f('0x2')](_0x410f84,_0x429193);};}function removeListener(_0x2d7637,_0x43f176){return function(){ChatInternalMessageEvents[_0xba5f('0x3')](_0x2d7637,_0x43f176);};}exports[_0xba5f('0x4')]=function(_0x1d6767){for(var _0x3e07a5=0x0,_0x549974=events[_0xba5f('0x5')];_0x3e07a5<_0x549974;_0x3e07a5++){var _0x35f5ba=events[_0x3e07a5];var _0xafb136=createListener(_0xba5f('0x6')+_0x35f5ba,_0x1d6767);ChatInternalMessageEvents['on'](_0x35f5ba,_0xafb136);}}; \ No newline at end of file +var _0x2d2c=['./chatInternalMessage.events','save','remove','update','removeListener','length','chatInternalMessage:'];(function(_0x53afd7,_0x926178){var _0x32ff71=function(_0x124bb5){while(--_0x124bb5){_0x53afd7['push'](_0x53afd7['shift']());}};_0x32ff71(++_0x926178);}(_0x2d2c,0xfc));var _0xc2d2=function(_0x397f37,_0x3cf86d){_0x397f37=_0x397f37-0x0;var _0x31cae6=_0x2d2c[_0x397f37];return _0x31cae6;};'use strict';var ChatInternalMessageEvents=require(_0xc2d2('0x0'));var events=[_0xc2d2('0x1'),_0xc2d2('0x2'),_0xc2d2('0x3')];function createListener(_0x33e548,_0x5293e2){return function(_0x52cb1e){_0x5293e2['emit'](_0x33e548,_0x52cb1e);};}function removeListener(_0x135cbb,_0x5ddc51){return function(){ChatInternalMessageEvents[_0xc2d2('0x4')](_0x135cbb,_0x5ddc51);};}exports['register']=function(_0x42fc19){for(var _0x1e8723=0x0,_0x29bb95=events[_0xc2d2('0x5')];_0x1e8723<_0x29bb95;_0x1e8723++){var _0x578d52=events[_0x1e8723];var _0x286152=createListener(_0xc2d2('0x6')+_0x578d52,_0x42fc19);ChatInternalMessageEvents['on'](_0x578d52,_0x286152);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 55f2eb7..238ba76 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 _0x2807=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','update','delete','destroy','exports','multer','util','path'];(function(_0x228c86,_0xeaff09){var _0x1f2b0d=function(_0x13430e){while(--_0x13430e){_0x228c86['push'](_0x228c86['shift']());}};_0x1f2b0d(++_0xeaff09);}(_0x2807,0xc5));var _0x7280=function(_0xe46c64,_0x2aa797){_0xe46c64=_0xe46c64-0x0;var _0x5c56eb=_0x2807[_0xe46c64];return _0x5c56eb;};'use strict';var multer=require(_0x7280('0x0'));var util=require(_0x7280('0x1'));var path=require(_0x7280('0x2'));var timeout=require(_0x7280('0x3'));var express=require(_0x7280('0x4'));var router=express[_0x7280('0x5')]();var fs_extra=require(_0x7280('0x6'));var auth=require(_0x7280('0x7'));var interaction=require(_0x7280('0x8'));var config=require(_0x7280('0x9'));var controller=require(_0x7280('0xa'));router[_0x7280('0xb')]('/',auth[_0x7280('0xc')](),controller[_0x7280('0xd')]);router[_0x7280('0xb')](_0x7280('0xe'),auth['isAuthenticated'](),controller[_0x7280('0xf')]);router['get'](_0x7280('0x10'),auth['isAuthenticated'](),controller[_0x7280('0x11')]);router[_0x7280('0xb')](_0x7280('0x12'),auth[_0x7280('0xc')](),controller[_0x7280('0x13')]);router[_0x7280('0x14')]('/',auth[_0x7280('0xc')](),controller['create']);router['put'](_0x7280('0x12'),controller[_0x7280('0x15')]);router[_0x7280('0x16')](_0x7280('0x12'),auth[_0x7280('0xc')](),controller[_0x7280('0x17')]);module[_0x7280('0x18')]=router; \ No newline at end of file +var _0x88d5=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','index','isAuthenticated','describe','/users','getUsers','/:id','show','post','create','put','update','delete','destroy'];(function(_0x23a796,_0x48fb50){var _0xa62cb4=function(_0x5dbe47){while(--_0x5dbe47){_0x23a796['push'](_0x23a796['shift']());}};_0xa62cb4(++_0x48fb50);}(_0x88d5,0x83));var _0x588d=function(_0x3ec023,_0xc91590){_0x3ec023=_0x3ec023-0x0;var _0x38db02=_0x88d5[_0x3ec023];return _0x38db02;};'use strict';var multer=require(_0x588d('0x0'));var util=require(_0x588d('0x1'));var path=require(_0x588d('0x2'));var timeout=require(_0x588d('0x3'));var express=require(_0x588d('0x4'));var router=express[_0x588d('0x5')]();var fs_extra=require(_0x588d('0x6'));var auth=require(_0x588d('0x7'));var interaction=require(_0x588d('0x8'));var config=require(_0x588d('0x9'));var controller=require(_0x588d('0xa'));router[_0x588d('0xb')]('/',auth['isAuthenticated'](),controller[_0x588d('0xc')]);router[_0x588d('0xb')]('/describe',auth[_0x588d('0xd')](),controller[_0x588d('0xe')]);router[_0x588d('0xb')](_0x588d('0xf'),auth[_0x588d('0xd')](),controller[_0x588d('0x10')]);router[_0x588d('0xb')](_0x588d('0x11'),auth[_0x588d('0xd')](),controller[_0x588d('0x12')]);router[_0x588d('0x13')]('/',auth[_0x588d('0xd')](),controller[_0x588d('0x14')]);router[_0x588d('0x15')]('/:id',controller[_0x588d('0x16')]);router[_0x588d('0x17')](_0x588d('0x11'),auth['isAuthenticated'](),controller[_0x588d('0x18')]);module[_0x588d('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 31719f7..1ec30e9 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 _0x5713=['sequelize','exports','medium','BOOLEAN','ENUM','out','TEXT'];(function(_0x88204e,_0x231b02){var _0x7b46d2=function(_0x1649b7){while(--_0x1649b7){_0x88204e['push'](_0x88204e['shift']());}};_0x7b46d2(++_0x231b02);}(_0x5713,0x1c7));var _0x3571=function(_0x24aed7,_0x2a6852){_0x24aed7=_0x24aed7-0x0;var _0x2224ee=_0x5713[_0x24aed7];return _0x2224ee;};'use strict';var Sequelize=require(_0x3571('0x0'));module[_0x3571('0x1')]={'body':{'type':Sequelize['TEXT'](_0x3571('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x3571('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3571('0x4')]('in',_0x3571('0x5')),'defaultValue':_0x3571('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x3571('0x6')]}}; \ No newline at end of file +var _0xfd7b=['STRING','sequelize','exports','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0x37a846,_0x1beab2){var _0x4cd7e2=function(_0x1b6c65){while(--_0x1b6c65){_0x37a846['push'](_0x37a846['shift']());}};_0x4cd7e2(++_0x1beab2);}(_0xfd7b,0xd1));var _0xbfd7=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xfd7b[_0x4243a3];return _0x1b2a33;};'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 diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index d5bcc32..7243863 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 _0x1d9c=['undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','index','ChatMessage','fieldName','key','model','keys','filters','intersection','attributes','fields','query','nolimit','order','sort','where','filter','map','type','VIRTUAL','merge','options','include','rows','show','params','rawAttributes','length','find','create','body','describe','chat-interactions','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','interaction','info','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','parse','formData','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','sequelize','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','client','http','then','request\x20sent','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','catch','status','json','offset'];(function(_0x337f7b,_0x326e33){var _0x2184b9=function(_0x497ecf){while(--_0x497ecf){_0x337f7b['push'](_0x337f7b['shift']());}};_0x2184b9(++_0x326e33);}(_0x1d9c,0x14b));var _0xc1d9=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x1d9c[_0xda464c];return _0x19e222;};'use strict';var emlformat=require(_0xc1d9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc1d9('0x1'));var jsonpatch=require(_0xc1d9('0x2'));var rp=require('request-promise');var moment=require(_0xc1d9('0x3'));var BPromise=require(_0xc1d9('0x4'));var Mustache=require(_0xc1d9('0x5'));var util=require(_0xc1d9('0x6'));var path=require('path');var sox=require(_0xc1d9('0x7'));var csv=require(_0xc1d9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc1d9('0x9'));var _=require(_0xc1d9('0xa'));var squel=require(_0xc1d9('0xb'));var crypto=require(_0xc1d9('0xc'));var jsforce=require(_0xc1d9('0xd'));var deskjs=require(_0xc1d9('0xe'));var toCsv=require(_0xc1d9('0x8'));var querystring=require('querystring');var Papa=require(_0xc1d9('0xf'));var Redis=require(_0xc1d9('0x10'));var authService=require(_0xc1d9('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc1d9('0x12'))(_0xc1d9('0x13'));var utils=require(_0xc1d9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc1d9('0x15'));var db=require(_0xc1d9('0x16'))['db'];config['redis']=_[_0xc1d9('0x17')](config['redis'],{'host':_0xc1d9('0x18'),'port':0x18eb});var socket=require(_0xc1d9('0x19'))(new Redis(config[_0xc1d9('0x1a')]));require('./chatMessage.socket')[_0xc1d9('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc1d9('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0xc1d9('0x1c')][_0xc1d9('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x37efc4,_0x3c74ad,_0x4fae79,_0x1ed4ec){return new BPromise(function(_0x585da4,_0xa5a32d){var _0x2741a6=_0x1ed4ec||client;return _0x2741a6['request'](_0x37efc4,_0x4fae79)[_0xc1d9('0x1e')](function(_0x297861){logger['info']('ChatMessage,\x20%s,\x20%s',_0x3c74ad,'request\x20sent');logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x3c74ad,_0xc1d9('0x1f'),JSON[_0xc1d9('0x20')](_0x297861));if(_0x297861[_0xc1d9('0x21')]){if(_0x297861[_0xc1d9('0x21')][_0xc1d9('0x22')]===0x1f4){logger[_0xc1d9('0x21')](_0xc1d9('0x23'),_0x3c74ad,_0x297861[_0xc1d9('0x21')][_0xc1d9('0x24')]);return _0xa5a32d(_0x297861[_0xc1d9('0x21')][_0xc1d9('0x24')]);}logger['error'](_0xc1d9('0x23'),_0x3c74ad,_0x297861[_0xc1d9('0x21')][_0xc1d9('0x24')]);return _0x585da4(_0x297861[_0xc1d9('0x21')][_0xc1d9('0x24')]);}else{logger['info'](_0xc1d9('0x23'),_0x3c74ad,_0xc1d9('0x1f'));_0x585da4(_0x297861['result'][_0xc1d9('0x24')]);}})[_0xc1d9('0x25')](function(_0x27a49e){logger[_0xc1d9('0x21')](_0xc1d9('0x23'),_0x3c74ad,_0x27a49e);_0xa5a32d(_0x27a49e);});});}function respondWithStatusCode(_0x21635a,_0x1a00d7){_0x1a00d7=_0x1a00d7||0xcc;return function(_0x8fc75b){if(_0x8fc75b){return _0x21635a['sendStatus'](_0x1a00d7);}return _0x21635a[_0xc1d9('0x26')](_0x1a00d7)['end']();};}function respondWithResult(_0x31e7c8,_0x467063){_0x467063=_0x467063||0xc8;return function(_0x5eb701){if(_0x5eb701){return _0x31e7c8[_0xc1d9('0x26')](_0x467063)[_0xc1d9('0x27')](_0x5eb701);}};}function respondWithFilteredResult(_0x38ae0b,_0x1737c6){return function(_0xcbae75){if(_0xcbae75){var _0x529915=typeof _0x1737c6[_0xc1d9('0x28')]===_0xc1d9('0x29')&&typeof _0x1737c6[_0xc1d9('0x2a')]==='undefined';var _0x55e185=_0xcbae75[_0xc1d9('0x2b')];var _0x462699=_0x529915?0x0:_0x1737c6['offset'];var _0x2a02cc=_0x529915?_0xcbae75['count']:_0x1737c6['offset']+_0x1737c6[_0xc1d9('0x2a')];var _0x3d65e1;if(_0x2a02cc>=_0x55e185){_0x2a02cc=_0x55e185;_0x3d65e1=0xc8;}else{_0x3d65e1=0xce;}_0x38ae0b[_0xc1d9('0x26')](_0x3d65e1);return _0x38ae0b[_0xc1d9('0x2c')](_0xc1d9('0x2d'),_0x462699+'-'+_0x2a02cc+'/'+_0x55e185)['json'](_0xcbae75);}return null;};}function patchUpdates(_0x27f207){return function(_0x353ebd){try{jsonpatch[_0xc1d9('0x2e')](_0x353ebd,_0x27f207,!![]);}catch(_0x88c1e0){return BPromise[_0xc1d9('0x2f')](_0x88c1e0);}return _0x353ebd[_0xc1d9('0x30')]();};}function saveUpdates(_0x2c10d3,_0x40c95f){return function(_0x28d504){if(_0x28d504){return _0x28d504[_0xc1d9('0x31')](_0x2c10d3)[_0xc1d9('0x1e')](function(_0x5395e9){return _0x5395e9;});}return null;};}function removeEntity(_0x5110fc,_0x4f3108){return function(_0x4a4a88){if(_0x4a4a88){return _0x4a4a88[_0xc1d9('0x32')]()[_0xc1d9('0x1e')](function(){_0x5110fc[_0xc1d9('0x26')](0xcc)[_0xc1d9('0x33')]();});}};}function handleEntityNotFound(_0x8048ac,_0x4c2abb){return function(_0x42971a){if(!_0x42971a){_0x8048ac['sendStatus'](0x194);}return _0x42971a;};}function handleError(_0x1f17ab,_0x633f73){_0x633f73=_0x633f73||0x1f4;return function(_0x116bcb){logger[_0xc1d9('0x21')](_0x116bcb[_0xc1d9('0x34')]);if(_0x116bcb[_0xc1d9('0x35')]){delete _0x116bcb[_0xc1d9('0x35')];}_0x1f17ab[_0xc1d9('0x26')](_0x633f73)['send'](_0x116bcb);};}exports[_0xc1d9('0x36')]=function(_0x4bddbd,_0x47e62f){var _0x33cf4c={},_0x47645f={},_0x34fabc={'count':0x0,'rows':[]};var _0x339446=_['map'](db[_0xc1d9('0x37')]['rawAttributes'],function(_0x4af64f){return{'name':_0x4af64f[_0xc1d9('0x38')],'type':_0x4af64f['type'][_0xc1d9('0x39')]};});_0x47645f[_0xc1d9('0x3a')]=_['map'](_0x339446,_0xc1d9('0x35'));_0x47645f['query']=_[_0xc1d9('0x3b')](_0x4bddbd['query']);_0x47645f[_0xc1d9('0x3c')]=_[_0xc1d9('0x3d')](_0x47645f['model'],_0x47645f['query']);_0x33cf4c[_0xc1d9('0x3e')]=_[_0xc1d9('0x3d')](_0x47645f['model'],qs[_0xc1d9('0x3f')](_0x4bddbd[_0xc1d9('0x40')][_0xc1d9('0x3f')]));_0x33cf4c[_0xc1d9('0x3e')]=_0x33cf4c[_0xc1d9('0x3e')]['length']?_0x33cf4c[_0xc1d9('0x3e')]:_0x47645f[_0xc1d9('0x3a')];if(!_0x4bddbd['query']['hasOwnProperty'](_0xc1d9('0x41'))){_0x33cf4c[_0xc1d9('0x2a')]=qs['limit'](_0x4bddbd[_0xc1d9('0x40')][_0xc1d9('0x2a')]);_0x33cf4c[_0xc1d9('0x28')]=qs[_0xc1d9('0x28')](_0x4bddbd['query'][_0xc1d9('0x28')]);}_0x33cf4c[_0xc1d9('0x42')]=qs[_0xc1d9('0x43')](_0x4bddbd[_0xc1d9('0x40')]['sort']);_0x33cf4c[_0xc1d9('0x44')]=qs['filters'](_['pick'](_0x4bddbd['query'],_0x47645f[_0xc1d9('0x3c')]),_0x339446);if(_0x4bddbd['query'][_0xc1d9('0x45')]){_0x33cf4c[_0xc1d9('0x44')]=_['merge'](_0x33cf4c[_0xc1d9('0x44')],{'$or':_[_0xc1d9('0x46')](_0x339446,function(_0x4fe376){if(_0x4fe376[_0xc1d9('0x47')]!==_0xc1d9('0x48')){var _0x8b193c={};_0x8b193c[_0x4fe376['name']]={'$like':'%'+_0x4bddbd['query'][_0xc1d9('0x45')]+'%'};return _0x8b193c;}})});}_0x33cf4c=_[_0xc1d9('0x49')]({},_0x33cf4c,_0x4bddbd[_0xc1d9('0x4a')]);var _0x6795c3={'where':_0x33cf4c[_0xc1d9('0x44')]};return db[_0xc1d9('0x37')][_0xc1d9('0x2b')](_0x6795c3)['then'](function(_0x3fcc8c){_0x34fabc[_0xc1d9('0x2b')]=_0x3fcc8c;if(_0x4bddbd[_0xc1d9('0x40')]['includeAll']){_0x33cf4c[_0xc1d9('0x4b')]=[{'all':!![]}];}return db[_0xc1d9('0x37')]['findAll'](_0x33cf4c);})[_0xc1d9('0x1e')](function(_0x5a8666){_0x34fabc[_0xc1d9('0x4c')]=_0x5a8666;return _0x34fabc;})[_0xc1d9('0x1e')](respondWithFilteredResult(_0x47e62f,_0x33cf4c))[_0xc1d9('0x25')](handleError(_0x47e62f,null));};exports[_0xc1d9('0x4d')]=function(_0x52a799,_0x299c4f){var _0x5bdfe2={'raw':!![],'where':{'id':_0x52a799[_0xc1d9('0x4e')]['id']}},_0x1d5fb2={};_0x1d5fb2['model']=_[_0xc1d9('0x3b')](db[_0xc1d9('0x37')][_0xc1d9('0x4f')]);_0x1d5fb2[_0xc1d9('0x40')]=_[_0xc1d9('0x3b')](_0x52a799[_0xc1d9('0x40')]);_0x1d5fb2['filters']=_[_0xc1d9('0x3d')](_0x1d5fb2[_0xc1d9('0x3a')],_0x1d5fb2[_0xc1d9('0x40')]);_0x5bdfe2[_0xc1d9('0x3e')]=_['intersection'](_0x1d5fb2['model'],qs[_0xc1d9('0x3f')](_0x52a799[_0xc1d9('0x40')]['fields']));_0x5bdfe2[_0xc1d9('0x3e')]=_0x5bdfe2[_0xc1d9('0x3e')][_0xc1d9('0x50')]?_0x5bdfe2[_0xc1d9('0x3e')]:_0x1d5fb2['model'];if(_0x52a799['query']['includeAll']){_0x5bdfe2['include']=[{'all':!![]}];}_0x5bdfe2=_['merge']({},_0x5bdfe2,_0x52a799[_0xc1d9('0x4a')]);return db['ChatMessage'][_0xc1d9('0x51')](_0x5bdfe2)[_0xc1d9('0x1e')](handleEntityNotFound(_0x299c4f,null))[_0xc1d9('0x1e')](respondWithResult(_0x299c4f,null))[_0xc1d9('0x25')](handleError(_0x299c4f,null));};exports[_0xc1d9('0x52')]=function(_0xa7dd10,_0x3e0e63){return db[_0xc1d9('0x37')][_0xc1d9('0x52')](_0xa7dd10[_0xc1d9('0x53')],{})[_0xc1d9('0x1e')](respondWithResult(_0x3e0e63,0xc9))[_0xc1d9('0x25')](handleError(_0x3e0e63,null));};exports[_0xc1d9('0x31')]=function(_0x2fb585,_0x2a0a4e){if(_0x2fb585[_0xc1d9('0x53')]['id']){delete _0x2fb585[_0xc1d9('0x53')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x2fb585['params']['id']}})[_0xc1d9('0x1e')](handleEntityNotFound(_0x2a0a4e,null))[_0xc1d9('0x1e')](saveUpdates(_0x2fb585[_0xc1d9('0x53')],null))[_0xc1d9('0x1e')](respondWithResult(_0x2a0a4e,null))[_0xc1d9('0x25')](handleError(_0x2a0a4e,null));};exports['destroy']=function(_0x51fd0b,_0x2991ce){return db[_0xc1d9('0x37')][_0xc1d9('0x51')]({'where':{'id':_0x51fd0b[_0xc1d9('0x4e')]['id']}})[_0xc1d9('0x1e')](handleEntityNotFound(_0x2991ce,null))[_0xc1d9('0x1e')](removeEntity(_0x2991ce,null))[_0xc1d9('0x25')](handleError(_0x2991ce,null));};exports[_0xc1d9('0x54')]=function(_0x3470be,_0x3a9a27){return db[_0xc1d9('0x37')][_0xc1d9('0x54')]()[_0xc1d9('0x1e')](respondWithResult(_0x3a9a27,null))[_0xc1d9('0x25')](handleError(_0x3a9a27,null));};var interaction_log=require(_0xc1d9('0x12'))(_0xc1d9('0x55'));exports[_0xc1d9('0x56')]=function(_0x1ec318,_0x3b4a03,_0x5ad219){var _0x5e879b={'agent':{},'channel':_0xc1d9('0x57')};if(_0x1ec318[_0xc1d9('0x53')]['id']){delete _0x1ec318[_0xc1d9('0x53')]['id'];}_0x1ec318[_0xc1d9('0x53')][_0xc1d9('0x58')]=!![];_0x1ec318['body']['readAt']=moment()[_0xc1d9('0x59')](_0xc1d9('0x5a'));_0x1ec318[_0xc1d9('0x53')][_0xc1d9('0x5b')]=_0x1ec318['body'][_0xc1d9('0x5b')]||_0x1ec318[_0xc1d9('0x5c')]['id'];_0x5e879b[_0xc1d9('0x5d')]['id']=_0x1ec318['body']['UserId'];return db[_0xc1d9('0x37')][_0xc1d9('0x51')]({'where':{'id':_0x1ec318[_0xc1d9('0x4e')]['id'],'UserId':null}})[_0xc1d9('0x1e')](handleEntityNotFound(_0x3b4a03,null))[_0xc1d9('0x1e')](saveUpdates(_0x1ec318[_0xc1d9('0x53')],null))['then'](function(_0x31940c){if(_0x31940c){_0x5e879b['message']=_0x31940c[_0xc1d9('0x5e')]({'plain':!![]});return db[_0xc1d9('0x5f')]['find']({'where':{'id':_0x31940c['ChatInteractionId']}});}return null;})[_0xc1d9('0x1e')](handleEntityNotFound(_0x3b4a03,null))['then'](function(_0x4ccd02){if(_0x4ccd02){return _0x4ccd02['update']({'UserId':_0x1ec318[_0xc1d9('0x53')]['UserId'],'read1stAt':_['isNil'](_0x4ccd02['read1stAt'])?moment()[_0xc1d9('0x59')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xc1d9('0x1e')](function(_0x3c0ef1){if(_0x3c0ef1){_0x5e879b[_0xc1d9('0x60')]=_0x3c0ef1[_0xc1d9('0x5e')]({'plain':!![]});interaction_log[_0xc1d9('0x61')](_0xc1d9('0x62'),_0x1ec318['user']['id'],_0x1ec318[_0xc1d9('0x5c')][_0xc1d9('0x35')],_0x1ec318['user']['role'],_0x5e879b[_0xc1d9('0x60')]['id'],_0x1ec318[_0xc1d9('0x53')]?JSON[_0xc1d9('0x20')](_0x1ec318[_0xc1d9('0x53')]):_0xc1d9('0x63'));return respondWithRpcPromise('AcceptMessage',_0xc1d9('0x64'),_0x5e879b);}return null;})['then'](function(_0x31484c){var _0xfaafd8=_0xc1d9('0x65')+_0x31484c[_0xc1d9('0x24')][_0xc1d9('0x66')];return db['sequelize']['query'](_0xfaafd8,{'type':db[_0xc1d9('0x67')][_0xc1d9('0x68')][_0xc1d9('0x69')],'raw':!![]})['then'](function(_0x2559a7){return _0x2559a7;});})['then'](function(_0xbd779){if(_0xbd779){_0x5e879b[_0xc1d9('0x24')]['contact']=_0xbd779[0x0];if(!_0x1ec318[_0xc1d9('0x53')]['UserId'])return;return db[_0xc1d9('0x6a')][_0xc1d9('0x51')]({'where':{'id':_0x1ec318[_0xc1d9('0x53')][_0xc1d9('0x5b')],'role':_0xc1d9('0x5d')},'attributes':['id',_0xc1d9('0x35'),_0xc1d9('0x6b'),_0xc1d9('0x6c'),_0xc1d9('0x6d')],'raw':!![]});}return null;})[_0xc1d9('0x1e')](function(_0x41202d){if(!_0x41202d)return null;_0x5e879b[_0xc1d9('0x24')][_0xc1d9('0x5d')]=_0x41202d;return _0x5e879b;})[_0xc1d9('0x1e')](function(_0x5da42a){if(_0x5da42a){if(_0x1ec318[_0xc1d9('0x53')][_0xc1d9('0x6e')]){_0x5e879b[_0xc1d9('0x24')][_0xc1d9('0x6f')]=util['format'](_0xc1d9('0x70'),_0x1ec318[_0xc1d9('0x5c')][_0xc1d9('0x35')]);_0x5e879b[_0xc1d9('0x24')][_0xc1d9('0x71')]=_0x5e879b[_0xc1d9('0x71')];_0x5e879b['message'][_0xc1d9('0x72')]=_0x5e879b[_0xc1d9('0x71')];_0x5e879b['message'][_0xc1d9('0x73')]='accept';return respondWithRpcPromise('EventManager',_0xc1d9('0x74'),{'event':'acceptmessage','message':_[_0xc1d9('0x49')](_0x5e879b[_0xc1d9('0x24')],JSON[_0xc1d9('0x75')](_0x5e879b[_0xc1d9('0x60')][_0xc1d9('0x76')]))},client9002)[_0xc1d9('0x1e')](function(){return _0x5e879b;});}return _0x5e879b;}return null;})['then'](respondWithResult(_0x3b4a03,null))['catch'](handleError(_0x3b4a03,null));};var interaction_log=require(_0xc1d9('0x12'))(_0xc1d9('0x55'));exports['reject']=function(_0x5376ae,_0x33372e,_0x5ccd43){var _0x5c3997={'agent':{},'channel':_0xc1d9('0x57')};if(_0x5376ae['body']['id']){delete _0x5376ae[_0xc1d9('0x53')]['id'];}_0x5376ae[_0xc1d9('0x53')][_0xc1d9('0x5b')]=_0x5376ae['body'][_0xc1d9('0x5b')]||_0x5376ae[_0xc1d9('0x5c')]['id'];_0x5c3997['agent']['id']=_0x5376ae[_0xc1d9('0x53')]['UserId'];return db[_0xc1d9('0x37')]['find']({'where':{'id':_0x5376ae[_0xc1d9('0x4e')]['id'],'UserId':null}})[_0xc1d9('0x1e')](handleEntityNotFound(_0x33372e,null))[_0xc1d9('0x1e')](function(_0x264108){if(_0x264108){_0x5c3997[_0xc1d9('0x24')]=_0x264108['get']({'plain':!![]});return db[_0xc1d9('0x5f')]['find']({'where':{'id':_0x264108[_0xc1d9('0x77')]}});}return null;})[_0xc1d9('0x1e')](handleEntityNotFound(_0x33372e,null))[_0xc1d9('0x1e')](function(_0x4fbec){if(_0x4fbec){_0x5c3997['interaction']=_0x4fbec[_0xc1d9('0x5e')]({'plain':!![]});interaction_log[_0xc1d9('0x61')](_0xc1d9('0x78'),_0x5376ae[_0xc1d9('0x5c')]['id'],_0x5376ae[_0xc1d9('0x5c')][_0xc1d9('0x35')],_0x5376ae[_0xc1d9('0x5c')][_0xc1d9('0x79')],_0x5c3997['interaction']['id'],_0x5376ae[_0xc1d9('0x53')]?JSON[_0xc1d9('0x20')](_0x5376ae[_0xc1d9('0x53')]):_0xc1d9('0x63'));return respondWithRpcPromise(_0xc1d9('0x7a'),'rejectMessage',_0x5c3997);}return null;})[_0xc1d9('0x1e')](function(_0x33eeb0){var _0x2e7fcc=_0xc1d9('0x65')+_0x33eeb0[_0xc1d9('0x24')][_0xc1d9('0x66')];return db[_0xc1d9('0x7b')][_0xc1d9('0x40')](_0x2e7fcc,{'type':db[_0xc1d9('0x67')]['QueryTypes'][_0xc1d9('0x69')],'raw':!![]})[_0xc1d9('0x1e')](function(_0x177f3f){return _0x177f3f;});})[_0xc1d9('0x1e')](function(_0x406260){if(_0x406260){_0x5c3997[_0xc1d9('0x24')]['contact']=_0x406260[0x0];if(!_0x5376ae[_0xc1d9('0x53')][_0xc1d9('0x5b')])return;return db[_0xc1d9('0x6a')]['find']({'where':{'id':_0x5376ae[_0xc1d9('0x53')][_0xc1d9('0x5b')],'role':_0xc1d9('0x5d')},'attributes':['id',_0xc1d9('0x35'),_0xc1d9('0x6b'),'email',_0xc1d9('0x6d')],'raw':!![]});}return null;})[_0xc1d9('0x1e')](function(_0x2b6054){if(!_0x2b6054)return null;_0x5c3997['message'][_0xc1d9('0x5d')]=_0x2b6054;return _0x5c3997;})[_0xc1d9('0x1e')](function(_0x208777){if(_0x208777){_0x208777[_0xc1d9('0x24')][_0xc1d9('0x6f')]=util['format'](_0xc1d9('0x70'),_0x5376ae[_0xc1d9('0x5c')][_0xc1d9('0x35')]);_0x208777[_0xc1d9('0x24')][_0xc1d9('0x71')]=_0x5c3997[_0xc1d9('0x71')];_0x208777[_0xc1d9('0x24')][_0xc1d9('0x72')]=_0x5c3997[_0xc1d9('0x71')];_0x208777[_0xc1d9('0x24')][_0xc1d9('0x73')]=_0xc1d9('0x2f');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_['merge'](_0x5c3997[_0xc1d9('0x24')],JSON[_0xc1d9('0x75')](_0x5c3997[_0xc1d9('0x60')]['formData']))},client9002);return _0x5c3997;}return null;})['then'](respondWithResult(_0x33372e,null))[_0xc1d9('0x25')](handleError(_0x33372e,null));}; \ No newline at end of file +var _0x83f0=['SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','ContactId','fullname','email','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','apply','reject','save','update','destroy','stack','name','send','map','ChatMessage','rawAttributes','fieldName','key','model','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','filter','options','include','findAll','rows','show','params','keys','length','includeAll','create','body','find','describe','accept','chat','read','readAt','format','UserId','agent','get','ChatInteraction','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','User','internal','interface'];(function(_0x2701fd,_0x506374){var _0x2a9cff=function(_0x4aaec1){while(--_0x4aaec1){_0x2701fd['push'](_0x2701fd['shift']());}};_0x2a9cff(++_0x506374);}(_0x83f0,0x99));var _0x083f=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x83f0[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require(_0x083f('0x0'));var rimraf=require(_0x083f('0x1'));var zipdir=require(_0x083f('0x2'));var jsonpatch=require(_0x083f('0x3'));var rp=require(_0x083f('0x4'));var moment=require('moment');var BPromise=require(_0x083f('0x5'));var Mustache=require(_0x083f('0x6'));var util=require('util');var path=require(_0x083f('0x7'));var sox=require(_0x083f('0x8'));var csv=require(_0x083f('0x9'));var ejs=require(_0x083f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x083f('0xb'));var squel=require(_0x083f('0xc'));var crypto=require(_0x083f('0xd'));var jsforce=require(_0x083f('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x083f('0xf'));var Papa=require(_0x083f('0x10'));var Redis=require(_0x083f('0x11'));var authService=require(_0x083f('0x12'));var qs=require(_0x083f('0x13'));var as=require(_0x083f('0x14'));var hardwareService=require(_0x083f('0x15'));var logger=require(_0x083f('0x16'))(_0x083f('0x17'));var utils=require(_0x083f('0x18'));var config=require(_0x083f('0x19'));var licenseUtil=require(_0x083f('0x1a'));var db=require(_0x083f('0x1b'))['db'];config['redis']=_['defaults'](config[_0x083f('0x1c')],{'host':_0x083f('0x1d'),'port':0x18eb});var socket=require(_0x083f('0x1e'))(new Redis(config[_0x083f('0x1c')]));require(_0x083f('0x1f'))[_0x083f('0x20')](socket);var jayson=require(_0x083f('0x21'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x083f('0x22')][_0x083f('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x5375e4,_0xde980a,_0x5d757a,_0x56118d){return new BPromise(function(_0x3371f0,_0xc47aef){var _0x4b597e=_0x56118d||client;return _0x4b597e[_0x083f('0x24')](_0x5375e4,_0x5d757a)[_0x083f('0x25')](function(_0x1816dc){logger['info'](_0x083f('0x26'),_0xde980a,_0x083f('0x27'));logger[_0x083f('0x28')](_0x083f('0x29'),_0xde980a,_0x083f('0x27'),JSON[_0x083f('0x2a')](_0x1816dc));if(_0x1816dc[_0x083f('0x2b')]){if(_0x1816dc[_0x083f('0x2b')][_0x083f('0x2c')]===0x1f4){logger[_0x083f('0x2b')](_0x083f('0x26'),_0xde980a,_0x1816dc['error'][_0x083f('0x2d')]);return _0xc47aef(_0x1816dc[_0x083f('0x2b')][_0x083f('0x2d')]);}logger[_0x083f('0x2b')](_0x083f('0x26'),_0xde980a,_0x1816dc['error'][_0x083f('0x2d')]);return _0x3371f0(_0x1816dc[_0x083f('0x2b')][_0x083f('0x2d')]);}else{logger[_0x083f('0x2e')]('ChatMessage,\x20%s,\x20%s',_0xde980a,_0x083f('0x27'));_0x3371f0(_0x1816dc[_0x083f('0x2f')][_0x083f('0x2d')]);}})[_0x083f('0x30')](function(_0x4812f0){logger[_0x083f('0x2b')]('ChatMessage,\x20%s,\x20%s',_0xde980a,_0x4812f0);_0xc47aef(_0x4812f0);});});}function respondWithStatusCode(_0x11f6d3,_0xa2bfe0){_0xa2bfe0=_0xa2bfe0||0xcc;return function(_0x379247){if(_0x379247){return _0x11f6d3[_0x083f('0x31')](_0xa2bfe0);}return _0x11f6d3['status'](_0xa2bfe0)[_0x083f('0x32')]();};}function respondWithResult(_0x5bddb6,_0x3973ad){_0x3973ad=_0x3973ad||0xc8;return function(_0x5475c5){if(_0x5475c5){return _0x5bddb6[_0x083f('0x33')](_0x3973ad)[_0x083f('0x34')](_0x5475c5);}};}function respondWithFilteredResult(_0x200886,_0x172f1d){return function(_0x4a93c7){if(_0x4a93c7){var _0x19409b=typeof _0x172f1d[_0x083f('0x35')]===_0x083f('0x36')&&typeof _0x172f1d['limit']===_0x083f('0x36');var _0x162bb4=_0x4a93c7['count'];var _0x319954=_0x19409b?0x0:_0x172f1d[_0x083f('0x35')];var _0x355eb4=_0x19409b?_0x4a93c7[_0x083f('0x37')]:_0x172f1d[_0x083f('0x35')]+_0x172f1d[_0x083f('0x38')];var _0x4a4535;if(_0x355eb4>=_0x162bb4){_0x355eb4=_0x162bb4;_0x4a4535=0xc8;}else{_0x4a4535=0xce;}_0x200886['status'](_0x4a4535);return _0x200886['set']('Content-Range',_0x319954+'-'+_0x355eb4+'/'+_0x162bb4)[_0x083f('0x34')](_0x4a93c7);}return null;};}function patchUpdates(_0x1472b2){return function(_0x1f2c9f){try{jsonpatch[_0x083f('0x39')](_0x1f2c9f,_0x1472b2,!![]);}catch(_0x4dfc3c){return BPromise[_0x083f('0x3a')](_0x4dfc3c);}return _0x1f2c9f[_0x083f('0x3b')]();};}function saveUpdates(_0x1e0902,_0x4af0f8){return function(_0x142854){if(_0x142854){return _0x142854[_0x083f('0x3c')](_0x1e0902)[_0x083f('0x25')](function(_0x228408){return _0x228408;});}return null;};}function removeEntity(_0x2dcf45,_0x59634b){return function(_0x1f5c92){if(_0x1f5c92){return _0x1f5c92[_0x083f('0x3d')]()[_0x083f('0x25')](function(){_0x2dcf45[_0x083f('0x33')](0xcc)[_0x083f('0x32')]();});}};}function handleEntityNotFound(_0x52cf65,_0x9820a3){return function(_0x27ef51){if(!_0x27ef51){_0x52cf65[_0x083f('0x31')](0x194);}return _0x27ef51;};}function handleError(_0xf2a10f,_0x4a79b6){_0x4a79b6=_0x4a79b6||0x1f4;return function(_0x2a1bde){logger['error'](_0x2a1bde[_0x083f('0x3e')]);if(_0x2a1bde[_0x083f('0x3f')]){delete _0x2a1bde[_0x083f('0x3f')];}_0xf2a10f['status'](_0x4a79b6)[_0x083f('0x40')](_0x2a1bde);};}exports['index']=function(_0x22e2c3,_0x117db5){var _0x199595={},_0x7e1941={},_0x46a6d3={'count':0x0,'rows':[]};var _0x265790=_[_0x083f('0x41')](db[_0x083f('0x42')][_0x083f('0x43')],function(_0x5cf33e){return{'name':_0x5cf33e[_0x083f('0x44')],'type':_0x5cf33e['type'][_0x083f('0x45')]};});_0x7e1941[_0x083f('0x46')]=_[_0x083f('0x41')](_0x265790,_0x083f('0x3f'));_0x7e1941['query']=_['keys'](_0x22e2c3['query']);_0x7e1941['filters']=_[_0x083f('0x47')](_0x7e1941[_0x083f('0x46')],_0x7e1941[_0x083f('0x48')]);_0x199595[_0x083f('0x49')]=_[_0x083f('0x47')](_0x7e1941[_0x083f('0x46')],qs['fields'](_0x22e2c3[_0x083f('0x48')][_0x083f('0x4a')]));_0x199595[_0x083f('0x49')]=_0x199595['attributes']['length']?_0x199595['attributes']:_0x7e1941['model'];if(!_0x22e2c3[_0x083f('0x48')][_0x083f('0x4b')](_0x083f('0x4c'))){_0x199595[_0x083f('0x38')]=qs[_0x083f('0x38')](_0x22e2c3['query'][_0x083f('0x38')]);_0x199595['offset']=qs[_0x083f('0x35')](_0x22e2c3[_0x083f('0x48')][_0x083f('0x35')]);}_0x199595[_0x083f('0x4d')]=qs[_0x083f('0x4e')](_0x22e2c3['query'][_0x083f('0x4e')]);_0x199595['where']=qs[_0x083f('0x4f')](_[_0x083f('0x50')](_0x22e2c3[_0x083f('0x48')],_0x7e1941['filters']),_0x265790);if(_0x22e2c3['query']['filter']){_0x199595[_0x083f('0x51')]=_[_0x083f('0x52')](_0x199595[_0x083f('0x51')],{'$or':_[_0x083f('0x41')](_0x265790,function(_0x585b8b){if(_0x585b8b['type']!=='VIRTUAL'){var _0x4d9079={};_0x4d9079[_0x585b8b[_0x083f('0x3f')]]={'$like':'%'+_0x22e2c3[_0x083f('0x48')][_0x083f('0x53')]+'%'};return _0x4d9079;}})});}_0x199595=_['merge']({},_0x199595,_0x22e2c3[_0x083f('0x54')]);var _0x3bf87d={'where':_0x199595[_0x083f('0x51')]};return db[_0x083f('0x42')][_0x083f('0x37')](_0x3bf87d)[_0x083f('0x25')](function(_0x48c268){_0x46a6d3[_0x083f('0x37')]=_0x48c268;if(_0x22e2c3['query']['includeAll']){_0x199595[_0x083f('0x55')]=[{'all':!![]}];}return db[_0x083f('0x42')][_0x083f('0x56')](_0x199595);})[_0x083f('0x25')](function(_0x17fbe3){_0x46a6d3[_0x083f('0x57')]=_0x17fbe3;return _0x46a6d3;})['then'](respondWithFilteredResult(_0x117db5,_0x199595))[_0x083f('0x30')](handleError(_0x117db5,null));};exports[_0x083f('0x58')]=function(_0x7a6b1e,_0x22730e){var _0x569304={'raw':!![],'where':{'id':_0x7a6b1e[_0x083f('0x59')]['id']}},_0x3ecd11={};_0x3ecd11[_0x083f('0x46')]=_[_0x083f('0x5a')](db[_0x083f('0x42')][_0x083f('0x43')]);_0x3ecd11[_0x083f('0x48')]=_[_0x083f('0x5a')](_0x7a6b1e['query']);_0x3ecd11[_0x083f('0x4f')]=_[_0x083f('0x47')](_0x3ecd11['model'],_0x3ecd11['query']);_0x569304['attributes']=_[_0x083f('0x47')](_0x3ecd11[_0x083f('0x46')],qs[_0x083f('0x4a')](_0x7a6b1e['query'][_0x083f('0x4a')]));_0x569304[_0x083f('0x49')]=_0x569304[_0x083f('0x49')][_0x083f('0x5b')]?_0x569304[_0x083f('0x49')]:_0x3ecd11[_0x083f('0x46')];if(_0x7a6b1e['query'][_0x083f('0x5c')]){_0x569304[_0x083f('0x55')]=[{'all':!![]}];}_0x569304=_['merge']({},_0x569304,_0x7a6b1e['options']);return db[_0x083f('0x42')]['find'](_0x569304)['then'](handleEntityNotFound(_0x22730e,null))['then'](respondWithResult(_0x22730e,null))['catch'](handleError(_0x22730e,null));};exports[_0x083f('0x5d')]=function(_0x33ffbd,_0xf9663c){return db[_0x083f('0x42')][_0x083f('0x5d')](_0x33ffbd['body'],{})[_0x083f('0x25')](respondWithResult(_0xf9663c,0xc9))[_0x083f('0x30')](handleError(_0xf9663c,null));};exports[_0x083f('0x3c')]=function(_0xeccc51,_0x583c33){if(_0xeccc51[_0x083f('0x5e')]['id']){delete _0xeccc51['body']['id'];}return db[_0x083f('0x42')][_0x083f('0x5f')]({'where':{'id':_0xeccc51[_0x083f('0x59')]['id']}})['then'](handleEntityNotFound(_0x583c33,null))[_0x083f('0x25')](saveUpdates(_0xeccc51[_0x083f('0x5e')],null))[_0x083f('0x25')](respondWithResult(_0x583c33,null))[_0x083f('0x30')](handleError(_0x583c33,null));};exports[_0x083f('0x3d')]=function(_0x53e06c,_0x3fa58b){return db['ChatMessage'][_0x083f('0x5f')]({'where':{'id':_0x53e06c['params']['id']}})[_0x083f('0x25')](handleEntityNotFound(_0x3fa58b,null))[_0x083f('0x25')](removeEntity(_0x3fa58b,null))[_0x083f('0x30')](handleError(_0x3fa58b,null));};exports[_0x083f('0x60')]=function(_0x954329,_0x5e34ed){return db[_0x083f('0x42')]['describe']()[_0x083f('0x25')](respondWithResult(_0x5e34ed,null))[_0x083f('0x30')](handleError(_0x5e34ed,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x083f('0x61')]=function(_0x2a4693,_0xf88a59,_0x33b7a1){var _0x567519={'agent':{},'channel':_0x083f('0x62')};if(_0x2a4693[_0x083f('0x5e')]['id']){delete _0x2a4693[_0x083f('0x5e')]['id'];}_0x2a4693['body'][_0x083f('0x63')]=!![];_0x2a4693['body'][_0x083f('0x64')]=moment()[_0x083f('0x65')]('YYYY-MM-DD\x20HH:mm:ss');_0x2a4693[_0x083f('0x5e')][_0x083f('0x66')]=_0x2a4693['body'][_0x083f('0x66')]||_0x2a4693['user']['id'];_0x567519[_0x083f('0x67')]['id']=_0x2a4693['body']['UserId'];return db[_0x083f('0x42')]['find']({'where':{'id':_0x2a4693[_0x083f('0x59')]['id'],'UserId':null}})[_0x083f('0x25')](handleEntityNotFound(_0xf88a59,null))[_0x083f('0x25')](saveUpdates(_0x2a4693['body'],null))[_0x083f('0x25')](function(_0x24f5d7){if(_0x24f5d7){_0x567519[_0x083f('0x2d')]=_0x24f5d7[_0x083f('0x68')]({'plain':!![]});return db[_0x083f('0x69')][_0x083f('0x5f')]({'where':{'id':_0x24f5d7['ChatInteractionId']}});}return null;})[_0x083f('0x25')](handleEntityNotFound(_0xf88a59,null))[_0x083f('0x25')](function(_0x129fd3){if(_0x129fd3){return _0x129fd3['update']({'UserId':_0x2a4693['body'][_0x083f('0x66')],'read1stAt':_[_0x083f('0x6a')](_0x129fd3['read1stAt'])?moment()[_0x083f('0x65')](_0x083f('0x6b')):undefined});}return null;})['then'](function(_0x515fbc){if(_0x515fbc){_0x567519[_0x083f('0x6c')]=_0x515fbc[_0x083f('0x68')]({'plain':!![]});interaction_log['info'](_0x083f('0x6d'),_0x2a4693[_0x083f('0x6e')]['id'],_0x2a4693['user'][_0x083f('0x3f')],_0x2a4693[_0x083f('0x6e')][_0x083f('0x6f')],_0x567519[_0x083f('0x6c')]['id'],_0x2a4693[_0x083f('0x5e')]?JSON[_0x083f('0x2a')](_0x2a4693[_0x083f('0x5e')]):_0x083f('0x70'));return respondWithRpcPromise(_0x083f('0x71'),_0x083f('0x72'),_0x567519);}return null;})[_0x083f('0x25')](function(_0xaf30ad){var _0x14e8f8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xaf30ad[_0x083f('0x2d')]['ContactId'];return db[_0x083f('0x73')]['query'](_0x14e8f8,{'type':db[_0x083f('0x74')][_0x083f('0x75')][_0x083f('0x76')],'raw':!![]})[_0x083f('0x25')](function(_0x978091){return _0x978091;});})[_0x083f('0x25')](function(_0x337c8a){if(_0x337c8a){_0x567519['message'][_0x083f('0x77')]=_0x337c8a[0x0];if(!_0x2a4693[_0x083f('0x5e')][_0x083f('0x66')])return;return db[_0x083f('0x78')][_0x083f('0x5f')]({'where':{'id':_0x2a4693[_0x083f('0x5e')][_0x083f('0x66')],'role':_0x083f('0x67')},'attributes':['id',_0x083f('0x3f'),'fullname','email',_0x083f('0x79')],'raw':!![]});}return null;})[_0x083f('0x25')](function(_0xe33f8c){if(!_0xe33f8c)return null;_0x567519[_0x083f('0x2d')][_0x083f('0x67')]=_0xe33f8c;return _0x567519;})[_0x083f('0x25')](function(_0x38534f){if(_0x38534f){if(_0x2a4693[_0x083f('0x5e')]['manual']){_0x567519['message'][_0x083f('0x7a')]=util['format'](_0x083f('0x7b'),_0x2a4693[_0x083f('0x6e')][_0x083f('0x3f')]);_0x567519[_0x083f('0x2d')][_0x083f('0x7c')]=_0x567519[_0x083f('0x7c')];_0x567519[_0x083f('0x2d')][_0x083f('0x7d')]=_0x567519[_0x083f('0x7c')];_0x567519[_0x083f('0x2d')][_0x083f('0x7e')]=_0x083f('0x61');return respondWithRpcPromise(_0x083f('0x7f'),'EventManager',{'event':_0x083f('0x80'),'message':_['merge'](_0x567519[_0x083f('0x2d')],JSON[_0x083f('0x81')](_0x567519['interaction'][_0x083f('0x82')]))},client9002)['then'](function(){return _0x567519;});}return _0x567519;}return null;})[_0x083f('0x25')](respondWithResult(_0xf88a59,null))[_0x083f('0x30')](handleError(_0xf88a59,null));};var interaction_log=require(_0x083f('0x16'))('chat-interactions');exports[_0x083f('0x3a')]=function(_0x4c8957,_0x32725e,_0x22a6ad){var _0xffb386={'agent':{},'channel':_0x083f('0x62')};if(_0x4c8957['body']['id']){delete _0x4c8957[_0x083f('0x5e')]['id'];}_0x4c8957['body'][_0x083f('0x66')]=_0x4c8957['body'][_0x083f('0x66')]||_0x4c8957['user']['id'];_0xffb386['agent']['id']=_0x4c8957[_0x083f('0x5e')][_0x083f('0x66')];return db[_0x083f('0x42')][_0x083f('0x5f')]({'where':{'id':_0x4c8957[_0x083f('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x32725e,null))[_0x083f('0x25')](function(_0x33aabe){if(_0x33aabe){_0xffb386[_0x083f('0x2d')]=_0x33aabe[_0x083f('0x68')]({'plain':!![]});return db[_0x083f('0x69')][_0x083f('0x5f')]({'where':{'id':_0x33aabe[_0x083f('0x83')]}});}return null;})['then'](handleEntityNotFound(_0x32725e,null))[_0x083f('0x25')](function(_0x580499){if(_0x580499){_0xffb386[_0x083f('0x6c')]=_0x580499[_0x083f('0x68')]({'plain':!![]});interaction_log[_0x083f('0x2e')](_0x083f('0x84'),_0x4c8957[_0x083f('0x6e')]['id'],_0x4c8957[_0x083f('0x6e')][_0x083f('0x3f')],_0x4c8957['user'][_0x083f('0x6f')],_0xffb386[_0x083f('0x6c')]['id'],_0x4c8957['body']?JSON[_0x083f('0x2a')](_0x4c8957[_0x083f('0x5e')]):_0x083f('0x70'));return respondWithRpcPromise(_0x083f('0x85'),'rejectMessage',_0xffb386);}return null;})[_0x083f('0x25')](function(_0x406646){var _0x5ae848='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x406646[_0x083f('0x2d')][_0x083f('0x86')];return db[_0x083f('0x73')][_0x083f('0x48')](_0x5ae848,{'type':db[_0x083f('0x74')][_0x083f('0x75')][_0x083f('0x76')],'raw':!![]})[_0x083f('0x25')](function(_0x621d21){return _0x621d21;});})[_0x083f('0x25')](function(_0x1fc3c8){if(_0x1fc3c8){_0xffb386[_0x083f('0x2d')][_0x083f('0x77')]=_0x1fc3c8[0x0];if(!_0x4c8957[_0x083f('0x5e')][_0x083f('0x66')])return;return db[_0x083f('0x78')][_0x083f('0x5f')]({'where':{'id':_0x4c8957[_0x083f('0x5e')][_0x083f('0x66')],'role':_0x083f('0x67')},'attributes':['id',_0x083f('0x3f'),_0x083f('0x87'),_0x083f('0x88'),_0x083f('0x79')],'raw':!![]});}return null;})['then'](function(_0x376515){if(!_0x376515)return null;_0xffb386[_0x083f('0x2d')][_0x083f('0x67')]=_0x376515;return _0xffb386;})['then'](function(_0xf21f47){if(_0xf21f47){_0xf21f47['message'][_0x083f('0x7a')]=util[_0x083f('0x65')](_0x083f('0x7b'),_0x4c8957[_0x083f('0x6e')][_0x083f('0x3f')]);_0xf21f47[_0x083f('0x2d')][_0x083f('0x7c')]=_0xffb386[_0x083f('0x7c')];_0xf21f47[_0x083f('0x2d')][_0x083f('0x7d')]=_0xffb386[_0x083f('0x7c')];_0xf21f47[_0x083f('0x2d')][_0x083f('0x7e')]=_0x083f('0x3a');respondWithRpcPromise(_0x083f('0x7f'),_0x083f('0x7f'),{'event':_0x083f('0x89'),'message':_['merge'](_0xffb386[_0x083f('0x2d')],JSON[_0x083f('0x81')](_0xffb386[_0x083f('0x6c')][_0x083f('0x82')]))},client9002);return _0xffb386;}return null;})[_0x083f('0x25')](respondWithResult(_0x32725e,null))[_0x083f('0x30')](handleError(_0x32725e,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 71fb7a2..29b0c21 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 _0x3c14=['emit','hasOwnProperty','exports','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x3c14,0x1b3));var _0x43c1=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x3c14[_0x29d94e];return _0x106237;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x43c1('0x0'))['db'][_0x43c1('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x43c1('0x2')](0x0);var events={'afterCreate':_0x43c1('0x3'),'afterUpdate':_0x43c1('0x4'),'afterDestroy':_0x43c1('0x5')};function emitEvent(_0x4fe7b9){return function(_0x37aee9,_0x4bbd0d,_0x3cd48a){ChatMessageEvents[_0x43c1('0x6')](_0x4fe7b9+':'+_0x37aee9['id'],_0x37aee9);ChatMessageEvents[_0x43c1('0x6')](_0x4fe7b9,_0x37aee9);_0x3cd48a(null);};}for(var e in events){if(events[_0x43c1('0x7')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x43c1('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0xd47e=['hook','exports','events','ChatMessage','setMaxListeners','save','update','remove','hasOwnProperty'];(function(_0x43576f,_0x1356ed){var _0x4d2466=function(_0x865deb){while(--_0x865deb){_0x43576f['push'](_0x43576f['shift']());}};_0x4d2466(++_0x1356ed);}(_0xd47e,0x134));var _0xed47=function(_0x464e93,_0x3f5e20){_0x464e93=_0x464e93-0x0;var _0x18e264=_0xd47e[_0x464e93];return _0x18e264;};'use strict';var EventEmitter=require(_0xed47('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xed47('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xed47('0x2')](0x0);var events={'afterCreate':_0xed47('0x3'),'afterUpdate':_0xed47('0x4'),'afterDestroy':_0xed47('0x5')};function emitEvent(_0x2fe77e){return function(_0x574cb6,_0x1a72fc,_0xea4bb9){ChatMessageEvents['emit'](_0x2fe77e+':'+_0x574cb6['id'],_0x574cb6);ChatMessageEvents['emit'](_0x2fe77e,_0x574cb6);_0xea4bb9(null);};}for(var e in events){if(events[_0xed47('0x6')](e)){var event=events[e];ChatMessage[_0xed47('0x7')](e,emitEvent(event));}}module[_0xed47('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 98e09f9..595b633 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 _0x23f5=['toLowerCase','out','secret','isNil','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','path','./chatMessage.attributes','define','ChatMessage','chat_messages','body','models','get','direction'];(function(_0x2fa1c6,_0x4a5b8d){var _0x5f3257=function(_0x195b53){while(--_0x195b53){_0x2fa1c6['push'](_0x2fa1c6['shift']());}};_0x5f3257(++_0x4a5b8d);}(_0x23f5,0x95));var _0x523f=function(_0x245c4f,_0x34b70f){_0x245c4f=_0x245c4f-0x0;var _0x3157a1=_0x23f5[_0x245c4f];return _0x3157a1;};'use strict';var _=require(_0x523f('0x0'));var util=require('util');var logger=require(_0x523f('0x1'))('api');var moment=require(_0x523f('0x2'));var BPromise=require(_0x523f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x523f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x523f('0x5'));module['exports']=function(_0x5c21a1,_0x5b10e7){return _0x5c21a1[_0x523f('0x6')](_0x523f('0x7'),attributes,{'tableName':_0x523f('0x8'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x523f('0x9')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f7e87,_0x4f412e,_0x5502f0){var _0x3af25e=_0x5c21a1[_0x523f('0xa')];var _0x51ec70=_0x1f7e87[_0x523f('0xb')]({'plain':!![]});if(_0x51ec70[_0x523f('0xc')][_0x523f('0xd')]()==='in'||_0x51ec70['direction'][_0x523f('0xd')]()===_0x523f('0xe')&&!_0x51ec70[_0x523f('0xf')]&&!_[_0x523f('0x10')](_0x51ec70['UserId'])){_0x3af25e[_0x523f('0x11')][_0x523f('0x12')]({'where':{'id':_0x51ec70[_0x523f('0x13')]}})[_0x523f('0x14')](function(_0x460c8b){if(_0x460c8b){_0x460c8b[_0x523f('0x15')]({'lastMsgAt':_0x51ec70[_0x523f('0x16')],'lastMsgDirection':_0x51ec70[_0x523f('0xc')]['toLowerCase']()});}})[_0x523f('0x17')](function(_0x3de6fe){console[_0x523f('0x18')](_0x3de6fe);});}_0x5502f0();}},'charset':_0x523f('0x19'),'collate':_0x523f('0x1a')});}; \ No newline at end of file +var _0xbd5c=['UserId','ChatInteraction','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','out','secret'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xbd5c,0x19d));var _0xcbd5=function(_0xf6d197,_0x948e12){_0xf6d197=_0xf6d197-0x0;var _0x420255=_0xbd5c[_0xf6d197];return _0x420255;};'use strict';var _=require(_0xcbd5('0x0'));var util=require(_0xcbd5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcbd5('0x2'));var BPromise=require(_0xcbd5('0x3'));var rp=require(_0xcbd5('0x4'));var fs=require('fs');var path=require(_0xcbd5('0x5'));var rimraf=require(_0xcbd5('0x6'));var config=require(_0xcbd5('0x7'));var attributes=require(_0xcbd5('0x8'));module[_0xcbd5('0x9')]=function(_0x389aaa,_0xb2e08){return _0x389aaa['define'](_0xcbd5('0xa'),attributes,{'tableName':_0xcbd5('0xb'),'paranoid':![],'indexes':[{'name':_0xcbd5('0xc'),'fields':[_0xcbd5('0xd')],'type':_0xcbd5('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4f12c0,_0x52cf5b,_0x431e3f){var _0x5f45ba=_0x389aaa[_0xcbd5('0xf')];var _0x6a7fe2=_0x4f12c0['get']({'plain':!![]});if(_0x6a7fe2['direction']['toLowerCase']()==='in'||_0x6a7fe2[_0xcbd5('0x10')]['toLowerCase']()===_0xcbd5('0x11')&&!_0x6a7fe2[_0xcbd5('0x12')]&&!_['isNil'](_0x6a7fe2[_0xcbd5('0x13')])){_0x5f45ba[_0xcbd5('0x14')]['findOne']({'where':{'id':_0x6a7fe2['ChatInteractionId']}})['then'](function(_0x1af92a){if(_0x1af92a){_0x1af92a['update']({'lastMsgAt':_0x6a7fe2['createdAt'],'lastMsgDirection':_0x6a7fe2[_0xcbd5('0x10')]['toLowerCase']()});}})['catch'](function(_0x235c81){console[_0xcbd5('0x15')](_0x235c81);});}_0x431e3f();}},'charset':_0xcbd5('0x16'),'collate':_0xcbd5('0x17')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index b691c5d..b313515 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 _0xe790=['message','result','catch','CreateChatMessage','ChatMessage','create','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x2241c4,_0x4dbf54){var _0x24264c=function(_0x3a33fb){while(--_0x3a33fb){_0x2241c4['push'](_0x2241c4['shift']());}};_0x24264c(++_0x4dbf54);}(_0xe790,0x189));var _0x0e79=function(_0x32cf2e,_0xfd311b){_0x32cf2e=_0x32cf2e-0x0;var _0x220ef4=_0xe790[_0x32cf2e];return _0x220ef4;};'use strict';var _=require(_0x0e79('0x0'));var util=require(_0x0e79('0x1'));var moment=require(_0x0e79('0x2'));var BPromise=require(_0x0e79('0x3'));var rs=require(_0x0e79('0x4'));var fs=require('fs');var Redis=require(_0x0e79('0x5'));var db=require(_0x0e79('0x6'))['db'];var utils=require(_0x0e79('0x7'));var logger=require(_0x0e79('0x8'))(_0x0e79('0x9'));var config=require(_0x0e79('0xa'));var jayson=require(_0x0e79('0xb'));var client=jayson['client']['http']({'port':0x232a});config[_0x0e79('0xc')]=_[_0x0e79('0xd')](config[_0x0e79('0xc')],{'host':_0x0e79('0xe'),'port':0x18eb});var socket=require(_0x0e79('0xf'))(new Redis(config[_0x0e79('0xc')]));require(_0x0e79('0x10'))[_0x0e79('0x11')](socket);function respondWithRpcPromise(_0x1a9ba2,_0x572c3d,_0x9de360){return new BPromise(function(_0x1090a4,_0x20e217){return client[_0x0e79('0x12')](_0x1a9ba2,_0x9de360)[_0x0e79('0x13')](function(_0xa1a46c){logger[_0x0e79('0x14')](_0x0e79('0x15'),_0x572c3d,'request\x20sent');logger[_0x0e79('0x16')](_0x0e79('0x17'),_0x572c3d,_0x0e79('0x18'),JSON['stringify'](_0xa1a46c));if(_0xa1a46c['error']){if(_0xa1a46c[_0x0e79('0x19')][_0x0e79('0x1a')]===0x1f4){logger['error'](_0x0e79('0x15'),_0x572c3d,_0xa1a46c['error'][_0x0e79('0x1b')]);return _0x20e217(_0xa1a46c[_0x0e79('0x19')][_0x0e79('0x1b')]);}logger[_0x0e79('0x19')](_0x0e79('0x15'),_0x572c3d,_0xa1a46c['error'][_0x0e79('0x1b')]);return _0x1090a4(_0xa1a46c[_0x0e79('0x19')][_0x0e79('0x1b')]);}else{logger[_0x0e79('0x14')](_0x0e79('0x15'),_0x572c3d,_0x0e79('0x18'));_0x1090a4(_0xa1a46c[_0x0e79('0x1c')]['message']);}})[_0x0e79('0x1d')](function(_0x13f0d3){logger['error'](_0x0e79('0x15'),_0x572c3d,_0x13f0d3);_0x20e217(_0x13f0d3);});});}exports[_0x0e79('0x1e')]=function(_0x414aca){var _0x189ac3=this;return new Promise(function(_0x35bcbd,_0x29d66c){return db[_0x0e79('0x1f')][_0x0e79('0x20')](_0x414aca[_0x0e79('0x21')],{'raw':_0x414aca[_0x0e79('0x22')]?_0x414aca[_0x0e79('0x22')]['raw']===undefined?!![]:![]:!![]})[_0x0e79('0x13')](function(_0x4c8b13){logger[_0x0e79('0x14')](_0x0e79('0x1e'),_0x414aca);logger['debug'](_0x0e79('0x1e'),_0x414aca,JSON['stringify'](_0x4c8b13));_0x35bcbd(_0x4c8b13);})['catch'](function(_0x44919d){logger[_0x0e79('0x19')]('CreateChatMessage',_0x44919d[_0x0e79('0x1b')],_0x414aca);_0x29d66c(_0x189ac3[_0x0e79('0x19')](0x1f4,_0x44919d[_0x0e79('0x1b')]));});});}; \ No newline at end of file +var _0x184a=['message','info','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x58b9b2,_0x4a3098){var _0x215fb5=function(_0x70e8d3){while(--_0x70e8d3){_0x58b9b2['push'](_0x58b9b2['shift']());}};_0x215fb5(++_0x4a3098);}(_0x184a,0x16b));var _0xa184=function(_0x26fe83,_0x29110){_0x26fe83=_0x26fe83-0x0;var _0x41b15f=_0x184a[_0x26fe83];return _0x41b15f;};'use strict';var _=require(_0xa184('0x0'));var util=require('util');var moment=require(_0xa184('0x1'));var BPromise=require(_0xa184('0x2'));var rs=require(_0xa184('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa184('0x4'))['db'];var utils=require(_0xa184('0x5'));var logger=require(_0xa184('0x6'))(_0xa184('0x7'));var config=require(_0xa184('0x8'));var jayson=require(_0xa184('0x9'));var client=jayson[_0xa184('0xa')]['http']({'port':0x232a});config[_0xa184('0xb')]=_['defaults'](config[_0xa184('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa184('0xb')]));require('./chatMessage.socket')[_0xa184('0xc')](socket);function respondWithRpcPromise(_0x54e82e,_0x5d7adf,_0xa9bbf6){return new BPromise(function(_0x3ee8e1,_0x1bdac7){return client[_0xa184('0xd')](_0x54e82e,_0xa9bbf6)[_0xa184('0xe')](function(_0x1e3d9e){logger['info'](_0xa184('0xf'),_0x5d7adf,_0xa184('0x10'));logger[_0xa184('0x11')](_0xa184('0x12'),_0x5d7adf,_0xa184('0x10'),JSON['stringify'](_0x1e3d9e));if(_0x1e3d9e[_0xa184('0x13')]){if(_0x1e3d9e['error'][_0xa184('0x14')]===0x1f4){logger['error'](_0xa184('0xf'),_0x5d7adf,_0x1e3d9e[_0xa184('0x13')]['message']);return _0x1bdac7(_0x1e3d9e[_0xa184('0x13')][_0xa184('0x15')]);}logger[_0xa184('0x13')](_0xa184('0xf'),_0x5d7adf,_0x1e3d9e[_0xa184('0x13')][_0xa184('0x15')]);return _0x3ee8e1(_0x1e3d9e['error'][_0xa184('0x15')]);}else{logger[_0xa184('0x16')]('ChatMessage,\x20%s,\x20%s',_0x5d7adf,_0xa184('0x10'));_0x3ee8e1(_0x1e3d9e[_0xa184('0x17')][_0xa184('0x15')]);}})[_0xa184('0x18')](function(_0x11d91e){logger[_0xa184('0x13')]('ChatMessage,\x20%s,\x20%s',_0x5d7adf,_0x11d91e);_0x1bdac7(_0x11d91e);});});}exports[_0xa184('0x19')]=function(_0x67496e){var _0x5d210c=this;return new Promise(function(_0x58d70e,_0x24b71e){return db[_0xa184('0x1a')][_0xa184('0x1b')](_0x67496e[_0xa184('0x1c')],{'raw':_0x67496e[_0xa184('0x1d')]?_0x67496e[_0xa184('0x1d')][_0xa184('0x1e')]===undefined?!![]:![]:!![]})[_0xa184('0xe')](function(_0x2c4a11){logger['info'](_0xa184('0x19'),_0x67496e);logger[_0xa184('0x11')]('CreateChatMessage',_0x67496e,JSON[_0xa184('0x1f')](_0x2c4a11));_0x58d70e(_0x2c4a11);})[_0xa184('0x18')](function(_0x2a0ec8){logger[_0xa184('0x13')](_0xa184('0x19'),_0x2a0ec8['message'],_0x67496e);_0x24b71e(_0x5d210c[_0xa184('0x13')](0x1f4,_0x2a0ec8[_0xa184('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 916d864..70b4ea4 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 _0xeb0d=['removeListener','register','./chatMessage.events','emit'];(function(_0x500785,_0x15e5ff){var _0x1f8bcc=function(_0x406983){while(--_0x406983){_0x500785['push'](_0x500785['shift']());}};_0x1f8bcc(++_0x15e5ff);}(_0xeb0d,0xe2));var _0xdeb0=function(_0x3c357e,_0x4c3edf){_0x3c357e=_0x3c357e-0x0;var _0x5cec9c=_0xeb0d[_0x3c357e];return _0x5cec9c;};'use strict';var ChatMessageEvents=require(_0xdeb0('0x0'));var events=['save','remove','update'];function createListener(_0x256ce4,_0x430873){return function(_0x538fc2){_0x430873[_0xdeb0('0x1')](_0x256ce4,_0x538fc2);};}function removeListener(_0x36367c,_0xd8dd51){return function(){ChatMessageEvents[_0xdeb0('0x2')](_0x36367c,_0xd8dd51);};}exports[_0xdeb0('0x3')]=function(_0x13d486){for(var _0xc48108=0x0,_0x27ebaa=events['length'];_0xc48108<_0x27ebaa;_0xc48108++){var _0x28a1a4=events[_0xc48108];var _0x16b36b=createListener('chatMessage:'+_0x28a1a4,_0x13d486);ChatMessageEvents['on'](_0x28a1a4,_0x16b36b);}}; \ No newline at end of file +var _0xdd0c=['save','remove','update','emit','removeListener','register','length'];(function(_0x42c2f7,_0x16bbdd){var _0x55c3ae=function(_0x24502f){while(--_0x24502f){_0x42c2f7['push'](_0x42c2f7['shift']());}};_0x55c3ae(++_0x16bbdd);}(_0xdd0c,0x165));var _0xcdd0=function(_0x491fcf,_0x450f7f){_0x491fcf=_0x491fcf-0x0;var _0x5b65f1=_0xdd0c[_0x491fcf];return _0x5b65f1;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xcdd0('0x0'),_0xcdd0('0x1'),_0xcdd0('0x2')];function createListener(_0x5e3ada,_0xe8ed9){return function(_0x5b86cb){_0xe8ed9[_0xcdd0('0x3')](_0x5e3ada,_0x5b86cb);};}function removeListener(_0x159e38,_0x432716){return function(){ChatMessageEvents[_0xcdd0('0x4')](_0x159e38,_0x432716);};}exports[_0xcdd0('0x5')]=function(_0x5ae472){for(var _0x2b33fc=0x0,_0x1b6f5d=events[_0xcdd0('0x6')];_0x2b33fc<_0x1b6f5d;_0x2b33fc++){var _0x15c402=events[_0x2b33fc];var _0x337496=createListener('chatMessage:'+_0x15c402,_0x5ae472);ChatMessageEvents['on'](_0x15c402,_0x337496);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index e6d1ec4..a8e9f7b 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 _0xf780=['chat','chatmessage:create','put','update','/:id/accept','/:id/reject','destroy','exports','multer','util','path','express','fs-extra','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','tracked'];(function(_0x4c4959,_0x54fc9c){var _0x3ecab1=function(_0x3a4307){while(--_0x3a4307){_0x4c4959['push'](_0x4c4959['shift']());}};_0x3ecab1(++_0x54fc9c);}(_0xf780,0x86));var _0x0f78=function(_0x39387b,_0x398b81){_0x39387b=_0x39387b-0x0;var _0x1b8aba=_0xf780[_0x39387b];return _0x1b8aba;};'use strict';var multer=require(_0x0f78('0x0'));var util=require(_0x0f78('0x1'));var path=require(_0x0f78('0x2'));var timeout=require('connect-timeout');var express=require(_0x0f78('0x3'));var router=express['Router']();var fs_extra=require(_0x0f78('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0f78('0x5'));var controller=require('./chatMessage.controller');router[_0x0f78('0x6')]('/',auth['isAuthenticated'](),controller[_0x0f78('0x7')]);router[_0x0f78('0x6')](_0x0f78('0x8'),auth[_0x0f78('0x9')](),controller[_0x0f78('0xa')]);router['get'](_0x0f78('0xb'),auth[_0x0f78('0x9')](),controller['show']);router['post']('/',auth[_0x0f78('0x9')](),interaction[_0x0f78('0xc')](_0x0f78('0xd'),_0x0f78('0xe')),controller['create']);router[_0x0f78('0xf')]('/:id',controller[_0x0f78('0x10')]);router[_0x0f78('0xf')](_0x0f78('0x11'),auth['isAuthenticated'](),controller['accept']);router[_0x0f78('0xf')](_0x0f78('0x12'),auth[_0x0f78('0x9')](),controller['reject']);router['delete'](_0x0f78('0xb'),auth[_0x0f78('0x9')](),controller[_0x0f78('0x13')]);module[_0x0f78('0x14')]=router; \ No newline at end of file +var _0x5a61=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','chat','chatmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a61,0x6b));var _0x15a6=function(_0x3e103d,_0x55790c){_0x3e103d=_0x3e103d-0x0;var _0x4931bf=_0x5a61[_0x3e103d];return _0x4931bf;};'use strict';var multer=require(_0x15a6('0x0'));var util=require('util');var path=require(_0x15a6('0x1'));var timeout=require(_0x15a6('0x2'));var express=require(_0x15a6('0x3'));var router=express[_0x15a6('0x4')]();var fs_extra=require(_0x15a6('0x5'));var auth=require(_0x15a6('0x6'));var interaction=require(_0x15a6('0x7'));var config=require(_0x15a6('0x8'));var controller=require(_0x15a6('0x9'));router[_0x15a6('0xa')]('/',auth[_0x15a6('0xb')](),controller[_0x15a6('0xc')]);router[_0x15a6('0xa')](_0x15a6('0xd'),auth[_0x15a6('0xb')](),controller[_0x15a6('0xe')]);router[_0x15a6('0xa')](_0x15a6('0xf'),auth[_0x15a6('0xb')](),controller['show']);router[_0x15a6('0x10')]('/',auth[_0x15a6('0xb')](),interaction[_0x15a6('0x11')](_0x15a6('0x12'),_0x15a6('0x13')),controller['create']);router[_0x15a6('0x14')](_0x15a6('0xf'),controller[_0x15a6('0x15')]);router[_0x15a6('0x14')](_0x15a6('0x16'),auth[_0x15a6('0xb')](),controller[_0x15a6('0x17')]);router[_0x15a6('0x14')](_0x15a6('0x18'),auth[_0x15a6('0xb')](),controller[_0x15a6('0x19')]);router[_0x15a6('0x1a')](_0x15a6('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 2f2309b..379f1c2 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 _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x2d21d8,_0x5c1fa9){var _0x132c02=function(_0x1c383c){while(--_0x1c383c){_0x2d21d8['push'](_0x2d21d8['shift']());}};_0x132c02(++_0x5c1fa9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x38b271,_0x587ec9){_0x38b271=_0x38b271-0x0;var _0x29d174=_0x5f2f[_0x38b271];return _0x29d174;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0xadb5=['medium','TEXT','exports'];(function(_0x184abf,_0x1bd5d2){var _0x4954a4=function(_0x600bf7){while(--_0x600bf7){_0x184abf['push'](_0x184abf['shift']());}};_0x4954a4(++_0x1bd5d2);}(_0xadb5,0xad));var _0x5adb=function(_0x3b59c0,_0x13a0bd){_0x3b59c0=_0x3b59c0-0x0;var _0x1e2e25=_0xadb5[_0x3b59c0];return _0x1e2e25;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 3060075..79f692c 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x7a54,0x106));var _0x47a5=function(_0xb33efa,_0x1366fd){_0xb33efa=_0xb33efa-0x0;var _0x71e283=_0x7a54[_0xb33efa];return _0x71e283;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x7a54,0x106));var _0x47a5=function(_0x5e7f9f,_0x2de81a){_0x5e7f9f=_0x5e7f9f-0x0;var _0x2afd1b=_0x7a54[_0x5e7f9f];return _0x2afd1b;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index b6dd571..e4994bc 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 _0xcb37=['events','update','remove','emit','hasOwnProperty','exports'];(function(_0x254b3c,_0x3c7484){var _0x460aa5=function(_0x4f22b9){while(--_0x4f22b9){_0x254b3c['push'](_0x254b3c['shift']());}};_0x460aa5(++_0x3c7484);}(_0xcb37,0xa8));var _0x7cb3=function(_0x488316,_0x1923b5){_0x488316=_0x488316-0x0;var _0x40f588=_0xcb37[_0x488316];return _0x40f588;};'use strict';var EventEmitter=require(_0x7cb3('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x7cb3('0x1'),'afterDestroy':_0x7cb3('0x2')};function emitEvent(_0x9afe46){return function(_0x34eeca,_0x2fd81e,_0x24de95){ChatOfflineMessageEvents[_0x7cb3('0x3')](_0x9afe46+':'+_0x34eeca['id'],_0x34eeca);ChatOfflineMessageEvents[_0x7cb3('0x3')](_0x9afe46,_0x34eeca);_0x24de95(null);};}for(var e in events){if(events[_0x7cb3('0x4')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x7cb3('0x5')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x847f=['emit','exports','events','../../mysqldb','ChatOfflineMessage','save','update','remove'];(function(_0x30c0a8,_0xfe54a1){var _0x17a034=function(_0x585a6f){while(--_0x585a6f){_0x30c0a8['push'](_0x30c0a8['shift']());}};_0x17a034(++_0xfe54a1);}(_0x847f,0x182));var _0xf847=function(_0x3705f7,_0x2553c4){_0x3705f7=_0x3705f7-0x0;var _0x2a1cf2=_0x847f[_0x3705f7];return _0x2a1cf2;};'use strict';var EventEmitter=require(_0xf847('0x0'));var ChatOfflineMessage=require(_0xf847('0x1'))['db'][_0xf847('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf847('0x3'),'afterUpdate':_0xf847('0x4'),'afterDestroy':_0xf847('0x5')};function emitEvent(_0x2e0f72){return function(_0x12faa2,_0x5d5964,_0x5eeab2){ChatOfflineMessageEvents[_0xf847('0x6')](_0x2e0f72+':'+_0x12faa2['id'],_0x12faa2);ChatOfflineMessageEvents[_0xf847('0x6')](_0x2e0f72,_0x12faa2);_0x5eeab2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0xf847('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index e918b94..f45c349 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 _0xbb3a=['chat_offline_messages','./chatOfflineMessage.attributes','define','ChatOfflineMessage'];(function(_0x13cb05,_0x24e6eb){var _0x490ad1=function(_0x31317f){while(--_0x31317f){_0x13cb05['push'](_0x13cb05['shift']());}};_0x490ad1(++_0x24e6eb);}(_0xbb3a,0x175));var _0xabb3=function(_0x2de92f,_0x45b4aa){_0x2de92f=_0x2de92f-0x0;var _0x55e6b5=_0xbb3a[_0x2de92f];return _0x55e6b5;};'use strict';var attributes=require(_0xabb3('0x0'));module['exports']=function(_0x17bd2f){return _0x17bd2f[_0xabb3('0x1')](_0xabb3('0x2'),attributes,{'tableName':_0xabb3('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9a43=['./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci'];(function(_0x393d69,_0x3a8c83){var _0x3cee37=function(_0x462682){while(--_0x462682){_0x393d69['push'](_0x393d69['shift']());}};_0x3cee37(++_0x3a8c83);}(_0x9a43,0x96));var _0x39a4=function(_0x15a833,_0x5092d6){_0x15a833=_0x15a833-0x0;var _0x371593=_0x9a43[_0x15a833];return _0x371593;};'use strict';var attributes=require(_0x39a4('0x0'));module[_0x39a4('0x1')]=function(_0x3cac99){return _0x3cac99[_0x39a4('0x2')](_0x39a4('0x3'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x39a4('0x4'),'collate':_0x39a4('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 0480956..a13f82f 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 _0xf029=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash'];(function(_0x19462f,_0xacc5ed){var _0x425473=function(_0x10aacf){while(--_0x10aacf){_0x19462f['push'](_0x19462f['shift']());}};_0x425473(++_0xacc5ed);}(_0xf029,0x16f));var _0x9f02=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xf029[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0x9f02('0x0'));var util=require(_0x9f02('0x1'));var moment=require(_0x9f02('0x2'));var BPromise=require(_0x9f02('0x3'));var rs=require(_0x9f02('0x4'));var fs=require('fs');var Redis=require(_0x9f02('0x5'));var db=require(_0x9f02('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9f02('0x7'));var jayson=require(_0x9f02('0x8'));var client=jayson[_0x9f02('0x9')][_0x9f02('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6aa12d,_0x560535,_0x5a2091){return new BPromise(function(_0x466b5e,_0x786688){return client[_0x9f02('0xb')](_0x6aa12d,_0x5a2091)[_0x9f02('0xc')](function(_0xf42b27){logger['info'](_0x9f02('0xd'),_0x560535,_0x9f02('0xe'));logger[_0x9f02('0xf')](_0x9f02('0x10'),_0x560535,_0x9f02('0xe'),JSON['stringify'](_0xf42b27));if(_0xf42b27[_0x9f02('0x11')]){if(_0xf42b27[_0x9f02('0x11')][_0x9f02('0x12')]===0x1f4){logger[_0x9f02('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x560535,_0xf42b27['error'][_0x9f02('0x13')]);return _0x786688(_0xf42b27[_0x9f02('0x11')]['message']);}logger[_0x9f02('0x11')](_0x9f02('0xd'),_0x560535,_0xf42b27['error'][_0x9f02('0x13')]);return _0x466b5e(_0xf42b27[_0x9f02('0x11')][_0x9f02('0x13')]);}else{logger[_0x9f02('0x14')](_0x9f02('0xd'),_0x560535,_0x9f02('0xe'));_0x466b5e(_0xf42b27[_0x9f02('0x15')][_0x9f02('0x13')]);}})[_0x9f02('0x16')](function(_0x3ccf9b){logger['error'](_0x9f02('0xd'),_0x560535,_0x3ccf9b);_0x786688(_0x3ccf9b);});});} \ No newline at end of file +var _0x21d1=['bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment'];(function(_0x4029b1,_0x4a2674){var _0x27ac22=function(_0x500e25){while(--_0x500e25){_0x4029b1['push'](_0x4029b1['shift']());}};_0x27ac22(++_0x4a2674);}(_0x21d1,0x1c9));var _0x121d=function(_0x5a13ec,_0x431fd7){_0x5a13ec=_0x5a13ec-0x0;var _0x27fd53=_0x21d1[_0x5a13ec];return _0x27fd53;};'use strict';var _=require(_0x121d('0x0'));var util=require(_0x121d('0x1'));var moment=require(_0x121d('0x2'));var BPromise=require(_0x121d('0x3'));var rs=require(_0x121d('0x4'));var fs=require('fs');var Redis=require(_0x121d('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x121d('0x6'))(_0x121d('0x7'));var config=require(_0x121d('0x8'));var jayson=require(_0x121d('0x9'));var client=jayson[_0x121d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x226625,_0x2bd1e8,_0x47b50b){return new BPromise(function(_0x2d4d7e,_0x242f0c){return client[_0x121d('0xb')](_0x226625,_0x47b50b)[_0x121d('0xc')](function(_0x8b07c2){logger[_0x121d('0xd')](_0x121d('0xe'),_0x2bd1e8,'request\x20sent');logger[_0x121d('0xf')](_0x121d('0x10'),_0x2bd1e8,_0x121d('0x11'),JSON['stringify'](_0x8b07c2));if(_0x8b07c2['error']){if(_0x8b07c2[_0x121d('0x12')][_0x121d('0x13')]===0x1f4){logger[_0x121d('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2bd1e8,_0x8b07c2['error'][_0x121d('0x14')]);return _0x242f0c(_0x8b07c2['error'][_0x121d('0x14')]);}logger[_0x121d('0x12')](_0x121d('0xe'),_0x2bd1e8,_0x8b07c2['error'][_0x121d('0x14')]);return _0x2d4d7e(_0x8b07c2[_0x121d('0x12')][_0x121d('0x14')]);}else{logger[_0x121d('0xd')](_0x121d('0xe'),_0x2bd1e8,_0x121d('0x11'));_0x2d4d7e(_0x8b07c2[_0x121d('0x15')][_0x121d('0x14')]);}})[_0x121d('0x16')](function(_0x475541){logger[_0x121d('0x12')](_0x121d('0xe'),_0x2bd1e8,_0x475541);_0x242f0c(_0x475541);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 5cbcaf0..2afdb2f 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 _0xc51e=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc51e,0x178));var _0xec51=function(_0x24fc2c,_0x47b500){_0x24fc2c=_0x24fc2c-0x0;var _0x483de4=_0xc51e[_0x24fc2c];return _0x483de4;};'use strict';var multer=require(_0xec51('0x0'));var util=require(_0xec51('0x1'));var path=require('path');var timeout=require(_0xec51('0x2'));var express=require(_0xec51('0x3'));var router=express[_0xec51('0x4')]();var fs_extra=require(_0xec51('0x5'));var auth=require(_0xec51('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xec51('0x7'));router[_0xec51('0x8')]('/',auth[_0xec51('0x9')](),controller[_0xec51('0xa')]);router['get'](_0xec51('0xb'),auth[_0xec51('0x9')](),controller[_0xec51('0xc')]);router[_0xec51('0x8')](_0xec51('0xd'),auth[_0xec51('0x9')](),controller[_0xec51('0xe')]);router[_0xec51('0xf')]('/',auth[_0xec51('0x9')](),controller['create']);router[_0xec51('0x10')](_0xec51('0xd'),auth[_0xec51('0x9')](),controller[_0xec51('0x11')]);router[_0xec51('0x12')](_0xec51('0xd'),auth['isAuthenticated'](),controller[_0xec51('0x13')]);module[_0xec51('0x14')]=router; \ No newline at end of file +var _0xc88d=['update','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc88d,0x1be));var _0xdc88=function(_0x49f371,_0x5a4f84){_0x49f371=_0x49f371-0x0;var _0x101bd9=_0xc88d[_0x49f371];return _0x101bd9;};'use strict';var multer=require('multer');var util=require(_0xdc88('0x0'));var path=require(_0xdc88('0x1'));var timeout=require(_0xdc88('0x2'));var express=require(_0xdc88('0x3'));var router=express[_0xdc88('0x4')]();var fs_extra=require(_0xdc88('0x5'));var auth=require(_0xdc88('0x6'));var interaction=require(_0xdc88('0x7'));var config=require(_0xdc88('0x8'));var controller=require('./chatOfflineMessage.controller');router[_0xdc88('0x9')]('/',auth[_0xdc88('0xa')](),controller[_0xdc88('0xb')]);router[_0xdc88('0x9')]('/describe',auth[_0xdc88('0xa')](),controller['describe']);router['get']('/:id',auth[_0xdc88('0xa')](),controller[_0xdc88('0xc')]);router[_0xdc88('0xd')]('/',auth[_0xdc88('0xa')](),controller[_0xdc88('0xe')]);router[_0xdc88('0xf')]('/:id',auth[_0xdc88('0xa')](),controller[_0xdc88('0x10')]);router[_0xdc88('0x11')](_0xdc88('0x12'),auth[_0xdc88('0xa')](),controller[_0xdc88('0x13')]);module[_0xdc88('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 90bf8e3..b184d70 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 _0x1f4d=['sequelize','exports','STRING','timeout','mouseOver','INTEGER'];(function(_0x730192,_0x531aed){var _0x24bd5d=function(_0x53221c){while(--_0x53221c){_0x730192['push'](_0x730192['shift']());}};_0x24bd5d(++_0x531aed);}(_0x1f4d,0xc6));var _0xd1f4=function(_0x4f8f53,_0x523ab0){_0x4f8f53=_0x4f8f53-0x0;var _0x5c5038=_0x1f4d[_0x4f8f53];return _0x5c5038;};'use strict';var Sequelize=require(_0xd1f4('0x0'));module[_0xd1f4('0x1')]={'name':{'type':Sequelize[_0xd1f4('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver',_0xd1f4('0x3')),'defaultValue':_0xd1f4('0x4')},'selector':{'type':Sequelize[_0xd1f4('0x2')]},'timeout':{'type':Sequelize[_0xd1f4('0x5')]}}; \ No newline at end of file +var _0x665d=['ENUM','mouseOver','timeout','sequelize','exports'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x665d,0x12f));var _0xd665=function(_0x57aec1,_0x2b6744){_0x57aec1=_0x57aec1-0x0;var _0x4597ae=_0x665d[_0x57aec1];return _0x4597ae;};'use strict';var Sequelize=require(_0xd665('0x0'));module[_0xd665('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xd665('0x2')](_0xd665('0x3'),_0xd665('0x4')),'defaultValue':_0xd665('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 1ef91a0..40421a5 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 _0xecd5=['ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','find','catch','create','body','update','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','show','params','model','keys'];(function(_0x5e7979,_0x4175c0){var _0x50f569=function(_0x184fa4){while(--_0x184fa4){_0x5e7979['push'](_0x5e7979['shift']());}};_0x50f569(++_0x4175c0);}(_0xecd5,0x110));var _0x5ecd=function(_0x285e99,_0x2f98ca){_0x285e99=_0x285e99-0x0;var _0x17623b=_0xecd5[_0x285e99];return _0x17623b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5ecd('0x0'));var zipdir=require(_0x5ecd('0x1'));var jsonpatch=require(_0x5ecd('0x2'));var rp=require('request-promise');var moment=require(_0x5ecd('0x3'));var BPromise=require(_0x5ecd('0x4'));var Mustache=require(_0x5ecd('0x5'));var util=require(_0x5ecd('0x6'));var path=require('path');var sox=require(_0x5ecd('0x7'));var csv=require('to-csv');var ejs=require(_0x5ecd('0x8'));var fs=require('fs');var fs_extra=require(_0x5ecd('0x9'));var _=require('lodash');var squel=require(_0x5ecd('0xa'));var crypto=require(_0x5ecd('0xb'));var jsforce=require(_0x5ecd('0xc'));var deskjs=require(_0x5ecd('0xd'));var toCsv=require(_0x5ecd('0xe'));var querystring=require(_0x5ecd('0xf'));var Papa=require(_0x5ecd('0x10'));var Redis=require(_0x5ecd('0x11'));var authService=require(_0x5ecd('0x12'));var qs=require(_0x5ecd('0x13'));var as=require(_0x5ecd('0x14'));var hardwareService=require(_0x5ecd('0x15'));var logger=require('../../config/logger')(_0x5ecd('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5ecd('0x17'));var db=require(_0x5ecd('0x18'))['db'];function respondWithStatusCode(_0x4b7add,_0x4fc1ec){_0x4fc1ec=_0x4fc1ec||0xcc;return function(_0x3eaad7){if(_0x3eaad7){return _0x4b7add[_0x5ecd('0x19')](_0x4fc1ec);}return _0x4b7add[_0x5ecd('0x1a')](_0x4fc1ec)[_0x5ecd('0x1b')]();};}function respondWithResult(_0x57bd97,_0x3b918c){_0x3b918c=_0x3b918c||0xc8;return function(_0x3b54f1){if(_0x3b54f1){return _0x57bd97['status'](_0x3b918c)[_0x5ecd('0x1c')](_0x3b54f1);}};}function respondWithFilteredResult(_0xacc5c4,_0x48442a){return function(_0x458899){if(_0x458899){var _0x4a0e19=typeof _0x48442a[_0x5ecd('0x1d')]===_0x5ecd('0x1e')&&typeof _0x48442a[_0x5ecd('0x1f')]===_0x5ecd('0x1e');var _0x3d4973=_0x458899[_0x5ecd('0x20')];var _0x231da2=_0x4a0e19?0x0:_0x48442a[_0x5ecd('0x1d')];var _0x3078ea=_0x4a0e19?_0x458899[_0x5ecd('0x20')]:_0x48442a[_0x5ecd('0x1d')]+_0x48442a[_0x5ecd('0x1f')];var _0x575985;if(_0x3078ea>=_0x3d4973){_0x3078ea=_0x3d4973;_0x575985=0xc8;}else{_0x575985=0xce;}_0xacc5c4[_0x5ecd('0x1a')](_0x575985);return _0xacc5c4[_0x5ecd('0x21')](_0x5ecd('0x22'),_0x231da2+'-'+_0x3078ea+'/'+_0x3d4973)[_0x5ecd('0x1c')](_0x458899);}return null;};}function patchUpdates(_0xea18b7){return function(_0x5e7d1f){try{jsonpatch[_0x5ecd('0x23')](_0x5e7d1f,_0xea18b7,!![]);}catch(_0x5628c4){return BPromise[_0x5ecd('0x24')](_0x5628c4);}return _0x5e7d1f[_0x5ecd('0x25')]();};}function saveUpdates(_0x38e74e,_0x3c8e2b){return function(_0x31a6d9){if(_0x31a6d9){return _0x31a6d9['update'](_0x38e74e)[_0x5ecd('0x26')](function(_0x1453ed){return _0x1453ed;});}return null;};}function removeEntity(_0x1d9161,_0x57168b){return function(_0xe80905){if(_0xe80905){return _0xe80905[_0x5ecd('0x27')]()[_0x5ecd('0x26')](function(){_0x1d9161[_0x5ecd('0x1a')](0xcc)[_0x5ecd('0x1b')]();});}};}function handleEntityNotFound(_0x20f134,_0x3d0086){return function(_0x14b07b){if(!_0x14b07b){_0x20f134['sendStatus'](0x194);}return _0x14b07b;};}function handleError(_0x1e3902,_0x5ae414){_0x5ae414=_0x5ae414||0x1f4;return function(_0x12a109){logger[_0x5ecd('0x28')](_0x12a109[_0x5ecd('0x29')]);if(_0x12a109[_0x5ecd('0x2a')]){delete _0x12a109[_0x5ecd('0x2a')];}_0x1e3902['status'](_0x5ae414)[_0x5ecd('0x2b')](_0x12a109);};}exports[_0x5ecd('0x2c')]=function(_0x33ca9e,_0x38c87d){var _0x389b88={'raw':!![],'where':{'id':_0x33ca9e[_0x5ecd('0x2d')]['id']}},_0x1c3eb8={};_0x1c3eb8[_0x5ecd('0x2e')]=_[_0x5ecd('0x2f')](db[_0x5ecd('0x30')][_0x5ecd('0x31')]);_0x1c3eb8[_0x5ecd('0x32')]=_[_0x5ecd('0x2f')](_0x33ca9e[_0x5ecd('0x32')]);_0x1c3eb8[_0x5ecd('0x33')]=_[_0x5ecd('0x34')](_0x1c3eb8[_0x5ecd('0x2e')],_0x1c3eb8['query']);_0x389b88[_0x5ecd('0x35')]=_[_0x5ecd('0x34')](_0x1c3eb8[_0x5ecd('0x2e')],qs[_0x5ecd('0x36')](_0x33ca9e[_0x5ecd('0x32')]['fields']));_0x389b88[_0x5ecd('0x35')]=_0x389b88[_0x5ecd('0x35')][_0x5ecd('0x37')]?_0x389b88[_0x5ecd('0x35')]:_0x1c3eb8[_0x5ecd('0x2e')];if(_0x33ca9e['query'][_0x5ecd('0x38')]){_0x389b88[_0x5ecd('0x39')]=[{'all':!![]}];}_0x389b88=_[_0x5ecd('0x3a')]({},_0x389b88,_0x33ca9e['options']);return db[_0x5ecd('0x30')][_0x5ecd('0x3b')](_0x389b88)[_0x5ecd('0x26')](handleEntityNotFound(_0x38c87d,null))[_0x5ecd('0x26')](respondWithResult(_0x38c87d,null))[_0x5ecd('0x3c')](handleError(_0x38c87d,null));};exports[_0x5ecd('0x3d')]=function(_0x57ebf0,_0xce7884){return db['ChatProactiveAction']['create'](_0x57ebf0[_0x5ecd('0x3e')],{})[_0x5ecd('0x26')](respondWithResult(_0xce7884,0xc9))[_0x5ecd('0x3c')](handleError(_0xce7884,null));};exports[_0x5ecd('0x3f')]=function(_0x38809f,_0x41975e){if(_0x38809f['body']['id']){delete _0x38809f['body']['id'];}return db[_0x5ecd('0x30')][_0x5ecd('0x3b')]({'where':{'id':_0x38809f[_0x5ecd('0x2d')]['id']}})[_0x5ecd('0x26')](handleEntityNotFound(_0x41975e,null))[_0x5ecd('0x26')](saveUpdates(_0x38809f[_0x5ecd('0x3e')],null))[_0x5ecd('0x26')](respondWithResult(_0x41975e,null))['catch'](handleError(_0x41975e,null));};exports[_0x5ecd('0x27')]=function(_0x2f4377,_0x2a499b){return db['ChatProactiveAction'][_0x5ecd('0x3b')]({'where':{'id':_0x2f4377[_0x5ecd('0x2d')]['id']}})[_0x5ecd('0x26')](handleEntityNotFound(_0x2a499b,null))['then'](removeEntity(_0x2a499b,null))['catch'](handleError(_0x2a499b,null));}; \ No newline at end of file +var _0x4e00=['sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','end','name','send','show','model','keys','ChatProactiveAction','rawAttributes','query','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','catch','params','destroy','rimraf','fast-json-patch','request-promise','mustache','path'];(function(_0x213ba1,_0x35c70f){var _0x192447=function(_0x5b5968){while(--_0x5b5968){_0x213ba1['push'](_0x213ba1['shift']());}};_0x192447(++_0x35c70f);}(_0x4e00,0xa0));var _0x04e0=function(_0x4b6bb4,_0x205fd3){_0x4b6bb4=_0x4b6bb4-0x0;var _0x53b2f6=_0x4e00[_0x4b6bb4];return _0x53b2f6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x04e0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x04e0('0x1'));var rp=require(_0x04e0('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x04e0('0x3'));var util=require('util');var path=require(_0x04e0('0x4'));var sox=require(_0x04e0('0x5'));var csv=require(_0x04e0('0x6'));var ejs=require(_0x04e0('0x7'));var fs=require('fs');var fs_extra=require(_0x04e0('0x8'));var _=require(_0x04e0('0x9'));var squel=require(_0x04e0('0xa'));var crypto=require('crypto');var jsforce=require(_0x04e0('0xb'));var deskjs=require(_0x04e0('0xc'));var toCsv=require(_0x04e0('0x6'));var querystring=require(_0x04e0('0xd'));var Papa=require('papaparse');var Redis=require(_0x04e0('0xe'));var authService=require(_0x04e0('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x04e0('0x10'));var logger=require('../../config/logger')(_0x04e0('0x11'));var utils=require(_0x04e0('0x12'));var config=require(_0x04e0('0x13'));var licenseUtil=require(_0x04e0('0x14'));var db=require(_0x04e0('0x15'))['db'];function respondWithStatusCode(_0xc0ae61,_0x2a620a){_0x2a620a=_0x2a620a||0xcc;return function(_0x323881){if(_0x323881){return _0xc0ae61['sendStatus'](_0x2a620a);}return _0xc0ae61[_0x04e0('0x16')](_0x2a620a)['end']();};}function respondWithResult(_0x1963cf,_0x29f682){_0x29f682=_0x29f682||0xc8;return function(_0xdf6702){if(_0xdf6702){return _0x1963cf['status'](_0x29f682)[_0x04e0('0x17')](_0xdf6702);}};}function respondWithFilteredResult(_0x3823f6,_0x2e28a5){return function(_0x221c66){if(_0x221c66){var _0x462cf7=typeof _0x2e28a5[_0x04e0('0x18')]===_0x04e0('0x19')&&typeof _0x2e28a5[_0x04e0('0x1a')]===_0x04e0('0x19');var _0xf7b102=_0x221c66[_0x04e0('0x1b')];var _0x1b6f4a=_0x462cf7?0x0:_0x2e28a5[_0x04e0('0x18')];var _0x5bdd6c=_0x462cf7?_0x221c66['count']:_0x2e28a5['offset']+_0x2e28a5[_0x04e0('0x1a')];var _0x3e940e;if(_0x5bdd6c>=_0xf7b102){_0x5bdd6c=_0xf7b102;_0x3e940e=0xc8;}else{_0x3e940e=0xce;}_0x3823f6[_0x04e0('0x16')](_0x3e940e);return _0x3823f6['set'](_0x04e0('0x1c'),_0x1b6f4a+'-'+_0x5bdd6c+'/'+_0xf7b102)[_0x04e0('0x17')](_0x221c66);}return null;};}function patchUpdates(_0x27e761){return function(_0x7bc646){try{jsonpatch['apply'](_0x7bc646,_0x27e761,!![]);}catch(_0x4fdbc4){return BPromise[_0x04e0('0x1d')](_0x4fdbc4);}return _0x7bc646[_0x04e0('0x1e')]();};}function saveUpdates(_0x34e44c,_0x310473){return function(_0x9e9020){if(_0x9e9020){return _0x9e9020[_0x04e0('0x1f')](_0x34e44c)[_0x04e0('0x20')](function(_0x3c3f69){return _0x3c3f69;});}return null;};}function removeEntity(_0x4566e2,_0x133b27){return function(_0x30decd){if(_0x30decd){return _0x30decd['destroy']()[_0x04e0('0x20')](function(){_0x4566e2[_0x04e0('0x16')](0xcc)[_0x04e0('0x21')]();});}};}function handleEntityNotFound(_0x2f47e1,_0x207c4c){return function(_0x50416c){if(!_0x50416c){_0x2f47e1['sendStatus'](0x194);}return _0x50416c;};}function handleError(_0x1ec359,_0x47e3be){_0x47e3be=_0x47e3be||0x1f4;return function(_0x11e64c){logger['error'](_0x11e64c['stack']);if(_0x11e64c[_0x04e0('0x22')]){delete _0x11e64c[_0x04e0('0x22')];}_0x1ec359[_0x04e0('0x16')](_0x47e3be)[_0x04e0('0x23')](_0x11e64c);};}exports[_0x04e0('0x24')]=function(_0x748569,_0xafde85){var _0x383a94={'raw':!![],'where':{'id':_0x748569['params']['id']}},_0xce81d5={};_0xce81d5[_0x04e0('0x25')]=_[_0x04e0('0x26')](db[_0x04e0('0x27')][_0x04e0('0x28')]);_0xce81d5[_0x04e0('0x29')]=_[_0x04e0('0x26')](_0x748569[_0x04e0('0x29')]);_0xce81d5['filters']=_[_0x04e0('0x2a')](_0xce81d5[_0x04e0('0x25')],_0xce81d5['query']);_0x383a94[_0x04e0('0x2b')]=_[_0x04e0('0x2a')](_0xce81d5[_0x04e0('0x25')],qs[_0x04e0('0x2c')](_0x748569[_0x04e0('0x29')]['fields']));_0x383a94['attributes']=_0x383a94[_0x04e0('0x2b')][_0x04e0('0x2d')]?_0x383a94[_0x04e0('0x2b')]:_0xce81d5[_0x04e0('0x25')];if(_0x748569[_0x04e0('0x29')][_0x04e0('0x2e')]){_0x383a94['include']=[{'all':!![]}];}_0x383a94=_[_0x04e0('0x2f')]({},_0x383a94,_0x748569[_0x04e0('0x30')]);return db['ChatProactiveAction'][_0x04e0('0x31')](_0x383a94)[_0x04e0('0x20')](handleEntityNotFound(_0xafde85,null))['then'](respondWithResult(_0xafde85,null))['catch'](handleError(_0xafde85,null));};exports[_0x04e0('0x32')]=function(_0xba549a,_0x3f29de){return db[_0x04e0('0x27')][_0x04e0('0x32')](_0xba549a[_0x04e0('0x33')],{})['then'](respondWithResult(_0x3f29de,0xc9))[_0x04e0('0x34')](handleError(_0x3f29de,null));};exports[_0x04e0('0x1f')]=function(_0xe3af2a,_0x4956b5){if(_0xe3af2a[_0x04e0('0x33')]['id']){delete _0xe3af2a[_0x04e0('0x33')]['id'];}return db[_0x04e0('0x27')][_0x04e0('0x31')]({'where':{'id':_0xe3af2a[_0x04e0('0x35')]['id']}})[_0x04e0('0x20')](handleEntityNotFound(_0x4956b5,null))[_0x04e0('0x20')](saveUpdates(_0xe3af2a[_0x04e0('0x33')],null))['then'](respondWithResult(_0x4956b5,null))['catch'](handleError(_0x4956b5,null));};exports[_0x04e0('0x36')]=function(_0x573755,_0x2a4595){return db[_0x04e0('0x27')][_0x04e0('0x31')]({'where':{'id':_0x573755['params']['id']}})['then'](handleEntityNotFound(_0x2a4595,null))[_0x04e0('0x20')](removeEntity(_0x2a4595,null))['catch'](handleError(_0x2a4595,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 0a6cff6..f724e62 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 _0xe809=['../../config/logger','moment','path','rimraf','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe809,0x153));var _0x9e80=function(_0x1497a2,_0x296f51){_0x1497a2=_0x1497a2-0x0;var _0x20f0ea=_0xe809[_0x1497a2];return _0x20f0ea;};'use strict';var _=require(_0x9e80('0x0'));var util=require(_0x9e80('0x1'));var logger=require(_0x9e80('0x2'))('api');var moment=require(_0x9e80('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e80('0x4'));var rimraf=require(_0x9e80('0x5'));var config=require('../../config/environment');var attributes=require(_0x9e80('0x6'));module[_0x9e80('0x7')]=function(_0x2f60b5,_0x46cd28){return _0x2f60b5[_0x9e80('0x8')](_0x9e80('0x9'),attributes,{'tableName':_0x9e80('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x65ac=['util','../../config/logger','bluebird','exports','ChatProactiveAction','chat_proactive_actions','lodash'];(function(_0x417577,_0x53d563){var _0x19db92=function(_0x4adc94){while(--_0x4adc94){_0x417577['push'](_0x417577['shift']());}};_0x19db92(++_0x53d563);}(_0x65ac,0x1bf));var _0xc65a=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x65ac[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xc65a('0x0'));var util=require(_0xc65a('0x1'));var logger=require(_0xc65a('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc65a('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('./chatProactiveAction.attributes');module[_0xc65a('0x4')]=function(_0x21af0c,_0x4c9227){return _0x21af0c['define'](_0xc65a('0x5'),attributes,{'tableName':_0xc65a('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index d6904b0..73cc141 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 _0x32ba=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x296297,_0x46209b){var _0x31cd6d=function(_0x3142ed){while(--_0x3142ed){_0x296297['push'](_0x296297['shift']());}};_0x31cd6d(++_0x46209b);}(_0x32ba,0x1aa));var _0xa32b=function(_0x4c8a8f,_0x997ef){_0x4c8a8f=_0x4c8a8f-0x0;var _0x404500=_0x32ba[_0x4c8a8f];return _0x404500;};'use strict';var _=require(_0xa32b('0x0'));var util=require(_0xa32b('0x1'));var moment=require(_0xa32b('0x2'));var BPromise=require(_0xa32b('0x3'));var rs=require(_0xa32b('0x4'));var fs=require('fs');var Redis=require(_0xa32b('0x5'));var db=require(_0xa32b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa32b('0x7'))('rpc');var config=require(_0xa32b('0x8'));var jayson=require(_0xa32b('0x9'));var client=jayson[_0xa32b('0xa')][_0xa32b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a4ada,_0x6c002e,_0x4e22d8){return new BPromise(function(_0x272f34,_0x320aeb){return client['request'](_0x4a4ada,_0x4e22d8)[_0xa32b('0xc')](function(_0x54de4f){logger[_0xa32b('0xd')](_0xa32b('0xe'),_0x6c002e,_0xa32b('0xf'));logger[_0xa32b('0x10')](_0xa32b('0x11'),_0x6c002e,_0xa32b('0xf'),JSON[_0xa32b('0x12')](_0x54de4f));if(_0x54de4f[_0xa32b('0x13')]){if(_0x54de4f[_0xa32b('0x13')][_0xa32b('0x14')]===0x1f4){logger[_0xa32b('0x13')](_0xa32b('0xe'),_0x6c002e,_0x54de4f[_0xa32b('0x13')][_0xa32b('0x15')]);return _0x320aeb(_0x54de4f[_0xa32b('0x13')][_0xa32b('0x15')]);}logger[_0xa32b('0x13')](_0xa32b('0xe'),_0x6c002e,_0x54de4f[_0xa32b('0x13')][_0xa32b('0x15')]);return _0x272f34(_0x54de4f[_0xa32b('0x13')]['message']);}else{logger['info'](_0xa32b('0xe'),_0x6c002e,_0xa32b('0xf'));_0x272f34(_0x54de4f[_0xa32b('0x16')][_0xa32b('0x15')]);}})[_0xa32b('0x17')](function(_0x1712d4){logger[_0xa32b('0x13')](_0xa32b('0xe'),_0x6c002e,_0x1712d4);_0x320aeb(_0x1712d4);});});} \ No newline at end of file +var _0x652f=['http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x652f,0xbd));var _0xf652=function(_0x5bdb03,_0x12c8f4){_0x5bdb03=_0x5bdb03-0x0;var _0x34b89c=_0x652f[_0x5bdb03];return _0x34b89c;};'use strict';var _=require(_0xf652('0x0'));var util=require(_0xf652('0x1'));var moment=require(_0xf652('0x2'));var BPromise=require(_0xf652('0x3'));var rs=require(_0xf652('0x4'));var fs=require('fs');var Redis=require(_0xf652('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf652('0x6'));var logger=require(_0xf652('0x7'))('rpc');var config=require(_0xf652('0x8'));var jayson=require(_0xf652('0x9'));var client=jayson[_0xf652('0xa')][_0xf652('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5bd0fc,_0x2af39a,_0x372b47){return new BPromise(function(_0x19768a,_0x7b48b6){return client[_0xf652('0xc')](_0x5bd0fc,_0x372b47)[_0xf652('0xd')](function(_0x41e850){logger[_0xf652('0xe')](_0xf652('0xf'),_0x2af39a,_0xf652('0x10'));logger[_0xf652('0x11')](_0xf652('0x12'),_0x2af39a,_0xf652('0x10'),JSON[_0xf652('0x13')](_0x41e850));if(_0x41e850['error']){if(_0x41e850[_0xf652('0x14')][_0xf652('0x15')]===0x1f4){logger[_0xf652('0x14')](_0xf652('0xf'),_0x2af39a,_0x41e850[_0xf652('0x14')][_0xf652('0x16')]);return _0x7b48b6(_0x41e850[_0xf652('0x14')]['message']);}logger[_0xf652('0x14')](_0xf652('0xf'),_0x2af39a,_0x41e850[_0xf652('0x14')]['message']);return _0x19768a(_0x41e850[_0xf652('0x14')][_0xf652('0x16')]);}else{logger[_0xf652('0xe')](_0xf652('0xf'),_0x2af39a,_0xf652('0x10'));_0x19768a(_0x41e850[_0xf652('0x17')]['message']);}})[_0xf652('0x18')](function(_0x443d6f){logger[_0xf652('0x14')](_0xf652('0xf'),_0x2af39a,_0x443d6f);_0x7b48b6(_0x443d6f);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 67d1a59..5f50634 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 _0x31f0=['fs-extra','../../components/auth/service','../../config/environment','./chatProactiveAction.controller','show','isAuthenticated','create','put','/:id','update','delete','destroy','exports','multer','path','express','Router'];(function(_0xac0de1,_0x12d3d9){var _0x1c1995=function(_0x3f96e8){while(--_0x3f96e8){_0xac0de1['push'](_0xac0de1['shift']());}};_0x1c1995(++_0x12d3d9);}(_0x31f0,0xb7));var _0x031f=function(_0x338fe5,_0x3ef01f){_0x338fe5=_0x338fe5-0x0;var _0x10d6ae=_0x31f0[_0x338fe5];return _0x10d6ae;};'use strict';var multer=require(_0x031f('0x0'));var util=require('util');var path=require(_0x031f('0x1'));var timeout=require('connect-timeout');var express=require(_0x031f('0x2'));var router=express[_0x031f('0x3')]();var fs_extra=require(_0x031f('0x4'));var auth=require(_0x031f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x031f('0x6'));var controller=require(_0x031f('0x7'));router['get']('/:id',auth['isAuthenticated'](),controller[_0x031f('0x8')]);router['post']('/',auth[_0x031f('0x9')](),controller[_0x031f('0xa')]);router[_0x031f('0xb')](_0x031f('0xc'),auth['isAuthenticated'](),controller[_0x031f('0xd')]);router[_0x031f('0xe')](_0x031f('0xc'),auth[_0x031f('0x9')](),controller[_0x031f('0xf')]);module[_0x031f('0x10')]=router; \ No newline at end of file +var _0x032e=['post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show'];(function(_0x43da18,_0x4c4521){var _0x5d72c5=function(_0x2ee73d){while(--_0x2ee73d){_0x43da18['push'](_0x43da18['shift']());}};_0x5d72c5(++_0x4c4521);}(_0x032e,0x124));var _0xe032=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x032e[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0xe032('0x0'));var util=require('util');var path=require(_0xe032('0x1'));var timeout=require(_0xe032('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe032('0x3'));var auth=require(_0xe032('0x4'));var interaction=require(_0xe032('0x5'));var config=require(_0xe032('0x6'));var controller=require(_0xe032('0x7'));router[_0xe032('0x8')](_0xe032('0x9'),auth[_0xe032('0xa')](),controller[_0xe032('0xb')]);router[_0xe032('0xc')]('/',auth[_0xe032('0xa')](),controller[_0xe032('0xd')]);router[_0xe032('0xe')](_0xe032('0x9'),auth[_0xe032('0xa')](),controller[_0xe032('0xf')]);router[_0xe032('0x10')](_0xe032('0x9'),auth['isAuthenticated'](),controller[_0xe032('0x11')]);module[_0xe032('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 3745170..3f24331 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 _0xf189=['name','STRING','INTEGER','ENUM','beepall','roundrobin','sequelize','exports'];(function(_0x26740c,_0x509842){var _0x6682c5=function(_0x579bd2){while(--_0x579bd2){_0x26740c['push'](_0x26740c['shift']());}};_0x6682c5(++_0x509842);}(_0xf189,0x146));var _0x9f18=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf189[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x9f18('0x0'));module[_0x9f18('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9f18('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9f18('0x3')]},'timeout':{'type':Sequelize[_0x9f18('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9f18('0x5')]('rrmemory',_0x9f18('0x6'),_0x9f18('0x7'))}}; \ No newline at end of file +var _0xd0c4=['exports','STRING','INTEGER','rrmemory','beepall','sequelize'];(function(_0xa8c155,_0x216e02){var _0x1e43cf=function(_0x38ec39){while(--_0x38ec39){_0xa8c155['push'](_0xa8c155['shift']());}};_0x1e43cf(++_0x216e02);}(_0xd0c4,0xd7));var _0x4d0c=function(_0x1ccb6b,_0x4e91e6){_0x1ccb6b=_0x1ccb6b-0x0;var _0x4c316=_0xd0c4[_0x1ccb6b];return _0x4c316;};'use strict';var Sequelize=require(_0x4d0c('0x0'));module[_0x4d0c('0x1')]={'name':{'type':Sequelize[_0x4d0c('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x4d0c('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x4d0c('0x4'),_0x4d0c('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 8685834..f778b87 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 _0xa4b2=['select','field','team_has_chat_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./chatQueue.socket','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','ChatQueues','UserProfileResource','name','index','map','ChatQueue','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','show','params','length','include','options','create','body','user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','get','UserChatQueue','sort','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams'];(function(_0x2744fe,_0x305ebf){var _0x4cc095=function(_0x2c460b){while(--_0x2c460b){_0x2744fe['push'](_0x2744fe['shift']());}};_0x4cc095(++_0x305ebf);}(_0xa4b2,0x1da));var _0x2a4b=function(_0x1151d6,_0x36ec8f){_0x1151d6=_0x1151d6-0x0;var _0xdff6ca=_0xa4b2[_0x1151d6];return _0xdff6ca;};'use strict';var emlformat=require(_0x2a4b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2a4b('0x1'));var jsonpatch=require(_0x2a4b('0x2'));var rp=require(_0x2a4b('0x3'));var moment=require('moment');var BPromise=require(_0x2a4b('0x4'));var Mustache=require(_0x2a4b('0x5'));var util=require('util');var path=require(_0x2a4b('0x6'));var sox=require(_0x2a4b('0x7'));var csv=require(_0x2a4b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2a4b('0x9'));var _=require(_0x2a4b('0xa'));var squel=require(_0x2a4b('0xb'));var crypto=require(_0x2a4b('0xc'));var jsforce=require(_0x2a4b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2a4b('0x8'));var querystring=require(_0x2a4b('0xe'));var Papa=require(_0x2a4b('0xf'));var Redis=require('ioredis');var authService=require(_0x2a4b('0x10'));var qs=require(_0x2a4b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2a4b('0x12'));var logger=require(_0x2a4b('0x13'))(_0x2a4b('0x14'));var utils=require(_0x2a4b('0x15'));var config=require(_0x2a4b('0x16'));var licenseUtil=require(_0x2a4b('0x17'));var db=require(_0x2a4b('0x18'))['db'];config['redis']=_[_0x2a4b('0x19')](config['redis'],{'host':_0x2a4b('0x1a'),'port':0x18eb});var socket=require(_0x2a4b('0x1b'))(new Redis(config['redis']));require(_0x2a4b('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1ce7cb,_0xb50a42,_0x2f4051,_0x11c9a1){return new BPromise(function(_0x498d9c,_0x5828f6){var _0x5c96e4=_0x11c9a1||client;return _0x5c96e4[_0x2a4b('0x1d')](_0x1ce7cb,_0x2f4051)[_0x2a4b('0x1e')](function(_0x185dff){logger[_0x2a4b('0x1f')](_0x2a4b('0x20'),_0xb50a42,_0x2a4b('0x21'));logger[_0x2a4b('0x22')](_0x2a4b('0x23'),_0xb50a42,_0x2a4b('0x21'),JSON['stringify'](_0x185dff));if(_0x185dff[_0x2a4b('0x24')]){if(_0x185dff[_0x2a4b('0x24')][_0x2a4b('0x25')]===0x1f4){logger[_0x2a4b('0x24')](_0x2a4b('0x20'),_0xb50a42,_0x185dff[_0x2a4b('0x24')][_0x2a4b('0x26')]);return _0x5828f6(_0x185dff['error']['message']);}logger[_0x2a4b('0x24')](_0x2a4b('0x20'),_0xb50a42,_0x185dff[_0x2a4b('0x24')][_0x2a4b('0x26')]);return _0x498d9c(_0x185dff['error'][_0x2a4b('0x26')]);}else{logger[_0x2a4b('0x1f')]('ChatQueue,\x20%s,\x20%s',_0xb50a42,_0x2a4b('0x21'));_0x498d9c(_0x185dff[_0x2a4b('0x27')][_0x2a4b('0x26')]);}})[_0x2a4b('0x28')](function(_0xd1af2b){logger['error'](_0x2a4b('0x20'),_0xb50a42,_0xd1af2b);_0x5828f6(_0xd1af2b);});});}function respondWithStatusCode(_0xfd0dc2,_0x54b362){_0x54b362=_0x54b362||0xcc;return function(_0xae1592){if(_0xae1592){return _0xfd0dc2[_0x2a4b('0x29')](_0x54b362);}return _0xfd0dc2[_0x2a4b('0x2a')](_0x54b362)[_0x2a4b('0x2b')]();};}function respondWithResult(_0x3a5c42,_0xf17012){_0xf17012=_0xf17012||0xc8;return function(_0x27954b){if(_0x27954b){return _0x3a5c42[_0x2a4b('0x2a')](_0xf17012)[_0x2a4b('0x2c')](_0x27954b);}};}function respondWithFilteredResult(_0x5eadd7,_0x42d14d){return function(_0x5613ee){if(_0x5613ee){var _0x107894=typeof _0x42d14d[_0x2a4b('0x2d')]===_0x2a4b('0x2e')&&typeof _0x42d14d[_0x2a4b('0x2f')]===_0x2a4b('0x2e');var _0x41f071=_0x5613ee[_0x2a4b('0x30')];var _0x2bda1e=_0x107894?0x0:_0x42d14d[_0x2a4b('0x2d')];var _0x1f6467=_0x107894?_0x5613ee[_0x2a4b('0x30')]:_0x42d14d[_0x2a4b('0x2d')]+_0x42d14d[_0x2a4b('0x2f')];var _0x468c70;if(_0x1f6467>=_0x41f071){_0x1f6467=_0x41f071;_0x468c70=0xc8;}else{_0x468c70=0xce;}_0x5eadd7['status'](_0x468c70);return _0x5eadd7[_0x2a4b('0x31')](_0x2a4b('0x32'),_0x2bda1e+'-'+_0x1f6467+'/'+_0x41f071)[_0x2a4b('0x2c')](_0x5613ee);}return null;};}function patchUpdates(_0x48ea5a){return function(_0x1d0209){try{jsonpatch[_0x2a4b('0x33')](_0x1d0209,_0x48ea5a,!![]);}catch(_0x39b389){return BPromise[_0x2a4b('0x34')](_0x39b389);}return _0x1d0209[_0x2a4b('0x35')]();};}function saveUpdates(_0x43854e,_0x41384d){return function(_0x23f957){if(_0x23f957){return _0x23f957[_0x2a4b('0x36')](_0x43854e)['then'](function(_0x3b9b6d){return _0x3b9b6d;});}return null;};}function removeEntity(_0x2394e5,_0x3528c7){return function(_0x164e99){if(_0x164e99){return _0x164e99[_0x2a4b('0x37')]()[_0x2a4b('0x1e')](function(){var _0x3c82a5=_0x164e99['get']({'plain':!![]});var _0x54879e=_0x2a4b('0x38');return db[_0x2a4b('0x39')][_0x2a4b('0x37')]({'where':{'type':_0x54879e,'resourceId':_0x3c82a5['id']}})[_0x2a4b('0x1e')](function(){return _0x164e99;});})['then'](function(){_0x2394e5[_0x2a4b('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17d4e6,_0x18ac62){return function(_0x2ac71f){if(!_0x2ac71f){_0x17d4e6[_0x2a4b('0x29')](0x194);}return _0x2ac71f;};}function handleError(_0x1dc4c5,_0x51ab6b){_0x51ab6b=_0x51ab6b||0x1f4;return function(_0x4e1733){logger['error'](_0x4e1733['stack']);if(_0x4e1733[_0x2a4b('0x3a')]){delete _0x4e1733[_0x2a4b('0x3a')];}_0x1dc4c5[_0x2a4b('0x2a')](_0x51ab6b)['send'](_0x4e1733);};}exports[_0x2a4b('0x3b')]=function(_0x44774b,_0x327c75){var _0x57fe6c={},_0x450a58={},_0x1c1a6c={'count':0x0,'rows':[]};var _0x58b445=_[_0x2a4b('0x3c')](db[_0x2a4b('0x3d')][_0x2a4b('0x3e')],function(_0x33ad5e){return{'name':_0x33ad5e[_0x2a4b('0x3f')],'type':_0x33ad5e[_0x2a4b('0x40')]['key']};});_0x450a58[_0x2a4b('0x41')]=_[_0x2a4b('0x3c')](_0x58b445,'name');_0x450a58['query']=_[_0x2a4b('0x42')](_0x44774b[_0x2a4b('0x43')]);_0x450a58[_0x2a4b('0x44')]=_[_0x2a4b('0x45')](_0x450a58[_0x2a4b('0x41')],_0x450a58[_0x2a4b('0x43')]);_0x57fe6c[_0x2a4b('0x46')]=_[_0x2a4b('0x45')](_0x450a58[_0x2a4b('0x41')],qs[_0x2a4b('0x47')](_0x44774b[_0x2a4b('0x43')][_0x2a4b('0x47')]));_0x57fe6c['attributes']=_0x57fe6c['attributes']['length']?_0x57fe6c[_0x2a4b('0x46')]:_0x450a58[_0x2a4b('0x41')];if(!_0x44774b[_0x2a4b('0x43')][_0x2a4b('0x48')](_0x2a4b('0x49'))){_0x57fe6c[_0x2a4b('0x2f')]=qs['limit'](_0x44774b['query'][_0x2a4b('0x2f')]);_0x57fe6c['offset']=qs['offset'](_0x44774b[_0x2a4b('0x43')][_0x2a4b('0x2d')]);}_0x57fe6c[_0x2a4b('0x4a')]=qs['sort'](_0x44774b[_0x2a4b('0x43')]['sort']);_0x57fe6c['where']=qs['filters'](_[_0x2a4b('0x4b')](_0x44774b[_0x2a4b('0x43')],_0x450a58[_0x2a4b('0x44')]),_0x58b445);if(_0x44774b['query'][_0x2a4b('0x4c')]){_0x57fe6c[_0x2a4b('0x4d')]=_[_0x2a4b('0x4e')](_0x57fe6c[_0x2a4b('0x4d')],{'$or':_[_0x2a4b('0x3c')](_0x58b445,function(_0x1e502a){if(_0x1e502a[_0x2a4b('0x40')]!==_0x2a4b('0x4f')){var _0x403841={};_0x403841[_0x1e502a['name']]={'$like':'%'+_0x44774b['query'][_0x2a4b('0x4c')]+'%'};return _0x403841;}})});}_0x57fe6c=_['merge']({},_0x57fe6c,_0x44774b['options']);var _0x45199f={'where':_0x57fe6c[_0x2a4b('0x4d')]};return db[_0x2a4b('0x3d')]['count'](_0x45199f)[_0x2a4b('0x1e')](function(_0x13998a){_0x1c1a6c['count']=_0x13998a;if(_0x44774b['query'][_0x2a4b('0x50')]){_0x57fe6c['include']=[{'all':!![]}];}return db['ChatQueue'][_0x2a4b('0x51')](_0x57fe6c);})[_0x2a4b('0x1e')](function(_0x525a68){_0x1c1a6c[_0x2a4b('0x52')]=_0x525a68;return _0x1c1a6c;})[_0x2a4b('0x1e')](respondWithFilteredResult(_0x327c75,_0x57fe6c))[_0x2a4b('0x28')](handleError(_0x327c75,null));};exports[_0x2a4b('0x53')]=function(_0x4c5e00,_0x4ae08f){var _0x1d0188={'raw':!![],'where':{'id':_0x4c5e00[_0x2a4b('0x54')]['id']}},_0x4c45fd={};_0x4c45fd[_0x2a4b('0x41')]=_[_0x2a4b('0x42')](db[_0x2a4b('0x3d')][_0x2a4b('0x3e')]);_0x4c45fd[_0x2a4b('0x43')]=_[_0x2a4b('0x42')](_0x4c5e00[_0x2a4b('0x43')]);_0x4c45fd['filters']=_[_0x2a4b('0x45')](_0x4c45fd[_0x2a4b('0x41')],_0x4c45fd[_0x2a4b('0x43')]);_0x1d0188['attributes']=_[_0x2a4b('0x45')](_0x4c45fd[_0x2a4b('0x41')],qs['fields'](_0x4c5e00[_0x2a4b('0x43')][_0x2a4b('0x47')]));_0x1d0188[_0x2a4b('0x46')]=_0x1d0188[_0x2a4b('0x46')][_0x2a4b('0x55')]?_0x1d0188['attributes']:_0x4c45fd[_0x2a4b('0x41')];if(_0x4c5e00[_0x2a4b('0x43')][_0x2a4b('0x50')]){_0x1d0188[_0x2a4b('0x56')]=[{'all':!![]}];}_0x1d0188=_[_0x2a4b('0x4e')]({},_0x1d0188,_0x4c5e00[_0x2a4b('0x57')]);return db[_0x2a4b('0x3d')]['find'](_0x1d0188)[_0x2a4b('0x1e')](handleEntityNotFound(_0x4ae08f,null))[_0x2a4b('0x1e')](respondWithResult(_0x4ae08f,null))[_0x2a4b('0x28')](handleError(_0x4ae08f,null));};exports[_0x2a4b('0x58')]=function(_0x576515,_0x2e62d9){return db[_0x2a4b('0x3d')][_0x2a4b('0x58')](_0x576515[_0x2a4b('0x59')],{})['then'](function(_0x339ab5){var _0x29064e=_0x576515[_0x2a4b('0x5a')]['get']({'plain':!![]});if(!_0x29064e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29064e[_0x2a4b('0x5b')]===_0x2a4b('0x5a')){var _0x3e80a7=_0x339ab5['get']({'plain':!![]});var _0x456182=_0x2a4b('0x38');return db['UserProfileSection'][_0x2a4b('0x5c')]({'where':{'name':_0x456182,'userProfileId':_0x29064e[_0x2a4b('0x5d')]},'raw':!![]})[_0x2a4b('0x1e')](function(_0x21e440){if(_0x21e440&&_0x21e440[_0x2a4b('0x5e')]===0x0){return db[_0x2a4b('0x39')][_0x2a4b('0x58')]({'name':_0x3e80a7['name'],'resourceId':_0x3e80a7['id'],'type':_0x21e440[_0x2a4b('0x3a')],'sectionId':_0x21e440['id']},{})[_0x2a4b('0x1e')](function(){return _0x339ab5;});}else{return _0x339ab5;}})[_0x2a4b('0x28')](function(_0x316f79){logger['error'](_0x2a4b('0x5f'),_0x316f79);throw _0x316f79;});}return _0x339ab5;})[_0x2a4b('0x1e')](respondWithResult(_0x2e62d9,0xc9))['catch'](handleError(_0x2e62d9,null));};exports[_0x2a4b('0x36')]=function(_0x63f5a5,_0x5aef7c){if(_0x63f5a5[_0x2a4b('0x59')]['id']){delete _0x63f5a5['body']['id'];}return db['ChatQueue']['find']({'where':{'id':_0x63f5a5['params']['id']}})[_0x2a4b('0x1e')](handleEntityNotFound(_0x5aef7c,null))[_0x2a4b('0x1e')](saveUpdates(_0x63f5a5[_0x2a4b('0x59')],null))[_0x2a4b('0x1e')](respondWithResult(_0x5aef7c,null))[_0x2a4b('0x28')](handleError(_0x5aef7c,null));};exports[_0x2a4b('0x37')]=function(_0xe1fefd,_0x5eca4e){return db[_0x2a4b('0x3d')][_0x2a4b('0x5c')]({'where':{'id':_0xe1fefd[_0x2a4b('0x54')]['id']}})[_0x2a4b('0x1e')](handleEntityNotFound(_0x5eca4e,null))[_0x2a4b('0x1e')](removeEntity(_0x5eca4e,null))['catch'](handleError(_0x5eca4e,null));};exports['describe']=function(_0x12814b,_0x525c6a){return db[_0x2a4b('0x3d')][_0x2a4b('0x60')]()['then'](respondWithResult(_0x525c6a,null))[_0x2a4b('0x28')](handleError(_0x525c6a,null));};exports['getMembers']=function(_0x430b6a,_0x46d28e,_0x1ce457){var _0x3fc8f4={'raw':!![],'where':{}},_0x1e6962={},_0x7ae236;return db[_0x2a4b('0x3d')][_0x2a4b('0x61')]({'where':{'id':_0x430b6a[_0x2a4b('0x54')]['id']}})[_0x2a4b('0x1e')](handleEntityNotFound(_0x46d28e,null))['then'](function(_0x24e075){if(_0x24e075){_0x7ae236=_0x24e075[_0x2a4b('0x62')]({'plain':!![]});_0x1e6962[_0x2a4b('0x41')]=_['keys'](db[_0x2a4b('0x63')][_0x2a4b('0x3e')]);_0x1e6962[_0x2a4b('0x43')]=_[_0x2a4b('0x42')](_0x430b6a[_0x2a4b('0x43')]);_0x1e6962[_0x2a4b('0x44')]=_[_0x2a4b('0x45')](_0x1e6962[_0x2a4b('0x41')],_0x1e6962[_0x2a4b('0x43')]);_0x3fc8f4[_0x2a4b('0x46')]=_['intersection'](_0x1e6962[_0x2a4b('0x41')],qs[_0x2a4b('0x47')](_0x430b6a[_0x2a4b('0x43')][_0x2a4b('0x47')]));_0x3fc8f4[_0x2a4b('0x46')]=_0x3fc8f4[_0x2a4b('0x46')][_0x2a4b('0x55')]?_0x3fc8f4['attributes']:_0x1e6962[_0x2a4b('0x41')];if(!_0x430b6a[_0x2a4b('0x43')][_0x2a4b('0x48')]('nolimit')){_0x3fc8f4['limit']=qs[_0x2a4b('0x2f')](_0x430b6a[_0x2a4b('0x43')][_0x2a4b('0x2f')]);_0x3fc8f4['offset']=qs[_0x2a4b('0x2d')](_0x430b6a[_0x2a4b('0x43')][_0x2a4b('0x2d')]);}_0x3fc8f4[_0x2a4b('0x4a')]=qs[_0x2a4b('0x64')](_0x430b6a['query'][_0x2a4b('0x64')]);_0x3fc8f4[_0x2a4b('0x4d')]=qs[_0x2a4b('0x44')](_['pick'](_0x430b6a[_0x2a4b('0x43')],_0x1e6962['filters']));_0x3fc8f4[_0x2a4b('0x4d')][_0x2a4b('0x65')]=_0x24e075['id'];if(_0x430b6a['query'][_0x2a4b('0x4c')]){_0x3fc8f4[_0x2a4b('0x4d')]=_[_0x2a4b('0x4e')](_0x3fc8f4['where'],{'$or':_[_0x2a4b('0x3c')](_0x3fc8f4[_0x2a4b('0x46')],function(_0x125857){var _0x202847={};_0x202847[_0x125857]={'$like':'%'+_0x430b6a[_0x2a4b('0x43')][_0x2a4b('0x4c')]+'%'};return _0x202847;})});}_0x3fc8f4=_['merge']({},_0x3fc8f4,_0x430b6a[_0x2a4b('0x57')]);return db[_0x2a4b('0x63')][_0x2a4b('0x51')](_0x3fc8f4);}})[_0x2a4b('0x1e')](function(_0x512cfe){if(_0x512cfe){return db[_0x2a4b('0x66')][_0x2a4b('0x67')]({'where':{'id':_['map'](_0x512cfe,_0x2a4b('0x68')),'role':_0x2a4b('0x69')},'attributes':['id','name',_0x2a4b('0x6a'),_0x2a4b('0x6b'),_0x2a4b('0x6c')]});}})[_0x2a4b('0x1e')](function(_0x22d313){if(_0x22d313){return{'count':_0x22d313['count'],'rows':_[_0x2a4b('0x3c')](_0x22d313[_0x2a4b('0x52')],function(_0x2f27cf){return{'membername':_0x2f27cf[_0x2a4b('0x3a')],'UserId':_0x2f27cf['id'],'queue_name':_0x7ae236[_0x2a4b('0x3a')],'ChatQueueId':_0x7ae236['id'],'interface':util['format']('%s/%s','SIP',_0x2f27cf['name']),'penalty':0x0,'paused':_0x2f27cf[_0x2a4b('0x6a')],'createdAt':_0x2f27cf[_0x2a4b('0x6c')],'updatedAt':_0x2f27cf[_0x2a4b('0x6b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2a4b('0x1e')](respondWithFilteredResult(_0x46d28e,_0x3fc8f4))['catch'](handleError(_0x46d28e,null));};exports['getTeams']=function(_0xce835c,_0x41c204,_0x482d1f){var _0x373f1b={};var _0xf385db={};var _0x1f992a;var _0x93485c;return db[_0x2a4b('0x3d')][_0x2a4b('0x61')]({'where':{'id':_0xce835c[_0x2a4b('0x54')]['id']}})[_0x2a4b('0x1e')](handleEntityNotFound(_0x41c204,null))[_0x2a4b('0x1e')](function(_0x22d8e1){if(_0x22d8e1){_0x1f992a=_0x22d8e1;_0xf385db[_0x2a4b('0x41')]=_['keys'](db['Team']['rawAttributes']);_0xf385db[_0x2a4b('0x43')]=_['keys'](_0xce835c[_0x2a4b('0x43')]);_0xf385db[_0x2a4b('0x44')]=_[_0x2a4b('0x45')](_0xf385db[_0x2a4b('0x41')],_0xf385db[_0x2a4b('0x43')]);_0x373f1b[_0x2a4b('0x46')]=_[_0x2a4b('0x45')](_0xf385db[_0x2a4b('0x41')],qs[_0x2a4b('0x47')](_0xce835c[_0x2a4b('0x43')][_0x2a4b('0x47')]));_0x373f1b[_0x2a4b('0x46')]=_0x373f1b[_0x2a4b('0x46')][_0x2a4b('0x55')]?_0x373f1b['attributes']:_0xf385db[_0x2a4b('0x41')];_0x373f1b[_0x2a4b('0x4a')]=qs[_0x2a4b('0x64')](_0xce835c[_0x2a4b('0x43')][_0x2a4b('0x64')]);_0x373f1b[_0x2a4b('0x4d')]=qs[_0x2a4b('0x44')](_[_0x2a4b('0x4b')](_0xce835c[_0x2a4b('0x43')],_0xf385db[_0x2a4b('0x44')]));if(_0xce835c[_0x2a4b('0x43')][_0x2a4b('0x4c')]){_0x373f1b['where']=_[_0x2a4b('0x4e')](_0x373f1b[_0x2a4b('0x4d')],{'$or':_[_0x2a4b('0x3c')](_0x373f1b[_0x2a4b('0x46')],function(_0x1d2b12){var _0x21daea={};_0x21daea[_0x1d2b12]={'$like':'%'+_0xce835c[_0x2a4b('0x43')]['filter']+'%'};return _0x21daea;})});}_0x373f1b=_[_0x2a4b('0x4e')]({},_0x373f1b,_0xce835c[_0x2a4b('0x57')]);return _0x1f992a[_0x2a4b('0x6d')](_0x373f1b);}})[_0x2a4b('0x1e')](function(_0x4a6c97){if(_0x4a6c97){_0x93485c=_0x4a6c97['length'];if(!_0xce835c[_0x2a4b('0x43')]['hasOwnProperty']('nolimit')){_0x373f1b[_0x2a4b('0x2f')]=qs[_0x2a4b('0x2f')](_0xce835c['query'][_0x2a4b('0x2f')]);_0x373f1b[_0x2a4b('0x2d')]=qs[_0x2a4b('0x2d')](_0xce835c[_0x2a4b('0x43')][_0x2a4b('0x2d')]);}return _0x1f992a[_0x2a4b('0x6d')](_0x373f1b);}})[_0x2a4b('0x1e')](function(_0xe2cdef){if(_0xe2cdef){return _0xe2cdef?{'count':_0x93485c,'rows':_0xe2cdef}:null;}})[_0x2a4b('0x1e')](respondWithResult(_0x41c204,null))[_0x2a4b('0x28')](handleError(_0x41c204,null));};exports[_0x2a4b('0x6e')]=function(_0x42192f,_0x579c91,_0x38fb81){var _0x44a39e=_0x42192f[_0x2a4b('0x59')][_0x2a4b('0x6f')];return db[_0x2a4b('0x70')][_0x2a4b('0x51')]({'where':{'id':_0x44a39e},'attributes':['id'],'include':[{'model':db[_0x2a4b('0x66')],'as':_0x2a4b('0x71'),'attributes':['id',_0x2a4b('0x3a'),_0x2a4b('0x72'),_0x2a4b('0x73'),_0x2a4b('0x74')],'raw':!![]}]})['then'](function(_0x40d4aa){if(_0x40d4aa){var _0x112ba8=_[_0x2a4b('0x75')](_0x40d4aa,function(_0x2d1d61){var _0x42a969=_0x2d1d61['get']({'plain':!![]});return _0x42a969['Agents'];});return db[_0x2a4b('0x3d')][_0x2a4b('0x5c')]({'where':{'id':_0x42192f['params']['id']}})[_0x2a4b('0x1e')](function(_0x2ef434){return db[_0x2a4b('0x76')][_0x2a4b('0x77')](function(_0x6f1e7){return _0x2ef434['addTeams'](_0x44a39e,{'transaction':_0x6f1e7})[_0x2a4b('0x1e')](function(){return BPromise[_0x2a4b('0x78')](_0x112ba8,function(_0x1f8987){return db['UserChatQueue'][_0x2a4b('0x79')]({'where':{'UserId':_0x1f8987['id'],'ChatQueueId':_0x42192f[_0x2a4b('0x54')]['id']},'transaction':_0x6f1e7});});})[_0x2a4b('0x1e')](function(){_0x112ba8[_0x2a4b('0x7a')](function(_0x1bdc8c){socket[_0x2a4b('0x7b')](_0x2a4b('0x7c'),{'UserId':_0x1bdc8c['id'],'ChatQueueId':_0x2ef434['id']});});});});});}})[_0x2a4b('0x1e')](respondWithStatusCode(_0x579c91,null))[_0x2a4b('0x28')](handleError(_0x579c91,null));};exports[_0x2a4b('0x7d')]=function(_0x569a86,_0x4b16fc,_0x2bd697){return db['Team'][_0x2a4b('0x51')]({'where':{'id':_0x569a86['query'][_0x2a4b('0x6f')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2a4b('0x71'),'attributes':['id'],'raw':!![]}]})[_0x2a4b('0x1e')](handleEntityNotFound(_0x4b16fc,null))[_0x2a4b('0x1e')](function(_0x14f2c9){var _0x4c259d=_[_0x2a4b('0x3c')](_0x14f2c9,'id');var _0x209abd=[];var _0x3dfe83=[];var _0x308883=squel[_0x2a4b('0x7e')]();_0x308883[_0x2a4b('0x7f')]('tq.TeamId')['from'](_0x2a4b('0x80'),'tq')[_0x2a4b('0x81')](_0x2a4b('0x82'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('ChatQueueId\x20=\x20?',_0x569a86[_0x2a4b('0x54')]['id']);for(var _0x15e641=0x0;_0x15e641<_0x14f2c9[_0x2a4b('0x55')];_0x15e641+=0x1){let _0x404dd2=_0x14f2c9[_0x15e641];for(var _0x2305e1=0x0;_0x2305e1<_0x404dd2[_0x2a4b('0x71')][_0x2a4b('0x55')];_0x2305e1+=0x1){let _0x1cc342=_0x404dd2[_0x2a4b('0x71')][_0x2305e1];var _0x3d7ffa=_0x308883[_0x2a4b('0x83')]();_0x3d7ffa['where'](_0x2a4b('0x84'),_0x1cc342['id']);_0x3dfe83[_0x2a4b('0x85')](db['sequelize'][_0x2a4b('0x43')](_0x3d7ffa[_0x2a4b('0x86')](),{'type':db[_0x2a4b('0x76')][_0x2a4b('0x87')][_0x2a4b('0x88')]})[_0x2a4b('0x1e')](function(_0x44f51e){if(_0x44f51e[_0x2a4b('0x55')]===0x1){return _0x1cc342['id'];}else{var _0x2047ab=_['every'](_[_0x2a4b('0x3c')](_0x44f51e,_0x2a4b('0x89')),function(_0x293062){return _[_0x2a4b('0x8a')](_0x4c259d,_0x293062);});if(_0x2047ab){return _0x1cc342['id'];}}}));}}return BPromise[_0x2a4b('0x8b')](_0x3dfe83)[_0x2a4b('0x1e')](function(_0x1f643c){_0x209abd=_(_0x209abd)[_0x2a4b('0x8c')](_0x1f643c)['compact']()[_0x2a4b('0x8d')]();return db[_0x2a4b('0x3d')][_0x2a4b('0x5c')]({'where':{'id':_0x569a86['params']['id']}})['then'](function(_0x540128){return db['sequelize']['transaction'](function(_0x588cf0){return _0x540128[_0x2a4b('0x7d')](_0x569a86['query'][_0x2a4b('0x6f')],{'transaction':_0x588cf0})[_0x2a4b('0x1e')](function(){if(!_[_0x2a4b('0x8e')](_0x209abd)){return _0x540128[_0x2a4b('0x8f')](_0x209abd,{'transaction':_0x588cf0});}})[_0x2a4b('0x1e')](function(){_0x209abd['forEach'](function(_0x333ae8){socket[_0x2a4b('0x7b')](_0x2a4b('0x90'),{'UserId':_0x333ae8,'ChatQueueId':_0x540128['id']});});});});});});})[_0x2a4b('0x1e')](respondWithStatusCode(_0x4b16fc,null))[_0x2a4b('0x28')](handleError(_0x4b16fc,null));};exports[_0x2a4b('0x91')]=function(_0x2a6157,_0x2ac115,_0x413469){return db[_0x2a4b('0x3d')][_0x2a4b('0x5c')]({'where':{'id':_0x2a6157['params']['id']}})[_0x2a4b('0x1e')](handleEntityNotFound(_0x2ac115,null))[_0x2a4b('0x1e')](function(_0x1acf03){if(_0x1acf03){return _0x1acf03['addAgents'](_0x2a6157[_0x2a4b('0x59')]['ids'],_[_0x2a4b('0x92')](_0x2a6157['body'],[_0x2a4b('0x6f'),'id'])||{})[_0x2a4b('0x93')](function(_0x35137d){for(var _0x2c86d6=0x0;_0x2c86d6<_0x2a6157[_0x2a4b('0x59')][_0x2a4b('0x6f')][_0x2a4b('0x55')];_0x2c86d6+=0x1){socket['emit'](_0x2a4b('0x7c'),{'UserId':Number(_0x2a6157[_0x2a4b('0x59')][_0x2a4b('0x6f')][_0x2c86d6]),'ChatQueueId':Number(_0x2a6157['params']['id'])});}return _0x35137d;});}})[_0x2a4b('0x1e')](respondWithResult(_0x2ac115,null))[_0x2a4b('0x28')](handleError(_0x2ac115,null));};exports[_0x2a4b('0x8f')]=function(_0x3f0e00,_0x396a2a,_0x304bfc){return db['ChatQueue']['find']({'where':{'id':_0x3f0e00[_0x2a4b('0x54')]['id']}})[_0x2a4b('0x1e')](handleEntityNotFound(_0x396a2a,null))['then'](function(_0x5cad03){if(_0x5cad03){return _0x5cad03[_0x2a4b('0x8f')](_0x3f0e00[_0x2a4b('0x43')]['ids'])[_0x2a4b('0x1e')](function(){if(_[_0x2a4b('0x94')](_0x3f0e00['query'][_0x2a4b('0x6f')])){for(var _0x4eebf3=0x0;_0x4eebf3<_0x3f0e00[_0x2a4b('0x43')][_0x2a4b('0x6f')][_0x2a4b('0x55')];_0x4eebf3+=0x1){socket[_0x2a4b('0x7b')](_0x2a4b('0x90'),{'UserId':Number(_0x3f0e00[_0x2a4b('0x43')][_0x2a4b('0x6f')][_0x4eebf3]),'ChatQueueId':Number(_0x3f0e00['params']['id'])});}}else{socket['emit'](_0x2a4b('0x90'),{'UserId':Number(_0x3f0e00[_0x2a4b('0x43')]['ids']),'ChatQueueId':Number(_0x3f0e00[_0x2a4b('0x54')]['id'])});}});}})[_0x2a4b('0x1e')](respondWithStatusCode(_0x396a2a,null))[_0x2a4b('0x28')](handleError(_0x396a2a,null));};exports[_0x2a4b('0x95')]=function(_0x72cf93,_0x5157a5,_0x48b873){var _0x11ae68={};var _0x5e7e63={};var _0x13938d;var _0x222301;return db[_0x2a4b('0x3d')][_0x2a4b('0x61')]({'where':{'id':_0x72cf93[_0x2a4b('0x54')]['id']}})[_0x2a4b('0x1e')](handleEntityNotFound(_0x5157a5,null))[_0x2a4b('0x1e')](function(_0x45a6e0){if(_0x45a6e0){_0x13938d=_0x45a6e0;_0x5e7e63['model']=_[_0x2a4b('0x42')](db['User'][_0x2a4b('0x3e')]);_0x5e7e63[_0x2a4b('0x43')]=_['keys'](_0x72cf93['query']);_0x5e7e63[_0x2a4b('0x44')]=_[_0x2a4b('0x45')](_0x5e7e63['model'],_0x5e7e63[_0x2a4b('0x43')]);_0x11ae68['attributes']=_[_0x2a4b('0x45')](_0x5e7e63['model'],qs['fields'](_0x72cf93[_0x2a4b('0x43')][_0x2a4b('0x47')]));_0x11ae68['attributes']=_0x11ae68[_0x2a4b('0x46')][_0x2a4b('0x55')]?_0x11ae68[_0x2a4b('0x46')]:_0x5e7e63[_0x2a4b('0x41')];_0x11ae68['order']=qs[_0x2a4b('0x64')](_0x72cf93[_0x2a4b('0x43')][_0x2a4b('0x64')]);_0x11ae68[_0x2a4b('0x4d')]=qs[_0x2a4b('0x44')](_['pick'](_0x72cf93['query'],_0x5e7e63[_0x2a4b('0x44')]));if(_0x72cf93['query'][_0x2a4b('0x4c')]){_0x11ae68[_0x2a4b('0x4d')]=_[_0x2a4b('0x4e')](_0x11ae68['where'],{'$or':_[_0x2a4b('0x3c')](_0x11ae68[_0x2a4b('0x46')],function(_0x674ee){var _0x4b907f={};_0x4b907f[_0x674ee]={'$like':'%'+_0x72cf93[_0x2a4b('0x43')]['filter']+'%'};return _0x4b907f;})});}_0x11ae68=_['merge']({},_0x11ae68,_0x72cf93[_0x2a4b('0x57')]);return _0x13938d[_0x2a4b('0x95')](_0x11ae68);}})[_0x2a4b('0x1e')](function(_0x15bd4b){if(_0x15bd4b){_0x222301=_0x15bd4b['length'];if(!_0x72cf93[_0x2a4b('0x43')][_0x2a4b('0x48')](_0x2a4b('0x49'))){_0x11ae68[_0x2a4b('0x2f')]=qs[_0x2a4b('0x2f')](_0x72cf93[_0x2a4b('0x43')][_0x2a4b('0x2f')]);_0x11ae68[_0x2a4b('0x2d')]=qs['offset'](_0x72cf93[_0x2a4b('0x43')][_0x2a4b('0x2d')]);}return _0x13938d[_0x2a4b('0x95')](_0x11ae68);}})[_0x2a4b('0x1e')](function(_0x8f5f0c){if(_0x8f5f0c){return _0x8f5f0c?{'count':_0x222301,'rows':_0x8f5f0c}:null;}})[_0x2a4b('0x1e')](respondWithResult(_0x5157a5,null))[_0x2a4b('0x28')](handleError(_0x5157a5,null));}; \ No newline at end of file +var _0xc5dc=['lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','get','ChatQueues','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','filter','ChatQueue','includeAll','include','findAll','rows','show','params','merge','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','order','ChatQueueId','User','findAndCountAll','agent','chatPause','updatedAt','createdAt','SIP','getTeams','Team','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','field','tq.TeamId','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','includes','all','union','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','fs-extra'];(function(_0x33a8ee,_0x572c3a){var _0x39f415=function(_0x47078a){while(--_0x47078a){_0x33a8ee['push'](_0x33a8ee['shift']());}};_0x39f415(++_0x572c3a);}(_0xc5dc,0x128));var _0xcc5d=function(_0x748ad0,_0x4cac46){_0x748ad0=_0x748ad0-0x0;var _0xe98ad4=_0xc5dc[_0x748ad0];return _0xe98ad4;};'use strict';var emlformat=require(_0xcc5d('0x0'));var rimraf=require(_0xcc5d('0x1'));var zipdir=require(_0xcc5d('0x2'));var jsonpatch=require(_0xcc5d('0x3'));var rp=require(_0xcc5d('0x4'));var moment=require(_0xcc5d('0x5'));var BPromise=require(_0xcc5d('0x6'));var Mustache=require(_0xcc5d('0x7'));var util=require('util');var path=require('path');var sox=require(_0xcc5d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcc5d('0x9'));var _=require(_0xcc5d('0xa'));var squel=require(_0xcc5d('0xb'));var crypto=require(_0xcc5d('0xc'));var jsforce=require(_0xcc5d('0xd'));var deskjs=require(_0xcc5d('0xe'));var toCsv=require(_0xcc5d('0xf'));var querystring=require('querystring');var Papa=require(_0xcc5d('0x10'));var Redis=require(_0xcc5d('0x11'));var authService=require(_0xcc5d('0x12'));var qs=require(_0xcc5d('0x13'));var as=require(_0xcc5d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcc5d('0x15'))['db'];config['redis']=_[_0xcc5d('0x16')](config[_0xcc5d('0x17')],{'host':_0xcc5d('0x18'),'port':0x18eb});var socket=require(_0xcc5d('0x19'))(new Redis(config[_0xcc5d('0x17')]));require(_0xcc5d('0x1a'))['register'](socket);var jayson=require(_0xcc5d('0x1b'));var client=jayson[_0xcc5d('0x1c')][_0xcc5d('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x10a9ce,_0x2820d7,_0x56e666,_0x5a1071){return new BPromise(function(_0x2f8c87,_0xf610c9){var _0x2bfa9f=_0x5a1071||client;return _0x2bfa9f[_0xcc5d('0x1e')](_0x10a9ce,_0x56e666)[_0xcc5d('0x1f')](function(_0xba7c4d){logger[_0xcc5d('0x20')](_0xcc5d('0x21'),_0x2820d7,_0xcc5d('0x22'));logger[_0xcc5d('0x23')](_0xcc5d('0x24'),_0x2820d7,_0xcc5d('0x22'),JSON['stringify'](_0xba7c4d));if(_0xba7c4d[_0xcc5d('0x25')]){if(_0xba7c4d['error'][_0xcc5d('0x26')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x2820d7,_0xba7c4d[_0xcc5d('0x25')][_0xcc5d('0x27')]);return _0xf610c9(_0xba7c4d[_0xcc5d('0x25')][_0xcc5d('0x27')]);}logger[_0xcc5d('0x25')](_0xcc5d('0x21'),_0x2820d7,_0xba7c4d[_0xcc5d('0x25')]['message']);return _0x2f8c87(_0xba7c4d[_0xcc5d('0x25')]['message']);}else{logger['info'](_0xcc5d('0x21'),_0x2820d7,_0xcc5d('0x22'));_0x2f8c87(_0xba7c4d[_0xcc5d('0x28')][_0xcc5d('0x27')]);}})['catch'](function(_0x2279f9){logger['error']('ChatQueue,\x20%s,\x20%s',_0x2820d7,_0x2279f9);_0xf610c9(_0x2279f9);});});}function respondWithStatusCode(_0x511bc8,_0x4043e0){_0x4043e0=_0x4043e0||0xcc;return function(_0xb1d23c){if(_0xb1d23c){return _0x511bc8[_0xcc5d('0x29')](_0x4043e0);}return _0x511bc8['status'](_0x4043e0)[_0xcc5d('0x2a')]();};}function respondWithResult(_0x5ac238,_0x365dd4){_0x365dd4=_0x365dd4||0xc8;return function(_0x52162b){if(_0x52162b){return _0x5ac238[_0xcc5d('0x2b')](_0x365dd4)[_0xcc5d('0x2c')](_0x52162b);}};}function respondWithFilteredResult(_0x1d5dd9,_0x4cd204){return function(_0x24ef39){if(_0x24ef39){var _0x517d3e=typeof _0x4cd204[_0xcc5d('0x2d')]===_0xcc5d('0x2e')&&typeof _0x4cd204[_0xcc5d('0x2f')]===_0xcc5d('0x2e');var _0xf9b1b7=_0x24ef39[_0xcc5d('0x30')];var _0xe98f3a=_0x517d3e?0x0:_0x4cd204[_0xcc5d('0x2d')];var _0x2a091c=_0x517d3e?_0x24ef39[_0xcc5d('0x30')]:_0x4cd204[_0xcc5d('0x2d')]+_0x4cd204['limit'];var _0x266270;if(_0x2a091c>=_0xf9b1b7){_0x2a091c=_0xf9b1b7;_0x266270=0xc8;}else{_0x266270=0xce;}_0x1d5dd9[_0xcc5d('0x2b')](_0x266270);return _0x1d5dd9[_0xcc5d('0x31')](_0xcc5d('0x32'),_0xe98f3a+'-'+_0x2a091c+'/'+_0xf9b1b7)[_0xcc5d('0x2c')](_0x24ef39);}return null;};}function patchUpdates(_0x163c74){return function(_0x178566){try{jsonpatch[_0xcc5d('0x33')](_0x178566,_0x163c74,!![]);}catch(_0x1eb06e){return BPromise[_0xcc5d('0x34')](_0x1eb06e);}return _0x178566['save']();};}function saveUpdates(_0xabd69f,_0x6c5a8){return function(_0x94ee5b){if(_0x94ee5b){return _0x94ee5b[_0xcc5d('0x35')](_0xabd69f)[_0xcc5d('0x1f')](function(_0x1dc12b){return _0x1dc12b;});}return null;};}function removeEntity(_0x2cacf9,_0x777bed){return function(_0x4f14b0){if(_0x4f14b0){return _0x4f14b0[_0xcc5d('0x36')]()['then'](function(){var _0x7023ce=_0x4f14b0[_0xcc5d('0x37')]({'plain':!![]});var _0x2fc952=_0xcc5d('0x38');return db['UserProfileResource'][_0xcc5d('0x36')]({'where':{'type':_0x2fc952,'resourceId':_0x7023ce['id']}})[_0xcc5d('0x1f')](function(){return _0x4f14b0;});})[_0xcc5d('0x1f')](function(){_0x2cacf9[_0xcc5d('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d4471,_0x1fc7fd){return function(_0xe7dd77){if(!_0xe7dd77){_0x2d4471[_0xcc5d('0x29')](0x194);}return _0xe7dd77;};}function handleError(_0x4a0bbb,_0x306209){_0x306209=_0x306209||0x1f4;return function(_0x27ba13){logger[_0xcc5d('0x25')](_0x27ba13[_0xcc5d('0x39')]);if(_0x27ba13['name']){delete _0x27ba13[_0xcc5d('0x3a')];}_0x4a0bbb[_0xcc5d('0x2b')](_0x306209)[_0xcc5d('0x3b')](_0x27ba13);};}exports[_0xcc5d('0x3c')]=function(_0xf8019b,_0x110b0d){var _0x4246c3={},_0x27c0e1={},_0x390983={'count':0x0,'rows':[]};var _0x121da4=_['map'](db['ChatQueue'][_0xcc5d('0x3d')],function(_0x4596c8){return{'name':_0x4596c8[_0xcc5d('0x3e')],'type':_0x4596c8[_0xcc5d('0x3f')][_0xcc5d('0x40')]};});_0x27c0e1['model']=_[_0xcc5d('0x41')](_0x121da4,_0xcc5d('0x3a'));_0x27c0e1[_0xcc5d('0x42')]=_[_0xcc5d('0x43')](_0xf8019b['query']);_0x27c0e1[_0xcc5d('0x44')]=_[_0xcc5d('0x45')](_0x27c0e1[_0xcc5d('0x46')],_0x27c0e1['query']);_0x4246c3['attributes']=_[_0xcc5d('0x45')](_0x27c0e1[_0xcc5d('0x46')],qs[_0xcc5d('0x47')](_0xf8019b[_0xcc5d('0x42')][_0xcc5d('0x47')]));_0x4246c3[_0xcc5d('0x48')]=_0x4246c3[_0xcc5d('0x48')][_0xcc5d('0x49')]?_0x4246c3[_0xcc5d('0x48')]:_0x27c0e1[_0xcc5d('0x46')];if(!_0xf8019b[_0xcc5d('0x42')][_0xcc5d('0x4a')](_0xcc5d('0x4b'))){_0x4246c3[_0xcc5d('0x2f')]=qs[_0xcc5d('0x2f')](_0xf8019b[_0xcc5d('0x42')][_0xcc5d('0x2f')]);_0x4246c3['offset']=qs[_0xcc5d('0x2d')](_0xf8019b['query'][_0xcc5d('0x2d')]);}_0x4246c3['order']=qs[_0xcc5d('0x4c')](_0xf8019b['query']['sort']);_0x4246c3['where']=qs[_0xcc5d('0x44')](_[_0xcc5d('0x4d')](_0xf8019b[_0xcc5d('0x42')],_0x27c0e1[_0xcc5d('0x44')]),_0x121da4);if(_0xf8019b[_0xcc5d('0x42')]['filter']){_0x4246c3[_0xcc5d('0x4e')]=_['merge'](_0x4246c3[_0xcc5d('0x4e')],{'$or':_['map'](_0x121da4,function(_0x2dfaaa){if(_0x2dfaaa[_0xcc5d('0x3f')]!==_0xcc5d('0x4f')){var _0x2472cd={};_0x2472cd[_0x2dfaaa['name']]={'$like':'%'+_0xf8019b[_0xcc5d('0x42')][_0xcc5d('0x50')]+'%'};return _0x2472cd;}})});}_0x4246c3=_['merge']({},_0x4246c3,_0xf8019b['options']);var _0x416b23={'where':_0x4246c3[_0xcc5d('0x4e')]};return db[_0xcc5d('0x51')][_0xcc5d('0x30')](_0x416b23)[_0xcc5d('0x1f')](function(_0x5ad436){_0x390983[_0xcc5d('0x30')]=_0x5ad436;if(_0xf8019b[_0xcc5d('0x42')][_0xcc5d('0x52')]){_0x4246c3[_0xcc5d('0x53')]=[{'all':!![]}];}return db[_0xcc5d('0x51')][_0xcc5d('0x54')](_0x4246c3);})[_0xcc5d('0x1f')](function(_0x148cc0){_0x390983[_0xcc5d('0x55')]=_0x148cc0;return _0x390983;})['then'](respondWithFilteredResult(_0x110b0d,_0x4246c3))['catch'](handleError(_0x110b0d,null));};exports[_0xcc5d('0x56')]=function(_0x29a128,_0x41c965){var _0x194c79={'raw':!![],'where':{'id':_0x29a128[_0xcc5d('0x57')]['id']}},_0x5b63ab={};_0x5b63ab['model']=_[_0xcc5d('0x43')](db['ChatQueue'][_0xcc5d('0x3d')]);_0x5b63ab['query']=_[_0xcc5d('0x43')](_0x29a128[_0xcc5d('0x42')]);_0x5b63ab[_0xcc5d('0x44')]=_['intersection'](_0x5b63ab[_0xcc5d('0x46')],_0x5b63ab[_0xcc5d('0x42')]);_0x194c79[_0xcc5d('0x48')]=_['intersection'](_0x5b63ab[_0xcc5d('0x46')],qs[_0xcc5d('0x47')](_0x29a128[_0xcc5d('0x42')][_0xcc5d('0x47')]));_0x194c79[_0xcc5d('0x48')]=_0x194c79[_0xcc5d('0x48')][_0xcc5d('0x49')]?_0x194c79[_0xcc5d('0x48')]:_0x5b63ab['model'];if(_0x29a128[_0xcc5d('0x42')][_0xcc5d('0x52')]){_0x194c79[_0xcc5d('0x53')]=[{'all':!![]}];}_0x194c79=_[_0xcc5d('0x58')]({},_0x194c79,_0x29a128[_0xcc5d('0x59')]);return db[_0xcc5d('0x51')][_0xcc5d('0x5a')](_0x194c79)[_0xcc5d('0x1f')](handleEntityNotFound(_0x41c965,null))[_0xcc5d('0x1f')](respondWithResult(_0x41c965,null))[_0xcc5d('0x5b')](handleError(_0x41c965,null));};exports['create']=function(_0x3352fb,_0x15ac6b){return db['ChatQueue'][_0xcc5d('0x5c')](_0x3352fb[_0xcc5d('0x5d')],{})[_0xcc5d('0x1f')](function(_0xf14a12){var _0x26d9a4=_0x3352fb[_0xcc5d('0x5e')][_0xcc5d('0x37')]({'plain':!![]});if(!_0x26d9a4)throw new Error(_0xcc5d('0x5f'));if(_0x26d9a4['role']===_0xcc5d('0x5e')){var _0x41566b=_0xf14a12[_0xcc5d('0x37')]({'plain':!![]});var _0x43fa99=_0xcc5d('0x38');return db[_0xcc5d('0x60')]['find']({'where':{'name':_0x43fa99,'userProfileId':_0x26d9a4['userProfileId']},'raw':!![]})[_0xcc5d('0x1f')](function(_0x53d669){if(_0x53d669&&_0x53d669[_0xcc5d('0x61')]===0x0){return db[_0xcc5d('0x62')]['create']({'name':_0x41566b[_0xcc5d('0x3a')],'resourceId':_0x41566b['id'],'type':_0x53d669[_0xcc5d('0x3a')],'sectionId':_0x53d669['id']},{})[_0xcc5d('0x1f')](function(){return _0xf14a12;});}else{return _0xf14a12;}})['catch'](function(_0x5b87a6){logger['error'](_0xcc5d('0x63'),_0x5b87a6);throw _0x5b87a6;});}return _0xf14a12;})['then'](respondWithResult(_0x15ac6b,0xc9))['catch'](handleError(_0x15ac6b,null));};exports[_0xcc5d('0x35')]=function(_0x1b9bd9,_0x41f224){if(_0x1b9bd9[_0xcc5d('0x5d')]['id']){delete _0x1b9bd9['body']['id'];}return db[_0xcc5d('0x51')][_0xcc5d('0x5a')]({'where':{'id':_0x1b9bd9['params']['id']}})[_0xcc5d('0x1f')](handleEntityNotFound(_0x41f224,null))['then'](saveUpdates(_0x1b9bd9[_0xcc5d('0x5d')],null))['then'](respondWithResult(_0x41f224,null))[_0xcc5d('0x5b')](handleError(_0x41f224,null));};exports['destroy']=function(_0x2b8d55,_0x535253){return db['ChatQueue'][_0xcc5d('0x5a')]({'where':{'id':_0x2b8d55['params']['id']}})[_0xcc5d('0x1f')](handleEntityNotFound(_0x535253,null))[_0xcc5d('0x1f')](removeEntity(_0x535253,null))[_0xcc5d('0x5b')](handleError(_0x535253,null));};exports['describe']=function(_0x44823,_0x2b7d33){return db[_0xcc5d('0x51')][_0xcc5d('0x64')]()[_0xcc5d('0x1f')](respondWithResult(_0x2b7d33,null))[_0xcc5d('0x5b')](handleError(_0x2b7d33,null));};exports[_0xcc5d('0x65')]=function(_0x57efca,_0x1d9dd8,_0x204048){var _0x54cb1c={'raw':!![],'where':{}},_0x3b815c={},_0x4de6d7;return db['ChatQueue'][_0xcc5d('0x66')]({'where':{'id':_0x57efca[_0xcc5d('0x57')]['id']}})[_0xcc5d('0x1f')](handleEntityNotFound(_0x1d9dd8,null))[_0xcc5d('0x1f')](function(_0x542c55){if(_0x542c55){_0x4de6d7=_0x542c55[_0xcc5d('0x37')]({'plain':!![]});_0x3b815c[_0xcc5d('0x46')]=_['keys'](db[_0xcc5d('0x67')][_0xcc5d('0x3d')]);_0x3b815c['query']=_[_0xcc5d('0x43')](_0x57efca[_0xcc5d('0x42')]);_0x3b815c['filters']=_[_0xcc5d('0x45')](_0x3b815c[_0xcc5d('0x46')],_0x3b815c['query']);_0x54cb1c['attributes']=_[_0xcc5d('0x45')](_0x3b815c[_0xcc5d('0x46')],qs[_0xcc5d('0x47')](_0x57efca[_0xcc5d('0x42')][_0xcc5d('0x47')]));_0x54cb1c[_0xcc5d('0x48')]=_0x54cb1c[_0xcc5d('0x48')]['length']?_0x54cb1c[_0xcc5d('0x48')]:_0x3b815c['model'];if(!_0x57efca[_0xcc5d('0x42')][_0xcc5d('0x4a')]('nolimit')){_0x54cb1c['limit']=qs[_0xcc5d('0x2f')](_0x57efca[_0xcc5d('0x42')]['limit']);_0x54cb1c[_0xcc5d('0x2d')]=qs[_0xcc5d('0x2d')](_0x57efca[_0xcc5d('0x42')][_0xcc5d('0x2d')]);}_0x54cb1c[_0xcc5d('0x68')]=qs[_0xcc5d('0x4c')](_0x57efca['query']['sort']);_0x54cb1c[_0xcc5d('0x4e')]=qs['filters'](_[_0xcc5d('0x4d')](_0x57efca[_0xcc5d('0x42')],_0x3b815c[_0xcc5d('0x44')]));_0x54cb1c[_0xcc5d('0x4e')][_0xcc5d('0x69')]=_0x542c55['id'];if(_0x57efca[_0xcc5d('0x42')][_0xcc5d('0x50')]){_0x54cb1c[_0xcc5d('0x4e')]=_[_0xcc5d('0x58')](_0x54cb1c[_0xcc5d('0x4e')],{'$or':_[_0xcc5d('0x41')](_0x54cb1c[_0xcc5d('0x48')],function(_0x522470){var _0x5d93ec={};_0x5d93ec[_0x522470]={'$like':'%'+_0x57efca[_0xcc5d('0x42')]['filter']+'%'};return _0x5d93ec;})});}_0x54cb1c=_[_0xcc5d('0x58')]({},_0x54cb1c,_0x57efca[_0xcc5d('0x59')]);return db['UserChatQueue']['findAll'](_0x54cb1c);}})[_0xcc5d('0x1f')](function(_0x3adf90){if(_0x3adf90){return db[_0xcc5d('0x6a')][_0xcc5d('0x6b')]({'where':{'id':_['map'](_0x3adf90,'UserId'),'role':_0xcc5d('0x6c')},'attributes':['id',_0xcc5d('0x3a'),_0xcc5d('0x6d'),_0xcc5d('0x6e'),_0xcc5d('0x6f')]});}})[_0xcc5d('0x1f')](function(_0x20ffa3){if(_0x20ffa3){return{'count':_0x20ffa3[_0xcc5d('0x30')],'rows':_['map'](_0x20ffa3['rows'],function(_0x4ac3a6){return{'membername':_0x4ac3a6[_0xcc5d('0x3a')],'UserId':_0x4ac3a6['id'],'queue_name':_0x4de6d7['name'],'ChatQueueId':_0x4de6d7['id'],'interface':util['format']('%s/%s',_0xcc5d('0x70'),_0x4ac3a6[_0xcc5d('0x3a')]),'penalty':0x0,'paused':_0x4ac3a6['chatPause'],'createdAt':_0x4ac3a6[_0xcc5d('0x6f')],'updatedAt':_0x4ac3a6[_0xcc5d('0x6e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xcc5d('0x1f')](respondWithFilteredResult(_0x1d9dd8,_0x54cb1c))['catch'](handleError(_0x1d9dd8,null));};exports[_0xcc5d('0x71')]=function(_0x1c8d9f,_0x340f94,_0x568db0){var _0x15ca04={};var _0x2b064b={};var _0x631a80;var _0x4c99c4;return db[_0xcc5d('0x51')][_0xcc5d('0x66')]({'where':{'id':_0x1c8d9f[_0xcc5d('0x57')]['id']}})[_0xcc5d('0x1f')](handleEntityNotFound(_0x340f94,null))[_0xcc5d('0x1f')](function(_0x3cd7a8){if(_0x3cd7a8){_0x631a80=_0x3cd7a8;_0x2b064b[_0xcc5d('0x46')]=_[_0xcc5d('0x43')](db[_0xcc5d('0x72')][_0xcc5d('0x3d')]);_0x2b064b[_0xcc5d('0x42')]=_[_0xcc5d('0x43')](_0x1c8d9f[_0xcc5d('0x42')]);_0x2b064b[_0xcc5d('0x44')]=_[_0xcc5d('0x45')](_0x2b064b['model'],_0x2b064b['query']);_0x15ca04['attributes']=_[_0xcc5d('0x45')](_0x2b064b['model'],qs[_0xcc5d('0x47')](_0x1c8d9f[_0xcc5d('0x42')][_0xcc5d('0x47')]));_0x15ca04[_0xcc5d('0x48')]=_0x15ca04[_0xcc5d('0x48')][_0xcc5d('0x49')]?_0x15ca04['attributes']:_0x2b064b[_0xcc5d('0x46')];_0x15ca04['order']=qs[_0xcc5d('0x4c')](_0x1c8d9f['query'][_0xcc5d('0x4c')]);_0x15ca04[_0xcc5d('0x4e')]=qs[_0xcc5d('0x44')](_[_0xcc5d('0x4d')](_0x1c8d9f['query'],_0x2b064b['filters']));if(_0x1c8d9f[_0xcc5d('0x42')][_0xcc5d('0x50')]){_0x15ca04[_0xcc5d('0x4e')]=_[_0xcc5d('0x58')](_0x15ca04['where'],{'$or':_[_0xcc5d('0x41')](_0x15ca04['attributes'],function(_0x446412){var _0xbde76e={};_0xbde76e[_0x446412]={'$like':'%'+_0x1c8d9f[_0xcc5d('0x42')][_0xcc5d('0x50')]+'%'};return _0xbde76e;})});}_0x15ca04=_['merge']({},_0x15ca04,_0x1c8d9f['options']);return _0x631a80[_0xcc5d('0x71')](_0x15ca04);}})[_0xcc5d('0x1f')](function(_0x5c54c0){if(_0x5c54c0){_0x4c99c4=_0x5c54c0[_0xcc5d('0x49')];if(!_0x1c8d9f[_0xcc5d('0x42')][_0xcc5d('0x4a')](_0xcc5d('0x4b'))){_0x15ca04['limit']=qs[_0xcc5d('0x2f')](_0x1c8d9f[_0xcc5d('0x42')][_0xcc5d('0x2f')]);_0x15ca04[_0xcc5d('0x2d')]=qs['offset'](_0x1c8d9f[_0xcc5d('0x42')][_0xcc5d('0x2d')]);}return _0x631a80[_0xcc5d('0x71')](_0x15ca04);}})[_0xcc5d('0x1f')](function(_0x1ed9a7){if(_0x1ed9a7){return _0x1ed9a7?{'count':_0x4c99c4,'rows':_0x1ed9a7}:null;}})['then'](respondWithResult(_0x340f94,null))[_0xcc5d('0x5b')](handleError(_0x340f94,null));};exports[_0xcc5d('0x73')]=function(_0x1cb8e5,_0x296944,_0x9f4471){var _0x2ee8dd=_0x1cb8e5[_0xcc5d('0x5d')][_0xcc5d('0x74')];return db[_0xcc5d('0x72')][_0xcc5d('0x54')]({'where':{'id':_0x2ee8dd},'attributes':['id'],'include':[{'model':db[_0xcc5d('0x6a')],'as':_0xcc5d('0x75'),'attributes':['id',_0xcc5d('0x3a'),_0xcc5d('0x76'),'voicePause',_0xcc5d('0x77')],'raw':!![]}]})[_0xcc5d('0x1f')](function(_0x1867ba){if(_0x1867ba){var _0x1ac8ac=_[_0xcc5d('0x78')](_0x1867ba,function(_0x1f428c){var _0x5f2b05=_0x1f428c['get']({'plain':!![]});return _0x5f2b05[_0xcc5d('0x75')];});return db['ChatQueue'][_0xcc5d('0x5a')]({'where':{'id':_0x1cb8e5[_0xcc5d('0x57')]['id']}})[_0xcc5d('0x1f')](function(_0x2915c0){return db[_0xcc5d('0x79')][_0xcc5d('0x7a')](function(_0x13e6a1){return _0x2915c0[_0xcc5d('0x73')](_0x2ee8dd,{'transaction':_0x13e6a1})[_0xcc5d('0x1f')](function(){return BPromise[_0xcc5d('0x7b')](_0x1ac8ac,function(_0x51c5f1){return db[_0xcc5d('0x67')][_0xcc5d('0x7c')]({'where':{'UserId':_0x51c5f1['id'],'ChatQueueId':_0x1cb8e5[_0xcc5d('0x57')]['id']},'transaction':_0x13e6a1});});})[_0xcc5d('0x1f')](function(){_0x1ac8ac[_0xcc5d('0x7d')](function(_0x90cb6e){socket[_0xcc5d('0x7e')](_0xcc5d('0x7f'),{'UserId':_0x90cb6e['id'],'ChatQueueId':_0x2915c0['id']});});});});});}})['then'](respondWithStatusCode(_0x296944,null))[_0xcc5d('0x5b')](handleError(_0x296944,null));};exports[_0xcc5d('0x80')]=function(_0x8075a3,_0x4358df,_0x57bb6e){return db['Team'][_0xcc5d('0x54')]({'where':{'id':_0x8075a3[_0xcc5d('0x42')][_0xcc5d('0x74')]},'attributes':['id'],'include':[{'model':db[_0xcc5d('0x6a')],'as':_0xcc5d('0x75'),'attributes':['id'],'raw':!![]}]})[_0xcc5d('0x1f')](handleEntityNotFound(_0x4358df,null))[_0xcc5d('0x1f')](function(_0x200f56){var _0x33a051=_['map'](_0x200f56,'id');var _0x2cb6fc=[];var _0x4ad60e=[];var _0x1567d2=squel['select']();_0x1567d2[_0xcc5d('0x81')](_0xcc5d('0x82'))[_0xcc5d('0x83')](_0xcc5d('0x84'),'tq')[_0xcc5d('0x85')]('user_has_teams','ut',_0xcc5d('0x86'))[_0xcc5d('0x4e')](_0xcc5d('0x87'),_0x8075a3[_0xcc5d('0x57')]['id']);for(var _0x3faf53=0x0;_0x3faf53<_0x200f56['length'];_0x3faf53+=0x1){let _0x4d6ea5=_0x200f56[_0x3faf53];for(var _0x145782=0x0;_0x145782<_0x4d6ea5['Agents'][_0xcc5d('0x49')];_0x145782+=0x1){let _0x545202=_0x4d6ea5[_0xcc5d('0x75')][_0x145782];var _0x313794=_0x1567d2[_0xcc5d('0x88')]();_0x313794[_0xcc5d('0x4e')](_0xcc5d('0x89'),_0x545202['id']);_0x4ad60e[_0xcc5d('0x8a')](db['sequelize'][_0xcc5d('0x42')](_0x313794['toString'](),{'type':db['sequelize'][_0xcc5d('0x8b')]['SELECT']})[_0xcc5d('0x1f')](function(_0xf8404b){if(_0xf8404b[_0xcc5d('0x49')]===0x1){return _0x545202['id'];}else{var _0x384d01=_[_0xcc5d('0x8c')](_[_0xcc5d('0x41')](_0xf8404b,'TeamId'),function(_0x4b60b4){return _[_0xcc5d('0x8d')](_0x33a051,_0x4b60b4);});if(_0x384d01){return _0x545202['id'];}}}));}}return BPromise[_0xcc5d('0x8e')](_0x4ad60e)[_0xcc5d('0x1f')](function(_0x37dc65){_0x2cb6fc=_(_0x2cb6fc)[_0xcc5d('0x8f')](_0x37dc65)['compact']()[_0xcc5d('0x90')]();return db[_0xcc5d('0x51')]['find']({'where':{'id':_0x8075a3[_0xcc5d('0x57')]['id']}})[_0xcc5d('0x1f')](function(_0xf1becf){return db['sequelize'][_0xcc5d('0x7a')](function(_0x512e39){return _0xf1becf[_0xcc5d('0x80')](_0x8075a3['query']['ids'],{'transaction':_0x512e39})[_0xcc5d('0x1f')](function(){if(!_[_0xcc5d('0x91')](_0x2cb6fc)){return _0xf1becf[_0xcc5d('0x92')](_0x2cb6fc,{'transaction':_0x512e39});}})[_0xcc5d('0x1f')](function(){_0x2cb6fc[_0xcc5d('0x7d')](function(_0x39a4b1){socket[_0xcc5d('0x7e')](_0xcc5d('0x93'),{'UserId':_0x39a4b1,'ChatQueueId':_0xf1becf['id']});});});});});});})[_0xcc5d('0x1f')](respondWithStatusCode(_0x4358df,null))[_0xcc5d('0x5b')](handleError(_0x4358df,null));};exports['addAgents']=function(_0x470c9b,_0x272def,_0x484f18){return db[_0xcc5d('0x51')][_0xcc5d('0x5a')]({'where':{'id':_0x470c9b[_0xcc5d('0x57')]['id']}})[_0xcc5d('0x1f')](handleEntityNotFound(_0x272def,null))[_0xcc5d('0x1f')](function(_0x4fa6fe){if(_0x4fa6fe){return _0x4fa6fe[_0xcc5d('0x94')](_0x470c9b[_0xcc5d('0x5d')][_0xcc5d('0x74')],_[_0xcc5d('0x95')](_0x470c9b[_0xcc5d('0x5d')],[_0xcc5d('0x74'),'id'])||{})[_0xcc5d('0x96')](function(_0x583947){for(var _0x5dca26=0x0;_0x5dca26<_0x470c9b[_0xcc5d('0x5d')][_0xcc5d('0x74')][_0xcc5d('0x49')];_0x5dca26+=0x1){socket['emit'](_0xcc5d('0x7f'),{'UserId':Number(_0x470c9b[_0xcc5d('0x5d')][_0xcc5d('0x74')][_0x5dca26]),'ChatQueueId':Number(_0x470c9b[_0xcc5d('0x57')]['id'])});}return _0x583947;});}})[_0xcc5d('0x1f')](respondWithResult(_0x272def,null))[_0xcc5d('0x5b')](handleError(_0x272def,null));};exports[_0xcc5d('0x92')]=function(_0x406c4f,_0x314b6c,_0x18a812){return db[_0xcc5d('0x51')]['find']({'where':{'id':_0x406c4f['params']['id']}})[_0xcc5d('0x1f')](handleEntityNotFound(_0x314b6c,null))[_0xcc5d('0x1f')](function(_0x1e1ab8){if(_0x1e1ab8){return _0x1e1ab8['removeAgents'](_0x406c4f[_0xcc5d('0x42')][_0xcc5d('0x74')])['then'](function(){if(_[_0xcc5d('0x97')](_0x406c4f['query']['ids'])){for(var _0x40ddb7=0x0;_0x40ddb7<_0x406c4f[_0xcc5d('0x42')][_0xcc5d('0x74')][_0xcc5d('0x49')];_0x40ddb7+=0x1){socket[_0xcc5d('0x7e')](_0xcc5d('0x93'),{'UserId':Number(_0x406c4f[_0xcc5d('0x42')]['ids'][_0x40ddb7]),'ChatQueueId':Number(_0x406c4f[_0xcc5d('0x57')]['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x406c4f[_0xcc5d('0x42')][_0xcc5d('0x74')]),'ChatQueueId':Number(_0x406c4f[_0xcc5d('0x57')]['id'])});}});}})[_0xcc5d('0x1f')](respondWithStatusCode(_0x314b6c,null))['catch'](handleError(_0x314b6c,null));};exports[_0xcc5d('0x98')]=function(_0x41a7bd,_0x4ca663,_0xde427f){var _0x112b9c={};var _0x544eaa={};var _0x236c26;var _0x3df766;return db['ChatQueue'][_0xcc5d('0x66')]({'where':{'id':_0x41a7bd[_0xcc5d('0x57')]['id']}})[_0xcc5d('0x1f')](handleEntityNotFound(_0x4ca663,null))['then'](function(_0x3f2d6f){if(_0x3f2d6f){_0x236c26=_0x3f2d6f;_0x544eaa['model']=_['keys'](db[_0xcc5d('0x6a')][_0xcc5d('0x3d')]);_0x544eaa[_0xcc5d('0x42')]=_[_0xcc5d('0x43')](_0x41a7bd[_0xcc5d('0x42')]);_0x544eaa['filters']=_['intersection'](_0x544eaa[_0xcc5d('0x46')],_0x544eaa[_0xcc5d('0x42')]);_0x112b9c[_0xcc5d('0x48')]=_[_0xcc5d('0x45')](_0x544eaa[_0xcc5d('0x46')],qs[_0xcc5d('0x47')](_0x41a7bd[_0xcc5d('0x42')][_0xcc5d('0x47')]));_0x112b9c[_0xcc5d('0x48')]=_0x112b9c[_0xcc5d('0x48')][_0xcc5d('0x49')]?_0x112b9c[_0xcc5d('0x48')]:_0x544eaa[_0xcc5d('0x46')];_0x112b9c[_0xcc5d('0x68')]=qs[_0xcc5d('0x4c')](_0x41a7bd[_0xcc5d('0x42')]['sort']);_0x112b9c[_0xcc5d('0x4e')]=qs[_0xcc5d('0x44')](_[_0xcc5d('0x4d')](_0x41a7bd['query'],_0x544eaa['filters']));if(_0x41a7bd['query']['filter']){_0x112b9c[_0xcc5d('0x4e')]=_[_0xcc5d('0x58')](_0x112b9c[_0xcc5d('0x4e')],{'$or':_['map'](_0x112b9c[_0xcc5d('0x48')],function(_0x201812){var _0x568bc0={};_0x568bc0[_0x201812]={'$like':'%'+_0x41a7bd['query'][_0xcc5d('0x50')]+'%'};return _0x568bc0;})});}_0x112b9c=_[_0xcc5d('0x58')]({},_0x112b9c,_0x41a7bd[_0xcc5d('0x59')]);return _0x236c26[_0xcc5d('0x98')](_0x112b9c);}})[_0xcc5d('0x1f')](function(_0x57fdf6){if(_0x57fdf6){_0x3df766=_0x57fdf6[_0xcc5d('0x49')];if(!_0x41a7bd[_0xcc5d('0x42')][_0xcc5d('0x4a')](_0xcc5d('0x4b'))){_0x112b9c[_0xcc5d('0x2f')]=qs[_0xcc5d('0x2f')](_0x41a7bd[_0xcc5d('0x42')][_0xcc5d('0x2f')]);_0x112b9c['offset']=qs['offset'](_0x41a7bd['query'][_0xcc5d('0x2d')]);}return _0x236c26[_0xcc5d('0x98')](_0x112b9c);}})[_0xcc5d('0x1f')](function(_0x19a822){if(_0x19a822){return _0x19a822?{'count':_0x3df766,'rows':_0x19a822}:null;}})[_0xcc5d('0x1f')](respondWithResult(_0x4ca663,null))[_0xcc5d('0x5b')](handleError(_0x4ca663,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 5da5713..dac4abd 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 _0x3f18=['ChatQueue','save','update','remove','hasOwnProperty','exports','events'];(function(_0x205dd4,_0x269d4a){var _0x561d69=function(_0x46c17d){while(--_0x46c17d){_0x205dd4['push'](_0x205dd4['shift']());}};_0x561d69(++_0x269d4a);}(_0x3f18,0x1aa));var _0x83f1=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x3f18[_0x4b369d];return _0x571a98;};'use strict';var EventEmitter=require(_0x83f1('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x83f1('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x83f1('0x2'),'afterUpdate':_0x83f1('0x3'),'afterDestroy':_0x83f1('0x4')};function emitEvent(_0x2fb87e){return function(_0x571eab,_0x282d9d,_0x5e8af8){ChatQueueEvents['emit'](_0x2fb87e+':'+_0x571eab['id'],_0x571eab);ChatQueueEvents['emit'](_0x2fb87e,_0x571eab);_0x5e8af8(null);};}for(var e in events){if(events[_0x83f1('0x5')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x83f1('0x6')]=ChatQueueEvents; \ No newline at end of file +var _0x5732=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x4da3aa,_0x3cca7a){var _0x24ff0e=function(_0xbf7caf){while(--_0xbf7caf){_0x4da3aa['push'](_0x4da3aa['shift']());}};_0x24ff0e(++_0x3cca7a);}(_0x5732,0xfb));var _0x2573=function(_0x5c66e6,_0x4a4254){_0x5c66e6=_0x5c66e6-0x0;var _0x3b378f=_0x5732[_0x5c66e6];return _0x3b378f;};'use strict';var EventEmitter=require(_0x2573('0x0'));var ChatQueue=require(_0x2573('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2573('0x2'),'afterUpdate':_0x2573('0x3'),'afterDestroy':'remove'};function emitEvent(_0x27696e){return function(_0x2cd27b,_0x2ee042,_0x2d9889){ChatQueueEvents[_0x2573('0x4')](_0x27696e+':'+_0x2cd27b['id'],_0x2cd27b);ChatQueueEvents[_0x2573('0x4')](_0x27696e,_0x2cd27b);_0x2d9889(null);};}for(var e in events){if(events[_0x2573('0x5')](e)){var event=events[e];ChatQueue[_0x2573('0x6')](e,emitEvent(event));}}module[_0x2573('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 54b1a5e..7c4eaa3 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 _0x946c=['request-promise','path','rimraf','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api'];(function(_0x4d666d,_0x5d729d){var _0x304bdd=function(_0x272197){while(--_0x272197){_0x4d666d['push'](_0x4d666d['shift']());}};_0x304bdd(++_0x5d729d);}(_0x946c,0x188));var _0xc946=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x946c[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0xc946('0x0'));var util=require(_0xc946('0x1'));var logger=require(_0xc946('0x2'))(_0xc946('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc946('0x4'));var fs=require('fs');var path=require(_0xc946('0x5'));var rimraf=require(_0xc946('0x6'));var config=require('../../config/environment');var attributes=require(_0xc946('0x7'));module[_0xc946('0x8')]=function(_0x5dc620,_0x1770f4){return _0x5dc620[_0xc946('0x9')](_0xc946('0xa'),attributes,{'tableName':_0xc946('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe5d=['bluebird','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','lodash','util','../../config/logger','moment'];(function(_0xd88736,_0x9c3494){var _0x24e4a8=function(_0x36607e){while(--_0x36607e){_0xd88736['push'](_0xd88736['shift']());}};_0x24e4a8(++_0x9c3494);}(_0xfe5d,0x80));var _0xdfe5=function(_0x4f5471,_0x40b087){_0x4f5471=_0x4f5471-0x0;var _0x8a9ea0=_0xfe5d[_0x4f5471];return _0x8a9ea0;};'use strict';var _=require(_0xdfe5('0x0'));var util=require(_0xdfe5('0x1'));var logger=require(_0xdfe5('0x2'))('api');var moment=require(_0xdfe5('0x3'));var BPromise=require(_0xdfe5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdfe5('0x5'));var rimraf=require(_0xdfe5('0x6'));var config=require(_0xdfe5('0x7'));var attributes=require(_0xdfe5('0x8'));module[_0xdfe5('0x9')]=function(_0x100f26,_0x43e0ad){return _0x100f26[_0xdfe5('0xa')]('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 a6f4b77..fd2ea7f 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 _0x6d0c=['request\x20sent','error','code','message','catch','ChatQueue','findAll','options','raw','where','limit','include','map','model','attributes','GetChatQueue','debug','stringify','ShowChatQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x46b93c,_0x55b143){var _0x91b789=function(_0x51d88f){while(--_0x51d88f){_0x46b93c['push'](_0x46b93c['shift']());}};_0x91b789(++_0x55b143);}(_0x6d0c,0x8c));var _0xc6d0=function(_0x235f3d,_0x35daa3){_0x235f3d=_0x235f3d-0x0;var _0x4d244d=_0x6d0c[_0x235f3d];return _0x4d244d;};'use strict';var _=require(_0xc6d0('0x0'));var util=require(_0xc6d0('0x1'));var moment=require(_0xc6d0('0x2'));var BPromise=require(_0xc6d0('0x3'));var rs=require(_0xc6d0('0x4'));var fs=require('fs');var Redis=require(_0xc6d0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc6d0('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc6d0('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc6d0('0x8')]({'port':0x232a});config[_0xc6d0('0x9')]=_[_0xc6d0('0xa')](config[_0xc6d0('0x9')],{'host':_0xc6d0('0xb'),'port':0x18eb});var socket=require(_0xc6d0('0xc'))(new Redis(config[_0xc6d0('0x9')]));require(_0xc6d0('0xd'))[_0xc6d0('0xe')](socket);function respondWithRpcPromise(_0x2e59b2,_0x577e64,_0xfdaf17){return new BPromise(function(_0x1f3ed1,_0x395085){return client[_0xc6d0('0xf')](_0x2e59b2,_0xfdaf17)[_0xc6d0('0x10')](function(_0x12f0db){logger[_0xc6d0('0x11')](_0xc6d0('0x12'),_0x577e64,'request\x20sent');logger['debug'](_0xc6d0('0x13'),_0x577e64,_0xc6d0('0x14'),JSON['stringify'](_0x12f0db));if(_0x12f0db[_0xc6d0('0x15')]){if(_0x12f0db[_0xc6d0('0x15')][_0xc6d0('0x16')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x577e64,_0x12f0db[_0xc6d0('0x15')][_0xc6d0('0x17')]);return _0x395085(_0x12f0db[_0xc6d0('0x15')]['message']);}logger[_0xc6d0('0x15')]('ChatQueue,\x20%s,\x20%s',_0x577e64,_0x12f0db[_0xc6d0('0x15')][_0xc6d0('0x17')]);return _0x1f3ed1(_0x12f0db[_0xc6d0('0x15')][_0xc6d0('0x17')]);}else{logger[_0xc6d0('0x11')]('ChatQueue,\x20%s,\x20%s',_0x577e64,'request\x20sent');_0x1f3ed1(_0x12f0db['result'][_0xc6d0('0x17')]);}})[_0xc6d0('0x18')](function(_0x1dd9e8){logger['error'](_0xc6d0('0x12'),_0x577e64,_0x1dd9e8);_0x395085(_0x1dd9e8);});});}exports['GetChatQueue']=function(_0x5200bf){var _0x2fca06=this;return new Promise(function(_0x26eb00,_0x2121f2){return db[_0xc6d0('0x19')][_0xc6d0('0x1a')]({'raw':_0x5200bf[_0xc6d0('0x1b')]?_0x5200bf[_0xc6d0('0x1b')][_0xc6d0('0x1c')]===undefined?!![]:![]:!![],'where':_0x5200bf['options']?_0x5200bf[_0xc6d0('0x1b')][_0xc6d0('0x1d')]||null:null,'attributes':_0x5200bf[_0xc6d0('0x1b')]?_0x5200bf[_0xc6d0('0x1b')]['attributes']||null:null,'limit':_0x5200bf['options']?_0x5200bf[_0xc6d0('0x1b')][_0xc6d0('0x1e')]||null:null,'include':_0x5200bf[_0xc6d0('0x1b')]?_0x5200bf[_0xc6d0('0x1b')][_0xc6d0('0x1f')]?_[_0xc6d0('0x20')](_0x5200bf[_0xc6d0('0x1b')][_0xc6d0('0x1f')],function(_0x420cf4){return{'model':db[_0x420cf4[_0xc6d0('0x21')]],'as':_0x420cf4['as'],'attributes':_0x420cf4[_0xc6d0('0x22')],'include':_0x420cf4[_0xc6d0('0x1f')]?_[_0xc6d0('0x20')](_0x420cf4['include'],function(_0x5ad146){return{'model':db[_0x5ad146[_0xc6d0('0x21')]],'as':_0x5ad146['as'],'attributes':_0x5ad146[_0xc6d0('0x22')],'include':_0x5ad146[_0xc6d0('0x1f')]?_[_0xc6d0('0x20')](_0x5ad146['include'],function(_0xa457fa){return{'model':db[_0xa457fa[_0xc6d0('0x21')]],'as':_0xa457fa['as'],'attributes':_0xa457fa[_0xc6d0('0x22')]};}):[]};}):[]};}):[]:[]})[_0xc6d0('0x10')](function(_0x6d0d94){logger['info'](_0xc6d0('0x23'),_0x5200bf);logger[_0xc6d0('0x24')](_0xc6d0('0x23'),_0x5200bf,JSON[_0xc6d0('0x25')](_0x6d0d94));_0x26eb00(_0x6d0d94);})[_0xc6d0('0x18')](function(_0x122c2c){logger['error'](_0xc6d0('0x23'),_0x122c2c[_0xc6d0('0x17')],_0x5200bf);_0x2121f2(_0x2fca06[_0xc6d0('0x15')](0x1f4,_0x122c2c[_0xc6d0('0x17')]));});});};exports[_0xc6d0('0x26')]=function(_0x4d3da0){var _0x58291a=this;return new Promise(function(_0x1dfa28,_0x1fda95){return db['ChatQueue'][_0xc6d0('0x27')]({'raw':_0x4d3da0[_0xc6d0('0x1b')]?_0x4d3da0[_0xc6d0('0x1b')][_0xc6d0('0x1c')]===undefined?!![]:![]:!![],'where':_0x4d3da0[_0xc6d0('0x1b')]?_0x4d3da0[_0xc6d0('0x1b')]['where']||null:null,'attributes':_0x4d3da0[_0xc6d0('0x1b')]?_0x4d3da0['options']['attributes']||null:null,'include':_0x4d3da0[_0xc6d0('0x1b')]?_0x4d3da0[_0xc6d0('0x1b')][_0xc6d0('0x1f')]?_['map'](_0x4d3da0['options'][_0xc6d0('0x1f')],function(_0x1a8eda){return{'model':db[_0x1a8eda['model']],'as':_0x1a8eda['as'],'attributes':_0x1a8eda['attributes'],'include':_0x1a8eda[_0xc6d0('0x1f')]?_[_0xc6d0('0x20')](_0x1a8eda['include'],function(_0x21403c){return{'model':db[_0x21403c[_0xc6d0('0x21')]],'as':_0x21403c['as'],'attributes':_0x21403c[_0xc6d0('0x22')],'include':_0x21403c['include']?_['map'](_0x21403c[_0xc6d0('0x1f')],function(_0x1c6d10){return{'model':db[_0x1c6d10[_0xc6d0('0x21')]],'as':_0x1c6d10['as'],'attributes':_0x1c6d10['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5eb2e4){logger[_0xc6d0('0x11')](_0xc6d0('0x26'),_0x4d3da0);logger[_0xc6d0('0x24')]('ShowChatQueue',_0x4d3da0,JSON['stringify'](_0x5eb2e4));_0x1dfa28(_0x5eb2e4);})[_0xc6d0('0x18')](function(_0x69d9dd){logger[_0xc6d0('0x15')]('ShowChatQueue',_0x69d9dd[_0xc6d0('0x17')],_0x4d3da0);_0x1fda95(_0x58291a[_0xc6d0('0x15')](0x1f4,_0x69d9dd['message']));});});}; \ No newline at end of file +var _0xb749=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./chatQueue.socket','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetChatQueue','options','raw','where','attributes','limit','include','model','map','then','debug','ShowChatQueue','lodash','moment','bluebird'];(function(_0x283783,_0x31b6b2){var _0x3ca348=function(_0x4cfc67){while(--_0x4cfc67){_0x283783['push'](_0x283783['shift']());}};_0x3ca348(++_0x31b6b2);}(_0xb749,0xac));var _0x9b74=function(_0x1925f8,_0x545551){_0x1925f8=_0x1925f8-0x0;var _0x2fd553=_0xb749[_0x1925f8];return _0x2fd553;};'use strict';var _=require(_0x9b74('0x0'));var util=require('util');var moment=require(_0x9b74('0x1'));var BPromise=require(_0x9b74('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9b74('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9b74('0x4'));var logger=require(_0x9b74('0x5'))(_0x9b74('0x6'));var config=require(_0x9b74('0x7'));var jayson=require(_0x9b74('0x8'));var client=jayson[_0x9b74('0x9')]['http']({'port':0x232a});config[_0x9b74('0xa')]=_['defaults'](config[_0x9b74('0xa')],{'host':_0x9b74('0xb'),'port':0x18eb});var socket=require(_0x9b74('0xc'))(new Redis(config[_0x9b74('0xa')]));require(_0x9b74('0xd'))['register'](socket);function respondWithRpcPromise(_0x91a9b4,_0x1fd119,_0x561ca6){return new BPromise(function(_0x3ae044,_0xfc8a79){return client[_0x9b74('0xe')](_0x91a9b4,_0x561ca6)['then'](function(_0x2474a3){logger[_0x9b74('0xf')](_0x9b74('0x10'),_0x1fd119,_0x9b74('0x11'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x1fd119,_0x9b74('0x11'),JSON[_0x9b74('0x12')](_0x2474a3));if(_0x2474a3[_0x9b74('0x13')]){if(_0x2474a3[_0x9b74('0x13')]['code']===0x1f4){logger[_0x9b74('0x13')](_0x9b74('0x10'),_0x1fd119,_0x2474a3[_0x9b74('0x13')][_0x9b74('0x14')]);return _0xfc8a79(_0x2474a3[_0x9b74('0x13')][_0x9b74('0x14')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x1fd119,_0x2474a3[_0x9b74('0x13')][_0x9b74('0x14')]);return _0x3ae044(_0x2474a3[_0x9b74('0x13')][_0x9b74('0x14')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x1fd119,_0x9b74('0x11'));_0x3ae044(_0x2474a3[_0x9b74('0x15')]['message']);}})[_0x9b74('0x16')](function(_0x427085){logger[_0x9b74('0x13')]('ChatQueue,\x20%s,\x20%s',_0x1fd119,_0x427085);_0xfc8a79(_0x427085);});});}exports[_0x9b74('0x17')]=function(_0x2a3498){var _0xc94186=this;return new Promise(function(_0x2f2464,_0x4d3673){return db['ChatQueue']['findAll']({'raw':_0x2a3498[_0x9b74('0x18')]?_0x2a3498['options'][_0x9b74('0x19')]===undefined?!![]:![]:!![],'where':_0x2a3498['options']?_0x2a3498[_0x9b74('0x18')][_0x9b74('0x1a')]||null:null,'attributes':_0x2a3498[_0x9b74('0x18')]?_0x2a3498[_0x9b74('0x18')][_0x9b74('0x1b')]||null:null,'limit':_0x2a3498['options']?_0x2a3498[_0x9b74('0x18')][_0x9b74('0x1c')]||null:null,'include':_0x2a3498['options']?_0x2a3498[_0x9b74('0x18')][_0x9b74('0x1d')]?_['map'](_0x2a3498['options'][_0x9b74('0x1d')],function(_0x1d41ca){return{'model':db[_0x1d41ca[_0x9b74('0x1e')]],'as':_0x1d41ca['as'],'attributes':_0x1d41ca[_0x9b74('0x1b')],'include':_0x1d41ca[_0x9b74('0x1d')]?_['map'](_0x1d41ca[_0x9b74('0x1d')],function(_0x35d202){return{'model':db[_0x35d202['model']],'as':_0x35d202['as'],'attributes':_0x35d202[_0x9b74('0x1b')],'include':_0x35d202['include']?_[_0x9b74('0x1f')](_0x35d202['include'],function(_0x55e332){return{'model':db[_0x55e332[_0x9b74('0x1e')]],'as':_0x55e332['as'],'attributes':_0x55e332[_0x9b74('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9b74('0x20')](function(_0x5a0319){logger['info'](_0x9b74('0x17'),_0x2a3498);logger[_0x9b74('0x21')](_0x9b74('0x17'),_0x2a3498,JSON['stringify'](_0x5a0319));_0x2f2464(_0x5a0319);})[_0x9b74('0x16')](function(_0x8f811e){logger[_0x9b74('0x13')](_0x9b74('0x17'),_0x8f811e[_0x9b74('0x14')],_0x2a3498);_0x4d3673(_0xc94186[_0x9b74('0x13')](0x1f4,_0x8f811e[_0x9b74('0x14')]));});});};exports[_0x9b74('0x22')]=function(_0x61e0cb){var _0x2c2a46=this;return new Promise(function(_0x4f7271,_0x54a253){return db['ChatQueue']['find']({'raw':_0x61e0cb[_0x9b74('0x18')]?_0x61e0cb[_0x9b74('0x18')][_0x9b74('0x19')]===undefined?!![]:![]:!![],'where':_0x61e0cb['options']?_0x61e0cb[_0x9b74('0x18')][_0x9b74('0x1a')]||null:null,'attributes':_0x61e0cb['options']?_0x61e0cb['options'][_0x9b74('0x1b')]||null:null,'include':_0x61e0cb[_0x9b74('0x18')]?_0x61e0cb[_0x9b74('0x18')][_0x9b74('0x1d')]?_[_0x9b74('0x1f')](_0x61e0cb['options'][_0x9b74('0x1d')],function(_0x113017){return{'model':db[_0x113017[_0x9b74('0x1e')]],'as':_0x113017['as'],'attributes':_0x113017[_0x9b74('0x1b')],'include':_0x113017['include']?_[_0x9b74('0x1f')](_0x113017[_0x9b74('0x1d')],function(_0x346e2f){return{'model':db[_0x346e2f[_0x9b74('0x1e')]],'as':_0x346e2f['as'],'attributes':_0x346e2f[_0x9b74('0x1b')],'include':_0x346e2f[_0x9b74('0x1d')]?_[_0x9b74('0x1f')](_0x346e2f[_0x9b74('0x1d')],function(_0x32b3e9){return{'model':db[_0x32b3e9[_0x9b74('0x1e')]],'as':_0x32b3e9['as'],'attributes':_0x32b3e9[_0x9b74('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9b74('0x20')](function(_0x2d2b97){logger[_0x9b74('0xf')](_0x9b74('0x22'),_0x61e0cb);logger[_0x9b74('0x21')](_0x9b74('0x22'),_0x61e0cb,JSON[_0x9b74('0x12')](_0x2d2b97));_0x4f7271(_0x2d2b97);})[_0x9b74('0x16')](function(_0x54d9e9){logger[_0x9b74('0x13')]('ShowChatQueue',_0x54d9e9[_0x9b74('0x14')],_0x61e0cb);_0x54a253(_0x2c2a46[_0x9b74('0x13')](0x1f4,_0x54d9e9[_0x9b74('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 0500ca6..98832b5 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 _0x222f=['./chatQueue.events','save','remove','update','emit','register'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x222f,0x1a4));var _0xf222=function(_0x59cf8a,_0x163bb9){_0x59cf8a=_0x59cf8a-0x0;var _0x22dde8=_0x222f[_0x59cf8a];return _0x22dde8;};'use strict';var ChatQueueEvents=require(_0xf222('0x0'));var events=[_0xf222('0x1'),_0xf222('0x2'),_0xf222('0x3')];function createListener(_0x4d09ec,_0x4b4237){return function(_0x195de1){_0x4b4237[_0xf222('0x4')](_0x4d09ec,_0x195de1);};}function removeListener(_0x307791,_0x7b187d){return function(){ChatQueueEvents['removeListener'](_0x307791,_0x7b187d);};}exports[_0xf222('0x5')]=function(_0x54a758){for(var _0x112e6d=0x0,_0x26f129=events['length'];_0x112e6d<_0x26f129;_0x112e6d++){var _0xf5a105=events[_0x112e6d];var _0x302d7a=createListener('chatQueue:'+_0xf5a105,_0x54a758);ChatQueueEvents['on'](_0xf5a105,_0x302d7a);}}; \ No newline at end of file +var _0x22fb=['remove','emit','removeListener','register','length','chatQueue:'];(function(_0x32febf,_0x4e3901){var _0x246469=function(_0xf83890){while(--_0xf83890){_0x32febf['push'](_0x32febf['shift']());}};_0x246469(++_0x4e3901);}(_0x22fb,0x192));var _0xb22f=function(_0x5da667,_0x3a5e16){_0x5da667=_0x5da667-0x0;var _0x47f4a8=_0x22fb[_0x5da667];return _0x47f4a8;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=['save',_0xb22f('0x0'),'update'];function createListener(_0x3f643d,_0x306b6e){return function(_0x2221f1){_0x306b6e[_0xb22f('0x1')](_0x3f643d,_0x2221f1);};}function removeListener(_0x201512,_0x50cdab){return function(){ChatQueueEvents[_0xb22f('0x2')](_0x201512,_0x50cdab);};}exports[_0xb22f('0x3')]=function(_0x2d1fb3){for(var _0xc3ffcc=0x0,_0x412a95=events[_0xb22f('0x4')];_0xc3ffcc<_0x412a95;_0xc3ffcc++){var _0x47f61a=events[_0xc3ffcc];var _0x34433b=createListener(_0xb22f('0x5')+_0x47f61a,_0x2d1fb3);ChatQueueEvents['on'](_0x47f61a,_0x34433b);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 1b028fc..f6129a5 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(_0x4bf550,_0x131bb9){var _0x36f6b5=function(_0x1bc4aa){while(--_0x1bc4aa){_0x4bf550['push'](_0x4bf550['shift']());}};_0x36f6b5(++_0x131bb9);}(_0x7217,0x19e));var _0x7721=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x7217[_0x110c3d];return _0x226d67;};'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(_0x4802ed,_0xbb726b){var _0xe67dc3=function(_0x20cca6){while(--_0x20cca6){_0x4802ed['push'](_0x4802ed['shift']());}};_0xe67dc3(++_0xbb726b);}(_0xe14b,0x93));var _0xbe14=function(_0x3d9b23,_0x52894d){_0x3d9b23=_0x3d9b23-0x0;var _0xf22517=_0xe14b[_0x3d9b23];return _0xf22517;};'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 8f06ec3..c59b1eb 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 _0xe1ef=['sequelize','exports','STRING','DATE','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe1ef,0x72));var _0xfe1e=function(_0xd204bd,_0x52cc59){_0xd204bd=_0xd204bd-0x0;var _0x54cc75=_0xe1ef[_0xd204bd];return _0x54cc75;};'use strict';var moment=require(_0xfe1e('0x0'));var Sequelize=require(_0xfe1e('0x1'));module[_0xfe1e('0x2')]={'uniqueid':{'type':Sequelize[_0xfe1e('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xfe1e('0x4')]},'acceptAt':{'type':Sequelize[_0xfe1e('0x4')]},'exitAt':{'type':Sequelize[_0xfe1e('0x4')]},'reason':{'type':Sequelize[_0xfe1e('0x3')]}}; \ No newline at end of file +var _0x759a=['STRING','DATE','moment','exports'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0x759a,0x126));var _0xa759=function(_0x1d35e9,_0x5ac1b5){_0x1d35e9=_0x1d35e9-0x0;var _0x49c1a4=_0x759a[_0x1d35e9];return _0x49c1a4;};'use strict';var moment=require(_0xa759('0x0'));var Sequelize=require('sequelize');module[_0xa759('0x1')]={'uniqueid':{'type':Sequelize[_0xa759('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xa759('0x2')]},'joinAt':{'type':Sequelize[_0xa759('0x3')]},'leaveAt':{'type':Sequelize[_0xa759('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xa759('0x3')]},'reason':{'type':Sequelize[_0xa759('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 85f87ce..fb24404 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 _0x8110=['name','send','index','map','ChatQueueReport','rawAttributes','fieldName','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','update','find','describe','rimraf','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x8110,0x185));var _0x0811=function(_0x8a8252,_0x24b338){_0x8a8252=_0x8a8252-0x0;var _0x21c0a0=_0x8110[_0x8a8252];return _0x21c0a0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0811('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0811('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x0811('0x2'));var util=require(_0x0811('0x3'));var path=require(_0x0811('0x4'));var sox=require(_0x0811('0x5'));var csv=require(_0x0811('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0811('0x7'));var _=require('lodash');var squel=require(_0x0811('0x8'));var crypto=require(_0x0811('0x9'));var jsforce=require(_0x0811('0xa'));var deskjs=require(_0x0811('0xb'));var toCsv=require(_0x0811('0x6'));var querystring=require(_0x0811('0xc'));var Papa=require(_0x0811('0xd'));var Redis=require(_0x0811('0xe'));var authService=require(_0x0811('0xf'));var qs=require(_0x0811('0x10'));var as=require(_0x0811('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0811('0x12'));var utils=require(_0x0811('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0811('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x220ec1,_0x20e525){_0x20e525=_0x20e525||0xcc;return function(_0x3e6050){if(_0x3e6050){return _0x220ec1[_0x0811('0x15')](_0x20e525);}return _0x220ec1[_0x0811('0x16')](_0x20e525)['end']();};}function respondWithResult(_0x535d3e,_0x203cca){_0x203cca=_0x203cca||0xc8;return function(_0x553502){if(_0x553502){return _0x535d3e['status'](_0x203cca)[_0x0811('0x17')](_0x553502);}};}function respondWithFilteredResult(_0x4ca03c,_0x4c0add){return function(_0x5c5e84){if(_0x5c5e84){var _0x3c06ec=typeof _0x4c0add[_0x0811('0x18')]===_0x0811('0x19')&&typeof _0x4c0add[_0x0811('0x1a')]===_0x0811('0x19');var _0x5baffe=_0x5c5e84[_0x0811('0x1b')];var _0x3c1856=_0x3c06ec?0x0:_0x4c0add[_0x0811('0x18')];var _0x1367c7=_0x3c06ec?_0x5c5e84['count']:_0x4c0add['offset']+_0x4c0add[_0x0811('0x1a')];var _0x414c49;if(_0x1367c7>=_0x5baffe){_0x1367c7=_0x5baffe;_0x414c49=0xc8;}else{_0x414c49=0xce;}_0x4ca03c['status'](_0x414c49);return _0x4ca03c[_0x0811('0x1c')](_0x0811('0x1d'),_0x3c1856+'-'+_0x1367c7+'/'+_0x5baffe)[_0x0811('0x17')](_0x5c5e84);}return null;};}function patchUpdates(_0x2b9aa3){return function(_0x47dd14){try{jsonpatch[_0x0811('0x1e')](_0x47dd14,_0x2b9aa3,!![]);}catch(_0x43102f){return BPromise[_0x0811('0x1f')](_0x43102f);}return _0x47dd14[_0x0811('0x20')]();};}function saveUpdates(_0x24bec4,_0x43c1a4){return function(_0x19e222){if(_0x19e222){return _0x19e222['update'](_0x24bec4)[_0x0811('0x21')](function(_0x3e5c14){return _0x3e5c14;});}return null;};}function removeEntity(_0x4e7e96,_0xc4b95c){return function(_0x46303e){if(_0x46303e){return _0x46303e[_0x0811('0x22')]()[_0x0811('0x21')](function(){_0x4e7e96['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x6d74ac,_0x5cce2e){return function(_0x3fe842){if(!_0x3fe842){_0x6d74ac['sendStatus'](0x194);}return _0x3fe842;};}function handleError(_0x33844b,_0x2957da){_0x2957da=_0x2957da||0x1f4;return function(_0x45170e){logger[_0x0811('0x23')](_0x45170e[_0x0811('0x24')]);if(_0x45170e[_0x0811('0x25')]){delete _0x45170e[_0x0811('0x25')];}_0x33844b['status'](_0x2957da)[_0x0811('0x26')](_0x45170e);};}exports[_0x0811('0x27')]=function(_0x3a190c,_0x1f9f1e){var _0x39af29={},_0x36c96a={},_0x58ef46={'count':0x0,'rows':[]};var _0x59c623=_[_0x0811('0x28')](db[_0x0811('0x29')][_0x0811('0x2a')],function(_0x5a9e10){return{'name':_0x5a9e10[_0x0811('0x2b')],'type':_0x5a9e10['type']['key']};});_0x36c96a['model']=_[_0x0811('0x28')](_0x59c623,_0x0811('0x25'));_0x36c96a['query']=_['keys'](_0x3a190c[_0x0811('0x2c')]);_0x36c96a['filters']=_[_0x0811('0x2d')](_0x36c96a[_0x0811('0x2e')],_0x36c96a['query']);_0x39af29[_0x0811('0x2f')]=_[_0x0811('0x2d')](_0x36c96a[_0x0811('0x2e')],qs['fields'](_0x3a190c[_0x0811('0x2c')][_0x0811('0x30')]));_0x39af29[_0x0811('0x2f')]=_0x39af29[_0x0811('0x2f')][_0x0811('0x31')]?_0x39af29[_0x0811('0x2f')]:_0x36c96a[_0x0811('0x2e')];if(!_0x3a190c[_0x0811('0x2c')][_0x0811('0x32')]('nolimit')){_0x39af29[_0x0811('0x1a')]=qs[_0x0811('0x1a')](_0x3a190c[_0x0811('0x2c')]['limit']);_0x39af29['offset']=qs[_0x0811('0x18')](_0x3a190c[_0x0811('0x2c')][_0x0811('0x18')]);}_0x39af29[_0x0811('0x33')]=qs[_0x0811('0x34')](_0x3a190c[_0x0811('0x2c')][_0x0811('0x34')]);_0x39af29[_0x0811('0x35')]=qs[_0x0811('0x36')](_[_0x0811('0x37')](_0x3a190c[_0x0811('0x2c')],_0x36c96a['filters']),_0x59c623);if(_0x3a190c[_0x0811('0x2c')]['filter']){_0x39af29[_0x0811('0x35')]=_[_0x0811('0x38')](_0x39af29[_0x0811('0x35')],{'$or':_['map'](_0x59c623,function(_0x2c50f6){if(_0x2c50f6[_0x0811('0x39')]!==_0x0811('0x3a')){var _0x3b155b={};_0x3b155b[_0x2c50f6[_0x0811('0x25')]]={'$like':'%'+_0x3a190c[_0x0811('0x2c')]['filter']+'%'};return _0x3b155b;}})});}_0x39af29=_['merge']({},_0x39af29,_0x3a190c[_0x0811('0x3b')]);var _0x17062b={'where':_0x39af29[_0x0811('0x35')]};return db[_0x0811('0x29')][_0x0811('0x1b')](_0x17062b)[_0x0811('0x21')](function(_0x220c8a){_0x58ef46[_0x0811('0x1b')]=_0x220c8a;if(_0x3a190c[_0x0811('0x2c')][_0x0811('0x3c')]){_0x39af29[_0x0811('0x3d')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x0811('0x3e')](_0x39af29);})['then'](function(_0x1ea7c5){_0x58ef46[_0x0811('0x3f')]=_0x1ea7c5;return _0x58ef46;})[_0x0811('0x21')](respondWithFilteredResult(_0x1f9f1e,_0x39af29))[_0x0811('0x40')](handleError(_0x1f9f1e,null));};exports['show']=function(_0x232757,_0x1b7954){var _0x20d34a={'raw':!![],'where':{'id':_0x232757[_0x0811('0x41')]['id']}},_0xccdd8b={};_0xccdd8b['model']=_['keys'](db['ChatQueueReport']['rawAttributes']);_0xccdd8b[_0x0811('0x2c')]=_['keys'](_0x232757['query']);_0xccdd8b['filters']=_[_0x0811('0x2d')](_0xccdd8b['model'],_0xccdd8b[_0x0811('0x2c')]);_0x20d34a['attributes']=_[_0x0811('0x2d')](_0xccdd8b[_0x0811('0x2e')],qs[_0x0811('0x30')](_0x232757[_0x0811('0x2c')][_0x0811('0x30')]));_0x20d34a['attributes']=_0x20d34a[_0x0811('0x2f')][_0x0811('0x31')]?_0x20d34a[_0x0811('0x2f')]:_0xccdd8b[_0x0811('0x2e')];if(_0x232757[_0x0811('0x2c')]['includeAll']){_0x20d34a[_0x0811('0x3d')]=[{'all':!![]}];}_0x20d34a=_[_0x0811('0x38')]({},_0x20d34a,_0x232757[_0x0811('0x3b')]);return db['ChatQueueReport']['find'](_0x20d34a)[_0x0811('0x21')](handleEntityNotFound(_0x1b7954,null))[_0x0811('0x21')](respondWithResult(_0x1b7954,null))[_0x0811('0x40')](handleError(_0x1b7954,null));};exports['create']=function(_0x4701c7,_0x39be7d){return db[_0x0811('0x29')][_0x0811('0x42')](_0x4701c7[_0x0811('0x43')],{})[_0x0811('0x21')](respondWithResult(_0x39be7d,0xc9))['catch'](handleError(_0x39be7d,null));};exports[_0x0811('0x44')]=function(_0x2b578c,_0x54c088){if(_0x2b578c['body']['id']){delete _0x2b578c[_0x0811('0x43')]['id'];}return db['ChatQueueReport'][_0x0811('0x45')]({'where':{'id':_0x2b578c[_0x0811('0x41')]['id']}})['then'](handleEntityNotFound(_0x54c088,null))['then'](saveUpdates(_0x2b578c[_0x0811('0x43')],null))['then'](respondWithResult(_0x54c088,null))[_0x0811('0x40')](handleError(_0x54c088,null));};exports[_0x0811('0x22')]=function(_0x52d23a,_0x39fad3){return db[_0x0811('0x29')][_0x0811('0x45')]({'where':{'id':_0x52d23a[_0x0811('0x41')]['id']}})[_0x0811('0x21')](handleEntityNotFound(_0x39fad3,null))['then'](removeEntity(_0x39fad3,null))[_0x0811('0x40')](handleError(_0x39fad3,null));};exports[_0x0811('0x46')]=function(_0x26d6b1,_0x5b0e18){return db[_0x0811('0x29')][_0x0811('0x46')]()[_0x0811('0x21')](respondWithResult(_0x5b0e18,null))[_0x0811('0x40')](handleError(_0x5b0e18,null));}; \ No newline at end of file +var _0xbe2c=['key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','json','reject','save','update','then','sendStatus','error','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type'];(function(_0x2f77ee,_0x2bff02){var _0x38d29a=function(_0x1f7e81){while(--_0x1f7e81){_0x2f77ee['push'](_0x2f77ee['shift']());}};_0x38d29a(++_0x2bff02);}(_0xbe2c,0x18f));var _0xcbe2=function(_0x195a4e,_0x1b58e){_0x195a4e=_0x195a4e-0x0;var _0x274bbf=_0xbe2c[_0x195a4e];return _0x274bbf;};'use strict';var emlformat=require(_0xcbe2('0x0'));var rimraf=require(_0xcbe2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcbe2('0x2'));var rp=require('request-promise');var moment=require(_0xcbe2('0x3'));var BPromise=require(_0xcbe2('0x4'));var Mustache=require(_0xcbe2('0x5'));var util=require(_0xcbe2('0x6'));var path=require(_0xcbe2('0x7'));var sox=require('sox');var csv=require(_0xcbe2('0x8'));var ejs=require(_0xcbe2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbe2('0xa'));var squel=require(_0xcbe2('0xb'));var crypto=require(_0xcbe2('0xc'));var jsforce=require(_0xcbe2('0xd'));var deskjs=require(_0xcbe2('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcbe2('0xf'));var Redis=require(_0xcbe2('0x10'));var authService=require(_0xcbe2('0x11'));var qs=require(_0xcbe2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcbe2('0x13'))(_0xcbe2('0x14'));var utils=require(_0xcbe2('0x15'));var config=require(_0xcbe2('0x16'));var licenseUtil=require(_0xcbe2('0x17'));var db=require(_0xcbe2('0x18'))['db'];function respondWithStatusCode(_0x526ce2,_0x1b94fb){_0x1b94fb=_0x1b94fb||0xcc;return function(_0x192c00){if(_0x192c00){return _0x526ce2['sendStatus'](_0x1b94fb);}return _0x526ce2[_0xcbe2('0x19')](_0x1b94fb)['end']();};}function respondWithResult(_0x41de3f,_0x4c18dc){_0x4c18dc=_0x4c18dc||0xc8;return function(_0x3920bf){if(_0x3920bf){return _0x41de3f['status'](_0x4c18dc)['json'](_0x3920bf);}};}function respondWithFilteredResult(_0xb89337,_0x4ec284){return function(_0xb2995b){if(_0xb2995b){var _0x23c38f=typeof _0x4ec284[_0xcbe2('0x1a')]===_0xcbe2('0x1b')&&typeof _0x4ec284[_0xcbe2('0x1c')]===_0xcbe2('0x1b');var _0x126aa9=_0xb2995b['count'];var _0xb968ac=_0x23c38f?0x0:_0x4ec284['offset'];var _0x1c09cb=_0x23c38f?_0xb2995b[_0xcbe2('0x1d')]:_0x4ec284[_0xcbe2('0x1a')]+_0x4ec284[_0xcbe2('0x1c')];var _0x537eb2;if(_0x1c09cb>=_0x126aa9){_0x1c09cb=_0x126aa9;_0x537eb2=0xc8;}else{_0x537eb2=0xce;}_0xb89337[_0xcbe2('0x19')](_0x537eb2);return _0xb89337['set']('Content-Range',_0xb968ac+'-'+_0x1c09cb+'/'+_0x126aa9)[_0xcbe2('0x1e')](_0xb2995b);}return null;};}function patchUpdates(_0x208863){return function(_0x8b1504){try{jsonpatch['apply'](_0x8b1504,_0x208863,!![]);}catch(_0x104706){return BPromise[_0xcbe2('0x1f')](_0x104706);}return _0x8b1504[_0xcbe2('0x20')]();};}function saveUpdates(_0x5167eb,_0x372789){return function(_0x432329){if(_0x432329){return _0x432329[_0xcbe2('0x21')](_0x5167eb)[_0xcbe2('0x22')](function(_0x38048c){return _0x38048c;});}return null;};}function removeEntity(_0x285fc7,_0x2f1e25){return function(_0x2914e6){if(_0x2914e6){return _0x2914e6['destroy']()[_0xcbe2('0x22')](function(){_0x285fc7[_0xcbe2('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40039f,_0x1829e6){return function(_0xc6ec9b){if(!_0xc6ec9b){_0x40039f[_0xcbe2('0x23')](0x194);}return _0xc6ec9b;};}function handleError(_0x105b92,_0x4833cd){_0x4833cd=_0x4833cd||0x1f4;return function(_0xbc5aab){logger[_0xcbe2('0x24')](_0xbc5aab['stack']);if(_0xbc5aab[_0xcbe2('0x25')]){delete _0xbc5aab['name'];}_0x105b92[_0xcbe2('0x19')](_0x4833cd)[_0xcbe2('0x26')](_0xbc5aab);};}exports[_0xcbe2('0x27')]=function(_0x431631,_0x4c194d){var _0xdee879={},_0x37eb8b={},_0x4cf95a={'count':0x0,'rows':[]};var _0x3596be=_[_0xcbe2('0x28')](db[_0xcbe2('0x29')][_0xcbe2('0x2a')],function(_0x26d570){return{'name':_0x26d570[_0xcbe2('0x2b')],'type':_0x26d570[_0xcbe2('0x2c')][_0xcbe2('0x2d')]};});_0x37eb8b[_0xcbe2('0x2e')]=_[_0xcbe2('0x28')](_0x3596be,_0xcbe2('0x25'));_0x37eb8b[_0xcbe2('0x2f')]=_[_0xcbe2('0x30')](_0x431631['query']);_0x37eb8b[_0xcbe2('0x31')]=_[_0xcbe2('0x32')](_0x37eb8b['model'],_0x37eb8b['query']);_0xdee879[_0xcbe2('0x33')]=_['intersection'](_0x37eb8b[_0xcbe2('0x2e')],qs[_0xcbe2('0x34')](_0x431631[_0xcbe2('0x2f')][_0xcbe2('0x34')]));_0xdee879[_0xcbe2('0x33')]=_0xdee879[_0xcbe2('0x33')][_0xcbe2('0x35')]?_0xdee879['attributes']:_0x37eb8b[_0xcbe2('0x2e')];if(!_0x431631['query']['hasOwnProperty'](_0xcbe2('0x36'))){_0xdee879['limit']=qs[_0xcbe2('0x1c')](_0x431631['query'][_0xcbe2('0x1c')]);_0xdee879[_0xcbe2('0x1a')]=qs['offset'](_0x431631[_0xcbe2('0x2f')]['offset']);}_0xdee879[_0xcbe2('0x37')]=qs['sort'](_0x431631['query'][_0xcbe2('0x38')]);_0xdee879['where']=qs['filters'](_[_0xcbe2('0x39')](_0x431631['query'],_0x37eb8b[_0xcbe2('0x31')]),_0x3596be);if(_0x431631[_0xcbe2('0x2f')][_0xcbe2('0x3a')]){_0xdee879['where']=_[_0xcbe2('0x3b')](_0xdee879[_0xcbe2('0x3c')],{'$or':_['map'](_0x3596be,function(_0x522bfd){if(_0x522bfd['type']!==_0xcbe2('0x3d')){var _0x4347a7={};_0x4347a7[_0x522bfd[_0xcbe2('0x25')]]={'$like':'%'+_0x431631[_0xcbe2('0x2f')][_0xcbe2('0x3a')]+'%'};return _0x4347a7;}})});}_0xdee879=_['merge']({},_0xdee879,_0x431631[_0xcbe2('0x3e')]);var _0x2b9fd8={'where':_0xdee879['where']};return db[_0xcbe2('0x29')][_0xcbe2('0x1d')](_0x2b9fd8)[_0xcbe2('0x22')](function(_0x3b2878){_0x4cf95a[_0xcbe2('0x1d')]=_0x3b2878;if(_0x431631[_0xcbe2('0x2f')]['includeAll']){_0xdee879[_0xcbe2('0x3f')]=[{'all':!![]}];}return db['ChatQueueReport'][_0xcbe2('0x40')](_0xdee879);})['then'](function(_0x272fdb){_0x4cf95a['rows']=_0x272fdb;return _0x4cf95a;})[_0xcbe2('0x22')](respondWithFilteredResult(_0x4c194d,_0xdee879))[_0xcbe2('0x41')](handleError(_0x4c194d,null));};exports[_0xcbe2('0x42')]=function(_0x1a200a,_0x4e72bb){var _0x25899c={'raw':!![],'where':{'id':_0x1a200a[_0xcbe2('0x43')]['id']}},_0x5c5684={};_0x5c5684[_0xcbe2('0x2e')]=_[_0xcbe2('0x30')](db['ChatQueueReport'][_0xcbe2('0x2a')]);_0x5c5684[_0xcbe2('0x2f')]=_['keys'](_0x1a200a[_0xcbe2('0x2f')]);_0x5c5684['filters']=_[_0xcbe2('0x32')](_0x5c5684[_0xcbe2('0x2e')],_0x5c5684[_0xcbe2('0x2f')]);_0x25899c[_0xcbe2('0x33')]=_[_0xcbe2('0x32')](_0x5c5684[_0xcbe2('0x2e')],qs['fields'](_0x1a200a['query'][_0xcbe2('0x34')]));_0x25899c['attributes']=_0x25899c[_0xcbe2('0x33')][_0xcbe2('0x35')]?_0x25899c[_0xcbe2('0x33')]:_0x5c5684[_0xcbe2('0x2e')];if(_0x1a200a[_0xcbe2('0x2f')][_0xcbe2('0x44')]){_0x25899c[_0xcbe2('0x3f')]=[{'all':!![]}];}_0x25899c=_[_0xcbe2('0x3b')]({},_0x25899c,_0x1a200a[_0xcbe2('0x3e')]);return db[_0xcbe2('0x29')][_0xcbe2('0x45')](_0x25899c)[_0xcbe2('0x22')](handleEntityNotFound(_0x4e72bb,null))[_0xcbe2('0x22')](respondWithResult(_0x4e72bb,null))[_0xcbe2('0x41')](handleError(_0x4e72bb,null));};exports['create']=function(_0x1110eb,_0x5868be){return db[_0xcbe2('0x29')][_0xcbe2('0x46')](_0x1110eb[_0xcbe2('0x47')],{})['then'](respondWithResult(_0x5868be,0xc9))[_0xcbe2('0x41')](handleError(_0x5868be,null));};exports[_0xcbe2('0x21')]=function(_0x52057b,_0x33e78b){if(_0x52057b[_0xcbe2('0x47')]['id']){delete _0x52057b[_0xcbe2('0x47')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x52057b['params']['id']}})[_0xcbe2('0x22')](handleEntityNotFound(_0x33e78b,null))[_0xcbe2('0x22')](saveUpdates(_0x52057b[_0xcbe2('0x47')],null))[_0xcbe2('0x22')](respondWithResult(_0x33e78b,null))[_0xcbe2('0x41')](handleError(_0x33e78b,null));};exports[_0xcbe2('0x48')]=function(_0x2d295c,_0x19f1e1){return db[_0xcbe2('0x29')]['find']({'where':{'id':_0x2d295c['params']['id']}})['then'](handleEntityNotFound(_0x19f1e1,null))[_0xcbe2('0x22')](removeEntity(_0x19f1e1,null))[_0xcbe2('0x41')](handleError(_0x19f1e1,null));};exports[_0xcbe2('0x49')]=function(_0x3b6cf8,_0x3275a5){return db[_0xcbe2('0x29')][_0xcbe2('0x49')]()['then'](respondWithResult(_0x3275a5,null))['catch'](handleError(_0x3275a5,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 58a56a1..7039d83 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x1cf1c7,_0x1e0f72){var _0x362b0a=function(_0xfec7cd){while(--_0xfec7cd){_0x1cf1c7['push'](_0x1cf1c7['shift']());}};_0x362b0a(++_0x1e0f72);}(_0xe706,0xa3));var _0x6e70=function(_0x10291b,_0x518773){_0x10291b=_0x10291b-0x0;var _0x1d5fbe=_0xe706[_0x10291b];return _0x1d5fbe;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x3d7c5b,_0x296fed){var _0x9c1421=function(_0x5477ce){while(--_0x5477ce){_0x3d7c5b['push'](_0x3d7c5b['shift']());}};_0x9c1421(++_0x296fed);}(_0x757a,0xde));var _0xa757=function(_0x3219fd,_0x1121a2){_0x3219fd=_0x3219fd-0x0;var _0x2b500e=_0x757a[_0x3219fd];return _0x2b500e;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index b3ef84e..e7fb549 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 _0x7b1b=['request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ChatQueueReport,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7b1b,0x17d));var _0xb7b1=function(_0x4741af,_0x2305b3){_0x4741af=_0x4741af-0x0;var _0xbf6b99=_0x7b1b[_0x4741af];return _0xbf6b99;};'use strict';var _=require(_0xb7b1('0x0'));var util=require(_0xb7b1('0x1'));var moment=require(_0xb7b1('0x2'));var BPromise=require(_0xb7b1('0x3'));var rs=require(_0xb7b1('0x4'));var fs=require('fs');var Redis=require(_0xb7b1('0x5'));var db=require(_0xb7b1('0x6'))['db'];var utils=require(_0xb7b1('0x7'));var logger=require(_0xb7b1('0x8'))('rpc');var config=require(_0xb7b1('0x9'));var jayson=require(_0xb7b1('0xa'));var client=jayson['client'][_0xb7b1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a0740,_0x4ba25d,_0x159a90){return new BPromise(function(_0x3d0b52,_0x1e3431){return client[_0xb7b1('0xc')](_0x3a0740,_0x159a90)['then'](function(_0x4b5481){logger[_0xb7b1('0xd')](_0xb7b1('0xe'),_0x4ba25d,_0xb7b1('0xf'));logger[_0xb7b1('0x10')](_0xb7b1('0x11'),_0x4ba25d,_0xb7b1('0xf'),JSON[_0xb7b1('0x12')](_0x4b5481));if(_0x4b5481[_0xb7b1('0x13')]){if(_0x4b5481[_0xb7b1('0x13')][_0xb7b1('0x14')]===0x1f4){logger[_0xb7b1('0x13')](_0xb7b1('0xe'),_0x4ba25d,_0x4b5481['error'][_0xb7b1('0x15')]);return _0x1e3431(_0x4b5481['error']['message']);}logger[_0xb7b1('0x13')](_0xb7b1('0xe'),_0x4ba25d,_0x4b5481[_0xb7b1('0x13')][_0xb7b1('0x15')]);return _0x3d0b52(_0x4b5481[_0xb7b1('0x13')]['message']);}else{logger[_0xb7b1('0xd')](_0xb7b1('0xe'),_0x4ba25d,_0xb7b1('0xf'));_0x3d0b52(_0x4b5481['result'][_0xb7b1('0x15')]);}})[_0xb7b1('0x16')](function(_0x8e2ff9){logger['error'](_0xb7b1('0xe'),_0x4ba25d,_0x8e2ff9);_0x1e3431(_0x8e2ff9);});});}exports[_0xb7b1('0x17')]=function(_0x59e2c7){var _0x526fc6=this;return new Promise(function(_0x14c02c,_0x55457d){return db[_0xb7b1('0x18')][_0xb7b1('0x19')](_0x59e2c7[_0xb7b1('0x1a')],{'raw':_0x59e2c7['options']?_0x59e2c7[_0xb7b1('0x1b')][_0xb7b1('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x507c5b){logger['info'](_0xb7b1('0x17'),_0x59e2c7);logger[_0xb7b1('0x10')](_0xb7b1('0x17'),_0x59e2c7,JSON[_0xb7b1('0x12')](_0x507c5b));_0x14c02c(_0x507c5b);})['catch'](function(_0x21f01f){logger[_0xb7b1('0x13')](_0xb7b1('0x17'),_0x21f01f[_0xb7b1('0x15')],_0x59e2c7);_0x55457d(_0x526fc6['error'](0x1f4,_0x21f01f[_0xb7b1('0x15')]));});});};exports[_0xb7b1('0x1d')]=function(_0xbbe040){var _0x4beaa4=this;return new Promise(function(_0x39ab05,_0x540027){return db[_0xb7b1('0x18')]['update'](_0xbbe040[_0xb7b1('0x1a')],{'raw':_0xbbe040['options']?_0xbbe040[_0xb7b1('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbbe040[_0xb7b1('0x1b')]?_0xbbe040[_0xb7b1('0x1b')][_0xb7b1('0x1e')]||null:null,'attributes':_0xbbe040[_0xb7b1('0x1b')]?_0xbbe040[_0xb7b1('0x1b')][_0xb7b1('0x1f')]||null:null,'limit':_0xbbe040[_0xb7b1('0x1b')]?_0xbbe040[_0xb7b1('0x1b')][_0xb7b1('0x20')]||null:null})['then'](function(_0x4c22b2){logger[_0xb7b1('0xd')](_0xb7b1('0x1d'),_0xbbe040);logger[_0xb7b1('0x10')](_0xb7b1('0x1d'),_0xbbe040,JSON['stringify'](_0x4c22b2));_0x39ab05(_0x4c22b2);})[_0xb7b1('0x16')](function(_0x5f115a){logger[_0xb7b1('0x13')](_0xb7b1('0x1d'),_0x5f115a[_0xb7b1('0x15')],_0xbbe040);_0x540027(_0x4beaa4['error'](0x1f4,_0x5f115a[_0xb7b1('0x15')]));});});}; \ No newline at end of file +var _0x0b66=['jayson/promise','client','http','request','info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','ChatQueueReport,\x20%s,\x20%s','message','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','then','stringify','catch','UpdateChatQueueReport','update','where','attributes','limit','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x37a738,_0x302f32){var _0x58a23a=function(_0x500ed0){while(--_0x500ed0){_0x37a738['push'](_0x37a738['shift']());}};_0x58a23a(++_0x302f32);}(_0x0b66,0x1b9));var _0x60b6=function(_0x362c80,_0x1b8621){_0x362c80=_0x362c80-0x0;var _0xcc5206=_0x0b66[_0x362c80];return _0xcc5206;};'use strict';var _=require('lodash');var util=require(_0x60b6('0x0'));var moment=require(_0x60b6('0x1'));var BPromise=require('bluebird');var rs=require(_0x60b6('0x2'));var fs=require('fs');var Redis=require(_0x60b6('0x3'));var db=require(_0x60b6('0x4'))['db'];var utils=require(_0x60b6('0x5'));var logger=require(_0x60b6('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x60b6('0x7'));var client=jayson[_0x60b6('0x8')][_0x60b6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15fc3d,_0x4bdeca,_0x1f0265){return new BPromise(function(_0xac7161,_0x9e15ac){return client[_0x60b6('0xa')](_0x15fc3d,_0x1f0265)['then'](function(_0x100d80){logger[_0x60b6('0xb')]('ChatQueueReport,\x20%s,\x20%s',_0x4bdeca,_0x60b6('0xc'));logger[_0x60b6('0xd')](_0x60b6('0xe'),_0x4bdeca,_0x60b6('0xc'),JSON['stringify'](_0x100d80));if(_0x100d80['error']){if(_0x100d80['error']['code']===0x1f4){logger[_0x60b6('0xf')](_0x60b6('0x10'),_0x4bdeca,_0x100d80['error'][_0x60b6('0x11')]);return _0x9e15ac(_0x100d80['error'][_0x60b6('0x11')]);}logger['error'](_0x60b6('0x10'),_0x4bdeca,_0x100d80[_0x60b6('0xf')]['message']);return _0xac7161(_0x100d80['error']['message']);}else{logger[_0x60b6('0xb')](_0x60b6('0x10'),_0x4bdeca,'request\x20sent');_0xac7161(_0x100d80['result']['message']);}})['catch'](function(_0x1dd9de){logger[_0x60b6('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x4bdeca,_0x1dd9de);_0x9e15ac(_0x1dd9de);});});}exports[_0x60b6('0x12')]=function(_0x58c747){var _0x51418e=this;return new Promise(function(_0x391aea,_0x14ea69){return db[_0x60b6('0x13')][_0x60b6('0x14')](_0x58c747[_0x60b6('0x15')],{'raw':_0x58c747['options']?_0x58c747[_0x60b6('0x16')][_0x60b6('0x17')]===undefined?!![]:![]:!![]})[_0x60b6('0x18')](function(_0x572de3){logger['info'](_0x60b6('0x12'),_0x58c747);logger['debug'](_0x60b6('0x12'),_0x58c747,JSON[_0x60b6('0x19')](_0x572de3));_0x391aea(_0x572de3);})[_0x60b6('0x1a')](function(_0x5d6424){logger[_0x60b6('0xf')](_0x60b6('0x12'),_0x5d6424[_0x60b6('0x11')],_0x58c747);_0x14ea69(_0x51418e[_0x60b6('0xf')](0x1f4,_0x5d6424[_0x60b6('0x11')]));});});};exports[_0x60b6('0x1b')]=function(_0x25e544){var _0x469fe0=this;return new Promise(function(_0x24104f,_0x38aa5b){return db[_0x60b6('0x13')][_0x60b6('0x1c')](_0x25e544['body'],{'raw':_0x25e544[_0x60b6('0x16')]?_0x25e544[_0x60b6('0x16')][_0x60b6('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25e544[_0x60b6('0x16')]?_0x25e544[_0x60b6('0x16')][_0x60b6('0x1d')]||null:null,'attributes':_0x25e544[_0x60b6('0x16')]?_0x25e544[_0x60b6('0x16')][_0x60b6('0x1e')]||null:null,'limit':_0x25e544['options']?_0x25e544[_0x60b6('0x16')][_0x60b6('0x1f')]||null:null})[_0x60b6('0x18')](function(_0x53cd4f){logger[_0x60b6('0xb')](_0x60b6('0x1b'),_0x25e544);logger['debug'](_0x60b6('0x1b'),_0x25e544,JSON[_0x60b6('0x19')](_0x53cd4f));_0x24104f(_0x53cd4f);})[_0x60b6('0x1a')](function(_0x3e79c2){logger['error']('UpdateChatQueueReport',_0x3e79c2[_0x60b6('0x11')],_0x25e544);_0x38aa5b(_0x469fe0['error'](0x1f4,_0x3e79c2[_0x60b6('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index dc819cb..d14a5c6 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 _0x4e3d=['index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./chatQueueReport.controller','get','isAuthenticated'];(function(_0x3da594,_0x246a24){var _0x502753=function(_0x6965cd){while(--_0x6965cd){_0x3da594['push'](_0x3da594['shift']());}};_0x502753(++_0x246a24);}(_0x4e3d,0x146));var _0xd4e3=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4e3d[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0xd4e3('0x0'));var util=require(_0xd4e3('0x1'));var path=require(_0xd4e3('0x2'));var timeout=require(_0xd4e3('0x3'));var express=require(_0xd4e3('0x4'));var router=express[_0xd4e3('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd4e3('0x6'));var config=require('../../config/environment');var controller=require(_0xd4e3('0x7'));router[_0xd4e3('0x8')]('/',auth[_0xd4e3('0x9')](),controller[_0xd4e3('0xa')]);router[_0xd4e3('0x8')](_0xd4e3('0xb'),auth[_0xd4e3('0x9')](),controller[_0xd4e3('0xc')]);router['get'](_0xd4e3('0xd'),auth[_0xd4e3('0x9')](),controller[_0xd4e3('0xe')]);router[_0xd4e3('0xf')]('/',auth[_0xd4e3('0x9')](),controller[_0xd4e3('0x10')]);router[_0xd4e3('0x11')]('/:id',auth[_0xd4e3('0x9')](),controller[_0xd4e3('0x12')]);router['delete'](_0xd4e3('0xd'),auth[_0xd4e3('0x9')](),controller[_0xd4e3('0x13')]);module[_0xd4e3('0x14')]=router; \ No newline at end of file +var _0x99e7=['destroy','multer','util','connect-timeout','Router','../../components/interaction/service','./chatQueueReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update'];(function(_0x429948,_0x1a6851){var _0x35d5d1=function(_0x574853){while(--_0x574853){_0x429948['push'](_0x429948['shift']());}};_0x35d5d1(++_0x1a6851);}(_0x99e7,0x19f));var _0x799e=function(_0x24cc72,_0x4dc73a){_0x24cc72=_0x24cc72-0x0;var _0xd49f1e=_0x99e7[_0x24cc72];return _0xd49f1e;};'use strict';var multer=require(_0x799e('0x0'));var util=require(_0x799e('0x1'));var path=require('path');var timeout=require(_0x799e('0x2'));var express=require('express');var router=express[_0x799e('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x799e('0x4'));var config=require('../../config/environment');var controller=require(_0x799e('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x799e('0x6')]);router[_0x799e('0x7')](_0x799e('0x8'),auth[_0x799e('0x9')](),controller[_0x799e('0xa')]);router['get'](_0x799e('0xb'),auth['isAuthenticated'](),controller[_0x799e('0xc')]);router[_0x799e('0xd')]('/',auth[_0x799e('0x9')](),controller[_0x799e('0xe')]);router[_0x799e('0xf')](_0x799e('0xb'),auth[_0x799e('0x9')](),controller[_0x799e('0x10')]);router['delete'](_0x799e('0xb'),auth[_0x799e('0x9')](),controller[_0x799e('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index ec06a38..be372c5 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x4fe1df,_0x413bd2){var _0x4a0b2c=function(_0x4d463a){while(--_0x4d463a){_0x4fe1df['push'](_0x4fe1df['shift']());}};_0x4a0b2c(++_0x413bd2);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x232ec0,_0x45fdd0){_0x232ec0=_0x232ec0-0x0;var _0x356705=_0xcb91[_0x232ec0];return _0x356705;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x5ddfd6,_0x32ddcd){var _0x5a7ba9=function(_0x476c78){while(--_0x476c78){_0x5ddfd6['push'](_0x5ddfd6['shift']());}};_0x5a7ba9(++_0x32ddcd);}(_0x00bb,0x1d8));var _0xb00b=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x00bb[_0x55e08b];return _0xd1a7ff;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index fb13f11..5f49691 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 _0x8968=['apply','reject','update','then','destroy','end','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','keys','filters','intersection','query','attributes','fields','length','model','nolimit','order','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x3c39f7,_0xcd2c1d){var _0x476581=function(_0x822b74){while(--_0x822b74){_0x3c39f7['push'](_0x3c39f7['shift']());}};_0x476581(++_0xcd2c1d);}(_0x8968,0x75));var _0x8896=function(_0x1f75e8,_0x7fa97f){_0x1f75e8=_0x1f75e8-0x0;var _0x120699=_0x8968[_0x1f75e8];return _0x120699;};'use strict';var emlformat=require(_0x8896('0x0'));var rimraf=require(_0x8896('0x1'));var zipdir=require(_0x8896('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8896('0x3'));var BPromise=require(_0x8896('0x4'));var Mustache=require('mustache');var util=require(_0x8896('0x5'));var path=require(_0x8896('0x6'));var sox=require(_0x8896('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8896('0x8'));var _=require(_0x8896('0x9'));var squel=require(_0x8896('0xa'));var crypto=require(_0x8896('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8896('0xc'));var Papa=require(_0x8896('0xd'));var Redis=require(_0x8896('0xe'));var authService=require(_0x8896('0xf'));var qs=require(_0x8896('0x10'));var as=require(_0x8896('0x11'));var hardwareService=require(_0x8896('0x12'));var logger=require(_0x8896('0x13'))('api');var utils=require(_0x8896('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8896('0x15'));var db=require(_0x8896('0x16'))['db'];function respondWithStatusCode(_0x7ce721,_0x5a7ede){_0x5a7ede=_0x5a7ede||0xcc;return function(_0x486c07){if(_0x486c07){return _0x7ce721[_0x8896('0x17')](_0x5a7ede);}return _0x7ce721[_0x8896('0x18')](_0x5a7ede)['end']();};}function respondWithResult(_0x568de8,_0x5a62ae){_0x5a62ae=_0x5a62ae||0xc8;return function(_0x4d5ddd){if(_0x4d5ddd){return _0x568de8['status'](_0x5a62ae)[_0x8896('0x19')](_0x4d5ddd);}};}function respondWithFilteredResult(_0x4ffc4e,_0x16e0f0){return function(_0x26e750){if(_0x26e750){var _0x2ea7b1=typeof _0x16e0f0[_0x8896('0x1a')]===_0x8896('0x1b')&&typeof _0x16e0f0[_0x8896('0x1c')]==='undefined';var _0x5a007a=_0x26e750['count'];var _0x55c82f=_0x2ea7b1?0x0:_0x16e0f0['offset'];var _0xe46b3b=_0x2ea7b1?_0x26e750[_0x8896('0x1d')]:_0x16e0f0[_0x8896('0x1a')]+_0x16e0f0[_0x8896('0x1c')];var _0x32bf56;if(_0xe46b3b>=_0x5a007a){_0xe46b3b=_0x5a007a;_0x32bf56=0xc8;}else{_0x32bf56=0xce;}_0x4ffc4e[_0x8896('0x18')](_0x32bf56);return _0x4ffc4e[_0x8896('0x1e')]('Content-Range',_0x55c82f+'-'+_0xe46b3b+'/'+_0x5a007a)[_0x8896('0x19')](_0x26e750);}return null;};}function patchUpdates(_0xc5fce){return function(_0xd00f98){try{jsonpatch[_0x8896('0x1f')](_0xd00f98,_0xc5fce,!![]);}catch(_0x2154fc){return BPromise[_0x8896('0x20')](_0x2154fc);}return _0xd00f98['save']();};}function saveUpdates(_0x1994f0,_0xb9e59){return function(_0x1bf510){if(_0x1bf510){return _0x1bf510[_0x8896('0x21')](_0x1994f0)[_0x8896('0x22')](function(_0x168963){return _0x168963;});}return null;};}function removeEntity(_0x5cc79c,_0x42f53e){return function(_0x384c19){if(_0x384c19){return _0x384c19[_0x8896('0x23')]()[_0x8896('0x22')](function(){_0x5cc79c[_0x8896('0x18')](0xcc)[_0x8896('0x24')]();});}};}function handleEntityNotFound(_0xa64a3f,_0x5f1a0a){return function(_0x2964c3){if(!_0x2964c3){_0xa64a3f['sendStatus'](0x194);}return _0x2964c3;};}function handleError(_0x5cd665,_0x392777){_0x392777=_0x392777||0x1f4;return function(_0x1ea9e6){logger[_0x8896('0x25')](_0x1ea9e6[_0x8896('0x26')]);if(_0x1ea9e6[_0x8896('0x27')]){delete _0x1ea9e6['name'];}_0x5cd665[_0x8896('0x18')](_0x392777)[_0x8896('0x28')](_0x1ea9e6);};}exports[_0x8896('0x29')]=function(_0xce069b,_0x294778){var _0x16191={},_0xd9f40d={},_0x222973={'count':0x0,'rows':[]};var _0x58f07e=_[_0x8896('0x2a')](db[_0x8896('0x2b')][_0x8896('0x2c')],function(_0x3ebc23){return{'name':_0x3ebc23[_0x8896('0x2d')],'type':_0x3ebc23[_0x8896('0x2e')][_0x8896('0x2f')]};});_0xd9f40d['model']=_['map'](_0x58f07e,_0x8896('0x27'));_0xd9f40d['query']=_[_0x8896('0x30')](_0xce069b['query']);_0xd9f40d[_0x8896('0x31')]=_[_0x8896('0x32')](_0xd9f40d['model'],_0xd9f40d[_0x8896('0x33')]);_0x16191[_0x8896('0x34')]=_['intersection'](_0xd9f40d['model'],qs[_0x8896('0x35')](_0xce069b[_0x8896('0x33')][_0x8896('0x35')]));_0x16191[_0x8896('0x34')]=_0x16191[_0x8896('0x34')][_0x8896('0x36')]?_0x16191['attributes']:_0xd9f40d[_0x8896('0x37')];if(!_0xce069b[_0x8896('0x33')]['hasOwnProperty'](_0x8896('0x38'))){_0x16191[_0x8896('0x1c')]=qs[_0x8896('0x1c')](_0xce069b['query']['limit']);_0x16191[_0x8896('0x1a')]=qs['offset'](_0xce069b[_0x8896('0x33')][_0x8896('0x1a')]);}_0x16191[_0x8896('0x39')]=qs['sort'](_0xce069b['query']['sort']);_0x16191[_0x8896('0x3a')]=qs['filters'](_[_0x8896('0x3b')](_0xce069b[_0x8896('0x33')],_0xd9f40d[_0x8896('0x31')]),_0x58f07e);if(_0xce069b[_0x8896('0x33')]['filter']){_0x16191[_0x8896('0x3a')]=_['merge'](_0x16191[_0x8896('0x3a')],{'$or':_[_0x8896('0x2a')](_0x58f07e,function(_0xdae7ab){if(_0xdae7ab[_0x8896('0x2e')]!==_0x8896('0x3c')){var _0x3c2da3={};_0x3c2da3[_0xdae7ab[_0x8896('0x27')]]={'$like':'%'+_0xce069b[_0x8896('0x33')][_0x8896('0x3d')]+'%'};return _0x3c2da3;}})});}_0x16191=_[_0x8896('0x3e')]({},_0x16191,_0xce069b[_0x8896('0x3f')]);var _0x36054c={'where':_0x16191[_0x8896('0x3a')]};return db['ChatTransferReport'][_0x8896('0x1d')](_0x36054c)[_0x8896('0x22')](function(_0x547304){_0x222973[_0x8896('0x1d')]=_0x547304;if(_0xce069b[_0x8896('0x33')][_0x8896('0x40')]){_0x16191[_0x8896('0x41')]=[{'all':!![]}];}return db[_0x8896('0x2b')][_0x8896('0x42')](_0x16191);})[_0x8896('0x22')](function(_0x2336f7){_0x222973[_0x8896('0x43')]=_0x2336f7;return _0x222973;})['then'](respondWithFilteredResult(_0x294778,_0x16191))[_0x8896('0x44')](handleError(_0x294778,null));};exports['show']=function(_0x1806bc,_0x3bcd00){var _0x1d2ef1={'raw':!![],'where':{'id':_0x1806bc[_0x8896('0x45')]['id']}},_0x1265b6={};_0x1265b6['model']=_['keys'](db['ChatTransferReport'][_0x8896('0x2c')]);_0x1265b6['query']=_[_0x8896('0x30')](_0x1806bc['query']);_0x1265b6[_0x8896('0x31')]=_[_0x8896('0x32')](_0x1265b6['model'],_0x1265b6[_0x8896('0x33')]);_0x1d2ef1[_0x8896('0x34')]=_[_0x8896('0x32')](_0x1265b6[_0x8896('0x37')],qs[_0x8896('0x35')](_0x1806bc[_0x8896('0x33')]['fields']));_0x1d2ef1[_0x8896('0x34')]=_0x1d2ef1[_0x8896('0x34')][_0x8896('0x36')]?_0x1d2ef1[_0x8896('0x34')]:_0x1265b6[_0x8896('0x37')];if(_0x1806bc['query']['includeAll']){_0x1d2ef1[_0x8896('0x41')]=[{'all':!![]}];}_0x1d2ef1=_[_0x8896('0x3e')]({},_0x1d2ef1,_0x1806bc[_0x8896('0x3f')]);return db['ChatTransferReport'][_0x8896('0x46')](_0x1d2ef1)[_0x8896('0x22')](handleEntityNotFound(_0x3bcd00,null))[_0x8896('0x22')](respondWithResult(_0x3bcd00,null))[_0x8896('0x44')](handleError(_0x3bcd00,null));};exports[_0x8896('0x47')]=function(_0x2c0fa8,_0xf47559){return db[_0x8896('0x2b')][_0x8896('0x47')](_0x2c0fa8[_0x8896('0x48')],{})[_0x8896('0x22')](respondWithResult(_0xf47559,0xc9))[_0x8896('0x44')](handleError(_0xf47559,null));};exports[_0x8896('0x21')]=function(_0x22d0a3,_0x2b5d20){if(_0x22d0a3[_0x8896('0x48')]['id']){delete _0x22d0a3['body']['id'];}return db[_0x8896('0x2b')][_0x8896('0x46')]({'where':{'id':_0x22d0a3[_0x8896('0x45')]['id']}})[_0x8896('0x22')](handleEntityNotFound(_0x2b5d20,null))['then'](saveUpdates(_0x22d0a3['body'],null))[_0x8896('0x22')](respondWithResult(_0x2b5d20,null))[_0x8896('0x44')](handleError(_0x2b5d20,null));};exports[_0x8896('0x23')]=function(_0x1cf94a,_0x2b6c63){return db[_0x8896('0x2b')]['find']({'where':{'id':_0x1cf94a['params']['id']}})['then'](handleEntityNotFound(_0x2b6c63,null))[_0x8896('0x22')](removeEntity(_0x2b6c63,null))[_0x8896('0x44')](handleError(_0x2b6c63,null));};exports[_0x8896('0x49')]=function(_0x1e3806,_0x252b97){return db[_0x8896('0x2b')][_0x8896('0x49')]()[_0x8896('0x22')](respondWithResult(_0x252b97,null))['catch'](handleError(_0x252b97,null));}; \ No newline at end of file +var _0xb70e=['VIRTUAL','options','include','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','error','stack','name','send','map','ChatTransferReport','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','type'];(function(_0x684bee,_0xbf2e7){var _0x524c9f=function(_0x18b127){while(--_0x18b127){_0x684bee['push'](_0x684bee['shift']());}};_0x524c9f(++_0xbf2e7);}(_0xb70e,0x1ee));var _0xeb70=function(_0xbd28e,_0x250eb3){_0xbd28e=_0xbd28e-0x0;var _0x1155e0=_0xb70e[_0xbd28e];return _0x1155e0;};'use strict';var emlformat=require(_0xeb70('0x0'));var rimraf=require(_0xeb70('0x1'));var zipdir=require(_0xeb70('0x2'));var jsonpatch=require(_0xeb70('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeb70('0x4'));var util=require('util');var path=require('path');var sox=require(_0xeb70('0x5'));var csv=require(_0xeb70('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeb70('0x7'));var _=require(_0xeb70('0x8'));var squel=require(_0xeb70('0x9'));var crypto=require(_0xeb70('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xeb70('0xb'));var toCsv=require(_0xeb70('0x6'));var querystring=require(_0xeb70('0xc'));var Papa=require(_0xeb70('0xd'));var Redis=require('ioredis');var authService=require(_0xeb70('0xe'));var qs=require(_0xeb70('0xf'));var as=require(_0xeb70('0x10'));var hardwareService=require(_0xeb70('0x11'));var logger=require(_0xeb70('0x12'))(_0xeb70('0x13'));var utils=require(_0xeb70('0x14'));var config=require(_0xeb70('0x15'));var licenseUtil=require(_0xeb70('0x16'));var db=require(_0xeb70('0x17'))['db'];function respondWithStatusCode(_0x3eb8ae,_0x4b9e47){_0x4b9e47=_0x4b9e47||0xcc;return function(_0x5d5ae1){if(_0x5d5ae1){return _0x3eb8ae[_0xeb70('0x18')](_0x4b9e47);}return _0x3eb8ae[_0xeb70('0x19')](_0x4b9e47)['end']();};}function respondWithResult(_0x441660,_0x281388){_0x281388=_0x281388||0xc8;return function(_0xa4bf6a){if(_0xa4bf6a){return _0x441660[_0xeb70('0x19')](_0x281388)[_0xeb70('0x1a')](_0xa4bf6a);}};}function respondWithFilteredResult(_0x12e262,_0x58c304){return function(_0xcd3d48){if(_0xcd3d48){var _0xad4bba=typeof _0x58c304[_0xeb70('0x1b')]===_0xeb70('0x1c')&&typeof _0x58c304[_0xeb70('0x1d')]===_0xeb70('0x1c');var _0x1d525b=_0xcd3d48[_0xeb70('0x1e')];var _0x102ac6=_0xad4bba?0x0:_0x58c304['offset'];var _0x37c934=_0xad4bba?_0xcd3d48[_0xeb70('0x1e')]:_0x58c304[_0xeb70('0x1b')]+_0x58c304['limit'];var _0x2577ac;if(_0x37c934>=_0x1d525b){_0x37c934=_0x1d525b;_0x2577ac=0xc8;}else{_0x2577ac=0xce;}_0x12e262[_0xeb70('0x19')](_0x2577ac);return _0x12e262[_0xeb70('0x1f')](_0xeb70('0x20'),_0x102ac6+'-'+_0x37c934+'/'+_0x1d525b)[_0xeb70('0x1a')](_0xcd3d48);}return null;};}function patchUpdates(_0x68c67f){return function(_0x213252){try{jsonpatch[_0xeb70('0x21')](_0x213252,_0x68c67f,!![]);}catch(_0x327a6a){return BPromise['reject'](_0x327a6a);}return _0x213252['save']();};}function saveUpdates(_0x296b49,_0x14119a){return function(_0x286b57){if(_0x286b57){return _0x286b57[_0xeb70('0x22')](_0x296b49)[_0xeb70('0x23')](function(_0x890e1f){return _0x890e1f;});}return null;};}function removeEntity(_0x40743f,_0x1a4f0c){return function(_0x3deb1f){if(_0x3deb1f){return _0x3deb1f['destroy']()[_0xeb70('0x23')](function(){_0x40743f[_0xeb70('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34a9a0,_0x2c81ab){return function(_0x158196){if(!_0x158196){_0x34a9a0['sendStatus'](0x194);}return _0x158196;};}function handleError(_0x4c69b4,_0x2813a0){_0x2813a0=_0x2813a0||0x1f4;return function(_0x538d43){logger[_0xeb70('0x24')](_0x538d43[_0xeb70('0x25')]);if(_0x538d43[_0xeb70('0x26')]){delete _0x538d43[_0xeb70('0x26')];}_0x4c69b4[_0xeb70('0x19')](_0x2813a0)[_0xeb70('0x27')](_0x538d43);};}exports['index']=function(_0x3eab93,_0x24c07b){var _0x5edf6e={},_0x307aa7={},_0x22ae05={'count':0x0,'rows':[]};var _0x3abe83=_[_0xeb70('0x28')](db[_0xeb70('0x29')][_0xeb70('0x2a')],function(_0xa88baa){return{'name':_0xa88baa['fieldName'],'type':_0xa88baa['type']['key']};});_0x307aa7['model']=_[_0xeb70('0x28')](_0x3abe83,_0xeb70('0x26'));_0x307aa7[_0xeb70('0x2b')]=_[_0xeb70('0x2c')](_0x3eab93[_0xeb70('0x2b')]);_0x307aa7[_0xeb70('0x2d')]=_[_0xeb70('0x2e')](_0x307aa7[_0xeb70('0x2f')],_0x307aa7[_0xeb70('0x2b')]);_0x5edf6e[_0xeb70('0x30')]=_[_0xeb70('0x2e')](_0x307aa7['model'],qs['fields'](_0x3eab93[_0xeb70('0x2b')][_0xeb70('0x31')]));_0x5edf6e[_0xeb70('0x30')]=_0x5edf6e[_0xeb70('0x30')][_0xeb70('0x32')]?_0x5edf6e[_0xeb70('0x30')]:_0x307aa7[_0xeb70('0x2f')];if(!_0x3eab93['query']['hasOwnProperty'](_0xeb70('0x33'))){_0x5edf6e[_0xeb70('0x1d')]=qs[_0xeb70('0x1d')](_0x3eab93[_0xeb70('0x2b')]['limit']);_0x5edf6e[_0xeb70('0x1b')]=qs[_0xeb70('0x1b')](_0x3eab93[_0xeb70('0x2b')]['offset']);}_0x5edf6e['order']=qs[_0xeb70('0x34')](_0x3eab93[_0xeb70('0x2b')][_0xeb70('0x34')]);_0x5edf6e[_0xeb70('0x35')]=qs[_0xeb70('0x2d')](_[_0xeb70('0x36')](_0x3eab93[_0xeb70('0x2b')],_0x307aa7['filters']),_0x3abe83);if(_0x3eab93[_0xeb70('0x2b')][_0xeb70('0x37')]){_0x5edf6e[_0xeb70('0x35')]=_[_0xeb70('0x38')](_0x5edf6e[_0xeb70('0x35')],{'$or':_[_0xeb70('0x28')](_0x3abe83,function(_0x72c856){if(_0x72c856[_0xeb70('0x39')]!==_0xeb70('0x3a')){var _0x23657a={};_0x23657a[_0x72c856[_0xeb70('0x26')]]={'$like':'%'+_0x3eab93[_0xeb70('0x2b')][_0xeb70('0x37')]+'%'};return _0x23657a;}})});}_0x5edf6e=_[_0xeb70('0x38')]({},_0x5edf6e,_0x3eab93[_0xeb70('0x3b')]);var _0x1c318e={'where':_0x5edf6e[_0xeb70('0x35')]};return db[_0xeb70('0x29')][_0xeb70('0x1e')](_0x1c318e)[_0xeb70('0x23')](function(_0x157992){_0x22ae05[_0xeb70('0x1e')]=_0x157992;if(_0x3eab93[_0xeb70('0x2b')]['includeAll']){_0x5edf6e[_0xeb70('0x3c')]=[{'all':!![]}];}return db[_0xeb70('0x29')]['findAll'](_0x5edf6e);})['then'](function(_0xf6a928){_0x22ae05[_0xeb70('0x3d')]=_0xf6a928;return _0x22ae05;})[_0xeb70('0x23')](respondWithFilteredResult(_0x24c07b,_0x5edf6e))[_0xeb70('0x3e')](handleError(_0x24c07b,null));};exports[_0xeb70('0x3f')]=function(_0x559cb0,_0x596ac2){var _0x4094b0={'raw':!![],'where':{'id':_0x559cb0[_0xeb70('0x40')]['id']}},_0x15de9b={};_0x15de9b[_0xeb70('0x2f')]=_[_0xeb70('0x2c')](db[_0xeb70('0x29')]['rawAttributes']);_0x15de9b[_0xeb70('0x2b')]=_[_0xeb70('0x2c')](_0x559cb0[_0xeb70('0x2b')]);_0x15de9b[_0xeb70('0x2d')]=_['intersection'](_0x15de9b[_0xeb70('0x2f')],_0x15de9b[_0xeb70('0x2b')]);_0x4094b0[_0xeb70('0x30')]=_[_0xeb70('0x2e')](_0x15de9b[_0xeb70('0x2f')],qs[_0xeb70('0x31')](_0x559cb0[_0xeb70('0x2b')]['fields']));_0x4094b0[_0xeb70('0x30')]=_0x4094b0['attributes'][_0xeb70('0x32')]?_0x4094b0[_0xeb70('0x30')]:_0x15de9b[_0xeb70('0x2f')];if(_0x559cb0[_0xeb70('0x2b')]['includeAll']){_0x4094b0[_0xeb70('0x3c')]=[{'all':!![]}];}_0x4094b0=_[_0xeb70('0x38')]({},_0x4094b0,_0x559cb0[_0xeb70('0x3b')]);return db[_0xeb70('0x29')][_0xeb70('0x41')](_0x4094b0)['then'](handleEntityNotFound(_0x596ac2,null))[_0xeb70('0x23')](respondWithResult(_0x596ac2,null))[_0xeb70('0x3e')](handleError(_0x596ac2,null));};exports[_0xeb70('0x42')]=function(_0x158500,_0x23283a){return db[_0xeb70('0x29')][_0xeb70('0x42')](_0x158500[_0xeb70('0x43')],{})[_0xeb70('0x23')](respondWithResult(_0x23283a,0xc9))['catch'](handleError(_0x23283a,null));};exports[_0xeb70('0x22')]=function(_0x418a26,_0x2c7b4e){if(_0x418a26[_0xeb70('0x43')]['id']){delete _0x418a26[_0xeb70('0x43')]['id'];}return db['ChatTransferReport'][_0xeb70('0x41')]({'where':{'id':_0x418a26[_0xeb70('0x40')]['id']}})[_0xeb70('0x23')](handleEntityNotFound(_0x2c7b4e,null))[_0xeb70('0x23')](saveUpdates(_0x418a26[_0xeb70('0x43')],null))['then'](respondWithResult(_0x2c7b4e,null))[_0xeb70('0x3e')](handleError(_0x2c7b4e,null));};exports['destroy']=function(_0xa8b10f,_0x4fa856){return db['ChatTransferReport'][_0xeb70('0x41')]({'where':{'id':_0xa8b10f[_0xeb70('0x40')]['id']}})['then'](handleEntityNotFound(_0x4fa856,null))['then'](removeEntity(_0x4fa856,null))['catch'](handleError(_0x4fa856,null));};exports[_0xeb70('0x44')]=function(_0x3d7554,_0x4949b5){return db[_0xeb70('0x29')][_0xeb70('0x44')]()[_0xeb70('0x23')](respondWithResult(_0x4949b5,null))[_0xeb70('0x3e')](handleError(_0x4949b5,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index e4a9819..84de1fb 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 _0xc4ea=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','report_chat_transfer','uniqueid'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc4ea,0x142));var _0xac4e=function(_0x39e74d,_0x54966b){_0x39e74d=_0x39e74d-0x0;var _0x4b5075=_0xc4ea[_0x39e74d];return _0x4b5075;};'use strict';var _=require(_0xac4e('0x0'));var util=require(_0xac4e('0x1'));var logger=require(_0xac4e('0x2'))(_0xac4e('0x3'));var moment=require(_0xac4e('0x4'));var BPromise=require(_0xac4e('0x5'));var rp=require(_0xac4e('0x6'));var fs=require('fs');var path=require(_0xac4e('0x7'));var rimraf=require(_0xac4e('0x8'));var config=require(_0xac4e('0x9'));var attributes=require(_0xac4e('0xa'));module[_0xac4e('0xb')]=function(_0x485fae,_0x2cc28b){return _0x485fae['define']('ChatTransferReport',attributes,{'tableName':_0xac4e('0xc'),'paranoid':![],'indexes':[{'name':_0xac4e('0xd'),'fields':[_0xac4e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x934a=['report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','define'];(function(_0x541fdf,_0x268606){var _0x3f11cf=function(_0x103d78){while(--_0x103d78){_0x541fdf['push'](_0x541fdf['shift']());}};_0x3f11cf(++_0x268606);}(_0x934a,0xfe));var _0xa934=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x934a[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xa934('0x0'));var util=require(_0xa934('0x1'));var logger=require(_0xa934('0x2'))(_0xa934('0x3'));var moment=require('moment');var BPromise=require(_0xa934('0x4'));var rp=require(_0xa934('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa934('0x6'));var config=require(_0xa934('0x7'));var attributes=require(_0xa934('0x8'));module['exports']=function(_0x17157b,_0x8cab85){return _0x17157b[_0xa934('0x9')]('ChatTransferReport',attributes,{'tableName':_0xa934('0xa'),'paranoid':![],'indexes':[{'name':_0xa934('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index e82cded..941f722 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 _0xdafe=['client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise'];(function(_0x25d221,_0xfec86f){var _0x453db5=function(_0x2d721e){while(--_0x2d721e){_0x25d221['push'](_0x25d221['shift']());}};_0x453db5(++_0xfec86f);}(_0xdafe,0x111));var _0xedaf=function(_0x12f16f,_0x23691a){_0x12f16f=_0x12f16f-0x0;var _0x5c1188=_0xdafe[_0x12f16f];return _0x5c1188;};'use strict';var _=require(_0xedaf('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xedaf('0x1'));var rs=require(_0xedaf('0x2'));var fs=require('fs');var Redis=require(_0xedaf('0x3'));var db=require(_0xedaf('0x4'))['db'];var utils=require(_0xedaf('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xedaf('0x6'));var client=jayson[_0xedaf('0x7')][_0xedaf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x216fae,_0x4b5327,_0x78a275){return new BPromise(function(_0xc2772d,_0x2175b3){return client[_0xedaf('0x9')](_0x216fae,_0x78a275)[_0xedaf('0xa')](function(_0xbd11fd){logger[_0xedaf('0xb')](_0xedaf('0xc'),_0x4b5327,_0xedaf('0xd'));logger[_0xedaf('0xe')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x4b5327,'request\x20sent',JSON[_0xedaf('0xf')](_0xbd11fd));if(_0xbd11fd['error']){if(_0xbd11fd[_0xedaf('0x10')][_0xedaf('0x11')]===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x4b5327,_0xbd11fd[_0xedaf('0x10')][_0xedaf('0x12')]);return _0x2175b3(_0xbd11fd[_0xedaf('0x10')][_0xedaf('0x12')]);}logger[_0xedaf('0x10')](_0xedaf('0xc'),_0x4b5327,_0xbd11fd[_0xedaf('0x10')][_0xedaf('0x12')]);return _0xc2772d(_0xbd11fd[_0xedaf('0x10')][_0xedaf('0x12')]);}else{logger['info'](_0xedaf('0xc'),_0x4b5327,_0xedaf('0xd'));_0xc2772d(_0xbd11fd['result']['message']);}})[_0xedaf('0x13')](function(_0x58a1ad){logger[_0xedaf('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x4b5327,_0x58a1ad);_0x2175b3(_0x58a1ad);});});} \ No newline at end of file +var _0xc4ce=['message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3ceb54,_0x5bddfd){var _0x26d8a6=function(_0x32e484){while(--_0x32e484){_0x3ceb54['push'](_0x3ceb54['shift']());}};_0x26d8a6(++_0x5bddfd);}(_0xc4ce,0x1e4));var _0xec4c=function(_0x31add5,_0x2879bb){_0x31add5=_0x31add5-0x0;var _0x23b83c=_0xc4ce[_0x31add5];return _0x23b83c;};'use strict';var _=require(_0xec4c('0x0'));var util=require(_0xec4c('0x1'));var moment=require(_0xec4c('0x2'));var BPromise=require('bluebird');var rs=require(_0xec4c('0x3'));var fs=require('fs');var Redis=require(_0xec4c('0x4'));var db=require(_0xec4c('0x5'))['db'];var utils=require(_0xec4c('0x6'));var logger=require('../../config/logger')(_0xec4c('0x7'));var config=require(_0xec4c('0x8'));var jayson=require(_0xec4c('0x9'));var client=jayson[_0xec4c('0xa')][_0xec4c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x598148,_0x5e64a7,_0x58c6a3){return new BPromise(function(_0x3787c2,_0xd47b81){return client[_0xec4c('0xc')](_0x598148,_0x58c6a3)['then'](function(_0x3c9b92){logger['info'](_0xec4c('0xd'),_0x5e64a7,_0xec4c('0xe'));logger[_0xec4c('0xf')](_0xec4c('0x10'),_0x5e64a7,_0xec4c('0xe'),JSON[_0xec4c('0x11')](_0x3c9b92));if(_0x3c9b92[_0xec4c('0x12')]){if(_0x3c9b92[_0xec4c('0x12')][_0xec4c('0x13')]===0x1f4){logger[_0xec4c('0x12')](_0xec4c('0xd'),_0x5e64a7,_0x3c9b92['error'][_0xec4c('0x14')]);return _0xd47b81(_0x3c9b92[_0xec4c('0x12')][_0xec4c('0x14')]);}logger[_0xec4c('0x12')](_0xec4c('0xd'),_0x5e64a7,_0x3c9b92[_0xec4c('0x12')][_0xec4c('0x14')]);return _0x3787c2(_0x3c9b92[_0xec4c('0x12')][_0xec4c('0x14')]);}else{logger[_0xec4c('0x15')]('ChatTransferReport,\x20%s,\x20%s',_0x5e64a7,'request\x20sent');_0x3787c2(_0x3c9b92[_0xec4c('0x16')][_0xec4c('0x14')]);}})[_0xec4c('0x17')](function(_0x526fd2){logger['error'](_0xec4c('0xd'),_0x5e64a7,_0x526fd2);_0xd47b81(_0x526fd2);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 3200816..a41555a 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 _0x79f0=['./chatTransferReport.controller','/:id','isAuthenticated','post','create','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x24d464,_0xd9decc){var _0x13d881=function(_0x20a09e){while(--_0x20a09e){_0x24d464['push'](_0x24d464['shift']());}};_0x13d881(++_0xd9decc);}(_0x79f0,0x189));var _0x079f=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x79f0[_0x16d10f];return _0x50c823;};'use strict';var multer=require(_0x079f('0x0'));var util=require('util');var path=require(_0x079f('0x1'));var timeout=require('connect-timeout');var express=require(_0x079f('0x2'));var router=express[_0x079f('0x3')]();var fs_extra=require(_0x079f('0x4'));var auth=require(_0x079f('0x5'));var interaction=require(_0x079f('0x6'));var config=require('../../config/environment');var controller=require(_0x079f('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x079f('0x8'),auth[_0x079f('0x9')](),controller['show']);router[_0x079f('0xa')]('/',auth[_0x079f('0x9')](),controller[_0x079f('0xb')]);router['put'](_0x079f('0x8'),auth[_0x079f('0x9')](),controller[_0x079f('0xc')]);router[_0x079f('0xd')]('/:id',auth[_0x079f('0x9')](),controller[_0x079f('0xe')]);module[_0x079f('0xf')]=router; \ No newline at end of file +var _0x2455=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','index','get','/describe','describe','isAuthenticated','show','post','create','/:id','destroy','exports','multer','util','path','connect-timeout'];(function(_0x53ff1b,_0xc2a0fa){var _0x34ef7d=function(_0x56f681){while(--_0x56f681){_0x53ff1b['push'](_0x53ff1b['shift']());}};_0x34ef7d(++_0xc2a0fa);}(_0x2455,0x7a));var _0x5245=function(_0x3ddefb,_0x2641f9){_0x3ddefb=_0x3ddefb-0x0;var _0x206cfc=_0x2455[_0x3ddefb];return _0x206cfc;};'use strict';var multer=require(_0x5245('0x0'));var util=require(_0x5245('0x1'));var path=require(_0x5245('0x2'));var timeout=require(_0x5245('0x3'));var express=require(_0x5245('0x4'));var router=express[_0x5245('0x5')]();var fs_extra=require(_0x5245('0x6'));var auth=require(_0x5245('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5245('0x8'));var controller=require(_0x5245('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x5245('0xa')]);router[_0x5245('0xb')](_0x5245('0xc'),auth['isAuthenticated'](),controller[_0x5245('0xd')]);router[_0x5245('0xb')]('/:id',auth[_0x5245('0xe')](),controller[_0x5245('0xf')]);router[_0x5245('0x10')]('/',auth[_0x5245('0xe')](),controller[_0x5245('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x5245('0x12'),auth[_0x5245('0xe')](),controller[_0x5245('0x13')]);module[_0x5245('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 7b682c4..90615c1 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 _0xbdb7=['address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','Chat','Send','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','star','thumb','stringify','input','name','onlineForm','textarea','Comments','Leave\x20your\x20comments','getDataValue','offlineForm','parse','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:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING'];(function(_0x35c2a9,_0x4e8953){var _0x5ab481=function(_0x16beeb){while(--_0x16beeb){_0x35c2a9['push'](_0x35c2a9['shift']());}};_0x5ab481(++_0x4e8953);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x3bd52b,_0xbbc735){_0x3bd52b=_0x3bd52b-0x0;var _0x1e5b89=_0xbdb7[_0x3bd52b];return _0x1e5b89;};'use strict';var Sequelize=require(_0x7bdb('0x0'));var rs=require(_0x7bdb('0x1'));module[_0x7bdb('0x2')]={'name':{'type':Sequelize[_0x7bdb('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x7bdb('0x3')],'allowNull':![],'unique':_0x7bdb('0x4')},'description':{'type':Sequelize[_0x7bdb('0x3')]},'mapKey':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':_0x7bdb('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x7bdb('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x7bdb('0x6')},'customerAlias':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x7bdb('0x3')],'allowNull':![],'defaultValue':_0x7bdb('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x7bdb('0x3')],'allowNull':![],'defaultValue':_0x7bdb('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x7bdb('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x7bdb('0x3')]},'animation':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x7bdb('0xd')),'defaultValue':'rounded'},'header_online':{'type':Sequelize['STRING'],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':_0x7bdb('0xe')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x7bdb('0xf')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x7bdb('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x7bdb('0x10')]},'closingQuestion':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':_0x7bdb('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':_0x7bdb('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':_0x7bdb('0x13')},'noteTitle':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':_0x7bdb('0x14')},'closingMessage':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':_0x7bdb('0x15')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x7bdb('0xf')},'skipMessageButton':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize['ENUM'](_0x7bdb('0x16'),_0x7bdb('0x17')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x7bdb('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x7bdb('0x10')],'defaultValue':function(){return JSON[_0x7bdb('0x18')]({'items':[{'type':_0x7bdb('0x19'),'variable':null,'config':{'placeholder':_0x7bdb('0x1a'),'type':'text','required':!![]},'props':{'title':_0x7bdb('0x1a'),'helpText':''}},{'type':_0x7bdb('0x19'),'props':{'title':_0x7bdb('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x7bdb('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x7bdb('0x1b'))?JSON['parse'](this['getDataValue']('onlineForm')):{};},'set':function(_0x2abef6){return this['setDataValue'](_0x7bdb('0x1b'),JSON[_0x7bdb('0x18')](_0x2abef6));}},'offlineForm':{'type':Sequelize[_0x7bdb('0x10')],'defaultValue':function(){return JSON[_0x7bdb('0x18')]({'items':[{'type':_0x7bdb('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x7bdb('0x5'),'type':_0x7bdb('0x5')},'variable':null},{'type':_0x7bdb('0x1c'),'config':{'placeholder':_0x7bdb('0x1d')},'props':{'title':_0x7bdb('0x1d'),'helpText':_0x7bdb('0x1e')}}],'fromKey':0x0});},'get':function(){return this[_0x7bdb('0x1f')](_0x7bdb('0x20'))?JSON[_0x7bdb('0x21')](this[_0x7bdb('0x1f')](_0x7bdb('0x20'))):{};},'set':function(_0x81ca6f){return this['setDataValue'](_0x7bdb('0x20'),JSON[_0x7bdb('0x18')](_0x81ca6f));}},'token':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':function(){return rs[_0x7bdb('0x22')]();}},'autoclose':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x7bdb('0x3')]},'forwardOffline':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x7bdb('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x7bdb('0x23')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x7bdb('0x24')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x7bdb('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x7bdb('0xf')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x7bdb('0x3')]},'notificationTemplate':{'type':Sequelize[_0x7bdb('0x10')],'defaultValue':function(){return _0x7bdb('0x26');}},'notificationSound':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x7bdb('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x7bdb('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':_0x7bdb('0x28')},'verticalAlignment':{'type':Sequelize[_0x7bdb('0x9')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':_0x7bdb('0x29')},'messagesAlignment':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':_0x7bdb('0x2a')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x7bdb('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x7bdb('0x3')],'allowNull':![],'defaultValue':_0x7bdb('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7bdb('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x7bdb('0x2c')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7bdb('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x7bdb('0x2d'),'set':function(_0x2d578e){if(!_0x2d578e)this[_0x7bdb('0x2e')](_0x7bdb('0x2f'),null);this[_0x7bdb('0x2e')](_0x7bdb('0x30'),_0x2d578e);}},'vidaooEscalation':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7bdb('0x31')},'vidaooNote':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':function(){return _0x7bdb('0x32');}},'vidaooMetadata':{'type':Sequelize[_0x7bdb('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x7bdb('0x10')]}}; \ No newline at end of file +var _0x3c81=['bottom_right','alternate','#fafafa','System','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','email','Agent','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','name','text','input','parse','getDataValue','setDataValue','onlineForm','textarea','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','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'];(function(_0x3f417c,_0x123722){var _0x45d920=function(_0x1ce62f){while(--_0x1ce62f){_0x3f417c['push'](_0x3f417c['shift']());}};_0x45d920(++_0x123722);}(_0x3c81,0x102));var _0x13c8=function(_0x3ab056,_0x2c63d5){_0x3ab056=_0x3ab056-0x0;var _0x465cff=_0x3c81[_0x3ab056];return _0x465cff;};'use strict';var Sequelize=require(_0x13c8('0x0'));var rs=require(_0x13c8('0x1'));module['exports']={'name':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x3')},'key':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x4')},'customerAlias':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![],'defaultValue':_0x13c8('0x5'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![],'defaultValue':_0x13c8('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x13c8('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x13c8('0x2')]},'animation':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x13c8('0x8')](_0x13c8('0x9'),_0x13c8('0xa')),'defaultValue':_0x13c8('0x9')},'header_online':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0xb')},'start_chat_button':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0xc')},'header_offline':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x13c8('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x13c8('0xe')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x13c8('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x11')},'placeholderMessage':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x12')},'closingMessage':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x13')},'closingMessageButton':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0xc')},'skipMessageButton':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x14')},'conditionAgreement':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x15')},'ratingType':{'type':Sequelize['ENUM'](_0x13c8('0x16'),_0x13c8('0x17')),'defaultValue':_0x13c8('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x13c8('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x13c8('0xe')],'defaultValue':function(){return JSON[_0x13c8('0x18')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x13c8('0x19'),'type':_0x13c8('0x1a'),'required':!![]},'props':{'title':_0x13c8('0x19'),'helpText':''}},{'type':_0x13c8('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x13c8('0x3'),'type':_0x13c8('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON[_0x13c8('0x1c')](this[_0x13c8('0x1d')]('onlineForm')):{};},'set':function(_0x5ad0dc){return this[_0x13c8('0x1e')](_0x13c8('0x1f'),JSON['stringify'](_0x5ad0dc));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x13c8('0x18')]({'items':[{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x13c8('0x3'),'type':_0x13c8('0x3')},'variable':null},{'type':_0x13c8('0x20'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0x13c8('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x13c8('0x1d')](_0x13c8('0x22'))?JSON[_0x13c8('0x1c')](this[_0x13c8('0x1d')](_0x13c8('0x22'))):{};},'set':function(_0x343080){return this['setDataValue'](_0x13c8('0x22'),JSON[_0x13c8('0x18')](_0x343080));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x13c8('0x2')]},'forwardOffline':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x23')},'waitingMessage':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x24')},'offlineMessageSubject':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x25')},'offlineMessageBody':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x26')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x13c8('0x27')},'skipUnmanaged':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x13c8('0xe')]},'showAgentAvatar':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x13c8('0x2')]},'notificationTemplate':{'type':Sequelize[_0x13c8('0xe')],'defaultValue':function(){return _0x13c8('0x28');}},'notificationSound':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x29')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x2a')},'verticalAlignment':{'type':Sequelize[_0x13c8('0x6')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x13c8('0x2b')},'defaultTitle':{'type':Sequelize[_0x13c8('0x2')]},'customerAvatar':{'type':Sequelize[_0x13c8('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x13c8('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![],'defaultValue':_0x13c8('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x13c8('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[_0x13c8('0x2')],'defaultValue':_0x13c8('0x2d')},'systemAvatar':{'type':Sequelize[_0x13c8('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x13c8('0x6')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x343dba){if(!_0x343dba)this[_0x13c8('0x1e')](_0x13c8('0x2e'),null);this[_0x13c8('0x1e')](_0x13c8('0x2f'),_0x343dba);}},'vidaooEscalation':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x13c8('0x2')]},'vidaooTopic':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![],'defaultValue':_0x13c8('0x30')},'vidaooNote':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':function(){return _0x13c8('0x31');}},'vidaooMetadata':{'type':Sequelize[_0x13c8('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x13c8('0xe')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index e98efbc..83b4a57 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 _0xad6a=['Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','inspect','No\x20timezone','Interval','getProactiveActions','../../config/license/util','getLicense','virtual','custom','License','increment','chatLicenseExceeded','Intervals','push','all','some','readFileSync','address','remote','stringify','x-real-ip','connection','replace','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','stack','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachments','addAgents','emit','userChatWebsite:save','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','querystring','ioredis','../../config/logger','../../config/environment','url','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','jayson/promise','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','limit','count','offset','set','json','then','destroy','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','ChatWebsite','includeAll','include','findAll','rows','length','body','user','get','role','ChatWebsites','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','describe','addDisposition','ChatWebsiteId','findOne','Disposition','nolimit','order','options','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','isNil','existsSync','root','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','headers','user-agent','getResult','chat','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','account','applications','Applications','list','orderBy','priority','ListId','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','contact','messageId','created','autoclose','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','User','UserId','agent','forcedOwnership','Start','startRouting','EventManager','offline','files','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline','MailAccount','findOrCreate','utf8','render','toPairs','offlineMessageBody','fromString','originalname','mimetype','server','attachments','basename','openNewInteraction','transaction','Attachment','bulkCreate','CloudProvider','forwardOffline','forwardOfflineAddress','SendMail','sendMail','MailAccountId','subjectOffline','toPairsIn','mapValues','email','offlineMessageSubject','Chat','NotifyMailAccount','addInteraction','omit','getInteractions','Contact','Owner','internal','Tags','color','tag'];(function(_0x439557,_0x9dd976){var _0xd7641=function(_0x28c58b){while(--_0x28c58b){_0x439557['push'](_0x439557['shift']());}};_0xd7641(++_0x9dd976);}(_0xad6a,0x165));var _0xaad6=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xad6a[_0x13b8f3];return _0x1a6d06;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0xaad6('0x0'));var util=require(_0xaad6('0x1'));var path=require(_0xaad6('0x2'));var ejs=require(_0xaad6('0x3'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var querystring=require(_0xaad6('0x4'));var Redis=require(_0xaad6('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0xaad6('0x6'))('api');var config=require(_0xaad6('0x7'));var url=require(_0xaad6('0x8'));var db=require(_0xaad6('0x9'))['db'];config[_0xaad6('0xa')]=_[_0xaad6('0xb')](config[_0xaad6('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xaad6('0xc'))(new Redis(config[_0xaad6('0xa')]));require(_0xaad6('0xd'))['register'](socket);var htmlToText=require('html-to-text');var jayson=require(_0xaad6('0xe'));var client=jayson[_0xaad6('0xf')][_0xaad6('0x10')]({'port':0x232c});var client9002=jayson['client'][_0xaad6('0x10')]({'port':0x232a});var client9003=jayson[_0xaad6('0xf')][_0xaad6('0x10')]({'port':0x232b});var client9001=jayson[_0xaad6('0xf')][_0xaad6('0x10')]({'port':0x2329});function respondWithRpcPromise(_0x28531c,_0x3d287f,_0x291cab,_0x1516e2){return new BPromise(function(_0x198384,_0xf9c737){var _0x314825=_0x1516e2||client;return _0x314825[_0xaad6('0x11')](_0x28531c,_0x291cab)['then'](function(_0x1fd484){logger[_0xaad6('0x12')](_0xaad6('0x13'),_0x3d287f,_0xaad6('0x14'));logger[_0xaad6('0x15')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x3d287f,_0xaad6('0x14'),JSON['stringify'](_0x1fd484));if(_0x1fd484[_0xaad6('0x16')]){if(_0x1fd484[_0xaad6('0x16')][_0xaad6('0x17')]===0x1f4){logger[_0xaad6('0x16')](_0xaad6('0x13'),_0x3d287f,_0x1fd484[_0xaad6('0x16')][_0xaad6('0x18')]);return _0xf9c737(_0x1fd484[_0xaad6('0x16')][_0xaad6('0x18')]);}logger[_0xaad6('0x16')](_0xaad6('0x13'),_0x3d287f,_0x1fd484['error'][_0xaad6('0x18')]);return _0x198384(_0x1fd484[_0xaad6('0x16')][_0xaad6('0x18')]);}else{logger['info'](_0xaad6('0x13'),_0x3d287f,_0xaad6('0x14'));_0x198384(_0x1fd484[_0xaad6('0x19')][_0xaad6('0x18')]);}})[_0xaad6('0x1a')](function(_0x3448e6){logger[_0xaad6('0x16')](_0xaad6('0x13'),_0x3d287f,_0x3448e6);_0xf9c737(_0x3448e6);});});}function respondWithStatusCode(_0x3dab92,_0x3d8034){_0x3d8034=_0x3d8034||0xcc;return function(_0x568b47){if(_0x568b47){return _0x3dab92[_0xaad6('0x1b')](_0x3d8034);}return _0x3dab92[_0xaad6('0x1c')](_0x3d8034)[_0xaad6('0x1d')]();};}function respondWithResult(_0x214d7e,_0x283831){_0x283831=_0x283831||0xc8;return function(_0x235ef7){if(_0x235ef7){return _0x214d7e[_0xaad6('0x1c')](_0x283831)['json'](_0x235ef7);}};}function respondWithFilteredResult(_0x522b8a,_0x2c2139){return function(_0x7cb3de){if(_0x7cb3de){var _0x5c9d58=typeof _0x2c2139['offset']==='undefined'&&typeof _0x2c2139[_0xaad6('0x1e')]==='undefined';var _0xce10b6=_0x7cb3de[_0xaad6('0x1f')];var _0x39089f=_0x5c9d58?0x0:_0x2c2139['offset'];var _0x681eb=_0x5c9d58?_0x7cb3de[_0xaad6('0x1f')]:_0x2c2139[_0xaad6('0x20')]+_0x2c2139[_0xaad6('0x1e')];var _0x34d6a3;if(_0x681eb>=_0xce10b6){_0x681eb=_0xce10b6;_0x34d6a3=0xc8;}else{_0x34d6a3=0xce;}_0x522b8a[_0xaad6('0x1c')](_0x34d6a3);return _0x522b8a[_0xaad6('0x21')]('Content-Range',_0x39089f+'-'+_0x681eb+'/'+_0xce10b6)[_0xaad6('0x22')](_0x7cb3de);}return null;};}function saveUpdates(_0x425fca){return function(_0x16a437){if(_0x16a437){return _0x16a437['update'](_0x425fca)[_0xaad6('0x23')](function(_0x38de72){return _0x38de72;});}return null;};}function removeEntity(_0x25e858){return function(_0x3c17b8){if(_0x3c17b8){return _0x3c17b8[_0xaad6('0x24')]()[_0xaad6('0x23')](function(){var _0x3a8dfa=_0x3c17b8['get']({'plain':!![]});var _0x23c801='ChatWebsites';return db[_0xaad6('0x25')][_0xaad6('0x24')]({'where':{'type':_0x23c801,'resourceId':_0x3a8dfa['id']}})[_0xaad6('0x23')](function(){return _0x3c17b8;});})[_0xaad6('0x23')](function(){_0x25e858[_0xaad6('0x1c')](0xcc)[_0xaad6('0x1d')]();});}};}function handleEntityNotFound(_0x4bea15){return function(_0x126fe8){if(!_0x126fe8){_0x4bea15[_0xaad6('0x1b')](0x194);}return _0x126fe8;};}function handleError(_0x3b32c1,_0x12d93a){_0x12d93a=_0x12d93a||0x1f4;return function(_0x1df3a3){logger['error'](_0x1df3a3['stack']);if(_0x1df3a3[_0xaad6('0x26')]){delete _0x1df3a3['name'];}_0x3b32c1[_0xaad6('0x1c')](_0x12d93a)[_0xaad6('0x27')](_0x1df3a3);};}exports[_0xaad6('0x28')]=function(_0x15a8cd,_0x393c14){var _0x311da0={'include':[{'model':db[_0xaad6('0x29')],'as':_0xaad6('0x2a')}]},_0x3a96aa={},_0x4b6ce7={'count':0x0,'rows':[]};var _0x2efa4d=_[_0xaad6('0x2b')](db['ChatWebsite'][_0xaad6('0x2c')],function(_0x2651b5){return{'name':_0x2651b5['fieldName'],'type':_0x2651b5[_0xaad6('0x2d')]['key']};});_0x3a96aa['model']=_[_0xaad6('0x2b')](_0x2efa4d,_0xaad6('0x26'));_0x3a96aa['query']=_[_0xaad6('0x2e')](_0x15a8cd[_0xaad6('0x2f')]);_0x3a96aa[_0xaad6('0x30')]=_[_0xaad6('0x31')](_0x3a96aa[_0xaad6('0x32')],_0x3a96aa[_0xaad6('0x2f')]);_0x311da0[_0xaad6('0x33')]=_[_0xaad6('0x31')](_0x3a96aa[_0xaad6('0x32')],qs[_0xaad6('0x34')](_0x15a8cd[_0xaad6('0x2f')][_0xaad6('0x34')]));_0x311da0[_0xaad6('0x33')]=_0x311da0['attributes']['length']?_0x311da0[_0xaad6('0x33')]:_0x3a96aa[_0xaad6('0x32')];if(!_0x15a8cd[_0xaad6('0x2f')][_0xaad6('0x35')]('nolimit')){_0x311da0[_0xaad6('0x1e')]=qs[_0xaad6('0x1e')](_0x15a8cd[_0xaad6('0x2f')][_0xaad6('0x1e')]);_0x311da0[_0xaad6('0x20')]=qs[_0xaad6('0x20')](_0x15a8cd['query'][_0xaad6('0x20')]);}_0x311da0['order']=qs['sort'](_0x15a8cd[_0xaad6('0x2f')][_0xaad6('0x36')]);_0x311da0[_0xaad6('0x37')]=qs['filters'](_[_0xaad6('0x38')](_0x15a8cd[_0xaad6('0x2f')],_0x3a96aa[_0xaad6('0x30')]),_0x2efa4d);if(_0x15a8cd[_0xaad6('0x2f')][_0xaad6('0x39')]){_0x311da0['where']=_['merge'](_0x311da0[_0xaad6('0x37')],{'$or':_[_0xaad6('0x2b')](_0x2efa4d,function(_0xb678cf){if(_0xb678cf[_0xaad6('0x2d')]!==_0xaad6('0x3a')){var _0x3b8f83={};_0x3b8f83[_0xb678cf[_0xaad6('0x26')]]={'$like':'%'+_0x15a8cd[_0xaad6('0x2f')][_0xaad6('0x39')]+'%'};return _0x3b8f83;}})});}_0x311da0=_[_0xaad6('0x3b')]({},_0x311da0,_0x15a8cd['options']);var _0x14d4d8={'where':_0x311da0[_0xaad6('0x37')]};return db[_0xaad6('0x3c')][_0xaad6('0x1f')](_0x14d4d8)[_0xaad6('0x23')](function(_0x3437dd){_0x4b6ce7[_0xaad6('0x1f')]=_0x3437dd;if(_0x15a8cd[_0xaad6('0x2f')][_0xaad6('0x3d')]){_0x311da0[_0xaad6('0x3e')]=[{'all':!![]}];}return db[_0xaad6('0x3c')][_0xaad6('0x3f')](_0x311da0);})['then'](function(_0x4a8fcb){_0x4b6ce7[_0xaad6('0x40')]=_0x4a8fcb;return _0x4b6ce7;})[_0xaad6('0x23')](respondWithFilteredResult(_0x393c14,_0x311da0))[_0xaad6('0x1a')](handleError(_0x393c14,null));};exports['show']=function(_0x3fd898,_0x266066){var _0x5a2e46={'raw':![],'where':{'id':_0x3fd898['params']['id']},'include':[{'model':db[_0xaad6('0x29')],'as':'mandatoryDispositionPause'}]},_0x223f49={};_0x223f49['model']=_[_0xaad6('0x2e')](db[_0xaad6('0x3c')][_0xaad6('0x2c')]);_0x223f49['query']=_['keys'](_0x3fd898[_0xaad6('0x2f')]);_0x223f49['filters']=_['intersection'](_0x223f49[_0xaad6('0x32')],_0x223f49['query']);_0x5a2e46[_0xaad6('0x33')]=_[_0xaad6('0x31')](_0x223f49[_0xaad6('0x32')],qs['fields'](_0x3fd898[_0xaad6('0x2f')][_0xaad6('0x34')]));_0x5a2e46[_0xaad6('0x33')]=_0x5a2e46[_0xaad6('0x33')][_0xaad6('0x41')]?_0x5a2e46[_0xaad6('0x33')]:_0x223f49[_0xaad6('0x32')];if(_0x3fd898[_0xaad6('0x2f')][_0xaad6('0x3d')]){_0x5a2e46[_0xaad6('0x3e')]=[{'all':!![]}];}_0x5a2e46=_[_0xaad6('0x3b')]({},_0x5a2e46,_0x3fd898['options']);return db[_0xaad6('0x3c')]['find'](_0x5a2e46)[_0xaad6('0x23')](handleEntityNotFound(_0x266066,null))[_0xaad6('0x23')](respondWithResult(_0x266066,null))[_0xaad6('0x1a')](handleError(_0x266066,null));};exports['create']=function(_0x4ae38c,_0x5eff00){return db['ChatWebsite']['create'](_0x4ae38c[_0xaad6('0x42')],{})[_0xaad6('0x23')](function(_0x174e11){var _0x13f811=_0x4ae38c[_0xaad6('0x43')][_0xaad6('0x44')]({'plain':!![]});if(!_0x13f811)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x13f811[_0xaad6('0x45')]==='user'){var _0x437d33=_0x174e11[_0xaad6('0x44')]({'plain':!![]});var _0x3f6964=_0xaad6('0x46');return db[_0xaad6('0x47')]['find']({'where':{'name':_0x3f6964,'userProfileId':_0x13f811[_0xaad6('0x48')]},'raw':!![]})['then'](function(_0x3c2c55){if(_0x3c2c55&&_0x3c2c55['autoAssociation']===0x0){return db['UserProfileResource'][_0xaad6('0x49')]({'name':_0x437d33[_0xaad6('0x26')],'resourceId':_0x437d33['id'],'type':_0x3c2c55['name'],'sectionId':_0x3c2c55['id']},{})[_0xaad6('0x23')](function(){return _0x174e11;});}else{return _0x174e11;}})[_0xaad6('0x1a')](function(_0x368c2a){logger['error'](_0xaad6('0x4a'),_0x368c2a);throw _0x368c2a;});}return _0x174e11;})[_0xaad6('0x23')](respondWithResult(_0x5eff00,0xc9))[_0xaad6('0x1a')](handleError(_0x5eff00,null));};exports[_0xaad6('0x4b')]=function(_0x49275c,_0xc0a40f){if(_0x49275c['body']['id']){delete _0x49275c['body']['id'];}return db[_0xaad6('0x3c')][_0xaad6('0x4c')]({'where':{'id':_0x49275c[_0xaad6('0x4d')]['id']},'include':[{'model':db[_0xaad6('0x29')],'as':_0xaad6('0x2a')}]})['then'](handleEntityNotFound(_0xc0a40f,null))[_0xaad6('0x23')](saveUpdates(_0x49275c[_0xaad6('0x42')],null))[_0xaad6('0x23')](respondWithResult(_0xc0a40f,null))[_0xaad6('0x1a')](handleError(_0xc0a40f,null));};exports[_0xaad6('0x24')]=function(_0x432da9,_0x5e1b7a){return db[_0xaad6('0x3c')]['find']({'where':{'id':_0x432da9['params']['id']}})[_0xaad6('0x23')](handleEntityNotFound(_0x5e1b7a,null))[_0xaad6('0x23')](removeEntity(_0x5e1b7a,null))[_0xaad6('0x1a')](handleError(_0x5e1b7a,null));};exports[_0xaad6('0x4e')]=function(_0x3ad917,_0x3677ae){return db[_0xaad6('0x3c')][_0xaad6('0x4e')]()[_0xaad6('0x23')](respondWithResult(_0x3677ae,null))[_0xaad6('0x1a')](handleError(_0x3677ae,null));};exports[_0xaad6('0x4f')]=function(_0x44258c,_0x487beb){if(_0x44258c[_0xaad6('0x42')]['id']){delete _0x44258c[_0xaad6('0x42')]['id'];}return db['ChatWebsite'][_0xaad6('0x4c')]({'where':{'id':_0x44258c[_0xaad6('0x4d')]['id']}})[_0xaad6('0x23')](handleEntityNotFound(_0x487beb,null))['then'](function(_0x48f624){if(_0x48f624){_0x44258c['body'][_0xaad6('0x50')]=_0x48f624['id'];return db['Disposition'][_0xaad6('0x49')](_0x44258c[_0xaad6('0x42')]);}})[_0xaad6('0x23')](respondWithResult(_0x487beb,null))[_0xaad6('0x1a')](handleError(_0x487beb,null));};exports['getDispositions']=function(_0x38a976,_0x3bd5ee){var _0x271595={'raw':![],'where':{}};var _0x54bc52={};var _0x4a5468={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xaad6('0x51')]({'where':{'id':_0x38a976[_0xaad6('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3bd5ee,null))[_0xaad6('0x23')](function(_0x4cb651){if(_0x4cb651){_0x54bc52[_0xaad6('0x32')]=_[_0xaad6('0x2e')](db[_0xaad6('0x52')][_0xaad6('0x2c')]);_0x54bc52['query']=_[_0xaad6('0x2e')](_0x38a976[_0xaad6('0x2f')]);_0x54bc52[_0xaad6('0x30')]=_[_0xaad6('0x31')](_0x54bc52[_0xaad6('0x32')],_0x54bc52['query']);_0x271595[_0xaad6('0x33')]=_[_0xaad6('0x31')](_0x54bc52[_0xaad6('0x32')],qs[_0xaad6('0x34')](_0x38a976['query'][_0xaad6('0x34')]));_0x271595['attributes']=_0x271595[_0xaad6('0x33')][_0xaad6('0x41')]?_0x271595[_0xaad6('0x33')]:_0x54bc52['model'];if(!_0x38a976[_0xaad6('0x2f')]['hasOwnProperty'](_0xaad6('0x53'))){_0x271595[_0xaad6('0x1e')]=qs[_0xaad6('0x1e')](_0x38a976[_0xaad6('0x2f')][_0xaad6('0x1e')]);_0x271595[_0xaad6('0x20')]=qs['offset'](_0x38a976[_0xaad6('0x2f')]['offset']);}_0x271595[_0xaad6('0x54')]=qs[_0xaad6('0x36')](_0x38a976[_0xaad6('0x2f')][_0xaad6('0x36')]);_0x271595['where']=qs['filters'](_[_0xaad6('0x38')](_0x38a976[_0xaad6('0x2f')],_0x54bc52[_0xaad6('0x30')]));_0x271595[_0xaad6('0x37')]['ChatWebsiteId']=_0x4cb651['id'];if(_0x38a976['query'][_0xaad6('0x39')]){_0x271595[_0xaad6('0x37')]=_['merge'](_0x271595[_0xaad6('0x37')],{'$or':_[_0xaad6('0x2b')](_0x271595['attributes'],function(_0x34701f){var _0x4d0722={};_0x4d0722[_0x34701f]={'$like':'%'+_0x38a976[_0xaad6('0x2f')][_0xaad6('0x39')]+'%'};return _0x4d0722;})});}_0x271595=_[_0xaad6('0x3b')]({},_0x271595,_0x38a976[_0xaad6('0x55')]);return db[_0xaad6('0x52')][_0xaad6('0x1f')]({'where':_0x271595[_0xaad6('0x37')]})['then'](function(_0x4d9f9e){_0x4a5468['count']=_0x4d9f9e;if(_0x38a976[_0xaad6('0x2f')]['includeAll']){_0x271595[_0xaad6('0x3e')]=[{'all':!![]}];}return db[_0xaad6('0x52')][_0xaad6('0x3f')](_0x271595);})[_0xaad6('0x23')](function(_0x47948c){_0x4a5468[_0xaad6('0x40')]=_0x47948c;return _0x4a5468;});}})[_0xaad6('0x23')](respondWithFilteredResult(_0x3bd5ee,_0x271595))[_0xaad6('0x1a')](handleError(_0x3bd5ee,null));};exports[_0xaad6('0x56')]=function(_0x23d844,_0x1a6bf2){return db[_0xaad6('0x3c')]['find']({'where':{'id':_0x23d844['params']['id']}})['then'](handleEntityNotFound(_0x1a6bf2,null))[_0xaad6('0x23')](function(_0x32d1a5){if(_0x32d1a5){return _0x32d1a5['removeDispositions'](_0x23d844[_0xaad6('0x2f')][_0xaad6('0x57')]);}})['then'](respondWithStatusCode(_0x1a6bf2,null))['catch'](handleError(_0x1a6bf2,null));};exports[_0xaad6('0x58')]=function(_0x585d84,_0x22ea29){if(_0x585d84[_0xaad6('0x42')]['id']){delete _0x585d84[_0xaad6('0x42')]['id'];}return db[_0xaad6('0x3c')][_0xaad6('0x4c')]({'where':{'id':_0x585d84[_0xaad6('0x4d')]['id']}})[_0xaad6('0x23')](handleEntityNotFound(_0x22ea29,null))[_0xaad6('0x23')](function(_0x41382c){if(_0x41382c){_0x585d84[_0xaad6('0x42')]['ChatWebsiteId']=_0x41382c['id'];return db[_0xaad6('0x59')]['create'](_0x585d84[_0xaad6('0x42')]);}})[_0xaad6('0x23')](respondWithResult(_0x22ea29,null))['catch'](handleError(_0x22ea29,null));};exports[_0xaad6('0x5a')]=function(_0x855046,_0x2d41a3){var _0x4b9e3d={'raw':![],'where':{}};var _0x31437f={};var _0x44e8c5={'count':0x0,'rows':[]};return db[_0xaad6('0x3c')]['findOne']({'where':{'id':_0x855046[_0xaad6('0x4d')]['id']}})[_0xaad6('0x23')](handleEntityNotFound(_0x2d41a3,null))[_0xaad6('0x23')](function(_0x491f60){if(_0x491f60){_0x31437f[_0xaad6('0x32')]=_[_0xaad6('0x2e')](db[_0xaad6('0x59')]['rawAttributes']);_0x31437f[_0xaad6('0x2f')]=_[_0xaad6('0x2e')](_0x855046['query']);_0x31437f[_0xaad6('0x30')]=_['intersection'](_0x31437f[_0xaad6('0x32')],_0x31437f[_0xaad6('0x2f')]);_0x4b9e3d[_0xaad6('0x33')]=_[_0xaad6('0x31')](_0x31437f[_0xaad6('0x32')],qs[_0xaad6('0x34')](_0x855046[_0xaad6('0x2f')][_0xaad6('0x34')]));_0x4b9e3d[_0xaad6('0x33')]=_0x4b9e3d[_0xaad6('0x33')][_0xaad6('0x41')]?_0x4b9e3d[_0xaad6('0x33')]:_0x31437f[_0xaad6('0x32')];if(!_0x855046[_0xaad6('0x2f')][_0xaad6('0x35')](_0xaad6('0x53'))){_0x4b9e3d[_0xaad6('0x1e')]=qs['limit'](_0x855046['query'][_0xaad6('0x1e')]);_0x4b9e3d[_0xaad6('0x20')]=qs[_0xaad6('0x20')](_0x855046[_0xaad6('0x2f')]['offset']);}_0x4b9e3d['order']=qs[_0xaad6('0x36')](_0x855046[_0xaad6('0x2f')]['sort']);_0x4b9e3d['where']=qs[_0xaad6('0x30')](_[_0xaad6('0x38')](_0x855046[_0xaad6('0x2f')],_0x31437f[_0xaad6('0x30')]));_0x4b9e3d[_0xaad6('0x37')][_0xaad6('0x50')]=_0x491f60['id'];if(_0x855046[_0xaad6('0x2f')][_0xaad6('0x39')]){_0x4b9e3d['where']=_['merge'](_0x4b9e3d[_0xaad6('0x37')],{'$or':_[_0xaad6('0x2b')](_0x4b9e3d[_0xaad6('0x33')],function(_0x2df595){var _0x626870={};_0x626870[_0x2df595]={'$like':'%'+_0x855046[_0xaad6('0x2f')][_0xaad6('0x39')]+'%'};return _0x626870;})});}_0x4b9e3d=_[_0xaad6('0x3b')]({},_0x4b9e3d,_0x855046[_0xaad6('0x55')]);return db[_0xaad6('0x59')][_0xaad6('0x1f')]({'where':_0x4b9e3d['where']})[_0xaad6('0x23')](function(_0x15a0d5){_0x44e8c5[_0xaad6('0x1f')]=_0x15a0d5;if(_0x855046['query'][_0xaad6('0x3d')]){_0x4b9e3d[_0xaad6('0x3e')]=[{'all':!![]}];}return db[_0xaad6('0x59')]['findAll'](_0x4b9e3d);})[_0xaad6('0x23')](function(_0x15649c){_0x44e8c5['rows']=_0x15649c;return _0x44e8c5;});}})[_0xaad6('0x23')](respondWithFilteredResult(_0x2d41a3,_0x4b9e3d))[_0xaad6('0x1a')](handleError(_0x2d41a3,null));};exports[_0xaad6('0x5b')]=function(_0x3b42aa,_0x11ea71){return db[_0xaad6('0x3c')][_0xaad6('0x4c')]({'where':{'id':_0x3b42aa[_0xaad6('0x4d')]['id']}})[_0xaad6('0x23')](handleEntityNotFound(_0x11ea71,null))[_0xaad6('0x23')](function(_0xbe015){if(_0xbe015){return _0xbe015['removeAnswers'](_0x3b42aa[_0xaad6('0x2f')][_0xaad6('0x57')]);}})['then'](respondWithStatusCode(_0x11ea71,null))[_0xaad6('0x1a')](handleError(_0x11ea71,null));};exports[_0xaad6('0x5c')]=function(_0x3d6496,_0x1e71eb){_0x3d6496[_0xaad6('0x42')][_0xaad6('0x5d')]=_0x3d6496[_0xaad6('0x5e')][_0xaad6('0x5f')];return db[_0xaad6('0x3c')]['find']({'where':{'id':_0x3d6496[_0xaad6('0x4d')]['id']}})[_0xaad6('0x23')](handleEntityNotFound(_0x1e71eb,null))['then'](saveUpdates(_0x3d6496['body'],null))[_0xaad6('0x23')](respondWithResult(_0x1e71eb,null))['catch'](handleError(_0x1e71eb,null));};exports[_0xaad6('0x60')]=function(_0x165ca9,_0x4e64f0){_0x165ca9[_0xaad6('0x42')][_0xaad6('0x61')]=_0x165ca9['file']['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x165ca9[_0xaad6('0x4d')]['id']}})[_0xaad6('0x23')](handleEntityNotFound(_0x4e64f0,null))['then'](saveUpdates(_0x165ca9[_0xaad6('0x42')],null))[_0xaad6('0x23')](respondWithResult(_0x4e64f0,null))[_0xaad6('0x1a')](handleError(_0x4e64f0,null));};exports[_0xaad6('0x62')]=function(_0x46e27e,_0x31e675){_0x46e27e[_0xaad6('0x42')][_0xaad6('0x63')]=_0x46e27e[_0xaad6('0x5e')][_0xaad6('0x5f')];return db[_0xaad6('0x3c')][_0xaad6('0x4c')]({'where':{'id':_0x46e27e[_0xaad6('0x4d')]['id']}})[_0xaad6('0x23')](handleEntityNotFound(_0x31e675,null))['then'](saveUpdates(_0x46e27e[_0xaad6('0x42')],null))[_0xaad6('0x23')](respondWithResult(_0x31e675,null))[_0xaad6('0x1a')](handleError(_0x31e675,null));};exports[_0xaad6('0x64')]=function(_0x338b6e,_0x33e154){_0x338b6e[_0xaad6('0x42')][_0xaad6('0x65')]=_0x338b6e[_0xaad6('0x5e')]['filename'];return db[_0xaad6('0x3c')][_0xaad6('0x4c')]({'where':{'id':_0x338b6e[_0xaad6('0x4d')]['id']}})['then'](handleEntityNotFound(_0x33e154,null))[_0xaad6('0x23')](saveUpdates(_0x338b6e[_0xaad6('0x42')],null))['then'](respondWithResult(_0x33e154,null))[_0xaad6('0x1a')](handleError(_0x33e154,null));};exports[_0xaad6('0x66')]=function(_0x52b81a,_0x1d806d){var _0x463cab=path[_0xaad6('0x67')](config['root'],_0xaad6('0x68'));var _0x238c0f={'where':{'id':_0x52b81a['params']['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x2227f1=![];return require('../../config/license/util')['getLicense']()[_0xaad6('0x23')](function(_0x33716c){if(_0x33716c){_0x2227f1=_0x33716c['custom'];}})[_0xaad6('0x23')](function(){return db[_0xaad6('0x3c')][_0xaad6('0x4c')](_0x238c0f);})[_0xaad6('0x23')](handleEntityNotFound(_0x1d806d,null))[_0xaad6('0x23')](function(_0x69fff0){if(_0x69fff0){if(!_[_0xaad6('0x69')](_0x69fff0[_0xaad6('0x5d')])){if(fs[_0xaad6('0x6a')](path[_0xaad6('0x67')](config[_0xaad6('0x6b')],_0xaad6('0x6c'),_0x69fff0[_0xaad6('0x5d')]))&&_0x2227f1){_0x463cab=path[_0xaad6('0x67')](config[_0xaad6('0x6b')],_0xaad6('0x6c'),_0x69fff0['sitepic']);}}return _0x1d806d[_0xaad6('0x6d')](_0x463cab);}})[_0xaad6('0x1a')](handleError(_0x1d806d,null));};exports['getAvatar']=function(_0x3db1d2,_0x4b53ee){var _0xbd8691=path['join'](config[_0xaad6('0x6b')],_0xaad6('0x6e'));var _0x1c7125={'where':{'id':_0x3db1d2['params']['id']},'attributes':['id',_0xaad6('0x61')],'raw':!![]};return db[_0xaad6('0x3c')]['find'](_0x1c7125)['then'](handleEntityNotFound(_0x4b53ee,null))[_0xaad6('0x23')](function(_0x5b2b78){if(_0x5b2b78){if(!_['isNil'](_0x5b2b78[_0xaad6('0x61')])){if(fs[_0xaad6('0x6a')](path[_0xaad6('0x67')](config['root'],_0xaad6('0x6f'),_0x5b2b78['agentAvatar']))){_0xbd8691=path[_0xaad6('0x67')](config[_0xaad6('0x6b')],_0xaad6('0x6f'),_0x5b2b78['agentAvatar']);}}return _0x4b53ee[_0xaad6('0x6d')](_0xbd8691);}})[_0xaad6('0x1a')](handleError(_0x4b53ee,null));};exports[_0xaad6('0x70')]=function(_0x372855,_0x533df8){var _0x342ed7=path[_0xaad6('0x67')](config[_0xaad6('0x6b')],'server/files/images/avatars/customer_avatar.png');var _0x284941={'where':{'id':_0x372855['params']['id']},'attributes':['id',_0xaad6('0x63'),_0xaad6('0x71')],'raw':!![]};return db[_0xaad6('0x3c')][_0xaad6('0x4c')](_0x284941)[_0xaad6('0x23')](handleEntityNotFound(_0x533df8,null))['then'](function(_0x485ff5){if(_0x485ff5){if(!_['isNil'](_0x485ff5['customerAvatar'])){if(fs['existsSync'](path[_0xaad6('0x67')](config[_0xaad6('0x6b')],'server/files/images/avatars/',_0x485ff5['customerAvatar']))&&_0x485ff5[_0xaad6('0x71')]){_0x342ed7=path[_0xaad6('0x67')](config[_0xaad6('0x6b')],_0xaad6('0x6f'),_0x485ff5[_0xaad6('0x63')]);}}return _0x533df8[_0xaad6('0x6d')](_0x342ed7);}})['catch'](handleError(_0x533df8,null));};exports[_0xaad6('0x72')]=function(_0x1c16fa,_0x492b24){var _0x22aea2=path['join'](config[_0xaad6('0x6b')],_0xaad6('0x73'));var _0xce8a6b={'where':{'id':_0x1c16fa[_0xaad6('0x4d')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db['ChatWebsite']['find'](_0xce8a6b)[_0xaad6('0x23')](handleEntityNotFound(_0x492b24,null))[_0xaad6('0x23')](function(_0x1aa576){if(_0x1aa576){if(!_['isNil'](_0x1aa576[_0xaad6('0x65')])){if(fs['existsSync'](path[_0xaad6('0x67')](config[_0xaad6('0x6b')],'server/files/images/avatars/',_0x1aa576[_0xaad6('0x65')]))){_0x22aea2=path['join'](config[_0xaad6('0x6b')],_0xaad6('0x6f'),_0x1aa576[_0xaad6('0x65')]);}}return _0x492b24[_0xaad6('0x6d')](_0x22aea2);}})[_0xaad6('0x1a')](handleError(_0x492b24,null));};exports[_0xaad6('0x74')]=function(_0x2da91d,_0x6c7855){var _0x2cbe80=require('user-agent-parser');var _0x3cae8f=new _0x2cbe80();var _0x2dc124=_0x3cae8f['setUA'](_0x2da91d[_0xaad6('0x75')][_0xaad6('0x76')])[_0xaad6('0x77')]();var _0x51034d={'body':_0x2da91d['body'],'channel':_0xaad6('0x78')};var _0x1402bf=[];var _0x517566=[];var _0x18f3e3={};var _0x3962c1=![];return db[_0xaad6('0x79')][_0xaad6('0x4e')]()['then'](function(_0x729b60){if(!_0x729b60){throw new db['Sequelize'][(_0xaad6('0x7a'))](_0xaad6('0x7b'));}_0x1402bf=_[_0xaad6('0x7c')](_[_0xaad6('0x2e')](_0x729b60),[_0xaad6('0x7d'),_0xaad6('0x7e')]);_0x517566=_[_0xaad6('0x7c')](_[_0xaad6('0x2e')](_0x729b60),[_0xaad6('0x7d'),'updatedAt',_0xaad6('0x7f'),'ListId']);if(_0x2da91d[_0xaad6('0x42')]['id']){delete _0x2da91d[_0xaad6('0x42')]['id'];}if(_[_0xaad6('0x69')](_0x2da91d[_0xaad6('0x42')][_0xaad6('0x80')])){throw new db[(_0xaad6('0x81'))]['ValidationError'](_0xaad6('0x82'));}if(_[_0xaad6('0x69')](_0x2da91d[_0xaad6('0x42')]['body'])||_0x2da91d['body'][_0xaad6('0x42')]===''){throw new db[(_0xaad6('0x81'))][(_0xaad6('0x7a'))](_0xaad6('0x83'));}if(_[_0xaad6('0x69')](_0x2da91d[_0xaad6('0x42')][_0xaad6('0x84')])){throw new db[(_0xaad6('0x81'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x517566);}if(!_['includes'](_0x517566,_0x2da91d['body'][_0xaad6('0x84')])){throw new db[(_0xaad6('0x81'))][(_0xaad6('0x7a'))](_0xaad6('0x85')+_0x517566);}_0x18f3e3[_0x2da91d[_0xaad6('0x42')]['mapKey']]=_0x2da91d[_0xaad6('0x42')][_0xaad6('0x80')];})[_0xaad6('0x23')](function(){return db[_0xaad6('0x3c')][_0xaad6('0x4c')]({'where':{'id':_0x2da91d['params']['id']},'include':[{'model':db[_0xaad6('0x86')],'as':_0xaad6('0x87'),'include':[{'model':db[_0xaad6('0x79')],'as':_0xaad6('0x88'),'where':_0x18f3e3,'limit':0x1,'order':[[_0xaad6('0x7e'),_0xaad6('0x89')]]}]},{'model':db[_0xaad6('0x8a')],'as':'Applications'}]});})[_0xaad6('0x23')](handleEntityNotFound(_0x6c7855,null))[_0xaad6('0x23')](function(_0x1aaff3){if(_0x1aaff3&&_0x1aaff3[_0xaad6('0x87')]){_0x51034d[_0xaad6('0x8b')]=_0x1aaff3;_0x51034d[_0xaad6('0x8c')]=_0x1aaff3[_0xaad6('0x8d')];_0x51034d[_0xaad6('0x8e')]=_0x1aaff3['List'];_0x51034d[_0xaad6('0x8c')]=_[_0xaad6('0x8f')](_0x51034d['applications'],[_0xaad6('0x90')],['asc']);if(_0x51034d['account'][_0xaad6('0x8d')]){delete _0x51034d['account'][_0xaad6('0x8d')];}if(_0x51034d[_0xaad6('0x8b')][_0xaad6('0x87')]&&_0x51034d['account'][_0xaad6('0x87')]['Contacts'][_0xaad6('0x41')]){return _0x51034d[_0xaad6('0x8b')][_0xaad6('0x87')]['Contacts'][0x0];}var _0x5b3356=_[_0xaad6('0xb')](_0x2da91d[_0xaad6('0x42')],{'firstName':_0x2da91d[_0xaad6('0x42')]['from'],'ListId':_0x1aaff3[_0xaad6('0x91')]});_0x5b3356[_0x2da91d[_0xaad6('0x42')][_0xaad6('0x84')]]=_0x2da91d['body'][_0xaad6('0x80')];return db[_0xaad6('0x79')][_0xaad6('0x49')](_0x5b3356,{'fields':_0x1402bf,'raw':!![]});}})[_0xaad6('0x23')](handleEntityNotFound(_0x6c7855,null))[_0xaad6('0x23')](function(_0x2a9bba){_0x51034d['contact']=_0x2a9bba;var _0x33295d=_0x2da91d[_0xaad6('0x42')]['customerIp'];if(_0x2da91d[_0xaad6('0x75')]['cf-connecting-ip']){_0x33295d=_0x2da91d['headers']['cf-connecting-ip'];}else if(_0x2da91d[_0xaad6('0x75')][_0xaad6('0x92')]){_0x33295d=_[_0xaad6('0x93')](_0x2da91d[_0xaad6('0x75')][_0xaad6('0x92')][_0xaad6('0x94')](','));}if(_0x2a9bba){var _0x156ba6={'ContactId':_0x2a9bba['id'],'ChatWebsiteId':_0x2da91d['params']['id'],'from':(_0x2a9bba[_0xaad6('0x95')]||'')+'\x20'+(_0x2a9bba[_0xaad6('0x96')]||''),'customerIp':_0x33295d,'customerPort':_0x2da91d[_0xaad6('0x75')][_0xaad6('0x97')]?_0x2da91d['headers'][_0xaad6('0x97')]:null,'referer':_0x2da91d['body'][_0xaad6('0x98')],'browserName':_0x2dc124[_0xaad6('0x99')]['name']&&_0x2dc124[_0xaad6('0x99')][_0xaad6('0x9a')]?util[_0xaad6('0x9b')](_0xaad6('0x9c'),_0x2dc124[_0xaad6('0x99')][_0xaad6('0x26')],_0x2dc124[_0xaad6('0x99')][_0xaad6('0x9a')]):'unknown','browserVersion':_0x2dc124[_0xaad6('0x99')][_0xaad6('0x9a')]||_0xaad6('0x9d'),'osName':util[_0xaad6('0x9b')](_0xaad6('0x9c'),_0x2dc124['os'][_0xaad6('0x26')],_0x2dc124['os'][_0xaad6('0x9a')]),'osVersion':_0x2dc124['os'][_0xaad6('0x9a')],'deviceModel':_0x2dc124['device'][_0xaad6('0x32')]&&_0x2dc124[_0xaad6('0x9e')][_0xaad6('0x9f')]?util[_0xaad6('0x9b')]('%s\x20%s\x20%s',_0x2dc124['device'][_0xaad6('0x32')],_0x2dc124[_0xaad6('0x9e')]['vendor'],_0x2dc124['device'][_0xaad6('0x2d')]):null,'deviceVendor':_0x2dc124['device'][_0xaad6('0x9f')],'deviceType':_0x2dc124[_0xaad6('0x9e')][_0xaad6('0x2d')],'formData':JSON['stringify'](_0x2da91d[_0xaad6('0x42')])};var _0x41a1db={'ChatWebsiteId':_0x2da91d[_0xaad6('0x4d')]['id'],'closed':![]};if(_0x2da91d[_0xaad6('0x42')][_0xaad6('0xa0')]){_0x41a1db[_0xaad6('0xa0')]=_0x2da91d[_0xaad6('0x42')][_0xaad6('0xa0')];return db[_0xaad6('0xa1')][_0xaad6('0x4c')]({'where':_0x41a1db})[_0xaad6('0x23')](function(_0x41a9b2){if(_0x41a9b2){return[_0x41a9b2,![]];}_0x156ba6['threadId']=_0x2da91d['body'][_0xaad6('0xa0')];_0x156ba6[_0xaad6('0xa2')]=_0x2da91d[_0xaad6('0x42')]['externalUrl'];return db[_0xaad6('0xa1')][_0xaad6('0x49')](_0x156ba6)[_0xaad6('0x23')](function(_0xdb494e){return[_0xdb494e,!![]];});});}_0x41a1db[_0xaad6('0xa3')]=_0x2a9bba['id'];if(_0x2da91d[_0xaad6('0x42')]['interaction']&&_0x2da91d[_0xaad6('0x42')][_0xaad6('0xa4')]['id']){_0x41a1db['id']=_0x2da91d[_0xaad6('0x42')][_0xaad6('0xa4')]['id'];return db[_0xaad6('0xa1')]['find']({'where':_0x41a1db})['then'](function(_0x8de1a8){if(_0x8de1a8){return[_0x8de1a8,![]];}return db[_0xaad6('0xa1')][_0xaad6('0x49')](_0x156ba6)[_0xaad6('0x23')](function(_0x277c17){return[_0x277c17,!![]];});});}return db['ChatInteraction']['create'](_0x156ba6)[_0xaad6('0x23')](function(_0x41144f){return[_0x41144f,!![]];});}})[_0xaad6('0xa5')](function(_0x3a847b,_0x513e51){if(_0x3a847b){_0x3962c1=_0x513e51;if(!_0x513e51){var _0x304d0c={'from':(_0x51034d['contact'][_0xaad6('0x95')]||'')+'\x20'+(_0x51034d[_0xaad6('0xa6')][_0xaad6('0x96')]||'')};if(_0x2da91d[_0xaad6('0x42')][_0xaad6('0xa0')]&&_0x2da91d[_0xaad6('0x42')]['messageId']&&_0x2da91d[_0xaad6('0x42')]['threadId']!=_0x2da91d['body'][_0xaad6('0xa7')]){_0x304d0c[_0xaad6('0xa0')]=_0x2da91d[_0xaad6('0x42')][_0xaad6('0xa7')];}return _0x3a847b[_0xaad6('0x4b')](_0x304d0c);}else{return _0x3a847b;}}})[_0xaad6('0x23')](function(_0x2d4f61){_0x51034d[_0xaad6('0xa4')]=_0x2d4f61[_0xaad6('0x44')]({'plain':!![]});_0x51034d['interaction'][_0xaad6('0xa8')]=_0x3962c1;if(_0x51034d[_0xaad6('0xa4')][_0xaad6('0xa8')]){if(_0x51034d[_0xaad6('0x8b')][_0xaad6('0xa9')]){_0x51034d[_0xaad6('0x8c')]['push']({'id':0x0,'priority':_0x51034d[_0xaad6('0x8c')][_0xaad6('0x41')]+0x1,'app':_0xaad6('0xaa'),'appdata':_0xaad6('0xab'),'interval':_0xaad6('0xac')});}}return db[_0xaad6('0xad')][_0xaad6('0x49')]({'body':_0x2da91d[_0xaad6('0x42')][_0xaad6('0x42')],'ChatWebsiteId':_0x2da91d[_0xaad6('0x4d')]['id'],'ChatInteractionId':_0x2d4f61['id'],'direction':'in','ContactId':_0x51034d[_0xaad6('0xa6')]['id'],'AttachmentId':_0x2da91d[_0xaad6('0x42')][_0xaad6('0xae')]});})['then'](function(_0x1255c4){_0x51034d['message']=_0x1255c4;if(_0x51034d[_0xaad6('0xa4')]['UserId']){return db[_0xaad6('0xaf')][_0xaad6('0x4c')]({'attributes':['id',_0xaad6('0x26')],'where':{'id':_0x51034d[_0xaad6('0xa4')][_0xaad6('0xb0')]}})[_0xaad6('0x23')](function(_0x3bb266){if(_0x3bb266){_0x51034d['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xaad6('0xb1'),'appdata':_0x3bb266[_0xaad6('0x26')]+','+(_0x51034d[_0xaad6('0x8b')]['waitForTheAssignedAgent']||0xa),'interval':_0xaad6('0xac')});_0x51034d[_0xaad6('0xb2')]=!![];}return respondWithRpcPromise(_0xaad6('0xb3'),'startRouting',_0x51034d);});}return respondWithRpcPromise(_0xaad6('0xb3'),_0xaad6('0xb4'),_0x51034d);})['then'](function(_0x3db535){respondWithRpcPromise(_0xaad6('0xb5'),_0xaad6('0xb5'),{'event':_0xaad6('0x74'),'message':_0x3db535},client9002);return _0x3db535;})[_0xaad6('0x23')](respondWithResult(_0x6c7855,null))[_0xaad6('0x1a')](handleError(_0x6c7855,null));};exports[_0xaad6('0xb6')]=function(_0x4b0846,_0x5353b3){var _0x5d0299,_0x289d1f,_0x1ae190;var _0x2328d9=[];var _0x4d9a4f={};var _0x376cf2=_0x4b0846[_0xaad6('0xb7')]||[];var _0x4bef66=[];var _0x15efac;return db[_0xaad6('0x79')][_0xaad6('0x4e')]()[_0xaad6('0x23')](function(_0x2b7824){if(!_0x2b7824){throw new db[(_0xaad6('0x81'))][(_0xaad6('0x7a'))](_0xaad6('0x7b'));}_0x2328d9=_['difference'](_[_0xaad6('0x2e')](_0x2b7824),['createdAt',_0xaad6('0x7e'),_0xaad6('0x7f'),_0xaad6('0x91')]);if(_0x4b0846[_0xaad6('0x42')]['id']){delete _0x4b0846['body']['id'];}if(_[_0xaad6('0x69')](_0x4b0846[_0xaad6('0x42')][_0xaad6('0x80')])){throw _0x5353b3[_0xaad6('0x1c')](0x1f4)[_0xaad6('0x27')](new db['Sequelize'][(_0xaad6('0x7a'))](_0xaad6('0x82')));}if(_[_0xaad6('0x69')](_0x4b0846[_0xaad6('0x42')][_0xaad6('0x42')])||_0x4b0846['body'][_0xaad6('0x42')]===''){throw _0x5353b3['status'](0x1f4)['send'](new db[(_0xaad6('0x81'))][(_0xaad6('0x7a'))](_0xaad6('0x83')));}if(_[_0xaad6('0x69')](_0x4b0846[_0xaad6('0x42')]['mapKeyOffline'])){throw _0x5353b3[_0xaad6('0x1c')](0x1f4)[_0xaad6('0x27')](new db[(_0xaad6('0x81'))][(_0xaad6('0x7a'))](_0xaad6('0xb8')+_0x2328d9));}if(!_[_0xaad6('0xb9')](_0x2328d9,_0x4b0846[_0xaad6('0x42')]['mapKeyOffline'])){throw _0x5353b3['status'](0x1f4)[_0xaad6('0x27')](new db[(_0xaad6('0x81'))][(_0xaad6('0x7a'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2328d9));}_0x4d9a4f[_0x4b0846['body'][_0xaad6('0xba')]]=_0x4b0846[_0xaad6('0x42')][_0xaad6('0x80')];})[_0xaad6('0x23')](function(){return db[_0xaad6('0x3c')][_0xaad6('0x4c')]({'where':{'id':_0x4b0846[_0xaad6('0x4d')]['id']},'include':[{'model':db[_0xaad6('0x86')],'as':'List'},{'model':db[_0xaad6('0xbb')],'as':'MailAccount'}]});})[_0xaad6('0x23')](handleEntityNotFound(_0x5353b3,null))['then'](function(_0x4b4585){if(_0x4b4585&&_0x4b4585['List']){_0x289d1f=_0x4b4585;var _0x151a07=_['defaults'](_0x4b0846['body'],{'firstName':_0x4b0846[_0xaad6('0x42')][_0xaad6('0x80')],'phone':_0x4b0846[_0xaad6('0x42')][_0xaad6('0x80')],'ListId':_0x4b4585[_0xaad6('0x91')]});_0x151a07[_0x4b0846[_0xaad6('0x42')][_0xaad6('0xba')]]=_0x4b0846[_0xaad6('0x42')][_0xaad6('0x80')];return db[_0xaad6('0x79')][_0xaad6('0xbc')]({'where':_0x4d9a4f,'defaults':_0x151a07});}})['spread'](function(_0x12fa56){if(_0x12fa56){_0x1ae190=_0x12fa56;var _0x348045=fs['readFileSync'](path[_0xaad6('0x67')](config[_0xaad6('0x6b')],'server/files/templates/chatOfflineMessage.ejs'),_0xaad6('0xbd'));var _0x1c1e52=ejs[_0xaad6('0xbe')](_0x348045,{'body':_[_0xaad6('0xbf')](_0x4b0846[_0xaad6('0x42')][_0xaad6('0x42')]),'bodyTitle':_0x289d1f[_0xaad6('0xc0')]});return db['ChatOfflineMessage'][_0xaad6('0x49')]({'body':_0x1c1e52,'plainBody':htmlToText[_0xaad6('0xc1')](_0x1c1e52),'ContactId':_0x12fa56['id'],'ChatWebsiteId':_0x289d1f['id']});}})[_0xaad6('0x23')](function(_0x2a5bb4){_0x15efac=_0x2a5bb4;if(_0x376cf2[_0xaad6('0x41')]){var _0x26c39f=_0x376cf2[_0xaad6('0x2b')](function(_0x2a5bcc){return{'name':_0x2a5bcc[_0xaad6('0xc2')],'basename':_0x2a5bcc['filename'],'type':_0x2a5bcc[_0xaad6('0xc3')],'ChatOfflineMessageId':_0x2a5bb4['id']};});_0x4bef66=_0x26c39f[_0xaad6('0x2b')](_0x187b35=>{var _0x85e417={'filename':_0x187b35[_0xaad6('0x26')],'path':path[_0xaad6('0x67')](config[_0xaad6('0x6b')],_0xaad6('0xc4'),'files',_0xaad6('0xc5'),'offline-chat',_0x187b35[_0xaad6('0xc6')])};return _0x85e417;});if(!_0x289d1f[_0xaad6('0xc7')]){return db['sequelize'][_0xaad6('0xc8')](function(_0x30cd9b){return db[_0xaad6('0xc9')][_0xaad6('0xca')](_0x26c39f,{'transaction':_0x30cd9b});});}}})[_0xaad6('0x23')](function(){if(_0x15efac){_0x5d0299=_0x15efac;return db[_0xaad6('0xbb')][_0xaad6('0x51')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0xaad6('0xcb')],'as':_0xaad6('0xcb'),'raw':!![]}]}]});}})['then'](function(_0x18b5bb){if(_0x18b5bb&&_0x18b5bb['Smtp']&&_0x289d1f[_0xaad6('0xcc')]&&_0x289d1f[_0xaad6('0xcd')]){var _0xb950cb=_0x18b5bb['getSmtpOptions']();return respondWithRpcPromise(_0xaad6('0xce'),_0xaad6('0xcf'),{'account':_0xb950cb,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x18b5bb[_0xaad6('0x26')],_0x18b5bb['email']||_0x18b5bb['Smtp']['user']),'to':_0x289d1f[_0xaad6('0xcd')],'subject':_0x289d1f['offlineMessageSubject'],'html':_0x5d0299[_0xaad6('0x42')],'attachments':_0x4bef66}},client9003)[_0xaad6('0x23')](function(){return _0x5d0299;})[_0xaad6('0x1a')](function(_0x2fc4b7){logger[_0xaad6('0x16')](_0x2fc4b7);});}})['then'](function(){if(_0x289d1f&&_0x289d1f['openNewInteraction']&&_0x289d1f[_0xaad6('0xd0')]){var _0x207c4b=[];if(_0x376cf2[_0xaad6('0x41')]){_0x207c4b=_0x376cf2[_0xaad6('0x2b')](function(_0x574266){return{'name':_0x574266[_0xaad6('0xc2')],'basename':_0x574266[_0xaad6('0x5f')],'type':_0x574266['mimetype'],'ChatOfflineMessageId':_0x15efac['id']};});}var _0x25fb76;if(!_['isNil'](_0x289d1f[_0xaad6('0xd1')])){var _0x5a14b5=_[_0xaad6('0x2b')](_0x4b0846[_0xaad6('0x42')],function(_0x53e550){return _0x53e550;});var _0x5a0e22=_[_0xaad6('0xd2')](_0x5a14b5)[0x0];var _0xb622a6=_[_0xaad6('0xd3')](_0x5a0e22,function(_0x413a75){return _0x413a75;});_0x25fb76=_0xb622a6[0x1][_0x289d1f[_0xaad6('0xd1')]];}var _0x4bc0ab={'from':_0x1ae190['email'],'firstName':_0x1ae190[_0xaad6('0x95')],'lastName':_0x1ae190[_0xaad6('0x96')],'mapKey':_0xaad6('0xd4'),'message':{'from':_0x1ae190['email'],'to':_0x289d1f[_0xaad6('0xbb')][_0xaad6('0xd4')],'cc':'','subject':_[_0xaad6('0x69')](_0x25fb76)?_0x289d1f[_0xaad6('0xd5')]:_0x25fb76,'messageId':'','sentAt':new Date(),'attach':_0x207c4b['length'],'attachments':_0x207c4b,'originChannel':_0xaad6('0xd6'),'ChatWebsiteId':_0x289d1f['id'],'ChatOfflineMessageId':_0x5d0299['id'],'originTo':_0x289d1f[_0xaad6('0xbb')][_0xaad6('0xd4')]},'body':_0x5d0299['body']};var _0x21133d={'account':{'id':_0x289d1f['MailAccountId']},'body':_0x4bc0ab,'log':_0xaad6('0xd7')};return respondWithRpcPromise(_0xaad6('0xd7'),'notifyMail',_0x21133d,client9001)['then'](function(){return _0x5d0299;})[_0xaad6('0x1a')](function(_0xc0ed1f){logger[_0xaad6('0x16')](_0xc0ed1f);});}return;})['then'](function(){if(_0x5d0299){return _0x5d0299;}})[_0xaad6('0x23')](respondWithResult(_0x5353b3,null))['catch'](function(_0x4bd03a){logger[_0xaad6('0x16')]('catch',_0x4bd03a);for(var _0x195ef3 of _0x376cf2){var _0x2a3378=path[_0xaad6('0x67')](config[_0xaad6('0x6b')],'server',_0xaad6('0xb7'),_0xaad6('0xc5'),'offline-chat',_0x195ef3[_0xaad6('0x5f')]);fs_extra['remove'](_0x2a3378)[_0xaad6('0x1a')](function(_0x2575f3){logger[_0xaad6('0x16')]('Could\x20not\x20remove\x20attachment\x20file',_0x2a3378,_0x2575f3);});}});};exports[_0xaad6('0xd8')]=function(_0x3c9240,_0x586d61){return db[_0xaad6('0xa1')][_0xaad6('0x4c')]({'where':{'id':_0x3c9240[_0xaad6('0x4d')]['id']}})[_0xaad6('0x23')](handleEntityNotFound(_0x586d61,null))['then'](function(_0xbf4d9c){if(_0xbf4d9c){return _0xbf4d9c[_0xaad6('0xd8')](_0x3c9240[_0xaad6('0x42')]['ids'],_[_0xaad6('0xd9')](_0x3c9240[_0xaad6('0x42')],['ids','id'])||{});}})[_0xaad6('0x23')](respondWithResult(_0x586d61,null))['catch'](handleError(_0x586d61,null));};exports[_0xaad6('0xda')]=function(_0x3337ef,_0x2c2fe4){var _0x18f441={'raw':![],'where':{}};var _0x5bf1cd={};var _0x54b1c5={'count':0x0,'rows':[]};return db[_0xaad6('0x3c')]['findOne']({'where':{'id':_0x3337ef['params']['id']}})[_0xaad6('0x23')](handleEntityNotFound(_0x2c2fe4,null))['then'](function(_0x3f4420){if(_0x3f4420){_0x5bf1cd['model']=_[_0xaad6('0x2e')](db[_0xaad6('0xa1')][_0xaad6('0x2c')]);_0x5bf1cd[_0xaad6('0x2f')]=_[_0xaad6('0x2e')](_0x3337ef[_0xaad6('0x2f')]);_0x5bf1cd[_0xaad6('0x30')]=_[_0xaad6('0x31')](_0x5bf1cd['model'],_0x5bf1cd[_0xaad6('0x2f')]);_0x18f441[_0xaad6('0x33')]=_[_0xaad6('0x31')](_0x5bf1cd[_0xaad6('0x32')],qs['fields'](_0x3337ef[_0xaad6('0x2f')][_0xaad6('0x34')]));_0x18f441[_0xaad6('0x33')]=_0x18f441['attributes'][_0xaad6('0x41')]?_0x18f441[_0xaad6('0x33')]:_0x5bf1cd[_0xaad6('0x32')];if(!_0x3337ef['query']['hasOwnProperty'](_0xaad6('0x53'))){_0x18f441[_0xaad6('0x1e')]=qs['limit'](_0x3337ef['query'][_0xaad6('0x1e')]);_0x18f441['offset']=qs['offset'](_0x3337ef[_0xaad6('0x2f')][_0xaad6('0x20')]);}_0x18f441[_0xaad6('0x54')]=qs[_0xaad6('0x36')](_0x3337ef['query'][_0xaad6('0x36')]);_0x18f441[_0xaad6('0x37')]=qs['filters'](_[_0xaad6('0x38')](_0x3337ef[_0xaad6('0x2f')],_0x5bf1cd[_0xaad6('0x30')]));_0x18f441['where'][_0xaad6('0x50')]=_0x3f4420['id'];if(_0x3337ef[_0xaad6('0x2f')]['filter']){_0x18f441[_0xaad6('0x37')]=_[_0xaad6('0x3b')](_0x18f441[_0xaad6('0x37')],{'$or':_[_0xaad6('0x2b')](_0x18f441['attributes'],function(_0x118699){var _0x260971={};_0x260971[_0x118699]={'$like':'%'+_0x3337ef['query'][_0xaad6('0x39')]+'%'};return _0x260971;})});}_0x18f441=_[_0xaad6('0x3b')]({},_0x18f441,_0x3337ef[_0xaad6('0x55')]);return db[_0xaad6('0xa1')][_0xaad6('0x1f')]({'where':_0x18f441[_0xaad6('0x37')]})[_0xaad6('0x23')](function(_0x485125){_0x54b1c5[_0xaad6('0x1f')]=_0x485125;if(_0x3337ef[_0xaad6('0x2f')][_0xaad6('0x3d')]){_0x18f441[_0xaad6('0x3e')]=[{'model':db[_0xaad6('0x79')],'as':_0xaad6('0xdb'),'required':![]},{'model':db[_0xaad6('0xaf')],'as':_0xaad6('0xdc'),'attributes':['name','fullname',_0xaad6('0xdd')],'required':![]},{'model':db['Tag'],'as':_0xaad6('0xde'),'attributes':['id',_0xaad6('0x26'),_0xaad6('0xdf')],'where':_0x3337ef[_0xaad6('0x2f')][_0xaad6('0xe0')]?{'id':_0x3337ef['query'][_0xaad6('0xe0')]}:undefined,'required':_0x3337ef['query']['tag']?!![]:![]}];}return db[_0xaad6('0xa1')]['findAll'](_0x18f441);})[_0xaad6('0x23')](function(_0x4d6f80){_0x54b1c5[_0xaad6('0x40')]=_0x4d6f80;return _0x54b1c5;});}})['then'](respondWithFilteredResult(_0x2c2fe4,_0x18f441))[_0xaad6('0x1a')](handleError(_0x2c2fe4,null));};function iftimePromise(_0x141b1e,_0x3dfc1a){return respondWithRpcPromise(_0xaad6('0xe1'),_0xaad6('0xe2'),{'command':_0x3dfc1a[_0xaad6('0xe3')]?util['format'](_0xaad6('0xe4'),_0x141b1e[_0xaad6('0xe5')],_0x3dfc1a[_0xaad6('0xe3')]):util[_0xaad6('0x9b')](_0xaad6('0xe6'),_0x141b1e[_0xaad6('0xe5')])},client9002)[_0xaad6('0x23')](function(_0x90ea9b){var _0x3106a2=_0x90ea9b&&_0x90ea9b[_0xaad6('0xe7')](_0xaad6('0xe8'))>=0x0?!![]:![];logger['info'](_0xaad6('0xe9'),_0x3dfc1a['id'],_0x141b1e['id'],_0x141b1e['interval'],_0x3106a2?_0xaad6('0xea'):'OFFLINE',_0x3dfc1a['timezone']?_0x3dfc1a[_0xaad6('0xe3')]:'No\x20timezone');return _0x3106a2;})[_0xaad6('0x1a')](function(_0x59b79c){logger[_0xaad6('0x16')](_0xaad6('0xe9'),_0x3dfc1a['id'],_0x141b1e['id'],_0x141b1e[_0xaad6('0xe5')],util[_0xaad6('0xeb')](_0x59b79c,{'showHidden':![],'depth':null}),_0x3dfc1a[_0xaad6('0xe3')]?_0x3dfc1a[_0xaad6('0xe3')]:_0xaad6('0xec'));return![];});}exports['getSnippet']=function(_0x1a7fd1,_0x55215c){var _0x126550=0x0;var _0x411204=0x0;var _0xe3bacb=![];var _0x53c2f1;var _0x2395bf;return db[_0xaad6('0x3c')][_0xaad6('0x4c')]({'where':{'id':_0x1a7fd1[_0xaad6('0x4d')]['id']},'include':[{'model':db[_0xaad6('0xed')],'as':'Interval','include':[{'model':db[_0xaad6('0xed')],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]})[_0xaad6('0x23')](handleEntityNotFound(_0x55215c,null))[_0xaad6('0x23')](function(_0x48a5dc){if(_0x48a5dc){_0x53c2f1=_0x48a5dc;return _0x48a5dc[_0xaad6('0xee')]({'raw':!![]});}})[_0xaad6('0x23')](function(_0x21f593){if(_0x53c2f1){if(_0x21f593){_0x2395bf=_0x21f593;}}return require(_0xaad6('0xef'))[_0xaad6('0xf0')]();})[_0xaad6('0x23')](function(_0x1738c4){if(_0x1738c4){_0x411204=_0x1738c4[_0xaad6('0xf1')];_0xe3bacb=_0x1738c4[_0xaad6('0xf2')];}})['then'](function(){return db[_0xaad6('0xa1')][_0xaad6('0x1f')]({'where':{'closed':![]}});})['then'](function(_0x22f7fb){_0x126550=_0x22f7fb;if(_0x411204&&_0x22f7fb>_0x411204){return db[_0xaad6('0xf3')][_0xaad6('0x51')]({'where':{'id':0x1}})[_0xaad6('0x23')](function(_0x29e4e7){if(_0x29e4e7){_0x29e4e7[_0xaad6('0xf4')](_0xaad6('0xf5'));}});}})[_0xaad6('0x23')](function(){if(_0x53c2f1[_0xaad6('0xed')]&&_0x53c2f1[_0xaad6('0xed')]['Intervals']){var _0xb9fec0=[];for(var _0x3e451a=0x0;_0x3e451a<_0x53c2f1['Interval'][_0xaad6('0xf6')][_0xaad6('0x41')];_0x3e451a++){var _0x30abe2=_0x53c2f1['Interval']['Intervals'][_0x3e451a]['get']({'plain':!![]});_0xb9fec0[_0xaad6('0xf7')](iftimePromise(_0x30abe2,_0x53c2f1));}return BPromise[_0xaad6('0xf8')](_0xb9fec0)[_0xaad6('0x23')](function(_0x127328){return _[_0xaad6('0xf9')](_0x127328);});}else{return!![];}})['then'](function(_0x3735a7){var _0x5f449f=fs[_0xaad6('0xfa')](path[_0xaad6('0x67')](config['root'],'server/files/chat/iframe.ejs'),_0xaad6('0xbd'));var _0x951b0c=new url['URL'](_0x53c2f1[_0xaad6('0xfb')])['origin'];var _0x18715d='3.1.0';var _0x1714e8=![];var _0x4600ed={'chatVersion':_0x18715d,'chatWebsiteAddressOrigin':_0x951b0c,'remote':_0x53c2f1[_0xaad6('0xfc')],'query':querystring[_0xaad6('0xfd')](_[_0xaad6('0x3b')](_0x53c2f1[_0xaad6('0x44')]({'plain':!![]}),{'customerIp':_0x1a7fd1[_0xaad6('0x75')][_0xaad6('0x92')]||_0x1a7fd1['headers'][_0xaad6('0xfe')]||_0x1a7fd1[_0xaad6('0xff')]['remoteAddress']||_0x1a7fd1['ip'],'referer':_0x1a7fd1[_0xaad6('0x75')][_0xaad6('0x98')],'openedInteractions':_0x126550,'maxInteractions':_0x411204,'virtual':_0xe3bacb[_0xaad6('0xf1')],'online':_0x3735a7,'custom':_0xe3bacb}))[_0xaad6('0x100')](/'/g,'\x5c\x27')};_0x55215c[_0xaad6('0x27')](ejs['render'](Mustache['render'](_0x5f449f,_0x4600ed),{'proactiveActions':_0x2395bf,'alignment':_0x53c2f1[_0xaad6('0x101')],'verticalAlignment':_0x53c2f1[_0xaad6('0x102')],'div_color':_0x53c2f1[_0xaad6('0xdf')],'labelText':_0x53c2f1[_0xaad6('0x103')],'text_color':_0x53c2f1[_0xaad6('0x104')],'text_button_color':_0x53c2f1[_0xaad6('0x105')],'button_color':_0x53c2f1[_0xaad6('0x106')],'background_color':_0x53c2f1[_0xaad6('0x107')],'hideWhenOffline':_0x53c2f1[_0xaad6('0x108')],'intervalId':_0x53c2f1['IntervalId'],'isDevelopment':_0x1714e8,'chatVersion':_0x18715d}));})[_0xaad6('0x1a')](handleError(_0x55215c,null));};exports[_0xaad6('0x109')]=function(_0x42d4c3,_0x35db63){var _0x574d16=_0x42d4c3[_0xaad6('0x4d')]['id'];var _0x357217=_0x42d4c3[_0xaad6('0x42')];var _0x5deec1=0xc8;var _0x2f7c84=null;return db[_0xaad6('0x10a')]['transaction']({'isolationLevel':db[_0xaad6('0x10a')]['Transaction'][_0xaad6('0x10b')][_0xaad6('0x10c')]},function(_0x3832a1){return db[_0xaad6('0x3c')]['findOne']({'where':{'id':_0x574d16},'transaction':_0x3832a1})[_0xaad6('0x23')](function(_0x3b99d6){if(_0x3b99d6){return db[_0xaad6('0x8a')][_0xaad6('0x24')]({'where':{'ChatWebsiteId':_0x574d16},'transaction':_0x3832a1})[_0xaad6('0x23')](function(){var _0x39d6cb=_['map'](_0x357217,function(_0x533d62){_0x533d62[_0xaad6('0x50')]=_0x574d16;return _0x533d62;});return db[_0xaad6('0x8a')][_0xaad6('0xca')](_0x39d6cb,{'transaction':_0x3832a1});});}else{_0x5deec1=0x194;_0x2f7c84=[];}});})['then'](function(){if(_0x5deec1!==0x194){return db[_0xaad6('0x8a')][_0xaad6('0x10d')]({'where':{'ChatWebsiteId':_0x574d16},'order':'priority'})[_0xaad6('0x23')](function(_0x5c4063){_0x2f7c84=_0x5c4063;});}})['catch'](function(_0x487b61){_0x5deec1=0x1f4;logger[_0xaad6('0x16')](_0x487b61[_0xaad6('0x10e')]);if(_0x487b61[_0xaad6('0x26')]){delete _0x487b61[_0xaad6('0x26')];}_0x2f7c84=_0x487b61;})[_0xaad6('0x10f')](function(){if(_0x2f7c84===null){_0x35db63['sendStatus'](_0x5deec1);}else{if(_0x5deec1===0x1f4){_0x35db63[_0xaad6('0x1c')](_0x5deec1)[_0xaad6('0x27')](_0x2f7c84);}else{_0x35db63[_0xaad6('0x1c')](_0x5deec1)[_0xaad6('0x22')](_0x2f7c84);}}});};exports[_0xaad6('0x110')]=function(_0x58d307,_0x381fca){var _0x34b02b={};var _0x487dbe={};var _0x62770d;var _0x2755b9;return db[_0xaad6('0x3c')]['findOne']({'where':{'id':_0x58d307[_0xaad6('0x4d')]['id']}})[_0xaad6('0x23')](handleEntityNotFound(_0x381fca,null))[_0xaad6('0x23')](function(_0x4cb054){if(_0x4cb054){_0x62770d=_0x4cb054;_0x487dbe[_0xaad6('0x32')]=_['keys'](db[_0xaad6('0x8a')][_0xaad6('0x2c')]);_0x487dbe[_0xaad6('0x2f')]=_[_0xaad6('0x2e')](_0x58d307[_0xaad6('0x2f')]);_0x487dbe[_0xaad6('0x30')]=_['intersection'](_0x487dbe[_0xaad6('0x32')],_0x487dbe['query']);_0x34b02b[_0xaad6('0x33')]=_['intersection'](_0x487dbe[_0xaad6('0x32')],qs[_0xaad6('0x34')](_0x58d307[_0xaad6('0x2f')]['fields']));_0x34b02b[_0xaad6('0x33')]=_0x34b02b[_0xaad6('0x33')][_0xaad6('0x41')]?_0x34b02b[_0xaad6('0x33')]:_0x487dbe['model'];_0x34b02b[_0xaad6('0x54')]=qs[_0xaad6('0x36')](_0x58d307[_0xaad6('0x2f')][_0xaad6('0x36')]);_0x34b02b[_0xaad6('0x37')]=qs[_0xaad6('0x30')](_[_0xaad6('0x38')](_0x58d307['query'],_0x487dbe['filters']));if(_0x58d307[_0xaad6('0x2f')]['filter']){_0x34b02b['where']=_[_0xaad6('0x3b')](_0x34b02b[_0xaad6('0x37')],{'$or':_[_0xaad6('0x2b')](_0x34b02b[_0xaad6('0x33')],function(_0x2385fb){var _0x22a279={};_0x22a279[_0x2385fb]={'$like':'%'+_0x58d307[_0xaad6('0x2f')]['filter']+'%'};return _0x22a279;})});}_0x34b02b=_[_0xaad6('0x3b')]({},_0x34b02b,_0x58d307[_0xaad6('0x55')]);return _0x62770d[_0xaad6('0x110')](_0x34b02b);}})[_0xaad6('0x23')](function(_0x2be7a8){if(_0x2be7a8){_0x2755b9=_0x2be7a8[_0xaad6('0x41')];if(!_0x58d307[_0xaad6('0x2f')][_0xaad6('0x35')](_0xaad6('0x53'))){_0x34b02b[_0xaad6('0x1e')]=qs[_0xaad6('0x1e')](_0x58d307['query'][_0xaad6('0x1e')]);_0x34b02b['offset']=qs[_0xaad6('0x20')](_0x58d307[_0xaad6('0x2f')]['offset']);}return _0x62770d[_0xaad6('0x110')](_0x34b02b);}})[_0xaad6('0x23')](function(_0x58b325){if(_0x58b325){return _0x58b325?{'count':_0x2755b9,'rows':_0x58b325}:null;}})['then'](respondWithResult(_0x381fca,null))[_0xaad6('0x1a')](handleError(_0x381fca,null));};exports[_0xaad6('0x111')]=function(_0x2a3f8e,_0x527730){return db[_0xaad6('0x112')][_0xaad6('0x4c')]({'where':{'id':_0x2a3f8e['params']['id']}})['then'](handleEntityNotFound(_0x527730,null))[_0xaad6('0x23')](function(_0x1d5480){if(_0x1d5480){return _0x1d5480[_0xaad6('0x111')](_0x2a3f8e[_0xaad6('0x42')]['ids'],_[_0xaad6('0xd9')](_0x2a3f8e[_0xaad6('0x42')],[_0xaad6('0x57'),'id'])||{});}})[_0xaad6('0x23')](respondWithResult(_0x527730,null))[_0xaad6('0x1a')](handleError(_0x527730,null));};exports[_0xaad6('0xee')]=function(_0x719874,_0x512bb1){var _0x2928db={};var _0x154533={};var _0x131da4;var _0xc19528;return db[_0xaad6('0x3c')][_0xaad6('0x51')]({'where':{'id':_0x719874['params']['id']}})[_0xaad6('0x23')](handleEntityNotFound(_0x512bb1,null))['then'](function(_0x3743dc){if(_0x3743dc){_0x131da4=_0x3743dc;_0x154533[_0xaad6('0x32')]=_[_0xaad6('0x2e')](db[_0xaad6('0x113')][_0xaad6('0x2c')]);_0x154533[_0xaad6('0x2f')]=_[_0xaad6('0x2e')](_0x719874[_0xaad6('0x2f')]);_0x154533[_0xaad6('0x30')]=_[_0xaad6('0x31')](_0x154533[_0xaad6('0x32')],_0x154533[_0xaad6('0x2f')]);_0x2928db['attributes']=_[_0xaad6('0x31')](_0x154533[_0xaad6('0x32')],qs['fields'](_0x719874[_0xaad6('0x2f')][_0xaad6('0x34')]));_0x2928db['attributes']=_0x2928db[_0xaad6('0x33')][_0xaad6('0x41')]?_0x2928db[_0xaad6('0x33')]:_0x154533[_0xaad6('0x32')];_0x2928db[_0xaad6('0x54')]=qs['sort'](_0x719874[_0xaad6('0x2f')]['sort']);_0x2928db[_0xaad6('0x37')]=qs[_0xaad6('0x30')](_['pick'](_0x719874['query'],_0x154533['filters']));if(_0x719874['query'][_0xaad6('0x39')]){_0x2928db[_0xaad6('0x37')]=_[_0xaad6('0x3b')](_0x2928db[_0xaad6('0x37')],{'$or':_['map'](_0x2928db[_0xaad6('0x33')],function(_0x58f261){var _0x4fcc0d={};_0x4fcc0d[_0x58f261]={'$like':'%'+_0x719874['query']['filter']+'%'};return _0x4fcc0d;})});}_0x2928db=_['merge']({},_0x2928db,_0x719874[_0xaad6('0x55')]);return _0x131da4['getProactiveActions'](_0x2928db);}})['then'](function(_0x270c1e){if(_0x270c1e){_0xc19528=_0x270c1e[_0xaad6('0x41')];if(!_0x719874[_0xaad6('0x2f')][_0xaad6('0x35')](_0xaad6('0x53'))){_0x2928db['limit']=qs[_0xaad6('0x1e')](_0x719874[_0xaad6('0x2f')][_0xaad6('0x1e')]);_0x2928db[_0xaad6('0x20')]=qs[_0xaad6('0x20')](_0x719874['query'][_0xaad6('0x20')]);}return _0x131da4[_0xaad6('0xee')](_0x2928db);}})[_0xaad6('0x23')](function(_0x5ecfff){if(_0x5ecfff){return _0x5ecfff?{'count':_0xc19528,'rows':_0x5ecfff}:null;}})[_0xaad6('0x23')](respondWithResult(_0x512bb1,null))[_0xaad6('0x1a')](handleError(_0x512bb1,null));};exports[_0xaad6('0x114')]=function(_0x55cba6,_0x2c0733){var _0x1d767a=_0x55cba6[_0xaad6('0x2f')][_0xaad6('0x115')]===_0xaad6('0x116')?'offlineForm':_0xaad6('0x117');return db['ChatWebsite'][_0xaad6('0x4c')]({'attributes':['id',_0x1d767a],'where':{'id':_0x55cba6[_0xaad6('0x4d')]['id']}})[_0xaad6('0x23')](handleEntityNotFound(_0x2c0733,null))[_0xaad6('0x23')](function(_0x20141a){if(_0x20141a){var _0x10d859=_0x20141a[_0x1d767a];var _0x441084=_0x10d859&&_0x10d859[_0xaad6('0x118')]?_0x10d859[_0xaad6('0x118')]:[];_0x2c0733[_0xaad6('0x27')]({'fromKey':_[_0xaad6('0x69')](_0x10d859[_0xaad6('0x119')])?undefined:_0x10d859[_0xaad6('0x119')],'count':_0x441084['length'],'rows':_0x441084});}})['catch'](handleError(_0x2c0733,null));};exports[_0xaad6('0x11a')]=function(_0x846abf,_0x309761){var _0x233604={'raw':![],'where':{}};var _0x1aeee1={};var _0x483bf4={'count':0x0,'rows':[]};return db[_0xaad6('0x3c')][_0xaad6('0x51')]({'where':{'id':_0x846abf[_0xaad6('0x4d')]['id']}})[_0xaad6('0x23')](handleEntityNotFound(_0x309761,null))[_0xaad6('0x23')](function(_0x40ccb4){if(_0x40ccb4){_0x1aeee1[_0xaad6('0x32')]=_['keys'](db[_0xaad6('0x11b')][_0xaad6('0x2c')]);_0x1aeee1[_0xaad6('0x2f')]=_['keys'](_0x846abf[_0xaad6('0x2f')]);_0x1aeee1['filters']=_['intersection'](_0x1aeee1['model'],_0x1aeee1['query']);_0x233604[_0xaad6('0x33')]=_[_0xaad6('0x31')](_0x1aeee1[_0xaad6('0x32')],qs[_0xaad6('0x34')](_0x846abf[_0xaad6('0x2f')][_0xaad6('0x34')]));_0x233604['attributes']=_0x233604[_0xaad6('0x33')]['length']?_0x233604[_0xaad6('0x33')]:_0x1aeee1[_0xaad6('0x32')];if(!_0x846abf[_0xaad6('0x2f')][_0xaad6('0x35')]('nolimit')){_0x233604[_0xaad6('0x1e')]=qs['limit'](_0x846abf[_0xaad6('0x2f')][_0xaad6('0x1e')]);_0x233604['offset']=qs[_0xaad6('0x20')](_0x846abf[_0xaad6('0x2f')][_0xaad6('0x20')]);}_0x233604[_0xaad6('0x54')]=qs[_0xaad6('0x36')](_0x846abf[_0xaad6('0x2f')][_0xaad6('0x36')]);_0x233604[_0xaad6('0x37')]=qs[_0xaad6('0x30')](_[_0xaad6('0x38')](_0x846abf[_0xaad6('0x2f')],_0x1aeee1['filters']));_0x233604[_0xaad6('0x37')][_0xaad6('0x50')]=_0x40ccb4['id'];if(_0x846abf[_0xaad6('0x2f')]['filter']){_0x233604[_0xaad6('0x37')]=_[_0xaad6('0x3b')](_0x233604['where'],{'$or':_[_0xaad6('0x2b')](_0x233604[_0xaad6('0x33')],function(_0xe9b00a){var _0x3d3c1a={};_0x3d3c1a[_0xe9b00a]={'$like':'%'+_0x846abf[_0xaad6('0x2f')][_0xaad6('0x39')]+'%'};return _0x3d3c1a;})});}_0x233604=_[_0xaad6('0x3b')]({},_0x233604,_0x846abf['options']);return db[_0xaad6('0x11b')][_0xaad6('0x1f')]({'where':_0x233604[_0xaad6('0x37')]})[_0xaad6('0x23')](function(_0x38a40e){_0x483bf4[_0xaad6('0x1f')]=_0x38a40e;if(_0x846abf[_0xaad6('0x2f')][_0xaad6('0x3d')]){_0x233604[_0xaad6('0x3e')]=[{'all':!![]}];}else{_0x233604['include']=[{'model':db[_0xaad6('0x79')],'as':_0xaad6('0xdb'),'required':![]},{'model':db['Attachment'],'as':_0xaad6('0x11c'),'required':![]}];}return db[_0xaad6('0x11b')][_0xaad6('0x3f')](_0x233604);})['then'](function(_0x4fa8a6){_0x483bf4[_0xaad6('0x40')]=_0x4fa8a6;return _0x483bf4;});}})[_0xaad6('0x23')](respondWithFilteredResult(_0x309761,_0x233604))[_0xaad6('0x1a')](handleError(_0x309761,null));};exports[_0xaad6('0x11d')]=function(_0x1a412b,_0x6c241f){return db[_0xaad6('0x3c')][_0xaad6('0x4c')]({'where':{'id':_0x1a412b['params']['id']}})[_0xaad6('0x23')](handleEntityNotFound(_0x6c241f,null))['then'](function(_0x1d09da){if(_0x1d09da){return _0x1d09da[_0xaad6('0x11d')](_0x1a412b[_0xaad6('0x42')][_0xaad6('0x57')],_[_0xaad6('0xd9')](_0x1a412b[_0xaad6('0x42')],[_0xaad6('0x57'),'id'])||{})[_0xaad6('0xa5')](function(_0x50fe23){for(var _0x305c3a=0x0;_0x305c3a<_0x1a412b['body'][_0xaad6('0x57')][_0xaad6('0x41')];_0x305c3a+=0x1){socket[_0xaad6('0x11e')](_0xaad6('0x11f'),{'UserId':Number(_0x1a412b[_0xaad6('0x42')]['ids'][_0x305c3a]),'ChatWebsiteId':Number(_0x1a412b[_0xaad6('0x4d')]['id'])});}return _0x50fe23;});}})[_0xaad6('0x23')](respondWithResult(_0x6c241f,null))[_0xaad6('0x1a')](handleError(_0x6c241f,null));};exports['removeAgents']=function(_0x231284,_0x2f95f9){return db[_0xaad6('0x3c')][_0xaad6('0x4c')]({'where':{'id':_0x231284['params']['id']}})[_0xaad6('0x23')](handleEntityNotFound(_0x2f95f9,null))['then'](function(_0x19a890){if(_0x19a890){return _0x19a890['removeAgents'](_0x231284[_0xaad6('0x2f')][_0xaad6('0x57')])[_0xaad6('0x23')](function(){if(_[_0xaad6('0x120')](_0x231284[_0xaad6('0x2f')][_0xaad6('0x57')])){for(var _0x105376=0x0;_0x105376<_0x231284[_0xaad6('0x2f')][_0xaad6('0x57')][_0xaad6('0x41')];_0x105376+=0x1){socket[_0xaad6('0x11e')](_0xaad6('0x121'),{'UserId':Number(_0x231284[_0xaad6('0x2f')][_0xaad6('0x57')][_0x105376]),'ChatWebsiteId':Number(_0x231284[_0xaad6('0x4d')]['id'])});}}else{socket[_0xaad6('0x11e')](_0xaad6('0x121'),{'UserId':Number(_0x231284[_0xaad6('0x2f')][_0xaad6('0x57')]),'ChatWebsiteId':Number(_0x231284[_0xaad6('0x4d')]['id'])});}});}})[_0xaad6('0x23')](respondWithStatusCode(_0x2f95f9,null))['catch'](handleError(_0x2f95f9,null));};exports['getAgents']=function(_0xefb478,_0x29cb78){var _0x54f37c={};var _0x47e6a8={};var _0x5c6f10;var _0x4d453a;return db[_0xaad6('0x3c')][_0xaad6('0x51')]({'where':{'id':_0xefb478[_0xaad6('0x4d')]['id']}})[_0xaad6('0x23')](handleEntityNotFound(_0x29cb78,null))[_0xaad6('0x23')](function(_0x54901e){if(_0x54901e){_0x5c6f10=_0x54901e;_0x47e6a8[_0xaad6('0x32')]=_[_0xaad6('0x2e')](db[_0xaad6('0xaf')][_0xaad6('0x2c')]);_0x47e6a8[_0xaad6('0x2f')]=_[_0xaad6('0x2e')](_0xefb478[_0xaad6('0x2f')]);_0x47e6a8[_0xaad6('0x30')]=_['intersection'](_0x47e6a8[_0xaad6('0x32')],_0x47e6a8[_0xaad6('0x2f')]);_0x54f37c[_0xaad6('0x33')]=_[_0xaad6('0x31')](_0x47e6a8[_0xaad6('0x32')],qs[_0xaad6('0x34')](_0xefb478['query'][_0xaad6('0x34')]));_0x54f37c[_0xaad6('0x33')]=_0x54f37c['attributes'][_0xaad6('0x41')]?_0x54f37c[_0xaad6('0x33')]:_0x47e6a8['model'];_0x54f37c[_0xaad6('0x54')]=qs[_0xaad6('0x36')](_0xefb478[_0xaad6('0x2f')][_0xaad6('0x36')]);_0x54f37c[_0xaad6('0x37')]=qs[_0xaad6('0x30')](_['pick'](_0xefb478['query'],_0x47e6a8['filters']));if(_0xefb478[_0xaad6('0x2f')]['filter']){_0x54f37c[_0xaad6('0x37')]=_[_0xaad6('0x3b')](_0x54f37c[_0xaad6('0x37')],{'$or':_[_0xaad6('0x2b')](_0x54f37c['attributes'],function(_0x2a3a4d){var _0x48a8ac={};_0x48a8ac[_0x2a3a4d]={'$like':'%'+_0xefb478['query'][_0xaad6('0x39')]+'%'};return _0x48a8ac;})});}_0x54f37c=_[_0xaad6('0x3b')]({},_0x54f37c,_0xefb478[_0xaad6('0x55')]);return _0x5c6f10[_0xaad6('0x122')](_0x54f37c);}})[_0xaad6('0x23')](function(_0x178440){if(_0x178440){_0x4d453a=_0x178440[_0xaad6('0x41')];if(!_0xefb478[_0xaad6('0x2f')][_0xaad6('0x35')]('nolimit')){_0x54f37c[_0xaad6('0x1e')]=qs[_0xaad6('0x1e')](_0xefb478[_0xaad6('0x2f')][_0xaad6('0x1e')]);_0x54f37c['offset']=qs[_0xaad6('0x20')](_0xefb478['query'][_0xaad6('0x20')]);}return _0x5c6f10[_0xaad6('0x122')](_0x54f37c);}})[_0xaad6('0x23')](function(_0x2a8a6f){if(_0x2a8a6f){return _0x2a8a6f?{'count':_0x4d453a,'rows':_0x2a8a6f}:null;}})[_0xaad6('0x23')](respondWithResult(_0x29cb78,null))[_0xaad6('0x1a')](handleError(_0x29cb78,null));}; \ No newline at end of file +var _0x42ba=['Sequelize','ValidationError','difference','createdAt','updatedAt','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','ChatApplication','Applications','applications','list','orderBy','priority','account','CmContact','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','vendor','%s\x20%s\x20%s','type','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','offline','files','no\x20available\x20attributes','CompanyId','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','offline-chat','openNewInteraction','sequelize','Attachment','MailServerOut','CloudProvider','forwardOffline','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','Smtp','MailAccountId','Chat','NotifyMailAccount','notifyMail','remove','addInteraction','omit','getInteractions','Contact','Owner','internal','Tag','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','getProactiveActions','License','increment','chatLicenseExceeded','Intervals','all','URL','address','origin','3.1.0','remote','x-real-ip','remoteAddress','virtual','replace','render','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','hideWhenOffline','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','stack','addProactiveActions','ChatProactiveAction','getFields','online','offlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','fs-extra','lodash','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','./chatWebsite.socket','html-to-text','jayson/promise','client','http','info','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','update','destroy','get','ChatWebsites','then','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','fieldName','key','query','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','rawAttributes','intersection','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','create','nolimit','order','removeDispositions','ids','CannedAnswer','getAnswers','findOne','include','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','addCustomerAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','isNil','existsSync','server/files/images/avatars/','customerAvatar','showCustomerAvatar','getSystemAvatar','notify','setUA','headers','user-agent','chat'];(function(_0x28c117,_0x590409){var _0x397766=function(_0x1ce4c9){while(--_0x1ce4c9){_0x28c117['push'](_0x28c117['shift']());}};_0x397766(++_0x590409);}(_0x42ba,0x1cc));var _0xa42b=function(_0x29dab8,_0x428035){_0x29dab8=_0x29dab8-0x0;var _0x2bbcf3=_0x42ba[_0x29dab8];return _0x2bbcf3;};'use strict';var BPromise=require(_0xa42b('0x0'));var Mustache=require(_0xa42b('0x1'));var util=require(_0xa42b('0x2'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa42b('0x3'));var _=require(_0xa42b('0x4'));var querystring=require(_0xa42b('0x5'));var Redis=require('ioredis');var qs=require(_0xa42b('0x6'));var logger=require(_0xa42b('0x7'))(_0xa42b('0x8'));var config=require(_0xa42b('0x9'));var url=require('url');var db=require(_0xa42b('0xa'))['db'];config['redis']=_[_0xa42b('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa42b('0xc'))(new Redis(config[_0xa42b('0xd')]));require(_0xa42b('0xe'))['register'](socket);var htmlToText=require(_0xa42b('0xf'));var jayson=require(_0xa42b('0x10'));var client=jayson[_0xa42b('0x11')][_0xa42b('0x12')]({'port':0x232c});var client9002=jayson[_0xa42b('0x11')][_0xa42b('0x12')]({'port':0x232a});var client9003=jayson[_0xa42b('0x11')][_0xa42b('0x12')]({'port':0x232b});var client9001=jayson[_0xa42b('0x11')]['http']({'port':0x2329});function respondWithRpcPromise(_0x2324d0,_0x2c1bff,_0x25dbcd,_0x271467){return new BPromise(function(_0xc67c82,_0x438a9f){var _0x4fb608=_0x271467||client;return _0x4fb608['request'](_0x2324d0,_0x25dbcd)['then'](function(_0xd7be20){logger[_0xa42b('0x13')](_0xa42b('0x14'),_0x2c1bff,'request\x20sent');logger['debug'](_0xa42b('0x15'),_0x2c1bff,_0xa42b('0x16'),JSON[_0xa42b('0x17')](_0xd7be20));if(_0xd7be20[_0xa42b('0x18')]){if(_0xd7be20[_0xa42b('0x18')][_0xa42b('0x19')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x2c1bff,_0xd7be20[_0xa42b('0x18')][_0xa42b('0x1a')]);return _0x438a9f(_0xd7be20[_0xa42b('0x18')]['message']);}logger['error'](_0xa42b('0x14'),_0x2c1bff,_0xd7be20[_0xa42b('0x18')]['message']);return _0xc67c82(_0xd7be20[_0xa42b('0x18')][_0xa42b('0x1a')]);}else{logger[_0xa42b('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x2c1bff,'request\x20sent');_0xc67c82(_0xd7be20['result'][_0xa42b('0x1a')]);}})[_0xa42b('0x1b')](function(_0x474790){logger[_0xa42b('0x18')](_0xa42b('0x14'),_0x2c1bff,_0x474790);_0x438a9f(_0x474790);});});}function respondWithStatusCode(_0x4db733,_0x1fae23){_0x1fae23=_0x1fae23||0xcc;return function(_0x148716){if(_0x148716){return _0x4db733[_0xa42b('0x1c')](_0x1fae23);}return _0x4db733['status'](_0x1fae23)[_0xa42b('0x1d')]();};}function respondWithResult(_0x4c15a1,_0x3ac0db){_0x3ac0db=_0x3ac0db||0xc8;return function(_0x3141d7){if(_0x3141d7){return _0x4c15a1['status'](_0x3ac0db)[_0xa42b('0x1e')](_0x3141d7);}};}function respondWithFilteredResult(_0x598f31,_0x5e562b){return function(_0x3006fc){if(_0x3006fc){var _0x1d2f34=typeof _0x5e562b[_0xa42b('0x1f')]===_0xa42b('0x20')&&typeof _0x5e562b[_0xa42b('0x21')]===_0xa42b('0x20');var _0x2f87d7=_0x3006fc[_0xa42b('0x22')];var _0x375730=_0x1d2f34?0x0:_0x5e562b[_0xa42b('0x1f')];var _0x121371=_0x1d2f34?_0x3006fc[_0xa42b('0x22')]:_0x5e562b[_0xa42b('0x1f')]+_0x5e562b[_0xa42b('0x21')];var _0xbceb2a;if(_0x121371>=_0x2f87d7){_0x121371=_0x2f87d7;_0xbceb2a=0xc8;}else{_0xbceb2a=0xce;}_0x598f31[_0xa42b('0x23')](_0xbceb2a);return _0x598f31[_0xa42b('0x24')]('Content-Range',_0x375730+'-'+_0x121371+'/'+_0x2f87d7)[_0xa42b('0x1e')](_0x3006fc);}return null;};}function saveUpdates(_0x4500a6){return function(_0x2c5011){if(_0x2c5011){return _0x2c5011[_0xa42b('0x25')](_0x4500a6)['then'](function(_0x146e00){return _0x146e00;});}return null;};}function removeEntity(_0xeef079){return function(_0x56ba5a){if(_0x56ba5a){return _0x56ba5a[_0xa42b('0x26')]()['then'](function(){var _0x3c3f9a=_0x56ba5a[_0xa42b('0x27')]({'plain':!![]});var _0x1e062f=_0xa42b('0x28');return db['UserProfileResource'][_0xa42b('0x26')]({'where':{'type':_0x1e062f,'resourceId':_0x3c3f9a['id']}})[_0xa42b('0x29')](function(){return _0x56ba5a;});})[_0xa42b('0x29')](function(){_0xeef079[_0xa42b('0x23')](0xcc)[_0xa42b('0x1d')]();});}};}function handleEntityNotFound(_0x5d9b0e){return function(_0x166368){if(!_0x166368){_0x5d9b0e[_0xa42b('0x1c')](0x194);}return _0x166368;};}function handleError(_0x44ed81,_0x2e9e7){_0x2e9e7=_0x2e9e7||0x1f4;return function(_0x20f8cc){logger[_0xa42b('0x18')](_0x20f8cc['stack']);if(_0x20f8cc['name']){delete _0x20f8cc[_0xa42b('0x2a')];}_0x44ed81[_0xa42b('0x23')](_0x2e9e7)[_0xa42b('0x2b')](_0x20f8cc);};}exports[_0xa42b('0x2c')]=function(_0x44e571,_0x12bc1e){var _0x959197={'include':[{'model':db[_0xa42b('0x2d')],'as':_0xa42b('0x2e')}]},_0x46fdeb={},_0x522c00={'count':0x0,'rows':[]};var _0x509157=_[_0xa42b('0x2f')](db[_0xa42b('0x30')]['rawAttributes'],function(_0x160b17){return{'name':_0x160b17[_0xa42b('0x31')],'type':_0x160b17['type'][_0xa42b('0x32')]};});_0x46fdeb['model']=_[_0xa42b('0x2f')](_0x509157,'name');_0x46fdeb[_0xa42b('0x33')]=_['keys'](_0x44e571[_0xa42b('0x33')]);_0x46fdeb['filters']=_['intersection'](_0x46fdeb[_0xa42b('0x34')],_0x46fdeb[_0xa42b('0x33')]);_0x959197[_0xa42b('0x35')]=_['intersection'](_0x46fdeb['model'],qs[_0xa42b('0x36')](_0x44e571[_0xa42b('0x33')][_0xa42b('0x36')]));_0x959197[_0xa42b('0x35')]=_0x959197[_0xa42b('0x35')][_0xa42b('0x37')]?_0x959197[_0xa42b('0x35')]:_0x46fdeb[_0xa42b('0x34')];if(!_0x44e571['query'][_0xa42b('0x38')]('nolimit')){_0x959197[_0xa42b('0x21')]=qs[_0xa42b('0x21')](_0x44e571[_0xa42b('0x33')][_0xa42b('0x21')]);_0x959197['offset']=qs[_0xa42b('0x1f')](_0x44e571[_0xa42b('0x33')][_0xa42b('0x1f')]);}_0x959197['order']=qs['sort'](_0x44e571['query'][_0xa42b('0x39')]);_0x959197[_0xa42b('0x3a')]=qs['filters'](_[_0xa42b('0x3b')](_0x44e571[_0xa42b('0x33')],_0x46fdeb[_0xa42b('0x3c')]),_0x509157);if(_0x44e571['query'][_0xa42b('0x3d')]){_0x959197[_0xa42b('0x3a')]=_[_0xa42b('0x3e')](_0x959197['where'],{'$or':_[_0xa42b('0x2f')](_0x509157,function(_0x59ba97){if(_0x59ba97['type']!==_0xa42b('0x3f')){var _0x5218a6={};_0x5218a6[_0x59ba97[_0xa42b('0x2a')]]={'$like':'%'+_0x44e571[_0xa42b('0x33')][_0xa42b('0x3d')]+'%'};return _0x5218a6;}})});}_0x959197=_['merge']({},_0x959197,_0x44e571[_0xa42b('0x40')]);var _0xcf5dae={'where':_0x959197['where']};return db[_0xa42b('0x30')][_0xa42b('0x22')](_0xcf5dae)['then'](function(_0x3dff35){_0x522c00[_0xa42b('0x22')]=_0x3dff35;if(_0x44e571[_0xa42b('0x33')][_0xa42b('0x41')]){_0x959197['include']=[{'all':!![]}];}return db[_0xa42b('0x30')][_0xa42b('0x42')](_0x959197);})[_0xa42b('0x29')](function(_0xc5ad90){_0x522c00[_0xa42b('0x43')]=_0xc5ad90;return _0x522c00;})[_0xa42b('0x29')](respondWithFilteredResult(_0x12bc1e,_0x959197))[_0xa42b('0x1b')](handleError(_0x12bc1e,null));};exports[_0xa42b('0x44')]=function(_0x2cc036,_0x5372ff){var _0x2c2a71={'raw':![],'where':{'id':_0x2cc036[_0xa42b('0x45')]['id']},'include':[{'model':db['Pause'],'as':_0xa42b('0x2e')}]},_0x12b02a={};_0x12b02a[_0xa42b('0x34')]=_[_0xa42b('0x46')](db[_0xa42b('0x30')][_0xa42b('0x47')]);_0x12b02a['query']=_[_0xa42b('0x46')](_0x2cc036['query']);_0x12b02a[_0xa42b('0x3c')]=_[_0xa42b('0x48')](_0x12b02a['model'],_0x12b02a[_0xa42b('0x33')]);_0x2c2a71[_0xa42b('0x35')]=_['intersection'](_0x12b02a[_0xa42b('0x34')],qs['fields'](_0x2cc036[_0xa42b('0x33')][_0xa42b('0x36')]));_0x2c2a71[_0xa42b('0x35')]=_0x2c2a71[_0xa42b('0x35')]['length']?_0x2c2a71[_0xa42b('0x35')]:_0x12b02a[_0xa42b('0x34')];if(_0x2cc036[_0xa42b('0x33')][_0xa42b('0x41')]){_0x2c2a71['include']=[{'all':!![]}];}_0x2c2a71=_[_0xa42b('0x3e')]({},_0x2c2a71,_0x2cc036['options']);return db[_0xa42b('0x30')]['find'](_0x2c2a71)['then'](handleEntityNotFound(_0x5372ff,null))[_0xa42b('0x29')](respondWithResult(_0x5372ff,null))[_0xa42b('0x1b')](handleError(_0x5372ff,null));};exports['create']=function(_0x515aea,_0x117863){return db[_0xa42b('0x30')]['create'](_0x515aea[_0xa42b('0x49')],{})[_0xa42b('0x29')](function(_0x4c25b1){var _0x28c251=_0x515aea[_0xa42b('0x4a')][_0xa42b('0x27')]({'plain':!![]});if(!_0x28c251)throw new Error(_0xa42b('0x4b'));if(_0x28c251[_0xa42b('0x4c')]===_0xa42b('0x4a')){var _0x353334=_0x4c25b1[_0xa42b('0x27')]({'plain':!![]});var _0x67cf30=_0xa42b('0x28');return db[_0xa42b('0x4d')][_0xa42b('0x4e')]({'where':{'name':_0x67cf30,'userProfileId':_0x28c251['userProfileId']},'raw':!![]})['then'](function(_0x4bfbcd){if(_0x4bfbcd&&_0x4bfbcd['autoAssociation']===0x0){return db[_0xa42b('0x4f')]['create']({'name':_0x353334['name'],'resourceId':_0x353334['id'],'type':_0x4bfbcd['name'],'sectionId':_0x4bfbcd['id']},{})[_0xa42b('0x29')](function(){return _0x4c25b1;});}else{return _0x4c25b1;}})['catch'](function(_0x5789a0){logger['error'](_0xa42b('0x50'),_0x5789a0);throw _0x5789a0;});}return _0x4c25b1;})[_0xa42b('0x29')](respondWithResult(_0x117863,0xc9))[_0xa42b('0x1b')](handleError(_0x117863,null));};exports[_0xa42b('0x25')]=function(_0x5da301,_0x39332a){if(_0x5da301['body']['id']){delete _0x5da301[_0xa42b('0x49')]['id'];}return db[_0xa42b('0x30')]['find']({'where':{'id':_0x5da301[_0xa42b('0x45')]['id']},'include':[{'model':db[_0xa42b('0x2d')],'as':_0xa42b('0x2e')}]})[_0xa42b('0x29')](handleEntityNotFound(_0x39332a,null))[_0xa42b('0x29')](saveUpdates(_0x5da301[_0xa42b('0x49')],null))['then'](respondWithResult(_0x39332a,null))[_0xa42b('0x1b')](handleError(_0x39332a,null));};exports['destroy']=function(_0x31cb8d,_0x2eb488){return db['ChatWebsite'][_0xa42b('0x4e')]({'where':{'id':_0x31cb8d[_0xa42b('0x45')]['id']}})['then'](handleEntityNotFound(_0x2eb488,null))['then'](removeEntity(_0x2eb488,null))[_0xa42b('0x1b')](handleError(_0x2eb488,null));};exports['describe']=function(_0x475331,_0x563162){return db[_0xa42b('0x30')][_0xa42b('0x51')]()[_0xa42b('0x29')](respondWithResult(_0x563162,null))[_0xa42b('0x1b')](handleError(_0x563162,null));};exports[_0xa42b('0x52')]=function(_0x1c66e2,_0x5d6082){if(_0x1c66e2[_0xa42b('0x49')]['id']){delete _0x1c66e2['body']['id'];}return db[_0xa42b('0x30')][_0xa42b('0x4e')]({'where':{'id':_0x1c66e2[_0xa42b('0x45')]['id']}})[_0xa42b('0x29')](handleEntityNotFound(_0x5d6082,null))['then'](function(_0x44cb2d){if(_0x44cb2d){_0x1c66e2['body'][_0xa42b('0x53')]=_0x44cb2d['id'];return db[_0xa42b('0x54')][_0xa42b('0x55')](_0x1c66e2['body']);}})[_0xa42b('0x29')](respondWithResult(_0x5d6082,null))['catch'](handleError(_0x5d6082,null));};exports['getDispositions']=function(_0x2a1d38,_0x382b31){var _0x350b77={'raw':![],'where':{}};var _0x630384={};var _0x2c3ef4={'count':0x0,'rows':[]};return db[_0xa42b('0x30')]['findOne']({'where':{'id':_0x2a1d38[_0xa42b('0x45')]['id']}})[_0xa42b('0x29')](handleEntityNotFound(_0x382b31,null))[_0xa42b('0x29')](function(_0x1a5d71){if(_0x1a5d71){_0x630384['model']=_['keys'](db[_0xa42b('0x54')]['rawAttributes']);_0x630384[_0xa42b('0x33')]=_['keys'](_0x2a1d38[_0xa42b('0x33')]);_0x630384[_0xa42b('0x3c')]=_[_0xa42b('0x48')](_0x630384[_0xa42b('0x34')],_0x630384['query']);_0x350b77['attributes']=_[_0xa42b('0x48')](_0x630384['model'],qs[_0xa42b('0x36')](_0x2a1d38[_0xa42b('0x33')][_0xa42b('0x36')]));_0x350b77[_0xa42b('0x35')]=_0x350b77[_0xa42b('0x35')][_0xa42b('0x37')]?_0x350b77['attributes']:_0x630384[_0xa42b('0x34')];if(!_0x2a1d38[_0xa42b('0x33')][_0xa42b('0x38')](_0xa42b('0x56'))){_0x350b77[_0xa42b('0x21')]=qs['limit'](_0x2a1d38[_0xa42b('0x33')][_0xa42b('0x21')]);_0x350b77['offset']=qs[_0xa42b('0x1f')](_0x2a1d38[_0xa42b('0x33')]['offset']);}_0x350b77[_0xa42b('0x57')]=qs[_0xa42b('0x39')](_0x2a1d38[_0xa42b('0x33')][_0xa42b('0x39')]);_0x350b77[_0xa42b('0x3a')]=qs[_0xa42b('0x3c')](_['pick'](_0x2a1d38[_0xa42b('0x33')],_0x630384[_0xa42b('0x3c')]));_0x350b77['where'][_0xa42b('0x53')]=_0x1a5d71['id'];if(_0x2a1d38[_0xa42b('0x33')][_0xa42b('0x3d')]){_0x350b77[_0xa42b('0x3a')]=_[_0xa42b('0x3e')](_0x350b77['where'],{'$or':_['map'](_0x350b77['attributes'],function(_0x2ff7d9){var _0x159c19={};_0x159c19[_0x2ff7d9]={'$like':'%'+_0x2a1d38[_0xa42b('0x33')]['filter']+'%'};return _0x159c19;})});}_0x350b77=_['merge']({},_0x350b77,_0x2a1d38[_0xa42b('0x40')]);return db[_0xa42b('0x54')][_0xa42b('0x22')]({'where':_0x350b77[_0xa42b('0x3a')]})[_0xa42b('0x29')](function(_0x35a8e7){_0x2c3ef4['count']=_0x35a8e7;if(_0x2a1d38[_0xa42b('0x33')][_0xa42b('0x41')]){_0x350b77['include']=[{'all':!![]}];}return db[_0xa42b('0x54')]['findAll'](_0x350b77);})[_0xa42b('0x29')](function(_0x2d2f07){_0x2c3ef4[_0xa42b('0x43')]=_0x2d2f07;return _0x2c3ef4;});}})[_0xa42b('0x29')](respondWithFilteredResult(_0x382b31,_0x350b77))[_0xa42b('0x1b')](handleError(_0x382b31,null));};exports['removeDispositions']=function(_0x670a8c,_0x5096c0){return db['ChatWebsite'][_0xa42b('0x4e')]({'where':{'id':_0x670a8c['params']['id']}})[_0xa42b('0x29')](handleEntityNotFound(_0x5096c0,null))[_0xa42b('0x29')](function(_0x5c33b9){if(_0x5c33b9){return _0x5c33b9[_0xa42b('0x58')](_0x670a8c[_0xa42b('0x33')][_0xa42b('0x59')]);}})[_0xa42b('0x29')](respondWithStatusCode(_0x5096c0,null))['catch'](handleError(_0x5096c0,null));};exports['addAnswer']=function(_0x4a34c6,_0x5923e7){if(_0x4a34c6['body']['id']){delete _0x4a34c6[_0xa42b('0x49')]['id'];}return db[_0xa42b('0x30')][_0xa42b('0x4e')]({'where':{'id':_0x4a34c6[_0xa42b('0x45')]['id']}})[_0xa42b('0x29')](handleEntityNotFound(_0x5923e7,null))[_0xa42b('0x29')](function(_0x51cc8a){if(_0x51cc8a){_0x4a34c6[_0xa42b('0x49')]['ChatWebsiteId']=_0x51cc8a['id'];return db[_0xa42b('0x5a')][_0xa42b('0x55')](_0x4a34c6[_0xa42b('0x49')]);}})[_0xa42b('0x29')](respondWithResult(_0x5923e7,null))['catch'](handleError(_0x5923e7,null));};exports[_0xa42b('0x5b')]=function(_0x24bb64,_0x5d72be){var _0x30557c={'raw':![],'where':{}};var _0x2532bf={};var _0x586656={'count':0x0,'rows':[]};return db[_0xa42b('0x30')][_0xa42b('0x5c')]({'where':{'id':_0x24bb64[_0xa42b('0x45')]['id']}})[_0xa42b('0x29')](handleEntityNotFound(_0x5d72be,null))[_0xa42b('0x29')](function(_0x3f12c8){if(_0x3f12c8){_0x2532bf[_0xa42b('0x34')]=_[_0xa42b('0x46')](db[_0xa42b('0x5a')]['rawAttributes']);_0x2532bf[_0xa42b('0x33')]=_[_0xa42b('0x46')](_0x24bb64[_0xa42b('0x33')]);_0x2532bf[_0xa42b('0x3c')]=_[_0xa42b('0x48')](_0x2532bf['model'],_0x2532bf[_0xa42b('0x33')]);_0x30557c['attributes']=_['intersection'](_0x2532bf['model'],qs[_0xa42b('0x36')](_0x24bb64['query'][_0xa42b('0x36')]));_0x30557c[_0xa42b('0x35')]=_0x30557c[_0xa42b('0x35')][_0xa42b('0x37')]?_0x30557c['attributes']:_0x2532bf['model'];if(!_0x24bb64['query'][_0xa42b('0x38')](_0xa42b('0x56'))){_0x30557c['limit']=qs[_0xa42b('0x21')](_0x24bb64['query']['limit']);_0x30557c['offset']=qs[_0xa42b('0x1f')](_0x24bb64[_0xa42b('0x33')][_0xa42b('0x1f')]);}_0x30557c[_0xa42b('0x57')]=qs[_0xa42b('0x39')](_0x24bb64[_0xa42b('0x33')][_0xa42b('0x39')]);_0x30557c[_0xa42b('0x3a')]=qs[_0xa42b('0x3c')](_[_0xa42b('0x3b')](_0x24bb64[_0xa42b('0x33')],_0x2532bf[_0xa42b('0x3c')]));_0x30557c[_0xa42b('0x3a')]['ChatWebsiteId']=_0x3f12c8['id'];if(_0x24bb64[_0xa42b('0x33')]['filter']){_0x30557c[_0xa42b('0x3a')]=_[_0xa42b('0x3e')](_0x30557c[_0xa42b('0x3a')],{'$or':_[_0xa42b('0x2f')](_0x30557c[_0xa42b('0x35')],function(_0x383873){var _0x564c1e={};_0x564c1e[_0x383873]={'$like':'%'+_0x24bb64[_0xa42b('0x33')]['filter']+'%'};return _0x564c1e;})});}_0x30557c=_[_0xa42b('0x3e')]({},_0x30557c,_0x24bb64[_0xa42b('0x40')]);return db['CannedAnswer'][_0xa42b('0x22')]({'where':_0x30557c[_0xa42b('0x3a')]})[_0xa42b('0x29')](function(_0x192060){_0x586656[_0xa42b('0x22')]=_0x192060;if(_0x24bb64[_0xa42b('0x33')][_0xa42b('0x41')]){_0x30557c[_0xa42b('0x5d')]=[{'all':!![]}];}return db[_0xa42b('0x5a')]['findAll'](_0x30557c);})[_0xa42b('0x29')](function(_0x55a746){_0x586656[_0xa42b('0x43')]=_0x55a746;return _0x586656;});}})[_0xa42b('0x29')](respondWithFilteredResult(_0x5d72be,_0x30557c))[_0xa42b('0x1b')](handleError(_0x5d72be,null));};exports[_0xa42b('0x5e')]=function(_0x24ee36,_0x2cc1e0){return db['ChatWebsite']['find']({'where':{'id':_0x24ee36['params']['id']}})['then'](handleEntityNotFound(_0x2cc1e0,null))[_0xa42b('0x29')](function(_0x27beb6){if(_0x27beb6){return _0x27beb6['removeAnswers'](_0x24ee36[_0xa42b('0x33')][_0xa42b('0x59')]);}})[_0xa42b('0x29')](respondWithStatusCode(_0x2cc1e0,null))[_0xa42b('0x1b')](handleError(_0x2cc1e0,null));};exports[_0xa42b('0x5f')]=function(_0x4a6ba4,_0x2c884d){_0x4a6ba4[_0xa42b('0x49')][_0xa42b('0x60')]=_0x4a6ba4[_0xa42b('0x61')][_0xa42b('0x62')];return db[_0xa42b('0x30')][_0xa42b('0x4e')]({'where':{'id':_0x4a6ba4['params']['id']}})[_0xa42b('0x29')](handleEntityNotFound(_0x2c884d,null))['then'](saveUpdates(_0x4a6ba4[_0xa42b('0x49')],null))['then'](respondWithResult(_0x2c884d,null))['catch'](handleError(_0x2c884d,null));};exports['addAvatar']=function(_0x6deffc,_0x5eb8ce){_0x6deffc[_0xa42b('0x49')][_0xa42b('0x63')]=_0x6deffc['file'][_0xa42b('0x62')];return db['ChatWebsite'][_0xa42b('0x4e')]({'where':{'id':_0x6deffc[_0xa42b('0x45')]['id']}})[_0xa42b('0x29')](handleEntityNotFound(_0x5eb8ce,null))[_0xa42b('0x29')](saveUpdates(_0x6deffc[_0xa42b('0x49')],null))[_0xa42b('0x29')](respondWithResult(_0x5eb8ce,null))['catch'](handleError(_0x5eb8ce,null));};exports[_0xa42b('0x64')]=function(_0x5b21f9,_0x3bff96){_0x5b21f9[_0xa42b('0x49')]['customerAvatar']=_0x5b21f9[_0xa42b('0x61')][_0xa42b('0x62')];return db[_0xa42b('0x30')]['find']({'where':{'id':_0x5b21f9['params']['id']}})[_0xa42b('0x29')](handleEntityNotFound(_0x3bff96,null))[_0xa42b('0x29')](saveUpdates(_0x5b21f9[_0xa42b('0x49')],null))[_0xa42b('0x29')](respondWithResult(_0x3bff96,null))[_0xa42b('0x1b')](handleError(_0x3bff96,null));};exports['addSystemAvatar']=function(_0x19aacb,_0x5cd347){_0x19aacb[_0xa42b('0x49')][_0xa42b('0x65')]=_0x19aacb[_0xa42b('0x61')][_0xa42b('0x62')];return db[_0xa42b('0x30')]['find']({'where':{'id':_0x19aacb[_0xa42b('0x45')]['id']}})['then'](handleEntityNotFound(_0x5cd347,null))['then'](saveUpdates(_0x19aacb[_0xa42b('0x49')],null))['then'](respondWithResult(_0x5cd347,null))[_0xa42b('0x1b')](handleError(_0x5cd347,null));};exports['getLogo']=function(_0x250b99,_0x2bff53){var _0x12253d=path[_0xa42b('0x66')](config[_0xa42b('0x67')],_0xa42b('0x68'));var _0x4d7455={'where':{'id':_0x250b99[_0xa42b('0x45')]['id']},'attributes':['id',_0xa42b('0x60')],'raw':!![]};var _0x1320b7=![];return require(_0xa42b('0x69'))[_0xa42b('0x6a')]()['then'](function(_0x46a595){if(_0x46a595){_0x1320b7=_0x46a595[_0xa42b('0x6b')];}})['then'](function(){return db[_0xa42b('0x30')][_0xa42b('0x4e')](_0x4d7455);})[_0xa42b('0x29')](handleEntityNotFound(_0x2bff53,null))[_0xa42b('0x29')](function(_0x4b880b){if(_0x4b880b){if(!_['isNil'](_0x4b880b[_0xa42b('0x60')])){if(fs['existsSync'](path[_0xa42b('0x66')](config[_0xa42b('0x67')],_0xa42b('0x6c'),_0x4b880b['sitepic']))&&_0x1320b7){_0x12253d=path[_0xa42b('0x66')](config['root'],_0xa42b('0x6c'),_0x4b880b[_0xa42b('0x60')]);}}return _0x2bff53[_0xa42b('0x6d')](_0x12253d);}})[_0xa42b('0x1b')](handleError(_0x2bff53,null));};exports['getAvatar']=function(_0x35c8bc,_0x55af52){var _0x693510=path['join'](config[_0xa42b('0x67')],_0xa42b('0x6e'));var _0x5eb571={'where':{'id':_0x35c8bc[_0xa42b('0x45')]['id']},'attributes':['id',_0xa42b('0x63')],'raw':!![]};return db[_0xa42b('0x30')]['find'](_0x5eb571)[_0xa42b('0x29')](handleEntityNotFound(_0x55af52,null))[_0xa42b('0x29')](function(_0x1fb76b){if(_0x1fb76b){if(!_[_0xa42b('0x6f')](_0x1fb76b[_0xa42b('0x63')])){if(fs[_0xa42b('0x70')](path['join'](config[_0xa42b('0x67')],_0xa42b('0x71'),_0x1fb76b[_0xa42b('0x63')]))){_0x693510=path[_0xa42b('0x66')](config['root'],_0xa42b('0x71'),_0x1fb76b[_0xa42b('0x63')]);}}return _0x55af52['download'](_0x693510);}})[_0xa42b('0x1b')](handleError(_0x55af52,null));};exports['getCustomerAvatar']=function(_0x59844c,_0x30d8f1){var _0x212121=path[_0xa42b('0x66')](config[_0xa42b('0x67')],'server/files/images/avatars/customer_avatar.png');var _0x42e62b={'where':{'id':_0x59844c[_0xa42b('0x45')]['id']},'attributes':['id',_0xa42b('0x72'),_0xa42b('0x73')],'raw':!![]};return db[_0xa42b('0x30')][_0xa42b('0x4e')](_0x42e62b)[_0xa42b('0x29')](handleEntityNotFound(_0x30d8f1,null))[_0xa42b('0x29')](function(_0x51fa73){if(_0x51fa73){if(!_[_0xa42b('0x6f')](_0x51fa73[_0xa42b('0x72')])){if(fs[_0xa42b('0x70')](path[_0xa42b('0x66')](config['root'],'server/files/images/avatars/',_0x51fa73[_0xa42b('0x72')]))&&_0x51fa73['showCustomerAvatar']){_0x212121=path[_0xa42b('0x66')](config[_0xa42b('0x67')],'server/files/images/avatars/',_0x51fa73['customerAvatar']);}}return _0x30d8f1[_0xa42b('0x6d')](_0x212121);}})[_0xa42b('0x1b')](handleError(_0x30d8f1,null));};exports[_0xa42b('0x74')]=function(_0x4359be,_0x4ad7e3){var _0x3dab56=path[_0xa42b('0x66')](config[_0xa42b('0x67')],'server/files/images/avatars/system_avatar.png');var _0x4723a5={'where':{'id':_0x4359be[_0xa42b('0x45')]['id']},'attributes':['id',_0xa42b('0x65')],'raw':!![]};return db[_0xa42b('0x30')][_0xa42b('0x4e')](_0x4723a5)['then'](handleEntityNotFound(_0x4ad7e3,null))[_0xa42b('0x29')](function(_0x568b98){if(_0x568b98){if(!_[_0xa42b('0x6f')](_0x568b98[_0xa42b('0x65')])){if(fs[_0xa42b('0x70')](path[_0xa42b('0x66')](config[_0xa42b('0x67')],_0xa42b('0x71'),_0x568b98[_0xa42b('0x65')]))){_0x3dab56=path[_0xa42b('0x66')](config[_0xa42b('0x67')],_0xa42b('0x71'),_0x568b98[_0xa42b('0x65')]);}}return _0x4ad7e3[_0xa42b('0x6d')](_0x3dab56);}})[_0xa42b('0x1b')](handleError(_0x4ad7e3,null));};exports[_0xa42b('0x75')]=function(_0x38ba41,_0x4b22bd){var _0x54228b=require('user-agent-parser');var _0x2ad523=new _0x54228b();var _0x30be3a=_0x2ad523[_0xa42b('0x76')](_0x38ba41[_0xa42b('0x77')][_0xa42b('0x78')])['getResult']();var _0xd0d849={'body':_0x38ba41['body'],'channel':_0xa42b('0x79')};var _0x94e135=[];var _0x306b75=[];var _0x58b048={};var _0x27e25c=![];return db['CmContact'][_0xa42b('0x51')]()[_0xa42b('0x29')](function(_0x417c65){if(!_0x417c65){throw new db[(_0xa42b('0x7a'))][(_0xa42b('0x7b'))]('no\x20available\x20attributes');}_0x94e135=_[_0xa42b('0x7c')](_[_0xa42b('0x46')](_0x417c65),['createdAt','updatedAt']);_0x306b75=_[_0xa42b('0x7c')](_[_0xa42b('0x46')](_0x417c65),[_0xa42b('0x7d'),_0xa42b('0x7e'),'CompanyId',_0xa42b('0x7f')]);if(_0x38ba41['body']['id']){delete _0x38ba41[_0xa42b('0x49')]['id'];}if(_[_0xa42b('0x6f')](_0x38ba41[_0xa42b('0x49')][_0xa42b('0x80')])){throw new db[(_0xa42b('0x7a'))][(_0xa42b('0x7b'))](_0xa42b('0x81'));}if(_[_0xa42b('0x6f')](_0x38ba41[_0xa42b('0x49')][_0xa42b('0x49')])||_0x38ba41[_0xa42b('0x49')][_0xa42b('0x49')]===''){throw new db['Sequelize'][(_0xa42b('0x7b'))](_0xa42b('0x82'));}if(_[_0xa42b('0x6f')](_0x38ba41['body'][_0xa42b('0x83')])){throw new db['Sequelize']['ValidationError'](_0xa42b('0x84')+_0x306b75);}if(!_[_0xa42b('0x85')](_0x306b75,_0x38ba41[_0xa42b('0x49')]['mapKey'])){throw new db[(_0xa42b('0x7a'))][(_0xa42b('0x7b'))](_0xa42b('0x86')+_0x306b75);}_0x58b048[_0x38ba41[_0xa42b('0x49')][_0xa42b('0x83')]]=_0x38ba41['body'][_0xa42b('0x80')];})[_0xa42b('0x29')](function(){return db['ChatWebsite'][_0xa42b('0x4e')]({'where':{'id':_0x38ba41[_0xa42b('0x45')]['id']},'include':[{'model':db[_0xa42b('0x87')],'as':_0xa42b('0x88'),'include':[{'model':db['CmContact'],'as':_0xa42b('0x89'),'where':_0x58b048,'limit':0x1,'order':[[_0xa42b('0x7e'),'DESC']]}]},{'model':db[_0xa42b('0x8a')],'as':_0xa42b('0x8b')}]});})[_0xa42b('0x29')](handleEntityNotFound(_0x4b22bd,null))[_0xa42b('0x29')](function(_0x1e120e){if(_0x1e120e&&_0x1e120e[_0xa42b('0x88')]){_0xd0d849['account']=_0x1e120e;_0xd0d849[_0xa42b('0x8c')]=_0x1e120e[_0xa42b('0x8b')];_0xd0d849[_0xa42b('0x8d')]=_0x1e120e[_0xa42b('0x88')];_0xd0d849[_0xa42b('0x8c')]=_[_0xa42b('0x8e')](_0xd0d849['applications'],[_0xa42b('0x8f')],['asc']);if(_0xd0d849[_0xa42b('0x90')][_0xa42b('0x8b')]){delete _0xd0d849[_0xa42b('0x90')][_0xa42b('0x8b')];}if(_0xd0d849['account'][_0xa42b('0x88')]&&_0xd0d849[_0xa42b('0x90')][_0xa42b('0x88')][_0xa42b('0x89')][_0xa42b('0x37')]){return _0xd0d849['account'][_0xa42b('0x88')][_0xa42b('0x89')][0x0];}var _0x1a1dc7=_[_0xa42b('0xb')](_0x38ba41[_0xa42b('0x49')],{'firstName':_0x38ba41[_0xa42b('0x49')]['from'],'ListId':_0x1e120e[_0xa42b('0x7f')]});_0x1a1dc7[_0x38ba41['body'][_0xa42b('0x83')]]=_0x38ba41[_0xa42b('0x49')]['from'];return db[_0xa42b('0x91')][_0xa42b('0x55')](_0x1a1dc7,{'fields':_0x94e135,'raw':!![]});}})['then'](handleEntityNotFound(_0x4b22bd,null))['then'](function(_0x4a3d34){_0xd0d849[_0xa42b('0x92')]=_0x4a3d34;var _0x41ed92=_0x38ba41[_0xa42b('0x49')][_0xa42b('0x93')];if(_0x38ba41[_0xa42b('0x77')][_0xa42b('0x94')]){_0x41ed92=_0x38ba41[_0xa42b('0x77')][_0xa42b('0x94')];}else if(_0x38ba41[_0xa42b('0x77')][_0xa42b('0x95')]){_0x41ed92=_['first'](_0x38ba41[_0xa42b('0x77')][_0xa42b('0x95')][_0xa42b('0x96')](','));}if(_0x4a3d34){var _0xa723af={'ContactId':_0x4a3d34['id'],'ChatWebsiteId':_0x38ba41['params']['id'],'from':(_0x4a3d34[_0xa42b('0x97')]||'')+'\x20'+(_0x4a3d34[_0xa42b('0x98')]||''),'customerIp':_0x41ed92,'customerPort':_0x38ba41[_0xa42b('0x77')][_0xa42b('0x99')]?_0x38ba41['headers']['x-real-port']:null,'referer':_0x38ba41['body'][_0xa42b('0x9a')],'browserName':_0x30be3a[_0xa42b('0x9b')][_0xa42b('0x2a')]&&_0x30be3a['browser'][_0xa42b('0x9c')]?util[_0xa42b('0x9d')]('%s\x20%s',_0x30be3a[_0xa42b('0x9b')][_0xa42b('0x2a')],_0x30be3a[_0xa42b('0x9b')][_0xa42b('0x9c')]):_0xa42b('0x9e'),'browserVersion':_0x30be3a[_0xa42b('0x9b')][_0xa42b('0x9c')]||'unknown','osName':util[_0xa42b('0x9d')](_0xa42b('0x9f'),_0x30be3a['os'][_0xa42b('0x2a')],_0x30be3a['os'][_0xa42b('0x9c')]),'osVersion':_0x30be3a['os'][_0xa42b('0x9c')],'deviceModel':_0x30be3a[_0xa42b('0xa0')][_0xa42b('0x34')]&&_0x30be3a[_0xa42b('0xa0')][_0xa42b('0xa1')]?util['format'](_0xa42b('0xa2'),_0x30be3a[_0xa42b('0xa0')][_0xa42b('0x34')],_0x30be3a[_0xa42b('0xa0')]['vendor'],_0x30be3a[_0xa42b('0xa0')][_0xa42b('0xa3')]):null,'deviceVendor':_0x30be3a[_0xa42b('0xa0')][_0xa42b('0xa1')],'deviceType':_0x30be3a[_0xa42b('0xa0')][_0xa42b('0xa3')],'formData':JSON[_0xa42b('0x17')](_0x38ba41[_0xa42b('0x49')])};var _0x43c736={'ChatWebsiteId':_0x38ba41['params']['id'],'closed':![]};if(_0x38ba41[_0xa42b('0x49')][_0xa42b('0xa4')]){_0x43c736[_0xa42b('0xa4')]=_0x38ba41['body'][_0xa42b('0xa4')];return db[_0xa42b('0xa5')][_0xa42b('0x4e')]({'where':_0x43c736})[_0xa42b('0x29')](function(_0x554a94){if(_0x554a94){return[_0x554a94,![]];}_0xa723af[_0xa42b('0xa4')]=_0x38ba41[_0xa42b('0x49')][_0xa42b('0xa4')];_0xa723af[_0xa42b('0xa6')]=_0x38ba41[_0xa42b('0x49')]['externalUrl'];return db['ChatInteraction'][_0xa42b('0x55')](_0xa723af)['then'](function(_0x475746){return[_0x475746,!![]];});});}_0x43c736[_0xa42b('0xa7')]=_0x4a3d34['id'];if(_0x38ba41[_0xa42b('0x49')][_0xa42b('0xa8')]&&_0x38ba41['body'][_0xa42b('0xa8')]['id']){_0x43c736['id']=_0x38ba41[_0xa42b('0x49')][_0xa42b('0xa8')]['id'];return db[_0xa42b('0xa5')]['find']({'where':_0x43c736})[_0xa42b('0x29')](function(_0x36644f){if(_0x36644f){return[_0x36644f,![]];}return db['ChatInteraction']['create'](_0xa723af)[_0xa42b('0x29')](function(_0x4508ba){return[_0x4508ba,!![]];});});}return db[_0xa42b('0xa5')][_0xa42b('0x55')](_0xa723af)[_0xa42b('0x29')](function(_0x16d1ae){return[_0x16d1ae,!![]];});}})[_0xa42b('0xa9')](function(_0x18ad21,_0x5e37be){if(_0x18ad21){_0x27e25c=_0x5e37be;if(!_0x5e37be){var _0x347e60={'from':(_0xd0d849[_0xa42b('0x92')][_0xa42b('0x97')]||'')+'\x20'+(_0xd0d849[_0xa42b('0x92')][_0xa42b('0x98')]||'')};if(_0x38ba41[_0xa42b('0x49')][_0xa42b('0xa4')]&&_0x38ba41['body'][_0xa42b('0xaa')]&&_0x38ba41[_0xa42b('0x49')][_0xa42b('0xa4')]!=_0x38ba41[_0xa42b('0x49')][_0xa42b('0xaa')]){_0x347e60[_0xa42b('0xa4')]=_0x38ba41[_0xa42b('0x49')][_0xa42b('0xaa')];}return _0x18ad21[_0xa42b('0x25')](_0x347e60);}else{return _0x18ad21;}}})[_0xa42b('0x29')](function(_0x25a714){_0xd0d849[_0xa42b('0xa8')]=_0x25a714[_0xa42b('0x27')]({'plain':!![]});_0xd0d849[_0xa42b('0xa8')][_0xa42b('0xab')]=_0x27e25c;if(_0xd0d849[_0xa42b('0xa8')][_0xa42b('0xab')]){if(_0xd0d849[_0xa42b('0x90')][_0xa42b('0xac')]){_0xd0d849[_0xa42b('0x8c')][_0xa42b('0xad')]({'id':0x0,'priority':_0xd0d849[_0xa42b('0x8c')]['length']+0x1,'app':_0xa42b('0xae'),'appdata':_0xa42b('0xaf'),'interval':_0xa42b('0xb0')});}}return db[_0xa42b('0xb1')][_0xa42b('0x55')]({'body':_0x38ba41['body'][_0xa42b('0x49')],'ChatWebsiteId':_0x38ba41[_0xa42b('0x45')]['id'],'ChatInteractionId':_0x25a714['id'],'direction':'in','ContactId':_0xd0d849['contact']['id'],'AttachmentId':_0x38ba41['body'][_0xa42b('0xb2')]});})[_0xa42b('0x29')](function(_0x425e60){_0xd0d849[_0xa42b('0x1a')]=_0x425e60;if(_0xd0d849[_0xa42b('0xa8')][_0xa42b('0xb3')]){return db[_0xa42b('0xb4')][_0xa42b('0x4e')]({'attributes':['id',_0xa42b('0x2a')],'where':{'id':_0xd0d849[_0xa42b('0xa8')][_0xa42b('0xb3')]}})[_0xa42b('0x29')](function(_0x371e8c){if(_0x371e8c){_0xd0d849['applications'][_0xa42b('0xb5')]({'id':0x0,'priority':0x0,'app':_0xa42b('0xb6'),'appdata':_0x371e8c[_0xa42b('0x2a')]+','+(_0xd0d849['account'][_0xa42b('0xb7')]||0xa),'interval':_0xa42b('0xb0')});_0xd0d849[_0xa42b('0xb8')]=!![];}return respondWithRpcPromise('Start',_0xa42b('0xb9'),_0xd0d849);});}return respondWithRpcPromise(_0xa42b('0xba'),_0xa42b('0xb9'),_0xd0d849);})[_0xa42b('0x29')](function(_0x51a965){respondWithRpcPromise('EventManager',_0xa42b('0xbb'),{'event':'notify','message':_0x51a965},client9002);return _0x51a965;})['then'](respondWithResult(_0x4b22bd,null))['catch'](handleError(_0x4b22bd,null));};exports[_0xa42b('0xbc')]=function(_0x11c82b,_0x5570c9){var _0x19da34,_0x3299f8,_0x52618e;var _0x3c993a=[];var _0x1a18c2={};var _0x2e7c5f=_0x11c82b[_0xa42b('0xbd')]||[];var _0xadad39=[];var _0x465c73;return db['CmContact']['describe']()[_0xa42b('0x29')](function(_0x25b4c7){if(!_0x25b4c7){throw new db[(_0xa42b('0x7a'))][(_0xa42b('0x7b'))](_0xa42b('0xbe'));}_0x3c993a=_[_0xa42b('0x7c')](_[_0xa42b('0x46')](_0x25b4c7),[_0xa42b('0x7d'),_0xa42b('0x7e'),_0xa42b('0xbf'),_0xa42b('0x7f')]);if(_0x11c82b[_0xa42b('0x49')]['id']){delete _0x11c82b[_0xa42b('0x49')]['id'];}if(_['isNil'](_0x11c82b['body'][_0xa42b('0x80')])){throw _0x5570c9['status'](0x1f4)[_0xa42b('0x2b')](new db[(_0xa42b('0x7a'))]['ValidationError'](_0xa42b('0x81')));}if(_[_0xa42b('0x6f')](_0x11c82b[_0xa42b('0x49')][_0xa42b('0x49')])||_0x11c82b[_0xa42b('0x49')][_0xa42b('0x49')]===''){throw _0x5570c9['status'](0x1f4)[_0xa42b('0x2b')](new db['Sequelize']['ValidationError'](_0xa42b('0x82')));}if(_[_0xa42b('0x6f')](_0x11c82b[_0xa42b('0x49')][_0xa42b('0xc0')])){throw _0x5570c9[_0xa42b('0x23')](0x1f4)['send'](new db[(_0xa42b('0x7a'))]['ValidationError'](_0xa42b('0xc1')+_0x3c993a));}if(!_['includes'](_0x3c993a,_0x11c82b[_0xa42b('0x49')][_0xa42b('0xc0')])){throw _0x5570c9[_0xa42b('0x23')](0x1f4)['send'](new db['Sequelize'][(_0xa42b('0x7b'))](_0xa42b('0xc2')+_0x3c993a));}_0x1a18c2[_0x11c82b[_0xa42b('0x49')][_0xa42b('0xc0')]]=_0x11c82b['body'][_0xa42b('0x80')];})[_0xa42b('0x29')](function(){return db[_0xa42b('0x30')]['find']({'where':{'id':_0x11c82b['params']['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db['MailAccount'],'as':_0xa42b('0xc3')}]});})['then'](handleEntityNotFound(_0x5570c9,null))[_0xa42b('0x29')](function(_0x4e43ae){if(_0x4e43ae&&_0x4e43ae[_0xa42b('0x88')]){_0x3299f8=_0x4e43ae;var _0x633811=_['defaults'](_0x11c82b['body'],{'firstName':_0x11c82b['body'][_0xa42b('0x80')],'phone':_0x11c82b[_0xa42b('0x49')][_0xa42b('0x80')],'ListId':_0x4e43ae[_0xa42b('0x7f')]});_0x633811[_0x11c82b[_0xa42b('0x49')]['mapKeyOffline']]=_0x11c82b[_0xa42b('0x49')]['from'];return db[_0xa42b('0x91')]['findOrCreate']({'where':_0x1a18c2,'defaults':_0x633811});}})[_0xa42b('0xa9')](function(_0x50683d){if(_0x50683d){_0x52618e=_0x50683d;var _0x53138d=fs[_0xa42b('0xc4')](path[_0xa42b('0x66')](config[_0xa42b('0x67')],_0xa42b('0xc5')),_0xa42b('0xc6'));var _0x19dae6=ejs['render'](_0x53138d,{'body':_[_0xa42b('0xc7')](_0x11c82b['body'][_0xa42b('0x49')]),'bodyTitle':_0x3299f8[_0xa42b('0xc8')]});return db[_0xa42b('0xc9')]['create']({'body':_0x19dae6,'plainBody':htmlToText[_0xa42b('0xca')](_0x19dae6),'ContactId':_0x50683d['id'],'ChatWebsiteId':_0x3299f8['id']});}})[_0xa42b('0x29')](function(_0x58d7b1){_0x465c73=_0x58d7b1;if(_0x2e7c5f[_0xa42b('0x37')]){var _0x5ba11a=_0x2e7c5f[_0xa42b('0x2f')](function(_0x1deb4d){return{'name':_0x1deb4d[_0xa42b('0xcb')],'basename':_0x1deb4d[_0xa42b('0x62')],'type':_0x1deb4d[_0xa42b('0xcc')],'ChatOfflineMessageId':_0x58d7b1['id']};});_0xadad39=_0x5ba11a[_0xa42b('0x2f')](_0x4b4fc0=>{var _0x203d06={'filename':_0x4b4fc0[_0xa42b('0x2a')],'path':path[_0xa42b('0x66')](config['root'],_0xa42b('0xcd'),'files','attachments',_0xa42b('0xce'),_0x4b4fc0['basename'])};return _0x203d06;});if(!_0x3299f8[_0xa42b('0xcf')]){return db[_0xa42b('0xd0')]['transaction'](function(_0x2966b7){return db[_0xa42b('0xd1')]['bulkCreate'](_0x5ba11a,{'transaction':_0x2966b7});});}}})[_0xa42b('0x29')](function(){if(_0x465c73){_0x19da34=_0x465c73;return db[_0xa42b('0xc3')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xa42b('0xd2')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xa42b('0xd3')],'as':_0xa42b('0xd3'),'raw':!![]}]}]});}})[_0xa42b('0x29')](function(_0x14e573){if(_0x14e573&&_0x14e573['Smtp']&&_0x3299f8[_0xa42b('0xd4')]&&_0x3299f8['forwardOfflineAddress']){var _0x281986=_0x14e573[_0xa42b('0xd5')]();return respondWithRpcPromise(_0xa42b('0xd6'),_0xa42b('0xd7'),{'account':_0x281986,'message':{'from':util[_0xa42b('0x9d')](_0xa42b('0xd8'),_0x14e573['name'],_0x14e573[_0xa42b('0xd9')]||_0x14e573[_0xa42b('0xda')][_0xa42b('0x4a')]),'to':_0x3299f8['forwardOfflineAddress'],'subject':_0x3299f8['offlineMessageSubject'],'html':_0x19da34[_0xa42b('0x49')],'attachments':_0xadad39}},client9003)['then'](function(){return _0x19da34;})[_0xa42b('0x1b')](function(_0xbae89c){logger[_0xa42b('0x18')](_0xbae89c);});}})[_0xa42b('0x29')](function(){if(_0x3299f8&&_0x3299f8[_0xa42b('0xcf')]&&_0x3299f8[_0xa42b('0xdb')]){var _0x45c4d5=[];if(_0x2e7c5f[_0xa42b('0x37')]){_0x45c4d5=_0x2e7c5f['map'](function(_0x46a09b){return{'name':_0x46a09b[_0xa42b('0xcb')],'basename':_0x46a09b[_0xa42b('0x62')],'type':_0x46a09b[_0xa42b('0xcc')],'ChatOfflineMessageId':_0x465c73['id']};});}var _0x20a458;if(!_[_0xa42b('0x6f')](_0x3299f8['subjectOffline'])){var _0x341d49=_[_0xa42b('0x2f')](_0x11c82b[_0xa42b('0x49')],function(_0x5461b7){return _0x5461b7;});var _0x245e16=_['toPairsIn'](_0x341d49)[0x0];var _0xcfa3ab=_['mapValues'](_0x245e16,function(_0x21c186){return _0x21c186;});_0x20a458=_0xcfa3ab[0x1][_0x3299f8['subjectOffline']];}var _0x1e8cf9={'from':_0x52618e[_0xa42b('0xd9')],'firstName':_0x52618e['firstName'],'lastName':_0x52618e[_0xa42b('0x98')],'mapKey':_0xa42b('0xd9'),'message':{'from':_0x52618e[_0xa42b('0xd9')],'to':_0x3299f8[_0xa42b('0xc3')][_0xa42b('0xd9')],'cc':'','subject':_[_0xa42b('0x6f')](_0x20a458)?_0x3299f8['offlineMessageSubject']:_0x20a458,'messageId':'','sentAt':new Date(),'attach':_0x45c4d5[_0xa42b('0x37')],'attachments':_0x45c4d5,'originChannel':_0xa42b('0xdc'),'ChatWebsiteId':_0x3299f8['id'],'ChatOfflineMessageId':_0x19da34['id'],'originTo':_0x3299f8['MailAccount']['email']},'body':_0x19da34['body']};var _0x2d4ee2={'account':{'id':_0x3299f8['MailAccountId']},'body':_0x1e8cf9,'log':_0xa42b('0xdd')};return respondWithRpcPromise(_0xa42b('0xdd'),_0xa42b('0xde'),_0x2d4ee2,client9001)[_0xa42b('0x29')](function(){return _0x19da34;})[_0xa42b('0x1b')](function(_0x4460e7){logger[_0xa42b('0x18')](_0x4460e7);});}return;})[_0xa42b('0x29')](function(){if(_0x19da34){return _0x19da34;}})[_0xa42b('0x29')](respondWithResult(_0x5570c9,null))[_0xa42b('0x1b')](function(_0x3a341e){logger[_0xa42b('0x18')](_0xa42b('0x1b'),_0x3a341e);for(var _0x19eefb of _0x2e7c5f){var _0x2f2396=path['join'](config[_0xa42b('0x67')],_0xa42b('0xcd'),_0xa42b('0xbd'),'attachments','offline-chat',_0x19eefb[_0xa42b('0x62')]);fs_extra[_0xa42b('0xdf')](_0x2f2396)['catch'](function(_0x5d90dc){logger[_0xa42b('0x18')]('Could\x20not\x20remove\x20attachment\x20file',_0x2f2396,_0x5d90dc);});}});};exports[_0xa42b('0xe0')]=function(_0x268215,_0x3f0b52){return db[_0xa42b('0xa5')][_0xa42b('0x4e')]({'where':{'id':_0x268215[_0xa42b('0x45')]['id']}})[_0xa42b('0x29')](handleEntityNotFound(_0x3f0b52,null))[_0xa42b('0x29')](function(_0x2cffe5){if(_0x2cffe5){return _0x2cffe5[_0xa42b('0xe0')](_0x268215['body'][_0xa42b('0x59')],_[_0xa42b('0xe1')](_0x268215[_0xa42b('0x49')],[_0xa42b('0x59'),'id'])||{});}})[_0xa42b('0x29')](respondWithResult(_0x3f0b52,null))[_0xa42b('0x1b')](handleError(_0x3f0b52,null));};exports[_0xa42b('0xe2')]=function(_0x25ed7e,_0x544015){var _0x1f3308={'raw':![],'where':{}};var _0x2dc3c0={};var _0x54fb74={'count':0x0,'rows':[]};return db[_0xa42b('0x30')][_0xa42b('0x5c')]({'where':{'id':_0x25ed7e[_0xa42b('0x45')]['id']}})['then'](handleEntityNotFound(_0x544015,null))[_0xa42b('0x29')](function(_0x47da31){if(_0x47da31){_0x2dc3c0[_0xa42b('0x34')]=_[_0xa42b('0x46')](db['ChatInteraction']['rawAttributes']);_0x2dc3c0['query']=_['keys'](_0x25ed7e[_0xa42b('0x33')]);_0x2dc3c0[_0xa42b('0x3c')]=_[_0xa42b('0x48')](_0x2dc3c0[_0xa42b('0x34')],_0x2dc3c0[_0xa42b('0x33')]);_0x1f3308[_0xa42b('0x35')]=_[_0xa42b('0x48')](_0x2dc3c0[_0xa42b('0x34')],qs[_0xa42b('0x36')](_0x25ed7e['query']['fields']));_0x1f3308[_0xa42b('0x35')]=_0x1f3308[_0xa42b('0x35')]['length']?_0x1f3308[_0xa42b('0x35')]:_0x2dc3c0['model'];if(!_0x25ed7e[_0xa42b('0x33')][_0xa42b('0x38')](_0xa42b('0x56'))){_0x1f3308['limit']=qs[_0xa42b('0x21')](_0x25ed7e[_0xa42b('0x33')]['limit']);_0x1f3308[_0xa42b('0x1f')]=qs[_0xa42b('0x1f')](_0x25ed7e[_0xa42b('0x33')][_0xa42b('0x1f')]);}_0x1f3308['order']=qs[_0xa42b('0x39')](_0x25ed7e[_0xa42b('0x33')][_0xa42b('0x39')]);_0x1f3308['where']=qs[_0xa42b('0x3c')](_[_0xa42b('0x3b')](_0x25ed7e[_0xa42b('0x33')],_0x2dc3c0[_0xa42b('0x3c')]));_0x1f3308[_0xa42b('0x3a')]['ChatWebsiteId']=_0x47da31['id'];if(_0x25ed7e[_0xa42b('0x33')][_0xa42b('0x3d')]){_0x1f3308[_0xa42b('0x3a')]=_['merge'](_0x1f3308[_0xa42b('0x3a')],{'$or':_[_0xa42b('0x2f')](_0x1f3308['attributes'],function(_0x59b79e){var _0x58bf24={};_0x58bf24[_0x59b79e]={'$like':'%'+_0x25ed7e[_0xa42b('0x33')]['filter']+'%'};return _0x58bf24;})});}_0x1f3308=_[_0xa42b('0x3e')]({},_0x1f3308,_0x25ed7e[_0xa42b('0x40')]);return db[_0xa42b('0xa5')][_0xa42b('0x22')]({'where':_0x1f3308[_0xa42b('0x3a')]})[_0xa42b('0x29')](function(_0x5aabe2){_0x54fb74[_0xa42b('0x22')]=_0x5aabe2;if(_0x25ed7e[_0xa42b('0x33')][_0xa42b('0x41')]){_0x1f3308['include']=[{'model':db[_0xa42b('0x91')],'as':_0xa42b('0xe3'),'required':![]},{'model':db[_0xa42b('0xb4')],'as':_0xa42b('0xe4'),'attributes':[_0xa42b('0x2a'),'fullname',_0xa42b('0xe5')],'required':![]},{'model':db[_0xa42b('0xe6')],'as':'Tags','attributes':['id',_0xa42b('0x2a'),_0xa42b('0xe7')],'where':_0x25ed7e['query']['tag']?{'id':_0x25ed7e['query'][_0xa42b('0xe8')]}:undefined,'required':_0x25ed7e[_0xa42b('0x33')][_0xa42b('0xe8')]?!![]:![]}];}return db[_0xa42b('0xa5')]['findAll'](_0x1f3308);})['then'](function(_0x26165b){_0x54fb74[_0xa42b('0x43')]=_0x26165b;return _0x54fb74;});}})[_0xa42b('0x29')](respondWithFilteredResult(_0x544015,_0x1f3308))[_0xa42b('0x1b')](handleError(_0x544015,null));};function iftimePromise(_0x1e112b,_0x36d352){return respondWithRpcPromise(_0xa42b('0xe9'),_0xa42b('0xea'),{'command':_0x36d352[_0xa42b('0xeb')]?util[_0xa42b('0x9d')](_0xa42b('0xec'),_0x1e112b[_0xa42b('0xed')],_0x36d352[_0xa42b('0xeb')]):util[_0xa42b('0x9d')](_0xa42b('0xee'),_0x1e112b[_0xa42b('0xed')])},client9002)['then'](function(_0x2c422e){var _0x58b709=_0x2c422e&&_0x2c422e['indexOf'](_0xa42b('0xef'))>=0x0?!![]:![];logger[_0xa42b('0x13')](_0xa42b('0xf0'),_0x36d352['id'],_0x1e112b['id'],_0x1e112b[_0xa42b('0xed')],_0x58b709?_0xa42b('0xf1'):_0xa42b('0xf2'),_0x36d352[_0xa42b('0xeb')]?_0x36d352[_0xa42b('0xeb')]:_0xa42b('0xf3'));return _0x58b709;})[_0xa42b('0x1b')](function(_0x13ac21){logger['error'](_0xa42b('0xf0'),_0x36d352['id'],_0x1e112b['id'],_0x1e112b[_0xa42b('0xed')],util[_0xa42b('0xf4')](_0x13ac21,{'showHidden':![],'depth':null}),_0x36d352[_0xa42b('0xeb')]?_0x36d352['timezone']:_0xa42b('0xf3'));return![];});}exports[_0xa42b('0xea')]=function(_0x22405c,_0x40279d){var _0xf32098=0x0;var _0x2ed4b0=0x0;var _0x39e331=![];var _0x52bb6e;var _0x465757;return db[_0xa42b('0x30')][_0xa42b('0x4e')]({'where':{'id':_0x22405c[_0xa42b('0x45')]['id']},'include':[{'model':db[_0xa42b('0xf5')],'as':'Interval','include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0xa42b('0xed')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x40279d,null))['then'](function(_0x1c48b9){if(_0x1c48b9){_0x52bb6e=_0x1c48b9;return _0x1c48b9[_0xa42b('0xf6')]({'raw':!![]});}})['then'](function(_0x34a8b2){if(_0x52bb6e){if(_0x34a8b2){_0x465757=_0x34a8b2;}}return require(_0xa42b('0x69'))[_0xa42b('0x6a')]();})[_0xa42b('0x29')](function(_0x29086c){if(_0x29086c){_0x2ed4b0=_0x29086c['virtual'];_0x39e331=_0x29086c[_0xa42b('0x6b')];}})[_0xa42b('0x29')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0xa42b('0x29')](function(_0x591ffb){_0xf32098=_0x591ffb;if(_0x2ed4b0&&_0x591ffb>_0x2ed4b0){return db[_0xa42b('0xf7')][_0xa42b('0x5c')]({'where':{'id':0x1}})[_0xa42b('0x29')](function(_0x325bbc){if(_0x325bbc){_0x325bbc[_0xa42b('0xf8')](_0xa42b('0xf9'));}});}})[_0xa42b('0x29')](function(){if(_0x52bb6e['Interval']&&_0x52bb6e[_0xa42b('0xf5')][_0xa42b('0xfa')]){var _0x2b92dc=[];for(var _0x219e3=0x0;_0x219e3<_0x52bb6e['Interval'][_0xa42b('0xfa')][_0xa42b('0x37')];_0x219e3++){var _0x4b8b16=_0x52bb6e[_0xa42b('0xf5')][_0xa42b('0xfa')][_0x219e3][_0xa42b('0x27')]({'plain':!![]});_0x2b92dc[_0xa42b('0xad')](iftimePromise(_0x4b8b16,_0x52bb6e));}return BPromise[_0xa42b('0xfb')](_0x2b92dc)[_0xa42b('0x29')](function(_0x4e2db3){return _['some'](_0x4e2db3);});}else{return!![];}})[_0xa42b('0x29')](function(_0xf82047){var _0x5c12ea=fs[_0xa42b('0xc4')](path['join'](config[_0xa42b('0x67')],'server/files/chat/iframe.ejs'),'utf8');var _0x310510=new url[(_0xa42b('0xfc'))](_0x52bb6e[_0xa42b('0xfd')])[_0xa42b('0xfe')];var _0x921762=_0xa42b('0xff');var _0x5b794e=![];var _0x108d40={'chatVersion':_0x921762,'chatWebsiteAddressOrigin':_0x310510,'remote':_0x52bb6e[_0xa42b('0x100')],'query':querystring[_0xa42b('0x17')](_[_0xa42b('0x3e')](_0x52bb6e[_0xa42b('0x27')]({'plain':!![]}),{'customerIp':_0x22405c[_0xa42b('0x77')]['x-forwarded-for']||_0x22405c[_0xa42b('0x77')][_0xa42b('0x101')]||_0x22405c['connection'][_0xa42b('0x102')]||_0x22405c['ip'],'referer':_0x22405c[_0xa42b('0x77')][_0xa42b('0x9a')],'openedInteractions':_0xf32098,'maxInteractions':_0x2ed4b0,'virtual':_0x39e331[_0xa42b('0x103')],'online':_0xf82047,'custom':_0x39e331}))[_0xa42b('0x104')](/'/g,'\x5c\x27')};_0x40279d['send'](ejs[_0xa42b('0x105')](Mustache[_0xa42b('0x105')](_0x5c12ea,_0x108d40),{'proactiveActions':_0x465757,'alignment':_0x52bb6e[_0xa42b('0x106')],'verticalAlignment':_0x52bb6e[_0xa42b('0x107')],'div_color':_0x52bb6e[_0xa42b('0xe7')],'labelText':_0x52bb6e[_0xa42b('0x108')],'text_color':_0x52bb6e[_0xa42b('0x109')],'text_button_color':_0x52bb6e[_0xa42b('0x10a')],'button_color':_0x52bb6e[_0xa42b('0x10b')],'background_color':_0x52bb6e['backgroundColor'],'hideWhenOffline':_0x52bb6e[_0xa42b('0x10c')],'intervalId':_0x52bb6e['IntervalId'],'isDevelopment':_0x5b794e,'chatVersion':_0x921762}));})[_0xa42b('0x1b')](handleError(_0x40279d,null));};exports[_0xa42b('0x10d')]=function(_0x375b77,_0x56e8e1){var _0xaf6578=_0x375b77[_0xa42b('0x45')]['id'];var _0x73efd0=_0x375b77[_0xa42b('0x49')];var _0x20df5c=0xc8;var _0x3c9e2c=null;return db[_0xa42b('0xd0')][_0xa42b('0x10e')]({'isolationLevel':db[_0xa42b('0xd0')][_0xa42b('0x10f')][_0xa42b('0x110')][_0xa42b('0x111')]},function(_0x54709e){return db['ChatWebsite'][_0xa42b('0x5c')]({'where':{'id':_0xaf6578},'transaction':_0x54709e})['then'](function(_0x277c86){if(_0x277c86){return db[_0xa42b('0x8a')][_0xa42b('0x26')]({'where':{'ChatWebsiteId':_0xaf6578},'transaction':_0x54709e})[_0xa42b('0x29')](function(){var _0x28a150=_[_0xa42b('0x2f')](_0x73efd0,function(_0x1e02a7){_0x1e02a7['ChatWebsiteId']=_0xaf6578;return _0x1e02a7;});return db['ChatApplication']['bulkCreate'](_0x28a150,{'transaction':_0x54709e});});}else{_0x20df5c=0x194;_0x3c9e2c=[];}});})[_0xa42b('0x29')](function(){if(_0x20df5c!==0x194){return db[_0xa42b('0x8a')]['findAndCountAll']({'where':{'ChatWebsiteId':_0xaf6578},'order':_0xa42b('0x8f')})[_0xa42b('0x29')](function(_0x146f9b){_0x3c9e2c=_0x146f9b;});}})[_0xa42b('0x1b')](function(_0x1e1223){_0x20df5c=0x1f4;logger['error'](_0x1e1223[_0xa42b('0x112')]);if(_0x1e1223[_0xa42b('0x2a')]){delete _0x1e1223['name'];}_0x3c9e2c=_0x1e1223;})['finally'](function(){if(_0x3c9e2c===null){_0x56e8e1[_0xa42b('0x1c')](_0x20df5c);}else{if(_0x20df5c===0x1f4){_0x56e8e1[_0xa42b('0x23')](_0x20df5c)[_0xa42b('0x2b')](_0x3c9e2c);}else{_0x56e8e1[_0xa42b('0x23')](_0x20df5c)[_0xa42b('0x1e')](_0x3c9e2c);}}});};exports['getApplications']=function(_0x36b220,_0x3458c0){var _0x39a2f2={};var _0x3b2482={};var _0x3fa958;var _0x5379b4;return db[_0xa42b('0x30')]['findOne']({'where':{'id':_0x36b220[_0xa42b('0x45')]['id']}})[_0xa42b('0x29')](handleEntityNotFound(_0x3458c0,null))[_0xa42b('0x29')](function(_0x392831){if(_0x392831){_0x3fa958=_0x392831;_0x3b2482[_0xa42b('0x34')]=_['keys'](db[_0xa42b('0x8a')][_0xa42b('0x47')]);_0x3b2482[_0xa42b('0x33')]=_[_0xa42b('0x46')](_0x36b220[_0xa42b('0x33')]);_0x3b2482[_0xa42b('0x3c')]=_[_0xa42b('0x48')](_0x3b2482[_0xa42b('0x34')],_0x3b2482[_0xa42b('0x33')]);_0x39a2f2['attributes']=_[_0xa42b('0x48')](_0x3b2482[_0xa42b('0x34')],qs[_0xa42b('0x36')](_0x36b220[_0xa42b('0x33')][_0xa42b('0x36')]));_0x39a2f2['attributes']=_0x39a2f2['attributes'][_0xa42b('0x37')]?_0x39a2f2[_0xa42b('0x35')]:_0x3b2482['model'];_0x39a2f2[_0xa42b('0x57')]=qs['sort'](_0x36b220[_0xa42b('0x33')][_0xa42b('0x39')]);_0x39a2f2[_0xa42b('0x3a')]=qs['filters'](_[_0xa42b('0x3b')](_0x36b220[_0xa42b('0x33')],_0x3b2482[_0xa42b('0x3c')]));if(_0x36b220[_0xa42b('0x33')][_0xa42b('0x3d')]){_0x39a2f2['where']=_[_0xa42b('0x3e')](_0x39a2f2[_0xa42b('0x3a')],{'$or':_[_0xa42b('0x2f')](_0x39a2f2['attributes'],function(_0x494074){var _0x14527f={};_0x14527f[_0x494074]={'$like':'%'+_0x36b220[_0xa42b('0x33')][_0xa42b('0x3d')]+'%'};return _0x14527f;})});}_0x39a2f2=_['merge']({},_0x39a2f2,_0x36b220[_0xa42b('0x40')]);return _0x3fa958['getApplications'](_0x39a2f2);}})['then'](function(_0x3ba503){if(_0x3ba503){_0x5379b4=_0x3ba503[_0xa42b('0x37')];if(!_0x36b220[_0xa42b('0x33')][_0xa42b('0x38')]('nolimit')){_0x39a2f2[_0xa42b('0x21')]=qs['limit'](_0x36b220[_0xa42b('0x33')][_0xa42b('0x21')]);_0x39a2f2[_0xa42b('0x1f')]=qs['offset'](_0x36b220[_0xa42b('0x33')][_0xa42b('0x1f')]);}return _0x3fa958['getApplications'](_0x39a2f2);}})[_0xa42b('0x29')](function(_0x354e7a){if(_0x354e7a){return _0x354e7a?{'count':_0x5379b4,'rows':_0x354e7a}:null;}})[_0xa42b('0x29')](respondWithResult(_0x3458c0,null))[_0xa42b('0x1b')](handleError(_0x3458c0,null));};exports[_0xa42b('0x113')]=function(_0x339af8,_0xe3c5fe){return db['chatProactiveAction'][_0xa42b('0x4e')]({'where':{'id':_0x339af8[_0xa42b('0x45')]['id']}})[_0xa42b('0x29')](handleEntityNotFound(_0xe3c5fe,null))[_0xa42b('0x29')](function(_0x198c74){if(_0x198c74){return _0x198c74['addProactiveActions'](_0x339af8[_0xa42b('0x49')][_0xa42b('0x59')],_[_0xa42b('0xe1')](_0x339af8[_0xa42b('0x49')],[_0xa42b('0x59'),'id'])||{});}})[_0xa42b('0x29')](respondWithResult(_0xe3c5fe,null))[_0xa42b('0x1b')](handleError(_0xe3c5fe,null));};exports[_0xa42b('0xf6')]=function(_0x6f0045,_0x40ae9b){var _0x35b466={};var _0x42fd78={};var _0x2d0b22;var _0x178353;return db[_0xa42b('0x30')][_0xa42b('0x5c')]({'where':{'id':_0x6f0045[_0xa42b('0x45')]['id']}})[_0xa42b('0x29')](handleEntityNotFound(_0x40ae9b,null))[_0xa42b('0x29')](function(_0x16e8a0){if(_0x16e8a0){_0x2d0b22=_0x16e8a0;_0x42fd78[_0xa42b('0x34')]=_[_0xa42b('0x46')](db[_0xa42b('0x114')]['rawAttributes']);_0x42fd78['query']=_[_0xa42b('0x46')](_0x6f0045[_0xa42b('0x33')]);_0x42fd78[_0xa42b('0x3c')]=_[_0xa42b('0x48')](_0x42fd78['model'],_0x42fd78[_0xa42b('0x33')]);_0x35b466[_0xa42b('0x35')]=_[_0xa42b('0x48')](_0x42fd78[_0xa42b('0x34')],qs['fields'](_0x6f0045[_0xa42b('0x33')][_0xa42b('0x36')]));_0x35b466['attributes']=_0x35b466['attributes'][_0xa42b('0x37')]?_0x35b466[_0xa42b('0x35')]:_0x42fd78[_0xa42b('0x34')];_0x35b466[_0xa42b('0x57')]=qs[_0xa42b('0x39')](_0x6f0045[_0xa42b('0x33')]['sort']);_0x35b466['where']=qs['filters'](_[_0xa42b('0x3b')](_0x6f0045[_0xa42b('0x33')],_0x42fd78[_0xa42b('0x3c')]));if(_0x6f0045[_0xa42b('0x33')][_0xa42b('0x3d')]){_0x35b466[_0xa42b('0x3a')]=_[_0xa42b('0x3e')](_0x35b466['where'],{'$or':_['map'](_0x35b466[_0xa42b('0x35')],function(_0x55e5df){var _0x3f5d39={};_0x3f5d39[_0x55e5df]={'$like':'%'+_0x6f0045[_0xa42b('0x33')][_0xa42b('0x3d')]+'%'};return _0x3f5d39;})});}_0x35b466=_[_0xa42b('0x3e')]({},_0x35b466,_0x6f0045[_0xa42b('0x40')]);return _0x2d0b22[_0xa42b('0xf6')](_0x35b466);}})[_0xa42b('0x29')](function(_0x271f90){if(_0x271f90){_0x178353=_0x271f90[_0xa42b('0x37')];if(!_0x6f0045['query']['hasOwnProperty'](_0xa42b('0x56'))){_0x35b466[_0xa42b('0x21')]=qs[_0xa42b('0x21')](_0x6f0045[_0xa42b('0x33')][_0xa42b('0x21')]);_0x35b466[_0xa42b('0x1f')]=qs[_0xa42b('0x1f')](_0x6f0045[_0xa42b('0x33')]['offset']);}return _0x2d0b22[_0xa42b('0xf6')](_0x35b466);}})['then'](function(_0xe20c5b){if(_0xe20c5b){return _0xe20c5b?{'count':_0x178353,'rows':_0xe20c5b}:null;}})['then'](respondWithResult(_0x40ae9b,null))['catch'](handleError(_0x40ae9b,null));};exports[_0xa42b('0x115')]=function(_0x56938d,_0x2e4343){var _0xbbcbf3=_0x56938d[_0xa42b('0x33')][_0xa42b('0x116')]==='false'?_0xa42b('0x117'):'onlineForm';return db[_0xa42b('0x30')][_0xa42b('0x4e')]({'attributes':['id',_0xbbcbf3],'where':{'id':_0x56938d[_0xa42b('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e4343,null))[_0xa42b('0x29')](function(_0x1ca25b){if(_0x1ca25b){var _0x3d97d5=_0x1ca25b[_0xbbcbf3];var _0x5b60ce=_0x3d97d5&&_0x3d97d5['items']?_0x3d97d5[_0xa42b('0x118')]:[];_0x2e4343['send']({'fromKey':_['isNil'](_0x3d97d5[_0xa42b('0x119')])?undefined:_0x3d97d5[_0xa42b('0x119')],'count':_0x5b60ce['length'],'rows':_0x5b60ce});}})[_0xa42b('0x1b')](handleError(_0x2e4343,null));};exports[_0xa42b('0x11a')]=function(_0x5375c8,_0x2686dd){var _0x70e7cc={'raw':![],'where':{}};var _0x54338f={};var _0x4e3cbf={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xa42b('0x5c')]({'where':{'id':_0x5375c8[_0xa42b('0x45')]['id']}})[_0xa42b('0x29')](handleEntityNotFound(_0x2686dd,null))['then'](function(_0x5577bb){if(_0x5577bb){_0x54338f[_0xa42b('0x34')]=_[_0xa42b('0x46')](db[_0xa42b('0xc9')][_0xa42b('0x47')]);_0x54338f['query']=_[_0xa42b('0x46')](_0x5375c8[_0xa42b('0x33')]);_0x54338f['filters']=_[_0xa42b('0x48')](_0x54338f['model'],_0x54338f[_0xa42b('0x33')]);_0x70e7cc[_0xa42b('0x35')]=_[_0xa42b('0x48')](_0x54338f[_0xa42b('0x34')],qs[_0xa42b('0x36')](_0x5375c8[_0xa42b('0x33')][_0xa42b('0x36')]));_0x70e7cc['attributes']=_0x70e7cc[_0xa42b('0x35')][_0xa42b('0x37')]?_0x70e7cc[_0xa42b('0x35')]:_0x54338f[_0xa42b('0x34')];if(!_0x5375c8['query'][_0xa42b('0x38')](_0xa42b('0x56'))){_0x70e7cc['limit']=qs[_0xa42b('0x21')](_0x5375c8[_0xa42b('0x33')]['limit']);_0x70e7cc['offset']=qs[_0xa42b('0x1f')](_0x5375c8[_0xa42b('0x33')][_0xa42b('0x1f')]);}_0x70e7cc[_0xa42b('0x57')]=qs[_0xa42b('0x39')](_0x5375c8['query'][_0xa42b('0x39')]);_0x70e7cc[_0xa42b('0x3a')]=qs[_0xa42b('0x3c')](_[_0xa42b('0x3b')](_0x5375c8['query'],_0x54338f[_0xa42b('0x3c')]));_0x70e7cc[_0xa42b('0x3a')][_0xa42b('0x53')]=_0x5577bb['id'];if(_0x5375c8[_0xa42b('0x33')][_0xa42b('0x3d')]){_0x70e7cc[_0xa42b('0x3a')]=_['merge'](_0x70e7cc[_0xa42b('0x3a')],{'$or':_[_0xa42b('0x2f')](_0x70e7cc[_0xa42b('0x35')],function(_0x10f033){var _0x5991d0={};_0x5991d0[_0x10f033]={'$like':'%'+_0x5375c8[_0xa42b('0x33')][_0xa42b('0x3d')]+'%'};return _0x5991d0;})});}_0x70e7cc=_[_0xa42b('0x3e')]({},_0x70e7cc,_0x5375c8['options']);return db[_0xa42b('0xc9')][_0xa42b('0x22')]({'where':_0x70e7cc['where']})[_0xa42b('0x29')](function(_0x174a7d){_0x4e3cbf[_0xa42b('0x22')]=_0x174a7d;if(_0x5375c8[_0xa42b('0x33')][_0xa42b('0x41')]){_0x70e7cc[_0xa42b('0x5d')]=[{'all':!![]}];}else{_0x70e7cc[_0xa42b('0x5d')]=[{'model':db[_0xa42b('0x91')],'as':_0xa42b('0xe3'),'required':![]},{'model':db[_0xa42b('0xd1')],'as':_0xa42b('0x11b'),'required':![]}];}return db[_0xa42b('0xc9')][_0xa42b('0x42')](_0x70e7cc);})[_0xa42b('0x29')](function(_0x52cded){_0x4e3cbf['rows']=_0x52cded;return _0x4e3cbf;});}})[_0xa42b('0x29')](respondWithFilteredResult(_0x2686dd,_0x70e7cc))[_0xa42b('0x1b')](handleError(_0x2686dd,null));};exports[_0xa42b('0x11c')]=function(_0x500b3d,_0x2f42a2){return db['ChatWebsite'][_0xa42b('0x4e')]({'where':{'id':_0x500b3d[_0xa42b('0x45')]['id']}})[_0xa42b('0x29')](handleEntityNotFound(_0x2f42a2,null))[_0xa42b('0x29')](function(_0x5e361d){if(_0x5e361d){return _0x5e361d[_0xa42b('0x11c')](_0x500b3d[_0xa42b('0x49')]['ids'],_[_0xa42b('0xe1')](_0x500b3d[_0xa42b('0x49')],[_0xa42b('0x59'),'id'])||{})[_0xa42b('0xa9')](function(_0x4f28a9){for(var _0x56aabe=0x0;_0x56aabe<_0x500b3d[_0xa42b('0x49')][_0xa42b('0x59')]['length'];_0x56aabe+=0x1){socket[_0xa42b('0x11d')](_0xa42b('0x11e'),{'UserId':Number(_0x500b3d[_0xa42b('0x49')]['ids'][_0x56aabe]),'ChatWebsiteId':Number(_0x500b3d[_0xa42b('0x45')]['id'])});}return _0x4f28a9;});}})['then'](respondWithResult(_0x2f42a2,null))['catch'](handleError(_0x2f42a2,null));};exports[_0xa42b('0x11f')]=function(_0x1efecd,_0x528318){return db[_0xa42b('0x30')][_0xa42b('0x4e')]({'where':{'id':_0x1efecd[_0xa42b('0x45')]['id']}})[_0xa42b('0x29')](handleEntityNotFound(_0x528318,null))[_0xa42b('0x29')](function(_0x502131){if(_0x502131){return _0x502131['removeAgents'](_0x1efecd['query'][_0xa42b('0x59')])[_0xa42b('0x29')](function(){if(_[_0xa42b('0x120')](_0x1efecd[_0xa42b('0x33')][_0xa42b('0x59')])){for(var _0x32ebf=0x0;_0x32ebf<_0x1efecd[_0xa42b('0x33')]['ids'][_0xa42b('0x37')];_0x32ebf+=0x1){socket[_0xa42b('0x11d')]('userChatWebsite:remove',{'UserId':Number(_0x1efecd[_0xa42b('0x33')][_0xa42b('0x59')][_0x32ebf]),'ChatWebsiteId':Number(_0x1efecd[_0xa42b('0x45')]['id'])});}}else{socket[_0xa42b('0x11d')](_0xa42b('0x121'),{'UserId':Number(_0x1efecd['query'][_0xa42b('0x59')]),'ChatWebsiteId':Number(_0x1efecd[_0xa42b('0x45')]['id'])});}});}})[_0xa42b('0x29')](respondWithStatusCode(_0x528318,null))['catch'](handleError(_0x528318,null));};exports[_0xa42b('0x122')]=function(_0x3fa1f4,_0x5bdfb6){var _0x2afa44={};var _0x447d39={};var _0x21331c;var _0x557c32;return db['ChatWebsite'][_0xa42b('0x5c')]({'where':{'id':_0x3fa1f4['params']['id']}})[_0xa42b('0x29')](handleEntityNotFound(_0x5bdfb6,null))[_0xa42b('0x29')](function(_0x3ed4d5){if(_0x3ed4d5){_0x21331c=_0x3ed4d5;_0x447d39[_0xa42b('0x34')]=_[_0xa42b('0x46')](db['User'][_0xa42b('0x47')]);_0x447d39[_0xa42b('0x33')]=_[_0xa42b('0x46')](_0x3fa1f4['query']);_0x447d39[_0xa42b('0x3c')]=_['intersection'](_0x447d39[_0xa42b('0x34')],_0x447d39['query']);_0x2afa44[_0xa42b('0x35')]=_[_0xa42b('0x48')](_0x447d39[_0xa42b('0x34')],qs[_0xa42b('0x36')](_0x3fa1f4['query'][_0xa42b('0x36')]));_0x2afa44[_0xa42b('0x35')]=_0x2afa44[_0xa42b('0x35')][_0xa42b('0x37')]?_0x2afa44[_0xa42b('0x35')]:_0x447d39[_0xa42b('0x34')];_0x2afa44[_0xa42b('0x57')]=qs[_0xa42b('0x39')](_0x3fa1f4['query'][_0xa42b('0x39')]);_0x2afa44['where']=qs['filters'](_[_0xa42b('0x3b')](_0x3fa1f4[_0xa42b('0x33')],_0x447d39[_0xa42b('0x3c')]));if(_0x3fa1f4[_0xa42b('0x33')][_0xa42b('0x3d')]){_0x2afa44['where']=_['merge'](_0x2afa44[_0xa42b('0x3a')],{'$or':_['map'](_0x2afa44['attributes'],function(_0x5adbfc){var _0x46076b={};_0x46076b[_0x5adbfc]={'$like':'%'+_0x3fa1f4['query'][_0xa42b('0x3d')]+'%'};return _0x46076b;})});}_0x2afa44=_[_0xa42b('0x3e')]({},_0x2afa44,_0x3fa1f4[_0xa42b('0x40')]);return _0x21331c[_0xa42b('0x122')](_0x2afa44);}})[_0xa42b('0x29')](function(_0x2c9212){if(_0x2c9212){_0x557c32=_0x2c9212[_0xa42b('0x37')];if(!_0x3fa1f4[_0xa42b('0x33')]['hasOwnProperty'](_0xa42b('0x56'))){_0x2afa44[_0xa42b('0x21')]=qs[_0xa42b('0x21')](_0x3fa1f4[_0xa42b('0x33')]['limit']);_0x2afa44[_0xa42b('0x1f')]=qs[_0xa42b('0x1f')](_0x3fa1f4[_0xa42b('0x33')][_0xa42b('0x1f')]);}return _0x21331c[_0xa42b('0x122')](_0x2afa44);}})['then'](function(_0x3c30e7){if(_0x3c30e7){return _0x3c30e7?{'count':_0x557c32,'rows':_0x3c30e7}:null;}})['then'](respondWithResult(_0x5bdfb6,null))[_0xa42b('0x1b')](handleError(_0x5bdfb6,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 8eae7cd..91e45e8 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 _0x27bf=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove'];(function(_0x4ded65,_0xc8d7c1){var _0x5864fb=function(_0x40df9d){while(--_0x40df9d){_0x4ded65['push'](_0x4ded65['shift']());}};_0x5864fb(++_0xc8d7c1);}(_0x27bf,0x117));var _0xf27b=function(_0x4bd1de,_0x325c78){_0x4bd1de=_0x4bd1de-0x0;var _0xaeced4=_0x27bf[_0x4bd1de];return _0xaeced4;};'use strict';var EventEmitter=require(_0xf27b('0x0'));var ChatWebsite=require(_0xf27b('0x1'))['db'][_0xf27b('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xf27b('0x3')](0x0);var events={'afterCreate':_0xf27b('0x4'),'afterUpdate':_0xf27b('0x5'),'afterDestroy':_0xf27b('0x6')};function emitEvent(_0x2ff64c){return function(_0x339bb9,_0x1542e3,_0x2e1396){ChatWebsiteEvents['emit'](_0x2ff64c+':'+_0x339bb9['id'],_0x339bb9);ChatWebsiteEvents[_0xf27b('0x7')](_0x2ff64c,_0x339bb9);_0x2e1396(null);};}for(var e in events){if(events[_0xf27b('0x8')](e)){var event=events[e];ChatWebsite[_0xf27b('0x9')](e,emitEvent(event));}}module[_0xf27b('0xa')]=ChatWebsiteEvents; \ No newline at end of file +var _0x5a93=['exports','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0x4399a6,_0x4f3ef7){var _0x20ba25=function(_0x5c9e3c){while(--_0x5c9e3c){_0x4399a6['push'](_0x4399a6['shift']());}};_0x20ba25(++_0x4f3ef7);}(_0x5a93,0xf6));var _0x35a9=function(_0x1e1017,_0x55783a){_0x1e1017=_0x1e1017-0x0;var _0x362a58=_0x5a93[_0x1e1017];return _0x362a58;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x35a9('0x0'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x35a9('0x1')](0x0);var events={'afterCreate':_0x35a9('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x7dc79f){return function(_0xf10dcf,_0x3a23d6,_0x4f45aa){ChatWebsiteEvents[_0x35a9('0x3')](_0x7dc79f+':'+_0xf10dcf['id'],_0xf10dcf);ChatWebsiteEvents[_0x35a9('0x3')](_0x7dc79f,_0xf10dcf);_0x4f45aa(null);};}for(var e in events){if(events[_0x35a9('0x4')](e)){var event=events[e];ChatWebsite[_0x35a9('0x5')](e,emitEvent(event));}}module[_0x35a9('0x6')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index abbc343..642a559 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 _0x8f4e=['chat_websites','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite'];(function(_0x5b81d2,_0x171d53){var _0x9d99ef=function(_0xec8974){while(--_0xec8974){_0x5b81d2['push'](_0x5b81d2['shift']());}};_0x9d99ef(++_0x171d53);}(_0x8f4e,0x169));var _0xe8f4=function(_0x21e42e,_0x3ee520){_0x21e42e=_0x21e42e-0x0;var _0x3c5888=_0x8f4e[_0x21e42e];return _0x3c5888;};'use strict';var _=require(_0xe8f4('0x0'));var util=require(_0xe8f4('0x1'));var logger=require(_0xe8f4('0x2'))(_0xe8f4('0x3'));var moment=require(_0xe8f4('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe8f4('0x5'));var config=require(_0xe8f4('0x6'));var attributes=require(_0xe8f4('0x7'));module[_0xe8f4('0x8')]=function(_0x57103a,_0x5edf1b){return _0x57103a[_0xe8f4('0x9')](_0xe8f4('0xa'),attributes,{'tableName':_0xe8f4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe9b1=['path','rimraf','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x27b2fd,_0x8c95b8){var _0x135f31=function(_0x13494d){while(--_0x13494d){_0x27b2fd['push'](_0x27b2fd['shift']());}};_0x135f31(++_0x8c95b8);}(_0xe9b1,0xaf));var _0x1e9b=function(_0x5bdb83,_0x3605de){_0x5bdb83=_0x5bdb83-0x0;var _0x1986bb=_0xe9b1[_0x5bdb83];return _0x1986bb;};'use strict';var _=require(_0x1e9b('0x0'));var util=require(_0x1e9b('0x1'));var logger=require(_0x1e9b('0x2'))(_0x1e9b('0x3'));var moment=require(_0x1e9b('0x4'));var BPromise=require(_0x1e9b('0x5'));var rp=require(_0x1e9b('0x6'));var fs=require('fs');var path=require(_0x1e9b('0x7'));var rimraf=require(_0x1e9b('0x8'));var config=require(_0x1e9b('0x9'));var attributes=require(_0x1e9b('0xa'));module[_0x1e9b('0xb')]=function(_0x41c896,_0x7de997){return _0x41c896['define'](_0x1e9b('0xc'),attributes,{'tableName':_0x1e9b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index db8e5c9..c01ec17 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 _0xfe74=['info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','then'];(function(_0x1a4b5e,_0x37550a){var _0x5145cc=function(_0x1ed405){while(--_0x1ed405){_0x1a4b5e['push'](_0x1a4b5e['shift']());}};_0x5145cc(++_0x37550a);}(_0xfe74,0x1c3));var _0x4fe7=function(_0x2185e8,_0x277e33){_0x2185e8=_0x2185e8-0x0;var _0x72984f=_0xfe74[_0x2185e8];return _0x72984f;};'use strict';var _=require(_0x4fe7('0x0'));var util=require(_0x4fe7('0x1'));var moment=require('moment');var BPromise=require(_0x4fe7('0x2'));var rs=require(_0x4fe7('0x3'));var fs=require('fs');var Redis=require(_0x4fe7('0x4'));var db=require(_0x4fe7('0x5'))['db'];var utils=require(_0x4fe7('0x6'));var logger=require(_0x4fe7('0x7'))('rpc');var config=require(_0x4fe7('0x8'));var jayson=require(_0x4fe7('0x9'));var client=jayson['client'][_0x4fe7('0xa')]({'port':0x232a});config[_0x4fe7('0xb')]=_[_0x4fe7('0xc')](config[_0x4fe7('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x4fe7('0xd'))(new Redis(config[_0x4fe7('0xb')]));require(_0x4fe7('0xe'))[_0x4fe7('0xf')](socket);function respondWithRpcPromise(_0x25402a,_0x20a22b,_0x4b34b5){return new BPromise(function(_0x3db4db,_0x736939){return client['request'](_0x25402a,_0x4b34b5)[_0x4fe7('0x10')](function(_0x1a56e9){logger[_0x4fe7('0x11')](_0x4fe7('0x12'),_0x20a22b,'request\x20sent');logger[_0x4fe7('0x13')](_0x4fe7('0x14'),_0x20a22b,'request\x20sent',JSON[_0x4fe7('0x15')](_0x1a56e9));if(_0x1a56e9['error']){if(_0x1a56e9[_0x4fe7('0x16')][_0x4fe7('0x17')]===0x1f4){logger['error'](_0x4fe7('0x12'),_0x20a22b,_0x1a56e9['error'][_0x4fe7('0x18')]);return _0x736939(_0x1a56e9[_0x4fe7('0x16')][_0x4fe7('0x18')]);}logger['error'](_0x4fe7('0x12'),_0x20a22b,_0x1a56e9[_0x4fe7('0x16')][_0x4fe7('0x18')]);return _0x3db4db(_0x1a56e9[_0x4fe7('0x16')]['message']);}else{logger['info'](_0x4fe7('0x12'),_0x20a22b,_0x4fe7('0x19'));_0x3db4db(_0x1a56e9['result'][_0x4fe7('0x18')]);}})['catch'](function(_0x45241c){logger[_0x4fe7('0x16')](_0x4fe7('0x12'),_0x20a22b,_0x45241c);_0x736939(_0x45241c);});});} \ No newline at end of file +var _0xad67=['redis','defaults','socket.io-emitter','./chatWebsite.socket','register','request','then','info','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5ca7f2,_0x565a83){var _0x51ca1b=function(_0xde6828){while(--_0xde6828){_0x5ca7f2['push'](_0x5ca7f2['shift']());}};_0x51ca1b(++_0x565a83);}(_0xad67,0x81));var _0x7ad6=function(_0x2f1753,_0x458f6d){_0x2f1753=_0x2f1753-0x0;var _0x56a164=_0xad67[_0x2f1753];return _0x56a164;};'use strict';var _=require(_0x7ad6('0x0'));var util=require(_0x7ad6('0x1'));var moment=require(_0x7ad6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7ad6('0x3'))['db'];var utils=require(_0x7ad6('0x4'));var logger=require(_0x7ad6('0x5'))(_0x7ad6('0x6'));var config=require(_0x7ad6('0x7'));var jayson=require(_0x7ad6('0x8'));var client=jayson[_0x7ad6('0x9')][_0x7ad6('0xa')]({'port':0x232a});config[_0x7ad6('0xb')]=_[_0x7ad6('0xc')](config[_0x7ad6('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7ad6('0xd'))(new Redis(config[_0x7ad6('0xb')]));require(_0x7ad6('0xe'))[_0x7ad6('0xf')](socket);function respondWithRpcPromise(_0x4b6b51,_0x1544e0,_0x5d0b23){return new BPromise(function(_0x4fe155,_0x39cf35){return client[_0x7ad6('0x10')](_0x4b6b51,_0x5d0b23)[_0x7ad6('0x11')](function(_0x3bf1e7){logger[_0x7ad6('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x1544e0,_0x7ad6('0x13'));logger['debug'](_0x7ad6('0x14'),_0x1544e0,'request\x20sent',JSON[_0x7ad6('0x15')](_0x3bf1e7));if(_0x3bf1e7['error']){if(_0x3bf1e7[_0x7ad6('0x16')][_0x7ad6('0x17')]===0x1f4){logger['error'](_0x7ad6('0x18'),_0x1544e0,_0x3bf1e7[_0x7ad6('0x16')]['message']);return _0x39cf35(_0x3bf1e7[_0x7ad6('0x16')][_0x7ad6('0x19')]);}logger['error'](_0x7ad6('0x18'),_0x1544e0,_0x3bf1e7[_0x7ad6('0x16')]['message']);return _0x4fe155(_0x3bf1e7[_0x7ad6('0x16')]['message']);}else{logger[_0x7ad6('0x12')](_0x7ad6('0x18'),_0x1544e0,_0x7ad6('0x13'));_0x4fe155(_0x3bf1e7[_0x7ad6('0x1a')][_0x7ad6('0x19')]);}})[_0x7ad6('0x1b')](function(_0x165160){logger[_0x7ad6('0x16')](_0x7ad6('0x18'),_0x1544e0,_0x165160);_0x39cf35(_0x165160);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 95d54e9..643f52b 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 _0x0f1f=['removeListener','./chatWebsite.events','save','remove','update','emit'];(function(_0x53abe5,_0x33a9e5){var _0xc1c37e=function(_0xd53c6e){while(--_0xd53c6e){_0x53abe5['push'](_0x53abe5['shift']());}};_0xc1c37e(++_0x33a9e5);}(_0x0f1f,0x10f));var _0xf0f1=function(_0x294726,_0x5db9e9){_0x294726=_0x294726-0x0;var _0x39e2e3=_0x0f1f[_0x294726];return _0x39e2e3;};'use strict';var ChatWebsiteEvents=require(_0xf0f1('0x0'));var events=[_0xf0f1('0x1'),_0xf0f1('0x2'),_0xf0f1('0x3')];function createListener(_0x1277ae,_0x36c3be){return function(_0x42d811){_0x36c3be[_0xf0f1('0x4')](_0x1277ae,_0x42d811);};}function removeListener(_0x28d3f2,_0x232a3a){return function(){ChatWebsiteEvents[_0xf0f1('0x5')](_0x28d3f2,_0x232a3a);};}exports['register']=function(_0x4620be){for(var _0x58b684=0x0,_0x5148e6=events['length'];_0x58b684<_0x5148e6;_0x58b684++){var _0x305398=events[_0x58b684];var _0x179d1e=createListener('chatWebsite:'+_0x305398,_0x4620be);ChatWebsiteEvents['on'](_0x305398,_0x179d1e);}}; \ No newline at end of file +var _0x44e8=['register','length','chatWebsite:','save','removeListener'];(function(_0x457b18,_0x1c99ab){var _0x38ffac=function(_0x19172a){while(--_0x19172a){_0x457b18['push'](_0x457b18['shift']());}};_0x38ffac(++_0x1c99ab);}(_0x44e8,0x107));var _0x844e=function(_0x16ed97,_0x363ac8){_0x16ed97=_0x16ed97-0x0;var _0x215fad=_0x44e8[_0x16ed97];return _0x215fad;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x844e('0x0'),'remove','update'];function createListener(_0x24c1af,_0x154d28){return function(_0x5d046b){_0x154d28['emit'](_0x24c1af,_0x5d046b);};}function removeListener(_0x1674d0,_0x891a47){return function(){ChatWebsiteEvents[_0x844e('0x1')](_0x1674d0,_0x891a47);};}exports[_0x844e('0x2')]=function(_0x433218){for(var _0x4a2dab=0x0,_0x5ab3b1=events[_0x844e('0x3')];_0x4a2dab<_0x5ab3b1;_0x4a2dab++){var _0x20ee2c=events[_0x4a2dab];var _0x396608=createListener(_0x844e('0x4')+_0x20ee2c,_0x433218);ChatWebsiteEvents['on'](_0x20ee2c,_0x396608);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 5fc41ad..1c36c0f 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 _0x7766=['getOfflineMessages','post','create','addDisposition','addAnswer','root','format','%s-%s','now','originalname','/:id/logo','single','file','addLogo','join','server/files/images/avatars/','diskStorage','addSystemAvatar','/:id/notify','server/files','attachments','offline-chat','ensureDir','extname','replace','/:id/offline','any','offline','addApplications','addProactiveActions','put','/:id','update','delete','destroy','removeDispositions','/:id/users','multer','util','path','express','Router','fs-extra','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getFields','/:id/offline_messages'];(function(_0x2274ed,_0x5cc62d){var _0xf9c7cf=function(_0x32f8cf){while(--_0x32f8cf){_0x2274ed['push'](_0x2274ed['shift']());}};_0xf9c7cf(++_0x5cc62d);}(_0x7766,0xad));var _0x6776=function(_0x5e0ca0,_0x3f3560){_0x5e0ca0=_0x5e0ca0-0x0;var _0x3dd119=_0x7766[_0x5e0ca0];return _0x3dd119;};'use strict';var multer=require(_0x6776('0x0'));var util=require(_0x6776('0x1'));var path=require(_0x6776('0x2'));var timeout=require('connect-timeout');var express=require(_0x6776('0x3'));var router=express[_0x6776('0x4')]();var fs_extra=require(_0x6776('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatWebsite.controller');router[_0x6776('0x6')]('/',auth[_0x6776('0x7')](),controller[_0x6776('0x8')]);router[_0x6776('0x6')](_0x6776('0x9'),auth[_0x6776('0x7')](),controller[_0x6776('0xa')]);router[_0x6776('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x6776('0xb')]);router[_0x6776('0x6')](_0x6776('0xc'),auth[_0x6776('0x7')](),controller[_0x6776('0xd')]);router[_0x6776('0x6')](_0x6776('0xe'),auth[_0x6776('0x7')](),controller[_0x6776('0xf')]);router[_0x6776('0x6')]('/:id/logo',controller[_0x6776('0x10')]);router[_0x6776('0x6')](_0x6776('0x11'),controller[_0x6776('0x12')]);router[_0x6776('0x6')](_0x6776('0x13'),controller[_0x6776('0x14')]);router[_0x6776('0x6')](_0x6776('0x15'),controller[_0x6776('0x16')]);router[_0x6776('0x6')](_0x6776('0x17'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x6776('0x6')](_0x6776('0x18'),controller[_0x6776('0x19')]);router[_0x6776('0x6')](_0x6776('0x1a'),auth[_0x6776('0x7')](),controller[_0x6776('0x1b')]);router['get'](_0x6776('0x1c'),auth[_0x6776('0x7')](),controller['getProactiveActions']);router['get']('/:id/fields',controller[_0x6776('0x1d')]);router[_0x6776('0x6')](_0x6776('0x1e'),auth[_0x6776('0x7')](),controller[_0x6776('0x1f')]);router[_0x6776('0x6')]('/:id/users',auth[_0x6776('0x7')](),controller['getAgents']);router[_0x6776('0x20')]('/',auth[_0x6776('0x7')](),controller[_0x6776('0x21')]);router['post'](_0x6776('0xc'),auth[_0x6776('0x7')](),controller[_0x6776('0x22')]);router[_0x6776('0x20')](_0x6776('0xe'),auth[_0x6776('0x7')](),controller[_0x6776('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x59557e,_0xfdac4f,_0x4a9f52){_0x4a9f52(null,path['join'](config[_0x6776('0x24')],'server/files/images/logos/'));},'filename':function(_0x56881d,_0x2580de,_0x20981e){_0x20981e(null,util[_0x6776('0x25')](_0x6776('0x26'),Date[_0x6776('0x27')](),_0x2580de[_0x6776('0x28')]));}})});router[_0x6776('0x20')](_0x6776('0x29'),upload[_0x6776('0x2a')](_0x6776('0x2b')),controller[_0x6776('0x2c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x482f30,_0x3a7232,_0x4f8919){_0x4f8919(null,path[_0x6776('0x2d')](config[_0x6776('0x24')],_0x6776('0x2e')));},'filename':function(_0x14a01f,_0x5cee19,_0x435bd1){_0x435bd1(null,util[_0x6776('0x25')](_0x6776('0x26'),Date[_0x6776('0x27')](),_0x5cee19['originalname']));}})});router['post'](_0x6776('0x11'),upload[_0x6776('0x2a')](_0x6776('0x2b')),controller['addAvatar']);var upload=multer({'storage':multer[_0x6776('0x2f')]({'destination':function(_0x12d91f,_0x446fed,_0xde4223){_0xde4223(null,path[_0x6776('0x2d')](config[_0x6776('0x24')],'server/files/images/avatars/'));},'filename':function(_0x5b204a,_0x1cc6f4,_0x14dd32){_0x14dd32(null,util['format'](_0x6776('0x26'),Date[_0x6776('0x27')](),_0x1cc6f4[_0x6776('0x28')]));}})});router['post'](_0x6776('0x13'),upload[_0x6776('0x2a')](_0x6776('0x2b')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x6776('0x2f')]({'destination':function(_0x2be896,_0x353203,_0x30f6ee){_0x30f6ee(null,path[_0x6776('0x2d')](config[_0x6776('0x24')],_0x6776('0x2e')));},'filename':function(_0x4f6311,_0x16a76e,_0x4d8df2){_0x4d8df2(null,util['format'](_0x6776('0x26'),Date[_0x6776('0x27')](),_0x16a76e[_0x6776('0x28')]));}})});router['post'](_0x6776('0x15'),upload[_0x6776('0x2a')](_0x6776('0x2b')),controller[_0x6776('0x30')]);router[_0x6776('0x20')](_0x6776('0x31'),controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x4d3c40,_0x6b4cd8,_0x447f17){const _0x1424f8=path[_0x6776('0x2d')](config[_0x6776('0x24')],_0x6776('0x32'),_0x6776('0x33'),_0x6776('0x34'));fs_extra[_0x6776('0x35')](_0x1424f8,function(){_0x447f17(null,_0x1424f8);});},'filename':function(_0x22c447,_0x21c265,_0x3c193a){const _0x47d406=_0x21c265['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x44dfe6=path[_0x6776('0x36')](_0x47d406);const _0x34eca8=Date[_0x6776('0x27')]()+'-'+_0x47d406[_0x6776('0x37')](_0x44dfe6,'')+_0x44dfe6;_0x3c193a(null,_0x34eca8);}})});router[_0x6776('0x20')](_0x6776('0x38'),offlineUploadMulter[_0x6776('0x39')](),controller[_0x6776('0x3a')]);router['post']('/:id/interactions',auth[_0x6776('0x7')](),controller['addInteraction']);router[_0x6776('0x20')](_0x6776('0x1a'),auth[_0x6776('0x7')](),controller[_0x6776('0x3b')]);router['post']('/:id/proactive_actions',auth[_0x6776('0x7')](),controller[_0x6776('0x3c')]);router[_0x6776('0x20')]('/:id/users',auth[_0x6776('0x7')](),controller['addAgents']);router[_0x6776('0x3d')](_0x6776('0x3e'),auth[_0x6776('0x7')](),controller[_0x6776('0x3f')]);router[_0x6776('0x40')](_0x6776('0x3e'),auth[_0x6776('0x7')](),controller[_0x6776('0x41')]);router[_0x6776('0x40')](_0x6776('0xc'),auth[_0x6776('0x7')](),controller[_0x6776('0x42')]);router[_0x6776('0x40')](_0x6776('0xe'),auth['isAuthenticated'](),controller['removeAnswers']);router['delete'](_0x6776('0x43'),auth[_0x6776('0x7')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x5e89=['getProactiveActions','getFields','getOfflineMessages','/:id/users','getAgents','create','/:id/dispositions','addDisposition','post','diskStorage','join','server/files/images/logos/','%s-%s','now','originalname','single','file','addLogo','root','server/files/images/avatars/','format','addAvatar','/:id/customer_avatar','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addApplications','/:id/proactive_actions','addProactiveActions','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','show','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications'];(function(_0x568c2a,_0x436eb8){var _0x373a36=function(_0x1d59e5){while(--_0x1d59e5){_0x568c2a['push'](_0x568c2a['shift']());}};_0x373a36(++_0x436eb8);}(_0x5e89,0x165));var _0x95e8=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x5e89[_0x9cd4c3];return _0x4c9025;};'use strict';var multer=require(_0x95e8('0x0'));var util=require(_0x95e8('0x1'));var path=require(_0x95e8('0x2'));var timeout=require('connect-timeout');var express=require(_0x95e8('0x3'));var router=express['Router']();var fs_extra=require(_0x95e8('0x4'));var auth=require(_0x95e8('0x5'));var interaction=require(_0x95e8('0x6'));var config=require(_0x95e8('0x7'));var controller=require(_0x95e8('0x8'));router[_0x95e8('0x9')]('/',auth[_0x95e8('0xa')](),controller[_0x95e8('0xb')]);router[_0x95e8('0x9')](_0x95e8('0xc'),auth[_0x95e8('0xa')](),controller[_0x95e8('0xd')]);router[_0x95e8('0x9')]('/:id',auth[_0x95e8('0xa')](),controller[_0x95e8('0xe')]);router[_0x95e8('0x9')]('/:id/dispositions',auth[_0x95e8('0xa')](),controller[_0x95e8('0xf')]);router[_0x95e8('0x9')](_0x95e8('0x10'),auth[_0x95e8('0xa')](),controller[_0x95e8('0x11')]);router['get'](_0x95e8('0x12'),controller[_0x95e8('0x13')]);router[_0x95e8('0x9')](_0x95e8('0x14'),controller[_0x95e8('0x15')]);router[_0x95e8('0x9')]('/:id/customer_avatar',controller['getCustomerAvatar']);router['get']('/:id/system_avatar',controller['getSystemAvatar']);router[_0x95e8('0x9')](_0x95e8('0x16'),auth['isAuthenticated'](),controller[_0x95e8('0x17')]);router[_0x95e8('0x9')](_0x95e8('0x18'),controller[_0x95e8('0x19')]);router[_0x95e8('0x9')](_0x95e8('0x1a'),auth[_0x95e8('0xa')](),controller[_0x95e8('0x1b')]);router[_0x95e8('0x9')]('/:id/proactive_actions',auth[_0x95e8('0xa')](),controller[_0x95e8('0x1c')]);router[_0x95e8('0x9')]('/:id/fields',controller[_0x95e8('0x1d')]);router[_0x95e8('0x9')]('/:id/offline_messages',auth[_0x95e8('0xa')](),controller[_0x95e8('0x1e')]);router[_0x95e8('0x9')](_0x95e8('0x1f'),auth[_0x95e8('0xa')](),controller[_0x95e8('0x20')]);router['post']('/',auth['isAuthenticated'](),controller[_0x95e8('0x21')]);router['post'](_0x95e8('0x22'),auth[_0x95e8('0xa')](),controller[_0x95e8('0x23')]);router[_0x95e8('0x24')](_0x95e8('0x10'),auth[_0x95e8('0xa')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x95e8('0x25')]({'destination':function(_0x1d0ef8,_0x548e62,_0x551dad){_0x551dad(null,path[_0x95e8('0x26')](config['root'],_0x95e8('0x27')));},'filename':function(_0x502a10,_0x5cc0d1,_0x2b2bac){_0x2b2bac(null,util['format'](_0x95e8('0x28'),Date[_0x95e8('0x29')](),_0x5cc0d1[_0x95e8('0x2a')]));}})});router['post']('/:id/logo',upload[_0x95e8('0x2b')](_0x95e8('0x2c')),controller[_0x95e8('0x2d')]);var upload=multer({'storage':multer[_0x95e8('0x25')]({'destination':function(_0x32ea34,_0x5d37ec,_0x46ee93){_0x46ee93(null,path['join'](config[_0x95e8('0x2e')],_0x95e8('0x2f')));},'filename':function(_0x2b0b33,_0x346631,_0x143a2a){_0x143a2a(null,util[_0x95e8('0x30')]('%s-%s',Date[_0x95e8('0x29')](),_0x346631[_0x95e8('0x2a')]));}})});router[_0x95e8('0x24')](_0x95e8('0x14'),upload[_0x95e8('0x2b')](_0x95e8('0x2c')),controller[_0x95e8('0x31')]);var upload=multer({'storage':multer[_0x95e8('0x25')]({'destination':function(_0x5a6020,_0x2ed3b3,_0x28e19e){_0x28e19e(null,path['join'](config[_0x95e8('0x2e')],_0x95e8('0x2f')));},'filename':function(_0x2c7b13,_0x27fe33,_0x2657ff){_0x2657ff(null,util[_0x95e8('0x30')](_0x95e8('0x28'),Date[_0x95e8('0x29')](),_0x27fe33[_0x95e8('0x2a')]));}})});router[_0x95e8('0x24')](_0x95e8('0x32'),upload[_0x95e8('0x2b')](_0x95e8('0x2c')),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x52797f,_0x42f59e,_0x56fd84){_0x56fd84(null,path['join'](config[_0x95e8('0x2e')],_0x95e8('0x2f')));},'filename':function(_0x3966b9,_0x283dc6,_0x28a234){_0x28a234(null,util[_0x95e8('0x30')](_0x95e8('0x28'),Date[_0x95e8('0x29')](),_0x283dc6[_0x95e8('0x2a')]));}})});router[_0x95e8('0x24')](_0x95e8('0x33'),upload[_0x95e8('0x2b')](_0x95e8('0x2c')),controller[_0x95e8('0x34')]);router[_0x95e8('0x24')](_0x95e8('0x35'),controller[_0x95e8('0x36')]);const offlineUploadMulter=multer({'storage':multer[_0x95e8('0x25')]({'destination':function(_0x382ebb,_0x3d8da4,_0x47f36f){const _0x531946=path[_0x95e8('0x26')](config[_0x95e8('0x2e')],_0x95e8('0x37'),_0x95e8('0x38'),_0x95e8('0x39'));fs_extra[_0x95e8('0x3a')](_0x531946,function(){_0x47f36f(null,_0x531946);});},'filename':function(_0x1d147e,_0x574fb8,_0x49c6cc){const _0x23ec39=_0x574fb8[_0x95e8('0x2a')][_0x95e8('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x597bd2=path[_0x95e8('0x3c')](_0x23ec39);const _0x520e03=Date[_0x95e8('0x29')]()+'-'+_0x23ec39[_0x95e8('0x3b')](_0x597bd2,'')+_0x597bd2;_0x49c6cc(null,_0x520e03);}})});router[_0x95e8('0x24')](_0x95e8('0x3d'),offlineUploadMulter[_0x95e8('0x3e')](),controller[_0x95e8('0x3f')]);router['post'](_0x95e8('0x16'),auth[_0x95e8('0xa')](),controller['addInteraction']);router['post'](_0x95e8('0x1a'),auth['isAuthenticated'](),controller[_0x95e8('0x40')]);router[_0x95e8('0x24')](_0x95e8('0x41'),auth['isAuthenticated'](),controller[_0x95e8('0x42')]);router[_0x95e8('0x24')](_0x95e8('0x1f'),auth['isAuthenticated'](),controller[_0x95e8('0x43')]);router[_0x95e8('0x44')](_0x95e8('0x45'),auth[_0x95e8('0xa')](),controller[_0x95e8('0x46')]);router[_0x95e8('0x47')](_0x95e8('0x45'),auth[_0x95e8('0xa')](),controller[_0x95e8('0x48')]);router['delete'](_0x95e8('0x22'),auth['isAuthenticated'](),controller[_0x95e8('0x49')]);router[_0x95e8('0x47')](_0x95e8('0x10'),auth['isAuthenticated'](),controller[_0x95e8('0x4a')]);router[_0x95e8('0x47')]('/:id/users',auth[_0x95e8('0xa')](),controller[_0x95e8('0x4b')]);module[_0x95e8('0x4c')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index ddbc0e1..749c365 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 _0xbb1c=['/client-logs','use','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','../config/environment','Router','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint'];(function(_0x1f2891,_0x4f436c){var _0x334493=function(_0x49801f){while(--_0x49801f){_0x1f2891['push'](_0x1f2891['shift']());}};_0x334493(++_0x4f436c);}(_0xbb1c,0x199));var _0xcbb1=function(_0x5a9c87,_0x11c8bc){_0x5a9c87=_0x5a9c87-0x0;var _0x33ed72=_0xbb1c[_0x5a9c87];return _0x33ed72;};var beaverLogger=require(_0xcbb1('0x0'));var express=require(_0xcbb1('0x1'));var auth=require(_0xcbb1('0x2'));var config=require(_0xcbb1('0x3'));var router=express[_0xcbb1('0x4')]();var isProduction=config['env']===_0xcbb1('0x5')||![];function clientSideLogs(_0xad863b,_0x510445,_0x386059){var _0x19a3bb=_0xad863b[_0xcbb1('0x6')][_0xcbb1('0x7')](_0xcbb1('0x8'));if(!_0x19a3bb){throw new Error(_0xcbb1('0x9'));}return beaverLogger[_0xcbb1('0xa')]({'uri':_0xcbb1('0xb'),'logger':_0x19a3bb,'enableCors':!isProduction})(_0xad863b,_0x510445,_0x386059);}router[_0xcbb1('0xc')](auth[_0xcbb1('0xd')](),clientSideLogs);module[_0xcbb1('0xe')]=router; \ No newline at end of file +var _0x62ed=['exports','beaver-logger/server','express','../components/auth/service','../config/environment','Router','env','app','get','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs'];(function(_0x5a633a,_0x4e8830){var _0x4a9df=function(_0x1a6732){while(--_0x1a6732){_0x5a633a['push'](_0x5a633a['shift']());}};_0x4a9df(++_0x4e8830);}(_0x62ed,0x115));var _0xd62e=function(_0x40258b,_0x1db52e){_0x40258b=_0x40258b-0x0;var _0x498cf2=_0x62ed[_0x40258b];return _0x498cf2;};var beaverLogger=require(_0xd62e('0x0'));var express=require(_0xd62e('0x1'));var auth=require(_0xd62e('0x2'));var config=require(_0xd62e('0x3'));var router=express[_0xd62e('0x4')]();var isProduction=config[_0xd62e('0x5')]==='production'||![];function clientSideLogs(_0x3db6d0,_0x3ac8ae,_0x5377a7){var _0x50ad49=_0x3db6d0[_0xd62e('0x6')][_0xd62e('0x7')]('client-side-logger');if(!_0x50ad49){throw new Error(_0xd62e('0x8'));}return beaverLogger[_0xd62e('0x9')]({'uri':_0xd62e('0xa'),'logger':_0x50ad49,'enableCors':!isProduction})(_0x3db6d0,_0x3ac8ae,_0x5377a7);}router['use'](auth['isAuthenticated'](),clientSideLogs);module[_0xd62e('0xb')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 263551b..ccd727c 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 _0xf72a=['Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','sequelize','STRING','AmazonAWS','MicrosoftAzure'];(function(_0x282ccc,_0x5d66a1){var _0x27c2dd=function(_0x58431a){while(--_0x58431a){_0x282ccc['push'](_0x282ccc['shift']());}};_0x27c2dd(++_0x5d66a1);}(_0xf72a,0xd4));var _0xaf72=function(_0x4d451c,_0x4b228d){_0x4d451c=_0x4d451c-0x0;var _0x5aac97=_0xf72a[_0x4d451c];return _0x5aac97;};'use strict';var Sequelize=require(_0xaf72('0x0'));module['exports']={'name':{'type':Sequelize[_0xaf72('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xaf72('0x2'),'Google',_0xaf72('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xaf72('0x4'),_0xaf72('0x5'))},'data1':{'type':Sequelize[_0xaf72('0x1')],'comment':_0xaf72('0x6')},'data2':{'type':Sequelize['STRING'],'comment':_0xaf72('0x7')},'data3':{'type':Sequelize[_0xaf72('0x1')],'comment':_0xaf72('0x8')},'data4':{'type':Sequelize['STRING'],'comment':_0xaf72('0x9')},'data5':{'type':Sequelize[_0xaf72('0xa')],'comment':_0xaf72('0xb')},'data6':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0x745d=['MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','sequelize','exports','STRING','ENUM','Google','MicrosoftAzure','Dynamics365','MicrosoftAzure\x20=>\x20client_id'];(function(_0x2f37e0,_0x393ef9){var _0x43ccce=function(_0x318b51){while(--_0x318b51){_0x2f37e0['push'](_0x2f37e0['shift']());}};_0x43ccce(++_0x393ef9);}(_0x745d,0xe2));var _0xd745=function(_0x265c51,_0x199578){_0x265c51=_0x265c51-0x0;var _0x3faf9d=_0x745d[_0x265c51];return _0x3faf9d;};'use strict';var Sequelize=require(_0xd745('0x0'));module[_0xd745('0x1')]={'name':{'type':Sequelize[_0xd745('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xd745('0x3')]('AmazonAWS',_0xd745('0x4'),_0xd745('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xd745('0x3')]('Outlook365',_0xd745('0x6'))},'data1':{'type':Sequelize['STRING'],'comment':_0xd745('0x7')},'data2':{'type':Sequelize[_0xd745('0x2')],'comment':_0xd745('0x8')},'data3':{'type':Sequelize[_0xd745('0x2')],'comment':_0xd745('0x9')},'data4':{'type':Sequelize[_0xd745('0x2')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0xd745('0xa')],'comment':_0xd745('0xb')},'data6':{'type':Sequelize[_0xd745('0xa')],'comment':_0xd745('0xc')},'data7':{'type':Sequelize[_0xd745('0xa')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index d6dc73d..11e61a5 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 _0xdf31=['emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','send','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','./cloudProvider.oauth','defaults','redis','localhost','socket.io-emitter','sendStatus','status','json','undefined','limit','count','offset','update','then','destroy','end','error','stack','name','padEnd','slice','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','CloudProvider','includeAll','include','findAll','rows','service','MicrosoftAzure','data3','show','params','find','decryptString','body','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','catch','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','code','data5','data6','startRefreshInterval'];(function(_0x5c6900,_0x53a947){var _0x3d0d4a=function(_0x390e4b){while(--_0x390e4b){_0x5c6900['push'](_0x5c6900['shift']());}};_0x3d0d4a(++_0x53a947);}(_0xdf31,0x66));var _0x1df3=function(_0xee599f,_0x302b54){_0xee599f=_0xee599f-0x0;var _0x47944d=_0xdf31[_0xee599f];return _0x47944d;};'use strict';var _=require(_0x1df3('0x0'));var Redis=require(_0x1df3('0x1'));var qs=require(_0x1df3('0x2'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0x1df3('0x3'))(_0x1df3('0x4'));var db=require('../../mysqldb')['db'];var oauth=require(_0x1df3('0x5'));config['redis']=_[_0x1df3('0x6')](config[_0x1df3('0x7')],{'host':_0x1df3('0x8'),'port':0x18eb});var socket=require(_0x1df3('0x9'))(new Redis(config['redis']));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x439c22,_0x1a5418){_0x1a5418=_0x1a5418||0xcc;return function(_0x516e6d){if(_0x516e6d){return _0x439c22[_0x1df3('0xa')](_0x1a5418);}return _0x439c22[_0x1df3('0xb')](_0x1a5418)['end']();};}function respondWithResult(_0x2ff5bc,_0x53468d){_0x53468d=_0x53468d||0xc8;return function(_0x76dd74){if(_0x76dd74){return _0x2ff5bc[_0x1df3('0xb')](_0x53468d)[_0x1df3('0xc')](_0x76dd74);}};}function respondWithFilteredResult(_0x4e2866,_0x32a33f){return function(_0x719382){if(_0x719382){var _0x101e28=typeof _0x32a33f['offset']===_0x1df3('0xd')&&typeof _0x32a33f[_0x1df3('0xe')]===_0x1df3('0xd');var _0x531e6d=_0x719382[_0x1df3('0xf')];var _0x5d99e0=_0x101e28?0x0:_0x32a33f[_0x1df3('0x10')];var _0x5bd6c5=_0x101e28?_0x719382['count']:_0x32a33f[_0x1df3('0x10')]+_0x32a33f[_0x1df3('0xe')];var _0x937ff4;if(_0x5bd6c5>=_0x531e6d){_0x5bd6c5=_0x531e6d;_0x937ff4=0xc8;}else{_0x937ff4=0xce;}_0x4e2866[_0x1df3('0xb')](_0x937ff4);return _0x4e2866['set']('Content-Range',_0x5d99e0+'-'+_0x5bd6c5+'/'+_0x531e6d)['json'](_0x719382);}return null;};}function saveUpdates(_0x3e4e13){return function(_0x3d1943){if(_0x3d1943){return _0x3d1943[_0x1df3('0x11')](_0x3e4e13)[_0x1df3('0x12')](function(_0x45218c){return _0x45218c;});}return null;};}function removeEntity(_0x3c1689){return function(_0x318d5a){if(_0x318d5a){return _0x318d5a[_0x1df3('0x13')]()[_0x1df3('0x12')](function(){_0x3c1689[_0x1df3('0xb')](0xcc)[_0x1df3('0x14')]();});}};}function handleEntityNotFound(_0x117b03){return function(_0x398867){if(!_0x398867){_0x117b03['sendStatus'](0x194);}return _0x398867;};}function handleError(_0x101639,_0x331a75){_0x331a75=_0x331a75||0x1f4;return function(_0x38023e){logger[_0x1df3('0x15')](_0x38023e[_0x1df3('0x16')]);if(_0x38023e[_0x1df3('0x17')]){delete _0x38023e['name'];}_0x101639[_0x1df3('0xb')](_0x331a75)['send'](_0x38023e);};}function maskClientSecret(_0x54b4fa){return _[_0x1df3('0x18')](_0x54b4fa[_0x1df3('0x19')](0x0,0x3),0x14,'*');}exports['index']=function(_0x4135ab,_0x4ca061){var _0xf5dd74={},_0x3beb9d={},_0x13c197={'count':0x0,'rows':[]};var _0x393f76=_[_0x1df3('0x1a')](db['CloudProvider'][_0x1df3('0x1b')],function(_0x40b428){return{'name':_0x40b428[_0x1df3('0x1c')],'type':_0x40b428[_0x1df3('0x1d')][_0x1df3('0x1e')]};});_0x3beb9d[_0x1df3('0x1f')]=_[_0x1df3('0x1a')](_0x393f76,_0x1df3('0x17'));_0x3beb9d[_0x1df3('0x20')]=_[_0x1df3('0x21')](_0x4135ab[_0x1df3('0x20')]);_0x3beb9d[_0x1df3('0x22')]=_[_0x1df3('0x23')](_0x3beb9d[_0x1df3('0x1f')],_0x3beb9d[_0x1df3('0x20')]);_0xf5dd74[_0x1df3('0x24')]=_['intersection'](_0x3beb9d[_0x1df3('0x1f')],qs[_0x1df3('0x25')](_0x4135ab[_0x1df3('0x20')][_0x1df3('0x25')]));_0xf5dd74['attributes']=_0xf5dd74[_0x1df3('0x24')][_0x1df3('0x26')]?_0xf5dd74[_0x1df3('0x24')]:_0x3beb9d[_0x1df3('0x1f')];if(!_0x4135ab[_0x1df3('0x20')]['hasOwnProperty'](_0x1df3('0x27'))){_0xf5dd74[_0x1df3('0xe')]=qs[_0x1df3('0xe')](_0x4135ab[_0x1df3('0x20')][_0x1df3('0xe')]);_0xf5dd74[_0x1df3('0x10')]=qs[_0x1df3('0x10')](_0x4135ab[_0x1df3('0x20')][_0x1df3('0x10')]);}_0xf5dd74[_0x1df3('0x28')]=qs[_0x1df3('0x29')](_0x4135ab[_0x1df3('0x20')][_0x1df3('0x29')]);_0xf5dd74['where']=qs[_0x1df3('0x22')](_[_0x1df3('0x2a')](_0x4135ab[_0x1df3('0x20')],_0x3beb9d[_0x1df3('0x22')]),_0x393f76);if(_0x4135ab[_0x1df3('0x20')][_0x1df3('0x2b')]){_0xf5dd74['where']=_[_0x1df3('0x2c')](_0xf5dd74['where'],{'$or':_[_0x1df3('0x1a')](_0x393f76,function(_0x4de616){if(_0x4de616[_0x1df3('0x1d')]!==_0x1df3('0x2d')){var _0x166dc1={};_0x166dc1[_0x4de616[_0x1df3('0x17')]]={'$like':'%'+_0x4135ab[_0x1df3('0x20')][_0x1df3('0x2b')]+'%'};return _0x166dc1;}})});}_0xf5dd74=_[_0x1df3('0x2c')]({},_0xf5dd74,_0x4135ab[_0x1df3('0x2e')]);var _0x590586={'where':_0xf5dd74['where']};return db[_0x1df3('0x2f')][_0x1df3('0xf')](_0x590586)['then'](function(_0x46137e){_0x13c197[_0x1df3('0xf')]=_0x46137e;if(_0x4135ab[_0x1df3('0x20')][_0x1df3('0x30')]){_0xf5dd74[_0x1df3('0x31')]=[{'all':!![]}];}return db[_0x1df3('0x2f')][_0x1df3('0x32')](_0xf5dd74);})[_0x1df3('0x12')](function(_0x56080f){_0x13c197[_0x1df3('0x33')]=_[_0x1df3('0x1a')](_0x56080f,function(_0x4f797e){if(_0x4f797e[_0x1df3('0x34')]===_0x1df3('0x35')){var _0x3bac65=encryptor['decryptString'](_0x4f797e['data3']);_0x4f797e[_0x1df3('0x36')]=maskClientSecret(_0x3bac65);}return _0x4f797e;});return _0x13c197;})['then'](respondWithFilteredResult(_0x4ca061,_0xf5dd74))['catch'](handleError(_0x4ca061,null));};exports[_0x1df3('0x37')]=function(_0x29a6bc,_0x34dd17){var _0x3b8043={'raw':!![],'where':{'id':_0x29a6bc[_0x1df3('0x38')]['id']}},_0x1839c4={};_0x1839c4[_0x1df3('0x1f')]=_[_0x1df3('0x21')](db[_0x1df3('0x2f')][_0x1df3('0x1b')]);_0x1839c4[_0x1df3('0x20')]=_[_0x1df3('0x21')](_0x29a6bc[_0x1df3('0x20')]);_0x1839c4[_0x1df3('0x22')]=_[_0x1df3('0x23')](_0x1839c4[_0x1df3('0x1f')],_0x1839c4[_0x1df3('0x20')]);_0x3b8043['attributes']=_['intersection'](_0x1839c4[_0x1df3('0x1f')],qs['fields'](_0x29a6bc[_0x1df3('0x20')]['fields']));_0x3b8043[_0x1df3('0x24')]=_0x3b8043[_0x1df3('0x24')][_0x1df3('0x26')]?_0x3b8043[_0x1df3('0x24')]:_0x1839c4['model'];if(_0x29a6bc['query'][_0x1df3('0x30')]){_0x3b8043[_0x1df3('0x31')]=[{'all':!![]}];}_0x3b8043=_[_0x1df3('0x2c')]({},_0x3b8043,_0x29a6bc['options']);return db[_0x1df3('0x2f')][_0x1df3('0x39')](_0x3b8043)[_0x1df3('0x12')](handleEntityNotFound(_0x34dd17,null))[_0x1df3('0x12')](function(_0x132863){if(_0x132863[_0x1df3('0x34')]==='MicrosoftAzure'){var _0x17ba58=encryptor[_0x1df3('0x3a')](_0x132863[_0x1df3('0x36')]);_0x132863[_0x1df3('0x36')]=maskClientSecret(_0x17ba58);}return _0x132863;})['then'](respondWithResult(_0x34dd17,null))['catch'](handleError(_0x34dd17,null));};exports['create']=function(_0x4a67e3,_0x292922){if(!_0x4a67e3[_0x1df3('0x3b')][_0x1df3('0x17')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x4a67e3[_0x1df3('0x3b')][_0x1df3('0x34')])throw new Error(_0x1df3('0x3c'));var _0x287dbc=db[_0x1df3('0x2f')][_0x1df3('0x1b')][_0x1df3('0x34')][_0x1df3('0x3d')];if(!_0x287dbc[_0x1df3('0x3e')](_0x4a67e3[_0x1df3('0x3b')]['service']))throw new Error(_0x1df3('0x3f')+_0x287dbc[_0x1df3('0x40')](',\x20'));if(_0x4a67e3[_0x1df3('0x3b')][_0x1df3('0x34')]===_0x1df3('0x35')&&_0x4a67e3['body'][_0x1df3('0x36')]){_0x4a67e3[_0x1df3('0x3b')][_0x1df3('0x36')]=encryptor[_0x1df3('0x41')](_0x4a67e3[_0x1df3('0x3b')][_0x1df3('0x36')]);}return db['CloudProvider']['create'](_0x4a67e3[_0x1df3('0x3b')],{})[_0x1df3('0x12')](respondWithResult(_0x292922,0xc9))['catch'](handleError(_0x292922,null));};exports['update']=function(_0x2d70ab,_0x429021){if(_0x2d70ab[_0x1df3('0x3b')]['id']){delete _0x2d70ab[_0x1df3('0x3b')]['id'];}return db['CloudProvider'][_0x1df3('0x39')]({'where':{'id':_0x2d70ab[_0x1df3('0x38')]['id']}})[_0x1df3('0x12')](handleEntityNotFound(_0x429021,null))[_0x1df3('0x12')](function(_0x26d3e7){if(_0x26d3e7[_0x1df3('0x34')]==='MicrosoftAzure'&&_0x2d70ab[_0x1df3('0x3b')][_0x1df3('0x36')]){_0x2d70ab[_0x1df3('0x3b')][_0x1df3('0x36')]=encryptor['encryptString'](_0x2d70ab[_0x1df3('0x3b')][_0x1df3('0x36')]);}return _0x26d3e7;})[_0x1df3('0x12')](saveUpdates(_0x2d70ab[_0x1df3('0x3b')],null))[_0x1df3('0x12')](respondWithResult(_0x429021,null))[_0x1df3('0x42')](handleError(_0x429021,null));};exports[_0x1df3('0x13')]=function(_0x3797b9,_0x342693){return db['CloudProvider'][_0x1df3('0x39')]({'where':{'id':_0x3797b9[_0x1df3('0x38')]['id']}})['then'](handleEntityNotFound(_0x342693,null))['then'](removeEntity(_0x342693,null))['catch'](handleError(_0x342693,null));};exports[_0x1df3('0x43')]=function(_0x1c6ae3,_0x3d4d34){return db[_0x1df3('0x2f')][_0x1df3('0x44')]({'where':{'id':_0x1c6ae3['params']['id']},'raw':!![]})[_0x1df3('0x12')](function(_0x349e2d){if(!_0x349e2d)return _0x3d4d34[_0x1df3('0xa')](0x194);return{'url':oauth[_0x1df3('0x45')](_0x349e2d,_0x1c6ae3[_0x1df3('0x46')]['id'])};})[_0x1df3('0x12')](respondWithResult(_0x3d4d34,null))[_0x1df3('0x42')](handleError(_0x3d4d34,null));};exports[_0x1df3('0x47')]=function(_0x2c5839,_0x6b8435){var _0x3ef283=_0x2c5839[_0x1df3('0x3b')];var _0x1a5459;var _0x305bac;if(_0x3ef283[_0x1df3('0x15')])throw _0x3ef283;redis[_0x1df3('0x48')](_0x3ef283[_0x1df3('0x49')])[_0x1df3('0x12')](function(_0x511561){if(!_0x511561)throw new Error(_0x1df3('0x4a'));_0x1a5459=JSON[_0x1df3('0x4b')](_0x511561);var _0x1c0923=Buffer['from'](_0x3ef283[_0x1df3('0x49')],'base64')[_0x1df3('0x4c')](_0x1df3('0x4d'));_0x305bac=JSON[_0x1df3('0x4b')](_0x1c0923);if(!oauth[_0x1df3('0x4e')](_0x3ef283[_0x1df3('0x4f')],_0x1a5459[_0x1df3('0x50')]))throw new Error(_0x1df3('0x51'));redis['del'](_0x3ef283['state']);return oauth['getOauth2MicrosoftAccessToken'](_0x3ef283[_0x1df3('0x52')],_0x1a5459);})[_0x1df3('0x12')](function(_0x5eceee){_0x1a5459[_0x1df3('0x53')]=_0x5eceee['access_token'];_0x1a5459[_0x1df3('0x54')]=_0x5eceee['refresh_token'];return db[_0x1df3('0x2f')]['update']({'data5':_0x1a5459[_0x1df3('0x53')],'data6':_0x1a5459[_0x1df3('0x54')]},{'where':{'id':_0x1a5459['id']}});})[_0x1df3('0x12')](function(){oauth[_0x1df3('0x55')](_0x1a5459);socket[_0x1df3('0x56')](_0x1df3('0x57'),{'id':_0x305bac['id']});return;})[_0x1df3('0x12')](respondWithStatusCode(_0x6b8435,null))['catch'](function(_0x32d884){if(_0x305bac){socket['emit'](_0x1df3('0x58'),{'id':_0x305bac['id']});}if(!_0x1a5459){logger[_0x1df3('0x15')](_0x1df3('0x59'),_0x32d884);return _0x6b8435[_0x1df3('0xb')](0x1f4)[_0x1df3('0x5a')](_0x32d884[_0x1df3('0x5b')]);}logger[_0x1df3('0x15')](_0x1df3('0x5c'),_0x1a5459['id'],JSON[_0x1df3('0x5d')](_0x32d884));});}; \ No newline at end of file +var _0x91bf=['VIRTUAL','options','includeAll','include','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','find','create','body','Service\x20parameter\x20not\x20specified','values','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','update','destroy','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','base64','ascii','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','data5','access_token','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','send','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/encryptor','../../config/environment','./cloudProvider.oauth','defaults','redis','socket.io-emitter','sendStatus','limit','undefined','offset','count','status','set','Content-Range','then','error','name','padEnd','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','keys','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','pick','filters','filter','merge','where'];(function(_0xb0bfd6,_0x2ca684){var _0x2924fc=function(_0xf0e69a){while(--_0xf0e69a){_0xb0bfd6['push'](_0xb0bfd6['shift']());}};_0x2924fc(++_0x2ca684);}(_0x91bf,0x147));var _0xf91b=function(_0x522b58,_0x527a40){_0x522b58=_0x522b58-0x0;var _0x1ee0f0=_0x91bf[_0x522b58];return _0x1ee0f0;};'use strict';var _=require(_0xf91b('0x0'));var Redis=require(_0xf91b('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0xf91b('0x2'));var config=require(_0xf91b('0x3'));var logger=require('../../config/logger')('api');var db=require('../../mysqldb')['db'];var oauth=require(_0xf91b('0x4'));config['redis']=_[_0xf91b('0x5')](config[_0xf91b('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0xf91b('0x7'))(new Redis(config['redis']));var redis=new Redis(config[_0xf91b('0x6')]);function respondWithStatusCode(_0x24115b,_0x4bf91f){_0x4bf91f=_0x4bf91f||0xcc;return function(_0x4e75a8){if(_0x4e75a8){return _0x24115b[_0xf91b('0x8')](_0x4bf91f);}return _0x24115b['status'](_0x4bf91f)['end']();};}function respondWithResult(_0x2859e3,_0x4aa71e){_0x4aa71e=_0x4aa71e||0xc8;return function(_0x2053b4){if(_0x2053b4){return _0x2859e3['status'](_0x4aa71e)['json'](_0x2053b4);}};}function respondWithFilteredResult(_0x2e66ba,_0x449a17){return function(_0x42dca2){if(_0x42dca2){var _0x55bee8=typeof _0x449a17['offset']==='undefined'&&typeof _0x449a17[_0xf91b('0x9')]===_0xf91b('0xa');var _0x191cd9=_0x42dca2['count'];var _0x59945b=_0x55bee8?0x0:_0x449a17[_0xf91b('0xb')];var _0x299b71=_0x55bee8?_0x42dca2[_0xf91b('0xc')]:_0x449a17['offset']+_0x449a17['limit'];var _0x3bb0a7;if(_0x299b71>=_0x191cd9){_0x299b71=_0x191cd9;_0x3bb0a7=0xc8;}else{_0x3bb0a7=0xce;}_0x2e66ba[_0xf91b('0xd')](_0x3bb0a7);return _0x2e66ba[_0xf91b('0xe')](_0xf91b('0xf'),_0x59945b+'-'+_0x299b71+'/'+_0x191cd9)['json'](_0x42dca2);}return null;};}function saveUpdates(_0x2f056d){return function(_0x3fd8ec){if(_0x3fd8ec){return _0x3fd8ec['update'](_0x2f056d)[_0xf91b('0x10')](function(_0x30d7e4){return _0x30d7e4;});}return null;};}function removeEntity(_0x3d8fe0){return function(_0xa0c494){if(_0xa0c494){return _0xa0c494['destroy']()[_0xf91b('0x10')](function(){_0x3d8fe0[_0xf91b('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x198380){return function(_0x57cf85){if(!_0x57cf85){_0x198380[_0xf91b('0x8')](0x194);}return _0x57cf85;};}function handleError(_0x181bb2,_0x4de572){_0x4de572=_0x4de572||0x1f4;return function(_0x8ee907){logger[_0xf91b('0x11')](_0x8ee907['stack']);if(_0x8ee907['name']){delete _0x8ee907[_0xf91b('0x12')];}_0x181bb2[_0xf91b('0xd')](_0x4de572)['send'](_0x8ee907);};}function maskClientSecret(_0x4c0c38){return _[_0xf91b('0x13')](_0x4c0c38['slice'](0x0,0x3),0x14,'*');}exports[_0xf91b('0x14')]=function(_0x50bc91,_0x4148eb){var _0x57f318={},_0x190a46={},_0x18b8f0={'count':0x0,'rows':[]};var _0x137c13=_[_0xf91b('0x15')](db[_0xf91b('0x16')][_0xf91b('0x17')],function(_0x2d48d3){return{'name':_0x2d48d3[_0xf91b('0x18')],'type':_0x2d48d3[_0xf91b('0x19')][_0xf91b('0x1a')]};});_0x190a46[_0xf91b('0x1b')]=_[_0xf91b('0x15')](_0x137c13,_0xf91b('0x12'));_0x190a46['query']=_[_0xf91b('0x1c')](_0x50bc91['query']);_0x190a46['filters']=_[_0xf91b('0x1d')](_0x190a46[_0xf91b('0x1b')],_0x190a46[_0xf91b('0x1e')]);_0x57f318['attributes']=_[_0xf91b('0x1d')](_0x190a46['model'],qs[_0xf91b('0x1f')](_0x50bc91[_0xf91b('0x1e')]['fields']));_0x57f318[_0xf91b('0x20')]=_0x57f318['attributes']['length']?_0x57f318[_0xf91b('0x20')]:_0x190a46[_0xf91b('0x1b')];if(!_0x50bc91[_0xf91b('0x1e')][_0xf91b('0x21')](_0xf91b('0x22'))){_0x57f318[_0xf91b('0x9')]=qs['limit'](_0x50bc91[_0xf91b('0x1e')][_0xf91b('0x9')]);_0x57f318[_0xf91b('0xb')]=qs[_0xf91b('0xb')](_0x50bc91['query']['offset']);}_0x57f318[_0xf91b('0x23')]=qs['sort'](_0x50bc91[_0xf91b('0x1e')]['sort']);_0x57f318['where']=qs['filters'](_[_0xf91b('0x24')](_0x50bc91[_0xf91b('0x1e')],_0x190a46[_0xf91b('0x25')]),_0x137c13);if(_0x50bc91[_0xf91b('0x1e')][_0xf91b('0x26')]){_0x57f318['where']=_[_0xf91b('0x27')](_0x57f318[_0xf91b('0x28')],{'$or':_[_0xf91b('0x15')](_0x137c13,function(_0x5a0576){if(_0x5a0576[_0xf91b('0x19')]!==_0xf91b('0x29')){var _0xb5ba63={};_0xb5ba63[_0x5a0576[_0xf91b('0x12')]]={'$like':'%'+_0x50bc91[_0xf91b('0x1e')][_0xf91b('0x26')]+'%'};return _0xb5ba63;}})});}_0x57f318=_[_0xf91b('0x27')]({},_0x57f318,_0x50bc91[_0xf91b('0x2a')]);var _0x39a815={'where':_0x57f318['where']};return db[_0xf91b('0x16')][_0xf91b('0xc')](_0x39a815)['then'](function(_0x273ca5){_0x18b8f0[_0xf91b('0xc')]=_0x273ca5;if(_0x50bc91[_0xf91b('0x1e')][_0xf91b('0x2b')]){_0x57f318[_0xf91b('0x2c')]=[{'all':!![]}];}return db[_0xf91b('0x16')]['findAll'](_0x57f318);})[_0xf91b('0x10')](function(_0x36cdca){_0x18b8f0[_0xf91b('0x2d')]=_['map'](_0x36cdca,function(_0x362064){if(_0x362064[_0xf91b('0x2e')]===_0xf91b('0x2f')){var _0x98861d=encryptor[_0xf91b('0x30')](_0x362064[_0xf91b('0x31')]);_0x362064[_0xf91b('0x31')]=maskClientSecret(_0x98861d);}return _0x362064;});return _0x18b8f0;})['then'](respondWithFilteredResult(_0x4148eb,_0x57f318))[_0xf91b('0x32')](handleError(_0x4148eb,null));};exports[_0xf91b('0x33')]=function(_0xde74e6,_0x1faf3d){var _0x47e297={'raw':!![],'where':{'id':_0xde74e6[_0xf91b('0x34')]['id']}},_0x1dfc05={};_0x1dfc05[_0xf91b('0x1b')]=_[_0xf91b('0x1c')](db['CloudProvider']['rawAttributes']);_0x1dfc05[_0xf91b('0x1e')]=_['keys'](_0xde74e6[_0xf91b('0x1e')]);_0x1dfc05[_0xf91b('0x25')]=_[_0xf91b('0x1d')](_0x1dfc05[_0xf91b('0x1b')],_0x1dfc05[_0xf91b('0x1e')]);_0x47e297['attributes']=_[_0xf91b('0x1d')](_0x1dfc05['model'],qs[_0xf91b('0x1f')](_0xde74e6[_0xf91b('0x1e')]['fields']));_0x47e297[_0xf91b('0x20')]=_0x47e297[_0xf91b('0x20')]['length']?_0x47e297['attributes']:_0x1dfc05[_0xf91b('0x1b')];if(_0xde74e6['query'][_0xf91b('0x2b')]){_0x47e297['include']=[{'all':!![]}];}_0x47e297=_['merge']({},_0x47e297,_0xde74e6[_0xf91b('0x2a')]);return db[_0xf91b('0x16')][_0xf91b('0x35')](_0x47e297)[_0xf91b('0x10')](handleEntityNotFound(_0x1faf3d,null))[_0xf91b('0x10')](function(_0x118aa6){if(_0x118aa6[_0xf91b('0x2e')]===_0xf91b('0x2f')){var _0x5abb99=encryptor[_0xf91b('0x30')](_0x118aa6[_0xf91b('0x31')]);_0x118aa6[_0xf91b('0x31')]=maskClientSecret(_0x5abb99);}return _0x118aa6;})['then'](respondWithResult(_0x1faf3d,null))[_0xf91b('0x32')](handleError(_0x1faf3d,null));};exports[_0xf91b('0x36')]=function(_0x5334af,_0xe5fc79){if(!_0x5334af[_0xf91b('0x37')][_0xf91b('0x12')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x5334af['body']['service'])throw new Error(_0xf91b('0x38'));var _0x22a2e0=db[_0xf91b('0x16')][_0xf91b('0x17')]['service'][_0xf91b('0x39')];if(!_0x22a2e0['includes'](_0x5334af['body'][_0xf91b('0x2e')]))throw new Error(_0xf91b('0x3a')+_0x22a2e0[_0xf91b('0x3b')](',\x20'));if(_0x5334af['body'][_0xf91b('0x2e')]===_0xf91b('0x2f')&&_0x5334af['body'][_0xf91b('0x31')]){_0x5334af['body'][_0xf91b('0x31')]=encryptor[_0xf91b('0x3c')](_0x5334af[_0xf91b('0x37')][_0xf91b('0x31')]);}return db[_0xf91b('0x16')][_0xf91b('0x36')](_0x5334af[_0xf91b('0x37')],{})['then'](respondWithResult(_0xe5fc79,0xc9))[_0xf91b('0x32')](handleError(_0xe5fc79,null));};exports[_0xf91b('0x3d')]=function(_0x7365ef,_0x533863){if(_0x7365ef[_0xf91b('0x37')]['id']){delete _0x7365ef[_0xf91b('0x37')]['id'];}return db[_0xf91b('0x16')]['find']({'where':{'id':_0x7365ef[_0xf91b('0x34')]['id']}})[_0xf91b('0x10')](handleEntityNotFound(_0x533863,null))[_0xf91b('0x10')](function(_0x1c46b9){if(_0x1c46b9[_0xf91b('0x2e')]==='MicrosoftAzure'&&_0x7365ef[_0xf91b('0x37')][_0xf91b('0x31')]){_0x7365ef[_0xf91b('0x37')][_0xf91b('0x31')]=encryptor['encryptString'](_0x7365ef['body'][_0xf91b('0x31')]);}return _0x1c46b9;})['then'](saveUpdates(_0x7365ef['body'],null))[_0xf91b('0x10')](respondWithResult(_0x533863,null))['catch'](handleError(_0x533863,null));};exports[_0xf91b('0x3e')]=function(_0x1431f1,_0x54fb2f){return db['CloudProvider'][_0xf91b('0x35')]({'where':{'id':_0x1431f1[_0xf91b('0x34')]['id']}})[_0xf91b('0x10')](handleEntityNotFound(_0x54fb2f,null))[_0xf91b('0x10')](removeEntity(_0x54fb2f,null))['catch'](handleError(_0x54fb2f,null));};exports[_0xf91b('0x3f')]=function(_0x29593e,_0x463667){return db[_0xf91b('0x16')][_0xf91b('0x40')]({'where':{'id':_0x29593e[_0xf91b('0x34')]['id']},'raw':!![]})[_0xf91b('0x10')](function(_0x2aab02){if(!_0x2aab02)return _0x463667[_0xf91b('0x8')](0x194);return{'url':oauth[_0xf91b('0x41')](_0x2aab02,_0x29593e[_0xf91b('0x42')]['id'])};})[_0xf91b('0x10')](respondWithResult(_0x463667,null))[_0xf91b('0x32')](handleError(_0x463667,null));};exports[_0xf91b('0x43')]=function(_0x57b10b,_0x4f031b){var _0x20ab7f=_0x57b10b[_0xf91b('0x37')];var _0x155563;var _0x2b5e2b;if(_0x20ab7f[_0xf91b('0x11')])throw _0x20ab7f;redis[_0xf91b('0x44')](_0x20ab7f[_0xf91b('0x45')])[_0xf91b('0x10')](function(_0xbf7133){if(!_0xbf7133)throw new Error(_0xf91b('0x46'));_0x155563=JSON[_0xf91b('0x47')](_0xbf7133);var _0x40edaa=Buffer[_0xf91b('0x48')](_0x20ab7f[_0xf91b('0x45')],_0xf91b('0x49'))['toString'](_0xf91b('0x4a'));_0x2b5e2b=JSON[_0xf91b('0x47')](_0x40edaa);if(!oauth['isValidIdToken'](_0x20ab7f[_0xf91b('0x4b')],_0x155563[_0xf91b('0x4c')]))throw new Error(_0xf91b('0x4d'));redis[_0xf91b('0x4e')](_0x20ab7f[_0xf91b('0x45')]);return oauth[_0xf91b('0x4f')](_0x20ab7f['code'],_0x155563);})['then'](function(_0x54b8b6){_0x155563[_0xf91b('0x50')]=_0x54b8b6[_0xf91b('0x51')];_0x155563['data6']=_0x54b8b6[_0xf91b('0x52')];return db[_0xf91b('0x16')][_0xf91b('0x3d')]({'data5':_0x155563[_0xf91b('0x50')],'data6':_0x155563['data6']},{'where':{'id':_0x155563['id']}});})[_0xf91b('0x10')](function(){oauth[_0xf91b('0x53')](_0x155563);socket[_0xf91b('0x54')](_0xf91b('0x55'),{'id':_0x2b5e2b['id']});return;})['then'](respondWithStatusCode(_0x4f031b,null))[_0xf91b('0x32')](function(_0x2a20c0){if(_0x2b5e2b){socket[_0xf91b('0x54')](_0xf91b('0x56'),{'id':_0x2b5e2b['id']});}if(!_0x155563){logger[_0xf91b('0x11')](_0xf91b('0x57'),_0x2a20c0);return _0x4f031b[_0xf91b('0xd')](0x1f4)[_0xf91b('0x58')](_0x2a20c0[_0xf91b('0x59')]);}logger['error'](_0xf91b('0x5a'),_0x155563['id'],JSON[_0xf91b('0x5b')](_0x2a20c0));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 83da0b6..b203627 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 _0xf406=['./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x199628,_0x198fc7){var _0x1b9c08=function(_0x15aac8){while(--_0x15aac8){_0x199628['push'](_0x199628['shift']());}};_0x1b9c08(++_0x198fc7);}(_0xf406,0x1a9));var _0x6f40=function(_0x59ae8f,_0x148344){_0x59ae8f=_0x59ae8f-0x0;var _0x3900b5=_0xf406[_0x59ae8f];return _0x3900b5;};'use strict';var _=require(_0x6f40('0x0'));var util=require(_0x6f40('0x1'));var logger=require(_0x6f40('0x2'))(_0x6f40('0x3'));var moment=require('moment');var BPromise=require(_0x6f40('0x4'));var rp=require(_0x6f40('0x5'));var fs=require('fs');var path=require(_0x6f40('0x6'));var rimraf=require(_0x6f40('0x7'));var config=require(_0x6f40('0x8'));var attributes=require(_0x6f40('0x9'));module[_0x6f40('0xa')]=function(_0x3e7cb2,_0x179a7a){return _0x3e7cb2[_0x6f40('0xb')](_0x6f40('0xc'),attributes,{'tableName':_0x6f40('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9974=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','./cloudProvider.attributes','cloud_providers'];(function(_0x45799a,_0x203d8d){var _0x20b234=function(_0x3faf51){while(--_0x3faf51){_0x45799a['push'](_0x45799a['shift']());}};_0x20b234(++_0x203d8d);}(_0x9974,0x168));var _0x4997=function(_0x4f602f,_0x5a0e14){_0x4f602f=_0x4f602f-0x0;var _0x79cf8b=_0x9974[_0x4f602f];return _0x79cf8b;};'use strict';var _=require(_0x4997('0x0'));var util=require(_0x4997('0x1'));var logger=require(_0x4997('0x2'))('api');var moment=require(_0x4997('0x3'));var BPromise=require('bluebird');var rp=require(_0x4997('0x4'));var fs=require('fs');var path=require(_0x4997('0x5'));var rimraf=require(_0x4997('0x6'));var config=require('../../config/environment');var attributes=require(_0x4997('0x7'));module['exports']=function(_0x2bb3dd,_0x2d358d){return _0x2bb3dd['define']('CloudProvider',attributes,{'tableName':_0x4997('0x8'),'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 4ea5503..7d0fb1a 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 _0xf7fa=['bind','findAll','map','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','jsonwebtoken','moment','ioredis','request-promise','util','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','/authorize','type','Dynamics365','push','data7','/.default','join','replace','{TENANT_ID}','data2','code','from','stringify','toString','base64','randomBytes','client_id','data1','response_type','redirect_uri','data4','scope','prompt','key','value','oauth2Claims','set','payload','iss','issuer','aud','nonce','isAfter','unix','exp','resolve','CloudProvider','refresh_token','data6','decryptString','data3','POST','then','access_token','update','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals'];(function(_0x7bbab4,_0xd306ec){var _0x19e00b=function(_0x72bd0){while(--_0x72bd0){_0x7bbab4['push'](_0x7bbab4['shift']());}};_0x19e00b(++_0xd306ec);}(_0xf7fa,0x9f));var _0xaf7f=function(_0x16bc83,_0x426eaf){_0x16bc83=_0x16bc83-0x0;var _0x426ebc=_0xf7fa[_0x16bc83];return _0x426ebc;};'use strict';var _=require(_0xaf7f('0x0'));var crypto=require('crypto');var jwt=require(_0xaf7f('0x1'));var moment=require(_0xaf7f('0x2'));var Redis=require(_0xaf7f('0x3'));var rp=require(_0xaf7f('0x4'));var util=require(_0xaf7f('0x5'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0xaf7f('0x6'))(_0xaf7f('0x7'));var schedule=require(_0xaf7f('0x8'));var db=require(_0xaf7f('0x9'))['db'];config[_0xaf7f('0xa')]=_[_0xaf7f('0xb')](config[_0xaf7f('0xa')],{'host':_0xaf7f('0xc'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0xaf7f('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0xaf7f('0xe'),_0xaf7f('0xf'),_0xaf7f('0x10'),_0xaf7f('0x11'),_0xaf7f('0x12'),_0xaf7f('0x13'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0xaf7f('0xe'),_0xaf7f('0x11')]};var MICROSOFT_AUTH_ENDPOINT=_0xaf7f('0x14');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x73ca47){var _0x50943f=_['map'](AZURE_AUTH_SCOPES[_0x73ca47['type']]);if(_0x73ca47[_0xaf7f('0x15')]===_0xaf7f('0x16'))_0x50943f[_0xaf7f('0x17')](_0x73ca47[_0xaf7f('0x18')]+_0xaf7f('0x19'));return _0x50943f[_0xaf7f('0x1a')]('\x20');}function getAccessTokenScope(_0x3446ab){if(_0x3446ab[_0xaf7f('0x15')]==='Outlook365')return _0xaf7f('0x12');if(_0x3446ab[_0xaf7f('0x15')]===_0xaf7f('0x16'))return _0x3446ab[_0xaf7f('0x18')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x479ec2,_0x35f36c){var _0x32e2f7=MICROSOFT_AUTH_URL[_0xaf7f('0x1b')](_0xaf7f('0x1c'),_0x479ec2[_0xaf7f('0x1d')]);var _0x5d47bf=[_0xaf7f('0x1e'),'id_token'];var _0x5c37d9=Buffer[_0xaf7f('0x1f')](JSON[_0xaf7f('0x20')]({'id':_0x35f36c}))[_0xaf7f('0x21')](_0xaf7f('0x22'));var _0x37e9c7=crypto[_0xaf7f('0x23')](0x10)[_0xaf7f('0x21')]('hex');var _0x42543c=getAuthorizationScopes(_0x479ec2);var _0x25fd64=[{'key':_0xaf7f('0x24'),'value':_0x479ec2[_0xaf7f('0x25')]},{'key':_0xaf7f('0x26'),'value':encodeURIComponent(_0x5d47bf[_0xaf7f('0x1a')]('\x20'))},{'key':_0xaf7f('0x27'),'value':_0x479ec2[_0xaf7f('0x28')]},{'key':'response_mode','value':'form_post'},{'key':_0xaf7f('0x29'),'value':encodeURIComponent(_0x42543c)},{'key':'state','value':_0x5c37d9},{'key':'nonce','value':_0x37e9c7},{'key':_0xaf7f('0x2a'),'value':'login'}];var _0x1d5367=_0x32e2f7+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x25fd64,function(_0xaf2c50){return _0xaf2c50[_0xaf7f('0x2b')]+'='+_0xaf2c50[_0xaf7f('0x2c')];})['join']('&');_0x479ec2[_0xaf7f('0x2d')]={'issuer':_0x32e2f7['replace']('oauth2/',''),'audience':_0x479ec2[_0xaf7f('0x25')],'state':_0x5c37d9,'nonce':_0x37e9c7};redis[_0xaf7f('0x2e')](_0x5c37d9,JSON[_0xaf7f('0x20')](_0x479ec2));return _0x1d5367;}function isValidIdToken(_0x391aa5,_0x35f869){try{var _0x4fe507=jwt['decode'](_0x391aa5,{'complete':!![]});var _0x378dc0=_0x4fe507[_0xaf7f('0x2f')];if(_0x378dc0[_0xaf7f('0x30')]!==_0x35f869[_0xaf7f('0x31')])return![];if(_0x378dc0[_0xaf7f('0x32')]!==_0x35f869['audience'])return![];if(_0x378dc0[_0xaf7f('0x33')]!==_0x35f869['nonce'])return![];if(moment()[_0xaf7f('0x34')](moment[_0xaf7f('0x35')](_0x378dc0[_0xaf7f('0x36')])))return![];return!![];}catch(_0x2339b2){throw _0x2339b2;}}function refreshOauth2MicrosoftAccessToken(_0x569d78){return Promise[_0xaf7f('0x37')]()['then'](function(){if(_0x569d78['data3'])return _0x569d78;return db[_0xaf7f('0x38')]['findOne']({'where':{'id':_0x569d78['id']},'raw':!![]});})['then'](function(_0x27bf59){var _0x4f29ea={'grant_type':_0xaf7f('0x39'),'refresh_token':_0x27bf59[_0xaf7f('0x3a')],'scope':getAccessTokenScope(_0x27bf59),'redirect_uri':_0x27bf59['data4'],'client_id':_0x27bf59[_0xaf7f('0x25')],'client_secret':encryptor[_0xaf7f('0x3b')](_0x27bf59[_0xaf7f('0x3c')])};var _0x390ebe={'method':_0xaf7f('0x3d'),'uri':MICROSOFT_AUTH_URL['replace'](_0xaf7f('0x1c'),_0x27bf59[_0xaf7f('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4f29ea,'json':!![]};return rp(_0x390ebe);})[_0xaf7f('0x3e')](function(_0x13d135){_0x569d78['data5']=_0x13d135[_0xaf7f('0x3f')];_0x569d78[_0xaf7f('0x3a')]=_0x13d135[_0xaf7f('0x39')];return db[_0xaf7f('0x38')][_0xaf7f('0x40')]({'data5':_0x569d78['data5'],'data6':_0x569d78[_0xaf7f('0x3a')]},{'where':{'id':_0x569d78['id']}});})[_0xaf7f('0x3e')](function(){return _0x569d78;})[_0xaf7f('0x41')](function(_0x5eeba0){logger['error'](_0xaf7f('0x42'),_0x569d78['id'],_0x5eeba0);});}function getOauth2MicrosoftAccessToken(_0xb11ae,_0x4f7b14){var _0x231cef={'grant_type':_0xaf7f('0x43'),'code':_0xb11ae,'scope':getAccessTokenScope(_0x4f7b14),'redirect_uri':_0x4f7b14[_0xaf7f('0x28')],'client_id':_0x4f7b14[_0xaf7f('0x25')],'client_secret':encryptor[_0xaf7f('0x3b')](_0x4f7b14[_0xaf7f('0x3c')])};var _0x438c16={'method':_0xaf7f('0x3d'),'uri':MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x4f7b14[_0xaf7f('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x231cef,'json':!![]};return rp(_0x438c16);}function startRefreshInterval(_0x20dd95){var _0x4e2886=schedule[_0xaf7f('0x44')];if(_0x4e2886[_0x20dd95['id']])clearInterval(_0x4e2886[_0x20dd95['id']]);_0x4e2886[_0x20dd95['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xaf7f('0x45')](this,{'id':_0x20dd95['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xaf7f('0x44')]=_0x4e2886;}function startAllRefreshIntervals(){return db[_0xaf7f('0x38')][_0xaf7f('0x46')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xaf7f('0x3e')](function(_0x18a9fc){var _0x3155bd=_0x18a9fc[_0xaf7f('0x47')](function(_0x328aae){return refreshOauth2MicrosoftAccessToken(_0x328aae)['then'](function(_0x19eaa5){startRefreshInterval(_0x19eaa5);});});return Promise['all'](_0x3155bd);})['catch'](function(_0xde45ab){var _0x33b543=_0xde45ab?util[_0xaf7f('0x48')](_0xde45ab,{'showHidden':![],'depth':null}):'';logger[_0xaf7f('0x49')](_0xaf7f('0x4a'),_0x33b543);});}module[_0xaf7f('0x4b')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x69cb=['data2','code','id_token','from','stringify','toString','base64','randomBytes','hex','client_id','data1','response_type','redirect_uri','data4','state','nonce','prompt','key','value','oauth2Claims','oauth2/','decode','payload','iss','issuer','aud','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','decryptString','POST','{TENANT_ID}','access_token','update','data5','data6','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','intervals','bind','findAll','all','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','moment','request-promise','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','profile','offline_access','https://outlook.office.com/POP.AccessAsUser.All','openid','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','replace'];(function(_0x43026d,_0x4d8576){var _0x313e6d=function(_0x3d6a35){while(--_0x3d6a35){_0x43026d['push'](_0x43026d['shift']());}};_0x313e6d(++_0x4d8576);}(_0x69cb,0xd5));var _0xb69c=function(_0x861e02,_0x33f772){_0x861e02=_0x861e02-0x0;var _0x48fc24=_0x69cb[_0x861e02];return _0x48fc24;};'use strict';var _=require(_0xb69c('0x0'));var crypto=require('crypto');var jwt=require('jsonwebtoken');var moment=require(_0xb69c('0x1'));var Redis=require('ioredis');var rp=require(_0xb69c('0x2'));var util=require('util');var encryptor=require(_0xb69c('0x3'));var config=require(_0xb69c('0x4'));var logger=require(_0xb69c('0x5'))(_0xb69c('0x6'));var schedule=require(_0xb69c('0x7'));var db=require(_0xb69c('0x8'))['db'];config[_0xb69c('0x9')]=_[_0xb69c('0xa')](config[_0xb69c('0x9')],{'host':_0xb69c('0xb'),'port':0x18eb});var redis=new Redis(config[_0xb69c('0x9')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0xb69c('0xc'),'email',_0xb69c('0xd'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0xb69c('0xe'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0xb69c('0xf'),_0xb69c('0xd')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0xb69c('0x10');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4ffac0){var _0x3c06c2=_[_0xb69c('0x11')](AZURE_AUTH_SCOPES[_0x4ffac0[_0xb69c('0x12')]]);if(_0x4ffac0['type']===_0xb69c('0x13'))_0x3c06c2[_0xb69c('0x14')](_0x4ffac0[_0xb69c('0x15')]+_0xb69c('0x16'));return _0x3c06c2[_0xb69c('0x17')]('\x20');}function getAccessTokenScope(_0x547fa2){if(_0x547fa2['type']===_0xb69c('0x18'))return _0xb69c('0x19');if(_0x547fa2[_0xb69c('0x12')]===_0xb69c('0x13'))return _0x547fa2[_0xb69c('0x15')]+_0xb69c('0x16');}function generateMicrosoftAuthorizationUrl(_0x2c2ac1,_0x2c1329){var _0x67b459=MICROSOFT_AUTH_URL[_0xb69c('0x1a')]('{TENANT_ID}',_0x2c2ac1[_0xb69c('0x1b')]);var _0x1c29cb=[_0xb69c('0x1c'),_0xb69c('0x1d')];var _0x581c83=Buffer[_0xb69c('0x1e')](JSON[_0xb69c('0x1f')]({'id':_0x2c1329}))[_0xb69c('0x20')](_0xb69c('0x21'));var _0x44ca5e=crypto[_0xb69c('0x22')](0x10)[_0xb69c('0x20')](_0xb69c('0x23'));var _0x3bec85=getAuthorizationScopes(_0x2c2ac1);var _0x18e26f=[{'key':_0xb69c('0x24'),'value':_0x2c2ac1[_0xb69c('0x25')]},{'key':_0xb69c('0x26'),'value':encodeURIComponent(_0x1c29cb['join']('\x20'))},{'key':_0xb69c('0x27'),'value':_0x2c2ac1[_0xb69c('0x28')]},{'key':'response_mode','value':'form_post'},{'key':'scope','value':encodeURIComponent(_0x3bec85)},{'key':_0xb69c('0x29'),'value':_0x581c83},{'key':_0xb69c('0x2a'),'value':_0x44ca5e},{'key':_0xb69c('0x2b'),'value':'login'}];var _0x2f490c=_0x67b459+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xb69c('0x11')](_0x18e26f,function(_0x3093c5){return _0x3093c5[_0xb69c('0x2c')]+'='+_0x3093c5[_0xb69c('0x2d')];})[_0xb69c('0x17')]('&');_0x2c2ac1[_0xb69c('0x2e')]={'issuer':_0x67b459[_0xb69c('0x1a')](_0xb69c('0x2f'),''),'audience':_0x2c2ac1[_0xb69c('0x25')],'state':_0x581c83,'nonce':_0x44ca5e};redis['set'](_0x581c83,JSON['stringify'](_0x2c2ac1));return _0x2f490c;}function isValidIdToken(_0x16c0dc,_0x26f825){try{var _0x260d1b=jwt[_0xb69c('0x30')](_0x16c0dc,{'complete':!![]});var _0x1408d7=_0x260d1b[_0xb69c('0x31')];if(_0x1408d7[_0xb69c('0x32')]!==_0x26f825[_0xb69c('0x33')])return![];if(_0x1408d7[_0xb69c('0x34')]!==_0x26f825[_0xb69c('0x35')])return![];if(_0x1408d7['nonce']!==_0x26f825[_0xb69c('0x2a')])return![];if(moment()[_0xb69c('0x36')](moment[_0xb69c('0x37')](_0x1408d7[_0xb69c('0x38')])))return![];return!![];}catch(_0x2a6bc8){throw _0x2a6bc8;}}function refreshOauth2MicrosoftAccessToken(_0x311852){return Promise[_0xb69c('0x39')]()[_0xb69c('0x3a')](function(){if(_0x311852[_0xb69c('0x3b')])return _0x311852;return db[_0xb69c('0x3c')][_0xb69c('0x3d')]({'where':{'id':_0x311852['id']},'raw':!![]});})['then'](function(_0x5e577c){var _0x4f4d2a={'grant_type':_0xb69c('0x3e'),'refresh_token':_0x5e577c['data6'],'scope':getAccessTokenScope(_0x5e577c),'redirect_uri':_0x5e577c[_0xb69c('0x28')],'client_id':_0x5e577c['data1'],'client_secret':encryptor[_0xb69c('0x3f')](_0x5e577c[_0xb69c('0x3b')])};var _0x54ca73={'method':_0xb69c('0x40'),'uri':MICROSOFT_AUTH_URL[_0xb69c('0x1a')](_0xb69c('0x41'),_0x5e577c[_0xb69c('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4f4d2a,'json':!![]};return rp(_0x54ca73);})[_0xb69c('0x3a')](function(_0x71e8b4){_0x311852['data5']=_0x71e8b4[_0xb69c('0x42')];_0x311852['data6']=_0x71e8b4['refresh_token'];return db['CloudProvider'][_0xb69c('0x43')]({'data5':_0x311852[_0xb69c('0x44')],'data6':_0x311852[_0xb69c('0x45')]},{'where':{'id':_0x311852['id']}});})[_0xb69c('0x3a')](function(){return _0x311852;})[_0xb69c('0x46')](function(_0x78437b){logger['error'](_0xb69c('0x47'),_0x311852['id'],_0x78437b);});}function getOauth2MicrosoftAccessToken(_0x5826eb,_0x4dfe7b){var _0x1413e4={'grant_type':'authorization_code','code':_0x5826eb,'scope':getAccessTokenScope(_0x4dfe7b),'redirect_uri':_0x4dfe7b[_0xb69c('0x28')],'client_id':_0x4dfe7b[_0xb69c('0x25')],'client_secret':encryptor['decryptString'](_0x4dfe7b[_0xb69c('0x3b')])};var _0x515270={'method':_0xb69c('0x40'),'uri':MICROSOFT_AUTH_URL[_0xb69c('0x1a')](_0xb69c('0x41'),_0x4dfe7b[_0xb69c('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1413e4,'json':!![]};return rp(_0x515270);}function startRefreshInterval(_0x4fb358){var _0x55a616=schedule[_0xb69c('0x48')];if(_0x55a616[_0x4fb358['id']])clearInterval(_0x55a616[_0x4fb358['id']]);_0x55a616[_0x4fb358['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xb69c('0x49')](this,{'id':_0x4fb358['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x55a616;}function startAllRefreshIntervals(){return db[_0xb69c('0x3c')][_0xb69c('0x4a')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x51759a){var _0x4ab598=_0x51759a[_0xb69c('0x11')](function(_0x19d615){return refreshOauth2MicrosoftAccessToken(_0x19d615)[_0xb69c('0x3a')](function(_0x50b5b9){startRefreshInterval(_0x50b5b9);});});return Promise[_0xb69c('0x4b')](_0x4ab598);})[_0xb69c('0x46')](function(_0xcb0e3d){var _0x9f1658=_0xcb0e3d?util[_0xb69c('0x4c')](_0xcb0e3d,{'showHidden':![],'depth':null}):'';logger[_0xb69c('0x4d')](_0xb69c('0x4e'),_0x9f1658);});}module[_0xb69c('0x4f')]={'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 fb6451c..6f7c396 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 _0xfff0=['../../config/environment','client','http','then','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x40162c,_0x256d00){var _0x816aad=function(_0x550d13){while(--_0x550d13){_0x40162c['push'](_0x40162c['shift']());}};_0x816aad(++_0x256d00);}(_0xfff0,0x139));var _0x0fff=function(_0x89cada,_0x585233){_0x89cada=_0x89cada-0x0;var _0x494834=_0xfff0[_0x89cada];return _0x494834;};'use strict';var _=require('lodash');var util=require(_0x0fff('0x0'));var moment=require(_0x0fff('0x1'));var BPromise=require(_0x0fff('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0fff('0x3'));var db=require(_0x0fff('0x4'))['db'];var utils=require(_0x0fff('0x5'));var logger=require('../../config/logger')(_0x0fff('0x6'));var config=require(_0x0fff('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0fff('0x8')][_0x0fff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f1d2b,_0x586dc5,_0x24cfb0){return new BPromise(function(_0x5e9672,_0x1f2658){return client['request'](_0x2f1d2b,_0x24cfb0)[_0x0fff('0xa')](function(_0x3db6f6){logger['info'](_0x0fff('0xb'),_0x586dc5,_0x0fff('0xc'));logger[_0x0fff('0xd')](_0x0fff('0xe'),_0x586dc5,_0x0fff('0xc'),JSON[_0x0fff('0xf')](_0x3db6f6));if(_0x3db6f6[_0x0fff('0x10')]){if(_0x3db6f6[_0x0fff('0x10')][_0x0fff('0x11')]===0x1f4){logger[_0x0fff('0x10')](_0x0fff('0xb'),_0x586dc5,_0x3db6f6['error'][_0x0fff('0x12')]);return _0x1f2658(_0x3db6f6['error'][_0x0fff('0x12')]);}logger[_0x0fff('0x10')](_0x0fff('0xb'),_0x586dc5,_0x3db6f6[_0x0fff('0x10')]['message']);return _0x5e9672(_0x3db6f6['error'][_0x0fff('0x12')]);}else{logger['info']('CloudProvider,\x20%s,\x20%s',_0x586dc5,'request\x20sent');_0x5e9672(_0x3db6f6[_0x0fff('0x13')][_0x0fff('0x12')]);}})['catch'](function(_0x431b33){logger[_0x0fff('0x10')]('CloudProvider,\x20%s,\x20%s',_0x586dc5,_0x431b33);_0x1f2658(_0x431b33);});});} \ No newline at end of file +var _0xa467=['../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x49052b,_0x3ba709){var _0x48c045=function(_0x41ac38){while(--_0x41ac38){_0x49052b['push'](_0x49052b['shift']());}};_0x48c045(++_0x3ba709);}(_0xa467,0x143));var _0x7a46=function(_0x1a0e2f,_0x173d4f){_0x1a0e2f=_0x1a0e2f-0x0;var _0x1b74c6=_0xa467[_0x1a0e2f];return _0x1b74c6;};'use strict';var _=require(_0x7a46('0x0'));var util=require(_0x7a46('0x1'));var moment=require(_0x7a46('0x2'));var BPromise=require(_0x7a46('0x3'));var rs=require(_0x7a46('0x4'));var fs=require('fs');var Redis=require(_0x7a46('0x5'));var db=require(_0x7a46('0x6'))['db'];var utils=require(_0x7a46('0x7'));var logger=require(_0x7a46('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7a46('0x9'));var client=jayson[_0x7a46('0xa')][_0x7a46('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x463cdf,_0x6d8fce,_0x550c38){return new BPromise(function(_0x341d9e,_0x1f8b07){return client[_0x7a46('0xc')](_0x463cdf,_0x550c38)[_0x7a46('0xd')](function(_0x382b56){logger[_0x7a46('0xe')]('CloudProvider,\x20%s,\x20%s',_0x6d8fce,_0x7a46('0xf'));logger['debug'](_0x7a46('0x10'),_0x6d8fce,'request\x20sent',JSON[_0x7a46('0x11')](_0x382b56));if(_0x382b56[_0x7a46('0x12')]){if(_0x382b56[_0x7a46('0x12')][_0x7a46('0x13')]===0x1f4){logger[_0x7a46('0x12')]('CloudProvider,\x20%s,\x20%s',_0x6d8fce,_0x382b56[_0x7a46('0x12')][_0x7a46('0x14')]);return _0x1f8b07(_0x382b56[_0x7a46('0x12')][_0x7a46('0x14')]);}logger[_0x7a46('0x12')]('CloudProvider,\x20%s,\x20%s',_0x6d8fce,_0x382b56[_0x7a46('0x12')]['message']);return _0x341d9e(_0x382b56['error'][_0x7a46('0x14')]);}else{logger[_0x7a46('0xe')]('CloudProvider,\x20%s,\x20%s',_0x6d8fce,_0x7a46('0xf'));_0x341d9e(_0x382b56['result'][_0x7a46('0x14')]);}})[_0x7a46('0x15')](function(_0x50e40e){logger[_0x7a46('0x12')]('CloudProvider,\x20%s,\x20%s',_0x6d8fce,_0x50e40e);_0x1f8b07(_0x50e40e);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index d1d590f..84f9901 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x2e5c9c,_0x1e81f3){var _0x9200c1=function(_0x10eae5){while(--_0x10eae5){_0x2e5c9c['push'](_0x2e5c9c['shift']());}};_0x9200c1(++_0x1e81f3);}(_0xadb5,0xad));var _0x5adb=function(_0x1d30b3,_0x3d499b){_0x1d30b3=_0x1d30b3-0x0;var _0x1f9a3f=_0xadb5[_0x1d30b3];return _0x1f9a3f;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['index']);router[_0x5adb('0x2')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller['show']);router[_0x5adb('0x5')]('/',auth[_0x5adb('0x3')](),controller[_0x5adb('0x6')]);router[_0x5adb('0x7')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0xa')]);router[_0x5adb('0x2')](_0x5adb('0xb'),auth[_0x5adb('0x3')](),controller['oauth2MicrosoftAuthorize']);router['post'](_0x5adb('0xc'),controller[_0x5adb('0xd')]);module[_0x5adb('0xe')]=router; \ No newline at end of file +var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x1261,0x144));var _0x1126=function(_0x4a6934,_0x1237f4){_0x4a6934=_0x4a6934-0x0;var _0x532acf=_0x1261[_0x4a6934];return _0x532acf;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 4612862..92fa0f3 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 _0x3270=['exports','STRING','name','sequelize'];(function(_0x49ad79,_0x48ee93){var _0xa4e38a=function(_0x4925c7){while(--_0x4925c7){_0x49ad79['push'](_0x49ad79['shift']());}};_0xa4e38a(++_0x48ee93);}(_0x3270,0xcf));var _0x0327=function(_0x5f1cf8,_0x5e0923){_0x5f1cf8=_0x5f1cf8-0x0;var _0x27d0fa=_0x3270[_0x5f1cf8];return _0x27d0fa;};'use strict';var Sequelize=require(_0x0327('0x0'));module[_0x0327('0x1')]={'name':{'type':Sequelize[_0x0327('0x2')],'unique':_0x0327('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x0327('0x2')]},'companyId':{'type':Sequelize[_0x0327('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x0327('0x2')]},'type':{'type':Sequelize[_0x0327('0x2')]},'street':{'type':Sequelize[_0x0327('0x2')]},'postalCode':{'type':Sequelize[_0x0327('0x2')]},'city':{'type':Sequelize[_0x0327('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x0327('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x0327('0x2')]},'sStreet':{'type':Sequelize[_0x0327('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x0327('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6690=['STRING','name','exports'];(function(_0x94a268,_0x68f124){var _0x6eb3fd=function(_0x2bdce7){while(--_0x2bdce7){_0x94a268['push'](_0x94a268['shift']());}};_0x6eb3fd(++_0x68f124);}(_0x6690,0x7a));var _0x0669=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x6690[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require('sequelize');module[_0x0669('0x0')]={'name':{'type':Sequelize[_0x0669('0x1')],'unique':_0x0669('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x0669('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x0669('0x1')]},'phone':{'type':Sequelize[_0x0669('0x1')]},'fax':{'type':Sequelize[_0x0669('0x1')]},'type':{'type':Sequelize[_0x0669('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x0669('0x1')]},'email':{'type':Sequelize[_0x0669('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x0669('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x0669('0x1')]},'sCity':{'type':Sequelize[_0x0669('0x1')]},'sCountry':{'type':Sequelize[_0x0669('0x1')]},'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 b307d50..f4bf583 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 _0x99b8=['body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','getContacts','findOne','order','pick','map','options','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','json','reject','save','update','then','destroy','get','error','stack','name','CmCompany','describe','keys','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','include','findAll','rows','catch','show','params','intersection','includeAll','create'];(function(_0x2375d6,_0x54fb98){var _0x4e3ab3=function(_0x16eede){while(--_0x16eede){_0x2375d6['push'](_0x2375d6['shift']());}};_0x4e3ab3(++_0x54fb98);}(_0x99b8,0x67));var _0x899b=function(_0x5e22f0,_0x346e80){_0x5e22f0=_0x5e22f0-0x0;var _0x2861a5=_0x99b8[_0x5e22f0];return _0x2861a5;};'use strict';var emlformat=require(_0x899b('0x0'));var rimraf=require(_0x899b('0x1'));var zipdir=require(_0x899b('0x2'));var jsonpatch=require(_0x899b('0x3'));var rp=require(_0x899b('0x4'));var moment=require(_0x899b('0x5'));var BPromise=require(_0x899b('0x6'));var Mustache=require(_0x899b('0x7'));var util=require(_0x899b('0x8'));var path=require(_0x899b('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x899b('0xa'));var _=require(_0x899b('0xb'));var squel=require('squel');var crypto=require(_0x899b('0xc'));var jsforce=require(_0x899b('0xd'));var deskjs=require(_0x899b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x899b('0xf'));var Papa=require(_0x899b('0x10'));var Redis=require(_0x899b('0x11'));var authService=require(_0x899b('0x12'));var qs=require(_0x899b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x899b('0x14'));var logger=require('../../config/logger')(_0x899b('0x15'));var utils=require(_0x899b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x899b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37fdfd,_0x4a1d37){_0x4a1d37=_0x4a1d37||0xcc;return function(_0x1eb090){if(_0x1eb090){return _0x37fdfd[_0x899b('0x18')](_0x4a1d37);}return _0x37fdfd['status'](_0x4a1d37)[_0x899b('0x19')]();};}function respondWithResult(_0xc0aafa,_0x33561c){_0x33561c=_0x33561c||0xc8;return function(_0x1933e0){if(_0x1933e0){return _0xc0aafa[_0x899b('0x1a')](_0x33561c)['json'](_0x1933e0);}};}function respondWithFilteredResult(_0x3c231c,_0x9c3c44){return function(_0x21cf3c){if(_0x21cf3c){var _0x5420b4=typeof _0x9c3c44[_0x899b('0x1b')]===_0x899b('0x1c')&&typeof _0x9c3c44[_0x899b('0x1d')]===_0x899b('0x1c');var _0x3f0ee2=_0x21cf3c[_0x899b('0x1e')];var _0x1be7af=_0x5420b4?0x0:_0x9c3c44[_0x899b('0x1b')];var _0x566231=_0x5420b4?_0x21cf3c[_0x899b('0x1e')]:_0x9c3c44['offset']+_0x9c3c44['limit'];var _0x33874d;if(_0x566231>=_0x3f0ee2){_0x566231=_0x3f0ee2;_0x33874d=0xc8;}else{_0x33874d=0xce;}_0x3c231c[_0x899b('0x1a')](_0x33874d);return _0x3c231c['set']('Content-Range',_0x1be7af+'-'+_0x566231+'/'+_0x3f0ee2)[_0x899b('0x1f')](_0x21cf3c);}return null;};}function patchUpdates(_0x297715){return function(_0xd401c0){try{jsonpatch['apply'](_0xd401c0,_0x297715,!![]);}catch(_0x207d87){return BPromise[_0x899b('0x20')](_0x207d87);}return _0xd401c0[_0x899b('0x21')]();};}function saveUpdates(_0x2e3d07,_0x42e193){return function(_0x1544d2){if(_0x1544d2){return _0x1544d2[_0x899b('0x22')](_0x2e3d07)[_0x899b('0x23')](function(_0x1e5235){return _0x1e5235;});}return null;};}function removeEntity(_0x274e39,_0x463fa1){return function(_0x429402){if(_0x429402){return _0x429402[_0x899b('0x24')]()[_0x899b('0x23')](function(){var _0x3cce91=_0x429402[_0x899b('0x25')]({'plain':!![]});var _0x2ec734='Companies';return db['UserProfileResource']['destroy']({'where':{'type':_0x2ec734,'resourceId':_0x3cce91['id']}})[_0x899b('0x23')](function(){return _0x429402;});})[_0x899b('0x23')](function(){_0x274e39[_0x899b('0x1a')](0xcc)[_0x899b('0x19')]();});}};}function handleEntityNotFound(_0x197073,_0x463ef1){return function(_0x45d570){if(!_0x45d570){_0x197073[_0x899b('0x18')](0x194);}return _0x45d570;};}function handleError(_0x1ea5d0,_0x391c96){_0x391c96=_0x391c96||0x1f4;return function(_0x4bc518){logger[_0x899b('0x26')](_0x4bc518[_0x899b('0x27')]);if(_0x4bc518[_0x899b('0x28')]){delete _0x4bc518[_0x899b('0x28')];}_0x1ea5d0[_0x899b('0x1a')](_0x391c96)['send'](_0x4bc518);};}exports['index']=function(_0x4ffcd6,_0x420abd){var _0xef4c65={},_0x5b8b53={},_0x58c62f={'count':0x0,'rows':[]};return db[_0x899b('0x29')][_0x899b('0x2a')]()[_0x899b('0x23')](function(_0x4653d5){_0x5b8b53['model']=_[_0x899b('0x2b')](_0x4653d5);_0x5b8b53[_0x899b('0x2c')]=_[_0x899b('0x2b')](_0x4ffcd6[_0x899b('0x2c')]);_0x5b8b53[_0x899b('0x2d')]=_['intersection'](_0x5b8b53[_0x899b('0x2e')],_0x5b8b53[_0x899b('0x2c')]);_0xef4c65[_0x899b('0x2f')]=_['intersection'](_0x5b8b53[_0x899b('0x2e')],qs[_0x899b('0x30')](_0x4ffcd6[_0x899b('0x2c')][_0x899b('0x30')]));_0xef4c65['attributes']=_0xef4c65[_0x899b('0x2f')][_0x899b('0x31')]?_0xef4c65[_0x899b('0x2f')]:_0x5b8b53['model'];if(!_0x4ffcd6['query'][_0x899b('0x32')](_0x899b('0x33'))){_0xef4c65['limit']=qs[_0x899b('0x1d')](_0x4ffcd6[_0x899b('0x2c')]['limit']);_0xef4c65[_0x899b('0x1b')]=qs[_0x899b('0x1b')](_0x4ffcd6['query'][_0x899b('0x1b')]);}_0xef4c65['order']=qs[_0x899b('0x34')](_0x4ffcd6['query'][_0x899b('0x34')]);_0xef4c65['where']=qs[_0x899b('0x2d')](_['pick'](_0x4ffcd6[_0x899b('0x2c')],_0x5b8b53[_0x899b('0x2d')]),_0x4653d5);if(_0x4ffcd6[_0x899b('0x2c')][_0x899b('0x35')]){_0xef4c65[_0x899b('0x36')]=_[_0x899b('0x37')](_0xef4c65[_0x899b('0x36')],{'$or':_['map'](_0xef4c65[_0x899b('0x2f')],function(_0x4b4695){var _0x2b028f={};_0x2b028f[_0x4b4695]={'$like':'%'+_0x4ffcd6[_0x899b('0x2c')][_0x899b('0x35')]+'%'};return _0x2b028f;})});}_0xef4c65=_[_0x899b('0x37')]({},_0xef4c65,_0x4ffcd6['options']);var _0x1c2361={'where':_0xef4c65['where']};return db[_0x899b('0x29')][_0x899b('0x1e')](_0x1c2361)[_0x899b('0x23')](function(_0x48265c){_0x58c62f[_0x899b('0x1e')]=_0x48265c;if(_0x4ffcd6['query']['includeAll']){_0xef4c65[_0x899b('0x38')]=[{'all':!![]}];}return db[_0x899b('0x29')][_0x899b('0x39')](_0xef4c65);})[_0x899b('0x23')](function(_0x5c93f9){_0x58c62f[_0x899b('0x3a')]=_0x5c93f9;return _0x58c62f;})[_0x899b('0x23')](respondWithFilteredResult(_0x420abd,_0xef4c65))[_0x899b('0x3b')](handleError(_0x420abd,null));})[_0x899b('0x3b')](handleError(_0x420abd,null));};exports[_0x899b('0x3c')]=function(_0x5165cf,_0x2bddf4){var _0x1ca1c3={'raw':![],'where':{'id':_0x5165cf[_0x899b('0x3d')]['id']}},_0x3e365b={};_0x3e365b[_0x899b('0x2e')]=_[_0x899b('0x2b')](db[_0x899b('0x29')]['rawAttributes']);_0x3e365b[_0x899b('0x2c')]=_[_0x899b('0x2b')](_0x5165cf[_0x899b('0x2c')]);_0x3e365b[_0x899b('0x2d')]=_[_0x899b('0x3e')](_0x3e365b[_0x899b('0x2e')],_0x3e365b[_0x899b('0x2c')]);_0x1ca1c3[_0x899b('0x2f')]=_['intersection'](_0x3e365b[_0x899b('0x2e')],qs[_0x899b('0x30')](_0x5165cf['query'][_0x899b('0x30')]));_0x1ca1c3[_0x899b('0x2f')]=_0x1ca1c3[_0x899b('0x2f')][_0x899b('0x31')]?_0x1ca1c3[_0x899b('0x2f')]:_0x3e365b[_0x899b('0x2e')];if(_0x5165cf[_0x899b('0x2c')][_0x899b('0x3f')]){_0x1ca1c3[_0x899b('0x38')]=[{'all':!![]}];}_0x1ca1c3=_[_0x899b('0x37')]({},_0x1ca1c3,_0x5165cf['options']);return db[_0x899b('0x29')]['find'](_0x1ca1c3)['then'](handleEntityNotFound(_0x2bddf4,null))[_0x899b('0x23')](respondWithResult(_0x2bddf4,null))[_0x899b('0x3b')](handleError(_0x2bddf4,null));};exports[_0x899b('0x40')]=function(_0x4de4a8,_0x1b18af){return db[_0x899b('0x29')]['create'](_0x4de4a8[_0x899b('0x41')],{})['then'](function(_0x4d2141){var _0x136871=_0x4de4a8['user'][_0x899b('0x25')]({'plain':!![]});if(!_0x136871)throw new Error(_0x899b('0x42'));if(_0x136871[_0x899b('0x43')]===_0x899b('0x44')){var _0x383522=_0x4d2141[_0x899b('0x25')]({'plain':!![]});var _0xfbd1d3='Companies';return db['UserProfileSection'][_0x899b('0x45')]({'where':{'name':_0xfbd1d3,'userProfileId':_0x136871[_0x899b('0x46')]},'raw':!![]})[_0x899b('0x23')](function(_0x27cf8b){if(_0x27cf8b&&_0x27cf8b[_0x899b('0x47')]===0x0){return db[_0x899b('0x48')]['create']({'name':_0x383522[_0x899b('0x28')],'resourceId':_0x383522['id'],'type':_0x27cf8b[_0x899b('0x28')],'sectionId':_0x27cf8b['id']},{})[_0x899b('0x23')](function(){return _0x4d2141;});}else{return _0x4d2141;}})[_0x899b('0x3b')](function(_0x29e70a){logger[_0x899b('0x26')](_0x899b('0x49'),_0x29e70a);throw _0x29e70a;});}return _0x4d2141;})['then'](respondWithResult(_0x1b18af,0xc9))[_0x899b('0x3b')](handleError(_0x1b18af,null));};exports[_0x899b('0x22')]=function(_0x18bacd,_0x5d9ace){if(_0x18bacd[_0x899b('0x41')]['id']){delete _0x18bacd['body']['id'];}return db['CmCompany'][_0x899b('0x45')]({'where':{'id':_0x18bacd['params']['id']}})[_0x899b('0x23')](handleEntityNotFound(_0x5d9ace,null))[_0x899b('0x23')](saveUpdates(_0x18bacd[_0x899b('0x41')],null))[_0x899b('0x23')](respondWithResult(_0x5d9ace,null))[_0x899b('0x3b')](handleError(_0x5d9ace,null));};exports[_0x899b('0x24')]=function(_0x46463e,_0x431d1f){return db[_0x899b('0x29')][_0x899b('0x45')]({'where':{'id':_0x46463e[_0x899b('0x3d')]['id']}})[_0x899b('0x23')](handleEntityNotFound(_0x431d1f,null))[_0x899b('0x23')](removeEntity(_0x431d1f,null))['catch'](handleError(_0x431d1f,null));};exports[_0x899b('0x2a')]=function(_0x5686c5,_0x10d570){return db[_0x899b('0x29')][_0x899b('0x2a')]()['then'](respondWithResult(_0x10d570,null))[_0x899b('0x3b')](handleError(_0x10d570,null));};exports[_0x899b('0x4a')]=function(_0x4d106f,_0x39f5b3,_0x306268){return db[_0x899b('0x4b')][_0x899b('0x45')]({'where':{'id':_0x4d106f['params']['id']}})[_0x899b('0x23')](handleEntityNotFound(_0x39f5b3,null))[_0x899b('0x23')](function(_0x53191d){if(_0x53191d){return _0x53191d['addContacts'](_0x4d106f[_0x899b('0x41')][_0x899b('0x4c')],_[_0x899b('0x4d')](_0x4d106f[_0x899b('0x41')],['ids','id'])||{});}})[_0x899b('0x23')](respondWithResult(_0x39f5b3,null))[_0x899b('0x3b')](handleError(_0x39f5b3,null));};exports[_0x899b('0x4e')]=function(_0x52a44a,_0x4b58e6,_0x92d6ad){var _0x269bea={};var _0xbe9cbc={};var _0x5980b6;var _0x2aa4af;return db['CmCompany'][_0x899b('0x4f')]({'where':{'id':_0x52a44a[_0x899b('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4b58e6,null))[_0x899b('0x23')](function(_0x2e02e0){if(_0x2e02e0){_0x5980b6=_0x2e02e0;_0xbe9cbc[_0x899b('0x2e')]=_[_0x899b('0x2b')](db[_0x899b('0x4b')]['rawAttributes']);_0xbe9cbc['query']=_['keys'](_0x52a44a[_0x899b('0x2c')]);_0xbe9cbc[_0x899b('0x2d')]=_[_0x899b('0x3e')](_0xbe9cbc[_0x899b('0x2e')],_0xbe9cbc[_0x899b('0x2c')]);_0x269bea['attributes']=_[_0x899b('0x3e')](_0xbe9cbc[_0x899b('0x2e')],qs['fields'](_0x52a44a[_0x899b('0x2c')][_0x899b('0x30')]));_0x269bea[_0x899b('0x2f')]=_0x269bea[_0x899b('0x2f')]['length']?_0x269bea['attributes']:_0xbe9cbc[_0x899b('0x2e')];_0x269bea[_0x899b('0x50')]=qs['sort'](_0x52a44a[_0x899b('0x2c')][_0x899b('0x34')]);_0x269bea[_0x899b('0x36')]=qs[_0x899b('0x2d')](_[_0x899b('0x51')](_0x52a44a[_0x899b('0x2c')],_0xbe9cbc[_0x899b('0x2d')]));if(_0x52a44a[_0x899b('0x2c')]['filter']){_0x269bea[_0x899b('0x36')]=_['merge'](_0x269bea[_0x899b('0x36')],{'$or':_[_0x899b('0x52')](_0x269bea['attributes'],function(_0x3e033e){var _0x2e660e={};_0x2e660e[_0x3e033e]={'$like':'%'+_0x52a44a['query'][_0x899b('0x35')]+'%'};return _0x2e660e;})});}_0x269bea=_[_0x899b('0x37')]({},_0x269bea,_0x52a44a[_0x899b('0x53')]);return _0x5980b6[_0x899b('0x4e')](_0x269bea);}})[_0x899b('0x23')](function(_0x5c5421){if(_0x5c5421){_0x2aa4af=_0x5c5421['length'];if(!_0x52a44a[_0x899b('0x2c')][_0x899b('0x32')]('nolimit')){_0x269bea['limit']=qs[_0x899b('0x1d')](_0x52a44a['query'][_0x899b('0x1d')]);_0x269bea[_0x899b('0x1b')]=qs[_0x899b('0x1b')](_0x52a44a['query'][_0x899b('0x1b')]);}return _0x5980b6[_0x899b('0x4e')](_0x269bea);}})[_0x899b('0x23')](function(_0x6d3ca4){if(_0x6d3ca4){return _0x6d3ca4?{'count':_0x2aa4af,'rows':_0x6d3ca4}:null;}})[_0x899b('0x23')](respondWithResult(_0x4b58e6,null))['catch'](handleError(_0x4b58e6,null));}; \ No newline at end of file +var _0xc2bc=['stack','name','send','index','describe','model','keys','intersection','attributes','query','fields','length','hasOwnProperty','order','sort','filters','filter','where','merge','options','CmCompany','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','getContacts','findOne','map','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','get','Companies','UserProfileResource','destroy','error'];(function(_0x5288a8,_0x3dafed){var _0x1f9e67=function(_0x26e598){while(--_0x26e598){_0x5288a8['push'](_0x5288a8['shift']());}};_0x1f9e67(++_0x3dafed);}(_0xc2bc,0x139));var _0xcc2b=function(_0x36b927,_0x67c31f){_0x36b927=_0x36b927-0x0;var _0x42e629=_0xc2bc[_0x36b927];return _0x42e629;};'use strict';var emlformat=require(_0xcc2b('0x0'));var rimraf=require(_0xcc2b('0x1'));var zipdir=require(_0xcc2b('0x2'));var jsonpatch=require(_0xcc2b('0x3'));var rp=require(_0xcc2b('0x4'));var moment=require(_0xcc2b('0x5'));var BPromise=require(_0xcc2b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xcc2b('0x7'));var sox=require('sox');var csv=require(_0xcc2b('0x8'));var ejs=require(_0xcc2b('0x9'));var fs=require('fs');var fs_extra=require(_0xcc2b('0xa'));var _=require(_0xcc2b('0xb'));var squel=require('squel');var crypto=require(_0xcc2b('0xc'));var jsforce=require(_0xcc2b('0xd'));var deskjs=require(_0xcc2b('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcc2b('0xf'));var authService=require(_0xcc2b('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcc2b('0x11'));var logger=require(_0xcc2b('0x12'))(_0xcc2b('0x13'));var utils=require(_0xcc2b('0x14'));var config=require(_0xcc2b('0x15'));var licenseUtil=require(_0xcc2b('0x16'));var db=require(_0xcc2b('0x17'))['db'];function respondWithStatusCode(_0x1de27c,_0x17e196){_0x17e196=_0x17e196||0xcc;return function(_0x124553){if(_0x124553){return _0x1de27c[_0xcc2b('0x18')](_0x17e196);}return _0x1de27c['status'](_0x17e196)[_0xcc2b('0x19')]();};}function respondWithResult(_0x56ba6a,_0x5cf089){_0x5cf089=_0x5cf089||0xc8;return function(_0xfaddb8){if(_0xfaddb8){return _0x56ba6a[_0xcc2b('0x1a')](_0x5cf089)[_0xcc2b('0x1b')](_0xfaddb8);}};}function respondWithFilteredResult(_0x55ea90,_0x4d8eeb){return function(_0x593fd5){if(_0x593fd5){var _0x347f66=typeof _0x4d8eeb[_0xcc2b('0x1c')]==='undefined'&&typeof _0x4d8eeb[_0xcc2b('0x1d')]==='undefined';var _0xd68cfe=_0x593fd5['count'];var _0x12f71d=_0x347f66?0x0:_0x4d8eeb[_0xcc2b('0x1c')];var _0x1356d2=_0x347f66?_0x593fd5[_0xcc2b('0x1e')]:_0x4d8eeb[_0xcc2b('0x1c')]+_0x4d8eeb[_0xcc2b('0x1d')];var _0x22ad92;if(_0x1356d2>=_0xd68cfe){_0x1356d2=_0xd68cfe;_0x22ad92=0xc8;}else{_0x22ad92=0xce;}_0x55ea90[_0xcc2b('0x1a')](_0x22ad92);return _0x55ea90[_0xcc2b('0x1f')](_0xcc2b('0x20'),_0x12f71d+'-'+_0x1356d2+'/'+_0xd68cfe)[_0xcc2b('0x1b')](_0x593fd5);}return null;};}function patchUpdates(_0x3df0fc){return function(_0x5f3dcd){try{jsonpatch[_0xcc2b('0x21')](_0x5f3dcd,_0x3df0fc,!![]);}catch(_0x52c601){return BPromise[_0xcc2b('0x22')](_0x52c601);}return _0x5f3dcd[_0xcc2b('0x23')]();};}function saveUpdates(_0x4d0a5c,_0x4a037e){return function(_0x35b60d){if(_0x35b60d){return _0x35b60d[_0xcc2b('0x24')](_0x4d0a5c)['then'](function(_0xb9ae5c){return _0xb9ae5c;});}return null;};}function removeEntity(_0xd0d805,_0x50f385){return function(_0x3b30e7){if(_0x3b30e7){return _0x3b30e7['destroy']()[_0xcc2b('0x25')](function(){var _0x5a49e7=_0x3b30e7[_0xcc2b('0x26')]({'plain':!![]});var _0x49850=_0xcc2b('0x27');return db[_0xcc2b('0x28')][_0xcc2b('0x29')]({'where':{'type':_0x49850,'resourceId':_0x5a49e7['id']}})[_0xcc2b('0x25')](function(){return _0x3b30e7;});})['then'](function(){_0xd0d805['status'](0xcc)[_0xcc2b('0x19')]();});}};}function handleEntityNotFound(_0x5f8161,_0x76af9d){return function(_0x132efb){if(!_0x132efb){_0x5f8161[_0xcc2b('0x18')](0x194);}return _0x132efb;};}function handleError(_0x4d5858,_0x51a8c7){_0x51a8c7=_0x51a8c7||0x1f4;return function(_0x34e436){logger[_0xcc2b('0x2a')](_0x34e436[_0xcc2b('0x2b')]);if(_0x34e436['name']){delete _0x34e436[_0xcc2b('0x2c')];}_0x4d5858['status'](_0x51a8c7)[_0xcc2b('0x2d')](_0x34e436);};}exports[_0xcc2b('0x2e')]=function(_0x2b14d9,_0x41381a){var _0x25962e={},_0x5dec43={},_0x128f5a={'count':0x0,'rows':[]};return db['CmCompany'][_0xcc2b('0x2f')]()[_0xcc2b('0x25')](function(_0x198a80){_0x5dec43[_0xcc2b('0x30')]=_[_0xcc2b('0x31')](_0x198a80);_0x5dec43['query']=_[_0xcc2b('0x31')](_0x2b14d9['query']);_0x5dec43['filters']=_[_0xcc2b('0x32')](_0x5dec43['model'],_0x5dec43['query']);_0x25962e[_0xcc2b('0x33')]=_[_0xcc2b('0x32')](_0x5dec43[_0xcc2b('0x30')],qs['fields'](_0x2b14d9[_0xcc2b('0x34')][_0xcc2b('0x35')]));_0x25962e[_0xcc2b('0x33')]=_0x25962e[_0xcc2b('0x33')][_0xcc2b('0x36')]?_0x25962e[_0xcc2b('0x33')]:_0x5dec43[_0xcc2b('0x30')];if(!_0x2b14d9[_0xcc2b('0x34')][_0xcc2b('0x37')]('nolimit')){_0x25962e['limit']=qs[_0xcc2b('0x1d')](_0x2b14d9[_0xcc2b('0x34')]['limit']);_0x25962e[_0xcc2b('0x1c')]=qs[_0xcc2b('0x1c')](_0x2b14d9['query'][_0xcc2b('0x1c')]);}_0x25962e[_0xcc2b('0x38')]=qs[_0xcc2b('0x39')](_0x2b14d9[_0xcc2b('0x34')][_0xcc2b('0x39')]);_0x25962e['where']=qs[_0xcc2b('0x3a')](_['pick'](_0x2b14d9[_0xcc2b('0x34')],_0x5dec43[_0xcc2b('0x3a')]),_0x198a80);if(_0x2b14d9['query'][_0xcc2b('0x3b')]){_0x25962e[_0xcc2b('0x3c')]=_['merge'](_0x25962e['where'],{'$or':_['map'](_0x25962e[_0xcc2b('0x33')],function(_0x16d0d8){var _0x16222a={};_0x16222a[_0x16d0d8]={'$like':'%'+_0x2b14d9['query'][_0xcc2b('0x3b')]+'%'};return _0x16222a;})});}_0x25962e=_[_0xcc2b('0x3d')]({},_0x25962e,_0x2b14d9[_0xcc2b('0x3e')]);var _0x471a5e={'where':_0x25962e['where']};return db[_0xcc2b('0x3f')][_0xcc2b('0x1e')](_0x471a5e)[_0xcc2b('0x25')](function(_0xf9647f){_0x128f5a[_0xcc2b('0x1e')]=_0xf9647f;if(_0x2b14d9['query'][_0xcc2b('0x40')]){_0x25962e['include']=[{'all':!![]}];}return db['CmCompany'][_0xcc2b('0x41')](_0x25962e);})[_0xcc2b('0x25')](function(_0x1c8bc7){_0x128f5a[_0xcc2b('0x42')]=_0x1c8bc7;return _0x128f5a;})[_0xcc2b('0x25')](respondWithFilteredResult(_0x41381a,_0x25962e))[_0xcc2b('0x43')](handleError(_0x41381a,null));})[_0xcc2b('0x43')](handleError(_0x41381a,null));};exports[_0xcc2b('0x44')]=function(_0x452fb,_0x1cdbc6){var _0xfc15a2={'raw':![],'where':{'id':_0x452fb[_0xcc2b('0x45')]['id']}},_0x1bc373={};_0x1bc373[_0xcc2b('0x30')]=_[_0xcc2b('0x31')](db[_0xcc2b('0x3f')][_0xcc2b('0x46')]);_0x1bc373['query']=_[_0xcc2b('0x31')](_0x452fb['query']);_0x1bc373[_0xcc2b('0x3a')]=_['intersection'](_0x1bc373[_0xcc2b('0x30')],_0x1bc373['query']);_0xfc15a2['attributes']=_[_0xcc2b('0x32')](_0x1bc373[_0xcc2b('0x30')],qs[_0xcc2b('0x35')](_0x452fb['query']['fields']));_0xfc15a2[_0xcc2b('0x33')]=_0xfc15a2[_0xcc2b('0x33')][_0xcc2b('0x36')]?_0xfc15a2[_0xcc2b('0x33')]:_0x1bc373['model'];if(_0x452fb[_0xcc2b('0x34')][_0xcc2b('0x40')]){_0xfc15a2[_0xcc2b('0x47')]=[{'all':!![]}];}_0xfc15a2=_[_0xcc2b('0x3d')]({},_0xfc15a2,_0x452fb[_0xcc2b('0x3e')]);return db['CmCompany'][_0xcc2b('0x48')](_0xfc15a2)['then'](handleEntityNotFound(_0x1cdbc6,null))[_0xcc2b('0x25')](respondWithResult(_0x1cdbc6,null))[_0xcc2b('0x43')](handleError(_0x1cdbc6,null));};exports[_0xcc2b('0x49')]=function(_0x39b934,_0x53f480){return db[_0xcc2b('0x3f')][_0xcc2b('0x49')](_0x39b934[_0xcc2b('0x4a')],{})[_0xcc2b('0x25')](function(_0x38cac6){var _0x46d5ce=_0x39b934[_0xcc2b('0x4b')]['get']({'plain':!![]});if(!_0x46d5ce)throw new Error(_0xcc2b('0x4c'));if(_0x46d5ce['role']===_0xcc2b('0x4b')){var _0x2dd09a=_0x38cac6[_0xcc2b('0x26')]({'plain':!![]});var _0x4e4193=_0xcc2b('0x27');return db[_0xcc2b('0x4d')]['find']({'where':{'name':_0x4e4193,'userProfileId':_0x46d5ce[_0xcc2b('0x4e')]},'raw':!![]})[_0xcc2b('0x25')](function(_0x440d32){if(_0x440d32&&_0x440d32[_0xcc2b('0x4f')]===0x0){return db['UserProfileResource'][_0xcc2b('0x49')]({'name':_0x2dd09a[_0xcc2b('0x2c')],'resourceId':_0x2dd09a['id'],'type':_0x440d32[_0xcc2b('0x2c')],'sectionId':_0x440d32['id']},{})[_0xcc2b('0x25')](function(){return _0x38cac6;});}else{return _0x38cac6;}})[_0xcc2b('0x43')](function(_0x1fbfd7){logger[_0xcc2b('0x2a')](_0xcc2b('0x50'),_0x1fbfd7);throw _0x1fbfd7;});}return _0x38cac6;})[_0xcc2b('0x25')](respondWithResult(_0x53f480,0xc9))['catch'](handleError(_0x53f480,null));};exports[_0xcc2b('0x24')]=function(_0x35ef03,_0x1bb6ef){if(_0x35ef03[_0xcc2b('0x4a')]['id']){delete _0x35ef03[_0xcc2b('0x4a')]['id'];}return db[_0xcc2b('0x3f')]['find']({'where':{'id':_0x35ef03['params']['id']}})[_0xcc2b('0x25')](handleEntityNotFound(_0x1bb6ef,null))[_0xcc2b('0x25')](saveUpdates(_0x35ef03[_0xcc2b('0x4a')],null))[_0xcc2b('0x25')](respondWithResult(_0x1bb6ef,null))[_0xcc2b('0x43')](handleError(_0x1bb6ef,null));};exports['destroy']=function(_0x155ff3,_0x5463e2){return db['CmCompany'][_0xcc2b('0x48')]({'where':{'id':_0x155ff3[_0xcc2b('0x45')]['id']}})['then'](handleEntityNotFound(_0x5463e2,null))['then'](removeEntity(_0x5463e2,null))[_0xcc2b('0x43')](handleError(_0x5463e2,null));};exports[_0xcc2b('0x2f')]=function(_0x3565bc,_0xaa1892){return db[_0xcc2b('0x3f')][_0xcc2b('0x2f')]()[_0xcc2b('0x25')](respondWithResult(_0xaa1892,null))[_0xcc2b('0x43')](handleError(_0xaa1892,null));};exports[_0xcc2b('0x51')]=function(_0x54e4d0,_0x401f97,_0x55eae0){return db[_0xcc2b('0x52')][_0xcc2b('0x48')]({'where':{'id':_0x54e4d0[_0xcc2b('0x45')]['id']}})['then'](handleEntityNotFound(_0x401f97,null))[_0xcc2b('0x25')](function(_0x2b502b){if(_0x2b502b){return _0x2b502b[_0xcc2b('0x51')](_0x54e4d0[_0xcc2b('0x4a')][_0xcc2b('0x53')],_[_0xcc2b('0x54')](_0x54e4d0['body'],[_0xcc2b('0x53'),'id'])||{});}})['then'](respondWithResult(_0x401f97,null))[_0xcc2b('0x43')](handleError(_0x401f97,null));};exports[_0xcc2b('0x55')]=function(_0xb1ecc5,_0x3faa84,_0x3bce32){var _0x42c5d5={};var _0x3d236c={};var _0x5e5a1f;var _0x314345;return db[_0xcc2b('0x3f')][_0xcc2b('0x56')]({'where':{'id':_0xb1ecc5[_0xcc2b('0x45')]['id']}})[_0xcc2b('0x25')](handleEntityNotFound(_0x3faa84,null))[_0xcc2b('0x25')](function(_0x3a71dc){if(_0x3a71dc){_0x5e5a1f=_0x3a71dc;_0x3d236c['model']=_[_0xcc2b('0x31')](db[_0xcc2b('0x52')][_0xcc2b('0x46')]);_0x3d236c[_0xcc2b('0x34')]=_[_0xcc2b('0x31')](_0xb1ecc5[_0xcc2b('0x34')]);_0x3d236c[_0xcc2b('0x3a')]=_['intersection'](_0x3d236c[_0xcc2b('0x30')],_0x3d236c[_0xcc2b('0x34')]);_0x42c5d5[_0xcc2b('0x33')]=_[_0xcc2b('0x32')](_0x3d236c['model'],qs[_0xcc2b('0x35')](_0xb1ecc5[_0xcc2b('0x34')][_0xcc2b('0x35')]));_0x42c5d5[_0xcc2b('0x33')]=_0x42c5d5[_0xcc2b('0x33')][_0xcc2b('0x36')]?_0x42c5d5['attributes']:_0x3d236c[_0xcc2b('0x30')];_0x42c5d5[_0xcc2b('0x38')]=qs[_0xcc2b('0x39')](_0xb1ecc5['query'][_0xcc2b('0x39')]);_0x42c5d5['where']=qs[_0xcc2b('0x3a')](_['pick'](_0xb1ecc5[_0xcc2b('0x34')],_0x3d236c['filters']));if(_0xb1ecc5[_0xcc2b('0x34')][_0xcc2b('0x3b')]){_0x42c5d5['where']=_[_0xcc2b('0x3d')](_0x42c5d5[_0xcc2b('0x3c')],{'$or':_[_0xcc2b('0x57')](_0x42c5d5[_0xcc2b('0x33')],function(_0x366df1){var _0x106489={};_0x106489[_0x366df1]={'$like':'%'+_0xb1ecc5[_0xcc2b('0x34')]['filter']+'%'};return _0x106489;})});}_0x42c5d5=_[_0xcc2b('0x3d')]({},_0x42c5d5,_0xb1ecc5[_0xcc2b('0x3e')]);return _0x5e5a1f[_0xcc2b('0x55')](_0x42c5d5);}})['then'](function(_0x2d6ac3){if(_0x2d6ac3){_0x314345=_0x2d6ac3[_0xcc2b('0x36')];if(!_0xb1ecc5[_0xcc2b('0x34')][_0xcc2b('0x37')](_0xcc2b('0x58'))){_0x42c5d5[_0xcc2b('0x1d')]=qs['limit'](_0xb1ecc5[_0xcc2b('0x34')][_0xcc2b('0x1d')]);_0x42c5d5[_0xcc2b('0x1c')]=qs[_0xcc2b('0x1c')](_0xb1ecc5['query'][_0xcc2b('0x1c')]);}return _0x5e5a1f[_0xcc2b('0x55')](_0x42c5d5);}})['then'](function(_0x21b0b8){if(_0x21b0b8){return _0x21b0b8?{'count':_0x314345,'rows':_0x21b0b8}:null;}})[_0xcc2b('0x25')](respondWithResult(_0x3faa84,null))[_0xcc2b('0x43')](handleError(_0x3faa84,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 4416669..852e4b6 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 _0xe945=['CmCompany','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','define'];(function(_0x25228c,_0x4c028c){var _0x5416a1=function(_0x4f0478){while(--_0x4f0478){_0x25228c['push'](_0x25228c['shift']());}};_0x5416a1(++_0x4c028c);}(_0xe945,0x139));var _0x5e94=function(_0x259ca4,_0x1b4dcc){_0x259ca4=_0x259ca4-0x0;var _0x1516bc=_0xe945[_0x259ca4];return _0x1516bc;};'use strict';var _=require(_0x5e94('0x0'));var util=require(_0x5e94('0x1'));var logger=require(_0x5e94('0x2'))(_0x5e94('0x3'));var moment=require('moment');var BPromise=require(_0x5e94('0x4'));var rp=require(_0x5e94('0x5'));var fs=require('fs');var path=require(_0x5e94('0x6'));var rimraf=require(_0x5e94('0x7'));var config=require(_0x5e94('0x8'));var attributes=require(_0x5e94('0x9'));module['exports']=function(_0x4d6da4,_0x4d0bd8){return _0x4d6da4[_0x5e94('0xa')](_0x5e94('0xb'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d1c=['exports','define','CmCompany','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x6d1c,0xd3));var _0xc6d1=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x6d1c[_0x4b7895];return _0x264180;};'use strict';var _=require('lodash');var util=require(_0xc6d1('0x0'));var logger=require(_0xc6d1('0x1'))(_0xc6d1('0x2'));var moment=require(_0xc6d1('0x3'));var BPromise=require(_0xc6d1('0x4'));var rp=require(_0xc6d1('0x5'));var fs=require('fs');var path=require(_0xc6d1('0x6'));var rimraf=require(_0xc6d1('0x7'));var config=require(_0xc6d1('0x8'));var attributes=require(_0xc6d1('0x9'));module[_0xc6d1('0xa')]=function(_0x3743ce,_0x1e0578){return _0x3743ce[_0xc6d1('0xb')](_0xc6d1('0xc'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index cd3351f..8a802ab 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 _0xc910=['error','message','CmCompany,\x20%s,\x20%s','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','stringify','code'];(function(_0x4e9c0a,_0x16a894){var _0x3448dd=function(_0x13eef7){while(--_0x13eef7){_0x4e9c0a['push'](_0x4e9c0a['shift']());}};_0x3448dd(++_0x16a894);}(_0xc910,0x7c));var _0x0c91=function(_0x56c53f,_0x4bd865){_0x56c53f=_0x56c53f-0x0;var _0x52b7b7=_0xc910[_0x56c53f];return _0x52b7b7;};'use strict';var _=require(_0x0c91('0x0'));var util=require('util');var moment=require(_0x0c91('0x1'));var BPromise=require(_0x0c91('0x2'));var rs=require(_0x0c91('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c91('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0c91('0x5'))(_0x0c91('0x6'));var config=require(_0x0c91('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0c91('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f0d9f,_0x18b494,_0x1940cc){return new BPromise(function(_0x1350f9,_0x9fa0bf){return client[_0x0c91('0x9')](_0x5f0d9f,_0x1940cc)[_0x0c91('0xa')](function(_0x299dad){logger[_0x0c91('0xb')]('CmCompany,\x20%s,\x20%s',_0x18b494,_0x0c91('0xc'));logger[_0x0c91('0xd')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x18b494,_0x0c91('0xc'),JSON[_0x0c91('0xe')](_0x299dad));if(_0x299dad['error']){if(_0x299dad['error'][_0x0c91('0xf')]===0x1f4){logger[_0x0c91('0x10')]('CmCompany,\x20%s,\x20%s',_0x18b494,_0x299dad[_0x0c91('0x10')][_0x0c91('0x11')]);return _0x9fa0bf(_0x299dad['error'][_0x0c91('0x11')]);}logger[_0x0c91('0x10')](_0x0c91('0x12'),_0x18b494,_0x299dad[_0x0c91('0x10')][_0x0c91('0x11')]);return _0x1350f9(_0x299dad[_0x0c91('0x10')]['message']);}else{logger[_0x0c91('0xb')](_0x0c91('0x12'),_0x18b494,_0x0c91('0xc'));_0x1350f9(_0x299dad['result']['message']);}})[_0x0c91('0x13')](function(_0x1967c7){logger['error'](_0x0c91('0x12'),_0x18b494,_0x1967c7);_0x9fa0bf(_0x1967c7);});});} \ No newline at end of file +var _0x9088=['http','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','result','bluebird','../../mysqldb','rpc','jayson/promise'];(function(_0x198099,_0x2b8ab1){var _0x111ae7=function(_0x49611f){while(--_0x49611f){_0x198099['push'](_0x198099['shift']());}};_0x111ae7(++_0x2b8ab1);}(_0x9088,0xdd));var _0x8908=function(_0x5d737d,_0x421884){_0x5d737d=_0x5d737d-0x0;var _0x29c646=_0x9088[_0x5d737d];return _0x29c646;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8908('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8908('0x1'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8908('0x2'));var config=require('../../config/environment');var jayson=require(_0x8908('0x3'));var client=jayson['client'][_0x8908('0x4')]({'port':0x232a});function respondWithRpcPromise(_0xf22cbc,_0x59ea19,_0x5abaf6){return new BPromise(function(_0x557384,_0x4f0197){return client['request'](_0xf22cbc,_0x5abaf6)[_0x8908('0x5')](function(_0xdaaf64){logger[_0x8908('0x6')](_0x8908('0x7'),_0x59ea19,_0x8908('0x8'));logger[_0x8908('0x9')](_0x8908('0xa'),_0x59ea19,_0x8908('0x8'),JSON['stringify'](_0xdaaf64));if(_0xdaaf64[_0x8908('0xb')]){if(_0xdaaf64[_0x8908('0xb')][_0x8908('0xc')]===0x1f4){logger[_0x8908('0xb')]('CmCompany,\x20%s,\x20%s',_0x59ea19,_0xdaaf64[_0x8908('0xb')][_0x8908('0xd')]);return _0x4f0197(_0xdaaf64[_0x8908('0xb')][_0x8908('0xd')]);}logger['error'](_0x8908('0x7'),_0x59ea19,_0xdaaf64[_0x8908('0xb')]['message']);return _0x557384(_0xdaaf64['error']['message']);}else{logger['info'](_0x8908('0x7'),_0x59ea19,_0x8908('0x8'));_0x557384(_0xdaaf64[_0x8908('0xe')][_0x8908('0xd')]);}})['catch'](function(_0x5cfe3e){logger[_0x8908('0xb')](_0x8908('0x7'),_0x59ea19,_0x5cfe3e);_0x4f0197(_0x5cfe3e);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index e070e33..f8d82ac 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 _0x5120=['get','index','/describe','isAuthenticated','describe','show','/:id/contacts','post','create','addContacts','put','/:id','update','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller'];(function(_0x2e024c,_0x3fe31b){var _0x3192b7=function(_0x5be52e){while(--_0x5be52e){_0x2e024c['push'](_0x2e024c['shift']());}};_0x3192b7(++_0x3fe31b);}(_0x5120,0xe7));var _0x0512=function(_0x185a5a,_0x19442b){_0x185a5a=_0x185a5a-0x0;var _0x39bd2d=_0x5120[_0x185a5a];return _0x39bd2d;};'use strict';var multer=require('multer');var util=require(_0x0512('0x0'));var path=require(_0x0512('0x1'));var timeout=require('connect-timeout');var express=require(_0x0512('0x2'));var router=express[_0x0512('0x3')]();var fs_extra=require(_0x0512('0x4'));var auth=require(_0x0512('0x5'));var interaction=require(_0x0512('0x6'));var config=require(_0x0512('0x7'));var controller=require(_0x0512('0x8'));router[_0x0512('0x9')]('/',auth['isAuthenticated'](),controller[_0x0512('0xa')]);router[_0x0512('0x9')](_0x0512('0xb'),auth[_0x0512('0xc')](),controller[_0x0512('0xd')]);router[_0x0512('0x9')]('/:id',auth[_0x0512('0xc')](),controller[_0x0512('0xe')]);router[_0x0512('0x9')](_0x0512('0xf'),auth[_0x0512('0xc')](),controller['getContacts']);router[_0x0512('0x10')]('/',auth[_0x0512('0xc')](),controller[_0x0512('0x11')]);router[_0x0512('0x10')](_0x0512('0xf'),auth[_0x0512('0xc')](),controller[_0x0512('0x12')]);router[_0x0512('0x13')](_0x0512('0x14'),auth[_0x0512('0xc')](),controller[_0x0512('0x15')]);router[_0x0512('0x16')](_0x0512('0x14'),auth[_0x0512('0xc')](),controller[_0x0512('0x17')]);module['exports']=router; \ No newline at end of file +var _0xa359=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','describe','/:id','show','post','create','/:id/contacts','put','delete','destroy'];(function(_0x40b046,_0x27857f){var _0x1558d4=function(_0xbfd78f){while(--_0xbfd78f){_0x40b046['push'](_0x40b046['shift']());}};_0x1558d4(++_0x27857f);}(_0xa359,0x12c));var _0x9a35=function(_0x17aec5,_0x32c026){_0x17aec5=_0x17aec5-0x0;var _0x51b26d=_0xa359[_0x17aec5];return _0x51b26d;};'use strict';var multer=require(_0x9a35('0x0'));var util=require(_0x9a35('0x1'));var path=require('path');var timeout=require(_0x9a35('0x2'));var express=require(_0x9a35('0x3'));var router=express[_0x9a35('0x4')]();var fs_extra=require(_0x9a35('0x5'));var auth=require(_0x9a35('0x6'));var interaction=require(_0x9a35('0x7'));var config=require(_0x9a35('0x8'));var controller=require(_0x9a35('0x9'));router[_0x9a35('0xa')]('/',auth[_0x9a35('0xb')](),controller[_0x9a35('0xc')]);router[_0x9a35('0xa')]('/describe',auth[_0x9a35('0xb')](),controller[_0x9a35('0xd')]);router[_0x9a35('0xa')](_0x9a35('0xe'),auth[_0x9a35('0xb')](),controller[_0x9a35('0xf')]);router[_0x9a35('0xa')]('/:id/contacts',auth[_0x9a35('0xb')](),controller['getContacts']);router[_0x9a35('0x10')]('/',auth[_0x9a35('0xb')](),controller[_0x9a35('0x11')]);router[_0x9a35('0x10')](_0x9a35('0x12'),auth['isAuthenticated'](),controller['addContacts']);router[_0x9a35('0x13')](_0x9a35('0xe'),auth[_0x9a35('0xb')](),controller['update']);router[_0x9a35('0x14')](_0x9a35('0xe'),auth[_0x9a35('0xb')](),controller[_0x9a35('0x15')]);module[_0x9a35('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 1efcb1a..7810142 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 _0xabb6=['TEXT','INTEGER','UNSIGNED','DATE','sequelize','exports','STRING'];(function(_0x17a9c7,_0x4f33f3){var _0x32831e=function(_0x33132c){while(--_0x33132c){_0x17a9c7['push'](_0x17a9c7['shift']());}};_0x32831e(++_0x4f33f3);}(_0xabb6,0x18c));var _0x6abb=function(_0x339287,_0x2f3015){_0x339287=_0x339287-0x0;var _0x4e0df0=_0xabb6[_0x339287];return _0x4e0df0;};'use strict';var _=require('lodash');var Sequelize=require(_0x6abb('0x0'));module[_0x6abb('0x1')]={'firstName':{'type':Sequelize[_0x6abb('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x6abb('0x2')]},'street':{'type':Sequelize[_0x6abb('0x2')]},'postalCode':{'type':Sequelize[_0x6abb('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x6abb('0x2')]},'dateOfBirth':{'type':Sequelize[_0x6abb('0x2')]},'description':{'type':Sequelize[_0x6abb('0x3')]},'phone':{'type':Sequelize[_0x6abb('0x2')]},'mobile':{'type':Sequelize[_0x6abb('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x6abb('0x2')]},'url':{'type':Sequelize[_0x6abb('0x2')]},'facebook':{'type':Sequelize[_0x6abb('0x2')]},'fb_data':{'type':Sequelize[_0x6abb('0x2')]},'twitter':{'type':Sequelize[_0x6abb('0x2')]},'skype':{'type':Sequelize[_0x6abb('0x2')]},'teams':{'type':Sequelize[_0x6abb('0x2')]},'viber':{'type':Sequelize[_0x6abb('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x6abb('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x6abb('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x6abb('0x2')]},'priority':{'type':Sequelize[_0x6abb('0x4')](0x2)[_0x6abb('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x6abb('0x6')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0x6abb('0x2')]},'utcOffset':{'type':Sequelize[_0x6abb('0x4')]}}; \ No newline at end of file +var _0x6f13=['STRING','TEXT','INTEGER','DATE','NOW','sequelize','exports'];(function(_0x432616,_0x5211f1){var _0xbb21ef=function(_0x2106af){while(--_0x2106af){_0x432616['push'](_0x432616['shift']());}};_0xbb21ef(++_0x5211f1);}(_0x6f13,0xe5));var _0x36f1=function(_0x5c6670,_0x46f467){_0x5c6670=_0x5c6670-0x0;var _0x21e11a=_0x6f13[_0x5c6670];return _0x21e11a;};'use strict';var _=require('lodash');var Sequelize=require(_0x36f1('0x0'));module[_0x36f1('0x1')]={'firstName':{'type':Sequelize[_0x36f1('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x36f1('0x2')]},'street':{'type':Sequelize[_0x36f1('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x36f1('0x2')]},'dateOfBirth':{'type':Sequelize[_0x36f1('0x2')]},'description':{'type':Sequelize[_0x36f1('0x3')]},'phone':{'type':Sequelize[_0x36f1('0x2')]},'mobile':{'type':Sequelize[_0x36f1('0x2')]},'fax':{'type':Sequelize[_0x36f1('0x2')]},'email':{'type':Sequelize[_0x36f1('0x2')]},'url':{'type':Sequelize[_0x36f1('0x2')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x36f1('0x2')]},'skype':{'type':Sequelize[_0x36f1('0x2')]},'teams':{'type':Sequelize[_0x36f1('0x2')]},'viber':{'type':Sequelize[_0x36f1('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x36f1('0x2')]},'telegram':{'type':Sequelize[_0x36f1('0x2')]},'UserId':{'type':Sequelize[_0x36f1('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x36f1('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x36f1('0x5')],'defaultValue':Sequelize[_0x36f1('0x6')]},'dialTimezone':{'type':Sequelize[_0x36f1('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 629954b..f40ba88 100644 --- a/server/api/cmContact/cmContact.controller.js +++ b/server/api/cmContact/cmContact.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file +var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 631cf8f..7bf00cd 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 _0x9491=['events','../../mysqldb','CmContact','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5e33b7,_0x1ad038){var _0x3d245c=function(_0x55e40c){while(--_0x55e40c){_0x5e33b7['push'](_0x5e33b7['shift']());}};_0x3d245c(++_0x1ad038);}(_0x9491,0x14a));var _0x1949=function(_0x39fe66,_0x13734c){_0x39fe66=_0x39fe66-0x0;var _0x36bda3=_0x9491[_0x39fe66];return _0x36bda3;};'use strict';var EventEmitter=require(_0x1949('0x0'));var CmContact=require(_0x1949('0x1'))['db'][_0x1949('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x1949('0x3')](0x0);var events={'afterCreate':_0x1949('0x4'),'afterUpdate':_0x1949('0x5'),'afterDestroy':_0x1949('0x6')};function emitEvent(_0x5ced81){return function(_0x19452d,_0xbedfe8,_0x57a1dc){CmContactEvents[_0x1949('0x7')](_0x5ced81+':'+_0x19452d['id'],_0x19452d);CmContactEvents[_0x1949('0x7')](_0x5ced81,_0x19452d);_0x57a1dc(null);};}for(var e in events){if(events[_0x1949('0x8')](e)){var event=events[e];CmContact[_0x1949('0x9')](e,emitEvent(event));}}module[_0x1949('0xa')]=CmContactEvents; \ No newline at end of file +var _0xe2fc=['update','emit','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0x39035b,_0x381fb4){var _0x356b7a=function(_0x322478){while(--_0x322478){_0x39035b['push'](_0x39035b['shift']());}};_0x356b7a(++_0x381fb4);}(_0xe2fc,0x1bc));var _0xce2f=function(_0x39cd68,_0x6c4b05){_0x39cd68=_0x39cd68-0x0;var _0x268612=_0xe2fc[_0x39cd68];return _0x268612;};'use strict';var EventEmitter=require(_0xce2f('0x0'));var CmContact=require(_0xce2f('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0xce2f('0x2')](0x0);var events={'afterCreate':_0xce2f('0x3'),'afterUpdate':_0xce2f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3e8b02){return function(_0x5c24c5,_0x524663,_0x39510f){CmContactEvents['emit'](_0x3e8b02+':'+_0x5c24c5['id'],_0x5c24c5);CmContactEvents[_0xce2f('0x5')](_0x3e8b02,_0x5c24c5);_0x39510f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0xce2f('0x6')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 74cd9e4..3e577f5 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 _0x36ff=['catch','error','afterCreate','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','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','always','onlyIfOpen','BlackLists','length','cmContact,\x20%s,\x20%s','message','Lists','CmHopperBlack','List\x20not\x20found','isEmpty','destroy','VoiceQueueId','push','info','[CmContact][afterDestroy][Succesfull]','inspect','util','../../config/logger','bluebird','rimraf','../../config/environment','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','lastName','fax','email','utf8mb4','utf8mb4_unicode_ci','models','get','cmContact','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','then','timezones','utcOffset','add','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'];(function(_0x429948,_0x1a6851){var _0x35d5d1=function(_0x574853){while(--_0x574853){_0x429948['push'](_0x429948['shift']());}};_0x35d5d1(++_0x1a6851);}(_0x36ff,0x1c6));var _0xf36f=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x36ff[_0x2763f2];return _0x3ef471;};'use strict';var _=require('lodash');var util=require(_0xf36f('0x0'));var logger=require(_0xf36f('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf36f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf36f('0x3'));var config=require(_0xf36f('0x4'));var shared=require('../../config/environment/shared');var attributes=require(_0xf36f('0x5'));module[_0xf36f('0x6')]=function(_0xb5262,_0x4da29a){return _0xb5262[_0xf36f('0x7')](_0xf36f('0x8'),attributes,{'tableName':_0xf36f('0x9'),'paranoid':!![],'indexes':[{'name':_0xf36f('0xa'),'fields':['phone']},{'name':_0xf36f('0xb'),'fields':['firstName',_0xf36f('0xc'),_0xf36f('0xa'),'mobile',_0xf36f('0xd'),_0xf36f('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0xf36f('0xf'),'collate':_0xf36f('0x10'),'hooks':{'afterCreate':function(_0x57f185,_0x202b58,_0x546c88){var _0xe55f27=_0xb5262[_0xf36f('0x11')];var _0x4a7ee9=_0x57f185[_0xf36f('0x12')]({'plain':!![]});function _0x289b92(){return function(_0x2e0d55){logger['error'](_0xf36f('0x13'),'afterCreate',util['inspect'](_0x2e0d55,{'showHidden':![],'depth':null}));};}function _0xe252b8(_0x302a11,_0x32e30d){var _0x2e0c90=_0x32e30d[_0xf36f('0x14')]?_0x32e30d[_0xf36f('0x14')]:moment()[_0xf36f('0x15')](_0xf36f('0x16'));return new BPromise(function(_0x3a70e6,_0x1da9e8){if(_[_0xf36f('0x17')](_0x32e30d[_0xf36f('0x18')])){_0x3a70e6({'ret':_0x2e0c90});}else{_0xe55f27[_0xf36f('0x19')][_0xf36f('0x1a')]({'where':{'id':_0x302a11['id']}})[_0xf36f('0x1b')](function(_0x4f9bd2){if(!_['isNil'](_0x4f9bd2)){var _0x5e3acd=_0x4f9bd2[_0xf36f('0x18')];if(!_[_0xf36f('0x17')](_0x5e3acd)){var _0x138860=shared[_0xf36f('0x1c')];var _0xf2d753=_0x138860[_0x5e3acd];var _0x327064=_0x138860[_0x32e30d[_0xf36f('0x18')]];if(!_[_0xf36f('0x17')](_0xf2d753)&&!_[_0xf36f('0x17')](_0x327064)){var _0x4311c7=_0xf2d753[_0xf36f('0x1d')]-_0x327064[_0xf36f('0x1d')];_0x2e0c90=_0x32e30d['scheduledat']?_0x32e30d[_0xf36f('0x14')]:moment();var _0x4a2ad2=moment(_0x2e0c90)[_0xf36f('0x1e')](_0x4311c7,'minutes');_0x3a70e6({'ret':_0x4a2ad2[_0xf36f('0x15')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x3a70e6({'ret':_0x2e0c90});}else _0x3a70e6({'ret':_0x2e0c90});}else{_0x3a70e6({'ret':_0x2e0c90});}});}});return 0xa;}var _0x520e32=function(_0x588cbb){return new BPromise(function(_0x3dd356,_0x4a27a3){_0xe252b8(_0x588cbb,_0x4a7ee9)[_0xf36f('0x1b')](function(_0x18b277){_0x4a7ee9[_0xf36f('0x14')]=_0x18b277[_0xf36f('0x1f')];_0xe55f27[_0xf36f('0x20')][_0xf36f('0x1a')]({'where':{'phone':_0x4a7ee9['phone'],'VoiceQueueId':_0x588cbb['id']}})[_0xf36f('0x1b')](function(_0x2baeb7){if(!_[_0xf36f('0x17')](_0x2baeb7)){throw new Error(_0xf36f('0x21')+_0x4a7ee9[_0xf36f('0xa')]+_0xf36f('0x22')+_0x588cbb['id']);}return _0xe55f27[_0xf36f('0x20')][_0xf36f('0x23')]({'phone':_0x4a7ee9[_0xf36f('0xa')],'ContactId':_0x4a7ee9['id'],'ListId':_0x4a7ee9[_0xf36f('0x24')],'priority':_0x4a7ee9[_0xf36f('0x25')]?_0x4a7ee9[_0xf36f('0x25')]:0x2,'scheduledat':_0x4a7ee9[_0xf36f('0x14')]?_0x4a7ee9[_0xf36f('0x14')]:moment()[_0xf36f('0x15')](_0xf36f('0x16')),'callback':_0x4a7ee9[_0xf36f('0x26')]?!![]:![],'callbackuniqueid':_0x4a7ee9[_0xf36f('0x26')]?_0x4a7ee9['callbackUniqueid']:undefined,'callbackat':_0x4a7ee9[_0xf36f('0x26')]?moment()[_0xf36f('0x15')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x588cbb['id']});})['catch'](function(_0x34044e){_0x4a27a3(_0x34044e);});});});};var _0x4b1d5c=function(_0x444b62){return new BPromise(function(_0x8e4cf6,_0x27dbfa){_0xe252b8(_0x444b62,_0x4a7ee9)[_0xf36f('0x1b')](function(_0x18ab3a){_0x4a7ee9[_0xf36f('0x14')]=_0x18ab3a[_0xf36f('0x1f')];_0xe55f27['CmHopper'][_0xf36f('0x1a')]({'where':{'phone':_0x4a7ee9[_0xf36f('0xa')],'VoiceQueueId':_0x444b62['id']}})['then'](function(_0x2a7de5){if(!_[_0xf36f('0x17')](_0x2a7de5)){throw new Error('cmContact,\x20afterCreate\x20'+_0x4a7ee9[_0xf36f('0xa')]+_0xf36f('0x27')+_0x444b62['id']);}return _0xe55f27[_0xf36f('0x28')]['findOne']({'where':{'calleridnum':_0x4a7ee9[_0xf36f('0xa')],'VoiceQueueId':_0x444b62['id']}});})['then'](function(_0x2cf951){if(!_[_0xf36f('0x17')](_0x2cf951)){throw new Error(_0xf36f('0x29')+_0x4a7ee9[_0xf36f('0xa')]+_0xf36f('0x2a')+_0x444b62['id']);}return _0xe55f27[_0xf36f('0x20')][_0xf36f('0x23')]({'phone':_0x4a7ee9[_0xf36f('0xa')],'ContactId':_0x4a7ee9['id'],'ListId':_0x4a7ee9[_0xf36f('0x24')],'priority':_0x4a7ee9['priority']?_0x4a7ee9[_0xf36f('0x25')]:0x2,'scheduledat':_0x4a7ee9['scheduledat']?_0x4a7ee9['scheduledat']:moment()[_0xf36f('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x4a7ee9[_0xf36f('0x26')]?!![]:![],'callbackuniqueid':_0x4a7ee9[_0xf36f('0x26')]?_0x4a7ee9['callbackUniqueid']:undefined,'callbackat':_0x4a7ee9[_0xf36f('0x26')]?moment()[_0xf36f('0x15')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x444b62['id']});})[_0xf36f('0x2b')](function(_0x5ede3d){_0x27dbfa(_0x5ede3d);});});});};function _0x2cd31d(){return function(_0x16f443){logger[_0xf36f('0x2c')]('cmContact',_0xf36f('0x2d'),util['inspect'](_0x16f443,{'showHidden':![],'depth':null}));};}function _0x1dd0f4(_0x175cc4,_0x548f39){var _0x5d1cd9=_0x548f39[_0xf36f('0x14')]?_0x548f39[_0xf36f('0x14')]:moment()[_0xf36f('0x15')](_0xf36f('0x16'));return new BPromise(function(_0x2649f9,_0x4bc372){if(_[_0xf36f('0x17')](_0x548f39[_0xf36f('0x18')])){_0x2649f9({'ret':_0x5d1cd9});}else{_0xe55f27[_0xf36f('0x2e')][_0xf36f('0x1a')]({'where':{'id':_0x175cc4['id']}})['then'](function(_0x206d12){if(!_[_0xf36f('0x17')](_0x206d12)){var _0x4db58c=_0x206d12[_0xf36f('0x18')];if(!_['isNil'](_0x4db58c)){var _0x4833ce=shared['timezones'];var _0x499648=_0x4833ce[_0x4db58c];var _0x125a4c=_0x4833ce[_0x548f39[_0xf36f('0x18')]];if(!_[_0xf36f('0x17')](_0x499648)&&!_[_0xf36f('0x17')](_0x125a4c)){var _0x2666d0=_0x499648[_0xf36f('0x1d')]-_0x125a4c[_0xf36f('0x1d')];_0x5d1cd9=_0x548f39[_0xf36f('0x14')]?_0x548f39['scheduledat']:moment();var _0x49a0d4=moment(_0x5d1cd9)[_0xf36f('0x1e')](_0x2666d0,_0xf36f('0x2f'));_0x2649f9({'ret':_0x49a0d4[_0xf36f('0x15')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x2649f9({'ret':_0x5d1cd9});}else _0x2649f9({'ret':_0x5d1cd9});}else{_0x2649f9({'ret':_0x5d1cd9});}});}});return 0xa;}var _0x2cb568=function(_0x4965b2){return new BPromise(function(_0x5dcd63,_0x57539a){_0x1dd0f4(_0x4965b2,_0x4a7ee9)[_0xf36f('0x1b')](function(_0x24b4ab){_0x4a7ee9[_0xf36f('0x14')]=_0x24b4ab[_0xf36f('0x1f')];_0xe55f27[_0xf36f('0x20')]['findOne']({'where':{'phone':_0x4a7ee9[_0xf36f('0xa')],'CampaignId':_0x4965b2['id']}})[_0xf36f('0x1b')](function(_0x26c56e){if(!_[_0xf36f('0x17')](_0x26c56e)){throw new Error(_0xf36f('0x21')+_0x4a7ee9[_0xf36f('0xa')]+_0xf36f('0x30')+_0x4965b2['id']);}return _0xe55f27[_0xf36f('0x20')][_0xf36f('0x23')]({'phone':_0x4a7ee9['phone'],'ContactId':_0x4a7ee9['id'],'ListId':_0x4a7ee9['ListId'],'priority':_0x4a7ee9[_0xf36f('0x25')]?_0x4a7ee9['priority']:0x2,'scheduledat':_0x4a7ee9[_0xf36f('0x14')]?_0x4a7ee9[_0xf36f('0x14')]:moment()[_0xf36f('0x15')](_0xf36f('0x16')),'callback':_0x4a7ee9[_0xf36f('0x26')]?!![]:![],'callbackuniqueid':_0x4a7ee9[_0xf36f('0x26')]?_0x4a7ee9['callbackUniqueid']:undefined,'callbackat':_0x4a7ee9[_0xf36f('0x26')]?moment()[_0xf36f('0x15')](_0xf36f('0x16')):undefined,'CampaignId':_0x4965b2['id']});})[_0xf36f('0x2b')](function(_0x16c291){_0x57539a(_0x16c291);});});});};var _0x1362fa=function(_0x54c245){return new BPromise(function(_0x338ea5,_0x2b75b2){_0x1dd0f4(_0x54c245,_0x4a7ee9)[_0xf36f('0x1b')](function(_0x3119d7){_0x4a7ee9[_0xf36f('0x14')]=_0x3119d7[_0xf36f('0x1f')];_0xe55f27[_0xf36f('0x20')][_0xf36f('0x1a')]({'where':{'phone':_0x4a7ee9[_0xf36f('0xa')],'CampaignId':_0x54c245['id']}})[_0xf36f('0x1b')](function(_0x444d44){if(!_[_0xf36f('0x17')](_0x444d44)){throw new Error(_0xf36f('0x21')+_0x4a7ee9[_0xf36f('0xa')]+_0xf36f('0x31')+_0x54c245['id']);}return _0xe55f27[_0xf36f('0x28')][_0xf36f('0x1a')]({'where':{'calleridnum':_0x4a7ee9[_0xf36f('0xa')],'CampaignId':_0x54c245['id']}});})[_0xf36f('0x1b')](function(_0x51c69b){if(!_[_0xf36f('0x17')](_0x51c69b)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x4a7ee9[_0xf36f('0xa')]+_0xf36f('0x32')+_0x54c245['id']);}return _0xe55f27[_0xf36f('0x20')][_0xf36f('0x23')]({'phone':_0x4a7ee9['phone'],'ContactId':_0x4a7ee9['id'],'ListId':_0x4a7ee9['ListId'],'priority':_0x4a7ee9[_0xf36f('0x25')]?_0x4a7ee9[_0xf36f('0x25')]:0x2,'scheduledat':_0x4a7ee9['scheduledat']?_0x4a7ee9['scheduledat']:moment()[_0xf36f('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x4a7ee9[_0xf36f('0x26')]?!![]:![],'callbackuniqueid':_0x4a7ee9[_0xf36f('0x26')]?_0x4a7ee9['callbackUniqueid']:undefined,'callbackat':_0x4a7ee9[_0xf36f('0x26')]?moment()[_0xf36f('0x15')](_0xf36f('0x16')):undefined,'CampaignId':_0x54c245['id']});})[_0xf36f('0x2b')](function(_0x2c503e){_0x2b75b2(_0x2c503e);});});});};if(_0x4a7ee9['ListId']){_0xe55f27[_0xf36f('0x19')][_0xf36f('0x33')]({'where':{'type':_0xf36f('0x34')},'attributes':['id',_0xf36f('0x35'),'dialTimezone'],'include':[{'model':_0xe55f27[_0xf36f('0x36')],'as':'Lists','where':{'id':_0x4a7ee9['ListId']}}]})[_0xf36f('0x1b')](function(_0x1f6835){if(_0x1f6835){var _0x5a0254=[];for(var _0x17e1b7=0x0,_0x1a102e;_0x17e1b7<_0x1f6835['length'];_0x17e1b7+=0x1){_0x1a102e=_0x1f6835[_0x17e1b7][_0xf36f('0x12')]({'plain':!![]});switch(_0x1a102e[_0xf36f('0x35')]){case _0xf36f('0x37'):_0x4b1d5c(_0x1a102e)[_0xf36f('0x2b')](_0x289b92());break;case _0xf36f('0x38'):_0x520e32(_0x1a102e)[_0xf36f('0x2b')](_0x289b92());break;default:_0x1dd0f4(_0x1a102e,_0x4a7ee9)['then'](function(_0x56519b){_0x4a7ee9['scheduledat']=_0x56519b[_0xf36f('0x1f')];_0xe55f27[_0xf36f('0x20')][_0xf36f('0x23')]({'phone':_0x4a7ee9[_0xf36f('0xa')],'ContactId':_0x4a7ee9['id'],'ListId':_0x4a7ee9[_0xf36f('0x24')],'scheduledat':_0x4a7ee9[_0xf36f('0x14')]?_0x4a7ee9['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x4a7ee9[_0xf36f('0x25')]?_0x4a7ee9[_0xf36f('0x25')]:0x2,'callback':_0x4a7ee9['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4a7ee9[_0xf36f('0x26')]?_0x4a7ee9[_0xf36f('0x26')]:undefined,'callbackat':_0x4a7ee9['callbackUniqueid']?moment()[_0xf36f('0x15')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x1a102e['id']})['catch'](_0x289b92());});}}}})[_0xf36f('0x1b')](function(){return _0xe55f27[_0xf36f('0x19')][_0xf36f('0x33')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0xe55f27[_0xf36f('0x36')],'as':_0xf36f('0x39'),'where':{'id':_0x4a7ee9['ListId']}}]})[_0xf36f('0x1b')](function(_0x355118){if(_0x355118){var _0x3cbd68=[];for(var _0xf84ae=0x0,_0x9d50a5;_0xf84ae<_0x355118[_0xf36f('0x3a')];_0xf84ae+=0x1){_0x9d50a5=_0x355118[_0xf84ae][_0xf36f('0x12')]({'plain':!![]});_0xe55f27['CmHopperBlack'][_0xf36f('0x23')]({'phone':_0x4a7ee9[_0xf36f('0xa')],'ContactId':_0x4a7ee9['id'],'ListId':_0x4a7ee9[_0xf36f('0x24')],'VoiceQueueId':_0x9d50a5['id']})['catch'](function(_0x586895){logger[_0xf36f('0x2c')](_0xf36f('0x3b'),_0xf36f('0x2d'),_0x586895[_0xf36f('0x3c')]);});}}});})[_0xf36f('0x1b')](function(){return _0xe55f27[_0xf36f('0x2e')][_0xf36f('0x33')]({'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0xe55f27[_0xf36f('0x36')],'as':_0xf36f('0x3d'),'where':{'id':_0x4a7ee9[_0xf36f('0x24')]}}]})[_0xf36f('0x1b')](function(_0x513296){if(_0x513296){var _0x5a6a6a=[];for(var _0x44e611=0x0,_0x1bc296;_0x44e611<_0x513296[_0xf36f('0x3a')];_0x44e611+=0x1){_0x1bc296=_0x513296[_0x44e611][_0xf36f('0x12')]({'plain':!![]});switch(_0x1bc296[_0xf36f('0x35')]){case _0xf36f('0x37'):_0x1362fa(_0x1bc296)[_0xf36f('0x2b')](_0x2cd31d());break;case _0xf36f('0x38'):_0x2cb568(_0x1bc296)['catch'](_0x2cd31d());break;default:_0xe55f27[_0xf36f('0x20')]['create']({'phone':_0x4a7ee9[_0xf36f('0xa')],'ContactId':_0x4a7ee9['id'],'ListId':_0x4a7ee9[_0xf36f('0x24')],'scheduledat':_0x4a7ee9['scheduledat']?_0x4a7ee9[_0xf36f('0x14')]:moment()['format'](_0xf36f('0x16')),'priority':_0x4a7ee9[_0xf36f('0x25')]?_0x4a7ee9[_0xf36f('0x25')]:0x2,'callback':_0x4a7ee9['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4a7ee9[_0xf36f('0x26')]?_0x4a7ee9[_0xf36f('0x26')]:undefined,'callbackat':_0x4a7ee9['callbackUniqueid']?moment()[_0xf36f('0x15')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x1bc296['id']})[_0xf36f('0x2b')](_0x2cd31d());}}}});})[_0xf36f('0x1b')](function(){return _0xe55f27[_0xf36f('0x2e')][_0xf36f('0x33')]({'attributes':['id'],'include':[{'model':_0xe55f27[_0xf36f('0x36')],'as':'BlackLists','where':{'id':_0x4a7ee9[_0xf36f('0x24')]}}]})['then'](function(_0x181eba){if(_0x181eba){var _0x51c7fa=[];for(var _0x3a670d=0x0,_0x36ff25;_0x3a670d<_0x181eba[_0xf36f('0x3a')];_0x3a670d+=0x1){_0x36ff25=_0x181eba[_0x3a670d]['get']({'plain':!![]});_0xe55f27[_0xf36f('0x3e')]['create']({'phone':_0x4a7ee9[_0xf36f('0xa')],'ContactId':_0x4a7ee9['id'],'ListId':_0x4a7ee9[_0xf36f('0x24')],'CampaignId':_0x36ff25['id']})[_0xf36f('0x2b')](function(_0x245549){logger[_0xf36f('0x2c')](_0xf36f('0x3b'),_0xf36f('0x2d'),_0x245549['message']);});}}});})[_0xf36f('0x1b')](function(){_0x546c88();})['catch'](function(_0x316f72){logger[_0xf36f('0x2c')]('cmContact,\x20%s,\x20%s',_0xf36f('0x2d'),_0x316f72[_0xf36f('0x3c')]);_0x546c88(_0x316f72);});}else{_0x546c88(new Error(_0xf36f('0x3f')));}},'afterDestroy':function(_0x432c44,_0x112086,_0x217509){var _0x543559=_0xb5262['models'];var _0x417859=_0x432c44['get']({'plain':!![]});return _0x543559[_0xf36f('0x20')][_0xf36f('0x33')]({'raw':!![],'where':{'ListId':_0x417859[_0xf36f('0x24')],'ContactId':_0x417859['id']}})[_0xf36f('0x1b')](function(_0x5691cd){if(!_[_0xf36f('0x40')](_0x5691cd)){var _0x32c70d=[];for(var _0x524e21=0x0;_0x524e21<_0x5691cd[_0xf36f('0x3a')];_0x524e21+=0x1){var _0x49d6b0=_0x543559[_0xf36f('0x20')][_0xf36f('0x41')]({'where':{'ListId':_0x5691cd[_0x524e21][_0xf36f('0x24')],'ContactId':_0x5691cd[_0x524e21]['ContactId'],'VoiceQueueId':_0x5691cd[_0x524e21][_0xf36f('0x42')],'CampaignId':_0x5691cd[_0x524e21]['CampaignId']}});_0x32c70d[_0xf36f('0x43')](_0x49d6b0);}return BPromise['all'](_0x32c70d);}})[_0xf36f('0x1b')](function(_0x560c0a){logger[_0xf36f('0x44')](_0xf36f('0x45'),util[_0xf36f('0x46')](_0x560c0a,{'showHidden':![],'depth':null}));_0x217509();})[_0xf36f('0x2b')](function(_0x54b583){logger[_0xf36f('0x2c')]('[CmContact][afterDestroy][Error]',util[_0xf36f('0x46')](_0x54b583,{'showHidden':![],'depth':null}));_0x217509(_0x54b583);});}}});}; \ No newline at end of file +var _0xf821=['minutes','ret','CmHopper','findOne','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','format','callbackUniqueid','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','catch','cmContact','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','dialCheckDuplicateType','CmList','always','findAll','outbound','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Campaign','Lists','length','List\x20not\x20found','isEmpty','ContactId','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','bluebird','request-promise','path','../../config/environment','../../config/environment/shared','exports','CmContact','cm_contacts','phone','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','afterCreate','inspect','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','then','timezones','utcOffset'];(function(_0x5b34c0,_0x3ad403){var _0x242bd3=function(_0x51d0ce){while(--_0x51d0ce){_0x5b34c0['push'](_0x5b34c0['shift']());}};_0x242bd3(++_0x3ad403);}(_0xf821,0x145));var _0x1f82=function(_0x190d2c,_0x159734){_0x190d2c=_0x190d2c-0x0;var _0x83d998=_0xf821[_0x190d2c];return _0x83d998;};'use strict';var _=require(_0x1f82('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x1f82('0x1'));var rp=require(_0x1f82('0x2'));var fs=require('fs');var path=require(_0x1f82('0x3'));var rimraf=require('rimraf');var config=require(_0x1f82('0x4'));var shared=require(_0x1f82('0x5'));var attributes=require('./cmContact.attributes');module[_0x1f82('0x6')]=function(_0x3260fa,_0x5bc22f){return _0x3260fa['define'](_0x1f82('0x7'),attributes,{'tableName':_0x1f82('0x8'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0x1f82('0x9')]},{'name':'fti_cm_contacts','fields':[_0x1f82('0xa'),_0x1f82('0xb'),_0x1f82('0x9'),_0x1f82('0xc'),_0x1f82('0xd'),_0x1f82('0xe')],'type':_0x1f82('0xf')}],'timestamps':!![],'charset':_0x1f82('0x10'),'collate':_0x1f82('0x11'),'hooks':{'afterCreate':function(_0x141c42,_0x71ec4c,_0x209a18){var _0x11cb15=_0x3260fa[_0x1f82('0x12')];var _0x243e4=_0x141c42[_0x1f82('0x13')]({'plain':!![]});function _0x28dc96(){return function(_0x18a083){logger[_0x1f82('0x14')]('cmContact',_0x1f82('0x15'),util[_0x1f82('0x16')](_0x18a083,{'showHidden':![],'depth':null}));};}function _0x1c49e2(_0x3ce6cd,_0x5a4b37){var _0x37b25c=_0x5a4b37['scheduledat']?_0x5a4b37[_0x1f82('0x17')]:moment()['format'](_0x1f82('0x18'));return new BPromise(function(_0x32904e,_0x371575){if(_[_0x1f82('0x19')](_0x5a4b37[_0x1f82('0x1a')])){_0x32904e({'ret':_0x37b25c});}else{_0x11cb15['VoiceQueue']['findOne']({'where':{'id':_0x3ce6cd['id']}})[_0x1f82('0x1b')](function(_0x1d4c40){if(!_[_0x1f82('0x19')](_0x1d4c40)){var _0x297c12=_0x1d4c40[_0x1f82('0x1a')];if(!_['isNil'](_0x297c12)){var _0x46b391=shared[_0x1f82('0x1c')];var _0x56d4f1=_0x46b391[_0x297c12];var _0x465be3=_0x46b391[_0x5a4b37['dialTimezone']];if(!_[_0x1f82('0x19')](_0x56d4f1)&&!_['isNil'](_0x465be3)){var _0x19841b=_0x56d4f1[_0x1f82('0x1d')]-_0x465be3[_0x1f82('0x1d')];_0x37b25c=_0x5a4b37[_0x1f82('0x17')]?_0x5a4b37['scheduledat']:moment();var _0x1effe4=moment(_0x37b25c)['add'](_0x19841b,_0x1f82('0x1e'));_0x32904e({'ret':_0x1effe4['format'](_0x1f82('0x18'))});}else _0x32904e({'ret':_0x37b25c});}else _0x32904e({'ret':_0x37b25c});}else{_0x32904e({'ret':_0x37b25c});}});}});return 0xa;}var _0x38e98e=function(_0x3a1302){return new BPromise(function(_0x438003,_0x56d903){_0x1c49e2(_0x3a1302,_0x243e4)[_0x1f82('0x1b')](function(_0x2e9063){_0x243e4[_0x1f82('0x17')]=_0x2e9063[_0x1f82('0x1f')];_0x11cb15[_0x1f82('0x20')][_0x1f82('0x21')]({'where':{'phone':_0x243e4[_0x1f82('0x9')],'VoiceQueueId':_0x3a1302['id']}})[_0x1f82('0x1b')](function(_0x133cb2){if(!_['isNil'](_0x133cb2)){throw new Error(_0x1f82('0x22')+_0x243e4['phone']+_0x1f82('0x23')+_0x3a1302['id']);}return _0x11cb15[_0x1f82('0x20')][_0x1f82('0x24')]({'phone':_0x243e4[_0x1f82('0x9')],'ContactId':_0x243e4['id'],'ListId':_0x243e4[_0x1f82('0x25')],'priority':_0x243e4[_0x1f82('0x26')]?_0x243e4[_0x1f82('0x26')]:0x2,'scheduledat':_0x243e4[_0x1f82('0x17')]?_0x243e4[_0x1f82('0x17')]:moment()[_0x1f82('0x27')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x243e4[_0x1f82('0x28')]?!![]:![],'callbackuniqueid':_0x243e4[_0x1f82('0x28')]?_0x243e4[_0x1f82('0x28')]:undefined,'callbackat':_0x243e4[_0x1f82('0x28')]?moment()[_0x1f82('0x27')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x3a1302['id']});})['catch'](function(_0x47d67d){_0x56d903(_0x47d67d);});});});};var _0x38de45=function(_0x1d6e1c){return new BPromise(function(_0x56983b,_0x68c654){_0x1c49e2(_0x1d6e1c,_0x243e4)[_0x1f82('0x1b')](function(_0x598225){_0x243e4['scheduledat']=_0x598225['ret'];_0x11cb15['CmHopper'][_0x1f82('0x21')]({'where':{'phone':_0x243e4[_0x1f82('0x9')],'VoiceQueueId':_0x1d6e1c['id']}})[_0x1f82('0x1b')](function(_0x21f9c6){if(!_['isNil'](_0x21f9c6)){throw new Error('cmContact,\x20afterCreate\x20'+_0x243e4[_0x1f82('0x9')]+_0x1f82('0x29')+_0x1d6e1c['id']);}return _0x11cb15[_0x1f82('0x2a')][_0x1f82('0x21')]({'where':{'calleridnum':_0x243e4[_0x1f82('0x9')],'VoiceQueueId':_0x1d6e1c['id']}});})['then'](function(_0x53d783){if(!_[_0x1f82('0x19')](_0x53d783)){throw new Error(_0x1f82('0x2b')+_0x243e4[_0x1f82('0x9')]+_0x1f82('0x2c')+_0x1d6e1c['id']);}return _0x11cb15['CmHopper']['create']({'phone':_0x243e4[_0x1f82('0x9')],'ContactId':_0x243e4['id'],'ListId':_0x243e4[_0x1f82('0x25')],'priority':_0x243e4[_0x1f82('0x26')]?_0x243e4[_0x1f82('0x26')]:0x2,'scheduledat':_0x243e4[_0x1f82('0x17')]?_0x243e4[_0x1f82('0x17')]:moment()['format'](_0x1f82('0x18')),'callback':_0x243e4['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x243e4[_0x1f82('0x28')]?_0x243e4[_0x1f82('0x28')]:undefined,'callbackat':_0x243e4['callbackUniqueid']?moment()[_0x1f82('0x27')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x1d6e1c['id']});})[_0x1f82('0x2d')](function(_0x3a03aa){_0x68c654(_0x3a03aa);});});});};function _0x6643db(){return function(_0x36fa01){logger[_0x1f82('0x14')](_0x1f82('0x2e'),_0x1f82('0x15'),util[_0x1f82('0x16')](_0x36fa01,{'showHidden':![],'depth':null}));};}function _0x34e204(_0x795a82,_0x3b295c){var _0x317882=_0x3b295c['scheduledat']?_0x3b295c['scheduledat']:moment()[_0x1f82('0x27')](_0x1f82('0x18'));return new BPromise(function(_0x23b0ad,_0x509190){if(_['isNil'](_0x3b295c[_0x1f82('0x1a')])){_0x23b0ad({'ret':_0x317882});}else{_0x11cb15['Campaign'][_0x1f82('0x21')]({'where':{'id':_0x795a82['id']}})[_0x1f82('0x1b')](function(_0x4ac2e2){if(!_[_0x1f82('0x19')](_0x4ac2e2)){var _0x2eec6f=_0x4ac2e2['dialTimezone'];if(!_[_0x1f82('0x19')](_0x2eec6f)){var _0xfd29be=shared[_0x1f82('0x1c')];var _0x4c7ad6=_0xfd29be[_0x2eec6f];var _0x46edd0=_0xfd29be[_0x3b295c['dialTimezone']];if(!_[_0x1f82('0x19')](_0x4c7ad6)&&!_[_0x1f82('0x19')](_0x46edd0)){var _0xec1181=_0x4c7ad6[_0x1f82('0x1d')]-_0x46edd0['utcOffset'];_0x317882=_0x3b295c[_0x1f82('0x17')]?_0x3b295c[_0x1f82('0x17')]:moment();var _0x40210b=moment(_0x317882)['add'](_0xec1181,_0x1f82('0x1e'));_0x23b0ad({'ret':_0x40210b[_0x1f82('0x27')](_0x1f82('0x18'))});}else _0x23b0ad({'ret':_0x317882});}else _0x23b0ad({'ret':_0x317882});}else{_0x23b0ad({'ret':_0x317882});}});}});return 0xa;}var _0x472dac=function(_0x1384af){return new BPromise(function(_0x42436c,_0x3fca1c){_0x34e204(_0x1384af,_0x243e4)[_0x1f82('0x1b')](function(_0x3157f7){_0x243e4[_0x1f82('0x17')]=_0x3157f7['ret'];_0x11cb15[_0x1f82('0x20')][_0x1f82('0x21')]({'where':{'phone':_0x243e4['phone'],'CampaignId':_0x1384af['id']}})[_0x1f82('0x1b')](function(_0x2cf2ed){if(!_[_0x1f82('0x19')](_0x2cf2ed)){throw new Error('cmContact,\x20afterCreate\x20'+_0x243e4[_0x1f82('0x9')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x1384af['id']);}return _0x11cb15[_0x1f82('0x20')]['create']({'phone':_0x243e4[_0x1f82('0x9')],'ContactId':_0x243e4['id'],'ListId':_0x243e4[_0x1f82('0x25')],'priority':_0x243e4[_0x1f82('0x26')]?_0x243e4[_0x1f82('0x26')]:0x2,'scheduledat':_0x243e4['scheduledat']?_0x243e4['scheduledat']:moment()[_0x1f82('0x27')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x243e4[_0x1f82('0x28')]?!![]:![],'callbackuniqueid':_0x243e4['callbackUniqueid']?_0x243e4[_0x1f82('0x28')]:undefined,'callbackat':_0x243e4['callbackUniqueid']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x1384af['id']});})[_0x1f82('0x2d')](function(_0x284ff3){_0x3fca1c(_0x284ff3);});});});};var _0x42f87=function(_0x19c0d5){return new BPromise(function(_0x5b56e6,_0x162976){_0x34e204(_0x19c0d5,_0x243e4)['then'](function(_0x151dd7){_0x243e4[_0x1f82('0x17')]=_0x151dd7[_0x1f82('0x1f')];_0x11cb15[_0x1f82('0x20')][_0x1f82('0x21')]({'where':{'phone':_0x243e4[_0x1f82('0x9')],'CampaignId':_0x19c0d5['id']}})['then'](function(_0xe6c017){if(!_['isNil'](_0xe6c017)){throw new Error(_0x1f82('0x22')+_0x243e4['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x19c0d5['id']);}return _0x11cb15['CmHopperFinal'][_0x1f82('0x21')]({'where':{'calleridnum':_0x243e4[_0x1f82('0x9')],'CampaignId':_0x19c0d5['id']}});})[_0x1f82('0x1b')](function(_0x321209){if(!_[_0x1f82('0x19')](_0x321209)){throw new Error(_0x1f82('0x2b')+_0x243e4[_0x1f82('0x9')]+_0x1f82('0x2f')+_0x19c0d5['id']);}return _0x11cb15[_0x1f82('0x20')][_0x1f82('0x24')]({'phone':_0x243e4[_0x1f82('0x9')],'ContactId':_0x243e4['id'],'ListId':_0x243e4[_0x1f82('0x25')],'priority':_0x243e4[_0x1f82('0x26')]?_0x243e4[_0x1f82('0x26')]:0x2,'scheduledat':_0x243e4[_0x1f82('0x17')]?_0x243e4[_0x1f82('0x17')]:moment()[_0x1f82('0x27')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x243e4[_0x1f82('0x28')]?!![]:![],'callbackuniqueid':_0x243e4[_0x1f82('0x28')]?_0x243e4[_0x1f82('0x28')]:undefined,'callbackat':_0x243e4[_0x1f82('0x28')]?moment()[_0x1f82('0x27')](_0x1f82('0x18')):undefined,'CampaignId':_0x19c0d5['id']});})[_0x1f82('0x2d')](function(_0x1b823f){_0x162976(_0x1b823f);});});});};if(_0x243e4['ListId']){_0x11cb15[_0x1f82('0x30')]['findAll']({'where':{'type':'outbound'},'attributes':['id',_0x1f82('0x31'),_0x1f82('0x1a')],'include':[{'model':_0x11cb15[_0x1f82('0x32')],'as':'Lists','where':{'id':_0x243e4[_0x1f82('0x25')]}}]})[_0x1f82('0x1b')](function(_0x210f18){if(_0x210f18){var _0x455359=[];for(var _0x515f51=0x0,_0x5ea600;_0x515f51<_0x210f18['length'];_0x515f51+=0x1){_0x5ea600=_0x210f18[_0x515f51][_0x1f82('0x13')]({'plain':!![]});switch(_0x5ea600[_0x1f82('0x31')]){case _0x1f82('0x33'):_0x38de45(_0x5ea600)['catch'](_0x28dc96());break;case'onlyIfOpen':_0x38e98e(_0x5ea600)[_0x1f82('0x2d')](_0x28dc96());break;default:_0x34e204(_0x5ea600,_0x243e4)[_0x1f82('0x1b')](function(_0x2ebeca){_0x243e4[_0x1f82('0x17')]=_0x2ebeca[_0x1f82('0x1f')];_0x11cb15[_0x1f82('0x20')]['create']({'phone':_0x243e4[_0x1f82('0x9')],'ContactId':_0x243e4['id'],'ListId':_0x243e4[_0x1f82('0x25')],'scheduledat':_0x243e4['scheduledat']?_0x243e4[_0x1f82('0x17')]:moment()['format'](_0x1f82('0x18')),'priority':_0x243e4[_0x1f82('0x26')]?_0x243e4[_0x1f82('0x26')]:0x2,'callback':_0x243e4[_0x1f82('0x28')]?!![]:![],'callbackuniqueid':_0x243e4[_0x1f82('0x28')]?_0x243e4[_0x1f82('0x28')]:undefined,'callbackat':_0x243e4[_0x1f82('0x28')]?moment()[_0x1f82('0x27')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x5ea600['id']})[_0x1f82('0x2d')](_0x28dc96());});}}}})[_0x1f82('0x1b')](function(){return _0x11cb15[_0x1f82('0x30')][_0x1f82('0x34')]({'where':{'type':_0x1f82('0x35')},'attributes':['id'],'include':[{'model':_0x11cb15[_0x1f82('0x32')],'as':_0x1f82('0x36'),'where':{'id':_0x243e4[_0x1f82('0x25')]}}]})[_0x1f82('0x1b')](function(_0x49127c){if(_0x49127c){var _0x15f3f0=[];for(var _0x216227=0x0,_0x19010e;_0x216227<_0x49127c['length'];_0x216227+=0x1){_0x19010e=_0x49127c[_0x216227][_0x1f82('0x13')]({'plain':!![]});_0x11cb15[_0x1f82('0x37')][_0x1f82('0x24')]({'phone':_0x243e4[_0x1f82('0x9')],'ContactId':_0x243e4['id'],'ListId':_0x243e4[_0x1f82('0x25')],'VoiceQueueId':_0x19010e['id']})['catch'](function(_0xfe225c){logger[_0x1f82('0x14')](_0x1f82('0x38'),_0x1f82('0x15'),_0xfe225c[_0x1f82('0x39')]);});}}});})[_0x1f82('0x1b')](function(){return _0x11cb15[_0x1f82('0x3a')][_0x1f82('0x34')]({'attributes':['id',_0x1f82('0x31'),_0x1f82('0x1a')],'include':[{'model':_0x11cb15[_0x1f82('0x32')],'as':_0x1f82('0x3b'),'where':{'id':_0x243e4['ListId']}}]})[_0x1f82('0x1b')](function(_0x301496){if(_0x301496){var _0x6a8ee1=[];for(var _0xf8f970=0x0,_0x576710;_0xf8f970<_0x301496['length'];_0xf8f970+=0x1){_0x576710=_0x301496[_0xf8f970][_0x1f82('0x13')]({'plain':!![]});switch(_0x576710['dialCheckDuplicateType']){case'always':_0x42f87(_0x576710)['catch'](_0x6643db());break;case'onlyIfOpen':_0x472dac(_0x576710)['catch'](_0x6643db());break;default:_0x11cb15['CmHopper']['create']({'phone':_0x243e4[_0x1f82('0x9')],'ContactId':_0x243e4['id'],'ListId':_0x243e4[_0x1f82('0x25')],'scheduledat':_0x243e4[_0x1f82('0x17')]?_0x243e4[_0x1f82('0x17')]:moment()[_0x1f82('0x27')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x243e4[_0x1f82('0x26')]?_0x243e4[_0x1f82('0x26')]:0x2,'callback':_0x243e4[_0x1f82('0x28')]?!![]:![],'callbackuniqueid':_0x243e4[_0x1f82('0x28')]?_0x243e4[_0x1f82('0x28')]:undefined,'callbackat':_0x243e4[_0x1f82('0x28')]?moment()['format'](_0x1f82('0x18')):undefined,'CampaignId':_0x576710['id']})[_0x1f82('0x2d')](_0x6643db());}}}});})[_0x1f82('0x1b')](function(){return _0x11cb15[_0x1f82('0x3a')][_0x1f82('0x34')]({'attributes':['id'],'include':[{'model':_0x11cb15[_0x1f82('0x32')],'as':_0x1f82('0x36'),'where':{'id':_0x243e4['ListId']}}]})[_0x1f82('0x1b')](function(_0x41efe7){if(_0x41efe7){var _0x3b97ca=[];for(var _0xe6e5c0=0x0,_0x225741;_0xe6e5c0<_0x41efe7[_0x1f82('0x3c')];_0xe6e5c0+=0x1){_0x225741=_0x41efe7[_0xe6e5c0][_0x1f82('0x13')]({'plain':!![]});_0x11cb15[_0x1f82('0x37')]['create']({'phone':_0x243e4[_0x1f82('0x9')],'ContactId':_0x243e4['id'],'ListId':_0x243e4[_0x1f82('0x25')],'CampaignId':_0x225741['id']})['catch'](function(_0x4576c4){logger[_0x1f82('0x14')](_0x1f82('0x38'),_0x1f82('0x15'),_0x4576c4[_0x1f82('0x39')]);});}}});})['then'](function(){_0x209a18();})[_0x1f82('0x2d')](function(_0x1a9f47){logger['error'](_0x1f82('0x38'),_0x1f82('0x15'),_0x1a9f47[_0x1f82('0x39')]);_0x209a18(_0x1a9f47);});}else{_0x209a18(new Error(_0x1f82('0x3d')));}},'afterDestroy':function(_0x307ac4,_0x2a817a,_0x353d77){var _0x25ed34=_0x3260fa['models'];var _0x48793b=_0x307ac4[_0x1f82('0x13')]({'plain':!![]});return _0x25ed34['CmHopper'][_0x1f82('0x34')]({'raw':!![],'where':{'ListId':_0x48793b[_0x1f82('0x25')],'ContactId':_0x48793b['id']}})[_0x1f82('0x1b')](function(_0x499cd7){if(!_[_0x1f82('0x3e')](_0x499cd7)){var _0x5f56be=[];for(var _0x1607d2=0x0;_0x1607d2<_0x499cd7[_0x1f82('0x3c')];_0x1607d2+=0x1){var _0x1735fb=_0x25ed34[_0x1f82('0x20')]['destroy']({'where':{'ListId':_0x499cd7[_0x1607d2][_0x1f82('0x25')],'ContactId':_0x499cd7[_0x1607d2][_0x1f82('0x3f')],'VoiceQueueId':_0x499cd7[_0x1607d2][_0x1f82('0x40')],'CampaignId':_0x499cd7[_0x1607d2][_0x1f82('0x41')]}});_0x5f56be[_0x1f82('0x42')](_0x1735fb);}return BPromise[_0x1f82('0x43')](_0x5f56be);}})['then'](function(_0xece853){logger[_0x1f82('0x44')](_0x1f82('0x45'),util[_0x1f82('0x16')](_0xece853,{'showHidden':![],'depth':null}));_0x353d77();})[_0x1f82('0x2d')](function(_0x1aa062){logger['error'](_0x1f82('0x46'),util['inspect'](_0x1aa062,{'showHidden':![],'depth':null}));_0x353d77(_0x1aa062);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 7ce828a..0f3397b 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(_0x3399ce,_0x129013){var _0x51d0b4=function(_0x474dff){while(--_0x474dff){_0x3399ce['push'](_0x3399ce['shift']());}};_0x51d0b4(++_0x129013);}(_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(_0x1fa158,_0xaa04d){var _0x38962e=function(_0x2cbce6){while(--_0x2cbce6){_0x1fa158['push'](_0x1fa158['shift']());}};_0x38962e(++_0xaa04d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 182e057..d4d0f95 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 _0x4f99=['exports','STRING','INTEGER','sequelize'];(function(_0x576e06,_0x2387f2){var _0x135ec2=function(_0x276a53){while(--_0x276a53){_0x576e06['push'](_0x576e06['shift']());}};_0x135ec2(++_0x2387f2);}(_0x4f99,0x157));var _0x94f9=function(_0x4e61aa,_0xda3b53){_0x4e61aa=_0x4e61aa-0x0;var _0x4d2bd2=_0x4f99[_0x4e61aa];return _0x4d2bd2;};'use strict';var Sequelize=require(_0x94f9('0x0'));module[_0x94f9('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x94f9('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x94f9('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x94f9('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x94f9('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0x94f9('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x2f72=['INTEGER','STRING','PHONE','sequelize','exports'];(function(_0x23d057,_0x78b62d){var _0x2fbc46=function(_0x16de3a){while(--_0x16de3a){_0x23d057['push'](_0x23d057['shift']());}};_0x2fbc46(++_0x78b62d);}(_0x2f72,0x166));var _0x22f7=function(_0x195af5,_0x3339e8){_0x195af5=_0x195af5-0x0;var _0x1b3a36=_0x2f72[_0x195af5];return _0x1b3a36;};'use strict';var Sequelize=require(_0x22f7('0x0'));module[_0x22f7('0x1')]={'CmContactId':{'type':Sequelize[_0x22f7('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x22f7('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x22f7('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x22f7('0x3')],'defaultValue':_0x22f7('0x4')},'OrderBy':{'type':Sequelize[_0x22f7('0x2')],'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 a00c1e4..fec52e3 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 _0x200c=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','destroy','get','CmContactHasItems','UserProfileResource','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','count','includeAll','include','CmContactHasItem','findAll','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x200c,0x1b9));var _0xc200=function(_0x2ea313,_0x5e0da7){_0x2ea313=_0x2ea313-0x0;var _0x4d23ae=_0x200c[_0x2ea313];return _0x4d23ae;};'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(_0xc200('0x6'));var Mustache=require(_0xc200('0x7'));var util=require(_0xc200('0x8'));var path=require('path');var sox=require(_0xc200('0x9'));var csv=require(_0xc200('0xa'));var ejs=require(_0xc200('0xb'));var fs=require('fs');var fs_extra=require(_0xc200('0xc'));var _=require(_0xc200('0xd'));var squel=require(_0xc200('0xe'));var crypto=require(_0xc200('0xf'));var jsforce=require(_0xc200('0x10'));var deskjs=require(_0xc200('0x11'));var toCsv=require(_0xc200('0xa'));var querystring=require(_0xc200('0x12'));var Papa=require(_0xc200('0x13'));var Redis=require(_0xc200('0x14'));var authService=require(_0xc200('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xc200('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc200('0x17'))(_0xc200('0x18'));var utils=require('../../config/utils');var config=require(_0xc200('0x19'));var licenseUtil=require(_0xc200('0x1a'));var db=require(_0xc200('0x1b'))['db'];function respondWithStatusCode(_0x17c866,_0x103b98){_0x103b98=_0x103b98||0xcc;return function(_0x2ccde7){if(_0x2ccde7){return _0x17c866[_0xc200('0x1c')](_0x103b98);}return _0x17c866[_0xc200('0x1d')](_0x103b98)['end']();};}function respondWithResult(_0x30478f,_0x43e79b){_0x43e79b=_0x43e79b||0xc8;return function(_0x535151){if(_0x535151){return _0x30478f[_0xc200('0x1d')](_0x43e79b)[_0xc200('0x1e')](_0x535151);}};}function respondWithFilteredResult(_0x484885,_0x2cc692){return function(_0x286d01){if(_0x286d01){var _0x5ae7d4=typeof _0x2cc692[_0xc200('0x1f')]===_0xc200('0x20')&&typeof _0x2cc692[_0xc200('0x21')]===_0xc200('0x20');var _0x2cb699=_0x286d01['count'];var _0x555a74=_0x5ae7d4?0x0:_0x2cc692['offset'];var _0x3049af=_0x5ae7d4?_0x286d01['count']:_0x2cc692['offset']+_0x2cc692['limit'];var _0x329c45;if(_0x3049af>=_0x2cb699){_0x3049af=_0x2cb699;_0x329c45=0xc8;}else{_0x329c45=0xce;}_0x484885[_0xc200('0x1d')](_0x329c45);return _0x484885[_0xc200('0x22')](_0xc200('0x23'),_0x555a74+'-'+_0x3049af+'/'+_0x2cb699)['json'](_0x286d01);}return null;};}function patchUpdates(_0x748a40){return function(_0x207ed9){try{jsonpatch[_0xc200('0x24')](_0x207ed9,_0x748a40,!![]);}catch(_0x5533f3){return BPromise[_0xc200('0x25')](_0x5533f3);}return _0x207ed9['save']();};}function saveUpdates(_0x4bed5e,_0x431b59){return function(_0xbd93fd){if(_0xbd93fd){return _0xbd93fd[_0xc200('0x26')](_0x4bed5e)[_0xc200('0x27')](function(_0x8347fd){return _0x8347fd;});}return null;};}function removeEntity(_0x143f59,_0x3c3d80){return function(_0x1a5a16){if(_0x1a5a16){return _0x1a5a16[_0xc200('0x28')]()[_0xc200('0x27')](function(){var _0x23ae15=_0x1a5a16[_0xc200('0x29')]({'plain':!![]});var _0x9d1831=_0xc200('0x2a');return db[_0xc200('0x2b')][_0xc200('0x28')]({'where':{'type':_0x9d1831,'resourceId':_0x23ae15['id']}})[_0xc200('0x27')](function(){return _0x1a5a16;});})[_0xc200('0x27')](function(){_0x143f59[_0xc200('0x1d')](0xcc)[_0xc200('0x2c')]();});}};}function handleEntityNotFound(_0x50a7ed,_0x51aa79){return function(_0x20bb7c){if(!_0x20bb7c){_0x50a7ed[_0xc200('0x1c')](0x194);}return _0x20bb7c;};}function handleError(_0x28d4ac,_0x3dfcee){_0x3dfcee=_0x3dfcee||0x1f4;return function(_0x221ba3){logger['error'](_0x221ba3[_0xc200('0x2d')]);if(_0x221ba3[_0xc200('0x2e')]){delete _0x221ba3[_0xc200('0x2e')];}_0x28d4ac[_0xc200('0x1d')](_0x3dfcee)[_0xc200('0x2f')](_0x221ba3);};}exports[_0xc200('0x30')]=function(_0x13bd6f,_0x17e3a1){var _0xe5eefc={},_0x420029={},_0x4d8b24={'count':0x0,'rows':[]};var _0x2ee760=_[_0xc200('0x31')](db['CmContactHasItem'][_0xc200('0x32')],function(_0x53ae4c){return{'name':_0x53ae4c[_0xc200('0x33')],'type':_0x53ae4c[_0xc200('0x34')][_0xc200('0x35')]};});_0x420029[_0xc200('0x36')]=_[_0xc200('0x31')](_0x2ee760,_0xc200('0x2e'));_0x420029[_0xc200('0x37')]=_[_0xc200('0x38')](_0x13bd6f[_0xc200('0x37')]);_0x420029[_0xc200('0x39')]=_[_0xc200('0x3a')](_0x420029['model'],_0x420029[_0xc200('0x37')]);_0xe5eefc[_0xc200('0x3b')]=_[_0xc200('0x3a')](_0x420029[_0xc200('0x36')],qs[_0xc200('0x3c')](_0x13bd6f['query']['fields']));_0xe5eefc[_0xc200('0x3b')]=_0xe5eefc[_0xc200('0x3b')][_0xc200('0x3d')]?_0xe5eefc[_0xc200('0x3b')]:_0x420029['model'];if(!_0x13bd6f['query'][_0xc200('0x3e')](_0xc200('0x3f'))){_0xe5eefc[_0xc200('0x21')]=qs[_0xc200('0x21')](_0x13bd6f['query'][_0xc200('0x21')]);_0xe5eefc[_0xc200('0x1f')]=qs[_0xc200('0x1f')](_0x13bd6f[_0xc200('0x37')]['offset']);}_0xe5eefc[_0xc200('0x40')]=qs['sort'](_0x13bd6f[_0xc200('0x37')][_0xc200('0x41')]);_0xe5eefc[_0xc200('0x42')]=qs['filters'](_[_0xc200('0x43')](_0x13bd6f[_0xc200('0x37')],_0x420029[_0xc200('0x39')]),_0x2ee760);if(_0x13bd6f[_0xc200('0x37')]['filter']){_0xe5eefc[_0xc200('0x42')]=_[_0xc200('0x44')](_0xe5eefc[_0xc200('0x42')],{'$or':_['map'](_0x2ee760,function(_0x2afef5){if(_0x2afef5[_0xc200('0x34')]!==_0xc200('0x45')){var _0x168ea9={};_0x168ea9[_0x2afef5[_0xc200('0x2e')]]={'$like':'%'+_0x13bd6f[_0xc200('0x37')]['filter']+'%'};return _0x168ea9;}})});}_0xe5eefc=_[_0xc200('0x44')]({},_0xe5eefc,_0x13bd6f[_0xc200('0x46')]);var _0x104f97={'where':_0xe5eefc[_0xc200('0x42')]};return db['CmContactHasItem'][_0xc200('0x47')](_0x104f97)['then'](function(_0x27fc26){_0x4d8b24[_0xc200('0x47')]=_0x27fc26;if(_0x13bd6f[_0xc200('0x37')][_0xc200('0x48')]){_0xe5eefc[_0xc200('0x49')]=[{'all':!![]}];}return db[_0xc200('0x4a')][_0xc200('0x4b')](_0xe5eefc);})['then'](function(_0x1e44d6){_0x4d8b24['rows']=_0x1e44d6;return _0x4d8b24;})[_0xc200('0x27')](respondWithFilteredResult(_0x17e3a1,_0xe5eefc))[_0xc200('0x4c')](handleError(_0x17e3a1,null));};exports[_0xc200('0x4d')]=function(_0x5b63f8,_0x5b7542){var _0x3b66c7={'raw':!![],'where':{'id':_0x5b63f8[_0xc200('0x4e')]['id']}},_0x378848={};_0x378848[_0xc200('0x36')]=_[_0xc200('0x38')](db[_0xc200('0x4a')][_0xc200('0x32')]);_0x378848[_0xc200('0x37')]=_[_0xc200('0x38')](_0x5b63f8[_0xc200('0x37')]);_0x378848['filters']=_[_0xc200('0x3a')](_0x378848[_0xc200('0x36')],_0x378848[_0xc200('0x37')]);_0x3b66c7['attributes']=_[_0xc200('0x3a')](_0x378848[_0xc200('0x36')],qs[_0xc200('0x3c')](_0x5b63f8[_0xc200('0x37')][_0xc200('0x3c')]));_0x3b66c7['attributes']=_0x3b66c7[_0xc200('0x3b')][_0xc200('0x3d')]?_0x3b66c7['attributes']:_0x378848[_0xc200('0x36')];if(_0x5b63f8['query'][_0xc200('0x48')]){_0x3b66c7[_0xc200('0x49')]=[{'all':!![]}];}_0x3b66c7=_[_0xc200('0x44')]({},_0x3b66c7,_0x5b63f8[_0xc200('0x46')]);return db['CmContactHasItem']['find'](_0x3b66c7)[_0xc200('0x27')](handleEntityNotFound(_0x5b7542,null))[_0xc200('0x27')](respondWithResult(_0x5b7542,null))['catch'](handleError(_0x5b7542,null));};exports[_0xc200('0x4f')]=function(_0xf0f027,_0x223fa7){return db[_0xc200('0x4a')][_0xc200('0x4f')](_0xf0f027['body'],{})['then'](function(_0x52d15e){var _0x6ce12f=_0xf0f027[_0xc200('0x50')]['get']({'plain':!![]});if(!_0x6ce12f)throw new Error(_0xc200('0x51'));if(_0x6ce12f[_0xc200('0x52')]==='user'){var _0x57d160=_0x52d15e['get']({'plain':!![]});var _0x18d295=_0xc200('0x2a');return db[_0xc200('0x53')][_0xc200('0x54')]({'where':{'name':_0x18d295,'userProfileId':_0x6ce12f[_0xc200('0x55')]},'raw':!![]})[_0xc200('0x27')](function(_0x11d7e4){if(_0x11d7e4&&_0x11d7e4[_0xc200('0x56')]===0x0){return db[_0xc200('0x2b')][_0xc200('0x4f')]({'name':_0x57d160['name'],'resourceId':_0x57d160['id'],'type':_0x11d7e4['name'],'sectionId':_0x11d7e4['id']},{})['then'](function(){return _0x52d15e;});}else{return _0x52d15e;}})[_0xc200('0x4c')](function(_0xf370f3){logger[_0xc200('0x57')](_0xc200('0x58'),_0xf370f3);throw _0xf370f3;});}return _0x52d15e;})[_0xc200('0x27')](respondWithResult(_0x223fa7,0xc9))['catch'](handleError(_0x223fa7,null));};exports[_0xc200('0x26')]=function(_0x1c7489,_0x546a84){if(_0x1c7489[_0xc200('0x59')]['id']){delete _0x1c7489[_0xc200('0x59')]['id'];}return db['CmContactHasItem']['find']({'where':{'id':_0x1c7489[_0xc200('0x4e')]['id']}})['then'](handleEntityNotFound(_0x546a84,null))[_0xc200('0x27')](saveUpdates(_0x1c7489[_0xc200('0x59')],null))[_0xc200('0x27')](respondWithResult(_0x546a84,null))[_0xc200('0x4c')](handleError(_0x546a84,null));};exports[_0xc200('0x28')]=function(_0x2db997,_0x2b6b91){return db['CmContactHasItem'][_0xc200('0x54')]({'where':{'id':_0x2db997[_0xc200('0x4e')]['id']}})[_0xc200('0x27')](handleEntityNotFound(_0x2b6b91,null))['then'](removeEntity(_0x2b6b91,null))[_0xc200('0x4c')](handleError(_0x2b6b91,null));}; \ No newline at end of file +var _0xcbfc=['fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','destroy','then','get','CmContactHasItems','UserProfileResource','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','length','include','body','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs'];(function(_0x488262,_0x1f4b62){var _0x4e072b=function(_0x517e54){while(--_0x517e54){_0x488262['push'](_0x488262['shift']());}};_0x4e072b(++_0x1f4b62);}(_0xcbfc,0xfa));var _0xccbf=function(_0x4dfe8d,_0x432442){_0x4dfe8d=_0x4dfe8d-0x0;var _0x55cd1e=_0xcbfc[_0x4dfe8d];return _0x55cd1e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xccbf('0x0'));var zipdir=require(_0xccbf('0x1'));var jsonpatch=require(_0xccbf('0x2'));var rp=require(_0xccbf('0x3'));var moment=require(_0xccbf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xccbf('0x5'));var util=require(_0xccbf('0x6'));var path=require(_0xccbf('0x7'));var sox=require(_0xccbf('0x8'));var csv=require(_0xccbf('0x9'));var ejs=require(_0xccbf('0xa'));var fs=require('fs');var fs_extra=require(_0xccbf('0xb'));var _=require(_0xccbf('0xc'));var squel=require(_0xccbf('0xd'));var crypto=require(_0xccbf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xccbf('0xf'));var toCsv=require(_0xccbf('0x9'));var querystring=require(_0xccbf('0x10'));var Papa=require(_0xccbf('0x11'));var Redis=require(_0xccbf('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xccbf('0x13'));var as=require(_0xccbf('0x14'));var hardwareService=require(_0xccbf('0x15'));var logger=require(_0xccbf('0x16'))('api');var utils=require(_0xccbf('0x17'));var config=require(_0xccbf('0x18'));var licenseUtil=require(_0xccbf('0x19'));var db=require(_0xccbf('0x1a'))['db'];function respondWithStatusCode(_0x17324e,_0x53e608){_0x53e608=_0x53e608||0xcc;return function(_0x5ec364){if(_0x5ec364){return _0x17324e[_0xccbf('0x1b')](_0x53e608);}return _0x17324e[_0xccbf('0x1c')](_0x53e608)['end']();};}function respondWithResult(_0x316e80,_0x39d2e4){_0x39d2e4=_0x39d2e4||0xc8;return function(_0x7e229f){if(_0x7e229f){return _0x316e80[_0xccbf('0x1c')](_0x39d2e4)[_0xccbf('0x1d')](_0x7e229f);}};}function respondWithFilteredResult(_0x246502,_0x44055c){return function(_0x3ea4a8){if(_0x3ea4a8){var _0x150994=typeof _0x44055c[_0xccbf('0x1e')]==='undefined'&&typeof _0x44055c[_0xccbf('0x1f')]===_0xccbf('0x20');var _0x375001=_0x3ea4a8[_0xccbf('0x21')];var _0x176c33=_0x150994?0x0:_0x44055c[_0xccbf('0x1e')];var _0xd90199=_0x150994?_0x3ea4a8[_0xccbf('0x21')]:_0x44055c[_0xccbf('0x1e')]+_0x44055c['limit'];var _0x29bc13;if(_0xd90199>=_0x375001){_0xd90199=_0x375001;_0x29bc13=0xc8;}else{_0x29bc13=0xce;}_0x246502[_0xccbf('0x1c')](_0x29bc13);return _0x246502[_0xccbf('0x22')](_0xccbf('0x23'),_0x176c33+'-'+_0xd90199+'/'+_0x375001)[_0xccbf('0x1d')](_0x3ea4a8);}return null;};}function patchUpdates(_0x1e7112){return function(_0x1859b0){try{jsonpatch['apply'](_0x1859b0,_0x1e7112,!![]);}catch(_0x3b177c){return BPromise[_0xccbf('0x24')](_0x3b177c);}return _0x1859b0[_0xccbf('0x25')]();};}function saveUpdates(_0x2539f6,_0x1b9243){return function(_0x1ebf73){if(_0x1ebf73){return _0x1ebf73['update'](_0x2539f6)['then'](function(_0x663020){return _0x663020;});}return null;};}function removeEntity(_0x14674f,_0x2c4632){return function(_0x1f87dd){if(_0x1f87dd){return _0x1f87dd[_0xccbf('0x26')]()[_0xccbf('0x27')](function(){var _0x459311=_0x1f87dd[_0xccbf('0x28')]({'plain':!![]});var _0x452212=_0xccbf('0x29');return db[_0xccbf('0x2a')][_0xccbf('0x26')]({'where':{'type':_0x452212,'resourceId':_0x459311['id']}})['then'](function(){return _0x1f87dd;});})['then'](function(){_0x14674f[_0xccbf('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47dadc,_0x15e592){return function(_0x3162f4){if(!_0x3162f4){_0x47dadc[_0xccbf('0x1b')](0x194);}return _0x3162f4;};}function handleError(_0x2b02e1,_0x2c002a){_0x2c002a=_0x2c002a||0x1f4;return function(_0x226e53){logger[_0xccbf('0x2b')](_0x226e53[_0xccbf('0x2c')]);if(_0x226e53['name']){delete _0x226e53[_0xccbf('0x2d')];}_0x2b02e1['status'](_0x2c002a)[_0xccbf('0x2e')](_0x226e53);};}exports[_0xccbf('0x2f')]=function(_0x385b96,_0x53d9cb){var _0x421292={},_0x22b225={},_0x12251c={'count':0x0,'rows':[]};var _0x2fe380=_[_0xccbf('0x30')](db[_0xccbf('0x31')][_0xccbf('0x32')],function(_0x1d79a0){return{'name':_0x1d79a0[_0xccbf('0x33')],'type':_0x1d79a0[_0xccbf('0x34')][_0xccbf('0x35')]};});_0x22b225['model']=_['map'](_0x2fe380,_0xccbf('0x2d'));_0x22b225[_0xccbf('0x36')]=_[_0xccbf('0x37')](_0x385b96[_0xccbf('0x36')]);_0x22b225[_0xccbf('0x38')]=_[_0xccbf('0x39')](_0x22b225['model'],_0x22b225['query']);_0x421292[_0xccbf('0x3a')]=_[_0xccbf('0x39')](_0x22b225[_0xccbf('0x3b')],qs[_0xccbf('0x3c')](_0x385b96[_0xccbf('0x36')]['fields']));_0x421292['attributes']=_0x421292[_0xccbf('0x3a')]['length']?_0x421292['attributes']:_0x22b225[_0xccbf('0x3b')];if(!_0x385b96[_0xccbf('0x36')][_0xccbf('0x3d')](_0xccbf('0x3e'))){_0x421292[_0xccbf('0x1f')]=qs[_0xccbf('0x1f')](_0x385b96[_0xccbf('0x36')][_0xccbf('0x1f')]);_0x421292[_0xccbf('0x1e')]=qs[_0xccbf('0x1e')](_0x385b96['query'][_0xccbf('0x1e')]);}_0x421292[_0xccbf('0x3f')]=qs['sort'](_0x385b96['query'][_0xccbf('0x40')]);_0x421292[_0xccbf('0x41')]=qs[_0xccbf('0x38')](_[_0xccbf('0x42')](_0x385b96['query'],_0x22b225['filters']),_0x2fe380);if(_0x385b96[_0xccbf('0x36')]['filter']){_0x421292['where']=_['merge'](_0x421292[_0xccbf('0x41')],{'$or':_[_0xccbf('0x30')](_0x2fe380,function(_0x2a240b){if(_0x2a240b[_0xccbf('0x34')]!==_0xccbf('0x43')){var _0x163c45={};_0x163c45[_0x2a240b['name']]={'$like':'%'+_0x385b96[_0xccbf('0x36')]['filter']+'%'};return _0x163c45;}})});}_0x421292=_[_0xccbf('0x44')]({},_0x421292,_0x385b96[_0xccbf('0x45')]);var _0x2b9705={'where':_0x421292[_0xccbf('0x41')]};return db['CmContactHasItem'][_0xccbf('0x21')](_0x2b9705)[_0xccbf('0x27')](function(_0x4ed168){_0x12251c[_0xccbf('0x21')]=_0x4ed168;if(_0x385b96[_0xccbf('0x36')][_0xccbf('0x46')]){_0x421292['include']=[{'all':!![]}];}return db[_0xccbf('0x31')][_0xccbf('0x47')](_0x421292);})[_0xccbf('0x27')](function(_0x2b4e33){_0x12251c[_0xccbf('0x48')]=_0x2b4e33;return _0x12251c;})[_0xccbf('0x27')](respondWithFilteredResult(_0x53d9cb,_0x421292))[_0xccbf('0x49')](handleError(_0x53d9cb,null));};exports[_0xccbf('0x4a')]=function(_0x5d4ae5,_0xc3c72f){var _0xbb3ac3={'raw':!![],'where':{'id':_0x5d4ae5[_0xccbf('0x4b')]['id']}},_0x1a573d={};_0x1a573d[_0xccbf('0x3b')]=_[_0xccbf('0x37')](db[_0xccbf('0x31')]['rawAttributes']);_0x1a573d[_0xccbf('0x36')]=_[_0xccbf('0x37')](_0x5d4ae5[_0xccbf('0x36')]);_0x1a573d[_0xccbf('0x38')]=_['intersection'](_0x1a573d[_0xccbf('0x3b')],_0x1a573d[_0xccbf('0x36')]);_0xbb3ac3[_0xccbf('0x3a')]=_[_0xccbf('0x39')](_0x1a573d[_0xccbf('0x3b')],qs[_0xccbf('0x3c')](_0x5d4ae5[_0xccbf('0x36')][_0xccbf('0x3c')]));_0xbb3ac3[_0xccbf('0x3a')]=_0xbb3ac3[_0xccbf('0x3a')][_0xccbf('0x4c')]?_0xbb3ac3[_0xccbf('0x3a')]:_0x1a573d[_0xccbf('0x3b')];if(_0x5d4ae5[_0xccbf('0x36')][_0xccbf('0x46')]){_0xbb3ac3[_0xccbf('0x4d')]=[{'all':!![]}];}_0xbb3ac3=_[_0xccbf('0x44')]({},_0xbb3ac3,_0x5d4ae5[_0xccbf('0x45')]);return db[_0xccbf('0x31')]['find'](_0xbb3ac3)['then'](handleEntityNotFound(_0xc3c72f,null))['then'](respondWithResult(_0xc3c72f,null))[_0xccbf('0x49')](handleError(_0xc3c72f,null));};exports['create']=function(_0x5ea4ef,_0x2a57dc){return db[_0xccbf('0x31')]['create'](_0x5ea4ef[_0xccbf('0x4e')],{})['then'](function(_0x1babc6){var _0x1425a2=_0x5ea4ef[_0xccbf('0x4f')]['get']({'plain':!![]});if(!_0x1425a2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1425a2['role']===_0xccbf('0x4f')){var _0x716b33=_0x1babc6['get']({'plain':!![]});var _0x505b62=_0xccbf('0x29');return db[_0xccbf('0x50')]['find']({'where':{'name':_0x505b62,'userProfileId':_0x1425a2[_0xccbf('0x51')]},'raw':!![]})[_0xccbf('0x27')](function(_0xafe89c){if(_0xafe89c&&_0xafe89c[_0xccbf('0x52')]===0x0){return db[_0xccbf('0x2a')][_0xccbf('0x53')]({'name':_0x716b33[_0xccbf('0x2d')],'resourceId':_0x716b33['id'],'type':_0xafe89c[_0xccbf('0x2d')],'sectionId':_0xafe89c['id']},{})[_0xccbf('0x27')](function(){return _0x1babc6;});}else{return _0x1babc6;}})['catch'](function(_0x219cd6){logger[_0xccbf('0x2b')](_0xccbf('0x54'),_0x219cd6);throw _0x219cd6;});}return _0x1babc6;})[_0xccbf('0x27')](respondWithResult(_0x2a57dc,0xc9))['catch'](handleError(_0x2a57dc,null));};exports[_0xccbf('0x55')]=function(_0x63c562,_0x21de5a){if(_0x63c562[_0xccbf('0x4e')]['id']){delete _0x63c562[_0xccbf('0x4e')]['id'];}return db[_0xccbf('0x31')][_0xccbf('0x56')]({'where':{'id':_0x63c562['params']['id']}})[_0xccbf('0x27')](handleEntityNotFound(_0x21de5a,null))[_0xccbf('0x27')](saveUpdates(_0x63c562[_0xccbf('0x4e')],null))[_0xccbf('0x27')](respondWithResult(_0x21de5a,null))[_0xccbf('0x49')](handleError(_0x21de5a,null));};exports[_0xccbf('0x26')]=function(_0x40d4f4,_0x3805c9){return db['CmContactHasItem'][_0xccbf('0x56')]({'where':{'id':_0x40d4f4[_0xccbf('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3805c9,null))['then'](removeEntity(_0x3805c9,null))[_0xccbf('0x49')](handleError(_0x3805c9,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 8837b5f..7c02ebb 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 _0x72de=['moment','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','cm_contact_has_items','../../config/logger','api'];(function(_0x465845,_0x15007c){var _0x314825=function(_0x4f24b8){while(--_0x4f24b8){_0x465845['push'](_0x465845['shift']());}};_0x314825(++_0x15007c);}(_0x72de,0x1b6));var _0xe72d=function(_0x3a3d4f,_0xa32003){_0x3a3d4f=_0x3a3d4f-0x0;var _0x7c03cd=_0x72de[_0x3a3d4f];return _0x7c03cd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe72d('0x0'))(_0xe72d('0x1'));var moment=require(_0xe72d('0x2'));var BPromise=require('bluebird');var rp=require(_0xe72d('0x3'));var fs=require('fs');var path=require(_0xe72d('0x4'));var rimraf=require(_0xe72d('0x5'));var config=require(_0xe72d('0x6'));var attributes=require(_0xe72d('0x7'));module[_0xe72d('0x8')]=function(_0x440de2,_0x8cb051){return _0x440de2['define']('CmContactHasItem',attributes,{'tableName':_0xe72d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xacc3=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','cm_contact_has_items','lodash','util','api'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xacc3,0x1d1));var _0x3acc=function(_0x17e22e,_0x4fa092){_0x17e22e=_0x17e22e-0x0;var _0x4b0914=_0xacc3[_0x17e22e];return _0x4b0914;};'use strict';var _=require(_0x3acc('0x0'));var util=require(_0x3acc('0x1'));var logger=require('../../config/logger')(_0x3acc('0x2'));var moment=require(_0x3acc('0x3'));var BPromise=require(_0x3acc('0x4'));var rp=require(_0x3acc('0x5'));var fs=require('fs');var path=require(_0x3acc('0x6'));var rimraf=require(_0x3acc('0x7'));var config=require(_0x3acc('0x8'));var attributes=require('./cmContactHasItem.attributes');module[_0x3acc('0x9')]=function(_0x1135c5,_0x5ac136){return _0x1135c5[_0x3acc('0xa')]('CmContactHasItem',attributes,{'tableName':_0x3acc('0xb'),'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 e1b6f21..74efe3d 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 _0x548c=['../../config/environment','then','info','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x7f22d1,_0x2211b6){var _0xb152c5=function(_0x48047b){while(--_0x48047b){_0x7f22d1['push'](_0x7f22d1['shift']());}};_0xb152c5(++_0x2211b6);}(_0x548c,0x173));var _0xc548=function(_0x494d57,_0x188221){_0x494d57=_0x494d57-0x0;var _0x2661e5=_0x548c[_0x494d57];return _0x2661e5;};'use strict';var _=require(_0xc548('0x0'));var util=require(_0xc548('0x1'));var moment=require('moment');var BPromise=require(_0xc548('0x2'));var rs=require(_0xc548('0x3'));var fs=require('fs');var Redis=require(_0xc548('0x4'));var db=require(_0xc548('0x5'))['db'];var utils=require(_0xc548('0x6'));var logger=require(_0xc548('0x7'))(_0xc548('0x8'));var config=require(_0xc548('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2bcc3f,_0x2098ab,_0x121e70){return new BPromise(function(_0x2fdfb3,_0x28793e){return client['request'](_0x2bcc3f,_0x121e70)[_0xc548('0xa')](function(_0x450d12){logger[_0xc548('0xb')]('CmContactHasItem,\x20%s,\x20%s',_0x2098ab,_0xc548('0xc'));logger['debug'](_0xc548('0xd'),_0x2098ab,'request\x20sent',JSON[_0xc548('0xe')](_0x450d12));if(_0x450d12[_0xc548('0xf')]){if(_0x450d12[_0xc548('0xf')][_0xc548('0x10')]===0x1f4){logger[_0xc548('0xf')](_0xc548('0x11'),_0x2098ab,_0x450d12[_0xc548('0xf')][_0xc548('0x12')]);return _0x28793e(_0x450d12['error']['message']);}logger['error'](_0xc548('0x11'),_0x2098ab,_0x450d12[_0xc548('0xf')]['message']);return _0x2fdfb3(_0x450d12[_0xc548('0xf')]['message']);}else{logger[_0xc548('0xb')](_0xc548('0x11'),_0x2098ab,_0xc548('0xc'));_0x2fdfb3(_0x450d12['result'][_0xc548('0x12')]);}})[_0xc548('0x13')](function(_0x1ac603){logger[_0xc548('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0x2098ab,_0x1ac603);_0x28793e(_0x1ac603);});});} \ No newline at end of file +var _0x1b64=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','CmContactHasItem,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util'];(function(_0x1722ea,_0x4393a8){var _0x1665dc=function(_0xa537d4){while(--_0xa537d4){_0x1722ea['push'](_0x1722ea['shift']());}};_0x1665dc(++_0x4393a8);}(_0x1b64,0x7c));var _0x41b6=function(_0x17d7a9,_0x4a1b71){_0x17d7a9=_0x17d7a9-0x0;var _0x595f9c=_0x1b64[_0x17d7a9];return _0x595f9c;};'use strict';var _=require(_0x41b6('0x0'));var util=require(_0x41b6('0x1'));var moment=require(_0x41b6('0x2'));var BPromise=require(_0x41b6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x41b6('0x4'));var db=require(_0x41b6('0x5'))['db'];var utils=require(_0x41b6('0x6'));var logger=require(_0x41b6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x41b6('0x8'));var client=jayson[_0x41b6('0x9')][_0x41b6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2085bc,_0x5b7a5f,_0x5e1411){return new BPromise(function(_0x2ceddf,_0x34e1fe){return client[_0x41b6('0xb')](_0x2085bc,_0x5e1411)['then'](function(_0x1963a0){logger[_0x41b6('0xc')](_0x41b6('0xd'),_0x5b7a5f,'request\x20sent');logger[_0x41b6('0xe')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x5b7a5f,_0x41b6('0xf'),JSON[_0x41b6('0x10')](_0x1963a0));if(_0x1963a0[_0x41b6('0x11')]){if(_0x1963a0[_0x41b6('0x11')][_0x41b6('0x12')]===0x1f4){logger[_0x41b6('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x5b7a5f,_0x1963a0[_0x41b6('0x11')][_0x41b6('0x13')]);return _0x34e1fe(_0x1963a0['error']['message']);}logger[_0x41b6('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x5b7a5f,_0x1963a0[_0x41b6('0x11')][_0x41b6('0x13')]);return _0x2ceddf(_0x1963a0[_0x41b6('0x11')]['message']);}else{logger[_0x41b6('0xc')](_0x41b6('0xd'),_0x5b7a5f,_0x41b6('0xf'));_0x2ceddf(_0x1963a0['result'][_0x41b6('0x13')]);}})[_0x41b6('0x14')](function(_0x4ac968){logger[_0x41b6('0x11')](_0x41b6('0xd'),_0x5b7a5f,_0x4ac968);_0x34e1fe(_0x4ac968);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index d7fec93..59e001a 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 _0x2096=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','/:id','post','create','put','update','delete','destroy'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x2096,0x112));var _0x6209=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x2096[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x6209('0x0'));var util=require(_0x6209('0x1'));var path=require(_0x6209('0x2'));var timeout=require(_0x6209('0x3'));var express=require(_0x6209('0x4'));var router=express[_0x6209('0x5')]();var fs_extra=require(_0x6209('0x6'));var auth=require(_0x6209('0x7'));var interaction=require(_0x6209('0x8'));var config=require(_0x6209('0x9'));var controller=require(_0x6209('0xa'));router[_0x6209('0xb')]('/',auth[_0x6209('0xc')](),controller['index']);router[_0x6209('0xb')](_0x6209('0xd'),auth[_0x6209('0xc')](),controller['show']);router[_0x6209('0xe')]('/',auth['isAuthenticated'](),controller[_0x6209('0xf')]);router[_0x6209('0x10')](_0x6209('0xd'),auth['isAuthenticated'](),controller[_0x6209('0x11')]);router[_0x6209('0x12')](_0x6209('0xd'),auth[_0x6209('0xc')](),controller[_0x6209('0x13')]);module[_0x6209('0x14')]=router; \ No newline at end of file +var _0xc378=['index','get','/:id','post','put','isAuthenticated','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller'];(function(_0x38e0de,_0x132d49){var _0x1a906a=function(_0x45d5a0){while(--_0x45d5a0){_0x38e0de['push'](_0x38e0de['shift']());}};_0x1a906a(++_0x132d49);}(_0xc378,0x1c2));var _0x8c37=function(_0x31df6f,_0x380e73){_0x31df6f=_0x31df6f-0x0;var _0x31e353=_0xc378[_0x31df6f];return _0x31e353;};'use strict';var multer=require('multer');var util=require(_0x8c37('0x0'));var path=require(_0x8c37('0x1'));var timeout=require(_0x8c37('0x2'));var express=require(_0x8c37('0x3'));var router=express[_0x8c37('0x4')]();var fs_extra=require(_0x8c37('0x5'));var auth=require(_0x8c37('0x6'));var interaction=require(_0x8c37('0x7'));var config=require(_0x8c37('0x8'));var controller=require(_0x8c37('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8c37('0xa')]);router[_0x8c37('0xb')](_0x8c37('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x8c37('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8c37('0xe')](_0x8c37('0xc'),auth[_0x8c37('0xf')](),controller[_0x8c37('0x10')]);router[_0x8c37('0x11')]('/:id',auth[_0x8c37('0xf')](),controller[_0x8c37('0x12')]);module[_0x8c37('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 5771586..10db558 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 _0xccfc=['sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','long','type','parse','isArray','values','stringify','BOOLEAN','ENUM'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xccfc,0x1cb));var _0xcccf=function(_0x4b440e,_0x190138){_0x4b440e=_0x4b440e-0x0;var _0x5932c2=_0xccfc[_0x4b440e];return _0x5932c2;};'use strict';var Sequelize=require(_0xcccf('0x0'));var _=require(_0xcccf('0x1'));module[_0xcccf('0x2')]={'name':{'type':Sequelize[_0xcccf('0x3')],'get':function(_0x1bb8a){return this[_0xcccf('0x4')](_0xcccf('0x5'));}},'alias':{'type':Sequelize[_0xcccf('0x6')],'allowNull':![],'set':function(_0x342707){this[_0xcccf('0x7')](_0xcccf('0x5'),_0x342707?_0x342707:this[_0xcccf('0x4')](_0xcccf('0x8')));}},'type':{'type':Sequelize[_0xcccf('0x6')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xcccf('0x9')),'get':function(){if(this[_0xcccf('0x4')](_0xcccf('0xa'))==='select'){return JSON[_0xcccf('0xb')](this[_0xcccf('0x4')]('values'));}else{return this['getDataValue']('values');}},'set':function(_0x22a8f2){if(Array[_0xcccf('0xc')](_0x22a8f2)){this[_0xcccf('0x7')](_0xcccf('0xd'),JSON[_0xcccf('0xe')](_0x22a8f2));}else{this[_0xcccf('0x7')](_0xcccf('0xd'),_0x22a8f2);}}},'required':{'type':Sequelize[_0xcccf('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xcccf('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xcccf('0x10')]('voice')}}; \ No newline at end of file +var _0xd967=['TEXT','long','type','parse','values','stringify','BOOLEAN','ENUM','sequelize','lodash','exports','getDataValue','alias','setDataValue','STRING'];(function(_0x44afa4,_0x5be27b){var _0xcad289=function(_0x206272){while(--_0x206272){_0x44afa4['push'](_0x44afa4['shift']());}};_0xcad289(++_0x5be27b);}(_0xd967,0x1bb));var _0x7d96=function(_0x4a5494,_0x3ad336){_0x4a5494=_0x4a5494-0x0;var _0x57cbb5=_0xd967[_0x4a5494];return _0x57cbb5;};'use strict';var Sequelize=require(_0x7d96('0x0'));var _=require(_0x7d96('0x1'));module[_0x7d96('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x52943a){return this[_0x7d96('0x3')](_0x7d96('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x314c29){this[_0x7d96('0x5')](_0x7d96('0x4'),_0x314c29?_0x314c29:this[_0x7d96('0x3')]('name'));}},'type':{'type':Sequelize[_0x7d96('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x7d96('0x7')](_0x7d96('0x8')),'get':function(){if(this['getDataValue'](_0x7d96('0x9'))==='select'){return JSON[_0x7d96('0xa')](this[_0x7d96('0x3')](_0x7d96('0xb')));}else{return this[_0x7d96('0x3')](_0x7d96('0xb'));}},'set':function(_0x420a08){if(Array['isArray'](_0x420a08)){this[_0x7d96('0x5')](_0x7d96('0xb'),JSON[_0x7d96('0xc')](_0x420a08));}else{this[_0x7d96('0x5')]('values',_0x420a08);}}},'required':{'type':Sequelize[_0x7d96('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x7d96('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x7d96('0xe')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 6d541ca..c85b106 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 _0x5c36=['sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','intersection','length','find','catch','body','params','create','sequelize','transaction','TEXT','text','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','format','cf_%d','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../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','update','then','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','fields','hasOwnProperty','nolimit','order'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x5c36,0x1d1));var _0x65c3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5c36[_0x2641f9];return _0x585741;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x65c3('0x0'));var jsonpatch=require(_0x65c3('0x1'));var rp=require(_0x65c3('0x2'));var moment=require(_0x65c3('0x3'));var BPromise=require(_0x65c3('0x4'));var Mustache=require('mustache');var util=require(_0x65c3('0x5'));var path=require(_0x65c3('0x6'));var sox=require(_0x65c3('0x7'));var csv=require(_0x65c3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x65c3('0x9'));var squel=require(_0x65c3('0xa'));var crypto=require(_0x65c3('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x65c3('0x8'));var querystring=require(_0x65c3('0xc'));var Papa=require(_0x65c3('0xd'));var Redis=require(_0x65c3('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x65c3('0xf'));var as=require(_0x65c3('0x10'));var hardwareService=require(_0x65c3('0x11'));var logger=require(_0x65c3('0x12'))(_0x65c3('0x13'));var utils=require(_0x65c3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x65c3('0x15'));var db=require(_0x65c3('0x16'))['db'];function respondWithStatusCode(_0x349b03,_0x5afc37){_0x5afc37=_0x5afc37||0xcc;return function(_0x2f54ef){if(_0x2f54ef){return _0x349b03[_0x65c3('0x17')](_0x5afc37);}return _0x349b03[_0x65c3('0x18')](_0x5afc37)['end']();};}function respondWithResult(_0x223e29,_0x146db5){_0x146db5=_0x146db5||0xc8;return function(_0x2b2381){if(_0x2b2381){return _0x223e29['status'](_0x146db5)['json'](_0x2b2381);}};}function respondWithFilteredResult(_0x4712cf,_0x36fbf6){return function(_0x12be12){if(_0x12be12){var _0x4c9a7b=typeof _0x36fbf6[_0x65c3('0x19')]===_0x65c3('0x1a')&&typeof _0x36fbf6[_0x65c3('0x1b')]===_0x65c3('0x1a');var _0x5efdea=_0x12be12[_0x65c3('0x1c')];var _0x2a7bc1=_0x4c9a7b?0x0:_0x36fbf6[_0x65c3('0x19')];var _0x266847=_0x4c9a7b?_0x12be12['count']:_0x36fbf6['offset']+_0x36fbf6[_0x65c3('0x1b')];var _0x31670e;if(_0x266847>=_0x5efdea){_0x266847=_0x5efdea;_0x31670e=0xc8;}else{_0x31670e=0xce;}_0x4712cf[_0x65c3('0x18')](_0x31670e);return _0x4712cf[_0x65c3('0x1d')](_0x65c3('0x1e'),_0x2a7bc1+'-'+_0x266847+'/'+_0x5efdea)[_0x65c3('0x1f')](_0x12be12);}return null;};}function patchUpdates(_0x582bac){return function(_0x1ff354){try{jsonpatch[_0x65c3('0x20')](_0x1ff354,_0x582bac,!![]);}catch(_0x4ac1b4){return BPromise[_0x65c3('0x21')](_0x4ac1b4);}return _0x1ff354['save']();};}function saveUpdates(_0x2a256d,_0x5fd38){return function(_0x41f969){if(_0x41f969){return _0x41f969[_0x65c3('0x22')](_0x2a256d)[_0x65c3('0x23')](function(_0x191ce2){return _0x191ce2;});}return null;};}function removeEntity(_0x233fe1,_0x3488a1){return function(_0x578bb3){if(_0x578bb3){return _0x578bb3[_0x65c3('0x24')]()[_0x65c3('0x23')](function(){_0x233fe1[_0x65c3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x264647,_0x2ac060){return function(_0x3d7b49){if(!_0x3d7b49){_0x264647[_0x65c3('0x17')](0x194);}return _0x3d7b49;};}function handleError(_0x2cedc9,_0x396ca5){_0x396ca5=_0x396ca5||0x1f4;return function(_0x1c191e){logger[_0x65c3('0x25')](_0x1c191e[_0x65c3('0x26')]);if(_0x1c191e[_0x65c3('0x27')]){delete _0x1c191e[_0x65c3('0x27')];}_0x2cedc9[_0x65c3('0x18')](_0x396ca5)[_0x65c3('0x28')](_0x1c191e);};}exports[_0x65c3('0x29')]=function(_0x12efa7,_0x55e38c){var _0x5e97bc={},_0x3c5571={},_0x18945a={'count':0x0,'rows':[]};var _0xb04283=_[_0x65c3('0x2a')](db[_0x65c3('0x2b')][_0x65c3('0x2c')],function(_0x32f340){return{'name':_0x32f340[_0x65c3('0x2d')],'type':_0x32f340[_0x65c3('0x2e')][_0x65c3('0x2f')]};});_0x3c5571['model']=_['differenceBy'](_['map'](_0xb04283,_0x65c3('0x27')),[_0x65c3('0x27')]);_0x3c5571['query']=_[_0x65c3('0x30')](_0x12efa7[_0x65c3('0x31')]);_0x3c5571[_0x65c3('0x32')]=_['intersection'](_0x3c5571[_0x65c3('0x33')],_0x3c5571[_0x65c3('0x31')]);_0x5e97bc[_0x65c3('0x34')]=_['intersection'](_0x3c5571[_0x65c3('0x33')],qs[_0x65c3('0x35')](_0x12efa7[_0x65c3('0x31')][_0x65c3('0x35')]));_0x5e97bc[_0x65c3('0x34')]=_0x5e97bc[_0x65c3('0x34')]['length']?_0x5e97bc[_0x65c3('0x34')]:_0x3c5571[_0x65c3('0x33')];if(!_0x12efa7[_0x65c3('0x31')][_0x65c3('0x36')](_0x65c3('0x37'))){_0x5e97bc['limit']=qs[_0x65c3('0x1b')](_0x12efa7[_0x65c3('0x31')][_0x65c3('0x1b')]);_0x5e97bc[_0x65c3('0x19')]=qs[_0x65c3('0x19')](_0x12efa7['query']['offset']);}_0x5e97bc[_0x65c3('0x38')]=qs[_0x65c3('0x39')](_0x12efa7[_0x65c3('0x31')][_0x65c3('0x39')]);_0x5e97bc[_0x65c3('0x3a')]=qs[_0x65c3('0x32')](_[_0x65c3('0x3b')](_0x12efa7[_0x65c3('0x31')],_0x3c5571[_0x65c3('0x32')]),_0xb04283);if(_0x12efa7[_0x65c3('0x31')][_0x65c3('0x3c')]){_0x5e97bc['where']=_['merge'](_0x5e97bc['where'],{'$or':_['map'](_0xb04283,function(_0x1fc713){if(_0x1fc713[_0x65c3('0x2e')]!==_0x65c3('0x3d')){var _0x5515e0={};_0x5515e0[_0x1fc713[_0x65c3('0x27')]]={'$like':'%'+_0x12efa7[_0x65c3('0x31')][_0x65c3('0x3c')]+'%'};return _0x5515e0;}})});}_0x5e97bc=_[_0x65c3('0x3e')]({},_0x5e97bc,_0x12efa7[_0x65c3('0x3f')]);var _0x1800af={'where':_0x5e97bc[_0x65c3('0x3a')]};return db['CmCustomField'][_0x65c3('0x1c')](_0x1800af)[_0x65c3('0x23')](function(_0x538bc1){_0x18945a[_0x65c3('0x1c')]=_0x538bc1;if(_0x12efa7['query'][_0x65c3('0x40')]){_0x5e97bc[_0x65c3('0x41')]=[{'all':!![]}];}return db[_0x65c3('0x2b')]['findAll'](_0x5e97bc);})[_0x65c3('0x23')](function(_0x19791d){_0x18945a['rows']=_0x19791d;return _0x18945a;})['then'](respondWithFilteredResult(_0x55e38c,_0x5e97bc))['catch'](handleError(_0x55e38c,null));};exports['show']=function(_0x22c0a6,_0x3237ed){var _0x241769={'raw':!![],'where':{'id':_0x22c0a6['params']['id']}},_0x5968ed={};_0x5968ed[_0x65c3('0x33')]=_[_0x65c3('0x30')](db['CmCustomField'][_0x65c3('0x2c')]);_0x5968ed[_0x65c3('0x31')]=_['keys'](_0x22c0a6[_0x65c3('0x31')]);_0x5968ed['filters']=_[_0x65c3('0x42')](_0x5968ed['model'],_0x5968ed[_0x65c3('0x31')]);_0x241769['attributes']=_['intersection'](_0x5968ed[_0x65c3('0x33')],qs['fields'](_0x22c0a6[_0x65c3('0x31')][_0x65c3('0x35')]));_0x241769[_0x65c3('0x34')]=_0x241769['attributes'][_0x65c3('0x43')]?_0x241769[_0x65c3('0x34')]:_0x5968ed[_0x65c3('0x33')];if(_0x22c0a6['query'][_0x65c3('0x40')]){_0x241769[_0x65c3('0x41')]=[{'all':!![]}];}_0x241769=_[_0x65c3('0x3e')]({},_0x241769,_0x22c0a6[_0x65c3('0x3f')]);return db[_0x65c3('0x2b')][_0x65c3('0x44')](_0x241769)[_0x65c3('0x23')](handleEntityNotFound(_0x3237ed,null))['then'](respondWithResult(_0x3237ed,null))[_0x65c3('0x45')](handleError(_0x3237ed,null));};exports[_0x65c3('0x22')]=function(_0x56777a,_0x48d78a){if(_0x56777a[_0x65c3('0x46')]['id']){delete _0x56777a[_0x65c3('0x46')]['id'];}return db[_0x65c3('0x2b')][_0x65c3('0x44')]({'where':{'id':_0x56777a[_0x65c3('0x47')]['id']}})['then'](handleEntityNotFound(_0x48d78a,null))[_0x65c3('0x23')](saveUpdates(_0x56777a[_0x65c3('0x46')],null))['then'](respondWithResult(_0x48d78a,null))[_0x65c3('0x45')](handleError(_0x48d78a,null));};exports['destroy']=function(_0x3ae192,_0x278825){return db[_0x65c3('0x2b')][_0x65c3('0x44')]({'where':{'id':_0x3ae192[_0x65c3('0x47')]['id']}})[_0x65c3('0x23')](handleEntityNotFound(_0x278825,null))[_0x65c3('0x23')](removeEntity(_0x278825,null))[_0x65c3('0x45')](handleError(_0x278825,null));};exports[_0x65c3('0x48')]=function(_0x1f5dd6,_0x5d76d1){var _0x155151;return db[_0x65c3('0x49')][_0x65c3('0x4a')](function(_0x43182b){return db[_0x65c3('0x2b')][_0x65c3('0x48')](_0x1f5dd6[_0x65c3('0x46')],{'transaction':_0x43182b})[_0x65c3('0x23')](function(_0x74d18f){_0x155151=_0x74d18f;var _0x58ab7a={'type':db['Sequelize'][_0x65c3('0x4b')],'transaction':_0x43182b};switch(_0x1f5dd6[_0x65c3('0x46')][_0x65c3('0x2e')]){case _0x65c3('0x4c'):_0x58ab7a[_0x65c3('0x2e')]=db[_0x65c3('0x4d')][_0x65c3('0x4b')];break;case _0x65c3('0x4e'):_0x58ab7a[_0x65c3('0x2e')]=db[_0x65c3('0x4d')][_0x65c3('0x4f')];break;case _0x65c3('0x50'):_0x58ab7a[_0x65c3('0x2e')]=db['Sequelize'][_0x65c3('0x51')];_0x58ab7a[_0x65c3('0x52')]=![];break;default:}return db[_0x65c3('0x49')][_0x65c3('0x53')]['addColumn'](_0x65c3('0x54'),util[_0x65c3('0x55')](_0x65c3('0x56'),_0x155151['id']),_0x58ab7a);})[_0x65c3('0x23')](function(){return _0x155151;});})[_0x65c3('0x23')](respondWithResult(_0x5d76d1,0xc9))[_0x65c3('0x45')](handleError(_0x5d76d1,null));}; \ No newline at end of file +var _0x55e5=['stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','model','differenceBy','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','body','find','transaction','TEXT','text','Sequelize','INTEGER','switch','defaultValue','sequelize','addColumn','format','cf_%d','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','end','error'];(function(_0x286749,_0x5e4a13){var _0x78e0cb=function(_0x4c9acf){while(--_0x4c9acf){_0x286749['push'](_0x286749['shift']());}};_0x78e0cb(++_0x5e4a13);}(_0x55e5,0xe1));var _0x555e=function(_0x4371f9,_0x1ccee6){_0x4371f9=_0x4371f9-0x0;var _0x3c4ca5=_0x55e5[_0x4371f9];return _0x3c4ca5;};'use strict';var emlformat=require(_0x555e('0x0'));var rimraf=require(_0x555e('0x1'));var zipdir=require(_0x555e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x555e('0x3'));var BPromise=require(_0x555e('0x4'));var Mustache=require('mustache');var util=require(_0x555e('0x5'));var path=require(_0x555e('0x6'));var sox=require('sox');var csv=require(_0x555e('0x7'));var ejs=require(_0x555e('0x8'));var fs=require('fs');var fs_extra=require(_0x555e('0x9'));var _=require(_0x555e('0xa'));var squel=require(_0x555e('0xb'));var crypto=require(_0x555e('0xc'));var jsforce=require(_0x555e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x555e('0x7'));var querystring=require(_0x555e('0xe'));var Papa=require(_0x555e('0xf'));var Redis=require('ioredis');var authService=require(_0x555e('0x10'));var qs=require(_0x555e('0x11'));var as=require(_0x555e('0x12'));var hardwareService=require(_0x555e('0x13'));var logger=require(_0x555e('0x14'))(_0x555e('0x15'));var utils=require(_0x555e('0x16'));var config=require(_0x555e('0x17'));var licenseUtil=require(_0x555e('0x18'));var db=require(_0x555e('0x19'))['db'];function respondWithStatusCode(_0x4bab5a,_0x170b29){_0x170b29=_0x170b29||0xcc;return function(_0x1ac745){if(_0x1ac745){return _0x4bab5a[_0x555e('0x1a')](_0x170b29);}return _0x4bab5a[_0x555e('0x1b')](_0x170b29)['end']();};}function respondWithResult(_0x3d52ba,_0x31ddf7){_0x31ddf7=_0x31ddf7||0xc8;return function(_0x5a0fea){if(_0x5a0fea){return _0x3d52ba[_0x555e('0x1b')](_0x31ddf7)[_0x555e('0x1c')](_0x5a0fea);}};}function respondWithFilteredResult(_0x50ea99,_0x3f2d6b){return function(_0x5aeabf){if(_0x5aeabf){var _0x55924a=typeof _0x3f2d6b[_0x555e('0x1d')]===_0x555e('0x1e')&&typeof _0x3f2d6b['limit']==='undefined';var _0x13a7f2=_0x5aeabf[_0x555e('0x1f')];var _0x541012=_0x55924a?0x0:_0x3f2d6b['offset'];var _0x306317=_0x55924a?_0x5aeabf[_0x555e('0x1f')]:_0x3f2d6b['offset']+_0x3f2d6b[_0x555e('0x20')];var _0x36a3c3;if(_0x306317>=_0x13a7f2){_0x306317=_0x13a7f2;_0x36a3c3=0xc8;}else{_0x36a3c3=0xce;}_0x50ea99[_0x555e('0x1b')](_0x36a3c3);return _0x50ea99[_0x555e('0x21')](_0x555e('0x22'),_0x541012+'-'+_0x306317+'/'+_0x13a7f2)[_0x555e('0x1c')](_0x5aeabf);}return null;};}function patchUpdates(_0x4135dd){return function(_0x4d9026){try{jsonpatch['apply'](_0x4d9026,_0x4135dd,!![]);}catch(_0x2abf05){return BPromise[_0x555e('0x23')](_0x2abf05);}return _0x4d9026[_0x555e('0x24')]();};}function saveUpdates(_0x5626c0,_0x3063da){return function(_0x55efc7){if(_0x55efc7){return _0x55efc7[_0x555e('0x25')](_0x5626c0)[_0x555e('0x26')](function(_0x4627b3){return _0x4627b3;});}return null;};}function removeEntity(_0x107d2a,_0x6ce9f9){return function(_0xcaa184){if(_0xcaa184){return _0xcaa184[_0x555e('0x27')]()['then'](function(){_0x107d2a[_0x555e('0x1b')](0xcc)[_0x555e('0x28')]();});}};}function handleEntityNotFound(_0x18b609,_0x3fb43d){return function(_0x4999ad){if(!_0x4999ad){_0x18b609[_0x555e('0x1a')](0x194);}return _0x4999ad;};}function handleError(_0x2926ba,_0x3e8a15){_0x3e8a15=_0x3e8a15||0x1f4;return function(_0x245c9e){logger[_0x555e('0x29')](_0x245c9e[_0x555e('0x2a')]);if(_0x245c9e[_0x555e('0x2b')]){delete _0x245c9e[_0x555e('0x2b')];}_0x2926ba['status'](_0x3e8a15)[_0x555e('0x2c')](_0x245c9e);};}exports[_0x555e('0x2d')]=function(_0x429de3,_0x178c8b){var _0x31640c={},_0x41197b={},_0x444c86={'count':0x0,'rows':[]};var _0x5cee53=_[_0x555e('0x2e')](db[_0x555e('0x2f')][_0x555e('0x30')],function(_0xd3594a){return{'name':_0xd3594a[_0x555e('0x31')],'type':_0xd3594a[_0x555e('0x32')]['key']};});_0x41197b[_0x555e('0x33')]=_[_0x555e('0x34')](_[_0x555e('0x2e')](_0x5cee53,_0x555e('0x2b')),[_0x555e('0x2b')]);_0x41197b[_0x555e('0x35')]=_[_0x555e('0x36')](_0x429de3[_0x555e('0x35')]);_0x41197b['filters']=_['intersection'](_0x41197b[_0x555e('0x33')],_0x41197b[_0x555e('0x35')]);_0x31640c[_0x555e('0x37')]=_[_0x555e('0x38')](_0x41197b[_0x555e('0x33')],qs['fields'](_0x429de3[_0x555e('0x35')][_0x555e('0x39')]));_0x31640c['attributes']=_0x31640c[_0x555e('0x37')][_0x555e('0x3a')]?_0x31640c[_0x555e('0x37')]:_0x41197b[_0x555e('0x33')];if(!_0x429de3['query'][_0x555e('0x3b')](_0x555e('0x3c'))){_0x31640c[_0x555e('0x20')]=qs[_0x555e('0x20')](_0x429de3[_0x555e('0x35')][_0x555e('0x20')]);_0x31640c['offset']=qs[_0x555e('0x1d')](_0x429de3[_0x555e('0x35')]['offset']);}_0x31640c[_0x555e('0x3d')]=qs[_0x555e('0x3e')](_0x429de3[_0x555e('0x35')][_0x555e('0x3e')]);_0x31640c['where']=qs[_0x555e('0x3f')](_['pick'](_0x429de3[_0x555e('0x35')],_0x41197b[_0x555e('0x3f')]),_0x5cee53);if(_0x429de3[_0x555e('0x35')][_0x555e('0x40')]){_0x31640c[_0x555e('0x41')]=_[_0x555e('0x42')](_0x31640c[_0x555e('0x41')],{'$or':_[_0x555e('0x2e')](_0x5cee53,function(_0x175b53){if(_0x175b53[_0x555e('0x32')]!==_0x555e('0x43')){var _0x23a059={};_0x23a059[_0x175b53[_0x555e('0x2b')]]={'$like':'%'+_0x429de3[_0x555e('0x35')][_0x555e('0x40')]+'%'};return _0x23a059;}})});}_0x31640c=_[_0x555e('0x42')]({},_0x31640c,_0x429de3[_0x555e('0x44')]);var _0x370135={'where':_0x31640c[_0x555e('0x41')]};return db[_0x555e('0x2f')][_0x555e('0x1f')](_0x370135)['then'](function(_0x5ba9a6){_0x444c86[_0x555e('0x1f')]=_0x5ba9a6;if(_0x429de3['query'][_0x555e('0x45')]){_0x31640c[_0x555e('0x46')]=[{'all':!![]}];}return db[_0x555e('0x2f')][_0x555e('0x47')](_0x31640c);})['then'](function(_0x2304a8){_0x444c86[_0x555e('0x48')]=_0x2304a8;return _0x444c86;})['then'](respondWithFilteredResult(_0x178c8b,_0x31640c))[_0x555e('0x49')](handleError(_0x178c8b,null));};exports[_0x555e('0x4a')]=function(_0x27fd89,_0x5c6ed6){var _0x217dcb={'raw':!![],'where':{'id':_0x27fd89[_0x555e('0x4b')]['id']}},_0x57d805={};_0x57d805[_0x555e('0x33')]=_[_0x555e('0x36')](db['CmCustomField'][_0x555e('0x30')]);_0x57d805[_0x555e('0x35')]=_['keys'](_0x27fd89[_0x555e('0x35')]);_0x57d805[_0x555e('0x3f')]=_[_0x555e('0x38')](_0x57d805[_0x555e('0x33')],_0x57d805[_0x555e('0x35')]);_0x217dcb[_0x555e('0x37')]=_['intersection'](_0x57d805[_0x555e('0x33')],qs[_0x555e('0x39')](_0x27fd89[_0x555e('0x35')][_0x555e('0x39')]));_0x217dcb[_0x555e('0x37')]=_0x217dcb[_0x555e('0x37')]['length']?_0x217dcb[_0x555e('0x37')]:_0x57d805['model'];if(_0x27fd89[_0x555e('0x35')][_0x555e('0x45')]){_0x217dcb[_0x555e('0x46')]=[{'all':!![]}];}_0x217dcb=_['merge']({},_0x217dcb,_0x27fd89[_0x555e('0x44')]);return db[_0x555e('0x2f')]['find'](_0x217dcb)[_0x555e('0x26')](handleEntityNotFound(_0x5c6ed6,null))[_0x555e('0x26')](respondWithResult(_0x5c6ed6,null))[_0x555e('0x49')](handleError(_0x5c6ed6,null));};exports[_0x555e('0x25')]=function(_0x38ebdb,_0xac4c0c){if(_0x38ebdb[_0x555e('0x4c')]['id']){delete _0x38ebdb[_0x555e('0x4c')]['id'];}return db[_0x555e('0x2f')][_0x555e('0x4d')]({'where':{'id':_0x38ebdb[_0x555e('0x4b')]['id']}})[_0x555e('0x26')](handleEntityNotFound(_0xac4c0c,null))['then'](saveUpdates(_0x38ebdb[_0x555e('0x4c')],null))['then'](respondWithResult(_0xac4c0c,null))['catch'](handleError(_0xac4c0c,null));};exports[_0x555e('0x27')]=function(_0x469652,_0x3f745a){return db['CmCustomField'][_0x555e('0x4d')]({'where':{'id':_0x469652[_0x555e('0x4b')]['id']}})[_0x555e('0x26')](handleEntityNotFound(_0x3f745a,null))[_0x555e('0x26')](removeEntity(_0x3f745a,null))[_0x555e('0x49')](handleError(_0x3f745a,null));};exports['create']=function(_0x27d525,_0x3c0fcc){var _0x476706;return db['sequelize'][_0x555e('0x4e')](function(_0x5281ec){return db['CmCustomField']['create'](_0x27d525[_0x555e('0x4c')],{'transaction':_0x5281ec})[_0x555e('0x26')](function(_0x54e34a){_0x476706=_0x54e34a;var _0x12a0dc={'type':db['Sequelize'][_0x555e('0x4f')],'transaction':_0x5281ec};switch(_0x27d525[_0x555e('0x4c')][_0x555e('0x32')]){case _0x555e('0x50'):_0x12a0dc['type']=db[_0x555e('0x51')][_0x555e('0x4f')];break;case'number':_0x12a0dc[_0x555e('0x32')]=db[_0x555e('0x51')][_0x555e('0x52')];break;case _0x555e('0x53'):_0x12a0dc['type']=db[_0x555e('0x51')]['BOOLEAN'];_0x12a0dc[_0x555e('0x54')]=![];break;default:}return db[_0x555e('0x55')]['queryInterface'][_0x555e('0x56')]('cm_contacts',util[_0x555e('0x57')](_0x555e('0x58'),_0x476706['id']),_0x12a0dc);})[_0x555e('0x26')](function(){return _0x476706;});})[_0x555e('0x26')](respondWithResult(_0x3c0fcc,0xc9))[_0x555e('0x49')](handleError(_0x3c0fcc,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 3e031d3..7dd2748 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 _0x3060=['cm_custom_fields','util','../../config/logger','api','bluebird','path','rimraf','exports','define','CmCustomField'];(function(_0x27604f,_0x5ae336){var _0x40d189=function(_0xebacde){while(--_0xebacde){_0x27604f['push'](_0x27604f['shift']());}};_0x40d189(++_0x5ae336);}(_0x3060,0x17d));var _0x0306=function(_0x8036e9,_0xb2a199){_0x8036e9=_0x8036e9-0x0;var _0x34a8eb=_0x3060[_0x8036e9];return _0x34a8eb;};'use strict';var _=require('lodash');var util=require(_0x0306('0x0'));var logger=require(_0x0306('0x1'))(_0x0306('0x2'));var moment=require('moment');var BPromise=require(_0x0306('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0306('0x4'));var rimraf=require(_0x0306('0x5'));var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module[_0x0306('0x6')]=function(_0x4e2dd5,_0x337217){return _0x4e2dd5[_0x0306('0x7')](_0x0306('0x8'),attributes,{'tableName':_0x0306('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f76=['CmCustomField','cm_custom_fields','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define'];(function(_0x48271f,_0xc4f6d3){var _0x13eb5c=function(_0x1a4acd){while(--_0x1a4acd){_0x48271f['push'](_0x48271f['shift']());}};_0x13eb5c(++_0xc4f6d3);}(_0x1f76,0x1d6));var _0x61f7=function(_0x3c6c2a,_0x28ef97){_0x3c6c2a=_0x3c6c2a-0x0;var _0x3c3ac9=_0x1f76[_0x3c6c2a];return _0x3c3ac9;};'use strict';var _=require(_0x61f7('0x0'));var util=require(_0x61f7('0x1'));var logger=require('../../config/logger')(_0x61f7('0x2'));var moment=require('moment');var BPromise=require(_0x61f7('0x3'));var rp=require(_0x61f7('0x4'));var fs=require('fs');var path=require(_0x61f7('0x5'));var rimraf=require(_0x61f7('0x6'));var config=require(_0x61f7('0x7'));var attributes=require(_0x61f7('0x8'));module[_0x61f7('0x9')]=function(_0x4eb26c,_0x7aa15b){return _0x4eb26c[_0x61f7('0xa')](_0x61f7('0xb'),attributes,{'tableName':_0x61f7('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 715d1a8..2e30210 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 _0x1ee1=['http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2bb86b,_0x32d63){var _0x3c8c9a=function(_0x551de8){while(--_0x551de8){_0x2bb86b['push'](_0x2bb86b['shift']());}};_0x3c8c9a(++_0x32d63);}(_0x1ee1,0xa6));var _0x11ee=function(_0x341e0f,_0xadbb66){_0x341e0f=_0x341e0f-0x0;var _0x5962c1=_0x1ee1[_0x341e0f];return _0x5962c1;};'use strict';var _=require('lodash');var util=require(_0x11ee('0x0'));var moment=require('moment');var BPromise=require(_0x11ee('0x1'));var rs=require(_0x11ee('0x2'));var fs=require('fs');var Redis=require(_0x11ee('0x3'));var db=require(_0x11ee('0x4'))['db'];var utils=require(_0x11ee('0x5'));var logger=require(_0x11ee('0x6'))(_0x11ee('0x7'));var config=require(_0x11ee('0x8'));var jayson=require(_0x11ee('0x9'));var client=jayson['client'][_0x11ee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58c513,_0x53d6ed,_0x5b1222){return new BPromise(function(_0xd307a5,_0x5844ac){return client[_0x11ee('0xb')](_0x58c513,_0x5b1222)[_0x11ee('0xc')](function(_0x28ba02){logger[_0x11ee('0xd')](_0x11ee('0xe'),_0x53d6ed,_0x11ee('0xf'));logger[_0x11ee('0x10')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x53d6ed,'request\x20sent',JSON[_0x11ee('0x11')](_0x28ba02));if(_0x28ba02['error']){if(_0x28ba02[_0x11ee('0x12')][_0x11ee('0x13')]===0x1f4){logger[_0x11ee('0x12')](_0x11ee('0xe'),_0x53d6ed,_0x28ba02[_0x11ee('0x12')][_0x11ee('0x14')]);return _0x5844ac(_0x28ba02['error'][_0x11ee('0x14')]);}logger[_0x11ee('0x12')](_0x11ee('0xe'),_0x53d6ed,_0x28ba02[_0x11ee('0x12')]['message']);return _0xd307a5(_0x28ba02[_0x11ee('0x12')]['message']);}else{logger[_0x11ee('0xd')]('CmCustomField,\x20%s,\x20%s',_0x53d6ed,_0x11ee('0xf'));_0xd307a5(_0x28ba02[_0x11ee('0x15')][_0x11ee('0x14')]);}})['catch'](function(_0x169faa){logger['error'](_0x11ee('0xe'),_0x53d6ed,_0x169faa);_0x5844ac(_0x169faa);});});} \ No newline at end of file +var _0xa7c8=['http','request','then','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x24d629,_0x9e418c){var _0x2728fd=function(_0x4469fa){while(--_0x4469fa){_0x24d629['push'](_0x24d629['shift']());}};_0x2728fd(++_0x9e418c);}(_0xa7c8,0xa8));var _0x8a7c=function(_0x1f7d6c,_0x512583){_0x1f7d6c=_0x1f7d6c-0x0;var _0x5e0321=_0xa7c8[_0x1f7d6c];return _0x5e0321;};'use strict';var _=require(_0x8a7c('0x0'));var util=require('util');var moment=require(_0x8a7c('0x1'));var BPromise=require(_0x8a7c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8a7c('0x3'));var logger=require(_0x8a7c('0x4'))(_0x8a7c('0x5'));var config=require(_0x8a7c('0x6'));var jayson=require(_0x8a7c('0x7'));var client=jayson['client'][_0x8a7c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x503b55,_0x44cc5f,_0x57e454){return new BPromise(function(_0x5c2a3a,_0x5b105b){return client[_0x8a7c('0x9')](_0x503b55,_0x57e454)[_0x8a7c('0xa')](function(_0x39c39e){logger[_0x8a7c('0xb')](_0x8a7c('0xc'),_0x44cc5f,'request\x20sent');logger[_0x8a7c('0xd')](_0x8a7c('0xe'),_0x44cc5f,_0x8a7c('0xf'),JSON[_0x8a7c('0x10')](_0x39c39e));if(_0x39c39e[_0x8a7c('0x11')]){if(_0x39c39e['error'][_0x8a7c('0x12')]===0x1f4){logger[_0x8a7c('0x11')](_0x8a7c('0xc'),_0x44cc5f,_0x39c39e['error'][_0x8a7c('0x13')]);return _0x5b105b(_0x39c39e[_0x8a7c('0x11')][_0x8a7c('0x13')]);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x44cc5f,_0x39c39e['error'][_0x8a7c('0x13')]);return _0x5c2a3a(_0x39c39e[_0x8a7c('0x11')]['message']);}else{logger[_0x8a7c('0xb')](_0x8a7c('0xc'),_0x44cc5f,_0x8a7c('0xf'));_0x5c2a3a(_0x39c39e[_0x8a7c('0x14')]['message']);}})[_0x8a7c('0x15')](function(_0x308026){logger[_0x8a7c('0x11')](_0x8a7c('0xc'),_0x44cc5f,_0x308026);_0x5b105b(_0x308026);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 0a60f49..f2cec97 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 _0x7163=['../../components/interaction/service','../../config/environment','./cmCustomField.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service'];(function(_0x36de10,_0xfe25e8){var _0x58100f=function(_0x1fee3f){while(--_0x1fee3f){_0x36de10['push'](_0x36de10['shift']());}};_0x58100f(++_0xfe25e8);}(_0x7163,0x1ef));var _0x3716=function(_0x54defc,_0x627178){_0x54defc=_0x54defc-0x0;var _0x1955d3=_0x7163[_0x54defc];return _0x1955d3;};'use strict';var multer=require(_0x3716('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3716('0x1'));var express=require(_0x3716('0x2'));var router=express[_0x3716('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3716('0x4'));var interaction=require(_0x3716('0x5'));var config=require(_0x3716('0x6'));var controller=require(_0x3716('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x3716('0x8')]);router[_0x3716('0x9')](_0x3716('0xa'),auth[_0x3716('0xb')](),controller[_0x3716('0xc')]);router[_0x3716('0xd')]('/',auth[_0x3716('0xb')](),controller[_0x3716('0xe')]);router[_0x3716('0xf')](_0x3716('0xa'),auth[_0x3716('0xb')](),controller[_0x3716('0x10')]);router[_0x3716('0x11')](_0x3716('0xa'),auth[_0x3716('0xb')](),controller[_0x3716('0x12')]);module[_0x3716('0x13')]=router; \ No newline at end of file +var _0x120b=['./cmCustomField.controller','get','isAuthenticated','index','/:id','show','create','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1b1948,_0x49f451){var _0x3cbd38=function(_0x2ca4f2){while(--_0x2ca4f2){_0x1b1948['push'](_0x1b1948['shift']());}};_0x3cbd38(++_0x49f451);}(_0x120b,0x8f));var _0xb120=function(_0x22d984,_0x114eab){_0x22d984=_0x22d984-0x0;var _0x420991=_0x120b[_0x22d984];return _0x420991;};'use strict';var multer=require(_0xb120('0x0'));var util=require(_0xb120('0x1'));var path=require('path');var timeout=require(_0xb120('0x2'));var express=require(_0xb120('0x3'));var router=express[_0xb120('0x4')]();var fs_extra=require(_0xb120('0x5'));var auth=require(_0xb120('0x6'));var interaction=require(_0xb120('0x7'));var config=require(_0xb120('0x8'));var controller=require(_0xb120('0x9'));router[_0xb120('0xa')]('/',auth[_0xb120('0xb')](),controller[_0xb120('0xc')]);router['get'](_0xb120('0xd'),auth[_0xb120('0xb')](),controller[_0xb120('0xe')]);router['post']('/',auth[_0xb120('0xb')](),controller[_0xb120('0xf')]);router['put']('/:id',auth[_0xb120('0xb')](),controller[_0xb120('0x10')]);router[_0xb120('0x11')](_0xb120('0xd'),auth[_0xb120('0xb')](),controller[_0xb120('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index ddb997e..b5c50a6 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 _0xa296=['sequelize','exports','DATE','format','INTEGER','BOOLEAN','UNSIGNED','contactListQueue','STRING','moment'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0xa296,0xc7));var _0x6a29=function(_0x3c60fc,_0x593ef5){_0x3c60fc=_0x3c60fc-0x0;var _0x495fd2=_0xa296[_0x3c60fc];return _0x495fd2;};'use strict';var moment=require(_0x6a29('0x0'));var Sequelize=require(_0x6a29('0x1'));module[_0x6a29('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x6a29('0x3')],'defaultValue':moment()[_0x6a29('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x6a29('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6a29('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6a29('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x6a29('0x6')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6a29('0x3')]},'priority':{'type':Sequelize[_0x6a29('0x5')](0x2)[_0x6a29('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x6a29('0x5')],'unique':_0x6a29('0x8')},'ListId':{'type':Sequelize[_0x6a29('0x5')],'unique':_0x6a29('0x8')},'UserId':{'type':Sequelize[_0x6a29('0x5')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x6a29('0x8')},'CampaignId':{'type':Sequelize[_0x6a29('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x6a29('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6a29('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6a29('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6a29('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x6a29('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x6a29('0x9')]},'recallmeNotifiedDate':{'type':Sequelize[_0x6a29('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xcecd=['exports','BOOLEAN','DATE','INTEGER','UNSIGNED','contactListQueue','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcecd,0x8c));var _0xdcec=function(_0x16ac49,_0x5bcd1b){_0x16ac49=_0x16ac49-0x0;var _0x5b297a=_0xcecd[_0x16ac49];return _0x5b297a;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xdcec('0x0')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xdcec('0x1')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xdcec('0x2')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xdcec('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xdcec('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xdcec('0x3')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xdcec('0x1')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xdcec('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xdcec('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xdcec('0x3')],'unique':_0xdcec('0x5')},'ListId':{'type':Sequelize[_0xdcec('0x3')],'unique':_0xdcec('0x5')},'UserId':{'type':Sequelize[_0xdcec('0x3')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xdcec('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xdcec('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xdcec('0x3')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xdcec('0x3')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xdcec('0x6')]},'recallmeNotifiedDate':{'type':Sequelize[_0xdcec('0x2')],'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 177997a..f32a2b3 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 _0xe198=['key','model','query','keys','filters','intersection','concat','$or','$gt','$gte','$lte','$ne','$eq','$not','$between','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$any','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','catch','show','length','includeAll','include','find','create','body','update','describe','destroy','params','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','format','calleridnum','campaigntype','queue','ivr','CmContact','ContactId','firstName','isNil','lastName','calleridname','finally','CmHopperAdditionalPhone','end','preview','dialOrderByScheduledAt','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','direction','prev','isEmpty','hopperIds','priority','DESC','ASC','literal','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','phone','recallme','LOCK','UPDATE','Contact','CmCompany','Company','List','Queue','getPreviewRecall','CmList','dialActive','getOpenContacts','getVoiceQueues','outbound','CmHopper,\x20%s,\x20%s,\x20%s','getTimezones','push','utcOffset','getTimezone','moment','lodash','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','then','sendStatus','error','name','send','index','map','CmHopper','rawAttributes','fieldName','type'];(function(_0x460fd7,_0x2012db){var _0x44d1c2=function(_0x545e11){while(--_0x545e11){_0x460fd7['push'](_0x460fd7['shift']());}};_0x44d1c2(++_0x2012db);}(_0xe198,0x6f));var _0x8e19=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xe198[_0x1d9aa0];return _0x226868;};'use strict';var moment=require(_0x8e19('0x0'));var _=require(_0x8e19('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x8e19('0x2'));var shared=require(_0x8e19('0x3'));var db=require(_0x8e19('0x4'))['db'];function respondWithResult(_0x529200,_0x32f52f){_0x32f52f=_0x32f52f||0xc8;return function(_0x4e3f58){if(_0x4e3f58){return _0x529200[_0x8e19('0x5')](_0x32f52f)[_0x8e19('0x6')](_0x4e3f58);}};}function respondWithFilteredResult(_0x2fb138,_0x188ce0){return function(_0x1175d6){if(_0x1175d6){var _0x4db35e=typeof _0x188ce0[_0x8e19('0x7')]===_0x8e19('0x8')&&typeof _0x188ce0[_0x8e19('0x9')]===_0x8e19('0x8');var _0x3fbe35=_0x1175d6[_0x8e19('0xa')];var _0x375054=_0x4db35e?0x0:_0x188ce0['offset'];var _0x146989=_0x4db35e?_0x1175d6[_0x8e19('0xa')]:_0x188ce0[_0x8e19('0x7')]+_0x188ce0[_0x8e19('0x9')];var _0x358d90;if(_0x146989>=_0x3fbe35){_0x146989=_0x3fbe35;_0x358d90=0xc8;}else{_0x358d90=0xce;}_0x2fb138[_0x8e19('0x5')](_0x358d90);return _0x2fb138[_0x8e19('0xb')](_0x8e19('0xc'),_0x375054+'-'+_0x146989+'/'+_0x3fbe35)['json'](_0x1175d6);}return null;};}function saveUpdates(_0x51a0c4,_0x3f4a6d){return function(_0x4b1b8d){if(_0x4b1b8d){return _0x4b1b8d['update'](_0x51a0c4)[_0x8e19('0xd')](function(_0x2c2d05){return _0x2c2d05;});}return null;};}function handleEntityNotFound(_0x16b584,_0x76ccdb){return function(_0x4a75e0){if(!_0x4a75e0){_0x16b584[_0x8e19('0xe')](0x194);}return _0x4a75e0;};}function handleError(_0x32f3ef,_0x5c474d){_0x5c474d=_0x5c474d||0x1f4;return function(_0x34a7c9){logger[_0x8e19('0xf')](_0x34a7c9['stack']);if(_0x34a7c9[_0x8e19('0x10')]){delete _0x34a7c9[_0x8e19('0x10')];}_0x32f3ef[_0x8e19('0x5')](_0x5c474d)[_0x8e19('0x11')](_0x34a7c9);};}exports[_0x8e19('0x12')]=function(_0x2e61e9,_0x27be43){var _0x1dde49={},_0x28d288={},_0x1c64f9={'count':0x0,'rows':[]};var _0x18a9d0=_[_0x8e19('0x13')](db[_0x8e19('0x14')][_0x8e19('0x15')],function(_0x4aa341){return{'name':_0x4aa341[_0x8e19('0x16')],'type':_0x4aa341[_0x8e19('0x17')][_0x8e19('0x18')]};});_0x28d288[_0x8e19('0x19')]=_[_0x8e19('0x13')](_0x18a9d0,_0x8e19('0x10'));_0x28d288[_0x8e19('0x1a')]=_[_0x8e19('0x1b')](_0x2e61e9[_0x8e19('0x1a')]);_0x28d288[_0x8e19('0x1c')]=_[_0x8e19('0x1d')](_0x28d288[_0x8e19('0x19')],_0x28d288[_0x8e19('0x1a')]);_0x28d288['filters']=_[_0x8e19('0x1e')](_0x28d288['filters'],['$and',_0x8e19('0x1f'),_0x8e19('0x20'),_0x8e19('0x21'),'$lt',_0x8e19('0x22'),_0x8e19('0x23'),_0x8e19('0x24'),_0x8e19('0x25'),_0x8e19('0x26'),_0x8e19('0x27'),'$in',_0x8e19('0x28'),_0x8e19('0x29'),_0x8e19('0x2a'),_0x8e19('0x2b'),_0x8e19('0x2c'),_0x8e19('0x29'),_0x8e19('0x2d'),'$contains','$contained',_0x8e19('0x2e')]);_0x1dde49[_0x8e19('0x2f')]=_[_0x8e19('0x1d')](_0x28d288[_0x8e19('0x19')],qs[_0x8e19('0x30')](_0x2e61e9[_0x8e19('0x1a')]['fields']));_0x1dde49['attributes']=_0x1dde49[_0x8e19('0x2f')]['length']?_0x1dde49[_0x8e19('0x2f')]:_0x28d288[_0x8e19('0x19')];if(!_0x2e61e9[_0x8e19('0x1a')][_0x8e19('0x31')]('nolimit')){_0x1dde49[_0x8e19('0x9')]=qs[_0x8e19('0x9')](_0x2e61e9['query']['limit']);_0x1dde49[_0x8e19('0x7')]=qs[_0x8e19('0x7')](_0x2e61e9[_0x8e19('0x1a')][_0x8e19('0x7')]);}_0x1dde49[_0x8e19('0x32')]=qs[_0x8e19('0x33')](_0x2e61e9[_0x8e19('0x1a')][_0x8e19('0x33')]);_0x1dde49['where']=qs[_0x8e19('0x1c')](_[_0x8e19('0x34')](_0x2e61e9['query'],_0x28d288[_0x8e19('0x1c')]),_0x18a9d0);if(_0x2e61e9[_0x8e19('0x1a')][_0x8e19('0x35')]){_0x1dde49[_0x8e19('0x36')]=_[_0x8e19('0x37')](_0x1dde49[_0x8e19('0x36')],{'$or':_[_0x8e19('0x13')](_0x18a9d0,function(_0x547368){if(_0x547368[_0x8e19('0x17')]!==_0x8e19('0x38')){var _0x398b9d={};_0x398b9d[_0x547368[_0x8e19('0x10')]]={'$like':'%'+_0x2e61e9[_0x8e19('0x1a')][_0x8e19('0x35')]+'%'};return _0x398b9d;}})});}_0x1dde49=_[_0x8e19('0x37')]({},_0x1dde49,_0x2e61e9[_0x8e19('0x39')]);var _0x15e4e6={'where':_0x1dde49[_0x8e19('0x36')]};return db[_0x8e19('0x14')][_0x8e19('0xa')](_0x15e4e6)['then'](function(_0x841669){_0x1c64f9['count']=_0x841669;if(_0x2e61e9['query']['includeAll']){_0x1dde49['include']=[{'all':!![]}];}return db[_0x8e19('0x14')][_0x8e19('0x3a')](_0x1dde49);})[_0x8e19('0xd')](function(_0xc15b5){_0x1c64f9['rows']=_0xc15b5;return _0x1c64f9;})[_0x8e19('0xd')](respondWithFilteredResult(_0x27be43,_0x1dde49))[_0x8e19('0x3b')](handleError(_0x27be43,null));};exports[_0x8e19('0x3c')]=function(_0x39aee0,_0x40bab6){var _0x1aa40b={'raw':!![],'where':{'id':_0x39aee0['params']['id']}},_0x5b71bb={};_0x5b71bb[_0x8e19('0x19')]=_[_0x8e19('0x1b')](db[_0x8e19('0x14')][_0x8e19('0x15')]);_0x5b71bb['query']=_[_0x8e19('0x1b')](_0x39aee0[_0x8e19('0x1a')]);_0x5b71bb['filters']=_[_0x8e19('0x1d')](_0x5b71bb[_0x8e19('0x19')],_0x5b71bb[_0x8e19('0x1a')]);_0x1aa40b['attributes']=_['intersection'](_0x5b71bb[_0x8e19('0x19')],qs[_0x8e19('0x30')](_0x39aee0[_0x8e19('0x1a')]['fields']));_0x1aa40b[_0x8e19('0x2f')]=_0x1aa40b[_0x8e19('0x2f')][_0x8e19('0x3d')]?_0x1aa40b[_0x8e19('0x2f')]:_0x5b71bb['model'];if(_0x39aee0[_0x8e19('0x1a')][_0x8e19('0x3e')]){_0x1aa40b[_0x8e19('0x3f')]=[{'all':!![]}];}_0x1aa40b=_[_0x8e19('0x37')]({},_0x1aa40b,_0x39aee0['options']);return db[_0x8e19('0x14')][_0x8e19('0x40')](_0x1aa40b)[_0x8e19('0xd')](handleEntityNotFound(_0x40bab6,null))[_0x8e19('0xd')](respondWithResult(_0x40bab6,null))[_0x8e19('0x3b')](handleError(_0x40bab6,null));};exports[_0x8e19('0x41')]=function(_0x1042d7,_0x118b2b){return db[_0x8e19('0x14')]['create'](_0x1042d7[_0x8e19('0x42')],{})['then'](respondWithResult(_0x118b2b,0xc9))[_0x8e19('0x3b')](handleError(_0x118b2b,null));};exports[_0x8e19('0x43')]=function(_0x2324f8,_0x241104){if(_0x2324f8[_0x8e19('0x42')]['id']){delete _0x2324f8[_0x8e19('0x42')]['id'];}return db[_0x8e19('0x14')][_0x8e19('0x40')]({'where':{'id':_0x2324f8['params']['id']}})[_0x8e19('0xd')](handleEntityNotFound(_0x241104,null))[_0x8e19('0xd')](saveUpdates(_0x2324f8[_0x8e19('0x42')],null))[_0x8e19('0xd')](respondWithResult(_0x241104,null))[_0x8e19('0x3b')](handleError(_0x241104,null));};exports[_0x8e19('0x44')]=function(_0x1bb5c8,_0x3edb29){return db[_0x8e19('0x14')]['describe']()[_0x8e19('0xd')](respondWithResult(_0x3edb29,null))[_0x8e19('0x3b')](handleError(_0x3edb29,null));};exports[_0x8e19('0x45')]=function(_0x19831c,_0xe30216){var _0xd9fa7d;var _0x3445cc=_0x19831c['params']['id'];return db['CmHopper']['find']({'where':{'id':_0x19831c[_0x8e19('0x46')]['id']}})[_0x8e19('0xd')](handleEntityNotFound(_0xe30216,null))[_0x8e19('0xd')](function(_0x271502){if(_0x271502){return _0x271502[_0x8e19('0x45')]()['then'](function(_0x2aaf42){return _0x2aaf42;});}})[_0x8e19('0xd')](function(_0x63e5db){_0xd9fa7d=_0x63e5db;if(_0x63e5db){if(_0x63e5db[_0x8e19('0x47')]||_0x63e5db[_0x8e19('0x48')]){return db[_0x63e5db[_0x8e19('0x47')]?_0x8e19('0x49'):_0x8e19('0x4a')]['find']({'where':{'id':_0x63e5db['VoiceQueueId']?_0x63e5db[_0x8e19('0x47')]:_0x63e5db[_0x8e19('0x48')]},'attributes':['id',_0x8e19('0x10')],'raw':!![]});}}})[_0x8e19('0xd')](function(_0x3197d1){var _0x3bdc42={};if(_0x3197d1){_[_0x8e19('0x37')](_0x3bdc42,_[_0x8e19('0x4b')](_0xd9fa7d[_0x8e19('0x4c')],[_0x8e19('0x4d'),_0x8e19('0x4e'),'id']));_0x3bdc42[_0x8e19('0x4f')]=0x15;_0x3bdc42[_0x8e19('0x50')]=_0x8e19('0x51');_0x3bdc42[_0x8e19('0x52')]=_0x3197d1[_0x8e19('0x10')];_0x3bdc42[_0x8e19('0x53')]=_0x19831c[_0x8e19('0x54')]['name'];_0x3bdc42['UserId']=_0x19831c[_0x8e19('0x54')]['id'];_0x3bdc42[_0x8e19('0x51')]=!![];_0x3bdc42['deletedat']=moment()[_0x8e19('0x55')]('YYYY-MM-DD\x20HH:mm:ss');_0x3bdc42[_0x8e19('0x56')]=_0xd9fa7d['phone'];_0x3bdc42[_0x8e19('0x57')]=_0xd9fa7d[_0x8e19('0x47')]?_0x8e19('0x58'):_0x8e19('0x59');return db[_0x8e19('0x5a')][_0x8e19('0x40')]({'where':{'id':_0x3bdc42[_0x8e19('0x5b')]},'attributes':[_0x8e19('0x5c'),'lastName']})[_0x8e19('0xd')](function(_0xdbc7fa){if(!_[_0x8e19('0x5d')](_0xe30216)&&!_[_0x8e19('0x5d')](_0xdbc7fa[_0x8e19('0x5c')])){_0x3bdc42['calleridname']=_0xdbc7fa[_0x8e19('0x5c')];if(!_['isNil'](_0xdbc7fa[_0x8e19('0x5e')])){_0x3bdc42[_0x8e19('0x5f')]+='\x20'+_0xdbc7fa[_0x8e19('0x5e')];}}})[_0x8e19('0x60')](function(){return db['CmHopperFinal']['create'](_0x3bdc42);});}})[_0x8e19('0xd')](function(_0x568302){return db[_0x8e19('0x61')][_0x8e19('0x45')]({'where':{'CmHopperId':_0x3445cc}});})[_0x8e19('0xd')](function(){return _0xe30216[_0x8e19('0x5')](0xcc)[_0x8e19('0x62')]();})[_0x8e19('0x3b')](handleError(_0xe30216,null));};exports['getPreview']=function(_0x4e63e4,_0x2cab3b){var _0xca2cab=[];return db[_0x8e19('0x5a')][_0x8e19('0x44')]()[_0x8e19('0xd')](function(_0x238783){_0xca2cab=_['keys'](_0x238783);return _0x4e63e4['user']['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x8e19('0x63')},'attributes':['id',_0x8e19('0x64'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x8e19('0xd')](function(_0x17f614){if(_0x17f614&&_0x17f614['length']){return db[_0x8e19('0x65')][_0x8e19('0x66')](function(_0x50308e){var _0x550da4={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x8e19('0x55')](_0x8e19('0x67'))},'VoiceQueueId':{'$in':_[_0x8e19('0x13')](_0x17f614,'id')},'$or':[{'UserId':null},{'UserId':_0x4e63e4[_0x8e19('0x54')]['id']}]};var _0x5cb961={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x17f614)[_0x8e19('0x35')](['dialPreviewAutoRecallMe',0x0])[_0x8e19('0x13')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x4e63e4['user']['id']}]};var _0x1e9cd2={'$or':[_0x550da4,_0x5cb961]};var _0x27c021=[];if(_0x4e63e4['body'][_0x8e19('0x68')]&&_0x4e63e4[_0x8e19('0x42')][_0x8e19('0x68')]===_0x8e19('0x69')){if(!_[_0x8e19('0x6a')](_0x4e63e4['body']['hopperIds'])){_0x1e9cd2['id']={'$in':_0x4e63e4[_0x8e19('0x42')][_0x8e19('0x6b')]};}_0x27c021=[[_0x8e19('0x6c'),'ASC'],['scheduledAt',_0x17f614[0x0][_0x8e19('0x64')]==='ASC'?_0x8e19('0x6d'):_0x8e19('0x6e')],db['sequelize'][_0x8e19('0x6f')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_[_0x8e19('0x6a')](_0x4e63e4[_0x8e19('0x42')]['hopperIds'])){_0x1e9cd2['id']={'$notIn':_0x4e63e4[_0x8e19('0x42')]['hopperIds']};}_0x27c021=[[_0x8e19('0x6c'),_0x8e19('0x6d')],[_0x8e19('0x70'),_0x17f614[0x0][_0x8e19('0x64')]],db[_0x8e19('0x65')][_0x8e19('0x6f')](_0x8e19('0x71')),['id',_0x8e19('0x6e')]];}return db[_0x8e19('0x14')][_0x8e19('0x72')]({'attributes':['id','scheduledat',_0x8e19('0x73'),_0x8e19('0x74')],'where':_0x1e9cd2,'order':_0x27c021,'transaction':_0x50308e,'lock':_0x50308e[_0x8e19('0x75')][_0x8e19('0x76')],'include':[{'model':db[_0x8e19('0x5a')],'as':_0x8e19('0x77'),'attributes':_0xca2cab,'include':[{'model':db[_0x8e19('0x78')],'as':_0x8e19('0x79'),'attributes':['id',_0x8e19('0x10')]}]},{'model':db['CmList'],'as':_0x8e19('0x7a'),'attributes':['id',_0x8e19('0x10')]},{'model':db[_0x8e19('0x49')],'as':_0x8e19('0x7b'),'attributes':['id',_0x8e19('0x10'),'dialActive']}]})[_0x8e19('0xd')](function(_0x1235aa){if(_0x1235aa){return _0x1235aa[_0x8e19('0x43')]({'UserId':_0x4e63e4[_0x8e19('0x54')]['id']},{'transaction':_0x50308e});}});});}})[_0x8e19('0xd')](handleEntityNotFound(_0x2cab3b,null))[_0x8e19('0xd')](respondWithResult(_0x2cab3b,null))['catch'](handleError(_0x2cab3b,null));};exports[_0x8e19('0x7c')]=function(_0x37b474,_0x8fddd2,_0x50c11a){var _0x1b7a5a=[];var _0x39f694=_0x37b474[_0x8e19('0x46')]['id'];var _0x1f0d29=_0x37b474['user']['id'];return db['CmContact'][_0x8e19('0x44')]()[_0x8e19('0xd')](function(_0x573ab9){_0x1b7a5a=_[_0x8e19('0x1b')](_0x573ab9);return db['sequelize'][_0x8e19('0x66')](function(_0x1f4e62){const _0x3e9d2d={'id':_0x39f694};return db[_0x8e19('0x14')][_0x8e19('0x72')]({'attributes':['id','scheduledat',_0x8e19('0x74')],'where':_0x3e9d2d,'transaction':_0x1f4e62,'lock':_0x1f4e62[_0x8e19('0x75')]['UPDATE'],'include':[{'model':db[_0x8e19('0x5a')],'as':'Contact','attributes':_0x1b7a5a,'include':[{'model':db[_0x8e19('0x78')],'as':_0x8e19('0x79'),'attributes':['id','name']}]},{'model':db[_0x8e19('0x7d')],'as':'List','attributes':['id',_0x8e19('0x10')]},{'model':db[_0x8e19('0x49')],'as':_0x8e19('0x7b'),'attributes':['id','name',_0x8e19('0x7e')]}]})[_0x8e19('0xd')](function(_0x228c0c){if(_0x228c0c){return _0x228c0c[_0x8e19('0x43')]({'UserId':_0x1f0d29},{'transaction':_0x1f4e62});}});});})['then'](handleEntityNotFound(_0x8fddd2,null))[_0x8e19('0xd')](respondWithResult(_0x8fddd2,null))[_0x8e19('0x3b')](handleError(_0x8fddd2,null));};exports[_0x8e19('0x7f')]=function(_0x4af320,_0x3e0480){return _0x4af320[_0x8e19('0x54')][_0x8e19('0x80')]({'where':{'type':_0x8e19('0x81'),'dialActive':!![],'dialMethod':_0x8e19('0x63')},'attributes':['id'],'raw':!![]})['then'](function(_0x3af920){if(_0x3af920&&_0x3af920[_0x8e19('0x3d')]){return db[_0x8e19('0x14')][_0x8e19('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x8e19('0x67'))},'VoiceQueueId':{'$in':_[_0x8e19('0x13')](_0x3af920,'id')},'$or':[{'UserId':null},{'UserId':_0x4af320[_0x8e19('0x54')]['id']}]}});}return 0x0;})[_0x8e19('0xd')](function(_0x4030c0){if(!_[_0x8e19('0x5d')](_0x4030c0)&&_['isNumber'](_0x4030c0)){return _0x3e0480[_0x8e19('0x5')](0xc8)['json']({'contacts':_0x4030c0});}else{logger[_0x8e19('0xf')](_0x8e19('0x82'),_0x8e19('0x7f'),0x194,'entity\x20not\x20found');_0x3e0480[_0x8e19('0xe')](0x194);}})[_0x8e19('0x3b')](handleError(_0x3e0480,null));};exports[_0x8e19('0x83')]=function(_0x45d292,_0x5a0465){var _0x140022=shared['timezones'];var _0x2f4637=[];_[_0x8e19('0x13')](_0x140022,function(_0x5fafca){_0x2f4637[_0x8e19('0x84')]({'id':_0x5fafca[_0x8e19('0x10')],'name':_0x5fafca['name'],'utcOffset':_0x5fafca[_0x8e19('0x85')]});});return _0x5a0465[_0x8e19('0x5')](0xc8)[_0x8e19('0x6')]({'tz':_0x2f4637});};exports[_0x8e19('0x86')]=function(_0x572868,_0x330096){var _0x3ad259=shared['timezones'];var _0x284368={};if(!_['isNil'](_0x3ad259[_0x572868[_0x8e19('0x42')]['id']]))_0x284368=_0x3ad259[_0x572868[_0x8e19('0x42')]['id']];return _0x330096['status'](0xc8)['json'](_0x284368);}; \ No newline at end of file +var _0xd6d2=['find','create','body','destroy','VoiceQueueId','CampaignId','Campaign','dataValues','createdAt','state','statedesc','campaign','membername','user','UserId','format','calleridnum','phone','campaigntype','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','describe','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','YYYY-MM-DD\x20HH:mm:ss','value','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','Contact','CmCompany','Company','List','VoiceQueue','Queue','dialActive','UPDATE','CmList','getOpenContacts','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','timezones','push','utcOffset','getTimezone','moment','lodash','../../config/logger','api','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','update','then','sendStatus','error','stack','name','map','CmHopper','rawAttributes','fieldName','type','model','query','keys','intersection','filters','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','$any','attributes','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','fields','length'];(function(_0x1ae491,_0x5b83b9){var _0x4958a5=function(_0xf0f364){while(--_0xf0f364){_0x1ae491['push'](_0x1ae491['shift']());}};_0x4958a5(++_0x5b83b9);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x19ab37,_0xf13b13){_0x19ab37=_0x19ab37-0x0;var _0x4abc0e=_0xd6d2[_0x19ab37];return _0x4abc0e;};'use strict';var moment=require(_0x2d6d('0x0'));var _=require(_0x2d6d('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x2d6d('0x2'))(_0x2d6d('0x3'));var shared=require('../../config/environment');var db=require(_0x2d6d('0x4'))['db'];function respondWithResult(_0x482d86,_0x1c5e54){_0x1c5e54=_0x1c5e54||0xc8;return function(_0x3ee519){if(_0x3ee519){return _0x482d86[_0x2d6d('0x5')](_0x1c5e54)['json'](_0x3ee519);}};}function respondWithFilteredResult(_0xfcdb1d,_0x132361){return function(_0xf59b20){if(_0xf59b20){var _0x45b7b9=typeof _0x132361[_0x2d6d('0x6')]===_0x2d6d('0x7')&&typeof _0x132361[_0x2d6d('0x8')]===_0x2d6d('0x7');var _0x8e4be8=_0xf59b20[_0x2d6d('0x9')];var _0x1a1f60=_0x45b7b9?0x0:_0x132361['offset'];var _0x25fc41=_0x45b7b9?_0xf59b20[_0x2d6d('0x9')]:_0x132361[_0x2d6d('0x6')]+_0x132361[_0x2d6d('0x8')];var _0x4143d5;if(_0x25fc41>=_0x8e4be8){_0x25fc41=_0x8e4be8;_0x4143d5=0xc8;}else{_0x4143d5=0xce;}_0xfcdb1d['status'](_0x4143d5);return _0xfcdb1d[_0x2d6d('0xa')](_0x2d6d('0xb'),_0x1a1f60+'-'+_0x25fc41+'/'+_0x8e4be8)[_0x2d6d('0xc')](_0xf59b20);}return null;};}function saveUpdates(_0x2ad9fc,_0x5c4bf6){return function(_0x5ef174){if(_0x5ef174){return _0x5ef174[_0x2d6d('0xd')](_0x2ad9fc)[_0x2d6d('0xe')](function(_0x46c909){return _0x46c909;});}return null;};}function handleEntityNotFound(_0x3528de,_0x58bd29){return function(_0x1ec6aa){if(!_0x1ec6aa){_0x3528de[_0x2d6d('0xf')](0x194);}return _0x1ec6aa;};}function handleError(_0x48a84e,_0x586085){_0x586085=_0x586085||0x1f4;return function(_0x370096){logger[_0x2d6d('0x10')](_0x370096[_0x2d6d('0x11')]);if(_0x370096['name']){delete _0x370096[_0x2d6d('0x12')];}_0x48a84e['status'](_0x586085)['send'](_0x370096);};}exports['index']=function(_0x1896fc,_0x4179f2){var _0x4426b8={},_0x3c527e={},_0x1d9f01={'count':0x0,'rows':[]};var _0x1bb4db=_[_0x2d6d('0x13')](db[_0x2d6d('0x14')][_0x2d6d('0x15')],function(_0x4898a7){return{'name':_0x4898a7[_0x2d6d('0x16')],'type':_0x4898a7[_0x2d6d('0x17')]['key']};});_0x3c527e[_0x2d6d('0x18')]=_[_0x2d6d('0x13')](_0x1bb4db,_0x2d6d('0x12'));_0x3c527e[_0x2d6d('0x19')]=_[_0x2d6d('0x1a')](_0x1896fc[_0x2d6d('0x19')]);_0x3c527e['filters']=_[_0x2d6d('0x1b')](_0x3c527e[_0x2d6d('0x18')],_0x3c527e[_0x2d6d('0x19')]);_0x3c527e['filters']=_['concat'](_0x3c527e[_0x2d6d('0x1c')],['$and','$or','$gt',_0x2d6d('0x1d'),_0x2d6d('0x1e'),_0x2d6d('0x1f'),_0x2d6d('0x20'),_0x2d6d('0x21'),'$not',_0x2d6d('0x22'),_0x2d6d('0x23'),_0x2d6d('0x24'),_0x2d6d('0x25'),_0x2d6d('0x26'),_0x2d6d('0x27'),_0x2d6d('0x28'),_0x2d6d('0x29'),_0x2d6d('0x26'),'$overlap',_0x2d6d('0x2a'),_0x2d6d('0x2b'),_0x2d6d('0x2c')]);_0x4426b8[_0x2d6d('0x2d')]=_['intersection'](_0x3c527e[_0x2d6d('0x18')],qs['fields'](_0x1896fc[_0x2d6d('0x19')]['fields']));_0x4426b8['attributes']=_0x4426b8[_0x2d6d('0x2d')]['length']?_0x4426b8[_0x2d6d('0x2d')]:_0x3c527e[_0x2d6d('0x18')];if(!_0x1896fc['query'][_0x2d6d('0x2e')]('nolimit')){_0x4426b8[_0x2d6d('0x8')]=qs[_0x2d6d('0x8')](_0x1896fc[_0x2d6d('0x19')][_0x2d6d('0x8')]);_0x4426b8[_0x2d6d('0x6')]=qs[_0x2d6d('0x6')](_0x1896fc[_0x2d6d('0x19')][_0x2d6d('0x6')]);}_0x4426b8['order']=qs[_0x2d6d('0x2f')](_0x1896fc[_0x2d6d('0x19')]['sort']);_0x4426b8[_0x2d6d('0x30')]=qs[_0x2d6d('0x1c')](_[_0x2d6d('0x31')](_0x1896fc[_0x2d6d('0x19')],_0x3c527e[_0x2d6d('0x1c')]),_0x1bb4db);if(_0x1896fc['query']['filter']){_0x4426b8['where']=_[_0x2d6d('0x32')](_0x4426b8[_0x2d6d('0x30')],{'$or':_[_0x2d6d('0x13')](_0x1bb4db,function(_0x54533e){if(_0x54533e[_0x2d6d('0x17')]!==_0x2d6d('0x33')){var _0x29dce0={};_0x29dce0[_0x54533e[_0x2d6d('0x12')]]={'$like':'%'+_0x1896fc['query'][_0x2d6d('0x34')]+'%'};return _0x29dce0;}})});}_0x4426b8=_[_0x2d6d('0x32')]({},_0x4426b8,_0x1896fc[_0x2d6d('0x35')]);var _0x15f9af={'where':_0x4426b8[_0x2d6d('0x30')]};return db[_0x2d6d('0x14')][_0x2d6d('0x9')](_0x15f9af)['then'](function(_0x2f331e){_0x1d9f01[_0x2d6d('0x9')]=_0x2f331e;if(_0x1896fc[_0x2d6d('0x19')][_0x2d6d('0x36')]){_0x4426b8[_0x2d6d('0x37')]=[{'all':!![]}];}return db['CmHopper'][_0x2d6d('0x38')](_0x4426b8);})[_0x2d6d('0xe')](function(_0x352ca9){_0x1d9f01[_0x2d6d('0x39')]=_0x352ca9;return _0x1d9f01;})[_0x2d6d('0xe')](respondWithFilteredResult(_0x4179f2,_0x4426b8))[_0x2d6d('0x3a')](handleError(_0x4179f2,null));};exports[_0x2d6d('0x3b')]=function(_0x124fc2,_0x179fc7){var _0x38cce8={'raw':!![],'where':{'id':_0x124fc2[_0x2d6d('0x3c')]['id']}},_0x3d2fea={};_0x3d2fea[_0x2d6d('0x18')]=_[_0x2d6d('0x1a')](db[_0x2d6d('0x14')][_0x2d6d('0x15')]);_0x3d2fea[_0x2d6d('0x19')]=_['keys'](_0x124fc2[_0x2d6d('0x19')]);_0x3d2fea[_0x2d6d('0x1c')]=_[_0x2d6d('0x1b')](_0x3d2fea[_0x2d6d('0x18')],_0x3d2fea[_0x2d6d('0x19')]);_0x38cce8['attributes']=_[_0x2d6d('0x1b')](_0x3d2fea[_0x2d6d('0x18')],qs[_0x2d6d('0x3d')](_0x124fc2[_0x2d6d('0x19')]['fields']));_0x38cce8[_0x2d6d('0x2d')]=_0x38cce8[_0x2d6d('0x2d')][_0x2d6d('0x3e')]?_0x38cce8[_0x2d6d('0x2d')]:_0x3d2fea[_0x2d6d('0x18')];if(_0x124fc2['query'][_0x2d6d('0x36')]){_0x38cce8[_0x2d6d('0x37')]=[{'all':!![]}];}_0x38cce8=_['merge']({},_0x38cce8,_0x124fc2[_0x2d6d('0x35')]);return db[_0x2d6d('0x14')][_0x2d6d('0x3f')](_0x38cce8)['then'](handleEntityNotFound(_0x179fc7,null))[_0x2d6d('0xe')](respondWithResult(_0x179fc7,null))[_0x2d6d('0x3a')](handleError(_0x179fc7,null));};exports['create']=function(_0x546f1f,_0x4b52a1){return db[_0x2d6d('0x14')][_0x2d6d('0x40')](_0x546f1f['body'],{})[_0x2d6d('0xe')](respondWithResult(_0x4b52a1,0xc9))[_0x2d6d('0x3a')](handleError(_0x4b52a1,null));};exports[_0x2d6d('0xd')]=function(_0x470fb5,_0x4d154c){if(_0x470fb5[_0x2d6d('0x41')]['id']){delete _0x470fb5[_0x2d6d('0x41')]['id'];}return db['CmHopper'][_0x2d6d('0x3f')]({'where':{'id':_0x470fb5[_0x2d6d('0x3c')]['id']}})[_0x2d6d('0xe')](handleEntityNotFound(_0x4d154c,null))[_0x2d6d('0xe')](saveUpdates(_0x470fb5[_0x2d6d('0x41')],null))[_0x2d6d('0xe')](respondWithResult(_0x4d154c,null))[_0x2d6d('0x3a')](handleError(_0x4d154c,null));};exports['describe']=function(_0xe6b038,_0x29771a){return db[_0x2d6d('0x14')]['describe']()['then'](respondWithResult(_0x29771a,null))[_0x2d6d('0x3a')](handleError(_0x29771a,null));};exports[_0x2d6d('0x42')]=function(_0x422198,_0x4e5203){var _0x238402;var _0xff0b07=_0x422198['params']['id'];return db[_0x2d6d('0x14')][_0x2d6d('0x3f')]({'where':{'id':_0x422198[_0x2d6d('0x3c')]['id']}})[_0x2d6d('0xe')](handleEntityNotFound(_0x4e5203,null))[_0x2d6d('0xe')](function(_0x28385f){if(_0x28385f){return _0x28385f[_0x2d6d('0x42')]()[_0x2d6d('0xe')](function(_0x42c125){return _0x42c125;});}})[_0x2d6d('0xe')](function(_0x57e1ec){_0x238402=_0x57e1ec;if(_0x57e1ec){if(_0x57e1ec[_0x2d6d('0x43')]||_0x57e1ec[_0x2d6d('0x44')]){return db[_0x57e1ec[_0x2d6d('0x43')]?'VoiceQueue':_0x2d6d('0x45')][_0x2d6d('0x3f')]({'where':{'id':_0x57e1ec[_0x2d6d('0x43')]?_0x57e1ec[_0x2d6d('0x43')]:_0x57e1ec[_0x2d6d('0x44')]},'attributes':['id',_0x2d6d('0x12')],'raw':!![]});}}})[_0x2d6d('0xe')](function(_0x4eb1d7){var _0x3131c5={};if(_0x4eb1d7){_[_0x2d6d('0x32')](_0x3131c5,_['omit'](_0x238402[_0x2d6d('0x46')],[_0x2d6d('0x47'),'updatedAt','id']));_0x3131c5[_0x2d6d('0x48')]=0x15;_0x3131c5[_0x2d6d('0x49')]='deleted';_0x3131c5[_0x2d6d('0x4a')]=_0x4eb1d7[_0x2d6d('0x12')];_0x3131c5[_0x2d6d('0x4b')]=_0x422198[_0x2d6d('0x4c')][_0x2d6d('0x12')];_0x3131c5[_0x2d6d('0x4d')]=_0x422198[_0x2d6d('0x4c')]['id'];_0x3131c5['deleted']=!![];_0x3131c5['deletedat']=moment()[_0x2d6d('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x3131c5[_0x2d6d('0x4f')]=_0x238402[_0x2d6d('0x50')];_0x3131c5[_0x2d6d('0x51')]=_0x238402['VoiceQueueId']?_0x2d6d('0x52'):'ivr';return db[_0x2d6d('0x53')][_0x2d6d('0x3f')]({'where':{'id':_0x3131c5[_0x2d6d('0x54')]},'attributes':[_0x2d6d('0x55'),_0x2d6d('0x56')]})[_0x2d6d('0xe')](function(_0x3b2dc7){if(!_[_0x2d6d('0x57')](_0x4e5203)&&!_['isNil'](_0x3b2dc7[_0x2d6d('0x55')])){_0x3131c5[_0x2d6d('0x58')]=_0x3b2dc7[_0x2d6d('0x55')];if(!_['isNil'](_0x3b2dc7['lastName'])){_0x3131c5['calleridname']+='\x20'+_0x3b2dc7[_0x2d6d('0x56')];}}})['finally'](function(){return db[_0x2d6d('0x59')][_0x2d6d('0x40')](_0x3131c5);});}})[_0x2d6d('0xe')](function(_0x3f9e3d){return db[_0x2d6d('0x5a')][_0x2d6d('0x42')]({'where':{'CmHopperId':_0xff0b07}});})['then'](function(){return _0x4e5203[_0x2d6d('0x5')](0xcc)[_0x2d6d('0x5b')]();})[_0x2d6d('0x3a')](handleError(_0x4e5203,null));};exports[_0x2d6d('0x5c')]=function(_0x9323fc,_0x487b55){var _0x4bbbeb=[];return db[_0x2d6d('0x53')][_0x2d6d('0x5d')]()[_0x2d6d('0xe')](function(_0x10216f){_0x4bbbeb=_['keys'](_0x10216f);return _0x9323fc[_0x2d6d('0x4c')][_0x2d6d('0x5e')]({'where':{'type':_0x2d6d('0x5f'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x2d6d('0x60'),_0x2d6d('0x61')],'raw':!![]});})[_0x2d6d('0xe')](function(_0x52c244){if(_0x52c244&&_0x52c244[_0x2d6d('0x3e')]){return db['sequelize'][_0x2d6d('0x62')](function(_0x2cdb39){var _0x2183ba={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x2d6d('0x4e')](_0x2d6d('0x63'))},'VoiceQueueId':{'$in':_[_0x2d6d('0x13')](_0x52c244,'id')},'$or':[{'UserId':null},{'UserId':_0x9323fc[_0x2d6d('0x4c')]['id']}]};var _0x1021f0={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x52c244)['filter']([_0x2d6d('0x61'),0x0])[_0x2d6d('0x13')]('id')[_0x2d6d('0x64')]()},'$or':[{'UserId':null},{'UserId':_0x9323fc[_0x2d6d('0x4c')]['id']}]};var _0x2145ea={'$or':[_0x2183ba,_0x1021f0]};var _0x584682=[];if(_0x9323fc[_0x2d6d('0x41')]['direction']&&_0x9323fc[_0x2d6d('0x41')][_0x2d6d('0x65')]===_0x2d6d('0x66')){if(!_[_0x2d6d('0x67')](_0x9323fc[_0x2d6d('0x41')][_0x2d6d('0x68')])){_0x2145ea['id']={'$in':_0x9323fc[_0x2d6d('0x41')][_0x2d6d('0x68')]};}_0x584682=[['priority',_0x2d6d('0x69')],[_0x2d6d('0x6a'),_0x52c244[0x0][_0x2d6d('0x60')]===_0x2d6d('0x69')?_0x2d6d('0x6b'):'ASC'],db['sequelize']['literal'](_0x2d6d('0x6c')),['id',_0x2d6d('0x6b')]];}else{if(!_[_0x2d6d('0x67')](_0x9323fc[_0x2d6d('0x41')][_0x2d6d('0x68')])){_0x2145ea['id']={'$notIn':_0x9323fc[_0x2d6d('0x41')][_0x2d6d('0x68')]};}_0x584682=[[_0x2d6d('0x6d'),_0x2d6d('0x6b')],['scheduledAt',_0x52c244[0x0][_0x2d6d('0x60')]],db['sequelize'][_0x2d6d('0x6e')](_0x2d6d('0x6f')),['id',_0x2d6d('0x69')]];}return db[_0x2d6d('0x14')][_0x2d6d('0x70')]({'attributes':['id',_0x2d6d('0x71'),'phone',_0x2d6d('0x72')],'where':_0x2145ea,'order':_0x584682,'transaction':_0x2cdb39,'lock':_0x2cdb39[_0x2d6d('0x73')]['UPDATE'],'include':[{'model':db[_0x2d6d('0x53')],'as':_0x2d6d('0x74'),'attributes':_0x4bbbeb,'include':[{'model':db[_0x2d6d('0x75')],'as':_0x2d6d('0x76'),'attributes':['id',_0x2d6d('0x12')]}]},{'model':db['CmList'],'as':_0x2d6d('0x77'),'attributes':['id',_0x2d6d('0x12')]},{'model':db[_0x2d6d('0x78')],'as':_0x2d6d('0x79'),'attributes':['id',_0x2d6d('0x12'),_0x2d6d('0x7a')]}]})[_0x2d6d('0xe')](function(_0x1b37ab){if(_0x1b37ab){return _0x1b37ab['update']({'UserId':_0x9323fc[_0x2d6d('0x4c')]['id']},{'transaction':_0x2cdb39});}});});}})[_0x2d6d('0xe')](handleEntityNotFound(_0x487b55,null))[_0x2d6d('0xe')](respondWithResult(_0x487b55,null))[_0x2d6d('0x3a')](handleError(_0x487b55,null));};exports['getPreviewRecall']=function(_0x455d3b,_0x4cc4c2,_0x4b67d8){var _0x55e5d1=[];var _0x5c3218=_0x455d3b['params']['id'];var _0x3b07e5=_0x455d3b[_0x2d6d('0x4c')]['id'];return db[_0x2d6d('0x53')][_0x2d6d('0x5d')]()[_0x2d6d('0xe')](function(_0x10908a){_0x55e5d1=_[_0x2d6d('0x1a')](_0x10908a);return db['sequelize'][_0x2d6d('0x62')](function(_0x92da1c){const _0x54df4b={'id':_0x5c3218};return db[_0x2d6d('0x14')][_0x2d6d('0x70')]({'attributes':['id','scheduledat',_0x2d6d('0x72')],'where':_0x54df4b,'transaction':_0x92da1c,'lock':_0x92da1c[_0x2d6d('0x73')][_0x2d6d('0x7b')],'include':[{'model':db['CmContact'],'as':_0x2d6d('0x74'),'attributes':_0x55e5d1,'include':[{'model':db[_0x2d6d('0x75')],'as':_0x2d6d('0x76'),'attributes':['id',_0x2d6d('0x12')]}]},{'model':db[_0x2d6d('0x7c')],'as':'List','attributes':['id',_0x2d6d('0x12')]},{'model':db['VoiceQueue'],'as':_0x2d6d('0x79'),'attributes':['id',_0x2d6d('0x12'),_0x2d6d('0x7a')]}]})['then'](function(_0x491ab5){if(_0x491ab5){return _0x491ab5[_0x2d6d('0xd')]({'UserId':_0x3b07e5},{'transaction':_0x92da1c});}});});})[_0x2d6d('0xe')](handleEntityNotFound(_0x4cc4c2,null))['then'](respondWithResult(_0x4cc4c2,null))[_0x2d6d('0x3a')](handleError(_0x4cc4c2,null));};exports[_0x2d6d('0x7d')]=function(_0x4952ac,_0x3e8f03){return _0x4952ac[_0x2d6d('0x4c')][_0x2d6d('0x5e')]({'where':{'type':_0x2d6d('0x5f'),'dialActive':!![],'dialMethod':_0x2d6d('0x7e')},'attributes':['id'],'raw':!![]})[_0x2d6d('0xe')](function(_0x5c5bdf){if(_0x5c5bdf&&_0x5c5bdf[_0x2d6d('0x3e')]){return db[_0x2d6d('0x14')][_0x2d6d('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x2d6d('0x4e')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x2d6d('0x13')](_0x5c5bdf,'id')},'$or':[{'UserId':null},{'UserId':_0x4952ac['user']['id']}]}});}return 0x0;})[_0x2d6d('0xe')](function(_0x578da6){if(!_[_0x2d6d('0x57')](_0x578da6)&&_[_0x2d6d('0x7f')](_0x578da6)){return _0x3e8f03['status'](0xc8)[_0x2d6d('0xc')]({'contacts':_0x578da6});}else{logger['error'](_0x2d6d('0x80'),'getOpenContacts',0x194,'entity\x20not\x20found');_0x3e8f03[_0x2d6d('0xf')](0x194);}})[_0x2d6d('0x3a')](handleError(_0x3e8f03,null));};exports['getTimezones']=function(_0x11d954,_0x46113c){var _0x47f382=shared[_0x2d6d('0x81')];var _0x1ad450=[];_[_0x2d6d('0x13')](_0x47f382,function(_0x43b696){_0x1ad450[_0x2d6d('0x82')]({'id':_0x43b696['name'],'name':_0x43b696[_0x2d6d('0x12')],'utcOffset':_0x43b696[_0x2d6d('0x83')]});});return _0x46113c['status'](0xc8)['json']({'tz':_0x1ad450});};exports[_0x2d6d('0x84')]=function(_0x44f0b3,_0x4d596c){var _0x53ef4e=shared[_0x2d6d('0x81')];var _0x296125={};if(!_['isNil'](_0x53ef4e[_0x44f0b3[_0x2d6d('0x41')]['id']]))_0x296125=_0x53ef4e[_0x44f0b3[_0x2d6d('0x41')]['id']];return _0x4d596c[_0x2d6d('0x5')](0xc8)[_0x2d6d('0xc')](_0x296125);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index e410749..02352ea 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 _0xd117=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xd117,0x182));var _0x7d11=function(_0xac0de1,_0x12d3d9){_0xac0de1=_0xac0de1-0x0;var _0x1c1995=_0xd117[_0xac0de1];return _0x1c1995;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var logger=require(_0x7d11('0x2'))(_0x7d11('0x3'));var moment=require(_0x7d11('0x4'));var BPromise=require(_0x7d11('0x5'));var rp=require(_0x7d11('0x6'));var fs=require('fs');var path=require(_0x7d11('0x7'));var rimraf=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var attributes=require(_0x7d11('0xa'));module[_0x7d11('0xb')]=function(_0x27d7e8,_0x40c3c4){return _0x27d7e8[_0x7d11('0xc')](_0x7d11('0xd'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x7d11('0xe'),'fields':[_0x7d11('0xe')]},{'name':_0x7d11('0xf'),'fields':['phone']},{'name':_0x7d11('0x10'),'fields':[_0x7d11('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd117=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0xd117,0x182));var _0x7d11=function(_0x2ad008,_0x45c253){_0x2ad008=_0x2ad008-0x0;var _0x4538cf=_0xd117[_0x2ad008];return _0x4538cf;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var logger=require(_0x7d11('0x2'))(_0x7d11('0x3'));var moment=require(_0x7d11('0x4'));var BPromise=require(_0x7d11('0x5'));var rp=require(_0x7d11('0x6'));var fs=require('fs');var path=require(_0x7d11('0x7'));var rimraf=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var attributes=require(_0x7d11('0xa'));module[_0x7d11('0xb')]=function(_0x27d7e8,_0x40c3c4){return _0x27d7e8[_0x7d11('0xc')](_0x7d11('0xd'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x7d11('0xe'),'fields':[_0x7d11('0xe')]},{'name':_0x7d11('0xf'),'fields':['phone']},{'name':_0x7d11('0x10'),'fields':[_0x7d11('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index adb216e..947de33 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 _0x26c7=['debug','stringify','catch','error','message','find','ShowCmHopper','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','Contact','keys','Agent','name','length','UserId','push','includes','all','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','LOCK','UPDATE','GetContactByPhone','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','literal','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','User','voicePause','CmList','List','NOW()','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','then','info'];(function(_0x1e475e,_0x3cc2b3){var _0x115606=function(_0x51db95){while(--_0x51db95){_0x1e475e['push'](_0x1e475e['shift']());}};_0x115606(++_0x3cc2b3);}(_0x26c7,0x13c));var _0x726c=function(_0x2233be,_0xd10120){_0x2233be=_0x2233be-0x0;var _0x1a6468=_0x26c7[_0x2233be];return _0x1a6468;};'use strict';var _=require(_0x726c('0x0'));var util=require(_0x726c('0x1'));var moment=require(_0x726c('0x2'));var BPromise=require(_0x726c('0x3'));var db=require(_0x726c('0x4'))['db'];var logger=require(_0x726c('0x5'))(_0x726c('0x6'));exports[_0x726c('0x7')]=function(_0x5bb6de){var _0x45ac8f=this;return new Promise(function(_0x3434f2,_0x1dd9e3){return db[_0x726c('0x8')][_0x726c('0x9')]({'raw':_0x5bb6de[_0x726c('0xa')]?_0x5bb6de[_0x726c('0xa')][_0x726c('0xb')]===undefined?!![]:![]:!![],'where':_0x5bb6de[_0x726c('0xa')]?_0x5bb6de['options'][_0x726c('0xc')]||null:null,'attributes':_0x5bb6de[_0x726c('0xa')]?_0x5bb6de[_0x726c('0xa')][_0x726c('0xd')]||null:null,'limit':_0x5bb6de[_0x726c('0xa')]?_0x5bb6de[_0x726c('0xa')][_0x726c('0xe')]||null:null,'include':_0x5bb6de[_0x726c('0xa')]?_0x5bb6de['options'][_0x726c('0xf')]?_[_0x726c('0x10')](_0x5bb6de[_0x726c('0xa')][_0x726c('0xf')],function(_0x2c6621){return{'model':db[_0x2c6621[_0x726c('0x11')]],'as':_0x2c6621['as'],'attributes':_0x2c6621[_0x726c('0xd')],'include':_0x2c6621[_0x726c('0xf')]?_[_0x726c('0x10')](_0x2c6621[_0x726c('0xf')],function(_0x312b91){return{'model':db[_0x312b91[_0x726c('0x11')]],'as':_0x312b91['as'],'attributes':_0x312b91[_0x726c('0xd')],'include':_0x312b91[_0x726c('0xf')]?_[_0x726c('0x10')](_0x312b91['include'],function(_0x32c5cc){return{'model':db[_0x32c5cc['model']],'as':_0x32c5cc['as'],'attributes':_0x32c5cc[_0x726c('0xd')]};}):[]};}):[]};}):[]:[]})[_0x726c('0x12')](function(_0x5d12c2){logger[_0x726c('0x13')](_0x726c('0x7'),_0x5bb6de);logger[_0x726c('0x14')](_0x726c('0x7'),_0x5bb6de,JSON[_0x726c('0x15')](_0x5d12c2));_0x3434f2(_0x5d12c2);})[_0x726c('0x16')](function(_0x433947){logger[_0x726c('0x17')]('GetCmHopper',_0x433947[_0x726c('0x18')],_0x5bb6de);_0x1dd9e3(_0x45ac8f[_0x726c('0x17')](0x1f4,_0x433947['message']));});});};exports['ShowCmHopper']=function(_0x1a501d){var _0x33042d=this;return new Promise(function(_0xb66be1,_0x54755e){return db[_0x726c('0x8')][_0x726c('0x19')]({'raw':_0x1a501d[_0x726c('0xa')]?_0x1a501d['options']['raw']===undefined?!![]:![]:!![],'where':_0x1a501d[_0x726c('0xa')]?_0x1a501d[_0x726c('0xa')]['where']||null:null,'attributes':_0x1a501d[_0x726c('0xa')]?_0x1a501d[_0x726c('0xa')]['attributes']||null:null,'include':_0x1a501d['options']?_0x1a501d['options'][_0x726c('0xf')]?_['map'](_0x1a501d[_0x726c('0xa')][_0x726c('0xf')],function(_0x5eb24e){return{'model':db[_0x5eb24e[_0x726c('0x11')]],'as':_0x5eb24e['as'],'attributes':_0x5eb24e['attributes'],'include':_0x5eb24e[_0x726c('0xf')]?_['map'](_0x5eb24e[_0x726c('0xf')],function(_0x3a47cf){return{'model':db[_0x3a47cf[_0x726c('0x11')]],'as':_0x3a47cf['as'],'attributes':_0x3a47cf[_0x726c('0xd')],'include':_0x3a47cf[_0x726c('0xf')]?_[_0x726c('0x10')](_0x3a47cf[_0x726c('0xf')],function(_0x1049ad){return{'model':db[_0x1049ad[_0x726c('0x11')]],'as':_0x1049ad['as'],'attributes':_0x1049ad['attributes']};}):[]};}):[]};}):[]:[]})[_0x726c('0x12')](function(_0x1a3228){logger[_0x726c('0x13')]('ShowCmHopper',_0x1a501d);logger[_0x726c('0x14')](_0x726c('0x1a'),_0x1a501d,JSON[_0x726c('0x15')](_0x1a3228));_0xb66be1(_0x1a3228);})[_0x726c('0x16')](function(_0x497141){logger['error']('ShowCmHopper',_0x497141[_0x726c('0x18')],_0x1a501d);_0x54755e(_0x33042d['error'](0x1f4,_0x497141['message']));});});};exports[_0x726c('0x1b')]=function(_0x26b456){var _0x21b211=this;return new Promise(function(_0xbee588,_0x56edab){return db['CmHopper'][_0x726c('0x1c')](_0x26b456[_0x726c('0x1d')],{'raw':_0x26b456['options']?_0x26b456['options'][_0x726c('0xb')]===undefined?!![]:![]:!![]})['then'](function(_0x62cee2){logger[_0x726c('0x13')]('CreateCmHopper',_0x26b456);logger['debug'](_0x726c('0x1b'),_0x26b456,JSON[_0x726c('0x15')](_0x62cee2));_0xbee588(_0x62cee2);})['catch'](function(_0x227c0c){logger['error'](_0x726c('0x1b'),_0x227c0c[_0x726c('0x18')],_0x26b456);_0x56edab(_0x21b211[_0x726c('0x17')](0x1f4,_0x227c0c['message']));});});};exports[_0x726c('0x1e')]=function(_0x2fcec5){var _0x567920=this;return new Promise(function(_0x492598,_0x54e484){return db[_0x726c('0x8')][_0x726c('0x1f')](_0x2fcec5['body'],{'raw':_0x2fcec5[_0x726c('0xa')]?_0x2fcec5[_0x726c('0xa')][_0x726c('0xb')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fcec5[_0x726c('0xa')]?_0x2fcec5['options'][_0x726c('0xc')]||null:null,'attributes':_0x2fcec5[_0x726c('0xa')]?_0x2fcec5[_0x726c('0xa')][_0x726c('0xd')]||null:null,'limit':_0x2fcec5[_0x726c('0xa')]?_0x2fcec5[_0x726c('0xa')]['limit']||null:null})['then'](function(_0x52ca69){logger['info']('UpdateCmHopper',_0x2fcec5);logger[_0x726c('0x13')](_0x726c('0x20'),JSON[_0x726c('0x15')](_0x2fcec5[_0x726c('0xa')][_0x726c('0xc')]),_0x2fcec5[_0x726c('0x1d')][_0x726c('0x21')]);logger['debug'](_0x726c('0x1e'),_0x2fcec5,JSON['stringify'](_0x52ca69));_0x492598(_0x52ca69);})['catch'](function(_0x5d462c){logger[_0x726c('0x17')](_0x726c('0x1e'),_0x5d462c[_0x726c('0x18')],_0x2fcec5);_0x54e484(_0x567920['error'](0x1f4,_0x5d462c['message']));});});};exports[_0x726c('0x22')]=function(_0x36f995){var _0x2bfe92=this;return new Promise(function(_0x31c2ab,_0x490fc4){return db[_0x726c('0x8')][_0x726c('0x23')]({'where':_0x36f995[_0x726c('0xa')]?_0x36f995[_0x726c('0xa')][_0x726c('0xc')]||null:null})[_0x726c('0x12')](function(_0x42eef4){logger['info'](_0x726c('0x22'),_0x36f995);logger[_0x726c('0x14')](_0x726c('0x22'),_0x36f995,JSON[_0x726c('0x15')](_0x42eef4));_0x31c2ab(_0x42eef4);})['catch'](function(_0x2bc848){logger[_0x726c('0x17')]('DestroyCmHopper',_0x2bc848[_0x726c('0x18')],_0x36f995);_0x490fc4(_0x2bfe92['error'](0x1f4,_0x2bc848['message']));});});};exports[_0x726c('0x24')]=function(_0x54bbb1){var _0x1c625b=this;return new Promise(function(_0x506523,_0x51a154){return db[_0x726c('0x25')][_0x726c('0x26')]()['then'](function(_0x17cbf4){return db[_0x726c('0x27')][_0x726c('0x28')](function(_0x212b53){return db[_0x726c('0x8')][_0x726c('0x9')]({'where':_0x54bbb1[_0x726c('0xa')]?_0x54bbb1['options'][_0x726c('0xc')]||null:null,'attributes':_0x54bbb1[_0x726c('0xa')]?_0x54bbb1[_0x726c('0xa')][_0x726c('0xd')]||null:null,'limit':_0x54bbb1[_0x726c('0xa')]?_0x54bbb1[_0x726c('0xa')][_0x726c('0xe')]||null:null,'order':_0x54bbb1[_0x726c('0xa')]?_0x54bbb1[_0x726c('0xa')][_0x726c('0x29')]||null:null,'transaction':_0x212b53,'lock':_0x212b53['LOCK']['UPDATE'],'include':[{'model':db[_0x726c('0x25')],'as':_0x726c('0x2a'),'attributes':_[_0x726c('0x2b')](_0x17cbf4)},{'model':db['User'],'as':_0x726c('0x2c'),'attributes':['id',_0x726c('0x2d'),'voicePause']}]})[_0x726c('0x12')](function(_0x3ed48b){var _0x30f283=[];var _0x422828=[];for(var _0x4f31c3=0x0;_0x4f31c3<_0x3ed48b[_0x726c('0x2e')];_0x4f31c3+=0x1){var _0x538316=_0x3ed48b[_0x4f31c3][_0x726c('0x2f')];if(_0x538316===null){_0x30f283[_0x726c('0x30')](_0x3ed48b[_0x4f31c3]['update'](_0x54bbb1[_0x726c('0x1d')],{'transaction':_0x212b53}));}else if(!_0x422828[_0x726c('0x31')](_0x538316)){_0x422828[_0x726c('0x30')](_0x538316);_0x30f283[_0x726c('0x30')](_0x3ed48b[_0x4f31c3][_0x726c('0x1f')](_0x54bbb1[_0x726c('0x1d')],{'transaction':_0x212b53}));}}return BPromise[_0x726c('0x32')](_0x30f283);});})[_0x726c('0x12')](function(_0x4bb1db){logger['info']('GetContactDialer',_0x54bbb1);if(_0x4bb1db[_0x726c('0x2e')]>0x0){logger[_0x726c('0x13')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x4bb1db[0x0]['dataValues']['id'],_0x4bb1db[0x0][_0x726c('0x33')][_0x726c('0x34')],_0x4bb1db[0x0]['dataValues'][_0x726c('0x21')]);}logger[_0x726c('0x14')](_0x726c('0x24'),_0x54bbb1,JSON[_0x726c('0x15')](_0x4bb1db));_0x506523(_0x4bb1db);})[_0x726c('0x16')](function(_0x2d01d6){logger['error']('GetContactDialer',_0x2d01d6['message'],_0x54bbb1);_0x51a154(_0x1c625b[_0x726c('0x17')](0x1f4,_0x2d01d6[_0x726c('0x18')]));});});});};exports[_0x726c('0x35')]=function(_0x597779){var _0x1a769b=this;return new Promise(function(_0x59849c,_0x563382){return db[_0x726c('0x27')]['transaction'](function(_0x4aee60){return db[_0x726c('0x36')][_0x726c('0x1c')](_0x597779['body'],{'raw':_0x597779[_0x726c('0xa')]?_0x597779[_0x726c('0xa')][_0x726c('0xb')]===undefined?!![]:![]:!![],'transaction':_0x4aee60})['then'](function(){logger[_0x726c('0x13')](_0x726c('0x37'),JSON['stringify'](_0x597779[_0x726c('0xa')][_0x726c('0xc')]),_0x597779[_0x726c('0xa')][_0x726c('0xc')][_0x726c('0x21')]);return db[_0x726c('0x8')][_0x726c('0x23')]({'where':_0x597779[_0x726c('0xa')]?_0x597779[_0x726c('0xa')][_0x726c('0xc')]||null:null,'transaction':_0x4aee60});});})[_0x726c('0x12')](function(_0x419a09){logger[_0x726c('0x13')](_0x726c('0x35'),_0x597779);logger['debug'](_0x726c('0x35'),_0x597779,JSON[_0x726c('0x15')](_0x419a09));_0x59849c(_0x419a09);})[_0x726c('0x16')](function(_0x42cf50){logger['error'](_0x726c('0x35'),_0x42cf50[_0x726c('0x18')],_0x597779);_0x563382(_0x1a769b[_0x726c('0x17')](0x1f4,_0x42cf50['message']));});});};exports[_0x726c('0x38')]=function(_0x71a172){var _0x19babf=this;return new Promise(function(_0x15b1a5,_0x3e76c5){return db[_0x726c('0x8')][_0x726c('0x9')]({'raw':_0x71a172['options']?_0x71a172['options'][_0x726c('0xb')]===undefined?!![]:![]:!![],'where':_0x71a172[_0x726c('0xa')]?_0x71a172[_0x726c('0xa')][_0x726c('0xc')]||null:null,'attributes':[[db[_0x726c('0x27')]['fn'](_0x726c('0x39'),db['sequelize']['fn']('IF',db[_0x726c('0x27')]['literal'](_0x726c('0x3a')+util[_0x726c('0x3b')](_0x726c('0x3c'),moment()['format'](_0x726c('0x3d')))+_0x726c('0x3e')))),_0x726c('0x3f')]]})[_0x726c('0x12')](function(_0x1eb8f4){logger['info'](_0x726c('0x38'),_0x71a172);logger[_0x726c('0x14')]('CountReScheduled',_0x71a172,JSON[_0x726c('0x15')](_0x1eb8f4));_0x15b1a5(_0x1eb8f4);})['catch'](function(_0x3643bc){logger[_0x726c('0x17')](_0x726c('0x38'),_0x3643bc[_0x726c('0x18')],_0x71a172);_0x3e76c5(_0x19babf['error'](0x1f4,_0x3643bc['message']));});});};exports[_0x726c('0x40')]=function(_0x175147){var _0x585190=this;return new Promise(function(_0x5c69c8,_0x3dc265){return db[_0x726c('0x25')][_0x726c('0x26')]()[_0x726c('0x12')](function(){return db[_0x726c('0x27')][_0x726c('0x28')](function(_0x20d3b9){return db['CmHopper'][_0x726c('0x9')]({'where':_0x175147[_0x726c('0xa')]?_0x175147['options']['where']||null:null,'attributes':_0x175147[_0x726c('0xa')]?_0x175147[_0x726c('0xa')][_0x726c('0xd')]||null:null,'limit':0x1,'order':_0x175147[_0x726c('0xa')]?_0x175147[_0x726c('0xa')][_0x726c('0x29')]||null:null,'group':db[_0x726c('0x8')]['UserId'],'transaction':_0x20d3b9,'lock':_0x20d3b9[_0x726c('0x41')][_0x726c('0x42')],'include':_0x175147[_0x726c('0xa')]?_0x175147[_0x726c('0xa')][_0x726c('0xf')]?_['map'](_0x175147[_0x726c('0xa')][_0x726c('0xf')],function(_0x51e9e6){return{'model':db[_0x51e9e6[_0x726c('0x11')]],'as':_0x51e9e6['as'],'attributes':_0x51e9e6['attributes'],'include':_0x51e9e6[_0x726c('0xf')]?_[_0x726c('0x10')](_0x51e9e6['include'],function(_0x32d019){return{'model':db[_0x32d019[_0x726c('0x11')]],'as':_0x32d019['as'],'attributes':_0x32d019[_0x726c('0xd')],'include':_0x32d019[_0x726c('0xf')]?_[_0x726c('0x10')](_0x32d019[_0x726c('0xf')],function(_0x1c0691){return{'model':db[_0x1c0691[_0x726c('0x11')]],'as':_0x1c0691['as'],'attributes':_0x1c0691[_0x726c('0xd')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x287c9d){var _0x14c97f=[];for(var _0x21821c=0x0;_0x21821c<_0x287c9d[_0x726c('0x2e')];_0x21821c+=0x1){_0x14c97f['push'](_0x287c9d[_0x21821c][_0x726c('0x1f')](_0x175147[_0x726c('0x1d')],{'transaction':_0x20d3b9}));}return BPromise[_0x726c('0x32')](_0x14c97f);});})['then'](function(_0x31a90e){logger[_0x726c('0x13')]('GetContactRecallMe',_0x175147);logger[_0x726c('0x14')](_0x726c('0x40'),_0x175147,JSON[_0x726c('0x15')](_0x31a90e));_0x5c69c8(_0x31a90e);})['catch'](function(_0x207b8d){logger[_0x726c('0x17')](_0x726c('0x40'),_0x207b8d[_0x726c('0x18')],_0x175147);_0x3dc265(_0x585190[_0x726c('0x17')](0x1f4,_0x207b8d[_0x726c('0x18')]));});});});};exports['GetCmHopperPreview']=function(_0x18bbbf){var _0x4c430f=this;return new Promise(function(_0x3cf35f,_0xac7111){db[_0x726c('0x25')][_0x726c('0x26')]()[_0x726c('0x12')](function(_0x5b3d66){return db[_0x726c('0x8')][_0x726c('0x9')]({'raw':_0x18bbbf[_0x726c('0xa')]?_0x18bbbf[_0x726c('0xa')]['raw']===undefined?!![]:![]:!![],'where':_0x18bbbf[_0x726c('0xa')]?_0x18bbbf[_0x726c('0xa')][_0x726c('0xc')]||null:null,'attributes':_0x18bbbf[_0x726c('0xa')]?_0x18bbbf['options'][_0x726c('0xd')]||null:null,'limit':_0x18bbbf[_0x726c('0xa')]?_0x18bbbf[_0x726c('0xa')][_0x726c('0xe')]||null:null,'include':_0x18bbbf[_0x726c('0xa')]?_0x18bbbf[_0x726c('0xa')][_0x726c('0xf')]?_[_0x726c('0x10')](_0x18bbbf[_0x726c('0xa')][_0x726c('0xf')],function(_0x3dcf95){return{'model':db[_0x3dcf95[_0x726c('0x11')]],'as':_0x3dcf95['as'],'attributes':_0x3dcf95['as']===_0x726c('0x2a')?_[_0x726c('0x2b')](_0x5b3d66):_0x3dcf95[_0x726c('0xd')],'include':_0x3dcf95['include']?_[_0x726c('0x10')](_0x3dcf95['include'],function(_0x3f1c75){return{'model':db[_0x3f1c75[_0x726c('0x11')]],'as':_0x3f1c75['as'],'attributes':_0x3f1c75[_0x726c('0xd')],'include':_0x3f1c75[_0x726c('0xf')]?_[_0x726c('0x10')](_0x3f1c75[_0x726c('0xf')],function(_0x1fff60){return{'model':db[_0x1fff60['model']],'as':_0x1fff60['as'],'attributes':_0x1fff60[_0x726c('0xd')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45ac64){logger[_0x726c('0x13')](_0x726c('0x7'),_0x18bbbf);logger['debug'](_0x726c('0x7'),_0x18bbbf,JSON[_0x726c('0x15')](_0x45ac64));_0x3cf35f(_0x45ac64);})[_0x726c('0x16')](function(_0x41b4c2){logger[_0x726c('0x17')](_0x726c('0x7'),_0x41b4c2[_0x726c('0x18')],_0x18bbbf);_0xac7111(_0x4c430f[_0x726c('0x17')](0x1f4,_0x41b4c2['message']));});});});};exports[_0x726c('0x43')]=function(_0x2b5ef9){var _0x20ec2c=this;return new Promise(function(_0x2af669,_0x569187){return db['CmContact'][_0x726c('0x44')]({'raw':!![],'where':{'phone':_0x2b5ef9[_0x726c('0xa')][_0x726c('0xc')][_0x726c('0x45')]},'attributes':['id',_0x726c('0x46')],'order':[['id','DESC']]})[_0x726c('0x12')](function(_0x495e95){logger[_0x726c('0x13')](_0x726c('0x47'),_0x2b5ef9);logger['debug']('getContactByPhone',_0x2b5ef9,JSON[_0x726c('0x15')](_0x495e95));_0x2af669(_0x495e95);})['catch'](function(_0x51730c){logger[_0x726c('0x17')]('getContactByPhone',_0x51730c[_0x726c('0x18')],_0x2b5ef9);_0x569187(_0x20ec2c['error'](0x1f4,_0x51730c[_0x726c('0x18')]));});});};exports[_0x726c('0x48')]=function(_0xbf344){var _0x18cf66=this;return new Promise(function(_0x309f78,_0x3cd8c){return db[_0x726c('0x27')][_0x726c('0x28')](function(_0x5bb871){var _0x2d4c1e=_0xbf344[_0x726c('0xa')]&&_0xbf344[_0x726c('0xa')]['where']?_0xbf344['options']['where']:{};return db[_0x726c('0x8')][_0x726c('0x1f')](_0xbf344[_0x726c('0x1d')],{'where':_0x2d4c1e,'transaction':_0x5bb871})[_0x726c('0x12')](function(_0x24f084){logger[_0x726c('0x13')](_0x726c('0x48'),_0xbf344);logger[_0x726c('0x14')](_0x726c('0x48'),_0xbf344,JSON[_0x726c('0x15')](_0x24f084));_0x309f78(_0x24f084);})[_0x726c('0x16')](function(_0x380ab3){logger[_0x726c('0x17')](_0x726c('0x48'),_0x380ab3[_0x726c('0x18')],_0xbf344);_0x3cd8c(_0x18cf66[_0x726c('0x17')](0x1f4,_0x380ab3[_0x726c('0x18')]));});});});};exports[_0x726c('0x49')]=function(_0xcb80b6){var _0x1c035f=this;var _0x47155c=_0xcb80b6[_0x726c('0x1d')][_0x726c('0xc')][_0x726c('0x4a')];var _0x1b7ef2=_0xcb80b6[_0x726c('0x1d')][_0x726c('0xc')][_0x726c('0x4b')];var _0x180e95=_0xcb80b6[_0x726c('0x1d')]['where']['availableAgentsIds'];return new Promise(function(_0x5ddedd,_0x3de2b3){return db['CmHopper'][_0x726c('0x9')]({'where':{'voiceQueueId':{'$in':_0x47155c},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x726c('0x27')][_0x726c('0x4c')](_0x726c('0x4d')+_0x1b7ef2+_0x726c('0x4e')),'$gt':db['sequelize']['literal']('NOW()')}},'UserId':{'$in':_0x180e95}},'include':[{'model':db['CmContact'],'as':_0x726c('0x2a')},{'model':db[_0x726c('0x4f')],'as':_0x726c('0x2c'),'attributes':['id',_0x726c('0x2d'),_0x726c('0x50')]},{'model':db[_0x726c('0x51')],'as':_0x726c('0x52')}]})[_0x726c('0x12')](function(_0x1f6d5d){if(_0x1f6d5d['length']>0x0){return db[_0x726c('0x27')][_0x726c('0x28')](function(_0x14721c){return db['CmHopper'][_0x726c('0x1f')]({'recallmeNotifiedDate':db[_0x726c('0x27')][_0x726c('0x4c')](_0x726c('0x53'))},{'where':{'id':{'$in':_[_0x726c('0x10')](_0x1f6d5d,'id')}},'transaction':_0x14721c})[_0x726c('0x12')](function(){_0x5ddedd(_0x1f6d5d);})[_0x726c('0x16')](function(_0x3d202e){logger['error'](_0x726c('0x49'),_0x3d202e['message'],_0xcb80b6);_0x3de2b3(_0x1c035f['error'](0x1f4,_0x3d202e[_0x726c('0x18')]));});})[_0x726c('0x16')](function(_0x49cc59){logger[_0x726c('0x17')]('CmHopperHandlePreviewRecallNotifications',_0x49cc59['message'],_0xcb80b6);_0x3de2b3(_0x1c035f['error'](0x1f4,_0x49cc59[_0x726c('0x18')]));});}else{_0x5ddedd(_0x1f6d5d);}});});}; \ No newline at end of file +var _0x5fcc=['length','UserId','push','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','transaction','order','all','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','lodash','util','moment','bluebird','../../mysqldb','rpc','GetCmHopper','findAll','options','where','attributes','limit','include','map','model','then','debug','stringify','catch','error','message','ShowCmHopper','CmHopper','find','raw','info','create','body','CreateCmHopper','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x5fcc,0x161));var _0xc5fc=function(_0x1003bf,_0x1eaba6){_0x1003bf=_0x1003bf-0x0;var _0x34bef1=_0x5fcc[_0x1003bf];return _0x34bef1;};'use strict';var _=require(_0xc5fc('0x0'));var util=require(_0xc5fc('0x1'));var moment=require(_0xc5fc('0x2'));var BPromise=require(_0xc5fc('0x3'));var db=require(_0xc5fc('0x4'))['db'];var logger=require('../../config/logger')(_0xc5fc('0x5'));exports[_0xc5fc('0x6')]=function(_0x5c499f){var _0x15bf9a=this;return new Promise(function(_0xf4d950,_0x48aca0){return db['CmHopper'][_0xc5fc('0x7')]({'raw':_0x5c499f[_0xc5fc('0x8')]?_0x5c499f[_0xc5fc('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x5c499f[_0xc5fc('0x8')]?_0x5c499f[_0xc5fc('0x8')][_0xc5fc('0x9')]||null:null,'attributes':_0x5c499f['options']?_0x5c499f[_0xc5fc('0x8')][_0xc5fc('0xa')]||null:null,'limit':_0x5c499f[_0xc5fc('0x8')]?_0x5c499f[_0xc5fc('0x8')][_0xc5fc('0xb')]||null:null,'include':_0x5c499f[_0xc5fc('0x8')]?_0x5c499f[_0xc5fc('0x8')][_0xc5fc('0xc')]?_[_0xc5fc('0xd')](_0x5c499f[_0xc5fc('0x8')][_0xc5fc('0xc')],function(_0x5a784a){return{'model':db[_0x5a784a[_0xc5fc('0xe')]],'as':_0x5a784a['as'],'attributes':_0x5a784a[_0xc5fc('0xa')],'include':_0x5a784a[_0xc5fc('0xc')]?_[_0xc5fc('0xd')](_0x5a784a[_0xc5fc('0xc')],function(_0x4dd68e){return{'model':db[_0x4dd68e[_0xc5fc('0xe')]],'as':_0x4dd68e['as'],'attributes':_0x4dd68e[_0xc5fc('0xa')],'include':_0x4dd68e['include']?_[_0xc5fc('0xd')](_0x4dd68e[_0xc5fc('0xc')],function(_0x51db22){return{'model':db[_0x51db22[_0xc5fc('0xe')]],'as':_0x51db22['as'],'attributes':_0x51db22[_0xc5fc('0xa')]};}):[]};}):[]};}):[]:[]})[_0xc5fc('0xf')](function(_0xc996b8){logger['info'](_0xc5fc('0x6'),_0x5c499f);logger[_0xc5fc('0x10')](_0xc5fc('0x6'),_0x5c499f,JSON[_0xc5fc('0x11')](_0xc996b8));_0xf4d950(_0xc996b8);})[_0xc5fc('0x12')](function(_0x225cd9){logger[_0xc5fc('0x13')](_0xc5fc('0x6'),_0x225cd9['message'],_0x5c499f);_0x48aca0(_0x15bf9a[_0xc5fc('0x13')](0x1f4,_0x225cd9[_0xc5fc('0x14')]));});});};exports[_0xc5fc('0x15')]=function(_0x2db80d){var _0x2c3f75=this;return new Promise(function(_0x4aebdb,_0x454dd4){return db[_0xc5fc('0x16')][_0xc5fc('0x17')]({'raw':_0x2db80d['options']?_0x2db80d['options'][_0xc5fc('0x18')]===undefined?!![]:![]:!![],'where':_0x2db80d['options']?_0x2db80d[_0xc5fc('0x8')][_0xc5fc('0x9')]||null:null,'attributes':_0x2db80d[_0xc5fc('0x8')]?_0x2db80d['options']['attributes']||null:null,'include':_0x2db80d[_0xc5fc('0x8')]?_0x2db80d[_0xc5fc('0x8')][_0xc5fc('0xc')]?_['map'](_0x2db80d[_0xc5fc('0x8')][_0xc5fc('0xc')],function(_0x2ddb65){return{'model':db[_0x2ddb65['model']],'as':_0x2ddb65['as'],'attributes':_0x2ddb65[_0xc5fc('0xa')],'include':_0x2ddb65[_0xc5fc('0xc')]?_[_0xc5fc('0xd')](_0x2ddb65['include'],function(_0xb9be73){return{'model':db[_0xb9be73['model']],'as':_0xb9be73['as'],'attributes':_0xb9be73[_0xc5fc('0xa')],'include':_0xb9be73[_0xc5fc('0xc')]?_[_0xc5fc('0xd')](_0xb9be73[_0xc5fc('0xc')],function(_0x1b7f9e){return{'model':db[_0x1b7f9e['model']],'as':_0x1b7f9e['as'],'attributes':_0x1b7f9e[_0xc5fc('0xa')]};}):[]};}):[]};}):[]:[]})[_0xc5fc('0xf')](function(_0x139284){logger[_0xc5fc('0x19')]('ShowCmHopper',_0x2db80d);logger[_0xc5fc('0x10')](_0xc5fc('0x15'),_0x2db80d,JSON[_0xc5fc('0x11')](_0x139284));_0x4aebdb(_0x139284);})[_0xc5fc('0x12')](function(_0x3205c8){logger[_0xc5fc('0x13')](_0xc5fc('0x15'),_0x3205c8[_0xc5fc('0x14')],_0x2db80d);_0x454dd4(_0x2c3f75[_0xc5fc('0x13')](0x1f4,_0x3205c8[_0xc5fc('0x14')]));});});};exports['CreateCmHopper']=function(_0x43d6e3){var _0x5f0029=this;return new Promise(function(_0x5e5d4b,_0x39e427){return db[_0xc5fc('0x16')][_0xc5fc('0x1a')](_0x43d6e3[_0xc5fc('0x1b')],{'raw':_0x43d6e3['options']?_0x43d6e3[_0xc5fc('0x8')][_0xc5fc('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x220d16){logger[_0xc5fc('0x19')](_0xc5fc('0x1c'),_0x43d6e3);logger[_0xc5fc('0x10')](_0xc5fc('0x1c'),_0x43d6e3,JSON[_0xc5fc('0x11')](_0x220d16));_0x5e5d4b(_0x220d16);})['catch'](function(_0x4359b3){logger[_0xc5fc('0x13')]('CreateCmHopper',_0x4359b3[_0xc5fc('0x14')],_0x43d6e3);_0x39e427(_0x5f0029[_0xc5fc('0x13')](0x1f4,_0x4359b3[_0xc5fc('0x14')]));});});};exports[_0xc5fc('0x1d')]=function(_0x1f4958){var _0x81c000=this;return new Promise(function(_0x442ac1,_0x414a87){return db[_0xc5fc('0x16')][_0xc5fc('0x1e')](_0x1f4958[_0xc5fc('0x1b')],{'raw':_0x1f4958['options']?_0x1f4958['options'][_0xc5fc('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f4958[_0xc5fc('0x8')]?_0x1f4958['options']['where']||null:null,'attributes':_0x1f4958[_0xc5fc('0x8')]?_0x1f4958[_0xc5fc('0x8')][_0xc5fc('0xa')]||null:null,'limit':_0x1f4958['options']?_0x1f4958['options']['limit']||null:null})[_0xc5fc('0xf')](function(_0x2183c2){logger[_0xc5fc('0x19')](_0xc5fc('0x1d'),_0x1f4958);logger[_0xc5fc('0x19')](_0xc5fc('0x1f'),JSON[_0xc5fc('0x11')](_0x1f4958[_0xc5fc('0x8')][_0xc5fc('0x9')]),_0x1f4958[_0xc5fc('0x1b')][_0xc5fc('0x20')]);logger[_0xc5fc('0x10')]('UpdateCmHopper',_0x1f4958,JSON[_0xc5fc('0x11')](_0x2183c2));_0x442ac1(_0x2183c2);})['catch'](function(_0xe79a85){logger[_0xc5fc('0x13')](_0xc5fc('0x1d'),_0xe79a85[_0xc5fc('0x14')],_0x1f4958);_0x414a87(_0x81c000[_0xc5fc('0x13')](0x1f4,_0xe79a85[_0xc5fc('0x14')]));});});};exports[_0xc5fc('0x21')]=function(_0x3079c7){var _0x29a9a8=this;return new Promise(function(_0x5679c0,_0x2a2b08){return db[_0xc5fc('0x16')][_0xc5fc('0x22')]({'where':_0x3079c7[_0xc5fc('0x8')]?_0x3079c7['options']['where']||null:null})[_0xc5fc('0xf')](function(_0x199ca1){logger[_0xc5fc('0x19')](_0xc5fc('0x21'),_0x3079c7);logger[_0xc5fc('0x10')](_0xc5fc('0x21'),_0x3079c7,JSON['stringify'](_0x199ca1));_0x5679c0(_0x199ca1);})[_0xc5fc('0x12')](function(_0x3b757b){logger[_0xc5fc('0x13')](_0xc5fc('0x21'),_0x3b757b[_0xc5fc('0x14')],_0x3079c7);_0x2a2b08(_0x29a9a8['error'](0x1f4,_0x3b757b[_0xc5fc('0x14')]));});});};exports[_0xc5fc('0x23')]=function(_0x14d64b){var _0x13ae1c=this;return new Promise(function(_0x547d81,_0x30d032){return db[_0xc5fc('0x24')][_0xc5fc('0x25')]()[_0xc5fc('0xf')](function(_0x20f888){return db[_0xc5fc('0x26')]['transaction'](function(_0x2d5ac8){return db[_0xc5fc('0x16')][_0xc5fc('0x7')]({'where':_0x14d64b['options']?_0x14d64b[_0xc5fc('0x8')][_0xc5fc('0x9')]||null:null,'attributes':_0x14d64b[_0xc5fc('0x8')]?_0x14d64b[_0xc5fc('0x8')][_0xc5fc('0xa')]||null:null,'limit':_0x14d64b[_0xc5fc('0x8')]?_0x14d64b['options'][_0xc5fc('0xb')]||null:null,'order':_0x14d64b[_0xc5fc('0x8')]?_0x14d64b['options']['order']||null:null,'transaction':_0x2d5ac8,'lock':_0x2d5ac8[_0xc5fc('0x27')][_0xc5fc('0x28')],'include':[{'model':db[_0xc5fc('0x24')],'as':_0xc5fc('0x29'),'attributes':_[_0xc5fc('0x2a')](_0x20f888)},{'model':db[_0xc5fc('0x2b')],'as':_0xc5fc('0x2c'),'attributes':['id',_0xc5fc('0x2d'),_0xc5fc('0x2e')]}]})[_0xc5fc('0xf')](function(_0x256f6a){var _0x5a30d0=[];var _0x5a6b62=[];for(var _0x15a9f6=0x0;_0x15a9f6<_0x256f6a[_0xc5fc('0x2f')];_0x15a9f6+=0x1){var _0xbcfc72=_0x256f6a[_0x15a9f6][_0xc5fc('0x30')];if(_0xbcfc72===null){_0x5a30d0[_0xc5fc('0x31')](_0x256f6a[_0x15a9f6]['update'](_0x14d64b[_0xc5fc('0x1b')],{'transaction':_0x2d5ac8}));}else if(!_0x5a6b62['includes'](_0xbcfc72)){_0x5a6b62[_0xc5fc('0x31')](_0xbcfc72);_0x5a30d0[_0xc5fc('0x31')](_0x256f6a[_0x15a9f6][_0xc5fc('0x1e')](_0x14d64b[_0xc5fc('0x1b')],{'transaction':_0x2d5ac8}));}}return BPromise['all'](_0x5a30d0);});})[_0xc5fc('0xf')](function(_0x5100d3){logger['info'](_0xc5fc('0x23'),_0x14d64b);if(_0x5100d3[_0xc5fc('0x2f')]>0x0){logger[_0xc5fc('0x19')](_0xc5fc('0x32'),_0x5100d3[0x0]['dataValues']['id'],_0x5100d3[0x0][_0xc5fc('0x33')]['ContactId'],_0x5100d3[0x0][_0xc5fc('0x33')]['active']);}logger[_0xc5fc('0x10')](_0xc5fc('0x23'),_0x14d64b,JSON[_0xc5fc('0x11')](_0x5100d3));_0x547d81(_0x5100d3);})[_0xc5fc('0x12')](function(_0x5c0700){logger[_0xc5fc('0x13')]('GetContactDialer',_0x5c0700['message'],_0x14d64b);_0x30d032(_0x13ae1c[_0xc5fc('0x13')](0x1f4,_0x5c0700[_0xc5fc('0x14')]));});});});};exports[_0xc5fc('0x34')]=function(_0x2863fd){var _0x506cd5=this;return new Promise(function(_0x51164e,_0x1497fa){return db[_0xc5fc('0x26')]['transaction'](function(_0x3b5b66){return db[_0xc5fc('0x35')]['create'](_0x2863fd[_0xc5fc('0x1b')],{'raw':_0x2863fd[_0xc5fc('0x8')]?_0x2863fd['options'][_0xc5fc('0x18')]===undefined?!![]:![]:!![],'transaction':_0x3b5b66})['then'](function(){logger['info']('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xc5fc('0x11')](_0x2863fd[_0xc5fc('0x8')][_0xc5fc('0x9')]),_0x2863fd[_0xc5fc('0x8')][_0xc5fc('0x9')][_0xc5fc('0x20')]);return db[_0xc5fc('0x16')][_0xc5fc('0x22')]({'where':_0x2863fd[_0xc5fc('0x8')]?_0x2863fd[_0xc5fc('0x8')][_0xc5fc('0x9')]||null:null,'transaction':_0x3b5b66});});})[_0xc5fc('0xf')](function(_0x4a0dec){logger['info'](_0xc5fc('0x34'),_0x2863fd);logger['debug'](_0xc5fc('0x34'),_0x2863fd,JSON[_0xc5fc('0x11')](_0x4a0dec));_0x51164e(_0x4a0dec);})['catch'](function(_0x254a90){logger[_0xc5fc('0x13')]('MoveContactManagedDialer',_0x254a90[_0xc5fc('0x14')],_0x2863fd);_0x1497fa(_0x506cd5['error'](0x1f4,_0x254a90[_0xc5fc('0x14')]));});});};exports[_0xc5fc('0x36')]=function(_0x332c4d){var _0x1f1bf5=this;return new Promise(function(_0x2f5fe7,_0x300ee6){return db[_0xc5fc('0x16')][_0xc5fc('0x7')]({'raw':_0x332c4d[_0xc5fc('0x8')]?_0x332c4d[_0xc5fc('0x8')][_0xc5fc('0x18')]===undefined?!![]:![]:!![],'where':_0x332c4d['options']?_0x332c4d[_0xc5fc('0x8')][_0xc5fc('0x9')]||null:null,'attributes':[[db[_0xc5fc('0x26')]['fn'](_0xc5fc('0x37'),db[_0xc5fc('0x26')]['fn']('IF',db['sequelize'][_0xc5fc('0x38')](_0xc5fc('0x39')+util['format'](_0xc5fc('0x3a'),moment()[_0xc5fc('0x3b')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xc5fc('0x3c')))),_0xc5fc('0x3d')]]})[_0xc5fc('0xf')](function(_0x2aeaed){logger[_0xc5fc('0x19')](_0xc5fc('0x36'),_0x332c4d);logger[_0xc5fc('0x10')](_0xc5fc('0x36'),_0x332c4d,JSON[_0xc5fc('0x11')](_0x2aeaed));_0x2f5fe7(_0x2aeaed);})[_0xc5fc('0x12')](function(_0x5c109c){logger[_0xc5fc('0x13')](_0xc5fc('0x36'),_0x5c109c[_0xc5fc('0x14')],_0x332c4d);_0x300ee6(_0x1f1bf5['error'](0x1f4,_0x5c109c[_0xc5fc('0x14')]));});});};exports[_0xc5fc('0x3e')]=function(_0x1ff02a){var _0x437365=this;return new Promise(function(_0x252c06,_0x517253){return db[_0xc5fc('0x24')][_0xc5fc('0x25')]()['then'](function(){return db['sequelize'][_0xc5fc('0x3f')](function(_0x2461ff){return db[_0xc5fc('0x16')][_0xc5fc('0x7')]({'where':_0x1ff02a[_0xc5fc('0x8')]?_0x1ff02a[_0xc5fc('0x8')][_0xc5fc('0x9')]||null:null,'attributes':_0x1ff02a[_0xc5fc('0x8')]?_0x1ff02a[_0xc5fc('0x8')]['attributes']||null:null,'limit':0x1,'order':_0x1ff02a[_0xc5fc('0x8')]?_0x1ff02a['options'][_0xc5fc('0x40')]||null:null,'group':db['CmHopper'][_0xc5fc('0x30')],'transaction':_0x2461ff,'lock':_0x2461ff[_0xc5fc('0x27')][_0xc5fc('0x28')],'include':_0x1ff02a['options']?_0x1ff02a[_0xc5fc('0x8')][_0xc5fc('0xc')]?_['map'](_0x1ff02a[_0xc5fc('0x8')][_0xc5fc('0xc')],function(_0x165fd9){return{'model':db[_0x165fd9[_0xc5fc('0xe')]],'as':_0x165fd9['as'],'attributes':_0x165fd9[_0xc5fc('0xa')],'include':_0x165fd9[_0xc5fc('0xc')]?_['map'](_0x165fd9['include'],function(_0x24a092){return{'model':db[_0x24a092[_0xc5fc('0xe')]],'as':_0x24a092['as'],'attributes':_0x24a092[_0xc5fc('0xa')],'include':_0x24a092['include']?_[_0xc5fc('0xd')](_0x24a092['include'],function(_0x4798f0){return{'model':db[_0x4798f0[_0xc5fc('0xe')]],'as':_0x4798f0['as'],'attributes':_0x4798f0[_0xc5fc('0xa')]};}):[]};}):[]};}):[]:[]})[_0xc5fc('0xf')](function(_0x256f8b){var _0x1d3f46=[];for(var _0x287b60=0x0;_0x287b60<_0x256f8b['length'];_0x287b60+=0x1){_0x1d3f46[_0xc5fc('0x31')](_0x256f8b[_0x287b60]['update'](_0x1ff02a[_0xc5fc('0x1b')],{'transaction':_0x2461ff}));}return BPromise[_0xc5fc('0x41')](_0x1d3f46);});})[_0xc5fc('0xf')](function(_0x234f26){logger[_0xc5fc('0x19')](_0xc5fc('0x3e'),_0x1ff02a);logger[_0xc5fc('0x10')](_0xc5fc('0x3e'),_0x1ff02a,JSON['stringify'](_0x234f26));_0x252c06(_0x234f26);})[_0xc5fc('0x12')](function(_0x5c018c){logger[_0xc5fc('0x13')](_0xc5fc('0x3e'),_0x5c018c[_0xc5fc('0x14')],_0x1ff02a);_0x517253(_0x437365['error'](0x1f4,_0x5c018c[_0xc5fc('0x14')]));});});});};exports[_0xc5fc('0x42')]=function(_0x472e65){var _0x1cf01c=this;return new Promise(function(_0x1c313c,_0x1f9772){db['CmContact'][_0xc5fc('0x25')]()[_0xc5fc('0xf')](function(_0x4aaacf){return db[_0xc5fc('0x16')][_0xc5fc('0x7')]({'raw':_0x472e65[_0xc5fc('0x8')]?_0x472e65[_0xc5fc('0x8')][_0xc5fc('0x18')]===undefined?!![]:![]:!![],'where':_0x472e65['options']?_0x472e65[_0xc5fc('0x8')][_0xc5fc('0x9')]||null:null,'attributes':_0x472e65[_0xc5fc('0x8')]?_0x472e65[_0xc5fc('0x8')][_0xc5fc('0xa')]||null:null,'limit':_0x472e65[_0xc5fc('0x8')]?_0x472e65[_0xc5fc('0x8')][_0xc5fc('0xb')]||null:null,'include':_0x472e65[_0xc5fc('0x8')]?_0x472e65[_0xc5fc('0x8')][_0xc5fc('0xc')]?_['map'](_0x472e65[_0xc5fc('0x8')][_0xc5fc('0xc')],function(_0x1ecd0f){return{'model':db[_0x1ecd0f[_0xc5fc('0xe')]],'as':_0x1ecd0f['as'],'attributes':_0x1ecd0f['as']===_0xc5fc('0x29')?_[_0xc5fc('0x2a')](_0x4aaacf):_0x1ecd0f[_0xc5fc('0xa')],'include':_0x1ecd0f[_0xc5fc('0xc')]?_[_0xc5fc('0xd')](_0x1ecd0f[_0xc5fc('0xc')],function(_0x30d84a){return{'model':db[_0x30d84a[_0xc5fc('0xe')]],'as':_0x30d84a['as'],'attributes':_0x30d84a[_0xc5fc('0xa')],'include':_0x30d84a[_0xc5fc('0xc')]?_[_0xc5fc('0xd')](_0x30d84a[_0xc5fc('0xc')],function(_0x5b987e){return{'model':db[_0x5b987e[_0xc5fc('0xe')]],'as':_0x5b987e['as'],'attributes':_0x5b987e[_0xc5fc('0xa')]};}):[]};}):[]};}):[]:[]})[_0xc5fc('0xf')](function(_0x1e14c7){logger['info']('GetCmHopper',_0x472e65);logger[_0xc5fc('0x10')]('GetCmHopper',_0x472e65,JSON[_0xc5fc('0x11')](_0x1e14c7));_0x1c313c(_0x1e14c7);})[_0xc5fc('0x12')](function(_0x370b33){logger['error'](_0xc5fc('0x6'),_0x370b33[_0xc5fc('0x14')],_0x472e65);_0x1f9772(_0x1cf01c[_0xc5fc('0x13')](0x1f4,_0x370b33['message']));});});});};exports[_0xc5fc('0x43')]=function(_0x5009c8){var _0x5392af=this;return new Promise(function(_0x4714df,_0x8118c3){return db[_0xc5fc('0x24')][_0xc5fc('0x44')]({'raw':!![],'where':{'phone':_0x5009c8[_0xc5fc('0x8')][_0xc5fc('0x9')][_0xc5fc('0x45')]},'attributes':['id',_0xc5fc('0x46')],'order':[['id',_0xc5fc('0x47')]]})[_0xc5fc('0xf')](function(_0x2204e5){logger[_0xc5fc('0x19')](_0xc5fc('0x48'),_0x5009c8);logger[_0xc5fc('0x10')]('getContactByPhone',_0x5009c8,JSON['stringify'](_0x2204e5));_0x4714df(_0x2204e5);})['catch'](function(_0x11520c){logger[_0xc5fc('0x13')](_0xc5fc('0x48'),_0x11520c[_0xc5fc('0x14')],_0x5009c8);_0x8118c3(_0x5392af[_0xc5fc('0x13')](0x1f4,_0x11520c[_0xc5fc('0x14')]));});});};exports[_0xc5fc('0x49')]=function(_0x493acb){var _0x4b14e7=this;return new Promise(function(_0x4da60f,_0x2e8afa){return db[_0xc5fc('0x26')][_0xc5fc('0x3f')](function(_0x1cca90){var _0x178831=_0x493acb['options']&&_0x493acb['options'][_0xc5fc('0x9')]?_0x493acb[_0xc5fc('0x8')][_0xc5fc('0x9')]:{};return db['CmHopper']['update'](_0x493acb['body'],{'where':_0x178831,'transaction':_0x1cca90})['then'](function(_0x2c7f01){logger[_0xc5fc('0x19')](_0xc5fc('0x49'),_0x493acb);logger['debug'](_0xc5fc('0x49'),_0x493acb,JSON['stringify'](_0x2c7f01));_0x4da60f(_0x2c7f01);})[_0xc5fc('0x12')](function(_0x11becd){logger['error'](_0xc5fc('0x49'),_0x11becd['message'],_0x493acb);_0x2e8afa(_0x4b14e7['error'](0x1f4,_0x11becd[_0xc5fc('0x14')]));});});});};exports[_0xc5fc('0x4a')]=function(_0x310c4e){var _0x1805bf=this;var _0xf63946=_0x310c4e[_0xc5fc('0x1b')][_0xc5fc('0x9')][_0xc5fc('0x4b')];var _0x40ccbf=_0x310c4e[_0xc5fc('0x1b')][_0xc5fc('0x9')][_0xc5fc('0x4c')];var _0x519cb8=_0x310c4e[_0xc5fc('0x1b')][_0xc5fc('0x9')]['availableAgentsIds'];return new Promise(function(_0x2d4b39,_0x4f66cf){return db[_0xc5fc('0x16')][_0xc5fc('0x7')]({'where':{'voiceQueueId':{'$in':_0xf63946},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize']['literal'](_0xc5fc('0x4d')+_0x40ccbf+_0xc5fc('0x4e')),'$gt':db[_0xc5fc('0x26')]['literal'](_0xc5fc('0x4f'))}},'UserId':{'$in':_0x519cb8}},'include':[{'model':db[_0xc5fc('0x24')],'as':_0xc5fc('0x29')},{'model':db['User'],'as':_0xc5fc('0x2c'),'attributes':['id',_0xc5fc('0x2d'),_0xc5fc('0x2e')]},{'model':db['CmList'],'as':'List'}]})[_0xc5fc('0xf')](function(_0x12ebd8){if(_0x12ebd8['length']>0x0){return db[_0xc5fc('0x26')]['transaction'](function(_0x2f2bdc){return db['CmHopper']['update']({'recallmeNotifiedDate':db[_0xc5fc('0x26')][_0xc5fc('0x38')](_0xc5fc('0x4f'))},{'where':{'id':{'$in':_['map'](_0x12ebd8,'id')}},'transaction':_0x2f2bdc})['then'](function(){_0x2d4b39(_0x12ebd8);})['catch'](function(_0x178ce2){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x178ce2[_0xc5fc('0x14')],_0x310c4e);_0x4f66cf(_0x1805bf['error'](0x1f4,_0x178ce2[_0xc5fc('0x14')]));});})['catch'](function(_0xa2d9c3){logger[_0xc5fc('0x13')]('CmHopperHandlePreviewRecallNotifications',_0xa2d9c3[_0xc5fc('0x14')],_0x310c4e);_0x4f66cf(_0x1805bf[_0xc5fc('0x13')](0x1f4,_0xa2d9c3[_0xc5fc('0x14')]));});}else{_0x2d4b39(_0x12ebd8);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 7916302..e8f87b6 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 _0x4f4d=['destroy','exports','express','Router','./cmHopper.controller','get','index','/describe','isAuthenticated','describe','/opencontacts','getTimezones','/:id','post','create','/preview','getPreview','getTimezone','put'];(function(_0x557701,_0x180f95){var _0x4c6d09=function(_0x241b67){while(--_0x241b67){_0x557701['push'](_0x557701['shift']());}};_0x4c6d09(++_0x180f95);}(_0x4f4d,0x9a));var _0xd4f4=function(_0x20008a,_0x362490){_0x20008a=_0x20008a-0x0;var _0x5d0f1c=_0x4f4d[_0x20008a];return _0x5d0f1c;};'use strict';var express=require(_0xd4f4('0x0'));var router=express[_0xd4f4('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xd4f4('0x2'));router[_0xd4f4('0x3')]('/',auth['isAuthenticated'](),controller[_0xd4f4('0x4')]);router[_0xd4f4('0x3')](_0xd4f4('0x5'),auth[_0xd4f4('0x6')](),controller[_0xd4f4('0x7')]);router['get'](_0xd4f4('0x8'),auth[_0xd4f4('0x6')](),controller['getOpenContacts']);router[_0xd4f4('0x3')]('/timezones',auth[_0xd4f4('0x6')](),controller[_0xd4f4('0x9')]);router[_0xd4f4('0x3')](_0xd4f4('0xa'),auth[_0xd4f4('0x6')](),controller['show']);router['get']('/:id/previewrecall',auth[_0xd4f4('0x6')](),controller['getPreviewRecall']);router[_0xd4f4('0xb')]('/',auth[_0xd4f4('0x6')](),controller[_0xd4f4('0xc')]);router[_0xd4f4('0xb')](_0xd4f4('0xd'),auth['isAuthenticated'](),controller[_0xd4f4('0xe')]);router[_0xd4f4('0xb')]('/timezone',auth['isAuthenticated'](),controller[_0xd4f4('0xf')]);router[_0xd4f4('0x10')](_0xd4f4('0xa'),auth[_0xd4f4('0x6')](),controller['update']);router['delete'](_0xd4f4('0xa'),auth[_0xd4f4('0x6')](),controller[_0xd4f4('0x11')]);module[_0xd4f4('0x12')]=router; \ No newline at end of file +var _0xd213=['update','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','describe','/opencontacts','getTimezones','show','getPreviewRecall','post','/preview','/timezone','put'];(function(_0x52f159,_0x419d8a){var _0x156799=function(_0xf168e8){while(--_0xf168e8){_0x52f159['push'](_0x52f159['shift']());}};_0x156799(++_0x419d8a);}(_0xd213,0xc9));var _0x3d21=function(_0x54b2fc,_0x43ca61){_0x54b2fc=_0x54b2fc-0x0;var _0x48443f=_0xd213[_0x54b2fc];return _0x48443f;};'use strict';var express=require(_0x3d21('0x0'));var router=express[_0x3d21('0x1')]();var auth=require(_0x3d21('0x2'));var controller=require(_0x3d21('0x3'));router[_0x3d21('0x4')]('/',auth[_0x3d21('0x5')](),controller['index']);router['get']('/describe',auth[_0x3d21('0x5')](),controller[_0x3d21('0x6')]);router[_0x3d21('0x4')](_0x3d21('0x7'),auth[_0x3d21('0x5')](),controller['getOpenContacts']);router[_0x3d21('0x4')]('/timezones',auth[_0x3d21('0x5')](),controller[_0x3d21('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3d21('0x9')]);router['get']('/:id/previewrecall',auth[_0x3d21('0x5')](),controller[_0x3d21('0xa')]);router[_0x3d21('0xb')]('/',auth[_0x3d21('0x5')](),controller['create']);router[_0x3d21('0xb')](_0x3d21('0xc'),auth['isAuthenticated'](),controller['getPreview']);router[_0x3d21('0xb')](_0x3d21('0xd'),auth[_0x3d21('0x5')](),controller['getTimezone']);router[_0x3d21('0xe')]('/:id',auth[_0x3d21('0x5')](),controller[_0x3d21('0xf')]);router['delete']('/:id',auth[_0x3d21('0x5')](),controller[_0x3d21('0x10')]);module[_0x3d21('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 7757833..5acb757 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 _0x34bb=['INTEGER','STRING','DATE','moment','sequelize','exports'];(function(_0x277534,_0x198d19){var _0x24bba4=function(_0x6999be){while(--_0x6999be){_0x277534['push'](_0x277534['shift']());}};_0x24bba4(++_0x198d19);}(_0x34bb,0xdb));var _0xb34b=function(_0xd11d13,_0x49d529){_0xd11d13=_0xd11d13-0x0;var _0x27f7e4=_0x34bb[_0xd11d13];return _0x27f7e4;};'use strict';var moment=require(_0xb34b('0x0'));var Sequelize=require(_0xb34b('0x1'));module[_0xb34b('0x2')]={'CmHopperId':{'type':Sequelize[_0xb34b('0x3')]},'phone':{'type':Sequelize[_0xb34b('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xb34b('0x5')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xb34b('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xb34b('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb34b('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb34b('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb34b('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xeede=['sequelize','exports','INTEGER','STRING','DATE','moment'];(function(_0x38841c,_0x1af0bf){var _0x500610=function(_0x225955){while(--_0x225955){_0x38841c['push'](_0x38841c['shift']());}};_0x500610(++_0x1af0bf);}(_0xeede,0x9b));var _0xeeed=function(_0x574ce3,_0x59eef4){_0x574ce3=_0x574ce3-0x0;var _0x3447a0=_0xeede[_0x574ce3];return _0x3447a0;};'use strict';var moment=require(_0xeeed('0x0'));var Sequelize=require(_0xeeed('0x1'));module[_0xeeed('0x2')]={'CmHopperId':{'type':Sequelize[_0xeeed('0x3')]},'phone':{'type':Sequelize[_0xeeed('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xeeed('0x5')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xeeed('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xeeed('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xeeed('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xeeed('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xeeed('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xeeed('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xeeed('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 9bdd6e5..d1a8a13 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 _0x10e9=['merge','VIRTUAL','include','findAll','rows','show','params','rawAttributes','includeAll','options','find','catch','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','map','CmHopperAdditionalPhone','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','filter','where'];(function(_0x39fff1,_0x3f859e){var _0x235670=function(_0x29b698){while(--_0x29b698){_0x39fff1['push'](_0x39fff1['shift']());}};_0x235670(++_0x3f859e);}(_0x10e9,0xbf));var _0x910e=function(_0x33c637,_0x597c26){_0x33c637=_0x33c637-0x0;var _0x14aa20=_0x10e9[_0x33c637];return _0x14aa20;};'use strict';var emlformat=require(_0x910e('0x0'));var rimraf=require(_0x910e('0x1'));var zipdir=require(_0x910e('0x2'));var jsonpatch=require(_0x910e('0x3'));var rp=require(_0x910e('0x4'));var moment=require(_0x910e('0x5'));var BPromise=require(_0x910e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x910e('0x7'));var sox=require(_0x910e('0x8'));var csv=require(_0x910e('0x9'));var ejs=require(_0x910e('0xa'));var fs=require('fs');var fs_extra=require(_0x910e('0xb'));var _=require(_0x910e('0xc'));var squel=require(_0x910e('0xd'));var crypto=require('crypto');var jsforce=require(_0x910e('0xe'));var deskjs=require(_0x910e('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x910e('0x10'));var Redis=require(_0x910e('0x11'));var authService=require(_0x910e('0x12'));var qs=require(_0x910e('0x13'));var as=require(_0x910e('0x14'));var hardwareService=require(_0x910e('0x15'));var logger=require(_0x910e('0x16'))(_0x910e('0x17'));var utils=require(_0x910e('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x910e('0x19'))['db'];function respondWithStatusCode(_0x4757af,_0x53213e){_0x53213e=_0x53213e||0xcc;return function(_0x25e54c){if(_0x25e54c){return _0x4757af[_0x910e('0x1a')](_0x53213e);}return _0x4757af[_0x910e('0x1b')](_0x53213e)[_0x910e('0x1c')]();};}function respondWithResult(_0x495931,_0x3309ea){_0x3309ea=_0x3309ea||0xc8;return function(_0x16540d){if(_0x16540d){return _0x495931[_0x910e('0x1b')](_0x3309ea)[_0x910e('0x1d')](_0x16540d);}};}function respondWithFilteredResult(_0x3037f1,_0x4341f7){return function(_0x4c6688){if(_0x4c6688){var _0x389578=typeof _0x4341f7[_0x910e('0x1e')]===_0x910e('0x1f')&&typeof _0x4341f7['limit']===_0x910e('0x1f');var _0x153d1d=_0x4c6688[_0x910e('0x20')];var _0x5b2220=_0x389578?0x0:_0x4341f7[_0x910e('0x1e')];var _0x1b2f35=_0x389578?_0x4c6688[_0x910e('0x20')]:_0x4341f7[_0x910e('0x1e')]+_0x4341f7['limit'];var _0x29a201;if(_0x1b2f35>=_0x153d1d){_0x1b2f35=_0x153d1d;_0x29a201=0xc8;}else{_0x29a201=0xce;}_0x3037f1[_0x910e('0x1b')](_0x29a201);return _0x3037f1[_0x910e('0x21')](_0x910e('0x22'),_0x5b2220+'-'+_0x1b2f35+'/'+_0x153d1d)[_0x910e('0x1d')](_0x4c6688);}return null;};}function patchUpdates(_0x414210){return function(_0x2296cc){try{jsonpatch[_0x910e('0x23')](_0x2296cc,_0x414210,!![]);}catch(_0x139cb5){return BPromise[_0x910e('0x24')](_0x139cb5);}return _0x2296cc['save']();};}function saveUpdates(_0x112dd3,_0x3ee945){return function(_0x3d9775){if(_0x3d9775){return _0x3d9775[_0x910e('0x25')](_0x112dd3)[_0x910e('0x26')](function(_0x1e1434){return _0x1e1434;});}return null;};}function removeEntity(_0x55a036,_0x4278aa){return function(_0x4d86c9){if(_0x4d86c9){return _0x4d86c9[_0x910e('0x27')]()['then'](function(){var _0x234c6d=_0x4d86c9[_0x910e('0x28')]({'plain':!![]});var _0xff268f=_0x910e('0x29');return db[_0x910e('0x2a')]['destroy']({'where':{'type':_0xff268f,'resourceId':_0x234c6d['id']}})[_0x910e('0x26')](function(){return _0x4d86c9;});})['then'](function(){_0x55a036[_0x910e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33473a,_0x532c30){return function(_0x38de98){if(!_0x38de98){_0x33473a[_0x910e('0x1a')](0x194);}return _0x38de98;};}function handleError(_0x806c41,_0x592863){_0x592863=_0x592863||0x1f4;return function(_0x51bd6f){logger[_0x910e('0x2b')](_0x51bd6f[_0x910e('0x2c')]);if(_0x51bd6f[_0x910e('0x2d')]){delete _0x51bd6f[_0x910e('0x2d')];}_0x806c41['status'](_0x592863)[_0x910e('0x2e')](_0x51bd6f);};}exports['index']=function(_0x4c3d98,_0x2ff42e){var _0x2fde1e={},_0x4418b2={},_0x5f43d2={'count':0x0,'rows':[]};var _0x21852d=_[_0x910e('0x2f')](db[_0x910e('0x30')]['rawAttributes'],function(_0x831bf3){return{'name':_0x831bf3[_0x910e('0x31')],'type':_0x831bf3[_0x910e('0x32')][_0x910e('0x33')]};});_0x4418b2[_0x910e('0x34')]=_[_0x910e('0x2f')](_0x21852d,_0x910e('0x2d'));_0x4418b2['query']=_[_0x910e('0x35')](_0x4c3d98[_0x910e('0x36')]);_0x4418b2['filters']=_[_0x910e('0x37')](_0x4418b2[_0x910e('0x34')],_0x4418b2[_0x910e('0x36')]);_0x2fde1e[_0x910e('0x38')]=_['intersection'](_0x4418b2[_0x910e('0x34')],qs[_0x910e('0x39')](_0x4c3d98[_0x910e('0x36')][_0x910e('0x39')]));_0x2fde1e[_0x910e('0x38')]=_0x2fde1e[_0x910e('0x38')][_0x910e('0x3a')]?_0x2fde1e[_0x910e('0x38')]:_0x4418b2[_0x910e('0x34')];if(!_0x4c3d98[_0x910e('0x36')][_0x910e('0x3b')](_0x910e('0x3c'))){_0x2fde1e[_0x910e('0x3d')]=qs[_0x910e('0x3d')](_0x4c3d98[_0x910e('0x36')]['limit']);_0x2fde1e[_0x910e('0x1e')]=qs['offset'](_0x4c3d98['query']['offset']);}_0x2fde1e[_0x910e('0x3e')]=qs[_0x910e('0x3f')](_0x4c3d98[_0x910e('0x36')][_0x910e('0x3f')]);_0x2fde1e['where']=qs[_0x910e('0x40')](_['pick'](_0x4c3d98['query'],_0x4418b2[_0x910e('0x40')]),_0x21852d);if(_0x4c3d98[_0x910e('0x36')][_0x910e('0x41')]){_0x2fde1e[_0x910e('0x42')]=_[_0x910e('0x43')](_0x2fde1e[_0x910e('0x42')],{'$or':_[_0x910e('0x2f')](_0x21852d,function(_0x331020){if(_0x331020[_0x910e('0x32')]!==_0x910e('0x44')){var _0x4392c1={};_0x4392c1[_0x331020[_0x910e('0x2d')]]={'$like':'%'+_0x4c3d98['query'][_0x910e('0x41')]+'%'};return _0x4392c1;}})});}_0x2fde1e=_[_0x910e('0x43')]({},_0x2fde1e,_0x4c3d98['options']);var _0xc67fea={'where':_0x2fde1e[_0x910e('0x42')]};return db[_0x910e('0x30')][_0x910e('0x20')](_0xc67fea)[_0x910e('0x26')](function(_0x392b01){_0x5f43d2[_0x910e('0x20')]=_0x392b01;if(_0x4c3d98[_0x910e('0x36')]['includeAll']){_0x2fde1e[_0x910e('0x45')]=[{'all':!![]}];}return db[_0x910e('0x30')][_0x910e('0x46')](_0x2fde1e);})[_0x910e('0x26')](function(_0x142c72){_0x5f43d2[_0x910e('0x47')]=_0x142c72;return _0x5f43d2;})[_0x910e('0x26')](respondWithFilteredResult(_0x2ff42e,_0x2fde1e))['catch'](handleError(_0x2ff42e,null));};exports[_0x910e('0x48')]=function(_0x10511d,_0x40dacb){var _0x48c10c={'raw':!![],'where':{'id':_0x10511d[_0x910e('0x49')]['id']}},_0x45009c={};_0x45009c['model']=_[_0x910e('0x35')](db[_0x910e('0x30')][_0x910e('0x4a')]);_0x45009c[_0x910e('0x36')]=_[_0x910e('0x35')](_0x10511d['query']);_0x45009c[_0x910e('0x40')]=_[_0x910e('0x37')](_0x45009c[_0x910e('0x34')],_0x45009c[_0x910e('0x36')]);_0x48c10c[_0x910e('0x38')]=_[_0x910e('0x37')](_0x45009c[_0x910e('0x34')],qs[_0x910e('0x39')](_0x10511d[_0x910e('0x36')][_0x910e('0x39')]));_0x48c10c[_0x910e('0x38')]=_0x48c10c[_0x910e('0x38')][_0x910e('0x3a')]?_0x48c10c[_0x910e('0x38')]:_0x45009c[_0x910e('0x34')];if(_0x10511d[_0x910e('0x36')][_0x910e('0x4b')]){_0x48c10c['include']=[{'all':!![]}];}_0x48c10c=_['merge']({},_0x48c10c,_0x10511d[_0x910e('0x4c')]);return db['CmHopperAdditionalPhone'][_0x910e('0x4d')](_0x48c10c)[_0x910e('0x26')](handleEntityNotFound(_0x40dacb,null))[_0x910e('0x26')](respondWithResult(_0x40dacb,null))[_0x910e('0x4e')](handleError(_0x40dacb,null));};exports[_0x910e('0x4f')]=function(_0x5730f6,_0x42474a){return db[_0x910e('0x30')][_0x910e('0x4f')](_0x5730f6[_0x910e('0x50')],{})[_0x910e('0x26')](function(_0x1b6d48){var _0x5e54e2=_0x5730f6[_0x910e('0x51')][_0x910e('0x28')]({'plain':!![]});if(!_0x5e54e2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e54e2[_0x910e('0x52')]===_0x910e('0x51')){var _0x1dce53=_0x1b6d48[_0x910e('0x28')]({'plain':!![]});var _0x1ef7a6=_0x910e('0x29');return db[_0x910e('0x53')]['find']({'where':{'name':_0x1ef7a6,'userProfileId':_0x5e54e2['userProfileId']},'raw':!![]})[_0x910e('0x26')](function(_0x11ddce){if(_0x11ddce&&_0x11ddce[_0x910e('0x54')]===0x0){return db[_0x910e('0x2a')][_0x910e('0x4f')]({'name':_0x1dce53[_0x910e('0x2d')],'resourceId':_0x1dce53['id'],'type':_0x11ddce[_0x910e('0x2d')],'sectionId':_0x11ddce['id']},{})[_0x910e('0x26')](function(){return _0x1b6d48;});}else{return _0x1b6d48;}})[_0x910e('0x4e')](function(_0x464d5d){logger['error'](_0x910e('0x55'),_0x464d5d);throw _0x464d5d;});}return _0x1b6d48;})[_0x910e('0x26')](respondWithResult(_0x42474a,0xc9))[_0x910e('0x4e')](handleError(_0x42474a,null));};exports['update']=function(_0x1fac76,_0x337f7d){if(_0x1fac76[_0x910e('0x50')]['id']){delete _0x1fac76[_0x910e('0x50')]['id'];}return db[_0x910e('0x30')][_0x910e('0x4d')]({'where':{'id':_0x1fac76[_0x910e('0x49')]['id']}})[_0x910e('0x26')](handleEntityNotFound(_0x337f7d,null))[_0x910e('0x26')](saveUpdates(_0x1fac76[_0x910e('0x50')],null))[_0x910e('0x26')](respondWithResult(_0x337f7d,null))['catch'](handleError(_0x337f7d,null));};exports[_0x910e('0x27')]=function(_0x28a2fb,_0x212e8e){return db[_0x910e('0x30')][_0x910e('0x4d')]({'where':{'id':_0x28a2fb[_0x910e('0x49')]['id']}})['then'](handleEntityNotFound(_0x212e8e,null))[_0x910e('0x26')](removeEntity(_0x212e8e,null))[_0x910e('0x4e')](handleError(_0x212e8e,null));}; \ No newline at end of file +var _0xa971=['set','reject','save','then','CmHopperAdditionalPhones','UserProfileResource','destroy','error','stack','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','catch','show','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x590be3,_0x45e19b){var _0x5667a4=function(_0x2c5107){while(--_0x2c5107){_0x590be3['push'](_0x590be3['shift']());}};_0x5667a4(++_0x45e19b);}(_0xa971,0x18b));var _0x1a97=function(_0x3b5ebb,_0x371290){_0x3b5ebb=_0x3b5ebb-0x0;var _0xc4c84b=_0xa971[_0x3b5ebb];return _0xc4c84b;};'use strict';var emlformat=require(_0x1a97('0x0'));var rimraf=require(_0x1a97('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1a97('0x2'));var rp=require(_0x1a97('0x3'));var moment=require(_0x1a97('0x4'));var BPromise=require(_0x1a97('0x5'));var Mustache=require(_0x1a97('0x6'));var util=require('util');var path=require('path');var sox=require(_0x1a97('0x7'));var csv=require(_0x1a97('0x8'));var ejs=require(_0x1a97('0x9'));var fs=require('fs');var fs_extra=require(_0x1a97('0xa'));var _=require(_0x1a97('0xb'));var squel=require(_0x1a97('0xc'));var crypto=require(_0x1a97('0xd'));var jsforce=require(_0x1a97('0xe'));var deskjs=require(_0x1a97('0xf'));var toCsv=require(_0x1a97('0x8'));var querystring=require(_0x1a97('0x10'));var Papa=require(_0x1a97('0x11'));var Redis=require(_0x1a97('0x12'));var authService=require(_0x1a97('0x13'));var qs=require(_0x1a97('0x14'));var as=require(_0x1a97('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1a97('0x16'))(_0x1a97('0x17'));var utils=require(_0x1a97('0x18'));var config=require(_0x1a97('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x1a97('0x1a'))['db'];function respondWithStatusCode(_0x5de0aa,_0xfe1fc3){_0xfe1fc3=_0xfe1fc3||0xcc;return function(_0x25d304){if(_0x25d304){return _0x5de0aa[_0x1a97('0x1b')](_0xfe1fc3);}return _0x5de0aa[_0x1a97('0x1c')](_0xfe1fc3)[_0x1a97('0x1d')]();};}function respondWithResult(_0x3e8025,_0x56e982){_0x56e982=_0x56e982||0xc8;return function(_0x215715){if(_0x215715){return _0x3e8025[_0x1a97('0x1c')](_0x56e982)[_0x1a97('0x1e')](_0x215715);}};}function respondWithFilteredResult(_0x4c0e56,_0x33fd23){return function(_0x4c8598){if(_0x4c8598){var _0x31c2ee=typeof _0x33fd23[_0x1a97('0x1f')]==='undefined'&&typeof _0x33fd23['limit']===_0x1a97('0x20');var _0x3f889a=_0x4c8598['count'];var _0x46eb64=_0x31c2ee?0x0:_0x33fd23[_0x1a97('0x1f')];var _0x5234e9=_0x31c2ee?_0x4c8598[_0x1a97('0x21')]:_0x33fd23[_0x1a97('0x1f')]+_0x33fd23[_0x1a97('0x22')];var _0x38b47a;if(_0x5234e9>=_0x3f889a){_0x5234e9=_0x3f889a;_0x38b47a=0xc8;}else{_0x38b47a=0xce;}_0x4c0e56['status'](_0x38b47a);return _0x4c0e56[_0x1a97('0x23')]('Content-Range',_0x46eb64+'-'+_0x5234e9+'/'+_0x3f889a)[_0x1a97('0x1e')](_0x4c8598);}return null;};}function patchUpdates(_0x255438){return function(_0x3f6dca){try{jsonpatch['apply'](_0x3f6dca,_0x255438,!![]);}catch(_0x5d6831){return BPromise[_0x1a97('0x24')](_0x5d6831);}return _0x3f6dca[_0x1a97('0x25')]();};}function saveUpdates(_0x169da1,_0x273c1c){return function(_0x1bc34a){if(_0x1bc34a){return _0x1bc34a['update'](_0x169da1)[_0x1a97('0x26')](function(_0x586c78){return _0x586c78;});}return null;};}function removeEntity(_0x46c985,_0x5989f6){return function(_0x9d5ace){if(_0x9d5ace){return _0x9d5ace['destroy']()[_0x1a97('0x26')](function(){var _0x20d02e=_0x9d5ace['get']({'plain':!![]});var _0x5f5266=_0x1a97('0x27');return db[_0x1a97('0x28')][_0x1a97('0x29')]({'where':{'type':_0x5f5266,'resourceId':_0x20d02e['id']}})['then'](function(){return _0x9d5ace;});})[_0x1a97('0x26')](function(){_0x46c985[_0x1a97('0x1c')](0xcc)[_0x1a97('0x1d')]();});}};}function handleEntityNotFound(_0x1df8bf,_0x37aa71){return function(_0x68b69f){if(!_0x68b69f){_0x1df8bf[_0x1a97('0x1b')](0x194);}return _0x68b69f;};}function handleError(_0x1ffee3,_0x323459){_0x323459=_0x323459||0x1f4;return function(_0x42fbfb){logger[_0x1a97('0x2a')](_0x42fbfb[_0x1a97('0x2b')]);if(_0x42fbfb['name']){delete _0x42fbfb['name'];}_0x1ffee3[_0x1a97('0x1c')](_0x323459)[_0x1a97('0x2c')](_0x42fbfb);};}exports[_0x1a97('0x2d')]=function(_0x3a5452,_0x54f619){var _0x519499={},_0x57134a={},_0x4ff2ab={'count':0x0,'rows':[]};var _0x3df7bd=_[_0x1a97('0x2e')](db[_0x1a97('0x2f')][_0x1a97('0x30')],function(_0x1c3746){return{'name':_0x1c3746[_0x1a97('0x31')],'type':_0x1c3746[_0x1a97('0x32')][_0x1a97('0x33')]};});_0x57134a[_0x1a97('0x34')]=_[_0x1a97('0x2e')](_0x3df7bd,'name');_0x57134a[_0x1a97('0x35')]=_[_0x1a97('0x36')](_0x3a5452[_0x1a97('0x35')]);_0x57134a[_0x1a97('0x37')]=_[_0x1a97('0x38')](_0x57134a[_0x1a97('0x34')],_0x57134a[_0x1a97('0x35')]);_0x519499[_0x1a97('0x39')]=_[_0x1a97('0x38')](_0x57134a[_0x1a97('0x34')],qs[_0x1a97('0x3a')](_0x3a5452[_0x1a97('0x35')][_0x1a97('0x3a')]));_0x519499[_0x1a97('0x39')]=_0x519499[_0x1a97('0x39')][_0x1a97('0x3b')]?_0x519499['attributes']:_0x57134a[_0x1a97('0x34')];if(!_0x3a5452['query'][_0x1a97('0x3c')](_0x1a97('0x3d'))){_0x519499['limit']=qs[_0x1a97('0x22')](_0x3a5452['query']['limit']);_0x519499[_0x1a97('0x1f')]=qs[_0x1a97('0x1f')](_0x3a5452[_0x1a97('0x35')]['offset']);}_0x519499['order']=qs['sort'](_0x3a5452[_0x1a97('0x35')][_0x1a97('0x3e')]);_0x519499[_0x1a97('0x3f')]=qs[_0x1a97('0x37')](_[_0x1a97('0x40')](_0x3a5452['query'],_0x57134a['filters']),_0x3df7bd);if(_0x3a5452[_0x1a97('0x35')][_0x1a97('0x41')]){_0x519499[_0x1a97('0x3f')]=_[_0x1a97('0x42')](_0x519499['where'],{'$or':_['map'](_0x3df7bd,function(_0x1f3caf){if(_0x1f3caf['type']!==_0x1a97('0x43')){var _0x5217fa={};_0x5217fa[_0x1f3caf[_0x1a97('0x44')]]={'$like':'%'+_0x3a5452['query'][_0x1a97('0x41')]+'%'};return _0x5217fa;}})});}_0x519499=_[_0x1a97('0x42')]({},_0x519499,_0x3a5452[_0x1a97('0x45')]);var _0x4d4076={'where':_0x519499[_0x1a97('0x3f')]};return db[_0x1a97('0x2f')][_0x1a97('0x21')](_0x4d4076)[_0x1a97('0x26')](function(_0x3ee0a4){_0x4ff2ab['count']=_0x3ee0a4;if(_0x3a5452['query'][_0x1a97('0x46')]){_0x519499[_0x1a97('0x47')]=[{'all':!![]}];}return db[_0x1a97('0x2f')][_0x1a97('0x48')](_0x519499);})[_0x1a97('0x26')](function(_0x17f9ed){_0x4ff2ab['rows']=_0x17f9ed;return _0x4ff2ab;})[_0x1a97('0x26')](respondWithFilteredResult(_0x54f619,_0x519499))[_0x1a97('0x49')](handleError(_0x54f619,null));};exports[_0x1a97('0x4a')]=function(_0x5650f2,_0x2a0b18){var _0x5982af={'raw':!![],'where':{'id':_0x5650f2['params']['id']}},_0x548ead={};_0x548ead[_0x1a97('0x34')]=_[_0x1a97('0x36')](db[_0x1a97('0x2f')][_0x1a97('0x30')]);_0x548ead[_0x1a97('0x35')]=_[_0x1a97('0x36')](_0x5650f2[_0x1a97('0x35')]);_0x548ead['filters']=_[_0x1a97('0x38')](_0x548ead[_0x1a97('0x34')],_0x548ead[_0x1a97('0x35')]);_0x5982af[_0x1a97('0x39')]=_['intersection'](_0x548ead[_0x1a97('0x34')],qs['fields'](_0x5650f2[_0x1a97('0x35')][_0x1a97('0x3a')]));_0x5982af['attributes']=_0x5982af['attributes'][_0x1a97('0x3b')]?_0x5982af[_0x1a97('0x39')]:_0x548ead[_0x1a97('0x34')];if(_0x5650f2[_0x1a97('0x35')][_0x1a97('0x46')]){_0x5982af[_0x1a97('0x47')]=[{'all':!![]}];}_0x5982af=_[_0x1a97('0x42')]({},_0x5982af,_0x5650f2[_0x1a97('0x45')]);return db[_0x1a97('0x2f')]['find'](_0x5982af)[_0x1a97('0x26')](handleEntityNotFound(_0x2a0b18,null))[_0x1a97('0x26')](respondWithResult(_0x2a0b18,null))[_0x1a97('0x49')](handleError(_0x2a0b18,null));};exports[_0x1a97('0x4b')]=function(_0xf6a273,_0x1357e2){return db[_0x1a97('0x2f')][_0x1a97('0x4b')](_0xf6a273[_0x1a97('0x4c')],{})[_0x1a97('0x26')](function(_0x47c800){var _0x1d1748=_0xf6a273[_0x1a97('0x4d')]['get']({'plain':!![]});if(!_0x1d1748)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d1748[_0x1a97('0x4e')]==='user'){var _0x37b126=_0x47c800['get']({'plain':!![]});var _0x342961='CmHopperAdditionalPhones';return db[_0x1a97('0x4f')]['find']({'where':{'name':_0x342961,'userProfileId':_0x1d1748[_0x1a97('0x50')]},'raw':!![]})['then'](function(_0xbf1615){if(_0xbf1615&&_0xbf1615[_0x1a97('0x51')]===0x0){return db[_0x1a97('0x28')][_0x1a97('0x4b')]({'name':_0x37b126[_0x1a97('0x44')],'resourceId':_0x37b126['id'],'type':_0xbf1615['name'],'sectionId':_0xbf1615['id']},{})[_0x1a97('0x26')](function(){return _0x47c800;});}else{return _0x47c800;}})[_0x1a97('0x49')](function(_0x496042){logger[_0x1a97('0x2a')](_0x1a97('0x52'),_0x496042);throw _0x496042;});}return _0x47c800;})[_0x1a97('0x26')](respondWithResult(_0x1357e2,0xc9))[_0x1a97('0x49')](handleError(_0x1357e2,null));};exports[_0x1a97('0x53')]=function(_0x1f828a,_0x462d59){if(_0x1f828a[_0x1a97('0x4c')]['id']){delete _0x1f828a['body']['id'];}return db[_0x1a97('0x2f')][_0x1a97('0x54')]({'where':{'id':_0x1f828a[_0x1a97('0x55')]['id']}})[_0x1a97('0x26')](handleEntityNotFound(_0x462d59,null))['then'](saveUpdates(_0x1f828a[_0x1a97('0x4c')],null))[_0x1a97('0x26')](respondWithResult(_0x462d59,null))[_0x1a97('0x49')](handleError(_0x462d59,null));};exports['destroy']=function(_0x46d248,_0x2fa485){return db[_0x1a97('0x2f')]['find']({'where':{'id':_0x46d248['params']['id']}})['then'](handleEntityNotFound(_0x2fa485,null))[_0x1a97('0x26')](removeEntity(_0x2fa485,null))[_0x1a97('0x49')](handleError(_0x2fa485,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index b4009df..a1ad3f8 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 _0xb468=['path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone','cm_hopper_additional_phones','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5ded96,_0x35805c){var _0x3cd145=function(_0x324285){while(--_0x324285){_0x5ded96['push'](_0x5ded96['shift']());}};_0x3cd145(++_0x35805c);}(_0xb468,0x1b7));var _0x8b46=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xb468[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8b46('0x0'))(_0x8b46('0x1'));var moment=require(_0x8b46('0x2'));var BPromise=require(_0x8b46('0x3'));var rp=require(_0x8b46('0x4'));var fs=require('fs');var path=require(_0x8b46('0x5'));var rimraf=require(_0x8b46('0x6'));var config=require(_0x8b46('0x7'));var attributes=require(_0x8b46('0x8'));module[_0x8b46('0x9')]=function(_0x54a293,_0x50f6ba){return _0x54a293['define'](_0x8b46('0xa'),attributes,{'tableName':_0x8b46('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b3a=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports','define','CmHopperAdditionalPhone'];(function(_0x3a11ab,_0x3f2562){var _0x524541=function(_0x686a9){while(--_0x686a9){_0x3a11ab['push'](_0x3a11ab['shift']());}};_0x524541(++_0x3f2562);}(_0x0b3a,0x9a));var _0xa0b3=function(_0x2af160,_0x765b1){_0x2af160=_0x2af160-0x0;var _0x439d67=_0x0b3a[_0x2af160];return _0x439d67;};'use strict';var _=require(_0xa0b3('0x0'));var util=require(_0xa0b3('0x1'));var logger=require(_0xa0b3('0x2'))(_0xa0b3('0x3'));var moment=require(_0xa0b3('0x4'));var BPromise=require('bluebird');var rp=require(_0xa0b3('0x5'));var fs=require('fs');var path=require(_0xa0b3('0x6'));var rimraf=require(_0xa0b3('0x7'));var config=require('../../config/environment');var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xa0b3('0x8')]=function(_0x156bff,_0x30d509){return _0x156bff[_0xa0b3('0x9')](_0xa0b3('0xa'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 38bbee9..d5ae887 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 _0x2f3a=['CmHopperAdditionalPhone','OrderBy','ASC','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countbusyretry','countnoanswerretry','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','transaction','update','activateAdditionalPhone','field','IncrementPreviewCounters','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId'];(function(_0x23c01d,_0x3aa26d){var _0x506a34=function(_0x49c07a){while(--_0x49c07a){_0x23c01d['push'](_0x23c01d['shift']());}};_0x506a34(++_0x3aa26d);}(_0x2f3a,0x195));var _0xa2f3=function(_0x3b2c24,_0x1cee91){_0x3b2c24=_0x3b2c24-0x0;var _0x166618=_0x2f3a[_0x3b2c24];return _0x166618;};'use strict';var _=require('lodash');var util=require(_0xa2f3('0x0'));var moment=require('moment');var BPromise=require(_0xa2f3('0x1'));var rs=require(_0xa2f3('0x2'));var fs=require('fs');var Redis=require(_0xa2f3('0x3'));var db=require(_0xa2f3('0x4'))['db'];var utils=require(_0xa2f3('0x5'));var logger=require('../../config/logger')(_0xa2f3('0x6'));var config=require(_0xa2f3('0x7'));var jayson=require(_0xa2f3('0x8'));var client=jayson['client'][_0xa2f3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f8502,_0x23b7dd,_0x2bf7d0){return new BPromise(function(_0x41b31d,_0x143b95){return client[_0xa2f3('0xa')](_0x4f8502,_0x2bf7d0)[_0xa2f3('0xb')](function(_0x11026f){logger['info'](_0xa2f3('0xc'),_0x23b7dd,_0xa2f3('0xd'));logger[_0xa2f3('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x23b7dd,_0xa2f3('0xd'),JSON['stringify'](_0x11026f));if(_0x11026f['error']){if(_0x11026f[_0xa2f3('0xf')][_0xa2f3('0x10')]===0x1f4){logger[_0xa2f3('0xf')](_0xa2f3('0xc'),_0x23b7dd,_0x11026f['error'][_0xa2f3('0x11')]);return _0x143b95(_0x11026f[_0xa2f3('0xf')][_0xa2f3('0x11')]);}logger[_0xa2f3('0xf')](_0xa2f3('0xc'),_0x23b7dd,_0x11026f['error'][_0xa2f3('0x11')]);return _0x41b31d(_0x11026f[_0xa2f3('0xf')][_0xa2f3('0x11')]);}else{logger['info'](_0xa2f3('0xc'),_0x23b7dd,_0xa2f3('0xd'));_0x41b31d(_0x11026f['result'][_0xa2f3('0x11')]);}})[_0xa2f3('0x12')](function(_0x1e097c){logger[_0xa2f3('0xf')](_0xa2f3('0xc'),_0x23b7dd,_0x1e097c);_0x143b95(_0x1e097c);});});}exports[_0xa2f3('0x13')]=function(_0x13255b){var _0xe4bf8d=this;return new Promise(function(_0x519f3b,_0x173987){return db[_0xa2f3('0x14')][_0xa2f3('0x15')]({'raw':!![],'where':{'ContactId':_0x13255b[_0xa2f3('0x16')][_0xa2f3('0x17')],'ListId':_0x13255b[_0xa2f3('0x16')][_0xa2f3('0x18')],'VoiceQueueId':_0x13255b[_0xa2f3('0x16')][_0xa2f3('0x19')]===undefined?null:_0x13255b[_0xa2f3('0x16')][_0xa2f3('0x19')],'CampaignId':_0x13255b[_0xa2f3('0x16')][_0xa2f3('0x1a')]===undefined?null:_0x13255b[_0xa2f3('0x16')][_0xa2f3('0x1a')]}})['then'](function(_0x1faca5){if(_0x1faca5!=null){return db[_0xa2f3('0x1b')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x1faca5['id'],'OrderBy':{'$gt':_0x1faca5[_0xa2f3('0x1c')]}},'order':[[_0xa2f3('0x1c'),_0xa2f3('0x1d')]]})['then'](function(_0xe32cdd){var _0x9b3fc6=0x0;if(_0xe32cdd){if(_0xe32cdd['countbusyretry']+_0xe32cdd[_0xa2f3('0x1e')]+_0xe32cdd['countnoanswerretry']+_0xe32cdd[_0xa2f3('0x1f')]+_0xe32cdd[_0xa2f3('0x20')]+_0xe32cdd[_0xa2f3('0x21')]+_0xe32cdd[_0xa2f3('0x22')]+_0xe32cdd[_0xa2f3('0x23')]<_0x13255b[_0xa2f3('0x24')][_0xa2f3('0x25')])_0x9b3fc6=0x1;_0x519f3b({'additional':_0x9b3fc6});}else{return db['CmHopperAdditionalPhone'][_0xa2f3('0x15')]({'raw':!![],'where':{'CmHopperId':_0x1faca5['id']},'order':[['OrderBy',_0xa2f3('0x1d')]]})[_0xa2f3('0xb')](function(_0x2a09e0){var _0x6b9f68=0x0;if(_0x2a09e0){if(_0x2a09e0[_0xa2f3('0x26')]+_0x2a09e0[_0xa2f3('0x1e')]+_0x2a09e0[_0xa2f3('0x27')]+_0x2a09e0[_0xa2f3('0x1f')]+_0x2a09e0[_0xa2f3('0x20')]+_0x2a09e0[_0xa2f3('0x21')]+_0x2a09e0[_0xa2f3('0x22')]+_0x2a09e0[_0xa2f3('0x23')]<_0x13255b[_0xa2f3('0x24')][_0xa2f3('0x25')])_0x6b9f68=0x1;_0x519f3b({'additional':_0x6b9f68});}else{_0x519f3b({'additional':0x0});}})[_0xa2f3('0x12')](function(_0x33d33d){logger['error'](_0xa2f3('0x13'),_0x33d33d[_0xa2f3('0x11')]);_0x173987(_0xe4bf8d[_0xa2f3('0xf')](0x1f4,_0x33d33d['message']));});}})[_0xa2f3('0x12')](function(_0x434a12){logger[_0xa2f3('0xf')]('VerifyAdditionalPhones',_0x434a12[_0xa2f3('0x11')]);_0x173987(_0xe4bf8d[_0xa2f3('0xf')](0x1f4,_0x434a12[_0xa2f3('0x11')]));});}else _0x519f3b({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x433bd8){var _0x54b278=this;return new Promise(function(_0x5335fe,_0x16962c){return db[_0xa2f3('0x14')][_0xa2f3('0x15')]({'raw':!![],'where':{'ContactId':_0x433bd8[_0xa2f3('0x16')]['ContactId'],'ListId':_0x433bd8[_0xa2f3('0x16')][_0xa2f3('0x18')],'VoiceQueueId':_0x433bd8[_0xa2f3('0x16')][_0xa2f3('0x19')]===undefined?null:_0x433bd8[_0xa2f3('0x16')][_0xa2f3('0x19')],'CampaignId':_0x433bd8[_0xa2f3('0x16')][_0xa2f3('0x1a')]===undefined?null:_0x433bd8['body'][_0xa2f3('0x1a')]}})[_0xa2f3('0xb')](function(_0x38c628){if(_0x38c628!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x38c628['id'],'OrderBy':{'$gte':_0x38c628[_0xa2f3('0x1c')]}},'order':[[_0xa2f3('0x1c'),'ASC']]})[_0xa2f3('0xb')](function(_0x4ec1ee){if(_0x4ec1ee)return activateAdditionalPhone(_0x38c628,_0x433bd8[_0xa2f3('0x16')],_0x4ec1ee,_0x433bd8['duration'],_0x433bd8['waitTime'])[_0xa2f3('0xb')](function(_0x27c3a7){_0x5335fe(_0x27c3a7);});else{return db['CmHopperAdditionalPhone'][_0xa2f3('0x15')]({'raw':!![],'where':{'CmHopperId':_0x38c628['id']},'order':[['OrderBy',_0xa2f3('0x1d')]]})[_0xa2f3('0xb')](function(_0x26a823){if(_0x26a823)return activateAdditionalPhone(_0x38c628,_0x433bd8[_0xa2f3('0x16')],_0x26a823,_0x433bd8[_0xa2f3('0x28')],_0x433bd8[_0xa2f3('0x29')])[_0xa2f3('0xb')](function(_0x2a534b){_0x5335fe(_0x2a534b);});else{_0x5335fe({'id':_0x38c628['id'],'phone':''});}})[_0xa2f3('0x12')](function(_0x39a588){logger[_0xa2f3('0xf')]('VerifyAdditionalPhones',_0x39a588[_0xa2f3('0x11')]);_0x16962c(_0x54b278[_0xa2f3('0xf')](0x1f4,_0x39a588[_0xa2f3('0x11')]));});}})[_0xa2f3('0x12')](function(_0x7a51c1){logger[_0xa2f3('0xf')](_0xa2f3('0x13'),_0x7a51c1[_0xa2f3('0x11')]);_0x16962c(_0x54b278[_0xa2f3('0xf')](0x1f4,_0x7a51c1[_0xa2f3('0x11')]));});}else _0x5335fe(0x1);});});};function activateAdditionalPhone(_0x23a410,_0x2335b3,_0x33f94d,_0x4db9f5,_0x12c715){return new Promise(function(_0xc823eb,_0x2f7e3b){var _0x3d9f7d;if(_[_0xa2f3('0x2a')](_0x33f94d['scheduledat'])){_0x33f94d[_0xa2f3('0x2b')]=moment();}if(moment()>moment(_0x33f94d[_0xa2f3('0x2b')])){_0x3d9f7d=moment()[_0xa2f3('0x2c')](_0x12c715||0x3,_0xa2f3('0x2d'));}else{if(_0x33f94d[_0xa2f3('0x1c')]==0x0){_0x3d9f7d=moment(_0x33f94d[_0xa2f3('0x2b')]);}else{_0x3d9f7d=moment()[_0xa2f3('0x2c')](_0x12c715||0x3,_0xa2f3('0x2d'));}}if(_['isNil'](_0x3d9f7d)){_0x3d9f7d=moment()[_0xa2f3('0x2c')](_0x12c715||0x3,_0xa2f3('0x2d'));}var _0x50df68={'phone':_0x23a410[_0xa2f3('0x2e')],'active':0x0,'OrderBy':_[_0xa2f3('0x2a')](_0x23a410[_0xa2f3('0x1c')])?0x0:_0x23a410['OrderBy'],'scheduledat':moment()[_0xa2f3('0x2c')](_0x4db9f5||0x1,_0xa2f3('0x2d')),'countbusyretry':_0x2335b3['countbusyretry'],'countcongestionretry':_0x2335b3[_0xa2f3('0x1e')],'countnoanswerretry':_0x2335b3['countnoanswerretry'],'countnosuchnumberretry':_0x2335b3[_0xa2f3('0x1f')],'countdropretry':_0x2335b3[_0xa2f3('0x20')],'countabandonedretry':_0x2335b3['countabandonedretry'],'countmachineretry':_0x2335b3['countmachineretry'],'countagentrejectretry':_0x2335b3[_0xa2f3('0x23')],'createdAt':_0x2335b3[_0xa2f3('0x2f')],'updatedAt':_0x2335b3[_0xa2f3('0x30')]};var _0x4e1d4f={'CmHopperId':_0x23a410['id'],'phone':_0x33f94d['phone'],'active':0x0,'OrderBy':_['isNil'](_0x33f94d[_0xa2f3('0x1c')])?0x0:_0x33f94d['OrderBy'],'scheduledat':_0x3d9f7d,'countbusyretry':_0x33f94d['countbusyretry'],'countcongestionretry':_0x33f94d[_0xa2f3('0x1e')],'countnoanswerretry':_0x33f94d[_0xa2f3('0x27')],'countnosuchnumberretry':_0x33f94d['countnosuchnumberretry'],'countdropretry':_0x33f94d[_0xa2f3('0x20')],'countabandonedretry':_0x33f94d['countabandonedretry'],'countmachineretry':_0x33f94d[_0xa2f3('0x22')],'countagentrejectretry':_0x33f94d[_0xa2f3('0x23')],'createdAt':_0x33f94d[_0xa2f3('0x2f')],'updatedAt':_0x33f94d['updatedAt']};return db['sequelize'][_0xa2f3('0x31')](function(_0x456af1){return db[_0xa2f3('0x1b')][_0xa2f3('0x32')](_0x50df68,{'where':{'id':_0x33f94d['id']}},{'transaction':_0x456af1})[_0xa2f3('0xb')](function(){return db[_0xa2f3('0x14')][_0xa2f3('0x32')](_0x4e1d4f,{'where':{'id':_0x23a410['id']}},{'transaction':_0x456af1});});})[_0xa2f3('0xb')](function(_0x10a0ba){_0xc823eb({'id':_0x23a410['id'],'phone':_0x33f94d[_0xa2f3('0x2e')]});})['catch'](function(_0x2aebc5){logger[_0xa2f3('0xf')](_0xa2f3('0x33'),_0x2aebc5[_0xa2f3('0x11')]);_0x2f7e3b({'error':_0x2aebc5[_0xa2f3('0x11')]});});});}exports['IncrementPreviewCounters']=function(_0x3e921d){var _0x73baf=this;return new Promise(function(_0xa863e7,_0x58335a){return db[_0xa2f3('0x14')]['update'](_0x3e921d[_0xa2f3('0x16')][_0xa2f3('0x34')],{'where':{'id':_0x3e921d[_0xa2f3('0x16')]['id']}})['then'](function(_0x317043){_0xa863e7(_0x317043);})['catch'](function(_0x52e271){logger[_0xa2f3('0xf')](_0xa2f3('0x35'),_0x52e271[_0xa2f3('0x11')]);_0x58335a(_0x73baf[_0xa2f3('0xf')](0x1f4,_0x52e271['message']));});});}; \ No newline at end of file +var _0xb552=['countnosuchnumberretry','createdAt','updatedAt','sequelize','transaction','update','phone','field','IncrementPreviewCounters','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countagentrejectretry','entity','dialGlobalMaxRetry','countdropretry','countmachineretry','SwapAdditionalPhones','ContactId','duration','waitTime','isNil','scheduledat','add','minutes'];(function(_0x3ff009,_0x1a3994){var _0x4346bf=function(_0x14350a){while(--_0x14350a){_0x3ff009['push'](_0x3ff009['shift']());}};_0x4346bf(++_0x1a3994);}(_0xb552,0x1d9));var _0x2b55=function(_0x5566f9,_0xa2899d){_0x5566f9=_0x5566f9-0x0;var _0x246527=_0xb552[_0x5566f9];return _0x246527;};'use strict';var _=require('lodash');var util=require(_0x2b55('0x0'));var moment=require('moment');var BPromise=require(_0x2b55('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b55('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2b55('0x3'));var logger=require(_0x2b55('0x4'))(_0x2b55('0x5'));var config=require(_0x2b55('0x6'));var jayson=require(_0x2b55('0x7'));var client=jayson[_0x2b55('0x8')][_0x2b55('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x373178,_0x562ce9,_0x43d57c){return new BPromise(function(_0x1c4bc8,_0x46ba0e){return client[_0x2b55('0xa')](_0x373178,_0x43d57c)[_0x2b55('0xb')](function(_0x57b0c5){logger[_0x2b55('0xc')](_0x2b55('0xd'),_0x562ce9,_0x2b55('0xe'));logger[_0x2b55('0xf')](_0x2b55('0x10'),_0x562ce9,_0x2b55('0xe'),JSON[_0x2b55('0x11')](_0x57b0c5));if(_0x57b0c5['error']){if(_0x57b0c5[_0x2b55('0x12')][_0x2b55('0x13')]===0x1f4){logger[_0x2b55('0x12')](_0x2b55('0xd'),_0x562ce9,_0x57b0c5[_0x2b55('0x12')]['message']);return _0x46ba0e(_0x57b0c5[_0x2b55('0x12')][_0x2b55('0x14')]);}logger[_0x2b55('0x12')](_0x2b55('0xd'),_0x562ce9,_0x57b0c5['error'][_0x2b55('0x14')]);return _0x1c4bc8(_0x57b0c5['error'][_0x2b55('0x14')]);}else{logger[_0x2b55('0xc')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x562ce9,_0x2b55('0xe'));_0x1c4bc8(_0x57b0c5['result'][_0x2b55('0x14')]);}})[_0x2b55('0x15')](function(_0x2523e9){logger[_0x2b55('0x12')](_0x2b55('0xd'),_0x562ce9,_0x2523e9);_0x46ba0e(_0x2523e9);});});}exports[_0x2b55('0x16')]=function(_0x175f91){var _0x3e6d6b=this;return new Promise(function(_0x568047,_0x38d673){return db[_0x2b55('0x17')][_0x2b55('0x18')]({'raw':!![],'where':{'ContactId':_0x175f91[_0x2b55('0x19')]['ContactId'],'ListId':_0x175f91[_0x2b55('0x19')][_0x2b55('0x1a')],'VoiceQueueId':_0x175f91[_0x2b55('0x19')][_0x2b55('0x1b')]===undefined?null:_0x175f91[_0x2b55('0x19')]['VoiceQueueId'],'CampaignId':_0x175f91[_0x2b55('0x19')][_0x2b55('0x1c')]===undefined?null:_0x175f91[_0x2b55('0x19')][_0x2b55('0x1c')]}})[_0x2b55('0xb')](function(_0x485af8){if(_0x485af8!=null){return db[_0x2b55('0x1d')][_0x2b55('0x18')]({'raw':!![],'where':{'CmHopperId':_0x485af8['id'],'OrderBy':{'$gt':_0x485af8[_0x2b55('0x1e')]}},'order':[[_0x2b55('0x1e'),_0x2b55('0x1f')]]})['then'](function(_0x25813e){var _0x480f60=0x0;if(_0x25813e){if(_0x25813e[_0x2b55('0x20')]+_0x25813e[_0x2b55('0x21')]+_0x25813e[_0x2b55('0x22')]+_0x25813e['countnosuchnumberretry']+_0x25813e['countdropretry']+_0x25813e[_0x2b55('0x23')]+_0x25813e['countmachineretry']+_0x25813e[_0x2b55('0x24')]<_0x175f91[_0x2b55('0x25')][_0x2b55('0x26')])_0x480f60=0x1;_0x568047({'additional':_0x480f60});}else{return db[_0x2b55('0x1d')][_0x2b55('0x18')]({'raw':!![],'where':{'CmHopperId':_0x485af8['id']},'order':[[_0x2b55('0x1e'),'ASC']]})[_0x2b55('0xb')](function(_0x5c54d9){var _0x39e3d8=0x0;if(_0x5c54d9){if(_0x5c54d9[_0x2b55('0x20')]+_0x5c54d9[_0x2b55('0x21')]+_0x5c54d9[_0x2b55('0x22')]+_0x5c54d9['countnosuchnumberretry']+_0x5c54d9[_0x2b55('0x27')]+_0x5c54d9['countabandonedretry']+_0x5c54d9[_0x2b55('0x28')]+_0x5c54d9[_0x2b55('0x24')]<_0x175f91[_0x2b55('0x25')][_0x2b55('0x26')])_0x39e3d8=0x1;_0x568047({'additional':_0x39e3d8});}else{_0x568047({'additional':0x0});}})[_0x2b55('0x15')](function(_0x23ea33){logger[_0x2b55('0x12')](_0x2b55('0x16'),_0x23ea33[_0x2b55('0x14')]);_0x38d673(_0x3e6d6b[_0x2b55('0x12')](0x1f4,_0x23ea33[_0x2b55('0x14')]));});}})['catch'](function(_0x224734){logger['error'](_0x2b55('0x16'),_0x224734[_0x2b55('0x14')]);_0x38d673(_0x3e6d6b['error'](0x1f4,_0x224734[_0x2b55('0x14')]));});}else _0x568047({'additional':0x0});});});};exports[_0x2b55('0x29')]=function(_0x19c588){var _0x336c66=this;return new Promise(function(_0x292175,_0x3db679){return db[_0x2b55('0x17')][_0x2b55('0x18')]({'raw':!![],'where':{'ContactId':_0x19c588[_0x2b55('0x19')][_0x2b55('0x2a')],'ListId':_0x19c588['body'][_0x2b55('0x1a')],'VoiceQueueId':_0x19c588['body']['VoiceQueueId']===undefined?null:_0x19c588['body'][_0x2b55('0x1b')],'CampaignId':_0x19c588[_0x2b55('0x19')][_0x2b55('0x1c')]===undefined?null:_0x19c588[_0x2b55('0x19')]['CampaignId']}})[_0x2b55('0xb')](function(_0x1b786a){if(_0x1b786a!=null){return db['CmHopperAdditionalPhone'][_0x2b55('0x18')]({'raw':!![],'where':{'CmHopperId':_0x1b786a['id'],'OrderBy':{'$gte':_0x1b786a['OrderBy']}},'order':[[_0x2b55('0x1e'),_0x2b55('0x1f')]]})[_0x2b55('0xb')](function(_0xe09156){if(_0xe09156)return activateAdditionalPhone(_0x1b786a,_0x19c588[_0x2b55('0x19')],_0xe09156,_0x19c588[_0x2b55('0x2b')],_0x19c588[_0x2b55('0x2c')])[_0x2b55('0xb')](function(_0x1d0ea6){_0x292175(_0x1d0ea6);});else{return db[_0x2b55('0x1d')][_0x2b55('0x18')]({'raw':!![],'where':{'CmHopperId':_0x1b786a['id']},'order':[[_0x2b55('0x1e'),_0x2b55('0x1f')]]})[_0x2b55('0xb')](function(_0x147018){if(_0x147018)return activateAdditionalPhone(_0x1b786a,_0x19c588['body'],_0x147018,_0x19c588[_0x2b55('0x2b')],_0x19c588[_0x2b55('0x2c')])[_0x2b55('0xb')](function(_0x4c9bf2){_0x292175(_0x4c9bf2);});else{_0x292175({'id':_0x1b786a['id'],'phone':''});}})[_0x2b55('0x15')](function(_0x44552f){logger[_0x2b55('0x12')](_0x2b55('0x16'),_0x44552f[_0x2b55('0x14')]);_0x3db679(_0x336c66[_0x2b55('0x12')](0x1f4,_0x44552f[_0x2b55('0x14')]));});}})[_0x2b55('0x15')](function(_0x225bbd){logger[_0x2b55('0x12')](_0x2b55('0x16'),_0x225bbd[_0x2b55('0x14')]);_0x3db679(_0x336c66[_0x2b55('0x12')](0x1f4,_0x225bbd[_0x2b55('0x14')]));});}else _0x292175(0x1);});});};function activateAdditionalPhone(_0x5f5084,_0x45f9c5,_0x5d9ca4,_0x51af26,_0x157f68){return new Promise(function(_0x5f36d0,_0x4a2e27){var _0x40d81e;if(_[_0x2b55('0x2d')](_0x5d9ca4['scheduledat'])){_0x5d9ca4[_0x2b55('0x2e')]=moment();}if(moment()>moment(_0x5d9ca4[_0x2b55('0x2e')])){_0x40d81e=moment()[_0x2b55('0x2f')](_0x157f68||0x3,_0x2b55('0x30'));}else{if(_0x5d9ca4[_0x2b55('0x1e')]==0x0){_0x40d81e=moment(_0x5d9ca4[_0x2b55('0x2e')]);}else{_0x40d81e=moment()[_0x2b55('0x2f')](_0x157f68||0x3,_0x2b55('0x30'));}}if(_[_0x2b55('0x2d')](_0x40d81e)){_0x40d81e=moment()[_0x2b55('0x2f')](_0x157f68||0x3,_0x2b55('0x30'));}var _0x3d9f7c={'phone':_0x5f5084['phone'],'active':0x0,'OrderBy':_[_0x2b55('0x2d')](_0x5f5084[_0x2b55('0x1e')])?0x0:_0x5f5084[_0x2b55('0x1e')],'scheduledat':moment()[_0x2b55('0x2f')](_0x51af26||0x1,'minutes'),'countbusyretry':_0x45f9c5[_0x2b55('0x20')],'countcongestionretry':_0x45f9c5[_0x2b55('0x21')],'countnoanswerretry':_0x45f9c5[_0x2b55('0x22')],'countnosuchnumberretry':_0x45f9c5[_0x2b55('0x31')],'countdropretry':_0x45f9c5[_0x2b55('0x27')],'countabandonedretry':_0x45f9c5[_0x2b55('0x23')],'countmachineretry':_0x45f9c5[_0x2b55('0x28')],'countagentrejectretry':_0x45f9c5[_0x2b55('0x24')],'createdAt':_0x45f9c5[_0x2b55('0x32')],'updatedAt':_0x45f9c5[_0x2b55('0x33')]};var _0x4ea56c={'CmHopperId':_0x5f5084['id'],'phone':_0x5d9ca4['phone'],'active':0x0,'OrderBy':_[_0x2b55('0x2d')](_0x5d9ca4[_0x2b55('0x1e')])?0x0:_0x5d9ca4[_0x2b55('0x1e')],'scheduledat':_0x40d81e,'countbusyretry':_0x5d9ca4[_0x2b55('0x20')],'countcongestionretry':_0x5d9ca4['countcongestionretry'],'countnoanswerretry':_0x5d9ca4['countnoanswerretry'],'countnosuchnumberretry':_0x5d9ca4[_0x2b55('0x31')],'countdropretry':_0x5d9ca4[_0x2b55('0x27')],'countabandonedretry':_0x5d9ca4[_0x2b55('0x23')],'countmachineretry':_0x5d9ca4[_0x2b55('0x28')],'countagentrejectretry':_0x5d9ca4[_0x2b55('0x24')],'createdAt':_0x5d9ca4[_0x2b55('0x32')],'updatedAt':_0x5d9ca4[_0x2b55('0x33')]};return db[_0x2b55('0x34')][_0x2b55('0x35')](function(_0x248bce){return db[_0x2b55('0x1d')][_0x2b55('0x36')](_0x3d9f7c,{'where':{'id':_0x5d9ca4['id']}},{'transaction':_0x248bce})[_0x2b55('0xb')](function(){return db['CmHopper']['update'](_0x4ea56c,{'where':{'id':_0x5f5084['id']}},{'transaction':_0x248bce});});})[_0x2b55('0xb')](function(_0x5a0e4b){_0x5f36d0({'id':_0x5f5084['id'],'phone':_0x5d9ca4[_0x2b55('0x37')]});})[_0x2b55('0x15')](function(_0xc55428){logger[_0x2b55('0x12')]('activateAdditionalPhone',_0xc55428[_0x2b55('0x14')]);_0x4a2e27({'error':_0xc55428[_0x2b55('0x14')]});});});}exports['IncrementPreviewCounters']=function(_0x166b82){var _0x5b8762=this;return new Promise(function(_0x59827f,_0xde9418){return db[_0x2b55('0x17')][_0x2b55('0x36')](_0x166b82[_0x2b55('0x19')][_0x2b55('0x38')],{'where':{'id':_0x166b82[_0x2b55('0x19')]['id']}})[_0x2b55('0xb')](function(_0x5a7c3b){_0x59827f(_0x5a7c3b);})[_0x2b55('0x15')](function(_0x5e73f9){logger[_0x2b55('0x12')](_0x2b55('0x39'),_0x5e73f9['message']);_0xde9418(_0x5b8762['error'](0x1f4,_0x5e73f9[_0x2b55('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 4717689..c774cc3 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 _0x7f93=['delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0x364e79,_0x6e95d4){var _0x2221ef=function(_0x485f55){while(--_0x485f55){_0x364e79['push'](_0x364e79['shift']());}};_0x2221ef(++_0x6e95d4);}(_0x7f93,0x1a6));var _0x37f9=function(_0x4e9871,_0x2c3038){_0x4e9871=_0x4e9871-0x0;var _0x49372c=_0x7f93[_0x4e9871];return _0x49372c;};'use strict';var multer=require(_0x37f9('0x0'));var util=require(_0x37f9('0x1'));var path=require('path');var timeout=require(_0x37f9('0x2'));var express=require(_0x37f9('0x3'));var router=express[_0x37f9('0x4')]();var fs_extra=require(_0x37f9('0x5'));var auth=require(_0x37f9('0x6'));var interaction=require(_0x37f9('0x7'));var config=require(_0x37f9('0x8'));var controller=require(_0x37f9('0x9'));router[_0x37f9('0xa')]('/',auth[_0x37f9('0xb')](),controller[_0x37f9('0xc')]);router['get'](_0x37f9('0xd'),auth[_0x37f9('0xb')](),controller[_0x37f9('0xe')]);router[_0x37f9('0xf')]('/',auth['isAuthenticated'](),controller[_0x37f9('0x10')]);router['put']('/:id',auth[_0x37f9('0xb')](),controller[_0x37f9('0x11')]);router[_0x37f9('0x12')](_0x37f9('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x37f9('0x13')]=router; \ No newline at end of file +var _0x07be=['put','/:id','update','delete','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','index','get','show','post','create'];(function(_0x12e3e3,_0x501eaf){var _0x26602e=function(_0x427882){while(--_0x427882){_0x12e3e3['push'](_0x12e3e3['shift']());}};_0x26602e(++_0x501eaf);}(_0x07be,0xfb));var _0xe07b=function(_0x1c6937,_0x401124){_0x1c6937=_0x1c6937-0x0;var _0x1aa094=_0x07be[_0x1c6937];return _0x1aa094;};'use strict';var multer=require(_0xe07b('0x0'));var util=require(_0xe07b('0x1'));var path=require(_0xe07b('0x2'));var timeout=require(_0xe07b('0x3'));var express=require('express');var router=express[_0xe07b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe07b('0x5'));var interaction=require(_0xe07b('0x6'));var config=require(_0xe07b('0x7'));var controller=require(_0xe07b('0x8'));router['get']('/',auth[_0xe07b('0x9')](),controller[_0xe07b('0xa')]);router[_0xe07b('0xb')]('/:id',auth[_0xe07b('0x9')](),controller[_0xe07b('0xc')]);router[_0xe07b('0xd')]('/',auth[_0xe07b('0x9')](),controller[_0xe07b('0xe')]);router[_0xe07b('0xf')](_0xe07b('0x10'),auth[_0xe07b('0x9')](),controller[_0xe07b('0x11')]);router[_0xe07b('0x12')](_0xe07b('0x10'),auth['isAuthenticated'](),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 4a55a31..aed01ac 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 _0x3468=['contactListQueue','moment','STRING','INTEGER'];(function(_0x263078,_0xdb379){var _0x238a95=function(_0x4bbba8){while(--_0x4bbba8){_0x263078['push'](_0x263078['shift']());}};_0x238a95(++_0xdb379);}(_0x3468,0x8d));var _0x8346=function(_0x4e2cd8,_0xdfb7ea){_0x4e2cd8=_0x4e2cd8-0x0;var _0x38bc0a=_0x3468[_0x4e2cd8];return _0x38bc0a;};'use strict';var moment=require(_0x8346('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0x8346('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x8346('0x2')],'unique':_0x8346('0x3')},'VoiceQueueId':{'type':Sequelize[_0x8346('0x2')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x9829=['exports','STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0x4b50b9,_0x26cdc9){var _0x5a97d1=function(_0x30a238){while(--_0x30a238){_0x4b50b9['push'](_0x4b50b9['shift']());}};_0x5a97d1(++_0x26cdc9);}(_0x9829,0xc4));var _0x9982=function(_0x421263,_0x18187d){_0x421263=_0x421263-0x0;var _0x34e4b5=_0x9829[_0x421263];return _0x34e4b5;};'use strict';var moment=require(_0x9982('0x0'));var Sequelize=require(_0x9982('0x1'));module[_0x9982('0x2')]={'phone':{'type':Sequelize[_0x9982('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x9982('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x9982('0x4')],'unique':_0x9982('0x5')},'VoiceQueueId':{'type':Sequelize[_0x9982('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index a715526..0487126 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 _0x4d36=['limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filters','merge','filter','options','includeAll','findAll','rows','show','params','find','catch','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4d36,0x159));var _0x64d3=function(_0x4207f4,_0x1f778b){_0x4207f4=_0x4207f4-0x0;var _0x29a621=_0x4d36[_0x4207f4];return _0x29a621;};'use strict';var emlformat=require(_0x64d3('0x0'));var rimraf=require(_0x64d3('0x1'));var zipdir=require(_0x64d3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x64d3('0x3'));var moment=require(_0x64d3('0x4'));var BPromise=require(_0x64d3('0x5'));var Mustache=require(_0x64d3('0x6'));var util=require('util');var path=require(_0x64d3('0x7'));var sox=require(_0x64d3('0x8'));var csv=require(_0x64d3('0x9'));var ejs=require(_0x64d3('0xa'));var fs=require('fs');var fs_extra=require(_0x64d3('0xb'));var _=require(_0x64d3('0xc'));var squel=require(_0x64d3('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x64d3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x64d3('0xf'));var Papa=require(_0x64d3('0x10'));var Redis=require(_0x64d3('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x64d3('0x12'));var hardwareService=require(_0x64d3('0x13'));var logger=require(_0x64d3('0x14'))(_0x64d3('0x15'));var utils=require(_0x64d3('0x16'));var config=require(_0x64d3('0x17'));var licenseUtil=require(_0x64d3('0x18'));var db=require(_0x64d3('0x19'))['db'];function respondWithStatusCode(_0x1686cc,_0x28e3f2){_0x28e3f2=_0x28e3f2||0xcc;return function(_0x4caa41){if(_0x4caa41){return _0x1686cc['sendStatus'](_0x28e3f2);}return _0x1686cc['status'](_0x28e3f2)[_0x64d3('0x1a')]();};}function respondWithResult(_0x1de162,_0x1f59ab){_0x1f59ab=_0x1f59ab||0xc8;return function(_0x3802ea){if(_0x3802ea){return _0x1de162[_0x64d3('0x1b')](_0x1f59ab)[_0x64d3('0x1c')](_0x3802ea);}};}function respondWithFilteredResult(_0x2c0767,_0x5ace2a){return function(_0x4b362a){if(_0x4b362a){var _0x3f4fae=typeof _0x5ace2a[_0x64d3('0x1d')]==='undefined'&&typeof _0x5ace2a[_0x64d3('0x1e')]===_0x64d3('0x1f');var _0x297cfb=_0x4b362a[_0x64d3('0x20')];var _0x47d6cd=_0x3f4fae?0x0:_0x5ace2a[_0x64d3('0x1d')];var _0x279939=_0x3f4fae?_0x4b362a[_0x64d3('0x20')]:_0x5ace2a[_0x64d3('0x1d')]+_0x5ace2a[_0x64d3('0x1e')];var _0x17506e;if(_0x279939>=_0x297cfb){_0x279939=_0x297cfb;_0x17506e=0xc8;}else{_0x17506e=0xce;}_0x2c0767[_0x64d3('0x1b')](_0x17506e);return _0x2c0767[_0x64d3('0x21')](_0x64d3('0x22'),_0x47d6cd+'-'+_0x279939+'/'+_0x297cfb)[_0x64d3('0x1c')](_0x4b362a);}return null;};}function patchUpdates(_0x5e32b7){return function(_0x39174){try{jsonpatch[_0x64d3('0x23')](_0x39174,_0x5e32b7,!![]);}catch(_0x2e16a7){return BPromise[_0x64d3('0x24')](_0x2e16a7);}return _0x39174[_0x64d3('0x25')]();};}function saveUpdates(_0x553128,_0x11a429){return function(_0x44b8a3){if(_0x44b8a3){return _0x44b8a3[_0x64d3('0x26')](_0x553128)[_0x64d3('0x27')](function(_0x59c6d2){return _0x59c6d2;});}return null;};}function removeEntity(_0x1b5e84,_0x252b75){return function(_0x4b4fd3){if(_0x4b4fd3){return _0x4b4fd3[_0x64d3('0x28')]()['then'](function(){_0x1b5e84['status'](0xcc)[_0x64d3('0x1a')]();});}};}function handleEntityNotFound(_0x577c8b,_0x448246){return function(_0x2303b9){if(!_0x2303b9){_0x577c8b[_0x64d3('0x29')](0x194);}return _0x2303b9;};}function handleError(_0xe35229,_0x5134ee){_0x5134ee=_0x5134ee||0x1f4;return function(_0x478309){logger[_0x64d3('0x2a')](_0x478309['stack']);if(_0x478309[_0x64d3('0x2b')]){delete _0x478309[_0x64d3('0x2b')];}_0xe35229[_0x64d3('0x1b')](_0x5134ee)[_0x64d3('0x2c')](_0x478309);};}exports[_0x64d3('0x2d')]=function(_0x34b5b7,_0x3bd8f3){var _0x2364d7={},_0x57ffe5={},_0x324236={'count':0x0,'rows':[]};var _0x581391=_[_0x64d3('0x2e')](db[_0x64d3('0x2f')][_0x64d3('0x30')],function(_0xee39fe){return{'name':_0xee39fe[_0x64d3('0x31')],'type':_0xee39fe[_0x64d3('0x32')][_0x64d3('0x33')]};});_0x57ffe5['model']=_[_0x64d3('0x2e')](_0x581391,'name');_0x57ffe5[_0x64d3('0x34')]=_[_0x64d3('0x35')](_0x34b5b7['query']);_0x57ffe5['filters']=_[_0x64d3('0x36')](_0x57ffe5[_0x64d3('0x37')],_0x57ffe5[_0x64d3('0x34')]);_0x2364d7[_0x64d3('0x38')]=_[_0x64d3('0x36')](_0x57ffe5[_0x64d3('0x37')],qs['fields'](_0x34b5b7[_0x64d3('0x34')][_0x64d3('0x39')]));_0x2364d7['attributes']=_0x2364d7[_0x64d3('0x38')][_0x64d3('0x3a')]?_0x2364d7[_0x64d3('0x38')]:_0x57ffe5[_0x64d3('0x37')];if(!_0x34b5b7[_0x64d3('0x34')][_0x64d3('0x3b')]('nolimit')){_0x2364d7[_0x64d3('0x1e')]=qs[_0x64d3('0x1e')](_0x34b5b7['query'][_0x64d3('0x1e')]);_0x2364d7['offset']=qs[_0x64d3('0x1d')](_0x34b5b7[_0x64d3('0x34')][_0x64d3('0x1d')]);}_0x2364d7['order']=qs[_0x64d3('0x3c')](_0x34b5b7[_0x64d3('0x34')][_0x64d3('0x3c')]);_0x2364d7[_0x64d3('0x3d')]=qs[_0x64d3('0x3e')](_['pick'](_0x34b5b7[_0x64d3('0x34')],_0x57ffe5['filters']),_0x581391);if(_0x34b5b7['query']['filter']){_0x2364d7['where']=_[_0x64d3('0x3f')](_0x2364d7[_0x64d3('0x3d')],{'$or':_[_0x64d3('0x2e')](_0x581391,function(_0x40fe9d){if(_0x40fe9d[_0x64d3('0x32')]!=='VIRTUAL'){var _0x5d3c5e={};_0x5d3c5e[_0x40fe9d[_0x64d3('0x2b')]]={'$like':'%'+_0x34b5b7[_0x64d3('0x34')][_0x64d3('0x40')]+'%'};return _0x5d3c5e;}})});}_0x2364d7=_[_0x64d3('0x3f')]({},_0x2364d7,_0x34b5b7[_0x64d3('0x41')]);var _0x1564ec={'where':_0x2364d7[_0x64d3('0x3d')]};return db[_0x64d3('0x2f')]['count'](_0x1564ec)[_0x64d3('0x27')](function(_0x1d1bb1){_0x324236[_0x64d3('0x20')]=_0x1d1bb1;if(_0x34b5b7['query'][_0x64d3('0x42')]){_0x2364d7['include']=[{'all':!![]}];}return db[_0x64d3('0x2f')][_0x64d3('0x43')](_0x2364d7);})[_0x64d3('0x27')](function(_0x3bafd7){_0x324236[_0x64d3('0x44')]=_0x3bafd7;return _0x324236;})[_0x64d3('0x27')](respondWithFilteredResult(_0x3bd8f3,_0x2364d7))['catch'](handleError(_0x3bd8f3,null));};exports[_0x64d3('0x45')]=function(_0x45dc2b,_0x59a04e){var _0x501a14={'raw':!![],'where':{'id':_0x45dc2b[_0x64d3('0x46')]['id']}},_0x5d5dfe={};_0x5d5dfe[_0x64d3('0x37')]=_['keys'](db[_0x64d3('0x2f')][_0x64d3('0x30')]);_0x5d5dfe[_0x64d3('0x34')]=_[_0x64d3('0x35')](_0x45dc2b[_0x64d3('0x34')]);_0x5d5dfe['filters']=_[_0x64d3('0x36')](_0x5d5dfe[_0x64d3('0x37')],_0x5d5dfe[_0x64d3('0x34')]);_0x501a14[_0x64d3('0x38')]=_[_0x64d3('0x36')](_0x5d5dfe['model'],qs[_0x64d3('0x39')](_0x45dc2b['query']['fields']));_0x501a14[_0x64d3('0x38')]=_0x501a14[_0x64d3('0x38')][_0x64d3('0x3a')]?_0x501a14['attributes']:_0x5d5dfe[_0x64d3('0x37')];if(_0x45dc2b[_0x64d3('0x34')][_0x64d3('0x42')]){_0x501a14['include']=[{'all':!![]}];}_0x501a14=_[_0x64d3('0x3f')]({},_0x501a14,_0x45dc2b['options']);return db[_0x64d3('0x2f')][_0x64d3('0x47')](_0x501a14)[_0x64d3('0x27')](handleEntityNotFound(_0x59a04e,null))['then'](respondWithResult(_0x59a04e,null))[_0x64d3('0x48')](handleError(_0x59a04e,null));};exports[_0x64d3('0x26')]=function(_0x3716b4,_0x1970e6){if(_0x3716b4['body']['id']){delete _0x3716b4['body']['id'];}return db[_0x64d3('0x2f')]['find']({'where':{'id':_0x3716b4[_0x64d3('0x46')]['id']}})[_0x64d3('0x27')](handleEntityNotFound(_0x1970e6,null))[_0x64d3('0x27')](saveUpdates(_0x3716b4[_0x64d3('0x49')],null))[_0x64d3('0x27')](respondWithResult(_0x1970e6,null))[_0x64d3('0x48')](handleError(_0x1970e6,null));};exports['destroy']=function(_0x38d793,_0x30891d){return db[_0x64d3('0x2f')][_0x64d3('0x47')]({'where':{'id':_0x38d793[_0x64d3('0x46')]['id']}})['then'](handleEntityNotFound(_0x30891d,null))['then'](removeEntity(_0x30891d,null))[_0x64d3('0x48')](handleError(_0x30891d,null));};exports['describe']=function(_0x344f24,_0x2ab13c){return db[_0x64d3('0x2f')][_0x64d3('0x4a')]()['then'](respondWithResult(_0x2ab13c,null))[_0x64d3('0x48')](handleError(_0x2ab13c,null));}; \ No newline at end of file +var _0x8157=['eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','CmHopperBlack','rawAttributes','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','params','keys','options','find','body','describe'];(function(_0x106629,_0x499504){var _0x770cfb=function(_0x7586b9){while(--_0x7586b9){_0x106629['push'](_0x106629['shift']());}};_0x770cfb(++_0x499504);}(_0x8157,0x128));var _0x7815=function(_0x149083,_0x4047b6){_0x149083=_0x149083-0x0;var _0x4dc74e=_0x8157[_0x149083];return _0x4dc74e;};'use strict';var emlformat=require(_0x7815('0x0'));var rimraf=require(_0x7815('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7815('0x2'));var moment=require(_0x7815('0x3'));var BPromise=require(_0x7815('0x4'));var Mustache=require(_0x7815('0x5'));var util=require(_0x7815('0x6'));var path=require(_0x7815('0x7'));var sox=require('sox');var csv=require(_0x7815('0x8'));var ejs=require(_0x7815('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7815('0xa'));var squel=require(_0x7815('0xb'));var crypto=require(_0x7815('0xc'));var jsforce=require(_0x7815('0xd'));var deskjs=require(_0x7815('0xe'));var toCsv=require(_0x7815('0x8'));var querystring=require('querystring');var Papa=require(_0x7815('0xf'));var Redis=require('ioredis');var authService=require(_0x7815('0x10'));var qs=require(_0x7815('0x11'));var as=require(_0x7815('0x12'));var hardwareService=require(_0x7815('0x13'));var logger=require(_0x7815('0x14'))(_0x7815('0x15'));var utils=require('../../config/utils');var config=require(_0x7815('0x16'));var licenseUtil=require(_0x7815('0x17'));var db=require(_0x7815('0x18'))['db'];function respondWithStatusCode(_0x56bef6,_0x787b9e){_0x787b9e=_0x787b9e||0xcc;return function(_0x3b9400){if(_0x3b9400){return _0x56bef6['sendStatus'](_0x787b9e);}return _0x56bef6[_0x7815('0x19')](_0x787b9e)[_0x7815('0x1a')]();};}function respondWithResult(_0x2fb74a,_0x48eba6){_0x48eba6=_0x48eba6||0xc8;return function(_0xc4c292){if(_0xc4c292){return _0x2fb74a['status'](_0x48eba6)[_0x7815('0x1b')](_0xc4c292);}};}function respondWithFilteredResult(_0x565d2e,_0x85b6b){return function(_0x5de3ad){if(_0x5de3ad){var _0x130c35=typeof _0x85b6b[_0x7815('0x1c')]==='undefined'&&typeof _0x85b6b[_0x7815('0x1d')]===_0x7815('0x1e');var _0x59783f=_0x5de3ad[_0x7815('0x1f')];var _0x52b775=_0x130c35?0x0:_0x85b6b[_0x7815('0x1c')];var _0x5e445d=_0x130c35?_0x5de3ad['count']:_0x85b6b['offset']+_0x85b6b[_0x7815('0x1d')];var _0x32b07a;if(_0x5e445d>=_0x59783f){_0x5e445d=_0x59783f;_0x32b07a=0xc8;}else{_0x32b07a=0xce;}_0x565d2e[_0x7815('0x19')](_0x32b07a);return _0x565d2e['set'](_0x7815('0x20'),_0x52b775+'-'+_0x5e445d+'/'+_0x59783f)['json'](_0x5de3ad);}return null;};}function patchUpdates(_0x49f511){return function(_0x14f054){try{jsonpatch[_0x7815('0x21')](_0x14f054,_0x49f511,!![]);}catch(_0x4840c5){return BPromise[_0x7815('0x22')](_0x4840c5);}return _0x14f054[_0x7815('0x23')]();};}function saveUpdates(_0x216f79,_0xb1afaa){return function(_0x12742a){if(_0x12742a){return _0x12742a[_0x7815('0x24')](_0x216f79)[_0x7815('0x25')](function(_0x13e6f9){return _0x13e6f9;});}return null;};}function removeEntity(_0x554493,_0x1413cc){return function(_0x213664){if(_0x213664){return _0x213664[_0x7815('0x26')]()[_0x7815('0x25')](function(){_0x554493['status'](0xcc)[_0x7815('0x1a')]();});}};}function handleEntityNotFound(_0x5c79d3,_0x274e4f){return function(_0x37cfac){if(!_0x37cfac){_0x5c79d3[_0x7815('0x27')](0x194);}return _0x37cfac;};}function handleError(_0x8dc688,_0x1a2bf8){_0x1a2bf8=_0x1a2bf8||0x1f4;return function(_0x3fdb2b){logger[_0x7815('0x28')](_0x3fdb2b['stack']);if(_0x3fdb2b[_0x7815('0x29')]){delete _0x3fdb2b['name'];}_0x8dc688[_0x7815('0x19')](_0x1a2bf8)[_0x7815('0x2a')](_0x3fdb2b);};}exports[_0x7815('0x2b')]=function(_0x1c7ca3,_0x3f8a00){var _0x2373bd={},_0x53e64a={},_0x4df3be={'count':0x0,'rows':[]};var _0x4e67a9=_[_0x7815('0x2c')](db[_0x7815('0x2d')][_0x7815('0x2e')],function(_0x546daa){return{'name':_0x546daa['fieldName'],'type':_0x546daa[_0x7815('0x2f')]['key']};});_0x53e64a['model']=_[_0x7815('0x2c')](_0x4e67a9,_0x7815('0x29'));_0x53e64a[_0x7815('0x30')]=_['keys'](_0x1c7ca3[_0x7815('0x30')]);_0x53e64a[_0x7815('0x31')]=_[_0x7815('0x32')](_0x53e64a[_0x7815('0x33')],_0x53e64a[_0x7815('0x30')]);_0x2373bd[_0x7815('0x34')]=_[_0x7815('0x32')](_0x53e64a[_0x7815('0x33')],qs[_0x7815('0x35')](_0x1c7ca3[_0x7815('0x30')]['fields']));_0x2373bd['attributes']=_0x2373bd[_0x7815('0x34')][_0x7815('0x36')]?_0x2373bd['attributes']:_0x53e64a['model'];if(!_0x1c7ca3[_0x7815('0x30')][_0x7815('0x37')](_0x7815('0x38'))){_0x2373bd[_0x7815('0x1d')]=qs[_0x7815('0x1d')](_0x1c7ca3[_0x7815('0x30')][_0x7815('0x1d')]);_0x2373bd[_0x7815('0x1c')]=qs[_0x7815('0x1c')](_0x1c7ca3[_0x7815('0x30')][_0x7815('0x1c')]);}_0x2373bd[_0x7815('0x39')]=qs[_0x7815('0x3a')](_0x1c7ca3[_0x7815('0x30')][_0x7815('0x3a')]);_0x2373bd[_0x7815('0x3b')]=qs[_0x7815('0x31')](_['pick'](_0x1c7ca3[_0x7815('0x30')],_0x53e64a[_0x7815('0x31')]),_0x4e67a9);if(_0x1c7ca3[_0x7815('0x30')]['filter']){_0x2373bd['where']=_[_0x7815('0x3c')](_0x2373bd[_0x7815('0x3b')],{'$or':_[_0x7815('0x2c')](_0x4e67a9,function(_0x367ea5){if(_0x367ea5[_0x7815('0x2f')]!==_0x7815('0x3d')){var _0x3836d={};_0x3836d[_0x367ea5[_0x7815('0x29')]]={'$like':'%'+_0x1c7ca3['query'][_0x7815('0x3e')]+'%'};return _0x3836d;}})});}_0x2373bd=_[_0x7815('0x3c')]({},_0x2373bd,_0x1c7ca3['options']);var _0x4d0da3={'where':_0x2373bd[_0x7815('0x3b')]};return db[_0x7815('0x2d')][_0x7815('0x1f')](_0x4d0da3)[_0x7815('0x25')](function(_0x1a8cd3){_0x4df3be[_0x7815('0x1f')]=_0x1a8cd3;if(_0x1c7ca3['query'][_0x7815('0x3f')]){_0x2373bd[_0x7815('0x40')]=[{'all':!![]}];}return db[_0x7815('0x2d')]['findAll'](_0x2373bd);})[_0x7815('0x25')](function(_0x2a8fa6){_0x4df3be[_0x7815('0x41')]=_0x2a8fa6;return _0x4df3be;})[_0x7815('0x25')](respondWithFilteredResult(_0x3f8a00,_0x2373bd))[_0x7815('0x42')](handleError(_0x3f8a00,null));};exports[_0x7815('0x43')]=function(_0x2a960d,_0x41aa95){var _0x1d86c1={'raw':!![],'where':{'id':_0x2a960d[_0x7815('0x44')]['id']}},_0x133e07={};_0x133e07[_0x7815('0x33')]=_[_0x7815('0x45')](db[_0x7815('0x2d')]['rawAttributes']);_0x133e07[_0x7815('0x30')]=_[_0x7815('0x45')](_0x2a960d[_0x7815('0x30')]);_0x133e07[_0x7815('0x31')]=_[_0x7815('0x32')](_0x133e07['model'],_0x133e07[_0x7815('0x30')]);_0x1d86c1['attributes']=_['intersection'](_0x133e07[_0x7815('0x33')],qs[_0x7815('0x35')](_0x2a960d[_0x7815('0x30')][_0x7815('0x35')]));_0x1d86c1[_0x7815('0x34')]=_0x1d86c1['attributes'][_0x7815('0x36')]?_0x1d86c1[_0x7815('0x34')]:_0x133e07['model'];if(_0x2a960d[_0x7815('0x30')][_0x7815('0x3f')]){_0x1d86c1['include']=[{'all':!![]}];}_0x1d86c1=_[_0x7815('0x3c')]({},_0x1d86c1,_0x2a960d[_0x7815('0x46')]);return db[_0x7815('0x2d')][_0x7815('0x47')](_0x1d86c1)[_0x7815('0x25')](handleEntityNotFound(_0x41aa95,null))[_0x7815('0x25')](respondWithResult(_0x41aa95,null))['catch'](handleError(_0x41aa95,null));};exports['update']=function(_0x3ad4dd,_0x23f6e1){if(_0x3ad4dd['body']['id']){delete _0x3ad4dd[_0x7815('0x48')]['id'];}return db[_0x7815('0x2d')][_0x7815('0x47')]({'where':{'id':_0x3ad4dd[_0x7815('0x44')]['id']}})[_0x7815('0x25')](handleEntityNotFound(_0x23f6e1,null))[_0x7815('0x25')](saveUpdates(_0x3ad4dd[_0x7815('0x48')],null))[_0x7815('0x25')](respondWithResult(_0x23f6e1,null))['catch'](handleError(_0x23f6e1,null));};exports['destroy']=function(_0x78797e,_0x408b84){return db[_0x7815('0x2d')]['find']({'where':{'id':_0x78797e[_0x7815('0x44')]['id']}})['then'](handleEntityNotFound(_0x408b84,null))['then'](removeEntity(_0x408b84,null))[_0x7815('0x42')](handleError(_0x408b84,null));};exports[_0x7815('0x49')]=function(_0x2843a5,_0x33ed36){return db[_0x7815('0x2d')][_0x7815('0x49')]()[_0x7815('0x25')](respondWithResult(_0x33ed36,null))['catch'](handleError(_0x33ed36,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 3448d89..2b8d2e5 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 _0xdde2=['api','moment','bluebird','request-promise','./cmHopperBlack.attributes','exports','define','cm_hopper_black','lodash','util','../../config/logger'];(function(_0x25b9f5,_0x259db4){var _0x2f81d0=function(_0x244b09){while(--_0x244b09){_0x25b9f5['push'](_0x25b9f5['shift']());}};_0x2f81d0(++_0x259db4);}(_0xdde2,0x11b));var _0x2dde=function(_0x19a669,_0x1719a8){_0x19a669=_0x19a669-0x0;var _0x4522bf=_0xdde2[_0x19a669];return _0x4522bf;};'use strict';var _=require(_0x2dde('0x0'));var util=require(_0x2dde('0x1'));var logger=require(_0x2dde('0x2'))(_0x2dde('0x3'));var moment=require(_0x2dde('0x4'));var BPromise=require(_0x2dde('0x5'));var rp=require(_0x2dde('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2dde('0x7'));module[_0x2dde('0x8')]=function(_0x32667b,_0x406cc9){return _0x32667b[_0x2dde('0x9')]('CmHopperBlack',attributes,{'tableName':_0x2dde('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda16=['api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xda16,0xb3));var _0x6da1=function(_0x51eb1b,_0x3f0f18){_0x51eb1b=_0x51eb1b-0x0;var _0x125309=_0xda16[_0x51eb1b];return _0x125309;};'use strict';var _=require(_0x6da1('0x0'));var util=require(_0x6da1('0x1'));var logger=require(_0x6da1('0x2'))(_0x6da1('0x3'));var moment=require(_0x6da1('0x4'));var BPromise=require(_0x6da1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6da1('0x6'));var rimraf=require(_0x6da1('0x7'));var config=require(_0x6da1('0x8'));var attributes=require(_0x6da1('0x9'));module[_0x6da1('0xa')]=function(_0x402a8f,_0x3a9850){return _0x402a8f[_0x6da1('0xb')](_0x6da1('0xc'),attributes,{'tableName':_0x6da1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index bbd2eb0..f5d3975 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 _0x909f=['model','UpdateCmHopperBlack','update','body','raw','where','then','stringify','DestroyCmHopperBlack','destroy','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','limit','include','attributes','map'];(function(_0x2e0a89,_0x2000f4){var _0x39b8dc=function(_0x50a48b){while(--_0x50a48b){_0x2e0a89['push'](_0x2e0a89['shift']());}};_0x39b8dc(++_0x2000f4);}(_0x909f,0x132));var _0xf909=function(_0x557c65,_0x3c1cfa){_0x557c65=_0x557c65-0x0;var _0x175c1b=_0x909f[_0x557c65];return _0x175c1b;};'use strict';var _=require(_0xf909('0x0'));var util=require('util');var moment=require(_0xf909('0x1'));var BPromise=require(_0xf909('0x2'));var rs=require(_0xf909('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf909('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf909('0x5'))(_0xf909('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf909('0x7')][_0xf909('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x91fb07,_0x10ce53,_0x232477){return new BPromise(function(_0x49e2db,_0x59e4fa){return client['request'](_0x91fb07,_0x232477)['then'](function(_0x49c12c){logger[_0xf909('0x9')](_0xf909('0xa'),_0x10ce53,'request\x20sent');logger[_0xf909('0xb')](_0xf909('0xc'),_0x10ce53,_0xf909('0xd'),JSON['stringify'](_0x49c12c));if(_0x49c12c[_0xf909('0xe')]){if(_0x49c12c[_0xf909('0xe')][_0xf909('0xf')]===0x1f4){logger[_0xf909('0xe')](_0xf909('0xa'),_0x10ce53,_0x49c12c[_0xf909('0xe')]['message']);return _0x59e4fa(_0x49c12c[_0xf909('0xe')][_0xf909('0x10')]);}logger['error'](_0xf909('0xa'),_0x10ce53,_0x49c12c['error']['message']);return _0x49e2db(_0x49c12c[_0xf909('0xe')][_0xf909('0x10')]);}else{logger[_0xf909('0x9')]('CmHopperBlack,\x20%s,\x20%s',_0x10ce53,'request\x20sent');_0x49e2db(_0x49c12c[_0xf909('0x11')][_0xf909('0x10')]);}})[_0xf909('0x12')](function(_0x2258fb){logger[_0xf909('0xe')](_0xf909('0xa'),_0x10ce53,_0x2258fb);_0x59e4fa(_0x2258fb);});});}exports[_0xf909('0x13')]=function(_0x574fad){var _0x1c712=this;return new Promise(function(_0xb52db1,_0x4f67d4){return db[_0xf909('0x14')][_0xf909('0x15')]({'raw':_0x574fad[_0xf909('0x16')]?_0x574fad[_0xf909('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x574fad[_0xf909('0x16')]?_0x574fad[_0xf909('0x16')]['where']||null:null,'attributes':_0x574fad[_0xf909('0x16')]?_0x574fad[_0xf909('0x16')]['attributes']||null:null,'limit':_0x574fad[_0xf909('0x16')]?_0x574fad[_0xf909('0x16')][_0xf909('0x17')]||null:null,'include':_0x574fad[_0xf909('0x16')]?_0x574fad['options'][_0xf909('0x18')]?_['map'](_0x574fad[_0xf909('0x16')][_0xf909('0x18')],function(_0x75c3e7){return{'model':db[_0x75c3e7['model']],'as':_0x75c3e7['as'],'attributes':_0x75c3e7[_0xf909('0x19')],'include':_0x75c3e7[_0xf909('0x18')]?_[_0xf909('0x1a')](_0x75c3e7['include'],function(_0x5d45ee){return{'model':db[_0x5d45ee[_0xf909('0x1b')]],'as':_0x5d45ee['as'],'attributes':_0x5d45ee[_0xf909('0x19')],'include':_0x5d45ee[_0xf909('0x18')]?_[_0xf909('0x1a')](_0x5d45ee[_0xf909('0x18')],function(_0x3da19a){return{'model':db[_0x3da19a[_0xf909('0x1b')]],'as':_0x3da19a['as'],'attributes':_0x3da19a[_0xf909('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x583a6b){logger[_0xf909('0x9')](_0xf909('0x13'),_0x574fad);logger[_0xf909('0xb')]('GetCmHopperBlack',_0x574fad,JSON['stringify'](_0x583a6b));_0xb52db1(_0x583a6b);})['catch'](function(_0x36e2c0){logger['error'](_0xf909('0x13'),_0x36e2c0[_0xf909('0x10')],_0x574fad);_0x4f67d4(_0x1c712[_0xf909('0xe')](0x1f4,_0x36e2c0[_0xf909('0x10')]));});});};exports[_0xf909('0x1c')]=function(_0x1e51a3){var _0x187778=this;return new Promise(function(_0x3d30a8,_0x5673dd){return db[_0xf909('0x14')][_0xf909('0x1d')](_0x1e51a3[_0xf909('0x1e')],{'raw':_0x1e51a3[_0xf909('0x16')]?_0x1e51a3[_0xf909('0x16')][_0xf909('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e51a3[_0xf909('0x16')]?_0x1e51a3[_0xf909('0x16')][_0xf909('0x20')]||null:null,'attributes':_0x1e51a3[_0xf909('0x16')]?_0x1e51a3[_0xf909('0x16')][_0xf909('0x19')]||null:null,'limit':_0x1e51a3[_0xf909('0x16')]?_0x1e51a3[_0xf909('0x16')][_0xf909('0x17')]||null:null})[_0xf909('0x21')](function(_0x3a66e1){logger[_0xf909('0x9')](_0xf909('0x1c'),_0x1e51a3);logger[_0xf909('0xb')](_0xf909('0x1c'),_0x1e51a3,JSON[_0xf909('0x22')](_0x3a66e1));_0x3d30a8(_0x3a66e1);})['catch'](function(_0xf68762){logger[_0xf909('0xe')](_0xf909('0x1c'),_0xf68762[_0xf909('0x10')],_0x1e51a3);_0x5673dd(_0x187778[_0xf909('0xe')](0x1f4,_0xf68762[_0xf909('0x10')]));});});};exports[_0xf909('0x23')]=function(_0x171fda){var _0x5af643=this;return new Promise(function(_0x361402,_0x58cd31){return db[_0xf909('0x14')][_0xf909('0x24')]({'where':_0x171fda[_0xf909('0x16')]?_0x171fda['options'][_0xf909('0x20')]||null:null})['then'](function(_0x5323d2){logger['info'](_0xf909('0x23'),_0x171fda);logger[_0xf909('0xb')](_0xf909('0x23'),_0x171fda,JSON['stringify'](_0x5323d2));_0x361402(_0x5323d2);})[_0xf909('0x12')](function(_0x18d08d){logger[_0xf909('0xe')](_0xf909('0x23'),_0x18d08d[_0xf909('0x10')],_0x171fda);_0x58cd31(_0x5af643[_0xf909('0xe')](0x1f4,_0x18d08d[_0xf909('0x10')]));});});}; \ No newline at end of file +var _0xbaa3=['client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','message','result','catch','CmHopperBlack','findAll','options','raw','where','limit','include','model','attributes','GetCmHopperBlack','stringify','UpdateCmHopperBlack','body','DestroyCmHopperBlack','destroy','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x580ef1,_0x4138ec){var _0x223855=function(_0x44867d){while(--_0x44867d){_0x580ef1['push'](_0x580ef1['shift']());}};_0x223855(++_0x4138ec);}(_0xbaa3,0x11f));var _0x3baa=function(_0x110d59,_0x50c4fb){_0x110d59=_0x110d59-0x0;var _0x2fce64=_0xbaa3[_0x110d59];return _0x2fce64;};'use strict';var _=require(_0x3baa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3baa('0x1'));var rs=require(_0x3baa('0x2'));var fs=require('fs');var Redis=require(_0x3baa('0x3'));var db=require(_0x3baa('0x4'))['db'];var utils=require(_0x3baa('0x5'));var logger=require('../../config/logger')(_0x3baa('0x6'));var config=require(_0x3baa('0x7'));var jayson=require(_0x3baa('0x8'));var client=jayson[_0x3baa('0x9')][_0x3baa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x270d9c,_0x44559a,_0x15baff){return new BPromise(function(_0x3a4d78,_0x37ccac){return client[_0x3baa('0xb')](_0x270d9c,_0x15baff)[_0x3baa('0xc')](function(_0x1461b8){logger[_0x3baa('0xd')](_0x3baa('0xe'),_0x44559a,_0x3baa('0xf'));logger[_0x3baa('0x10')](_0x3baa('0x11'),_0x44559a,_0x3baa('0xf'),JSON['stringify'](_0x1461b8));if(_0x1461b8[_0x3baa('0x12')]){if(_0x1461b8[_0x3baa('0x12')]['code']===0x1f4){logger[_0x3baa('0x12')](_0x3baa('0xe'),_0x44559a,_0x1461b8['error'][_0x3baa('0x13')]);return _0x37ccac(_0x1461b8[_0x3baa('0x12')][_0x3baa('0x13')]);}logger[_0x3baa('0x12')](_0x3baa('0xe'),_0x44559a,_0x1461b8[_0x3baa('0x12')][_0x3baa('0x13')]);return _0x3a4d78(_0x1461b8['error'][_0x3baa('0x13')]);}else{logger[_0x3baa('0xd')](_0x3baa('0xe'),_0x44559a,_0x3baa('0xf'));_0x3a4d78(_0x1461b8[_0x3baa('0x14')][_0x3baa('0x13')]);}})[_0x3baa('0x15')](function(_0xcf604e){logger['error'](_0x3baa('0xe'),_0x44559a,_0xcf604e);_0x37ccac(_0xcf604e);});});}exports['GetCmHopperBlack']=function(_0x5c02d3){var _0x5df21e=this;return new Promise(function(_0x5e6de5,_0x16e358){return db[_0x3baa('0x16')][_0x3baa('0x17')]({'raw':_0x5c02d3[_0x3baa('0x18')]?_0x5c02d3['options'][_0x3baa('0x19')]===undefined?!![]:![]:!![],'where':_0x5c02d3[_0x3baa('0x18')]?_0x5c02d3['options'][_0x3baa('0x1a')]||null:null,'attributes':_0x5c02d3['options']?_0x5c02d3[_0x3baa('0x18')]['attributes']||null:null,'limit':_0x5c02d3[_0x3baa('0x18')]?_0x5c02d3[_0x3baa('0x18')][_0x3baa('0x1b')]||null:null,'include':_0x5c02d3[_0x3baa('0x18')]?_0x5c02d3[_0x3baa('0x18')][_0x3baa('0x1c')]?_['map'](_0x5c02d3[_0x3baa('0x18')]['include'],function(_0x59bb5b){return{'model':db[_0x59bb5b[_0x3baa('0x1d')]],'as':_0x59bb5b['as'],'attributes':_0x59bb5b[_0x3baa('0x1e')],'include':_0x59bb5b[_0x3baa('0x1c')]?_['map'](_0x59bb5b['include'],function(_0x5e469e){return{'model':db[_0x5e469e[_0x3baa('0x1d')]],'as':_0x5e469e['as'],'attributes':_0x5e469e['attributes'],'include':_0x5e469e['include']?_['map'](_0x5e469e[_0x3baa('0x1c')],function(_0x121a0a){return{'model':db[_0x121a0a[_0x3baa('0x1d')]],'as':_0x121a0a['as'],'attributes':_0x121a0a[_0x3baa('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3baa('0xc')](function(_0x5d1283){logger[_0x3baa('0xd')](_0x3baa('0x1f'),_0x5c02d3);logger[_0x3baa('0x10')]('GetCmHopperBlack',_0x5c02d3,JSON[_0x3baa('0x20')](_0x5d1283));_0x5e6de5(_0x5d1283);})[_0x3baa('0x15')](function(_0x20dcfb){logger[_0x3baa('0x12')](_0x3baa('0x1f'),_0x20dcfb[_0x3baa('0x13')],_0x5c02d3);_0x16e358(_0x5df21e['error'](0x1f4,_0x20dcfb[_0x3baa('0x13')]));});});};exports[_0x3baa('0x21')]=function(_0x47e397){var _0x5a9144=this;return new Promise(function(_0x3b4a44,_0x638c3){return db[_0x3baa('0x16')]['update'](_0x47e397[_0x3baa('0x22')],{'raw':_0x47e397['options']?_0x47e397['options'][_0x3baa('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47e397[_0x3baa('0x18')]?_0x47e397[_0x3baa('0x18')][_0x3baa('0x1a')]||null:null,'attributes':_0x47e397[_0x3baa('0x18')]?_0x47e397['options'][_0x3baa('0x1e')]||null:null,'limit':_0x47e397['options']?_0x47e397[_0x3baa('0x18')][_0x3baa('0x1b')]||null:null})[_0x3baa('0xc')](function(_0x535272){logger[_0x3baa('0xd')]('UpdateCmHopperBlack',_0x47e397);logger[_0x3baa('0x10')]('UpdateCmHopperBlack',_0x47e397,JSON[_0x3baa('0x20')](_0x535272));_0x3b4a44(_0x535272);})[_0x3baa('0x15')](function(_0xd92971){logger[_0x3baa('0x12')](_0x3baa('0x21'),_0xd92971[_0x3baa('0x13')],_0x47e397);_0x638c3(_0x5a9144[_0x3baa('0x12')](0x1f4,_0xd92971[_0x3baa('0x13')]));});});};exports[_0x3baa('0x23')]=function(_0x193752){var _0x33d688=this;return new Promise(function(_0x33b0f5,_0x45ab8d){return db[_0x3baa('0x16')][_0x3baa('0x24')]({'where':_0x193752[_0x3baa('0x18')]?_0x193752[_0x3baa('0x18')][_0x3baa('0x1a')]||null:null})[_0x3baa('0xc')](function(_0xd5eed9){logger['info'](_0x3baa('0x23'),_0x193752);logger['debug'](_0x3baa('0x23'),_0x193752,JSON[_0x3baa('0x20')](_0xd5eed9));_0x33b0f5(_0xd5eed9);})[_0x3baa('0x15')](function(_0x2c2702){logger[_0x3baa('0x12')]('DestroyCmHopperBlack',_0x2c2702[_0x3baa('0x13')],_0x193752);_0x45ab8d(_0x33d688['error'](0x1f4,_0x2c2702['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 5c14dea..0a0088a 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 _0x4fb4=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','show','put','/:id','update','delete','destroy'];(function(_0x459d7d,_0x55db19){var _0x26abf1=function(_0x39e5d5){while(--_0x39e5d5){_0x459d7d['push'](_0x459d7d['shift']());}};_0x26abf1(++_0x55db19);}(_0x4fb4,0x190));var _0x44fb=function(_0x40207e,_0x2c1e14){_0x40207e=_0x40207e-0x0;var _0x51cc73=_0x4fb4[_0x40207e];return _0x51cc73;};'use strict';var multer=require('multer');var util=require(_0x44fb('0x0'));var path=require(_0x44fb('0x1'));var timeout=require(_0x44fb('0x2'));var express=require(_0x44fb('0x3'));var router=express[_0x44fb('0x4')]();var fs_extra=require(_0x44fb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x44fb('0x6'));var config=require(_0x44fb('0x7'));var controller=require(_0x44fb('0x8'));router[_0x44fb('0x9')]('/',auth[_0x44fb('0xa')](),controller[_0x44fb('0xb')]);router[_0x44fb('0x9')](_0x44fb('0xc'),auth['isAuthenticated'](),controller[_0x44fb('0xd')]);router[_0x44fb('0x9')]('/:id',auth[_0x44fb('0xa')](),controller[_0x44fb('0xe')]);router[_0x44fb('0xf')](_0x44fb('0x10'),auth[_0x44fb('0xa')](),controller[_0x44fb('0x11')]);router[_0x44fb('0x12')](_0x44fb('0x10'),auth[_0x44fb('0xa')](),controller[_0x44fb('0x13')]);module['exports']=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(_0x33db13,_0x169eb4){var _0x5eb09d=function(_0x289656){while(--_0x289656){_0x33db13['push'](_0x33db13['shift']());}};_0x5eb09d(++_0x169eb4);}(_0x3d04,0xbe));var _0x43d0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3d04[_0x2dafbe];return _0x58a45a;};'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 1379578..8e35a6b 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 _0x3718=['exports','INTEGER','STRING','DATE','endtime','followuptime','diff','seconds','BOOLEAN','sequelize','moment'];(function(_0x55d8c5,_0x10287a){var _0x225ae5=function(_0x2ba03a){while(--_0x2ba03a){_0x55d8c5['push'](_0x55d8c5['shift']());}};_0x225ae5(++_0x10287a);}(_0x3718,0x1a0));var _0x8371=function(_0x2620d2,_0x3dd51a){_0x2620d2=_0x2620d2-0x0;var _0x2e37f1=_0x3718[_0x2620d2];return _0x2e37f1;};'use strict';var Sequelize=require(_0x8371('0x0'));var moment=require(_0x8371('0x1'));module[_0x8371('0x2')]={'state':{'type':Sequelize[_0x8371('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x8371('0x4')]},'scheduledat':{'type':Sequelize[_0x8371('0x5')]},'countbusyretry':{'type':Sequelize[_0x8371('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8371('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8371('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8371('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x8371('0x4')]},'originatecalleridname':{'type':Sequelize[_0x8371('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x8371('0x4')]},'starttime':{'type':Sequelize[_0x8371('0x5')]},'responsetime':{'type':Sequelize[_0x8371('0x5')]},'answertime':{'type':Sequelize[_0x8371('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x8371('0x5')]},'ringtime':{'type':Sequelize[_0x8371('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8371('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x8371('0x4')]},'campaigntype':{'type':Sequelize[_0x8371('0x4')]},'membername':{'type':Sequelize[_0x8371('0x4')]},'reason':{'type':Sequelize[_0x8371('0x4')]},'disposition':{'type':Sequelize[_0x8371('0x4')]},'secondDisposition':{'type':Sequelize[_0x8371('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x8371('0x5')],'set':function(_0x55940f){var _0xf4ffbb=this['getDataValue'](_0x8371('0x6'));if(_0xf4ffbb&&_0x55940f){this['setDataValue'](_0x8371('0x7'),moment(_0x55940f)[_0x8371('0x8')](moment(_0xf4ffbb),_0x8371('0x9')));}}},'amd':{'type':Sequelize[_0x8371('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8371('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x8371('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x8371('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x8371('0x5')]},'callback':{'type':Sequelize[_0x8371('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8371('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x8371('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x8371('0x5')]},'recallme':{'type':Sequelize[_0x8371('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x8371('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x8371('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8371('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8371('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8371('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8371('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x796e=['moment','exports','INTEGER','STRING','DATE','getDataValue','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize'];(function(_0x2e0b72,_0x45066e){var _0x3df44c=function(_0x113240){while(--_0x113240){_0x2e0b72['push'](_0x2e0b72['shift']());}};_0x3df44c(++_0x45066e);}(_0x796e,0x143));var _0xe796=function(_0x25b0cd,_0x3dcd36){_0x25b0cd=_0x25b0cd-0x0;var _0x302f0d=_0x796e[_0x25b0cd];return _0x302f0d;};'use strict';var Sequelize=require(_0xe796('0x0'));var moment=require(_0xe796('0x1'));module[_0xe796('0x2')]={'state':{'type':Sequelize[_0xe796('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xe796('0x4')]},'scheduledat':{'type':Sequelize[_0xe796('0x5')]},'countbusyretry':{'type':Sequelize[_0xe796('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe796('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xe796('0x4')]},'originatecalleridname':{'type':Sequelize[_0xe796('0x4')]},'calleridnum':{'type':Sequelize[_0xe796('0x4')]},'calleridname':{'type':Sequelize[_0xe796('0x4')]},'starttime':{'type':Sequelize[_0xe796('0x5')]},'responsetime':{'type':Sequelize[_0xe796('0x5')]},'answertime':{'type':Sequelize[_0xe796('0x5')]},'droptime':{'type':Sequelize[_0xe796('0x5')]},'endtime':{'type':Sequelize[_0xe796('0x5')]},'ringtime':{'type':Sequelize[_0xe796('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe796('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe796('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe796('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xe796('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xe796('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xe796('0x4')]},'dispositionat':{'type':Sequelize[_0xe796('0x5')],'set':function(_0xd74313){var _0x7390f3=this[_0xe796('0x6')]('endtime');if(_0x7390f3&&_0xd74313){this[_0xe796('0x7')](_0xe796('0x8'),moment(_0xd74313)[_0xe796('0x9')](moment(_0x7390f3),_0xe796('0xa')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xe796('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xe796('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xe796('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xe796('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe796('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe796('0x5')]},'deleted':{'type':Sequelize[_0xe796('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xe796('0x5')]},'recallme':{'type':Sequelize[_0xe796('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xe796('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xe796('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe796('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe796('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe796('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe796('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 f6f5977..d631a38 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 _0x5496=['set','Content-Range','apply','reject','save','update','then','error','stack','name','index','CmHopperFinal','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','fields','include','options','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','dropContacts','abandonedContacts','reCallContacts','answeringMachine','into','cm_hopper','fromQuery','ListId','VoiceQueueId','createdAt','field','phone','NOW()','scheduledAt','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','updatedAt','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','from','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','ANY_VALUE(calleridnum)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','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','sendStatus','end','status','json','undefined','limit','count'];(function(_0x4372b3,_0x380cfc){var _0x338133=function(_0x4a5198){while(--_0x4a5198){_0x4372b3['push'](_0x4372b3['shift']());}};_0x338133(++_0x380cfc);}(_0x5496,0x175));var _0x6549=function(_0x82b1cb,_0x43ed4f){_0x82b1cb=_0x82b1cb-0x0;var _0x4b7fb4=_0x5496[_0x82b1cb];return _0x4b7fb4;};'use strict';var emlformat=require(_0x6549('0x0'));var rimraf=require(_0x6549('0x1'));var zipdir=require(_0x6549('0x2'));var jsonpatch=require(_0x6549('0x3'));var rp=require(_0x6549('0x4'));var moment=require('moment');var BPromise=require(_0x6549('0x5'));var Mustache=require('mustache');var util=require(_0x6549('0x6'));var path=require(_0x6549('0x7'));var sox=require(_0x6549('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6549('0x9'));var _=require(_0x6549('0xa'));var squel=require('squel');var crypto=require(_0x6549('0xb'));var jsforce=require(_0x6549('0xc'));var deskjs=require(_0x6549('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xe'));var Papa=require(_0x6549('0xf'));var Redis=require(_0x6549('0x10'));var authService=require(_0x6549('0x11'));var qs=require(_0x6549('0x12'));var as=require(_0x6549('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6549('0x14'));var utils=require(_0x6549('0x15'));var config=require(_0x6549('0x16'));var licenseUtil=require(_0x6549('0x17'));var db=require(_0x6549('0x18'))['db'];function respondWithStatusCode(_0x5bc018,_0x4dfb06){_0x4dfb06=_0x4dfb06||0xcc;return function(_0x3f844f){if(_0x3f844f){return _0x5bc018[_0x6549('0x19')](_0x4dfb06);}return _0x5bc018['status'](_0x4dfb06)[_0x6549('0x1a')]();};}function respondWithResult(_0x150fc8,_0x195d25){_0x195d25=_0x195d25||0xc8;return function(_0x12b068){if(_0x12b068){return _0x150fc8[_0x6549('0x1b')](_0x195d25)[_0x6549('0x1c')](_0x12b068);}};}function respondWithFilteredResult(_0x55c112,_0x5db86d){return function(_0x384f75){if(_0x384f75){var _0x25da29=typeof _0x5db86d['offset']===_0x6549('0x1d')&&typeof _0x5db86d[_0x6549('0x1e')]===_0x6549('0x1d');var _0x387e60=_0x384f75[_0x6549('0x1f')];var _0x53b12b=_0x25da29?0x0:_0x5db86d['offset'];var _0x26a212=_0x25da29?_0x384f75['count']:_0x5db86d['offset']+_0x5db86d[_0x6549('0x1e')];var _0x1e5079;if(_0x26a212>=_0x387e60){_0x26a212=_0x387e60;_0x1e5079=0xc8;}else{_0x1e5079=0xce;}_0x55c112[_0x6549('0x1b')](_0x1e5079);return _0x55c112[_0x6549('0x20')](_0x6549('0x21'),_0x53b12b+'-'+_0x26a212+'/'+_0x387e60)['json'](_0x384f75);}return null;};}function patchUpdates(_0x228117){return function(_0x4b40c1){try{jsonpatch[_0x6549('0x22')](_0x4b40c1,_0x228117,!![]);}catch(_0x72322b){return BPromise[_0x6549('0x23')](_0x72322b);}return _0x4b40c1[_0x6549('0x24')]();};}function saveUpdates(_0x22bcf8,_0x12d547){return function(_0x427b47){if(_0x427b47){return _0x427b47[_0x6549('0x25')](_0x22bcf8)[_0x6549('0x26')](function(_0x6ae00c){return _0x6ae00c;});}return null;};}function removeEntity(_0x40d3f9,_0x1fbfa4){return function(_0x23c0ba){if(_0x23c0ba){return _0x23c0ba['destroy']()[_0x6549('0x26')](function(){_0x40d3f9[_0x6549('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126967,_0x29f89e){return function(_0x3768cb){if(!_0x3768cb){_0x126967['sendStatus'](0x194);}return _0x3768cb;};}function handleError(_0x31a95,_0xfb51a1){_0xfb51a1=_0xfb51a1||0x1f4;return function(_0x14de1f){logger[_0x6549('0x27')](_0x14de1f[_0x6549('0x28')]);if(_0x14de1f[_0x6549('0x29')]){delete _0x14de1f[_0x6549('0x29')];}_0x31a95[_0x6549('0x1b')](_0xfb51a1)['send'](_0x14de1f);};}exports[_0x6549('0x2a')]=function(_0x136518,_0x17fdfb){var _0x4c605c={},_0x3f1502={},_0x4acaf5={'count':0x0,'rows':[]};var _0x4f0ad1=_['map'](db[_0x6549('0x2b')][_0x6549('0x2c')],function(_0x4f3069){return{'name':_0x4f3069[_0x6549('0x2d')],'type':_0x4f3069[_0x6549('0x2e')][_0x6549('0x2f')]};});_0x3f1502[_0x6549('0x30')]=_[_0x6549('0x31')](_0x4f0ad1,_0x6549('0x29'));_0x3f1502[_0x6549('0x32')]=_['keys'](_0x136518[_0x6549('0x32')]);_0x3f1502[_0x6549('0x33')]=_[_0x6549('0x34')](_0x3f1502[_0x6549('0x30')],_0x3f1502[_0x6549('0x32')]);_0x4c605c[_0x6549('0x35')]=_['intersection'](_0x3f1502[_0x6549('0x30')],qs['fields'](_0x136518[_0x6549('0x32')]['fields']));_0x4c605c[_0x6549('0x35')]=_0x4c605c[_0x6549('0x35')][_0x6549('0x36')]?_0x4c605c['attributes']:_0x3f1502[_0x6549('0x30')];if(!_0x136518[_0x6549('0x32')][_0x6549('0x37')](_0x6549('0x38'))){_0x4c605c['limit']=qs['limit'](_0x136518['query'][_0x6549('0x1e')]);_0x4c605c[_0x6549('0x39')]=qs['offset'](_0x136518[_0x6549('0x32')][_0x6549('0x39')]);}_0x4c605c[_0x6549('0x3a')]=qs[_0x6549('0x3b')](_0x136518[_0x6549('0x32')]['sort']);_0x4c605c['where']=qs[_0x6549('0x33')](_[_0x6549('0x3c')](_0x136518[_0x6549('0x32')],_0x3f1502[_0x6549('0x33')]),_0x4f0ad1);if(_0x136518[_0x6549('0x32')][_0x6549('0x3d')]){_0x4c605c[_0x6549('0x3e')]=_[_0x6549('0x3f')](_0x4c605c[_0x6549('0x3e')],{'$or':_[_0x6549('0x31')](_0x4f0ad1,function(_0x525f82){if(_0x525f82[_0x6549('0x2e')]!==_0x6549('0x40')){var _0x2ea977={};_0x2ea977[_0x525f82[_0x6549('0x29')]]={'$like':'%'+_0x136518[_0x6549('0x32')]['filter']+'%'};return _0x2ea977;}})});}_0x4c605c=_['merge']({},_0x4c605c,_0x136518['options']);var _0x22b919={'where':_0x4c605c[_0x6549('0x3e')]};return db[_0x6549('0x2b')][_0x6549('0x1f')](_0x22b919)['then'](function(_0x56ce9f){_0x4acaf5[_0x6549('0x1f')]=_0x56ce9f;if(_0x136518[_0x6549('0x32')][_0x6549('0x41')]){_0x4c605c['include']=[{'all':!![]}];}return db[_0x6549('0x2b')]['findAll'](_0x4c605c);})[_0x6549('0x26')](function(_0x2ec614){_0x4acaf5[_0x6549('0x42')]=_0x2ec614;return _0x4acaf5;})[_0x6549('0x26')](respondWithFilteredResult(_0x17fdfb,_0x4c605c))[_0x6549('0x43')](handleError(_0x17fdfb,null));};exports[_0x6549('0x44')]=function(_0xbbfdc9,_0x4deaab){var _0x132625={'raw':!![],'where':{'id':_0xbbfdc9[_0x6549('0x45')]['id']}},_0x309f45={};_0x309f45[_0x6549('0x30')]=_[_0x6549('0x46')](db[_0x6549('0x2b')][_0x6549('0x2c')]);_0x309f45[_0x6549('0x32')]=_[_0x6549('0x46')](_0xbbfdc9[_0x6549('0x32')]);_0x309f45[_0x6549('0x33')]=_[_0x6549('0x34')](_0x309f45[_0x6549('0x30')],_0x309f45[_0x6549('0x32')]);_0x132625[_0x6549('0x35')]=_[_0x6549('0x34')](_0x309f45['model'],qs[_0x6549('0x47')](_0xbbfdc9[_0x6549('0x32')][_0x6549('0x47')]));_0x132625[_0x6549('0x35')]=_0x132625['attributes'][_0x6549('0x36')]?_0x132625['attributes']:_0x309f45[_0x6549('0x30')];if(_0xbbfdc9[_0x6549('0x32')]['includeAll']){_0x132625[_0x6549('0x48')]=[{'all':!![]}];}_0x132625=_[_0x6549('0x3f')]({},_0x132625,_0xbbfdc9[_0x6549('0x49')]);return db[_0x6549('0x2b')][_0x6549('0x4a')](_0x132625)['then'](handleEntityNotFound(_0x4deaab,null))['then'](respondWithResult(_0x4deaab,null))[_0x6549('0x43')](handleError(_0x4deaab,null));};exports[_0x6549('0x4b')]=function(_0x41d675,_0x1712f3){return db[_0x6549('0x2b')]['describe']()[_0x6549('0x26')](respondWithResult(_0x1712f3,null))[_0x6549('0x43')](handleError(_0x1712f3,null));};exports[_0x6549('0x25')]=function(_0x6121af,_0xa4c650){if(_0x6121af[_0x6549('0x4c')][_0x6549('0x4d')]){delete _0x6121af[_0x6549('0x4c')]['uniqueid'];}return db[_0x6549('0x2b')]['find']({'where':{'uniqueid':_0x6121af[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0xa4c650,null))[_0x6549('0x26')](saveUpdates(_0x6121af['body'],null))[_0x6549('0x26')](respondWithResult(_0xa4c650,null))[_0x6549('0x43')](handleError(_0xa4c650,null));};exports[_0x6549('0x4e')]=function(_0x5300c8,_0x19ac50,_0x17d7ce){return db[_0x6549('0x2b')][_0x6549('0x4f')]({'raw':![],'where':{'VoiceQueueId':_0x5300c8[_0x6549('0x45')]['id']},'attributes':[[db[_0x6549('0x50')]['fn']('COUNT',db[_0x6549('0x50')]['fn']('IF',db['sequelize'][_0x6549('0x51')](_0x6549('0x52')))),_0x6549('0x53')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x55')))),_0x6549('0x56')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x57')))),_0x6549('0x58')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')]['literal'](_0x6549('0x59')))),_0x6549('0x5a')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5b')))),'dropContacts'],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5c')))),'abandonedContacts'],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5d')))),'reCallContacts'],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')]['literal'](_0x6549('0x5e')))),'answeringMachine']]})[_0x6549('0x26')](handleEntityNotFound(_0x19ac50,null))[_0x6549('0x26')](respondWithResult(_0x19ac50,null))[_0x6549('0x43')](handleError(_0x19ac50,null));};exports[_0x6549('0x5f')]=function(_0x2da535,_0x45eb28,_0x3b01d9){return db[_0x6549('0x2b')][_0x6549('0x4f')]({'raw':![],'where':{'CampaignId':_0x2da535[_0x6549('0x45')]['id']},'attributes':[[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')]['literal'](_0x6549('0x52')))),_0x6549('0x53')],[db['sequelize']['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')]('`state`\x20=\x203,\x201,\x20null'))),_0x6549('0x56')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db['sequelize'][_0x6549('0x51')]('`state`\x20=\x205,\x201,\x20null'))),_0x6549('0x58')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x59')))),_0x6549('0x5a')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5b')))),_0x6549('0x60')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db['sequelize'][_0x6549('0x51')](_0x6549('0x5c')))),_0x6549('0x61')],[db['sequelize']['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db['sequelize'][_0x6549('0x51')](_0x6549('0x5d')))),_0x6549('0x62')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')]('`state`\x20=\x2019,\x201,\x20null'))),_0x6549('0x63')]]})['then'](handleEntityNotFound(_0x45eb28,null))[_0x6549('0x26')](respondWithResult(_0x45eb28,null))[_0x6549('0x43')](handleError(_0x45eb28,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x372b67,_0x2c00a1,_0x2e6b4b){return db['VoiceQueue'][_0x6549('0x4a')]({'where':{'id':_0x372b67[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x2c00a1,null))[_0x6549('0x26')](function(_0x15b906){var _0x34c5f9;if(_0x15b906){_0x34c5f9=squel['insert']()[_0x6549('0x64')](_0x6549('0x65'))[_0x6549('0x66')](['phone','scheduledAt','ContactId',_0x6549('0x67'),_0x6549('0x68'),_0x6549('0x69'),'updatedAt'],squel['select']()[_0x6549('0x6a')]('ANY_VALUE(calleridnum)',_0x6549('0x6b'))[_0x6549('0x6a')](_0x6549('0x6c'),_0x6549('0x6d'))[_0x6549('0x6a')](_0x6549('0x6e'),_0x6549('0x6f'))['field'](_0x6549('0x70'),_0x6549('0x67'))[_0x6549('0x6a')]('ANY_VALUE(VoiceQueueId)',_0x6549('0x68'))[_0x6549('0x6a')](_0x6549('0x6c'),_0x6549('0x69'))[_0x6549('0x6a')](_0x6549('0x6c'),_0x6549('0x71'))['from'](_0x6549('0x72'))['where'](_0x6549('0x73'),_0x372b67[_0x6549('0x45')]['id'][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x75'),_0x372b67[_0x6549('0x4c')][_0x6549('0x76')][_0x6549('0x74')]())['where'](_0x6549('0x77'))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x6b'))[_0x6549('0x7a')](_0x6549('0x65'))[_0x6549('0x3e')](_0x6549('0x73'),_0x372b67['params']['id'][_0x6549('0x74')]()))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x7b'))[_0x6549('0x7a')](_0x6549('0x72'))[_0x6549('0x3e')](_0x6549('0x73'),_0x372b67[_0x6549('0x45')]['id'][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x7c')))[_0x6549('0x7d')](_0x6549('0x6f')))[_0x6549('0x74')]();return db[_0x6549('0x50')]['query'](_0x34c5f9);}return[];})[_0x6549('0x26')](respondWithResult(_0x2c00a1,null))[_0x6549('0x43')](handleError(_0x2c00a1,null));};exports[_0x6549('0x7e')]=function(_0x35bad6,_0x371d8a,_0xfde69e){return db[_0x6549('0x7f')][_0x6549('0x4a')]({'where':{'id':_0x35bad6[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x371d8a,null))[_0x6549('0x26')](function(_0x1da2d7){var _0x348d55;if(_0x1da2d7){_0x348d55=squel[_0x6549('0x80')]()[_0x6549('0x64')](_0x6549('0x65'))[_0x6549('0x66')](['phone',_0x6549('0x6d'),_0x6549('0x6f'),_0x6549('0x67'),_0x6549('0x81'),_0x6549('0x69'),_0x6549('0x71')],squel[_0x6549('0x79')]()['field'](_0x6549('0x82'),'phone')['field'](_0x6549('0x6c'),'scheduledAt')[_0x6549('0x6a')](_0x6549('0x6e'),_0x6549('0x6f'))[_0x6549('0x6a')](_0x6549('0x70'),'ListId')[_0x6549('0x6a')]('ANY_VALUE(CampaignId)',_0x6549('0x81'))[_0x6549('0x6a')](_0x6549('0x6c'),'createdAt')[_0x6549('0x6a')](_0x6549('0x6c'),'updatedAt')['from'](_0x6549('0x72'))[_0x6549('0x3e')](_0x6549('0x83'),_0x35bad6[_0x6549('0x45')]['id'][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x75'),_0x35bad6[_0x6549('0x4c')][_0x6549('0x76')][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x77'))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x6b'))[_0x6549('0x7a')](_0x6549('0x65'))['where']('CampaignId\x20=\x20?',_0x35bad6[_0x6549('0x45')]['id'][_0x6549('0x74')]()))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x7b'))[_0x6549('0x7a')](_0x6549('0x72'))[_0x6549('0x3e')]('CampaignId\x20=\x20?',_0x35bad6['params']['id']['toString']())[_0x6549('0x3e')](_0x6549('0x7c')))[_0x6549('0x7d')](_0x6549('0x6f')))[_0x6549('0x74')]();return db['sequelize'][_0x6549('0x32')](_0x348d55);}return[];})[_0x6549('0x26')](respondWithResult(_0x371d8a,null))[_0x6549('0x43')](handleError(_0x371d8a,null));};exports[_0x6549('0x84')]=function(_0x230874,_0x3be369,_0xaf1a80){return db[_0x6549('0x85')][_0x6549('0x86')]({'where':{'VoiceQueueId':_0x230874[_0x6549('0x4c')][_0x6549('0x68')],'CampaignId':_0x230874['body'][_0x6549('0x81')],'ContactId':_0x230874[_0x6549('0x4c')][_0x6549('0x6f')]}})[_0x6549('0x26')](handleEntityNotFound(_0x3be369,null))['then'](function(_0x158c92){if(_0x158c92){return _0x158c92;}return null;})[_0x6549('0x26')](respondWithResult(_0x3be369,null))[_0x6549('0x43')](handleError(_0x3be369,null));}; \ No newline at end of file +var _0x1623=['reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','dropContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','phone','scheduledAt','ListId','createdAt','select','ANY_VALUE(calleridnum)','field','NOW()','ContactId','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','from','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','VoiceQueueId\x20=\x20?','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','updatedAt','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','options','CmHopperFinal','findAll','rows','catch','show','params','length','find','describe','body','uniqueid','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts'];(function(_0x45318e,_0x358ed8){var _0x5272c4=function(_0x3c23b1){while(--_0x3c23b1){_0x45318e['push'](_0x45318e['shift']());}};_0x5272c4(++_0x358ed8);}(_0x1623,0xab));var _0x3162=function(_0x487b14,_0x26f63){_0x487b14=_0x487b14-0x0;var _0x2b87e7=_0x1623[_0x487b14];return _0x2b87e7;};'use strict';var emlformat=require(_0x3162('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3162('0x1'));var rp=require(_0x3162('0x2'));var moment=require(_0x3162('0x3'));var BPromise=require(_0x3162('0x4'));var Mustache=require(_0x3162('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3162('0x6'));var csv=require('to-csv');var ejs=require(_0x3162('0x7'));var fs=require('fs');var fs_extra=require(_0x3162('0x8'));var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0xd'));var querystring=require(_0x3162('0xe'));var Papa=require(_0x3162('0xf'));var Redis=require(_0x3162('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x11'));var hardwareService=require(_0x3162('0x12'));var logger=require(_0x3162('0x13'))(_0x3162('0x14'));var utils=require(_0x3162('0x15'));var config=require(_0x3162('0x16'));var licenseUtil=require(_0x3162('0x17'));var db=require(_0x3162('0x18'))['db'];function respondWithStatusCode(_0x157ab8,_0x4c3625){_0x4c3625=_0x4c3625||0xcc;return function(_0x2d11c5){if(_0x2d11c5){return _0x157ab8['sendStatus'](_0x4c3625);}return _0x157ab8[_0x3162('0x19')](_0x4c3625)[_0x3162('0x1a')]();};}function respondWithResult(_0x49d1ad,_0x4a393a){_0x4a393a=_0x4a393a||0xc8;return function(_0x198764){if(_0x198764){return _0x49d1ad[_0x3162('0x19')](_0x4a393a)[_0x3162('0x1b')](_0x198764);}};}function respondWithFilteredResult(_0x4b8a3b,_0x15e348){return function(_0x3d0bea){if(_0x3d0bea){var _0x2705d1=typeof _0x15e348['offset']===_0x3162('0x1c')&&typeof _0x15e348[_0x3162('0x1d')]===_0x3162('0x1c');var _0xc3ee06=_0x3d0bea[_0x3162('0x1e')];var _0x1eed46=_0x2705d1?0x0:_0x15e348[_0x3162('0x1f')];var _0x4b2bf3=_0x2705d1?_0x3d0bea[_0x3162('0x1e')]:_0x15e348[_0x3162('0x1f')]+_0x15e348[_0x3162('0x1d')];var _0x36ca97;if(_0x4b2bf3>=_0xc3ee06){_0x4b2bf3=_0xc3ee06;_0x36ca97=0xc8;}else{_0x36ca97=0xce;}_0x4b8a3b['status'](_0x36ca97);return _0x4b8a3b[_0x3162('0x20')]('Content-Range',_0x1eed46+'-'+_0x4b2bf3+'/'+_0xc3ee06)['json'](_0x3d0bea);}return null;};}function patchUpdates(_0xa5c62b){return function(_0x3e4d23){try{jsonpatch[_0x3162('0x21')](_0x3e4d23,_0xa5c62b,!![]);}catch(_0x523fab){return BPromise['reject'](_0x523fab);}return _0x3e4d23[_0x3162('0x22')]();};}function saveUpdates(_0x396372,_0x32c051){return function(_0x26c90d){if(_0x26c90d){return _0x26c90d[_0x3162('0x23')](_0x396372)[_0x3162('0x24')](function(_0x52ae25){return _0x52ae25;});}return null;};}function removeEntity(_0x1b2713,_0x5a4994){return function(_0xd283d6){if(_0xd283d6){return _0xd283d6[_0x3162('0x25')]()[_0x3162('0x24')](function(){_0x1b2713[_0x3162('0x19')](0xcc)[_0x3162('0x1a')]();});}};}function handleEntityNotFound(_0x3c543e,_0x30552f){return function(_0x5f8f7){if(!_0x5f8f7){_0x3c543e[_0x3162('0x26')](0x194);}return _0x5f8f7;};}function handleError(_0x356c5d,_0x8fa09f){_0x8fa09f=_0x8fa09f||0x1f4;return function(_0x2f62d7){logger[_0x3162('0x27')](_0x2f62d7['stack']);if(_0x2f62d7[_0x3162('0x28')]){delete _0x2f62d7['name'];}_0x356c5d[_0x3162('0x19')](_0x8fa09f)[_0x3162('0x29')](_0x2f62d7);};}exports[_0x3162('0x2a')]=function(_0x57f567,_0x4903e7){var _0xda0389={},_0xaa1f35={},_0x14df16={'count':0x0,'rows':[]};var _0x399148=_[_0x3162('0x2b')](db['CmHopperFinal'][_0x3162('0x2c')],function(_0x4e3cc2){return{'name':_0x4e3cc2[_0x3162('0x2d')],'type':_0x4e3cc2[_0x3162('0x2e')][_0x3162('0x2f')]};});_0xaa1f35[_0x3162('0x30')]=_[_0x3162('0x2b')](_0x399148,_0x3162('0x28'));_0xaa1f35[_0x3162('0x31')]=_[_0x3162('0x32')](_0x57f567['query']);_0xaa1f35[_0x3162('0x33')]=_[_0x3162('0x34')](_0xaa1f35['model'],_0xaa1f35[_0x3162('0x31')]);_0xda0389[_0x3162('0x35')]=_['intersection'](_0xaa1f35['model'],qs[_0x3162('0x36')](_0x57f567['query'][_0x3162('0x36')]));_0xda0389[_0x3162('0x35')]=_0xda0389[_0x3162('0x35')]['length']?_0xda0389['attributes']:_0xaa1f35[_0x3162('0x30')];if(!_0x57f567[_0x3162('0x31')]['hasOwnProperty'](_0x3162('0x37'))){_0xda0389['limit']=qs[_0x3162('0x1d')](_0x57f567[_0x3162('0x31')][_0x3162('0x1d')]);_0xda0389[_0x3162('0x1f')]=qs[_0x3162('0x1f')](_0x57f567[_0x3162('0x31')][_0x3162('0x1f')]);}_0xda0389[_0x3162('0x38')]=qs[_0x3162('0x39')](_0x57f567[_0x3162('0x31')][_0x3162('0x39')]);_0xda0389['where']=qs[_0x3162('0x33')](_[_0x3162('0x3a')](_0x57f567[_0x3162('0x31')],_0xaa1f35['filters']),_0x399148);if(_0x57f567['query'][_0x3162('0x3b')]){_0xda0389[_0x3162('0x3c')]=_[_0x3162('0x3d')](_0xda0389[_0x3162('0x3c')],{'$or':_['map'](_0x399148,function(_0x4186b6){if(_0x4186b6['type']!=='VIRTUAL'){var _0x5dee49={};_0x5dee49[_0x4186b6[_0x3162('0x28')]]={'$like':'%'+_0x57f567[_0x3162('0x31')][_0x3162('0x3b')]+'%'};return _0x5dee49;}})});}_0xda0389=_['merge']({},_0xda0389,_0x57f567[_0x3162('0x3e')]);var _0x2ce9c6={'where':_0xda0389[_0x3162('0x3c')]};return db[_0x3162('0x3f')][_0x3162('0x1e')](_0x2ce9c6)['then'](function(_0x5447d6){_0x14df16[_0x3162('0x1e')]=_0x5447d6;if(_0x57f567[_0x3162('0x31')]['includeAll']){_0xda0389['include']=[{'all':!![]}];}return db[_0x3162('0x3f')][_0x3162('0x40')](_0xda0389);})[_0x3162('0x24')](function(_0x4883ac){_0x14df16[_0x3162('0x41')]=_0x4883ac;return _0x14df16;})[_0x3162('0x24')](respondWithFilteredResult(_0x4903e7,_0xda0389))[_0x3162('0x42')](handleError(_0x4903e7,null));};exports[_0x3162('0x43')]=function(_0x534708,_0x2617d3){var _0x282e3e={'raw':!![],'where':{'id':_0x534708[_0x3162('0x44')]['id']}},_0x522cce={};_0x522cce[_0x3162('0x30')]=_['keys'](db[_0x3162('0x3f')][_0x3162('0x2c')]);_0x522cce['query']=_[_0x3162('0x32')](_0x534708['query']);_0x522cce[_0x3162('0x33')]=_[_0x3162('0x34')](_0x522cce[_0x3162('0x30')],_0x522cce[_0x3162('0x31')]);_0x282e3e[_0x3162('0x35')]=_[_0x3162('0x34')](_0x522cce['model'],qs[_0x3162('0x36')](_0x534708[_0x3162('0x31')][_0x3162('0x36')]));_0x282e3e['attributes']=_0x282e3e[_0x3162('0x35')][_0x3162('0x45')]?_0x282e3e['attributes']:_0x522cce[_0x3162('0x30')];if(_0x534708['query']['includeAll']){_0x282e3e['include']=[{'all':!![]}];}_0x282e3e=_[_0x3162('0x3d')]({},_0x282e3e,_0x534708[_0x3162('0x3e')]);return db[_0x3162('0x3f')][_0x3162('0x46')](_0x282e3e)[_0x3162('0x24')](handleEntityNotFound(_0x2617d3,null))[_0x3162('0x24')](respondWithResult(_0x2617d3,null))[_0x3162('0x42')](handleError(_0x2617d3,null));};exports[_0x3162('0x47')]=function(_0x3d2958,_0x28865c){return db[_0x3162('0x3f')][_0x3162('0x47')]()[_0x3162('0x24')](respondWithResult(_0x28865c,null))['catch'](handleError(_0x28865c,null));};exports[_0x3162('0x23')]=function(_0x48cb8f,_0x4f1dde){if(_0x48cb8f[_0x3162('0x48')][_0x3162('0x49')]){delete _0x48cb8f[_0x3162('0x48')][_0x3162('0x49')];}return db['CmHopperFinal'][_0x3162('0x46')]({'where':{'uniqueid':_0x48cb8f['params']['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x4f1dde,null))[_0x3162('0x24')](saveUpdates(_0x48cb8f['body'],null))[_0x3162('0x24')](respondWithResult(_0x4f1dde,null))['catch'](handleError(_0x4f1dde,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x13e7c4,_0x22c0a2,_0x160364){return db[_0x3162('0x3f')][_0x3162('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x13e7c4[_0x3162('0x44')]['id']},'attributes':[[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x3162('0x4c')))),_0x3162('0x4d')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')]('`state`\x20=\x203,\x201,\x20null'))),_0x3162('0x4f')],[db['sequelize']['fn'](_0x3162('0x4b'),db['sequelize']['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x50')))),_0x3162('0x51')],[db['sequelize']['fn']('COUNT',db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x52')))),_0x3162('0x53')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db['sequelize'][_0x3162('0x4e')](_0x3162('0x54')))),'dropContacts'],[db['sequelize']['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x55')))),_0x3162('0x56')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db['sequelize']['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x3162('0x57')],[db['sequelize']['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x58')))),_0x3162('0x59')]]})[_0x3162('0x24')](handleEntityNotFound(_0x22c0a2,null))[_0x3162('0x24')](respondWithResult(_0x22c0a2,null))[_0x3162('0x42')](handleError(_0x22c0a2,null));};exports[_0x3162('0x5a')]=function(_0x4b5729,_0x4a42ea,_0x520b1a){return db[_0x3162('0x3f')]['findAll']({'raw':![],'where':{'CampaignId':_0x4b5729[_0x3162('0x44')]['id']},'attributes':[[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x3162('0x4d')],[db[_0x3162('0x4a')]['fn']('COUNT',db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x5b')))),_0x3162('0x4f')],[db['sequelize']['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x50')))),'busyContacts'],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x52')))),_0x3162('0x53')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x54')))),_0x3162('0x5c')],[db[_0x3162('0x4a')]['fn']('COUNT',db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x55')))),'abandonedContacts'],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x5d')))),'reCallContacts'],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x58')))),'answeringMachine']]})[_0x3162('0x24')](handleEntityNotFound(_0x4a42ea,null))[_0x3162('0x24')](respondWithResult(_0x4a42ea,null))[_0x3162('0x42')](handleError(_0x4a42ea,null));};exports[_0x3162('0x5e')]=function(_0x8a75ca,_0x33c39d,_0xb3d824){return db['VoiceQueue']['find']({'where':{'id':_0x8a75ca['params']['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x33c39d,null))[_0x3162('0x24')](function(_0x59b3f7){var _0x129005;if(_0x59b3f7){_0x129005=squel[_0x3162('0x5f')]()[_0x3162('0x60')](_0x3162('0x61'))['fromQuery']([_0x3162('0x62'),_0x3162('0x63'),'ContactId',_0x3162('0x64'),'VoiceQueueId',_0x3162('0x65'),'updatedAt'],squel[_0x3162('0x66')]()['field'](_0x3162('0x67'),_0x3162('0x62'))[_0x3162('0x68')](_0x3162('0x69'),_0x3162('0x63'))[_0x3162('0x68')]('ANY_VALUE(ContactId)',_0x3162('0x6a'))[_0x3162('0x68')](_0x3162('0x6b'),'ListId')[_0x3162('0x68')](_0x3162('0x6c'),_0x3162('0x6d'))[_0x3162('0x68')](_0x3162('0x69'),'createdAt')[_0x3162('0x68')](_0x3162('0x69'),'updatedAt')['from'](_0x3162('0x6e'))[_0x3162('0x3c')]('VoiceQueueId\x20=\x20?',_0x8a75ca[_0x3162('0x44')]['id'][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x70'),_0x8a75ca[_0x3162('0x48')][_0x3162('0x71')][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x72'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x3162('0x66')]()[_0x3162('0x68')]('phone')[_0x3162('0x73')]('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0x8a75ca[_0x3162('0x44')]['id']['toString']()))[_0x3162('0x3c')](_0x3162('0x74'),squel[_0x3162('0x66')]()[_0x3162('0x68')](_0x3162('0x75'))[_0x3162('0x73')](_0x3162('0x6e'))[_0x3162('0x3c')](_0x3162('0x76'),_0x8a75ca[_0x3162('0x44')]['id'][_0x3162('0x6f')]())['where'](_0x3162('0x77')))[_0x3162('0x78')](_0x3162('0x6a')))[_0x3162('0x6f')]();return db[_0x3162('0x4a')][_0x3162('0x31')](_0x129005);}return[];})[_0x3162('0x24')](respondWithResult(_0x33c39d,null))[_0x3162('0x42')](handleError(_0x33c39d,null));};exports[_0x3162('0x79')]=function(_0x3f37fa,_0x1d242f,_0x190f91){return db['Campaign'][_0x3162('0x46')]({'where':{'id':_0x3f37fa[_0x3162('0x44')]['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x1d242f,null))['then'](function(_0x3d7bd1){var _0x5cdbb0;if(_0x3d7bd1){_0x5cdbb0=squel[_0x3162('0x5f')]()[_0x3162('0x60')]('cm_hopper')['fromQuery']([_0x3162('0x62'),_0x3162('0x63'),'ContactId',_0x3162('0x64'),'CampaignId',_0x3162('0x65'),_0x3162('0x7a')],squel[_0x3162('0x66')]()[_0x3162('0x68')](_0x3162('0x67'),_0x3162('0x62'))[_0x3162('0x68')](_0x3162('0x69'),_0x3162('0x63'))['field'](_0x3162('0x7b'),'ContactId')[_0x3162('0x68')](_0x3162('0x6b'),'ListId')[_0x3162('0x68')](_0x3162('0x7c'),_0x3162('0x7d'))[_0x3162('0x68')](_0x3162('0x69'),_0x3162('0x65'))[_0x3162('0x68')]('NOW()',_0x3162('0x7a'))[_0x3162('0x73')](_0x3162('0x6e'))['where'](_0x3162('0x7e'),_0x3f37fa[_0x3162('0x44')]['id'][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x70'),_0x3f37fa[_0x3162('0x48')]['state'][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x72'))[_0x3162('0x3c')](_0x3162('0x74'),squel['select']()[_0x3162('0x68')]('phone')[_0x3162('0x73')](_0x3162('0x61'))['where'](_0x3162('0x7e'),_0x3f37fa[_0x3162('0x44')]['id'][_0x3162('0x6f')]()))['where'](_0x3162('0x74'),squel['select']()['field'](_0x3162('0x75'))[_0x3162('0x73')](_0x3162('0x6e'))[_0x3162('0x3c')](_0x3162('0x7e'),_0x3f37fa[_0x3162('0x44')]['id'][_0x3162('0x6f')]())['where']('state\x20=\x204'))['group'](_0x3162('0x6a')))[_0x3162('0x6f')]();return db['sequelize']['query'](_0x5cdbb0);}return[];})[_0x3162('0x24')](respondWithResult(_0x1d242f,null))['catch'](handleError(_0x1d242f,null));};exports[_0x3162('0x7f')]=function(_0x35d9f0,_0x4408db,_0x377edb){return db['CmHopper'][_0x3162('0x80')]({'where':{'VoiceQueueId':_0x35d9f0[_0x3162('0x48')][_0x3162('0x6d')],'CampaignId':_0x35d9f0['body'][_0x3162('0x7d')],'ContactId':_0x35d9f0['body'][_0x3162('0x6a')]}})['then'](handleEntityNotFound(_0x4408db,null))[_0x3162('0x24')](function(_0x3d414f){if(_0x3d414f){return _0x3d414f;}return null;})[_0x3162('0x24')](respondWithResult(_0x4408db,null))['catch'](handleError(_0x4408db,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 3554c21..d39e58a 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 _0xb57b=['../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','calleridnum','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb57b,0x96));var _0xbb57=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xb57b[_0x487b0c];return _0x1adbdc;};'use strict';var _=require('lodash');var util=require(_0xbb57('0x0'));var logger=require(_0xbb57('0x1'))('api');var moment=require(_0xbb57('0x2'));var BPromise=require(_0xbb57('0x3'));var rp=require(_0xbb57('0x4'));var fs=require('fs');var path=require(_0xbb57('0x5'));var rimraf=require('rimraf');var config=require(_0xbb57('0x6'));var attributes=require(_0xbb57('0x7'));module[_0xbb57('0x8')]=function(_0x27b6e9,_0xbbd110){return _0x27b6e9[_0xbb57('0x9')](_0xbb57('0xa'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xbb57('0xb')]},{'name':'uniqueid','fields':[_0xbb57('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbd95=['../../config/logger','api','moment','bluebird','path','rimraf','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util'];(function(_0x2b4ed7,_0x3de6bc){var _0x2974f6=function(_0x549e96){while(--_0x549e96){_0x2b4ed7['push'](_0x2b4ed7['shift']());}};_0x2974f6(++_0x3de6bc);}(_0xbd95,0x1a2));var _0x5bd9=function(_0x53d231,_0x1072b1){_0x53d231=_0x53d231-0x0;var _0x20956b=_0xbd95[_0x53d231];return _0x20956b;};'use strict';var _=require(_0x5bd9('0x0'));var util=require(_0x5bd9('0x1'));var logger=require(_0x5bd9('0x2'))(_0x5bd9('0x3'));var moment=require(_0x5bd9('0x4'));var BPromise=require(_0x5bd9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5bd9('0x6'));var rimraf=require(_0x5bd9('0x7'));var config=require('../../config/environment');var attributes=require(_0x5bd9('0x8'));module[_0x5bd9('0x9')]=function(_0x14cc2b,_0x1de259){return _0x14cc2b[_0x5bd9('0xa')](_0x5bd9('0xb'),attributes,{'tableName':_0x5bd9('0xc'),'paranoid':![],'indexes':[{'name':_0x5bd9('0xd'),'fields':['calleridnum']},{'name':'uniqueid','fields':[_0x5bd9('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 96615be..f22995a 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x55f104,_0x38d4e1){var _0x575026=function(_0x3f3112){while(--_0x3f3112){_0x55f104['push'](_0x55f104['shift']());}};_0x575026(++_0x38d4e1);}(_0xb10b,0x12a));var _0xbb10=function(_0x13137e,_0x29c0f3){_0x13137e=_0x13137e-0x0;var _0x346261=_0xb10b[_0x13137e];return _0x346261;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x5690e2,_0x4fbe8e){var _0x360b7c=function(_0x10dc84){while(--_0x10dc84){_0x5690e2['push'](_0x5690e2['shift']());}};_0x360b7c(++_0x4fbe8e);}(_0x7a54,0x106));var _0x47a5=function(_0x216914,_0x445b18){_0x216914=_0x216914-0x0;var _0xdb2782=_0x7a54[_0x216914];return _0xdb2782;};'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 5aa9d38..d1a15e8 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 _0x1373=['../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','isAuthenticated','index','/describe','describe','get','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','connect-timeout','express','Router','fs-extra'];(function(_0x2f4054,_0x2a90f6){var _0x3cd1fd=function(_0x5d2723){while(--_0x5d2723){_0x2f4054['push'](_0x2f4054['shift']());}};_0x3cd1fd(++_0x2a90f6);}(_0x1373,0x1e1));var _0x3137=function(_0x21e71a,_0xf0b818){_0x21e71a=_0x21e71a-0x0;var _0x174f46=_0x1373[_0x21e71a];return _0x174f46;};'use strict';var multer=require(_0x3137('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3137('0x1'));var express=require(_0x3137('0x2'));var router=express[_0x3137('0x3')]();var fs_extra=require(_0x3137('0x4'));var auth=require(_0x3137('0x5'));var interaction=require(_0x3137('0x6'));var config=require('../../config/environment');var controller=require(_0x3137('0x7'));router['get']('/',auth[_0x3137('0x8')](),controller[_0x3137('0x9')]);router['get'](_0x3137('0xa'),auth['isAuthenticated'](),controller[_0x3137('0xb')]);router[_0x3137('0xc')]('/:id',auth[_0x3137('0x8')](),controller['show']);router[_0x3137('0xc')](_0x3137('0xd'),auth[_0x3137('0x8')](),controller[_0x3137('0xe')]);router[_0x3137('0xc')](_0x3137('0xf'),auth[_0x3137('0x8')](),controller[_0x3137('0x10')]);router[_0x3137('0x11')](_0x3137('0x12'),auth[_0x3137('0x8')](),controller[_0x3137('0x13')]);router[_0x3137('0x11')](_0x3137('0x14'),auth[_0x3137('0x8')](),controller[_0x3137('0x15')]);router[_0x3137('0x11')](_0x3137('0x16'),auth['isAuthenticated'](),controller[_0x3137('0x17')]);router[_0x3137('0x18')]('/:id',auth[_0x3137('0x8')](),controller[_0x3137('0x19')]);module[_0x3137('0x1a')]=router; \ No newline at end of file +var _0x0a1f=['isAuthenticated','index','/describe','describe','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','util','path','express','Router','fs-extra','../../config/environment','./cmHopperFinal.controller','get'];(function(_0x403396,_0x28f1d6){var _0x1cafd9=function(_0x4c43c0){while(--_0x4c43c0){_0x403396['push'](_0x403396['shift']());}};_0x1cafd9(++_0x28f1d6);}(_0x0a1f,0x88));var _0xf0a1=function(_0x22a1b7,_0x1822b7){_0x22a1b7=_0x22a1b7-0x0;var _0x2d1d50=_0x0a1f[_0x22a1b7];return _0x2d1d50;};'use strict';var multer=require('multer');var util=require(_0xf0a1('0x0'));var path=require(_0xf0a1('0x1'));var timeout=require('connect-timeout');var express=require(_0xf0a1('0x2'));var router=express[_0xf0a1('0x3')]();var fs_extra=require(_0xf0a1('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf0a1('0x5'));var controller=require(_0xf0a1('0x6'));router[_0xf0a1('0x7')]('/',auth[_0xf0a1('0x8')](),controller[_0xf0a1('0x9')]);router[_0xf0a1('0x7')](_0xf0a1('0xa'),auth['isAuthenticated'](),controller[_0xf0a1('0xb')]);router[_0xf0a1('0x7')](_0xf0a1('0xc'),auth[_0xf0a1('0x8')](),controller[_0xf0a1('0xd')]);router[_0xf0a1('0x7')]('/voice/queue/countAttributes/:id',auth[_0xf0a1('0x8')](),controller[_0xf0a1('0xe')]);router[_0xf0a1('0x7')](_0xf0a1('0xf'),auth[_0xf0a1('0x8')](),controller[_0xf0a1('0x10')]);router[_0xf0a1('0x11')]('/voice/queue/moveContacts/:id',auth[_0xf0a1('0x8')](),controller[_0xf0a1('0x12')]);router['post'](_0xf0a1('0x13'),auth[_0xf0a1('0x8')](),controller[_0xf0a1('0x14')]);router[_0xf0a1('0x11')](_0xf0a1('0x15'),auth[_0xf0a1('0x8')](),controller[_0xf0a1('0x16')]);router['put'](_0xf0a1('0xc'),auth[_0xf0a1('0x8')](),controller[_0xf0a1('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 90842df..b22eb67 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 _0x586d=['exports','INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x586d,0x155));var _0xd586=function(_0x2ee57a,_0x3cc404){_0x2ee57a=_0x2ee57a-0x0;var _0x55197f=_0x586d[_0x2ee57a];return _0x55197f;};'use strict';var Sequelize=require(_0xd586('0x0'));module[_0xd586('0x1')]={'state':{'type':Sequelize[_0xd586('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xd586('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xd586('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd586('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd586('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xd586('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xd586('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd586('0x3')]},'calleridname':{'type':Sequelize[_0xd586('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xd586('0x4')]},'answertime':{'type':Sequelize[_0xd586('0x4')]},'droptime':{'type':Sequelize[_0xd586('0x4')]},'endtime':{'type':Sequelize[_0xd586('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xd586('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd586('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xd586('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xd586('0x3')]},'campaigntype':{'type':Sequelize[_0xd586('0x3')]},'membername':{'type':Sequelize[_0xd586('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xd586('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xd586('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd586('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd586('0x4')]},'recallme':{'type':Sequelize[_0xd586('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xd586('0x4')]},'edited':{'type':Sequelize[_0xd586('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xd586('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd586('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd586('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd586('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xd586('0x3')]}}; \ No newline at end of file +var _0xaae4=['sequelize','exports','INTEGER','DATE','STRING','BOOLEAN'];(function(_0x45209d,_0x98639a){var _0x5a1c63=function(_0x1704cd){while(--_0x1704cd){_0x45209d['push'](_0x45209d['shift']());}};_0x5a1c63(++_0x98639a);}(_0xaae4,0x120));var _0x4aae=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xaae4[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x4aae('0x0'));module[_0x4aae('0x1')]={'state':{'type':Sequelize[_0x4aae('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x4aae('0x3')]},'countbusyretry':{'type':Sequelize[_0x4aae('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4aae('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4aae('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x4aae('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x4aae('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x4aae('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x4aae('0x4')]},'calleridname':{'type':Sequelize[_0x4aae('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x4aae('0x3')]},'answertime':{'type':Sequelize[_0x4aae('0x3')]},'droptime':{'type':Sequelize[_0x4aae('0x3')]},'endtime':{'type':Sequelize[_0x4aae('0x3')]},'ringtime':{'type':Sequelize[_0x4aae('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x4aae('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x4aae('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x4aae('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x4aae('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x4aae('0x4')]},'membername':{'type':Sequelize[_0x4aae('0x4')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x4aae('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x4aae('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x4aae('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x4aae('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4aae('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4aae('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4aae('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4aae('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x4aae('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index e5860fb..96b2de9 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 _0x7a80=['filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../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','index','map','CmHopperHistory','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x810025,_0x34bb04){var _0x4dbc81=function(_0x2c3907){while(--_0x2c3907){_0x810025['push'](_0x810025['shift']());}};_0x4dbc81(++_0x34bb04);}(_0x7a80,0x10a));var _0x07a8=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7a80[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0x07a8('0x0'));var rimraf=require(_0x07a8('0x1'));var zipdir=require(_0x07a8('0x2'));var jsonpatch=require(_0x07a8('0x3'));var rp=require(_0x07a8('0x4'));var moment=require(_0x07a8('0x5'));var BPromise=require(_0x07a8('0x6'));var Mustache=require(_0x07a8('0x7'));var util=require(_0x07a8('0x8'));var path=require(_0x07a8('0x9'));var sox=require('sox');var csv=require(_0x07a8('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x07a8('0xb'));var _=require(_0x07a8('0xc'));var squel=require(_0x07a8('0xd'));var crypto=require(_0x07a8('0xe'));var jsforce=require(_0x07a8('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x07a8('0xa'));var querystring=require('querystring');var Papa=require(_0x07a8('0x10'));var Redis=require(_0x07a8('0x11'));var authService=require(_0x07a8('0x12'));var qs=require(_0x07a8('0x13'));var as=require(_0x07a8('0x14'));var hardwareService=require(_0x07a8('0x15'));var logger=require(_0x07a8('0x16'))(_0x07a8('0x17'));var utils=require('../../config/utils');var config=require(_0x07a8('0x18'));var licenseUtil=require(_0x07a8('0x19'));var db=require(_0x07a8('0x1a'))['db'];function respondWithStatusCode(_0x535dd6,_0xbd8352){_0xbd8352=_0xbd8352||0xcc;return function(_0x2c712e){if(_0x2c712e){return _0x535dd6['sendStatus'](_0xbd8352);}return _0x535dd6[_0x07a8('0x1b')](_0xbd8352)[_0x07a8('0x1c')]();};}function respondWithResult(_0x4c18ba,_0x2b165c){_0x2b165c=_0x2b165c||0xc8;return function(_0x1a9a93){if(_0x1a9a93){return _0x4c18ba['status'](_0x2b165c)[_0x07a8('0x1d')](_0x1a9a93);}};}function respondWithFilteredResult(_0x25bb33,_0x1f7e3c){return function(_0x177a4a){if(_0x177a4a){var _0xcf4f6a=typeof _0x1f7e3c[_0x07a8('0x1e')]===_0x07a8('0x1f')&&typeof _0x1f7e3c[_0x07a8('0x20')]===_0x07a8('0x1f');var _0xaf8b2a=_0x177a4a[_0x07a8('0x21')];var _0x3ce272=_0xcf4f6a?0x0:_0x1f7e3c[_0x07a8('0x1e')];var _0x560dfa=_0xcf4f6a?_0x177a4a[_0x07a8('0x21')]:_0x1f7e3c[_0x07a8('0x1e')]+_0x1f7e3c[_0x07a8('0x20')];var _0x4419e0;if(_0x560dfa>=_0xaf8b2a){_0x560dfa=_0xaf8b2a;_0x4419e0=0xc8;}else{_0x4419e0=0xce;}_0x25bb33['status'](_0x4419e0);return _0x25bb33[_0x07a8('0x22')](_0x07a8('0x23'),_0x3ce272+'-'+_0x560dfa+'/'+_0xaf8b2a)[_0x07a8('0x1d')](_0x177a4a);}return null;};}function patchUpdates(_0x15550d){return function(_0x25f84f){try{jsonpatch[_0x07a8('0x24')](_0x25f84f,_0x15550d,!![]);}catch(_0x5ef519){return BPromise[_0x07a8('0x25')](_0x5ef519);}return _0x25f84f[_0x07a8('0x26')]();};}function saveUpdates(_0x1cf742,_0x1b4ff9){return function(_0x4caafa){if(_0x4caafa){return _0x4caafa[_0x07a8('0x27')](_0x1cf742)[_0x07a8('0x28')](function(_0x449ccf){return _0x449ccf;});}return null;};}function removeEntity(_0x2a6fb9,_0x3a795f){return function(_0x3954d7){if(_0x3954d7){return _0x3954d7[_0x07a8('0x29')]()[_0x07a8('0x28')](function(){_0x2a6fb9[_0x07a8('0x1b')](0xcc)[_0x07a8('0x1c')]();});}};}function handleEntityNotFound(_0x5e3eab,_0x293a7f){return function(_0x51e37f){if(!_0x51e37f){_0x5e3eab[_0x07a8('0x2a')](0x194);}return _0x51e37f;};}function handleError(_0x432533,_0x394865){_0x394865=_0x394865||0x1f4;return function(_0x27b7b2){logger[_0x07a8('0x2b')](_0x27b7b2[_0x07a8('0x2c')]);if(_0x27b7b2[_0x07a8('0x2d')]){delete _0x27b7b2[_0x07a8('0x2d')];}_0x432533['status'](_0x394865)[_0x07a8('0x2e')](_0x27b7b2);};}exports[_0x07a8('0x2f')]=function(_0x4748c1,_0x2f529a){var _0x3f7b8a={},_0x2d6647={},_0x4603e5={'count':0x0,'rows':[]};var _0x501fd3=_[_0x07a8('0x30')](db[_0x07a8('0x31')][_0x07a8('0x32')],function(_0x11d4c2){return{'name':_0x11d4c2[_0x07a8('0x33')],'type':_0x11d4c2['type'][_0x07a8('0x34')]};});_0x2d6647[_0x07a8('0x35')]=_[_0x07a8('0x30')](_0x501fd3,'name');_0x2d6647['query']=_[_0x07a8('0x36')](_0x4748c1[_0x07a8('0x37')]);_0x2d6647['filters']=_[_0x07a8('0x38')](_0x2d6647[_0x07a8('0x35')],_0x2d6647['query']);_0x3f7b8a[_0x07a8('0x39')]=_['intersection'](_0x2d6647[_0x07a8('0x35')],qs[_0x07a8('0x3a')](_0x4748c1[_0x07a8('0x37')][_0x07a8('0x3a')]));_0x3f7b8a[_0x07a8('0x39')]=_0x3f7b8a['attributes'][_0x07a8('0x3b')]?_0x3f7b8a[_0x07a8('0x39')]:_0x2d6647[_0x07a8('0x35')];if(!_0x4748c1[_0x07a8('0x37')][_0x07a8('0x3c')](_0x07a8('0x3d'))){_0x3f7b8a[_0x07a8('0x20')]=qs[_0x07a8('0x20')](_0x4748c1['query'][_0x07a8('0x20')]);_0x3f7b8a[_0x07a8('0x1e')]=qs['offset'](_0x4748c1[_0x07a8('0x37')]['offset']);}_0x3f7b8a[_0x07a8('0x3e')]=qs['sort'](_0x4748c1[_0x07a8('0x37')][_0x07a8('0x3f')]);_0x3f7b8a[_0x07a8('0x40')]=qs['filters'](_[_0x07a8('0x41')](_0x4748c1[_0x07a8('0x37')],_0x2d6647[_0x07a8('0x42')]),_0x501fd3);if(_0x4748c1['query'][_0x07a8('0x43')]){_0x3f7b8a[_0x07a8('0x40')]=_[_0x07a8('0x44')](_0x3f7b8a[_0x07a8('0x40')],{'$or':_[_0x07a8('0x30')](_0x501fd3,function(_0x3c13ed){if(_0x3c13ed[_0x07a8('0x45')]!==_0x07a8('0x46')){var _0x68f8d5={};_0x68f8d5[_0x3c13ed[_0x07a8('0x2d')]]={'$like':'%'+_0x4748c1[_0x07a8('0x37')][_0x07a8('0x43')]+'%'};return _0x68f8d5;}})});}_0x3f7b8a=_[_0x07a8('0x44')]({},_0x3f7b8a,_0x4748c1[_0x07a8('0x47')]);var _0x1a8da7={'where':_0x3f7b8a[_0x07a8('0x40')]};return db[_0x07a8('0x31')][_0x07a8('0x21')](_0x1a8da7)[_0x07a8('0x28')](function(_0x3fb30d){_0x4603e5[_0x07a8('0x21')]=_0x3fb30d;if(_0x4748c1[_0x07a8('0x37')][_0x07a8('0x48')]){_0x3f7b8a[_0x07a8('0x49')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x07a8('0x4a')](_0x3f7b8a);})[_0x07a8('0x28')](function(_0x13ddad){_0x4603e5['rows']=_0x13ddad;return _0x4603e5;})[_0x07a8('0x28')](respondWithFilteredResult(_0x2f529a,_0x3f7b8a))[_0x07a8('0x4b')](handleError(_0x2f529a,null));};exports[_0x07a8('0x4c')]=function(_0x3c5f92,_0x5c95bc){var _0x30009d={'raw':!![],'where':{'id':_0x3c5f92[_0x07a8('0x4d')]['id']}},_0x1f3ca3={};_0x1f3ca3[_0x07a8('0x35')]=_['keys'](db[_0x07a8('0x31')][_0x07a8('0x32')]);_0x1f3ca3['query']=_[_0x07a8('0x36')](_0x3c5f92[_0x07a8('0x37')]);_0x1f3ca3[_0x07a8('0x42')]=_[_0x07a8('0x38')](_0x1f3ca3[_0x07a8('0x35')],_0x1f3ca3[_0x07a8('0x37')]);_0x30009d['attributes']=_[_0x07a8('0x38')](_0x1f3ca3[_0x07a8('0x35')],qs[_0x07a8('0x3a')](_0x3c5f92['query'][_0x07a8('0x3a')]));_0x30009d[_0x07a8('0x39')]=_0x30009d[_0x07a8('0x39')][_0x07a8('0x3b')]?_0x30009d[_0x07a8('0x39')]:_0x1f3ca3[_0x07a8('0x35')];if(_0x3c5f92[_0x07a8('0x37')][_0x07a8('0x48')]){_0x30009d[_0x07a8('0x49')]=[{'all':!![]}];}_0x30009d=_[_0x07a8('0x44')]({},_0x30009d,_0x3c5f92[_0x07a8('0x47')]);return db[_0x07a8('0x31')][_0x07a8('0x4e')](_0x30009d)[_0x07a8('0x28')](handleEntityNotFound(_0x5c95bc,null))[_0x07a8('0x28')](respondWithResult(_0x5c95bc,null))[_0x07a8('0x4b')](handleError(_0x5c95bc,null));};exports[_0x07a8('0x4f')]=function(_0x5d58e9,_0x2e49c4){return db['CmHopperHistory']['create'](_0x5d58e9[_0x07a8('0x50')],{})[_0x07a8('0x28')](respondWithResult(_0x2e49c4,0xc9))[_0x07a8('0x4b')](handleError(_0x2e49c4,null));};exports[_0x07a8('0x51')]=function(_0x20d854,_0x3d7ebf){return db[_0x07a8('0x31')][_0x07a8('0x51')]()[_0x07a8('0x28')](respondWithResult(_0x3d7ebf,null))[_0x07a8('0x4b')](handleError(_0x3d7ebf,null));};exports[_0x07a8('0x27')]=function(_0x1f6627,_0x319a55){if(_0x1f6627[_0x07a8('0x50')][_0x07a8('0x52')]){delete _0x1f6627['body'][_0x07a8('0x52')];}return db[_0x07a8('0x31')]['find']({'where':{'uniqueid':_0x1f6627[_0x07a8('0x4d')]['id']}})[_0x07a8('0x28')](handleEntityNotFound(_0x319a55,null))[_0x07a8('0x28')](saveUpdates(_0x1f6627[_0x07a8('0x50')],null))['then'](respondWithResult(_0x319a55,null))[_0x07a8('0x4b')](handleError(_0x319a55,null));}; \ No newline at end of file +var _0x93bd=['mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','end','sendStatus','stack','name','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','describe','body','uniqueid','eml-format','rimraf','zip-dir','request-promise'];(function(_0x2687e5,_0x5d297f){var _0x2e7d32=function(_0x406f30){while(--_0x406f30){_0x2687e5['push'](_0x2687e5['shift']());}};_0x2e7d32(++_0x5d297f);}(_0x93bd,0x130));var _0xd93b=function(_0x2a9fbf,_0x1cdd71){_0x2a9fbf=_0x2a9fbf-0x0;var _0x21035f=_0x93bd[_0x2a9fbf];return _0x21035f;};'use strict';var emlformat=require(_0xd93b('0x0'));var rimraf=require(_0xd93b('0x1'));var zipdir=require(_0xd93b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd93b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd93b('0x4'));var util=require('util');var path=require(_0xd93b('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd93b('0x6'));var fs=require('fs');var fs_extra=require(_0xd93b('0x7'));var _=require(_0xd93b('0x8'));var squel=require(_0xd93b('0x9'));var crypto=require(_0xd93b('0xa'));var jsforce=require(_0xd93b('0xb'));var deskjs=require(_0xd93b('0xc'));var toCsv=require(_0xd93b('0xd'));var querystring=require(_0xd93b('0xe'));var Papa=require(_0xd93b('0xf'));var Redis=require('ioredis');var authService=require(_0xd93b('0x10'));var qs=require(_0xd93b('0x11'));var as=require(_0xd93b('0x12'));var hardwareService=require(_0xd93b('0x13'));var logger=require(_0xd93b('0x14'))('api');var utils=require(_0xd93b('0x15'));var config=require(_0xd93b('0x16'));var licenseUtil=require(_0xd93b('0x17'));var db=require(_0xd93b('0x18'))['db'];function respondWithStatusCode(_0x3a5b88,_0x836aad){_0x836aad=_0x836aad||0xcc;return function(_0xc89dbe){if(_0xc89dbe){return _0x3a5b88['sendStatus'](_0x836aad);}return _0x3a5b88['status'](_0x836aad)['end']();};}function respondWithResult(_0x44b1bb,_0x37cc49){_0x37cc49=_0x37cc49||0xc8;return function(_0x2ece05){if(_0x2ece05){return _0x44b1bb[_0xd93b('0x19')](_0x37cc49)[_0xd93b('0x1a')](_0x2ece05);}};}function respondWithFilteredResult(_0x50fed7,_0x15b7b7){return function(_0x4e3d86){if(_0x4e3d86){var _0x5d85cf=typeof _0x15b7b7[_0xd93b('0x1b')]===_0xd93b('0x1c')&&typeof _0x15b7b7[_0xd93b('0x1d')]===_0xd93b('0x1c');var _0x30e45b=_0x4e3d86[_0xd93b('0x1e')];var _0x2456a9=_0x5d85cf?0x0:_0x15b7b7[_0xd93b('0x1b')];var _0x29ee78=_0x5d85cf?_0x4e3d86['count']:_0x15b7b7[_0xd93b('0x1b')]+_0x15b7b7[_0xd93b('0x1d')];var _0x475f93;if(_0x29ee78>=_0x30e45b){_0x29ee78=_0x30e45b;_0x475f93=0xc8;}else{_0x475f93=0xce;}_0x50fed7[_0xd93b('0x19')](_0x475f93);return _0x50fed7['set'](_0xd93b('0x1f'),_0x2456a9+'-'+_0x29ee78+'/'+_0x30e45b)[_0xd93b('0x1a')](_0x4e3d86);}return null;};}function patchUpdates(_0x28c139){return function(_0x4a0a82){try{jsonpatch[_0xd93b('0x20')](_0x4a0a82,_0x28c139,!![]);}catch(_0x2d1eb6){return BPromise['reject'](_0x2d1eb6);}return _0x4a0a82[_0xd93b('0x21')]();};}function saveUpdates(_0x3c0dbe,_0x5d33d5){return function(_0x4dda32){if(_0x4dda32){return _0x4dda32[_0xd93b('0x22')](_0x3c0dbe)[_0xd93b('0x23')](function(_0x574a47){return _0x574a47;});}return null;};}function removeEntity(_0x5a5ffd,_0x54aa8f){return function(_0x3af860){if(_0x3af860){return _0x3af860[_0xd93b('0x24')]()[_0xd93b('0x23')](function(){_0x5a5ffd[_0xd93b('0x19')](0xcc)[_0xd93b('0x25')]();});}};}function handleEntityNotFound(_0x258c32,_0x433b06){return function(_0x312b92){if(!_0x312b92){_0x258c32[_0xd93b('0x26')](0x194);}return _0x312b92;};}function handleError(_0x5310eb,_0x83aa33){_0x83aa33=_0x83aa33||0x1f4;return function(_0x3ef88f){logger['error'](_0x3ef88f[_0xd93b('0x27')]);if(_0x3ef88f[_0xd93b('0x28')]){delete _0x3ef88f[_0xd93b('0x28')];}_0x5310eb[_0xd93b('0x19')](_0x83aa33)['send'](_0x3ef88f);};}exports['index']=function(_0x59a920,_0x4536ec){var _0x453267={},_0x204d1a={},_0x1ea320={'count':0x0,'rows':[]};var _0x25d48e=_[_0xd93b('0x29')](db[_0xd93b('0x2a')][_0xd93b('0x2b')],function(_0x21043c){return{'name':_0x21043c[_0xd93b('0x2c')],'type':_0x21043c[_0xd93b('0x2d')][_0xd93b('0x2e')]};});_0x204d1a[_0xd93b('0x2f')]=_[_0xd93b('0x29')](_0x25d48e,_0xd93b('0x28'));_0x204d1a[_0xd93b('0x30')]=_[_0xd93b('0x31')](_0x59a920[_0xd93b('0x30')]);_0x204d1a[_0xd93b('0x32')]=_[_0xd93b('0x33')](_0x204d1a[_0xd93b('0x2f')],_0x204d1a['query']);_0x453267[_0xd93b('0x34')]=_['intersection'](_0x204d1a[_0xd93b('0x2f')],qs[_0xd93b('0x35')](_0x59a920[_0xd93b('0x30')][_0xd93b('0x35')]));_0x453267[_0xd93b('0x34')]=_0x453267[_0xd93b('0x34')]['length']?_0x453267[_0xd93b('0x34')]:_0x204d1a[_0xd93b('0x2f')];if(!_0x59a920['query'][_0xd93b('0x36')](_0xd93b('0x37'))){_0x453267['limit']=qs[_0xd93b('0x1d')](_0x59a920[_0xd93b('0x30')]['limit']);_0x453267['offset']=qs[_0xd93b('0x1b')](_0x59a920[_0xd93b('0x30')][_0xd93b('0x1b')]);}_0x453267[_0xd93b('0x38')]=qs['sort'](_0x59a920[_0xd93b('0x30')][_0xd93b('0x39')]);_0x453267['where']=qs[_0xd93b('0x32')](_[_0xd93b('0x3a')](_0x59a920[_0xd93b('0x30')],_0x204d1a[_0xd93b('0x32')]),_0x25d48e);if(_0x59a920[_0xd93b('0x30')][_0xd93b('0x3b')]){_0x453267[_0xd93b('0x3c')]=_[_0xd93b('0x3d')](_0x453267[_0xd93b('0x3c')],{'$or':_['map'](_0x25d48e,function(_0x543042){if(_0x543042[_0xd93b('0x2d')]!==_0xd93b('0x3e')){var _0x2adf44={};_0x2adf44[_0x543042['name']]={'$like':'%'+_0x59a920[_0xd93b('0x30')][_0xd93b('0x3b')]+'%'};return _0x2adf44;}})});}_0x453267=_[_0xd93b('0x3d')]({},_0x453267,_0x59a920[_0xd93b('0x3f')]);var _0x477f02={'where':_0x453267['where']};return db[_0xd93b('0x2a')][_0xd93b('0x1e')](_0x477f02)[_0xd93b('0x23')](function(_0x294046){_0x1ea320[_0xd93b('0x1e')]=_0x294046;if(_0x59a920[_0xd93b('0x30')][_0xd93b('0x40')]){_0x453267['include']=[{'all':!![]}];}return db[_0xd93b('0x2a')][_0xd93b('0x41')](_0x453267);})[_0xd93b('0x23')](function(_0x59b65b){_0x1ea320[_0xd93b('0x42')]=_0x59b65b;return _0x1ea320;})[_0xd93b('0x23')](respondWithFilteredResult(_0x4536ec,_0x453267))[_0xd93b('0x43')](handleError(_0x4536ec,null));};exports[_0xd93b('0x44')]=function(_0x30b888,_0x475a64){var _0x18fd8f={'raw':!![],'where':{'id':_0x30b888[_0xd93b('0x45')]['id']}},_0x3e62b7={};_0x3e62b7['model']=_[_0xd93b('0x31')](db[_0xd93b('0x2a')][_0xd93b('0x2b')]);_0x3e62b7[_0xd93b('0x30')]=_[_0xd93b('0x31')](_0x30b888[_0xd93b('0x30')]);_0x3e62b7[_0xd93b('0x32')]=_[_0xd93b('0x33')](_0x3e62b7[_0xd93b('0x2f')],_0x3e62b7[_0xd93b('0x30')]);_0x18fd8f[_0xd93b('0x34')]=_['intersection'](_0x3e62b7[_0xd93b('0x2f')],qs[_0xd93b('0x35')](_0x30b888[_0xd93b('0x30')]['fields']));_0x18fd8f['attributes']=_0x18fd8f[_0xd93b('0x34')][_0xd93b('0x46')]?_0x18fd8f[_0xd93b('0x34')]:_0x3e62b7[_0xd93b('0x2f')];if(_0x30b888[_0xd93b('0x30')]['includeAll']){_0x18fd8f[_0xd93b('0x47')]=[{'all':!![]}];}_0x18fd8f=_['merge']({},_0x18fd8f,_0x30b888['options']);return db[_0xd93b('0x2a')][_0xd93b('0x48')](_0x18fd8f)[_0xd93b('0x23')](handleEntityNotFound(_0x475a64,null))[_0xd93b('0x23')](respondWithResult(_0x475a64,null))[_0xd93b('0x43')](handleError(_0x475a64,null));};exports[_0xd93b('0x49')]=function(_0x166588,_0x3af5c4){return db['CmHopperHistory'][_0xd93b('0x49')](_0x166588['body'],{})['then'](respondWithResult(_0x3af5c4,0xc9))[_0xd93b('0x43')](handleError(_0x3af5c4,null));};exports['describe']=function(_0x4c3ba,_0x3e87a6){return db[_0xd93b('0x2a')][_0xd93b('0x4a')]()['then'](respondWithResult(_0x3e87a6,null))[_0xd93b('0x43')](handleError(_0x3e87a6,null));};exports[_0xd93b('0x22')]=function(_0x6bc927,_0x57d47a){if(_0x6bc927[_0xd93b('0x4b')]['uniqueid']){delete _0x6bc927[_0xd93b('0x4b')][_0xd93b('0x4c')];}return db[_0xd93b('0x2a')][_0xd93b('0x48')]({'where':{'uniqueid':_0x6bc927[_0xd93b('0x45')]['id']}})[_0xd93b('0x23')](handleEntityNotFound(_0x57d47a,null))[_0xd93b('0x23')](saveUpdates(_0x6bc927['body'],null))[_0xd93b('0x23')](respondWithResult(_0x57d47a,null))[_0xd93b('0x43')](handleError(_0x57d47a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index eb965e8..3bb78c2 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 _0x2ace=['CmHopperHistory','cm_hopper_history','endtime','uniqueid','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define'];(function(_0x133b0e,_0x23febb){var _0x5d3229=function(_0x53c328){while(--_0x53c328){_0x133b0e['push'](_0x133b0e['shift']());}};_0x5d3229(++_0x23febb);}(_0x2ace,0x17e));var _0xe2ac=function(_0x3ba566,_0x5e009d){_0x3ba566=_0x3ba566-0x0;var _0x480317=_0x2ace[_0x3ba566];return _0x480317;};'use strict';var _=require('lodash');var util=require(_0xe2ac('0x0'));var logger=require(_0xe2ac('0x1'))(_0xe2ac('0x2'));var moment=require('moment');var BPromise=require(_0xe2ac('0x3'));var rp=require(_0xe2ac('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe2ac('0x5'));var config=require(_0xe2ac('0x6'));var attributes=require(_0xe2ac('0x7'));module[_0xe2ac('0x8')]=function(_0x386b18,_0x46e9f3){return _0x386b18[_0xe2ac('0x9')](_0xe2ac('0xa'),attributes,{'tableName':_0xe2ac('0xb'),'paranoid':![],'indexes':[{'name':_0xe2ac('0xc'),'fields':[_0xe2ac('0xc')]},{'name':_0xe2ac('0xd'),'fields':[_0xe2ac('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb78e=['../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x82ad48,_0x2d6224){var _0x3a4643=function(_0x4b1d2b){while(--_0x4b1d2b){_0x82ad48['push'](_0x82ad48['shift']());}};_0x3a4643(++_0x2d6224);}(_0xb78e,0x1c9));var _0xeb78=function(_0x277c6b,_0x1ee9a){_0x277c6b=_0x277c6b-0x0;var _0x353f02=_0xb78e[_0x277c6b];return _0x353f02;};'use strict';var _=require(_0xeb78('0x0'));var util=require(_0xeb78('0x1'));var logger=require('../../config/logger')(_0xeb78('0x2'));var moment=require(_0xeb78('0x3'));var BPromise=require(_0xeb78('0x4'));var rp=require(_0xeb78('0x5'));var fs=require('fs');var path=require(_0xeb78('0x6'));var rimraf=require(_0xeb78('0x7'));var config=require(_0xeb78('0x8'));var attributes=require(_0xeb78('0x9'));module['exports']=function(_0x3c35e7,_0x17a736){return _0x3c35e7[_0xeb78('0xa')](_0xeb78('0xb'),attributes,{'tableName':_0xeb78('0xc'),'paranoid':![],'indexes':[{'name':_0xeb78('0xd'),'fields':[_0xeb78('0xd')]},{'name':'uniqueid','fields':[_0xeb78('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 22cfdb5..9fbc918 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 _0xfecd=['create','body','options','AvgHandleTime','CmHopperHistory','raw','where','sequelize','COUNT','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','col','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','then','info','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory'];(function(_0xfe3349,_0x5b6ec0){var _0x4471af=function(_0x21b88a){while(--_0x21b88a){_0xfe3349['push'](_0xfe3349['shift']());}};_0x4471af(++_0x5b6ec0);}(_0xfecd,0x107));var _0xdfec=function(_0x4019cd,_0x13b1cc){_0x4019cd=_0x4019cd-0x0;var _0x5b6586=_0xfecd[_0x4019cd];return _0x5b6586;};'use strict';var _=require(_0xdfec('0x0'));var util=require('util');var moment=require(_0xdfec('0x1'));var BPromise=require(_0xdfec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdfec('0x3'));var db=require(_0xdfec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdfec('0x5'))('rpc');var config=require(_0xdfec('0x6'));var jayson=require(_0xdfec('0x7'));var client=jayson[_0xdfec('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f35a8,_0x6090af,_0x40782c){return new BPromise(function(_0x81175c,_0x413c88){return client['request'](_0x2f35a8,_0x40782c)[_0xdfec('0x9')](function(_0x194755){logger[_0xdfec('0xa')]('CmHopperHistory,\x20%s,\x20%s',_0x6090af,'request\x20sent');logger[_0xdfec('0xb')](_0xdfec('0xc'),_0x6090af,'request\x20sent',JSON[_0xdfec('0xd')](_0x194755));if(_0x194755[_0xdfec('0xe')]){if(_0x194755['error'][_0xdfec('0xf')]===0x1f4){logger['error'](_0xdfec('0x10'),_0x6090af,_0x194755[_0xdfec('0xe')][_0xdfec('0x11')]);return _0x413c88(_0x194755[_0xdfec('0xe')][_0xdfec('0x11')]);}logger[_0xdfec('0xe')](_0xdfec('0x10'),_0x6090af,_0x194755[_0xdfec('0xe')]['message']);return _0x81175c(_0x194755[_0xdfec('0xe')][_0xdfec('0x11')]);}else{logger['info'](_0xdfec('0x10'),_0x6090af,'request\x20sent');_0x81175c(_0x194755[_0xdfec('0x12')][_0xdfec('0x11')]);}})[_0xdfec('0x13')](function(_0x2354ad){logger['error'](_0xdfec('0x10'),_0x6090af,_0x2354ad);_0x413c88(_0x2354ad);});});}exports[_0xdfec('0x14')]=function(_0x336abf){var _0x144890=this;return new Promise(function(_0x10c44c,_0x5deea6){return db['CmHopperHistory'][_0xdfec('0x15')](_0x336abf[_0xdfec('0x16')],{'raw':_0x336abf[_0xdfec('0x17')]?_0x336abf['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4b9614){logger[_0xdfec('0xa')](_0xdfec('0x14'),_0x336abf);logger['debug'](_0xdfec('0x14'),_0x336abf,JSON[_0xdfec('0xd')](_0x4b9614));_0x10c44c(_0x4b9614);})['catch'](function(_0x23c8fd){logger['error'](_0xdfec('0x14'),_0x23c8fd[_0xdfec('0x11')],_0x336abf);_0x5deea6(_0x144890[_0xdfec('0xe')](0x1f4,_0x23c8fd[_0xdfec('0x11')]));});});};exports[_0xdfec('0x18')]=function(_0x3e29aa){var _0x412b26=this;return new Promise(function(_0x3a0566,_0xbeb814){return db[_0xdfec('0x19')]['findAll']({'raw':_0x3e29aa[_0xdfec('0x17')]?_0x3e29aa['options'][_0xdfec('0x1a')]===undefined?!![]:![]:!![],'where':_0x3e29aa[_0xdfec('0x17')]?_0x3e29aa[_0xdfec('0x17')][_0xdfec('0x1b')]||null:null,'attributes':[[db[_0xdfec('0x1c')]['fn'](_0xdfec('0x1d'),db[_0xdfec('0x1c')]['col']('id')),_0xdfec('0x1e')],[db[_0xdfec('0x1c')]['fn']('COUNT',db[_0xdfec('0x1c')]['fn']('IF',db['sequelize']['literal'](_0xdfec('0x1f')))),_0xdfec('0x20')],[db[_0xdfec('0x1c')]['fn'](_0xdfec('0x1d'),db[_0xdfec('0x1c')]['fn']('IF',db[_0xdfec('0x1c')][_0xdfec('0x21')](_0xdfec('0x22')))),_0xdfec('0x23')],[db[_0xdfec('0x1c')]['fn'](_0xdfec('0x1d'),db[_0xdfec('0x1c')]['fn']('IF',db['sequelize'][_0xdfec('0x21')](_0xdfec('0x24')))),_0xdfec('0x25')],[db[_0xdfec('0x1c')]['fn'](_0xdfec('0x26'),db[_0xdfec('0x1c')]['fn']('IF',db[_0xdfec('0x1c')][_0xdfec('0x21')](_0xdfec('0x27')))),'predictiveIntervalAvgHoldtime'],[db['sequelize']['fn'](_0xdfec('0x26'),db[_0xdfec('0x1c')]['fn']('IF',db[_0xdfec('0x1c')][_0xdfec('0x21')](_0xdfec('0x28')))),_0xdfec('0x29')]]})['then'](function(_0x4ed5c3){logger[_0xdfec('0xa')](_0xdfec('0x18'),_0x3e29aa);logger[_0xdfec('0xb')](_0xdfec('0x18'),_0x3e29aa,JSON[_0xdfec('0xd')](_0x4ed5c3));_0x3a0566(_0x4ed5c3);})[_0xdfec('0x13')](function(_0x3a1d09){logger[_0xdfec('0xe')](_0xdfec('0x18'),_0x3a1d09[_0xdfec('0x11')],_0x3e29aa);_0xbeb814(_0x412b26[_0xdfec('0xe')](0x1f4,_0x3a1d09['message']));});});};exports[_0xdfec('0x2a')]=function(_0x30e164){var _0x261fc3=this;return new Promise(function(_0x4e4000,_0x2971a1){return db['CmHopperHistory'][_0xdfec('0x2b')]({'raw':_0x30e164[_0xdfec('0x17')]?_0x30e164['options'][_0xdfec('0x1a')]===undefined?!![]:![]:!![],'where':_0x30e164[_0xdfec('0x17')]?_0x30e164[_0xdfec('0x17')][_0xdfec('0x1b')]||null:null,'attributes':[[_0xdfec('0x2c'),_0xdfec('0x2d')],[db[_0xdfec('0x1c')]['fn'](_0xdfec('0x1d'),db[_0xdfec('0x1c')]['fn']('IF',db[_0xdfec('0x1c')][_0xdfec('0x21')](_0xdfec('0x2e')))),_0xdfec('0x2f')],[db['sequelize']['fn'](_0xdfec('0x1d'),db[_0xdfec('0x1c')]['fn']('IF',db[_0xdfec('0x1c')]['literal'](_0xdfec('0x30')))),_0xdfec('0x31')],[db[_0xdfec('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xdfec('0x1c')][_0xdfec('0x21')](_0xdfec('0x1f')))),'outboundAnswerCallsDay'],[db[_0xdfec('0x1c')]['fn']('COUNT',db[_0xdfec('0x1c')]['fn']('IF',db[_0xdfec('0x1c')]['literal'](_0xdfec('0x32')))),_0xdfec('0x33')],[db[_0xdfec('0x1c')]['fn'](_0xdfec('0x1d'),db[_0xdfec('0x1c')]['fn']('IF',db[_0xdfec('0x1c')][_0xdfec('0x21')](_0xdfec('0x34')))),_0xdfec('0x35')],[db['sequelize']['fn'](_0xdfec('0x1d'),db[_0xdfec('0x1c')]['fn']('IF',db[_0xdfec('0x1c')][_0xdfec('0x21')](_0xdfec('0x36')))),_0xdfec('0x37')],[db[_0xdfec('0x1c')]['fn'](_0xdfec('0x1d'),db[_0xdfec('0x1c')]['fn']('IF',db[_0xdfec('0x1c')][_0xdfec('0x21')](_0xdfec('0x38')))),_0xdfec('0x39')],[db[_0xdfec('0x1c')]['fn']('COUNT',db[_0xdfec('0x1c')]['fn']('IF',db[_0xdfec('0x1c')]['literal'](_0xdfec('0x3a')))),_0xdfec('0x3b')],[db[_0xdfec('0x1c')]['fn'](_0xdfec('0x1d'),db[_0xdfec('0x1c')]['fn']('IF',db['sequelize'][_0xdfec('0x21')]('`state`\x20=\x2013,\x201,\x20null'))),_0xdfec('0x3c')],[db['sequelize']['fn'](_0xdfec('0x1d'),db[_0xdfec('0x1c')]['fn']('IF',db[_0xdfec('0x1c')][_0xdfec('0x21')]('`state`\x20=\x2014,\x201,\x20null'))),_0xdfec('0x3d')],[db[_0xdfec('0x1c')]['fn'](_0xdfec('0x1d'),db[_0xdfec('0x1c')]['fn']('IF',db[_0xdfec('0x1c')][_0xdfec('0x21')](_0xdfec('0x3e')))),_0xdfec('0x3f')],[db[_0xdfec('0x1c')]['fn'](_0xdfec('0x1d'),db[_0xdfec('0x1c')]['fn']('IF',db[_0xdfec('0x1c')][_0xdfec('0x21')](_0xdfec('0x40')))),_0xdfec('0x41')],[db['sequelize']['fn'](_0xdfec('0x1d'),db[_0xdfec('0x1c')]['fn']('IF',db[_0xdfec('0x1c')][_0xdfec('0x21')]('`state`\x20=\x2020,\x201,\x20null'))),_0xdfec('0x3f')],[db[_0xdfec('0x1c')]['fn'](_0xdfec('0x1d'),db['sequelize']['fn']('IF',db[_0xdfec('0x1c')][_0xdfec('0x21')](_0xdfec('0x42')))),_0xdfec('0x43')]],'group':[_0xdfec('0x2c')]})[_0xdfec('0x9')](function(_0x4ff22e){logger['info'](_0xdfec('0x2a'),_0x30e164);logger[_0xdfec('0xb')](_0xdfec('0x2a'),_0x30e164,JSON['stringify'](_0x4ff22e));_0x4e4000(_0x4ff22e);})[_0xdfec('0x13')](function(_0x2b15e6){logger[_0xdfec('0xe')](_0xdfec('0x2a'),_0x2b15e6[_0xdfec('0x11')],_0x30e164);_0x2971a1(_0x261fc3[_0xdfec('0xe')](0x1f4,_0x2b15e6['message']));});});};exports['GetCampaignHopperHistory']=function(_0x45ca2b){var _0x905ff7=this;return new Promise(function(_0x496213,_0x7df95a){return db[_0xdfec('0x19')][_0xdfec('0x2b')]({'raw':_0x45ca2b[_0xdfec('0x17')]?_0x45ca2b[_0xdfec('0x17')][_0xdfec('0x1a')]===undefined?!![]:![]:!![],'where':_0x45ca2b[_0xdfec('0x17')]?_0x45ca2b['options'][_0xdfec('0x1b')]||null:null,'attributes':[[_0xdfec('0x2c'),_0xdfec('0x2d')],[db['sequelize']['fn']('COUNT',db[_0xdfec('0x1c')][_0xdfec('0x44')]('id')),_0xdfec('0x45')],[db[_0xdfec('0x1c')]['fn']('COUNT',db[_0xdfec('0x1c')]['fn']('IF',db[_0xdfec('0x1c')]['literal'](_0xdfec('0x1f')))),_0xdfec('0x46')]],'group':[_0xdfec('0x2c')]})['then'](function(_0xfc932e){logger[_0xdfec('0xa')]('GetCampaignHopperHistory',_0x45ca2b);logger[_0xdfec('0xb')]('GetCampaignHopperHistory',_0x45ca2b,JSON[_0xdfec('0xd')](_0xfc932e));_0x496213(_0xfc932e);})[_0xdfec('0x13')](function(_0x9b35da){logger[_0xdfec('0xe')]('GetCampaignHopperHistory',_0x9b35da[_0xdfec('0x11')],_0x45ca2b);_0x7df95a(_0x905ff7[_0xdfec('0xe')](0x1f4,_0x9b35da[_0xdfec('0x11')]));});});}; \ No newline at end of file +var _0xbbc6=['`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','name','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','CmHopperHistory,\x20%s,\x20%s','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','stringify','AvgHandleTime','findAll','where','sequelize','COUNT','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','raw','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay'];(function(_0x4c887e,_0x422965){var _0x135a75=function(_0x42d528){while(--_0x42d528){_0x4c887e['push'](_0x4c887e['shift']());}};_0x135a75(++_0x422965);}(_0xbbc6,0xa6));var _0x6bbc=function(_0x23adbf,_0xba5878){_0x23adbf=_0x23adbf-0x0;var _0x38bfad=_0xbbc6[_0x23adbf];return _0x38bfad;};'use strict';var _=require(_0x6bbc('0x0'));var util=require(_0x6bbc('0x1'));var moment=require(_0x6bbc('0x2'));var BPromise=require(_0x6bbc('0x3'));var rs=require(_0x6bbc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6bbc('0x5'));var logger=require(_0x6bbc('0x6'))('rpc');var config=require(_0x6bbc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6bbc('0x8')][_0x6bbc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d63ac,_0x447ef2,_0x38b3f4){return new BPromise(function(_0x560278,_0x1ed07f){return client[_0x6bbc('0xa')](_0x2d63ac,_0x38b3f4)[_0x6bbc('0xb')](function(_0x5aab77){logger[_0x6bbc('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x447ef2,_0x6bbc('0xd'));logger[_0x6bbc('0xe')](_0x6bbc('0xf'),_0x447ef2,'request\x20sent',JSON['stringify'](_0x5aab77));if(_0x5aab77[_0x6bbc('0x10')]){if(_0x5aab77['error'][_0x6bbc('0x11')]===0x1f4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x447ef2,_0x5aab77[_0x6bbc('0x10')][_0x6bbc('0x12')]);return _0x1ed07f(_0x5aab77['error'][_0x6bbc('0x12')]);}logger[_0x6bbc('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x447ef2,_0x5aab77['error'][_0x6bbc('0x12')]);return _0x560278(_0x5aab77[_0x6bbc('0x10')][_0x6bbc('0x12')]);}else{logger['info'](_0x6bbc('0x13'),_0x447ef2,_0x6bbc('0xd'));_0x560278(_0x5aab77[_0x6bbc('0x14')][_0x6bbc('0x12')]);}})[_0x6bbc('0x15')](function(_0x2d8f2c){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x447ef2,_0x2d8f2c);_0x1ed07f(_0x2d8f2c);});});}exports[_0x6bbc('0x16')]=function(_0x51a5fe){var _0x3af05e=this;return new Promise(function(_0x5aa926,_0x2d39af){return db[_0x6bbc('0x17')][_0x6bbc('0x18')](_0x51a5fe[_0x6bbc('0x19')],{'raw':_0x51a5fe[_0x6bbc('0x1a')]?_0x51a5fe['options']['raw']===undefined?!![]:![]:!![]})[_0x6bbc('0xb')](function(_0x4d7620){logger['info'](_0x6bbc('0x16'),_0x51a5fe);logger[_0x6bbc('0xe')](_0x6bbc('0x16'),_0x51a5fe,JSON[_0x6bbc('0x1b')](_0x4d7620));_0x5aa926(_0x4d7620);})[_0x6bbc('0x15')](function(_0x86526){logger[_0x6bbc('0x10')](_0x6bbc('0x16'),_0x86526['message'],_0x51a5fe);_0x2d39af(_0x3af05e[_0x6bbc('0x10')](0x1f4,_0x86526['message']));});});};exports[_0x6bbc('0x1c')]=function(_0x51854d){var _0x49f8e8=this;return new Promise(function(_0x4b1fb3,_0x49e556){return db[_0x6bbc('0x17')][_0x6bbc('0x1d')]({'raw':_0x51854d[_0x6bbc('0x1a')]?_0x51854d[_0x6bbc('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x51854d[_0x6bbc('0x1a')]?_0x51854d[_0x6bbc('0x1a')][_0x6bbc('0x1e')]||null:null,'attributes':[[db[_0x6bbc('0x1f')]['fn'](_0x6bbc('0x20'),db[_0x6bbc('0x1f')]['col']('id')),_0x6bbc('0x21')],[db[_0x6bbc('0x1f')]['fn'](_0x6bbc('0x20'),db[_0x6bbc('0x1f')]['fn']('IF',db[_0x6bbc('0x1f')][_0x6bbc('0x22')](_0x6bbc('0x23')))),_0x6bbc('0x24')],[db[_0x6bbc('0x1f')]['fn'](_0x6bbc('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x6bbc('0x22')](_0x6bbc('0x25')))),_0x6bbc('0x26')],[db[_0x6bbc('0x1f')]['fn']('COUNT',db[_0x6bbc('0x1f')]['fn']('IF',db[_0x6bbc('0x1f')][_0x6bbc('0x22')](_0x6bbc('0x27')))),_0x6bbc('0x28')],[db[_0x6bbc('0x1f')]['fn'](_0x6bbc('0x29'),db[_0x6bbc('0x1f')]['fn']('IF',db['sequelize'][_0x6bbc('0x22')](_0x6bbc('0x2a')))),_0x6bbc('0x2b')],[db[_0x6bbc('0x1f')]['fn'](_0x6bbc('0x29'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x6bbc('0x2c')))),'predictiveIntervalAvgTalktime']]})[_0x6bbc('0xb')](function(_0x641381){logger[_0x6bbc('0xc')](_0x6bbc('0x1c'),_0x51854d);logger['debug']('AvgHandleTime',_0x51854d,JSON[_0x6bbc('0x1b')](_0x641381));_0x4b1fb3(_0x641381);})['catch'](function(_0x2ec4b2){logger['error'](_0x6bbc('0x1c'),_0x2ec4b2[_0x6bbc('0x12')],_0x51854d);_0x49e556(_0x49f8e8[_0x6bbc('0x10')](0x1f4,_0x2ec4b2[_0x6bbc('0x12')]));});});};exports[_0x6bbc('0x2d')]=function(_0x36bf64){var _0x471a62=this;return new Promise(function(_0x4e67d7,_0x41c821){return db[_0x6bbc('0x17')][_0x6bbc('0x1d')]({'raw':_0x36bf64[_0x6bbc('0x1a')]?_0x36bf64[_0x6bbc('0x1a')][_0x6bbc('0x2e')]===undefined?!![]:![]:!![],'where':_0x36bf64['options']?_0x36bf64['options'][_0x6bbc('0x1e')]||null:null,'attributes':[[_0x6bbc('0x2f'),'name'],[db[_0x6bbc('0x1f')]['fn']('COUNT',db[_0x6bbc('0x1f')]['fn']('IF',db[_0x6bbc('0x1f')][_0x6bbc('0x22')](_0x6bbc('0x30')))),_0x6bbc('0x31')],[db[_0x6bbc('0x1f')]['fn'](_0x6bbc('0x20'),db[_0x6bbc('0x1f')]['fn']('IF',db[_0x6bbc('0x1f')][_0x6bbc('0x22')](_0x6bbc('0x32')))),_0x6bbc('0x33')],[db[_0x6bbc('0x1f')]['fn'](_0x6bbc('0x20'),db['sequelize']['fn']('IF',db[_0x6bbc('0x1f')][_0x6bbc('0x22')](_0x6bbc('0x23')))),_0x6bbc('0x34')],[db[_0x6bbc('0x1f')]['fn'](_0x6bbc('0x20'),db['sequelize']['fn']('IF',db[_0x6bbc('0x1f')][_0x6bbc('0x22')](_0x6bbc('0x35')))),_0x6bbc('0x36')],[db[_0x6bbc('0x1f')]['fn'](_0x6bbc('0x20'),db[_0x6bbc('0x1f')]['fn']('IF',db[_0x6bbc('0x1f')][_0x6bbc('0x22')](_0x6bbc('0x37')))),_0x6bbc('0x38')],[db[_0x6bbc('0x1f')]['fn']('COUNT',db[_0x6bbc('0x1f')]['fn']('IF',db[_0x6bbc('0x1f')][_0x6bbc('0x22')](_0x6bbc('0x39')))),_0x6bbc('0x3a')],[db[_0x6bbc('0x1f')]['fn'](_0x6bbc('0x20'),db[_0x6bbc('0x1f')]['fn']('IF',db[_0x6bbc('0x1f')][_0x6bbc('0x22')](_0x6bbc('0x3b')))),_0x6bbc('0x3c')],[db[_0x6bbc('0x1f')]['fn']('COUNT',db[_0x6bbc('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x6bbc('0x3d')))),_0x6bbc('0x3e')],[db['sequelize']['fn']('COUNT',db[_0x6bbc('0x1f')]['fn']('IF',db[_0x6bbc('0x1f')][_0x6bbc('0x22')](_0x6bbc('0x3f')))),_0x6bbc('0x40')],[db[_0x6bbc('0x1f')]['fn'](_0x6bbc('0x20'),db[_0x6bbc('0x1f')]['fn']('IF',db[_0x6bbc('0x1f')][_0x6bbc('0x22')](_0x6bbc('0x41')))),_0x6bbc('0x42')],[db[_0x6bbc('0x1f')]['fn'](_0x6bbc('0x20'),db[_0x6bbc('0x1f')]['fn']('IF',db[_0x6bbc('0x1f')][_0x6bbc('0x22')](_0x6bbc('0x43')))),_0x6bbc('0x44')],[db['sequelize']['fn'](_0x6bbc('0x20'),db[_0x6bbc('0x1f')]['fn']('IF',db[_0x6bbc('0x1f')][_0x6bbc('0x22')](_0x6bbc('0x45')))),'outboundAnswerAgiCallsDay'],[db[_0x6bbc('0x1f')]['fn'](_0x6bbc('0x20'),db[_0x6bbc('0x1f')]['fn']('IF',db[_0x6bbc('0x1f')]['literal'](_0x6bbc('0x46')))),_0x6bbc('0x44')],[db[_0x6bbc('0x1f')]['fn'](_0x6bbc('0x20'),db[_0x6bbc('0x1f')]['fn']('IF',db[_0x6bbc('0x1f')]['literal'](_0x6bbc('0x47')))),_0x6bbc('0x48')]],'group':[_0x6bbc('0x2f')]})[_0x6bbc('0xb')](function(_0x8960dd){logger[_0x6bbc('0xc')]('GetVoiceQueueHopperHistory',_0x36bf64);logger[_0x6bbc('0xe')](_0x6bbc('0x2d'),_0x36bf64,JSON['stringify'](_0x8960dd));_0x4e67d7(_0x8960dd);})['catch'](function(_0x4677d0){logger['error'](_0x6bbc('0x2d'),_0x4677d0[_0x6bbc('0x12')],_0x36bf64);_0x41c821(_0x471a62['error'](0x1f4,_0x4677d0[_0x6bbc('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x1f4e0a){var _0x4a6dd5=this;return new Promise(function(_0x3c136c,_0x2502ac){return db[_0x6bbc('0x17')][_0x6bbc('0x1d')]({'raw':_0x1f4e0a['options']?_0x1f4e0a[_0x6bbc('0x1a')][_0x6bbc('0x2e')]===undefined?!![]:![]:!![],'where':_0x1f4e0a[_0x6bbc('0x1a')]?_0x1f4e0a['options']['where']||null:null,'attributes':[[_0x6bbc('0x2f'),_0x6bbc('0x49')],[db[_0x6bbc('0x1f')]['fn'](_0x6bbc('0x20'),db['sequelize']['col']('id')),_0x6bbc('0x4a')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x6bbc('0x23')))),_0x6bbc('0x4b')]],'group':[_0x6bbc('0x2f')]})[_0x6bbc('0xb')](function(_0x3f4da0){logger[_0x6bbc('0xc')]('GetCampaignHopperHistory',_0x1f4e0a);logger[_0x6bbc('0xe')](_0x6bbc('0x4c'),_0x1f4e0a,JSON[_0x6bbc('0x1b')](_0x3f4da0));_0x3c136c(_0x3f4da0);})[_0x6bbc('0x15')](function(_0x55baaa){logger['error'](_0x6bbc('0x4c'),_0x55baaa[_0x6bbc('0x12')],_0x1f4e0a);_0x2502ac(_0x4a6dd5[_0x6bbc('0x10')](0x1f4,_0x55baaa['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index ea38dd4..af8829d 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 _0x6b08=['get','index','/describe','isAuthenticated','describe','/:id','show','create','put','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller'];(function(_0x3d2763,_0x2ec071){var _0x40ad02=function(_0x7a03e5){while(--_0x7a03e5){_0x3d2763['push'](_0x3d2763['shift']());}};_0x40ad02(++_0x2ec071);}(_0x6b08,0x12b));var _0x86b0=function(_0x176cf0,_0x5f39c5){_0x176cf0=_0x176cf0-0x0;var _0x5e052d=_0x6b08[_0x176cf0];return _0x5e052d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x86b0('0x0'));var express=require(_0x86b0('0x1'));var router=express[_0x86b0('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x86b0('0x3'));var interaction=require(_0x86b0('0x4'));var config=require(_0x86b0('0x5'));var controller=require(_0x86b0('0x6'));router[_0x86b0('0x7')]('/',auth['isAuthenticated'](),controller[_0x86b0('0x8')]);router[_0x86b0('0x7')](_0x86b0('0x9'),auth[_0x86b0('0xa')](),controller[_0x86b0('0xb')]);router[_0x86b0('0x7')](_0x86b0('0xc'),auth[_0x86b0('0xa')](),controller[_0x86b0('0xd')]);router['post']('/',auth[_0x86b0('0xa')](),controller[_0x86b0('0xe')]);router[_0x86b0('0xf')](_0x86b0('0xc'),auth['isAuthenticated'](),controller['update']);module[_0x86b0('0x10')]=router; \ No newline at end of file +var _0x0322=['index','/describe','describe','show','post','create','put','/:id','update','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated'];(function(_0x19655c,_0x35229b){var _0x10b430=function(_0x4b1597){while(--_0x4b1597){_0x19655c['push'](_0x19655c['shift']());}};_0x10b430(++_0x35229b);}(_0x0322,0x14a));var _0x2032=function(_0x584513,_0x37c6c9){_0x584513=_0x584513-0x0;var _0xe4a14e=_0x0322[_0x584513];return _0xe4a14e;};'use strict';var multer=require(_0x2032('0x0'));var util=require(_0x2032('0x1'));var path=require(_0x2032('0x2'));var timeout=require(_0x2032('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2032('0x4'));var auth=require(_0x2032('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2032('0x6'));var controller=require(_0x2032('0x7'));router[_0x2032('0x8')]('/',auth[_0x2032('0x9')](),controller[_0x2032('0xa')]);router[_0x2032('0x8')](_0x2032('0xb'),auth[_0x2032('0x9')](),controller[_0x2032('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x2032('0xd')]);router[_0x2032('0xe')]('/',auth[_0x2032('0x9')](),controller[_0x2032('0xf')]);router[_0x2032('0x10')](_0x2032('0x11'),auth[_0x2032('0x9')](),controller[_0x2032('0x12')]);module[_0x2032('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 14256bf..79f4aa5 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 _0xc01b=['sequelize','exports','STRING','name'];(function(_0x14e78b,_0x134776){var _0x53006f=function(_0x23cf65){while(--_0x23cf65){_0x14e78b['push'](_0x14e78b['shift']());}};_0x53006f(++_0x134776);}(_0xc01b,0x74));var _0xbc01=function(_0x2b5901,_0xe161c8){_0x2b5901=_0x2b5901-0x0;var _0x44e1e0=_0xc01b[_0x2b5901];return _0x44e1e0;};'use strict';var Sequelize=require(_0xbc01('0x0'));module[_0xbc01('0x1')]={'name':{'type':Sequelize[_0xbc01('0x2')],'unique':_0xbc01('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbc01('0x2')]},'dialPrefix':{'type':Sequelize[_0xbc01('0x2')]}}; \ No newline at end of file +var _0x4b1f=['STRING','sequelize','exports','name'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4b1f,0x195));var _0xf4b1=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x4b1f[_0x5a776b];return _0xbbef59;};'use strict';var Sequelize=require(_0xf4b1('0x0'));module[_0xf4b1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xf4b1('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf4b1('0x3')]},'dialPrefix':{'type':Sequelize[_0xf4b1('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 8c2a4d3..aacfc11 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 _0xafcf=['autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ListId','Disposition','hasOwnProperty','findAll','removeDispositions','ids','tags','join','push','CmContact','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','raw','getContactsCsv','ContactItemType','alias','select','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','cm_contact_has_items','CmContactId\x20=\x20c.id','additionalPhone_','description','from','ItemTypeId\x20=\x20?','toString','each','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','sendStatus','addCustomField','findOne','addCustomFields','TEXT','text','Sequelize','number','switch','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','emit','userCmList:save','removeAgents','isArray','userCmList:remove','User','getAgents','info','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','then','destroy','get','Lists','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','CmList','includeAll','include','rows','catch','params','keys','find','create','body','user','role'];(function(_0x527e60,_0x244fb4){var _0x23db33=function(_0x20de14){while(--_0x20de14){_0x527e60['push'](_0x527e60['shift']());}};_0x23db33(++_0x244fb4);}(_0xafcf,0xf2));var _0xfafc=function(_0x55527b,_0x293c9a){_0x55527b=_0x55527b-0x0;var _0xd2577b=_0xafcf[_0x55527b];return _0xd2577b;};'use strict';var emlformat=require(_0xfafc('0x0'));var rimraf=require(_0xfafc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfafc('0x2'));var rp=require(_0xfafc('0x3'));var moment=require(_0xfafc('0x4'));var BPromise=require(_0xfafc('0x5'));var Mustache=require(_0xfafc('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xfafc('0x7'));var ejs=require(_0xfafc('0x8'));var fs=require('fs');var fs_extra=require(_0xfafc('0x9'));var _=require(_0xfafc('0xa'));var squel=require('squel');var crypto=require(_0xfafc('0xb'));var jsforce=require(_0xfafc('0xc'));var deskjs=require(_0xfafc('0xd'));var toCsv=require(_0xfafc('0x7'));var querystring=require(_0xfafc('0xe'));var Papa=require(_0xfafc('0xf'));var Redis=require('ioredis');var authService=require(_0xfafc('0x10'));var qs=require(_0xfafc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfafc('0x12'))(_0xfafc('0x13'));var utils=require(_0xfafc('0x14'));var config=require(_0xfafc('0x15'));var licenseUtil=require(_0xfafc('0x16'));var db=require(_0xfafc('0x17'))['db'];var csv_results;config[_0xfafc('0x18')]=_[_0xfafc('0x19')](config['redis'],{'host':_0xfafc('0x1a'),'port':0x18eb});var socket=require(_0xfafc('0x1b'))(new Redis(config[_0xfafc('0x18')]));require('./cmList.socket')['register'](socket);function respondWithStatusCode(_0x49311f,_0x1a7c77){_0x1a7c77=_0x1a7c77||0xcc;return function(_0x157c7a){if(_0x157c7a){return _0x49311f['sendStatus'](_0x1a7c77);}return _0x49311f[_0xfafc('0x1c')](_0x1a7c77)[_0xfafc('0x1d')]();};}function respondWithResult(_0x359e96,_0x1358b0){_0x1358b0=_0x1358b0||0xc8;return function(_0x4a6f85){if(_0x4a6f85){return _0x359e96[_0xfafc('0x1c')](_0x1358b0)[_0xfafc('0x1e')](_0x4a6f85);}};}function respondWithFilteredResult(_0x506204,_0x42697e){return function(_0x3672dd){if(_0x3672dd){var _0x2dc4fe=typeof _0x42697e[_0xfafc('0x1f')]==='undefined'&&typeof _0x42697e[_0xfafc('0x20')]===_0xfafc('0x21');var _0x50d161=_0x3672dd[_0xfafc('0x22')];var _0x506593=_0x2dc4fe?0x0:_0x42697e[_0xfafc('0x1f')];var _0x5b685f=_0x2dc4fe?_0x3672dd[_0xfafc('0x22')]:_0x42697e[_0xfafc('0x1f')]+_0x42697e[_0xfafc('0x20')];var _0x2eddb9;if(_0x5b685f>=_0x50d161){_0x5b685f=_0x50d161;_0x2eddb9=0xc8;}else{_0x2eddb9=0xce;}_0x506204[_0xfafc('0x1c')](_0x2eddb9);return _0x506204[_0xfafc('0x23')](_0xfafc('0x24'),_0x506593+'-'+_0x5b685f+'/'+_0x50d161)[_0xfafc('0x1e')](_0x3672dd);}return null;};}function patchUpdates(_0x6a6588){return function(_0x219e85){try{jsonpatch[_0xfafc('0x25')](_0x219e85,_0x6a6588,!![]);}catch(_0x44c9ec){return BPromise['reject'](_0x44c9ec);}return _0x219e85['save']();};}function saveUpdates(_0x484271,_0x11f202){return function(_0x785380){if(_0x785380){return _0x785380['update'](_0x484271)[_0xfafc('0x26')](function(_0x4366a0){return _0x4366a0;});}return null;};}function removeEntity(_0x56aa13,_0x59e467){return function(_0x5dbb5b){if(_0x5dbb5b){return _0x5dbb5b[_0xfafc('0x27')]()[_0xfafc('0x26')](function(){var _0x508da6=_0x5dbb5b[_0xfafc('0x28')]({'plain':!![]});var _0x2aff29=_0xfafc('0x29');return db[_0xfafc('0x2a')]['destroy']({'where':{'type':_0x2aff29,'resourceId':_0x508da6['id']}})[_0xfafc('0x26')](function(){return _0x5dbb5b;});})[_0xfafc('0x26')](function(){_0x56aa13[_0xfafc('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x488a5e,_0x4fe593){return function(_0xd186d2){if(!_0xd186d2){_0x488a5e['sendStatus'](0x194);}return _0xd186d2;};}function handleError(_0x4f1f97,_0x1f46c2){_0x1f46c2=_0x1f46c2||0x1f4;return function(_0x10951d){logger['error'](_0x10951d[_0xfafc('0x2b')]);if(_0x10951d[_0xfafc('0x2c')]){delete _0x10951d[_0xfafc('0x2c')];}_0x4f1f97[_0xfafc('0x1c')](_0x1f46c2)[_0xfafc('0x2d')](_0x10951d);};}exports[_0xfafc('0x2e')]=function(_0x2f94bc,_0x1b246c){var _0xb5c9b6={},_0x4e0be5={},_0xecb732={'count':0x0,'rows':[]};var _0x376c93=_[_0xfafc('0x2f')](db['CmList'][_0xfafc('0x30')],function(_0x452a5f){return{'name':_0x452a5f[_0xfafc('0x31')],'type':_0x452a5f[_0xfafc('0x32')][_0xfafc('0x33')]};});_0x4e0be5['model']=_[_0xfafc('0x2f')](_0x376c93,_0xfafc('0x2c'));_0x4e0be5['query']=_['keys'](_0x2f94bc[_0xfafc('0x34')]);_0x4e0be5['filters']=_[_0xfafc('0x35')](_0x4e0be5['model'],_0x4e0be5['query']);_0xb5c9b6[_0xfafc('0x36')]=_['intersection'](_0x4e0be5[_0xfafc('0x37')],qs[_0xfafc('0x38')](_0x2f94bc[_0xfafc('0x34')][_0xfafc('0x38')]));_0xb5c9b6[_0xfafc('0x36')]=_0xb5c9b6[_0xfafc('0x36')][_0xfafc('0x39')]?_0xb5c9b6[_0xfafc('0x36')]:_0x4e0be5[_0xfafc('0x37')];if(!_0x2f94bc['query']['hasOwnProperty'](_0xfafc('0x3a'))){_0xb5c9b6[_0xfafc('0x20')]=qs['limit'](_0x2f94bc[_0xfafc('0x34')][_0xfafc('0x20')]);_0xb5c9b6[_0xfafc('0x1f')]=qs[_0xfafc('0x1f')](_0x2f94bc[_0xfafc('0x34')][_0xfafc('0x1f')]);}_0xb5c9b6[_0xfafc('0x3b')]=qs['sort'](_0x2f94bc[_0xfafc('0x34')][_0xfafc('0x3c')]);_0xb5c9b6[_0xfafc('0x3d')]=qs['filters'](_[_0xfafc('0x3e')](_0x2f94bc[_0xfafc('0x34')],_0x4e0be5[_0xfafc('0x3f')]),_0x376c93);if(_0x2f94bc[_0xfafc('0x34')][_0xfafc('0x40')]){_0xb5c9b6[_0xfafc('0x3d')]=_[_0xfafc('0x41')](_0xb5c9b6['where'],{'$or':_[_0xfafc('0x2f')](_0x376c93,function(_0x2ec943){if(_0x2ec943[_0xfafc('0x32')]!==_0xfafc('0x42')){var _0x17f5f3={};_0x17f5f3[_0x2ec943['name']]={'$like':'%'+_0x2f94bc[_0xfafc('0x34')]['filter']+'%'};return _0x17f5f3;}})});}_0xb5c9b6=_['merge']({},_0xb5c9b6,_0x2f94bc[_0xfafc('0x43')]);var _0x30f2c3={'where':_0xb5c9b6['where']};return db[_0xfafc('0x44')]['count'](_0x30f2c3)['then'](function(_0x5214e1){_0xecb732[_0xfafc('0x22')]=_0x5214e1;if(_0x2f94bc[_0xfafc('0x34')][_0xfafc('0x45')]){_0xb5c9b6[_0xfafc('0x46')]=[{'all':!![]}];}return db[_0xfafc('0x44')]['findAll'](_0xb5c9b6);})['then'](function(_0x4bc0bb){_0xecb732[_0xfafc('0x47')]=_0x4bc0bb;return _0xecb732;})[_0xfafc('0x26')](respondWithFilteredResult(_0x1b246c,_0xb5c9b6))[_0xfafc('0x48')](handleError(_0x1b246c,null));};exports['show']=function(_0x39d0e0,_0x2ab547){var _0x2329e5={'raw':![],'where':{'id':_0x39d0e0[_0xfafc('0x49')]['id']}},_0x2598ba={};_0x2598ba[_0xfafc('0x37')]=_[_0xfafc('0x4a')](db[_0xfafc('0x44')][_0xfafc('0x30')]);_0x2598ba[_0xfafc('0x34')]=_['keys'](_0x39d0e0['query']);_0x2598ba['filters']=_['intersection'](_0x2598ba[_0xfafc('0x37')],_0x2598ba[_0xfafc('0x34')]);_0x2329e5[_0xfafc('0x36')]=_[_0xfafc('0x35')](_0x2598ba[_0xfafc('0x37')],qs['fields'](_0x39d0e0[_0xfafc('0x34')]['fields']));_0x2329e5['attributes']=_0x2329e5['attributes']['length']?_0x2329e5[_0xfafc('0x36')]:_0x2598ba[_0xfafc('0x37')];if(_0x39d0e0['query'][_0xfafc('0x45')]){_0x2329e5[_0xfafc('0x46')]=[{'all':!![]}];}_0x2329e5=_[_0xfafc('0x41')]({},_0x2329e5,_0x39d0e0['options']);return db[_0xfafc('0x44')][_0xfafc('0x4b')](_0x2329e5)[_0xfafc('0x26')](handleEntityNotFound(_0x2ab547,null))[_0xfafc('0x26')](respondWithResult(_0x2ab547,null))[_0xfafc('0x48')](handleError(_0x2ab547,null));};exports['create']=function(_0x402b41,_0x196c29){return db['CmList'][_0xfafc('0x4c')](_0x402b41[_0xfafc('0x4d')],{})['then'](function(_0x13762c){var _0x3ba37d=_0x402b41[_0xfafc('0x4e')]['get']({'plain':!![]});if(!_0x3ba37d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ba37d[_0xfafc('0x4f')]==='user'){var _0x1dadec=_0x13762c[_0xfafc('0x28')]({'plain':!![]});var _0x119907=_0xfafc('0x29');return db['UserProfileSection'][_0xfafc('0x4b')]({'where':{'name':_0x119907,'userProfileId':_0x3ba37d['userProfileId']},'raw':!![]})[_0xfafc('0x26')](function(_0x2c8862){if(_0x2c8862&&_0x2c8862[_0xfafc('0x50')]===0x0){return db[_0xfafc('0x2a')][_0xfafc('0x4c')]({'name':_0x1dadec[_0xfafc('0x2c')],'resourceId':_0x1dadec['id'],'type':_0x2c8862['name'],'sectionId':_0x2c8862['id']},{})['then'](function(){return _0x13762c;});}else{return _0x13762c;}})[_0xfafc('0x48')](function(_0x8e9073){logger[_0xfafc('0x51')](_0xfafc('0x52'),_0x8e9073);throw _0x8e9073;});}return _0x13762c;})[_0xfafc('0x26')](respondWithResult(_0x196c29,0xc9))['catch'](handleError(_0x196c29,null));};exports[_0xfafc('0x53')]=function(_0x5f2dc1,_0x52bb55){if(_0x5f2dc1[_0xfafc('0x4d')]['id']){delete _0x5f2dc1[_0xfafc('0x4d')]['id'];}return db['CmList']['find']({'where':{'id':_0x5f2dc1['params']['id']}})[_0xfafc('0x26')](handleEntityNotFound(_0x52bb55,null))[_0xfafc('0x26')](saveUpdates(_0x5f2dc1[_0xfafc('0x4d')],null))[_0xfafc('0x26')](respondWithResult(_0x52bb55,null))[_0xfafc('0x48')](handleError(_0x52bb55,null));};exports[_0xfafc('0x27')]=function(_0x1f0488,_0xcc464c){return db[_0xfafc('0x44')][_0xfafc('0x4b')]({'where':{'id':_0x1f0488[_0xfafc('0x49')]['id']}})['then'](handleEntityNotFound(_0xcc464c,null))[_0xfafc('0x26')](removeEntity(_0xcc464c,null))[_0xfafc('0x48')](handleError(_0xcc464c,null));};exports[_0xfafc('0x54')]=function(_0x237597,_0x583039){return db[_0xfafc('0x44')][_0xfafc('0x54')]()[_0xfafc('0x26')](respondWithResult(_0x583039,null))['catch'](handleError(_0x583039,null));};exports[_0xfafc('0x55')]=function(_0xf703f8,_0x2720d6,_0x3af23e){if(_0xf703f8[_0xfafc('0x4d')]['id']){delete _0xf703f8[_0xfafc('0x4d')]['id'];}return db[_0xfafc('0x44')][_0xfafc('0x4b')]({'where':{'id':_0xf703f8[_0xfafc('0x49')]['id']}})['then'](handleEntityNotFound(_0x2720d6,null))[_0xfafc('0x26')](function(_0x3b4c54){if(_0x3b4c54){_0xf703f8[_0xfafc('0x4d')][_0xfafc('0x56')]=_0x3b4c54['id'];return db[_0xfafc('0x57')][_0xfafc('0x4c')](_0xf703f8['body']);}})['then'](respondWithResult(_0x2720d6,null))['catch'](handleError(_0x2720d6,null));};exports['getDispositions']=function(_0x559bf6,_0x5f224a,_0x12e71a){var _0x39c6b7={'raw':![],'where':{}};var _0x64b34d={};var _0x2c49ca={'count':0x0,'rows':[]};return db[_0xfafc('0x44')]['findOne']({'where':{'id':_0x559bf6[_0xfafc('0x49')]['id']}})[_0xfafc('0x26')](handleEntityNotFound(_0x5f224a,null))[_0xfafc('0x26')](function(_0x12331e){if(_0x12331e){_0x64b34d[_0xfafc('0x37')]=_[_0xfafc('0x4a')](db[_0xfafc('0x57')][_0xfafc('0x30')]);_0x64b34d[_0xfafc('0x34')]=_[_0xfafc('0x4a')](_0x559bf6[_0xfafc('0x34')]);_0x64b34d[_0xfafc('0x3f')]=_['intersection'](_0x64b34d[_0xfafc('0x37')],_0x64b34d[_0xfafc('0x34')]);_0x39c6b7[_0xfafc('0x36')]=_[_0xfafc('0x35')](_0x64b34d[_0xfafc('0x37')],qs[_0xfafc('0x38')](_0x559bf6['query']['fields']));_0x39c6b7[_0xfafc('0x36')]=_0x39c6b7[_0xfafc('0x36')][_0xfafc('0x39')]?_0x39c6b7[_0xfafc('0x36')]:_0x64b34d[_0xfafc('0x37')];if(!_0x559bf6[_0xfafc('0x34')][_0xfafc('0x58')](_0xfafc('0x3a'))){_0x39c6b7[_0xfafc('0x20')]=qs[_0xfafc('0x20')](_0x559bf6['query'][_0xfafc('0x20')]);_0x39c6b7[_0xfafc('0x1f')]=qs['offset'](_0x559bf6[_0xfafc('0x34')][_0xfafc('0x1f')]);}_0x39c6b7['order']=qs[_0xfafc('0x3c')](_0x559bf6[_0xfafc('0x34')][_0xfafc('0x3c')]);_0x39c6b7[_0xfafc('0x3d')]=qs[_0xfafc('0x3f')](_['pick'](_0x559bf6[_0xfafc('0x34')],_0x64b34d['filters']));_0x39c6b7[_0xfafc('0x3d')][_0xfafc('0x56')]=_0x12331e['id'];if(_0x559bf6['query'][_0xfafc('0x40')]){_0x39c6b7[_0xfafc('0x3d')]=_[_0xfafc('0x41')](_0x39c6b7[_0xfafc('0x3d')],{'$or':_[_0xfafc('0x2f')](_0x39c6b7[_0xfafc('0x36')],function(_0x6aa768){var _0x4c9380={};_0x4c9380[_0x6aa768]={'$like':'%'+_0x559bf6[_0xfafc('0x34')][_0xfafc('0x40')]+'%'};return _0x4c9380;})});}_0x39c6b7=_[_0xfafc('0x41')]({},_0x39c6b7,_0x559bf6[_0xfafc('0x43')]);return db[_0xfafc('0x57')][_0xfafc('0x22')]({'where':_0x39c6b7[_0xfafc('0x3d')]})[_0xfafc('0x26')](function(_0x2d38af){_0x2c49ca[_0xfafc('0x22')]=_0x2d38af;if(_0x559bf6['query'][_0xfafc('0x45')]){_0x39c6b7['include']=[{'all':!![]}];}return db['Disposition'][_0xfafc('0x59')](_0x39c6b7);})['then'](function(_0x134946){_0x2c49ca['rows']=_0x134946;return _0x2c49ca;});}})[_0xfafc('0x26')](respondWithFilteredResult(_0x5f224a,_0x39c6b7))[_0xfafc('0x48')](handleError(_0x5f224a,null));};exports[_0xfafc('0x5a')]=function(_0xbec6df,_0x5780ee,_0x30c557){return db[_0xfafc('0x44')]['find']({'where':{'id':_0xbec6df[_0xfafc('0x49')]['id']}})['then'](handleEntityNotFound(_0x5780ee,null))[_0xfafc('0x26')](function(_0x242e3b){if(_0x242e3b){return _0x242e3b[_0xfafc('0x5a')](_0xbec6df[_0xfafc('0x34')][_0xfafc('0x5b')]);}})[_0xfafc('0x26')](respondWithStatusCode(_0x5780ee,null))[_0xfafc('0x48')](handleError(_0x5780ee,null));};exports['addContacts']=function(_0x21762c,_0x38a155,_0xc9006e){return db[_0xfafc('0x44')][_0xfafc('0x4b')]({'where':{'id':_0x21762c[_0xfafc('0x49')]['id']}})[_0xfafc('0x26')](handleEntityNotFound(_0x38a155,null))[_0xfafc('0x26')](function(_0x310e27){if(_0x310e27){var _0x1a6b9b=[];var _0x2bc331={'success':[],'errors':[]};return db['CmContact'][_0xfafc('0x54')]()[_0xfafc('0x26')](function(_0xa47248){if(_0x21762c['body']['tags']&&_['isArray'](_0x21762c[_0xfafc('0x4d')][_0xfafc('0x5c')])){if(_0x21762c[_0xfafc('0x4d')]['tags']['length']){_0x21762c[_0xfafc('0x4d')][_0xfafc('0x5c')]=_0x21762c[_0xfafc('0x4d')][_0xfafc('0x5c')][_0xfafc('0x5d')](';')+';';}else{_0x21762c[_0xfafc('0x4d')][_0xfafc('0x5c')]=null;}}else{_0x21762c['body'][_0xfafc('0x5c')]=null;}if(_0x21762c[_0xfafc('0x4d')]&&_['isArray'](_0x21762c[_0xfafc('0x4d')])){for(var _0x2caa35=0x0;_0x2caa35<_0x21762c[_0xfafc('0x4d')][_0xfafc('0x39')];_0x2caa35+=0x1){_0x21762c['body'][_0x2caa35]['ListId']=_0x21762c['params']['id'];_0x1a6b9b[_0xfafc('0x5e')](_0x21762c[_0xfafc('0x4d')][_0x2caa35]);}return BPromise['each'](_0x1a6b9b,function(_0x2e0747){return db[_0xfafc('0x5f')][_0xfafc('0x4c')](_[_0xfafc('0x60')](_0x2e0747,[_0xfafc('0x5b'),'id'])||{},{'fields':_[_0xfafc('0x4a')](_0xa47248),'raw':!![]})['then'](function(_0x24da6a){_0x2bc331[_0xfafc('0x61')][_0xfafc('0x5e')](_0x24da6a[_0xfafc('0x62')]);})['catch'](function(_0x2528bb){_0x2bc331[_0xfafc('0x63')][_0xfafc('0x5e')]({'data':_0x2e0747,'error':_0x2528bb[_0xfafc('0x64')]});});})[_0xfafc('0x26')](function(_0x32307c){return _0x2bc331;})['catch'](function(_0x1601cc){return _0x1601cc;});}else{_0x38a155[_0xfafc('0x1c')](0x190)[_0xfafc('0x1e')]({'message':_0xfafc('0x65')});}});}})[_0xfafc('0x26')](respondWithResult(_0x38a155,null))[_0xfafc('0x48')](handleError(_0x38a155,null));};exports['getContacts']=function(_0x5e149f,_0x21c3c3,_0x5e4dc9){var _0x4445a6;return db['CmList'][_0xfafc('0x4b')]({'where':{'id':_0x5e149f[_0xfafc('0x49')]['id']},'include':[{'model':db[_0xfafc('0x66')],'as':_0xfafc('0x67')}]})[_0xfafc('0x26')](handleEntityNotFound(_0x21c3c3,null))[_0xfafc('0x26')](function(_0x48b969){if(_0x48b969){_0x4445a6=_0x48b969;return db[_0xfafc('0x5f')][_0xfafc('0x30')];}})[_0xfafc('0x26')](function(_0x12c931){if(_0x12c931){var _0x39c0ca={};var _0x303632={};_0x303632[_0xfafc('0x37')]=_[_0xfafc('0x68')](_[_0xfafc('0x4a')](_0x12c931),_[_0xfafc('0x2f')](_0x4445a6[_0xfafc('0x67')],function(_0x7eb61b){return util[_0xfafc('0x69')]('cf_%d',_0x7eb61b['id']);}));_0x303632[_0xfafc('0x34')]=_[_0xfafc('0x4a')](_0x5e149f[_0xfafc('0x34')]);_0x303632['filters']=_[_0xfafc('0x35')](_0x303632[_0xfafc('0x37')],_0x303632[_0xfafc('0x34')]);_0x39c0ca[_0xfafc('0x36')]=_[_0xfafc('0x35')](_0x303632[_0xfafc('0x37')],qs[_0xfafc('0x38')](_0x5e149f[_0xfafc('0x34')][_0xfafc('0x38')]));_0x39c0ca[_0xfafc('0x36')]=_0x39c0ca['attributes'][_0xfafc('0x39')]?_0x39c0ca[_0xfafc('0x36')]:_0x303632[_0xfafc('0x37')];if(!_0x5e149f[_0xfafc('0x34')][_0xfafc('0x58')](_0xfafc('0x3a'))){_0x39c0ca[_0xfafc('0x20')]=qs[_0xfafc('0x20')](_0x5e149f['query'][_0xfafc('0x20')]);_0x39c0ca[_0xfafc('0x1f')]=qs[_0xfafc('0x1f')](_0x5e149f[_0xfafc('0x34')]['offset']);}_0x39c0ca['order']=qs[_0xfafc('0x3c')](_0x5e149f[_0xfafc('0x34')]['sort']);_0x39c0ca[_0xfafc('0x3d')]=qs[_0xfafc('0x3f')](_[_0xfafc('0x3e')](_0x5e149f[_0xfafc('0x34')],_0x303632['filters']));_0x39c0ca[_0xfafc('0x6a')]=!![];if(_0x5e149f[_0xfafc('0x34')][_0xfafc('0x40')]){_0x39c0ca[_0xfafc('0x3d')]=_[_0xfafc('0x41')](_0x39c0ca[_0xfafc('0x3d')],{'$or':_[_0xfafc('0x2f')](_0x39c0ca[_0xfafc('0x36')],function(_0x239e54){var _0x42b43a={};_0x42b43a[_0x239e54]={'$like':'%'+_0x5e149f[_0xfafc('0x34')][_0xfafc('0x40')]+'%'};return _0x42b43a;})});}_0x39c0ca=_[_0xfafc('0x41')]({},_0x39c0ca,_0x5e149f[_0xfafc('0x43')]);return _0x4445a6['getContacts'](_0x39c0ca);}})[_0xfafc('0x26')](respondWithResult(_0x21c3c3,null))[_0xfafc('0x48')](handleError(_0x21c3c3,null));};exports[_0xfafc('0x6b')]=function(_0x41c50d,_0x8b3f83,_0x54a893){var _0x2afdc9;var _0x100e68;var _0x329efc;var _0x2b06c2=_0x41c50d[_0xfafc('0x49')]['id'];csv_results=[];return db[_0xfafc('0x6c')][_0xfafc('0x59')]({'attributes':['id',_0xfafc('0x2c')],'raw':!![],'order':['OrderBy']})[_0xfafc('0x26')](function(_0x4e180f){_0x2afdc9=_0x4e180f;var _0x119ff6=_[_0xfafc('0x4a')](db[_0xfafc('0x5f')][_0xfafc('0x30')]);return db[_0xfafc('0x66')]['findAll']({'raw':!![],'attributes':['id',_0xfafc('0x6d')]})[_0xfafc('0x26')](function(_0x2bf870){_0x100e68=_0x2bf870;var _0x1b0090=squel[_0xfafc('0x6e')]()[_0xfafc('0x38')](_0x119ff6)['from'](_0xfafc('0x6f'),'c')[_0xfafc('0x3d')](_0xfafc('0x70'),_0x2b06c2)[_0xfafc('0x3d')](_0xfafc('0x71'))[_0xfafc('0x72')]();for(var _0x10e9a7=0x0;_0x10e9a7<_0x100e68[_0xfafc('0x39')];_0x10e9a7++){_0x1b0090[_0xfafc('0x73')](_0xfafc('0x74')+_0x100e68[_0x10e9a7]['id'],_0xfafc('0x75')+_0x100e68[_0x10e9a7][_0xfafc('0x6d')]);}for(var _0x10e9a7=0x0;_0x10e9a7<_0x2afdc9[_0xfafc('0x39')];_0x10e9a7++){_0x1b0090['field'](squel[_0xfafc('0x6e')]()['field'](_0xfafc('0x76'))['from'](_0xfafc('0x77'))[_0xfafc('0x3d')]('ItemTypeId\x20=\x20?',_0x2afdc9[_0x10e9a7]['id'])[_0xfafc('0x3d')](_0xfafc('0x78')),_0xfafc('0x79')+_0x2afdc9[_0x10e9a7][_0xfafc('0x2c')]);_0x1b0090[_0xfafc('0x73')](squel['select']()[_0xfafc('0x73')](_0xfafc('0x7a'))[_0xfafc('0x7b')](_0xfafc('0x77'))['where'](_0xfafc('0x7c'),_0x2afdc9[_0x10e9a7]['id'])[_0xfafc('0x3d')](_0xfafc('0x78')),'description_additionalPhone_'+_0x2afdc9[_0x10e9a7][_0xfafc('0x2c')]);}var _0x514063=[];_0x514063['push'](_0x1b0090[_0xfafc('0x7d')]());BPromise[_0xfafc('0x7e')](_0x514063,handleQuery)[_0xfafc('0x26')](function(_0x41a302){handleQuery(_0x1b0090[_0xfafc('0x7d')]());var _0x47e86e=csv_results[0x0];if(!_[_0xfafc('0x7f')](_0x47e86e)){var _0xcab28f=toCsv(_0x47e86e);var _0x362605=Date[_0xfafc('0x80')]();fs[_0xfafc('0x81')](util[_0xfafc('0x69')](_0xfafc('0x82'),_0x2b06c2,_0x362605),_0xcab28f);_0x8b3f83[_0xfafc('0x83')](_0xfafc('0x84'),_0xfafc('0x85')+util[_0xfafc('0x69')](_0xfafc('0x86'),_0x2b06c2,_0x362605));_0x8b3f83[_0xfafc('0x83')](_0xfafc('0x87'),'text/csv');return _0x8b3f83[_0xfafc('0x88')](util[_0xfafc('0x69')](_0xfafc('0x82'),_0x2b06c2,_0x362605));}else{return _0x8b3f83[_0xfafc('0x89')](0xcc);}});});});};exports[_0xfafc('0x8a')]=function(_0x412b04,_0x51d189,_0x2a3031){var _0x57d259;delete _0x412b04[_0xfafc('0x4d')]['id'];return db[_0xfafc('0x44')][_0xfafc('0x8b')]({'where':{'id':_0x412b04[_0xfafc('0x49')]['id']}})[_0xfafc('0x26')](handleEntityNotFound(_0x51d189,null))[_0xfafc('0x26')](function(_0x33c5dc){if(_0x33c5dc){return db['sequelize']['transaction'](function(_0x4f4a04){return db[_0xfafc('0x66')][_0xfafc('0x4c')](_0x412b04[_0xfafc('0x4d')],{'transaction':_0x4f4a04})['then'](function(_0x509746){_0x57d259=_0x509746;return _0x33c5dc[_0xfafc('0x8c')](_0x509746,{'transaction':_0x4f4a04});})[_0xfafc('0x26')](function(){var _0x47262c={'type':db['Sequelize'][_0xfafc('0x8d')],'transaction':_0x4f4a04};switch(_0x412b04['body']['type']){case _0xfafc('0x8e'):_0x47262c[_0xfafc('0x32')]=db[_0xfafc('0x8f')]['TEXT'];break;case _0xfafc('0x90'):_0x47262c[_0xfafc('0x32')]=db[_0xfafc('0x8f')]['INTEGER'];break;case _0xfafc('0x91'):_0x47262c['type']=db[_0xfafc('0x8f')]['BOOLEAN'];_0x47262c['defaultValue']=![];break;default:}return db['sequelize'][_0xfafc('0x92')][_0xfafc('0x93')](_0xfafc('0x6f'),util[_0xfafc('0x69')](_0xfafc('0x94'),_0x57d259['id']),_0x47262c);})[_0xfafc('0x26')](function(){return _0x57d259;});});}})['then'](respondWithResult(_0x51d189,null))[_0xfafc('0x48')](handleError(_0x51d189,null));};exports[_0xfafc('0x95')]=function(_0x516cf4,_0x2f7947,_0x32005e){var _0xbf8821={};var _0x2f5785={};var _0x23c6bf;var _0x244665;return db[_0xfafc('0x44')]['findOne']({'where':{'id':_0x516cf4[_0xfafc('0x49')]['id']}})[_0xfafc('0x26')](handleEntityNotFound(_0x2f7947,null))[_0xfafc('0x26')](function(_0x291cce){if(_0x291cce){_0x23c6bf=_0x291cce;_0x2f5785[_0xfafc('0x37')]=_[_0xfafc('0x4a')](db[_0xfafc('0x66')][_0xfafc('0x30')]);_0x2f5785['query']=_['keys'](_0x516cf4[_0xfafc('0x34')]);_0x2f5785[_0xfafc('0x3f')]=_[_0xfafc('0x35')](_0x2f5785['model'],_0x2f5785[_0xfafc('0x34')]);_0xbf8821[_0xfafc('0x36')]=_['intersection'](_0x2f5785[_0xfafc('0x37')],qs[_0xfafc('0x38')](_0x516cf4[_0xfafc('0x34')]['fields']));_0xbf8821[_0xfafc('0x36')]=_0xbf8821[_0xfafc('0x36')]['length']?_0xbf8821['attributes']:_0x2f5785['model'];_0xbf8821[_0xfafc('0x3b')]=qs[_0xfafc('0x3c')](_0x516cf4[_0xfafc('0x34')][_0xfafc('0x3c')]);_0xbf8821[_0xfafc('0x3d')]=qs['filters'](_[_0xfafc('0x3e')](_0x516cf4[_0xfafc('0x34')],_0x2f5785[_0xfafc('0x3f')]));_0xbf8821[_0xfafc('0x3d')]=_[_0xfafc('0x41')](_0xbf8821[_0xfafc('0x3d')],{'$or':[{'ListId':_0x291cce['id']},{'ListId':null}]});if(_0x516cf4[_0xfafc('0x34')][_0xfafc('0x40')]){_0xbf8821[_0xfafc('0x3d')]=_['merge'](_0xbf8821['where'],{'$or':_['map'](_0xbf8821['attributes'],function(_0x352be){var _0x4214aa={};_0x4214aa[_0x352be]={'$like':'%'+_0x516cf4[_0xfafc('0x34')][_0xfafc('0x40')]+'%'};return _0x4214aa;})});}_0xbf8821=_[_0xfafc('0x41')]({},_0xbf8821,_0x516cf4[_0xfafc('0x43')]);return db['CmCustomField'][_0xfafc('0x96')](_0xbf8821);}})[_0xfafc('0x26')](respondWithResult(_0x2f7947,null))[_0xfafc('0x48')](handleError(_0x2f7947,null));};exports[_0xfafc('0x97')]=function(_0x18aa6a,_0x2a4675){return db[_0xfafc('0x66')][_0xfafc('0x96')]({'where':{'ListId':null}})[_0xfafc('0x26')](handleEntityNotFound(_0x2a4675,null))[_0xfafc('0x26')](function(_0x45b999){return _0x45b999;})[_0xfafc('0x26')](respondWithResult(_0x2a4675,null))[_0xfafc('0x48')](handleError(_0x2a4675,null));};exports['addAgents']=function(_0x1015e9,_0x2500b5,_0x358be0){return db[_0xfafc('0x44')]['find']({'where':{'id':_0x1015e9[_0xfafc('0x49')]['id']}})[_0xfafc('0x26')](handleEntityNotFound(_0x2500b5,null))[_0xfafc('0x26')](function(_0x41eb20){if(_0x41eb20){return _0x41eb20[_0xfafc('0x98')](_0x1015e9[_0xfafc('0x4d')]['ids'],_[_0xfafc('0x60')](_0x1015e9[_0xfafc('0x4d')],[_0xfafc('0x5b'),'id'])||{})['spread'](function(_0x2a0064){for(var _0x3557ac=0x0;_0x3557ac<_0x1015e9[_0xfafc('0x4d')][_0xfafc('0x5b')]['length'];_0x3557ac+=0x1){socket[_0xfafc('0x99')](_0xfafc('0x9a'),{'UserId':Number(_0x1015e9[_0xfafc('0x4d')][_0xfafc('0x5b')][_0x3557ac]),'CmListId':Number(_0x1015e9['params']['id'])});}return _0x2a0064;});}})[_0xfafc('0x26')](respondWithResult(_0x2500b5,null))[_0xfafc('0x48')](handleError(_0x2500b5,null));};exports[_0xfafc('0x9b')]=function(_0x4382b2,_0x47d3b7,_0x2c66ef){return db[_0xfafc('0x44')][_0xfafc('0x4b')]({'where':{'id':_0x4382b2[_0xfafc('0x49')]['id']}})['then'](handleEntityNotFound(_0x47d3b7,null))[_0xfafc('0x26')](function(_0x1c6099){if(_0x1c6099){return _0x1c6099[_0xfafc('0x9b')](_0x4382b2['query'][_0xfafc('0x5b')])[_0xfafc('0x26')](function(){if(_[_0xfafc('0x9c')](_0x4382b2[_0xfafc('0x34')][_0xfafc('0x5b')])){for(var _0x3cc5af=0x0;_0x3cc5af<_0x4382b2[_0xfafc('0x34')][_0xfafc('0x5b')][_0xfafc('0x39')];_0x3cc5af+=0x1){socket['emit'](_0xfafc('0x9d'),{'UserId':Number(_0x4382b2['query'][_0xfafc('0x5b')][_0x3cc5af]),'CmListId':Number(_0x4382b2[_0xfafc('0x49')]['id'])});}}else{socket[_0xfafc('0x99')]('userCmList:remove',{'UserId':Number(_0x4382b2[_0xfafc('0x34')]['ids']),'CmListId':Number(_0x4382b2['params']['id'])});}});}})['then'](respondWithStatusCode(_0x47d3b7,null))[_0xfafc('0x48')](handleError(_0x47d3b7,null));};exports['getAgents']=function(_0x38c066,_0x570bc9,_0x3faa95){var _0x4f434f={};var _0x430c17={};var _0x4f374d;var _0x4c4f76;return db['CmList'][_0xfafc('0x8b')]({'where':{'id':_0x38c066[_0xfafc('0x49')]['id']}})['then'](handleEntityNotFound(_0x570bc9,null))[_0xfafc('0x26')](function(_0x260792){if(_0x260792){_0x4f374d=_0x260792;_0x430c17[_0xfafc('0x37')]=_[_0xfafc('0x4a')](db[_0xfafc('0x9e')][_0xfafc('0x30')]);_0x430c17[_0xfafc('0x34')]=_['keys'](_0x38c066['query']);_0x430c17[_0xfafc('0x3f')]=_[_0xfafc('0x35')](_0x430c17[_0xfafc('0x37')],_0x430c17['query']);_0x4f434f[_0xfafc('0x36')]=_['intersection'](_0x430c17[_0xfafc('0x37')],qs[_0xfafc('0x38')](_0x38c066[_0xfafc('0x34')][_0xfafc('0x38')]));_0x4f434f[_0xfafc('0x36')]=_0x4f434f[_0xfafc('0x36')][_0xfafc('0x39')]?_0x4f434f[_0xfafc('0x36')]:_0x430c17['model'];_0x4f434f[_0xfafc('0x3b')]=qs['sort'](_0x38c066[_0xfafc('0x34')][_0xfafc('0x3c')]);_0x4f434f[_0xfafc('0x3d')]=qs[_0xfafc('0x3f')](_[_0xfafc('0x3e')](_0x38c066[_0xfafc('0x34')],_0x430c17[_0xfafc('0x3f')]));if(_0x38c066[_0xfafc('0x34')][_0xfafc('0x40')]){_0x4f434f['where']=_[_0xfafc('0x41')](_0x4f434f['where'],{'$or':_[_0xfafc('0x2f')](_0x4f434f[_0xfafc('0x36')],function(_0x249caf){var _0x450718={};_0x450718[_0x249caf]={'$like':'%'+_0x38c066[_0xfafc('0x34')]['filter']+'%'};return _0x450718;})});}_0x4f434f=_[_0xfafc('0x41')]({},_0x4f434f,_0x38c066[_0xfafc('0x43')]);return _0x4f374d['getAgents'](_0x4f434f);}})['then'](function(_0x12ae00){if(_0x12ae00){_0x4c4f76=_0x12ae00[_0xfafc('0x39')];if(!_0x38c066[_0xfafc('0x34')][_0xfafc('0x58')]('nolimit')){_0x4f434f[_0xfafc('0x20')]=qs['limit'](_0x38c066['query'][_0xfafc('0x20')]);_0x4f434f[_0xfafc('0x1f')]=qs[_0xfafc('0x1f')](_0x38c066[_0xfafc('0x34')][_0xfafc('0x1f')]);}return _0x4f374d[_0xfafc('0x9f')](_0x4f434f);}})[_0xfafc('0x26')](function(_0x35065e){if(_0x35065e){return _0x35065e?{'count':_0x4c4f76,'rows':_0x35065e}:null;}})[_0xfafc('0x26')](respondWithResult(_0x570bc9,null))[_0xfafc('0x48')](handleError(_0x570bc9,null));};function handleQuery(_0x2706d8){logger[_0xfafc('0xa0')](_0x2706d8);return db['sequelize'][_0xfafc('0x34')](_0x2706d8)['spread'](function(_0x181de6){csv_results[_0xfafc('0x5e')](_0x181de6);})[_0xfafc('0x48')](function(_0x269bba){logger[_0xfafc('0x51')](_0x269bba['message']);});} \ No newline at end of file +var _0xee41=['VIRTUAL','includeAll','include','params','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','findOne','pick','findAll','removeDispositions','ids','addContacts','CmContact','tags','join','push','each','omit','success','dataValues','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','from','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','toString','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','info','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','update','then','destroy','get','UserProfileResource','stack','name','index','map','CmList','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge'];(function(_0x36a481,_0x29a707){var _0x4a590c=function(_0x4e0d40){while(--_0x4e0d40){_0x36a481['push'](_0x36a481['shift']());}};_0x4a590c(++_0x29a707);}(_0xee41,0x1aa));var _0x1ee4=function(_0x23e33d,_0x31c8c8){_0x23e33d=_0x23e33d-0x0;var _0x818fc=_0xee41[_0x23e33d];return _0x818fc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1ee4('0x0'));var zipdir=require(_0x1ee4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1ee4('0x2'));var moment=require(_0x1ee4('0x3'));var BPromise=require(_0x1ee4('0x4'));var Mustache=require(_0x1ee4('0x5'));var util=require(_0x1ee4('0x6'));var path=require(_0x1ee4('0x7'));var sox=require('sox');var csv=require(_0x1ee4('0x8'));var ejs=require(_0x1ee4('0x9'));var fs=require('fs');var fs_extra=require(_0x1ee4('0xa'));var _=require(_0x1ee4('0xb'));var squel=require('squel');var crypto=require(_0x1ee4('0xc'));var jsforce=require(_0x1ee4('0xd'));var deskjs=require(_0x1ee4('0xe'));var toCsv=require(_0x1ee4('0x8'));var querystring=require(_0x1ee4('0xf'));var Papa=require(_0x1ee4('0x10'));var Redis=require(_0x1ee4('0x11'));var authService=require(_0x1ee4('0x12'));var qs=require(_0x1ee4('0x13'));var as=require(_0x1ee4('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1ee4('0x15'))(_0x1ee4('0x16'));var utils=require('../../config/utils');var config=require(_0x1ee4('0x17'));var licenseUtil=require(_0x1ee4('0x18'));var db=require(_0x1ee4('0x19'))['db'];var csv_results;config[_0x1ee4('0x1a')]=_[_0x1ee4('0x1b')](config[_0x1ee4('0x1a')],{'host':_0x1ee4('0x1c'),'port':0x18eb});var socket=require(_0x1ee4('0x1d'))(new Redis(config[_0x1ee4('0x1a')]));require(_0x1ee4('0x1e'))['register'](socket);function respondWithStatusCode(_0x416544,_0x44ad8a){_0x44ad8a=_0x44ad8a||0xcc;return function(_0xaebb6){if(_0xaebb6){return _0x416544[_0x1ee4('0x1f')](_0x44ad8a);}return _0x416544[_0x1ee4('0x20')](_0x44ad8a)[_0x1ee4('0x21')]();};}function respondWithResult(_0x1b29df,_0xd57dcb){_0xd57dcb=_0xd57dcb||0xc8;return function(_0x21c148){if(_0x21c148){return _0x1b29df[_0x1ee4('0x20')](_0xd57dcb)[_0x1ee4('0x22')](_0x21c148);}};}function respondWithFilteredResult(_0x4b70ac,_0x1bfb2d){return function(_0x953b58){if(_0x953b58){var _0x31a8aa=typeof _0x1bfb2d[_0x1ee4('0x23')]==='undefined'&&typeof _0x1bfb2d[_0x1ee4('0x24')]===_0x1ee4('0x25');var _0x4221f8=_0x953b58[_0x1ee4('0x26')];var _0x58ad37=_0x31a8aa?0x0:_0x1bfb2d[_0x1ee4('0x23')];var _0x2c459d=_0x31a8aa?_0x953b58[_0x1ee4('0x26')]:_0x1bfb2d[_0x1ee4('0x23')]+_0x1bfb2d[_0x1ee4('0x24')];var _0x1b9dde;if(_0x2c459d>=_0x4221f8){_0x2c459d=_0x4221f8;_0x1b9dde=0xc8;}else{_0x1b9dde=0xce;}_0x4b70ac[_0x1ee4('0x20')](_0x1b9dde);return _0x4b70ac[_0x1ee4('0x27')]('Content-Range',_0x58ad37+'-'+_0x2c459d+'/'+_0x4221f8)[_0x1ee4('0x22')](_0x953b58);}return null;};}function patchUpdates(_0x10476d){return function(_0x52bc3b){try{jsonpatch[_0x1ee4('0x28')](_0x52bc3b,_0x10476d,!![]);}catch(_0x22e340){return BPromise['reject'](_0x22e340);}return _0x52bc3b['save']();};}function saveUpdates(_0x426d87,_0x48af86){return function(_0x16bd27){if(_0x16bd27){return _0x16bd27[_0x1ee4('0x29')](_0x426d87)[_0x1ee4('0x2a')](function(_0x306114){return _0x306114;});}return null;};}function removeEntity(_0x412e15,_0x2881d0){return function(_0x1e47b7){if(_0x1e47b7){return _0x1e47b7[_0x1ee4('0x2b')]()['then'](function(){var _0x5ab224=_0x1e47b7[_0x1ee4('0x2c')]({'plain':!![]});var _0x36d788='Lists';return db[_0x1ee4('0x2d')][_0x1ee4('0x2b')]({'where':{'type':_0x36d788,'resourceId':_0x5ab224['id']}})[_0x1ee4('0x2a')](function(){return _0x1e47b7;});})[_0x1ee4('0x2a')](function(){_0x412e15['status'](0xcc)[_0x1ee4('0x21')]();});}};}function handleEntityNotFound(_0x4d663f,_0x4b738d){return function(_0x3b7880){if(!_0x3b7880){_0x4d663f[_0x1ee4('0x1f')](0x194);}return _0x3b7880;};}function handleError(_0x54b85e,_0x5a4413){_0x5a4413=_0x5a4413||0x1f4;return function(_0x338fc8){logger['error'](_0x338fc8[_0x1ee4('0x2e')]);if(_0x338fc8[_0x1ee4('0x2f')]){delete _0x338fc8['name'];}_0x54b85e[_0x1ee4('0x20')](_0x5a4413)['send'](_0x338fc8);};}exports[_0x1ee4('0x30')]=function(_0x512fa1,_0x241949){var _0x30fd13={},_0x5f4ec5={},_0x45bdfd={'count':0x0,'rows':[]};var _0x73ce91=_[_0x1ee4('0x31')](db[_0x1ee4('0x32')][_0x1ee4('0x33')],function(_0x312f4b){return{'name':_0x312f4b[_0x1ee4('0x34')],'type':_0x312f4b[_0x1ee4('0x35')]['key']};});_0x5f4ec5[_0x1ee4('0x36')]=_[_0x1ee4('0x31')](_0x73ce91,_0x1ee4('0x2f'));_0x5f4ec5[_0x1ee4('0x37')]=_[_0x1ee4('0x38')](_0x512fa1['query']);_0x5f4ec5[_0x1ee4('0x39')]=_[_0x1ee4('0x3a')](_0x5f4ec5['model'],_0x5f4ec5[_0x1ee4('0x37')]);_0x30fd13[_0x1ee4('0x3b')]=_[_0x1ee4('0x3a')](_0x5f4ec5[_0x1ee4('0x36')],qs['fields'](_0x512fa1['query'][_0x1ee4('0x3c')]));_0x30fd13[_0x1ee4('0x3b')]=_0x30fd13[_0x1ee4('0x3b')][_0x1ee4('0x3d')]?_0x30fd13[_0x1ee4('0x3b')]:_0x5f4ec5['model'];if(!_0x512fa1['query'][_0x1ee4('0x3e')](_0x1ee4('0x3f'))){_0x30fd13[_0x1ee4('0x24')]=qs[_0x1ee4('0x24')](_0x512fa1['query'][_0x1ee4('0x24')]);_0x30fd13[_0x1ee4('0x23')]=qs[_0x1ee4('0x23')](_0x512fa1[_0x1ee4('0x37')][_0x1ee4('0x23')]);}_0x30fd13[_0x1ee4('0x40')]=qs['sort'](_0x512fa1[_0x1ee4('0x37')][_0x1ee4('0x41')]);_0x30fd13[_0x1ee4('0x42')]=qs['filters'](_['pick'](_0x512fa1[_0x1ee4('0x37')],_0x5f4ec5['filters']),_0x73ce91);if(_0x512fa1[_0x1ee4('0x37')][_0x1ee4('0x43')]){_0x30fd13[_0x1ee4('0x42')]=_[_0x1ee4('0x44')](_0x30fd13['where'],{'$or':_[_0x1ee4('0x31')](_0x73ce91,function(_0x4d9697){if(_0x4d9697[_0x1ee4('0x35')]!==_0x1ee4('0x45')){var _0x4421cc={};_0x4421cc[_0x4d9697['name']]={'$like':'%'+_0x512fa1['query'][_0x1ee4('0x43')]+'%'};return _0x4421cc;}})});}_0x30fd13=_['merge']({},_0x30fd13,_0x512fa1['options']);var _0x32d8b8={'where':_0x30fd13[_0x1ee4('0x42')]};return db[_0x1ee4('0x32')]['count'](_0x32d8b8)['then'](function(_0x40a159){_0x45bdfd[_0x1ee4('0x26')]=_0x40a159;if(_0x512fa1['query'][_0x1ee4('0x46')]){_0x30fd13[_0x1ee4('0x47')]=[{'all':!![]}];}return db[_0x1ee4('0x32')]['findAll'](_0x30fd13);})[_0x1ee4('0x2a')](function(_0x186434){_0x45bdfd['rows']=_0x186434;return _0x45bdfd;})[_0x1ee4('0x2a')](respondWithFilteredResult(_0x241949,_0x30fd13))['catch'](handleError(_0x241949,null));};exports['show']=function(_0x14af9e,_0x4728bc){var _0x1a202f={'raw':![],'where':{'id':_0x14af9e[_0x1ee4('0x48')]['id']}},_0x4c1660={};_0x4c1660[_0x1ee4('0x36')]=_[_0x1ee4('0x38')](db['CmList'][_0x1ee4('0x33')]);_0x4c1660[_0x1ee4('0x37')]=_['keys'](_0x14af9e[_0x1ee4('0x37')]);_0x4c1660['filters']=_[_0x1ee4('0x3a')](_0x4c1660[_0x1ee4('0x36')],_0x4c1660['query']);_0x1a202f[_0x1ee4('0x3b')]=_['intersection'](_0x4c1660[_0x1ee4('0x36')],qs[_0x1ee4('0x3c')](_0x14af9e['query'][_0x1ee4('0x3c')]));_0x1a202f[_0x1ee4('0x3b')]=_0x1a202f[_0x1ee4('0x3b')][_0x1ee4('0x3d')]?_0x1a202f['attributes']:_0x4c1660[_0x1ee4('0x36')];if(_0x14af9e[_0x1ee4('0x37')][_0x1ee4('0x46')]){_0x1a202f[_0x1ee4('0x47')]=[{'all':!![]}];}_0x1a202f=_['merge']({},_0x1a202f,_0x14af9e[_0x1ee4('0x49')]);return db[_0x1ee4('0x32')][_0x1ee4('0x4a')](_0x1a202f)[_0x1ee4('0x2a')](handleEntityNotFound(_0x4728bc,null))[_0x1ee4('0x2a')](respondWithResult(_0x4728bc,null))[_0x1ee4('0x4b')](handleError(_0x4728bc,null));};exports[_0x1ee4('0x4c')]=function(_0x30e15f,_0x517c0d){return db[_0x1ee4('0x32')][_0x1ee4('0x4c')](_0x30e15f[_0x1ee4('0x4d')],{})[_0x1ee4('0x2a')](function(_0x7f29fd){var _0x3ce1db=_0x30e15f[_0x1ee4('0x4e')][_0x1ee4('0x2c')]({'plain':!![]});if(!_0x3ce1db)throw new Error(_0x1ee4('0x4f'));if(_0x3ce1db[_0x1ee4('0x50')]===_0x1ee4('0x4e')){var _0x3c1290=_0x7f29fd[_0x1ee4('0x2c')]({'plain':!![]});var _0x5cfc85=_0x1ee4('0x51');return db[_0x1ee4('0x52')][_0x1ee4('0x4a')]({'where':{'name':_0x5cfc85,'userProfileId':_0x3ce1db[_0x1ee4('0x53')]},'raw':!![]})[_0x1ee4('0x2a')](function(_0x1b31a4){if(_0x1b31a4&&_0x1b31a4[_0x1ee4('0x54')]===0x0){return db['UserProfileResource'][_0x1ee4('0x4c')]({'name':_0x3c1290[_0x1ee4('0x2f')],'resourceId':_0x3c1290['id'],'type':_0x1b31a4['name'],'sectionId':_0x1b31a4['id']},{})[_0x1ee4('0x2a')](function(){return _0x7f29fd;});}else{return _0x7f29fd;}})[_0x1ee4('0x4b')](function(_0x1d0bc0){logger[_0x1ee4('0x55')](_0x1ee4('0x56'),_0x1d0bc0);throw _0x1d0bc0;});}return _0x7f29fd;})['then'](respondWithResult(_0x517c0d,0xc9))[_0x1ee4('0x4b')](handleError(_0x517c0d,null));};exports[_0x1ee4('0x29')]=function(_0x2ecae5,_0x16c702){if(_0x2ecae5['body']['id']){delete _0x2ecae5[_0x1ee4('0x4d')]['id'];}return db[_0x1ee4('0x32')][_0x1ee4('0x4a')]({'where':{'id':_0x2ecae5[_0x1ee4('0x48')]['id']}})[_0x1ee4('0x2a')](handleEntityNotFound(_0x16c702,null))[_0x1ee4('0x2a')](saveUpdates(_0x2ecae5[_0x1ee4('0x4d')],null))['then'](respondWithResult(_0x16c702,null))['catch'](handleError(_0x16c702,null));};exports[_0x1ee4('0x2b')]=function(_0x274db0,_0xb318ae){return db['CmList'][_0x1ee4('0x4a')]({'where':{'id':_0x274db0[_0x1ee4('0x48')]['id']}})['then'](handleEntityNotFound(_0xb318ae,null))[_0x1ee4('0x2a')](removeEntity(_0xb318ae,null))[_0x1ee4('0x4b')](handleError(_0xb318ae,null));};exports[_0x1ee4('0x57')]=function(_0x192ffe,_0x378b16){return db[_0x1ee4('0x32')][_0x1ee4('0x57')]()[_0x1ee4('0x2a')](respondWithResult(_0x378b16,null))[_0x1ee4('0x4b')](handleError(_0x378b16,null));};exports[_0x1ee4('0x58')]=function(_0x33627c,_0x1caf33,_0xb453ad){if(_0x33627c['body']['id']){delete _0x33627c[_0x1ee4('0x4d')]['id'];}return db[_0x1ee4('0x32')][_0x1ee4('0x4a')]({'where':{'id':_0x33627c[_0x1ee4('0x48')]['id']}})['then'](handleEntityNotFound(_0x1caf33,null))[_0x1ee4('0x2a')](function(_0x58e1e1){if(_0x58e1e1){_0x33627c['body'][_0x1ee4('0x59')]=_0x58e1e1['id'];return db[_0x1ee4('0x5a')]['create'](_0x33627c['body']);}})['then'](respondWithResult(_0x1caf33,null))[_0x1ee4('0x4b')](handleError(_0x1caf33,null));};exports[_0x1ee4('0x5b')]=function(_0x1d33d2,_0x9baf45,_0x14e23c){var _0x2e38f={'raw':![],'where':{}};var _0x22b751={};var _0x32e950={'count':0x0,'rows':[]};return db['CmList'][_0x1ee4('0x5c')]({'where':{'id':_0x1d33d2[_0x1ee4('0x48')]['id']}})[_0x1ee4('0x2a')](handleEntityNotFound(_0x9baf45,null))[_0x1ee4('0x2a')](function(_0x4981d7){if(_0x4981d7){_0x22b751['model']=_[_0x1ee4('0x38')](db['Disposition']['rawAttributes']);_0x22b751['query']=_[_0x1ee4('0x38')](_0x1d33d2[_0x1ee4('0x37')]);_0x22b751['filters']=_['intersection'](_0x22b751[_0x1ee4('0x36')],_0x22b751[_0x1ee4('0x37')]);_0x2e38f[_0x1ee4('0x3b')]=_[_0x1ee4('0x3a')](_0x22b751[_0x1ee4('0x36')],qs[_0x1ee4('0x3c')](_0x1d33d2['query'][_0x1ee4('0x3c')]));_0x2e38f[_0x1ee4('0x3b')]=_0x2e38f[_0x1ee4('0x3b')][_0x1ee4('0x3d')]?_0x2e38f[_0x1ee4('0x3b')]:_0x22b751[_0x1ee4('0x36')];if(!_0x1d33d2[_0x1ee4('0x37')][_0x1ee4('0x3e')](_0x1ee4('0x3f'))){_0x2e38f[_0x1ee4('0x24')]=qs[_0x1ee4('0x24')](_0x1d33d2[_0x1ee4('0x37')][_0x1ee4('0x24')]);_0x2e38f[_0x1ee4('0x23')]=qs[_0x1ee4('0x23')](_0x1d33d2['query'][_0x1ee4('0x23')]);}_0x2e38f[_0x1ee4('0x40')]=qs[_0x1ee4('0x41')](_0x1d33d2['query'][_0x1ee4('0x41')]);_0x2e38f[_0x1ee4('0x42')]=qs[_0x1ee4('0x39')](_[_0x1ee4('0x5d')](_0x1d33d2['query'],_0x22b751[_0x1ee4('0x39')]));_0x2e38f['where'][_0x1ee4('0x59')]=_0x4981d7['id'];if(_0x1d33d2[_0x1ee4('0x37')][_0x1ee4('0x43')]){_0x2e38f[_0x1ee4('0x42')]=_[_0x1ee4('0x44')](_0x2e38f[_0x1ee4('0x42')],{'$or':_['map'](_0x2e38f[_0x1ee4('0x3b')],function(_0x4d670c){var _0x388f94={};_0x388f94[_0x4d670c]={'$like':'%'+_0x1d33d2['query']['filter']+'%'};return _0x388f94;})});}_0x2e38f=_[_0x1ee4('0x44')]({},_0x2e38f,_0x1d33d2['options']);return db[_0x1ee4('0x5a')][_0x1ee4('0x26')]({'where':_0x2e38f[_0x1ee4('0x42')]})[_0x1ee4('0x2a')](function(_0x5ab323){_0x32e950[_0x1ee4('0x26')]=_0x5ab323;if(_0x1d33d2['query']['includeAll']){_0x2e38f['include']=[{'all':!![]}];}return db[_0x1ee4('0x5a')][_0x1ee4('0x5e')](_0x2e38f);})[_0x1ee4('0x2a')](function(_0x2be051){_0x32e950['rows']=_0x2be051;return _0x32e950;});}})['then'](respondWithFilteredResult(_0x9baf45,_0x2e38f))[_0x1ee4('0x4b')](handleError(_0x9baf45,null));};exports[_0x1ee4('0x5f')]=function(_0x329b36,_0x5344d9,_0x4b4f16){return db[_0x1ee4('0x32')]['find']({'where':{'id':_0x329b36[_0x1ee4('0x48')]['id']}})['then'](handleEntityNotFound(_0x5344d9,null))[_0x1ee4('0x2a')](function(_0x349e33){if(_0x349e33){return _0x349e33[_0x1ee4('0x5f')](_0x329b36[_0x1ee4('0x37')][_0x1ee4('0x60')]);}})[_0x1ee4('0x2a')](respondWithStatusCode(_0x5344d9,null))[_0x1ee4('0x4b')](handleError(_0x5344d9,null));};exports[_0x1ee4('0x61')]=function(_0x4a31c8,_0x16b60a,_0x267720){return db[_0x1ee4('0x32')]['find']({'where':{'id':_0x4a31c8[_0x1ee4('0x48')]['id']}})[_0x1ee4('0x2a')](handleEntityNotFound(_0x16b60a,null))[_0x1ee4('0x2a')](function(_0x5dbee3){if(_0x5dbee3){var _0x14778c=[];var _0x1c7afc={'success':[],'errors':[]};return db[_0x1ee4('0x62')]['describe']()[_0x1ee4('0x2a')](function(_0x11447e){if(_0x4a31c8[_0x1ee4('0x4d')][_0x1ee4('0x63')]&&_['isArray'](_0x4a31c8['body']['tags'])){if(_0x4a31c8['body'][_0x1ee4('0x63')]['length']){_0x4a31c8[_0x1ee4('0x4d')][_0x1ee4('0x63')]=_0x4a31c8[_0x1ee4('0x4d')][_0x1ee4('0x63')][_0x1ee4('0x64')](';')+';';}else{_0x4a31c8[_0x1ee4('0x4d')][_0x1ee4('0x63')]=null;}}else{_0x4a31c8['body'][_0x1ee4('0x63')]=null;}if(_0x4a31c8[_0x1ee4('0x4d')]&&_['isArray'](_0x4a31c8[_0x1ee4('0x4d')])){for(var _0x16569c=0x0;_0x16569c<_0x4a31c8[_0x1ee4('0x4d')][_0x1ee4('0x3d')];_0x16569c+=0x1){_0x4a31c8[_0x1ee4('0x4d')][_0x16569c][_0x1ee4('0x59')]=_0x4a31c8['params']['id'];_0x14778c[_0x1ee4('0x65')](_0x4a31c8[_0x1ee4('0x4d')][_0x16569c]);}return BPromise[_0x1ee4('0x66')](_0x14778c,function(_0x1567fa){return db[_0x1ee4('0x62')][_0x1ee4('0x4c')](_[_0x1ee4('0x67')](_0x1567fa,['ids','id'])||{},{'fields':_[_0x1ee4('0x38')](_0x11447e),'raw':!![]})['then'](function(_0x1ecca4){_0x1c7afc[_0x1ee4('0x68')]['push'](_0x1ecca4[_0x1ee4('0x69')]);})[_0x1ee4('0x4b')](function(_0x4ab9f9){_0x1c7afc['errors'][_0x1ee4('0x65')]({'data':_0x1567fa,'error':_0x4ab9f9[_0x1ee4('0x6a')]});});})[_0x1ee4('0x2a')](function(_0x5b2671){return _0x1c7afc;})[_0x1ee4('0x4b')](function(_0x571265){return _0x571265;});}else{_0x16b60a[_0x1ee4('0x20')](0x190)[_0x1ee4('0x22')]({'message':_0x1ee4('0x6b')});}});}})[_0x1ee4('0x2a')](respondWithResult(_0x16b60a,null))['catch'](handleError(_0x16b60a,null));};exports[_0x1ee4('0x6c')]=function(_0x2ddbe3,_0x3232d5,_0x28ec72){var _0x4da61f;return db[_0x1ee4('0x32')][_0x1ee4('0x4a')]({'where':{'id':_0x2ddbe3[_0x1ee4('0x48')]['id']},'include':[{'model':db[_0x1ee4('0x6d')],'as':'CustomFields'}]})[_0x1ee4('0x2a')](handleEntityNotFound(_0x3232d5,null))[_0x1ee4('0x2a')](function(_0x3eb3fe){if(_0x3eb3fe){_0x4da61f=_0x3eb3fe;return db[_0x1ee4('0x62')][_0x1ee4('0x33')];}})[_0x1ee4('0x2a')](function(_0x279ba4){if(_0x279ba4){var _0x3f7722={};var _0x3d7fa5={};_0x3d7fa5[_0x1ee4('0x36')]=_['concat'](_['keys'](_0x279ba4),_['map'](_0x4da61f[_0x1ee4('0x6e')],function(_0x299a08){return util[_0x1ee4('0x6f')](_0x1ee4('0x70'),_0x299a08['id']);}));_0x3d7fa5['query']=_[_0x1ee4('0x38')](_0x2ddbe3[_0x1ee4('0x37')]);_0x3d7fa5[_0x1ee4('0x39')]=_[_0x1ee4('0x3a')](_0x3d7fa5[_0x1ee4('0x36')],_0x3d7fa5[_0x1ee4('0x37')]);_0x3f7722[_0x1ee4('0x3b')]=_['intersection'](_0x3d7fa5[_0x1ee4('0x36')],qs[_0x1ee4('0x3c')](_0x2ddbe3[_0x1ee4('0x37')]['fields']));_0x3f7722[_0x1ee4('0x3b')]=_0x3f7722[_0x1ee4('0x3b')][_0x1ee4('0x3d')]?_0x3f7722[_0x1ee4('0x3b')]:_0x3d7fa5[_0x1ee4('0x36')];if(!_0x2ddbe3[_0x1ee4('0x37')][_0x1ee4('0x3e')](_0x1ee4('0x3f'))){_0x3f7722['limit']=qs[_0x1ee4('0x24')](_0x2ddbe3[_0x1ee4('0x37')][_0x1ee4('0x24')]);_0x3f7722['offset']=qs['offset'](_0x2ddbe3['query'][_0x1ee4('0x23')]);}_0x3f7722['order']=qs[_0x1ee4('0x41')](_0x2ddbe3['query'][_0x1ee4('0x41')]);_0x3f7722[_0x1ee4('0x42')]=qs[_0x1ee4('0x39')](_[_0x1ee4('0x5d')](_0x2ddbe3[_0x1ee4('0x37')],_0x3d7fa5[_0x1ee4('0x39')]));_0x3f7722[_0x1ee4('0x71')]=!![];if(_0x2ddbe3[_0x1ee4('0x37')][_0x1ee4('0x43')]){_0x3f7722[_0x1ee4('0x42')]=_[_0x1ee4('0x44')](_0x3f7722[_0x1ee4('0x42')],{'$or':_['map'](_0x3f7722[_0x1ee4('0x3b')],function(_0x36578e){var _0xe4de9c={};_0xe4de9c[_0x36578e]={'$like':'%'+_0x2ddbe3[_0x1ee4('0x37')][_0x1ee4('0x43')]+'%'};return _0xe4de9c;})});}_0x3f7722=_[_0x1ee4('0x44')]({},_0x3f7722,_0x2ddbe3[_0x1ee4('0x49')]);return _0x4da61f[_0x1ee4('0x6c')](_0x3f7722);}})[_0x1ee4('0x2a')](respondWithResult(_0x3232d5,null))[_0x1ee4('0x4b')](handleError(_0x3232d5,null));};exports[_0x1ee4('0x72')]=function(_0x3bd633,_0x459d32,_0x1c2fbf){var _0x34548c;var _0x10d350;var _0x323f40;var _0x39a472=_0x3bd633[_0x1ee4('0x48')]['id'];csv_results=[];return db[_0x1ee4('0x73')][_0x1ee4('0x5e')]({'attributes':['id',_0x1ee4('0x2f')],'raw':!![],'order':[_0x1ee4('0x74')]})[_0x1ee4('0x2a')](function(_0x48b04d){_0x34548c=_0x48b04d;var _0x45d3e7=_[_0x1ee4('0x38')](db[_0x1ee4('0x62')][_0x1ee4('0x33')]);return db['CmCustomField']['findAll']({'raw':!![],'attributes':['id',_0x1ee4('0x75')]})[_0x1ee4('0x2a')](function(_0x4b4a48){_0x10d350=_0x4b4a48;var _0x1c7d8a=squel[_0x1ee4('0x76')]()[_0x1ee4('0x3c')](_0x45d3e7)[_0x1ee4('0x77')]('cm_contacts','c')[_0x1ee4('0x42')](_0x1ee4('0x78'),_0x39a472)['where'](_0x1ee4('0x79'))[_0x1ee4('0x7a')]();for(var _0x550c15=0x0;_0x550c15<_0x10d350[_0x1ee4('0x3d')];_0x550c15++){_0x1c7d8a[_0x1ee4('0x7b')](_0x1ee4('0x7c')+_0x10d350[_0x550c15]['id'],_0x1ee4('0x7d')+_0x10d350[_0x550c15]['alias']);}for(var _0x550c15=0x0;_0x550c15<_0x34548c[_0x1ee4('0x3d')];_0x550c15++){_0x1c7d8a[_0x1ee4('0x7b')](squel[_0x1ee4('0x76')]()['field'](_0x1ee4('0x7e'))[_0x1ee4('0x77')](_0x1ee4('0x7f'))['where'](_0x1ee4('0x80'),_0x34548c[_0x550c15]['id'])[_0x1ee4('0x42')](_0x1ee4('0x81')),_0x1ee4('0x82')+_0x34548c[_0x550c15]['name']);_0x1c7d8a['field'](squel[_0x1ee4('0x76')]()[_0x1ee4('0x7b')]('description')[_0x1ee4('0x77')](_0x1ee4('0x7f'))[_0x1ee4('0x42')](_0x1ee4('0x80'),_0x34548c[_0x550c15]['id'])[_0x1ee4('0x42')](_0x1ee4('0x81')),'description_additionalPhone_'+_0x34548c[_0x550c15][_0x1ee4('0x2f')]);}var _0x1fc2b2=[];_0x1fc2b2[_0x1ee4('0x65')](_0x1c7d8a[_0x1ee4('0x83')]());BPromise[_0x1ee4('0x66')](_0x1fc2b2,handleQuery)[_0x1ee4('0x2a')](function(_0x44176f){handleQuery(_0x1c7d8a[_0x1ee4('0x83')]());var _0x3544fe=csv_results[0x0];if(!_[_0x1ee4('0x84')](_0x3544fe)){var _0x1c751a=toCsv(_0x3544fe);var _0x201e3c=Date[_0x1ee4('0x85')]();fs['writeFileSync'](util[_0x1ee4('0x6f')](_0x1ee4('0x86'),_0x39a472,_0x201e3c),_0x1c751a);_0x459d32[_0x1ee4('0x87')]('Content-disposition',_0x1ee4('0x88')+util[_0x1ee4('0x6f')](_0x1ee4('0x89'),_0x39a472,_0x201e3c));_0x459d32['setHeader'](_0x1ee4('0x8a'),'text/csv');return _0x459d32['download'](util['format'](_0x1ee4('0x86'),_0x39a472,_0x201e3c));}else{return _0x459d32[_0x1ee4('0x1f')](0xcc);}});});});};exports[_0x1ee4('0x8b')]=function(_0x291b8e,_0x4fe42f,_0x15f0be){var _0x336b81;delete _0x291b8e[_0x1ee4('0x4d')]['id'];return db[_0x1ee4('0x32')][_0x1ee4('0x5c')]({'where':{'id':_0x291b8e['params']['id']}})[_0x1ee4('0x2a')](handleEntityNotFound(_0x4fe42f,null))[_0x1ee4('0x2a')](function(_0x2be8b3){if(_0x2be8b3){return db[_0x1ee4('0x8c')][_0x1ee4('0x8d')](function(_0x339a80){return db[_0x1ee4('0x6d')][_0x1ee4('0x4c')](_0x291b8e[_0x1ee4('0x4d')],{'transaction':_0x339a80})[_0x1ee4('0x2a')](function(_0x27c338){_0x336b81=_0x27c338;return _0x2be8b3[_0x1ee4('0x8e')](_0x27c338,{'transaction':_0x339a80});})[_0x1ee4('0x2a')](function(){var _0x2e8c14={'type':db[_0x1ee4('0x8f')][_0x1ee4('0x90')],'transaction':_0x339a80};switch(_0x291b8e[_0x1ee4('0x4d')][_0x1ee4('0x35')]){case _0x1ee4('0x91'):_0x2e8c14['type']=db['Sequelize'][_0x1ee4('0x90')];break;case _0x1ee4('0x92'):_0x2e8c14[_0x1ee4('0x35')]=db['Sequelize'][_0x1ee4('0x93')];break;case'switch':_0x2e8c14[_0x1ee4('0x35')]=db[_0x1ee4('0x8f')][_0x1ee4('0x94')];_0x2e8c14['defaultValue']=![];break;default:}return db[_0x1ee4('0x8c')][_0x1ee4('0x95')][_0x1ee4('0x96')](_0x1ee4('0x97'),util['format'](_0x1ee4('0x98'),_0x336b81['id']),_0x2e8c14);})[_0x1ee4('0x2a')](function(){return _0x336b81;});});}})[_0x1ee4('0x2a')](respondWithResult(_0x4fe42f,null))[_0x1ee4('0x4b')](handleError(_0x4fe42f,null));};exports[_0x1ee4('0x99')]=function(_0x273433,_0x3f4d39,_0x17bc35){var _0x9c8120={};var _0xc2f259={};var _0x5da6f7;var _0x3b28ec;return db[_0x1ee4('0x32')]['findOne']({'where':{'id':_0x273433[_0x1ee4('0x48')]['id']}})['then'](handleEntityNotFound(_0x3f4d39,null))['then'](function(_0x13f0b5){if(_0x13f0b5){_0x5da6f7=_0x13f0b5;_0xc2f259['model']=_['keys'](db[_0x1ee4('0x6d')][_0x1ee4('0x33')]);_0xc2f259['query']=_[_0x1ee4('0x38')](_0x273433['query']);_0xc2f259['filters']=_[_0x1ee4('0x3a')](_0xc2f259[_0x1ee4('0x36')],_0xc2f259[_0x1ee4('0x37')]);_0x9c8120[_0x1ee4('0x3b')]=_['intersection'](_0xc2f259[_0x1ee4('0x36')],qs[_0x1ee4('0x3c')](_0x273433[_0x1ee4('0x37')][_0x1ee4('0x3c')]));_0x9c8120[_0x1ee4('0x3b')]=_0x9c8120[_0x1ee4('0x3b')]['length']?_0x9c8120[_0x1ee4('0x3b')]:_0xc2f259[_0x1ee4('0x36')];_0x9c8120['order']=qs[_0x1ee4('0x41')](_0x273433[_0x1ee4('0x37')][_0x1ee4('0x41')]);_0x9c8120[_0x1ee4('0x42')]=qs[_0x1ee4('0x39')](_[_0x1ee4('0x5d')](_0x273433[_0x1ee4('0x37')],_0xc2f259['filters']));_0x9c8120[_0x1ee4('0x42')]=_[_0x1ee4('0x44')](_0x9c8120[_0x1ee4('0x42')],{'$or':[{'ListId':_0x13f0b5['id']},{'ListId':null}]});if(_0x273433['query'][_0x1ee4('0x43')]){_0x9c8120[_0x1ee4('0x42')]=_[_0x1ee4('0x44')](_0x9c8120['where'],{'$or':_['map'](_0x9c8120[_0x1ee4('0x3b')],function(_0x2a1a7c){var _0x298f2a={};_0x298f2a[_0x2a1a7c]={'$like':'%'+_0x273433[_0x1ee4('0x37')]['filter']+'%'};return _0x298f2a;})});}_0x9c8120=_[_0x1ee4('0x44')]({},_0x9c8120,_0x273433[_0x1ee4('0x49')]);return db[_0x1ee4('0x6d')][_0x1ee4('0x9a')](_0x9c8120);}})['then'](respondWithResult(_0x3f4d39,null))['catch'](handleError(_0x3f4d39,null));};exports[_0x1ee4('0x9b')]=function(_0x4560bc,_0x35172){return db[_0x1ee4('0x6d')][_0x1ee4('0x9a')]({'where':{'ListId':null}})[_0x1ee4('0x2a')](handleEntityNotFound(_0x35172,null))[_0x1ee4('0x2a')](function(_0xf1f6b2){return _0xf1f6b2;})['then'](respondWithResult(_0x35172,null))[_0x1ee4('0x4b')](handleError(_0x35172,null));};exports[_0x1ee4('0x9c')]=function(_0x42ed9b,_0x4da481,_0x52551c){return db[_0x1ee4('0x32')][_0x1ee4('0x4a')]({'where':{'id':_0x42ed9b['params']['id']}})['then'](handleEntityNotFound(_0x4da481,null))[_0x1ee4('0x2a')](function(_0x40066d){if(_0x40066d){return _0x40066d[_0x1ee4('0x9c')](_0x42ed9b[_0x1ee4('0x4d')][_0x1ee4('0x60')],_[_0x1ee4('0x67')](_0x42ed9b['body'],[_0x1ee4('0x60'),'id'])||{})[_0x1ee4('0x9d')](function(_0x525e14){for(var _0x2e4b09=0x0;_0x2e4b09<_0x42ed9b['body'][_0x1ee4('0x60')]['length'];_0x2e4b09+=0x1){socket[_0x1ee4('0x9e')](_0x1ee4('0x9f'),{'UserId':Number(_0x42ed9b[_0x1ee4('0x4d')][_0x1ee4('0x60')][_0x2e4b09]),'CmListId':Number(_0x42ed9b[_0x1ee4('0x48')]['id'])});}return _0x525e14;});}})[_0x1ee4('0x2a')](respondWithResult(_0x4da481,null))[_0x1ee4('0x4b')](handleError(_0x4da481,null));};exports[_0x1ee4('0xa0')]=function(_0x48f1d6,_0x36583f,_0xfe639d){return db['CmList']['find']({'where':{'id':_0x48f1d6[_0x1ee4('0x48')]['id']}})['then'](handleEntityNotFound(_0x36583f,null))[_0x1ee4('0x2a')](function(_0x4638c0){if(_0x4638c0){return _0x4638c0['removeAgents'](_0x48f1d6['query']['ids'])[_0x1ee4('0x2a')](function(){if(_['isArray'](_0x48f1d6['query'][_0x1ee4('0x60')])){for(var _0x219e9c=0x0;_0x219e9c<_0x48f1d6[_0x1ee4('0x37')][_0x1ee4('0x60')][_0x1ee4('0x3d')];_0x219e9c+=0x1){socket[_0x1ee4('0x9e')](_0x1ee4('0xa1'),{'UserId':Number(_0x48f1d6[_0x1ee4('0x37')][_0x1ee4('0x60')][_0x219e9c]),'CmListId':Number(_0x48f1d6[_0x1ee4('0x48')]['id'])});}}else{socket[_0x1ee4('0x9e')](_0x1ee4('0xa1'),{'UserId':Number(_0x48f1d6[_0x1ee4('0x37')][_0x1ee4('0x60')]),'CmListId':Number(_0x48f1d6[_0x1ee4('0x48')]['id'])});}});}})[_0x1ee4('0x2a')](respondWithStatusCode(_0x36583f,null))[_0x1ee4('0x4b')](handleError(_0x36583f,null));};exports['getAgents']=function(_0x3b6163,_0x4248eb,_0x289465){var _0x4d9eb0={};var _0x2f04da={};var _0x320a2d;var _0x56f255;return db[_0x1ee4('0x32')]['findOne']({'where':{'id':_0x3b6163[_0x1ee4('0x48')]['id']}})[_0x1ee4('0x2a')](handleEntityNotFound(_0x4248eb,null))[_0x1ee4('0x2a')](function(_0x389ef0){if(_0x389ef0){_0x320a2d=_0x389ef0;_0x2f04da[_0x1ee4('0x36')]=_[_0x1ee4('0x38')](db[_0x1ee4('0xa2')][_0x1ee4('0x33')]);_0x2f04da[_0x1ee4('0x37')]=_[_0x1ee4('0x38')](_0x3b6163[_0x1ee4('0x37')]);_0x2f04da[_0x1ee4('0x39')]=_[_0x1ee4('0x3a')](_0x2f04da[_0x1ee4('0x36')],_0x2f04da[_0x1ee4('0x37')]);_0x4d9eb0[_0x1ee4('0x3b')]=_[_0x1ee4('0x3a')](_0x2f04da[_0x1ee4('0x36')],qs[_0x1ee4('0x3c')](_0x3b6163[_0x1ee4('0x37')][_0x1ee4('0x3c')]));_0x4d9eb0[_0x1ee4('0x3b')]=_0x4d9eb0['attributes']['length']?_0x4d9eb0['attributes']:_0x2f04da[_0x1ee4('0x36')];_0x4d9eb0[_0x1ee4('0x40')]=qs['sort'](_0x3b6163[_0x1ee4('0x37')][_0x1ee4('0x41')]);_0x4d9eb0[_0x1ee4('0x42')]=qs[_0x1ee4('0x39')](_[_0x1ee4('0x5d')](_0x3b6163[_0x1ee4('0x37')],_0x2f04da['filters']));if(_0x3b6163[_0x1ee4('0x37')][_0x1ee4('0x43')]){_0x4d9eb0[_0x1ee4('0x42')]=_['merge'](_0x4d9eb0[_0x1ee4('0x42')],{'$or':_['map'](_0x4d9eb0[_0x1ee4('0x3b')],function(_0x495e56){var _0x7f8fd5={};_0x7f8fd5[_0x495e56]={'$like':'%'+_0x3b6163[_0x1ee4('0x37')][_0x1ee4('0x43')]+'%'};return _0x7f8fd5;})});}_0x4d9eb0=_[_0x1ee4('0x44')]({},_0x4d9eb0,_0x3b6163[_0x1ee4('0x49')]);return _0x320a2d[_0x1ee4('0xa3')](_0x4d9eb0);}})[_0x1ee4('0x2a')](function(_0x2f8138){if(_0x2f8138){_0x56f255=_0x2f8138[_0x1ee4('0x3d')];if(!_0x3b6163[_0x1ee4('0x37')]['hasOwnProperty'](_0x1ee4('0x3f'))){_0x4d9eb0['limit']=qs[_0x1ee4('0x24')](_0x3b6163[_0x1ee4('0x37')][_0x1ee4('0x24')]);_0x4d9eb0['offset']=qs[_0x1ee4('0x23')](_0x3b6163[_0x1ee4('0x37')][_0x1ee4('0x23')]);}return _0x320a2d[_0x1ee4('0xa3')](_0x4d9eb0);}})[_0x1ee4('0x2a')](function(_0x335eda){if(_0x335eda){return _0x335eda?{'count':_0x56f255,'rows':_0x335eda}:null;}})[_0x1ee4('0x2a')](respondWithResult(_0x4248eb,null))['catch'](handleError(_0x4248eb,null));};function handleQuery(_0x546777){logger[_0x1ee4('0xa4')](_0x546777);return db['sequelize'][_0x1ee4('0x37')](_0x546777)[_0x1ee4('0x9d')](function(_0x32fa6e){csv_results[_0x1ee4('0x65')](_0x32fa6e);})[_0x1ee4('0x4b')](function(_0x5357e9){logger[_0x1ee4('0x55')](_0x5357e9[_0x1ee4('0x6a')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 0e64b36..3a74e69 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x55ca,0x126));var _0xa55c=function(_0x24b53b,_0x57c20d){_0x24b53b=_0x24b53b-0x0;var _0x3b5c00=_0x55ca[_0x24b53b];return _0x3b5c00;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x21d0c3,_0x16c71c){var _0x4df18e=function(_0x576bfe){while(--_0x576bfe){_0x21d0c3['push'](_0x21d0c3['shift']());}};_0x4df18e(++_0x16c71c);}(_0x814b,0x1a2));var _0xb814=function(_0x124f88,_0x3ad501){_0x124f88=_0x124f88-0x0;var _0xed0e3b=_0x814b[_0x124f88];return _0xed0e3b;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 54552c5..2d80512 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 _0xbdb7=['request-promise','path','rimraf','./cmList.attributes','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x16a101,_0x12caba){_0x16a101=_0x16a101-0x0;var _0x47b258=_0xbdb7[_0x16a101];return _0x47b258;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var moment=require(_0x7bdb('0x4'));var BPromise=require(_0x7bdb('0x5'));var rp=require(_0x7bdb('0x6'));var fs=require('fs');var path=require(_0x7bdb('0x7'));var rimraf=require(_0x7bdb('0x8'));var config=require('../../config/environment');var attributes=require(_0x7bdb('0x9'));module['exports']=function(_0x4b5fff,_0xffdc86){return _0x4b5fff[_0x7bdb('0xa')]('CmList',attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda55=['util','moment','bluebird','request-promise','path','rimraf','./cmList.attributes','define','CmList','cm_lists','lodash'];(function(_0x25c655,_0x583d89){var _0x33c2f6=function(_0xd2899a){while(--_0xd2899a){_0x25c655['push'](_0x25c655['shift']());}};_0x33c2f6(++_0x583d89);}(_0xda55,0x6d));var _0x5da5=function(_0x34b71e,_0x58f44d){_0x34b71e=_0x34b71e-0x0;var _0x2cb29b=_0xda55[_0x34b71e];return _0x2cb29b;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5da5('0x2'));var BPromise=require(_0x5da5('0x3'));var rp=require(_0x5da5('0x4'));var fs=require('fs');var path=require(_0x5da5('0x5'));var rimraf=require(_0x5da5('0x6'));var config=require('../../config/environment');var attributes=require(_0x5da5('0x7'));module['exports']=function(_0x356a37,_0x58e7b3){return _0x356a37[_0x5da5('0x8')](_0x5da5('0x9'),attributes,{'tableName':_0x5da5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index ff8c49f..f7196fc 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 _0x7928=['util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','redis','defaults','localhost','request','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x113c43,_0x171537){var _0x25a1ac=function(_0x5544b2){while(--_0x5544b2){_0x113c43['push'](_0x113c43['shift']());}};_0x25a1ac(++_0x171537);}(_0x7928,0x159));var _0x8792=function(_0x376ced,_0x240ab0){_0x376ced=_0x376ced-0x0;var _0x2c1248=_0x7928[_0x376ced];return _0x2c1248;};'use strict';var _=require('lodash');var util=require(_0x8792('0x0'));var moment=require(_0x8792('0x1'));var BPromise=require(_0x8792('0x2'));var rs=require(_0x8792('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8792('0x4'));var logger=require('../../config/logger')(_0x8792('0x5'));var config=require(_0x8792('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8792('0x7')]['http']({'port':0x232a});config[_0x8792('0x8')]=_[_0x8792('0x9')](config[_0x8792('0x8')],{'host':_0x8792('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./cmList.socket')['register'](socket);function respondWithRpcPromise(_0x4229f2,_0x471f36,_0x218dd4){return new BPromise(function(_0x443b03,_0x18170f){return client[_0x8792('0xb')](_0x4229f2,_0x218dd4)[_0x8792('0xc')](function(_0xe6371e){logger['info'](_0x8792('0xd'),_0x471f36,_0x8792('0xe'));logger[_0x8792('0xf')](_0x8792('0x10'),_0x471f36,'request\x20sent',JSON[_0x8792('0x11')](_0xe6371e));if(_0xe6371e['error']){if(_0xe6371e[_0x8792('0x12')][_0x8792('0x13')]===0x1f4){logger[_0x8792('0x12')](_0x8792('0xd'),_0x471f36,_0xe6371e['error'][_0x8792('0x14')]);return _0x18170f(_0xe6371e['error'][_0x8792('0x14')]);}logger[_0x8792('0x12')](_0x8792('0xd'),_0x471f36,_0xe6371e['error'][_0x8792('0x14')]);return _0x443b03(_0xe6371e[_0x8792('0x12')][_0x8792('0x14')]);}else{logger['info'](_0x8792('0xd'),_0x471f36,_0x8792('0xe'));_0x443b03(_0xe6371e[_0x8792('0x15')][_0x8792('0x14')]);}})[_0x8792('0x16')](function(_0x485a90){logger[_0x8792('0x12')]('CmList,\x20%s,\x20%s',_0x471f36,_0x485a90);_0x18170f(_0x485a90);});});} \ No newline at end of file +var _0x6bb6=['defaults','localhost','redis','register','then','info','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','code','error','CmList,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x10392d,_0x33691b){var _0x44a8ef=function(_0x408ecb){while(--_0x408ecb){_0x10392d['push'](_0x10392d['shift']());}};_0x44a8ef(++_0x33691b);}(_0x6bb6,0xd7));var _0x66bb=function(_0x1b7a69,_0x4cc209){_0x1b7a69=_0x1b7a69-0x0;var _0x176d25=_0x6bb6[_0x1b7a69];return _0x176d25;};'use strict';var _=require(_0x66bb('0x0'));var util=require('util');var moment=require(_0x66bb('0x1'));var BPromise=require('bluebird');var rs=require(_0x66bb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x66bb('0x3'))['db'];var utils=require(_0x66bb('0x4'));var logger=require('../../config/logger')(_0x66bb('0x5'));var config=require(_0x66bb('0x6'));var jayson=require(_0x66bb('0x7'));var client=jayson[_0x66bb('0x8')][_0x66bb('0x9')]({'port':0x232a});config['redis']=_[_0x66bb('0xa')](config['redis'],{'host':_0x66bb('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x66bb('0xc')]));require('./cmList.socket')[_0x66bb('0xd')](socket);function respondWithRpcPromise(_0x2a113c,_0x1d4306,_0x3ba55f){return new BPromise(function(_0x39fa32,_0x51cafe){return client['request'](_0x2a113c,_0x3ba55f)[_0x66bb('0xe')](function(_0x6938da){logger[_0x66bb('0xf')]('CmList,\x20%s,\x20%s',_0x1d4306,'request\x20sent');logger[_0x66bb('0x10')](_0x66bb('0x11'),_0x1d4306,'request\x20sent',JSON[_0x66bb('0x12')](_0x6938da));if(_0x6938da['error']){if(_0x6938da['error'][_0x66bb('0x13')]===0x1f4){logger[_0x66bb('0x14')](_0x66bb('0x15'),_0x1d4306,_0x6938da[_0x66bb('0x14')][_0x66bb('0x16')]);return _0x51cafe(_0x6938da[_0x66bb('0x14')]['message']);}logger[_0x66bb('0x14')](_0x66bb('0x15'),_0x1d4306,_0x6938da[_0x66bb('0x14')][_0x66bb('0x16')]);return _0x39fa32(_0x6938da[_0x66bb('0x14')][_0x66bb('0x16')]);}else{logger['info']('CmList,\x20%s,\x20%s',_0x1d4306,'request\x20sent');_0x39fa32(_0x6938da[_0x66bb('0x17')][_0x66bb('0x16')]);}})[_0x66bb('0x18')](function(_0x766650){logger[_0x66bb('0x14')]('CmList,\x20%s,\x20%s',_0x1d4306,_0x766650);_0x51cafe(_0x766650);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 46d7146..514c391 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 _0x6ba3=['./cmList.events','save','update','emit','removeListener','register'];(function(_0x20119d,_0x5034fa){var _0x15c7bf=function(_0x3fe257){while(--_0x3fe257){_0x20119d['push'](_0x20119d['shift']());}};_0x15c7bf(++_0x5034fa);}(_0x6ba3,0x186));var _0x36ba=function(_0x48051b,_0x368d0b){_0x48051b=_0x48051b-0x0;var _0x5669e1=_0x6ba3[_0x48051b];return _0x5669e1;};'use strict';var CmListEvents=require(_0x36ba('0x0'));var events=[_0x36ba('0x1'),'remove',_0x36ba('0x2')];function createListener(_0x1030cb,_0x4d3da0){return function(_0x48b553){_0x4d3da0[_0x36ba('0x3')](_0x1030cb,_0x48b553);};}function removeListener(_0x19333a,_0x2f9b88){return function(){CmListEvents[_0x36ba('0x4')](_0x19333a,_0x2f9b88);};}exports[_0x36ba('0x5')]=function(_0x3547bb){for(var _0x2a8b90=0x0,_0xbbdeba=events['length'];_0x2a8b90<_0xbbdeba;_0x2a8b90++){var _0x55b92d=events[_0x2a8b90];var _0x5c3445=createListener('cmList:'+_0x55b92d,_0x3547bb);CmListEvents['on'](_0x55b92d,_0x5c3445);}}; \ No newline at end of file +var _0xcf09=['register','length','cmList:','./cmList.events','save','emit'];(function(_0x2a2166,_0x3a077f){var _0x3bcf50=function(_0x3f0300){while(--_0x3f0300){_0x2a2166['push'](_0x2a2166['shift']());}};_0x3bcf50(++_0x3a077f);}(_0xcf09,0x165));var _0x9cf0=function(_0x27c06e,_0xa9b01c){_0x27c06e=_0x27c06e-0x0;var _0x116681=_0xcf09[_0x27c06e];return _0x116681;};'use strict';var CmListEvents=require(_0x9cf0('0x0'));var events=[_0x9cf0('0x1'),'remove','update'];function createListener(_0x153ac4,_0x1f7fb0){return function(_0x278cfd){_0x1f7fb0[_0x9cf0('0x2')](_0x153ac4,_0x278cfd);};}function removeListener(_0x13d71d,_0x55ae0c){return function(){CmListEvents['removeListener'](_0x13d71d,_0x55ae0c);};}exports[_0x9cf0('0x3')]=function(_0x1a2d10){for(var _0x3c2609=0x0,_0x3e3625=events[_0x9cf0('0x4')];_0x3c2609<_0x3e3625;_0x3c2609++){var _0x4271f4=events[_0x3c2609];var _0xfb344e=createListener(_0x9cf0('0x5')+_0x4271f4,_0x1a2d10);CmListEvents['on'](_0x4271f4,_0xfb344e);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 1f2cc17..ff1d597 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 _0x931f=['delete','removeDispositions','removeAgents','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','getGlobalCustomFields','/:id','show','/:id/dispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','getAgents','post','create','addDisposition','addContacts','/:id/users','addAgents','put','update'];(function(_0x4ae78d,_0x1d6b50){var _0x27b850=function(_0x30f14a){while(--_0x30f14a){_0x4ae78d['push'](_0x4ae78d['shift']());}};_0x27b850(++_0x1d6b50);}(_0x931f,0x184));var _0xf931=function(_0x26fa43,_0x30a86c){_0x26fa43=_0x26fa43-0x0;var _0x81ca8d=_0x931f[_0x26fa43];return _0x81ca8d;};'use strict';var multer=require(_0xf931('0x0'));var util=require(_0xf931('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf931('0x2'));var router=express['Router']();var fs_extra=require(_0xf931('0x3'));var auth=require(_0xf931('0x4'));var interaction=require(_0xf931('0x5'));var config=require('../../config/environment');var controller=require('./cmList.controller');router[_0xf931('0x6')]('/',auth[_0xf931('0x7')](),controller[_0xf931('0x8')]);router['get']('/describe',auth[_0xf931('0x7')](),controller[_0xf931('0x9')]);router[_0xf931('0x6')]('/global_fields',auth[_0xf931('0x7')](),controller[_0xf931('0xa')]);router['get'](_0xf931('0xb'),auth['isAuthenticated'](),controller[_0xf931('0xc')]);router[_0xf931('0x6')](_0xf931('0xd'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xf931('0x6')](_0xf931('0xe'),auth[_0xf931('0x7')](),controller['getContacts']);router[_0xf931('0x6')](_0xf931('0xf'),auth['isAuthenticated'](),controller[_0xf931('0x10')]);router[_0xf931('0x6')](_0xf931('0x11'),auth[_0xf931('0x7')](),controller[_0xf931('0x12')]);router[_0xf931('0x6')]('/:id/users',auth[_0xf931('0x7')](),controller[_0xf931('0x13')]);router[_0xf931('0x14')]('/',auth[_0xf931('0x7')](),controller[_0xf931('0x15')]);router['post']('/:id/dispositions',auth[_0xf931('0x7')](),controller[_0xf931('0x16')]);router[_0xf931('0x14')](_0xf931('0xe'),auth[_0xf931('0x7')](),controller[_0xf931('0x17')]);router[_0xf931('0x14')]('/:id/fields',auth[_0xf931('0x7')](),controller['addCustomField']);router['post'](_0xf931('0x18'),auth[_0xf931('0x7')](),controller[_0xf931('0x19')]);router[_0xf931('0x1a')](_0xf931('0xb'),auth[_0xf931('0x7')](),controller[_0xf931('0x1b')]);router['delete'](_0xf931('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0xf931('0x1c')](_0xf931('0xd'),auth['isAuthenticated'](),controller[_0xf931('0x1d')]);router[_0xf931('0x1c')](_0xf931('0x18'),auth[_0xf931('0x7')](),controller[_0xf931('0x1e')]);module[_0xf931('0x1f')]=router; \ No newline at end of file +var _0x1c57=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','getGlobalCustomFields','/:id','show','/:id/dispositions','isAuthenticated','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','post','create','addDisposition','/:id/contacts','/:id/fields','put','update','delete','removeDispositions','removeAgents','exports','multer','path','connect-timeout'];(function(_0x16d6dd,_0x23730d){var _0x1d4048=function(_0x1508b2){while(--_0x1508b2){_0x16d6dd['push'](_0x16d6dd['shift']());}};_0x1d4048(++_0x23730d);}(_0x1c57,0xf5));var _0x71c5=function(_0x18a008,_0x3386ad){_0x18a008=_0x18a008-0x0;var _0x4e236e=_0x1c57[_0x18a008];return _0x4e236e;};'use strict';var multer=require(_0x71c5('0x0'));var util=require('util');var path=require(_0x71c5('0x1'));var timeout=require(_0x71c5('0x2'));var express=require('express');var router=express[_0x71c5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x71c5('0x4'));var interaction=require(_0x71c5('0x5'));var config=require(_0x71c5('0x6'));var controller=require('./cmList.controller');router[_0x71c5('0x7')]('/',auth['isAuthenticated'](),controller[_0x71c5('0x8')]);router[_0x71c5('0x7')](_0x71c5('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x71c5('0x7')]('/global_fields',auth['isAuthenticated'](),controller[_0x71c5('0xa')]);router[_0x71c5('0x7')](_0x71c5('0xb'),auth['isAuthenticated'](),controller[_0x71c5('0xc')]);router[_0x71c5('0x7')](_0x71c5('0xd'),auth[_0x71c5('0xe')](),controller[_0x71c5('0xf')]);router[_0x71c5('0x7')]('/:id/contacts',auth[_0x71c5('0xe')](),controller[_0x71c5('0x10')]);router[_0x71c5('0x7')](_0x71c5('0x11'),auth['isAuthenticated'](),controller[_0x71c5('0x12')]);router['get']('/:id/fields',auth[_0x71c5('0xe')](),controller[_0x71c5('0x13')]);router[_0x71c5('0x7')]('/:id/users',auth[_0x71c5('0xe')](),controller['getAgents']);router[_0x71c5('0x14')]('/',auth[_0x71c5('0xe')](),controller[_0x71c5('0x15')]);router['post']('/:id/dispositions',auth[_0x71c5('0xe')](),controller[_0x71c5('0x16')]);router['post'](_0x71c5('0x17'),auth['isAuthenticated'](),controller['addContacts']);router[_0x71c5('0x14')](_0x71c5('0x18'),auth[_0x71c5('0xe')](),controller['addCustomField']);router[_0x71c5('0x14')]('/:id/users',auth[_0x71c5('0xe')](),controller['addAgents']);router[_0x71c5('0x19')](_0x71c5('0xb'),auth['isAuthenticated'](),controller[_0x71c5('0x1a')]);router[_0x71c5('0x1b')](_0x71c5('0xb'),auth[_0x71c5('0xe')](),controller['destroy']);router[_0x71c5('0x1b')](_0x71c5('0xd'),auth[_0x71c5('0xe')](),controller[_0x71c5('0x1c')]);router['delete']('/:id/users',auth[_0x71c5('0xe')](),controller[_0x71c5('0x1d')]);module[_0x71c5('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 1c7a129..d8a3752 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 _0x8b88=['STRING','sequelize','exports'];(function(_0x947202,_0xdc4efa){var _0xfa83e5=function(_0x39c1fd){while(--_0x39c1fd){_0x947202['push'](_0x947202['shift']());}};_0xfa83e5(++_0xdc4efa);}(_0x8b88,0x172));var _0x88b8=function(_0x440a33,_0x3a1841){_0x440a33=_0x440a33-0x0;var _0xd62392=_0x8b88[_0x440a33];return _0xd62392;};'use strict';var Sequelize=require(_0x88b8('0x0'));module[_0x88b8('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x55e7a0){return this['getDataValue']('field');}},'field':{'type':Sequelize[_0x88b8('0x2')],'allowNull':![]},'operator':{'type':Sequelize[_0x88b8('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x88b8('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xe3c9=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x1582ab,_0x3203fd){var _0x2a4368=function(_0xd83a0d){while(--_0xd83a0d){_0x1582ab['push'](_0x1582ab['shift']());}};_0x2a4368(++_0x3203fd);}(_0xe3c9,0x1d7));var _0x9e3c=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xe3c9[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x9e3c('0x0'));module[_0x9e3c('0x1')]={'name':{'type':Sequelize[_0x9e3c('0x2')],'get':function(_0x194579){return this['getDataValue'](_0x9e3c('0x3'));}},'field':{'type':Sequelize[_0x9e3c('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x9e3c('0x4')],'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 21b1e26..e3e5ba4 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x41908a,_0x4a5bb2){var _0x23ac1a=function(_0x59cd4d){while(--_0x59cd4d){_0x41908a['push'](_0x41908a['shift']());}};_0x23ac1a(++_0x4a5bb2);}(_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){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x17fa80,_0x6a7e6e){var _0x532893=function(_0x3d6758){while(--_0x3d6758){_0x17fa80['push'](_0x17fa80['shift']());}};_0x532893(++_0x6a7e6e);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 42ba6e4..5bf80fe 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 _0xe5d6=['exports','define','Condition','tools_conditions','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./condition.attributes'];(function(_0x988a68,_0x4bdf25){var _0x473c57=function(_0xdeef55){while(--_0xdeef55){_0x988a68['push'](_0x988a68['shift']());}};_0x473c57(++_0x4bdf25);}(_0xe5d6,0x149));var _0x6e5d=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xe5d6[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x6e5d('0x0'));var util=require(_0x6e5d('0x1'));var logger=require('../../config/logger')(_0x6e5d('0x2'));var moment=require(_0x6e5d('0x3'));var BPromise=require(_0x6e5d('0x4'));var rp=require(_0x6e5d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6e5d('0x6'));var config=require(_0x6e5d('0x7'));var attributes=require(_0x6e5d('0x8'));module[_0x6e5d('0x9')]=function(_0x342140,_0x5cf9e9){return _0x342140[_0x6e5d('0xa')](_0x6e5d('0xb'),attributes,{'tableName':_0x6e5d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafbc=['define','Condition','tools_conditions','lodash','util','../../config/logger','api','moment','bluebird','path','exports'];(function(_0x29241b,_0x1fa79f){var _0x548e79=function(_0x5ea7a5){while(--_0x5ea7a5){_0x29241b['push'](_0x29241b['shift']());}};_0x548e79(++_0x1fa79f);}(_0xafbc,0xb3));var _0xcafb=function(_0x149c42,_0x51b231){_0x149c42=_0x149c42-0x0;var _0x4a708c=_0xafbc[_0x149c42];return _0x4a708c;};'use strict';var _=require(_0xcafb('0x0'));var util=require(_0xcafb('0x1'));var logger=require(_0xcafb('0x2'))(_0xcafb('0x3'));var moment=require(_0xcafb('0x4'));var BPromise=require(_0xcafb('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcafb('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./condition.attributes');module[_0xcafb('0x7')]=function(_0x419a15,_0x52064a){return _0x419a15[_0xcafb('0x8')](_0xcafb('0x9'),attributes,{'tableName':_0xcafb('0xa'),'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 0f8c827..7e3efb4 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 _0x6118=['rpc','client','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x171fc7,_0x277ce3){var _0x58bba1=function(_0x27df90){while(--_0x27df90){_0x171fc7['push'](_0x171fc7['shift']());}};_0x58bba1(++_0x277ce3);}(_0x6118,0x82));var _0x8611=function(_0x4e93a9,_0x413f30){_0x4e93a9=_0x4e93a9-0x0;var _0x43013c=_0x6118[_0x4e93a9];return _0x43013c;};'use strict';var _=require(_0x8611('0x0'));var util=require(_0x8611('0x1'));var moment=require(_0x8611('0x2'));var BPromise=require(_0x8611('0x3'));var rs=require(_0x8611('0x4'));var fs=require('fs');var Redis=require(_0x8611('0x5'));var db=require(_0x8611('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8611('0x7'))(_0x8611('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8611('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x114c1d,_0x9b918a,_0x8d33f2){return new BPromise(function(_0x1f62dd,_0x79d210){return client[_0x8611('0xa')](_0x114c1d,_0x8d33f2)[_0x8611('0xb')](function(_0x3b492e){logger[_0x8611('0xc')](_0x8611('0xd'),_0x9b918a,_0x8611('0xe'));logger[_0x8611('0xf')](_0x8611('0x10'),_0x9b918a,_0x8611('0xe'),JSON[_0x8611('0x11')](_0x3b492e));if(_0x3b492e[_0x8611('0x12')]){if(_0x3b492e[_0x8611('0x12')][_0x8611('0x13')]===0x1f4){logger['error'](_0x8611('0xd'),_0x9b918a,_0x3b492e[_0x8611('0x12')]['message']);return _0x79d210(_0x3b492e[_0x8611('0x12')]['message']);}logger['error'](_0x8611('0xd'),_0x9b918a,_0x3b492e[_0x8611('0x12')][_0x8611('0x14')]);return _0x1f62dd(_0x3b492e[_0x8611('0x12')][_0x8611('0x14')]);}else{logger[_0x8611('0xc')]('Condition,\x20%s,\x20%s',_0x9b918a,_0x8611('0xe'));_0x1f62dd(_0x3b492e[_0x8611('0x15')][_0x8611('0x14')]);}})[_0x8611('0x16')](function(_0x451fc4){logger[_0x8611('0x12')](_0x8611('0xd'),_0x9b918a,_0x451fc4);_0x79d210(_0x451fc4);});});} \ No newline at end of file +var _0x5b1d=['request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s'];(function(_0x52684f,_0xff73fc){var _0x4a55f0=function(_0x8ce37c){while(--_0x8ce37c){_0x52684f['push'](_0x52684f['shift']());}};_0x4a55f0(++_0xff73fc);}(_0x5b1d,0x140));var _0xd5b1=function(_0x2bd278,_0x2123e2){_0x2bd278=_0x2bd278-0x0;var _0x4e5425=_0x5b1d[_0x2bd278];return _0x4e5425;};'use strict';var _=require(_0xd5b1('0x0'));var util=require(_0xd5b1('0x1'));var moment=require(_0xd5b1('0x2'));var BPromise=require(_0xd5b1('0x3'));var rs=require(_0xd5b1('0x4'));var fs=require('fs');var Redis=require(_0xd5b1('0x5'));var db=require(_0xd5b1('0x6'))['db'];var utils=require(_0xd5b1('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xd5b1('0x8'));var jayson=require(_0xd5b1('0x9'));var client=jayson[_0xd5b1('0xa')][_0xd5b1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x333e07,_0x53e300,_0xf3007f){return new BPromise(function(_0x31cc08,_0x4019ca){return client[_0xd5b1('0xc')](_0x333e07,_0xf3007f)[_0xd5b1('0xd')](function(_0x2e4d49){logger[_0xd5b1('0xe')](_0xd5b1('0xf'),_0x53e300,_0xd5b1('0x10'));logger['debug'](_0xd5b1('0x11'),_0x53e300,_0xd5b1('0x10'),JSON[_0xd5b1('0x12')](_0x2e4d49));if(_0x2e4d49[_0xd5b1('0x13')]){if(_0x2e4d49[_0xd5b1('0x13')][_0xd5b1('0x14')]===0x1f4){logger[_0xd5b1('0x13')](_0xd5b1('0xf'),_0x53e300,_0x2e4d49[_0xd5b1('0x13')][_0xd5b1('0x15')]);return _0x4019ca(_0x2e4d49[_0xd5b1('0x13')]['message']);}logger[_0xd5b1('0x13')](_0xd5b1('0xf'),_0x53e300,_0x2e4d49['error'][_0xd5b1('0x15')]);return _0x31cc08(_0x2e4d49[_0xd5b1('0x13')][_0xd5b1('0x15')]);}else{logger['info'](_0xd5b1('0xf'),_0x53e300,'request\x20sent');_0x31cc08(_0x2e4d49[_0xd5b1('0x16')][_0xd5b1('0x15')]);}})[_0xd5b1('0x17')](function(_0x3ff92){logger[_0xd5b1('0x13')]('Condition,\x20%s,\x20%s',_0x53e300,_0x3ff92);_0x4019ca(_0x3ff92);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 2bf873a..fc6adbf 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 _0xb783=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','util','path','connect-timeout','express'];(function(_0x59ae73,_0x36314d){var _0x18e551=function(_0x2e69fa){while(--_0x2e69fa){_0x59ae73['push'](_0x59ae73['shift']());}};_0x18e551(++_0x36314d);}(_0xb783,0xc0));var _0x3b78=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xb783[_0x255d5b];return _0x3e141a;};'use strict';var multer=require('multer');var util=require(_0x3b78('0x0'));var path=require(_0x3b78('0x1'));var timeout=require(_0x3b78('0x2'));var express=require(_0x3b78('0x3'));var router=express[_0x3b78('0x4')]();var fs_extra=require(_0x3b78('0x5'));var auth=require(_0x3b78('0x6'));var interaction=require(_0x3b78('0x7'));var config=require(_0x3b78('0x8'));var controller=require(_0x3b78('0x9'));router[_0x3b78('0xa')](_0x3b78('0xb'),auth[_0x3b78('0xc')](),controller[_0x3b78('0xd')]);router['delete'](_0x3b78('0xb'),auth[_0x3b78('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x69bd=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','put','isAuthenticated','update','/:id','destroy','multer'];(function(_0x5b989e,_0x4e28f9){var _0x36f054=function(_0x4a0bd0){while(--_0x4a0bd0){_0x5b989e['push'](_0x5b989e['shift']());}};_0x36f054(++_0x4e28f9);}(_0x69bd,0x144));var _0xd69b=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x69bd[_0x166742];return _0xb7814a;};'use strict';var multer=require(_0xd69b('0x0'));var util=require(_0xd69b('0x1'));var path=require('path');var timeout=require(_0xd69b('0x2'));var express=require('express');var router=express[_0xd69b('0x3')]();var fs_extra=require(_0xd69b('0x4'));var auth=require(_0xd69b('0x5'));var interaction=require(_0xd69b('0x6'));var config=require('../../config/environment');var controller=require(_0xd69b('0x7'));router[_0xd69b('0x8')]('/:id',auth[_0xd69b('0x9')](),controller[_0xd69b('0xa')]);router['delete'](_0xd69b('0xb'),auth[_0xd69b('0x9')](),controller[_0xd69b('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 33fc802..87e72c6 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 _0x7420=['exports','INTEGER','sequelize'];(function(_0x2306de,_0x5b9304){var _0x3143e9=function(_0x4c5c5e){while(--_0x4c5c5e){_0x2306de['push'](_0x2306de['shift']());}};_0x3143e9(++_0x5b9304);}(_0x7420,0x140));var _0x0742=function(_0x455dc3,_0x40ddaf){_0x455dc3=_0x455dc3-0x0;var _0x8180b6=_0x7420[_0x455dc3];return _0x8180b6;};'use strict';var Sequelize=require(_0x0742('0x0'));module[_0x0742('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x0742('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x818e=['exports','name','INTEGER'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x818e,0xff));var _0xe818=function(_0x3f7c8c,_0x5c26a6){_0x3f7c8c=_0x3f7c8c-0x0;var _0x48e4d2=_0x818e[_0x3f7c8c];return _0x48e4d2;};'use strict';var Sequelize=require('sequelize');module[_0xe818('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe818('0x1')},'OrderBy':{'type':Sequelize[_0xe818('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 5d2c7fe..85b33a8 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 _0x8603=['rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','ContactItemType','includeAll','include','findAll','rows','params','find','catch','create','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body'];(function(_0x119517,_0x383d12){var _0x140331=function(_0x48ef2c){while(--_0x48ef2c){_0x119517['push'](_0x119517['shift']());}};_0x140331(++_0x383d12);}(_0x8603,0x190));var _0x3860=function(_0x4a02e9,_0x5d7b67){_0x4a02e9=_0x4a02e9-0x0;var _0x229ed7=_0x8603[_0x4a02e9];return _0x229ed7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3860('0x0'));var zipdir=require(_0x3860('0x1'));var jsonpatch=require(_0x3860('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3860('0x3'));var Mustache=require(_0x3860('0x4'));var util=require(_0x3860('0x5'));var path=require('path');var sox=require(_0x3860('0x6'));var csv=require('to-csv');var ejs=require(_0x3860('0x7'));var fs=require('fs');var fs_extra=require(_0x3860('0x8'));var _=require(_0x3860('0x9'));var squel=require(_0x3860('0xa'));var crypto=require(_0x3860('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3860('0xc'));var Papa=require(_0x3860('0xd'));var Redis=require('ioredis');var authService=require(_0x3860('0xe'));var qs=require(_0x3860('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3860('0x10'));var logger=require(_0x3860('0x11'))('api');var utils=require(_0x3860('0x12'));var config=require(_0x3860('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3860('0x14'))['db'];function respondWithStatusCode(_0x8ad61d,_0x2428f6){_0x2428f6=_0x2428f6||0xcc;return function(_0x1ea619){if(_0x1ea619){return _0x8ad61d[_0x3860('0x15')](_0x2428f6);}return _0x8ad61d[_0x3860('0x16')](_0x2428f6)[_0x3860('0x17')]();};}function respondWithResult(_0x12b23b,_0x465d8d){_0x465d8d=_0x465d8d||0xc8;return function(_0x46264d){if(_0x46264d){return _0x12b23b['status'](_0x465d8d)[_0x3860('0x18')](_0x46264d);}};}function respondWithFilteredResult(_0x21eaf1,_0x122e40){return function(_0x37d9ab){if(_0x37d9ab){var _0x1055b3=typeof _0x122e40[_0x3860('0x19')]===_0x3860('0x1a')&&typeof _0x122e40[_0x3860('0x1b')]===_0x3860('0x1a');var _0x3c0d91=_0x37d9ab[_0x3860('0x1c')];var _0x45b799=_0x1055b3?0x0:_0x122e40['offset'];var _0x4863bd=_0x1055b3?_0x37d9ab[_0x3860('0x1c')]:_0x122e40[_0x3860('0x19')]+_0x122e40[_0x3860('0x1b')];var _0x53fc63;if(_0x4863bd>=_0x3c0d91){_0x4863bd=_0x3c0d91;_0x53fc63=0xc8;}else{_0x53fc63=0xce;}_0x21eaf1[_0x3860('0x16')](_0x53fc63);return _0x21eaf1[_0x3860('0x1d')](_0x3860('0x1e'),_0x45b799+'-'+_0x4863bd+'/'+_0x3c0d91)[_0x3860('0x18')](_0x37d9ab);}return null;};}function patchUpdates(_0x20a5b0){return function(_0x45081f){try{jsonpatch[_0x3860('0x1f')](_0x45081f,_0x20a5b0,!![]);}catch(_0x1f8891){return BPromise[_0x3860('0x20')](_0x1f8891);}return _0x45081f[_0x3860('0x21')]();};}function saveUpdates(_0xacd57f,_0x2e0b6e){return function(_0x280ea9){if(_0x280ea9){return _0x280ea9[_0x3860('0x22')](_0xacd57f)[_0x3860('0x23')](function(_0x564efd){return _0x564efd;});}return null;};}function removeEntity(_0xfc10a5,_0x133093){return function(_0x2b91f2){if(_0x2b91f2){return _0x2b91f2[_0x3860('0x24')]()[_0x3860('0x23')](function(){var _0x56a6d1=_0x2b91f2[_0x3860('0x25')]({'plain':!![]});var _0x568515='ContactItemTypes';return db[_0x3860('0x26')][_0x3860('0x24')]({'where':{'type':_0x568515,'resourceId':_0x56a6d1['id']}})['then'](function(){return _0x2b91f2;});})['then'](function(){_0xfc10a5['status'](0xcc)[_0x3860('0x17')]();});}};}function handleEntityNotFound(_0x3ebc5b,_0xb25cc2){return function(_0x371f3a){if(!_0x371f3a){_0x3ebc5b[_0x3860('0x15')](0x194);}return _0x371f3a;};}function handleError(_0x228d34,_0x544b9a){_0x544b9a=_0x544b9a||0x1f4;return function(_0x4c4314){logger[_0x3860('0x27')](_0x4c4314[_0x3860('0x28')]);if(_0x4c4314['name']){delete _0x4c4314[_0x3860('0x29')];}_0x228d34[_0x3860('0x16')](_0x544b9a)[_0x3860('0x2a')](_0x4c4314);};}exports[_0x3860('0x2b')]=function(_0x3628f7,_0x4bbae9){var _0x36ae2b={},_0xf624ba={},_0x367b14={'count':0x0,'rows':[]};var _0x4bd90c=_[_0x3860('0x2c')](db['ContactItemType'][_0x3860('0x2d')],function(_0x4825f0){return{'name':_0x4825f0[_0x3860('0x2e')],'type':_0x4825f0[_0x3860('0x2f')][_0x3860('0x30')]};});_0xf624ba['model']=_[_0x3860('0x2c')](_0x4bd90c,_0x3860('0x29'));_0xf624ba['query']=_[_0x3860('0x31')](_0x3628f7['query']);_0xf624ba[_0x3860('0x32')]=_[_0x3860('0x33')](_0xf624ba[_0x3860('0x34')],_0xf624ba[_0x3860('0x35')]);_0x36ae2b[_0x3860('0x36')]=_[_0x3860('0x33')](_0xf624ba[_0x3860('0x34')],qs['fields'](_0x3628f7[_0x3860('0x35')][_0x3860('0x37')]));_0x36ae2b['attributes']=_0x36ae2b[_0x3860('0x36')][_0x3860('0x38')]?_0x36ae2b[_0x3860('0x36')]:_0xf624ba['model'];if(!_0x3628f7['query'][_0x3860('0x39')](_0x3860('0x3a'))){_0x36ae2b[_0x3860('0x1b')]=qs[_0x3860('0x1b')](_0x3628f7['query']['limit']);_0x36ae2b[_0x3860('0x19')]=qs[_0x3860('0x19')](_0x3628f7[_0x3860('0x35')][_0x3860('0x19')]);}_0x36ae2b[_0x3860('0x3b')]=qs['sort'](_0x3628f7[_0x3860('0x35')][_0x3860('0x3c')]);_0x36ae2b['where']=qs['filters'](_[_0x3860('0x3d')](_0x3628f7[_0x3860('0x35')],_0xf624ba[_0x3860('0x32')]),_0x4bd90c);if(_0x3628f7[_0x3860('0x35')][_0x3860('0x3e')]){_0x36ae2b['where']=_[_0x3860('0x3f')](_0x36ae2b['where'],{'$or':_[_0x3860('0x2c')](_0x4bd90c,function(_0x35bf7a){if(_0x35bf7a['type']!==_0x3860('0x40')){var _0x162e65={};_0x162e65[_0x35bf7a['name']]={'$like':'%'+_0x3628f7[_0x3860('0x35')][_0x3860('0x3e')]+'%'};return _0x162e65;}})});}_0x36ae2b=_[_0x3860('0x3f')]({},_0x36ae2b,_0x3628f7[_0x3860('0x41')]);var _0x4f486e={'where':_0x36ae2b[_0x3860('0x42')]};return db[_0x3860('0x43')][_0x3860('0x1c')](_0x4f486e)['then'](function(_0x3a87e5){_0x367b14['count']=_0x3a87e5;if(_0x3628f7[_0x3860('0x35')][_0x3860('0x44')]){_0x36ae2b[_0x3860('0x45')]=[{'all':!![]}];}return db[_0x3860('0x43')][_0x3860('0x46')](_0x36ae2b);})[_0x3860('0x23')](function(_0x4e0a44){_0x367b14[_0x3860('0x47')]=_0x4e0a44;return _0x367b14;})[_0x3860('0x23')](respondWithFilteredResult(_0x4bbae9,_0x36ae2b))['catch'](handleError(_0x4bbae9,null));};exports['show']=function(_0x2938d4,_0x5840f7){var _0x4f2f53={'raw':!![],'where':{'id':_0x2938d4[_0x3860('0x48')]['id']}},_0x164a77={};_0x164a77['model']=_[_0x3860('0x31')](db[_0x3860('0x43')][_0x3860('0x2d')]);_0x164a77[_0x3860('0x35')]=_[_0x3860('0x31')](_0x2938d4[_0x3860('0x35')]);_0x164a77[_0x3860('0x32')]=_[_0x3860('0x33')](_0x164a77[_0x3860('0x34')],_0x164a77[_0x3860('0x35')]);_0x4f2f53[_0x3860('0x36')]=_[_0x3860('0x33')](_0x164a77[_0x3860('0x34')],qs['fields'](_0x2938d4[_0x3860('0x35')]['fields']));_0x4f2f53[_0x3860('0x36')]=_0x4f2f53[_0x3860('0x36')][_0x3860('0x38')]?_0x4f2f53[_0x3860('0x36')]:_0x164a77[_0x3860('0x34')];if(_0x2938d4[_0x3860('0x35')][_0x3860('0x44')]){_0x4f2f53[_0x3860('0x45')]=[{'all':!![]}];}_0x4f2f53=_['merge']({},_0x4f2f53,_0x2938d4[_0x3860('0x41')]);return db[_0x3860('0x43')][_0x3860('0x49')](_0x4f2f53)['then'](handleEntityNotFound(_0x5840f7,null))[_0x3860('0x23')](respondWithResult(_0x5840f7,null))[_0x3860('0x4a')](handleError(_0x5840f7,null));};exports[_0x3860('0x4b')]=function(_0x3dc957,_0x5ed2db){return db['ContactItemType'][_0x3860('0x4b')](_0x3dc957['body'],{})[_0x3860('0x23')](function(_0x4226da){var _0x410dab=_0x3dc957['user'][_0x3860('0x25')]({'plain':!![]});if(!_0x410dab)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x410dab[_0x3860('0x4c')]==='user'){var _0xf9edb4=_0x4226da[_0x3860('0x25')]({'plain':!![]});var _0x39b2e0='ContactItemTypes';return db['UserProfileSection'][_0x3860('0x49')]({'where':{'name':_0x39b2e0,'userProfileId':_0x410dab[_0x3860('0x4d')]},'raw':!![]})['then'](function(_0x3910f5){if(_0x3910f5&&_0x3910f5['autoAssociation']===0x0){return db[_0x3860('0x26')][_0x3860('0x4b')]({'name':_0xf9edb4[_0x3860('0x29')],'resourceId':_0xf9edb4['id'],'type':_0x3910f5[_0x3860('0x29')],'sectionId':_0x3910f5['id']},{})[_0x3860('0x23')](function(){return _0x4226da;});}else{return _0x4226da;}})[_0x3860('0x4a')](function(_0x3fad85){logger['error'](_0x3860('0x4e'),_0x3fad85);throw _0x3fad85;});}return _0x4226da;})[_0x3860('0x23')](respondWithResult(_0x5ed2db,0xc9))[_0x3860('0x4a')](handleError(_0x5ed2db,null));};exports[_0x3860('0x22')]=function(_0x279e6f,_0x447163){if(_0x279e6f['body']['id']){delete _0x279e6f[_0x3860('0x4f')]['id'];}return db[_0x3860('0x43')][_0x3860('0x49')]({'where':{'id':_0x279e6f[_0x3860('0x48')]['id']}})[_0x3860('0x23')](handleEntityNotFound(_0x447163,null))[_0x3860('0x23')](saveUpdates(_0x279e6f[_0x3860('0x4f')],null))[_0x3860('0x23')](respondWithResult(_0x447163,null))['catch'](handleError(_0x447163,null));};exports[_0x3860('0x24')]=function(_0x2ff0bf,_0x53a669){return db[_0x3860('0x43')][_0x3860('0x49')]({'where':{'id':_0x2ff0bf[_0x3860('0x48')]['id']}})['then'](handleEntityNotFound(_0x53a669,null))[_0x3860('0x23')](db['CmContactHasItem'][_0x3860('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x2ff0bf[_0x3860('0x48')]['id']}}))[_0x3860('0x23')](removeEntity(_0x53a669,null))[_0x3860('0x4a')](handleError(_0x53a669,null));}; \ No newline at end of file +var _0x065e=['findAll','rows','show','params','keys','rawAttributes','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ContactItemTypes','UserProfileSection','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','CmContactHasItem','eml-format','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','UserProfileResource','error','name','send','index','map','ContactItemType','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include'];(function(_0x405069,_0x14db45){var _0xd7c425=function(_0x18ea5e){while(--_0x18ea5e){_0x405069['push'](_0x405069['shift']());}};_0xd7c425(++_0x14db45);}(_0x065e,0x1a7));var _0xe065=function(_0x2f461d,_0x40029c){_0x2f461d=_0x2f461d-0x0;var _0x3fe90e=_0x065e[_0x2f461d];return _0x3fe90e;};'use strict';var emlformat=require(_0xe065('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe065('0x1'));var moment=require(_0xe065('0x2'));var BPromise=require(_0xe065('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe065('0x4'));var sox=require(_0xe065('0x5'));var csv=require('to-csv');var ejs=require(_0xe065('0x6'));var fs=require('fs');var fs_extra=require(_0xe065('0x7'));var _=require(_0xe065('0x8'));var squel=require('squel');var crypto=require(_0xe065('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe065('0xa'));var toCsv=require(_0xe065('0xb'));var querystring=require(_0xe065('0xc'));var Papa=require(_0xe065('0xd'));var Redis=require(_0xe065('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe065('0xf'));var as=require(_0xe065('0x10'));var hardwareService=require(_0xe065('0x11'));var logger=require(_0xe065('0x12'))(_0xe065('0x13'));var utils=require(_0xe065('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe065('0x15'))['db'];function respondWithStatusCode(_0x13b697,_0xf5ab44){_0xf5ab44=_0xf5ab44||0xcc;return function(_0x5bd30f){if(_0x5bd30f){return _0x13b697[_0xe065('0x16')](_0xf5ab44);}return _0x13b697[_0xe065('0x17')](_0xf5ab44)[_0xe065('0x18')]();};}function respondWithResult(_0x2e9480,_0x29297b){_0x29297b=_0x29297b||0xc8;return function(_0x541985){if(_0x541985){return _0x2e9480[_0xe065('0x17')](_0x29297b)[_0xe065('0x19')](_0x541985);}};}function respondWithFilteredResult(_0x15d365,_0xc5ef4f){return function(_0x434e07){if(_0x434e07){var _0x352206=typeof _0xc5ef4f[_0xe065('0x1a')]==='undefined'&&typeof _0xc5ef4f[_0xe065('0x1b')]===_0xe065('0x1c');var _0x54d260=_0x434e07[_0xe065('0x1d')];var _0x1d2f7a=_0x352206?0x0:_0xc5ef4f[_0xe065('0x1a')];var _0x14c97c=_0x352206?_0x434e07[_0xe065('0x1d')]:_0xc5ef4f[_0xe065('0x1a')]+_0xc5ef4f[_0xe065('0x1b')];var _0x5000e1;if(_0x14c97c>=_0x54d260){_0x14c97c=_0x54d260;_0x5000e1=0xc8;}else{_0x5000e1=0xce;}_0x15d365[_0xe065('0x17')](_0x5000e1);return _0x15d365['set'](_0xe065('0x1e'),_0x1d2f7a+'-'+_0x14c97c+'/'+_0x54d260)[_0xe065('0x19')](_0x434e07);}return null;};}function patchUpdates(_0x55f55c){return function(_0x1c6567){try{jsonpatch['apply'](_0x1c6567,_0x55f55c,!![]);}catch(_0xe26e9b){return BPromise[_0xe065('0x1f')](_0xe26e9b);}return _0x1c6567[_0xe065('0x20')]();};}function saveUpdates(_0x110556,_0x3ecd13){return function(_0x105cb2){if(_0x105cb2){return _0x105cb2[_0xe065('0x21')](_0x110556)[_0xe065('0x22')](function(_0x1c5dd9){return _0x1c5dd9;});}return null;};}function removeEntity(_0x5081a3,_0x7208af){return function(_0x43b712){if(_0x43b712){return _0x43b712[_0xe065('0x23')]()[_0xe065('0x22')](function(){var _0x5e8b60=_0x43b712['get']({'plain':!![]});var _0x164965='ContactItemTypes';return db[_0xe065('0x24')][_0xe065('0x23')]({'where':{'type':_0x164965,'resourceId':_0x5e8b60['id']}})[_0xe065('0x22')](function(){return _0x43b712;});})[_0xe065('0x22')](function(){_0x5081a3[_0xe065('0x17')](0xcc)[_0xe065('0x18')]();});}};}function handleEntityNotFound(_0x3b1caf,_0x26a159){return function(_0x52cd9c){if(!_0x52cd9c){_0x3b1caf['sendStatus'](0x194);}return _0x52cd9c;};}function handleError(_0x14de01,_0x10e6ba){_0x10e6ba=_0x10e6ba||0x1f4;return function(_0x23aee9){logger[_0xe065('0x25')](_0x23aee9['stack']);if(_0x23aee9[_0xe065('0x26')]){delete _0x23aee9['name'];}_0x14de01['status'](_0x10e6ba)[_0xe065('0x27')](_0x23aee9);};}exports[_0xe065('0x28')]=function(_0x2aa766,_0x5b8523){var _0x883747={},_0x59b915={},_0x12679d={'count':0x0,'rows':[]};var _0x46db7e=_[_0xe065('0x29')](db[_0xe065('0x2a')]['rawAttributes'],function(_0x3f02b2){return{'name':_0x3f02b2['fieldName'],'type':_0x3f02b2[_0xe065('0x2b')][_0xe065('0x2c')]};});_0x59b915['model']=_[_0xe065('0x29')](_0x46db7e,'name');_0x59b915[_0xe065('0x2d')]=_['keys'](_0x2aa766[_0xe065('0x2d')]);_0x59b915[_0xe065('0x2e')]=_[_0xe065('0x2f')](_0x59b915[_0xe065('0x30')],_0x59b915['query']);_0x883747[_0xe065('0x31')]=_[_0xe065('0x2f')](_0x59b915[_0xe065('0x30')],qs[_0xe065('0x32')](_0x2aa766[_0xe065('0x2d')][_0xe065('0x32')]));_0x883747['attributes']=_0x883747[_0xe065('0x31')][_0xe065('0x33')]?_0x883747['attributes']:_0x59b915[_0xe065('0x30')];if(!_0x2aa766[_0xe065('0x2d')][_0xe065('0x34')](_0xe065('0x35'))){_0x883747[_0xe065('0x1b')]=qs[_0xe065('0x1b')](_0x2aa766[_0xe065('0x2d')]['limit']);_0x883747[_0xe065('0x1a')]=qs['offset'](_0x2aa766[_0xe065('0x2d')][_0xe065('0x1a')]);}_0x883747[_0xe065('0x36')]=qs[_0xe065('0x37')](_0x2aa766[_0xe065('0x2d')][_0xe065('0x37')]);_0x883747['where']=qs[_0xe065('0x2e')](_[_0xe065('0x38')](_0x2aa766[_0xe065('0x2d')],_0x59b915['filters']),_0x46db7e);if(_0x2aa766[_0xe065('0x2d')][_0xe065('0x39')]){_0x883747[_0xe065('0x3a')]=_[_0xe065('0x3b')](_0x883747[_0xe065('0x3a')],{'$or':_['map'](_0x46db7e,function(_0x341740){if(_0x341740[_0xe065('0x2b')]!=='VIRTUAL'){var _0x236e75={};_0x236e75[_0x341740['name']]={'$like':'%'+_0x2aa766[_0xe065('0x2d')][_0xe065('0x39')]+'%'};return _0x236e75;}})});}_0x883747=_['merge']({},_0x883747,_0x2aa766[_0xe065('0x3c')]);var _0x20c881={'where':_0x883747['where']};return db[_0xe065('0x2a')][_0xe065('0x1d')](_0x20c881)[_0xe065('0x22')](function(_0x44a3f6){_0x12679d[_0xe065('0x1d')]=_0x44a3f6;if(_0x2aa766[_0xe065('0x2d')][_0xe065('0x3d')]){_0x883747[_0xe065('0x3e')]=[{'all':!![]}];}return db[_0xe065('0x2a')][_0xe065('0x3f')](_0x883747);})[_0xe065('0x22')](function(_0x4364c3){_0x12679d[_0xe065('0x40')]=_0x4364c3;return _0x12679d;})['then'](respondWithFilteredResult(_0x5b8523,_0x883747))['catch'](handleError(_0x5b8523,null));};exports[_0xe065('0x41')]=function(_0x2bf092,_0x5ee4ec){var _0x3ba838={'raw':!![],'where':{'id':_0x2bf092[_0xe065('0x42')]['id']}},_0x448044={};_0x448044[_0xe065('0x30')]=_[_0xe065('0x43')](db[_0xe065('0x2a')][_0xe065('0x44')]);_0x448044[_0xe065('0x2d')]=_[_0xe065('0x43')](_0x2bf092['query']);_0x448044[_0xe065('0x2e')]=_[_0xe065('0x2f')](_0x448044[_0xe065('0x30')],_0x448044['query']);_0x3ba838[_0xe065('0x31')]=_[_0xe065('0x2f')](_0x448044[_0xe065('0x30')],qs[_0xe065('0x32')](_0x2bf092['query'][_0xe065('0x32')]));_0x3ba838[_0xe065('0x31')]=_0x3ba838[_0xe065('0x31')][_0xe065('0x33')]?_0x3ba838[_0xe065('0x31')]:_0x448044[_0xe065('0x30')];if(_0x2bf092[_0xe065('0x2d')]['includeAll']){_0x3ba838[_0xe065('0x3e')]=[{'all':!![]}];}_0x3ba838=_[_0xe065('0x3b')]({},_0x3ba838,_0x2bf092[_0xe065('0x3c')]);return db[_0xe065('0x2a')][_0xe065('0x45')](_0x3ba838)[_0xe065('0x22')](handleEntityNotFound(_0x5ee4ec,null))[_0xe065('0x22')](respondWithResult(_0x5ee4ec,null))['catch'](handleError(_0x5ee4ec,null));};exports[_0xe065('0x46')]=function(_0x5a2360,_0x45fe1f){return db[_0xe065('0x2a')][_0xe065('0x46')](_0x5a2360['body'],{})[_0xe065('0x22')](function(_0x16898c){var _0x3ab70d=_0x5a2360[_0xe065('0x47')][_0xe065('0x48')]({'plain':!![]});if(!_0x3ab70d)throw new Error(_0xe065('0x49'));if(_0x3ab70d[_0xe065('0x4a')]===_0xe065('0x47')){var _0x3095c8=_0x16898c[_0xe065('0x48')]({'plain':!![]});var _0x3f91a2=_0xe065('0x4b');return db[_0xe065('0x4c')]['find']({'where':{'name':_0x3f91a2,'userProfileId':_0x3ab70d['userProfileId']},'raw':!![]})['then'](function(_0x23ba0b){if(_0x23ba0b&&_0x23ba0b['autoAssociation']===0x0){return db[_0xe065('0x24')][_0xe065('0x46')]({'name':_0x3095c8[_0xe065('0x26')],'resourceId':_0x3095c8['id'],'type':_0x23ba0b['name'],'sectionId':_0x23ba0b['id']},{})[_0xe065('0x22')](function(){return _0x16898c;});}else{return _0x16898c;}})[_0xe065('0x4d')](function(_0x5cce78){logger[_0xe065('0x25')](_0xe065('0x4e'),_0x5cce78);throw _0x5cce78;});}return _0x16898c;})[_0xe065('0x22')](respondWithResult(_0x45fe1f,0xc9))[_0xe065('0x4d')](handleError(_0x45fe1f,null));};exports[_0xe065('0x21')]=function(_0x1ea568,_0xe77af6){if(_0x1ea568[_0xe065('0x4f')]['id']){delete _0x1ea568[_0xe065('0x4f')]['id'];}return db[_0xe065('0x2a')]['find']({'where':{'id':_0x1ea568[_0xe065('0x42')]['id']}})[_0xe065('0x22')](handleEntityNotFound(_0xe77af6,null))[_0xe065('0x22')](saveUpdates(_0x1ea568[_0xe065('0x4f')],null))['then'](respondWithResult(_0xe77af6,null))[_0xe065('0x4d')](handleError(_0xe77af6,null));};exports[_0xe065('0x23')]=function(_0x21884d,_0xb1fca1){return db['ContactItemType'][_0xe065('0x45')]({'where':{'id':_0x21884d[_0xe065('0x42')]['id']}})[_0xe065('0x22')](handleEntityNotFound(_0xb1fca1,null))['then'](db[_0xe065('0x50')][_0xe065('0x21')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x21884d[_0xe065('0x42')]['id']}}))[_0xe065('0x22')](removeEntity(_0xb1fca1,null))[_0xe065('0x4d')](handleError(_0xb1fca1,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index c3b8c9a..826d6c8 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 _0x4e54=['define','ContactItemType','tools_contact_item_types','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x4e54,0x65));var _0x44e5=function(_0x132d12,_0x2c9799){_0x132d12=_0x132d12-0x0;var _0x1c3163=_0x4e54[_0x132d12];return _0x1c3163;};'use strict';var _=require('lodash');var util=require(_0x44e5('0x0'));var logger=require(_0x44e5('0x1'))(_0x44e5('0x2'));var moment=require(_0x44e5('0x3'));var BPromise=require(_0x44e5('0x4'));var rp=require(_0x44e5('0x5'));var fs=require('fs');var path=require(_0x44e5('0x6'));var rimraf=require(_0x44e5('0x7'));var config=require(_0x44e5('0x8'));var attributes=require(_0x44e5('0x9'));module[_0x44e5('0xa')]=function(_0x5d8637,_0x37fd95){return _0x5d8637[_0x44e5('0xb')](_0x44e5('0xc'),attributes,{'tableName':_0x44e5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde6f=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash'];(function(_0x5a517d,_0x54b788){var _0x3fe234=function(_0x2afc2f){while(--_0x2afc2f){_0x5a517d['push'](_0x5a517d['shift']());}};_0x3fe234(++_0x54b788);}(_0xde6f,0xdf));var _0xfde6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xde6f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xfde6('0x0'));var util=require('util');var logger=require(_0xfde6('0x1'))(_0xfde6('0x2'));var moment=require(_0xfde6('0x3'));var BPromise=require(_0xfde6('0x4'));var rp=require(_0xfde6('0x5'));var fs=require('fs');var path=require(_0xfde6('0x6'));var rimraf=require(_0xfde6('0x7'));var config=require(_0xfde6('0x8'));var attributes=require(_0xfde6('0x9'));module[_0xfde6('0xa')]=function(_0x40b57f,_0x285e19){return _0x40b57f[_0xfde6('0xb')](_0xfde6('0xc'),attributes,{'tableName':_0xfde6('0xd'),'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 8560b0e..89bf2ec 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 _0x8319=['jayson/promise','http','request','ContactItemType,\x20%s,\x20%s','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x4042c8,_0x516c2a){var _0x245c4e=function(_0x2a0474){while(--_0x2a0474){_0x4042c8['push'](_0x4042c8['shift']());}};_0x245c4e(++_0x516c2a);}(_0x8319,0xac));var _0x9831=function(_0x19e821,_0x4d2578){_0x19e821=_0x19e821-0x0;var _0x5cbd74=_0x8319[_0x19e821];return _0x5cbd74;};'use strict';var _=require(_0x9831('0x0'));var util=require(_0x9831('0x1'));var moment=require('moment');var BPromise=require(_0x9831('0x2'));var rs=require(_0x9831('0x3'));var fs=require('fs');var Redis=require(_0x9831('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9831('0x5'))(_0x9831('0x6'));var config=require(_0x9831('0x7'));var jayson=require(_0x9831('0x8'));var client=jayson['client'][_0x9831('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f42f4,_0x428885,_0x4844ba){return new BPromise(function(_0x1e9d59,_0x72efd9){return client[_0x9831('0xa')](_0x3f42f4,_0x4844ba)['then'](function(_0x555f22){logger['info'](_0x9831('0xb'),_0x428885,'request\x20sent');logger['debug'](_0x9831('0xc'),_0x428885,'request\x20sent',JSON[_0x9831('0xd')](_0x555f22));if(_0x555f22[_0x9831('0xe')]){if(_0x555f22[_0x9831('0xe')][_0x9831('0xf')]===0x1f4){logger[_0x9831('0xe')](_0x9831('0xb'),_0x428885,_0x555f22[_0x9831('0xe')][_0x9831('0x10')]);return _0x72efd9(_0x555f22[_0x9831('0xe')][_0x9831('0x10')]);}logger[_0x9831('0xe')](_0x9831('0xb'),_0x428885,_0x555f22[_0x9831('0xe')][_0x9831('0x10')]);return _0x1e9d59(_0x555f22['error'][_0x9831('0x10')]);}else{logger[_0x9831('0x11')]('ContactItemType,\x20%s,\x20%s',_0x428885,_0x9831('0x12'));_0x1e9d59(_0x555f22['result'][_0x9831('0x10')]);}})[_0x9831('0x13')](function(_0x525c56){logger[_0x9831('0xe')]('ContactItemType,\x20%s,\x20%s',_0x428885,_0x525c56);_0x72efd9(_0x525c56);});});} \ No newline at end of file +var _0x1d5d=['info','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client'];(function(_0x36bb96,_0x5ec14a){var _0x287f17=function(_0x142f2b){while(--_0x142f2b){_0x36bb96['push'](_0x36bb96['shift']());}};_0x287f17(++_0x5ec14a);}(_0x1d5d,0x7f));var _0xd1d5=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x1d5d[_0x2f3848];return _0x102668;};'use strict';var _=require(_0xd1d5('0x0'));var util=require(_0xd1d5('0x1'));var moment=require(_0xd1d5('0x2'));var BPromise=require('bluebird');var rs=require(_0xd1d5('0x3'));var fs=require('fs');var Redis=require(_0xd1d5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd1d5('0x5'));var logger=require('../../config/logger')(_0xd1d5('0x6'));var config=require('../../config/environment');var jayson=require(_0xd1d5('0x7'));var client=jayson[_0xd1d5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34dd34,_0x506ff9,_0x3d7907){return new BPromise(function(_0x24613e,_0x85e98c){return client['request'](_0x34dd34,_0x3d7907)['then'](function(_0x1e5038){logger[_0xd1d5('0x9')](_0xd1d5('0xa'),_0x506ff9,_0xd1d5('0xb'));logger['debug'](_0xd1d5('0xc'),_0x506ff9,'request\x20sent',JSON[_0xd1d5('0xd')](_0x1e5038));if(_0x1e5038[_0xd1d5('0xe')]){if(_0x1e5038[_0xd1d5('0xe')][_0xd1d5('0xf')]===0x1f4){logger[_0xd1d5('0xe')](_0xd1d5('0xa'),_0x506ff9,_0x1e5038['error']['message']);return _0x85e98c(_0x1e5038[_0xd1d5('0xe')][_0xd1d5('0x10')]);}logger[_0xd1d5('0xe')](_0xd1d5('0xa'),_0x506ff9,_0x1e5038['error'][_0xd1d5('0x10')]);return _0x24613e(_0x1e5038['error'][_0xd1d5('0x10')]);}else{logger[_0xd1d5('0x9')]('ContactItemType,\x20%s,\x20%s',_0x506ff9,_0xd1d5('0xb'));_0x24613e(_0x1e5038['result'][_0xd1d5('0x10')]);}})['catch'](function(_0x2b2397){logger['error'](_0xd1d5('0xa'),_0x506ff9,_0x2b2397);_0x85e98c(_0x2b2397);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 40a5edb..4166e4a 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 _0xd954=['../../components/interaction/service','../../config/environment','./contactItemType.controller','get','index','/:id','show','post','create','put','isAuthenticated','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x30b4e1,_0x4fb045){var _0x50dcdc=function(_0x2c6384){while(--_0x2c6384){_0x30b4e1['push'](_0x30b4e1['shift']());}};_0x50dcdc(++_0x4fb045);}(_0xd954,0x15e));var _0x4d95=function(_0x31991b,_0xaf75d2){_0x31991b=_0x31991b-0x0;var _0x307304=_0xd954[_0x31991b];return _0x307304;};'use strict';var multer=require(_0x4d95('0x0'));var util=require(_0x4d95('0x1'));var path=require(_0x4d95('0x2'));var timeout=require(_0x4d95('0x3'));var express=require(_0x4d95('0x4'));var router=express[_0x4d95('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4d95('0x6'));var interaction=require(_0x4d95('0x7'));var config=require(_0x4d95('0x8'));var controller=require(_0x4d95('0x9'));router[_0x4d95('0xa')]('/',auth['isAuthenticated'](),controller[_0x4d95('0xb')]);router[_0x4d95('0xa')](_0x4d95('0xc'),auth['isAuthenticated'](),controller[_0x4d95('0xd')]);router[_0x4d95('0xe')]('/',auth['isAuthenticated'](),controller[_0x4d95('0xf')]);router[_0x4d95('0x10')](_0x4d95('0xc'),auth[_0x4d95('0x11')](),controller[_0x4d95('0x12')]);router[_0x4d95('0x13')]('/:id',auth[_0x4d95('0x11')](),controller['destroy']);module[_0x4d95('0x14')]=router; \ No newline at end of file +var _0x3a51=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete','multer','connect-timeout','express'];(function(_0x45ea78,_0x31678e){var _0xd722b7=function(_0x25710a){while(--_0x25710a){_0x45ea78['push'](_0x45ea78['shift']());}};_0xd722b7(++_0x31678e);}(_0x3a51,0x69));var _0x13a5=function(_0x1fe58d,_0x327378){_0x1fe58d=_0x1fe58d-0x0;var _0x5119b8=_0x3a51[_0x1fe58d];return _0x5119b8;};'use strict';var multer=require(_0x13a5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x13a5('0x1'));var express=require(_0x13a5('0x2'));var router=express[_0x13a5('0x3')]();var fs_extra=require(_0x13a5('0x4'));var auth=require(_0x13a5('0x5'));var interaction=require(_0x13a5('0x6'));var config=require(_0x13a5('0x7'));var controller=require(_0x13a5('0x8'));router['get']('/',auth[_0x13a5('0x9')](),controller['index']);router[_0x13a5('0xa')](_0x13a5('0xb'),auth['isAuthenticated'](),controller[_0x13a5('0xc')]);router[_0x13a5('0xd')]('/',auth[_0x13a5('0x9')](),controller[_0x13a5('0xe')]);router[_0x13a5('0xf')](_0x13a5('0xb'),auth['isAuthenticated'](),controller[_0x13a5('0x10')]);router[_0x13a5('0x11')](_0x13a5('0xb'),auth[_0x13a5('0x9')](),controller['destroy']);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 2d672b8..5d24328 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 _0xd8b0=['exports','sequelize'];(function(_0x55b7c2,_0x171b87){var _0x362883=function(_0xbc61ea){while(--_0xbc61ea){_0x55b7c2['push'](_0x55b7c2['shift']());}};_0x362883(++_0x171b87);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x202126,_0x3aff7c){var _0x3327e7=function(_0x580a3c){while(--_0x580a3c){_0x202126['push'](_0x202126['shift']());}};_0x3327e7(++_0x3aff7c);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'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 84b1dce..a6c7d12 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 _0x0675=['widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','options','getItems','hasOwnProperty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','get','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','includeAll','include','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','omit','createdAt','body','updatedAt','UserProfileSection','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','web-report','reportType','attrReport','attrRefresh'];(function(_0x3fbb62,_0x1c30b4){var _0x1e2f61=function(_0x2ab8fc){while(--_0x2ab8fc){_0x3fbb62['push'](_0x3fbb62['shift']());}};_0x1e2f61(++_0x1c30b4);}(_0x0675,0x109));var _0x5067=function(_0x2e0602,_0x3c396d){_0x2e0602=_0x2e0602-0x0;var _0x224585=_0x0675[_0x2e0602];return _0x224585;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5067('0x0'));var zipdir=require(_0x5067('0x1'));var jsonpatch=require(_0x5067('0x2'));var rp=require(_0x5067('0x3'));var moment=require(_0x5067('0x4'));var BPromise=require(_0x5067('0x5'));var Mustache=require(_0x5067('0x6'));var util=require(_0x5067('0x7'));var path=require(_0x5067('0x8'));var sox=require(_0x5067('0x9'));var csv=require('to-csv');var ejs=require(_0x5067('0xa'));var fs=require('fs');var fs_extra=require(_0x5067('0xb'));var _=require(_0x5067('0xc'));var squel=require('squel');var crypto=require(_0x5067('0xd'));var jsforce=require(_0x5067('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5067('0xf'));var Papa=require('papaparse');var Redis=require(_0x5067('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5067('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5067('0x12'));var logger=require(_0x5067('0x13'))(_0x5067('0x14'));var utils=require(_0x5067('0x15'));var config=require(_0x5067('0x16'));var licenseUtil=require(_0x5067('0x17'));var db=require(_0x5067('0x18'))['db'];config[_0x5067('0x19')]=_[_0x5067('0x1a')](config[_0x5067('0x19')],{'host':_0x5067('0x1b'),'port':0x18eb});var socket=require(_0x5067('0x1c'))(new Redis(config['redis']));require('./dashboard.socket')[_0x5067('0x1d')](socket);function respondWithStatusCode(_0x2f5a6e,_0x2a5e5c){_0x2a5e5c=_0x2a5e5c||0xcc;return function(_0x38566e){if(_0x38566e){return _0x2f5a6e[_0x5067('0x1e')](_0x2a5e5c);}return _0x2f5a6e[_0x5067('0x1f')](_0x2a5e5c)[_0x5067('0x20')]();};}function respondWithResult(_0x468945,_0x5ab32e){_0x5ab32e=_0x5ab32e||0xc8;return function(_0x2c79ce){if(_0x2c79ce){return _0x468945[_0x5067('0x1f')](_0x5ab32e)[_0x5067('0x21')](_0x2c79ce);}};}function respondWithFilteredResult(_0x1bc232,_0x5d9a04){return function(_0x1de30b){if(_0x1de30b){var _0x4a8784=typeof _0x5d9a04['offset']===_0x5067('0x22')&&typeof _0x5d9a04[_0x5067('0x23')]==='undefined';var _0x27fbdc=_0x1de30b[_0x5067('0x24')];var _0x4ba77c=_0x4a8784?0x0:_0x5d9a04[_0x5067('0x25')];var _0xa96a2c=_0x4a8784?_0x1de30b[_0x5067('0x24')]:_0x5d9a04[_0x5067('0x25')]+_0x5d9a04[_0x5067('0x23')];var _0x50b4f4;if(_0xa96a2c>=_0x27fbdc){_0xa96a2c=_0x27fbdc;_0x50b4f4=0xc8;}else{_0x50b4f4=0xce;}_0x1bc232[_0x5067('0x1f')](_0x50b4f4);return _0x1bc232['set'](_0x5067('0x26'),_0x4ba77c+'-'+_0xa96a2c+'/'+_0x27fbdc)[_0x5067('0x21')](_0x1de30b);}return null;};}function patchUpdates(_0x5ccc4a){return function(_0x3f92df){try{jsonpatch[_0x5067('0x27')](_0x3f92df,_0x5ccc4a,!![]);}catch(_0x831109){return BPromise[_0x5067('0x28')](_0x831109);}return _0x3f92df['save']();};}function saveUpdates(_0x4bce81,_0x972954){return function(_0x532cc7){if(_0x532cc7){return _0x532cc7[_0x5067('0x29')](_0x4bce81)[_0x5067('0x2a')](function(_0x24c74a){return _0x24c74a;});}return null;};}function removeEntity(_0x126784,_0x37fdf9){return function(_0x32b409){if(_0x32b409){return _0x32b409[_0x5067('0x2b')]()['then'](function(){var _0x1d2157=_0x32b409[_0x5067('0x2c')]({'plain':!![]});var _0x4f01bf='CustomDashboards';return db['UserProfileResource'][_0x5067('0x2b')]({'where':{'type':_0x4f01bf,'resourceId':_0x1d2157['id']}})[_0x5067('0x2a')](function(){return _0x32b409;});})[_0x5067('0x2a')](function(){_0x126784[_0x5067('0x1f')](0xcc)[_0x5067('0x20')]();});}};}function handleEntityNotFound(_0x509a9b,_0xc64b76){return function(_0x8ab78){if(!_0x8ab78){_0x509a9b['sendStatus'](0x194);}return _0x8ab78;};}function handleError(_0x1e47ed,_0x199a2a){_0x199a2a=_0x199a2a||0x1f4;return function(_0x327ed6){logger[_0x5067('0x2d')](_0x327ed6[_0x5067('0x2e')]);if(_0x327ed6[_0x5067('0x2f')]){delete _0x327ed6[_0x5067('0x2f')];}_0x1e47ed[_0x5067('0x1f')](_0x199a2a)[_0x5067('0x30')](_0x327ed6);};}exports[_0x5067('0x31')]=function(_0x5ed5c5,_0x3c7687){var _0x481d09={},_0x52caf8={},_0x5033ca={'count':0x0,'rows':[]};var _0x39ba4c=_[_0x5067('0x32')](db[_0x5067('0x33')][_0x5067('0x34')],function(_0x4e0b9b){return{'name':_0x4e0b9b[_0x5067('0x35')],'type':_0x4e0b9b[_0x5067('0x36')][_0x5067('0x37')]};});_0x52caf8[_0x5067('0x38')]=_['map'](_0x39ba4c,'name');_0x52caf8['query']=_[_0x5067('0x39')](_0x5ed5c5['query']);_0x52caf8[_0x5067('0x3a')]=_[_0x5067('0x3b')](_0x52caf8[_0x5067('0x38')],_0x52caf8[_0x5067('0x3c')]);_0x481d09[_0x5067('0x3d')]=_[_0x5067('0x3b')](_0x52caf8[_0x5067('0x38')],qs[_0x5067('0x3e')](_0x5ed5c5[_0x5067('0x3c')][_0x5067('0x3e')]));_0x481d09[_0x5067('0x3d')]=_0x481d09[_0x5067('0x3d')][_0x5067('0x3f')]?_0x481d09[_0x5067('0x3d')]:_0x52caf8[_0x5067('0x38')];if(!_0x5ed5c5[_0x5067('0x3c')]['hasOwnProperty'](_0x5067('0x40'))){_0x481d09[_0x5067('0x23')]=qs[_0x5067('0x23')](_0x5ed5c5[_0x5067('0x3c')][_0x5067('0x23')]);_0x481d09[_0x5067('0x25')]=qs['offset'](_0x5ed5c5[_0x5067('0x3c')]['offset']);}_0x481d09[_0x5067('0x41')]=qs['sort'](_0x5ed5c5[_0x5067('0x3c')][_0x5067('0x42')]);_0x481d09['where']=qs[_0x5067('0x3a')](_[_0x5067('0x43')](_0x5ed5c5['query'],_0x52caf8['filters']),_0x39ba4c);if(_0x5ed5c5[_0x5067('0x3c')][_0x5067('0x44')]){_0x481d09[_0x5067('0x45')]=_['merge'](_0x481d09['where'],{'$or':_[_0x5067('0x32')](_0x39ba4c,function(_0x205624){if(_0x205624[_0x5067('0x36')]!=='VIRTUAL'){var _0x322fc7={};_0x322fc7[_0x205624[_0x5067('0x2f')]]={'$like':'%'+_0x5ed5c5['query']['filter']+'%'};return _0x322fc7;}})});}_0x481d09=_[_0x5067('0x46')]({},_0x481d09,_0x5ed5c5['options']);var _0x2b2aad={'where':_0x481d09[_0x5067('0x45')]};return db[_0x5067('0x33')][_0x5067('0x24')](_0x2b2aad)[_0x5067('0x2a')](function(_0x4e771c){_0x5033ca[_0x5067('0x24')]=_0x4e771c;if(_0x5ed5c5[_0x5067('0x3c')][_0x5067('0x47')]){_0x481d09[_0x5067('0x48')]=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x481d09);})[_0x5067('0x2a')](function(_0x2905d0){_0x5033ca['rows']=_0x2905d0;return _0x5033ca;})[_0x5067('0x2a')](respondWithFilteredResult(_0x3c7687,_0x481d09))[_0x5067('0x49')](handleError(_0x3c7687,null));};exports[_0x5067('0x4a')]=function(_0x5e3461,_0x16401d){var _0x1cc1c3={'raw':![],'where':{'id':_0x5e3461['params']['id']}},_0x3c342e={};_0x3c342e[_0x5067('0x38')]=_[_0x5067('0x39')](db[_0x5067('0x33')]['rawAttributes']);_0x3c342e[_0x5067('0x3c')]=_[_0x5067('0x39')](_0x5e3461[_0x5067('0x3c')]);_0x3c342e[_0x5067('0x3a')]=_['intersection'](_0x3c342e[_0x5067('0x38')],_0x3c342e[_0x5067('0x3c')]);_0x1cc1c3[_0x5067('0x3d')]=_[_0x5067('0x3b')](_0x3c342e[_0x5067('0x38')],qs['fields'](_0x5e3461['query'][_0x5067('0x3e')]));_0x1cc1c3[_0x5067('0x3d')]=_0x1cc1c3[_0x5067('0x3d')][_0x5067('0x3f')]?_0x1cc1c3[_0x5067('0x3d')]:_0x3c342e[_0x5067('0x38')];if(_0x5e3461[_0x5067('0x3c')][_0x5067('0x47')]){_0x1cc1c3[_0x5067('0x48')]=[{'all':!![]}];}_0x1cc1c3=_['merge']({},_0x1cc1c3,_0x5e3461['options']);return db['Dashboard'][_0x5067('0x4b')](_0x1cc1c3)[_0x5067('0x2a')](handleEntityNotFound(_0x16401d,null))[_0x5067('0x2a')](respondWithResult(_0x16401d,null))[_0x5067('0x49')](handleError(_0x16401d,null));};exports[_0x5067('0x4c')]=function(_0x7f2374,_0x58ff7b){return db[_0x5067('0x33')][_0x5067('0x4c')](_0x7f2374['body'],{})[_0x5067('0x2a')](function(_0x2203b4){var _0x1bde1e=_0x7f2374[_0x5067('0x4d')][_0x5067('0x2c')]({'plain':!![]});if(!_0x1bde1e)throw new Error(_0x5067('0x4e'));if(_0x1bde1e[_0x5067('0x4f')]===_0x5067('0x4d')){var _0x37cd90=_0x2203b4[_0x5067('0x2c')]({'plain':!![]});var _0x44c712=_0x5067('0x50');return db['UserProfileSection'][_0x5067('0x4b')]({'where':{'name':_0x44c712,'userProfileId':_0x1bde1e[_0x5067('0x51')]},'raw':!![]})[_0x5067('0x2a')](function(_0x361b04){if(_0x361b04&&_0x361b04[_0x5067('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x37cd90[_0x5067('0x2f')],'resourceId':_0x37cd90['id'],'type':_0x361b04[_0x5067('0x2f')],'sectionId':_0x361b04['id']},{})[_0x5067('0x2a')](function(){return _0x2203b4;});}else{return _0x2203b4;}})['catch'](function(_0x351d81){logger['error'](_0x5067('0x53'),_0x351d81);throw _0x351d81;});}return _0x2203b4;})[_0x5067('0x2a')](respondWithResult(_0x58ff7b,0xc9))[_0x5067('0x49')](handleError(_0x58ff7b,null));};exports['clone']=function(_0x3b52ce,_0x10c7b5){var _0x555493={'where':{'id':_0x3b52ce[_0x5067('0x54')]['id']}},_0x2adc08={};_0x2adc08[_0x5067('0x38')]=_['keys'](db[_0x5067('0x33')][_0x5067('0x34')]);_0x555493[_0x5067('0x3d')]=_['intersection'](_0x2adc08[_0x5067('0x38')],qs[_0x5067('0x3e')](_0x3b52ce[_0x5067('0x3c')][_0x5067('0x3e')]));_0x555493[_0x5067('0x3d')]=_0x555493['attributes']['length']?_0x555493['attributes']:_0x2adc08[_0x5067('0x38')];if(_0x3b52ce[_0x5067('0x3c')]['includeAll']){_0x555493[_0x5067('0x48')]=[{'all':!![]}];}_0x555493=_[_0x5067('0x46')]({},_0x555493,_0x3b52ce['options']);return db['Dashboard']['find'](_0x555493)['then'](handleEntityNotFound(_0x10c7b5,null))[_0x5067('0x2a')](function(_0x428425){if(_0x428425){var _0x417f55=_0x428425[_0x5067('0x2c')]({'plain':!![]});_0x417f55=qs[_0x5067('0x55')](_0x417f55,['id',_0x5067('0x56'),'updatedAt']);_0x3b52ce[_0x5067('0x57')]=_[_0x5067('0x55')](_0x3b52ce[_0x5067('0x57')],['id',_0x5067('0x56'),_0x5067('0x58')]);return db[_0x5067('0x33')][_0x5067('0x4c')](_[_0x5067('0x46')](_0x417f55,_0x3b52ce[_0x5067('0x57')]),{'include':_0x3b52ce['query'][_0x5067('0x47')]?[{'all':!![]}]:undefined})[_0x5067('0x2a')](function(_0x67f443){var _0x327b65=_0x3b52ce[_0x5067('0x4d')][_0x5067('0x2c')]({'plain':!![]});if(!_0x327b65)throw new Error(_0x5067('0x4e'));if(_0x327b65[_0x5067('0x4f')]===_0x5067('0x4d')){var _0x38a74c=_0x67f443['get']({'plain':!![]});var _0x1ebacd=_0x5067('0x50');return db[_0x5067('0x59')]['find']({'where':{'name':_0x1ebacd,'userProfileId':_0x327b65[_0x5067('0x51')]},'raw':!![]})[_0x5067('0x2a')](function(_0x3f276f){if(_0x3f276f&&_0x3f276f['autoAssociation']===0x0){return db['UserProfileResource'][_0x5067('0x4c')]({'name':_0x38a74c[_0x5067('0x2f')],'resourceId':_0x38a74c['id'],'type':_0x3f276f[_0x5067('0x2f')],'sectionId':_0x3f276f['id']},{})[_0x5067('0x2a')](function(){return _0x67f443;});}else{return _0x67f443;}})[_0x5067('0x49')](function(_0xab11f9){logger['error'](_0x5067('0x53'),_0xab11f9);throw _0xab11f9;});}return _0x67f443;});}})[_0x5067('0x2a')](respondWithResult(_0x10c7b5,0xc9))[_0x5067('0x49')](handleError(_0x10c7b5,null));};exports[_0x5067('0x29')]=function(_0x362577,_0x261a93){if(_0x362577['body']['id']){delete _0x362577[_0x5067('0x57')]['id'];}return db[_0x5067('0x33')][_0x5067('0x4b')]({'where':{'id':_0x362577[_0x5067('0x54')]['id']}})[_0x5067('0x2a')](handleEntityNotFound(_0x261a93,null))[_0x5067('0x2a')](saveUpdates(_0x362577[_0x5067('0x57')],null))[_0x5067('0x2a')](respondWithResult(_0x261a93,null))[_0x5067('0x49')](handleError(_0x261a93,null));};exports[_0x5067('0x2b')]=function(_0x3b9101,_0x4fc876){return db[_0x5067('0x33')][_0x5067('0x4b')]({'where':{'id':_0x3b9101[_0x5067('0x54')]['id']}})[_0x5067('0x2a')](handleEntityNotFound(_0x4fc876,null))['then'](removeEntity(_0x4fc876,null))['catch'](handleError(_0x4fc876,null));};function widgetAttributes(_0x25a290){try{switch(_0x25a290[_0x5067('0x36')]){case'iframe':return[{'name':_0x5067('0x5a'),'value':_0x25a290[_0x5067('0x5a')]||(_0x25a290[_0x5067('0x5b')]&&_0x25a290[_0x5067('0x5b')][0x0]?_0x25a290['attrs'][0x0][_0x5067('0x5c')]:undefined)||_0x5067('0x5d')}];case _0x5067('0x5e'):return[{'name':_0x5067('0x5f'),'value':_0x25a290[_0x5067('0x5f')]||(_0x25a290[_0x5067('0x5b')]&&_0x25a290['attrs'][0x0]?_0x25a290[_0x5067('0x5b')][0x0][_0x5067('0x5c')]:undefined)||''}];case _0x5067('0x60'):return[{'name':_0x5067('0x61'),'value':_0x25a290[_0x5067('0x61')]||(_0x25a290[_0x5067('0x5b')]&&_0x25a290[_0x5067('0x5b')][0x0]?_0x25a290[_0x5067('0x5b')][0x0][_0x5067('0x5c')]:undefined)||_0x5067('0x62')},{'name':'attrTimezone','value':_0x25a290[_0x5067('0x63')]||(_0x25a290[_0x5067('0x5b')]&&_0x25a290['attrs'][0x1]?_0x25a290[_0x5067('0x5b')][0x1]['value']:undefined)||'0.00'},{'name':_0x5067('0x64'),'value':_0x25a290[_0x5067('0x64')]||(_0x25a290['attrs']&&_0x25a290[_0x5067('0x5b')][0x2]?_0x25a290[_0x5067('0x5b')][0x2][_0x5067('0x5c')]:undefined)||0xc}];case _0x5067('0x65'):return[{'name':'attrMetric','value':_0x25a290[_0x5067('0x66')]||(_0x25a290['attrs']&&_0x25a290[_0x5067('0x5b')][0x0]?_0x25a290[_0x5067('0x5b')][0x0][_0x5067('0x5c')]:undefined)||_0x5067('0x67')},{'name':_0x5067('0x68'),'value':_0x25a290[_0x5067('0x68')]||(_0x25a290['attrs']&&_0x25a290['attrs'][0x1]?_0x25a290[_0x5067('0x5b')][0x1][_0x5067('0x5c')]:undefined)||[]},{'name':'attrFontSize','value':_0x25a290[_0x5067('0x64')]||(_0x25a290[_0x5067('0x5b')]&&_0x25a290[_0x5067('0x5b')][0x2]?_0x25a290['attrs'][0x2][_0x5067('0x5c')]:undefined)||0x14},{'name':_0x5067('0x69'),'value':_0x25a290['attrChannel']||(_0x25a290[_0x5067('0x5b')]&&_0x25a290['attrs'][0x3]?_0x25a290[_0x5067('0x5b')][0x3][_0x5067('0x5c')]:undefined)||'voice'},{'name':_0x5067('0x6a'),'value':_0x25a290[_0x5067('0x6a')]||(_0x25a290[_0x5067('0x5b')]&&_0x25a290[_0x5067('0x5b')][0x4]?_0x25a290[_0x5067('0x5b')][0x4]['value']:undefined)||''},{'name':_0x5067('0x6b'),'value':_0x25a290['attrFaxAccounts']||(_0x25a290['attrs']&&_0x25a290[_0x5067('0x5b')][0x5]?_0x25a290[_0x5067('0x5b')][0x5][_0x5067('0x5c')]:undefined)||''},{'name':_0x5067('0x6c'),'value':_0x25a290[_0x5067('0x6c')]||(_0x25a290[_0x5067('0x5b')]&&_0x25a290[_0x5067('0x5b')][0x6]?_0x25a290[_0x5067('0x5b')][0x6][_0x5067('0x5c')]:undefined)||''},{'name':_0x5067('0x6d'),'value':_0x25a290[_0x5067('0x6d')]||(_0x25a290[_0x5067('0x5b')]&&_0x25a290[_0x5067('0x5b')][0x7]?_0x25a290['attrs'][0x7][_0x5067('0x5c')]:undefined)||''},{'name':_0x5067('0x6e'),'value':_0x25a290[_0x5067('0x6e')]||(_0x25a290[_0x5067('0x5b')]&&_0x25a290['attrs'][0x8]?_0x25a290[_0x5067('0x5b')][0x8]['value']:undefined)||''},{'name':_0x5067('0x6f'),'value':_0x25a290['attrChatWebsites']||(_0x25a290[_0x5067('0x5b')]&&_0x25a290[_0x5067('0x5b')][0x9]?_0x25a290[_0x5067('0x5b')][0x9][_0x5067('0x5c')]:undefined)||''}];case _0x5067('0x70'):case _0x5067('0x71'):return[{'name':'attrSerie1','value':_0x25a290[_0x5067('0x72')]||(_0x25a290['attrs']&&_0x25a290[_0x5067('0x5b')][0x0]?_0x25a290[_0x5067('0x5b')][0x0]['value']:undefined)||'total'},{'name':_0x5067('0x73'),'value':_0x25a290[_0x5067('0x73')]||(_0x25a290[_0x5067('0x5b')]&&_0x25a290[_0x5067('0x5b')][0x1]?_0x25a290['attrs'][0x1][_0x5067('0x5c')]:undefined)||null},{'name':'attrSerie3','value':_0x25a290[_0x5067('0x74')]||(_0x25a290['attrs']&&_0x25a290[_0x5067('0x5b')][0x2]?_0x25a290[_0x5067('0x5b')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x25a290[_0x5067('0x68')]||(_0x25a290[_0x5067('0x5b')]&&_0x25a290[_0x5067('0x5b')][0x3]?_0x25a290[_0x5067('0x5b')][0x3][_0x5067('0x5c')]:undefined)||[]},{'name':'attrChannel','value':_0x25a290[_0x5067('0x69')]||(_0x25a290[_0x5067('0x5b')]&&_0x25a290['attrs'][0x4]?_0x25a290['attrs'][0x4]['value']:undefined)||_0x5067('0x75')},{'name':_0x5067('0x6a'),'value':_0x25a290['attrEmailAccounts']||(_0x25a290[_0x5067('0x5b')]&&_0x25a290[_0x5067('0x5b')][0x5]?_0x25a290[_0x5067('0x5b')][0x5][_0x5067('0x5c')]:undefined)||''},{'name':_0x5067('0x6b'),'value':_0x25a290[_0x5067('0x6b')]||(_0x25a290[_0x5067('0x5b')]&&_0x25a290[_0x5067('0x5b')][0x6]?_0x25a290[_0x5067('0x5b')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x25a290['attrSmsAccounts']||(_0x25a290['attrs']&&_0x25a290[_0x5067('0x5b')][0x7]?_0x25a290[_0x5067('0x5b')][0x7][_0x5067('0x5c')]:undefined)||''},{'name':_0x5067('0x6d'),'value':_0x25a290[_0x5067('0x6d')]||(_0x25a290[_0x5067('0x5b')]&&_0x25a290[_0x5067('0x5b')][0x8]?_0x25a290[_0x5067('0x5b')][0x8][_0x5067('0x5c')]:undefined)||''},{'name':_0x5067('0x6e'),'value':_0x25a290[_0x5067('0x6e')]||(_0x25a290[_0x5067('0x5b')]&&_0x25a290[_0x5067('0x5b')][0x9]?_0x25a290[_0x5067('0x5b')][0x9][_0x5067('0x5c')]:undefined)||''},{'name':_0x5067('0x6f'),'value':_0x25a290[_0x5067('0x6f')]||(_0x25a290[_0x5067('0x5b')]&&_0x25a290[_0x5067('0x5b')][0xa]?_0x25a290[_0x5067('0x5b')][0xa][_0x5067('0x5c')]:undefined)||''}];case _0x5067('0x76'):return[{'name':'attrReport','type':_0x25a290[_0x5067('0x77')]||(_0x25a290['attrs']&&_0x25a290[_0x5067('0x5b')][0x0]?_0x25a290[_0x5067('0x5b')][0x0][_0x5067('0x36')]:undefined)||null,'value':_0x25a290[_0x5067('0x78')]||(_0x25a290['attrs']&&_0x25a290[_0x5067('0x5b')][0x0]?_0x25a290['attrs'][0x0][_0x5067('0x5c')]:undefined)||null},{'name':_0x5067('0x79'),'value':_0x25a290[_0x5067('0x79')]||(_0x25a290[_0x5067('0x5b')]&&_0x25a290['attrs'][0x1]?_0x25a290[_0x5067('0x5b')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x55c6ab){logger[_0x5067('0x2d')](_0x5067('0x7a'),JSON[_0x5067('0x7b')](_0x55c6ab));return[];}}exports['addItem']=function(_0x536991,_0x41339f,_0x3cf13a){if(_0x536991['body']['id']){delete _0x536991[_0x5067('0x57')]['id'];}return db[_0x5067('0x33')][_0x5067('0x4b')]({'where':{'id':_0x536991[_0x5067('0x54')]['id']}})['then'](handleEntityNotFound(_0x41339f,null))[_0x5067('0x2a')](function(_0x40a460){if(_0x40a460){_0x536991[_0x5067('0x57')][_0x5067('0x7c')]=_0x40a460['id'];_0x536991[_0x5067('0x57')][_0x5067('0x5b')]=widgetAttributes(_0x536991[_0x5067('0x57')]);return db[_0x5067('0x7d')][_0x5067('0x4c')](_0x536991[_0x5067('0x57')]);}})[_0x5067('0x2a')](respondWithResult(_0x41339f,null))[_0x5067('0x49')](handleError(_0x41339f,null));};exports['getItems']=function(_0xea9049,_0x1d6bbf,_0xf22f6b){var _0x308b3e={};var _0xf325de={};var _0x388552;var _0x397ed6;return db[_0x5067('0x33')]['findOne']({'where':{'id':_0xea9049[_0x5067('0x54')]['id']}})[_0x5067('0x2a')](handleEntityNotFound(_0x1d6bbf,null))[_0x5067('0x2a')](function(_0x4ba653){if(_0x4ba653){_0x388552=_0x4ba653;_0xf325de['model']=_[_0x5067('0x39')](db[_0x5067('0x7d')]['rawAttributes']);_0xf325de[_0x5067('0x3c')]=_[_0x5067('0x39')](_0xea9049[_0x5067('0x3c')]);_0xf325de[_0x5067('0x3a')]=_[_0x5067('0x3b')](_0xf325de[_0x5067('0x38')],_0xf325de['query']);_0x308b3e[_0x5067('0x3d')]=_[_0x5067('0x3b')](_0xf325de['model'],qs['fields'](_0xea9049[_0x5067('0x3c')][_0x5067('0x3e')]));_0x308b3e[_0x5067('0x3d')]=_0x308b3e['attributes'][_0x5067('0x3f')]?_0x308b3e[_0x5067('0x3d')]:_0xf325de[_0x5067('0x38')];_0x308b3e[_0x5067('0x41')]=qs[_0x5067('0x42')](_0xea9049[_0x5067('0x3c')][_0x5067('0x42')]);_0x308b3e[_0x5067('0x45')]=qs['filters'](_[_0x5067('0x43')](_0xea9049[_0x5067('0x3c')],_0xf325de[_0x5067('0x3a')]));if(_0xea9049[_0x5067('0x3c')][_0x5067('0x44')]){_0x308b3e['where']=_['merge'](_0x308b3e['where'],{'$or':_[_0x5067('0x32')](_0x308b3e['attributes'],function(_0x5a61bf){var _0xaf4cd2={};_0xaf4cd2[_0x5a61bf]={'$like':'%'+_0xea9049[_0x5067('0x3c')]['filter']+'%'};return _0xaf4cd2;})});}_0x308b3e=_[_0x5067('0x46')]({},_0x308b3e,_0xea9049[_0x5067('0x7e')]);return _0x388552[_0x5067('0x7f')](_0x308b3e);}})[_0x5067('0x2a')](function(_0x5c0b67){if(_0x5c0b67){_0x397ed6=_0x5c0b67[_0x5067('0x3f')];if(!_0xea9049[_0x5067('0x3c')][_0x5067('0x80')]('nolimit')){_0x308b3e[_0x5067('0x23')]=qs['limit'](_0xea9049[_0x5067('0x3c')][_0x5067('0x23')]);_0x308b3e['offset']=qs['offset'](_0xea9049[_0x5067('0x3c')][_0x5067('0x25')]);}return _0x388552[_0x5067('0x7f')](_0x308b3e);}})['then'](function(_0x21099e){if(_0x21099e){return _0x21099e?{'count':_0x397ed6,'rows':_0x21099e}:null;}})['then'](respondWithResult(_0x1d6bbf,null))[_0x5067('0x49')](handleError(_0x1d6bbf,null));}; \ No newline at end of file +var _0x6747=['papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','then','UserProfileResource','error','name','send','index','map','Dashboard','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','where','merge','type','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','find','catch','clone','updatedAt','UserProfileSection','userProfileId','autoAssociation','update','destroy','iframe','attrUrl','attrs','value','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','order','getItems','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x6747,0x70));var _0x7674=function(_0x132887,_0x8a429e){_0x132887=_0x132887-0x0;var _0x4edd79=_0x6747[_0x132887];return _0x4edd79;};'use strict';var emlformat=require(_0x7674('0x0'));var rimraf=require(_0x7674('0x1'));var zipdir=require(_0x7674('0x2'));var jsonpatch=require(_0x7674('0x3'));var rp=require('request-promise');var moment=require(_0x7674('0x4'));var BPromise=require(_0x7674('0x5'));var Mustache=require('mustache');var util=require(_0x7674('0x6'));var path=require(_0x7674('0x7'));var sox=require('sox');var csv=require(_0x7674('0x8'));var ejs=require(_0x7674('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7674('0xa'));var squel=require(_0x7674('0xb'));var crypto=require('crypto');var jsforce=require(_0x7674('0xc'));var deskjs=require(_0x7674('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7674('0xe'));var Papa=require(_0x7674('0xf'));var Redis=require(_0x7674('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7674('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7674('0x12'));var logger=require(_0x7674('0x13'))(_0x7674('0x14'));var utils=require(_0x7674('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7674('0x16'));var db=require('../../mysqldb')['db'];config[_0x7674('0x17')]=_[_0x7674('0x18')](config[_0x7674('0x17')],{'host':_0x7674('0x19'),'port':0x18eb});var socket=require(_0x7674('0x1a'))(new Redis(config[_0x7674('0x17')]));require(_0x7674('0x1b'))[_0x7674('0x1c')](socket);function respondWithStatusCode(_0x228a5a,_0x341156){_0x341156=_0x341156||0xcc;return function(_0x46dd38){if(_0x46dd38){return _0x228a5a[_0x7674('0x1d')](_0x341156);}return _0x228a5a[_0x7674('0x1e')](_0x341156)[_0x7674('0x1f')]();};}function respondWithResult(_0x394479,_0x44ab2a){_0x44ab2a=_0x44ab2a||0xc8;return function(_0x5db5ad){if(_0x5db5ad){return _0x394479[_0x7674('0x1e')](_0x44ab2a)[_0x7674('0x20')](_0x5db5ad);}};}function respondWithFilteredResult(_0x1b54e2,_0x3ae163){return function(_0x4f8367){if(_0x4f8367){var _0x271be4=typeof _0x3ae163[_0x7674('0x21')]===_0x7674('0x22')&&typeof _0x3ae163[_0x7674('0x23')]==='undefined';var _0x2294c8=_0x4f8367['count'];var _0x2916e2=_0x271be4?0x0:_0x3ae163[_0x7674('0x21')];var _0xd331b3=_0x271be4?_0x4f8367['count']:_0x3ae163[_0x7674('0x21')]+_0x3ae163['limit'];var _0x1c9138;if(_0xd331b3>=_0x2294c8){_0xd331b3=_0x2294c8;_0x1c9138=0xc8;}else{_0x1c9138=0xce;}_0x1b54e2[_0x7674('0x1e')](_0x1c9138);return _0x1b54e2[_0x7674('0x24')](_0x7674('0x25'),_0x2916e2+'-'+_0xd331b3+'/'+_0x2294c8)[_0x7674('0x20')](_0x4f8367);}return null;};}function patchUpdates(_0x51bf58){return function(_0x129354){try{jsonpatch[_0x7674('0x26')](_0x129354,_0x51bf58,!![]);}catch(_0x534212){return BPromise['reject'](_0x534212);}return _0x129354[_0x7674('0x27')]();};}function saveUpdates(_0x402c0c,_0x336caa){return function(_0x11416){if(_0x11416){return _0x11416['update'](_0x402c0c)[_0x7674('0x28')](function(_0x547b71){return _0x547b71;});}return null;};}function removeEntity(_0x3b75ec,_0x202a28){return function(_0x1c19b6){if(_0x1c19b6){return _0x1c19b6['destroy']()[_0x7674('0x28')](function(){var _0x3b9a78=_0x1c19b6['get']({'plain':!![]});var _0x437fc0='CustomDashboards';return db[_0x7674('0x29')]['destroy']({'where':{'type':_0x437fc0,'resourceId':_0x3b9a78['id']}})[_0x7674('0x28')](function(){return _0x1c19b6;});})['then'](function(){_0x3b75ec[_0x7674('0x1e')](0xcc)[_0x7674('0x1f')]();});}};}function handleEntityNotFound(_0x541b73,_0x539343){return function(_0x1fccd9){if(!_0x1fccd9){_0x541b73[_0x7674('0x1d')](0x194);}return _0x1fccd9;};}function handleError(_0x430443,_0x4f8915){_0x4f8915=_0x4f8915||0x1f4;return function(_0x1b593c){logger[_0x7674('0x2a')](_0x1b593c['stack']);if(_0x1b593c[_0x7674('0x2b')]){delete _0x1b593c[_0x7674('0x2b')];}_0x430443['status'](_0x4f8915)[_0x7674('0x2c')](_0x1b593c);};}exports[_0x7674('0x2d')]=function(_0x4a41df,_0x2949cf){var _0x4cf010={},_0x1131c4={},_0x4214b9={'count':0x0,'rows':[]};var _0x11a0ed=_[_0x7674('0x2e')](db[_0x7674('0x2f')][_0x7674('0x30')],function(_0x52b3ba){return{'name':_0x52b3ba['fieldName'],'type':_0x52b3ba['type'][_0x7674('0x31')]};});_0x1131c4[_0x7674('0x32')]=_[_0x7674('0x2e')](_0x11a0ed,'name');_0x1131c4[_0x7674('0x33')]=_[_0x7674('0x34')](_0x4a41df['query']);_0x1131c4[_0x7674('0x35')]=_[_0x7674('0x36')](_0x1131c4[_0x7674('0x32')],_0x1131c4[_0x7674('0x33')]);_0x4cf010[_0x7674('0x37')]=_['intersection'](_0x1131c4['model'],qs['fields'](_0x4a41df[_0x7674('0x33')][_0x7674('0x38')]));_0x4cf010[_0x7674('0x37')]=_0x4cf010[_0x7674('0x37')][_0x7674('0x39')]?_0x4cf010[_0x7674('0x37')]:_0x1131c4['model'];if(!_0x4a41df['query']['hasOwnProperty'](_0x7674('0x3a'))){_0x4cf010[_0x7674('0x23')]=qs[_0x7674('0x23')](_0x4a41df[_0x7674('0x33')]['limit']);_0x4cf010['offset']=qs[_0x7674('0x21')](_0x4a41df['query']['offset']);}_0x4cf010['order']=qs[_0x7674('0x3b')](_0x4a41df['query']['sort']);_0x4cf010['where']=qs['filters'](_[_0x7674('0x3c')](_0x4a41df[_0x7674('0x33')],_0x1131c4[_0x7674('0x35')]),_0x11a0ed);if(_0x4a41df[_0x7674('0x33')]['filter']){_0x4cf010[_0x7674('0x3d')]=_[_0x7674('0x3e')](_0x4cf010[_0x7674('0x3d')],{'$or':_[_0x7674('0x2e')](_0x11a0ed,function(_0x41c726){if(_0x41c726[_0x7674('0x3f')]!==_0x7674('0x40')){var _0x2efb72={};_0x2efb72[_0x41c726[_0x7674('0x2b')]]={'$like':'%'+_0x4a41df[_0x7674('0x33')][_0x7674('0x41')]+'%'};return _0x2efb72;}})});}_0x4cf010=_[_0x7674('0x3e')]({},_0x4cf010,_0x4a41df[_0x7674('0x42')]);var _0x1126ef={'where':_0x4cf010['where']};return db['Dashboard'][_0x7674('0x43')](_0x1126ef)['then'](function(_0x58b5bd){_0x4214b9[_0x7674('0x43')]=_0x58b5bd;if(_0x4a41df['query'][_0x7674('0x44')]){_0x4cf010[_0x7674('0x45')]=[{'all':!![]}];}return db[_0x7674('0x2f')][_0x7674('0x46')](_0x4cf010);})[_0x7674('0x28')](function(_0x1f2545){_0x4214b9[_0x7674('0x47')]=_0x1f2545;return _0x4214b9;})[_0x7674('0x28')](respondWithFilteredResult(_0x2949cf,_0x4cf010))['catch'](handleError(_0x2949cf,null));};exports['show']=function(_0x1ea7ab,_0x4b709){var _0xe95b58={'raw':![],'where':{'id':_0x1ea7ab[_0x7674('0x48')]['id']}},_0x250647={};_0x250647[_0x7674('0x32')]=_[_0x7674('0x34')](db['Dashboard'][_0x7674('0x30')]);_0x250647[_0x7674('0x33')]=_[_0x7674('0x34')](_0x1ea7ab['query']);_0x250647[_0x7674('0x35')]=_[_0x7674('0x36')](_0x250647['model'],_0x250647[_0x7674('0x33')]);_0xe95b58[_0x7674('0x37')]=_[_0x7674('0x36')](_0x250647['model'],qs[_0x7674('0x38')](_0x1ea7ab[_0x7674('0x33')]['fields']));_0xe95b58[_0x7674('0x37')]=_0xe95b58[_0x7674('0x37')]['length']?_0xe95b58[_0x7674('0x37')]:_0x250647['model'];if(_0x1ea7ab[_0x7674('0x33')][_0x7674('0x44')]){_0xe95b58[_0x7674('0x45')]=[{'all':!![]}];}_0xe95b58=_['merge']({},_0xe95b58,_0x1ea7ab['options']);return db[_0x7674('0x2f')]['find'](_0xe95b58)[_0x7674('0x28')](handleEntityNotFound(_0x4b709,null))[_0x7674('0x28')](respondWithResult(_0x4b709,null))['catch'](handleError(_0x4b709,null));};exports[_0x7674('0x49')]=function(_0x139bc5,_0x2bb1a0){return db[_0x7674('0x2f')][_0x7674('0x49')](_0x139bc5[_0x7674('0x4a')],{})[_0x7674('0x28')](function(_0x1dd73a){var _0x5acaf0=_0x139bc5[_0x7674('0x4b')][_0x7674('0x4c')]({'plain':!![]});if(!_0x5acaf0)throw new Error(_0x7674('0x4d'));if(_0x5acaf0[_0x7674('0x4e')]===_0x7674('0x4b')){var _0x1d4d1c=_0x1dd73a[_0x7674('0x4c')]({'plain':!![]});var _0x4076ba=_0x7674('0x4f');return db['UserProfileSection'][_0x7674('0x50')]({'where':{'name':_0x4076ba,'userProfileId':_0x5acaf0['userProfileId']},'raw':!![]})['then'](function(_0x37a9df){if(_0x37a9df&&_0x37a9df['autoAssociation']===0x0){return db[_0x7674('0x29')]['create']({'name':_0x1d4d1c['name'],'resourceId':_0x1d4d1c['id'],'type':_0x37a9df[_0x7674('0x2b')],'sectionId':_0x37a9df['id']},{})[_0x7674('0x28')](function(){return _0x1dd73a;});}else{return _0x1dd73a;}})[_0x7674('0x51')](function(_0x3eafd8){logger[_0x7674('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3eafd8);throw _0x3eafd8;});}return _0x1dd73a;})['then'](respondWithResult(_0x2bb1a0,0xc9))[_0x7674('0x51')](handleError(_0x2bb1a0,null));};exports[_0x7674('0x52')]=function(_0x29cd2f,_0x28c1b0){var _0x33b7a6={'where':{'id':_0x29cd2f[_0x7674('0x48')]['id']}},_0x45f2d2={};_0x45f2d2['model']=_[_0x7674('0x34')](db[_0x7674('0x2f')]['rawAttributes']);_0x33b7a6[_0x7674('0x37')]=_['intersection'](_0x45f2d2[_0x7674('0x32')],qs['fields'](_0x29cd2f[_0x7674('0x33')]['fields']));_0x33b7a6[_0x7674('0x37')]=_0x33b7a6[_0x7674('0x37')][_0x7674('0x39')]?_0x33b7a6['attributes']:_0x45f2d2[_0x7674('0x32')];if(_0x29cd2f['query'][_0x7674('0x44')]){_0x33b7a6[_0x7674('0x45')]=[{'all':!![]}];}_0x33b7a6=_[_0x7674('0x3e')]({},_0x33b7a6,_0x29cd2f[_0x7674('0x42')]);return db[_0x7674('0x2f')][_0x7674('0x50')](_0x33b7a6)[_0x7674('0x28')](handleEntityNotFound(_0x28c1b0,null))[_0x7674('0x28')](function(_0x1b37f4){if(_0x1b37f4){var _0x1d3dc3=_0x1b37f4[_0x7674('0x4c')]({'plain':!![]});_0x1d3dc3=qs['omit'](_0x1d3dc3,['id','createdAt',_0x7674('0x53')]);_0x29cd2f[_0x7674('0x4a')]=_['omit'](_0x29cd2f[_0x7674('0x4a')],['id','createdAt',_0x7674('0x53')]);return db['Dashboard']['create'](_['merge'](_0x1d3dc3,_0x29cd2f[_0x7674('0x4a')]),{'include':_0x29cd2f[_0x7674('0x33')]['includeAll']?[{'all':!![]}]:undefined})[_0x7674('0x28')](function(_0x3b749e){var _0x43a498=_0x29cd2f['user'][_0x7674('0x4c')]({'plain':!![]});if(!_0x43a498)throw new Error(_0x7674('0x4d'));if(_0x43a498[_0x7674('0x4e')]===_0x7674('0x4b')){var _0x1741d9=_0x3b749e['get']({'plain':!![]});var _0x1a00b9=_0x7674('0x4f');return db[_0x7674('0x54')]['find']({'where':{'name':_0x1a00b9,'userProfileId':_0x43a498[_0x7674('0x55')]},'raw':!![]})['then'](function(_0x3c343c){if(_0x3c343c&&_0x3c343c[_0x7674('0x56')]===0x0){return db[_0x7674('0x29')][_0x7674('0x49')]({'name':_0x1741d9[_0x7674('0x2b')],'resourceId':_0x1741d9['id'],'type':_0x3c343c[_0x7674('0x2b')],'sectionId':_0x3c343c['id']},{})[_0x7674('0x28')](function(){return _0x3b749e;});}else{return _0x3b749e;}})[_0x7674('0x51')](function(_0x31919c){logger[_0x7674('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31919c);throw _0x31919c;});}return _0x3b749e;});}})[_0x7674('0x28')](respondWithResult(_0x28c1b0,0xc9))['catch'](handleError(_0x28c1b0,null));};exports[_0x7674('0x57')]=function(_0xde301e,_0x3386b3){if(_0xde301e[_0x7674('0x4a')]['id']){delete _0xde301e[_0x7674('0x4a')]['id'];}return db[_0x7674('0x2f')][_0x7674('0x50')]({'where':{'id':_0xde301e[_0x7674('0x48')]['id']}})[_0x7674('0x28')](handleEntityNotFound(_0x3386b3,null))[_0x7674('0x28')](saveUpdates(_0xde301e[_0x7674('0x4a')],null))[_0x7674('0x28')](respondWithResult(_0x3386b3,null))[_0x7674('0x51')](handleError(_0x3386b3,null));};exports[_0x7674('0x58')]=function(_0x4c2bdb,_0x10428e){return db['Dashboard'][_0x7674('0x50')]({'where':{'id':_0x4c2bdb['params']['id']}})[_0x7674('0x28')](handleEntityNotFound(_0x10428e,null))[_0x7674('0x28')](removeEntity(_0x10428e,null))[_0x7674('0x51')](handleError(_0x10428e,null));};function widgetAttributes(_0x2016c1){try{switch(_0x2016c1[_0x7674('0x3f')]){case _0x7674('0x59'):return[{'name':_0x7674('0x5a'),'value':_0x2016c1[_0x7674('0x5a')]||(_0x2016c1[_0x7674('0x5b')]&&_0x2016c1['attrs'][0x0]?_0x2016c1[_0x7674('0x5b')][0x0][_0x7674('0x5c')]:undefined)||'https://'}];case'custom':return[{'name':_0x7674('0x5d'),'value':_0x2016c1[_0x7674('0x5d')]||(_0x2016c1[_0x7674('0x5b')]&&_0x2016c1[_0x7674('0x5b')][0x0]?_0x2016c1[_0x7674('0x5b')][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0x7674('0x5e'),'value':_0x2016c1['attrHourFormat']||(_0x2016c1['attrs']&&_0x2016c1[_0x7674('0x5b')][0x0]?_0x2016c1[_0x7674('0x5b')][0x0]['value']:undefined)||_0x7674('0x5f')},{'name':_0x7674('0x60'),'value':_0x2016c1[_0x7674('0x60')]||(_0x2016c1[_0x7674('0x5b')]&&_0x2016c1[_0x7674('0x5b')][0x1]?_0x2016c1[_0x7674('0x5b')][0x1][_0x7674('0x5c')]:undefined)||_0x7674('0x61')},{'name':_0x7674('0x62'),'value':_0x2016c1[_0x7674('0x62')]||(_0x2016c1[_0x7674('0x5b')]&&_0x2016c1['attrs'][0x2]?_0x2016c1[_0x7674('0x5b')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x7674('0x63'),'value':_0x2016c1['attrMetric']||(_0x2016c1['attrs']&&_0x2016c1[_0x7674('0x5b')][0x0]?_0x2016c1['attrs'][0x0][_0x7674('0x5c')]:undefined)||_0x7674('0x64')},{'name':_0x7674('0x65'),'value':_0x2016c1[_0x7674('0x65')]||(_0x2016c1[_0x7674('0x5b')]&&_0x2016c1[_0x7674('0x5b')][0x1]?_0x2016c1[_0x7674('0x5b')][0x1]['value']:undefined)||[]},{'name':_0x7674('0x62'),'value':_0x2016c1[_0x7674('0x62')]||(_0x2016c1[_0x7674('0x5b')]&&_0x2016c1[_0x7674('0x5b')][0x2]?_0x2016c1[_0x7674('0x5b')][0x2][_0x7674('0x5c')]:undefined)||0x14},{'name':_0x7674('0x66'),'value':_0x2016c1[_0x7674('0x66')]||(_0x2016c1['attrs']&&_0x2016c1[_0x7674('0x5b')][0x3]?_0x2016c1['attrs'][0x3][_0x7674('0x5c')]:undefined)||_0x7674('0x67')},{'name':_0x7674('0x68'),'value':_0x2016c1['attrEmailAccounts']||(_0x2016c1[_0x7674('0x5b')]&&_0x2016c1[_0x7674('0x5b')][0x4]?_0x2016c1['attrs'][0x4][_0x7674('0x5c')]:undefined)||''},{'name':_0x7674('0x69'),'value':_0x2016c1[_0x7674('0x69')]||(_0x2016c1[_0x7674('0x5b')]&&_0x2016c1['attrs'][0x5]?_0x2016c1['attrs'][0x5]['value']:undefined)||''},{'name':_0x7674('0x6a'),'value':_0x2016c1[_0x7674('0x6a')]||(_0x2016c1['attrs']&&_0x2016c1[_0x7674('0x5b')][0x6]?_0x2016c1['attrs'][0x6][_0x7674('0x5c')]:undefined)||''},{'name':_0x7674('0x6b'),'value':_0x2016c1[_0x7674('0x6b')]||(_0x2016c1[_0x7674('0x5b')]&&_0x2016c1[_0x7674('0x5b')][0x7]?_0x2016c1[_0x7674('0x5b')][0x7][_0x7674('0x5c')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2016c1[_0x7674('0x6c')]||(_0x2016c1[_0x7674('0x5b')]&&_0x2016c1[_0x7674('0x5b')][0x8]?_0x2016c1[_0x7674('0x5b')][0x8]['value']:undefined)||''},{'name':_0x7674('0x6d'),'value':_0x2016c1[_0x7674('0x6d')]||(_0x2016c1[_0x7674('0x5b')]&&_0x2016c1['attrs'][0x9]?_0x2016c1[_0x7674('0x5b')][0x9][_0x7674('0x5c')]:undefined)||''}];case _0x7674('0x6e'):case _0x7674('0x6f'):return[{'name':_0x7674('0x70'),'value':_0x2016c1['attrSerie1']||(_0x2016c1[_0x7674('0x5b')]&&_0x2016c1[_0x7674('0x5b')][0x0]?_0x2016c1[_0x7674('0x5b')][0x0][_0x7674('0x5c')]:undefined)||'total'},{'name':'attrSerie2','value':_0x2016c1[_0x7674('0x71')]||(_0x2016c1[_0x7674('0x5b')]&&_0x2016c1[_0x7674('0x5b')][0x1]?_0x2016c1['attrs'][0x1][_0x7674('0x5c')]:undefined)||null},{'name':_0x7674('0x72'),'value':_0x2016c1[_0x7674('0x72')]||(_0x2016c1[_0x7674('0x5b')]&&_0x2016c1[_0x7674('0x5b')][0x2]?_0x2016c1['attrs'][0x2][_0x7674('0x5c')]:undefined)||null},{'name':_0x7674('0x65'),'value':_0x2016c1['attrVoiceQueues']||(_0x2016c1[_0x7674('0x5b')]&&_0x2016c1[_0x7674('0x5b')][0x3]?_0x2016c1[_0x7674('0x5b')][0x3][_0x7674('0x5c')]:undefined)||[]},{'name':_0x7674('0x66'),'value':_0x2016c1[_0x7674('0x66')]||(_0x2016c1[_0x7674('0x5b')]&&_0x2016c1[_0x7674('0x5b')][0x4]?_0x2016c1[_0x7674('0x5b')][0x4][_0x7674('0x5c')]:undefined)||_0x7674('0x67')},{'name':_0x7674('0x68'),'value':_0x2016c1[_0x7674('0x68')]||(_0x2016c1[_0x7674('0x5b')]&&_0x2016c1[_0x7674('0x5b')][0x5]?_0x2016c1['attrs'][0x5]['value']:undefined)||''},{'name':_0x7674('0x69'),'value':_0x2016c1[_0x7674('0x69')]||(_0x2016c1[_0x7674('0x5b')]&&_0x2016c1[_0x7674('0x5b')][0x6]?_0x2016c1[_0x7674('0x5b')][0x6][_0x7674('0x5c')]:undefined)||''},{'name':_0x7674('0x6a'),'value':_0x2016c1['attrSmsAccounts']||(_0x2016c1[_0x7674('0x5b')]&&_0x2016c1[_0x7674('0x5b')][0x7]?_0x2016c1[_0x7674('0x5b')][0x7][_0x7674('0x5c')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x2016c1[_0x7674('0x6b')]||(_0x2016c1[_0x7674('0x5b')]&&_0x2016c1['attrs'][0x8]?_0x2016c1[_0x7674('0x5b')][0x8][_0x7674('0x5c')]:undefined)||''},{'name':_0x7674('0x6c'),'value':_0x2016c1[_0x7674('0x6c')]||(_0x2016c1['attrs']&&_0x2016c1[_0x7674('0x5b')][0x9]?_0x2016c1[_0x7674('0x5b')][0x9][_0x7674('0x5c')]:undefined)||''},{'name':_0x7674('0x6d'),'value':_0x2016c1[_0x7674('0x6d')]||(_0x2016c1['attrs']&&_0x2016c1[_0x7674('0x5b')][0xa]?_0x2016c1[_0x7674('0x5b')][0xa][_0x7674('0x5c')]:undefined)||''}];case _0x7674('0x73'):return[{'name':_0x7674('0x74'),'type':_0x2016c1[_0x7674('0x75')]||(_0x2016c1['attrs']&&_0x2016c1[_0x7674('0x5b')][0x0]?_0x2016c1[_0x7674('0x5b')][0x0][_0x7674('0x3f')]:undefined)||null,'value':_0x2016c1[_0x7674('0x74')]||(_0x2016c1[_0x7674('0x5b')]&&_0x2016c1[_0x7674('0x5b')][0x0]?_0x2016c1[_0x7674('0x5b')][0x0][_0x7674('0x5c')]:undefined)||null},{'name':_0x7674('0x76'),'value':_0x2016c1[_0x7674('0x76')]||(_0x2016c1[_0x7674('0x5b')]&&_0x2016c1[_0x7674('0x5b')][0x1]?_0x2016c1[_0x7674('0x5b')][0x1][_0x7674('0x5c')]:undefined)||0x0}];default:return[];}}catch(_0x45d8e8){logger[_0x7674('0x2a')](_0x7674('0x77'),JSON[_0x7674('0x78')](_0x45d8e8));return[];}}exports[_0x7674('0x79')]=function(_0x3fbad6,_0x34f414,_0x10ec40){if(_0x3fbad6[_0x7674('0x4a')]['id']){delete _0x3fbad6[_0x7674('0x4a')]['id'];}return db[_0x7674('0x2f')][_0x7674('0x50')]({'where':{'id':_0x3fbad6['params']['id']}})[_0x7674('0x28')](handleEntityNotFound(_0x34f414,null))[_0x7674('0x28')](function(_0x5a0a31){if(_0x5a0a31){_0x3fbad6[_0x7674('0x4a')][_0x7674('0x7a')]=_0x5a0a31['id'];_0x3fbad6[_0x7674('0x4a')][_0x7674('0x5b')]=widgetAttributes(_0x3fbad6[_0x7674('0x4a')]);return db[_0x7674('0x7b')][_0x7674('0x49')](_0x3fbad6[_0x7674('0x4a')]);}})[_0x7674('0x28')](respondWithResult(_0x34f414,null))[_0x7674('0x51')](handleError(_0x34f414,null));};exports['getItems']=function(_0x934963,_0x3b3c9a,_0x219ecf){var _0x148f32={};var _0x3d5167={};var _0x2dee13;var _0x2e94c8;return db[_0x7674('0x2f')]['findOne']({'where':{'id':_0x934963[_0x7674('0x48')]['id']}})[_0x7674('0x28')](handleEntityNotFound(_0x3b3c9a,null))['then'](function(_0x41b2d4){if(_0x41b2d4){_0x2dee13=_0x41b2d4;_0x3d5167[_0x7674('0x32')]=_[_0x7674('0x34')](db['DashboardItem'][_0x7674('0x30')]);_0x3d5167[_0x7674('0x33')]=_[_0x7674('0x34')](_0x934963[_0x7674('0x33')]);_0x3d5167['filters']=_[_0x7674('0x36')](_0x3d5167[_0x7674('0x32')],_0x3d5167[_0x7674('0x33')]);_0x148f32[_0x7674('0x37')]=_[_0x7674('0x36')](_0x3d5167[_0x7674('0x32')],qs[_0x7674('0x38')](_0x934963[_0x7674('0x33')][_0x7674('0x38')]));_0x148f32[_0x7674('0x37')]=_0x148f32[_0x7674('0x37')][_0x7674('0x39')]?_0x148f32[_0x7674('0x37')]:_0x3d5167['model'];_0x148f32[_0x7674('0x7c')]=qs[_0x7674('0x3b')](_0x934963[_0x7674('0x33')][_0x7674('0x3b')]);_0x148f32[_0x7674('0x3d')]=qs[_0x7674('0x35')](_[_0x7674('0x3c')](_0x934963[_0x7674('0x33')],_0x3d5167[_0x7674('0x35')]));if(_0x934963[_0x7674('0x33')][_0x7674('0x41')]){_0x148f32[_0x7674('0x3d')]=_['merge'](_0x148f32[_0x7674('0x3d')],{'$or':_[_0x7674('0x2e')](_0x148f32['attributes'],function(_0x4bcdf2){var _0x21ef66={};_0x21ef66[_0x4bcdf2]={'$like':'%'+_0x934963[_0x7674('0x33')]['filter']+'%'};return _0x21ef66;})});}_0x148f32=_[_0x7674('0x3e')]({},_0x148f32,_0x934963[_0x7674('0x42')]);return _0x2dee13[_0x7674('0x7d')](_0x148f32);}})['then'](function(_0x3f3b71){if(_0x3f3b71){_0x2e94c8=_0x3f3b71[_0x7674('0x39')];if(!_0x934963[_0x7674('0x33')][_0x7674('0x7e')](_0x7674('0x3a'))){_0x148f32['limit']=qs[_0x7674('0x23')](_0x934963['query'][_0x7674('0x23')]);_0x148f32['offset']=qs[_0x7674('0x21')](_0x934963[_0x7674('0x33')][_0x7674('0x21')]);}return _0x2dee13[_0x7674('0x7d')](_0x148f32);}})[_0x7674('0x28')](function(_0x50d121){if(_0x50d121){return _0x50d121?{'count':_0x2e94c8,'rows':_0x50d121}:null;}})[_0x7674('0x28')](respondWithResult(_0x3b3c9a,null))[_0x7674('0x51')](handleError(_0x3b3c9a,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 35609ba..a565078 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 _0x9901=['setMaxListeners','save','update','remove','emit','hook','exports','../../mysqldb'];(function(_0x446186,_0x116e31){var _0x63b564=function(_0x590a14){while(--_0x590a14){_0x446186['push'](_0x446186['shift']());}};_0x63b564(++_0x116e31);}(_0x9901,0x1bf));var _0x1990=function(_0x54613d,_0x4b8872){_0x54613d=_0x54613d-0x0;var _0x11c35b=_0x9901[_0x54613d];return _0x11c35b;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x1990('0x0'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x1990('0x1')](0x0);var events={'afterCreate':_0x1990('0x2'),'afterUpdate':_0x1990('0x3'),'afterDestroy':_0x1990('0x4')};function emitEvent(_0x583b77){return function(_0x3b76f0,_0x53a506,_0x5dfe3f){DashboardEvents[_0x1990('0x5')](_0x583b77+':'+_0x3b76f0['id'],_0x3b76f0);DashboardEvents['emit'](_0x583b77,_0x3b76f0);_0x5dfe3f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x1990('0x6')](e,emitEvent(event));}}module[_0x1990('0x7')]=DashboardEvents; \ No newline at end of file +var _0xcb04=['events','../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x208af9,_0x428504){var _0x34e94b=function(_0x48aa03){while(--_0x48aa03){_0x208af9['push'](_0x208af9['shift']());}};_0x34e94b(++_0x428504);}(_0xcb04,0x9a));var _0x4cb0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcb04[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x4cb0('0x0'));var Dashboard=require(_0x4cb0('0x1'))['db'][_0x4cb0('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x4cb0('0x3')](0x0);var events={'afterCreate':_0x4cb0('0x4'),'afterUpdate':_0x4cb0('0x5'),'afterDestroy':_0x4cb0('0x6')};function emitEvent(_0x2f1690){return function(_0x392bd7,_0x3939b4,_0x47aae7){DashboardEvents[_0x4cb0('0x7')](_0x2f1690+':'+_0x392bd7['id'],_0x392bd7);DashboardEvents[_0x4cb0('0x7')](_0x2f1690,_0x392bd7);_0x47aae7(null);};}for(var e in events){if(events[_0x4cb0('0x8')](e)){var event=events[e];Dashboard[_0x4cb0('0x9')](e,emitEvent(event));}}module[_0x4cb0('0xa')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index fddb801..3beffd6 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 _0xc27f=['rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x457796,_0x34ca8d){var _0x1edad3=function(_0x33ba8a){while(--_0x33ba8a){_0x457796['push'](_0x457796['shift']());}};_0x1edad3(++_0x34ca8d);}(_0xc27f,0x85));var _0xfc27=function(_0x176a4d,_0x5770af){_0x176a4d=_0x176a4d-0x0;var _0x411f3b=_0xc27f[_0x176a4d];return _0x411f3b;};'use strict';var _=require(_0xfc27('0x0'));var util=require(_0xfc27('0x1'));var logger=require(_0xfc27('0x2'))('api');var moment=require(_0xfc27('0x3'));var BPromise=require(_0xfc27('0x4'));var rp=require(_0xfc27('0x5'));var fs=require('fs');var path=require(_0xfc27('0x6'));var rimraf=require(_0xfc27('0x7'));var config=require(_0xfc27('0x8'));var attributes=require(_0xfc27('0x9'));module[_0xfc27('0xa')]=function(_0x14c86a,_0x15c405){return _0x14c86a[_0xfc27('0xb')](_0xfc27('0xc'),attributes,{'tableName':_0xfc27('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c1d=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','Dashboard','dashboards','lodash'];(function(_0x2b8a91,_0x3d9cc3){var _0x5240c0=function(_0x301393){while(--_0x301393){_0x2b8a91['push'](_0x2b8a91['shift']());}};_0x5240c0(++_0x3d9cc3);}(_0x6c1d,0xa4));var _0xd6c1=function(_0x1e2c07,_0x24ce44){_0x1e2c07=_0x1e2c07-0x0;var _0x6d9e9=_0x6c1d[_0x1e2c07];return _0x6d9e9;};'use strict';var _=require(_0xd6c1('0x0'));var util=require('util');var logger=require(_0xd6c1('0x1'))(_0xd6c1('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd6c1('0x3'));var fs=require('fs');var path=require(_0xd6c1('0x4'));var rimraf=require(_0xd6c1('0x5'));var config=require(_0xd6c1('0x6'));var attributes=require(_0xd6c1('0x7'));module[_0xd6c1('0x8')]=function(_0x255d90,_0x1e8394){return _0x255d90['define'](_0xd6c1('0x9'),attributes,{'tableName':_0xd6c1('0xa'),'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 145c9ae..5c0cff7 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 _0xd6e8=['request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','Dashboard,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','request','then','info'];(function(_0xe257ee,_0x353e81){var _0x53b734=function(_0x16686e){while(--_0x16686e){_0xe257ee['push'](_0xe257ee['shift']());}};_0x53b734(++_0x353e81);}(_0xd6e8,0x166));var _0x8d6e=function(_0x720e20,_0x1a827){_0x720e20=_0x720e20-0x0;var _0xfef46e=_0xd6e8[_0x720e20];return _0xfef46e;};'use strict';var _=require(_0x8d6e('0x0'));var util=require(_0x8d6e('0x1'));var moment=require(_0x8d6e('0x2'));var BPromise=require(_0x8d6e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d6e('0x4'));var db=require(_0x8d6e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8d6e('0x6'))(_0x8d6e('0x7'));var config=require(_0x8d6e('0x8'));var jayson=require(_0x8d6e('0x9'));var client=jayson[_0x8d6e('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x8d6e('0xb')],{'host':_0x8d6e('0xc'),'port':0x18eb});var socket=require(_0x8d6e('0xd'))(new Redis(config[_0x8d6e('0xb')]));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x42d7b8,_0xdce52d,_0x1fa5ce){return new BPromise(function(_0x46e011,_0xfef7a1){return client[_0x8d6e('0xe')](_0x42d7b8,_0x1fa5ce)[_0x8d6e('0xf')](function(_0x5e47e1){logger[_0x8d6e('0x10')]('Dashboard,\x20%s,\x20%s',_0xdce52d,_0x8d6e('0x11'));logger[_0x8d6e('0x12')](_0x8d6e('0x13'),_0xdce52d,_0x8d6e('0x11'),JSON['stringify'](_0x5e47e1));if(_0x5e47e1[_0x8d6e('0x14')]){if(_0x5e47e1[_0x8d6e('0x14')][_0x8d6e('0x15')]===0x1f4){logger[_0x8d6e('0x14')]('Dashboard,\x20%s,\x20%s',_0xdce52d,_0x5e47e1['error']['message']);return _0xfef7a1(_0x5e47e1[_0x8d6e('0x14')][_0x8d6e('0x16')]);}logger['error'](_0x8d6e('0x17'),_0xdce52d,_0x5e47e1[_0x8d6e('0x14')][_0x8d6e('0x16')]);return _0x46e011(_0x5e47e1[_0x8d6e('0x14')][_0x8d6e('0x16')]);}else{logger[_0x8d6e('0x10')]('Dashboard,\x20%s,\x20%s',_0xdce52d,'request\x20sent');_0x46e011(_0x5e47e1['result']['message']);}})[_0x8d6e('0x18')](function(_0x174200){logger[_0x8d6e('0x14')](_0x8d6e('0x17'),_0xdce52d,_0x174200);_0xfef7a1(_0x174200);});});} \ No newline at end of file +var _0xe8fd=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x2a5310,_0x41dfcf){var _0x144037=function(_0xe6447f){while(--_0xe6447f){_0x2a5310['push'](_0x2a5310['shift']());}};_0x144037(++_0x41dfcf);}(_0xe8fd,0xa9));var _0xde8f=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xe8fd[_0x2642cb];return _0xe6e41;};'use strict';var _=require(_0xde8f('0x0'));var util=require(_0xde8f('0x1'));var moment=require(_0xde8f('0x2'));var BPromise=require(_0xde8f('0x3'));var rs=require(_0xde8f('0x4'));var fs=require('fs');var Redis=require(_0xde8f('0x5'));var db=require(_0xde8f('0x6'))['db'];var utils=require(_0xde8f('0x7'));var logger=require('../../config/logger')(_0xde8f('0x8'));var config=require('../../config/environment');var jayson=require(_0xde8f('0x9'));var client=jayson[_0xde8f('0xa')][_0xde8f('0xb')]({'port':0x232a});config[_0xde8f('0xc')]=_[_0xde8f('0xd')](config[_0xde8f('0xc')],{'host':_0xde8f('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xde8f('0xc')]));require(_0xde8f('0xf'))[_0xde8f('0x10')](socket);function respondWithRpcPromise(_0x1dd737,_0x178889,_0x4ac7ef){return new BPromise(function(_0x514258,_0x1c56ad){return client[_0xde8f('0x11')](_0x1dd737,_0x4ac7ef)[_0xde8f('0x12')](function(_0x4fb03a){logger[_0xde8f('0x13')](_0xde8f('0x14'),_0x178889,_0xde8f('0x15'));logger[_0xde8f('0x16')](_0xde8f('0x17'),_0x178889,_0xde8f('0x15'),JSON['stringify'](_0x4fb03a));if(_0x4fb03a[_0xde8f('0x18')]){if(_0x4fb03a[_0xde8f('0x18')][_0xde8f('0x19')]===0x1f4){logger[_0xde8f('0x18')](_0xde8f('0x14'),_0x178889,_0x4fb03a[_0xde8f('0x18')][_0xde8f('0x1a')]);return _0x1c56ad(_0x4fb03a[_0xde8f('0x18')][_0xde8f('0x1a')]);}logger[_0xde8f('0x18')](_0xde8f('0x14'),_0x178889,_0x4fb03a[_0xde8f('0x18')][_0xde8f('0x1a')]);return _0x514258(_0x4fb03a[_0xde8f('0x18')][_0xde8f('0x1a')]);}else{logger['info'](_0xde8f('0x14'),_0x178889,_0xde8f('0x15'));_0x514258(_0x4fb03a[_0xde8f('0x1b')][_0xde8f('0x1a')]);}})[_0xde8f('0x1c')](function(_0x32eae8){logger[_0xde8f('0x18')]('Dashboard,\x20%s,\x20%s',_0x178889,_0x32eae8);_0x1c56ad(_0x32eae8);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index ff6ae4e..96a3c4d 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 _0xb2da=['dashboard:','./dashboard.events','save','remove','update','emit','removeListener'];(function(_0x5071a6,_0x5e183c){var _0xddda8b=function(_0x4be059){while(--_0x4be059){_0x5071a6['push'](_0x5071a6['shift']());}};_0xddda8b(++_0x5e183c);}(_0xb2da,0xe1));var _0xab2d=function(_0x39707b,_0x2caf4d){_0x39707b=_0x39707b-0x0;var _0xd9864b=_0xb2da[_0x39707b];return _0xd9864b;};'use strict';var DashboardEvents=require(_0xab2d('0x0'));var events=[_0xab2d('0x1'),_0xab2d('0x2'),_0xab2d('0x3')];function createListener(_0x555bcf,_0x1f9d9f){return function(_0xa6b230){_0x1f9d9f[_0xab2d('0x4')](_0x555bcf,_0xa6b230);};}function removeListener(_0x204044,_0x49f080){return function(){DashboardEvents[_0xab2d('0x5')](_0x204044,_0x49f080);};}exports['register']=function(_0x3da2fb){for(var _0x32f89a=0x0,_0x5b7808=events['length'];_0x32f89a<_0x5b7808;_0x32f89a++){var _0x555b8b=events[_0x32f89a];var _0x3fd57e=createListener(_0xab2d('0x6')+_0x555b8b,_0x3da2fb);DashboardEvents['on'](_0x555b8b,_0x3fd57e);}}; \ No newline at end of file +var _0x7cc5=['removeListener','register','length','./dashboard.events','save','remove','update','emit'];(function(_0x3b1e3f,_0xf8826b){var _0x3b1cd3=function(_0x26ad44){while(--_0x26ad44){_0x3b1e3f['push'](_0x3b1e3f['shift']());}};_0x3b1cd3(++_0xf8826b);}(_0x7cc5,0xfb));var _0x57cc=function(_0x2ec593,_0x167967){_0x2ec593=_0x2ec593-0x0;var _0x1a9f9e=_0x7cc5[_0x2ec593];return _0x1a9f9e;};'use strict';var DashboardEvents=require(_0x57cc('0x0'));var events=[_0x57cc('0x1'),_0x57cc('0x2'),_0x57cc('0x3')];function createListener(_0x425fc3,_0x40b909){return function(_0xef78c2){_0x40b909[_0x57cc('0x4')](_0x425fc3,_0xef78c2);};}function removeListener(_0x2f57f0,_0x513665){return function(){DashboardEvents[_0x57cc('0x5')](_0x2f57f0,_0x513665);};}exports[_0x57cc('0x6')]=function(_0x18fb36){for(var _0x1a96b0=0x0,_0x346649=events[_0x57cc('0x7')];_0x1a96b0<_0x346649;_0x1a96b0++){var _0x5b6b7f=events[_0x1a96b0];var _0x253b00=createListener('dashboard:'+_0x5b6b7f,_0x18fb36);DashboardEvents['on'](_0x5b6b7f,_0x253b00);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index a4c4466..70f07da 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 _0x316c=['/:id/items','getItems','post','create','/:id/clone','clone','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x316c,0x155));var _0xc316=function(_0x4a6e52,_0x1d0089){_0x4a6e52=_0x4a6e52-0x0;var _0x49dc4b=_0x316c[_0x4a6e52];return _0x49dc4b;};'use strict';var multer=require(_0xc316('0x0'));var util=require(_0xc316('0x1'));var path=require(_0xc316('0x2'));var timeout=require(_0xc316('0x3'));var express=require(_0xc316('0x4'));var router=express[_0xc316('0x5')]();var fs_extra=require(_0xc316('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc316('0x7'));var config=require(_0xc316('0x8'));var controller=require('./dashboard.controller');router['get']('/',auth[_0xc316('0x9')](),controller['index']);router[_0xc316('0xa')]('/:id',auth[_0xc316('0x9')](),controller['show']);router[_0xc316('0xa')](_0xc316('0xb'),auth['isAuthenticated'](),controller[_0xc316('0xc')]);router[_0xc316('0xd')]('/',auth[_0xc316('0x9')](),controller[_0xc316('0xe')]);router['post'](_0xc316('0xf'),auth['isAuthenticated'](),controller[_0xc316('0x10')]);router[_0xc316('0xd')](_0xc316('0xb'),auth[_0xc316('0x9')](),controller['addItem']);router[_0xc316('0x11')](_0xc316('0x12'),auth['isAuthenticated'](),controller[_0xc316('0x13')]);router[_0xc316('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xc316('0x15')]);module['exports']=router; \ No newline at end of file +var _0x5c12=['Router','fs-extra','../../components/interaction/service','./dashboard.controller','isAuthenticated','index','get','/:id','/:id/items','post','/:id/clone','clone','update','delete','exports','multer','path','express'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x5c12,0x12f));var _0x25c1=function(_0x3a2e49,_0x21ebea){_0x3a2e49=_0x3a2e49-0x0;var _0x257140=_0x5c12[_0x3a2e49];return _0x257140;};'use strict';var multer=require(_0x25c1('0x0'));var util=require('util');var path=require(_0x25c1('0x1'));var timeout=require('connect-timeout');var express=require(_0x25c1('0x2'));var router=express[_0x25c1('0x3')]();var fs_extra=require(_0x25c1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x25c1('0x5'));var config=require('../../config/environment');var controller=require(_0x25c1('0x6'));router['get']('/',auth[_0x25c1('0x7')](),controller[_0x25c1('0x8')]);router[_0x25c1('0x9')](_0x25c1('0xa'),auth[_0x25c1('0x7')](),controller['show']);router[_0x25c1('0x9')](_0x25c1('0xb'),auth[_0x25c1('0x7')](),controller['getItems']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x25c1('0xc')](_0x25c1('0xd'),auth[_0x25c1('0x7')](),controller[_0x25c1('0xe')]);router[_0x25c1('0xc')]('/:id/items',auth[_0x25c1('0x7')](),controller['addItem']);router['put'](_0x25c1('0xa'),auth[_0x25c1('0x7')](),controller[_0x25c1('0xf')]);router[_0x25c1('0x10')]('/:id',auth[_0x25c1('0x7')](),controller['destroy']);module[_0x25c1('0x11')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 606063c..ba31bde 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 _0xdbf5=['squel','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff'];(function(_0x186547,_0xad5ab4){var _0xb9e99=function(_0x29404c){while(--_0x29404c){_0x186547['push'](_0x186547['shift']());}};_0xb9e99(++_0xad5ab4);}(_0xdbf5,0x18c));var _0x5dbf=function(_0xec2f4e,_0x153d52){_0xec2f4e=_0xec2f4e-0x0;var _0x1ea6db=_0xdbf5[_0xec2f4e];return _0x1ea6db;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x5dbf('0x0'));var _=require('lodash');module['exports']={'title':{'type':Sequelize[_0x5dbf('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5dbf('0x1')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x5dbf('0x2')](_0x5dbf('0x3')),'get':function(){try{return JSON[_0x5dbf('0x4')](this[_0x5dbf('0x5')](_0x5dbf('0x6')));}catch(_0x1decd2){return[];}},'set':function(_0x3f8628){try{this[_0x5dbf('0x7')](_0x5dbf('0x6'),JSON[_0x5dbf('0x8')](_0x3f8628));}catch(_0x93e657){this['setDataValue'](_0x5dbf('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x5dbf('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x5dbf('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5dbf('0x9')]},'col':{'type':Sequelize[_0x5dbf('0x9')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5dbf('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5dbf('0x1')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x687b=['sequelize','squel','lodash','exports','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','STRING','#ffffff','#2196f3'];(function(_0x6ff99f,_0x234351){var _0xecc8c2=function(_0x50b591){while(--_0x50b591){_0x6ff99f['push'](_0x6ff99f['shift']());}};_0xecc8c2(++_0x234351);}(_0x687b,0x14a));var _0xb687=function(_0x54b719,_0x39ade5){_0x54b719=_0x54b719-0x0;var _0x31edd9=_0x687b[_0x54b719];return _0x31edd9;};'use strict';var Sequelize=require(_0xb687('0x0'));var squel=require(_0xb687('0x1'));var _=require(_0xb687('0x2'));module[_0xb687('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xb687('0x4')](_0xb687('0x5')),'get':function(){try{return JSON[_0xb687('0x6')](this[_0xb687('0x7')](_0xb687('0x8')));}catch(_0x194c55){return[];}},'set':function(_0x16ccf3){try{this[_0xb687('0x9')](_0xb687('0x8'),JSON[_0xb687('0xa')](_0x16ccf3));}catch(_0x48942b){this[_0xb687('0x9')](_0xb687('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xb687('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb687('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xb687('0xb')]},'col':{'type':Sequelize[_0xb687('0xb')]},'background':{'type':Sequelize[_0xb687('0xc')],'allowNull':![],'defaultValue':_0xb687('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xb687('0xc')],'allowNull':![],'defaultValue':_0xb687('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xb687('0xc')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 49e1b8d..c6f9db1 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 _0x6d19=['error','stack','name','send','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','DashboardItem','find','catch','destroy','iframe','attrUrl','attrs','value','https://','attrPath','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then'];(function(_0x3246a6,_0x2a685a){var _0x1df64d=function(_0x4868ad){while(--_0x4868ad){_0x3246a6['push'](_0x3246a6['shift']());}};_0x1df64d(++_0x2a685a);}(_0x6d19,0x160));var _0x96d1=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x6d19[_0x2b9b7f];return _0x4ed19a;};'use strict';var emlformat=require(_0x96d1('0x0'));var rimraf=require(_0x96d1('0x1'));var zipdir=require(_0x96d1('0x2'));var jsonpatch=require(_0x96d1('0x3'));var rp=require(_0x96d1('0x4'));var moment=require(_0x96d1('0x5'));var BPromise=require(_0x96d1('0x6'));var Mustache=require('mustache');var util=require(_0x96d1('0x7'));var path=require(_0x96d1('0x8'));var sox=require(_0x96d1('0x9'));var csv=require(_0x96d1('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x96d1('0xb'));var _=require(_0x96d1('0xc'));var squel=require(_0x96d1('0xd'));var crypto=require('crypto');var jsforce=require(_0x96d1('0xe'));var deskjs=require(_0x96d1('0xf'));var toCsv=require(_0x96d1('0xa'));var querystring=require(_0x96d1('0x10'));var Papa=require(_0x96d1('0x11'));var Redis=require(_0x96d1('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x96d1('0x13'));var hardwareService=require(_0x96d1('0x14'));var logger=require('../../config/logger')(_0x96d1('0x15'));var utils=require('../../config/utils');var config=require(_0x96d1('0x16'));var licenseUtil=require(_0x96d1('0x17'));var db=require(_0x96d1('0x18'))['db'];config[_0x96d1('0x19')]=_[_0x96d1('0x1a')](config[_0x96d1('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x96d1('0x1b'))(new Redis(config[_0x96d1('0x19')]));require(_0x96d1('0x1c'))[_0x96d1('0x1d')](socket);function respondWithStatusCode(_0x2fd5c6,_0x5a9e7d){_0x5a9e7d=_0x5a9e7d||0xcc;return function(_0x52e614){if(_0x52e614){return _0x2fd5c6[_0x96d1('0x1e')](_0x5a9e7d);}return _0x2fd5c6[_0x96d1('0x1f')](_0x5a9e7d)[_0x96d1('0x20')]();};}function respondWithResult(_0x9eb2c4,_0x2d521d){_0x2d521d=_0x2d521d||0xc8;return function(_0x3e9a0){if(_0x3e9a0){return _0x9eb2c4[_0x96d1('0x1f')](_0x2d521d)[_0x96d1('0x21')](_0x3e9a0);}};}function respondWithFilteredResult(_0x913482,_0x5853f0){return function(_0x18c73f){if(_0x18c73f){var _0x1c3540=typeof _0x5853f0[_0x96d1('0x22')]===_0x96d1('0x23')&&typeof _0x5853f0[_0x96d1('0x24')]==='undefined';var _0x3c605a=_0x18c73f[_0x96d1('0x25')];var _0x28b2aa=_0x1c3540?0x0:_0x5853f0[_0x96d1('0x22')];var _0x5866e9=_0x1c3540?_0x18c73f[_0x96d1('0x25')]:_0x5853f0[_0x96d1('0x22')]+_0x5853f0[_0x96d1('0x24')];var _0x31a7e5;if(_0x5866e9>=_0x3c605a){_0x5866e9=_0x3c605a;_0x31a7e5=0xc8;}else{_0x31a7e5=0xce;}_0x913482['status'](_0x31a7e5);return _0x913482[_0x96d1('0x26')](_0x96d1('0x27'),_0x28b2aa+'-'+_0x5866e9+'/'+_0x3c605a)[_0x96d1('0x21')](_0x18c73f);}return null;};}function patchUpdates(_0x1390ac){return function(_0x5a0584){try{jsonpatch[_0x96d1('0x28')](_0x5a0584,_0x1390ac,!![]);}catch(_0x38f350){return BPromise['reject'](_0x38f350);}return _0x5a0584[_0x96d1('0x29')]();};}function saveUpdates(_0x29ea83,_0x54c824){return function(_0x1130ba){if(_0x1130ba){return _0x1130ba[_0x96d1('0x2a')](_0x29ea83)[_0x96d1('0x2b')](function(_0x5462ec){return _0x5462ec;});}return null;};}function removeEntity(_0x424d1e,_0x46aa64){return function(_0x7e7006){if(_0x7e7006){return _0x7e7006['destroy']()['then'](function(){_0x424d1e[_0x96d1('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3728c8,_0x274dcd){return function(_0x267efc){if(!_0x267efc){_0x3728c8[_0x96d1('0x1e')](0x194);}return _0x267efc;};}function handleError(_0x3bfde7,_0x4eb09a){_0x4eb09a=_0x4eb09a||0x1f4;return function(_0x1b42a0){logger[_0x96d1('0x2c')](_0x1b42a0[_0x96d1('0x2d')]);if(_0x1b42a0[_0x96d1('0x2e')]){delete _0x1b42a0[_0x96d1('0x2e')];}_0x3bfde7[_0x96d1('0x1f')](_0x4eb09a)[_0x96d1('0x2f')](_0x1b42a0);};}exports['show']=function(_0x59749e,_0x7ee767){var _0x266d2c={'raw':![],'where':{'id':_0x59749e[_0x96d1('0x30')]['id']}},_0x3968f5={};_0x3968f5[_0x96d1('0x31')]=_[_0x96d1('0x32')](db['DashboardItem'][_0x96d1('0x33')]);_0x3968f5[_0x96d1('0x34')]=_[_0x96d1('0x32')](_0x59749e[_0x96d1('0x34')]);_0x3968f5[_0x96d1('0x35')]=_[_0x96d1('0x36')](_0x3968f5['model'],_0x3968f5[_0x96d1('0x34')]);_0x266d2c[_0x96d1('0x37')]=_[_0x96d1('0x36')](_0x3968f5[_0x96d1('0x31')],qs[_0x96d1('0x38')](_0x59749e[_0x96d1('0x34')]['fields']));_0x266d2c[_0x96d1('0x37')]=_0x266d2c['attributes']['length']?_0x266d2c['attributes']:_0x3968f5[_0x96d1('0x31')];if(_0x59749e[_0x96d1('0x34')][_0x96d1('0x39')]){_0x266d2c[_0x96d1('0x3a')]=[{'all':!![]}];}_0x266d2c=_[_0x96d1('0x3b')]({},_0x266d2c,_0x59749e['options']);return db[_0x96d1('0x3c')][_0x96d1('0x3d')](_0x266d2c)[_0x96d1('0x2b')](handleEntityNotFound(_0x7ee767,null))[_0x96d1('0x2b')](respondWithResult(_0x7ee767,null))[_0x96d1('0x3e')](handleError(_0x7ee767,null));};exports[_0x96d1('0x3f')]=function(_0x4b22c1,_0x2b8273){return db[_0x96d1('0x3c')][_0x96d1('0x3d')]({'where':{'id':_0x4b22c1[_0x96d1('0x30')]['id']}})[_0x96d1('0x2b')](handleEntityNotFound(_0x2b8273,null))[_0x96d1('0x2b')](removeEntity(_0x2b8273,null))[_0x96d1('0x3e')](handleError(_0x2b8273,null));};function widgetAttributes(_0x4d70be){try{switch(_0x4d70be['type']){case _0x96d1('0x40'):return[{'name':_0x96d1('0x41'),'value':_0x4d70be[_0x96d1('0x41')]||(_0x4d70be[_0x96d1('0x42')]&&_0x4d70be[_0x96d1('0x42')][0x0]?_0x4d70be['attrs'][0x0][_0x96d1('0x43')]:undefined)||_0x96d1('0x44')}];case'custom':return[{'name':_0x96d1('0x45'),'value':_0x4d70be[_0x96d1('0x45')]||(_0x4d70be[_0x96d1('0x42')]&&_0x4d70be[_0x96d1('0x42')][0x0]?_0x4d70be['attrs'][0x0][_0x96d1('0x43')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x4d70be[_0x96d1('0x46')]||(_0x4d70be[_0x96d1('0x42')]&&_0x4d70be['attrs'][0x0]?_0x4d70be['attrs'][0x0][_0x96d1('0x43')]:undefined)||'HH:mm:ss'},{'name':_0x96d1('0x47'),'value':_0x4d70be['attrTimezone']||(_0x4d70be[_0x96d1('0x42')]&&_0x4d70be['attrs'][0x1]?_0x4d70be[_0x96d1('0x42')][0x1]['value']:undefined)||'0.00'},{'name':_0x96d1('0x48'),'value':_0x4d70be['attrFontSize']||(_0x4d70be['attrs']&&_0x4d70be[_0x96d1('0x42')][0x2]?_0x4d70be[_0x96d1('0x42')][0x2][_0x96d1('0x43')]:undefined)||0xc}];case _0x96d1('0x49'):return[{'name':_0x96d1('0x4a'),'value':_0x4d70be['attrMetric']||(_0x4d70be['attrs']&&_0x4d70be['attrs'][0x0]?_0x4d70be[_0x96d1('0x42')][0x0][_0x96d1('0x43')]:undefined)||_0x96d1('0x4b')},{'name':_0x96d1('0x4c'),'value':_0x4d70be[_0x96d1('0x4c')]||(_0x4d70be[_0x96d1('0x42')]&&_0x4d70be['attrs'][0x1]?_0x4d70be['attrs'][0x1][_0x96d1('0x43')]:undefined)||[]},{'name':_0x96d1('0x48'),'value':_0x4d70be[_0x96d1('0x48')]||(_0x4d70be[_0x96d1('0x42')]&&_0x4d70be[_0x96d1('0x42')][0x2]?_0x4d70be[_0x96d1('0x42')][0x2][_0x96d1('0x43')]:undefined)||0x14},{'name':_0x96d1('0x4d'),'value':_0x4d70be['attrChannel']||(_0x4d70be['attrs']&&_0x4d70be[_0x96d1('0x42')][0x3]?_0x4d70be[_0x96d1('0x42')][0x3]['value']:undefined)||_0x96d1('0x4e')},{'name':'attrEmailAccounts','value':_0x4d70be[_0x96d1('0x4f')]||(_0x4d70be[_0x96d1('0x42')]&&_0x4d70be[_0x96d1('0x42')][0x4]?_0x4d70be[_0x96d1('0x42')][0x4][_0x96d1('0x43')]:undefined)||''},{'name':_0x96d1('0x50'),'value':_0x4d70be['attrFaxAccounts']||(_0x4d70be[_0x96d1('0x42')]&&_0x4d70be[_0x96d1('0x42')][0x5]?_0x4d70be['attrs'][0x5][_0x96d1('0x43')]:undefined)||''},{'name':_0x96d1('0x51'),'value':_0x4d70be[_0x96d1('0x51')]||(_0x4d70be[_0x96d1('0x42')]&&_0x4d70be[_0x96d1('0x42')][0x6]?_0x4d70be[_0x96d1('0x42')][0x6][_0x96d1('0x43')]:undefined)||''},{'name':_0x96d1('0x52'),'value':_0x4d70be[_0x96d1('0x52')]||(_0x4d70be[_0x96d1('0x42')]&&_0x4d70be[_0x96d1('0x42')][0x7]?_0x4d70be[_0x96d1('0x42')][0x7][_0x96d1('0x43')]:undefined)||''},{'name':_0x96d1('0x53'),'value':_0x4d70be['attrWhatsappAccounts']||(_0x4d70be[_0x96d1('0x42')]&&_0x4d70be[_0x96d1('0x42')][0x8]?_0x4d70be[_0x96d1('0x42')][0x8][_0x96d1('0x43')]:undefined)||''},{'name':_0x96d1('0x54'),'value':_0x4d70be[_0x96d1('0x54')]||(_0x4d70be['attrs']&&_0x4d70be[_0x96d1('0x42')][0x9]?_0x4d70be[_0x96d1('0x42')][0x9]['value']:undefined)||''}];case _0x96d1('0x55'):case _0x96d1('0x56'):return[{'name':_0x96d1('0x57'),'value':_0x4d70be['attrSerie1']||(_0x4d70be[_0x96d1('0x42')]&&_0x4d70be['attrs'][0x0]?_0x4d70be[_0x96d1('0x42')][0x0]['value']:undefined)||_0x96d1('0x4b')},{'name':_0x96d1('0x58'),'value':_0x4d70be[_0x96d1('0x58')]||(_0x4d70be[_0x96d1('0x42')]&&_0x4d70be[_0x96d1('0x42')][0x1]?_0x4d70be['attrs'][0x1][_0x96d1('0x43')]:undefined)||null},{'name':_0x96d1('0x59'),'value':_0x4d70be[_0x96d1('0x59')]||(_0x4d70be['attrs']&&_0x4d70be[_0x96d1('0x42')][0x2]?_0x4d70be[_0x96d1('0x42')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x4d70be[_0x96d1('0x4c')]||(_0x4d70be[_0x96d1('0x42')]&&_0x4d70be[_0x96d1('0x42')][0x3]?_0x4d70be['attrs'][0x3][_0x96d1('0x43')]:undefined)||[]},{'name':'attrChannel','value':_0x4d70be[_0x96d1('0x4d')]||(_0x4d70be[_0x96d1('0x42')]&&_0x4d70be[_0x96d1('0x42')][0x4]?_0x4d70be['attrs'][0x4][_0x96d1('0x43')]:undefined)||_0x96d1('0x4e')},{'name':_0x96d1('0x4f'),'value':_0x4d70be[_0x96d1('0x4f')]||(_0x4d70be[_0x96d1('0x42')]&&_0x4d70be[_0x96d1('0x42')][0x5]?_0x4d70be[_0x96d1('0x42')][0x5][_0x96d1('0x43')]:undefined)||''},{'name':_0x96d1('0x50'),'value':_0x4d70be['attrFaxAccounts']||(_0x4d70be[_0x96d1('0x42')]&&_0x4d70be[_0x96d1('0x42')][0x6]?_0x4d70be[_0x96d1('0x42')][0x6][_0x96d1('0x43')]:undefined)||''},{'name':_0x96d1('0x51'),'value':_0x4d70be[_0x96d1('0x51')]||(_0x4d70be[_0x96d1('0x42')]&&_0x4d70be[_0x96d1('0x42')][0x7]?_0x4d70be[_0x96d1('0x42')][0x7]['value']:undefined)||''},{'name':_0x96d1('0x52'),'value':_0x4d70be[_0x96d1('0x52')]||(_0x4d70be[_0x96d1('0x42')]&&_0x4d70be['attrs'][0x8]?_0x4d70be['attrs'][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x4d70be[_0x96d1('0x53')]||(_0x4d70be[_0x96d1('0x42')]&&_0x4d70be[_0x96d1('0x42')][0x9]?_0x4d70be[_0x96d1('0x42')][0x9][_0x96d1('0x43')]:undefined)||''},{'name':_0x96d1('0x54'),'value':_0x4d70be['attrChatWebsites']||(_0x4d70be[_0x96d1('0x42')]&&_0x4d70be[_0x96d1('0x42')][0xa]?_0x4d70be[_0x96d1('0x42')][0xa][_0x96d1('0x43')]:undefined)||''}];case _0x96d1('0x5a'):return[{'name':_0x96d1('0x5b'),'type':_0x4d70be[_0x96d1('0x5c')]||(_0x4d70be[_0x96d1('0x42')]&&_0x4d70be[_0x96d1('0x42')][0x0]?_0x4d70be[_0x96d1('0x42')][0x0][_0x96d1('0x5d')]:undefined)||null,'value':_0x4d70be['attrReport']||(_0x4d70be['attrs']&&_0x4d70be[_0x96d1('0x42')][0x0]?_0x4d70be[_0x96d1('0x42')][0x0][_0x96d1('0x43')]:undefined)||null},{'name':_0x96d1('0x5e'),'value':_0x4d70be[_0x96d1('0x5e')]||(_0x4d70be[_0x96d1('0x42')]&&_0x4d70be[_0x96d1('0x42')][0x1]?_0x4d70be[_0x96d1('0x42')][0x1][_0x96d1('0x43')]:undefined)||0x0}];default:return[];}}catch(_0x54f377){logger['error'](_0x96d1('0x5f'),JSON[_0x96d1('0x60')](_0x54f377));return[];}}exports[_0x96d1('0x61')]=function(_0x34b6db,_0x253dd4){if(_0x34b6db[_0x96d1('0x62')]){_0x34b6db[_0x96d1('0x62')][_0x96d1('0x42')]=widgetAttributes(_0x34b6db[_0x96d1('0x62')]);}return db[_0x96d1('0x3c')][_0x96d1('0x61')](_0x34b6db['body'],{})[_0x96d1('0x2b')](respondWithResult(_0x253dd4,0xc9))[_0x96d1('0x3e')](handleError(_0x253dd4,null));};exports[_0x96d1('0x2a')]=function(_0x67548,_0x1d2d8a){if(_0x67548[_0x96d1('0x62')]['id']){delete _0x67548[_0x96d1('0x62')]['id'];}_0x67548[_0x96d1('0x62')]['attrs']=widgetAttributes(_0x67548['body']);return db[_0x96d1('0x3c')][_0x96d1('0x3d')]({'where':{'id':_0x67548['params']['id']}})[_0x96d1('0x2b')](handleEntityNotFound(_0x1d2d8a,null))[_0x96d1('0x2b')](saveUpdates(_0x67548[_0x96d1('0x62')],null))['then'](respondWithResult(_0x1d2d8a,null))['catch'](handleError(_0x1d2d8a,null));}; \ No newline at end of file +var _0xb073=['attrSerie3','attrReport','reportType','attrRefresh','stringify','create','body','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','register','sendStatus','status','end','limit','count','offset','set','json','save','update','destroy','then','error','send','show','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','model','fields','length','includeAll','merge','options','catch','find','params','type','iframe','attrUrl','attrs','https://','custom','attrPath','value','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2'];(function(_0x2a357d,_0x1a1a19){var _0x429b9c=function(_0x4f70e1){while(--_0x4f70e1){_0x2a357d['push'](_0x2a357d['shift']());}};_0x429b9c(++_0x1a1a19);}(_0xb073,0x187));var _0x3b07=function(_0x48ebe8,_0x300832){_0x48ebe8=_0x48ebe8-0x0;var _0x5c65fb=_0xb073[_0x48ebe8];return _0x5c65fb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3b07('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3b07('0x1'));var rp=require(_0x3b07('0x2'));var moment=require(_0x3b07('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3b07('0x4'));var util=require(_0x3b07('0x5'));var path=require(_0x3b07('0x6'));var sox=require('sox');var csv=require(_0x3b07('0x7'));var ejs=require(_0x3b07('0x8'));var fs=require('fs');var fs_extra=require(_0x3b07('0x9'));var _=require(_0x3b07('0xa'));var squel=require(_0x3b07('0xb'));var crypto=require(_0x3b07('0xc'));var jsforce=require(_0x3b07('0xd'));var deskjs=require(_0x3b07('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3b07('0xf'));var Redis=require(_0x3b07('0x10'));var authService=require(_0x3b07('0x11'));var qs=require(_0x3b07('0x12'));var as=require(_0x3b07('0x13'));var hardwareService=require(_0x3b07('0x14'));var logger=require(_0x3b07('0x15'))(_0x3b07('0x16'));var utils=require(_0x3b07('0x17'));var config=require(_0x3b07('0x18'));var licenseUtil=require(_0x3b07('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x3b07('0x1a')](config[_0x3b07('0x1b')],{'host':_0x3b07('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3b07('0x1b')]));require('./dashboardItem.socket')[_0x3b07('0x1d')](socket);function respondWithStatusCode(_0x589d65,_0x2d3151){_0x2d3151=_0x2d3151||0xcc;return function(_0xad5aaa){if(_0xad5aaa){return _0x589d65[_0x3b07('0x1e')](_0x2d3151);}return _0x589d65[_0x3b07('0x1f')](_0x2d3151)[_0x3b07('0x20')]();};}function respondWithResult(_0x33d648,_0x4560db){_0x4560db=_0x4560db||0xc8;return function(_0x268f0b){if(_0x268f0b){return _0x33d648['status'](_0x4560db)['json'](_0x268f0b);}};}function respondWithFilteredResult(_0x5e956d,_0x318a17){return function(_0x227afa){if(_0x227afa){var _0x4d28a0=typeof _0x318a17['offset']==='undefined'&&typeof _0x318a17[_0x3b07('0x21')]==='undefined';var _0x5bd380=_0x227afa[_0x3b07('0x22')];var _0x3b66ff=_0x4d28a0?0x0:_0x318a17[_0x3b07('0x23')];var _0x46f659=_0x4d28a0?_0x227afa[_0x3b07('0x22')]:_0x318a17[_0x3b07('0x23')]+_0x318a17[_0x3b07('0x21')];var _0x1e2713;if(_0x46f659>=_0x5bd380){_0x46f659=_0x5bd380;_0x1e2713=0xc8;}else{_0x1e2713=0xce;}_0x5e956d[_0x3b07('0x1f')](_0x1e2713);return _0x5e956d[_0x3b07('0x24')]('Content-Range',_0x3b66ff+'-'+_0x46f659+'/'+_0x5bd380)[_0x3b07('0x25')](_0x227afa);}return null;};}function patchUpdates(_0x4c7117){return function(_0x367064){try{jsonpatch['apply'](_0x367064,_0x4c7117,!![]);}catch(_0x20969e){return BPromise['reject'](_0x20969e);}return _0x367064[_0x3b07('0x26')]();};}function saveUpdates(_0x1e9d62,_0x42123f){return function(_0x4bd5f9){if(_0x4bd5f9){return _0x4bd5f9[_0x3b07('0x27')](_0x1e9d62)['then'](function(_0x248e4e){return _0x248e4e;});}return null;};}function removeEntity(_0x503dea,_0xbb8016){return function(_0x33e124){if(_0x33e124){return _0x33e124[_0x3b07('0x28')]()[_0x3b07('0x29')](function(){_0x503dea[_0x3b07('0x1f')](0xcc)[_0x3b07('0x20')]();});}};}function handleEntityNotFound(_0x43d50f,_0x4a67c3){return function(_0x2b3c96){if(!_0x2b3c96){_0x43d50f[_0x3b07('0x1e')](0x194);}return _0x2b3c96;};}function handleError(_0xe738c7,_0x3fa1f5){_0x3fa1f5=_0x3fa1f5||0x1f4;return function(_0x15c1a1){logger[_0x3b07('0x2a')](_0x15c1a1['stack']);if(_0x15c1a1['name']){delete _0x15c1a1['name'];}_0xe738c7['status'](_0x3fa1f5)[_0x3b07('0x2b')](_0x15c1a1);};}exports[_0x3b07('0x2c')]=function(_0xbc12a2,_0x3ce8c6){var _0xe5fdc7={'raw':![],'where':{'id':_0xbc12a2['params']['id']}},_0x4491f2={};_0x4491f2['model']=_[_0x3b07('0x2d')](db[_0x3b07('0x2e')][_0x3b07('0x2f')]);_0x4491f2['query']=_[_0x3b07('0x2d')](_0xbc12a2[_0x3b07('0x30')]);_0x4491f2[_0x3b07('0x31')]=_[_0x3b07('0x32')](_0x4491f2['model'],_0x4491f2[_0x3b07('0x30')]);_0xe5fdc7[_0x3b07('0x33')]=_[_0x3b07('0x32')](_0x4491f2[_0x3b07('0x34')],qs['fields'](_0xbc12a2[_0x3b07('0x30')][_0x3b07('0x35')]));_0xe5fdc7[_0x3b07('0x33')]=_0xe5fdc7[_0x3b07('0x33')][_0x3b07('0x36')]?_0xe5fdc7[_0x3b07('0x33')]:_0x4491f2[_0x3b07('0x34')];if(_0xbc12a2[_0x3b07('0x30')][_0x3b07('0x37')]){_0xe5fdc7['include']=[{'all':!![]}];}_0xe5fdc7=_[_0x3b07('0x38')]({},_0xe5fdc7,_0xbc12a2[_0x3b07('0x39')]);return db[_0x3b07('0x2e')]['find'](_0xe5fdc7)['then'](handleEntityNotFound(_0x3ce8c6,null))[_0x3b07('0x29')](respondWithResult(_0x3ce8c6,null))[_0x3b07('0x3a')](handleError(_0x3ce8c6,null));};exports[_0x3b07('0x28')]=function(_0x12df56,_0x537ffe){return db[_0x3b07('0x2e')][_0x3b07('0x3b')]({'where':{'id':_0x12df56[_0x3b07('0x3c')]['id']}})['then'](handleEntityNotFound(_0x537ffe,null))[_0x3b07('0x29')](removeEntity(_0x537ffe,null))['catch'](handleError(_0x537ffe,null));};function widgetAttributes(_0x2ae8c6){try{switch(_0x2ae8c6[_0x3b07('0x3d')]){case _0x3b07('0x3e'):return[{'name':_0x3b07('0x3f'),'value':_0x2ae8c6[_0x3b07('0x3f')]||(_0x2ae8c6[_0x3b07('0x40')]&&_0x2ae8c6[_0x3b07('0x40')][0x0]?_0x2ae8c6[_0x3b07('0x40')][0x0]['value']:undefined)||_0x3b07('0x41')}];case _0x3b07('0x42'):return[{'name':'attrPath','value':_0x2ae8c6[_0x3b07('0x43')]||(_0x2ae8c6['attrs']&&_0x2ae8c6['attrs'][0x0]?_0x2ae8c6[_0x3b07('0x40')][0x0][_0x3b07('0x44')]:undefined)||''}];case'clock':return[{'name':_0x3b07('0x45'),'value':_0x2ae8c6[_0x3b07('0x45')]||(_0x2ae8c6[_0x3b07('0x40')]&&_0x2ae8c6[_0x3b07('0x40')][0x0]?_0x2ae8c6[_0x3b07('0x40')][0x0][_0x3b07('0x44')]:undefined)||_0x3b07('0x46')},{'name':_0x3b07('0x47'),'value':_0x2ae8c6[_0x3b07('0x47')]||(_0x2ae8c6[_0x3b07('0x40')]&&_0x2ae8c6['attrs'][0x1]?_0x2ae8c6['attrs'][0x1][_0x3b07('0x44')]:undefined)||_0x3b07('0x48')},{'name':_0x3b07('0x49'),'value':_0x2ae8c6['attrFontSize']||(_0x2ae8c6[_0x3b07('0x40')]&&_0x2ae8c6[_0x3b07('0x40')][0x2]?_0x2ae8c6[_0x3b07('0x40')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x2ae8c6[_0x3b07('0x4a')]||(_0x2ae8c6[_0x3b07('0x40')]&&_0x2ae8c6[_0x3b07('0x40')][0x0]?_0x2ae8c6[_0x3b07('0x40')][0x0][_0x3b07('0x44')]:undefined)||_0x3b07('0x4b')},{'name':_0x3b07('0x4c'),'value':_0x2ae8c6[_0x3b07('0x4c')]||(_0x2ae8c6[_0x3b07('0x40')]&&_0x2ae8c6['attrs'][0x1]?_0x2ae8c6[_0x3b07('0x40')][0x1][_0x3b07('0x44')]:undefined)||[]},{'name':_0x3b07('0x49'),'value':_0x2ae8c6[_0x3b07('0x49')]||(_0x2ae8c6['attrs']&&_0x2ae8c6[_0x3b07('0x40')][0x2]?_0x2ae8c6[_0x3b07('0x40')][0x2][_0x3b07('0x44')]:undefined)||0x14},{'name':'attrChannel','value':_0x2ae8c6[_0x3b07('0x4d')]||(_0x2ae8c6['attrs']&&_0x2ae8c6[_0x3b07('0x40')][0x3]?_0x2ae8c6[_0x3b07('0x40')][0x3]['value']:undefined)||_0x3b07('0x4e')},{'name':_0x3b07('0x4f'),'value':_0x2ae8c6['attrEmailAccounts']||(_0x2ae8c6[_0x3b07('0x40')]&&_0x2ae8c6[_0x3b07('0x40')][0x4]?_0x2ae8c6[_0x3b07('0x40')][0x4][_0x3b07('0x44')]:undefined)||''},{'name':_0x3b07('0x50'),'value':_0x2ae8c6['attrFaxAccounts']||(_0x2ae8c6[_0x3b07('0x40')]&&_0x2ae8c6['attrs'][0x5]?_0x2ae8c6[_0x3b07('0x40')][0x5][_0x3b07('0x44')]:undefined)||''},{'name':_0x3b07('0x51'),'value':_0x2ae8c6[_0x3b07('0x51')]||(_0x2ae8c6['attrs']&&_0x2ae8c6['attrs'][0x6]?_0x2ae8c6[_0x3b07('0x40')][0x6]['value']:undefined)||''},{'name':_0x3b07('0x52'),'value':_0x2ae8c6['attrOpenchannelAccounts']||(_0x2ae8c6[_0x3b07('0x40')]&&_0x2ae8c6[_0x3b07('0x40')][0x7]?_0x2ae8c6[_0x3b07('0x40')][0x7][_0x3b07('0x44')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2ae8c6[_0x3b07('0x53')]||(_0x2ae8c6[_0x3b07('0x40')]&&_0x2ae8c6[_0x3b07('0x40')][0x8]?_0x2ae8c6[_0x3b07('0x40')][0x8][_0x3b07('0x44')]:undefined)||''},{'name':_0x3b07('0x54'),'value':_0x2ae8c6[_0x3b07('0x54')]||(_0x2ae8c6[_0x3b07('0x40')]&&_0x2ae8c6['attrs'][0x9]?_0x2ae8c6[_0x3b07('0x40')][0x9][_0x3b07('0x44')]:undefined)||''}];case _0x3b07('0x55'):case _0x3b07('0x56'):return[{'name':_0x3b07('0x57'),'value':_0x2ae8c6['attrSerie1']||(_0x2ae8c6['attrs']&&_0x2ae8c6[_0x3b07('0x40')][0x0]?_0x2ae8c6[_0x3b07('0x40')][0x0][_0x3b07('0x44')]:undefined)||_0x3b07('0x4b')},{'name':'attrSerie2','value':_0x2ae8c6[_0x3b07('0x58')]||(_0x2ae8c6[_0x3b07('0x40')]&&_0x2ae8c6[_0x3b07('0x40')][0x1]?_0x2ae8c6[_0x3b07('0x40')][0x1][_0x3b07('0x44')]:undefined)||null},{'name':_0x3b07('0x59'),'value':_0x2ae8c6[_0x3b07('0x59')]||(_0x2ae8c6[_0x3b07('0x40')]&&_0x2ae8c6['attrs'][0x2]?_0x2ae8c6[_0x3b07('0x40')][0x2][_0x3b07('0x44')]:undefined)||null},{'name':_0x3b07('0x4c'),'value':_0x2ae8c6[_0x3b07('0x4c')]||(_0x2ae8c6[_0x3b07('0x40')]&&_0x2ae8c6['attrs'][0x3]?_0x2ae8c6[_0x3b07('0x40')][0x3]['value']:undefined)||[]},{'name':_0x3b07('0x4d'),'value':_0x2ae8c6['attrChannel']||(_0x2ae8c6[_0x3b07('0x40')]&&_0x2ae8c6[_0x3b07('0x40')][0x4]?_0x2ae8c6['attrs'][0x4][_0x3b07('0x44')]:undefined)||_0x3b07('0x4e')},{'name':_0x3b07('0x4f'),'value':_0x2ae8c6['attrEmailAccounts']||(_0x2ae8c6[_0x3b07('0x40')]&&_0x2ae8c6[_0x3b07('0x40')][0x5]?_0x2ae8c6[_0x3b07('0x40')][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x2ae8c6[_0x3b07('0x50')]||(_0x2ae8c6[_0x3b07('0x40')]&&_0x2ae8c6[_0x3b07('0x40')][0x6]?_0x2ae8c6[_0x3b07('0x40')][0x6][_0x3b07('0x44')]:undefined)||''},{'name':_0x3b07('0x51'),'value':_0x2ae8c6[_0x3b07('0x51')]||(_0x2ae8c6['attrs']&&_0x2ae8c6[_0x3b07('0x40')][0x7]?_0x2ae8c6[_0x3b07('0x40')][0x7]['value']:undefined)||''},{'name':_0x3b07('0x52'),'value':_0x2ae8c6[_0x3b07('0x52')]||(_0x2ae8c6[_0x3b07('0x40')]&&_0x2ae8c6[_0x3b07('0x40')][0x8]?_0x2ae8c6[_0x3b07('0x40')][0x8][_0x3b07('0x44')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2ae8c6[_0x3b07('0x53')]||(_0x2ae8c6[_0x3b07('0x40')]&&_0x2ae8c6[_0x3b07('0x40')][0x9]?_0x2ae8c6[_0x3b07('0x40')][0x9]['value']:undefined)||''},{'name':_0x3b07('0x54'),'value':_0x2ae8c6[_0x3b07('0x54')]||(_0x2ae8c6[_0x3b07('0x40')]&&_0x2ae8c6[_0x3b07('0x40')][0xa]?_0x2ae8c6['attrs'][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0x3b07('0x5a'),'type':_0x2ae8c6[_0x3b07('0x5b')]||(_0x2ae8c6['attrs']&&_0x2ae8c6[_0x3b07('0x40')][0x0]?_0x2ae8c6[_0x3b07('0x40')][0x0][_0x3b07('0x3d')]:undefined)||null,'value':_0x2ae8c6[_0x3b07('0x5a')]||(_0x2ae8c6[_0x3b07('0x40')]&&_0x2ae8c6[_0x3b07('0x40')][0x0]?_0x2ae8c6[_0x3b07('0x40')][0x0]['value']:undefined)||null},{'name':_0x3b07('0x5c'),'value':_0x2ae8c6[_0x3b07('0x5c')]||(_0x2ae8c6['attrs']&&_0x2ae8c6[_0x3b07('0x40')][0x1]?_0x2ae8c6[_0x3b07('0x40')][0x1][_0x3b07('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x25e50f){logger[_0x3b07('0x2a')]('widgetAttributes:\x20%s',JSON[_0x3b07('0x5d')](_0x25e50f));return[];}}exports[_0x3b07('0x5e')]=function(_0x50c803,_0x29856d){if(_0x50c803[_0x3b07('0x5f')]){_0x50c803['body']['attrs']=widgetAttributes(_0x50c803[_0x3b07('0x5f')]);}return db['DashboardItem'][_0x3b07('0x5e')](_0x50c803[_0x3b07('0x5f')],{})[_0x3b07('0x29')](respondWithResult(_0x29856d,0xc9))[_0x3b07('0x3a')](handleError(_0x29856d,null));};exports[_0x3b07('0x27')]=function(_0x265b8d,_0x53150b){if(_0x265b8d['body']['id']){delete _0x265b8d[_0x3b07('0x5f')]['id'];}_0x265b8d['body'][_0x3b07('0x40')]=widgetAttributes(_0x265b8d[_0x3b07('0x5f')]);return db[_0x3b07('0x2e')]['find']({'where':{'id':_0x265b8d['params']['id']}})[_0x3b07('0x29')](handleEntityNotFound(_0x53150b,null))[_0x3b07('0x29')](saveUpdates(_0x265b8d[_0x3b07('0x5f')],null))[_0x3b07('0x29')](respondWithResult(_0x53150b,null))['catch'](handleError(_0x53150b,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 86a5866..2bc88e0 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 _0x1675=['events','../../mysqldb','update','remove','emit','hasOwnProperty','exports'];(function(_0x50242d,_0x5eac09){var _0x1a26a6=function(_0x46ab24){while(--_0x46ab24){_0x50242d['push'](_0x50242d['shift']());}};_0x1a26a6(++_0x5eac09);}(_0x1675,0x1a4));var _0x5167=function(_0x2a61b0,_0x2c7e84){_0x2a61b0=_0x2a61b0-0x0;var _0x2a8b3a=_0x1675[_0x2a61b0];return _0x2a8b3a;};'use strict';var EventEmitter=require(_0x5167('0x0'));var DashboardItem=require(_0x5167('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5167('0x2'),'afterDestroy':_0x5167('0x3')};function emitEvent(_0x52756a){return function(_0x14858e,_0x215f25,_0x579174){DashboardItemEvents[_0x5167('0x4')](_0x52756a+':'+_0x14858e['id'],_0x14858e);DashboardItemEvents[_0x5167('0x4')](_0x52756a,_0x14858e);_0x579174(null);};}for(var e in events){if(events[_0x5167('0x5')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x5167('0x6')]=DashboardItemEvents; \ No newline at end of file +var _0x4417=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save'];(function(_0x5a6a3f,_0x313a88){var _0x3b6bc8=function(_0x16bd1a){while(--_0x16bd1a){_0x5a6a3f['push'](_0x5a6a3f['shift']());}};_0x3b6bc8(++_0x313a88);}(_0x4417,0xd7));var _0x7441=function(_0x4cc854,_0x558afa){_0x4cc854=_0x4cc854-0x0;var _0x20bde0=_0x4417[_0x4cc854];return _0x20bde0;};'use strict';var EventEmitter=require(_0x7441('0x0'));var DashboardItem=require(_0x7441('0x1'))['db'][_0x7441('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x7441('0x3')](0x0);var events={'afterCreate':_0x7441('0x4'),'afterUpdate':_0x7441('0x5'),'afterDestroy':'remove'};function emitEvent(_0x294022){return function(_0x56fbb1,_0x31e4a6,_0x124240){DashboardItemEvents[_0x7441('0x6')](_0x294022+':'+_0x56fbb1['id'],_0x56fbb1);DashboardItemEvents['emit'](_0x294022,_0x56fbb1);_0x124240(null);};}for(var e in events){if(events[_0x7441('0x7')](e)){var event=events[e];DashboardItem[_0x7441('0x8')](e,emitEvent(event));}}module[_0x7441('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 14663e4..8e17907 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 _0x6db1=['moment','bluebird','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6db1,0x13e));var _0x16db=function(_0x77c2bf,_0x3c1a39){_0x77c2bf=_0x77c2bf-0x0;var _0x3a15b0=_0x6db1[_0x77c2bf];return _0x3a15b0;};'use strict';var _=require(_0x16db('0x0'));var util=require(_0x16db('0x1'));var logger=require(_0x16db('0x2'))(_0x16db('0x3'));var moment=require(_0x16db('0x4'));var BPromise=require(_0x16db('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x16db('0x6'));var rimraf=require(_0x16db('0x7'));var config=require(_0x16db('0x8'));var attributes=require(_0x16db('0x9'));module[_0x16db('0xa')]=function(_0x1cf88f,_0x38b8af){return _0x1cf88f[_0x16db('0xb')](_0x16db('0xc'),attributes,{'tableName':_0x16db('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x946e=['./dashboardItem.attributes','exports','define','DashboardItem','lodash','../../config/logger','moment','path','rimraf','../../config/environment'];(function(_0x2420c8,_0x59cdcc){var _0x46e13d=function(_0x1117c3){while(--_0x1117c3){_0x2420c8['push'](_0x2420c8['shift']());}};_0x46e13d(++_0x59cdcc);}(_0x946e,0x1d0));var _0xe946=function(_0x130ced,_0x2f1655){_0x130ced=_0x130ced-0x0;var _0x44d512=_0x946e[_0x130ced];return _0x44d512;};'use strict';var _=require(_0xe946('0x0'));var util=require('util');var logger=require(_0xe946('0x1'))('api');var moment=require(_0xe946('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe946('0x3'));var rimraf=require(_0xe946('0x4'));var config=require(_0xe946('0x5'));var attributes=require(_0xe946('0x6'));module[_0xe946('0x7')]=function(_0x49224a,_0x123d0c){return _0x49224a[_0xe946('0x8')](_0xe946('0x9'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 789b2bd..3b2ddcb 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 _0x67ba=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','util','moment','bluebird','randomstring'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x67ba,0x7e));var _0xa67b=function(_0x1f01bb,_0x2f61e4){_0x1f01bb=_0x1f01bb-0x0;var _0x59d7b4=_0x67ba[_0x1f01bb];return _0x59d7b4;};'use strict';var _=require('lodash');var util=require(_0xa67b('0x0'));var moment=require(_0xa67b('0x1'));var BPromise=require(_0xa67b('0x2'));var rs=require(_0xa67b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa67b('0x4'))['db'];var utils=require(_0xa67b('0x5'));var logger=require(_0xa67b('0x6'))(_0xa67b('0x7'));var config=require(_0xa67b('0x8'));var jayson=require(_0xa67b('0x9'));var client=jayson[_0xa67b('0xa')][_0xa67b('0xb')]({'port':0x232a});config['redis']=_[_0xa67b('0xc')](config[_0xa67b('0xd')],{'host':_0xa67b('0xe'),'port':0x18eb});var socket=require(_0xa67b('0xf'))(new Redis(config[_0xa67b('0xd')]));require('./dashboardItem.socket')[_0xa67b('0x10')](socket);function respondWithRpcPromise(_0x167715,_0x40a8c2,_0x1659ad){return new BPromise(function(_0x1c19ee,_0x2ef9b6){return client[_0xa67b('0x11')](_0x167715,_0x1659ad)['then'](function(_0x455bab){logger['info'](_0xa67b('0x12'),_0x40a8c2,_0xa67b('0x13'));logger[_0xa67b('0x14')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x40a8c2,'request\x20sent',JSON['stringify'](_0x455bab));if(_0x455bab[_0xa67b('0x15')]){if(_0x455bab[_0xa67b('0x15')][_0xa67b('0x16')]===0x1f4){logger[_0xa67b('0x15')]('DashboardItem,\x20%s,\x20%s',_0x40a8c2,_0x455bab[_0xa67b('0x15')][_0xa67b('0x17')]);return _0x2ef9b6(_0x455bab[_0xa67b('0x15')][_0xa67b('0x17')]);}logger['error'](_0xa67b('0x12'),_0x40a8c2,_0x455bab[_0xa67b('0x15')][_0xa67b('0x17')]);return _0x1c19ee(_0x455bab[_0xa67b('0x15')]['message']);}else{logger[_0xa67b('0x18')](_0xa67b('0x12'),_0x40a8c2,_0xa67b('0x13'));_0x1c19ee(_0x455bab[_0xa67b('0x19')][_0xa67b('0x17')]);}})['catch'](function(_0x23ace2){logger['error']('DashboardItem,\x20%s,\x20%s',_0x40a8c2,_0x23ace2);_0x2ef9b6(_0x23ace2);});});} \ No newline at end of file +var _0xdcae=['error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','./dashboardItem.socket','register','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5f2327,_0x123bcd){var _0x304698=function(_0x5eb594){while(--_0x5eb594){_0x5f2327['push'](_0x5f2327['shift']());}};_0x304698(++_0x123bcd);}(_0xdcae,0x1cf));var _0xedca=function(_0x45c9f4,_0x2eec90){_0x45c9f4=_0x45c9f4-0x0;var _0x1f9be9=_0xdcae[_0x45c9f4];return _0x1f9be9;};'use strict';var _=require(_0xedca('0x0'));var util=require(_0xedca('0x1'));var moment=require(_0xedca('0x2'));var BPromise=require(_0xedca('0x3'));var rs=require(_0xedca('0x4'));var fs=require('fs');var Redis=require(_0xedca('0x5'));var db=require(_0xedca('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xedca('0x7'))(_0xedca('0x8'));var config=require(_0xedca('0x9'));var jayson=require(_0xedca('0xa'));var client=jayson[_0xedca('0xb')][_0xedca('0xc')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xedca('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xedca('0xe'))[_0xedca('0xf')](socket);function respondWithRpcPromise(_0x18688b,_0x8b3543,_0x4fd635){return new BPromise(function(_0x1ac489,_0x306e07){return client[_0xedca('0x10')](_0x18688b,_0x4fd635)['then'](function(_0x5780f5){logger[_0xedca('0x11')](_0xedca('0x12'),_0x8b3543,_0xedca('0x13'));logger[_0xedca('0x14')](_0xedca('0x15'),_0x8b3543,_0xedca('0x13'),JSON[_0xedca('0x16')](_0x5780f5));if(_0x5780f5[_0xedca('0x17')]){if(_0x5780f5[_0xedca('0x17')][_0xedca('0x18')]===0x1f4){logger[_0xedca('0x17')](_0xedca('0x12'),_0x8b3543,_0x5780f5[_0xedca('0x17')][_0xedca('0x19')]);return _0x306e07(_0x5780f5[_0xedca('0x17')][_0xedca('0x19')]);}logger['error'](_0xedca('0x12'),_0x8b3543,_0x5780f5[_0xedca('0x17')][_0xedca('0x19')]);return _0x1ac489(_0x5780f5[_0xedca('0x17')][_0xedca('0x19')]);}else{logger[_0xedca('0x11')](_0xedca('0x12'),_0x8b3543,_0xedca('0x13'));_0x1ac489(_0x5780f5['result']['message']);}})[_0xedca('0x1a')](function(_0x5a1f4b){logger[_0xedca('0x17')]('DashboardItem,\x20%s,\x20%s',_0x8b3543,_0x5a1f4b);_0x306e07(_0x5a1f4b);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 6c9aa67..838d758 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 _0x8e7d=['save','remove','update','emit','length','dashboardItem:','./dashboardItem.events'];(function(_0x5400b,_0x55943a){var _0x36a39b=function(_0x56963c){while(--_0x56963c){_0x5400b['push'](_0x5400b['shift']());}};_0x36a39b(++_0x55943a);}(_0x8e7d,0xdf));var _0xd8e7=function(_0x48f2b2,_0x424f6a){_0x48f2b2=_0x48f2b2-0x0;var _0x464438=_0x8e7d[_0x48f2b2];return _0x464438;};'use strict';var DashboardItemEvents=require(_0xd8e7('0x0'));var events=[_0xd8e7('0x1'),_0xd8e7('0x2'),_0xd8e7('0x3')];function createListener(_0x486789,_0x421223){return function(_0x597b12){_0x421223[_0xd8e7('0x4')](_0x486789,_0x597b12);};}function removeListener(_0x51ef21,_0x913f06){return function(){DashboardItemEvents['removeListener'](_0x51ef21,_0x913f06);};}exports['register']=function(_0x433ff5){for(var _0x4cf884=0x0,_0x4a04d2=events[_0xd8e7('0x5')];_0x4cf884<_0x4a04d2;_0x4cf884++){var _0x54d234=events[_0x4cf884];var _0x260454=createListener(_0xd8e7('0x6')+_0x54d234,_0x433ff5);DashboardItemEvents['on'](_0x54d234,_0x260454);}}; \ No newline at end of file +var _0x6257=['remove','update','emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','save'];(function(_0x420668,_0x112b85){var _0x23cfc2=function(_0x5d7a47){while(--_0x5d7a47){_0x420668['push'](_0x420668['shift']());}};_0x23cfc2(++_0x112b85);}(_0x6257,0x181));var _0x7625=function(_0x12a338,_0x23c57e){_0x12a338=_0x12a338-0x0;var _0x3fa984=_0x6257[_0x12a338];return _0x3fa984;};'use strict';var DashboardItemEvents=require(_0x7625('0x0'));var events=[_0x7625('0x1'),_0x7625('0x2'),_0x7625('0x3')];function createListener(_0x35aa4a,_0x35146f){return function(_0x3535c1){_0x35146f[_0x7625('0x4')](_0x35aa4a,_0x3535c1);};}function removeListener(_0x1cc78f,_0x3f08bb){return function(){DashboardItemEvents[_0x7625('0x5')](_0x1cc78f,_0x3f08bb);};}exports[_0x7625('0x6')]=function(_0x4da799){for(var _0x338947=0x0,_0xa24349=events[_0x7625('0x7')];_0x338947<_0xa24349;_0x338947++){var _0x2d20ce=events[_0x338947];var _0x1a1359=createListener(_0x7625('0x8')+_0x2d20ce,_0x4da799);DashboardItemEvents['on'](_0x2d20ce,_0x1a1359);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index b2a358b..fd81c44 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 _0xf260=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','create','put','update','exports','multer','util','path'];(function(_0x58fe32,_0x165254){var _0x117f21=function(_0x210e6c){while(--_0x210e6c){_0x58fe32['push'](_0x58fe32['shift']());}};_0x117f21(++_0x165254);}(_0xf260,0x11d));var _0x0f26=function(_0x420513,_0x30eae3){_0x420513=_0x420513-0x0;var _0x1b44ec=_0xf260[_0x420513];return _0x1b44ec;};'use strict';var multer=require(_0x0f26('0x0'));var util=require(_0x0f26('0x1'));var path=require(_0x0f26('0x2'));var timeout=require(_0x0f26('0x3'));var express=require(_0x0f26('0x4'));var router=express[_0x0f26('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0f26('0x6'));var interaction=require(_0x0f26('0x7'));var config=require(_0x0f26('0x8'));var controller=require(_0x0f26('0x9'));router[_0x0f26('0xa')](_0x0f26('0xb'),auth[_0x0f26('0xc')](),controller[_0x0f26('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0f26('0xe')]);router[_0x0f26('0xf')](_0x0f26('0xb'),auth['isAuthenticated'](),controller[_0x0f26('0x10')]);router['delete'](_0x0f26('0xb'),auth[_0x0f26('0xc')](),controller['destroy']);module[_0x0f26('0x11')]=router; \ No newline at end of file +var _0x94d9=['connect-timeout','express','fs-extra','../../components/interaction/service','./dashboardItem.controller','get','/:id','show','post','isAuthenticated','create','delete','destroy','exports','util','path'];(function(_0x5a6644,_0x45d612){var _0x3a2a5d=function(_0x54159e){while(--_0x54159e){_0x5a6644['push'](_0x5a6644['shift']());}};_0x3a2a5d(++_0x45d612);}(_0x94d9,0x1de));var _0x994d=function(_0x655ff7,_0x453fa8){_0x655ff7=_0x655ff7-0x0;var _0x5c55fe=_0x94d9[_0x655ff7];return _0x5c55fe;};'use strict';var multer=require('multer');var util=require(_0x994d('0x0'));var path=require(_0x994d('0x1'));var timeout=require(_0x994d('0x2'));var express=require(_0x994d('0x3'));var router=express['Router']();var fs_extra=require(_0x994d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x994d('0x5'));var config=require('../../config/environment');var controller=require(_0x994d('0x6'));router[_0x994d('0x7')](_0x994d('0x8'),auth['isAuthenticated'](),controller[_0x994d('0x9')]);router[_0x994d('0xa')]('/',auth[_0x994d('0xb')](),controller[_0x994d('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x994d('0xd')](_0x994d('0x8'),auth[_0x994d('0xb')](),controller[_0x994d('0xe')]);module[_0x994d('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index d02e507..d05734b 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 _0xe0c2=['second','sequelize','STRING','ENUM','first'];(function(_0x4e90f0,_0x3b7e3c){var _0x1a2cee=function(_0xc0c5f5){while(--_0xc0c5f5){_0x4e90f0['push'](_0x4e90f0['shift']());}};_0x1a2cee(++_0x3b7e3c);}(_0xe0c2,0x1eb));var _0x2e0c=function(_0x3bdbad,_0x5cf453){_0x3bdbad=_0x3bdbad-0x0;var _0x9533e0=_0xe0c2[_0x3bdbad];return _0x9533e0;};'use strict';var Sequelize=require(_0x2e0c('0x0'));module['exports']={'name':{'type':Sequelize[_0x2e0c('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x2e0c('0x2')](_0x2e0c('0x3'),_0x2e0c('0x4'),'third'),'allowNull':![],'defaultValue':_0x2e0c('0x3')},'description':{'type':Sequelize[_0x2e0c('0x1')]}}; \ No newline at end of file +var _0x084d=['first','second','STRING','sequelize','exports','ENUM'];(function(_0x1bca87,_0x17410b){var _0x4dead3=function(_0x1baf01){while(--_0x1baf01){_0x1bca87['push'](_0x1bca87['shift']());}};_0x4dead3(++_0x17410b);}(_0x084d,0x1c5));var _0xd084=function(_0x42c930,_0x34df51){_0x42c930=_0x42c930-0x0;var _0x2b863b=_0x084d[_0x42c930];return _0x2b863b;};'use strict';var Sequelize=require(_0xd084('0x0'));module[_0xd084('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0xd084('0x2')](_0xd084('0x3'),_0xd084('0x4'),'third'),'allowNull':![],'defaultValue':_0xd084('0x3')},'description':{'type':Sequelize[_0xd084('0x5')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 392aa64..86091af 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 _0x8b17=['where','filters','pick','filter','merge','Disposition','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','save','then','destroy','Dispositions','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort'];(function(_0xdb35ea,_0x34fc65){var _0x20fd09=function(_0x27fec1){while(--_0x27fec1){_0xdb35ea['push'](_0xdb35ea['shift']());}};_0x20fd09(++_0x34fc65);}(_0x8b17,0xbe));var _0x78b1=function(_0x32de22,_0x3e3ebf){_0x32de22=_0x32de22-0x0;var _0x343c85=_0x8b17[_0x32de22];return _0x343c85;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x78b1('0x0'));var zipdir=require(_0x78b1('0x1'));var jsonpatch=require(_0x78b1('0x2'));var rp=require(_0x78b1('0x3'));var moment=require('moment');var BPromise=require(_0x78b1('0x4'));var Mustache=require(_0x78b1('0x5'));var util=require(_0x78b1('0x6'));var path=require(_0x78b1('0x7'));var sox=require(_0x78b1('0x8'));var csv=require('to-csv');var ejs=require(_0x78b1('0x9'));var fs=require('fs');var fs_extra=require(_0x78b1('0xa'));var _=require(_0x78b1('0xb'));var squel=require('squel');var crypto=require(_0x78b1('0xc'));var jsforce=require(_0x78b1('0xd'));var deskjs=require(_0x78b1('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x78b1('0xf'));var Redis=require('ioredis');var authService=require(_0x78b1('0x10'));var qs=require(_0x78b1('0x11'));var as=require(_0x78b1('0x12'));var hardwareService=require(_0x78b1('0x13'));var logger=require(_0x78b1('0x14'))('api');var utils=require(_0x78b1('0x15'));var config=require(_0x78b1('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x78b1('0x17'))['db'];function respondWithStatusCode(_0x62f75a,_0x18b9a9){_0x18b9a9=_0x18b9a9||0xcc;return function(_0x1bfdea){if(_0x1bfdea){return _0x62f75a[_0x78b1('0x18')](_0x18b9a9);}return _0x62f75a[_0x78b1('0x19')](_0x18b9a9)[_0x78b1('0x1a')]();};}function respondWithResult(_0x1c0e69,_0x517b3f){_0x517b3f=_0x517b3f||0xc8;return function(_0x2541cb){if(_0x2541cb){return _0x1c0e69[_0x78b1('0x19')](_0x517b3f)[_0x78b1('0x1b')](_0x2541cb);}};}function respondWithFilteredResult(_0x17ec39,_0x9a5408){return function(_0x2947c5){if(_0x2947c5){var _0xf0798a=typeof _0x9a5408['offset']===_0x78b1('0x1c')&&typeof _0x9a5408[_0x78b1('0x1d')]===_0x78b1('0x1c');var _0x10bfc6=_0x2947c5['count'];var _0x89dff6=_0xf0798a?0x0:_0x9a5408[_0x78b1('0x1e')];var _0xcdbb68=_0xf0798a?_0x2947c5[_0x78b1('0x1f')]:_0x9a5408['offset']+_0x9a5408[_0x78b1('0x1d')];var _0x6bea56;if(_0xcdbb68>=_0x10bfc6){_0xcdbb68=_0x10bfc6;_0x6bea56=0xc8;}else{_0x6bea56=0xce;}_0x17ec39[_0x78b1('0x19')](_0x6bea56);return _0x17ec39['set'](_0x78b1('0x20'),_0x89dff6+'-'+_0xcdbb68+'/'+_0x10bfc6)[_0x78b1('0x1b')](_0x2947c5);}return null;};}function patchUpdates(_0x1dd290){return function(_0x31d29e){try{jsonpatch[_0x78b1('0x21')](_0x31d29e,_0x1dd290,!![]);}catch(_0x462770){return BPromise['reject'](_0x462770);}return _0x31d29e[_0x78b1('0x22')]();};}function saveUpdates(_0x450f85,_0x205e48){return function(_0x3b6a9d){if(_0x3b6a9d){return _0x3b6a9d['update'](_0x450f85)[_0x78b1('0x23')](function(_0x2b3bc6){return _0x2b3bc6;});}return null;};}function removeEntity(_0x5b9455,_0x3fc11f){return function(_0x6be320){if(_0x6be320){return _0x6be320[_0x78b1('0x24')]()[_0x78b1('0x23')](function(){var _0x25e3bc=_0x6be320['get']({'plain':!![]});var _0x52d84f=_0x78b1('0x25');return db[_0x78b1('0x26')]['destroy']({'where':{'type':_0x52d84f,'resourceId':_0x25e3bc['id']}})[_0x78b1('0x23')](function(){return _0x6be320;});})[_0x78b1('0x23')](function(){_0x5b9455[_0x78b1('0x19')](0xcc)[_0x78b1('0x1a')]();});}};}function handleEntityNotFound(_0x15f878,_0x535ad2){return function(_0x8f9fcc){if(!_0x8f9fcc){_0x15f878[_0x78b1('0x18')](0x194);}return _0x8f9fcc;};}function handleError(_0x4f2069,_0x56719f){_0x56719f=_0x56719f||0x1f4;return function(_0x324953){logger[_0x78b1('0x27')](_0x324953[_0x78b1('0x28')]);if(_0x324953[_0x78b1('0x29')]){delete _0x324953[_0x78b1('0x29')];}_0x4f2069[_0x78b1('0x19')](_0x56719f)[_0x78b1('0x2a')](_0x324953);};}exports['index']=function(_0x370cd2,_0x34f637){var _0x4551c7={},_0x2306a9={},_0x6ba592={'count':0x0,'rows':[]};var _0x49510c=_[_0x78b1('0x2b')](db['Disposition'][_0x78b1('0x2c')],function(_0x506f45){return{'name':_0x506f45[_0x78b1('0x2d')],'type':_0x506f45[_0x78b1('0x2e')]['key']};});_0x2306a9[_0x78b1('0x2f')]=_[_0x78b1('0x2b')](_0x49510c,_0x78b1('0x29'));_0x2306a9[_0x78b1('0x30')]=_[_0x78b1('0x31')](_0x370cd2[_0x78b1('0x30')]);_0x2306a9['filters']=_[_0x78b1('0x32')](_0x2306a9[_0x78b1('0x2f')],_0x2306a9['query']);_0x4551c7[_0x78b1('0x33')]=_[_0x78b1('0x32')](_0x2306a9['model'],qs[_0x78b1('0x34')](_0x370cd2[_0x78b1('0x30')][_0x78b1('0x34')]));_0x4551c7[_0x78b1('0x33')]=_0x4551c7[_0x78b1('0x33')]['length']?_0x4551c7[_0x78b1('0x33')]:_0x2306a9[_0x78b1('0x2f')];if(!_0x370cd2[_0x78b1('0x30')][_0x78b1('0x35')]('nolimit')){_0x4551c7[_0x78b1('0x1d')]=qs[_0x78b1('0x1d')](_0x370cd2[_0x78b1('0x30')]['limit']);_0x4551c7[_0x78b1('0x1e')]=qs['offset'](_0x370cd2[_0x78b1('0x30')]['offset']);}_0x4551c7[_0x78b1('0x36')]=qs['sort'](_0x370cd2['query'][_0x78b1('0x37')]);_0x4551c7[_0x78b1('0x38')]=qs[_0x78b1('0x39')](_[_0x78b1('0x3a')](_0x370cd2[_0x78b1('0x30')],_0x2306a9[_0x78b1('0x39')]),_0x49510c);if(_0x370cd2[_0x78b1('0x30')][_0x78b1('0x3b')]){_0x4551c7[_0x78b1('0x38')]=_[_0x78b1('0x3c')](_0x4551c7[_0x78b1('0x38')],{'$or':_[_0x78b1('0x2b')](_0x49510c,function(_0x1387eb){if(_0x1387eb[_0x78b1('0x2e')]!=='VIRTUAL'){var _0x456cd1={};_0x456cd1[_0x1387eb[_0x78b1('0x29')]]={'$like':'%'+_0x370cd2[_0x78b1('0x30')][_0x78b1('0x3b')]+'%'};return _0x456cd1;}})});}_0x4551c7=_[_0x78b1('0x3c')]({},_0x4551c7,_0x370cd2['options']);var _0x844404={'where':_0x4551c7['where']};return db[_0x78b1('0x3d')][_0x78b1('0x1f')](_0x844404)[_0x78b1('0x23')](function(_0xa320dd){_0x6ba592[_0x78b1('0x1f')]=_0xa320dd;if(_0x370cd2[_0x78b1('0x30')][_0x78b1('0x3e')]){_0x4551c7[_0x78b1('0x3f')]=[{'all':!![]}];}return db[_0x78b1('0x3d')][_0x78b1('0x40')](_0x4551c7);})[_0x78b1('0x23')](function(_0x4f79f6){_0x6ba592[_0x78b1('0x41')]=_0x4f79f6;return _0x6ba592;})[_0x78b1('0x23')](respondWithFilteredResult(_0x34f637,_0x4551c7))[_0x78b1('0x42')](handleError(_0x34f637,null));};exports[_0x78b1('0x43')]=function(_0x4cd1ae,_0x3b2448){var _0x2fdcd9={'raw':!![],'where':{'id':_0x4cd1ae[_0x78b1('0x44')]['id']}},_0x221640={};_0x221640[_0x78b1('0x2f')]=_[_0x78b1('0x31')](db[_0x78b1('0x3d')][_0x78b1('0x2c')]);_0x221640[_0x78b1('0x30')]=_[_0x78b1('0x31')](_0x4cd1ae['query']);_0x221640[_0x78b1('0x39')]=_[_0x78b1('0x32')](_0x221640['model'],_0x221640['query']);_0x2fdcd9[_0x78b1('0x33')]=_[_0x78b1('0x32')](_0x221640[_0x78b1('0x2f')],qs[_0x78b1('0x34')](_0x4cd1ae[_0x78b1('0x30')][_0x78b1('0x34')]));_0x2fdcd9[_0x78b1('0x33')]=_0x2fdcd9['attributes'][_0x78b1('0x45')]?_0x2fdcd9[_0x78b1('0x33')]:_0x221640[_0x78b1('0x2f')];if(_0x4cd1ae['query'][_0x78b1('0x3e')]){_0x2fdcd9['include']=[{'all':!![]}];}_0x2fdcd9=_[_0x78b1('0x3c')]({},_0x2fdcd9,_0x4cd1ae[_0x78b1('0x46')]);return db[_0x78b1('0x3d')][_0x78b1('0x47')](_0x2fdcd9)['then'](handleEntityNotFound(_0x3b2448,null))[_0x78b1('0x23')](respondWithResult(_0x3b2448,null))[_0x78b1('0x42')](handleError(_0x3b2448,null));};exports[_0x78b1('0x48')]=function(_0x1e17d2,_0x40cecc){return db[_0x78b1('0x3d')][_0x78b1('0x48')](_0x1e17d2['body'],{})['then'](function(_0x370515){var _0x55e3f7=_0x1e17d2[_0x78b1('0x49')]['get']({'plain':!![]});if(!_0x55e3f7)throw new Error(_0x78b1('0x4a'));if(_0x55e3f7['role']===_0x78b1('0x49')){var _0x220e7b=_0x370515[_0x78b1('0x4b')]({'plain':!![]});var _0x449ac1=_0x78b1('0x25');return db[_0x78b1('0x4c')][_0x78b1('0x47')]({'where':{'name':_0x449ac1,'userProfileId':_0x55e3f7[_0x78b1('0x4d')]},'raw':!![]})['then'](function(_0x58113d){if(_0x58113d&&_0x58113d[_0x78b1('0x4e')]===0x0){return db[_0x78b1('0x26')][_0x78b1('0x48')]({'name':_0x220e7b[_0x78b1('0x29')],'resourceId':_0x220e7b['id'],'type':_0x58113d[_0x78b1('0x29')],'sectionId':_0x58113d['id']},{})[_0x78b1('0x23')](function(){return _0x370515;});}else{return _0x370515;}})['catch'](function(_0x2bb150){logger['error'](_0x78b1('0x4f'),_0x2bb150);throw _0x2bb150;});}return _0x370515;})[_0x78b1('0x23')](respondWithResult(_0x40cecc,0xc9))['catch'](handleError(_0x40cecc,null));};exports[_0x78b1('0x50')]=function(_0x4e81fa,_0x57d845){if(_0x4e81fa[_0x78b1('0x51')]['id']){delete _0x4e81fa['body']['id'];}return db[_0x78b1('0x3d')][_0x78b1('0x47')]({'where':{'id':_0x4e81fa[_0x78b1('0x44')]['id']}})[_0x78b1('0x23')](handleEntityNotFound(_0x57d845,null))[_0x78b1('0x23')](saveUpdates(_0x4e81fa[_0x78b1('0x51')],null))[_0x78b1('0x23')](respondWithResult(_0x57d845,null))[_0x78b1('0x42')](handleError(_0x57d845,null));};exports[_0x78b1('0x24')]=function(_0x3df122,_0x47e74a){return db[_0x78b1('0x3d')][_0x78b1('0x47')]({'where':{'id':_0x3df122[_0x78b1('0x44')]['id']}})[_0x78b1('0x23')](handleEntityNotFound(_0x47e74a,null))[_0x78b1('0x23')](removeEntity(_0x47e74a,null))[_0x78b1('0x42')](handleError(_0x47e74a,null));}; \ No newline at end of file +var _0x6462=['order','sort','pick','filter','where','VIRTUAL','merge','options','Disposition','includeAll','findAll','rows','show','params','include','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','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x533132,_0xf5b6fa){var _0x1a7447=function(_0x44d580){while(--_0x44d580){_0x533132['push'](_0x533132['shift']());}};_0x1a7447(++_0xf5b6fa);}(_0x6462,0x11f));var _0x2646=function(_0x409fcd,_0x25aef2){_0x409fcd=_0x409fcd-0x0;var _0x14dda3=_0x6462[_0x409fcd];return _0x14dda3;};'use strict';var emlformat=require(_0x2646('0x0'));var rimraf=require(_0x2646('0x1'));var zipdir=require(_0x2646('0x2'));var jsonpatch=require(_0x2646('0x3'));var rp=require('request-promise');var moment=require(_0x2646('0x4'));var BPromise=require(_0x2646('0x5'));var Mustache=require(_0x2646('0x6'));var util=require(_0x2646('0x7'));var path=require(_0x2646('0x8'));var sox=require(_0x2646('0x9'));var csv=require(_0x2646('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2646('0xb'));var squel=require(_0x2646('0xc'));var crypto=require(_0x2646('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2646('0xe'));var toCsv=require(_0x2646('0xa'));var querystring=require(_0x2646('0xf'));var Papa=require(_0x2646('0x10'));var Redis=require(_0x2646('0x11'));var authService=require(_0x2646('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2646('0x13'));var hardwareService=require(_0x2646('0x14'));var logger=require('../../config/logger')(_0x2646('0x15'));var utils=require('../../config/utils');var config=require(_0x2646('0x16'));var licenseUtil=require(_0x2646('0x17'));var db=require(_0x2646('0x18'))['db'];function respondWithStatusCode(_0x3ea81f,_0x591f4c){_0x591f4c=_0x591f4c||0xcc;return function(_0x7c9590){if(_0x7c9590){return _0x3ea81f['sendStatus'](_0x591f4c);}return _0x3ea81f['status'](_0x591f4c)[_0x2646('0x19')]();};}function respondWithResult(_0x538ca6,_0x1727ce){_0x1727ce=_0x1727ce||0xc8;return function(_0x8bcc76){if(_0x8bcc76){return _0x538ca6[_0x2646('0x1a')](_0x1727ce)['json'](_0x8bcc76);}};}function respondWithFilteredResult(_0x593642,_0x1097e4){return function(_0x19a4a1){if(_0x19a4a1){var _0x52914d=typeof _0x1097e4['offset']===_0x2646('0x1b')&&typeof _0x1097e4[_0x2646('0x1c')]===_0x2646('0x1b');var _0x7d2ddb=_0x19a4a1[_0x2646('0x1d')];var _0x25a1a9=_0x52914d?0x0:_0x1097e4[_0x2646('0x1e')];var _0x24cd8c=_0x52914d?_0x19a4a1[_0x2646('0x1d')]:_0x1097e4[_0x2646('0x1e')]+_0x1097e4[_0x2646('0x1c')];var _0x4d077c;if(_0x24cd8c>=_0x7d2ddb){_0x24cd8c=_0x7d2ddb;_0x4d077c=0xc8;}else{_0x4d077c=0xce;}_0x593642['status'](_0x4d077c);return _0x593642['set'](_0x2646('0x1f'),_0x25a1a9+'-'+_0x24cd8c+'/'+_0x7d2ddb)[_0x2646('0x20')](_0x19a4a1);}return null;};}function patchUpdates(_0x2632ff){return function(_0x36ee19){try{jsonpatch[_0x2646('0x21')](_0x36ee19,_0x2632ff,!![]);}catch(_0x506702){return BPromise[_0x2646('0x22')](_0x506702);}return _0x36ee19[_0x2646('0x23')]();};}function saveUpdates(_0x3d4c82,_0x15da0d){return function(_0xc0358){if(_0xc0358){return _0xc0358[_0x2646('0x24')](_0x3d4c82)[_0x2646('0x25')](function(_0x3f13c2){return _0x3f13c2;});}return null;};}function removeEntity(_0x1fdb46,_0x10a1ca){return function(_0x325244){if(_0x325244){return _0x325244[_0x2646('0x26')]()[_0x2646('0x25')](function(){var _0x5821e8=_0x325244[_0x2646('0x27')]({'plain':!![]});var _0x3d0ee3='Dispositions';return db[_0x2646('0x28')]['destroy']({'where':{'type':_0x3d0ee3,'resourceId':_0x5821e8['id']}})[_0x2646('0x25')](function(){return _0x325244;});})[_0x2646('0x25')](function(){_0x1fdb46[_0x2646('0x1a')](0xcc)[_0x2646('0x19')]();});}};}function handleEntityNotFound(_0x544073,_0x3a2f6d){return function(_0x43bd0a){if(!_0x43bd0a){_0x544073[_0x2646('0x29')](0x194);}return _0x43bd0a;};}function handleError(_0x2bfaa5,_0x186b4d){_0x186b4d=_0x186b4d||0x1f4;return function(_0x3e12b9){logger['error'](_0x3e12b9[_0x2646('0x2a')]);if(_0x3e12b9[_0x2646('0x2b')]){delete _0x3e12b9[_0x2646('0x2b')];}_0x2bfaa5[_0x2646('0x1a')](_0x186b4d)[_0x2646('0x2c')](_0x3e12b9);};}exports[_0x2646('0x2d')]=function(_0x2b23c9,_0x20fb97){var _0x29ef79={},_0x2750a3={},_0x2f3be3={'count':0x0,'rows':[]};var _0xb2b38c=_[_0x2646('0x2e')](db['Disposition'][_0x2646('0x2f')],function(_0xb05216){return{'name':_0xb05216[_0x2646('0x30')],'type':_0xb05216[_0x2646('0x31')][_0x2646('0x32')]};});_0x2750a3['model']=_[_0x2646('0x2e')](_0xb2b38c,'name');_0x2750a3[_0x2646('0x33')]=_[_0x2646('0x34')](_0x2b23c9[_0x2646('0x33')]);_0x2750a3[_0x2646('0x35')]=_[_0x2646('0x36')](_0x2750a3['model'],_0x2750a3['query']);_0x29ef79['attributes']=_[_0x2646('0x36')](_0x2750a3[_0x2646('0x37')],qs[_0x2646('0x38')](_0x2b23c9[_0x2646('0x33')]['fields']));_0x29ef79[_0x2646('0x39')]=_0x29ef79[_0x2646('0x39')][_0x2646('0x3a')]?_0x29ef79['attributes']:_0x2750a3[_0x2646('0x37')];if(!_0x2b23c9[_0x2646('0x33')][_0x2646('0x3b')](_0x2646('0x3c'))){_0x29ef79['limit']=qs[_0x2646('0x1c')](_0x2b23c9['query'][_0x2646('0x1c')]);_0x29ef79['offset']=qs[_0x2646('0x1e')](_0x2b23c9['query'][_0x2646('0x1e')]);}_0x29ef79[_0x2646('0x3d')]=qs[_0x2646('0x3e')](_0x2b23c9['query'][_0x2646('0x3e')]);_0x29ef79['where']=qs[_0x2646('0x35')](_[_0x2646('0x3f')](_0x2b23c9[_0x2646('0x33')],_0x2750a3[_0x2646('0x35')]),_0xb2b38c);if(_0x2b23c9['query'][_0x2646('0x40')]){_0x29ef79[_0x2646('0x41')]=_['merge'](_0x29ef79[_0x2646('0x41')],{'$or':_[_0x2646('0x2e')](_0xb2b38c,function(_0x42c51f){if(_0x42c51f[_0x2646('0x31')]!==_0x2646('0x42')){var _0x5a1bf8={};_0x5a1bf8[_0x42c51f['name']]={'$like':'%'+_0x2b23c9['query'][_0x2646('0x40')]+'%'};return _0x5a1bf8;}})});}_0x29ef79=_[_0x2646('0x43')]({},_0x29ef79,_0x2b23c9[_0x2646('0x44')]);var _0x3d6cbd={'where':_0x29ef79[_0x2646('0x41')]};return db[_0x2646('0x45')][_0x2646('0x1d')](_0x3d6cbd)[_0x2646('0x25')](function(_0x128fc4){_0x2f3be3[_0x2646('0x1d')]=_0x128fc4;if(_0x2b23c9[_0x2646('0x33')][_0x2646('0x46')]){_0x29ef79['include']=[{'all':!![]}];}return db['Disposition'][_0x2646('0x47')](_0x29ef79);})['then'](function(_0x2e9ff2){_0x2f3be3[_0x2646('0x48')]=_0x2e9ff2;return _0x2f3be3;})[_0x2646('0x25')](respondWithFilteredResult(_0x20fb97,_0x29ef79))['catch'](handleError(_0x20fb97,null));};exports[_0x2646('0x49')]=function(_0x1fb449,_0x37cec9){var _0x3febcd={'raw':!![],'where':{'id':_0x1fb449[_0x2646('0x4a')]['id']}},_0x38d386={};_0x38d386[_0x2646('0x37')]=_['keys'](db['Disposition'][_0x2646('0x2f')]);_0x38d386[_0x2646('0x33')]=_[_0x2646('0x34')](_0x1fb449['query']);_0x38d386[_0x2646('0x35')]=_['intersection'](_0x38d386[_0x2646('0x37')],_0x38d386[_0x2646('0x33')]);_0x3febcd[_0x2646('0x39')]=_['intersection'](_0x38d386[_0x2646('0x37')],qs['fields'](_0x1fb449[_0x2646('0x33')][_0x2646('0x38')]));_0x3febcd['attributes']=_0x3febcd[_0x2646('0x39')]['length']?_0x3febcd[_0x2646('0x39')]:_0x38d386['model'];if(_0x1fb449[_0x2646('0x33')][_0x2646('0x46')]){_0x3febcd[_0x2646('0x4b')]=[{'all':!![]}];}_0x3febcd=_[_0x2646('0x43')]({},_0x3febcd,_0x1fb449[_0x2646('0x44')]);return db[_0x2646('0x45')]['find'](_0x3febcd)[_0x2646('0x25')](handleEntityNotFound(_0x37cec9,null))['then'](respondWithResult(_0x37cec9,null))[_0x2646('0x4c')](handleError(_0x37cec9,null));};exports[_0x2646('0x4d')]=function(_0x462b73,_0x2fe6dc){return db[_0x2646('0x45')][_0x2646('0x4d')](_0x462b73[_0x2646('0x4e')],{})[_0x2646('0x25')](function(_0x152f8a){var _0x204432=_0x462b73[_0x2646('0x4f')][_0x2646('0x27')]({'plain':!![]});if(!_0x204432)throw new Error(_0x2646('0x50'));if(_0x204432[_0x2646('0x51')]===_0x2646('0x4f')){var _0x1c3987=_0x152f8a[_0x2646('0x27')]({'plain':!![]});var _0x345d3e='Dispositions';return db[_0x2646('0x52')][_0x2646('0x53')]({'where':{'name':_0x345d3e,'userProfileId':_0x204432['userProfileId']},'raw':!![]})['then'](function(_0x1e6aa9){if(_0x1e6aa9&&_0x1e6aa9[_0x2646('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x1c3987[_0x2646('0x2b')],'resourceId':_0x1c3987['id'],'type':_0x1e6aa9[_0x2646('0x2b')],'sectionId':_0x1e6aa9['id']},{})[_0x2646('0x25')](function(){return _0x152f8a;});}else{return _0x152f8a;}})[_0x2646('0x4c')](function(_0x24d269){logger[_0x2646('0x55')](_0x2646('0x56'),_0x24d269);throw _0x24d269;});}return _0x152f8a;})['then'](respondWithResult(_0x2fe6dc,0xc9))[_0x2646('0x4c')](handleError(_0x2fe6dc,null));};exports[_0x2646('0x24')]=function(_0x1f6810,_0x33c1a4){if(_0x1f6810[_0x2646('0x4e')]['id']){delete _0x1f6810['body']['id'];}return db[_0x2646('0x45')][_0x2646('0x53')]({'where':{'id':_0x1f6810[_0x2646('0x4a')]['id']}})[_0x2646('0x25')](handleEntityNotFound(_0x33c1a4,null))['then'](saveUpdates(_0x1f6810[_0x2646('0x4e')],null))[_0x2646('0x25')](respondWithResult(_0x33c1a4,null))[_0x2646('0x4c')](handleError(_0x33c1a4,null));};exports[_0x2646('0x26')]=function(_0x29d71d,_0x1d213d){return db[_0x2646('0x45')]['find']({'where':{'id':_0x29d71d[_0x2646('0x4a')]['id']}})[_0x2646('0x25')](handleEntityNotFound(_0x1d213d,null))[_0x2646('0x25')](removeEntity(_0x1d213d,null))[_0x2646('0x4c')](handleError(_0x1d213d,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 82928fb..db55ce4 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 _0x90e6=['name_chat','ChatWebsiteId','name_sms','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','util','../../config/logger','moment','request-promise','path','rimraf','exports','define','Disposition','name_voice','name','ListId'];(function(_0x21326c,_0x10b84b){var _0x379fb1=function(_0x182229){while(--_0x182229){_0x21326c['push'](_0x21326c['shift']());}};_0x379fb1(++_0x10b84b);}(_0x90e6,0xe3));var _0x690e=function(_0x4b1032,_0x36952e){_0x4b1032=_0x4b1032-0x0;var _0x5a1d55=_0x90e6[_0x4b1032];return _0x5a1d55;};'use strict';var _=require(_0x690e('0x0'));var util=require(_0x690e('0x1'));var logger=require(_0x690e('0x2'))('api');var moment=require(_0x690e('0x3'));var BPromise=require('bluebird');var rp=require(_0x690e('0x4'));var fs=require('fs');var path=require(_0x690e('0x5'));var rimraf=require(_0x690e('0x6'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0x690e('0x7')]=function(_0x17b6e5,_0x463059){return _0x17b6e5[_0x690e('0x8')](_0x690e('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x690e('0xa'),'fields':[_0x690e('0xb'),_0x690e('0xc')]},{'unique':!![],'name':_0x690e('0xd'),'fields':[_0x690e('0xb'),_0x690e('0xe')]},{'unique':!![],'name':'name_mail','fields':[_0x690e('0xb'),'MailAccountId']},{'unique':!![],'name':_0x690e('0xf'),'fields':[_0x690e('0xb'),'SmsAccountId']},{'unique':!![],'name':'name_fax','fields':[_0x690e('0xb'),_0x690e('0x10')]},{'unique':!![],'name':_0x690e('0x11'),'fields':[_0x690e('0xb'),_0x690e('0x12')]},{'unique':!![],'name':_0x690e('0x13'),'fields':['name','WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb656=['ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','WhatsappAccountId','lodash','util','../../config/logger','api','moment','path','rimraf','./disposition.attributes','exports','tools_dispositions','name_voice','name'];(function(_0x1db551,_0x4a6682){var _0x7b3bdc=function(_0x36c82c){while(--_0x36c82c){_0x1db551['push'](_0x1db551['shift']());}};_0x7b3bdc(++_0x4a6682);}(_0xb656,0x1a9));var _0x6b65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb656[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6b65('0x0'));var util=require(_0x6b65('0x1'));var logger=require(_0x6b65('0x2'))(_0x6b65('0x3'));var moment=require(_0x6b65('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6b65('0x5'));var rimraf=require(_0x6b65('0x6'));var config=require('../../config/environment');var attributes=require(_0x6b65('0x7'));module[_0x6b65('0x8')]=function(_0x1cd1fd,_0x23ba2b){return _0x1cd1fd['define']('Disposition',attributes,{'tableName':_0x6b65('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x6b65('0xa'),'fields':[_0x6b65('0xb'),_0x6b65('0xc')]},{'unique':!![],'name':_0x6b65('0xd'),'fields':[_0x6b65('0xb'),_0x6b65('0xe')]},{'unique':!![],'name':_0x6b65('0xf'),'fields':[_0x6b65('0xb'),_0x6b65('0x10')]},{'unique':!![],'name':_0x6b65('0x11'),'fields':[_0x6b65('0xb'),_0x6b65('0x12')]},{'unique':!![],'name':_0x6b65('0x13'),'fields':[_0x6b65('0xb'),_0x6b65('0x14')]},{'unique':!![],'name':_0x6b65('0x15'),'fields':[_0x6b65('0xb'),'OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0x6b65('0xb'),_0x6b65('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index c4a4c33..9b653fb 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(_0x190566,_0x2cf04f){var _0x2f42db=function(_0x1769d9){while(--_0x1769d9){_0x190566['push'](_0x190566['shift']());}};_0x2f42db(++_0x2cf04f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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(_0x24669b,_0x144ee1){var _0x3cf3b4=function(_0x57ca9d){while(--_0x57ca9d){_0x24669b['push'](_0x24669b['shift']());}};_0x3cf3b4(++_0x144ee1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 aa278f1..63a85d5 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 _0xa569=['util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','/:id','show','create','put','update','delete','exports'];(function(_0x3823fe,_0x5052e4){var _0x1bc34b=function(_0x5947b6){while(--_0x5947b6){_0x3823fe['push'](_0x3823fe['shift']());}};_0x1bc34b(++_0x5052e4);}(_0xa569,0xcc));var _0x9a56=function(_0x365e54,_0x44be74){_0x365e54=_0x365e54-0x0;var _0x13317a=_0xa569[_0x365e54];return _0x13317a;};'use strict';var multer=require('multer');var util=require(_0x9a56('0x0'));var path=require('path');var timeout=require(_0x9a56('0x1'));var express=require(_0x9a56('0x2'));var router=express[_0x9a56('0x3')]();var fs_extra=require(_0x9a56('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9a56('0x5'));var config=require(_0x9a56('0x6'));var controller=require(_0x9a56('0x7'));router[_0x9a56('0x8')]('/',auth[_0x9a56('0x9')](),controller['index']);router['get'](_0x9a56('0xa'),auth[_0x9a56('0x9')](),controller[_0x9a56('0xb')]);router['post']('/',auth[_0x9a56('0x9')](),controller[_0x9a56('0xc')]);router[_0x9a56('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x9a56('0xe')]);router[_0x9a56('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x9a56('0x10')]=router; \ No newline at end of file +var _0xfaee=['/:id','show','post','create','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated'];(function(_0x4e74c3,_0x5c8a2d){var _0x2fb1dd=function(_0x464f1c){while(--_0x464f1c){_0x4e74c3['push'](_0x4e74c3['shift']());}};_0x2fb1dd(++_0x5c8a2d);}(_0xfaee,0x15d));var _0xefae=function(_0x1fd675,_0x587658){_0x1fd675=_0x1fd675-0x0;var _0x521d1c=_0xfaee[_0x1fd675];return _0x521d1c;};'use strict';var multer=require(_0xefae('0x0'));var util=require(_0xefae('0x1'));var path=require('path');var timeout=require(_0xefae('0x2'));var express=require(_0xefae('0x3'));var router=express[_0xefae('0x4')]();var fs_extra=require(_0xefae('0x5'));var auth=require(_0xefae('0x6'));var interaction=require(_0xefae('0x7'));var config=require(_0xefae('0x8'));var controller=require(_0xefae('0x9'));router[_0xefae('0xa')]('/',auth[_0xefae('0xb')](),controller['index']);router[_0xefae('0xa')](_0xefae('0xc'),auth[_0xefae('0xb')](),controller[_0xefae('0xd')]);router[_0xefae('0xe')]('/',auth['isAuthenticated'](),controller[_0xefae('0xf')]);router[_0xefae('0x10')](_0xefae('0xc'),auth[_0xefae('0xb')](),controller['update']);router['delete'](_0xefae('0xc'),auth[_0xefae('0xb')](),controller[_0xefae('0x11')]);module[_0xefae('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 78fe65e..420c767 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 _0x734a=['9600','14400','4800','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','yes','localstationid','2400','7200'];(function(_0xa80011,_0x3ecd39){var _0x4b41b5=function(_0x104b6b){while(--_0x104b6b){_0xa80011['push'](_0xa80011['shift']());}};_0x4b41b5(++_0x3ecd39);}(_0x734a,0x83));var _0xa734=function(_0x42546d,_0x4b060a){_0x42546d=_0x42546d-0x0;var _0x5cac5b=_0x734a[_0x42546d];return _0x5cac5b;};'use strict';var Sequelize=require(_0xa734('0x0'));module['exports']={'name':{'type':Sequelize[_0xa734('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa734('0x1')]},'ecm':{'type':Sequelize[_0xa734('0x2')](_0xa734('0x3'),'no'),'defaultValue':_0xa734('0x3')},'headerinfo':{'type':Sequelize[_0xa734('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':_0xa734('0x4')},'minrate':{'type':Sequelize['ENUM'](_0xa734('0x5'),'4800',_0xa734('0x6'),_0xa734('0x7'),'12000',_0xa734('0x8')),'defaultValue':_0xa734('0x9')},'maxrate':{'type':Sequelize[_0xa734('0x2')]('2400',_0xa734('0x9'),'7200',_0xa734('0x7'),'12000',_0xa734('0x8')),'defaultValue':'14400'},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xa734('0xa')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xa734('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xa734('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xa734('0x2')](_0xa734('0xc'),_0xa734('0xd'),_0xa734('0xe'),_0xa734('0xf')),'defaultValue':_0xa734('0xc')},'key':{'type':Sequelize[_0xa734('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa734('0x10')],'defaultValue':function(){return _0xa734('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa734('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa734('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa734('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa734('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa734('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa734('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa734('0xb')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xa734('0x12')],'defaultValue':![],'comment':_0xa734('0x13'),'set':function(_0x3bb5cb){if(!_0x3bb5cb)this[_0xa734('0x14')](_0xa734('0x15'),null);this[_0xa734('0x14')](_0xa734('0x16'),_0x3bb5cb);}}}; \ No newline at end of file +var _0xe606=['BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','12000','14400','7200','9600','INTEGER','SIP','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0xc5b1aa,_0x436c79){var _0x4cfe8d=function(_0xac03f5){while(--_0xac03f5){_0xc5b1aa['push'](_0xc5b1aa['shift']());}};_0x4cfe8d(++_0x436c79);}(_0xe606,0x125));var _0x6e60=function(_0x12314f,_0x2ac7ae){_0x12314f=_0x12314f-0x0;var _0x3b6e61=_0xe606[_0x12314f];return _0x3b6e61;};'use strict';var Sequelize=require(_0x6e60('0x0'));module[_0x6e60('0x1')]={'name':{'type':Sequelize[_0x6e60('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x6e60('0x3')](_0x6e60('0x4'),'no'),'defaultValue':_0x6e60('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x6e60('0x5')},'localstationid':{'type':Sequelize[_0x6e60('0x2')],'unique':_0x6e60('0x6')},'minrate':{'type':Sequelize[_0x6e60('0x3')](_0x6e60('0x7'),_0x6e60('0x8'),'7200','9600',_0x6e60('0x9'),_0x6e60('0xa')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x6e60('0x3')]('2400',_0x6e60('0x8'),_0x6e60('0xb'),_0x6e60('0xc'),'12000','14400'),'defaultValue':_0x6e60('0xa')},'modem':{'type':Sequelize[_0x6e60('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x6e60('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x6e60('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x6e60('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x6e60('0x3')](_0x6e60('0xe'),'IAX',_0x6e60('0xf'),_0x6e60('0x10')),'defaultValue':_0x6e60('0xe')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6e60('0x11')],'defaultValue':function(){return _0x6e60('0x12');}},'notificationSound':{'type':Sequelize[_0x6e60('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6e60('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6e60('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6e60('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6e60('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6e60('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6e60('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6e60('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x6e60('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x6e60('0x13')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2721a4){if(!_0x2721a4)this[_0x6e60('0x15')](_0x6e60('0x16'),null);this[_0x6e60('0x15')](_0x6e60('0x17'),_0x2721a4);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 352bde8..6472def 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 _0x137f=['priority','send','getApplications','context','exten','localstationid','app','system','description','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','t38timeout','FAXOPT(','ReceiveFax','addAccountApplications','bulkCreate','updateAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','DESC','attachments','join','root','basename','isNil','from','\x22%s\x22\x20<%s>','fax','List','List\x20not\x20found','Send\x20Fax\x20failed','filename','Contact\x20not\x20found','spread','out','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','destroy','get','FaxAccounts','UserProfileResource','end','stack','name','Pause','mandatoryDispositionPause','FaxAccount','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','includeAll','include','findAll','rows','show','rawAttributes','intersection','find','create','user','userProfileId','autoAssociation','update','body','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll'];(function(_0x2a7201,_0x4c0925){var _0x23c86a=function(_0x243338){while(--_0x243338){_0x2a7201['push'](_0x2a7201['shift']());}};_0x23c86a(++_0x4c0925);}(_0x137f,0x105));var _0xf137=function(_0x19454d,_0x568bb2){_0x19454d=_0x19454d-0x0;var _0x4b3f32=_0x137f[_0x19454d];return _0x4b3f32;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf137('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf137('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf137('0x2'));var Mustache=require(_0xf137('0x3'));var util=require('util');var path=require(_0xf137('0x4'));var sox=require(_0xf137('0x5'));var csv=require(_0xf137('0x6'));var ejs=require(_0xf137('0x7'));var fs=require('fs');var fs_extra=require(_0xf137('0x8'));var _=require('lodash');var squel=require(_0xf137('0x9'));var crypto=require(_0xf137('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf137('0xb'));var toCsv=require(_0xf137('0x6'));var querystring=require(_0xf137('0xc'));var Papa=require(_0xf137('0xd'));var Redis=require(_0xf137('0xe'));var authService=require(_0xf137('0xf'));var qs=require(_0xf137('0x10'));var as=require(_0xf137('0x11'));var hardwareService=require(_0xf137('0x12'));var logger=require(_0xf137('0x13'))(_0xf137('0x14'));var utils=require('../../config/utils');var config=require(_0xf137('0x15'));var licenseUtil=require(_0xf137('0x16'));var db=require(_0xf137('0x17'))['db'];config['redis']=_[_0xf137('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf137('0x19'))(new Redis(config['redis']));require(_0xf137('0x1a'))['register'](socket);var jayson=require(_0xf137('0x1b'));var client=jayson[_0xf137('0x1c')][_0xf137('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xf137('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4c5deb,_0xc0fbb5,_0x3fcce4,_0x17a026){return new BPromise(function(_0x1768d2,_0x57c7a5){var _0x37c229=_0x17a026||client;return _0x37c229[_0xf137('0x1e')](_0x4c5deb,_0x3fcce4)[_0xf137('0x1f')](function(_0x35db69){logger[_0xf137('0x20')](_0xf137('0x21'),_0xc0fbb5,_0xf137('0x22'));logger[_0xf137('0x23')](_0xf137('0x24'),_0xc0fbb5,_0xf137('0x22'),JSON['stringify'](_0x35db69));if(_0x35db69[_0xf137('0x25')]){if(_0x35db69['error']['code']===0x1f4){logger[_0xf137('0x25')](_0xf137('0x21'),_0xc0fbb5,_0x35db69[_0xf137('0x25')][_0xf137('0x26')]);return _0x57c7a5(_0x35db69[_0xf137('0x25')]['message']);}logger['error']('FaxAccount,\x20%s,\x20%s',_0xc0fbb5,_0x35db69[_0xf137('0x25')][_0xf137('0x26')]);return _0x1768d2(_0x35db69[_0xf137('0x25')]['message']);}else{logger[_0xf137('0x20')](_0xf137('0x21'),_0xc0fbb5,'request\x20sent');_0x1768d2(_0x35db69[_0xf137('0x27')][_0xf137('0x26')]);}})[_0xf137('0x28')](function(_0x5ab391){logger['error'](_0xf137('0x21'),_0xc0fbb5,_0x5ab391);_0x57c7a5(_0x5ab391);});});}function respondWithStatusCode(_0x2b87ac,_0x54ce20){_0x54ce20=_0x54ce20||0xcc;return function(_0x2279fc){if(_0x2279fc){return _0x2b87ac[_0xf137('0x29')](_0x54ce20);}return _0x2b87ac[_0xf137('0x2a')](_0x54ce20)['end']();};}function respondWithResult(_0x541db5,_0x507216){_0x507216=_0x507216||0xc8;return function(_0x25a617){if(_0x25a617){return _0x541db5['status'](_0x507216)['json'](_0x25a617);}};}function respondWithFilteredResult(_0x34f23e,_0x7e046f){return function(_0x1e21fa){if(_0x1e21fa){var _0x33997d=typeof _0x7e046f['offset']===_0xf137('0x2b')&&typeof _0x7e046f[_0xf137('0x2c')]===_0xf137('0x2b');var _0x2b0677=_0x1e21fa[_0xf137('0x2d')];var _0x406295=_0x33997d?0x0:_0x7e046f[_0xf137('0x2e')];var _0x22cb54=_0x33997d?_0x1e21fa[_0xf137('0x2d')]:_0x7e046f['offset']+_0x7e046f['limit'];var _0x2e5f96;if(_0x22cb54>=_0x2b0677){_0x22cb54=_0x2b0677;_0x2e5f96=0xc8;}else{_0x2e5f96=0xce;}_0x34f23e['status'](_0x2e5f96);return _0x34f23e[_0xf137('0x2f')](_0xf137('0x30'),_0x406295+'-'+_0x22cb54+'/'+_0x2b0677)[_0xf137('0x31')](_0x1e21fa);}return null;};}function patchUpdates(_0x115b1c){return function(_0x3d8db4){try{jsonpatch[_0xf137('0x32')](_0x3d8db4,_0x115b1c,!![]);}catch(_0x871ed8){return BPromise[_0xf137('0x33')](_0x871ed8);}return _0x3d8db4[_0xf137('0x34')]();};}function saveUpdates(_0x54f030,_0x223cdc){return function(_0x3d9078){if(_0x3d9078){return _0x3d9078['update'](_0x54f030)[_0xf137('0x1f')](function(_0x238dbd){return _0x238dbd;});}return null;};}function removeEntity(_0xdc30d1,_0x179658){return function(_0x8e83c7){if(_0x8e83c7){return _0x8e83c7[_0xf137('0x35')]()[_0xf137('0x1f')](function(){var _0x5f47a8=_0x8e83c7[_0xf137('0x36')]({'plain':!![]});var _0x3b9668=_0xf137('0x37');return db[_0xf137('0x38')]['destroy']({'where':{'type':_0x3b9668,'resourceId':_0x5f47a8['id']}})[_0xf137('0x1f')](function(){return _0x8e83c7;});})[_0xf137('0x1f')](function(){_0xdc30d1[_0xf137('0x2a')](0xcc)[_0xf137('0x39')]();});}};}function handleEntityNotFound(_0x123356,_0x5d8706){return function(_0x1ac14e){if(!_0x1ac14e){_0x123356['sendStatus'](0x194);}return _0x1ac14e;};}function handleError(_0x39da8f,_0x2cb23e){_0x2cb23e=_0x2cb23e||0x1f4;return function(_0x560f90){logger['error'](_0x560f90[_0xf137('0x3a')]);if(_0x560f90[_0xf137('0x3b')]){delete _0x560f90[_0xf137('0x3b')];}_0x39da8f[_0xf137('0x2a')](_0x2cb23e)['send'](_0x560f90);};}exports['index']=function(_0x53085a,_0x2718de){var _0x353fd5={'include':[{'model':db[_0xf137('0x3c')],'as':_0xf137('0x3d')}]},_0x4b09a4={},_0xb2c9ea={'count':0x0,'rows':[]};var _0x48f2d1=_['map'](db[_0xf137('0x3e')]['rawAttributes'],function(_0x46921e){return{'name':_0x46921e[_0xf137('0x3f')],'type':_0x46921e[_0xf137('0x40')][_0xf137('0x41')]};});_0x4b09a4[_0xf137('0x42')]=_[_0xf137('0x43')](_0x48f2d1,_0xf137('0x3b'));_0x4b09a4[_0xf137('0x44')]=_[_0xf137('0x45')](_0x53085a[_0xf137('0x44')]);_0x4b09a4[_0xf137('0x46')]=_['intersection'](_0x4b09a4['model'],_0x4b09a4['query']);_0x353fd5[_0xf137('0x47')]=_['intersection'](_0x4b09a4[_0xf137('0x42')],qs[_0xf137('0x48')](_0x53085a[_0xf137('0x44')][_0xf137('0x48')]));_0x353fd5[_0xf137('0x47')]=_0x353fd5[_0xf137('0x47')][_0xf137('0x49')]?_0x353fd5[_0xf137('0x47')]:_0x4b09a4[_0xf137('0x42')];if(!_0x53085a[_0xf137('0x44')][_0xf137('0x4a')](_0xf137('0x4b'))){_0x353fd5[_0xf137('0x2c')]=qs[_0xf137('0x2c')](_0x53085a[_0xf137('0x44')]['limit']);_0x353fd5[_0xf137('0x2e')]=qs[_0xf137('0x2e')](_0x53085a['query'][_0xf137('0x2e')]);}_0x353fd5[_0xf137('0x4c')]=qs[_0xf137('0x4d')](_0x53085a[_0xf137('0x44')]['sort']);_0x353fd5['where']=qs[_0xf137('0x46')](_[_0xf137('0x4e')](_0x53085a[_0xf137('0x44')],_0x4b09a4[_0xf137('0x46')]),_0x48f2d1);if(_0x53085a['query']['filter']){_0x353fd5[_0xf137('0x4f')]=_[_0xf137('0x50')](_0x353fd5['where'],{'$or':_[_0xf137('0x43')](_0x48f2d1,function(_0x319f78){if(_0x319f78[_0xf137('0x40')]!=='VIRTUAL'){var _0x381815={};_0x381815[_0x319f78['name']]={'$like':'%'+_0x53085a[_0xf137('0x44')][_0xf137('0x51')]+'%'};return _0x381815;}})});}_0x353fd5=_[_0xf137('0x50')]({},_0x353fd5,_0x53085a[_0xf137('0x52')]);var _0x4aa718={'where':_0x353fd5[_0xf137('0x4f')]};return db[_0xf137('0x3e')][_0xf137('0x2d')](_0x4aa718)[_0xf137('0x1f')](function(_0x1a65b5){_0xb2c9ea[_0xf137('0x2d')]=_0x1a65b5;if(_0x53085a[_0xf137('0x44')][_0xf137('0x53')]){_0x353fd5[_0xf137('0x54')]=[{'all':!![]}];}return db[_0xf137('0x3e')][_0xf137('0x55')](_0x353fd5);})[_0xf137('0x1f')](function(_0x2e1db5){_0xb2c9ea[_0xf137('0x56')]=_0x2e1db5;return _0xb2c9ea;})[_0xf137('0x1f')](respondWithFilteredResult(_0x2718de,_0x353fd5))[_0xf137('0x28')](handleError(_0x2718de,null));};exports[_0xf137('0x57')]=function(_0x11d37d,_0x421f04){var _0x3f90b1={'raw':![],'where':{'id':_0x11d37d['params']['id']},'include':[{'model':db[_0xf137('0x3c')],'as':_0xf137('0x3d')}]},_0x23c543={};_0x23c543[_0xf137('0x42')]=_[_0xf137('0x45')](db['FaxAccount'][_0xf137('0x58')]);_0x23c543[_0xf137('0x44')]=_['keys'](_0x11d37d[_0xf137('0x44')]);_0x23c543['filters']=_['intersection'](_0x23c543[_0xf137('0x42')],_0x23c543[_0xf137('0x44')]);_0x3f90b1[_0xf137('0x47')]=_[_0xf137('0x59')](_0x23c543[_0xf137('0x42')],qs[_0xf137('0x48')](_0x11d37d[_0xf137('0x44')]['fields']));_0x3f90b1[_0xf137('0x47')]=_0x3f90b1['attributes'][_0xf137('0x49')]?_0x3f90b1[_0xf137('0x47')]:_0x23c543[_0xf137('0x42')];if(_0x11d37d[_0xf137('0x44')][_0xf137('0x53')]){_0x3f90b1['include']=[{'all':!![]}];}_0x3f90b1=_['merge']({},_0x3f90b1,_0x11d37d[_0xf137('0x52')]);return db[_0xf137('0x3e')][_0xf137('0x5a')](_0x3f90b1)['then'](handleEntityNotFound(_0x421f04,null))['then'](respondWithResult(_0x421f04,null))[_0xf137('0x28')](handleError(_0x421f04,null));};exports[_0xf137('0x5b')]=function(_0x56602c,_0x33a8f3){return db[_0xf137('0x3e')]['create'](_0x56602c['body'],{})['then'](function(_0x208360){var _0x5c1213=_0x56602c[_0xf137('0x5c')]['get']({'plain':!![]});if(!_0x5c1213)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c1213['role']===_0xf137('0x5c')){var _0x2e5ad9=_0x208360['get']({'plain':!![]});var _0x13ad7d=_0xf137('0x37');return db['UserProfileSection'][_0xf137('0x5a')]({'where':{'name':_0x13ad7d,'userProfileId':_0x5c1213[_0xf137('0x5d')]},'raw':!![]})[_0xf137('0x1f')](function(_0x3e3e17){if(_0x3e3e17&&_0x3e3e17[_0xf137('0x5e')]===0x0){return db[_0xf137('0x38')][_0xf137('0x5b')]({'name':_0x2e5ad9['name'],'resourceId':_0x2e5ad9['id'],'type':_0x3e3e17[_0xf137('0x3b')],'sectionId':_0x3e3e17['id']},{})[_0xf137('0x1f')](function(){return _0x208360;});}else{return _0x208360;}})[_0xf137('0x28')](function(_0xa4b84){logger[_0xf137('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa4b84);throw _0xa4b84;});}return _0x208360;})[_0xf137('0x1f')](respondWithResult(_0x33a8f3,0xc9))[_0xf137('0x28')](handleError(_0x33a8f3,null));};exports[_0xf137('0x5f')]=function(_0x44cfe4,_0x49daf7){if(_0x44cfe4[_0xf137('0x60')]['id']){delete _0x44cfe4[_0xf137('0x60')]['id'];}return db['FaxAccount'][_0xf137('0x5a')]({'where':{'id':_0x44cfe4[_0xf137('0x61')]['id']},'include':[{'model':db[_0xf137('0x3c')],'as':_0xf137('0x3d')}]})[_0xf137('0x1f')](handleEntityNotFound(_0x49daf7,null))[_0xf137('0x1f')](saveUpdates(_0x44cfe4[_0xf137('0x60')],null))[_0xf137('0x1f')](respondWithResult(_0x49daf7,null))[_0xf137('0x28')](handleError(_0x49daf7,null));};exports[_0xf137('0x35')]=function(_0x39d321,_0x3ee06f){return db[_0xf137('0x3e')][_0xf137('0x5a')]({'where':{'id':_0x39d321[_0xf137('0x61')]['id']}})[_0xf137('0x1f')](handleEntityNotFound(_0x3ee06f,null))['then'](removeEntity(_0x3ee06f,null))[_0xf137('0x28')](handleError(_0x3ee06f,null));};exports[_0xf137('0x62')]=function(_0xf870ff,_0x5a745d){return db[_0xf137('0x3e')][_0xf137('0x62')]()[_0xf137('0x1f')](respondWithResult(_0x5a745d,null))[_0xf137('0x28')](handleError(_0x5a745d,null));};exports[_0xf137('0x63')]=function(_0x41f195,_0x39e980,_0x292bb8){if(_0x41f195['body']['id']){delete _0x41f195[_0xf137('0x60')]['id'];}return db[_0xf137('0x3e')][_0xf137('0x5a')]({'where':{'id':_0x41f195['params']['id']}})[_0xf137('0x1f')](handleEntityNotFound(_0x39e980,null))[_0xf137('0x1f')](function(_0x1cd077){if(_0x1cd077){_0x41f195[_0xf137('0x60')][_0xf137('0x64')]=_0x1cd077['id'];return db[_0xf137('0x65')][_0xf137('0x5b')](_0x41f195[_0xf137('0x60')]);}})['then'](respondWithResult(_0x39e980,null))[_0xf137('0x28')](handleError(_0x39e980,null));};exports[_0xf137('0x66')]=function(_0x1d7c45,_0x15cc65,_0x1b4d95){var _0xc3aaa4={'raw':![],'where':{}};var _0xac84e3={};var _0x4ae127={'count':0x0,'rows':[]};return db[_0xf137('0x3e')][_0xf137('0x67')]({'where':{'id':_0x1d7c45[_0xf137('0x61')]['id']}})[_0xf137('0x1f')](handleEntityNotFound(_0x15cc65,null))['then'](function(_0x5898b2){if(_0x5898b2){_0xac84e3[_0xf137('0x42')]=_[_0xf137('0x45')](db[_0xf137('0x65')][_0xf137('0x58')]);_0xac84e3[_0xf137('0x44')]=_[_0xf137('0x45')](_0x1d7c45[_0xf137('0x44')]);_0xac84e3[_0xf137('0x46')]=_['intersection'](_0xac84e3[_0xf137('0x42')],_0xac84e3[_0xf137('0x44')]);_0xc3aaa4[_0xf137('0x47')]=_[_0xf137('0x59')](_0xac84e3[_0xf137('0x42')],qs[_0xf137('0x48')](_0x1d7c45['query']['fields']));_0xc3aaa4[_0xf137('0x47')]=_0xc3aaa4['attributes'][_0xf137('0x49')]?_0xc3aaa4[_0xf137('0x47')]:_0xac84e3[_0xf137('0x42')];if(!_0x1d7c45[_0xf137('0x44')][_0xf137('0x4a')](_0xf137('0x4b'))){_0xc3aaa4[_0xf137('0x2c')]=qs[_0xf137('0x2c')](_0x1d7c45[_0xf137('0x44')]['limit']);_0xc3aaa4['offset']=qs[_0xf137('0x2e')](_0x1d7c45['query'][_0xf137('0x2e')]);}_0xc3aaa4['order']=qs[_0xf137('0x4d')](_0x1d7c45['query'][_0xf137('0x4d')]);_0xc3aaa4[_0xf137('0x4f')]=qs[_0xf137('0x46')](_['pick'](_0x1d7c45['query'],_0xac84e3[_0xf137('0x46')]));_0xc3aaa4[_0xf137('0x4f')]['FaxAccountId']=_0x5898b2['id'];if(_0x1d7c45[_0xf137('0x44')]['filter']){_0xc3aaa4['where']=_[_0xf137('0x50')](_0xc3aaa4['where'],{'$or':_[_0xf137('0x43')](_0xc3aaa4[_0xf137('0x47')],function(_0x35e4b3){var _0x133fb0={};_0x133fb0[_0x35e4b3]={'$like':'%'+_0x1d7c45[_0xf137('0x44')]['filter']+'%'};return _0x133fb0;})});}_0xc3aaa4=_[_0xf137('0x50')]({},_0xc3aaa4,_0x1d7c45[_0xf137('0x52')]);return db[_0xf137('0x65')][_0xf137('0x2d')]({'where':_0xc3aaa4[_0xf137('0x4f')]})['then'](function(_0x4375f1){_0x4ae127[_0xf137('0x2d')]=_0x4375f1;if(_0x1d7c45[_0xf137('0x44')][_0xf137('0x53')]){_0xc3aaa4[_0xf137('0x54')]=[{'all':!![]}];}return db[_0xf137('0x65')][_0xf137('0x55')](_0xc3aaa4);})[_0xf137('0x1f')](function(_0x206ccb){_0x4ae127[_0xf137('0x56')]=_0x206ccb;return _0x4ae127;});}})['then'](respondWithFilteredResult(_0x15cc65,_0xc3aaa4))[_0xf137('0x28')](handleError(_0x15cc65,null));};exports[_0xf137('0x68')]=function(_0x204800,_0x5adb88,_0x512abd){return db['FaxAccount'][_0xf137('0x5a')]({'where':{'id':_0x204800[_0xf137('0x61')]['id']}})[_0xf137('0x1f')](handleEntityNotFound(_0x5adb88,null))[_0xf137('0x1f')](function(_0x2fe35a){if(_0x2fe35a){return _0x2fe35a[_0xf137('0x68')](_0x204800['query'][_0xf137('0x69')]);}})[_0xf137('0x1f')](respondWithStatusCode(_0x5adb88,null))[_0xf137('0x28')](handleError(_0x5adb88,null));};exports[_0xf137('0x6a')]=function(_0x399e1b,_0x4ef637,_0x30b4f5){if(_0x399e1b[_0xf137('0x60')]['id']){delete _0x399e1b[_0xf137('0x60')]['id'];}return db[_0xf137('0x3e')][_0xf137('0x5a')]({'where':{'id':_0x399e1b['params']['id']}})[_0xf137('0x1f')](handleEntityNotFound(_0x4ef637,null))[_0xf137('0x1f')](function(_0x2ac082){if(_0x2ac082){_0x399e1b[_0xf137('0x60')][_0xf137('0x64')]=_0x2ac082['id'];return db[_0xf137('0x6b')][_0xf137('0x5b')](_0x399e1b['body']);}})['then'](respondWithResult(_0x4ef637,null))[_0xf137('0x28')](handleError(_0x4ef637,null));};exports['getAnswers']=function(_0x5a69b2,_0x3bf17e,_0x13dfb2){var _0x1c091c={'raw':![],'where':{}};var _0x4d2b63={};var _0x45cf34={'count':0x0,'rows':[]};return db[_0xf137('0x3e')][_0xf137('0x67')]({'where':{'id':_0x5a69b2['params']['id']}})[_0xf137('0x1f')](handleEntityNotFound(_0x3bf17e,null))['then'](function(_0x379915){if(_0x379915){_0x4d2b63['model']=_[_0xf137('0x45')](db['CannedAnswer']['rawAttributes']);_0x4d2b63[_0xf137('0x44')]=_['keys'](_0x5a69b2[_0xf137('0x44')]);_0x4d2b63[_0xf137('0x46')]=_[_0xf137('0x59')](_0x4d2b63['model'],_0x4d2b63[_0xf137('0x44')]);_0x1c091c[_0xf137('0x47')]=_[_0xf137('0x59')](_0x4d2b63[_0xf137('0x42')],qs[_0xf137('0x48')](_0x5a69b2[_0xf137('0x44')][_0xf137('0x48')]));_0x1c091c[_0xf137('0x47')]=_0x1c091c[_0xf137('0x47')][_0xf137('0x49')]?_0x1c091c[_0xf137('0x47')]:_0x4d2b63[_0xf137('0x42')];if(!_0x5a69b2[_0xf137('0x44')][_0xf137('0x4a')](_0xf137('0x4b'))){_0x1c091c[_0xf137('0x2c')]=qs['limit'](_0x5a69b2['query'][_0xf137('0x2c')]);_0x1c091c[_0xf137('0x2e')]=qs['offset'](_0x5a69b2['query'][_0xf137('0x2e')]);}_0x1c091c[_0xf137('0x4c')]=qs['sort'](_0x5a69b2['query'][_0xf137('0x4d')]);_0x1c091c[_0xf137('0x4f')]=qs['filters'](_['pick'](_0x5a69b2[_0xf137('0x44')],_0x4d2b63[_0xf137('0x46')]));_0x1c091c[_0xf137('0x4f')]['FaxAccountId']=_0x379915['id'];if(_0x5a69b2[_0xf137('0x44')][_0xf137('0x51')]){_0x1c091c[_0xf137('0x4f')]=_['merge'](_0x1c091c[_0xf137('0x4f')],{'$or':_['map'](_0x1c091c['attributes'],function(_0x2ddf69){var _0x35b4f8={};_0x35b4f8[_0x2ddf69]={'$like':'%'+_0x5a69b2[_0xf137('0x44')]['filter']+'%'};return _0x35b4f8;})});}_0x1c091c=_[_0xf137('0x50')]({},_0x1c091c,_0x5a69b2[_0xf137('0x52')]);return db[_0xf137('0x6b')][_0xf137('0x2d')]({'where':_0x1c091c[_0xf137('0x4f')]})[_0xf137('0x1f')](function(_0x3472fe){_0x45cf34[_0xf137('0x2d')]=_0x3472fe;if(_0x5a69b2['query'][_0xf137('0x53')]){_0x1c091c[_0xf137('0x54')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x1c091c);})[_0xf137('0x1f')](function(_0x20d207){_0x45cf34['rows']=_0x20d207;return _0x45cf34;});}})['then'](respondWithFilteredResult(_0x3bf17e,_0x1c091c))[_0xf137('0x28')](handleError(_0x3bf17e,null));};exports[_0xf137('0x6c')]=function(_0x5a8053,_0x1037d3,_0x2c0a30){return db[_0xf137('0x3e')][_0xf137('0x5a')]({'where':{'id':_0x5a8053[_0xf137('0x61')]['id']}})[_0xf137('0x1f')](handleEntityNotFound(_0x1037d3,null))['then'](function(_0x2cc5d1){if(_0x2cc5d1){return _0x2cc5d1[_0xf137('0x6c')](_0x5a8053[_0xf137('0x44')][_0xf137('0x69')]);}})[_0xf137('0x1f')](respondWithStatusCode(_0x1037d3,null))[_0xf137('0x28')](handleError(_0x1037d3,null));};exports[_0xf137('0x6d')]=function(_0x299c03,_0x20431a,_0x366e5a){return db['FaxInteraction']['find']({'where':{'id':_0x299c03[_0xf137('0x61')]['id']}})[_0xf137('0x1f')](handleEntityNotFound(_0x20431a,null))[_0xf137('0x1f')](function(_0x4b5a72){if(_0x4b5a72){return _0x4b5a72[_0xf137('0x6d')](_0x299c03[_0xf137('0x60')]['ids'],_[_0xf137('0x6e')](_0x299c03[_0xf137('0x60')],[_0xf137('0x69'),'id'])||{});}})[_0xf137('0x1f')](respondWithResult(_0x20431a,null))['catch'](handleError(_0x20431a,null));};exports[_0xf137('0x6f')]=function(_0x15cadb,_0x227d09,_0x103e6f){var _0x43e1e9={'raw':![],'where':{}};var _0x1df9ef={};var _0x59c2a9={'count':0x0,'rows':[]};return db[_0xf137('0x3e')][_0xf137('0x67')]({'where':{'id':_0x15cadb[_0xf137('0x61')]['id']}})[_0xf137('0x1f')](handleEntityNotFound(_0x227d09,null))[_0xf137('0x1f')](function(_0x1aca50){if(_0x1aca50){_0x1df9ef[_0xf137('0x42')]=_[_0xf137('0x45')](db[_0xf137('0x70')][_0xf137('0x58')]);_0x1df9ef[_0xf137('0x44')]=_[_0xf137('0x45')](_0x15cadb['query']);_0x1df9ef[_0xf137('0x46')]=_[_0xf137('0x59')](_0x1df9ef[_0xf137('0x42')],_0x1df9ef[_0xf137('0x44')]);_0x43e1e9[_0xf137('0x47')]=_[_0xf137('0x59')](_0x1df9ef[_0xf137('0x42')],qs[_0xf137('0x48')](_0x15cadb[_0xf137('0x44')][_0xf137('0x48')]));_0x43e1e9[_0xf137('0x47')]=_0x43e1e9['attributes'][_0xf137('0x49')]?_0x43e1e9['attributes']:_0x1df9ef[_0xf137('0x42')];if(!_0x15cadb[_0xf137('0x44')]['hasOwnProperty']('nolimit')){_0x43e1e9[_0xf137('0x2c')]=qs[_0xf137('0x2c')](_0x15cadb[_0xf137('0x44')][_0xf137('0x2c')]);_0x43e1e9[_0xf137('0x2e')]=qs[_0xf137('0x2e')](_0x15cadb['query']['offset']);}_0x43e1e9[_0xf137('0x4c')]=qs[_0xf137('0x4d')](_0x15cadb[_0xf137('0x44')][_0xf137('0x4d')]);_0x43e1e9[_0xf137('0x4f')]=qs['filters'](_['pick'](_0x15cadb[_0xf137('0x44')],_0x1df9ef[_0xf137('0x46')]));_0x43e1e9[_0xf137('0x4f')]['FaxAccountId']=_0x1aca50['id'];if(_0x15cadb[_0xf137('0x44')][_0xf137('0x51')]){_0x43e1e9['where']=_['merge'](_0x43e1e9['where'],{'$or':_[_0xf137('0x43')](_0x43e1e9[_0xf137('0x47')],function(_0x4ba89b){var _0x125ee5={};_0x125ee5[_0x4ba89b]={'$like':'%'+_0x15cadb[_0xf137('0x44')]['filter']+'%'};return _0x125ee5;})});}_0x43e1e9=_[_0xf137('0x50')]({},_0x43e1e9,_0x15cadb['options']);return db[_0xf137('0x70')][_0xf137('0x2d')]({'where':_0x43e1e9[_0xf137('0x4f')]})[_0xf137('0x1f')](function(_0x36f900){_0x59c2a9['count']=_0x36f900;if(_0x15cadb[_0xf137('0x44')][_0xf137('0x53')]){_0x43e1e9['include']=[{'model':db[_0xf137('0x71')],'as':_0xf137('0x72'),'required':![]},{'model':db[_0xf137('0x73')],'as':_0xf137('0x74'),'attributes':['name',_0xf137('0x75'),_0xf137('0x76')],'required':![]},{'model':db[_0xf137('0x77')],'as':_0xf137('0x78'),'attributes':['id',_0xf137('0x3b'),_0xf137('0x79')],'where':_0x15cadb['query'][_0xf137('0x7a')]?{'id':_0x15cadb[_0xf137('0x44')]['tag']}:undefined,'required':_0x15cadb[_0xf137('0x44')]['tag']?!![]:![]}];}return db[_0xf137('0x70')]['findAll'](_0x43e1e9);})[_0xf137('0x1f')](function(_0x324273){_0x59c2a9['rows']=_0x324273;return _0x59c2a9;});}})['then'](respondWithFilteredResult(_0x227d09,_0x43e1e9))[_0xf137('0x28')](handleError(_0x227d09,null));};exports[_0xf137('0x7b')]=function(_0x3a6347,_0x39b26e){var _0x188ce1=_0x3a6347[_0xf137('0x61')]['id'];var _0x1d9cac=_0x3a6347[_0xf137('0x60')];var _0x5273a8=0xc8;var _0x42f0e6=null;return db[_0xf137('0x7c')][_0xf137('0x7d')]({'isolationLevel':db['sequelize'][_0xf137('0x7e')][_0xf137('0x7f')][_0xf137('0x80')]},function(_0x52253d){return db[_0xf137('0x3e')]['findOne']({'where':{'id':_0x188ce1},'transaction':_0x52253d})[_0xf137('0x1f')](function(_0x4475a){if(_0x4475a){return db['FaxApplication'][_0xf137('0x35')]({'where':{'FaxAccountId':_0x188ce1},'transaction':_0x52253d})[_0xf137('0x1f')](function(){var _0x259cf4=_[_0xf137('0x43')](_0x1d9cac,function(_0x155c16){_0x155c16[_0xf137('0x64')]=_0x188ce1;return _0x155c16;});return db['FaxApplication']['bulkCreate'](_0x259cf4,{'transaction':_0x52253d});});}else{_0x5273a8=0x194;_0x42f0e6=[];}});})[_0xf137('0x1f')](function(){if(_0x5273a8!==0x194){return db[_0xf137('0x81')][_0xf137('0x82')]({'where':{'FaxAccountId':_0x188ce1},'order':_0xf137('0x83')})['then'](function(_0x2397ac){_0x42f0e6=_0x2397ac;});}})[_0xf137('0x28')](function(_0x4b8371){_0x5273a8=0x1f4;logger[_0xf137('0x25')](_0x4b8371[_0xf137('0x3a')]);if(_0x4b8371[_0xf137('0x3b')]){delete _0x4b8371[_0xf137('0x3b')];}_0x42f0e6=_0x4b8371;})['finally'](function(){if(_0x42f0e6===null){_0x39b26e['sendStatus'](_0x5273a8);}else{if(_0x5273a8===0x1f4){_0x39b26e['status'](_0x5273a8)[_0xf137('0x84')](_0x42f0e6);}else{_0x39b26e[_0xf137('0x2a')](_0x5273a8)[_0xf137('0x31')](_0x42f0e6);}}});};exports[_0xf137('0x85')]=function(_0x5aa43a,_0x2d3b67,_0x50e513){var _0x287014={};var _0x199912={};var _0x1c1b55;var _0x1daa5b;return db[_0xf137('0x3e')][_0xf137('0x67')]({'where':{'id':_0x5aa43a[_0xf137('0x61')]['id']}})[_0xf137('0x1f')](handleEntityNotFound(_0x2d3b67,null))[_0xf137('0x1f')](function(_0x6502cb){if(_0x6502cb){_0x1c1b55=_0x6502cb;_0x199912['model']=_[_0xf137('0x45')](db[_0xf137('0x81')][_0xf137('0x58')]);_0x199912[_0xf137('0x44')]=_['keys'](_0x5aa43a[_0xf137('0x44')]);_0x199912['filters']=_[_0xf137('0x59')](_0x199912[_0xf137('0x42')],_0x199912[_0xf137('0x44')]);_0x287014[_0xf137('0x47')]=_[_0xf137('0x59')](_0x199912[_0xf137('0x42')],qs[_0xf137('0x48')](_0x5aa43a[_0xf137('0x44')][_0xf137('0x48')]));_0x287014[_0xf137('0x47')]=_0x287014[_0xf137('0x47')]['length']?_0x287014['attributes']:_0x199912['model'];_0x287014['order']=qs[_0xf137('0x4d')](_0x5aa43a[_0xf137('0x44')][_0xf137('0x4d')]);_0x287014[_0xf137('0x4f')]=qs['filters'](_[_0xf137('0x4e')](_0x5aa43a['query'],_0x199912[_0xf137('0x46')]));if(_0x5aa43a[_0xf137('0x44')][_0xf137('0x51')]){_0x287014['where']=_[_0xf137('0x50')](_0x287014['where'],{'$or':_['map'](_0x287014['attributes'],function(_0xd55cd){var _0x2eb501={};_0x2eb501[_0xd55cd]={'$like':'%'+_0x5aa43a[_0xf137('0x44')][_0xf137('0x51')]+'%'};return _0x2eb501;})});}_0x287014=_['merge']({},_0x287014,_0x5aa43a[_0xf137('0x52')]);return _0x1c1b55['getApplications'](_0x287014);}})[_0xf137('0x1f')](function(_0x562e0a){if(_0x562e0a){_0x1daa5b=_0x562e0a[_0xf137('0x49')];if(!_0x5aa43a[_0xf137('0x44')][_0xf137('0x4a')](_0xf137('0x4b'))){_0x287014[_0xf137('0x2c')]=qs[_0xf137('0x2c')](_0x5aa43a[_0xf137('0x44')]['limit']);_0x287014['offset']=qs[_0xf137('0x2e')](_0x5aa43a['query'][_0xf137('0x2e')]);}return _0x1c1b55['getApplications'](_0x287014);}})[_0xf137('0x1f')](function(_0x25ad76){if(_0x25ad76){return _0x25ad76?{'count':_0x1daa5b,'rows':_0x25ad76}:null;}})[_0xf137('0x1f')](respondWithResult(_0x2d3b67,null))['catch'](handleError(_0x2d3b67,null));};function Extension(_0x4a48a5,_0x885a2e,_0xd8b87a,_0x292c44){this[_0xf137('0x86')]='from-voip-provider';this[_0xf137('0x87')]=_0x4a48a5[_0xf137('0x88')];this[_0xf137('0x89')]=_0x292c44;this['type']=_0xf137('0x8a');this[_0xf137('0x8b')]='Fax\x20Extension';this[_0xf137('0x64')]=_0x4a48a5['id'];this[_0xf137('0x83')]=_0x885a2e;this[_0xf137('0x8c')]=_0xd8b87a;}function createExtensionsReciveFax(_0x1b68bd){var _0x564f8f=0x1;var _0x114b02=[];_0x114b02[_0xf137('0x8d')](new Extension(_0x1b68bd,_0x564f8f,'',_0xf137('0x8e')));_0x564f8f+=0x1;_0x114b02[_0xf137('0x8d')](new Extension(_0x1b68bd,_0x564f8f,_0xf137('0x8f'),_0xf137('0x90')));_0x564f8f+=0x1;for(var _0x457a21 in _0x1b68bd){if(_0x1b68bd[_0xf137('0x4a')](_0x457a21)&&(_0x457a21===_0xf137('0x91')||_0x457a21===_0xf137('0x88')||_0x457a21===_0xf137('0x92')||_0x457a21===_0xf137('0x93')||_0x457a21===_0xf137('0x94')||_0x457a21===_0xf137('0x95')||_0x457a21===_0xf137('0x96')||_0x457a21==='modem'||_0x457a21===_0xf137('0x97'))){_0x114b02['push'](new Extension(_0x1b68bd,_0x564f8f,_0xf137('0x98')+_0x457a21+')='+_0x1b68bd[_0x457a21],_0xf137('0x90')));_0x564f8f+=0x1;}}_0x114b02[_0xf137('0x8d')](new Extension(_0x1b68bd,_0x564f8f,'6','Wait'));_0x564f8f+=0x1;_0x114b02[_0xf137('0x8d')](new Extension(_0x1b68bd,_0x564f8f,'/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',_0xf137('0x99')));_0x564f8f=0x0;return _0x114b02;}exports[_0xf137('0x9a')]=function(_0x1aa648,_0x2b78e2,_0x254657){var _0x541052;return db[_0xf137('0x7c')]['transaction'](function(_0x3ede59){return db[_0xf137('0x3e')][_0xf137('0x5b')](_0x1aa648[_0xf137('0x60')],{'transaction':_0x3ede59})[_0xf137('0x1f')](function(_0x37fb7d){_0x541052=_0x37fb7d[_0xf137('0x36')]({'plain':!![]});return db['VoiceExtension'][_0xf137('0x9b')](createExtensionsReciveFax(_0x541052),{'transaction':_0x3ede59});});})['then'](function(){return _0x541052;})[_0xf137('0x1f')](respondWithResult(_0x2b78e2,null))[_0xf137('0x28')](handleError(_0x2b78e2,null));};exports[_0xf137('0x9c')]=function(_0x24e36d,_0x5d03fa,_0x1c2d68){var _0x2cccf7;return db['sequelize'][_0xf137('0x7d')](function(_0x46db29){return db[_0xf137('0x3e')][_0xf137('0x5f')](_0x24e36d[_0xf137('0x60')],{'where':{'id':_0x24e36d[_0xf137('0x60')]['id']},'transaction':_0x46db29})[_0xf137('0x1f')](function(_0x618a0d){return db[_0xf137('0x9d')]['destroy']({'where':{'FaxAccountId':_0x24e36d[_0xf137('0x60')]['id']},'transaction':_0x46db29})['then'](function(_0x49b780){return db[_0xf137('0x9d')][_0xf137('0x9b')](createExtensionsReciveFax(_[_0xf137('0x6e')](_0x24e36d[_0xf137('0x60')],[_0xf137('0x9e'),_0xf137('0x41'),_0xf137('0x9f'),_0xf137('0xa0'),_0xf137('0xa1'),_0xf137('0xa2')])),{'transaction':_0x46db29});});});})[_0xf137('0x1f')](function(){return db[_0xf137('0x3e')][_0xf137('0xa3')](_0x24e36d[_0xf137('0x60')]['id']);})[_0xf137('0x1f')](respondWithResult(_0x5d03fa,null))[_0xf137('0x28')](handleError(_0x5d03fa,null));};exports['getMessages']=function(_0x40ab1b,_0x52915c,_0x591695){var _0x27ee2b={'raw':!![],'where':{}};var _0x2a9485={};var _0x60257b={'count':0x0,'rows':[]};return db[_0xf137('0x3e')][_0xf137('0x67')]({'where':{'id':_0x40ab1b[_0xf137('0x61')]['id']}})[_0xf137('0x1f')](handleEntityNotFound(_0x52915c,null))['then'](function(_0x308974){if(_0x308974){_0x2a9485[_0xf137('0x42')]=_[_0xf137('0x45')](db[_0xf137('0xa4')][_0xf137('0x58')]);_0x2a9485[_0xf137('0x44')]=_[_0xf137('0x45')](_0x40ab1b[_0xf137('0x44')]);_0x2a9485[_0xf137('0x46')]=_[_0xf137('0x59')](_0x2a9485[_0xf137('0x42')],_0x2a9485[_0xf137('0x44')]);_0x27ee2b[_0xf137('0x47')]=_['intersection'](_0x2a9485[_0xf137('0x42')],qs[_0xf137('0x48')](_0x40ab1b[_0xf137('0x44')]['fields']));_0x27ee2b[_0xf137('0x47')]=_0x27ee2b[_0xf137('0x47')][_0xf137('0x49')]?_0x27ee2b[_0xf137('0x47')]:_0x2a9485[_0xf137('0x42')];if(!_0x40ab1b[_0xf137('0x44')][_0xf137('0x4a')](_0xf137('0x4b'))){_0x27ee2b['limit']=qs[_0xf137('0x2c')](_0x40ab1b['query'][_0xf137('0x2c')]);_0x27ee2b[_0xf137('0x2e')]=qs[_0xf137('0x2e')](_0x40ab1b[_0xf137('0x44')][_0xf137('0x2e')]);}_0x27ee2b[_0xf137('0x4c')]=qs[_0xf137('0x4d')](_0x40ab1b[_0xf137('0x44')][_0xf137('0x4d')]);_0x27ee2b['where']=qs[_0xf137('0x46')](_['pick'](_0x40ab1b[_0xf137('0x44')],_0x2a9485[_0xf137('0x46')]));_0x27ee2b['where'][_0xf137('0x64')]=_0x308974['id'];if(_0x40ab1b[_0xf137('0x44')][_0xf137('0x51')]){_0x27ee2b['where']=_['merge'](_0x27ee2b[_0xf137('0x4f')],{'$or':_['map'](_0x27ee2b['attributes'],function(_0x82faa){var _0x153ce8={};_0x153ce8[_0x82faa]={'$like':'%'+_0x40ab1b[_0xf137('0x44')]['filter']+'%'};return _0x153ce8;})});}if(_0x40ab1b[_0xf137('0x44')][_0xf137('0xa5')]){var _0x2fb411=_0x40ab1b[_0xf137('0x44')][_0xf137('0xa5')]['split'](',');var _0x3369c3={};_0x3369c3[_0x2fb411[0x0]]={'$gte':moment(_0x2fb411[0x1])[_0xf137('0xa6')](_0xf137('0xa7'))};_0x27ee2b['where']=_[_0xf137('0x50')](_0x27ee2b['where'],_0x3369c3);}_0x27ee2b=_[_0xf137('0x50')]({},_0x27ee2b,_0x40ab1b[_0xf137('0x52')]);return db[_0xf137('0xa4')][_0xf137('0x2d')]({'where':_0x27ee2b[_0xf137('0x4f')]})[_0xf137('0x1f')](function(_0x1c6516){_0x60257b[_0xf137('0x2d')]=_0x1c6516;if(_0x40ab1b[_0xf137('0x44')]['includeAll']){_0x27ee2b['include']=[{'all':!![]}];}return db[_0xf137('0xa4')][_0xf137('0x55')](_0x27ee2b);})['then'](function(_0x1ff345){_0x60257b[_0xf137('0x56')]=_0x1ff345;return _0x60257b;});}})[_0xf137('0x1f')](respondWithFilteredResult(_0x52915c,_0x27ee2b))[_0xf137('0x28')](handleError(_0x52915c,null));};exports[_0xf137('0x84')]=function(_0x2addb7,_0x349392,_0x5208ca){var _0x86bac,_0xa8116f={},_0x540023;if(_0x2addb7[_0xf137('0x60')]['to']){_0x540023=_0x2addb7[_0xf137('0x60')]['to'][0x0];}return db['FaxAccount'][_0xf137('0x5a')]({'where':{'id':_0x2addb7['params']['id']},'include':[{'model':db[_0xf137('0xa8')],'as':'List','include':[{'model':db[_0xf137('0x71')],'as':_0xf137('0xa9'),'where':{'fax':_0x540023},'limit':0x1,'order':[[_0xf137('0xa0'),_0xf137('0xaa')]]}]}]})['then'](handleEntityNotFound(_0x349392,null))['then'](function(_0x343888){_0x86bac=_0x343888;if(_0x2addb7[_0xf137('0x60')][_0xf137('0xab')]&&_0x2addb7[_0xf137('0x60')]['attachments'][_0xf137('0x49')]){for(var _0x53dd08=0x0;_0x53dd08<_0x2addb7[_0xf137('0x60')][_0xf137('0xab')][_0xf137('0x49')];_0x53dd08+=0x1){_0x2addb7[_0xf137('0x60')]['attachments'][_0x53dd08]={'filename':_0x2addb7[_0xf137('0x60')][_0xf137('0xab')][_0x53dd08][_0xf137('0x3b')],'id':_0x2addb7['body'][_0xf137('0xab')][_0x53dd08]['id'],'path':path[_0xf137('0xac')](config[_0xf137('0xad')],'server/files/attachments',_0x2addb7[_0xf137('0x60')][_0xf137('0xab')][_0x53dd08][_0xf137('0xae')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_[_0xf137('0xaf')](_0x2addb7[_0xf137('0x61')]['id'])?undefined:_0x2addb7[_0xf137('0x61')]['id'],'path':_[_0xf137('0xaf')](_0x2addb7[_0xf137('0x60')]['attachments'][0x0][_0xf137('0x4')])?undefined:_0x2addb7[_0xf137('0x60')]['attachments'][0x0][_0xf137('0x4')],'fax':_[_0xf137('0xaf')](_0x2addb7[_0xf137('0x60')]['to'][0x0])?undefined:_0x2addb7[_0xf137('0x60')]['to'][0x0]},client9002);})['then'](function(){if(_0x86bac){if(_[_0xf137('0xaf')](_0x2addb7['body'][_0xf137('0xb0')])){_0x2addb7[_0xf137('0x60')]['from']=util[_0xf137('0xa6')](_0xf137('0xb1'),_0x86bac['name'],_0x86bac[_0xf137('0xb2')]);}if(_0x86bac[_0xf137('0xb3')]){if(_0x86bac[_0xf137('0xb3')]['Contacts'][_0xf137('0x49')]){return _0x86bac[_0xf137('0xb3')][_0xf137('0xa9')][0x0];}else{return db[_0xf137('0x71')][_0xf137('0x5b')](_[_0xf137('0x18')](_0x2addb7[_0xf137('0x60')],{'firstName':_0x2addb7[_0xf137('0x60')]['to'][0x0],'phone':_0x2addb7[_0xf137('0x60')]['to'][0x0],'fax':_0x2addb7[_0xf137('0x60')]['to'][0x0],'ListId':_0x86bac[_0xf137('0xa2')]}));}}else{throw new Error(_0xf137('0xb4'));}}else{throw new Error(_0xf137('0xb5'));}})[_0xf137('0x1f')](function(_0x2f5dca){if(_0x2f5dca){return db[_0xf137('0x70')][_0xf137('0x5a')]({'where':{'ContactId':_0x2f5dca['id'],'closed':![],'FaxAccountId':_0x86bac['id']}})[_0xf137('0x1f')](function(_0x49544d){if(_0x49544d){return[_0x49544d,![]];}return db[_0xf137('0x70')][_0xf137('0x5b')]({'UserId':_0x2addb7['user']['id'],'ContactId':_0x2f5dca['id'],'FaxAccountId':_0x86bac['id'],'fax':_0x2addb7['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xf137('0x50')](_0x2addb7[_0xf137('0x60')],{'read':![],'body':_0x2addb7[_0xf137('0x60')][_0xf137('0xab')][0x0][_0xf137('0xb6')],'FaxAccountId':_0x86bac['id'],'UserId':_0x2addb7[_0xf137('0x5c')]['id'],'ContactId':_0x2f5dca['id'],'AttachmentId':_0x2addb7['body'][_0xf137('0xab')][0x0]['id']})]},{'include':[{'model':db[_0xf137('0xa4')],'as':'Messages'}]})[_0xf137('0x1f')](function(_0x5a132d){return[_0x5a132d,!![]];});});}else{throw new Error(_0xf137('0xb7'));}})[_0xf137('0xb8')](function(_0x2cefd7,_0xfb13e9){if(_0xfb13e9){return _0x2cefd7;}return db[_0xf137('0xa4')]['create']({'direction':_0xf137('0xb9'),'read':![],'body':_0x2addb7[_0xf137('0x60')][_0xf137('0xab')][0x0]['filename'],'FaxAccountId':_0x86bac['id'],'FaxInteractionId':_0x2cefd7['id'],'UserId':_0x2addb7['user']['id'],'ContactId':_0x2cefd7['ContactId'],'AttachmentId':_0x2addb7[_0xf137('0x60')][_0xf137('0xab')][0x0]['id']})[_0xf137('0x1f')](function(_0x300a3a){_0x2cefd7[_0xf137('0xba')][_0xf137('0xbb')]=[];_0x2cefd7[_0xf137('0xba')]['Messages'][_0xf137('0x8d')](_0x300a3a[_0xf137('0xba')]);return _0x2cefd7;});})['then'](function(_0x5e82ef){respondWithRpcPromise(_0xf137('0xbc'),_0xf137('0xbc'),{'FaxAccountId':_[_0xf137('0xaf')](_0x2addb7['params']['id'])?undefined:_0x2addb7['params']['id'],'path':_['isNil'](_0x2addb7[_0xf137('0x60')]['attachments'][0x0][_0xf137('0x4')])?undefined:_0x2addb7['body'][_0xf137('0xab')][0x0][_0xf137('0x4')],'fax':_[_0xf137('0xaf')](_0x2addb7[_0xf137('0x60')]['to'][0x0])?undefined:_0x2addb7[_0xf137('0x60')]['to'][0x0],'AttachmentId':_0x2addb7[_0xf137('0x60')][_0xf137('0xab')][0x0]['id']},client9002)[_0xf137('0x1f')](function(_0x7ca804){logger[_0xf137('0x20')]('SendFaxRpc,\x20%s',_0x7ca804);})[_0xf137('0x28')](function(_0x5d3528){logger[_0xf137('0x20')](_0xf137('0xbd'),_0x5d3528);});return _0x5e82ef;})[_0xf137('0x1f')](respondWithResult(_0x349392,null))[_0xf137('0x28')](handleError(_0x349392,null));};exports[_0xf137('0xbe')]=function(_0x18f539,_0x23ade1,_0x4c65a2){return db[_0xf137('0x3e')]['find']({'where':{'id':_0x18f539[_0xf137('0x61')]['id']}})['then'](handleEntityNotFound(_0x23ade1,null))['then'](function(_0x24138d){if(_0x24138d){return _0x24138d[_0xf137('0xbe')](_0x18f539[_0xf137('0x60')][_0xf137('0x69')],_['omit'](_0x18f539[_0xf137('0x60')],[_0xf137('0x69'),'id'])||{})[_0xf137('0xb8')](function(_0xb55d8c){for(var _0x32adaa=0x0;_0x32adaa<_0x18f539[_0xf137('0x60')][_0xf137('0x69')]['length'];_0x32adaa+=0x1){socket[_0xf137('0xbf')](_0xf137('0xc0'),{'UserId':Number(_0x18f539[_0xf137('0x60')][_0xf137('0x69')][_0x32adaa]),'FaxAccountId':Number(_0x18f539[_0xf137('0x61')]['id'])});}return _0xb55d8c;});}})[_0xf137('0x1f')](respondWithResult(_0x23ade1,null))[_0xf137('0x28')](handleError(_0x23ade1,null));};exports[_0xf137('0xc1')]=function(_0x55b7d1,_0x892026,_0x4d7b5d){return db[_0xf137('0x3e')][_0xf137('0x5a')]({'where':{'id':_0x55b7d1[_0xf137('0x61')]['id']}})[_0xf137('0x1f')](handleEntityNotFound(_0x892026,null))[_0xf137('0x1f')](function(_0x3f1018){if(_0x3f1018){return _0x3f1018[_0xf137('0xc1')](_0x55b7d1['query'][_0xf137('0x69')])['then'](function(){if(_['isArray'](_0x55b7d1[_0xf137('0x44')][_0xf137('0x69')])){for(var _0x77514a=0x0;_0x77514a<_0x55b7d1['query']['ids'][_0xf137('0x49')];_0x77514a+=0x1){socket[_0xf137('0xbf')]('userFaxAccount:remove',{'UserId':Number(_0x55b7d1['query'][_0xf137('0x69')][_0x77514a]),'FaxAccountId':Number(_0x55b7d1[_0xf137('0x61')]['id'])});}}else{socket[_0xf137('0xbf')](_0xf137('0xc2'),{'UserId':Number(_0x55b7d1[_0xf137('0x44')][_0xf137('0x69')]),'FaxAccountId':Number(_0x55b7d1[_0xf137('0x61')]['id'])});}});}})[_0xf137('0x1f')](respondWithStatusCode(_0x892026,null))[_0xf137('0x28')](handleError(_0x892026,null));};exports['getAgents']=function(_0x164fd1,_0x393eb8,_0xcea343){var _0x1c16fd={};var _0x54f0a2={};var _0x1c1ebc;var _0x2343f0;return db[_0xf137('0x3e')][_0xf137('0x67')]({'where':{'id':_0x164fd1[_0xf137('0x61')]['id']}})[_0xf137('0x1f')](handleEntityNotFound(_0x393eb8,null))[_0xf137('0x1f')](function(_0x4b0f10){if(_0x4b0f10){_0x1c1ebc=_0x4b0f10;_0x54f0a2[_0xf137('0x42')]=_[_0xf137('0x45')](db[_0xf137('0x73')]['rawAttributes']);_0x54f0a2[_0xf137('0x44')]=_[_0xf137('0x45')](_0x164fd1[_0xf137('0x44')]);_0x54f0a2[_0xf137('0x46')]=_[_0xf137('0x59')](_0x54f0a2[_0xf137('0x42')],_0x54f0a2['query']);_0x1c16fd['attributes']=_[_0xf137('0x59')](_0x54f0a2['model'],qs[_0xf137('0x48')](_0x164fd1[_0xf137('0x44')]['fields']));_0x1c16fd[_0xf137('0x47')]=_0x1c16fd[_0xf137('0x47')][_0xf137('0x49')]?_0x1c16fd[_0xf137('0x47')]:_0x54f0a2[_0xf137('0x42')];_0x1c16fd[_0xf137('0x4c')]=qs[_0xf137('0x4d')](_0x164fd1[_0xf137('0x44')]['sort']);_0x1c16fd[_0xf137('0x4f')]=qs[_0xf137('0x46')](_[_0xf137('0x4e')](_0x164fd1['query'],_0x54f0a2['filters']));if(_0x164fd1[_0xf137('0x44')][_0xf137('0x51')]){_0x1c16fd['where']=_[_0xf137('0x50')](_0x1c16fd[_0xf137('0x4f')],{'$or':_[_0xf137('0x43')](_0x1c16fd[_0xf137('0x47')],function(_0x2507df){var _0x44e5a2={};_0x44e5a2[_0x2507df]={'$like':'%'+_0x164fd1[_0xf137('0x44')][_0xf137('0x51')]+'%'};return _0x44e5a2;})});}_0x1c16fd=_[_0xf137('0x50')]({},_0x1c16fd,_0x164fd1[_0xf137('0x52')]);return _0x1c1ebc[_0xf137('0xc3')](_0x1c16fd);}})[_0xf137('0x1f')](function(_0x406050){if(_0x406050){_0x2343f0=_0x406050[_0xf137('0x49')];if(!_0x164fd1[_0xf137('0x44')][_0xf137('0x4a')]('nolimit')){_0x1c16fd[_0xf137('0x2c')]=qs[_0xf137('0x2c')](_0x164fd1[_0xf137('0x44')][_0xf137('0x2c')]);_0x1c16fd[_0xf137('0x2e')]=qs[_0xf137('0x2e')](_0x164fd1[_0xf137('0x44')][_0xf137('0x2e')]);}return _0x1c1ebc[_0xf137('0xc3')](_0x1c16fd);}})[_0xf137('0x1f')](function(_0x374368){if(_0x374368){return _0x374368?{'count':_0x2343f0,'rows':_0x374368}:null;}})[_0xf137('0x1f')](respondWithResult(_0x393eb8,null))['catch'](handleError(_0x393eb8,null));}; \ No newline at end of file +var _0x0483=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','save','update','destroy','get','FaxAccounts','UserProfileResource','name','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','show','Pause','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','FaxAccountId','Disposition','getDispositions','findOne','pick','options','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addInteraction','omit','FaxInteraction','CmContact','Owner','fullname','internal','Tags','addApplications','sequelize','Transaction','FaxApplication','bulkCreate','findAndCountAll','priority','stack','send','getApplications','context','from-voip-provider','localstationid','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','transaction','tech','createdAt','updatedAt','ListId','getMessages','FaxMessage','$gte','format','CmList','List','Contacts','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','out','Messages','spread','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','User','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x56e0e5,_0x2e3937){var _0x27bb15=function(_0x186336){while(--_0x186336){_0x56e0e5['push'](_0x56e0e5['shift']());}};_0x27bb15(++_0x2e3937);}(_0x0483,0x16b));var _0x3048=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x0483[_0x263a74];return _0x2aa86c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3048('0x0'));var zipdir=require(_0x3048('0x1'));var jsonpatch=require(_0x3048('0x2'));var rp=require('request-promise');var moment=require(_0x3048('0x3'));var BPromise=require(_0x3048('0x4'));var Mustache=require('mustache');var util=require(_0x3048('0x5'));var path=require(_0x3048('0x6'));var sox=require('sox');var csv=require(_0x3048('0x7'));var ejs=require(_0x3048('0x8'));var fs=require('fs');var fs_extra=require(_0x3048('0x9'));var _=require(_0x3048('0xa'));var squel=require(_0x3048('0xb'));var crypto=require(_0x3048('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3048('0xd'));var toCsv=require(_0x3048('0x7'));var querystring=require(_0x3048('0xe'));var Papa=require(_0x3048('0xf'));var Redis=require(_0x3048('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3048('0x11'));var as=require(_0x3048('0x12'));var hardwareService=require(_0x3048('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x3048('0x14'));var licenseUtil=require(_0x3048('0x15'));var db=require(_0x3048('0x16'))['db'];config[_0x3048('0x17')]=_[_0x3048('0x18')](config['redis'],{'host':_0x3048('0x19'),'port':0x18eb});var socket=require(_0x3048('0x1a'))(new Redis(config[_0x3048('0x17')]));require(_0x3048('0x1b'))['register'](socket);var jayson=require(_0x3048('0x1c'));var client=jayson[_0x3048('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x3048('0x1d')][_0x3048('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5d8e33,_0x5b28c3,_0x264535,_0xf09ee1){return new BPromise(function(_0x25b73f,_0x41ff5f){var _0x3109a9=_0xf09ee1||client;return _0x3109a9[_0x3048('0x1f')](_0x5d8e33,_0x264535)[_0x3048('0x20')](function(_0xf356c6){logger[_0x3048('0x21')](_0x3048('0x22'),_0x5b28c3,_0x3048('0x23'));logger[_0x3048('0x24')](_0x3048('0x25'),_0x5b28c3,'request\x20sent',JSON[_0x3048('0x26')](_0xf356c6));if(_0xf356c6[_0x3048('0x27')]){if(_0xf356c6[_0x3048('0x27')][_0x3048('0x28')]===0x1f4){logger['error'](_0x3048('0x22'),_0x5b28c3,_0xf356c6[_0x3048('0x27')][_0x3048('0x29')]);return _0x41ff5f(_0xf356c6[_0x3048('0x27')]['message']);}logger[_0x3048('0x27')](_0x3048('0x22'),_0x5b28c3,_0xf356c6[_0x3048('0x27')][_0x3048('0x29')]);return _0x25b73f(_0xf356c6[_0x3048('0x27')][_0x3048('0x29')]);}else{logger['info'](_0x3048('0x22'),_0x5b28c3,_0x3048('0x23'));_0x25b73f(_0xf356c6['result'][_0x3048('0x29')]);}})[_0x3048('0x2a')](function(_0x1d0d9a){logger[_0x3048('0x27')]('FaxAccount,\x20%s,\x20%s',_0x5b28c3,_0x1d0d9a);_0x41ff5f(_0x1d0d9a);});});}function respondWithStatusCode(_0x420672,_0x43b425){_0x43b425=_0x43b425||0xcc;return function(_0x42b58c){if(_0x42b58c){return _0x420672[_0x3048('0x2b')](_0x43b425);}return _0x420672[_0x3048('0x2c')](_0x43b425)[_0x3048('0x2d')]();};}function respondWithResult(_0x424dfd,_0x34baaf){_0x34baaf=_0x34baaf||0xc8;return function(_0x542ca6){if(_0x542ca6){return _0x424dfd['status'](_0x34baaf)[_0x3048('0x2e')](_0x542ca6);}};}function respondWithFilteredResult(_0x370785,_0x58f551){return function(_0x4a01dd){if(_0x4a01dd){var _0x347624=typeof _0x58f551['offset']===_0x3048('0x2f')&&typeof _0x58f551['limit']===_0x3048('0x2f');var _0x2c4b94=_0x4a01dd[_0x3048('0x30')];var _0x5d2c98=_0x347624?0x0:_0x58f551[_0x3048('0x31')];var _0x1da698=_0x347624?_0x4a01dd[_0x3048('0x30')]:_0x58f551['offset']+_0x58f551[_0x3048('0x32')];var _0x1925b6;if(_0x1da698>=_0x2c4b94){_0x1da698=_0x2c4b94;_0x1925b6=0xc8;}else{_0x1925b6=0xce;}_0x370785['status'](_0x1925b6);return _0x370785['set'](_0x3048('0x33'),_0x5d2c98+'-'+_0x1da698+'/'+_0x2c4b94)[_0x3048('0x2e')](_0x4a01dd);}return null;};}function patchUpdates(_0x163484){return function(_0x2b8aec){try{jsonpatch[_0x3048('0x34')](_0x2b8aec,_0x163484,!![]);}catch(_0x309059){return BPromise['reject'](_0x309059);}return _0x2b8aec[_0x3048('0x35')]();};}function saveUpdates(_0xc6cccf,_0x2f8936){return function(_0x51482f){if(_0x51482f){return _0x51482f[_0x3048('0x36')](_0xc6cccf)[_0x3048('0x20')](function(_0xd75497){return _0xd75497;});}return null;};}function removeEntity(_0x554854,_0x3a0721){return function(_0x56b1ea){if(_0x56b1ea){return _0x56b1ea[_0x3048('0x37')]()[_0x3048('0x20')](function(){var _0x498d00=_0x56b1ea[_0x3048('0x38')]({'plain':!![]});var _0x15d97d=_0x3048('0x39');return db[_0x3048('0x3a')][_0x3048('0x37')]({'where':{'type':_0x15d97d,'resourceId':_0x498d00['id']}})['then'](function(){return _0x56b1ea;});})['then'](function(){_0x554854['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x10ca60,_0x596554){return function(_0x114648){if(!_0x114648){_0x10ca60[_0x3048('0x2b')](0x194);}return _0x114648;};}function handleError(_0xa37ddc,_0x370e37){_0x370e37=_0x370e37||0x1f4;return function(_0x341cb9){logger['error'](_0x341cb9['stack']);if(_0x341cb9[_0x3048('0x3b')]){delete _0x341cb9[_0x3048('0x3b')];}_0xa37ddc['status'](_0x370e37)['send'](_0x341cb9);};}exports[_0x3048('0x3c')]=function(_0x556172,_0x3e6ff3){var _0x3c6e67={'include':[{'model':db['Pause'],'as':_0x3048('0x3d')}]},_0x138e8f={},_0x588279={'count':0x0,'rows':[]};var _0x41494b=_[_0x3048('0x3e')](db[_0x3048('0x3f')][_0x3048('0x40')],function(_0x45b730){return{'name':_0x45b730['fieldName'],'type':_0x45b730['type'][_0x3048('0x41')]};});_0x138e8f[_0x3048('0x42')]=_['map'](_0x41494b,_0x3048('0x3b'));_0x138e8f['query']=_[_0x3048('0x43')](_0x556172[_0x3048('0x44')]);_0x138e8f[_0x3048('0x45')]=_[_0x3048('0x46')](_0x138e8f['model'],_0x138e8f['query']);_0x3c6e67['attributes']=_[_0x3048('0x46')](_0x138e8f['model'],qs[_0x3048('0x47')](_0x556172[_0x3048('0x44')][_0x3048('0x47')]));_0x3c6e67[_0x3048('0x48')]=_0x3c6e67['attributes'][_0x3048('0x49')]?_0x3c6e67[_0x3048('0x48')]:_0x138e8f[_0x3048('0x42')];if(!_0x556172['query'][_0x3048('0x4a')](_0x3048('0x4b'))){_0x3c6e67[_0x3048('0x32')]=qs[_0x3048('0x32')](_0x556172[_0x3048('0x44')][_0x3048('0x32')]);_0x3c6e67['offset']=qs[_0x3048('0x31')](_0x556172[_0x3048('0x44')][_0x3048('0x31')]);}_0x3c6e67[_0x3048('0x4c')]=qs[_0x3048('0x4d')](_0x556172[_0x3048('0x44')][_0x3048('0x4d')]);_0x3c6e67[_0x3048('0x4e')]=qs[_0x3048('0x45')](_['pick'](_0x556172['query'],_0x138e8f[_0x3048('0x45')]),_0x41494b);if(_0x556172['query'][_0x3048('0x4f')]){_0x3c6e67[_0x3048('0x4e')]=_[_0x3048('0x50')](_0x3c6e67[_0x3048('0x4e')],{'$or':_['map'](_0x41494b,function(_0x1efa97){if(_0x1efa97[_0x3048('0x51')]!==_0x3048('0x52')){var _0x1b62b5={};_0x1b62b5[_0x1efa97[_0x3048('0x3b')]]={'$like':'%'+_0x556172[_0x3048('0x44')][_0x3048('0x4f')]+'%'};return _0x1b62b5;}})});}_0x3c6e67=_[_0x3048('0x50')]({},_0x3c6e67,_0x556172['options']);var _0x341b54={'where':_0x3c6e67[_0x3048('0x4e')]};return db['FaxAccount'][_0x3048('0x30')](_0x341b54)[_0x3048('0x20')](function(_0xe7541a){_0x588279['count']=_0xe7541a;if(_0x556172['query'][_0x3048('0x53')]){_0x3c6e67[_0x3048('0x54')]=[{'all':!![]}];}return db[_0x3048('0x3f')][_0x3048('0x55')](_0x3c6e67);})['then'](function(_0x4e2e01){_0x588279['rows']=_0x4e2e01;return _0x588279;})[_0x3048('0x20')](respondWithFilteredResult(_0x3e6ff3,_0x3c6e67))[_0x3048('0x2a')](handleError(_0x3e6ff3,null));};exports[_0x3048('0x56')]=function(_0xf73101,_0x416f99){var _0x88a450={'raw':![],'where':{'id':_0xf73101['params']['id']},'include':[{'model':db[_0x3048('0x57')],'as':_0x3048('0x3d')}]},_0xa5e263={};_0xa5e263[_0x3048('0x42')]=_[_0x3048('0x43')](db[_0x3048('0x3f')][_0x3048('0x40')]);_0xa5e263[_0x3048('0x44')]=_['keys'](_0xf73101[_0x3048('0x44')]);_0xa5e263[_0x3048('0x45')]=_[_0x3048('0x46')](_0xa5e263[_0x3048('0x42')],_0xa5e263[_0x3048('0x44')]);_0x88a450[_0x3048('0x48')]=_[_0x3048('0x46')](_0xa5e263['model'],qs[_0x3048('0x47')](_0xf73101[_0x3048('0x44')][_0x3048('0x47')]));_0x88a450[_0x3048('0x48')]=_0x88a450[_0x3048('0x48')][_0x3048('0x49')]?_0x88a450['attributes']:_0xa5e263[_0x3048('0x42')];if(_0xf73101[_0x3048('0x44')]['includeAll']){_0x88a450[_0x3048('0x54')]=[{'all':!![]}];}_0x88a450=_['merge']({},_0x88a450,_0xf73101['options']);return db['FaxAccount'][_0x3048('0x58')](_0x88a450)['then'](handleEntityNotFound(_0x416f99,null))[_0x3048('0x20')](respondWithResult(_0x416f99,null))[_0x3048('0x2a')](handleError(_0x416f99,null));};exports['create']=function(_0x4cd9f9,_0x2c480b){return db['FaxAccount'][_0x3048('0x59')](_0x4cd9f9[_0x3048('0x5a')],{})[_0x3048('0x20')](function(_0x2b783f){var _0x3ac9ec=_0x4cd9f9[_0x3048('0x5b')][_0x3048('0x38')]({'plain':!![]});if(!_0x3ac9ec)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ac9ec['role']==='user'){var _0x53c255=_0x2b783f[_0x3048('0x38')]({'plain':!![]});var _0x10950f=_0x3048('0x39');return db[_0x3048('0x5c')][_0x3048('0x58')]({'where':{'name':_0x10950f,'userProfileId':_0x3ac9ec[_0x3048('0x5d')]},'raw':!![]})['then'](function(_0x53e371){if(_0x53e371&&_0x53e371[_0x3048('0x5e')]===0x0){return db[_0x3048('0x3a')][_0x3048('0x59')]({'name':_0x53c255[_0x3048('0x3b')],'resourceId':_0x53c255['id'],'type':_0x53e371[_0x3048('0x3b')],'sectionId':_0x53e371['id']},{})[_0x3048('0x20')](function(){return _0x2b783f;});}else{return _0x2b783f;}})['catch'](function(_0x159732){logger[_0x3048('0x27')](_0x3048('0x5f'),_0x159732);throw _0x159732;});}return _0x2b783f;})['then'](respondWithResult(_0x2c480b,0xc9))['catch'](handleError(_0x2c480b,null));};exports[_0x3048('0x36')]=function(_0x3e958c,_0x3cf436){if(_0x3e958c[_0x3048('0x5a')]['id']){delete _0x3e958c[_0x3048('0x5a')]['id'];}return db[_0x3048('0x3f')][_0x3048('0x58')]({'where':{'id':_0x3e958c['params']['id']},'include':[{'model':db[_0x3048('0x57')],'as':_0x3048('0x3d')}]})[_0x3048('0x20')](handleEntityNotFound(_0x3cf436,null))['then'](saveUpdates(_0x3e958c['body'],null))[_0x3048('0x20')](respondWithResult(_0x3cf436,null))[_0x3048('0x2a')](handleError(_0x3cf436,null));};exports[_0x3048('0x37')]=function(_0x69a479,_0x42ac51){return db[_0x3048('0x3f')][_0x3048('0x58')]({'where':{'id':_0x69a479[_0x3048('0x60')]['id']}})['then'](handleEntityNotFound(_0x42ac51,null))['then'](removeEntity(_0x42ac51,null))[_0x3048('0x2a')](handleError(_0x42ac51,null));};exports[_0x3048('0x61')]=function(_0x19e972,_0xb59282){return db[_0x3048('0x3f')][_0x3048('0x61')]()['then'](respondWithResult(_0xb59282,null))[_0x3048('0x2a')](handleError(_0xb59282,null));};exports['addDisposition']=function(_0x34df12,_0x1be514,_0x190a4a){if(_0x34df12[_0x3048('0x5a')]['id']){delete _0x34df12[_0x3048('0x5a')]['id'];}return db['FaxAccount'][_0x3048('0x58')]({'where':{'id':_0x34df12[_0x3048('0x60')]['id']}})[_0x3048('0x20')](handleEntityNotFound(_0x1be514,null))[_0x3048('0x20')](function(_0x3524fa){if(_0x3524fa){_0x34df12[_0x3048('0x5a')][_0x3048('0x62')]=_0x3524fa['id'];return db[_0x3048('0x63')][_0x3048('0x59')](_0x34df12[_0x3048('0x5a')]);}})['then'](respondWithResult(_0x1be514,null))[_0x3048('0x2a')](handleError(_0x1be514,null));};exports[_0x3048('0x64')]=function(_0xb0503c,_0x2c1b7b,_0x247486){var _0x36a0df={'raw':![],'where':{}};var _0x319b37={};var _0x4e3fc7={'count':0x0,'rows':[]};return db[_0x3048('0x3f')][_0x3048('0x65')]({'where':{'id':_0xb0503c[_0x3048('0x60')]['id']}})[_0x3048('0x20')](handleEntityNotFound(_0x2c1b7b,null))['then'](function(_0x260749){if(_0x260749){_0x319b37['model']=_[_0x3048('0x43')](db[_0x3048('0x63')][_0x3048('0x40')]);_0x319b37['query']=_[_0x3048('0x43')](_0xb0503c[_0x3048('0x44')]);_0x319b37[_0x3048('0x45')]=_[_0x3048('0x46')](_0x319b37[_0x3048('0x42')],_0x319b37['query']);_0x36a0df[_0x3048('0x48')]=_[_0x3048('0x46')](_0x319b37[_0x3048('0x42')],qs[_0x3048('0x47')](_0xb0503c[_0x3048('0x44')]['fields']));_0x36a0df[_0x3048('0x48')]=_0x36a0df[_0x3048('0x48')]['length']?_0x36a0df['attributes']:_0x319b37[_0x3048('0x42')];if(!_0xb0503c[_0x3048('0x44')]['hasOwnProperty'](_0x3048('0x4b'))){_0x36a0df['limit']=qs['limit'](_0xb0503c[_0x3048('0x44')][_0x3048('0x32')]);_0x36a0df[_0x3048('0x31')]=qs[_0x3048('0x31')](_0xb0503c[_0x3048('0x44')]['offset']);}_0x36a0df[_0x3048('0x4c')]=qs[_0x3048('0x4d')](_0xb0503c[_0x3048('0x44')]['sort']);_0x36a0df[_0x3048('0x4e')]=qs[_0x3048('0x45')](_[_0x3048('0x66')](_0xb0503c[_0x3048('0x44')],_0x319b37[_0x3048('0x45')]));_0x36a0df[_0x3048('0x4e')][_0x3048('0x62')]=_0x260749['id'];if(_0xb0503c['query'][_0x3048('0x4f')]){_0x36a0df[_0x3048('0x4e')]=_[_0x3048('0x50')](_0x36a0df[_0x3048('0x4e')],{'$or':_[_0x3048('0x3e')](_0x36a0df[_0x3048('0x48')],function(_0x3c7bcc){var _0xf5c8e3={};_0xf5c8e3[_0x3c7bcc]={'$like':'%'+_0xb0503c[_0x3048('0x44')][_0x3048('0x4f')]+'%'};return _0xf5c8e3;})});}_0x36a0df=_['merge']({},_0x36a0df,_0xb0503c[_0x3048('0x67')]);return db[_0x3048('0x63')][_0x3048('0x30')]({'where':_0x36a0df[_0x3048('0x4e')]})['then'](function(_0xd820a0){_0x4e3fc7[_0x3048('0x30')]=_0xd820a0;if(_0xb0503c[_0x3048('0x44')][_0x3048('0x53')]){_0x36a0df[_0x3048('0x54')]=[{'all':!![]}];}return db[_0x3048('0x63')]['findAll'](_0x36a0df);})['then'](function(_0x2e2692){_0x4e3fc7[_0x3048('0x68')]=_0x2e2692;return _0x4e3fc7;});}})[_0x3048('0x20')](respondWithFilteredResult(_0x2c1b7b,_0x36a0df))[_0x3048('0x2a')](handleError(_0x2c1b7b,null));};exports[_0x3048('0x69')]=function(_0x4cb463,_0x53d3e0,_0x214653){return db['FaxAccount'][_0x3048('0x58')]({'where':{'id':_0x4cb463['params']['id']}})[_0x3048('0x20')](handleEntityNotFound(_0x53d3e0,null))[_0x3048('0x20')](function(_0x5c81b5){if(_0x5c81b5){return _0x5c81b5[_0x3048('0x69')](_0x4cb463[_0x3048('0x44')]['ids']);}})[_0x3048('0x20')](respondWithStatusCode(_0x53d3e0,null))['catch'](handleError(_0x53d3e0,null));};exports[_0x3048('0x6a')]=function(_0x2492c2,_0x3d91da,_0x41d894){if(_0x2492c2[_0x3048('0x5a')]['id']){delete _0x2492c2[_0x3048('0x5a')]['id'];}return db[_0x3048('0x3f')][_0x3048('0x58')]({'where':{'id':_0x2492c2[_0x3048('0x60')]['id']}})[_0x3048('0x20')](handleEntityNotFound(_0x3d91da,null))[_0x3048('0x20')](function(_0x1a6c21){if(_0x1a6c21){_0x2492c2[_0x3048('0x5a')][_0x3048('0x62')]=_0x1a6c21['id'];return db[_0x3048('0x6b')]['create'](_0x2492c2[_0x3048('0x5a')]);}})[_0x3048('0x20')](respondWithResult(_0x3d91da,null))[_0x3048('0x2a')](handleError(_0x3d91da,null));};exports[_0x3048('0x6c')]=function(_0x56cf8c,_0x1e1995,_0x2ba8be){var _0x1396ae={'raw':![],'where':{}};var _0x3f57f9={};var _0x44266d={'count':0x0,'rows':[]};return db[_0x3048('0x3f')]['findOne']({'where':{'id':_0x56cf8c['params']['id']}})[_0x3048('0x20')](handleEntityNotFound(_0x1e1995,null))['then'](function(_0x116b51){if(_0x116b51){_0x3f57f9[_0x3048('0x42')]=_[_0x3048('0x43')](db[_0x3048('0x6b')]['rawAttributes']);_0x3f57f9[_0x3048('0x44')]=_[_0x3048('0x43')](_0x56cf8c['query']);_0x3f57f9[_0x3048('0x45')]=_[_0x3048('0x46')](_0x3f57f9['model'],_0x3f57f9['query']);_0x1396ae['attributes']=_[_0x3048('0x46')](_0x3f57f9['model'],qs['fields'](_0x56cf8c[_0x3048('0x44')]['fields']));_0x1396ae[_0x3048('0x48')]=_0x1396ae['attributes']['length']?_0x1396ae[_0x3048('0x48')]:_0x3f57f9[_0x3048('0x42')];if(!_0x56cf8c['query'][_0x3048('0x4a')]('nolimit')){_0x1396ae[_0x3048('0x32')]=qs['limit'](_0x56cf8c[_0x3048('0x44')]['limit']);_0x1396ae[_0x3048('0x31')]=qs['offset'](_0x56cf8c['query']['offset']);}_0x1396ae[_0x3048('0x4c')]=qs[_0x3048('0x4d')](_0x56cf8c[_0x3048('0x44')][_0x3048('0x4d')]);_0x1396ae[_0x3048('0x4e')]=qs[_0x3048('0x45')](_['pick'](_0x56cf8c[_0x3048('0x44')],_0x3f57f9[_0x3048('0x45')]));_0x1396ae[_0x3048('0x4e')]['FaxAccountId']=_0x116b51['id'];if(_0x56cf8c['query'][_0x3048('0x4f')]){_0x1396ae['where']=_[_0x3048('0x50')](_0x1396ae[_0x3048('0x4e')],{'$or':_[_0x3048('0x3e')](_0x1396ae[_0x3048('0x48')],function(_0x498063){var _0x3ec0c6={};_0x3ec0c6[_0x498063]={'$like':'%'+_0x56cf8c[_0x3048('0x44')]['filter']+'%'};return _0x3ec0c6;})});}_0x1396ae=_[_0x3048('0x50')]({},_0x1396ae,_0x56cf8c[_0x3048('0x67')]);return db[_0x3048('0x6b')][_0x3048('0x30')]({'where':_0x1396ae[_0x3048('0x4e')]})['then'](function(_0x33542b){_0x44266d[_0x3048('0x30')]=_0x33542b;if(_0x56cf8c['query']['includeAll']){_0x1396ae['include']=[{'all':!![]}];}return db[_0x3048('0x6b')][_0x3048('0x55')](_0x1396ae);})[_0x3048('0x20')](function(_0x440d94){_0x44266d[_0x3048('0x68')]=_0x440d94;return _0x44266d;});}})[_0x3048('0x20')](respondWithFilteredResult(_0x1e1995,_0x1396ae))[_0x3048('0x2a')](handleError(_0x1e1995,null));};exports[_0x3048('0x6d')]=function(_0x4af474,_0x193614,_0x23a811){return db['FaxAccount'][_0x3048('0x58')]({'where':{'id':_0x4af474[_0x3048('0x60')]['id']}})[_0x3048('0x20')](handleEntityNotFound(_0x193614,null))[_0x3048('0x20')](function(_0x2a5e4f){if(_0x2a5e4f){return _0x2a5e4f['removeAnswers'](_0x4af474[_0x3048('0x44')][_0x3048('0x6e')]);}})[_0x3048('0x20')](respondWithStatusCode(_0x193614,null))[_0x3048('0x2a')](handleError(_0x193614,null));};exports[_0x3048('0x6f')]=function(_0x1eee88,_0x460887,_0x4976a4){return db['FaxInteraction'][_0x3048('0x58')]({'where':{'id':_0x1eee88[_0x3048('0x60')]['id']}})[_0x3048('0x20')](handleEntityNotFound(_0x460887,null))[_0x3048('0x20')](function(_0x4d713c){if(_0x4d713c){return _0x4d713c[_0x3048('0x6f')](_0x1eee88[_0x3048('0x5a')][_0x3048('0x6e')],_[_0x3048('0x70')](_0x1eee88[_0x3048('0x5a')],['ids','id'])||{});}})[_0x3048('0x20')](respondWithResult(_0x460887,null))[_0x3048('0x2a')](handleError(_0x460887,null));};exports['getInteractions']=function(_0x4bc9f1,_0x21717d,_0x59e625){var _0x1ecdcd={'raw':![],'where':{}};var _0x3830cc={};var _0x4e4588={'count':0x0,'rows':[]};return db['FaxAccount'][_0x3048('0x65')]({'where':{'id':_0x4bc9f1[_0x3048('0x60')]['id']}})[_0x3048('0x20')](handleEntityNotFound(_0x21717d,null))[_0x3048('0x20')](function(_0x13897b){if(_0x13897b){_0x3830cc[_0x3048('0x42')]=_['keys'](db['FaxInteraction'][_0x3048('0x40')]);_0x3830cc[_0x3048('0x44')]=_[_0x3048('0x43')](_0x4bc9f1[_0x3048('0x44')]);_0x3830cc['filters']=_['intersection'](_0x3830cc[_0x3048('0x42')],_0x3830cc[_0x3048('0x44')]);_0x1ecdcd[_0x3048('0x48')]=_['intersection'](_0x3830cc[_0x3048('0x42')],qs[_0x3048('0x47')](_0x4bc9f1['query']['fields']));_0x1ecdcd[_0x3048('0x48')]=_0x1ecdcd[_0x3048('0x48')]['length']?_0x1ecdcd['attributes']:_0x3830cc['model'];if(!_0x4bc9f1[_0x3048('0x44')][_0x3048('0x4a')](_0x3048('0x4b'))){_0x1ecdcd[_0x3048('0x32')]=qs[_0x3048('0x32')](_0x4bc9f1[_0x3048('0x44')][_0x3048('0x32')]);_0x1ecdcd[_0x3048('0x31')]=qs['offset'](_0x4bc9f1[_0x3048('0x44')][_0x3048('0x31')]);}_0x1ecdcd[_0x3048('0x4c')]=qs[_0x3048('0x4d')](_0x4bc9f1['query'][_0x3048('0x4d')]);_0x1ecdcd[_0x3048('0x4e')]=qs[_0x3048('0x45')](_[_0x3048('0x66')](_0x4bc9f1[_0x3048('0x44')],_0x3830cc[_0x3048('0x45')]));_0x1ecdcd[_0x3048('0x4e')][_0x3048('0x62')]=_0x13897b['id'];if(_0x4bc9f1[_0x3048('0x44')][_0x3048('0x4f')]){_0x1ecdcd[_0x3048('0x4e')]=_[_0x3048('0x50')](_0x1ecdcd['where'],{'$or':_[_0x3048('0x3e')](_0x1ecdcd[_0x3048('0x48')],function(_0x38c028){var _0x5ce6a1={};_0x5ce6a1[_0x38c028]={'$like':'%'+_0x4bc9f1['query'][_0x3048('0x4f')]+'%'};return _0x5ce6a1;})});}_0x1ecdcd=_[_0x3048('0x50')]({},_0x1ecdcd,_0x4bc9f1[_0x3048('0x67')]);return db[_0x3048('0x71')][_0x3048('0x30')]({'where':_0x1ecdcd[_0x3048('0x4e')]})[_0x3048('0x20')](function(_0x308a5a){_0x4e4588[_0x3048('0x30')]=_0x308a5a;if(_0x4bc9f1[_0x3048('0x44')][_0x3048('0x53')]){_0x1ecdcd[_0x3048('0x54')]=[{'model':db[_0x3048('0x72')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x3048('0x73'),'attributes':[_0x3048('0x3b'),_0x3048('0x74'),_0x3048('0x75')],'required':![]},{'model':db['Tag'],'as':_0x3048('0x76'),'attributes':['id',_0x3048('0x3b'),'color'],'where':_0x4bc9f1['query']['tag']?{'id':_0x4bc9f1[_0x3048('0x44')]['tag']}:undefined,'required':_0x4bc9f1[_0x3048('0x44')]['tag']?!![]:![]}];}return db[_0x3048('0x71')][_0x3048('0x55')](_0x1ecdcd);})['then'](function(_0x5cb8a0){_0x4e4588[_0x3048('0x68')]=_0x5cb8a0;return _0x4e4588;});}})[_0x3048('0x20')](respondWithFilteredResult(_0x21717d,_0x1ecdcd))['catch'](handleError(_0x21717d,null));};exports[_0x3048('0x77')]=function(_0x37bcf1,_0x2cf364){var _0x45abb8=_0x37bcf1[_0x3048('0x60')]['id'];var _0x4ea8a1=_0x37bcf1[_0x3048('0x5a')];var _0x253ee5=0xc8;var _0x3a770b=null;return db[_0x3048('0x78')]['transaction']({'isolationLevel':db[_0x3048('0x78')][_0x3048('0x79')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x5794c9){return db[_0x3048('0x3f')][_0x3048('0x65')]({'where':{'id':_0x45abb8},'transaction':_0x5794c9})[_0x3048('0x20')](function(_0x4f0ca0){if(_0x4f0ca0){return db[_0x3048('0x7a')][_0x3048('0x37')]({'where':{'FaxAccountId':_0x45abb8},'transaction':_0x5794c9})[_0x3048('0x20')](function(){var _0x2d8fbf=_['map'](_0x4ea8a1,function(_0x428a9c){_0x428a9c[_0x3048('0x62')]=_0x45abb8;return _0x428a9c;});return db[_0x3048('0x7a')][_0x3048('0x7b')](_0x2d8fbf,{'transaction':_0x5794c9});});}else{_0x253ee5=0x194;_0x3a770b=[];}});})['then'](function(){if(_0x253ee5!==0x194){return db['FaxApplication'][_0x3048('0x7c')]({'where':{'FaxAccountId':_0x45abb8},'order':_0x3048('0x7d')})[_0x3048('0x20')](function(_0x773a16){_0x3a770b=_0x773a16;});}})['catch'](function(_0x5baf63){_0x253ee5=0x1f4;logger['error'](_0x5baf63[_0x3048('0x7e')]);if(_0x5baf63['name']){delete _0x5baf63[_0x3048('0x3b')];}_0x3a770b=_0x5baf63;})['finally'](function(){if(_0x3a770b===null){_0x2cf364[_0x3048('0x2b')](_0x253ee5);}else{if(_0x253ee5===0x1f4){_0x2cf364[_0x3048('0x2c')](_0x253ee5)[_0x3048('0x7f')](_0x3a770b);}else{_0x2cf364[_0x3048('0x2c')](_0x253ee5)[_0x3048('0x2e')](_0x3a770b);}}});};exports[_0x3048('0x80')]=function(_0x40633d,_0x30db53,_0x122f9a){var _0x173fe0={};var _0x2dd4d4={};var _0x877878;var _0x83bb81;return db[_0x3048('0x3f')][_0x3048('0x65')]({'where':{'id':_0x40633d[_0x3048('0x60')]['id']}})[_0x3048('0x20')](handleEntityNotFound(_0x30db53,null))[_0x3048('0x20')](function(_0x551a43){if(_0x551a43){_0x877878=_0x551a43;_0x2dd4d4[_0x3048('0x42')]=_[_0x3048('0x43')](db[_0x3048('0x7a')][_0x3048('0x40')]);_0x2dd4d4[_0x3048('0x44')]=_['keys'](_0x40633d['query']);_0x2dd4d4[_0x3048('0x45')]=_[_0x3048('0x46')](_0x2dd4d4[_0x3048('0x42')],_0x2dd4d4['query']);_0x173fe0[_0x3048('0x48')]=_[_0x3048('0x46')](_0x2dd4d4[_0x3048('0x42')],qs[_0x3048('0x47')](_0x40633d[_0x3048('0x44')][_0x3048('0x47')]));_0x173fe0[_0x3048('0x48')]=_0x173fe0[_0x3048('0x48')][_0x3048('0x49')]?_0x173fe0[_0x3048('0x48')]:_0x2dd4d4[_0x3048('0x42')];_0x173fe0[_0x3048('0x4c')]=qs['sort'](_0x40633d[_0x3048('0x44')][_0x3048('0x4d')]);_0x173fe0[_0x3048('0x4e')]=qs[_0x3048('0x45')](_[_0x3048('0x66')](_0x40633d[_0x3048('0x44')],_0x2dd4d4[_0x3048('0x45')]));if(_0x40633d['query'][_0x3048('0x4f')]){_0x173fe0['where']=_['merge'](_0x173fe0[_0x3048('0x4e')],{'$or':_[_0x3048('0x3e')](_0x173fe0[_0x3048('0x48')],function(_0xe5bbae){var _0x46b44a={};_0x46b44a[_0xe5bbae]={'$like':'%'+_0x40633d[_0x3048('0x44')][_0x3048('0x4f')]+'%'};return _0x46b44a;})});}_0x173fe0=_[_0x3048('0x50')]({},_0x173fe0,_0x40633d[_0x3048('0x67')]);return _0x877878[_0x3048('0x80')](_0x173fe0);}})[_0x3048('0x20')](function(_0x59ca8d){if(_0x59ca8d){_0x83bb81=_0x59ca8d[_0x3048('0x49')];if(!_0x40633d[_0x3048('0x44')][_0x3048('0x4a')](_0x3048('0x4b'))){_0x173fe0['limit']=qs[_0x3048('0x32')](_0x40633d[_0x3048('0x44')][_0x3048('0x32')]);_0x173fe0[_0x3048('0x31')]=qs['offset'](_0x40633d[_0x3048('0x44')]['offset']);}return _0x877878[_0x3048('0x80')](_0x173fe0);}})[_0x3048('0x20')](function(_0x5f0cae){if(_0x5f0cae){return _0x5f0cae?{'count':_0x83bb81,'rows':_0x5f0cae}:null;}})[_0x3048('0x20')](respondWithResult(_0x30db53,null))[_0x3048('0x2a')](handleError(_0x30db53,null));};function Extension(_0x33cbef,_0x57b2eb,_0x29331c,_0x10b532){this[_0x3048('0x81')]=_0x3048('0x82');this['exten']=_0x33cbef[_0x3048('0x83')];this['app']=_0x10b532;this[_0x3048('0x51')]=_0x3048('0x84');this[_0x3048('0x85')]=_0x3048('0x86');this['FaxAccountId']=_0x33cbef['id'];this[_0x3048('0x7d')]=_0x57b2eb;this[_0x3048('0x87')]=_0x29331c;}function createExtensionsReciveFax(_0x5331e1){var _0x32d9f4=0x1;var _0x2a56e4=[];_0x2a56e4[_0x3048('0x88')](new Extension(_0x5331e1,_0x32d9f4,'',_0x3048('0x89')));_0x32d9f4+=0x1;_0x2a56e4[_0x3048('0x88')](new Extension(_0x5331e1,_0x32d9f4,_0x3048('0x8a'),_0x3048('0x8b')));_0x32d9f4+=0x1;for(var _0x2b0367 in _0x5331e1){if(_0x5331e1['hasOwnProperty'](_0x2b0367)&&(_0x2b0367===_0x3048('0x8c')||_0x2b0367==='localstationid'||_0x2b0367===_0x3048('0x8d')||_0x2b0367===_0x3048('0x8e')||_0x2b0367===_0x3048('0x8f')||_0x2b0367===_0x3048('0x90')||_0x2b0367===_0x3048('0x91')||_0x2b0367===_0x3048('0x92')||_0x2b0367===_0x3048('0x93'))){_0x2a56e4[_0x3048('0x88')](new Extension(_0x5331e1,_0x32d9f4,'FAXOPT('+_0x2b0367+')='+_0x5331e1[_0x2b0367],'Set'));_0x32d9f4+=0x1;}}_0x2a56e4[_0x3048('0x88')](new Extension(_0x5331e1,_0x32d9f4,'6',_0x3048('0x94')));_0x32d9f4+=0x1;_0x2a56e4[_0x3048('0x88')](new Extension(_0x5331e1,_0x32d9f4,_0x3048('0x95'),_0x3048('0x96')));_0x32d9f4=0x0;return _0x2a56e4;}exports[_0x3048('0x97')]=function(_0xef56cb,_0x4482d3,_0x142373){var _0x208ffc;return db[_0x3048('0x78')]['transaction'](function(_0x5b2203){return db[_0x3048('0x3f')][_0x3048('0x59')](_0xef56cb[_0x3048('0x5a')],{'transaction':_0x5b2203})[_0x3048('0x20')](function(_0x18c105){_0x208ffc=_0x18c105[_0x3048('0x38')]({'plain':!![]});return db[_0x3048('0x98')][_0x3048('0x7b')](createExtensionsReciveFax(_0x208ffc),{'transaction':_0x5b2203});});})[_0x3048('0x20')](function(){return _0x208ffc;})[_0x3048('0x20')](respondWithResult(_0x4482d3,null))['catch'](handleError(_0x4482d3,null));};exports[_0x3048('0x99')]=function(_0x4b0d77,_0x44a99e,_0x35a420){var _0x3103db;return db[_0x3048('0x78')][_0x3048('0x9a')](function(_0x17276b){return db['FaxAccount']['update'](_0x4b0d77[_0x3048('0x5a')],{'where':{'id':_0x4b0d77[_0x3048('0x5a')]['id']},'transaction':_0x17276b})[_0x3048('0x20')](function(_0x49a2a3){return db[_0x3048('0x98')][_0x3048('0x37')]({'where':{'FaxAccountId':_0x4b0d77[_0x3048('0x5a')]['id']},'transaction':_0x17276b})[_0x3048('0x20')](function(_0x5d311e){return db['VoiceExtension'][_0x3048('0x7b')](createExtensionsReciveFax(_['omit'](_0x4b0d77[_0x3048('0x5a')],[_0x3048('0x9b'),_0x3048('0x41'),_0x3048('0x9c'),_0x3048('0x9d'),'TrunkId',_0x3048('0x9e')])),{'transaction':_0x17276b});});});})[_0x3048('0x20')](function(){return db[_0x3048('0x3f')]['findById'](_0x4b0d77[_0x3048('0x5a')]['id']);})[_0x3048('0x20')](respondWithResult(_0x44a99e,null))['catch'](handleError(_0x44a99e,null));};exports[_0x3048('0x9f')]=function(_0x59deb0,_0x838942,_0x30b2a6){var _0x4fd043={'raw':!![],'where':{}};var _0x19c30b={};var _0x13b59e={'count':0x0,'rows':[]};return db[_0x3048('0x3f')][_0x3048('0x65')]({'where':{'id':_0x59deb0[_0x3048('0x60')]['id']}})[_0x3048('0x20')](handleEntityNotFound(_0x838942,null))[_0x3048('0x20')](function(_0xacae00){if(_0xacae00){_0x19c30b[_0x3048('0x42')]=_[_0x3048('0x43')](db[_0x3048('0xa0')][_0x3048('0x40')]);_0x19c30b[_0x3048('0x44')]=_[_0x3048('0x43')](_0x59deb0['query']);_0x19c30b[_0x3048('0x45')]=_[_0x3048('0x46')](_0x19c30b[_0x3048('0x42')],_0x19c30b[_0x3048('0x44')]);_0x4fd043[_0x3048('0x48')]=_[_0x3048('0x46')](_0x19c30b[_0x3048('0x42')],qs[_0x3048('0x47')](_0x59deb0['query']['fields']));_0x4fd043[_0x3048('0x48')]=_0x4fd043[_0x3048('0x48')][_0x3048('0x49')]?_0x4fd043[_0x3048('0x48')]:_0x19c30b['model'];if(!_0x59deb0[_0x3048('0x44')][_0x3048('0x4a')]('nolimit')){_0x4fd043[_0x3048('0x32')]=qs[_0x3048('0x32')](_0x59deb0[_0x3048('0x44')][_0x3048('0x32')]);_0x4fd043['offset']=qs['offset'](_0x59deb0[_0x3048('0x44')][_0x3048('0x31')]);}_0x4fd043[_0x3048('0x4c')]=qs[_0x3048('0x4d')](_0x59deb0[_0x3048('0x44')][_0x3048('0x4d')]);_0x4fd043['where']=qs[_0x3048('0x45')](_[_0x3048('0x66')](_0x59deb0[_0x3048('0x44')],_0x19c30b[_0x3048('0x45')]));_0x4fd043[_0x3048('0x4e')][_0x3048('0x62')]=_0xacae00['id'];if(_0x59deb0[_0x3048('0x44')][_0x3048('0x4f')]){_0x4fd043['where']=_[_0x3048('0x50')](_0x4fd043[_0x3048('0x4e')],{'$or':_[_0x3048('0x3e')](_0x4fd043[_0x3048('0x48')],function(_0x18898b){var _0x5c149e={};_0x5c149e[_0x18898b]={'$like':'%'+_0x59deb0[_0x3048('0x44')][_0x3048('0x4f')]+'%'};return _0x5c149e;})});}if(_0x59deb0[_0x3048('0x44')][_0x3048('0xa1')]){var _0x6576af=_0x59deb0[_0x3048('0x44')][_0x3048('0xa1')]['split'](',');var _0x29c61a={};_0x29c61a[_0x6576af[0x0]]={'$gte':moment(_0x6576af[0x1])[_0x3048('0xa2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4fd043[_0x3048('0x4e')]=_[_0x3048('0x50')](_0x4fd043['where'],_0x29c61a);}_0x4fd043=_[_0x3048('0x50')]({},_0x4fd043,_0x59deb0[_0x3048('0x67')]);return db[_0x3048('0xa0')][_0x3048('0x30')]({'where':_0x4fd043[_0x3048('0x4e')]})['then'](function(_0x1015fb){_0x13b59e[_0x3048('0x30')]=_0x1015fb;if(_0x59deb0[_0x3048('0x44')][_0x3048('0x53')]){_0x4fd043['include']=[{'all':!![]}];}return db[_0x3048('0xa0')]['findAll'](_0x4fd043);})[_0x3048('0x20')](function(_0x59d13f){_0x13b59e[_0x3048('0x68')]=_0x59d13f;return _0x13b59e;});}})[_0x3048('0x20')](respondWithFilteredResult(_0x838942,_0x4fd043))[_0x3048('0x2a')](handleError(_0x838942,null));};exports[_0x3048('0x7f')]=function(_0x1ba94c,_0x550817,_0x38b4b4){var _0xde939f,_0xd218ba={},_0x38f462;if(_0x1ba94c[_0x3048('0x5a')]['to']){_0x38f462=_0x1ba94c['body']['to'][0x0];}return db[_0x3048('0x3f')][_0x3048('0x58')]({'where':{'id':_0x1ba94c[_0x3048('0x60')]['id']},'include':[{'model':db[_0x3048('0xa3')],'as':_0x3048('0xa4'),'include':[{'model':db[_0x3048('0x72')],'as':_0x3048('0xa5'),'where':{'fax':_0x38f462},'limit':0x1,'order':[[_0x3048('0x9d'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x550817,null))[_0x3048('0x20')](function(_0x573469){_0xde939f=_0x573469;if(_0x1ba94c[_0x3048('0x5a')][_0x3048('0xa6')]&&_0x1ba94c[_0x3048('0x5a')][_0x3048('0xa6')]['length']){for(var _0x1d7727=0x0;_0x1d7727<_0x1ba94c[_0x3048('0x5a')][_0x3048('0xa6')][_0x3048('0x49')];_0x1d7727+=0x1){_0x1ba94c[_0x3048('0x5a')][_0x3048('0xa6')][_0x1d7727]={'filename':_0x1ba94c['body']['attachments'][_0x1d7727][_0x3048('0x3b')],'id':_0x1ba94c[_0x3048('0x5a')][_0x3048('0xa6')][_0x1d7727]['id'],'path':path[_0x3048('0xa7')](config['root'],_0x3048('0xa8'),_0x1ba94c[_0x3048('0x5a')]['attachments'][_0x1d7727][_0x3048('0xa9')])};}}return respondWithRpcPromise(_0x3048('0xaa'),_0x3048('0xaa'),{'FaxAccountId':_[_0x3048('0xab')](_0x1ba94c['params']['id'])?undefined:_0x1ba94c['params']['id'],'path':_['isNil'](_0x1ba94c[_0x3048('0x5a')][_0x3048('0xa6')][0x0]['path'])?undefined:_0x1ba94c[_0x3048('0x5a')][_0x3048('0xa6')][0x0][_0x3048('0x6')],'fax':_[_0x3048('0xab')](_0x1ba94c[_0x3048('0x5a')]['to'][0x0])?undefined:_0x1ba94c[_0x3048('0x5a')]['to'][0x0]},client9002);})[_0x3048('0x20')](function(){if(_0xde939f){if(_[_0x3048('0xab')](_0x1ba94c['body'][_0x3048('0xac')])){_0x1ba94c['body'][_0x3048('0xac')]=util[_0x3048('0xa2')](_0x3048('0xad'),_0xde939f[_0x3048('0x3b')],_0xde939f[_0x3048('0xae')]);}if(_0xde939f[_0x3048('0xa4')]){if(_0xde939f[_0x3048('0xa4')][_0x3048('0xa5')][_0x3048('0x49')]){return _0xde939f['List'][_0x3048('0xa5')][0x0];}else{return db[_0x3048('0x72')][_0x3048('0x59')](_[_0x3048('0x18')](_0x1ba94c['body'],{'firstName':_0x1ba94c[_0x3048('0x5a')]['to'][0x0],'phone':_0x1ba94c[_0x3048('0x5a')]['to'][0x0],'fax':_0x1ba94c['body']['to'][0x0],'ListId':_0xde939f['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x3048('0x20')](function(_0x4bc34e){if(_0x4bc34e){return db['FaxInteraction'][_0x3048('0x58')]({'where':{'ContactId':_0x4bc34e['id'],'closed':![],'FaxAccountId':_0xde939f['id']}})[_0x3048('0x20')](function(_0x4c2e2d){if(_0x4c2e2d){return[_0x4c2e2d,![]];}return db[_0x3048('0x71')][_0x3048('0x59')]({'UserId':_0x1ba94c[_0x3048('0x5b')]['id'],'ContactId':_0x4bc34e['id'],'FaxAccountId':_0xde939f['id'],'fax':_0x1ba94c[_0x3048('0x5a')]['to'][0x0],'firstMsgDirection':_0x3048('0xaf'),'Messages':[_[_0x3048('0x50')](_0x1ba94c[_0x3048('0x5a')],{'read':![],'body':_0x1ba94c[_0x3048('0x5a')]['attachments'][0x0]['filename'],'FaxAccountId':_0xde939f['id'],'UserId':_0x1ba94c[_0x3048('0x5b')]['id'],'ContactId':_0x4bc34e['id'],'AttachmentId':_0x1ba94c[_0x3048('0x5a')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x3048('0xa0')],'as':_0x3048('0xb0')}]})[_0x3048('0x20')](function(_0x5df127){return[_0x5df127,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x3048('0xb1')](function(_0x38a116,_0x2dc375){if(_0x2dc375){return _0x38a116;}return db[_0x3048('0xa0')][_0x3048('0x59')]({'direction':_0x3048('0xaf'),'read':![],'body':_0x1ba94c['body'][_0x3048('0xa6')][0x0][_0x3048('0xb2')],'FaxAccountId':_0xde939f['id'],'FaxInteractionId':_0x38a116['id'],'UserId':_0x1ba94c['user']['id'],'ContactId':_0x38a116[_0x3048('0xb3')],'AttachmentId':_0x1ba94c[_0x3048('0x5a')]['attachments'][0x0]['id']})['then'](function(_0x1b8125){_0x38a116['dataValues'][_0x3048('0xb0')]=[];_0x38a116[_0x3048('0xb4')][_0x3048('0xb0')][_0x3048('0x88')](_0x1b8125[_0x3048('0xb4')]);return _0x38a116;});})[_0x3048('0x20')](function(_0x11c4cc){respondWithRpcPromise(_0x3048('0xb5'),'SendFax',{'FaxAccountId':_[_0x3048('0xab')](_0x1ba94c['params']['id'])?undefined:_0x1ba94c[_0x3048('0x60')]['id'],'path':_[_0x3048('0xab')](_0x1ba94c['body'][_0x3048('0xa6')][0x0][_0x3048('0x6')])?undefined:_0x1ba94c[_0x3048('0x5a')]['attachments'][0x0][_0x3048('0x6')],'fax':_[_0x3048('0xab')](_0x1ba94c[_0x3048('0x5a')]['to'][0x0])?undefined:_0x1ba94c[_0x3048('0x5a')]['to'][0x0],'AttachmentId':_0x1ba94c[_0x3048('0x5a')][_0x3048('0xa6')][0x0]['id']},client9002)[_0x3048('0x20')](function(_0x5923ba){logger['info'](_0x3048('0xb6'),_0x5923ba);})[_0x3048('0x2a')](function(_0x483fe2){logger[_0x3048('0x21')]('SendFaxRpc,\x20%s',_0x483fe2);});return _0x11c4cc;})[_0x3048('0x20')](respondWithResult(_0x550817,null))[_0x3048('0x2a')](handleError(_0x550817,null));};exports[_0x3048('0xb7')]=function(_0x2e83df,_0xbef6b,_0x426788){return db[_0x3048('0x3f')][_0x3048('0x58')]({'where':{'id':_0x2e83df[_0x3048('0x60')]['id']}})['then'](handleEntityNotFound(_0xbef6b,null))[_0x3048('0x20')](function(_0x34300c){if(_0x34300c){return _0x34300c['addAgents'](_0x2e83df['body']['ids'],_['omit'](_0x2e83df[_0x3048('0x5a')],['ids','id'])||{})[_0x3048('0xb1')](function(_0x18e72b){for(var _0x51f304=0x0;_0x51f304<_0x2e83df[_0x3048('0x5a')][_0x3048('0x6e')]['length'];_0x51f304+=0x1){socket[_0x3048('0xb8')]('userFaxAccount:save',{'UserId':Number(_0x2e83df[_0x3048('0x5a')][_0x3048('0x6e')][_0x51f304]),'FaxAccountId':Number(_0x2e83df[_0x3048('0x60')]['id'])});}return _0x18e72b;});}})[_0x3048('0x20')](respondWithResult(_0xbef6b,null))['catch'](handleError(_0xbef6b,null));};exports[_0x3048('0xb9')]=function(_0x3595ca,_0x2ca517,_0x52fa1d){return db[_0x3048('0x3f')][_0x3048('0x58')]({'where':{'id':_0x3595ca['params']['id']}})[_0x3048('0x20')](handleEntityNotFound(_0x2ca517,null))['then'](function(_0xdac42e){if(_0xdac42e){return _0xdac42e['removeAgents'](_0x3595ca[_0x3048('0x44')][_0x3048('0x6e')])[_0x3048('0x20')](function(){if(_['isArray'](_0x3595ca['query'][_0x3048('0x6e')])){for(var _0x1d9831=0x0;_0x1d9831<_0x3595ca[_0x3048('0x44')][_0x3048('0x6e')][_0x3048('0x49')];_0x1d9831+=0x1){socket[_0x3048('0xb8')]('userFaxAccount:remove',{'UserId':Number(_0x3595ca[_0x3048('0x44')]['ids'][_0x1d9831]),'FaxAccountId':Number(_0x3595ca[_0x3048('0x60')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x3595ca[_0x3048('0x44')][_0x3048('0x6e')]),'FaxAccountId':Number(_0x3595ca[_0x3048('0x60')]['id'])});}});}})['then'](respondWithStatusCode(_0x2ca517,null))[_0x3048('0x2a')](handleError(_0x2ca517,null));};exports['getAgents']=function(_0x270ce2,_0x295b2c,_0x1e6fe9){var _0x1451b8={};var _0x184902={};var _0x5842e7;var _0x4bcb0a;return db[_0x3048('0x3f')][_0x3048('0x65')]({'where':{'id':_0x270ce2[_0x3048('0x60')]['id']}})[_0x3048('0x20')](handleEntityNotFound(_0x295b2c,null))['then'](function(_0x2e20fb){if(_0x2e20fb){_0x5842e7=_0x2e20fb;_0x184902[_0x3048('0x42')]=_['keys'](db[_0x3048('0xba')][_0x3048('0x40')]);_0x184902[_0x3048('0x44')]=_['keys'](_0x270ce2['query']);_0x184902['filters']=_[_0x3048('0x46')](_0x184902[_0x3048('0x42')],_0x184902[_0x3048('0x44')]);_0x1451b8['attributes']=_[_0x3048('0x46')](_0x184902['model'],qs['fields'](_0x270ce2[_0x3048('0x44')]['fields']));_0x1451b8[_0x3048('0x48')]=_0x1451b8['attributes'][_0x3048('0x49')]?_0x1451b8[_0x3048('0x48')]:_0x184902[_0x3048('0x42')];_0x1451b8[_0x3048('0x4c')]=qs[_0x3048('0x4d')](_0x270ce2[_0x3048('0x44')][_0x3048('0x4d')]);_0x1451b8[_0x3048('0x4e')]=qs[_0x3048('0x45')](_[_0x3048('0x66')](_0x270ce2[_0x3048('0x44')],_0x184902[_0x3048('0x45')]));if(_0x270ce2['query'][_0x3048('0x4f')]){_0x1451b8[_0x3048('0x4e')]=_[_0x3048('0x50')](_0x1451b8['where'],{'$or':_[_0x3048('0x3e')](_0x1451b8['attributes'],function(_0xffee9d){var _0x5a290c={};_0x5a290c[_0xffee9d]={'$like':'%'+_0x270ce2[_0x3048('0x44')]['filter']+'%'};return _0x5a290c;})});}_0x1451b8=_['merge']({},_0x1451b8,_0x270ce2['options']);return _0x5842e7[_0x3048('0xbb')](_0x1451b8);}})[_0x3048('0x20')](function(_0x362aae){if(_0x362aae){_0x4bcb0a=_0x362aae['length'];if(!_0x270ce2['query'][_0x3048('0x4a')]('nolimit')){_0x1451b8[_0x3048('0x32')]=qs[_0x3048('0x32')](_0x270ce2['query'][_0x3048('0x32')]);_0x1451b8['offset']=qs[_0x3048('0x31')](_0x270ce2[_0x3048('0x44')][_0x3048('0x31')]);}return _0x5842e7['getAgents'](_0x1451b8);}})[_0x3048('0x20')](function(_0x599973){if(_0x599973){return _0x599973?{'count':_0x4bcb0a,'rows':_0x599973}:null;}})['then'](respondWithResult(_0x295b2c,null))[_0x3048('0x2a')](handleError(_0x295b2c,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 2cea2aa..c0989c7 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 _0x546f=['setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x546f,0xf7));var _0xf546=function(_0x311e78,_0xbcf8ca){_0x311e78=_0x311e78-0x0;var _0x44fef6=_0x546f[_0x311e78];return _0x44fef6;};'use strict';var EventEmitter=require(_0xf546('0x0'));var FaxAccount=require(_0xf546('0x1'))['db'][_0xf546('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xf546('0x3')](0x0);var events={'afterCreate':_0xf546('0x4'),'afterUpdate':_0xf546('0x5'),'afterDestroy':_0xf546('0x6')};function emitEvent(_0x379a7d){return function(_0x3c3344,_0x354c82,_0x535f2e){FaxAccountEvents['emit'](_0x379a7d+':'+_0x3c3344['id'],_0x3c3344);FaxAccountEvents['emit'](_0x379a7d,_0x3c3344);_0x535f2e(null);};}for(var e in events){if(events[_0xf546('0x7')](e)){var event=events[e];FaxAccount[_0xf546('0x8')](e,emitEvent(event));}}module[_0xf546('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0x7b77=['../../mysqldb','FaxAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events'];(function(_0xe75d24,_0x54f93b){var _0x4d2587=function(_0x1e5fc9){while(--_0x1e5fc9){_0xe75d24['push'](_0xe75d24['shift']());}};_0x4d2587(++_0x54f93b);}(_0x7b77,0x179));var _0x77b7=function(_0xf0bc07,_0x510ebf){_0xf0bc07=_0xf0bc07-0x0;var _0x1c50c2=_0x7b77[_0xf0bc07];return _0x1c50c2;};'use strict';var EventEmitter=require(_0x77b7('0x0'));var FaxAccount=require(_0x77b7('0x1'))['db'][_0x77b7('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x77b7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x77b7('0x4'),'afterDestroy':_0x77b7('0x5')};function emitEvent(_0x3dbd97){return function(_0x5cfb6f,_0x4716a1,_0x139f98){FaxAccountEvents[_0x77b7('0x6')](_0x3dbd97+':'+_0x5cfb6f['id'],_0x5cfb6f);FaxAccountEvents[_0x77b7('0x6')](_0x3dbd97,_0x5cfb6f);_0x139f98(null);};}for(var e in events){if(events[_0x77b7('0x7')](e)){var event=events[e];FaxAccount[_0x77b7('0x8')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 1fc695d..f6c655e 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 _0x5c9c=['../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0xba3943,_0x5bd4d3){var _0x76c933=function(_0x21361f){while(--_0x21361f){_0xba3943['push'](_0xba3943['shift']());}};_0x76c933(++_0x5bd4d3);}(_0x5c9c,0x1c0));var _0xc5c9=function(_0x57fe6c,_0x4e7465){_0x57fe6c=_0x57fe6c-0x0;var _0x5167f6=_0x5c9c[_0x57fe6c];return _0x5167f6;};'use strict';var _=require(_0xc5c9('0x0'));var util=require(_0xc5c9('0x1'));var logger=require(_0xc5c9('0x2'))('api');var moment=require(_0xc5c9('0x3'));var BPromise=require(_0xc5c9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc5c9('0x5'));var rimraf=require(_0xc5c9('0x6'));var config=require(_0xc5c9('0x7'));var attributes=require(_0xc5c9('0x8'));module[_0xc5c9('0x9')]=function(_0x56343d,_0x1b299d){return _0x56343d[_0xc5c9('0xa')](_0xc5c9('0xb'),attributes,{'tableName':_0xc5c9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8757=['fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./faxAccount.attributes','exports','define'];(function(_0x5d37d1,_0x2a8a4d){var _0x37683b=function(_0x38a04b){while(--_0x38a04b){_0x5d37d1['push'](_0x5d37d1['shift']());}};_0x37683b(++_0x2a8a4d);}(_0x8757,0xfd));var _0x7875=function(_0x2f0844,_0x4d2d46){_0x2f0844=_0x2f0844-0x0;var _0x46a2c3=_0x8757[_0x2f0844];return _0x46a2c3;};'use strict';var _=require(_0x7875('0x0'));var util=require(_0x7875('0x1'));var logger=require(_0x7875('0x2'))(_0x7875('0x3'));var moment=require(_0x7875('0x4'));var BPromise=require(_0x7875('0x5'));var rp=require(_0x7875('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7875('0x7'));var attributes=require(_0x7875('0x8'));module[_0x7875('0x9')]=function(_0x69735f,_0x5a899f){return _0x69735f[_0x7875('0xa')]('FaxAccount',attributes,{'tableName':_0x7875('0xb'),'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 fa00687..cd0b70b 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 _0xffed=['FaxApplication','Applications','list','orderBy','applications','priority','from','create','fax','FaxInteraction','find','Contact\x20not\x20found','get','push','close','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','User','name','waitForTheAssignedAgent','Start','startRouting','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxAccount.socket','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','GetFaxAccount','FaxAccount','options','where','attributes','limit','include','model','map','NotifyFaxAccount','body','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC'];(function(_0x46fe2b,_0x3931b3){var _0x33a923=function(_0x286913){while(--_0x286913){_0x46fe2b['push'](_0x46fe2b['shift']());}};_0x33a923(++_0x3931b3);}(_0xffed,0xc4));var _0xdffe=function(_0x592030,_0x19ca68){_0x592030=_0x592030-0x0;var _0x3ea820=_0xffed[_0x592030];return _0x3ea820;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdffe('0x0'));var BPromise=require(_0xdffe('0x1'));var rs=require(_0xdffe('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdffe('0x3'))['db'];var utils=require(_0xdffe('0x4'));var logger=require('../../config/logger')(_0xdffe('0x5'));var config=require(_0xdffe('0x6'));var jayson=require(_0xdffe('0x7'));var client=jayson[_0xdffe('0x8')][_0xdffe('0x9')]({'port':0x232c});config[_0xdffe('0xa')]=_[_0xdffe('0xb')](config['redis'],{'host':_0xdffe('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdffe('0xa')]));require(_0xdffe('0xd'))['register'](socket);function respondWithRpcPromise(_0xced7f,_0x49dab7,_0x1eb654){return new BPromise(function(_0xd3ad24,_0x14be78){return client[_0xdffe('0xe')](_0xced7f,_0x1eb654)[_0xdffe('0xf')](function(_0x1a1719){logger[_0xdffe('0x10')]('FaxAccount,\x20%s,\x20%s',_0x49dab7,_0xdffe('0x11'));logger[_0xdffe('0x12')](_0xdffe('0x13'),_0x49dab7,_0xdffe('0x11'),JSON[_0xdffe('0x14')](_0x1a1719));if(_0x1a1719['error']){if(_0x1a1719[_0xdffe('0x15')][_0xdffe('0x16')]===0x1f4){logger['error'](_0xdffe('0x17'),_0x49dab7,_0x1a1719['error'][_0xdffe('0x18')]);return _0x14be78(_0x1a1719[_0xdffe('0x15')]['message']);}logger[_0xdffe('0x15')](_0xdffe('0x17'),_0x49dab7,_0x1a1719[_0xdffe('0x15')]['message']);return _0xd3ad24(_0x1a1719[_0xdffe('0x15')][_0xdffe('0x18')]);}else{logger[_0xdffe('0x10')](_0xdffe('0x17'),_0x49dab7,_0xdffe('0x11'));_0xd3ad24(_0x1a1719[_0xdffe('0x19')][_0xdffe('0x18')]);}})['catch'](function(_0x4f1900){logger[_0xdffe('0x15')](_0xdffe('0x17'),_0x49dab7,_0x4f1900);_0x14be78(_0x4f1900);});});}exports[_0xdffe('0x1a')]=function(_0x3a8699){var _0x13aae8=this;return new Promise(function(_0x29e8c5,_0xadbabc){return db[_0xdffe('0x1b')]['findAll']({'raw':_0x3a8699[_0xdffe('0x1c')]?_0x3a8699['options']['raw']===undefined?!![]:![]:!![],'where':_0x3a8699[_0xdffe('0x1c')]?_0x3a8699[_0xdffe('0x1c')][_0xdffe('0x1d')]||null:null,'attributes':_0x3a8699[_0xdffe('0x1c')]?_0x3a8699[_0xdffe('0x1c')][_0xdffe('0x1e')]||null:null,'limit':_0x3a8699[_0xdffe('0x1c')]?_0x3a8699[_0xdffe('0x1c')][_0xdffe('0x1f')]||null:null,'include':_0x3a8699[_0xdffe('0x1c')]?_0x3a8699[_0xdffe('0x1c')]['include']?_['map'](_0x3a8699[_0xdffe('0x1c')][_0xdffe('0x20')],function(_0x5addb2){return{'model':db[_0x5addb2[_0xdffe('0x21')]],'as':_0x5addb2['as'],'attributes':_0x5addb2[_0xdffe('0x1e')],'include':_0x5addb2['include']?_[_0xdffe('0x22')](_0x5addb2['include'],function(_0x207f6d){return{'model':db[_0x207f6d[_0xdffe('0x21')]],'as':_0x207f6d['as'],'attributes':_0x207f6d['attributes'],'include':_0x207f6d[_0xdffe('0x20')]?_[_0xdffe('0x22')](_0x207f6d['include'],function(_0x1b6bde){return{'model':db[_0x1b6bde[_0xdffe('0x21')]],'as':_0x1b6bde['as'],'attributes':_0x1b6bde[_0xdffe('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xdffe('0xf')](function(_0x3e0929){logger['info'](_0xdffe('0x1a'),_0x3a8699);logger[_0xdffe('0x12')](_0xdffe('0x1a'),_0x3a8699,JSON[_0xdffe('0x14')](_0x3e0929));_0x29e8c5(_0x3e0929);})['catch'](function(_0xb14426){logger[_0xdffe('0x15')](_0xdffe('0x1a'),_0xb14426[_0xdffe('0x18')],_0x3a8699);_0xadbabc(_0x13aae8[_0xdffe('0x15')](0x1f4,_0xb14426[_0xdffe('0x18')]));});});};exports[_0xdffe('0x23')]=function(_0x9b48e2,_0x53090d,_0x56b732){var _0x3983e4=this;return new Promise(function(_0x85935f,_0x1cdc74){var _0x3f025c={'body':_0x9b48e2[_0xdffe('0x24')],'channel':'fax'};var _0x32e850=[];var _0x3a39bf=[];var _0x4f75ba={};return db[_0xdffe('0x25')][_0xdffe('0x26')]()['then'](function(_0x327e88){if(!_0x327e88){throw new db[(_0xdffe('0x27'))]['ValidationError'](_0xdffe('0x28'));}_0x32e850=_[_0xdffe('0x29')](_[_0xdffe('0x2a')](_0x327e88),[_0xdffe('0x2b'),_0xdffe('0x2c')]);_0x3a39bf=_[_0xdffe('0x29')](_[_0xdffe('0x2a')](_0x327e88),[_0xdffe('0x2b'),'updatedAt',_0xdffe('0x2d'),_0xdffe('0x2e')]);if(_0x9b48e2[_0xdffe('0x24')]['id']){delete _0x9b48e2[_0xdffe('0x24')]['id'];}if(_['isNil'](_0x9b48e2['body']['from'])){throw new db[(_0xdffe('0x27'))]['ValidationError'](_0xdffe('0x2f'));}if(_[_0xdffe('0x30')](_0x9b48e2[_0xdffe('0x24')][_0xdffe('0x24')])||_0x9b48e2[_0xdffe('0x24')][_0xdffe('0x24')]===''){throw new db[(_0xdffe('0x27'))][(_0xdffe('0x31'))](_0xdffe('0x32'));}if(_['isNil'](_0x9b48e2[_0xdffe('0x24')]['mapKey'])){throw new db[(_0xdffe('0x27'))][(_0xdffe('0x31'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3a39bf);}if(!_[_0xdffe('0x33')](_0x3a39bf,_0x9b48e2[_0xdffe('0x24')][_0xdffe('0x34')])){throw new db[(_0xdffe('0x27'))][(_0xdffe('0x31'))](_0xdffe('0x35')+_0x3a39bf);}_0x4f75ba[_0x9b48e2['body'][_0xdffe('0x34')]]=_0x9b48e2['body']['from'];})['then'](function(){return db[_0xdffe('0x1b')]['find']({'where':{'id':_0x9b48e2[_0xdffe('0x36')]['id']},'include':[{'model':db[_0xdffe('0x37')],'as':_0xdffe('0x38'),'include':[{'model':db['CmContact'],'as':_0xdffe('0x39'),'where':_0x4f75ba,'limit':0x1,'order':[[_0xdffe('0x2c'),_0xdffe('0x3a')]]}]},{'model':db[_0xdffe('0x3b')],'as':_0xdffe('0x3c')}]});})[_0xdffe('0xf')](function(_0x4b1525){if(_0x4b1525&&_0x4b1525['List']){var _0x89d764=_0x4b1525['get']({'plain':!![]});_0x3f025c[_0xdffe('0x36')]=_0x89d764;_0x3f025c['applications']=_0x89d764[_0xdffe('0x3c')];_0x3f025c[_0xdffe('0x3d')]=_0x89d764['List'];_0x3f025c['applications']=_[_0xdffe('0x3e')](_0x3f025c[_0xdffe('0x3f')],[_0xdffe('0x40')],['asc']);if(_0x3f025c[_0xdffe('0x36')]['Applications']){delete _0x3f025c[_0xdffe('0x36')][_0xdffe('0x3c')];}if(_0x3f025c[_0xdffe('0x36')][_0xdffe('0x38')]&&_0x3f025c['account'][_0xdffe('0x38')][_0xdffe('0x39')]['length']){return _0x3f025c[_0xdffe('0x36')][_0xdffe('0x38')][_0xdffe('0x39')][0x0];}var _0x1c99c9=_[_0xdffe('0xb')](_0x9b48e2[_0xdffe('0x24')],{'firstName':_0x9b48e2['body']['from'],'ListId':_0x89d764[_0xdffe('0x2e')]});_0x1c99c9[_0x9b48e2[_0xdffe('0x24')][_0xdffe('0x34')]]=_0x9b48e2[_0xdffe('0x24')][_0xdffe('0x41')];return db[_0xdffe('0x25')][_0xdffe('0x42')](_0x1c99c9,{'fields':_0x32e850,'raw':!![]});}})[_0xdffe('0xf')](function(_0x450b38){_0x3f025c['contact']=_0x450b38;if(_0x450b38){var _0x2ea042={'ContactId':_0x450b38['id'],'FaxAccountId':_0x9b48e2[_0xdffe('0x36')]['id'],'fax':_0x450b38[_0xdffe('0x43')]};return db[_0xdffe('0x44')][_0xdffe('0x45')]({'where':{'ContactId':_0x450b38['id'],'closed':![],'FaxAccountId':_0x9b48e2[_0xdffe('0x36')]['id']}})[_0xdffe('0xf')](function(_0x152cf9){if(_0x152cf9){return[_0x152cf9,![]];}return db[_0xdffe('0x44')][_0xdffe('0x42')](_0x2ea042)[_0xdffe('0xf')](function(_0x21273d){return[_0x21273d,!![]];});});}else{throw new Error(_0xdffe('0x46'));}})['spread'](function(_0x43a083,_0x1dd071){var _0xbd9039=_0x43a083[_0xdffe('0x47')]({'plain':!![]});if(_0x1dd071){if(_0x3f025c[_0xdffe('0x36')]['autoclose']){_0x3f025c[_0xdffe('0x3f')][_0xdffe('0x48')]({'id':0x0,'priority':_0x3f025c[_0xdffe('0x3f')]['length']+0x1,'app':_0xdffe('0x49'),'appdata':'unmanaged','interval':_0xdffe('0x4a')});}_0xbd9039['created']=!![];}else{_0xbd9039[_0xdffe('0x4b')]=![];}_0x3f025c[_0xdffe('0x4c')]=_0xbd9039;return db[_0xdffe('0x4d')][_0xdffe('0x42')]({'body':_0x9b48e2[_0xdffe('0x24')][_0xdffe('0x24')],'FaxAccountId':_0x9b48e2[_0xdffe('0x36')]['id'],'FaxInteractionId':_0x43a083['id'],'direction':'in','ContactId':_0x43a083['ContactId'],'AttachmentId':_0x9b48e2[_0xdffe('0x24')][_0xdffe('0x4e')]});})[_0xdffe('0xf')](function(_0x1339b8){_0x3f025c['message']=_0x1339b8;if(_0x3f025c[_0xdffe('0x4c')][_0xdffe('0x4f')]){return db[_0xdffe('0x50')][_0xdffe('0x45')]({'attributes':['id',_0xdffe('0x51')],'where':{'id':_0x3f025c[_0xdffe('0x4c')][_0xdffe('0x4f')]}})[_0xdffe('0xf')](function(_0x8bdfc9){if(_0x8bdfc9){_0x3f025c['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x8bdfc9[_0xdffe('0x51')]+','+(_0x3f025c[_0xdffe('0x36')][_0xdffe('0x52')]||0xa),'interval':_0xdffe('0x4a')});}return respondWithRpcPromise(_0xdffe('0x53'),_0xdffe('0x54'),_0x3f025c);});}return respondWithRpcPromise(_0xdffe('0x53'),_0xdffe('0x54'),_0x3f025c);})[_0xdffe('0xf')](function(_0x229edf){_0x85935f(_0x229edf);})['catch'](function(_0xffbf4e){_0x1cdc74(_0x3983e4['error'](0x1f4,_0xffbf4e[_0xdffe('0x18')]));});});}; \ No newline at end of file +var _0x1761=['stringify','error','code','FaxAccount,\x20%s,\x20%s','message','info','result','catch','FaxAccount','findAll','options','limit','include','map','model','attributes','GetFaxAccount','NotifyFaxAccount','body','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find','account','CmList','Contacts','DESC','FaxApplication','Applications','get','applications','List','orderBy','priority','asc','length','contact','fax','FaxInteraction','create','Contact\x20not\x20found','spread','autoclose','push','close','*,*,*,*','FaxMessage','ContactId','interaction','UserId','User','unshift','agent','name','waitForTheAssignedAgent','startRouting','Start','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','request\x20sent','debug'];(function(_0x60df74,_0x458e29){var _0x5ee872=function(_0x356888){while(--_0x356888){_0x60df74['push'](_0x60df74['shift']());}};_0x5ee872(++_0x458e29);}(_0x1761,0x9f));var _0x1176=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1761[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x1176('0x0'));var moment=require(_0x1176('0x1'));var BPromise=require(_0x1176('0x2'));var rs=require(_0x1176('0x3'));var fs=require('fs');var Redis=require(_0x1176('0x4'));var db=require(_0x1176('0x5'))['db'];var utils=require(_0x1176('0x6'));var logger=require(_0x1176('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1176('0x8')][_0x1176('0x9')]({'port':0x232c});config[_0x1176('0xa')]=_['defaults'](config['redis'],{'host':_0x1176('0xb'),'port':0x18eb});var socket=require(_0x1176('0xc'))(new Redis(config['redis']));require(_0x1176('0xd'))[_0x1176('0xe')](socket);function respondWithRpcPromise(_0x5cf689,_0x1433a3,_0x3f118f){return new BPromise(function(_0x4d51a6,_0xba95d2){return client[_0x1176('0xf')](_0x5cf689,_0x3f118f)[_0x1176('0x10')](function(_0x3725e7){logger['info']('FaxAccount,\x20%s,\x20%s',_0x1433a3,_0x1176('0x11'));logger[_0x1176('0x12')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x1433a3,'request\x20sent',JSON[_0x1176('0x13')](_0x3725e7));if(_0x3725e7[_0x1176('0x14')]){if(_0x3725e7[_0x1176('0x14')][_0x1176('0x15')]===0x1f4){logger[_0x1176('0x14')](_0x1176('0x16'),_0x1433a3,_0x3725e7['error'][_0x1176('0x17')]);return _0xba95d2(_0x3725e7[_0x1176('0x14')]['message']);}logger[_0x1176('0x14')](_0x1176('0x16'),_0x1433a3,_0x3725e7[_0x1176('0x14')][_0x1176('0x17')]);return _0x4d51a6(_0x3725e7[_0x1176('0x14')][_0x1176('0x17')]);}else{logger[_0x1176('0x18')]('FaxAccount,\x20%s,\x20%s',_0x1433a3,_0x1176('0x11'));_0x4d51a6(_0x3725e7[_0x1176('0x19')]['message']);}})[_0x1176('0x1a')](function(_0x1fe448){logger[_0x1176('0x14')](_0x1176('0x16'),_0x1433a3,_0x1fe448);_0xba95d2(_0x1fe448);});});}exports['GetFaxAccount']=function(_0x5e7f3d){var _0x5533d2=this;return new Promise(function(_0x245623,_0x168d27){return db[_0x1176('0x1b')][_0x1176('0x1c')]({'raw':_0x5e7f3d[_0x1176('0x1d')]?_0x5e7f3d[_0x1176('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5e7f3d[_0x1176('0x1d')]?_0x5e7f3d[_0x1176('0x1d')]['where']||null:null,'attributes':_0x5e7f3d[_0x1176('0x1d')]?_0x5e7f3d['options']['attributes']||null:null,'limit':_0x5e7f3d[_0x1176('0x1d')]?_0x5e7f3d[_0x1176('0x1d')][_0x1176('0x1e')]||null:null,'include':_0x5e7f3d[_0x1176('0x1d')]?_0x5e7f3d[_0x1176('0x1d')][_0x1176('0x1f')]?_[_0x1176('0x20')](_0x5e7f3d[_0x1176('0x1d')][_0x1176('0x1f')],function(_0x498e38){return{'model':db[_0x498e38[_0x1176('0x21')]],'as':_0x498e38['as'],'attributes':_0x498e38['attributes'],'include':_0x498e38[_0x1176('0x1f')]?_[_0x1176('0x20')](_0x498e38[_0x1176('0x1f')],function(_0x1c22d8){return{'model':db[_0x1c22d8[_0x1176('0x21')]],'as':_0x1c22d8['as'],'attributes':_0x1c22d8[_0x1176('0x22')],'include':_0x1c22d8[_0x1176('0x1f')]?_[_0x1176('0x20')](_0x1c22d8['include'],function(_0x205a72){return{'model':db[_0x205a72[_0x1176('0x21')]],'as':_0x205a72['as'],'attributes':_0x205a72[_0x1176('0x22')]};}):[]};}):[]};}):[]:[]})[_0x1176('0x10')](function(_0x36d8ab){logger['info'](_0x1176('0x23'),_0x5e7f3d);logger['debug']('GetFaxAccount',_0x5e7f3d,JSON['stringify'](_0x36d8ab));_0x245623(_0x36d8ab);})[_0x1176('0x1a')](function(_0x35e41a){logger['error'](_0x1176('0x23'),_0x35e41a['message'],_0x5e7f3d);_0x168d27(_0x5533d2[_0x1176('0x14')](0x1f4,_0x35e41a[_0x1176('0x17')]));});});};exports[_0x1176('0x24')]=function(_0x3dfc79,_0x516686,_0x58e1c6){var _0x38a230=this;return new Promise(function(_0x1ddca8,_0x2795c6){var _0x1a6399={'body':_0x3dfc79[_0x1176('0x25')],'channel':'fax'};var _0x5e55ec=[];var _0x2ec959=[];var _0x1ac7cb={};return db[_0x1176('0x26')][_0x1176('0x27')]()['then'](function(_0x2219f5){if(!_0x2219f5){throw new db[(_0x1176('0x28'))][(_0x1176('0x29'))](_0x1176('0x2a'));}_0x5e55ec=_[_0x1176('0x2b')](_[_0x1176('0x2c')](_0x2219f5),[_0x1176('0x2d'),_0x1176('0x2e')]);_0x2ec959=_[_0x1176('0x2b')](_['keys'](_0x2219f5),[_0x1176('0x2d'),_0x1176('0x2e'),'CompanyId',_0x1176('0x2f')]);if(_0x3dfc79[_0x1176('0x25')]['id']){delete _0x3dfc79[_0x1176('0x25')]['id'];}if(_[_0x1176('0x30')](_0x3dfc79['body'][_0x1176('0x31')])){throw new db[(_0x1176('0x28'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x1176('0x30')](_0x3dfc79['body']['body'])||_0x3dfc79[_0x1176('0x25')][_0x1176('0x25')]===''){throw new db[(_0x1176('0x28'))]['ValidationError'](_0x1176('0x32'));}if(_[_0x1176('0x30')](_0x3dfc79[_0x1176('0x25')][_0x1176('0x33')])){throw new db[(_0x1176('0x28'))]['ValidationError'](_0x1176('0x34')+_0x2ec959);}if(!_[_0x1176('0x35')](_0x2ec959,_0x3dfc79[_0x1176('0x25')][_0x1176('0x33')])){throw new db[(_0x1176('0x28'))][(_0x1176('0x29'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2ec959);}_0x1ac7cb[_0x3dfc79[_0x1176('0x25')]['mapKey']]=_0x3dfc79[_0x1176('0x25')][_0x1176('0x31')];})[_0x1176('0x10')](function(){return db[_0x1176('0x1b')][_0x1176('0x36')]({'where':{'id':_0x3dfc79[_0x1176('0x37')]['id']},'include':[{'model':db[_0x1176('0x38')],'as':'List','include':[{'model':db[_0x1176('0x26')],'as':_0x1176('0x39'),'where':_0x1ac7cb,'limit':0x1,'order':[[_0x1176('0x2e'),_0x1176('0x3a')]]}]},{'model':db[_0x1176('0x3b')],'as':_0x1176('0x3c')}]});})[_0x1176('0x10')](function(_0x2f9050){if(_0x2f9050&&_0x2f9050['List']){var _0x38fda3=_0x2f9050[_0x1176('0x3d')]({'plain':!![]});_0x1a6399[_0x1176('0x37')]=_0x38fda3;_0x1a6399[_0x1176('0x3e')]=_0x38fda3[_0x1176('0x3c')];_0x1a6399['list']=_0x38fda3[_0x1176('0x3f')];_0x1a6399[_0x1176('0x3e')]=_[_0x1176('0x40')](_0x1a6399['applications'],[_0x1176('0x41')],[_0x1176('0x42')]);if(_0x1a6399[_0x1176('0x37')][_0x1176('0x3c')]){delete _0x1a6399[_0x1176('0x37')][_0x1176('0x3c')];}if(_0x1a6399[_0x1176('0x37')][_0x1176('0x3f')]&&_0x1a6399['account']['List'][_0x1176('0x39')][_0x1176('0x43')]){return _0x1a6399[_0x1176('0x37')]['List']['Contacts'][0x0];}var _0x5b9093=_['defaults'](_0x3dfc79[_0x1176('0x25')],{'firstName':_0x3dfc79[_0x1176('0x25')][_0x1176('0x31')],'ListId':_0x38fda3[_0x1176('0x2f')]});_0x5b9093[_0x3dfc79[_0x1176('0x25')][_0x1176('0x33')]]=_0x3dfc79[_0x1176('0x25')][_0x1176('0x31')];return db[_0x1176('0x26')]['create'](_0x5b9093,{'fields':_0x5e55ec,'raw':!![]});}})[_0x1176('0x10')](function(_0x12024e){_0x1a6399[_0x1176('0x44')]=_0x12024e;if(_0x12024e){var _0x36fe57={'ContactId':_0x12024e['id'],'FaxAccountId':_0x3dfc79[_0x1176('0x37')]['id'],'fax':_0x12024e[_0x1176('0x45')]};return db[_0x1176('0x46')][_0x1176('0x36')]({'where':{'ContactId':_0x12024e['id'],'closed':![],'FaxAccountId':_0x3dfc79[_0x1176('0x37')]['id']}})[_0x1176('0x10')](function(_0x1c4b59){if(_0x1c4b59){return[_0x1c4b59,![]];}return db[_0x1176('0x46')][_0x1176('0x47')](_0x36fe57)[_0x1176('0x10')](function(_0x4e64ad){return[_0x4e64ad,!![]];});});}else{throw new Error(_0x1176('0x48'));}})[_0x1176('0x49')](function(_0xb13426,_0x37be7b){var _0x2f859c=_0xb13426[_0x1176('0x3d')]({'plain':!![]});if(_0x37be7b){if(_0x1a6399[_0x1176('0x37')][_0x1176('0x4a')]){_0x1a6399[_0x1176('0x3e')][_0x1176('0x4b')]({'id':0x0,'priority':_0x1a6399[_0x1176('0x3e')][_0x1176('0x43')]+0x1,'app':_0x1176('0x4c'),'appdata':'unmanaged','interval':_0x1176('0x4d')});}_0x2f859c['created']=!![];}else{_0x2f859c['created']=![];}_0x1a6399['interaction']=_0x2f859c;return db[_0x1176('0x4e')][_0x1176('0x47')]({'body':_0x3dfc79[_0x1176('0x25')][_0x1176('0x25')],'FaxAccountId':_0x3dfc79[_0x1176('0x37')]['id'],'FaxInteractionId':_0xb13426['id'],'direction':'in','ContactId':_0xb13426[_0x1176('0x4f')],'AttachmentId':_0x3dfc79[_0x1176('0x25')]['AttachmentId']});})['then'](function(_0x2c9e8d){_0x1a6399['message']=_0x2c9e8d;if(_0x1a6399[_0x1176('0x50')][_0x1176('0x51')]){return db[_0x1176('0x52')][_0x1176('0x36')]({'attributes':['id','name'],'where':{'id':_0x1a6399[_0x1176('0x50')][_0x1176('0x51')]}})[_0x1176('0x10')](function(_0x51244b){if(_0x51244b){_0x1a6399[_0x1176('0x3e')][_0x1176('0x53')]({'id':0x0,'priority':0x0,'app':_0x1176('0x54'),'appdata':_0x51244b[_0x1176('0x55')]+','+(_0x1a6399['account'][_0x1176('0x56')]||0xa),'interval':_0x1176('0x4d')});}return respondWithRpcPromise('Start',_0x1176('0x57'),_0x1a6399);});}return respondWithRpcPromise(_0x1176('0x58'),_0x1176('0x57'),_0x1a6399);})['then'](function(_0x561710){_0x1ddca8(_0x561710);})[_0x1176('0x1a')](function(_0x1de97a){_0x2795c6(_0x38a230['error'](0x1f4,_0x1de97a[_0x1176('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 74bef55..10a0ae9 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 _0x1cbd=['save','remove','emit','removeListener','register','length','faxAccount:','./faxAccount.events'];(function(_0x55adfa,_0x493df8){var _0x2bf7a6=function(_0x12e42e){while(--_0x12e42e){_0x55adfa['push'](_0x55adfa['shift']());}};_0x2bf7a6(++_0x493df8);}(_0x1cbd,0x167));var _0xd1cb=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x1cbd[_0x11ce46];return _0x368a1e;};'use strict';var FaxAccountEvents=require(_0xd1cb('0x0'));var events=[_0xd1cb('0x1'),_0xd1cb('0x2'),'update'];function createListener(_0x381629,_0x58e815){return function(_0x322a00){_0x58e815[_0xd1cb('0x3')](_0x381629,_0x322a00);};}function removeListener(_0x2a616f,_0x1313c2){return function(){FaxAccountEvents[_0xd1cb('0x4')](_0x2a616f,_0x1313c2);};}exports[_0xd1cb('0x5')]=function(_0x3ba21b){for(var _0x4bfaee=0x0,_0x321da4=events[_0xd1cb('0x6')];_0x4bfaee<_0x321da4;_0x4bfaee++){var _0x329b8e=events[_0x4bfaee];var _0x22e1c7=createListener(_0xd1cb('0x7')+_0x329b8e,_0x3ba21b);FaxAccountEvents['on'](_0x329b8e,_0x22e1c7);}}; \ No newline at end of file +var _0xc82b=['register','length','faxAccount:','./faxAccount.events','update','emit','removeListener'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xc82b,0x1f4));var _0xbc82=function(_0xa9d635,_0x20eab5){_0xa9d635=_0xa9d635-0x0;var _0x2eff28=_0xc82b[_0xa9d635];return _0x2eff28;};'use strict';var FaxAccountEvents=require(_0xbc82('0x0'));var events=['save','remove',_0xbc82('0x1')];function createListener(_0x4ce32d,_0x4e0ff2){return function(_0x1bbb9b){_0x4e0ff2[_0xbc82('0x2')](_0x4ce32d,_0x1bbb9b);};}function removeListener(_0x36a143,_0x503a76){return function(){FaxAccountEvents[_0xbc82('0x3')](_0x36a143,_0x503a76);};}exports[_0xbc82('0x4')]=function(_0x3ed75c){for(var _0x24ad46=0x0,_0x329b62=events[_0xbc82('0x5')];_0x24ad46<_0x329b62;_0x24ad46++){var _0x1db12f=events[_0x24ad46];var _0x53b173=createListener(_0xbc82('0x6')+_0x1db12f,_0x3ed75c);FaxAccountEvents['on'](_0x1db12f,_0x53b173);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 9432c88..1c809a4 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0xc3b861,_0x4049eb){var _0x241fb6=function(_0x427740){while(--_0x427740){_0xc3b861['push'](_0xc3b861['shift']());}};_0x241fb6(++_0x4049eb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0xbe5401,_0x2433d9){var _0x4cff04=function(_0x32058f){while(--_0x32058f){_0xbe5401['push'](_0xbe5401['shift']());}};_0x4cff04(++_0x2433d9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index b602389..4699e66 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 _0xc879=['STRING','noop','TEXT','*,*,*,*','sequelize','INTEGER'];(function(_0x3b2b0b,_0x39a465){var _0x2ada99=function(_0x1be941){while(--_0x1be941){_0x3b2b0b['push'](_0x3b2b0b['shift']());}};_0x2ada99(++_0x39a465);}(_0xc879,0x9a));var _0x9c87=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xc879[_0x49b207];return _0x2dc8fa;};'use strict';var Sequelize=require(_0x9c87('0x0'));module['exports']={'priority':{'type':Sequelize[_0x9c87('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x9c87('0x2')],'allowNull':![],'defaultValue':_0x9c87('0x3')},'appdata':{'type':Sequelize[_0x9c87('0x4')]()},'description':{'type':Sequelize[_0x9c87('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9c87('0x5')}}; \ No newline at end of file +var _0xd79d=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x195b77,_0x2ba1e9){var _0x4fa195=function(_0x32c185){while(--_0x32c185){_0x195b77['push'](_0x195b77['shift']());}};_0x4fa195(++_0x2ba1e9);}(_0xd79d,0x110));var _0xdd79=function(_0x12e898,_0x1ef073){_0x12e898=_0x12e898-0x0;var _0x190631=_0xd79d[_0x12e898];return _0x190631;};'use strict';var Sequelize=require(_0xdd79('0x0'));module[_0xdd79('0x1')]={'priority':{'type':Sequelize[_0xdd79('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xdd79('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xdd79('0x4')]()},'description':{'type':Sequelize[_0xdd79('0x3')]},'interval':{'type':Sequelize[_0xdd79('0x3')],'defaultValue':_0xdd79('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 410d7c8..d6d8982 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 _0x922b=['set','Content-Range','apply','reject','update','then','error','stack','name','map','FaxApplication','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit'];(function(_0xa9e76e,_0x572d0c){var _0x53630d=function(_0x3c1871){while(--_0x3c1871){_0xa9e76e['push'](_0xa9e76e['shift']());}};_0x53630d(++_0x572d0c);}(_0x922b,0x7a));var _0xb922=function(_0x27411a,_0x8f6f0f){_0x27411a=_0x27411a-0x0;var _0x4edda2=_0x922b[_0x27411a];return _0x4edda2;};'use strict';var emlformat=require(_0xb922('0x0'));var rimraf=require(_0xb922('0x1'));var zipdir=require(_0xb922('0x2'));var jsonpatch=require(_0xb922('0x3'));var rp=require('request-promise');var moment=require(_0xb922('0x4'));var BPromise=require(_0xb922('0x5'));var Mustache=require(_0xb922('0x6'));var util=require(_0xb922('0x7'));var path=require(_0xb922('0x8'));var sox=require(_0xb922('0x9'));var csv=require('to-csv');var ejs=require(_0xb922('0xa'));var fs=require('fs');var fs_extra=require(_0xb922('0xb'));var _=require('lodash');var squel=require(_0xb922('0xc'));var crypto=require(_0xb922('0xd'));var jsforce=require(_0xb922('0xe'));var deskjs=require(_0xb922('0xf'));var toCsv=require(_0xb922('0x10'));var querystring=require(_0xb922('0x11'));var Papa=require('papaparse');var Redis=require(_0xb922('0x12'));var authService=require(_0xb922('0x13'));var qs=require(_0xb922('0x14'));var as=require(_0xb922('0x15'));var hardwareService=require(_0xb922('0x16'));var logger=require(_0xb922('0x17'))(_0xb922('0x18'));var utils=require(_0xb922('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb922('0x1a'))['db'];function respondWithStatusCode(_0x176355,_0x4c06ea){_0x4c06ea=_0x4c06ea||0xcc;return function(_0x27a41e){if(_0x27a41e){return _0x176355[_0xb922('0x1b')](_0x4c06ea);}return _0x176355[_0xb922('0x1c')](_0x4c06ea)[_0xb922('0x1d')]();};}function respondWithResult(_0x3636cc,_0x4d4053){_0x4d4053=_0x4d4053||0xc8;return function(_0xc413d6){if(_0xc413d6){return _0x3636cc[_0xb922('0x1c')](_0x4d4053)['json'](_0xc413d6);}};}function respondWithFilteredResult(_0x21697a,_0x3af1a1){return function(_0x3cee6c){if(_0x3cee6c){var _0x38432e=typeof _0x3af1a1[_0xb922('0x1e')]===_0xb922('0x1f')&&typeof _0x3af1a1['limit']===_0xb922('0x1f');var _0x30624e=_0x3cee6c[_0xb922('0x20')];var _0x101139=_0x38432e?0x0:_0x3af1a1[_0xb922('0x1e')];var _0x373309=_0x38432e?_0x3cee6c['count']:_0x3af1a1[_0xb922('0x1e')]+_0x3af1a1[_0xb922('0x21')];var _0x3c8672;if(_0x373309>=_0x30624e){_0x373309=_0x30624e;_0x3c8672=0xc8;}else{_0x3c8672=0xce;}_0x21697a[_0xb922('0x1c')](_0x3c8672);return _0x21697a[_0xb922('0x22')](_0xb922('0x23'),_0x101139+'-'+_0x373309+'/'+_0x30624e)['json'](_0x3cee6c);}return null;};}function patchUpdates(_0x561803){return function(_0xe6a6cb){try{jsonpatch[_0xb922('0x24')](_0xe6a6cb,_0x561803,!![]);}catch(_0x1a79ad){return BPromise[_0xb922('0x25')](_0x1a79ad);}return _0xe6a6cb['save']();};}function saveUpdates(_0x29b1a6,_0xaf3e7f){return function(_0x48df0b){if(_0x48df0b){return _0x48df0b[_0xb922('0x26')](_0x29b1a6)['then'](function(_0x229175){return _0x229175;});}return null;};}function removeEntity(_0x42a42c,_0x458ea1){return function(_0x11029c){if(_0x11029c){return _0x11029c['destroy']()[_0xb922('0x27')](function(){_0x42a42c[_0xb922('0x1c')](0xcc)[_0xb922('0x1d')]();});}};}function handleEntityNotFound(_0x47ec07,_0x4665a9){return function(_0x33fe37){if(!_0x33fe37){_0x47ec07[_0xb922('0x1b')](0x194);}return _0x33fe37;};}function handleError(_0x2b180a,_0x251c2d){_0x251c2d=_0x251c2d||0x1f4;return function(_0x16c1db){logger[_0xb922('0x28')](_0x16c1db[_0xb922('0x29')]);if(_0x16c1db['name']){delete _0x16c1db[_0xb922('0x2a')];}_0x2b180a[_0xb922('0x1c')](_0x251c2d)['send'](_0x16c1db);};}exports['index']=function(_0x99e180,_0x22368b){var _0x1940d0={},_0x1fe9ed={},_0xb1ba6f={'count':0x0,'rows':[]};var _0x4d176a=_[_0xb922('0x2b')](db[_0xb922('0x2c')][_0xb922('0x2d')],function(_0x4ddce0){return{'name':_0x4ddce0[_0xb922('0x2e')],'type':_0x4ddce0['type'][_0xb922('0x2f')]};});_0x1fe9ed['model']=_[_0xb922('0x2b')](_0x4d176a,_0xb922('0x2a'));_0x1fe9ed[_0xb922('0x30')]=_[_0xb922('0x31')](_0x99e180[_0xb922('0x30')]);_0x1fe9ed[_0xb922('0x32')]=_[_0xb922('0x33')](_0x1fe9ed[_0xb922('0x34')],_0x1fe9ed['query']);_0x1940d0[_0xb922('0x35')]=_[_0xb922('0x33')](_0x1fe9ed[_0xb922('0x34')],qs[_0xb922('0x36')](_0x99e180[_0xb922('0x30')][_0xb922('0x36')]));_0x1940d0[_0xb922('0x35')]=_0x1940d0[_0xb922('0x35')][_0xb922('0x37')]?_0x1940d0[_0xb922('0x35')]:_0x1fe9ed[_0xb922('0x34')];if(!_0x99e180['query'][_0xb922('0x38')](_0xb922('0x39'))){_0x1940d0['limit']=qs['limit'](_0x99e180[_0xb922('0x30')][_0xb922('0x21')]);_0x1940d0[_0xb922('0x1e')]=qs[_0xb922('0x1e')](_0x99e180[_0xb922('0x30')]['offset']);}_0x1940d0[_0xb922('0x3a')]=qs[_0xb922('0x3b')](_0x99e180[_0xb922('0x30')][_0xb922('0x3b')]);_0x1940d0[_0xb922('0x3c')]=qs[_0xb922('0x32')](_[_0xb922('0x3d')](_0x99e180[_0xb922('0x30')],_0x1fe9ed[_0xb922('0x32')]),_0x4d176a);if(_0x99e180[_0xb922('0x30')][_0xb922('0x3e')]){_0x1940d0[_0xb922('0x3c')]=_[_0xb922('0x3f')](_0x1940d0[_0xb922('0x3c')],{'$or':_['map'](_0x4d176a,function(_0x13a1f1){if(_0x13a1f1[_0xb922('0x40')]!==_0xb922('0x41')){var _0x2adc0f={};_0x2adc0f[_0x13a1f1['name']]={'$like':'%'+_0x99e180[_0xb922('0x30')][_0xb922('0x3e')]+'%'};return _0x2adc0f;}})});}_0x1940d0=_[_0xb922('0x3f')]({},_0x1940d0,_0x99e180[_0xb922('0x42')]);var _0x2449b1={'where':_0x1940d0[_0xb922('0x3c')]};return db['FaxApplication']['count'](_0x2449b1)['then'](function(_0x25cf8b){_0xb1ba6f[_0xb922('0x20')]=_0x25cf8b;if(_0x99e180[_0xb922('0x30')]['includeAll']){_0x1940d0[_0xb922('0x43')]=[{'all':!![]}];}return db[_0xb922('0x2c')][_0xb922('0x44')](_0x1940d0);})[_0xb922('0x27')](function(_0x1b7ca9){_0xb1ba6f[_0xb922('0x45')]=_0x1b7ca9;return _0xb1ba6f;})[_0xb922('0x27')](respondWithFilteredResult(_0x22368b,_0x1940d0))[_0xb922('0x46')](handleError(_0x22368b,null));};exports[_0xb922('0x47')]=function(_0x272ae5,_0x36b415){var _0x2af551={'raw':!![],'where':{'id':_0x272ae5[_0xb922('0x48')]['id']}},_0x3f9524={};_0x3f9524[_0xb922('0x34')]=_[_0xb922('0x31')](db[_0xb922('0x2c')][_0xb922('0x2d')]);_0x3f9524[_0xb922('0x30')]=_[_0xb922('0x31')](_0x272ae5[_0xb922('0x30')]);_0x3f9524[_0xb922('0x32')]=_[_0xb922('0x33')](_0x3f9524[_0xb922('0x34')],_0x3f9524['query']);_0x2af551['attributes']=_[_0xb922('0x33')](_0x3f9524[_0xb922('0x34')],qs[_0xb922('0x36')](_0x272ae5[_0xb922('0x30')][_0xb922('0x36')]));_0x2af551[_0xb922('0x35')]=_0x2af551[_0xb922('0x35')][_0xb922('0x37')]?_0x2af551[_0xb922('0x35')]:_0x3f9524[_0xb922('0x34')];if(_0x272ae5[_0xb922('0x30')][_0xb922('0x49')]){_0x2af551['include']=[{'all':!![]}];}_0x2af551=_[_0xb922('0x3f')]({},_0x2af551,_0x272ae5['options']);return db['FaxApplication'][_0xb922('0x4a')](_0x2af551)[_0xb922('0x27')](handleEntityNotFound(_0x36b415,null))[_0xb922('0x27')](respondWithResult(_0x36b415,null))[_0xb922('0x46')](handleError(_0x36b415,null));};exports[_0xb922('0x4b')]=function(_0x1a786f,_0x5bde48){return db[_0xb922('0x2c')][_0xb922('0x4b')](_0x1a786f[_0xb922('0x4c')],{})[_0xb922('0x27')](respondWithResult(_0x5bde48,0xc9))[_0xb922('0x46')](handleError(_0x5bde48,null));};exports[_0xb922('0x26')]=function(_0x5d4ba3,_0x5cb547){if(_0x5d4ba3['body']['id']){delete _0x5d4ba3[_0xb922('0x4c')]['id'];}return db['FaxApplication'][_0xb922('0x4a')]({'where':{'id':_0x5d4ba3[_0xb922('0x48')]['id']}})[_0xb922('0x27')](handleEntityNotFound(_0x5cb547,null))['then'](saveUpdates(_0x5d4ba3[_0xb922('0x4c')],null))[_0xb922('0x27')](respondWithResult(_0x5cb547,null))['catch'](handleError(_0x5cb547,null));};exports[_0xb922('0x4d')]=function(_0x835270,_0x101c08){return db['FaxApplication']['find']({'where':{'id':_0x835270[_0xb922('0x48')]['id']}})[_0xb922('0x27')](handleEntityNotFound(_0x101c08,null))[_0xb922('0x27')](removeEntity(_0x101c08,null))['catch'](handleError(_0x101c08,null));}; \ No newline at end of file +var _0x6bca=['create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','sendStatus','error','name','index','map','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','filter','options','FaxApplication','includeAll','include','findAll','show','params','rawAttributes','find','catch'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x6bca,0x11a));var _0xa6bc=function(_0x152472,_0x5b71f0){_0x152472=_0x152472-0x0;var _0x299755=_0x6bca[_0x152472];return _0x299755;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa6bc('0x0'));var zipdir=require(_0xa6bc('0x1'));var jsonpatch=require(_0xa6bc('0x2'));var rp=require(_0xa6bc('0x3'));var moment=require('moment');var BPromise=require(_0xa6bc('0x4'));var Mustache=require('mustache');var util=require(_0xa6bc('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xa6bc('0x6'));var ejs=require(_0xa6bc('0x7'));var fs=require('fs');var fs_extra=require(_0xa6bc('0x8'));var _=require(_0xa6bc('0x9'));var squel=require(_0xa6bc('0xa'));var crypto=require(_0xa6bc('0xb'));var jsforce=require(_0xa6bc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa6bc('0x6'));var querystring=require(_0xa6bc('0xd'));var Papa=require(_0xa6bc('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa6bc('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa6bc('0x10'))(_0xa6bc('0x11'));var utils=require(_0xa6bc('0x12'));var config=require(_0xa6bc('0x13'));var licenseUtil=require(_0xa6bc('0x14'));var db=require(_0xa6bc('0x15'))['db'];function respondWithStatusCode(_0x560f51,_0x2ddec9){_0x2ddec9=_0x2ddec9||0xcc;return function(_0x1172f5){if(_0x1172f5){return _0x560f51['sendStatus'](_0x2ddec9);}return _0x560f51[_0xa6bc('0x16')](_0x2ddec9)[_0xa6bc('0x17')]();};}function respondWithResult(_0xfcc1d1,_0x5cfcdd){_0x5cfcdd=_0x5cfcdd||0xc8;return function(_0x2945e4){if(_0x2945e4){return _0xfcc1d1[_0xa6bc('0x16')](_0x5cfcdd)[_0xa6bc('0x18')](_0x2945e4);}};}function respondWithFilteredResult(_0xa72648,_0x45efee){return function(_0xd73b50){if(_0xd73b50){var _0x379926=typeof _0x45efee[_0xa6bc('0x19')]===_0xa6bc('0x1a')&&typeof _0x45efee[_0xa6bc('0x1b')]===_0xa6bc('0x1a');var _0x6b3098=_0xd73b50[_0xa6bc('0x1c')];var _0xd1aa4c=_0x379926?0x0:_0x45efee['offset'];var _0x4700e9=_0x379926?_0xd73b50[_0xa6bc('0x1c')]:_0x45efee[_0xa6bc('0x19')]+_0x45efee[_0xa6bc('0x1b')];var _0x1c7bbc;if(_0x4700e9>=_0x6b3098){_0x4700e9=_0x6b3098;_0x1c7bbc=0xc8;}else{_0x1c7bbc=0xce;}_0xa72648['status'](_0x1c7bbc);return _0xa72648[_0xa6bc('0x1d')]('Content-Range',_0xd1aa4c+'-'+_0x4700e9+'/'+_0x6b3098)[_0xa6bc('0x18')](_0xd73b50);}return null;};}function patchUpdates(_0x5ae71e){return function(_0x26c417){try{jsonpatch['apply'](_0x26c417,_0x5ae71e,!![]);}catch(_0x98b49a){return BPromise[_0xa6bc('0x1e')](_0x98b49a);}return _0x26c417[_0xa6bc('0x1f')]();};}function saveUpdates(_0x3b7077,_0x12319a){return function(_0x2b2713){if(_0x2b2713){return _0x2b2713[_0xa6bc('0x20')](_0x3b7077)['then'](function(_0x52e29b){return _0x52e29b;});}return null;};}function removeEntity(_0x38aa1c,_0x4e01d9){return function(_0x4d0801){if(_0x4d0801){return _0x4d0801[_0xa6bc('0x21')]()[_0xa6bc('0x22')](function(){_0x38aa1c[_0xa6bc('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x313aca,_0x47d971){return function(_0x225581){if(!_0x225581){_0x313aca[_0xa6bc('0x23')](0x194);}return _0x225581;};}function handleError(_0x5b7d0a,_0x1aa3d7){_0x1aa3d7=_0x1aa3d7||0x1f4;return function(_0x3cf6b8){logger[_0xa6bc('0x24')](_0x3cf6b8['stack']);if(_0x3cf6b8[_0xa6bc('0x25')]){delete _0x3cf6b8[_0xa6bc('0x25')];}_0x5b7d0a['status'](_0x1aa3d7)['send'](_0x3cf6b8);};}exports[_0xa6bc('0x26')]=function(_0x5b0679,_0x5ba95a){var _0x16e210={},_0x50be8f={},_0xe636a={'count':0x0,'rows':[]};var _0x4d28f5=_[_0xa6bc('0x27')](db['FaxApplication']['rawAttributes'],function(_0x11cd66){return{'name':_0x11cd66[_0xa6bc('0x28')],'type':_0x11cd66['type'][_0xa6bc('0x29')]};});_0x50be8f['model']=_[_0xa6bc('0x27')](_0x4d28f5,_0xa6bc('0x25'));_0x50be8f[_0xa6bc('0x2a')]=_[_0xa6bc('0x2b')](_0x5b0679['query']);_0x50be8f[_0xa6bc('0x2c')]=_['intersection'](_0x50be8f[_0xa6bc('0x2d')],_0x50be8f[_0xa6bc('0x2a')]);_0x16e210[_0xa6bc('0x2e')]=_[_0xa6bc('0x2f')](_0x50be8f[_0xa6bc('0x2d')],qs['fields'](_0x5b0679[_0xa6bc('0x2a')][_0xa6bc('0x30')]));_0x16e210[_0xa6bc('0x2e')]=_0x16e210[_0xa6bc('0x2e')][_0xa6bc('0x31')]?_0x16e210['attributes']:_0x50be8f[_0xa6bc('0x2d')];if(!_0x5b0679[_0xa6bc('0x2a')][_0xa6bc('0x32')](_0xa6bc('0x33'))){_0x16e210[_0xa6bc('0x1b')]=qs[_0xa6bc('0x1b')](_0x5b0679[_0xa6bc('0x2a')][_0xa6bc('0x1b')]);_0x16e210[_0xa6bc('0x19')]=qs['offset'](_0x5b0679['query']['offset']);}_0x16e210['order']=qs[_0xa6bc('0x34')](_0x5b0679[_0xa6bc('0x2a')]['sort']);_0x16e210[_0xa6bc('0x35')]=qs[_0xa6bc('0x2c')](_['pick'](_0x5b0679[_0xa6bc('0x2a')],_0x50be8f[_0xa6bc('0x2c')]),_0x4d28f5);if(_0x5b0679[_0xa6bc('0x2a')]['filter']){_0x16e210[_0xa6bc('0x35')]=_[_0xa6bc('0x36')](_0x16e210[_0xa6bc('0x35')],{'$or':_[_0xa6bc('0x27')](_0x4d28f5,function(_0x400bda){if(_0x400bda[_0xa6bc('0x37')]!==_0xa6bc('0x38')){var _0x13942f={};_0x13942f[_0x400bda['name']]={'$like':'%'+_0x5b0679[_0xa6bc('0x2a')][_0xa6bc('0x39')]+'%'};return _0x13942f;}})});}_0x16e210=_[_0xa6bc('0x36')]({},_0x16e210,_0x5b0679[_0xa6bc('0x3a')]);var _0x3434ed={'where':_0x16e210[_0xa6bc('0x35')]};return db[_0xa6bc('0x3b')][_0xa6bc('0x1c')](_0x3434ed)['then'](function(_0x264c0b){_0xe636a['count']=_0x264c0b;if(_0x5b0679[_0xa6bc('0x2a')][_0xa6bc('0x3c')]){_0x16e210[_0xa6bc('0x3d')]=[{'all':!![]}];}return db[_0xa6bc('0x3b')][_0xa6bc('0x3e')](_0x16e210);})[_0xa6bc('0x22')](function(_0x16af7a){_0xe636a['rows']=_0x16af7a;return _0xe636a;})[_0xa6bc('0x22')](respondWithFilteredResult(_0x5ba95a,_0x16e210))['catch'](handleError(_0x5ba95a,null));};exports[_0xa6bc('0x3f')]=function(_0x26e46d,_0x2caf2b){var _0x48d6ce={'raw':!![],'where':{'id':_0x26e46d[_0xa6bc('0x40')]['id']}},_0x592cfa={};_0x592cfa['model']=_['keys'](db[_0xa6bc('0x3b')][_0xa6bc('0x41')]);_0x592cfa[_0xa6bc('0x2a')]=_[_0xa6bc('0x2b')](_0x26e46d[_0xa6bc('0x2a')]);_0x592cfa[_0xa6bc('0x2c')]=_[_0xa6bc('0x2f')](_0x592cfa[_0xa6bc('0x2d')],_0x592cfa[_0xa6bc('0x2a')]);_0x48d6ce['attributes']=_[_0xa6bc('0x2f')](_0x592cfa[_0xa6bc('0x2d')],qs[_0xa6bc('0x30')](_0x26e46d[_0xa6bc('0x2a')][_0xa6bc('0x30')]));_0x48d6ce['attributes']=_0x48d6ce[_0xa6bc('0x2e')]['length']?_0x48d6ce[_0xa6bc('0x2e')]:_0x592cfa[_0xa6bc('0x2d')];if(_0x26e46d[_0xa6bc('0x2a')]['includeAll']){_0x48d6ce[_0xa6bc('0x3d')]=[{'all':!![]}];}_0x48d6ce=_[_0xa6bc('0x36')]({},_0x48d6ce,_0x26e46d[_0xa6bc('0x3a')]);return db['FaxApplication'][_0xa6bc('0x42')](_0x48d6ce)[_0xa6bc('0x22')](handleEntityNotFound(_0x2caf2b,null))['then'](respondWithResult(_0x2caf2b,null))[_0xa6bc('0x43')](handleError(_0x2caf2b,null));};exports['create']=function(_0xd5d05,_0x3a674a){return db[_0xa6bc('0x3b')][_0xa6bc('0x44')](_0xd5d05[_0xa6bc('0x45')],{})[_0xa6bc('0x22')](respondWithResult(_0x3a674a,0xc9))[_0xa6bc('0x43')](handleError(_0x3a674a,null));};exports['update']=function(_0x2eef4e,_0x10b470){if(_0x2eef4e['body']['id']){delete _0x2eef4e[_0xa6bc('0x45')]['id'];}return db[_0xa6bc('0x3b')][_0xa6bc('0x42')]({'where':{'id':_0x2eef4e['params']['id']}})['then'](handleEntityNotFound(_0x10b470,null))[_0xa6bc('0x22')](saveUpdates(_0x2eef4e[_0xa6bc('0x45')],null))[_0xa6bc('0x22')](respondWithResult(_0x10b470,null))[_0xa6bc('0x43')](handleError(_0x10b470,null));};exports[_0xa6bc('0x21')]=function(_0xb5c2ad,_0x3d4b2b){return db[_0xa6bc('0x3b')][_0xa6bc('0x42')]({'where':{'id':_0xb5c2ad[_0xa6bc('0x40')]['id']}})[_0xa6bc('0x22')](handleEntityNotFound(_0x3d4b2b,null))[_0xa6bc('0x22')](removeEntity(_0x3d4b2b,null))[_0xa6bc('0x43')](handleError(_0x3d4b2b,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 04cdac0..7d1ba71 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 _0x779a=['utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./faxApplication.attributes','exports','define','fax_applications'];(function(_0x359cc2,_0x2f162c){var _0x40a7d7=function(_0x17e3d7){while(--_0x17e3d7){_0x359cc2['push'](_0x359cc2['shift']());}};_0x40a7d7(++_0x2f162c);}(_0x779a,0x105));var _0xa779=function(_0x4a2961,_0x961860){_0x4a2961=_0x4a2961-0x0;var _0x5a13a7=_0x779a[_0x4a2961];return _0x5a13a7;};'use strict';var _=require(_0xa779('0x0'));var util=require(_0xa779('0x1'));var logger=require(_0xa779('0x2'))('api');var moment=require(_0xa779('0x3'));var BPromise=require(_0xa779('0x4'));var rp=require(_0xa779('0x5'));var fs=require('fs');var path=require(_0xa779('0x6'));var rimraf=require(_0xa779('0x7'));var config=require('../../config/environment');var attributes=require(_0xa779('0x8'));module[_0xa779('0x9')]=function(_0x1efd0d,_0x52fd1d){return _0x1efd0d[_0xa779('0xa')]('FaxApplication',attributes,{'tableName':_0xa779('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xa779('0xc')});}; \ No newline at end of file +var _0xd6c5=['./faxApplication.attributes','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd6c5,0x164));var _0x5d6c=function(_0x16a731,_0x217dbd){_0x16a731=_0x16a731-0x0;var _0x58cb23=_0xd6c5[_0x16a731];return _0x58cb23;};'use strict';var _=require('lodash');var util=require(_0x5d6c('0x0'));var logger=require(_0x5d6c('0x1'))(_0x5d6c('0x2'));var moment=require(_0x5d6c('0x3'));var BPromise=require(_0x5d6c('0x4'));var rp=require(_0x5d6c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5d6c('0x6'));var config=require(_0x5d6c('0x7'));var attributes=require(_0x5d6c('0x8'));module['exports']=function(_0x9d948d,_0x363b83){return _0x9d948d['define'](_0x5d6c('0x9'),attributes,{'tableName':_0x5d6c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5d6c('0xb'),'collate':_0x5d6c('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 448b246..283622c 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 _0x29f9=['UpdateFaxApplication','FaxApplication','raw','options','where','attributes','stringify','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','code','error','message','catch'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x29f9,0x1e2));var _0x929f=function(_0x32cb75,_0x272757){_0x32cb75=_0x32cb75-0x0;var _0x10bf9b=_0x29f9[_0x32cb75];return _0x10bf9b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x929f('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x929f('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x929f('0x2'));var logger=require(_0x929f('0x3'))(_0x929f('0x4'));var config=require(_0x929f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x929f('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0xcd0115,_0x4b7d13,_0x3f7a7f){return new BPromise(function(_0xf613f5,_0x1ec7ea){return client[_0x929f('0x7')](_0xcd0115,_0x3f7a7f)[_0x929f('0x8')](function(_0x26baeb){logger[_0x929f('0x9')](_0x929f('0xa'),_0x4b7d13,_0x929f('0xb'));logger[_0x929f('0xc')](_0x929f('0xd'),_0x4b7d13,_0x929f('0xb'),JSON['stringify'](_0x26baeb));if(_0x26baeb['error']){if(_0x26baeb['error'][_0x929f('0xe')]===0x1f4){logger[_0x929f('0xf')]('FaxApplication,\x20%s,\x20%s',_0x4b7d13,_0x26baeb[_0x929f('0xf')][_0x929f('0x10')]);return _0x1ec7ea(_0x26baeb[_0x929f('0xf')]['message']);}logger[_0x929f('0xf')](_0x929f('0xa'),_0x4b7d13,_0x26baeb[_0x929f('0xf')][_0x929f('0x10')]);return _0xf613f5(_0x26baeb[_0x929f('0xf')][_0x929f('0x10')]);}else{logger[_0x929f('0x9')]('FaxApplication,\x20%s,\x20%s',_0x4b7d13,'request\x20sent');_0xf613f5(_0x26baeb['result'][_0x929f('0x10')]);}})[_0x929f('0x11')](function(_0x128549){logger[_0x929f('0xf')](_0x929f('0xa'),_0x4b7d13,_0x128549);_0x1ec7ea(_0x128549);});});}exports[_0x929f('0x12')]=function(_0x50db66){var _0xa65c0b=this;return new Promise(function(_0x15dbe3,_0xe12df0){return db[_0x929f('0x13')]['update'](_0x50db66['body'],{'raw':_0x50db66['options']?_0x50db66['options'][_0x929f('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50db66[_0x929f('0x15')]?_0x50db66[_0x929f('0x15')][_0x929f('0x16')]||null:null,'attributes':_0x50db66[_0x929f('0x15')]?_0x50db66[_0x929f('0x15')][_0x929f('0x17')]||null:null,'limit':_0x50db66['options']?_0x50db66['options']['limit']||null:null})['then'](function(_0x4e2166){logger[_0x929f('0x9')](_0x929f('0x12'),_0x50db66);logger['debug']('UpdateFaxApplication',_0x50db66,JSON[_0x929f('0x18')](_0x4e2166));_0x15dbe3(_0x4e2166);})['catch'](function(_0x4f3381){logger[_0x929f('0xf')](_0x929f('0x12'),_0x4f3381[_0x929f('0x10')],_0x50db66);_0xe12df0(_0xa65c0b[_0x929f('0xf')](0x1f4,_0x4f3381[_0x929f('0x10')]));});});}; \ No newline at end of file +var _0x3aaf=['update','options','where','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','then','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','UpdateFaxApplication','FaxApplication'];(function(_0x18f32c,_0x4ab1e9){var _0x49033b=function(_0x2d2bc3){while(--_0x2d2bc3){_0x18f32c['push'](_0x18f32c['shift']());}};_0x49033b(++_0x4ab1e9);}(_0x3aaf,0x162));var _0xf3aa=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x3aaf[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require(_0xf3aa('0x0'));var util=require(_0xf3aa('0x1'));var moment=require(_0xf3aa('0x2'));var BPromise=require(_0xf3aa('0x3'));var rs=require(_0xf3aa('0x4'));var fs=require('fs');var Redis=require(_0xf3aa('0x5'));var db=require(_0xf3aa('0x6'))['db'];var utils=require(_0xf3aa('0x7'));var logger=require(_0xf3aa('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf3aa('0x9')][_0xf3aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x133b01,_0x235c29,_0x5759f5){return new BPromise(function(_0x47b60d,_0x1a0200){return client['request'](_0x133b01,_0x5759f5)[_0xf3aa('0xb')](function(_0xa99096){logger[_0xf3aa('0xc')](_0xf3aa('0xd'),_0x235c29,'request\x20sent');logger[_0xf3aa('0xe')](_0xf3aa('0xf'),_0x235c29,_0xf3aa('0x10'),JSON['stringify'](_0xa99096));if(_0xa99096['error']){if(_0xa99096[_0xf3aa('0x11')]['code']===0x1f4){logger[_0xf3aa('0x11')](_0xf3aa('0xd'),_0x235c29,_0xa99096[_0xf3aa('0x11')]['message']);return _0x1a0200(_0xa99096['error'][_0xf3aa('0x12')]);}logger[_0xf3aa('0x11')]('FaxApplication,\x20%s,\x20%s',_0x235c29,_0xa99096['error'][_0xf3aa('0x12')]);return _0x47b60d(_0xa99096['error'][_0xf3aa('0x12')]);}else{logger['info'](_0xf3aa('0xd'),_0x235c29,_0xf3aa('0x10'));_0x47b60d(_0xa99096[_0xf3aa('0x13')]['message']);}})[_0xf3aa('0x14')](function(_0x16d5c9){logger[_0xf3aa('0x11')]('FaxApplication,\x20%s,\x20%s',_0x235c29,_0x16d5c9);_0x1a0200(_0x16d5c9);});});}exports[_0xf3aa('0x15')]=function(_0x5add43){var _0x5c209f=this;return new Promise(function(_0x11a600,_0x1d1411){return db[_0xf3aa('0x16')][_0xf3aa('0x17')](_0x5add43['body'],{'raw':_0x5add43['options']?_0x5add43['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5add43['options']?_0x5add43[_0xf3aa('0x18')][_0xf3aa('0x19')]||null:null,'attributes':_0x5add43['options']?_0x5add43[_0xf3aa('0x18')][_0xf3aa('0x1a')]||null:null,'limit':_0x5add43[_0xf3aa('0x18')]?_0x5add43[_0xf3aa('0x18')][_0xf3aa('0x1b')]||null:null})['then'](function(_0x23b352){logger[_0xf3aa('0xc')](_0xf3aa('0x15'),_0x5add43);logger['debug'](_0xf3aa('0x15'),_0x5add43,JSON[_0xf3aa('0x1c')](_0x23b352));_0x11a600(_0x23b352);})[_0xf3aa('0x14')](function(_0x4bfe21){logger[_0xf3aa('0x11')](_0xf3aa('0x15'),_0x4bfe21[_0xf3aa('0x12')],_0x5add43);_0x1d1411(_0x5c209f[_0xf3aa('0x11')](0x1f4,_0x4bfe21[_0xf3aa('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index be70038..044029f 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 _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./faxApplication.controller','get'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0xda2d,0x102));var _0xdda2=function(_0x59478e,_0x5d98d6){_0x59478e=_0x59478e-0x0;var _0x3c6ea1=_0xda2d[_0x59478e];return _0x3c6ea1;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0xc')]('/',auth['isAuthenticated'](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xf')]);router[_0xdda2('0x10')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x11')]);module[_0xdda2('0x12')]=router; \ No newline at end of file +var _0x2547=['delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxApplication.controller','get','isAuthenticated','index','/:id','show','update'];(function(_0xa36c4d,_0x12d21c){var _0x405afc=function(_0x283948){while(--_0x283948){_0xa36c4d['push'](_0xa36c4d['shift']());}};_0x405afc(++_0x12d21c);}(_0x2547,0x1cd));var _0x7254=function(_0x3e8058,_0x1a49e5){_0x3e8058=_0x3e8058-0x0;var _0x1028ea=_0x2547[_0x3e8058];return _0x1028ea;};'use strict';var multer=require('multer');var util=require(_0x7254('0x0'));var path=require(_0x7254('0x1'));var timeout=require(_0x7254('0x2'));var express=require(_0x7254('0x3'));var router=express[_0x7254('0x4')]();var fs_extra=require(_0x7254('0x5'));var auth=require(_0x7254('0x6'));var interaction=require(_0x7254('0x7'));var config=require('../../config/environment');var controller=require(_0x7254('0x8'));router[_0x7254('0x9')]('/',auth[_0x7254('0xa')](),controller[_0x7254('0xb')]);router['get'](_0x7254('0xc'),auth[_0x7254('0xa')](),controller[_0x7254('0xd')]);router['post']('/',auth[_0x7254('0xa')](),controller['create']);router['put']('/:id',auth[_0x7254('0xa')](),controller[_0x7254('0xe')]);router[_0x7254('0xf')](_0x7254('0xc'),auth[_0x7254('0xa')](),controller[_0x7254('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index d91f07d..fba8e08 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 _0x6fc0=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x4a8bad,_0x4bfb2f){var _0x30cf32=function(_0x557b3a){while(--_0x557b3a){_0x4a8bad['push'](_0x4a8bad['shift']());}};_0x30cf32(++_0x4bfb2f);}(_0x6fc0,0x180));var _0x06fc=function(_0x43228b,_0x2154ed){_0x43228b=_0x43228b-0x0;var _0x1c03bf=_0x6fc0[_0x43228b];return _0x1c03bf;};'use strict';var Sequelize=require(_0x06fc('0x0'));module[_0x06fc('0x1')]={'closed':{'type':Sequelize[_0x06fc('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x06fc('0x3')]},'disposition':{'type':Sequelize[_0x06fc('0x4')]},'secondDisposition':{'type':Sequelize[_0x06fc('0x4')]},'thirdDisposition':{'type':Sequelize[_0x06fc('0x4')]},'note':{'type':Sequelize[_0x06fc('0x4')]},'read1stAt':{'type':Sequelize[_0x06fc('0x3')]},'fax':{'type':Sequelize[_0x06fc('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x06fc('0x5')]('in',_0x06fc('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x06fc('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x06fc('0x5')]('in',_0x06fc('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x999e=['ENUM','out','exports','DATE','STRING'];(function(_0x4d7bd9,_0x167a31){var _0x64176b=function(_0x361000){while(--_0x361000){_0x4d7bd9['push'](_0x4d7bd9['shift']());}};_0x64176b(++_0x167a31);}(_0x999e,0x9d));var _0xe999=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x999e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xe999('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe999('0x1')]},'disposition':{'type':Sequelize[_0xe999('0x2')]},'secondDisposition':{'type':Sequelize[_0xe999('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe999('0x2')]},'read1stAt':{'type':Sequelize[_0xe999('0x1')]},'fax':{'type':Sequelize[_0xe999('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xe999('0x3')]('in',_0xe999('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xe999('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 8ebfc74..88b1329 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 _0xdaf3=['YYYY-MM-DD\x20HH:mm:ss','FaxMessage','rows','setTags','omit','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','push','Attachment','createdAt','Messages','get','basename','existsSync','createReadStream','resolve','log','zip-dir','moment','bluebird','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','then','error','stack','name','send','index','map','FaxInteraction','rawAttributes','type','key','getOptions','findAll','fax','query','catch','show','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','update','params','addMessage','ids','getMessages','nolimit','order','sort','where','FaxInteractionId','filter','$gte','format'];(function(_0x5b4ebe,_0x28bedf){var _0x4d080c=function(_0x40472f){while(--_0x40472f){_0x5b4ebe['push'](_0x5b4ebe['shift']());}};_0x4d080c(++_0x28bedf);}(_0xdaf3,0xe3));var _0x3daf=function(_0x4bfc12,_0x142724){_0x4bfc12=_0x4bfc12-0x0;var _0x33b8ee=_0xdaf3[_0x4bfc12];return _0x33b8ee;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x3daf('0x0'));var moment=require(_0x3daf('0x1'));var BPromise=require(_0x3daf('0x2'));var util=require('util');var path=require(_0x3daf('0x3'));var fs=require('fs');var _=require(_0x3daf('0x4'));var Redis=require(_0x3daf('0x5'));var interaction=require(_0x3daf('0x6'));var qs=require(_0x3daf('0x7'));var logger=require('../../config/logger')(_0x3daf('0x8'));var config=require('../../config/environment');var db=require(_0x3daf('0x9'))['db'];config['redis']=_[_0x3daf('0xa')](config[_0x3daf('0xb')],{'host':_0x3daf('0xc'),'port':0x18eb});var socket=require(_0x3daf('0xd'))(new Redis(config[_0x3daf('0xb')]));require(_0x3daf('0xe'))[_0x3daf('0xf')](socket);function respondWithStatusCode(_0x5974f3,_0x1f1642){_0x1f1642=_0x1f1642||0xcc;return function(_0x4043a4){if(_0x4043a4){return _0x5974f3[_0x3daf('0x10')](_0x1f1642);}return _0x5974f3['status'](_0x1f1642)[_0x3daf('0x11')]();};}function respondWithResult(_0x38b846,_0x5cf221){_0x5cf221=_0x5cf221||0xc8;return function(_0x24b7bf){if(_0x24b7bf){return _0x38b846[_0x3daf('0x12')](_0x5cf221)[_0x3daf('0x13')](_0x24b7bf);}};}function respondWithFilteredResult(_0x667588,_0x50ffb9){return function(_0x2535a1){if(_0x2535a1){var _0x2a84b7=typeof _0x50ffb9[_0x3daf('0x14')]===_0x3daf('0x15')&&typeof _0x50ffb9['limit']==='undefined';var _0x33032d=_0x2535a1['count'];var _0x5afd31=_0x2a84b7?0x0:_0x50ffb9[_0x3daf('0x14')];var _0x1230d0=_0x2a84b7?_0x2535a1[_0x3daf('0x16')]:_0x50ffb9['offset']+_0x50ffb9[_0x3daf('0x17')];var _0x352f6d;if(_0x1230d0>=_0x33032d){_0x1230d0=_0x33032d;_0x352f6d=0xc8;}else{_0x352f6d=0xce;}_0x667588[_0x3daf('0x12')](_0x352f6d);return _0x667588[_0x3daf('0x18')](_0x3daf('0x19'),_0x5afd31+'-'+_0x1230d0+'/'+_0x33032d)['json'](_0x2535a1);}return null;};}function saveUpdates(_0x4508ca){return function(_0x2812a4){if(_0x2812a4){return _0x2812a4['update'](_0x4508ca)[_0x3daf('0x1a')](function(_0x4d6b8e){return _0x4d6b8e;});}return null;};}function removeEntity(_0x516b78){return function(_0x2e0c11){if(_0x2e0c11){return _0x2e0c11['destroy']()['then'](function(){_0x516b78[_0x3daf('0x12')](0xcc)[_0x3daf('0x11')]();});}};}function handleEntityNotFound(_0x26d172){return function(_0x2f9c56){if(!_0x2f9c56){_0x26d172[_0x3daf('0x10')](0x194);}return _0x2f9c56;};}function handleError(_0xe1fd24,_0x2c7103){_0x2c7103=_0x2c7103||0x1f4;return function(_0x16d9d0){logger[_0x3daf('0x1b')](_0x16d9d0[_0x3daf('0x1c')]);if(_0x16d9d0['name']){delete _0x16d9d0[_0x3daf('0x1d')];}_0xe1fd24[_0x3daf('0x12')](_0x2c7103)[_0x3daf('0x1e')](_0x16d9d0);};}exports[_0x3daf('0x1f')]=function(_0x10fc83,_0x49dcc1){var _0x2ad006={};var _0x391e76=_[_0x3daf('0x20')](db[_0x3daf('0x21')][_0x3daf('0x22')],function(_0x495ad8){return{'name':_0x495ad8['fieldName'],'type':_0x495ad8[_0x3daf('0x23')][_0x3daf('0x24')]};});_0x2ad006=qs[_0x3daf('0x25')](_0x391e76,_0x10fc83);return interaction[_0x3daf('0x26')](_0x3daf('0x27'),_0x10fc83[_0x3daf('0x28')],_0x10fc83['user'],_0x2ad006,_0x391e76)['then'](respondWithFilteredResult(_0x49dcc1,_0x2ad006))[_0x3daf('0x29')](handleError(_0x49dcc1,null));};exports[_0x3daf('0x2a')]=function(_0x441533,_0x2b69d1){var _0x43b059={'raw':![],'where':{'id':_0x441533['params']['id']}},_0x54a77f={};_0x54a77f[_0x3daf('0x2b')]=_['keys'](db['FaxInteraction']['rawAttributes']);_0x54a77f[_0x3daf('0x28')]=_[_0x3daf('0x2c')](_0x441533[_0x3daf('0x28')]);_0x54a77f[_0x3daf('0x2d')]=_[_0x3daf('0x2e')](_0x54a77f[_0x3daf('0x2b')],_0x54a77f['query']);_0x43b059[_0x3daf('0x2f')]=_[_0x3daf('0x2e')](_0x54a77f[_0x3daf('0x2b')],qs[_0x3daf('0x30')](_0x441533[_0x3daf('0x28')][_0x3daf('0x30')]));_0x43b059['attributes']=_0x43b059['attributes'][_0x3daf('0x31')]?_0x43b059[_0x3daf('0x2f')]:_0x54a77f[_0x3daf('0x2b')];if(_0x441533['query'][_0x3daf('0x32')]){_0x43b059[_0x3daf('0x33')]=[{'all':!![]}];}_0x43b059=_[_0x3daf('0x34')]({},_0x43b059,_0x441533[_0x3daf('0x35')]);return db[_0x3daf('0x21')][_0x3daf('0x36')](_0x43b059)[_0x3daf('0x1a')](handleEntityNotFound(_0x2b69d1,null))[_0x3daf('0x1a')](respondWithResult(_0x2b69d1,null))[_0x3daf('0x29')](handleError(_0x2b69d1,null));};exports[_0x3daf('0x37')]=function(_0x42a558,_0x3ff154){return db['FaxInteraction'][_0x3daf('0x37')](_0x42a558[_0x3daf('0x38')],{})['then'](respondWithResult(_0x3ff154,0xc9))[_0x3daf('0x29')](handleError(_0x3ff154,null));};exports[_0x3daf('0x39')]=function(_0x307947,_0x3dcc7f){if(_0x307947[_0x3daf('0x38')]['id']){delete _0x307947[_0x3daf('0x38')]['id'];}return db[_0x3daf('0x21')]['find']({'where':{'id':_0x307947[_0x3daf('0x3a')]['id']}})[_0x3daf('0x1a')](handleEntityNotFound(_0x3dcc7f,null))['then'](saveUpdates(_0x307947[_0x3daf('0x38')],null))[_0x3daf('0x1a')](respondWithResult(_0x3dcc7f,null))[_0x3daf('0x29')](handleError(_0x3dcc7f,null));};exports['destroy']=function(_0x59a9e7,_0x277811){return db['FaxInteraction'][_0x3daf('0x36')]({'where':{'id':_0x59a9e7[_0x3daf('0x3a')]['id']}})[_0x3daf('0x1a')](handleEntityNotFound(_0x277811,null))[_0x3daf('0x1a')](removeEntity(_0x277811,null))[_0x3daf('0x29')](handleError(_0x277811,null));};exports['describe']=function(_0x1a2f5c,_0x5a0f27){return db['FaxInteraction']['describe']()[_0x3daf('0x1a')](respondWithResult(_0x5a0f27,null))[_0x3daf('0x29')](handleError(_0x5a0f27,null));};exports['addMessage']=function(_0x15e689,_0x4f2b28){return db['FaxMessage'][_0x3daf('0x36')]({'where':{'id':_0x15e689[_0x3daf('0x3a')]['id']}})[_0x3daf('0x1a')](handleEntityNotFound(_0x4f2b28,null))[_0x3daf('0x1a')](function(_0x302737){if(_0x302737){return _0x302737[_0x3daf('0x3b')](_0x15e689[_0x3daf('0x38')][_0x3daf('0x3c')],_['omit'](_0x15e689[_0x3daf('0x38')],['ids','id'])||{});}})[_0x3daf('0x1a')](respondWithResult(_0x4f2b28,null))['catch'](handleError(_0x4f2b28,null));};exports[_0x3daf('0x3d')]=function(_0x1c2044,_0x4e9c18){var _0x11c99c={'raw':![],'where':{}};var _0x52c180={};var _0x1da2c7={'count':0x0,'rows':[]};return db[_0x3daf('0x21')]['findOne']({'where':{'id':_0x1c2044[_0x3daf('0x3a')]['id']}})[_0x3daf('0x1a')](handleEntityNotFound(_0x4e9c18,null))[_0x3daf('0x1a')](function(_0x22c93e){if(_0x22c93e){_0x52c180[_0x3daf('0x2b')]=_['keys'](db['FaxMessage'][_0x3daf('0x22')]);_0x52c180['query']=_[_0x3daf('0x2c')](_0x1c2044[_0x3daf('0x28')]);_0x52c180[_0x3daf('0x2d')]=_[_0x3daf('0x2e')](_0x52c180[_0x3daf('0x2b')],_0x52c180['query']);_0x11c99c[_0x3daf('0x2f')]=_[_0x3daf('0x2e')](_0x52c180['model'],qs[_0x3daf('0x30')](_0x1c2044[_0x3daf('0x28')]['fields']));_0x11c99c['attributes']=_0x11c99c['attributes'][_0x3daf('0x31')]?_0x11c99c[_0x3daf('0x2f')]:_0x52c180['model'];if(!_0x1c2044[_0x3daf('0x28')]['hasOwnProperty'](_0x3daf('0x3e'))){_0x11c99c[_0x3daf('0x17')]=qs[_0x3daf('0x17')](_0x1c2044['query']['limit']);_0x11c99c[_0x3daf('0x14')]=qs['offset'](_0x1c2044[_0x3daf('0x28')][_0x3daf('0x14')]);}_0x11c99c[_0x3daf('0x3f')]=qs[_0x3daf('0x40')](_0x1c2044[_0x3daf('0x28')][_0x3daf('0x40')]);_0x11c99c['where']=qs[_0x3daf('0x2d')](_['pick'](_0x1c2044['query'],_0x52c180['filters']));_0x11c99c[_0x3daf('0x41')][_0x3daf('0x42')]=_0x22c93e['id'];if(_0x1c2044[_0x3daf('0x28')]['filter']){_0x11c99c[_0x3daf('0x41')]=_[_0x3daf('0x34')](_0x11c99c[_0x3daf('0x41')],{'$or':_[_0x3daf('0x20')](_0x11c99c[_0x3daf('0x2f')],function(_0x392992){var _0x2e78f2={};_0x2e78f2[_0x392992]={'$like':'%'+_0x1c2044['query'][_0x3daf('0x43')]+'%'};return _0x2e78f2;})});}if(_0x1c2044['query']['$gte']){var _0x508f7d=_0x1c2044[_0x3daf('0x28')][_0x3daf('0x44')]['split'](',');var _0x4b6e94={};_0x4b6e94[_0x508f7d[0x0]]={'$gte':moment(_0x508f7d[0x1])[_0x3daf('0x45')](_0x3daf('0x46'))};_0x11c99c[_0x3daf('0x41')]=_[_0x3daf('0x34')](_0x11c99c[_0x3daf('0x41')],_0x4b6e94);}_0x11c99c=_[_0x3daf('0x34')]({},_0x11c99c,_0x1c2044[_0x3daf('0x35')]);return db[_0x3daf('0x47')][_0x3daf('0x16')]({'where':_0x11c99c['where']})[_0x3daf('0x1a')](function(_0x26a92f){_0x1da2c7[_0x3daf('0x16')]=_0x26a92f;if(_0x1c2044['query'][_0x3daf('0x32')]){_0x11c99c[_0x3daf('0x33')]=[{'all':!![]}];}return db[_0x3daf('0x47')][_0x3daf('0x26')](_0x11c99c);})[_0x3daf('0x1a')](function(_0x25d1b5){_0x1da2c7[_0x3daf('0x48')]=_0x25d1b5;return _0x1da2c7;});}})['then'](respondWithFilteredResult(_0x4e9c18,_0x11c99c))[_0x3daf('0x29')](handleError(_0x4e9c18,null));};exports['addTags']=function(_0x306992,_0x179963){return db[_0x3daf('0x21')][_0x3daf('0x36')]({'where':{'id':_0x306992['params']['id']}})['then'](handleEntityNotFound(_0x179963,null))[_0x3daf('0x1a')](function(_0x12462d){if(_0x12462d){return _0x12462d[_0x3daf('0x49')](_0x306992['body'][_0x3daf('0x3c')],_[_0x3daf('0x4a')](_0x306992[_0x3daf('0x38')],[_0x3daf('0x3c'),'id'])||{})[_0x3daf('0x4b')](function(){return db[_0x3daf('0x4c')][_0x3daf('0x26')]({'attributes':['id','name',_0x3daf('0x4d')],'where':{'id':_0x306992[_0x3daf('0x38')][_0x3daf('0x3c')]}});})[_0x3daf('0x1a')](function(_0x2bfef0){socket[_0x3daf('0x4e')](_0x3daf('0x4f'),{'id':Number(_0x306992[_0x3daf('0x3a')]['id']),'tags':_0x2bfef0||[]});return{'id':Number(_0x306992['params']['id']),'tags':_0x2bfef0||[]};});}})[_0x3daf('0x1a')](respondWithResult(_0x179963,null))[_0x3daf('0x29')](handleError(_0x179963,null));};exports[_0x3daf('0x50')]=function(_0x4a01e4,_0x1bc7ca){return db[_0x3daf('0x21')][_0x3daf('0x36')]({'where':{'id':_0x4a01e4[_0x3daf('0x3a')]['id']}})[_0x3daf('0x1a')](handleEntityNotFound(_0x1bc7ca,null))['then'](function(_0x3b4290){if(_0x3b4290){return _0x3b4290[_0x3daf('0x50')](_0x4a01e4[_0x3daf('0x28')][_0x3daf('0x3c')]);}})[_0x3daf('0x1a')](respondWithStatusCode(_0x1bc7ca,null))[_0x3daf('0x29')](handleError(_0x1bc7ca,null));};exports[_0x3daf('0x51')]=function(_0x3d380d,_0x1e9e17){var _0x4ea6cb=moment()[_0x3daf('0x52')]()[_0x3daf('0x53')]();var _0x2d5152=path['join'](config[_0x3daf('0x54')],_0x3daf('0x55'),_0x3daf('0x56'),_0x3daf('0x57'));var _0x4eec7b=path[_0x3daf('0x58')](config['root'],_0x3daf('0x55'),_0x3daf('0x56'),'attachments');var _0xf92d3b=path[_0x3daf('0x58')](_0x2d5152,_0x4ea6cb);var _0x4ef692=util[_0x3daf('0x45')]('transcript-%d-%s.zip',_0x3d380d[_0x3daf('0x3a')]['id'],_0x4ea6cb);var _0x19dd53=path[_0x3daf('0x58')](_0x2d5152,_0x4ef692);var _0x4de32a=[];_0x4de32a[_0x3daf('0x59')]({'model':db[_0x3daf('0x5a')],'as':_0x3daf('0x5a'),'raw':!![]});var _0x36a662=[{'model':db[_0x3daf('0x47')],'as':'Messages','attributes':['id',_0x3daf('0x38'),_0x3daf('0x5b')],'include':_0x4de32a}];return db[_0x3daf('0x21')][_0x3daf('0x36')]({'where':{'id':_0x3d380d['params']['id']},'include':_0x36a662})['then'](handleEntityNotFound(_0x1e9e17,null))[_0x3daf('0x1a')](function(_0x3a30af){if(_0x3a30af&&_0x3a30af[_0x3daf('0x5c')]){var _0xef7042=_0x3a30af[_0x3daf('0x5d')]({'plain':!![]});fs['mkdirSync'](_0xf92d3b);for(var _0x3d178e=0x0;_0x3d178e<_0xef7042[_0x3daf('0x5c')]['length'];_0x3d178e++){var _0x74f79d=_0xef7042[_0x3daf('0x5c')][_0x3d178e][_0x3daf('0x5a')];if(_0x74f79d){var _0x59177b=path[_0x3daf('0x58')](_0x4eec7b,_0x74f79d[_0x3daf('0x5e')]);if(fs[_0x3daf('0x5f')](_0x59177b)){fs[_0x3daf('0x60')](_0x59177b)['pipe'](fs['createWriteStream'](path[_0x3daf('0x58')](_0xf92d3b,_0x74f79d[_0x3daf('0x5e')])));}}}return BPromise[_0x3daf('0x61')]()['then'](function(){return new BPromise(function(_0x423613,_0x1a7224){zipdir(_0xf92d3b,{'saveTo':_0x19dd53},function(_0x338154,_0x48d1b3){if(_0x338154)return _0x1a7224(_0x338154);return _0x423613(_0x48d1b3);});})[_0x3daf('0x1a')](function(){return new BPromise(function(_0x357f84,_0x4fb6e8){rimraf(_0xf92d3b,function(_0x3f461f){if(_0x3f461f)_0x4fb6e8(_0x3f461f);return _0x357f84();});});})[_0x3daf('0x1a')](function(){return _0x1e9e17[_0x3daf('0x51')](_0x19dd53,_0x4ef692,function(_0x34ba56){if(_0x34ba56){console[_0x3daf('0x62')]('err',_0x34ba56);}else{fs['unlinkSync'](_0x19dd53);}});});});}else{return _0x1e9e17['sendStatus'](0xc8);}})['catch'](handleError(_0x1e9e17,null));}; \ No newline at end of file +var _0x18ff=['error','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','fax','query','user','catch','model','FaxInteraction','keys','intersection','attributes','fields','includeAll','include','merge','options','find','create','body','update','params','describe','addMessage','FaxMessage','ids','omit','findOne','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','filter','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','transcript-%d-%s.zip','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','createWriteStream','resolve','log','err','unlinkSync','rimraf','zip-dir','bluebird','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','then','destroy','end'];(function(_0x216ddd,_0x4550ce){var _0x3e090c=function(_0x4f6fa3){while(--_0x4f6fa3){_0x216ddd['push'](_0x216ddd['shift']());}};_0x3e090c(++_0x4550ce);}(_0x18ff,0x18c));var _0xf18f=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x18ff[_0x55f8b4];return _0x2475f9;};'use strict';var rimraf=require(_0xf18f('0x0'));var zipdir=require(_0xf18f('0x1'));var moment=require('moment');var BPromise=require(_0xf18f('0x2'));var util=require('util');var path=require(_0xf18f('0x3'));var fs=require('fs');var _=require(_0xf18f('0x4'));var Redis=require(_0xf18f('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0xf18f('0x6'));var logger=require(_0xf18f('0x7'))(_0xf18f('0x8'));var config=require(_0xf18f('0x9'));var db=require(_0xf18f('0xa'))['db'];config[_0xf18f('0xb')]=_['defaults'](config[_0xf18f('0xb')],{'host':_0xf18f('0xc'),'port':0x18eb});var socket=require(_0xf18f('0xd'))(new Redis(config[_0xf18f('0xb')]));require(_0xf18f('0xe'))[_0xf18f('0xf')](socket);function respondWithStatusCode(_0x3dcb30,_0x53af17){_0x53af17=_0x53af17||0xcc;return function(_0x3e5e0c){if(_0x3e5e0c){return _0x3dcb30[_0xf18f('0x10')](_0x53af17);}return _0x3dcb30['status'](_0x53af17)['end']();};}function respondWithResult(_0x10c7a4,_0x597941){_0x597941=_0x597941||0xc8;return function(_0x3f7e61){if(_0x3f7e61){return _0x10c7a4[_0xf18f('0x11')](_0x597941)[_0xf18f('0x12')](_0x3f7e61);}};}function respondWithFilteredResult(_0x4b1165,_0x485518){return function(_0x377c60){if(_0x377c60){var _0x3555ce=typeof _0x485518[_0xf18f('0x13')]==='undefined'&&typeof _0x485518[_0xf18f('0x14')]===_0xf18f('0x15');var _0x45b5b6=_0x377c60[_0xf18f('0x16')];var _0x59fbf4=_0x3555ce?0x0:_0x485518[_0xf18f('0x13')];var _0x397171=_0x3555ce?_0x377c60[_0xf18f('0x16')]:_0x485518[_0xf18f('0x13')]+_0x485518[_0xf18f('0x14')];var _0x11f69a;if(_0x397171>=_0x45b5b6){_0x397171=_0x45b5b6;_0x11f69a=0xc8;}else{_0x11f69a=0xce;}_0x4b1165[_0xf18f('0x11')](_0x11f69a);return _0x4b1165[_0xf18f('0x17')](_0xf18f('0x18'),_0x59fbf4+'-'+_0x397171+'/'+_0x45b5b6)[_0xf18f('0x12')](_0x377c60);}return null;};}function saveUpdates(_0x331610){return function(_0x2b0c48){if(_0x2b0c48){return _0x2b0c48['update'](_0x331610)[_0xf18f('0x19')](function(_0x484dc7){return _0x484dc7;});}return null;};}function removeEntity(_0x201b02){return function(_0x308d09){if(_0x308d09){return _0x308d09[_0xf18f('0x1a')]()[_0xf18f('0x19')](function(){_0x201b02['status'](0xcc)[_0xf18f('0x1b')]();});}};}function handleEntityNotFound(_0x4d65ee){return function(_0x245c9a){if(!_0x245c9a){_0x4d65ee[_0xf18f('0x10')](0x194);}return _0x245c9a;};}function handleError(_0x18ea38,_0x25494e){_0x25494e=_0x25494e||0x1f4;return function(_0x2e8637){logger[_0xf18f('0x1c')](_0x2e8637['stack']);if(_0x2e8637[_0xf18f('0x1d')]){delete _0x2e8637[_0xf18f('0x1d')];}_0x18ea38['status'](_0x25494e)[_0xf18f('0x1e')](_0x2e8637);};}exports[_0xf18f('0x1f')]=function(_0x1e4e09,_0x491ce2){var _0x8ee03={};var _0x23154c=_[_0xf18f('0x20')](db['FaxInteraction'][_0xf18f('0x21')],function(_0x52fe44){return{'name':_0x52fe44[_0xf18f('0x22')],'type':_0x52fe44[_0xf18f('0x23')][_0xf18f('0x24')]};});_0x8ee03=qs[_0xf18f('0x25')](_0x23154c,_0x1e4e09);return interaction['findAll'](_0xf18f('0x26'),_0x1e4e09[_0xf18f('0x27')],_0x1e4e09[_0xf18f('0x28')],_0x8ee03,_0x23154c)[_0xf18f('0x19')](respondWithFilteredResult(_0x491ce2,_0x8ee03))[_0xf18f('0x29')](handleError(_0x491ce2,null));};exports['show']=function(_0x115fe5,_0x5ea904){var _0x1c8ed9={'raw':![],'where':{'id':_0x115fe5['params']['id']}},_0x1544a4={};_0x1544a4[_0xf18f('0x2a')]=_['keys'](db[_0xf18f('0x2b')][_0xf18f('0x21')]);_0x1544a4[_0xf18f('0x27')]=_[_0xf18f('0x2c')](_0x115fe5['query']);_0x1544a4['filters']=_[_0xf18f('0x2d')](_0x1544a4[_0xf18f('0x2a')],_0x1544a4['query']);_0x1c8ed9[_0xf18f('0x2e')]=_['intersection'](_0x1544a4['model'],qs[_0xf18f('0x2f')](_0x115fe5['query'][_0xf18f('0x2f')]));_0x1c8ed9['attributes']=_0x1c8ed9['attributes']['length']?_0x1c8ed9[_0xf18f('0x2e')]:_0x1544a4[_0xf18f('0x2a')];if(_0x115fe5[_0xf18f('0x27')][_0xf18f('0x30')]){_0x1c8ed9[_0xf18f('0x31')]=[{'all':!![]}];}_0x1c8ed9=_[_0xf18f('0x32')]({},_0x1c8ed9,_0x115fe5[_0xf18f('0x33')]);return db[_0xf18f('0x2b')][_0xf18f('0x34')](_0x1c8ed9)[_0xf18f('0x19')](handleEntityNotFound(_0x5ea904,null))[_0xf18f('0x19')](respondWithResult(_0x5ea904,null))['catch'](handleError(_0x5ea904,null));};exports[_0xf18f('0x35')]=function(_0x4598ed,_0x14a0bb){return db['FaxInteraction'][_0xf18f('0x35')](_0x4598ed[_0xf18f('0x36')],{})[_0xf18f('0x19')](respondWithResult(_0x14a0bb,0xc9))[_0xf18f('0x29')](handleError(_0x14a0bb,null));};exports[_0xf18f('0x37')]=function(_0x347672,_0x51bdbf){if(_0x347672[_0xf18f('0x36')]['id']){delete _0x347672['body']['id'];}return db['FaxInteraction'][_0xf18f('0x34')]({'where':{'id':_0x347672[_0xf18f('0x38')]['id']}})[_0xf18f('0x19')](handleEntityNotFound(_0x51bdbf,null))[_0xf18f('0x19')](saveUpdates(_0x347672[_0xf18f('0x36')],null))[_0xf18f('0x19')](respondWithResult(_0x51bdbf,null))[_0xf18f('0x29')](handleError(_0x51bdbf,null));};exports[_0xf18f('0x1a')]=function(_0x1697ee,_0x10f9ae){return db[_0xf18f('0x2b')][_0xf18f('0x34')]({'where':{'id':_0x1697ee[_0xf18f('0x38')]['id']}})[_0xf18f('0x19')](handleEntityNotFound(_0x10f9ae,null))[_0xf18f('0x19')](removeEntity(_0x10f9ae,null))[_0xf18f('0x29')](handleError(_0x10f9ae,null));};exports[_0xf18f('0x39')]=function(_0x4ebc28,_0x3acdc3){return db['FaxInteraction']['describe']()[_0xf18f('0x19')](respondWithResult(_0x3acdc3,null))[_0xf18f('0x29')](handleError(_0x3acdc3,null));};exports[_0xf18f('0x3a')]=function(_0x2756f7,_0x3d9f7c){return db[_0xf18f('0x3b')]['find']({'where':{'id':_0x2756f7['params']['id']}})['then'](handleEntityNotFound(_0x3d9f7c,null))[_0xf18f('0x19')](function(_0x15d239){if(_0x15d239){return _0x15d239['addMessage'](_0x2756f7[_0xf18f('0x36')][_0xf18f('0x3c')],_[_0xf18f('0x3d')](_0x2756f7[_0xf18f('0x36')],[_0xf18f('0x3c'),'id'])||{});}})[_0xf18f('0x19')](respondWithResult(_0x3d9f7c,null))[_0xf18f('0x29')](handleError(_0x3d9f7c,null));};exports['getMessages']=function(_0x4ce1d4,_0x306d35){var _0x18c8dd={'raw':![],'where':{}};var _0x510149={};var _0x4445d4={'count':0x0,'rows':[]};return db[_0xf18f('0x2b')][_0xf18f('0x3e')]({'where':{'id':_0x4ce1d4['params']['id']}})[_0xf18f('0x19')](handleEntityNotFound(_0x306d35,null))['then'](function(_0x9b3034){if(_0x9b3034){_0x510149['model']=_[_0xf18f('0x2c')](db[_0xf18f('0x3b')]['rawAttributes']);_0x510149[_0xf18f('0x27')]=_[_0xf18f('0x2c')](_0x4ce1d4['query']);_0x510149['filters']=_[_0xf18f('0x2d')](_0x510149['model'],_0x510149[_0xf18f('0x27')]);_0x18c8dd[_0xf18f('0x2e')]=_[_0xf18f('0x2d')](_0x510149[_0xf18f('0x2a')],qs[_0xf18f('0x2f')](_0x4ce1d4['query'][_0xf18f('0x2f')]));_0x18c8dd['attributes']=_0x18c8dd['attributes'][_0xf18f('0x3f')]?_0x18c8dd[_0xf18f('0x2e')]:_0x510149[_0xf18f('0x2a')];if(!_0x4ce1d4[_0xf18f('0x27')][_0xf18f('0x40')](_0xf18f('0x41'))){_0x18c8dd['limit']=qs[_0xf18f('0x14')](_0x4ce1d4[_0xf18f('0x27')][_0xf18f('0x14')]);_0x18c8dd[_0xf18f('0x13')]=qs['offset'](_0x4ce1d4[_0xf18f('0x27')][_0xf18f('0x13')]);}_0x18c8dd[_0xf18f('0x42')]=qs['sort'](_0x4ce1d4[_0xf18f('0x27')][_0xf18f('0x43')]);_0x18c8dd['where']=qs[_0xf18f('0x44')](_[_0xf18f('0x45')](_0x4ce1d4[_0xf18f('0x27')],_0x510149[_0xf18f('0x44')]));_0x18c8dd[_0xf18f('0x46')]['FaxInteractionId']=_0x9b3034['id'];if(_0x4ce1d4[_0xf18f('0x27')]['filter']){_0x18c8dd[_0xf18f('0x46')]=_[_0xf18f('0x32')](_0x18c8dd[_0xf18f('0x46')],{'$or':_['map'](_0x18c8dd[_0xf18f('0x2e')],function(_0x14cb7a){var _0x217a1a={};_0x217a1a[_0x14cb7a]={'$like':'%'+_0x4ce1d4['query'][_0xf18f('0x47')]+'%'};return _0x217a1a;})});}if(_0x4ce1d4[_0xf18f('0x27')]['$gte']){var _0xf2d956=_0x4ce1d4['query']['$gte'][_0xf18f('0x48')](',');var _0x10ee02={};_0x10ee02[_0xf2d956[0x0]]={'$gte':moment(_0xf2d956[0x1])[_0xf18f('0x49')](_0xf18f('0x4a'))};_0x18c8dd[_0xf18f('0x46')]=_[_0xf18f('0x32')](_0x18c8dd[_0xf18f('0x46')],_0x10ee02);}_0x18c8dd=_[_0xf18f('0x32')]({},_0x18c8dd,_0x4ce1d4[_0xf18f('0x33')]);return db[_0xf18f('0x3b')][_0xf18f('0x16')]({'where':_0x18c8dd['where']})[_0xf18f('0x19')](function(_0x4aa238){_0x4445d4[_0xf18f('0x16')]=_0x4aa238;if(_0x4ce1d4[_0xf18f('0x27')][_0xf18f('0x30')]){_0x18c8dd['include']=[{'all':!![]}];}return db[_0xf18f('0x3b')][_0xf18f('0x4b')](_0x18c8dd);})[_0xf18f('0x19')](function(_0x2d41d9){_0x4445d4[_0xf18f('0x4c')]=_0x2d41d9;return _0x4445d4;});}})[_0xf18f('0x19')](respondWithFilteredResult(_0x306d35,_0x18c8dd))[_0xf18f('0x29')](handleError(_0x306d35,null));};exports[_0xf18f('0x4d')]=function(_0x988c2e,_0x36936b){return db[_0xf18f('0x2b')]['find']({'where':{'id':_0x988c2e['params']['id']}})[_0xf18f('0x19')](handleEntityNotFound(_0x36936b,null))['then'](function(_0xcc0589){if(_0xcc0589){return _0xcc0589[_0xf18f('0x4e')](_0x988c2e[_0xf18f('0x36')]['ids'],_[_0xf18f('0x3d')](_0x988c2e[_0xf18f('0x36')],[_0xf18f('0x3c'),'id'])||{})[_0xf18f('0x4f')](function(){return db[_0xf18f('0x50')][_0xf18f('0x4b')]({'attributes':['id',_0xf18f('0x1d'),_0xf18f('0x51')],'where':{'id':_0x988c2e[_0xf18f('0x36')][_0xf18f('0x3c')]}});})[_0xf18f('0x19')](function(_0x3d2076){socket[_0xf18f('0x52')](_0xf18f('0x53'),{'id':Number(_0x988c2e[_0xf18f('0x38')]['id']),'tags':_0x3d2076||[]});return{'id':Number(_0x988c2e[_0xf18f('0x38')]['id']),'tags':_0x3d2076||[]};});}})[_0xf18f('0x19')](respondWithResult(_0x36936b,null))[_0xf18f('0x29')](handleError(_0x36936b,null));};exports[_0xf18f('0x54')]=function(_0x4c5877,_0x5f1209){return db[_0xf18f('0x2b')][_0xf18f('0x34')]({'where':{'id':_0x4c5877[_0xf18f('0x38')]['id']}})[_0xf18f('0x19')](handleEntityNotFound(_0x5f1209,null))[_0xf18f('0x19')](function(_0x71eacf){if(_0x71eacf){return _0x71eacf[_0xf18f('0x54')](_0x4c5877[_0xf18f('0x27')][_0xf18f('0x3c')]);}})[_0xf18f('0x19')](respondWithStatusCode(_0x5f1209,null))[_0xf18f('0x29')](handleError(_0x5f1209,null));};exports[_0xf18f('0x55')]=function(_0xf755d8,_0x3c79c5){var _0x1837ca=moment()[_0xf18f('0x56')]()[_0xf18f('0x57')]();var _0x1a108c=path[_0xf18f('0x58')](config[_0xf18f('0x59')],_0xf18f('0x5a'),_0xf18f('0x5b'),'tmp');var _0x452bb6=path[_0xf18f('0x58')](config['root'],_0xf18f('0x5a'),_0xf18f('0x5b'),'attachments');var _0x5a0a0a=path[_0xf18f('0x58')](_0x1a108c,_0x1837ca);var _0x48929a=util[_0xf18f('0x49')](_0xf18f('0x5c'),_0xf755d8[_0xf18f('0x38')]['id'],_0x1837ca);var _0x437917=path[_0xf18f('0x58')](_0x1a108c,_0x48929a);var _0x1ab98b=[];_0x1ab98b['push']({'model':db['Attachment'],'as':_0xf18f('0x5d'),'raw':!![]});var _0x1d92ae=[{'model':db[_0xf18f('0x3b')],'as':_0xf18f('0x5e'),'attributes':['id',_0xf18f('0x36'),_0xf18f('0x5f')],'include':_0x1ab98b}];return db[_0xf18f('0x2b')][_0xf18f('0x34')]({'where':{'id':_0xf755d8[_0xf18f('0x38')]['id']},'include':_0x1d92ae})['then'](handleEntityNotFound(_0x3c79c5,null))[_0xf18f('0x19')](function(_0x3978b7){if(_0x3978b7&&_0x3978b7[_0xf18f('0x5e')]){var _0x1dfc14=_0x3978b7[_0xf18f('0x60')]({'plain':!![]});fs[_0xf18f('0x61')](_0x5a0a0a);for(var _0x36bfb6=0x0;_0x36bfb6<_0x1dfc14[_0xf18f('0x5e')][_0xf18f('0x3f')];_0x36bfb6++){var _0x87977=_0x1dfc14[_0xf18f('0x5e')][_0x36bfb6]['Attachment'];if(_0x87977){var _0xfe1729=path[_0xf18f('0x58')](_0x452bb6,_0x87977[_0xf18f('0x62')]);if(fs[_0xf18f('0x63')](_0xfe1729)){fs[_0xf18f('0x64')](_0xfe1729)['pipe'](fs[_0xf18f('0x65')](path[_0xf18f('0x58')](_0x5a0a0a,_0x87977[_0xf18f('0x62')])));}}}return BPromise[_0xf18f('0x66')]()[_0xf18f('0x19')](function(){return new BPromise(function(_0x16ab3b,_0x1aa7d0){zipdir(_0x5a0a0a,{'saveTo':_0x437917},function(_0x42ce03,_0x4873cf){if(_0x42ce03)return _0x1aa7d0(_0x42ce03);return _0x16ab3b(_0x4873cf);});})[_0xf18f('0x19')](function(){return new BPromise(function(_0x477aa9,_0x28a86e){rimraf(_0x5a0a0a,function(_0x20bab7){if(_0x20bab7)_0x28a86e(_0x20bab7);return _0x477aa9();});});})[_0xf18f('0x19')](function(){return _0x3c79c5[_0xf18f('0x55')](_0x437917,_0x48929a,function(_0x31cd73){if(_0x31cd73){console[_0xf18f('0x67')](_0xf18f('0x68'),_0x31cd73);}else{fs[_0xf18f('0x69')](_0x437917);}});});});}else{return _0x3c79c5['sendStatus'](0xc8);}})[_0xf18f('0x29')](handleError(_0x3c79c5,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 900e4e6..574104f 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 _0x376d=['then','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','getUsers','Users','findAll'];(function(_0x323949,_0x2abdc1){var _0x475daf=function(_0x19dc1){while(--_0x19dc1){_0x323949['push'](_0x323949['shift']());}};_0x475daf(++_0x2abdc1);}(_0x376d,0x107));var _0xd376=function(_0x3d7b3a,_0x2906eb){_0x3d7b3a=_0x3d7b3a-0x0;var _0x469f8e=_0x376d[_0x3d7b3a];return _0x469f8e;};'use strict';var EventEmitter=require(_0xd376('0x0'));var FaxInteraction=require(_0xd376('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0xd376('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xd376('0x2')](0x0);var events={'afterCreate':_0xd376('0x3'),'afterUpdate':_0xd376('0x4'),'afterDestroy':_0xd376('0x5')};function emitEvent(_0x54d873){return function(_0x366dc2,_0x24c8e2,_0x4fb027){_0x366dc2[_0xd376('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x22875e){_0x366dc2['setDataValue'](_0xd376('0x7'),_0x22875e['map'](function(_0x3d6b14){return{'id':_0x3d6b14['id']};}));return FaxMessage[_0xd376('0x8')]({'where':{'FaxInteractionId':_0x366dc2['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd376('0x9')](function(_0x573bf8){_0x366dc2[_0xd376('0xa')](_0xd376('0xb'),_0x573bf8[_0xd376('0xc')]);FaxInteractionEvents[_0xd376('0xd')](_0x54d873+':'+_0x366dc2['id'],_0x366dc2);FaxInteractionEvents[_0xd376('0xd')](_0x54d873,_0x366dc2);_0x4fb027(null);})['catch'](_0x4fb027(null));};}for(var e in events){if(events[_0xd376('0xe')](e)){var event=events[e];FaxInteraction[_0xd376('0xf')](e,emitEvent(event));}}module[_0xd376('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x5398=['remove','getUsers','then','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update'];(function(_0x11946c,_0x12152c){var _0x383935=function(_0x61fce2){while(--_0x61fce2){_0x11946c['push'](_0x11946c['shift']());}};_0x383935(++_0x12152c);}(_0x5398,0x6a));var _0x8539=function(_0x56f1cc,_0x103561){_0x56f1cc=_0x56f1cc-0x0;var _0x25c55f=_0x5398[_0x56f1cc];return _0x25c55f;};'use strict';var EventEmitter=require(_0x8539('0x0'));var FaxInteraction=require(_0x8539('0x1'))['db'][_0x8539('0x2')];var FaxMessage=require(_0x8539('0x1'))['db'][_0x8539('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x8539('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8539('0x5'),'afterDestroy':_0x8539('0x6')};function emitEvent(_0x33bb6f){return function(_0x4e8b20,_0x5d3858,_0xef845a){_0x4e8b20[_0x8539('0x7')]({'attributes':['id'],'raw':!![]})[_0x8539('0x8')](function(_0x1b7f72){_0x4e8b20['setDataValue']('Users',_0x1b7f72['map'](function(_0x3b1e34){return{'id':_0x3b1e34['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x4e8b20['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8539('0x8')](function(_0x4ca15e){_0x4e8b20[_0x8539('0x9')](_0x8539('0xa'),_0x4ca15e[_0x8539('0xb')]);FaxInteractionEvents[_0x8539('0xc')](_0x33bb6f+':'+_0x4e8b20['id'],_0x4e8b20);FaxInteractionEvents[_0x8539('0xc')](_0x33bb6f,_0x4e8b20);_0xef845a(null);})[_0x8539('0xd')](_0xef845a(null));};}for(var e in events){if(events[_0x8539('0xe')](e)){var event=events[e];FaxInteraction[_0x8539('0xf')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 7ca2e32..9be0d40 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 _0x1d91=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./faxInteraction.attributes','exports','FaxInteraction','fax_interactions','closed','format'];(function(_0x568bd7,_0x23eea6){var _0x203cda=function(_0x26d94f){while(--_0x26d94f){_0x568bd7['push'](_0x568bd7['shift']());}};_0x203cda(++_0x23eea6);}(_0x1d91,0x150));var _0x11d9=function(_0x29deca,_0x241ece){_0x29deca=_0x29deca-0x0;var _0x345fc8=_0x1d91[_0x29deca];return _0x345fc8;};'use strict';var _=require(_0x11d9('0x0'));var util=require(_0x11d9('0x1'));var logger=require(_0x11d9('0x2'))('api');var moment=require(_0x11d9('0x3'));var BPromise=require(_0x11d9('0x4'));var rp=require(_0x11d9('0x5'));var fs=require('fs');var path=require(_0x11d9('0x6'));var rimraf=require('rimraf');var config=require(_0x11d9('0x7'));var attributes=require(_0x11d9('0x8'));module[_0x11d9('0x9')]=function(_0x4b27dd,_0x564b2b){return _0x4b27dd['define'](_0x11d9('0xa'),attributes,{'tableName':_0x11d9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x274b17,_0x32a4f7,_0x7a8c60){if(_0x274b17['changed'](_0x11d9('0xc'))){_0x274b17['closedAt']=moment()[_0x11d9('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x7a8c60(null,_0x274b17);}}});}; \ No newline at end of file +var _0x7295=['changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','exports','FaxInteraction','fax_interactions'];(function(_0x5c34c4,_0x1e278c){var _0x1082b4=function(_0x3c7fc3){while(--_0x3c7fc3){_0x5c34c4['push'](_0x5c34c4['shift']());}};_0x1082b4(++_0x1e278c);}(_0x7295,0x199));var _0x5729=function(_0x2d7827,_0x5afb3d){_0x2d7827=_0x2d7827-0x0;var _0x2ef080=_0x7295[_0x2d7827];return _0x2ef080;};'use strict';var _=require('lodash');var util=require(_0x5729('0x0'));var logger=require('../../config/logger')(_0x5729('0x1'));var moment=require(_0x5729('0x2'));var BPromise=require(_0x5729('0x3'));var rp=require(_0x5729('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5729('0x5'));var config=require(_0x5729('0x6'));var attributes=require(_0x5729('0x7'));module[_0x5729('0x8')]=function(_0x53dd57,_0x3aeae1){return _0x53dd57['define'](_0x5729('0x9'),attributes,{'tableName':_0x5729('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xc3ea33,_0x3bcf50,_0x50f21e){if(_0xc3ea33[_0x5729('0xb')](_0x5729('0xc'))){_0xc3ea33[_0x5729('0xd')]=moment()['format'](_0x5729('0xe'));}_0x50f21e(null,_0xc3ea33);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 9b2a9f6..1c74dc0 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 _0x64ff=['info','result','catch','FaxInteraction','update','options','raw','attributes','UpdateFaxInteraction','stringify','AddTagsToFaxInteraction','find','where','addTags','omit','body','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','debug','request\x20sent','error','code','FaxInteraction,\x20%s,\x20%s','message'];(function(_0x7f14eb,_0x293155){var _0x554bff=function(_0x43ed25){while(--_0x43ed25){_0x7f14eb['push'](_0x7f14eb['shift']());}};_0x554bff(++_0x293155);}(_0x64ff,0x114));var _0xf64f=function(_0x2e7eb3,_0x3c3e04){_0x2e7eb3=_0x2e7eb3-0x0;var _0x11e17a=_0x64ff[_0x2e7eb3];return _0x11e17a;};'use strict';var _=require(_0xf64f('0x0'));var util=require('util');var moment=require(_0xf64f('0x1'));var BPromise=require(_0xf64f('0x2'));var rs=require(_0xf64f('0x3'));var fs=require('fs');var Redis=require(_0xf64f('0x4'));var db=require(_0xf64f('0x5'))['db'];var utils=require(_0xf64f('0x6'));var logger=require(_0xf64f('0x7'))(_0xf64f('0x8'));var config=require(_0xf64f('0x9'));var jayson=require(_0xf64f('0xa'));var client=jayson[_0xf64f('0xb')][_0xf64f('0xc')]({'port':0x232a});config[_0xf64f('0xd')]=_[_0xf64f('0xe')](config[_0xf64f('0xd')],{'host':_0xf64f('0xf'),'port':0x18eb});var socket=require(_0xf64f('0x10'))(new Redis(config[_0xf64f('0xd')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x371b42,_0xcdcc9d,_0x32085c){return new BPromise(function(_0x19d19a,_0x38a64c){return client[_0xf64f('0x11')](_0x371b42,_0x32085c)[_0xf64f('0x12')](function(_0x267122){logger['info']('FaxInteraction,\x20%s,\x20%s',_0xcdcc9d,'request\x20sent');logger[_0xf64f('0x13')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0xcdcc9d,_0xf64f('0x14'),JSON['stringify'](_0x267122));if(_0x267122[_0xf64f('0x15')]){if(_0x267122[_0xf64f('0x15')][_0xf64f('0x16')]===0x1f4){logger[_0xf64f('0x15')](_0xf64f('0x17'),_0xcdcc9d,_0x267122[_0xf64f('0x15')]['message']);return _0x38a64c(_0x267122[_0xf64f('0x15')][_0xf64f('0x18')]);}logger[_0xf64f('0x15')](_0xf64f('0x17'),_0xcdcc9d,_0x267122[_0xf64f('0x15')][_0xf64f('0x18')]);return _0x19d19a(_0x267122[_0xf64f('0x15')]['message']);}else{logger[_0xf64f('0x19')](_0xf64f('0x17'),_0xcdcc9d,_0xf64f('0x14'));_0x19d19a(_0x267122[_0xf64f('0x1a')][_0xf64f('0x18')]);}})[_0xf64f('0x1b')](function(_0x2bc952){logger[_0xf64f('0x15')](_0xf64f('0x17'),_0xcdcc9d,_0x2bc952);_0x38a64c(_0x2bc952);});});}exports['UpdateFaxInteraction']=function(_0x2cc8fd){var _0x31eca1=this;return new Promise(function(_0x3c55d1,_0x162c02){return db[_0xf64f('0x1c')][_0xf64f('0x1d')](_0x2cc8fd['body'],{'raw':_0x2cc8fd[_0xf64f('0x1e')]?_0x2cc8fd[_0xf64f('0x1e')][_0xf64f('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2cc8fd[_0xf64f('0x1e')]?_0x2cc8fd['options']['where']||null:null,'attributes':_0x2cc8fd['options']?_0x2cc8fd[_0xf64f('0x1e')][_0xf64f('0x20')]||null:null,'limit':_0x2cc8fd[_0xf64f('0x1e')]?_0x2cc8fd[_0xf64f('0x1e')]['limit']||null:null})[_0xf64f('0x12')](function(_0x98bfca){logger[_0xf64f('0x19')](_0xf64f('0x21'),_0x2cc8fd);logger[_0xf64f('0x13')](_0xf64f('0x21'),_0x2cc8fd,JSON[_0xf64f('0x22')](_0x98bfca));_0x3c55d1(_0x98bfca);})['catch'](function(_0x21c853){logger[_0xf64f('0x15')](_0xf64f('0x21'),_0x21c853[_0xf64f('0x18')],_0x2cc8fd);_0x162c02(_0x31eca1[_0xf64f('0x15')](0x1f4,_0x21c853['message']));});});};exports[_0xf64f('0x23')]=function(_0x96a2b2){return new Promise(function(_0x2044c4,_0x3bb490){return db[_0xf64f('0x1c')][_0xf64f('0x24')]({'where':_0x96a2b2['options']?_0x96a2b2[_0xf64f('0x1e')][_0xf64f('0x25')]||null:null})[_0xf64f('0x12')](function(_0x497039){if(_0x497039){return _0x497039[_0xf64f('0x26')](_0x96a2b2['body']['ids'],_[_0xf64f('0x27')](_0x96a2b2[_0xf64f('0x28')],['ids','id'])||{});}})[_0xf64f('0x29')](function(_0x17239c){logger[_0xf64f('0x19')](_0xf64f('0x2a'),_0x96a2b2);logger[_0xf64f('0x13')]('AddTags',_0x96a2b2,JSON[_0xf64f('0x22')](_0x17239c));_0x2044c4(_0x17239c);})[_0xf64f('0x1b')](function(_0x2f7a03){logger['error'](_0xf64f('0x2a'),_0x2f7a03['message'],_0x96a2b2);_0x3bb490(_this[_0xf64f('0x15')](0x1f4,_0x2f7a03['message']));});});}; \ No newline at end of file +var _0x0fad=['body','options','raw','where','attributes','limit','AddTagsToFaxInteraction','find','ids','omit','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','then','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateFaxInteraction','FaxInteraction','update'];(function(_0x340ab0,_0xbf1e61){var _0x43a897=function(_0x63bdf7){while(--_0x63bdf7){_0x340ab0['push'](_0x340ab0['shift']());}};_0x43a897(++_0xbf1e61);}(_0x0fad,0xaf));var _0xd0fa=function(_0x230951,_0x4dad52){_0x230951=_0x230951-0x0;var _0xeb26b1=_0x0fad[_0x230951];return _0xeb26b1;};'use strict';var _=require(_0xd0fa('0x0'));var util=require('util');var moment=require(_0xd0fa('0x1'));var BPromise=require(_0xd0fa('0x2'));var rs=require(_0xd0fa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd0fa('0x4'))['db'];var utils=require(_0xd0fa('0x5'));var logger=require(_0xd0fa('0x6'))(_0xd0fa('0x7'));var config=require(_0xd0fa('0x8'));var jayson=require(_0xd0fa('0x9'));var client=jayson[_0xd0fa('0xa')][_0xd0fa('0xb')]({'port':0x232a});config[_0xd0fa('0xc')]=_['defaults'](config[_0xd0fa('0xc')],{'host':_0xd0fa('0xd'),'port':0x18eb});var socket=require(_0xd0fa('0xe'))(new Redis(config[_0xd0fa('0xc')]));require(_0xd0fa('0xf'))['register'](socket);function respondWithRpcPromise(_0x46c55c,_0x5c584a,_0x2630f7){return new BPromise(function(_0x12f210,_0x6f1d4e){return client['request'](_0x46c55c,_0x2630f7)[_0xd0fa('0x10')](function(_0x3d1140){logger[_0xd0fa('0x11')](_0xd0fa('0x12'),_0x5c584a,'request\x20sent');logger[_0xd0fa('0x13')](_0xd0fa('0x14'),_0x5c584a,_0xd0fa('0x15'),JSON[_0xd0fa('0x16')](_0x3d1140));if(_0x3d1140[_0xd0fa('0x17')]){if(_0x3d1140['error'][_0xd0fa('0x18')]===0x1f4){logger[_0xd0fa('0x17')](_0xd0fa('0x12'),_0x5c584a,_0x3d1140[_0xd0fa('0x17')][_0xd0fa('0x19')]);return _0x6f1d4e(_0x3d1140['error'][_0xd0fa('0x19')]);}logger[_0xd0fa('0x17')](_0xd0fa('0x12'),_0x5c584a,_0x3d1140['error'][_0xd0fa('0x19')]);return _0x12f210(_0x3d1140[_0xd0fa('0x17')][_0xd0fa('0x19')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x5c584a,_0xd0fa('0x15'));_0x12f210(_0x3d1140['result']['message']);}})[_0xd0fa('0x1a')](function(_0x482932){logger['error'](_0xd0fa('0x12'),_0x5c584a,_0x482932);_0x6f1d4e(_0x482932);});});}exports[_0xd0fa('0x1b')]=function(_0x41630a){var _0x3287b4=this;return new Promise(function(_0x359cf2,_0x13888f){return db[_0xd0fa('0x1c')][_0xd0fa('0x1d')](_0x41630a[_0xd0fa('0x1e')],{'raw':_0x41630a[_0xd0fa('0x1f')]?_0x41630a[_0xd0fa('0x1f')][_0xd0fa('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41630a[_0xd0fa('0x1f')]?_0x41630a[_0xd0fa('0x1f')][_0xd0fa('0x21')]||null:null,'attributes':_0x41630a[_0xd0fa('0x1f')]?_0x41630a['options'][_0xd0fa('0x22')]||null:null,'limit':_0x41630a['options']?_0x41630a[_0xd0fa('0x1f')][_0xd0fa('0x23')]||null:null})[_0xd0fa('0x10')](function(_0x5734ee){logger['info'](_0xd0fa('0x1b'),_0x41630a);logger[_0xd0fa('0x13')](_0xd0fa('0x1b'),_0x41630a,JSON['stringify'](_0x5734ee));_0x359cf2(_0x5734ee);})['catch'](function(_0x18f0c1){logger['error'](_0xd0fa('0x1b'),_0x18f0c1[_0xd0fa('0x19')],_0x41630a);_0x13888f(_0x3287b4[_0xd0fa('0x17')](0x1f4,_0x18f0c1['message']));});});};exports[_0xd0fa('0x24')]=function(_0x4509c3){return new Promise(function(_0x2a2077,_0x447298){return db[_0xd0fa('0x1c')][_0xd0fa('0x25')]({'where':_0x4509c3['options']?_0x4509c3[_0xd0fa('0x1f')][_0xd0fa('0x21')]||null:null})[_0xd0fa('0x10')](function(_0x167998){if(_0x167998){return _0x167998['addTags'](_0x4509c3[_0xd0fa('0x1e')][_0xd0fa('0x26')],_[_0xd0fa('0x27')](_0x4509c3[_0xd0fa('0x1e')],['ids','id'])||{});}})['spread'](function(_0xbfa09e){logger[_0xd0fa('0x11')](_0xd0fa('0x28'),_0x4509c3);logger[_0xd0fa('0x13')]('AddTags',_0x4509c3,JSON[_0xd0fa('0x16')](_0xbfa09e));_0x2a2077(_0xbfa09e);})[_0xd0fa('0x1a')](function(_0x23b8f1){logger[_0xd0fa('0x17')]('AddTags',_0x23b8f1[_0xd0fa('0x19')],_0x4509c3);_0x447298(_this[_0xd0fa('0x17')](0x1f4,_0x23b8f1['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 63704d6..afb60cd 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 _0x44e7=['removeListener','length','./faxInteraction.events','remove','update','emit'];(function(_0x350269,_0x532e02){var _0x4fcb30=function(_0x3d2b51){while(--_0x3d2b51){_0x350269['push'](_0x350269['shift']());}};_0x4fcb30(++_0x532e02);}(_0x44e7,0x1e2));var _0x744e=function(_0x186d17,_0x9fa8ef){_0x186d17=_0x186d17-0x0;var _0x5d4b89=_0x44e7[_0x186d17];return _0x5d4b89;};'use strict';var FaxInteractionEvents=require(_0x744e('0x0'));var events=['save',_0x744e('0x1'),_0x744e('0x2')];function createListener(_0x371f53,_0x5ad0a7){return function(_0x588ebe){_0x5ad0a7[_0x744e('0x3')](_0x371f53,_0x588ebe);};}function removeListener(_0x5518ae,_0x554a18){return function(){FaxInteractionEvents[_0x744e('0x4')](_0x5518ae,_0x554a18);};}exports['register']=function(_0x18aa7c){for(var _0x19fc17=0x0,_0x47ab84=events[_0x744e('0x5')];_0x19fc17<_0x47ab84;_0x19fc17++){var _0x1de3d2=events[_0x19fc17];var _0x32bade=createListener('faxInteraction:'+_0x1de3d2,_0x18aa7c);FaxInteractionEvents['on'](_0x1de3d2,_0x32bade);}}; \ No newline at end of file +var _0x64a9=['update','emit','removeListener','length','./faxInteraction.events','remove'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x64a9,0xc4));var _0x964a=function(_0x46ddef,_0x6c3dac){_0x46ddef=_0x46ddef-0x0;var _0x358c6e=_0x64a9[_0x46ddef];return _0x358c6e;};'use strict';var FaxInteractionEvents=require(_0x964a('0x0'));var events=['save',_0x964a('0x1'),_0x964a('0x2')];function createListener(_0x12fa79,_0x45ee15){return function(_0x30fb31){_0x45ee15[_0x964a('0x3')](_0x12fa79,_0x30fb31);};}function removeListener(_0x13d201,_0x6d7c4){return function(){FaxInteractionEvents[_0x964a('0x4')](_0x13d201,_0x6d7c4);};}exports['register']=function(_0x5b47a1){for(var _0x437844=0x0,_0x560d3f=events[_0x964a('0x5')];_0x437844<_0x560d3f;_0x437844++){var _0x28c860=events[_0x437844];var _0x58b066=createListener('faxInteraction:'+_0x28c860,_0x5b47a1);FaxInteractionEvents['on'](_0x28c860,_0x58b066);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index a4f2a68..af76335 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 _0xf06b=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','post','/:id/messages','addMessage','/:id/tags','fax','addTags','put','tracked','delete','faxinteraction:destroy','removeTags','exports','multer','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf06b,0x166));var _0xbf06=function(_0x18abfe,_0x57fd1a){_0x18abfe=_0x18abfe-0x0;var _0x40e0d9=_0xf06b[_0x18abfe];return _0x40e0d9;};'use strict';var multer=require(_0xbf06('0x0'));var util=require(_0xbf06('0x1'));var path=require(_0xbf06('0x2'));var timeout=require(_0xbf06('0x3'));var express=require(_0xbf06('0x4'));var router=express[_0xbf06('0x5')]();var fs_extra=require(_0xbf06('0x6'));var auth=require(_0xbf06('0x7'));var interaction=require(_0xbf06('0x8'));var config=require('../../config/environment');var controller=require(_0xbf06('0x9'));router[_0xbf06('0xa')]('/',auth[_0xbf06('0xb')](),controller[_0xbf06('0xc')]);router[_0xbf06('0xa')](_0xbf06('0xd'),auth[_0xbf06('0xb')](),controller[_0xbf06('0xe')]);router[_0xbf06('0xa')](_0xbf06('0xf'),auth['isAuthenticated'](),controller[_0xbf06('0x10')]);router['get']('/:id/messages',auth[_0xbf06('0xb')](),controller['getMessages']);router[_0xbf06('0xa')]('/:id/download',auth[_0xbf06('0xb')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0xbf06('0x11')]);router[_0xbf06('0x12')](_0xbf06('0x13'),auth[_0xbf06('0xb')](),controller[_0xbf06('0x14')]);router[_0xbf06('0x12')](_0xbf06('0x15'),auth[_0xbf06('0xb')](),interaction['tracked'](_0xbf06('0x16'),'faxinteraction:addtags'),controller[_0xbf06('0x17')]);router[_0xbf06('0x18')](_0xbf06('0xf'),auth[_0xbf06('0xb')](),interaction[_0xbf06('0x19')](_0xbf06('0x16'),'faxinteraction:update'),controller['update']);router[_0xbf06('0x1a')](_0xbf06('0xf'),auth[_0xbf06('0xb')](),interaction[_0xbf06('0x19')](_0xbf06('0x16'),_0xbf06('0x1b')),controller['destroy']);router['delete'](_0xbf06('0x15'),auth[_0xbf06('0xb')](),controller[_0xbf06('0x1c')]);module[_0xbf06('0x1d')]=router; \ No newline at end of file +var _0x9cbc=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','/:id/messages','/:id/download','download','post','addMessage','tracked','faxinteraction:addtags','addTags','put','fax','delete','faxinteraction:destroy','destroy','/:id/tags','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x398074,_0xfe40bc){var _0x24eaa3=function(_0x26dd84){while(--_0x26dd84){_0x398074['push'](_0x398074['shift']());}};_0x24eaa3(++_0xfe40bc);}(_0x9cbc,0x1f2));var _0xc9cb=function(_0x22ffbf,_0x16f31e){_0x22ffbf=_0x22ffbf-0x0;var _0x360c17=_0x9cbc[_0x22ffbf];return _0x360c17;};'use strict';var multer=require(_0xc9cb('0x0'));var util=require('util');var path=require(_0xc9cb('0x1'));var timeout=require(_0xc9cb('0x2'));var express=require('express');var router=express[_0xc9cb('0x3')]();var fs_extra=require(_0xc9cb('0x4'));var auth=require(_0xc9cb('0x5'));var interaction=require(_0xc9cb('0x6'));var config=require(_0xc9cb('0x7'));var controller=require('./faxInteraction.controller');router['get']('/',auth[_0xc9cb('0x8')](),controller[_0xc9cb('0x9')]);router[_0xc9cb('0xa')](_0xc9cb('0xb'),auth[_0xc9cb('0x8')](),controller[_0xc9cb('0xc')]);router[_0xc9cb('0xa')](_0xc9cb('0xd'),auth[_0xc9cb('0x8')](),controller['show']);router[_0xc9cb('0xa')](_0xc9cb('0xe'),auth[_0xc9cb('0x8')](),controller['getMessages']);router[_0xc9cb('0xa')](_0xc9cb('0xf'),auth[_0xc9cb('0x8')](),controller[_0xc9cb('0x10')]);router[_0xc9cb('0x11')]('/',auth[_0xc9cb('0x8')](),controller['create']);router[_0xc9cb('0x11')](_0xc9cb('0xe'),auth[_0xc9cb('0x8')](),controller[_0xc9cb('0x12')]);router['post']('/:id/tags',auth[_0xc9cb('0x8')](),interaction[_0xc9cb('0x13')]('fax',_0xc9cb('0x14')),controller[_0xc9cb('0x15')]);router[_0xc9cb('0x16')]('/:id',auth[_0xc9cb('0x8')](),interaction[_0xc9cb('0x13')](_0xc9cb('0x17'),'faxinteraction:update'),controller['update']);router[_0xc9cb('0x18')](_0xc9cb('0xd'),auth['isAuthenticated'](),interaction[_0xc9cb('0x13')]('fax',_0xc9cb('0x19')),controller[_0xc9cb('0x1a')]);router['delete'](_0xc9cb('0x1b'),auth[_0xc9cb('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 4843f09..d738a47 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 _0x5645=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','out'];(function(_0x3d46a8,_0x385df8){var _0x521cc8=function(_0x5ab2c4){while(--_0x5ab2c4){_0x3d46a8['push'](_0x3d46a8['shift']());}};_0x521cc8(++_0x385df8);}(_0x5645,0x19e));var _0x5564=function(_0x4ce735,_0x328084){_0x4ce735=_0x4ce735-0x0;var _0x6d7a1=_0x5645[_0x4ce735];return _0x6d7a1;};'use strict';var Sequelize=require(_0x5564('0x0'));module[_0x5564('0x1')]={'body':{'type':Sequelize[_0x5564('0x2')](_0x5564('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x5564('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x5564('0x5')),'defaultValue':_0x5564('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x5564('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x5564('0x6')]}}; \ No newline at end of file +var _0xf9f7=['exports','TEXT','medium','BOOLEAN','ENUM','DATE','sequelize'];(function(_0x49831d,_0x302af0){var _0x42c997=function(_0x156ed3){while(--_0x156ed3){_0x49831d['push'](_0x49831d['shift']());}};_0x42c997(++_0x302af0);}(_0xf9f7,0xdf));var _0x7f9f=function(_0x212fcc,_0x1a8867){_0x212fcc=_0x212fcc-0x0;var _0x4d8190=_0xf9f7[_0x212fcc];return _0x4d8190;};'use strict';var Sequelize=require(_0x7f9f('0x0'));module[_0x7f9f('0x1')]={'body':{'type':Sequelize[_0x7f9f('0x2')](_0x7f9f('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x7f9f('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7f9f('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x7f9f('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x7f9f('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index c22cc49..3bb8add 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 _0x37e6=['./faxMessage.socket','register','client','http','then','info','debug','request\x20sent','stringify','error','FaxMessage,\x20%s,\x20%s','message','catch','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','sendStatus','stack','name','send','index','map','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','merge','filter','options','FaxMessage','include','findAll','rows','show','includeAll','body','find','params','describe','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','fax-interactions','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','User','fullname','event','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','eml-format','fast-json-patch','bluebird','mustache','util','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/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis'];(function(_0x133277,_0xb1d6b2){var _0x5b4a22=function(_0x484c26){while(--_0x484c26){_0x133277['push'](_0x133277['shift']());}};_0x5b4a22(++_0xb1d6b2);}(_0x37e6,0x75));var _0x637e=function(_0x2d5833,_0x1a5c3b){_0x2d5833=_0x2d5833-0x0;var _0x33bed7=_0x37e6[_0x2d5833];return _0x33bed7;};'use strict';var emlformat=require(_0x637e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x637e('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x637e('0x2'));var Mustache=require(_0x637e('0x3'));var util=require(_0x637e('0x4'));var path=require(_0x637e('0x5'));var sox=require(_0x637e('0x6'));var csv=require('to-csv');var ejs=require(_0x637e('0x7'));var fs=require('fs');var fs_extra=require(_0x637e('0x8'));var _=require(_0x637e('0x9'));var squel=require(_0x637e('0xa'));var crypto=require(_0x637e('0xb'));var jsforce=require(_0x637e('0xc'));var deskjs=require(_0x637e('0xd'));var toCsv=require(_0x637e('0xe'));var querystring=require(_0x637e('0xf'));var Papa=require(_0x637e('0x10'));var Redis=require(_0x637e('0x11'));var authService=require(_0x637e('0x12'));var qs=require(_0x637e('0x13'));var as=require(_0x637e('0x14'));var hardwareService=require(_0x637e('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x637e('0x16'));var licenseUtil=require(_0x637e('0x17'));var db=require(_0x637e('0x18'))['db'];config['redis']=_[_0x637e('0x19')](config['redis'],{'host':_0x637e('0x1a'),'port':0x18eb});var socket=require(_0x637e('0x1b'))(new Redis(config[_0x637e('0x1c')]));require(_0x637e('0x1d'))[_0x637e('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x637e('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x637e('0x1f')][_0x637e('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x115028,_0x11d4e5,_0x1b8fa1,_0x36cc49){return new BPromise(function(_0x4dc9c4,_0x32e975){var _0x2ebdff=_0x36cc49||client;return _0x2ebdff['request'](_0x115028,_0x1b8fa1)[_0x637e('0x21')](function(_0x318ef9){logger[_0x637e('0x22')]('FaxMessage,\x20%s,\x20%s',_0x11d4e5,'request\x20sent');logger[_0x637e('0x23')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x11d4e5,_0x637e('0x24'),JSON[_0x637e('0x25')](_0x318ef9));if(_0x318ef9[_0x637e('0x26')]){if(_0x318ef9[_0x637e('0x26')]['code']===0x1f4){logger['error'](_0x637e('0x27'),_0x11d4e5,_0x318ef9[_0x637e('0x26')][_0x637e('0x28')]);return _0x32e975(_0x318ef9[_0x637e('0x26')][_0x637e('0x28')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x11d4e5,_0x318ef9['error'][_0x637e('0x28')]);return _0x4dc9c4(_0x318ef9[_0x637e('0x26')][_0x637e('0x28')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x11d4e5,_0x637e('0x24'));_0x4dc9c4(_0x318ef9['result']['message']);}})[_0x637e('0x29')](function(_0x1f85ec){logger[_0x637e('0x26')](_0x637e('0x27'),_0x11d4e5,_0x1f85ec);_0x32e975(_0x1f85ec);});});}function respondWithStatusCode(_0x19a978,_0x136074){_0x136074=_0x136074||0xcc;return function(_0x50cb9f){if(_0x50cb9f){return _0x19a978['sendStatus'](_0x136074);}return _0x19a978['status'](_0x136074)[_0x637e('0x2a')]();};}function respondWithResult(_0x45523d,_0x596d2d){_0x596d2d=_0x596d2d||0xc8;return function(_0x3fc083){if(_0x3fc083){return _0x45523d[_0x637e('0x2b')](_0x596d2d)[_0x637e('0x2c')](_0x3fc083);}};}function respondWithFilteredResult(_0x29e58e,_0xc60818){return function(_0x58126a){if(_0x58126a){var _0x2c2efd=typeof _0xc60818[_0x637e('0x2d')]===_0x637e('0x2e')&&typeof _0xc60818[_0x637e('0x2f')]===_0x637e('0x2e');var _0x14a664=_0x58126a[_0x637e('0x30')];var _0x2f15f8=_0x2c2efd?0x0:_0xc60818[_0x637e('0x2d')];var _0x431e7e=_0x2c2efd?_0x58126a[_0x637e('0x30')]:_0xc60818[_0x637e('0x2d')]+_0xc60818[_0x637e('0x2f')];var _0x1cb0c8;if(_0x431e7e>=_0x14a664){_0x431e7e=_0x14a664;_0x1cb0c8=0xc8;}else{_0x1cb0c8=0xce;}_0x29e58e['status'](_0x1cb0c8);return _0x29e58e[_0x637e('0x31')](_0x637e('0x32'),_0x2f15f8+'-'+_0x431e7e+'/'+_0x14a664)[_0x637e('0x2c')](_0x58126a);}return null;};}function patchUpdates(_0x2afd07){return function(_0x316a6c){try{jsonpatch[_0x637e('0x33')](_0x316a6c,_0x2afd07,!![]);}catch(_0x4b4f89){return BPromise[_0x637e('0x34')](_0x4b4f89);}return _0x316a6c[_0x637e('0x35')]();};}function saveUpdates(_0x3d429d,_0x1eff8d){return function(_0x2e87b3){if(_0x2e87b3){return _0x2e87b3['update'](_0x3d429d)['then'](function(_0x2c9017){return _0x2c9017;});}return null;};}function removeEntity(_0x294554,_0x351d6e){return function(_0x3b9c8f){if(_0x3b9c8f){return _0x3b9c8f[_0x637e('0x36')]()[_0x637e('0x21')](function(){_0x294554[_0x637e('0x2b')](0xcc)[_0x637e('0x2a')]();});}};}function handleEntityNotFound(_0x1c3728,_0x2cdc2c){return function(_0x34d2f4){if(!_0x34d2f4){_0x1c3728[_0x637e('0x37')](0x194);}return _0x34d2f4;};}function handleError(_0x1973c6,_0x9907c3){_0x9907c3=_0x9907c3||0x1f4;return function(_0x46c974){logger['error'](_0x46c974[_0x637e('0x38')]);if(_0x46c974[_0x637e('0x39')]){delete _0x46c974[_0x637e('0x39')];}_0x1973c6['status'](_0x9907c3)[_0x637e('0x3a')](_0x46c974);};}exports[_0x637e('0x3b')]=function(_0x2fa0b8,_0x3250c1){var _0x4c3fb1={},_0x46854f={},_0x46a521={'count':0x0,'rows':[]};var _0x114443=_[_0x637e('0x3c')](db['FaxMessage']['rawAttributes'],function(_0x2edb74){return{'name':_0x2edb74[_0x637e('0x3d')],'type':_0x2edb74[_0x637e('0x3e')]['key']};});_0x46854f['model']=_[_0x637e('0x3c')](_0x114443,'name');_0x46854f[_0x637e('0x3f')]=_[_0x637e('0x40')](_0x2fa0b8[_0x637e('0x3f')]);_0x46854f[_0x637e('0x41')]=_[_0x637e('0x42')](_0x46854f['model'],_0x46854f[_0x637e('0x3f')]);_0x4c3fb1[_0x637e('0x43')]=_[_0x637e('0x42')](_0x46854f[_0x637e('0x44')],qs[_0x637e('0x45')](_0x2fa0b8[_0x637e('0x3f')][_0x637e('0x45')]));_0x4c3fb1[_0x637e('0x43')]=_0x4c3fb1[_0x637e('0x43')][_0x637e('0x46')]?_0x4c3fb1[_0x637e('0x43')]:_0x46854f[_0x637e('0x44')];if(!_0x2fa0b8['query']['hasOwnProperty'](_0x637e('0x47'))){_0x4c3fb1[_0x637e('0x2f')]=qs['limit'](_0x2fa0b8[_0x637e('0x3f')]['limit']);_0x4c3fb1['offset']=qs['offset'](_0x2fa0b8[_0x637e('0x3f')][_0x637e('0x2d')]);}_0x4c3fb1[_0x637e('0x48')]=qs[_0x637e('0x49')](_0x2fa0b8[_0x637e('0x3f')][_0x637e('0x49')]);_0x4c3fb1[_0x637e('0x4a')]=qs[_0x637e('0x41')](_[_0x637e('0x4b')](_0x2fa0b8[_0x637e('0x3f')],_0x46854f[_0x637e('0x41')]),_0x114443);if(_0x2fa0b8[_0x637e('0x3f')]['filter']){_0x4c3fb1['where']=_[_0x637e('0x4c')](_0x4c3fb1[_0x637e('0x4a')],{'$or':_['map'](_0x114443,function(_0x5221b3){if(_0x5221b3[_0x637e('0x3e')]!=='VIRTUAL'){var _0x15b62c={};_0x15b62c[_0x5221b3[_0x637e('0x39')]]={'$like':'%'+_0x2fa0b8[_0x637e('0x3f')][_0x637e('0x4d')]+'%'};return _0x15b62c;}})});}_0x4c3fb1=_[_0x637e('0x4c')]({},_0x4c3fb1,_0x2fa0b8[_0x637e('0x4e')]);var _0x2984b6={'where':_0x4c3fb1[_0x637e('0x4a')]};return db[_0x637e('0x4f')][_0x637e('0x30')](_0x2984b6)['then'](function(_0x1d9555){_0x46a521['count']=_0x1d9555;if(_0x2fa0b8[_0x637e('0x3f')]['includeAll']){_0x4c3fb1[_0x637e('0x50')]=[{'all':!![]}];}return db['FaxMessage'][_0x637e('0x51')](_0x4c3fb1);})[_0x637e('0x21')](function(_0x37ed2c){_0x46a521[_0x637e('0x52')]=_0x37ed2c;return _0x46a521;})['then'](respondWithFilteredResult(_0x3250c1,_0x4c3fb1))[_0x637e('0x29')](handleError(_0x3250c1,null));};exports[_0x637e('0x53')]=function(_0x47efb5,_0x408adb){var _0x39498f={'raw':!![],'where':{'id':_0x47efb5['params']['id']}},_0x57394d={};_0x57394d[_0x637e('0x44')]=_[_0x637e('0x40')](db[_0x637e('0x4f')]['rawAttributes']);_0x57394d[_0x637e('0x3f')]=_[_0x637e('0x40')](_0x47efb5[_0x637e('0x3f')]);_0x57394d[_0x637e('0x41')]=_['intersection'](_0x57394d[_0x637e('0x44')],_0x57394d[_0x637e('0x3f')]);_0x39498f[_0x637e('0x43')]=_[_0x637e('0x42')](_0x57394d[_0x637e('0x44')],qs[_0x637e('0x45')](_0x47efb5[_0x637e('0x3f')][_0x637e('0x45')]));_0x39498f[_0x637e('0x43')]=_0x39498f[_0x637e('0x43')][_0x637e('0x46')]?_0x39498f[_0x637e('0x43')]:_0x57394d[_0x637e('0x44')];if(_0x47efb5[_0x637e('0x3f')][_0x637e('0x54')]){_0x39498f[_0x637e('0x50')]=[{'all':!![]}];}_0x39498f=_[_0x637e('0x4c')]({},_0x39498f,_0x47efb5[_0x637e('0x4e')]);return db[_0x637e('0x4f')]['find'](_0x39498f)[_0x637e('0x21')](handleEntityNotFound(_0x408adb,null))[_0x637e('0x21')](respondWithResult(_0x408adb,null))[_0x637e('0x29')](handleError(_0x408adb,null));};exports['update']=function(_0x5b0576,_0x50a6e9){if(_0x5b0576[_0x637e('0x55')]['id']){delete _0x5b0576[_0x637e('0x55')]['id'];}return db[_0x637e('0x4f')][_0x637e('0x56')]({'where':{'id':_0x5b0576[_0x637e('0x57')]['id']}})['then'](handleEntityNotFound(_0x50a6e9,null))[_0x637e('0x21')](saveUpdates(_0x5b0576[_0x637e('0x55')],null))[_0x637e('0x21')](respondWithResult(_0x50a6e9,null))[_0x637e('0x29')](handleError(_0x50a6e9,null));};exports['destroy']=function(_0x297ec1,_0x3a6fdf){return db[_0x637e('0x4f')][_0x637e('0x56')]({'where':{'id':_0x297ec1[_0x637e('0x57')]['id']}})['then'](handleEntityNotFound(_0x3a6fdf,null))[_0x637e('0x21')](removeEntity(_0x3a6fdf,null))['catch'](handleError(_0x3a6fdf,null));};exports[_0x637e('0x58')]=function(_0x48726b,_0x5bc7a9){return db[_0x637e('0x4f')]['describe']()[_0x637e('0x21')](respondWithResult(_0x5bc7a9,null))[_0x637e('0x29')](handleError(_0x5bc7a9,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x637e('0x59')]=function(_0x585c16,_0x5da093,_0x1ba775){var _0x1a2b5d={'agent':{},'channel':_0x637e('0x5a')};if(_0x585c16[_0x637e('0x55')]['id']){delete _0x585c16['body']['id'];}_0x585c16[_0x637e('0x55')][_0x637e('0x5b')]=!![];_0x585c16[_0x637e('0x55')][_0x637e('0x5c')]=moment()[_0x637e('0x5d')](_0x637e('0x5e'));_0x585c16[_0x637e('0x55')][_0x637e('0x5f')]=_0x585c16[_0x637e('0x55')][_0x637e('0x5f')]||_0x585c16[_0x637e('0x60')]['id'];_0x1a2b5d[_0x637e('0x61')]['id']=_0x585c16[_0x637e('0x55')][_0x637e('0x5f')];return db[_0x637e('0x4f')][_0x637e('0x56')]({'where':{'id':_0x585c16[_0x637e('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5da093,null))[_0x637e('0x21')](saveUpdates(_0x585c16[_0x637e('0x55')],null))[_0x637e('0x21')](function(_0xf5fe1){if(_0xf5fe1){_0x1a2b5d[_0x637e('0x28')]=_0xf5fe1[_0x637e('0x62')]({'plain':!![]});return db['FaxInteraction'][_0x637e('0x56')]({'where':{'id':_0xf5fe1[_0x637e('0x63')]}});}return null;})[_0x637e('0x21')](handleEntityNotFound(_0x5da093,null))['then'](function(_0x16e629){if(_0x16e629){return _0x16e629['update']({'UserId':_0x585c16[_0x637e('0x55')][_0x637e('0x5f')],'read1stAt':_[_0x637e('0x64')](_0x16e629[_0x637e('0x65')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x637e('0x21')](function(_0x4847e6){if(_0x4847e6){_0x1a2b5d[_0x637e('0x66')]=_0x4847e6[_0x637e('0x62')]({'plain':!![]});interaction_log[_0x637e('0x22')](_0x637e('0x67'),_0x585c16[_0x637e('0x60')]['id'],_0x585c16['user'][_0x637e('0x39')],_0x585c16[_0x637e('0x60')][_0x637e('0x68')],_0x1a2b5d[_0x637e('0x66')]['id'],_0x585c16[_0x637e('0x55')]?JSON['stringify'](_0x585c16[_0x637e('0x55')]):_0x637e('0x69'));return respondWithRpcPromise(_0x637e('0x6a'),_0x637e('0x6b'),_0x1a2b5d);}return null;})[_0x637e('0x21')](function(_0x133147){var _0x537cb3='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x133147[_0x637e('0x28')][_0x637e('0x6c')];return db[_0x637e('0x6d')][_0x637e('0x3f')](_0x537cb3,{'type':db['Sequelize'][_0x637e('0x6e')][_0x637e('0x6f')],'raw':!![]})[_0x637e('0x21')](function(_0x15e22f){return _0x15e22f;});})[_0x637e('0x21')](function(_0x38ba72){if(_0x38ba72){_0x1a2b5d['message'][_0x637e('0x70')]=_0x38ba72[0x0];if(!_0x585c16[_0x637e('0x55')][_0x637e('0x5f')])return;return db['User'][_0x637e('0x56')]({'where':{'id':_0x585c16[_0x637e('0x55')]['UserId'],'role':_0x637e('0x61')},'attributes':['id',_0x637e('0x39'),'fullname',_0x637e('0x71'),_0x637e('0x72')],'raw':!![]});}return null;})[_0x637e('0x21')](function(_0x10180d){if(!_0x10180d)return null;_0x1a2b5d[_0x637e('0x28')][_0x637e('0x61')]=_0x10180d;return _0x1a2b5d;})[_0x637e('0x21')](function(_0x578c7b){if(_0x578c7b){if(_0x585c16['body'][_0x637e('0x73')]){_0x1a2b5d['message'][_0x637e('0x74')]=util[_0x637e('0x5d')](_0x637e('0x75'),_0x585c16[_0x637e('0x60')]['name']);_0x1a2b5d[_0x637e('0x28')]['channel']=_0x1a2b5d[_0x637e('0x76')];_0x1a2b5d[_0x637e('0x28')][_0x637e('0x77')]=_0x1a2b5d[_0x637e('0x76')];_0x1a2b5d[_0x637e('0x28')]['event']=_0x637e('0x59');return respondWithRpcPromise(_0x637e('0x78'),_0x637e('0x78'),{'event':_0x637e('0x79'),'message':_0x1a2b5d[_0x637e('0x28')]},client9002)[_0x637e('0x21')](function(){return _0x1a2b5d;});}return _0x1a2b5d;}return null;})['then'](respondWithResult(_0x5da093,null))['catch'](handleError(_0x5da093,null));};var interaction_log=require('../../config/logger')(_0x637e('0x7a'));exports[_0x637e('0x34')]=function(_0x1a1664,_0x5488ec,_0x3f3cb4){var _0x89aea4={'agent':{},'channel':'fax'};if(_0x1a1664[_0x637e('0x55')]['id']){delete _0x1a1664[_0x637e('0x55')]['id'];}_0x1a1664[_0x637e('0x55')][_0x637e('0x5f')]=_0x1a1664[_0x637e('0x55')][_0x637e('0x5f')]||_0x1a1664[_0x637e('0x60')]['id'];_0x89aea4['agent']['id']=_0x1a1664[_0x637e('0x55')][_0x637e('0x5f')];return db[_0x637e('0x4f')]['find']({'where':{'id':_0x1a1664[_0x637e('0x57')]['id'],'UserId':null}})[_0x637e('0x21')](handleEntityNotFound(_0x5488ec,null))['then'](function(_0x22623d){if(_0x22623d){_0x89aea4['message']=_0x22623d[_0x637e('0x62')]({'plain':!![]});return db[_0x637e('0x7b')][_0x637e('0x56')]({'where':{'id':_0x22623d[_0x637e('0x63')]}});}return null;})[_0x637e('0x21')](handleEntityNotFound(_0x5488ec,null))[_0x637e('0x21')](function(_0x4c8f17){if(_0x4c8f17){_0x89aea4[_0x637e('0x66')]=_0x4c8f17[_0x637e('0x62')]({'plain':!![]});interaction_log['info'](_0x637e('0x7c'),_0x1a1664[_0x637e('0x60')]['id'],_0x1a1664[_0x637e('0x60')][_0x637e('0x39')],_0x1a1664[_0x637e('0x60')]['role'],_0x89aea4[_0x637e('0x66')]['id'],_0x1a1664['body']?JSON['stringify'](_0x1a1664['body']):_0x637e('0x69'));return respondWithRpcPromise(_0x637e('0x7d'),'rejectMessage',_0x89aea4);}return null;})['then'](function(_0xdf9781){var _0x3277d4=_0x637e('0x7e')+_0xdf9781['message'][_0x637e('0x6c')];return db[_0x637e('0x6d')][_0x637e('0x3f')](_0x3277d4,{'type':db[_0x637e('0x7f')]['QueryTypes'][_0x637e('0x6f')],'raw':!![]})['then'](function(_0x57db68){return _0x57db68;});})[_0x637e('0x21')](function(_0x13b515){if(_0x13b515){_0x89aea4[_0x637e('0x28')][_0x637e('0x70')]=_0x13b515[0x0];if(!_0x1a1664[_0x637e('0x55')][_0x637e('0x5f')])return;return db[_0x637e('0x80')][_0x637e('0x56')]({'where':{'id':_0x1a1664[_0x637e('0x55')][_0x637e('0x5f')],'role':'agent'},'attributes':['id','name',_0x637e('0x81'),_0x637e('0x71'),_0x637e('0x72')],'raw':!![]});}return null;})[_0x637e('0x21')](function(_0x580e10){if(!_0x580e10)return null;_0x89aea4[_0x637e('0x28')][_0x637e('0x61')]=_0x580e10;return _0x89aea4;})[_0x637e('0x21')](function(_0x5a947a){if(_0x5a947a){_0x5a947a[_0x637e('0x28')][_0x637e('0x74')]=util[_0x637e('0x5d')]('SIP/%s',_0x1a1664['user'][_0x637e('0x39')]);_0x5a947a[_0x637e('0x28')]['channel']=_0x89aea4[_0x637e('0x76')];_0x5a947a[_0x637e('0x28')][_0x637e('0x77')]=_0x89aea4['channel'];_0x5a947a[_0x637e('0x28')][_0x637e('0x82')]='reject';respondWithRpcPromise(_0x637e('0x78'),_0x637e('0x78'),{'event':'rejectmessage','message':_0x5a947a[_0x637e('0x28')]},client9002);return _0x89aea4;}return null;})[_0x637e('0x21')](respondWithResult(_0x5488ec,null))[_0x637e('0x29')](handleError(_0x5488ec,null));};exports[_0x637e('0x83')]=function(_0x109265,_0x51d1c2){var _0x446f04;return db[_0x637e('0x4f')]['create'](_0x109265[_0x637e('0x55')],{})[_0x637e('0x21')](function(_0xb5833f){_0x446f04=_0xb5833f;return db[_0x637e('0x84')][_0x637e('0x85')]({'where':{'id':_0x446f04[_0x637e('0x6c')]}});})[_0x637e('0x21')](function(_0x26e9b9){if(_['isNil'](_0x26e9b9)){return;}else{_0x446f04[_0x637e('0x5a')]=_0x26e9b9[_0x637e('0x5a')];return db[_0x637e('0x86')]['findOne']({'where':{'id':_0x446f04[_0x637e('0x87')]}});}})[_0x637e('0x21')](function(_0x3aa6f1){return respondWithRpcPromise(_0x637e('0x88'),_0x637e('0x88'),{'FaxAccountId':_[_0x637e('0x64')](_0x109265['body'])?undefined:_0x109265[_0x637e('0x55')][_0x637e('0x89')],'path':_[_0x637e('0x64')](_0x3aa6f1)?undefined:util[_0x637e('0x5d')](_0x637e('0x8a'),_0x3aa6f1[_0x637e('0x8b')]),'fax':_['isNil'](_0x446f04[_0x637e('0x5a')])?undefined:_0x446f04['fax'],'AttachmentId':_0x446f04[_0x637e('0x87')]},client9002);})[_0x637e('0x21')](respondWithResult(_0x51d1c2,0xc9))[_0x637e('0x29')](handleError(_0x51d1c2,null));};exports[_0x637e('0x8c')]=function(_0x4aaba5,_0x14a673){var _0x1dd03c=path[_0x637e('0x8d')](config[_0x637e('0x8e')],_0x637e('0x8f'),_0x637e('0x90'),_0x637e('0x91'));return db[_0x637e('0x4f')][_0x637e('0x56')]({'where':{'id':_0x4aaba5['params']['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x14a673,null))[_0x637e('0x21')](function(_0x50a394){if(_0x50a394){return _0x14a673[_0x637e('0x8c')](path[_0x637e('0x8d')](_0x1dd03c,_0x50a394[_0x637e('0x86')][_0x637e('0x8b')]));}})[_0x637e('0x29')](handleError(_0x14a673,null));}; \ No newline at end of file +var _0x3c70=['filters','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','fields','include','find','body','describe','fax-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','isNil','read1stAt','role','interaction','null','AcceptMessage','acceptMessage','sequelize','Sequelize','SELECT','User','fullname','internal','interface','SIP/%s','channel','event','accept','acceptmessage','fax','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','email','motionChannel','create','CmContact','findOne','ContactId','Attachment','SendFax','FaxAccountId','basename','AttachmentId','download','join','root','server','files','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','jayson/promise','client','http','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','status','end','limit','count','offset','set','Content-Range','json','reject','save','update','destroy','sendStatus','stack','name','index','FaxMessage','rawAttributes','type','key','model','map','query','keys','intersection','attributes','length','hasOwnProperty','order','sort','where'];(function(_0x57313c,_0x3b0080){var _0x5ca2f6=function(_0x4ad4de){while(--_0x4ad4de){_0x57313c['push'](_0x57313c['shift']());}};_0x5ca2f6(++_0x3b0080);}(_0x3c70,0x1e8));var _0x03c7=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x3c70[_0x5b78e8];return _0xf2c321;};'use strict';var emlformat=require(_0x03c7('0x0'));var rimraf=require(_0x03c7('0x1'));var zipdir=require(_0x03c7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x03c7('0x3'));var moment=require(_0x03c7('0x4'));var BPromise=require(_0x03c7('0x5'));var Mustache=require(_0x03c7('0x6'));var util=require(_0x03c7('0x7'));var path=require(_0x03c7('0x8'));var sox=require(_0x03c7('0x9'));var csv=require(_0x03c7('0xa'));var ejs=require(_0x03c7('0xb'));var fs=require('fs');var fs_extra=require(_0x03c7('0xc'));var _=require(_0x03c7('0xd'));var squel=require(_0x03c7('0xe'));var crypto=require(_0x03c7('0xf'));var jsforce=require(_0x03c7('0x10'));var deskjs=require(_0x03c7('0x11'));var toCsv=require('to-csv');var querystring=require(_0x03c7('0x12'));var Papa=require(_0x03c7('0x13'));var Redis=require(_0x03c7('0x14'));var authService=require(_0x03c7('0x15'));var qs=require(_0x03c7('0x16'));var as=require(_0x03c7('0x17'));var hardwareService=require(_0x03c7('0x18'));var logger=require(_0x03c7('0x19'))(_0x03c7('0x1a'));var utils=require('../../config/utils');var config=require(_0x03c7('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x03c7('0x1c'))['db'];config[_0x03c7('0x1d')]=_['defaults'](config['redis'],{'host':_0x03c7('0x1e'),'port':0x18eb});var socket=require(_0x03c7('0x1f'))(new Redis(config[_0x03c7('0x1d')]));require('./faxMessage.socket')['register'](socket);var jayson=require(_0x03c7('0x20'));var client=jayson[_0x03c7('0x21')]['http']({'port':0x232c});var client9002=jayson[_0x03c7('0x21')][_0x03c7('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x4eebea,_0x2f02d2,_0x3b7310,_0x50d83a){return new BPromise(function(_0x421fdf,_0x4ae725){var _0x338960=_0x50d83a||client;return _0x338960['request'](_0x4eebea,_0x3b7310)[_0x03c7('0x23')](function(_0x43f6dc){logger[_0x03c7('0x24')](_0x03c7('0x25'),_0x2f02d2,_0x03c7('0x26'));logger[_0x03c7('0x27')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x2f02d2,'request\x20sent',JSON[_0x03c7('0x28')](_0x43f6dc));if(_0x43f6dc['error']){if(_0x43f6dc[_0x03c7('0x29')]['code']===0x1f4){logger[_0x03c7('0x29')]('FaxMessage,\x20%s,\x20%s',_0x2f02d2,_0x43f6dc['error'][_0x03c7('0x2a')]);return _0x4ae725(_0x43f6dc[_0x03c7('0x29')][_0x03c7('0x2a')]);}logger[_0x03c7('0x29')]('FaxMessage,\x20%s,\x20%s',_0x2f02d2,_0x43f6dc['error'][_0x03c7('0x2a')]);return _0x421fdf(_0x43f6dc[_0x03c7('0x29')][_0x03c7('0x2a')]);}else{logger[_0x03c7('0x24')](_0x03c7('0x25'),_0x2f02d2,_0x03c7('0x26'));_0x421fdf(_0x43f6dc[_0x03c7('0x2b')][_0x03c7('0x2a')]);}})[_0x03c7('0x2c')](function(_0x52c44f){logger[_0x03c7('0x29')]('FaxMessage,\x20%s,\x20%s',_0x2f02d2,_0x52c44f);_0x4ae725(_0x52c44f);});});}function respondWithStatusCode(_0x342977,_0x2c9754){_0x2c9754=_0x2c9754||0xcc;return function(_0x38340d){if(_0x38340d){return _0x342977['sendStatus'](_0x2c9754);}return _0x342977[_0x03c7('0x2d')](_0x2c9754)[_0x03c7('0x2e')]();};}function respondWithResult(_0x46d426,_0x33bcba){_0x33bcba=_0x33bcba||0xc8;return function(_0x5f0877){if(_0x5f0877){return _0x46d426[_0x03c7('0x2d')](_0x33bcba)['json'](_0x5f0877);}};}function respondWithFilteredResult(_0x1f4913,_0x479c6c){return function(_0x59b689){if(_0x59b689){var _0x280fe1=typeof _0x479c6c['offset']==='undefined'&&typeof _0x479c6c[_0x03c7('0x2f')]==='undefined';var _0x111fe1=_0x59b689[_0x03c7('0x30')];var _0x26cc95=_0x280fe1?0x0:_0x479c6c[_0x03c7('0x31')];var _0x19c2cd=_0x280fe1?_0x59b689[_0x03c7('0x30')]:_0x479c6c['offset']+_0x479c6c[_0x03c7('0x2f')];var _0x16d490;if(_0x19c2cd>=_0x111fe1){_0x19c2cd=_0x111fe1;_0x16d490=0xc8;}else{_0x16d490=0xce;}_0x1f4913[_0x03c7('0x2d')](_0x16d490);return _0x1f4913[_0x03c7('0x32')](_0x03c7('0x33'),_0x26cc95+'-'+_0x19c2cd+'/'+_0x111fe1)[_0x03c7('0x34')](_0x59b689);}return null;};}function patchUpdates(_0x30df35){return function(_0x2579c0){try{jsonpatch['apply'](_0x2579c0,_0x30df35,!![]);}catch(_0x340017){return BPromise[_0x03c7('0x35')](_0x340017);}return _0x2579c0[_0x03c7('0x36')]();};}function saveUpdates(_0x1d06f9,_0x3610be){return function(_0x421b75){if(_0x421b75){return _0x421b75[_0x03c7('0x37')](_0x1d06f9)[_0x03c7('0x23')](function(_0x4ae83d){return _0x4ae83d;});}return null;};}function removeEntity(_0x39cf12,_0x589e9d){return function(_0x795a7c){if(_0x795a7c){return _0x795a7c[_0x03c7('0x38')]()[_0x03c7('0x23')](function(){_0x39cf12[_0x03c7('0x2d')](0xcc)[_0x03c7('0x2e')]();});}};}function handleEntityNotFound(_0x36c03f,_0xa1cd82){return function(_0x42b5be){if(!_0x42b5be){_0x36c03f[_0x03c7('0x39')](0x194);}return _0x42b5be;};}function handleError(_0x4370ce,_0x3074e9){_0x3074e9=_0x3074e9||0x1f4;return function(_0x379a7a){logger[_0x03c7('0x29')](_0x379a7a[_0x03c7('0x3a')]);if(_0x379a7a[_0x03c7('0x3b')]){delete _0x379a7a[_0x03c7('0x3b')];}_0x4370ce['status'](_0x3074e9)['send'](_0x379a7a);};}exports[_0x03c7('0x3c')]=function(_0x5d37b4,_0x3c580e){var _0x23b1ae={},_0x355d1a={},_0x127b82={'count':0x0,'rows':[]};var _0x7ad42d=_['map'](db[_0x03c7('0x3d')][_0x03c7('0x3e')],function(_0x44f0d1){return{'name':_0x44f0d1['fieldName'],'type':_0x44f0d1[_0x03c7('0x3f')][_0x03c7('0x40')]};});_0x355d1a[_0x03c7('0x41')]=_[_0x03c7('0x42')](_0x7ad42d,_0x03c7('0x3b'));_0x355d1a[_0x03c7('0x43')]=_[_0x03c7('0x44')](_0x5d37b4['query']);_0x355d1a['filters']=_[_0x03c7('0x45')](_0x355d1a[_0x03c7('0x41')],_0x355d1a['query']);_0x23b1ae[_0x03c7('0x46')]=_[_0x03c7('0x45')](_0x355d1a[_0x03c7('0x41')],qs['fields'](_0x5d37b4[_0x03c7('0x43')]['fields']));_0x23b1ae[_0x03c7('0x46')]=_0x23b1ae['attributes'][_0x03c7('0x47')]?_0x23b1ae[_0x03c7('0x46')]:_0x355d1a[_0x03c7('0x41')];if(!_0x5d37b4[_0x03c7('0x43')][_0x03c7('0x48')]('nolimit')){_0x23b1ae[_0x03c7('0x2f')]=qs[_0x03c7('0x2f')](_0x5d37b4['query'][_0x03c7('0x2f')]);_0x23b1ae[_0x03c7('0x31')]=qs['offset'](_0x5d37b4['query'][_0x03c7('0x31')]);}_0x23b1ae[_0x03c7('0x49')]=qs[_0x03c7('0x4a')](_0x5d37b4[_0x03c7('0x43')][_0x03c7('0x4a')]);_0x23b1ae[_0x03c7('0x4b')]=qs['filters'](_['pick'](_0x5d37b4[_0x03c7('0x43')],_0x355d1a[_0x03c7('0x4c')]),_0x7ad42d);if(_0x5d37b4[_0x03c7('0x43')]['filter']){_0x23b1ae['where']=_[_0x03c7('0x4d')](_0x23b1ae['where'],{'$or':_[_0x03c7('0x42')](_0x7ad42d,function(_0x3d271f){if(_0x3d271f[_0x03c7('0x3f')]!==_0x03c7('0x4e')){var _0x25a2a9={};_0x25a2a9[_0x3d271f[_0x03c7('0x3b')]]={'$like':'%'+_0x5d37b4[_0x03c7('0x43')]['filter']+'%'};return _0x25a2a9;}})});}_0x23b1ae=_[_0x03c7('0x4d')]({},_0x23b1ae,_0x5d37b4[_0x03c7('0x4f')]);var _0x4968cd={'where':_0x23b1ae[_0x03c7('0x4b')]};return db[_0x03c7('0x3d')][_0x03c7('0x30')](_0x4968cd)['then'](function(_0x2f0cd2){_0x127b82[_0x03c7('0x30')]=_0x2f0cd2;if(_0x5d37b4[_0x03c7('0x43')][_0x03c7('0x50')]){_0x23b1ae['include']=[{'all':!![]}];}return db[_0x03c7('0x3d')][_0x03c7('0x51')](_0x23b1ae);})[_0x03c7('0x23')](function(_0x2e5c2b){_0x127b82[_0x03c7('0x52')]=_0x2e5c2b;return _0x127b82;})[_0x03c7('0x23')](respondWithFilteredResult(_0x3c580e,_0x23b1ae))['catch'](handleError(_0x3c580e,null));};exports[_0x03c7('0x53')]=function(_0x4c660e,_0x44b445){var _0x783c93={'raw':!![],'where':{'id':_0x4c660e[_0x03c7('0x54')]['id']}},_0x555abb={};_0x555abb[_0x03c7('0x41')]=_[_0x03c7('0x44')](db[_0x03c7('0x3d')]['rawAttributes']);_0x555abb[_0x03c7('0x43')]=_[_0x03c7('0x44')](_0x4c660e['query']);_0x555abb[_0x03c7('0x4c')]=_[_0x03c7('0x45')](_0x555abb[_0x03c7('0x41')],_0x555abb['query']);_0x783c93[_0x03c7('0x46')]=_[_0x03c7('0x45')](_0x555abb['model'],qs[_0x03c7('0x55')](_0x4c660e['query'][_0x03c7('0x55')]));_0x783c93[_0x03c7('0x46')]=_0x783c93[_0x03c7('0x46')]['length']?_0x783c93[_0x03c7('0x46')]:_0x555abb[_0x03c7('0x41')];if(_0x4c660e['query'][_0x03c7('0x50')]){_0x783c93[_0x03c7('0x56')]=[{'all':!![]}];}_0x783c93=_[_0x03c7('0x4d')]({},_0x783c93,_0x4c660e[_0x03c7('0x4f')]);return db[_0x03c7('0x3d')][_0x03c7('0x57')](_0x783c93)['then'](handleEntityNotFound(_0x44b445,null))[_0x03c7('0x23')](respondWithResult(_0x44b445,null))['catch'](handleError(_0x44b445,null));};exports['update']=function(_0x3a3ee6,_0x262c00){if(_0x3a3ee6[_0x03c7('0x58')]['id']){delete _0x3a3ee6[_0x03c7('0x58')]['id'];}return db[_0x03c7('0x3d')][_0x03c7('0x57')]({'where':{'id':_0x3a3ee6[_0x03c7('0x54')]['id']}})[_0x03c7('0x23')](handleEntityNotFound(_0x262c00,null))[_0x03c7('0x23')](saveUpdates(_0x3a3ee6[_0x03c7('0x58')],null))['then'](respondWithResult(_0x262c00,null))['catch'](handleError(_0x262c00,null));};exports[_0x03c7('0x38')]=function(_0x27005a,_0x1b1adb){return db[_0x03c7('0x3d')][_0x03c7('0x57')]({'where':{'id':_0x27005a[_0x03c7('0x54')]['id']}})['then'](handleEntityNotFound(_0x1b1adb,null))['then'](removeEntity(_0x1b1adb,null))['catch'](handleError(_0x1b1adb,null));};exports['describe']=function(_0x454e71,_0x30e807){return db[_0x03c7('0x3d')][_0x03c7('0x59')]()[_0x03c7('0x23')](respondWithResult(_0x30e807,null))[_0x03c7('0x2c')](handleError(_0x30e807,null));};var interaction_log=require('../../config/logger')(_0x03c7('0x5a'));exports['accept']=function(_0x4ba32c,_0x121bf3,_0x3866e2){var _0x10bbad={'agent':{},'channel':'fax'};if(_0x4ba32c[_0x03c7('0x58')]['id']){delete _0x4ba32c['body']['id'];}_0x4ba32c[_0x03c7('0x58')][_0x03c7('0x5b')]=!![];_0x4ba32c[_0x03c7('0x58')][_0x03c7('0x5c')]=moment()[_0x03c7('0x5d')](_0x03c7('0x5e'));_0x4ba32c['body'][_0x03c7('0x5f')]=_0x4ba32c[_0x03c7('0x58')][_0x03c7('0x5f')]||_0x4ba32c[_0x03c7('0x60')]['id'];_0x10bbad[_0x03c7('0x61')]['id']=_0x4ba32c['body']['UserId'];return db[_0x03c7('0x3d')][_0x03c7('0x57')]({'where':{'id':_0x4ba32c['params']['id'],'UserId':null}})[_0x03c7('0x23')](handleEntityNotFound(_0x121bf3,null))[_0x03c7('0x23')](saveUpdates(_0x4ba32c[_0x03c7('0x58')],null))['then'](function(_0x4f2e56){if(_0x4f2e56){_0x10bbad[_0x03c7('0x2a')]=_0x4f2e56[_0x03c7('0x62')]({'plain':!![]});return db[_0x03c7('0x63')][_0x03c7('0x57')]({'where':{'id':_0x4f2e56['FaxInteractionId']}});}return null;})[_0x03c7('0x23')](handleEntityNotFound(_0x121bf3,null))['then'](function(_0x22d0df){if(_0x22d0df){return _0x22d0df[_0x03c7('0x37')]({'UserId':_0x4ba32c[_0x03c7('0x58')][_0x03c7('0x5f')],'read1stAt':_[_0x03c7('0x64')](_0x22d0df[_0x03c7('0x65')])?moment()[_0x03c7('0x5d')](_0x03c7('0x5e')):undefined});}return null;})[_0x03c7('0x23')](function(_0x1d5fd1){if(_0x1d5fd1){_0x10bbad['interaction']=_0x1d5fd1[_0x03c7('0x62')]({'plain':!![]});interaction_log[_0x03c7('0x24')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4ba32c[_0x03c7('0x60')]['id'],_0x4ba32c[_0x03c7('0x60')][_0x03c7('0x3b')],_0x4ba32c[_0x03c7('0x60')][_0x03c7('0x66')],_0x10bbad[_0x03c7('0x67')]['id'],_0x4ba32c[_0x03c7('0x58')]?JSON[_0x03c7('0x28')](_0x4ba32c[_0x03c7('0x58')]):_0x03c7('0x68'));return respondWithRpcPromise(_0x03c7('0x69'),_0x03c7('0x6a'),_0x10bbad);}return null;})['then'](function(_0x116892){var _0x3eac5a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x116892[_0x03c7('0x2a')]['ContactId'];return db[_0x03c7('0x6b')][_0x03c7('0x43')](_0x3eac5a,{'type':db[_0x03c7('0x6c')]['QueryTypes'][_0x03c7('0x6d')],'raw':!![]})[_0x03c7('0x23')](function(_0x34ab2a){return _0x34ab2a;});})[_0x03c7('0x23')](function(_0x48b05b){if(_0x48b05b){_0x10bbad[_0x03c7('0x2a')]['contact']=_0x48b05b[0x0];if(!_0x4ba32c[_0x03c7('0x58')][_0x03c7('0x5f')])return;return db[_0x03c7('0x6e')][_0x03c7('0x57')]({'where':{'id':_0x4ba32c[_0x03c7('0x58')][_0x03c7('0x5f')],'role':_0x03c7('0x61')},'attributes':['id','name',_0x03c7('0x6f'),'email',_0x03c7('0x70')],'raw':!![]});}return null;})['then'](function(_0x4605f6){if(!_0x4605f6)return null;_0x10bbad[_0x03c7('0x2a')]['agent']=_0x4605f6;return _0x10bbad;})[_0x03c7('0x23')](function(_0x25bbcc){if(_0x25bbcc){if(_0x4ba32c['body']['manual']){_0x10bbad['message'][_0x03c7('0x71')]=util['format'](_0x03c7('0x72'),_0x4ba32c['user'][_0x03c7('0x3b')]);_0x10bbad[_0x03c7('0x2a')]['channel']=_0x10bbad[_0x03c7('0x73')];_0x10bbad[_0x03c7('0x2a')]['motionChannel']=_0x10bbad[_0x03c7('0x73')];_0x10bbad['message'][_0x03c7('0x74')]=_0x03c7('0x75');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x03c7('0x76'),'message':_0x10bbad[_0x03c7('0x2a')]},client9002)[_0x03c7('0x23')](function(){return _0x10bbad;});}return _0x10bbad;}return null;})['then'](respondWithResult(_0x121bf3,null))[_0x03c7('0x2c')](handleError(_0x121bf3,null));};var interaction_log=require(_0x03c7('0x19'))(_0x03c7('0x5a'));exports[_0x03c7('0x35')]=function(_0x160b22,_0x45dd1f,_0x312174){var _0x8d7181={'agent':{},'channel':_0x03c7('0x77')};if(_0x160b22[_0x03c7('0x58')]['id']){delete _0x160b22[_0x03c7('0x58')]['id'];}_0x160b22['body']['UserId']=_0x160b22[_0x03c7('0x58')]['UserId']||_0x160b22[_0x03c7('0x60')]['id'];_0x8d7181[_0x03c7('0x61')]['id']=_0x160b22['body'][_0x03c7('0x5f')];return db[_0x03c7('0x3d')][_0x03c7('0x57')]({'where':{'id':_0x160b22[_0x03c7('0x54')]['id'],'UserId':null}})[_0x03c7('0x23')](handleEntityNotFound(_0x45dd1f,null))[_0x03c7('0x23')](function(_0x5c0dbe){if(_0x5c0dbe){_0x8d7181[_0x03c7('0x2a')]=_0x5c0dbe[_0x03c7('0x62')]({'plain':!![]});return db[_0x03c7('0x63')][_0x03c7('0x57')]({'where':{'id':_0x5c0dbe[_0x03c7('0x78')]}});}return null;})[_0x03c7('0x23')](handleEntityNotFound(_0x45dd1f,null))['then'](function(_0x1935a3){if(_0x1935a3){_0x8d7181[_0x03c7('0x67')]=_0x1935a3['get']({'plain':!![]});interaction_log[_0x03c7('0x24')](_0x03c7('0x79'),_0x160b22['user']['id'],_0x160b22[_0x03c7('0x60')]['name'],_0x160b22['user'][_0x03c7('0x66')],_0x8d7181[_0x03c7('0x67')]['id'],_0x160b22['body']?JSON[_0x03c7('0x28')](_0x160b22[_0x03c7('0x58')]):_0x03c7('0x68'));return respondWithRpcPromise(_0x03c7('0x7a'),'rejectMessage',_0x8d7181);}return null;})[_0x03c7('0x23')](function(_0x52b117){var _0x3b4799=_0x03c7('0x7b')+_0x52b117[_0x03c7('0x2a')]['ContactId'];return db[_0x03c7('0x6b')][_0x03c7('0x43')](_0x3b4799,{'type':db[_0x03c7('0x6c')]['QueryTypes'][_0x03c7('0x6d')],'raw':!![]})['then'](function(_0x3c5c85){return _0x3c5c85;});})['then'](function(_0x263e0a){if(_0x263e0a){_0x8d7181[_0x03c7('0x2a')][_0x03c7('0x7c')]=_0x263e0a[0x0];if(!_0x160b22[_0x03c7('0x58')][_0x03c7('0x5f')])return;return db[_0x03c7('0x6e')][_0x03c7('0x57')]({'where':{'id':_0x160b22[_0x03c7('0x58')][_0x03c7('0x5f')],'role':'agent'},'attributes':['id',_0x03c7('0x3b'),_0x03c7('0x6f'),_0x03c7('0x7d'),_0x03c7('0x70')],'raw':!![]});}return null;})['then'](function(_0x195b85){if(!_0x195b85)return null;_0x8d7181[_0x03c7('0x2a')][_0x03c7('0x61')]=_0x195b85;return _0x8d7181;})[_0x03c7('0x23')](function(_0x3c2a89){if(_0x3c2a89){_0x3c2a89['message']['interface']=util['format'](_0x03c7('0x72'),_0x160b22[_0x03c7('0x60')][_0x03c7('0x3b')]);_0x3c2a89[_0x03c7('0x2a')][_0x03c7('0x73')]=_0x8d7181[_0x03c7('0x73')];_0x3c2a89['message'][_0x03c7('0x7e')]=_0x8d7181[_0x03c7('0x73')];_0x3c2a89[_0x03c7('0x2a')][_0x03c7('0x74')]=_0x03c7('0x35');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x3c2a89[_0x03c7('0x2a')]},client9002);return _0x8d7181;}return null;})['then'](respondWithResult(_0x45dd1f,null))[_0x03c7('0x2c')](handleError(_0x45dd1f,null));};exports[_0x03c7('0x7f')]=function(_0xb19143,_0x282ea7){var _0x398857;return db['FaxMessage'][_0x03c7('0x7f')](_0xb19143['body'],{})[_0x03c7('0x23')](function(_0x3dc9d1){_0x398857=_0x3dc9d1;return db[_0x03c7('0x80')][_0x03c7('0x81')]({'where':{'id':_0x398857[_0x03c7('0x82')]}});})[_0x03c7('0x23')](function(_0x574baa){if(_['isNil'](_0x574baa)){return;}else{_0x398857[_0x03c7('0x77')]=_0x574baa[_0x03c7('0x77')];return db[_0x03c7('0x83')][_0x03c7('0x81')]({'where':{'id':_0x398857['AttachmentId']}});}})[_0x03c7('0x23')](function(_0x37a818){return respondWithRpcPromise(_0x03c7('0x84'),'SendFax',{'FaxAccountId':_[_0x03c7('0x64')](_0xb19143[_0x03c7('0x58')])?undefined:_0xb19143[_0x03c7('0x58')][_0x03c7('0x85')],'path':_[_0x03c7('0x64')](_0x37a818)?undefined:util[_0x03c7('0x5d')]('/var/opt/motion2/server/files/attachments/%s',_0x37a818[_0x03c7('0x86')]),'fax':_[_0x03c7('0x64')](_0x398857[_0x03c7('0x77')])?undefined:_0x398857[_0x03c7('0x77')],'AttachmentId':_0x398857[_0x03c7('0x87')]},client9002);})[_0x03c7('0x23')](respondWithResult(_0x282ea7,0xc9))[_0x03c7('0x2c')](handleError(_0x282ea7,null));};exports[_0x03c7('0x88')]=function(_0x1473bc,_0x5ed304){var _0x24b47f=path[_0x03c7('0x89')](config[_0x03c7('0x8a')],_0x03c7('0x8b'),_0x03c7('0x8c'),'attachments');return db[_0x03c7('0x3d')][_0x03c7('0x57')]({'where':{'id':_0x1473bc['params']['id']},'include':[{'model':db[_0x03c7('0x83')],'as':_0x03c7('0x83')}]})[_0x03c7('0x23')](handleEntityNotFound(_0x5ed304,null))[_0x03c7('0x23')](function(_0x1aa1f7){if(_0x1aa1f7){return _0x5ed304[_0x03c7('0x88')](path[_0x03c7('0x89')](_0x24b47f,_0x1aa1f7[_0x03c7('0x83')][_0x03c7('0x86')]));}})[_0x03c7('0x2c')](handleError(_0x5ed304,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index f7bbb14..d44db1b 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 _0xfc91=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','save'];(function(_0x1c0001,_0x2c2f01){var _0x56a9ea=function(_0x3059d0){while(--_0x3059d0){_0x1c0001['push'](_0x1c0001['shift']());}};_0x56a9ea(++_0x2c2f01);}(_0xfc91,0xb5));var _0x1fc9=function(_0x3b6548,_0x572009){_0x3b6548=_0x3b6548-0x0;var _0x148940=_0xfc91[_0x3b6548];return _0x148940;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x1fc9('0x0'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x1fc9('0x1')](0x0);var events={'afterCreate':_0x1fc9('0x2'),'afterUpdate':_0x1fc9('0x3'),'afterDestroy':_0x1fc9('0x4')};function emitEvent(_0x2199cd){return function(_0xa16e01,_0x471692,_0x6d3bcc){FaxMessageEvents[_0x1fc9('0x5')](_0x2199cd+':'+_0xa16e01['id'],_0xa16e01);FaxMessageEvents[_0x1fc9('0x5')](_0x2199cd,_0xa16e01);_0x6d3bcc(null);};}for(var e in events){if(events[_0x1fc9('0x6')](e)){var event=events[e];FaxMessage[_0x1fc9('0x7')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0xf811=['exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x41c690,_0x38e97a){var _0x1df86a=function(_0x4e19b5){while(--_0x4e19b5){_0x41c690['push'](_0x41c690['shift']());}};_0x1df86a(++_0x38e97a);}(_0xf811,0x6f));var _0x1f81=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0xf811[_0x474bc0];return _0x4b24cf;};'use strict';var EventEmitter=require(_0x1f81('0x0'));var FaxMessage=require(_0x1f81('0x1'))['db'][_0x1f81('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x1f81('0x3')](0x0);var events={'afterCreate':_0x1f81('0x4'),'afterUpdate':_0x1f81('0x5'),'afterDestroy':_0x1f81('0x6')};function emitEvent(_0x1650f4){return function(_0x18f178,_0x4281c3,_0x40b2b6){FaxMessageEvents[_0x1f81('0x7')](_0x1650f4+':'+_0x18f178['id'],_0x18f178);FaxMessageEvents[_0x1f81('0x7')](_0x1650f4,_0x18f178);_0x40b2b6(null);};}for(var e in events){if(events[_0x1f81('0x8')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x1f81('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index a596f4b..41e25b7 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 _0x85af=['UserId','findOne','FaxInteractionId','update','createdAt','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','toLowerCase','direction','out','secret'];(function(_0x3e069e,_0x24f8ab){var _0x229985=function(_0x5ca262){while(--_0x5ca262){_0x3e069e['push'](_0x3e069e['shift']());}};_0x229985(++_0x24f8ab);}(_0x85af,0x118));var _0xf85a=function(_0xa58f09,_0xebc49c){_0xa58f09=_0xa58f09-0x0;var _0x3b4977=_0x85af[_0xa58f09];return _0x3b4977;};'use strict';var _=require('lodash');var util=require(_0xf85a('0x0'));var logger=require(_0xf85a('0x1'))(_0xf85a('0x2'));var moment=require(_0xf85a('0x3'));var BPromise=require(_0xf85a('0x4'));var rp=require(_0xf85a('0x5'));var fs=require('fs');var path=require(_0xf85a('0x6'));var rimraf=require('rimraf');var config=require(_0xf85a('0x7'));var attributes=require(_0xf85a('0x8'));module[_0xf85a('0x9')]=function(_0xc76471,_0x4bdeb6){return _0xc76471['define'](_0xf85a('0xa'),attributes,{'tableName':_0xf85a('0xb'),'paranoid':![],'indexes':[{'name':_0xf85a('0xc'),'fields':[_0xf85a('0xd')],'type':_0xf85a('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3acb6a,_0x11c13e,_0x17c6e5){var _0x587cf8=_0xc76471[_0xf85a('0xf')];var _0x4afedc=_0x3acb6a['get']({'plain':!![]});if(_0x4afedc['direction'][_0xf85a('0x10')]()==='in'||_0x4afedc[_0xf85a('0x11')][_0xf85a('0x10')]()===_0xf85a('0x12')&&!_0x4afedc[_0xf85a('0x13')]&&!_['isNil'](_0x4afedc[_0xf85a('0x14')])){_0x587cf8['FaxInteraction'][_0xf85a('0x15')]({'where':{'id':_0x4afedc[_0xf85a('0x16')]}})['then'](function(_0x100b2a){if(_0x100b2a){_0x100b2a[_0xf85a('0x17')]({'lastMsgAt':_0x4afedc[_0xf85a('0x18')],'lastMsgDirection':_0x4afedc[_0xf85a('0x11')][_0xf85a('0x10')]()});}})['catch'](function(_0x521ec8){console['error'](_0x521ec8);});}_0x17c6e5();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x10dc=['FaxInteractionId','update','error','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','fti_fax_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','FaxInteraction'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x10dc,0x122));var _0xc10d=function(_0x47cd62,_0x19bbf3){_0x47cd62=_0x47cd62-0x0;var _0x7923b9=_0x10dc[_0x47cd62];return _0x7923b9;};'use strict';var _=require('lodash');var util=require(_0xc10d('0x0'));var logger=require(_0xc10d('0x1'))(_0xc10d('0x2'));var moment=require(_0xc10d('0x3'));var BPromise=require(_0xc10d('0x4'));var rp=require(_0xc10d('0x5'));var fs=require('fs');var path=require(_0xc10d('0x6'));var rimraf=require(_0xc10d('0x7'));var config=require(_0xc10d('0x8'));var attributes=require(_0xc10d('0x9'));module[_0xc10d('0xa')]=function(_0x57a6ea,_0xcc3577){return _0x57a6ea[_0xc10d('0xb')]('FaxMessage',attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xc10d('0xc'),'fields':['body'],'type':_0xc10d('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x212d65,_0x291470,_0x525c01){var _0x1d6833=_0x57a6ea[_0xc10d('0xe')];var _0x29c178=_0x212d65[_0xc10d('0xf')]({'plain':!![]});if(_0x29c178[_0xc10d('0x10')][_0xc10d('0x11')]()==='in'||_0x29c178[_0xc10d('0x10')]['toLowerCase']()===_0xc10d('0x12')&&!_0x29c178[_0xc10d('0x13')]&&!_[_0xc10d('0x14')](_0x29c178['UserId'])){_0x1d6833[_0xc10d('0x15')]['findOne']({'where':{'id':_0x29c178[_0xc10d('0x16')]}})['then'](function(_0x531cd0){if(_0x531cd0){_0x531cd0[_0xc10d('0x17')]({'lastMsgAt':_0x29c178['createdAt'],'lastMsgDirection':_0x29c178['direction'][_0xc10d('0x11')]()});}})['catch'](function(_0x5cf409){console[_0xc10d('0x18')](_0x5cf409);});}_0x525c01();}},'charset':_0xc10d('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 8f894fa..92c0d94 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 _0x55e0=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./faxMessage.socket','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','then','UpdateFaxMessage','update','where','attributes','limit','lodash','util'];(function(_0x581844,_0x1aa88b){var _0x178ddb=function(_0x5695e9){while(--_0x5695e9){_0x581844['push'](_0x581844['shift']());}};_0x178ddb(++_0x1aa88b);}(_0x55e0,0xdc));var _0x055e=function(_0x8b2a7f,_0x5987a7){_0x8b2a7f=_0x8b2a7f-0x0;var _0x2116e4=_0x55e0[_0x8b2a7f];return _0x2116e4;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var moment=require(_0x055e('0x2'));var BPromise=require(_0x055e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x055e('0x4'))['db'];var utils=require(_0x055e('0x5'));var logger=require(_0x055e('0x6'))(_0x055e('0x7'));var config=require(_0x055e('0x8'));var jayson=require(_0x055e('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x055e('0xa')]=_['defaults'](config[_0x055e('0xa')],{'host':_0x055e('0xb'),'port':0x18eb});var socket=require(_0x055e('0xc'))(new Redis(config[_0x055e('0xa')]));require(_0x055e('0xd'))['register'](socket);function respondWithRpcPromise(_0x40779c,_0xd67814,_0xb816c){return new BPromise(function(_0xa0d384,_0x238068){return client['request'](_0x40779c,_0xb816c)['then'](function(_0x187cce){logger['info'](_0x055e('0xe'),_0xd67814,_0x055e('0xf'));logger[_0x055e('0x10')](_0x055e('0x11'),_0xd67814,_0x055e('0xf'),JSON[_0x055e('0x12')](_0x187cce));if(_0x187cce[_0x055e('0x13')]){if(_0x187cce['error'][_0x055e('0x14')]===0x1f4){logger[_0x055e('0x13')](_0x055e('0xe'),_0xd67814,_0x187cce[_0x055e('0x13')][_0x055e('0x15')]);return _0x238068(_0x187cce['error'][_0x055e('0x15')]);}logger[_0x055e('0x13')](_0x055e('0xe'),_0xd67814,_0x187cce['error'][_0x055e('0x15')]);return _0xa0d384(_0x187cce[_0x055e('0x13')][_0x055e('0x15')]);}else{logger[_0x055e('0x16')](_0x055e('0xe'),_0xd67814,'request\x20sent');_0xa0d384(_0x187cce[_0x055e('0x17')][_0x055e('0x15')]);}})[_0x055e('0x18')](function(_0x2ed6fb){logger['error'](_0x055e('0xe'),_0xd67814,_0x2ed6fb);_0x238068(_0x2ed6fb);});});}exports[_0x055e('0x19')]=function(_0x58e44a){var _0xe2b7b5=this;return new Promise(function(_0x4412f9,_0x10258f){return db[_0x055e('0x1a')][_0x055e('0x1b')](_0x58e44a[_0x055e('0x1c')],{'raw':_0x58e44a['options']?_0x58e44a[_0x055e('0x1d')][_0x055e('0x1e')]===undefined?!![]:![]:!![]})[_0x055e('0x1f')](function(_0x5930ff){logger[_0x055e('0x16')](_0x055e('0x19'),_0x58e44a);logger[_0x055e('0x10')](_0x055e('0x19'),_0x58e44a,JSON['stringify'](_0x5930ff));_0x4412f9(_0x5930ff);})[_0x055e('0x18')](function(_0x56c372){logger[_0x055e('0x13')](_0x055e('0x19'),_0x56c372[_0x055e('0x15')],_0x58e44a);_0x10258f(_0xe2b7b5[_0x055e('0x13')](0x1f4,_0x56c372[_0x055e('0x15')]));});});};exports[_0x055e('0x20')]=function(_0x58caf9){var _0x2fb49b=this;return new Promise(function(_0x1f90a9,_0x2a82f8){return db['FaxMessage'][_0x055e('0x21')](_0x58caf9[_0x055e('0x1c')],{'raw':_0x58caf9[_0x055e('0x1d')]?_0x58caf9[_0x055e('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58caf9[_0x055e('0x1d')]?_0x58caf9['options'][_0x055e('0x22')]||null:null,'attributes':_0x58caf9[_0x055e('0x1d')]?_0x58caf9[_0x055e('0x1d')][_0x055e('0x23')]||null:null,'limit':_0x58caf9[_0x055e('0x1d')]?_0x58caf9['options'][_0x055e('0x24')]||null:null})[_0x055e('0x1f')](function(_0x293062){logger[_0x055e('0x16')](_0x055e('0x20'),_0x58caf9);logger[_0x055e('0x10')](_0x055e('0x20'),_0x58caf9,JSON[_0x055e('0x12')](_0x293062));_0x1f90a9(_0x293062);})['catch'](function(_0x26d1c2){logger[_0x055e('0x13')]('UpdateFaxMessage',_0x26d1c2[_0x055e('0x15')],_0x58caf9);_0x2a82f8(_0x2fb49b[_0x055e('0x13')](0x1f4,_0x26d1c2[_0x055e('0x15')]));});});}; \ No newline at end of file +var _0x207c=['result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','UpdateFaxMessage','attributes','limit','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','redis','defaults','localhost','socket.io-emitter','register','info','request\x20sent','debug','stringify','error','code','FaxMessage,\x20%s,\x20%s','message'];(function(_0x491d53,_0x119d7b){var _0x3a8be3=function(_0x2e4ed3){while(--_0x2e4ed3){_0x491d53['push'](_0x491d53['shift']());}};_0x3a8be3(++_0x119d7b);}(_0x207c,0x1e8));var _0xc207=function(_0x280d43,_0x2e7450){_0x280d43=_0x280d43-0x0;var _0x14446d=_0x207c[_0x280d43];return _0x14446d;};'use strict';var _=require('lodash');var util=require(_0xc207('0x0'));var moment=require(_0xc207('0x1'));var BPromise=require(_0xc207('0x2'));var rs=require(_0xc207('0x3'));var fs=require('fs');var Redis=require(_0xc207('0x4'));var db=require(_0xc207('0x5'))['db'];var utils=require(_0xc207('0x6'));var logger=require('../../config/logger')(_0xc207('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc207('0x8')]({'port':0x232a});config[_0xc207('0x9')]=_[_0xc207('0xa')](config['redis'],{'host':_0xc207('0xb'),'port':0x18eb});var socket=require(_0xc207('0xc'))(new Redis(config[_0xc207('0x9')]));require('./faxMessage.socket')[_0xc207('0xd')](socket);function respondWithRpcPromise(_0x817576,_0x216e14,_0x13ec41){return new BPromise(function(_0x201162,_0x347549){return client['request'](_0x817576,_0x13ec41)['then'](function(_0x5b556f){logger[_0xc207('0xe')]('FaxMessage,\x20%s,\x20%s',_0x216e14,_0xc207('0xf'));logger[_0xc207('0x10')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x216e14,_0xc207('0xf'),JSON[_0xc207('0x11')](_0x5b556f));if(_0x5b556f[_0xc207('0x12')]){if(_0x5b556f[_0xc207('0x12')][_0xc207('0x13')]===0x1f4){logger['error'](_0xc207('0x14'),_0x216e14,_0x5b556f[_0xc207('0x12')][_0xc207('0x15')]);return _0x347549(_0x5b556f[_0xc207('0x12')]['message']);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x216e14,_0x5b556f[_0xc207('0x12')][_0xc207('0x15')]);return _0x201162(_0x5b556f[_0xc207('0x12')][_0xc207('0x15')]);}else{logger['info'](_0xc207('0x14'),_0x216e14,_0xc207('0xf'));_0x201162(_0x5b556f[_0xc207('0x16')]['message']);}})[_0xc207('0x17')](function(_0x488cc0){logger[_0xc207('0x12')](_0xc207('0x14'),_0x216e14,_0x488cc0);_0x347549(_0x488cc0);});});}exports[_0xc207('0x18')]=function(_0x461f6a){var _0xce0770=this;return new Promise(function(_0x2caec5,_0x35c0b0){return db[_0xc207('0x19')][_0xc207('0x1a')](_0x461f6a[_0xc207('0x1b')],{'raw':_0x461f6a[_0xc207('0x1c')]?_0x461f6a[_0xc207('0x1c')][_0xc207('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x163b36){logger['info'](_0xc207('0x18'),_0x461f6a);logger[_0xc207('0x10')](_0xc207('0x18'),_0x461f6a,JSON[_0xc207('0x11')](_0x163b36));_0x2caec5(_0x163b36);})[_0xc207('0x17')](function(_0xd209ac){logger[_0xc207('0x12')](_0xc207('0x18'),_0xd209ac[_0xc207('0x15')],_0x461f6a);_0x35c0b0(_0xce0770[_0xc207('0x12')](0x1f4,_0xd209ac[_0xc207('0x15')]));});});};exports[_0xc207('0x1e')]=function(_0x3f738e){var _0x138970=this;return new Promise(function(_0x1445d3,_0x56a066){return db[_0xc207('0x19')]['update'](_0x3f738e['body'],{'raw':_0x3f738e[_0xc207('0x1c')]?_0x3f738e[_0xc207('0x1c')][_0xc207('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f738e[_0xc207('0x1c')]?_0x3f738e[_0xc207('0x1c')]['where']||null:null,'attributes':_0x3f738e[_0xc207('0x1c')]?_0x3f738e[_0xc207('0x1c')][_0xc207('0x1f')]||null:null,'limit':_0x3f738e[_0xc207('0x1c')]?_0x3f738e[_0xc207('0x1c')][_0xc207('0x20')]||null:null})[_0xc207('0x21')](function(_0x27bc72){logger[_0xc207('0xe')](_0xc207('0x1e'),_0x3f738e);logger[_0xc207('0x10')](_0xc207('0x1e'),_0x3f738e,JSON[_0xc207('0x11')](_0x27bc72));_0x1445d3(_0x27bc72);})['catch'](function(_0x1cc799){logger[_0xc207('0x12')](_0xc207('0x1e'),_0x1cc799[_0xc207('0x15')],_0x3f738e);_0x56a066(_0x138970[_0xc207('0x12')](0x1f4,_0x1cc799[_0xc207('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 52472f1..f2f968e 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 _0xbf5a=['register','length','faxMessage:','./faxMessage.events','save','remove','removeListener'];(function(_0x102e64,_0x5b5b9b){var _0x25956c=function(_0x2622e3){while(--_0x2622e3){_0x102e64['push'](_0x102e64['shift']());}};_0x25956c(++_0x5b5b9b);}(_0xbf5a,0x65));var _0xabf5=function(_0x193f7e,_0xc511dd){_0x193f7e=_0x193f7e-0x0;var _0x591551=_0xbf5a[_0x193f7e];return _0x591551;};'use strict';var FaxMessageEvents=require(_0xabf5('0x0'));var events=[_0xabf5('0x1'),_0xabf5('0x2'),'update'];function createListener(_0x353a27,_0x50b1f8){return function(_0x1de864){_0x50b1f8['emit'](_0x353a27,_0x1de864);};}function removeListener(_0x43bd11,_0x283cb6){return function(){FaxMessageEvents[_0xabf5('0x3')](_0x43bd11,_0x283cb6);};}exports[_0xabf5('0x4')]=function(_0x31fd32){for(var _0x4e557c=0x0,_0x2f5288=events[_0xabf5('0x5')];_0x4e557c<_0x2f5288;_0x4e557c++){var _0xad616e=events[_0x4e557c];var _0x5354f4=createListener(_0xabf5('0x6')+_0xad616e,_0x31fd32);FaxMessageEvents['on'](_0xad616e,_0x5354f4);}}; \ No newline at end of file +var _0xc96d=['save','update','emit','removeListener','register','length','./faxMessage.events'];(function(_0x31abac,_0x1a3457){var _0x1160ff=function(_0x4794d8){while(--_0x4794d8){_0x31abac['push'](_0x31abac['shift']());}};_0x1160ff(++_0x1a3457);}(_0xc96d,0xc3));var _0xdc96=function(_0x2fe932,_0x448c1d){_0x2fe932=_0x2fe932-0x0;var _0x56fbaf=_0xc96d[_0x2fe932];return _0x56fbaf;};'use strict';var FaxMessageEvents=require(_0xdc96('0x0'));var events=[_0xdc96('0x1'),'remove',_0xdc96('0x2')];function createListener(_0x15702d,_0x4798a7){return function(_0x365f01){_0x4798a7[_0xdc96('0x3')](_0x15702d,_0x365f01);};}function removeListener(_0x42bd64,_0x13ba78){return function(){FaxMessageEvents[_0xdc96('0x4')](_0x42bd64,_0x13ba78);};}exports[_0xdc96('0x5')]=function(_0xd47a82){for(var _0x4019fb=0x0,_0x4fc8b0=events[_0xdc96('0x6')];_0x4019fb<_0x4fc8b0;_0x4019fb++){var _0x2dfdac=events[_0x4019fb];var _0x47b0b2=createListener('faxMessage:'+_0x2dfdac,_0xd47a82);FaxMessageEvents['on'](_0x2dfdac,_0x47b0b2);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index e2df3df..a86f728 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 _0x593e=['../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','show','download','post','fax','faxmessage:create','create','put','/:id','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x407de4,_0x39b031){var _0x49b3a5=function(_0x10ea52){while(--_0x10ea52){_0x407de4['push'](_0x407de4['shift']());}};_0x49b3a5(++_0x39b031);}(_0x593e,0xcb));var _0xe593=function(_0x391cb5,_0x4f8e1c){_0x391cb5=_0x391cb5-0x0;var _0xf96750=_0x593e[_0x391cb5];return _0xf96750;};'use strict';var multer=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var path=require(_0xe593('0x2'));var timeout=require(_0xe593('0x3'));var express=require(_0xe593('0x4'));var router=express[_0xe593('0x5')]();var fs_extra=require(_0xe593('0x6'));var auth=require(_0xe593('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe593('0x8'));var controller=require(_0xe593('0x9'));router[_0xe593('0xa')]('/',auth[_0xe593('0xb')](),controller[_0xe593('0xc')]);router[_0xe593('0xa')](_0xe593('0xd'),auth[_0xe593('0xb')](),controller[_0xe593('0xe')]);router[_0xe593('0xa')]('/:id',auth[_0xe593('0xb')](),controller[_0xe593('0xf')]);router[_0xe593('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0xe593('0x10')]);router[_0xe593('0x11')]('/',auth[_0xe593('0xb')](),interaction['tracked'](_0xe593('0x12'),_0xe593('0x13')),controller[_0xe593('0x14')]);router[_0xe593('0x15')](_0xe593('0x16'),auth[_0xe593('0xb')](),controller[_0xe593('0x17')]);router[_0xe593('0x15')](_0xe593('0x18'),auth[_0xe593('0xb')](),controller['accept']);router[_0xe593('0x15')](_0xe593('0x19'),auth['isAuthenticated'](),controller[_0xe593('0x1a')]);router[_0xe593('0x1b')]('/:id',auth[_0xe593('0xb')](),controller[_0xe593('0x1c')]);module[_0xe593('0x1d')]=router; \ No newline at end of file +var _0x593e=['../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','show','download','post','fax','faxmessage:create','create','put','/:id','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x783834,_0x38c810){var _0x22055f=function(_0x6a6998){while(--_0x6a6998){_0x783834['push'](_0x783834['shift']());}};_0x22055f(++_0x38c810);}(_0x593e,0xcb));var _0xe593=function(_0x227920,_0x5b0b0e){_0x227920=_0x227920-0x0;var _0x280027=_0x593e[_0x227920];return _0x280027;};'use strict';var multer=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var path=require(_0xe593('0x2'));var timeout=require(_0xe593('0x3'));var express=require(_0xe593('0x4'));var router=express[_0xe593('0x5')]();var fs_extra=require(_0xe593('0x6'));var auth=require(_0xe593('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe593('0x8'));var controller=require(_0xe593('0x9'));router[_0xe593('0xa')]('/',auth[_0xe593('0xb')](),controller[_0xe593('0xc')]);router[_0xe593('0xa')](_0xe593('0xd'),auth[_0xe593('0xb')](),controller[_0xe593('0xe')]);router[_0xe593('0xa')]('/:id',auth[_0xe593('0xb')](),controller[_0xe593('0xf')]);router[_0xe593('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0xe593('0x10')]);router[_0xe593('0x11')]('/',auth[_0xe593('0xb')](),interaction['tracked'](_0xe593('0x12'),_0xe593('0x13')),controller[_0xe593('0x14')]);router[_0xe593('0x15')](_0xe593('0x16'),auth[_0xe593('0xb')](),controller[_0xe593('0x17')]);router[_0xe593('0x15')](_0xe593('0x18'),auth[_0xe593('0xb')](),controller['accept']);router[_0xe593('0x15')](_0xe593('0x19'),auth['isAuthenticated'](),controller[_0xe593('0x1a')]);router[_0xe593('0x1b')]('/:id',auth[_0xe593('0xb')](),controller[_0xe593('0x1c')]);module[_0xe593('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 05c26b6..1a0ebb6 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 _0xbbaf=['sequelize','exports','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x3ab5f0,_0x4dc8e8){var _0x39d70b=function(_0x1a04f6){while(--_0x1a04f6){_0x3ab5f0['push'](_0x3ab5f0['shift']());}};_0x39d70b(++_0x4dc8e8);}(_0xbbaf,0x158));var _0xfbba=function(_0x472f07,_0x393fe4){_0x472f07=_0x472f07-0x0;var _0x5a6c7a=_0xbbaf[_0x472f07];return _0x5a6c7a;};'use strict';var Sequelize=require(_0xfbba('0x0'));module[_0xfbba('0x1')]={'name':{'type':Sequelize[_0xfbba('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xfbba('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfbba('0x4')](_0xfbba('0x5'),_0xfbba('0x6'),_0xfbba('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xfbba('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5950=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x97ec0e,_0x10eb67){var _0x1fd9dd=function(_0x187652){while(--_0x187652){_0x97ec0e['push'](_0x97ec0e['shift']());}};_0x1fd9dd(++_0x10eb67);}(_0x5950,0x11e));var _0x0595=function(_0x329432,_0x405c12){_0x329432=_0x329432-0x0;var _0x51a741=_0x5950[_0x329432];return _0x51a741;};'use strict';var Sequelize=require(_0x0595('0x0'));module[_0x0595('0x1')]={'name':{'type':Sequelize[_0x0595('0x2')],'unique':_0x0595('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0595('0x2')]},'timeout':{'type':Sequelize[_0x0595('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0595('0x5')](_0x0595('0x6'),_0x0595('0x7'),_0x0595('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x0595('0x4')],'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 6cdac2d..9c0adcf 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 _0x74d7=['userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','isArray','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','save','update','then','destroy','UserProfileResource','error','name','send','index','FaxQueue','fieldName','type','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','filters','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserFaxQueue','pick','findAndCountAll','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','User','Agents','online','voicePause','sequelize','each','forEach','emit','removeTeams','select','field','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','value','transaction','removeAgents'];(function(_0x132558,_0x521d93){var _0x34f138=function(_0x3e3541){while(--_0x3e3541){_0x132558['push'](_0x132558['shift']());}};_0x34f138(++_0x521d93);}(_0x74d7,0x113));var _0x774d=function(_0x541ea6,_0x51cab6){_0x541ea6=_0x541ea6-0x0;var _0x3c3e84=_0x74d7[_0x541ea6];return _0x3c3e84;};'use strict';var emlformat=require(_0x774d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x774d('0x1'));var rp=require(_0x774d('0x2'));var moment=require(_0x774d('0x3'));var BPromise=require(_0x774d('0x4'));var Mustache=require(_0x774d('0x5'));var util=require(_0x774d('0x6'));var path=require(_0x774d('0x7'));var sox=require(_0x774d('0x8'));var csv=require(_0x774d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x774d('0xa'));var squel=require('squel');var crypto=require(_0x774d('0xb'));var jsforce=require(_0x774d('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x774d('0xd'));var Redis=require(_0x774d('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x774d('0xf'));var logger=require(_0x774d('0x10'))(_0x774d('0x11'));var utils=require(_0x774d('0x12'));var config=require(_0x774d('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x774d('0x14'))['db'];config[_0x774d('0x15')]=_[_0x774d('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x774d('0x17'))(new Redis(config[_0x774d('0x15')]));require(_0x774d('0x18'))[_0x774d('0x19')](socket);function respondWithStatusCode(_0x5e9646,_0x12db55){_0x12db55=_0x12db55||0xcc;return function(_0x2a18d9){if(_0x2a18d9){return _0x5e9646[_0x774d('0x1a')](_0x12db55);}return _0x5e9646[_0x774d('0x1b')](_0x12db55)['end']();};}function respondWithResult(_0x1344b0,_0x47ac8a){_0x47ac8a=_0x47ac8a||0xc8;return function(_0x4e6e82){if(_0x4e6e82){return _0x1344b0[_0x774d('0x1b')](_0x47ac8a)[_0x774d('0x1c')](_0x4e6e82);}};}function respondWithFilteredResult(_0x33b1c3,_0x41930c){return function(_0xf29a92){if(_0xf29a92){var _0x251e1d=typeof _0x41930c[_0x774d('0x1d')]===_0x774d('0x1e')&&typeof _0x41930c[_0x774d('0x1f')]==='undefined';var _0x5d9087=_0xf29a92['count'];var _0x5ed5db=_0x251e1d?0x0:_0x41930c[_0x774d('0x1d')];var _0x5a8d1d=_0x251e1d?_0xf29a92[_0x774d('0x20')]:_0x41930c[_0x774d('0x1d')]+_0x41930c[_0x774d('0x1f')];var _0x130bf1;if(_0x5a8d1d>=_0x5d9087){_0x5a8d1d=_0x5d9087;_0x130bf1=0xc8;}else{_0x130bf1=0xce;}_0x33b1c3[_0x774d('0x1b')](_0x130bf1);return _0x33b1c3[_0x774d('0x21')]('Content-Range',_0x5ed5db+'-'+_0x5a8d1d+'/'+_0x5d9087)['json'](_0xf29a92);}return null;};}function patchUpdates(_0x325795){return function(_0x1d3572){try{jsonpatch['apply'](_0x1d3572,_0x325795,!![]);}catch(_0x1621c8){return BPromise['reject'](_0x1621c8);}return _0x1d3572[_0x774d('0x22')]();};}function saveUpdates(_0x209bee,_0x288c08){return function(_0x70fb98){if(_0x70fb98){return _0x70fb98[_0x774d('0x23')](_0x209bee)[_0x774d('0x24')](function(_0xbf15df){return _0xbf15df;});}return null;};}function removeEntity(_0x3c941f,_0xb4821d){return function(_0x25b947){if(_0x25b947){return _0x25b947[_0x774d('0x25')]()[_0x774d('0x24')](function(){var _0x3144e5=_0x25b947['get']({'plain':!![]});var _0x53740e='FaxQueues';return db[_0x774d('0x26')][_0x774d('0x25')]({'where':{'type':_0x53740e,'resourceId':_0x3144e5['id']}})[_0x774d('0x24')](function(){return _0x25b947;});})[_0x774d('0x24')](function(){_0x3c941f[_0x774d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fceb4,_0x12e749){return function(_0x679586){if(!_0x679586){_0x2fceb4[_0x774d('0x1a')](0x194);}return _0x679586;};}function handleError(_0x54b613,_0x10a435){_0x10a435=_0x10a435||0x1f4;return function(_0x425c54){logger[_0x774d('0x27')](_0x425c54['stack']);if(_0x425c54[_0x774d('0x28')]){delete _0x425c54[_0x774d('0x28')];}_0x54b613['status'](_0x10a435)[_0x774d('0x29')](_0x425c54);};}exports[_0x774d('0x2a')]=function(_0xed8125,_0x3f4fee){var _0x36c507={},_0x5c7594={},_0x57c76c={'count':0x0,'rows':[]};var _0x520fba=_['map'](db[_0x774d('0x2b')]['rawAttributes'],function(_0x132dbd){return{'name':_0x132dbd[_0x774d('0x2c')],'type':_0x132dbd[_0x774d('0x2d')]['key']};});_0x5c7594[_0x774d('0x2e')]=_[_0x774d('0x2f')](_0x520fba,'name');_0x5c7594['query']=_[_0x774d('0x30')](_0xed8125[_0x774d('0x31')]);_0x5c7594['filters']=_[_0x774d('0x32')](_0x5c7594[_0x774d('0x2e')],_0x5c7594['query']);_0x36c507[_0x774d('0x33')]=_[_0x774d('0x32')](_0x5c7594[_0x774d('0x2e')],qs[_0x774d('0x34')](_0xed8125['query'][_0x774d('0x34')]));_0x36c507[_0x774d('0x33')]=_0x36c507[_0x774d('0x33')][_0x774d('0x35')]?_0x36c507['attributes']:_0x5c7594[_0x774d('0x2e')];if(!_0xed8125[_0x774d('0x31')][_0x774d('0x36')](_0x774d('0x37'))){_0x36c507[_0x774d('0x1f')]=qs[_0x774d('0x1f')](_0xed8125['query'][_0x774d('0x1f')]);_0x36c507[_0x774d('0x1d')]=qs[_0x774d('0x1d')](_0xed8125[_0x774d('0x31')]['offset']);}_0x36c507[_0x774d('0x38')]=qs[_0x774d('0x39')](_0xed8125[_0x774d('0x31')]['sort']);_0x36c507[_0x774d('0x3a')]=qs['filters'](_['pick'](_0xed8125[_0x774d('0x31')],_0x5c7594['filters']),_0x520fba);if(_0xed8125['query'][_0x774d('0x3b')]){_0x36c507['where']=_[_0x774d('0x3c')](_0x36c507[_0x774d('0x3a')],{'$or':_[_0x774d('0x2f')](_0x520fba,function(_0x3799ee){if(_0x3799ee[_0x774d('0x2d')]!==_0x774d('0x3d')){var _0x920c2e={};_0x920c2e[_0x3799ee['name']]={'$like':'%'+_0xed8125[_0x774d('0x31')][_0x774d('0x3b')]+'%'};return _0x920c2e;}})});}_0x36c507=_[_0x774d('0x3c')]({},_0x36c507,_0xed8125[_0x774d('0x3e')]);var _0x2d6b5d={'where':_0x36c507[_0x774d('0x3a')]};return db['FaxQueue'][_0x774d('0x20')](_0x2d6b5d)[_0x774d('0x24')](function(_0x468f1a){_0x57c76c[_0x774d('0x20')]=_0x468f1a;if(_0xed8125['query'][_0x774d('0x3f')]){_0x36c507[_0x774d('0x40')]=[{'all':!![]}];}return db['FaxQueue']['findAll'](_0x36c507);})[_0x774d('0x24')](function(_0x22f14f){_0x57c76c[_0x774d('0x41')]=_0x22f14f;return _0x57c76c;})[_0x774d('0x24')](respondWithFilteredResult(_0x3f4fee,_0x36c507))[_0x774d('0x42')](handleError(_0x3f4fee,null));};exports[_0x774d('0x43')]=function(_0x57f859,_0xa24b2f){var _0x359e68={'raw':!![],'where':{'id':_0x57f859['params']['id']}},_0x629c37={};_0x629c37[_0x774d('0x2e')]=_[_0x774d('0x30')](db['FaxQueue'][_0x774d('0x44')]);_0x629c37[_0x774d('0x31')]=_[_0x774d('0x30')](_0x57f859[_0x774d('0x31')]);_0x629c37[_0x774d('0x45')]=_[_0x774d('0x32')](_0x629c37['model'],_0x629c37[_0x774d('0x31')]);_0x359e68[_0x774d('0x33')]=_['intersection'](_0x629c37[_0x774d('0x2e')],qs[_0x774d('0x34')](_0x57f859[_0x774d('0x31')]['fields']));_0x359e68['attributes']=_0x359e68[_0x774d('0x33')][_0x774d('0x35')]?_0x359e68[_0x774d('0x33')]:_0x629c37[_0x774d('0x2e')];if(_0x57f859['query'][_0x774d('0x3f')]){_0x359e68[_0x774d('0x40')]=[{'all':!![]}];}_0x359e68=_[_0x774d('0x3c')]({},_0x359e68,_0x57f859[_0x774d('0x3e')]);return db[_0x774d('0x2b')][_0x774d('0x46')](_0x359e68)['then'](handleEntityNotFound(_0xa24b2f,null))['then'](respondWithResult(_0xa24b2f,null))[_0x774d('0x42')](handleError(_0xa24b2f,null));};exports[_0x774d('0x47')]=function(_0x26b7f0,_0x31071b){return db[_0x774d('0x2b')][_0x774d('0x47')](_0x26b7f0[_0x774d('0x48')],{})[_0x774d('0x24')](function(_0xb82c01){var _0x4779cb=_0x26b7f0['user'][_0x774d('0x49')]({'plain':!![]});if(!_0x4779cb)throw new Error(_0x774d('0x4a'));if(_0x4779cb['role']===_0x774d('0x4b')){var _0x5e730a=_0xb82c01[_0x774d('0x49')]({'plain':!![]});var _0x19d557='FaxQueues';return db[_0x774d('0x4c')][_0x774d('0x46')]({'where':{'name':_0x19d557,'userProfileId':_0x4779cb['userProfileId']},'raw':!![]})[_0x774d('0x24')](function(_0x9d4d5a){if(_0x9d4d5a&&_0x9d4d5a[_0x774d('0x4d')]===0x0){return db[_0x774d('0x26')]['create']({'name':_0x5e730a[_0x774d('0x28')],'resourceId':_0x5e730a['id'],'type':_0x9d4d5a['name'],'sectionId':_0x9d4d5a['id']},{})[_0x774d('0x24')](function(){return _0xb82c01;});}else{return _0xb82c01;}})['catch'](function(_0x352553){logger[_0x774d('0x27')](_0x774d('0x4e'),_0x352553);throw _0x352553;});}return _0xb82c01;})[_0x774d('0x24')](respondWithResult(_0x31071b,0xc9))['catch'](handleError(_0x31071b,null));};exports[_0x774d('0x23')]=function(_0x514ac4,_0x13ea20){if(_0x514ac4[_0x774d('0x48')]['id']){delete _0x514ac4[_0x774d('0x48')]['id'];}return db[_0x774d('0x2b')][_0x774d('0x46')]({'where':{'id':_0x514ac4[_0x774d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x13ea20,null))[_0x774d('0x24')](saveUpdates(_0x514ac4[_0x774d('0x48')],null))[_0x774d('0x24')](respondWithResult(_0x13ea20,null))[_0x774d('0x42')](handleError(_0x13ea20,null));};exports[_0x774d('0x25')]=function(_0x458ba4,_0x667d9){return db['FaxQueue'][_0x774d('0x46')]({'where':{'id':_0x458ba4[_0x774d('0x4f')]['id']}})[_0x774d('0x24')](handleEntityNotFound(_0x667d9,null))[_0x774d('0x24')](removeEntity(_0x667d9,null))[_0x774d('0x42')](handleError(_0x667d9,null));};exports[_0x774d('0x50')]=function(_0x127330,_0x24391a){return db[_0x774d('0x2b')]['describe']()[_0x774d('0x24')](respondWithResult(_0x24391a,null))[_0x774d('0x42')](handleError(_0x24391a,null));};exports[_0x774d('0x51')]=function(_0x12fc8d,_0x2c11b4,_0xcaedae){var _0x19e61f={'raw':!![],'where':{}},_0x377fbf={},_0x3cd6f0;return db[_0x774d('0x2b')][_0x774d('0x52')]({'where':{'id':_0x12fc8d[_0x774d('0x4f')]['id']}})[_0x774d('0x24')](handleEntityNotFound(_0x2c11b4,null))[_0x774d('0x24')](function(_0x374b1c){if(_0x374b1c){_0x3cd6f0=_0x374b1c[_0x774d('0x49')]({'plain':!![]});_0x377fbf[_0x774d('0x2e')]=_[_0x774d('0x30')](db[_0x774d('0x53')][_0x774d('0x44')]);_0x377fbf['query']=_[_0x774d('0x30')](_0x12fc8d['query']);_0x377fbf[_0x774d('0x45')]=_['intersection'](_0x377fbf[_0x774d('0x2e')],_0x377fbf[_0x774d('0x31')]);_0x19e61f[_0x774d('0x33')]=_[_0x774d('0x32')](_0x377fbf[_0x774d('0x2e')],qs[_0x774d('0x34')](_0x12fc8d[_0x774d('0x31')][_0x774d('0x34')]));_0x19e61f['attributes']=_0x19e61f[_0x774d('0x33')]['length']?_0x19e61f[_0x774d('0x33')]:_0x377fbf[_0x774d('0x2e')];if(!_0x12fc8d['query'][_0x774d('0x36')](_0x774d('0x37'))){_0x19e61f[_0x774d('0x1f')]=qs[_0x774d('0x1f')](_0x12fc8d[_0x774d('0x31')]['limit']);_0x19e61f[_0x774d('0x1d')]=qs[_0x774d('0x1d')](_0x12fc8d['query']['offset']);}_0x19e61f[_0x774d('0x38')]=qs[_0x774d('0x39')](_0x12fc8d[_0x774d('0x31')][_0x774d('0x39')]);_0x19e61f[_0x774d('0x3a')]=qs[_0x774d('0x45')](_[_0x774d('0x54')](_0x12fc8d[_0x774d('0x31')],_0x377fbf[_0x774d('0x45')]));_0x19e61f[_0x774d('0x3a')]['FaxQueueId']=_0x374b1c['id'];if(_0x12fc8d[_0x774d('0x31')][_0x774d('0x3b')]){_0x19e61f[_0x774d('0x3a')]=_[_0x774d('0x3c')](_0x19e61f['where'],{'$or':_['map'](_0x19e61f[_0x774d('0x33')],function(_0x496a3b){var _0x3d7e8a={};_0x3d7e8a[_0x496a3b]={'$like':'%'+_0x12fc8d['query'][_0x774d('0x3b')]+'%'};return _0x3d7e8a;})});}_0x19e61f=_[_0x774d('0x3c')]({},_0x19e61f,_0x12fc8d['options']);return db[_0x774d('0x53')]['findAll'](_0x19e61f);}})[_0x774d('0x24')](function(_0x5e746d){if(_0x5e746d){return db['User'][_0x774d('0x55')]({'where':{'id':_[_0x774d('0x2f')](_0x5e746d,'UserId'),'role':_0x774d('0x56')},'attributes':['id',_0x774d('0x28'),_0x774d('0x57'),_0x774d('0x58'),_0x774d('0x59')]});}})[_0x774d('0x24')](function(_0x4f0bfb){if(_0x4f0bfb){return{'count':_0x4f0bfb[_0x774d('0x20')],'rows':_['map'](_0x4f0bfb[_0x774d('0x41')],function(_0x2e8f0c){return{'membername':_0x2e8f0c[_0x774d('0x28')],'UserId':_0x2e8f0c['id'],'queue_name':_0x3cd6f0[_0x774d('0x28')],'FaxQueueId':_0x3cd6f0['id'],'interface':util[_0x774d('0x5a')](_0x774d('0x5b'),_0x774d('0x5c'),_0x2e8f0c['name']),'penalty':0x0,'paused':_0x2e8f0c[_0x774d('0x57')],'createdAt':_0x2e8f0c[_0x774d('0x59')],'updatedAt':_0x2e8f0c[_0x774d('0x58')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x774d('0x24')](respondWithFilteredResult(_0x2c11b4,_0x19e61f))[_0x774d('0x42')](handleError(_0x2c11b4,null));};exports[_0x774d('0x5d')]=function(_0x37c760,_0x171910,_0x12eb4a){var _0x38deef={};var _0x4f0092={};var _0x2ffabb;var _0x4afca6;return db[_0x774d('0x2b')][_0x774d('0x52')]({'where':{'id':_0x37c760['params']['id']}})[_0x774d('0x24')](handleEntityNotFound(_0x171910,null))['then'](function(_0x56aa49){if(_0x56aa49){_0x2ffabb=_0x56aa49;_0x4f0092[_0x774d('0x2e')]=_[_0x774d('0x30')](db['Team'][_0x774d('0x44')]);_0x4f0092[_0x774d('0x31')]=_[_0x774d('0x30')](_0x37c760[_0x774d('0x31')]);_0x4f0092[_0x774d('0x45')]=_[_0x774d('0x32')](_0x4f0092[_0x774d('0x2e')],_0x4f0092[_0x774d('0x31')]);_0x38deef[_0x774d('0x33')]=_[_0x774d('0x32')](_0x4f0092[_0x774d('0x2e')],qs[_0x774d('0x34')](_0x37c760[_0x774d('0x31')]['fields']));_0x38deef['attributes']=_0x38deef[_0x774d('0x33')][_0x774d('0x35')]?_0x38deef[_0x774d('0x33')]:_0x4f0092[_0x774d('0x2e')];_0x38deef[_0x774d('0x38')]=qs[_0x774d('0x39')](_0x37c760[_0x774d('0x31')][_0x774d('0x39')]);_0x38deef['where']=qs[_0x774d('0x45')](_[_0x774d('0x54')](_0x37c760[_0x774d('0x31')],_0x4f0092[_0x774d('0x45')]));if(_0x37c760[_0x774d('0x31')][_0x774d('0x3b')]){_0x38deef['where']=_['merge'](_0x38deef[_0x774d('0x3a')],{'$or':_[_0x774d('0x2f')](_0x38deef[_0x774d('0x33')],function(_0x419379){var _0x4b318d={};_0x4b318d[_0x419379]={'$like':'%'+_0x37c760[_0x774d('0x31')][_0x774d('0x3b')]+'%'};return _0x4b318d;})});}_0x38deef=_[_0x774d('0x3c')]({},_0x38deef,_0x37c760[_0x774d('0x3e')]);return _0x2ffabb['getTeams'](_0x38deef);}})[_0x774d('0x24')](function(_0x37dd53){if(_0x37dd53){_0x4afca6=_0x37dd53[_0x774d('0x35')];if(!_0x37c760['query']['hasOwnProperty']('nolimit')){_0x38deef[_0x774d('0x1f')]=qs[_0x774d('0x1f')](_0x37c760[_0x774d('0x31')]['limit']);_0x38deef[_0x774d('0x1d')]=qs[_0x774d('0x1d')](_0x37c760[_0x774d('0x31')][_0x774d('0x1d')]);}return _0x2ffabb[_0x774d('0x5d')](_0x38deef);}})['then'](function(_0x333b7c){if(_0x333b7c){return _0x333b7c?{'count':_0x4afca6,'rows':_0x333b7c}:null;}})['then'](respondWithResult(_0x171910,null))[_0x774d('0x42')](handleError(_0x171910,null));};exports[_0x774d('0x5e')]=function(_0x43de89,_0x126d43,_0xd4529){var _0xd72fff=_0x43de89[_0x774d('0x48')][_0x774d('0x5f')];return db[_0x774d('0x60')]['findAll']({'where':{'id':_0xd72fff},'attributes':['id'],'include':[{'model':db[_0x774d('0x61')],'as':_0x774d('0x62'),'attributes':['id',_0x774d('0x28'),_0x774d('0x63'),_0x774d('0x64'),'interface'],'raw':!![]}]})[_0x774d('0x24')](function(_0x10c90d){if(_0x10c90d){var _0x3bcf5f=_['flatMap'](_0x10c90d,function(_0x10af18){var _0x123e6b=_0x10af18[_0x774d('0x49')]({'plain':!![]});return _0x123e6b['Agents'];});return db['FaxQueue'][_0x774d('0x46')]({'where':{'id':_0x43de89[_0x774d('0x4f')]['id']}})[_0x774d('0x24')](function(_0x56302c){return db[_0x774d('0x65')]['transaction'](function(_0x479226){return _0x56302c[_0x774d('0x5e')](_0xd72fff,{'transaction':_0x479226})['then'](function(){return BPromise[_0x774d('0x66')](_0x3bcf5f,function(_0x17f22d){return db[_0x774d('0x53')]['findOrCreate']({'where':{'UserId':_0x17f22d['id'],'FaxQueueId':_0x43de89[_0x774d('0x4f')]['id']},'transaction':_0x479226});});})[_0x774d('0x24')](function(){_0x3bcf5f[_0x774d('0x67')](function(_0x2b5128){socket[_0x774d('0x68')]('userFaxQueue:save',{'UserId':_0x2b5128['id'],'FaxQueueId':_0x56302c['id']});});});});});}})['then'](respondWithStatusCode(_0x126d43,null))['catch'](handleError(_0x126d43,null));};exports[_0x774d('0x69')]=function(_0x2f72a3,_0x4cc52b,_0x70246f){return db['Team']['findAll']({'where':{'id':_0x2f72a3['query'][_0x774d('0x5f')]},'attributes':['id'],'include':[{'model':db[_0x774d('0x61')],'as':_0x774d('0x62'),'attributes':['id'],'raw':!![]}]})[_0x774d('0x24')](handleEntityNotFound(_0x4cc52b,null))[_0x774d('0x24')](function(_0x11b6ce){var _0x14d889=_[_0x774d('0x2f')](_0x11b6ce,'id');var _0x45a298=[];var _0x39db26=[];var _0x12f002=squel[_0x774d('0x6a')]();_0x12f002[_0x774d('0x6b')]('tq.TeamId')[_0x774d('0x6c')](_0x774d('0x6d'),'tq')[_0x774d('0x6e')]('user_has_teams','ut',_0x774d('0x6f'))[_0x774d('0x3a')](_0x774d('0x70'),_0x2f72a3['params']['id']);for(var _0x185ebf=0x0;_0x185ebf<_0x11b6ce[_0x774d('0x35')];_0x185ebf+=0x1){let _0x1468d9=_0x11b6ce[_0x185ebf];for(var _0x13dfa0=0x0;_0x13dfa0<_0x1468d9[_0x774d('0x62')][_0x774d('0x35')];_0x13dfa0+=0x1){let _0x5bac59=_0x1468d9['Agents'][_0x13dfa0];var _0x5d55da=_0x12f002[_0x774d('0x71')]();_0x5d55da['where'](_0x774d('0x72'),_0x5bac59['id']);_0x39db26[_0x774d('0x73')](db['sequelize'][_0x774d('0x31')](_0x5d55da[_0x774d('0x74')](),{'type':db['sequelize']['QueryTypes'][_0x774d('0x75')]})[_0x774d('0x24')](function(_0x51951b){if(_0x51951b[_0x774d('0x35')]===0x1){return _0x5bac59['id'];}else{var _0x4b23a4=_[_0x774d('0x76')](_[_0x774d('0x2f')](_0x51951b,_0x774d('0x77')),function(_0x258efd){return _[_0x774d('0x78')](_0x14d889,_0x258efd);});if(_0x4b23a4){return _0x5bac59['id'];}}}));}}return BPromise[_0x774d('0x79')](_0x39db26)['then'](function(_0x8d6691){_0x45a298=_(_0x45a298)[_0x774d('0x7a')](_0x8d6691)[_0x774d('0x7b')]()[_0x774d('0x7c')]();return db[_0x774d('0x2b')]['find']({'where':{'id':_0x2f72a3[_0x774d('0x4f')]['id']}})[_0x774d('0x24')](function(_0x49437a){return db[_0x774d('0x65')][_0x774d('0x7d')](function(_0x2afa66){return _0x49437a[_0x774d('0x69')](_0x2f72a3[_0x774d('0x31')][_0x774d('0x5f')],{'transaction':_0x2afa66})[_0x774d('0x24')](function(){if(!_['isEmpty'](_0x45a298)){return _0x49437a[_0x774d('0x7e')](_0x45a298,{'transaction':_0x2afa66});}})[_0x774d('0x24')](function(){_0x45a298[_0x774d('0x67')](function(_0x358eb7){socket[_0x774d('0x68')](_0x774d('0x7f'),{'UserId':_0x358eb7,'FaxQueueId':_0x49437a['id']});});});});});});})[_0x774d('0x24')](respondWithStatusCode(_0x4cc52b,null))['catch'](handleError(_0x4cc52b,null));};exports[_0x774d('0x80')]=function(_0x25ddf2,_0x15bb0f,_0x439ae7){return db[_0x774d('0x2b')][_0x774d('0x46')]({'where':{'id':_0x25ddf2[_0x774d('0x4f')]['id']}})[_0x774d('0x24')](handleEntityNotFound(_0x15bb0f,null))[_0x774d('0x24')](function(_0x1b1770){if(_0x1b1770){return _0x1b1770[_0x774d('0x80')](_0x25ddf2['body'][_0x774d('0x5f')],_[_0x774d('0x81')](_0x25ddf2[_0x774d('0x48')],['ids','id'])||{})[_0x774d('0x82')](function(_0x266453){for(var _0x5a34a6=0x0;_0x5a34a6<_0x25ddf2[_0x774d('0x48')][_0x774d('0x5f')][_0x774d('0x35')];_0x5a34a6+=0x1){socket[_0x774d('0x68')](_0x774d('0x83'),{'UserId':Number(_0x25ddf2[_0x774d('0x48')][_0x774d('0x5f')][_0x5a34a6]),'FaxQueueId':Number(_0x25ddf2['params']['id'])});}return _0x266453;});}})['then'](respondWithResult(_0x15bb0f,null))[_0x774d('0x42')](handleError(_0x15bb0f,null));};exports[_0x774d('0x7e')]=function(_0x4a8265,_0x14d885,_0x5e104d){return db[_0x774d('0x2b')][_0x774d('0x46')]({'where':{'id':_0x4a8265[_0x774d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x14d885,null))['then'](function(_0x49134b){if(_0x49134b){return _0x49134b['removeAgents'](_0x4a8265[_0x774d('0x31')]['ids'])[_0x774d('0x24')](function(){if(_[_0x774d('0x84')](_0x4a8265[_0x774d('0x31')][_0x774d('0x5f')])){for(var _0x3916d6=0x0;_0x3916d6<_0x4a8265[_0x774d('0x31')][_0x774d('0x5f')][_0x774d('0x35')];_0x3916d6+=0x1){socket[_0x774d('0x68')](_0x774d('0x7f'),{'UserId':Number(_0x4a8265[_0x774d('0x31')]['ids'][_0x3916d6]),'FaxQueueId':Number(_0x4a8265[_0x774d('0x4f')]['id'])});}}else{socket[_0x774d('0x68')](_0x774d('0x7f'),{'UserId':Number(_0x4a8265[_0x774d('0x31')][_0x774d('0x5f')]),'FaxQueueId':Number(_0x4a8265[_0x774d('0x4f')]['id'])});}});}})[_0x774d('0x24')](respondWithStatusCode(_0x14d885,null))[_0x774d('0x42')](handleError(_0x14d885,null));};exports[_0x774d('0x85')]=function(_0x135fe7,_0x288847,_0x58f15e){var _0x25f8c8={};var _0x3d5520={};var _0x35f5dc;var _0x582f85;return db['FaxQueue'][_0x774d('0x52')]({'where':{'id':_0x135fe7[_0x774d('0x4f')]['id']}})[_0x774d('0x24')](handleEntityNotFound(_0x288847,null))[_0x774d('0x24')](function(_0x4ffc5f){if(_0x4ffc5f){_0x35f5dc=_0x4ffc5f;_0x3d5520['model']=_[_0x774d('0x30')](db[_0x774d('0x61')][_0x774d('0x44')]);_0x3d5520[_0x774d('0x31')]=_[_0x774d('0x30')](_0x135fe7['query']);_0x3d5520['filters']=_[_0x774d('0x32')](_0x3d5520[_0x774d('0x2e')],_0x3d5520[_0x774d('0x31')]);_0x25f8c8[_0x774d('0x33')]=_['intersection'](_0x3d5520[_0x774d('0x2e')],qs[_0x774d('0x34')](_0x135fe7['query'][_0x774d('0x34')]));_0x25f8c8['attributes']=_0x25f8c8[_0x774d('0x33')]['length']?_0x25f8c8[_0x774d('0x33')]:_0x3d5520['model'];_0x25f8c8[_0x774d('0x38')]=qs['sort'](_0x135fe7[_0x774d('0x31')][_0x774d('0x39')]);_0x25f8c8['where']=qs['filters'](_['pick'](_0x135fe7[_0x774d('0x31')],_0x3d5520[_0x774d('0x45')]));if(_0x135fe7[_0x774d('0x31')][_0x774d('0x3b')]){_0x25f8c8[_0x774d('0x3a')]=_[_0x774d('0x3c')](_0x25f8c8[_0x774d('0x3a')],{'$or':_[_0x774d('0x2f')](_0x25f8c8['attributes'],function(_0x438025){var _0x2df693={};_0x2df693[_0x438025]={'$like':'%'+_0x135fe7[_0x774d('0x31')][_0x774d('0x3b')]+'%'};return _0x2df693;})});}_0x25f8c8=_['merge']({},_0x25f8c8,_0x135fe7[_0x774d('0x3e')]);return _0x35f5dc[_0x774d('0x85')](_0x25f8c8);}})[_0x774d('0x24')](function(_0x4af7a6){if(_0x4af7a6){_0x582f85=_0x4af7a6[_0x774d('0x35')];if(!_0x135fe7[_0x774d('0x31')][_0x774d('0x36')](_0x774d('0x37'))){_0x25f8c8[_0x774d('0x1f')]=qs[_0x774d('0x1f')](_0x135fe7[_0x774d('0x31')][_0x774d('0x1f')]);_0x25f8c8['offset']=qs[_0x774d('0x1d')](_0x135fe7['query'][_0x774d('0x1d')]);}return _0x35f5dc[_0x774d('0x85')](_0x25f8c8);}})[_0x774d('0x24')](function(_0x51787f){if(_0x51787f){return _0x51787f?{'count':_0x582f85,'rows':_0x51787f}:null;}})[_0x774d('0x24')](respondWithResult(_0x288847,null))[_0x774d('0x42')](handleError(_0x288847,null));}; \ No newline at end of file +var _0xcbee=['findAll','rows','catch','show','params','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','nolimit','User','UserId','faxPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','addTeams','ids','online','interface','transaction','each','findOrCreate','userFaxQueue:save','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','every','includes','all','compact','removeTeams','removeAgents','forEach','emit','omit','spread','isArray','userFaxQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','FaxQueues','UserProfileResource','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include'];(function(_0x2b2a51,_0x3a8ff6){var _0x271f0d=function(_0xe9cbb){while(--_0xe9cbb){_0x2b2a51['push'](_0x2b2a51['shift']());}};_0x271f0d(++_0x3a8ff6);}(_0xcbee,0x1e0));var _0xecbe=function(_0x1847bd,_0xd743c5){_0x1847bd=_0x1847bd-0x0;var _0x1dbb02=_0xcbee[_0x1847bd];return _0x1dbb02;};'use strict';var emlformat=require(_0xecbe('0x0'));var rimraf=require(_0xecbe('0x1'));var zipdir=require(_0xecbe('0x2'));var jsonpatch=require(_0xecbe('0x3'));var rp=require(_0xecbe('0x4'));var moment=require('moment');var BPromise=require(_0xecbe('0x5'));var Mustache=require('mustache');var util=require(_0xecbe('0x6'));var path=require(_0xecbe('0x7'));var sox=require(_0xecbe('0x8'));var csv=require(_0xecbe('0x9'));var ejs=require(_0xecbe('0xa'));var fs=require('fs');var fs_extra=require(_0xecbe('0xb'));var _=require(_0xecbe('0xc'));var squel=require(_0xecbe('0xd'));var crypto=require(_0xecbe('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xecbe('0x9'));var querystring=require(_0xecbe('0xf'));var Papa=require(_0xecbe('0x10'));var Redis=require(_0xecbe('0x11'));var authService=require(_0xecbe('0x12'));var qs=require(_0xecbe('0x13'));var as=require(_0xecbe('0x14'));var hardwareService=require(_0xecbe('0x15'));var logger=require(_0xecbe('0x16'))('api');var utils=require(_0xecbe('0x17'));var config=require(_0xecbe('0x18'));var licenseUtil=require(_0xecbe('0x19'));var db=require('../../mysqldb')['db'];config[_0xecbe('0x1a')]=_[_0xecbe('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xecbe('0x1a')]));require('./faxQueue.socket')[_0xecbe('0x1c')](socket);function respondWithStatusCode(_0x41500f,_0x3389ec){_0x3389ec=_0x3389ec||0xcc;return function(_0x2d3f61){if(_0x2d3f61){return _0x41500f[_0xecbe('0x1d')](_0x3389ec);}return _0x41500f[_0xecbe('0x1e')](_0x3389ec)[_0xecbe('0x1f')]();};}function respondWithResult(_0x41db03,_0x33b773){_0x33b773=_0x33b773||0xc8;return function(_0x498cfe){if(_0x498cfe){return _0x41db03[_0xecbe('0x1e')](_0x33b773)[_0xecbe('0x20')](_0x498cfe);}};}function respondWithFilteredResult(_0x42c15f,_0x2e8db7){return function(_0xebbd18){if(_0xebbd18){var _0x593ad4=typeof _0x2e8db7[_0xecbe('0x21')]===_0xecbe('0x22')&&typeof _0x2e8db7['limit']===_0xecbe('0x22');var _0x10851f=_0xebbd18[_0xecbe('0x23')];var _0x4f5364=_0x593ad4?0x0:_0x2e8db7['offset'];var _0x50ad69=_0x593ad4?_0xebbd18['count']:_0x2e8db7[_0xecbe('0x21')]+_0x2e8db7['limit'];var _0x4d9280;if(_0x50ad69>=_0x10851f){_0x50ad69=_0x10851f;_0x4d9280=0xc8;}else{_0x4d9280=0xce;}_0x42c15f[_0xecbe('0x1e')](_0x4d9280);return _0x42c15f[_0xecbe('0x24')](_0xecbe('0x25'),_0x4f5364+'-'+_0x50ad69+'/'+_0x10851f)[_0xecbe('0x20')](_0xebbd18);}return null;};}function patchUpdates(_0x29d07e){return function(_0x549731){try{jsonpatch[_0xecbe('0x26')](_0x549731,_0x29d07e,!![]);}catch(_0x362aee){return BPromise[_0xecbe('0x27')](_0x362aee);}return _0x549731[_0xecbe('0x28')]();};}function saveUpdates(_0x148039,_0x1731dc){return function(_0x2f6182){if(_0x2f6182){return _0x2f6182[_0xecbe('0x29')](_0x148039)[_0xecbe('0x2a')](function(_0x303ceb){return _0x303ceb;});}return null;};}function removeEntity(_0x5c824b,_0x1317e1){return function(_0x2a4631){if(_0x2a4631){return _0x2a4631[_0xecbe('0x2b')]()['then'](function(){var _0x5bef2c=_0x2a4631[_0xecbe('0x2c')]({'plain':!![]});var _0x1d2db9=_0xecbe('0x2d');return db[_0xecbe('0x2e')][_0xecbe('0x2b')]({'where':{'type':_0x1d2db9,'resourceId':_0x5bef2c['id']}})[_0xecbe('0x2a')](function(){return _0x2a4631;});})['then'](function(){_0x5c824b[_0xecbe('0x1e')](0xcc)[_0xecbe('0x1f')]();});}};}function handleEntityNotFound(_0x55ade9,_0x5cd5e2){return function(_0x3e17c8){if(!_0x3e17c8){_0x55ade9[_0xecbe('0x1d')](0x194);}return _0x3e17c8;};}function handleError(_0x22874b,_0x5973f0){_0x5973f0=_0x5973f0||0x1f4;return function(_0x324aae){logger['error'](_0x324aae[_0xecbe('0x2f')]);if(_0x324aae[_0xecbe('0x30')]){delete _0x324aae['name'];}_0x22874b[_0xecbe('0x1e')](_0x5973f0)[_0xecbe('0x31')](_0x324aae);};}exports[_0xecbe('0x32')]=function(_0x1b1214,_0x45da90){var _0x5f4542={},_0x2b784c={},_0x41bd18={'count':0x0,'rows':[]};var _0x1569e0=_[_0xecbe('0x33')](db[_0xecbe('0x34')][_0xecbe('0x35')],function(_0x301b5e){return{'name':_0x301b5e[_0xecbe('0x36')],'type':_0x301b5e['type'][_0xecbe('0x37')]};});_0x2b784c['model']=_[_0xecbe('0x33')](_0x1569e0,'name');_0x2b784c[_0xecbe('0x38')]=_[_0xecbe('0x39')](_0x1b1214[_0xecbe('0x38')]);_0x2b784c[_0xecbe('0x3a')]=_[_0xecbe('0x3b')](_0x2b784c[_0xecbe('0x3c')],_0x2b784c[_0xecbe('0x38')]);_0x5f4542[_0xecbe('0x3d')]=_[_0xecbe('0x3b')](_0x2b784c[_0xecbe('0x3c')],qs[_0xecbe('0x3e')](_0x1b1214[_0xecbe('0x38')][_0xecbe('0x3e')]));_0x5f4542['attributes']=_0x5f4542[_0xecbe('0x3d')][_0xecbe('0x3f')]?_0x5f4542[_0xecbe('0x3d')]:_0x2b784c['model'];if(!_0x1b1214[_0xecbe('0x38')][_0xecbe('0x40')]('nolimit')){_0x5f4542[_0xecbe('0x41')]=qs[_0xecbe('0x41')](_0x1b1214[_0xecbe('0x38')][_0xecbe('0x41')]);_0x5f4542[_0xecbe('0x21')]=qs[_0xecbe('0x21')](_0x1b1214[_0xecbe('0x38')][_0xecbe('0x21')]);}_0x5f4542[_0xecbe('0x42')]=qs['sort'](_0x1b1214[_0xecbe('0x38')][_0xecbe('0x43')]);_0x5f4542[_0xecbe('0x44')]=qs['filters'](_[_0xecbe('0x45')](_0x1b1214[_0xecbe('0x38')],_0x2b784c[_0xecbe('0x3a')]),_0x1569e0);if(_0x1b1214[_0xecbe('0x38')][_0xecbe('0x46')]){_0x5f4542[_0xecbe('0x44')]=_['merge'](_0x5f4542[_0xecbe('0x44')],{'$or':_[_0xecbe('0x33')](_0x1569e0,function(_0x53e48b){if(_0x53e48b[_0xecbe('0x47')]!==_0xecbe('0x48')){var _0x4ec943={};_0x4ec943[_0x53e48b['name']]={'$like':'%'+_0x1b1214[_0xecbe('0x38')][_0xecbe('0x46')]+'%'};return _0x4ec943;}})});}_0x5f4542=_['merge']({},_0x5f4542,_0x1b1214[_0xecbe('0x49')]);var _0x5dd3a3={'where':_0x5f4542[_0xecbe('0x44')]};return db[_0xecbe('0x34')][_0xecbe('0x23')](_0x5dd3a3)[_0xecbe('0x2a')](function(_0x5a1fa6){_0x41bd18[_0xecbe('0x23')]=_0x5a1fa6;if(_0x1b1214[_0xecbe('0x38')][_0xecbe('0x4a')]){_0x5f4542[_0xecbe('0x4b')]=[{'all':!![]}];}return db['FaxQueue'][_0xecbe('0x4c')](_0x5f4542);})['then'](function(_0x18428a){_0x41bd18[_0xecbe('0x4d')]=_0x18428a;return _0x41bd18;})['then'](respondWithFilteredResult(_0x45da90,_0x5f4542))[_0xecbe('0x4e')](handleError(_0x45da90,null));};exports[_0xecbe('0x4f')]=function(_0xdf2cfe,_0x118c41){var _0x25fce9={'raw':!![],'where':{'id':_0xdf2cfe[_0xecbe('0x50')]['id']}},_0x95157f={};_0x95157f['model']=_[_0xecbe('0x39')](db[_0xecbe('0x34')][_0xecbe('0x35')]);_0x95157f['query']=_[_0xecbe('0x39')](_0xdf2cfe[_0xecbe('0x38')]);_0x95157f[_0xecbe('0x3a')]=_[_0xecbe('0x3b')](_0x95157f['model'],_0x95157f[_0xecbe('0x38')]);_0x25fce9[_0xecbe('0x3d')]=_[_0xecbe('0x3b')](_0x95157f[_0xecbe('0x3c')],qs['fields'](_0xdf2cfe[_0xecbe('0x38')][_0xecbe('0x3e')]));_0x25fce9[_0xecbe('0x3d')]=_0x25fce9['attributes']['length']?_0x25fce9[_0xecbe('0x3d')]:_0x95157f[_0xecbe('0x3c')];if(_0xdf2cfe['query'][_0xecbe('0x4a')]){_0x25fce9['include']=[{'all':!![]}];}_0x25fce9=_[_0xecbe('0x51')]({},_0x25fce9,_0xdf2cfe[_0xecbe('0x49')]);return db[_0xecbe('0x34')][_0xecbe('0x52')](_0x25fce9)['then'](handleEntityNotFound(_0x118c41,null))[_0xecbe('0x2a')](respondWithResult(_0x118c41,null))[_0xecbe('0x4e')](handleError(_0x118c41,null));};exports[_0xecbe('0x53')]=function(_0x3251ec,_0x30d0de){return db[_0xecbe('0x34')][_0xecbe('0x53')](_0x3251ec[_0xecbe('0x54')],{})[_0xecbe('0x2a')](function(_0x360800){var _0x46b593=_0x3251ec[_0xecbe('0x55')][_0xecbe('0x2c')]({'plain':!![]});if(!_0x46b593)throw new Error(_0xecbe('0x56'));if(_0x46b593[_0xecbe('0x57')]==='user'){var _0x33433e=_0x360800[_0xecbe('0x2c')]({'plain':!![]});var _0x507d7c=_0xecbe('0x2d');return db['UserProfileSection']['find']({'where':{'name':_0x507d7c,'userProfileId':_0x46b593['userProfileId']},'raw':!![]})[_0xecbe('0x2a')](function(_0x50a4fe){if(_0x50a4fe&&_0x50a4fe[_0xecbe('0x58')]===0x0){return db[_0xecbe('0x2e')][_0xecbe('0x53')]({'name':_0x33433e[_0xecbe('0x30')],'resourceId':_0x33433e['id'],'type':_0x50a4fe['name'],'sectionId':_0x50a4fe['id']},{})[_0xecbe('0x2a')](function(){return _0x360800;});}else{return _0x360800;}})[_0xecbe('0x4e')](function(_0x343c84){logger[_0xecbe('0x59')](_0xecbe('0x5a'),_0x343c84);throw _0x343c84;});}return _0x360800;})['then'](respondWithResult(_0x30d0de,0xc9))['catch'](handleError(_0x30d0de,null));};exports['update']=function(_0x2cea86,_0x5ae910){if(_0x2cea86[_0xecbe('0x54')]['id']){delete _0x2cea86[_0xecbe('0x54')]['id'];}return db[_0xecbe('0x34')][_0xecbe('0x52')]({'where':{'id':_0x2cea86[_0xecbe('0x50')]['id']}})[_0xecbe('0x2a')](handleEntityNotFound(_0x5ae910,null))['then'](saveUpdates(_0x2cea86[_0xecbe('0x54')],null))[_0xecbe('0x2a')](respondWithResult(_0x5ae910,null))[_0xecbe('0x4e')](handleError(_0x5ae910,null));};exports[_0xecbe('0x2b')]=function(_0x159522,_0x260198){return db[_0xecbe('0x34')]['find']({'where':{'id':_0x159522['params']['id']}})['then'](handleEntityNotFound(_0x260198,null))['then'](removeEntity(_0x260198,null))[_0xecbe('0x4e')](handleError(_0x260198,null));};exports[_0xecbe('0x5b')]=function(_0x468d1a,_0x404013){return db[_0xecbe('0x34')][_0xecbe('0x5b')]()[_0xecbe('0x2a')](respondWithResult(_0x404013,null))['catch'](handleError(_0x404013,null));};exports[_0xecbe('0x5c')]=function(_0x195ea5,_0x250149,_0x3e2112){var _0x2867f5={'raw':!![],'where':{}},_0x5e0c28={},_0x489275;return db[_0xecbe('0x34')][_0xecbe('0x5d')]({'where':{'id':_0x195ea5['params']['id']}})[_0xecbe('0x2a')](handleEntityNotFound(_0x250149,null))[_0xecbe('0x2a')](function(_0x42e523){if(_0x42e523){_0x489275=_0x42e523[_0xecbe('0x2c')]({'plain':!![]});_0x5e0c28[_0xecbe('0x3c')]=_[_0xecbe('0x39')](db[_0xecbe('0x5e')][_0xecbe('0x35')]);_0x5e0c28[_0xecbe('0x38')]=_[_0xecbe('0x39')](_0x195ea5[_0xecbe('0x38')]);_0x5e0c28['filters']=_[_0xecbe('0x3b')](_0x5e0c28['model'],_0x5e0c28[_0xecbe('0x38')]);_0x2867f5[_0xecbe('0x3d')]=_[_0xecbe('0x3b')](_0x5e0c28[_0xecbe('0x3c')],qs[_0xecbe('0x3e')](_0x195ea5[_0xecbe('0x38')]['fields']));_0x2867f5[_0xecbe('0x3d')]=_0x2867f5[_0xecbe('0x3d')][_0xecbe('0x3f')]?_0x2867f5[_0xecbe('0x3d')]:_0x5e0c28[_0xecbe('0x3c')];if(!_0x195ea5['query'][_0xecbe('0x40')](_0xecbe('0x5f'))){_0x2867f5[_0xecbe('0x41')]=qs[_0xecbe('0x41')](_0x195ea5[_0xecbe('0x38')][_0xecbe('0x41')]);_0x2867f5[_0xecbe('0x21')]=qs['offset'](_0x195ea5[_0xecbe('0x38')][_0xecbe('0x21')]);}_0x2867f5[_0xecbe('0x42')]=qs['sort'](_0x195ea5[_0xecbe('0x38')][_0xecbe('0x43')]);_0x2867f5[_0xecbe('0x44')]=qs['filters'](_[_0xecbe('0x45')](_0x195ea5['query'],_0x5e0c28[_0xecbe('0x3a')]));_0x2867f5[_0xecbe('0x44')]['FaxQueueId']=_0x42e523['id'];if(_0x195ea5[_0xecbe('0x38')][_0xecbe('0x46')]){_0x2867f5[_0xecbe('0x44')]=_[_0xecbe('0x51')](_0x2867f5[_0xecbe('0x44')],{'$or':_[_0xecbe('0x33')](_0x2867f5['attributes'],function(_0x4a2062){var _0x54d64c={};_0x54d64c[_0x4a2062]={'$like':'%'+_0x195ea5['query'][_0xecbe('0x46')]+'%'};return _0x54d64c;})});}_0x2867f5=_[_0xecbe('0x51')]({},_0x2867f5,_0x195ea5['options']);return db['UserFaxQueue'][_0xecbe('0x4c')](_0x2867f5);}})[_0xecbe('0x2a')](function(_0x1bfc39){if(_0x1bfc39){return db[_0xecbe('0x60')]['findAndCountAll']({'where':{'id':_[_0xecbe('0x33')](_0x1bfc39,_0xecbe('0x61')),'role':'agent'},'attributes':['id','name',_0xecbe('0x62'),_0xecbe('0x63'),_0xecbe('0x64')]});}})[_0xecbe('0x2a')](function(_0x315713){if(_0x315713){return{'count':_0x315713[_0xecbe('0x23')],'rows':_[_0xecbe('0x33')](_0x315713['rows'],function(_0x2b01c6){return{'membername':_0x2b01c6[_0xecbe('0x30')],'UserId':_0x2b01c6['id'],'queue_name':_0x489275[_0xecbe('0x30')],'FaxQueueId':_0x489275['id'],'interface':util['format'](_0xecbe('0x65'),_0xecbe('0x66'),_0x2b01c6[_0xecbe('0x30')]),'penalty':0x0,'paused':_0x2b01c6['faxPause'],'createdAt':_0x2b01c6[_0xecbe('0x64')],'updatedAt':_0x2b01c6[_0xecbe('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xecbe('0x2a')](respondWithFilteredResult(_0x250149,_0x2867f5))['catch'](handleError(_0x250149,null));};exports[_0xecbe('0x67')]=function(_0x17ec8a,_0x4fd8d0,_0x168b15){var _0x3ac033={};var _0x2e2485={};var _0x5efb2a;var _0x3ef525;return db[_0xecbe('0x34')][_0xecbe('0x5d')]({'where':{'id':_0x17ec8a[_0xecbe('0x50')]['id']}})[_0xecbe('0x2a')](handleEntityNotFound(_0x4fd8d0,null))[_0xecbe('0x2a')](function(_0x19c9df){if(_0x19c9df){_0x5efb2a=_0x19c9df;_0x2e2485[_0xecbe('0x3c')]=_[_0xecbe('0x39')](db[_0xecbe('0x68')][_0xecbe('0x35')]);_0x2e2485[_0xecbe('0x38')]=_[_0xecbe('0x39')](_0x17ec8a[_0xecbe('0x38')]);_0x2e2485[_0xecbe('0x3a')]=_[_0xecbe('0x3b')](_0x2e2485['model'],_0x2e2485[_0xecbe('0x38')]);_0x3ac033[_0xecbe('0x3d')]=_[_0xecbe('0x3b')](_0x2e2485[_0xecbe('0x3c')],qs['fields'](_0x17ec8a['query'][_0xecbe('0x3e')]));_0x3ac033[_0xecbe('0x3d')]=_0x3ac033['attributes'][_0xecbe('0x3f')]?_0x3ac033['attributes']:_0x2e2485['model'];_0x3ac033[_0xecbe('0x42')]=qs[_0xecbe('0x43')](_0x17ec8a['query']['sort']);_0x3ac033['where']=qs[_0xecbe('0x3a')](_['pick'](_0x17ec8a[_0xecbe('0x38')],_0x2e2485['filters']));if(_0x17ec8a[_0xecbe('0x38')][_0xecbe('0x46')]){_0x3ac033['where']=_['merge'](_0x3ac033[_0xecbe('0x44')],{'$or':_['map'](_0x3ac033[_0xecbe('0x3d')],function(_0x3ad920){var _0x343eb0={};_0x343eb0[_0x3ad920]={'$like':'%'+_0x17ec8a['query'][_0xecbe('0x46')]+'%'};return _0x343eb0;})});}_0x3ac033=_[_0xecbe('0x51')]({},_0x3ac033,_0x17ec8a[_0xecbe('0x49')]);return _0x5efb2a[_0xecbe('0x67')](_0x3ac033);}})[_0xecbe('0x2a')](function(_0x316bfe){if(_0x316bfe){_0x3ef525=_0x316bfe[_0xecbe('0x3f')];if(!_0x17ec8a[_0xecbe('0x38')][_0xecbe('0x40')]('nolimit')){_0x3ac033[_0xecbe('0x41')]=qs[_0xecbe('0x41')](_0x17ec8a['query']['limit']);_0x3ac033[_0xecbe('0x21')]=qs[_0xecbe('0x21')](_0x17ec8a[_0xecbe('0x38')][_0xecbe('0x21')]);}return _0x5efb2a[_0xecbe('0x67')](_0x3ac033);}})['then'](function(_0x9ba171){if(_0x9ba171){return _0x9ba171?{'count':_0x3ef525,'rows':_0x9ba171}:null;}})['then'](respondWithResult(_0x4fd8d0,null))[_0xecbe('0x4e')](handleError(_0x4fd8d0,null));};exports[_0xecbe('0x69')]=function(_0x59ef07,_0x2b7c9c,_0x2c4c16){var _0x175df9=_0x59ef07[_0xecbe('0x54')][_0xecbe('0x6a')];return db[_0xecbe('0x68')][_0xecbe('0x4c')]({'where':{'id':_0x175df9},'attributes':['id'],'include':[{'model':db[_0xecbe('0x60')],'as':'Agents','attributes':['id',_0xecbe('0x30'),_0xecbe('0x6b'),'voicePause',_0xecbe('0x6c')],'raw':!![]}]})[_0xecbe('0x2a')](function(_0x237bc1){if(_0x237bc1){var _0x1e8c6d=_['flatMap'](_0x237bc1,function(_0x48d793){var _0x1f1a2f=_0x48d793['get']({'plain':!![]});return _0x1f1a2f['Agents'];});return db[_0xecbe('0x34')][_0xecbe('0x52')]({'where':{'id':_0x59ef07[_0xecbe('0x50')]['id']}})[_0xecbe('0x2a')](function(_0x4cb8a2){return db['sequelize'][_0xecbe('0x6d')](function(_0x26a613){return _0x4cb8a2[_0xecbe('0x69')](_0x175df9,{'transaction':_0x26a613})[_0xecbe('0x2a')](function(){return BPromise[_0xecbe('0x6e')](_0x1e8c6d,function(_0x39fb3e){return db[_0xecbe('0x5e')][_0xecbe('0x6f')]({'where':{'UserId':_0x39fb3e['id'],'FaxQueueId':_0x59ef07[_0xecbe('0x50')]['id']},'transaction':_0x26a613});});})[_0xecbe('0x2a')](function(){_0x1e8c6d['forEach'](function(_0x4875b0){socket['emit'](_0xecbe('0x70'),{'UserId':_0x4875b0['id'],'FaxQueueId':_0x4cb8a2['id']});});});});});}})[_0xecbe('0x2a')](respondWithStatusCode(_0x2b7c9c,null))['catch'](handleError(_0x2b7c9c,null));};exports['removeTeams']=function(_0x2371b8,_0x1e2361,_0x2ede5d){return db['Team'][_0xecbe('0x4c')]({'where':{'id':_0x2371b8['query'][_0xecbe('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xecbe('0x60')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xecbe('0x2a')](handleEntityNotFound(_0x1e2361,null))[_0xecbe('0x2a')](function(_0x5b50f3){var _0x46d42c=_['map'](_0x5b50f3,'id');var _0x449d71=[];var _0x35f577=[];var _0xea2d9a=squel[_0xecbe('0x71')]();_0xea2d9a[_0xecbe('0x72')](_0xecbe('0x73'))[_0xecbe('0x74')](_0xecbe('0x75'),'tq')[_0xecbe('0x76')](_0xecbe('0x77'),'ut',_0xecbe('0x78'))[_0xecbe('0x44')]('FaxQueueId\x20=\x20?',_0x2371b8[_0xecbe('0x50')]['id']);for(var _0x290421=0x0;_0x290421<_0x5b50f3[_0xecbe('0x3f')];_0x290421+=0x1){let _0x5887d6=_0x5b50f3[_0x290421];for(var _0x5a6552=0x0;_0x5a6552<_0x5887d6['Agents'][_0xecbe('0x3f')];_0x5a6552+=0x1){let _0x3e9a0d=_0x5887d6['Agents'][_0x5a6552];var _0x379377=_0xea2d9a[_0xecbe('0x79')]();_0x379377['where'](_0xecbe('0x7a'),_0x3e9a0d['id']);_0x35f577['push'](db[_0xecbe('0x7b')][_0xecbe('0x38')](_0x379377[_0xecbe('0x7c')](),{'type':db[_0xecbe('0x7b')][_0xecbe('0x7d')]['SELECT']})[_0xecbe('0x2a')](function(_0x500806){if(_0x500806[_0xecbe('0x3f')]===0x1){return _0x3e9a0d['id'];}else{var _0x4cc7af=_[_0xecbe('0x7e')](_[_0xecbe('0x33')](_0x500806,'TeamId'),function(_0x1d4a3a){return _[_0xecbe('0x7f')](_0x46d42c,_0x1d4a3a);});if(_0x4cc7af){return _0x3e9a0d['id'];}}}));}}return BPromise[_0xecbe('0x80')](_0x35f577)[_0xecbe('0x2a')](function(_0x55b5e0){_0x449d71=_(_0x449d71)['union'](_0x55b5e0)[_0xecbe('0x81')]()['value']();return db[_0xecbe('0x34')]['find']({'where':{'id':_0x2371b8['params']['id']}})[_0xecbe('0x2a')](function(_0xce0d11){return db[_0xecbe('0x7b')][_0xecbe('0x6d')](function(_0x137b5d){return _0xce0d11[_0xecbe('0x82')](_0x2371b8['query']['ids'],{'transaction':_0x137b5d})['then'](function(){if(!_['isEmpty'](_0x449d71)){return _0xce0d11[_0xecbe('0x83')](_0x449d71,{'transaction':_0x137b5d});}})['then'](function(){_0x449d71[_0xecbe('0x84')](function(_0x297e5d){socket[_0xecbe('0x85')]('userFaxQueue:remove',{'UserId':_0x297e5d,'FaxQueueId':_0xce0d11['id']});});});});});});})[_0xecbe('0x2a')](respondWithStatusCode(_0x1e2361,null))[_0xecbe('0x4e')](handleError(_0x1e2361,null));};exports['addAgents']=function(_0x537b1c,_0x519f36,_0x407ed5){return db[_0xecbe('0x34')][_0xecbe('0x52')]({'where':{'id':_0x537b1c[_0xecbe('0x50')]['id']}})['then'](handleEntityNotFound(_0x519f36,null))[_0xecbe('0x2a')](function(_0x2d5153){if(_0x2d5153){return _0x2d5153['addAgents'](_0x537b1c['body'][_0xecbe('0x6a')],_[_0xecbe('0x86')](_0x537b1c['body'],['ids','id'])||{})[_0xecbe('0x87')](function(_0x56ff5c){for(var _0x2cb469=0x0;_0x2cb469<_0x537b1c[_0xecbe('0x54')]['ids']['length'];_0x2cb469+=0x1){socket[_0xecbe('0x85')](_0xecbe('0x70'),{'UserId':Number(_0x537b1c[_0xecbe('0x54')][_0xecbe('0x6a')][_0x2cb469]),'FaxQueueId':Number(_0x537b1c[_0xecbe('0x50')]['id'])});}return _0x56ff5c;});}})[_0xecbe('0x2a')](respondWithResult(_0x519f36,null))[_0xecbe('0x4e')](handleError(_0x519f36,null));};exports[_0xecbe('0x83')]=function(_0x1c93c6,_0x506f88,_0x1a22d2){return db['FaxQueue'][_0xecbe('0x52')]({'where':{'id':_0x1c93c6['params']['id']}})['then'](handleEntityNotFound(_0x506f88,null))[_0xecbe('0x2a')](function(_0x205806){if(_0x205806){return _0x205806[_0xecbe('0x83')](_0x1c93c6['query'][_0xecbe('0x6a')])['then'](function(){if(_[_0xecbe('0x88')](_0x1c93c6['query'][_0xecbe('0x6a')])){for(var _0x2b50c9=0x0;_0x2b50c9<_0x1c93c6[_0xecbe('0x38')][_0xecbe('0x6a')][_0xecbe('0x3f')];_0x2b50c9+=0x1){socket['emit'](_0xecbe('0x89'),{'UserId':Number(_0x1c93c6[_0xecbe('0x38')][_0xecbe('0x6a')][_0x2b50c9]),'FaxQueueId':Number(_0x1c93c6[_0xecbe('0x50')]['id'])});}}else{socket['emit'](_0xecbe('0x89'),{'UserId':Number(_0x1c93c6[_0xecbe('0x38')]['ids']),'FaxQueueId':Number(_0x1c93c6['params']['id'])});}});}})['then'](respondWithStatusCode(_0x506f88,null))[_0xecbe('0x4e')](handleError(_0x506f88,null));};exports[_0xecbe('0x8a')]=function(_0x121bd8,_0x19d34d,_0x522d75){var _0x45a600={};var _0x4712a3={};var _0x221114;var _0x6afdf1;return db[_0xecbe('0x34')][_0xecbe('0x5d')]({'where':{'id':_0x121bd8[_0xecbe('0x50')]['id']}})[_0xecbe('0x2a')](handleEntityNotFound(_0x19d34d,null))[_0xecbe('0x2a')](function(_0x5589f3){if(_0x5589f3){_0x221114=_0x5589f3;_0x4712a3[_0xecbe('0x3c')]=_[_0xecbe('0x39')](db[_0xecbe('0x60')][_0xecbe('0x35')]);_0x4712a3[_0xecbe('0x38')]=_[_0xecbe('0x39')](_0x121bd8[_0xecbe('0x38')]);_0x4712a3[_0xecbe('0x3a')]=_[_0xecbe('0x3b')](_0x4712a3[_0xecbe('0x3c')],_0x4712a3[_0xecbe('0x38')]);_0x45a600[_0xecbe('0x3d')]=_['intersection'](_0x4712a3['model'],qs[_0xecbe('0x3e')](_0x121bd8[_0xecbe('0x38')][_0xecbe('0x3e')]));_0x45a600[_0xecbe('0x3d')]=_0x45a600['attributes']['length']?_0x45a600[_0xecbe('0x3d')]:_0x4712a3[_0xecbe('0x3c')];_0x45a600[_0xecbe('0x42')]=qs['sort'](_0x121bd8[_0xecbe('0x38')][_0xecbe('0x43')]);_0x45a600[_0xecbe('0x44')]=qs[_0xecbe('0x3a')](_[_0xecbe('0x45')](_0x121bd8[_0xecbe('0x38')],_0x4712a3[_0xecbe('0x3a')]));if(_0x121bd8[_0xecbe('0x38')]['filter']){_0x45a600[_0xecbe('0x44')]=_[_0xecbe('0x51')](_0x45a600[_0xecbe('0x44')],{'$or':_['map'](_0x45a600[_0xecbe('0x3d')],function(_0x34195a){var _0x44672f={};_0x44672f[_0x34195a]={'$like':'%'+_0x121bd8[_0xecbe('0x38')]['filter']+'%'};return _0x44672f;})});}_0x45a600=_[_0xecbe('0x51')]({},_0x45a600,_0x121bd8['options']);return _0x221114[_0xecbe('0x8a')](_0x45a600);}})[_0xecbe('0x2a')](function(_0x3b43f2){if(_0x3b43f2){_0x6afdf1=_0x3b43f2['length'];if(!_0x121bd8[_0xecbe('0x38')][_0xecbe('0x40')](_0xecbe('0x5f'))){_0x45a600[_0xecbe('0x41')]=qs['limit'](_0x121bd8[_0xecbe('0x38')][_0xecbe('0x41')]);_0x45a600[_0xecbe('0x21')]=qs[_0xecbe('0x21')](_0x121bd8[_0xecbe('0x38')][_0xecbe('0x21')]);}return _0x221114[_0xecbe('0x8a')](_0x45a600);}})[_0xecbe('0x2a')](function(_0x230a4c){if(_0x230a4c){return _0x230a4c?{'count':_0x6afdf1,'rows':_0x230a4c}:null;}})[_0xecbe('0x2a')](respondWithResult(_0x19d34d,null))['catch'](handleError(_0x19d34d,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 9c7f1d2..e167887 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 _0x8d6a=['remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners','update'];(function(_0x246a3f,_0x5ec46d){var _0x390359=function(_0x53f8a0){while(--_0x53f8a0){_0x246a3f['push'](_0x246a3f['shift']());}};_0x390359(++_0x5ec46d);}(_0x8d6a,0x125));var _0xa8d6=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x8d6a[_0x30ae5e];return _0x1f2e93;};'use strict';var EventEmitter=require(_0xa8d6('0x0'));var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xa8d6('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa8d6('0x2'),'afterDestroy':_0xa8d6('0x3')};function emitEvent(_0xb6ea5){return function(_0x12f999,_0x13eeed,_0x20e4a5){FaxQueueEvents[_0xa8d6('0x4')](_0xb6ea5+':'+_0x12f999['id'],_0x12f999);FaxQueueEvents['emit'](_0xb6ea5,_0x12f999);_0x20e4a5(null);};}for(var e in events){if(events[_0xa8d6('0x5')](e)){var event=events[e];FaxQueue[_0xa8d6('0x6')](e,emitEvent(event));}}module[_0xa8d6('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0xa5a2=['save','update','emit','hasOwnProperty','exports','events','FaxQueue'];(function(_0x200ad7,_0x33ea52){var _0x5dca66=function(_0x2c36df){while(--_0x2c36df){_0x200ad7['push'](_0x200ad7['shift']());}};_0x5dca66(++_0x33ea52);}(_0xa5a2,0x1e8));var _0x2a5a=function(_0x551461,_0x1be3ac){_0x551461=_0x551461-0x0;var _0x443054=_0xa5a2[_0x551461];return _0x443054;};'use strict';var EventEmitter=require(_0x2a5a('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x2a5a('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2a5a('0x2'),'afterUpdate':_0x2a5a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4b5114){return function(_0x222c26,_0xa572fc,_0x3a8f87){FaxQueueEvents[_0x2a5a('0x4')](_0x4b5114+':'+_0x222c26['id'],_0x222c26);FaxQueueEvents['emit'](_0x4b5114,_0x222c26);_0x3a8f87(null);};}for(var e in events){if(events[_0x2a5a('0x5')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x2a5a('0x6')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index bfb1227..e993223 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 _0xa2ea=['../../config/environment','./faxQueue.attributes','define','fax_queues','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x5a7e78,_0x400b57){var _0xa8d4a1=function(_0x486659){while(--_0x486659){_0x5a7e78['push'](_0x5a7e78['shift']());}};_0xa8d4a1(++_0x400b57);}(_0xa2ea,0xe0));var _0xaa2e=function(_0x32e9e9,_0x3df5aa){_0x32e9e9=_0x32e9e9-0x0;var _0x400b63=_0xa2ea[_0x32e9e9];return _0x400b63;};'use strict';var _=require(_0xaa2e('0x0'));var util=require('util');var logger=require(_0xaa2e('0x1'))(_0xaa2e('0x2'));var moment=require('moment');var BPromise=require(_0xaa2e('0x3'));var rp=require(_0xaa2e('0x4'));var fs=require('fs');var path=require(_0xaa2e('0x5'));var rimraf=require(_0xaa2e('0x6'));var config=require(_0xaa2e('0x7'));var attributes=require(_0xaa2e('0x8'));module['exports']=function(_0x878c96,_0x1f042a){return _0x878c96[_0xaa2e('0x9')]('FaxQueue',attributes,{'tableName':_0xaa2e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd9a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxQueue.attributes','exports','define','fax_queues','lodash','util'];(function(_0x4b0878,_0x2114a0){var _0x48792f=function(_0xf632f0){while(--_0xf632f0){_0x4b0878['push'](_0x4b0878['shift']());}};_0x48792f(++_0x2114a0);}(_0xbd9a,0x129));var _0xabd9=function(_0xa5c132,_0x48c175){_0xa5c132=_0xa5c132-0x0;var _0x3faa40=_0xbd9a[_0xa5c132];return _0x3faa40;};'use strict';var _=require(_0xabd9('0x0'));var util=require(_0xabd9('0x1'));var logger=require(_0xabd9('0x2'))(_0xabd9('0x3'));var moment=require(_0xabd9('0x4'));var BPromise=require(_0xabd9('0x5'));var rp=require(_0xabd9('0x6'));var fs=require('fs');var path=require(_0xabd9('0x7'));var rimraf=require(_0xabd9('0x8'));var config=require('../../config/environment');var attributes=require(_0xabd9('0x9'));module[_0xabd9('0xa')]=function(_0x5c18f5,_0x3f3332){return _0x5c18f5[_0xabd9('0xb')]('FaxQueue',attributes,{'tableName':_0xabd9('0xc'),'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 22e7e22..17d7e0a 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 _0x36df=['lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','attributes','limit','include','model','map','ShowFaxQueue','find','raw','where'];(function(_0x44a2b0,_0x5b4baf){var _0x540e75=function(_0x5982f6){while(--_0x5982f6){_0x44a2b0['push'](_0x44a2b0['shift']());}};_0x540e75(++_0x5b4baf);}(_0x36df,0x126));var _0xf36d=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x36df[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xf36d('0x0'));var util=require(_0xf36d('0x1'));var moment=require(_0xf36d('0x2'));var BPromise=require(_0xf36d('0x3'));var rs=require(_0xf36d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf36d('0x5'));var logger=require(_0xf36d('0x6'))(_0xf36d('0x7'));var config=require(_0xf36d('0x8'));var jayson=require(_0xf36d('0x9'));var client=jayson[_0xf36d('0xa')][_0xf36d('0xb')]({'port':0x232a});config[_0xf36d('0xc')]=_['defaults'](config['redis'],{'host':_0xf36d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf36d('0xc')]));require(_0xf36d('0xe'))[_0xf36d('0xf')](socket);function respondWithRpcPromise(_0x447e50,_0x5d4229,_0x2babe5){return new BPromise(function(_0x3a19e3,_0x2e2ed5){return client[_0xf36d('0x10')](_0x447e50,_0x2babe5)[_0xf36d('0x11')](function(_0x16d9da){logger[_0xf36d('0x12')](_0xf36d('0x13'),_0x5d4229,_0xf36d('0x14'));logger[_0xf36d('0x15')](_0xf36d('0x16'),_0x5d4229,_0xf36d('0x14'),JSON[_0xf36d('0x17')](_0x16d9da));if(_0x16d9da[_0xf36d('0x18')]){if(_0x16d9da[_0xf36d('0x18')][_0xf36d('0x19')]===0x1f4){logger[_0xf36d('0x18')](_0xf36d('0x13'),_0x5d4229,_0x16d9da[_0xf36d('0x18')][_0xf36d('0x1a')]);return _0x2e2ed5(_0x16d9da[_0xf36d('0x18')][_0xf36d('0x1a')]);}logger['error'](_0xf36d('0x13'),_0x5d4229,_0x16d9da['error'][_0xf36d('0x1a')]);return _0x3a19e3(_0x16d9da[_0xf36d('0x18')][_0xf36d('0x1a')]);}else{logger[_0xf36d('0x12')]('FaxQueue,\x20%s,\x20%s',_0x5d4229,_0xf36d('0x14'));_0x3a19e3(_0x16d9da[_0xf36d('0x1b')][_0xf36d('0x1a')]);}})[_0xf36d('0x1c')](function(_0x373ca9){logger[_0xf36d('0x18')]('FaxQueue,\x20%s,\x20%s',_0x5d4229,_0x373ca9);_0x2e2ed5(_0x373ca9);});});}exports[_0xf36d('0x1d')]=function(_0x2a1763){var _0x40c458=this;return new Promise(function(_0x25f857,_0x4cd77b){return db[_0xf36d('0x1e')][_0xf36d('0x1f')]({'raw':_0x2a1763[_0xf36d('0x20')]?_0x2a1763[_0xf36d('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x2a1763[_0xf36d('0x20')]?_0x2a1763[_0xf36d('0x20')]['where']||null:null,'attributes':_0x2a1763[_0xf36d('0x20')]?_0x2a1763['options'][_0xf36d('0x21')]||null:null,'limit':_0x2a1763[_0xf36d('0x20')]?_0x2a1763['options'][_0xf36d('0x22')]||null:null,'include':_0x2a1763[_0xf36d('0x20')]?_0x2a1763['options'][_0xf36d('0x23')]?_['map'](_0x2a1763[_0xf36d('0x20')]['include'],function(_0x26a7ff){return{'model':db[_0x26a7ff[_0xf36d('0x24')]],'as':_0x26a7ff['as'],'attributes':_0x26a7ff['attributes'],'include':_0x26a7ff[_0xf36d('0x23')]?_[_0xf36d('0x25')](_0x26a7ff[_0xf36d('0x23')],function(_0x1e4f64){return{'model':db[_0x1e4f64[_0xf36d('0x24')]],'as':_0x1e4f64['as'],'attributes':_0x1e4f64[_0xf36d('0x21')],'include':_0x1e4f64[_0xf36d('0x23')]?_[_0xf36d('0x25')](_0x1e4f64['include'],function(_0x3c5701){return{'model':db[_0x3c5701[_0xf36d('0x24')]],'as':_0x3c5701['as'],'attributes':_0x3c5701[_0xf36d('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf36d('0x11')](function(_0x4cec33){logger[_0xf36d('0x12')]('GetFaxQueue',_0x2a1763);logger['debug'](_0xf36d('0x1d'),_0x2a1763,JSON['stringify'](_0x4cec33));_0x25f857(_0x4cec33);})[_0xf36d('0x1c')](function(_0x332e81){logger[_0xf36d('0x18')]('GetFaxQueue',_0x332e81['message'],_0x2a1763);_0x4cd77b(_0x40c458[_0xf36d('0x18')](0x1f4,_0x332e81[_0xf36d('0x1a')]));});});};exports[_0xf36d('0x26')]=function(_0x1c546d){var _0x244ee0=this;return new Promise(function(_0x75d2c,_0x539eaa){return db['FaxQueue'][_0xf36d('0x27')]({'raw':_0x1c546d['options']?_0x1c546d[_0xf36d('0x20')][_0xf36d('0x28')]===undefined?!![]:![]:!![],'where':_0x1c546d[_0xf36d('0x20')]?_0x1c546d[_0xf36d('0x20')][_0xf36d('0x29')]||null:null,'attributes':_0x1c546d[_0xf36d('0x20')]?_0x1c546d['options'][_0xf36d('0x21')]||null:null,'include':_0x1c546d[_0xf36d('0x20')]?_0x1c546d[_0xf36d('0x20')]['include']?_[_0xf36d('0x25')](_0x1c546d[_0xf36d('0x20')]['include'],function(_0x2be65b){return{'model':db[_0x2be65b['model']],'as':_0x2be65b['as'],'attributes':_0x2be65b['attributes'],'include':_0x2be65b[_0xf36d('0x23')]?_[_0xf36d('0x25')](_0x2be65b[_0xf36d('0x23')],function(_0x1c13e6){return{'model':db[_0x1c13e6['model']],'as':_0x1c13e6['as'],'attributes':_0x1c13e6[_0xf36d('0x21')],'include':_0x1c13e6['include']?_[_0xf36d('0x25')](_0x1c13e6['include'],function(_0x13d522){return{'model':db[_0x13d522[_0xf36d('0x24')]],'as':_0x13d522['as'],'attributes':_0x13d522[_0xf36d('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf36d('0x11')](function(_0x184bfa){logger[_0xf36d('0x12')](_0xf36d('0x26'),_0x1c546d);logger[_0xf36d('0x15')](_0xf36d('0x26'),_0x1c546d,JSON[_0xf36d('0x17')](_0x184bfa));_0x75d2c(_0x184bfa);})[_0xf36d('0x1c')](function(_0x3ca540){logger['error'](_0xf36d('0x26'),_0x3ca540[_0xf36d('0x1a')],_0x1c546d);_0x539eaa(_0x244ee0[_0xf36d('0x18')](0x1f4,_0x3ca540[_0xf36d('0x1a')]));});});}; \ No newline at end of file +var _0x661a=['FaxQueue','find','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','GetFaxQueue','findAll','options','where','attributes','limit','include','map','model','ShowFaxQueue'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x661a,0x122));var _0xa661=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x661a[_0x24f31b];return _0x488401;};'use strict';var _=require(_0xa661('0x0'));var util=require(_0xa661('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa661('0x2'));var fs=require('fs');var Redis=require(_0xa661('0x3'));var db=require(_0xa661('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa661('0x5'));var config=require(_0xa661('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa661('0x7')][_0xa661('0x8')]({'port':0x232a});config[_0xa661('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa661('0xa'))(new Redis(config[_0xa661('0x9')]));require(_0xa661('0xb'))[_0xa661('0xc')](socket);function respondWithRpcPromise(_0x72e9e,_0x35be99,_0x2f622c){return new BPromise(function(_0x3f444f,_0x1f6468){return client[_0xa661('0xd')](_0x72e9e,_0x2f622c)[_0xa661('0xe')](function(_0x8ea9f1){logger[_0xa661('0xf')](_0xa661('0x10'),_0x35be99,'request\x20sent');logger[_0xa661('0x11')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x35be99,_0xa661('0x12'),JSON[_0xa661('0x13')](_0x8ea9f1));if(_0x8ea9f1['error']){if(_0x8ea9f1['error']['code']===0x1f4){logger['error'](_0xa661('0x10'),_0x35be99,_0x8ea9f1[_0xa661('0x14')][_0xa661('0x15')]);return _0x1f6468(_0x8ea9f1['error'][_0xa661('0x15')]);}logger['error'](_0xa661('0x10'),_0x35be99,_0x8ea9f1[_0xa661('0x14')][_0xa661('0x15')]);return _0x3f444f(_0x8ea9f1['error'][_0xa661('0x15')]);}else{logger[_0xa661('0xf')]('FaxQueue,\x20%s,\x20%s',_0x35be99,_0xa661('0x12'));_0x3f444f(_0x8ea9f1[_0xa661('0x16')][_0xa661('0x15')]);}})[_0xa661('0x17')](function(_0x30487a){logger['error'](_0xa661('0x10'),_0x35be99,_0x30487a);_0x1f6468(_0x30487a);});});}exports[_0xa661('0x18')]=function(_0x3877e0){var _0x49e5f3=this;return new Promise(function(_0x26e27d,_0x241b14){return db['FaxQueue'][_0xa661('0x19')]({'raw':_0x3877e0[_0xa661('0x1a')]?_0x3877e0[_0xa661('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3877e0['options']?_0x3877e0[_0xa661('0x1a')][_0xa661('0x1b')]||null:null,'attributes':_0x3877e0[_0xa661('0x1a')]?_0x3877e0[_0xa661('0x1a')][_0xa661('0x1c')]||null:null,'limit':_0x3877e0['options']?_0x3877e0['options'][_0xa661('0x1d')]||null:null,'include':_0x3877e0[_0xa661('0x1a')]?_0x3877e0[_0xa661('0x1a')][_0xa661('0x1e')]?_[_0xa661('0x1f')](_0x3877e0[_0xa661('0x1a')][_0xa661('0x1e')],function(_0xe859a2){return{'model':db[_0xe859a2['model']],'as':_0xe859a2['as'],'attributes':_0xe859a2[_0xa661('0x1c')],'include':_0xe859a2[_0xa661('0x1e')]?_[_0xa661('0x1f')](_0xe859a2[_0xa661('0x1e')],function(_0x5e6c78){return{'model':db[_0x5e6c78[_0xa661('0x20')]],'as':_0x5e6c78['as'],'attributes':_0x5e6c78[_0xa661('0x1c')],'include':_0x5e6c78['include']?_[_0xa661('0x1f')](_0x5e6c78['include'],function(_0x1eb918){return{'model':db[_0x1eb918['model']],'as':_0x1eb918['as'],'attributes':_0x1eb918[_0xa661('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa661('0xe')](function(_0x2bbda9){logger[_0xa661('0xf')](_0xa661('0x18'),_0x3877e0);logger['debug'](_0xa661('0x18'),_0x3877e0,JSON['stringify'](_0x2bbda9));_0x26e27d(_0x2bbda9);})[_0xa661('0x17')](function(_0x1d8a25){logger[_0xa661('0x14')](_0xa661('0x18'),_0x1d8a25[_0xa661('0x15')],_0x3877e0);_0x241b14(_0x49e5f3[_0xa661('0x14')](0x1f4,_0x1d8a25[_0xa661('0x15')]));});});};exports[_0xa661('0x21')]=function(_0x1001e2){var _0x2e0286=this;return new Promise(function(_0x180500,_0x1a0d14){return db[_0xa661('0x22')][_0xa661('0x23')]({'raw':_0x1001e2['options']?_0x1001e2[_0xa661('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1001e2[_0xa661('0x1a')]?_0x1001e2[_0xa661('0x1a')][_0xa661('0x1b')]||null:null,'attributes':_0x1001e2[_0xa661('0x1a')]?_0x1001e2[_0xa661('0x1a')][_0xa661('0x1c')]||null:null,'include':_0x1001e2[_0xa661('0x1a')]?_0x1001e2[_0xa661('0x1a')]['include']?_[_0xa661('0x1f')](_0x1001e2['options'][_0xa661('0x1e')],function(_0x506efd){return{'model':db[_0x506efd[_0xa661('0x20')]],'as':_0x506efd['as'],'attributes':_0x506efd[_0xa661('0x1c')],'include':_0x506efd[_0xa661('0x1e')]?_[_0xa661('0x1f')](_0x506efd[_0xa661('0x1e')],function(_0x469245){return{'model':db[_0x469245[_0xa661('0x20')]],'as':_0x469245['as'],'attributes':_0x469245[_0xa661('0x1c')],'include':_0x469245[_0xa661('0x1e')]?_[_0xa661('0x1f')](_0x469245['include'],function(_0xe03e1b){return{'model':db[_0xe03e1b[_0xa661('0x20')]],'as':_0xe03e1b['as'],'attributes':_0xe03e1b[_0xa661('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa661('0xe')](function(_0x57a9d1){logger[_0xa661('0xf')](_0xa661('0x21'),_0x1001e2);logger[_0xa661('0x11')](_0xa661('0x21'),_0x1001e2,JSON['stringify'](_0x57a9d1));_0x180500(_0x57a9d1);})[_0xa661('0x17')](function(_0xcc1d3c){logger[_0xa661('0x14')](_0xa661('0x21'),_0xcc1d3c[_0xa661('0x15')],_0x1001e2);_0x1a0d14(_0x2e0286['error'](0x1f4,_0xcc1d3c[_0xa661('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index a8eaf3c..1fcc584 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 _0x8454=['removeListener','register','length','faxQueue:','./faxQueue.events','save','remove','update'];(function(_0x1a89ca,_0x27394b){var _0x29cbb2=function(_0x31e1f4){while(--_0x31e1f4){_0x1a89ca['push'](_0x1a89ca['shift']());}};_0x29cbb2(++_0x27394b);}(_0x8454,0x1a4));var _0x4845=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x8454[_0x5b644e];return _0x49c6bf;};'use strict';var FaxQueueEvents=require(_0x4845('0x0'));var events=[_0x4845('0x1'),_0x4845('0x2'),_0x4845('0x3')];function createListener(_0x4e41d,_0x242ce6){return function(_0x1b363a){_0x242ce6['emit'](_0x4e41d,_0x1b363a);};}function removeListener(_0x3c7534,_0xcd6cd2){return function(){FaxQueueEvents[_0x4845('0x4')](_0x3c7534,_0xcd6cd2);};}exports[_0x4845('0x5')]=function(_0x5304c9){for(var _0x5425f4=0x0,_0xa91c10=events[_0x4845('0x6')];_0x5425f4<_0xa91c10;_0x5425f4++){var _0x5bf5aa=events[_0x5425f4];var _0x3be9e9=createListener(_0x4845('0x7')+_0x5bf5aa,_0x5304c9);FaxQueueEvents['on'](_0x5bf5aa,_0x3be9e9);}}; \ No newline at end of file +var _0x56e7=['emit','removeListener','length','save','remove'];(function(_0x5f3059,_0x1475b3){var _0x2ff9be=function(_0x4f4451){while(--_0x4f4451){_0x5f3059['push'](_0x5f3059['shift']());}};_0x2ff9be(++_0x1475b3);}(_0x56e7,0x7b));var _0x756e=function(_0x9b45f,_0x3df8b8){_0x9b45f=_0x9b45f-0x0;var _0xb25912=_0x56e7[_0x9b45f];return _0xb25912;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x756e('0x0'),_0x756e('0x1'),'update'];function createListener(_0x2eadee,_0x3efe5c){return function(_0x46a672){_0x3efe5c[_0x756e('0x2')](_0x2eadee,_0x46a672);};}function removeListener(_0x11ce5f,_0x38546a){return function(){FaxQueueEvents[_0x756e('0x3')](_0x11ce5f,_0x38546a);};}exports['register']=function(_0x3b3b8f){for(var _0x404189=0x0,_0x26519d=events[_0x756e('0x4')];_0x404189<_0x26519d;_0x404189++){var _0x5c8589=events[_0x404189];var _0x1c6a22=createListener('faxQueue:'+_0x5c8589,_0x3b3b8f);FaxQueueEvents['on'](_0x5c8589,_0x1c6a22);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index e7c0866..a87da00 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 _0xfd2e=['removeAgents','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','index','isAuthenticated','get','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','addTeams','post','put','update','delete','removeTeams'];(function(_0x5c2f6a,_0x54c8d4){var _0x39324f=function(_0x4cd4ce){while(--_0x4cd4ce){_0x5c2f6a['push'](_0x5c2f6a['shift']());}};_0x39324f(++_0x54c8d4);}(_0xfd2e,0x6e));var _0xefd2=function(_0xc54b25,_0x79a670){_0xc54b25=_0xc54b25-0x0;var _0x671d7e=_0xfd2e[_0xc54b25];return _0x671d7e;};'use strict';var multer=require(_0xefd2('0x0'));var util=require('util');var path=require(_0xefd2('0x1'));var timeout=require('connect-timeout');var express=require(_0xefd2('0x2'));var router=express['Router']();var fs_extra=require(_0xefd2('0x3'));var auth=require(_0xefd2('0x4'));var interaction=require(_0xefd2('0x5'));var config=require(_0xefd2('0x6'));var controller=require(_0xefd2('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xefd2('0x8')]);router['get']('/describe',auth[_0xefd2('0x9')](),controller['describe']);router[_0xefd2('0xa')](_0xefd2('0xb'),auth[_0xefd2('0x9')](),controller[_0xefd2('0xc')]);router[_0xefd2('0xa')](_0xefd2('0xd'),auth[_0xefd2('0x9')](),controller['getMembers']);router[_0xefd2('0xa')](_0xefd2('0xe'),auth[_0xefd2('0x9')](),controller[_0xefd2('0xf')]);router[_0xefd2('0xa')](_0xefd2('0x10'),auth[_0xefd2('0x9')](),controller[_0xefd2('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xefd2('0x12')]);router['post']('/:id/teams',auth[_0xefd2('0x9')](),controller[_0xefd2('0x13')]);router[_0xefd2('0x14')](_0xefd2('0x10'),auth[_0xefd2('0x9')](),controller['addAgents']);router[_0xefd2('0x15')](_0xefd2('0xb'),auth[_0xefd2('0x9')](),controller[_0xefd2('0x16')]);router[_0xefd2('0x17')](_0xefd2('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0xefd2('0x17')](_0xefd2('0xe'),auth[_0xefd2('0x9')](),controller[_0xefd2('0x18')]);router[_0xefd2('0x17')]('/:id/users',auth[_0xefd2('0x9')](),controller[_0xefd2('0x19')]);module[_0xefd2('0x1a')]=router; \ No newline at end of file +var _0x71ab=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/teams','create','post','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller'];(function(_0x1809c5,_0x46cabc){var _0x5254a4=function(_0xd1d319){while(--_0xd1d319){_0x1809c5['push'](_0x1809c5['shift']());}};_0x5254a4(++_0x46cabc);}(_0x71ab,0x64));var _0xb71a=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x71ab[_0x126558];return _0x1f6d14;};'use strict';var multer=require('multer');var util=require(_0xb71a('0x0'));var path=require('path');var timeout=require(_0xb71a('0x1'));var express=require('express');var router=express[_0xb71a('0x2')]();var fs_extra=require(_0xb71a('0x3'));var auth=require(_0xb71a('0x4'));var interaction=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var controller=require(_0xb71a('0x7'));router[_0xb71a('0x8')]('/',auth[_0xb71a('0x9')](),controller[_0xb71a('0xa')]);router[_0xb71a('0x8')](_0xb71a('0xb'),auth[_0xb71a('0x9')](),controller[_0xb71a('0xc')]);router[_0xb71a('0x8')](_0xb71a('0xd'),auth[_0xb71a('0x9')](),controller[_0xb71a('0xe')]);router[_0xb71a('0x8')]('/:id/members',auth[_0xb71a('0x9')](),controller['getMembers']);router[_0xb71a('0x8')](_0xb71a('0xf'),auth[_0xb71a('0x9')](),controller['getTeams']);router[_0xb71a('0x8')]('/:id/users',auth[_0xb71a('0x9')](),controller['getAgents']);router['post']('/',auth[_0xb71a('0x9')](),controller[_0xb71a('0x10')]);router[_0xb71a('0x11')](_0xb71a('0xf'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0xb71a('0x12'),auth[_0xb71a('0x9')](),controller[_0xb71a('0x13')]);router[_0xb71a('0x14')](_0xb71a('0xd'),auth[_0xb71a('0x9')](),controller[_0xb71a('0x15')]);router[_0xb71a('0x16')](_0xb71a('0xd'),auth['isAuthenticated'](),controller[_0xb71a('0x17')]);router[_0xb71a('0x16')](_0xb71a('0xf'),auth[_0xb71a('0x9')](),controller[_0xb71a('0x18')]);router[_0xb71a('0x16')](_0xb71a('0x12'),auth[_0xb71a('0x9')](),controller[_0xb71a('0x19')]);module[_0xb71a('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index c56a137..26b41ec 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 _0x27f8=['sequelize','exports','STRING','DATE'];(function(_0x5aa8da,_0x4c4700){var _0x43df8a=function(_0x57629e){while(--_0x57629e){_0x5aa8da['push'](_0x5aa8da['shift']());}};_0x43df8a(++_0x4c4700);}(_0x27f8,0x180));var _0x827f=function(_0x4c9f6a,_0xcb2cb2){_0x4c9f6a=_0x4c9f6a-0x0;var _0x5df5b9=_0x27f8[_0x4c9f6a];return _0x5df5b9;};'use strict';var moment=require('moment');var Sequelize=require(_0x827f('0x0'));module[_0x827f('0x1')]={'uniqueid':{'type':Sequelize[_0x827f('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x827f('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x827f('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x827f('0x2')]}}; \ No newline at end of file +var _0x43e1=['DATE','moment','sequelize','exports','STRING'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x43e1,0x18c));var _0x143e=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x43e1[_0x10004e];return _0x5af990;};'use strict';var moment=require(_0x143e('0x0'));var Sequelize=require(_0x143e('0x1'));module[_0x143e('0x2')]={'uniqueid':{'type':Sequelize[_0x143e('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x143e('0x3')]},'joinAt':{'type':Sequelize[_0x143e('0x4')]},'leaveAt':{'type':Sequelize[_0x143e('0x4')]},'acceptAt':{'type':Sequelize[_0x143e('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x143e('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 7558243..648b5b5 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 _0x682e=['intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','show','params','keys','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','apply','reject','save','update','then','error','stack','send','map','FaxQueueReport','rawAttributes','type','key','model','query','filters'];(function(_0x5cc51f,_0x22c480){var _0x315a2f=function(_0x4f93bd){while(--_0x4f93bd){_0x5cc51f['push'](_0x5cc51f['shift']());}};_0x315a2f(++_0x22c480);}(_0x682e,0x1ce));var _0xe682=function(_0x1f704b,_0x21dc03){_0x1f704b=_0x1f704b-0x0;var _0x5560ef=_0x682e[_0x1f704b];return _0x5560ef;};'use strict';var emlformat=require(_0xe682('0x0'));var rimraf=require(_0xe682('0x1'));var zipdir=require(_0xe682('0x2'));var jsonpatch=require(_0xe682('0x3'));var rp=require(_0xe682('0x4'));var moment=require(_0xe682('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe682('0x6'));var util=require(_0xe682('0x7'));var path=require(_0xe682('0x8'));var sox=require(_0xe682('0x9'));var csv=require(_0xe682('0xa'));var ejs=require(_0xe682('0xb'));var fs=require('fs');var fs_extra=require(_0xe682('0xc'));var _=require(_0xe682('0xd'));var squel=require(_0xe682('0xe'));var crypto=require(_0xe682('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xe682('0x10'));var toCsv=require(_0xe682('0xa'));var querystring=require(_0xe682('0x11'));var Papa=require(_0xe682('0x12'));var Redis=require(_0xe682('0x13'));var authService=require(_0xe682('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe682('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe682('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xe682('0x17'));var licenseUtil=require(_0xe682('0x18'));var db=require(_0xe682('0x19'))['db'];function respondWithStatusCode(_0x178861,_0x9d0c78){_0x9d0c78=_0x9d0c78||0xcc;return function(_0x27ead7){if(_0x27ead7){return _0x178861['sendStatus'](_0x9d0c78);}return _0x178861[_0xe682('0x1a')](_0x9d0c78)[_0xe682('0x1b')]();};}function respondWithResult(_0x1e4755,_0x32b45a){_0x32b45a=_0x32b45a||0xc8;return function(_0x29ec5a){if(_0x29ec5a){return _0x1e4755[_0xe682('0x1a')](_0x32b45a)[_0xe682('0x1c')](_0x29ec5a);}};}function respondWithFilteredResult(_0x30da5d,_0x5940b8){return function(_0x2de4e8){if(_0x2de4e8){var _0x5e29bd=typeof _0x5940b8['offset']==='undefined'&&typeof _0x5940b8[_0xe682('0x1d')]===_0xe682('0x1e');var _0xeae968=_0x2de4e8[_0xe682('0x1f')];var _0x51166c=_0x5e29bd?0x0:_0x5940b8[_0xe682('0x20')];var _0x596ca3=_0x5e29bd?_0x2de4e8[_0xe682('0x1f')]:_0x5940b8['offset']+_0x5940b8[_0xe682('0x1d')];var _0x5a2b51;if(_0x596ca3>=_0xeae968){_0x596ca3=_0xeae968;_0x5a2b51=0xc8;}else{_0x5a2b51=0xce;}_0x30da5d[_0xe682('0x1a')](_0x5a2b51);return _0x30da5d['set']('Content-Range',_0x51166c+'-'+_0x596ca3+'/'+_0xeae968)[_0xe682('0x1c')](_0x2de4e8);}return null;};}function patchUpdates(_0x5ebf37){return function(_0x36c7e0){try{jsonpatch[_0xe682('0x21')](_0x36c7e0,_0x5ebf37,!![]);}catch(_0x3c8f12){return BPromise[_0xe682('0x22')](_0x3c8f12);}return _0x36c7e0[_0xe682('0x23')]();};}function saveUpdates(_0x16fbfe,_0x227139){return function(_0x220eb3){if(_0x220eb3){return _0x220eb3[_0xe682('0x24')](_0x16fbfe)[_0xe682('0x25')](function(_0x1f8757){return _0x1f8757;});}return null;};}function removeEntity(_0x3e9018,_0x46402f){return function(_0x5bfb75){if(_0x5bfb75){return _0x5bfb75['destroy']()[_0xe682('0x25')](function(){_0x3e9018[_0xe682('0x1a')](0xcc)[_0xe682('0x1b')]();});}};}function handleEntityNotFound(_0x4d1502,_0xd0e3c0){return function(_0x4a3835){if(!_0x4a3835){_0x4d1502['sendStatus'](0x194);}return _0x4a3835;};}function handleError(_0x2164dc,_0x108a09){_0x108a09=_0x108a09||0x1f4;return function(_0x422539){logger[_0xe682('0x26')](_0x422539[_0xe682('0x27')]);if(_0x422539['name']){delete _0x422539['name'];}_0x2164dc['status'](_0x108a09)[_0xe682('0x28')](_0x422539);};}exports['index']=function(_0x57f872,_0x3bfd56){var _0x5a2a13={},_0x263154={},_0x5d6802={'count':0x0,'rows':[]};var _0x480a3d=_[_0xe682('0x29')](db[_0xe682('0x2a')][_0xe682('0x2b')],function(_0x3d5b9b){return{'name':_0x3d5b9b['fieldName'],'type':_0x3d5b9b[_0xe682('0x2c')][_0xe682('0x2d')]};});_0x263154[_0xe682('0x2e')]=_[_0xe682('0x29')](_0x480a3d,'name');_0x263154[_0xe682('0x2f')]=_['keys'](_0x57f872[_0xe682('0x2f')]);_0x263154[_0xe682('0x30')]=_['intersection'](_0x263154[_0xe682('0x2e')],_0x263154[_0xe682('0x2f')]);_0x5a2a13['attributes']=_[_0xe682('0x31')](_0x263154[_0xe682('0x2e')],qs[_0xe682('0x32')](_0x57f872[_0xe682('0x2f')][_0xe682('0x32')]));_0x5a2a13['attributes']=_0x5a2a13[_0xe682('0x33')][_0xe682('0x34')]?_0x5a2a13[_0xe682('0x33')]:_0x263154['model'];if(!_0x57f872[_0xe682('0x2f')][_0xe682('0x35')]('nolimit')){_0x5a2a13[_0xe682('0x1d')]=qs[_0xe682('0x1d')](_0x57f872['query'][_0xe682('0x1d')]);_0x5a2a13[_0xe682('0x20')]=qs[_0xe682('0x20')](_0x57f872[_0xe682('0x2f')]['offset']);}_0x5a2a13[_0xe682('0x36')]=qs[_0xe682('0x37')](_0x57f872[_0xe682('0x2f')][_0xe682('0x37')]);_0x5a2a13[_0xe682('0x38')]=qs[_0xe682('0x30')](_[_0xe682('0x39')](_0x57f872[_0xe682('0x2f')],_0x263154[_0xe682('0x30')]),_0x480a3d);if(_0x57f872[_0xe682('0x2f')][_0xe682('0x3a')]){_0x5a2a13[_0xe682('0x38')]=_[_0xe682('0x3b')](_0x5a2a13[_0xe682('0x38')],{'$or':_[_0xe682('0x29')](_0x480a3d,function(_0x553999){if(_0x553999['type']!==_0xe682('0x3c')){var _0x36e66f={};_0x36e66f[_0x553999[_0xe682('0x3d')]]={'$like':'%'+_0x57f872[_0xe682('0x2f')][_0xe682('0x3a')]+'%'};return _0x36e66f;}})});}_0x5a2a13=_[_0xe682('0x3b')]({},_0x5a2a13,_0x57f872[_0xe682('0x3e')]);var _0x2d6ae6={'where':_0x5a2a13[_0xe682('0x38')]};return db[_0xe682('0x2a')][_0xe682('0x1f')](_0x2d6ae6)[_0xe682('0x25')](function(_0x541292){_0x5d6802['count']=_0x541292;if(_0x57f872[_0xe682('0x2f')][_0xe682('0x3f')]){_0x5a2a13[_0xe682('0x40')]=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0x5a2a13);})[_0xe682('0x25')](function(_0x5aaa0f){_0x5d6802['rows']=_0x5aaa0f;return _0x5d6802;})['then'](respondWithFilteredResult(_0x3bfd56,_0x5a2a13))['catch'](handleError(_0x3bfd56,null));};exports[_0xe682('0x41')]=function(_0x8b03c7,_0x35c4c1){var _0x1cd700={'raw':!![],'where':{'id':_0x8b03c7[_0xe682('0x42')]['id']}},_0xc220b4={};_0xc220b4[_0xe682('0x2e')]=_[_0xe682('0x43')](db[_0xe682('0x2a')][_0xe682('0x2b')]);_0xc220b4['query']=_[_0xe682('0x43')](_0x8b03c7['query']);_0xc220b4[_0xe682('0x30')]=_[_0xe682('0x31')](_0xc220b4[_0xe682('0x2e')],_0xc220b4[_0xe682('0x2f')]);_0x1cd700[_0xe682('0x33')]=_[_0xe682('0x31')](_0xc220b4[_0xe682('0x2e')],qs['fields'](_0x8b03c7['query'][_0xe682('0x32')]));_0x1cd700[_0xe682('0x33')]=_0x1cd700[_0xe682('0x33')]['length']?_0x1cd700[_0xe682('0x33')]:_0xc220b4[_0xe682('0x2e')];if(_0x8b03c7[_0xe682('0x2f')][_0xe682('0x3f')]){_0x1cd700[_0xe682('0x40')]=[{'all':!![]}];}_0x1cd700=_[_0xe682('0x3b')]({},_0x1cd700,_0x8b03c7[_0xe682('0x3e')]);return db[_0xe682('0x2a')][_0xe682('0x44')](_0x1cd700)[_0xe682('0x25')](handleEntityNotFound(_0x35c4c1,null))[_0xe682('0x25')](respondWithResult(_0x35c4c1,null))['catch'](handleError(_0x35c4c1,null));};exports[_0xe682('0x45')]=function(_0x51d6d9,_0x5a2753){return db[_0xe682('0x2a')][_0xe682('0x45')](_0x51d6d9[_0xe682('0x46')],{})[_0xe682('0x25')](respondWithResult(_0x5a2753,0xc9))[_0xe682('0x47')](handleError(_0x5a2753,null));};exports['update']=function(_0x52faa4,_0x254b3d){if(_0x52faa4[_0xe682('0x46')]['id']){delete _0x52faa4[_0xe682('0x46')]['id'];}return db[_0xe682('0x2a')][_0xe682('0x44')]({'where':{'id':_0x52faa4[_0xe682('0x42')]['id']}})[_0xe682('0x25')](handleEntityNotFound(_0x254b3d,null))[_0xe682('0x25')](saveUpdates(_0x52faa4[_0xe682('0x46')],null))['then'](respondWithResult(_0x254b3d,null))['catch'](handleError(_0x254b3d,null));};exports['destroy']=function(_0x50656d,_0x18a55e){return db[_0xe682('0x2a')][_0xe682('0x44')]({'where':{'id':_0x50656d[_0xe682('0x42')]['id']}})[_0xe682('0x25')](handleEntityNotFound(_0x18a55e,null))[_0xe682('0x25')](removeEntity(_0x18a55e,null))[_0xe682('0x47')](handleError(_0x18a55e,null));};exports[_0xe682('0x48')]=function(_0xda6157,_0x6a0848){return db[_0xe682('0x2a')][_0xe682('0x48')]()['then'](respondWithResult(_0x6a0848,null))['catch'](handleError(_0x6a0848,null));}; \ No newline at end of file +var _0xb63f=['hasOwnProperty','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','sendStatus','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length'];(function(_0x387d4c,_0xa49033){var _0x5aa39e=function(_0x5e49f8){while(--_0x5e49f8){_0x387d4c['push'](_0x387d4c['shift']());}};_0x5aa39e(++_0xa49033);}(_0xb63f,0xa3));var _0xfb63=function(_0x1fc1f9,_0x454fb2){_0x1fc1f9=_0x1fc1f9-0x0;var _0x4987ca=_0xb63f[_0x1fc1f9];return _0x4987ca;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfb63('0x0'));var jsonpatch=require(_0xfb63('0x1'));var rp=require(_0xfb63('0x2'));var moment=require(_0xfb63('0x3'));var BPromise=require(_0xfb63('0x4'));var Mustache=require(_0xfb63('0x5'));var util=require(_0xfb63('0x6'));var path=require(_0xfb63('0x7'));var sox=require(_0xfb63('0x8'));var csv=require('to-csv');var ejs=require(_0xfb63('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfb63('0xa'));var squel=require(_0xfb63('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfb63('0xc'));var querystring=require(_0xfb63('0xd'));var Papa=require(_0xfb63('0xe'));var Redis=require('ioredis');var authService=require(_0xfb63('0xf'));var qs=require(_0xfb63('0x10'));var as=require(_0xfb63('0x11'));var hardwareService=require(_0xfb63('0x12'));var logger=require(_0xfb63('0x13'))(_0xfb63('0x14'));var utils=require(_0xfb63('0x15'));var config=require(_0xfb63('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xee69d,_0x233ec3){_0x233ec3=_0x233ec3||0xcc;return function(_0xa2f034){if(_0xa2f034){return _0xee69d['sendStatus'](_0x233ec3);}return _0xee69d[_0xfb63('0x17')](_0x233ec3)[_0xfb63('0x18')]();};}function respondWithResult(_0x48a22c,_0x4575b6){_0x4575b6=_0x4575b6||0xc8;return function(_0x377d1e){if(_0x377d1e){return _0x48a22c[_0xfb63('0x17')](_0x4575b6)[_0xfb63('0x19')](_0x377d1e);}};}function respondWithFilteredResult(_0x51e7ef,_0x44619e){return function(_0x48e2c0){if(_0x48e2c0){var _0x19f196=typeof _0x44619e[_0xfb63('0x1a')]===_0xfb63('0x1b')&&typeof _0x44619e[_0xfb63('0x1c')]===_0xfb63('0x1b');var _0x49081d=_0x48e2c0[_0xfb63('0x1d')];var _0x5dfd32=_0x19f196?0x0:_0x44619e[_0xfb63('0x1a')];var _0x4f7508=_0x19f196?_0x48e2c0[_0xfb63('0x1d')]:_0x44619e[_0xfb63('0x1a')]+_0x44619e[_0xfb63('0x1c')];var _0x452f1e;if(_0x4f7508>=_0x49081d){_0x4f7508=_0x49081d;_0x452f1e=0xc8;}else{_0x452f1e=0xce;}_0x51e7ef['status'](_0x452f1e);return _0x51e7ef[_0xfb63('0x1e')]('Content-Range',_0x5dfd32+'-'+_0x4f7508+'/'+_0x49081d)[_0xfb63('0x19')](_0x48e2c0);}return null;};}function patchUpdates(_0x3ef0cf){return function(_0x564052){try{jsonpatch[_0xfb63('0x1f')](_0x564052,_0x3ef0cf,!![]);}catch(_0x23c4fb){return BPromise['reject'](_0x23c4fb);}return _0x564052[_0xfb63('0x20')]();};}function saveUpdates(_0x43bf68,_0x267953){return function(_0x34e22c){if(_0x34e22c){return _0x34e22c[_0xfb63('0x21')](_0x43bf68)[_0xfb63('0x22')](function(_0x17f81e){return _0x17f81e;});}return null;};}function removeEntity(_0x1bbedc,_0x43c245){return function(_0xa7612f){if(_0xa7612f){return _0xa7612f[_0xfb63('0x23')]()[_0xfb63('0x22')](function(){_0x1bbedc[_0xfb63('0x17')](0xcc)[_0xfb63('0x18')]();});}};}function handleEntityNotFound(_0x26036d,_0x19ea95){return function(_0x1b8f0a){if(!_0x1b8f0a){_0x26036d[_0xfb63('0x24')](0x194);}return _0x1b8f0a;};}function handleError(_0x49482f,_0x2bbe9a){_0x2bbe9a=_0x2bbe9a||0x1f4;return function(_0x4c80c1){logger['error'](_0x4c80c1[_0xfb63('0x25')]);if(_0x4c80c1[_0xfb63('0x26')]){delete _0x4c80c1[_0xfb63('0x26')];}_0x49482f[_0xfb63('0x17')](_0x2bbe9a)[_0xfb63('0x27')](_0x4c80c1);};}exports[_0xfb63('0x28')]=function(_0x594962,_0x45e231){var _0x2a008e={},_0x441dd7={},_0x188501={'count':0x0,'rows':[]};var _0x3c910b=_[_0xfb63('0x29')](db[_0xfb63('0x2a')][_0xfb63('0x2b')],function(_0x293909){return{'name':_0x293909[_0xfb63('0x2c')],'type':_0x293909[_0xfb63('0x2d')]['key']};});_0x441dd7[_0xfb63('0x2e')]=_['map'](_0x3c910b,_0xfb63('0x26'));_0x441dd7[_0xfb63('0x2f')]=_[_0xfb63('0x30')](_0x594962['query']);_0x441dd7['filters']=_[_0xfb63('0x31')](_0x441dd7['model'],_0x441dd7['query']);_0x2a008e[_0xfb63('0x32')]=_['intersection'](_0x441dd7[_0xfb63('0x2e')],qs[_0xfb63('0x33')](_0x594962[_0xfb63('0x2f')][_0xfb63('0x33')]));_0x2a008e[_0xfb63('0x32')]=_0x2a008e[_0xfb63('0x32')][_0xfb63('0x34')]?_0x2a008e[_0xfb63('0x32')]:_0x441dd7['model'];if(!_0x594962['query'][_0xfb63('0x35')]('nolimit')){_0x2a008e[_0xfb63('0x1c')]=qs[_0xfb63('0x1c')](_0x594962[_0xfb63('0x2f')][_0xfb63('0x1c')]);_0x2a008e[_0xfb63('0x1a')]=qs['offset'](_0x594962['query'][_0xfb63('0x1a')]);}_0x2a008e[_0xfb63('0x36')]=qs['sort'](_0x594962['query']['sort']);_0x2a008e[_0xfb63('0x37')]=qs[_0xfb63('0x38')](_[_0xfb63('0x39')](_0x594962['query'],_0x441dd7[_0xfb63('0x38')]),_0x3c910b);if(_0x594962[_0xfb63('0x2f')][_0xfb63('0x3a')]){_0x2a008e[_0xfb63('0x37')]=_[_0xfb63('0x3b')](_0x2a008e[_0xfb63('0x37')],{'$or':_[_0xfb63('0x29')](_0x3c910b,function(_0x579ca5){if(_0x579ca5['type']!==_0xfb63('0x3c')){var _0x4fb080={};_0x4fb080[_0x579ca5[_0xfb63('0x26')]]={'$like':'%'+_0x594962[_0xfb63('0x2f')][_0xfb63('0x3a')]+'%'};return _0x4fb080;}})});}_0x2a008e=_[_0xfb63('0x3b')]({},_0x2a008e,_0x594962[_0xfb63('0x3d')]);var _0x38ecc3={'where':_0x2a008e[_0xfb63('0x37')]};return db[_0xfb63('0x2a')][_0xfb63('0x1d')](_0x38ecc3)[_0xfb63('0x22')](function(_0x3d745a){_0x188501[_0xfb63('0x1d')]=_0x3d745a;if(_0x594962[_0xfb63('0x2f')][_0xfb63('0x3e')]){_0x2a008e[_0xfb63('0x3f')]=[{'all':!![]}];}return db[_0xfb63('0x2a')][_0xfb63('0x40')](_0x2a008e);})[_0xfb63('0x22')](function(_0x3f0d52){_0x188501[_0xfb63('0x41')]=_0x3f0d52;return _0x188501;})[_0xfb63('0x22')](respondWithFilteredResult(_0x45e231,_0x2a008e))['catch'](handleError(_0x45e231,null));};exports['show']=function(_0x29786a,_0x54346d){var _0x3bdc62={'raw':!![],'where':{'id':_0x29786a[_0xfb63('0x42')]['id']}},_0x1fc68b={};_0x1fc68b[_0xfb63('0x2e')]=_[_0xfb63('0x30')](db[_0xfb63('0x2a')][_0xfb63('0x2b')]);_0x1fc68b[_0xfb63('0x2f')]=_[_0xfb63('0x30')](_0x29786a[_0xfb63('0x2f')]);_0x1fc68b[_0xfb63('0x38')]=_[_0xfb63('0x31')](_0x1fc68b['model'],_0x1fc68b[_0xfb63('0x2f')]);_0x3bdc62[_0xfb63('0x32')]=_[_0xfb63('0x31')](_0x1fc68b[_0xfb63('0x2e')],qs[_0xfb63('0x33')](_0x29786a[_0xfb63('0x2f')][_0xfb63('0x33')]));_0x3bdc62[_0xfb63('0x32')]=_0x3bdc62[_0xfb63('0x32')]['length']?_0x3bdc62[_0xfb63('0x32')]:_0x1fc68b[_0xfb63('0x2e')];if(_0x29786a[_0xfb63('0x2f')][_0xfb63('0x3e')]){_0x3bdc62[_0xfb63('0x3f')]=[{'all':!![]}];}_0x3bdc62=_[_0xfb63('0x3b')]({},_0x3bdc62,_0x29786a['options']);return db[_0xfb63('0x2a')][_0xfb63('0x43')](_0x3bdc62)[_0xfb63('0x22')](handleEntityNotFound(_0x54346d,null))[_0xfb63('0x22')](respondWithResult(_0x54346d,null))[_0xfb63('0x44')](handleError(_0x54346d,null));};exports[_0xfb63('0x45')]=function(_0x2cf398,_0x13030c){return db[_0xfb63('0x2a')]['create'](_0x2cf398[_0xfb63('0x46')],{})[_0xfb63('0x22')](respondWithResult(_0x13030c,0xc9))[_0xfb63('0x44')](handleError(_0x13030c,null));};exports[_0xfb63('0x21')]=function(_0x27a179,_0x1f0478){if(_0x27a179[_0xfb63('0x46')]['id']){delete _0x27a179[_0xfb63('0x46')]['id'];}return db[_0xfb63('0x2a')]['find']({'where':{'id':_0x27a179[_0xfb63('0x42')]['id']}})[_0xfb63('0x22')](handleEntityNotFound(_0x1f0478,null))[_0xfb63('0x22')](saveUpdates(_0x27a179[_0xfb63('0x46')],null))[_0xfb63('0x22')](respondWithResult(_0x1f0478,null))[_0xfb63('0x44')](handleError(_0x1f0478,null));};exports['destroy']=function(_0x39d921,_0x24aa62){return db['FaxQueueReport'][_0xfb63('0x43')]({'where':{'id':_0x39d921[_0xfb63('0x42')]['id']}})[_0xfb63('0x22')](handleEntityNotFound(_0x24aa62,null))[_0xfb63('0x22')](removeEntity(_0x24aa62,null))[_0xfb63('0x44')](handleError(_0x24aa62,null));};exports[_0xfb63('0x47')]=function(_0xf95110,_0x43c1a8){return db[_0xfb63('0x2a')][_0xfb63('0x47')]()[_0xfb63('0x22')](respondWithResult(_0x43c1a8,null))['catch'](handleError(_0x43c1a8,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 83c46a1..e1642fe 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['report_fax_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport'];(function(_0x226ec4,_0xb65dfe){var _0x3421e2=function(_0x5edfe8){while(--_0x5edfe8){_0x226ec4['push'](_0x226ec4['shift']());}};_0x3421e2(++_0xb65dfe);}(_0x7a54,0x106));var _0x47a5=function(_0x35be33,_0x5d313c){_0x35be33=_0x35be33-0x0;var _0x1c4a81=_0x7a54[_0x35be33];return _0x1c4a81;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_fax_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport'];(function(_0xe0d935,_0x4610eb){var _0x12db5b=function(_0x371d2c){while(--_0x371d2c){_0xe0d935['push'](_0xe0d935['shift']());}};_0x12db5b(++_0x4610eb);}(_0x7a54,0x106));var _0x47a5=function(_0x51e28d,_0x4bfa52){_0x51e28d=_0x51e28d-0x0;var _0x34e899=_0x7a54[_0x51e28d];return _0x34e899;};'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/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index b509549..192363c 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 _0xad43=['attributes','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','stringify','catch','UpdateFaxQueueReport','update','where'];(function(_0x2cfbef,_0x2d8e4c){var _0x356ae3=function(_0x258749){while(--_0x258749){_0x2cfbef['push'](_0x2cfbef['shift']());}};_0x356ae3(++_0x2d8e4c);}(_0xad43,0x177));var _0x3ad4=function(_0xf73c93,_0x590a0d){_0xf73c93=_0xf73c93-0x0;var _0x81558f=_0xad43[_0xf73c93];return _0x81558f;};'use strict';var _=require(_0x3ad4('0x0'));var util=require(_0x3ad4('0x1'));var moment=require(_0x3ad4('0x2'));var BPromise=require(_0x3ad4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3ad4('0x4'))['db'];var utils=require(_0x3ad4('0x5'));var logger=require('../../config/logger')(_0x3ad4('0x6'));var config=require(_0x3ad4('0x7'));var jayson=require(_0x3ad4('0x8'));var client=jayson[_0x3ad4('0x9')][_0x3ad4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2adf11,_0x492846,_0x8575a1){return new BPromise(function(_0x1ba580,_0xfd53e8){return client[_0x3ad4('0xb')](_0x2adf11,_0x8575a1)[_0x3ad4('0xc')](function(_0x1ca42c){logger[_0x3ad4('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x492846,_0x3ad4('0xe'));logger[_0x3ad4('0xf')](_0x3ad4('0x10'),_0x492846,_0x3ad4('0xe'),JSON['stringify'](_0x1ca42c));if(_0x1ca42c[_0x3ad4('0x11')]){if(_0x1ca42c['error'][_0x3ad4('0x12')]===0x1f4){logger[_0x3ad4('0x11')](_0x3ad4('0x13'),_0x492846,_0x1ca42c[_0x3ad4('0x11')]['message']);return _0xfd53e8(_0x1ca42c[_0x3ad4('0x11')][_0x3ad4('0x14')]);}logger[_0x3ad4('0x11')](_0x3ad4('0x13'),_0x492846,_0x1ca42c[_0x3ad4('0x11')][_0x3ad4('0x14')]);return _0x1ba580(_0x1ca42c['error'][_0x3ad4('0x14')]);}else{logger[_0x3ad4('0xd')](_0x3ad4('0x13'),_0x492846,_0x3ad4('0xe'));_0x1ba580(_0x1ca42c[_0x3ad4('0x15')][_0x3ad4('0x14')]);}})['catch'](function(_0x4867bd){logger[_0x3ad4('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x492846,_0x4867bd);_0xfd53e8(_0x4867bd);});});}exports[_0x3ad4('0x16')]=function(_0x4cba8d){var _0x3430f3=this;return new Promise(function(_0x4860e9,_0x58ded0){return db[_0x3ad4('0x17')][_0x3ad4('0x18')](_0x4cba8d[_0x3ad4('0x19')],{'raw':_0x4cba8d[_0x3ad4('0x1a')]?_0x4cba8d[_0x3ad4('0x1a')][_0x3ad4('0x1b')]===undefined?!![]:![]:!![]})[_0x3ad4('0xc')](function(_0x44f724){logger['info']('CreateFaxQueueReport',_0x4cba8d);logger[_0x3ad4('0xf')](_0x3ad4('0x16'),_0x4cba8d,JSON[_0x3ad4('0x1c')](_0x44f724));_0x4860e9(_0x44f724);})[_0x3ad4('0x1d')](function(_0x103cf5){logger[_0x3ad4('0x11')](_0x3ad4('0x16'),_0x103cf5[_0x3ad4('0x14')],_0x4cba8d);_0x58ded0(_0x3430f3[_0x3ad4('0x11')](0x1f4,_0x103cf5[_0x3ad4('0x14')]));});});};exports[_0x3ad4('0x1e')]=function(_0x4972c4){var _0x4ae5ff=this;return new Promise(function(_0x3b4f0a,_0x269fc1){return db[_0x3ad4('0x17')][_0x3ad4('0x1f')](_0x4972c4[_0x3ad4('0x19')],{'raw':_0x4972c4[_0x3ad4('0x1a')]?_0x4972c4['options'][_0x3ad4('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4972c4['options']?_0x4972c4[_0x3ad4('0x1a')][_0x3ad4('0x20')]||null:null,'attributes':_0x4972c4[_0x3ad4('0x1a')]?_0x4972c4[_0x3ad4('0x1a')][_0x3ad4('0x21')]||null:null,'limit':_0x4972c4[_0x3ad4('0x1a')]?_0x4972c4['options']['limit']||null:null})['then'](function(_0x2dfe8a){logger[_0x3ad4('0xd')](_0x3ad4('0x1e'),_0x4972c4);logger[_0x3ad4('0xf')](_0x3ad4('0x1e'),_0x4972c4,JSON['stringify'](_0x2dfe8a));_0x3b4f0a(_0x2dfe8a);})[_0x3ad4('0x1d')](function(_0x51e00e){logger[_0x3ad4('0x11')]('UpdateFaxQueueReport',_0x51e00e[_0x3ad4('0x14')],_0x4972c4);_0x269fc1(_0x4ae5ff[_0x3ad4('0x11')](0x1f4,_0x51e00e['message']));});});}; \ No newline at end of file +var _0x2d88=['rpc','../../config/environment','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options','raw','CreateFaxQueueReport','UpdateFaxQueueReport','update','where','attributes','util','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0xbed58e,_0x3a1272){var _0x295e44=function(_0x45755a){while(--_0x45755a){_0xbed58e['push'](_0xbed58e['shift']());}};_0x295e44(++_0x3a1272);}(_0x2d88,0x19f));var _0x82d8=function(_0x1b66c8,_0x1569f6){_0x1b66c8=_0x1b66c8-0x0;var _0x1e372a=_0x2d88[_0x1b66c8];return _0x1e372a;};'use strict';var _=require('lodash');var util=require(_0x82d8('0x0'));var moment=require(_0x82d8('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x82d8('0x2'));var db=require(_0x82d8('0x3'))['db'];var utils=require(_0x82d8('0x4'));var logger=require('../../config/logger')(_0x82d8('0x5'));var config=require(_0x82d8('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x82d8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x343fc7,_0x112200,_0xeb140d){return new BPromise(function(_0x8edd35,_0x1ea314){return client[_0x82d8('0x8')](_0x343fc7,_0xeb140d)[_0x82d8('0x9')](function(_0x600670){logger[_0x82d8('0xa')](_0x82d8('0xb'),_0x112200,_0x82d8('0xc'));logger[_0x82d8('0xd')](_0x82d8('0xe'),_0x112200,'request\x20sent',JSON[_0x82d8('0xf')](_0x600670));if(_0x600670[_0x82d8('0x10')]){if(_0x600670[_0x82d8('0x10')][_0x82d8('0x11')]===0x1f4){logger[_0x82d8('0x10')](_0x82d8('0xb'),_0x112200,_0x600670['error'][_0x82d8('0x12')]);return _0x1ea314(_0x600670['error']['message']);}logger[_0x82d8('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x112200,_0x600670['error'][_0x82d8('0x12')]);return _0x8edd35(_0x600670[_0x82d8('0x10')][_0x82d8('0x12')]);}else{logger[_0x82d8('0xa')]('FaxQueueReport,\x20%s,\x20%s',_0x112200,'request\x20sent');_0x8edd35(_0x600670[_0x82d8('0x13')][_0x82d8('0x12')]);}})[_0x82d8('0x14')](function(_0x5c00a9){logger[_0x82d8('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x112200,_0x5c00a9);_0x1ea314(_0x5c00a9);});});}exports['CreateFaxQueueReport']=function(_0x2f3a2d){var _0x5331d3=this;return new Promise(function(_0x35ca17,_0x2b9fb0){return db['FaxQueueReport'][_0x82d8('0x15')](_0x2f3a2d[_0x82d8('0x16')],{'raw':_0x2f3a2d[_0x82d8('0x17')]?_0x2f3a2d['options'][_0x82d8('0x18')]===undefined?!![]:![]:!![]})[_0x82d8('0x9')](function(_0x1b8768){logger[_0x82d8('0xa')]('CreateFaxQueueReport',_0x2f3a2d);logger['debug'](_0x82d8('0x19'),_0x2f3a2d,JSON[_0x82d8('0xf')](_0x1b8768));_0x35ca17(_0x1b8768);})[_0x82d8('0x14')](function(_0x189ac7){logger[_0x82d8('0x10')](_0x82d8('0x19'),_0x189ac7[_0x82d8('0x12')],_0x2f3a2d);_0x2b9fb0(_0x5331d3[_0x82d8('0x10')](0x1f4,_0x189ac7['message']));});});};exports[_0x82d8('0x1a')]=function(_0x26639c){var _0xb1f50b=this;return new Promise(function(_0x3452de,_0x48b364){return db['FaxQueueReport'][_0x82d8('0x1b')](_0x26639c[_0x82d8('0x16')],{'raw':_0x26639c[_0x82d8('0x17')]?_0x26639c[_0x82d8('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26639c[_0x82d8('0x17')]?_0x26639c[_0x82d8('0x17')][_0x82d8('0x1c')]||null:null,'attributes':_0x26639c[_0x82d8('0x17')]?_0x26639c['options'][_0x82d8('0x1d')]||null:null,'limit':_0x26639c[_0x82d8('0x17')]?_0x26639c[_0x82d8('0x17')]['limit']||null:null})['then'](function(_0x10831e){logger[_0x82d8('0xa')](_0x82d8('0x1a'),_0x26639c);logger[_0x82d8('0xd')](_0x82d8('0x1a'),_0x26639c,JSON[_0x82d8('0xf')](_0x10831e));_0x3452de(_0x10831e);})[_0x82d8('0x14')](function(_0x67cc18){logger['error'](_0x82d8('0x1a'),_0x67cc18[_0x82d8('0x12')],_0x26639c);_0x48b364(_0xb1f50b[_0x82d8('0x10')](0x1f4,_0x67cc18['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 9c5d42a..ad816e5 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 _0x923c=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','describe','show','create','/:id','update','delete','destroy','exports','multer'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x923c,0x92));var _0xc923=function(_0x2003df,_0x50dfba){_0x2003df=_0x2003df-0x0;var _0x32f176=_0x923c[_0x2003df];return _0x32f176;};'use strict';var multer=require(_0xc923('0x0'));var util=require(_0xc923('0x1'));var path=require(_0xc923('0x2'));var timeout=require(_0xc923('0x3'));var express=require(_0xc923('0x4'));var router=express[_0xc923('0x5')]();var fs_extra=require(_0xc923('0x6'));var auth=require(_0xc923('0x7'));var interaction=require(_0xc923('0x8'));var config=require('../../config/environment');var controller=require(_0xc923('0x9'));router[_0xc923('0xa')]('/',auth[_0xc923('0xb')](),controller[_0xc923('0xc')]);router['get']('/describe',auth[_0xc923('0xb')](),controller[_0xc923('0xd')]);router['get']('/:id',auth[_0xc923('0xb')](),controller[_0xc923('0xe')]);router['post']('/',auth[_0xc923('0xb')](),controller[_0xc923('0xf')]);router['put'](_0xc923('0x10'),auth[_0xc923('0xb')](),controller[_0xc923('0x11')]);router[_0xc923('0x12')]('/:id',auth[_0xc923('0xb')](),controller[_0xc923('0x13')]);module[_0xc923('0x14')]=router; \ No newline at end of file +var _0xdfbe=['create','put','update','delete','exports','util','path','fs-extra','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x4c5ed3,_0x5e5b5c){var _0x368903=function(_0x3602aa){while(--_0x3602aa){_0x4c5ed3['push'](_0x4c5ed3['shift']());}};_0x368903(++_0x5e5b5c);}(_0xdfbe,0x1e1));var _0xedfb=function(_0xe0c73d,_0x513c88){_0xe0c73d=_0xe0c73d-0x0;var _0x2c8760=_0xdfbe[_0xe0c73d];return _0x2c8760;};'use strict';var multer=require('multer');var util=require(_0xedfb('0x0'));var path=require(_0xedfb('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xedfb('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xedfb('0x3'));var controller=require(_0xedfb('0x4'));router[_0xedfb('0x5')]('/',auth[_0xedfb('0x6')](),controller[_0xedfb('0x7')]);router['get'](_0xedfb('0x8'),auth[_0xedfb('0x6')](),controller[_0xedfb('0x9')]);router[_0xedfb('0x5')](_0xedfb('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xedfb('0xb')]('/',auth['isAuthenticated'](),controller[_0xedfb('0xc')]);router[_0xedfb('0xd')](_0xedfb('0xa'),auth[_0xedfb('0x6')](),controller[_0xedfb('0xe')]);router[_0xedfb('0xf')](_0xedfb('0xa'),auth[_0xedfb('0x6')](),controller['destroy']);module[_0xedfb('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index af3956b..88db4b1 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x3acdef,_0x3e81b5){var _0x4398a5=function(_0x4def81){while(--_0x4def81){_0x3acdef['push'](_0x3acdef['shift']());}};_0x4398a5(++_0x3e81b5);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x2316b9,_0x87059b){_0x2316b9=_0x2316b9-0x0;var _0x4405a9=_0xf3cd[_0x2316b9];return _0x4405a9;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x134e6f,_0x58c616){var _0x519a52=function(_0xbaad8a){while(--_0xbaad8a){_0x134e6f['push'](_0x134e6f['shift']());}};_0x519a52(++_0x58c616);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index a770e15..1f40370 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 _0x5029=['limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','FaxTransferReport','fieldName','key','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','type','merge','include','findAll','show','params','model','rawAttributes','options','catch','create','body','find','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','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','count'];(function(_0x5ccfa9,_0x415e4d){var _0x228ced=function(_0x57750a){while(--_0x57750a){_0x5ccfa9['push'](_0x5ccfa9['shift']());}};_0x228ced(++_0x415e4d);}(_0x5029,0x198));var _0x9502=function(_0x444462,_0x2bf6e){_0x444462=_0x444462-0x0;var _0x3060fa=_0x5029[_0x444462];return _0x3060fa;};'use strict';var emlformat=require(_0x9502('0x0'));var rimraf=require(_0x9502('0x1'));var zipdir=require(_0x9502('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9502('0x3'));var moment=require('moment');var BPromise=require(_0x9502('0x4'));var Mustache=require('mustache');var util=require(_0x9502('0x5'));var path=require('path');var sox=require(_0x9502('0x6'));var csv=require('to-csv');var ejs=require(_0x9502('0x7'));var fs=require('fs');var fs_extra=require(_0x9502('0x8'));var _=require(_0x9502('0x9'));var squel=require(_0x9502('0xa'));var crypto=require('crypto');var jsforce=require(_0x9502('0xb'));var deskjs=require(_0x9502('0xc'));var toCsv=require(_0x9502('0xd'));var querystring=require('querystring');var Papa=require(_0x9502('0xe'));var Redis=require(_0x9502('0xf'));var authService=require(_0x9502('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9502('0x11'));var hardwareService=require(_0x9502('0x12'));var logger=require(_0x9502('0x13'))(_0x9502('0x14'));var utils=require(_0x9502('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9502('0x16'));var db=require(_0x9502('0x17'))['db'];function respondWithStatusCode(_0x4dfdcf,_0x18d105){_0x18d105=_0x18d105||0xcc;return function(_0x546dd6){if(_0x546dd6){return _0x4dfdcf[_0x9502('0x18')](_0x18d105);}return _0x4dfdcf[_0x9502('0x19')](_0x18d105)['end']();};}function respondWithResult(_0xa56fc8,_0x5ac790){_0x5ac790=_0x5ac790||0xc8;return function(_0x2fbffe){if(_0x2fbffe){return _0xa56fc8[_0x9502('0x19')](_0x5ac790)[_0x9502('0x1a')](_0x2fbffe);}};}function respondWithFilteredResult(_0x1ef686,_0x3e73fb){return function(_0xe0ecd1){if(_0xe0ecd1){var _0x3c9dfa=typeof _0x3e73fb[_0x9502('0x1b')]===_0x9502('0x1c')&&typeof _0x3e73fb['limit']===_0x9502('0x1c');var _0xb276e=_0xe0ecd1['count'];var _0x2d88d6=_0x3c9dfa?0x0:_0x3e73fb[_0x9502('0x1b')];var _0xc47f3a=_0x3c9dfa?_0xe0ecd1[_0x9502('0x1d')]:_0x3e73fb[_0x9502('0x1b')]+_0x3e73fb[_0x9502('0x1e')];var _0x52aa17;if(_0xc47f3a>=_0xb276e){_0xc47f3a=_0xb276e;_0x52aa17=0xc8;}else{_0x52aa17=0xce;}_0x1ef686[_0x9502('0x19')](_0x52aa17);return _0x1ef686[_0x9502('0x1f')](_0x9502('0x20'),_0x2d88d6+'-'+_0xc47f3a+'/'+_0xb276e)['json'](_0xe0ecd1);}return null;};}function patchUpdates(_0x455c12){return function(_0x5baf5f){try{jsonpatch['apply'](_0x5baf5f,_0x455c12,!![]);}catch(_0x37dd03){return BPromise[_0x9502('0x21')](_0x37dd03);}return _0x5baf5f[_0x9502('0x22')]();};}function saveUpdates(_0x94dbc0,_0x192add){return function(_0x4bada1){if(_0x4bada1){return _0x4bada1[_0x9502('0x23')](_0x94dbc0)[_0x9502('0x24')](function(_0x42216c){return _0x42216c;});}return null;};}function removeEntity(_0x83ef4a,_0x440123){return function(_0x38a4d4){if(_0x38a4d4){return _0x38a4d4[_0x9502('0x25')]()['then'](function(){_0x83ef4a[_0x9502('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c1c80,_0x40cb5e){return function(_0x127dd2){if(!_0x127dd2){_0x4c1c80[_0x9502('0x18')](0x194);}return _0x127dd2;};}function handleError(_0x19cc37,_0x417987){_0x417987=_0x417987||0x1f4;return function(_0x989896){logger[_0x9502('0x26')](_0x989896[_0x9502('0x27')]);if(_0x989896[_0x9502('0x28')]){delete _0x989896[_0x9502('0x28')];}_0x19cc37['status'](_0x417987)[_0x9502('0x29')](_0x989896);};}exports[_0x9502('0x2a')]=function(_0x1f5996,_0x5935be){var _0x36c4f6={},_0x40174a={},_0x592a0b={'count':0x0,'rows':[]};var _0x519e63=_[_0x9502('0x2b')](db[_0x9502('0x2c')]['rawAttributes'],function(_0x3f6fb5){return{'name':_0x3f6fb5[_0x9502('0x2d')],'type':_0x3f6fb5['type'][_0x9502('0x2e')]};});_0x40174a['model']=_[_0x9502('0x2b')](_0x519e63,'name');_0x40174a[_0x9502('0x2f')]=_[_0x9502('0x30')](_0x1f5996[_0x9502('0x2f')]);_0x40174a['filters']=_[_0x9502('0x31')](_0x40174a['model'],_0x40174a[_0x9502('0x2f')]);_0x36c4f6[_0x9502('0x32')]=_['intersection'](_0x40174a['model'],qs[_0x9502('0x33')](_0x1f5996[_0x9502('0x2f')][_0x9502('0x33')]));_0x36c4f6[_0x9502('0x32')]=_0x36c4f6[_0x9502('0x32')]['length']?_0x36c4f6[_0x9502('0x32')]:_0x40174a['model'];if(!_0x1f5996[_0x9502('0x2f')][_0x9502('0x34')](_0x9502('0x35'))){_0x36c4f6[_0x9502('0x1e')]=qs[_0x9502('0x1e')](_0x1f5996['query'][_0x9502('0x1e')]);_0x36c4f6['offset']=qs[_0x9502('0x1b')](_0x1f5996['query']['offset']);}_0x36c4f6[_0x9502('0x36')]=qs[_0x9502('0x37')](_0x1f5996['query'][_0x9502('0x37')]);_0x36c4f6['where']=qs[_0x9502('0x38')](_[_0x9502('0x39')](_0x1f5996[_0x9502('0x2f')],_0x40174a['filters']),_0x519e63);if(_0x1f5996['query'][_0x9502('0x3a')]){_0x36c4f6[_0x9502('0x3b')]=_['merge'](_0x36c4f6[_0x9502('0x3b')],{'$or':_['map'](_0x519e63,function(_0x4bda16){if(_0x4bda16[_0x9502('0x3c')]!=='VIRTUAL'){var _0x47be8c={};_0x47be8c[_0x4bda16[_0x9502('0x28')]]={'$like':'%'+_0x1f5996['query'][_0x9502('0x3a')]+'%'};return _0x47be8c;}})});}_0x36c4f6=_[_0x9502('0x3d')]({},_0x36c4f6,_0x1f5996['options']);var _0xb0a910={'where':_0x36c4f6[_0x9502('0x3b')]};return db[_0x9502('0x2c')][_0x9502('0x1d')](_0xb0a910)[_0x9502('0x24')](function(_0x19068e){_0x592a0b['count']=_0x19068e;if(_0x1f5996[_0x9502('0x2f')]['includeAll']){_0x36c4f6[_0x9502('0x3e')]=[{'all':!![]}];}return db[_0x9502('0x2c')][_0x9502('0x3f')](_0x36c4f6);})[_0x9502('0x24')](function(_0x338f63){_0x592a0b['rows']=_0x338f63;return _0x592a0b;})[_0x9502('0x24')](respondWithFilteredResult(_0x5935be,_0x36c4f6))['catch'](handleError(_0x5935be,null));};exports[_0x9502('0x40')]=function(_0x1127a8,_0x278aef){var _0x21a855={'raw':!![],'where':{'id':_0x1127a8[_0x9502('0x41')]['id']}},_0x10b29f={};_0x10b29f[_0x9502('0x42')]=_['keys'](db[_0x9502('0x2c')][_0x9502('0x43')]);_0x10b29f[_0x9502('0x2f')]=_[_0x9502('0x30')](_0x1127a8['query']);_0x10b29f[_0x9502('0x38')]=_[_0x9502('0x31')](_0x10b29f[_0x9502('0x42')],_0x10b29f[_0x9502('0x2f')]);_0x21a855[_0x9502('0x32')]=_['intersection'](_0x10b29f[_0x9502('0x42')],qs[_0x9502('0x33')](_0x1127a8[_0x9502('0x2f')][_0x9502('0x33')]));_0x21a855['attributes']=_0x21a855['attributes']['length']?_0x21a855[_0x9502('0x32')]:_0x10b29f['model'];if(_0x1127a8['query']['includeAll']){_0x21a855['include']=[{'all':!![]}];}_0x21a855=_[_0x9502('0x3d')]({},_0x21a855,_0x1127a8[_0x9502('0x44')]);return db[_0x9502('0x2c')]['find'](_0x21a855)['then'](handleEntityNotFound(_0x278aef,null))[_0x9502('0x24')](respondWithResult(_0x278aef,null))[_0x9502('0x45')](handleError(_0x278aef,null));};exports['create']=function(_0x29b906,_0x5ce28e){return db[_0x9502('0x2c')][_0x9502('0x46')](_0x29b906['body'],{})['then'](respondWithResult(_0x5ce28e,0xc9))[_0x9502('0x45')](handleError(_0x5ce28e,null));};exports['update']=function(_0x57cf66,_0x5be18b){if(_0x57cf66['body']['id']){delete _0x57cf66[_0x9502('0x47')]['id'];}return db[_0x9502('0x2c')][_0x9502('0x48')]({'where':{'id':_0x57cf66['params']['id']}})['then'](handleEntityNotFound(_0x5be18b,null))[_0x9502('0x24')](saveUpdates(_0x57cf66[_0x9502('0x47')],null))[_0x9502('0x24')](respondWithResult(_0x5be18b,null))[_0x9502('0x45')](handleError(_0x5be18b,null));};exports[_0x9502('0x25')]=function(_0x339836,_0xbcfee6){return db['FaxTransferReport'][_0x9502('0x48')]({'where':{'id':_0x339836[_0x9502('0x41')]['id']}})[_0x9502('0x24')](handleEntityNotFound(_0xbcfee6,null))[_0x9502('0x24')](removeEntity(_0xbcfee6,null))[_0x9502('0x45')](handleError(_0xbcfee6,null));};exports['describe']=function(_0x1adfb6,_0x210221){return db['FaxTransferReport']['describe']()[_0x9502('0x24')](respondWithResult(_0x210221,null))[_0x9502('0x45')](handleError(_0x210221,null));}; \ No newline at end of file +var _0x1a10=['merge','VIRTUAL','FaxTransferReport','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','end','error','name','index','map','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x446208,_0xb483fb){var _0xe49563=function(_0x1d3a21){while(--_0x1d3a21){_0x446208['push'](_0x446208['shift']());}};_0xe49563(++_0xb483fb);}(_0x1a10,0xa6));var _0x01a1=function(_0x25b7f2,_0x35e98b){_0x25b7f2=_0x25b7f2-0x0;var _0x424315=_0x1a10[_0x25b7f2];return _0x424315;};'use strict';var emlformat=require(_0x01a1('0x0'));var rimraf=require(_0x01a1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x01a1('0x2'));var rp=require(_0x01a1('0x3'));var moment=require(_0x01a1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x01a1('0x5'));var util=require(_0x01a1('0x6'));var path=require(_0x01a1('0x7'));var sox=require(_0x01a1('0x8'));var csv=require(_0x01a1('0x9'));var ejs=require(_0x01a1('0xa'));var fs=require('fs');var fs_extra=require(_0x01a1('0xb'));var _=require(_0x01a1('0xc'));var squel=require(_0x01a1('0xd'));var crypto=require(_0x01a1('0xe'));var jsforce=require(_0x01a1('0xf'));var deskjs=require(_0x01a1('0x10'));var toCsv=require(_0x01a1('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x01a1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x01a1('0x12'));var hardwareService=require(_0x01a1('0x13'));var logger=require(_0x01a1('0x14'))(_0x01a1('0x15'));var utils=require('../../config/utils');var config=require(_0x01a1('0x16'));var licenseUtil=require(_0x01a1('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x211a78,_0x3baa8c){_0x3baa8c=_0x3baa8c||0xcc;return function(_0x2b2d01){if(_0x2b2d01){return _0x211a78[_0x01a1('0x18')](_0x3baa8c);}return _0x211a78[_0x01a1('0x19')](_0x3baa8c)['end']();};}function respondWithResult(_0x3b7180,_0x31966b){_0x31966b=_0x31966b||0xc8;return function(_0x403ea7){if(_0x403ea7){return _0x3b7180[_0x01a1('0x19')](_0x31966b)[_0x01a1('0x1a')](_0x403ea7);}};}function respondWithFilteredResult(_0x3b4f8c,_0xad76be){return function(_0x1a0bac){if(_0x1a0bac){var _0x2aa043=typeof _0xad76be[_0x01a1('0x1b')]===_0x01a1('0x1c')&&typeof _0xad76be[_0x01a1('0x1d')]==='undefined';var _0x196a7e=_0x1a0bac['count'];var _0x1fbd8d=_0x2aa043?0x0:_0xad76be[_0x01a1('0x1b')];var _0x2d4f85=_0x2aa043?_0x1a0bac[_0x01a1('0x1e')]:_0xad76be['offset']+_0xad76be[_0x01a1('0x1d')];var _0x51f19a;if(_0x2d4f85>=_0x196a7e){_0x2d4f85=_0x196a7e;_0x51f19a=0xc8;}else{_0x51f19a=0xce;}_0x3b4f8c[_0x01a1('0x19')](_0x51f19a);return _0x3b4f8c[_0x01a1('0x1f')](_0x01a1('0x20'),_0x1fbd8d+'-'+_0x2d4f85+'/'+_0x196a7e)[_0x01a1('0x1a')](_0x1a0bac);}return null;};}function patchUpdates(_0x2e7aaf){return function(_0x1d1d43){try{jsonpatch[_0x01a1('0x21')](_0x1d1d43,_0x2e7aaf,!![]);}catch(_0x3d54a5){return BPromise['reject'](_0x3d54a5);}return _0x1d1d43[_0x01a1('0x22')]();};}function saveUpdates(_0x5256c4,_0xc150dd){return function(_0x3b5d4a){if(_0x3b5d4a){return _0x3b5d4a[_0x01a1('0x23')](_0x5256c4)['then'](function(_0x32b6e4){return _0x32b6e4;});}return null;};}function removeEntity(_0x1bd82c,_0x11b8c6){return function(_0xb08240){if(_0xb08240){return _0xb08240[_0x01a1('0x24')]()[_0x01a1('0x25')](function(){_0x1bd82c['status'](0xcc)[_0x01a1('0x26')]();});}};}function handleEntityNotFound(_0x56fce7,_0x2534b0){return function(_0xf899e5){if(!_0xf899e5){_0x56fce7[_0x01a1('0x18')](0x194);}return _0xf899e5;};}function handleError(_0x3412f7,_0x2baccc){_0x2baccc=_0x2baccc||0x1f4;return function(_0x19c8f6){logger[_0x01a1('0x27')](_0x19c8f6['stack']);if(_0x19c8f6[_0x01a1('0x28')]){delete _0x19c8f6['name'];}_0x3412f7[_0x01a1('0x19')](_0x2baccc)['send'](_0x19c8f6);};}exports[_0x01a1('0x29')]=function(_0x44cf49,_0x250200){var _0x103e89={},_0x503139={},_0xb33101={'count':0x0,'rows':[]};var _0x3d62fe=_[_0x01a1('0x2a')](db['FaxTransferReport']['rawAttributes'],function(_0x16bf93){return{'name':_0x16bf93['fieldName'],'type':_0x16bf93[_0x01a1('0x2b')][_0x01a1('0x2c')]};});_0x503139[_0x01a1('0x2d')]=_['map'](_0x3d62fe,_0x01a1('0x28'));_0x503139[_0x01a1('0x2e')]=_['keys'](_0x44cf49['query']);_0x503139[_0x01a1('0x2f')]=_[_0x01a1('0x30')](_0x503139[_0x01a1('0x2d')],_0x503139[_0x01a1('0x2e')]);_0x103e89['attributes']=_[_0x01a1('0x30')](_0x503139['model'],qs[_0x01a1('0x31')](_0x44cf49[_0x01a1('0x2e')][_0x01a1('0x31')]));_0x103e89[_0x01a1('0x32')]=_0x103e89[_0x01a1('0x32')][_0x01a1('0x33')]?_0x103e89[_0x01a1('0x32')]:_0x503139[_0x01a1('0x2d')];if(!_0x44cf49['query'][_0x01a1('0x34')](_0x01a1('0x35'))){_0x103e89[_0x01a1('0x1d')]=qs[_0x01a1('0x1d')](_0x44cf49[_0x01a1('0x2e')][_0x01a1('0x1d')]);_0x103e89[_0x01a1('0x1b')]=qs[_0x01a1('0x1b')](_0x44cf49[_0x01a1('0x2e')][_0x01a1('0x1b')]);}_0x103e89[_0x01a1('0x36')]=qs['sort'](_0x44cf49[_0x01a1('0x2e')][_0x01a1('0x37')]);_0x103e89[_0x01a1('0x38')]=qs[_0x01a1('0x2f')](_[_0x01a1('0x39')](_0x44cf49[_0x01a1('0x2e')],_0x503139[_0x01a1('0x2f')]),_0x3d62fe);if(_0x44cf49['query'][_0x01a1('0x3a')]){_0x103e89[_0x01a1('0x38')]=_[_0x01a1('0x3b')](_0x103e89[_0x01a1('0x38')],{'$or':_[_0x01a1('0x2a')](_0x3d62fe,function(_0x4978b7){if(_0x4978b7[_0x01a1('0x2b')]!==_0x01a1('0x3c')){var _0x55f779={};_0x55f779[_0x4978b7[_0x01a1('0x28')]]={'$like':'%'+_0x44cf49[_0x01a1('0x2e')]['filter']+'%'};return _0x55f779;}})});}_0x103e89=_['merge']({},_0x103e89,_0x44cf49['options']);var _0x2589ba={'where':_0x103e89[_0x01a1('0x38')]};return db[_0x01a1('0x3d')][_0x01a1('0x1e')](_0x2589ba)[_0x01a1('0x25')](function(_0x3f3b37){_0xb33101[_0x01a1('0x1e')]=_0x3f3b37;if(_0x44cf49[_0x01a1('0x2e')][_0x01a1('0x3e')]){_0x103e89[_0x01a1('0x3f')]=[{'all':!![]}];}return db[_0x01a1('0x3d')][_0x01a1('0x40')](_0x103e89);})['then'](function(_0x5bed4e){_0xb33101[_0x01a1('0x41')]=_0x5bed4e;return _0xb33101;})[_0x01a1('0x25')](respondWithFilteredResult(_0x250200,_0x103e89))[_0x01a1('0x42')](handleError(_0x250200,null));};exports['show']=function(_0x389737,_0x2e2e9c){var _0x32e94d={'raw':!![],'where':{'id':_0x389737[_0x01a1('0x43')]['id']}},_0xf66d5a={};_0xf66d5a['model']=_[_0x01a1('0x44')](db[_0x01a1('0x3d')][_0x01a1('0x45')]);_0xf66d5a[_0x01a1('0x2e')]=_['keys'](_0x389737[_0x01a1('0x2e')]);_0xf66d5a['filters']=_['intersection'](_0xf66d5a[_0x01a1('0x2d')],_0xf66d5a[_0x01a1('0x2e')]);_0x32e94d[_0x01a1('0x32')]=_[_0x01a1('0x30')](_0xf66d5a[_0x01a1('0x2d')],qs[_0x01a1('0x31')](_0x389737[_0x01a1('0x2e')][_0x01a1('0x31')]));_0x32e94d[_0x01a1('0x32')]=_0x32e94d[_0x01a1('0x32')][_0x01a1('0x33')]?_0x32e94d[_0x01a1('0x32')]:_0xf66d5a[_0x01a1('0x2d')];if(_0x389737[_0x01a1('0x2e')][_0x01a1('0x3e')]){_0x32e94d['include']=[{'all':!![]}];}_0x32e94d=_[_0x01a1('0x3b')]({},_0x32e94d,_0x389737[_0x01a1('0x46')]);return db[_0x01a1('0x3d')][_0x01a1('0x47')](_0x32e94d)['then'](handleEntityNotFound(_0x2e2e9c,null))[_0x01a1('0x25')](respondWithResult(_0x2e2e9c,null))[_0x01a1('0x42')](handleError(_0x2e2e9c,null));};exports[_0x01a1('0x48')]=function(_0x3cfe21,_0x19d58d){return db[_0x01a1('0x3d')][_0x01a1('0x48')](_0x3cfe21[_0x01a1('0x49')],{})['then'](respondWithResult(_0x19d58d,0xc9))[_0x01a1('0x42')](handleError(_0x19d58d,null));};exports[_0x01a1('0x23')]=function(_0x55c9d6,_0x3143f8){if(_0x55c9d6['body']['id']){delete _0x55c9d6[_0x01a1('0x49')]['id'];}return db[_0x01a1('0x3d')]['find']({'where':{'id':_0x55c9d6['params']['id']}})[_0x01a1('0x25')](handleEntityNotFound(_0x3143f8,null))[_0x01a1('0x25')](saveUpdates(_0x55c9d6[_0x01a1('0x49')],null))[_0x01a1('0x25')](respondWithResult(_0x3143f8,null))[_0x01a1('0x42')](handleError(_0x3143f8,null));};exports[_0x01a1('0x24')]=function(_0x3bd43f,_0x4f3896){return db[_0x01a1('0x3d')][_0x01a1('0x47')]({'where':{'id':_0x3bd43f[_0x01a1('0x43')]['id']}})[_0x01a1('0x25')](handleEntityNotFound(_0x4f3896,null))['then'](removeEntity(_0x4f3896,null))[_0x01a1('0x42')](handleError(_0x4f3896,null));};exports[_0x01a1('0x4a')]=function(_0x4c530f,_0x5e5fef){return db['FaxTransferReport'][_0x01a1('0x4a')]()[_0x01a1('0x25')](respondWithResult(_0x5e5fef,null))[_0x01a1('0x42')](handleError(_0x5e5fef,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 694dbb3..d13fca3 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 _0xb0f6=['FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','./faxTransferReport.attributes','exports'];(function(_0x39af07,_0x5155a7){var _0x4381fd=function(_0x92c328){while(--_0x92c328){_0x39af07['push'](_0x39af07['shift']());}};_0x4381fd(++_0x5155a7);}(_0xb0f6,0x1bf));var _0x6b0f=function(_0x4cb529,_0x47ba2a){_0x4cb529=_0x4cb529-0x0;var _0x354d96=_0xb0f6[_0x4cb529];return _0x354d96;};'use strict';var _=require(_0x6b0f('0x0'));var util=require(_0x6b0f('0x1'));var logger=require(_0x6b0f('0x2'))(_0x6b0f('0x3'));var moment=require(_0x6b0f('0x4'));var BPromise=require('bluebird');var rp=require(_0x6b0f('0x5'));var fs=require('fs');var path=require(_0x6b0f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6b0f('0x7'));module[_0x6b0f('0x8')]=function(_0x202032,_0x21b7d0){return _0x202032['define'](_0x6b0f('0x9'),attributes,{'tableName':_0x6b0f('0xa'),'paranoid':![],'indexes':[{'name':_0x6b0f('0xb'),'fields':[_0x6b0f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf5fd=['report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./faxTransferReport.attributes','define'];(function(_0x1fb49d,_0x17353a){var _0x160def=function(_0x4fc4f9){while(--_0x4fc4f9){_0x1fb49d['push'](_0x1fb49d['shift']());}};_0x160def(++_0x17353a);}(_0xf5fd,0xc8));var _0xdf5f=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0xf5fd[_0x22b68a];return _0x1ac67a;};'use strict';var _=require(_0xdf5f('0x0'));var util=require(_0xdf5f('0x1'));var logger=require(_0xdf5f('0x2'))(_0xdf5f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf5f('0x4'));var rimraf=require(_0xdf5f('0x5'));var config=require(_0xdf5f('0x6'));var attributes=require(_0xdf5f('0x7'));module['exports']=function(_0x304eb6,_0x40a943){return _0x304eb6[_0xdf5f('0x8')]('FaxTransferReport',attributes,{'tableName':_0xdf5f('0x9'),'paranoid':![],'indexes':[{'name':_0xdf5f('0xa'),'fields':[_0xdf5f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 0678a6a..382086b 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 _0x630f=['../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxTransferReport,\x20%s,\x20%s','result','lodash','moment','bluebird','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x630f,0x161));var _0xf630=function(_0x50bf4e,_0x482126){_0x50bf4e=_0x50bf4e-0x0;var _0x478f64=_0x630f[_0x50bf4e];return _0x478f64;};'use strict';var _=require(_0xf630('0x0'));var util=require('util');var moment=require(_0xf630('0x1'));var BPromise=require(_0xf630('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf630('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf630('0x4'));var logger=require('../../config/logger')(_0xf630('0x5'));var config=require(_0xf630('0x6'));var jayson=require(_0xf630('0x7'));var client=jayson[_0xf630('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ec2d4,_0x3cdbfb,_0x43c55f){return new BPromise(function(_0x4c4ade,_0x20d60d){return client[_0xf630('0x9')](_0x5ec2d4,_0x43c55f)[_0xf630('0xa')](function(_0x2fe53d){logger[_0xf630('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x3cdbfb,_0xf630('0xc'));logger[_0xf630('0xd')](_0xf630('0xe'),_0x3cdbfb,_0xf630('0xc'),JSON[_0xf630('0xf')](_0x2fe53d));if(_0x2fe53d[_0xf630('0x10')]){if(_0x2fe53d[_0xf630('0x10')][_0xf630('0x11')]===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x3cdbfb,_0x2fe53d[_0xf630('0x10')]['message']);return _0x20d60d(_0x2fe53d[_0xf630('0x10')][_0xf630('0x12')]);}logger[_0xf630('0x10')](_0xf630('0x13'),_0x3cdbfb,_0x2fe53d[_0xf630('0x10')]['message']);return _0x4c4ade(_0x2fe53d[_0xf630('0x10')][_0xf630('0x12')]);}else{logger[_0xf630('0xb')](_0xf630('0x13'),_0x3cdbfb,_0xf630('0xc'));_0x4c4ade(_0x2fe53d[_0xf630('0x14')][_0xf630('0x12')]);}})['catch'](function(_0xf0a676){logger['error'](_0xf630('0x13'),_0x3cdbfb,_0xf0a676);_0x20d60d(_0xf0a676);});});} \ No newline at end of file +var _0x8c3e=['jayson/promise','http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x4f8100,_0x37f9c3){var _0x164488=function(_0x4d7dd9){while(--_0x4d7dd9){_0x4f8100['push'](_0x4f8100['shift']());}};_0x164488(++_0x37f9c3);}(_0x8c3e,0xe8));var _0xe8c3=function(_0x4cc588,_0x4a9bc4){_0x4cc588=_0x4cc588-0x0;var _0x36619d=_0x8c3e[_0x4cc588];return _0x36619d;};'use strict';var _=require(_0xe8c3('0x0'));var util=require(_0xe8c3('0x1'));var moment=require(_0xe8c3('0x2'));var BPromise=require(_0xe8c3('0x3'));var rs=require(_0xe8c3('0x4'));var fs=require('fs');var Redis=require(_0xe8c3('0x5'));var db=require(_0xe8c3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe8c3('0x7'))(_0xe8c3('0x8'));var config=require(_0xe8c3('0x9'));var jayson=require(_0xe8c3('0xa'));var client=jayson['client'][_0xe8c3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c0117,_0x475bbe,_0x4612ab){return new BPromise(function(_0x5d35d8,_0x317919){return client['request'](_0x4c0117,_0x4612ab)[_0xe8c3('0xc')](function(_0x4473f8){logger[_0xe8c3('0xd')](_0xe8c3('0xe'),_0x475bbe,_0xe8c3('0xf'));logger[_0xe8c3('0x10')](_0xe8c3('0x11'),_0x475bbe,'request\x20sent',JSON[_0xe8c3('0x12')](_0x4473f8));if(_0x4473f8['error']){if(_0x4473f8[_0xe8c3('0x13')]['code']===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x475bbe,_0x4473f8[_0xe8c3('0x13')][_0xe8c3('0x14')]);return _0x317919(_0x4473f8[_0xe8c3('0x13')][_0xe8c3('0x14')]);}logger[_0xe8c3('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x475bbe,_0x4473f8['error'][_0xe8c3('0x14')]);return _0x5d35d8(_0x4473f8['error'][_0xe8c3('0x14')]);}else{logger['info'](_0xe8c3('0xe'),_0x475bbe,_0xe8c3('0xf'));_0x5d35d8(_0x4473f8['result'][_0xe8c3('0x14')]);}})[_0xe8c3('0x15')](function(_0x520140){logger[_0xe8c3('0x13')](_0xe8c3('0xe'),_0x475bbe,_0x520140);_0x317919(_0x520140);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 686783a..fa3d987 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 _0x6d66=['post','put','/:id','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','/describe','isAuthenticated','describe','show'];(function(_0x256130,_0x56ff88){var _0x29839f=function(_0x3dfa22){while(--_0x3dfa22){_0x256130['push'](_0x256130['shift']());}};_0x29839f(++_0x56ff88);}(_0x6d66,0xe9));var _0x66d6=function(_0x10c63a,_0x1284c6){_0x10c63a=_0x10c63a-0x0;var _0xf4a586=_0x6d66[_0x10c63a];return _0xf4a586;};'use strict';var multer=require(_0x66d6('0x0'));var util=require(_0x66d6('0x1'));var path=require(_0x66d6('0x2'));var timeout=require('connect-timeout');var express=require(_0x66d6('0x3'));var router=express[_0x66d6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x66d6('0x5'));var interaction=require(_0x66d6('0x6'));var config=require(_0x66d6('0x7'));var controller=require(_0x66d6('0x8'));router[_0x66d6('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x66d6('0x9')](_0x66d6('0xa'),auth[_0x66d6('0xb')](),controller[_0x66d6('0xc')]);router[_0x66d6('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x66d6('0xd')]);router[_0x66d6('0xe')]('/',auth[_0x66d6('0xb')](),controller['create']);router[_0x66d6('0xf')](_0x66d6('0x10'),auth[_0x66d6('0xb')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x66d6('0x11')]);module[_0x66d6('0x12')]=router; \ No newline at end of file +var _0x1097=['isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller'];(function(_0x37dd6e,_0x515639){var _0x168f1e=function(_0x110b50){while(--_0x110b50){_0x37dd6e['push'](_0x37dd6e['shift']());}};_0x168f1e(++_0x515639);}(_0x1097,0x99));var _0x7109=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x1097[_0x1589dd];return _0x1bddd1;};'use strict';var multer=require('multer');var util=require(_0x7109('0x0'));var path=require('path');var timeout=require(_0x7109('0x1'));var express=require('express');var router=express[_0x7109('0x2')]();var fs_extra=require(_0x7109('0x3'));var auth=require(_0x7109('0x4'));var interaction=require(_0x7109('0x5'));var config=require('../../config/environment');var controller=require(_0x7109('0x6'));router['get']('/',auth[_0x7109('0x7')](),controller[_0x7109('0x8')]);router[_0x7109('0x9')](_0x7109('0xa'),auth['isAuthenticated'](),controller[_0x7109('0xb')]);router['get'](_0x7109('0xc'),auth['isAuthenticated'](),controller[_0x7109('0xd')]);router[_0x7109('0xe')]('/',auth[_0x7109('0x7')](),controller[_0x7109('0xf')]);router[_0x7109('0x10')](_0x7109('0xc'),auth[_0x7109('0x7')](),controller[_0x7109('0x11')]);router[_0x7109('0x12')](_0x7109('0xc'),auth[_0x7109('0x7')](),controller['destroy']);module[_0x7109('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index d609400..5fe395f 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 _0xdde7=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','/:id','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x10555a,_0x238459){var _0x4a5c41=function(_0x3753ef){while(--_0x3753ef){_0x10555a['push'](_0x10555a['shift']());}};_0x4a5c41(++_0x238459);}(_0xdde7,0x1c4));var _0x7dde=function(_0x393eac,_0x4505f3){_0x393eac=_0x393eac-0x0;var _0x37a891=_0xdde7[_0x393eac];return _0x37a891;};'use strict';var multer=require(_0x7dde('0x0'));var util=require(_0x7dde('0x1'));var path=require(_0x7dde('0x2'));var timeout=require(_0x7dde('0x3'));var express=require('express');var router=express[_0x7dde('0x4')]();var fs_extra=require(_0x7dde('0x5'));var auth=require(_0x7dde('0x6'));var interaction=require(_0x7dde('0x7'));var config=require('../../config/environment');var controller=require(_0x7dde('0x8'));router[_0x7dde('0x9')]('/',auth[_0x7dde('0xa')](),controller[_0x7dde('0xb')]);router[_0x7dde('0x9')]('/:id',auth[_0x7dde('0xa')](),controller[_0x7dde('0xc')]);router[_0x7dde('0x9')](_0x7dde('0xd'),auth[_0x7dde('0xa')](),controller[_0x7dde('0xe')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x7dde('0xf')]);router[_0x7dde('0x10')]('/',auth[_0x7dde('0xa')](),controller[_0x7dde('0x11')]);router[_0x7dde('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x7dde('0x12')]);router[_0x7dde('0x13')](_0x7dde('0x14'),auth[_0x7dde('0xa')](),controller[_0x7dde('0x15')]);router['delete']('/:id',auth[_0x7dde('0xa')](),controller[_0x7dde('0x16')]);module[_0x7dde('0x17')]=router; \ No newline at end of file +var _0x4e84=['isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','/:id','show'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4e84,0x191));var _0x44e8=function(_0x92d91f,_0x39b9d9){_0x92d91f=_0x92d91f-0x0;var _0x5276f2=_0x4e84[_0x92d91f];return _0x5276f2;};'use strict';var multer=require(_0x44e8('0x0'));var util=require(_0x44e8('0x1'));var path=require('path');var timeout=require(_0x44e8('0x2'));var express=require(_0x44e8('0x3'));var router=express[_0x44e8('0x4')]();var fs_extra=require(_0x44e8('0x5'));var auth=require(_0x44e8('0x6'));var interaction=require(_0x44e8('0x7'));var config=require(_0x44e8('0x8'));var controller=require(_0x44e8('0x9'));router[_0x44e8('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x44e8('0xb'),auth['isAuthenticated'](),controller[_0x44e8('0xc')]);router[_0x44e8('0xa')]('/:id/configurations',auth[_0x44e8('0xd')](),controller[_0x44e8('0xe')]);router[_0x44e8('0xa')](_0x44e8('0xf'),auth[_0x44e8('0xd')](),controller[_0x44e8('0x10')]);router[_0x44e8('0x11')]('/',auth[_0x44e8('0xd')](),controller[_0x44e8('0x12')]);router['post'](_0x44e8('0x13'),auth[_0x44e8('0xd')](),controller['addConfiguration']);router[_0x44e8('0x14')](_0x44e8('0xb'),auth[_0x44e8('0xd')](),controller['update']);router[_0x44e8('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x44e8('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index a32e2fa..ca67715 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 _0x07e1=['exports','STRING','ENUM','basic','newTab'];(function(_0x430459,_0x58519c){var _0x3a2439=function(_0x27a0b3){while(--_0x27a0b3){_0x430459['push'](_0x430459['shift']());}};_0x3a2439(++_0x58519c);}(_0x07e1,0x140));var _0x107e=function(_0x4e26d2,_0x21be50){_0x4e26d2=_0x4e26d2-0x0;var _0x17665a=_0x07e1[_0x4e26d2];return _0x17665a;};'use strict';var Sequelize=require('sequelize');module[_0x107e('0x0')]={'name':{'type':Sequelize[_0x107e('0x1')]},'description':{'type':Sequelize[_0x107e('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x107e('0x1')]},'authType':{'type':Sequelize[_0x107e('0x2')](_0x107e('0x3')),'defaultValue':_0x107e('0x3')},'password':{'type':Sequelize[_0x107e('0x1')]},'consumerKey':{'type':Sequelize[_0x107e('0x1')]},'consumerSecret':{'type':Sequelize[_0x107e('0x1')]},'token':{'type':Sequelize[_0x107e('0x1')]},'tokenSecret':{'type':Sequelize[_0x107e('0x1')]},'serverUrl':{'type':Sequelize[_0x107e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x107e('0x2')]('integrationTab',_0x107e('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x150a=['STRING','basic','ENUM','integrationTab','newTab','sequelize'];(function(_0x5d345b,_0x7b2e03){var _0x175516=function(_0x4ee93c){while(--_0x4ee93c){_0x5d345b['push'](_0x5d345b['shift']());}};_0x175516(++_0x7b2e03);}(_0x150a,0x13d));var _0xa150=function(_0x341ced,_0x5774ad){_0x341ced=_0x341ced-0x0;var _0x5726b5=_0x150a[_0x341ced];return _0x5726b5;};'use strict';var Sequelize=require(_0xa150('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa150('0x1')]},'remoteUri':{'type':Sequelize[_0xa150('0x1')]},'authType':{'type':Sequelize['ENUM'](_0xa150('0x2')),'defaultValue':_0xa150('0x2')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xa150('0x1')]},'consumerSecret':{'type':Sequelize[_0xa150('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xa150('0x1')]},'serverUrl':{'type':Sequelize[_0xa150('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa150('0x3')](_0xa150('0x4'),_0xa150('0x5')),'defaultValue':_0xa150('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 1227db8..cde32b8 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 _0x628d=['send','test','Wrong\x20credentials','eml-format','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','../../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','offset','undefined','count','set','json','reject','then','destroy','stack','name','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','DeskAccount','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','update','getConfigurations','findOne','DeskConfiguration','order','hasOwnProperty','AccountId','Subjects','getSubjects','channel','getDescriptions','DeskField','Descriptions','getFields','priority','remoteUri','authType','username','consumerKey','consumerSecret','token','tokenSecret','substring','lastIndexOf','GET','basic','Authorization','format','Basic\x20%s','toString','base64','entries','active','label','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x628d,0xeb));var _0xd628=function(_0x493477,_0x35aee7){_0x493477=_0x493477-0x0;var _0x296f08=_0x628d[_0x493477];return _0x296f08;};'use strict';var emlformat=require(_0xd628('0x0'));var rimraf=require(_0xd628('0x1'));var zipdir=require(_0xd628('0x2'));var jsonpatch=require(_0xd628('0x3'));var rp=require(_0xd628('0x4'));var moment=require(_0xd628('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd628('0x6'));var util=require(_0xd628('0x7'));var path=require(_0xd628('0x8'));var sox=require(_0xd628('0x9'));var csv=require(_0xd628('0xa'));var ejs=require(_0xd628('0xb'));var fs=require('fs');var fs_extra=require(_0xd628('0xc'));var _=require(_0xd628('0xd'));var squel=require('squel');var crypto=require(_0xd628('0xe'));var jsforce=require(_0xd628('0xf'));var deskjs=require(_0xd628('0x10'));var toCsv=require(_0xd628('0xa'));var querystring=require(_0xd628('0x11'));var Papa=require(_0xd628('0x12'));var Redis=require('ioredis');var authService=require(_0xd628('0x13'));var qs=require(_0xd628('0x14'));var as=require(_0xd628('0x15'));var hardwareService=require(_0xd628('0x16'));var logger=require('../../config/logger')(_0xd628('0x17'));var utils=require(_0xd628('0x18'));var config=require(_0xd628('0x19'));var licenseUtil=require(_0xd628('0x1a'));var db=require(_0xd628('0x1b'))['db'];var integrations=require(_0xd628('0x1c'));function respondWithStatusCode(_0x2e5aa8,_0x5edd43){_0x5edd43=_0x5edd43||0xcc;return function(_0x11f9d9){if(_0x11f9d9){return _0x2e5aa8[_0xd628('0x1d')](_0x5edd43);}return _0x2e5aa8[_0xd628('0x1e')](_0x5edd43)[_0xd628('0x1f')]();};}function respondWithResult(_0xe5cd3d,_0x4b0f5c){_0x4b0f5c=_0x4b0f5c||0xc8;return function(_0x1871d1){if(_0x1871d1){return _0xe5cd3d['status'](_0x4b0f5c)['json'](_0x1871d1);}};}function respondWithFilteredResult(_0x2b0f07,_0x2ed1b0){return function(_0x29e12d){if(_0x29e12d){var _0x23874d=typeof _0x2ed1b0[_0xd628('0x20')]==='undefined'&&typeof _0x2ed1b0['limit']===_0xd628('0x21');var _0x482a88=_0x29e12d[_0xd628('0x22')];var _0x20056f=_0x23874d?0x0:_0x2ed1b0[_0xd628('0x20')];var _0x25cc03=_0x23874d?_0x29e12d[_0xd628('0x22')]:_0x2ed1b0[_0xd628('0x20')]+_0x2ed1b0['limit'];var _0x1aacc2;if(_0x25cc03>=_0x482a88){_0x25cc03=_0x482a88;_0x1aacc2=0xc8;}else{_0x1aacc2=0xce;}_0x2b0f07[_0xd628('0x1e')](_0x1aacc2);return _0x2b0f07[_0xd628('0x23')]('Content-Range',_0x20056f+'-'+_0x25cc03+'/'+_0x482a88)[_0xd628('0x24')](_0x29e12d);}return null;};}function patchUpdates(_0x189a58){return function(_0x287cdb){try{jsonpatch['apply'](_0x287cdb,_0x189a58,!![]);}catch(_0x5653f4){return BPromise[_0xd628('0x25')](_0x5653f4);}return _0x287cdb['save']();};}function saveUpdates(_0x2001b2,_0x2c70a4){return function(_0x2e79f2){if(_0x2e79f2){return _0x2e79f2['update'](_0x2001b2)[_0xd628('0x26')](function(_0xb42b8d){return _0xb42b8d;});}return null;};}function removeEntity(_0x3ad956,_0x59a5e4){return function(_0x5e56ef){if(_0x5e56ef){return _0x5e56ef[_0xd628('0x27')]()[_0xd628('0x26')](function(){_0x3ad956['status'](0xcc)[_0xd628('0x1f')]();});}};}function handleEntityNotFound(_0x5a5cfd,_0x64e95a){return function(_0xc78317){if(!_0xc78317){_0x5a5cfd[_0xd628('0x1d')](0x194);}return _0xc78317;};}function handleError(_0x12ab60,_0x343147){_0x343147=_0x343147||0x1f4;return function(_0x3c42fa){logger['error'](_0x3c42fa[_0xd628('0x28')]);if(_0x3c42fa[_0xd628('0x29')]){delete _0x3c42fa[_0xd628('0x29')];}_0x12ab60[_0xd628('0x1e')](_0x343147)['send'](_0x3c42fa);};}exports[_0xd628('0x2a')]=function(_0x11c957,_0x213747){var _0x4158d1={},_0x1a7c40={},_0x31b0e6={'count':0x0,'rows':[]};var _0x3a48e0=_[_0xd628('0x2b')](db['DeskAccount']['rawAttributes'],function(_0x2bca87){return{'name':_0x2bca87[_0xd628('0x2c')],'type':_0x2bca87[_0xd628('0x2d')][_0xd628('0x2e')]};});_0x1a7c40[_0xd628('0x2f')]=_[_0xd628('0x2b')](_0x3a48e0,'name');_0x1a7c40[_0xd628('0x30')]=_['keys'](_0x11c957[_0xd628('0x30')]);_0x1a7c40[_0xd628('0x31')]=_[_0xd628('0x32')](_0x1a7c40['model'],_0x1a7c40[_0xd628('0x30')]);_0x4158d1[_0xd628('0x33')]=_[_0xd628('0x32')](_0x1a7c40[_0xd628('0x2f')],qs['fields'](_0x11c957['query'][_0xd628('0x34')]));_0x4158d1[_0xd628('0x33')]=_0x4158d1[_0xd628('0x33')][_0xd628('0x35')]?_0x4158d1['attributes']:_0x1a7c40['model'];if(!_0x11c957['query']['hasOwnProperty'](_0xd628('0x36'))){_0x4158d1['limit']=qs[_0xd628('0x37')](_0x11c957[_0xd628('0x30')][_0xd628('0x37')]);_0x4158d1[_0xd628('0x20')]=qs['offset'](_0x11c957[_0xd628('0x30')][_0xd628('0x20')]);}_0x4158d1['order']=qs[_0xd628('0x38')](_0x11c957['query'][_0xd628('0x38')]);_0x4158d1[_0xd628('0x39')]=qs[_0xd628('0x31')](_['pick'](_0x11c957[_0xd628('0x30')],_0x1a7c40[_0xd628('0x31')]),_0x3a48e0);if(_0x11c957[_0xd628('0x30')][_0xd628('0x3a')]){_0x4158d1[_0xd628('0x39')]=_[_0xd628('0x3b')](_0x4158d1['where'],{'$or':_[_0xd628('0x2b')](_0x3a48e0,function(_0x4c4b61){if(_0x4c4b61[_0xd628('0x2d')]!==_0xd628('0x3c')){var _0x582faa={};_0x582faa[_0x4c4b61[_0xd628('0x29')]]={'$like':'%'+_0x11c957[_0xd628('0x30')][_0xd628('0x3a')]+'%'};return _0x582faa;}})});}_0x4158d1=_[_0xd628('0x3b')]({},_0x4158d1,_0x11c957[_0xd628('0x3d')]);var _0x137f43={'where':_0x4158d1[_0xd628('0x39')]};return db['DeskAccount'][_0xd628('0x22')](_0x137f43)[_0xd628('0x26')](function(_0x2bff32){_0x31b0e6[_0xd628('0x22')]=_0x2bff32;if(_0x11c957[_0xd628('0x30')][_0xd628('0x3e')]){_0x4158d1[_0xd628('0x3f')]=[{'all':!![]}];}return db[_0xd628('0x40')][_0xd628('0x41')](_0x4158d1);})[_0xd628('0x26')](function(_0x425cac){_0x31b0e6[_0xd628('0x42')]=_0x425cac;return _0x31b0e6;})['then'](respondWithFilteredResult(_0x213747,_0x4158d1))[_0xd628('0x43')](handleError(_0x213747,null));};exports[_0xd628('0x44')]=function(_0x54a491,_0x4a9c97){var _0x2cc36c={'raw':![],'where':{'id':_0x54a491[_0xd628('0x45')]['id']}},_0x2ecd83={};_0x2ecd83[_0xd628('0x2f')]=_[_0xd628('0x46')](db[_0xd628('0x40')][_0xd628('0x47')]);_0x2ecd83[_0xd628('0x30')]=_[_0xd628('0x46')](_0x54a491['query']);_0x2ecd83['filters']=_['intersection'](_0x2ecd83['model'],_0x2ecd83[_0xd628('0x30')]);_0x2cc36c['attributes']=_[_0xd628('0x32')](_0x2ecd83[_0xd628('0x2f')],qs['fields'](_0x54a491[_0xd628('0x30')][_0xd628('0x34')]));_0x2cc36c[_0xd628('0x33')]=_0x2cc36c[_0xd628('0x33')][_0xd628('0x35')]?_0x2cc36c['attributes']:_0x2ecd83['model'];if(_0x54a491['query'][_0xd628('0x3e')]){_0x2cc36c['include']=[{'all':!![]}];}_0x2cc36c=_[_0xd628('0x3b')]({},_0x2cc36c,_0x54a491[_0xd628('0x3d')]);return db[_0xd628('0x40')][_0xd628('0x48')](_0x2cc36c)['then'](handleEntityNotFound(_0x4a9c97,null))[_0xd628('0x26')](respondWithResult(_0x4a9c97,null))['catch'](handleError(_0x4a9c97,null));};exports['create']=function(_0x5ed823,_0x5a3472){return db[_0xd628('0x40')][_0xd628('0x49')](_0x5ed823[_0xd628('0x4a')],{})['then'](respondWithResult(_0x5a3472,0xc9))['catch'](handleError(_0x5a3472,null));};exports[_0xd628('0x4b')]=function(_0x2ab8ce,_0x598f14){if(_0x2ab8ce['body']['id']){delete _0x2ab8ce[_0xd628('0x4a')]['id'];}return db[_0xd628('0x40')][_0xd628('0x48')]({'where':{'id':_0x2ab8ce[_0xd628('0x45')]['id']}})['then'](handleEntityNotFound(_0x598f14,null))['then'](saveUpdates(_0x2ab8ce[_0xd628('0x4a')],null))[_0xd628('0x26')](respondWithResult(_0x598f14,null))[_0xd628('0x43')](handleError(_0x598f14,null));};exports[_0xd628('0x27')]=function(_0x27ef26,_0x2d7496){return db[_0xd628('0x40')][_0xd628('0x48')]({'where':{'id':_0x27ef26[_0xd628('0x45')]['id']}})[_0xd628('0x26')](handleEntityNotFound(_0x2d7496,null))[_0xd628('0x26')](removeEntity(_0x2d7496,null))[_0xd628('0x43')](handleError(_0x2d7496,null));};exports[_0xd628('0x4c')]=function(_0x32dacd,_0x4462b1,_0xa9dda6){var _0x5b3796={};var _0x49de2a={};var _0x201c5e;var _0x50d3b6;return db[_0xd628('0x40')][_0xd628('0x4d')]({'where':{'id':_0x32dacd[_0xd628('0x45')]['id']}})[_0xd628('0x26')](handleEntityNotFound(_0x4462b1,null))[_0xd628('0x26')](function(_0x51be41){if(_0x51be41){_0x201c5e=_0x51be41;_0x49de2a['model']=_[_0xd628('0x46')](db[_0xd628('0x4e')][_0xd628('0x47')]);_0x49de2a['query']=_[_0xd628('0x46')](_0x32dacd['query']);_0x49de2a[_0xd628('0x31')]=_[_0xd628('0x32')](_0x49de2a[_0xd628('0x2f')],_0x49de2a['query']);_0x5b3796[_0xd628('0x33')]=_[_0xd628('0x32')](_0x49de2a[_0xd628('0x2f')],qs[_0xd628('0x34')](_0x32dacd[_0xd628('0x30')][_0xd628('0x34')]));_0x5b3796['attributes']=_0x5b3796['attributes'][_0xd628('0x35')]?_0x5b3796[_0xd628('0x33')]:_0x49de2a[_0xd628('0x2f')];_0x5b3796[_0xd628('0x4f')]=qs[_0xd628('0x38')](_0x32dacd[_0xd628('0x30')][_0xd628('0x38')]);_0x5b3796[_0xd628('0x39')]=qs['filters'](_['pick'](_0x32dacd[_0xd628('0x30')],_0x49de2a[_0xd628('0x31')]));if(_0x32dacd['query'][_0xd628('0x3a')]){_0x5b3796['where']=_[_0xd628('0x3b')](_0x5b3796[_0xd628('0x39')],{'$or':_[_0xd628('0x2b')](_0x5b3796[_0xd628('0x33')],function(_0x3810f1){var _0x216697={};_0x216697[_0x3810f1]={'$like':'%'+_0x32dacd[_0xd628('0x30')][_0xd628('0x3a')]+'%'};return _0x216697;})});}_0x5b3796=_[_0xd628('0x3b')]({},_0x5b3796,_0x32dacd[_0xd628('0x3d')]);return _0x201c5e[_0xd628('0x4c')](_0x5b3796);}})['then'](function(_0x10f3f7){if(_0x10f3f7){_0x50d3b6=_0x10f3f7[_0xd628('0x35')];if(!_0x32dacd[_0xd628('0x30')][_0xd628('0x50')](_0xd628('0x36'))){_0x5b3796[_0xd628('0x37')]=qs[_0xd628('0x37')](_0x32dacd['query'][_0xd628('0x37')]);_0x5b3796[_0xd628('0x20')]=qs[_0xd628('0x20')](_0x32dacd[_0xd628('0x30')]['offset']);}return _0x201c5e['getConfigurations'](_0x5b3796);}})[_0xd628('0x26')](function(_0x472ef8){if(_0x472ef8){return _0x472ef8?{'count':_0x50d3b6,'rows':_0x472ef8}:null;}})[_0xd628('0x26')](respondWithResult(_0x4462b1,null))[_0xd628('0x43')](handleError(_0x4462b1,null));};exports['addConfiguration']=function(_0x42e140,_0x1cc06c,_0x450b0d){if(_0x42e140[_0xd628('0x4a')]['id']){delete _0x42e140[_0xd628('0x4a')]['id'];}return db[_0xd628('0x40')][_0xd628('0x4d')]({'where':{'id':_0x42e140['params']['id']}})[_0xd628('0x26')](handleEntityNotFound(_0x1cc06c,null))[_0xd628('0x26')](function(_0x317b9a){if(_0x317b9a){_0x42e140[_0xd628('0x4a')][_0xd628('0x51')]=_0x317b9a['id'];_0x42e140[_0xd628('0x4a')][_0xd628('0x52')]=integrations[_0xd628('0x53')](_0x42e140[_0xd628('0x4a')][_0xd628('0x54')],_0x42e140['body'][_0xd628('0x2d')]);_0x42e140[_0xd628('0x4a')]['Descriptions']=integrations[_0xd628('0x55')](_0x42e140[_0xd628('0x4a')][_0xd628('0x54')],_0x42e140[_0xd628('0x4a')][_0xd628('0x2d')]);return db['DeskConfiguration']['create'](_0x42e140['body'],{'include':[{'model':db[_0xd628('0x56')],'as':_0xd628('0x52')},{'model':db[_0xd628('0x56')],'as':_0xd628('0x57')}]});}return null;})[_0xd628('0x26')](respondWithResult(_0x1cc06c,null))[_0xd628('0x43')](handleError(_0x1cc06c,null));};exports[_0xd628('0x58')]=function(_0x5cbf95,_0xcc8d74,_0x25cb43){var _0xdb272c=[{'name':'priority','label':_0xd628('0x59'),'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 _0x58f55f='';return db[_0xd628('0x40')][_0xd628('0x4d')]({'where':{'id':_0x5cbf95[_0xd628('0x45')]['id']},'attributes':['id',_0xd628('0x5a'),_0xd628('0x5b'),_0xd628('0x5c'),'password',_0xd628('0x5d'),_0xd628('0x5e'),_0xd628('0x5f'),_0xd628('0x60')]})[_0xd628('0x26')](handleEntityNotFound(_0xcc8d74,null))[_0xd628('0x26')](function(_0x192775){if(_0x192775){_0x58f55f=_0x192775['remoteUri'];var _0x34ebe9=_0x58f55f['slice'](-0x1);if(_0x34ebe9==='/'){_0x58f55f=_0x58f55f[_0xd628('0x61')](0x0,_0x58f55f[_0xd628('0x62')](_0x34ebe9));}var _0x231a07={'method':_0xd628('0x63'),'uri':util['format']('%s/custom_fields',_0x58f55f),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x192775[_0xd628('0x5b')]===_0xd628('0x64')){_0x231a07['headers'][_0xd628('0x65')]=util[_0xd628('0x66')](_0xd628('0x67'),new Buffer(util[_0xd628('0x66')]('%s:%s',_0x192775[_0xd628('0x5c')],_0x192775['password']))[_0xd628('0x68')](_0xd628('0x69')));}return rp(_0x231a07)[_0xd628('0x26')](function(_0x524b0c){return _0xdb272c['concat'](_[_0xd628('0x2b')](_0x524b0c['_embedded'][_0xd628('0x6a')],function(_0x3973f9){return{'id':_0x3973f9['name'],'name':_0x3973f9[_0xd628('0x29')],'type':_0x3973f9[_0xd628('0x2d')],'active':_0x3973f9[_0xd628('0x6b')],'label':_0x3973f9[_0xd628('0x6c')],'custom':!![]};}));});}})[_0xd628('0x26')](function(_0x247274){return{'count':_0x247274[_0xd628('0x35')],'rows':_0x247274};})[_0xd628('0x26')](respondWithResult(_0xcc8d74,null))['catch'](function(_0x267071){var _0x446ee7=_0x5cbf95[_0xd628('0x30')]['test']?0x1f4:_0x267071[_0xd628('0x6d')]||0x1f4;logger[_0xd628('0x6e')](_0xd628('0x6f'),_0xd628('0x58'),_0x446ee7,JSON[_0xd628('0x70')](_0x267071));delete _0x267071['name'];if(_0x446ee7===0x191){_0x446ee7=0x190;}_0xcc8d74[_0xd628('0x1e')](_0x446ee7)[_0xd628('0x71')](_0x5cbf95[_0xd628('0x30')][_0xd628('0x72')]?{'message':_0xd628('0x73'),'statusCode':_0x267071[_0xd628('0x6d')]}:_0x267071);});}; \ No newline at end of file +var _0x4f89=['nolimit','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','length','include','create','body','find','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','getSubjects','channel','getDescriptions','DeskField','Subjects','Descriptions','getFields','priority','authType','consumerKey','consumerSecret','token','tokenSecret','remoteUri','slice','substring','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','username','password','base64','concat','_embedded','entries','active','label','test','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','eml-format','fast-json-patch','sox','to-csv','ejs','fs-extra','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x31d8ab,_0x21fc97){var _0x29de5e=function(_0x32c83c){while(--_0x32c83c){_0x31d8ab['push'](_0x31d8ab['shift']());}};_0x29de5e(++_0x21fc97);}(_0x4f89,0xa6));var _0x94f8=function(_0x5951b9,_0xa33e50){_0x5951b9=_0x5951b9-0x0;var _0x426c13=_0x4f89[_0x5951b9];return _0x426c13;};'use strict';var emlformat=require(_0x94f8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x94f8('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x94f8('0x2'));var csv=require(_0x94f8('0x3'));var ejs=require(_0x94f8('0x4'));var fs=require('fs');var fs_extra=require(_0x94f8('0x5'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x94f8('0x3'));var querystring=require(_0x94f8('0x6'));var Papa=require(_0x94f8('0x7'));var Redis=require(_0x94f8('0x8'));var authService=require(_0x94f8('0x9'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x94f8('0xa'))(_0x94f8('0xb'));var utils=require(_0x94f8('0xc'));var config=require('../../config/environment');var licenseUtil=require(_0x94f8('0xd'));var db=require(_0x94f8('0xe'))['db'];var integrations=require(_0x94f8('0xf'));function respondWithStatusCode(_0x30ac55,_0x154827){_0x154827=_0x154827||0xcc;return function(_0x578c0a){if(_0x578c0a){return _0x30ac55[_0x94f8('0x10')](_0x154827);}return _0x30ac55[_0x94f8('0x11')](_0x154827)[_0x94f8('0x12')]();};}function respondWithResult(_0x23f35d,_0x361549){_0x361549=_0x361549||0xc8;return function(_0x3e442b){if(_0x3e442b){return _0x23f35d['status'](_0x361549)[_0x94f8('0x13')](_0x3e442b);}};}function respondWithFilteredResult(_0x13a03d,_0x4f339c){return function(_0x407580){if(_0x407580){var _0x5b2cee=typeof _0x4f339c[_0x94f8('0x14')]===_0x94f8('0x15')&&typeof _0x4f339c[_0x94f8('0x16')]===_0x94f8('0x15');var _0xfe1244=_0x407580[_0x94f8('0x17')];var _0x40e37f=_0x5b2cee?0x0:_0x4f339c[_0x94f8('0x14')];var _0x43cb05=_0x5b2cee?_0x407580[_0x94f8('0x17')]:_0x4f339c[_0x94f8('0x14')]+_0x4f339c['limit'];var _0x40da7a;if(_0x43cb05>=_0xfe1244){_0x43cb05=_0xfe1244;_0x40da7a=0xc8;}else{_0x40da7a=0xce;}_0x13a03d[_0x94f8('0x11')](_0x40da7a);return _0x13a03d[_0x94f8('0x18')]('Content-Range',_0x40e37f+'-'+_0x43cb05+'/'+_0xfe1244)[_0x94f8('0x13')](_0x407580);}return null;};}function patchUpdates(_0x264ed6){return function(_0x16baf7){try{jsonpatch[_0x94f8('0x19')](_0x16baf7,_0x264ed6,!![]);}catch(_0x5a2b4a){return BPromise['reject'](_0x5a2b4a);}return _0x16baf7[_0x94f8('0x1a')]();};}function saveUpdates(_0x5c75c1,_0x5917f5){return function(_0x9ffa3){if(_0x9ffa3){return _0x9ffa3[_0x94f8('0x1b')](_0x5c75c1)[_0x94f8('0x1c')](function(_0x29aef5){return _0x29aef5;});}return null;};}function removeEntity(_0x4f2ede,_0x350f6e){return function(_0x4efe4d){if(_0x4efe4d){return _0x4efe4d['destroy']()[_0x94f8('0x1c')](function(){_0x4f2ede['status'](0xcc)[_0x94f8('0x12')]();});}};}function handleEntityNotFound(_0x47be05,_0x235f79){return function(_0x7df09b){if(!_0x7df09b){_0x47be05['sendStatus'](0x194);}return _0x7df09b;};}function handleError(_0x2136dc,_0x3b5331){_0x3b5331=_0x3b5331||0x1f4;return function(_0x477d76){logger[_0x94f8('0x1d')](_0x477d76[_0x94f8('0x1e')]);if(_0x477d76[_0x94f8('0x1f')]){delete _0x477d76['name'];}_0x2136dc[_0x94f8('0x11')](_0x3b5331)[_0x94f8('0x20')](_0x477d76);};}exports[_0x94f8('0x21')]=function(_0xfcdfa2,_0x2d6df7){var _0x146238={},_0x13dd1c={},_0x4e3590={'count':0x0,'rows':[]};var _0x3240d2=_[_0x94f8('0x22')](db[_0x94f8('0x23')][_0x94f8('0x24')],function(_0x4e4988){return{'name':_0x4e4988[_0x94f8('0x25')],'type':_0x4e4988[_0x94f8('0x26')][_0x94f8('0x27')]};});_0x13dd1c[_0x94f8('0x28')]=_[_0x94f8('0x22')](_0x3240d2,_0x94f8('0x1f'));_0x13dd1c[_0x94f8('0x29')]=_[_0x94f8('0x2a')](_0xfcdfa2[_0x94f8('0x29')]);_0x13dd1c[_0x94f8('0x2b')]=_[_0x94f8('0x2c')](_0x13dd1c['model'],_0x13dd1c[_0x94f8('0x29')]);_0x146238[_0x94f8('0x2d')]=_['intersection'](_0x13dd1c[_0x94f8('0x28')],qs['fields'](_0xfcdfa2[_0x94f8('0x29')][_0x94f8('0x2e')]));_0x146238[_0x94f8('0x2d')]=_0x146238['attributes']['length']?_0x146238[_0x94f8('0x2d')]:_0x13dd1c[_0x94f8('0x28')];if(!_0xfcdfa2[_0x94f8('0x29')][_0x94f8('0x2f')](_0x94f8('0x30'))){_0x146238[_0x94f8('0x16')]=qs[_0x94f8('0x16')](_0xfcdfa2[_0x94f8('0x29')][_0x94f8('0x16')]);_0x146238[_0x94f8('0x14')]=qs[_0x94f8('0x14')](_0xfcdfa2[_0x94f8('0x29')][_0x94f8('0x14')]);}_0x146238['order']=qs[_0x94f8('0x31')](_0xfcdfa2['query'][_0x94f8('0x31')]);_0x146238[_0x94f8('0x32')]=qs[_0x94f8('0x2b')](_['pick'](_0xfcdfa2[_0x94f8('0x29')],_0x13dd1c[_0x94f8('0x2b')]),_0x3240d2);if(_0xfcdfa2[_0x94f8('0x29')][_0x94f8('0x33')]){_0x146238[_0x94f8('0x32')]=_[_0x94f8('0x34')](_0x146238['where'],{'$or':_['map'](_0x3240d2,function(_0x38edf6){if(_0x38edf6[_0x94f8('0x26')]!=='VIRTUAL'){var _0x4ac217={};_0x4ac217[_0x38edf6['name']]={'$like':'%'+_0xfcdfa2[_0x94f8('0x29')][_0x94f8('0x33')]+'%'};return _0x4ac217;}})});}_0x146238=_[_0x94f8('0x34')]({},_0x146238,_0xfcdfa2[_0x94f8('0x35')]);var _0x4ebbe7={'where':_0x146238[_0x94f8('0x32')]};return db[_0x94f8('0x23')]['count'](_0x4ebbe7)[_0x94f8('0x1c')](function(_0x4d1bce){_0x4e3590[_0x94f8('0x17')]=_0x4d1bce;if(_0xfcdfa2[_0x94f8('0x29')][_0x94f8('0x36')]){_0x146238['include']=[{'all':!![]}];}return db[_0x94f8('0x23')][_0x94f8('0x37')](_0x146238);})[_0x94f8('0x1c')](function(_0x334844){_0x4e3590[_0x94f8('0x38')]=_0x334844;return _0x4e3590;})[_0x94f8('0x1c')](respondWithFilteredResult(_0x2d6df7,_0x146238))[_0x94f8('0x39')](handleError(_0x2d6df7,null));};exports[_0x94f8('0x3a')]=function(_0x5a7632,_0xa73ec8){var _0x44aa1b={'raw':![],'where':{'id':_0x5a7632[_0x94f8('0x3b')]['id']}},_0x36cdec={};_0x36cdec['model']=_[_0x94f8('0x2a')](db['DeskAccount'][_0x94f8('0x24')]);_0x36cdec['query']=_[_0x94f8('0x2a')](_0x5a7632[_0x94f8('0x29')]);_0x36cdec[_0x94f8('0x2b')]=_['intersection'](_0x36cdec[_0x94f8('0x28')],_0x36cdec['query']);_0x44aa1b[_0x94f8('0x2d')]=_[_0x94f8('0x2c')](_0x36cdec[_0x94f8('0x28')],qs[_0x94f8('0x2e')](_0x5a7632[_0x94f8('0x29')][_0x94f8('0x2e')]));_0x44aa1b[_0x94f8('0x2d')]=_0x44aa1b[_0x94f8('0x2d')][_0x94f8('0x3c')]?_0x44aa1b['attributes']:_0x36cdec[_0x94f8('0x28')];if(_0x5a7632[_0x94f8('0x29')][_0x94f8('0x36')]){_0x44aa1b[_0x94f8('0x3d')]=[{'all':!![]}];}_0x44aa1b=_[_0x94f8('0x34')]({},_0x44aa1b,_0x5a7632[_0x94f8('0x35')]);return db[_0x94f8('0x23')]['find'](_0x44aa1b)[_0x94f8('0x1c')](handleEntityNotFound(_0xa73ec8,null))[_0x94f8('0x1c')](respondWithResult(_0xa73ec8,null))['catch'](handleError(_0xa73ec8,null));};exports[_0x94f8('0x3e')]=function(_0x39ad83,_0x4b3b3e){return db[_0x94f8('0x23')][_0x94f8('0x3e')](_0x39ad83[_0x94f8('0x3f')],{})[_0x94f8('0x1c')](respondWithResult(_0x4b3b3e,0xc9))[_0x94f8('0x39')](handleError(_0x4b3b3e,null));};exports[_0x94f8('0x1b')]=function(_0x222b1a,_0xd02fa3){if(_0x222b1a[_0x94f8('0x3f')]['id']){delete _0x222b1a[_0x94f8('0x3f')]['id'];}return db['DeskAccount'][_0x94f8('0x40')]({'where':{'id':_0x222b1a[_0x94f8('0x3b')]['id']}})['then'](handleEntityNotFound(_0xd02fa3,null))[_0x94f8('0x1c')](saveUpdates(_0x222b1a['body'],null))['then'](respondWithResult(_0xd02fa3,null))[_0x94f8('0x39')](handleError(_0xd02fa3,null));};exports['destroy']=function(_0x148cb5,_0x2ac969){return db[_0x94f8('0x23')][_0x94f8('0x40')]({'where':{'id':_0x148cb5['params']['id']}})['then'](handleEntityNotFound(_0x2ac969,null))[_0x94f8('0x1c')](removeEntity(_0x2ac969,null))[_0x94f8('0x39')](handleError(_0x2ac969,null));};exports[_0x94f8('0x41')]=function(_0x568c30,_0x5bbf65,_0x4a89fe){var _0x590e82={};var _0x5b299e={};var _0x282394;var _0x246b94;return db['DeskAccount'][_0x94f8('0x42')]({'where':{'id':_0x568c30[_0x94f8('0x3b')]['id']}})[_0x94f8('0x1c')](handleEntityNotFound(_0x5bbf65,null))[_0x94f8('0x1c')](function(_0x5bbb30){if(_0x5bbb30){_0x282394=_0x5bbb30;_0x5b299e[_0x94f8('0x28')]=_[_0x94f8('0x2a')](db[_0x94f8('0x43')]['rawAttributes']);_0x5b299e[_0x94f8('0x29')]=_[_0x94f8('0x2a')](_0x568c30[_0x94f8('0x29')]);_0x5b299e[_0x94f8('0x2b')]=_[_0x94f8('0x2c')](_0x5b299e['model'],_0x5b299e[_0x94f8('0x29')]);_0x590e82['attributes']=_[_0x94f8('0x2c')](_0x5b299e[_0x94f8('0x28')],qs[_0x94f8('0x2e')](_0x568c30[_0x94f8('0x29')][_0x94f8('0x2e')]));_0x590e82[_0x94f8('0x2d')]=_0x590e82[_0x94f8('0x2d')][_0x94f8('0x3c')]?_0x590e82[_0x94f8('0x2d')]:_0x5b299e[_0x94f8('0x28')];_0x590e82['order']=qs[_0x94f8('0x31')](_0x568c30['query'][_0x94f8('0x31')]);_0x590e82[_0x94f8('0x32')]=qs['filters'](_['pick'](_0x568c30[_0x94f8('0x29')],_0x5b299e[_0x94f8('0x2b')]));if(_0x568c30[_0x94f8('0x29')][_0x94f8('0x33')]){_0x590e82['where']=_[_0x94f8('0x34')](_0x590e82[_0x94f8('0x32')],{'$or':_[_0x94f8('0x22')](_0x590e82[_0x94f8('0x2d')],function(_0x1baf50){var _0xc13243={};_0xc13243[_0x1baf50]={'$like':'%'+_0x568c30['query']['filter']+'%'};return _0xc13243;})});}_0x590e82=_[_0x94f8('0x34')]({},_0x590e82,_0x568c30['options']);return _0x282394['getConfigurations'](_0x590e82);}})[_0x94f8('0x1c')](function(_0x25ca0d){if(_0x25ca0d){_0x246b94=_0x25ca0d['length'];if(!_0x568c30[_0x94f8('0x29')][_0x94f8('0x2f')](_0x94f8('0x30'))){_0x590e82[_0x94f8('0x16')]=qs[_0x94f8('0x16')](_0x568c30[_0x94f8('0x29')][_0x94f8('0x16')]);_0x590e82[_0x94f8('0x14')]=qs[_0x94f8('0x14')](_0x568c30[_0x94f8('0x29')][_0x94f8('0x14')]);}return _0x282394['getConfigurations'](_0x590e82);}})['then'](function(_0x9d9a01){if(_0x9d9a01){return _0x9d9a01?{'count':_0x246b94,'rows':_0x9d9a01}:null;}})['then'](respondWithResult(_0x5bbf65,null))[_0x94f8('0x39')](handleError(_0x5bbf65,null));};exports[_0x94f8('0x44')]=function(_0x4234bd,_0x1ac577,_0x49a7e0){if(_0x4234bd[_0x94f8('0x3f')]['id']){delete _0x4234bd['body']['id'];}return db[_0x94f8('0x23')][_0x94f8('0x42')]({'where':{'id':_0x4234bd[_0x94f8('0x3b')]['id']}})['then'](handleEntityNotFound(_0x1ac577,null))['then'](function(_0x3b7259){if(_0x3b7259){_0x4234bd[_0x94f8('0x3f')][_0x94f8('0x45')]=_0x3b7259['id'];_0x4234bd[_0x94f8('0x3f')]['Subjects']=integrations[_0x94f8('0x46')](_0x4234bd['body'][_0x94f8('0x47')],_0x4234bd[_0x94f8('0x3f')]['type']);_0x4234bd[_0x94f8('0x3f')]['Descriptions']=integrations[_0x94f8('0x48')](_0x4234bd['body']['channel'],_0x4234bd[_0x94f8('0x3f')][_0x94f8('0x26')]);return db['DeskConfiguration'][_0x94f8('0x3e')](_0x4234bd[_0x94f8('0x3f')],{'include':[{'model':db[_0x94f8('0x49')],'as':_0x94f8('0x4a')},{'model':db['DeskField'],'as':_0x94f8('0x4b')}]});}return null;})['then'](respondWithResult(_0x1ac577,null))['catch'](handleError(_0x1ac577,null));};exports[_0x94f8('0x4c')]=function(_0x24cf7e,_0x28da87,_0x957e9c){var _0x216a34=[{'name':_0x94f8('0x4d'),'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 _0x24e601='';return db['DeskAccount'][_0x94f8('0x42')]({'where':{'id':_0x24cf7e[_0x94f8('0x3b')]['id']},'attributes':['id','remoteUri',_0x94f8('0x4e'),'username','password',_0x94f8('0x4f'),_0x94f8('0x50'),_0x94f8('0x51'),_0x94f8('0x52')]})[_0x94f8('0x1c')](handleEntityNotFound(_0x28da87,null))[_0x94f8('0x1c')](function(_0x36637a){if(_0x36637a){_0x24e601=_0x36637a[_0x94f8('0x53')];var _0x4dd663=_0x24e601[_0x94f8('0x54')](-0x1);if(_0x4dd663==='/'){_0x24e601=_0x24e601[_0x94f8('0x55')](0x0,_0x24e601['lastIndexOf'](_0x4dd663));}var _0x25db1d={'method':_0x94f8('0x56'),'uri':util[_0x94f8('0x57')](_0x94f8('0x58'),_0x24e601),'headers':{'Content-Type':_0x94f8('0x59'),'Accept':_0x94f8('0x59')},'json':!![]};if(_0x36637a['authType']===_0x94f8('0x5a')){_0x25db1d[_0x94f8('0x5b')][_0x94f8('0x5c')]=util[_0x94f8('0x57')](_0x94f8('0x5d'),new Buffer(util['format'](_0x94f8('0x5e'),_0x36637a[_0x94f8('0x5f')],_0x36637a[_0x94f8('0x60')]))['toString'](_0x94f8('0x61')));}return rp(_0x25db1d)[_0x94f8('0x1c')](function(_0x22fcd3){return _0x216a34[_0x94f8('0x62')](_[_0x94f8('0x22')](_0x22fcd3[_0x94f8('0x63')][_0x94f8('0x64')],function(_0x2570d3){return{'id':_0x2570d3[_0x94f8('0x1f')],'name':_0x2570d3['name'],'type':_0x2570d3[_0x94f8('0x26')],'active':_0x2570d3[_0x94f8('0x65')],'label':_0x2570d3[_0x94f8('0x66')],'custom':!![]};}));});}})[_0x94f8('0x1c')](function(_0x5cf290){return{'count':_0x5cf290[_0x94f8('0x3c')],'rows':_0x5cf290};})[_0x94f8('0x1c')](respondWithResult(_0x28da87,null))[_0x94f8('0x39')](function(_0x11b87f){var _0x3865ec=_0x24cf7e[_0x94f8('0x29')][_0x94f8('0x67')]?0x1f4:_0x11b87f['statusCode']||0x1f4;logger['error'](_0x94f8('0x68'),_0x94f8('0x4c'),_0x3865ec,JSON[_0x94f8('0x69')](_0x11b87f));delete _0x11b87f['name'];if(_0x3865ec===0x191){_0x3865ec=0x190;}_0x28da87[_0x94f8('0x11')](_0x3865ec)['send'](_0x24cf7e[_0x94f8('0x29')][_0x94f8('0x67')]?{'message':'Wrong\x20credentials','statusCode':_0x11b87f[_0x94f8('0x6a')]}:_0x11b87f);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 9981ef0..6f6fdcd 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 _0xe53b=['util','api','bluebird','path','rimraf','../../config/environment','define','lodash'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xe53b,0x1cf));var _0xbe53=function(_0x2e52f2,_0x2c5f5a){_0x2e52f2=_0x2e52f2-0x0;var _0x2d1802=_0xe53b[_0x2e52f2];return _0x2d1802;};'use strict';var _=require(_0xbe53('0x0'));var util=require(_0xbe53('0x1'));var logger=require('../../config/logger')(_0xbe53('0x2'));var moment=require('moment');var BPromise=require(_0xbe53('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe53('0x4'));var rimraf=require(_0xbe53('0x5'));var config=require(_0xbe53('0x6'));var attributes=require('./intDeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5ae78b,_0xc435dc){return _0x5ae78b[_0xbe53('0x7')]('DeskAccount',attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0531=['bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','exports','define','int_desk_accounts','util','../../config/logger','moment'];(function(_0x2b729a,_0x21945a){var _0x4a398d=function(_0x267019){while(--_0x267019){_0x2b729a['push'](_0x2b729a['shift']());}};_0x4a398d(++_0x21945a);}(_0x0531,0x141));var _0x1053=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x0531[_0x5037ab];return _0x512adb;};'use strict';var _=require('lodash');var util=require(_0x1053('0x0'));var logger=require(_0x1053('0x1'))('api');var moment=require(_0x1053('0x2'));var BPromise=require(_0x1053('0x3'));var rp=require(_0x1053('0x4'));var fs=require('fs');var path=require(_0x1053('0x5'));var rimraf=require(_0x1053('0x6'));var config=require(_0x1053('0x7'));var attributes=require(_0x1053('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x1053('0x9')]=function(_0xeac4dd,_0x2309d4){return _0xeac4dd[_0x1053('0xa')]('DeskAccount',attributes,{'tableName':_0x1053('0xb'),'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 5c84761..1257ab5 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 _0x248e=['http','then','info','request\x20sent','stringify','error','code','message','DeskAccount,\x20%s,\x20%s','result','catch','GetDeskAccount','DeskAccount','options','limit','include','model','attributes','map','ShowDeskAccount','find','raw','where','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x509273,_0x13fc9f){var _0x38ef40=function(_0xf8d4c9){while(--_0xf8d4c9){_0x509273['push'](_0x509273['shift']());}};_0x38ef40(++_0x13fc9f);}(_0x248e,0x93));var _0xe248=function(_0x1a7e3c,_0x2f98a1){_0x1a7e3c=_0x1a7e3c-0x0;var _0x4cfea9=_0x248e[_0x1a7e3c];return _0x4cfea9;};'use strict';var _=require(_0xe248('0x0'));var util=require(_0xe248('0x1'));var moment=require(_0xe248('0x2'));var BPromise=require('bluebird');var rs=require(_0xe248('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe248('0x4'));var logger=require(_0xe248('0x5'))(_0xe248('0x6'));var config=require(_0xe248('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe248('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e5a61,_0x27a0ba,_0x121577){return new BPromise(function(_0x4bb895,_0x2f99fd){return client['request'](_0x2e5a61,_0x121577)[_0xe248('0x9')](function(_0x20ec29){logger[_0xe248('0xa')]('DeskAccount,\x20%s,\x20%s',_0x27a0ba,_0xe248('0xb'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x27a0ba,'request\x20sent',JSON[_0xe248('0xc')](_0x20ec29));if(_0x20ec29[_0xe248('0xd')]){if(_0x20ec29[_0xe248('0xd')][_0xe248('0xe')]===0x1f4){logger[_0xe248('0xd')]('DeskAccount,\x20%s,\x20%s',_0x27a0ba,_0x20ec29[_0xe248('0xd')]['message']);return _0x2f99fd(_0x20ec29['error'][_0xe248('0xf')]);}logger[_0xe248('0xd')](_0xe248('0x10'),_0x27a0ba,_0x20ec29[_0xe248('0xd')][_0xe248('0xf')]);return _0x4bb895(_0x20ec29[_0xe248('0xd')][_0xe248('0xf')]);}else{logger[_0xe248('0xa')](_0xe248('0x10'),_0x27a0ba,_0xe248('0xb'));_0x4bb895(_0x20ec29[_0xe248('0x11')]['message']);}})[_0xe248('0x12')](function(_0x3a8750){logger[_0xe248('0xd')](_0xe248('0x10'),_0x27a0ba,_0x3a8750);_0x2f99fd(_0x3a8750);});});}exports[_0xe248('0x13')]=function(_0x49ca7c){var _0x59080d=this;return new Promise(function(_0x5ab4a8,_0x414139){return db[_0xe248('0x14')]['findAll']({'raw':_0x49ca7c['options']?_0x49ca7c['options']['raw']===undefined?!![]:![]:!![],'where':_0x49ca7c[_0xe248('0x15')]?_0x49ca7c[_0xe248('0x15')]['where']||null:null,'attributes':_0x49ca7c[_0xe248('0x15')]?_0x49ca7c['options']['attributes']||null:null,'limit':_0x49ca7c[_0xe248('0x15')]?_0x49ca7c['options'][_0xe248('0x16')]||null:null,'include':_0x49ca7c['options']?_0x49ca7c[_0xe248('0x15')][_0xe248('0x17')]?_['map'](_0x49ca7c['options'][_0xe248('0x17')],function(_0x34a864){return{'model':db[_0x34a864[_0xe248('0x18')]],'as':_0x34a864['as'],'attributes':_0x34a864[_0xe248('0x19')],'include':_0x34a864[_0xe248('0x17')]?_['map'](_0x34a864[_0xe248('0x17')],function(_0x4cadca){return{'model':db[_0x4cadca[_0xe248('0x18')]],'as':_0x4cadca['as'],'attributes':_0x4cadca[_0xe248('0x19')],'include':_0x4cadca[_0xe248('0x17')]?_[_0xe248('0x1a')](_0x4cadca[_0xe248('0x17')],function(_0x5e3b15){return{'model':db[_0x5e3b15['model']],'as':_0x5e3b15['as'],'attributes':_0x5e3b15[_0xe248('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe248('0x9')](function(_0x9aa305){logger[_0xe248('0xa')](_0xe248('0x13'),_0x49ca7c);logger['debug'](_0xe248('0x13'),_0x49ca7c,JSON['stringify'](_0x9aa305));_0x5ab4a8(_0x9aa305);})[_0xe248('0x12')](function(_0x496a21){logger[_0xe248('0xd')](_0xe248('0x13'),_0x496a21[_0xe248('0xf')],_0x49ca7c);_0x414139(_0x59080d[_0xe248('0xd')](0x1f4,_0x496a21[_0xe248('0xf')]));});});};exports[_0xe248('0x1b')]=function(_0x169c55){var _0x34a7a0=this;return new Promise(function(_0x372f85,_0x3101f4){return db[_0xe248('0x14')][_0xe248('0x1c')]({'raw':_0x169c55[_0xe248('0x15')]?_0x169c55[_0xe248('0x15')][_0xe248('0x1d')]===undefined?!![]:![]:!![],'where':_0x169c55['options']?_0x169c55[_0xe248('0x15')][_0xe248('0x1e')]||null:null,'attributes':_0x169c55[_0xe248('0x15')]?_0x169c55[_0xe248('0x15')][_0xe248('0x19')]||null:null,'include':_0x169c55['options']?_0x169c55[_0xe248('0x15')][_0xe248('0x17')]?_[_0xe248('0x1a')](_0x169c55[_0xe248('0x15')][_0xe248('0x17')],function(_0x16406c){return{'model':db[_0x16406c[_0xe248('0x18')]],'as':_0x16406c['as'],'attributes':_0x16406c['attributes'],'include':_0x16406c[_0xe248('0x17')]?_[_0xe248('0x1a')](_0x16406c['include'],function(_0x1b7471){return{'model':db[_0x1b7471[_0xe248('0x18')]],'as':_0x1b7471['as'],'attributes':_0x1b7471['attributes'],'include':_0x1b7471['include']?_[_0xe248('0x1a')](_0x1b7471['include'],function(_0x4db475){return{'model':db[_0x4db475[_0xe248('0x18')]],'as':_0x4db475['as'],'attributes':_0x4db475['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3af378){logger[_0xe248('0xa')]('ShowDeskAccount',_0x169c55);logger['debug'](_0xe248('0x1b'),_0x169c55,JSON['stringify'](_0x3af378));_0x372f85(_0x3af378);})[_0xe248('0x12')](function(_0x2e87e4){logger[_0xe248('0xd')]('ShowDeskAccount',_0x2e87e4[_0xe248('0xf')],_0x169c55);_0x3101f4(_0x34a7a0['error'](0x1f4,_0x2e87e4['message']));});});}; \ No newline at end of file +var _0x2987=['error','code','message','DeskAccount,\x20%s,\x20%s','catch','GetDeskAccount','DeskAccount','findAll','options','where','limit','include','map','model','attributes','then','find','raw','ShowDeskAccount','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x41a3dc,_0x14c6c8){var _0x5782bd=function(_0x4468ed){while(--_0x4468ed){_0x41a3dc['push'](_0x41a3dc['shift']());}};_0x5782bd(++_0x14c6c8);}(_0x2987,0x17e));var _0x7298=function(_0xf738ad,_0x5e1d7f){_0xf738ad=_0xf738ad-0x0;var _0x598570=_0x2987[_0xf738ad];return _0x598570;};'use strict';var _=require('lodash');var util=require(_0x7298('0x0'));var moment=require(_0x7298('0x1'));var BPromise=require(_0x7298('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7298('0x3'))['db'];var utils=require(_0x7298('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x7298('0x5'));var jayson=require(_0x7298('0x6'));var client=jayson['client'][_0x7298('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4cb4c7,_0x1d6147,_0x363c92){return new BPromise(function(_0x2b3dc6,_0x2f002d){return client[_0x7298('0x8')](_0x4cb4c7,_0x363c92)['then'](function(_0x325a8a){logger[_0x7298('0x9')]('DeskAccount,\x20%s,\x20%s',_0x1d6147,_0x7298('0xa'));logger[_0x7298('0xb')](_0x7298('0xc'),_0x1d6147,_0x7298('0xa'),JSON[_0x7298('0xd')](_0x325a8a));if(_0x325a8a[_0x7298('0xe')]){if(_0x325a8a['error'][_0x7298('0xf')]===0x1f4){logger[_0x7298('0xe')]('DeskAccount,\x20%s,\x20%s',_0x1d6147,_0x325a8a[_0x7298('0xe')][_0x7298('0x10')]);return _0x2f002d(_0x325a8a['error'][_0x7298('0x10')]);}logger[_0x7298('0xe')](_0x7298('0x11'),_0x1d6147,_0x325a8a[_0x7298('0xe')]['message']);return _0x2b3dc6(_0x325a8a[_0x7298('0xe')][_0x7298('0x10')]);}else{logger[_0x7298('0x9')]('DeskAccount,\x20%s,\x20%s',_0x1d6147,_0x7298('0xa'));_0x2b3dc6(_0x325a8a['result'][_0x7298('0x10')]);}})[_0x7298('0x12')](function(_0x4974ef){logger[_0x7298('0xe')](_0x7298('0x11'),_0x1d6147,_0x4974ef);_0x2f002d(_0x4974ef);});});}exports[_0x7298('0x13')]=function(_0xdbb01d){var _0x1955a5=this;return new Promise(function(_0xe6c14e,_0x16d2db){return db[_0x7298('0x14')][_0x7298('0x15')]({'raw':_0xdbb01d[_0x7298('0x16')]?_0xdbb01d[_0x7298('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xdbb01d[_0x7298('0x16')]?_0xdbb01d[_0x7298('0x16')][_0x7298('0x17')]||null:null,'attributes':_0xdbb01d[_0x7298('0x16')]?_0xdbb01d[_0x7298('0x16')]['attributes']||null:null,'limit':_0xdbb01d['options']?_0xdbb01d[_0x7298('0x16')][_0x7298('0x18')]||null:null,'include':_0xdbb01d[_0x7298('0x16')]?_0xdbb01d['options'][_0x7298('0x19')]?_[_0x7298('0x1a')](_0xdbb01d[_0x7298('0x16')][_0x7298('0x19')],function(_0x21b3d7){return{'model':db[_0x21b3d7[_0x7298('0x1b')]],'as':_0x21b3d7['as'],'attributes':_0x21b3d7[_0x7298('0x1c')],'include':_0x21b3d7['include']?_[_0x7298('0x1a')](_0x21b3d7[_0x7298('0x19')],function(_0x4b34c6){return{'model':db[_0x4b34c6['model']],'as':_0x4b34c6['as'],'attributes':_0x4b34c6[_0x7298('0x1c')],'include':_0x4b34c6[_0x7298('0x19')]?_[_0x7298('0x1a')](_0x4b34c6[_0x7298('0x19')],function(_0x756f44){return{'model':db[_0x756f44[_0x7298('0x1b')]],'as':_0x756f44['as'],'attributes':_0x756f44[_0x7298('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7298('0x1d')](function(_0x20d57c){logger[_0x7298('0x9')](_0x7298('0x13'),_0xdbb01d);logger['debug'](_0x7298('0x13'),_0xdbb01d,JSON['stringify'](_0x20d57c));_0xe6c14e(_0x20d57c);})['catch'](function(_0x3abd39){logger[_0x7298('0xe')]('GetDeskAccount',_0x3abd39['message'],_0xdbb01d);_0x16d2db(_0x1955a5['error'](0x1f4,_0x3abd39[_0x7298('0x10')]));});});};exports['ShowDeskAccount']=function(_0x52110d){var _0x34d84b=this;return new Promise(function(_0x3dd63f,_0x70b72c){return db['DeskAccount'][_0x7298('0x1e')]({'raw':_0x52110d['options']?_0x52110d[_0x7298('0x16')][_0x7298('0x1f')]===undefined?!![]:![]:!![],'where':_0x52110d[_0x7298('0x16')]?_0x52110d[_0x7298('0x16')][_0x7298('0x17')]||null:null,'attributes':_0x52110d[_0x7298('0x16')]?_0x52110d[_0x7298('0x16')][_0x7298('0x1c')]||null:null,'include':_0x52110d[_0x7298('0x16')]?_0x52110d[_0x7298('0x16')]['include']?_['map'](_0x52110d[_0x7298('0x16')]['include'],function(_0x19bc5b){return{'model':db[_0x19bc5b[_0x7298('0x1b')]],'as':_0x19bc5b['as'],'attributes':_0x19bc5b[_0x7298('0x1c')],'include':_0x19bc5b[_0x7298('0x19')]?_[_0x7298('0x1a')](_0x19bc5b['include'],function(_0x200db8){return{'model':db[_0x200db8[_0x7298('0x1b')]],'as':_0x200db8['as'],'attributes':_0x200db8[_0x7298('0x1c')],'include':_0x200db8[_0x7298('0x19')]?_[_0x7298('0x1a')](_0x200db8['include'],function(_0x24ff5f){return{'model':db[_0x24ff5f['model']],'as':_0x24ff5f['as'],'attributes':_0x24ff5f[_0x7298('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7298('0x1d')](function(_0x3dd395){logger['info'](_0x7298('0x20'),_0x52110d);logger[_0x7298('0xb')](_0x7298('0x20'),_0x52110d,JSON[_0x7298('0xd')](_0x3dd395));_0x3dd63f(_0x3dd395);})[_0x7298('0x12')](function(_0x48e3e6){logger[_0x7298('0xe')](_0x7298('0x20'),_0x48e3e6[_0x7298('0x10')],_0x52110d);_0x70b72c(_0x34d84b[_0x7298('0xe')](0x1f4,_0x48e3e6[_0x7298('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index ee0d9c5..5695c75 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 _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(_0x2ba1de,_0x957602){var _0x2abdf9=function(_0x37b2ba){while(--_0x37b2ba){_0x2ba1de['push'](_0x2ba1de['shift']());}};_0x2abdf9(++_0x957602);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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 +var _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x28a61c,_0x265fec){var _0x3fef39=function(_0x28f43b){while(--_0x28f43b){_0x28a61c['push'](_0x28a61c['shift']());}};_0x3fef39(++_0x265fec);}(_0xedd9,0xfc));var _0x9edd=function(_0x3d0117,_0x4921e5){_0x3d0117=_0x3d0117-0x0;var _0x47fd73=_0xedd9[_0x3d0117];return _0x47fd73;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 478d770..9f0ec7b 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 _0x53fb=['sequelize','exports','STRING'];(function(_0x8aa16c,_0x18db4c){var _0x5910f2=function(_0x1604ec){while(--_0x1604ec){_0x8aa16c['push'](_0x8aa16c['shift']());}};_0x5910f2(++_0x18db4c);}(_0x53fb,0xd8));var _0xb53f=function(_0x2d30b9,_0x32cc73){_0x2d30b9=_0x2d30b9-0x0;var _0x16c52e=_0x53fb[_0x2d30b9];return _0x16c52e;};'use strict';var Sequelize=require(_0xb53f('0x0'));module[_0xb53f('0x1')]={'name':{'type':Sequelize[_0xb53f('0x2')]},'description':{'type':Sequelize[_0xb53f('0x2')]}}; \ No newline at end of file +var _0x9622=['sequelize','exports','STRING'];(function(_0x257896,_0x8de612){var _0x1ff242=function(_0x8ea06a){while(--_0x8ea06a){_0x257896['push'](_0x257896['shift']());}};_0x1ff242(++_0x8de612);}(_0x9622,0xba));var _0x2962=function(_0x16bc1b,_0x33a54e){_0x16bc1b=_0x16bc1b-0x0;var _0x5cd224=_0x9622[_0x16bc1b];return _0x5cd224;};'use strict';var Sequelize=require(_0x2962('0x0'));module[_0x2962('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2962('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 83ee3a9..87c418d 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 _0x0a5d=['intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','catch','show','params','create','body','update','find','getFields','DeskField','getSubjects','hasOwnProperty','getDescriptions','findOne','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','save','then','destroy','error','stack','name','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x0a5d,0xc1));var _0xd0a5=function(_0x2650e9,_0xb91cc){_0x2650e9=_0x2650e9-0x0;var _0x3511c8=_0x0a5d[_0x2650e9];return _0x3511c8;};'use strict';var emlformat=require(_0xd0a5('0x0'));var rimraf=require(_0xd0a5('0x1'));var zipdir=require(_0xd0a5('0x2'));var jsonpatch=require(_0xd0a5('0x3'));var rp=require('request-promise');var moment=require(_0xd0a5('0x4'));var BPromise=require(_0xd0a5('0x5'));var Mustache=require(_0xd0a5('0x6'));var util=require(_0xd0a5('0x7'));var path=require(_0xd0a5('0x8'));var sox=require('sox');var csv=require(_0xd0a5('0x9'));var ejs=require(_0xd0a5('0xa'));var fs=require('fs');var fs_extra=require(_0xd0a5('0xb'));var _=require(_0xd0a5('0xc'));var squel=require('squel');var crypto=require(_0xd0a5('0xd'));var jsforce=require(_0xd0a5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd0a5('0x9'));var querystring=require(_0xd0a5('0xf'));var Papa=require('papaparse');var Redis=require(_0xd0a5('0x10'));var authService=require(_0xd0a5('0x11'));var qs=require(_0xd0a5('0x12'));var as=require(_0xd0a5('0x13'));var hardwareService=require(_0xd0a5('0x14'));var logger=require(_0xd0a5('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xd0a5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd0a5('0x17'))['db'];function respondWithStatusCode(_0xd46bc0,_0x578373){_0x578373=_0x578373||0xcc;return function(_0x41ff56){if(_0x41ff56){return _0xd46bc0[_0xd0a5('0x18')](_0x578373);}return _0xd46bc0[_0xd0a5('0x19')](_0x578373)[_0xd0a5('0x1a')]();};}function respondWithResult(_0x2bad61,_0x546eca){_0x546eca=_0x546eca||0xc8;return function(_0x293f76){if(_0x293f76){return _0x2bad61['status'](_0x546eca)[_0xd0a5('0x1b')](_0x293f76);}};}function respondWithFilteredResult(_0x15026b,_0x2b55ef){return function(_0x510aca){if(_0x510aca){var _0x3214e7=typeof _0x2b55ef['offset']===_0xd0a5('0x1c')&&typeof _0x2b55ef[_0xd0a5('0x1d')]===_0xd0a5('0x1c');var _0x1c53dd=_0x510aca['count'];var _0x58f3a0=_0x3214e7?0x0:_0x2b55ef[_0xd0a5('0x1e')];var _0x44f319=_0x3214e7?_0x510aca[_0xd0a5('0x1f')]:_0x2b55ef[_0xd0a5('0x1e')]+_0x2b55ef[_0xd0a5('0x1d')];var _0x2774f4;if(_0x44f319>=_0x1c53dd){_0x44f319=_0x1c53dd;_0x2774f4=0xc8;}else{_0x2774f4=0xce;}_0x15026b[_0xd0a5('0x19')](_0x2774f4);return _0x15026b[_0xd0a5('0x20')](_0xd0a5('0x21'),_0x58f3a0+'-'+_0x44f319+'/'+_0x1c53dd)[_0xd0a5('0x1b')](_0x510aca);}return null;};}function patchUpdates(_0x565fe){return function(_0x277c69){try{jsonpatch[_0xd0a5('0x22')](_0x277c69,_0x565fe,!![]);}catch(_0xfe4df8){return BPromise['reject'](_0xfe4df8);}return _0x277c69[_0xd0a5('0x23')]();};}function saveUpdates(_0x3c22a6,_0x320f0e){return function(_0x3368f5){if(_0x3368f5){return _0x3368f5['update'](_0x3c22a6)[_0xd0a5('0x24')](function(_0x2e3675){return _0x2e3675;});}return null;};}function removeEntity(_0x495b45,_0x6734f4){return function(_0x51b628){if(_0x51b628){return _0x51b628[_0xd0a5('0x25')]()[_0xd0a5('0x24')](function(){_0x495b45[_0xd0a5('0x19')](0xcc)[_0xd0a5('0x1a')]();});}};}function handleEntityNotFound(_0x4b9346,_0x5ecd1f){return function(_0x5411cb){if(!_0x5411cb){_0x4b9346[_0xd0a5('0x18')](0x194);}return _0x5411cb;};}function handleError(_0x5441e6,_0x5833c8){_0x5833c8=_0x5833c8||0x1f4;return function(_0x17d484){logger[_0xd0a5('0x26')](_0x17d484[_0xd0a5('0x27')]);if(_0x17d484[_0xd0a5('0x28')]){delete _0x17d484[_0xd0a5('0x28')];}_0x5441e6[_0xd0a5('0x19')](_0x5833c8)['send'](_0x17d484);};}exports[_0xd0a5('0x29')]=function(_0x456236,_0x4f6bb9){var _0x13d4b7={},_0x5a97e4={},_0x51c2ea={'count':0x0,'rows':[]};var _0x19ab70=_[_0xd0a5('0x2a')](db[_0xd0a5('0x2b')][_0xd0a5('0x2c')],function(_0x54b15a){return{'name':_0x54b15a[_0xd0a5('0x2d')],'type':_0x54b15a[_0xd0a5('0x2e')][_0xd0a5('0x2f')]};});_0x5a97e4[_0xd0a5('0x30')]=_[_0xd0a5('0x2a')](_0x19ab70,'name');_0x5a97e4[_0xd0a5('0x31')]=_[_0xd0a5('0x32')](_0x456236['query']);_0x5a97e4[_0xd0a5('0x33')]=_['intersection'](_0x5a97e4[_0xd0a5('0x30')],_0x5a97e4['query']);_0x13d4b7[_0xd0a5('0x34')]=_[_0xd0a5('0x35')](_0x5a97e4['model'],qs[_0xd0a5('0x36')](_0x456236['query'][_0xd0a5('0x36')]));_0x13d4b7[_0xd0a5('0x34')]=_0x13d4b7[_0xd0a5('0x34')][_0xd0a5('0x37')]?_0x13d4b7['attributes']:_0x5a97e4[_0xd0a5('0x30')];if(!_0x456236[_0xd0a5('0x31')]['hasOwnProperty'](_0xd0a5('0x38'))){_0x13d4b7[_0xd0a5('0x1d')]=qs[_0xd0a5('0x1d')](_0x456236[_0xd0a5('0x31')][_0xd0a5('0x1d')]);_0x13d4b7[_0xd0a5('0x1e')]=qs['offset'](_0x456236['query'][_0xd0a5('0x1e')]);}_0x13d4b7[_0xd0a5('0x39')]=qs[_0xd0a5('0x3a')](_0x456236['query'][_0xd0a5('0x3a')]);_0x13d4b7[_0xd0a5('0x3b')]=qs[_0xd0a5('0x33')](_[_0xd0a5('0x3c')](_0x456236[_0xd0a5('0x31')],_0x5a97e4[_0xd0a5('0x33')]),_0x19ab70);if(_0x456236[_0xd0a5('0x31')][_0xd0a5('0x3d')]){_0x13d4b7[_0xd0a5('0x3b')]=_[_0xd0a5('0x3e')](_0x13d4b7[_0xd0a5('0x3b')],{'$or':_[_0xd0a5('0x2a')](_0x19ab70,function(_0x394f66){if(_0x394f66[_0xd0a5('0x2e')]!=='VIRTUAL'){var _0x32d724={};_0x32d724[_0x394f66['name']]={'$like':'%'+_0x456236[_0xd0a5('0x31')][_0xd0a5('0x3d')]+'%'};return _0x32d724;}})});}_0x13d4b7=_[_0xd0a5('0x3e')]({},_0x13d4b7,_0x456236[_0xd0a5('0x3f')]);var _0x324e18={'where':_0x13d4b7[_0xd0a5('0x3b')]};return db[_0xd0a5('0x2b')][_0xd0a5('0x1f')](_0x324e18)['then'](function(_0x3cabc5){_0x51c2ea[_0xd0a5('0x1f')]=_0x3cabc5;if(_0x456236[_0xd0a5('0x31')][_0xd0a5('0x40')]){_0x13d4b7[_0xd0a5('0x41')]=[{'all':!![]}];}return db[_0xd0a5('0x2b')]['findAll'](_0x13d4b7);})['then'](function(_0xab0270){_0x51c2ea['rows']=_0xab0270;return _0x51c2ea;})[_0xd0a5('0x24')](respondWithFilteredResult(_0x4f6bb9,_0x13d4b7))[_0xd0a5('0x42')](handleError(_0x4f6bb9,null));};exports[_0xd0a5('0x43')]=function(_0x5447cc,_0xe9f270){var _0x152709={'raw':![],'where':{'id':_0x5447cc[_0xd0a5('0x44')]['id']}},_0x39af9e={};_0x39af9e[_0xd0a5('0x30')]=_[_0xd0a5('0x32')](db['DeskConfiguration'][_0xd0a5('0x2c')]);_0x39af9e[_0xd0a5('0x31')]=_[_0xd0a5('0x32')](_0x5447cc[_0xd0a5('0x31')]);_0x39af9e[_0xd0a5('0x33')]=_[_0xd0a5('0x35')](_0x39af9e[_0xd0a5('0x30')],_0x39af9e[_0xd0a5('0x31')]);_0x152709['attributes']=_['intersection'](_0x39af9e[_0xd0a5('0x30')],qs[_0xd0a5('0x36')](_0x5447cc['query'][_0xd0a5('0x36')]));_0x152709[_0xd0a5('0x34')]=_0x152709[_0xd0a5('0x34')][_0xd0a5('0x37')]?_0x152709[_0xd0a5('0x34')]:_0x39af9e[_0xd0a5('0x30')];if(_0x5447cc['query']['includeAll']){_0x152709[_0xd0a5('0x41')]=[{'all':!![]}];}_0x152709=_[_0xd0a5('0x3e')]({},_0x152709,_0x5447cc['options']);return db[_0xd0a5('0x2b')]['find'](_0x152709)[_0xd0a5('0x24')](handleEntityNotFound(_0xe9f270,null))['then'](respondWithResult(_0xe9f270,null))[_0xd0a5('0x42')](handleError(_0xe9f270,null));};exports[_0xd0a5('0x45')]=function(_0x4629de,_0x21f81b){return db['DeskConfiguration'][_0xd0a5('0x45')](_0x4629de[_0xd0a5('0x46')],{})[_0xd0a5('0x24')](respondWithResult(_0x21f81b,0xc9))[_0xd0a5('0x42')](handleError(_0x21f81b,null));};exports[_0xd0a5('0x47')]=function(_0x2e3300,_0x11f700){if(_0x2e3300[_0xd0a5('0x46')]['id']){delete _0x2e3300['body']['id'];}return db[_0xd0a5('0x2b')][_0xd0a5('0x48')]({'where':{'id':_0x2e3300['params']['id']}})[_0xd0a5('0x24')](handleEntityNotFound(_0x11f700,null))[_0xd0a5('0x24')](saveUpdates(_0x2e3300[_0xd0a5('0x46')],null))['then'](respondWithResult(_0x11f700,null))['catch'](handleError(_0x11f700,null));};exports['destroy']=function(_0x2b32be,_0x257e3a){return db[_0xd0a5('0x2b')][_0xd0a5('0x48')]({'where':{'id':_0x2b32be[_0xd0a5('0x44')]['id']}})[_0xd0a5('0x24')](handleEntityNotFound(_0x257e3a,null))['then'](removeEntity(_0x257e3a,null))[_0xd0a5('0x42')](handleError(_0x257e3a,null));};exports[_0xd0a5('0x49')]=function(_0x27707a,_0x1981c0,_0x1bbc77){var _0x316dec={};var _0x10bef4={};var _0x276214;var _0x123c61;return db[_0xd0a5('0x2b')]['findOne']({'where':{'id':_0x27707a[_0xd0a5('0x44')]['id']}})['then'](handleEntityNotFound(_0x1981c0,null))[_0xd0a5('0x24')](function(_0x4eb889){if(_0x4eb889){_0x276214=_0x4eb889;_0x10bef4[_0xd0a5('0x30')]=_[_0xd0a5('0x32')](db[_0xd0a5('0x4a')][_0xd0a5('0x2c')]);_0x10bef4[_0xd0a5('0x31')]=_['keys'](_0x27707a[_0xd0a5('0x31')]);_0x10bef4[_0xd0a5('0x33')]=_['intersection'](_0x10bef4['model'],_0x10bef4[_0xd0a5('0x31')]);_0x316dec['attributes']=_[_0xd0a5('0x35')](_0x10bef4[_0xd0a5('0x30')],qs[_0xd0a5('0x36')](_0x27707a[_0xd0a5('0x31')][_0xd0a5('0x36')]));_0x316dec[_0xd0a5('0x34')]=_0x316dec[_0xd0a5('0x34')][_0xd0a5('0x37')]?_0x316dec[_0xd0a5('0x34')]:_0x10bef4['model'];_0x316dec['order']=qs[_0xd0a5('0x3a')](_0x27707a[_0xd0a5('0x31')][_0xd0a5('0x3a')]);_0x316dec[_0xd0a5('0x3b')]=qs[_0xd0a5('0x33')](_['pick'](_0x27707a[_0xd0a5('0x31')],_0x10bef4['filters']));if(_0x27707a[_0xd0a5('0x31')][_0xd0a5('0x3d')]){_0x316dec[_0xd0a5('0x3b')]=_['merge'](_0x316dec[_0xd0a5('0x3b')],{'$or':_['map'](_0x316dec[_0xd0a5('0x34')],function(_0x118432){var _0x7214ef={};_0x7214ef[_0x118432]={'$like':'%'+_0x27707a[_0xd0a5('0x31')][_0xd0a5('0x3d')]+'%'};return _0x7214ef;})});}_0x316dec=_[_0xd0a5('0x3e')]({},_0x316dec,_0x27707a[_0xd0a5('0x3f')]);return _0x276214['getFields'](_0x316dec);}})[_0xd0a5('0x24')](function(_0x2ab02b){if(_0x2ab02b){_0x123c61=_0x2ab02b[_0xd0a5('0x37')];if(!_0x27707a[_0xd0a5('0x31')]['hasOwnProperty'](_0xd0a5('0x38'))){_0x316dec[_0xd0a5('0x1d')]=qs[_0xd0a5('0x1d')](_0x27707a[_0xd0a5('0x31')][_0xd0a5('0x1d')]);_0x316dec[_0xd0a5('0x1e')]=qs[_0xd0a5('0x1e')](_0x27707a[_0xd0a5('0x31')][_0xd0a5('0x1e')]);}return _0x276214[_0xd0a5('0x49')](_0x316dec);}})[_0xd0a5('0x24')](function(_0x2a41cb){if(_0x2a41cb){return _0x2a41cb?{'count':_0x123c61,'rows':_0x2a41cb}:null;}})[_0xd0a5('0x24')](respondWithResult(_0x1981c0,null))[_0xd0a5('0x42')](handleError(_0x1981c0,null));};exports[_0xd0a5('0x4b')]=function(_0x1fd902,_0x3ede7a,_0x2ede7a){var _0x1a51ac={};var _0x313546={};var _0x364483;var _0x450ffe;return db[_0xd0a5('0x2b')]['findOne']({'where':{'id':_0x1fd902[_0xd0a5('0x44')]['id']}})[_0xd0a5('0x24')](handleEntityNotFound(_0x3ede7a,null))['then'](function(_0xc43c81){if(_0xc43c81){_0x364483=_0xc43c81;_0x313546[_0xd0a5('0x30')]=_[_0xd0a5('0x32')](db[_0xd0a5('0x4a')][_0xd0a5('0x2c')]);_0x313546[_0xd0a5('0x31')]=_['keys'](_0x1fd902[_0xd0a5('0x31')]);_0x313546['filters']=_['intersection'](_0x313546[_0xd0a5('0x30')],_0x313546[_0xd0a5('0x31')]);_0x1a51ac['attributes']=_['intersection'](_0x313546[_0xd0a5('0x30')],qs[_0xd0a5('0x36')](_0x1fd902[_0xd0a5('0x31')]['fields']));_0x1a51ac['attributes']=_0x1a51ac[_0xd0a5('0x34')]['length']?_0x1a51ac[_0xd0a5('0x34')]:_0x313546[_0xd0a5('0x30')];_0x1a51ac['order']=qs[_0xd0a5('0x3a')](_0x1fd902[_0xd0a5('0x31')]['sort']);_0x1a51ac[_0xd0a5('0x3b')]=qs[_0xd0a5('0x33')](_[_0xd0a5('0x3c')](_0x1fd902['query'],_0x313546[_0xd0a5('0x33')]));if(_0x1fd902[_0xd0a5('0x31')][_0xd0a5('0x3d')]){_0x1a51ac[_0xd0a5('0x3b')]=_[_0xd0a5('0x3e')](_0x1a51ac[_0xd0a5('0x3b')],{'$or':_[_0xd0a5('0x2a')](_0x1a51ac[_0xd0a5('0x34')],function(_0xb1e55e){var _0x34f764={};_0x34f764[_0xb1e55e]={'$like':'%'+_0x1fd902['query'][_0xd0a5('0x3d')]+'%'};return _0x34f764;})});}_0x1a51ac=_[_0xd0a5('0x3e')]({},_0x1a51ac,_0x1fd902[_0xd0a5('0x3f')]);return _0x364483[_0xd0a5('0x4b')](_0x1a51ac);}})[_0xd0a5('0x24')](function(_0x445288){if(_0x445288){_0x450ffe=_0x445288[_0xd0a5('0x37')];if(!_0x1fd902[_0xd0a5('0x31')][_0xd0a5('0x4c')]('nolimit')){_0x1a51ac[_0xd0a5('0x1d')]=qs[_0xd0a5('0x1d')](_0x1fd902['query'][_0xd0a5('0x1d')]);_0x1a51ac[_0xd0a5('0x1e')]=qs[_0xd0a5('0x1e')](_0x1fd902[_0xd0a5('0x31')][_0xd0a5('0x1e')]);}return _0x364483[_0xd0a5('0x4b')](_0x1a51ac);}})[_0xd0a5('0x24')](function(_0x28fe91){if(_0x28fe91){return _0x28fe91?{'count':_0x450ffe,'rows':_0x28fe91}:null;}})[_0xd0a5('0x24')](respondWithResult(_0x3ede7a,null))[_0xd0a5('0x42')](handleError(_0x3ede7a,null));};exports[_0xd0a5('0x4d')]=function(_0xbe6c2a,_0x53edb7,_0x5dae69){var _0x5681fc={};var _0x570a0c={};var _0x324062;var _0x44a21d;return db['DeskConfiguration'][_0xd0a5('0x4e')]({'where':{'id':_0xbe6c2a['params']['id']}})[_0xd0a5('0x24')](handleEntityNotFound(_0x53edb7,null))[_0xd0a5('0x24')](function(_0x5d354f){if(_0x5d354f){_0x324062=_0x5d354f;_0x570a0c[_0xd0a5('0x30')]=_['keys'](db['DeskField'][_0xd0a5('0x2c')]);_0x570a0c['query']=_['keys'](_0xbe6c2a[_0xd0a5('0x31')]);_0x570a0c[_0xd0a5('0x33')]=_[_0xd0a5('0x35')](_0x570a0c['model'],_0x570a0c['query']);_0x5681fc[_0xd0a5('0x34')]=_[_0xd0a5('0x35')](_0x570a0c[_0xd0a5('0x30')],qs['fields'](_0xbe6c2a['query'][_0xd0a5('0x36')]));_0x5681fc[_0xd0a5('0x34')]=_0x5681fc[_0xd0a5('0x34')]['length']?_0x5681fc[_0xd0a5('0x34')]:_0x570a0c['model'];_0x5681fc['order']=qs[_0xd0a5('0x3a')](_0xbe6c2a[_0xd0a5('0x31')][_0xd0a5('0x3a')]);_0x5681fc[_0xd0a5('0x3b')]=qs['filters'](_['pick'](_0xbe6c2a['query'],_0x570a0c['filters']));if(_0xbe6c2a['query'][_0xd0a5('0x3d')]){_0x5681fc[_0xd0a5('0x3b')]=_['merge'](_0x5681fc[_0xd0a5('0x3b')],{'$or':_[_0xd0a5('0x2a')](_0x5681fc[_0xd0a5('0x34')],function(_0x11a651){var _0x4d062f={};_0x4d062f[_0x11a651]={'$like':'%'+_0xbe6c2a['query']['filter']+'%'};return _0x4d062f;})});}_0x5681fc=_[_0xd0a5('0x3e')]({},_0x5681fc,_0xbe6c2a['options']);return _0x324062[_0xd0a5('0x4d')](_0x5681fc);}})[_0xd0a5('0x24')](function(_0x1a63a6){if(_0x1a63a6){_0x44a21d=_0x1a63a6['length'];if(!_0xbe6c2a[_0xd0a5('0x31')][_0xd0a5('0x4c')](_0xd0a5('0x38'))){_0x5681fc[_0xd0a5('0x1d')]=qs[_0xd0a5('0x1d')](_0xbe6c2a['query']['limit']);_0x5681fc[_0xd0a5('0x1e')]=qs['offset'](_0xbe6c2a['query']['offset']);}return _0x324062[_0xd0a5('0x4d')](_0x5681fc);}})[_0xd0a5('0x24')](function(_0x1df879){if(_0x1df879){return _0x1df879?{'count':_0x44a21d,'rows':_0x1df879}:null;}})[_0xd0a5('0x24')](respondWithResult(_0x53edb7,null))[_0xd0a5('0x42')](handleError(_0x53edb7,null));};exports[_0xd0a5('0x4f')]=function(_0x51a66c,_0x1b1481,_0x501b9d){var _0x581231={};var _0x54e1d3={};var _0x133777;var _0x5be771;return db[_0xd0a5('0x2b')][_0xd0a5('0x4e')]({'where':{'id':_0x51a66c[_0xd0a5('0x44')]['id']}})['then'](handleEntityNotFound(_0x1b1481,null))['then'](function(_0x335e3b){if(_0x335e3b){_0x133777=_0x335e3b;_0x54e1d3['model']=_[_0xd0a5('0x32')](db['Tag'][_0xd0a5('0x2c')]);_0x54e1d3[_0xd0a5('0x31')]=_[_0xd0a5('0x32')](_0x51a66c[_0xd0a5('0x31')]);_0x54e1d3[_0xd0a5('0x33')]=_[_0xd0a5('0x35')](_0x54e1d3['model'],_0x54e1d3['query']);_0x581231[_0xd0a5('0x34')]=_['intersection'](_0x54e1d3[_0xd0a5('0x30')],qs['fields'](_0x51a66c['query'][_0xd0a5('0x36')]));_0x581231[_0xd0a5('0x34')]=_0x581231[_0xd0a5('0x34')][_0xd0a5('0x37')]?_0x581231['attributes']:_0x54e1d3[_0xd0a5('0x30')];_0x581231[_0xd0a5('0x39')]=qs[_0xd0a5('0x3a')](_0x51a66c[_0xd0a5('0x31')][_0xd0a5('0x3a')]);_0x581231[_0xd0a5('0x3b')]=qs[_0xd0a5('0x33')](_[_0xd0a5('0x3c')](_0x51a66c[_0xd0a5('0x31')],_0x54e1d3[_0xd0a5('0x33')]));if(_0x51a66c[_0xd0a5('0x31')]['filter']){_0x581231[_0xd0a5('0x3b')]=_[_0xd0a5('0x3e')](_0x581231[_0xd0a5('0x3b')],{'$or':_[_0xd0a5('0x2a')](_0x581231['attributes'],function(_0x34fed1){var _0x369715={};_0x369715[_0x34fed1]={'$like':'%'+_0x51a66c[_0xd0a5('0x31')][_0xd0a5('0x3d')]+'%'};return _0x369715;})});}_0x581231=_['merge']({},_0x581231,_0x51a66c['options']);return _0x133777[_0xd0a5('0x4f')](_0x581231);}})[_0xd0a5('0x24')](function(_0x52ffad){if(_0x52ffad){_0x5be771=_0x52ffad[_0xd0a5('0x37')];if(!_0x51a66c['query'][_0xd0a5('0x4c')]('nolimit')){_0x581231['limit']=qs['limit'](_0x51a66c[_0xd0a5('0x31')][_0xd0a5('0x1d')]);_0x581231[_0xd0a5('0x1e')]=qs[_0xd0a5('0x1e')](_0x51a66c[_0xd0a5('0x31')][_0xd0a5('0x1e')]);}return _0x133777[_0xd0a5('0x4f')](_0x581231);}})[_0xd0a5('0x24')](function(_0x278436){if(_0x278436){return _0x278436?{'count':_0x5be771,'rows':_0x278436}:null;}})[_0xd0a5('0x24')](respondWithResult(_0x1b1481,null))[_0xd0a5('0x42')](handleError(_0x1b1481,null));};exports['setTags']=function(_0x347658,_0x8ad0e9,_0x2ec780){if(_0x347658[_0xd0a5('0x46')]['id']){delete _0x347658['body']['id'];}return db[_0xd0a5('0x2b')][_0xd0a5('0x4e')]({'where':{'id':_0x347658[_0xd0a5('0x44')]['id']}})[_0xd0a5('0x24')](handleEntityNotFound(_0x8ad0e9,null))[_0xd0a5('0x24')](function(_0x3b4791){if(_0x3b4791){return _0x3b4791[_0xd0a5('0x50')](_0x347658['body'][_0xd0a5('0x51')]||[]);}return null;})[_0xd0a5('0x24')](respondWithResult(_0x8ad0e9,null))[_0xd0a5('0x42')](handleError(_0x8ad0e9,null));}; \ No newline at end of file +var _0x5b5b=['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','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','then','end','error','stack','name','send','map','rawAttributes','fieldName','key','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','where','merge','type','VIRTUAL','options','DeskConfiguration','includeAll','include','findAll','rows','show','params','keys','intersection','create','catch','body','find','getFields','findOne','DeskField','order','sort','filter','getSubjects','pick','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse'];(function(_0x148427,_0xeb87db){var _0x501c9d=function(_0xf07181){while(--_0xf07181){_0x148427['push'](_0x148427['shift']());}};_0x501c9d(++_0xeb87db);}(_0x5b5b,0x14c));var _0xb5b5=function(_0x3bb5b4,_0x128455){_0x3bb5b4=_0x3bb5b4-0x0;var _0x586c60=_0x5b5b[_0x3bb5b4];return _0x586c60;};'use strict';var emlformat=require(_0xb5b5('0x0'));var rimraf=require(_0xb5b5('0x1'));var zipdir=require(_0xb5b5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb5b5('0x3'));var moment=require(_0xb5b5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb5b5('0x5'));var util=require(_0xb5b5('0x6'));var path=require(_0xb5b5('0x7'));var sox=require(_0xb5b5('0x8'));var csv=require(_0xb5b5('0x9'));var ejs=require(_0xb5b5('0xa'));var fs=require('fs');var fs_extra=require(_0xb5b5('0xb'));var _=require('lodash');var squel=require(_0xb5b5('0xc'));var crypto=require('crypto');var jsforce=require(_0xb5b5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb5b5('0x9'));var querystring=require(_0xb5b5('0xe'));var Papa=require(_0xb5b5('0xf'));var Redis=require(_0xb5b5('0x10'));var authService=require(_0xb5b5('0x11'));var qs=require(_0xb5b5('0x12'));var as=require(_0xb5b5('0x13'));var hardwareService=require(_0xb5b5('0x14'));var logger=require(_0xb5b5('0x15'))(_0xb5b5('0x16'));var utils=require(_0xb5b5('0x17'));var config=require(_0xb5b5('0x18'));var licenseUtil=require(_0xb5b5('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x337953,_0x160bac){_0x160bac=_0x160bac||0xcc;return function(_0x23ec2e){if(_0x23ec2e){return _0x337953[_0xb5b5('0x1a')](_0x160bac);}return _0x337953[_0xb5b5('0x1b')](_0x160bac)['end']();};}function respondWithResult(_0x36a88c,_0x1e9b24){_0x1e9b24=_0x1e9b24||0xc8;return function(_0x22e9c5){if(_0x22e9c5){return _0x36a88c['status'](_0x1e9b24)['json'](_0x22e9c5);}};}function respondWithFilteredResult(_0x509bd6,_0x24f05f){return function(_0xc5fb54){if(_0xc5fb54){var _0x5a62d8=typeof _0x24f05f['offset']==='undefined'&&typeof _0x24f05f[_0xb5b5('0x1c')]===_0xb5b5('0x1d');var _0x162b4a=_0xc5fb54[_0xb5b5('0x1e')];var _0x2e854c=_0x5a62d8?0x0:_0x24f05f[_0xb5b5('0x1f')];var _0x38dc8b=_0x5a62d8?_0xc5fb54['count']:_0x24f05f[_0xb5b5('0x1f')]+_0x24f05f[_0xb5b5('0x1c')];var _0xbd0d3b;if(_0x38dc8b>=_0x162b4a){_0x38dc8b=_0x162b4a;_0xbd0d3b=0xc8;}else{_0xbd0d3b=0xce;}_0x509bd6[_0xb5b5('0x1b')](_0xbd0d3b);return _0x509bd6[_0xb5b5('0x20')](_0xb5b5('0x21'),_0x2e854c+'-'+_0x38dc8b+'/'+_0x162b4a)[_0xb5b5('0x22')](_0xc5fb54);}return null;};}function patchUpdates(_0x170a8f){return function(_0x18a749){try{jsonpatch[_0xb5b5('0x23')](_0x18a749,_0x170a8f,!![]);}catch(_0x37f1c8){return BPromise[_0xb5b5('0x24')](_0x37f1c8);}return _0x18a749[_0xb5b5('0x25')]();};}function saveUpdates(_0x2616e6,_0x202e80){return function(_0x50b58c){if(_0x50b58c){return _0x50b58c[_0xb5b5('0x26')](_0x2616e6)[_0xb5b5('0x27')](function(_0x1f61a9){return _0x1f61a9;});}return null;};}function removeEntity(_0x5aa09a,_0x440d4a){return function(_0x232e81){if(_0x232e81){return _0x232e81['destroy']()[_0xb5b5('0x27')](function(){_0x5aa09a[_0xb5b5('0x1b')](0xcc)[_0xb5b5('0x28')]();});}};}function handleEntityNotFound(_0x3f3c3a,_0x57e1b4){return function(_0x162653){if(!_0x162653){_0x3f3c3a[_0xb5b5('0x1a')](0x194);}return _0x162653;};}function handleError(_0x549289,_0x3ae791){_0x3ae791=_0x3ae791||0x1f4;return function(_0x49151a){logger[_0xb5b5('0x29')](_0x49151a[_0xb5b5('0x2a')]);if(_0x49151a['name']){delete _0x49151a[_0xb5b5('0x2b')];}_0x549289[_0xb5b5('0x1b')](_0x3ae791)[_0xb5b5('0x2c')](_0x49151a);};}exports['index']=function(_0x4e55f4,_0x5e2025){var _0x30d5bb={},_0x72df52={},_0x3d000e={'count':0x0,'rows':[]};var _0x29c4d3=_[_0xb5b5('0x2d')](db['DeskConfiguration'][_0xb5b5('0x2e')],function(_0x3eaa1e){return{'name':_0x3eaa1e[_0xb5b5('0x2f')],'type':_0x3eaa1e['type'][_0xb5b5('0x30')]};});_0x72df52['model']=_[_0xb5b5('0x2d')](_0x29c4d3,'name');_0x72df52[_0xb5b5('0x31')]=_['keys'](_0x4e55f4[_0xb5b5('0x31')]);_0x72df52[_0xb5b5('0x32')]=_['intersection'](_0x72df52[_0xb5b5('0x33')],_0x72df52[_0xb5b5('0x31')]);_0x30d5bb[_0xb5b5('0x34')]=_['intersection'](_0x72df52[_0xb5b5('0x33')],qs[_0xb5b5('0x35')](_0x4e55f4[_0xb5b5('0x31')]['fields']));_0x30d5bb[_0xb5b5('0x34')]=_0x30d5bb[_0xb5b5('0x34')][_0xb5b5('0x36')]?_0x30d5bb['attributes']:_0x72df52[_0xb5b5('0x33')];if(!_0x4e55f4[_0xb5b5('0x31')][_0xb5b5('0x37')](_0xb5b5('0x38'))){_0x30d5bb[_0xb5b5('0x1c')]=qs[_0xb5b5('0x1c')](_0x4e55f4[_0xb5b5('0x31')][_0xb5b5('0x1c')]);_0x30d5bb[_0xb5b5('0x1f')]=qs[_0xb5b5('0x1f')](_0x4e55f4[_0xb5b5('0x31')]['offset']);}_0x30d5bb['order']=qs['sort'](_0x4e55f4['query']['sort']);_0x30d5bb[_0xb5b5('0x39')]=qs[_0xb5b5('0x32')](_['pick'](_0x4e55f4[_0xb5b5('0x31')],_0x72df52[_0xb5b5('0x32')]),_0x29c4d3);if(_0x4e55f4[_0xb5b5('0x31')]['filter']){_0x30d5bb[_0xb5b5('0x39')]=_[_0xb5b5('0x3a')](_0x30d5bb[_0xb5b5('0x39')],{'$or':_[_0xb5b5('0x2d')](_0x29c4d3,function(_0x14ece5){if(_0x14ece5[_0xb5b5('0x3b')]!==_0xb5b5('0x3c')){var _0x2c8007={};_0x2c8007[_0x14ece5[_0xb5b5('0x2b')]]={'$like':'%'+_0x4e55f4[_0xb5b5('0x31')]['filter']+'%'};return _0x2c8007;}})});}_0x30d5bb=_[_0xb5b5('0x3a')]({},_0x30d5bb,_0x4e55f4[_0xb5b5('0x3d')]);var _0x2bff22={'where':_0x30d5bb[_0xb5b5('0x39')]};return db[_0xb5b5('0x3e')]['count'](_0x2bff22)['then'](function(_0x4221ca){_0x3d000e['count']=_0x4221ca;if(_0x4e55f4[_0xb5b5('0x31')][_0xb5b5('0x3f')]){_0x30d5bb[_0xb5b5('0x40')]=[{'all':!![]}];}return db[_0xb5b5('0x3e')][_0xb5b5('0x41')](_0x30d5bb);})[_0xb5b5('0x27')](function(_0x129dbd){_0x3d000e[_0xb5b5('0x42')]=_0x129dbd;return _0x3d000e;})[_0xb5b5('0x27')](respondWithFilteredResult(_0x5e2025,_0x30d5bb))['catch'](handleError(_0x5e2025,null));};exports[_0xb5b5('0x43')]=function(_0x19654d,_0x542ab0){var _0x597104={'raw':![],'where':{'id':_0x19654d[_0xb5b5('0x44')]['id']}},_0x5f5844={};_0x5f5844[_0xb5b5('0x33')]=_[_0xb5b5('0x45')](db[_0xb5b5('0x3e')][_0xb5b5('0x2e')]);_0x5f5844[_0xb5b5('0x31')]=_['keys'](_0x19654d[_0xb5b5('0x31')]);_0x5f5844[_0xb5b5('0x32')]=_[_0xb5b5('0x46')](_0x5f5844[_0xb5b5('0x33')],_0x5f5844['query']);_0x597104[_0xb5b5('0x34')]=_[_0xb5b5('0x46')](_0x5f5844[_0xb5b5('0x33')],qs[_0xb5b5('0x35')](_0x19654d[_0xb5b5('0x31')][_0xb5b5('0x35')]));_0x597104[_0xb5b5('0x34')]=_0x597104[_0xb5b5('0x34')][_0xb5b5('0x36')]?_0x597104[_0xb5b5('0x34')]:_0x5f5844[_0xb5b5('0x33')];if(_0x19654d['query']['includeAll']){_0x597104['include']=[{'all':!![]}];}_0x597104=_['merge']({},_0x597104,_0x19654d[_0xb5b5('0x3d')]);return db['DeskConfiguration']['find'](_0x597104)['then'](handleEntityNotFound(_0x542ab0,null))[_0xb5b5('0x27')](respondWithResult(_0x542ab0,null))['catch'](handleError(_0x542ab0,null));};exports[_0xb5b5('0x47')]=function(_0x58f52b,_0x18d0e5){return db['DeskConfiguration']['create'](_0x58f52b['body'],{})[_0xb5b5('0x27')](respondWithResult(_0x18d0e5,0xc9))[_0xb5b5('0x48')](handleError(_0x18d0e5,null));};exports[_0xb5b5('0x26')]=function(_0x1df9b7,_0x2a4da2){if(_0x1df9b7[_0xb5b5('0x49')]['id']){delete _0x1df9b7[_0xb5b5('0x49')]['id'];}return db[_0xb5b5('0x3e')][_0xb5b5('0x4a')]({'where':{'id':_0x1df9b7[_0xb5b5('0x44')]['id']}})[_0xb5b5('0x27')](handleEntityNotFound(_0x2a4da2,null))[_0xb5b5('0x27')](saveUpdates(_0x1df9b7[_0xb5b5('0x49')],null))['then'](respondWithResult(_0x2a4da2,null))[_0xb5b5('0x48')](handleError(_0x2a4da2,null));};exports['destroy']=function(_0x50e5cb,_0x2bb0cb){return db['DeskConfiguration'][_0xb5b5('0x4a')]({'where':{'id':_0x50e5cb[_0xb5b5('0x44')]['id']}})[_0xb5b5('0x27')](handleEntityNotFound(_0x2bb0cb,null))[_0xb5b5('0x27')](removeEntity(_0x2bb0cb,null))[_0xb5b5('0x48')](handleError(_0x2bb0cb,null));};exports[_0xb5b5('0x4b')]=function(_0x47f438,_0x1597d8,_0x2aeae4){var _0x4d694f={};var _0x4642e6={};var _0x2a1e47;var _0x4b990d;return db[_0xb5b5('0x3e')][_0xb5b5('0x4c')]({'where':{'id':_0x47f438['params']['id']}})[_0xb5b5('0x27')](handleEntityNotFound(_0x1597d8,null))[_0xb5b5('0x27')](function(_0x1bd3b9){if(_0x1bd3b9){_0x2a1e47=_0x1bd3b9;_0x4642e6[_0xb5b5('0x33')]=_[_0xb5b5('0x45')](db[_0xb5b5('0x4d')][_0xb5b5('0x2e')]);_0x4642e6[_0xb5b5('0x31')]=_[_0xb5b5('0x45')](_0x47f438[_0xb5b5('0x31')]);_0x4642e6[_0xb5b5('0x32')]=_[_0xb5b5('0x46')](_0x4642e6[_0xb5b5('0x33')],_0x4642e6[_0xb5b5('0x31')]);_0x4d694f[_0xb5b5('0x34')]=_[_0xb5b5('0x46')](_0x4642e6[_0xb5b5('0x33')],qs[_0xb5b5('0x35')](_0x47f438['query'][_0xb5b5('0x35')]));_0x4d694f[_0xb5b5('0x34')]=_0x4d694f[_0xb5b5('0x34')][_0xb5b5('0x36')]?_0x4d694f[_0xb5b5('0x34')]:_0x4642e6[_0xb5b5('0x33')];_0x4d694f[_0xb5b5('0x4e')]=qs['sort'](_0x47f438[_0xb5b5('0x31')][_0xb5b5('0x4f')]);_0x4d694f[_0xb5b5('0x39')]=qs['filters'](_['pick'](_0x47f438[_0xb5b5('0x31')],_0x4642e6[_0xb5b5('0x32')]));if(_0x47f438[_0xb5b5('0x31')][_0xb5b5('0x50')]){_0x4d694f[_0xb5b5('0x39')]=_[_0xb5b5('0x3a')](_0x4d694f['where'],{'$or':_[_0xb5b5('0x2d')](_0x4d694f[_0xb5b5('0x34')],function(_0x30b4a9){var _0x5edd21={};_0x5edd21[_0x30b4a9]={'$like':'%'+_0x47f438[_0xb5b5('0x31')][_0xb5b5('0x50')]+'%'};return _0x5edd21;})});}_0x4d694f=_[_0xb5b5('0x3a')]({},_0x4d694f,_0x47f438[_0xb5b5('0x3d')]);return _0x2a1e47[_0xb5b5('0x4b')](_0x4d694f);}})[_0xb5b5('0x27')](function(_0x301c5a){if(_0x301c5a){_0x4b990d=_0x301c5a[_0xb5b5('0x36')];if(!_0x47f438['query']['hasOwnProperty'](_0xb5b5('0x38'))){_0x4d694f[_0xb5b5('0x1c')]=qs[_0xb5b5('0x1c')](_0x47f438[_0xb5b5('0x31')]['limit']);_0x4d694f[_0xb5b5('0x1f')]=qs[_0xb5b5('0x1f')](_0x47f438[_0xb5b5('0x31')]['offset']);}return _0x2a1e47[_0xb5b5('0x4b')](_0x4d694f);}})[_0xb5b5('0x27')](function(_0xc9e494){if(_0xc9e494){return _0xc9e494?{'count':_0x4b990d,'rows':_0xc9e494}:null;}})['then'](respondWithResult(_0x1597d8,null))['catch'](handleError(_0x1597d8,null));};exports[_0xb5b5('0x51')]=function(_0x233cd5,_0x3783b4,_0x1afb01){var _0x13c7c4={};var _0x17edad={};var _0x4bbbbd;var _0x4ab36a;return db[_0xb5b5('0x3e')][_0xb5b5('0x4c')]({'where':{'id':_0x233cd5[_0xb5b5('0x44')]['id']}})[_0xb5b5('0x27')](handleEntityNotFound(_0x3783b4,null))[_0xb5b5('0x27')](function(_0x185b92){if(_0x185b92){_0x4bbbbd=_0x185b92;_0x17edad[_0xb5b5('0x33')]=_[_0xb5b5('0x45')](db['DeskField'][_0xb5b5('0x2e')]);_0x17edad[_0xb5b5('0x31')]=_[_0xb5b5('0x45')](_0x233cd5['query']);_0x17edad['filters']=_['intersection'](_0x17edad[_0xb5b5('0x33')],_0x17edad[_0xb5b5('0x31')]);_0x13c7c4[_0xb5b5('0x34')]=_[_0xb5b5('0x46')](_0x17edad['model'],qs['fields'](_0x233cd5[_0xb5b5('0x31')][_0xb5b5('0x35')]));_0x13c7c4[_0xb5b5('0x34')]=_0x13c7c4['attributes'][_0xb5b5('0x36')]?_0x13c7c4[_0xb5b5('0x34')]:_0x17edad['model'];_0x13c7c4[_0xb5b5('0x4e')]=qs[_0xb5b5('0x4f')](_0x233cd5[_0xb5b5('0x31')][_0xb5b5('0x4f')]);_0x13c7c4[_0xb5b5('0x39')]=qs[_0xb5b5('0x32')](_[_0xb5b5('0x52')](_0x233cd5[_0xb5b5('0x31')],_0x17edad[_0xb5b5('0x32')]));if(_0x233cd5['query'][_0xb5b5('0x50')]){_0x13c7c4[_0xb5b5('0x39')]=_['merge'](_0x13c7c4[_0xb5b5('0x39')],{'$or':_[_0xb5b5('0x2d')](_0x13c7c4[_0xb5b5('0x34')],function(_0x384ee0){var _0x4caae={};_0x4caae[_0x384ee0]={'$like':'%'+_0x233cd5[_0xb5b5('0x31')][_0xb5b5('0x50')]+'%'};return _0x4caae;})});}_0x13c7c4=_[_0xb5b5('0x3a')]({},_0x13c7c4,_0x233cd5[_0xb5b5('0x3d')]);return _0x4bbbbd[_0xb5b5('0x51')](_0x13c7c4);}})[_0xb5b5('0x27')](function(_0xad4357){if(_0xad4357){_0x4ab36a=_0xad4357['length'];if(!_0x233cd5[_0xb5b5('0x31')][_0xb5b5('0x37')](_0xb5b5('0x38'))){_0x13c7c4[_0xb5b5('0x1c')]=qs[_0xb5b5('0x1c')](_0x233cd5[_0xb5b5('0x31')]['limit']);_0x13c7c4[_0xb5b5('0x1f')]=qs[_0xb5b5('0x1f')](_0x233cd5[_0xb5b5('0x31')]['offset']);}return _0x4bbbbd[_0xb5b5('0x51')](_0x13c7c4);}})['then'](function(_0x4ee9b1){if(_0x4ee9b1){return _0x4ee9b1?{'count':_0x4ab36a,'rows':_0x4ee9b1}:null;}})['then'](respondWithResult(_0x3783b4,null))[_0xb5b5('0x48')](handleError(_0x3783b4,null));};exports[_0xb5b5('0x53')]=function(_0x321d9f,_0x24fa10,_0x13e3ae){var _0xba7bef={};var _0x2284cf={};var _0x562ecc;var _0x4e74d4;return db[_0xb5b5('0x3e')][_0xb5b5('0x4c')]({'where':{'id':_0x321d9f[_0xb5b5('0x44')]['id']}})[_0xb5b5('0x27')](handleEntityNotFound(_0x24fa10,null))[_0xb5b5('0x27')](function(_0x8fc761){if(_0x8fc761){_0x562ecc=_0x8fc761;_0x2284cf['model']=_[_0xb5b5('0x45')](db[_0xb5b5('0x4d')][_0xb5b5('0x2e')]);_0x2284cf[_0xb5b5('0x31')]=_[_0xb5b5('0x45')](_0x321d9f[_0xb5b5('0x31')]);_0x2284cf[_0xb5b5('0x32')]=_[_0xb5b5('0x46')](_0x2284cf['model'],_0x2284cf[_0xb5b5('0x31')]);_0xba7bef[_0xb5b5('0x34')]=_[_0xb5b5('0x46')](_0x2284cf[_0xb5b5('0x33')],qs[_0xb5b5('0x35')](_0x321d9f[_0xb5b5('0x31')]['fields']));_0xba7bef['attributes']=_0xba7bef[_0xb5b5('0x34')][_0xb5b5('0x36')]?_0xba7bef[_0xb5b5('0x34')]:_0x2284cf['model'];_0xba7bef['order']=qs[_0xb5b5('0x4f')](_0x321d9f[_0xb5b5('0x31')][_0xb5b5('0x4f')]);_0xba7bef[_0xb5b5('0x39')]=qs[_0xb5b5('0x32')](_[_0xb5b5('0x52')](_0x321d9f['query'],_0x2284cf[_0xb5b5('0x32')]));if(_0x321d9f['query'][_0xb5b5('0x50')]){_0xba7bef[_0xb5b5('0x39')]=_[_0xb5b5('0x3a')](_0xba7bef['where'],{'$or':_[_0xb5b5('0x2d')](_0xba7bef[_0xb5b5('0x34')],function(_0x53420f){var _0x169cd1={};_0x169cd1[_0x53420f]={'$like':'%'+_0x321d9f[_0xb5b5('0x31')][_0xb5b5('0x50')]+'%'};return _0x169cd1;})});}_0xba7bef=_['merge']({},_0xba7bef,_0x321d9f['options']);return _0x562ecc[_0xb5b5('0x53')](_0xba7bef);}})['then'](function(_0x3c5413){if(_0x3c5413){_0x4e74d4=_0x3c5413[_0xb5b5('0x36')];if(!_0x321d9f[_0xb5b5('0x31')][_0xb5b5('0x37')](_0xb5b5('0x38'))){_0xba7bef[_0xb5b5('0x1c')]=qs[_0xb5b5('0x1c')](_0x321d9f['query'][_0xb5b5('0x1c')]);_0xba7bef['offset']=qs[_0xb5b5('0x1f')](_0x321d9f[_0xb5b5('0x31')][_0xb5b5('0x1f')]);}return _0x562ecc[_0xb5b5('0x53')](_0xba7bef);}})[_0xb5b5('0x27')](function(_0x43eb74){if(_0x43eb74){return _0x43eb74?{'count':_0x4e74d4,'rows':_0x43eb74}:null;}})[_0xb5b5('0x27')](respondWithResult(_0x24fa10,null))[_0xb5b5('0x48')](handleError(_0x24fa10,null));};exports['getTags']=function(_0x1bebf5,_0x51a861,_0x1bb4b4){var _0x5d45ae={};var _0x91ce83={};var _0x3b071e;var _0x104c11;return db['DeskConfiguration'][_0xb5b5('0x4c')]({'where':{'id':_0x1bebf5[_0xb5b5('0x44')]['id']}})[_0xb5b5('0x27')](handleEntityNotFound(_0x51a861,null))[_0xb5b5('0x27')](function(_0x164fa7){if(_0x164fa7){_0x3b071e=_0x164fa7;_0x91ce83['model']=_[_0xb5b5('0x45')](db['Tag'][_0xb5b5('0x2e')]);_0x91ce83[_0xb5b5('0x31')]=_['keys'](_0x1bebf5['query']);_0x91ce83[_0xb5b5('0x32')]=_[_0xb5b5('0x46')](_0x91ce83[_0xb5b5('0x33')],_0x91ce83[_0xb5b5('0x31')]);_0x5d45ae['attributes']=_[_0xb5b5('0x46')](_0x91ce83[_0xb5b5('0x33')],qs[_0xb5b5('0x35')](_0x1bebf5[_0xb5b5('0x31')][_0xb5b5('0x35')]));_0x5d45ae[_0xb5b5('0x34')]=_0x5d45ae['attributes'][_0xb5b5('0x36')]?_0x5d45ae[_0xb5b5('0x34')]:_0x91ce83['model'];_0x5d45ae[_0xb5b5('0x4e')]=qs[_0xb5b5('0x4f')](_0x1bebf5[_0xb5b5('0x31')][_0xb5b5('0x4f')]);_0x5d45ae[_0xb5b5('0x39')]=qs[_0xb5b5('0x32')](_[_0xb5b5('0x52')](_0x1bebf5[_0xb5b5('0x31')],_0x91ce83['filters']));if(_0x1bebf5[_0xb5b5('0x31')]['filter']){_0x5d45ae[_0xb5b5('0x39')]=_['merge'](_0x5d45ae[_0xb5b5('0x39')],{'$or':_[_0xb5b5('0x2d')](_0x5d45ae[_0xb5b5('0x34')],function(_0x378d82){var _0x3ed147={};_0x3ed147[_0x378d82]={'$like':'%'+_0x1bebf5[_0xb5b5('0x31')][_0xb5b5('0x50')]+'%'};return _0x3ed147;})});}_0x5d45ae=_[_0xb5b5('0x3a')]({},_0x5d45ae,_0x1bebf5['options']);return _0x3b071e[_0xb5b5('0x54')](_0x5d45ae);}})[_0xb5b5('0x27')](function(_0x1f36b5){if(_0x1f36b5){_0x104c11=_0x1f36b5[_0xb5b5('0x36')];if(!_0x1bebf5[_0xb5b5('0x31')][_0xb5b5('0x37')]('nolimit')){_0x5d45ae[_0xb5b5('0x1c')]=qs[_0xb5b5('0x1c')](_0x1bebf5[_0xb5b5('0x31')][_0xb5b5('0x1c')]);_0x5d45ae[_0xb5b5('0x1f')]=qs[_0xb5b5('0x1f')](_0x1bebf5[_0xb5b5('0x31')][_0xb5b5('0x1f')]);}return _0x3b071e[_0xb5b5('0x54')](_0x5d45ae);}})[_0xb5b5('0x27')](function(_0x15d057){if(_0x15d057){return _0x15d057?{'count':_0x104c11,'rows':_0x15d057}:null;}})[_0xb5b5('0x27')](respondWithResult(_0x51a861,null))[_0xb5b5('0x48')](handleError(_0x51a861,null));};exports[_0xb5b5('0x55')]=function(_0xf08c7e,_0x166ab9,_0x584484){if(_0xf08c7e[_0xb5b5('0x49')]['id']){delete _0xf08c7e['body']['id'];}return db[_0xb5b5('0x3e')][_0xb5b5('0x4c')]({'where':{'id':_0xf08c7e[_0xb5b5('0x44')]['id']}})[_0xb5b5('0x27')](handleEntityNotFound(_0x166ab9,null))[_0xb5b5('0x27')](function(_0x4f17ed){if(_0x4f17ed){return _0x4f17ed[_0xb5b5('0x55')](_0xf08c7e[_0xb5b5('0x49')][_0xb5b5('0x56')]||[]);}return null;})['then'](respondWithResult(_0x166ab9,null))[_0xb5b5('0x48')](handleError(_0x166ab9,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 64a64a1..e8dd7ac 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 _0x9b23=['bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x4f8ebf,_0x58760c){var _0x164d9a=function(_0x16bcc6){while(--_0x16bcc6){_0x4f8ebf['push'](_0x4f8ebf['shift']());}};_0x164d9a(++_0x58760c);}(_0x9b23,0x136));var _0x39b2=function(_0x2dc30a,_0x476c1a){_0x2dc30a=_0x2dc30a-0x0;var _0x1f7dfa=_0x9b23[_0x2dc30a];return _0x1f7dfa;};'use strict';var _=require(_0x39b2('0x0'));var util=require(_0x39b2('0x1'));var logger=require(_0x39b2('0x2'))(_0x39b2('0x3'));var moment=require(_0x39b2('0x4'));var BPromise=require(_0x39b2('0x5'));var rp=require(_0x39b2('0x6'));var fs=require('fs');var path=require(_0x39b2('0x7'));var rimraf=require(_0x39b2('0x8'));var config=require(_0x39b2('0x9'));var attributes=require(_0x39b2('0xa'));module[_0x39b2('0xb')]=function(_0x79b188,_0x4db5f2){return _0x79b188[_0x39b2('0xc')](_0x39b2('0xd'),attributes,{'tableName':_0x39b2('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a8a=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash'];(function(_0x3af393,_0x3f6ed9){var _0x201105=function(_0x529015){while(--_0x529015){_0x3af393['push'](_0x3af393['shift']());}};_0x201105(++_0x3f6ed9);}(_0x3a8a,0xed));var _0xa3a8=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x3a8a[_0x432682];return _0x463d05;};'use strict';var _=require(_0xa3a8('0x0'));var util=require(_0xa3a8('0x1'));var logger=require(_0xa3a8('0x2'))(_0xa3a8('0x3'));var moment=require(_0xa3a8('0x4'));var BPromise=require(_0xa3a8('0x5'));var rp=require(_0xa3a8('0x6'));var fs=require('fs');var path=require(_0xa3a8('0x7'));var rimraf=require('rimraf');var config=require(_0xa3a8('0x8'));var attributes=require(_0xa3a8('0x9'));module[_0xa3a8('0xa')]=function(_0x4117a4,_0x33e4de){return _0x4117a4[_0xa3a8('0xb')](_0xa3a8('0xc'),attributes,{'tableName':_0xa3a8('0xd'),'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 219829d..24b56f1 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 _0xa67e=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','code','error','message','result','util','bluebird','randomstring','ioredis'];(function(_0x5cbaf3,_0x25646a){var _0x29f965=function(_0x2bb5be){while(--_0x2bb5be){_0x5cbaf3['push'](_0x5cbaf3['shift']());}};_0x29f965(++_0x25646a);}(_0xa67e,0xce));var _0xea67=function(_0x132786,_0x83bd2f){_0x132786=_0x132786-0x0;var _0x2f5a2d=_0xa67e[_0x132786];return _0x2f5a2d;};'use strict';var _=require('lodash');var util=require(_0xea67('0x0'));var moment=require('moment');var BPromise=require(_0xea67('0x1'));var rs=require(_0xea67('0x2'));var fs=require('fs');var Redis=require(_0xea67('0x3'));var db=require(_0xea67('0x4'))['db'];var utils=require(_0xea67('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xea67('0x6'));var jayson=require(_0xea67('0x7'));var client=jayson[_0xea67('0x8')][_0xea67('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1bb0e2,_0x156416,_0x2fe018){return new BPromise(function(_0x1b932b,_0x3e8174){return client[_0xea67('0xa')](_0x1bb0e2,_0x2fe018)[_0xea67('0xb')](function(_0x5a5d44){logger[_0xea67('0xc')](_0xea67('0xd'),_0x156416,_0xea67('0xe'));logger[_0xea67('0xf')](_0xea67('0x10'),_0x156416,'request\x20sent',JSON['stringify'](_0x5a5d44));if(_0x5a5d44['error']){if(_0x5a5d44['error'][_0xea67('0x11')]===0x1f4){logger[_0xea67('0x12')](_0xea67('0xd'),_0x156416,_0x5a5d44['error'][_0xea67('0x13')]);return _0x3e8174(_0x5a5d44[_0xea67('0x12')]['message']);}logger[_0xea67('0x12')](_0xea67('0xd'),_0x156416,_0x5a5d44['error']['message']);return _0x1b932b(_0x5a5d44[_0xea67('0x12')]['message']);}else{logger[_0xea67('0xc')](_0xea67('0xd'),_0x156416,_0xea67('0xe'));_0x1b932b(_0x5a5d44[_0xea67('0x14')][_0xea67('0x13')]);}})['catch'](function(_0x4b4714){logger['error'](_0xea67('0xd'),_0x156416,_0x4b4714);_0x3e8174(_0x4b4714);});});} \ No newline at end of file +var _0x1410=['jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1410,0x130));var _0x0141=function(_0x3e9e1e,_0x2a1068){_0x3e9e1e=_0x3e9e1e-0x0;var _0x2edbbb=_0x1410[_0x3e9e1e];return _0x2edbbb;};'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']('DeskConfiguration,\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']('DeskConfiguration,\x20%s,\x20%s',_0x22b566,_0x3c91e8);_0x57cfbb(_0x3c91e8);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 8a38baf..5a50fc9 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 _0x0053=['show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./intDeskField.controller','isAuthenticated','index','get','/:id'];(function(_0x393d69,_0x3a8c83){var _0x3cee37=function(_0x462682){while(--_0x462682){_0x393d69['push'](_0x393d69['shift']());}};_0x3cee37(++_0x3a8c83);}(_0x0053,0x14b));var _0x3005=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0053[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x3005('0x0'));var path=require(_0x3005('0x1'));var timeout=require(_0x3005('0x2'));var express=require(_0x3005('0x3'));var router=express['Router']();var fs_extra=require(_0x3005('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3005('0x5'));var config=require('../../config/environment');var controller=require(_0x3005('0x6'));router['get']('/',auth[_0x3005('0x7')](),controller[_0x3005('0x8')]);router[_0x3005('0x9')](_0x3005('0xa'),auth[_0x3005('0x7')](),controller[_0x3005('0xb')]);router[_0x3005('0xc')]('/',auth[_0x3005('0x7')](),controller[_0x3005('0xd')]);router[_0x3005('0xe')](_0x3005('0xa'),auth[_0x3005('0x7')](),controller[_0x3005('0xf')]);router[_0x3005('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x3005('0x11')]);module[_0x3005('0x12')]=router; \ No newline at end of file +var _0xa282=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5f1d8c,_0x372db3){var _0x5cad66=function(_0x2ee200){while(--_0x2ee200){_0x5f1d8c['push'](_0x5f1d8c['shift']());}};_0x5cad66(++_0x372db3);}(_0xa282,0x189));var _0x2a28=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xa282[_0x1e4360];return _0x31e6b4;};'use strict';var multer=require(_0x2a28('0x0'));var util=require(_0x2a28('0x1'));var path=require(_0x2a28('0x2'));var timeout=require(_0x2a28('0x3'));var express=require(_0x2a28('0x4'));var router=express[_0x2a28('0x5')]();var fs_extra=require(_0x2a28('0x6'));var auth=require(_0x2a28('0x7'));var interaction=require(_0x2a28('0x8'));var config=require(_0x2a28('0x9'));var controller=require(_0x2a28('0xa'));router[_0x2a28('0xb')]('/',auth[_0x2a28('0xc')](),controller['index']);router['get'](_0x2a28('0xd'),auth[_0x2a28('0xc')](),controller[_0x2a28('0xe')]);router[_0x2a28('0xf')]('/',auth['isAuthenticated'](),controller[_0x2a28('0x10')]);router[_0x2a28('0x11')](_0x2a28('0xd'),auth[_0x2a28('0xc')](),controller[_0x2a28('0x12')]);router[_0x2a28('0x13')]('/:id',auth[_0x2a28('0xc')](),controller['destroy']);module[_0x2a28('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 465d567..a384744 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 _0x3858=['string','STRING','ENUM','BOOLEAN','sequelize','exports','variable','customVariable'];(function(_0x445e22,_0x1c57b8){var _0xc7f4f7=function(_0x48ee20){while(--_0x48ee20){_0x445e22['push'](_0x445e22['shift']());}};_0xc7f4f7(++_0x1c57b8);}(_0x3858,0x10c));var _0x8385=function(_0x3bf5d3,_0x2ca715){_0x3bf5d3=_0x3bf5d3-0x0;var _0x2b81bb=_0x3858[_0x3bf5d3];return _0x2b81bb;};'use strict';var Sequelize=require(_0x8385('0x0'));module[_0x8385('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x8385('0x2'),_0x8385('0x3'),'keyValue','picklist'),'defaultValue':_0x8385('0x4')},'content':{'type':Sequelize[_0x8385('0x5')]},'key':{'type':Sequelize[_0x8385('0x5')]},'keyType':{'type':Sequelize[_0x8385('0x6')]('string','variable',_0x8385('0x3'))},'keyContent':{'type':Sequelize[_0x8385('0x5')]},'idField':{'type':Sequelize[_0x8385('0x5')]},'nameField':{'type':Sequelize[_0x8385('0x5')]},'customField':{'type':Sequelize[_0x8385('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdb25=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xdb25,0x1ca));var _0x5db2=function(_0x80380e,_0xe62cf8){_0x80380e=_0x80380e-0x0;var _0x417c29=_0xdb25[_0x80380e];return _0x417c29;};'use strict';var Sequelize=require(_0x5db2('0x0'));module[_0x5db2('0x1')]={'type':{'type':Sequelize[_0x5db2('0x2')](_0x5db2('0x3'),_0x5db2('0x4'),_0x5db2('0x5'),_0x5db2('0x6'),_0x5db2('0x7')),'defaultValue':_0x5db2('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5db2('0x2')](_0x5db2('0x3'),_0x5db2('0x4'),_0x5db2('0x5'))},'keyContent':{'type':Sequelize[_0x5db2('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5db2('0x8')]},'customField':{'type':Sequelize[_0x5db2('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5db2('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index fee11d7..1b3d6db 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 _0x4d07=['name','send','map','DeskField','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','rows','catch','rawAttributes','find','create','body','params','eml-format','zip-dir','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','update','then','destroy','error','stack'];(function(_0x15402a,_0x4fa192){var _0x227919=function(_0x1e28a4){while(--_0x1e28a4){_0x15402a['push'](_0x15402a['shift']());}};_0x227919(++_0x4fa192);}(_0x4d07,0x18e));var _0x74d0=function(_0x5dbb84,_0x1bbce9){_0x5dbb84=_0x5dbb84-0x0;var _0x1d6eae=_0x4d07[_0x5dbb84];return _0x1d6eae;};'use strict';var emlformat=require(_0x74d0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x74d0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x74d0('0x2'));var util=require(_0x74d0('0x3'));var path=require(_0x74d0('0x4'));var sox=require(_0x74d0('0x5'));var csv=require(_0x74d0('0x6'));var ejs=require(_0x74d0('0x7'));var fs=require('fs');var fs_extra=require(_0x74d0('0x8'));var _=require(_0x74d0('0x9'));var squel=require(_0x74d0('0xa'));var crypto=require(_0x74d0('0xb'));var jsforce=require(_0x74d0('0xc'));var deskjs=require(_0x74d0('0xd'));var toCsv=require(_0x74d0('0x6'));var querystring=require('querystring');var Papa=require(_0x74d0('0xe'));var Redis=require(_0x74d0('0xf'));var authService=require(_0x74d0('0x10'));var qs=require(_0x74d0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x74d0('0x12'));var logger=require(_0x74d0('0x13'))(_0x74d0('0x14'));var utils=require(_0x74d0('0x15'));var config=require(_0x74d0('0x16'));var licenseUtil=require(_0x74d0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13c742,_0x5753aa){_0x5753aa=_0x5753aa||0xcc;return function(_0x3ec5d3){if(_0x3ec5d3){return _0x13c742[_0x74d0('0x18')](_0x5753aa);}return _0x13c742[_0x74d0('0x19')](_0x5753aa)[_0x74d0('0x1a')]();};}function respondWithResult(_0x313c53,_0x3b35e5){_0x3b35e5=_0x3b35e5||0xc8;return function(_0x5cd088){if(_0x5cd088){return _0x313c53[_0x74d0('0x19')](_0x3b35e5)[_0x74d0('0x1b')](_0x5cd088);}};}function respondWithFilteredResult(_0x449162,_0x4a2794){return function(_0x1601d5){if(_0x1601d5){var _0x3e3dee=typeof _0x4a2794[_0x74d0('0x1c')]==='undefined'&&typeof _0x4a2794[_0x74d0('0x1d')]===_0x74d0('0x1e');var _0x30f605=_0x1601d5[_0x74d0('0x1f')];var _0x3cd9af=_0x3e3dee?0x0:_0x4a2794['offset'];var _0x1e1f08=_0x3e3dee?_0x1601d5['count']:_0x4a2794[_0x74d0('0x1c')]+_0x4a2794[_0x74d0('0x1d')];var _0x1ff871;if(_0x1e1f08>=_0x30f605){_0x1e1f08=_0x30f605;_0x1ff871=0xc8;}else{_0x1ff871=0xce;}_0x449162[_0x74d0('0x19')](_0x1ff871);return _0x449162[_0x74d0('0x20')](_0x74d0('0x21'),_0x3cd9af+'-'+_0x1e1f08+'/'+_0x30f605)[_0x74d0('0x1b')](_0x1601d5);}return null;};}function patchUpdates(_0x7aaca6){return function(_0x127690){try{jsonpatch['apply'](_0x127690,_0x7aaca6,!![]);}catch(_0x3cc6b5){return BPromise['reject'](_0x3cc6b5);}return _0x127690[_0x74d0('0x22')]();};}function saveUpdates(_0x16084a,_0x4ab837){return function(_0x1062f9){if(_0x1062f9){return _0x1062f9[_0x74d0('0x23')](_0x16084a)[_0x74d0('0x24')](function(_0x3153f0){return _0x3153f0;});}return null;};}function removeEntity(_0x377514,_0x43dc54){return function(_0xae815f){if(_0xae815f){return _0xae815f[_0x74d0('0x25')]()[_0x74d0('0x24')](function(){_0x377514[_0x74d0('0x19')](0xcc)[_0x74d0('0x1a')]();});}};}function handleEntityNotFound(_0x4ed251,_0x35dbe4){return function(_0x27b4dc){if(!_0x27b4dc){_0x4ed251[_0x74d0('0x18')](0x194);}return _0x27b4dc;};}function handleError(_0x319156,_0x6fbcba){_0x6fbcba=_0x6fbcba||0x1f4;return function(_0x6ab99d){logger[_0x74d0('0x26')](_0x6ab99d[_0x74d0('0x27')]);if(_0x6ab99d[_0x74d0('0x28')]){delete _0x6ab99d['name'];}_0x319156['status'](_0x6fbcba)[_0x74d0('0x29')](_0x6ab99d);};}exports['index']=function(_0x18b4fd,_0x261fc6){var _0x2d9880={},_0x4c18d9={},_0x5bc475={'count':0x0,'rows':[]};var _0xbebf6=_[_0x74d0('0x2a')](db[_0x74d0('0x2b')]['rawAttributes'],function(_0x59294b){return{'name':_0x59294b[_0x74d0('0x2c')],'type':_0x59294b[_0x74d0('0x2d')][_0x74d0('0x2e')]};});_0x4c18d9['model']=_[_0x74d0('0x2a')](_0xbebf6,_0x74d0('0x28'));_0x4c18d9[_0x74d0('0x2f')]=_[_0x74d0('0x30')](_0x18b4fd[_0x74d0('0x2f')]);_0x4c18d9['filters']=_['intersection'](_0x4c18d9[_0x74d0('0x31')],_0x4c18d9[_0x74d0('0x2f')]);_0x2d9880[_0x74d0('0x32')]=_[_0x74d0('0x33')](_0x4c18d9['model'],qs[_0x74d0('0x34')](_0x18b4fd[_0x74d0('0x2f')][_0x74d0('0x34')]));_0x2d9880[_0x74d0('0x32')]=_0x2d9880[_0x74d0('0x32')][_0x74d0('0x35')]?_0x2d9880[_0x74d0('0x32')]:_0x4c18d9[_0x74d0('0x31')];if(!_0x18b4fd[_0x74d0('0x2f')][_0x74d0('0x36')](_0x74d0('0x37'))){_0x2d9880[_0x74d0('0x1d')]=qs[_0x74d0('0x1d')](_0x18b4fd['query'][_0x74d0('0x1d')]);_0x2d9880[_0x74d0('0x1c')]=qs[_0x74d0('0x1c')](_0x18b4fd[_0x74d0('0x2f')][_0x74d0('0x1c')]);}_0x2d9880[_0x74d0('0x38')]=qs[_0x74d0('0x39')](_0x18b4fd[_0x74d0('0x2f')][_0x74d0('0x39')]);_0x2d9880[_0x74d0('0x3a')]=qs['filters'](_[_0x74d0('0x3b')](_0x18b4fd[_0x74d0('0x2f')],_0x4c18d9[_0x74d0('0x3c')]),_0xbebf6);if(_0x18b4fd['query']['filter']){_0x2d9880[_0x74d0('0x3a')]=_[_0x74d0('0x3d')](_0x2d9880['where'],{'$or':_[_0x74d0('0x2a')](_0xbebf6,function(_0x4c4cfd){if(_0x4c4cfd[_0x74d0('0x2d')]!==_0x74d0('0x3e')){var _0x43c894={};_0x43c894[_0x4c4cfd[_0x74d0('0x28')]]={'$like':'%'+_0x18b4fd[_0x74d0('0x2f')][_0x74d0('0x3f')]+'%'};return _0x43c894;}})});}_0x2d9880=_[_0x74d0('0x3d')]({},_0x2d9880,_0x18b4fd[_0x74d0('0x40')]);var _0x2dae77={'where':_0x2d9880[_0x74d0('0x3a')]};return db['DeskField'][_0x74d0('0x1f')](_0x2dae77)[_0x74d0('0x24')](function(_0x55935e){_0x5bc475['count']=_0x55935e;if(_0x18b4fd['query'][_0x74d0('0x41')]){_0x2d9880['include']=[{'all':!![]}];}return db[_0x74d0('0x2b')]['findAll'](_0x2d9880);})[_0x74d0('0x24')](function(_0x55d8d3){_0x5bc475[_0x74d0('0x42')]=_0x55d8d3;return _0x5bc475;})['then'](respondWithFilteredResult(_0x261fc6,_0x2d9880))[_0x74d0('0x43')](handleError(_0x261fc6,null));};exports['show']=function(_0x450aec,_0x3d79ed){var _0x2ecd38={'raw':!![],'where':{'id':_0x450aec['params']['id']}},_0x11a24e={};_0x11a24e['model']=_[_0x74d0('0x30')](db['DeskField'][_0x74d0('0x44')]);_0x11a24e[_0x74d0('0x2f')]=_[_0x74d0('0x30')](_0x450aec[_0x74d0('0x2f')]);_0x11a24e[_0x74d0('0x3c')]=_['intersection'](_0x11a24e[_0x74d0('0x31')],_0x11a24e[_0x74d0('0x2f')]);_0x2ecd38['attributes']=_[_0x74d0('0x33')](_0x11a24e[_0x74d0('0x31')],qs[_0x74d0('0x34')](_0x450aec[_0x74d0('0x2f')][_0x74d0('0x34')]));_0x2ecd38['attributes']=_0x2ecd38['attributes']['length']?_0x2ecd38[_0x74d0('0x32')]:_0x11a24e[_0x74d0('0x31')];if(_0x450aec[_0x74d0('0x2f')][_0x74d0('0x41')]){_0x2ecd38['include']=[{'all':!![]}];}_0x2ecd38=_['merge']({},_0x2ecd38,_0x450aec[_0x74d0('0x40')]);return db[_0x74d0('0x2b')][_0x74d0('0x45')](_0x2ecd38)[_0x74d0('0x24')](handleEntityNotFound(_0x3d79ed,null))[_0x74d0('0x24')](respondWithResult(_0x3d79ed,null))[_0x74d0('0x43')](handleError(_0x3d79ed,null));};exports[_0x74d0('0x46')]=function(_0x531db9,_0x3ef3d0){return db['DeskField']['create'](_0x531db9[_0x74d0('0x47')],{})['then'](respondWithResult(_0x3ef3d0,0xc9))[_0x74d0('0x43')](handleError(_0x3ef3d0,null));};exports[_0x74d0('0x23')]=function(_0x3a9cfb,_0x10452b){if(_0x3a9cfb[_0x74d0('0x47')]['id']){delete _0x3a9cfb['body']['id'];}return db['DeskField']['find']({'where':{'id':_0x3a9cfb[_0x74d0('0x48')]['id']}})[_0x74d0('0x24')](handleEntityNotFound(_0x10452b,null))[_0x74d0('0x24')](saveUpdates(_0x3a9cfb[_0x74d0('0x47')],null))['then'](respondWithResult(_0x10452b,null))[_0x74d0('0x43')](handleError(_0x10452b,null));};exports[_0x74d0('0x25')]=function(_0x1bf9cd,_0x41f893){return db[_0x74d0('0x2b')]['find']({'where':{'id':_0x1bf9cd[_0x74d0('0x48')]['id']}})[_0x74d0('0x24')](handleEntityNotFound(_0x41f893,null))['then'](removeEntity(_0x41f893,null))[_0x74d0('0x43')](handleError(_0x41f893,null));}; \ No newline at end of file +var _0x494e=['util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','DeskField','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','options','include','findAll','rows','show','keys','rawAttributes','includeAll','merge','find','catch','create','body','params','eml-format','zip-dir','moment','bluebird','mustache'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x494e,0xd6));var _0xe494=function(_0x2bbc0b,_0x209fbc){_0x2bbc0b=_0x2bbc0b-0x0;var _0x2a2cf6=_0x494e[_0x2bbc0b];return _0x2a2cf6;};'use strict';var emlformat=require(_0xe494('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe494('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe494('0x2'));var BPromise=require(_0xe494('0x3'));var Mustache=require(_0xe494('0x4'));var util=require(_0xe494('0x5'));var path=require(_0xe494('0x6'));var sox=require(_0xe494('0x7'));var csv=require(_0xe494('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe494('0x9'));var squel=require(_0xe494('0xa'));var crypto=require(_0xe494('0xb'));var jsforce=require(_0xe494('0xc'));var deskjs=require(_0xe494('0xd'));var toCsv=require(_0xe494('0x8'));var querystring=require(_0xe494('0xe'));var Papa=require('papaparse');var Redis=require(_0xe494('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe494('0x10'));var hardwareService=require(_0xe494('0x11'));var logger=require(_0xe494('0x12'))(_0xe494('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe494('0x14'))['db'];function respondWithStatusCode(_0xbd223f,_0x43c3be){_0x43c3be=_0x43c3be||0xcc;return function(_0x51f733){if(_0x51f733){return _0xbd223f[_0xe494('0x15')](_0x43c3be);}return _0xbd223f[_0xe494('0x16')](_0x43c3be)[_0xe494('0x17')]();};}function respondWithResult(_0x2fa579,_0x57afbf){_0x57afbf=_0x57afbf||0xc8;return function(_0x1d6a4c){if(_0x1d6a4c){return _0x2fa579['status'](_0x57afbf)['json'](_0x1d6a4c);}};}function respondWithFilteredResult(_0x1158ec,_0xa43ef2){return function(_0x317c23){if(_0x317c23){var _0x34744a=typeof _0xa43ef2['offset']===_0xe494('0x18')&&typeof _0xa43ef2[_0xe494('0x19')]===_0xe494('0x18');var _0x524ec2=_0x317c23[_0xe494('0x1a')];var _0x5737b8=_0x34744a?0x0:_0xa43ef2['offset'];var _0x411dba=_0x34744a?_0x317c23[_0xe494('0x1a')]:_0xa43ef2[_0xe494('0x1b')]+_0xa43ef2[_0xe494('0x19')];var _0x4465e1;if(_0x411dba>=_0x524ec2){_0x411dba=_0x524ec2;_0x4465e1=0xc8;}else{_0x4465e1=0xce;}_0x1158ec[_0xe494('0x16')](_0x4465e1);return _0x1158ec[_0xe494('0x1c')]('Content-Range',_0x5737b8+'-'+_0x411dba+'/'+_0x524ec2)[_0xe494('0x1d')](_0x317c23);}return null;};}function patchUpdates(_0x3bc181){return function(_0xa3dd6a){try{jsonpatch[_0xe494('0x1e')](_0xa3dd6a,_0x3bc181,!![]);}catch(_0x3bb951){return BPromise[_0xe494('0x1f')](_0x3bb951);}return _0xa3dd6a[_0xe494('0x20')]();};}function saveUpdates(_0x12454d,_0x44ddda){return function(_0x3ea711){if(_0x3ea711){return _0x3ea711[_0xe494('0x21')](_0x12454d)[_0xe494('0x22')](function(_0x39b02a){return _0x39b02a;});}return null;};}function removeEntity(_0x4cbb2a,_0x22267d){return function(_0x1847ca){if(_0x1847ca){return _0x1847ca[_0xe494('0x23')]()['then'](function(){_0x4cbb2a[_0xe494('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8447e8,_0x58c4ce){return function(_0x540d67){if(!_0x540d67){_0x8447e8[_0xe494('0x15')](0x194);}return _0x540d67;};}function handleError(_0x7277a,_0x49b3b2){_0x49b3b2=_0x49b3b2||0x1f4;return function(_0x3390bd){logger[_0xe494('0x24')](_0x3390bd[_0xe494('0x25')]);if(_0x3390bd['name']){delete _0x3390bd[_0xe494('0x26')];}_0x7277a[_0xe494('0x16')](_0x49b3b2)[_0xe494('0x27')](_0x3390bd);};}exports['index']=function(_0x191de7,_0x2571ef){var _0x4fc686={},_0x58d3f9={},_0x4940ca={'count':0x0,'rows':[]};var _0x4f693f=_[_0xe494('0x28')](db[_0xe494('0x29')]['rawAttributes'],function(_0x49fb81){return{'name':_0x49fb81[_0xe494('0x2a')],'type':_0x49fb81['type'][_0xe494('0x2b')]};});_0x58d3f9['model']=_[_0xe494('0x28')](_0x4f693f,'name');_0x58d3f9[_0xe494('0x2c')]=_['keys'](_0x191de7[_0xe494('0x2c')]);_0x58d3f9[_0xe494('0x2d')]=_[_0xe494('0x2e')](_0x58d3f9[_0xe494('0x2f')],_0x58d3f9['query']);_0x4fc686[_0xe494('0x30')]=_[_0xe494('0x2e')](_0x58d3f9[_0xe494('0x2f')],qs[_0xe494('0x31')](_0x191de7[_0xe494('0x2c')][_0xe494('0x31')]));_0x4fc686[_0xe494('0x30')]=_0x4fc686[_0xe494('0x30')][_0xe494('0x32')]?_0x4fc686[_0xe494('0x30')]:_0x58d3f9['model'];if(!_0x191de7['query'][_0xe494('0x33')](_0xe494('0x34'))){_0x4fc686[_0xe494('0x19')]=qs['limit'](_0x191de7['query'][_0xe494('0x19')]);_0x4fc686['offset']=qs[_0xe494('0x1b')](_0x191de7[_0xe494('0x2c')]['offset']);}_0x4fc686['order']=qs['sort'](_0x191de7[_0xe494('0x2c')][_0xe494('0x35')]);_0x4fc686[_0xe494('0x36')]=qs['filters'](_[_0xe494('0x37')](_0x191de7['query'],_0x58d3f9[_0xe494('0x2d')]),_0x4f693f);if(_0x191de7['query'][_0xe494('0x38')]){_0x4fc686['where']=_['merge'](_0x4fc686['where'],{'$or':_[_0xe494('0x28')](_0x4f693f,function(_0x256864){if(_0x256864[_0xe494('0x39')]!==_0xe494('0x3a')){var _0x4af235={};_0x4af235[_0x256864[_0xe494('0x26')]]={'$like':'%'+_0x191de7[_0xe494('0x2c')][_0xe494('0x38')]+'%'};return _0x4af235;}})});}_0x4fc686=_['merge']({},_0x4fc686,_0x191de7[_0xe494('0x3b')]);var _0x3327ca={'where':_0x4fc686[_0xe494('0x36')]};return db[_0xe494('0x29')][_0xe494('0x1a')](_0x3327ca)['then'](function(_0x3a9fa0){_0x4940ca[_0xe494('0x1a')]=_0x3a9fa0;if(_0x191de7['query']['includeAll']){_0x4fc686[_0xe494('0x3c')]=[{'all':!![]}];}return db[_0xe494('0x29')][_0xe494('0x3d')](_0x4fc686);})[_0xe494('0x22')](function(_0x2d7bb2){_0x4940ca[_0xe494('0x3e')]=_0x2d7bb2;return _0x4940ca;})[_0xe494('0x22')](respondWithFilteredResult(_0x2571ef,_0x4fc686))['catch'](handleError(_0x2571ef,null));};exports[_0xe494('0x3f')]=function(_0x164075,_0x28b6e7){var _0x34f3d6={'raw':!![],'where':{'id':_0x164075['params']['id']}},_0x464dd4={};_0x464dd4['model']=_[_0xe494('0x40')](db[_0xe494('0x29')][_0xe494('0x41')]);_0x464dd4[_0xe494('0x2c')]=_[_0xe494('0x40')](_0x164075[_0xe494('0x2c')]);_0x464dd4[_0xe494('0x2d')]=_[_0xe494('0x2e')](_0x464dd4[_0xe494('0x2f')],_0x464dd4['query']);_0x34f3d6[_0xe494('0x30')]=_['intersection'](_0x464dd4['model'],qs[_0xe494('0x31')](_0x164075['query'][_0xe494('0x31')]));_0x34f3d6[_0xe494('0x30')]=_0x34f3d6[_0xe494('0x30')]['length']?_0x34f3d6['attributes']:_0x464dd4[_0xe494('0x2f')];if(_0x164075[_0xe494('0x2c')][_0xe494('0x42')]){_0x34f3d6['include']=[{'all':!![]}];}_0x34f3d6=_[_0xe494('0x43')]({},_0x34f3d6,_0x164075[_0xe494('0x3b')]);return db[_0xe494('0x29')][_0xe494('0x44')](_0x34f3d6)[_0xe494('0x22')](handleEntityNotFound(_0x28b6e7,null))['then'](respondWithResult(_0x28b6e7,null))[_0xe494('0x45')](handleError(_0x28b6e7,null));};exports[_0xe494('0x46')]=function(_0x488f10,_0x9be151){return db[_0xe494('0x29')][_0xe494('0x46')](_0x488f10[_0xe494('0x47')],{})[_0xe494('0x22')](respondWithResult(_0x9be151,0xc9))['catch'](handleError(_0x9be151,null));};exports[_0xe494('0x21')]=function(_0x506d15,_0x2a0271){if(_0x506d15[_0xe494('0x47')]['id']){delete _0x506d15[_0xe494('0x47')]['id'];}return db[_0xe494('0x29')][_0xe494('0x44')]({'where':{'id':_0x506d15[_0xe494('0x48')]['id']}})[_0xe494('0x22')](handleEntityNotFound(_0x2a0271,null))['then'](saveUpdates(_0x506d15[_0xe494('0x47')],null))[_0xe494('0x22')](respondWithResult(_0x2a0271,null))[_0xe494('0x45')](handleError(_0x2a0271,null));};exports[_0xe494('0x23')]=function(_0x56b86a,_0x54f619){return db['DeskField'][_0xe494('0x44')]({'where':{'id':_0x56b86a[_0xe494('0x48')]['id']}})[_0xe494('0x22')](handleEntityNotFound(_0x54f619,null))[_0xe494('0x22')](removeEntity(_0x54f619,null))['catch'](handleError(_0x54f619,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index bf1e7d0..3e481e8 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 _0x3c25=['int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDeskField.attributes','DeskField'];(function(_0x4b0e73,_0x176c80){var _0x1455b0=function(_0x1352c5){while(--_0x1352c5){_0x4b0e73['push'](_0x4b0e73['shift']());}};_0x1455b0(++_0x176c80);}(_0x3c25,0x130));var _0x53c2=function(_0xc1d1d9,_0x33d89b){_0xc1d1d9=_0xc1d1d9-0x0;var _0x5ac72b=_0x3c25[_0xc1d1d9];return _0x5ac72b;};'use strict';var _=require(_0x53c2('0x0'));var util=require(_0x53c2('0x1'));var logger=require(_0x53c2('0x2'))(_0x53c2('0x3'));var moment=require(_0x53c2('0x4'));var BPromise=require(_0x53c2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x53c2('0x6'));var rimraf=require(_0x53c2('0x7'));var config=require(_0x53c2('0x8'));var attributes=require(_0x53c2('0x9'));module['exports']=function(_0x232aa0,_0x38edf4){return _0x232aa0['define'](_0x53c2('0xa'),attributes,{'tableName':_0x53c2('0xb'),'paranoid':![],'indexes':[{'name':_0x53c2('0xc'),'fields':[_0x53c2('0xd'),_0x53c2('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfe5b=['desk_unique_index','idField','lodash','util','api','bluebird','request-promise','path','rimraf','./intDeskField.attributes','define','DeskField','int_desk_fields'];(function(_0x3f8870,_0x362fb5){var _0xf7bb50=function(_0x58617c){while(--_0x58617c){_0x3f8870['push'](_0x3f8870['shift']());}};_0xf7bb50(++_0x362fb5);}(_0xfe5b,0x1f0));var _0xbfe5=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0xfe5b[_0x13ce0c];return _0x4388fb;};'use strict';var _=require(_0xbfe5('0x0'));var util=require(_0xbfe5('0x1'));var logger=require('../../config/logger')(_0xbfe5('0x2'));var moment=require('moment');var BPromise=require(_0xbfe5('0x3'));var rp=require(_0xbfe5('0x4'));var fs=require('fs');var path=require(_0xbfe5('0x5'));var rimraf=require(_0xbfe5('0x6'));var config=require('../../config/environment');var attributes=require(_0xbfe5('0x7'));module['exports']=function(_0x18787a,_0x317d29){return _0x18787a[_0xbfe5('0x8')](_0xbfe5('0x9'),attributes,{'tableName':_0xbfe5('0xa'),'paranoid':![],'indexes':[{'name':_0xbfe5('0xb'),'fields':[_0xbfe5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 6df781b..29f4536 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 _0xdaa7=['randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util'];(function(_0x2980de,_0x1426a4){var _0x81a4ca=function(_0x19040e){while(--_0x19040e){_0x2980de['push'](_0x2980de['shift']());}};_0x81a4ca(++_0x1426a4);}(_0xdaa7,0x19c));var _0x7daa=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0xdaa7[_0x51c819];return _0x15c5d2;};'use strict';var _=require(_0x7daa('0x0'));var util=require(_0x7daa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7daa('0x2'));var fs=require('fs');var Redis=require(_0x7daa('0x3'));var db=require(_0x7daa('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7daa('0x5'));var jayson=require(_0x7daa('0x6'));var client=jayson[_0x7daa('0x7')][_0x7daa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x917cc7,_0x4111bf,_0x4b670f){return new BPromise(function(_0x2be978,_0x3e2143){return client['request'](_0x917cc7,_0x4b670f)['then'](function(_0x2b1de9){logger[_0x7daa('0x9')](_0x7daa('0xa'),_0x4111bf,_0x7daa('0xb'));logger[_0x7daa('0xc')]('DeskField,\x20%s,\x20%s,\x20%s',_0x4111bf,_0x7daa('0xb'),JSON[_0x7daa('0xd')](_0x2b1de9));if(_0x2b1de9[_0x7daa('0xe')]){if(_0x2b1de9[_0x7daa('0xe')][_0x7daa('0xf')]===0x1f4){logger[_0x7daa('0xe')](_0x7daa('0xa'),_0x4111bf,_0x2b1de9[_0x7daa('0xe')][_0x7daa('0x10')]);return _0x3e2143(_0x2b1de9[_0x7daa('0xe')][_0x7daa('0x10')]);}logger['error'](_0x7daa('0xa'),_0x4111bf,_0x2b1de9[_0x7daa('0xe')]['message']);return _0x2be978(_0x2b1de9[_0x7daa('0xe')][_0x7daa('0x10')]);}else{logger[_0x7daa('0x9')](_0x7daa('0xa'),_0x4111bf,_0x7daa('0xb'));_0x2be978(_0x2b1de9['result'][_0x7daa('0x10')]);}})[_0x7daa('0x11')](function(_0x151502){logger[_0x7daa('0xe')](_0x7daa('0xa'),_0x4111bf,_0x151502);_0x3e2143(_0x151502);});});} \ No newline at end of file +var _0x44ee=['info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x13ec74,_0x2ed6bd){var _0x1bf158=function(_0x20da2b){while(--_0x20da2b){_0x13ec74['push'](_0x13ec74['shift']());}};_0x1bf158(++_0x2ed6bd);}(_0x44ee,0x1d7));var _0xe44e=function(_0x2173ad,_0x29c09a){_0x2173ad=_0x2173ad-0x0;var _0x1b32ca=_0x44ee[_0x2173ad];return _0x1b32ca;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe44e('0x0'));var BPromise=require(_0xe44e('0x1'));var rs=require(_0xe44e('0x2'));var fs=require('fs');var Redis=require(_0xe44e('0x3'));var db=require(_0xe44e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe44e('0x5'))(_0xe44e('0x6'));var config=require(_0xe44e('0x7'));var jayson=require(_0xe44e('0x8'));var client=jayson[_0xe44e('0x9')][_0xe44e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d6797,_0x40397e,_0x2c3ae7){return new BPromise(function(_0x40efa7,_0x59a6c5){return client[_0xe44e('0xb')](_0x5d6797,_0x2c3ae7)['then'](function(_0x281504){logger[_0xe44e('0xc')](_0xe44e('0xd'),_0x40397e,_0xe44e('0xe'));logger['debug'](_0xe44e('0xf'),_0x40397e,'request\x20sent',JSON[_0xe44e('0x10')](_0x281504));if(_0x281504[_0xe44e('0x11')]){if(_0x281504['error'][_0xe44e('0x12')]===0x1f4){logger[_0xe44e('0x11')](_0xe44e('0xd'),_0x40397e,_0x281504[_0xe44e('0x11')]['message']);return _0x59a6c5(_0x281504[_0xe44e('0x11')][_0xe44e('0x13')]);}logger[_0xe44e('0x11')]('DeskField,\x20%s,\x20%s',_0x40397e,_0x281504[_0xe44e('0x11')][_0xe44e('0x13')]);return _0x40efa7(_0x281504['error'][_0xe44e('0x13')]);}else{logger[_0xe44e('0xc')]('DeskField,\x20%s,\x20%s',_0x40397e,_0xe44e('0xe'));_0x40efa7(_0x281504['result']['message']);}})[_0xe44e('0x14')](function(_0x1ea80f){logger[_0xe44e('0x11')](_0xe44e('0xd'),_0x40397e,_0x1ea80f);_0x59a6c5(_0x1ea80f);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 5089b17..e91c9a9 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 _0xa5ac=['/:id/configurations','addConfiguration','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','get','/:id','show','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x43ec5b,_0x156cee){var _0xe01ed=function(_0x5be6ac){while(--_0x5be6ac){_0x43ec5b['push'](_0x43ec5b['shift']());}};_0xe01ed(++_0x156cee);}(_0xa5ac,0xc1));var _0xca5a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5ac[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xca5a('0x0'));var path=require(_0xca5a('0x1'));var timeout=require(_0xca5a('0x2'));var express=require('express');var router=express[_0xca5a('0x3')]();var fs_extra=require(_0xca5a('0x4'));var auth=require(_0xca5a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xca5a('0x6'));var controller=require(_0xca5a('0x7'));router['get']('/',auth[_0xca5a('0x8')](),controller['index']);router[_0xca5a('0x9')](_0xca5a('0xa'),auth[_0xca5a('0x8')](),controller[_0xca5a('0xb')]);router['get']('/:id/configurations',auth[_0xca5a('0x8')](),controller[_0xca5a('0xc')]);router[_0xca5a('0x9')](_0xca5a('0xd'),auth[_0xca5a('0x8')](),controller[_0xca5a('0xe')]);router[_0xca5a('0xf')]('/',auth[_0xca5a('0x8')](),controller[_0xca5a('0x10')]);router[_0xca5a('0xf')](_0xca5a('0x11'),auth['isAuthenticated'](),controller[_0xca5a('0x12')]);router['put'](_0xca5a('0xa'),auth[_0xca5a('0x8')](),controller['update']);router['delete'](_0xca5a('0xa'),auth['isAuthenticated'](),controller[_0xca5a('0x13')]);module[_0xca5a('0x14')]=router; \ No newline at end of file +var _0x194d=['multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','exports'];(function(_0x148bc0,_0xf5cfdc){var _0x34d7d0=function(_0x28f5d7){while(--_0x28f5d7){_0x148bc0['push'](_0x148bc0['shift']());}};_0x34d7d0(++_0xf5cfdc);}(_0x194d,0x9a));var _0xd194=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x194d[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0xd194('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd194('0x1'));var express=require(_0xd194('0x2'));var router=express['Router']();var fs_extra=require(_0xd194('0x3'));var auth=require(_0xd194('0x4'));var interaction=require(_0xd194('0x5'));var config=require(_0xd194('0x6'));var controller=require('./intDynamics365Account.controller');router[_0xd194('0x7')]('/',auth[_0xd194('0x8')](),controller[_0xd194('0x9')]);router['get'](_0xd194('0xa'),auth[_0xd194('0x8')](),controller['show']);router[_0xd194('0x7')](_0xd194('0xb'),auth[_0xd194('0x8')](),controller[_0xd194('0xc')]);router[_0xd194('0x7')](_0xd194('0xd'),auth[_0xd194('0x8')](),controller[_0xd194('0xe')]);router[_0xd194('0xf')]('/',auth[_0xd194('0x8')](),controller[_0xd194('0x10')]);router[_0xd194('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xd194('0x11')]);router['put']('/:id',auth[_0xd194('0x8')](),controller[_0xd194('0x12')]);router[_0xd194('0x13')](_0xd194('0xa'),auth[_0xd194('0x8')](),controller[_0xd194('0x14')]);module[_0xd194('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 531932b..a2b22c5 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 _0x744c=['sequelize','exports','STRING','BOOLEAN'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x744c,0xa0));var _0xc744=function(_0xc76644,_0x2c0f9a){_0xc76644=_0xc76644-0x0;var _0x366481=_0x744c[_0xc76644];return _0x366481;};'use strict';var Sequelize=require(_0xc744('0x0'));module[_0xc744('0x1')]={'name':{'type':Sequelize[_0xc744('0x2')]},'username':{'type':Sequelize[_0xc744('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xc744('0x2')]},'tenantId':{'type':Sequelize[_0xc744('0x2')]},'clientId':{'type':Sequelize[_0xc744('0x2')]},'clientSecret':{'type':Sequelize[_0xc744('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xc744('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x10dc=['exports','STRING','BOOLEAN','sequelize'];(function(_0x4af3dc,_0x5ef283){var _0x2b8396=function(_0x90991){while(--_0x90991){_0x4af3dc['push'](_0x4af3dc['shift']());}};_0x2b8396(++_0x5ef283);}(_0x10dc,0x107));var _0xc10d=function(_0x113a1a,_0x22a2c9){_0x113a1a=_0x113a1a-0x0;var _0x14d16e=_0x10dc[_0x113a1a];return _0x14d16e;};'use strict';var Sequelize=require(_0xc10d('0x0'));module[_0xc10d('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc10d('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xc10d('0x2')]},'tenantId':{'type':Sequelize[_0xc10d('0x2')]},'clientId':{'type':Sequelize[_0xc10d('0x2')]},'clientSecret':{'type':Sequelize[_0xc10d('0x2')]},'serverUrl':{'type':Sequelize[_0xc10d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc10d('0x2')]},'modernAuthentication':{'type':Sequelize[_0xc10d('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 7082d5b..8caef46 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 _0x5561=['GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','includes','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','push','MetadataId','all','isNil','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','concat','send','test','Wrong\x20credentials','statusCode','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','json','offset','limit','count','set','Content-Range','update','then','destroy','status','end','sendStatus','error','name','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','params','includeAll','options','find','create','body','getConfigurations','findOne','Dynamics365Configuration','hasOwnProperty','AccountId','Descriptions','getDescriptions','channel','Dynamics365Field','Subjects','lastIndexOf','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','title','description','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyyominame','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','resolvebykpiidname','responsiblecontactidyominame','slaname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','utcconversiontimezonecode','versionnumber','username','password','remoteUri','clientSecret','CloudProvider','data7','modernAuthentication','access_token','data5','POST','tenantId','/oauth2/token','clientId'];(function(_0x291d19,_0x3cd086){var _0x9afffe=function(_0x5b40d6){while(--_0x5b40d6){_0x291d19['push'](_0x291d19['shift']());}};_0x9afffe(++_0x3cd086);}(_0x5561,0xe0));var _0x1556=function(_0x42ee88,_0x321540){_0x42ee88=_0x42ee88-0x0;var _0x560514=_0x5561[_0x42ee88];return _0x560514;};'use strict';var rp=require(_0x1556('0x0'));var util=require(_0x1556('0x1'));var _=require(_0x1556('0x2'));var qs=require(_0x1556('0x3'));var logger=require(_0x1556('0x4'))(_0x1556('0x5'));var db=require(_0x1556('0x6'))['db'];var integrations=require(_0x1556('0x7'));function respondWithResult(_0x3b4088,_0x137534){_0x137534=_0x137534||0xc8;return function(_0xf97c23){if(_0xf97c23){return _0x3b4088['status'](_0x137534)[_0x1556('0x8')](_0xf97c23);}};}function respondWithFilteredResult(_0x81cb5b,_0xc6c4f3){return function(_0x2569fa){if(_0x2569fa){var _0x34668a=typeof _0xc6c4f3[_0x1556('0x9')]==='undefined'&&typeof _0xc6c4f3[_0x1556('0xa')]==='undefined';var _0x4e938f=_0x2569fa[_0x1556('0xb')];var _0x3ac4a3=_0x34668a?0x0:_0xc6c4f3[_0x1556('0x9')];var _0x33b3fb=_0x34668a?_0x2569fa['count']:_0xc6c4f3['offset']+_0xc6c4f3[_0x1556('0xa')];var _0x2000f;if(_0x33b3fb>=_0x4e938f){_0x33b3fb=_0x4e938f;_0x2000f=0xc8;}else{_0x2000f=0xce;}_0x81cb5b['status'](_0x2000f);return _0x81cb5b[_0x1556('0xc')](_0x1556('0xd'),_0x3ac4a3+'-'+_0x33b3fb+'/'+_0x4e938f)['json'](_0x2569fa);}return null;};}function saveUpdates(_0x4f6935){return function(_0x31c30b){if(_0x31c30b){return _0x31c30b[_0x1556('0xe')](_0x4f6935)[_0x1556('0xf')](function(_0x354035){return _0x354035;});}return null;};}function removeEntity(_0x50079e){return function(_0x157f46){if(_0x157f46){return _0x157f46[_0x1556('0x10')]()[_0x1556('0xf')](function(){_0x50079e[_0x1556('0x11')](0xcc)[_0x1556('0x12')]();});}};}function handleEntityNotFound(_0x4e7745){return function(_0x59e0e7){if(!_0x59e0e7){_0x4e7745[_0x1556('0x13')](0x194);}return _0x59e0e7;};}function handleError(_0x34d49e,_0x18e453){_0x18e453=_0x18e453||0x1f4;return function(_0x13746f){logger[_0x1556('0x14')](_0x13746f['stack']);if(_0x13746f[_0x1556('0x15')]){delete _0x13746f[_0x1556('0x15')];}_0x34d49e['status'](_0x18e453)['send'](_0x13746f);};}exports[_0x1556('0x16')]=function(_0x52869a,_0xa29b68){var _0x510f35={},_0x4e47fc={},_0x502a35={'count':0x0,'rows':[]};var _0x478521=_[_0x1556('0x17')](db[_0x1556('0x18')][_0x1556('0x19')],function(_0x29001b){return{'name':_0x29001b[_0x1556('0x1a')],'type':_0x29001b[_0x1556('0x1b')][_0x1556('0x1c')]};});_0x4e47fc[_0x1556('0x1d')]=_['map'](_0x478521,_0x1556('0x15'));_0x4e47fc[_0x1556('0x1e')]=_[_0x1556('0x1f')](_0x52869a[_0x1556('0x1e')]);_0x4e47fc[_0x1556('0x20')]=_[_0x1556('0x21')](_0x4e47fc[_0x1556('0x1d')],_0x4e47fc[_0x1556('0x1e')]);_0x510f35[_0x1556('0x22')]=_[_0x1556('0x21')](_0x4e47fc[_0x1556('0x1d')],qs[_0x1556('0x23')](_0x52869a[_0x1556('0x1e')][_0x1556('0x23')]));_0x510f35[_0x1556('0x22')]=_0x510f35['attributes'][_0x1556('0x24')]?_0x510f35[_0x1556('0x22')]:_0x4e47fc[_0x1556('0x1d')];if(!_0x52869a[_0x1556('0x1e')]['hasOwnProperty'](_0x1556('0x25'))){_0x510f35[_0x1556('0xa')]=qs[_0x1556('0xa')](_0x52869a[_0x1556('0x1e')][_0x1556('0xa')]);_0x510f35[_0x1556('0x9')]=qs[_0x1556('0x9')](_0x52869a['query'][_0x1556('0x9')]);}_0x510f35[_0x1556('0x26')]=qs[_0x1556('0x27')](_0x52869a[_0x1556('0x1e')][_0x1556('0x27')]);_0x510f35[_0x1556('0x28')]=qs[_0x1556('0x20')](_[_0x1556('0x29')](_0x52869a['query'],_0x4e47fc[_0x1556('0x20')]),_0x478521);if(_0x52869a[_0x1556('0x1e')][_0x1556('0x2a')]){_0x510f35['where']=_[_0x1556('0x2b')](_0x510f35['where'],{'$or':_[_0x1556('0x17')](_0x478521,function(_0x48489f){if(_0x48489f[_0x1556('0x1b')]!==_0x1556('0x2c')){var _0x93d9b3={};_0x93d9b3[_0x48489f[_0x1556('0x15')]]={'$like':'%'+_0x52869a['query'][_0x1556('0x2a')]+'%'};return _0x93d9b3;}})});}_0x510f35=_['merge']({},_0x510f35,_0x52869a['options']);var _0x3bef39={'where':_0x510f35['where']};return db[_0x1556('0x18')]['count'](_0x3bef39)[_0x1556('0xf')](function(_0x504f37){_0x502a35[_0x1556('0xb')]=_0x504f37;if(_0x52869a[_0x1556('0x1e')]['includeAll']){_0x510f35[_0x1556('0x2d')]=[{'all':!![]}];}return db[_0x1556('0x18')][_0x1556('0x2e')](_0x510f35);})[_0x1556('0xf')](function(_0x2bef4d){_0x502a35['rows']=_0x2bef4d;return _0x502a35;})[_0x1556('0xf')](respondWithFilteredResult(_0xa29b68,_0x510f35))[_0x1556('0x2f')](handleError(_0xa29b68,null));};exports[_0x1556('0x30')]=function(_0x501860,_0x35f319){var _0x3eb87e={'raw':![],'where':{'id':_0x501860[_0x1556('0x31')]['id']}},_0x40248b={};_0x40248b[_0x1556('0x1d')]=_['keys'](db['Dynamics365Account'][_0x1556('0x19')]);_0x40248b['query']=_[_0x1556('0x1f')](_0x501860[_0x1556('0x1e')]);_0x40248b[_0x1556('0x20')]=_['intersection'](_0x40248b[_0x1556('0x1d')],_0x40248b[_0x1556('0x1e')]);_0x3eb87e[_0x1556('0x22')]=_[_0x1556('0x21')](_0x40248b[_0x1556('0x1d')],qs['fields'](_0x501860[_0x1556('0x1e')][_0x1556('0x23')]));_0x3eb87e[_0x1556('0x22')]=_0x3eb87e['attributes'][_0x1556('0x24')]?_0x3eb87e['attributes']:_0x40248b[_0x1556('0x1d')];if(_0x501860[_0x1556('0x1e')][_0x1556('0x32')]){_0x3eb87e['include']=[{'all':!![]}];}_0x3eb87e=_[_0x1556('0x2b')]({},_0x3eb87e,_0x501860[_0x1556('0x33')]);return db[_0x1556('0x18')][_0x1556('0x34')](_0x3eb87e)[_0x1556('0xf')](handleEntityNotFound(_0x35f319,null))[_0x1556('0xf')](respondWithResult(_0x35f319,null))['catch'](handleError(_0x35f319,null));};exports[_0x1556('0x35')]=function(_0x248bdf,_0x1f93f6){return db[_0x1556('0x18')][_0x1556('0x35')](_0x248bdf[_0x1556('0x36')],{})[_0x1556('0xf')](respondWithResult(_0x1f93f6,0xc9))[_0x1556('0x2f')](handleError(_0x1f93f6,null));};exports[_0x1556('0xe')]=function(_0xec469a,_0x82e7c){if(_0xec469a[_0x1556('0x36')]['id']){delete _0xec469a[_0x1556('0x36')]['id'];}return db[_0x1556('0x18')][_0x1556('0x34')]({'where':{'id':_0xec469a[_0x1556('0x31')]['id']}})[_0x1556('0xf')](handleEntityNotFound(_0x82e7c,null))[_0x1556('0xf')](saveUpdates(_0xec469a[_0x1556('0x36')],null))['then'](respondWithResult(_0x82e7c,null))['catch'](handleError(_0x82e7c,null));};exports[_0x1556('0x10')]=function(_0x54d25f,_0x5c60d5){return db['Dynamics365Account']['find']({'where':{'id':_0x54d25f['params']['id']}})['then'](handleEntityNotFound(_0x5c60d5,null))[_0x1556('0xf')](removeEntity(_0x5c60d5,null))['catch'](handleError(_0x5c60d5,null));};exports[_0x1556('0x37')]=function(_0x370def,_0x43c2d9){var _0x42e9b1={};var _0x4626d4={};var _0x39e75a;var _0x3201f8;return db[_0x1556('0x18')][_0x1556('0x38')]({'where':{'id':_0x370def[_0x1556('0x31')]['id']}})[_0x1556('0xf')](handleEntityNotFound(_0x43c2d9,null))[_0x1556('0xf')](function(_0x5954c9){if(_0x5954c9){_0x39e75a=_0x5954c9;_0x4626d4['model']=_[_0x1556('0x1f')](db[_0x1556('0x39')][_0x1556('0x19')]);_0x4626d4[_0x1556('0x1e')]=_[_0x1556('0x1f')](_0x370def[_0x1556('0x1e')]);_0x4626d4['filters']=_[_0x1556('0x21')](_0x4626d4[_0x1556('0x1d')],_0x4626d4['query']);_0x42e9b1['attributes']=_[_0x1556('0x21')](_0x4626d4[_0x1556('0x1d')],qs[_0x1556('0x23')](_0x370def[_0x1556('0x1e')][_0x1556('0x23')]));_0x42e9b1[_0x1556('0x22')]=_0x42e9b1[_0x1556('0x22')][_0x1556('0x24')]?_0x42e9b1[_0x1556('0x22')]:_0x4626d4[_0x1556('0x1d')];_0x42e9b1[_0x1556('0x26')]=qs[_0x1556('0x27')](_0x370def[_0x1556('0x1e')][_0x1556('0x27')]);_0x42e9b1[_0x1556('0x28')]=qs[_0x1556('0x20')](_[_0x1556('0x29')](_0x370def[_0x1556('0x1e')],_0x4626d4[_0x1556('0x20')]));if(_0x370def[_0x1556('0x1e')]['filter']){_0x42e9b1['where']=_['merge'](_0x42e9b1['where'],{'$or':_['map'](_0x42e9b1[_0x1556('0x22')],function(_0x11f51d){var _0x37663b={};_0x37663b[_0x11f51d]={'$like':'%'+_0x370def[_0x1556('0x1e')]['filter']+'%'};return _0x37663b;})});}_0x42e9b1=_['merge']({},_0x42e9b1,_0x370def[_0x1556('0x33')]);return _0x39e75a[_0x1556('0x37')](_0x42e9b1);}})[_0x1556('0xf')](function(_0x59fd64){if(_0x59fd64){_0x3201f8=_0x59fd64['length'];if(!_0x370def['query'][_0x1556('0x3a')](_0x1556('0x25'))){_0x42e9b1[_0x1556('0xa')]=qs[_0x1556('0xa')](_0x370def['query'][_0x1556('0xa')]);_0x42e9b1[_0x1556('0x9')]=qs[_0x1556('0x9')](_0x370def[_0x1556('0x1e')]['offset']);}return _0x39e75a['getConfigurations'](_0x42e9b1);}})['then'](function(_0x40f090){if(_0x40f090){return _0x40f090?{'count':_0x3201f8,'rows':_0x40f090}:null;}})['then'](respondWithResult(_0x43c2d9,null))[_0x1556('0x2f')](handleError(_0x43c2d9,null));};exports['addConfiguration']=function(_0x1b9dcd,_0x42012b){if(_0x1b9dcd[_0x1556('0x36')]['id']){delete _0x1b9dcd[_0x1556('0x36')]['id'];}return db[_0x1556('0x18')][_0x1556('0x38')]({'where':{'id':_0x1b9dcd[_0x1556('0x31')]['id']}})['then'](handleEntityNotFound(_0x42012b,null))[_0x1556('0xf')](function(_0x5d4cbe){if(_0x5d4cbe){_0x1b9dcd[_0x1556('0x36')][_0x1556('0x3b')]=_0x5d4cbe['id'];_0x1b9dcd[_0x1556('0x36')]['Subjects']=integrations['getSubjects'](_0x1b9dcd[_0x1556('0x36')]['channel'],_0x1b9dcd[_0x1556('0x36')][_0x1556('0x1b')]);_0x1b9dcd[_0x1556('0x36')][_0x1556('0x3c')]=integrations[_0x1556('0x3d')](_0x1b9dcd[_0x1556('0x36')][_0x1556('0x3e')],_0x1b9dcd[_0x1556('0x36')]['type']);return db[_0x1556('0x39')][_0x1556('0x35')](_0x1b9dcd['body'],{'include':[{'model':db[_0x1556('0x3f')],'as':_0x1556('0x40')},{'model':db[_0x1556('0x3f')],'as':_0x1556('0x3c')}]});}return null;})['then'](respondWithResult(_0x42012b,null))[_0x1556('0x2f')](handleError(_0x42012b,null));};function sanitizeRemoteUri(_0x22b6ec){var _0x419a98=_0x22b6ec['slice'](-0x1);if(_0x419a98==='/')return _0x22b6ec['substring'](0x0,_0x22b6ec[_0x1556('0x41')](_0x419a98));return _0x22b6ec;}function getWebApiUrl(_0x553631){return util['format'](_0x1556('0x42'),_0x553631);}exports[_0x1556('0x43')]=function(_0x110f6c,_0x35139d){var _0x3dbd84=_0x110f6c[_0x1556('0x1e')][_0x1556('0x44')];var _0x1c8013=_0x3dbd84===_0x1556('0x45')?_0x1556('0x46'):'PhoneCall';var _0x24cdc5='';var _0x2c90ea='';var _0x514787='';var _0x310910='';var _0x137418='';var _0x24c515='';var _0x322337='';var _0x1f8538='';var _0xd35397=[_0x1556('0x47'),_0x1556('0x48'),'customerid','ownerid',_0x1556('0x49'),_0x1556('0x4a'),_0x1556('0x4b'),_0x1556('0x4c'),_0x1556('0x4d'),_0x1556('0x4e')];var _0x48be73=[_0x1556('0x4f'),'accountidyominame',_0x1556('0x50'),_0x1556('0x51'),_0x1556('0x52'),_0x1556('0x53'),_0x1556('0x54'),_0x1556('0x55'),_0x1556('0x56'),'createdbyexternalpartyyominame','createdbyname',_0x1556('0x57'),'createdon',_0x1556('0x58'),'createdonbehalfbyyominame',_0x1556('0x59'),_0x1556('0x5a'),_0x1556('0x5b'),_0x1556('0x5c'),_0x1556('0x5d'),_0x1556('0x5e'),_0x1556('0x5f'),_0x1556('0x60'),_0x1556('0x61'),_0x1556('0x62'),'followupby',_0x1556('0x63'),_0x1556('0x64'),_0x1556('0x65'),_0x1556('0x66'),'masteridname','modifiedbyexternalpartyname',_0x1556('0x67'),_0x1556('0x68'),_0x1556('0x69'),_0x1556('0x6a'),_0x1556('0x6b'),_0x1556('0x6c'),'msdyn_incidenttypename',_0x1556('0x6d'),_0x1556('0x6e'),_0x1556('0x6f'),'overriddencreatedon',_0x1556('0x70'),_0x1556('0x71'),_0x1556('0x72'),_0x1556('0x73'),_0x1556('0x74'),'primarycontactidyominame',_0x1556('0x75'),'productidname','productserialnumber','resolveby',_0x1556('0x76'),'responseby','responsiblecontactidname',_0x1556('0x77'),'sentimentvalue','slainvokedidname',_0x1556('0x78'),'socialprofileidname',_0x1556('0x79'),_0x1556('0x7a'),'subjectidname',_0x1556('0x7b'),_0x1556('0x7c'),'transactioncurrencyidname','traversedpath',_0x1556('0x7d'),_0x1556('0x7e')];var _0x504abc=_0xd35397['concat'](_0x48be73);return db[_0x1556('0x18')]['findOne']({'where':{'id':_0x110f6c[_0x1556('0x31')]['id']},'attributes':['id',_0x1556('0x7f'),_0x1556('0x80'),_0x1556('0x81'),'tenantId','clientId',_0x1556('0x82'),'modernAuthentication'],'include':[{'model':db[_0x1556('0x83')],'as':'CloudProvider','attributes':['id','data5',_0x1556('0x84')]}]})[_0x1556('0xf')](handleEntityNotFound(_0x35139d,null))[_0x1556('0xf')](function(_0x170130){if(_0x170130){if(_0x170130[_0x1556('0x85')]){_0x170130[_0x1556('0x86')]=_0x170130[_0x1556('0x83')][_0x1556('0x87')];_0x1f8538=sanitizeRemoteUri(_0x170130['CloudProvider'][_0x1556('0x84')]);_0x322337=getWebApiUrl(_0x1f8538);return _0x170130;}_0x1f8538=sanitizeRemoteUri(_0x170130[_0x1556('0x81')]);_0x322337=getWebApiUrl(_0x1f8538);var _0x15407e={'method':_0x1556('0x88'),'uri':'https://login.microsoftonline.com/'+_0x170130[_0x1556('0x89')]+_0x1556('0x8a'),'form':{'client_id':_0x170130[_0x1556('0x8b')],'resource':_0x1f8538,'username':_0x170130['username'],'password':_0x170130[_0x1556('0x80')],'grant_type':_0x1556('0x80'),'client_secret':_0x170130['clientSecret']},'json':!![]};return rp(_0x15407e);}})[_0x1556('0xf')](function(_0x126ada){_0x24c515=_0x126ada[_0x1556('0x86')];var _0x3cd7b5={'method':_0x1556('0x8c'),'uri':encodeURI(_0x322337+_0x1556('0x8d')+_0x1c8013+'\x27'),'headers':{'Authorization':_0x1556('0x8e')+_0x24c515,'If-None-Match':null,'OData-Version':_0x1556('0x8f')},'json':!![]};return rp(_0x3cd7b5);})['then'](function(_0x517e8e){var _0x29553e=_0x517e8e[_0x1556('0x90')][0x0];var _0x34b9e7=_0x29553e['MetadataId'];var _0x5f36b4={'method':'GET','uri':_0x322337+'EntityDefinitions('+_0x34b9e7+_0x1556('0x91'),'headers':{'Authorization':_0x1556('0x8e')+_0x24c515,'If-None-Match':null,'OData-Version':_0x1556('0x8f')},'json':!![]};return rp(_0x5f36b4);})['then'](function(_0x45ebeb){_0x24cdc5=_0x45ebeb;_0x2c90ea=_0x24cdc5['Attributes'];_0x2c90ea=_['remove'](_0x2c90ea,function(_0x24a459){return!_0x504abc[_0x1556('0x92')](_0x24a459[_0x1556('0x93')]);});var _0x398bcb=[];var _0x9920f5=[];_0x2c90ea[_0x1556('0x94')](function(_0x1ae7a2){if(_0x1ae7a2[_0x1556('0x95')]){var _0x593f03=_0x1ae7a2[_0x1556('0x95')][_0x1556('0x96')](_0x1ae7a2[_0x1556('0x95')]['lastIndexOf']('.')+0x1);if(_0x593f03===_0x1556('0x97')){_0x398bcb[_0x1556('0x98')](getSelectList(_0x322337,_0x3dbd84,_0x9920f5,_0x24cdc5[_0x1556('0x99')],_0x1ae7a2['MetadataId'],_0x24c515));}}});return Promise[_0x1556('0x9a')](_0x398bcb);})[_0x1556('0xf')](function(_0xa1000d){_0x514787=_0xa1000d[0x0];var _0x3799ab=[];var _0x2bc0a2=[];_0x2c90ea[_0x1556('0x94')](function(_0xd4b02f){if(!_[_0x1556('0x9b')](_0xd4b02f['@odata.type'])){var _0x5f2314=_0xd4b02f[_0x1556('0x95')][_0x1556('0x96')](_0xd4b02f['@odata.type'][_0x1556('0x41')]('.')+0x1);if(_0x5f2314==='BooleanAttributeMetadata'){_0x3799ab['push'](getBooleanList(_0x322337,_0x3dbd84,_0x2bc0a2,_0x24cdc5[_0x1556('0x99')],_0xd4b02f[_0x1556('0x99')],_0x24c515));}}});return Promise['all'](_0x3799ab);})[_0x1556('0xf')](function(_0x554484){_0x310910=_0x554484[0x0];var _0x5ca86a=[];var _0x3b5cdd=[];_0x2c90ea[_0x1556('0x94')](function(_0x4bccd7){if(_0x4bccd7[_0x1556('0x95')]){var _0x44fac5=_0x4bccd7['@odata.type']['substring'](_0x4bccd7[_0x1556('0x95')]['lastIndexOf']('.')+0x1);if(_0x44fac5===_0x1556('0x9c')||_0x44fac5===_0x1556('0x9d')||_0x44fac5==='BigIntAttributeMetadata'||_0x44fac5===_0x1556('0x9e')||_0x44fac5===_0x1556('0x9f')||_0x44fac5==='DateTimeAttributeMetadata'||_0x44fac5===_0x1556('0xa0')||_0x44fac5===_0x1556('0xa1')||_0x44fac5==='StateAttributeMetadata'||_0x44fac5===_0x1556('0xa2')){_0x5ca86a[_0x1556('0x98')](getInputList(_0x322337,_0x3dbd84,_0x44fac5,_0x3b5cdd,_0x24cdc5[_0x1556('0x99')],_0x4bccd7['MetadataId'],_0x24c515));}}});return Promise[_0x1556('0x9a')](_0x5ca86a);})[_0x1556('0xf')](function(_0x139386){_0x137418=_0x139386[0x0];var _0x4ddaca=_0x514787[_0x1556('0xa3')](_0x310910)['concat'](_0x137418);var _0x255b30={'count':_0x4ddaca[_0x1556('0x24')],'rows':_0x4ddaca};return _0x255b30;})[_0x1556('0xf')](respondWithResult(_0x35139d,null))[_0x1556('0x2f')](function(_0xcef32c){var _0x3a152e=_0x110f6c[_0x1556('0x1e')]['test']?0x1f4:_0xcef32c['statusCode']||0x1f4;logger[_0x1556('0x14')](_0xcef32c['stack']);delete _0xcef32c[_0x1556('0x15')];if(_0x3a152e===0x191){_0x3a152e=0x190;}_0x35139d['status'](_0x3a152e)[_0x1556('0xa4')](_0x110f6c[_0x1556('0x1e')][_0x1556('0xa5')]?{'message':_0x1556('0xa6'),'statusCode':_0xcef32c[_0x1556('0xa7')]}:_0xcef32c);});};function getSelectList(_0x52f111,_0x492c75,_0x269d22,_0x21af51,_0x4a774f,_0xc383f2){var _0x1890eb={'method':_0x1556('0x8c'),'uri':_0x52f111+_0x1556('0xa8')+_0x21af51+_0x1556('0xa9')+_0x4a774f+_0x1556('0xaa')+_0x1556('0xab'),'headers':{'Authorization':'Bearer\x20'+_0xc383f2,'If-None-Match':null,'OData-Version':_0x1556('0x8f')},'json':!![]};return rp(_0x1890eb)[_0x1556('0xf')](function(_0x4bf954){var _0x2cbfd0=[];var _0x2955c7=_0x4bf954[_0x1556('0xac')][_0x1556('0xad')];_0x2955c7['forEach'](function(_0x42b28b){_0x2cbfd0[_0x1556('0x98')]({'name':_0x42b28b[_0x1556('0xae')][_0x1556('0xaf')][_0x1556('0xae')],'value':String(_0x42b28b['Value'])});});var _0x5b2d6e={'id':_0x492c75+'_'+_0x4bf954[_0x1556('0x93')],'name':_0x4bf954[_0x1556('0xb0')][_0x1556('0xaf')][_0x1556('0xae')],'custom':![],'options':_0x2cbfd0};_0x269d22[_0x1556('0x98')](_0x5b2d6e);return _0x269d22;});}function getBooleanList(_0x37693f,_0x1a6750,_0x14f42e,_0x5a7f84,_0x578193,_0x4a6d47){var _0x5a7b51={'method':_0x1556('0x8c'),'uri':_0x37693f+_0x1556('0xa8')+_0x5a7f84+')/Attributes('+_0x578193+_0x1556('0xb1'),'headers':{'Authorization':_0x1556('0x8e')+_0x4a6d47,'If-None-Match':null,'OData-Version':_0x1556('0x8f')},'json':!![]};return rp(_0x5a7b51)[_0x1556('0xf')](function(_0x41e672){var _0x1ce1ef=[];_0x1ce1ef[_0x1556('0x98')]({'name':_0x41e672[_0x1556('0xac')][_0x1556('0xb2')][_0x1556('0xae')][_0x1556('0xaf')]['Label'],'value':'true'},{'name':_0x41e672[_0x1556('0xac')][_0x1556('0xb3')][_0x1556('0xae')][_0x1556('0xaf')][_0x1556('0xae')],'value':'false'});var _0x2c5d4b={'id':_0x1a6750+'_'+_0x41e672[_0x1556('0x93')],'name':_0x41e672[_0x1556('0xb0')][_0x1556('0xaf')][_0x1556('0xae')],'custom':![],'options':_0x1ce1ef};_0x14f42e[_0x1556('0x98')](_0x2c5d4b);return _0x14f42e;});}function getInputList(_0x393c2e,_0x59ae4c,_0x31743f,_0xc979bc,_0x5c3fa3,_0x46f602,_0x124c5d){var _0x2ac857={'method':_0x1556('0x8c'),'uri':_0x393c2e+'EntityDefinitions('+_0x5c3fa3+')/Attributes('+_0x46f602+_0x1556('0xb4')+_0x31743f+_0x1556('0xb5'),'headers':{'Authorization':_0x1556('0x8e')+_0x124c5d,'If-None-Match':null,'OData-Version':_0x1556('0x8f')},'json':!![]};return rp(_0x2ac857)[_0x1556('0xf')](function(_0x23a5d9){var _0x463295={'id':_0x59ae4c+'_'+_0x23a5d9['LogicalName'],'name':_0x23a5d9[_0x1556('0xb0')]['UserLocalizedLabel']?_0x23a5d9[_0x1556('0xb0')]['UserLocalizedLabel'][_0x1556('0xae')]:_0x23a5d9['LogicalName'],'custom':![],'options':[]};_0xc979bc[_0x1556('0x98')](_0x463295);return _0xc979bc;});} \ No newline at end of file +var _0x3a87=['ticketType','Incident','PhoneCall','title','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','responseby','sentimentvalue','slainvokedidname','slaname','statecode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','clientId','clientSecret','CloudProvider','data7','access_token','data5','POST','https://login.microsoftonline.com/','tenantId','/oauth2/token','username','password','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(','Attributes','remove','includes','LogicalName','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','all','forEach','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','statusCode','test','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','Label','UserLocalizedLabel',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','DisplayName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','status','offset','limit','undefined','count','set','Content-Range','json','then','end','error','stack','name','send','map','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','VIRTUAL','filter','merge','where','includeAll','include','Dynamics365Account','findAll','catch','show','rawAttributes','options','find','create','body','update','params','destroy','findOne','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','Dynamics365Field','slice','substring','format','getFields'];(function(_0x3d9343,_0x3802c5){var _0x7f93df=function(_0x46e6b9){while(--_0x46e6b9){_0x3d9343['push'](_0x3d9343['shift']());}};_0x7f93df(++_0x3802c5);}(_0x3a87,0x1f2));var _0x73a8=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0x3a87[_0x3ce2c4];return _0x4047c1;};'use strict';var rp=require(_0x73a8('0x0'));var util=require(_0x73a8('0x1'));var _=require(_0x73a8('0x2'));var qs=require(_0x73a8('0x3'));var logger=require(_0x73a8('0x4'))(_0x73a8('0x5'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x217296,_0x5cf5db){_0x5cf5db=_0x5cf5db||0xc8;return function(_0x37093a){if(_0x37093a){return _0x217296[_0x73a8('0x6')](_0x5cf5db)['json'](_0x37093a);}};}function respondWithFilteredResult(_0x4e03a0,_0x386523){return function(_0xf4166c){if(_0xf4166c){var _0x412c20=typeof _0x386523[_0x73a8('0x7')]==='undefined'&&typeof _0x386523[_0x73a8('0x8')]===_0x73a8('0x9');var _0x20afe1=_0xf4166c['count'];var _0x1a1338=_0x412c20?0x0:_0x386523[_0x73a8('0x7')];var _0x5cd3c5=_0x412c20?_0xf4166c[_0x73a8('0xa')]:_0x386523[_0x73a8('0x7')]+_0x386523['limit'];var _0x2a4fe9;if(_0x5cd3c5>=_0x20afe1){_0x5cd3c5=_0x20afe1;_0x2a4fe9=0xc8;}else{_0x2a4fe9=0xce;}_0x4e03a0['status'](_0x2a4fe9);return _0x4e03a0[_0x73a8('0xb')](_0x73a8('0xc'),_0x1a1338+'-'+_0x5cd3c5+'/'+_0x20afe1)[_0x73a8('0xd')](_0xf4166c);}return null;};}function saveUpdates(_0x3eaf4e){return function(_0x4e8ce3){if(_0x4e8ce3){return _0x4e8ce3['update'](_0x3eaf4e)[_0x73a8('0xe')](function(_0x24b995){return _0x24b995;});}return null;};}function removeEntity(_0x30df81){return function(_0x2e8e66){if(_0x2e8e66){return _0x2e8e66['destroy']()[_0x73a8('0xe')](function(){_0x30df81[_0x73a8('0x6')](0xcc)[_0x73a8('0xf')]();});}};}function handleEntityNotFound(_0x43930b){return function(_0x3d6ebc){if(!_0x3d6ebc){_0x43930b['sendStatus'](0x194);}return _0x3d6ebc;};}function handleError(_0x51baba,_0x3a5515){_0x3a5515=_0x3a5515||0x1f4;return function(_0xa7e401){logger[_0x73a8('0x10')](_0xa7e401[_0x73a8('0x11')]);if(_0xa7e401['name']){delete _0xa7e401[_0x73a8('0x12')];}_0x51baba[_0x73a8('0x6')](_0x3a5515)[_0x73a8('0x13')](_0xa7e401);};}exports['index']=function(_0x3056b4,_0x9caf4c){var _0xe4f2aa={},_0x31aa27={},_0x164076={'count':0x0,'rows':[]};var _0x17f724=_[_0x73a8('0x14')](db['Dynamics365Account']['rawAttributes'],function(_0x94ca9a){return{'name':_0x94ca9a['fieldName'],'type':_0x94ca9a[_0x73a8('0x15')]['key']};});_0x31aa27[_0x73a8('0x16')]=_[_0x73a8('0x14')](_0x17f724,'name');_0x31aa27[_0x73a8('0x17')]=_[_0x73a8('0x18')](_0x3056b4[_0x73a8('0x17')]);_0x31aa27[_0x73a8('0x19')]=_['intersection'](_0x31aa27[_0x73a8('0x16')],_0x31aa27[_0x73a8('0x17')]);_0xe4f2aa['attributes']=_[_0x73a8('0x1a')](_0x31aa27[_0x73a8('0x16')],qs[_0x73a8('0x1b')](_0x3056b4[_0x73a8('0x17')][_0x73a8('0x1b')]));_0xe4f2aa[_0x73a8('0x1c')]=_0xe4f2aa[_0x73a8('0x1c')][_0x73a8('0x1d')]?_0xe4f2aa['attributes']:_0x31aa27[_0x73a8('0x16')];if(!_0x3056b4[_0x73a8('0x17')][_0x73a8('0x1e')](_0x73a8('0x1f'))){_0xe4f2aa[_0x73a8('0x8')]=qs[_0x73a8('0x8')](_0x3056b4[_0x73a8('0x17')]['limit']);_0xe4f2aa[_0x73a8('0x7')]=qs[_0x73a8('0x7')](_0x3056b4[_0x73a8('0x17')][_0x73a8('0x7')]);}_0xe4f2aa[_0x73a8('0x20')]=qs['sort'](_0x3056b4[_0x73a8('0x17')][_0x73a8('0x21')]);_0xe4f2aa['where']=qs[_0x73a8('0x19')](_[_0x73a8('0x22')](_0x3056b4[_0x73a8('0x17')],_0x31aa27[_0x73a8('0x19')]),_0x17f724);if(_0x3056b4[_0x73a8('0x17')]['filter']){_0xe4f2aa['where']=_['merge'](_0xe4f2aa['where'],{'$or':_[_0x73a8('0x14')](_0x17f724,function(_0x29ab05){if(_0x29ab05[_0x73a8('0x15')]!==_0x73a8('0x23')){var _0x384e81={};_0x384e81[_0x29ab05[_0x73a8('0x12')]]={'$like':'%'+_0x3056b4[_0x73a8('0x17')][_0x73a8('0x24')]+'%'};return _0x384e81;}})});}_0xe4f2aa=_[_0x73a8('0x25')]({},_0xe4f2aa,_0x3056b4['options']);var _0x3ba41d={'where':_0xe4f2aa[_0x73a8('0x26')]};return db['Dynamics365Account'][_0x73a8('0xa')](_0x3ba41d)[_0x73a8('0xe')](function(_0x561106){_0x164076[_0x73a8('0xa')]=_0x561106;if(_0x3056b4[_0x73a8('0x17')][_0x73a8('0x27')]){_0xe4f2aa[_0x73a8('0x28')]=[{'all':!![]}];}return db[_0x73a8('0x29')][_0x73a8('0x2a')](_0xe4f2aa);})[_0x73a8('0xe')](function(_0x4feb70){_0x164076['rows']=_0x4feb70;return _0x164076;})['then'](respondWithFilteredResult(_0x9caf4c,_0xe4f2aa))[_0x73a8('0x2b')](handleError(_0x9caf4c,null));};exports[_0x73a8('0x2c')]=function(_0x555e57,_0x3506b4){var _0x119bdb={'raw':![],'where':{'id':_0x555e57['params']['id']}},_0x44bda7={};_0x44bda7[_0x73a8('0x16')]=_[_0x73a8('0x18')](db[_0x73a8('0x29')][_0x73a8('0x2d')]);_0x44bda7[_0x73a8('0x17')]=_[_0x73a8('0x18')](_0x555e57[_0x73a8('0x17')]);_0x44bda7[_0x73a8('0x19')]=_[_0x73a8('0x1a')](_0x44bda7[_0x73a8('0x16')],_0x44bda7['query']);_0x119bdb['attributes']=_[_0x73a8('0x1a')](_0x44bda7[_0x73a8('0x16')],qs['fields'](_0x555e57[_0x73a8('0x17')][_0x73a8('0x1b')]));_0x119bdb['attributes']=_0x119bdb[_0x73a8('0x1c')][_0x73a8('0x1d')]?_0x119bdb[_0x73a8('0x1c')]:_0x44bda7[_0x73a8('0x16')];if(_0x555e57[_0x73a8('0x17')][_0x73a8('0x27')]){_0x119bdb['include']=[{'all':!![]}];}_0x119bdb=_[_0x73a8('0x25')]({},_0x119bdb,_0x555e57[_0x73a8('0x2e')]);return db[_0x73a8('0x29')][_0x73a8('0x2f')](_0x119bdb)[_0x73a8('0xe')](handleEntityNotFound(_0x3506b4,null))[_0x73a8('0xe')](respondWithResult(_0x3506b4,null))['catch'](handleError(_0x3506b4,null));};exports['create']=function(_0x149c95,_0x47c7d6){return db[_0x73a8('0x29')][_0x73a8('0x30')](_0x149c95[_0x73a8('0x31')],{})[_0x73a8('0xe')](respondWithResult(_0x47c7d6,0xc9))[_0x73a8('0x2b')](handleError(_0x47c7d6,null));};exports[_0x73a8('0x32')]=function(_0x4fbbd8,_0x2bd09a){if(_0x4fbbd8[_0x73a8('0x31')]['id']){delete _0x4fbbd8[_0x73a8('0x31')]['id'];}return db['Dynamics365Account'][_0x73a8('0x2f')]({'where':{'id':_0x4fbbd8[_0x73a8('0x33')]['id']}})[_0x73a8('0xe')](handleEntityNotFound(_0x2bd09a,null))[_0x73a8('0xe')](saveUpdates(_0x4fbbd8[_0x73a8('0x31')],null))[_0x73a8('0xe')](respondWithResult(_0x2bd09a,null))[_0x73a8('0x2b')](handleError(_0x2bd09a,null));};exports[_0x73a8('0x34')]=function(_0x554de1,_0x3d5ec8){return db['Dynamics365Account']['find']({'where':{'id':_0x554de1[_0x73a8('0x33')]['id']}})[_0x73a8('0xe')](handleEntityNotFound(_0x3d5ec8,null))[_0x73a8('0xe')](removeEntity(_0x3d5ec8,null))['catch'](handleError(_0x3d5ec8,null));};exports['getConfigurations']=function(_0x2b0495,_0x4e338e){var _0x40fb57={};var _0x5809eb={};var _0x529aa0;var _0x321dc5;return db[_0x73a8('0x29')][_0x73a8('0x35')]({'where':{'id':_0x2b0495[_0x73a8('0x33')]['id']}})[_0x73a8('0xe')](handleEntityNotFound(_0x4e338e,null))[_0x73a8('0xe')](function(_0x31ca69){if(_0x31ca69){_0x529aa0=_0x31ca69;_0x5809eb['model']=_['keys'](db['Dynamics365Configuration']['rawAttributes']);_0x5809eb[_0x73a8('0x17')]=_[_0x73a8('0x18')](_0x2b0495[_0x73a8('0x17')]);_0x5809eb['filters']=_[_0x73a8('0x1a')](_0x5809eb[_0x73a8('0x16')],_0x5809eb[_0x73a8('0x17')]);_0x40fb57[_0x73a8('0x1c')]=_[_0x73a8('0x1a')](_0x5809eb[_0x73a8('0x16')],qs[_0x73a8('0x1b')](_0x2b0495['query'][_0x73a8('0x1b')]));_0x40fb57[_0x73a8('0x1c')]=_0x40fb57[_0x73a8('0x1c')][_0x73a8('0x1d')]?_0x40fb57[_0x73a8('0x1c')]:_0x5809eb[_0x73a8('0x16')];_0x40fb57[_0x73a8('0x20')]=qs[_0x73a8('0x21')](_0x2b0495[_0x73a8('0x17')]['sort']);_0x40fb57[_0x73a8('0x26')]=qs[_0x73a8('0x19')](_[_0x73a8('0x22')](_0x2b0495[_0x73a8('0x17')],_0x5809eb[_0x73a8('0x19')]));if(_0x2b0495['query'][_0x73a8('0x24')]){_0x40fb57[_0x73a8('0x26')]=_[_0x73a8('0x25')](_0x40fb57[_0x73a8('0x26')],{'$or':_[_0x73a8('0x14')](_0x40fb57['attributes'],function(_0x1a5797){var _0x1658a5={};_0x1658a5[_0x1a5797]={'$like':'%'+_0x2b0495[_0x73a8('0x17')]['filter']+'%'};return _0x1658a5;})});}_0x40fb57=_[_0x73a8('0x25')]({},_0x40fb57,_0x2b0495[_0x73a8('0x2e')]);return _0x529aa0[_0x73a8('0x36')](_0x40fb57);}})[_0x73a8('0xe')](function(_0x15b9b6){if(_0x15b9b6){_0x321dc5=_0x15b9b6[_0x73a8('0x1d')];if(!_0x2b0495[_0x73a8('0x17')][_0x73a8('0x1e')]('nolimit')){_0x40fb57[_0x73a8('0x8')]=qs[_0x73a8('0x8')](_0x2b0495[_0x73a8('0x17')][_0x73a8('0x8')]);_0x40fb57['offset']=qs[_0x73a8('0x7')](_0x2b0495['query'][_0x73a8('0x7')]);}return _0x529aa0[_0x73a8('0x36')](_0x40fb57);}})[_0x73a8('0xe')](function(_0x3f2b79){if(_0x3f2b79){return _0x3f2b79?{'count':_0x321dc5,'rows':_0x3f2b79}:null;}})[_0x73a8('0xe')](respondWithResult(_0x4e338e,null))[_0x73a8('0x2b')](handleError(_0x4e338e,null));};exports[_0x73a8('0x37')]=function(_0x714e18,_0x5a9ffe){if(_0x714e18[_0x73a8('0x31')]['id']){delete _0x714e18[_0x73a8('0x31')]['id'];}return db[_0x73a8('0x29')][_0x73a8('0x35')]({'where':{'id':_0x714e18[_0x73a8('0x33')]['id']}})[_0x73a8('0xe')](handleEntityNotFound(_0x5a9ffe,null))[_0x73a8('0xe')](function(_0x20da79){if(_0x20da79){_0x714e18[_0x73a8('0x31')][_0x73a8('0x38')]=_0x20da79['id'];_0x714e18['body'][_0x73a8('0x39')]=integrations[_0x73a8('0x3a')](_0x714e18['body'][_0x73a8('0x3b')],_0x714e18['body']['type']);_0x714e18[_0x73a8('0x31')][_0x73a8('0x3c')]=integrations['getDescriptions'](_0x714e18[_0x73a8('0x31')][_0x73a8('0x3b')],_0x714e18[_0x73a8('0x31')]['type']);return db['Dynamics365Configuration'][_0x73a8('0x30')](_0x714e18['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0x73a8('0x39')},{'model':db[_0x73a8('0x3d')],'as':_0x73a8('0x3c')}]});}return null;})[_0x73a8('0xe')](respondWithResult(_0x5a9ffe,null))['catch'](handleError(_0x5a9ffe,null));};function sanitizeRemoteUri(_0x51ae5f){var _0x3b087d=_0x51ae5f[_0x73a8('0x3e')](-0x1);if(_0x3b087d==='/')return _0x51ae5f[_0x73a8('0x3f')](0x0,_0x51ae5f['lastIndexOf'](_0x3b087d));return _0x51ae5f;}function getWebApiUrl(_0x12210e){return util[_0x73a8('0x40')]('%s/api/data/v9.0/',_0x12210e);}exports[_0x73a8('0x41')]=function(_0x242a0d,_0x42cee5){var _0x1eb5ab=_0x242a0d[_0x73a8('0x17')][_0x73a8('0x42')];var _0x17ff1a=_0x1eb5ab==='incident'?_0x73a8('0x43'):_0x73a8('0x44');var _0x2965e1='';var _0x58e07e='';var _0x32ad4f='';var _0x1e0178='';var _0x2e83c5='';var _0x59208f='';var _0x3a4714='';var _0x4605e6='';var _0xeb59d=[_0x73a8('0x45'),'description',_0x73a8('0x46'),_0x73a8('0x47'),_0x73a8('0x48'),_0x73a8('0x49'),_0x73a8('0x4a'),_0x73a8('0x4b'),_0x73a8('0x4c'),_0x73a8('0x4d')];var _0x50c143=[_0x73a8('0x4e'),_0x73a8('0x4f'),_0x73a8('0x50'),_0x73a8('0x51'),_0x73a8('0x52'),_0x73a8('0x53'),_0x73a8('0x54'),_0x73a8('0x55'),_0x73a8('0x56'),_0x73a8('0x57'),'createdbyname',_0x73a8('0x58'),_0x73a8('0x59'),_0x73a8('0x5a'),_0x73a8('0x5b'),'customeridname',_0x73a8('0x5c'),_0x73a8('0x5d'),_0x73a8('0x5e'),_0x73a8('0x5f'),_0x73a8('0x60'),'entityimage_url','escalatedon',_0x73a8('0x61'),_0x73a8('0x62'),'followupby',_0x73a8('0x63'),_0x73a8('0x64'),_0x73a8('0x65'),_0x73a8('0x66'),_0x73a8('0x67'),_0x73a8('0x68'),_0x73a8('0x69'),'modifiedbyname',_0x73a8('0x6a'),_0x73a8('0x6b'),_0x73a8('0x6c'),_0x73a8('0x6d'),_0x73a8('0x6e'),'msdyn_iotalertname',_0x73a8('0x6f'),_0x73a8('0x70'),_0x73a8('0x71'),_0x73a8('0x72'),_0x73a8('0x73'),_0x73a8('0x74'),_0x73a8('0x75'),_0x73a8('0x76'),_0x73a8('0x77'),'prioritycodename',_0x73a8('0x78'),_0x73a8('0x79'),_0x73a8('0x7a'),'resolvebykpiidname',_0x73a8('0x7b'),'responsiblecontactidname','responsiblecontactidyominame',_0x73a8('0x7c'),_0x73a8('0x7d'),_0x73a8('0x7e'),'socialprofileidname',_0x73a8('0x7f'),'statuscode',_0x73a8('0x80'),_0x73a8('0x81'),'timezoneruleversionnumber',_0x73a8('0x82'),_0x73a8('0x83'),'utcconversiontimezonecode',_0x73a8('0x84')];var _0x14a6f3=_0xeb59d[_0x73a8('0x85')](_0x50c143);return db[_0x73a8('0x29')][_0x73a8('0x35')]({'where':{'id':_0x242a0d[_0x73a8('0x33')]['id']},'attributes':['id','username','password','remoteUri','tenantId',_0x73a8('0x86'),_0x73a8('0x87'),'modernAuthentication'],'include':[{'model':db[_0x73a8('0x88')],'as':_0x73a8('0x88'),'attributes':['id','data5',_0x73a8('0x89')]}]})[_0x73a8('0xe')](handleEntityNotFound(_0x42cee5,null))[_0x73a8('0xe')](function(_0x1d5d3e){if(_0x1d5d3e){if(_0x1d5d3e['modernAuthentication']){_0x1d5d3e[_0x73a8('0x8a')]=_0x1d5d3e['CloudProvider'][_0x73a8('0x8b')];_0x4605e6=sanitizeRemoteUri(_0x1d5d3e[_0x73a8('0x88')][_0x73a8('0x89')]);_0x3a4714=getWebApiUrl(_0x4605e6);return _0x1d5d3e;}_0x4605e6=sanitizeRemoteUri(_0x1d5d3e['remoteUri']);_0x3a4714=getWebApiUrl(_0x4605e6);var _0xa1bb24={'method':_0x73a8('0x8c'),'uri':_0x73a8('0x8d')+_0x1d5d3e[_0x73a8('0x8e')]+_0x73a8('0x8f'),'form':{'client_id':_0x1d5d3e[_0x73a8('0x86')],'resource':_0x4605e6,'username':_0x1d5d3e[_0x73a8('0x90')],'password':_0x1d5d3e[_0x73a8('0x91')],'grant_type':'password','client_secret':_0x1d5d3e[_0x73a8('0x87')]},'json':!![]};return rp(_0xa1bb24);}})[_0x73a8('0xe')](function(_0x2d2ca7){_0x59208f=_0x2d2ca7[_0x73a8('0x8a')];var _0x1d8d6f={'method':_0x73a8('0x92'),'uri':encodeURI(_0x3a4714+_0x73a8('0x93')+_0x17ff1a+'\x27'),'headers':{'Authorization':_0x73a8('0x94')+_0x59208f,'If-None-Match':null,'OData-Version':_0x73a8('0x95')},'json':!![]};return rp(_0x1d8d6f);})[_0x73a8('0xe')](function(_0x59738e){var _0xd077c8=_0x59738e[_0x73a8('0x96')][0x0];var _0x16604d=_0xd077c8[_0x73a8('0x97')];var _0x56b039={'method':_0x73a8('0x92'),'uri':_0x3a4714+_0x73a8('0x98')+_0x16604d+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x73a8('0x94')+_0x59208f,'If-None-Match':null,'OData-Version':_0x73a8('0x95')},'json':!![]};return rp(_0x56b039);})[_0x73a8('0xe')](function(_0x3fe221){_0x2965e1=_0x3fe221;_0x58e07e=_0x2965e1[_0x73a8('0x99')];_0x58e07e=_[_0x73a8('0x9a')](_0x58e07e,function(_0x1d200b){return!_0x14a6f3[_0x73a8('0x9b')](_0x1d200b[_0x73a8('0x9c')]);});var _0x54f0fd=[];var _0x4af5f4=[];_0x58e07e['forEach'](function(_0xbbcb6c){if(_0xbbcb6c[_0x73a8('0x9d')]){var _0x33b930=_0xbbcb6c[_0x73a8('0x9d')][_0x73a8('0x3f')](_0xbbcb6c[_0x73a8('0x9d')][_0x73a8('0x9e')]('.')+0x1);if(_0x33b930===_0x73a8('0x9f')){_0x54f0fd[_0x73a8('0xa0')](getSelectList(_0x3a4714,_0x1eb5ab,_0x4af5f4,_0x2965e1['MetadataId'],_0xbbcb6c[_0x73a8('0x97')],_0x59208f));}}});return Promise[_0x73a8('0xa1')](_0x54f0fd);})['then'](function(_0x24ad11){_0x32ad4f=_0x24ad11[0x0];var _0x11ab33=[];var _0x2cabb5=[];_0x58e07e[_0x73a8('0xa2')](function(_0x551d79){if(!_[_0x73a8('0xa3')](_0x551d79[_0x73a8('0x9d')])){var _0x5bf012=_0x551d79['@odata.type'][_0x73a8('0x3f')](_0x551d79['@odata.type'][_0x73a8('0x9e')]('.')+0x1);if(_0x5bf012===_0x73a8('0xa4')){_0x11ab33[_0x73a8('0xa0')](getBooleanList(_0x3a4714,_0x1eb5ab,_0x2cabb5,_0x2965e1['MetadataId'],_0x551d79[_0x73a8('0x97')],_0x59208f));}}});return Promise[_0x73a8('0xa1')](_0x11ab33);})['then'](function(_0x5642b5){_0x1e0178=_0x5642b5[0x0];var _0x2f76bd=[];var _0x4c8156=[];_0x58e07e[_0x73a8('0xa2')](function(_0x539ad7){if(_0x539ad7[_0x73a8('0x9d')]){var _0x202908=_0x539ad7[_0x73a8('0x9d')]['substring'](_0x539ad7[_0x73a8('0x9d')][_0x73a8('0x9e')]('.')+0x1);if(_0x202908===_0x73a8('0xa5')||_0x202908===_0x73a8('0xa6')||_0x202908==='BigIntAttributeMetadata'||_0x202908===_0x73a8('0xa7')||_0x202908==='MemoAttributeMetadata'||_0x202908===_0x73a8('0xa8')||_0x202908===_0x73a8('0xa9')||_0x202908===_0x73a8('0xaa')||_0x202908===_0x73a8('0xab')||_0x202908==='DecimalAttributeMetadata'){_0x2f76bd[_0x73a8('0xa0')](getInputList(_0x3a4714,_0x1eb5ab,_0x202908,_0x4c8156,_0x2965e1[_0x73a8('0x97')],_0x539ad7[_0x73a8('0x97')],_0x59208f));}}});return Promise[_0x73a8('0xa1')](_0x2f76bd);})[_0x73a8('0xe')](function(_0x596add){_0x2e83c5=_0x596add[0x0];var _0x15c0e8=_0x32ad4f[_0x73a8('0x85')](_0x1e0178)[_0x73a8('0x85')](_0x2e83c5);var _0x44f082={'count':_0x15c0e8[_0x73a8('0x1d')],'rows':_0x15c0e8};return _0x44f082;})[_0x73a8('0xe')](respondWithResult(_0x42cee5,null))[_0x73a8('0x2b')](function(_0x4101ca){var _0x14701e=_0x242a0d[_0x73a8('0x17')]['test']?0x1f4:_0x4101ca[_0x73a8('0xac')]||0x1f4;logger[_0x73a8('0x10')](_0x4101ca[_0x73a8('0x11')]);delete _0x4101ca[_0x73a8('0x12')];if(_0x14701e===0x191){_0x14701e=0x190;}_0x42cee5[_0x73a8('0x6')](_0x14701e)[_0x73a8('0x13')](_0x242a0d[_0x73a8('0x17')][_0x73a8('0xad')]?{'message':_0x73a8('0xae'),'statusCode':_0x4101ca[_0x73a8('0xac')]}:_0x4101ca);});};function getSelectList(_0x139b33,_0x47e1bd,_0x34a6c5,_0x553108,_0x4a1391,_0xcbd03b){var _0x24f730={'method':_0x73a8('0x92'),'uri':_0x139b33+'EntityDefinitions('+_0x553108+')/Attributes('+_0x4a1391+_0x73a8('0xaf')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x73a8('0x94')+_0xcbd03b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x24f730)[_0x73a8('0xe')](function(_0xd61c2a){var _0x21cd8f=[];var _0x1b4934=_0xd61c2a['OptionSet']['Options'];_0x1b4934[_0x73a8('0xa2')](function(_0x51d42d){_0x21cd8f['push']({'name':_0x51d42d[_0x73a8('0xb0')]['UserLocalizedLabel']['Label'],'value':String(_0x51d42d['Value'])});});var _0x112cb9={'id':_0x47e1bd+'_'+_0xd61c2a[_0x73a8('0x9c')],'name':_0xd61c2a['DisplayName'][_0x73a8('0xb1')][_0x73a8('0xb0')],'custom':![],'options':_0x21cd8f};_0x34a6c5[_0x73a8('0xa0')](_0x112cb9);return _0x34a6c5;});}function getBooleanList(_0x547034,_0x4d73d2,_0xf2ebab,_0x258c34,_0x4f08f7,_0x1b44e2){var _0x3def52={'method':_0x73a8('0x92'),'uri':_0x547034+'EntityDefinitions('+_0x258c34+_0x73a8('0xb2')+_0x4f08f7+_0x73a8('0xb3'),'headers':{'Authorization':_0x73a8('0x94')+_0x1b44e2,'If-None-Match':null,'OData-Version':_0x73a8('0x95')},'json':!![]};return rp(_0x3def52)[_0x73a8('0xe')](function(_0x288656){var _0x16cea6=[];_0x16cea6['push']({'name':_0x288656[_0x73a8('0xb4')][_0x73a8('0xb5')][_0x73a8('0xb0')][_0x73a8('0xb1')][_0x73a8('0xb0')],'value':_0x73a8('0xb6')},{'name':_0x288656[_0x73a8('0xb4')][_0x73a8('0xb7')]['Label'][_0x73a8('0xb1')][_0x73a8('0xb0')],'value':_0x73a8('0xb8')});var _0x2e72a6={'id':_0x4d73d2+'_'+_0x288656[_0x73a8('0x9c')],'name':_0x288656['DisplayName']['UserLocalizedLabel'][_0x73a8('0xb0')],'custom':![],'options':_0x16cea6};_0xf2ebab[_0x73a8('0xa0')](_0x2e72a6);return _0xf2ebab;});}function getInputList(_0x52012e,_0x205c60,_0x4c87d0,_0xcd77bc,_0x4a3079,_0x486f9d,_0x4599e7){var _0x2ff13e={'method':_0x73a8('0x92'),'uri':_0x52012e+_0x73a8('0x98')+_0x4a3079+')/Attributes('+_0x486f9d+_0x73a8('0xb9')+_0x4c87d0+_0x73a8('0xba'),'headers':{'Authorization':'Bearer\x20'+_0x4599e7,'If-None-Match':null,'OData-Version':_0x73a8('0x95')},'json':!![]};return rp(_0x2ff13e)['then'](function(_0xfaf3cf){var _0x367a4b={'id':_0x205c60+'_'+_0xfaf3cf[_0x73a8('0x9c')],'name':_0xfaf3cf[_0x73a8('0xbb')][_0x73a8('0xb1')]?_0xfaf3cf[_0x73a8('0xbb')]['UserLocalizedLabel'][_0x73a8('0xb0')]:_0xfaf3cf[_0x73a8('0x9c')],'custom':![],'options':[]};_0xcd77bc[_0x73a8('0xa0')](_0x367a4b);return _0xcd77bc;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 796d851..c2b1f7f 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 _0xa9e0=['define','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0xcc5977,_0x3fa6b){var _0x57c61d=function(_0x5a5185){while(--_0x5a5185){_0xcc5977['push'](_0xcc5977['shift']());}};_0x57c61d(++_0x3fa6b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));var integrations=require(_0x0a9e('0x8'));module['exports']=function(_0x219af0,_0x441e3a){return _0x219af0[_0x0a9e('0x9')]('Dynamics365Account',attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x41ef97,_0x701f4){var _0x131d25=function(_0x4cd731){while(--_0x4cd731){_0x41ef97['push'](_0x41ef97['shift']());}};_0x131d25(++_0x701f4);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 86dcb98..e9ed387 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 _0xfc0e=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','catch','find','then','ShowDynamics365Account','debug'];(function(_0x50b852,_0x3526c9){var _0x187c65=function(_0x251ed0){while(--_0x251ed0){_0x50b852['push'](_0x50b852['shift']());}};_0x187c65(++_0x3526c9);}(_0xfc0e,0x1d4));var _0xefc0=function(_0x1af05b,_0x5134b5){_0x1af05b=_0x1af05b-0x0;var _0x5be7cc=_0xfc0e[_0x1af05b];return _0x5be7cc;};'use strict';var _=require(_0xefc0('0x0'));var util=require(_0xefc0('0x1'));var moment=require('moment');var BPromise=require(_0xefc0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xefc0('0x3'));var db=require(_0xefc0('0x4'))['db'];var utils=require(_0xefc0('0x5'));var logger=require(_0xefc0('0x6'))(_0xefc0('0x7'));var config=require(_0xefc0('0x8'));var jayson=require(_0xefc0('0x9'));var client=jayson[_0xefc0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1eb62f,_0x3e094c,_0x2a93bf){return new BPromise(function(_0x147b7b,_0x55490a){return client['request'](_0x1eb62f,_0x2a93bf)['then'](function(_0x1e2bac){logger[_0xefc0('0xb')](_0xefc0('0xc'),_0x3e094c,_0xefc0('0xd'));logger['debug'](_0xefc0('0xe'),_0x3e094c,_0xefc0('0xd'),JSON[_0xefc0('0xf')](_0x1e2bac));if(_0x1e2bac[_0xefc0('0x10')]){if(_0x1e2bac[_0xefc0('0x10')][_0xefc0('0x11')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x3e094c,_0x1e2bac['error']['message']);return _0x55490a(_0x1e2bac[_0xefc0('0x10')][_0xefc0('0x12')]);}logger[_0xefc0('0x10')](_0xefc0('0xc'),_0x3e094c,_0x1e2bac[_0xefc0('0x10')][_0xefc0('0x12')]);return _0x147b7b(_0x1e2bac['error']['message']);}else{logger[_0xefc0('0xb')](_0xefc0('0xc'),_0x3e094c,_0xefc0('0xd'));_0x147b7b(_0x1e2bac[_0xefc0('0x13')][_0xefc0('0x12')]);}})['catch'](function(_0x400284){logger['error'](_0xefc0('0xc'),_0x3e094c,_0x400284);_0x55490a(_0x400284);});});}exports[_0xefc0('0x14')]=function(_0x2f9407){var _0x1fb069=this;return new Promise(function(_0x53d8de,_0xbbe648){return db[_0xefc0('0x15')][_0xefc0('0x16')]({'raw':_0x2f9407[_0xefc0('0x17')]?_0x2f9407[_0xefc0('0x17')][_0xefc0('0x18')]===undefined?!![]:![]:!![],'where':_0x2f9407['options']?_0x2f9407[_0xefc0('0x17')][_0xefc0('0x19')]||null:null,'attributes':_0x2f9407['options']?_0x2f9407[_0xefc0('0x17')][_0xefc0('0x1a')]||null:null,'limit':_0x2f9407[_0xefc0('0x17')]?_0x2f9407[_0xefc0('0x17')][_0xefc0('0x1b')]||null:null,'include':_0x2f9407[_0xefc0('0x17')]?_0x2f9407[_0xefc0('0x17')][_0xefc0('0x1c')]?_[_0xefc0('0x1d')](_0x2f9407[_0xefc0('0x17')]['include'],function(_0x4da9c3){return{'model':db[_0x4da9c3[_0xefc0('0x1e')]],'as':_0x4da9c3['as'],'attributes':_0x4da9c3[_0xefc0('0x1a')],'include':_0x4da9c3[_0xefc0('0x1c')]?_[_0xefc0('0x1d')](_0x4da9c3['include'],function(_0x40407f){return{'model':db[_0x40407f[_0xefc0('0x1e')]],'as':_0x40407f['as'],'attributes':_0x40407f[_0xefc0('0x1a')],'include':_0x40407f[_0xefc0('0x1c')]?_[_0xefc0('0x1d')](_0x40407f[_0xefc0('0x1c')],function(_0x37d47d){return{'model':db[_0x37d47d['model']],'as':_0x37d47d['as'],'attributes':_0x37d47d[_0xefc0('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x6605e2){logger['info'](_0xefc0('0x14'),_0x2f9407);logger['debug'](_0xefc0('0x14'),_0x2f9407,JSON[_0xefc0('0xf')](_0x6605e2));_0x53d8de(_0x6605e2);})[_0xefc0('0x1f')](function(_0x29ebf8){logger[_0xefc0('0x10')](_0xefc0('0x14'),_0x29ebf8['message'],_0x2f9407);_0xbbe648(_0x1fb069[_0xefc0('0x10')](0x1f4,_0x29ebf8[_0xefc0('0x12')]));});});};exports['ShowDynamics365Account']=function(_0x19f402){var _0x52bacd=this;return new Promise(function(_0x283f4d,_0x4e08f6){return db[_0xefc0('0x15')][_0xefc0('0x20')]({'raw':_0x19f402[_0xefc0('0x17')]?_0x19f402['options']['raw']===undefined?!![]:![]:!![],'where':_0x19f402[_0xefc0('0x17')]?_0x19f402['options']['where']||null:null,'attributes':_0x19f402[_0xefc0('0x17')]?_0x19f402[_0xefc0('0x17')]['attributes']||null:null,'include':_0x19f402[_0xefc0('0x17')]?_0x19f402['options'][_0xefc0('0x1c')]?_[_0xefc0('0x1d')](_0x19f402['options'][_0xefc0('0x1c')],function(_0xd01a5){return{'model':db[_0xd01a5[_0xefc0('0x1e')]],'as':_0xd01a5['as'],'attributes':_0xd01a5['attributes'],'include':_0xd01a5[_0xefc0('0x1c')]?_[_0xefc0('0x1d')](_0xd01a5[_0xefc0('0x1c')],function(_0x5bb012){return{'model':db[_0x5bb012[_0xefc0('0x1e')]],'as':_0x5bb012['as'],'attributes':_0x5bb012[_0xefc0('0x1a')],'include':_0x5bb012['include']?_[_0xefc0('0x1d')](_0x5bb012['include'],function(_0x2021de){return{'model':db[_0x2021de[_0xefc0('0x1e')]],'as':_0x2021de['as'],'attributes':_0x2021de[_0xefc0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xefc0('0x21')](function(_0x3207a2){logger[_0xefc0('0xb')](_0xefc0('0x22'),_0x19f402);logger[_0xefc0('0x23')](_0xefc0('0x22'),_0x19f402,JSON[_0xefc0('0xf')](_0x3207a2));_0x283f4d(_0x3207a2);})[_0xefc0('0x1f')](function(_0x3e84fc){logger[_0xefc0('0x10')](_0xefc0('0x22'),_0x3e84fc['message'],_0x19f402);_0x4e08f6(_0x52bacd[_0xefc0('0x10')](0x1f4,_0x3e84fc['message']));});});}; \ No newline at end of file +var _0x7443=['../../config/utils','../../config/environment','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','findAll','options','raw','where','include','map','model','attributes','ShowDynamics365Account','Dynamics365Account','find','lodash','randomstring','ioredis','../../mysqldb'];(function(_0x456bd2,_0x156c79){var _0x2218c1=function(_0x44f2d4){while(--_0x44f2d4){_0x456bd2['push'](_0x456bd2['shift']());}};_0x2218c1(++_0x156c79);}(_0x7443,0xf4));var _0x3744=function(_0x216d84,_0x592540){_0x216d84=_0x216d84-0x0;var _0x115b45=_0x7443[_0x216d84];return _0x115b45;};'use strict';var _=require(_0x3744('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3744('0x1'));var fs=require('fs');var Redis=require(_0x3744('0x2'));var db=require(_0x3744('0x3'))['db'];var utils=require(_0x3744('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x3744('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x3744('0x6')][_0x3744('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xdd0967,_0x3a9c25,_0x5a83b1){return new BPromise(function(_0x5f588e,_0x5c0b60){return client['request'](_0xdd0967,_0x5a83b1)[_0x3744('0x8')](function(_0x4a01a2){logger[_0x3744('0x9')](_0x3744('0xa'),_0x3a9c25,_0x3744('0xb'));logger['debug'](_0x3744('0xc'),_0x3a9c25,_0x3744('0xb'),JSON[_0x3744('0xd')](_0x4a01a2));if(_0x4a01a2[_0x3744('0xe')]){if(_0x4a01a2[_0x3744('0xe')][_0x3744('0xf')]===0x1f4){logger['error'](_0x3744('0xa'),_0x3a9c25,_0x4a01a2[_0x3744('0xe')][_0x3744('0x10')]);return _0x5c0b60(_0x4a01a2[_0x3744('0xe')][_0x3744('0x10')]);}logger[_0x3744('0xe')](_0x3744('0xa'),_0x3a9c25,_0x4a01a2[_0x3744('0xe')][_0x3744('0x10')]);return _0x5f588e(_0x4a01a2[_0x3744('0xe')]['message']);}else{logger[_0x3744('0x9')]('Dynamics365Account,\x20%s,\x20%s',_0x3a9c25,_0x3744('0xb'));_0x5f588e(_0x4a01a2[_0x3744('0x11')][_0x3744('0x10')]);}})[_0x3744('0x12')](function(_0x41c51b){logger[_0x3744('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x3a9c25,_0x41c51b);_0x5c0b60(_0x41c51b);});});}exports[_0x3744('0x13')]=function(_0x25c729){var _0x47e67d=this;return new Promise(function(_0x1398e6,_0x5575a7){return db['Dynamics365Account'][_0x3744('0x14')]({'raw':_0x25c729[_0x3744('0x15')]?_0x25c729[_0x3744('0x15')][_0x3744('0x16')]===undefined?!![]:![]:!![],'where':_0x25c729[_0x3744('0x15')]?_0x25c729[_0x3744('0x15')][_0x3744('0x17')]||null:null,'attributes':_0x25c729[_0x3744('0x15')]?_0x25c729[_0x3744('0x15')]['attributes']||null:null,'limit':_0x25c729[_0x3744('0x15')]?_0x25c729[_0x3744('0x15')]['limit']||null:null,'include':_0x25c729['options']?_0x25c729['options'][_0x3744('0x18')]?_[_0x3744('0x19')](_0x25c729['options'][_0x3744('0x18')],function(_0x34587c){return{'model':db[_0x34587c[_0x3744('0x1a')]],'as':_0x34587c['as'],'attributes':_0x34587c['attributes'],'include':_0x34587c[_0x3744('0x18')]?_[_0x3744('0x19')](_0x34587c[_0x3744('0x18')],function(_0x245da8){return{'model':db[_0x245da8['model']],'as':_0x245da8['as'],'attributes':_0x245da8[_0x3744('0x1b')],'include':_0x245da8[_0x3744('0x18')]?_[_0x3744('0x19')](_0x245da8[_0x3744('0x18')],function(_0x5bade1){return{'model':db[_0x5bade1[_0x3744('0x1a')]],'as':_0x5bade1['as'],'attributes':_0x5bade1[_0x3744('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3744('0x8')](function(_0x589928){logger['info'](_0x3744('0x13'),_0x25c729);logger['debug'](_0x3744('0x13'),_0x25c729,JSON['stringify'](_0x589928));_0x1398e6(_0x589928);})[_0x3744('0x12')](function(_0x27e367){logger[_0x3744('0xe')](_0x3744('0x13'),_0x27e367[_0x3744('0x10')],_0x25c729);_0x5575a7(_0x47e67d[_0x3744('0xe')](0x1f4,_0x27e367[_0x3744('0x10')]));});});};exports[_0x3744('0x1c')]=function(_0x3ffcb8){var _0x395552=this;return new Promise(function(_0x144368,_0x3a1269){return db[_0x3744('0x1d')][_0x3744('0x1e')]({'raw':_0x3ffcb8[_0x3744('0x15')]?_0x3ffcb8[_0x3744('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x3ffcb8[_0x3744('0x15')]?_0x3ffcb8[_0x3744('0x15')]['where']||null:null,'attributes':_0x3ffcb8[_0x3744('0x15')]?_0x3ffcb8[_0x3744('0x15')][_0x3744('0x1b')]||null:null,'include':_0x3ffcb8[_0x3744('0x15')]?_0x3ffcb8[_0x3744('0x15')][_0x3744('0x18')]?_[_0x3744('0x19')](_0x3ffcb8[_0x3744('0x15')]['include'],function(_0x54e8f9){return{'model':db[_0x54e8f9[_0x3744('0x1a')]],'as':_0x54e8f9['as'],'attributes':_0x54e8f9['attributes'],'include':_0x54e8f9[_0x3744('0x18')]?_['map'](_0x54e8f9['include'],function(_0xfeb823){return{'model':db[_0xfeb823[_0x3744('0x1a')]],'as':_0xfeb823['as'],'attributes':_0xfeb823[_0x3744('0x1b')],'include':_0xfeb823['include']?_[_0x3744('0x19')](_0xfeb823[_0x3744('0x18')],function(_0x2fef7a){return{'model':db[_0x2fef7a['model']],'as':_0x2fef7a['as'],'attributes':_0x2fef7a['attributes']};}):[]};}):[]};}):[]:[]})[_0x3744('0x8')](function(_0xbf170a){logger['info']('ShowDynamics365Account',_0x3ffcb8);logger['debug']('ShowDynamics365Account',_0x3ffcb8,JSON[_0x3744('0xd')](_0xbf170a));_0x144368(_0xbf170a);})[_0x3744('0x12')](function(_0x15e847){logger[_0x3744('0xe')](_0x3744('0x1c'),_0x15e847['message'],_0x3ffcb8);_0x3a1269(_0x395552[_0x3744('0xe')](0x1f4,_0x15e847[_0x3744('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index e66a81e..d76188d 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 _0xc5b3=['isAuthenticated','get','/:id','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller'];(function(_0x37646d,_0x4351b5){var _0x19eb17=function(_0x175882){while(--_0x175882){_0x37646d['push'](_0x37646d['shift']());}};_0x19eb17(++_0x4351b5);}(_0xc5b3,0x1ee));var _0x3c5b=function(_0x2e4cbf,_0x8763d3){_0x2e4cbf=_0x2e4cbf-0x0;var _0x52840f=_0xc5b3[_0x2e4cbf];return _0x52840f;};'use strict';var multer=require(_0x3c5b('0x0'));var util=require(_0x3c5b('0x1'));var path=require(_0x3c5b('0x2'));var timeout=require(_0x3c5b('0x3'));var express=require(_0x3c5b('0x4'));var router=express[_0x3c5b('0x5')]();var fs_extra=require(_0x3c5b('0x6'));var auth=require(_0x3c5b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3c5b('0x8'));var controller=require(_0x3c5b('0x9'));router['get']('/',auth[_0x3c5b('0xa')](),controller['index']);router[_0x3c5b('0xb')](_0x3c5b('0xc'),auth[_0x3c5b('0xa')](),controller[_0x3c5b('0xd')]);router[_0x3c5b('0xb')](_0x3c5b('0xe'),auth[_0x3c5b('0xa')](),controller['getFields']);router[_0x3c5b('0xb')](_0x3c5b('0xf'),auth[_0x3c5b('0xa')](),controller[_0x3c5b('0x10')]);router[_0x3c5b('0xb')]('/:id/descriptions',auth[_0x3c5b('0xa')](),controller[_0x3c5b('0x11')]);router[_0x3c5b('0x12')]('/',auth[_0x3c5b('0xa')](),controller[_0x3c5b('0x13')]);router[_0x3c5b('0x14')](_0x3c5b('0xc'),auth['isAuthenticated'](),controller[_0x3c5b('0x15')]);router[_0x3c5b('0x16')](_0x3c5b('0xc'),auth[_0x3c5b('0xa')](),controller['destroy']);module[_0x3c5b('0x17')]=router; \ No newline at end of file +var _0xbaca=['get','isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','getDescriptions','post','create','put','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller'];(function(_0x2567a0,_0x1847de){var _0x5f47f5=function(_0x2d2af7){while(--_0x2d2af7){_0x2567a0['push'](_0x2567a0['shift']());}};_0x5f47f5(++_0x1847de);}(_0xbaca,0xfc));var _0xabac=function(_0x30c7c5,_0x168208){_0x30c7c5=_0x30c7c5-0x0;var _0x29e24e=_0xbaca[_0x30c7c5];return _0x29e24e;};'use strict';var multer=require(_0xabac('0x0'));var util=require(_0xabac('0x1'));var path=require('path');var timeout=require(_0xabac('0x2'));var express=require(_0xabac('0x3'));var router=express['Router']();var fs_extra=require(_0xabac('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xabac('0x5'));var config=require(_0xabac('0x6'));var controller=require(_0xabac('0x7'));router[_0xabac('0x8')]('/',auth[_0xabac('0x9')](),controller['index']);router['get'](_0xabac('0xa'),auth[_0xabac('0x9')](),controller['show']);router['get'](_0xabac('0xb'),auth[_0xabac('0x9')](),controller[_0xabac('0xc')]);router['get'](_0xabac('0xd'),auth[_0xabac('0x9')](),controller['getSubjects']);router[_0xabac('0x8')]('/:id/descriptions',auth[_0xabac('0x9')](),controller[_0xabac('0xe')]);router[_0xabac('0xf')]('/',auth['isAuthenticated'](),controller[_0xabac('0x10')]);router[_0xabac('0x11')](_0xabac('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xabac('0xa'),auth[_0xabac('0x9')](),controller[_0xabac('0x12')]);module[_0xabac('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 9e2ba07..fdaf5b6 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 _0x055a=['sequelize','exports','STRING','incident','ENUM','nothing','contact','BOOLEAN'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x055a,0x100));var _0xa055=function(_0x291b77,_0x36b1c2){_0x291b77=_0x291b77-0x0;var _0x138495=_0x055a[_0x291b77];return _0x138495;};'use strict';var Sequelize=require(_0xa055('0x0'));module[_0xa055('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa055('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0xa055('0x3'),'phonecall'),'defaultValue':_0xa055('0x3')},'moduleCreate':{'type':Sequelize[_0xa055('0x4')]('contact',_0xa055('0x5')),'defaultValue':_0xa055('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xa055('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xa055('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0xf439=['STRING','ENUM','incident','phonecall','nothing','contact','BOOLEAN','sequelize','exports'];(function(_0x4df747,_0x3fbecf){var _0x2112f3=function(_0x5ceab6){while(--_0x5ceab6){_0x4df747['push'](_0x4df747['shift']());}};_0x2112f3(++_0x3fbecf);}(_0xf439,0x1ed));var _0x9f43=function(_0x40daf6,_0x4f976f){_0x40daf6=_0x40daf6-0x0;var _0x56435c=_0xf439[_0x40daf6];return _0x56435c;};'use strict';var Sequelize=require(_0x9f43('0x0'));module[_0x9f43('0x1')]={'name':{'type':Sequelize[_0x9f43('0x2')]},'description':{'type':Sequelize[_0x9f43('0x2')]},'ticketType':{'type':Sequelize[_0x9f43('0x3')](_0x9f43('0x4'),_0x9f43('0x5')),'defaultValue':_0x9f43('0x4')},'moduleCreate':{'type':Sequelize[_0x9f43('0x3')]('contact',_0x9f43('0x6')),'defaultValue':_0x9f43('0x7'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x9f43('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x9f43('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 01c41a3..ace84d0 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 _0x78a8=['crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','options','find','create','body','params','Dynamics365Field','getFields','findOne','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x469348,_0x39af3d){var _0x5a13a1=function(_0x48324a){while(--_0x48324a){_0x469348['push'](_0x469348['shift']());}};_0x5a13a1(++_0x39af3d);}(_0x78a8,0x12c));var _0x878a=function(_0x381af4,_0x1e2eae){_0x381af4=_0x381af4-0x0;var _0x460ef0=_0x78a8[_0x381af4];return _0x460ef0;};'use strict';var emlformat=require(_0x878a('0x0'));var rimraf=require(_0x878a('0x1'));var zipdir=require(_0x878a('0x2'));var jsonpatch=require(_0x878a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x878a('0x4'));var util=require(_0x878a('0x5'));var path=require(_0x878a('0x6'));var sox=require(_0x878a('0x7'));var csv=require(_0x878a('0x8'));var ejs=require(_0x878a('0x9'));var fs=require('fs');var fs_extra=require(_0x878a('0xa'));var _=require(_0x878a('0xb'));var squel=require('squel');var crypto=require(_0x878a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x878a('0xd'));var toCsv=require(_0x878a('0x8'));var querystring=require('querystring');var Papa=require(_0x878a('0xe'));var Redis=require(_0x878a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x878a('0x10'));var as=require(_0x878a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x878a('0x12'))(_0x878a('0x13'));var utils=require(_0x878a('0x14'));var config=require(_0x878a('0x15'));var licenseUtil=require(_0x878a('0x16'));var db=require(_0x878a('0x17'))['db'];function respondWithStatusCode(_0x2039be,_0x499132){_0x499132=_0x499132||0xcc;return function(_0x1f8fe3){if(_0x1f8fe3){return _0x2039be[_0x878a('0x18')](_0x499132);}return _0x2039be['status'](_0x499132)[_0x878a('0x19')]();};}function respondWithResult(_0x1eb797,_0x18450c){_0x18450c=_0x18450c||0xc8;return function(_0x4ddace){if(_0x4ddace){return _0x1eb797[_0x878a('0x1a')](_0x18450c)[_0x878a('0x1b')](_0x4ddace);}};}function respondWithFilteredResult(_0x1af740,_0x418bda){return function(_0x59d5aa){if(_0x59d5aa){var _0x2e9a38=typeof _0x418bda['offset']===_0x878a('0x1c')&&typeof _0x418bda[_0x878a('0x1d')]===_0x878a('0x1c');var _0x1b9950=_0x59d5aa[_0x878a('0x1e')];var _0x11963f=_0x2e9a38?0x0:_0x418bda[_0x878a('0x1f')];var _0x4d2cd6=_0x2e9a38?_0x59d5aa['count']:_0x418bda[_0x878a('0x1f')]+_0x418bda['limit'];var _0x449c7f;if(_0x4d2cd6>=_0x1b9950){_0x4d2cd6=_0x1b9950;_0x449c7f=0xc8;}else{_0x449c7f=0xce;}_0x1af740[_0x878a('0x1a')](_0x449c7f);return _0x1af740[_0x878a('0x20')](_0x878a('0x21'),_0x11963f+'-'+_0x4d2cd6+'/'+_0x1b9950)[_0x878a('0x1b')](_0x59d5aa);}return null;};}function patchUpdates(_0x2e9e42){return function(_0x418961){try{jsonpatch[_0x878a('0x22')](_0x418961,_0x2e9e42,!![]);}catch(_0x5f2e8f){return BPromise['reject'](_0x5f2e8f);}return _0x418961['save']();};}function saveUpdates(_0x29fbc0,_0x28f515){return function(_0x2381c2){if(_0x2381c2){return _0x2381c2[_0x878a('0x23')](_0x29fbc0)[_0x878a('0x24')](function(_0x12bd05){return _0x12bd05;});}return null;};}function removeEntity(_0xe58339,_0x43d758){return function(_0x1bf1f0){if(_0x1bf1f0){return _0x1bf1f0[_0x878a('0x25')]()[_0x878a('0x24')](function(){_0xe58339[_0x878a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa249b6,_0xea247b){return function(_0x54e7f8){if(!_0x54e7f8){_0xa249b6['sendStatus'](0x194);}return _0x54e7f8;};}function handleError(_0x4c5b3e,_0x4e3137){_0x4e3137=_0x4e3137||0x1f4;return function(_0x1175e2){logger['error'](_0x1175e2[_0x878a('0x26')]);if(_0x1175e2[_0x878a('0x27')]){delete _0x1175e2[_0x878a('0x27')];}_0x4c5b3e[_0x878a('0x1a')](_0x4e3137)[_0x878a('0x28')](_0x1175e2);};}exports[_0x878a('0x29')]=function(_0x2bd361,_0x41f25c){var _0x27af44={},_0x3c6d4c={},_0x1cff9a={'count':0x0,'rows':[]};var _0x153427=_[_0x878a('0x2a')](db[_0x878a('0x2b')][_0x878a('0x2c')],function(_0x1bb017){return{'name':_0x1bb017['fieldName'],'type':_0x1bb017[_0x878a('0x2d')][_0x878a('0x2e')]};});_0x3c6d4c[_0x878a('0x2f')]=_[_0x878a('0x2a')](_0x153427,'name');_0x3c6d4c['query']=_[_0x878a('0x30')](_0x2bd361[_0x878a('0x31')]);_0x3c6d4c[_0x878a('0x32')]=_[_0x878a('0x33')](_0x3c6d4c[_0x878a('0x2f')],_0x3c6d4c[_0x878a('0x31')]);_0x27af44[_0x878a('0x34')]=_[_0x878a('0x33')](_0x3c6d4c[_0x878a('0x2f')],qs[_0x878a('0x35')](_0x2bd361[_0x878a('0x31')][_0x878a('0x35')]));_0x27af44[_0x878a('0x34')]=_0x27af44[_0x878a('0x34')][_0x878a('0x36')]?_0x27af44['attributes']:_0x3c6d4c[_0x878a('0x2f')];if(!_0x2bd361[_0x878a('0x31')][_0x878a('0x37')](_0x878a('0x38'))){_0x27af44[_0x878a('0x1d')]=qs[_0x878a('0x1d')](_0x2bd361[_0x878a('0x31')][_0x878a('0x1d')]);_0x27af44[_0x878a('0x1f')]=qs['offset'](_0x2bd361[_0x878a('0x31')][_0x878a('0x1f')]);}_0x27af44[_0x878a('0x39')]=qs[_0x878a('0x3a')](_0x2bd361[_0x878a('0x31')]['sort']);_0x27af44[_0x878a('0x3b')]=qs['filters'](_[_0x878a('0x3c')](_0x2bd361[_0x878a('0x31')],_0x3c6d4c['filters']),_0x153427);if(_0x2bd361['query'][_0x878a('0x3d')]){_0x27af44['where']=_[_0x878a('0x3e')](_0x27af44[_0x878a('0x3b')],{'$or':_[_0x878a('0x2a')](_0x153427,function(_0x553056){if(_0x553056['type']!=='VIRTUAL'){var _0x585763={};_0x585763[_0x553056['name']]={'$like':'%'+_0x2bd361['query']['filter']+'%'};return _0x585763;}})});}_0x27af44=_[_0x878a('0x3e')]({},_0x27af44,_0x2bd361['options']);var _0x4bd6a6={'where':_0x27af44[_0x878a('0x3b')]};return db[_0x878a('0x2b')]['count'](_0x4bd6a6)[_0x878a('0x24')](function(_0x3bce07){_0x1cff9a[_0x878a('0x1e')]=_0x3bce07;if(_0x2bd361['query'][_0x878a('0x3f')]){_0x27af44[_0x878a('0x40')]=[{'all':!![]}];}return db[_0x878a('0x2b')][_0x878a('0x41')](_0x27af44);})[_0x878a('0x24')](function(_0x32b6af){_0x1cff9a['rows']=_0x32b6af;return _0x1cff9a;})[_0x878a('0x24')](respondWithFilteredResult(_0x41f25c,_0x27af44))[_0x878a('0x42')](handleError(_0x41f25c,null));};exports[_0x878a('0x43')]=function(_0x186d70,_0x91ce1e){var _0x4071e9={'raw':![],'where':{'id':_0x186d70['params']['id']}},_0x142423={};_0x142423[_0x878a('0x2f')]=_[_0x878a('0x30')](db[_0x878a('0x2b')][_0x878a('0x2c')]);_0x142423['query']=_[_0x878a('0x30')](_0x186d70[_0x878a('0x31')]);_0x142423[_0x878a('0x32')]=_[_0x878a('0x33')](_0x142423['model'],_0x142423[_0x878a('0x31')]);_0x4071e9[_0x878a('0x34')]=_[_0x878a('0x33')](_0x142423['model'],qs['fields'](_0x186d70['query'][_0x878a('0x35')]));_0x4071e9[_0x878a('0x34')]=_0x4071e9['attributes'][_0x878a('0x36')]?_0x4071e9[_0x878a('0x34')]:_0x142423[_0x878a('0x2f')];if(_0x186d70[_0x878a('0x31')][_0x878a('0x3f')]){_0x4071e9['include']=[{'all':!![]}];}_0x4071e9=_[_0x878a('0x3e')]({},_0x4071e9,_0x186d70[_0x878a('0x44')]);return db[_0x878a('0x2b')][_0x878a('0x45')](_0x4071e9)[_0x878a('0x24')](handleEntityNotFound(_0x91ce1e,null))[_0x878a('0x24')](respondWithResult(_0x91ce1e,null))['catch'](handleError(_0x91ce1e,null));};exports['create']=function(_0x49c497,_0xedc9fe){return db['Dynamics365Configuration'][_0x878a('0x46')](_0x49c497[_0x878a('0x47')],{})[_0x878a('0x24')](respondWithResult(_0xedc9fe,0xc9))['catch'](handleError(_0xedc9fe,null));};exports[_0x878a('0x23')]=function(_0x30a31f,_0x4b0f7e){if(_0x30a31f[_0x878a('0x47')]['id']){delete _0x30a31f[_0x878a('0x47')]['id'];}return db[_0x878a('0x2b')][_0x878a('0x45')]({'where':{'id':_0x30a31f[_0x878a('0x48')]['id']}})['then'](handleEntityNotFound(_0x4b0f7e,null))[_0x878a('0x24')](saveUpdates(_0x30a31f[_0x878a('0x47')],null))[_0x878a('0x24')](respondWithResult(_0x4b0f7e,null))[_0x878a('0x42')](handleError(_0x4b0f7e,null));};exports[_0x878a('0x25')]=function(_0x32fe34,_0x4c0d10){return db[_0x878a('0x2b')]['find']({'where':{'id':_0x32fe34['params']['id']}})[_0x878a('0x24')](handleEntityNotFound(_0x4c0d10,null))[_0x878a('0x24')](removeEntity(_0x4c0d10,null))[_0x878a('0x42')](handleError(_0x4c0d10,null));};exports['getFields']=function(_0x143274,_0x383063,_0x6f1a63){var _0x101ff5={};var _0xa393f={};var _0x1fadec;var _0x2b6f7f;return db[_0x878a('0x2b')]['findOne']({'where':{'id':_0x143274['params']['id']}})[_0x878a('0x24')](handleEntityNotFound(_0x383063,null))[_0x878a('0x24')](function(_0x82a895){if(_0x82a895){_0x1fadec=_0x82a895;_0xa393f[_0x878a('0x2f')]=_['keys'](db[_0x878a('0x49')][_0x878a('0x2c')]);_0xa393f['query']=_[_0x878a('0x30')](_0x143274[_0x878a('0x31')]);_0xa393f[_0x878a('0x32')]=_[_0x878a('0x33')](_0xa393f['model'],_0xa393f[_0x878a('0x31')]);_0x101ff5[_0x878a('0x34')]=_[_0x878a('0x33')](_0xa393f['model'],qs['fields'](_0x143274['query'][_0x878a('0x35')]));_0x101ff5[_0x878a('0x34')]=_0x101ff5['attributes'][_0x878a('0x36')]?_0x101ff5[_0x878a('0x34')]:_0xa393f[_0x878a('0x2f')];_0x101ff5[_0x878a('0x39')]=qs[_0x878a('0x3a')](_0x143274['query']['sort']);_0x101ff5[_0x878a('0x3b')]=qs[_0x878a('0x32')](_[_0x878a('0x3c')](_0x143274[_0x878a('0x31')],_0xa393f[_0x878a('0x32')]));if(_0x143274['query'][_0x878a('0x3d')]){_0x101ff5['where']=_[_0x878a('0x3e')](_0x101ff5[_0x878a('0x3b')],{'$or':_[_0x878a('0x2a')](_0x101ff5['attributes'],function(_0x3347b2){var _0x2d8206={};_0x2d8206[_0x3347b2]={'$like':'%'+_0x143274['query']['filter']+'%'};return _0x2d8206;})});}_0x101ff5=_[_0x878a('0x3e')]({},_0x101ff5,_0x143274[_0x878a('0x44')]);return _0x1fadec[_0x878a('0x4a')](_0x101ff5);}})['then'](function(_0x28d6fc){if(_0x28d6fc){_0x2b6f7f=_0x28d6fc['length'];if(!_0x143274['query']['hasOwnProperty']('nolimit')){_0x101ff5['limit']=qs[_0x878a('0x1d')](_0x143274[_0x878a('0x31')][_0x878a('0x1d')]);_0x101ff5['offset']=qs[_0x878a('0x1f')](_0x143274[_0x878a('0x31')][_0x878a('0x1f')]);}return _0x1fadec[_0x878a('0x4a')](_0x101ff5);}})[_0x878a('0x24')](function(_0x31f47a){if(_0x31f47a){return _0x31f47a?{'count':_0x2b6f7f,'rows':_0x31f47a}:null;}})['then'](respondWithResult(_0x383063,null))[_0x878a('0x42')](handleError(_0x383063,null));};exports['getSubjects']=function(_0x54c096,_0x37bb81,_0x3ca01f){var _0x454941={};var _0x311f3d={};var _0x18f4cd;var _0x38c595;return db[_0x878a('0x2b')][_0x878a('0x4b')]({'where':{'id':_0x54c096[_0x878a('0x48')]['id']}})['then'](handleEntityNotFound(_0x37bb81,null))[_0x878a('0x24')](function(_0xecb616){if(_0xecb616){_0x18f4cd=_0xecb616;_0x311f3d[_0x878a('0x2f')]=_[_0x878a('0x30')](db[_0x878a('0x49')][_0x878a('0x2c')]);_0x311f3d[_0x878a('0x31')]=_[_0x878a('0x30')](_0x54c096['query']);_0x311f3d[_0x878a('0x32')]=_['intersection'](_0x311f3d['model'],_0x311f3d[_0x878a('0x31')]);_0x454941[_0x878a('0x34')]=_['intersection'](_0x311f3d[_0x878a('0x2f')],qs[_0x878a('0x35')](_0x54c096[_0x878a('0x31')][_0x878a('0x35')]));_0x454941[_0x878a('0x34')]=_0x454941['attributes'][_0x878a('0x36')]?_0x454941[_0x878a('0x34')]:_0x311f3d[_0x878a('0x2f')];_0x454941['order']=qs[_0x878a('0x3a')](_0x54c096[_0x878a('0x31')][_0x878a('0x3a')]);_0x454941['where']=qs[_0x878a('0x32')](_[_0x878a('0x3c')](_0x54c096[_0x878a('0x31')],_0x311f3d['filters']));if(_0x54c096[_0x878a('0x31')][_0x878a('0x3d')]){_0x454941[_0x878a('0x3b')]=_[_0x878a('0x3e')](_0x454941[_0x878a('0x3b')],{'$or':_[_0x878a('0x2a')](_0x454941[_0x878a('0x34')],function(_0x469901){var _0x13f66d={};_0x13f66d[_0x469901]={'$like':'%'+_0x54c096[_0x878a('0x31')]['filter']+'%'};return _0x13f66d;})});}_0x454941=_[_0x878a('0x3e')]({},_0x454941,_0x54c096['options']);return _0x18f4cd[_0x878a('0x4c')](_0x454941);}})['then'](function(_0x1e58e1){if(_0x1e58e1){_0x38c595=_0x1e58e1[_0x878a('0x36')];if(!_0x54c096['query'][_0x878a('0x37')](_0x878a('0x38'))){_0x454941[_0x878a('0x1d')]=qs[_0x878a('0x1d')](_0x54c096[_0x878a('0x31')]['limit']);_0x454941['offset']=qs[_0x878a('0x1f')](_0x54c096['query']['offset']);}return _0x18f4cd[_0x878a('0x4c')](_0x454941);}})[_0x878a('0x24')](function(_0x2830bf){if(_0x2830bf){return _0x2830bf?{'count':_0x38c595,'rows':_0x2830bf}:null;}})[_0x878a('0x24')](respondWithResult(_0x37bb81,null))[_0x878a('0x42')](handleError(_0x37bb81,null));};exports[_0x878a('0x4d')]=function(_0x172926,_0x3d4e0a,_0x1abca7){var _0x46542d={};var _0x26eb7d={};var _0x2d7d84;var _0x332547;return db[_0x878a('0x2b')][_0x878a('0x4b')]({'where':{'id':_0x172926[_0x878a('0x48')]['id']}})[_0x878a('0x24')](handleEntityNotFound(_0x3d4e0a,null))[_0x878a('0x24')](function(_0x1d50df){if(_0x1d50df){_0x2d7d84=_0x1d50df;_0x26eb7d['model']=_[_0x878a('0x30')](db['Dynamics365Field'][_0x878a('0x2c')]);_0x26eb7d[_0x878a('0x31')]=_[_0x878a('0x30')](_0x172926[_0x878a('0x31')]);_0x26eb7d[_0x878a('0x32')]=_['intersection'](_0x26eb7d[_0x878a('0x2f')],_0x26eb7d[_0x878a('0x31')]);_0x46542d['attributes']=_[_0x878a('0x33')](_0x26eb7d[_0x878a('0x2f')],qs[_0x878a('0x35')](_0x172926['query'][_0x878a('0x35')]));_0x46542d[_0x878a('0x34')]=_0x46542d['attributes'][_0x878a('0x36')]?_0x46542d[_0x878a('0x34')]:_0x26eb7d['model'];_0x46542d[_0x878a('0x39')]=qs[_0x878a('0x3a')](_0x172926['query'][_0x878a('0x3a')]);_0x46542d[_0x878a('0x3b')]=qs[_0x878a('0x32')](_[_0x878a('0x3c')](_0x172926[_0x878a('0x31')],_0x26eb7d[_0x878a('0x32')]));if(_0x172926['query'][_0x878a('0x3d')]){_0x46542d[_0x878a('0x3b')]=_[_0x878a('0x3e')](_0x46542d[_0x878a('0x3b')],{'$or':_['map'](_0x46542d[_0x878a('0x34')],function(_0x247c0d){var _0x1795c2={};_0x1795c2[_0x247c0d]={'$like':'%'+_0x172926['query'][_0x878a('0x3d')]+'%'};return _0x1795c2;})});}_0x46542d=_['merge']({},_0x46542d,_0x172926['options']);return _0x2d7d84[_0x878a('0x4d')](_0x46542d);}})['then'](function(_0xe698a0){if(_0xe698a0){_0x332547=_0xe698a0['length'];if(!_0x172926['query'][_0x878a('0x37')](_0x878a('0x38'))){_0x46542d[_0x878a('0x1d')]=qs[_0x878a('0x1d')](_0x172926[_0x878a('0x31')][_0x878a('0x1d')]);_0x46542d[_0x878a('0x1f')]=qs[_0x878a('0x1f')](_0x172926[_0x878a('0x31')][_0x878a('0x1f')]);}return _0x2d7d84[_0x878a('0x4d')](_0x46542d);}})['then'](function(_0x2bfdc0){if(_0x2bfdc0){return _0x2bfdc0?{'count':_0x332547,'rows':_0x2bfdc0}:null;}})[_0x878a('0x24')](respondWithResult(_0x3d4e0a,null))[_0x878a('0x42')](handleError(_0x3d4e0a,null));}; \ No newline at end of file +var _0x64b8=['length','hasOwnProperty','sort','where','filter','merge','type','includeAll','include','findAll','rows','catch','params','keys','options','create','body','find','getFields','findOne','Dynamics365Field','order','pick','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x64b8,0x1aa));var _0x864b=function(_0x4458d7,_0xb46535){_0x4458d7=_0x4458d7-0x0;var _0x538fca=_0x64b8[_0x4458d7];return _0x538fca;};'use strict';var emlformat=require(_0x864b('0x0'));var rimraf=require(_0x864b('0x1'));var zipdir=require(_0x864b('0x2'));var jsonpatch=require(_0x864b('0x3'));var rp=require(_0x864b('0x4'));var moment=require('moment');var BPromise=require(_0x864b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x864b('0x6'));var sox=require(_0x864b('0x7'));var csv=require(_0x864b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x864b('0x9'));var _=require(_0x864b('0xa'));var squel=require(_0x864b('0xb'));var crypto=require('crypto');var jsforce=require(_0x864b('0xc'));var deskjs=require(_0x864b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x864b('0xe'));var Papa=require('papaparse');var Redis=require(_0x864b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x864b('0x10'));var as=require(_0x864b('0x11'));var hardwareService=require(_0x864b('0x12'));var logger=require(_0x864b('0x13'))(_0x864b('0x14'));var utils=require(_0x864b('0x15'));var config=require(_0x864b('0x16'));var licenseUtil=require(_0x864b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37488c,_0xb345ec){_0xb345ec=_0xb345ec||0xcc;return function(_0x190217){if(_0x190217){return _0x37488c[_0x864b('0x18')](_0xb345ec);}return _0x37488c[_0x864b('0x19')](_0xb345ec)[_0x864b('0x1a')]();};}function respondWithResult(_0x1557b3,_0x1a9281){_0x1a9281=_0x1a9281||0xc8;return function(_0x385580){if(_0x385580){return _0x1557b3[_0x864b('0x19')](_0x1a9281)[_0x864b('0x1b')](_0x385580);}};}function respondWithFilteredResult(_0x1bc07d,_0x10c93d){return function(_0x4a1131){if(_0x4a1131){var _0x4df77c=typeof _0x10c93d['offset']==='undefined'&&typeof _0x10c93d[_0x864b('0x1c')]===_0x864b('0x1d');var _0x1ba78c=_0x4a1131[_0x864b('0x1e')];var _0x3ffff5=_0x4df77c?0x0:_0x10c93d[_0x864b('0x1f')];var _0x430c93=_0x4df77c?_0x4a1131[_0x864b('0x1e')]:_0x10c93d['offset']+_0x10c93d[_0x864b('0x1c')];var _0xacc938;if(_0x430c93>=_0x1ba78c){_0x430c93=_0x1ba78c;_0xacc938=0xc8;}else{_0xacc938=0xce;}_0x1bc07d[_0x864b('0x19')](_0xacc938);return _0x1bc07d[_0x864b('0x20')](_0x864b('0x21'),_0x3ffff5+'-'+_0x430c93+'/'+_0x1ba78c)[_0x864b('0x1b')](_0x4a1131);}return null;};}function patchUpdates(_0xa84f82){return function(_0x456862){try{jsonpatch['apply'](_0x456862,_0xa84f82,!![]);}catch(_0x2178a9){return BPromise[_0x864b('0x22')](_0x2178a9);}return _0x456862[_0x864b('0x23')]();};}function saveUpdates(_0x4c6150,_0x3e65c6){return function(_0x566309){if(_0x566309){return _0x566309[_0x864b('0x24')](_0x4c6150)['then'](function(_0x21451c){return _0x21451c;});}return null;};}function removeEntity(_0x18e326,_0x4a009b){return function(_0x1b794d){if(_0x1b794d){return _0x1b794d[_0x864b('0x25')]()[_0x864b('0x26')](function(){_0x18e326[_0x864b('0x19')](0xcc)[_0x864b('0x1a')]();});}};}function handleEntityNotFound(_0x20a9c2,_0x6a168e){return function(_0x560d10){if(!_0x560d10){_0x20a9c2[_0x864b('0x18')](0x194);}return _0x560d10;};}function handleError(_0x1e46a4,_0x1729ea){_0x1729ea=_0x1729ea||0x1f4;return function(_0x2c0233){logger[_0x864b('0x27')](_0x2c0233[_0x864b('0x28')]);if(_0x2c0233[_0x864b('0x29')]){delete _0x2c0233[_0x864b('0x29')];}_0x1e46a4[_0x864b('0x19')](_0x1729ea)[_0x864b('0x2a')](_0x2c0233);};}exports[_0x864b('0x2b')]=function(_0x3c784d,_0x5c6803){var _0x1a6bbb={},_0x18976c={},_0x2cb018={'count':0x0,'rows':[]};var _0x53dec8=_[_0x864b('0x2c')](db[_0x864b('0x2d')][_0x864b('0x2e')],function(_0x8e9cef){return{'name':_0x8e9cef[_0x864b('0x2f')],'type':_0x8e9cef['type']['key']};});_0x18976c[_0x864b('0x30')]=_[_0x864b('0x2c')](_0x53dec8,_0x864b('0x29'));_0x18976c['query']=_['keys'](_0x3c784d[_0x864b('0x31')]);_0x18976c[_0x864b('0x32')]=_[_0x864b('0x33')](_0x18976c[_0x864b('0x30')],_0x18976c[_0x864b('0x31')]);_0x1a6bbb['attributes']=_['intersection'](_0x18976c['model'],qs[_0x864b('0x34')](_0x3c784d['query'][_0x864b('0x34')]));_0x1a6bbb[_0x864b('0x35')]=_0x1a6bbb['attributes'][_0x864b('0x36')]?_0x1a6bbb[_0x864b('0x35')]:_0x18976c[_0x864b('0x30')];if(!_0x3c784d[_0x864b('0x31')][_0x864b('0x37')]('nolimit')){_0x1a6bbb[_0x864b('0x1c')]=qs[_0x864b('0x1c')](_0x3c784d[_0x864b('0x31')][_0x864b('0x1c')]);_0x1a6bbb[_0x864b('0x1f')]=qs[_0x864b('0x1f')](_0x3c784d[_0x864b('0x31')][_0x864b('0x1f')]);}_0x1a6bbb['order']=qs[_0x864b('0x38')](_0x3c784d[_0x864b('0x31')][_0x864b('0x38')]);_0x1a6bbb[_0x864b('0x39')]=qs[_0x864b('0x32')](_['pick'](_0x3c784d[_0x864b('0x31')],_0x18976c[_0x864b('0x32')]),_0x53dec8);if(_0x3c784d[_0x864b('0x31')][_0x864b('0x3a')]){_0x1a6bbb[_0x864b('0x39')]=_[_0x864b('0x3b')](_0x1a6bbb[_0x864b('0x39')],{'$or':_[_0x864b('0x2c')](_0x53dec8,function(_0x509d2e){if(_0x509d2e[_0x864b('0x3c')]!=='VIRTUAL'){var _0x7c591a={};_0x7c591a[_0x509d2e['name']]={'$like':'%'+_0x3c784d[_0x864b('0x31')][_0x864b('0x3a')]+'%'};return _0x7c591a;}})});}_0x1a6bbb=_[_0x864b('0x3b')]({},_0x1a6bbb,_0x3c784d['options']);var _0x23407a={'where':_0x1a6bbb[_0x864b('0x39')]};return db[_0x864b('0x2d')][_0x864b('0x1e')](_0x23407a)[_0x864b('0x26')](function(_0x17fb64){_0x2cb018[_0x864b('0x1e')]=_0x17fb64;if(_0x3c784d[_0x864b('0x31')][_0x864b('0x3d')]){_0x1a6bbb[_0x864b('0x3e')]=[{'all':!![]}];}return db[_0x864b('0x2d')][_0x864b('0x3f')](_0x1a6bbb);})['then'](function(_0x12ba91){_0x2cb018[_0x864b('0x40')]=_0x12ba91;return _0x2cb018;})[_0x864b('0x26')](respondWithFilteredResult(_0x5c6803,_0x1a6bbb))[_0x864b('0x41')](handleError(_0x5c6803,null));};exports['show']=function(_0x105c66,_0x2dccec){var _0x31c72c={'raw':![],'where':{'id':_0x105c66[_0x864b('0x42')]['id']}},_0xe10354={};_0xe10354[_0x864b('0x30')]=_[_0x864b('0x43')](db[_0x864b('0x2d')][_0x864b('0x2e')]);_0xe10354[_0x864b('0x31')]=_['keys'](_0x105c66[_0x864b('0x31')]);_0xe10354[_0x864b('0x32')]=_[_0x864b('0x33')](_0xe10354[_0x864b('0x30')],_0xe10354[_0x864b('0x31')]);_0x31c72c[_0x864b('0x35')]=_[_0x864b('0x33')](_0xe10354[_0x864b('0x30')],qs[_0x864b('0x34')](_0x105c66[_0x864b('0x31')][_0x864b('0x34')]));_0x31c72c[_0x864b('0x35')]=_0x31c72c[_0x864b('0x35')][_0x864b('0x36')]?_0x31c72c[_0x864b('0x35')]:_0xe10354[_0x864b('0x30')];if(_0x105c66['query'][_0x864b('0x3d')]){_0x31c72c['include']=[{'all':!![]}];}_0x31c72c=_[_0x864b('0x3b')]({},_0x31c72c,_0x105c66[_0x864b('0x44')]);return db[_0x864b('0x2d')]['find'](_0x31c72c)[_0x864b('0x26')](handleEntityNotFound(_0x2dccec,null))['then'](respondWithResult(_0x2dccec,null))[_0x864b('0x41')](handleError(_0x2dccec,null));};exports[_0x864b('0x45')]=function(_0xf6d544,_0x2d21ad){return db[_0x864b('0x2d')][_0x864b('0x45')](_0xf6d544[_0x864b('0x46')],{})[_0x864b('0x26')](respondWithResult(_0x2d21ad,0xc9))[_0x864b('0x41')](handleError(_0x2d21ad,null));};exports[_0x864b('0x24')]=function(_0x237736,_0x1732b3){if(_0x237736[_0x864b('0x46')]['id']){delete _0x237736[_0x864b('0x46')]['id'];}return db[_0x864b('0x2d')][_0x864b('0x47')]({'where':{'id':_0x237736[_0x864b('0x42')]['id']}})[_0x864b('0x26')](handleEntityNotFound(_0x1732b3,null))[_0x864b('0x26')](saveUpdates(_0x237736[_0x864b('0x46')],null))[_0x864b('0x26')](respondWithResult(_0x1732b3,null))['catch'](handleError(_0x1732b3,null));};exports['destroy']=function(_0x1db115,_0x49474b){return db[_0x864b('0x2d')][_0x864b('0x47')]({'where':{'id':_0x1db115[_0x864b('0x42')]['id']}})[_0x864b('0x26')](handleEntityNotFound(_0x49474b,null))[_0x864b('0x26')](removeEntity(_0x49474b,null))[_0x864b('0x41')](handleError(_0x49474b,null));};exports[_0x864b('0x48')]=function(_0x56475d,_0x3a05d8,_0x5a53e6){var _0x4d6d00={};var _0x9ce6e5={};var _0x5eb6b3;var _0x1dbbd2;return db['Dynamics365Configuration'][_0x864b('0x49')]({'where':{'id':_0x56475d[_0x864b('0x42')]['id']}})[_0x864b('0x26')](handleEntityNotFound(_0x3a05d8,null))[_0x864b('0x26')](function(_0x2e47e6){if(_0x2e47e6){_0x5eb6b3=_0x2e47e6;_0x9ce6e5[_0x864b('0x30')]=_[_0x864b('0x43')](db[_0x864b('0x4a')][_0x864b('0x2e')]);_0x9ce6e5[_0x864b('0x31')]=_[_0x864b('0x43')](_0x56475d[_0x864b('0x31')]);_0x9ce6e5[_0x864b('0x32')]=_['intersection'](_0x9ce6e5['model'],_0x9ce6e5[_0x864b('0x31')]);_0x4d6d00['attributes']=_[_0x864b('0x33')](_0x9ce6e5['model'],qs[_0x864b('0x34')](_0x56475d[_0x864b('0x31')][_0x864b('0x34')]));_0x4d6d00[_0x864b('0x35')]=_0x4d6d00[_0x864b('0x35')][_0x864b('0x36')]?_0x4d6d00[_0x864b('0x35')]:_0x9ce6e5[_0x864b('0x30')];_0x4d6d00[_0x864b('0x4b')]=qs[_0x864b('0x38')](_0x56475d[_0x864b('0x31')][_0x864b('0x38')]);_0x4d6d00[_0x864b('0x39')]=qs[_0x864b('0x32')](_[_0x864b('0x4c')](_0x56475d['query'],_0x9ce6e5[_0x864b('0x32')]));if(_0x56475d[_0x864b('0x31')][_0x864b('0x3a')]){_0x4d6d00[_0x864b('0x39')]=_[_0x864b('0x3b')](_0x4d6d00[_0x864b('0x39')],{'$or':_[_0x864b('0x2c')](_0x4d6d00['attributes'],function(_0x1f251a){var _0x121c15={};_0x121c15[_0x1f251a]={'$like':'%'+_0x56475d[_0x864b('0x31')][_0x864b('0x3a')]+'%'};return _0x121c15;})});}_0x4d6d00=_[_0x864b('0x3b')]({},_0x4d6d00,_0x56475d[_0x864b('0x44')]);return _0x5eb6b3[_0x864b('0x48')](_0x4d6d00);}})['then'](function(_0xb64ab2){if(_0xb64ab2){_0x1dbbd2=_0xb64ab2['length'];if(!_0x56475d[_0x864b('0x31')]['hasOwnProperty'](_0x864b('0x4d'))){_0x4d6d00[_0x864b('0x1c')]=qs[_0x864b('0x1c')](_0x56475d['query'][_0x864b('0x1c')]);_0x4d6d00[_0x864b('0x1f')]=qs[_0x864b('0x1f')](_0x56475d['query'][_0x864b('0x1f')]);}return _0x5eb6b3[_0x864b('0x48')](_0x4d6d00);}})[_0x864b('0x26')](function(_0x268ed1){if(_0x268ed1){return _0x268ed1?{'count':_0x1dbbd2,'rows':_0x268ed1}:null;}})[_0x864b('0x26')](respondWithResult(_0x3a05d8,null))[_0x864b('0x41')](handleError(_0x3a05d8,null));};exports['getSubjects']=function(_0x2dee54,_0x16d692,_0x4217a4){var _0x39a188={};var _0x2a57d5={};var _0x91cafb;var _0x5deeda;return db[_0x864b('0x2d')][_0x864b('0x49')]({'where':{'id':_0x2dee54[_0x864b('0x42')]['id']}})[_0x864b('0x26')](handleEntityNotFound(_0x16d692,null))['then'](function(_0x2b525b){if(_0x2b525b){_0x91cafb=_0x2b525b;_0x2a57d5[_0x864b('0x30')]=_['keys'](db[_0x864b('0x4a')][_0x864b('0x2e')]);_0x2a57d5[_0x864b('0x31')]=_[_0x864b('0x43')](_0x2dee54['query']);_0x2a57d5[_0x864b('0x32')]=_[_0x864b('0x33')](_0x2a57d5[_0x864b('0x30')],_0x2a57d5[_0x864b('0x31')]);_0x39a188['attributes']=_['intersection'](_0x2a57d5['model'],qs['fields'](_0x2dee54[_0x864b('0x31')][_0x864b('0x34')]));_0x39a188['attributes']=_0x39a188[_0x864b('0x35')]['length']?_0x39a188[_0x864b('0x35')]:_0x2a57d5[_0x864b('0x30')];_0x39a188['order']=qs[_0x864b('0x38')](_0x2dee54[_0x864b('0x31')][_0x864b('0x38')]);_0x39a188[_0x864b('0x39')]=qs['filters'](_[_0x864b('0x4c')](_0x2dee54['query'],_0x2a57d5[_0x864b('0x32')]));if(_0x2dee54['query'][_0x864b('0x3a')]){_0x39a188[_0x864b('0x39')]=_[_0x864b('0x3b')](_0x39a188[_0x864b('0x39')],{'$or':_[_0x864b('0x2c')](_0x39a188[_0x864b('0x35')],function(_0x3bb62a){var _0x43d9a6={};_0x43d9a6[_0x3bb62a]={'$like':'%'+_0x2dee54['query'][_0x864b('0x3a')]+'%'};return _0x43d9a6;})});}_0x39a188=_['merge']({},_0x39a188,_0x2dee54[_0x864b('0x44')]);return _0x91cafb[_0x864b('0x4e')](_0x39a188);}})[_0x864b('0x26')](function(_0x11bd5b){if(_0x11bd5b){_0x5deeda=_0x11bd5b[_0x864b('0x36')];if(!_0x2dee54['query'][_0x864b('0x37')](_0x864b('0x4d'))){_0x39a188[_0x864b('0x1c')]=qs[_0x864b('0x1c')](_0x2dee54['query'][_0x864b('0x1c')]);_0x39a188['offset']=qs[_0x864b('0x1f')](_0x2dee54['query'][_0x864b('0x1f')]);}return _0x91cafb[_0x864b('0x4e')](_0x39a188);}})['then'](function(_0x288a56){if(_0x288a56){return _0x288a56?{'count':_0x5deeda,'rows':_0x288a56}:null;}})[_0x864b('0x26')](respondWithResult(_0x16d692,null))[_0x864b('0x41')](handleError(_0x16d692,null));};exports[_0x864b('0x4f')]=function(_0x14dbf2,_0x2b3788,_0x5441ee){var _0x1c7f64={};var _0x427bcd={};var _0x5a170d;var _0x38fa6e;return db[_0x864b('0x2d')][_0x864b('0x49')]({'where':{'id':_0x14dbf2[_0x864b('0x42')]['id']}})[_0x864b('0x26')](handleEntityNotFound(_0x2b3788,null))[_0x864b('0x26')](function(_0x305b71){if(_0x305b71){_0x5a170d=_0x305b71;_0x427bcd[_0x864b('0x30')]=_[_0x864b('0x43')](db['Dynamics365Field'][_0x864b('0x2e')]);_0x427bcd[_0x864b('0x31')]=_[_0x864b('0x43')](_0x14dbf2['query']);_0x427bcd[_0x864b('0x32')]=_[_0x864b('0x33')](_0x427bcd[_0x864b('0x30')],_0x427bcd[_0x864b('0x31')]);_0x1c7f64[_0x864b('0x35')]=_[_0x864b('0x33')](_0x427bcd['model'],qs[_0x864b('0x34')](_0x14dbf2[_0x864b('0x31')][_0x864b('0x34')]));_0x1c7f64[_0x864b('0x35')]=_0x1c7f64[_0x864b('0x35')][_0x864b('0x36')]?_0x1c7f64[_0x864b('0x35')]:_0x427bcd['model'];_0x1c7f64[_0x864b('0x4b')]=qs[_0x864b('0x38')](_0x14dbf2[_0x864b('0x31')][_0x864b('0x38')]);_0x1c7f64[_0x864b('0x39')]=qs[_0x864b('0x32')](_['pick'](_0x14dbf2[_0x864b('0x31')],_0x427bcd[_0x864b('0x32')]));if(_0x14dbf2[_0x864b('0x31')][_0x864b('0x3a')]){_0x1c7f64[_0x864b('0x39')]=_['merge'](_0x1c7f64[_0x864b('0x39')],{'$or':_[_0x864b('0x2c')](_0x1c7f64[_0x864b('0x35')],function(_0x4c2ca3){var _0x5aec84={};_0x5aec84[_0x4c2ca3]={'$like':'%'+_0x14dbf2['query'][_0x864b('0x3a')]+'%'};return _0x5aec84;})});}_0x1c7f64=_[_0x864b('0x3b')]({},_0x1c7f64,_0x14dbf2[_0x864b('0x44')]);return _0x5a170d[_0x864b('0x4f')](_0x1c7f64);}})['then'](function(_0x3cc4a3){if(_0x3cc4a3){_0x38fa6e=_0x3cc4a3[_0x864b('0x36')];if(!_0x14dbf2['query'][_0x864b('0x37')](_0x864b('0x4d'))){_0x1c7f64[_0x864b('0x1c')]=qs[_0x864b('0x1c')](_0x14dbf2[_0x864b('0x31')][_0x864b('0x1c')]);_0x1c7f64['offset']=qs[_0x864b('0x1f')](_0x14dbf2['query'][_0x864b('0x1f')]);}return _0x5a170d['getDescriptions'](_0x1c7f64);}})['then'](function(_0x4400b2){if(_0x4400b2){return _0x4400b2?{'count':_0x38fa6e,'rows':_0x4400b2}:null;}})[_0x864b('0x26')](respondWithResult(_0x2b3788,null))[_0x864b('0x41')](handleError(_0x2b3788,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index f5440c9..fb4a80f 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 _0x5b02=['define','Dynamics365Configuration','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports'];(function(_0x5d3d76,_0x96f453){var _0x2382f9=function(_0x55cdb8){while(--_0x55cdb8){_0x5d3d76['push'](_0x5d3d76['shift']());}};_0x2382f9(++_0x96f453);}(_0x5b02,0xe9));var _0x25b0=function(_0x39b5d1,_0x56cbcf){_0x39b5d1=_0x39b5d1-0x0;var _0x2643a2=_0x5b02[_0x39b5d1];return _0x2643a2;};'use strict';var _=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var logger=require(_0x25b0('0x2'))(_0x25b0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x25b0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x25b0('0x5'));var config=require(_0x25b0('0x6'));var attributes=require(_0x25b0('0x7'));module[_0x25b0('0x8')]=function(_0x2d84a9,_0x4eea55){return _0x2d84a9[_0x25b0('0x9')](_0x25b0('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00bb=['util','../../config/logger','moment','request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x432c09,_0x38c421){var _0x54d340=function(_0x154733){while(--_0x154733){_0x432c09['push'](_0x432c09['shift']());}};_0x54d340(++_0x38c421);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x00bb[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var logger=require(_0xb00b('0x2'))('api');var moment=require(_0xb00b('0x3'));var BPromise=require('bluebird');var rp=require(_0xb00b('0x4'));var fs=require('fs');var path=require(_0xb00b('0x5'));var rimraf=require('rimraf');var config=require(_0xb00b('0x6'));var attributes=require(_0xb00b('0x7'));module['exports']=function(_0x574cf8,_0x532ffb){return _0x574cf8[_0xb00b('0x8')](_0xb00b('0x9'),attributes,{'tableName':_0xb00b('0xa'),'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 a983629..982bb4c 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 _0xae62=['code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error'];(function(_0xf8f833,_0x512053){var _0x1e1dac=function(_0x12d6e9){while(--_0x12d6e9){_0xf8f833['push'](_0xf8f833['shift']());}};_0x1e1dac(++_0x512053);}(_0xae62,0xe0));var _0x2ae6=function(_0x4dcb7b,_0x5374db){_0x4dcb7b=_0x4dcb7b-0x0;var _0x196f73=_0xae62[_0x4dcb7b];return _0x196f73;};'use strict';var _=require('lodash');var util=require(_0x2ae6('0x0'));var moment=require(_0x2ae6('0x1'));var BPromise=require(_0x2ae6('0x2'));var rs=require(_0x2ae6('0x3'));var fs=require('fs');var Redis=require(_0x2ae6('0x4'));var db=require(_0x2ae6('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2ae6('0x6'));var config=require(_0x2ae6('0x7'));var jayson=require(_0x2ae6('0x8'));var client=jayson['client'][_0x2ae6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21e437,_0x177811,_0x57170d){return new BPromise(function(_0x144c0c,_0x50b139){return client['request'](_0x21e437,_0x57170d)[_0x2ae6('0xa')](function(_0x1c3cd5){logger[_0x2ae6('0xb')](_0x2ae6('0xc'),_0x177811,_0x2ae6('0xd'));logger['debug'](_0x2ae6('0xe'),_0x177811,_0x2ae6('0xd'),JSON['stringify'](_0x1c3cd5));if(_0x1c3cd5[_0x2ae6('0xf')]){if(_0x1c3cd5[_0x2ae6('0xf')][_0x2ae6('0x10')]===0x1f4){logger[_0x2ae6('0xf')](_0x2ae6('0xc'),_0x177811,_0x1c3cd5['error'][_0x2ae6('0x11')]);return _0x50b139(_0x1c3cd5['error'][_0x2ae6('0x11')]);}logger[_0x2ae6('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x177811,_0x1c3cd5[_0x2ae6('0xf')]['message']);return _0x144c0c(_0x1c3cd5['error'][_0x2ae6('0x11')]);}else{logger[_0x2ae6('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x177811,_0x2ae6('0xd'));_0x144c0c(_0x1c3cd5[_0x2ae6('0x12')][_0x2ae6('0x11')]);}})[_0x2ae6('0x13')](function(_0x470f71){logger[_0x2ae6('0xf')](_0x2ae6('0xc'),_0x177811,_0x470f71);_0x50b139(_0x470f71);});});} \ No newline at end of file +var _0x260d=['then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request'];(function(_0x2c9cce,_0x21e21c){var _0x4bc082=function(_0x16ba4c){while(--_0x16ba4c){_0x2c9cce['push'](_0x2c9cce['shift']());}};_0x4bc082(++_0x21e21c);}(_0x260d,0x181));var _0xd260=function(_0x1bcbf,_0xb1d7e){_0x1bcbf=_0x1bcbf-0x0;var _0x10f707=_0x260d[_0x1bcbf];return _0x10f707;};'use strict';var _=require('lodash');var util=require(_0xd260('0x0'));var moment=require('moment');var BPromise=require(_0xd260('0x1'));var rs=require(_0xd260('0x2'));var fs=require('fs');var Redis=require(_0xd260('0x3'));var db=require(_0xd260('0x4'))['db'];var utils=require(_0xd260('0x5'));var logger=require('../../config/logger')(_0xd260('0x6'));var config=require('../../config/environment');var jayson=require(_0xd260('0x7'));var client=jayson[_0xd260('0x8')][_0xd260('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f7cb9,_0x1b6852,_0x596c58){return new BPromise(function(_0x529c12,_0x716a32){return client[_0xd260('0xa')](_0x2f7cb9,_0x596c58)[_0xd260('0xb')](function(_0x184a26){logger[_0xd260('0xc')](_0xd260('0xd'),_0x1b6852,_0xd260('0xe'));logger[_0xd260('0xf')](_0xd260('0x10'),_0x1b6852,'request\x20sent',JSON[_0xd260('0x11')](_0x184a26));if(_0x184a26[_0xd260('0x12')]){if(_0x184a26[_0xd260('0x12')][_0xd260('0x13')]===0x1f4){logger[_0xd260('0x12')](_0xd260('0xd'),_0x1b6852,_0x184a26[_0xd260('0x12')][_0xd260('0x14')]);return _0x716a32(_0x184a26[_0xd260('0x12')][_0xd260('0x14')]);}logger[_0xd260('0x12')](_0xd260('0xd'),_0x1b6852,_0x184a26[_0xd260('0x12')][_0xd260('0x14')]);return _0x529c12(_0x184a26[_0xd260('0x12')]['message']);}else{logger[_0xd260('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1b6852,_0xd260('0xe'));_0x529c12(_0x184a26['result'][_0xd260('0x14')]);}})[_0xd260('0x15')](function(_0x11f4ae){logger[_0xd260('0x12')](_0xd260('0xd'),_0x1b6852,_0x11f4ae);_0x716a32(_0x11f4ae);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 5c1af40..8ef694e 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 _0x39c3=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy'];(function(_0x581135,_0x197723){var _0x146ac9=function(_0xbc297){while(--_0xbc297){_0x581135['push'](_0x581135['shift']());}};_0x146ac9(++_0x197723);}(_0x39c3,0xbe));var _0x339c=function(_0x28014d,_0x383e2f){_0x28014d=_0x28014d-0x0;var _0x2572cc=_0x39c3[_0x28014d];return _0x2572cc;};'use strict';var multer=require('multer');var util=require(_0x339c('0x0'));var path=require('path');var timeout=require(_0x339c('0x1'));var express=require(_0x339c('0x2'));var router=express[_0x339c('0x3')]();var fs_extra=require(_0x339c('0x4'));var auth=require(_0x339c('0x5'));var interaction=require(_0x339c('0x6'));var config=require(_0x339c('0x7'));var controller=require(_0x339c('0x8'));router[_0x339c('0x9')]('/',auth[_0x339c('0xa')](),controller[_0x339c('0xb')]);router[_0x339c('0x9')](_0x339c('0xc'),auth['isAuthenticated'](),controller[_0x339c('0xd')]);router[_0x339c('0xe')]('/',auth[_0x339c('0xa')](),controller[_0x339c('0xf')]);router[_0x339c('0x10')](_0x339c('0xc'),auth[_0x339c('0xa')](),controller['update']);router[_0x339c('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x339c('0x12')]);module['exports']=router; \ No newline at end of file +var _0xfa3c=['get','index','/:id','isAuthenticated','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller'];(function(_0x1948d0,_0xbd5720){var _0x188e66=function(_0x187b9e){while(--_0x187b9e){_0x1948d0['push'](_0x1948d0['shift']());}};_0x188e66(++_0xbd5720);}(_0xfa3c,0x10e));var _0xcfa3=function(_0x3e330a,_0x11bf04){_0x3e330a=_0x3e330a-0x0;var _0x451dee=_0xfa3c[_0x3e330a];return _0x451dee;};'use strict';var multer=require(_0xcfa3('0x0'));var util=require(_0xcfa3('0x1'));var path=require(_0xcfa3('0x2'));var timeout=require(_0xcfa3('0x3'));var express=require(_0xcfa3('0x4'));var router=express[_0xcfa3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xcfa3('0x6'));var interaction=require(_0xcfa3('0x7'));var config=require(_0xcfa3('0x8'));var controller=require(_0xcfa3('0x9'));router[_0xcfa3('0xa')]('/',auth['isAuthenticated'](),controller[_0xcfa3('0xb')]);router['get'](_0xcfa3('0xc'),auth[_0xcfa3('0xd')](),controller['show']);router[_0xcfa3('0xe')]('/',auth[_0xcfa3('0xd')](),controller[_0xcfa3('0xf')]);router['put'](_0xcfa3('0xc'),auth['isAuthenticated'](),controller[_0xcfa3('0x10')]);router[_0xcfa3('0x11')]('/:id',auth[_0xcfa3('0xd')](),controller[_0xcfa3('0x12')]);module[_0xcfa3('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index ac82327..465c60f 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 _0xecb1=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x4b8a51,_0x1dcb1f){var _0x6e5efe=function(_0x46182f){while(--_0x46182f){_0x4b8a51['push'](_0x4b8a51['shift']());}};_0x6e5efe(++_0x1dcb1f);}(_0xecb1,0xf3));var _0x1ecb=function(_0x3f83ad,_0x34b731){_0x3f83ad=_0x3f83ad-0x0;var _0x1c5460=_0xecb1[_0x3f83ad];return _0x1c5460;};'use strict';var Sequelize=require(_0x1ecb('0x0'));module[_0x1ecb('0x1')]={'type':{'type':Sequelize[_0x1ecb('0x2')](_0x1ecb('0x3'),_0x1ecb('0x4'),_0x1ecb('0x5'),_0x1ecb('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x1ecb('0x7')]},'key':{'type':Sequelize[_0x1ecb('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x1ecb('0x3'),_0x1ecb('0x4'),_0x1ecb('0x5'))},'keyContent':{'type':Sequelize[_0x1ecb('0x7')]},'idField':{'type':Sequelize[_0x1ecb('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1ecb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1ecb('0x7')]}}; \ No newline at end of file +var _0x93a3=['picklist','STRING','variable','customVariable','BOOLEAN','sequelize','exports','string','keyValue'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x93a3,0x1c7));var _0x393a=function(_0x660318,_0x30e7f0){_0x660318=_0x660318-0x0;var _0xcdee13=_0x93a3[_0x660318];return _0xcdee13;};'use strict';var Sequelize=require(_0x393a('0x0'));module[_0x393a('0x1')]={'type':{'type':Sequelize['ENUM'](_0x393a('0x2'),'variable','customVariable',_0x393a('0x3'),_0x393a('0x4')),'defaultValue':_0x393a('0x2')},'content':{'type':Sequelize[_0x393a('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x393a('0x2'),_0x393a('0x6'),_0x393a('0x7'))},'keyContent':{'type':Sequelize[_0x393a('0x5')]},'idField':{'type':Sequelize[_0x393a('0x5')]},'nameField':{'type':Sequelize[_0x393a('0x5')]},'customField':{'type':Sequelize[_0x393a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x393a('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index c4ef8e7..66555ed 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 _0xe863=['sort','pick','where','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','keys','rawAttributes','length','include','body','find','destroy','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','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','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','apply','save','then','error','stack','map','Dynamics365Field','fieldName','type','model','name','query','filters','attributes','intersection','fields','hasOwnProperty'];(function(_0x109946,_0x3494b7){var _0x4ed20b=function(_0x578aa4){while(--_0x578aa4){_0x109946['push'](_0x109946['shift']());}};_0x4ed20b(++_0x3494b7);}(_0xe863,0x171));var _0x3e86=function(_0x49dd7e,_0x48b1e5){_0x49dd7e=_0x49dd7e-0x0;var _0x4c4f6e=_0xe863[_0x49dd7e];return _0x4c4f6e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3e86('0x0'));var jsonpatch=require(_0x3e86('0x1'));var rp=require(_0x3e86('0x2'));var moment=require(_0x3e86('0x3'));var BPromise=require(_0x3e86('0x4'));var Mustache=require(_0x3e86('0x5'));var util=require(_0x3e86('0x6'));var path=require(_0x3e86('0x7'));var sox=require(_0x3e86('0x8'));var csv=require('to-csv');var ejs=require(_0x3e86('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3e86('0xa'));var squel=require(_0x3e86('0xb'));var crypto=require(_0x3e86('0xc'));var jsforce=require(_0x3e86('0xd'));var deskjs=require(_0x3e86('0xe'));var toCsv=require(_0x3e86('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e86('0x10'));var authService=require(_0x3e86('0x11'));var qs=require(_0x3e86('0x12'));var as=require(_0x3e86('0x13'));var hardwareService=require(_0x3e86('0x14'));var logger=require(_0x3e86('0x15'))(_0x3e86('0x16'));var utils=require(_0x3e86('0x17'));var config=require(_0x3e86('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3e86('0x19'))['db'];function respondWithStatusCode(_0x2a5b38,_0x35ffa1){_0x35ffa1=_0x35ffa1||0xcc;return function(_0x33f811){if(_0x33f811){return _0x2a5b38[_0x3e86('0x1a')](_0x35ffa1);}return _0x2a5b38['status'](_0x35ffa1)[_0x3e86('0x1b')]();};}function respondWithResult(_0x2a50e0,_0x4c0c7d){_0x4c0c7d=_0x4c0c7d||0xc8;return function(_0x1641ff){if(_0x1641ff){return _0x2a50e0[_0x3e86('0x1c')](_0x4c0c7d)[_0x3e86('0x1d')](_0x1641ff);}};}function respondWithFilteredResult(_0xf71f6e,_0x388b60){return function(_0x57136a){if(_0x57136a){var _0x51012d=typeof _0x388b60['offset']===_0x3e86('0x1e')&&typeof _0x388b60[_0x3e86('0x1f')]===_0x3e86('0x1e');var _0x291e18=_0x57136a[_0x3e86('0x20')];var _0x43aab6=_0x51012d?0x0:_0x388b60[_0x3e86('0x21')];var _0x539019=_0x51012d?_0x57136a[_0x3e86('0x20')]:_0x388b60[_0x3e86('0x21')]+_0x388b60[_0x3e86('0x1f')];var _0x11c990;if(_0x539019>=_0x291e18){_0x539019=_0x291e18;_0x11c990=0xc8;}else{_0x11c990=0xce;}_0xf71f6e[_0x3e86('0x1c')](_0x11c990);return _0xf71f6e['set']('Content-Range',_0x43aab6+'-'+_0x539019+'/'+_0x291e18)['json'](_0x57136a);}return null;};}function patchUpdates(_0x53f7c3){return function(_0x5926db){try{jsonpatch[_0x3e86('0x22')](_0x5926db,_0x53f7c3,!![]);}catch(_0x5961fe){return BPromise['reject'](_0x5961fe);}return _0x5926db[_0x3e86('0x23')]();};}function saveUpdates(_0x93b44d,_0x226ed2){return function(_0x5e8228){if(_0x5e8228){return _0x5e8228['update'](_0x93b44d)[_0x3e86('0x24')](function(_0x15cbea){return _0x15cbea;});}return null;};}function removeEntity(_0x4b0a63,_0x224f3f){return function(_0x9063a9){if(_0x9063a9){return _0x9063a9['destroy']()[_0x3e86('0x24')](function(){_0x4b0a63['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41ba6d,_0x317668){return function(_0x58eabd){if(!_0x58eabd){_0x41ba6d['sendStatus'](0x194);}return _0x58eabd;};}function handleError(_0x34f535,_0x54ef19){_0x54ef19=_0x54ef19||0x1f4;return function(_0x494316){logger[_0x3e86('0x25')](_0x494316[_0x3e86('0x26')]);if(_0x494316['name']){delete _0x494316['name'];}_0x34f535[_0x3e86('0x1c')](_0x54ef19)['send'](_0x494316);};}exports['index']=function(_0x5ad4f2,_0x13d2e5){var _0x2af1e9={},_0x477670={},_0x32e2a6={'count':0x0,'rows':[]};var _0x847836=_[_0x3e86('0x27')](db[_0x3e86('0x28')]['rawAttributes'],function(_0x437708){return{'name':_0x437708[_0x3e86('0x29')],'type':_0x437708[_0x3e86('0x2a')]['key']};});_0x477670[_0x3e86('0x2b')]=_[_0x3e86('0x27')](_0x847836,_0x3e86('0x2c'));_0x477670[_0x3e86('0x2d')]=_['keys'](_0x5ad4f2[_0x3e86('0x2d')]);_0x477670[_0x3e86('0x2e')]=_['intersection'](_0x477670['model'],_0x477670[_0x3e86('0x2d')]);_0x2af1e9[_0x3e86('0x2f')]=_[_0x3e86('0x30')](_0x477670[_0x3e86('0x2b')],qs[_0x3e86('0x31')](_0x5ad4f2[_0x3e86('0x2d')]['fields']));_0x2af1e9[_0x3e86('0x2f')]=_0x2af1e9[_0x3e86('0x2f')]['length']?_0x2af1e9[_0x3e86('0x2f')]:_0x477670[_0x3e86('0x2b')];if(!_0x5ad4f2['query'][_0x3e86('0x32')]('nolimit')){_0x2af1e9[_0x3e86('0x1f')]=qs[_0x3e86('0x1f')](_0x5ad4f2[_0x3e86('0x2d')][_0x3e86('0x1f')]);_0x2af1e9[_0x3e86('0x21')]=qs[_0x3e86('0x21')](_0x5ad4f2[_0x3e86('0x2d')][_0x3e86('0x21')]);}_0x2af1e9['order']=qs[_0x3e86('0x33')](_0x5ad4f2[_0x3e86('0x2d')][_0x3e86('0x33')]);_0x2af1e9['where']=qs[_0x3e86('0x2e')](_[_0x3e86('0x34')](_0x5ad4f2[_0x3e86('0x2d')],_0x477670[_0x3e86('0x2e')]),_0x847836);if(_0x5ad4f2[_0x3e86('0x2d')]['filter']){_0x2af1e9[_0x3e86('0x35')]=_[_0x3e86('0x36')](_0x2af1e9['where'],{'$or':_[_0x3e86('0x27')](_0x847836,function(_0x413f4f){if(_0x413f4f[_0x3e86('0x2a')]!==_0x3e86('0x37')){var _0x3027bd={};_0x3027bd[_0x413f4f[_0x3e86('0x2c')]]={'$like':'%'+_0x5ad4f2[_0x3e86('0x2d')][_0x3e86('0x38')]+'%'};return _0x3027bd;}})});}_0x2af1e9=_['merge']({},_0x2af1e9,_0x5ad4f2[_0x3e86('0x39')]);var _0x21650f={'where':_0x2af1e9['where']};return db[_0x3e86('0x28')]['count'](_0x21650f)['then'](function(_0x2acf92){_0x32e2a6[_0x3e86('0x20')]=_0x2acf92;if(_0x5ad4f2['query'][_0x3e86('0x3a')]){_0x2af1e9['include']=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x2af1e9);})[_0x3e86('0x24')](function(_0x40e28d){_0x32e2a6[_0x3e86('0x3b')]=_0x40e28d;return _0x32e2a6;})[_0x3e86('0x24')](respondWithFilteredResult(_0x13d2e5,_0x2af1e9))[_0x3e86('0x3c')](handleError(_0x13d2e5,null));};exports[_0x3e86('0x3d')]=function(_0x442221,_0x533256){var _0x7e4eb4={'raw':!![],'where':{'id':_0x442221[_0x3e86('0x3e')]['id']}},_0x2703d4={};_0x2703d4['model']=_[_0x3e86('0x3f')](db[_0x3e86('0x28')][_0x3e86('0x40')]);_0x2703d4[_0x3e86('0x2d')]=_[_0x3e86('0x3f')](_0x442221[_0x3e86('0x2d')]);_0x2703d4[_0x3e86('0x2e')]=_[_0x3e86('0x30')](_0x2703d4['model'],_0x2703d4[_0x3e86('0x2d')]);_0x7e4eb4[_0x3e86('0x2f')]=_[_0x3e86('0x30')](_0x2703d4['model'],qs['fields'](_0x442221[_0x3e86('0x2d')][_0x3e86('0x31')]));_0x7e4eb4['attributes']=_0x7e4eb4['attributes'][_0x3e86('0x41')]?_0x7e4eb4[_0x3e86('0x2f')]:_0x2703d4[_0x3e86('0x2b')];if(_0x442221[_0x3e86('0x2d')]['includeAll']){_0x7e4eb4[_0x3e86('0x42')]=[{'all':!![]}];}_0x7e4eb4=_[_0x3e86('0x36')]({},_0x7e4eb4,_0x442221[_0x3e86('0x39')]);return db[_0x3e86('0x28')]['find'](_0x7e4eb4)[_0x3e86('0x24')](handleEntityNotFound(_0x533256,null))[_0x3e86('0x24')](respondWithResult(_0x533256,null))['catch'](handleError(_0x533256,null));};exports['create']=function(_0x3406fa,_0x2e1c0d){return db[_0x3e86('0x28')]['create'](_0x3406fa[_0x3e86('0x43')],{})[_0x3e86('0x24')](respondWithResult(_0x2e1c0d,0xc9))[_0x3e86('0x3c')](handleError(_0x2e1c0d,null));};exports['update']=function(_0x17842a,_0x3fb519){if(_0x17842a['body']['id']){delete _0x17842a[_0x3e86('0x43')]['id'];}return db[_0x3e86('0x28')][_0x3e86('0x44')]({'where':{'id':_0x17842a[_0x3e86('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3fb519,null))[_0x3e86('0x24')](saveUpdates(_0x17842a[_0x3e86('0x43')],null))['then'](respondWithResult(_0x3fb519,null))[_0x3e86('0x3c')](handleError(_0x3fb519,null));};exports[_0x3e86('0x45')]=function(_0x1810c7,_0x429aa9){return db[_0x3e86('0x28')][_0x3e86('0x44')]({'where':{'id':_0x1810c7[_0x3e86('0x3e')]['id']}})[_0x3e86('0x24')](handleEntityNotFound(_0x429aa9,null))[_0x3e86('0x24')](removeEntity(_0x429aa9,null))[_0x3e86('0x3c')](handleError(_0x429aa9,null));}; \ No newline at end of file +var _0xeba7=['end','json','offset','undefined','limit','count','status','set','save','update','then','destroy','error','stack','name','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','Dynamics365Field','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus'];(function(_0x8faf90,_0x5ae801){var _0x4e6aae=function(_0x747dcf){while(--_0x747dcf){_0x8faf90['push'](_0x8faf90['shift']());}};_0x4e6aae(++_0x5ae801);}(_0xeba7,0x139));var _0x7eba=function(_0x46cfbb,_0x16f6bf){_0x46cfbb=_0x46cfbb-0x0;var _0x5a384a=_0xeba7[_0x46cfbb];return _0x5a384a;};'use strict';var emlformat=require(_0x7eba('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7eba('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7eba('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x7eba('0x3'));var util=require(_0x7eba('0x4'));var path=require(_0x7eba('0x5'));var sox=require(_0x7eba('0x6'));var csv=require(_0x7eba('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7eba('0x8'));var _=require(_0x7eba('0x9'));var squel=require(_0x7eba('0xa'));var crypto=require(_0x7eba('0xb'));var jsforce=require(_0x7eba('0xc'));var deskjs=require(_0x7eba('0xd'));var toCsv=require(_0x7eba('0x7'));var querystring=require(_0x7eba('0xe'));var Papa=require('papaparse');var Redis=require(_0x7eba('0xf'));var authService=require(_0x7eba('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7eba('0x11'));var logger=require(_0x7eba('0x12'))('api');var utils=require(_0x7eba('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7eba('0x14'))['db'];function respondWithStatusCode(_0x5621eb,_0x6f5610){_0x6f5610=_0x6f5610||0xcc;return function(_0x2fc381){if(_0x2fc381){return _0x5621eb[_0x7eba('0x15')](_0x6f5610);}return _0x5621eb['status'](_0x6f5610)[_0x7eba('0x16')]();};}function respondWithResult(_0x47205a,_0xeea4ab){_0xeea4ab=_0xeea4ab||0xc8;return function(_0x45f57a){if(_0x45f57a){return _0x47205a['status'](_0xeea4ab)[_0x7eba('0x17')](_0x45f57a);}};}function respondWithFilteredResult(_0x5c12b2,_0x3f2df6){return function(_0x38a192){if(_0x38a192){var _0x19d17c=typeof _0x3f2df6[_0x7eba('0x18')]===_0x7eba('0x19')&&typeof _0x3f2df6[_0x7eba('0x1a')]==='undefined';var _0x2eef22=_0x38a192[_0x7eba('0x1b')];var _0x3f9aeb=_0x19d17c?0x0:_0x3f2df6[_0x7eba('0x18')];var _0x3bc383=_0x19d17c?_0x38a192[_0x7eba('0x1b')]:_0x3f2df6[_0x7eba('0x18')]+_0x3f2df6[_0x7eba('0x1a')];var _0xa60507;if(_0x3bc383>=_0x2eef22){_0x3bc383=_0x2eef22;_0xa60507=0xc8;}else{_0xa60507=0xce;}_0x5c12b2[_0x7eba('0x1c')](_0xa60507);return _0x5c12b2[_0x7eba('0x1d')]('Content-Range',_0x3f9aeb+'-'+_0x3bc383+'/'+_0x2eef22)[_0x7eba('0x17')](_0x38a192);}return null;};}function patchUpdates(_0xb4bec0){return function(_0x4e1b92){try{jsonpatch['apply'](_0x4e1b92,_0xb4bec0,!![]);}catch(_0x3c72f4){return BPromise['reject'](_0x3c72f4);}return _0x4e1b92[_0x7eba('0x1e')]();};}function saveUpdates(_0x2f76ba,_0x2ff72a){return function(_0x3e4802){if(_0x3e4802){return _0x3e4802[_0x7eba('0x1f')](_0x2f76ba)[_0x7eba('0x20')](function(_0x1c6a74){return _0x1c6a74;});}return null;};}function removeEntity(_0x11039e,_0xdb366d){return function(_0x4ef622){if(_0x4ef622){return _0x4ef622[_0x7eba('0x21')]()[_0x7eba('0x20')](function(){_0x11039e[_0x7eba('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x531f70,_0x389172){return function(_0x5adfb0){if(!_0x5adfb0){_0x531f70[_0x7eba('0x15')](0x194);}return _0x5adfb0;};}function handleError(_0x418e9a,_0x27efc0){_0x27efc0=_0x27efc0||0x1f4;return function(_0xa05227){logger[_0x7eba('0x22')](_0xa05227[_0x7eba('0x23')]);if(_0xa05227[_0x7eba('0x24')]){delete _0xa05227[_0x7eba('0x24')];}_0x418e9a[_0x7eba('0x1c')](_0x27efc0)['send'](_0xa05227);};}exports[_0x7eba('0x25')]=function(_0x2a7d6b,_0xc8ebd0){var _0x5e0975={},_0x26665c={},_0x1c9718={'count':0x0,'rows':[]};var _0x4388a9=_[_0x7eba('0x26')](db['Dynamics365Field'][_0x7eba('0x27')],function(_0x290ea7){return{'name':_0x290ea7['fieldName'],'type':_0x290ea7[_0x7eba('0x28')]['key']};});_0x26665c[_0x7eba('0x29')]=_[_0x7eba('0x26')](_0x4388a9,_0x7eba('0x24'));_0x26665c[_0x7eba('0x2a')]=_[_0x7eba('0x2b')](_0x2a7d6b[_0x7eba('0x2a')]);_0x26665c[_0x7eba('0x2c')]=_[_0x7eba('0x2d')](_0x26665c[_0x7eba('0x29')],_0x26665c[_0x7eba('0x2a')]);_0x5e0975[_0x7eba('0x2e')]=_[_0x7eba('0x2d')](_0x26665c['model'],qs['fields'](_0x2a7d6b[_0x7eba('0x2a')][_0x7eba('0x2f')]));_0x5e0975['attributes']=_0x5e0975[_0x7eba('0x2e')][_0x7eba('0x30')]?_0x5e0975[_0x7eba('0x2e')]:_0x26665c['model'];if(!_0x2a7d6b['query'][_0x7eba('0x31')](_0x7eba('0x32'))){_0x5e0975['limit']=qs[_0x7eba('0x1a')](_0x2a7d6b[_0x7eba('0x2a')][_0x7eba('0x1a')]);_0x5e0975[_0x7eba('0x18')]=qs[_0x7eba('0x18')](_0x2a7d6b['query'][_0x7eba('0x18')]);}_0x5e0975['order']=qs[_0x7eba('0x33')](_0x2a7d6b[_0x7eba('0x2a')][_0x7eba('0x33')]);_0x5e0975[_0x7eba('0x34')]=qs[_0x7eba('0x2c')](_[_0x7eba('0x35')](_0x2a7d6b[_0x7eba('0x2a')],_0x26665c[_0x7eba('0x2c')]),_0x4388a9);if(_0x2a7d6b['query'][_0x7eba('0x36')]){_0x5e0975[_0x7eba('0x34')]=_[_0x7eba('0x37')](_0x5e0975[_0x7eba('0x34')],{'$or':_['map'](_0x4388a9,function(_0x350bd2){if(_0x350bd2[_0x7eba('0x28')]!==_0x7eba('0x38')){var _0x4c6b88={};_0x4c6b88[_0x350bd2[_0x7eba('0x24')]]={'$like':'%'+_0x2a7d6b['query'][_0x7eba('0x36')]+'%'};return _0x4c6b88;}})});}_0x5e0975=_['merge']({},_0x5e0975,_0x2a7d6b['options']);var _0x52051d={'where':_0x5e0975['where']};return db[_0x7eba('0x39')][_0x7eba('0x1b')](_0x52051d)['then'](function(_0x10919d){_0x1c9718['count']=_0x10919d;if(_0x2a7d6b[_0x7eba('0x2a')]['includeAll']){_0x5e0975['include']=[{'all':!![]}];}return db[_0x7eba('0x39')][_0x7eba('0x3a')](_0x5e0975);})[_0x7eba('0x20')](function(_0x1492e8){_0x1c9718[_0x7eba('0x3b')]=_0x1492e8;return _0x1c9718;})['then'](respondWithFilteredResult(_0xc8ebd0,_0x5e0975))[_0x7eba('0x3c')](handleError(_0xc8ebd0,null));};exports[_0x7eba('0x3d')]=function(_0x10fb53,_0x87b98){var _0x49ff52={'raw':!![],'where':{'id':_0x10fb53[_0x7eba('0x3e')]['id']}},_0x5d7bf8={};_0x5d7bf8[_0x7eba('0x29')]=_[_0x7eba('0x2b')](db[_0x7eba('0x39')][_0x7eba('0x27')]);_0x5d7bf8[_0x7eba('0x2a')]=_[_0x7eba('0x2b')](_0x10fb53['query']);_0x5d7bf8['filters']=_[_0x7eba('0x2d')](_0x5d7bf8[_0x7eba('0x29')],_0x5d7bf8['query']);_0x49ff52[_0x7eba('0x2e')]=_[_0x7eba('0x2d')](_0x5d7bf8[_0x7eba('0x29')],qs[_0x7eba('0x2f')](_0x10fb53[_0x7eba('0x2a')][_0x7eba('0x2f')]));_0x49ff52[_0x7eba('0x2e')]=_0x49ff52['attributes']['length']?_0x49ff52[_0x7eba('0x2e')]:_0x5d7bf8[_0x7eba('0x29')];if(_0x10fb53[_0x7eba('0x2a')][_0x7eba('0x3f')]){_0x49ff52['include']=[{'all':!![]}];}_0x49ff52=_[_0x7eba('0x37')]({},_0x49ff52,_0x10fb53['options']);return db[_0x7eba('0x39')][_0x7eba('0x40')](_0x49ff52)[_0x7eba('0x20')](handleEntityNotFound(_0x87b98,null))['then'](respondWithResult(_0x87b98,null))['catch'](handleError(_0x87b98,null));};exports[_0x7eba('0x41')]=function(_0x5858b2,_0x52439f){return db[_0x7eba('0x39')][_0x7eba('0x41')](_0x5858b2['body'],{})[_0x7eba('0x20')](respondWithResult(_0x52439f,0xc9))[_0x7eba('0x3c')](handleError(_0x52439f,null));};exports[_0x7eba('0x1f')]=function(_0x1ff247,_0x34f25d){if(_0x1ff247[_0x7eba('0x42')]['id']){delete _0x1ff247['body']['id'];}return db[_0x7eba('0x39')]['find']({'where':{'id':_0x1ff247[_0x7eba('0x3e')]['id']}})[_0x7eba('0x20')](handleEntityNotFound(_0x34f25d,null))[_0x7eba('0x20')](saveUpdates(_0x1ff247[_0x7eba('0x42')],null))[_0x7eba('0x20')](respondWithResult(_0x34f25d,null))[_0x7eba('0x3c')](handleError(_0x34f25d,null));};exports['destroy']=function(_0x3135f2,_0x5a311e){return db['Dynamics365Field'][_0x7eba('0x40')]({'where':{'id':_0x3135f2['params']['id']}})[_0x7eba('0x20')](handleEntityNotFound(_0x5a311e,null))[_0x7eba('0x20')](removeEntity(_0x5a311e,null))[_0x7eba('0x3c')](handleError(_0x5a311e,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 5598b7f..d66e1a7 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 _0x856d=['moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','Dynamics365Field','dynamics365_unique_index','idField','lodash','util','api'];(function(_0x236c67,_0x28b77e){var _0x19e4fb=function(_0x7cffa2){while(--_0x7cffa2){_0x236c67['push'](_0x236c67['shift']());}};_0x19e4fb(++_0x28b77e);}(_0x856d,0x1aa));var _0xd856=function(_0x5d6452,_0x4c72d2){_0x5d6452=_0x5d6452-0x0;var _0x4aff24=_0x856d[_0x5d6452];return _0x4aff24;};'use strict';var _=require(_0xd856('0x0'));var util=require(_0xd856('0x1'));var logger=require('../../config/logger')(_0xd856('0x2'));var moment=require(_0xd856('0x3'));var BPromise=require(_0xd856('0x4'));var rp=require(_0xd856('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd856('0x6'));var config=require(_0xd856('0x7'));var attributes=require(_0xd856('0x8'));module[_0xd856('0x9')]=function(_0x2c923d,_0x4a4e64){return _0x2c923d['define'](_0xd856('0xa'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xd856('0xb'),'fields':[_0xd856('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe326=['request-promise','path','rimraf','./intDynamics365Field.attributes','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','FieldId','util','api','moment','bluebird'];(function(_0x13c6bf,_0x4bf8b3){var _0x474009=function(_0x1e262f){while(--_0x1e262f){_0x13c6bf['push'](_0x13c6bf['shift']());}};_0x474009(++_0x4bf8b3);}(_0xe326,0x1c4));var _0x6e32=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0xe326[_0x2adbeb];return _0x5e18a6;};'use strict';var _=require('lodash');var util=require(_0x6e32('0x0'));var logger=require('../../config/logger')(_0x6e32('0x1'));var moment=require(_0x6e32('0x2'));var BPromise=require(_0x6e32('0x3'));var rp=require(_0x6e32('0x4'));var fs=require('fs');var path=require(_0x6e32('0x5'));var rimraf=require(_0x6e32('0x6'));var config=require('../../config/environment');var attributes=require(_0x6e32('0x7'));module['exports']=function(_0x590d41,_0x502865){return _0x590d41['define'](_0x6e32('0x8'),attributes,{'tableName':_0x6e32('0x9'),'paranoid':![],'indexes':[{'name':_0x6e32('0xa'),'fields':['idField',_0x6e32('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 3ace461..b881be4 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 _0x7559=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','code','message','error','result','lodash','util','moment'];(function(_0x5b34c0,_0x3ad403){var _0x242bd3=function(_0x51d0ce){while(--_0x51d0ce){_0x5b34c0['push'](_0x5b34c0['shift']());}};_0x242bd3(++_0x3ad403);}(_0x7559,0xfa));var _0x9755=function(_0x48d2b5,_0x23f54e){_0x48d2b5=_0x48d2b5-0x0;var _0x1a6dbb=_0x7559[_0x48d2b5];return _0x1a6dbb;};'use strict';var _=require(_0x9755('0x0'));var util=require(_0x9755('0x1'));var moment=require(_0x9755('0x2'));var BPromise=require(_0x9755('0x3'));var rs=require(_0x9755('0x4'));var fs=require('fs');var Redis=require(_0x9755('0x5'));var db=require(_0x9755('0x6'))['db'];var utils=require(_0x9755('0x7'));var logger=require('../../config/logger')(_0x9755('0x8'));var config=require(_0x9755('0x9'));var jayson=require(_0x9755('0xa'));var client=jayson[_0x9755('0xb')][_0x9755('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x235398,_0x3e969a,_0x24f4ea){return new BPromise(function(_0xd3bea8,_0x2ae61c){return client[_0x9755('0xd')](_0x235398,_0x24f4ea)[_0x9755('0xe')](function(_0x1e6b12){logger[_0x9755('0xf')](_0x9755('0x10'),_0x3e969a,'request\x20sent');logger['debug'](_0x9755('0x11'),_0x3e969a,'request\x20sent',JSON[_0x9755('0x12')](_0x1e6b12));if(_0x1e6b12['error']){if(_0x1e6b12['error'][_0x9755('0x13')]===0x1f4){logger['error'](_0x9755('0x10'),_0x3e969a,_0x1e6b12['error']['message']);return _0x2ae61c(_0x1e6b12['error'][_0x9755('0x14')]);}logger[_0x9755('0x15')](_0x9755('0x10'),_0x3e969a,_0x1e6b12[_0x9755('0x15')][_0x9755('0x14')]);return _0xd3bea8(_0x1e6b12['error']['message']);}else{logger[_0x9755('0xf')](_0x9755('0x10'),_0x3e969a,'request\x20sent');_0xd3bea8(_0x1e6b12[_0x9755('0x16')][_0x9755('0x14')]);}})['catch'](function(_0x1a199a){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x3e969a,_0x1a199a);_0x2ae61c(_0x1a199a);});});} \ No newline at end of file +var _0xbf6c=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xbf6c,0x1cd));var _0xcbf6=function(_0xfe9168,_0x51393e){_0xfe9168=_0xfe9168-0x0;var _0x168b04=_0xbf6c[_0xfe9168];return _0x168b04;};'use strict';var _=require(_0xcbf6('0x0'));var util=require(_0xcbf6('0x1'));var moment=require(_0xcbf6('0x2'));var BPromise=require('bluebird');var rs=require(_0xcbf6('0x3'));var fs=require('fs');var Redis=require(_0xcbf6('0x4'));var db=require(_0xcbf6('0x5'))['db'];var utils=require(_0xcbf6('0x6'));var logger=require(_0xcbf6('0x7'))(_0xcbf6('0x8'));var config=require(_0xcbf6('0x9'));var jayson=require(_0xcbf6('0xa'));var client=jayson[_0xcbf6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a317b,_0x5b5779,_0xcc7498){return new BPromise(function(_0x8acbbe,_0x46398c){return client[_0xcbf6('0xc')](_0x4a317b,_0xcc7498)[_0xcbf6('0xd')](function(_0x2d131d){logger[_0xcbf6('0xe')](_0xcbf6('0xf'),_0x5b5779,'request\x20sent');logger[_0xcbf6('0x10')](_0xcbf6('0x11'),_0x5b5779,'request\x20sent',JSON['stringify'](_0x2d131d));if(_0x2d131d[_0xcbf6('0x12')]){if(_0x2d131d['error'][_0xcbf6('0x13')]===0x1f4){logger[_0xcbf6('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x5b5779,_0x2d131d['error']['message']);return _0x46398c(_0x2d131d[_0xcbf6('0x12')][_0xcbf6('0x14')]);}logger[_0xcbf6('0x12')](_0xcbf6('0xf'),_0x5b5779,_0x2d131d['error'][_0xcbf6('0x14')]);return _0x8acbbe(_0x2d131d[_0xcbf6('0x12')][_0xcbf6('0x14')]);}else{logger[_0xcbf6('0xe')](_0xcbf6('0xf'),_0x5b5779,_0xcbf6('0x15'));_0x8acbbe(_0x2d131d[_0xcbf6('0x16')][_0xcbf6('0x14')]);}})['catch'](function(_0x370089){logger[_0xcbf6('0x12')](_0xcbf6('0xf'),_0x5b5779,_0x370089);_0x46398c(_0x370089);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 97b54f6..8ef5332 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 _0xf1b7=['post','create','/:id/configurations','addConfiguration','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','show'];(function(_0x1aa3fe,_0x27c5fa){var _0x163cee=function(_0x2a1505){while(--_0x2a1505){_0x1aa3fe['push'](_0x1aa3fe['shift']());}};_0x163cee(++_0x27c5fa);}(_0xf1b7,0x196));var _0x7f1b=function(_0x1dbd0b,_0x26e998){_0x1dbd0b=_0x1dbd0b-0x0;var _0x5275fd=_0xf1b7[_0x1dbd0b];return _0x5275fd;};'use strict';var multer=require(_0x7f1b('0x0'));var util=require(_0x7f1b('0x1'));var path=require(_0x7f1b('0x2'));var timeout=require('connect-timeout');var express=require(_0x7f1b('0x3'));var router=express[_0x7f1b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7f1b('0x5'));var interaction=require(_0x7f1b('0x6'));var config=require('../../config/environment');var controller=require(_0x7f1b('0x7'));router[_0x7f1b('0x8')]('/',auth[_0x7f1b('0x9')](),controller['index']);router[_0x7f1b('0x8')](_0x7f1b('0xa'),auth['isAuthenticated'](),controller[_0x7f1b('0xb')]);router[_0x7f1b('0x8')]('/:id/configurations',auth[_0x7f1b('0x9')](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0x7f1b('0x9')](),controller['getFields']);router[_0x7f1b('0xc')]('/',auth[_0x7f1b('0x9')](),controller[_0x7f1b('0xd')]);router[_0x7f1b('0xc')](_0x7f1b('0xe'),auth[_0x7f1b('0x9')](),controller[_0x7f1b('0xf')]);router['put']('/:id',auth[_0x7f1b('0x9')](),controller[_0x7f1b('0x10')]);router['delete'](_0x7f1b('0xa'),auth[_0x7f1b('0x9')](),controller[_0x7f1b('0x11')]);module[_0x7f1b('0x12')]=router; \ No newline at end of file +var _0x6743=['destroy','exports','multer','util','connect-timeout','Router','../../components/interaction/service','./intFreshdeskAccount.controller','get','index','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','/:id','update','delete'];(function(_0xee4883,_0x2529ee){var _0x43629d=function(_0x374e2a){while(--_0x374e2a){_0xee4883['push'](_0xee4883['shift']());}};_0x43629d(++_0x2529ee);}(_0x6743,0x80));var _0x3674=function(_0x46012c,_0x66bacf){_0x46012c=_0x46012c-0x0;var _0x26d30f=_0x6743[_0x46012c];return _0x26d30f;};'use strict';var multer=require(_0x3674('0x0'));var util=require(_0x3674('0x1'));var path=require('path');var timeout=require(_0x3674('0x2'));var express=require('express');var router=express[_0x3674('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3674('0x4'));var config=require('../../config/environment');var controller=require(_0x3674('0x5'));router[_0x3674('0x6')]('/',auth['isAuthenticated'](),controller[_0x3674('0x7')]);router['get']('/:id',auth[_0x3674('0x8')](),controller['show']);router['get'](_0x3674('0x9'),auth[_0x3674('0x8')](),controller[_0x3674('0xa')]);router[_0x3674('0x6')](_0x3674('0xb'),auth[_0x3674('0x8')](),controller[_0x3674('0xc')]);router[_0x3674('0xd')]('/',auth[_0x3674('0x8')](),controller[_0x3674('0xe')]);router['post'](_0x3674('0x9'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x3674('0xf')](_0x3674('0x10'),auth[_0x3674('0x8')](),controller[_0x3674('0x11')]);router[_0x3674('0x12')]('/:id',auth[_0x3674('0x8')](),controller[_0x3674('0x13')]);module[_0x3674('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 044137a..93e8551 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 _0x9582=['exports','STRING','username','remoteUri','sequelize'];(function(_0x1b4f19,_0x235951){var _0x3b830a=function(_0x1c62f9){while(--_0x1c62f9){_0x1b4f19['push'](_0x1b4f19['shift']());}};_0x3b830a(++_0x235951);}(_0x9582,0x95));var _0x2958=function(_0x107952,_0x1963e9){_0x107952=_0x107952-0x0;var _0x544521=_0x9582[_0x107952];return _0x544521;};'use strict';var Sequelize=require(_0x2958('0x0'));module[_0x2958('0x1')]={'name':{'type':Sequelize[_0x2958('0x2')]},'description':{'type':Sequelize[_0x2958('0x2')]},'username':{'type':Sequelize[_0x2958('0x2')],'unique':_0x2958('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2958('0x2')],'unique':_0x2958('0x4')},'serverUrl':{'type':Sequelize[_0x2958('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xd824=['exports','STRING','username','remoteUri','sequelize'];(function(_0x2c87a8,_0x31378a){var _0x27ad4d=function(_0x44788c){while(--_0x44788c){_0x2c87a8['push'](_0x2c87a8['shift']());}};_0x27ad4d(++_0x31378a);}(_0xd824,0xc2));var _0x4d82=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd824[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x4d82('0x0'));module[_0x4d82('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4d82('0x2')],'unique':_0x4d82('0x3')},'apiKey':{'type':Sequelize[_0x4d82('0x2')]},'remoteUri':{'type':Sequelize[_0x4d82('0x2')],'unique':_0x4d82('0x4')},'serverUrl':{'type':Sequelize[_0x4d82('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 4cc5ff3..b368e61 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 _0x3ae9=['lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','count','limit','set','apply','reject','save','destroy','then','sendStatus','error','stack','name','send','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','FreshdeskAccount','findAll','rows','catch','show','params','include','options','find','create','body','update','findOne','FreshdeskConfiguration','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','apiKey','remoteUri','slice','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','toString','base64','subject','agent','priority','source','ticket_type','group','remove','custom_text','custom_dropdown','label','default','choices','capitalize','test','statusCode','stringify','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra'];(function(_0x5df10c,_0x5f1e5e){var _0x47228b=function(_0x482964){while(--_0x482964){_0x5df10c['push'](_0x5df10c['shift']());}};_0x47228b(++_0x5f1e5e);}(_0x3ae9,0xdb));var _0x93ae=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x3ae9[_0x297fd3];return _0x2af381;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x93ae('0x0'));var jsonpatch=require(_0x93ae('0x1'));var rp=require(_0x93ae('0x2'));var moment=require('moment');var BPromise=require(_0x93ae('0x3'));var Mustache=require(_0x93ae('0x4'));var util=require(_0x93ae('0x5'));var path=require(_0x93ae('0x6'));var sox=require('sox');var csv=require(_0x93ae('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x93ae('0x8'));var _=require(_0x93ae('0x9'));var squel=require(_0x93ae('0xa'));var crypto=require(_0x93ae('0xb'));var jsforce=require(_0x93ae('0xc'));var deskjs=require(_0x93ae('0xd'));var toCsv=require('to-csv');var querystring=require(_0x93ae('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x93ae('0xf'));var as=require(_0x93ae('0x10'));var hardwareService=require(_0x93ae('0x11'));var logger=require(_0x93ae('0x12'))(_0x93ae('0x13'));var utils=require(_0x93ae('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x93ae('0x15'))['db'];var integrations=require(_0x93ae('0x16'));function respondWithStatusCode(_0x4a9f52,_0x571e5f){_0x571e5f=_0x571e5f||0xcc;return function(_0x36f71a){if(_0x36f71a){return _0x4a9f52['sendStatus'](_0x571e5f);}return _0x4a9f52[_0x93ae('0x17')](_0x571e5f)[_0x93ae('0x18')]();};}function respondWithResult(_0x5b4ea1,_0x392a55){_0x392a55=_0x392a55||0xc8;return function(_0x7f8662){if(_0x7f8662){return _0x5b4ea1[_0x93ae('0x17')](_0x392a55)[_0x93ae('0x19')](_0x7f8662);}};}function respondWithFilteredResult(_0x121937,_0x2d1df5){return function(_0x5ed82a){if(_0x5ed82a){var _0x11a9ce=typeof _0x2d1df5[_0x93ae('0x1a')]===_0x93ae('0x1b')&&typeof _0x2d1df5['limit']===_0x93ae('0x1b');var _0x514a0c=_0x5ed82a['count'];var _0x1002b6=_0x11a9ce?0x0:_0x2d1df5['offset'];var _0x3a92e7=_0x11a9ce?_0x5ed82a[_0x93ae('0x1c')]:_0x2d1df5['offset']+_0x2d1df5[_0x93ae('0x1d')];var _0x31a8da;if(_0x3a92e7>=_0x514a0c){_0x3a92e7=_0x514a0c;_0x31a8da=0xc8;}else{_0x31a8da=0xce;}_0x121937[_0x93ae('0x17')](_0x31a8da);return _0x121937[_0x93ae('0x1e')]('Content-Range',_0x1002b6+'-'+_0x3a92e7+'/'+_0x514a0c)[_0x93ae('0x19')](_0x5ed82a);}return null;};}function patchUpdates(_0x2f4187){return function(_0x4cbf03){try{jsonpatch[_0x93ae('0x1f')](_0x4cbf03,_0x2f4187,!![]);}catch(_0x28d6fa){return BPromise[_0x93ae('0x20')](_0x28d6fa);}return _0x4cbf03[_0x93ae('0x21')]();};}function saveUpdates(_0x26d5ac,_0x468fdf){return function(_0xcdd84f){if(_0xcdd84f){return _0xcdd84f['update'](_0x26d5ac)['then'](function(_0xd33af5){return _0xd33af5;});}return null;};}function removeEntity(_0x283e50,_0x4f9f43){return function(_0x4d0c48){if(_0x4d0c48){return _0x4d0c48[_0x93ae('0x22')]()[_0x93ae('0x23')](function(){_0x283e50[_0x93ae('0x17')](0xcc)[_0x93ae('0x18')]();});}};}function handleEntityNotFound(_0x1abea7,_0xe17086){return function(_0x1970f4){if(!_0x1970f4){_0x1abea7[_0x93ae('0x24')](0x194);}return _0x1970f4;};}function handleError(_0x542656,_0x564c15){_0x564c15=_0x564c15||0x1f4;return function(_0x57dd01){logger[_0x93ae('0x25')](_0x57dd01[_0x93ae('0x26')]);if(_0x57dd01[_0x93ae('0x27')]){delete _0x57dd01[_0x93ae('0x27')];}_0x542656[_0x93ae('0x17')](_0x564c15)[_0x93ae('0x28')](_0x57dd01);};}exports['index']=function(_0x54a37b,_0x223f42){var _0x115ac5={},_0x1aa36c={},_0x3a4393={'count':0x0,'rows':[]};var _0x485622=_['map'](db['FreshdeskAccount'][_0x93ae('0x29')],function(_0x512d8f){return{'name':_0x512d8f[_0x93ae('0x2a')],'type':_0x512d8f[_0x93ae('0x2b')]['key']};});_0x1aa36c[_0x93ae('0x2c')]=_[_0x93ae('0x2d')](_0x485622,_0x93ae('0x27'));_0x1aa36c[_0x93ae('0x2e')]=_[_0x93ae('0x2f')](_0x54a37b[_0x93ae('0x2e')]);_0x1aa36c[_0x93ae('0x30')]=_[_0x93ae('0x31')](_0x1aa36c['model'],_0x1aa36c[_0x93ae('0x2e')]);_0x115ac5[_0x93ae('0x32')]=_[_0x93ae('0x31')](_0x1aa36c[_0x93ae('0x2c')],qs[_0x93ae('0x33')](_0x54a37b[_0x93ae('0x2e')][_0x93ae('0x33')]));_0x115ac5[_0x93ae('0x32')]=_0x115ac5['attributes'][_0x93ae('0x34')]?_0x115ac5['attributes']:_0x1aa36c[_0x93ae('0x2c')];if(!_0x54a37b[_0x93ae('0x2e')][_0x93ae('0x35')](_0x93ae('0x36'))){_0x115ac5[_0x93ae('0x1d')]=qs[_0x93ae('0x1d')](_0x54a37b['query'][_0x93ae('0x1d')]);_0x115ac5[_0x93ae('0x1a')]=qs[_0x93ae('0x1a')](_0x54a37b['query'][_0x93ae('0x1a')]);}_0x115ac5[_0x93ae('0x37')]=qs[_0x93ae('0x38')](_0x54a37b['query']['sort']);_0x115ac5[_0x93ae('0x39')]=qs[_0x93ae('0x30')](_[_0x93ae('0x3a')](_0x54a37b[_0x93ae('0x2e')],_0x1aa36c[_0x93ae('0x30')]),_0x485622);if(_0x54a37b[_0x93ae('0x2e')][_0x93ae('0x3b')]){_0x115ac5[_0x93ae('0x39')]=_[_0x93ae('0x3c')](_0x115ac5[_0x93ae('0x39')],{'$or':_[_0x93ae('0x2d')](_0x485622,function(_0x2650bf){if(_0x2650bf[_0x93ae('0x2b')]!==_0x93ae('0x3d')){var _0x5789e1={};_0x5789e1[_0x2650bf[_0x93ae('0x27')]]={'$like':'%'+_0x54a37b[_0x93ae('0x2e')]['filter']+'%'};return _0x5789e1;}})});}_0x115ac5=_[_0x93ae('0x3c')]({},_0x115ac5,_0x54a37b['options']);var _0x59867a={'where':_0x115ac5[_0x93ae('0x39')]};return db['FreshdeskAccount'][_0x93ae('0x1c')](_0x59867a)[_0x93ae('0x23')](function(_0x10f680){_0x3a4393[_0x93ae('0x1c')]=_0x10f680;if(_0x54a37b[_0x93ae('0x2e')][_0x93ae('0x3e')]){_0x115ac5['include']=[{'all':!![]}];}return db[_0x93ae('0x3f')][_0x93ae('0x40')](_0x115ac5);})[_0x93ae('0x23')](function(_0x1a8bee){_0x3a4393[_0x93ae('0x41')]=_0x1a8bee;return _0x3a4393;})[_0x93ae('0x23')](respondWithFilteredResult(_0x223f42,_0x115ac5))[_0x93ae('0x42')](handleError(_0x223f42,null));};exports[_0x93ae('0x43')]=function(_0x6865d7,_0x3fc8a2){var _0x3ba904={'raw':![],'where':{'id':_0x6865d7[_0x93ae('0x44')]['id']}},_0x4a2ead={};_0x4a2ead[_0x93ae('0x2c')]=_['keys'](db['FreshdeskAccount'][_0x93ae('0x29')]);_0x4a2ead[_0x93ae('0x2e')]=_[_0x93ae('0x2f')](_0x6865d7[_0x93ae('0x2e')]);_0x4a2ead[_0x93ae('0x30')]=_[_0x93ae('0x31')](_0x4a2ead[_0x93ae('0x2c')],_0x4a2ead[_0x93ae('0x2e')]);_0x3ba904['attributes']=_[_0x93ae('0x31')](_0x4a2ead[_0x93ae('0x2c')],qs[_0x93ae('0x33')](_0x6865d7[_0x93ae('0x2e')][_0x93ae('0x33')]));_0x3ba904['attributes']=_0x3ba904['attributes'][_0x93ae('0x34')]?_0x3ba904['attributes']:_0x4a2ead[_0x93ae('0x2c')];if(_0x6865d7['query']['includeAll']){_0x3ba904[_0x93ae('0x45')]=[{'all':!![]}];}_0x3ba904=_[_0x93ae('0x3c')]({},_0x3ba904,_0x6865d7[_0x93ae('0x46')]);return db[_0x93ae('0x3f')][_0x93ae('0x47')](_0x3ba904)[_0x93ae('0x23')](handleEntityNotFound(_0x3fc8a2,null))[_0x93ae('0x23')](respondWithResult(_0x3fc8a2,null))['catch'](handleError(_0x3fc8a2,null));};exports[_0x93ae('0x48')]=function(_0x490ce3,_0x57110d){return db[_0x93ae('0x3f')][_0x93ae('0x48')](_0x490ce3[_0x93ae('0x49')],{})[_0x93ae('0x23')](respondWithResult(_0x57110d,0xc9))['catch'](handleError(_0x57110d,null));};exports[_0x93ae('0x4a')]=function(_0x4e7652,_0x57136a){if(_0x4e7652[_0x93ae('0x49')]['id']){delete _0x4e7652[_0x93ae('0x49')]['id'];}return db[_0x93ae('0x3f')][_0x93ae('0x47')]({'where':{'id':_0x4e7652[_0x93ae('0x44')]['id']}})[_0x93ae('0x23')](handleEntityNotFound(_0x57136a,null))[_0x93ae('0x23')](saveUpdates(_0x4e7652[_0x93ae('0x49')],null))['then'](respondWithResult(_0x57136a,null))['catch'](handleError(_0x57136a,null));};exports['destroy']=function(_0x4ddece,_0x5f11ab){return db[_0x93ae('0x3f')][_0x93ae('0x47')]({'where':{'id':_0x4ddece[_0x93ae('0x44')]['id']}})[_0x93ae('0x23')](handleEntityNotFound(_0x5f11ab,null))['then'](removeEntity(_0x5f11ab,null))[_0x93ae('0x42')](handleError(_0x5f11ab,null));};exports['getConfigurations']=function(_0x283518,_0x2d2089,_0x3553d3){var _0xbe41ce={};var _0x4732bd={};var _0xd4479a;var _0x161f30;return db[_0x93ae('0x3f')][_0x93ae('0x4b')]({'where':{'id':_0x283518['params']['id']}})[_0x93ae('0x23')](handleEntityNotFound(_0x2d2089,null))['then'](function(_0x2b1aa2){if(_0x2b1aa2){_0xd4479a=_0x2b1aa2;_0x4732bd[_0x93ae('0x2c')]=_[_0x93ae('0x2f')](db[_0x93ae('0x4c')][_0x93ae('0x29')]);_0x4732bd[_0x93ae('0x2e')]=_[_0x93ae('0x2f')](_0x283518['query']);_0x4732bd[_0x93ae('0x30')]=_['intersection'](_0x4732bd['model'],_0x4732bd[_0x93ae('0x2e')]);_0xbe41ce[_0x93ae('0x32')]=_['intersection'](_0x4732bd[_0x93ae('0x2c')],qs[_0x93ae('0x33')](_0x283518[_0x93ae('0x2e')][_0x93ae('0x33')]));_0xbe41ce[_0x93ae('0x32')]=_0xbe41ce[_0x93ae('0x32')][_0x93ae('0x34')]?_0xbe41ce[_0x93ae('0x32')]:_0x4732bd[_0x93ae('0x2c')];_0xbe41ce[_0x93ae('0x37')]=qs[_0x93ae('0x38')](_0x283518['query'][_0x93ae('0x38')]);_0xbe41ce[_0x93ae('0x39')]=qs[_0x93ae('0x30')](_[_0x93ae('0x3a')](_0x283518[_0x93ae('0x2e')],_0x4732bd[_0x93ae('0x30')]));if(_0x283518['query'][_0x93ae('0x3b')]){_0xbe41ce[_0x93ae('0x39')]=_[_0x93ae('0x3c')](_0xbe41ce[_0x93ae('0x39')],{'$or':_[_0x93ae('0x2d')](_0xbe41ce['attributes'],function(_0x1a6897){var _0x3ccef1={};_0x3ccef1[_0x1a6897]={'$like':'%'+_0x283518[_0x93ae('0x2e')]['filter']+'%'};return _0x3ccef1;})});}_0xbe41ce=_[_0x93ae('0x3c')]({},_0xbe41ce,_0x283518[_0x93ae('0x46')]);return _0xd4479a['getConfigurations'](_0xbe41ce);}})[_0x93ae('0x23')](function(_0x45ff85){if(_0x45ff85){_0x161f30=_0x45ff85[_0x93ae('0x34')];if(!_0x283518[_0x93ae('0x2e')][_0x93ae('0x35')](_0x93ae('0x36'))){_0xbe41ce[_0x93ae('0x1d')]=qs['limit'](_0x283518[_0x93ae('0x2e')]['limit']);_0xbe41ce['offset']=qs[_0x93ae('0x1a')](_0x283518[_0x93ae('0x2e')]['offset']);}return _0xd4479a[_0x93ae('0x4d')](_0xbe41ce);}})[_0x93ae('0x23')](function(_0x5ffdeb){if(_0x5ffdeb){return _0x5ffdeb?{'count':_0x161f30,'rows':_0x5ffdeb}:null;}})[_0x93ae('0x23')](respondWithResult(_0x2d2089,null))[_0x93ae('0x42')](handleError(_0x2d2089,null));};exports[_0x93ae('0x4e')]=function(_0x3323c5,_0x195e07,_0x204378){if(_0x3323c5['body']['id']){delete _0x3323c5['body']['id'];}return db[_0x93ae('0x3f')][_0x93ae('0x4b')]({'where':{'id':_0x3323c5[_0x93ae('0x44')]['id']}})[_0x93ae('0x23')](handleEntityNotFound(_0x195e07,null))[_0x93ae('0x23')](function(_0x20f2af){if(_0x20f2af){_0x3323c5[_0x93ae('0x49')]['AccountId']=_0x20f2af['id'];_0x3323c5['body'][_0x93ae('0x4f')]=integrations[_0x93ae('0x50')](_0x3323c5[_0x93ae('0x49')][_0x93ae('0x51')],_0x3323c5[_0x93ae('0x49')][_0x93ae('0x2b')]);_0x3323c5[_0x93ae('0x49')][_0x93ae('0x52')]=integrations[_0x93ae('0x53')](_0x3323c5['body'][_0x93ae('0x51')],_0x3323c5['body']['type']);return db[_0x93ae('0x4c')][_0x93ae('0x48')](_0x3323c5[_0x93ae('0x49')],{'include':[{'model':db[_0x93ae('0x54')],'as':_0x93ae('0x4f')},{'model':db[_0x93ae('0x54')],'as':_0x93ae('0x52')}]});}return null;})[_0x93ae('0x23')](respondWithResult(_0x195e07,null))[_0x93ae('0x42')](handleError(_0x195e07,null));};exports[_0x93ae('0x55')]=function(_0x37aab7,_0x24e2d8,_0x540324){var _0x5b5b5a='';return db[_0x93ae('0x3f')][_0x93ae('0x4b')]({'where':{'id':_0x37aab7[_0x93ae('0x44')]['id']},'attributes':['id','remoteUri',_0x93ae('0x56')]})[_0x93ae('0x23')](handleEntityNotFound(_0x24e2d8,null))[_0x93ae('0x23')](function(_0x4d1693){if(_0x4d1693){_0x5b5b5a=_0x4d1693[_0x93ae('0x57')];var _0x3dceb5=_0x5b5b5a[_0x93ae('0x58')](-0x1);if(_0x3dceb5==='/'){_0x5b5b5a=_0x5b5b5a[_0x93ae('0x59')](0x0,_0x5b5b5a[_0x93ae('0x5a')](_0x3dceb5));}return rp({'method':'GET','uri':util[_0x93ae('0x5b')](_0x93ae('0x5c'),_0x5b5b5a,_0x93ae('0x5d')),'headers':{'Authorization':util['format'](_0x93ae('0x5e'),new Buffer(util[_0x93ae('0x5b')]('%s:X',_0x4d1693[_0x93ae('0x56')]))[_0x93ae('0x5f')](_0x93ae('0x60')))},'json':!![]});}})[_0x93ae('0x23')](function(_0x563fe6){if(_0x563fe6){var _0x26fd6e=['requester',_0x93ae('0x61'),_0x93ae('0x62'),'description',_0x93ae('0x17'),_0x93ae('0x63'),'group',_0x93ae('0x64'),_0x93ae('0x65'),_0x93ae('0x66'),'company'];_[_0x93ae('0x67')](_0x563fe6,function(_0x5d8282){return _0x26fd6e['includes'](_0x5d8282[_0x93ae('0x27')])||!_0x5d8282['default']&&_0x5d8282[_0x93ae('0x2b')]!==_0x93ae('0x68')&&_0x5d8282[_0x93ae('0x2b')]!==_0x93ae('0x69');});return{'count':_0x563fe6[_0x93ae('0x34')],'rows':_[_0x93ae('0x2d')](_0x563fe6,function(_0x3db0e7){return{'id':_0x3db0e7[_0x93ae('0x27')],'name':_0x3db0e7[_0x93ae('0x6a')],'custom':!_0x3db0e7[_0x93ae('0x6b')],'options':_0x3db0e7['choices']?_['map'](_0x3db0e7[_0x93ae('0x6c')],function(_0x470662){return{'name':_[_0x93ae('0x6d')](_0x470662),'value':_0x470662};}):[]};})};}})[_0x93ae('0x23')](respondWithResult(_0x24e2d8,null))[_0x93ae('0x42')](function(_0x574c2c){var _0x91668=_0x37aab7[_0x93ae('0x2e')][_0x93ae('0x6e')]?0x1f4:_0x574c2c[_0x93ae('0x6f')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x91668,JSON[_0x93ae('0x70')](_0x574c2c));delete _0x574c2c['name'];if(_0x91668===0x191){_0x91668=0x190;}_0x24e2d8[_0x93ae('0x17')](_0x91668)[_0x93ae('0x28')](_0x37aab7['query'][_0x93ae('0x6e')]?{'message':_0x93ae('0x71'),'statusCode':_0x574c2c[_0x93ae('0x6f')]}:_0x574c2c);});}; \ No newline at end of file +var _0xb12d=['fields','hasOwnProperty','nolimit','order','where','pick','merge','FreshdeskAccount','includeAll','include','findAll','rows','show','params','length','options','catch','create','body','find','getConfigurations','findOne','FreshdeskConfiguration','rawAttributes','sort','filter','addConfiguration','AccountId','Subjects','getSubjects','channel','FreshdeskField','Descriptions','remoteUri','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','toString','base64','requester','subject','agent','description','priority','group','source','ticket_type','company','default','custom_text','custom_dropdown','choices','capitalize','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x555491,_0x423f2c){var _0x4acccc=function(_0x3b3287){while(--_0x3b3287){_0x555491['push'](_0x555491['shift']());}};_0x4acccc(++_0x423f2c);}(_0xb12d,0x124));var _0xdb12=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0xb12d[_0x3b1b23];return _0x1efc85;};'use strict';var emlformat=require(_0xdb12('0x0'));var rimraf=require(_0xdb12('0x1'));var zipdir=require(_0xdb12('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdb12('0x3'));var moment=require('moment');var BPromise=require(_0xdb12('0x4'));var Mustache=require(_0xdb12('0x5'));var util=require(_0xdb12('0x6'));var path=require(_0xdb12('0x7'));var sox=require(_0xdb12('0x8'));var csv=require(_0xdb12('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdb12('0xa'));var _=require(_0xdb12('0xb'));var squel=require(_0xdb12('0xc'));var crypto=require(_0xdb12('0xd'));var jsforce=require(_0xdb12('0xe'));var deskjs=require(_0xdb12('0xf'));var toCsv=require(_0xdb12('0x9'));var querystring=require(_0xdb12('0x10'));var Papa=require('papaparse');var Redis=require(_0xdb12('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdb12('0x12'));var as=require(_0xdb12('0x13'));var hardwareService=require(_0xdb12('0x14'));var logger=require('../../config/logger')(_0xdb12('0x15'));var utils=require(_0xdb12('0x16'));var config=require(_0xdb12('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xdb12('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3f607f,_0x127a69){_0x127a69=_0x127a69||0xcc;return function(_0x2aa078){if(_0x2aa078){return _0x3f607f['sendStatus'](_0x127a69);}return _0x3f607f[_0xdb12('0x19')](_0x127a69)[_0xdb12('0x1a')]();};}function respondWithResult(_0x55d032,_0x44b39c){_0x44b39c=_0x44b39c||0xc8;return function(_0x490e71){if(_0x490e71){return _0x55d032[_0xdb12('0x19')](_0x44b39c)[_0xdb12('0x1b')](_0x490e71);}};}function respondWithFilteredResult(_0x54a745,_0x1dc8b8){return function(_0x4325a9){if(_0x4325a9){var _0x477a29=typeof _0x1dc8b8[_0xdb12('0x1c')]==='undefined'&&typeof _0x1dc8b8['limit']===_0xdb12('0x1d');var _0x38b639=_0x4325a9['count'];var _0x40d2b9=_0x477a29?0x0:_0x1dc8b8[_0xdb12('0x1c')];var _0x2e1926=_0x477a29?_0x4325a9[_0xdb12('0x1e')]:_0x1dc8b8[_0xdb12('0x1c')]+_0x1dc8b8[_0xdb12('0x1f')];var _0x4481cb;if(_0x2e1926>=_0x38b639){_0x2e1926=_0x38b639;_0x4481cb=0xc8;}else{_0x4481cb=0xce;}_0x54a745[_0xdb12('0x19')](_0x4481cb);return _0x54a745[_0xdb12('0x20')](_0xdb12('0x21'),_0x40d2b9+'-'+_0x2e1926+'/'+_0x38b639)[_0xdb12('0x1b')](_0x4325a9);}return null;};}function patchUpdates(_0x3aaafc){return function(_0x2e40d3){try{jsonpatch[_0xdb12('0x22')](_0x2e40d3,_0x3aaafc,!![]);}catch(_0x37b293){return BPromise['reject'](_0x37b293);}return _0x2e40d3[_0xdb12('0x23')]();};}function saveUpdates(_0x2ae3c9,_0x20aecf){return function(_0x2ff27a){if(_0x2ff27a){return _0x2ff27a[_0xdb12('0x24')](_0x2ae3c9)[_0xdb12('0x25')](function(_0x9dc121){return _0x9dc121;});}return null;};}function removeEntity(_0x32190c,_0x3ae83a){return function(_0x471c50){if(_0x471c50){return _0x471c50[_0xdb12('0x26')]()[_0xdb12('0x25')](function(){_0x32190c[_0xdb12('0x19')](0xcc)[_0xdb12('0x1a')]();});}};}function handleEntityNotFound(_0x182090,_0x1f5a3e){return function(_0x34f8ae){if(!_0x34f8ae){_0x182090[_0xdb12('0x27')](0x194);}return _0x34f8ae;};}function handleError(_0x456395,_0x5ec5af){_0x5ec5af=_0x5ec5af||0x1f4;return function(_0x8cb4d6){logger['error'](_0x8cb4d6['stack']);if(_0x8cb4d6[_0xdb12('0x28')]){delete _0x8cb4d6[_0xdb12('0x28')];}_0x456395[_0xdb12('0x19')](_0x5ec5af)[_0xdb12('0x29')](_0x8cb4d6);};}exports[_0xdb12('0x2a')]=function(_0xa5da71,_0x2187e6){var _0x43131b={},_0x5dd88e={},_0x32a1dd={'count':0x0,'rows':[]};var _0x19d6da=_[_0xdb12('0x2b')](db['FreshdeskAccount']['rawAttributes'],function(_0x3ac501){return{'name':_0x3ac501[_0xdb12('0x2c')],'type':_0x3ac501[_0xdb12('0x2d')][_0xdb12('0x2e')]};});_0x5dd88e[_0xdb12('0x2f')]=_[_0xdb12('0x2b')](_0x19d6da,_0xdb12('0x28'));_0x5dd88e[_0xdb12('0x30')]=_[_0xdb12('0x31')](_0xa5da71[_0xdb12('0x30')]);_0x5dd88e[_0xdb12('0x32')]=_[_0xdb12('0x33')](_0x5dd88e[_0xdb12('0x2f')],_0x5dd88e['query']);_0x43131b[_0xdb12('0x34')]=_[_0xdb12('0x33')](_0x5dd88e['model'],qs['fields'](_0xa5da71[_0xdb12('0x30')][_0xdb12('0x35')]));_0x43131b[_0xdb12('0x34')]=_0x43131b['attributes']['length']?_0x43131b[_0xdb12('0x34')]:_0x5dd88e['model'];if(!_0xa5da71[_0xdb12('0x30')][_0xdb12('0x36')](_0xdb12('0x37'))){_0x43131b[_0xdb12('0x1f')]=qs[_0xdb12('0x1f')](_0xa5da71['query']['limit']);_0x43131b['offset']=qs['offset'](_0xa5da71[_0xdb12('0x30')]['offset']);}_0x43131b[_0xdb12('0x38')]=qs['sort'](_0xa5da71['query']['sort']);_0x43131b[_0xdb12('0x39')]=qs['filters'](_[_0xdb12('0x3a')](_0xa5da71['query'],_0x5dd88e['filters']),_0x19d6da);if(_0xa5da71['query']['filter']){_0x43131b[_0xdb12('0x39')]=_[_0xdb12('0x3b')](_0x43131b[_0xdb12('0x39')],{'$or':_['map'](_0x19d6da,function(_0x1e14dd){if(_0x1e14dd['type']!=='VIRTUAL'){var _0x53da36={};_0x53da36[_0x1e14dd[_0xdb12('0x28')]]={'$like':'%'+_0xa5da71['query']['filter']+'%'};return _0x53da36;}})});}_0x43131b=_[_0xdb12('0x3b')]({},_0x43131b,_0xa5da71['options']);var _0x137136={'where':_0x43131b['where']};return db[_0xdb12('0x3c')][_0xdb12('0x1e')](_0x137136)['then'](function(_0x1fd46c){_0x32a1dd['count']=_0x1fd46c;if(_0xa5da71['query'][_0xdb12('0x3d')]){_0x43131b[_0xdb12('0x3e')]=[{'all':!![]}];}return db[_0xdb12('0x3c')][_0xdb12('0x3f')](_0x43131b);})['then'](function(_0x5ee617){_0x32a1dd[_0xdb12('0x40')]=_0x5ee617;return _0x32a1dd;})[_0xdb12('0x25')](respondWithFilteredResult(_0x2187e6,_0x43131b))['catch'](handleError(_0x2187e6,null));};exports[_0xdb12('0x41')]=function(_0x22bfe2,_0x227e64){var _0x44b13d={'raw':![],'where':{'id':_0x22bfe2[_0xdb12('0x42')]['id']}},_0x53f5f1={};_0x53f5f1[_0xdb12('0x2f')]=_[_0xdb12('0x31')](db[_0xdb12('0x3c')]['rawAttributes']);_0x53f5f1[_0xdb12('0x30')]=_[_0xdb12('0x31')](_0x22bfe2[_0xdb12('0x30')]);_0x53f5f1[_0xdb12('0x32')]=_['intersection'](_0x53f5f1[_0xdb12('0x2f')],_0x53f5f1[_0xdb12('0x30')]);_0x44b13d[_0xdb12('0x34')]=_['intersection'](_0x53f5f1[_0xdb12('0x2f')],qs[_0xdb12('0x35')](_0x22bfe2[_0xdb12('0x30')][_0xdb12('0x35')]));_0x44b13d[_0xdb12('0x34')]=_0x44b13d[_0xdb12('0x34')][_0xdb12('0x43')]?_0x44b13d['attributes']:_0x53f5f1[_0xdb12('0x2f')];if(_0x22bfe2[_0xdb12('0x30')][_0xdb12('0x3d')]){_0x44b13d[_0xdb12('0x3e')]=[{'all':!![]}];}_0x44b13d=_['merge']({},_0x44b13d,_0x22bfe2[_0xdb12('0x44')]);return db[_0xdb12('0x3c')]['find'](_0x44b13d)[_0xdb12('0x25')](handleEntityNotFound(_0x227e64,null))[_0xdb12('0x25')](respondWithResult(_0x227e64,null))[_0xdb12('0x45')](handleError(_0x227e64,null));};exports[_0xdb12('0x46')]=function(_0x31c230,_0x267f9e){return db['FreshdeskAccount'][_0xdb12('0x46')](_0x31c230[_0xdb12('0x47')],{})[_0xdb12('0x25')](respondWithResult(_0x267f9e,0xc9))[_0xdb12('0x45')](handleError(_0x267f9e,null));};exports[_0xdb12('0x24')]=function(_0x2f5b53,_0xdf1329){if(_0x2f5b53['body']['id']){delete _0x2f5b53[_0xdb12('0x47')]['id'];}return db[_0xdb12('0x3c')][_0xdb12('0x48')]({'where':{'id':_0x2f5b53[_0xdb12('0x42')]['id']}})[_0xdb12('0x25')](handleEntityNotFound(_0xdf1329,null))[_0xdb12('0x25')](saveUpdates(_0x2f5b53[_0xdb12('0x47')],null))[_0xdb12('0x25')](respondWithResult(_0xdf1329,null))[_0xdb12('0x45')](handleError(_0xdf1329,null));};exports[_0xdb12('0x26')]=function(_0xcca8dc,_0x2a63ec){return db[_0xdb12('0x3c')][_0xdb12('0x48')]({'where':{'id':_0xcca8dc['params']['id']}})[_0xdb12('0x25')](handleEntityNotFound(_0x2a63ec,null))['then'](removeEntity(_0x2a63ec,null))['catch'](handleError(_0x2a63ec,null));};exports[_0xdb12('0x49')]=function(_0x473ad7,_0x3b7926,_0x9ac248){var _0x166792={};var _0x2189bc={};var _0x4e97d4;var _0x26a508;return db[_0xdb12('0x3c')][_0xdb12('0x4a')]({'where':{'id':_0x473ad7[_0xdb12('0x42')]['id']}})[_0xdb12('0x25')](handleEntityNotFound(_0x3b7926,null))[_0xdb12('0x25')](function(_0x362593){if(_0x362593){_0x4e97d4=_0x362593;_0x2189bc[_0xdb12('0x2f')]=_['keys'](db[_0xdb12('0x4b')][_0xdb12('0x4c')]);_0x2189bc['query']=_['keys'](_0x473ad7['query']);_0x2189bc[_0xdb12('0x32')]=_[_0xdb12('0x33')](_0x2189bc['model'],_0x2189bc['query']);_0x166792['attributes']=_[_0xdb12('0x33')](_0x2189bc[_0xdb12('0x2f')],qs[_0xdb12('0x35')](_0x473ad7[_0xdb12('0x30')][_0xdb12('0x35')]));_0x166792[_0xdb12('0x34')]=_0x166792[_0xdb12('0x34')]['length']?_0x166792[_0xdb12('0x34')]:_0x2189bc[_0xdb12('0x2f')];_0x166792[_0xdb12('0x38')]=qs[_0xdb12('0x4d')](_0x473ad7[_0xdb12('0x30')][_0xdb12('0x4d')]);_0x166792[_0xdb12('0x39')]=qs[_0xdb12('0x32')](_[_0xdb12('0x3a')](_0x473ad7[_0xdb12('0x30')],_0x2189bc[_0xdb12('0x32')]));if(_0x473ad7[_0xdb12('0x30')][_0xdb12('0x4e')]){_0x166792[_0xdb12('0x39')]=_[_0xdb12('0x3b')](_0x166792[_0xdb12('0x39')],{'$or':_['map'](_0x166792['attributes'],function(_0x2092b2){var _0x1384a0={};_0x1384a0[_0x2092b2]={'$like':'%'+_0x473ad7[_0xdb12('0x30')][_0xdb12('0x4e')]+'%'};return _0x1384a0;})});}_0x166792=_[_0xdb12('0x3b')]({},_0x166792,_0x473ad7[_0xdb12('0x44')]);return _0x4e97d4[_0xdb12('0x49')](_0x166792);}})[_0xdb12('0x25')](function(_0x2f0b1f){if(_0x2f0b1f){_0x26a508=_0x2f0b1f[_0xdb12('0x43')];if(!_0x473ad7[_0xdb12('0x30')][_0xdb12('0x36')](_0xdb12('0x37'))){_0x166792[_0xdb12('0x1f')]=qs['limit'](_0x473ad7[_0xdb12('0x30')][_0xdb12('0x1f')]);_0x166792[_0xdb12('0x1c')]=qs['offset'](_0x473ad7['query'][_0xdb12('0x1c')]);}return _0x4e97d4[_0xdb12('0x49')](_0x166792);}})['then'](function(_0x561109){if(_0x561109){return _0x561109?{'count':_0x26a508,'rows':_0x561109}:null;}})[_0xdb12('0x25')](respondWithResult(_0x3b7926,null))[_0xdb12('0x45')](handleError(_0x3b7926,null));};exports[_0xdb12('0x4f')]=function(_0x510358,_0x99c2cb,_0x5bc689){if(_0x510358[_0xdb12('0x47')]['id']){delete _0x510358[_0xdb12('0x47')]['id'];}return db[_0xdb12('0x3c')]['findOne']({'where':{'id':_0x510358[_0xdb12('0x42')]['id']}})[_0xdb12('0x25')](handleEntityNotFound(_0x99c2cb,null))[_0xdb12('0x25')](function(_0x3a0494){if(_0x3a0494){_0x510358[_0xdb12('0x47')][_0xdb12('0x50')]=_0x3a0494['id'];_0x510358[_0xdb12('0x47')][_0xdb12('0x51')]=integrations[_0xdb12('0x52')](_0x510358[_0xdb12('0x47')][_0xdb12('0x53')],_0x510358[_0xdb12('0x47')][_0xdb12('0x2d')]);_0x510358[_0xdb12('0x47')]['Descriptions']=integrations['getDescriptions'](_0x510358[_0xdb12('0x47')][_0xdb12('0x53')],_0x510358[_0xdb12('0x47')][_0xdb12('0x2d')]);return db[_0xdb12('0x4b')][_0xdb12('0x46')](_0x510358[_0xdb12('0x47')],{'include':[{'model':db[_0xdb12('0x54')],'as':_0xdb12('0x51')},{'model':db['FreshdeskField'],'as':_0xdb12('0x55')}]});}return null;})[_0xdb12('0x25')](respondWithResult(_0x99c2cb,null))[_0xdb12('0x45')](handleError(_0x99c2cb,null));};exports['getFields']=function(_0x59d706,_0x16560a,_0x39cc0e){var _0x2bf69e='';return db[_0xdb12('0x3c')]['findOne']({'where':{'id':_0x59d706['params']['id']},'attributes':['id',_0xdb12('0x56'),'apiKey']})[_0xdb12('0x25')](handleEntityNotFound(_0x16560a,null))['then'](function(_0xcf052d){if(_0xcf052d){_0x2bf69e=_0xcf052d[_0xdb12('0x56')];var _0x98a34d=_0x2bf69e['slice'](-0x1);if(_0x98a34d==='/'){_0x2bf69e=_0x2bf69e[_0xdb12('0x57')](0x0,_0x2bf69e[_0xdb12('0x58')](_0x98a34d));}return rp({'method':_0xdb12('0x59'),'uri':util[_0xdb12('0x5a')](_0xdb12('0x5b'),_0x2bf69e,_0xdb12('0x5c')),'headers':{'Authorization':util[_0xdb12('0x5a')](_0xdb12('0x5d'),new Buffer(util[_0xdb12('0x5a')]('%s:X',_0xcf052d['apiKey']))[_0xdb12('0x5e')](_0xdb12('0x5f')))},'json':!![]});}})[_0xdb12('0x25')](function(_0x584903){if(_0x584903){var _0x1386ef=[_0xdb12('0x60'),_0xdb12('0x61'),_0xdb12('0x62'),_0xdb12('0x63'),'status',_0xdb12('0x64'),_0xdb12('0x65'),_0xdb12('0x66'),_0xdb12('0x67'),'group',_0xdb12('0x68')];_['remove'](_0x584903,function(_0x596cbb){return _0x1386ef['includes'](_0x596cbb[_0xdb12('0x28')])||!_0x596cbb[_0xdb12('0x69')]&&_0x596cbb['type']!==_0xdb12('0x6a')&&_0x596cbb[_0xdb12('0x2d')]!==_0xdb12('0x6b');});return{'count':_0x584903[_0xdb12('0x43')],'rows':_['map'](_0x584903,function(_0x1ca5cf){return{'id':_0x1ca5cf['name'],'name':_0x1ca5cf['label'],'custom':!_0x1ca5cf[_0xdb12('0x69')],'options':_0x1ca5cf['choices']?_['map'](_0x1ca5cf[_0xdb12('0x6c')],function(_0x167584){return{'name':_[_0xdb12('0x6d')](_0x167584),'value':_0x167584};}):[]};})};}})[_0xdb12('0x25')](respondWithResult(_0x16560a,null))[_0xdb12('0x45')](function(_0x5d23ca){var _0x1f457a=_0x59d706['query']['test']?0x1f4:_0x5d23ca[_0xdb12('0x6e')]||0x1f4;logger[_0xdb12('0x6f')](_0xdb12('0x70'),_0xdb12('0x71'),_0x1f457a,JSON['stringify'](_0x5d23ca));delete _0x5d23ca[_0xdb12('0x28')];if(_0x1f457a===0x191){_0x1f457a=0x190;}_0x16560a[_0xdb12('0x19')](_0x1f457a)[_0xdb12('0x29')](_0x59d706[_0xdb12('0x30')]['test']?{'message':_0xdb12('0x72'),'statusCode':_0x5d23ca[_0xdb12('0x6e')]}:_0x5d23ca);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index b15e400..1ed5bc7 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 _0x12d0=['request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','lodash','util','moment','bluebird'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x12d0,0x188));var _0x012d=function(_0x579d9e,_0x36f172){_0x579d9e=_0x579d9e-0x0;var _0x246ec1=_0x12d0[_0x579d9e];return _0x246ec1;};'use strict';var _=require(_0x012d('0x0'));var util=require(_0x012d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x012d('0x2'));var BPromise=require(_0x012d('0x3'));var rp=require(_0x012d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x012d('0x5'));var config=require(_0x012d('0x6'));var attributes=require(_0x012d('0x7'));var integrations=require(_0x012d('0x8'));module[_0x012d('0x9')]=function(_0x213c6d,_0x2a0856){return _0x213c6d['define'](_0x012d('0xa'),attributes,{'tableName':_0x012d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1fc3=['int_freshdesk_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount'];(function(_0x26f06e,_0x3ff221){var _0x3d6def=function(_0x359009){while(--_0x359009){_0x26f06e['push'](_0x26f06e['shift']());}};_0x3d6def(++_0x3ff221);}(_0x1fc3,0x178));var _0x31fc=function(_0x108337,_0x249db3){_0x108337=_0x108337-0x0;var _0x53979d=_0x1fc3[_0x108337];return _0x53979d;};'use strict';var _=require(_0x31fc('0x0'));var util=require(_0x31fc('0x1'));var logger=require(_0x31fc('0x2'))(_0x31fc('0x3'));var moment=require('moment');var BPromise=require(_0x31fc('0x4'));var rp=require(_0x31fc('0x5'));var fs=require('fs');var path=require(_0x31fc('0x6'));var rimraf=require(_0x31fc('0x7'));var config=require(_0x31fc('0x8'));var attributes=require(_0x31fc('0x9'));var integrations=require(_0x31fc('0xa'));module[_0x31fc('0xb')]=function(_0x2626e3,_0x35a285){return _0x2626e3[_0x31fc('0xc')](_0x31fc('0xd'),attributes,{'tableName':_0x31fc('0xe'),'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 680efde..56507c5 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 _0x6c70=['find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','info','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','catch','GetFreshdeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','then','ShowFreshdeskAccount','FreshdeskAccount'];(function(_0x2bd88d,_0x2d5dc3){var _0x5516d4=function(_0x1272c8){while(--_0x1272c8){_0x2bd88d['push'](_0x2bd88d['shift']());}};_0x5516d4(++_0x2d5dc3);}(_0x6c70,0x1f0));var _0x06c7=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x6c70[_0x2763f2];return _0x3ef471;};'use strict';var _=require('lodash');var util=require(_0x06c7('0x0'));var moment=require('moment');var BPromise=require(_0x06c7('0x1'));var rs=require(_0x06c7('0x2'));var fs=require('fs');var Redis=require(_0x06c7('0x3'));var db=require(_0x06c7('0x4'))['db'];var utils=require(_0x06c7('0x5'));var logger=require('../../config/logger')(_0x06c7('0x6'));var config=require(_0x06c7('0x7'));var jayson=require(_0x06c7('0x8'));var client=jayson[_0x06c7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e92c0,_0x5ee2bc,_0x1cea79){return new BPromise(function(_0x506364,_0x4fe039){return client['request'](_0x4e92c0,_0x1cea79)['then'](function(_0xfd0a3b){logger[_0x06c7('0xa')]('FreshdeskAccount,\x20%s,\x20%s',_0x5ee2bc,'request\x20sent');logger[_0x06c7('0xb')](_0x06c7('0xc'),_0x5ee2bc,'request\x20sent',JSON[_0x06c7('0xd')](_0xfd0a3b));if(_0xfd0a3b[_0x06c7('0xe')]){if(_0xfd0a3b[_0x06c7('0xe')]['code']===0x1f4){logger[_0x06c7('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x5ee2bc,_0xfd0a3b[_0x06c7('0xe')]['message']);return _0x4fe039(_0xfd0a3b[_0x06c7('0xe')][_0x06c7('0xf')]);}logger[_0x06c7('0xe')](_0x06c7('0x10'),_0x5ee2bc,_0xfd0a3b[_0x06c7('0xe')][_0x06c7('0xf')]);return _0x506364(_0xfd0a3b[_0x06c7('0xe')][_0x06c7('0xf')]);}else{logger[_0x06c7('0xa')](_0x06c7('0x10'),_0x5ee2bc,_0x06c7('0x11'));_0x506364(_0xfd0a3b['result'][_0x06c7('0xf')]);}})[_0x06c7('0x12')](function(_0x51c898){logger['error'](_0x06c7('0x10'),_0x5ee2bc,_0x51c898);_0x4fe039(_0x51c898);});});}exports[_0x06c7('0x13')]=function(_0x96a716){var _0x472607=this;return new Promise(function(_0x158664,_0x2dd2f6){return db['FreshdeskAccount'][_0x06c7('0x14')]({'raw':_0x96a716[_0x06c7('0x15')]?_0x96a716[_0x06c7('0x15')][_0x06c7('0x16')]===undefined?!![]:![]:!![],'where':_0x96a716[_0x06c7('0x15')]?_0x96a716[_0x06c7('0x15')][_0x06c7('0x17')]||null:null,'attributes':_0x96a716['options']?_0x96a716[_0x06c7('0x15')]['attributes']||null:null,'limit':_0x96a716[_0x06c7('0x15')]?_0x96a716['options'][_0x06c7('0x18')]||null:null,'include':_0x96a716[_0x06c7('0x15')]?_0x96a716[_0x06c7('0x15')][_0x06c7('0x19')]?_[_0x06c7('0x1a')](_0x96a716['options'][_0x06c7('0x19')],function(_0x5b2712){return{'model':db[_0x5b2712[_0x06c7('0x1b')]],'as':_0x5b2712['as'],'attributes':_0x5b2712[_0x06c7('0x1c')],'include':_0x5b2712['include']?_['map'](_0x5b2712['include'],function(_0x17dc4b){return{'model':db[_0x17dc4b[_0x06c7('0x1b')]],'as':_0x17dc4b['as'],'attributes':_0x17dc4b[_0x06c7('0x1c')],'include':_0x17dc4b[_0x06c7('0x19')]?_['map'](_0x17dc4b[_0x06c7('0x19')],function(_0x273ce7){return{'model':db[_0x273ce7[_0x06c7('0x1b')]],'as':_0x273ce7['as'],'attributes':_0x273ce7[_0x06c7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x06c7('0x1d')](function(_0x1c1c19){logger[_0x06c7('0xa')](_0x06c7('0x13'),_0x96a716);logger[_0x06c7('0xb')](_0x06c7('0x13'),_0x96a716,JSON[_0x06c7('0xd')](_0x1c1c19));_0x158664(_0x1c1c19);})[_0x06c7('0x12')](function(_0x45aad5){logger['error'](_0x06c7('0x13'),_0x45aad5[_0x06c7('0xf')],_0x96a716);_0x2dd2f6(_0x472607[_0x06c7('0xe')](0x1f4,_0x45aad5[_0x06c7('0xf')]));});});};exports[_0x06c7('0x1e')]=function(_0x1fe4f1){var _0x497131=this;return new Promise(function(_0x59849b,_0x3d0ca7){return db[_0x06c7('0x1f')][_0x06c7('0x20')]({'raw':_0x1fe4f1[_0x06c7('0x15')]?_0x1fe4f1[_0x06c7('0x15')][_0x06c7('0x16')]===undefined?!![]:![]:!![],'where':_0x1fe4f1[_0x06c7('0x15')]?_0x1fe4f1[_0x06c7('0x15')][_0x06c7('0x17')]||null:null,'attributes':_0x1fe4f1[_0x06c7('0x15')]?_0x1fe4f1['options'][_0x06c7('0x1c')]||null:null,'include':_0x1fe4f1[_0x06c7('0x15')]?_0x1fe4f1[_0x06c7('0x15')][_0x06c7('0x19')]?_['map'](_0x1fe4f1[_0x06c7('0x15')][_0x06c7('0x19')],function(_0x5a661d){return{'model':db[_0x5a661d[_0x06c7('0x1b')]],'as':_0x5a661d['as'],'attributes':_0x5a661d[_0x06c7('0x1c')],'include':_0x5a661d[_0x06c7('0x19')]?_['map'](_0x5a661d[_0x06c7('0x19')],function(_0xdb84a5){return{'model':db[_0xdb84a5[_0x06c7('0x1b')]],'as':_0xdb84a5['as'],'attributes':_0xdb84a5[_0x06c7('0x1c')],'include':_0xdb84a5[_0x06c7('0x19')]?_[_0x06c7('0x1a')](_0xdb84a5[_0x06c7('0x19')],function(_0x229745){return{'model':db[_0x229745[_0x06c7('0x1b')]],'as':_0x229745['as'],'attributes':_0x229745[_0x06c7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x06c7('0x1d')](function(_0x48dbcf){logger[_0x06c7('0xa')]('ShowFreshdeskAccount',_0x1fe4f1);logger[_0x06c7('0xb')](_0x06c7('0x1e'),_0x1fe4f1,JSON[_0x06c7('0xd')](_0x48dbcf));_0x59849b(_0x48dbcf);})['catch'](function(_0x61d0e9){logger['error'](_0x06c7('0x1e'),_0x61d0e9[_0x06c7('0xf')],_0x1fe4f1);_0x3d0ca7(_0x497131[_0x06c7('0xe')](0x1f4,_0x61d0e9[_0x06c7('0xf')]));});});}; \ No newline at end of file +var _0xc38d=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','GetFreshdeskAccount','options','raw','where','attributes','limit','map','include','model','ShowFreshdeskAccount','FreshdeskAccount'];(function(_0x2df2eb,_0x3959a0){var _0xa5abb9=function(_0x49830e){while(--_0x49830e){_0x2df2eb['push'](_0x2df2eb['shift']());}};_0xa5abb9(++_0x3959a0);}(_0xc38d,0x110));var _0xdc38=function(_0xf41566,_0xce102f){_0xf41566=_0xf41566-0x0;var _0x5a05c1=_0xc38d[_0xf41566];return _0x5a05c1;};'use strict';var _=require(_0xdc38('0x0'));var util=require(_0xdc38('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdc38('0x2'));var fs=require('fs');var Redis=require(_0xdc38('0x3'));var db=require(_0xdc38('0x4'))['db'];var utils=require(_0xdc38('0x5'));var logger=require(_0xdc38('0x6'))(_0xdc38('0x7'));var config=require(_0xdc38('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdc38('0x9')][_0xdc38('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58809b,_0x207f67,_0x4b5f47){return new BPromise(function(_0x1b952a,_0x81d274){return client[_0xdc38('0xb')](_0x58809b,_0x4b5f47)[_0xdc38('0xc')](function(_0x2c6954){logger[_0xdc38('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x207f67,_0xdc38('0xe'));logger[_0xdc38('0xf')](_0xdc38('0x10'),_0x207f67,_0xdc38('0xe'),JSON[_0xdc38('0x11')](_0x2c6954));if(_0x2c6954['error']){if(_0x2c6954['error']['code']===0x1f4){logger[_0xdc38('0x12')](_0xdc38('0x13'),_0x207f67,_0x2c6954['error'][_0xdc38('0x14')]);return _0x81d274(_0x2c6954[_0xdc38('0x12')][_0xdc38('0x14')]);}logger['error'](_0xdc38('0x13'),_0x207f67,_0x2c6954[_0xdc38('0x12')][_0xdc38('0x14')]);return _0x1b952a(_0x2c6954['error'][_0xdc38('0x14')]);}else{logger[_0xdc38('0xd')](_0xdc38('0x13'),_0x207f67,'request\x20sent');_0x1b952a(_0x2c6954[_0xdc38('0x15')]['message']);}})[_0xdc38('0x16')](function(_0xc8205d){logger[_0xdc38('0x12')](_0xdc38('0x13'),_0x207f67,_0xc8205d);_0x81d274(_0xc8205d);});});}exports[_0xdc38('0x17')]=function(_0x29627b){var _0x4c38b2=this;return new Promise(function(_0x1a3e81,_0x4352be){return db['FreshdeskAccount']['findAll']({'raw':_0x29627b[_0xdc38('0x18')]?_0x29627b[_0xdc38('0x18')][_0xdc38('0x19')]===undefined?!![]:![]:!![],'where':_0x29627b[_0xdc38('0x18')]?_0x29627b[_0xdc38('0x18')][_0xdc38('0x1a')]||null:null,'attributes':_0x29627b[_0xdc38('0x18')]?_0x29627b['options'][_0xdc38('0x1b')]||null:null,'limit':_0x29627b[_0xdc38('0x18')]?_0x29627b['options'][_0xdc38('0x1c')]||null:null,'include':_0x29627b[_0xdc38('0x18')]?_0x29627b[_0xdc38('0x18')]['include']?_[_0xdc38('0x1d')](_0x29627b[_0xdc38('0x18')][_0xdc38('0x1e')],function(_0x2c5a96){return{'model':db[_0x2c5a96['model']],'as':_0x2c5a96['as'],'attributes':_0x2c5a96[_0xdc38('0x1b')],'include':_0x2c5a96['include']?_[_0xdc38('0x1d')](_0x2c5a96[_0xdc38('0x1e')],function(_0x19959f){return{'model':db[_0x19959f[_0xdc38('0x1f')]],'as':_0x19959f['as'],'attributes':_0x19959f[_0xdc38('0x1b')],'include':_0x19959f[_0xdc38('0x1e')]?_[_0xdc38('0x1d')](_0x19959f[_0xdc38('0x1e')],function(_0x205571){return{'model':db[_0x205571[_0xdc38('0x1f')]],'as':_0x205571['as'],'attributes':_0x205571['attributes']};}):[]};}):[]};}):[]:[]})[_0xdc38('0xc')](function(_0xc6f6dd){logger[_0xdc38('0xd')](_0xdc38('0x17'),_0x29627b);logger[_0xdc38('0xf')](_0xdc38('0x17'),_0x29627b,JSON[_0xdc38('0x11')](_0xc6f6dd));_0x1a3e81(_0xc6f6dd);})[_0xdc38('0x16')](function(_0x5cc211){logger[_0xdc38('0x12')](_0xdc38('0x17'),_0x5cc211[_0xdc38('0x14')],_0x29627b);_0x4352be(_0x4c38b2[_0xdc38('0x12')](0x1f4,_0x5cc211['message']));});});};exports[_0xdc38('0x20')]=function(_0x2d54e5){var _0x1a3637=this;return new Promise(function(_0x143141,_0x39ae82){return db[_0xdc38('0x21')]['find']({'raw':_0x2d54e5[_0xdc38('0x18')]?_0x2d54e5[_0xdc38('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2d54e5['options']?_0x2d54e5[_0xdc38('0x18')][_0xdc38('0x1a')]||null:null,'attributes':_0x2d54e5['options']?_0x2d54e5[_0xdc38('0x18')][_0xdc38('0x1b')]||null:null,'include':_0x2d54e5[_0xdc38('0x18')]?_0x2d54e5[_0xdc38('0x18')][_0xdc38('0x1e')]?_[_0xdc38('0x1d')](_0x2d54e5[_0xdc38('0x18')]['include'],function(_0x24b130){return{'model':db[_0x24b130[_0xdc38('0x1f')]],'as':_0x24b130['as'],'attributes':_0x24b130[_0xdc38('0x1b')],'include':_0x24b130[_0xdc38('0x1e')]?_[_0xdc38('0x1d')](_0x24b130['include'],function(_0x303909){return{'model':db[_0x303909[_0xdc38('0x1f')]],'as':_0x303909['as'],'attributes':_0x303909[_0xdc38('0x1b')],'include':_0x303909[_0xdc38('0x1e')]?_[_0xdc38('0x1d')](_0x303909[_0xdc38('0x1e')],function(_0xd1c100){return{'model':db[_0xd1c100['model']],'as':_0xd1c100['as'],'attributes':_0xd1c100['attributes']};}):[]};}):[]};}):[]:[]})[_0xdc38('0xc')](function(_0x360570){logger[_0xdc38('0xd')](_0xdc38('0x20'),_0x2d54e5);logger[_0xdc38('0xf')](_0xdc38('0x20'),_0x2d54e5,JSON[_0xdc38('0x11')](_0x360570));_0x143141(_0x360570);})[_0xdc38('0x16')](function(_0x24cb4b){logger['error'](_0xdc38('0x20'),_0x24cb4b['message'],_0x2d54e5);_0x39ae82(_0x1a3637[_0xdc38('0x12')](0x1f4,_0x24cb4b[_0xdc38('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index dba408b..0bd8a56 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 _0x9d09=['multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','put','/:id','update','delete','destroy','exports'];(function(_0x2e4cbf,_0x8763d3){var _0x52840f=function(_0x31b93f){while(--_0x31b93f){_0x2e4cbf['push'](_0x2e4cbf['shift']());}};_0x52840f(++_0x8763d3);}(_0x9d09,0xb6));var _0x99d0=function(_0x58ba97,_0x4d0187){_0x58ba97=_0x58ba97-0x0;var _0x34110e=_0x9d09[_0x58ba97];return _0x34110e;};'use strict';var multer=require(_0x99d0('0x0'));var util=require(_0x99d0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x99d0('0x2'));var router=express['Router']();var fs_extra=require(_0x99d0('0x3'));var auth=require(_0x99d0('0x4'));var interaction=require(_0x99d0('0x5'));var config=require('../../config/environment');var controller=require(_0x99d0('0x6'));router[_0x99d0('0x7')]('/',auth[_0x99d0('0x8')](),controller[_0x99d0('0x9')]);router[_0x99d0('0x7')]('/:id',auth[_0x99d0('0x8')](),controller[_0x99d0('0xa')]);router[_0x99d0('0x7')](_0x99d0('0xb'),auth['isAuthenticated'](),controller[_0x99d0('0xc')]);router[_0x99d0('0x7')](_0x99d0('0xd'),auth[_0x99d0('0x8')](),controller['getSubjects']);router[_0x99d0('0x7')](_0x99d0('0xe'),auth[_0x99d0('0x8')](),controller[_0x99d0('0xf')]);router[_0x99d0('0x7')](_0x99d0('0x10'),auth['isAuthenticated'](),controller['getTags']);router[_0x99d0('0x11')]('/',auth['isAuthenticated'](),controller[_0x99d0('0x12')]);router[_0x99d0('0x11')](_0x99d0('0x10'),auth['isAuthenticated'](),controller[_0x99d0('0x13')]);router[_0x99d0('0x14')](_0x99d0('0x15'),auth[_0x99d0('0x8')](),controller[_0x99d0('0x16')]);router[_0x99d0('0x17')](_0x99d0('0x15'),auth[_0x99d0('0x8')](),controller[_0x99d0('0x18')]);module[_0x99d0('0x19')]=router; \ No newline at end of file +var _0x4c96=['delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put'];(function(_0x1cb247,_0x401c73){var _0x338700=function(_0x593f32){while(--_0x593f32){_0x1cb247['push'](_0x1cb247['shift']());}};_0x338700(++_0x401c73);}(_0x4c96,0xa6));var _0x64c9=function(_0x4e075f,_0x1c94d2){_0x4e075f=_0x4e075f-0x0;var _0x17c45e=_0x4c96[_0x4e075f];return _0x17c45e;};'use strict';var multer=require(_0x64c9('0x0'));var util=require(_0x64c9('0x1'));var path=require(_0x64c9('0x2'));var timeout=require(_0x64c9('0x3'));var express=require(_0x64c9('0x4'));var router=express[_0x64c9('0x5')]();var fs_extra=require(_0x64c9('0x6'));var auth=require(_0x64c9('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x64c9('0x8'));router[_0x64c9('0x9')]('/',auth[_0x64c9('0xa')](),controller['index']);router[_0x64c9('0x9')]('/:id',auth[_0x64c9('0xa')](),controller['show']);router[_0x64c9('0x9')](_0x64c9('0xb'),auth[_0x64c9('0xa')](),controller[_0x64c9('0xc')]);router['get'](_0x64c9('0xd'),auth[_0x64c9('0xa')](),controller[_0x64c9('0xe')]);router[_0x64c9('0x9')](_0x64c9('0xf'),auth[_0x64c9('0xa')](),controller[_0x64c9('0x10')]);router[_0x64c9('0x9')](_0x64c9('0x11'),auth[_0x64c9('0xa')](),controller[_0x64c9('0x12')]);router[_0x64c9('0x13')]('/',auth[_0x64c9('0xa')](),controller[_0x64c9('0x14')]);router['post']('/:id/tags',auth[_0x64c9('0xa')](),controller[_0x64c9('0x15')]);router[_0x64c9('0x16')]('/:id',auth[_0x64c9('0xa')](),controller['update']);router[_0x64c9('0x17')](_0x64c9('0x18'),auth['isAuthenticated'](),controller[_0x64c9('0x19')]);module[_0x64c9('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index f7aff2c..bc0c742 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 _0x1801=['sequelize'];(function(_0x24883d,_0x1988b7){var _0x30929c=function(_0x35627c){while(--_0x35627c){_0x24883d['push'](_0x24883d['shift']());}};_0x30929c(++_0x1988b7);}(_0x1801,0x159));var _0x1180=function(_0x1fe0be,_0x4670da){_0x1fe0be=_0x1fe0be-0x0;var _0x2bf403=_0x1801[_0x1fe0be];return _0x2bf403;};'use strict';var Sequelize=require(_0x1180('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb5bf=['STRING','sequelize'];(function(_0x534c04,_0x54d3a7){var _0x27fd87=function(_0x2ffef0){while(--_0x2ffef0){_0x534c04['push'](_0x534c04['shift']());}};_0x27fd87(++_0x54d3a7);}(_0xb5bf,0x1ef));var _0xfb5b=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0xb5bf[_0xb24a3e];return _0x4038d7;};'use strict';var Sequelize=require(_0xfb5b('0x0'));module['exports']={'name':{'type':Sequelize[_0xfb5b('0x1')]},'description':{'type':Sequelize[_0xfb5b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index e45286c..f52e801 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 _0xaf83=['sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','error','name','send','map','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','VIRTUAL','filter','includeAll','include','FreshdeskConfiguration','findAll','rows','catch','show','params','keys','merge','options','find','create','body','getFields','FreshdeskField','pick','nolimit','getSubjects','getDescriptions','Tag','getTags','setTags','findOne','ids','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xaf83,0x1d5));var _0x3af8=function(_0x4e4ad6,_0x3217b6){_0x4e4ad6=_0x4e4ad6-0x0;var _0x3a5b9f=_0xaf83[_0x4e4ad6];return _0x3a5b9f;};'use strict';var emlformat=require(_0x3af8('0x0'));var rimraf=require(_0x3af8('0x1'));var zipdir=require(_0x3af8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3af8('0x3'));var moment=require('moment');var BPromise=require(_0x3af8('0x4'));var Mustache=require(_0x3af8('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3af8('0x6'));var fs=require('fs');var fs_extra=require(_0x3af8('0x7'));var _=require(_0x3af8('0x8'));var squel=require(_0x3af8('0x9'));var crypto=require(_0x3af8('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3af8('0xb'));var toCsv=require(_0x3af8('0xc'));var querystring=require(_0x3af8('0xd'));var Papa=require('papaparse');var Redis=require(_0x3af8('0xe'));var authService=require(_0x3af8('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3af8('0x10'));var hardwareService=require(_0x3af8('0x11'));var logger=require(_0x3af8('0x12'))(_0x3af8('0x13'));var utils=require(_0x3af8('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3af8('0x15'));var db=require(_0x3af8('0x16'))['db'];function respondWithStatusCode(_0x3852d4,_0xba97d9){_0xba97d9=_0xba97d9||0xcc;return function(_0x3d8ea9){if(_0x3d8ea9){return _0x3852d4[_0x3af8('0x17')](_0xba97d9);}return _0x3852d4[_0x3af8('0x18')](_0xba97d9)[_0x3af8('0x19')]();};}function respondWithResult(_0x487432,_0x2899b0){_0x2899b0=_0x2899b0||0xc8;return function(_0x11c6f3){if(_0x11c6f3){return _0x487432[_0x3af8('0x18')](_0x2899b0)[_0x3af8('0x1a')](_0x11c6f3);}};}function respondWithFilteredResult(_0x20af87,_0x5c80b5){return function(_0x1d095e){if(_0x1d095e){var _0x4da5f6=typeof _0x5c80b5[_0x3af8('0x1b')]===_0x3af8('0x1c')&&typeof _0x5c80b5['limit']===_0x3af8('0x1c');var _0x485010=_0x1d095e[_0x3af8('0x1d')];var _0x2b35fb=_0x4da5f6?0x0:_0x5c80b5[_0x3af8('0x1b')];var _0x842bd6=_0x4da5f6?_0x1d095e['count']:_0x5c80b5[_0x3af8('0x1b')]+_0x5c80b5[_0x3af8('0x1e')];var _0x4133a4;if(_0x842bd6>=_0x485010){_0x842bd6=_0x485010;_0x4133a4=0xc8;}else{_0x4133a4=0xce;}_0x20af87['status'](_0x4133a4);return _0x20af87[_0x3af8('0x1f')]('Content-Range',_0x2b35fb+'-'+_0x842bd6+'/'+_0x485010)[_0x3af8('0x1a')](_0x1d095e);}return null;};}function patchUpdates(_0x1c00ce){return function(_0x56ca7c){try{jsonpatch['apply'](_0x56ca7c,_0x1c00ce,!![]);}catch(_0x5aaa76){return BPromise[_0x3af8('0x20')](_0x5aaa76);}return _0x56ca7c[_0x3af8('0x21')]();};}function saveUpdates(_0x4f21ca,_0x4173a3){return function(_0x2bb7e5){if(_0x2bb7e5){return _0x2bb7e5[_0x3af8('0x22')](_0x4f21ca)[_0x3af8('0x23')](function(_0x332112){return _0x332112;});}return null;};}function removeEntity(_0x26cd9b,_0x1433cd){return function(_0x5ed84f){if(_0x5ed84f){return _0x5ed84f[_0x3af8('0x24')]()[_0x3af8('0x23')](function(){_0x26cd9b[_0x3af8('0x18')](0xcc)[_0x3af8('0x19')]();});}};}function handleEntityNotFound(_0x118c4b,_0x27bac4){return function(_0x3e15de){if(!_0x3e15de){_0x118c4b[_0x3af8('0x17')](0x194);}return _0x3e15de;};}function handleError(_0x2e303d,_0x49143f){_0x49143f=_0x49143f||0x1f4;return function(_0xaffac6){logger[_0x3af8('0x25')](_0xaffac6['stack']);if(_0xaffac6[_0x3af8('0x26')]){delete _0xaffac6[_0x3af8('0x26')];}_0x2e303d['status'](_0x49143f)[_0x3af8('0x27')](_0xaffac6);};}exports['index']=function(_0x583ef5,_0x3ac1c8){var _0x1821e0={},_0x59726e={},_0x1863f5={'count':0x0,'rows':[]};var _0x5a9b97=_[_0x3af8('0x28')](db['FreshdeskConfiguration'][_0x3af8('0x29')],function(_0x31f363){return{'name':_0x31f363['fieldName'],'type':_0x31f363[_0x3af8('0x2a')][_0x3af8('0x2b')]};});_0x59726e[_0x3af8('0x2c')]=_[_0x3af8('0x28')](_0x5a9b97,_0x3af8('0x26'));_0x59726e['query']=_['keys'](_0x583ef5[_0x3af8('0x2d')]);_0x59726e[_0x3af8('0x2e')]=_['intersection'](_0x59726e[_0x3af8('0x2c')],_0x59726e[_0x3af8('0x2d')]);_0x1821e0[_0x3af8('0x2f')]=_[_0x3af8('0x30')](_0x59726e[_0x3af8('0x2c')],qs[_0x3af8('0x31')](_0x583ef5['query']['fields']));_0x1821e0['attributes']=_0x1821e0[_0x3af8('0x2f')][_0x3af8('0x32')]?_0x1821e0[_0x3af8('0x2f')]:_0x59726e[_0x3af8('0x2c')];if(!_0x583ef5[_0x3af8('0x2d')][_0x3af8('0x33')]('nolimit')){_0x1821e0[_0x3af8('0x1e')]=qs[_0x3af8('0x1e')](_0x583ef5[_0x3af8('0x2d')]['limit']);_0x1821e0[_0x3af8('0x1b')]=qs[_0x3af8('0x1b')](_0x583ef5[_0x3af8('0x2d')][_0x3af8('0x1b')]);}_0x1821e0[_0x3af8('0x34')]=qs[_0x3af8('0x35')](_0x583ef5['query']['sort']);_0x1821e0['where']=qs[_0x3af8('0x2e')](_['pick'](_0x583ef5[_0x3af8('0x2d')],_0x59726e[_0x3af8('0x2e')]),_0x5a9b97);if(_0x583ef5[_0x3af8('0x2d')]['filter']){_0x1821e0[_0x3af8('0x36')]=_['merge'](_0x1821e0[_0x3af8('0x36')],{'$or':_[_0x3af8('0x28')](_0x5a9b97,function(_0x44f2bf){if(_0x44f2bf['type']!==_0x3af8('0x37')){var _0x4eefac={};_0x4eefac[_0x44f2bf[_0x3af8('0x26')]]={'$like':'%'+_0x583ef5[_0x3af8('0x2d')][_0x3af8('0x38')]+'%'};return _0x4eefac;}})});}_0x1821e0=_['merge']({},_0x1821e0,_0x583ef5['options']);var _0x59c9a4={'where':_0x1821e0[_0x3af8('0x36')]};return db['FreshdeskConfiguration'][_0x3af8('0x1d')](_0x59c9a4)[_0x3af8('0x23')](function(_0x3a6382){_0x1863f5[_0x3af8('0x1d')]=_0x3a6382;if(_0x583ef5[_0x3af8('0x2d')][_0x3af8('0x39')]){_0x1821e0[_0x3af8('0x3a')]=[{'all':!![]}];}return db[_0x3af8('0x3b')][_0x3af8('0x3c')](_0x1821e0);})[_0x3af8('0x23')](function(_0x4809df){_0x1863f5[_0x3af8('0x3d')]=_0x4809df;return _0x1863f5;})[_0x3af8('0x23')](respondWithFilteredResult(_0x3ac1c8,_0x1821e0))[_0x3af8('0x3e')](handleError(_0x3ac1c8,null));};exports[_0x3af8('0x3f')]=function(_0x5b137c,_0x422ed1){var _0x16b2d5={'raw':![],'where':{'id':_0x5b137c[_0x3af8('0x40')]['id']}},_0xc1b209={};_0xc1b209[_0x3af8('0x2c')]=_[_0x3af8('0x41')](db[_0x3af8('0x3b')][_0x3af8('0x29')]);_0xc1b209[_0x3af8('0x2d')]=_['keys'](_0x5b137c[_0x3af8('0x2d')]);_0xc1b209[_0x3af8('0x2e')]=_[_0x3af8('0x30')](_0xc1b209['model'],_0xc1b209[_0x3af8('0x2d')]);_0x16b2d5[_0x3af8('0x2f')]=_[_0x3af8('0x30')](_0xc1b209[_0x3af8('0x2c')],qs[_0x3af8('0x31')](_0x5b137c[_0x3af8('0x2d')]['fields']));_0x16b2d5[_0x3af8('0x2f')]=_0x16b2d5[_0x3af8('0x2f')]['length']?_0x16b2d5[_0x3af8('0x2f')]:_0xc1b209[_0x3af8('0x2c')];if(_0x5b137c['query'][_0x3af8('0x39')]){_0x16b2d5[_0x3af8('0x3a')]=[{'all':!![]}];}_0x16b2d5=_[_0x3af8('0x42')]({},_0x16b2d5,_0x5b137c[_0x3af8('0x43')]);return db[_0x3af8('0x3b')][_0x3af8('0x44')](_0x16b2d5)[_0x3af8('0x23')](handleEntityNotFound(_0x422ed1,null))[_0x3af8('0x23')](respondWithResult(_0x422ed1,null))[_0x3af8('0x3e')](handleError(_0x422ed1,null));};exports[_0x3af8('0x45')]=function(_0x172c27,_0x41111a){return db[_0x3af8('0x3b')]['create'](_0x172c27[_0x3af8('0x46')],{})[_0x3af8('0x23')](respondWithResult(_0x41111a,0xc9))[_0x3af8('0x3e')](handleError(_0x41111a,null));};exports['update']=function(_0x46948e,_0x2d9630){if(_0x46948e[_0x3af8('0x46')]['id']){delete _0x46948e['body']['id'];}return db[_0x3af8('0x3b')]['find']({'where':{'id':_0x46948e[_0x3af8('0x40')]['id']}})[_0x3af8('0x23')](handleEntityNotFound(_0x2d9630,null))[_0x3af8('0x23')](saveUpdates(_0x46948e[_0x3af8('0x46')],null))[_0x3af8('0x23')](respondWithResult(_0x2d9630,null))[_0x3af8('0x3e')](handleError(_0x2d9630,null));};exports['destroy']=function(_0x2ec370,_0x1dfef4){return db[_0x3af8('0x3b')]['find']({'where':{'id':_0x2ec370[_0x3af8('0x40')]['id']}})['then'](handleEntityNotFound(_0x1dfef4,null))[_0x3af8('0x23')](removeEntity(_0x1dfef4,null))['catch'](handleError(_0x1dfef4,null));};exports[_0x3af8('0x47')]=function(_0x2d7db8,_0x5a4409,_0x408a33){var _0x478c65={};var _0x2eff40={};var _0xf09d89;var _0x3a7249;return db[_0x3af8('0x3b')]['findOne']({'where':{'id':_0x2d7db8[_0x3af8('0x40')]['id']}})[_0x3af8('0x23')](handleEntityNotFound(_0x5a4409,null))[_0x3af8('0x23')](function(_0x2d39d0){if(_0x2d39d0){_0xf09d89=_0x2d39d0;_0x2eff40[_0x3af8('0x2c')]=_[_0x3af8('0x41')](db[_0x3af8('0x48')][_0x3af8('0x29')]);_0x2eff40[_0x3af8('0x2d')]=_[_0x3af8('0x41')](_0x2d7db8['query']);_0x2eff40[_0x3af8('0x2e')]=_[_0x3af8('0x30')](_0x2eff40[_0x3af8('0x2c')],_0x2eff40[_0x3af8('0x2d')]);_0x478c65[_0x3af8('0x2f')]=_['intersection'](_0x2eff40[_0x3af8('0x2c')],qs[_0x3af8('0x31')](_0x2d7db8[_0x3af8('0x2d')][_0x3af8('0x31')]));_0x478c65[_0x3af8('0x2f')]=_0x478c65[_0x3af8('0x2f')][_0x3af8('0x32')]?_0x478c65[_0x3af8('0x2f')]:_0x2eff40[_0x3af8('0x2c')];_0x478c65['order']=qs['sort'](_0x2d7db8[_0x3af8('0x2d')][_0x3af8('0x35')]);_0x478c65[_0x3af8('0x36')]=qs[_0x3af8('0x2e')](_[_0x3af8('0x49')](_0x2d7db8[_0x3af8('0x2d')],_0x2eff40[_0x3af8('0x2e')]));if(_0x2d7db8[_0x3af8('0x2d')][_0x3af8('0x38')]){_0x478c65[_0x3af8('0x36')]=_[_0x3af8('0x42')](_0x478c65[_0x3af8('0x36')],{'$or':_[_0x3af8('0x28')](_0x478c65[_0x3af8('0x2f')],function(_0x5ee9ab){var _0x3a260a={};_0x3a260a[_0x5ee9ab]={'$like':'%'+_0x2d7db8[_0x3af8('0x2d')][_0x3af8('0x38')]+'%'};return _0x3a260a;})});}_0x478c65=_['merge']({},_0x478c65,_0x2d7db8['options']);return _0xf09d89['getFields'](_0x478c65);}})['then'](function(_0x36f15b){if(_0x36f15b){_0x3a7249=_0x36f15b[_0x3af8('0x32')];if(!_0x2d7db8['query'][_0x3af8('0x33')](_0x3af8('0x4a'))){_0x478c65[_0x3af8('0x1e')]=qs[_0x3af8('0x1e')](_0x2d7db8[_0x3af8('0x2d')][_0x3af8('0x1e')]);_0x478c65[_0x3af8('0x1b')]=qs[_0x3af8('0x1b')](_0x2d7db8[_0x3af8('0x2d')][_0x3af8('0x1b')]);}return _0xf09d89[_0x3af8('0x47')](_0x478c65);}})[_0x3af8('0x23')](function(_0x374bad){if(_0x374bad){return _0x374bad?{'count':_0x3a7249,'rows':_0x374bad}:null;}})['then'](respondWithResult(_0x5a4409,null))['catch'](handleError(_0x5a4409,null));};exports[_0x3af8('0x4b')]=function(_0xc7b18b,_0x570d8a,_0x1754dc){var _0x5bbb5e={};var _0x2a7ef4={};var _0x2e7ae2;var _0x2e2399;return db[_0x3af8('0x3b')]['findOne']({'where':{'id':_0xc7b18b[_0x3af8('0x40')]['id']}})[_0x3af8('0x23')](handleEntityNotFound(_0x570d8a,null))[_0x3af8('0x23')](function(_0x23f054){if(_0x23f054){_0x2e7ae2=_0x23f054;_0x2a7ef4[_0x3af8('0x2c')]=_[_0x3af8('0x41')](db[_0x3af8('0x48')][_0x3af8('0x29')]);_0x2a7ef4[_0x3af8('0x2d')]=_[_0x3af8('0x41')](_0xc7b18b[_0x3af8('0x2d')]);_0x2a7ef4[_0x3af8('0x2e')]=_[_0x3af8('0x30')](_0x2a7ef4[_0x3af8('0x2c')],_0x2a7ef4[_0x3af8('0x2d')]);_0x5bbb5e[_0x3af8('0x2f')]=_[_0x3af8('0x30')](_0x2a7ef4['model'],qs[_0x3af8('0x31')](_0xc7b18b[_0x3af8('0x2d')][_0x3af8('0x31')]));_0x5bbb5e[_0x3af8('0x2f')]=_0x5bbb5e[_0x3af8('0x2f')][_0x3af8('0x32')]?_0x5bbb5e[_0x3af8('0x2f')]:_0x2a7ef4[_0x3af8('0x2c')];_0x5bbb5e[_0x3af8('0x34')]=qs[_0x3af8('0x35')](_0xc7b18b[_0x3af8('0x2d')]['sort']);_0x5bbb5e[_0x3af8('0x36')]=qs[_0x3af8('0x2e')](_[_0x3af8('0x49')](_0xc7b18b[_0x3af8('0x2d')],_0x2a7ef4[_0x3af8('0x2e')]));if(_0xc7b18b['query'][_0x3af8('0x38')]){_0x5bbb5e[_0x3af8('0x36')]=_[_0x3af8('0x42')](_0x5bbb5e['where'],{'$or':_[_0x3af8('0x28')](_0x5bbb5e[_0x3af8('0x2f')],function(_0x9f5f84){var _0x470793={};_0x470793[_0x9f5f84]={'$like':'%'+_0xc7b18b[_0x3af8('0x2d')]['filter']+'%'};return _0x470793;})});}_0x5bbb5e=_[_0x3af8('0x42')]({},_0x5bbb5e,_0xc7b18b['options']);return _0x2e7ae2['getSubjects'](_0x5bbb5e);}})['then'](function(_0x3a8e46){if(_0x3a8e46){_0x2e2399=_0x3a8e46[_0x3af8('0x32')];if(!_0xc7b18b[_0x3af8('0x2d')][_0x3af8('0x33')](_0x3af8('0x4a'))){_0x5bbb5e[_0x3af8('0x1e')]=qs['limit'](_0xc7b18b[_0x3af8('0x2d')]['limit']);_0x5bbb5e[_0x3af8('0x1b')]=qs[_0x3af8('0x1b')](_0xc7b18b[_0x3af8('0x2d')][_0x3af8('0x1b')]);}return _0x2e7ae2['getSubjects'](_0x5bbb5e);}})['then'](function(_0x2953a8){if(_0x2953a8){return _0x2953a8?{'count':_0x2e2399,'rows':_0x2953a8}:null;}})['then'](respondWithResult(_0x570d8a,null))[_0x3af8('0x3e')](handleError(_0x570d8a,null));};exports[_0x3af8('0x4c')]=function(_0x495d83,_0x1312f1,_0x12263e){var _0x5be166={};var _0x414cdc={};var _0x394756;var _0x1ba6ee;return db[_0x3af8('0x3b')]['findOne']({'where':{'id':_0x495d83[_0x3af8('0x40')]['id']}})[_0x3af8('0x23')](handleEntityNotFound(_0x1312f1,null))[_0x3af8('0x23')](function(_0x48c029){if(_0x48c029){_0x394756=_0x48c029;_0x414cdc[_0x3af8('0x2c')]=_[_0x3af8('0x41')](db['FreshdeskField'][_0x3af8('0x29')]);_0x414cdc[_0x3af8('0x2d')]=_[_0x3af8('0x41')](_0x495d83['query']);_0x414cdc[_0x3af8('0x2e')]=_[_0x3af8('0x30')](_0x414cdc['model'],_0x414cdc[_0x3af8('0x2d')]);_0x5be166[_0x3af8('0x2f')]=_[_0x3af8('0x30')](_0x414cdc[_0x3af8('0x2c')],qs[_0x3af8('0x31')](_0x495d83[_0x3af8('0x2d')][_0x3af8('0x31')]));_0x5be166['attributes']=_0x5be166['attributes'][_0x3af8('0x32')]?_0x5be166[_0x3af8('0x2f')]:_0x414cdc[_0x3af8('0x2c')];_0x5be166['order']=qs[_0x3af8('0x35')](_0x495d83['query'][_0x3af8('0x35')]);_0x5be166[_0x3af8('0x36')]=qs[_0x3af8('0x2e')](_[_0x3af8('0x49')](_0x495d83[_0x3af8('0x2d')],_0x414cdc[_0x3af8('0x2e')]));if(_0x495d83[_0x3af8('0x2d')][_0x3af8('0x38')]){_0x5be166[_0x3af8('0x36')]=_['merge'](_0x5be166[_0x3af8('0x36')],{'$or':_['map'](_0x5be166['attributes'],function(_0x18724a){var _0x5d9586={};_0x5d9586[_0x18724a]={'$like':'%'+_0x495d83[_0x3af8('0x2d')][_0x3af8('0x38')]+'%'};return _0x5d9586;})});}_0x5be166=_[_0x3af8('0x42')]({},_0x5be166,_0x495d83[_0x3af8('0x43')]);return _0x394756['getDescriptions'](_0x5be166);}})[_0x3af8('0x23')](function(_0x196c8c){if(_0x196c8c){_0x1ba6ee=_0x196c8c['length'];if(!_0x495d83['query'][_0x3af8('0x33')](_0x3af8('0x4a'))){_0x5be166[_0x3af8('0x1e')]=qs[_0x3af8('0x1e')](_0x495d83[_0x3af8('0x2d')]['limit']);_0x5be166[_0x3af8('0x1b')]=qs[_0x3af8('0x1b')](_0x495d83['query']['offset']);}return _0x394756[_0x3af8('0x4c')](_0x5be166);}})['then'](function(_0x171cd7){if(_0x171cd7){return _0x171cd7?{'count':_0x1ba6ee,'rows':_0x171cd7}:null;}})[_0x3af8('0x23')](respondWithResult(_0x1312f1,null))['catch'](handleError(_0x1312f1,null));};exports['getTags']=function(_0x4572a4,_0x4945d1,_0x5306ce){var _0x11f09e={};var _0x3e4127={};var _0x3592ba;var _0x40521f;return db[_0x3af8('0x3b')]['findOne']({'where':{'id':_0x4572a4['params']['id']}})['then'](handleEntityNotFound(_0x4945d1,null))[_0x3af8('0x23')](function(_0xde27d5){if(_0xde27d5){_0x3592ba=_0xde27d5;_0x3e4127[_0x3af8('0x2c')]=_['keys'](db[_0x3af8('0x4d')]['rawAttributes']);_0x3e4127[_0x3af8('0x2d')]=_[_0x3af8('0x41')](_0x4572a4[_0x3af8('0x2d')]);_0x3e4127[_0x3af8('0x2e')]=_[_0x3af8('0x30')](_0x3e4127[_0x3af8('0x2c')],_0x3e4127[_0x3af8('0x2d')]);_0x11f09e[_0x3af8('0x2f')]=_[_0x3af8('0x30')](_0x3e4127[_0x3af8('0x2c')],qs[_0x3af8('0x31')](_0x4572a4['query'][_0x3af8('0x31')]));_0x11f09e[_0x3af8('0x2f')]=_0x11f09e[_0x3af8('0x2f')][_0x3af8('0x32')]?_0x11f09e[_0x3af8('0x2f')]:_0x3e4127[_0x3af8('0x2c')];_0x11f09e['order']=qs[_0x3af8('0x35')](_0x4572a4[_0x3af8('0x2d')][_0x3af8('0x35')]);_0x11f09e[_0x3af8('0x36')]=qs[_0x3af8('0x2e')](_['pick'](_0x4572a4[_0x3af8('0x2d')],_0x3e4127[_0x3af8('0x2e')]));if(_0x4572a4[_0x3af8('0x2d')][_0x3af8('0x38')]){_0x11f09e[_0x3af8('0x36')]=_[_0x3af8('0x42')](_0x11f09e[_0x3af8('0x36')],{'$or':_[_0x3af8('0x28')](_0x11f09e[_0x3af8('0x2f')],function(_0x5c34a6){var _0x40f070={};_0x40f070[_0x5c34a6]={'$like':'%'+_0x4572a4[_0x3af8('0x2d')][_0x3af8('0x38')]+'%'};return _0x40f070;})});}_0x11f09e=_[_0x3af8('0x42')]({},_0x11f09e,_0x4572a4[_0x3af8('0x43')]);return _0x3592ba['getTags'](_0x11f09e);}})['then'](function(_0x2ac602){if(_0x2ac602){_0x40521f=_0x2ac602[_0x3af8('0x32')];if(!_0x4572a4[_0x3af8('0x2d')][_0x3af8('0x33')]('nolimit')){_0x11f09e[_0x3af8('0x1e')]=qs[_0x3af8('0x1e')](_0x4572a4[_0x3af8('0x2d')][_0x3af8('0x1e')]);_0x11f09e['offset']=qs[_0x3af8('0x1b')](_0x4572a4[_0x3af8('0x2d')][_0x3af8('0x1b')]);}return _0x3592ba[_0x3af8('0x4e')](_0x11f09e);}})['then'](function(_0x341d35){if(_0x341d35){return _0x341d35?{'count':_0x40521f,'rows':_0x341d35}:null;}})[_0x3af8('0x23')](respondWithResult(_0x4945d1,null))[_0x3af8('0x3e')](handleError(_0x4945d1,null));};exports[_0x3af8('0x4f')]=function(_0x4dbe5d,_0x2a407e,_0x357592){if(_0x4dbe5d['body']['id']){delete _0x4dbe5d[_0x3af8('0x46')]['id'];}return db[_0x3af8('0x3b')][_0x3af8('0x50')]({'where':{'id':_0x4dbe5d[_0x3af8('0x40')]['id']}})[_0x3af8('0x23')](handleEntityNotFound(_0x2a407e,null))['then'](function(_0x44c6e3){if(_0x44c6e3){return _0x44c6e3[_0x3af8('0x4f')](_0x4dbe5d[_0x3af8('0x46')][_0x3af8('0x51')]||[]);}return null;})[_0x3af8('0x23')](respondWithResult(_0x2a407e,null))[_0x3af8('0x3e')](handleError(_0x2a407e,null));}; \ No newline at end of file +var _0x2037=['merge','type','VIRTUAL','options','FreshdeskConfiguration','includeAll','include','rows','catch','show','params','rawAttributes','create','body','find','getFields','findOne','FreshdeskField','length','order','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','index','map','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter'];(function(_0x33ea77,_0x21ae18){var _0x2408e7=function(_0x12b57e){while(--_0x12b57e){_0x33ea77['push'](_0x33ea77['shift']());}};_0x2408e7(++_0x21ae18);}(_0x2037,0x10e));var _0x7203=function(_0x4cc03b,_0x299f1c){_0x4cc03b=_0x4cc03b-0x0;var _0xf0358c=_0x2037[_0x4cc03b];return _0xf0358c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7203('0x0'));var zipdir=require(_0x7203('0x1'));var jsonpatch=require(_0x7203('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7203('0x3'));var Mustache=require(_0x7203('0x4'));var util=require(_0x7203('0x5'));var path=require(_0x7203('0x6'));var sox=require(_0x7203('0x7'));var csv=require('to-csv');var ejs=require(_0x7203('0x8'));var fs=require('fs');var fs_extra=require(_0x7203('0x9'));var _=require(_0x7203('0xa'));var squel=require(_0x7203('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7203('0xc'));var toCsv=require(_0x7203('0xd'));var querystring=require(_0x7203('0xe'));var Papa=require(_0x7203('0xf'));var Redis=require('ioredis');var authService=require(_0x7203('0x10'));var qs=require(_0x7203('0x11'));var as=require(_0x7203('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x7203('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x7203('0x14'));var db=require(_0x7203('0x15'))['db'];function respondWithStatusCode(_0x833087,_0x1d43b1){_0x1d43b1=_0x1d43b1||0xcc;return function(_0x35a448){if(_0x35a448){return _0x833087[_0x7203('0x16')](_0x1d43b1);}return _0x833087[_0x7203('0x17')](_0x1d43b1)[_0x7203('0x18')]();};}function respondWithResult(_0x2c831c,_0x2941a5){_0x2941a5=_0x2941a5||0xc8;return function(_0x3250d5){if(_0x3250d5){return _0x2c831c[_0x7203('0x17')](_0x2941a5)[_0x7203('0x19')](_0x3250d5);}};}function respondWithFilteredResult(_0xf2887d,_0x1a2666){return function(_0x5dfeb0){if(_0x5dfeb0){var _0x19532a=typeof _0x1a2666[_0x7203('0x1a')]===_0x7203('0x1b')&&typeof _0x1a2666[_0x7203('0x1c')]==='undefined';var _0x263608=_0x5dfeb0[_0x7203('0x1d')];var _0x1275eb=_0x19532a?0x0:_0x1a2666['offset'];var _0x2d220c=_0x19532a?_0x5dfeb0[_0x7203('0x1d')]:_0x1a2666[_0x7203('0x1a')]+_0x1a2666[_0x7203('0x1c')];var _0x18062e;if(_0x2d220c>=_0x263608){_0x2d220c=_0x263608;_0x18062e=0xc8;}else{_0x18062e=0xce;}_0xf2887d[_0x7203('0x17')](_0x18062e);return _0xf2887d[_0x7203('0x1e')]('Content-Range',_0x1275eb+'-'+_0x2d220c+'/'+_0x263608)[_0x7203('0x19')](_0x5dfeb0);}return null;};}function patchUpdates(_0x11cb6c){return function(_0x484031){try{jsonpatch[_0x7203('0x1f')](_0x484031,_0x11cb6c,!![]);}catch(_0x4437c3){return BPromise[_0x7203('0x20')](_0x4437c3);}return _0x484031[_0x7203('0x21')]();};}function saveUpdates(_0x1e520e,_0x509aac){return function(_0xb0cdb8){if(_0xb0cdb8){return _0xb0cdb8[_0x7203('0x22')](_0x1e520e)[_0x7203('0x23')](function(_0x18e203){return _0x18e203;});}return null;};}function removeEntity(_0x12702c,_0x4c1d90){return function(_0x4062bf){if(_0x4062bf){return _0x4062bf[_0x7203('0x24')]()[_0x7203('0x23')](function(){_0x12702c['status'](0xcc)[_0x7203('0x18')]();});}};}function handleEntityNotFound(_0x1743f0,_0x24a329){return function(_0x14c5fe){if(!_0x14c5fe){_0x1743f0[_0x7203('0x16')](0x194);}return _0x14c5fe;};}function handleError(_0x542ba4,_0x3218e4){_0x3218e4=_0x3218e4||0x1f4;return function(_0x4a8f64){logger[_0x7203('0x25')](_0x4a8f64['stack']);if(_0x4a8f64[_0x7203('0x26')]){delete _0x4a8f64[_0x7203('0x26')];}_0x542ba4[_0x7203('0x17')](_0x3218e4)['send'](_0x4a8f64);};}exports[_0x7203('0x27')]=function(_0x2bd14f,_0x507f11){var _0x559a5f={},_0x52746d={},_0xdf3c9={'count':0x0,'rows':[]};var _0x26b4ba=_[_0x7203('0x28')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x57c9fc){return{'name':_0x57c9fc['fieldName'],'type':_0x57c9fc['type'][_0x7203('0x29')]};});_0x52746d[_0x7203('0x2a')]=_[_0x7203('0x28')](_0x26b4ba,_0x7203('0x26'));_0x52746d[_0x7203('0x2b')]=_[_0x7203('0x2c')](_0x2bd14f[_0x7203('0x2b')]);_0x52746d[_0x7203('0x2d')]=_[_0x7203('0x2e')](_0x52746d[_0x7203('0x2a')],_0x52746d['query']);_0x559a5f[_0x7203('0x2f')]=_['intersection'](_0x52746d['model'],qs[_0x7203('0x30')](_0x2bd14f['query']['fields']));_0x559a5f[_0x7203('0x2f')]=_0x559a5f[_0x7203('0x2f')]['length']?_0x559a5f[_0x7203('0x2f')]:_0x52746d[_0x7203('0x2a')];if(!_0x2bd14f[_0x7203('0x2b')]['hasOwnProperty'](_0x7203('0x31'))){_0x559a5f[_0x7203('0x1c')]=qs[_0x7203('0x1c')](_0x2bd14f[_0x7203('0x2b')][_0x7203('0x1c')]);_0x559a5f[_0x7203('0x1a')]=qs[_0x7203('0x1a')](_0x2bd14f[_0x7203('0x2b')][_0x7203('0x1a')]);}_0x559a5f['order']=qs[_0x7203('0x32')](_0x2bd14f[_0x7203('0x2b')][_0x7203('0x32')]);_0x559a5f[_0x7203('0x33')]=qs[_0x7203('0x2d')](_[_0x7203('0x34')](_0x2bd14f['query'],_0x52746d['filters']),_0x26b4ba);if(_0x2bd14f['query'][_0x7203('0x35')]){_0x559a5f['where']=_[_0x7203('0x36')](_0x559a5f[_0x7203('0x33')],{'$or':_[_0x7203('0x28')](_0x26b4ba,function(_0x37893b){if(_0x37893b[_0x7203('0x37')]!==_0x7203('0x38')){var _0x10ebc0={};_0x10ebc0[_0x37893b['name']]={'$like':'%'+_0x2bd14f['query']['filter']+'%'};return _0x10ebc0;}})});}_0x559a5f=_[_0x7203('0x36')]({},_0x559a5f,_0x2bd14f[_0x7203('0x39')]);var _0x469b8b={'where':_0x559a5f[_0x7203('0x33')]};return db[_0x7203('0x3a')]['count'](_0x469b8b)[_0x7203('0x23')](function(_0x4314d0){_0xdf3c9[_0x7203('0x1d')]=_0x4314d0;if(_0x2bd14f['query'][_0x7203('0x3b')]){_0x559a5f[_0x7203('0x3c')]=[{'all':!![]}];}return db[_0x7203('0x3a')]['findAll'](_0x559a5f);})[_0x7203('0x23')](function(_0x142a14){_0xdf3c9[_0x7203('0x3d')]=_0x142a14;return _0xdf3c9;})[_0x7203('0x23')](respondWithFilteredResult(_0x507f11,_0x559a5f))[_0x7203('0x3e')](handleError(_0x507f11,null));};exports[_0x7203('0x3f')]=function(_0x9c1e47,_0x311a38){var _0x34a6c5={'raw':![],'where':{'id':_0x9c1e47[_0x7203('0x40')]['id']}},_0x22f1ef={};_0x22f1ef[_0x7203('0x2a')]=_[_0x7203('0x2c')](db[_0x7203('0x3a')][_0x7203('0x41')]);_0x22f1ef[_0x7203('0x2b')]=_['keys'](_0x9c1e47[_0x7203('0x2b')]);_0x22f1ef[_0x7203('0x2d')]=_['intersection'](_0x22f1ef[_0x7203('0x2a')],_0x22f1ef['query']);_0x34a6c5[_0x7203('0x2f')]=_[_0x7203('0x2e')](_0x22f1ef[_0x7203('0x2a')],qs['fields'](_0x9c1e47[_0x7203('0x2b')]['fields']));_0x34a6c5[_0x7203('0x2f')]=_0x34a6c5['attributes']['length']?_0x34a6c5[_0x7203('0x2f')]:_0x22f1ef['model'];if(_0x9c1e47[_0x7203('0x2b')][_0x7203('0x3b')]){_0x34a6c5[_0x7203('0x3c')]=[{'all':!![]}];}_0x34a6c5=_['merge']({},_0x34a6c5,_0x9c1e47[_0x7203('0x39')]);return db[_0x7203('0x3a')]['find'](_0x34a6c5)[_0x7203('0x23')](handleEntityNotFound(_0x311a38,null))[_0x7203('0x23')](respondWithResult(_0x311a38,null))['catch'](handleError(_0x311a38,null));};exports[_0x7203('0x42')]=function(_0x21a43b,_0x38d374){return db[_0x7203('0x3a')][_0x7203('0x42')](_0x21a43b[_0x7203('0x43')],{})[_0x7203('0x23')](respondWithResult(_0x38d374,0xc9))['catch'](handleError(_0x38d374,null));};exports['update']=function(_0x207219,_0x4be602){if(_0x207219[_0x7203('0x43')]['id']){delete _0x207219[_0x7203('0x43')]['id'];}return db[_0x7203('0x3a')][_0x7203('0x44')]({'where':{'id':_0x207219['params']['id']}})[_0x7203('0x23')](handleEntityNotFound(_0x4be602,null))[_0x7203('0x23')](saveUpdates(_0x207219['body'],null))[_0x7203('0x23')](respondWithResult(_0x4be602,null))['catch'](handleError(_0x4be602,null));};exports[_0x7203('0x24')]=function(_0x2d0612,_0x584b94){return db[_0x7203('0x3a')][_0x7203('0x44')]({'where':{'id':_0x2d0612[_0x7203('0x40')]['id']}})[_0x7203('0x23')](handleEntityNotFound(_0x584b94,null))[_0x7203('0x23')](removeEntity(_0x584b94,null))[_0x7203('0x3e')](handleError(_0x584b94,null));};exports[_0x7203('0x45')]=function(_0x3f7dd8,_0x48af92,_0x45492b){var _0x802753={};var _0x3e2f90={};var _0x47efea;var _0x522288;return db['FreshdeskConfiguration'][_0x7203('0x46')]({'where':{'id':_0x3f7dd8[_0x7203('0x40')]['id']}})[_0x7203('0x23')](handleEntityNotFound(_0x48af92,null))[_0x7203('0x23')](function(_0x12a6ac){if(_0x12a6ac){_0x47efea=_0x12a6ac;_0x3e2f90[_0x7203('0x2a')]=_[_0x7203('0x2c')](db[_0x7203('0x47')][_0x7203('0x41')]);_0x3e2f90[_0x7203('0x2b')]=_[_0x7203('0x2c')](_0x3f7dd8['query']);_0x3e2f90['filters']=_[_0x7203('0x2e')](_0x3e2f90[_0x7203('0x2a')],_0x3e2f90[_0x7203('0x2b')]);_0x802753[_0x7203('0x2f')]=_[_0x7203('0x2e')](_0x3e2f90[_0x7203('0x2a')],qs[_0x7203('0x30')](_0x3f7dd8[_0x7203('0x2b')][_0x7203('0x30')]));_0x802753['attributes']=_0x802753[_0x7203('0x2f')][_0x7203('0x48')]?_0x802753[_0x7203('0x2f')]:_0x3e2f90[_0x7203('0x2a')];_0x802753[_0x7203('0x49')]=qs[_0x7203('0x32')](_0x3f7dd8[_0x7203('0x2b')][_0x7203('0x32')]);_0x802753[_0x7203('0x33')]=qs[_0x7203('0x2d')](_[_0x7203('0x34')](_0x3f7dd8['query'],_0x3e2f90['filters']));if(_0x3f7dd8[_0x7203('0x2b')]['filter']){_0x802753['where']=_['merge'](_0x802753[_0x7203('0x33')],{'$or':_[_0x7203('0x28')](_0x802753[_0x7203('0x2f')],function(_0x1b32af){var _0xba2daa={};_0xba2daa[_0x1b32af]={'$like':'%'+_0x3f7dd8[_0x7203('0x2b')][_0x7203('0x35')]+'%'};return _0xba2daa;})});}_0x802753=_[_0x7203('0x36')]({},_0x802753,_0x3f7dd8[_0x7203('0x39')]);return _0x47efea[_0x7203('0x45')](_0x802753);}})[_0x7203('0x23')](function(_0x4b8cbc){if(_0x4b8cbc){_0x522288=_0x4b8cbc[_0x7203('0x48')];if(!_0x3f7dd8[_0x7203('0x2b')][_0x7203('0x4a')](_0x7203('0x31'))){_0x802753[_0x7203('0x1c')]=qs[_0x7203('0x1c')](_0x3f7dd8['query'][_0x7203('0x1c')]);_0x802753[_0x7203('0x1a')]=qs[_0x7203('0x1a')](_0x3f7dd8[_0x7203('0x2b')][_0x7203('0x1a')]);}return _0x47efea[_0x7203('0x45')](_0x802753);}})[_0x7203('0x23')](function(_0x25e6ca){if(_0x25e6ca){return _0x25e6ca?{'count':_0x522288,'rows':_0x25e6ca}:null;}})[_0x7203('0x23')](respondWithResult(_0x48af92,null))['catch'](handleError(_0x48af92,null));};exports[_0x7203('0x4b')]=function(_0xf3cd2e,_0x15c9b4,_0x24624d){var _0x4f6c73={};var _0x1dba9d={};var _0x1c41ca;var _0x1e6c66;return db[_0x7203('0x3a')][_0x7203('0x46')]({'where':{'id':_0xf3cd2e[_0x7203('0x40')]['id']}})[_0x7203('0x23')](handleEntityNotFound(_0x15c9b4,null))['then'](function(_0x2a5d13){if(_0x2a5d13){_0x1c41ca=_0x2a5d13;_0x1dba9d[_0x7203('0x2a')]=_[_0x7203('0x2c')](db[_0x7203('0x47')][_0x7203('0x41')]);_0x1dba9d[_0x7203('0x2b')]=_[_0x7203('0x2c')](_0xf3cd2e[_0x7203('0x2b')]);_0x1dba9d[_0x7203('0x2d')]=_[_0x7203('0x2e')](_0x1dba9d[_0x7203('0x2a')],_0x1dba9d[_0x7203('0x2b')]);_0x4f6c73['attributes']=_[_0x7203('0x2e')](_0x1dba9d[_0x7203('0x2a')],qs['fields'](_0xf3cd2e[_0x7203('0x2b')][_0x7203('0x30')]));_0x4f6c73[_0x7203('0x2f')]=_0x4f6c73[_0x7203('0x2f')][_0x7203('0x48')]?_0x4f6c73[_0x7203('0x2f')]:_0x1dba9d[_0x7203('0x2a')];_0x4f6c73[_0x7203('0x49')]=qs['sort'](_0xf3cd2e['query'][_0x7203('0x32')]);_0x4f6c73[_0x7203('0x33')]=qs['filters'](_[_0x7203('0x34')](_0xf3cd2e[_0x7203('0x2b')],_0x1dba9d[_0x7203('0x2d')]));if(_0xf3cd2e[_0x7203('0x2b')]['filter']){_0x4f6c73[_0x7203('0x33')]=_[_0x7203('0x36')](_0x4f6c73[_0x7203('0x33')],{'$or':_[_0x7203('0x28')](_0x4f6c73['attributes'],function(_0x38397d){var _0x6c113e={};_0x6c113e[_0x38397d]={'$like':'%'+_0xf3cd2e[_0x7203('0x2b')][_0x7203('0x35')]+'%'};return _0x6c113e;})});}_0x4f6c73=_[_0x7203('0x36')]({},_0x4f6c73,_0xf3cd2e[_0x7203('0x39')]);return _0x1c41ca['getSubjects'](_0x4f6c73);}})['then'](function(_0x2d17c4){if(_0x2d17c4){_0x1e6c66=_0x2d17c4[_0x7203('0x48')];if(!_0xf3cd2e[_0x7203('0x2b')][_0x7203('0x4a')](_0x7203('0x31'))){_0x4f6c73['limit']=qs[_0x7203('0x1c')](_0xf3cd2e[_0x7203('0x2b')][_0x7203('0x1c')]);_0x4f6c73['offset']=qs[_0x7203('0x1a')](_0xf3cd2e['query'][_0x7203('0x1a')]);}return _0x1c41ca[_0x7203('0x4b')](_0x4f6c73);}})[_0x7203('0x23')](function(_0x41e4bc){if(_0x41e4bc){return _0x41e4bc?{'count':_0x1e6c66,'rows':_0x41e4bc}:null;}})[_0x7203('0x23')](respondWithResult(_0x15c9b4,null))['catch'](handleError(_0x15c9b4,null));};exports[_0x7203('0x4c')]=function(_0x91097,_0x5d9ee7,_0x3980e0){var _0x1d65e9={};var _0x34109b={};var _0x1ae80e;var _0x1d4a71;return db[_0x7203('0x3a')][_0x7203('0x46')]({'where':{'id':_0x91097[_0x7203('0x40')]['id']}})[_0x7203('0x23')](handleEntityNotFound(_0x5d9ee7,null))[_0x7203('0x23')](function(_0x283d6f){if(_0x283d6f){_0x1ae80e=_0x283d6f;_0x34109b[_0x7203('0x2a')]=_['keys'](db[_0x7203('0x47')][_0x7203('0x41')]);_0x34109b[_0x7203('0x2b')]=_['keys'](_0x91097[_0x7203('0x2b')]);_0x34109b[_0x7203('0x2d')]=_['intersection'](_0x34109b['model'],_0x34109b[_0x7203('0x2b')]);_0x1d65e9[_0x7203('0x2f')]=_[_0x7203('0x2e')](_0x34109b[_0x7203('0x2a')],qs[_0x7203('0x30')](_0x91097[_0x7203('0x2b')][_0x7203('0x30')]));_0x1d65e9['attributes']=_0x1d65e9[_0x7203('0x2f')][_0x7203('0x48')]?_0x1d65e9[_0x7203('0x2f')]:_0x34109b[_0x7203('0x2a')];_0x1d65e9[_0x7203('0x49')]=qs[_0x7203('0x32')](_0x91097[_0x7203('0x2b')]['sort']);_0x1d65e9[_0x7203('0x33')]=qs[_0x7203('0x2d')](_[_0x7203('0x34')](_0x91097[_0x7203('0x2b')],_0x34109b[_0x7203('0x2d')]));if(_0x91097['query']['filter']){_0x1d65e9['where']=_[_0x7203('0x36')](_0x1d65e9[_0x7203('0x33')],{'$or':_['map'](_0x1d65e9[_0x7203('0x2f')],function(_0x4c8ca8){var _0xc309b8={};_0xc309b8[_0x4c8ca8]={'$like':'%'+_0x91097[_0x7203('0x2b')][_0x7203('0x35')]+'%'};return _0xc309b8;})});}_0x1d65e9=_[_0x7203('0x36')]({},_0x1d65e9,_0x91097[_0x7203('0x39')]);return _0x1ae80e[_0x7203('0x4c')](_0x1d65e9);}})[_0x7203('0x23')](function(_0x2003b9){if(_0x2003b9){_0x1d4a71=_0x2003b9[_0x7203('0x48')];if(!_0x91097[_0x7203('0x2b')]['hasOwnProperty'](_0x7203('0x31'))){_0x1d65e9[_0x7203('0x1c')]=qs['limit'](_0x91097[_0x7203('0x2b')][_0x7203('0x1c')]);_0x1d65e9['offset']=qs[_0x7203('0x1a')](_0x91097[_0x7203('0x2b')]['offset']);}return _0x1ae80e[_0x7203('0x4c')](_0x1d65e9);}})[_0x7203('0x23')](function(_0x287127){if(_0x287127){return _0x287127?{'count':_0x1d4a71,'rows':_0x287127}:null;}})[_0x7203('0x23')](respondWithResult(_0x5d9ee7,null))[_0x7203('0x3e')](handleError(_0x5d9ee7,null));};exports[_0x7203('0x4d')]=function(_0x3788ec,_0x51d6d8,_0x3b00ee){var _0x397a01={};var _0x490ecf={};var _0x4f9f84;var _0x1e009a;return db[_0x7203('0x3a')][_0x7203('0x46')]({'where':{'id':_0x3788ec[_0x7203('0x40')]['id']}})[_0x7203('0x23')](handleEntityNotFound(_0x51d6d8,null))[_0x7203('0x23')](function(_0xd87444){if(_0xd87444){_0x4f9f84=_0xd87444;_0x490ecf[_0x7203('0x2a')]=_[_0x7203('0x2c')](db[_0x7203('0x4e')][_0x7203('0x41')]);_0x490ecf[_0x7203('0x2b')]=_[_0x7203('0x2c')](_0x3788ec['query']);_0x490ecf[_0x7203('0x2d')]=_[_0x7203('0x2e')](_0x490ecf[_0x7203('0x2a')],_0x490ecf[_0x7203('0x2b')]);_0x397a01['attributes']=_[_0x7203('0x2e')](_0x490ecf[_0x7203('0x2a')],qs[_0x7203('0x30')](_0x3788ec['query']['fields']));_0x397a01[_0x7203('0x2f')]=_0x397a01[_0x7203('0x2f')][_0x7203('0x48')]?_0x397a01['attributes']:_0x490ecf['model'];_0x397a01[_0x7203('0x49')]=qs[_0x7203('0x32')](_0x3788ec[_0x7203('0x2b')][_0x7203('0x32')]);_0x397a01['where']=qs[_0x7203('0x2d')](_[_0x7203('0x34')](_0x3788ec[_0x7203('0x2b')],_0x490ecf[_0x7203('0x2d')]));if(_0x3788ec[_0x7203('0x2b')][_0x7203('0x35')]){_0x397a01[_0x7203('0x33')]=_['merge'](_0x397a01[_0x7203('0x33')],{'$or':_[_0x7203('0x28')](_0x397a01[_0x7203('0x2f')],function(_0x9cba80){var _0x5b056c={};_0x5b056c[_0x9cba80]={'$like':'%'+_0x3788ec['query'][_0x7203('0x35')]+'%'};return _0x5b056c;})});}_0x397a01=_[_0x7203('0x36')]({},_0x397a01,_0x3788ec['options']);return _0x4f9f84[_0x7203('0x4d')](_0x397a01);}})[_0x7203('0x23')](function(_0x2f8e95){if(_0x2f8e95){_0x1e009a=_0x2f8e95[_0x7203('0x48')];if(!_0x3788ec[_0x7203('0x2b')][_0x7203('0x4a')](_0x7203('0x31'))){_0x397a01['limit']=qs[_0x7203('0x1c')](_0x3788ec[_0x7203('0x2b')][_0x7203('0x1c')]);_0x397a01[_0x7203('0x1a')]=qs['offset'](_0x3788ec[_0x7203('0x2b')][_0x7203('0x1a')]);}return _0x4f9f84[_0x7203('0x4d')](_0x397a01);}})[_0x7203('0x23')](function(_0x4c2c07){if(_0x4c2c07){return _0x4c2c07?{'count':_0x1e009a,'rows':_0x4c2c07}:null;}})[_0x7203('0x23')](respondWithResult(_0x51d6d8,null))[_0x7203('0x3e')](handleError(_0x51d6d8,null));};exports[_0x7203('0x4f')]=function(_0x259831,_0x26588b,_0x586142){if(_0x259831[_0x7203('0x43')]['id']){delete _0x259831[_0x7203('0x43')]['id'];}return db[_0x7203('0x3a')]['findOne']({'where':{'id':_0x259831[_0x7203('0x40')]['id']}})[_0x7203('0x23')](handleEntityNotFound(_0x26588b,null))['then'](function(_0x1456e4){if(_0x1456e4){return _0x1456e4[_0x7203('0x4f')](_0x259831[_0x7203('0x43')][_0x7203('0x50')]||[]);}return null;})[_0x7203('0x23')](respondWithResult(_0x26588b,null))[_0x7203('0x3e')](handleError(_0x26588b,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 1366f46..8b83266 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 _0xbde7=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','api'];(function(_0x2f243c,_0x33db47){var _0x16f2b4=function(_0x24720f){while(--_0x24720f){_0x2f243c['push'](_0x2f243c['shift']());}};_0x16f2b4(++_0x33db47);}(_0xbde7,0x169));var _0x7bde=function(_0x4685d3,_0x53f994){_0x4685d3=_0x4685d3-0x0;var _0x195d65=_0xbde7[_0x4685d3];return _0x195d65;};'use strict';var _=require(_0x7bde('0x0'));var util=require('util');var logger=require(_0x7bde('0x1'))(_0x7bde('0x2'));var moment=require(_0x7bde('0x3'));var BPromise=require(_0x7bde('0x4'));var rp=require(_0x7bde('0x5'));var fs=require('fs');var path=require(_0x7bde('0x6'));var rimraf=require(_0x7bde('0x7'));var config=require(_0x7bde('0x8'));var attributes=require(_0x7bde('0x9'));module[_0x7bde('0xa')]=function(_0x5b9615,_0x22a8df){return _0x5b9615['define'](_0x7bde('0xb'),attributes,{'tableName':_0x7bde('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e9a=['api','moment','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','lodash','../../config/logger'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0e9a,0x14b));var _0xa0e9=function(_0x28029a,_0x1a4c5f){_0x28029a=_0x28029a-0x0;var _0x13f191=_0x0e9a[_0x28029a];return _0x13f191;};'use strict';var _=require(_0xa0e9('0x0'));var util=require('util');var logger=require(_0xa0e9('0x1'))(_0xa0e9('0x2'));var moment=require(_0xa0e9('0x3'));var BPromise=require('bluebird');var rp=require(_0xa0e9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa0e9('0x5'));var config=require(_0xa0e9('0x6'));var attributes=require(_0xa0e9('0x7'));module['exports']=function(_0x1704e5,_0x269360){return _0x1704e5[_0xa0e9('0x8')]('FreshdeskConfiguration',attributes,{'tableName':'int_freshdesk_configurations','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 6d8ecad..95a94f1 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 _0x1ce9=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1ce9,0xe4));var _0x91ce=function(_0x329dc5,_0x42591f){_0x329dc5=_0x329dc5-0x0;var _0x32111d=_0x1ce9[_0x329dc5];return _0x32111d;};'use strict';var _=require(_0x91ce('0x0'));var util=require('util');var moment=require(_0x91ce('0x1'));var BPromise=require(_0x91ce('0x2'));var rs=require(_0x91ce('0x3'));var fs=require('fs');var Redis=require(_0x91ce('0x4'));var db=require(_0x91ce('0x5'))['db'];var utils=require(_0x91ce('0x6'));var logger=require(_0x91ce('0x7'))(_0x91ce('0x8'));var config=require(_0x91ce('0x9'));var jayson=require(_0x91ce('0xa'));var client=jayson[_0x91ce('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xcd9908,_0x15b936,_0x4193b1){return new BPromise(function(_0x1f5995,_0x1ef278){return client[_0x91ce('0xc')](_0xcd9908,_0x4193b1)[_0x91ce('0xd')](function(_0x799682){logger[_0x91ce('0xe')](_0x91ce('0xf'),_0x15b936,'request\x20sent');logger[_0x91ce('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x15b936,_0x91ce('0x11'),JSON[_0x91ce('0x12')](_0x799682));if(_0x799682['error']){if(_0x799682[_0x91ce('0x13')]['code']===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x15b936,_0x799682[_0x91ce('0x13')][_0x91ce('0x14')]);return _0x1ef278(_0x799682[_0x91ce('0x13')][_0x91ce('0x14')]);}logger[_0x91ce('0x13')](_0x91ce('0xf'),_0x15b936,_0x799682['error'][_0x91ce('0x14')]);return _0x1f5995(_0x799682[_0x91ce('0x13')][_0x91ce('0x14')]);}else{logger[_0x91ce('0xe')](_0x91ce('0xf'),_0x15b936,_0x91ce('0x11'));_0x1f5995(_0x799682[_0x91ce('0x15')][_0x91ce('0x14')]);}})[_0x91ce('0x16')](function(_0xfbfb28){logger[_0x91ce('0x13')](_0x91ce('0xf'),_0x15b936,_0xfbfb28);_0x1ef278(_0xfbfb28);});});} \ No newline at end of file +var _0xb1cf=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x285f9b,_0xfcae6c){var _0x32dd58=function(_0x392920){while(--_0x392920){_0x285f9b['push'](_0x285f9b['shift']());}};_0x32dd58(++_0xfcae6c);}(_0xb1cf,0x1c3));var _0xfb1c=function(_0x438988,_0x2a86cf){_0x438988=_0x438988-0x0;var _0x1ce59f=_0xb1cf[_0x438988];return _0x1ce59f;};'use strict';var _=require(_0xfb1c('0x0'));var util=require(_0xfb1c('0x1'));var moment=require(_0xfb1c('0x2'));var BPromise=require(_0xfb1c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb1c('0x4'));var db=require(_0xfb1c('0x5'))['db'];var utils=require(_0xfb1c('0x6'));var logger=require(_0xfb1c('0x7'))(_0xfb1c('0x8'));var config=require(_0xfb1c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xfb1c('0xa')][_0xfb1c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ee437,_0x489a35,_0x10a865){return new BPromise(function(_0x490f5d,_0x1b8aa4){return client[_0xfb1c('0xc')](_0x3ee437,_0x10a865)[_0xfb1c('0xd')](function(_0xffa7c8){logger[_0xfb1c('0xe')](_0xfb1c('0xf'),_0x489a35,_0xfb1c('0x10'));logger['debug'](_0xfb1c('0x11'),_0x489a35,_0xfb1c('0x10'),JSON[_0xfb1c('0x12')](_0xffa7c8));if(_0xffa7c8['error']){if(_0xffa7c8[_0xfb1c('0x13')][_0xfb1c('0x14')]===0x1f4){logger['error'](_0xfb1c('0xf'),_0x489a35,_0xffa7c8['error']['message']);return _0x1b8aa4(_0xffa7c8['error'][_0xfb1c('0x15')]);}logger[_0xfb1c('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x489a35,_0xffa7c8['error'][_0xfb1c('0x15')]);return _0x490f5d(_0xffa7c8[_0xfb1c('0x13')][_0xfb1c('0x15')]);}else{logger[_0xfb1c('0xe')](_0xfb1c('0xf'),_0x489a35,_0xfb1c('0x10'));_0x490f5d(_0xffa7c8[_0xfb1c('0x16')][_0xfb1c('0x15')]);}})[_0xfb1c('0x17')](function(_0x5a4a6e){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x489a35,_0x5a4a6e);_0x1b8aa4(_0x5a4a6e);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 1ee007c..76d6852 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 _0x1556=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x41316a,_0x376fd3){var _0x582d09=function(_0x5e0151){while(--_0x5e0151){_0x41316a['push'](_0x41316a['shift']());}};_0x582d09(++_0x376fd3);}(_0x1556,0x1dc));var _0x6155=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x1556[_0x178e48];return _0x440d7e;};'use strict';var multer=require(_0x6155('0x0'));var util=require(_0x6155('0x1'));var path=require(_0x6155('0x2'));var timeout=require(_0x6155('0x3'));var express=require(_0x6155('0x4'));var router=express[_0x6155('0x5')]();var fs_extra=require(_0x6155('0x6'));var auth=require(_0x6155('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0x6155('0x8')]('/',auth[_0x6155('0x9')](),controller[_0x6155('0xa')]);router['get'](_0x6155('0xb'),auth[_0x6155('0x9')](),controller[_0x6155('0xc')]);router[_0x6155('0xd')]('/',auth[_0x6155('0x9')](),controller[_0x6155('0xe')]);router[_0x6155('0xf')](_0x6155('0xb'),auth['isAuthenticated'](),controller[_0x6155('0x10')]);router[_0x6155('0x11')]('/:id',auth[_0x6155('0x9')](),controller['destroy']);module[_0x6155('0x12')]=router; \ No newline at end of file +var _0xed87=['../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x47140b,_0x4874b1){var _0x78d1b1=function(_0x5b51a3){while(--_0x5b51a3){_0x47140b['push'](_0x47140b['shift']());}};_0x78d1b1(++_0x4874b1);}(_0xed87,0x16e));var _0x7ed8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xed87[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7ed8('0x0'));var util=require(_0x7ed8('0x1'));var path=require(_0x7ed8('0x2'));var timeout=require(_0x7ed8('0x3'));var express=require(_0x7ed8('0x4'));var router=express[_0x7ed8('0x5')]();var fs_extra=require(_0x7ed8('0x6'));var auth=require(_0x7ed8('0x7'));var interaction=require(_0x7ed8('0x8'));var config=require(_0x7ed8('0x9'));var controller=require(_0x7ed8('0xa'));router[_0x7ed8('0xb')]('/',auth[_0x7ed8('0xc')](),controller[_0x7ed8('0xd')]);router['get']('/:id',auth[_0x7ed8('0xc')](),controller[_0x7ed8('0xe')]);router[_0x7ed8('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7ed8('0x10')](_0x7ed8('0x11'),auth['isAuthenticated'](),controller[_0x7ed8('0x12')]);router[_0x7ed8('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x7ed8('0x14')]);module[_0x7ed8('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 1f8a13a..4e8fb5d 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 _0x5adc=['string','customVariable','variable','STRING','ENUM'];(function(_0x50530f,_0x4f5e81){var _0xa6eded=function(_0x419035){while(--_0x419035){_0x50530f['push'](_0x50530f['shift']());}};_0xa6eded(++_0x4f5e81);}(_0x5adc,0x1e9));var _0xc5ad=function(_0x32f9b0,_0x4d9a67){_0x32f9b0=_0x32f9b0-0x0;var _0x3c435b=_0x5adc[_0x32f9b0];return _0x3c435b;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xc5ad('0x0')](_0xc5ad('0x1'),'variable',_0xc5ad('0x2'),'keyValue','picklist'),'defaultValue':_0xc5ad('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xc5ad('0x3'),_0xc5ad('0x2'))},'keyContent':{'type':Sequelize[_0xc5ad('0x4')]},'idField':{'type':Sequelize[_0xc5ad('0x4')]},'nameField':{'type':Sequelize[_0xc5ad('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc5ad('0x4')]}}; \ No newline at end of file +var _0xdb2d=['keyValue','picklist','STRING','customVariable','sequelize','exports','ENUM','string','variable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb2d,0x190));var _0xddb2=function(_0x128517,_0x554ec2){_0x128517=_0x128517-0x0;var _0x50e658=_0xdb2d[_0x128517];return _0x50e658;};'use strict';var Sequelize=require(_0xddb2('0x0'));module[_0xddb2('0x1')]={'type':{'type':Sequelize[_0xddb2('0x2')](_0xddb2('0x3'),_0xddb2('0x4'),'customVariable',_0xddb2('0x5'),_0xddb2('0x6')),'defaultValue':_0xddb2('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xddb2('0x7')]},'keyType':{'type':Sequelize[_0xddb2('0x2')](_0xddb2('0x3'),'variable',_0xddb2('0x8'))},'keyContent':{'type':Sequelize[_0xddb2('0x7')]},'idField':{'type':Sequelize[_0xddb2('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xddb2('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 93d206d..319bbd3 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 _0xc3fe=['destroy','end','name','status','send','index','map','FreshdeskField','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','catch','show','params','rawAttributes','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','then'];(function(_0xc4577d,_0x44fb35){var _0xfb792e=function(_0x2edb27){while(--_0x2edb27){_0xc4577d['push'](_0xc4577d['shift']());}};_0xfb792e(++_0x44fb35);}(_0xc3fe,0xff));var _0xec3f=function(_0x110b25,_0x4b6124){_0x110b25=_0x110b25-0x0;var _0xe494f5=_0xc3fe[_0x110b25];return _0xe494f5;};'use strict';var emlformat=require(_0xec3f('0x0'));var rimraf=require(_0xec3f('0x1'));var zipdir=require(_0xec3f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xec3f('0x3'));var moment=require(_0xec3f('0x4'));var BPromise=require(_0xec3f('0x5'));var Mustache=require('mustache');var util=require(_0xec3f('0x6'));var path=require(_0xec3f('0x7'));var sox=require(_0xec3f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xec3f('0x9'));var _=require(_0xec3f('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xec3f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xec3f('0xc'));var querystring=require(_0xec3f('0xd'));var Papa=require(_0xec3f('0xe'));var Redis=require(_0xec3f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xec3f('0x10'));var as=require(_0xec3f('0x11'));var hardwareService=require(_0xec3f('0x12'));var logger=require(_0xec3f('0x13'))(_0xec3f('0x14'));var utils=require(_0xec3f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xec3f('0x16'));var db=require(_0xec3f('0x17'))['db'];function respondWithStatusCode(_0x367c5e,_0x57891d){_0x57891d=_0x57891d||0xcc;return function(_0x5367df){if(_0x5367df){return _0x367c5e[_0xec3f('0x18')](_0x57891d);}return _0x367c5e['status'](_0x57891d)['end']();};}function respondWithResult(_0x209ffa,_0x4318bd){_0x4318bd=_0x4318bd||0xc8;return function(_0x113d16){if(_0x113d16){return _0x209ffa['status'](_0x4318bd)['json'](_0x113d16);}};}function respondWithFilteredResult(_0x5509ec,_0x5ad65a){return function(_0x37d688){if(_0x37d688){var _0x10ff81=typeof _0x5ad65a['offset']===_0xec3f('0x19')&&typeof _0x5ad65a[_0xec3f('0x1a')]===_0xec3f('0x19');var _0x3b7393=_0x37d688['count'];var _0x7805c=_0x10ff81?0x0:_0x5ad65a[_0xec3f('0x1b')];var _0x2d338=_0x10ff81?_0x37d688[_0xec3f('0x1c')]:_0x5ad65a[_0xec3f('0x1b')]+_0x5ad65a['limit'];var _0x2f8bc8;if(_0x2d338>=_0x3b7393){_0x2d338=_0x3b7393;_0x2f8bc8=0xc8;}else{_0x2f8bc8=0xce;}_0x5509ec['status'](_0x2f8bc8);return _0x5509ec[_0xec3f('0x1d')](_0xec3f('0x1e'),_0x7805c+'-'+_0x2d338+'/'+_0x3b7393)[_0xec3f('0x1f')](_0x37d688);}return null;};}function patchUpdates(_0x47b6f9){return function(_0x526ff){try{jsonpatch[_0xec3f('0x20')](_0x526ff,_0x47b6f9,!![]);}catch(_0x4fdfc3){return BPromise[_0xec3f('0x21')](_0x4fdfc3);}return _0x526ff[_0xec3f('0x22')]();};}function saveUpdates(_0x1f173f,_0x395b9a){return function(_0x4d9598){if(_0x4d9598){return _0x4d9598[_0xec3f('0x23')](_0x1f173f)[_0xec3f('0x24')](function(_0x2f45bb){return _0x2f45bb;});}return null;};}function removeEntity(_0x4e4770,_0xfc9c0d){return function(_0x4b5932){if(_0x4b5932){return _0x4b5932[_0xec3f('0x25')]()['then'](function(){_0x4e4770['status'](0xcc)[_0xec3f('0x26')]();});}};}function handleEntityNotFound(_0x482bf2,_0x217b7d){return function(_0xa12054){if(!_0xa12054){_0x482bf2[_0xec3f('0x18')](0x194);}return _0xa12054;};}function handleError(_0x4df17b,_0x296fc3){_0x296fc3=_0x296fc3||0x1f4;return function(_0x1da532){logger['error'](_0x1da532['stack']);if(_0x1da532[_0xec3f('0x27')]){delete _0x1da532['name'];}_0x4df17b[_0xec3f('0x28')](_0x296fc3)[_0xec3f('0x29')](_0x1da532);};}exports[_0xec3f('0x2a')]=function(_0x2eac8d,_0x4614c9){var _0x19473c={},_0x2f2d15={},_0x237134={'count':0x0,'rows':[]};var _0x56217e=_[_0xec3f('0x2b')](db[_0xec3f('0x2c')]['rawAttributes'],function(_0x91c11a){return{'name':_0x91c11a[_0xec3f('0x2d')],'type':_0x91c11a[_0xec3f('0x2e')][_0xec3f('0x2f')]};});_0x2f2d15[_0xec3f('0x30')]=_[_0xec3f('0x2b')](_0x56217e,_0xec3f('0x27'));_0x2f2d15[_0xec3f('0x31')]=_[_0xec3f('0x32')](_0x2eac8d[_0xec3f('0x31')]);_0x2f2d15[_0xec3f('0x33')]=_[_0xec3f('0x34')](_0x2f2d15[_0xec3f('0x30')],_0x2f2d15[_0xec3f('0x31')]);_0x19473c[_0xec3f('0x35')]=_['intersection'](_0x2f2d15[_0xec3f('0x30')],qs[_0xec3f('0x36')](_0x2eac8d[_0xec3f('0x31')][_0xec3f('0x36')]));_0x19473c[_0xec3f('0x35')]=_0x19473c['attributes'][_0xec3f('0x37')]?_0x19473c[_0xec3f('0x35')]:_0x2f2d15[_0xec3f('0x30')];if(!_0x2eac8d['query']['hasOwnProperty'](_0xec3f('0x38'))){_0x19473c['limit']=qs[_0xec3f('0x1a')](_0x2eac8d['query'][_0xec3f('0x1a')]);_0x19473c['offset']=qs['offset'](_0x2eac8d[_0xec3f('0x31')][_0xec3f('0x1b')]);}_0x19473c[_0xec3f('0x39')]=qs[_0xec3f('0x3a')](_0x2eac8d[_0xec3f('0x31')][_0xec3f('0x3a')]);_0x19473c['where']=qs['filters'](_[_0xec3f('0x3b')](_0x2eac8d[_0xec3f('0x31')],_0x2f2d15[_0xec3f('0x33')]),_0x56217e);if(_0x2eac8d[_0xec3f('0x31')][_0xec3f('0x3c')]){_0x19473c[_0xec3f('0x3d')]=_[_0xec3f('0x3e')](_0x19473c['where'],{'$or':_[_0xec3f('0x2b')](_0x56217e,function(_0x5aadc3){if(_0x5aadc3[_0xec3f('0x2e')]!==_0xec3f('0x3f')){var _0x2c8f59={};_0x2c8f59[_0x5aadc3[_0xec3f('0x27')]]={'$like':'%'+_0x2eac8d[_0xec3f('0x31')][_0xec3f('0x3c')]+'%'};return _0x2c8f59;}})});}_0x19473c=_[_0xec3f('0x3e')]({},_0x19473c,_0x2eac8d[_0xec3f('0x40')]);var _0x35b902={'where':_0x19473c[_0xec3f('0x3d')]};return db[_0xec3f('0x2c')][_0xec3f('0x1c')](_0x35b902)[_0xec3f('0x24')](function(_0x482219){_0x237134[_0xec3f('0x1c')]=_0x482219;if(_0x2eac8d[_0xec3f('0x31')]['includeAll']){_0x19473c[_0xec3f('0x41')]=[{'all':!![]}];}return db[_0xec3f('0x2c')]['findAll'](_0x19473c);})[_0xec3f('0x24')](function(_0xae1b8a){_0x237134[_0xec3f('0x42')]=_0xae1b8a;return _0x237134;})[_0xec3f('0x24')](respondWithFilteredResult(_0x4614c9,_0x19473c))[_0xec3f('0x43')](handleError(_0x4614c9,null));};exports[_0xec3f('0x44')]=function(_0x5e434d,_0x142d85){var _0x386e96={'raw':!![],'where':{'id':_0x5e434d[_0xec3f('0x45')]['id']}},_0x1c6494={};_0x1c6494[_0xec3f('0x30')]=_[_0xec3f('0x32')](db[_0xec3f('0x2c')][_0xec3f('0x46')]);_0x1c6494[_0xec3f('0x31')]=_['keys'](_0x5e434d[_0xec3f('0x31')]);_0x1c6494['filters']=_[_0xec3f('0x34')](_0x1c6494[_0xec3f('0x30')],_0x1c6494[_0xec3f('0x31')]);_0x386e96[_0xec3f('0x35')]=_[_0xec3f('0x34')](_0x1c6494[_0xec3f('0x30')],qs[_0xec3f('0x36')](_0x5e434d[_0xec3f('0x31')][_0xec3f('0x36')]));_0x386e96[_0xec3f('0x35')]=_0x386e96[_0xec3f('0x35')][_0xec3f('0x37')]?_0x386e96['attributes']:_0x1c6494[_0xec3f('0x30')];if(_0x5e434d[_0xec3f('0x31')]['includeAll']){_0x386e96[_0xec3f('0x41')]=[{'all':!![]}];}_0x386e96=_[_0xec3f('0x3e')]({},_0x386e96,_0x5e434d[_0xec3f('0x40')]);return db[_0xec3f('0x2c')]['find'](_0x386e96)['then'](handleEntityNotFound(_0x142d85,null))[_0xec3f('0x24')](respondWithResult(_0x142d85,null))[_0xec3f('0x43')](handleError(_0x142d85,null));};exports['create']=function(_0x2a9fc8,_0x28acd1){return db[_0xec3f('0x2c')]['create'](_0x2a9fc8[_0xec3f('0x47')],{})['then'](respondWithResult(_0x28acd1,0xc9))['catch'](handleError(_0x28acd1,null));};exports['update']=function(_0x97c57d,_0x1b7cf6){if(_0x97c57d[_0xec3f('0x47')]['id']){delete _0x97c57d[_0xec3f('0x47')]['id'];}return db['FreshdeskField'][_0xec3f('0x48')]({'where':{'id':_0x97c57d['params']['id']}})[_0xec3f('0x24')](handleEntityNotFound(_0x1b7cf6,null))[_0xec3f('0x24')](saveUpdates(_0x97c57d[_0xec3f('0x47')],null))[_0xec3f('0x24')](respondWithResult(_0x1b7cf6,null))[_0xec3f('0x43')](handleError(_0x1b7cf6,null));};exports[_0xec3f('0x25')]=function(_0x515bf2,_0x2ab636){return db['FreshdeskField'][_0xec3f('0x48')]({'where':{'id':_0x515bf2['params']['id']}})[_0xec3f('0x24')](handleEntityNotFound(_0x2ab636,null))['then'](removeEntity(_0x2ab636,null))[_0xec3f('0x43')](handleError(_0x2ab636,null));}; \ No newline at end of file +var _0xf109=['crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','destroy','then','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','FreshdeskField','includeAll','include','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x32fc75,_0x3aa7d8){var _0x103668=function(_0x4d47bd){while(--_0x4d47bd){_0x32fc75['push'](_0x32fc75['shift']());}};_0x103668(++_0x3aa7d8);}(_0xf109,0xce));var _0x9f10=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0xf109[_0x556bb1];return _0x45455f;};'use strict';var emlformat=require(_0x9f10('0x0'));var rimraf=require(_0x9f10('0x1'));var zipdir=require(_0x9f10('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9f10('0x3'));var Mustache=require(_0x9f10('0x4'));var util=require(_0x9f10('0x5'));var path=require(_0x9f10('0x6'));var sox=require(_0x9f10('0x7'));var csv=require(_0x9f10('0x8'));var ejs=require(_0x9f10('0x9'));var fs=require('fs');var fs_extra=require(_0x9f10('0xa'));var _=require(_0x9f10('0xb'));var squel=require(_0x9f10('0xc'));var crypto=require(_0x9f10('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9f10('0xe'));var toCsv=require(_0x9f10('0x8'));var querystring=require(_0x9f10('0xf'));var Papa=require(_0x9f10('0x10'));var Redis=require(_0x9f10('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9f10('0x12'));var as=require(_0x9f10('0x13'));var hardwareService=require(_0x9f10('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x9f10('0x15'));var config=require(_0x9f10('0x16'));var licenseUtil=require(_0x9f10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x289164,_0x260606){_0x260606=_0x260606||0xcc;return function(_0x35c529){if(_0x35c529){return _0x289164['sendStatus'](_0x260606);}return _0x289164[_0x9f10('0x18')](_0x260606)[_0x9f10('0x19')]();};}function respondWithResult(_0x5be443,_0x40a48a){_0x40a48a=_0x40a48a||0xc8;return function(_0x236e28){if(_0x236e28){return _0x5be443['status'](_0x40a48a)['json'](_0x236e28);}};}function respondWithFilteredResult(_0x2b6c4c,_0x177918){return function(_0x549217){if(_0x549217){var _0x11154b=typeof _0x177918['offset']===_0x9f10('0x1a')&&typeof _0x177918[_0x9f10('0x1b')]==='undefined';var _0x11cc56=_0x549217[_0x9f10('0x1c')];var _0x509fba=_0x11154b?0x0:_0x177918[_0x9f10('0x1d')];var _0x53bfbd=_0x11154b?_0x549217[_0x9f10('0x1c')]:_0x177918['offset']+_0x177918[_0x9f10('0x1b')];var _0x56fb44;if(_0x53bfbd>=_0x11cc56){_0x53bfbd=_0x11cc56;_0x56fb44=0xc8;}else{_0x56fb44=0xce;}_0x2b6c4c['status'](_0x56fb44);return _0x2b6c4c[_0x9f10('0x1e')](_0x9f10('0x1f'),_0x509fba+'-'+_0x53bfbd+'/'+_0x11cc56)[_0x9f10('0x20')](_0x549217);}return null;};}function patchUpdates(_0x3a78be){return function(_0xa810c){try{jsonpatch[_0x9f10('0x21')](_0xa810c,_0x3a78be,!![]);}catch(_0x27843d){return BPromise['reject'](_0x27843d);}return _0xa810c[_0x9f10('0x22')]();};}function saveUpdates(_0x58e6ba,_0x293990){return function(_0x36ace4){if(_0x36ace4){return _0x36ace4[_0x9f10('0x23')](_0x58e6ba)['then'](function(_0x2f31fb){return _0x2f31fb;});}return null;};}function removeEntity(_0x3dde2e,_0x213567){return function(_0x4d21c5){if(_0x4d21c5){return _0x4d21c5[_0x9f10('0x24')]()[_0x9f10('0x25')](function(){_0x3dde2e[_0x9f10('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ec07d,_0x23c2e7){return function(_0x11cae7){if(!_0x11cae7){_0x2ec07d[_0x9f10('0x26')](0x194);}return _0x11cae7;};}function handleError(_0x5e80de,_0x57539b){_0x57539b=_0x57539b||0x1f4;return function(_0x5c1800){logger[_0x9f10('0x27')](_0x5c1800['stack']);if(_0x5c1800[_0x9f10('0x28')]){delete _0x5c1800[_0x9f10('0x28')];}_0x5e80de[_0x9f10('0x18')](_0x57539b)[_0x9f10('0x29')](_0x5c1800);};}exports[_0x9f10('0x2a')]=function(_0x4f6b0c,_0x522805){var _0x22814f={},_0x40f96b={},_0xfbb37f={'count':0x0,'rows':[]};var _0x181aec=_[_0x9f10('0x2b')](db['FreshdeskField'][_0x9f10('0x2c')],function(_0x501ee){return{'name':_0x501ee[_0x9f10('0x2d')],'type':_0x501ee[_0x9f10('0x2e')]['key']};});_0x40f96b[_0x9f10('0x2f')]=_[_0x9f10('0x2b')](_0x181aec,_0x9f10('0x28'));_0x40f96b['query']=_[_0x9f10('0x30')](_0x4f6b0c['query']);_0x40f96b[_0x9f10('0x31')]=_[_0x9f10('0x32')](_0x40f96b[_0x9f10('0x2f')],_0x40f96b['query']);_0x22814f[_0x9f10('0x33')]=_[_0x9f10('0x32')](_0x40f96b[_0x9f10('0x2f')],qs[_0x9f10('0x34')](_0x4f6b0c[_0x9f10('0x35')]['fields']));_0x22814f[_0x9f10('0x33')]=_0x22814f['attributes'][_0x9f10('0x36')]?_0x22814f[_0x9f10('0x33')]:_0x40f96b[_0x9f10('0x2f')];if(!_0x4f6b0c[_0x9f10('0x35')][_0x9f10('0x37')](_0x9f10('0x38'))){_0x22814f['limit']=qs[_0x9f10('0x1b')](_0x4f6b0c[_0x9f10('0x35')][_0x9f10('0x1b')]);_0x22814f['offset']=qs[_0x9f10('0x1d')](_0x4f6b0c[_0x9f10('0x35')]['offset']);}_0x22814f[_0x9f10('0x39')]=qs['sort'](_0x4f6b0c[_0x9f10('0x35')][_0x9f10('0x3a')]);_0x22814f[_0x9f10('0x3b')]=qs[_0x9f10('0x31')](_[_0x9f10('0x3c')](_0x4f6b0c[_0x9f10('0x35')],_0x40f96b[_0x9f10('0x31')]),_0x181aec);if(_0x4f6b0c[_0x9f10('0x35')]['filter']){_0x22814f[_0x9f10('0x3b')]=_[_0x9f10('0x3d')](_0x22814f[_0x9f10('0x3b')],{'$or':_['map'](_0x181aec,function(_0x233bab){if(_0x233bab[_0x9f10('0x2e')]!=='VIRTUAL'){var _0x30b04b={};_0x30b04b[_0x233bab[_0x9f10('0x28')]]={'$like':'%'+_0x4f6b0c[_0x9f10('0x35')]['filter']+'%'};return _0x30b04b;}})});}_0x22814f=_['merge']({},_0x22814f,_0x4f6b0c[_0x9f10('0x3e')]);var _0x2ff98d={'where':_0x22814f[_0x9f10('0x3b')]};return db[_0x9f10('0x3f')][_0x9f10('0x1c')](_0x2ff98d)[_0x9f10('0x25')](function(_0x15929f){_0xfbb37f[_0x9f10('0x1c')]=_0x15929f;if(_0x4f6b0c[_0x9f10('0x35')][_0x9f10('0x40')]){_0x22814f[_0x9f10('0x41')]=[{'all':!![]}];}return db[_0x9f10('0x3f')]['findAll'](_0x22814f);})['then'](function(_0x4bb805){_0xfbb37f[_0x9f10('0x42')]=_0x4bb805;return _0xfbb37f;})['then'](respondWithFilteredResult(_0x522805,_0x22814f))[_0x9f10('0x43')](handleError(_0x522805,null));};exports[_0x9f10('0x44')]=function(_0x426d30,_0x47d25c){var _0x3cfce6={'raw':!![],'where':{'id':_0x426d30[_0x9f10('0x45')]['id']}},_0xf1164={};_0xf1164[_0x9f10('0x2f')]=_[_0x9f10('0x30')](db['FreshdeskField']['rawAttributes']);_0xf1164['query']=_[_0x9f10('0x30')](_0x426d30['query']);_0xf1164[_0x9f10('0x31')]=_['intersection'](_0xf1164[_0x9f10('0x2f')],_0xf1164[_0x9f10('0x35')]);_0x3cfce6[_0x9f10('0x33')]=_[_0x9f10('0x32')](_0xf1164['model'],qs[_0x9f10('0x34')](_0x426d30[_0x9f10('0x35')]['fields']));_0x3cfce6[_0x9f10('0x33')]=_0x3cfce6[_0x9f10('0x33')][_0x9f10('0x36')]?_0x3cfce6[_0x9f10('0x33')]:_0xf1164[_0x9f10('0x2f')];if(_0x426d30[_0x9f10('0x35')][_0x9f10('0x40')]){_0x3cfce6[_0x9f10('0x41')]=[{'all':!![]}];}_0x3cfce6=_[_0x9f10('0x3d')]({},_0x3cfce6,_0x426d30[_0x9f10('0x3e')]);return db['FreshdeskField'][_0x9f10('0x46')](_0x3cfce6)[_0x9f10('0x25')](handleEntityNotFound(_0x47d25c,null))['then'](respondWithResult(_0x47d25c,null))[_0x9f10('0x43')](handleError(_0x47d25c,null));};exports[_0x9f10('0x47')]=function(_0x1cf3eb,_0x1807b3){return db['FreshdeskField'][_0x9f10('0x47')](_0x1cf3eb[_0x9f10('0x48')],{})[_0x9f10('0x25')](respondWithResult(_0x1807b3,0xc9))[_0x9f10('0x43')](handleError(_0x1807b3,null));};exports[_0x9f10('0x23')]=function(_0x43cb31,_0x479b46){if(_0x43cb31[_0x9f10('0x48')]['id']){delete _0x43cb31[_0x9f10('0x48')]['id'];}return db[_0x9f10('0x3f')][_0x9f10('0x46')]({'where':{'id':_0x43cb31[_0x9f10('0x45')]['id']}})[_0x9f10('0x25')](handleEntityNotFound(_0x479b46,null))['then'](saveUpdates(_0x43cb31[_0x9f10('0x48')],null))[_0x9f10('0x25')](respondWithResult(_0x479b46,null))[_0x9f10('0x43')](handleError(_0x479b46,null));};exports[_0x9f10('0x24')]=function(_0x39dae3,_0x15d676){return db[_0x9f10('0x3f')][_0x9f10('0x46')]({'where':{'id':_0x39dae3['params']['id']}})[_0x9f10('0x25')](handleEntityNotFound(_0x15d676,null))['then'](removeEntity(_0x15d676,null))[_0x9f10('0x43')](handleError(_0x15d676,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 14c6173..e7d6c86 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 _0x331c=['bluebird','rimraf','./intFreshdeskField.attributes','exports','define','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','../../config/logger'];(function(_0x294421,_0x17d482){var _0x510cea=function(_0x36ad25){while(--_0x36ad25){_0x294421['push'](_0x294421['shift']());}};_0x510cea(++_0x17d482);}(_0x331c,0xf0));var _0xc331=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x331c[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0xc331('0x0'));var util=require('util');var logger=require(_0xc331('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc331('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc331('0x3'));var config=require('../../config/environment');var attributes=require(_0xc331('0x4'));module[_0xc331('0x5')]=function(_0x567fe9,_0x14a44f){return _0x567fe9[_0xc331('0x6')]('FreshdeskField',attributes,{'tableName':_0xc331('0x7'),'paranoid':![],'indexes':[{'name':_0xc331('0x8'),'fields':[_0xc331('0x9'),_0xc331('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa3d4=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x451bb4,_0x4e2391){var _0x4f850c=function(_0x277b43){while(--_0x277b43){_0x451bb4['push'](_0x451bb4['shift']());}};_0x4f850c(++_0x4e2391);}(_0xa3d4,0x12d));var _0x4a3d=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xa3d4[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0x4a3d('0x0'));var util=require(_0x4a3d('0x1'));var logger=require(_0x4a3d('0x2'))(_0x4a3d('0x3'));var moment=require(_0x4a3d('0x4'));var BPromise=require(_0x4a3d('0x5'));var rp=require(_0x4a3d('0x6'));var fs=require('fs');var path=require(_0x4a3d('0x7'));var rimraf=require(_0x4a3d('0x8'));var config=require(_0x4a3d('0x9'));var attributes=require(_0x4a3d('0xa'));module[_0x4a3d('0xb')]=function(_0x4f57be,_0x43012c){return _0x4f57be['define'](_0x4a3d('0xc'),attributes,{'tableName':_0x4a3d('0xd'),'paranoid':![],'indexes':[{'name':_0x4a3d('0xe'),'fields':[_0x4a3d('0xf'),_0x4a3d('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 599ae8e..e930716 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 _0xafe2=['util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x1a0510,_0x107972){var _0x4c7348=function(_0x334fd8){while(--_0x334fd8){_0x1a0510['push'](_0x1a0510['shift']());}};_0x4c7348(++_0x107972);}(_0xafe2,0x1e0));var _0x2afe=function(_0x440153,_0x3c99a4){_0x440153=_0x440153-0x0;var _0x1b2667=_0xafe2[_0x440153];return _0x1b2667;};'use strict';var _=require('lodash');var util=require(_0x2afe('0x0'));var moment=require('moment');var BPromise=require(_0x2afe('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2afe('0x2'));var db=require(_0x2afe('0x3'))['db'];var utils=require(_0x2afe('0x4'));var logger=require(_0x2afe('0x5'))(_0x2afe('0x6'));var config=require(_0x2afe('0x7'));var jayson=require(_0x2afe('0x8'));var client=jayson[_0x2afe('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x250982,_0x18f1db,_0x2226a9){return new BPromise(function(_0xeaab4b,_0x207f34){return client[_0x2afe('0xa')](_0x250982,_0x2226a9)[_0x2afe('0xb')](function(_0x2c9ebf){logger[_0x2afe('0xc')](_0x2afe('0xd'),_0x18f1db,_0x2afe('0xe'));logger[_0x2afe('0xf')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x18f1db,_0x2afe('0xe'),JSON[_0x2afe('0x10')](_0x2c9ebf));if(_0x2c9ebf['error']){if(_0x2c9ebf[_0x2afe('0x11')][_0x2afe('0x12')]===0x1f4){logger[_0x2afe('0x11')](_0x2afe('0xd'),_0x18f1db,_0x2c9ebf['error'][_0x2afe('0x13')]);return _0x207f34(_0x2c9ebf['error'][_0x2afe('0x13')]);}logger[_0x2afe('0x11')](_0x2afe('0xd'),_0x18f1db,_0x2c9ebf[_0x2afe('0x11')][_0x2afe('0x13')]);return _0xeaab4b(_0x2c9ebf[_0x2afe('0x11')][_0x2afe('0x13')]);}else{logger['info'](_0x2afe('0xd'),_0x18f1db,'request\x20sent');_0xeaab4b(_0x2c9ebf['result'][_0x2afe('0x13')]);}})['catch'](function(_0x56c1e2){logger[_0x2afe('0x11')](_0x2afe('0xd'),_0x18f1db,_0x56c1e2);_0x207f34(_0x56c1e2);});});} \ No newline at end of file +var _0xf432=['request\x20sent','stringify','code','message','error','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s'];(function(_0x1b4412,_0x31c1ff){var _0x337392=function(_0x553288){while(--_0x553288){_0x1b4412['push'](_0x1b4412['shift']());}};_0x337392(++_0x31c1ff);}(_0xf432,0xc7));var _0x2f43=function(_0x7e3f06,_0x426f70){_0x7e3f06=_0x7e3f06-0x0;var _0x12b8ff=_0xf432[_0x7e3f06];return _0x12b8ff;};'use strict';var _=require('lodash');var util=require(_0x2f43('0x0'));var moment=require(_0x2f43('0x1'));var BPromise=require(_0x2f43('0x2'));var rs=require(_0x2f43('0x3'));var fs=require('fs');var Redis=require(_0x2f43('0x4'));var db=require(_0x2f43('0x5'))['db'];var utils=require(_0x2f43('0x6'));var logger=require(_0x2f43('0x7'))(_0x2f43('0x8'));var config=require(_0x2f43('0x9'));var jayson=require(_0x2f43('0xa'));var client=jayson[_0x2f43('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e7d25,_0x29c5ec,_0x54fea4){return new BPromise(function(_0x37fd2,_0x27a18e){return client['request'](_0x1e7d25,_0x54fea4)[_0x2f43('0xc')](function(_0x478749){logger[_0x2f43('0xd')](_0x2f43('0xe'),_0x29c5ec,'request\x20sent');logger[_0x2f43('0xf')](_0x2f43('0x10'),_0x29c5ec,_0x2f43('0x11'),JSON[_0x2f43('0x12')](_0x478749));if(_0x478749['error']){if(_0x478749['error'][_0x2f43('0x13')]===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x29c5ec,_0x478749['error'][_0x2f43('0x14')]);return _0x27a18e(_0x478749[_0x2f43('0x15')][_0x2f43('0x14')]);}logger[_0x2f43('0x15')](_0x2f43('0xe'),_0x29c5ec,_0x478749[_0x2f43('0x15')][_0x2f43('0x14')]);return _0x37fd2(_0x478749[_0x2f43('0x15')][_0x2f43('0x14')]);}else{logger[_0x2f43('0xd')](_0x2f43('0xe'),_0x29c5ec,_0x2f43('0x11'));_0x37fd2(_0x478749[_0x2f43('0x16')][_0x2f43('0x14')]);}})[_0x2f43('0x17')](function(_0x126e4c){logger[_0x2f43('0x15')](_0x2f43('0xe'),_0x29c5ec,_0x126e4c);_0x27a18e(_0x126e4c);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 36ddf27..e5ea160 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 _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(_0x3c42b2,_0xa54dc6){var _0x54318e=function(_0x1e2e8e){while(--_0x1e2e8e){_0x3c42b2['push'](_0x3c42b2['shift']());}};_0x54318e(++_0xa54dc6);}(_0x4fc2,0x111));var _0x24fc=function(_0x38257d,_0x4aa6da){_0x38257d=_0x38257d-0x0;var _0x1175b3=_0x4fc2[_0x38257d];return _0x1175b3;};'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 +var _0x69d3=['path','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','multer','util'];(function(_0x573ca2,_0x4dcca7){var _0x406c77=function(_0x271582){while(--_0x271582){_0x573ca2['push'](_0x573ca2['shift']());}};_0x406c77(++_0x4dcca7);}(_0x69d3,0xda));var _0x369d=function(_0x1838ba,_0x3d44e5){_0x1838ba=_0x1838ba-0x0;var _0x5197ef=_0x69d3[_0x1838ba];return _0x5197ef;};'use strict';var multer=require(_0x369d('0x0'));var util=require(_0x369d('0x1'));var path=require(_0x369d('0x2'));var timeout=require('connect-timeout');var express=require(_0x369d('0x3'));var router=express[_0x369d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x369d('0x5'));var config=require('../../config/environment');var controller=require('./intFreshsalesAccount.controller');router[_0x369d('0x6')]('/',auth[_0x369d('0x7')](),controller[_0x369d('0x8')]);router[_0x369d('0x6')](_0x369d('0x9'),auth[_0x369d('0x7')](),controller[_0x369d('0xa')]);router[_0x369d('0x6')](_0x369d('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x369d('0x6')](_0x369d('0xc'),auth[_0x369d('0x7')](),controller[_0x369d('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x369d('0xe')]);router[_0x369d('0xf')](_0x369d('0xb'),auth[_0x369d('0x7')](),controller[_0x369d('0x10')]);router[_0x369d('0x11')]('/:id',auth[_0x369d('0x7')](),controller[_0x369d('0x12')]);router[_0x369d('0x13')](_0x369d('0x9'),auth[_0x369d('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 0adabf8..787af7b 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 _0xd4a2=['STRING','username','sequelize'];(function(_0x1df691,_0x2605a0){var _0x7ec437=function(_0xd5a3f5){while(--_0xd5a3f5){_0x1df691['push'](_0x1df691['shift']());}};_0x7ec437(++_0x2605a0);}(_0xd4a2,0x173));var _0x2d4a=function(_0x29d3fe,_0x31894c){_0x29d3fe=_0x29d3fe-0x0;var _0xf784ff=_0xd4a2[_0x29d3fe];return _0xf784ff;};'use strict';var Sequelize=require(_0x2d4a('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2d4a('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x2d4a('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2d4a('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x2d4a('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xcf2f=['exports','STRING','remoteUri','sequelize'];(function(_0x43c35c,_0xeb5f90){var _0x2ea8da=function(_0x21704a){while(--_0x21704a){_0x43c35c['push'](_0x43c35c['shift']());}};_0x2ea8da(++_0xeb5f90);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x514018,_0x59d4cb){_0x514018=_0x514018-0x0;var _0x30a2a7=_0xcf2f[_0x514018];return _0x30a2a7;};'use strict';var Sequelize=require(_0xfcf2('0x0'));module[_0xfcf2('0x1')]={'name':{'type':Sequelize[_0xfcf2('0x2')]},'description':{'type':Sequelize[_0xfcf2('0x2')]},'username':{'type':Sequelize[_0xfcf2('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xfcf2('0x2')]},'remoteUri':{'type':Sequelize[_0xfcf2('0x2')],'unique':_0xfcf2('0x3')},'serverUrl':{'type':Sequelize[_0xfcf2('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 ec6022a..bc15a2a 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 _0x5965=['AccountId','Subjects','Descriptions','getDescriptions','channel','FreshsalesField','getFields','username','remoteUri','apiKey','lastIndexOf','GET','format','%s%s','/api/selector/owners','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','FreshsalesAccount','rawAttributes','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','catch','create','body','find','getConfigurations','findOne','FreshsalesConfiguration'];(function(_0x1bf15f,_0x24bb54){var _0x6987c9=function(_0x568650){while(--_0x568650){_0x1bf15f['push'](_0x1bf15f['shift']());}};_0x6987c9(++_0x24bb54);}(_0x5965,0xe4));var _0x5596=function(_0xae21d5,_0x1acf25){_0xae21d5=_0xae21d5-0x0;var _0x5935fb=_0x5965[_0xae21d5];return _0x5935fb;};'use strict';var emlformat=require(_0x5596('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5596('0x1'));var jsonpatch=require(_0x5596('0x2'));var rp=require(_0x5596('0x3'));var moment=require(_0x5596('0x4'));var BPromise=require(_0x5596('0x5'));var Mustache=require(_0x5596('0x6'));var util=require(_0x5596('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x5596('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5596('0x9'));var _=require(_0x5596('0xa'));var squel=require(_0x5596('0xb'));var crypto=require(_0x5596('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5596('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5596('0xe'));var Papa=require(_0x5596('0xf'));var Redis=require(_0x5596('0x10'));var authService=require(_0x5596('0x11'));var qs=require(_0x5596('0x12'));var as=require(_0x5596('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5596('0x14'))(_0x5596('0x15'));var utils=require(_0x5596('0x16'));var config=require(_0x5596('0x17'));var licenseUtil=require(_0x5596('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5596('0x19'));function respondWithStatusCode(_0x332fab,_0x1073ae){_0x1073ae=_0x1073ae||0xcc;return function(_0x146bbd){if(_0x146bbd){return _0x332fab[_0x5596('0x1a')](_0x1073ae);}return _0x332fab[_0x5596('0x1b')](_0x1073ae)[_0x5596('0x1c')]();};}function respondWithResult(_0x36f494,_0x41f34b){_0x41f34b=_0x41f34b||0xc8;return function(_0x1290b8){if(_0x1290b8){return _0x36f494[_0x5596('0x1b')](_0x41f34b)[_0x5596('0x1d')](_0x1290b8);}};}function respondWithFilteredResult(_0x34fb19,_0x5d26fe){return function(_0x2772eb){if(_0x2772eb){var _0x35d058=typeof _0x5d26fe[_0x5596('0x1e')]===_0x5596('0x1f')&&typeof _0x5d26fe['limit']===_0x5596('0x1f');var _0x3fe23b=_0x2772eb['count'];var _0x1aa193=_0x35d058?0x0:_0x5d26fe[_0x5596('0x1e')];var _0x1b2573=_0x35d058?_0x2772eb[_0x5596('0x20')]:_0x5d26fe['offset']+_0x5d26fe[_0x5596('0x21')];var _0x45f6e4;if(_0x1b2573>=_0x3fe23b){_0x1b2573=_0x3fe23b;_0x45f6e4=0xc8;}else{_0x45f6e4=0xce;}_0x34fb19[_0x5596('0x1b')](_0x45f6e4);return _0x34fb19[_0x5596('0x22')]('Content-Range',_0x1aa193+'-'+_0x1b2573+'/'+_0x3fe23b)['json'](_0x2772eb);}return null;};}function patchUpdates(_0x895dc5){return function(_0x748b15){try{jsonpatch[_0x5596('0x23')](_0x748b15,_0x895dc5,!![]);}catch(_0x5a6903){return BPromise[_0x5596('0x24')](_0x5a6903);}return _0x748b15[_0x5596('0x25')]();};}function saveUpdates(_0x1a1c32,_0x2c9de0){return function(_0x9f7a45){if(_0x9f7a45){return _0x9f7a45[_0x5596('0x26')](_0x1a1c32)[_0x5596('0x27')](function(_0x3941d3){return _0x3941d3;});}return null;};}function removeEntity(_0x2f1248,_0x49ffb5){return function(_0x138d9c){if(_0x138d9c){return _0x138d9c[_0x5596('0x28')]()[_0x5596('0x27')](function(){_0x2f1248[_0x5596('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a47e6,_0x135e70){return function(_0x1448f3){if(!_0x1448f3){_0x3a47e6[_0x5596('0x1a')](0x194);}return _0x1448f3;};}function handleError(_0x3c1fc6,_0x4e1e1f){_0x4e1e1f=_0x4e1e1f||0x1f4;return function(_0x50f611){logger[_0x5596('0x29')](_0x50f611[_0x5596('0x2a')]);if(_0x50f611['name']){delete _0x50f611[_0x5596('0x2b')];}_0x3c1fc6[_0x5596('0x1b')](_0x4e1e1f)[_0x5596('0x2c')](_0x50f611);};}exports['index']=function(_0x45acbd,_0x1a79f3){var _0x439c91={},_0x12ecf2={},_0xe930c7={'count':0x0,'rows':[]};var _0x1a1726=_[_0x5596('0x2d')](db[_0x5596('0x2e')][_0x5596('0x2f')],function(_0x19bfa1){return{'name':_0x19bfa1['fieldName'],'type':_0x19bfa1[_0x5596('0x30')][_0x5596('0x31')]};});_0x12ecf2['model']=_[_0x5596('0x2d')](_0x1a1726,_0x5596('0x2b'));_0x12ecf2[_0x5596('0x32')]=_[_0x5596('0x33')](_0x45acbd['query']);_0x12ecf2[_0x5596('0x34')]=_['intersection'](_0x12ecf2['model'],_0x12ecf2['query']);_0x439c91[_0x5596('0x35')]=_[_0x5596('0x36')](_0x12ecf2[_0x5596('0x37')],qs[_0x5596('0x38')](_0x45acbd[_0x5596('0x32')]['fields']));_0x439c91[_0x5596('0x35')]=_0x439c91[_0x5596('0x35')][_0x5596('0x39')]?_0x439c91[_0x5596('0x35')]:_0x12ecf2[_0x5596('0x37')];if(!_0x45acbd[_0x5596('0x32')][_0x5596('0x3a')](_0x5596('0x3b'))){_0x439c91[_0x5596('0x21')]=qs[_0x5596('0x21')](_0x45acbd[_0x5596('0x32')][_0x5596('0x21')]);_0x439c91[_0x5596('0x1e')]=qs[_0x5596('0x1e')](_0x45acbd[_0x5596('0x32')][_0x5596('0x1e')]);}_0x439c91[_0x5596('0x3c')]=qs[_0x5596('0x3d')](_0x45acbd['query'][_0x5596('0x3d')]);_0x439c91[_0x5596('0x3e')]=qs[_0x5596('0x34')](_[_0x5596('0x3f')](_0x45acbd['query'],_0x12ecf2[_0x5596('0x34')]),_0x1a1726);if(_0x45acbd[_0x5596('0x32')][_0x5596('0x40')]){_0x439c91[_0x5596('0x3e')]=_[_0x5596('0x41')](_0x439c91[_0x5596('0x3e')],{'$or':_[_0x5596('0x2d')](_0x1a1726,function(_0x55c06c){if(_0x55c06c['type']!==_0x5596('0x42')){var _0x64b612={};_0x64b612[_0x55c06c[_0x5596('0x2b')]]={'$like':'%'+_0x45acbd[_0x5596('0x32')][_0x5596('0x40')]+'%'};return _0x64b612;}})});}_0x439c91=_[_0x5596('0x41')]({},_0x439c91,_0x45acbd['options']);var _0x8d179f={'where':_0x439c91[_0x5596('0x3e')]};return db[_0x5596('0x2e')][_0x5596('0x20')](_0x8d179f)['then'](function(_0x3e1a0e){_0xe930c7[_0x5596('0x20')]=_0x3e1a0e;if(_0x45acbd[_0x5596('0x32')][_0x5596('0x43')]){_0x439c91[_0x5596('0x44')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x5596('0x45')](_0x439c91);})[_0x5596('0x27')](function(_0x42c90c){_0xe930c7[_0x5596('0x46')]=_0x42c90c;return _0xe930c7;})[_0x5596('0x27')](respondWithFilteredResult(_0x1a79f3,_0x439c91))['catch'](handleError(_0x1a79f3,null));};exports[_0x5596('0x47')]=function(_0x1f8dc3,_0x301561){var _0x52a64e={'raw':![],'where':{'id':_0x1f8dc3[_0x5596('0x48')]['id']}},_0xf1e05a={};_0xf1e05a[_0x5596('0x37')]=_[_0x5596('0x33')](db[_0x5596('0x2e')][_0x5596('0x2f')]);_0xf1e05a[_0x5596('0x32')]=_[_0x5596('0x33')](_0x1f8dc3[_0x5596('0x32')]);_0xf1e05a[_0x5596('0x34')]=_[_0x5596('0x36')](_0xf1e05a[_0x5596('0x37')],_0xf1e05a[_0x5596('0x32')]);_0x52a64e[_0x5596('0x35')]=_[_0x5596('0x36')](_0xf1e05a['model'],qs[_0x5596('0x38')](_0x1f8dc3[_0x5596('0x32')][_0x5596('0x38')]));_0x52a64e[_0x5596('0x35')]=_0x52a64e['attributes'][_0x5596('0x39')]?_0x52a64e[_0x5596('0x35')]:_0xf1e05a[_0x5596('0x37')];if(_0x1f8dc3[_0x5596('0x32')][_0x5596('0x43')]){_0x52a64e[_0x5596('0x44')]=[{'all':!![]}];}_0x52a64e=_['merge']({},_0x52a64e,_0x1f8dc3[_0x5596('0x49')]);return db[_0x5596('0x2e')]['find'](_0x52a64e)[_0x5596('0x27')](handleEntityNotFound(_0x301561,null))[_0x5596('0x27')](respondWithResult(_0x301561,null))[_0x5596('0x4a')](handleError(_0x301561,null));};exports[_0x5596('0x4b')]=function(_0x554885,_0x4df63f){return db[_0x5596('0x2e')][_0x5596('0x4b')](_0x554885['body'],{})[_0x5596('0x27')](respondWithResult(_0x4df63f,0xc9))[_0x5596('0x4a')](handleError(_0x4df63f,null));};exports[_0x5596('0x26')]=function(_0x45b5fd,_0x1e163c){if(_0x45b5fd[_0x5596('0x4c')]['id']){delete _0x45b5fd[_0x5596('0x4c')]['id'];}return db[_0x5596('0x2e')][_0x5596('0x4d')]({'where':{'id':_0x45b5fd[_0x5596('0x48')]['id']}})[_0x5596('0x27')](handleEntityNotFound(_0x1e163c,null))[_0x5596('0x27')](saveUpdates(_0x45b5fd[_0x5596('0x4c')],null))[_0x5596('0x27')](respondWithResult(_0x1e163c,null))[_0x5596('0x4a')](handleError(_0x1e163c,null));};exports['destroy']=function(_0x4badcd,_0x368977){return db[_0x5596('0x2e')][_0x5596('0x4d')]({'where':{'id':_0x4badcd['params']['id']}})['then'](handleEntityNotFound(_0x368977,null))['then'](removeEntity(_0x368977,null))[_0x5596('0x4a')](handleError(_0x368977,null));};exports[_0x5596('0x4e')]=function(_0x4afacf,_0xb2bc13,_0x3329f7){var _0x4d73d5={};var _0x21b429={};var _0x7be316;var _0x4112b2;return db['FreshsalesAccount'][_0x5596('0x4f')]({'where':{'id':_0x4afacf[_0x5596('0x48')]['id']}})[_0x5596('0x27')](handleEntityNotFound(_0xb2bc13,null))[_0x5596('0x27')](function(_0x41bf28){if(_0x41bf28){_0x7be316=_0x41bf28;_0x21b429['model']=_['keys'](db[_0x5596('0x50')]['rawAttributes']);_0x21b429[_0x5596('0x32')]=_[_0x5596('0x33')](_0x4afacf[_0x5596('0x32')]);_0x21b429[_0x5596('0x34')]=_[_0x5596('0x36')](_0x21b429[_0x5596('0x37')],_0x21b429['query']);_0x4d73d5[_0x5596('0x35')]=_[_0x5596('0x36')](_0x21b429[_0x5596('0x37')],qs[_0x5596('0x38')](_0x4afacf[_0x5596('0x32')][_0x5596('0x38')]));_0x4d73d5[_0x5596('0x35')]=_0x4d73d5['attributes'][_0x5596('0x39')]?_0x4d73d5['attributes']:_0x21b429[_0x5596('0x37')];_0x4d73d5[_0x5596('0x3c')]=qs[_0x5596('0x3d')](_0x4afacf[_0x5596('0x32')][_0x5596('0x3d')]);_0x4d73d5[_0x5596('0x3e')]=qs[_0x5596('0x34')](_['pick'](_0x4afacf['query'],_0x21b429['filters']));if(_0x4afacf[_0x5596('0x32')][_0x5596('0x40')]){_0x4d73d5['where']=_[_0x5596('0x41')](_0x4d73d5[_0x5596('0x3e')],{'$or':_[_0x5596('0x2d')](_0x4d73d5[_0x5596('0x35')],function(_0x23c0f7){var _0xb4f786={};_0xb4f786[_0x23c0f7]={'$like':'%'+_0x4afacf[_0x5596('0x32')][_0x5596('0x40')]+'%'};return _0xb4f786;})});}_0x4d73d5=_[_0x5596('0x41')]({},_0x4d73d5,_0x4afacf[_0x5596('0x49')]);return _0x7be316[_0x5596('0x4e')](_0x4d73d5);}})[_0x5596('0x27')](function(_0x253f65){if(_0x253f65){_0x4112b2=_0x253f65['length'];if(!_0x4afacf['query'][_0x5596('0x3a')](_0x5596('0x3b'))){_0x4d73d5[_0x5596('0x21')]=qs[_0x5596('0x21')](_0x4afacf[_0x5596('0x32')]['limit']);_0x4d73d5[_0x5596('0x1e')]=qs[_0x5596('0x1e')](_0x4afacf['query'][_0x5596('0x1e')]);}return _0x7be316['getConfigurations'](_0x4d73d5);}})[_0x5596('0x27')](function(_0x53dec3){if(_0x53dec3){return _0x53dec3?{'count':_0x4112b2,'rows':_0x53dec3}:null;}})[_0x5596('0x27')](respondWithResult(_0xb2bc13,null))['catch'](handleError(_0xb2bc13,null));};exports['addConfiguration']=function(_0x515186,_0x5333a9,_0x1d2aff){if(_0x515186['body']['id']){delete _0x515186[_0x5596('0x4c')]['id'];}return db[_0x5596('0x2e')]['findOne']({'where':{'id':_0x515186[_0x5596('0x48')]['id']}})[_0x5596('0x27')](handleEntityNotFound(_0x5333a9,null))[_0x5596('0x27')](function(_0x2f703d){if(_0x2f703d){_0x515186[_0x5596('0x4c')][_0x5596('0x51')]=_0x2f703d['id'];_0x515186[_0x5596('0x4c')][_0x5596('0x52')]=integrations['getSubjects'](_0x515186['body']['channel'],_0x515186[_0x5596('0x4c')][_0x5596('0x30')]);_0x515186[_0x5596('0x4c')][_0x5596('0x53')]=integrations[_0x5596('0x54')](_0x515186[_0x5596('0x4c')][_0x5596('0x55')],_0x515186['body']['type']);return db['FreshsalesConfiguration']['create'](_0x515186[_0x5596('0x4c')],{'include':[{'model':db[_0x5596('0x56')],'as':_0x5596('0x52')},{'model':db[_0x5596('0x56')],'as':_0x5596('0x53')}]});}return null;})[_0x5596('0x27')](respondWithResult(_0x5333a9,null))[_0x5596('0x4a')](handleError(_0x5333a9,null));};exports[_0x5596('0x57')]=function(_0x379a3a,_0x2fad32,_0x398772){var _0xa92bf1='';var _0x360555='';return db[_0x5596('0x2e')]['findOne']({'where':{'id':_0x379a3a[_0x5596('0x48')]['id']},'attributes':['id',_0x5596('0x58'),_0x5596('0x59'),_0x5596('0x5a')]})['then'](handleEntityNotFound(_0x2fad32,null))['then'](function(_0x365ce6){if(_0x365ce6){_0x360555=_0x365ce6[_0x5596('0x58')];_0xa92bf1=_0x365ce6[_0x5596('0x59')];var _0x1da971=_0x365ce6['remoteUri']['slice'](-0x1);if(_0x1da971==='/'){_0xa92bf1=_0xa92bf1['substring'](0x0,_0xa92bf1[_0x5596('0x5b')](_0x1da971));}return rp({'method':_0x5596('0x5c'),'uri':util[_0x5596('0x5d')](_0x5596('0x5e'),_0xa92bf1,_0x5596('0x5f')),'headers':{'Authorization':'Token\x20token='+_0x365ce6[_0x5596('0x5a')]},'json':!![]});}})[_0x5596('0x27')](function(_0x466250){if(_0x466250){var _0x4d986e=_0x466250[_0x5596('0x60')];var _0x56aef5=![];var _0x41456d=null;for(_0x41456d=0x0;_0x41456d<_0x4d986e[_0x5596('0x39')];_0x41456d++){if(_0x4d986e[_0x41456d][_0x5596('0x61')]===_0x360555){_0x56aef5=!![];}}if(_0x56aef5){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x5596('0x62')});}}})[_0x5596('0x27')](respondWithResult(_0x2fad32,null))['catch'](function(_0xbe48fb){var _0x7be032=_0x379a3a[_0x5596('0x32')][_0x5596('0x63')]?0x1f4:_0xbe48fb[_0x5596('0x64')]||0x1f4;logger['error'](_0x5596('0x65'),_0x5596('0x57'),_0x7be032,JSON['stringify'](_0xbe48fb));delete _0xbe48fb[_0x5596('0x2b')];if(_0x7be032===0x191){_0x7be032=0x190;}_0x2fad32['status'](_0x7be032)['send'](_0x379a3a[_0x5596('0x32')][_0x5596('0x63')]?{'message':_0x5596('0x66'),'statusCode':_0xbe48fb[_0x5596('0x64')]}:_0xbe48fb);});}; \ No newline at end of file +var _0xab43=['FreshsalesAccount','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','options','includeAll','include','rows','show','params','length','merge','find','catch','create','body','findOne','FreshsalesConfiguration','order','getConfigurations','addConfiguration','channel','getDescriptions','FreshsalesField','Subjects','Descriptions','remoteUri','apiKey','slice','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','test','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','then','destroy','error','stack','name','send','index','map'];(function(_0x1b533a,_0x407e43){var _0x4d7cb5=function(_0x1a58f8){while(--_0x1a58f8){_0x1b533a['push'](_0x1b533a['shift']());}};_0x4d7cb5(++_0x407e43);}(_0xab43,0x94));var _0x3ab4=function(_0x1ea34f,_0x50f248){_0x1ea34f=_0x1ea34f-0x0;var _0x5ecee1=_0xab43[_0x1ea34f];return _0x5ecee1;};'use strict';var emlformat=require(_0x3ab4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3ab4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3ab4('0x2'));var moment=require(_0x3ab4('0x3'));var BPromise=require(_0x3ab4('0x4'));var Mustache=require(_0x3ab4('0x5'));var util=require(_0x3ab4('0x6'));var path=require(_0x3ab4('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3ab4('0x8'));var fs=require('fs');var fs_extra=require(_0x3ab4('0x9'));var _=require(_0x3ab4('0xa'));var squel=require(_0x3ab4('0xb'));var crypto=require('crypto');var jsforce=require(_0x3ab4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3ab4('0xd'));var querystring=require('querystring');var Papa=require(_0x3ab4('0xe'));var Redis=require('ioredis');var authService=require(_0x3ab4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3ab4('0x10'));var hardwareService=require(_0x3ab4('0x11'));var logger=require(_0x3ab4('0x12'))('api');var utils=require(_0x3ab4('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3ab4('0x14'));var db=require(_0x3ab4('0x15'))['db'];var integrations=require(_0x3ab4('0x16'));function respondWithStatusCode(_0x54da94,_0x41f91d){_0x41f91d=_0x41f91d||0xcc;return function(_0x3ce018){if(_0x3ce018){return _0x54da94[_0x3ab4('0x17')](_0x41f91d);}return _0x54da94[_0x3ab4('0x18')](_0x41f91d)[_0x3ab4('0x19')]();};}function respondWithResult(_0x243e7b,_0x128f42){_0x128f42=_0x128f42||0xc8;return function(_0x505530){if(_0x505530){return _0x243e7b[_0x3ab4('0x18')](_0x128f42)['json'](_0x505530);}};}function respondWithFilteredResult(_0x9c86b8,_0x431280){return function(_0x54d6d3){if(_0x54d6d3){var _0x58600e=typeof _0x431280['offset']===_0x3ab4('0x1a')&&typeof _0x431280[_0x3ab4('0x1b')]===_0x3ab4('0x1a');var _0x4f219a=_0x54d6d3[_0x3ab4('0x1c')];var _0x4dd4af=_0x58600e?0x0:_0x431280[_0x3ab4('0x1d')];var _0x401407=_0x58600e?_0x54d6d3['count']:_0x431280[_0x3ab4('0x1d')]+_0x431280[_0x3ab4('0x1b')];var _0x3d6507;if(_0x401407>=_0x4f219a){_0x401407=_0x4f219a;_0x3d6507=0xc8;}else{_0x3d6507=0xce;}_0x9c86b8['status'](_0x3d6507);return _0x9c86b8['set'](_0x3ab4('0x1e'),_0x4dd4af+'-'+_0x401407+'/'+_0x4f219a)[_0x3ab4('0x1f')](_0x54d6d3);}return null;};}function patchUpdates(_0x426c07){return function(_0x427671){try{jsonpatch[_0x3ab4('0x20')](_0x427671,_0x426c07,!![]);}catch(_0x337509){return BPromise[_0x3ab4('0x21')](_0x337509);}return _0x427671['save']();};}function saveUpdates(_0x25bc50,_0x3ffc64){return function(_0x23b204){if(_0x23b204){return _0x23b204['update'](_0x25bc50)[_0x3ab4('0x22')](function(_0x4a542c){return _0x4a542c;});}return null;};}function removeEntity(_0x4b7c40,_0x5de29b){return function(_0x169508){if(_0x169508){return _0x169508[_0x3ab4('0x23')]()[_0x3ab4('0x22')](function(){_0x4b7c40[_0x3ab4('0x18')](0xcc)[_0x3ab4('0x19')]();});}};}function handleEntityNotFound(_0x2ea82a,_0x28985f){return function(_0x23ee22){if(!_0x23ee22){_0x2ea82a['sendStatus'](0x194);}return _0x23ee22;};}function handleError(_0x3d71b4,_0x586ab9){_0x586ab9=_0x586ab9||0x1f4;return function(_0x2c9189){logger[_0x3ab4('0x24')](_0x2c9189[_0x3ab4('0x25')]);if(_0x2c9189[_0x3ab4('0x26')]){delete _0x2c9189['name'];}_0x3d71b4[_0x3ab4('0x18')](_0x586ab9)[_0x3ab4('0x27')](_0x2c9189);};}exports[_0x3ab4('0x28')]=function(_0x2e556a,_0x4fac54){var _0xfba822={},_0x2409da={},_0x1ffd7c={'count':0x0,'rows':[]};var _0x2efded=_[_0x3ab4('0x29')](db[_0x3ab4('0x2a')][_0x3ab4('0x2b')],function(_0x467b3b){return{'name':_0x467b3b['fieldName'],'type':_0x467b3b[_0x3ab4('0x2c')][_0x3ab4('0x2d')]};});_0x2409da[_0x3ab4('0x2e')]=_[_0x3ab4('0x29')](_0x2efded,_0x3ab4('0x26'));_0x2409da['query']=_[_0x3ab4('0x2f')](_0x2e556a[_0x3ab4('0x30')]);_0x2409da[_0x3ab4('0x31')]=_[_0x3ab4('0x32')](_0x2409da['model'],_0x2409da['query']);_0xfba822[_0x3ab4('0x33')]=_[_0x3ab4('0x32')](_0x2409da[_0x3ab4('0x2e')],qs['fields'](_0x2e556a['query'][_0x3ab4('0x34')]));_0xfba822[_0x3ab4('0x33')]=_0xfba822['attributes']['length']?_0xfba822['attributes']:_0x2409da[_0x3ab4('0x2e')];if(!_0x2e556a[_0x3ab4('0x30')][_0x3ab4('0x35')](_0x3ab4('0x36'))){_0xfba822[_0x3ab4('0x1b')]=qs[_0x3ab4('0x1b')](_0x2e556a[_0x3ab4('0x30')][_0x3ab4('0x1b')]);_0xfba822[_0x3ab4('0x1d')]=qs[_0x3ab4('0x1d')](_0x2e556a[_0x3ab4('0x30')][_0x3ab4('0x1d')]);}_0xfba822['order']=qs[_0x3ab4('0x37')](_0x2e556a[_0x3ab4('0x30')][_0x3ab4('0x37')]);_0xfba822[_0x3ab4('0x38')]=qs[_0x3ab4('0x31')](_['pick'](_0x2e556a[_0x3ab4('0x30')],_0x2409da[_0x3ab4('0x31')]),_0x2efded);if(_0x2e556a[_0x3ab4('0x30')][_0x3ab4('0x39')]){_0xfba822['where']=_['merge'](_0xfba822[_0x3ab4('0x38')],{'$or':_[_0x3ab4('0x29')](_0x2efded,function(_0x599881){if(_0x599881[_0x3ab4('0x2c')]!=='VIRTUAL'){var _0x45b296={};_0x45b296[_0x599881[_0x3ab4('0x26')]]={'$like':'%'+_0x2e556a[_0x3ab4('0x30')]['filter']+'%'};return _0x45b296;}})});}_0xfba822=_['merge']({},_0xfba822,_0x2e556a[_0x3ab4('0x3a')]);var _0x44f18f={'where':_0xfba822[_0x3ab4('0x38')]};return db[_0x3ab4('0x2a')][_0x3ab4('0x1c')](_0x44f18f)['then'](function(_0x58d330){_0x1ffd7c['count']=_0x58d330;if(_0x2e556a['query'][_0x3ab4('0x3b')]){_0xfba822[_0x3ab4('0x3c')]=[{'all':!![]}];}return db[_0x3ab4('0x2a')]['findAll'](_0xfba822);})[_0x3ab4('0x22')](function(_0x547dda){_0x1ffd7c[_0x3ab4('0x3d')]=_0x547dda;return _0x1ffd7c;})[_0x3ab4('0x22')](respondWithFilteredResult(_0x4fac54,_0xfba822))['catch'](handleError(_0x4fac54,null));};exports[_0x3ab4('0x3e')]=function(_0x22f488,_0x4bf1ba){var _0x597717={'raw':![],'where':{'id':_0x22f488[_0x3ab4('0x3f')]['id']}},_0x47f6ca={};_0x47f6ca[_0x3ab4('0x2e')]=_[_0x3ab4('0x2f')](db[_0x3ab4('0x2a')][_0x3ab4('0x2b')]);_0x47f6ca[_0x3ab4('0x30')]=_[_0x3ab4('0x2f')](_0x22f488['query']);_0x47f6ca[_0x3ab4('0x31')]=_['intersection'](_0x47f6ca[_0x3ab4('0x2e')],_0x47f6ca[_0x3ab4('0x30')]);_0x597717[_0x3ab4('0x33')]=_[_0x3ab4('0x32')](_0x47f6ca[_0x3ab4('0x2e')],qs[_0x3ab4('0x34')](_0x22f488[_0x3ab4('0x30')][_0x3ab4('0x34')]));_0x597717['attributes']=_0x597717[_0x3ab4('0x33')][_0x3ab4('0x40')]?_0x597717[_0x3ab4('0x33')]:_0x47f6ca[_0x3ab4('0x2e')];if(_0x22f488['query'][_0x3ab4('0x3b')]){_0x597717[_0x3ab4('0x3c')]=[{'all':!![]}];}_0x597717=_[_0x3ab4('0x41')]({},_0x597717,_0x22f488[_0x3ab4('0x3a')]);return db[_0x3ab4('0x2a')][_0x3ab4('0x42')](_0x597717)['then'](handleEntityNotFound(_0x4bf1ba,null))[_0x3ab4('0x22')](respondWithResult(_0x4bf1ba,null))[_0x3ab4('0x43')](handleError(_0x4bf1ba,null));};exports['create']=function(_0x3a7970,_0x44e999){return db[_0x3ab4('0x2a')][_0x3ab4('0x44')](_0x3a7970[_0x3ab4('0x45')],{})[_0x3ab4('0x22')](respondWithResult(_0x44e999,0xc9))[_0x3ab4('0x43')](handleError(_0x44e999,null));};exports['update']=function(_0xeb2740,_0x3d79e2){if(_0xeb2740['body']['id']){delete _0xeb2740[_0x3ab4('0x45')]['id'];}return db[_0x3ab4('0x2a')][_0x3ab4('0x42')]({'where':{'id':_0xeb2740[_0x3ab4('0x3f')]['id']}})[_0x3ab4('0x22')](handleEntityNotFound(_0x3d79e2,null))['then'](saveUpdates(_0xeb2740[_0x3ab4('0x45')],null))[_0x3ab4('0x22')](respondWithResult(_0x3d79e2,null))['catch'](handleError(_0x3d79e2,null));};exports[_0x3ab4('0x23')]=function(_0x51e9b4,_0x3b775c){return db['FreshsalesAccount'][_0x3ab4('0x42')]({'where':{'id':_0x51e9b4['params']['id']}})['then'](handleEntityNotFound(_0x3b775c,null))['then'](removeEntity(_0x3b775c,null))['catch'](handleError(_0x3b775c,null));};exports['getConfigurations']=function(_0x21cd85,_0x296586,_0x2d9e39){var _0xb08217={};var _0x4f6ba5={};var _0x538fd0;var _0x4cfff9;return db[_0x3ab4('0x2a')][_0x3ab4('0x46')]({'where':{'id':_0x21cd85[_0x3ab4('0x3f')]['id']}})[_0x3ab4('0x22')](handleEntityNotFound(_0x296586,null))[_0x3ab4('0x22')](function(_0x334e1e){if(_0x334e1e){_0x538fd0=_0x334e1e;_0x4f6ba5[_0x3ab4('0x2e')]=_[_0x3ab4('0x2f')](db[_0x3ab4('0x47')][_0x3ab4('0x2b')]);_0x4f6ba5[_0x3ab4('0x30')]=_[_0x3ab4('0x2f')](_0x21cd85[_0x3ab4('0x30')]);_0x4f6ba5['filters']=_['intersection'](_0x4f6ba5[_0x3ab4('0x2e')],_0x4f6ba5[_0x3ab4('0x30')]);_0xb08217[_0x3ab4('0x33')]=_['intersection'](_0x4f6ba5['model'],qs['fields'](_0x21cd85[_0x3ab4('0x30')]['fields']));_0xb08217[_0x3ab4('0x33')]=_0xb08217[_0x3ab4('0x33')]['length']?_0xb08217[_0x3ab4('0x33')]:_0x4f6ba5[_0x3ab4('0x2e')];_0xb08217[_0x3ab4('0x48')]=qs[_0x3ab4('0x37')](_0x21cd85[_0x3ab4('0x30')][_0x3ab4('0x37')]);_0xb08217[_0x3ab4('0x38')]=qs[_0x3ab4('0x31')](_['pick'](_0x21cd85[_0x3ab4('0x30')],_0x4f6ba5[_0x3ab4('0x31')]));if(_0x21cd85[_0x3ab4('0x30')][_0x3ab4('0x39')]){_0xb08217[_0x3ab4('0x38')]=_[_0x3ab4('0x41')](_0xb08217[_0x3ab4('0x38')],{'$or':_[_0x3ab4('0x29')](_0xb08217[_0x3ab4('0x33')],function(_0x17536b){var _0x4d05c4={};_0x4d05c4[_0x17536b]={'$like':'%'+_0x21cd85[_0x3ab4('0x30')]['filter']+'%'};return _0x4d05c4;})});}_0xb08217=_[_0x3ab4('0x41')]({},_0xb08217,_0x21cd85[_0x3ab4('0x3a')]);return _0x538fd0[_0x3ab4('0x49')](_0xb08217);}})['then'](function(_0x365d34){if(_0x365d34){_0x4cfff9=_0x365d34[_0x3ab4('0x40')];if(!_0x21cd85[_0x3ab4('0x30')][_0x3ab4('0x35')]('nolimit')){_0xb08217[_0x3ab4('0x1b')]=qs['limit'](_0x21cd85[_0x3ab4('0x30')][_0x3ab4('0x1b')]);_0xb08217['offset']=qs[_0x3ab4('0x1d')](_0x21cd85['query'][_0x3ab4('0x1d')]);}return _0x538fd0[_0x3ab4('0x49')](_0xb08217);}})[_0x3ab4('0x22')](function(_0x493dc9){if(_0x493dc9){return _0x493dc9?{'count':_0x4cfff9,'rows':_0x493dc9}:null;}})[_0x3ab4('0x22')](respondWithResult(_0x296586,null))[_0x3ab4('0x43')](handleError(_0x296586,null));};exports[_0x3ab4('0x4a')]=function(_0x54a9de,_0x5cb5c6,_0x3d7b95){if(_0x54a9de[_0x3ab4('0x45')]['id']){delete _0x54a9de[_0x3ab4('0x45')]['id'];}return db[_0x3ab4('0x2a')][_0x3ab4('0x46')]({'where':{'id':_0x54a9de[_0x3ab4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5cb5c6,null))['then'](function(_0x922f04){if(_0x922f04){_0x54a9de[_0x3ab4('0x45')]['AccountId']=_0x922f04['id'];_0x54a9de[_0x3ab4('0x45')]['Subjects']=integrations['getSubjects'](_0x54a9de[_0x3ab4('0x45')][_0x3ab4('0x4b')],_0x54a9de[_0x3ab4('0x45')]['type']);_0x54a9de[_0x3ab4('0x45')]['Descriptions']=integrations[_0x3ab4('0x4c')](_0x54a9de[_0x3ab4('0x45')][_0x3ab4('0x4b')],_0x54a9de[_0x3ab4('0x45')][_0x3ab4('0x2c')]);return db[_0x3ab4('0x47')]['create'](_0x54a9de[_0x3ab4('0x45')],{'include':[{'model':db[_0x3ab4('0x4d')],'as':_0x3ab4('0x4e')},{'model':db['FreshsalesField'],'as':_0x3ab4('0x4f')}]});}return null;})[_0x3ab4('0x22')](respondWithResult(_0x5cb5c6,null))[_0x3ab4('0x43')](handleError(_0x5cb5c6,null));};exports['getFields']=function(_0x525022,_0x3b52fe,_0x167edf){var _0x2dede4='';var _0x48c09e='';return db[_0x3ab4('0x2a')][_0x3ab4('0x46')]({'where':{'id':_0x525022['params']['id']},'attributes':['id','username',_0x3ab4('0x50'),_0x3ab4('0x51')]})['then'](handleEntityNotFound(_0x3b52fe,null))[_0x3ab4('0x22')](function(_0x2664c6){if(_0x2664c6){_0x48c09e=_0x2664c6['username'];_0x2dede4=_0x2664c6[_0x3ab4('0x50')];var _0x11f5b4=_0x2664c6[_0x3ab4('0x50')][_0x3ab4('0x52')](-0x1);if(_0x11f5b4==='/'){_0x2dede4=_0x2dede4['substring'](0x0,_0x2dede4['lastIndexOf'](_0x11f5b4));}return rp({'method':_0x3ab4('0x53'),'uri':util[_0x3ab4('0x54')](_0x3ab4('0x55'),_0x2dede4,_0x3ab4('0x56')),'headers':{'Authorization':_0x3ab4('0x57')+_0x2664c6[_0x3ab4('0x51')]},'json':!![]});}})[_0x3ab4('0x22')](function(_0x1fc507){if(_0x1fc507){var _0xa9bac1=_0x1fc507[_0x3ab4('0x58')];var _0x131fe5=![];var _0x48fc5b=null;for(_0x48fc5b=0x0;_0x48fc5b<_0xa9bac1[_0x3ab4('0x40')];_0x48fc5b++){if(_0xa9bac1[_0x48fc5b][_0x3ab4('0x59')]===_0x48c09e){_0x131fe5=!![];}}if(_0x131fe5){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x3ab4('0x5a')});}}})[_0x3ab4('0x22')](respondWithResult(_0x3b52fe,null))[_0x3ab4('0x43')](function(_0x57522d){var _0x803d21=_0x525022[_0x3ab4('0x30')]['test']?0x1f4:_0x57522d[_0x3ab4('0x5b')]||0x1f4;logger[_0x3ab4('0x24')](_0x3ab4('0x5c'),_0x3ab4('0x5d'),_0x803d21,JSON['stringify'](_0x57522d));delete _0x57522d[_0x3ab4('0x26')];if(_0x803d21===0x191){_0x803d21=0x190;}_0x3b52fe['status'](_0x803d21)['send'](_0x525022['query'][_0x3ab4('0x5e')]?{'message':'Wrong\x20credentials','statusCode':_0x57522d[_0x3ab4('0x5b')]}:_0x57522d);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 6dbe2d5..7322834 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 _0xe2fe=['define','int_freshsales_accounts','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0xaded7d,_0x31b658){var _0x417142=function(_0x218f7e){while(--_0x218f7e){_0xaded7d['push'](_0xaded7d['shift']());}};_0x417142(++_0x31b658);}(_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('./intFreshsalesAccount.attributes');var integrations=require(_0xee2f('0x7'));module[_0xee2f('0x8')]=function(_0x49926b,_0x1533a0){return _0x49926b[_0xee2f('0x9')]('FreshsalesAccount',attributes,{'tableName':_0xee2f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fdc=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','lodash','util','../../config/logger','api'];(function(_0x5208b2,_0x1eb1c4){var _0x52b0a0=function(_0x211d13){while(--_0x211d13){_0x5208b2['push'](_0x5208b2['shift']());}};_0x52b0a0(++_0x1eb1c4);}(_0x5fdc,0x127));var _0xc5fd=function(_0x155dc4,_0x5b6bd1){_0x155dc4=_0x155dc4-0x0;var _0x22f064=_0x5fdc[_0x155dc4];return _0x22f064;};'use strict';var _=require(_0xc5fd('0x0'));var util=require(_0xc5fd('0x1'));var logger=require(_0xc5fd('0x2'))(_0xc5fd('0x3'));var moment=require(_0xc5fd('0x4'));var BPromise=require(_0xc5fd('0x5'));var rp=require(_0xc5fd('0x6'));var fs=require('fs');var path=require(_0xc5fd('0x7'));var rimraf=require(_0xc5fd('0x8'));var config=require(_0xc5fd('0x9'));var attributes=require(_0xc5fd('0xa'));var integrations=require(_0xc5fd('0xb'));module[_0xc5fd('0xc')]=function(_0x216902,_0x15ffe7){return _0x216902['define']('FreshsalesAccount',attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 0dc3961..b02446b 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 _0x3a6d=['client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','attributes','limit','include','model','map','debug','ShowFreshsalesAccount','find','raw','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x1e3f9e,_0x489b75){var _0x553299=function(_0x4a649e){while(--_0x4a649e){_0x1e3f9e['push'](_0x1e3f9e['shift']());}};_0x553299(++_0x489b75);}(_0x3a6d,0x143));var _0xd3a6=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x3a6d[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var moment=require('moment');var BPromise=require(_0xd3a6('0x2'));var rs=require(_0xd3a6('0x3'));var fs=require('fs');var Redis=require(_0xd3a6('0x4'));var db=require(_0xd3a6('0x5'))['db'];var utils=require(_0xd3a6('0x6'));var logger=require('../../config/logger')(_0xd3a6('0x7'));var config=require(_0xd3a6('0x8'));var jayson=require(_0xd3a6('0x9'));var client=jayson[_0xd3a6('0xa')][_0xd3a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x282cb1,_0x58d83a,_0x121bd2){return new BPromise(function(_0x134dd3,_0x16858){return client[_0xd3a6('0xc')](_0x282cb1,_0x121bd2)[_0xd3a6('0xd')](function(_0xa67661){logger[_0xd3a6('0xe')](_0xd3a6('0xf'),_0x58d83a,_0xd3a6('0x10'));logger['debug'](_0xd3a6('0x11'),_0x58d83a,_0xd3a6('0x10'),JSON[_0xd3a6('0x12')](_0xa67661));if(_0xa67661[_0xd3a6('0x13')]){if(_0xa67661[_0xd3a6('0x13')]['code']===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x58d83a,_0xa67661[_0xd3a6('0x13')][_0xd3a6('0x14')]);return _0x16858(_0xa67661[_0xd3a6('0x13')][_0xd3a6('0x14')]);}logger[_0xd3a6('0x13')](_0xd3a6('0xf'),_0x58d83a,_0xa67661[_0xd3a6('0x13')]['message']);return _0x134dd3(_0xa67661[_0xd3a6('0x13')][_0xd3a6('0x14')]);}else{logger[_0xd3a6('0xe')]('FreshsalesAccount,\x20%s,\x20%s',_0x58d83a,_0xd3a6('0x10'));_0x134dd3(_0xa67661[_0xd3a6('0x15')][_0xd3a6('0x14')]);}})['catch'](function(_0x3498d5){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x58d83a,_0x3498d5);_0x16858(_0x3498d5);});});}exports[_0xd3a6('0x16')]=function(_0x8d1286){var _0x32683f=this;return new Promise(function(_0xbe58b4,_0x22fb05){return db[_0xd3a6('0x17')][_0xd3a6('0x18')]({'raw':_0x8d1286['options']?_0x8d1286[_0xd3a6('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x8d1286[_0xd3a6('0x19')]?_0x8d1286[_0xd3a6('0x19')][_0xd3a6('0x1a')]||null:null,'attributes':_0x8d1286[_0xd3a6('0x19')]?_0x8d1286[_0xd3a6('0x19')][_0xd3a6('0x1b')]||null:null,'limit':_0x8d1286['options']?_0x8d1286[_0xd3a6('0x19')][_0xd3a6('0x1c')]||null:null,'include':_0x8d1286['options']?_0x8d1286['options']['include']?_['map'](_0x8d1286['options'][_0xd3a6('0x1d')],function(_0x400982){return{'model':db[_0x400982[_0xd3a6('0x1e')]],'as':_0x400982['as'],'attributes':_0x400982['attributes'],'include':_0x400982[_0xd3a6('0x1d')]?_['map'](_0x400982[_0xd3a6('0x1d')],function(_0x16afc8){return{'model':db[_0x16afc8[_0xd3a6('0x1e')]],'as':_0x16afc8['as'],'attributes':_0x16afc8['attributes'],'include':_0x16afc8[_0xd3a6('0x1d')]?_[_0xd3a6('0x1f')](_0x16afc8[_0xd3a6('0x1d')],function(_0x219e32){return{'model':db[_0x219e32[_0xd3a6('0x1e')]],'as':_0x219e32['as'],'attributes':_0x219e32[_0xd3a6('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30df90){logger[_0xd3a6('0xe')](_0xd3a6('0x16'),_0x8d1286);logger[_0xd3a6('0x20')](_0xd3a6('0x16'),_0x8d1286,JSON[_0xd3a6('0x12')](_0x30df90));_0xbe58b4(_0x30df90);})['catch'](function(_0x535bd4){logger[_0xd3a6('0x13')](_0xd3a6('0x16'),_0x535bd4[_0xd3a6('0x14')],_0x8d1286);_0x22fb05(_0x32683f[_0xd3a6('0x13')](0x1f4,_0x535bd4['message']));});});};exports[_0xd3a6('0x21')]=function(_0xa4efd){var _0x4d322a=this;return new Promise(function(_0x14381c,_0x5d9867){return db[_0xd3a6('0x17')][_0xd3a6('0x22')]({'raw':_0xa4efd[_0xd3a6('0x19')]?_0xa4efd[_0xd3a6('0x19')][_0xd3a6('0x23')]===undefined?!![]:![]:!![],'where':_0xa4efd[_0xd3a6('0x19')]?_0xa4efd[_0xd3a6('0x19')]['where']||null:null,'attributes':_0xa4efd['options']?_0xa4efd[_0xd3a6('0x19')][_0xd3a6('0x1b')]||null:null,'include':_0xa4efd[_0xd3a6('0x19')]?_0xa4efd['options'][_0xd3a6('0x1d')]?_[_0xd3a6('0x1f')](_0xa4efd[_0xd3a6('0x19')][_0xd3a6('0x1d')],function(_0x3ebd0d){return{'model':db[_0x3ebd0d[_0xd3a6('0x1e')]],'as':_0x3ebd0d['as'],'attributes':_0x3ebd0d[_0xd3a6('0x1b')],'include':_0x3ebd0d[_0xd3a6('0x1d')]?_['map'](_0x3ebd0d[_0xd3a6('0x1d')],function(_0x41981c){return{'model':db[_0x41981c[_0xd3a6('0x1e')]],'as':_0x41981c['as'],'attributes':_0x41981c[_0xd3a6('0x1b')],'include':_0x41981c[_0xd3a6('0x1d')]?_[_0xd3a6('0x1f')](_0x41981c['include'],function(_0x16a30a){return{'model':db[_0x16a30a['model']],'as':_0x16a30a['as'],'attributes':_0x16a30a[_0xd3a6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd3a6('0xd')](function(_0x180bb9){logger[_0xd3a6('0xe')]('ShowFreshsalesAccount',_0xa4efd);logger['debug'](_0xd3a6('0x21'),_0xa4efd,JSON[_0xd3a6('0x12')](_0x180bb9));_0x14381c(_0x180bb9);})[_0xd3a6('0x24')](function(_0x5188e1){logger[_0xd3a6('0x13')](_0xd3a6('0x21'),_0x5188e1['message'],_0xa4efd);_0x5d9867(_0x4d322a[_0xd3a6('0x13')](0x1f4,_0x5188e1['message']));});});}; \ No newline at end of file +var _0xafb9=['ShowFreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','limit','map','attributes','include','model','debug'];(function(_0x179cf3,_0x16f529){var _0x599ee3=function(_0x6fdce7){while(--_0x6fdce7){_0x179cf3['push'](_0x179cf3['shift']());}};_0x599ee3(++_0x16f529);}(_0xafb9,0x68));var _0x9afb=function(_0xf64efd,_0x17bd4b){_0xf64efd=_0xf64efd-0x0;var _0x5ac355=_0xafb9[_0xf64efd];return _0x5ac355;};'use strict';var _=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var moment=require(_0x9afb('0x2'));var BPromise=require(_0x9afb('0x3'));var rs=require(_0x9afb('0x4'));var fs=require('fs');var Redis=require(_0x9afb('0x5'));var db=require(_0x9afb('0x6'))['db'];var utils=require(_0x9afb('0x7'));var logger=require(_0x9afb('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9afb('0x9'));var client=jayson['client'][_0x9afb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x548b24,_0x556880,_0x4c0e9d){return new BPromise(function(_0x1edf77,_0x20b8c1){return client['request'](_0x548b24,_0x4c0e9d)[_0x9afb('0xb')](function(_0x3e0264){logger[_0x9afb('0xc')](_0x9afb('0xd'),_0x556880,_0x9afb('0xe'));logger['debug']('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x556880,_0x9afb('0xe'),JSON[_0x9afb('0xf')](_0x3e0264));if(_0x3e0264[_0x9afb('0x10')]){if(_0x3e0264[_0x9afb('0x10')][_0x9afb('0x11')]===0x1f4){logger[_0x9afb('0x10')](_0x9afb('0xd'),_0x556880,_0x3e0264[_0x9afb('0x10')][_0x9afb('0x12')]);return _0x20b8c1(_0x3e0264[_0x9afb('0x10')]['message']);}logger[_0x9afb('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x556880,_0x3e0264['error'][_0x9afb('0x12')]);return _0x1edf77(_0x3e0264[_0x9afb('0x10')][_0x9afb('0x12')]);}else{logger[_0x9afb('0xc')](_0x9afb('0xd'),_0x556880,_0x9afb('0xe'));_0x1edf77(_0x3e0264[_0x9afb('0x13')]['message']);}})[_0x9afb('0x14')](function(_0x2145c2){logger[_0x9afb('0x10')](_0x9afb('0xd'),_0x556880,_0x2145c2);_0x20b8c1(_0x2145c2);});});}exports[_0x9afb('0x15')]=function(_0x508433){var _0x201ff4=this;return new Promise(function(_0x50a7e4,_0x3fdb34){return db[_0x9afb('0x16')]['findAll']({'raw':_0x508433['options']?_0x508433[_0x9afb('0x17')][_0x9afb('0x18')]===undefined?!![]:![]:!![],'where':_0x508433[_0x9afb('0x17')]?_0x508433[_0x9afb('0x17')][_0x9afb('0x19')]||null:null,'attributes':_0x508433['options']?_0x508433[_0x9afb('0x17')]['attributes']||null:null,'limit':_0x508433['options']?_0x508433[_0x9afb('0x17')][_0x9afb('0x1a')]||null:null,'include':_0x508433[_0x9afb('0x17')]?_0x508433[_0x9afb('0x17')]['include']?_[_0x9afb('0x1b')](_0x508433[_0x9afb('0x17')]['include'],function(_0x571bd9){return{'model':db[_0x571bd9['model']],'as':_0x571bd9['as'],'attributes':_0x571bd9[_0x9afb('0x1c')],'include':_0x571bd9['include']?_[_0x9afb('0x1b')](_0x571bd9[_0x9afb('0x1d')],function(_0x50a919){return{'model':db[_0x50a919[_0x9afb('0x1e')]],'as':_0x50a919['as'],'attributes':_0x50a919[_0x9afb('0x1c')],'include':_0x50a919[_0x9afb('0x1d')]?_[_0x9afb('0x1b')](_0x50a919['include'],function(_0x348255){return{'model':db[_0x348255['model']],'as':_0x348255['as'],'attributes':_0x348255[_0x9afb('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5692fa){logger[_0x9afb('0xc')](_0x9afb('0x15'),_0x508433);logger[_0x9afb('0x1f')](_0x9afb('0x15'),_0x508433,JSON[_0x9afb('0xf')](_0x5692fa));_0x50a7e4(_0x5692fa);})[_0x9afb('0x14')](function(_0x46673d){logger['error']('GetFreshsalesAccount',_0x46673d[_0x9afb('0x12')],_0x508433);_0x3fdb34(_0x201ff4[_0x9afb('0x10')](0x1f4,_0x46673d['message']));});});};exports[_0x9afb('0x20')]=function(_0x2f388c){var _0x5560bd=this;return new Promise(function(_0x1b9f18,_0xc220e9){return db[_0x9afb('0x16')][_0x9afb('0x21')]({'raw':_0x2f388c[_0x9afb('0x17')]?_0x2f388c[_0x9afb('0x17')][_0x9afb('0x18')]===undefined?!![]:![]:!![],'where':_0x2f388c[_0x9afb('0x17')]?_0x2f388c['options']['where']||null:null,'attributes':_0x2f388c[_0x9afb('0x17')]?_0x2f388c[_0x9afb('0x17')][_0x9afb('0x1c')]||null:null,'include':_0x2f388c[_0x9afb('0x17')]?_0x2f388c[_0x9afb('0x17')][_0x9afb('0x1d')]?_[_0x9afb('0x1b')](_0x2f388c['options']['include'],function(_0x67d63a){return{'model':db[_0x67d63a[_0x9afb('0x1e')]],'as':_0x67d63a['as'],'attributes':_0x67d63a['attributes'],'include':_0x67d63a[_0x9afb('0x1d')]?_['map'](_0x67d63a[_0x9afb('0x1d')],function(_0xc59d55){return{'model':db[_0xc59d55['model']],'as':_0xc59d55['as'],'attributes':_0xc59d55[_0x9afb('0x1c')],'include':_0xc59d55['include']?_[_0x9afb('0x1b')](_0xc59d55[_0x9afb('0x1d')],function(_0x45c57f){return{'model':db[_0x45c57f[_0x9afb('0x1e')]],'as':_0x45c57f['as'],'attributes':_0x45c57f[_0x9afb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9afb('0xb')](function(_0x19227f){logger[_0x9afb('0xc')]('ShowFreshsalesAccount',_0x2f388c);logger[_0x9afb('0x1f')]('ShowFreshsalesAccount',_0x2f388c,JSON[_0x9afb('0xf')](_0x19227f));_0x1b9f18(_0x19227f);})[_0x9afb('0x14')](function(_0x3c5231){logger[_0x9afb('0x10')](_0x9afb('0x20'),_0x3c5231[_0x9afb('0x12')],_0x2f388c);_0xc220e9(_0x5560bd[_0x9afb('0x10')](0x1f4,_0x3c5231[_0x9afb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 1967a2e..cef7132 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 _0xec0c=['../../components/auth/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','show','/:id/subjects','getDescriptions','/:id/fields','getFields','create','put','/:id','update','delete','multer','util','path','connect-timeout','express'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xec0c,0x80));var _0xcec0=function(_0x47e05f,_0x3f9395){_0x47e05f=_0x47e05f-0x0;var _0x5c5095=_0xec0c[_0x47e05f];return _0x5c5095;};'use strict';var multer=require(_0xcec0('0x0'));var util=require(_0xcec0('0x1'));var path=require(_0xcec0('0x2'));var timeout=require(_0xcec0('0x3'));var express=require(_0xcec0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcec0('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcec0('0x6'));router[_0xcec0('0x7')]('/',auth[_0xcec0('0x8')](),controller['index']);router[_0xcec0('0x7')]('/:id',auth[_0xcec0('0x8')](),controller[_0xcec0('0x9')]);router[_0xcec0('0x7')](_0xcec0('0xa'),auth[_0xcec0('0x8')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0xcec0('0x8')](),controller[_0xcec0('0xb')]);router[_0xcec0('0x7')](_0xcec0('0xc'),auth[_0xcec0('0x8')](),controller[_0xcec0('0xd')]);router['post']('/',auth[_0xcec0('0x8')](),controller[_0xcec0('0xe')]);router[_0xcec0('0xf')](_0xcec0('0x10'),auth[_0xcec0('0x8')](),controller[_0xcec0('0x11')]);router[_0xcec0('0x12')](_0xcec0('0x10'),auth[_0xcec0('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7fbd=['index','get','/:id','isAuthenticated','show','/:id/subjects','getSubjects','getDescriptions','/:id/fields','getFields','post','create','update','delete','multer','express','Router','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller'];(function(_0x1e0245,_0x154010){var _0x53bea7=function(_0x5d6b09){while(--_0x5d6b09){_0x1e0245['push'](_0x1e0245['shift']());}};_0x53bea7(++_0x154010);}(_0x7fbd,0x176));var _0xd7fb=function(_0x533ef3,_0x42fc7c){_0x533ef3=_0x533ef3-0x0;var _0x25ceac=_0x7fbd[_0x533ef3];return _0x25ceac;};'use strict';var multer=require(_0xd7fb('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd7fb('0x1'));var router=express[_0xd7fb('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xd7fb('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xd7fb('0x4'));var controller=require(_0xd7fb('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xd7fb('0x6')]);router[_0xd7fb('0x7')](_0xd7fb('0x8'),auth[_0xd7fb('0x9')](),controller[_0xd7fb('0xa')]);router[_0xd7fb('0x7')](_0xd7fb('0xb'),auth[_0xd7fb('0x9')](),controller[_0xd7fb('0xc')]);router['get']('/:id/descriptions',auth[_0xd7fb('0x9')](),controller[_0xd7fb('0xd')]);router[_0xd7fb('0x7')](_0xd7fb('0xe'),auth[_0xd7fb('0x9')](),controller[_0xd7fb('0xf')]);router[_0xd7fb('0x10')]('/',auth[_0xd7fb('0x9')](),controller[_0xd7fb('0x11')]);router['put'](_0xd7fb('0x8'),auth[_0xd7fb('0x9')](),controller[_0xd7fb('0x12')]);router[_0xd7fb('0x13')](_0xd7fb('0x8'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index daa8ffb..4a2cc7f 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 _0xf86e=['exports','STRING','sequelize'];(function(_0x2a720f,_0x14ca9c){var _0x35a853=function(_0xd11eb6){while(--_0xd11eb6){_0x2a720f['push'](_0x2a720f['shift']());}};_0x35a853(++_0x14ca9c);}(_0xf86e,0x65));var _0xef86=function(_0x2212d1,_0x483fc8){_0x2212d1=_0x2212d1-0x0;var _0x15eec5=_0xf86e[_0x2212d1];return _0x15eec5;};'use strict';var Sequelize=require(_0xef86('0x0'));module[_0xef86('0x1')]={'name':{'type':Sequelize[_0xef86('0x2')]},'description':{'type':Sequelize[_0xef86('0x2')]}}; \ No newline at end of file +var _0xdd4b=['exports','STRING','sequelize'];(function(_0x256c0d,_0x52effd){var _0x11d449=function(_0x138672){while(--_0x138672){_0x256c0d['push'](_0x256c0d['shift']());}};_0x11d449(++_0x52effd);}(_0xdd4b,0x11c));var _0xbdd4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd4b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xbdd4('0x0'));module[_0xbdd4('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbdd4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index bd96e02..60e343f 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 _0xc062=['query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','name','options','FreshsalesConfiguration','include','findAll','catch','show','params','attributes','includeAll','create','body','destroy','find','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','index','map','rawAttributes','type','model'];(function(_0x1c92ff,_0x3dfb69){var _0x2930ee=function(_0x33ea67){while(--_0x33ea67){_0x1c92ff['push'](_0x1c92ff['shift']());}};_0x2930ee(++_0x3dfb69);}(_0xc062,0x10c));var _0x2c06=function(_0x38428e,_0x201da3){_0x38428e=_0x38428e-0x0;var _0x431293=_0xc062[_0x38428e];return _0x431293;};'use strict';var emlformat=require(_0x2c06('0x0'));var rimraf=require(_0x2c06('0x1'));var zipdir=require(_0x2c06('0x2'));var jsonpatch=require(_0x2c06('0x3'));var rp=require(_0x2c06('0x4'));var moment=require('moment');var BPromise=require(_0x2c06('0x5'));var Mustache=require('mustache');var util=require(_0x2c06('0x6'));var path=require('path');var sox=require(_0x2c06('0x7'));var csv=require(_0x2c06('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2c06('0x9'));var _=require('lodash');var squel=require(_0x2c06('0xa'));var crypto=require(_0x2c06('0xb'));var jsforce=require(_0x2c06('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2c06('0x8'));var querystring=require('querystring');var Papa=require(_0x2c06('0xd'));var Redis=require(_0x2c06('0xe'));var authService=require(_0x2c06('0xf'));var qs=require(_0x2c06('0x10'));var as=require(_0x2c06('0x11'));var hardwareService=require(_0x2c06('0x12'));var logger=require(_0x2c06('0x13'))(_0x2c06('0x14'));var utils=require(_0x2c06('0x15'));var config=require(_0x2c06('0x16'));var licenseUtil=require(_0x2c06('0x17'));var db=require(_0x2c06('0x18'))['db'];function respondWithStatusCode(_0x2a2148,_0x74452f){_0x74452f=_0x74452f||0xcc;return function(_0x3232a8){if(_0x3232a8){return _0x2a2148[_0x2c06('0x19')](_0x74452f);}return _0x2a2148[_0x2c06('0x1a')](_0x74452f)['end']();};}function respondWithResult(_0x56ce35,_0x3ec64f){_0x3ec64f=_0x3ec64f||0xc8;return function(_0x55a878){if(_0x55a878){return _0x56ce35[_0x2c06('0x1a')](_0x3ec64f)[_0x2c06('0x1b')](_0x55a878);}};}function respondWithFilteredResult(_0x467651,_0x3a5cb0){return function(_0x5b564a){if(_0x5b564a){var _0x2a034d=typeof _0x3a5cb0[_0x2c06('0x1c')]===_0x2c06('0x1d')&&typeof _0x3a5cb0[_0x2c06('0x1e')]===_0x2c06('0x1d');var _0x372048=_0x5b564a['count'];var _0x164d5c=_0x2a034d?0x0:_0x3a5cb0[_0x2c06('0x1c')];var _0x139045=_0x2a034d?_0x5b564a[_0x2c06('0x1f')]:_0x3a5cb0['offset']+_0x3a5cb0[_0x2c06('0x1e')];var _0x25d226;if(_0x139045>=_0x372048){_0x139045=_0x372048;_0x25d226=0xc8;}else{_0x25d226=0xce;}_0x467651[_0x2c06('0x1a')](_0x25d226);return _0x467651[_0x2c06('0x20')]('Content-Range',_0x164d5c+'-'+_0x139045+'/'+_0x372048)['json'](_0x5b564a);}return null;};}function patchUpdates(_0x5a30ca){return function(_0x1f6417){try{jsonpatch[_0x2c06('0x21')](_0x1f6417,_0x5a30ca,!![]);}catch(_0x49650c){return BPromise['reject'](_0x49650c);}return _0x1f6417[_0x2c06('0x22')]();};}function saveUpdates(_0x273da7,_0x531913){return function(_0x3dcc03){if(_0x3dcc03){return _0x3dcc03[_0x2c06('0x23')](_0x273da7)['then'](function(_0x22b31c){return _0x22b31c;});}return null;};}function removeEntity(_0xf325c0,_0x371c18){return function(_0x1d8838){if(_0x1d8838){return _0x1d8838['destroy']()[_0x2c06('0x24')](function(){_0xf325c0[_0x2c06('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d0bd3,_0x12accb){return function(_0xdbf66c){if(!_0xdbf66c){_0x5d0bd3[_0x2c06('0x19')](0x194);}return _0xdbf66c;};}function handleError(_0x4bf6de,_0x5eda3f){_0x5eda3f=_0x5eda3f||0x1f4;return function(_0x2b4b8f){logger[_0x2c06('0x25')](_0x2b4b8f[_0x2c06('0x26')]);if(_0x2b4b8f['name']){delete _0x2b4b8f['name'];}_0x4bf6de[_0x2c06('0x1a')](_0x5eda3f)['send'](_0x2b4b8f);};}exports[_0x2c06('0x27')]=function(_0x3b77d8,_0x2666b8){var _0x4a5206={},_0x44029a={},_0x1b071d={'count':0x0,'rows':[]};var _0x53d113=_[_0x2c06('0x28')](db['FreshsalesConfiguration'][_0x2c06('0x29')],function(_0x577eff){return{'name':_0x577eff['fieldName'],'type':_0x577eff[_0x2c06('0x2a')]['key']};});_0x44029a[_0x2c06('0x2b')]=_['map'](_0x53d113,'name');_0x44029a[_0x2c06('0x2c')]=_[_0x2c06('0x2d')](_0x3b77d8[_0x2c06('0x2c')]);_0x44029a[_0x2c06('0x2e')]=_['intersection'](_0x44029a[_0x2c06('0x2b')],_0x44029a[_0x2c06('0x2c')]);_0x4a5206['attributes']=_[_0x2c06('0x2f')](_0x44029a['model'],qs[_0x2c06('0x30')](_0x3b77d8[_0x2c06('0x2c')][_0x2c06('0x30')]));_0x4a5206['attributes']=_0x4a5206['attributes'][_0x2c06('0x31')]?_0x4a5206['attributes']:_0x44029a[_0x2c06('0x2b')];if(!_0x3b77d8[_0x2c06('0x2c')][_0x2c06('0x32')](_0x2c06('0x33'))){_0x4a5206[_0x2c06('0x1e')]=qs['limit'](_0x3b77d8['query']['limit']);_0x4a5206['offset']=qs[_0x2c06('0x1c')](_0x3b77d8[_0x2c06('0x2c')][_0x2c06('0x1c')]);}_0x4a5206[_0x2c06('0x34')]=qs[_0x2c06('0x35')](_0x3b77d8[_0x2c06('0x2c')][_0x2c06('0x35')]);_0x4a5206['where']=qs[_0x2c06('0x2e')](_[_0x2c06('0x36')](_0x3b77d8[_0x2c06('0x2c')],_0x44029a[_0x2c06('0x2e')]),_0x53d113);if(_0x3b77d8[_0x2c06('0x2c')][_0x2c06('0x37')]){_0x4a5206['where']=_[_0x2c06('0x38')](_0x4a5206[_0x2c06('0x39')],{'$or':_[_0x2c06('0x28')](_0x53d113,function(_0x1e5ab3){if(_0x1e5ab3['type']!==_0x2c06('0x3a')){var _0x39c32c={};_0x39c32c[_0x1e5ab3[_0x2c06('0x3b')]]={'$like':'%'+_0x3b77d8[_0x2c06('0x2c')][_0x2c06('0x37')]+'%'};return _0x39c32c;}})});}_0x4a5206=_[_0x2c06('0x38')]({},_0x4a5206,_0x3b77d8[_0x2c06('0x3c')]);var _0x5d9a44={'where':_0x4a5206['where']};return db[_0x2c06('0x3d')][_0x2c06('0x1f')](_0x5d9a44)[_0x2c06('0x24')](function(_0x230c09){_0x1b071d['count']=_0x230c09;if(_0x3b77d8['query']['includeAll']){_0x4a5206[_0x2c06('0x3e')]=[{'all':!![]}];}return db[_0x2c06('0x3d')][_0x2c06('0x3f')](_0x4a5206);})['then'](function(_0x8bc85f){_0x1b071d['rows']=_0x8bc85f;return _0x1b071d;})['then'](respondWithFilteredResult(_0x2666b8,_0x4a5206))[_0x2c06('0x40')](handleError(_0x2666b8,null));};exports[_0x2c06('0x41')]=function(_0x58b758,_0x18726a){var _0x1b7438={'raw':![],'where':{'id':_0x58b758[_0x2c06('0x42')]['id']}},_0x57ca34={};_0x57ca34['model']=_[_0x2c06('0x2d')](db[_0x2c06('0x3d')]['rawAttributes']);_0x57ca34[_0x2c06('0x2c')]=_[_0x2c06('0x2d')](_0x58b758[_0x2c06('0x2c')]);_0x57ca34[_0x2c06('0x2e')]=_[_0x2c06('0x2f')](_0x57ca34[_0x2c06('0x2b')],_0x57ca34[_0x2c06('0x2c')]);_0x1b7438[_0x2c06('0x43')]=_[_0x2c06('0x2f')](_0x57ca34[_0x2c06('0x2b')],qs['fields'](_0x58b758[_0x2c06('0x2c')][_0x2c06('0x30')]));_0x1b7438[_0x2c06('0x43')]=_0x1b7438[_0x2c06('0x43')][_0x2c06('0x31')]?_0x1b7438[_0x2c06('0x43')]:_0x57ca34['model'];if(_0x58b758[_0x2c06('0x2c')][_0x2c06('0x44')]){_0x1b7438[_0x2c06('0x3e')]=[{'all':!![]}];}_0x1b7438=_['merge']({},_0x1b7438,_0x58b758['options']);return db[_0x2c06('0x3d')]['find'](_0x1b7438)[_0x2c06('0x24')](handleEntityNotFound(_0x18726a,null))[_0x2c06('0x24')](respondWithResult(_0x18726a,null))[_0x2c06('0x40')](handleError(_0x18726a,null));};exports[_0x2c06('0x45')]=function(_0x476700,_0x4b1230){return db[_0x2c06('0x3d')]['create'](_0x476700[_0x2c06('0x46')],{})[_0x2c06('0x24')](respondWithResult(_0x4b1230,0xc9))['catch'](handleError(_0x4b1230,null));};exports['update']=function(_0x36fb96,_0x450c47){if(_0x36fb96[_0x2c06('0x46')]['id']){delete _0x36fb96[_0x2c06('0x46')]['id'];}return db[_0x2c06('0x3d')]['find']({'where':{'id':_0x36fb96['params']['id']}})[_0x2c06('0x24')](handleEntityNotFound(_0x450c47,null))['then'](saveUpdates(_0x36fb96[_0x2c06('0x46')],null))[_0x2c06('0x24')](respondWithResult(_0x450c47,null))['catch'](handleError(_0x450c47,null));};exports[_0x2c06('0x47')]=function(_0x3724e3,_0x327a71){return db[_0x2c06('0x3d')][_0x2c06('0x48')]({'where':{'id':_0x3724e3['params']['id']}})[_0x2c06('0x24')](handleEntityNotFound(_0x327a71,null))[_0x2c06('0x24')](removeEntity(_0x327a71,null))[_0x2c06('0x40')](handleError(_0x327a71,null));};exports[_0x2c06('0x49')]=function(_0x4848ec,_0x272110,_0x1e90c2){var _0x56faf1={};var _0x303497={};var _0x4a526f;var _0x1277ff;return db[_0x2c06('0x3d')][_0x2c06('0x4a')]({'where':{'id':_0x4848ec[_0x2c06('0x42')]['id']}})['then'](handleEntityNotFound(_0x272110,null))[_0x2c06('0x24')](function(_0x55b499){if(_0x55b499){_0x4a526f=_0x55b499;_0x303497[_0x2c06('0x2b')]=_[_0x2c06('0x2d')](db[_0x2c06('0x4b')][_0x2c06('0x29')]);_0x303497[_0x2c06('0x2c')]=_['keys'](_0x4848ec[_0x2c06('0x2c')]);_0x303497[_0x2c06('0x2e')]=_[_0x2c06('0x2f')](_0x303497[_0x2c06('0x2b')],_0x303497[_0x2c06('0x2c')]);_0x56faf1['attributes']=_['intersection'](_0x303497[_0x2c06('0x2b')],qs[_0x2c06('0x30')](_0x4848ec[_0x2c06('0x2c')]['fields']));_0x56faf1[_0x2c06('0x43')]=_0x56faf1[_0x2c06('0x43')][_0x2c06('0x31')]?_0x56faf1[_0x2c06('0x43')]:_0x303497['model'];_0x56faf1[_0x2c06('0x34')]=qs['sort'](_0x4848ec['query'][_0x2c06('0x35')]);_0x56faf1[_0x2c06('0x39')]=qs['filters'](_[_0x2c06('0x36')](_0x4848ec['query'],_0x303497[_0x2c06('0x2e')]));if(_0x4848ec[_0x2c06('0x2c')][_0x2c06('0x37')]){_0x56faf1[_0x2c06('0x39')]=_['merge'](_0x56faf1['where'],{'$or':_[_0x2c06('0x28')](_0x56faf1[_0x2c06('0x43')],function(_0x374d9d){var _0x4e77cc={};_0x4e77cc[_0x374d9d]={'$like':'%'+_0x4848ec['query'][_0x2c06('0x37')]+'%'};return _0x4e77cc;})});}_0x56faf1=_['merge']({},_0x56faf1,_0x4848ec[_0x2c06('0x3c')]);return _0x4a526f[_0x2c06('0x49')](_0x56faf1);}})['then'](function(_0x518fc8){if(_0x518fc8){_0x1277ff=_0x518fc8[_0x2c06('0x31')];if(!_0x4848ec[_0x2c06('0x2c')][_0x2c06('0x32')](_0x2c06('0x33'))){_0x56faf1[_0x2c06('0x1e')]=qs[_0x2c06('0x1e')](_0x4848ec[_0x2c06('0x2c')]['limit']);_0x56faf1['offset']=qs[_0x2c06('0x1c')](_0x4848ec['query']['offset']);}return _0x4a526f[_0x2c06('0x49')](_0x56faf1);}})[_0x2c06('0x24')](function(_0x3e6be1){if(_0x3e6be1){return _0x3e6be1?{'count':_0x1277ff,'rows':_0x3e6be1}:null;}})['then'](respondWithResult(_0x272110,null))['catch'](handleError(_0x272110,null));};exports[_0x2c06('0x4c')]=function(_0x552e2e,_0x36cdb9,_0x1a3dd6){var _0x37d814={};var _0xaf5df8={};var _0x332354;var _0x797922;return db[_0x2c06('0x3d')][_0x2c06('0x4a')]({'where':{'id':_0x552e2e['params']['id']}})[_0x2c06('0x24')](handleEntityNotFound(_0x36cdb9,null))['then'](function(_0x4a6b0c){if(_0x4a6b0c){_0x332354=_0x4a6b0c;_0xaf5df8[_0x2c06('0x2b')]=_[_0x2c06('0x2d')](db[_0x2c06('0x4b')][_0x2c06('0x29')]);_0xaf5df8[_0x2c06('0x2c')]=_[_0x2c06('0x2d')](_0x552e2e[_0x2c06('0x2c')]);_0xaf5df8['filters']=_[_0x2c06('0x2f')](_0xaf5df8[_0x2c06('0x2b')],_0xaf5df8[_0x2c06('0x2c')]);_0x37d814[_0x2c06('0x43')]=_[_0x2c06('0x2f')](_0xaf5df8[_0x2c06('0x2b')],qs[_0x2c06('0x30')](_0x552e2e[_0x2c06('0x2c')][_0x2c06('0x30')]));_0x37d814['attributes']=_0x37d814['attributes'][_0x2c06('0x31')]?_0x37d814[_0x2c06('0x43')]:_0xaf5df8[_0x2c06('0x2b')];_0x37d814[_0x2c06('0x34')]=qs[_0x2c06('0x35')](_0x552e2e['query'][_0x2c06('0x35')]);_0x37d814[_0x2c06('0x39')]=qs[_0x2c06('0x2e')](_[_0x2c06('0x36')](_0x552e2e[_0x2c06('0x2c')],_0xaf5df8['filters']));if(_0x552e2e[_0x2c06('0x2c')]['filter']){_0x37d814[_0x2c06('0x39')]=_[_0x2c06('0x38')](_0x37d814[_0x2c06('0x39')],{'$or':_[_0x2c06('0x28')](_0x37d814[_0x2c06('0x43')],function(_0x2eceba){var _0x282232={};_0x282232[_0x2eceba]={'$like':'%'+_0x552e2e[_0x2c06('0x2c')]['filter']+'%'};return _0x282232;})});}_0x37d814=_['merge']({},_0x37d814,_0x552e2e[_0x2c06('0x3c')]);return _0x332354[_0x2c06('0x4c')](_0x37d814);}})['then'](function(_0x45411e){if(_0x45411e){_0x797922=_0x45411e[_0x2c06('0x31')];if(!_0x552e2e[_0x2c06('0x2c')][_0x2c06('0x32')]('nolimit')){_0x37d814['limit']=qs[_0x2c06('0x1e')](_0x552e2e[_0x2c06('0x2c')][_0x2c06('0x1e')]);_0x37d814['offset']=qs[_0x2c06('0x1c')](_0x552e2e[_0x2c06('0x2c')][_0x2c06('0x1c')]);}return _0x332354['getDescriptions'](_0x37d814);}})[_0x2c06('0x24')](function(_0x53eb91){if(_0x53eb91){return _0x53eb91?{'count':_0x797922,'rows':_0x53eb91}:null;}})[_0x2c06('0x24')](respondWithResult(_0x36cdb9,null))[_0x2c06('0x40')](handleError(_0x36cdb9,null));};exports['getFields']=function(_0x4e2d94,_0x351186,_0x47ad44){var _0x458024={};var _0x234958={};var _0x55bf9a;var _0x4cd5df;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x4e2d94[_0x2c06('0x42')]['id']}})['then'](handleEntityNotFound(_0x351186,null))['then'](function(_0x42d6b0){if(_0x42d6b0){_0x55bf9a=_0x42d6b0;_0x234958[_0x2c06('0x2b')]=_[_0x2c06('0x2d')](db[_0x2c06('0x4b')][_0x2c06('0x29')]);_0x234958[_0x2c06('0x2c')]=_[_0x2c06('0x2d')](_0x4e2d94[_0x2c06('0x2c')]);_0x234958[_0x2c06('0x2e')]=_[_0x2c06('0x2f')](_0x234958[_0x2c06('0x2b')],_0x234958[_0x2c06('0x2c')]);_0x458024['attributes']=_[_0x2c06('0x2f')](_0x234958[_0x2c06('0x2b')],qs[_0x2c06('0x30')](_0x4e2d94[_0x2c06('0x2c')][_0x2c06('0x30')]));_0x458024['attributes']=_0x458024['attributes'][_0x2c06('0x31')]?_0x458024[_0x2c06('0x43')]:_0x234958['model'];_0x458024[_0x2c06('0x34')]=qs[_0x2c06('0x35')](_0x4e2d94['query'][_0x2c06('0x35')]);_0x458024[_0x2c06('0x39')]=qs[_0x2c06('0x2e')](_[_0x2c06('0x36')](_0x4e2d94[_0x2c06('0x2c')],_0x234958[_0x2c06('0x2e')]));if(_0x4e2d94[_0x2c06('0x2c')][_0x2c06('0x37')]){_0x458024[_0x2c06('0x39')]=_[_0x2c06('0x38')](_0x458024[_0x2c06('0x39')],{'$or':_[_0x2c06('0x28')](_0x458024[_0x2c06('0x43')],function(_0x202ade){var _0x2683c2={};_0x2683c2[_0x202ade]={'$like':'%'+_0x4e2d94[_0x2c06('0x2c')][_0x2c06('0x37')]+'%'};return _0x2683c2;})});}_0x458024=_[_0x2c06('0x38')]({},_0x458024,_0x4e2d94[_0x2c06('0x3c')]);return _0x55bf9a[_0x2c06('0x4d')](_0x458024);}})[_0x2c06('0x24')](function(_0xd8d710){if(_0xd8d710){_0x4cd5df=_0xd8d710['length'];if(!_0x4e2d94[_0x2c06('0x2c')][_0x2c06('0x32')]('nolimit')){_0x458024['limit']=qs[_0x2c06('0x1e')](_0x4e2d94[_0x2c06('0x2c')]['limit']);_0x458024['offset']=qs[_0x2c06('0x1c')](_0x4e2d94[_0x2c06('0x2c')][_0x2c06('0x1c')]);}return _0x55bf9a[_0x2c06('0x4d')](_0x458024);}})['then'](function(_0x549a01){if(_0x549a01){return _0x549a01?{'count':_0x4cd5df,'rows':_0x549a01}:null;}})[_0x2c06('0x24')](respondWithResult(_0x351186,null))[_0x2c06('0x40')](handleError(_0x351186,null));}; \ No newline at end of file +var _0xed66=['findAll','rows','catch','params','keys','includeAll','body','update','find','getSubjects','nolimit','getDescriptions','FreshsalesField','getFields','findOne','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','offset','undefined','limit','count','status','set','Content-Range','json','reject','save','destroy','then','end','stack','name','send','index','map','rawAttributes','type','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','FreshsalesConfiguration','include'];(function(_0x1d3b63,_0x2c5e25){var _0x54ed09=function(_0x6cd72e){while(--_0x6cd72e){_0x1d3b63['push'](_0x1d3b63['shift']());}};_0x54ed09(++_0x2c5e25);}(_0xed66,0xff));var _0x6ed6=function(_0x5641d9,_0x1de53b){_0x5641d9=_0x5641d9-0x0;var _0x1b1f89=_0xed66[_0x5641d9];return _0x1b1f89;};'use strict';var emlformat=require(_0x6ed6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6ed6('0x1'));var rp=require(_0x6ed6('0x2'));var moment=require(_0x6ed6('0x3'));var BPromise=require(_0x6ed6('0x4'));var Mustache=require(_0x6ed6('0x5'));var util=require(_0x6ed6('0x6'));var path=require(_0x6ed6('0x7'));var sox=require(_0x6ed6('0x8'));var csv=require(_0x6ed6('0x9'));var ejs=require(_0x6ed6('0xa'));var fs=require('fs');var fs_extra=require(_0x6ed6('0xb'));var _=require(_0x6ed6('0xc'));var squel=require(_0x6ed6('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6ed6('0x9'));var querystring=require(_0x6ed6('0xe'));var Papa=require(_0x6ed6('0xf'));var Redis=require(_0x6ed6('0x10'));var authService=require(_0x6ed6('0x11'));var qs=require(_0x6ed6('0x12'));var as=require(_0x6ed6('0x13'));var hardwareService=require(_0x6ed6('0x14'));var logger=require('../../config/logger')(_0x6ed6('0x15'));var utils=require(_0x6ed6('0x16'));var config=require(_0x6ed6('0x17'));var licenseUtil=require(_0x6ed6('0x18'));var db=require(_0x6ed6('0x19'))['db'];function respondWithStatusCode(_0x4d5661,_0x17472d){_0x17472d=_0x17472d||0xcc;return function(_0x1b77c1){if(_0x1b77c1){return _0x4d5661[_0x6ed6('0x1a')](_0x17472d);}return _0x4d5661['status'](_0x17472d)['end']();};}function respondWithResult(_0x6accee,_0x2ab8ed){_0x2ab8ed=_0x2ab8ed||0xc8;return function(_0x1cb6f1){if(_0x1cb6f1){return _0x6accee['status'](_0x2ab8ed)['json'](_0x1cb6f1);}};}function respondWithFilteredResult(_0x513ed7,_0x2b8e29){return function(_0x2efd39){if(_0x2efd39){var _0x352009=typeof _0x2b8e29[_0x6ed6('0x1b')]===_0x6ed6('0x1c')&&typeof _0x2b8e29[_0x6ed6('0x1d')]===_0x6ed6('0x1c');var _0x3c3ba7=_0x2efd39[_0x6ed6('0x1e')];var _0x3a24f=_0x352009?0x0:_0x2b8e29[_0x6ed6('0x1b')];var _0x591c78=_0x352009?_0x2efd39[_0x6ed6('0x1e')]:_0x2b8e29[_0x6ed6('0x1b')]+_0x2b8e29[_0x6ed6('0x1d')];var _0x400554;if(_0x591c78>=_0x3c3ba7){_0x591c78=_0x3c3ba7;_0x400554=0xc8;}else{_0x400554=0xce;}_0x513ed7[_0x6ed6('0x1f')](_0x400554);return _0x513ed7[_0x6ed6('0x20')](_0x6ed6('0x21'),_0x3a24f+'-'+_0x591c78+'/'+_0x3c3ba7)[_0x6ed6('0x22')](_0x2efd39);}return null;};}function patchUpdates(_0x1a2b15){return function(_0x1337b1){try{jsonpatch['apply'](_0x1337b1,_0x1a2b15,!![]);}catch(_0x587212){return BPromise[_0x6ed6('0x23')](_0x587212);}return _0x1337b1[_0x6ed6('0x24')]();};}function saveUpdates(_0x4fc6d6,_0x3eac19){return function(_0x5799ef){if(_0x5799ef){return _0x5799ef['update'](_0x4fc6d6)['then'](function(_0x2f759d){return _0x2f759d;});}return null;};}function removeEntity(_0x5cf71a,_0x195eac){return function(_0x237e58){if(_0x237e58){return _0x237e58[_0x6ed6('0x25')]()[_0x6ed6('0x26')](function(){_0x5cf71a['status'](0xcc)[_0x6ed6('0x27')]();});}};}function handleEntityNotFound(_0xa489db,_0x251c05){return function(_0x13d95){if(!_0x13d95){_0xa489db[_0x6ed6('0x1a')](0x194);}return _0x13d95;};}function handleError(_0x192e42,_0x9c90e7){_0x9c90e7=_0x9c90e7||0x1f4;return function(_0x3717f0){logger['error'](_0x3717f0[_0x6ed6('0x28')]);if(_0x3717f0[_0x6ed6('0x29')]){delete _0x3717f0[_0x6ed6('0x29')];}_0x192e42[_0x6ed6('0x1f')](_0x9c90e7)[_0x6ed6('0x2a')](_0x3717f0);};}exports[_0x6ed6('0x2b')]=function(_0x542f64,_0x28a50e){var _0x532f7f={},_0x19f862={},_0x2ca741={'count':0x0,'rows':[]};var _0x14366d=_[_0x6ed6('0x2c')](db['FreshsalesConfiguration'][_0x6ed6('0x2d')],function(_0x302471){return{'name':_0x302471['fieldName'],'type':_0x302471[_0x6ed6('0x2e')]['key']};});_0x19f862[_0x6ed6('0x2f')]=_['map'](_0x14366d,_0x6ed6('0x29'));_0x19f862['query']=_['keys'](_0x542f64[_0x6ed6('0x30')]);_0x19f862['filters']=_[_0x6ed6('0x31')](_0x19f862['model'],_0x19f862[_0x6ed6('0x30')]);_0x532f7f[_0x6ed6('0x32')]=_[_0x6ed6('0x31')](_0x19f862['model'],qs[_0x6ed6('0x33')](_0x542f64[_0x6ed6('0x30')]['fields']));_0x532f7f[_0x6ed6('0x32')]=_0x532f7f[_0x6ed6('0x32')][_0x6ed6('0x34')]?_0x532f7f[_0x6ed6('0x32')]:_0x19f862['model'];if(!_0x542f64[_0x6ed6('0x30')][_0x6ed6('0x35')]('nolimit')){_0x532f7f[_0x6ed6('0x1d')]=qs['limit'](_0x542f64[_0x6ed6('0x30')][_0x6ed6('0x1d')]);_0x532f7f[_0x6ed6('0x1b')]=qs[_0x6ed6('0x1b')](_0x542f64[_0x6ed6('0x30')][_0x6ed6('0x1b')]);}_0x532f7f[_0x6ed6('0x36')]=qs[_0x6ed6('0x37')](_0x542f64[_0x6ed6('0x30')][_0x6ed6('0x37')]);_0x532f7f[_0x6ed6('0x38')]=qs[_0x6ed6('0x39')](_[_0x6ed6('0x3a')](_0x542f64[_0x6ed6('0x30')],_0x19f862[_0x6ed6('0x39')]),_0x14366d);if(_0x542f64['query'][_0x6ed6('0x3b')]){_0x532f7f['where']=_['merge'](_0x532f7f['where'],{'$or':_[_0x6ed6('0x2c')](_0x14366d,function(_0x4fee9b){if(_0x4fee9b[_0x6ed6('0x2e')]!==_0x6ed6('0x3c')){var _0x20bc46={};_0x20bc46[_0x4fee9b[_0x6ed6('0x29')]]={'$like':'%'+_0x542f64[_0x6ed6('0x30')][_0x6ed6('0x3b')]+'%'};return _0x20bc46;}})});}_0x532f7f=_[_0x6ed6('0x3d')]({},_0x532f7f,_0x542f64[_0x6ed6('0x3e')]);var _0x275d44={'where':_0x532f7f[_0x6ed6('0x38')]};return db[_0x6ed6('0x3f')]['count'](_0x275d44)[_0x6ed6('0x26')](function(_0x207ed2){_0x2ca741['count']=_0x207ed2;if(_0x542f64[_0x6ed6('0x30')]['includeAll']){_0x532f7f[_0x6ed6('0x40')]=[{'all':!![]}];}return db[_0x6ed6('0x3f')][_0x6ed6('0x41')](_0x532f7f);})[_0x6ed6('0x26')](function(_0x287853){_0x2ca741[_0x6ed6('0x42')]=_0x287853;return _0x2ca741;})[_0x6ed6('0x26')](respondWithFilteredResult(_0x28a50e,_0x532f7f))[_0x6ed6('0x43')](handleError(_0x28a50e,null));};exports['show']=function(_0x383d9c,_0x407246){var _0x10bd80={'raw':![],'where':{'id':_0x383d9c[_0x6ed6('0x44')]['id']}},_0x1a8882={};_0x1a8882[_0x6ed6('0x2f')]=_[_0x6ed6('0x45')](db[_0x6ed6('0x3f')]['rawAttributes']);_0x1a8882[_0x6ed6('0x30')]=_['keys'](_0x383d9c[_0x6ed6('0x30')]);_0x1a8882[_0x6ed6('0x39')]=_[_0x6ed6('0x31')](_0x1a8882['model'],_0x1a8882[_0x6ed6('0x30')]);_0x10bd80[_0x6ed6('0x32')]=_['intersection'](_0x1a8882[_0x6ed6('0x2f')],qs[_0x6ed6('0x33')](_0x383d9c[_0x6ed6('0x30')][_0x6ed6('0x33')]));_0x10bd80[_0x6ed6('0x32')]=_0x10bd80[_0x6ed6('0x32')][_0x6ed6('0x34')]?_0x10bd80[_0x6ed6('0x32')]:_0x1a8882['model'];if(_0x383d9c[_0x6ed6('0x30')][_0x6ed6('0x46')]){_0x10bd80[_0x6ed6('0x40')]=[{'all':!![]}];}_0x10bd80=_[_0x6ed6('0x3d')]({},_0x10bd80,_0x383d9c[_0x6ed6('0x3e')]);return db[_0x6ed6('0x3f')]['find'](_0x10bd80)[_0x6ed6('0x26')](handleEntityNotFound(_0x407246,null))[_0x6ed6('0x26')](respondWithResult(_0x407246,null))[_0x6ed6('0x43')](handleError(_0x407246,null));};exports['create']=function(_0x541e18,_0xe5bb23){return db[_0x6ed6('0x3f')]['create'](_0x541e18[_0x6ed6('0x47')],{})[_0x6ed6('0x26')](respondWithResult(_0xe5bb23,0xc9))[_0x6ed6('0x43')](handleError(_0xe5bb23,null));};exports[_0x6ed6('0x48')]=function(_0x16251e,_0x1612aa){if(_0x16251e['body']['id']){delete _0x16251e[_0x6ed6('0x47')]['id'];}return db['FreshsalesConfiguration'][_0x6ed6('0x49')]({'where':{'id':_0x16251e[_0x6ed6('0x44')]['id']}})['then'](handleEntityNotFound(_0x1612aa,null))['then'](saveUpdates(_0x16251e[_0x6ed6('0x47')],null))['then'](respondWithResult(_0x1612aa,null))[_0x6ed6('0x43')](handleError(_0x1612aa,null));};exports[_0x6ed6('0x25')]=function(_0x18ad49,_0x2cd336){return db[_0x6ed6('0x3f')][_0x6ed6('0x49')]({'where':{'id':_0x18ad49[_0x6ed6('0x44')]['id']}})[_0x6ed6('0x26')](handleEntityNotFound(_0x2cd336,null))[_0x6ed6('0x26')](removeEntity(_0x2cd336,null))[_0x6ed6('0x43')](handleError(_0x2cd336,null));};exports[_0x6ed6('0x4a')]=function(_0x35d2eb,_0x2e74f9,_0xb5895){var _0xea34dd={};var _0x213b5e={};var _0x567f39;var _0x298bdf;return db[_0x6ed6('0x3f')]['findOne']({'where':{'id':_0x35d2eb[_0x6ed6('0x44')]['id']}})['then'](handleEntityNotFound(_0x2e74f9,null))[_0x6ed6('0x26')](function(_0x15026f){if(_0x15026f){_0x567f39=_0x15026f;_0x213b5e[_0x6ed6('0x2f')]=_[_0x6ed6('0x45')](db['FreshsalesField'][_0x6ed6('0x2d')]);_0x213b5e[_0x6ed6('0x30')]=_[_0x6ed6('0x45')](_0x35d2eb['query']);_0x213b5e[_0x6ed6('0x39')]=_[_0x6ed6('0x31')](_0x213b5e[_0x6ed6('0x2f')],_0x213b5e[_0x6ed6('0x30')]);_0xea34dd[_0x6ed6('0x32')]=_[_0x6ed6('0x31')](_0x213b5e[_0x6ed6('0x2f')],qs[_0x6ed6('0x33')](_0x35d2eb[_0x6ed6('0x30')][_0x6ed6('0x33')]));_0xea34dd[_0x6ed6('0x32')]=_0xea34dd[_0x6ed6('0x32')][_0x6ed6('0x34')]?_0xea34dd[_0x6ed6('0x32')]:_0x213b5e[_0x6ed6('0x2f')];_0xea34dd[_0x6ed6('0x36')]=qs[_0x6ed6('0x37')](_0x35d2eb['query'][_0x6ed6('0x37')]);_0xea34dd[_0x6ed6('0x38')]=qs[_0x6ed6('0x39')](_[_0x6ed6('0x3a')](_0x35d2eb[_0x6ed6('0x30')],_0x213b5e['filters']));if(_0x35d2eb[_0x6ed6('0x30')][_0x6ed6('0x3b')]){_0xea34dd[_0x6ed6('0x38')]=_[_0x6ed6('0x3d')](_0xea34dd[_0x6ed6('0x38')],{'$or':_[_0x6ed6('0x2c')](_0xea34dd[_0x6ed6('0x32')],function(_0x594538){var _0x67d18c={};_0x67d18c[_0x594538]={'$like':'%'+_0x35d2eb[_0x6ed6('0x30')]['filter']+'%'};return _0x67d18c;})});}_0xea34dd=_[_0x6ed6('0x3d')]({},_0xea34dd,_0x35d2eb['options']);return _0x567f39[_0x6ed6('0x4a')](_0xea34dd);}})[_0x6ed6('0x26')](function(_0x321cd4){if(_0x321cd4){_0x298bdf=_0x321cd4[_0x6ed6('0x34')];if(!_0x35d2eb[_0x6ed6('0x30')][_0x6ed6('0x35')](_0x6ed6('0x4b'))){_0xea34dd[_0x6ed6('0x1d')]=qs[_0x6ed6('0x1d')](_0x35d2eb['query'][_0x6ed6('0x1d')]);_0xea34dd['offset']=qs['offset'](_0x35d2eb[_0x6ed6('0x30')][_0x6ed6('0x1b')]);}return _0x567f39[_0x6ed6('0x4a')](_0xea34dd);}})[_0x6ed6('0x26')](function(_0x1305a9){if(_0x1305a9){return _0x1305a9?{'count':_0x298bdf,'rows':_0x1305a9}:null;}})[_0x6ed6('0x26')](respondWithResult(_0x2e74f9,null))[_0x6ed6('0x43')](handleError(_0x2e74f9,null));};exports[_0x6ed6('0x4c')]=function(_0x18558f,_0x88329e,_0x365e51){var _0x431e6a={};var _0x1c7c96={};var _0x2552af;var _0x49dd58;return db[_0x6ed6('0x3f')]['findOne']({'where':{'id':_0x18558f['params']['id']}})[_0x6ed6('0x26')](handleEntityNotFound(_0x88329e,null))[_0x6ed6('0x26')](function(_0x1b5fc8){if(_0x1b5fc8){_0x2552af=_0x1b5fc8;_0x1c7c96[_0x6ed6('0x2f')]=_[_0x6ed6('0x45')](db[_0x6ed6('0x4d')][_0x6ed6('0x2d')]);_0x1c7c96['query']=_['keys'](_0x18558f[_0x6ed6('0x30')]);_0x1c7c96['filters']=_[_0x6ed6('0x31')](_0x1c7c96['model'],_0x1c7c96['query']);_0x431e6a[_0x6ed6('0x32')]=_[_0x6ed6('0x31')](_0x1c7c96[_0x6ed6('0x2f')],qs[_0x6ed6('0x33')](_0x18558f['query'][_0x6ed6('0x33')]));_0x431e6a['attributes']=_0x431e6a[_0x6ed6('0x32')][_0x6ed6('0x34')]?_0x431e6a[_0x6ed6('0x32')]:_0x1c7c96[_0x6ed6('0x2f')];_0x431e6a['order']=qs[_0x6ed6('0x37')](_0x18558f[_0x6ed6('0x30')][_0x6ed6('0x37')]);_0x431e6a[_0x6ed6('0x38')]=qs['filters'](_[_0x6ed6('0x3a')](_0x18558f[_0x6ed6('0x30')],_0x1c7c96[_0x6ed6('0x39')]));if(_0x18558f[_0x6ed6('0x30')][_0x6ed6('0x3b')]){_0x431e6a[_0x6ed6('0x38')]=_[_0x6ed6('0x3d')](_0x431e6a['where'],{'$or':_[_0x6ed6('0x2c')](_0x431e6a['attributes'],function(_0x426e9d){var _0x4451b2={};_0x4451b2[_0x426e9d]={'$like':'%'+_0x18558f['query'][_0x6ed6('0x3b')]+'%'};return _0x4451b2;})});}_0x431e6a=_[_0x6ed6('0x3d')]({},_0x431e6a,_0x18558f[_0x6ed6('0x3e')]);return _0x2552af[_0x6ed6('0x4c')](_0x431e6a);}})['then'](function(_0x579c42){if(_0x579c42){_0x49dd58=_0x579c42[_0x6ed6('0x34')];if(!_0x18558f[_0x6ed6('0x30')][_0x6ed6('0x35')]('nolimit')){_0x431e6a['limit']=qs[_0x6ed6('0x1d')](_0x18558f[_0x6ed6('0x30')][_0x6ed6('0x1d')]);_0x431e6a['offset']=qs[_0x6ed6('0x1b')](_0x18558f['query'][_0x6ed6('0x1b')]);}return _0x2552af['getDescriptions'](_0x431e6a);}})['then'](function(_0x584157){if(_0x584157){return _0x584157?{'count':_0x49dd58,'rows':_0x584157}:null;}})[_0x6ed6('0x26')](respondWithResult(_0x88329e,null))[_0x6ed6('0x43')](handleError(_0x88329e,null));};exports[_0x6ed6('0x4e')]=function(_0x1e5def,_0x112c43,_0x5580e0){var _0xce1b77={};var _0x5c0161={};var _0x13f2e7;var _0x180f19;return db['FreshsalesConfiguration'][_0x6ed6('0x4f')]({'where':{'id':_0x1e5def[_0x6ed6('0x44')]['id']}})[_0x6ed6('0x26')](handleEntityNotFound(_0x112c43,null))[_0x6ed6('0x26')](function(_0x57804c){if(_0x57804c){_0x13f2e7=_0x57804c;_0x5c0161['model']=_[_0x6ed6('0x45')](db[_0x6ed6('0x4d')][_0x6ed6('0x2d')]);_0x5c0161[_0x6ed6('0x30')]=_[_0x6ed6('0x45')](_0x1e5def[_0x6ed6('0x30')]);_0x5c0161[_0x6ed6('0x39')]=_['intersection'](_0x5c0161[_0x6ed6('0x2f')],_0x5c0161[_0x6ed6('0x30')]);_0xce1b77[_0x6ed6('0x32')]=_[_0x6ed6('0x31')](_0x5c0161['model'],qs['fields'](_0x1e5def[_0x6ed6('0x30')][_0x6ed6('0x33')]));_0xce1b77[_0x6ed6('0x32')]=_0xce1b77[_0x6ed6('0x32')][_0x6ed6('0x34')]?_0xce1b77[_0x6ed6('0x32')]:_0x5c0161['model'];_0xce1b77[_0x6ed6('0x36')]=qs[_0x6ed6('0x37')](_0x1e5def[_0x6ed6('0x30')][_0x6ed6('0x37')]);_0xce1b77[_0x6ed6('0x38')]=qs[_0x6ed6('0x39')](_[_0x6ed6('0x3a')](_0x1e5def['query'],_0x5c0161['filters']));if(_0x1e5def[_0x6ed6('0x30')][_0x6ed6('0x3b')]){_0xce1b77[_0x6ed6('0x38')]=_[_0x6ed6('0x3d')](_0xce1b77['where'],{'$or':_[_0x6ed6('0x2c')](_0xce1b77[_0x6ed6('0x32')],function(_0x3e3992){var _0x175a46={};_0x175a46[_0x3e3992]={'$like':'%'+_0x1e5def[_0x6ed6('0x30')][_0x6ed6('0x3b')]+'%'};return _0x175a46;})});}_0xce1b77=_['merge']({},_0xce1b77,_0x1e5def[_0x6ed6('0x3e')]);return _0x13f2e7[_0x6ed6('0x4e')](_0xce1b77);}})[_0x6ed6('0x26')](function(_0x2a3e76){if(_0x2a3e76){_0x180f19=_0x2a3e76['length'];if(!_0x1e5def[_0x6ed6('0x30')][_0x6ed6('0x35')]('nolimit')){_0xce1b77[_0x6ed6('0x1d')]=qs[_0x6ed6('0x1d')](_0x1e5def['query']['limit']);_0xce1b77['offset']=qs[_0x6ed6('0x1b')](_0x1e5def[_0x6ed6('0x30')]['offset']);}return _0x13f2e7[_0x6ed6('0x4e')](_0xce1b77);}})[_0x6ed6('0x26')](function(_0x261975){if(_0x261975){return _0x261975?{'count':_0x180f19,'rows':_0x261975}:null;}})[_0x6ed6('0x26')](respondWithResult(_0x112c43,null))[_0x6ed6('0x43')](handleError(_0x112c43,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index d254aad..7e864fa 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 _0x8e64=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','int_freshsales_configurations','lodash','api'];(function(_0x52f80d,_0x143626){var _0x2a79a0=function(_0x284ed8){while(--_0x284ed8){_0x52f80d['push'](_0x52f80d['shift']());}};_0x2a79a0(++_0x143626);}(_0x8e64,0x15a));var _0x48e6=function(_0x2263e5,_0x524d3b){_0x2263e5=_0x2263e5-0x0;var _0x338442=_0x8e64[_0x2263e5];return _0x338442;};'use strict';var _=require(_0x48e6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x48e6('0x1'));var moment=require(_0x48e6('0x2'));var BPromise=require(_0x48e6('0x3'));var rp=require(_0x48e6('0x4'));var fs=require('fs');var path=require(_0x48e6('0x5'));var rimraf=require(_0x48e6('0x6'));var config=require(_0x48e6('0x7'));var attributes=require(_0x48e6('0x8'));module[_0x48e6('0x9')]=function(_0x210ca8,_0x5e704){return _0x210ca8['define'](_0x48e6('0xa'),attributes,{'tableName':_0x48e6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0079=['int_freshsales_configurations','util','../../config/logger','api','bluebird','request-promise','path','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration'];(function(_0x4c18c8,_0x156539){var _0x59d2ac=function(_0x135294){while(--_0x135294){_0x4c18c8['push'](_0x4c18c8['shift']());}};_0x59d2ac(++_0x156539);}(_0x0079,0x1cf));var _0x9007=function(_0x1dde87,_0x54ac00){_0x1dde87=_0x1dde87-0x0;var _0x4052a9=_0x0079[_0x1dde87];return _0x4052a9;};'use strict';var _=require('lodash');var util=require(_0x9007('0x0'));var logger=require(_0x9007('0x1'))(_0x9007('0x2'));var moment=require('moment');var BPromise=require(_0x9007('0x3'));var rp=require(_0x9007('0x4'));var fs=require('fs');var path=require(_0x9007('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9007('0x6'));module[_0x9007('0x7')]=function(_0x387c73,_0x1b7997){return _0x387c73[_0x9007('0x8')](_0x9007('0x9'),attributes,{'tableName':_0x9007('0xa'),'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 fd7b18f..4db82ad 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 _0x0e46=['jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x24a6f4,_0x526878){var _0x5ddaf1=function(_0x46803c){while(--_0x46803c){_0x24a6f4['push'](_0x24a6f4['shift']());}};_0x5ddaf1(++_0x526878);}(_0x0e46,0x151));var _0x60e4=function(_0x365cf4,_0x54cd92){_0x365cf4=_0x365cf4-0x0;var _0x4f5059=_0x0e46[_0x365cf4];return _0x4f5059;};'use strict';var _=require(_0x60e4('0x0'));var util=require(_0x60e4('0x1'));var moment=require(_0x60e4('0x2'));var BPromise=require(_0x60e4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x60e4('0x4'));var db=require(_0x60e4('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x60e4('0x6'));var config=require(_0x60e4('0x7'));var jayson=require(_0x60e4('0x8'));var client=jayson[_0x60e4('0x9')][_0x60e4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43d9c3,_0x46aae3,_0x33930e){return new BPromise(function(_0x370b1a,_0xb59499){return client[_0x60e4('0xb')](_0x43d9c3,_0x33930e)[_0x60e4('0xc')](function(_0x3a7104){logger[_0x60e4('0xd')](_0x60e4('0xe'),_0x46aae3,_0x60e4('0xf'));logger[_0x60e4('0x10')](_0x60e4('0x11'),_0x46aae3,_0x60e4('0xf'),JSON[_0x60e4('0x12')](_0x3a7104));if(_0x3a7104[_0x60e4('0x13')]){if(_0x3a7104[_0x60e4('0x13')][_0x60e4('0x14')]===0x1f4){logger[_0x60e4('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x46aae3,_0x3a7104[_0x60e4('0x13')]['message']);return _0xb59499(_0x3a7104[_0x60e4('0x13')][_0x60e4('0x15')]);}logger[_0x60e4('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x46aae3,_0x3a7104[_0x60e4('0x13')][_0x60e4('0x15')]);return _0x370b1a(_0x3a7104[_0x60e4('0x13')]['message']);}else{logger['info'](_0x60e4('0xe'),_0x46aae3,_0x60e4('0xf'));_0x370b1a(_0x3a7104[_0x60e4('0x16')]['message']);}})['catch'](function(_0x2b002a){logger[_0x60e4('0x13')](_0x60e4('0xe'),_0x46aae3,_0x2b002a);_0xb59499(_0x2b002a);});});} \ No newline at end of file +var _0x0b22=['randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','util'];(function(_0x2085f3,_0x50105b){var _0x384e3c=function(_0x235fa0){while(--_0x235fa0){_0x2085f3['push'](_0x2085f3['shift']());}};_0x384e3c(++_0x50105b);}(_0x0b22,0x1a1));var _0x20b2=function(_0x3d6cbe,_0x28215a){_0x3d6cbe=_0x3d6cbe-0x0;var _0xdca8c1=_0x0b22[_0x3d6cbe];return _0xdca8c1;};'use strict';var _=require('lodash');var util=require(_0x20b2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x20b2('0x1'));var fs=require('fs');var Redis=require(_0x20b2('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x20b2('0x3'));var logger=require(_0x20b2('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x20b2('0x5'));var client=jayson[_0x20b2('0x6')][_0x20b2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1e3801,_0x501055,_0x42c12c){return new BPromise(function(_0x25c454,_0x5b7323){return client[_0x20b2('0x8')](_0x1e3801,_0x42c12c)[_0x20b2('0x9')](function(_0x2f9f70){logger[_0x20b2('0xa')](_0x20b2('0xb'),_0x501055,_0x20b2('0xc'));logger[_0x20b2('0xd')](_0x20b2('0xe'),_0x501055,_0x20b2('0xc'),JSON['stringify'](_0x2f9f70));if(_0x2f9f70[_0x20b2('0xf')]){if(_0x2f9f70[_0x20b2('0xf')][_0x20b2('0x10')]===0x1f4){logger[_0x20b2('0xf')](_0x20b2('0xb'),_0x501055,_0x2f9f70['error']['message']);return _0x5b7323(_0x2f9f70[_0x20b2('0xf')]['message']);}logger[_0x20b2('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x501055,_0x2f9f70['error'][_0x20b2('0x11')]);return _0x25c454(_0x2f9f70[_0x20b2('0xf')][_0x20b2('0x11')]);}else{logger['info'](_0x20b2('0xb'),_0x501055,_0x20b2('0xc'));_0x25c454(_0x2f9f70[_0x20b2('0x12')][_0x20b2('0x11')]);}})['catch'](function(_0x33e068){logger[_0x20b2('0xf')](_0x20b2('0xb'),_0x501055,_0x33e068);_0x5b7323(_0x33e068);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 9beaf53..38b7e82 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 _0x385b=['isAuthenticated','index','/:id','show','post','create','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get'];(function(_0x36793c,_0x4d5e71){var _0x21ed36=function(_0x56b1b0){while(--_0x56b1b0){_0x36793c['push'](_0x36793c['shift']());}};_0x21ed36(++_0x4d5e71);}(_0x385b,0x1a7));var _0xb385=function(_0x39be73,_0x31a022){_0x39be73=_0x39be73-0x0;var _0x14b572=_0x385b[_0x39be73];return _0x14b572;};'use strict';var multer=require('multer');var util=require(_0xb385('0x0'));var path=require('path');var timeout=require(_0xb385('0x1'));var express=require(_0xb385('0x2'));var router=express[_0xb385('0x3')]();var fs_extra=require(_0xb385('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb385('0x5'));var config=require(_0xb385('0x6'));var controller=require(_0xb385('0x7'));router[_0xb385('0x8')]('/',auth[_0xb385('0x9')](),controller[_0xb385('0xa')]);router[_0xb385('0x8')](_0xb385('0xb'),auth['isAuthenticated'](),controller[_0xb385('0xc')]);router[_0xb385('0xd')]('/',auth[_0xb385('0x9')](),controller[_0xb385('0xe')]);router['put'](_0xb385('0xb'),auth[_0xb385('0x9')](),controller['update']);router[_0xb385('0xf')](_0xb385('0xb'),auth[_0xb385('0x9')](),controller[_0xb385('0x10')]);module[_0xb385('0x11')]=router; \ No newline at end of file +var _0xc3b0=['path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','index','/:id','isAuthenticated','create','put','update','delete','destroy','exports','multer','util'];(function(_0x238d40,_0x3d809b){var _0x27e010=function(_0x6a2812){while(--_0x6a2812){_0x238d40['push'](_0x238d40['shift']());}};_0x27e010(++_0x3d809b);}(_0xc3b0,0x166));var _0x0c3b=function(_0x1d887b,_0x1a5487){_0x1d887b=_0x1d887b-0x0;var _0x4754ed=_0xc3b0[_0x1d887b];return _0x4754ed;};'use strict';var multer=require(_0x0c3b('0x0'));var util=require(_0x0c3b('0x1'));var path=require(_0x0c3b('0x2'));var timeout=require(_0x0c3b('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0c3b('0x4'));var auth=require(_0x0c3b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0c3b('0x6'));var controller=require(_0x0c3b('0x7'));router[_0x0c3b('0x8')]('/',auth['isAuthenticated'](),controller[_0x0c3b('0x9')]);router[_0x0c3b('0x8')](_0x0c3b('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x0c3b('0xb')](),controller[_0x0c3b('0xc')]);router[_0x0c3b('0xd')](_0x0c3b('0xa'),auth[_0x0c3b('0xb')](),controller[_0x0c3b('0xe')]);router[_0x0c3b('0xf')](_0x0c3b('0xa'),auth[_0x0c3b('0xb')](),controller[_0x0c3b('0x10')]);module[_0x0c3b('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 8614df4..a20261e 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 _0x3894=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x345d5,_0x597e45){var _0xcd7211=function(_0x269870){while(--_0x269870){_0x345d5['push'](_0x345d5['shift']());}};_0xcd7211(++_0x597e45);}(_0x3894,0x1ca));var _0x4389=function(_0x3e618a,_0x135251){_0x3e618a=_0x3e618a-0x0;var _0x1f3d61=_0x3894[_0x3e618a];return _0x1f3d61;};'use strict';var Sequelize=require(_0x4389('0x0'));module[_0x4389('0x1')]={'type':{'type':Sequelize[_0x4389('0x2')](_0x4389('0x3'),_0x4389('0x4'),_0x4389('0x5'),_0x4389('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4389('0x7')]},'keyType':{'type':Sequelize['ENUM']('string',_0x4389('0x4'),_0x4389('0x5'))},'keyContent':{'type':Sequelize[_0x4389('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4389('0x7')]},'customField':{'type':Sequelize[_0x4389('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4389('0x7')]}}; \ No newline at end of file +var _0x2345=['string','variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','exports'];(function(_0x5a5412,_0x37cbd1){var _0x345052=function(_0x4e8eb8){while(--_0x4e8eb8){_0x5a5412['push'](_0x5a5412['shift']());}};_0x345052(++_0x37cbd1);}(_0x2345,0x1e8));var _0x5234=function(_0x304aa5,_0x1dac8f){_0x304aa5=_0x304aa5-0x0;var _0x13823b=_0x2345[_0x304aa5];return _0x13823b;};'use strict';var Sequelize=require(_0x5234('0x0'));module[_0x5234('0x1')]={'type':{'type':Sequelize['ENUM'](_0x5234('0x2'),_0x5234('0x3'),_0x5234('0x4'),_0x5234('0x5'),_0x5234('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5234('0x7')]},'key':{'type':Sequelize[_0x5234('0x7')]},'keyType':{'type':Sequelize[_0x5234('0x8')](_0x5234('0x2'),_0x5234('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5234('0x7')]},'customField':{'type':Sequelize[_0x5234('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 4e74ec0..72f0a20 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 _0xc4e2=['../../config/environment','../../config/license/util','status','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','FreshsalesField','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','include','merge','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x4dd0f4,_0x4afdcf){var _0x572ddd=function(_0x14c783){while(--_0x14c783){_0x4dd0f4['push'](_0x4dd0f4['shift']());}};_0x572ddd(++_0x4afdcf);}(_0xc4e2,0x106));var _0x2c4e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xc4e2[_0x9df060];return _0x338dfe;};'use strict';var emlformat=require(_0x2c4e('0x0'));var rimraf=require(_0x2c4e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c4e('0x2'));var rp=require(_0x2c4e('0x3'));var moment=require(_0x2c4e('0x4'));var BPromise=require(_0x2c4e('0x5'));var Mustache=require(_0x2c4e('0x6'));var util=require('util');var path=require(_0x2c4e('0x7'));var sox=require(_0x2c4e('0x8'));var csv=require(_0x2c4e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2c4e('0xa'));var squel=require('squel');var crypto=require(_0x2c4e('0xb'));var jsforce=require(_0x2c4e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2c4e('0xd'));var Redis=require(_0x2c4e('0xe'));var authService=require(_0x2c4e('0xf'));var qs=require(_0x2c4e('0x10'));var as=require(_0x2c4e('0x11'));var hardwareService=require(_0x2c4e('0x12'));var logger=require(_0x2c4e('0x13'))(_0x2c4e('0x14'));var utils=require(_0x2c4e('0x15'));var config=require(_0x2c4e('0x16'));var licenseUtil=require(_0x2c4e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3eff31,_0x335f60){_0x335f60=_0x335f60||0xcc;return function(_0x4bcf4a){if(_0x4bcf4a){return _0x3eff31['sendStatus'](_0x335f60);}return _0x3eff31[_0x2c4e('0x18')](_0x335f60)['end']();};}function respondWithResult(_0x293a47,_0x5a9015){_0x5a9015=_0x5a9015||0xc8;return function(_0x45246a){if(_0x45246a){return _0x293a47[_0x2c4e('0x18')](_0x5a9015)['json'](_0x45246a);}};}function respondWithFilteredResult(_0x4e89e3,_0x458ffa){return function(_0xc3e127){if(_0xc3e127){var _0x5ed298=typeof _0x458ffa[_0x2c4e('0x19')]===_0x2c4e('0x1a')&&typeof _0x458ffa[_0x2c4e('0x1b')]===_0x2c4e('0x1a');var _0x59f3b7=_0xc3e127[_0x2c4e('0x1c')];var _0x2ae511=_0x5ed298?0x0:_0x458ffa['offset'];var _0x15e2f1=_0x5ed298?_0xc3e127[_0x2c4e('0x1c')]:_0x458ffa[_0x2c4e('0x19')]+_0x458ffa[_0x2c4e('0x1b')];var _0x348dc1;if(_0x15e2f1>=_0x59f3b7){_0x15e2f1=_0x59f3b7;_0x348dc1=0xc8;}else{_0x348dc1=0xce;}_0x4e89e3['status'](_0x348dc1);return _0x4e89e3['set'](_0x2c4e('0x1d'),_0x2ae511+'-'+_0x15e2f1+'/'+_0x59f3b7)['json'](_0xc3e127);}return null;};}function patchUpdates(_0xa6d301){return function(_0x18b83b){try{jsonpatch[_0x2c4e('0x1e')](_0x18b83b,_0xa6d301,!![]);}catch(_0x3ec69b){return BPromise['reject'](_0x3ec69b);}return _0x18b83b[_0x2c4e('0x1f')]();};}function saveUpdates(_0x4e7987,_0x330a77){return function(_0x2f2a28){if(_0x2f2a28){return _0x2f2a28[_0x2c4e('0x20')](_0x4e7987)[_0x2c4e('0x21')](function(_0x237541){return _0x237541;});}return null;};}function removeEntity(_0x336229,_0x5b84e6){return function(_0x2ad6d5){if(_0x2ad6d5){return _0x2ad6d5[_0x2c4e('0x22')]()['then'](function(){_0x336229[_0x2c4e('0x18')](0xcc)[_0x2c4e('0x23')]();});}};}function handleEntityNotFound(_0x5ced1a,_0x322b4b){return function(_0x432fa8){if(!_0x432fa8){_0x5ced1a[_0x2c4e('0x24')](0x194);}return _0x432fa8;};}function handleError(_0xcae1d4,_0x322aa0){_0x322aa0=_0x322aa0||0x1f4;return function(_0x4d46ac){logger[_0x2c4e('0x25')](_0x4d46ac[_0x2c4e('0x26')]);if(_0x4d46ac['name']){delete _0x4d46ac[_0x2c4e('0x27')];}_0xcae1d4[_0x2c4e('0x18')](_0x322aa0)[_0x2c4e('0x28')](_0x4d46ac);};}exports[_0x2c4e('0x29')]=function(_0x3f3c44,_0x2abcde){var _0x37e643={},_0x50e490={},_0x2c8408={'count':0x0,'rows':[]};var _0x122e3c=_['map'](db[_0x2c4e('0x2a')][_0x2c4e('0x2b')],function(_0x284d00){return{'name':_0x284d00['fieldName'],'type':_0x284d00[_0x2c4e('0x2c')][_0x2c4e('0x2d')]};});_0x50e490[_0x2c4e('0x2e')]=_[_0x2c4e('0x2f')](_0x122e3c,_0x2c4e('0x27'));_0x50e490[_0x2c4e('0x30')]=_[_0x2c4e('0x31')](_0x3f3c44['query']);_0x50e490[_0x2c4e('0x32')]=_[_0x2c4e('0x33')](_0x50e490[_0x2c4e('0x2e')],_0x50e490[_0x2c4e('0x30')]);_0x37e643[_0x2c4e('0x34')]=_['intersection'](_0x50e490[_0x2c4e('0x2e')],qs[_0x2c4e('0x35')](_0x3f3c44[_0x2c4e('0x30')]['fields']));_0x37e643[_0x2c4e('0x34')]=_0x37e643[_0x2c4e('0x34')][_0x2c4e('0x36')]?_0x37e643['attributes']:_0x50e490['model'];if(!_0x3f3c44[_0x2c4e('0x30')]['hasOwnProperty']('nolimit')){_0x37e643[_0x2c4e('0x1b')]=qs[_0x2c4e('0x1b')](_0x3f3c44[_0x2c4e('0x30')][_0x2c4e('0x1b')]);_0x37e643[_0x2c4e('0x19')]=qs[_0x2c4e('0x19')](_0x3f3c44[_0x2c4e('0x30')]['offset']);}_0x37e643['order']=qs[_0x2c4e('0x37')](_0x3f3c44[_0x2c4e('0x30')]['sort']);_0x37e643[_0x2c4e('0x38')]=qs[_0x2c4e('0x32')](_[_0x2c4e('0x39')](_0x3f3c44['query'],_0x50e490['filters']),_0x122e3c);if(_0x3f3c44['query']['filter']){_0x37e643[_0x2c4e('0x38')]=_['merge'](_0x37e643[_0x2c4e('0x38')],{'$or':_['map'](_0x122e3c,function(_0x5244f2){if(_0x5244f2[_0x2c4e('0x2c')]!==_0x2c4e('0x3a')){var _0x3d42a7={};_0x3d42a7[_0x5244f2[_0x2c4e('0x27')]]={'$like':'%'+_0x3f3c44[_0x2c4e('0x30')][_0x2c4e('0x3b')]+'%'};return _0x3d42a7;}})});}_0x37e643=_['merge']({},_0x37e643,_0x3f3c44[_0x2c4e('0x3c')]);var _0x477499={'where':_0x37e643[_0x2c4e('0x38')]};return db[_0x2c4e('0x2a')][_0x2c4e('0x1c')](_0x477499)[_0x2c4e('0x21')](function(_0x1f2810){_0x2c8408[_0x2c4e('0x1c')]=_0x1f2810;if(_0x3f3c44['query'][_0x2c4e('0x3d')]){_0x37e643['include']=[{'all':!![]}];}return db[_0x2c4e('0x2a')][_0x2c4e('0x3e')](_0x37e643);})['then'](function(_0x3b9e97){_0x2c8408['rows']=_0x3b9e97;return _0x2c8408;})['then'](respondWithFilteredResult(_0x2abcde,_0x37e643))[_0x2c4e('0x3f')](handleError(_0x2abcde,null));};exports[_0x2c4e('0x40')]=function(_0x3c4268,_0x484cdc){var _0x27da23={'raw':!![],'where':{'id':_0x3c4268[_0x2c4e('0x41')]['id']}},_0x24d581={};_0x24d581['model']=_[_0x2c4e('0x31')](db['FreshsalesField'][_0x2c4e('0x2b')]);_0x24d581[_0x2c4e('0x30')]=_['keys'](_0x3c4268[_0x2c4e('0x30')]);_0x24d581[_0x2c4e('0x32')]=_[_0x2c4e('0x33')](_0x24d581[_0x2c4e('0x2e')],_0x24d581[_0x2c4e('0x30')]);_0x27da23[_0x2c4e('0x34')]=_['intersection'](_0x24d581[_0x2c4e('0x2e')],qs[_0x2c4e('0x35')](_0x3c4268[_0x2c4e('0x30')][_0x2c4e('0x35')]));_0x27da23[_0x2c4e('0x34')]=_0x27da23[_0x2c4e('0x34')][_0x2c4e('0x36')]?_0x27da23[_0x2c4e('0x34')]:_0x24d581[_0x2c4e('0x2e')];if(_0x3c4268[_0x2c4e('0x30')]['includeAll']){_0x27da23[_0x2c4e('0x42')]=[{'all':!![]}];}_0x27da23=_[_0x2c4e('0x43')]({},_0x27da23,_0x3c4268[_0x2c4e('0x3c')]);return db[_0x2c4e('0x2a')][_0x2c4e('0x44')](_0x27da23)[_0x2c4e('0x21')](handleEntityNotFound(_0x484cdc,null))[_0x2c4e('0x21')](respondWithResult(_0x484cdc,null))[_0x2c4e('0x3f')](handleError(_0x484cdc,null));};exports[_0x2c4e('0x45')]=function(_0x392be7,_0x692618){return db[_0x2c4e('0x2a')]['create'](_0x392be7[_0x2c4e('0x46')],{})[_0x2c4e('0x21')](respondWithResult(_0x692618,0xc9))[_0x2c4e('0x3f')](handleError(_0x692618,null));};exports[_0x2c4e('0x20')]=function(_0x56d013,_0x31c444){if(_0x56d013['body']['id']){delete _0x56d013[_0x2c4e('0x46')]['id'];}return db[_0x2c4e('0x2a')]['find']({'where':{'id':_0x56d013[_0x2c4e('0x41')]['id']}})[_0x2c4e('0x21')](handleEntityNotFound(_0x31c444,null))['then'](saveUpdates(_0x56d013[_0x2c4e('0x46')],null))[_0x2c4e('0x21')](respondWithResult(_0x31c444,null))[_0x2c4e('0x3f')](handleError(_0x31c444,null));};exports[_0x2c4e('0x22')]=function(_0x45b9b0,_0x4a2f25){return db[_0x2c4e('0x2a')][_0x2c4e('0x44')]({'where':{'id':_0x45b9b0[_0x2c4e('0x41')]['id']}})['then'](handleEntityNotFound(_0x4a2f25,null))[_0x2c4e('0x21')](removeEntity(_0x4a2f25,null))[_0x2c4e('0x3f')](handleError(_0x4a2f25,null));}; \ No newline at end of file +var _0x4d67=['map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','body','eml-format','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/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','set','Content-Range','save','update','then','destroy','status','error','name','send','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4d67,0xb8));var _0x74d6=function(_0x17e8a2,_0x16e8e6){_0x17e8a2=_0x17e8a2-0x0;var _0xe752f9=_0x4d67[_0x17e8a2];return _0xe752f9;};'use strict';var emlformat=require(_0x74d6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x74d6('0x1'));var rp=require(_0x74d6('0x2'));var moment=require(_0x74d6('0x3'));var BPromise=require(_0x74d6('0x4'));var Mustache=require(_0x74d6('0x5'));var util=require(_0x74d6('0x6'));var path=require(_0x74d6('0x7'));var sox=require(_0x74d6('0x8'));var csv=require(_0x74d6('0x9'));var ejs=require(_0x74d6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x74d6('0xb'));var squel=require(_0x74d6('0xc'));var crypto=require(_0x74d6('0xd'));var jsforce=require(_0x74d6('0xe'));var deskjs=require(_0x74d6('0xf'));var toCsv=require(_0x74d6('0x9'));var querystring=require(_0x74d6('0x10'));var Papa=require(_0x74d6('0x11'));var Redis=require(_0x74d6('0x12'));var authService=require(_0x74d6('0x13'));var qs=require(_0x74d6('0x14'));var as=require(_0x74d6('0x15'));var hardwareService=require(_0x74d6('0x16'));var logger=require(_0x74d6('0x17'))('api');var utils=require(_0x74d6('0x18'));var config=require(_0x74d6('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x74d6('0x1a'))['db'];function respondWithStatusCode(_0x43ca54,_0x2c6807){_0x2c6807=_0x2c6807||0xcc;return function(_0x2577f9){if(_0x2577f9){return _0x43ca54[_0x74d6('0x1b')](_0x2c6807);}return _0x43ca54['status'](_0x2c6807)['end']();};}function respondWithResult(_0x4f79af,_0x274e7d){_0x274e7d=_0x274e7d||0xc8;return function(_0x3b8791){if(_0x3b8791){return _0x4f79af['status'](_0x274e7d)[_0x74d6('0x1c')](_0x3b8791);}};}function respondWithFilteredResult(_0x4b883e,_0x3e380a){return function(_0x106a15){if(_0x106a15){var _0x27b9bf=typeof _0x3e380a[_0x74d6('0x1d')]==='undefined'&&typeof _0x3e380a[_0x74d6('0x1e')]===_0x74d6('0x1f');var _0x4609c0=_0x106a15[_0x74d6('0x20')];var _0x98a7eb=_0x27b9bf?0x0:_0x3e380a[_0x74d6('0x1d')];var _0x138741=_0x27b9bf?_0x106a15[_0x74d6('0x20')]:_0x3e380a[_0x74d6('0x1d')]+_0x3e380a['limit'];var _0x35f647;if(_0x138741>=_0x4609c0){_0x138741=_0x4609c0;_0x35f647=0xc8;}else{_0x35f647=0xce;}_0x4b883e['status'](_0x35f647);return _0x4b883e[_0x74d6('0x21')](_0x74d6('0x22'),_0x98a7eb+'-'+_0x138741+'/'+_0x4609c0)[_0x74d6('0x1c')](_0x106a15);}return null;};}function patchUpdates(_0x170932){return function(_0x3988b0){try{jsonpatch['apply'](_0x3988b0,_0x170932,!![]);}catch(_0x2f164e){return BPromise['reject'](_0x2f164e);}return _0x3988b0[_0x74d6('0x23')]();};}function saveUpdates(_0x30e3f8,_0x5e5f28){return function(_0x1632d4){if(_0x1632d4){return _0x1632d4[_0x74d6('0x24')](_0x30e3f8)[_0x74d6('0x25')](function(_0x44a16e){return _0x44a16e;});}return null;};}function removeEntity(_0xe17f00,_0x5c8b47){return function(_0x2ce406){if(_0x2ce406){return _0x2ce406[_0x74d6('0x26')]()['then'](function(){_0xe17f00[_0x74d6('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa802d5,_0x1b303d){return function(_0x105671){if(!_0x105671){_0xa802d5[_0x74d6('0x1b')](0x194);}return _0x105671;};}function handleError(_0x2f0e0b,_0x22d9ea){_0x22d9ea=_0x22d9ea||0x1f4;return function(_0x28e248){logger[_0x74d6('0x28')](_0x28e248['stack']);if(_0x28e248[_0x74d6('0x29')]){delete _0x28e248['name'];}_0x2f0e0b[_0x74d6('0x27')](_0x22d9ea)[_0x74d6('0x2a')](_0x28e248);};}exports[_0x74d6('0x2b')]=function(_0x241711,_0x518aba){var _0x3286fa={},_0x8aa138={},_0x236045={'count':0x0,'rows':[]};var _0x2941a3=_[_0x74d6('0x2c')](db[_0x74d6('0x2d')][_0x74d6('0x2e')],function(_0xc19c45){return{'name':_0xc19c45[_0x74d6('0x2f')],'type':_0xc19c45[_0x74d6('0x30')][_0x74d6('0x31')]};});_0x8aa138[_0x74d6('0x32')]=_[_0x74d6('0x2c')](_0x2941a3,'name');_0x8aa138[_0x74d6('0x33')]=_[_0x74d6('0x34')](_0x241711[_0x74d6('0x33')]);_0x8aa138[_0x74d6('0x35')]=_[_0x74d6('0x36')](_0x8aa138[_0x74d6('0x32')],_0x8aa138[_0x74d6('0x33')]);_0x3286fa[_0x74d6('0x37')]=_['intersection'](_0x8aa138[_0x74d6('0x32')],qs['fields'](_0x241711['query'][_0x74d6('0x38')]));_0x3286fa[_0x74d6('0x37')]=_0x3286fa[_0x74d6('0x37')]['length']?_0x3286fa[_0x74d6('0x37')]:_0x8aa138[_0x74d6('0x32')];if(!_0x241711['query'][_0x74d6('0x39')](_0x74d6('0x3a'))){_0x3286fa[_0x74d6('0x1e')]=qs[_0x74d6('0x1e')](_0x241711[_0x74d6('0x33')][_0x74d6('0x1e')]);_0x3286fa['offset']=qs[_0x74d6('0x1d')](_0x241711[_0x74d6('0x33')][_0x74d6('0x1d')]);}_0x3286fa['order']=qs['sort'](_0x241711[_0x74d6('0x33')][_0x74d6('0x3b')]);_0x3286fa[_0x74d6('0x3c')]=qs['filters'](_[_0x74d6('0x3d')](_0x241711['query'],_0x8aa138[_0x74d6('0x35')]),_0x2941a3);if(_0x241711[_0x74d6('0x33')][_0x74d6('0x3e')]){_0x3286fa['where']=_['merge'](_0x3286fa[_0x74d6('0x3c')],{'$or':_['map'](_0x2941a3,function(_0x1e8350){if(_0x1e8350['type']!==_0x74d6('0x3f')){var _0x1ecbf0={};_0x1ecbf0[_0x1e8350[_0x74d6('0x29')]]={'$like':'%'+_0x241711[_0x74d6('0x33')][_0x74d6('0x3e')]+'%'};return _0x1ecbf0;}})});}_0x3286fa=_[_0x74d6('0x40')]({},_0x3286fa,_0x241711[_0x74d6('0x41')]);var _0x5ea590={'where':_0x3286fa[_0x74d6('0x3c')]};return db[_0x74d6('0x2d')][_0x74d6('0x20')](_0x5ea590)[_0x74d6('0x25')](function(_0x5d55e1){_0x236045[_0x74d6('0x20')]=_0x5d55e1;if(_0x241711[_0x74d6('0x33')][_0x74d6('0x42')]){_0x3286fa[_0x74d6('0x43')]=[{'all':!![]}];}return db[_0x74d6('0x2d')][_0x74d6('0x44')](_0x3286fa);})[_0x74d6('0x25')](function(_0x514cf0){_0x236045[_0x74d6('0x45')]=_0x514cf0;return _0x236045;})['then'](respondWithFilteredResult(_0x518aba,_0x3286fa))[_0x74d6('0x46')](handleError(_0x518aba,null));};exports[_0x74d6('0x47')]=function(_0x294693,_0x188027){var _0x472d99={'raw':!![],'where':{'id':_0x294693[_0x74d6('0x48')]['id']}},_0x15bed8={};_0x15bed8['model']=_[_0x74d6('0x34')](db[_0x74d6('0x2d')][_0x74d6('0x2e')]);_0x15bed8[_0x74d6('0x33')]=_[_0x74d6('0x34')](_0x294693['query']);_0x15bed8[_0x74d6('0x35')]=_['intersection'](_0x15bed8[_0x74d6('0x32')],_0x15bed8[_0x74d6('0x33')]);_0x472d99[_0x74d6('0x37')]=_['intersection'](_0x15bed8[_0x74d6('0x32')],qs[_0x74d6('0x38')](_0x294693['query'][_0x74d6('0x38')]));_0x472d99[_0x74d6('0x37')]=_0x472d99[_0x74d6('0x37')][_0x74d6('0x49')]?_0x472d99['attributes']:_0x15bed8['model'];if(_0x294693[_0x74d6('0x33')][_0x74d6('0x42')]){_0x472d99[_0x74d6('0x43')]=[{'all':!![]}];}_0x472d99=_['merge']({},_0x472d99,_0x294693[_0x74d6('0x41')]);return db[_0x74d6('0x2d')][_0x74d6('0x4a')](_0x472d99)['then'](handleEntityNotFound(_0x188027,null))['then'](respondWithResult(_0x188027,null))[_0x74d6('0x46')](handleError(_0x188027,null));};exports['create']=function(_0x1ceb3f,_0x24b4e8){return db[_0x74d6('0x2d')]['create'](_0x1ceb3f[_0x74d6('0x4b')],{})[_0x74d6('0x25')](respondWithResult(_0x24b4e8,0xc9))[_0x74d6('0x46')](handleError(_0x24b4e8,null));};exports['update']=function(_0x2d37b2,_0x403a22){if(_0x2d37b2[_0x74d6('0x4b')]['id']){delete _0x2d37b2['body']['id'];}return db[_0x74d6('0x2d')][_0x74d6('0x4a')]({'where':{'id':_0x2d37b2['params']['id']}})[_0x74d6('0x25')](handleEntityNotFound(_0x403a22,null))[_0x74d6('0x25')](saveUpdates(_0x2d37b2[_0x74d6('0x4b')],null))[_0x74d6('0x25')](respondWithResult(_0x403a22,null))[_0x74d6('0x46')](handleError(_0x403a22,null));};exports['destroy']=function(_0x1a399a,_0x3a2fd3){return db['FreshsalesField'][_0x74d6('0x4a')]({'where':{'id':_0x1a399a[_0x74d6('0x48')]['id']}})[_0x74d6('0x25')](handleEntityNotFound(_0x3a2fd3,null))[_0x74d6('0x25')](removeEntity(_0x3a2fd3,null))[_0x74d6('0x46')](handleError(_0x3a2fd3,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 08613b0..ea7dfc7 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 _0x7292=['api','moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','lodash','util','../../config/logger'];(function(_0x5d1bda,_0x279fbb){var _0x4e4917=function(_0x2ad079){while(--_0x2ad079){_0x5d1bda['push'](_0x5d1bda['shift']());}};_0x4e4917(++_0x279fbb);}(_0x7292,0x6d));var _0x2729=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x7292[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0x2729('0x0'));var util=require(_0x2729('0x1'));var logger=require(_0x2729('0x2'))(_0x2729('0x3'));var moment=require(_0x2729('0x4'));var BPromise=require(_0x2729('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2729('0x6'));var rimraf=require(_0x2729('0x7'));var config=require(_0x2729('0x8'));var attributes=require(_0x2729('0x9'));module[_0x2729('0xa')]=function(_0x4db88a,_0x119935){return _0x4db88a[_0x2729('0xb')](_0x2729('0xc'),attributes,{'tableName':_0x2729('0xd'),'paranoid':![],'indexes':[{'name':_0x2729('0xe'),'fields':[_0x2729('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe77c=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','util','../../config/logger','moment'];(function(_0x26ddd9,_0x128536){var _0x2dafd9=function(_0x382f0b){while(--_0x382f0b){_0x26ddd9['push'](_0x26ddd9['shift']());}};_0x2dafd9(++_0x128536);}(_0xe77c,0x176));var _0xce77=function(_0x2860ab,_0x27440f){_0x2860ab=_0x2860ab-0x0;var _0x3037c4=_0xe77c[_0x2860ab];return _0x3037c4;};'use strict';var _=require(_0xce77('0x0'));var util=require(_0xce77('0x1'));var logger=require(_0xce77('0x2'))('api');var moment=require(_0xce77('0x3'));var BPromise=require(_0xce77('0x4'));var rp=require(_0xce77('0x5'));var fs=require('fs');var path=require(_0xce77('0x6'));var rimraf=require(_0xce77('0x7'));var config=require(_0xce77('0x8'));var attributes=require(_0xce77('0x9'));module['exports']=function(_0x5aea39,_0xed47c5){return _0x5aea39['define'](_0xce77('0xa'),attributes,{'tableName':_0xce77('0xb'),'paranoid':![],'indexes':[{'name':_0xce77('0xc'),'fields':['idField',_0xce77('0xd')],'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 e6b361f..c3d63ad 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0xd713d,_0x24eb9b){var _0x529488=function(_0x376c87){while(--_0x376c87){_0xd713d['push'](_0xd713d['shift']());}};_0x529488(++_0x24eb9b);}(_0x2ef3,0xba));var _0x32ef=function(_0x3ff0ac,_0x52d0c7){_0x3ff0ac=_0x3ff0ac-0x0;var _0x33014a=_0x2ef3[_0x3ff0ac];return _0x33014a;};'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')]('FreshsalesField,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0xb4c7=['client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x47219c,_0x78ae33){var _0x4cd653=function(_0x5cb6da){while(--_0x5cb6da){_0x47219c['push'](_0x47219c['shift']());}};_0x4cd653(++_0x78ae33);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x4230d6,_0x12477e){_0x4230d6=_0x4230d6-0x0;var _0x2743f2=_0xb4c7[_0x4230d6];return _0x2743f2;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var moment=require(_0x7b4c('0x2'));var BPromise=require(_0x7b4c('0x3'));var rs=require(_0x7b4c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b4c('0x5'))['db'];var utils=require(_0x7b4c('0x6'));var logger=require(_0x7b4c('0x7'))(_0x7b4c('0x8'));var config=require(_0x7b4c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7b4c('0xa')][_0x7b4c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dd5c7,_0x4bf85d,_0x2d7b7e){return new BPromise(function(_0x21687f,_0x570daa){return client[_0x7b4c('0xc')](_0x2dd5c7,_0x2d7b7e)[_0x7b4c('0xd')](function(_0x28e902){logger[_0x7b4c('0xe')](_0x7b4c('0xf'),_0x4bf85d,_0x7b4c('0x10'));logger[_0x7b4c('0x11')](_0x7b4c('0x12'),_0x4bf85d,_0x7b4c('0x10'),JSON[_0x7b4c('0x13')](_0x28e902));if(_0x28e902['error']){if(_0x28e902['error'][_0x7b4c('0x14')]===0x1f4){logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);return _0x570daa(_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);}logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x28e902[_0x7b4c('0x15')]['message']);return _0x21687f(_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);}else{logger[_0x7b4c('0xe')](_0x7b4c('0xf'),_0x4bf85d,_0x7b4c('0x10'));_0x21687f(_0x28e902[_0x7b4c('0x17')][_0x7b4c('0x16')]);}})[_0x7b4c('0x18')](function(_0x4d3f5e){logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x4d3f5e);_0x570daa(_0x4d3f5e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 81b2168..4787e34 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x4fe4ec,_0x5e4cc5){var _0x176455=function(_0x5e3459){while(--_0x5e3459){_0x4fe4ec['push'](_0x4fe4ec['shift']());}};_0x176455(++_0x5e4cc5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2b92db,_0x43b44e){var _0x140e0c=function(_0x585e68){while(--_0x585e68){_0x2b92db['push'](_0x2b92db['shift']());}};_0x140e0c(++_0x43b44e);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 78b21ec..d5d4f50 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 _0x020a=['username','ENUM','integrationTab','sequelize','exports','STRING'];(function(_0x281223,_0x1794c3){var _0x424e78=function(_0x504d4f){while(--_0x504d4f){_0x281223['push'](_0x281223['shift']());}};_0x424e78(++_0x1794c3);}(_0x020a,0xc9));var _0xa020=function(_0x1d69e5,_0x2a29af){_0x1d69e5=_0x1d69e5-0x0;var _0x17da11=_0x020a[_0x1d69e5];return _0x17da11;};'use strict';var Sequelize=require(_0xa020('0x0'));module[_0xa020('0x1')]={'name':{'type':Sequelize[_0xa020('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa020('0x2')],'unique':_0xa020('0x3')},'remoteUri':{'type':Sequelize[_0xa020('0x2')]},'password':{'type':Sequelize[_0xa020('0x2')]},'clientId':{'type':Sequelize[_0xa020('0x2')]},'clientSecret':{'type':Sequelize[_0xa020('0x2')]},'securityToken':{'type':Sequelize[_0xa020('0x2')]},'serverUrl':{'type':Sequelize[_0xa020('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa020('0x4')](_0xa020('0x5'),'newTab'),'defaultValue':_0xa020('0x5')}}; \ No newline at end of file +var _0x1f20=['username','ENUM','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x1519a9,_0x1ae115){var _0x132aee=function(_0x2cdce3){while(--_0x2cdce3){_0x1519a9['push'](_0x1519a9['shift']());}};_0x132aee(++_0x1ae115);}(_0x1f20,0x11c));var _0x01f2=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x1f20[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x01f2('0x0'));module[_0x01f2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x01f2('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x01f2('0x3')},'remoteUri':{'type':Sequelize[_0x01f2('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x01f2('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x01f2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x01f2('0x4')](_0x01f2('0x5'),_0x01f2('0x6')),'defaultValue':_0x01f2('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index ef9b965..c070c7c 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 _0x7a4c=['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','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','SalesforceAccount','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','sort','filters','pick','filter','where','merge','options','includeAll','findAll','rows','params','include','find','catch','create','body','getConfigurations','SalesforceConfiguration','order','hasOwnProperty','findOne','AccountId','getSubjects','channel','SalesforceField','Descriptions','getFields','Task','remoteUri','password','securityToken','slice','lastIndexOf','Connection','clientId','clientSecret','login','username','concat','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','int','picklist','email','textarea','includes','label','custom','picklistValues','boolean','True','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox'];(function(_0xa738c0,_0x28606d){var _0x594e8b=function(_0x5202ef){while(--_0x5202ef){_0xa738c0['push'](_0xa738c0['shift']());}};_0x594e8b(++_0x28606d);}(_0x7a4c,0x1cf));var _0xc7a4=function(_0x3fd455,_0x1f7c5b){_0x3fd455=_0x3fd455-0x0;var _0x1c259f=_0x7a4c[_0x3fd455];return _0x1c259f;};'use strict';var emlformat=require(_0xc7a4('0x0'));var rimraf=require(_0xc7a4('0x1'));var zipdir=require(_0xc7a4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc7a4('0x3'));var moment=require('moment');var BPromise=require(_0xc7a4('0x4'));var Mustache=require(_0xc7a4('0x5'));var util=require(_0xc7a4('0x6'));var path=require(_0xc7a4('0x7'));var sox=require(_0xc7a4('0x8'));var csv=require(_0xc7a4('0x9'));var ejs=require(_0xc7a4('0xa'));var fs=require('fs');var fs_extra=require(_0xc7a4('0xb'));var _=require(_0xc7a4('0xc'));var squel=require(_0xc7a4('0xd'));var crypto=require(_0xc7a4('0xe'));var jsforce=require(_0xc7a4('0xf'));var deskjs=require(_0xc7a4('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc7a4('0x11'));var Redis=require(_0xc7a4('0x12'));var authService=require(_0xc7a4('0x13'));var qs=require(_0xc7a4('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc7a4('0x15'));var logger=require(_0xc7a4('0x16'))('api');var utils=require(_0xc7a4('0x17'));var config=require(_0xc7a4('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xc7a4('0x19'));function respondWithStatusCode(_0x4ddaff,_0x48576b){_0x48576b=_0x48576b||0xcc;return function(_0x467cc0){if(_0x467cc0){return _0x4ddaff[_0xc7a4('0x1a')](_0x48576b);}return _0x4ddaff[_0xc7a4('0x1b')](_0x48576b)[_0xc7a4('0x1c')]();};}function respondWithResult(_0x5742ff,_0x943355){_0x943355=_0x943355||0xc8;return function(_0x4cabb5){if(_0x4cabb5){return _0x5742ff[_0xc7a4('0x1b')](_0x943355)['json'](_0x4cabb5);}};}function respondWithFilteredResult(_0x1f28a7,_0x4ea745){return function(_0x471d4c){if(_0x471d4c){var _0x13c5f3=typeof _0x4ea745[_0xc7a4('0x1d')]===_0xc7a4('0x1e')&&typeof _0x4ea745[_0xc7a4('0x1f')]===_0xc7a4('0x1e');var _0x47e81d=_0x471d4c[_0xc7a4('0x20')];var _0x3418e7=_0x13c5f3?0x0:_0x4ea745[_0xc7a4('0x1d')];var _0x227ad2=_0x13c5f3?_0x471d4c[_0xc7a4('0x20')]:_0x4ea745[_0xc7a4('0x1d')]+_0x4ea745[_0xc7a4('0x1f')];var _0xfa9345;if(_0x227ad2>=_0x47e81d){_0x227ad2=_0x47e81d;_0xfa9345=0xc8;}else{_0xfa9345=0xce;}_0x1f28a7[_0xc7a4('0x1b')](_0xfa9345);return _0x1f28a7[_0xc7a4('0x21')](_0xc7a4('0x22'),_0x3418e7+'-'+_0x227ad2+'/'+_0x47e81d)['json'](_0x471d4c);}return null;};}function patchUpdates(_0x4a20e9){return function(_0x562fd3){try{jsonpatch[_0xc7a4('0x23')](_0x562fd3,_0x4a20e9,!![]);}catch(_0x520a42){return BPromise[_0xc7a4('0x24')](_0x520a42);}return _0x562fd3[_0xc7a4('0x25')]();};}function saveUpdates(_0x2e61c7,_0x226d93){return function(_0x50ec5c){if(_0x50ec5c){return _0x50ec5c[_0xc7a4('0x26')](_0x2e61c7)[_0xc7a4('0x27')](function(_0xc43f49){return _0xc43f49;});}return null;};}function removeEntity(_0x5900a3,_0xa84c46){return function(_0x23d8b7){if(_0x23d8b7){return _0x23d8b7[_0xc7a4('0x28')]()[_0xc7a4('0x27')](function(){_0x5900a3[_0xc7a4('0x1b')](0xcc)[_0xc7a4('0x1c')]();});}};}function handleEntityNotFound(_0x3859f6,_0x2be7ed){return function(_0x3367be){if(!_0x3367be){_0x3859f6[_0xc7a4('0x1a')](0x194);}return _0x3367be;};}function handleError(_0x345d13,_0x377ada){_0x377ada=_0x377ada||0x1f4;return function(_0x32c6ad){logger['error'](_0x32c6ad[_0xc7a4('0x29')]);if(_0x32c6ad[_0xc7a4('0x2a')]){delete _0x32c6ad['name'];}_0x345d13['status'](_0x377ada)[_0xc7a4('0x2b')](_0x32c6ad);};}exports['index']=function(_0x3a135f,_0x3867ee){var _0x575252={},_0x4648db={},_0xa9ffd1={'count':0x0,'rows':[]};var _0x49ee58=_[_0xc7a4('0x2c')](db[_0xc7a4('0x2d')]['rawAttributes'],function(_0x2ebb9c){return{'name':_0x2ebb9c[_0xc7a4('0x2e')],'type':_0x2ebb9c[_0xc7a4('0x2f')][_0xc7a4('0x30')]};});_0x4648db[_0xc7a4('0x31')]=_[_0xc7a4('0x2c')](_0x49ee58,_0xc7a4('0x2a'));_0x4648db[_0xc7a4('0x32')]=_[_0xc7a4('0x33')](_0x3a135f[_0xc7a4('0x32')]);_0x4648db['filters']=_['intersection'](_0x4648db['model'],_0x4648db[_0xc7a4('0x32')]);_0x575252['attributes']=_[_0xc7a4('0x34')](_0x4648db[_0xc7a4('0x31')],qs[_0xc7a4('0x35')](_0x3a135f[_0xc7a4('0x32')][_0xc7a4('0x35')]));_0x575252[_0xc7a4('0x36')]=_0x575252['attributes'][_0xc7a4('0x37')]?_0x575252[_0xc7a4('0x36')]:_0x4648db[_0xc7a4('0x31')];if(!_0x3a135f[_0xc7a4('0x32')]['hasOwnProperty']('nolimit')){_0x575252[_0xc7a4('0x1f')]=qs[_0xc7a4('0x1f')](_0x3a135f[_0xc7a4('0x32')][_0xc7a4('0x1f')]);_0x575252[_0xc7a4('0x1d')]=qs[_0xc7a4('0x1d')](_0x3a135f[_0xc7a4('0x32')][_0xc7a4('0x1d')]);}_0x575252['order']=qs[_0xc7a4('0x38')](_0x3a135f[_0xc7a4('0x32')]['sort']);_0x575252['where']=qs[_0xc7a4('0x39')](_[_0xc7a4('0x3a')](_0x3a135f[_0xc7a4('0x32')],_0x4648db['filters']),_0x49ee58);if(_0x3a135f[_0xc7a4('0x32')][_0xc7a4('0x3b')]){_0x575252['where']=_['merge'](_0x575252[_0xc7a4('0x3c')],{'$or':_['map'](_0x49ee58,function(_0x49f34b){if(_0x49f34b[_0xc7a4('0x2f')]!=='VIRTUAL'){var _0x23d12e={};_0x23d12e[_0x49f34b[_0xc7a4('0x2a')]]={'$like':'%'+_0x3a135f[_0xc7a4('0x32')][_0xc7a4('0x3b')]+'%'};return _0x23d12e;}})});}_0x575252=_[_0xc7a4('0x3d')]({},_0x575252,_0x3a135f[_0xc7a4('0x3e')]);var _0x3badb6={'where':_0x575252[_0xc7a4('0x3c')]};return db[_0xc7a4('0x2d')][_0xc7a4('0x20')](_0x3badb6)['then'](function(_0x418a8e){_0xa9ffd1[_0xc7a4('0x20')]=_0x418a8e;if(_0x3a135f[_0xc7a4('0x32')][_0xc7a4('0x3f')]){_0x575252['include']=[{'all':!![]}];}return db[_0xc7a4('0x2d')][_0xc7a4('0x40')](_0x575252);})['then'](function(_0x5c9062){_0xa9ffd1[_0xc7a4('0x41')]=_0x5c9062;return _0xa9ffd1;})[_0xc7a4('0x27')](respondWithFilteredResult(_0x3867ee,_0x575252))['catch'](handleError(_0x3867ee,null));};exports['show']=function(_0xdd3686,_0x4478bc){var _0x3e1786={'raw':![],'where':{'id':_0xdd3686[_0xc7a4('0x42')]['id']}},_0x3be311={};_0x3be311[_0xc7a4('0x31')]=_[_0xc7a4('0x33')](db['SalesforceAccount']['rawAttributes']);_0x3be311['query']=_['keys'](_0xdd3686[_0xc7a4('0x32')]);_0x3be311[_0xc7a4('0x39')]=_[_0xc7a4('0x34')](_0x3be311[_0xc7a4('0x31')],_0x3be311[_0xc7a4('0x32')]);_0x3e1786['attributes']=_[_0xc7a4('0x34')](_0x3be311['model'],qs['fields'](_0xdd3686[_0xc7a4('0x32')][_0xc7a4('0x35')]));_0x3e1786[_0xc7a4('0x36')]=_0x3e1786[_0xc7a4('0x36')][_0xc7a4('0x37')]?_0x3e1786[_0xc7a4('0x36')]:_0x3be311['model'];if(_0xdd3686[_0xc7a4('0x32')][_0xc7a4('0x3f')]){_0x3e1786[_0xc7a4('0x43')]=[{'all':!![]}];}_0x3e1786=_['merge']({},_0x3e1786,_0xdd3686[_0xc7a4('0x3e')]);return db[_0xc7a4('0x2d')][_0xc7a4('0x44')](_0x3e1786)[_0xc7a4('0x27')](handleEntityNotFound(_0x4478bc,null))[_0xc7a4('0x27')](respondWithResult(_0x4478bc,null))[_0xc7a4('0x45')](handleError(_0x4478bc,null));};exports['create']=function(_0x1ea3e0,_0x4bdf03){return db[_0xc7a4('0x2d')][_0xc7a4('0x46')](_0x1ea3e0['body'],{})[_0xc7a4('0x27')](respondWithResult(_0x4bdf03,0xc9))['catch'](handleError(_0x4bdf03,null));};exports[_0xc7a4('0x26')]=function(_0x47a545,_0x4a65ff){if(_0x47a545['body']['id']){delete _0x47a545['body']['id'];}return db[_0xc7a4('0x2d')][_0xc7a4('0x44')]({'where':{'id':_0x47a545[_0xc7a4('0x42')]['id']}})[_0xc7a4('0x27')](handleEntityNotFound(_0x4a65ff,null))[_0xc7a4('0x27')](saveUpdates(_0x47a545[_0xc7a4('0x47')],null))[_0xc7a4('0x27')](respondWithResult(_0x4a65ff,null))[_0xc7a4('0x45')](handleError(_0x4a65ff,null));};exports[_0xc7a4('0x28')]=function(_0x3d6b5b,_0x5c39ca){return db[_0xc7a4('0x2d')][_0xc7a4('0x44')]({'where':{'id':_0x3d6b5b['params']['id']}})[_0xc7a4('0x27')](handleEntityNotFound(_0x5c39ca,null))[_0xc7a4('0x27')](removeEntity(_0x5c39ca,null))[_0xc7a4('0x45')](handleError(_0x5c39ca,null));};exports[_0xc7a4('0x48')]=function(_0x442e28,_0x14dbff,_0x5e2473){var _0x273c25={};var _0x114acd={};var _0x535570;var _0x50a4d1;return db['SalesforceAccount']['findOne']({'where':{'id':_0x442e28[_0xc7a4('0x42')]['id']}})[_0xc7a4('0x27')](handleEntityNotFound(_0x14dbff,null))[_0xc7a4('0x27')](function(_0x5e1cbb){if(_0x5e1cbb){_0x535570=_0x5e1cbb;_0x114acd[_0xc7a4('0x31')]=_[_0xc7a4('0x33')](db[_0xc7a4('0x49')]['rawAttributes']);_0x114acd[_0xc7a4('0x32')]=_['keys'](_0x442e28[_0xc7a4('0x32')]);_0x114acd[_0xc7a4('0x39')]=_[_0xc7a4('0x34')](_0x114acd[_0xc7a4('0x31')],_0x114acd[_0xc7a4('0x32')]);_0x273c25[_0xc7a4('0x36')]=_['intersection'](_0x114acd[_0xc7a4('0x31')],qs[_0xc7a4('0x35')](_0x442e28[_0xc7a4('0x32')][_0xc7a4('0x35')]));_0x273c25[_0xc7a4('0x36')]=_0x273c25[_0xc7a4('0x36')][_0xc7a4('0x37')]?_0x273c25[_0xc7a4('0x36')]:_0x114acd[_0xc7a4('0x31')];_0x273c25[_0xc7a4('0x4a')]=qs[_0xc7a4('0x38')](_0x442e28[_0xc7a4('0x32')][_0xc7a4('0x38')]);_0x273c25[_0xc7a4('0x3c')]=qs[_0xc7a4('0x39')](_['pick'](_0x442e28['query'],_0x114acd['filters']));if(_0x442e28['query'][_0xc7a4('0x3b')]){_0x273c25[_0xc7a4('0x3c')]=_[_0xc7a4('0x3d')](_0x273c25[_0xc7a4('0x3c')],{'$or':_[_0xc7a4('0x2c')](_0x273c25['attributes'],function(_0x467761){var _0x190d7c={};_0x190d7c[_0x467761]={'$like':'%'+_0x442e28[_0xc7a4('0x32')][_0xc7a4('0x3b')]+'%'};return _0x190d7c;})});}_0x273c25=_['merge']({},_0x273c25,_0x442e28[_0xc7a4('0x3e')]);return _0x535570[_0xc7a4('0x48')](_0x273c25);}})[_0xc7a4('0x27')](function(_0x24c751){if(_0x24c751){_0x50a4d1=_0x24c751[_0xc7a4('0x37')];if(!_0x442e28[_0xc7a4('0x32')][_0xc7a4('0x4b')]('nolimit')){_0x273c25[_0xc7a4('0x1f')]=qs['limit'](_0x442e28[_0xc7a4('0x32')][_0xc7a4('0x1f')]);_0x273c25['offset']=qs['offset'](_0x442e28['query'][_0xc7a4('0x1d')]);}return _0x535570[_0xc7a4('0x48')](_0x273c25);}})['then'](function(_0x18ec64){if(_0x18ec64){return _0x18ec64?{'count':_0x50a4d1,'rows':_0x18ec64}:null;}})[_0xc7a4('0x27')](respondWithResult(_0x14dbff,null))['catch'](handleError(_0x14dbff,null));};exports['addConfiguration']=function(_0x32fe26,_0x4736e1,_0x4dbc95){if(_0x32fe26['body']['id']){delete _0x32fe26['body']['id'];}return db[_0xc7a4('0x2d')][_0xc7a4('0x4c')]({'where':{'id':_0x32fe26[_0xc7a4('0x42')]['id']}})['then'](handleEntityNotFound(_0x4736e1,null))[_0xc7a4('0x27')](function(_0xafca2a){if(_0xafca2a){_0x32fe26['body'][_0xc7a4('0x4d')]=_0xafca2a['id'];_0x32fe26[_0xc7a4('0x47')]['Subjects']=integrations[_0xc7a4('0x4e')](_0x32fe26[_0xc7a4('0x47')][_0xc7a4('0x4f')],_0x32fe26[_0xc7a4('0x47')][_0xc7a4('0x2f')]);_0x32fe26[_0xc7a4('0x47')]['Descriptions']=integrations['getDescriptions'](_0x32fe26[_0xc7a4('0x47')][_0xc7a4('0x4f')],_0x32fe26[_0xc7a4('0x47')][_0xc7a4('0x2f')]);return db['SalesforceConfiguration'][_0xc7a4('0x46')](_0x32fe26['body'],{'include':[{'model':db[_0xc7a4('0x50')],'as':'Subjects'},{'model':db[_0xc7a4('0x50')],'as':_0xc7a4('0x51')}]});}return null;})['then'](respondWithResult(_0x4736e1,null))[_0xc7a4('0x45')](handleError(_0x4736e1,null));};exports[_0xc7a4('0x52')]=function(_0x14219b,_0x1c0559,_0x512ccd){var _0x19a1ee;var _0x9edd0c='';var _0x5b5e8a=_0xc7a4('0x53');return db[_0xc7a4('0x2d')][_0xc7a4('0x4c')]({'where':{'id':_0x14219b[_0xc7a4('0x42')]['id']},'attributes':['id',_0xc7a4('0x54'),'clientId','clientSecret','username',_0xc7a4('0x55'),_0xc7a4('0x56')]})[_0xc7a4('0x27')](handleEntityNotFound(_0x1c0559,null))[_0xc7a4('0x27')](function(_0x56d587){if(_0x56d587){_0x9edd0c=_0x56d587[_0xc7a4('0x54')];var _0x317531=_0x9edd0c[_0xc7a4('0x57')](-0x1);if(_0x317531==='/'){_0x9edd0c=_0x9edd0c['substring'](0x0,_0x9edd0c[_0xc7a4('0x58')](_0x317531));}_0x19a1ee=new jsforce[(_0xc7a4('0x59'))]({'oauth2':{'loginUrl':_0x9edd0c,'clientId':_0x56d587[_0xc7a4('0x5a')],'clientSecret':_0x56d587[_0xc7a4('0x5b')]}});return _0x19a1ee[_0xc7a4('0x5c')](_0x56d587[_0xc7a4('0x5d')],_0x56d587[_0xc7a4('0x55')][_0xc7a4('0x5e')](_0x56d587[_0xc7a4('0x56')]));}})[_0xc7a4('0x27')](function(_0x280422){if(_0x280422){if(!_['isNil'](_0x14219b[_0xc7a4('0x32')][_0xc7a4('0x5f')])){_0x5b5e8a=_0x14219b['query'][_0xc7a4('0x5f')];}return _0x19a1ee['sobject'](_0x5b5e8a)[_0xc7a4('0x60')]();}})[_0xc7a4('0x27')](function(_0x38acd9){var _0xd041be=[_0xc7a4('0x61'),_0xc7a4('0x62'),_0xc7a4('0x63'),_0xc7a4('0x64'),_0xc7a4('0x65'),_0xc7a4('0x66')];var _0x2e6da2=['string',_0xc7a4('0x67'),_0xc7a4('0x68'),'boolean',_0xc7a4('0x69'),_0xc7a4('0x6a'),'phone'];if(_0x38acd9){_['remove'](_0x38acd9['fields'],function(_0x13435d){return _0xd041be[_0xc7a4('0x6b')](_0x13435d[_0xc7a4('0x2a')])||!_0x2e6da2[_0xc7a4('0x6b')](_0x13435d[_0xc7a4('0x2f')]);});return{'count':_0x38acd9[_0xc7a4('0x35')][_0xc7a4('0x37')],'rows':_['map'](_0x38acd9['fields'],function(_0x1cdf49){return{'id':_0x1cdf49['name'],'name':_0x1cdf49[_0xc7a4('0x6c')],'custom':_0x1cdf49[_0xc7a4('0x6d')],'options':_0x1cdf49[_0xc7a4('0x6e')]['length']>0x0?_['map'](_0x1cdf49[_0xc7a4('0x6e')],function(_0x435af1){return{'name':_0x435af1[_0xc7a4('0x6c')],'value':_0x435af1['value']};}):_0x1cdf49['type']==_0xc7a4('0x6f')?[{'name':_0xc7a4('0x70'),'value':'true'},{'name':'False','value':'false'}]:[]};})};}})[_0xc7a4('0x27')](respondWithResult(_0x1c0559,null))[_0xc7a4('0x45')](function(_0x4223a5){var _0x1178e4=_0x14219b[_0xc7a4('0x32')]['test']?0x1f4:_0x4223a5[_0xc7a4('0x71')]||0x1f4;logger['error'](_0xc7a4('0x72'),_0xc7a4('0x52'),_0x1178e4,JSON[_0xc7a4('0x73')](_0x4223a5));delete _0x4223a5[_0xc7a4('0x2a')];if(_0x1178e4===0x191){_0x1178e4=0x190;}_0x1c0559['status'](_0x1178e4)[_0xc7a4('0x2b')](_0x14219b[_0xc7a4('0x32')][_0xc7a4('0x74')]?{'message':_0xc7a4('0x75'),'statusCode':_0x4223a5['statusCode']}:_0x4223a5);});}; \ No newline at end of file +var _0xb012=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','find','catch','create','body','getConfigurations','findOne','SalesforceConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','clientSecret','securityToken','remoteUri','slice','lastIndexOf','clientId','password','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','int','picklist','boolean','textarea','phone','remove','includes','length','custom','picklistValues','label','value','true','False','false','send','Wrong\x20credentials','eml-format','rimraf','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x142dc4,_0x366f49){var _0x5d9776=function(_0x41e34b){while(--_0x41e34b){_0x142dc4['push'](_0x142dc4['shift']());}};_0x5d9776(++_0x366f49);}(_0xb012,0x69));var _0x2b01=function(_0x3cd34a,_0x93acd2){_0x3cd34a=_0x3cd34a-0x0;var _0x1ea6f4=_0xb012[_0x3cd34a];return _0x1ea6f4;};'use strict';var emlformat=require(_0x2b01('0x0'));var rimraf=require(_0x2b01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2b01('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2b01('0x3'));var util=require(_0x2b01('0x4'));var path=require(_0x2b01('0x5'));var sox=require(_0x2b01('0x6'));var csv=require(_0x2b01('0x7'));var ejs=require(_0x2b01('0x8'));var fs=require('fs');var fs_extra=require(_0x2b01('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2b01('0xa'));var jsforce=require(_0x2b01('0xb'));var deskjs=require(_0x2b01('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2b01('0xd'));var Papa=require(_0x2b01('0xe'));var Redis=require(_0x2b01('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2b01('0x10'));var as=require(_0x2b01('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b01('0x12'))(_0x2b01('0x13'));var utils=require(_0x2b01('0x14'));var config=require(_0x2b01('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2b01('0x16'))['db'];var integrations=require(_0x2b01('0x17'));function respondWithStatusCode(_0x368125,_0x5d8718){_0x5d8718=_0x5d8718||0xcc;return function(_0x3eec52){if(_0x3eec52){return _0x368125[_0x2b01('0x18')](_0x5d8718);}return _0x368125[_0x2b01('0x19')](_0x5d8718)[_0x2b01('0x1a')]();};}function respondWithResult(_0x4584f6,_0x4feec2){_0x4feec2=_0x4feec2||0xc8;return function(_0x4074fa){if(_0x4074fa){return _0x4584f6[_0x2b01('0x19')](_0x4feec2)['json'](_0x4074fa);}};}function respondWithFilteredResult(_0x2758c6,_0x521462){return function(_0x5f2324){if(_0x5f2324){var _0x13e75b=typeof _0x521462['offset']===_0x2b01('0x1b')&&typeof _0x521462[_0x2b01('0x1c')]===_0x2b01('0x1b');var _0x2245f3=_0x5f2324[_0x2b01('0x1d')];var _0x5a3dcb=_0x13e75b?0x0:_0x521462[_0x2b01('0x1e')];var _0x4aeef9=_0x13e75b?_0x5f2324['count']:_0x521462[_0x2b01('0x1e')]+_0x521462[_0x2b01('0x1c')];var _0x2c06ae;if(_0x4aeef9>=_0x2245f3){_0x4aeef9=_0x2245f3;_0x2c06ae=0xc8;}else{_0x2c06ae=0xce;}_0x2758c6['status'](_0x2c06ae);return _0x2758c6['set'](_0x2b01('0x1f'),_0x5a3dcb+'-'+_0x4aeef9+'/'+_0x2245f3)[_0x2b01('0x20')](_0x5f2324);}return null;};}function patchUpdates(_0x392eec){return function(_0x501329){try{jsonpatch[_0x2b01('0x21')](_0x501329,_0x392eec,!![]);}catch(_0x22c0cd){return BPromise[_0x2b01('0x22')](_0x22c0cd);}return _0x501329[_0x2b01('0x23')]();};}function saveUpdates(_0x39286d,_0x9fb63f){return function(_0x271614){if(_0x271614){return _0x271614[_0x2b01('0x24')](_0x39286d)[_0x2b01('0x25')](function(_0x2a0474){return _0x2a0474;});}return null;};}function removeEntity(_0x26f957,_0x1f64fc){return function(_0x34411d){if(_0x34411d){return _0x34411d[_0x2b01('0x26')]()[_0x2b01('0x25')](function(){_0x26f957[_0x2b01('0x19')](0xcc)[_0x2b01('0x1a')]();});}};}function handleEntityNotFound(_0x418faa,_0x39cf49){return function(_0x342af7){if(!_0x342af7){_0x418faa['sendStatus'](0x194);}return _0x342af7;};}function handleError(_0x288915,_0x17d5a2){_0x17d5a2=_0x17d5a2||0x1f4;return function(_0x45b337){logger[_0x2b01('0x27')](_0x45b337[_0x2b01('0x28')]);if(_0x45b337[_0x2b01('0x29')]){delete _0x45b337[_0x2b01('0x29')];}_0x288915[_0x2b01('0x19')](_0x17d5a2)['send'](_0x45b337);};}exports[_0x2b01('0x2a')]=function(_0x593692,_0x26cc17){var _0x230cd2={},_0x2365f3={},_0x4e9abd={'count':0x0,'rows':[]};var _0x1b68e2=_[_0x2b01('0x2b')](db[_0x2b01('0x2c')][_0x2b01('0x2d')],function(_0x13f653){return{'name':_0x13f653[_0x2b01('0x2e')],'type':_0x13f653[_0x2b01('0x2f')][_0x2b01('0x30')]};});_0x2365f3[_0x2b01('0x31')]=_['map'](_0x1b68e2,'name');_0x2365f3['query']=_[_0x2b01('0x32')](_0x593692[_0x2b01('0x33')]);_0x2365f3[_0x2b01('0x34')]=_[_0x2b01('0x35')](_0x2365f3[_0x2b01('0x31')],_0x2365f3['query']);_0x230cd2['attributes']=_['intersection'](_0x2365f3[_0x2b01('0x31')],qs[_0x2b01('0x36')](_0x593692[_0x2b01('0x33')][_0x2b01('0x36')]));_0x230cd2[_0x2b01('0x37')]=_0x230cd2['attributes']['length']?_0x230cd2['attributes']:_0x2365f3['model'];if(!_0x593692[_0x2b01('0x33')]['hasOwnProperty'](_0x2b01('0x38'))){_0x230cd2['limit']=qs[_0x2b01('0x1c')](_0x593692['query']['limit']);_0x230cd2[_0x2b01('0x1e')]=qs[_0x2b01('0x1e')](_0x593692[_0x2b01('0x33')][_0x2b01('0x1e')]);}_0x230cd2['order']=qs[_0x2b01('0x39')](_0x593692['query'][_0x2b01('0x39')]);_0x230cd2['where']=qs['filters'](_[_0x2b01('0x3a')](_0x593692[_0x2b01('0x33')],_0x2365f3[_0x2b01('0x34')]),_0x1b68e2);if(_0x593692['query'][_0x2b01('0x3b')]){_0x230cd2[_0x2b01('0x3c')]=_[_0x2b01('0x3d')](_0x230cd2[_0x2b01('0x3c')],{'$or':_['map'](_0x1b68e2,function(_0x5ccab7){if(_0x5ccab7[_0x2b01('0x2f')]!==_0x2b01('0x3e')){var _0x37ed1d={};_0x37ed1d[_0x5ccab7[_0x2b01('0x29')]]={'$like':'%'+_0x593692[_0x2b01('0x33')]['filter']+'%'};return _0x37ed1d;}})});}_0x230cd2=_[_0x2b01('0x3d')]({},_0x230cd2,_0x593692[_0x2b01('0x3f')]);var _0x16879d={'where':_0x230cd2[_0x2b01('0x3c')]};return db[_0x2b01('0x2c')]['count'](_0x16879d)[_0x2b01('0x25')](function(_0x36fe2d){_0x4e9abd[_0x2b01('0x1d')]=_0x36fe2d;if(_0x593692['query']['includeAll']){_0x230cd2['include']=[{'all':!![]}];}return db[_0x2b01('0x2c')][_0x2b01('0x40')](_0x230cd2);})[_0x2b01('0x25')](function(_0x2dbc5c){_0x4e9abd[_0x2b01('0x41')]=_0x2dbc5c;return _0x4e9abd;})[_0x2b01('0x25')](respondWithFilteredResult(_0x26cc17,_0x230cd2))['catch'](handleError(_0x26cc17,null));};exports[_0x2b01('0x42')]=function(_0x5cc723,_0x425dda){var _0x113951={'raw':![],'where':{'id':_0x5cc723[_0x2b01('0x43')]['id']}},_0x5a85d9={};_0x5a85d9[_0x2b01('0x31')]=_[_0x2b01('0x32')](db[_0x2b01('0x2c')][_0x2b01('0x2d')]);_0x5a85d9[_0x2b01('0x33')]=_[_0x2b01('0x32')](_0x5cc723['query']);_0x5a85d9[_0x2b01('0x34')]=_['intersection'](_0x5a85d9['model'],_0x5a85d9[_0x2b01('0x33')]);_0x113951[_0x2b01('0x37')]=_['intersection'](_0x5a85d9[_0x2b01('0x31')],qs[_0x2b01('0x36')](_0x5cc723[_0x2b01('0x33')][_0x2b01('0x36')]));_0x113951[_0x2b01('0x37')]=_0x113951[_0x2b01('0x37')]['length']?_0x113951[_0x2b01('0x37')]:_0x5a85d9[_0x2b01('0x31')];if(_0x5cc723[_0x2b01('0x33')][_0x2b01('0x44')]){_0x113951['include']=[{'all':!![]}];}_0x113951=_[_0x2b01('0x3d')]({},_0x113951,_0x5cc723[_0x2b01('0x3f')]);return db['SalesforceAccount'][_0x2b01('0x45')](_0x113951)[_0x2b01('0x25')](handleEntityNotFound(_0x425dda,null))[_0x2b01('0x25')](respondWithResult(_0x425dda,null))[_0x2b01('0x46')](handleError(_0x425dda,null));};exports[_0x2b01('0x47')]=function(_0xcc73c7,_0x41b344){return db['SalesforceAccount'][_0x2b01('0x47')](_0xcc73c7[_0x2b01('0x48')],{})[_0x2b01('0x25')](respondWithResult(_0x41b344,0xc9))[_0x2b01('0x46')](handleError(_0x41b344,null));};exports[_0x2b01('0x24')]=function(_0x205032,_0xf64c9){if(_0x205032[_0x2b01('0x48')]['id']){delete _0x205032['body']['id'];}return db[_0x2b01('0x2c')][_0x2b01('0x45')]({'where':{'id':_0x205032[_0x2b01('0x43')]['id']}})[_0x2b01('0x25')](handleEntityNotFound(_0xf64c9,null))['then'](saveUpdates(_0x205032['body'],null))[_0x2b01('0x25')](respondWithResult(_0xf64c9,null))['catch'](handleError(_0xf64c9,null));};exports[_0x2b01('0x26')]=function(_0x2e3ec8,_0x4c4a59){return db['SalesforceAccount'][_0x2b01('0x45')]({'where':{'id':_0x2e3ec8[_0x2b01('0x43')]['id']}})[_0x2b01('0x25')](handleEntityNotFound(_0x4c4a59,null))[_0x2b01('0x25')](removeEntity(_0x4c4a59,null))['catch'](handleError(_0x4c4a59,null));};exports[_0x2b01('0x49')]=function(_0x59a22c,_0x19e756,_0x364f99){var _0x249c9d={};var _0xeef65d={};var _0x19321c;var _0x512dd6;return db[_0x2b01('0x2c')][_0x2b01('0x4a')]({'where':{'id':_0x59a22c[_0x2b01('0x43')]['id']}})[_0x2b01('0x25')](handleEntityNotFound(_0x19e756,null))[_0x2b01('0x25')](function(_0x1f8186){if(_0x1f8186){_0x19321c=_0x1f8186;_0xeef65d['model']=_[_0x2b01('0x32')](db[_0x2b01('0x4b')]['rawAttributes']);_0xeef65d[_0x2b01('0x33')]=_[_0x2b01('0x32')](_0x59a22c[_0x2b01('0x33')]);_0xeef65d[_0x2b01('0x34')]=_['intersection'](_0xeef65d[_0x2b01('0x31')],_0xeef65d['query']);_0x249c9d['attributes']=_[_0x2b01('0x35')](_0xeef65d[_0x2b01('0x31')],qs[_0x2b01('0x36')](_0x59a22c['query'][_0x2b01('0x36')]));_0x249c9d[_0x2b01('0x37')]=_0x249c9d['attributes']['length']?_0x249c9d[_0x2b01('0x37')]:_0xeef65d[_0x2b01('0x31')];_0x249c9d['order']=qs[_0x2b01('0x39')](_0x59a22c[_0x2b01('0x33')][_0x2b01('0x39')]);_0x249c9d[_0x2b01('0x3c')]=qs['filters'](_[_0x2b01('0x3a')](_0x59a22c[_0x2b01('0x33')],_0xeef65d[_0x2b01('0x34')]));if(_0x59a22c[_0x2b01('0x33')][_0x2b01('0x3b')]){_0x249c9d['where']=_[_0x2b01('0x3d')](_0x249c9d['where'],{'$or':_[_0x2b01('0x2b')](_0x249c9d['attributes'],function(_0x46b284){var _0x25476f={};_0x25476f[_0x46b284]={'$like':'%'+_0x59a22c[_0x2b01('0x33')]['filter']+'%'};return _0x25476f;})});}_0x249c9d=_[_0x2b01('0x3d')]({},_0x249c9d,_0x59a22c['options']);return _0x19321c['getConfigurations'](_0x249c9d);}})[_0x2b01('0x25')](function(_0x19a284){if(_0x19a284){_0x512dd6=_0x19a284['length'];if(!_0x59a22c[_0x2b01('0x33')][_0x2b01('0x4c')](_0x2b01('0x38'))){_0x249c9d[_0x2b01('0x1c')]=qs[_0x2b01('0x1c')](_0x59a22c[_0x2b01('0x33')][_0x2b01('0x1c')]);_0x249c9d['offset']=qs[_0x2b01('0x1e')](_0x59a22c[_0x2b01('0x33')][_0x2b01('0x1e')]);}return _0x19321c[_0x2b01('0x49')](_0x249c9d);}})['then'](function(_0x138c2f){if(_0x138c2f){return _0x138c2f?{'count':_0x512dd6,'rows':_0x138c2f}:null;}})['then'](respondWithResult(_0x19e756,null))[_0x2b01('0x46')](handleError(_0x19e756,null));};exports[_0x2b01('0x4d')]=function(_0xcaec0c,_0xd6299a,_0x3f539e){if(_0xcaec0c[_0x2b01('0x48')]['id']){delete _0xcaec0c[_0x2b01('0x48')]['id'];}return db[_0x2b01('0x2c')][_0x2b01('0x4a')]({'where':{'id':_0xcaec0c[_0x2b01('0x43')]['id']}})[_0x2b01('0x25')](handleEntityNotFound(_0xd6299a,null))['then'](function(_0x4de082){if(_0x4de082){_0xcaec0c['body'][_0x2b01('0x4e')]=_0x4de082['id'];_0xcaec0c['body'][_0x2b01('0x4f')]=integrations[_0x2b01('0x50')](_0xcaec0c[_0x2b01('0x48')][_0x2b01('0x51')],_0xcaec0c[_0x2b01('0x48')][_0x2b01('0x2f')]);_0xcaec0c[_0x2b01('0x48')][_0x2b01('0x52')]=integrations[_0x2b01('0x53')](_0xcaec0c[_0x2b01('0x48')][_0x2b01('0x51')],_0xcaec0c[_0x2b01('0x48')][_0x2b01('0x2f')]);return db['SalesforceConfiguration']['create'](_0xcaec0c['body'],{'include':[{'model':db[_0x2b01('0x54')],'as':_0x2b01('0x4f')},{'model':db[_0x2b01('0x54')],'as':_0x2b01('0x52')}]});}return null;})['then'](respondWithResult(_0xd6299a,null))[_0x2b01('0x46')](handleError(_0xd6299a,null));};exports[_0x2b01('0x55')]=function(_0x729bb0,_0x4f9a51,_0x2317c4){var _0x47064c;var _0x419bf3='';var _0x925709=_0x2b01('0x56');return db['SalesforceAccount'][_0x2b01('0x4a')]({'where':{'id':_0x729bb0[_0x2b01('0x43')]['id']},'attributes':['id','remoteUri','clientId',_0x2b01('0x57'),'username','password',_0x2b01('0x58')]})[_0x2b01('0x25')](handleEntityNotFound(_0x4f9a51,null))[_0x2b01('0x25')](function(_0x316bc8){if(_0x316bc8){_0x419bf3=_0x316bc8[_0x2b01('0x59')];var _0xd3779f=_0x419bf3[_0x2b01('0x5a')](-0x1);if(_0xd3779f==='/'){_0x419bf3=_0x419bf3['substring'](0x0,_0x419bf3[_0x2b01('0x5b')](_0xd3779f));}_0x47064c=new jsforce['Connection']({'oauth2':{'loginUrl':_0x419bf3,'clientId':_0x316bc8[_0x2b01('0x5c')],'clientSecret':_0x316bc8[_0x2b01('0x57')]}});return _0x47064c['login'](_0x316bc8['username'],_0x316bc8[_0x2b01('0x5d')][_0x2b01('0x5e')](_0x316bc8[_0x2b01('0x58')]));}})[_0x2b01('0x25')](function(_0x26415b){if(_0x26415b){if(!_[_0x2b01('0x5f')](_0x729bb0[_0x2b01('0x33')]['ticketType'])){_0x925709=_0x729bb0[_0x2b01('0x33')][_0x2b01('0x60')];}return _0x47064c[_0x2b01('0x61')](_0x925709)[_0x2b01('0x62')]();}})[_0x2b01('0x25')](function(_0x22de36){var _0x22aa1b=[_0x2b01('0x63'),_0x2b01('0x64'),_0x2b01('0x65'),_0x2b01('0x66'),_0x2b01('0x67'),'Description'];var _0x69154a=[_0x2b01('0x68'),_0x2b01('0x69'),_0x2b01('0x6a'),_0x2b01('0x6b'),'email',_0x2b01('0x6c'),_0x2b01('0x6d')];if(_0x22de36){_[_0x2b01('0x6e')](_0x22de36['fields'],function(_0x326063){return _0x22aa1b[_0x2b01('0x6f')](_0x326063['name'])||!_0x69154a[_0x2b01('0x6f')](_0x326063['type']);});return{'count':_0x22de36[_0x2b01('0x36')][_0x2b01('0x70')],'rows':_[_0x2b01('0x2b')](_0x22de36['fields'],function(_0x48ee81){return{'id':_0x48ee81[_0x2b01('0x29')],'name':_0x48ee81['label'],'custom':_0x48ee81[_0x2b01('0x71')],'options':_0x48ee81[_0x2b01('0x72')][_0x2b01('0x70')]>0x0?_[_0x2b01('0x2b')](_0x48ee81[_0x2b01('0x72')],function(_0x2abb9b){return{'name':_0x2abb9b[_0x2b01('0x73')],'value':_0x2abb9b[_0x2b01('0x74')]};}):_0x48ee81[_0x2b01('0x2f')]==_0x2b01('0x6b')?[{'name':'True','value':_0x2b01('0x75')},{'name':_0x2b01('0x76'),'value':_0x2b01('0x77')}]:[]};})};}})[_0x2b01('0x25')](respondWithResult(_0x4f9a51,null))[_0x2b01('0x46')](function(_0xa3b62){var _0x152c66=_0x729bb0['query']['test']?0x1f4:_0xa3b62['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x2b01('0x55'),_0x152c66,JSON['stringify'](_0xa3b62));delete _0xa3b62['name'];if(_0x152c66===0x191){_0x152c66=0x190;}_0x4f9a51[_0x2b01('0x19')](_0x152c66)[_0x2b01('0x78')](_0x729bb0[_0x2b01('0x33')]['test']?{'message':_0x2b01('0x79'),'statusCode':_0xa3b62['statusCode']}:_0xa3b62);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 4b50a98..dbfa410 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 _0x515d=['bluebird','request-promise','path','rimraf','./intSalesforceAccount.attributes','define','SalesforceAccount','int_salesforce_accounts','util','../../config/logger','api','moment'];(function(_0x3b3210,_0x25e8ed){var _0x5b5484=function(_0x417858){while(--_0x417858){_0x3b3210['push'](_0x3b3210['shift']());}};_0x5b5484(++_0x25e8ed);}(_0x515d,0x104));var _0xd515=function(_0x22c58b,_0x1a59c9){_0x22c58b=_0x22c58b-0x0;var _0x1fe680=_0x515d[_0x22c58b];return _0x1fe680;};'use strict';var _=require('lodash');var util=require(_0xd515('0x0'));var logger=require(_0xd515('0x1'))(_0xd515('0x2'));var moment=require(_0xd515('0x3'));var BPromise=require(_0xd515('0x4'));var rp=require(_0xd515('0x5'));var fs=require('fs');var path=require(_0xd515('0x6'));var rimraf=require(_0xd515('0x7'));var config=require('../../config/environment');var attributes=require(_0xd515('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x42daa5,_0x1130fc){return _0x42daa5[_0xd515('0x9')](_0xd515('0xa'),attributes,{'tableName':_0xd515('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10d8=['exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../components/integrations/configuration'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x10d8,0xee));var _0x810d=function(_0x488876,_0x6baec9){_0x488876=_0x488876-0x0;var _0x58e179=_0x10d8[_0x488876];return _0x58e179;};'use strict';var _=require(_0x810d('0x0'));var util=require(_0x810d('0x1'));var logger=require(_0x810d('0x2'))('api');var moment=require(_0x810d('0x3'));var BPromise=require(_0x810d('0x4'));var rp=require(_0x810d('0x5'));var fs=require('fs');var path=require(_0x810d('0x6'));var rimraf=require(_0x810d('0x7'));var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x810d('0x8'));module[_0x810d('0x9')]=function(_0xeebfbe,_0x3a4786){return _0xeebfbe[_0x810d('0xa')](_0x810d('0xb'),attributes,{'tableName':_0x810d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index bd5577a..8858a47 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 _0x36e2=['request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetSalesforceAccount','SalesforceAccount','options','where','model','attributes','include','map','stringify','ShowSalesforceAccount','find','raw','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SalesforceAccount,\x20%s,\x20%s'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x36e2,0x1f3));var _0x236e=function(_0x488602,_0xd80932){_0x488602=_0x488602-0x0;var _0x484b92=_0x36e2[_0x488602];return _0x484b92;};'use strict';var _=require(_0x236e('0x0'));var util=require('util');var moment=require(_0x236e('0x1'));var BPromise=require(_0x236e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x236e('0x3'))['db'];var utils=require(_0x236e('0x4'));var logger=require(_0x236e('0x5'))(_0x236e('0x6'));var config=require(_0x236e('0x7'));var jayson=require(_0x236e('0x8'));var client=jayson[_0x236e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30a386,_0x58d1df,_0x489f0d){return new BPromise(function(_0x44857f,_0xa6a959){return client['request'](_0x30a386,_0x489f0d)[_0x236e('0xa')](function(_0x196073){logger[_0x236e('0xb')](_0x236e('0xc'),_0x58d1df,_0x236e('0xd'));logger[_0x236e('0xe')](_0x236e('0xf'),_0x58d1df,_0x236e('0xd'),JSON['stringify'](_0x196073));if(_0x196073[_0x236e('0x10')]){if(_0x196073[_0x236e('0x10')][_0x236e('0x11')]===0x1f4){logger[_0x236e('0x10')](_0x236e('0xc'),_0x58d1df,_0x196073[_0x236e('0x10')][_0x236e('0x12')]);return _0xa6a959(_0x196073['error'][_0x236e('0x12')]);}logger['error'](_0x236e('0xc'),_0x58d1df,_0x196073[_0x236e('0x10')]['message']);return _0x44857f(_0x196073[_0x236e('0x10')][_0x236e('0x12')]);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x58d1df,_0x236e('0xd'));_0x44857f(_0x196073['result'][_0x236e('0x12')]);}})[_0x236e('0x13')](function(_0x47babb){logger[_0x236e('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x58d1df,_0x47babb);_0xa6a959(_0x47babb);});});}exports[_0x236e('0x14')]=function(_0x5c8d07){var _0x453bd0=this;return new Promise(function(_0x27621a,_0x331b43){return db[_0x236e('0x15')]['findAll']({'raw':_0x5c8d07[_0x236e('0x16')]?_0x5c8d07[_0x236e('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5c8d07['options']?_0x5c8d07[_0x236e('0x16')][_0x236e('0x17')]||null:null,'attributes':_0x5c8d07[_0x236e('0x16')]?_0x5c8d07[_0x236e('0x16')]['attributes']||null:null,'limit':_0x5c8d07[_0x236e('0x16')]?_0x5c8d07['options']['limit']||null:null,'include':_0x5c8d07[_0x236e('0x16')]?_0x5c8d07['options']['include']?_['map'](_0x5c8d07[_0x236e('0x16')]['include'],function(_0x46d3fa){return{'model':db[_0x46d3fa[_0x236e('0x18')]],'as':_0x46d3fa['as'],'attributes':_0x46d3fa[_0x236e('0x19')],'include':_0x46d3fa[_0x236e('0x1a')]?_[_0x236e('0x1b')](_0x46d3fa['include'],function(_0x5bd2f0){return{'model':db[_0x5bd2f0[_0x236e('0x18')]],'as':_0x5bd2f0['as'],'attributes':_0x5bd2f0[_0x236e('0x19')],'include':_0x5bd2f0[_0x236e('0x1a')]?_[_0x236e('0x1b')](_0x5bd2f0[_0x236e('0x1a')],function(_0xbd7eba){return{'model':db[_0xbd7eba[_0x236e('0x18')]],'as':_0xbd7eba['as'],'attributes':_0xbd7eba[_0x236e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x236e('0xa')](function(_0x2f279f){logger[_0x236e('0xb')](_0x236e('0x14'),_0x5c8d07);logger[_0x236e('0xe')](_0x236e('0x14'),_0x5c8d07,JSON[_0x236e('0x1c')](_0x2f279f));_0x27621a(_0x2f279f);})[_0x236e('0x13')](function(_0x246d6a){logger[_0x236e('0x10')](_0x236e('0x14'),_0x246d6a[_0x236e('0x12')],_0x5c8d07);_0x331b43(_0x453bd0[_0x236e('0x10')](0x1f4,_0x246d6a[_0x236e('0x12')]));});});};exports[_0x236e('0x1d')]=function(_0x31df4c){var _0x4efc6e=this;return new Promise(function(_0x17395b,_0xaa9b67){return db[_0x236e('0x15')][_0x236e('0x1e')]({'raw':_0x31df4c[_0x236e('0x16')]?_0x31df4c[_0x236e('0x16')][_0x236e('0x1f')]===undefined?!![]:![]:!![],'where':_0x31df4c[_0x236e('0x16')]?_0x31df4c[_0x236e('0x16')][_0x236e('0x17')]||null:null,'attributes':_0x31df4c[_0x236e('0x16')]?_0x31df4c[_0x236e('0x16')]['attributes']||null:null,'include':_0x31df4c[_0x236e('0x16')]?_0x31df4c[_0x236e('0x16')][_0x236e('0x1a')]?_[_0x236e('0x1b')](_0x31df4c[_0x236e('0x16')][_0x236e('0x1a')],function(_0x1e502e){return{'model':db[_0x1e502e[_0x236e('0x18')]],'as':_0x1e502e['as'],'attributes':_0x1e502e[_0x236e('0x19')],'include':_0x1e502e[_0x236e('0x1a')]?_[_0x236e('0x1b')](_0x1e502e[_0x236e('0x1a')],function(_0x38e7c9){return{'model':db[_0x38e7c9[_0x236e('0x18')]],'as':_0x38e7c9['as'],'attributes':_0x38e7c9[_0x236e('0x19')],'include':_0x38e7c9['include']?_[_0x236e('0x1b')](_0x38e7c9[_0x236e('0x1a')],function(_0x5879b2){return{'model':db[_0x5879b2['model']],'as':_0x5879b2['as'],'attributes':_0x5879b2['attributes']};}):[]};}):[]};}):[]:[]})[_0x236e('0xa')](function(_0x552a37){logger[_0x236e('0xb')]('ShowSalesforceAccount',_0x31df4c);logger[_0x236e('0xe')](_0x236e('0x1d'),_0x31df4c,JSON[_0x236e('0x1c')](_0x552a37));_0x17395b(_0x552a37);})[_0x236e('0x13')](function(_0x42867d){logger[_0x236e('0x10')](_0x236e('0x1d'),_0x42867d[_0x236e('0x12')],_0x31df4c);_0xaa9b67(_0x4efc6e[_0x236e('0x10')](0x1f4,_0x42867d[_0x236e('0x12')]));});});}; \ No newline at end of file +var _0x9105=['client','http','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','map','include','model','ShowSalesforceAccount','find','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4b5ebf,_0x3ecfcc){var _0x154546=function(_0x5bd577){while(--_0x5bd577){_0x4b5ebf['push'](_0x4b5ebf['shift']());}};_0x154546(++_0x3ecfcc);}(_0x9105,0xc9));var _0x5910=function(_0x1335e1,_0x9f1072){_0x1335e1=_0x1335e1-0x0;var _0x2f92d5=_0x9105[_0x1335e1];return _0x2f92d5;};'use strict';var _=require(_0x5910('0x0'));var util=require('util');var moment=require(_0x5910('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5910('0x2'));var db=require(_0x5910('0x3'))['db'];var utils=require(_0x5910('0x4'));var logger=require(_0x5910('0x5'))(_0x5910('0x6'));var config=require(_0x5910('0x7'));var jayson=require(_0x5910('0x8'));var client=jayson[_0x5910('0x9')][_0x5910('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ac61d,_0x562ea6,_0x20a475){return new BPromise(function(_0x2c30e3,_0x3489d4){return client['request'](_0x2ac61d,_0x20a475)[_0x5910('0xb')](function(_0x542c09){logger[_0x5910('0xc')](_0x5910('0xd'),_0x562ea6,_0x5910('0xe'));logger[_0x5910('0xf')](_0x5910('0x10'),_0x562ea6,_0x5910('0xe'),JSON[_0x5910('0x11')](_0x542c09));if(_0x542c09[_0x5910('0x12')]){if(_0x542c09['error'][_0x5910('0x13')]===0x1f4){logger['error'](_0x5910('0xd'),_0x562ea6,_0x542c09[_0x5910('0x12')]['message']);return _0x3489d4(_0x542c09['error']['message']);}logger[_0x5910('0x12')](_0x5910('0xd'),_0x562ea6,_0x542c09[_0x5910('0x12')]['message']);return _0x2c30e3(_0x542c09[_0x5910('0x12')][_0x5910('0x14')]);}else{logger['info'](_0x5910('0xd'),_0x562ea6,'request\x20sent');_0x2c30e3(_0x542c09[_0x5910('0x15')][_0x5910('0x14')]);}})[_0x5910('0x16')](function(_0x54fa34){logger[_0x5910('0x12')](_0x5910('0xd'),_0x562ea6,_0x54fa34);_0x3489d4(_0x54fa34);});});}exports[_0x5910('0x17')]=function(_0x40c440){var _0xc25d79=this;return new Promise(function(_0x598c7b,_0x472198){return db[_0x5910('0x18')][_0x5910('0x19')]({'raw':_0x40c440[_0x5910('0x1a')]?_0x40c440['options'][_0x5910('0x1b')]===undefined?!![]:![]:!![],'where':_0x40c440[_0x5910('0x1a')]?_0x40c440[_0x5910('0x1a')][_0x5910('0x1c')]||null:null,'attributes':_0x40c440[_0x5910('0x1a')]?_0x40c440[_0x5910('0x1a')][_0x5910('0x1d')]||null:null,'limit':_0x40c440[_0x5910('0x1a')]?_0x40c440[_0x5910('0x1a')]['limit']||null:null,'include':_0x40c440['options']?_0x40c440[_0x5910('0x1a')]['include']?_[_0x5910('0x1e')](_0x40c440[_0x5910('0x1a')][_0x5910('0x1f')],function(_0xbe5e1a){return{'model':db[_0xbe5e1a[_0x5910('0x20')]],'as':_0xbe5e1a['as'],'attributes':_0xbe5e1a[_0x5910('0x1d')],'include':_0xbe5e1a['include']?_['map'](_0xbe5e1a['include'],function(_0x42f680){return{'model':db[_0x42f680[_0x5910('0x20')]],'as':_0x42f680['as'],'attributes':_0x42f680['attributes'],'include':_0x42f680[_0x5910('0x1f')]?_[_0x5910('0x1e')](_0x42f680['include'],function(_0x59c1f3){return{'model':db[_0x59c1f3[_0x5910('0x20')]],'as':_0x59c1f3['as'],'attributes':_0x59c1f3[_0x5910('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5910('0xb')](function(_0x57ca0a){logger[_0x5910('0xc')](_0x5910('0x17'),_0x40c440);logger[_0x5910('0xf')](_0x5910('0x17'),_0x40c440,JSON['stringify'](_0x57ca0a));_0x598c7b(_0x57ca0a);})[_0x5910('0x16')](function(_0x214999){logger[_0x5910('0x12')](_0x5910('0x17'),_0x214999[_0x5910('0x14')],_0x40c440);_0x472198(_0xc25d79['error'](0x1f4,_0x214999['message']));});});};exports[_0x5910('0x21')]=function(_0x33d318){var _0x5489e9=this;return new Promise(function(_0x10702b,_0x2e77da){return db['SalesforceAccount'][_0x5910('0x22')]({'raw':_0x33d318['options']?_0x33d318['options'][_0x5910('0x1b')]===undefined?!![]:![]:!![],'where':_0x33d318[_0x5910('0x1a')]?_0x33d318[_0x5910('0x1a')][_0x5910('0x1c')]||null:null,'attributes':_0x33d318[_0x5910('0x1a')]?_0x33d318[_0x5910('0x1a')][_0x5910('0x1d')]||null:null,'include':_0x33d318['options']?_0x33d318['options']['include']?_[_0x5910('0x1e')](_0x33d318['options'][_0x5910('0x1f')],function(_0x57fa62){return{'model':db[_0x57fa62[_0x5910('0x20')]],'as':_0x57fa62['as'],'attributes':_0x57fa62[_0x5910('0x1d')],'include':_0x57fa62['include']?_[_0x5910('0x1e')](_0x57fa62[_0x5910('0x1f')],function(_0x49db7a){return{'model':db[_0x49db7a['model']],'as':_0x49db7a['as'],'attributes':_0x49db7a[_0x5910('0x1d')],'include':_0x49db7a[_0x5910('0x1f')]?_['map'](_0x49db7a[_0x5910('0x1f')],function(_0x16f096){return{'model':db[_0x16f096['model']],'as':_0x16f096['as'],'attributes':_0x16f096[_0x5910('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5910('0xb')](function(_0x1847a6){logger['info'](_0x5910('0x21'),_0x33d318);logger[_0x5910('0xf')](_0x5910('0x21'),_0x33d318,JSON[_0x5910('0x11')](_0x1847a6));_0x10702b(_0x1847a6);})[_0x5910('0x16')](function(_0x4390f7){logger[_0x5910('0x12')]('ShowSalesforceAccount',_0x4390f7[_0x5910('0x14')],_0x33d318);_0x2e77da(_0x5489e9[_0x5910('0x12')](0x1f4,_0x4390f7[_0x5910('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index cd9e7b8..31d2276 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(_0x4e6d45,_0x446828){var _0x264716=function(_0x26785e){while(--_0x26785e){_0x4e6d45['push'](_0x4e6d45['shift']());}};_0x264716(++_0x446828);}(_0xadb5,0xad));var _0x5adb=function(_0x4de94f,_0x2cb97d){_0x4de94f=_0x4de94f-0x0;var _0x1b8578=_0xadb5[_0x4de94f];return _0x1b8578;};'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 _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0xcc51bc,_0x19bfb8){var _0x190c3f=function(_0x4c251d){while(--_0x4c251d){_0xcc51bc['push'](_0xcc51bc['shift']());}};_0x190c3f(++_0x19bfb8);}(_0x2ef3,0xba));var _0x32ef=function(_0x3555fc,_0xd9afcc){_0x3555fc=_0x3555fc-0x0;var _0x480684=_0x2ef3[_0x3555fc];return _0x480684;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index a885e9d..7615ee0 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 _0x5cba=['exports','STRING','ENUM','Task','Case','contact_lead','contact','lead','account','nothing','sequelize'];(function(_0x1ee6c7,_0x40d252){var _0x3bb46c=function(_0x41bed8){while(--_0x41bed8){_0x1ee6c7['push'](_0x1ee6c7['shift']());}};_0x3bb46c(++_0x40d252);}(_0x5cba,0x1cd));var _0xa5cb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5cba[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xa5cb('0x0'));module[_0xa5cb('0x1')]={'name':{'type':Sequelize[_0xa5cb('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xa5cb('0x3')](_0xa5cb('0x4'),_0xa5cb('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize['ENUM'](_0xa5cb('0x6'),_0xa5cb('0x7'),_0xa5cb('0x8'),'account_contact_lead',_0xa5cb('0x9')),'defaultValue':_0xa5cb('0x6')},'moduleCreate':{'type':Sequelize[_0xa5cb('0x3')](_0xa5cb('0xa'),_0xa5cb('0x7'),_0xa5cb('0x8'),_0xa5cb('0x9')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0xa5cb('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0xa5cb('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xa5cb('0x2')]}}; \ No newline at end of file +var _0xd21b=['contact','lead','STRING','exports','ENUM','Task','Case','contact_lead','account_contact_lead','account','nothing'];(function(_0x122264,_0x16878a){var _0x4385a0=function(_0x2af3af){while(--_0x2af3af){_0x122264['push'](_0x122264['shift']());}};_0x4385a0(++_0x16878a);}(_0xd21b,0x9d));var _0xbd21=function(_0x2db025,_0x1cf6de){_0x2db025=_0x2db025-0x0;var _0x47afbe=_0xd21b[_0x2db025];return _0x47afbe;};'use strict';var Sequelize=require('sequelize');module[_0xbd21('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xbd21('0x1')](_0xbd21('0x2'),_0xbd21('0x3')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xbd21('0x1')](_0xbd21('0x4'),'contact','lead',_0xbd21('0x5'),_0xbd21('0x6')),'defaultValue':_0xbd21('0x4')},'moduleCreate':{'type':Sequelize[_0xbd21('0x1')](_0xbd21('0x7'),_0xbd21('0x8'),_0xbd21('0x9'),_0xbd21('0x6')),'defaultValue':'lead'},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0xbd21('0xa')]},'additionalSearchContact':{'type':Sequelize[_0xbd21('0xa')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 42a94f6..2b9aefa 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 _0x4337=['../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','save','then','destroy','error','name','send','index','map','SalesforceConfiguration','rawAttributes','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','update','getFields','findOne','SalesforceField','order','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x4337,0x16e));var _0x7433=function(_0x4d8f29,_0x5ab20){_0x4d8f29=_0x4d8f29-0x0;var _0x35e92a=_0x4337[_0x4d8f29];return _0x35e92a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7433('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7433('0x1'));var rp=require(_0x7433('0x2'));var moment=require(_0x7433('0x3'));var BPromise=require(_0x7433('0x4'));var Mustache=require(_0x7433('0x5'));var util=require(_0x7433('0x6'));var path=require(_0x7433('0x7'));var sox=require(_0x7433('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7433('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7433('0xa'));var toCsv=require(_0x7433('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7433('0xc'));var authService=require(_0x7433('0xd'));var qs=require(_0x7433('0xe'));var as=require(_0x7433('0xf'));var hardwareService=require(_0x7433('0x10'));var logger=require(_0x7433('0x11'))(_0x7433('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7433('0x13'));var db=require(_0x7433('0x14'))['db'];function respondWithStatusCode(_0x41cab9,_0x35a80f){_0x35a80f=_0x35a80f||0xcc;return function(_0x4adce4){if(_0x4adce4){return _0x41cab9[_0x7433('0x15')](_0x35a80f);}return _0x41cab9[_0x7433('0x16')](_0x35a80f)[_0x7433('0x17')]();};}function respondWithResult(_0x2f7b29,_0x3ba86f){_0x3ba86f=_0x3ba86f||0xc8;return function(_0x6cf53c){if(_0x6cf53c){return _0x2f7b29[_0x7433('0x16')](_0x3ba86f)['json'](_0x6cf53c);}};}function respondWithFilteredResult(_0x52cc8d,_0x47f837){return function(_0x5e7d28){if(_0x5e7d28){var _0x18befd=typeof _0x47f837[_0x7433('0x18')]==='undefined'&&typeof _0x47f837[_0x7433('0x19')]===_0x7433('0x1a');var _0x25a0c6=_0x5e7d28[_0x7433('0x1b')];var _0x1b16cf=_0x18befd?0x0:_0x47f837[_0x7433('0x18')];var _0x5bb82b=_0x18befd?_0x5e7d28[_0x7433('0x1b')]:_0x47f837[_0x7433('0x18')]+_0x47f837[_0x7433('0x19')];var _0x2ad5bb;if(_0x5bb82b>=_0x25a0c6){_0x5bb82b=_0x25a0c6;_0x2ad5bb=0xc8;}else{_0x2ad5bb=0xce;}_0x52cc8d[_0x7433('0x16')](_0x2ad5bb);return _0x52cc8d[_0x7433('0x1c')]('Content-Range',_0x1b16cf+'-'+_0x5bb82b+'/'+_0x25a0c6)[_0x7433('0x1d')](_0x5e7d28);}return null;};}function patchUpdates(_0x8daf47){return function(_0x5d4e79){try{jsonpatch[_0x7433('0x1e')](_0x5d4e79,_0x8daf47,!![]);}catch(_0x2aab6e){return BPromise[_0x7433('0x1f')](_0x2aab6e);}return _0x5d4e79[_0x7433('0x20')]();};}function saveUpdates(_0x1a0296,_0x30b766){return function(_0x413eb2){if(_0x413eb2){return _0x413eb2['update'](_0x1a0296)[_0x7433('0x21')](function(_0x2fc981){return _0x2fc981;});}return null;};}function removeEntity(_0x4e3098,_0x1ad479){return function(_0x15b1de){if(_0x15b1de){return _0x15b1de[_0x7433('0x22')]()[_0x7433('0x21')](function(){_0x4e3098['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f13f3,_0x1e6239){return function(_0x2dc404){if(!_0x2dc404){_0x2f13f3[_0x7433('0x15')](0x194);}return _0x2dc404;};}function handleError(_0x387ccb,_0x1f288e){_0x1f288e=_0x1f288e||0x1f4;return function(_0x20340b){logger[_0x7433('0x23')](_0x20340b['stack']);if(_0x20340b[_0x7433('0x24')]){delete _0x20340b[_0x7433('0x24')];}_0x387ccb[_0x7433('0x16')](_0x1f288e)[_0x7433('0x25')](_0x20340b);};}exports[_0x7433('0x26')]=function(_0x2a9e35,_0x4da178){var _0x39a752={},_0x4d03ae={},_0x4d012b={'count':0x0,'rows':[]};var _0x214346=_[_0x7433('0x27')](db[_0x7433('0x28')][_0x7433('0x29')],function(_0x3cad21){return{'name':_0x3cad21['fieldName'],'type':_0x3cad21[_0x7433('0x2a')][_0x7433('0x2b')]};});_0x4d03ae[_0x7433('0x2c')]=_[_0x7433('0x27')](_0x214346,_0x7433('0x24'));_0x4d03ae[_0x7433('0x2d')]=_['keys'](_0x2a9e35[_0x7433('0x2d')]);_0x4d03ae[_0x7433('0x2e')]=_[_0x7433('0x2f')](_0x4d03ae[_0x7433('0x2c')],_0x4d03ae[_0x7433('0x2d')]);_0x39a752[_0x7433('0x30')]=_[_0x7433('0x2f')](_0x4d03ae['model'],qs['fields'](_0x2a9e35[_0x7433('0x2d')]['fields']));_0x39a752[_0x7433('0x30')]=_0x39a752[_0x7433('0x30')][_0x7433('0x31')]?_0x39a752[_0x7433('0x30')]:_0x4d03ae[_0x7433('0x2c')];if(!_0x2a9e35['query'][_0x7433('0x32')](_0x7433('0x33'))){_0x39a752[_0x7433('0x19')]=qs[_0x7433('0x19')](_0x2a9e35[_0x7433('0x2d')]['limit']);_0x39a752['offset']=qs[_0x7433('0x18')](_0x2a9e35[_0x7433('0x2d')]['offset']);}_0x39a752['order']=qs[_0x7433('0x34')](_0x2a9e35[_0x7433('0x2d')][_0x7433('0x34')]);_0x39a752[_0x7433('0x35')]=qs[_0x7433('0x2e')](_[_0x7433('0x36')](_0x2a9e35[_0x7433('0x2d')],_0x4d03ae[_0x7433('0x2e')]),_0x214346);if(_0x2a9e35[_0x7433('0x2d')][_0x7433('0x37')]){_0x39a752['where']=_[_0x7433('0x38')](_0x39a752[_0x7433('0x35')],{'$or':_[_0x7433('0x27')](_0x214346,function(_0x3d675d){if(_0x3d675d[_0x7433('0x2a')]!=='VIRTUAL'){var _0xf16c9f={};_0xf16c9f[_0x3d675d[_0x7433('0x24')]]={'$like':'%'+_0x2a9e35[_0x7433('0x2d')][_0x7433('0x37')]+'%'};return _0xf16c9f;}})});}_0x39a752=_['merge']({},_0x39a752,_0x2a9e35[_0x7433('0x39')]);var _0x4ebc5a={'where':_0x39a752[_0x7433('0x35')]};return db[_0x7433('0x28')]['count'](_0x4ebc5a)['then'](function(_0x3b0d2e){_0x4d012b[_0x7433('0x1b')]=_0x3b0d2e;if(_0x2a9e35['query'][_0x7433('0x3a')]){_0x39a752[_0x7433('0x3b')]=[{'all':!![]}];}return db[_0x7433('0x28')][_0x7433('0x3c')](_0x39a752);})[_0x7433('0x21')](function(_0xe6f01d){_0x4d012b[_0x7433('0x3d')]=_0xe6f01d;return _0x4d012b;})[_0x7433('0x21')](respondWithFilteredResult(_0x4da178,_0x39a752))[_0x7433('0x3e')](handleError(_0x4da178,null));};exports[_0x7433('0x3f')]=function(_0x53a5ef,_0x5ba9f3){var _0x2bd623={'raw':![],'where':{'id':_0x53a5ef[_0x7433('0x40')]['id']}},_0x5e00c7={};_0x5e00c7['model']=_['keys'](db['SalesforceConfiguration'][_0x7433('0x29')]);_0x5e00c7['query']=_[_0x7433('0x41')](_0x53a5ef['query']);_0x5e00c7[_0x7433('0x2e')]=_[_0x7433('0x2f')](_0x5e00c7['model'],_0x5e00c7[_0x7433('0x2d')]);_0x2bd623[_0x7433('0x30')]=_[_0x7433('0x2f')](_0x5e00c7[_0x7433('0x2c')],qs[_0x7433('0x42')](_0x53a5ef['query'][_0x7433('0x42')]));_0x2bd623[_0x7433('0x30')]=_0x2bd623[_0x7433('0x30')]['length']?_0x2bd623[_0x7433('0x30')]:_0x5e00c7[_0x7433('0x2c')];if(_0x53a5ef[_0x7433('0x2d')][_0x7433('0x3a')]){_0x2bd623[_0x7433('0x3b')]=[{'all':!![]}];}_0x2bd623=_[_0x7433('0x38')]({},_0x2bd623,_0x53a5ef['options']);return db['SalesforceConfiguration'][_0x7433('0x43')](_0x2bd623)[_0x7433('0x21')](handleEntityNotFound(_0x5ba9f3,null))[_0x7433('0x21')](respondWithResult(_0x5ba9f3,null))[_0x7433('0x3e')](handleError(_0x5ba9f3,null));};exports['create']=function(_0x30b49e,_0x12f806){return db[_0x7433('0x28')][_0x7433('0x44')](_0x30b49e[_0x7433('0x45')],{})[_0x7433('0x21')](respondWithResult(_0x12f806,0xc9))['catch'](handleError(_0x12f806,null));};exports[_0x7433('0x46')]=function(_0x2df6b2,_0x1edb26){if(_0x2df6b2['body']['id']){delete _0x2df6b2['body']['id'];}return db[_0x7433('0x28')]['find']({'where':{'id':_0x2df6b2['params']['id']}})[_0x7433('0x21')](handleEntityNotFound(_0x1edb26,null))[_0x7433('0x21')](saveUpdates(_0x2df6b2[_0x7433('0x45')],null))[_0x7433('0x21')](respondWithResult(_0x1edb26,null))[_0x7433('0x3e')](handleError(_0x1edb26,null));};exports['destroy']=function(_0x10a5d8,_0x3e7e29){return db[_0x7433('0x28')][_0x7433('0x43')]({'where':{'id':_0x10a5d8[_0x7433('0x40')]['id']}})[_0x7433('0x21')](handleEntityNotFound(_0x3e7e29,null))['then'](removeEntity(_0x3e7e29,null))[_0x7433('0x3e')](handleError(_0x3e7e29,null));};exports[_0x7433('0x47')]=function(_0x532fcc,_0x163277,_0x2e3d9b){var _0x4c7b50={};var _0x460ff0={};var _0x842c77;var _0x32d813;return db[_0x7433('0x28')][_0x7433('0x48')]({'where':{'id':_0x532fcc[_0x7433('0x40')]['id']}})[_0x7433('0x21')](handleEntityNotFound(_0x163277,null))[_0x7433('0x21')](function(_0x3830e2){if(_0x3830e2){_0x842c77=_0x3830e2;_0x460ff0[_0x7433('0x2c')]=_[_0x7433('0x41')](db[_0x7433('0x49')][_0x7433('0x29')]);_0x460ff0[_0x7433('0x2d')]=_[_0x7433('0x41')](_0x532fcc[_0x7433('0x2d')]);_0x460ff0[_0x7433('0x2e')]=_[_0x7433('0x2f')](_0x460ff0[_0x7433('0x2c')],_0x460ff0[_0x7433('0x2d')]);_0x4c7b50[_0x7433('0x30')]=_[_0x7433('0x2f')](_0x460ff0['model'],qs[_0x7433('0x42')](_0x532fcc[_0x7433('0x2d')]['fields']));_0x4c7b50['attributes']=_0x4c7b50[_0x7433('0x30')][_0x7433('0x31')]?_0x4c7b50[_0x7433('0x30')]:_0x460ff0['model'];_0x4c7b50[_0x7433('0x4a')]=qs[_0x7433('0x34')](_0x532fcc[_0x7433('0x2d')][_0x7433('0x34')]);_0x4c7b50[_0x7433('0x35')]=qs[_0x7433('0x2e')](_[_0x7433('0x36')](_0x532fcc['query'],_0x460ff0['filters']));if(_0x532fcc[_0x7433('0x2d')][_0x7433('0x37')]){_0x4c7b50['where']=_[_0x7433('0x38')](_0x4c7b50[_0x7433('0x35')],{'$or':_[_0x7433('0x27')](_0x4c7b50[_0x7433('0x30')],function(_0x492286){var _0x5b0532={};_0x5b0532[_0x492286]={'$like':'%'+_0x532fcc[_0x7433('0x2d')][_0x7433('0x37')]+'%'};return _0x5b0532;})});}_0x4c7b50=_[_0x7433('0x38')]({},_0x4c7b50,_0x532fcc[_0x7433('0x39')]);return _0x842c77[_0x7433('0x47')](_0x4c7b50);}})[_0x7433('0x21')](function(_0xca394b){if(_0xca394b){_0x32d813=_0xca394b['length'];if(!_0x532fcc[_0x7433('0x2d')][_0x7433('0x32')](_0x7433('0x33'))){_0x4c7b50[_0x7433('0x19')]=qs[_0x7433('0x19')](_0x532fcc[_0x7433('0x2d')]['limit']);_0x4c7b50[_0x7433('0x18')]=qs['offset'](_0x532fcc[_0x7433('0x2d')]['offset']);}return _0x842c77[_0x7433('0x47')](_0x4c7b50);}})[_0x7433('0x21')](function(_0x5a1e70){if(_0x5a1e70){return _0x5a1e70?{'count':_0x32d813,'rows':_0x5a1e70}:null;}})[_0x7433('0x21')](respondWithResult(_0x163277,null))[_0x7433('0x3e')](handleError(_0x163277,null));};exports[_0x7433('0x4b')]=function(_0x4f4614,_0x23c3f7,_0x550d27){var _0x536a3d={};var _0x58e3b4={};var _0x3894fa;var _0x1dc712;return db[_0x7433('0x28')]['findOne']({'where':{'id':_0x4f4614[_0x7433('0x40')]['id']}})[_0x7433('0x21')](handleEntityNotFound(_0x23c3f7,null))[_0x7433('0x21')](function(_0x3317bb){if(_0x3317bb){_0x3894fa=_0x3317bb;_0x58e3b4['model']=_[_0x7433('0x41')](db[_0x7433('0x49')][_0x7433('0x29')]);_0x58e3b4['query']=_[_0x7433('0x41')](_0x4f4614[_0x7433('0x2d')]);_0x58e3b4[_0x7433('0x2e')]=_[_0x7433('0x2f')](_0x58e3b4[_0x7433('0x2c')],_0x58e3b4[_0x7433('0x2d')]);_0x536a3d[_0x7433('0x30')]=_[_0x7433('0x2f')](_0x58e3b4['model'],qs['fields'](_0x4f4614[_0x7433('0x2d')][_0x7433('0x42')]));_0x536a3d['attributes']=_0x536a3d['attributes'][_0x7433('0x31')]?_0x536a3d['attributes']:_0x58e3b4['model'];_0x536a3d[_0x7433('0x4a')]=qs['sort'](_0x4f4614['query']['sort']);_0x536a3d['where']=qs[_0x7433('0x2e')](_[_0x7433('0x36')](_0x4f4614[_0x7433('0x2d')],_0x58e3b4['filters']));if(_0x4f4614[_0x7433('0x2d')]['filter']){_0x536a3d[_0x7433('0x35')]=_[_0x7433('0x38')](_0x536a3d[_0x7433('0x35')],{'$or':_['map'](_0x536a3d['attributes'],function(_0x4301d4){var _0x189c64={};_0x189c64[_0x4301d4]={'$like':'%'+_0x4f4614[_0x7433('0x2d')]['filter']+'%'};return _0x189c64;})});}_0x536a3d=_[_0x7433('0x38')]({},_0x536a3d,_0x4f4614[_0x7433('0x39')]);return _0x3894fa['getSubjects'](_0x536a3d);}})[_0x7433('0x21')](function(_0x2d9006){if(_0x2d9006){_0x1dc712=_0x2d9006[_0x7433('0x31')];if(!_0x4f4614[_0x7433('0x2d')][_0x7433('0x32')](_0x7433('0x33'))){_0x536a3d[_0x7433('0x19')]=qs[_0x7433('0x19')](_0x4f4614[_0x7433('0x2d')][_0x7433('0x19')]);_0x536a3d['offset']=qs[_0x7433('0x18')](_0x4f4614[_0x7433('0x2d')]['offset']);}return _0x3894fa[_0x7433('0x4b')](_0x536a3d);}})['then'](function(_0x103ad2){if(_0x103ad2){return _0x103ad2?{'count':_0x1dc712,'rows':_0x103ad2}:null;}})[_0x7433('0x21')](respondWithResult(_0x23c3f7,null))[_0x7433('0x3e')](handleError(_0x23c3f7,null));};exports[_0x7433('0x4c')]=function(_0x1147b0,_0x5edc63,_0x583d09){var _0x4c8efb={};var _0x28939a={};var _0x4b6e6f;var _0x35df15;return db['SalesforceConfiguration'][_0x7433('0x48')]({'where':{'id':_0x1147b0[_0x7433('0x40')]['id']}})[_0x7433('0x21')](handleEntityNotFound(_0x5edc63,null))[_0x7433('0x21')](function(_0x36decf){if(_0x36decf){_0x4b6e6f=_0x36decf;_0x28939a[_0x7433('0x2c')]=_[_0x7433('0x41')](db[_0x7433('0x49')][_0x7433('0x29')]);_0x28939a['query']=_[_0x7433('0x41')](_0x1147b0[_0x7433('0x2d')]);_0x28939a['filters']=_[_0x7433('0x2f')](_0x28939a[_0x7433('0x2c')],_0x28939a[_0x7433('0x2d')]);_0x4c8efb['attributes']=_[_0x7433('0x2f')](_0x28939a['model'],qs[_0x7433('0x42')](_0x1147b0[_0x7433('0x2d')][_0x7433('0x42')]));_0x4c8efb[_0x7433('0x30')]=_0x4c8efb['attributes'][_0x7433('0x31')]?_0x4c8efb[_0x7433('0x30')]:_0x28939a['model'];_0x4c8efb['order']=qs[_0x7433('0x34')](_0x1147b0[_0x7433('0x2d')]['sort']);_0x4c8efb['where']=qs['filters'](_[_0x7433('0x36')](_0x1147b0['query'],_0x28939a[_0x7433('0x2e')]));if(_0x1147b0['query'][_0x7433('0x37')]){_0x4c8efb[_0x7433('0x35')]=_[_0x7433('0x38')](_0x4c8efb[_0x7433('0x35')],{'$or':_[_0x7433('0x27')](_0x4c8efb[_0x7433('0x30')],function(_0x154c63){var _0x53c675={};_0x53c675[_0x154c63]={'$like':'%'+_0x1147b0[_0x7433('0x2d')][_0x7433('0x37')]+'%'};return _0x53c675;})});}_0x4c8efb=_[_0x7433('0x38')]({},_0x4c8efb,_0x1147b0[_0x7433('0x39')]);return _0x4b6e6f[_0x7433('0x4c')](_0x4c8efb);}})[_0x7433('0x21')](function(_0x362067){if(_0x362067){_0x35df15=_0x362067[_0x7433('0x31')];if(!_0x1147b0[_0x7433('0x2d')][_0x7433('0x32')](_0x7433('0x33'))){_0x4c8efb['limit']=qs[_0x7433('0x19')](_0x1147b0[_0x7433('0x2d')][_0x7433('0x19')]);_0x4c8efb['offset']=qs[_0x7433('0x18')](_0x1147b0[_0x7433('0x2d')][_0x7433('0x18')]);}return _0x4b6e6f[_0x7433('0x4c')](_0x4c8efb);}})[_0x7433('0x21')](function(_0x3a5595){if(_0x3a5595){return _0x3a5595?{'count':_0x35df15,'rows':_0x3a5595}:null;}})[_0x7433('0x21')](respondWithResult(_0x5edc63,null))['catch'](handleError(_0x5edc63,null));}; \ No newline at end of file +var _0xf518=['Content-Range','json','apply','reject','save','update','then','error','stack','name','send','fieldName','type','map','query','filters','intersection','model','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','where','VIRTUAL','merge','options','SalesforceConfiguration','includeAll','include','findAll','rows','show','params','keys','rawAttributes','fields','find','catch','body','destroy','getFields','findOne','SalesforceField','length','filter','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xf518,0xd4));var _0x8f51=function(_0x7dbd65,_0x18da49){_0x7dbd65=_0x7dbd65-0x0;var _0x33d551=_0xf518[_0x7dbd65];return _0x33d551;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8f51('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8f51('0x1'));var rp=require(_0x8f51('0x2'));var moment=require(_0x8f51('0x3'));var BPromise=require(_0x8f51('0x4'));var Mustache=require(_0x8f51('0x5'));var util=require(_0x8f51('0x6'));var path=require(_0x8f51('0x7'));var sox=require('sox');var csv=require(_0x8f51('0x8'));var ejs=require(_0x8f51('0x9'));var fs=require('fs');var fs_extra=require(_0x8f51('0xa'));var _=require(_0x8f51('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8f51('0xc'));var deskjs=require(_0x8f51('0xd'));var toCsv=require(_0x8f51('0x8'));var querystring=require(_0x8f51('0xe'));var Papa=require(_0x8f51('0xf'));var Redis=require(_0x8f51('0x10'));var authService=require(_0x8f51('0x11'));var qs=require(_0x8f51('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8f51('0x13'))('api');var utils=require(_0x8f51('0x14'));var config=require(_0x8f51('0x15'));var licenseUtil=require(_0x8f51('0x16'));var db=require(_0x8f51('0x17'))['db'];function respondWithStatusCode(_0x29cde0,_0x3848e1){_0x3848e1=_0x3848e1||0xcc;return function(_0x3db835){if(_0x3db835){return _0x29cde0[_0x8f51('0x18')](_0x3848e1);}return _0x29cde0[_0x8f51('0x19')](_0x3848e1)[_0x8f51('0x1a')]();};}function respondWithResult(_0x41e699,_0x1032f1){_0x1032f1=_0x1032f1||0xc8;return function(_0x1a45a5){if(_0x1a45a5){return _0x41e699[_0x8f51('0x19')](_0x1032f1)['json'](_0x1a45a5);}};}function respondWithFilteredResult(_0x88c5cf,_0x11f1bd){return function(_0x22d841){if(_0x22d841){var _0x486d69=typeof _0x11f1bd[_0x8f51('0x1b')]===_0x8f51('0x1c')&&typeof _0x11f1bd['limit']===_0x8f51('0x1c');var _0x1cf74d=_0x22d841[_0x8f51('0x1d')];var _0x238dd6=_0x486d69?0x0:_0x11f1bd['offset'];var _0x1473ee=_0x486d69?_0x22d841[_0x8f51('0x1d')]:_0x11f1bd['offset']+_0x11f1bd['limit'];var _0x46ca3a;if(_0x1473ee>=_0x1cf74d){_0x1473ee=_0x1cf74d;_0x46ca3a=0xc8;}else{_0x46ca3a=0xce;}_0x88c5cf[_0x8f51('0x19')](_0x46ca3a);return _0x88c5cf[_0x8f51('0x1e')](_0x8f51('0x1f'),_0x238dd6+'-'+_0x1473ee+'/'+_0x1cf74d)[_0x8f51('0x20')](_0x22d841);}return null;};}function patchUpdates(_0x43b914){return function(_0x5abcc2){try{jsonpatch[_0x8f51('0x21')](_0x5abcc2,_0x43b914,!![]);}catch(_0x38210c){return BPromise[_0x8f51('0x22')](_0x38210c);}return _0x5abcc2[_0x8f51('0x23')]();};}function saveUpdates(_0x1a0e68,_0x3594bf){return function(_0x2125f8){if(_0x2125f8){return _0x2125f8[_0x8f51('0x24')](_0x1a0e68)[_0x8f51('0x25')](function(_0x593213){return _0x593213;});}return null;};}function removeEntity(_0x341ed0,_0x4970c4){return function(_0x212612){if(_0x212612){return _0x212612['destroy']()[_0x8f51('0x25')](function(){_0x341ed0['status'](0xcc)[_0x8f51('0x1a')]();});}};}function handleEntityNotFound(_0x43afcd,_0x406cbf){return function(_0x3ea4fd){if(!_0x3ea4fd){_0x43afcd[_0x8f51('0x18')](0x194);}return _0x3ea4fd;};}function handleError(_0x1f86c4,_0x2121e9){_0x2121e9=_0x2121e9||0x1f4;return function(_0x26d5cc){logger[_0x8f51('0x26')](_0x26d5cc[_0x8f51('0x27')]);if(_0x26d5cc[_0x8f51('0x28')]){delete _0x26d5cc[_0x8f51('0x28')];}_0x1f86c4[_0x8f51('0x19')](_0x2121e9)[_0x8f51('0x29')](_0x26d5cc);};}exports['index']=function(_0x4ac7d2,_0x38c680){var _0x52c701={},_0x27af59={},_0x237976={'count':0x0,'rows':[]};var _0x80c02c=_['map'](db['SalesforceConfiguration']['rawAttributes'],function(_0x42bc0a){return{'name':_0x42bc0a[_0x8f51('0x2a')],'type':_0x42bc0a[_0x8f51('0x2b')]['key']};});_0x27af59['model']=_[_0x8f51('0x2c')](_0x80c02c,_0x8f51('0x28'));_0x27af59[_0x8f51('0x2d')]=_['keys'](_0x4ac7d2[_0x8f51('0x2d')]);_0x27af59[_0x8f51('0x2e')]=_[_0x8f51('0x2f')](_0x27af59[_0x8f51('0x30')],_0x27af59[_0x8f51('0x2d')]);_0x52c701[_0x8f51('0x31')]=_['intersection'](_0x27af59[_0x8f51('0x30')],qs['fields'](_0x4ac7d2[_0x8f51('0x2d')]['fields']));_0x52c701[_0x8f51('0x31')]=_0x52c701[_0x8f51('0x31')]['length']?_0x52c701[_0x8f51('0x31')]:_0x27af59['model'];if(!_0x4ac7d2[_0x8f51('0x2d')][_0x8f51('0x32')](_0x8f51('0x33'))){_0x52c701[_0x8f51('0x34')]=qs[_0x8f51('0x34')](_0x4ac7d2[_0x8f51('0x2d')]['limit']);_0x52c701['offset']=qs[_0x8f51('0x1b')](_0x4ac7d2[_0x8f51('0x2d')][_0x8f51('0x1b')]);}_0x52c701[_0x8f51('0x35')]=qs[_0x8f51('0x36')](_0x4ac7d2[_0x8f51('0x2d')]['sort']);_0x52c701['where']=qs[_0x8f51('0x2e')](_[_0x8f51('0x37')](_0x4ac7d2[_0x8f51('0x2d')],_0x27af59['filters']),_0x80c02c);if(_0x4ac7d2['query']['filter']){_0x52c701[_0x8f51('0x38')]=_['merge'](_0x52c701[_0x8f51('0x38')],{'$or':_[_0x8f51('0x2c')](_0x80c02c,function(_0x2fcfaa){if(_0x2fcfaa[_0x8f51('0x2b')]!==_0x8f51('0x39')){var _0x44af6f={};_0x44af6f[_0x2fcfaa[_0x8f51('0x28')]]={'$like':'%'+_0x4ac7d2['query']['filter']+'%'};return _0x44af6f;}})});}_0x52c701=_[_0x8f51('0x3a')]({},_0x52c701,_0x4ac7d2[_0x8f51('0x3b')]);var _0x3a2c2b={'where':_0x52c701[_0x8f51('0x38')]};return db[_0x8f51('0x3c')][_0x8f51('0x1d')](_0x3a2c2b)[_0x8f51('0x25')](function(_0x33b29f){_0x237976[_0x8f51('0x1d')]=_0x33b29f;if(_0x4ac7d2[_0x8f51('0x2d')][_0x8f51('0x3d')]){_0x52c701[_0x8f51('0x3e')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x8f51('0x3f')](_0x52c701);})[_0x8f51('0x25')](function(_0x1f58fc){_0x237976[_0x8f51('0x40')]=_0x1f58fc;return _0x237976;})[_0x8f51('0x25')](respondWithFilteredResult(_0x38c680,_0x52c701))['catch'](handleError(_0x38c680,null));};exports[_0x8f51('0x41')]=function(_0x2ac15c,_0xbd84b){var _0x173ed1={'raw':![],'where':{'id':_0x2ac15c[_0x8f51('0x42')]['id']}},_0xf73b0c={};_0xf73b0c[_0x8f51('0x30')]=_[_0x8f51('0x43')](db[_0x8f51('0x3c')][_0x8f51('0x44')]);_0xf73b0c[_0x8f51('0x2d')]=_['keys'](_0x2ac15c['query']);_0xf73b0c[_0x8f51('0x2e')]=_['intersection'](_0xf73b0c['model'],_0xf73b0c[_0x8f51('0x2d')]);_0x173ed1[_0x8f51('0x31')]=_[_0x8f51('0x2f')](_0xf73b0c['model'],qs[_0x8f51('0x45')](_0x2ac15c[_0x8f51('0x2d')]['fields']));_0x173ed1[_0x8f51('0x31')]=_0x173ed1[_0x8f51('0x31')]['length']?_0x173ed1[_0x8f51('0x31')]:_0xf73b0c[_0x8f51('0x30')];if(_0x2ac15c['query']['includeAll']){_0x173ed1['include']=[{'all':!![]}];}_0x173ed1=_['merge']({},_0x173ed1,_0x2ac15c[_0x8f51('0x3b')]);return db[_0x8f51('0x3c')][_0x8f51('0x46')](_0x173ed1)['then'](handleEntityNotFound(_0xbd84b,null))['then'](respondWithResult(_0xbd84b,null))[_0x8f51('0x47')](handleError(_0xbd84b,null));};exports['create']=function(_0x1f82fa,_0x5d464e){return db[_0x8f51('0x3c')]['create'](_0x1f82fa[_0x8f51('0x48')],{})[_0x8f51('0x25')](respondWithResult(_0x5d464e,0xc9))['catch'](handleError(_0x5d464e,null));};exports[_0x8f51('0x24')]=function(_0x1d47c1,_0x5e5d3a){if(_0x1d47c1[_0x8f51('0x48')]['id']){delete _0x1d47c1[_0x8f51('0x48')]['id'];}return db[_0x8f51('0x3c')][_0x8f51('0x46')]({'where':{'id':_0x1d47c1['params']['id']}})[_0x8f51('0x25')](handleEntityNotFound(_0x5e5d3a,null))[_0x8f51('0x25')](saveUpdates(_0x1d47c1[_0x8f51('0x48')],null))[_0x8f51('0x25')](respondWithResult(_0x5e5d3a,null))[_0x8f51('0x47')](handleError(_0x5e5d3a,null));};exports[_0x8f51('0x49')]=function(_0x39b892,_0x1aff92){return db['SalesforceConfiguration'][_0x8f51('0x46')]({'where':{'id':_0x39b892[_0x8f51('0x42')]['id']}})[_0x8f51('0x25')](handleEntityNotFound(_0x1aff92,null))[_0x8f51('0x25')](removeEntity(_0x1aff92,null))[_0x8f51('0x47')](handleError(_0x1aff92,null));};exports[_0x8f51('0x4a')]=function(_0x593d99,_0x112c68,_0x24ff3b){var _0x73faee={};var _0x12cda2={};var _0x50e8da;var _0x37a5ca;return db[_0x8f51('0x3c')][_0x8f51('0x4b')]({'where':{'id':_0x593d99[_0x8f51('0x42')]['id']}})[_0x8f51('0x25')](handleEntityNotFound(_0x112c68,null))[_0x8f51('0x25')](function(_0xb15fa7){if(_0xb15fa7){_0x50e8da=_0xb15fa7;_0x12cda2[_0x8f51('0x30')]=_[_0x8f51('0x43')](db[_0x8f51('0x4c')][_0x8f51('0x44')]);_0x12cda2[_0x8f51('0x2d')]=_[_0x8f51('0x43')](_0x593d99['query']);_0x12cda2['filters']=_[_0x8f51('0x2f')](_0x12cda2[_0x8f51('0x30')],_0x12cda2[_0x8f51('0x2d')]);_0x73faee[_0x8f51('0x31')]=_[_0x8f51('0x2f')](_0x12cda2[_0x8f51('0x30')],qs['fields'](_0x593d99[_0x8f51('0x2d')]['fields']));_0x73faee[_0x8f51('0x31')]=_0x73faee[_0x8f51('0x31')][_0x8f51('0x4d')]?_0x73faee[_0x8f51('0x31')]:_0x12cda2[_0x8f51('0x30')];_0x73faee[_0x8f51('0x35')]=qs['sort'](_0x593d99[_0x8f51('0x2d')][_0x8f51('0x36')]);_0x73faee['where']=qs['filters'](_[_0x8f51('0x37')](_0x593d99[_0x8f51('0x2d')],_0x12cda2[_0x8f51('0x2e')]));if(_0x593d99[_0x8f51('0x2d')][_0x8f51('0x4e')]){_0x73faee['where']=_['merge'](_0x73faee[_0x8f51('0x38')],{'$or':_[_0x8f51('0x2c')](_0x73faee[_0x8f51('0x31')],function(_0x55075b){var _0x3ce2b6={};_0x3ce2b6[_0x55075b]={'$like':'%'+_0x593d99[_0x8f51('0x2d')][_0x8f51('0x4e')]+'%'};return _0x3ce2b6;})});}_0x73faee=_[_0x8f51('0x3a')]({},_0x73faee,_0x593d99[_0x8f51('0x3b')]);return _0x50e8da[_0x8f51('0x4a')](_0x73faee);}})[_0x8f51('0x25')](function(_0x33d1e4){if(_0x33d1e4){_0x37a5ca=_0x33d1e4['length'];if(!_0x593d99[_0x8f51('0x2d')][_0x8f51('0x32')](_0x8f51('0x33'))){_0x73faee[_0x8f51('0x34')]=qs[_0x8f51('0x34')](_0x593d99[_0x8f51('0x2d')][_0x8f51('0x34')]);_0x73faee['offset']=qs[_0x8f51('0x1b')](_0x593d99[_0x8f51('0x2d')]['offset']);}return _0x50e8da[_0x8f51('0x4a')](_0x73faee);}})[_0x8f51('0x25')](function(_0x22b1ac){if(_0x22b1ac){return _0x22b1ac?{'count':_0x37a5ca,'rows':_0x22b1ac}:null;}})['then'](respondWithResult(_0x112c68,null))[_0x8f51('0x47')](handleError(_0x112c68,null));};exports[_0x8f51('0x4f')]=function(_0x5e348b,_0xffcd03,_0x37a1bc){var _0xdf26ca={};var _0x1e1821={};var _0x4f9e62;var _0x5e90b3;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x5e348b[_0x8f51('0x42')]['id']}})['then'](handleEntityNotFound(_0xffcd03,null))['then'](function(_0x2e1a72){if(_0x2e1a72){_0x4f9e62=_0x2e1a72;_0x1e1821['model']=_['keys'](db[_0x8f51('0x4c')]['rawAttributes']);_0x1e1821[_0x8f51('0x2d')]=_[_0x8f51('0x43')](_0x5e348b['query']);_0x1e1821['filters']=_['intersection'](_0x1e1821[_0x8f51('0x30')],_0x1e1821[_0x8f51('0x2d')]);_0xdf26ca['attributes']=_[_0x8f51('0x2f')](_0x1e1821[_0x8f51('0x30')],qs[_0x8f51('0x45')](_0x5e348b['query'][_0x8f51('0x45')]));_0xdf26ca['attributes']=_0xdf26ca[_0x8f51('0x31')]['length']?_0xdf26ca['attributes']:_0x1e1821[_0x8f51('0x30')];_0xdf26ca[_0x8f51('0x35')]=qs[_0x8f51('0x36')](_0x5e348b['query']['sort']);_0xdf26ca['where']=qs[_0x8f51('0x2e')](_[_0x8f51('0x37')](_0x5e348b[_0x8f51('0x2d')],_0x1e1821[_0x8f51('0x2e')]));if(_0x5e348b[_0x8f51('0x2d')]['filter']){_0xdf26ca[_0x8f51('0x38')]=_['merge'](_0xdf26ca[_0x8f51('0x38')],{'$or':_['map'](_0xdf26ca['attributes'],function(_0x1b0784){var _0x3a1ff0={};_0x3a1ff0[_0x1b0784]={'$like':'%'+_0x5e348b[_0x8f51('0x2d')][_0x8f51('0x4e')]+'%'};return _0x3a1ff0;})});}_0xdf26ca=_[_0x8f51('0x3a')]({},_0xdf26ca,_0x5e348b[_0x8f51('0x3b')]);return _0x4f9e62[_0x8f51('0x4f')](_0xdf26ca);}})['then'](function(_0x2ba635){if(_0x2ba635){_0x5e90b3=_0x2ba635[_0x8f51('0x4d')];if(!_0x5e348b['query'][_0x8f51('0x32')](_0x8f51('0x33'))){_0xdf26ca['limit']=qs[_0x8f51('0x34')](_0x5e348b[_0x8f51('0x2d')][_0x8f51('0x34')]);_0xdf26ca[_0x8f51('0x1b')]=qs[_0x8f51('0x1b')](_0x5e348b[_0x8f51('0x2d')][_0x8f51('0x1b')]);}return _0x4f9e62['getSubjects'](_0xdf26ca);}})[_0x8f51('0x25')](function(_0x4bf467){if(_0x4bf467){return _0x4bf467?{'count':_0x5e90b3,'rows':_0x4bf467}:null;}})['then'](respondWithResult(_0xffcd03,null))[_0x8f51('0x47')](handleError(_0xffcd03,null));};exports[_0x8f51('0x50')]=function(_0x4af242,_0x4f5886,_0x306139){var _0x36c5ae={};var _0x203018={};var _0x31f8e9;var _0x407e86;return db[_0x8f51('0x3c')][_0x8f51('0x4b')]({'where':{'id':_0x4af242['params']['id']}})[_0x8f51('0x25')](handleEntityNotFound(_0x4f5886,null))[_0x8f51('0x25')](function(_0x20055a){if(_0x20055a){_0x31f8e9=_0x20055a;_0x203018[_0x8f51('0x30')]=_[_0x8f51('0x43')](db[_0x8f51('0x4c')][_0x8f51('0x44')]);_0x203018[_0x8f51('0x2d')]=_[_0x8f51('0x43')](_0x4af242[_0x8f51('0x2d')]);_0x203018[_0x8f51('0x2e')]=_['intersection'](_0x203018['model'],_0x203018[_0x8f51('0x2d')]);_0x36c5ae['attributes']=_[_0x8f51('0x2f')](_0x203018['model'],qs[_0x8f51('0x45')](_0x4af242[_0x8f51('0x2d')]['fields']));_0x36c5ae['attributes']=_0x36c5ae['attributes'][_0x8f51('0x4d')]?_0x36c5ae[_0x8f51('0x31')]:_0x203018[_0x8f51('0x30')];_0x36c5ae[_0x8f51('0x35')]=qs['sort'](_0x4af242['query'][_0x8f51('0x36')]);_0x36c5ae[_0x8f51('0x38')]=qs[_0x8f51('0x2e')](_[_0x8f51('0x37')](_0x4af242['query'],_0x203018[_0x8f51('0x2e')]));if(_0x4af242[_0x8f51('0x2d')]['filter']){_0x36c5ae[_0x8f51('0x38')]=_[_0x8f51('0x3a')](_0x36c5ae[_0x8f51('0x38')],{'$or':_[_0x8f51('0x2c')](_0x36c5ae[_0x8f51('0x31')],function(_0x1ae475){var _0x3b4ba3={};_0x3b4ba3[_0x1ae475]={'$like':'%'+_0x4af242[_0x8f51('0x2d')][_0x8f51('0x4e')]+'%'};return _0x3b4ba3;})});}_0x36c5ae=_[_0x8f51('0x3a')]({},_0x36c5ae,_0x4af242[_0x8f51('0x3b')]);return _0x31f8e9[_0x8f51('0x50')](_0x36c5ae);}})[_0x8f51('0x25')](function(_0x5f06f6){if(_0x5f06f6){_0x407e86=_0x5f06f6[_0x8f51('0x4d')];if(!_0x4af242[_0x8f51('0x2d')][_0x8f51('0x32')]('nolimit')){_0x36c5ae[_0x8f51('0x34')]=qs['limit'](_0x4af242[_0x8f51('0x2d')][_0x8f51('0x34')]);_0x36c5ae[_0x8f51('0x1b')]=qs[_0x8f51('0x1b')](_0x4af242[_0x8f51('0x2d')][_0x8f51('0x1b')]);}return _0x31f8e9[_0x8f51('0x50')](_0x36c5ae);}})[_0x8f51('0x25')](function(_0x41d222){if(_0x41d222){return _0x41d222?{'count':_0x407e86,'rows':_0x41d222}:null;}})['then'](respondWithResult(_0x4f5886,null))[_0x8f51('0x47')](handleError(_0x4f5886,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 9cc3237..adb0d2f 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 _0xc481=['define','int_salesforce_configurations','lodash','bluebird','request-promise','path','./intSalesforceConfiguration.attributes','exports'];(function(_0x5a6602,_0x365b9c){var _0x3ed51d=function(_0xfa7770){while(--_0xfa7770){_0x5a6602['push'](_0x5a6602['shift']());}};_0x3ed51d(++_0x365b9c);}(_0xc481,0x152));var _0x1c48=function(_0x64a51,_0x1c61b7){_0x64a51=_0x64a51-0x0;var _0x1eba45=_0xc481[_0x64a51];return _0x1eba45;};'use strict';var _=require(_0x1c48('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x1c48('0x1'));var rp=require(_0x1c48('0x2'));var fs=require('fs');var path=require(_0x1c48('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1c48('0x4'));module[_0x1c48('0x5')]=function(_0x57e8cb,_0x13177a){return _0x57e8cb[_0x1c48('0x6')]('SalesforceConfiguration',attributes,{'tableName':_0x1c48('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x251d=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','lodash','util'];(function(_0x10d6f5,_0x140245){var _0x484db4=function(_0x2f7ec4){while(--_0x2f7ec4){_0x10d6f5['push'](_0x10d6f5['shift']());}};_0x484db4(++_0x140245);}(_0x251d,0x172));var _0xd251=function(_0x261813,_0x4b54c8){_0x261813=_0x261813-0x0;var _0x13097a=_0x251d[_0x261813];return _0x13097a;};'use strict';var _=require(_0xd251('0x0'));var util=require(_0xd251('0x1'));var logger=require(_0xd251('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd251('0x3'));var rp=require(_0xd251('0x4'));var fs=require('fs');var path=require(_0xd251('0x5'));var rimraf=require(_0xd251('0x6'));var config=require(_0xd251('0x7'));var attributes=require(_0xd251('0x8'));module[_0xd251('0x9')]=function(_0x57720d,_0x485231){return _0x57720d[_0xd251('0xa')]('SalesforceConfiguration',attributes,{'tableName':_0xd251('0xb'),'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 87490fb..87cb16b 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 _0x07e0=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird'];(function(_0x2881c5,_0x1aaeec){var _0x4b48a9=function(_0x26e8b4){while(--_0x26e8b4){_0x2881c5['push'](_0x2881c5['shift']());}};_0x4b48a9(++_0x1aaeec);}(_0x07e0,0x153));var _0x007e=function(_0x5dd62d,_0x558773){_0x5dd62d=_0x5dd62d-0x0;var _0x327413=_0x07e0[_0x5dd62d];return _0x327413;};'use strict';var _=require(_0x007e('0x0'));var util=require(_0x007e('0x1'));var moment=require('moment');var BPromise=require(_0x007e('0x2'));var rs=require(_0x007e('0x3'));var fs=require('fs');var Redis=require(_0x007e('0x4'));var db=require(_0x007e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x007e('0x6'))(_0x007e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x468846,_0x33d873,_0xe5372d){return new BPromise(function(_0x2fbb1c,_0xc1cd47){return client[_0x007e('0x8')](_0x468846,_0xe5372d)[_0x007e('0x9')](function(_0x9293b9){logger[_0x007e('0xa')](_0x007e('0xb'),_0x33d873,'request\x20sent');logger['debug'](_0x007e('0xc'),_0x33d873,_0x007e('0xd'),JSON[_0x007e('0xe')](_0x9293b9));if(_0x9293b9['error']){if(_0x9293b9[_0x007e('0xf')][_0x007e('0x10')]===0x1f4){logger[_0x007e('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x33d873,_0x9293b9[_0x007e('0xf')][_0x007e('0x11')]);return _0xc1cd47(_0x9293b9[_0x007e('0xf')][_0x007e('0x11')]);}logger[_0x007e('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x33d873,_0x9293b9[_0x007e('0xf')][_0x007e('0x11')]);return _0x2fbb1c(_0x9293b9[_0x007e('0xf')][_0x007e('0x11')]);}else{logger[_0x007e('0xa')]('SalesforceConfiguration,\x20%s,\x20%s',_0x33d873,'request\x20sent');_0x2fbb1c(_0x9293b9['result'][_0x007e('0x11')]);}})[_0x007e('0x12')](function(_0x589188){logger[_0x007e('0xf')](_0x007e('0xb'),_0x33d873,_0x589188);_0xc1cd47(_0x589188);});});} \ No newline at end of file +var _0x6257=['SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x3140da,_0x39e0e0){var _0x5887ba=function(_0x769f3f){while(--_0x769f3f){_0x3140da['push'](_0x3140da['shift']());}};_0x5887ba(++_0x39e0e0);}(_0x6257,0x176));var _0x7625=function(_0x1ef6b3,_0x14ee00){_0x1ef6b3=_0x1ef6b3-0x0;var _0x44d55d=_0x6257[_0x1ef6b3];return _0x44d55d;};'use strict';var _=require(_0x7625('0x0'));var util=require('util');var moment=require(_0x7625('0x1'));var BPromise=require(_0x7625('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7625('0x3'));var db=require(_0x7625('0x4'))['db'];var utils=require(_0x7625('0x5'));var logger=require(_0x7625('0x6'))(_0x7625('0x7'));var config=require(_0x7625('0x8'));var jayson=require(_0x7625('0x9'));var client=jayson[_0x7625('0xa')][_0x7625('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32381b,_0x4b0d43,_0x39ffab){return new BPromise(function(_0xcea96c,_0x39ad88){return client[_0x7625('0xc')](_0x32381b,_0x39ffab)[_0x7625('0xd')](function(_0x269342){logger[_0x7625('0xe')](_0x7625('0xf'),_0x4b0d43,_0x7625('0x10'));logger['debug'](_0x7625('0x11'),_0x4b0d43,'request\x20sent',JSON['stringify'](_0x269342));if(_0x269342[_0x7625('0x12')]){if(_0x269342[_0x7625('0x12')][_0x7625('0x13')]===0x1f4){logger[_0x7625('0x12')](_0x7625('0xf'),_0x4b0d43,_0x269342[_0x7625('0x12')][_0x7625('0x14')]);return _0x39ad88(_0x269342['error']['message']);}logger[_0x7625('0x12')](_0x7625('0xf'),_0x4b0d43,_0x269342[_0x7625('0x12')][_0x7625('0x14')]);return _0xcea96c(_0x269342[_0x7625('0x12')][_0x7625('0x14')]);}else{logger[_0x7625('0xe')](_0x7625('0xf'),_0x4b0d43,_0x7625('0x10'));_0xcea96c(_0x269342[_0x7625('0x15')]['message']);}})[_0x7625('0x16')](function(_0x4ef0d1){logger[_0x7625('0x12')](_0x7625('0xf'),_0x4b0d43,_0x4ef0d1);_0x39ad88(_0x4ef0d1);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 01ef5db..910a577 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 _0x9f32=['isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','get'];(function(_0x4d3835,_0x4f5f50){var _0x823439=function(_0x25a5c6){while(--_0x25a5c6){_0x4d3835['push'](_0x4d3835['shift']());}};_0x823439(++_0x4f5f50);}(_0x9f32,0x109));var _0x29f3=function(_0x2afe1c,_0x1c454c){_0x2afe1c=_0x2afe1c-0x0;var _0x4ad077=_0x9f32[_0x2afe1c];return _0x4ad077;};'use strict';var multer=require(_0x29f3('0x0'));var util=require(_0x29f3('0x1'));var path=require('path');var timeout=require(_0x29f3('0x2'));var express=require('express');var router=express[_0x29f3('0x3')]();var fs_extra=require(_0x29f3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x29f3('0x5'));var config=require('../../config/environment');var controller=require('./intSalesforceField.controller');router[_0x29f3('0x6')]('/',auth[_0x29f3('0x7')](),controller[_0x29f3('0x8')]);router['get'](_0x29f3('0x9'),auth[_0x29f3('0x7')](),controller[_0x29f3('0xa')]);router[_0x29f3('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x29f3('0xc')]('/:id',auth[_0x29f3('0x7')](),controller[_0x29f3('0xd')]);router[_0x29f3('0xe')](_0x29f3('0x9'),auth[_0x29f3('0x7')](),controller[_0x29f3('0xf')]);module[_0x29f3('0x10')]=router; \ No newline at end of file +var _0xa522=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util'];(function(_0xbb1add,_0x489d26){var _0x1620b1=function(_0x2b43c3){while(--_0x2b43c3){_0xbb1add['push'](_0xbb1add['shift']());}};_0x1620b1(++_0x489d26);}(_0xa522,0x1c0));var _0x2a52=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0xa522[_0xdd2bfa];return _0x55397e;};'use strict';var multer=require(_0x2a52('0x0'));var util=require(_0x2a52('0x1'));var path=require('path');var timeout=require(_0x2a52('0x2'));var express=require(_0x2a52('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2a52('0x4'));var interaction=require(_0x2a52('0x5'));var config=require('../../config/environment');var controller=require(_0x2a52('0x6'));router[_0x2a52('0x7')]('/',auth[_0x2a52('0x8')](),controller[_0x2a52('0x9')]);router[_0x2a52('0x7')](_0x2a52('0xa'),auth['isAuthenticated'](),controller[_0x2a52('0xb')]);router[_0x2a52('0xc')]('/',auth[_0x2a52('0x8')](),controller['create']);router[_0x2a52('0xd')](_0x2a52('0xa'),auth[_0x2a52('0x8')](),controller[_0x2a52('0xe')]);router[_0x2a52('0xf')](_0x2a52('0xa'),auth['isAuthenticated'](),controller[_0x2a52('0x10')]);module[_0x2a52('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 4a35eba..4ec76d6 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 _0xbfb7=['STRING','variable','exports','ENUM','string','customVariable','keyValue','picklist'];(function(_0x4a8434,_0x2a8e34){var _0x1e5341=function(_0x112ed7){while(--_0x112ed7){_0x4a8434['push'](_0x4a8434['shift']());}};_0x1e5341(++_0x2a8e34);}(_0xbfb7,0x19a));var _0x7bfb=function(_0x171520,_0x1cee8c){_0x171520=_0x171520-0x0;var _0x3cc729=_0xbfb7[_0x171520];return _0x3cc729;};'use strict';var Sequelize=require('sequelize');module[_0x7bfb('0x0')]={'type':{'type':Sequelize[_0x7bfb('0x1')](_0x7bfb('0x2'),'variable',_0x7bfb('0x3'),_0x7bfb('0x4'),_0x7bfb('0x5')),'defaultValue':_0x7bfb('0x2')},'content':{'type':Sequelize[_0x7bfb('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0x7bfb('0x7'),_0x7bfb('0x3'))},'keyContent':{'type':Sequelize[_0x7bfb('0x6')]},'idField':{'type':Sequelize[_0x7bfb('0x6')]},'variableName':{'type':Sequelize[_0x7bfb('0x6')]}}; \ No newline at end of file +var _0x9ec0=['picklist','string','STRING','exports','ENUM','variable','customVariable','keyValue'];(function(_0x11cb92,_0x534825){var _0x50e2e6=function(_0x347dce){while(--_0x347dce){_0x11cb92['push'](_0x11cb92['shift']());}};_0x50e2e6(++_0x534825);}(_0x9ec0,0xc3));var _0x09ec=function(_0x2edfb3,_0x1267bd){_0x2edfb3=_0x2edfb3-0x0;var _0x3df862=_0x9ec0[_0x2edfb3];return _0x3df862;};'use strict';var Sequelize=require('sequelize');module[_0x09ec('0x0')]={'type':{'type':Sequelize[_0x09ec('0x1')]('string',_0x09ec('0x2'),_0x09ec('0x3'),_0x09ec('0x4'),_0x09ec('0x5')),'defaultValue':_0x09ec('0x6')},'content':{'type':Sequelize[_0x09ec('0x7')]},'key':{'type':Sequelize[_0x09ec('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x09ec('0x6'),_0x09ec('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x09ec('0x7')]},'idField':{'type':Sequelize[_0x09ec('0x7')]},'variableName':{'type':Sequelize[_0x09ec('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index eae9938..0416aab 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 _0xa2d1=['reject','update','then','error','stack','name','send','index','map','SalesforceField','fieldName','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','params','rawAttributes','find','create','body','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x14e0db,_0x5d8a5c){var _0x166fe3=function(_0x4deda2){while(--_0x4deda2){_0x14e0db['push'](_0x14e0db['shift']());}};_0x166fe3(++_0x5d8a5c);}(_0xa2d1,0x72));var _0x1a2d=function(_0x13844e,_0x14d041){_0x13844e=_0x13844e-0x0;var _0x5183b0=_0xa2d1[_0x13844e];return _0x5183b0;};'use strict';var emlformat=require(_0x1a2d('0x0'));var rimraf=require(_0x1a2d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1a2d('0x2'));var rp=require(_0x1a2d('0x3'));var moment=require(_0x1a2d('0x4'));var BPromise=require(_0x1a2d('0x5'));var Mustache=require('mustache');var util=require(_0x1a2d('0x6'));var path=require(_0x1a2d('0x7'));var sox=require(_0x1a2d('0x8'));var csv=require('to-csv');var ejs=require(_0x1a2d('0x9'));var fs=require('fs');var fs_extra=require(_0x1a2d('0xa'));var _=require(_0x1a2d('0xb'));var squel=require(_0x1a2d('0xc'));var crypto=require(_0x1a2d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1a2d('0xe'));var toCsv=require(_0x1a2d('0xf'));var querystring=require('querystring');var Papa=require(_0x1a2d('0x10'));var Redis=require(_0x1a2d('0x11'));var authService=require(_0x1a2d('0x12'));var qs=require(_0x1a2d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1a2d('0x14'))(_0x1a2d('0x15'));var utils=require(_0x1a2d('0x16'));var config=require(_0x1a2d('0x17'));var licenseUtil=require(_0x1a2d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa97623,_0x202b89){_0x202b89=_0x202b89||0xcc;return function(_0x5c7276){if(_0x5c7276){return _0xa97623[_0x1a2d('0x19')](_0x202b89);}return _0xa97623[_0x1a2d('0x1a')](_0x202b89)[_0x1a2d('0x1b')]();};}function respondWithResult(_0x40acc3,_0x288192){_0x288192=_0x288192||0xc8;return function(_0x5c40ca){if(_0x5c40ca){return _0x40acc3[_0x1a2d('0x1a')](_0x288192)[_0x1a2d('0x1c')](_0x5c40ca);}};}function respondWithFilteredResult(_0x13ea65,_0x4fa06b){return function(_0xb584a1){if(_0xb584a1){var _0x42405b=typeof _0x4fa06b[_0x1a2d('0x1d')]===_0x1a2d('0x1e')&&typeof _0x4fa06b[_0x1a2d('0x1f')]===_0x1a2d('0x1e');var _0x5c4336=_0xb584a1[_0x1a2d('0x20')];var _0x3533e9=_0x42405b?0x0:_0x4fa06b[_0x1a2d('0x1d')];var _0x2fac2d=_0x42405b?_0xb584a1[_0x1a2d('0x20')]:_0x4fa06b[_0x1a2d('0x1d')]+_0x4fa06b[_0x1a2d('0x1f')];var _0x537deb;if(_0x2fac2d>=_0x5c4336){_0x2fac2d=_0x5c4336;_0x537deb=0xc8;}else{_0x537deb=0xce;}_0x13ea65[_0x1a2d('0x1a')](_0x537deb);return _0x13ea65[_0x1a2d('0x21')](_0x1a2d('0x22'),_0x3533e9+'-'+_0x2fac2d+'/'+_0x5c4336)[_0x1a2d('0x1c')](_0xb584a1);}return null;};}function patchUpdates(_0x344ee7){return function(_0x1aefd6){try{jsonpatch[_0x1a2d('0x23')](_0x1aefd6,_0x344ee7,!![]);}catch(_0x2be277){return BPromise[_0x1a2d('0x24')](_0x2be277);}return _0x1aefd6['save']();};}function saveUpdates(_0x4bd86a,_0x2109ec){return function(_0x12a33c){if(_0x12a33c){return _0x12a33c[_0x1a2d('0x25')](_0x4bd86a)[_0x1a2d('0x26')](function(_0x521431){return _0x521431;});}return null;};}function removeEntity(_0x439e39,_0x4a5f9d){return function(_0x317b36){if(_0x317b36){return _0x317b36['destroy']()[_0x1a2d('0x26')](function(){_0x439e39[_0x1a2d('0x1a')](0xcc)[_0x1a2d('0x1b')]();});}};}function handleEntityNotFound(_0x5afb6f,_0x503d){return function(_0x12c419){if(!_0x12c419){_0x5afb6f[_0x1a2d('0x19')](0x194);}return _0x12c419;};}function handleError(_0x4e30bd,_0xd03048){_0xd03048=_0xd03048||0x1f4;return function(_0xdff27e){logger[_0x1a2d('0x27')](_0xdff27e[_0x1a2d('0x28')]);if(_0xdff27e['name']){delete _0xdff27e[_0x1a2d('0x29')];}_0x4e30bd['status'](_0xd03048)[_0x1a2d('0x2a')](_0xdff27e);};}exports[_0x1a2d('0x2b')]=function(_0x1c8857,_0x5bc5fa){var _0x19676f={},_0x591f66={},_0x4b3b09={'count':0x0,'rows':[]};var _0x42f2d4=_[_0x1a2d('0x2c')](db[_0x1a2d('0x2d')]['rawAttributes'],function(_0x21ad83){return{'name':_0x21ad83[_0x1a2d('0x2e')],'type':_0x21ad83['type'][_0x1a2d('0x2f')]};});_0x591f66[_0x1a2d('0x30')]=_[_0x1a2d('0x2c')](_0x42f2d4,_0x1a2d('0x29'));_0x591f66[_0x1a2d('0x31')]=_[_0x1a2d('0x32')](_0x1c8857[_0x1a2d('0x31')]);_0x591f66['filters']=_['intersection'](_0x591f66['model'],_0x591f66[_0x1a2d('0x31')]);_0x19676f[_0x1a2d('0x33')]=_[_0x1a2d('0x34')](_0x591f66[_0x1a2d('0x30')],qs[_0x1a2d('0x35')](_0x1c8857[_0x1a2d('0x31')][_0x1a2d('0x35')]));_0x19676f[_0x1a2d('0x33')]=_0x19676f[_0x1a2d('0x33')][_0x1a2d('0x36')]?_0x19676f[_0x1a2d('0x33')]:_0x591f66[_0x1a2d('0x30')];if(!_0x1c8857[_0x1a2d('0x31')]['hasOwnProperty'](_0x1a2d('0x37'))){_0x19676f[_0x1a2d('0x1f')]=qs[_0x1a2d('0x1f')](_0x1c8857[_0x1a2d('0x31')][_0x1a2d('0x1f')]);_0x19676f[_0x1a2d('0x1d')]=qs[_0x1a2d('0x1d')](_0x1c8857[_0x1a2d('0x31')]['offset']);}_0x19676f[_0x1a2d('0x38')]=qs[_0x1a2d('0x39')](_0x1c8857[_0x1a2d('0x31')][_0x1a2d('0x39')]);_0x19676f['where']=qs[_0x1a2d('0x3a')](_[_0x1a2d('0x3b')](_0x1c8857[_0x1a2d('0x31')],_0x591f66[_0x1a2d('0x3a')]),_0x42f2d4);if(_0x1c8857[_0x1a2d('0x31')][_0x1a2d('0x3c')]){_0x19676f[_0x1a2d('0x3d')]=_['merge'](_0x19676f[_0x1a2d('0x3d')],{'$or':_['map'](_0x42f2d4,function(_0x26f888){if(_0x26f888[_0x1a2d('0x3e')]!==_0x1a2d('0x3f')){var _0x4f3f55={};_0x4f3f55[_0x26f888[_0x1a2d('0x29')]]={'$like':'%'+_0x1c8857['query'][_0x1a2d('0x3c')]+'%'};return _0x4f3f55;}})});}_0x19676f=_[_0x1a2d('0x40')]({},_0x19676f,_0x1c8857[_0x1a2d('0x41')]);var _0x1bf235={'where':_0x19676f[_0x1a2d('0x3d')]};return db[_0x1a2d('0x2d')][_0x1a2d('0x20')](_0x1bf235)[_0x1a2d('0x26')](function(_0x541daf){_0x4b3b09[_0x1a2d('0x20')]=_0x541daf;if(_0x1c8857[_0x1a2d('0x31')][_0x1a2d('0x42')]){_0x19676f[_0x1a2d('0x43')]=[{'all':!![]}];}return db['SalesforceField'][_0x1a2d('0x44')](_0x19676f);})[_0x1a2d('0x26')](function(_0x2c453b){_0x4b3b09['rows']=_0x2c453b;return _0x4b3b09;})['then'](respondWithFilteredResult(_0x5bc5fa,_0x19676f))['catch'](handleError(_0x5bc5fa,null));};exports['show']=function(_0x2eb895,_0x485373){var _0x5666ae={'raw':!![],'where':{'id':_0x2eb895[_0x1a2d('0x45')]['id']}},_0x4aee8e={};_0x4aee8e[_0x1a2d('0x30')]=_['keys'](db[_0x1a2d('0x2d')][_0x1a2d('0x46')]);_0x4aee8e[_0x1a2d('0x31')]=_[_0x1a2d('0x32')](_0x2eb895[_0x1a2d('0x31')]);_0x4aee8e[_0x1a2d('0x3a')]=_[_0x1a2d('0x34')](_0x4aee8e[_0x1a2d('0x30')],_0x4aee8e[_0x1a2d('0x31')]);_0x5666ae[_0x1a2d('0x33')]=_[_0x1a2d('0x34')](_0x4aee8e[_0x1a2d('0x30')],qs[_0x1a2d('0x35')](_0x2eb895['query']['fields']));_0x5666ae[_0x1a2d('0x33')]=_0x5666ae['attributes'][_0x1a2d('0x36')]?_0x5666ae['attributes']:_0x4aee8e[_0x1a2d('0x30')];if(_0x2eb895[_0x1a2d('0x31')][_0x1a2d('0x42')]){_0x5666ae[_0x1a2d('0x43')]=[{'all':!![]}];}_0x5666ae=_[_0x1a2d('0x40')]({},_0x5666ae,_0x2eb895[_0x1a2d('0x41')]);return db['SalesforceField'][_0x1a2d('0x47')](_0x5666ae)[_0x1a2d('0x26')](handleEntityNotFound(_0x485373,null))[_0x1a2d('0x26')](respondWithResult(_0x485373,null))['catch'](handleError(_0x485373,null));};exports[_0x1a2d('0x48')]=function(_0x23bc9e,_0x4e689d){return db[_0x1a2d('0x2d')][_0x1a2d('0x48')](_0x23bc9e[_0x1a2d('0x49')],{})[_0x1a2d('0x26')](respondWithResult(_0x4e689d,0xc9))['catch'](handleError(_0x4e689d,null));};exports[_0x1a2d('0x25')]=function(_0x4bdb2d,_0x36d64f){if(_0x4bdb2d['body']['id']){delete _0x4bdb2d[_0x1a2d('0x49')]['id'];}return db[_0x1a2d('0x2d')][_0x1a2d('0x47')]({'where':{'id':_0x4bdb2d[_0x1a2d('0x45')]['id']}})[_0x1a2d('0x26')](handleEntityNotFound(_0x36d64f,null))['then'](saveUpdates(_0x4bdb2d[_0x1a2d('0x49')],null))[_0x1a2d('0x26')](respondWithResult(_0x36d64f,null))[_0x1a2d('0x4a')](handleError(_0x36d64f,null));};exports['destroy']=function(_0x544d20,_0x3ae653){return db[_0x1a2d('0x2d')][_0x1a2d('0x47')]({'where':{'id':_0x544d20[_0x1a2d('0x45')]['id']}})[_0x1a2d('0x26')](handleEntityNotFound(_0x3ae653,null))[_0x1a2d('0x26')](removeEntity(_0x3ae653,null))['catch'](handleError(_0x3ae653,null));}; \ No newline at end of file +var _0x69fa=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','reject','save','update','destroy','then','error','stack','name','send','map','SalesforceField','rawAttributes','fieldName','type','model','keys','query','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','intersection','include','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x116c0b,_0x300ef3){var _0x4b3179=function(_0x28c944){while(--_0x28c944){_0x116c0b['push'](_0x116c0b['shift']());}};_0x4b3179(++_0x300ef3);}(_0x69fa,0x176));var _0xa69f=function(_0x333767,_0x3e6f9c){_0x333767=_0x333767-0x0;var _0x51661b=_0x69fa[_0x333767];return _0x51661b;};'use strict';var emlformat=require(_0xa69f('0x0'));var rimraf=require(_0xa69f('0x1'));var zipdir=require(_0xa69f('0x2'));var jsonpatch=require(_0xa69f('0x3'));var rp=require(_0xa69f('0x4'));var moment=require(_0xa69f('0x5'));var BPromise=require(_0xa69f('0x6'));var Mustache=require(_0xa69f('0x7'));var util=require(_0xa69f('0x8'));var path=require(_0xa69f('0x9'));var sox=require(_0xa69f('0xa'));var csv=require(_0xa69f('0xb'));var ejs=require(_0xa69f('0xc'));var fs=require('fs');var fs_extra=require(_0xa69f('0xd'));var _=require(_0xa69f('0xe'));var squel=require(_0xa69f('0xf'));var crypto=require(_0xa69f('0x10'));var jsforce=require(_0xa69f('0x11'));var deskjs=require(_0xa69f('0x12'));var toCsv=require(_0xa69f('0xb'));var querystring=require('querystring');var Papa=require(_0xa69f('0x13'));var Redis=require(_0xa69f('0x14'));var authService=require(_0xa69f('0x15'));var qs=require(_0xa69f('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa69f('0x17'));var logger=require('../../config/logger')(_0xa69f('0x18'));var utils=require(_0xa69f('0x19'));var config=require(_0xa69f('0x1a'));var licenseUtil=require(_0xa69f('0x1b'));var db=require(_0xa69f('0x1c'))['db'];function respondWithStatusCode(_0x25ff13,_0x2b940c){_0x2b940c=_0x2b940c||0xcc;return function(_0x1efb32){if(_0x1efb32){return _0x25ff13[_0xa69f('0x1d')](_0x2b940c);}return _0x25ff13['status'](_0x2b940c)[_0xa69f('0x1e')]();};}function respondWithResult(_0x3877ad,_0x58bbcf){_0x58bbcf=_0x58bbcf||0xc8;return function(_0x214af4){if(_0x214af4){return _0x3877ad['status'](_0x58bbcf)[_0xa69f('0x1f')](_0x214af4);}};}function respondWithFilteredResult(_0x4562ab,_0x415855){return function(_0x1df248){if(_0x1df248){var _0x380130=typeof _0x415855[_0xa69f('0x20')]===_0xa69f('0x21')&&typeof _0x415855[_0xa69f('0x22')]===_0xa69f('0x21');var _0x27fd9c=_0x1df248['count'];var _0x114785=_0x380130?0x0:_0x415855[_0xa69f('0x20')];var _0x420721=_0x380130?_0x1df248[_0xa69f('0x23')]:_0x415855['offset']+_0x415855['limit'];var _0x5def51;if(_0x420721>=_0x27fd9c){_0x420721=_0x27fd9c;_0x5def51=0xc8;}else{_0x5def51=0xce;}_0x4562ab[_0xa69f('0x24')](_0x5def51);return _0x4562ab['set']('Content-Range',_0x114785+'-'+_0x420721+'/'+_0x27fd9c)[_0xa69f('0x1f')](_0x1df248);}return null;};}function patchUpdates(_0x49a15c){return function(_0x2dceab){try{jsonpatch['apply'](_0x2dceab,_0x49a15c,!![]);}catch(_0x2570d6){return BPromise[_0xa69f('0x25')](_0x2570d6);}return _0x2dceab[_0xa69f('0x26')]();};}function saveUpdates(_0x4746cb,_0x4216f7){return function(_0x49c483){if(_0x49c483){return _0x49c483[_0xa69f('0x27')](_0x4746cb)['then'](function(_0x2ae08c){return _0x2ae08c;});}return null;};}function removeEntity(_0x10709f,_0x5115e0){return function(_0x3d3a2e){if(_0x3d3a2e){return _0x3d3a2e[_0xa69f('0x28')]()[_0xa69f('0x29')](function(){_0x10709f[_0xa69f('0x24')](0xcc)[_0xa69f('0x1e')]();});}};}function handleEntityNotFound(_0x4512d4,_0x3935fd){return function(_0x16f228){if(!_0x16f228){_0x4512d4[_0xa69f('0x1d')](0x194);}return _0x16f228;};}function handleError(_0x5d807a,_0x42c601){_0x42c601=_0x42c601||0x1f4;return function(_0x3c5710){logger[_0xa69f('0x2a')](_0x3c5710[_0xa69f('0x2b')]);if(_0x3c5710[_0xa69f('0x2c')]){delete _0x3c5710[_0xa69f('0x2c')];}_0x5d807a[_0xa69f('0x24')](_0x42c601)[_0xa69f('0x2d')](_0x3c5710);};}exports['index']=function(_0x4b5f48,_0x17b6b6){var _0x406aa7={},_0xa76c9e={},_0x283ee4={'count':0x0,'rows':[]};var _0x50beb9=_[_0xa69f('0x2e')](db[_0xa69f('0x2f')][_0xa69f('0x30')],function(_0x1bc6cb){return{'name':_0x1bc6cb[_0xa69f('0x31')],'type':_0x1bc6cb[_0xa69f('0x32')]['key']};});_0xa76c9e[_0xa69f('0x33')]=_[_0xa69f('0x2e')](_0x50beb9,'name');_0xa76c9e['query']=_[_0xa69f('0x34')](_0x4b5f48[_0xa69f('0x35')]);_0xa76c9e['filters']=_['intersection'](_0xa76c9e[_0xa69f('0x33')],_0xa76c9e[_0xa69f('0x35')]);_0x406aa7['attributes']=_['intersection'](_0xa76c9e['model'],qs[_0xa69f('0x36')](_0x4b5f48[_0xa69f('0x35')][_0xa69f('0x36')]));_0x406aa7[_0xa69f('0x37')]=_0x406aa7[_0xa69f('0x37')][_0xa69f('0x38')]?_0x406aa7[_0xa69f('0x37')]:_0xa76c9e[_0xa69f('0x33')];if(!_0x4b5f48[_0xa69f('0x35')]['hasOwnProperty'](_0xa69f('0x39'))){_0x406aa7['limit']=qs[_0xa69f('0x22')](_0x4b5f48[_0xa69f('0x35')][_0xa69f('0x22')]);_0x406aa7[_0xa69f('0x20')]=qs[_0xa69f('0x20')](_0x4b5f48[_0xa69f('0x35')][_0xa69f('0x20')]);}_0x406aa7[_0xa69f('0x3a')]=qs['sort'](_0x4b5f48[_0xa69f('0x35')][_0xa69f('0x3b')]);_0x406aa7[_0xa69f('0x3c')]=qs[_0xa69f('0x3d')](_[_0xa69f('0x3e')](_0x4b5f48[_0xa69f('0x35')],_0xa76c9e['filters']),_0x50beb9);if(_0x4b5f48[_0xa69f('0x35')]['filter']){_0x406aa7['where']=_[_0xa69f('0x3f')](_0x406aa7[_0xa69f('0x3c')],{'$or':_[_0xa69f('0x2e')](_0x50beb9,function(_0x4f245e){if(_0x4f245e[_0xa69f('0x32')]!==_0xa69f('0x40')){var _0x115d5b={};_0x115d5b[_0x4f245e[_0xa69f('0x2c')]]={'$like':'%'+_0x4b5f48['query'][_0xa69f('0x41')]+'%'};return _0x115d5b;}})});}_0x406aa7=_[_0xa69f('0x3f')]({},_0x406aa7,_0x4b5f48[_0xa69f('0x42')]);var _0x30e1ea={'where':_0x406aa7['where']};return db[_0xa69f('0x2f')][_0xa69f('0x23')](_0x30e1ea)[_0xa69f('0x29')](function(_0xd05b0){_0x283ee4[_0xa69f('0x23')]=_0xd05b0;if(_0x4b5f48['query'][_0xa69f('0x43')]){_0x406aa7['include']=[{'all':!![]}];}return db['SalesforceField'][_0xa69f('0x44')](_0x406aa7);})['then'](function(_0xec5d14){_0x283ee4[_0xa69f('0x45')]=_0xec5d14;return _0x283ee4;})['then'](respondWithFilteredResult(_0x17b6b6,_0x406aa7))['catch'](handleError(_0x17b6b6,null));};exports[_0xa69f('0x46')]=function(_0xa13c39,_0x160c74){var _0x58de1b={'raw':!![],'where':{'id':_0xa13c39[_0xa69f('0x47')]['id']}},_0x59eb51={};_0x59eb51[_0xa69f('0x33')]=_[_0xa69f('0x34')](db[_0xa69f('0x2f')][_0xa69f('0x30')]);_0x59eb51[_0xa69f('0x35')]=_[_0xa69f('0x34')](_0xa13c39[_0xa69f('0x35')]);_0x59eb51['filters']=_[_0xa69f('0x48')](_0x59eb51[_0xa69f('0x33')],_0x59eb51[_0xa69f('0x35')]);_0x58de1b[_0xa69f('0x37')]=_[_0xa69f('0x48')](_0x59eb51['model'],qs[_0xa69f('0x36')](_0xa13c39[_0xa69f('0x35')]['fields']));_0x58de1b[_0xa69f('0x37')]=_0x58de1b[_0xa69f('0x37')][_0xa69f('0x38')]?_0x58de1b[_0xa69f('0x37')]:_0x59eb51[_0xa69f('0x33')];if(_0xa13c39[_0xa69f('0x35')]['includeAll']){_0x58de1b[_0xa69f('0x49')]=[{'all':!![]}];}_0x58de1b=_[_0xa69f('0x3f')]({},_0x58de1b,_0xa13c39['options']);return db[_0xa69f('0x2f')][_0xa69f('0x4a')](_0x58de1b)[_0xa69f('0x29')](handleEntityNotFound(_0x160c74,null))['then'](respondWithResult(_0x160c74,null))['catch'](handleError(_0x160c74,null));};exports[_0xa69f('0x4b')]=function(_0x59bdcb,_0x1733c5){return db[_0xa69f('0x2f')][_0xa69f('0x4b')](_0x59bdcb[_0xa69f('0x4c')],{})['then'](respondWithResult(_0x1733c5,0xc9))[_0xa69f('0x4d')](handleError(_0x1733c5,null));};exports[_0xa69f('0x27')]=function(_0x2d1712,_0xffb1b0){if(_0x2d1712[_0xa69f('0x4c')]['id']){delete _0x2d1712[_0xa69f('0x4c')]['id'];}return db[_0xa69f('0x2f')][_0xa69f('0x4a')]({'where':{'id':_0x2d1712['params']['id']}})['then'](handleEntityNotFound(_0xffb1b0,null))[_0xa69f('0x29')](saveUpdates(_0x2d1712[_0xa69f('0x4c')],null))[_0xa69f('0x29')](respondWithResult(_0xffb1b0,null))['catch'](handleError(_0xffb1b0,null));};exports[_0xa69f('0x28')]=function(_0xfcf720,_0x47e079){return db[_0xa69f('0x2f')][_0xa69f('0x4a')]({'where':{'id':_0xfcf720[_0xa69f('0x47')]['id']}})[_0xa69f('0x29')](handleEntityNotFound(_0x47e079,null))[_0xa69f('0x29')](removeEntity(_0x47e079,null))['catch'](handleError(_0x47e079,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 47f7e2a..f6e482e 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 _0x7bee=['idField','FieldId','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','define','SalesforceField','int_salesforce_fields','salesforce_unique_index'];(function(_0x4f9c62,_0x27dfa7){var _0x96cf03=function(_0x4f0fe0){while(--_0x4f0fe0){_0x4f9c62['push'](_0x4f9c62['shift']());}};_0x96cf03(++_0x27dfa7);}(_0x7bee,0x1af));var _0xe7be=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x7bee[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0xe7be('0x0'));var logger=require(_0xe7be('0x1'))('api');var moment=require(_0xe7be('0x2'));var BPromise=require(_0xe7be('0x3'));var rp=require(_0xe7be('0x4'));var fs=require('fs');var path=require(_0xe7be('0x5'));var rimraf=require(_0xe7be('0x6'));var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0x33ebba,_0xb6b788){return _0x33ebba[_0xe7be('0x7')](_0xe7be('0x8'),attributes,{'tableName':_0xe7be('0x9'),'paranoid':![],'indexes':[{'name':_0xe7be('0xa'),'fields':[_0xe7be('0xb'),_0xe7be('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe6e4=['FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','salesforce_unique_index','idField'];(function(_0x2b7d8a,_0x3ae57d){var _0x533d53=function(_0x23a7b9){while(--_0x23a7b9){_0x2b7d8a['push'](_0x2b7d8a['shift']());}};_0x533d53(++_0x3ae57d);}(_0xe6e4,0xd3));var _0x4e6e=function(_0x46a671,_0x758e9a){_0x46a671=_0x46a671-0x0;var _0x526d75=_0xe6e4[_0x46a671];return _0x526d75;};'use strict';var _=require(_0x4e6e('0x0'));var util=require(_0x4e6e('0x1'));var logger=require(_0x4e6e('0x2'))(_0x4e6e('0x3'));var moment=require(_0x4e6e('0x4'));var BPromise=require('bluebird');var rp=require(_0x4e6e('0x5'));var fs=require('fs');var path=require(_0x4e6e('0x6'));var rimraf=require('rimraf');var config=require(_0x4e6e('0x7'));var attributes=require(_0x4e6e('0x8'));module[_0x4e6e('0x9')]=function(_0x1817e7,_0x1dfc10){return _0x1817e7[_0x4e6e('0xa')](_0x4e6e('0xb'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x4e6e('0xc'),'fields':[_0x4e6e('0xd'),_0x4e6e('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index ac66fd2..f61da69 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 _0xf98f=['request','then','info','SalesforceField,\x20%s,\x20%s','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2a9407,_0x5d18e9){var _0x51f349=function(_0x32cbbb){while(--_0x32cbbb){_0x2a9407['push'](_0x2a9407['shift']());}};_0x51f349(++_0x5d18e9);}(_0xf98f,0x106));var _0xff98=function(_0x4d8f75,_0x15bf3f){_0x4d8f75=_0x4d8f75-0x0;var _0x3f5e61=_0xf98f[_0x4d8f75];return _0x3f5e61;};'use strict';var _=require(_0xff98('0x0'));var util=require(_0xff98('0x1'));var moment=require(_0xff98('0x2'));var BPromise=require(_0xff98('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff98('0x4'));var db=require(_0xff98('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xff98('0x6'))(_0xff98('0x7'));var config=require(_0xff98('0x8'));var jayson=require(_0xff98('0x9'));var client=jayson[_0xff98('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b5cf9,_0x237be8,_0x194c24){return new BPromise(function(_0x3093c3,_0x30affd){return client[_0xff98('0xb')](_0x3b5cf9,_0x194c24)[_0xff98('0xc')](function(_0x1bbfb2){logger[_0xff98('0xd')](_0xff98('0xe'),_0x237be8,'request\x20sent');logger['debug'](_0xff98('0xf'),_0x237be8,_0xff98('0x10'),JSON[_0xff98('0x11')](_0x1bbfb2));if(_0x1bbfb2['error']){if(_0x1bbfb2[_0xff98('0x12')]['code']===0x1f4){logger['error'](_0xff98('0xe'),_0x237be8,_0x1bbfb2['error'][_0xff98('0x13')]);return _0x30affd(_0x1bbfb2[_0xff98('0x12')][_0xff98('0x13')]);}logger['error'](_0xff98('0xe'),_0x237be8,_0x1bbfb2[_0xff98('0x12')][_0xff98('0x13')]);return _0x3093c3(_0x1bbfb2['error'][_0xff98('0x13')]);}else{logger[_0xff98('0xd')](_0xff98('0xe'),_0x237be8,_0xff98('0x10'));_0x3093c3(_0x1bbfb2[_0xff98('0x14')][_0xff98('0x13')]);}})['catch'](function(_0xef3836){logger[_0xff98('0x12')](_0xff98('0xe'),_0x237be8,_0xef3836);_0x30affd(_0xef3836);});});} \ No newline at end of file +var _0xa696=['catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x2baab2,_0x4050ef){var _0x1df670=function(_0x45729b){while(--_0x45729b){_0x2baab2['push'](_0x2baab2['shift']());}};_0x1df670(++_0x4050ef);}(_0xa696,0xfd));var _0x6a69=function(_0x254b22,_0x27159f){_0x254b22=_0x254b22-0x0;var _0x1279db=_0xa696[_0x254b22];return _0x1279db;};'use strict';var _=require('lodash');var util=require(_0x6a69('0x0'));var moment=require(_0x6a69('0x1'));var BPromise=require(_0x6a69('0x2'));var rs=require(_0x6a69('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a69('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6a69('0x5'))(_0x6a69('0x6'));var config=require(_0x6a69('0x7'));var jayson=require(_0x6a69('0x8'));var client=jayson[_0x6a69('0x9')][_0x6a69('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x132c08,_0x2d1209,_0x39c4ce){return new BPromise(function(_0x3e5654,_0x2f7059){return client[_0x6a69('0xb')](_0x132c08,_0x39c4ce)[_0x6a69('0xc')](function(_0x13c199){logger[_0x6a69('0xd')](_0x6a69('0xe'),_0x2d1209,_0x6a69('0xf'));logger['debug'](_0x6a69('0x10'),_0x2d1209,_0x6a69('0xf'),JSON[_0x6a69('0x11')](_0x13c199));if(_0x13c199['error']){if(_0x13c199[_0x6a69('0x12')]['code']===0x1f4){logger[_0x6a69('0x12')]('SalesforceField,\x20%s,\x20%s',_0x2d1209,_0x13c199['error'][_0x6a69('0x13')]);return _0x2f7059(_0x13c199['error'][_0x6a69('0x13')]);}logger[_0x6a69('0x12')](_0x6a69('0xe'),_0x2d1209,_0x13c199['error'][_0x6a69('0x13')]);return _0x3e5654(_0x13c199[_0x6a69('0x12')][_0x6a69('0x13')]);}else{logger[_0x6a69('0xd')](_0x6a69('0xe'),_0x2d1209,_0x6a69('0xf'));_0x3e5654(_0x13c199['result'][_0x6a69('0x13')]);}})[_0x6a69('0x14')](function(_0x54e23e){logger['error'](_0x6a69('0xe'),_0x2d1209,_0x54e23e);_0x2f7059(_0x54e23e);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 55e39f8..746a5a3 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 _0xce56=['connect-timeout','Router','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x58eed6,_0x49a046){var _0x381fa7=function(_0x1ebf98){while(--_0x1ebf98){_0x58eed6['push'](_0x58eed6['shift']());}};_0x381fa7(++_0x49a046);}(_0xce56,0x173));var _0x6ce5=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xce56[_0x3899d1];return _0xeb4a7d;};'use strict';var multer=require(_0x6ce5('0x0'));var util=require(_0x6ce5('0x1'));var path=require(_0x6ce5('0x2'));var timeout=require(_0x6ce5('0x3'));var express=require('express');var router=express[_0x6ce5('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6ce5('0x5'));var controller=require('./intServicenowAccount.controller');router[_0x6ce5('0x6')]('/',auth[_0x6ce5('0x7')](),controller['index']);router[_0x6ce5('0x6')](_0x6ce5('0x8'),auth['isAuthenticated'](),controller[_0x6ce5('0x9')]);router['get'](_0x6ce5('0xa'),auth[_0x6ce5('0x7')](),controller[_0x6ce5('0xb')]);router[_0x6ce5('0x6')](_0x6ce5('0xc'),auth[_0x6ce5('0x7')](),controller[_0x6ce5('0xd')]);router[_0x6ce5('0xe')]('/',auth['isAuthenticated'](),controller[_0x6ce5('0xf')]);router[_0x6ce5('0xe')](_0x6ce5('0xa'),auth[_0x6ce5('0x7')](),controller[_0x6ce5('0x10')]);router[_0x6ce5('0x11')]('/:id',auth[_0x6ce5('0x7')](),controller[_0x6ce5('0x12')]);router[_0x6ce5('0x13')](_0x6ce5('0x8'),auth[_0x6ce5('0x7')](),controller[_0x6ce5('0x14')]);module[_0x6ce5('0x15')]=router; \ No newline at end of file +var _0xd2ce=['/:id/fields','getFields','post','create','addConfiguration','update','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','/:id/configurations','isAuthenticated'];(function(_0x4438f0,_0x3e4909){var _0x5ed82b=function(_0x2eea9a){while(--_0x2eea9a){_0x4438f0['push'](_0x4438f0['shift']());}};_0x5ed82b(++_0x3e4909);}(_0xd2ce,0x13c));var _0xed2c=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xd2ce[_0x12d033];return _0x3b4e80;};'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('./intServicenowAccount.controller');router[_0xed2c('0x8')]('/',auth['isAuthenticated'](),controller[_0xed2c('0x9')]);router[_0xed2c('0x8')](_0xed2c('0xa'),auth['isAuthenticated'](),controller[_0xed2c('0xb')]);router['get'](_0xed2c('0xc'),auth[_0xed2c('0xd')](),controller['getConfigurations']);router['get'](_0xed2c('0xe'),auth[_0xed2c('0xd')](),controller[_0xed2c('0xf')]);router[_0xed2c('0x10')]('/',auth['isAuthenticated'](),controller[_0xed2c('0x11')]);router[_0xed2c('0x10')](_0xed2c('0xc'),auth[_0xed2c('0xd')](),controller[_0xed2c('0x12')]);router['put'](_0xed2c('0xa'),auth[_0xed2c('0xd')](),controller[_0xed2c('0x13')]);router[_0xed2c('0x14')](_0xed2c('0xa'),auth[_0xed2c('0xd')](),controller['destroy']);module[_0xed2c('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 5c62f19..e387b3b 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 _0xc337=['exports','STRING','username','remoteUri','sequelize'];(function(_0x45835f,_0x45e562){var _0x437c3d=function(_0x1f0b9c){while(--_0x1f0b9c){_0x45835f['push'](_0x45835f['shift']());}};_0x437c3d(++_0x45e562);}(_0xc337,0xe0));var _0x7c33=function(_0x1d2f1d,_0x449946){_0x1d2f1d=_0x1d2f1d-0x0;var _0xc52508=_0xc337[_0x1d2f1d];return _0xc52508;};'use strict';var Sequelize=require(_0x7c33('0x0'));module[_0x7c33('0x1')]={'name':{'type':Sequelize[_0x7c33('0x2')]},'description':{'type':Sequelize[_0x7c33('0x2')]},'username':{'type':Sequelize[_0x7c33('0x2')],'unique':_0x7c33('0x3')},'password':{'type':Sequelize[_0x7c33('0x2')]},'email':{'type':Sequelize[_0x7c33('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x7c33('0x4')},'serverUrl':{'type':Sequelize[_0x7c33('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x7e34=['remoteUri','exports','STRING','username'];(function(_0x5db6f5,_0x515567){var _0x119303=function(_0x58c973){while(--_0x58c973){_0x5db6f5['push'](_0x5db6f5['shift']());}};_0x119303(++_0x515567);}(_0x7e34,0x1d1));var _0x47e3=function(_0x43b4a2,_0x520e8d){_0x43b4a2=_0x43b4a2-0x0;var _0x6055d8=_0x7e34[_0x43b4a2];return _0x6055d8;};'use strict';var Sequelize=require('sequelize');module[_0x47e3('0x0')]={'name':{'type':Sequelize[_0x47e3('0x1')]},'description':{'type':Sequelize[_0x47e3('0x1')]},'username':{'type':Sequelize[_0x47e3('0x1')],'unique':_0x47e3('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x47e3('0x1')]},'remoteUri':{'type':Sequelize[_0x47e3('0x1')],'unique':_0x47e3('0x3')},'serverUrl':{'type':Sequelize[_0x47e3('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 0f68cc1..8609e40 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 _0x30f1=['getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','notify','incident_state','severity','category','parent','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','sys_created_on','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','rfc','time_worked','opened_at','business_duration','group_list','work_end','resolved_at','caller_id','approval_set','subcategory','work_notes','close_code','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','reopened_by','problem_id','company','reassignment_count','activity_due','assigned_to','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','email','serverUrl','remoteUri','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','includes','forEach','internalType','label','push','all','log','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','test','statusCode','stack','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','value','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','filter','where','merge','VIRTUAL','options','ServicenowAccount','count','includeAll','include','catch','params','find','create','body','update','getConfigurations','findOne','ServicenowConfiguration','order','pick','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions'];(function(_0x45af66,_0x12335b){var _0x56474a=function(_0x510c39){while(--_0x510c39){_0x45af66['push'](_0x45af66['shift']());}};_0x56474a(++_0x12335b);}(_0x30f1,0x6c));var _0x130f=function(_0x282c92,_0x4951b8){_0x282c92=_0x282c92-0x0;var _0x487319=_0x30f1[_0x282c92];return _0x487319;};'use strict';var emlformat=require(_0x130f('0x0'));var rimraf=require(_0x130f('0x1'));var zipdir=require(_0x130f('0x2'));var jsonpatch=require(_0x130f('0x3'));var rp=require('request-promise');var moment=require(_0x130f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x130f('0x5'));var util=require(_0x130f('0x6'));var path=require('path');var sox=require(_0x130f('0x7'));var csv=require('to-csv');var ejs=require(_0x130f('0x8'));var fs=require('fs');var fs_extra=require(_0x130f('0x9'));var _=require(_0x130f('0xa'));var squel=require('squel');var crypto=require(_0x130f('0xb'));var jsforce=require(_0x130f('0xc'));var deskjs=require(_0x130f('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x130f('0xe'));var Redis=require(_0x130f('0xf'));var authService=require(_0x130f('0x10'));var qs=require(_0x130f('0x11'));var as=require(_0x130f('0x12'));var hardwareService=require(_0x130f('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x130f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x130f('0x15'));var db=require(_0x130f('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x281ecd,_0x11e98e){_0x11e98e=_0x11e98e||0xcc;return function(_0x3ce9fd){if(_0x3ce9fd){return _0x281ecd[_0x130f('0x17')](_0x11e98e);}return _0x281ecd[_0x130f('0x18')](_0x11e98e)[_0x130f('0x19')]();};}function respondWithResult(_0x2d64ea,_0x165070){_0x165070=_0x165070||0xc8;return function(_0x3bb282){if(_0x3bb282){return _0x2d64ea['status'](_0x165070)[_0x130f('0x1a')](_0x3bb282);}};}function respondWithFilteredResult(_0x5bf252,_0x5a4b61){return function(_0x3ed43b){if(_0x3ed43b){var _0xbcd58c=typeof _0x5a4b61[_0x130f('0x1b')]===_0x130f('0x1c')&&typeof _0x5a4b61[_0x130f('0x1d')]===_0x130f('0x1c');var _0x489786=_0x3ed43b['count'];var _0x5d6236=_0xbcd58c?0x0:_0x5a4b61['offset'];var _0xa94e5d=_0xbcd58c?_0x3ed43b['count']:_0x5a4b61['offset']+_0x5a4b61['limit'];var _0x547197;if(_0xa94e5d>=_0x489786){_0xa94e5d=_0x489786;_0x547197=0xc8;}else{_0x547197=0xce;}_0x5bf252[_0x130f('0x18')](_0x547197);return _0x5bf252['set'](_0x130f('0x1e'),_0x5d6236+'-'+_0xa94e5d+'/'+_0x489786)[_0x130f('0x1a')](_0x3ed43b);}return null;};}function patchUpdates(_0x1a5170){return function(_0x198bf0){try{jsonpatch[_0x130f('0x1f')](_0x198bf0,_0x1a5170,!![]);}catch(_0x4f7df5){return BPromise[_0x130f('0x20')](_0x4f7df5);}return _0x198bf0['save']();};}function saveUpdates(_0x1d5d12,_0x2dc47f){return function(_0x4e8916){if(_0x4e8916){return _0x4e8916['update'](_0x1d5d12)[_0x130f('0x21')](function(_0x414618){return _0x414618;});}return null;};}function removeEntity(_0x1b4581,_0x3b7e03){return function(_0x8574e1){if(_0x8574e1){return _0x8574e1[_0x130f('0x22')]()[_0x130f('0x21')](function(){_0x1b4581['status'](0xcc)[_0x130f('0x19')]();});}};}function handleEntityNotFound(_0x32d008,_0x2d0baa){return function(_0x3127bf){if(!_0x3127bf){_0x32d008[_0x130f('0x17')](0x194);}return _0x3127bf;};}function handleError(_0x530099,_0x47c3cf){_0x47c3cf=_0x47c3cf||0x1f4;return function(_0x4e414d){logger[_0x130f('0x23')](_0x4e414d['stack']);if(_0x4e414d[_0x130f('0x24')]){delete _0x4e414d[_0x130f('0x24')];}_0x530099['status'](_0x47c3cf)[_0x130f('0x25')](_0x4e414d);};}exports['index']=function(_0xb328c8,_0x230725){var _0x594022={},_0x291671={},_0x483dcf={'count':0x0,'rows':[]};var _0x16d364=_[_0x130f('0x26')](db['ServicenowAccount'][_0x130f('0x27')],function(_0x25ae0c){return{'name':_0x25ae0c[_0x130f('0x28')],'type':_0x25ae0c[_0x130f('0x29')][_0x130f('0x2a')]};});_0x291671[_0x130f('0x2b')]=_[_0x130f('0x26')](_0x16d364,'name');_0x291671[_0x130f('0x2c')]=_[_0x130f('0x2d')](_0xb328c8['query']);_0x291671[_0x130f('0x2e')]=_[_0x130f('0x2f')](_0x291671['model'],_0x291671[_0x130f('0x2c')]);_0x594022[_0x130f('0x30')]=_['intersection'](_0x291671[_0x130f('0x2b')],qs['fields'](_0xb328c8[_0x130f('0x2c')][_0x130f('0x31')]));_0x594022[_0x130f('0x30')]=_0x594022[_0x130f('0x30')][_0x130f('0x32')]?_0x594022[_0x130f('0x30')]:_0x291671['model'];if(!_0xb328c8[_0x130f('0x2c')]['hasOwnProperty']('nolimit')){_0x594022[_0x130f('0x1d')]=qs[_0x130f('0x1d')](_0xb328c8[_0x130f('0x2c')][_0x130f('0x1d')]);_0x594022[_0x130f('0x1b')]=qs[_0x130f('0x1b')](_0xb328c8[_0x130f('0x2c')][_0x130f('0x1b')]);}_0x594022['order']=qs[_0x130f('0x33')](_0xb328c8[_0x130f('0x2c')][_0x130f('0x33')]);_0x594022['where']=qs[_0x130f('0x2e')](_['pick'](_0xb328c8['query'],_0x291671[_0x130f('0x2e')]),_0x16d364);if(_0xb328c8[_0x130f('0x2c')][_0x130f('0x34')]){_0x594022[_0x130f('0x35')]=_[_0x130f('0x36')](_0x594022[_0x130f('0x35')],{'$or':_[_0x130f('0x26')](_0x16d364,function(_0x220ff9){if(_0x220ff9[_0x130f('0x29')]!==_0x130f('0x37')){var _0x2c2620={};_0x2c2620[_0x220ff9[_0x130f('0x24')]]={'$like':'%'+_0xb328c8[_0x130f('0x2c')]['filter']+'%'};return _0x2c2620;}})});}_0x594022=_[_0x130f('0x36')]({},_0x594022,_0xb328c8[_0x130f('0x38')]);var _0x47eb88={'where':_0x594022[_0x130f('0x35')]};return db[_0x130f('0x39')][_0x130f('0x3a')](_0x47eb88)['then'](function(_0x2949ff){_0x483dcf[_0x130f('0x3a')]=_0x2949ff;if(_0xb328c8['query'][_0x130f('0x3b')]){_0x594022[_0x130f('0x3c')]=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0x594022);})[_0x130f('0x21')](function(_0x11e6d1){_0x483dcf['rows']=_0x11e6d1;return _0x483dcf;})[_0x130f('0x21')](respondWithFilteredResult(_0x230725,_0x594022))[_0x130f('0x3d')](handleError(_0x230725,null));};exports['show']=function(_0x35a91b,_0x4ba22f){var _0x4c16df={'raw':![],'where':{'id':_0x35a91b[_0x130f('0x3e')]['id']}},_0x3382c9={};_0x3382c9[_0x130f('0x2b')]=_['keys'](db[_0x130f('0x39')][_0x130f('0x27')]);_0x3382c9[_0x130f('0x2c')]=_['keys'](_0x35a91b[_0x130f('0x2c')]);_0x3382c9[_0x130f('0x2e')]=_[_0x130f('0x2f')](_0x3382c9[_0x130f('0x2b')],_0x3382c9['query']);_0x4c16df[_0x130f('0x30')]=_[_0x130f('0x2f')](_0x3382c9[_0x130f('0x2b')],qs[_0x130f('0x31')](_0x35a91b[_0x130f('0x2c')]['fields']));_0x4c16df[_0x130f('0x30')]=_0x4c16df['attributes'][_0x130f('0x32')]?_0x4c16df['attributes']:_0x3382c9['model'];if(_0x35a91b[_0x130f('0x2c')]['includeAll']){_0x4c16df[_0x130f('0x3c')]=[{'all':!![]}];}_0x4c16df=_['merge']({},_0x4c16df,_0x35a91b[_0x130f('0x38')]);return db[_0x130f('0x39')][_0x130f('0x3f')](_0x4c16df)['then'](handleEntityNotFound(_0x4ba22f,null))[_0x130f('0x21')](respondWithResult(_0x4ba22f,null))['catch'](handleError(_0x4ba22f,null));};exports[_0x130f('0x40')]=function(_0x108b20,_0x535d4e){return db[_0x130f('0x39')]['create'](_0x108b20[_0x130f('0x41')],{})[_0x130f('0x21')](respondWithResult(_0x535d4e,0xc9))['catch'](handleError(_0x535d4e,null));};exports[_0x130f('0x42')]=function(_0xe7f3d1,_0x4f8162){if(_0xe7f3d1['body']['id']){delete _0xe7f3d1[_0x130f('0x41')]['id'];}return db[_0x130f('0x39')]['find']({'where':{'id':_0xe7f3d1[_0x130f('0x3e')]['id']}})[_0x130f('0x21')](handleEntityNotFound(_0x4f8162,null))[_0x130f('0x21')](saveUpdates(_0xe7f3d1['body'],null))[_0x130f('0x21')](respondWithResult(_0x4f8162,null))['catch'](handleError(_0x4f8162,null));};exports[_0x130f('0x22')]=function(_0x525bfc,_0x39c231){return db[_0x130f('0x39')][_0x130f('0x3f')]({'where':{'id':_0x525bfc[_0x130f('0x3e')]['id']}})[_0x130f('0x21')](handleEntityNotFound(_0x39c231,null))[_0x130f('0x21')](removeEntity(_0x39c231,null))['catch'](handleError(_0x39c231,null));};exports[_0x130f('0x43')]=function(_0x3520d8,_0x29b813,_0x145193){var _0x466bf3={};var _0x477f1d={};var _0x57edf4;var _0x3b8eec;return db[_0x130f('0x39')][_0x130f('0x44')]({'where':{'id':_0x3520d8[_0x130f('0x3e')]['id']}})[_0x130f('0x21')](handleEntityNotFound(_0x29b813,null))[_0x130f('0x21')](function(_0x5cbdb6){if(_0x5cbdb6){_0x57edf4=_0x5cbdb6;_0x477f1d['model']=_[_0x130f('0x2d')](db[_0x130f('0x45')][_0x130f('0x27')]);_0x477f1d[_0x130f('0x2c')]=_['keys'](_0x3520d8[_0x130f('0x2c')]);_0x477f1d['filters']=_[_0x130f('0x2f')](_0x477f1d[_0x130f('0x2b')],_0x477f1d[_0x130f('0x2c')]);_0x466bf3[_0x130f('0x30')]=_[_0x130f('0x2f')](_0x477f1d['model'],qs[_0x130f('0x31')](_0x3520d8[_0x130f('0x2c')][_0x130f('0x31')]));_0x466bf3['attributes']=_0x466bf3[_0x130f('0x30')][_0x130f('0x32')]?_0x466bf3[_0x130f('0x30')]:_0x477f1d[_0x130f('0x2b')];_0x466bf3[_0x130f('0x46')]=qs[_0x130f('0x33')](_0x3520d8[_0x130f('0x2c')][_0x130f('0x33')]);_0x466bf3['where']=qs[_0x130f('0x2e')](_[_0x130f('0x47')](_0x3520d8[_0x130f('0x2c')],_0x477f1d['filters']));if(_0x3520d8[_0x130f('0x2c')][_0x130f('0x34')]){_0x466bf3['where']=_[_0x130f('0x36')](_0x466bf3[_0x130f('0x35')],{'$or':_[_0x130f('0x26')](_0x466bf3[_0x130f('0x30')],function(_0x17583d){var _0x594600={};_0x594600[_0x17583d]={'$like':'%'+_0x3520d8['query'][_0x130f('0x34')]+'%'};return _0x594600;})});}_0x466bf3=_[_0x130f('0x36')]({},_0x466bf3,_0x3520d8[_0x130f('0x38')]);return _0x57edf4['getConfigurations'](_0x466bf3);}})['then'](function(_0x5ecee6){if(_0x5ecee6){_0x3b8eec=_0x5ecee6[_0x130f('0x32')];if(!_0x3520d8[_0x130f('0x2c')]['hasOwnProperty'](_0x130f('0x48'))){_0x466bf3[_0x130f('0x1d')]=qs[_0x130f('0x1d')](_0x3520d8['query']['limit']);_0x466bf3[_0x130f('0x1b')]=qs['offset'](_0x3520d8[_0x130f('0x2c')]['offset']);}return _0x57edf4[_0x130f('0x43')](_0x466bf3);}})[_0x130f('0x21')](function(_0x2d5f10){if(_0x2d5f10){return _0x2d5f10?{'count':_0x3b8eec,'rows':_0x2d5f10}:null;}})[_0x130f('0x21')](respondWithResult(_0x29b813,null))[_0x130f('0x3d')](handleError(_0x29b813,null));};exports[_0x130f('0x49')]=function(_0xffbfb3,_0x24393a,_0x2c4857){if(_0xffbfb3[_0x130f('0x41')]['id']){delete _0xffbfb3[_0x130f('0x41')]['id'];}return db[_0x130f('0x39')][_0x130f('0x44')]({'where':{'id':_0xffbfb3['params']['id']}})[_0x130f('0x21')](handleEntityNotFound(_0x24393a,null))['then'](function(_0x300be5){if(_0x300be5){_0xffbfb3['body'][_0x130f('0x4a')]=_0x300be5['id'];_0xffbfb3[_0x130f('0x41')][_0x130f('0x4b')]=integrations[_0x130f('0x4c')](_0xffbfb3[_0x130f('0x41')][_0x130f('0x4d')],_0xffbfb3['body'][_0x130f('0x29')]);_0xffbfb3['body'][_0x130f('0x4e')]=integrations[_0x130f('0x4f')](_0xffbfb3['body'][_0x130f('0x4d')],_0xffbfb3[_0x130f('0x41')]['type']);return db[_0x130f('0x45')][_0x130f('0x40')](_0xffbfb3['body'],{'include':[{'model':db[_0x130f('0x50')],'as':'Subjects'},{'model':db[_0x130f('0x50')],'as':_0x130f('0x4e')}]});}return null;})[_0x130f('0x21')](respondWithResult(_0x24393a,null))[_0x130f('0x3d')](handleError(_0x24393a,null));};exports[_0x130f('0x51')]=function(_0x4aed42,_0x4bfe25,_0x59e02f){var _0x24ac03=[_0x130f('0x52'),_0x130f('0x53'),_0x130f('0x54'),'subcategory','close_code',_0x130f('0x55'),_0x130f('0x56'),_0x130f('0x57'),_0x130f('0x58')];var _0x2cb0dd=[_0x130f('0x59'),_0x130f('0x52'),_0x130f('0x5a'),_0x130f('0x5b'),'upon_reject',_0x130f('0x5c'),_0x130f('0x5d'),_0x130f('0x53'),_0x130f('0x5e'),_0x130f('0x5f'),_0x130f('0x60'),_0x130f('0x61'),_0x130f('0x62'),'user_input',_0x130f('0x63'),'sys_domain',_0x130f('0x64'),_0x130f('0x65'),_0x130f('0x54'),_0x130f('0x46'),_0x130f('0x66'),_0x130f('0x67'),_0x130f('0x68'),_0x130f('0x69'),_0x130f('0x6a'),_0x130f('0x6b'),_0x130f('0x6c'),_0x130f('0x6d'),'priority','sys_domain_path',_0x130f('0x6e'),_0x130f('0x6f'),'expected_start',_0x130f('0x70'),_0x130f('0x71'),_0x130f('0x72'),_0x130f('0x73'),'reopened_time',_0x130f('0x74'),_0x130f('0x75'),_0x130f('0x76'),_0x130f('0x77'),_0x130f('0x78'),'short_description',_0x130f('0x79'),_0x130f('0x7a'),_0x130f('0x7b'),_0x130f('0x7c'),_0x130f('0x7d'),_0x130f('0x7e'),_0x130f('0x7f'),_0x130f('0x80'),_0x130f('0x81'),_0x130f('0x55'),_0x130f('0x82'),_0x130f('0x83'),_0x130f('0x84'),_0x130f('0x85'),_0x130f('0x86'),'sys_id','contact_type',_0x130f('0x87'),'incident_state','urgency',_0x130f('0x88'),_0x130f('0x89'),_0x130f('0x8a'),_0x130f('0x8b'),_0x130f('0x8c'),_0x130f('0x57'),'comments',_0x130f('0x8d'),_0x130f('0x8e'),_0x130f('0x8f'),_0x130f('0x90'),_0x130f('0x91'),_0x130f('0x92'),_0x130f('0x93'),_0x130f('0x94'),_0x130f('0x95'),_0x130f('0x96'),_0x130f('0x97'),_0x130f('0x58')];var _0x4656a7='';var _0x2473c8='';var _0xc09b6c=[];var _0xc60ec='';var _0x202978='';var _0x253e65=[];var _0x3941bb='';var _0x167b78='';var _0x3e21f6={};var _0x25e277='';return db[_0x130f('0x39')][_0x130f('0x44')]({'where':{'id':_0x4aed42['params']['id']},'attributes':['id',_0x130f('0x98'),'password',_0x130f('0x99'),'remoteUri',_0x130f('0x9a')]})[_0x130f('0x21')](handleEntityNotFound(_0x4bfe25,null))[_0x130f('0x21')](function(_0x3a9f44){if(_0x3a9f44){_0x25e277=_0x3a9f44[_0x130f('0x9b')];var _0x4f77da=_0x25e277[_0x130f('0x9c')](-0x1);if(_0x4f77da==='/'){_0x25e277=_0x25e277['substring'](0x0,_0x25e277[_0x130f('0x9d')](_0x4f77da));}_0x167b78=util[_0x130f('0x9e')](_0x130f('0x9f'),_0x25e277);_0x3941bb=util[_0x130f('0x9e')](_0x130f('0xa0'),_0x25e277);_0x3e21f6={'user':_0x3a9f44[_0x130f('0x98')],'pass':_0x3a9f44['password']};var _0x4c2a25={'method':_0x130f('0xa1'),'uri':_0x167b78+_0x130f('0xa2'),'auth':_0x3e21f6,'json':!![]};return rp(_0x4c2a25);}})[_0x130f('0x21')](function(_0x5c99b6){if(_0x5c99b6['result'][_0x130f('0x32')]>0x0){_0x4656a7=_0x5c99b6[_0x130f('0xa3')];}console['log'](_0x130f('0xa4'),_0x4656a7);_0x253e65=[];_0x2473c8=Object[_0x130f('0xa5')]([],_0x4656a7);_['remove'](_0x2473c8,function(_0x1d2424){return!_0x24ac03[_0x130f('0xa6')](_0x1d2424['name']);});_0x2473c8[_0x130f('0xa7')](function(_0x4bab4b){var _0x5e9ce6=createFieldObject(_0x3941bb,_0x3e21f6,_0x4bab4b[_0x130f('0xa8')],_0x4bab4b[_0x130f('0x24')],_0x4bab4b[_0x130f('0xa9')],![]);_0x253e65[_0x130f('0xaa')](_0x5e9ce6);});return Promise[_0x130f('0xab')](_0x253e65);})[_0x130f('0x21')](function(_0x5b7efb){_0xc09b6c=_0x5b7efb;_0xc60ec=Object[_0x130f('0xa5')]([],_0x4656a7);console[_0x130f('0xac')](_0x130f('0xad'),_0x4656a7);_['remove'](_0xc60ec,function(_0x1e312d){return _0x2cb0dd['includes'](_0x1e312d[_0x130f('0x24')]);});console[_0x130f('0xac')](_0x130f('0xae'),_0xc60ec);_0x253e65=[];_0xc60ec[_0x130f('0xa7')](function(_0x18a8ab){var _0x44765f=createFieldObject(_0x3941bb,_0x3e21f6,_0x18a8ab[_0x130f('0xa8')],_0x18a8ab[_0x130f('0x24')],_0x18a8ab['label'],!![]);_0x253e65[_0x130f('0xaa')](_0x44765f);});return Promise['all'](_0x253e65);})[_0x130f('0x21')](function(_0x4d5f10){_0x202978=_0x4d5f10;var _0x3f3250=_0xc09b6c[_0x130f('0xaf')](_0x202978);return{'count':_0x3f3250[_0x130f('0x32')],'rows':_0x3f3250};})[_0x130f('0x21')](respondWithResult(_0x4bfe25,null))[_0x130f('0x3d')](function(_0x1ee403){console[_0x130f('0xac')]('ServiceNow\x20error:\x20'+_0x1ee403);var _0x31af51=_0x4aed42['query'][_0x130f('0xb0')]?0x1f4:_0x1ee403[_0x130f('0xb1')]||0x1f4;logger[_0x130f('0x23')](_0x1ee403[_0x130f('0xb2')]);delete _0x1ee403[_0x130f('0x24')];if(_0x31af51===0x191){_0x31af51=0x190;}_0x4bfe25[_0x130f('0x18')](_0x31af51)['send'](_0x4aed42[_0x130f('0x2c')][_0x130f('0xb0')]?{'message':_0x130f('0xb3'),'statusCode':_0x1ee403['statusCode']}:_0x1ee403);});};function createFieldObject(_0x10c67f,_0x2eca97,_0xa64626,_0x32808e,_0x153cce,_0x34f09d){return new Promise(function(_0x4110c9,_0x3286a7){var _0x3eb6f8={'id':_0x32808e,'name':_0x153cce,'custom':_0x34f09d};if(_0xa64626===_0x130f('0xb4')){_0x3eb6f8[_0x130f('0x38')]=[{'name':_0x130f('0xb5'),'value':_0x130f('0xb6')},{'name':_0x130f('0xb7'),'value':_0x130f('0xb8')}];_0x4110c9(_0x3eb6f8);}else{var _0x91a5c8={'method':_0x130f('0xa1'),'uri':_0x10c67f+_0x130f('0xb9')+_0x32808e,'auth':_0x2eca97,'json':!![]};return rp(_0x91a5c8)[_0x130f('0x21')](function(_0x368854){var _0x2e4e0f=[];if(_0x368854[_0x130f('0xa3')]['length']>0x0){_0x368854[_0x130f('0xa3')]['forEach'](function(_0xcc9456){if(_0xcc9456['inactive']==='false'){var _0x3a75f8={'name':_0xcc9456[_0x130f('0xa9')],'value':_0xcc9456[_0x130f('0xba')]};_0x2e4e0f[_0x130f('0xaa')](_0x3a75f8);}});}_0x3eb6f8[_0x130f('0x38')]=_0x2e4e0f;if(_0x3eb6f8[_0x130f('0x38')]['length']>0x0){_0x4110c9(_0x3eb6f8);}else{if(_0x34f09d==![]){_0x4110c9();}else{_0x4110c9(_0x3eb6f8);}}});}});} \ No newline at end of file +var _0x49fb=['../../components/integrations/configuration','sendStatus','status','undefined','limit','offset','count','set','json','save','then','destroy','end','stack','name','index','map','ServicenowAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','findOne','ServicenowConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ServicenowField','Descriptions','getFields','knowledge','subcategory','close_code','incident_state','severity','category','caused_by','watch_list','sys_updated_on','hold_reason','approval_history','number','resolved_by','sys_updated_by','opened_by','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','delivery_plan','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','opened_at','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','problem_id','company','activity_due','assigned_to','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','remoteUri','serverUrl','substring','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','log','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','concat','ServiceNow\x20error:\x20','statusCode','error','send','test','Wrong\x20credentials','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util'];(function(_0x3df568,_0x3de3b3){var _0x451540=function(_0x3ccffd){while(--_0x3ccffd){_0x3df568['push'](_0x3df568['shift']());}};_0x451540(++_0x3de3b3);}(_0x49fb,0xa2));var _0xb49f=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x49fb[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0xb49f('0x0'));var rimraf=require(_0xb49f('0x1'));var zipdir=require(_0xb49f('0x2'));var jsonpatch=require(_0xb49f('0x3'));var rp=require(_0xb49f('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb49f('0x5'));var path=require(_0xb49f('0x6'));var sox=require('sox');var csv=require(_0xb49f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb49f('0x8'));var _=require(_0xb49f('0x9'));var squel=require(_0xb49f('0xa'));var crypto=require(_0xb49f('0xb'));var jsforce=require(_0xb49f('0xc'));var deskjs=require(_0xb49f('0xd'));var toCsv=require(_0xb49f('0x7'));var querystring=require(_0xb49f('0xe'));var Papa=require(_0xb49f('0xf'));var Redis=require(_0xb49f('0x10'));var authService=require(_0xb49f('0x11'));var qs=require(_0xb49f('0x12'));var as=require(_0xb49f('0x13'));var hardwareService=require(_0xb49f('0x14'));var logger=require(_0xb49f('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb49f('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xb49f('0x17'));function respondWithStatusCode(_0x2b5a3a,_0x4e9b91){_0x4e9b91=_0x4e9b91||0xcc;return function(_0x2c9004){if(_0x2c9004){return _0x2b5a3a[_0xb49f('0x18')](_0x4e9b91);}return _0x2b5a3a[_0xb49f('0x19')](_0x4e9b91)['end']();};}function respondWithResult(_0x53df85,_0x23cbdd){_0x23cbdd=_0x23cbdd||0xc8;return function(_0x4960b3){if(_0x4960b3){return _0x53df85[_0xb49f('0x19')](_0x23cbdd)['json'](_0x4960b3);}};}function respondWithFilteredResult(_0x443229,_0x544f21){return function(_0xd7ec12){if(_0xd7ec12){var _0x7e2f80=typeof _0x544f21['offset']===_0xb49f('0x1a')&&typeof _0x544f21[_0xb49f('0x1b')]===_0xb49f('0x1a');var _0x5f3bda=_0xd7ec12['count'];var _0x3eef40=_0x7e2f80?0x0:_0x544f21[_0xb49f('0x1c')];var _0x27bdcb=_0x7e2f80?_0xd7ec12[_0xb49f('0x1d')]:_0x544f21[_0xb49f('0x1c')]+_0x544f21[_0xb49f('0x1b')];var _0x218d3e;if(_0x27bdcb>=_0x5f3bda){_0x27bdcb=_0x5f3bda;_0x218d3e=0xc8;}else{_0x218d3e=0xce;}_0x443229[_0xb49f('0x19')](_0x218d3e);return _0x443229[_0xb49f('0x1e')]('Content-Range',_0x3eef40+'-'+_0x27bdcb+'/'+_0x5f3bda)[_0xb49f('0x1f')](_0xd7ec12);}return null;};}function patchUpdates(_0x418953){return function(_0x5717ba){try{jsonpatch['apply'](_0x5717ba,_0x418953,!![]);}catch(_0x588276){return BPromise['reject'](_0x588276);}return _0x5717ba[_0xb49f('0x20')]();};}function saveUpdates(_0x34fd4f,_0x2fdfb1){return function(_0x1cd084){if(_0x1cd084){return _0x1cd084['update'](_0x34fd4f)[_0xb49f('0x21')](function(_0x357a14){return _0x357a14;});}return null;};}function removeEntity(_0x4bf46f,_0x127bc9){return function(_0x57e300){if(_0x57e300){return _0x57e300[_0xb49f('0x22')]()[_0xb49f('0x21')](function(){_0x4bf46f[_0xb49f('0x19')](0xcc)[_0xb49f('0x23')]();});}};}function handleEntityNotFound(_0x5f193f,_0x409aeb){return function(_0x525469){if(!_0x525469){_0x5f193f[_0xb49f('0x18')](0x194);}return _0x525469;};}function handleError(_0x124def,_0x3eaff5){_0x3eaff5=_0x3eaff5||0x1f4;return function(_0x1b1d85){logger['error'](_0x1b1d85[_0xb49f('0x24')]);if(_0x1b1d85['name']){delete _0x1b1d85[_0xb49f('0x25')];}_0x124def[_0xb49f('0x19')](_0x3eaff5)['send'](_0x1b1d85);};}exports[_0xb49f('0x26')]=function(_0x29d04a,_0x3693f0){var _0x51784b={},_0x39fe16={},_0x271a1c={'count':0x0,'rows':[]};var _0x557c4b=_[_0xb49f('0x27')](db[_0xb49f('0x28')][_0xb49f('0x29')],function(_0x4f6776){return{'name':_0x4f6776[_0xb49f('0x2a')],'type':_0x4f6776['type']['key']};});_0x39fe16[_0xb49f('0x2b')]=_[_0xb49f('0x27')](_0x557c4b,'name');_0x39fe16[_0xb49f('0x2c')]=_[_0xb49f('0x2d')](_0x29d04a[_0xb49f('0x2c')]);_0x39fe16[_0xb49f('0x2e')]=_[_0xb49f('0x2f')](_0x39fe16[_0xb49f('0x2b')],_0x39fe16[_0xb49f('0x2c')]);_0x51784b[_0xb49f('0x30')]=_[_0xb49f('0x2f')](_0x39fe16[_0xb49f('0x2b')],qs[_0xb49f('0x31')](_0x29d04a[_0xb49f('0x2c')][_0xb49f('0x31')]));_0x51784b[_0xb49f('0x30')]=_0x51784b['attributes'][_0xb49f('0x32')]?_0x51784b['attributes']:_0x39fe16[_0xb49f('0x2b')];if(!_0x29d04a[_0xb49f('0x2c')][_0xb49f('0x33')](_0xb49f('0x34'))){_0x51784b[_0xb49f('0x1b')]=qs['limit'](_0x29d04a[_0xb49f('0x2c')][_0xb49f('0x1b')]);_0x51784b[_0xb49f('0x1c')]=qs['offset'](_0x29d04a['query'][_0xb49f('0x1c')]);}_0x51784b[_0xb49f('0x35')]=qs[_0xb49f('0x36')](_0x29d04a[_0xb49f('0x2c')][_0xb49f('0x36')]);_0x51784b[_0xb49f('0x37')]=qs[_0xb49f('0x2e')](_[_0xb49f('0x38')](_0x29d04a[_0xb49f('0x2c')],_0x39fe16['filters']),_0x557c4b);if(_0x29d04a[_0xb49f('0x2c')][_0xb49f('0x39')]){_0x51784b['where']=_['merge'](_0x51784b[_0xb49f('0x37')],{'$or':_['map'](_0x557c4b,function(_0x2d146e){if(_0x2d146e[_0xb49f('0x3a')]!==_0xb49f('0x3b')){var _0x13a644={};_0x13a644[_0x2d146e[_0xb49f('0x25')]]={'$like':'%'+_0x29d04a[_0xb49f('0x2c')][_0xb49f('0x39')]+'%'};return _0x13a644;}})});}_0x51784b=_['merge']({},_0x51784b,_0x29d04a[_0xb49f('0x3c')]);var _0x1127b8={'where':_0x51784b[_0xb49f('0x37')]};return db[_0xb49f('0x28')][_0xb49f('0x1d')](_0x1127b8)[_0xb49f('0x21')](function(_0x4d0a2f){_0x271a1c[_0xb49f('0x1d')]=_0x4d0a2f;if(_0x29d04a[_0xb49f('0x2c')][_0xb49f('0x3d')]){_0x51784b[_0xb49f('0x3e')]=[{'all':!![]}];}return db[_0xb49f('0x28')][_0xb49f('0x3f')](_0x51784b);})[_0xb49f('0x21')](function(_0x3e8fdd){_0x271a1c[_0xb49f('0x40')]=_0x3e8fdd;return _0x271a1c;})[_0xb49f('0x21')](respondWithFilteredResult(_0x3693f0,_0x51784b))[_0xb49f('0x41')](handleError(_0x3693f0,null));};exports[_0xb49f('0x42')]=function(_0x188902,_0x369a67){var _0x5512a5={'raw':![],'where':{'id':_0x188902[_0xb49f('0x43')]['id']}},_0x1341e0={};_0x1341e0[_0xb49f('0x2b')]=_[_0xb49f('0x2d')](db[_0xb49f('0x28')][_0xb49f('0x29')]);_0x1341e0[_0xb49f('0x2c')]=_[_0xb49f('0x2d')](_0x188902[_0xb49f('0x2c')]);_0x1341e0[_0xb49f('0x2e')]=_[_0xb49f('0x2f')](_0x1341e0[_0xb49f('0x2b')],_0x1341e0[_0xb49f('0x2c')]);_0x5512a5[_0xb49f('0x30')]=_[_0xb49f('0x2f')](_0x1341e0[_0xb49f('0x2b')],qs[_0xb49f('0x31')](_0x188902[_0xb49f('0x2c')][_0xb49f('0x31')]));_0x5512a5[_0xb49f('0x30')]=_0x5512a5[_0xb49f('0x30')][_0xb49f('0x32')]?_0x5512a5[_0xb49f('0x30')]:_0x1341e0[_0xb49f('0x2b')];if(_0x188902[_0xb49f('0x2c')][_0xb49f('0x3d')]){_0x5512a5[_0xb49f('0x3e')]=[{'all':!![]}];}_0x5512a5=_[_0xb49f('0x44')]({},_0x5512a5,_0x188902[_0xb49f('0x3c')]);return db['ServicenowAccount'][_0xb49f('0x45')](_0x5512a5)[_0xb49f('0x21')](handleEntityNotFound(_0x369a67,null))['then'](respondWithResult(_0x369a67,null))['catch'](handleError(_0x369a67,null));};exports[_0xb49f('0x46')]=function(_0x5a281a,_0x1e808d){return db[_0xb49f('0x28')][_0xb49f('0x46')](_0x5a281a['body'],{})[_0xb49f('0x21')](respondWithResult(_0x1e808d,0xc9))[_0xb49f('0x41')](handleError(_0x1e808d,null));};exports['update']=function(_0x311e4e,_0x42c6a5){if(_0x311e4e[_0xb49f('0x47')]['id']){delete _0x311e4e[_0xb49f('0x47')]['id'];}return db[_0xb49f('0x28')]['find']({'where':{'id':_0x311e4e[_0xb49f('0x43')]['id']}})[_0xb49f('0x21')](handleEntityNotFound(_0x42c6a5,null))[_0xb49f('0x21')](saveUpdates(_0x311e4e['body'],null))[_0xb49f('0x21')](respondWithResult(_0x42c6a5,null))[_0xb49f('0x41')](handleError(_0x42c6a5,null));};exports['destroy']=function(_0x36c241,_0x480815){return db['ServicenowAccount'][_0xb49f('0x45')]({'where':{'id':_0x36c241[_0xb49f('0x43')]['id']}})['then'](handleEntityNotFound(_0x480815,null))[_0xb49f('0x21')](removeEntity(_0x480815,null))[_0xb49f('0x41')](handleError(_0x480815,null));};exports['getConfigurations']=function(_0xc30648,_0x487823,_0xa30f44){var _0xada931={};var _0x41c206={};var _0x2b0905;var _0x29cd81;return db[_0xb49f('0x28')][_0xb49f('0x48')]({'where':{'id':_0xc30648['params']['id']}})[_0xb49f('0x21')](handleEntityNotFound(_0x487823,null))[_0xb49f('0x21')](function(_0x47ba02){if(_0x47ba02){_0x2b0905=_0x47ba02;_0x41c206[_0xb49f('0x2b')]=_['keys'](db[_0xb49f('0x49')][_0xb49f('0x29')]);_0x41c206[_0xb49f('0x2c')]=_['keys'](_0xc30648[_0xb49f('0x2c')]);_0x41c206['filters']=_['intersection'](_0x41c206['model'],_0x41c206[_0xb49f('0x2c')]);_0xada931['attributes']=_['intersection'](_0x41c206[_0xb49f('0x2b')],qs[_0xb49f('0x31')](_0xc30648[_0xb49f('0x2c')][_0xb49f('0x31')]));_0xada931[_0xb49f('0x30')]=_0xada931[_0xb49f('0x30')][_0xb49f('0x32')]?_0xada931[_0xb49f('0x30')]:_0x41c206[_0xb49f('0x2b')];_0xada931[_0xb49f('0x35')]=qs['sort'](_0xc30648[_0xb49f('0x2c')][_0xb49f('0x36')]);_0xada931['where']=qs[_0xb49f('0x2e')](_[_0xb49f('0x38')](_0xc30648[_0xb49f('0x2c')],_0x41c206[_0xb49f('0x2e')]));if(_0xc30648[_0xb49f('0x2c')][_0xb49f('0x39')]){_0xada931['where']=_[_0xb49f('0x44')](_0xada931['where'],{'$or':_[_0xb49f('0x27')](_0xada931[_0xb49f('0x30')],function(_0x435a19){var _0x3c503a={};_0x3c503a[_0x435a19]={'$like':'%'+_0xc30648[_0xb49f('0x2c')]['filter']+'%'};return _0x3c503a;})});}_0xada931=_[_0xb49f('0x44')]({},_0xada931,_0xc30648['options']);return _0x2b0905[_0xb49f('0x4a')](_0xada931);}})[_0xb49f('0x21')](function(_0x17cb30){if(_0x17cb30){_0x29cd81=_0x17cb30[_0xb49f('0x32')];if(!_0xc30648[_0xb49f('0x2c')][_0xb49f('0x33')]('nolimit')){_0xada931[_0xb49f('0x1b')]=qs[_0xb49f('0x1b')](_0xc30648['query'][_0xb49f('0x1b')]);_0xada931[_0xb49f('0x1c')]=qs[_0xb49f('0x1c')](_0xc30648[_0xb49f('0x2c')][_0xb49f('0x1c')]);}return _0x2b0905[_0xb49f('0x4a')](_0xada931);}})[_0xb49f('0x21')](function(_0x4bfea5){if(_0x4bfea5){return _0x4bfea5?{'count':_0x29cd81,'rows':_0x4bfea5}:null;}})[_0xb49f('0x21')](respondWithResult(_0x487823,null))[_0xb49f('0x41')](handleError(_0x487823,null));};exports[_0xb49f('0x4b')]=function(_0x5a175b,_0x191270,_0x31a9d8){if(_0x5a175b[_0xb49f('0x47')]['id']){delete _0x5a175b[_0xb49f('0x47')]['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x5a175b[_0xb49f('0x43')]['id']}})['then'](handleEntityNotFound(_0x191270,null))[_0xb49f('0x21')](function(_0x5e42c9){if(_0x5e42c9){_0x5a175b[_0xb49f('0x47')][_0xb49f('0x4c')]=_0x5e42c9['id'];_0x5a175b[_0xb49f('0x47')][_0xb49f('0x4d')]=integrations[_0xb49f('0x4e')](_0x5a175b[_0xb49f('0x47')][_0xb49f('0x4f')],_0x5a175b[_0xb49f('0x47')]['type']);_0x5a175b['body']['Descriptions']=integrations[_0xb49f('0x50')](_0x5a175b[_0xb49f('0x47')]['channel'],_0x5a175b[_0xb49f('0x47')]['type']);return db[_0xb49f('0x49')][_0xb49f('0x46')](_0x5a175b[_0xb49f('0x47')],{'include':[{'model':db[_0xb49f('0x51')],'as':_0xb49f('0x4d')},{'model':db['ServicenowField'],'as':_0xb49f('0x52')}]});}return null;})[_0xb49f('0x21')](respondWithResult(_0x191270,null))[_0xb49f('0x41')](handleError(_0x191270,null));};exports[_0xb49f('0x53')]=function(_0x3cd4c6,_0x1be5e7,_0x362a8b){var _0x676c3f=['made_sla','hold_reason',_0xb49f('0x54'),_0xb49f('0x55'),_0xb49f('0x56'),'notify',_0xb49f('0x57'),_0xb49f('0x58'),_0xb49f('0x59')];var _0x481d96=['parent','made_sla',_0xb49f('0x5a'),_0xb49f('0x5b'),'upon_reject',_0xb49f('0x5c'),'child_incidents',_0xb49f('0x5d'),_0xb49f('0x5e'),_0xb49f('0x5f'),_0xb49f('0x60'),_0xb49f('0x61'),_0xb49f('0x62'),'user_input',_0xb49f('0x63'),_0xb49f('0x64'),_0xb49f('0x65'),_0xb49f('0x66'),_0xb49f('0x54'),'order',_0xb49f('0x67'),'closed_at','cmdb_ci',_0xb49f('0x68'),'impact',_0xb49f('0x69'),_0xb49f('0x6a'),_0xb49f('0x6b'),_0xb49f('0x6c'),_0xb49f('0x6d'),_0xb49f('0x6e'),_0xb49f('0x6f'),'expected_start',_0xb49f('0x70'),'business_duration','group_list','work_end',_0xb49f('0x71'),_0xb49f('0x72'),_0xb49f('0x73'),_0xb49f('0x74'),_0xb49f('0x55'),_0xb49f('0x75'),_0xb49f('0x76'),'close_code',_0xb49f('0x77'),'delivery_task',_0xb49f('0x78'),_0xb49f('0x79'),_0xb49f('0x7a'),_0xb49f('0x7b'),_0xb49f('0x7c'),_0xb49f('0x7d'),'notify',_0xb49f('0x7e'),_0xb49f('0x7f'),_0xb49f('0x80'),_0xb49f('0x81'),_0xb49f('0x82'),_0xb49f('0x83'),_0xb49f('0x84'),_0xb49f('0x85'),_0xb49f('0x57'),'urgency',_0xb49f('0x86'),_0xb49f('0x87'),'reassignment_count',_0xb49f('0x88'),_0xb49f('0x89'),_0xb49f('0x58'),'comments',_0xb49f('0x8a'),_0xb49f('0x8b'),_0xb49f('0x8c'),_0xb49f('0x8d'),_0xb49f('0x8e'),_0xb49f('0x8f'),_0xb49f('0x90'),_0xb49f('0x91'),_0xb49f('0x92'),_0xb49f('0x93'),_0xb49f('0x94'),'category'];var _0x452317='';var _0x2b88fe='';var _0x17f122=[];var _0x3e3167='';var _0x5bc5a4='';var _0xc5a3e=[];var _0x3e669d='';var _0xa7f904='';var _0x581006={};var _0xfa629e='';return db[_0xb49f('0x28')][_0xb49f('0x48')]({'where':{'id':_0x3cd4c6[_0xb49f('0x43')]['id']},'attributes':['id',_0xb49f('0x95'),_0xb49f('0x96'),'email',_0xb49f('0x97'),_0xb49f('0x98')]})['then'](handleEntityNotFound(_0x1be5e7,null))['then'](function(_0x38f8b0){if(_0x38f8b0){_0xfa629e=_0x38f8b0['remoteUri'];var _0x4b7542=_0xfa629e['slice'](-0x1);if(_0x4b7542==='/'){_0xfa629e=_0xfa629e[_0xb49f('0x99')](0x0,_0xfa629e['lastIndexOf'](_0x4b7542));}_0xa7f904=util[_0xb49f('0x9a')]('%s/api/now/doc/table/schema/',_0xfa629e);_0x3e669d=util[_0xb49f('0x9a')](_0xb49f('0x9b'),_0xfa629e);_0x581006={'user':_0x38f8b0['username'],'pass':_0x38f8b0[_0xb49f('0x96')]};var _0x272989={'method':_0xb49f('0x9c'),'uri':_0xa7f904+_0xb49f('0x9d'),'auth':_0x581006,'json':!![]};return rp(_0x272989);}})[_0xb49f('0x21')](function(_0x4852a4){if(_0x4852a4[_0xb49f('0x9e')][_0xb49f('0x32')]>0x0){_0x452317=_0x4852a4[_0xb49f('0x9e')];}console['log'](_0xb49f('0x9f'),_0x452317);_0xc5a3e=[];_0x2b88fe=Object[_0xb49f('0xa0')]([],_0x452317);_[_0xb49f('0xa1')](_0x2b88fe,function(_0x2fc137){return!_0x676c3f[_0xb49f('0xa2')](_0x2fc137[_0xb49f('0x25')]);});_0x2b88fe[_0xb49f('0xa3')](function(_0x11f18a){var _0x572e5f=createFieldObject(_0x3e669d,_0x581006,_0x11f18a[_0xb49f('0xa4')],_0x11f18a[_0xb49f('0x25')],_0x11f18a[_0xb49f('0xa5')],![]);_0xc5a3e[_0xb49f('0xa6')](_0x572e5f);});return Promise['all'](_0xc5a3e);})['then'](function(_0x2543da){_0x17f122=_0x2543da;_0x3e3167=Object['assign']([],_0x452317);console[_0xb49f('0xa7')](_0xb49f('0xa8'),_0x452317);_[_0xb49f('0xa1')](_0x3e3167,function(_0x235b1a){return _0x481d96[_0xb49f('0xa2')](_0x235b1a['name']);});console[_0xb49f('0xa7')](_0xb49f('0xa9'),_0x3e3167);_0xc5a3e=[];_0x3e3167[_0xb49f('0xa3')](function(_0x2347ba){var _0x4f09c6=createFieldObject(_0x3e669d,_0x581006,_0x2347ba[_0xb49f('0xa4')],_0x2347ba[_0xb49f('0x25')],_0x2347ba[_0xb49f('0xa5')],!![]);_0xc5a3e['push'](_0x4f09c6);});return Promise[_0xb49f('0xaa')](_0xc5a3e);})[_0xb49f('0x21')](function(_0x4d951c){_0x5bc5a4=_0x4d951c;var _0x222285=_0x17f122[_0xb49f('0xab')](_0x5bc5a4);return{'count':_0x222285[_0xb49f('0x32')],'rows':_0x222285};})[_0xb49f('0x21')](respondWithResult(_0x1be5e7,null))['catch'](function(_0x3f9847){console[_0xb49f('0xa7')](_0xb49f('0xac')+_0x3f9847);var _0x60d3b2=_0x3cd4c6['query']['test']?0x1f4:_0x3f9847[_0xb49f('0xad')]||0x1f4;logger[_0xb49f('0xae')](_0x3f9847[_0xb49f('0x24')]);delete _0x3f9847[_0xb49f('0x25')];if(_0x60d3b2===0x191){_0x60d3b2=0x190;}_0x1be5e7['status'](_0x60d3b2)[_0xb49f('0xaf')](_0x3cd4c6[_0xb49f('0x2c')][_0xb49f('0xb0')]?{'message':_0xb49f('0xb1'),'statusCode':_0x3f9847['statusCode']}:_0x3f9847);});};function createFieldObject(_0x1112c2,_0x4ee10b,_0x152710,_0x3af4dc,_0x519bc0,_0x93f9c2){return new Promise(function(_0x3105a9,_0x85e1c){var _0xe85bc0={'id':_0x3af4dc,'name':_0x519bc0,'custom':_0x93f9c2};if(_0x152710==='boolean'){_0xe85bc0[_0xb49f('0x3c')]=[{'name':_0xb49f('0xb2'),'value':_0xb49f('0xb3')},{'name':_0xb49f('0xb4'),'value':_0xb49f('0xb5')}];_0x3105a9(_0xe85bc0);}else{var _0x2a9a3d={'method':_0xb49f('0x9c'),'uri':_0x1112c2+_0xb49f('0xb6')+_0x3af4dc,'auth':_0x4ee10b,'json':!![]};return rp(_0x2a9a3d)[_0xb49f('0x21')](function(_0x27616d){var _0x40e53b=[];if(_0x27616d[_0xb49f('0x9e')]['length']>0x0){_0x27616d[_0xb49f('0x9e')][_0xb49f('0xa3')](function(_0x4a5c95){if(_0x4a5c95[_0xb49f('0xb7')]===_0xb49f('0xb5')){var _0x363e18={'name':_0x4a5c95[_0xb49f('0xa5')],'value':_0x4a5c95[_0xb49f('0xb8')]};_0x40e53b[_0xb49f('0xa6')](_0x363e18);}});}_0xe85bc0[_0xb49f('0x3c')]=_0x40e53b;if(_0xe85bc0['options'][_0xb49f('0x32')]>0x0){_0x3105a9(_0xe85bc0);}else{if(_0x93f9c2==![]){_0x3105a9();}else{_0x3105a9(_0xe85bc0);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index d4dad31..cff4f87 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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','lodash','util'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x7a54,0x106));var _0x47a5=function(_0x3bb181,_0x39c533){_0x3bb181=_0x3bb181-0x0;var _0x1405b1=_0x7a54[_0x3bb181];return _0x1405b1;};'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'));var integrations=require(_0x47a5('0x9'));module['exports']=function(_0x3d5629,_0x59199c){return _0x3d5629[_0x47a5('0xa')](_0x47a5('0xb'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','util','moment'];(function(_0x4285f2,_0x4342b1){var _0x5a3014=function(_0x5f20bf){while(--_0x5f20bf){_0x4285f2['push'](_0x4285f2['shift']());}};_0x5a3014(++_0x4342b1);}(_0xe14b,0x93));var _0xbe14=function(_0x325957,_0x48a222){_0x325957=_0x325957-0x0;var _0xbb84a9=_0xe14b[_0x325957];return _0xbb84a9;};'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'));var integrations=require(_0xbe14('0x6'));module[_0xbe14('0x7')]=function(_0x1ff100,_0x1d9ade){return _0x1ff100[_0xbe14('0x8')](_0xbe14('0x9'),attributes,{'tableName':'int_servicenow_accounts','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 fa85067..8193634 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 _0x9200=['util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','client','request','then','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowAccount,\x20%s,\x20%s','info','request\x20sent','result','catch','GetServicenowAccount','findAll','options','where','attributes','limit','include','model','map','ShowServicenowAccount','ServicenowAccount','find'];(function(_0x4c6144,_0x58925a){var _0xe92275=function(_0x16a90d){while(--_0x16a90d){_0x4c6144['push'](_0x4c6144['shift']());}};_0xe92275(++_0x58925a);}(_0x9200,0x1ce));var _0x0920=function(_0xca485f,_0xfc3a89){_0xca485f=_0xca485f-0x0;var _0x3df755=_0x9200[_0xca485f];return _0x3df755;};'use strict';var _=require('lodash');var util=require(_0x0920('0x0'));var moment=require(_0x0920('0x1'));var BPromise=require(_0x0920('0x2'));var rs=require(_0x0920('0x3'));var fs=require('fs');var Redis=require(_0x0920('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0920('0x5'));var logger=require('../../config/logger')(_0x0920('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0920('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2313a8,_0x45358c,_0xfc5f0a){return new BPromise(function(_0x10481e,_0x2b8326){return client[_0x0920('0x8')](_0x2313a8,_0xfc5f0a)[_0x0920('0x9')](function(_0x39321c){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x45358c,'request\x20sent');logger[_0x0920('0xa')](_0x0920('0xb'),_0x45358c,'request\x20sent',JSON[_0x0920('0xc')](_0x39321c));if(_0x39321c[_0x0920('0xd')]){if(_0x39321c[_0x0920('0xd')][_0x0920('0xe')]===0x1f4){logger[_0x0920('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x45358c,_0x39321c[_0x0920('0xd')][_0x0920('0xf')]);return _0x2b8326(_0x39321c[_0x0920('0xd')]['message']);}logger[_0x0920('0xd')](_0x0920('0x10'),_0x45358c,_0x39321c['error'][_0x0920('0xf')]);return _0x10481e(_0x39321c[_0x0920('0xd')][_0x0920('0xf')]);}else{logger[_0x0920('0x11')](_0x0920('0x10'),_0x45358c,_0x0920('0x12'));_0x10481e(_0x39321c[_0x0920('0x13')]['message']);}})[_0x0920('0x14')](function(_0x24ad3c){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x45358c,_0x24ad3c);_0x2b8326(_0x24ad3c);});});}exports[_0x0920('0x15')]=function(_0xd8f474){var _0x834d43=this;return new Promise(function(_0x2b148a,_0x1d607a){return db['ServicenowAccount'][_0x0920('0x16')]({'raw':_0xd8f474['options']?_0xd8f474[_0x0920('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xd8f474[_0x0920('0x17')]?_0xd8f474['options'][_0x0920('0x18')]||null:null,'attributes':_0xd8f474['options']?_0xd8f474['options'][_0x0920('0x19')]||null:null,'limit':_0xd8f474['options']?_0xd8f474[_0x0920('0x17')][_0x0920('0x1a')]||null:null,'include':_0xd8f474['options']?_0xd8f474[_0x0920('0x17')][_0x0920('0x1b')]?_['map'](_0xd8f474[_0x0920('0x17')][_0x0920('0x1b')],function(_0x27a7cc){return{'model':db[_0x27a7cc[_0x0920('0x1c')]],'as':_0x27a7cc['as'],'attributes':_0x27a7cc['attributes'],'include':_0x27a7cc[_0x0920('0x1b')]?_[_0x0920('0x1d')](_0x27a7cc[_0x0920('0x1b')],function(_0x5aa232){return{'model':db[_0x5aa232[_0x0920('0x1c')]],'as':_0x5aa232['as'],'attributes':_0x5aa232['attributes'],'include':_0x5aa232[_0x0920('0x1b')]?_[_0x0920('0x1d')](_0x5aa232[_0x0920('0x1b')],function(_0x252202){return{'model':db[_0x252202[_0x0920('0x1c')]],'as':_0x252202['as'],'attributes':_0x252202[_0x0920('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46061f){logger[_0x0920('0x11')](_0x0920('0x15'),_0xd8f474);logger[_0x0920('0xa')](_0x0920('0x15'),_0xd8f474,JSON[_0x0920('0xc')](_0x46061f));_0x2b148a(_0x46061f);})['catch'](function(_0x254c31){logger['error'](_0x0920('0x15'),_0x254c31['message'],_0xd8f474);_0x1d607a(_0x834d43['error'](0x1f4,_0x254c31[_0x0920('0xf')]));});});};exports[_0x0920('0x1e')]=function(_0x48cc7c){var _0x35da2e=this;return new Promise(function(_0x276d67,_0x5d8316){return db[_0x0920('0x1f')][_0x0920('0x20')]({'raw':_0x48cc7c[_0x0920('0x17')]?_0x48cc7c[_0x0920('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x48cc7c[_0x0920('0x17')]?_0x48cc7c[_0x0920('0x17')][_0x0920('0x18')]||null:null,'attributes':_0x48cc7c[_0x0920('0x17')]?_0x48cc7c['options']['attributes']||null:null,'include':_0x48cc7c[_0x0920('0x17')]?_0x48cc7c[_0x0920('0x17')]['include']?_[_0x0920('0x1d')](_0x48cc7c['options'][_0x0920('0x1b')],function(_0xfaf829){return{'model':db[_0xfaf829[_0x0920('0x1c')]],'as':_0xfaf829['as'],'attributes':_0xfaf829[_0x0920('0x19')],'include':_0xfaf829[_0x0920('0x1b')]?_[_0x0920('0x1d')](_0xfaf829[_0x0920('0x1b')],function(_0x3d77cc){return{'model':db[_0x3d77cc[_0x0920('0x1c')]],'as':_0x3d77cc['as'],'attributes':_0x3d77cc['attributes'],'include':_0x3d77cc[_0x0920('0x1b')]?_[_0x0920('0x1d')](_0x3d77cc[_0x0920('0x1b')],function(_0x319ada){return{'model':db[_0x319ada['model']],'as':_0x319ada['as'],'attributes':_0x319ada['attributes']};}):[]};}):[]};}):[]:[]})[_0x0920('0x9')](function(_0x3ef3d1){logger[_0x0920('0x11')](_0x0920('0x1e'),_0x48cc7c);logger[_0x0920('0xa')](_0x0920('0x1e'),_0x48cc7c,JSON[_0x0920('0xc')](_0x3ef3d1));_0x276d67(_0x3ef3d1);})[_0x0920('0x14')](function(_0x314541){logger[_0x0920('0xd')](_0x0920('0x1e'),_0x314541[_0x0920('0xf')],_0x48cc7c);_0x5d8316(_0x35da2e[_0x0920('0xd')](0x1f4,_0x314541['message']));});});}; \ No newline at end of file +var _0x98e8=['message','info','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowServicenowAccount','find','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','error','code','ServicenowAccount,\x20%s,\x20%s'];(function(_0x591f11,_0x434242){var _0x3ba1db=function(_0x26f4bc){while(--_0x26f4bc){_0x591f11['push'](_0x591f11['shift']());}};_0x3ba1db(++_0x434242);}(_0x98e8,0x10e));var _0x898e=function(_0x219fcf,_0x228f59){_0x219fcf=_0x219fcf-0x0;var _0x857eb7=_0x98e8[_0x219fcf];return _0x857eb7;};'use strict';var _=require(_0x898e('0x0'));var util=require(_0x898e('0x1'));var moment=require(_0x898e('0x2'));var BPromise=require(_0x898e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x898e('0x4'));var db=require(_0x898e('0x5'))['db'];var utils=require(_0x898e('0x6'));var logger=require('../../config/logger')(_0x898e('0x7'));var config=require(_0x898e('0x8'));var jayson=require(_0x898e('0x9'));var client=jayson[_0x898e('0xa')][_0x898e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1dfbe8,_0x3948a9,_0x4410aa){return new BPromise(function(_0x1e9ad6,_0x4bed28){return client[_0x898e('0xc')](_0x1dfbe8,_0x4410aa)[_0x898e('0xd')](function(_0x415922){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x3948a9,_0x898e('0xe'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x3948a9,_0x898e('0xe'),JSON['stringify'](_0x415922));if(_0x415922[_0x898e('0xf')]){if(_0x415922[_0x898e('0xf')][_0x898e('0x10')]===0x1f4){logger[_0x898e('0xf')](_0x898e('0x11'),_0x3948a9,_0x415922[_0x898e('0xf')][_0x898e('0x12')]);return _0x4bed28(_0x415922[_0x898e('0xf')]['message']);}logger[_0x898e('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x3948a9,_0x415922['error']['message']);return _0x1e9ad6(_0x415922[_0x898e('0xf')][_0x898e('0x12')]);}else{logger[_0x898e('0x13')](_0x898e('0x11'),_0x3948a9,'request\x20sent');_0x1e9ad6(_0x415922['result'][_0x898e('0x12')]);}})[_0x898e('0x14')](function(_0x5b6fbd){logger[_0x898e('0xf')](_0x898e('0x11'),_0x3948a9,_0x5b6fbd);_0x4bed28(_0x5b6fbd);});});}exports[_0x898e('0x15')]=function(_0x1f73d6){var _0x2ef986=this;return new Promise(function(_0x196926,_0x259f35){return db[_0x898e('0x16')][_0x898e('0x17')]({'raw':_0x1f73d6[_0x898e('0x18')]?_0x1f73d6[_0x898e('0x18')][_0x898e('0x19')]===undefined?!![]:![]:!![],'where':_0x1f73d6[_0x898e('0x18')]?_0x1f73d6['options'][_0x898e('0x1a')]||null:null,'attributes':_0x1f73d6[_0x898e('0x18')]?_0x1f73d6[_0x898e('0x18')][_0x898e('0x1b')]||null:null,'limit':_0x1f73d6[_0x898e('0x18')]?_0x1f73d6[_0x898e('0x18')][_0x898e('0x1c')]||null:null,'include':_0x1f73d6[_0x898e('0x18')]?_0x1f73d6['options'][_0x898e('0x1d')]?_[_0x898e('0x1e')](_0x1f73d6[_0x898e('0x18')][_0x898e('0x1d')],function(_0x438fad){return{'model':db[_0x438fad[_0x898e('0x1f')]],'as':_0x438fad['as'],'attributes':_0x438fad[_0x898e('0x1b')],'include':_0x438fad[_0x898e('0x1d')]?_['map'](_0x438fad[_0x898e('0x1d')],function(_0x160433){return{'model':db[_0x160433['model']],'as':_0x160433['as'],'attributes':_0x160433['attributes'],'include':_0x160433[_0x898e('0x1d')]?_[_0x898e('0x1e')](_0x160433[_0x898e('0x1d')],function(_0x3e30c3){return{'model':db[_0x3e30c3[_0x898e('0x1f')]],'as':_0x3e30c3['as'],'attributes':_0x3e30c3[_0x898e('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43f431){logger[_0x898e('0x13')](_0x898e('0x15'),_0x1f73d6);logger['debug'](_0x898e('0x15'),_0x1f73d6,JSON[_0x898e('0x20')](_0x43f431));_0x196926(_0x43f431);})[_0x898e('0x14')](function(_0x407516){logger[_0x898e('0xf')]('GetServicenowAccount',_0x407516[_0x898e('0x12')],_0x1f73d6);_0x259f35(_0x2ef986[_0x898e('0xf')](0x1f4,_0x407516[_0x898e('0x12')]));});});};exports[_0x898e('0x21')]=function(_0x5c685c){var _0x41673c=this;return new Promise(function(_0x3827b6,_0x401026){return db[_0x898e('0x16')][_0x898e('0x22')]({'raw':_0x5c685c[_0x898e('0x18')]?_0x5c685c[_0x898e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5c685c[_0x898e('0x18')]?_0x5c685c[_0x898e('0x18')][_0x898e('0x1a')]||null:null,'attributes':_0x5c685c[_0x898e('0x18')]?_0x5c685c[_0x898e('0x18')][_0x898e('0x1b')]||null:null,'include':_0x5c685c['options']?_0x5c685c[_0x898e('0x18')][_0x898e('0x1d')]?_[_0x898e('0x1e')](_0x5c685c[_0x898e('0x18')]['include'],function(_0x488e03){return{'model':db[_0x488e03[_0x898e('0x1f')]],'as':_0x488e03['as'],'attributes':_0x488e03[_0x898e('0x1b')],'include':_0x488e03[_0x898e('0x1d')]?_[_0x898e('0x1e')](_0x488e03[_0x898e('0x1d')],function(_0x42fdb0){return{'model':db[_0x42fdb0['model']],'as':_0x42fdb0['as'],'attributes':_0x42fdb0[_0x898e('0x1b')],'include':_0x42fdb0[_0x898e('0x1d')]?_['map'](_0x42fdb0['include'],function(_0x47c1a6){return{'model':db[_0x47c1a6[_0x898e('0x1f')]],'as':_0x47c1a6['as'],'attributes':_0x47c1a6[_0x898e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x898e('0xd')](function(_0x5ed63f){logger[_0x898e('0x13')](_0x898e('0x21'),_0x5c685c);logger[_0x898e('0x23')](_0x898e('0x21'),_0x5c685c,JSON[_0x898e('0x20')](_0x5ed63f));_0x3827b6(_0x5ed63f);})['catch'](function(_0x255f05){logger[_0x898e('0xf')](_0x898e('0x21'),_0x255f05[_0x898e('0x12')],_0x5c685c);_0x401026(_0x41673c[_0x898e('0xf')](0x1f4,_0x255f05[_0x898e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 4863968..a397446 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 _0xcd10=['getDescriptions','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','index','get','show','/:id/fields','getSubjects'];(function(_0x10d34b,_0x4fef76){var _0x92b0bf=function(_0x16e291){while(--_0x16e291){_0x10d34b['push'](_0x10d34b['shift']());}};_0x92b0bf(++_0x4fef76);}(_0xcd10,0xe5));var _0x0cd1=function(_0xc7e986,_0x3cc9a0){_0xc7e986=_0xc7e986-0x0;var _0x1b5be7=_0xcd10[_0xc7e986];return _0x1b5be7;};'use strict';var multer=require('multer');var util=require(_0x0cd1('0x0'));var path=require(_0x0cd1('0x1'));var timeout=require(_0x0cd1('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0cd1('0x3'));var controller=require(_0x0cd1('0x4'));router['get']('/',auth[_0x0cd1('0x5')](),controller[_0x0cd1('0x6')]);router[_0x0cd1('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x0cd1('0x8')]);router[_0x0cd1('0x7')](_0x0cd1('0x9'),auth[_0x0cd1('0x5')](),controller['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x0cd1('0xa')]);router[_0x0cd1('0x7')]('/:id/descriptions',auth[_0x0cd1('0x5')](),controller[_0x0cd1('0xb')]);router[_0x0cd1('0xc')]('/',auth[_0x0cd1('0x5')](),controller[_0x0cd1('0xd')]);router[_0x0cd1('0xe')](_0x0cd1('0xf'),auth[_0x0cd1('0x5')](),controller[_0x0cd1('0x10')]);router[_0x0cd1('0x11')](_0x0cd1('0xf'),auth[_0x0cd1('0x5')](),controller[_0x0cd1('0x12')]);module[_0x0cd1('0x13')]=router; \ No newline at end of file +var _0x5a25=['update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./intServicenowConfiguration.controller','get','/:id','isAuthenticated','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x3aa0d8,_0x4d1345){var _0x2a3d45=function(_0x2b5013){while(--_0x2b5013){_0x3aa0d8['push'](_0x3aa0d8['shift']());}};_0x2a3d45(++_0x4d1345);}(_0x5a25,0x193));var _0x55a2=function(_0x539bde,_0x14b7db){_0x539bde=_0x539bde-0x0;var _0x1718d4=_0x5a25[_0x539bde];return _0x1718d4;};'use strict';var multer=require(_0x55a2('0x0'));var util=require(_0x55a2('0x1'));var path=require(_0x55a2('0x2'));var timeout=require('connect-timeout');var express=require(_0x55a2('0x3'));var router=express[_0x55a2('0x4')]();var fs_extra=require(_0x55a2('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x55a2('0x6'));var controller=require(_0x55a2('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x55a2('0x8')](_0x55a2('0x9'),auth[_0x55a2('0xa')](),controller['show']);router[_0x55a2('0x8')](_0x55a2('0xb'),auth[_0x55a2('0xa')](),controller[_0x55a2('0xc')]);router[_0x55a2('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x55a2('0xd')]);router['get'](_0x55a2('0xe'),auth[_0x55a2('0xa')](),controller[_0x55a2('0xf')]);router[_0x55a2('0x10')]('/',auth[_0x55a2('0xa')](),controller['create']);router['put'](_0x55a2('0x9'),auth['isAuthenticated'](),controller[_0x55a2('0x11')]);router[_0x55a2('0x12')](_0x55a2('0x9'),auth[_0x55a2('0xa')](),controller[_0x55a2('0x13')]);module[_0x55a2('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 7fe26c4..007fa08 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 _0x139a=['sequelize','exports','STRING'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x139a,0x198));var _0xa139=function(_0x1b5e3e,_0x1cd8a4){_0x1b5e3e=_0x1b5e3e-0x0;var _0x48c26f=_0x139a[_0x1b5e3e];return _0x48c26f;};'use strict';var Sequelize=require(_0xa139('0x0'));module[_0xa139('0x1')]={'name':{'type':Sequelize[_0xa139('0x2')]},'description':{'type':Sequelize[_0xa139('0x2')]}}; \ No newline at end of file +var _0x92bd=['exports','STRING','sequelize'];(function(_0x4a1de0,_0x61d745){var _0x566a67=function(_0x3d6ba7){while(--_0x3d6ba7){_0x4a1de0['push'](_0x4a1de0['shift']());}};_0x566a67(++_0x61d745);}(_0x92bd,0x176));var _0xd92b=function(_0x22eaca,_0xe31556){_0x22eaca=_0x22eaca-0x0;var _0x309bd0=_0x92bd[_0x22eaca];return _0x309bd0;};'use strict';var Sequelize=require(_0xd92b('0x0'));module[_0xd92b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd92b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 529adb7..59fb969 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 _0xbef8=['nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','find','create','body','params','destroy','findOne','ServicenowField','getFields','getSubjects','getDescriptions','rimraf','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x3160bf,_0x79b197){var _0x12f230=function(_0x2ad85c){while(--_0x2ad85c){_0x3160bf['push'](_0x3160bf['shift']());}};_0x12f230(++_0x79b197);}(_0xbef8,0x69));var _0x8bef=function(_0x1bfc8c,_0x5ea704){_0x1bfc8c=_0x1bfc8c-0x0;var _0x5bc277=_0xbef8[_0x1bfc8c];return _0x5bc277;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8bef('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8bef('0x1'));var moment=require(_0x8bef('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8bef('0x3'));var util=require(_0x8bef('0x4'));var path=require('path');var sox=require(_0x8bef('0x5'));var csv=require(_0x8bef('0x6'));var ejs=require(_0x8bef('0x7'));var fs=require('fs');var fs_extra=require(_0x8bef('0x8'));var _=require(_0x8bef('0x9'));var squel=require(_0x8bef('0xa'));var crypto=require('crypto');var jsforce=require(_0x8bef('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8bef('0x6'));var querystring=require(_0x8bef('0xc'));var Papa=require(_0x8bef('0xd'));var Redis=require(_0x8bef('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8bef('0xf'));var as=require(_0x8bef('0x10'));var hardwareService=require(_0x8bef('0x11'));var logger=require(_0x8bef('0x12'))('api');var utils=require(_0x8bef('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8bef('0x14'))['db'];function respondWithStatusCode(_0x42111f,_0x3d2736){_0x3d2736=_0x3d2736||0xcc;return function(_0x4f9946){if(_0x4f9946){return _0x42111f['sendStatus'](_0x3d2736);}return _0x42111f[_0x8bef('0x15')](_0x3d2736)[_0x8bef('0x16')]();};}function respondWithResult(_0x56bda1,_0x4497d3){_0x4497d3=_0x4497d3||0xc8;return function(_0xdd02ef){if(_0xdd02ef){return _0x56bda1[_0x8bef('0x15')](_0x4497d3)['json'](_0xdd02ef);}};}function respondWithFilteredResult(_0x43da58,_0x4f7420){return function(_0x351d5c){if(_0x351d5c){var _0x5c8d43=typeof _0x4f7420['offset']===_0x8bef('0x17')&&typeof _0x4f7420[_0x8bef('0x18')]===_0x8bef('0x17');var _0x3f238e=_0x351d5c[_0x8bef('0x19')];var _0x5134c7=_0x5c8d43?0x0:_0x4f7420[_0x8bef('0x1a')];var _0x2154ab=_0x5c8d43?_0x351d5c[_0x8bef('0x19')]:_0x4f7420[_0x8bef('0x1a')]+_0x4f7420[_0x8bef('0x18')];var _0x46d96e;if(_0x2154ab>=_0x3f238e){_0x2154ab=_0x3f238e;_0x46d96e=0xc8;}else{_0x46d96e=0xce;}_0x43da58['status'](_0x46d96e);return _0x43da58[_0x8bef('0x1b')](_0x8bef('0x1c'),_0x5134c7+'-'+_0x2154ab+'/'+_0x3f238e)[_0x8bef('0x1d')](_0x351d5c);}return null;};}function patchUpdates(_0x59e3ae){return function(_0x1e7c07){try{jsonpatch[_0x8bef('0x1e')](_0x1e7c07,_0x59e3ae,!![]);}catch(_0x161e22){return BPromise[_0x8bef('0x1f')](_0x161e22);}return _0x1e7c07[_0x8bef('0x20')]();};}function saveUpdates(_0x20d07e,_0x2602a9){return function(_0x46bc9a){if(_0x46bc9a){return _0x46bc9a[_0x8bef('0x21')](_0x20d07e)[_0x8bef('0x22')](function(_0x58692e){return _0x58692e;});}return null;};}function removeEntity(_0x5575a5,_0x6341a2){return function(_0x144da0){if(_0x144da0){return _0x144da0['destroy']()[_0x8bef('0x22')](function(){_0x5575a5['status'](0xcc)[_0x8bef('0x16')]();});}};}function handleEntityNotFound(_0xfcfeb6,_0x2f365d){return function(_0xc5bc8a){if(!_0xc5bc8a){_0xfcfeb6[_0x8bef('0x23')](0x194);}return _0xc5bc8a;};}function handleError(_0x411969,_0x7698d6){_0x7698d6=_0x7698d6||0x1f4;return function(_0x349c25){logger[_0x8bef('0x24')](_0x349c25[_0x8bef('0x25')]);if(_0x349c25[_0x8bef('0x26')]){delete _0x349c25[_0x8bef('0x26')];}_0x411969[_0x8bef('0x15')](_0x7698d6)[_0x8bef('0x27')](_0x349c25);};}exports[_0x8bef('0x28')]=function(_0x49527c,_0x211d09){var _0x59510a={},_0x13337e={},_0x5d4278={'count':0x0,'rows':[]};var _0x402255=_[_0x8bef('0x29')](db[_0x8bef('0x2a')][_0x8bef('0x2b')],function(_0x1a85cc){return{'name':_0x1a85cc[_0x8bef('0x2c')],'type':_0x1a85cc['type'][_0x8bef('0x2d')]};});_0x13337e[_0x8bef('0x2e')]=_['map'](_0x402255,_0x8bef('0x26'));_0x13337e[_0x8bef('0x2f')]=_[_0x8bef('0x30')](_0x49527c['query']);_0x13337e[_0x8bef('0x31')]=_[_0x8bef('0x32')](_0x13337e[_0x8bef('0x2e')],_0x13337e['query']);_0x59510a[_0x8bef('0x33')]=_[_0x8bef('0x32')](_0x13337e[_0x8bef('0x2e')],qs[_0x8bef('0x34')](_0x49527c['query'][_0x8bef('0x34')]));_0x59510a[_0x8bef('0x33')]=_0x59510a[_0x8bef('0x33')][_0x8bef('0x35')]?_0x59510a['attributes']:_0x13337e[_0x8bef('0x2e')];if(!_0x49527c[_0x8bef('0x2f')][_0x8bef('0x36')](_0x8bef('0x37'))){_0x59510a[_0x8bef('0x18')]=qs[_0x8bef('0x18')](_0x49527c[_0x8bef('0x2f')]['limit']);_0x59510a[_0x8bef('0x1a')]=qs[_0x8bef('0x1a')](_0x49527c[_0x8bef('0x2f')][_0x8bef('0x1a')]);}_0x59510a[_0x8bef('0x38')]=qs[_0x8bef('0x39')](_0x49527c[_0x8bef('0x2f')][_0x8bef('0x39')]);_0x59510a[_0x8bef('0x3a')]=qs[_0x8bef('0x31')](_[_0x8bef('0x3b')](_0x49527c['query'],_0x13337e[_0x8bef('0x31')]),_0x402255);if(_0x49527c[_0x8bef('0x2f')]['filter']){_0x59510a[_0x8bef('0x3a')]=_[_0x8bef('0x3c')](_0x59510a[_0x8bef('0x3a')],{'$or':_[_0x8bef('0x29')](_0x402255,function(_0x563a34){if(_0x563a34[_0x8bef('0x3d')]!==_0x8bef('0x3e')){var _0x9bfb43={};_0x9bfb43[_0x563a34[_0x8bef('0x26')]]={'$like':'%'+_0x49527c[_0x8bef('0x2f')][_0x8bef('0x3f')]+'%'};return _0x9bfb43;}})});}_0x59510a=_[_0x8bef('0x3c')]({},_0x59510a,_0x49527c[_0x8bef('0x40')]);var _0x455980={'where':_0x59510a[_0x8bef('0x3a')]};return db[_0x8bef('0x2a')][_0x8bef('0x19')](_0x455980)[_0x8bef('0x22')](function(_0x2b4bd4){_0x5d4278['count']=_0x2b4bd4;if(_0x49527c['query'][_0x8bef('0x41')]){_0x59510a[_0x8bef('0x42')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x59510a);})[_0x8bef('0x22')](function(_0x15c0c9){_0x5d4278[_0x8bef('0x43')]=_0x15c0c9;return _0x5d4278;})[_0x8bef('0x22')](respondWithFilteredResult(_0x211d09,_0x59510a))[_0x8bef('0x44')](handleError(_0x211d09,null));};exports[_0x8bef('0x45')]=function(_0x5e69bf,_0x1dc3f2){var _0x1f9d42={'raw':![],'where':{'id':_0x5e69bf['params']['id']}},_0xdcc6fb={};_0xdcc6fb[_0x8bef('0x2e')]=_[_0x8bef('0x30')](db[_0x8bef('0x2a')]['rawAttributes']);_0xdcc6fb[_0x8bef('0x2f')]=_[_0x8bef('0x30')](_0x5e69bf[_0x8bef('0x2f')]);_0xdcc6fb[_0x8bef('0x31')]=_[_0x8bef('0x32')](_0xdcc6fb['model'],_0xdcc6fb[_0x8bef('0x2f')]);_0x1f9d42[_0x8bef('0x33')]=_[_0x8bef('0x32')](_0xdcc6fb['model'],qs[_0x8bef('0x34')](_0x5e69bf[_0x8bef('0x2f')][_0x8bef('0x34')]));_0x1f9d42['attributes']=_0x1f9d42[_0x8bef('0x33')]['length']?_0x1f9d42[_0x8bef('0x33')]:_0xdcc6fb[_0x8bef('0x2e')];if(_0x5e69bf[_0x8bef('0x2f')]['includeAll']){_0x1f9d42['include']=[{'all':!![]}];}_0x1f9d42=_[_0x8bef('0x3c')]({},_0x1f9d42,_0x5e69bf[_0x8bef('0x40')]);return db[_0x8bef('0x2a')][_0x8bef('0x46')](_0x1f9d42)[_0x8bef('0x22')](handleEntityNotFound(_0x1dc3f2,null))[_0x8bef('0x22')](respondWithResult(_0x1dc3f2,null))[_0x8bef('0x44')](handleError(_0x1dc3f2,null));};exports[_0x8bef('0x47')]=function(_0xa545d2,_0x5352b5){return db['ServicenowConfiguration'][_0x8bef('0x47')](_0xa545d2[_0x8bef('0x48')],{})[_0x8bef('0x22')](respondWithResult(_0x5352b5,0xc9))[_0x8bef('0x44')](handleError(_0x5352b5,null));};exports[_0x8bef('0x21')]=function(_0x4d10e9,_0x9064ba){if(_0x4d10e9[_0x8bef('0x48')]['id']){delete _0x4d10e9[_0x8bef('0x48')]['id'];}return db[_0x8bef('0x2a')][_0x8bef('0x46')]({'where':{'id':_0x4d10e9[_0x8bef('0x49')]['id']}})[_0x8bef('0x22')](handleEntityNotFound(_0x9064ba,null))[_0x8bef('0x22')](saveUpdates(_0x4d10e9[_0x8bef('0x48')],null))[_0x8bef('0x22')](respondWithResult(_0x9064ba,null))[_0x8bef('0x44')](handleError(_0x9064ba,null));};exports[_0x8bef('0x4a')]=function(_0x5039c6,_0x3518b5){return db[_0x8bef('0x2a')]['find']({'where':{'id':_0x5039c6[_0x8bef('0x49')]['id']}})['then'](handleEntityNotFound(_0x3518b5,null))['then'](removeEntity(_0x3518b5,null))[_0x8bef('0x44')](handleError(_0x3518b5,null));};exports['getFields']=function(_0x2cbc8d,_0x2161ba,_0x35f25b){var _0x177928={};var _0x5bea34={};var _0x213866;var _0x520c36;return db[_0x8bef('0x2a')][_0x8bef('0x4b')]({'where':{'id':_0x2cbc8d[_0x8bef('0x49')]['id']}})[_0x8bef('0x22')](handleEntityNotFound(_0x2161ba,null))[_0x8bef('0x22')](function(_0x358dd7){if(_0x358dd7){_0x213866=_0x358dd7;_0x5bea34[_0x8bef('0x2e')]=_[_0x8bef('0x30')](db[_0x8bef('0x4c')][_0x8bef('0x2b')]);_0x5bea34['query']=_[_0x8bef('0x30')](_0x2cbc8d['query']);_0x5bea34[_0x8bef('0x31')]=_[_0x8bef('0x32')](_0x5bea34[_0x8bef('0x2e')],_0x5bea34[_0x8bef('0x2f')]);_0x177928[_0x8bef('0x33')]=_[_0x8bef('0x32')](_0x5bea34[_0x8bef('0x2e')],qs[_0x8bef('0x34')](_0x2cbc8d[_0x8bef('0x2f')][_0x8bef('0x34')]));_0x177928[_0x8bef('0x33')]=_0x177928['attributes'][_0x8bef('0x35')]?_0x177928[_0x8bef('0x33')]:_0x5bea34['model'];_0x177928[_0x8bef('0x38')]=qs['sort'](_0x2cbc8d[_0x8bef('0x2f')][_0x8bef('0x39')]);_0x177928['where']=qs[_0x8bef('0x31')](_[_0x8bef('0x3b')](_0x2cbc8d[_0x8bef('0x2f')],_0x5bea34[_0x8bef('0x31')]));if(_0x2cbc8d[_0x8bef('0x2f')][_0x8bef('0x3f')]){_0x177928[_0x8bef('0x3a')]=_[_0x8bef('0x3c')](_0x177928[_0x8bef('0x3a')],{'$or':_[_0x8bef('0x29')](_0x177928[_0x8bef('0x33')],function(_0x15303c){var _0xe8c70e={};_0xe8c70e[_0x15303c]={'$like':'%'+_0x2cbc8d[_0x8bef('0x2f')][_0x8bef('0x3f')]+'%'};return _0xe8c70e;})});}_0x177928=_['merge']({},_0x177928,_0x2cbc8d[_0x8bef('0x40')]);return _0x213866[_0x8bef('0x4d')](_0x177928);}})[_0x8bef('0x22')](function(_0x3b3a19){if(_0x3b3a19){_0x520c36=_0x3b3a19[_0x8bef('0x35')];if(!_0x2cbc8d[_0x8bef('0x2f')]['hasOwnProperty'](_0x8bef('0x37'))){_0x177928['limit']=qs[_0x8bef('0x18')](_0x2cbc8d[_0x8bef('0x2f')][_0x8bef('0x18')]);_0x177928[_0x8bef('0x1a')]=qs[_0x8bef('0x1a')](_0x2cbc8d[_0x8bef('0x2f')][_0x8bef('0x1a')]);}return _0x213866[_0x8bef('0x4d')](_0x177928);}})[_0x8bef('0x22')](function(_0x58a128){if(_0x58a128){return _0x58a128?{'count':_0x520c36,'rows':_0x58a128}:null;}})['then'](respondWithResult(_0x2161ba,null))['catch'](handleError(_0x2161ba,null));};exports[_0x8bef('0x4e')]=function(_0x5ac4a1,_0x2053cd,_0x387158){var _0x535f75={};var _0x365820={};var _0x1553db;var _0x4c5211;return db[_0x8bef('0x2a')][_0x8bef('0x4b')]({'where':{'id':_0x5ac4a1[_0x8bef('0x49')]['id']}})[_0x8bef('0x22')](handleEntityNotFound(_0x2053cd,null))[_0x8bef('0x22')](function(_0x59190d){if(_0x59190d){_0x1553db=_0x59190d;_0x365820['model']=_['keys'](db['ServicenowField'][_0x8bef('0x2b')]);_0x365820['query']=_[_0x8bef('0x30')](_0x5ac4a1[_0x8bef('0x2f')]);_0x365820[_0x8bef('0x31')]=_[_0x8bef('0x32')](_0x365820[_0x8bef('0x2e')],_0x365820[_0x8bef('0x2f')]);_0x535f75['attributes']=_[_0x8bef('0x32')](_0x365820['model'],qs[_0x8bef('0x34')](_0x5ac4a1[_0x8bef('0x2f')][_0x8bef('0x34')]));_0x535f75['attributes']=_0x535f75[_0x8bef('0x33')]['length']?_0x535f75[_0x8bef('0x33')]:_0x365820[_0x8bef('0x2e')];_0x535f75['order']=qs[_0x8bef('0x39')](_0x5ac4a1[_0x8bef('0x2f')][_0x8bef('0x39')]);_0x535f75[_0x8bef('0x3a')]=qs[_0x8bef('0x31')](_[_0x8bef('0x3b')](_0x5ac4a1['query'],_0x365820[_0x8bef('0x31')]));if(_0x5ac4a1[_0x8bef('0x2f')][_0x8bef('0x3f')]){_0x535f75[_0x8bef('0x3a')]=_[_0x8bef('0x3c')](_0x535f75[_0x8bef('0x3a')],{'$or':_[_0x8bef('0x29')](_0x535f75[_0x8bef('0x33')],function(_0x26d33e){var _0x255ec5={};_0x255ec5[_0x26d33e]={'$like':'%'+_0x5ac4a1[_0x8bef('0x2f')][_0x8bef('0x3f')]+'%'};return _0x255ec5;})});}_0x535f75=_[_0x8bef('0x3c')]({},_0x535f75,_0x5ac4a1[_0x8bef('0x40')]);return _0x1553db[_0x8bef('0x4e')](_0x535f75);}})['then'](function(_0x2a0e66){if(_0x2a0e66){_0x4c5211=_0x2a0e66[_0x8bef('0x35')];if(!_0x5ac4a1[_0x8bef('0x2f')][_0x8bef('0x36')](_0x8bef('0x37'))){_0x535f75[_0x8bef('0x18')]=qs[_0x8bef('0x18')](_0x5ac4a1[_0x8bef('0x2f')]['limit']);_0x535f75['offset']=qs[_0x8bef('0x1a')](_0x5ac4a1['query'][_0x8bef('0x1a')]);}return _0x1553db[_0x8bef('0x4e')](_0x535f75);}})[_0x8bef('0x22')](function(_0x1499e6){if(_0x1499e6){return _0x1499e6?{'count':_0x4c5211,'rows':_0x1499e6}:null;}})[_0x8bef('0x22')](respondWithResult(_0x2053cd,null))[_0x8bef('0x44')](handleError(_0x2053cd,null));};exports[_0x8bef('0x4f')]=function(_0x404cee,_0x5722df,_0x2936c8){var _0x2c406c={};var _0x5e1fad={};var _0x2bd711;var _0x593764;return db['ServicenowConfiguration'][_0x8bef('0x4b')]({'where':{'id':_0x404cee[_0x8bef('0x49')]['id']}})[_0x8bef('0x22')](handleEntityNotFound(_0x5722df,null))[_0x8bef('0x22')](function(_0x2553fa){if(_0x2553fa){_0x2bd711=_0x2553fa;_0x5e1fad[_0x8bef('0x2e')]=_[_0x8bef('0x30')](db['ServicenowField']['rawAttributes']);_0x5e1fad['query']=_[_0x8bef('0x30')](_0x404cee[_0x8bef('0x2f')]);_0x5e1fad['filters']=_[_0x8bef('0x32')](_0x5e1fad[_0x8bef('0x2e')],_0x5e1fad[_0x8bef('0x2f')]);_0x2c406c[_0x8bef('0x33')]=_['intersection'](_0x5e1fad[_0x8bef('0x2e')],qs[_0x8bef('0x34')](_0x404cee['query'][_0x8bef('0x34')]));_0x2c406c[_0x8bef('0x33')]=_0x2c406c['attributes'][_0x8bef('0x35')]?_0x2c406c[_0x8bef('0x33')]:_0x5e1fad['model'];_0x2c406c[_0x8bef('0x38')]=qs[_0x8bef('0x39')](_0x404cee[_0x8bef('0x2f')][_0x8bef('0x39')]);_0x2c406c[_0x8bef('0x3a')]=qs['filters'](_[_0x8bef('0x3b')](_0x404cee[_0x8bef('0x2f')],_0x5e1fad[_0x8bef('0x31')]));if(_0x404cee[_0x8bef('0x2f')][_0x8bef('0x3f')]){_0x2c406c[_0x8bef('0x3a')]=_['merge'](_0x2c406c[_0x8bef('0x3a')],{'$or':_[_0x8bef('0x29')](_0x2c406c[_0x8bef('0x33')],function(_0xcc8c8a){var _0x47a7e6={};_0x47a7e6[_0xcc8c8a]={'$like':'%'+_0x404cee[_0x8bef('0x2f')][_0x8bef('0x3f')]+'%'};return _0x47a7e6;})});}_0x2c406c=_[_0x8bef('0x3c')]({},_0x2c406c,_0x404cee[_0x8bef('0x40')]);return _0x2bd711[_0x8bef('0x4f')](_0x2c406c);}})[_0x8bef('0x22')](function(_0x9e46a2){if(_0x9e46a2){_0x593764=_0x9e46a2['length'];if(!_0x404cee[_0x8bef('0x2f')]['hasOwnProperty'](_0x8bef('0x37'))){_0x2c406c[_0x8bef('0x18')]=qs['limit'](_0x404cee[_0x8bef('0x2f')][_0x8bef('0x18')]);_0x2c406c[_0x8bef('0x1a')]=qs['offset'](_0x404cee[_0x8bef('0x2f')][_0x8bef('0x1a')]);}return _0x2bd711['getDescriptions'](_0x2c406c);}})[_0x8bef('0x22')](function(_0x452d07){if(_0x452d07){return _0x452d07?{'count':_0x593764,'rows':_0x452d07}:null;}})[_0x8bef('0x22')](respondWithResult(_0x5722df,null))[_0x8bef('0x44')](handleError(_0x5722df,null));}; \ No newline at end of file +var _0xd976=['type','key','model','map','query','intersection','attributes','fields','hasOwnProperty','sort','filters','pick','filter','where','merge','VIRTUAL','name','options','includeAll','findAll','rows','params','keys','length','include','find','catch','create','body','update','getFields','findOne','ServicenowField','order','getSubjects','nolimit','getDescriptions','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','sendStatus','error','stack','send','ServicenowConfiguration','rawAttributes','fieldName'];(function(_0x5e1f4b,_0x50b208){var _0x5ce7b4=function(_0x53d04f){while(--_0x53d04f){_0x5e1f4b['push'](_0x5e1f4b['shift']());}};_0x5ce7b4(++_0x50b208);}(_0xd976,0x169));var _0x6d97=function(_0x476f08,_0x3c5760){_0x476f08=_0x476f08-0x0;var _0x355fae=_0xd976[_0x476f08];return _0x355fae;};'use strict';var emlformat=require(_0x6d97('0x0'));var rimraf=require(_0x6d97('0x1'));var zipdir=require(_0x6d97('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6d97('0x3'));var moment=require('moment');var BPromise=require(_0x6d97('0x4'));var Mustache=require(_0x6d97('0x5'));var util=require(_0x6d97('0x6'));var path=require(_0x6d97('0x7'));var sox=require(_0x6d97('0x8'));var csv=require(_0x6d97('0x9'));var ejs=require(_0x6d97('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6d97('0xb'));var squel=require(_0x6d97('0xc'));var crypto=require(_0x6d97('0xd'));var jsforce=require(_0x6d97('0xe'));var deskjs=require(_0x6d97('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6d97('0x10'));var Papa=require(_0x6d97('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6d97('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6d97('0x13'));var logger=require(_0x6d97('0x14'))('api');var utils=require(_0x6d97('0x15'));var config=require(_0x6d97('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6d97('0x17'))['db'];function respondWithStatusCode(_0x3a00c0,_0x425bf6){_0x425bf6=_0x425bf6||0xcc;return function(_0x3a2422){if(_0x3a2422){return _0x3a00c0['sendStatus'](_0x425bf6);}return _0x3a00c0[_0x6d97('0x18')](_0x425bf6)[_0x6d97('0x19')]();};}function respondWithResult(_0x5a33b9,_0x502baf){_0x502baf=_0x502baf||0xc8;return function(_0x2898ec){if(_0x2898ec){return _0x5a33b9[_0x6d97('0x18')](_0x502baf)[_0x6d97('0x1a')](_0x2898ec);}};}function respondWithFilteredResult(_0x5b304d,_0x186011){return function(_0x12fc94){if(_0x12fc94){var _0x75099f=typeof _0x186011[_0x6d97('0x1b')]===_0x6d97('0x1c')&&typeof _0x186011['limit']===_0x6d97('0x1c');var _0xc97be=_0x12fc94[_0x6d97('0x1d')];var _0x46acd3=_0x75099f?0x0:_0x186011[_0x6d97('0x1b')];var _0x194be0=_0x75099f?_0x12fc94[_0x6d97('0x1d')]:_0x186011['offset']+_0x186011[_0x6d97('0x1e')];var _0x20d6cc;if(_0x194be0>=_0xc97be){_0x194be0=_0xc97be;_0x20d6cc=0xc8;}else{_0x20d6cc=0xce;}_0x5b304d[_0x6d97('0x18')](_0x20d6cc);return _0x5b304d[_0x6d97('0x1f')](_0x6d97('0x20'),_0x46acd3+'-'+_0x194be0+'/'+_0xc97be)[_0x6d97('0x1a')](_0x12fc94);}return null;};}function patchUpdates(_0x71e27f){return function(_0x3642e1){try{jsonpatch['apply'](_0x3642e1,_0x71e27f,!![]);}catch(_0x54659e){return BPromise[_0x6d97('0x21')](_0x54659e);}return _0x3642e1[_0x6d97('0x22')]();};}function saveUpdates(_0x589986,_0x47146e){return function(_0x3243ac){if(_0x3243ac){return _0x3243ac['update'](_0x589986)[_0x6d97('0x23')](function(_0x4b13d3){return _0x4b13d3;});}return null;};}function removeEntity(_0x3b1c90,_0x237f80){return function(_0x5dfd91){if(_0x5dfd91){return _0x5dfd91[_0x6d97('0x24')]()[_0x6d97('0x23')](function(){_0x3b1c90[_0x6d97('0x18')](0xcc)[_0x6d97('0x19')]();});}};}function handleEntityNotFound(_0x3f87df,_0x306125){return function(_0x16d8eb){if(!_0x16d8eb){_0x3f87df[_0x6d97('0x25')](0x194);}return _0x16d8eb;};}function handleError(_0x1b1af3,_0x15b6b3){_0x15b6b3=_0x15b6b3||0x1f4;return function(_0x3956b2){logger[_0x6d97('0x26')](_0x3956b2[_0x6d97('0x27')]);if(_0x3956b2['name']){delete _0x3956b2['name'];}_0x1b1af3[_0x6d97('0x18')](_0x15b6b3)[_0x6d97('0x28')](_0x3956b2);};}exports['index']=function(_0x39f33c,_0x4fbeb7){var _0x378efa={},_0x5bd01c={},_0x5e6803={'count':0x0,'rows':[]};var _0x5733b0=_['map'](db[_0x6d97('0x29')][_0x6d97('0x2a')],function(_0x8100f3){return{'name':_0x8100f3[_0x6d97('0x2b')],'type':_0x8100f3[_0x6d97('0x2c')][_0x6d97('0x2d')]};});_0x5bd01c[_0x6d97('0x2e')]=_[_0x6d97('0x2f')](_0x5733b0,'name');_0x5bd01c[_0x6d97('0x30')]=_['keys'](_0x39f33c[_0x6d97('0x30')]);_0x5bd01c['filters']=_[_0x6d97('0x31')](_0x5bd01c[_0x6d97('0x2e')],_0x5bd01c['query']);_0x378efa[_0x6d97('0x32')]=_[_0x6d97('0x31')](_0x5bd01c[_0x6d97('0x2e')],qs[_0x6d97('0x33')](_0x39f33c['query']['fields']));_0x378efa['attributes']=_0x378efa[_0x6d97('0x32')]['length']?_0x378efa[_0x6d97('0x32')]:_0x5bd01c['model'];if(!_0x39f33c[_0x6d97('0x30')][_0x6d97('0x34')]('nolimit')){_0x378efa['limit']=qs[_0x6d97('0x1e')](_0x39f33c[_0x6d97('0x30')]['limit']);_0x378efa['offset']=qs[_0x6d97('0x1b')](_0x39f33c[_0x6d97('0x30')][_0x6d97('0x1b')]);}_0x378efa['order']=qs['sort'](_0x39f33c[_0x6d97('0x30')][_0x6d97('0x35')]);_0x378efa['where']=qs[_0x6d97('0x36')](_[_0x6d97('0x37')](_0x39f33c['query'],_0x5bd01c[_0x6d97('0x36')]),_0x5733b0);if(_0x39f33c['query'][_0x6d97('0x38')]){_0x378efa[_0x6d97('0x39')]=_[_0x6d97('0x3a')](_0x378efa[_0x6d97('0x39')],{'$or':_[_0x6d97('0x2f')](_0x5733b0,function(_0x4224d5){if(_0x4224d5['type']!==_0x6d97('0x3b')){var _0x2fb39e={};_0x2fb39e[_0x4224d5[_0x6d97('0x3c')]]={'$like':'%'+_0x39f33c[_0x6d97('0x30')][_0x6d97('0x38')]+'%'};return _0x2fb39e;}})});}_0x378efa=_['merge']({},_0x378efa,_0x39f33c[_0x6d97('0x3d')]);var _0x5e3b82={'where':_0x378efa[_0x6d97('0x39')]};return db[_0x6d97('0x29')][_0x6d97('0x1d')](_0x5e3b82)[_0x6d97('0x23')](function(_0x5935e9){_0x5e6803[_0x6d97('0x1d')]=_0x5935e9;if(_0x39f33c[_0x6d97('0x30')][_0x6d97('0x3e')]){_0x378efa['include']=[{'all':!![]}];}return db[_0x6d97('0x29')][_0x6d97('0x3f')](_0x378efa);})['then'](function(_0x5d4419){_0x5e6803[_0x6d97('0x40')]=_0x5d4419;return _0x5e6803;})[_0x6d97('0x23')](respondWithFilteredResult(_0x4fbeb7,_0x378efa))['catch'](handleError(_0x4fbeb7,null));};exports['show']=function(_0x187d56,_0xf02606){var _0x184157={'raw':![],'where':{'id':_0x187d56[_0x6d97('0x41')]['id']}},_0x51b488={};_0x51b488['model']=_[_0x6d97('0x42')](db[_0x6d97('0x29')]['rawAttributes']);_0x51b488[_0x6d97('0x30')]=_[_0x6d97('0x42')](_0x187d56[_0x6d97('0x30')]);_0x51b488[_0x6d97('0x36')]=_['intersection'](_0x51b488[_0x6d97('0x2e')],_0x51b488[_0x6d97('0x30')]);_0x184157['attributes']=_[_0x6d97('0x31')](_0x51b488[_0x6d97('0x2e')],qs[_0x6d97('0x33')](_0x187d56[_0x6d97('0x30')]['fields']));_0x184157[_0x6d97('0x32')]=_0x184157[_0x6d97('0x32')][_0x6d97('0x43')]?_0x184157[_0x6d97('0x32')]:_0x51b488['model'];if(_0x187d56[_0x6d97('0x30')][_0x6d97('0x3e')]){_0x184157[_0x6d97('0x44')]=[{'all':!![]}];}_0x184157=_[_0x6d97('0x3a')]({},_0x184157,_0x187d56['options']);return db[_0x6d97('0x29')][_0x6d97('0x45')](_0x184157)[_0x6d97('0x23')](handleEntityNotFound(_0xf02606,null))['then'](respondWithResult(_0xf02606,null))[_0x6d97('0x46')](handleError(_0xf02606,null));};exports[_0x6d97('0x47')]=function(_0xfbfe17,_0x5a8ca9){return db[_0x6d97('0x29')][_0x6d97('0x47')](_0xfbfe17[_0x6d97('0x48')],{})[_0x6d97('0x23')](respondWithResult(_0x5a8ca9,0xc9))[_0x6d97('0x46')](handleError(_0x5a8ca9,null));};exports[_0x6d97('0x49')]=function(_0x49acbf,_0x2b3e63){if(_0x49acbf['body']['id']){delete _0x49acbf[_0x6d97('0x48')]['id'];}return db[_0x6d97('0x29')][_0x6d97('0x45')]({'where':{'id':_0x49acbf['params']['id']}})[_0x6d97('0x23')](handleEntityNotFound(_0x2b3e63,null))['then'](saveUpdates(_0x49acbf[_0x6d97('0x48')],null))[_0x6d97('0x23')](respondWithResult(_0x2b3e63,null))[_0x6d97('0x46')](handleError(_0x2b3e63,null));};exports[_0x6d97('0x24')]=function(_0x2a4c5a,_0x2359d5){return db[_0x6d97('0x29')][_0x6d97('0x45')]({'where':{'id':_0x2a4c5a['params']['id']}})[_0x6d97('0x23')](handleEntityNotFound(_0x2359d5,null))[_0x6d97('0x23')](removeEntity(_0x2359d5,null))[_0x6d97('0x46')](handleError(_0x2359d5,null));};exports[_0x6d97('0x4a')]=function(_0x1113ce,_0x224ff6,_0x32ad9b){var _0x3d4f7b={};var _0x5ae482={};var _0x528b08;var _0x50f433;return db['ServicenowConfiguration'][_0x6d97('0x4b')]({'where':{'id':_0x1113ce[_0x6d97('0x41')]['id']}})[_0x6d97('0x23')](handleEntityNotFound(_0x224ff6,null))['then'](function(_0x1b65ec){if(_0x1b65ec){_0x528b08=_0x1b65ec;_0x5ae482[_0x6d97('0x2e')]=_['keys'](db[_0x6d97('0x4c')]['rawAttributes']);_0x5ae482[_0x6d97('0x30')]=_[_0x6d97('0x42')](_0x1113ce['query']);_0x5ae482[_0x6d97('0x36')]=_[_0x6d97('0x31')](_0x5ae482['model'],_0x5ae482['query']);_0x3d4f7b[_0x6d97('0x32')]=_['intersection'](_0x5ae482[_0x6d97('0x2e')],qs[_0x6d97('0x33')](_0x1113ce['query'][_0x6d97('0x33')]));_0x3d4f7b[_0x6d97('0x32')]=_0x3d4f7b['attributes'][_0x6d97('0x43')]?_0x3d4f7b[_0x6d97('0x32')]:_0x5ae482['model'];_0x3d4f7b[_0x6d97('0x4d')]=qs[_0x6d97('0x35')](_0x1113ce[_0x6d97('0x30')][_0x6d97('0x35')]);_0x3d4f7b[_0x6d97('0x39')]=qs[_0x6d97('0x36')](_['pick'](_0x1113ce[_0x6d97('0x30')],_0x5ae482[_0x6d97('0x36')]));if(_0x1113ce[_0x6d97('0x30')][_0x6d97('0x38')]){_0x3d4f7b[_0x6d97('0x39')]=_[_0x6d97('0x3a')](_0x3d4f7b[_0x6d97('0x39')],{'$or':_[_0x6d97('0x2f')](_0x3d4f7b[_0x6d97('0x32')],function(_0x538ebb){var _0x2a33cf={};_0x2a33cf[_0x538ebb]={'$like':'%'+_0x1113ce[_0x6d97('0x30')][_0x6d97('0x38')]+'%'};return _0x2a33cf;})});}_0x3d4f7b=_['merge']({},_0x3d4f7b,_0x1113ce[_0x6d97('0x3d')]);return _0x528b08[_0x6d97('0x4a')](_0x3d4f7b);}})[_0x6d97('0x23')](function(_0x4c27a7){if(_0x4c27a7){_0x50f433=_0x4c27a7[_0x6d97('0x43')];if(!_0x1113ce[_0x6d97('0x30')][_0x6d97('0x34')]('nolimit')){_0x3d4f7b['limit']=qs[_0x6d97('0x1e')](_0x1113ce['query']['limit']);_0x3d4f7b[_0x6d97('0x1b')]=qs['offset'](_0x1113ce['query'][_0x6d97('0x1b')]);}return _0x528b08[_0x6d97('0x4a')](_0x3d4f7b);}})['then'](function(_0x2d75ec){if(_0x2d75ec){return _0x2d75ec?{'count':_0x50f433,'rows':_0x2d75ec}:null;}})['then'](respondWithResult(_0x224ff6,null))[_0x6d97('0x46')](handleError(_0x224ff6,null));};exports['getSubjects']=function(_0x1bb469,_0x16770c,_0x43b6e7){var _0x46c72b={};var _0x52072a={};var _0x20a7f5;var _0x10a39b;return db[_0x6d97('0x29')]['findOne']({'where':{'id':_0x1bb469[_0x6d97('0x41')]['id']}})[_0x6d97('0x23')](handleEntityNotFound(_0x16770c,null))[_0x6d97('0x23')](function(_0x564916){if(_0x564916){_0x20a7f5=_0x564916;_0x52072a[_0x6d97('0x2e')]=_['keys'](db[_0x6d97('0x4c')]['rawAttributes']);_0x52072a[_0x6d97('0x30')]=_[_0x6d97('0x42')](_0x1bb469[_0x6d97('0x30')]);_0x52072a['filters']=_[_0x6d97('0x31')](_0x52072a['model'],_0x52072a['query']);_0x46c72b[_0x6d97('0x32')]=_['intersection'](_0x52072a[_0x6d97('0x2e')],qs[_0x6d97('0x33')](_0x1bb469[_0x6d97('0x30')][_0x6d97('0x33')]));_0x46c72b[_0x6d97('0x32')]=_0x46c72b[_0x6d97('0x32')]['length']?_0x46c72b[_0x6d97('0x32')]:_0x52072a['model'];_0x46c72b[_0x6d97('0x4d')]=qs[_0x6d97('0x35')](_0x1bb469[_0x6d97('0x30')]['sort']);_0x46c72b[_0x6d97('0x39')]=qs[_0x6d97('0x36')](_['pick'](_0x1bb469[_0x6d97('0x30')],_0x52072a[_0x6d97('0x36')]));if(_0x1bb469['query'][_0x6d97('0x38')]){_0x46c72b[_0x6d97('0x39')]=_[_0x6d97('0x3a')](_0x46c72b[_0x6d97('0x39')],{'$or':_['map'](_0x46c72b[_0x6d97('0x32')],function(_0xbd0de3){var _0x572bd6={};_0x572bd6[_0xbd0de3]={'$like':'%'+_0x1bb469[_0x6d97('0x30')][_0x6d97('0x38')]+'%'};return _0x572bd6;})});}_0x46c72b=_['merge']({},_0x46c72b,_0x1bb469[_0x6d97('0x3d')]);return _0x20a7f5[_0x6d97('0x4e')](_0x46c72b);}})[_0x6d97('0x23')](function(_0x31d675){if(_0x31d675){_0x10a39b=_0x31d675[_0x6d97('0x43')];if(!_0x1bb469[_0x6d97('0x30')][_0x6d97('0x34')](_0x6d97('0x4f'))){_0x46c72b[_0x6d97('0x1e')]=qs[_0x6d97('0x1e')](_0x1bb469['query'][_0x6d97('0x1e')]);_0x46c72b[_0x6d97('0x1b')]=qs[_0x6d97('0x1b')](_0x1bb469[_0x6d97('0x30')][_0x6d97('0x1b')]);}return _0x20a7f5[_0x6d97('0x4e')](_0x46c72b);}})[_0x6d97('0x23')](function(_0x540c20){if(_0x540c20){return _0x540c20?{'count':_0x10a39b,'rows':_0x540c20}:null;}})[_0x6d97('0x23')](respondWithResult(_0x16770c,null))[_0x6d97('0x46')](handleError(_0x16770c,null));};exports['getDescriptions']=function(_0x2a1fd5,_0x178244,_0x5ab75a){var _0x1c16b0={};var _0x31b6d7={};var _0xe18254;var _0xc7c8e4;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x2a1fd5[_0x6d97('0x41')]['id']}})[_0x6d97('0x23')](handleEntityNotFound(_0x178244,null))[_0x6d97('0x23')](function(_0x13502b){if(_0x13502b){_0xe18254=_0x13502b;_0x31b6d7[_0x6d97('0x2e')]=_[_0x6d97('0x42')](db[_0x6d97('0x4c')][_0x6d97('0x2a')]);_0x31b6d7['query']=_[_0x6d97('0x42')](_0x2a1fd5[_0x6d97('0x30')]);_0x31b6d7[_0x6d97('0x36')]=_['intersection'](_0x31b6d7[_0x6d97('0x2e')],_0x31b6d7['query']);_0x1c16b0[_0x6d97('0x32')]=_[_0x6d97('0x31')](_0x31b6d7[_0x6d97('0x2e')],qs['fields'](_0x2a1fd5[_0x6d97('0x30')][_0x6d97('0x33')]));_0x1c16b0[_0x6d97('0x32')]=_0x1c16b0[_0x6d97('0x32')]['length']?_0x1c16b0[_0x6d97('0x32')]:_0x31b6d7[_0x6d97('0x2e')];_0x1c16b0[_0x6d97('0x4d')]=qs[_0x6d97('0x35')](_0x2a1fd5[_0x6d97('0x30')]['sort']);_0x1c16b0['where']=qs[_0x6d97('0x36')](_['pick'](_0x2a1fd5[_0x6d97('0x30')],_0x31b6d7[_0x6d97('0x36')]));if(_0x2a1fd5[_0x6d97('0x30')][_0x6d97('0x38')]){_0x1c16b0[_0x6d97('0x39')]=_[_0x6d97('0x3a')](_0x1c16b0[_0x6d97('0x39')],{'$or':_[_0x6d97('0x2f')](_0x1c16b0[_0x6d97('0x32')],function(_0x44a1e7){var _0x3f4341={};_0x3f4341[_0x44a1e7]={'$like':'%'+_0x2a1fd5['query']['filter']+'%'};return _0x3f4341;})});}_0x1c16b0=_[_0x6d97('0x3a')]({},_0x1c16b0,_0x2a1fd5[_0x6d97('0x3d')]);return _0xe18254[_0x6d97('0x50')](_0x1c16b0);}})[_0x6d97('0x23')](function(_0x51c21a){if(_0x51c21a){_0xc7c8e4=_0x51c21a[_0x6d97('0x43')];if(!_0x2a1fd5[_0x6d97('0x30')][_0x6d97('0x34')](_0x6d97('0x4f'))){_0x1c16b0[_0x6d97('0x1e')]=qs[_0x6d97('0x1e')](_0x2a1fd5[_0x6d97('0x30')][_0x6d97('0x1e')]);_0x1c16b0[_0x6d97('0x1b')]=qs[_0x6d97('0x1b')](_0x2a1fd5[_0x6d97('0x30')][_0x6d97('0x1b')]);}return _0xe18254[_0x6d97('0x50')](_0x1c16b0);}})[_0x6d97('0x23')](function(_0x2db7f7){if(_0x2db7f7){return _0x2db7f7?{'count':_0xc7c8e4,'rows':_0x2db7f7}:null;}})[_0x6d97('0x23')](respondWithResult(_0x178244,null))[_0x6d97('0x46')](handleError(_0x178244,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index d669e5d..2062a00 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 _0xa7fa=['exports','int_servicenow_configurations','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes'];(function(_0x10bd3d,_0x478dfb){var _0x48d6fd=function(_0xdf597f){while(--_0xdf597f){_0x10bd3d['push'](_0x10bd3d['shift']());}};_0x48d6fd(++_0x478dfb);}(_0xa7fa,0xfc));var _0xaa7f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa7fa[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaa7f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaa7f('0x1'));var moment=require(_0xaa7f('0x2'));var BPromise=require(_0xaa7f('0x3'));var rp=require(_0xaa7f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaa7f('0x5'));var config=require(_0xaa7f('0x6'));var attributes=require(_0xaa7f('0x7'));module[_0xaa7f('0x8')]=function(_0x48e98f,_0xf79d63){return _0x48e98f['define']('ServicenowConfiguration',attributes,{'tableName':_0xaa7f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb515=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger'];(function(_0x11a485,_0x44430f){var _0x19308b=function(_0x337eb6){while(--_0x337eb6){_0x11a485['push'](_0x11a485['shift']());}};_0x19308b(++_0x44430f);}(_0xb515,0x1b8));var _0x5b51=function(_0x2ecc65,_0xd75c48){_0x2ecc65=_0x2ecc65-0x0;var _0x103cc3=_0xb515[_0x2ecc65];return _0x103cc3;};'use strict';var _=require(_0x5b51('0x0'));var util=require('util');var logger=require(_0x5b51('0x1'))(_0x5b51('0x2'));var moment=require(_0x5b51('0x3'));var BPromise=require(_0x5b51('0x4'));var rp=require(_0x5b51('0x5'));var fs=require('fs');var path=require(_0x5b51('0x6'));var rimraf=require(_0x5b51('0x7'));var config=require(_0x5b51('0x8'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x5b51('0x9')]=function(_0xf9e3ac,_0x3ef482){return _0xf9e3ac[_0x5b51('0xa')](_0x5b51('0xb'),attributes,{'tableName':_0x5b51('0xc'),'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 dcd2f65..275fbfc 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 _0xfcf0=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','lodash','util','bluebird'];(function(_0x2a453b,_0x479c50){var _0x132f79=function(_0x5e3d83){while(--_0x5e3d83){_0x2a453b['push'](_0x2a453b['shift']());}};_0x132f79(++_0x479c50);}(_0xfcf0,0x138));var _0x0fcf=function(_0x4d7f3f,_0x4d2803){_0x4d7f3f=_0x4d7f3f-0x0;var _0x5d67cc=_0xfcf0[_0x4d7f3f];return _0x5d67cc;};'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')]('ServicenowConfiguration,\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);});});} \ No newline at end of file +var _0xbcc9=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','info','result','catch','util','bluebird','ioredis'];(function(_0x532178,_0x5a1e6f){var _0x54d107=function(_0x54aadc){while(--_0x54aadc){_0x532178['push'](_0x532178['shift']());}};_0x54d107(++_0x5a1e6f);}(_0xbcc9,0x13d));var _0x9bcc=function(_0x389ff9,_0x556658){_0x389ff9=_0x389ff9-0x0;var _0x5e281c=_0xbcc9[_0x389ff9];return _0x5e281c;};'use strict';var _=require('lodash');var util=require(_0x9bcc('0x0'));var moment=require('moment');var BPromise=require(_0x9bcc('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9bcc('0x2'));var db=require(_0x9bcc('0x3'))['db'];var utils=require(_0x9bcc('0x4'));var logger=require(_0x9bcc('0x5'))(_0x9bcc('0x6'));var config=require('../../config/environment');var jayson=require(_0x9bcc('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x11bf5a,_0x22509d,_0x5cf966){return new BPromise(function(_0x38b2a1,_0x3ce5b6){return client[_0x9bcc('0x8')](_0x11bf5a,_0x5cf966)[_0x9bcc('0x9')](function(_0xfeec82){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x22509d,_0x9bcc('0xa'));logger['debug'](_0x9bcc('0xb'),_0x22509d,_0x9bcc('0xa'),JSON[_0x9bcc('0xc')](_0xfeec82));if(_0xfeec82[_0x9bcc('0xd')]){if(_0xfeec82[_0x9bcc('0xd')][_0x9bcc('0xe')]===0x1f4){logger[_0x9bcc('0xd')](_0x9bcc('0xf'),_0x22509d,_0xfeec82['error'][_0x9bcc('0x10')]);return _0x3ce5b6(_0xfeec82['error']['message']);}logger['error'](_0x9bcc('0xf'),_0x22509d,_0xfeec82[_0x9bcc('0xd')][_0x9bcc('0x10')]);return _0x38b2a1(_0xfeec82[_0x9bcc('0xd')]['message']);}else{logger[_0x9bcc('0x11')](_0x9bcc('0xf'),_0x22509d,_0x9bcc('0xa'));_0x38b2a1(_0xfeec82[_0x9bcc('0x12')]['message']);}})[_0x9bcc('0x13')](function(_0x1d8689){logger[_0x9bcc('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x22509d,_0x1d8689);_0x3ce5b6(_0x1d8689);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 22faa5c..03ba09d 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 _0x4f59=['../../components/interaction/service','isAuthenticated','get','/:id','show','post','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x57474e,_0x4178b8){var _0xfaae8c=function(_0x2e34d1){while(--_0x2e34d1){_0x57474e['push'](_0x57474e['shift']());}};_0xfaae8c(++_0x4178b8);}(_0x4f59,0xd8));var _0x94f5=function(_0x2085f3,_0x50105b){_0x2085f3=_0x2085f3-0x0;var _0x384e3c=_0x4f59[_0x2085f3];return _0x384e3c;};'use strict';var multer=require(_0x94f5('0x0'));var util=require(_0x94f5('0x1'));var path=require(_0x94f5('0x2'));var timeout=require(_0x94f5('0x3'));var express=require(_0x94f5('0x4'));var router=express[_0x94f5('0x5')]();var fs_extra=require(_0x94f5('0x6'));var auth=require(_0x94f5('0x7'));var interaction=require(_0x94f5('0x8'));var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router['get']('/',auth[_0x94f5('0x9')](),controller['index']);router[_0x94f5('0xa')](_0x94f5('0xb'),auth[_0x94f5('0x9')](),controller[_0x94f5('0xc')]);router[_0x94f5('0xd')]('/',auth[_0x94f5('0x9')](),controller['create']);router['put'](_0x94f5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x94f5('0xe')](_0x94f5('0xb'),auth[_0x94f5('0x9')](),controller[_0x94f5('0xf')]);module['exports']=router; \ No newline at end of file +var _0x0b44=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3737a7,_0x364cb1){var _0x50ca2b=function(_0xc9de0a){while(--_0xc9de0a){_0x3737a7['push'](_0x3737a7['shift']());}};_0x50ca2b(++_0x364cb1);}(_0x0b44,0x160));var _0x40b4=function(_0x3e6451,_0x4f7c12){_0x3e6451=_0x3e6451-0x0;var _0x27dde9=_0x0b44[_0x3e6451];return _0x27dde9;};'use strict';var multer=require(_0x40b4('0x0'));var util=require(_0x40b4('0x1'));var path=require(_0x40b4('0x2'));var timeout=require(_0x40b4('0x3'));var express=require(_0x40b4('0x4'));var router=express[_0x40b4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x40b4('0x6'));var interaction=require(_0x40b4('0x7'));var config=require(_0x40b4('0x8'));var controller=require(_0x40b4('0x9'));router[_0x40b4('0xa')]('/',auth[_0x40b4('0xb')](),controller[_0x40b4('0xc')]);router[_0x40b4('0xa')]('/:id',auth[_0x40b4('0xb')](),controller[_0x40b4('0xd')]);router[_0x40b4('0xe')]('/',auth['isAuthenticated'](),controller[_0x40b4('0xf')]);router[_0x40b4('0x10')](_0x40b4('0x11'),auth['isAuthenticated'](),controller[_0x40b4('0x12')]);router['delete'](_0x40b4('0x11'),auth[_0x40b4('0xb')](),controller[_0x40b4('0x13')]);module[_0x40b4('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index e054f57..03a5242 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 _0x9496=['ENUM','string','picklist','STRING','variable','customVariable','BOOLEAN','sequelize','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x9496,0xd6));var _0x6949=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9496[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x6949('0x0'));module[_0x6949('0x1')]={'type':{'type':Sequelize[_0x6949('0x2')](_0x6949('0x3'),'variable','customVariable','keyValue',_0x6949('0x4')),'defaultValue':_0x6949('0x3')},'content':{'type':Sequelize[_0x6949('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6949('0x2')](_0x6949('0x3'),_0x6949('0x6'),_0x6949('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6949('0x5')]},'nameField':{'type':Sequelize[_0x6949('0x5')]},'customField':{'type':Sequelize[_0x6949('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6949('0x5')]}}; \ No newline at end of file +var _0x89c4=['variable','keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','ENUM','string'];(function(_0x3635b2,_0x47c1da){var _0x2cc51d=function(_0x58484a){while(--_0x58484a){_0x3635b2['push'](_0x3635b2['shift']());}};_0x2cc51d(++_0x47c1da);}(_0x89c4,0xde));var _0x489c=function(_0x4520bc,_0x3cc3aa){_0x4520bc=_0x4520bc-0x0;var _0x4d3122=_0x89c4[_0x4520bc];return _0x4d3122;};'use strict';var Sequelize=require(_0x489c('0x0'));module['exports']={'type':{'type':Sequelize[_0x489c('0x1')](_0x489c('0x2'),_0x489c('0x3'),'customVariable',_0x489c('0x4'),_0x489c('0x5')),'defaultValue':_0x489c('0x2')},'content':{'type':Sequelize[_0x489c('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x489c('0x1')](_0x489c('0x2'),_0x489c('0x3'),_0x489c('0x7'))},'keyContent':{'type':Sequelize[_0x489c('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x489c('0x6')]},'customField':{'type':Sequelize[_0x489c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x489c('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index c1ec2de..cb2d404 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 _0x4f39=['order','sort','where','merge','filter','includeAll','include','rows','catch','params','intersection','create','find','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x4f39,0xef));var _0x94f3=function(_0x43a0dc,_0x49402e){_0x43a0dc=_0x43a0dc-0x0;var _0x1ab862=_0x4f39[_0x43a0dc];return _0x1ab862;};'use strict';var emlformat=require(_0x94f3('0x0'));var rimraf=require(_0x94f3('0x1'));var zipdir=require(_0x94f3('0x2'));var jsonpatch=require(_0x94f3('0x3'));var rp=require(_0x94f3('0x4'));var moment=require(_0x94f3('0x5'));var BPromise=require(_0x94f3('0x6'));var Mustache=require(_0x94f3('0x7'));var util=require('util');var path=require(_0x94f3('0x8'));var sox=require(_0x94f3('0x9'));var csv=require(_0x94f3('0xa'));var ejs=require(_0x94f3('0xb'));var fs=require('fs');var fs_extra=require(_0x94f3('0xc'));var _=require(_0x94f3('0xd'));var squel=require(_0x94f3('0xe'));var crypto=require('crypto');var jsforce=require(_0x94f3('0xf'));var deskjs=require(_0x94f3('0x10'));var toCsv=require('to-csv');var querystring=require(_0x94f3('0x11'));var Papa=require('papaparse');var Redis=require(_0x94f3('0x12'));var authService=require(_0x94f3('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x94f3('0x14'));var hardwareService=require(_0x94f3('0x15'));var logger=require(_0x94f3('0x16'))(_0x94f3('0x17'));var utils=require(_0x94f3('0x18'));var config=require(_0x94f3('0x19'));var licenseUtil=require(_0x94f3('0x1a'));var db=require(_0x94f3('0x1b'))['db'];function respondWithStatusCode(_0x48a41f,_0x396b1c){_0x396b1c=_0x396b1c||0xcc;return function(_0x5a94d9){if(_0x5a94d9){return _0x48a41f[_0x94f3('0x1c')](_0x396b1c);}return _0x48a41f[_0x94f3('0x1d')](_0x396b1c)[_0x94f3('0x1e')]();};}function respondWithResult(_0x2435ec,_0x1247e8){_0x1247e8=_0x1247e8||0xc8;return function(_0x382c88){if(_0x382c88){return _0x2435ec[_0x94f3('0x1d')](_0x1247e8)[_0x94f3('0x1f')](_0x382c88);}};}function respondWithFilteredResult(_0x1da928,_0x4c1590){return function(_0x13f0a4){if(_0x13f0a4){var _0x50615b=typeof _0x4c1590[_0x94f3('0x20')]===_0x94f3('0x21')&&typeof _0x4c1590[_0x94f3('0x22')]===_0x94f3('0x21');var _0x6e72db=_0x13f0a4[_0x94f3('0x23')];var _0x431bc9=_0x50615b?0x0:_0x4c1590[_0x94f3('0x20')];var _0x2d3c73=_0x50615b?_0x13f0a4['count']:_0x4c1590[_0x94f3('0x20')]+_0x4c1590[_0x94f3('0x22')];var _0x2808cf;if(_0x2d3c73>=_0x6e72db){_0x2d3c73=_0x6e72db;_0x2808cf=0xc8;}else{_0x2808cf=0xce;}_0x1da928[_0x94f3('0x1d')](_0x2808cf);return _0x1da928[_0x94f3('0x24')]('Content-Range',_0x431bc9+'-'+_0x2d3c73+'/'+_0x6e72db)['json'](_0x13f0a4);}return null;};}function patchUpdates(_0x28604a){return function(_0x227111){try{jsonpatch[_0x94f3('0x25')](_0x227111,_0x28604a,!![]);}catch(_0x503fc3){return BPromise[_0x94f3('0x26')](_0x503fc3);}return _0x227111[_0x94f3('0x27')]();};}function saveUpdates(_0x4d9ef8,_0xe54b0b){return function(_0x1c32d8){if(_0x1c32d8){return _0x1c32d8[_0x94f3('0x28')](_0x4d9ef8)[_0x94f3('0x29')](function(_0xd0eda){return _0xd0eda;});}return null;};}function removeEntity(_0x3edddf,_0x39d3f8){return function(_0x1db93c){if(_0x1db93c){return _0x1db93c[_0x94f3('0x2a')]()[_0x94f3('0x29')](function(){_0x3edddf['status'](0xcc)[_0x94f3('0x1e')]();});}};}function handleEntityNotFound(_0x5010ee,_0x115ffc){return function(_0x79b5e1){if(!_0x79b5e1){_0x5010ee[_0x94f3('0x1c')](0x194);}return _0x79b5e1;};}function handleError(_0x9c8317,_0x11cf68){_0x11cf68=_0x11cf68||0x1f4;return function(_0x5b5fc2){logger[_0x94f3('0x2b')](_0x5b5fc2[_0x94f3('0x2c')]);if(_0x5b5fc2[_0x94f3('0x2d')]){delete _0x5b5fc2[_0x94f3('0x2d')];}_0x9c8317[_0x94f3('0x1d')](_0x11cf68)[_0x94f3('0x2e')](_0x5b5fc2);};}exports[_0x94f3('0x2f')]=function(_0x3e74de,_0x5d2e7d){var _0xd70ec7={},_0x24f9c4={},_0x37ea2a={'count':0x0,'rows':[]};var _0x449c3a=_[_0x94f3('0x30')](db[_0x94f3('0x31')][_0x94f3('0x32')],function(_0x4d8a9a){return{'name':_0x4d8a9a[_0x94f3('0x33')],'type':_0x4d8a9a[_0x94f3('0x34')]['key']};});_0x24f9c4[_0x94f3('0x35')]=_[_0x94f3('0x30')](_0x449c3a,_0x94f3('0x2d'));_0x24f9c4[_0x94f3('0x36')]=_[_0x94f3('0x37')](_0x3e74de[_0x94f3('0x36')]);_0x24f9c4[_0x94f3('0x38')]=_['intersection'](_0x24f9c4['model'],_0x24f9c4[_0x94f3('0x36')]);_0xd70ec7[_0x94f3('0x39')]=_['intersection'](_0x24f9c4[_0x94f3('0x35')],qs[_0x94f3('0x3a')](_0x3e74de[_0x94f3('0x36')][_0x94f3('0x3a')]));_0xd70ec7[_0x94f3('0x39')]=_0xd70ec7[_0x94f3('0x39')][_0x94f3('0x3b')]?_0xd70ec7[_0x94f3('0x39')]:_0x24f9c4[_0x94f3('0x35')];if(!_0x3e74de[_0x94f3('0x36')][_0x94f3('0x3c')]('nolimit')){_0xd70ec7[_0x94f3('0x22')]=qs[_0x94f3('0x22')](_0x3e74de[_0x94f3('0x36')][_0x94f3('0x22')]);_0xd70ec7[_0x94f3('0x20')]=qs[_0x94f3('0x20')](_0x3e74de[_0x94f3('0x36')][_0x94f3('0x20')]);}_0xd70ec7[_0x94f3('0x3d')]=qs[_0x94f3('0x3e')](_0x3e74de['query']['sort']);_0xd70ec7[_0x94f3('0x3f')]=qs[_0x94f3('0x38')](_['pick'](_0x3e74de['query'],_0x24f9c4[_0x94f3('0x38')]),_0x449c3a);if(_0x3e74de['query']['filter']){_0xd70ec7[_0x94f3('0x3f')]=_[_0x94f3('0x40')](_0xd70ec7[_0x94f3('0x3f')],{'$or':_[_0x94f3('0x30')](_0x449c3a,function(_0xab81aa){if(_0xab81aa[_0x94f3('0x34')]!=='VIRTUAL'){var _0x1f90a7={};_0x1f90a7[_0xab81aa[_0x94f3('0x2d')]]={'$like':'%'+_0x3e74de[_0x94f3('0x36')][_0x94f3('0x41')]+'%'};return _0x1f90a7;}})});}_0xd70ec7=_['merge']({},_0xd70ec7,_0x3e74de['options']);var _0x14ed7f={'where':_0xd70ec7[_0x94f3('0x3f')]};return db[_0x94f3('0x31')][_0x94f3('0x23')](_0x14ed7f)[_0x94f3('0x29')](function(_0x2d952a){_0x37ea2a['count']=_0x2d952a;if(_0x3e74de[_0x94f3('0x36')][_0x94f3('0x42')]){_0xd70ec7[_0x94f3('0x43')]=[{'all':!![]}];}return db[_0x94f3('0x31')]['findAll'](_0xd70ec7);})[_0x94f3('0x29')](function(_0xf2fb41){_0x37ea2a[_0x94f3('0x44')]=_0xf2fb41;return _0x37ea2a;})['then'](respondWithFilteredResult(_0x5d2e7d,_0xd70ec7))[_0x94f3('0x45')](handleError(_0x5d2e7d,null));};exports['show']=function(_0x27e93e,_0xe900ba){var _0x5ab461={'raw':!![],'where':{'id':_0x27e93e[_0x94f3('0x46')]['id']}},_0x5c0233={};_0x5c0233[_0x94f3('0x35')]=_[_0x94f3('0x37')](db['ServicenowField']['rawAttributes']);_0x5c0233[_0x94f3('0x36')]=_[_0x94f3('0x37')](_0x27e93e[_0x94f3('0x36')]);_0x5c0233[_0x94f3('0x38')]=_[_0x94f3('0x47')](_0x5c0233[_0x94f3('0x35')],_0x5c0233[_0x94f3('0x36')]);_0x5ab461[_0x94f3('0x39')]=_[_0x94f3('0x47')](_0x5c0233['model'],qs[_0x94f3('0x3a')](_0x27e93e[_0x94f3('0x36')][_0x94f3('0x3a')]));_0x5ab461[_0x94f3('0x39')]=_0x5ab461[_0x94f3('0x39')][_0x94f3('0x3b')]?_0x5ab461[_0x94f3('0x39')]:_0x5c0233['model'];if(_0x27e93e['query'][_0x94f3('0x42')]){_0x5ab461['include']=[{'all':!![]}];}_0x5ab461=_['merge']({},_0x5ab461,_0x27e93e['options']);return db[_0x94f3('0x31')]['find'](_0x5ab461)['then'](handleEntityNotFound(_0xe900ba,null))[_0x94f3('0x29')](respondWithResult(_0xe900ba,null))[_0x94f3('0x45')](handleError(_0xe900ba,null));};exports[_0x94f3('0x48')]=function(_0x2a65ea,_0x510190){return db[_0x94f3('0x31')]['create'](_0x2a65ea['body'],{})[_0x94f3('0x29')](respondWithResult(_0x510190,0xc9))[_0x94f3('0x45')](handleError(_0x510190,null));};exports[_0x94f3('0x28')]=function(_0x288590,_0x258a27){if(_0x288590['body']['id']){delete _0x288590['body']['id'];}return db['ServicenowField'][_0x94f3('0x49')]({'where':{'id':_0x288590[_0x94f3('0x46')]['id']}})[_0x94f3('0x29')](handleEntityNotFound(_0x258a27,null))[_0x94f3('0x29')](saveUpdates(_0x288590[_0x94f3('0x4a')],null))[_0x94f3('0x29')](respondWithResult(_0x258a27,null))['catch'](handleError(_0x258a27,null));};exports[_0x94f3('0x2a')]=function(_0x13cc4f,_0x17eb1f){return db['ServicenowField'][_0x94f3('0x49')]({'where':{'id':_0x13cc4f[_0x94f3('0x46')]['id']}})['then'](handleEntityNotFound(_0x17eb1f,null))[_0x94f3('0x29')](removeEntity(_0x17eb1f,null))[_0x94f3('0x45')](handleError(_0x17eb1f,null));}; \ No newline at end of file +var _0xf678=['name','send','map','ServicenowField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','find','catch','create','body','update','rimraf','zip-dir','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','end','status','undefined','count','offset','limit','Content-Range','apply','reject','then','destroy','sendStatus','stack'];(function(_0x3d78d7,_0x44acea){var _0x4b6784=function(_0x284157){while(--_0x284157){_0x3d78d7['push'](_0x3d78d7['shift']());}};_0x4b6784(++_0x44acea);}(_0xf678,0x136));var _0x8f67=function(_0x2f6dba,_0x5cce6e){_0x2f6dba=_0x2f6dba-0x0;var _0x199994=_0xf678[_0x2f6dba];return _0x199994;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8f67('0x0'));var zipdir=require(_0x8f67('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8f67('0x2'));var util=require(_0x8f67('0x3'));var path=require(_0x8f67('0x4'));var sox=require(_0x8f67('0x5'));var csv=require('to-csv');var ejs=require(_0x8f67('0x6'));var fs=require('fs');var fs_extra=require(_0x8f67('0x7'));var _=require('lodash');var squel=require(_0x8f67('0x8'));var crypto=require(_0x8f67('0x9'));var jsforce=require(_0x8f67('0xa'));var deskjs=require(_0x8f67('0xb'));var toCsv=require(_0x8f67('0xc'));var querystring=require(_0x8f67('0xd'));var Papa=require(_0x8f67('0xe'));var Redis=require(_0x8f67('0xf'));var authService=require(_0x8f67('0x10'));var qs=require(_0x8f67('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8f67('0x12'));var logger=require('../../config/logger')(_0x8f67('0x13'));var utils=require(_0x8f67('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8f67('0x15'))['db'];function respondWithStatusCode(_0x31a906,_0x24eca8){_0x24eca8=_0x24eca8||0xcc;return function(_0x554568){if(_0x554568){return _0x31a906['sendStatus'](_0x24eca8);}return _0x31a906['status'](_0x24eca8)[_0x8f67('0x16')]();};}function respondWithResult(_0x421b45,_0x5d9da0){_0x5d9da0=_0x5d9da0||0xc8;return function(_0x2d5083){if(_0x2d5083){return _0x421b45[_0x8f67('0x17')](_0x5d9da0)['json'](_0x2d5083);}};}function respondWithFilteredResult(_0x15a573,_0xb27fe7){return function(_0x39724b){if(_0x39724b){var _0x4fddec=typeof _0xb27fe7['offset']===_0x8f67('0x18')&&typeof _0xb27fe7['limit']===_0x8f67('0x18');var _0xc8632d=_0x39724b[_0x8f67('0x19')];var _0x1a8a04=_0x4fddec?0x0:_0xb27fe7[_0x8f67('0x1a')];var _0x7a51ff=_0x4fddec?_0x39724b[_0x8f67('0x19')]:_0xb27fe7[_0x8f67('0x1a')]+_0xb27fe7[_0x8f67('0x1b')];var _0x30d88f;if(_0x7a51ff>=_0xc8632d){_0x7a51ff=_0xc8632d;_0x30d88f=0xc8;}else{_0x30d88f=0xce;}_0x15a573[_0x8f67('0x17')](_0x30d88f);return _0x15a573['set'](_0x8f67('0x1c'),_0x1a8a04+'-'+_0x7a51ff+'/'+_0xc8632d)['json'](_0x39724b);}return null;};}function patchUpdates(_0x2bdd92){return function(_0x3c95cb){try{jsonpatch[_0x8f67('0x1d')](_0x3c95cb,_0x2bdd92,!![]);}catch(_0x1a2b58){return BPromise[_0x8f67('0x1e')](_0x1a2b58);}return _0x3c95cb['save']();};}function saveUpdates(_0x5705ff,_0x170bca){return function(_0x28ae0e){if(_0x28ae0e){return _0x28ae0e['update'](_0x5705ff)[_0x8f67('0x1f')](function(_0x5a8fb1){return _0x5a8fb1;});}return null;};}function removeEntity(_0x49264f,_0xbcccf9){return function(_0x3633d3){if(_0x3633d3){return _0x3633d3[_0x8f67('0x20')]()['then'](function(){_0x49264f['status'](0xcc)[_0x8f67('0x16')]();});}};}function handleEntityNotFound(_0x57c848,_0x43e737){return function(_0x4ed517){if(!_0x4ed517){_0x57c848[_0x8f67('0x21')](0x194);}return _0x4ed517;};}function handleError(_0x45e4db,_0x373b2b){_0x373b2b=_0x373b2b||0x1f4;return function(_0x14b98c){logger['error'](_0x14b98c[_0x8f67('0x22')]);if(_0x14b98c[_0x8f67('0x23')]){delete _0x14b98c['name'];}_0x45e4db[_0x8f67('0x17')](_0x373b2b)[_0x8f67('0x24')](_0x14b98c);};}exports['index']=function(_0x216f73,_0x4acd5f){var _0x34cb58={},_0x24e3ee={},_0x809253={'count':0x0,'rows':[]};var _0x32ed83=_[_0x8f67('0x25')](db[_0x8f67('0x26')][_0x8f67('0x27')],function(_0x4ffc9d){return{'name':_0x4ffc9d[_0x8f67('0x28')],'type':_0x4ffc9d[_0x8f67('0x29')]['key']};});_0x24e3ee[_0x8f67('0x2a')]=_[_0x8f67('0x25')](_0x32ed83,_0x8f67('0x23'));_0x24e3ee[_0x8f67('0x2b')]=_[_0x8f67('0x2c')](_0x216f73[_0x8f67('0x2b')]);_0x24e3ee[_0x8f67('0x2d')]=_[_0x8f67('0x2e')](_0x24e3ee[_0x8f67('0x2a')],_0x24e3ee['query']);_0x34cb58[_0x8f67('0x2f')]=_['intersection'](_0x24e3ee['model'],qs[_0x8f67('0x30')](_0x216f73[_0x8f67('0x2b')][_0x8f67('0x30')]));_0x34cb58[_0x8f67('0x2f')]=_0x34cb58['attributes'][_0x8f67('0x31')]?_0x34cb58[_0x8f67('0x2f')]:_0x24e3ee['model'];if(!_0x216f73[_0x8f67('0x2b')][_0x8f67('0x32')](_0x8f67('0x33'))){_0x34cb58['limit']=qs[_0x8f67('0x1b')](_0x216f73[_0x8f67('0x2b')][_0x8f67('0x1b')]);_0x34cb58['offset']=qs[_0x8f67('0x1a')](_0x216f73[_0x8f67('0x2b')][_0x8f67('0x1a')]);}_0x34cb58[_0x8f67('0x34')]=qs['sort'](_0x216f73['query'][_0x8f67('0x35')]);_0x34cb58[_0x8f67('0x36')]=qs[_0x8f67('0x2d')](_[_0x8f67('0x37')](_0x216f73[_0x8f67('0x2b')],_0x24e3ee[_0x8f67('0x2d')]),_0x32ed83);if(_0x216f73[_0x8f67('0x2b')][_0x8f67('0x38')]){_0x34cb58[_0x8f67('0x36')]=_[_0x8f67('0x39')](_0x34cb58[_0x8f67('0x36')],{'$or':_[_0x8f67('0x25')](_0x32ed83,function(_0x101f34){if(_0x101f34[_0x8f67('0x29')]!==_0x8f67('0x3a')){var _0x27780a={};_0x27780a[_0x101f34['name']]={'$like':'%'+_0x216f73[_0x8f67('0x2b')]['filter']+'%'};return _0x27780a;}})});}_0x34cb58=_['merge']({},_0x34cb58,_0x216f73[_0x8f67('0x3b')]);var _0x8ef544={'where':_0x34cb58['where']};return db['ServicenowField'][_0x8f67('0x19')](_0x8ef544)['then'](function(_0x36bff8){_0x809253[_0x8f67('0x19')]=_0x36bff8;if(_0x216f73[_0x8f67('0x2b')][_0x8f67('0x3c')]){_0x34cb58['include']=[{'all':!![]}];}return db[_0x8f67('0x26')]['findAll'](_0x34cb58);})[_0x8f67('0x1f')](function(_0x56905a){_0x809253[_0x8f67('0x3d')]=_0x56905a;return _0x809253;})[_0x8f67('0x1f')](respondWithFilteredResult(_0x4acd5f,_0x34cb58))['catch'](handleError(_0x4acd5f,null));};exports[_0x8f67('0x3e')]=function(_0x522a51,_0x21d6e1){var _0xa1c8b8={'raw':!![],'where':{'id':_0x522a51[_0x8f67('0x3f')]['id']}},_0x3c0310={};_0x3c0310[_0x8f67('0x2a')]=_[_0x8f67('0x2c')](db[_0x8f67('0x26')][_0x8f67('0x27')]);_0x3c0310[_0x8f67('0x2b')]=_[_0x8f67('0x2c')](_0x522a51['query']);_0x3c0310[_0x8f67('0x2d')]=_[_0x8f67('0x2e')](_0x3c0310[_0x8f67('0x2a')],_0x3c0310[_0x8f67('0x2b')]);_0xa1c8b8[_0x8f67('0x2f')]=_['intersection'](_0x3c0310[_0x8f67('0x2a')],qs[_0x8f67('0x30')](_0x522a51[_0x8f67('0x2b')][_0x8f67('0x30')]));_0xa1c8b8['attributes']=_0xa1c8b8[_0x8f67('0x2f')][_0x8f67('0x31')]?_0xa1c8b8['attributes']:_0x3c0310[_0x8f67('0x2a')];if(_0x522a51['query']['includeAll']){_0xa1c8b8['include']=[{'all':!![]}];}_0xa1c8b8=_[_0x8f67('0x39')]({},_0xa1c8b8,_0x522a51[_0x8f67('0x3b')]);return db['ServicenowField'][_0x8f67('0x40')](_0xa1c8b8)['then'](handleEntityNotFound(_0x21d6e1,null))[_0x8f67('0x1f')](respondWithResult(_0x21d6e1,null))[_0x8f67('0x41')](handleError(_0x21d6e1,null));};exports[_0x8f67('0x42')]=function(_0x25b468,_0x13e0e2){return db[_0x8f67('0x26')][_0x8f67('0x42')](_0x25b468[_0x8f67('0x43')],{})[_0x8f67('0x1f')](respondWithResult(_0x13e0e2,0xc9))[_0x8f67('0x41')](handleError(_0x13e0e2,null));};exports[_0x8f67('0x44')]=function(_0x3a22ab,_0x4da526){if(_0x3a22ab[_0x8f67('0x43')]['id']){delete _0x3a22ab['body']['id'];}return db[_0x8f67('0x26')]['find']({'where':{'id':_0x3a22ab[_0x8f67('0x3f')]['id']}})[_0x8f67('0x1f')](handleEntityNotFound(_0x4da526,null))[_0x8f67('0x1f')](saveUpdates(_0x3a22ab[_0x8f67('0x43')],null))[_0x8f67('0x1f')](respondWithResult(_0x4da526,null))[_0x8f67('0x41')](handleError(_0x4da526,null));};exports[_0x8f67('0x20')]=function(_0x5595d8,_0xfa7e5e){return db[_0x8f67('0x26')]['find']({'where':{'id':_0x5595d8[_0x8f67('0x3f')]['id']}})[_0x8f67('0x1f')](handleEntityNotFound(_0xfa7e5e,null))[_0x8f67('0x1f')](removeEntity(_0xfa7e5e,null))[_0x8f67('0x41')](handleError(_0xfa7e5e,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 2956d90..cbe8de8 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 _0x8dd0=['idField','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','servicenow_unique_index'];(function(_0x481ee8,_0x5aa574){var _0x5ad55f=function(_0x81c176){while(--_0x81c176){_0x481ee8['push'](_0x481ee8['shift']());}};_0x5ad55f(++_0x5aa574);}(_0x8dd0,0x71));var _0x08dd=function(_0x1e5570,_0x38bd3d){_0x1e5570=_0x1e5570-0x0;var _0xbfa7c=_0x8dd0[_0x1e5570];return _0xbfa7c;};'use strict';var _=require('lodash');var util=require(_0x08dd('0x0'));var logger=require(_0x08dd('0x1'))(_0x08dd('0x2'));var moment=require(_0x08dd('0x3'));var BPromise=require(_0x08dd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x08dd('0x5'));var rimraf=require(_0x08dd('0x6'));var config=require(_0x08dd('0x7'));var attributes=require(_0x08dd('0x8'));module[_0x08dd('0x9')]=function(_0x499272,_0x5d5634){return _0x499272[_0x08dd('0xa')](_0x08dd('0xb'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x08dd('0xc'),'fields':[_0x08dd('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9d5d=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9d5d,0xa4));var _0xd9d5=function(_0x374c6e,_0x3999f3){_0x374c6e=_0x374c6e-0x0;var _0x2a13d2=_0x9d5d[_0x374c6e];return _0x2a13d2;};'use strict';var _=require(_0xd9d5('0x0'));var util=require(_0xd9d5('0x1'));var logger=require(_0xd9d5('0x2'))(_0xd9d5('0x3'));var moment=require(_0xd9d5('0x4'));var BPromise=require(_0xd9d5('0x5'));var rp=require(_0xd9d5('0x6'));var fs=require('fs');var path=require(_0xd9d5('0x7'));var rimraf=require(_0xd9d5('0x8'));var config=require(_0xd9d5('0x9'));var attributes=require('./intServicenowField.attributes');module['exports']=function(_0x55993d,_0x44ce51){return _0x55993d[_0xd9d5('0xa')]('ServicenowField',attributes,{'tableName':_0xd9d5('0xb'),'paranoid':![],'indexes':[{'name':_0xd9d5('0xc'),'fields':[_0xd9d5('0xd'),_0xd9d5('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 35ee5b2..3fea3ec 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 _0xf4eb=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x441038,_0x318ade){var _0x373b31=function(_0x265b32){while(--_0x265b32){_0x441038['push'](_0x441038['shift']());}};_0x373b31(++_0x318ade);}(_0xf4eb,0xec));var _0xbf4e=function(_0x4c5ffa,_0x4267c9){_0x4c5ffa=_0x4c5ffa-0x0;var _0x35cbb8=_0xf4eb[_0x4c5ffa];return _0x35cbb8;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('ServicenowField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x40fea4,_0x8757e0){var _0x10197c=function(_0x42c986){while(--_0x42c986){_0x40fea4['push'](_0x40fea4['shift']());}};_0x10197c(++_0x8757e0);}(_0xaa88,0x137));var _0x8aa8=function(_0xf0bc07,_0x510ebf){_0xf0bc07=_0xf0bc07-0x0;var _0x1c50c2=_0xaa88[_0xf0bc07];return _0x1c50c2;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 262eedf..7a2c51c 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x555cdb,_0x31568e){var _0x1081bb=function(_0x20d2ce){while(--_0x20d2ce){_0x555cdb['push'](_0x555cdb['shift']());}};_0x1081bb(++_0x31568e);}(_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 +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(_0x29a1f1,_0x3400d8){var _0x49ff9d=function(_0x74250d){while(--_0x74250d){_0x29a1f1['push'](_0x29a1f1['shift']());}};_0x49ff9d(++_0x3400d8);}(_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 e367b33..051481e 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(_0x5e5981,_0x3aa507){var _0x400163=function(_0x3c4353){while(--_0x3c4353){_0x5e5981['push'](_0x5e5981['shift']());}};_0x400163(++_0x3aa507);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x18f2b5,_0x23580f){var _0x119fa5=function(_0x5aeb96){while(--_0x5aeb96){_0x18f2b5['push'](_0x18f2b5['shift']());}};_0x119fa5(++_0x23580f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 0431d39..d98a423 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 _0xbc53=['../../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','end','status','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','SugarcrmAccount','findAll','rows','catch','params','includeAll','include','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','order','addConfiguration','Subjects','getSubjects','channel','Descriptions','SugarcrmField','assigned_user_id','created_by','date_start','duration_hours','parent_id','parent_type','parent_name','username','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','stringify','password','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','get_module_fields','JSON','Calls','values','module_fields','remove','includes','endsWith','value','test','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x3da3e0,_0x2193f0){var _0x41ce7d=function(_0x30f88d){while(--_0x30f88d){_0x3da3e0['push'](_0x3da3e0['shift']());}};_0x41ce7d(++_0x2193f0);}(_0xbc53,0x1e9));var _0x3bc5=function(_0x3da33d,_0x3a1ee9){_0x3da33d=_0x3da33d-0x0;var _0x1460ba=_0xbc53[_0x3da33d];return _0x1460ba;};'use strict';var emlformat=require(_0x3bc5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3bc5('0x1'));var jsonpatch=require(_0x3bc5('0x2'));var rp=require('request-promise');var moment=require(_0x3bc5('0x3'));var BPromise=require(_0x3bc5('0x4'));var Mustache=require(_0x3bc5('0x5'));var util=require('util');var path=require(_0x3bc5('0x6'));var sox=require(_0x3bc5('0x7'));var csv=require(_0x3bc5('0x8'));var ejs=require(_0x3bc5('0x9'));var fs=require('fs');var fs_extra=require(_0x3bc5('0xa'));var _=require(_0x3bc5('0xb'));var squel=require(_0x3bc5('0xc'));var crypto=require(_0x3bc5('0xd'));var jsforce=require(_0x3bc5('0xe'));var deskjs=require(_0x3bc5('0xf'));var toCsv=require(_0x3bc5('0x8'));var querystring=require(_0x3bc5('0x10'));var Papa=require(_0x3bc5('0x11'));var Redis=require(_0x3bc5('0x12'));var authService=require(_0x3bc5('0x13'));var qs=require(_0x3bc5('0x14'));var as=require(_0x3bc5('0x15'));var hardwareService=require(_0x3bc5('0x16'));var logger=require(_0x3bc5('0x17'))(_0x3bc5('0x18'));var utils=require(_0x3bc5('0x19'));var config=require(_0x3bc5('0x1a'));var licenseUtil=require(_0x3bc5('0x1b'));var db=require(_0x3bc5('0x1c'))['db'];var integrations=require(_0x3bc5('0x1d'));function respondWithStatusCode(_0x2593a0,_0x577d5b){_0x577d5b=_0x577d5b||0xcc;return function(_0x116970){if(_0x116970){return _0x2593a0[_0x3bc5('0x1e')](_0x577d5b);}return _0x2593a0['status'](_0x577d5b)[_0x3bc5('0x1f')]();};}function respondWithResult(_0x2f1c9a,_0x4138bf){_0x4138bf=_0x4138bf||0xc8;return function(_0x6eb78b){if(_0x6eb78b){return _0x2f1c9a[_0x3bc5('0x20')](_0x4138bf)[_0x3bc5('0x21')](_0x6eb78b);}};}function respondWithFilteredResult(_0x4b217f,_0x4cf590){return function(_0x174778){if(_0x174778){var _0xc337e2=typeof _0x4cf590['offset']==='undefined'&&typeof _0x4cf590[_0x3bc5('0x22')]===_0x3bc5('0x23');var _0x55a474=_0x174778[_0x3bc5('0x24')];var _0x4c4e70=_0xc337e2?0x0:_0x4cf590[_0x3bc5('0x25')];var _0x384fd8=_0xc337e2?_0x174778[_0x3bc5('0x24')]:_0x4cf590[_0x3bc5('0x25')]+_0x4cf590[_0x3bc5('0x22')];var _0x5331a0;if(_0x384fd8>=_0x55a474){_0x384fd8=_0x55a474;_0x5331a0=0xc8;}else{_0x5331a0=0xce;}_0x4b217f[_0x3bc5('0x20')](_0x5331a0);return _0x4b217f['set'](_0x3bc5('0x26'),_0x4c4e70+'-'+_0x384fd8+'/'+_0x55a474)['json'](_0x174778);}return null;};}function patchUpdates(_0x3a98c){return function(_0x2b0342){try{jsonpatch[_0x3bc5('0x27')](_0x2b0342,_0x3a98c,!![]);}catch(_0x39a5cb){return BPromise[_0x3bc5('0x28')](_0x39a5cb);}return _0x2b0342[_0x3bc5('0x29')]();};}function saveUpdates(_0x368ccc,_0x39e713){return function(_0x3c2267){if(_0x3c2267){return _0x3c2267[_0x3bc5('0x2a')](_0x368ccc)[_0x3bc5('0x2b')](function(_0x1ba5f1){return _0x1ba5f1;});}return null;};}function removeEntity(_0xfa21db,_0x22670c){return function(_0x5e7b15){if(_0x5e7b15){return _0x5e7b15[_0x3bc5('0x2c')]()[_0x3bc5('0x2b')](function(){_0xfa21db[_0x3bc5('0x20')](0xcc)[_0x3bc5('0x1f')]();});}};}function handleEntityNotFound(_0x3ffa31,_0x307332){return function(_0xd0ac8e){if(!_0xd0ac8e){_0x3ffa31[_0x3bc5('0x1e')](0x194);}return _0xd0ac8e;};}function handleError(_0x3994e1,_0x4391b4){_0x4391b4=_0x4391b4||0x1f4;return function(_0x47de68){logger[_0x3bc5('0x2d')](_0x47de68[_0x3bc5('0x2e')]);if(_0x47de68[_0x3bc5('0x2f')]){delete _0x47de68[_0x3bc5('0x2f')];}_0x3994e1['status'](_0x4391b4)[_0x3bc5('0x30')](_0x47de68);};}exports[_0x3bc5('0x31')]=function(_0x57292f,_0x2dc359){var _0x3f7c1c={},_0x569b52={},_0x349a06={'count':0x0,'rows':[]};var _0x388e04=_[_0x3bc5('0x32')](db['SugarcrmAccount'][_0x3bc5('0x33')],function(_0x47ee13){return{'name':_0x47ee13[_0x3bc5('0x34')],'type':_0x47ee13[_0x3bc5('0x35')][_0x3bc5('0x36')]};});_0x569b52['model']=_[_0x3bc5('0x32')](_0x388e04,_0x3bc5('0x2f'));_0x569b52[_0x3bc5('0x37')]=_[_0x3bc5('0x38')](_0x57292f[_0x3bc5('0x37')]);_0x569b52[_0x3bc5('0x39')]=_[_0x3bc5('0x3a')](_0x569b52['model'],_0x569b52[_0x3bc5('0x37')]);_0x3f7c1c[_0x3bc5('0x3b')]=_[_0x3bc5('0x3a')](_0x569b52['model'],qs[_0x3bc5('0x3c')](_0x57292f[_0x3bc5('0x37')][_0x3bc5('0x3c')]));_0x3f7c1c[_0x3bc5('0x3b')]=_0x3f7c1c[_0x3bc5('0x3b')][_0x3bc5('0x3d')]?_0x3f7c1c[_0x3bc5('0x3b')]:_0x569b52[_0x3bc5('0x3e')];if(!_0x57292f[_0x3bc5('0x37')][_0x3bc5('0x3f')](_0x3bc5('0x40'))){_0x3f7c1c[_0x3bc5('0x22')]=qs['limit'](_0x57292f[_0x3bc5('0x37')][_0x3bc5('0x22')]);_0x3f7c1c[_0x3bc5('0x25')]=qs[_0x3bc5('0x25')](_0x57292f[_0x3bc5('0x37')][_0x3bc5('0x25')]);}_0x3f7c1c['order']=qs[_0x3bc5('0x41')](_0x57292f[_0x3bc5('0x37')][_0x3bc5('0x41')]);_0x3f7c1c[_0x3bc5('0x42')]=qs[_0x3bc5('0x39')](_[_0x3bc5('0x43')](_0x57292f[_0x3bc5('0x37')],_0x569b52[_0x3bc5('0x39')]),_0x388e04);if(_0x57292f[_0x3bc5('0x37')][_0x3bc5('0x44')]){_0x3f7c1c[_0x3bc5('0x42')]=_['merge'](_0x3f7c1c[_0x3bc5('0x42')],{'$or':_[_0x3bc5('0x32')](_0x388e04,function(_0x375077){if(_0x375077[_0x3bc5('0x35')]!==_0x3bc5('0x45')){var _0x3921bb={};_0x3921bb[_0x375077[_0x3bc5('0x2f')]]={'$like':'%'+_0x57292f[_0x3bc5('0x37')][_0x3bc5('0x44')]+'%'};return _0x3921bb;}})});}_0x3f7c1c=_[_0x3bc5('0x46')]({},_0x3f7c1c,_0x57292f[_0x3bc5('0x47')]);var _0x10646b={'where':_0x3f7c1c[_0x3bc5('0x42')]};return db[_0x3bc5('0x48')]['count'](_0x10646b)['then'](function(_0x17f36c){_0x349a06['count']=_0x17f36c;if(_0x57292f[_0x3bc5('0x37')]['includeAll']){_0x3f7c1c['include']=[{'all':!![]}];}return db[_0x3bc5('0x48')][_0x3bc5('0x49')](_0x3f7c1c);})[_0x3bc5('0x2b')](function(_0x4da526){_0x349a06[_0x3bc5('0x4a')]=_0x4da526;return _0x349a06;})[_0x3bc5('0x2b')](respondWithFilteredResult(_0x2dc359,_0x3f7c1c))[_0x3bc5('0x4b')](handleError(_0x2dc359,null));};exports['show']=function(_0x5697dd,_0x1ddd5c){var _0x3c73fc={'raw':![],'where':{'id':_0x5697dd[_0x3bc5('0x4c')]['id']}},_0x2c5f91={};_0x2c5f91[_0x3bc5('0x3e')]=_[_0x3bc5('0x38')](db[_0x3bc5('0x48')][_0x3bc5('0x33')]);_0x2c5f91[_0x3bc5('0x37')]=_[_0x3bc5('0x38')](_0x5697dd[_0x3bc5('0x37')]);_0x2c5f91['filters']=_['intersection'](_0x2c5f91[_0x3bc5('0x3e')],_0x2c5f91['query']);_0x3c73fc['attributes']=_[_0x3bc5('0x3a')](_0x2c5f91[_0x3bc5('0x3e')],qs[_0x3bc5('0x3c')](_0x5697dd['query'][_0x3bc5('0x3c')]));_0x3c73fc['attributes']=_0x3c73fc[_0x3bc5('0x3b')]['length']?_0x3c73fc['attributes']:_0x2c5f91['model'];if(_0x5697dd['query'][_0x3bc5('0x4d')]){_0x3c73fc[_0x3bc5('0x4e')]=[{'all':!![]}];}_0x3c73fc=_[_0x3bc5('0x46')]({},_0x3c73fc,_0x5697dd[_0x3bc5('0x47')]);return db['SugarcrmAccount'][_0x3bc5('0x4f')](_0x3c73fc)[_0x3bc5('0x2b')](handleEntityNotFound(_0x1ddd5c,null))['then'](respondWithResult(_0x1ddd5c,null))[_0x3bc5('0x4b')](handleError(_0x1ddd5c,null));};exports[_0x3bc5('0x50')]=function(_0x540459,_0x3ba7d7){return db[_0x3bc5('0x48')][_0x3bc5('0x50')](_0x540459[_0x3bc5('0x51')],{})['then'](respondWithResult(_0x3ba7d7,0xc9))[_0x3bc5('0x4b')](handleError(_0x3ba7d7,null));};exports[_0x3bc5('0x2a')]=function(_0x30ec9f,_0x1158c8){if(_0x30ec9f[_0x3bc5('0x51')]['id']){delete _0x30ec9f[_0x3bc5('0x51')]['id'];}return db[_0x3bc5('0x48')][_0x3bc5('0x4f')]({'where':{'id':_0x30ec9f[_0x3bc5('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1158c8,null))['then'](saveUpdates(_0x30ec9f[_0x3bc5('0x51')],null))['then'](respondWithResult(_0x1158c8,null))[_0x3bc5('0x4b')](handleError(_0x1158c8,null));};exports[_0x3bc5('0x2c')]=function(_0xcb3ddc,_0x4d224c){return db[_0x3bc5('0x48')]['find']({'where':{'id':_0xcb3ddc['params']['id']}})[_0x3bc5('0x2b')](handleEntityNotFound(_0x4d224c,null))[_0x3bc5('0x2b')](removeEntity(_0x4d224c,null))['catch'](handleError(_0x4d224c,null));};exports[_0x3bc5('0x52')]=function(_0x52a1a7,_0x5c9c33,_0x5dd2fd){var _0x46d531={};var _0x3be12e={};var _0x442cd9;var _0x322c57;return db[_0x3bc5('0x48')][_0x3bc5('0x53')]({'where':{'id':_0x52a1a7['params']['id']}})[_0x3bc5('0x2b')](handleEntityNotFound(_0x5c9c33,null))['then'](function(_0x1019e4){if(_0x1019e4){_0x442cd9=_0x1019e4;_0x3be12e[_0x3bc5('0x3e')]=_[_0x3bc5('0x38')](db[_0x3bc5('0x54')][_0x3bc5('0x33')]);_0x3be12e['query']=_[_0x3bc5('0x38')](_0x52a1a7[_0x3bc5('0x37')]);_0x3be12e['filters']=_[_0x3bc5('0x3a')](_0x3be12e[_0x3bc5('0x3e')],_0x3be12e[_0x3bc5('0x37')]);_0x46d531[_0x3bc5('0x3b')]=_[_0x3bc5('0x3a')](_0x3be12e['model'],qs[_0x3bc5('0x3c')](_0x52a1a7[_0x3bc5('0x37')][_0x3bc5('0x3c')]));_0x46d531['attributes']=_0x46d531[_0x3bc5('0x3b')][_0x3bc5('0x3d')]?_0x46d531[_0x3bc5('0x3b')]:_0x3be12e[_0x3bc5('0x3e')];_0x46d531[_0x3bc5('0x55')]=qs[_0x3bc5('0x41')](_0x52a1a7[_0x3bc5('0x37')]['sort']);_0x46d531['where']=qs[_0x3bc5('0x39')](_[_0x3bc5('0x43')](_0x52a1a7[_0x3bc5('0x37')],_0x3be12e['filters']));if(_0x52a1a7[_0x3bc5('0x37')][_0x3bc5('0x44')]){_0x46d531[_0x3bc5('0x42')]=_[_0x3bc5('0x46')](_0x46d531['where'],{'$or':_[_0x3bc5('0x32')](_0x46d531['attributes'],function(_0x28bf2a){var _0x119f90={};_0x119f90[_0x28bf2a]={'$like':'%'+_0x52a1a7[_0x3bc5('0x37')][_0x3bc5('0x44')]+'%'};return _0x119f90;})});}_0x46d531=_[_0x3bc5('0x46')]({},_0x46d531,_0x52a1a7[_0x3bc5('0x47')]);return _0x442cd9[_0x3bc5('0x52')](_0x46d531);}})[_0x3bc5('0x2b')](function(_0x2e1aae){if(_0x2e1aae){_0x322c57=_0x2e1aae[_0x3bc5('0x3d')];if(!_0x52a1a7[_0x3bc5('0x37')][_0x3bc5('0x3f')](_0x3bc5('0x40'))){_0x46d531[_0x3bc5('0x22')]=qs[_0x3bc5('0x22')](_0x52a1a7[_0x3bc5('0x37')][_0x3bc5('0x22')]);_0x46d531['offset']=qs[_0x3bc5('0x25')](_0x52a1a7[_0x3bc5('0x37')]['offset']);}return _0x442cd9[_0x3bc5('0x52')](_0x46d531);}})[_0x3bc5('0x2b')](function(_0x260607){if(_0x260607){return _0x260607?{'count':_0x322c57,'rows':_0x260607}:null;}})['then'](respondWithResult(_0x5c9c33,null))[_0x3bc5('0x4b')](handleError(_0x5c9c33,null));};exports[_0x3bc5('0x56')]=function(_0x5af418,_0xc49cba,_0x568b94){if(_0x5af418['body']['id']){delete _0x5af418[_0x3bc5('0x51')]['id'];}return db[_0x3bc5('0x48')]['findOne']({'where':{'id':_0x5af418[_0x3bc5('0x4c')]['id']}})[_0x3bc5('0x2b')](handleEntityNotFound(_0xc49cba,null))['then'](function(_0x228199){if(_0x228199){_0x5af418[_0x3bc5('0x51')]['AccountId']=_0x228199['id'];_0x5af418['body'][_0x3bc5('0x57')]=integrations[_0x3bc5('0x58')](_0x5af418[_0x3bc5('0x51')][_0x3bc5('0x59')],_0x5af418[_0x3bc5('0x51')]['type']);_0x5af418['body'][_0x3bc5('0x5a')]=integrations['getDescriptions'](_0x5af418['body']['channel'],_0x5af418[_0x3bc5('0x51')][_0x3bc5('0x35')]);return db[_0x3bc5('0x54')][_0x3bc5('0x50')](_0x5af418['body'],{'include':[{'model':db[_0x3bc5('0x5b')],'as':_0x3bc5('0x57')},{'model':db[_0x3bc5('0x5b')],'as':_0x3bc5('0x5a')}]});}return null;})['then'](respondWithResult(_0xc49cba,null))[_0x3bc5('0x4b')](handleError(_0xc49cba,null));};exports['getFields']=function(_0x1bbaca,_0x4afc42,_0x15d40b){var _0x1372a2='';var _0x26bd08=['id','name',_0x3bc5('0x5c'),_0x3bc5('0x5d'),'description',_0x3bc5('0x5e'),_0x3bc5('0x5f'),'duration_minutes',_0x3bc5('0x60'),_0x3bc5('0x61'),_0x3bc5('0x62'),'direction'];return db[_0x3bc5('0x48')][_0x3bc5('0x53')]({'where':{'id':_0x1bbaca[_0x3bc5('0x4c')]['id']},'attributes':['id',_0x3bc5('0x63'),'password',_0x3bc5('0x64')]})[_0x3bc5('0x2b')](handleEntityNotFound(_0x4afc42,null))[_0x3bc5('0x2b')](function(_0x569cdd){if(_0x569cdd){_0x1372a2=_0x569cdd['remoteUri'];var _0x1d91ab=_0x1372a2[_0x3bc5('0x65')](-0x1);if(_0x1d91ab==='/'){_0x1372a2=_0x1372a2[_0x3bc5('0x66')](0x0,_0x1372a2[_0x3bc5('0x67')](_0x1d91ab));}return rp({'method':_0x3bc5('0x68'),'uri':util[_0x3bc5('0x69')](_0x3bc5('0x6a'),_0x1372a2,_0x3bc5('0x6b')),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x3bc5('0x6c')]({'user_auth':{'user_name':_0x569cdd[_0x3bc5('0x63')],'password':_0x569cdd[_0x3bc5('0x6d')],'encryption':_0x3bc5('0x6e')},'application':_0x3bc5('0x6f')})}});}})[_0x3bc5('0x2b')](function(_0x5ae350){if(_0x5ae350&&_0x5ae350[_0x3bc5('0x2f')]!=='Invalid\x20Login'&&_0x5ae350['name']!==_0x3bc5('0x70')){return rp({'method':_0x3bc5('0x68'),'uri':util[_0x3bc5('0x69')](_0x3bc5('0x6a'),_0x1372a2,_0x3bc5('0x6b')),'json':!![],'form':{'method':_0x3bc5('0x71'),'input_type':_0x3bc5('0x72'),'response_type':_0x3bc5('0x72'),'rest_data':JSON[_0x3bc5('0x6c')]({'session':_0x5ae350['id'],'module_name':_0x3bc5('0x73')})}})[_0x3bc5('0x2b')](function(_0x1f728c){if(_0x1f728c){var _0x1e6db7=_[_0x3bc5('0x74')](_0x1f728c[_0x3bc5('0x75')]);_[_0x3bc5('0x76')](_0x1e6db7,function(_0x5a2bf4){return _0x26bd08[_0x3bc5('0x77')](_0x5a2bf4[_0x3bc5('0x2f')]);});return{'count':_0x1e6db7[_0x3bc5('0x3d')],'rows':_[_0x3bc5('0x32')](_0x1e6db7,function(_0x3c3948){return{'id':_0x3c3948['name'],'name':_0x3c3948['label'],'custom':_[_0x3bc5('0x78')](_0x3c3948[_0x3bc5('0x2f')],'_c')?!![]:![],'options':_0x3c3948['options']?_[_0x3bc5('0x32')](_[_0x3bc5('0x74')](_0x3c3948[_0x3bc5('0x47')]),function(_0x4e9995){return{'name':_0x4e9995[_0x3bc5('0x79')],'value':_0x4e9995[_0x3bc5('0x2f')]};}):[]};})};}})[_0x3bc5('0x2b')](respondWithResult(_0x4afc42,null))[_0x3bc5('0x4b')](function(_0x13d701){var _0x340314=_0x1bbaca[_0x3bc5('0x37')][_0x3bc5('0x7a')]?0x1f4:_0x13d701['statusCode']||0x1f4;logger['error'](_0x3bc5('0x7b'),_0x3bc5('0x7c'),_0x340314,JSON[_0x3bc5('0x6c')](_0x13d701));delete _0x13d701['name'];if(_0x340314===0x191){_0x340314=0x190;}_0x4afc42['status'](_0x340314)[_0x3bc5('0x30')](_0x1bbaca[_0x3bc5('0x37')][_0x3bc5('0x7a')]?{'message':_0x3bc5('0x7d'),'statusCode':_0x13d701[_0x3bc5('0x7e')]}:_0x13d701);});}else{var _0x40b3c3=0x1f4;_0x4afc42[_0x3bc5('0x20')](_0x40b3c3)[_0x3bc5('0x30')]({'message':_0x3bc5('0x7d'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x1edd=['error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','VIRTUAL','filter','includeAll','include','findAll','rows','show','options','create','body','catch','find','getConfigurations','findOne','params','SugarcrmConfiguration','pick','merge','addConfiguration','Subjects','getSubjects','Descriptions','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_id','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','format','%s%s','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','POST','get_module_fields','Calls','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy'];(function(_0x119d2b,_0xc3190f){var _0x3c8728=function(_0x24f9e2){while(--_0x24f9e2){_0x119d2b['push'](_0x119d2b['shift']());}};_0x3c8728(++_0xc3190f);}(_0x1edd,0xcd));var _0xd1ed=function(_0x43f489,_0x2b4fea){_0x43f489=_0x43f489-0x0;var _0x4134b4=_0x1edd[_0x43f489];return _0x4134b4;};'use strict';var emlformat=require(_0xd1ed('0x0'));var rimraf=require(_0xd1ed('0x1'));var zipdir=require(_0xd1ed('0x2'));var jsonpatch=require(_0xd1ed('0x3'));var rp=require(_0xd1ed('0x4'));var moment=require(_0xd1ed('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd1ed('0x6'));var util=require(_0xd1ed('0x7'));var path=require('path');var sox=require(_0xd1ed('0x8'));var csv=require(_0xd1ed('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd1ed('0xa'));var squel=require(_0xd1ed('0xb'));var crypto=require(_0xd1ed('0xc'));var jsforce=require(_0xd1ed('0xd'));var deskjs=require(_0xd1ed('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd1ed('0xf'));var Papa=require(_0xd1ed('0x10'));var Redis=require(_0xd1ed('0x11'));var authService=require(_0xd1ed('0x12'));var qs=require(_0xd1ed('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd1ed('0x14'))('api');var utils=require(_0xd1ed('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd1ed('0x16'));var db=require(_0xd1ed('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x830708,_0x1fcb38){_0x1fcb38=_0x1fcb38||0xcc;return function(_0x4bac1e){if(_0x4bac1e){return _0x830708[_0xd1ed('0x18')](_0x1fcb38);}return _0x830708[_0xd1ed('0x19')](_0x1fcb38)[_0xd1ed('0x1a')]();};}function respondWithResult(_0x58101c,_0x3303c7){_0x3303c7=_0x3303c7||0xc8;return function(_0x4e01c9){if(_0x4e01c9){return _0x58101c[_0xd1ed('0x19')](_0x3303c7)[_0xd1ed('0x1b')](_0x4e01c9);}};}function respondWithFilteredResult(_0x474ba4,_0x58f0b1){return function(_0x2464f5){if(_0x2464f5){var _0x229bd2=typeof _0x58f0b1['offset']===_0xd1ed('0x1c')&&typeof _0x58f0b1[_0xd1ed('0x1d')]==='undefined';var _0x552bd2=_0x2464f5[_0xd1ed('0x1e')];var _0x3bbd71=_0x229bd2?0x0:_0x58f0b1[_0xd1ed('0x1f')];var _0x358fa8=_0x229bd2?_0x2464f5['count']:_0x58f0b1[_0xd1ed('0x1f')]+_0x58f0b1[_0xd1ed('0x1d')];var _0x43254a;if(_0x358fa8>=_0x552bd2){_0x358fa8=_0x552bd2;_0x43254a=0xc8;}else{_0x43254a=0xce;}_0x474ba4[_0xd1ed('0x19')](_0x43254a);return _0x474ba4[_0xd1ed('0x20')]('Content-Range',_0x3bbd71+'-'+_0x358fa8+'/'+_0x552bd2)['json'](_0x2464f5);}return null;};}function patchUpdates(_0x643fed){return function(_0x3c7087){try{jsonpatch[_0xd1ed('0x21')](_0x3c7087,_0x643fed,!![]);}catch(_0x4bc212){return BPromise[_0xd1ed('0x22')](_0x4bc212);}return _0x3c7087[_0xd1ed('0x23')]();};}function saveUpdates(_0x12e3ea,_0x27161e){return function(_0x5e664f){if(_0x5e664f){return _0x5e664f[_0xd1ed('0x24')](_0x12e3ea)[_0xd1ed('0x25')](function(_0x8981d2){return _0x8981d2;});}return null;};}function removeEntity(_0x5d2f3e,_0xc246d4){return function(_0xaeb3c7){if(_0xaeb3c7){return _0xaeb3c7[_0xd1ed('0x26')]()[_0xd1ed('0x25')](function(){_0x5d2f3e[_0xd1ed('0x19')](0xcc)[_0xd1ed('0x1a')]();});}};}function handleEntityNotFound(_0x249d34,_0x1472a8){return function(_0x5ae661){if(!_0x5ae661){_0x249d34[_0xd1ed('0x18')](0x194);}return _0x5ae661;};}function handleError(_0x3b9c18,_0x4797cc){_0x4797cc=_0x4797cc||0x1f4;return function(_0xc51b97){logger[_0xd1ed('0x27')](_0xc51b97[_0xd1ed('0x28')]);if(_0xc51b97[_0xd1ed('0x29')]){delete _0xc51b97[_0xd1ed('0x29')];}_0x3b9c18['status'](_0x4797cc)[_0xd1ed('0x2a')](_0xc51b97);};}exports[_0xd1ed('0x2b')]=function(_0x5d7574,_0x4e0df4){var _0x2d701f={},_0x2f6dc1={},_0x4e7b75={'count':0x0,'rows':[]};var _0x429f8f=_[_0xd1ed('0x2c')](db[_0xd1ed('0x2d')][_0xd1ed('0x2e')],function(_0x34835f){return{'name':_0x34835f[_0xd1ed('0x2f')],'type':_0x34835f[_0xd1ed('0x30')][_0xd1ed('0x31')]};});_0x2f6dc1[_0xd1ed('0x32')]=_['map'](_0x429f8f,_0xd1ed('0x29'));_0x2f6dc1[_0xd1ed('0x33')]=_[_0xd1ed('0x34')](_0x5d7574[_0xd1ed('0x33')]);_0x2f6dc1['filters']=_[_0xd1ed('0x35')](_0x2f6dc1['model'],_0x2f6dc1[_0xd1ed('0x33')]);_0x2d701f[_0xd1ed('0x36')]=_['intersection'](_0x2f6dc1[_0xd1ed('0x32')],qs['fields'](_0x5d7574[_0xd1ed('0x33')][_0xd1ed('0x37')]));_0x2d701f['attributes']=_0x2d701f[_0xd1ed('0x36')][_0xd1ed('0x38')]?_0x2d701f[_0xd1ed('0x36')]:_0x2f6dc1[_0xd1ed('0x32')];if(!_0x5d7574['query'][_0xd1ed('0x39')](_0xd1ed('0x3a'))){_0x2d701f[_0xd1ed('0x1d')]=qs[_0xd1ed('0x1d')](_0x5d7574['query'][_0xd1ed('0x1d')]);_0x2d701f['offset']=qs['offset'](_0x5d7574[_0xd1ed('0x33')][_0xd1ed('0x1f')]);}_0x2d701f[_0xd1ed('0x3b')]=qs[_0xd1ed('0x3c')](_0x5d7574[_0xd1ed('0x33')][_0xd1ed('0x3c')]);_0x2d701f['where']=qs['filters'](_['pick'](_0x5d7574['query'],_0x2f6dc1[_0xd1ed('0x3d')]),_0x429f8f);if(_0x5d7574[_0xd1ed('0x33')]['filter']){_0x2d701f[_0xd1ed('0x3e')]=_['merge'](_0x2d701f[_0xd1ed('0x3e')],{'$or':_[_0xd1ed('0x2c')](_0x429f8f,function(_0x3aec31){if(_0x3aec31[_0xd1ed('0x30')]!==_0xd1ed('0x3f')){var _0x18fe95={};_0x18fe95[_0x3aec31['name']]={'$like':'%'+_0x5d7574[_0xd1ed('0x33')][_0xd1ed('0x40')]+'%'};return _0x18fe95;}})});}_0x2d701f=_['merge']({},_0x2d701f,_0x5d7574['options']);var _0x54c9bb={'where':_0x2d701f[_0xd1ed('0x3e')]};return db[_0xd1ed('0x2d')]['count'](_0x54c9bb)['then'](function(_0x7b92af){_0x4e7b75['count']=_0x7b92af;if(_0x5d7574[_0xd1ed('0x33')][_0xd1ed('0x41')]){_0x2d701f[_0xd1ed('0x42')]=[{'all':!![]}];}return db[_0xd1ed('0x2d')][_0xd1ed('0x43')](_0x2d701f);})[_0xd1ed('0x25')](function(_0x5d2cd1){_0x4e7b75[_0xd1ed('0x44')]=_0x5d2cd1;return _0x4e7b75;})['then'](respondWithFilteredResult(_0x4e0df4,_0x2d701f))['catch'](handleError(_0x4e0df4,null));};exports[_0xd1ed('0x45')]=function(_0x7c959d,_0x3c4cf2){var _0xb3e263={'raw':![],'where':{'id':_0x7c959d['params']['id']}},_0x1aeabd={};_0x1aeabd[_0xd1ed('0x32')]=_['keys'](db[_0xd1ed('0x2d')][_0xd1ed('0x2e')]);_0x1aeabd[_0xd1ed('0x33')]=_[_0xd1ed('0x34')](_0x7c959d[_0xd1ed('0x33')]);_0x1aeabd[_0xd1ed('0x3d')]=_[_0xd1ed('0x35')](_0x1aeabd[_0xd1ed('0x32')],_0x1aeabd[_0xd1ed('0x33')]);_0xb3e263['attributes']=_[_0xd1ed('0x35')](_0x1aeabd[_0xd1ed('0x32')],qs[_0xd1ed('0x37')](_0x7c959d[_0xd1ed('0x33')][_0xd1ed('0x37')]));_0xb3e263[_0xd1ed('0x36')]=_0xb3e263[_0xd1ed('0x36')][_0xd1ed('0x38')]?_0xb3e263[_0xd1ed('0x36')]:_0x1aeabd['model'];if(_0x7c959d[_0xd1ed('0x33')][_0xd1ed('0x41')]){_0xb3e263[_0xd1ed('0x42')]=[{'all':!![]}];}_0xb3e263=_['merge']({},_0xb3e263,_0x7c959d[_0xd1ed('0x46')]);return db['SugarcrmAccount']['find'](_0xb3e263)[_0xd1ed('0x25')](handleEntityNotFound(_0x3c4cf2,null))[_0xd1ed('0x25')](respondWithResult(_0x3c4cf2,null))['catch'](handleError(_0x3c4cf2,null));};exports[_0xd1ed('0x47')]=function(_0x479076,_0x1ff97d){return db['SugarcrmAccount']['create'](_0x479076[_0xd1ed('0x48')],{})[_0xd1ed('0x25')](respondWithResult(_0x1ff97d,0xc9))[_0xd1ed('0x49')](handleError(_0x1ff97d,null));};exports[_0xd1ed('0x24')]=function(_0xfdbc58,_0x53727a){if(_0xfdbc58[_0xd1ed('0x48')]['id']){delete _0xfdbc58[_0xd1ed('0x48')]['id'];}return db[_0xd1ed('0x2d')][_0xd1ed('0x4a')]({'where':{'id':_0xfdbc58['params']['id']}})['then'](handleEntityNotFound(_0x53727a,null))['then'](saveUpdates(_0xfdbc58[_0xd1ed('0x48')],null))[_0xd1ed('0x25')](respondWithResult(_0x53727a,null))[_0xd1ed('0x49')](handleError(_0x53727a,null));};exports[_0xd1ed('0x26')]=function(_0x4378b8,_0x279145){return db[_0xd1ed('0x2d')][_0xd1ed('0x4a')]({'where':{'id':_0x4378b8['params']['id']}})[_0xd1ed('0x25')](handleEntityNotFound(_0x279145,null))[_0xd1ed('0x25')](removeEntity(_0x279145,null))[_0xd1ed('0x49')](handleError(_0x279145,null));};exports[_0xd1ed('0x4b')]=function(_0x4579be,_0x4be686,_0x357b24){var _0x2e4e31={};var _0x30b984={};var _0xf8691a;var _0x4bacca;return db[_0xd1ed('0x2d')][_0xd1ed('0x4c')]({'where':{'id':_0x4579be[_0xd1ed('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4be686,null))[_0xd1ed('0x25')](function(_0x292ea3){if(_0x292ea3){_0xf8691a=_0x292ea3;_0x30b984[_0xd1ed('0x32')]=_[_0xd1ed('0x34')](db[_0xd1ed('0x4e')]['rawAttributes']);_0x30b984[_0xd1ed('0x33')]=_[_0xd1ed('0x34')](_0x4579be[_0xd1ed('0x33')]);_0x30b984[_0xd1ed('0x3d')]=_[_0xd1ed('0x35')](_0x30b984[_0xd1ed('0x32')],_0x30b984[_0xd1ed('0x33')]);_0x2e4e31['attributes']=_['intersection'](_0x30b984['model'],qs[_0xd1ed('0x37')](_0x4579be[_0xd1ed('0x33')][_0xd1ed('0x37')]));_0x2e4e31[_0xd1ed('0x36')]=_0x2e4e31['attributes'][_0xd1ed('0x38')]?_0x2e4e31[_0xd1ed('0x36')]:_0x30b984[_0xd1ed('0x32')];_0x2e4e31[_0xd1ed('0x3b')]=qs['sort'](_0x4579be[_0xd1ed('0x33')][_0xd1ed('0x3c')]);_0x2e4e31[_0xd1ed('0x3e')]=qs[_0xd1ed('0x3d')](_[_0xd1ed('0x4f')](_0x4579be['query'],_0x30b984['filters']));if(_0x4579be[_0xd1ed('0x33')]['filter']){_0x2e4e31[_0xd1ed('0x3e')]=_[_0xd1ed('0x50')](_0x2e4e31['where'],{'$or':_[_0xd1ed('0x2c')](_0x2e4e31[_0xd1ed('0x36')],function(_0x10500b){var _0x33b209={};_0x33b209[_0x10500b]={'$like':'%'+_0x4579be[_0xd1ed('0x33')]['filter']+'%'};return _0x33b209;})});}_0x2e4e31=_[_0xd1ed('0x50')]({},_0x2e4e31,_0x4579be[_0xd1ed('0x46')]);return _0xf8691a[_0xd1ed('0x4b')](_0x2e4e31);}})[_0xd1ed('0x25')](function(_0x3ee942){if(_0x3ee942){_0x4bacca=_0x3ee942[_0xd1ed('0x38')];if(!_0x4579be[_0xd1ed('0x33')][_0xd1ed('0x39')]('nolimit')){_0x2e4e31[_0xd1ed('0x1d')]=qs['limit'](_0x4579be[_0xd1ed('0x33')][_0xd1ed('0x1d')]);_0x2e4e31[_0xd1ed('0x1f')]=qs['offset'](_0x4579be[_0xd1ed('0x33')][_0xd1ed('0x1f')]);}return _0xf8691a['getConfigurations'](_0x2e4e31);}})[_0xd1ed('0x25')](function(_0xacbd7e){if(_0xacbd7e){return _0xacbd7e?{'count':_0x4bacca,'rows':_0xacbd7e}:null;}})['then'](respondWithResult(_0x4be686,null))['catch'](handleError(_0x4be686,null));};exports[_0xd1ed('0x51')]=function(_0x4687d9,_0x3a4e5,_0x455e64){if(_0x4687d9[_0xd1ed('0x48')]['id']){delete _0x4687d9[_0xd1ed('0x48')]['id'];}return db['SugarcrmAccount'][_0xd1ed('0x4c')]({'where':{'id':_0x4687d9[_0xd1ed('0x4d')]['id']}})[_0xd1ed('0x25')](handleEntityNotFound(_0x3a4e5,null))['then'](function(_0xcf486c){if(_0xcf486c){_0x4687d9['body']['AccountId']=_0xcf486c['id'];_0x4687d9[_0xd1ed('0x48')][_0xd1ed('0x52')]=integrations[_0xd1ed('0x53')](_0x4687d9[_0xd1ed('0x48')]['channel'],_0x4687d9[_0xd1ed('0x48')][_0xd1ed('0x30')]);_0x4687d9[_0xd1ed('0x48')][_0xd1ed('0x54')]=integrations['getDescriptions'](_0x4687d9[_0xd1ed('0x48')]['channel'],_0x4687d9[_0xd1ed('0x48')][_0xd1ed('0x30')]);return db[_0xd1ed('0x4e')][_0xd1ed('0x47')](_0x4687d9[_0xd1ed('0x48')],{'include':[{'model':db['SugarcrmField'],'as':_0xd1ed('0x52')},{'model':db[_0xd1ed('0x55')],'as':_0xd1ed('0x54')}]});}return null;})['then'](respondWithResult(_0x3a4e5,null))['catch'](handleError(_0x3a4e5,null));};exports[_0xd1ed('0x56')]=function(_0x32a24a,_0x54eaaf,_0x2ec1f8){var _0x7ce5e7='';var _0x5e72c4=['id','name',_0xd1ed('0x57'),'created_by',_0xd1ed('0x58'),_0xd1ed('0x59'),_0xd1ed('0x5a'),_0xd1ed('0x5b'),_0xd1ed('0x5c'),'parent_type',_0xd1ed('0x5d'),_0xd1ed('0x5e')];return db[_0xd1ed('0x2d')][_0xd1ed('0x4c')]({'where':{'id':_0x32a24a[_0xd1ed('0x4d')]['id']},'attributes':['id',_0xd1ed('0x5f'),_0xd1ed('0x60'),_0xd1ed('0x61')]})['then'](handleEntityNotFound(_0x54eaaf,null))[_0xd1ed('0x25')](function(_0x56577c){if(_0x56577c){_0x7ce5e7=_0x56577c[_0xd1ed('0x61')];var _0x278528=_0x7ce5e7[_0xd1ed('0x62')](-0x1);if(_0x278528==='/'){_0x7ce5e7=_0x7ce5e7[_0xd1ed('0x63')](0x0,_0x7ce5e7[_0xd1ed('0x64')](_0x278528));}return rp({'method':'POST','uri':util[_0xd1ed('0x65')](_0xd1ed('0x66'),_0x7ce5e7,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xd1ed('0x67'),'input_type':'JSON','response_type':_0xd1ed('0x68'),'rest_data':JSON[_0xd1ed('0x69')]({'user_auth':{'user_name':_0x56577c['username'],'password':_0x56577c[_0xd1ed('0x60')],'encryption':_0xd1ed('0x6a')},'application':_0xd1ed('0x6b')})}});}})['then'](function(_0x25dc87){if(_0x25dc87&&_0x25dc87['name']!=='Invalid\x20Login'&&_0x25dc87[_0xd1ed('0x29')]!=='Password\x20Expired'){return rp({'method':_0xd1ed('0x6c'),'uri':util[_0xd1ed('0x65')](_0xd1ed('0x66'),_0x7ce5e7,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xd1ed('0x6d'),'input_type':_0xd1ed('0x68'),'response_type':_0xd1ed('0x68'),'rest_data':JSON[_0xd1ed('0x69')]({'session':_0x25dc87['id'],'module_name':_0xd1ed('0x6e')})}})[_0xd1ed('0x25')](function(_0x241a2d){if(_0x241a2d){var _0x1e01e6=_[_0xd1ed('0x6f')](_0x241a2d[_0xd1ed('0x70')]);_[_0xd1ed('0x71')](_0x1e01e6,function(_0x3a100d){return _0x5e72c4[_0xd1ed('0x72')](_0x3a100d[_0xd1ed('0x29')]);});return{'count':_0x1e01e6[_0xd1ed('0x38')],'rows':_[_0xd1ed('0x2c')](_0x1e01e6,function(_0x180d31){return{'id':_0x180d31['name'],'name':_0x180d31[_0xd1ed('0x73')],'custom':_[_0xd1ed('0x74')](_0x180d31[_0xd1ed('0x29')],'_c')?!![]:![],'options':_0x180d31[_0xd1ed('0x46')]?_[_0xd1ed('0x2c')](_['values'](_0x180d31[_0xd1ed('0x46')]),function(_0x2ba7f5){return{'name':_0x2ba7f5[_0xd1ed('0x75')],'value':_0x2ba7f5[_0xd1ed('0x29')]};}):[]};})};}})[_0xd1ed('0x25')](respondWithResult(_0x54eaaf,null))[_0xd1ed('0x49')](function(_0x122eaf){var _0x325232=_0x32a24a[_0xd1ed('0x33')][_0xd1ed('0x76')]?0x1f4:_0x122eaf[_0xd1ed('0x77')]||0x1f4;logger[_0xd1ed('0x27')](_0xd1ed('0x78'),_0xd1ed('0x56'),_0x325232,JSON[_0xd1ed('0x69')](_0x122eaf));delete _0x122eaf[_0xd1ed('0x29')];if(_0x325232===0x191){_0x325232=0x190;}_0x54eaaf['status'](_0x325232)[_0xd1ed('0x2a')](_0x32a24a[_0xd1ed('0x33')][_0xd1ed('0x76')]?{'message':_0xd1ed('0x79'),'statusCode':_0x122eaf[_0xd1ed('0x77')]}:_0x122eaf);});}else{var _0x2bedd1=0x1f4;_0x54eaaf[_0xd1ed('0x19')](_0x2bedd1)[_0xd1ed('0x2a')]({'message':_0xd1ed('0x79'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index fee4889..a2a2f37 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 _0x9bc8=['api','moment','bluebird','request-promise','path','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9bc8,0xa6));var _0x89bc=function(_0x155fea,_0x1afd1e){_0x155fea=_0x155fea-0x0;var _0x4394bb=_0x9bc8[_0x155fea];return _0x4394bb;};'use strict';var _=require(_0x89bc('0x0'));var util=require(_0x89bc('0x1'));var logger=require(_0x89bc('0x2'))(_0x89bc('0x3'));var moment=require(_0x89bc('0x4'));var BPromise=require(_0x89bc('0x5'));var rp=require(_0x89bc('0x6'));var fs=require('fs');var path=require(_0x89bc('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x89bc('0x8'));module[_0x89bc('0x9')]=function(_0x49c366,_0x24ab05){return _0x49c366[_0x89bc('0xa')](_0x89bc('0xb'),attributes,{'tableName':_0x89bc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9fda=['request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','api','moment','bluebird'];(function(_0x110ce3,_0xd22d55){var _0x17e26e=function(_0x3dda46){while(--_0x3dda46){_0x110ce3['push'](_0x110ce3['shift']());}};_0x17e26e(++_0xd22d55);}(_0x9fda,0x8c));var _0xa9fd=function(_0x6224bc,_0x38960d){_0x6224bc=_0x6224bc-0x0;var _0x5cf36b=_0x9fda[_0x6224bc];return _0x5cf36b;};'use strict';var _=require(_0xa9fd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa9fd('0x1'));var moment=require(_0xa9fd('0x2'));var BPromise=require(_0xa9fd('0x3'));var rp=require(_0xa9fd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9fd('0x5'));var config=require(_0xa9fd('0x6'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xa9fd('0x7'));module[_0xa9fd('0x8')]=function(_0x4eb431,_0x5f2d27){return _0x4eb431[_0xa9fd('0x9')](_0xa9fd('0xa'),attributes,{'tableName':_0xa9fd('0xb'),'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 6920532..f075f27 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 _0x59c4=['stringify','code','error','message','result','catch','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetSugarcrmAccount','find','ShowSugarcrmAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s'];(function(_0x387f41,_0x3781fd){var _0x394b65=function(_0x3b1010){while(--_0x3b1010){_0x387f41['push'](_0x387f41['shift']());}};_0x394b65(++_0x3781fd);}(_0x59c4,0x1b7));var _0x459c=function(_0x2c6c75,_0x42382a){_0x2c6c75=_0x2c6c75-0x0;var _0x29b79c=_0x59c4[_0x2c6c75];return _0x29b79c;};'use strict';var _=require(_0x459c('0x0'));var util=require(_0x459c('0x1'));var moment=require(_0x459c('0x2'));var BPromise=require(_0x459c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x459c('0x4'));var db=require(_0x459c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x459c('0x6'));var config=require(_0x459c('0x7'));var jayson=require(_0x459c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2fba58,_0x28c424,_0x418ad9){return new BPromise(function(_0x1c9dee,_0x4e62ce){return client[_0x459c('0x9')](_0x2fba58,_0x418ad9)[_0x459c('0xa')](function(_0x4b849e){logger[_0x459c('0xb')](_0x459c('0xc'),_0x28c424,_0x459c('0xd'));logger[_0x459c('0xe')](_0x459c('0xf'),_0x28c424,_0x459c('0xd'),JSON[_0x459c('0x10')](_0x4b849e));if(_0x4b849e['error']){if(_0x4b849e['error'][_0x459c('0x11')]===0x1f4){logger[_0x459c('0x12')](_0x459c('0xc'),_0x28c424,_0x4b849e[_0x459c('0x12')][_0x459c('0x13')]);return _0x4e62ce(_0x4b849e[_0x459c('0x12')][_0x459c('0x13')]);}logger[_0x459c('0x12')](_0x459c('0xc'),_0x28c424,_0x4b849e[_0x459c('0x12')][_0x459c('0x13')]);return _0x1c9dee(_0x4b849e['error']['message']);}else{logger[_0x459c('0xb')](_0x459c('0xc'),_0x28c424,_0x459c('0xd'));_0x1c9dee(_0x4b849e[_0x459c('0x14')][_0x459c('0x13')]);}})[_0x459c('0x15')](function(_0x3c3ab4){logger[_0x459c('0x12')](_0x459c('0xc'),_0x28c424,_0x3c3ab4);_0x4e62ce(_0x3c3ab4);});});}exports['GetSugarcrmAccount']=function(_0xa069cf){var _0x85025d=this;return new Promise(function(_0x2df372,_0x2f3663){return db[_0x459c('0x16')][_0x459c('0x17')]({'raw':_0xa069cf[_0x459c('0x18')]?_0xa069cf[_0x459c('0x18')][_0x459c('0x19')]===undefined?!![]:![]:!![],'where':_0xa069cf[_0x459c('0x18')]?_0xa069cf[_0x459c('0x18')][_0x459c('0x1a')]||null:null,'attributes':_0xa069cf[_0x459c('0x18')]?_0xa069cf[_0x459c('0x18')][_0x459c('0x1b')]||null:null,'limit':_0xa069cf[_0x459c('0x18')]?_0xa069cf[_0x459c('0x18')][_0x459c('0x1c')]||null:null,'include':_0xa069cf['options']?_0xa069cf[_0x459c('0x18')][_0x459c('0x1d')]?_[_0x459c('0x1e')](_0xa069cf[_0x459c('0x18')][_0x459c('0x1d')],function(_0x569139){return{'model':db[_0x569139[_0x459c('0x1f')]],'as':_0x569139['as'],'attributes':_0x569139[_0x459c('0x1b')],'include':_0x569139['include']?_[_0x459c('0x1e')](_0x569139[_0x459c('0x1d')],function(_0x5bf54c){return{'model':db[_0x5bf54c[_0x459c('0x1f')]],'as':_0x5bf54c['as'],'attributes':_0x5bf54c[_0x459c('0x1b')],'include':_0x5bf54c[_0x459c('0x1d')]?_[_0x459c('0x1e')](_0x5bf54c[_0x459c('0x1d')],function(_0x467e4f){return{'model':db[_0x467e4f['model']],'as':_0x467e4f['as'],'attributes':_0x467e4f[_0x459c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x459c('0xa')](function(_0x4e17a4){logger[_0x459c('0xb')]('GetSugarcrmAccount',_0xa069cf);logger[_0x459c('0xe')](_0x459c('0x20'),_0xa069cf,JSON[_0x459c('0x10')](_0x4e17a4));_0x2df372(_0x4e17a4);})[_0x459c('0x15')](function(_0x503499){logger[_0x459c('0x12')](_0x459c('0x20'),_0x503499[_0x459c('0x13')],_0xa069cf);_0x2f3663(_0x85025d['error'](0x1f4,_0x503499['message']));});});};exports['ShowSugarcrmAccount']=function(_0x2e37a0){var _0x22da00=this;return new Promise(function(_0x5393e2,_0x34e8b3){return db[_0x459c('0x16')][_0x459c('0x21')]({'raw':_0x2e37a0['options']?_0x2e37a0[_0x459c('0x18')][_0x459c('0x19')]===undefined?!![]:![]:!![],'where':_0x2e37a0[_0x459c('0x18')]?_0x2e37a0[_0x459c('0x18')][_0x459c('0x1a')]||null:null,'attributes':_0x2e37a0[_0x459c('0x18')]?_0x2e37a0['options'][_0x459c('0x1b')]||null:null,'include':_0x2e37a0[_0x459c('0x18')]?_0x2e37a0['options']['include']?_[_0x459c('0x1e')](_0x2e37a0[_0x459c('0x18')][_0x459c('0x1d')],function(_0xa605ba){return{'model':db[_0xa605ba[_0x459c('0x1f')]],'as':_0xa605ba['as'],'attributes':_0xa605ba[_0x459c('0x1b')],'include':_0xa605ba[_0x459c('0x1d')]?_['map'](_0xa605ba[_0x459c('0x1d')],function(_0x2ee9c5){return{'model':db[_0x2ee9c5['model']],'as':_0x2ee9c5['as'],'attributes':_0x2ee9c5['attributes'],'include':_0x2ee9c5[_0x459c('0x1d')]?_[_0x459c('0x1e')](_0x2ee9c5['include'],function(_0x469a93){return{'model':db[_0x469a93[_0x459c('0x1f')]],'as':_0x469a93['as'],'attributes':_0x469a93[_0x459c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x459c('0xa')](function(_0x3ce02b){logger[_0x459c('0xb')](_0x459c('0x22'),_0x2e37a0);logger[_0x459c('0xe')]('ShowSugarcrmAccount',_0x2e37a0,JSON[_0x459c('0x10')](_0x3ce02b));_0x5393e2(_0x3ce02b);})[_0x459c('0x15')](function(_0x424e34){logger[_0x459c('0x12')](_0x459c('0x22'),_0x424e34[_0x459c('0x13')],_0x2e37a0);_0x34e8b3(_0x22da00['error'](0x1f4,_0x424e34['message']));});});}; \ No newline at end of file +var _0xdf4d=['find','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmAccount,\x20%s,\x20%s','message','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowSugarcrmAccount'];(function(_0x6c0123,_0x4c8d3b){var _0x5a87d2=function(_0x1ff614){while(--_0x1ff614){_0x6c0123['push'](_0x6c0123['shift']());}};_0x5a87d2(++_0x4c8d3b);}(_0xdf4d,0xce));var _0xddf4=function(_0x315b62,_0x58e83b){_0x315b62=_0x315b62-0x0;var _0x33e3a9=_0xdf4d[_0x315b62];return _0x33e3a9;};'use strict';var _=require(_0xddf4('0x0'));var util=require(_0xddf4('0x1'));var moment=require('moment');var BPromise=require(_0xddf4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xddf4('0x3'));var db=require(_0xddf4('0x4'))['db'];var utils=require(_0xddf4('0x5'));var logger=require(_0xddf4('0x6'))('rpc');var config=require(_0xddf4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xddf4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x175ca1,_0x264a89,_0x348eaa){return new BPromise(function(_0x4e36e0,_0x33b378){return client[_0xddf4('0x9')](_0x175ca1,_0x348eaa)[_0xddf4('0xa')](function(_0x45d2e5){logger[_0xddf4('0xb')]('SugarcrmAccount,\x20%s,\x20%s',_0x264a89,_0xddf4('0xc'));logger['debug'](_0xddf4('0xd'),_0x264a89,_0xddf4('0xc'),JSON[_0xddf4('0xe')](_0x45d2e5));if(_0x45d2e5['error']){if(_0x45d2e5[_0xddf4('0xf')]['code']===0x1f4){logger[_0xddf4('0xf')](_0xddf4('0x10'),_0x264a89,_0x45d2e5[_0xddf4('0xf')][_0xddf4('0x11')]);return _0x33b378(_0x45d2e5[_0xddf4('0xf')][_0xddf4('0x11')]);}logger[_0xddf4('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x264a89,_0x45d2e5[_0xddf4('0xf')]['message']);return _0x4e36e0(_0x45d2e5[_0xddf4('0xf')]['message']);}else{logger[_0xddf4('0xb')](_0xddf4('0x10'),_0x264a89,'request\x20sent');_0x4e36e0(_0x45d2e5[_0xddf4('0x12')][_0xddf4('0x11')]);}})['catch'](function(_0x1240a1){logger[_0xddf4('0xf')](_0xddf4('0x10'),_0x264a89,_0x1240a1);_0x33b378(_0x1240a1);});});}exports[_0xddf4('0x13')]=function(_0x3617c4){var _0x171a51=this;return new Promise(function(_0x9b58b,_0x53ef5f){return db[_0xddf4('0x14')][_0xddf4('0x15')]({'raw':_0x3617c4[_0xddf4('0x16')]?_0x3617c4['options'][_0xddf4('0x17')]===undefined?!![]:![]:!![],'where':_0x3617c4['options']?_0x3617c4[_0xddf4('0x16')][_0xddf4('0x18')]||null:null,'attributes':_0x3617c4[_0xddf4('0x16')]?_0x3617c4['options'][_0xddf4('0x19')]||null:null,'limit':_0x3617c4[_0xddf4('0x16')]?_0x3617c4[_0xddf4('0x16')][_0xddf4('0x1a')]||null:null,'include':_0x3617c4[_0xddf4('0x16')]?_0x3617c4[_0xddf4('0x16')][_0xddf4('0x1b')]?_[_0xddf4('0x1c')](_0x3617c4[_0xddf4('0x16')][_0xddf4('0x1b')],function(_0x39891e){return{'model':db[_0x39891e[_0xddf4('0x1d')]],'as':_0x39891e['as'],'attributes':_0x39891e[_0xddf4('0x19')],'include':_0x39891e[_0xddf4('0x1b')]?_[_0xddf4('0x1c')](_0x39891e[_0xddf4('0x1b')],function(_0x45efee){return{'model':db[_0x45efee['model']],'as':_0x45efee['as'],'attributes':_0x45efee[_0xddf4('0x19')],'include':_0x45efee[_0xddf4('0x1b')]?_['map'](_0x45efee['include'],function(_0x52bd25){return{'model':db[_0x52bd25[_0xddf4('0x1d')]],'as':_0x52bd25['as'],'attributes':_0x52bd25['attributes']};}):[]};}):[]};}):[]:[]})[_0xddf4('0xa')](function(_0x4e55b9){logger[_0xddf4('0xb')](_0xddf4('0x13'),_0x3617c4);logger[_0xddf4('0x1e')](_0xddf4('0x13'),_0x3617c4,JSON['stringify'](_0x4e55b9));_0x9b58b(_0x4e55b9);})['catch'](function(_0x24507c){logger['error'](_0xddf4('0x13'),_0x24507c[_0xddf4('0x11')],_0x3617c4);_0x53ef5f(_0x171a51[_0xddf4('0xf')](0x1f4,_0x24507c[_0xddf4('0x11')]));});});};exports[_0xddf4('0x1f')]=function(_0x41fc5e){var _0x346417=this;return new Promise(function(_0x14d719,_0x5b4914){return db[_0xddf4('0x14')][_0xddf4('0x20')]({'raw':_0x41fc5e[_0xddf4('0x16')]?_0x41fc5e['options']['raw']===undefined?!![]:![]:!![],'where':_0x41fc5e[_0xddf4('0x16')]?_0x41fc5e[_0xddf4('0x16')][_0xddf4('0x18')]||null:null,'attributes':_0x41fc5e[_0xddf4('0x16')]?_0x41fc5e[_0xddf4('0x16')][_0xddf4('0x19')]||null:null,'include':_0x41fc5e['options']?_0x41fc5e[_0xddf4('0x16')]['include']?_[_0xddf4('0x1c')](_0x41fc5e[_0xddf4('0x16')]['include'],function(_0x1ea007){return{'model':db[_0x1ea007[_0xddf4('0x1d')]],'as':_0x1ea007['as'],'attributes':_0x1ea007[_0xddf4('0x19')],'include':_0x1ea007[_0xddf4('0x1b')]?_['map'](_0x1ea007[_0xddf4('0x1b')],function(_0xf23ce6){return{'model':db[_0xf23ce6['model']],'as':_0xf23ce6['as'],'attributes':_0xf23ce6[_0xddf4('0x19')],'include':_0xf23ce6['include']?_[_0xddf4('0x1c')](_0xf23ce6[_0xddf4('0x1b')],function(_0x2c911a){return{'model':db[_0x2c911a[_0xddf4('0x1d')]],'as':_0x2c911a['as'],'attributes':_0x2c911a[_0xddf4('0x19')]};}):[]};}):[]};}):[]:[]})[_0xddf4('0xa')](function(_0x20343a){logger[_0xddf4('0xb')]('ShowSugarcrmAccount',_0x41fc5e);logger['debug'](_0xddf4('0x1f'),_0x41fc5e,JSON[_0xddf4('0xe')](_0x20343a));_0x14d719(_0x20343a);})[_0xddf4('0x21')](function(_0x1726d2){logger[_0xddf4('0xf')](_0xddf4('0x1f'),_0x1726d2[_0xddf4('0x11')],_0x41fc5e);_0x5b4914(_0x346417[_0xddf4('0xf')](0x1f4,_0x1726d2[_0xddf4('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index b361d84..82bc02e 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 _0x4af1=['post','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4af1,0xc1));var _0x14af=function(_0x403e70,_0x4b4905){_0x403e70=_0x403e70-0x0;var _0x404baa=_0x4af1[_0x403e70];return _0x404baa;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x14af('0x0'));var timeout=require(_0x14af('0x1'));var express=require(_0x14af('0x2'));var router=express[_0x14af('0x3')]();var fs_extra=require(_0x14af('0x4'));var auth=require(_0x14af('0x5'));var interaction=require(_0x14af('0x6'));var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router[_0x14af('0x7')]('/',auth['isAuthenticated'](),controller[_0x14af('0x8')]);router[_0x14af('0x7')](_0x14af('0x9'),auth[_0x14af('0xa')](),controller[_0x14af('0xb')]);router[_0x14af('0x7')]('/:id/fields',auth[_0x14af('0xa')](),controller[_0x14af('0xc')]);router[_0x14af('0x7')](_0x14af('0xd'),auth['isAuthenticated'](),controller[_0x14af('0xe')]);router['get'](_0x14af('0xf'),auth[_0x14af('0xa')](),controller[_0x14af('0x10')]);router[_0x14af('0x11')]('/',auth[_0x14af('0xa')](),controller['create']);router['put'](_0x14af('0x9'),auth[_0x14af('0xa')](),controller[_0x14af('0x12')]);router['delete']('/:id',auth[_0x14af('0xa')](),controller[_0x14af('0x13')]);module[_0x14af('0x14')]=router; \ No newline at end of file +var _0xdb0d=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','put','update','delete','destroy','exports','multer','util'];(function(_0x1def1b,_0x31f12e){var _0x1a294e=function(_0x356484){while(--_0x356484){_0x1def1b['push'](_0x1def1b['shift']());}};_0x1a294e(++_0x31f12e);}(_0xdb0d,0xee));var _0xddb0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdb0d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xddb0('0x0'));var util=require(_0xddb0('0x1'));var path=require(_0xddb0('0x2'));var timeout=require(_0xddb0('0x3'));var express=require(_0xddb0('0x4'));var router=express[_0xddb0('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xddb0('0x6'));var interaction=require(_0xddb0('0x7'));var config=require(_0xddb0('0x8'));var controller=require('./intSugarcrmConfiguration.controller');router[_0xddb0('0x9')]('/',auth['isAuthenticated'](),controller[_0xddb0('0xa')]);router['get'](_0xddb0('0xb'),auth[_0xddb0('0xc')](),controller[_0xddb0('0xd')]);router[_0xddb0('0x9')](_0xddb0('0xe'),auth[_0xddb0('0xc')](),controller[_0xddb0('0xf')]);router[_0xddb0('0x9')](_0xddb0('0x10'),auth[_0xddb0('0xc')](),controller[_0xddb0('0x11')]);router[_0xddb0('0x9')]('/:id/descriptions',auth[_0xddb0('0xc')](),controller[_0xddb0('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xddb0('0x13')](_0xddb0('0xb'),auth[_0xddb0('0xc')](),controller[_0xddb0('0x14')]);router[_0xddb0('0x15')](_0xddb0('0xb'),auth[_0xddb0('0xc')](),controller[_0xddb0('0x16')]);module[_0xddb0('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 d81dcce..eeebef2 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 _0xff4b=['sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff4b,0xe4));var _0xbff4=function(_0x2607f3,_0x3b951e){_0x2607f3=_0x2607f3-0x0;var _0x51a575=_0xff4b[_0x2607f3];return _0x51a575;};'use strict';var Sequelize=require(_0xbff4('0x0'));module[_0xbff4('0x1')]={'name':{'type':Sequelize[_0xbff4('0x2')]},'description':{'type':Sequelize[_0xbff4('0x2')]}}; \ No newline at end of file +var _0x582a=['exports','STRING','sequelize'];(function(_0x1317c6,_0x3941d1){var _0x2a83b7=function(_0x599bcb){while(--_0x599bcb){_0x1317c6['push'](_0x1317c6['shift']());}};_0x2a83b7(++_0x3941d1);}(_0x582a,0x1cd));var _0xa582=function(_0x5bd613,_0x151a02){_0x5bd613=_0x5bd613-0x0;var _0x62f674=_0x582a[_0x5bd613];return _0x62f674;};'use strict';var Sequelize=require(_0xa582('0x0'));module[_0xa582('0x1')]={'name':{'type':Sequelize[_0xa582('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 2221781..a16939c 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 _0x61e1=['includeAll','include','findAll','rows','show','params','keys','length','find','catch','body','getFields','SugarcrmField','pick','findOne','getSubjects','hasOwnProperty','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','Content-Range','update','then','destroy','error','stack','name','send','index','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','nolimit','order','sort','where','merge','filter','options'];(function(_0x248238,_0xe31996){var _0xb93bc4=function(_0xa7489e){while(--_0xa7489e){_0x248238['push'](_0x248238['shift']());}};_0xb93bc4(++_0xe31996);}(_0x61e1,0xae));var _0x161e=function(_0xc9b897,_0x5e2171){_0xc9b897=_0xc9b897-0x0;var _0x44643e=_0x61e1[_0xc9b897];return _0x44643e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x161e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x161e('0x1'));var rp=require(_0x161e('0x2'));var moment=require(_0x161e('0x3'));var BPromise=require(_0x161e('0x4'));var Mustache=require(_0x161e('0x5'));var util=require(_0x161e('0x6'));var path=require('path');var sox=require(_0x161e('0x7'));var csv=require(_0x161e('0x8'));var ejs=require(_0x161e('0x9'));var fs=require('fs');var fs_extra=require(_0x161e('0xa'));var _=require(_0x161e('0xb'));var squel=require('squel');var crypto=require(_0x161e('0xc'));var jsforce=require(_0x161e('0xd'));var deskjs=require(_0x161e('0xe'));var toCsv=require(_0x161e('0x8'));var querystring=require(_0x161e('0xf'));var Papa=require(_0x161e('0x10'));var Redis=require(_0x161e('0x11'));var authService=require(_0x161e('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x161e('0x13'));var logger=require(_0x161e('0x14'))(_0x161e('0x15'));var utils=require(_0x161e('0x16'));var config=require(_0x161e('0x17'));var licenseUtil=require(_0x161e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf284fd,_0x6bd534){_0x6bd534=_0x6bd534||0xcc;return function(_0x20f718){if(_0x20f718){return _0xf284fd[_0x161e('0x19')](_0x6bd534);}return _0xf284fd[_0x161e('0x1a')](_0x6bd534)[_0x161e('0x1b')]();};}function respondWithResult(_0x3071bf,_0x3039e2){_0x3039e2=_0x3039e2||0xc8;return function(_0x496fe7){if(_0x496fe7){return _0x3071bf[_0x161e('0x1a')](_0x3039e2)['json'](_0x496fe7);}};}function respondWithFilteredResult(_0x325d80,_0x133a60){return function(_0x116a6f){if(_0x116a6f){var _0x334344=typeof _0x133a60[_0x161e('0x1c')]===_0x161e('0x1d')&&typeof _0x133a60['limit']===_0x161e('0x1d');var _0x429594=_0x116a6f[_0x161e('0x1e')];var _0x1d5f31=_0x334344?0x0:_0x133a60[_0x161e('0x1c')];var _0xc55fd1=_0x334344?_0x116a6f[_0x161e('0x1e')]:_0x133a60[_0x161e('0x1c')]+_0x133a60[_0x161e('0x1f')];var _0x4bdb78;if(_0xc55fd1>=_0x429594){_0xc55fd1=_0x429594;_0x4bdb78=0xc8;}else{_0x4bdb78=0xce;}_0x325d80[_0x161e('0x1a')](_0x4bdb78);return _0x325d80['set'](_0x161e('0x20'),_0x1d5f31+'-'+_0xc55fd1+'/'+_0x429594)['json'](_0x116a6f);}return null;};}function patchUpdates(_0x57a29b){return function(_0x35072b){try{jsonpatch['apply'](_0x35072b,_0x57a29b,!![]);}catch(_0x5273f1){return BPromise['reject'](_0x5273f1);}return _0x35072b['save']();};}function saveUpdates(_0x51cca0,_0x33a4be){return function(_0x2a69c4){if(_0x2a69c4){return _0x2a69c4[_0x161e('0x21')](_0x51cca0)[_0x161e('0x22')](function(_0x1ce4d5){return _0x1ce4d5;});}return null;};}function removeEntity(_0x41696d,_0x13b399){return function(_0x259635){if(_0x259635){return _0x259635[_0x161e('0x23')]()[_0x161e('0x22')](function(){_0x41696d[_0x161e('0x1a')](0xcc)[_0x161e('0x1b')]();});}};}function handleEntityNotFound(_0x135dd6,_0x2e8c25){return function(_0x73867f){if(!_0x73867f){_0x135dd6[_0x161e('0x19')](0x194);}return _0x73867f;};}function handleError(_0x2e631e,_0x29f55e){_0x29f55e=_0x29f55e||0x1f4;return function(_0x46a85e){logger[_0x161e('0x24')](_0x46a85e[_0x161e('0x25')]);if(_0x46a85e[_0x161e('0x26')]){delete _0x46a85e[_0x161e('0x26')];}_0x2e631e['status'](_0x29f55e)[_0x161e('0x27')](_0x46a85e);};}exports[_0x161e('0x28')]=function(_0x46e3b0,_0x38a96a){var _0x5d2124={},_0x17421e={},_0x36ae7f={'count':0x0,'rows':[]};var _0x5d070c=_['map'](db[_0x161e('0x29')][_0x161e('0x2a')],function(_0x23e95e){return{'name':_0x23e95e[_0x161e('0x2b')],'type':_0x23e95e[_0x161e('0x2c')][_0x161e('0x2d')]};});_0x17421e[_0x161e('0x2e')]=_[_0x161e('0x2f')](_0x5d070c,_0x161e('0x26'));_0x17421e[_0x161e('0x30')]=_['keys'](_0x46e3b0[_0x161e('0x30')]);_0x17421e[_0x161e('0x31')]=_[_0x161e('0x32')](_0x17421e[_0x161e('0x2e')],_0x17421e[_0x161e('0x30')]);_0x5d2124[_0x161e('0x33')]=_[_0x161e('0x32')](_0x17421e[_0x161e('0x2e')],qs['fields'](_0x46e3b0['query'][_0x161e('0x34')]));_0x5d2124[_0x161e('0x33')]=_0x5d2124[_0x161e('0x33')]['length']?_0x5d2124[_0x161e('0x33')]:_0x17421e[_0x161e('0x2e')];if(!_0x46e3b0[_0x161e('0x30')]['hasOwnProperty'](_0x161e('0x35'))){_0x5d2124[_0x161e('0x1f')]=qs[_0x161e('0x1f')](_0x46e3b0[_0x161e('0x30')][_0x161e('0x1f')]);_0x5d2124[_0x161e('0x1c')]=qs[_0x161e('0x1c')](_0x46e3b0[_0x161e('0x30')][_0x161e('0x1c')]);}_0x5d2124[_0x161e('0x36')]=qs[_0x161e('0x37')](_0x46e3b0[_0x161e('0x30')][_0x161e('0x37')]);_0x5d2124[_0x161e('0x38')]=qs[_0x161e('0x31')](_['pick'](_0x46e3b0['query'],_0x17421e[_0x161e('0x31')]),_0x5d070c);if(_0x46e3b0[_0x161e('0x30')]['filter']){_0x5d2124[_0x161e('0x38')]=_[_0x161e('0x39')](_0x5d2124[_0x161e('0x38')],{'$or':_[_0x161e('0x2f')](_0x5d070c,function(_0x45aa46){if(_0x45aa46[_0x161e('0x2c')]!=='VIRTUAL'){var _0x3ebf9d={};_0x3ebf9d[_0x45aa46[_0x161e('0x26')]]={'$like':'%'+_0x46e3b0[_0x161e('0x30')][_0x161e('0x3a')]+'%'};return _0x3ebf9d;}})});}_0x5d2124=_[_0x161e('0x39')]({},_0x5d2124,_0x46e3b0[_0x161e('0x3b')]);var _0x35cd82={'where':_0x5d2124[_0x161e('0x38')]};return db['SugarcrmConfiguration'][_0x161e('0x1e')](_0x35cd82)[_0x161e('0x22')](function(_0x3ccca9){_0x36ae7f[_0x161e('0x1e')]=_0x3ccca9;if(_0x46e3b0[_0x161e('0x30')][_0x161e('0x3c')]){_0x5d2124[_0x161e('0x3d')]=[{'all':!![]}];}return db[_0x161e('0x29')][_0x161e('0x3e')](_0x5d2124);})[_0x161e('0x22')](function(_0x302463){_0x36ae7f[_0x161e('0x3f')]=_0x302463;return _0x36ae7f;})['then'](respondWithFilteredResult(_0x38a96a,_0x5d2124))['catch'](handleError(_0x38a96a,null));};exports[_0x161e('0x40')]=function(_0xc911d0,_0x5ea5f4){var _0x175c14={'raw':![],'where':{'id':_0xc911d0[_0x161e('0x41')]['id']}},_0xd39ed2={};_0xd39ed2['model']=_[_0x161e('0x42')](db[_0x161e('0x29')][_0x161e('0x2a')]);_0xd39ed2[_0x161e('0x30')]=_[_0x161e('0x42')](_0xc911d0[_0x161e('0x30')]);_0xd39ed2[_0x161e('0x31')]=_[_0x161e('0x32')](_0xd39ed2['model'],_0xd39ed2[_0x161e('0x30')]);_0x175c14[_0x161e('0x33')]=_[_0x161e('0x32')](_0xd39ed2['model'],qs['fields'](_0xc911d0[_0x161e('0x30')][_0x161e('0x34')]));_0x175c14[_0x161e('0x33')]=_0x175c14[_0x161e('0x33')][_0x161e('0x43')]?_0x175c14['attributes']:_0xd39ed2[_0x161e('0x2e')];if(_0xc911d0['query'][_0x161e('0x3c')]){_0x175c14[_0x161e('0x3d')]=[{'all':!![]}];}_0x175c14=_[_0x161e('0x39')]({},_0x175c14,_0xc911d0[_0x161e('0x3b')]);return db[_0x161e('0x29')][_0x161e('0x44')](_0x175c14)[_0x161e('0x22')](handleEntityNotFound(_0x5ea5f4,null))['then'](respondWithResult(_0x5ea5f4,null))[_0x161e('0x45')](handleError(_0x5ea5f4,null));};exports['create']=function(_0x3161d8,_0x557715){return db[_0x161e('0x29')]['create'](_0x3161d8['body'],{})[_0x161e('0x22')](respondWithResult(_0x557715,0xc9))[_0x161e('0x45')](handleError(_0x557715,null));};exports[_0x161e('0x21')]=function(_0x8940c8,_0x198e28){if(_0x8940c8[_0x161e('0x46')]['id']){delete _0x8940c8[_0x161e('0x46')]['id'];}return db['SugarcrmConfiguration'][_0x161e('0x44')]({'where':{'id':_0x8940c8[_0x161e('0x41')]['id']}})[_0x161e('0x22')](handleEntityNotFound(_0x198e28,null))[_0x161e('0x22')](saveUpdates(_0x8940c8[_0x161e('0x46')],null))['then'](respondWithResult(_0x198e28,null))[_0x161e('0x45')](handleError(_0x198e28,null));};exports[_0x161e('0x23')]=function(_0x440c70,_0x1714ad){return db['SugarcrmConfiguration'][_0x161e('0x44')]({'where':{'id':_0x440c70[_0x161e('0x41')]['id']}})[_0x161e('0x22')](handleEntityNotFound(_0x1714ad,null))['then'](removeEntity(_0x1714ad,null))[_0x161e('0x45')](handleError(_0x1714ad,null));};exports[_0x161e('0x47')]=function(_0x518577,_0x250b6f,_0x468c8c){var _0xc9f040={};var _0x26dcaf={};var _0x21cf73;var _0x4f80f0;return db[_0x161e('0x29')]['findOne']({'where':{'id':_0x518577['params']['id']}})['then'](handleEntityNotFound(_0x250b6f,null))[_0x161e('0x22')](function(_0x42ba73){if(_0x42ba73){_0x21cf73=_0x42ba73;_0x26dcaf['model']=_[_0x161e('0x42')](db[_0x161e('0x48')][_0x161e('0x2a')]);_0x26dcaf[_0x161e('0x30')]=_[_0x161e('0x42')](_0x518577[_0x161e('0x30')]);_0x26dcaf[_0x161e('0x31')]=_[_0x161e('0x32')](_0x26dcaf[_0x161e('0x2e')],_0x26dcaf['query']);_0xc9f040[_0x161e('0x33')]=_[_0x161e('0x32')](_0x26dcaf[_0x161e('0x2e')],qs[_0x161e('0x34')](_0x518577[_0x161e('0x30')][_0x161e('0x34')]));_0xc9f040[_0x161e('0x33')]=_0xc9f040[_0x161e('0x33')][_0x161e('0x43')]?_0xc9f040[_0x161e('0x33')]:_0x26dcaf['model'];_0xc9f040['order']=qs[_0x161e('0x37')](_0x518577[_0x161e('0x30')][_0x161e('0x37')]);_0xc9f040['where']=qs['filters'](_[_0x161e('0x49')](_0x518577['query'],_0x26dcaf[_0x161e('0x31')]));if(_0x518577[_0x161e('0x30')][_0x161e('0x3a')]){_0xc9f040[_0x161e('0x38')]=_[_0x161e('0x39')](_0xc9f040['where'],{'$or':_['map'](_0xc9f040['attributes'],function(_0x508074){var _0x1b9865={};_0x1b9865[_0x508074]={'$like':'%'+_0x518577['query'][_0x161e('0x3a')]+'%'};return _0x1b9865;})});}_0xc9f040=_['merge']({},_0xc9f040,_0x518577[_0x161e('0x3b')]);return _0x21cf73['getFields'](_0xc9f040);}})['then'](function(_0x12dd2e){if(_0x12dd2e){_0x4f80f0=_0x12dd2e[_0x161e('0x43')];if(!_0x518577[_0x161e('0x30')]['hasOwnProperty'](_0x161e('0x35'))){_0xc9f040[_0x161e('0x1f')]=qs['limit'](_0x518577['query'][_0x161e('0x1f')]);_0xc9f040[_0x161e('0x1c')]=qs['offset'](_0x518577[_0x161e('0x30')][_0x161e('0x1c')]);}return _0x21cf73['getFields'](_0xc9f040);}})[_0x161e('0x22')](function(_0x51ffed){if(_0x51ffed){return _0x51ffed?{'count':_0x4f80f0,'rows':_0x51ffed}:null;}})['then'](respondWithResult(_0x250b6f,null))[_0x161e('0x45')](handleError(_0x250b6f,null));};exports['getSubjects']=function(_0x17e798,_0x18dc08,_0x23d5d7){var _0x1b1162={};var _0x4a0b53={};var _0x5e6f8a;var _0x7a2e76;return db[_0x161e('0x29')][_0x161e('0x4a')]({'where':{'id':_0x17e798[_0x161e('0x41')]['id']}})[_0x161e('0x22')](handleEntityNotFound(_0x18dc08,null))[_0x161e('0x22')](function(_0x48d455){if(_0x48d455){_0x5e6f8a=_0x48d455;_0x4a0b53[_0x161e('0x2e')]=_[_0x161e('0x42')](db[_0x161e('0x48')][_0x161e('0x2a')]);_0x4a0b53['query']=_[_0x161e('0x42')](_0x17e798[_0x161e('0x30')]);_0x4a0b53[_0x161e('0x31')]=_[_0x161e('0x32')](_0x4a0b53[_0x161e('0x2e')],_0x4a0b53[_0x161e('0x30')]);_0x1b1162[_0x161e('0x33')]=_[_0x161e('0x32')](_0x4a0b53[_0x161e('0x2e')],qs[_0x161e('0x34')](_0x17e798[_0x161e('0x30')][_0x161e('0x34')]));_0x1b1162[_0x161e('0x33')]=_0x1b1162[_0x161e('0x33')][_0x161e('0x43')]?_0x1b1162[_0x161e('0x33')]:_0x4a0b53[_0x161e('0x2e')];_0x1b1162[_0x161e('0x36')]=qs[_0x161e('0x37')](_0x17e798['query']['sort']);_0x1b1162['where']=qs[_0x161e('0x31')](_[_0x161e('0x49')](_0x17e798[_0x161e('0x30')],_0x4a0b53['filters']));if(_0x17e798[_0x161e('0x30')]['filter']){_0x1b1162[_0x161e('0x38')]=_[_0x161e('0x39')](_0x1b1162['where'],{'$or':_[_0x161e('0x2f')](_0x1b1162['attributes'],function(_0x4868d6){var _0x3272ed={};_0x3272ed[_0x4868d6]={'$like':'%'+_0x17e798[_0x161e('0x30')]['filter']+'%'};return _0x3272ed;})});}_0x1b1162=_[_0x161e('0x39')]({},_0x1b1162,_0x17e798[_0x161e('0x3b')]);return _0x5e6f8a[_0x161e('0x4b')](_0x1b1162);}})['then'](function(_0x4d218c){if(_0x4d218c){_0x7a2e76=_0x4d218c[_0x161e('0x43')];if(!_0x17e798[_0x161e('0x30')][_0x161e('0x4c')](_0x161e('0x35'))){_0x1b1162[_0x161e('0x1f')]=qs[_0x161e('0x1f')](_0x17e798[_0x161e('0x30')][_0x161e('0x1f')]);_0x1b1162[_0x161e('0x1c')]=qs[_0x161e('0x1c')](_0x17e798[_0x161e('0x30')][_0x161e('0x1c')]);}return _0x5e6f8a[_0x161e('0x4b')](_0x1b1162);}})['then'](function(_0x54dfb1){if(_0x54dfb1){return _0x54dfb1?{'count':_0x7a2e76,'rows':_0x54dfb1}:null;}})[_0x161e('0x22')](respondWithResult(_0x18dc08,null))[_0x161e('0x45')](handleError(_0x18dc08,null));};exports[_0x161e('0x4d')]=function(_0x10c7de,_0x59bff2,_0x100a3b){var _0x461f43={};var _0x1f9823={};var _0x3c3615;var _0x298225;return db['SugarcrmConfiguration'][_0x161e('0x4a')]({'where':{'id':_0x10c7de[_0x161e('0x41')]['id']}})[_0x161e('0x22')](handleEntityNotFound(_0x59bff2,null))[_0x161e('0x22')](function(_0x2c811c){if(_0x2c811c){_0x3c3615=_0x2c811c;_0x1f9823[_0x161e('0x2e')]=_[_0x161e('0x42')](db[_0x161e('0x48')][_0x161e('0x2a')]);_0x1f9823[_0x161e('0x30')]=_[_0x161e('0x42')](_0x10c7de['query']);_0x1f9823[_0x161e('0x31')]=_[_0x161e('0x32')](_0x1f9823[_0x161e('0x2e')],_0x1f9823[_0x161e('0x30')]);_0x461f43[_0x161e('0x33')]=_[_0x161e('0x32')](_0x1f9823[_0x161e('0x2e')],qs[_0x161e('0x34')](_0x10c7de[_0x161e('0x30')]['fields']));_0x461f43[_0x161e('0x33')]=_0x461f43[_0x161e('0x33')][_0x161e('0x43')]?_0x461f43[_0x161e('0x33')]:_0x1f9823[_0x161e('0x2e')];_0x461f43[_0x161e('0x36')]=qs[_0x161e('0x37')](_0x10c7de[_0x161e('0x30')][_0x161e('0x37')]);_0x461f43[_0x161e('0x38')]=qs[_0x161e('0x31')](_[_0x161e('0x49')](_0x10c7de[_0x161e('0x30')],_0x1f9823[_0x161e('0x31')]));if(_0x10c7de['query'][_0x161e('0x3a')]){_0x461f43[_0x161e('0x38')]=_[_0x161e('0x39')](_0x461f43['where'],{'$or':_['map'](_0x461f43[_0x161e('0x33')],function(_0x2a7e26){var _0x390964={};_0x390964[_0x2a7e26]={'$like':'%'+_0x10c7de[_0x161e('0x30')]['filter']+'%'};return _0x390964;})});}_0x461f43=_['merge']({},_0x461f43,_0x10c7de[_0x161e('0x3b')]);return _0x3c3615[_0x161e('0x4d')](_0x461f43);}})['then'](function(_0x3f56c6){if(_0x3f56c6){_0x298225=_0x3f56c6['length'];if(!_0x10c7de[_0x161e('0x30')][_0x161e('0x4c')]('nolimit')){_0x461f43['limit']=qs[_0x161e('0x1f')](_0x10c7de[_0x161e('0x30')][_0x161e('0x1f')]);_0x461f43['offset']=qs['offset'](_0x10c7de[_0x161e('0x30')][_0x161e('0x1c')]);}return _0x3c3615[_0x161e('0x4d')](_0x461f43);}})[_0x161e('0x22')](function(_0x2dec8c){if(_0x2dec8c){return _0x2dec8c?{'count':_0x298225,'rows':_0x2dec8c}:null;}})[_0x161e('0x22')](respondWithResult(_0x59bff2,null))[_0x161e('0x45')](handleError(_0x59bff2,null));}; \ No newline at end of file +var _0xa8a2=['ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','map','SugarcrmConfiguration','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','filter','VIRTUAL','merge','options','includeAll','rows','catch','show','params','include','body','find','getFields','findOne','sort','getSubjects','SugarcrmField','pick','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv'];(function(_0x2af5ec,_0x5cf1f8){var _0xd144aa=function(_0x1a1c81){while(--_0x1a1c81){_0x2af5ec['push'](_0x2af5ec['shift']());}};_0xd144aa(++_0x5cf1f8);}(_0xa8a2,0x185));var _0x2a8a=function(_0x511b38,_0x3731bf){_0x511b38=_0x511b38-0x0;var _0x205e91=_0xa8a2[_0x511b38];return _0x205e91;};'use strict';var emlformat=require(_0x2a8a('0x0'));var rimraf=require(_0x2a8a('0x1'));var zipdir=require(_0x2a8a('0x2'));var jsonpatch=require(_0x2a8a('0x3'));var rp=require(_0x2a8a('0x4'));var moment=require(_0x2a8a('0x5'));var BPromise=require(_0x2a8a('0x6'));var Mustache=require(_0x2a8a('0x7'));var util=require(_0x2a8a('0x8'));var path=require('path');var sox=require(_0x2a8a('0x9'));var csv=require(_0x2a8a('0xa'));var ejs=require(_0x2a8a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2a8a('0xc'));var squel=require(_0x2a8a('0xd'));var crypto=require(_0x2a8a('0xe'));var jsforce=require(_0x2a8a('0xf'));var deskjs=require(_0x2a8a('0x10'));var toCsv=require(_0x2a8a('0xa'));var querystring=require(_0x2a8a('0x11'));var Papa=require('papaparse');var Redis=require(_0x2a8a('0x12'));var authService=require(_0x2a8a('0x13'));var qs=require(_0x2a8a('0x14'));var as=require(_0x2a8a('0x15'));var hardwareService=require(_0x2a8a('0x16'));var logger=require('../../config/logger')(_0x2a8a('0x17'));var utils=require('../../config/utils');var config=require(_0x2a8a('0x18'));var licenseUtil=require(_0x2a8a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb5038c,_0x53cecc){_0x53cecc=_0x53cecc||0xcc;return function(_0x5c4286){if(_0x5c4286){return _0xb5038c[_0x2a8a('0x1a')](_0x53cecc);}return _0xb5038c[_0x2a8a('0x1b')](_0x53cecc)[_0x2a8a('0x1c')]();};}function respondWithResult(_0x14018a,_0xe5420f){_0xe5420f=_0xe5420f||0xc8;return function(_0x57c000){if(_0x57c000){return _0x14018a[_0x2a8a('0x1b')](_0xe5420f)[_0x2a8a('0x1d')](_0x57c000);}};}function respondWithFilteredResult(_0x224180,_0x205bcd){return function(_0x360348){if(_0x360348){var _0x2799fa=typeof _0x205bcd[_0x2a8a('0x1e')]===_0x2a8a('0x1f')&&typeof _0x205bcd[_0x2a8a('0x20')]===_0x2a8a('0x1f');var _0x336c57=_0x360348[_0x2a8a('0x21')];var _0x1b8a66=_0x2799fa?0x0:_0x205bcd[_0x2a8a('0x1e')];var _0xc72402=_0x2799fa?_0x360348[_0x2a8a('0x21')]:_0x205bcd['offset']+_0x205bcd[_0x2a8a('0x20')];var _0x16db43;if(_0xc72402>=_0x336c57){_0xc72402=_0x336c57;_0x16db43=0xc8;}else{_0x16db43=0xce;}_0x224180['status'](_0x16db43);return _0x224180[_0x2a8a('0x22')](_0x2a8a('0x23'),_0x1b8a66+'-'+_0xc72402+'/'+_0x336c57)[_0x2a8a('0x1d')](_0x360348);}return null;};}function patchUpdates(_0x4c9c24){return function(_0xbce620){try{jsonpatch[_0x2a8a('0x24')](_0xbce620,_0x4c9c24,!![]);}catch(_0x3a888e){return BPromise['reject'](_0x3a888e);}return _0xbce620[_0x2a8a('0x25')]();};}function saveUpdates(_0xf4a6f1,_0x37f74a){return function(_0x40ac68){if(_0x40ac68){return _0x40ac68[_0x2a8a('0x26')](_0xf4a6f1)[_0x2a8a('0x27')](function(_0x440c26){return _0x440c26;});}return null;};}function removeEntity(_0x3c7a9e,_0xa0d2d3){return function(_0x36800c){if(_0x36800c){return _0x36800c[_0x2a8a('0x28')]()[_0x2a8a('0x27')](function(){_0x3c7a9e['status'](0xcc)[_0x2a8a('0x1c')]();});}};}function handleEntityNotFound(_0x11d712,_0x8f6d9e){return function(_0x15c936){if(!_0x15c936){_0x11d712[_0x2a8a('0x1a')](0x194);}return _0x15c936;};}function handleError(_0x41bac7,_0x3a333f){_0x3a333f=_0x3a333f||0x1f4;return function(_0xc0ad34){logger[_0x2a8a('0x29')](_0xc0ad34[_0x2a8a('0x2a')]);if(_0xc0ad34[_0x2a8a('0x2b')]){delete _0xc0ad34[_0x2a8a('0x2b')];}_0x41bac7[_0x2a8a('0x1b')](_0x3a333f)['send'](_0xc0ad34);};}exports['index']=function(_0x44947c,_0x27c5bc){var _0x5b2af2={},_0x1d3f84={},_0x2b2978={'count':0x0,'rows':[]};var _0xc7634a=_[_0x2a8a('0x2c')](db[_0x2a8a('0x2d')][_0x2a8a('0x2e')],function(_0x186863){return{'name':_0x186863[_0x2a8a('0x2f')],'type':_0x186863[_0x2a8a('0x30')]['key']};});_0x1d3f84[_0x2a8a('0x31')]=_[_0x2a8a('0x2c')](_0xc7634a,_0x2a8a('0x2b'));_0x1d3f84['query']=_[_0x2a8a('0x32')](_0x44947c[_0x2a8a('0x33')]);_0x1d3f84['filters']=_[_0x2a8a('0x34')](_0x1d3f84['model'],_0x1d3f84[_0x2a8a('0x33')]);_0x5b2af2[_0x2a8a('0x35')]=_['intersection'](_0x1d3f84[_0x2a8a('0x31')],qs[_0x2a8a('0x36')](_0x44947c['query'][_0x2a8a('0x36')]));_0x5b2af2[_0x2a8a('0x35')]=_0x5b2af2['attributes'][_0x2a8a('0x37')]?_0x5b2af2[_0x2a8a('0x35')]:_0x1d3f84[_0x2a8a('0x31')];if(!_0x44947c[_0x2a8a('0x33')][_0x2a8a('0x38')](_0x2a8a('0x39'))){_0x5b2af2[_0x2a8a('0x20')]=qs[_0x2a8a('0x20')](_0x44947c['query']['limit']);_0x5b2af2[_0x2a8a('0x1e')]=qs['offset'](_0x44947c[_0x2a8a('0x33')]['offset']);}_0x5b2af2[_0x2a8a('0x3a')]=qs['sort'](_0x44947c[_0x2a8a('0x33')]['sort']);_0x5b2af2[_0x2a8a('0x3b')]=qs[_0x2a8a('0x3c')](_['pick'](_0x44947c[_0x2a8a('0x33')],_0x1d3f84['filters']),_0xc7634a);if(_0x44947c[_0x2a8a('0x33')][_0x2a8a('0x3d')]){_0x5b2af2['where']=_['merge'](_0x5b2af2[_0x2a8a('0x3b')],{'$or':_[_0x2a8a('0x2c')](_0xc7634a,function(_0x31a0ed){if(_0x31a0ed[_0x2a8a('0x30')]!==_0x2a8a('0x3e')){var _0x36516d={};_0x36516d[_0x31a0ed[_0x2a8a('0x2b')]]={'$like':'%'+_0x44947c[_0x2a8a('0x33')][_0x2a8a('0x3d')]+'%'};return _0x36516d;}})});}_0x5b2af2=_[_0x2a8a('0x3f')]({},_0x5b2af2,_0x44947c[_0x2a8a('0x40')]);var _0x316474={'where':_0x5b2af2[_0x2a8a('0x3b')]};return db[_0x2a8a('0x2d')][_0x2a8a('0x21')](_0x316474)[_0x2a8a('0x27')](function(_0x4a3508){_0x2b2978[_0x2a8a('0x21')]=_0x4a3508;if(_0x44947c[_0x2a8a('0x33')][_0x2a8a('0x41')]){_0x5b2af2['include']=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x5b2af2);})['then'](function(_0x15ed2a){_0x2b2978[_0x2a8a('0x42')]=_0x15ed2a;return _0x2b2978;})[_0x2a8a('0x27')](respondWithFilteredResult(_0x27c5bc,_0x5b2af2))[_0x2a8a('0x43')](handleError(_0x27c5bc,null));};exports[_0x2a8a('0x44')]=function(_0x52f9c1,_0x26ca15){var _0x22e7ec={'raw':![],'where':{'id':_0x52f9c1[_0x2a8a('0x45')]['id']}},_0x2936fa={};_0x2936fa[_0x2a8a('0x31')]=_[_0x2a8a('0x32')](db[_0x2a8a('0x2d')][_0x2a8a('0x2e')]);_0x2936fa['query']=_[_0x2a8a('0x32')](_0x52f9c1[_0x2a8a('0x33')]);_0x2936fa[_0x2a8a('0x3c')]=_['intersection'](_0x2936fa['model'],_0x2936fa[_0x2a8a('0x33')]);_0x22e7ec[_0x2a8a('0x35')]=_[_0x2a8a('0x34')](_0x2936fa[_0x2a8a('0x31')],qs['fields'](_0x52f9c1[_0x2a8a('0x33')][_0x2a8a('0x36')]));_0x22e7ec[_0x2a8a('0x35')]=_0x22e7ec['attributes']['length']?_0x22e7ec['attributes']:_0x2936fa[_0x2a8a('0x31')];if(_0x52f9c1['query'][_0x2a8a('0x41')]){_0x22e7ec[_0x2a8a('0x46')]=[{'all':!![]}];}_0x22e7ec=_['merge']({},_0x22e7ec,_0x52f9c1[_0x2a8a('0x40')]);return db[_0x2a8a('0x2d')]['find'](_0x22e7ec)[_0x2a8a('0x27')](handleEntityNotFound(_0x26ca15,null))[_0x2a8a('0x27')](respondWithResult(_0x26ca15,null))['catch'](handleError(_0x26ca15,null));};exports['create']=function(_0x2905c5,_0x275b05){return db['SugarcrmConfiguration']['create'](_0x2905c5[_0x2a8a('0x47')],{})[_0x2a8a('0x27')](respondWithResult(_0x275b05,0xc9))[_0x2a8a('0x43')](handleError(_0x275b05,null));};exports['update']=function(_0x4541c9,_0x238d76){if(_0x4541c9[_0x2a8a('0x47')]['id']){delete _0x4541c9[_0x2a8a('0x47')]['id'];}return db['SugarcrmConfiguration'][_0x2a8a('0x48')]({'where':{'id':_0x4541c9['params']['id']}})[_0x2a8a('0x27')](handleEntityNotFound(_0x238d76,null))['then'](saveUpdates(_0x4541c9['body'],null))[_0x2a8a('0x27')](respondWithResult(_0x238d76,null))[_0x2a8a('0x43')](handleError(_0x238d76,null));};exports[_0x2a8a('0x28')]=function(_0xa83c26,_0x1e0a01){return db[_0x2a8a('0x2d')][_0x2a8a('0x48')]({'where':{'id':_0xa83c26[_0x2a8a('0x45')]['id']}})[_0x2a8a('0x27')](handleEntityNotFound(_0x1e0a01,null))[_0x2a8a('0x27')](removeEntity(_0x1e0a01,null))[_0x2a8a('0x43')](handleError(_0x1e0a01,null));};exports[_0x2a8a('0x49')]=function(_0x39dbf9,_0x153942,_0x4c4fcb){var _0x5eb97b={};var _0x1ffabb={};var _0x17c3c8;var _0x5d584c;return db[_0x2a8a('0x2d')][_0x2a8a('0x4a')]({'where':{'id':_0x39dbf9[_0x2a8a('0x45')]['id']}})[_0x2a8a('0x27')](handleEntityNotFound(_0x153942,null))[_0x2a8a('0x27')](function(_0x4a590f){if(_0x4a590f){_0x17c3c8=_0x4a590f;_0x1ffabb[_0x2a8a('0x31')]=_[_0x2a8a('0x32')](db['SugarcrmField']['rawAttributes']);_0x1ffabb[_0x2a8a('0x33')]=_[_0x2a8a('0x32')](_0x39dbf9[_0x2a8a('0x33')]);_0x1ffabb[_0x2a8a('0x3c')]=_['intersection'](_0x1ffabb[_0x2a8a('0x31')],_0x1ffabb[_0x2a8a('0x33')]);_0x5eb97b['attributes']=_[_0x2a8a('0x34')](_0x1ffabb['model'],qs[_0x2a8a('0x36')](_0x39dbf9[_0x2a8a('0x33')][_0x2a8a('0x36')]));_0x5eb97b['attributes']=_0x5eb97b['attributes'][_0x2a8a('0x37')]?_0x5eb97b['attributes']:_0x1ffabb[_0x2a8a('0x31')];_0x5eb97b[_0x2a8a('0x3a')]=qs['sort'](_0x39dbf9[_0x2a8a('0x33')][_0x2a8a('0x4b')]);_0x5eb97b['where']=qs[_0x2a8a('0x3c')](_['pick'](_0x39dbf9[_0x2a8a('0x33')],_0x1ffabb[_0x2a8a('0x3c')]));if(_0x39dbf9[_0x2a8a('0x33')][_0x2a8a('0x3d')]){_0x5eb97b[_0x2a8a('0x3b')]=_['merge'](_0x5eb97b[_0x2a8a('0x3b')],{'$or':_['map'](_0x5eb97b['attributes'],function(_0x4a01e4){var _0x3656f6={};_0x3656f6[_0x4a01e4]={'$like':'%'+_0x39dbf9['query'][_0x2a8a('0x3d')]+'%'};return _0x3656f6;})});}_0x5eb97b=_[_0x2a8a('0x3f')]({},_0x5eb97b,_0x39dbf9['options']);return _0x17c3c8['getFields'](_0x5eb97b);}})[_0x2a8a('0x27')](function(_0x1108c7){if(_0x1108c7){_0x5d584c=_0x1108c7[_0x2a8a('0x37')];if(!_0x39dbf9[_0x2a8a('0x33')][_0x2a8a('0x38')](_0x2a8a('0x39'))){_0x5eb97b[_0x2a8a('0x20')]=qs[_0x2a8a('0x20')](_0x39dbf9[_0x2a8a('0x33')][_0x2a8a('0x20')]);_0x5eb97b['offset']=qs[_0x2a8a('0x1e')](_0x39dbf9[_0x2a8a('0x33')]['offset']);}return _0x17c3c8[_0x2a8a('0x49')](_0x5eb97b);}})[_0x2a8a('0x27')](function(_0x44daca){if(_0x44daca){return _0x44daca?{'count':_0x5d584c,'rows':_0x44daca}:null;}})[_0x2a8a('0x27')](respondWithResult(_0x153942,null))[_0x2a8a('0x43')](handleError(_0x153942,null));};exports[_0x2a8a('0x4c')]=function(_0x5a5e05,_0x18bce8,_0x3c5069){var _0x262bb9={};var _0x5c7a30={};var _0x2c9981;var _0x586818;return db[_0x2a8a('0x2d')]['findOne']({'where':{'id':_0x5a5e05['params']['id']}})[_0x2a8a('0x27')](handleEntityNotFound(_0x18bce8,null))['then'](function(_0x381bcc){if(_0x381bcc){_0x2c9981=_0x381bcc;_0x5c7a30['model']=_[_0x2a8a('0x32')](db[_0x2a8a('0x4d')]['rawAttributes']);_0x5c7a30[_0x2a8a('0x33')]=_[_0x2a8a('0x32')](_0x5a5e05[_0x2a8a('0x33')]);_0x5c7a30[_0x2a8a('0x3c')]=_[_0x2a8a('0x34')](_0x5c7a30['model'],_0x5c7a30[_0x2a8a('0x33')]);_0x262bb9['attributes']=_[_0x2a8a('0x34')](_0x5c7a30['model'],qs[_0x2a8a('0x36')](_0x5a5e05[_0x2a8a('0x33')][_0x2a8a('0x36')]));_0x262bb9[_0x2a8a('0x35')]=_0x262bb9[_0x2a8a('0x35')][_0x2a8a('0x37')]?_0x262bb9['attributes']:_0x5c7a30[_0x2a8a('0x31')];_0x262bb9['order']=qs['sort'](_0x5a5e05[_0x2a8a('0x33')]['sort']);_0x262bb9[_0x2a8a('0x3b')]=qs['filters'](_[_0x2a8a('0x4e')](_0x5a5e05[_0x2a8a('0x33')],_0x5c7a30[_0x2a8a('0x3c')]));if(_0x5a5e05['query'][_0x2a8a('0x3d')]){_0x262bb9[_0x2a8a('0x3b')]=_[_0x2a8a('0x3f')](_0x262bb9[_0x2a8a('0x3b')],{'$or':_[_0x2a8a('0x2c')](_0x262bb9[_0x2a8a('0x35')],function(_0x29c5d5){var _0x5c2105={};_0x5c2105[_0x29c5d5]={'$like':'%'+_0x5a5e05[_0x2a8a('0x33')][_0x2a8a('0x3d')]+'%'};return _0x5c2105;})});}_0x262bb9=_['merge']({},_0x262bb9,_0x5a5e05[_0x2a8a('0x40')]);return _0x2c9981[_0x2a8a('0x4c')](_0x262bb9);}})[_0x2a8a('0x27')](function(_0x6979e5){if(_0x6979e5){_0x586818=_0x6979e5['length'];if(!_0x5a5e05[_0x2a8a('0x33')]['hasOwnProperty'](_0x2a8a('0x39'))){_0x262bb9[_0x2a8a('0x20')]=qs[_0x2a8a('0x20')](_0x5a5e05[_0x2a8a('0x33')][_0x2a8a('0x20')]);_0x262bb9[_0x2a8a('0x1e')]=qs[_0x2a8a('0x1e')](_0x5a5e05[_0x2a8a('0x33')]['offset']);}return _0x2c9981[_0x2a8a('0x4c')](_0x262bb9);}})[_0x2a8a('0x27')](function(_0x52df0d){if(_0x52df0d){return _0x52df0d?{'count':_0x586818,'rows':_0x52df0d}:null;}})[_0x2a8a('0x27')](respondWithResult(_0x18bce8,null))[_0x2a8a('0x43')](handleError(_0x18bce8,null));};exports[_0x2a8a('0x4f')]=function(_0x48e3c7,_0x2d510f,_0x352adb){var _0x35867a={};var _0x14962d={};var _0x52238a;var _0x3033b5;return db[_0x2a8a('0x2d')][_0x2a8a('0x4a')]({'where':{'id':_0x48e3c7[_0x2a8a('0x45')]['id']}})[_0x2a8a('0x27')](handleEntityNotFound(_0x2d510f,null))[_0x2a8a('0x27')](function(_0x38531b){if(_0x38531b){_0x52238a=_0x38531b;_0x14962d[_0x2a8a('0x31')]=_[_0x2a8a('0x32')](db[_0x2a8a('0x4d')][_0x2a8a('0x2e')]);_0x14962d['query']=_['keys'](_0x48e3c7[_0x2a8a('0x33')]);_0x14962d[_0x2a8a('0x3c')]=_[_0x2a8a('0x34')](_0x14962d[_0x2a8a('0x31')],_0x14962d[_0x2a8a('0x33')]);_0x35867a[_0x2a8a('0x35')]=_[_0x2a8a('0x34')](_0x14962d[_0x2a8a('0x31')],qs[_0x2a8a('0x36')](_0x48e3c7[_0x2a8a('0x33')][_0x2a8a('0x36')]));_0x35867a['attributes']=_0x35867a[_0x2a8a('0x35')]['length']?_0x35867a['attributes']:_0x14962d['model'];_0x35867a[_0x2a8a('0x3a')]=qs[_0x2a8a('0x4b')](_0x48e3c7['query'][_0x2a8a('0x4b')]);_0x35867a[_0x2a8a('0x3b')]=qs['filters'](_[_0x2a8a('0x4e')](_0x48e3c7[_0x2a8a('0x33')],_0x14962d[_0x2a8a('0x3c')]));if(_0x48e3c7[_0x2a8a('0x33')][_0x2a8a('0x3d')]){_0x35867a['where']=_[_0x2a8a('0x3f')](_0x35867a[_0x2a8a('0x3b')],{'$or':_[_0x2a8a('0x2c')](_0x35867a['attributes'],function(_0x56ce72){var _0x30efdf={};_0x30efdf[_0x56ce72]={'$like':'%'+_0x48e3c7[_0x2a8a('0x33')]['filter']+'%'};return _0x30efdf;})});}_0x35867a=_[_0x2a8a('0x3f')]({},_0x35867a,_0x48e3c7['options']);return _0x52238a['getDescriptions'](_0x35867a);}})[_0x2a8a('0x27')](function(_0x2ad3fc){if(_0x2ad3fc){_0x3033b5=_0x2ad3fc['length'];if(!_0x48e3c7[_0x2a8a('0x33')][_0x2a8a('0x38')](_0x2a8a('0x39'))){_0x35867a[_0x2a8a('0x20')]=qs[_0x2a8a('0x20')](_0x48e3c7[_0x2a8a('0x33')]['limit']);_0x35867a[_0x2a8a('0x1e')]=qs[_0x2a8a('0x1e')](_0x48e3c7[_0x2a8a('0x33')][_0x2a8a('0x1e')]);}return _0x52238a[_0x2a8a('0x4f')](_0x35867a);}})[_0x2a8a('0x27')](function(_0x2e7148){if(_0x2e7148){return _0x2e7148?{'count':_0x3033b5,'rows':_0x2e7148}:null;}})[_0x2a8a('0x27')](respondWithResult(_0x2d510f,null))['catch'](handleError(_0x2d510f,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 9ce3928..132b28f 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 _0xb029=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb029,0x18c));var _0x9b02=function(_0x39b21d,_0x1baef9){_0x39b21d=_0x39b21d-0x0;var _0x73b4dc=_0xb029[_0x39b21d];return _0x73b4dc;};'use strict';var _=require('lodash');var util=require(_0x9b02('0x0'));var logger=require(_0x9b02('0x1'))(_0x9b02('0x2'));var moment=require(_0x9b02('0x3'));var BPromise=require(_0x9b02('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b02('0x5'));var rimraf=require(_0x9b02('0x6'));var config=require(_0x9b02('0x7'));var attributes=require(_0x9b02('0x8'));module[_0x9b02('0x9')]=function(_0x50cf24,_0x2e0d7a){return _0x50cf24['define'](_0x9b02('0xa'),attributes,{'tableName':_0x9b02('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bb6=['path','rimraf','exports','define','SugarcrmConfiguration','util','api','bluebird','request-promise'];(function(_0x378b4,_0x5ca7fa){var _0x11d07b=function(_0x35d420){while(--_0x35d420){_0x378b4['push'](_0x378b4['shift']());}};_0x11d07b(++_0x5ca7fa);}(_0x9bb6,0xb0));var _0x69bb=function(_0x3a1d7d,_0x11dfbd){_0x3a1d7d=_0x3a1d7d-0x0;var _0x2af564=_0x9bb6[_0x3a1d7d];return _0x2af564;};'use strict';var _=require('lodash');var util=require(_0x69bb('0x0'));var logger=require('../../config/logger')(_0x69bb('0x1'));var moment=require('moment');var BPromise=require(_0x69bb('0x2'));var rp=require(_0x69bb('0x3'));var fs=require('fs');var path=require(_0x69bb('0x4'));var rimraf=require(_0x69bb('0x5'));var config=require('../../config/environment');var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x69bb('0x6')]=function(_0x55aa2b,_0x325566){return _0x55aa2b[_0x69bb('0x7')](_0x69bb('0x8'),attributes,{'tableName':'int_sugarcrm_configurations','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 95e6cea..ea33bc0 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 _0x8ddd=['result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','SugarcrmConfiguration,\x20%s,\x20%s','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8ddd,0x106));var _0xd8dd=function(_0x109042,_0x413790){_0x109042=_0x109042-0x0;var _0x5afbab=_0x8ddd[_0x109042];return _0x5afbab;};'use strict';var _=require(_0xd8dd('0x0'));var util=require(_0xd8dd('0x1'));var moment=require('moment');var BPromise=require(_0xd8dd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8dd('0x3'));var db=require(_0xd8dd('0x4'))['db'];var utils=require(_0xd8dd('0x5'));var logger=require(_0xd8dd('0x6'))('rpc');var config=require(_0xd8dd('0x7'));var jayson=require(_0xd8dd('0x8'));var client=jayson[_0xd8dd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40bec6,_0x1aad68,_0x252789){return new BPromise(function(_0x5374ef,_0x6fa719){return client[_0xd8dd('0xa')](_0x40bec6,_0x252789)['then'](function(_0x46deb8){logger[_0xd8dd('0xb')](_0xd8dd('0xc'),_0x1aad68,'request\x20sent');logger['debug'](_0xd8dd('0xd'),_0x1aad68,_0xd8dd('0xe'),JSON[_0xd8dd('0xf')](_0x46deb8));if(_0x46deb8[_0xd8dd('0x10')]){if(_0x46deb8['error']['code']===0x1f4){logger[_0xd8dd('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1aad68,_0x46deb8[_0xd8dd('0x10')][_0xd8dd('0x11')]);return _0x6fa719(_0x46deb8['error']['message']);}logger[_0xd8dd('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1aad68,_0x46deb8[_0xd8dd('0x10')]['message']);return _0x5374ef(_0x46deb8['error'][_0xd8dd('0x11')]);}else{logger[_0xd8dd('0xb')](_0xd8dd('0xc'),_0x1aad68,_0xd8dd('0xe'));_0x5374ef(_0x46deb8[_0xd8dd('0x12')][_0xd8dd('0x11')]);}})[_0xd8dd('0x13')](function(_0x211033){logger['error'](_0xd8dd('0xc'),_0x1aad68,_0x211033);_0x6fa719(_0x211033);});});} \ No newline at end of file +var _0x2bf6=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x9f2a69,_0x5158db){var _0x1365e6=function(_0x1ae01f){while(--_0x1ae01f){_0x9f2a69['push'](_0x9f2a69['shift']());}};_0x1365e6(++_0x5158db);}(_0x2bf6,0x163));var _0x62bf=function(_0x5ee4d5,_0x5873a3){_0x5ee4d5=_0x5ee4d5-0x0;var _0x241a05=_0x2bf6[_0x5ee4d5];return _0x241a05;};'use strict';var _=require('lodash');var util=require(_0x62bf('0x0'));var moment=require(_0x62bf('0x1'));var BPromise=require(_0x62bf('0x2'));var rs=require(_0x62bf('0x3'));var fs=require('fs');var Redis=require(_0x62bf('0x4'));var db=require(_0x62bf('0x5'))['db'];var utils=require(_0x62bf('0x6'));var logger=require(_0x62bf('0x7'))('rpc');var config=require(_0x62bf('0x8'));var jayson=require(_0x62bf('0x9'));var client=jayson[_0x62bf('0xa')][_0x62bf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d8000,_0xc6a24b,_0x2a264e){return new BPromise(function(_0x8b91fe,_0x4e669e){return client[_0x62bf('0xc')](_0x4d8000,_0x2a264e)[_0x62bf('0xd')](function(_0x336aa9){logger['info'](_0x62bf('0xe'),_0xc6a24b,'request\x20sent');logger[_0x62bf('0xf')](_0x62bf('0x10'),_0xc6a24b,_0x62bf('0x11'),JSON['stringify'](_0x336aa9));if(_0x336aa9[_0x62bf('0x12')]){if(_0x336aa9['error'][_0x62bf('0x13')]===0x1f4){logger[_0x62bf('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xc6a24b,_0x336aa9[_0x62bf('0x12')]['message']);return _0x4e669e(_0x336aa9[_0x62bf('0x12')]['message']);}logger[_0x62bf('0x12')](_0x62bf('0xe'),_0xc6a24b,_0x336aa9['error'][_0x62bf('0x14')]);return _0x8b91fe(_0x336aa9[_0x62bf('0x12')][_0x62bf('0x14')]);}else{logger[_0x62bf('0x15')](_0x62bf('0xe'),_0xc6a24b,_0x62bf('0x11'));_0x8b91fe(_0x336aa9[_0x62bf('0x16')][_0x62bf('0x14')]);}})[_0x62bf('0x17')](function(_0x544d17){logger['error'](_0x62bf('0xe'),_0xc6a24b,_0x544d17);_0x4e669e(_0x544d17);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index e6a1342..fbf4104 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 _0xe017=['isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get'];(function(_0x43e83e,_0x57bc80){var _0x474911=function(_0x35c6c2){while(--_0x35c6c2){_0x43e83e['push'](_0x43e83e['shift']());}};_0x474911(++_0x57bc80);}(_0xe017,0xaa));var _0x7e01=function(_0x58ef09,_0x5849f7){_0x58ef09=_0x58ef09-0x0;var _0x1795ab=_0xe017[_0x58ef09];return _0x1795ab;};'use strict';var multer=require(_0x7e01('0x0'));var util=require(_0x7e01('0x1'));var path=require(_0x7e01('0x2'));var timeout=require(_0x7e01('0x3'));var express=require('express');var router=express[_0x7e01('0x4')]();var fs_extra=require(_0x7e01('0x5'));var auth=require(_0x7e01('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7e01('0x7'));var controller=require(_0x7e01('0x8'));router[_0x7e01('0x9')]('/',auth[_0x7e01('0xa')](),controller['index']);router[_0x7e01('0x9')](_0x7e01('0xb'),auth[_0x7e01('0xa')](),controller[_0x7e01('0xc')]);router[_0x7e01('0xd')]('/',auth[_0x7e01('0xa')](),controller[_0x7e01('0xe')]);router[_0x7e01('0xf')](_0x7e01('0xb'),auth[_0x7e01('0xa')](),controller[_0x7e01('0x10')]);router[_0x7e01('0x11')](_0x7e01('0xb'),auth[_0x7e01('0xa')](),controller[_0x7e01('0x12')]);module[_0x7e01('0x13')]=router; \ No newline at end of file +var _0xbe84=['index','get','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xbe84,0xaa));var _0x4be8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbe84[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x4be8('0x0'));var util=require(_0x4be8('0x1'));var path=require('path');var timeout=require(_0x4be8('0x2'));var express=require(_0x4be8('0x3'));var router=express[_0x4be8('0x4')]();var fs_extra=require(_0x4be8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4be8('0x6'));var config=require(_0x4be8('0x7'));var controller=require(_0x4be8('0x8'));router['get']('/',auth[_0x4be8('0x9')](),controller[_0x4be8('0xa')]);router[_0x4be8('0xb')](_0x4be8('0xc'),auth[_0x4be8('0x9')](),controller[_0x4be8('0xd')]);router[_0x4be8('0xe')]('/',auth['isAuthenticated'](),controller[_0x4be8('0xf')]);router[_0x4be8('0x10')]('/:id',auth[_0x4be8('0x9')](),controller[_0x4be8('0x11')]);router['delete'](_0x4be8('0xc'),auth[_0x4be8('0x9')](),controller[_0x4be8('0x12')]);module[_0x4be8('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 085f630..acc10b2 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 _0x1fc7=['keyValue','STRING','ENUM','BOOLEAN','sequelize','string','variable','customVariable'];(function(_0x46c077,_0xfdb3b8){var _0x3687e1=function(_0x594967){while(--_0x594967){_0x46c077['push'](_0x46c077['shift']());}};_0x3687e1(++_0xfdb3b8);}(_0x1fc7,0x94));var _0x71fc=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x1fc7[_0x2064e5];return _0x21a233;};'use strict';var Sequelize=require(_0x71fc('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x71fc('0x1'),_0x71fc('0x2'),_0x71fc('0x3'),_0x71fc('0x4'),'picklist'),'defaultValue':_0x71fc('0x1')},'content':{'type':Sequelize[_0x71fc('0x5')]},'key':{'type':Sequelize[_0x71fc('0x5')]},'keyType':{'type':Sequelize[_0x71fc('0x6')]('string',_0x71fc('0x2'),_0x71fc('0x3'))},'keyContent':{'type':Sequelize[_0x71fc('0x5')]},'idField':{'type':Sequelize[_0x71fc('0x5')]},'nameField':{'type':Sequelize[_0x71fc('0x5')]},'customField':{'type':Sequelize[_0x71fc('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x71fc('0x5')]}}; \ No newline at end of file +var _0xf2e1=['STRING','ENUM','variable','BOOLEAN','customVariable','picklist','string'];(function(_0x1ad6f5,_0x563ff4){var _0x2c23bd=function(_0x4f3c33){while(--_0x4f3c33){_0x1ad6f5['push'](_0x1ad6f5['shift']());}};_0x2c23bd(++_0x563ff4);}(_0xf2e1,0x115));var _0x1f2e=function(_0x4d9043,_0x13dadc){_0x4d9043=_0x4d9043-0x0;var _0xeae030=_0xf2e1[_0x4d9043];return _0xeae030;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM']('string','variable',_0x1f2e('0x0'),'keyValue',_0x1f2e('0x1')),'defaultValue':_0x1f2e('0x2')},'content':{'type':Sequelize[_0x1f2e('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1f2e('0x4')](_0x1f2e('0x2'),_0x1f2e('0x5'),_0x1f2e('0x0'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1f2e('0x3')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1f2e('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1f2e('0x3')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 0fbdf97..09a9619 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 _0xe36a=['then','destroy','error','stack','name','index','map','SugarcrmField','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x29e267,_0x428955){var _0x3fb655=function(_0x49c599){while(--_0x49c599){_0x29e267['push'](_0x29e267['shift']());}};_0x3fb655(++_0x428955);}(_0xe36a,0x13a));var _0xae36=function(_0x580730,_0x423233){_0x580730=_0x580730-0x0;var _0xf5629a=_0xe36a[_0x580730];return _0xf5629a;};'use strict';var emlformat=require(_0xae36('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xae36('0x1'));var jsonpatch=require(_0xae36('0x2'));var rp=require('request-promise');var moment=require(_0xae36('0x3'));var BPromise=require(_0xae36('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xae36('0x5'));var sox=require(_0xae36('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae36('0x7'));var squel=require(_0xae36('0x8'));var crypto=require(_0xae36('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xae36('0xa'));var toCsv=require(_0xae36('0xb'));var querystring=require(_0xae36('0xc'));var Papa=require(_0xae36('0xd'));var Redis=require(_0xae36('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xae36('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae36('0x10'));var logger=require(_0xae36('0x11'))(_0xae36('0x12'));var utils=require(_0xae36('0x13'));var config=require(_0xae36('0x14'));var licenseUtil=require(_0xae36('0x15'));var db=require(_0xae36('0x16'))['db'];function respondWithStatusCode(_0x2e1110,_0x218a28){_0x218a28=_0x218a28||0xcc;return function(_0x261a44){if(_0x261a44){return _0x2e1110[_0xae36('0x17')](_0x218a28);}return _0x2e1110['status'](_0x218a28)[_0xae36('0x18')]();};}function respondWithResult(_0x2ee79a,_0x30de1f){_0x30de1f=_0x30de1f||0xc8;return function(_0x4c7e08){if(_0x4c7e08){return _0x2ee79a[_0xae36('0x19')](_0x30de1f)[_0xae36('0x1a')](_0x4c7e08);}};}function respondWithFilteredResult(_0x14e572,_0x4d17b4){return function(_0x5f0611){if(_0x5f0611){var _0x3e4fd8=typeof _0x4d17b4[_0xae36('0x1b')]===_0xae36('0x1c')&&typeof _0x4d17b4[_0xae36('0x1d')]===_0xae36('0x1c');var _0x13dd41=_0x5f0611[_0xae36('0x1e')];var _0x17aca1=_0x3e4fd8?0x0:_0x4d17b4[_0xae36('0x1b')];var _0x4c3fa4=_0x3e4fd8?_0x5f0611[_0xae36('0x1e')]:_0x4d17b4[_0xae36('0x1b')]+_0x4d17b4[_0xae36('0x1d')];var _0x1c2878;if(_0x4c3fa4>=_0x13dd41){_0x4c3fa4=_0x13dd41;_0x1c2878=0xc8;}else{_0x1c2878=0xce;}_0x14e572[_0xae36('0x19')](_0x1c2878);return _0x14e572[_0xae36('0x1f')](_0xae36('0x20'),_0x17aca1+'-'+_0x4c3fa4+'/'+_0x13dd41)[_0xae36('0x1a')](_0x5f0611);}return null;};}function patchUpdates(_0x3425a0){return function(_0x42dd31){try{jsonpatch[_0xae36('0x21')](_0x42dd31,_0x3425a0,!![]);}catch(_0x3554ac){return BPromise[_0xae36('0x22')](_0x3554ac);}return _0x42dd31[_0xae36('0x23')]();};}function saveUpdates(_0x342d21,_0x51f9c3){return function(_0xd934b2){if(_0xd934b2){return _0xd934b2['update'](_0x342d21)[_0xae36('0x24')](function(_0x556f09){return _0x556f09;});}return null;};}function removeEntity(_0x29da0d,_0x3d8265){return function(_0x136280){if(_0x136280){return _0x136280[_0xae36('0x25')]()[_0xae36('0x24')](function(){_0x29da0d[_0xae36('0x19')](0xcc)[_0xae36('0x18')]();});}};}function handleEntityNotFound(_0x38b705,_0x3f280c){return function(_0x363739){if(!_0x363739){_0x38b705['sendStatus'](0x194);}return _0x363739;};}function handleError(_0x425b54,_0x2c7874){_0x2c7874=_0x2c7874||0x1f4;return function(_0x218dea){logger[_0xae36('0x26')](_0x218dea[_0xae36('0x27')]);if(_0x218dea[_0xae36('0x28')]){delete _0x218dea['name'];}_0x425b54[_0xae36('0x19')](_0x2c7874)['send'](_0x218dea);};}exports[_0xae36('0x29')]=function(_0x45d6a8,_0x2bb733){var _0x14db32={},_0x302d14={},_0x13cb1f={'count':0x0,'rows':[]};var _0x580fb4=_[_0xae36('0x2a')](db[_0xae36('0x2b')]['rawAttributes'],function(_0x4c089f){return{'name':_0x4c089f['fieldName'],'type':_0x4c089f[_0xae36('0x2c')][_0xae36('0x2d')]};});_0x302d14[_0xae36('0x2e')]=_[_0xae36('0x2a')](_0x580fb4,_0xae36('0x28'));_0x302d14[_0xae36('0x2f')]=_[_0xae36('0x30')](_0x45d6a8[_0xae36('0x2f')]);_0x302d14[_0xae36('0x31')]=_[_0xae36('0x32')](_0x302d14['model'],_0x302d14[_0xae36('0x2f')]);_0x14db32[_0xae36('0x33')]=_['intersection'](_0x302d14[_0xae36('0x2e')],qs[_0xae36('0x34')](_0x45d6a8['query'][_0xae36('0x34')]));_0x14db32[_0xae36('0x33')]=_0x14db32[_0xae36('0x33')][_0xae36('0x35')]?_0x14db32[_0xae36('0x33')]:_0x302d14[_0xae36('0x2e')];if(!_0x45d6a8[_0xae36('0x2f')][_0xae36('0x36')](_0xae36('0x37'))){_0x14db32[_0xae36('0x1d')]=qs[_0xae36('0x1d')](_0x45d6a8[_0xae36('0x2f')][_0xae36('0x1d')]);_0x14db32[_0xae36('0x1b')]=qs['offset'](_0x45d6a8['query']['offset']);}_0x14db32[_0xae36('0x38')]=qs[_0xae36('0x39')](_0x45d6a8[_0xae36('0x2f')][_0xae36('0x39')]);_0x14db32[_0xae36('0x3a')]=qs[_0xae36('0x31')](_['pick'](_0x45d6a8[_0xae36('0x2f')],_0x302d14[_0xae36('0x31')]),_0x580fb4);if(_0x45d6a8[_0xae36('0x2f')]['filter']){_0x14db32[_0xae36('0x3a')]=_[_0xae36('0x3b')](_0x14db32['where'],{'$or':_[_0xae36('0x2a')](_0x580fb4,function(_0x24ce4b){if(_0x24ce4b[_0xae36('0x2c')]!=='VIRTUAL'){var _0x6e5e7b={};_0x6e5e7b[_0x24ce4b[_0xae36('0x28')]]={'$like':'%'+_0x45d6a8[_0xae36('0x2f')]['filter']+'%'};return _0x6e5e7b;}})});}_0x14db32=_['merge']({},_0x14db32,_0x45d6a8[_0xae36('0x3c')]);var _0x13dd8b={'where':_0x14db32[_0xae36('0x3a')]};return db[_0xae36('0x2b')]['count'](_0x13dd8b)['then'](function(_0xb9bb47){_0x13cb1f[_0xae36('0x1e')]=_0xb9bb47;if(_0x45d6a8[_0xae36('0x2f')][_0xae36('0x3d')]){_0x14db32[_0xae36('0x3e')]=[{'all':!![]}];}return db[_0xae36('0x2b')][_0xae36('0x3f')](_0x14db32);})[_0xae36('0x24')](function(_0x789406){_0x13cb1f[_0xae36('0x40')]=_0x789406;return _0x13cb1f;})[_0xae36('0x24')](respondWithFilteredResult(_0x2bb733,_0x14db32))[_0xae36('0x41')](handleError(_0x2bb733,null));};exports['show']=function(_0x598ffa,_0x2cb946){var _0x2260fa={'raw':!![],'where':{'id':_0x598ffa[_0xae36('0x42')]['id']}},_0x253cfe={};_0x253cfe['model']=_[_0xae36('0x30')](db['SugarcrmField']['rawAttributes']);_0x253cfe[_0xae36('0x2f')]=_['keys'](_0x598ffa[_0xae36('0x2f')]);_0x253cfe[_0xae36('0x31')]=_[_0xae36('0x32')](_0x253cfe[_0xae36('0x2e')],_0x253cfe[_0xae36('0x2f')]);_0x2260fa[_0xae36('0x33')]=_[_0xae36('0x32')](_0x253cfe[_0xae36('0x2e')],qs['fields'](_0x598ffa['query'][_0xae36('0x34')]));_0x2260fa[_0xae36('0x33')]=_0x2260fa['attributes'][_0xae36('0x35')]?_0x2260fa[_0xae36('0x33')]:_0x253cfe[_0xae36('0x2e')];if(_0x598ffa[_0xae36('0x2f')][_0xae36('0x3d')]){_0x2260fa[_0xae36('0x3e')]=[{'all':!![]}];}_0x2260fa=_[_0xae36('0x3b')]({},_0x2260fa,_0x598ffa[_0xae36('0x3c')]);return db[_0xae36('0x2b')][_0xae36('0x43')](_0x2260fa)[_0xae36('0x24')](handleEntityNotFound(_0x2cb946,null))[_0xae36('0x24')](respondWithResult(_0x2cb946,null))['catch'](handleError(_0x2cb946,null));};exports['create']=function(_0x3dfb0a,_0x3b94d7){return db[_0xae36('0x2b')][_0xae36('0x44')](_0x3dfb0a[_0xae36('0x45')],{})[_0xae36('0x24')](respondWithResult(_0x3b94d7,0xc9))['catch'](handleError(_0x3b94d7,null));};exports['update']=function(_0x379951,_0x32dc8f){if(_0x379951[_0xae36('0x45')]['id']){delete _0x379951[_0xae36('0x45')]['id'];}return db['SugarcrmField'][_0xae36('0x43')]({'where':{'id':_0x379951[_0xae36('0x42')]['id']}})[_0xae36('0x24')](handleEntityNotFound(_0x32dc8f,null))[_0xae36('0x24')](saveUpdates(_0x379951['body'],null))[_0xae36('0x24')](respondWithResult(_0x32dc8f,null))['catch'](handleError(_0x32dc8f,null));};exports[_0xae36('0x25')]=function(_0x3c253c,_0x326ede){return db[_0xae36('0x2b')][_0xae36('0x43')]({'where':{'id':_0x3c253c[_0xae36('0x42')]['id']}})[_0xae36('0x24')](handleEntityNotFound(_0x326ede,null))[_0xae36('0x24')](removeEntity(_0x326ede,null))[_0xae36('0x41')](handleError(_0x326ede,null));}; \ No newline at end of file +var _0x06a4=['model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','length','find','catch','create','body','destroy','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','reject','save','update','then','error','stack','name','index','SugarcrmField','fieldName','type','key'];(function(_0x1eedbb,_0x20faa2){var _0x2e1030=function(_0x5d00b9){while(--_0x5d00b9){_0x1eedbb['push'](_0x1eedbb['shift']());}};_0x2e1030(++_0x20faa2);}(_0x06a4,0x1f2));var _0x406a=function(_0x572644,_0x543d79){_0x572644=_0x572644-0x0;var _0x17efa9=_0x06a4[_0x572644];return _0x17efa9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x406a('0x0'));var rp=require(_0x406a('0x1'));var moment=require(_0x406a('0x2'));var BPromise=require(_0x406a('0x3'));var Mustache=require(_0x406a('0x4'));var util=require(_0x406a('0x5'));var path=require(_0x406a('0x6'));var sox=require('sox');var csv=require(_0x406a('0x7'));var ejs=require(_0x406a('0x8'));var fs=require('fs');var fs_extra=require(_0x406a('0x9'));var _=require(_0x406a('0xa'));var squel=require(_0x406a('0xb'));var crypto=require(_0x406a('0xc'));var jsforce=require(_0x406a('0xd'));var deskjs=require(_0x406a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x406a('0xf'));var Papa=require(_0x406a('0x10'));var Redis=require('ioredis');var authService=require(_0x406a('0x11'));var qs=require(_0x406a('0x12'));var as=require(_0x406a('0x13'));var hardwareService=require(_0x406a('0x14'));var logger=require(_0x406a('0x15'))(_0x406a('0x16'));var utils=require(_0x406a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x406a('0x18'));var db=require(_0x406a('0x19'))['db'];function respondWithStatusCode(_0x352a2b,_0x28c884){_0x28c884=_0x28c884||0xcc;return function(_0x935c39){if(_0x935c39){return _0x352a2b[_0x406a('0x1a')](_0x28c884);}return _0x352a2b['status'](_0x28c884)[_0x406a('0x1b')]();};}function respondWithResult(_0x1bb6be,_0x2c86f6){_0x2c86f6=_0x2c86f6||0xc8;return function(_0x25edb4){if(_0x25edb4){return _0x1bb6be['status'](_0x2c86f6)[_0x406a('0x1c')](_0x25edb4);}};}function respondWithFilteredResult(_0x902852,_0x30e1b4){return function(_0x575147){if(_0x575147){var _0x3aa821=typeof _0x30e1b4[_0x406a('0x1d')]==='undefined'&&typeof _0x30e1b4[_0x406a('0x1e')]===_0x406a('0x1f');var _0x448a88=_0x575147[_0x406a('0x20')];var _0x59d3ed=_0x3aa821?0x0:_0x30e1b4[_0x406a('0x1d')];var _0x2f9304=_0x3aa821?_0x575147['count']:_0x30e1b4[_0x406a('0x1d')]+_0x30e1b4[_0x406a('0x1e')];var _0x1491a4;if(_0x2f9304>=_0x448a88){_0x2f9304=_0x448a88;_0x1491a4=0xc8;}else{_0x1491a4=0xce;}_0x902852[_0x406a('0x21')](_0x1491a4);return _0x902852[_0x406a('0x22')](_0x406a('0x23'),_0x59d3ed+'-'+_0x2f9304+'/'+_0x448a88)['json'](_0x575147);}return null;};}function patchUpdates(_0x39be60){return function(_0xc95a76){try{jsonpatch['apply'](_0xc95a76,_0x39be60,!![]);}catch(_0x3fc6b0){return BPromise[_0x406a('0x24')](_0x3fc6b0);}return _0xc95a76[_0x406a('0x25')]();};}function saveUpdates(_0xd24ae8,_0x5403da){return function(_0x418f43){if(_0x418f43){return _0x418f43[_0x406a('0x26')](_0xd24ae8)[_0x406a('0x27')](function(_0x5b66){return _0x5b66;});}return null;};}function removeEntity(_0x3d8a0e,_0x3957d2){return function(_0x47ba3a){if(_0x47ba3a){return _0x47ba3a['destroy']()[_0x406a('0x27')](function(){_0x3d8a0e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x230362,_0x2b6e0a){return function(_0x3f62b1){if(!_0x3f62b1){_0x230362[_0x406a('0x1a')](0x194);}return _0x3f62b1;};}function handleError(_0xea86fb,_0x336eb9){_0x336eb9=_0x336eb9||0x1f4;return function(_0x41c6ba){logger[_0x406a('0x28')](_0x41c6ba[_0x406a('0x29')]);if(_0x41c6ba['name']){delete _0x41c6ba[_0x406a('0x2a')];}_0xea86fb[_0x406a('0x21')](_0x336eb9)['send'](_0x41c6ba);};}exports[_0x406a('0x2b')]=function(_0x3ce36c,_0x242a88){var _0xa07150={},_0x6ae423={},_0xf7ec68={'count':0x0,'rows':[]};var _0x1c7168=_['map'](db[_0x406a('0x2c')]['rawAttributes'],function(_0x5ecd8f){return{'name':_0x5ecd8f[_0x406a('0x2d')],'type':_0x5ecd8f[_0x406a('0x2e')][_0x406a('0x2f')]};});_0x6ae423[_0x406a('0x30')]=_[_0x406a('0x31')](_0x1c7168,_0x406a('0x2a'));_0x6ae423[_0x406a('0x32')]=_[_0x406a('0x33')](_0x3ce36c[_0x406a('0x32')]);_0x6ae423[_0x406a('0x34')]=_[_0x406a('0x35')](_0x6ae423[_0x406a('0x30')],_0x6ae423[_0x406a('0x32')]);_0xa07150['attributes']=_[_0x406a('0x35')](_0x6ae423[_0x406a('0x30')],qs['fields'](_0x3ce36c[_0x406a('0x32')][_0x406a('0x36')]));_0xa07150[_0x406a('0x37')]=_0xa07150[_0x406a('0x37')]['length']?_0xa07150[_0x406a('0x37')]:_0x6ae423[_0x406a('0x30')];if(!_0x3ce36c[_0x406a('0x32')][_0x406a('0x38')](_0x406a('0x39'))){_0xa07150[_0x406a('0x1e')]=qs[_0x406a('0x1e')](_0x3ce36c['query'][_0x406a('0x1e')]);_0xa07150[_0x406a('0x1d')]=qs[_0x406a('0x1d')](_0x3ce36c[_0x406a('0x32')][_0x406a('0x1d')]);}_0xa07150[_0x406a('0x3a')]=qs[_0x406a('0x3b')](_0x3ce36c[_0x406a('0x32')][_0x406a('0x3b')]);_0xa07150['where']=qs[_0x406a('0x34')](_[_0x406a('0x3c')](_0x3ce36c[_0x406a('0x32')],_0x6ae423['filters']),_0x1c7168);if(_0x3ce36c['query'][_0x406a('0x3d')]){_0xa07150[_0x406a('0x3e')]=_[_0x406a('0x3f')](_0xa07150['where'],{'$or':_[_0x406a('0x31')](_0x1c7168,function(_0x2ad539){if(_0x2ad539[_0x406a('0x2e')]!==_0x406a('0x40')){var _0x286762={};_0x286762[_0x2ad539['name']]={'$like':'%'+_0x3ce36c[_0x406a('0x32')][_0x406a('0x3d')]+'%'};return _0x286762;}})});}_0xa07150=_[_0x406a('0x3f')]({},_0xa07150,_0x3ce36c[_0x406a('0x41')]);var _0x1db536={'where':_0xa07150[_0x406a('0x3e')]};return db['SugarcrmField'][_0x406a('0x20')](_0x1db536)[_0x406a('0x27')](function(_0x277a1a){_0xf7ec68['count']=_0x277a1a;if(_0x3ce36c['query'][_0x406a('0x42')]){_0xa07150[_0x406a('0x43')]=[{'all':!![]}];}return db[_0x406a('0x2c')][_0x406a('0x44')](_0xa07150);})[_0x406a('0x27')](function(_0xd5ffc){_0xf7ec68[_0x406a('0x45')]=_0xd5ffc;return _0xf7ec68;})[_0x406a('0x27')](respondWithFilteredResult(_0x242a88,_0xa07150))['catch'](handleError(_0x242a88,null));};exports['show']=function(_0x1c19e0,_0x5a64f9){var _0x3d484d={'raw':!![],'where':{'id':_0x1c19e0[_0x406a('0x46')]['id']}},_0x3fb75c={};_0x3fb75c[_0x406a('0x30')]=_[_0x406a('0x33')](db[_0x406a('0x2c')][_0x406a('0x47')]);_0x3fb75c['query']=_['keys'](_0x1c19e0[_0x406a('0x32')]);_0x3fb75c[_0x406a('0x34')]=_[_0x406a('0x35')](_0x3fb75c[_0x406a('0x30')],_0x3fb75c[_0x406a('0x32')]);_0x3d484d['attributes']=_[_0x406a('0x35')](_0x3fb75c[_0x406a('0x30')],qs[_0x406a('0x36')](_0x1c19e0[_0x406a('0x32')][_0x406a('0x36')]));_0x3d484d[_0x406a('0x37')]=_0x3d484d[_0x406a('0x37')][_0x406a('0x48')]?_0x3d484d['attributes']:_0x3fb75c[_0x406a('0x30')];if(_0x1c19e0[_0x406a('0x32')][_0x406a('0x42')]){_0x3d484d['include']=[{'all':!![]}];}_0x3d484d=_[_0x406a('0x3f')]({},_0x3d484d,_0x1c19e0['options']);return db[_0x406a('0x2c')][_0x406a('0x49')](_0x3d484d)[_0x406a('0x27')](handleEntityNotFound(_0x5a64f9,null))[_0x406a('0x27')](respondWithResult(_0x5a64f9,null))[_0x406a('0x4a')](handleError(_0x5a64f9,null));};exports[_0x406a('0x4b')]=function(_0x230b55,_0x522cc5){return db[_0x406a('0x2c')][_0x406a('0x4b')](_0x230b55['body'],{})[_0x406a('0x27')](respondWithResult(_0x522cc5,0xc9))[_0x406a('0x4a')](handleError(_0x522cc5,null));};exports['update']=function(_0x474804,_0x3f6e0f){if(_0x474804['body']['id']){delete _0x474804['body']['id'];}return db[_0x406a('0x2c')]['find']({'where':{'id':_0x474804[_0x406a('0x46')]['id']}})[_0x406a('0x27')](handleEntityNotFound(_0x3f6e0f,null))[_0x406a('0x27')](saveUpdates(_0x474804[_0x406a('0x4c')],null))[_0x406a('0x27')](respondWithResult(_0x3f6e0f,null))[_0x406a('0x4a')](handleError(_0x3f6e0f,null));};exports[_0x406a('0x4d')]=function(_0x5c3db8,_0x206b0c){return db[_0x406a('0x2c')][_0x406a('0x49')]({'where':{'id':_0x5c3db8[_0x406a('0x46')]['id']}})[_0x406a('0x27')](handleEntityNotFound(_0x206b0c,null))[_0x406a('0x27')](removeEntity(_0x206b0c,null))[_0x406a('0x4a')](handleError(_0x206b0c,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 74d9b24..cf4656b 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 _0x4cb8=['api','moment','bluebird','request-promise','./intSugarcrmField.attributes','define','SugarcrmField','int_sugarcrm_fields','idField','FieldId','lodash','util','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4cb8,0xcd));var _0x84cb=function(_0x55ec1e,_0x30c76e){_0x55ec1e=_0x55ec1e-0x0;var _0x21d443=_0x4cb8[_0x55ec1e];return _0x21d443;};'use strict';var _=require(_0x84cb('0x0'));var util=require(_0x84cb('0x1'));var logger=require(_0x84cb('0x2'))(_0x84cb('0x3'));var moment=require(_0x84cb('0x4'));var BPromise=require(_0x84cb('0x5'));var rp=require(_0x84cb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x84cb('0x7'));module['exports']=function(_0x8722b6,_0x1ffb2b){return _0x8722b6[_0x84cb('0x8')](_0x84cb('0x9'),attributes,{'tableName':_0x84cb('0xa'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x84cb('0xb'),_0x84cb('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd142=['define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','util','api','moment','bluebird','request-promise','rimraf','./intSugarcrmField.attributes','exports'];(function(_0x5a9d2b,_0x64b8b8){var _0x55a4a5=function(_0x589406){while(--_0x589406){_0x5a9d2b['push'](_0x5a9d2b['shift']());}};_0x55a4a5(++_0x64b8b8);}(_0xd142,0xef));var _0x2d14=function(_0x3cac61,_0x62fed0){_0x3cac61=_0x3cac61-0x0;var _0x570b82=_0xd142[_0x3cac61];return _0x570b82;};'use strict';var _=require('lodash');var util=require(_0x2d14('0x0'));var logger=require('../../config/logger')(_0x2d14('0x1'));var moment=require(_0x2d14('0x2'));var BPromise=require(_0x2d14('0x3'));var rp=require(_0x2d14('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2d14('0x5'));var config=require('../../config/environment');var attributes=require(_0x2d14('0x6'));module[_0x2d14('0x7')]=function(_0x396415,_0x128f22){return _0x396415[_0x2d14('0x8')](_0x2d14('0x9'),attributes,{'tableName':_0x2d14('0xa'),'paranoid':![],'indexes':[{'name':_0x2d14('0xb'),'fields':['idField',_0x2d14('0xc')],'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 003f625..3767296 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 _0x819c=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','code','error','SugarcrmField,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x34bc9f,_0x289840){var _0x170d91=function(_0x51d279){while(--_0x51d279){_0x34bc9f['push'](_0x34bc9f['shift']());}};_0x170d91(++_0x289840);}(_0x819c,0x172));var _0xc819=function(_0x4b3489,_0x23ee4a){_0x4b3489=_0x4b3489-0x0;var _0xa61ed7=_0x819c[_0x4b3489];return _0xa61ed7;};'use strict';var _=require(_0xc819('0x0'));var util=require(_0xc819('0x1'));var moment=require(_0xc819('0x2'));var BPromise=require(_0xc819('0x3'));var rs=require(_0xc819('0x4'));var fs=require('fs');var Redis=require(_0xc819('0x5'));var db=require(_0xc819('0x6'))['db'];var utils=require(_0xc819('0x7'));var logger=require(_0xc819('0x8'))(_0xc819('0x9'));var config=require(_0xc819('0xa'));var jayson=require(_0xc819('0xb'));var client=jayson[_0xc819('0xc')][_0xc819('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x464230,_0xcf0294,_0x59dced){return new BPromise(function(_0x2145ea,_0x11ea71){return client[_0xc819('0xe')](_0x464230,_0x59dced)['then'](function(_0x2b1181){logger[_0xc819('0xf')]('SugarcrmField,\x20%s,\x20%s',_0xcf0294,_0xc819('0x10'));logger[_0xc819('0x11')](_0xc819('0x12'),_0xcf0294,_0xc819('0x10'),JSON[_0xc819('0x13')](_0x2b1181));if(_0x2b1181['error']){if(_0x2b1181['error'][_0xc819('0x14')]===0x1f4){logger[_0xc819('0x15')](_0xc819('0x16'),_0xcf0294,_0x2b1181['error'][_0xc819('0x17')]);return _0x11ea71(_0x2b1181['error'][_0xc819('0x17')]);}logger[_0xc819('0x15')]('SugarcrmField,\x20%s,\x20%s',_0xcf0294,_0x2b1181[_0xc819('0x15')][_0xc819('0x17')]);return _0x2145ea(_0x2b1181[_0xc819('0x15')]['message']);}else{logger[_0xc819('0xf')](_0xc819('0x16'),_0xcf0294,_0xc819('0x10'));_0x2145ea(_0x2b1181[_0xc819('0x18')]['message']);}})['catch'](function(_0x3050d1){logger['error']('SugarcrmField,\x20%s,\x20%s',_0xcf0294,_0x3050d1);_0x11ea71(_0x3050d1);});});} \ No newline at end of file +var _0x7892=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x50d966,_0x2e9b8c){var _0x5393e9=function(_0x52e4fc){while(--_0x52e4fc){_0x50d966['push'](_0x50d966['shift']());}};_0x5393e9(++_0x2e9b8c);}(_0x7892,0x67));var _0x2789=function(_0x327d7a,_0x1b7157){_0x327d7a=_0x327d7a-0x0;var _0x3dfce7=_0x7892[_0x327d7a];return _0x3dfce7;};'use strict';var _=require(_0x2789('0x0'));var util=require(_0x2789('0x1'));var moment=require(_0x2789('0x2'));var BPromise=require(_0x2789('0x3'));var rs=require(_0x2789('0x4'));var fs=require('fs');var Redis=require(_0x2789('0x5'));var db=require(_0x2789('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2789('0x7'))(_0x2789('0x8'));var config=require(_0x2789('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3b4717,_0x43844a,_0x39b91a){return new BPromise(function(_0xf315e7,_0x335eb8){return client[_0x2789('0xa')](_0x3b4717,_0x39b91a)['then'](function(_0x4970bf){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x43844a,_0x2789('0xb'));logger[_0x2789('0xc')](_0x2789('0xd'),_0x43844a,_0x2789('0xb'),JSON[_0x2789('0xe')](_0x4970bf));if(_0x4970bf[_0x2789('0xf')]){if(_0x4970bf[_0x2789('0xf')][_0x2789('0x10')]===0x1f4){logger[_0x2789('0xf')](_0x2789('0x11'),_0x43844a,_0x4970bf[_0x2789('0xf')][_0x2789('0x12')]);return _0x335eb8(_0x4970bf['error']['message']);}logger[_0x2789('0xf')](_0x2789('0x11'),_0x43844a,_0x4970bf[_0x2789('0xf')][_0x2789('0x12')]);return _0xf315e7(_0x4970bf[_0x2789('0xf')]['message']);}else{logger['info'](_0x2789('0x11'),_0x43844a,'request\x20sent');_0xf315e7(_0x4970bf[_0x2789('0x13')][_0x2789('0x12')]);}})[_0x2789('0x14')](function(_0x1ef056){logger['error'](_0x2789('0x11'),_0x43844a,_0x1ef056);_0x335eb8(_0x1ef056);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 999540f..49b0d73 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 _0xbb94=['delete','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','create','post','put','update'];(function(_0x207d2f,_0x44400f){var _0x3c3498=function(_0x57fdfb){while(--_0x57fdfb){_0x207d2f['push'](_0x207d2f['shift']());}};_0x3c3498(++_0x44400f);}(_0xbb94,0xde));var _0x4bb9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbb94[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4bb9('0x0'));var timeout=require('connect-timeout');var express=require(_0x4bb9('0x1'));var router=express[_0x4bb9('0x2')]();var fs_extra=require(_0x4bb9('0x3'));var auth=require(_0x4bb9('0x4'));var interaction=require(_0x4bb9('0x5'));var config=require(_0x4bb9('0x6'));var controller=require(_0x4bb9('0x7'));router[_0x4bb9('0x8')]('/',auth[_0x4bb9('0x9')](),controller['index']);router[_0x4bb9('0x8')](_0x4bb9('0xa'),auth[_0x4bb9('0x9')](),controller['show']);router[_0x4bb9('0x8')](_0x4bb9('0xb'),auth['isAuthenticated'](),controller[_0x4bb9('0xc')]);router['get'](_0x4bb9('0xd'),auth[_0x4bb9('0x9')](),controller['getFields']);router['post']('/',auth[_0x4bb9('0x9')](),controller[_0x4bb9('0xe')]);router[_0x4bb9('0xf')](_0x4bb9('0xb'),auth[_0x4bb9('0x9')](),controller['addConfiguration']);router[_0x4bb9('0x10')]('/:id',auth[_0x4bb9('0x9')](),controller[_0x4bb9('0x11')]);router[_0x4bb9('0x12')](_0x4bb9('0xa'),auth[_0x4bb9('0x9')](),controller['destroy']);module[_0x4bb9('0x13')]=router; \ No newline at end of file +var _0xac8b=['../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5b932c,_0x13e10b){var _0x253ff9=function(_0x5b3136){while(--_0x5b3136){_0x5b932c['push'](_0x5b932c['shift']());}};_0x253ff9(++_0x13e10b);}(_0xac8b,0x1c2));var _0xbac8=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xac8b[_0x1abb09];return _0xea1c07;};'use strict';var multer=require('multer');var util=require(_0xbac8('0x0'));var path=require(_0xbac8('0x1'));var timeout=require('connect-timeout');var express=require(_0xbac8('0x2'));var router=express[_0xbac8('0x3')]();var fs_extra=require(_0xbac8('0x4'));var auth=require(_0xbac8('0x5'));var interaction=require(_0xbac8('0x6'));var config=require(_0xbac8('0x7'));var controller=require(_0xbac8('0x8'));router[_0xbac8('0x9')]('/',auth[_0xbac8('0xa')](),controller[_0xbac8('0xb')]);router[_0xbac8('0x9')](_0xbac8('0xc'),auth[_0xbac8('0xa')](),controller['show']);router[_0xbac8('0x9')](_0xbac8('0xd'),auth[_0xbac8('0xa')](),controller[_0xbac8('0xe')]);router[_0xbac8('0x9')](_0xbac8('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0xbac8('0x10')]('/',auth['isAuthenticated'](),controller[_0xbac8('0x11')]);router[_0xbac8('0x10')](_0xbac8('0xd'),auth[_0xbac8('0xa')](),controller[_0xbac8('0x12')]);router[_0xbac8('0x13')](_0xbac8('0xc'),auth[_0xbac8('0xa')](),controller[_0xbac8('0x14')]);router[_0xbac8('0x15')](_0xbac8('0xc'),auth[_0xbac8('0xa')](),controller[_0xbac8('0x16')]);module[_0xbac8('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index ba96eca..429c60d 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 _0xdd6b=['HelpDesk','sequelize','exports','STRING'];(function(_0x5e0849,_0x36a3f0){var _0x13ccbf=function(_0x10b951){while(--_0x10b951){_0x5e0849['push'](_0x5e0849['shift']());}};_0x13ccbf(++_0x36a3f0);}(_0xdd6b,0x16d));var _0xbdd6=function(_0x3443a9,_0x3aab5e){_0x3443a9=_0x3443a9-0x0;var _0x525265=_0xdd6b[_0x3443a9];return _0x525265;};'use strict';var Sequelize=require(_0xbdd6('0x0'));module[_0xbdd6('0x1')]={'name':{'type':Sequelize[_0xbdd6('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xbdd6('0x2')],'allowNull':![],'defaultValue':_0xbdd6('0x3')},'remoteUri':{'type':Sequelize[_0xbdd6('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xbdd6('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xbdd6('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x95b0=['exports','STRING','HelpDesk','sequelize'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x95b0,0x157));var _0x095b=function(_0x41c236,_0x121047){_0x41c236=_0x41c236-0x0;var _0x370d59=_0x95b0[_0x41c236];return _0x370d59;};'use strict';var Sequelize=require(_0x095b('0x0'));module[_0x095b('0x1')]={'name':{'type':Sequelize[_0x095b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x095b('0x2')]},'username':{'type':Sequelize[_0x095b('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x095b('0x2')],'allowNull':![],'defaultValue':_0x095b('0x3')},'remoteUri':{'type':Sequelize[_0x095b('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x095b('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x095b('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 32ce459..d719885 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 _0x02aa=['rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','offset','limit','count','set','apply','reject','save','then','destroy','end','error','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','options','includeAll','include','rows','show','params','find','catch','create','update','body','getConfigurations','findOne','nolimit','AccountId','getSubjects','channel','getDescriptions','VtigerConfiguration','Subjects','md5','getFields','description','moduleName','remoteUri','serverUrl','username','slice','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','token','describe','sessionName','autogenerated','owner','remove','includes','editable','false','label','startsWith','picklist','picklistValues','value','vTiger\x20error:\x20','statusCode','stringify','test','Wrong\x20credentials'];(function(_0x117f18,_0x43cb2b){var _0x2d04e6=function(_0x15f1f7){while(--_0x15f1f7){_0x117f18['push'](_0x117f18['shift']());}};_0x2d04e6(++_0x43cb2b);}(_0x02aa,0x1cc));var _0xa02a=function(_0xde1b5,_0x291eca){_0xde1b5=_0xde1b5-0x0;var _0x52cd92=_0x02aa[_0xde1b5];return _0x52cd92;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa02a('0x0'));var zipdir=require(_0xa02a('0x1'));var jsonpatch=require(_0xa02a('0x2'));var rp=require('request-promise');var moment=require(_0xa02a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa02a('0x4'));var util=require(_0xa02a('0x5'));var path=require(_0xa02a('0x6'));var sox=require(_0xa02a('0x7'));var csv=require(_0xa02a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa02a('0x9'));var crypto=require(_0xa02a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa02a('0xb'));var toCsv=require(_0xa02a('0x8'));var querystring=require('querystring');var Papa=require(_0xa02a('0xc'));var Redis=require(_0xa02a('0xd'));var authService=require(_0xa02a('0xe'));var qs=require(_0xa02a('0xf'));var as=require(_0xa02a('0x10'));var hardwareService=require(_0xa02a('0x11'));var logger=require('../../config/logger')(_0xa02a('0x12'));var utils=require(_0xa02a('0x13'));var config=require(_0xa02a('0x14'));var licenseUtil=require(_0xa02a('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa02a('0x16'));function respondWithStatusCode(_0x1dc47d,_0x244034){_0x244034=_0x244034||0xcc;return function(_0x2cd1bc){if(_0x2cd1bc){return _0x1dc47d[_0xa02a('0x17')](_0x244034);}return _0x1dc47d[_0xa02a('0x18')](_0x244034)['end']();};}function respondWithResult(_0x5b2979,_0xdd5623){_0xdd5623=_0xdd5623||0xc8;return function(_0x155676){if(_0x155676){return _0x5b2979[_0xa02a('0x18')](_0xdd5623)['json'](_0x155676);}};}function respondWithFilteredResult(_0x5ed773,_0x321c14){return function(_0x1ff189){if(_0x1ff189){var _0x98e2d5=typeof _0x321c14[_0xa02a('0x19')]==='undefined'&&typeof _0x321c14[_0xa02a('0x1a')]==='undefined';var _0x253ff6=_0x1ff189['count'];var _0x581e1d=_0x98e2d5?0x0:_0x321c14[_0xa02a('0x19')];var _0x1db9bc=_0x98e2d5?_0x1ff189[_0xa02a('0x1b')]:_0x321c14[_0xa02a('0x19')]+_0x321c14[_0xa02a('0x1a')];var _0x41f33e;if(_0x1db9bc>=_0x253ff6){_0x1db9bc=_0x253ff6;_0x41f33e=0xc8;}else{_0x41f33e=0xce;}_0x5ed773[_0xa02a('0x18')](_0x41f33e);return _0x5ed773[_0xa02a('0x1c')]('Content-Range',_0x581e1d+'-'+_0x1db9bc+'/'+_0x253ff6)['json'](_0x1ff189);}return null;};}function patchUpdates(_0x1be383){return function(_0x31e570){try{jsonpatch[_0xa02a('0x1d')](_0x31e570,_0x1be383,!![]);}catch(_0x351a09){return BPromise[_0xa02a('0x1e')](_0x351a09);}return _0x31e570[_0xa02a('0x1f')]();};}function saveUpdates(_0x527f74,_0xe7a1d7){return function(_0x5af51a){if(_0x5af51a){return _0x5af51a['update'](_0x527f74)[_0xa02a('0x20')](function(_0x865547){return _0x865547;});}return null;};}function removeEntity(_0x33816b,_0x5a7ebf){return function(_0x1f559b){if(_0x1f559b){return _0x1f559b[_0xa02a('0x21')]()[_0xa02a('0x20')](function(){_0x33816b[_0xa02a('0x18')](0xcc)[_0xa02a('0x22')]();});}};}function handleEntityNotFound(_0x3b1b52,_0x11b1ea){return function(_0x157880){if(!_0x157880){_0x3b1b52[_0xa02a('0x17')](0x194);}return _0x157880;};}function handleError(_0x2282fd,_0x21821a){_0x21821a=_0x21821a||0x1f4;return function(_0x4632db){logger[_0xa02a('0x23')](_0x4632db['stack']);if(_0x4632db[_0xa02a('0x24')]){delete _0x4632db[_0xa02a('0x24')];}_0x2282fd[_0xa02a('0x18')](_0x21821a)[_0xa02a('0x25')](_0x4632db);};}exports[_0xa02a('0x26')]=function(_0x596df8,_0x41c59b){var _0x3ca29e={},_0x47eea1={},_0xfed710={'count':0x0,'rows':[]};var _0x28d334=_[_0xa02a('0x27')](db[_0xa02a('0x28')][_0xa02a('0x29')],function(_0x3ff9ed){return{'name':_0x3ff9ed[_0xa02a('0x2a')],'type':_0x3ff9ed[_0xa02a('0x2b')][_0xa02a('0x2c')]};});_0x47eea1[_0xa02a('0x2d')]=_['map'](_0x28d334,_0xa02a('0x24'));_0x47eea1['query']=_[_0xa02a('0x2e')](_0x596df8['query']);_0x47eea1['filters']=_[_0xa02a('0x2f')](_0x47eea1[_0xa02a('0x2d')],_0x47eea1[_0xa02a('0x30')]);_0x3ca29e[_0xa02a('0x31')]=_[_0xa02a('0x2f')](_0x47eea1['model'],qs[_0xa02a('0x32')](_0x596df8[_0xa02a('0x30')][_0xa02a('0x32')]));_0x3ca29e['attributes']=_0x3ca29e['attributes'][_0xa02a('0x33')]?_0x3ca29e[_0xa02a('0x31')]:_0x47eea1[_0xa02a('0x2d')];if(!_0x596df8['query'][_0xa02a('0x34')]('nolimit')){_0x3ca29e[_0xa02a('0x1a')]=qs[_0xa02a('0x1a')](_0x596df8[_0xa02a('0x30')]['limit']);_0x3ca29e['offset']=qs['offset'](_0x596df8[_0xa02a('0x30')][_0xa02a('0x19')]);}_0x3ca29e[_0xa02a('0x35')]=qs[_0xa02a('0x36')](_0x596df8[_0xa02a('0x30')][_0xa02a('0x36')]);_0x3ca29e[_0xa02a('0x37')]=qs['filters'](_[_0xa02a('0x38')](_0x596df8[_0xa02a('0x30')],_0x47eea1[_0xa02a('0x39')]),_0x28d334);if(_0x596df8[_0xa02a('0x30')][_0xa02a('0x3a')]){_0x3ca29e[_0xa02a('0x37')]=_[_0xa02a('0x3b')](_0x3ca29e[_0xa02a('0x37')],{'$or':_[_0xa02a('0x27')](_0x28d334,function(_0x23d3e8){if(_0x23d3e8[_0xa02a('0x2b')]!=='VIRTUAL'){var _0x8cbfb8={};_0x8cbfb8[_0x23d3e8[_0xa02a('0x24')]]={'$like':'%'+_0x596df8[_0xa02a('0x30')][_0xa02a('0x3a')]+'%'};return _0x8cbfb8;}})});}_0x3ca29e=_[_0xa02a('0x3b')]({},_0x3ca29e,_0x596df8[_0xa02a('0x3c')]);var _0x50e9a8={'where':_0x3ca29e[_0xa02a('0x37')]};return db[_0xa02a('0x28')]['count'](_0x50e9a8)[_0xa02a('0x20')](function(_0x462fdd){_0xfed710[_0xa02a('0x1b')]=_0x462fdd;if(_0x596df8[_0xa02a('0x30')][_0xa02a('0x3d')]){_0x3ca29e[_0xa02a('0x3e')]=[{'all':!![]}];}return db[_0xa02a('0x28')]['findAll'](_0x3ca29e);})[_0xa02a('0x20')](function(_0x18d987){_0xfed710[_0xa02a('0x3f')]=_0x18d987;return _0xfed710;})[_0xa02a('0x20')](respondWithFilteredResult(_0x41c59b,_0x3ca29e))['catch'](handleError(_0x41c59b,null));};exports[_0xa02a('0x40')]=function(_0x590ea0,_0x59a407){var _0x4f9994={'raw':![],'where':{'id':_0x590ea0[_0xa02a('0x41')]['id']}},_0x15324e={};_0x15324e['model']=_[_0xa02a('0x2e')](db[_0xa02a('0x28')]['rawAttributes']);_0x15324e[_0xa02a('0x30')]=_[_0xa02a('0x2e')](_0x590ea0['query']);_0x15324e[_0xa02a('0x39')]=_[_0xa02a('0x2f')](_0x15324e[_0xa02a('0x2d')],_0x15324e[_0xa02a('0x30')]);_0x4f9994[_0xa02a('0x31')]=_[_0xa02a('0x2f')](_0x15324e[_0xa02a('0x2d')],qs[_0xa02a('0x32')](_0x590ea0[_0xa02a('0x30')][_0xa02a('0x32')]));_0x4f9994[_0xa02a('0x31')]=_0x4f9994['attributes'][_0xa02a('0x33')]?_0x4f9994[_0xa02a('0x31')]:_0x15324e[_0xa02a('0x2d')];if(_0x590ea0['query'][_0xa02a('0x3d')]){_0x4f9994['include']=[{'all':!![]}];}_0x4f9994=_[_0xa02a('0x3b')]({},_0x4f9994,_0x590ea0[_0xa02a('0x3c')]);return db[_0xa02a('0x28')][_0xa02a('0x42')](_0x4f9994)[_0xa02a('0x20')](handleEntityNotFound(_0x59a407,null))[_0xa02a('0x20')](respondWithResult(_0x59a407,null))[_0xa02a('0x43')](handleError(_0x59a407,null));};exports[_0xa02a('0x44')]=function(_0x1c8989,_0x108f2f){return db[_0xa02a('0x28')][_0xa02a('0x44')](_0x1c8989['body'],{})['then'](respondWithResult(_0x108f2f,0xc9))[_0xa02a('0x43')](handleError(_0x108f2f,null));};exports[_0xa02a('0x45')]=function(_0x43d834,_0x648b01){if(_0x43d834[_0xa02a('0x46')]['id']){delete _0x43d834[_0xa02a('0x46')]['id'];}return db['VtigerAccount'][_0xa02a('0x42')]({'where':{'id':_0x43d834[_0xa02a('0x41')]['id']}})[_0xa02a('0x20')](handleEntityNotFound(_0x648b01,null))[_0xa02a('0x20')](saveUpdates(_0x43d834[_0xa02a('0x46')],null))[_0xa02a('0x20')](respondWithResult(_0x648b01,null))[_0xa02a('0x43')](handleError(_0x648b01,null));};exports[_0xa02a('0x21')]=function(_0x176ba6,_0x6be99c){return db[_0xa02a('0x28')][_0xa02a('0x42')]({'where':{'id':_0x176ba6[_0xa02a('0x41')]['id']}})['then'](handleEntityNotFound(_0x6be99c,null))[_0xa02a('0x20')](removeEntity(_0x6be99c,null))[_0xa02a('0x43')](handleError(_0x6be99c,null));};exports[_0xa02a('0x47')]=function(_0xa95d1f,_0x4accfe,_0x5d5ebb){var _0x3f6cd6={};var _0x49e2d0={};var _0x37a2c0;var _0x3c30a0;return db[_0xa02a('0x28')][_0xa02a('0x48')]({'where':{'id':_0xa95d1f[_0xa02a('0x41')]['id']}})[_0xa02a('0x20')](handleEntityNotFound(_0x4accfe,null))[_0xa02a('0x20')](function(_0x1a91f8){if(_0x1a91f8){_0x37a2c0=_0x1a91f8;_0x49e2d0['model']=_['keys'](db['VtigerConfiguration'][_0xa02a('0x29')]);_0x49e2d0[_0xa02a('0x30')]=_[_0xa02a('0x2e')](_0xa95d1f[_0xa02a('0x30')]);_0x49e2d0[_0xa02a('0x39')]=_[_0xa02a('0x2f')](_0x49e2d0[_0xa02a('0x2d')],_0x49e2d0[_0xa02a('0x30')]);_0x3f6cd6[_0xa02a('0x31')]=_['intersection'](_0x49e2d0['model'],qs[_0xa02a('0x32')](_0xa95d1f['query'][_0xa02a('0x32')]));_0x3f6cd6['attributes']=_0x3f6cd6[_0xa02a('0x31')][_0xa02a('0x33')]?_0x3f6cd6[_0xa02a('0x31')]:_0x49e2d0[_0xa02a('0x2d')];_0x3f6cd6[_0xa02a('0x35')]=qs[_0xa02a('0x36')](_0xa95d1f[_0xa02a('0x30')]['sort']);_0x3f6cd6[_0xa02a('0x37')]=qs[_0xa02a('0x39')](_['pick'](_0xa95d1f[_0xa02a('0x30')],_0x49e2d0[_0xa02a('0x39')]));if(_0xa95d1f[_0xa02a('0x30')]['filter']){_0x3f6cd6[_0xa02a('0x37')]=_['merge'](_0x3f6cd6[_0xa02a('0x37')],{'$or':_['map'](_0x3f6cd6['attributes'],function(_0x498f13){var _0x4dcf77={};_0x4dcf77[_0x498f13]={'$like':'%'+_0xa95d1f[_0xa02a('0x30')][_0xa02a('0x3a')]+'%'};return _0x4dcf77;})});}_0x3f6cd6=_[_0xa02a('0x3b')]({},_0x3f6cd6,_0xa95d1f['options']);return _0x37a2c0[_0xa02a('0x47')](_0x3f6cd6);}})[_0xa02a('0x20')](function(_0x3c87fc){if(_0x3c87fc){_0x3c30a0=_0x3c87fc[_0xa02a('0x33')];if(!_0xa95d1f[_0xa02a('0x30')]['hasOwnProperty'](_0xa02a('0x49'))){_0x3f6cd6[_0xa02a('0x1a')]=qs[_0xa02a('0x1a')](_0xa95d1f['query']['limit']);_0x3f6cd6[_0xa02a('0x19')]=qs['offset'](_0xa95d1f[_0xa02a('0x30')][_0xa02a('0x19')]);}return _0x37a2c0['getConfigurations'](_0x3f6cd6);}})[_0xa02a('0x20')](function(_0x4afc81){if(_0x4afc81){return _0x4afc81?{'count':_0x3c30a0,'rows':_0x4afc81}:null;}})['then'](respondWithResult(_0x4accfe,null))[_0xa02a('0x43')](handleError(_0x4accfe,null));};exports['addConfiguration']=function(_0x105fc7,_0x5cd788,_0x21bc65){if(_0x105fc7[_0xa02a('0x46')]['id']){delete _0x105fc7[_0xa02a('0x46')]['id'];}return db[_0xa02a('0x28')]['findOne']({'where':{'id':_0x105fc7['params']['id']}})[_0xa02a('0x20')](handleEntityNotFound(_0x5cd788,null))[_0xa02a('0x20')](function(_0x1407cf){if(_0x1407cf){_0x105fc7[_0xa02a('0x46')][_0xa02a('0x4a')]=_0x1407cf['id'];_0x105fc7['body']['Subjects']=integrations[_0xa02a('0x4b')](_0x105fc7[_0xa02a('0x46')][_0xa02a('0x4c')],_0x105fc7['body']['type']);_0x105fc7['body']['Descriptions']=integrations[_0xa02a('0x4d')](_0x105fc7[_0xa02a('0x46')][_0xa02a('0x4c')],_0x105fc7['body'][_0xa02a('0x2b')]);return db[_0xa02a('0x4e')][_0xa02a('0x44')](_0x105fc7[_0xa02a('0x46')],{'include':[{'model':db['VtigerField'],'as':_0xa02a('0x4f')},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})[_0xa02a('0x20')](respondWithResult(_0x5cd788,null))[_0xa02a('0x43')](handleError(_0x5cd788,null));};var md5=require(_0xa02a('0x50'));exports[_0xa02a('0x51')]=function(_0x30adfa,_0x30685d,_0x3ebc20){var _0x317e81=null;var _0x57eba6=null;var _0x1f40fc=null;var _0x127ba5=null;var _0x16ece1='';return db[_0xa02a('0x28')]['findOne']({'where':{'id':_0x30adfa[_0xa02a('0x41')]['id']},'attributes':['id','name','username',_0xa02a('0x52'),_0xa02a('0x53'),_0xa02a('0x54'),_0xa02a('0x55'),'accessKey']})['then'](handleEntityNotFound(_0x30685d,null))['then'](function(_0x2080cd){if(_0x2080cd){_0x317e81=_0x2080cd[_0xa02a('0x56')];_0x57eba6=_0x2080cd['accessKey'];_0x1f40fc=_0x2080cd[_0xa02a('0x53')];_0x16ece1=_0x2080cd[_0xa02a('0x54')];var _0x965bef=_0x16ece1[_0xa02a('0x57')](-0x1);if(_0x965bef==='/'){_0x16ece1=_0x16ece1['substring'](0x0,_0x16ece1['lastIndexOf'](_0x965bef));}_0x127ba5=util[_0xa02a('0x58')](_0xa02a('0x59'),_0x16ece1);var _0x4f9838={'method':_0xa02a('0x5a'),'uri':_0x127ba5,'qs':{'operation':_0xa02a('0x5b'),'username':_0x2080cd[_0xa02a('0x56')]},'json':!![]};return rp(_0x4f9838);}})[_0xa02a('0x20')](function(_0x2c407b){if(_0x2c407b[_0xa02a('0x5c')]){var _0x4fb01b={'method':_0xa02a('0x5d'),'uri':_0x127ba5,'form':{'operation':_0xa02a('0x5e'),'username':_0x317e81,'accessKey':md5(_0x2c407b[_0xa02a('0x5f')][_0xa02a('0x60')]+_0x57eba6)},'json':!![]};return rp(_0x4fb01b);}})['then'](function(_0x39c134){if(_0x39c134[_0xa02a('0x5c')]){var _0x3ab0c8={'method':_0xa02a('0x5a'),'uri':_0x127ba5,'qs':{'operation':_0xa02a('0x61'),'username':_0x317e81,'sessionName':_0x39c134[_0xa02a('0x5f')][_0xa02a('0x62')],'elementType':_0x1f40fc},'json':!![]};return rp(_0x3ab0c8);}})[_0xa02a('0x20')](function(_0x87f0b4){if(_0x87f0b4[_0xa02a('0x5c')]){var _0x1ca3eb=[_0xa02a('0x63'),'reference',_0xa02a('0x64')];_[_0xa02a('0x65')](_0x87f0b4['result']['fields'],function(_0x3cd141){return _0x1ca3eb[_0xa02a('0x66')](_0x3cd141[_0xa02a('0x2b')][_0xa02a('0x24')]);});_[_0xa02a('0x65')](_0x87f0b4[_0xa02a('0x5f')][_0xa02a('0x32')],function(_0x1e9872){return _0x1e9872[_0xa02a('0x67')]===_0xa02a('0x68');});return{'count':_0x87f0b4[_0xa02a('0x5f')]['fields'][_0xa02a('0x33')],'rows':_[_0xa02a('0x27')](_0x87f0b4[_0xa02a('0x5f')][_0xa02a('0x32')],function(_0x3d8ae0){return{'id':_0x3d8ae0[_0xa02a('0x24')],'name':_0x3d8ae0[_0xa02a('0x69')],'custom':_[_0xa02a('0x6a')](_0x3d8ae0['name'],'cf_')?!![]:![],'options':_0x3d8ae0[_0xa02a('0x2b')]['name']===_0xa02a('0x6b')&&_0x3d8ae0['type'][_0xa02a('0x6c')][_0xa02a('0x33')]>0x0?_[_0xa02a('0x27')](_0x3d8ae0['type'][_0xa02a('0x6c')],function(_0x53f46b){return{'name':_0x53f46b[_0xa02a('0x69')],'value':_0x53f46b[_0xa02a('0x6d')]};}):[]};})};}})['then'](respondWithResult(_0x30685d,null))[_0xa02a('0x43')](function(_0x4d88db){console['log'](_0xa02a('0x6e')+_0x4d88db);var _0x44a8d8=_0x30adfa['query']['test']?0x1f4:_0x4d88db[_0xa02a('0x6f')]||0x1f4;logger[_0xa02a('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0xa02a('0x51'),_0x44a8d8,JSON[_0xa02a('0x70')](_0x4d88db));delete _0x4d88db['name'];if(_0x44a8d8===0x191){_0x44a8d8=0x190;}_0x30685d[_0xa02a('0x18')](_0x44a8d8)[_0xa02a('0x25')](_0x30adfa[_0xa02a('0x30')][_0xa02a('0x71')]?{'message':_0xa02a('0x72'),'statusCode':_0x4d88db[_0xa02a('0x6f')]}:_0x4d88db);});}; \ No newline at end of file +var _0xe77b=['lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','status','undefined','limit','count','offset','set','Content-Range','apply','then','destroy','end','sendStatus','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','create','body','update','find','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','md5','getFields','username','description','moduleName','serverUrl','accessKey','remoteUri','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','POST','result','token','describe','autogenerated','reference','owner','remove','includes','false','label','picklist','picklistValues','value','log','vTiger\x20error:\x20','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','fs-extra'];(function(_0x2c8cf7,_0x43b1fa){var _0x56c530=function(_0x64cb23){while(--_0x64cb23){_0x2c8cf7['push'](_0x2c8cf7['shift']());}};_0x56c530(++_0x43b1fa);}(_0xe77b,0x147));var _0xbe77=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe77b[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbe77('0x0'));var zipdir=require(_0xbe77('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbe77('0x2'));var moment=require(_0xbe77('0x3'));var BPromise=require(_0xbe77('0x4'));var Mustache=require('mustache');var util=require(_0xbe77('0x5'));var path=require('path');var sox=require(_0xbe77('0x6'));var csv=require(_0xbe77('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbe77('0x8'));var _=require(_0xbe77('0x9'));var squel=require('squel');var crypto=require(_0xbe77('0xa'));var jsforce=require(_0xbe77('0xb'));var deskjs=require(_0xbe77('0xc'));var toCsv=require(_0xbe77('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbe77('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xbe77('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe77('0xf'));var logger=require(_0xbe77('0x10'))(_0xbe77('0x11'));var utils=require(_0xbe77('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xbe77('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0xbe77('0x14'));function respondWithStatusCode(_0x2f608a,_0xf0a642){_0xf0a642=_0xf0a642||0xcc;return function(_0x453e97){if(_0x453e97){return _0x2f608a['sendStatus'](_0xf0a642);}return _0x2f608a[_0xbe77('0x15')](_0xf0a642)['end']();};}function respondWithResult(_0x10659f,_0x9e1023){_0x9e1023=_0x9e1023||0xc8;return function(_0x216746){if(_0x216746){return _0x10659f[_0xbe77('0x15')](_0x9e1023)['json'](_0x216746);}};}function respondWithFilteredResult(_0x56b0aa,_0x34f778){return function(_0x3039ca){if(_0x3039ca){var _0x14f7a3=typeof _0x34f778['offset']===_0xbe77('0x16')&&typeof _0x34f778[_0xbe77('0x17')]==='undefined';var _0x447fd5=_0x3039ca[_0xbe77('0x18')];var _0x17e644=_0x14f7a3?0x0:_0x34f778[_0xbe77('0x19')];var _0x2ddac9=_0x14f7a3?_0x3039ca['count']:_0x34f778['offset']+_0x34f778['limit'];var _0x2d6136;if(_0x2ddac9>=_0x447fd5){_0x2ddac9=_0x447fd5;_0x2d6136=0xc8;}else{_0x2d6136=0xce;}_0x56b0aa[_0xbe77('0x15')](_0x2d6136);return _0x56b0aa[_0xbe77('0x1a')](_0xbe77('0x1b'),_0x17e644+'-'+_0x2ddac9+'/'+_0x447fd5)['json'](_0x3039ca);}return null;};}function patchUpdates(_0x3fd328){return function(_0xca48f){try{jsonpatch[_0xbe77('0x1c')](_0xca48f,_0x3fd328,!![]);}catch(_0x54324f){return BPromise['reject'](_0x54324f);}return _0xca48f['save']();};}function saveUpdates(_0x48c259,_0x42c28c){return function(_0x1ccf83){if(_0x1ccf83){return _0x1ccf83['update'](_0x48c259)[_0xbe77('0x1d')](function(_0x4ac276){return _0x4ac276;});}return null;};}function removeEntity(_0x3ef429,_0x427640){return function(_0x3942e6){if(_0x3942e6){return _0x3942e6[_0xbe77('0x1e')]()[_0xbe77('0x1d')](function(){_0x3ef429['status'](0xcc)[_0xbe77('0x1f')]();});}};}function handleEntityNotFound(_0x10449a,_0x5cad4b){return function(_0x3f2955){if(!_0x3f2955){_0x10449a[_0xbe77('0x20')](0x194);}return _0x3f2955;};}function handleError(_0x2c350f,_0x1427e7){_0x1427e7=_0x1427e7||0x1f4;return function(_0x47d288){logger[_0xbe77('0x21')](_0x47d288[_0xbe77('0x22')]);if(_0x47d288['name']){delete _0x47d288[_0xbe77('0x23')];}_0x2c350f['status'](_0x1427e7)[_0xbe77('0x24')](_0x47d288);};}exports[_0xbe77('0x25')]=function(_0x2d735b,_0x356c76){var _0x5c376a={},_0x173b0c={},_0x48a719={'count':0x0,'rows':[]};var _0x562757=_[_0xbe77('0x26')](db[_0xbe77('0x27')][_0xbe77('0x28')],function(_0xebbd7a){return{'name':_0xebbd7a[_0xbe77('0x29')],'type':_0xebbd7a['type']['key']};});_0x173b0c[_0xbe77('0x2a')]=_[_0xbe77('0x26')](_0x562757,'name');_0x173b0c[_0xbe77('0x2b')]=_[_0xbe77('0x2c')](_0x2d735b['query']);_0x173b0c[_0xbe77('0x2d')]=_[_0xbe77('0x2e')](_0x173b0c[_0xbe77('0x2a')],_0x173b0c[_0xbe77('0x2b')]);_0x5c376a[_0xbe77('0x2f')]=_[_0xbe77('0x2e')](_0x173b0c[_0xbe77('0x2a')],qs['fields'](_0x2d735b[_0xbe77('0x2b')][_0xbe77('0x30')]));_0x5c376a[_0xbe77('0x2f')]=_0x5c376a[_0xbe77('0x2f')][_0xbe77('0x31')]?_0x5c376a[_0xbe77('0x2f')]:_0x173b0c[_0xbe77('0x2a')];if(!_0x2d735b['query']['hasOwnProperty'](_0xbe77('0x32'))){_0x5c376a['limit']=qs['limit'](_0x2d735b['query'][_0xbe77('0x17')]);_0x5c376a[_0xbe77('0x19')]=qs['offset'](_0x2d735b[_0xbe77('0x2b')][_0xbe77('0x19')]);}_0x5c376a[_0xbe77('0x33')]=qs[_0xbe77('0x34')](_0x2d735b[_0xbe77('0x2b')][_0xbe77('0x34')]);_0x5c376a[_0xbe77('0x35')]=qs[_0xbe77('0x2d')](_[_0xbe77('0x36')](_0x2d735b['query'],_0x173b0c[_0xbe77('0x2d')]),_0x562757);if(_0x2d735b[_0xbe77('0x2b')][_0xbe77('0x37')]){_0x5c376a['where']=_['merge'](_0x5c376a['where'],{'$or':_[_0xbe77('0x26')](_0x562757,function(_0x3edf6c){if(_0x3edf6c[_0xbe77('0x38')]!==_0xbe77('0x39')){var _0x58558b={};_0x58558b[_0x3edf6c[_0xbe77('0x23')]]={'$like':'%'+_0x2d735b[_0xbe77('0x2b')][_0xbe77('0x37')]+'%'};return _0x58558b;}})});}_0x5c376a=_[_0xbe77('0x3a')]({},_0x5c376a,_0x2d735b[_0xbe77('0x3b')]);var _0x76f6b5={'where':_0x5c376a[_0xbe77('0x35')]};return db[_0xbe77('0x27')][_0xbe77('0x18')](_0x76f6b5)[_0xbe77('0x1d')](function(_0x4b669c){_0x48a719['count']=_0x4b669c;if(_0x2d735b[_0xbe77('0x2b')][_0xbe77('0x3c')]){_0x5c376a[_0xbe77('0x3d')]=[{'all':!![]}];}return db[_0xbe77('0x27')][_0xbe77('0x3e')](_0x5c376a);})[_0xbe77('0x1d')](function(_0x53629b){_0x48a719[_0xbe77('0x3f')]=_0x53629b;return _0x48a719;})[_0xbe77('0x1d')](respondWithFilteredResult(_0x356c76,_0x5c376a))[_0xbe77('0x40')](handleError(_0x356c76,null));};exports['show']=function(_0x549bf7,_0x84ff77){var _0x5e1ce9={'raw':![],'where':{'id':_0x549bf7[_0xbe77('0x41')]['id']}},_0x17d0e2={};_0x17d0e2[_0xbe77('0x2a')]=_[_0xbe77('0x2c')](db[_0xbe77('0x27')]['rawAttributes']);_0x17d0e2['query']=_[_0xbe77('0x2c')](_0x549bf7[_0xbe77('0x2b')]);_0x17d0e2[_0xbe77('0x2d')]=_['intersection'](_0x17d0e2['model'],_0x17d0e2[_0xbe77('0x2b')]);_0x5e1ce9[_0xbe77('0x2f')]=_[_0xbe77('0x2e')](_0x17d0e2[_0xbe77('0x2a')],qs[_0xbe77('0x30')](_0x549bf7[_0xbe77('0x2b')][_0xbe77('0x30')]));_0x5e1ce9[_0xbe77('0x2f')]=_0x5e1ce9[_0xbe77('0x2f')][_0xbe77('0x31')]?_0x5e1ce9['attributes']:_0x17d0e2[_0xbe77('0x2a')];if(_0x549bf7[_0xbe77('0x2b')][_0xbe77('0x3c')]){_0x5e1ce9[_0xbe77('0x3d')]=[{'all':!![]}];}_0x5e1ce9=_[_0xbe77('0x3a')]({},_0x5e1ce9,_0x549bf7['options']);return db[_0xbe77('0x27')]['find'](_0x5e1ce9)[_0xbe77('0x1d')](handleEntityNotFound(_0x84ff77,null))[_0xbe77('0x1d')](respondWithResult(_0x84ff77,null))['catch'](handleError(_0x84ff77,null));};exports[_0xbe77('0x42')]=function(_0x659977,_0xf8ed68){return db[_0xbe77('0x27')][_0xbe77('0x42')](_0x659977[_0xbe77('0x43')],{})[_0xbe77('0x1d')](respondWithResult(_0xf8ed68,0xc9))[_0xbe77('0x40')](handleError(_0xf8ed68,null));};exports[_0xbe77('0x44')]=function(_0xc0d5f9,_0x56fa2a){if(_0xc0d5f9[_0xbe77('0x43')]['id']){delete _0xc0d5f9[_0xbe77('0x43')]['id'];}return db[_0xbe77('0x27')]['find']({'where':{'id':_0xc0d5f9[_0xbe77('0x41')]['id']}})[_0xbe77('0x1d')](handleEntityNotFound(_0x56fa2a,null))[_0xbe77('0x1d')](saveUpdates(_0xc0d5f9[_0xbe77('0x43')],null))[_0xbe77('0x1d')](respondWithResult(_0x56fa2a,null))[_0xbe77('0x40')](handleError(_0x56fa2a,null));};exports[_0xbe77('0x1e')]=function(_0x1f2155,_0x128e7a){return db[_0xbe77('0x27')][_0xbe77('0x45')]({'where':{'id':_0x1f2155[_0xbe77('0x41')]['id']}})[_0xbe77('0x1d')](handleEntityNotFound(_0x128e7a,null))[_0xbe77('0x1d')](removeEntity(_0x128e7a,null))[_0xbe77('0x40')](handleError(_0x128e7a,null));};exports[_0xbe77('0x46')]=function(_0x41cec9,_0x17e508,_0x1b483e){var _0x13fb94={};var _0x52724e={};var _0xf7d571;var _0x11a604;return db[_0xbe77('0x27')][_0xbe77('0x47')]({'where':{'id':_0x41cec9[_0xbe77('0x41')]['id']}})['then'](handleEntityNotFound(_0x17e508,null))['then'](function(_0x5c5426){if(_0x5c5426){_0xf7d571=_0x5c5426;_0x52724e[_0xbe77('0x2a')]=_[_0xbe77('0x2c')](db[_0xbe77('0x48')][_0xbe77('0x28')]);_0x52724e['query']=_['keys'](_0x41cec9[_0xbe77('0x2b')]);_0x52724e[_0xbe77('0x2d')]=_[_0xbe77('0x2e')](_0x52724e[_0xbe77('0x2a')],_0x52724e['query']);_0x13fb94['attributes']=_[_0xbe77('0x2e')](_0x52724e[_0xbe77('0x2a')],qs[_0xbe77('0x30')](_0x41cec9['query'][_0xbe77('0x30')]));_0x13fb94[_0xbe77('0x2f')]=_0x13fb94[_0xbe77('0x2f')][_0xbe77('0x31')]?_0x13fb94[_0xbe77('0x2f')]:_0x52724e[_0xbe77('0x2a')];_0x13fb94[_0xbe77('0x33')]=qs[_0xbe77('0x34')](_0x41cec9[_0xbe77('0x2b')][_0xbe77('0x34')]);_0x13fb94[_0xbe77('0x35')]=qs[_0xbe77('0x2d')](_[_0xbe77('0x36')](_0x41cec9[_0xbe77('0x2b')],_0x52724e[_0xbe77('0x2d')]));if(_0x41cec9[_0xbe77('0x2b')][_0xbe77('0x37')]){_0x13fb94[_0xbe77('0x35')]=_[_0xbe77('0x3a')](_0x13fb94[_0xbe77('0x35')],{'$or':_[_0xbe77('0x26')](_0x13fb94[_0xbe77('0x2f')],function(_0x44d14f){var _0x4f79a3={};_0x4f79a3[_0x44d14f]={'$like':'%'+_0x41cec9['query']['filter']+'%'};return _0x4f79a3;})});}_0x13fb94=_[_0xbe77('0x3a')]({},_0x13fb94,_0x41cec9['options']);return _0xf7d571[_0xbe77('0x46')](_0x13fb94);}})['then'](function(_0x58080d){if(_0x58080d){_0x11a604=_0x58080d[_0xbe77('0x31')];if(!_0x41cec9[_0xbe77('0x2b')]['hasOwnProperty'](_0xbe77('0x32'))){_0x13fb94[_0xbe77('0x17')]=qs[_0xbe77('0x17')](_0x41cec9[_0xbe77('0x2b')]['limit']);_0x13fb94[_0xbe77('0x19')]=qs[_0xbe77('0x19')](_0x41cec9[_0xbe77('0x2b')]['offset']);}return _0xf7d571[_0xbe77('0x46')](_0x13fb94);}})[_0xbe77('0x1d')](function(_0x210471){if(_0x210471){return _0x210471?{'count':_0x11a604,'rows':_0x210471}:null;}})[_0xbe77('0x1d')](respondWithResult(_0x17e508,null))[_0xbe77('0x40')](handleError(_0x17e508,null));};exports[_0xbe77('0x49')]=function(_0x46ca0b,_0x358963,_0x1b2f15){if(_0x46ca0b[_0xbe77('0x43')]['id']){delete _0x46ca0b[_0xbe77('0x43')]['id'];}return db[_0xbe77('0x27')][_0xbe77('0x47')]({'where':{'id':_0x46ca0b['params']['id']}})[_0xbe77('0x1d')](handleEntityNotFound(_0x358963,null))[_0xbe77('0x1d')](function(_0x525dbe){if(_0x525dbe){_0x46ca0b[_0xbe77('0x43')][_0xbe77('0x4a')]=_0x525dbe['id'];_0x46ca0b['body'][_0xbe77('0x4b')]=integrations['getSubjects'](_0x46ca0b[_0xbe77('0x43')][_0xbe77('0x4c')],_0x46ca0b[_0xbe77('0x43')]['type']);_0x46ca0b[_0xbe77('0x43')][_0xbe77('0x4d')]=integrations['getDescriptions'](_0x46ca0b[_0xbe77('0x43')]['channel'],_0x46ca0b[_0xbe77('0x43')][_0xbe77('0x38')]);return db[_0xbe77('0x48')][_0xbe77('0x42')](_0x46ca0b[_0xbe77('0x43')],{'include':[{'model':db['VtigerField'],'as':_0xbe77('0x4b')},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})[_0xbe77('0x1d')](respondWithResult(_0x358963,null))['catch'](handleError(_0x358963,null));};var md5=require(_0xbe77('0x4e'));exports[_0xbe77('0x4f')]=function(_0x281c45,_0x1be3ad,_0x32c542){var _0x36009e=null;var _0x5f5369=null;var _0xcf9727=null;var _0x19c3d8=null;var _0x12b86a='';return db[_0xbe77('0x27')]['findOne']({'where':{'id':_0x281c45[_0xbe77('0x41')]['id']},'attributes':['id',_0xbe77('0x23'),_0xbe77('0x50'),_0xbe77('0x51'),_0xbe77('0x52'),'remoteUri',_0xbe77('0x53'),'accessKey']})[_0xbe77('0x1d')](handleEntityNotFound(_0x1be3ad,null))[_0xbe77('0x1d')](function(_0x28ac93){if(_0x28ac93){_0x36009e=_0x28ac93['username'];_0x5f5369=_0x28ac93[_0xbe77('0x54')];_0xcf9727=_0x28ac93[_0xbe77('0x52')];_0x12b86a=_0x28ac93[_0xbe77('0x55')];var _0x586a7f=_0x12b86a[_0xbe77('0x56')](-0x1);if(_0x586a7f==='/'){_0x12b86a=_0x12b86a[_0xbe77('0x57')](0x0,_0x12b86a[_0xbe77('0x58')](_0x586a7f));}_0x19c3d8=util[_0xbe77('0x59')](_0xbe77('0x5a'),_0x12b86a);var _0x134446={'method':_0xbe77('0x5b'),'uri':_0x19c3d8,'qs':{'operation':_0xbe77('0x5c'),'username':_0x28ac93[_0xbe77('0x50')]},'json':!![]};return rp(_0x134446);}})['then'](function(_0x111b95){if(_0x111b95['success']){var _0x1789a5={'method':_0xbe77('0x5d'),'uri':_0x19c3d8,'form':{'operation':'login','username':_0x36009e,'accessKey':md5(_0x111b95[_0xbe77('0x5e')][_0xbe77('0x5f')]+_0x5f5369)},'json':!![]};return rp(_0x1789a5);}})[_0xbe77('0x1d')](function(_0x473d21){if(_0x473d21['success']){var _0x5cf35b={'method':_0xbe77('0x5b'),'uri':_0x19c3d8,'qs':{'operation':_0xbe77('0x60'),'username':_0x36009e,'sessionName':_0x473d21[_0xbe77('0x5e')]['sessionName'],'elementType':_0xcf9727},'json':!![]};return rp(_0x5cf35b);}})['then'](function(_0x4318dc){if(_0x4318dc['success']){var _0x505818=[_0xbe77('0x61'),_0xbe77('0x62'),_0xbe77('0x63')];_[_0xbe77('0x64')](_0x4318dc[_0xbe77('0x5e')]['fields'],function(_0x4965d0){return _0x505818[_0xbe77('0x65')](_0x4965d0['type'][_0xbe77('0x23')]);});_['remove'](_0x4318dc[_0xbe77('0x5e')]['fields'],function(_0x4dd80f){return _0x4dd80f['editable']===_0xbe77('0x66');});return{'count':_0x4318dc[_0xbe77('0x5e')][_0xbe77('0x30')][_0xbe77('0x31')],'rows':_[_0xbe77('0x26')](_0x4318dc[_0xbe77('0x5e')]['fields'],function(_0x555669){return{'id':_0x555669['name'],'name':_0x555669[_0xbe77('0x67')],'custom':_['startsWith'](_0x555669['name'],'cf_')?!![]:![],'options':_0x555669[_0xbe77('0x38')][_0xbe77('0x23')]===_0xbe77('0x68')&&_0x555669['type']['picklistValues']['length']>0x0?_[_0xbe77('0x26')](_0x555669[_0xbe77('0x38')][_0xbe77('0x69')],function(_0x382a1b){return{'name':_0x382a1b[_0xbe77('0x67')],'value':_0x382a1b[_0xbe77('0x6a')]};}):[]};})};}})[_0xbe77('0x1d')](respondWithResult(_0x1be3ad,null))[_0xbe77('0x40')](function(_0x366590){console[_0xbe77('0x6b')](_0xbe77('0x6c')+_0x366590);var _0x5090f6=_0x281c45[_0xbe77('0x2b')]['test']?0x1f4:_0x366590['statusCode']||0x1f4;logger['error'](_0xbe77('0x6d'),_0xbe77('0x4f'),_0x5090f6,JSON['stringify'](_0x366590));delete _0x366590[_0xbe77('0x23')];if(_0x5090f6===0x191){_0x5090f6=0x190;}_0x1be3ad[_0xbe77('0x15')](_0x5090f6)['send'](_0x281c45[_0xbe77('0x2b')][_0xbe77('0x6e')]?{'message':_0xbe77('0x6f'),'statusCode':_0x366590['statusCode']}:_0x366590);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index d588011..d8bfb97 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 _0x2c78=['../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','VtigerAccount','int_vtiger_accounts','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x50e1aa,_0x15aba8){var _0x8a2196=function(_0x17b7c7){while(--_0x17b7c7){_0x50e1aa['push'](_0x50e1aa['shift']());}};_0x8a2196(++_0x15aba8);}(_0x2c78,0x17f));var _0x82c7=function(_0x12d79d,_0x3c4f12){_0x12d79d=_0x12d79d-0x0;var _0x5cbe01=_0x2c78[_0x12d79d];return _0x5cbe01;};'use strict';var _=require('lodash');var util=require(_0x82c7('0x0'));var logger=require(_0x82c7('0x1'))('api');var moment=require(_0x82c7('0x2'));var BPromise=require(_0x82c7('0x3'));var rp=require(_0x82c7('0x4'));var fs=require('fs');var path=require(_0x82c7('0x5'));var rimraf=require(_0x82c7('0x6'));var config=require(_0x82c7('0x7'));var attributes=require(_0x82c7('0x8'));var integrations=require(_0x82c7('0x9'));module[_0x82c7('0xa')]=function(_0x4057c3,_0xf307d1){return _0x4057c3['define'](_0x82c7('0xb'),attributes,{'tableName':_0x82c7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcea4=['define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x572bba,_0x1c7270){var _0x10cd7c=function(_0x5baeb0){while(--_0x5baeb0){_0x572bba['push'](_0x572bba['shift']());}};_0x10cd7c(++_0x1c7270);}(_0xcea4,0x8f));var _0x4cea=function(_0x23d50e,_0x378059){_0x23d50e=_0x23d50e-0x0;var _0x1ce88f=_0xcea4[_0x23d50e];return _0x1ce88f;};'use strict';var _=require(_0x4cea('0x0'));var util=require(_0x4cea('0x1'));var logger=require(_0x4cea('0x2'))(_0x4cea('0x3'));var moment=require(_0x4cea('0x4'));var BPromise=require(_0x4cea('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4cea('0x6'));var config=require(_0x4cea('0x7'));var attributes=require(_0x4cea('0x8'));var integrations=require(_0x4cea('0x9'));module[_0x4cea('0xa')]=function(_0x1eb41b,_0x118aee){return _0x1eb41b[_0x4cea('0xb')](_0x4cea('0xc'),attributes,{'tableName':_0x4cea('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index a26d740..0ab5664 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 _0xa74f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetVtigerAccount','VtigerAccount','options','raw','where','limit','attributes','include','map','model','ShowVtigerAccount','find','moment'];(function(_0x52ca59,_0x279dda){var _0x1ab7e5=function(_0x2b8c74){while(--_0x2b8c74){_0x52ca59['push'](_0x52ca59['shift']());}};_0x1ab7e5(++_0x279dda);}(_0xa74f,0x9a));var _0xfa74=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa74f[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfa74('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa74('0x1'));var db=require(_0xfa74('0x2'))['db'];var utils=require(_0xfa74('0x3'));var logger=require(_0xfa74('0x4'))('rpc');var config=require(_0xfa74('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfa74('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x9ddbd2,_0x3ac32e,_0x2d9fa9){return new BPromise(function(_0x287921,_0x344e04){return client['request'](_0x9ddbd2,_0x2d9fa9)[_0xfa74('0x7')](function(_0x37d4d8){logger[_0xfa74('0x8')](_0xfa74('0x9'),_0x3ac32e,'request\x20sent');logger[_0xfa74('0xa')](_0xfa74('0xb'),_0x3ac32e,'request\x20sent',JSON[_0xfa74('0xc')](_0x37d4d8));if(_0x37d4d8[_0xfa74('0xd')]){if(_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xe')]===0x1f4){logger['error'](_0xfa74('0x9'),_0x3ac32e,_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xf')]);return _0x344e04(_0x37d4d8[_0xfa74('0xd')]['message']);}logger[_0xfa74('0xd')](_0xfa74('0x9'),_0x3ac32e,_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xf')]);return _0x287921(_0x37d4d8[_0xfa74('0xd')]['message']);}else{logger[_0xfa74('0x8')](_0xfa74('0x9'),_0x3ac32e,_0xfa74('0x10'));_0x287921(_0x37d4d8[_0xfa74('0x11')][_0xfa74('0xf')]);}})[_0xfa74('0x12')](function(_0x3b9e32){logger['error'](_0xfa74('0x9'),_0x3ac32e,_0x3b9e32);_0x344e04(_0x3b9e32);});});}exports[_0xfa74('0x13')]=function(_0x51dda1){var _0x4928b6=this;return new Promise(function(_0x31d3c1,_0x25a36b){return db[_0xfa74('0x14')]['findAll']({'raw':_0x51dda1[_0xfa74('0x15')]?_0x51dda1[_0xfa74('0x15')][_0xfa74('0x16')]===undefined?!![]:![]:!![],'where':_0x51dda1['options']?_0x51dda1[_0xfa74('0x15')][_0xfa74('0x17')]||null:null,'attributes':_0x51dda1[_0xfa74('0x15')]?_0x51dda1['options']['attributes']||null:null,'limit':_0x51dda1[_0xfa74('0x15')]?_0x51dda1[_0xfa74('0x15')][_0xfa74('0x18')]||null:null,'include':_0x51dda1[_0xfa74('0x15')]?_0x51dda1[_0xfa74('0x15')]['include']?_['map'](_0x51dda1[_0xfa74('0x15')]['include'],function(_0x48cbd3){return{'model':db[_0x48cbd3['model']],'as':_0x48cbd3['as'],'attributes':_0x48cbd3[_0xfa74('0x19')],'include':_0x48cbd3[_0xfa74('0x1a')]?_[_0xfa74('0x1b')](_0x48cbd3['include'],function(_0x530f99){return{'model':db[_0x530f99[_0xfa74('0x1c')]],'as':_0x530f99['as'],'attributes':_0x530f99[_0xfa74('0x19')],'include':_0x530f99['include']?_[_0xfa74('0x1b')](_0x530f99['include'],function(_0x1a8cf7){return{'model':db[_0x1a8cf7[_0xfa74('0x1c')]],'as':_0x1a8cf7['as'],'attributes':_0x1a8cf7['attributes']};}):[]};}):[]};}):[]:[]})[_0xfa74('0x7')](function(_0x1130de){logger[_0xfa74('0x8')](_0xfa74('0x13'),_0x51dda1);logger['debug'](_0xfa74('0x13'),_0x51dda1,JSON[_0xfa74('0xc')](_0x1130de));_0x31d3c1(_0x1130de);})[_0xfa74('0x12')](function(_0x57d90e){logger['error'](_0xfa74('0x13'),_0x57d90e[_0xfa74('0xf')],_0x51dda1);_0x25a36b(_0x4928b6['error'](0x1f4,_0x57d90e['message']));});});};exports[_0xfa74('0x1d')]=function(_0x564060){var _0x2238d4=this;return new Promise(function(_0x4d6d0a,_0x363173){return db[_0xfa74('0x14')][_0xfa74('0x1e')]({'raw':_0x564060[_0xfa74('0x15')]?_0x564060['options'][_0xfa74('0x16')]===undefined?!![]:![]:!![],'where':_0x564060[_0xfa74('0x15')]?_0x564060[_0xfa74('0x15')][_0xfa74('0x17')]||null:null,'attributes':_0x564060[_0xfa74('0x15')]?_0x564060[_0xfa74('0x15')][_0xfa74('0x19')]||null:null,'include':_0x564060['options']?_0x564060[_0xfa74('0x15')]['include']?_[_0xfa74('0x1b')](_0x564060[_0xfa74('0x15')][_0xfa74('0x1a')],function(_0x1b5ff0){return{'model':db[_0x1b5ff0['model']],'as':_0x1b5ff0['as'],'attributes':_0x1b5ff0['attributes'],'include':_0x1b5ff0[_0xfa74('0x1a')]?_[_0xfa74('0x1b')](_0x1b5ff0[_0xfa74('0x1a')],function(_0x25863f){return{'model':db[_0x25863f['model']],'as':_0x25863f['as'],'attributes':_0x25863f[_0xfa74('0x19')],'include':_0x25863f[_0xfa74('0x1a')]?_['map'](_0x25863f['include'],function(_0x557510){return{'model':db[_0x557510['model']],'as':_0x557510['as'],'attributes':_0x557510['attributes']};}):[]};}):[]};}):[]:[]})[_0xfa74('0x7')](function(_0x1c3b44){logger[_0xfa74('0x8')](_0xfa74('0x1d'),_0x564060);logger[_0xfa74('0xa')](_0xfa74('0x1d'),_0x564060,JSON[_0xfa74('0xc')](_0x1c3b44));_0x4d6d0a(_0x1c3b44);})[_0xfa74('0x12')](function(_0x1a2d52){logger['error'](_0xfa74('0x1d'),_0x1a2d52[_0xfa74('0xf')],_0x564060);_0x363173(_0x2238d4[_0xfa74('0xd')](0x1f4,_0x1a2d52[_0xfa74('0xf')]));});});}; \ No newline at end of file +var _0xd87e=['stringify','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','map','include','model','attributes','ShowVtigerAccount','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s'];(function(_0x45b5f7,_0x355b47){var _0x1856f7=function(_0x1ac8dd){while(--_0x1ac8dd){_0x45b5f7['push'](_0x45b5f7['shift']());}};_0x1856f7(++_0x355b47);}(_0xd87e,0x1bf));var _0xed87=function(_0x19d24e,_0x48638d){_0x19d24e=_0x19d24e-0x0;var _0x28c4f2=_0xd87e[_0x19d24e];return _0x28c4f2;};'use strict';var _=require(_0xed87('0x0'));var util=require(_0xed87('0x1'));var moment=require('moment');var BPromise=require(_0xed87('0x2'));var rs=require(_0xed87('0x3'));var fs=require('fs');var Redis=require(_0xed87('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xed87('0x5'));var logger=require('../../config/logger')(_0xed87('0x6'));var config=require(_0xed87('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xed87('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5da793,_0xa33c67,_0x42fef6){return new BPromise(function(_0x33e1c1,_0x2f348a){return client['request'](_0x5da793,_0x42fef6)[_0xed87('0x9')](function(_0x3dce4b){logger[_0xed87('0xa')](_0xed87('0xb'),_0xa33c67,_0xed87('0xc'));logger[_0xed87('0xd')](_0xed87('0xe'),_0xa33c67,'request\x20sent',JSON[_0xed87('0xf')](_0x3dce4b));if(_0x3dce4b[_0xed87('0x10')]){if(_0x3dce4b['error'][_0xed87('0x11')]===0x1f4){logger[_0xed87('0x10')]('VtigerAccount,\x20%s,\x20%s',_0xa33c67,_0x3dce4b['error'][_0xed87('0x12')]);return _0x2f348a(_0x3dce4b[_0xed87('0x10')][_0xed87('0x12')]);}logger[_0xed87('0x10')](_0xed87('0xb'),_0xa33c67,_0x3dce4b[_0xed87('0x10')]['message']);return _0x33e1c1(_0x3dce4b[_0xed87('0x10')][_0xed87('0x12')]);}else{logger[_0xed87('0xa')](_0xed87('0xb'),_0xa33c67,_0xed87('0xc'));_0x33e1c1(_0x3dce4b[_0xed87('0x13')][_0xed87('0x12')]);}})[_0xed87('0x14')](function(_0x385859){logger['error'](_0xed87('0xb'),_0xa33c67,_0x385859);_0x2f348a(_0x385859);});});}exports[_0xed87('0x15')]=function(_0x2c386a){var _0xfb8a44=this;return new Promise(function(_0x5f4076,_0x211085){return db[_0xed87('0x16')][_0xed87('0x17')]({'raw':_0x2c386a[_0xed87('0x18')]?_0x2c386a[_0xed87('0x18')][_0xed87('0x19')]===undefined?!![]:![]:!![],'where':_0x2c386a[_0xed87('0x18')]?_0x2c386a[_0xed87('0x18')][_0xed87('0x1a')]||null:null,'attributes':_0x2c386a['options']?_0x2c386a['options']['attributes']||null:null,'limit':_0x2c386a['options']?_0x2c386a[_0xed87('0x18')]['limit']||null:null,'include':_0x2c386a[_0xed87('0x18')]?_0x2c386a[_0xed87('0x18')]['include']?_[_0xed87('0x1b')](_0x2c386a['options'][_0xed87('0x1c')],function(_0x24962e){return{'model':db[_0x24962e[_0xed87('0x1d')]],'as':_0x24962e['as'],'attributes':_0x24962e[_0xed87('0x1e')],'include':_0x24962e[_0xed87('0x1c')]?_['map'](_0x24962e[_0xed87('0x1c')],function(_0x3c22b7){return{'model':db[_0x3c22b7[_0xed87('0x1d')]],'as':_0x3c22b7['as'],'attributes':_0x3c22b7[_0xed87('0x1e')],'include':_0x3c22b7[_0xed87('0x1c')]?_[_0xed87('0x1b')](_0x3c22b7[_0xed87('0x1c')],function(_0x4735b3){return{'model':db[_0x4735b3[_0xed87('0x1d')]],'as':_0x4735b3['as'],'attributes':_0x4735b3[_0xed87('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xed87('0x9')](function(_0x341a35){logger[_0xed87('0xa')](_0xed87('0x15'),_0x2c386a);logger['debug'](_0xed87('0x15'),_0x2c386a,JSON[_0xed87('0xf')](_0x341a35));_0x5f4076(_0x341a35);})['catch'](function(_0x3dff74){logger[_0xed87('0x10')](_0xed87('0x15'),_0x3dff74['message'],_0x2c386a);_0x211085(_0xfb8a44['error'](0x1f4,_0x3dff74[_0xed87('0x12')]));});});};exports[_0xed87('0x1f')]=function(_0x21ab8a){var _0x549a19=this;return new Promise(function(_0x37d45a,_0x3b87e3){return db[_0xed87('0x16')][_0xed87('0x20')]({'raw':_0x21ab8a[_0xed87('0x18')]?_0x21ab8a[_0xed87('0x18')][_0xed87('0x19')]===undefined?!![]:![]:!![],'where':_0x21ab8a[_0xed87('0x18')]?_0x21ab8a[_0xed87('0x18')]['where']||null:null,'attributes':_0x21ab8a[_0xed87('0x18')]?_0x21ab8a[_0xed87('0x18')]['attributes']||null:null,'include':_0x21ab8a[_0xed87('0x18')]?_0x21ab8a['options'][_0xed87('0x1c')]?_[_0xed87('0x1b')](_0x21ab8a[_0xed87('0x18')][_0xed87('0x1c')],function(_0x103b34){return{'model':db[_0x103b34[_0xed87('0x1d')]],'as':_0x103b34['as'],'attributes':_0x103b34[_0xed87('0x1e')],'include':_0x103b34[_0xed87('0x1c')]?_[_0xed87('0x1b')](_0x103b34[_0xed87('0x1c')],function(_0x35c9aa){return{'model':db[_0x35c9aa['model']],'as':_0x35c9aa['as'],'attributes':_0x35c9aa[_0xed87('0x1e')],'include':_0x35c9aa[_0xed87('0x1c')]?_['map'](_0x35c9aa[_0xed87('0x1c')],function(_0x54f6cb){return{'model':db[_0x54f6cb[_0xed87('0x1d')]],'as':_0x54f6cb['as'],'attributes':_0x54f6cb[_0xed87('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x443090){logger[_0xed87('0xa')](_0xed87('0x1f'),_0x21ab8a);logger[_0xed87('0xd')](_0xed87('0x1f'),_0x21ab8a,JSON['stringify'](_0x443090));_0x37d45a(_0x443090);})[_0xed87('0x14')](function(_0x525a11){logger[_0xed87('0x10')]('ShowVtigerAccount',_0x525a11[_0xed87('0x12')],_0x21ab8a);_0x3b87e3(_0x549a19[_0xed87('0x10')](0x1f4,_0x525a11[_0xed87('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index e755625..69d8702 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 _0x5f8e=['post','create','delete','exports','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x5f8e,0x89));var _0xe5f8=function(_0xed4881,_0x45771c){_0xed4881=_0xed4881-0x0;var _0x7fcbd5=_0x5f8e[_0xed4881];return _0x7fcbd5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe5f8('0x0'));var timeout=require(_0xe5f8('0x1'));var express=require(_0xe5f8('0x2'));var router=express[_0xe5f8('0x3')]();var fs_extra=require(_0xe5f8('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe5f8('0x5'));var controller=require('./intVtigerConfiguration.controller');router[_0xe5f8('0x6')]('/',auth[_0xe5f8('0x7')](),controller[_0xe5f8('0x8')]);router[_0xe5f8('0x6')](_0xe5f8('0x9'),auth[_0xe5f8('0x7')](),controller[_0xe5f8('0xa')]);router[_0xe5f8('0x6')](_0xe5f8('0xb'),auth[_0xe5f8('0x7')](),controller['getFields']);router[_0xe5f8('0x6')](_0xe5f8('0xc'),auth[_0xe5f8('0x7')](),controller[_0xe5f8('0xd')]);router[_0xe5f8('0x6')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xe5f8('0xe')]);router[_0xe5f8('0xf')]('/',auth[_0xe5f8('0x7')](),controller[_0xe5f8('0x10')]);router['put'](_0xe5f8('0x9'),auth[_0xe5f8('0x7')](),controller['update']);router[_0xe5f8('0x11')](_0xe5f8('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xe5f8('0x12')]=router; \ No newline at end of file +var _0x2587=['express','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','destroy','multer','util','path','connect-timeout'];(function(_0x206f02,_0x36f322){var _0x8a2663=function(_0x5ac031){while(--_0x5ac031){_0x206f02['push'](_0x206f02['shift']());}};_0x8a2663(++_0x36f322);}(_0x2587,0x1ca));var _0x7258=function(_0x5e0914,_0x481afe){_0x5e0914=_0x5e0914-0x0;var _0x5eebff=_0x2587[_0x5e0914];return _0x5eebff;};'use strict';var multer=require(_0x7258('0x0'));var util=require(_0x7258('0x1'));var path=require(_0x7258('0x2'));var timeout=require(_0x7258('0x3'));var express=require(_0x7258('0x4'));var router=express['Router']();var fs_extra=require(_0x7258('0x5'));var auth=require(_0x7258('0x6'));var interaction=require(_0x7258('0x7'));var config=require('../../config/environment');var controller=require(_0x7258('0x8'));router[_0x7258('0x9')]('/',auth[_0x7258('0xa')](),controller[_0x7258('0xb')]);router[_0x7258('0x9')](_0x7258('0xc'),auth[_0x7258('0xa')](),controller[_0x7258('0xd')]);router[_0x7258('0x9')]('/:id/fields',auth[_0x7258('0xa')](),controller[_0x7258('0xe')]);router['get'](_0x7258('0xf'),auth[_0x7258('0xa')](),controller['getSubjects']);router['get'](_0x7258('0x10'),auth['isAuthenticated'](),controller[_0x7258('0x11')]);router[_0x7258('0x12')]('/',auth[_0x7258('0xa')](),controller[_0x7258('0x13')]);router[_0x7258('0x14')](_0x7258('0xc'),auth[_0x7258('0xa')](),controller['update']);router['delete'](_0x7258('0xc'),auth[_0x7258('0xa')](),controller[_0x7258('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 6267466..6ca2c33 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 _0xa7b6=['STRING','sequelize'];(function(_0x5477a9,_0x2ac104){var _0x2777e6=function(_0x3ad030){while(--_0x3ad030){_0x5477a9['push'](_0x5477a9['shift']());}};_0x2777e6(++_0x2ac104);}(_0xa7b6,0x9f));var _0x6a7b=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa7b6[_0x4709c0];return _0x13348b;};'use strict';var Sequelize=require(_0x6a7b('0x0'));module['exports']={'name':{'type':Sequelize[_0x6a7b('0x1')]},'description':{'type':Sequelize[_0x6a7b('0x1')]}}; \ No newline at end of file +var _0xed12=['STRING','exports'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xed12,0x177));var _0x2ed1=function(_0xe2b3e2,_0x56a05a){_0xe2b3e2=_0xe2b3e2-0x0;var _0x384e3f=_0xed12[_0xe2b3e2];return _0x384e3f;};'use strict';var Sequelize=require('sequelize');module[_0x2ed1('0x0')]={'name':{'type':Sequelize[_0x2ed1('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 4d96c98..56e8c14 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 _0xa8d7=['save','update','destroy','stack','name','send','map','VtigerConfiguration','rawAttributes','fieldName','type','query','keys','intersection','model','fields','attributes','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','then','rows','show','params','length','include','find','create','body','catch','getFields','findOne','VtigerField','pick','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject'];(function(_0x530871,_0x376dfa){var _0x2f0479=function(_0x521672){while(--_0x521672){_0x530871['push'](_0x530871['shift']());}};_0x2f0479(++_0x376dfa);}(_0xa8d7,0x1b8));var _0x7a8d=function(_0x1602ef,_0x447aba){_0x1602ef=_0x1602ef-0x0;var _0x5870ee=_0xa8d7[_0x1602ef];return _0x5870ee;};'use strict';var emlformat=require(_0x7a8d('0x0'));var rimraf=require(_0x7a8d('0x1'));var zipdir=require(_0x7a8d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7a8d('0x3'));var moment=require(_0x7a8d('0x4'));var BPromise=require(_0x7a8d('0x5'));var Mustache=require(_0x7a8d('0x6'));var util=require(_0x7a8d('0x7'));var path=require(_0x7a8d('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7a8d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7a8d('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7a8d('0xb'));var deskjs=require(_0x7a8d('0xc'));var toCsv=require(_0x7a8d('0xd'));var querystring=require('querystring');var Papa=require(_0x7a8d('0xe'));var Redis=require(_0x7a8d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7a8d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a8d('0x11'));var logger=require(_0x7a8d('0x12'))(_0x7a8d('0x13'));var utils=require('../../config/utils');var config=require(_0x7a8d('0x14'));var licenseUtil=require(_0x7a8d('0x15'));var db=require(_0x7a8d('0x16'))['db'];function respondWithStatusCode(_0x102270,_0x4eda02){_0x4eda02=_0x4eda02||0xcc;return function(_0x1498fd){if(_0x1498fd){return _0x102270[_0x7a8d('0x17')](_0x4eda02);}return _0x102270[_0x7a8d('0x18')](_0x4eda02)[_0x7a8d('0x19')]();};}function respondWithResult(_0x199178,_0x246c3c){_0x246c3c=_0x246c3c||0xc8;return function(_0x52e7d3){if(_0x52e7d3){return _0x199178[_0x7a8d('0x18')](_0x246c3c)['json'](_0x52e7d3);}};}function respondWithFilteredResult(_0x16cae9,_0x385156){return function(_0x22832f){if(_0x22832f){var _0x3b8bd0=typeof _0x385156[_0x7a8d('0x1a')]===_0x7a8d('0x1b')&&typeof _0x385156[_0x7a8d('0x1c')]===_0x7a8d('0x1b');var _0x4d92e0=_0x22832f[_0x7a8d('0x1d')];var _0x2ec784=_0x3b8bd0?0x0:_0x385156[_0x7a8d('0x1a')];var _0x58f6d2=_0x3b8bd0?_0x22832f[_0x7a8d('0x1d')]:_0x385156[_0x7a8d('0x1a')]+_0x385156[_0x7a8d('0x1c')];var _0x589de5;if(_0x58f6d2>=_0x4d92e0){_0x58f6d2=_0x4d92e0;_0x589de5=0xc8;}else{_0x589de5=0xce;}_0x16cae9[_0x7a8d('0x18')](_0x589de5);return _0x16cae9[_0x7a8d('0x1e')]('Content-Range',_0x2ec784+'-'+_0x58f6d2+'/'+_0x4d92e0)[_0x7a8d('0x1f')](_0x22832f);}return null;};}function patchUpdates(_0x42546d){return function(_0x12451c){try{jsonpatch[_0x7a8d('0x20')](_0x12451c,_0x42546d,!![]);}catch(_0x187953){return BPromise[_0x7a8d('0x21')](_0x187953);}return _0x12451c[_0x7a8d('0x22')]();};}function saveUpdates(_0x50bf3c,_0x56efe8){return function(_0xc029a5){if(_0xc029a5){return _0xc029a5[_0x7a8d('0x23')](_0x50bf3c)['then'](function(_0x54dc9e){return _0x54dc9e;});}return null;};}function removeEntity(_0xe9de36,_0x401894){return function(_0x30af97){if(_0x30af97){return _0x30af97[_0x7a8d('0x24')]()['then'](function(){_0xe9de36[_0x7a8d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14a69d,_0x19e10d){return function(_0x44ebdc){if(!_0x44ebdc){_0x14a69d[_0x7a8d('0x17')](0x194);}return _0x44ebdc;};}function handleError(_0x569a8e,_0x5779a8){_0x5779a8=_0x5779a8||0x1f4;return function(_0x1e7b74){logger['error'](_0x1e7b74[_0x7a8d('0x25')]);if(_0x1e7b74['name']){delete _0x1e7b74[_0x7a8d('0x26')];}_0x569a8e['status'](_0x5779a8)[_0x7a8d('0x27')](_0x1e7b74);};}exports['index']=function(_0x49d6ac,_0x1e78aa){var _0x4dd2e6={},_0x1ae521={},_0x56273e={'count':0x0,'rows':[]};var _0x121214=_[_0x7a8d('0x28')](db[_0x7a8d('0x29')][_0x7a8d('0x2a')],function(_0x22b97e){return{'name':_0x22b97e[_0x7a8d('0x2b')],'type':_0x22b97e[_0x7a8d('0x2c')]['key']};});_0x1ae521['model']=_[_0x7a8d('0x28')](_0x121214,_0x7a8d('0x26'));_0x1ae521[_0x7a8d('0x2d')]=_[_0x7a8d('0x2e')](_0x49d6ac[_0x7a8d('0x2d')]);_0x1ae521['filters']=_[_0x7a8d('0x2f')](_0x1ae521[_0x7a8d('0x30')],_0x1ae521[_0x7a8d('0x2d')]);_0x4dd2e6['attributes']=_['intersection'](_0x1ae521[_0x7a8d('0x30')],qs[_0x7a8d('0x31')](_0x49d6ac[_0x7a8d('0x2d')]['fields']));_0x4dd2e6[_0x7a8d('0x32')]=_0x4dd2e6[_0x7a8d('0x32')]['length']?_0x4dd2e6[_0x7a8d('0x32')]:_0x1ae521['model'];if(!_0x49d6ac['query']['hasOwnProperty'](_0x7a8d('0x33'))){_0x4dd2e6['limit']=qs['limit'](_0x49d6ac[_0x7a8d('0x2d')]['limit']);_0x4dd2e6['offset']=qs['offset'](_0x49d6ac['query'][_0x7a8d('0x1a')]);}_0x4dd2e6[_0x7a8d('0x34')]=qs[_0x7a8d('0x35')](_0x49d6ac[_0x7a8d('0x2d')][_0x7a8d('0x35')]);_0x4dd2e6[_0x7a8d('0x36')]=qs['filters'](_['pick'](_0x49d6ac[_0x7a8d('0x2d')],_0x1ae521[_0x7a8d('0x37')]),_0x121214);if(_0x49d6ac['query'][_0x7a8d('0x38')]){_0x4dd2e6[_0x7a8d('0x36')]=_[_0x7a8d('0x39')](_0x4dd2e6[_0x7a8d('0x36')],{'$or':_[_0x7a8d('0x28')](_0x121214,function(_0x181d16){if(_0x181d16[_0x7a8d('0x2c')]!==_0x7a8d('0x3a')){var _0xb8d453={};_0xb8d453[_0x181d16['name']]={'$like':'%'+_0x49d6ac[_0x7a8d('0x2d')][_0x7a8d('0x38')]+'%'};return _0xb8d453;}})});}_0x4dd2e6=_[_0x7a8d('0x39')]({},_0x4dd2e6,_0x49d6ac[_0x7a8d('0x3b')]);var _0x15d13a={'where':_0x4dd2e6[_0x7a8d('0x36')]};return db['VtigerConfiguration'][_0x7a8d('0x1d')](_0x15d13a)['then'](function(_0x1cff06){_0x56273e[_0x7a8d('0x1d')]=_0x1cff06;if(_0x49d6ac[_0x7a8d('0x2d')][_0x7a8d('0x3c')]){_0x4dd2e6['include']=[{'all':!![]}];}return db[_0x7a8d('0x29')][_0x7a8d('0x3d')](_0x4dd2e6);})[_0x7a8d('0x3e')](function(_0x2e9fe5){_0x56273e[_0x7a8d('0x3f')]=_0x2e9fe5;return _0x56273e;})[_0x7a8d('0x3e')](respondWithFilteredResult(_0x1e78aa,_0x4dd2e6))['catch'](handleError(_0x1e78aa,null));};exports[_0x7a8d('0x40')]=function(_0x42cdf5,_0x58c8ce){var _0xa50f31={'raw':![],'where':{'id':_0x42cdf5[_0x7a8d('0x41')]['id']}},_0xf10e5a={};_0xf10e5a[_0x7a8d('0x30')]=_[_0x7a8d('0x2e')](db[_0x7a8d('0x29')][_0x7a8d('0x2a')]);_0xf10e5a[_0x7a8d('0x2d')]=_[_0x7a8d('0x2e')](_0x42cdf5[_0x7a8d('0x2d')]);_0xf10e5a['filters']=_[_0x7a8d('0x2f')](_0xf10e5a[_0x7a8d('0x30')],_0xf10e5a[_0x7a8d('0x2d')]);_0xa50f31[_0x7a8d('0x32')]=_['intersection'](_0xf10e5a['model'],qs[_0x7a8d('0x31')](_0x42cdf5[_0x7a8d('0x2d')][_0x7a8d('0x31')]));_0xa50f31[_0x7a8d('0x32')]=_0xa50f31['attributes'][_0x7a8d('0x42')]?_0xa50f31[_0x7a8d('0x32')]:_0xf10e5a['model'];if(_0x42cdf5[_0x7a8d('0x2d')][_0x7a8d('0x3c')]){_0xa50f31[_0x7a8d('0x43')]=[{'all':!![]}];}_0xa50f31=_['merge']({},_0xa50f31,_0x42cdf5[_0x7a8d('0x3b')]);return db['VtigerConfiguration'][_0x7a8d('0x44')](_0xa50f31)[_0x7a8d('0x3e')](handleEntityNotFound(_0x58c8ce,null))[_0x7a8d('0x3e')](respondWithResult(_0x58c8ce,null))['catch'](handleError(_0x58c8ce,null));};exports[_0x7a8d('0x45')]=function(_0x41fd7e,_0x382c38){return db[_0x7a8d('0x29')][_0x7a8d('0x45')](_0x41fd7e[_0x7a8d('0x46')],{})[_0x7a8d('0x3e')](respondWithResult(_0x382c38,0xc9))[_0x7a8d('0x47')](handleError(_0x382c38,null));};exports[_0x7a8d('0x23')]=function(_0x2cbb48,_0xaf7c78){if(_0x2cbb48[_0x7a8d('0x46')]['id']){delete _0x2cbb48[_0x7a8d('0x46')]['id'];}return db['VtigerConfiguration'][_0x7a8d('0x44')]({'where':{'id':_0x2cbb48[_0x7a8d('0x41')]['id']}})[_0x7a8d('0x3e')](handleEntityNotFound(_0xaf7c78,null))[_0x7a8d('0x3e')](saveUpdates(_0x2cbb48[_0x7a8d('0x46')],null))[_0x7a8d('0x3e')](respondWithResult(_0xaf7c78,null))[_0x7a8d('0x47')](handleError(_0xaf7c78,null));};exports[_0x7a8d('0x24')]=function(_0x2036ab,_0x4bc6d1){return db[_0x7a8d('0x29')][_0x7a8d('0x44')]({'where':{'id':_0x2036ab[_0x7a8d('0x41')]['id']}})['then'](handleEntityNotFound(_0x4bc6d1,null))[_0x7a8d('0x3e')](removeEntity(_0x4bc6d1,null))[_0x7a8d('0x47')](handleError(_0x4bc6d1,null));};exports[_0x7a8d('0x48')]=function(_0x3e2884,_0x48c537,_0x3a3265){var _0x538707={};var _0x2b728e={};var _0x5499c9;var _0xe0c4e3;return db['VtigerConfiguration'][_0x7a8d('0x49')]({'where':{'id':_0x3e2884[_0x7a8d('0x41')]['id']}})[_0x7a8d('0x3e')](handleEntityNotFound(_0x48c537,null))[_0x7a8d('0x3e')](function(_0x1c6c0b){if(_0x1c6c0b){_0x5499c9=_0x1c6c0b;_0x2b728e[_0x7a8d('0x30')]=_[_0x7a8d('0x2e')](db[_0x7a8d('0x4a')][_0x7a8d('0x2a')]);_0x2b728e[_0x7a8d('0x2d')]=_['keys'](_0x3e2884['query']);_0x2b728e['filters']=_[_0x7a8d('0x2f')](_0x2b728e[_0x7a8d('0x30')],_0x2b728e[_0x7a8d('0x2d')]);_0x538707['attributes']=_[_0x7a8d('0x2f')](_0x2b728e['model'],qs[_0x7a8d('0x31')](_0x3e2884[_0x7a8d('0x2d')][_0x7a8d('0x31')]));_0x538707[_0x7a8d('0x32')]=_0x538707['attributes']['length']?_0x538707[_0x7a8d('0x32')]:_0x2b728e[_0x7a8d('0x30')];_0x538707[_0x7a8d('0x34')]=qs[_0x7a8d('0x35')](_0x3e2884[_0x7a8d('0x2d')][_0x7a8d('0x35')]);_0x538707[_0x7a8d('0x36')]=qs[_0x7a8d('0x37')](_[_0x7a8d('0x4b')](_0x3e2884['query'],_0x2b728e['filters']));if(_0x3e2884[_0x7a8d('0x2d')][_0x7a8d('0x38')]){_0x538707[_0x7a8d('0x36')]=_['merge'](_0x538707[_0x7a8d('0x36')],{'$or':_[_0x7a8d('0x28')](_0x538707[_0x7a8d('0x32')],function(_0xedb3d7){var _0x35f46d={};_0x35f46d[_0xedb3d7]={'$like':'%'+_0x3e2884[_0x7a8d('0x2d')]['filter']+'%'};return _0x35f46d;})});}_0x538707=_[_0x7a8d('0x39')]({},_0x538707,_0x3e2884['options']);return _0x5499c9[_0x7a8d('0x48')](_0x538707);}})['then'](function(_0x21d36d){if(_0x21d36d){_0xe0c4e3=_0x21d36d[_0x7a8d('0x42')];if(!_0x3e2884[_0x7a8d('0x2d')]['hasOwnProperty'](_0x7a8d('0x33'))){_0x538707['limit']=qs[_0x7a8d('0x1c')](_0x3e2884[_0x7a8d('0x2d')][_0x7a8d('0x1c')]);_0x538707[_0x7a8d('0x1a')]=qs[_0x7a8d('0x1a')](_0x3e2884[_0x7a8d('0x2d')][_0x7a8d('0x1a')]);}return _0x5499c9[_0x7a8d('0x48')](_0x538707);}})[_0x7a8d('0x3e')](function(_0x49dcd0){if(_0x49dcd0){return _0x49dcd0?{'count':_0xe0c4e3,'rows':_0x49dcd0}:null;}})[_0x7a8d('0x3e')](respondWithResult(_0x48c537,null))[_0x7a8d('0x47')](handleError(_0x48c537,null));};exports[_0x7a8d('0x4c')]=function(_0x369c13,_0xa9574d,_0x28c386){var _0x48e1d3={};var _0x51d3cc={};var _0x345093;var _0x5c5272;return db[_0x7a8d('0x29')][_0x7a8d('0x49')]({'where':{'id':_0x369c13[_0x7a8d('0x41')]['id']}})[_0x7a8d('0x3e')](handleEntityNotFound(_0xa9574d,null))[_0x7a8d('0x3e')](function(_0x195282){if(_0x195282){_0x345093=_0x195282;_0x51d3cc[_0x7a8d('0x30')]=_['keys'](db[_0x7a8d('0x4a')][_0x7a8d('0x2a')]);_0x51d3cc[_0x7a8d('0x2d')]=_[_0x7a8d('0x2e')](_0x369c13[_0x7a8d('0x2d')]);_0x51d3cc[_0x7a8d('0x37')]=_[_0x7a8d('0x2f')](_0x51d3cc[_0x7a8d('0x30')],_0x51d3cc['query']);_0x48e1d3[_0x7a8d('0x32')]=_[_0x7a8d('0x2f')](_0x51d3cc[_0x7a8d('0x30')],qs[_0x7a8d('0x31')](_0x369c13[_0x7a8d('0x2d')][_0x7a8d('0x31')]));_0x48e1d3['attributes']=_0x48e1d3[_0x7a8d('0x32')][_0x7a8d('0x42')]?_0x48e1d3['attributes']:_0x51d3cc[_0x7a8d('0x30')];_0x48e1d3['order']=qs[_0x7a8d('0x35')](_0x369c13[_0x7a8d('0x2d')][_0x7a8d('0x35')]);_0x48e1d3['where']=qs[_0x7a8d('0x37')](_[_0x7a8d('0x4b')](_0x369c13[_0x7a8d('0x2d')],_0x51d3cc[_0x7a8d('0x37')]));if(_0x369c13[_0x7a8d('0x2d')][_0x7a8d('0x38')]){_0x48e1d3[_0x7a8d('0x36')]=_[_0x7a8d('0x39')](_0x48e1d3[_0x7a8d('0x36')],{'$or':_[_0x7a8d('0x28')](_0x48e1d3['attributes'],function(_0x50e885){var _0x271843={};_0x271843[_0x50e885]={'$like':'%'+_0x369c13[_0x7a8d('0x2d')]['filter']+'%'};return _0x271843;})});}_0x48e1d3=_[_0x7a8d('0x39')]({},_0x48e1d3,_0x369c13[_0x7a8d('0x3b')]);return _0x345093[_0x7a8d('0x4c')](_0x48e1d3);}})[_0x7a8d('0x3e')](function(_0xaf0cc9){if(_0xaf0cc9){_0x5c5272=_0xaf0cc9[_0x7a8d('0x42')];if(!_0x369c13[_0x7a8d('0x2d')][_0x7a8d('0x4d')](_0x7a8d('0x33'))){_0x48e1d3[_0x7a8d('0x1c')]=qs[_0x7a8d('0x1c')](_0x369c13['query'][_0x7a8d('0x1c')]);_0x48e1d3[_0x7a8d('0x1a')]=qs[_0x7a8d('0x1a')](_0x369c13['query'][_0x7a8d('0x1a')]);}return _0x345093[_0x7a8d('0x4c')](_0x48e1d3);}})['then'](function(_0x5ea7b5){if(_0x5ea7b5){return _0x5ea7b5?{'count':_0x5c5272,'rows':_0x5ea7b5}:null;}})['then'](respondWithResult(_0xa9574d,null))[_0x7a8d('0x47')](handleError(_0xa9574d,null));};exports[_0x7a8d('0x4e')]=function(_0x50252e,_0x3b5d1a,_0x52b1eb){var _0x181b53={};var _0x5cb0b0={};var _0x1d687a;var _0x2881dc;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x50252e[_0x7a8d('0x41')]['id']}})[_0x7a8d('0x3e')](handleEntityNotFound(_0x3b5d1a,null))[_0x7a8d('0x3e')](function(_0x3dddc8){if(_0x3dddc8){_0x1d687a=_0x3dddc8;_0x5cb0b0[_0x7a8d('0x30')]=_[_0x7a8d('0x2e')](db['VtigerField'][_0x7a8d('0x2a')]);_0x5cb0b0[_0x7a8d('0x2d')]=_[_0x7a8d('0x2e')](_0x50252e[_0x7a8d('0x2d')]);_0x5cb0b0[_0x7a8d('0x37')]=_['intersection'](_0x5cb0b0['model'],_0x5cb0b0[_0x7a8d('0x2d')]);_0x181b53[_0x7a8d('0x32')]=_['intersection'](_0x5cb0b0['model'],qs[_0x7a8d('0x31')](_0x50252e[_0x7a8d('0x2d')]['fields']));_0x181b53['attributes']=_0x181b53[_0x7a8d('0x32')][_0x7a8d('0x42')]?_0x181b53[_0x7a8d('0x32')]:_0x5cb0b0[_0x7a8d('0x30')];_0x181b53[_0x7a8d('0x34')]=qs[_0x7a8d('0x35')](_0x50252e['query'][_0x7a8d('0x35')]);_0x181b53['where']=qs[_0x7a8d('0x37')](_['pick'](_0x50252e[_0x7a8d('0x2d')],_0x5cb0b0[_0x7a8d('0x37')]));if(_0x50252e[_0x7a8d('0x2d')][_0x7a8d('0x38')]){_0x181b53['where']=_['merge'](_0x181b53[_0x7a8d('0x36')],{'$or':_[_0x7a8d('0x28')](_0x181b53[_0x7a8d('0x32')],function(_0x4818bb){var _0x48b0a3={};_0x48b0a3[_0x4818bb]={'$like':'%'+_0x50252e[_0x7a8d('0x2d')][_0x7a8d('0x38')]+'%'};return _0x48b0a3;})});}_0x181b53=_[_0x7a8d('0x39')]({},_0x181b53,_0x50252e[_0x7a8d('0x3b')]);return _0x1d687a[_0x7a8d('0x4e')](_0x181b53);}})[_0x7a8d('0x3e')](function(_0xb4ee1){if(_0xb4ee1){_0x2881dc=_0xb4ee1[_0x7a8d('0x42')];if(!_0x50252e[_0x7a8d('0x2d')][_0x7a8d('0x4d')]('nolimit')){_0x181b53[_0x7a8d('0x1c')]=qs[_0x7a8d('0x1c')](_0x50252e[_0x7a8d('0x2d')][_0x7a8d('0x1c')]);_0x181b53[_0x7a8d('0x1a')]=qs[_0x7a8d('0x1a')](_0x50252e['query'][_0x7a8d('0x1a')]);}return _0x1d687a['getDescriptions'](_0x181b53);}})['then'](function(_0xe24303){if(_0xe24303){return _0xe24303?{'count':_0x2881dc,'rows':_0xe24303}:null;}})[_0x7a8d('0x3e')](respondWithResult(_0x3b5d1a,null))[_0x7a8d('0x47')](handleError(_0x3b5d1a,null));}; \ No newline at end of file +var _0xf2e2=['util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','VtigerConfiguration','findAll','catch','params','keys','includeAll','include','find','create','body','getFields','findOne','VtigerField','options','hasOwnProperty','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache'];(function(_0x48a928,_0x430727){var _0x11c1e9=function(_0x338805){while(--_0x338805){_0x48a928['push'](_0x48a928['shift']());}};_0x11c1e9(++_0x430727);}(_0xf2e2,0x1ce));var _0x2f2e=function(_0x37ed92,_0x8e5252){_0x37ed92=_0x37ed92-0x0;var _0x5a1125=_0xf2e2[_0x37ed92];return _0x5a1125;};'use strict';var emlformat=require(_0x2f2e('0x0'));var rimraf=require(_0x2f2e('0x1'));var zipdir=require(_0x2f2e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2f2e('0x3'));var moment=require('moment');var BPromise=require(_0x2f2e('0x4'));var Mustache=require(_0x2f2e('0x5'));var util=require(_0x2f2e('0x6'));var path=require(_0x2f2e('0x7'));var sox=require(_0x2f2e('0x8'));var csv=require(_0x2f2e('0x9'));var ejs=require(_0x2f2e('0xa'));var fs=require('fs');var fs_extra=require(_0x2f2e('0xb'));var _=require('lodash');var squel=require(_0x2f2e('0xc'));var crypto=require(_0x2f2e('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2f2e('0x9'));var querystring=require(_0x2f2e('0xe'));var Papa=require(_0x2f2e('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2f2e('0x10'));var as=require(_0x2f2e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2f2e('0x12'));var utils=require(_0x2f2e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2f2e('0x14'));var db=require(_0x2f2e('0x15'))['db'];function respondWithStatusCode(_0x29361f,_0x5b8e24){_0x5b8e24=_0x5b8e24||0xcc;return function(_0x1c2f93){if(_0x1c2f93){return _0x29361f[_0x2f2e('0x16')](_0x5b8e24);}return _0x29361f[_0x2f2e('0x17')](_0x5b8e24)[_0x2f2e('0x18')]();};}function respondWithResult(_0x5aca0e,_0x49a993){_0x49a993=_0x49a993||0xc8;return function(_0x2cd121){if(_0x2cd121){return _0x5aca0e[_0x2f2e('0x17')](_0x49a993)[_0x2f2e('0x19')](_0x2cd121);}};}function respondWithFilteredResult(_0x5de20,_0x1664f8){return function(_0x4cf3dc){if(_0x4cf3dc){var _0x3fcdb8=typeof _0x1664f8['offset']==='undefined'&&typeof _0x1664f8[_0x2f2e('0x1a')]===_0x2f2e('0x1b');var _0x100cb2=_0x4cf3dc[_0x2f2e('0x1c')];var _0x1347c5=_0x3fcdb8?0x0:_0x1664f8[_0x2f2e('0x1d')];var _0x452dd6=_0x3fcdb8?_0x4cf3dc['count']:_0x1664f8[_0x2f2e('0x1d')]+_0x1664f8['limit'];var _0x504589;if(_0x452dd6>=_0x100cb2){_0x452dd6=_0x100cb2;_0x504589=0xc8;}else{_0x504589=0xce;}_0x5de20['status'](_0x504589);return _0x5de20[_0x2f2e('0x1e')](_0x2f2e('0x1f'),_0x1347c5+'-'+_0x452dd6+'/'+_0x100cb2)[_0x2f2e('0x19')](_0x4cf3dc);}return null;};}function patchUpdates(_0x5674b8){return function(_0x34b5ac){try{jsonpatch[_0x2f2e('0x20')](_0x34b5ac,_0x5674b8,!![]);}catch(_0x138146){return BPromise[_0x2f2e('0x21')](_0x138146);}return _0x34b5ac[_0x2f2e('0x22')]();};}function saveUpdates(_0x1d5b01,_0x4ff3db){return function(_0x77f6d5){if(_0x77f6d5){return _0x77f6d5[_0x2f2e('0x23')](_0x1d5b01)[_0x2f2e('0x24')](function(_0x5637b0){return _0x5637b0;});}return null;};}function removeEntity(_0x671e39,_0x88b99f){return function(_0x50920a){if(_0x50920a){return _0x50920a[_0x2f2e('0x25')]()['then'](function(){_0x671e39[_0x2f2e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x238071,_0x849a62){return function(_0x368244){if(!_0x368244){_0x238071[_0x2f2e('0x16')](0x194);}return _0x368244;};}function handleError(_0x250f42,_0x15f374){_0x15f374=_0x15f374||0x1f4;return function(_0x1e78cf){logger['error'](_0x1e78cf[_0x2f2e('0x26')]);if(_0x1e78cf[_0x2f2e('0x27')]){delete _0x1e78cf[_0x2f2e('0x27')];}_0x250f42[_0x2f2e('0x17')](_0x15f374)[_0x2f2e('0x28')](_0x1e78cf);};}exports[_0x2f2e('0x29')]=function(_0x5f5a79,_0x5f9ee1){var _0x374bee={},_0x1de4f5={},_0x4a34f5={'count':0x0,'rows':[]};var _0x281d48=_['map'](db['VtigerConfiguration'][_0x2f2e('0x2a')],function(_0x373e05){return{'name':_0x373e05['fieldName'],'type':_0x373e05[_0x2f2e('0x2b')][_0x2f2e('0x2c')]};});_0x1de4f5[_0x2f2e('0x2d')]=_[_0x2f2e('0x2e')](_0x281d48,_0x2f2e('0x27'));_0x1de4f5[_0x2f2e('0x2f')]=_['keys'](_0x5f5a79[_0x2f2e('0x2f')]);_0x1de4f5[_0x2f2e('0x30')]=_[_0x2f2e('0x31')](_0x1de4f5[_0x2f2e('0x2d')],_0x1de4f5[_0x2f2e('0x2f')]);_0x374bee[_0x2f2e('0x32')]=_['intersection'](_0x1de4f5[_0x2f2e('0x2d')],qs[_0x2f2e('0x33')](_0x5f5a79[_0x2f2e('0x2f')]['fields']));_0x374bee[_0x2f2e('0x32')]=_0x374bee[_0x2f2e('0x32')][_0x2f2e('0x34')]?_0x374bee[_0x2f2e('0x32')]:_0x1de4f5[_0x2f2e('0x2d')];if(!_0x5f5a79['query']['hasOwnProperty'](_0x2f2e('0x35'))){_0x374bee['limit']=qs[_0x2f2e('0x1a')](_0x5f5a79['query'][_0x2f2e('0x1a')]);_0x374bee[_0x2f2e('0x1d')]=qs[_0x2f2e('0x1d')](_0x5f5a79[_0x2f2e('0x2f')]['offset']);}_0x374bee['order']=qs[_0x2f2e('0x36')](_0x5f5a79[_0x2f2e('0x2f')][_0x2f2e('0x36')]);_0x374bee[_0x2f2e('0x37')]=qs[_0x2f2e('0x30')](_[_0x2f2e('0x38')](_0x5f5a79[_0x2f2e('0x2f')],_0x1de4f5[_0x2f2e('0x30')]),_0x281d48);if(_0x5f5a79[_0x2f2e('0x2f')]['filter']){_0x374bee[_0x2f2e('0x37')]=_[_0x2f2e('0x39')](_0x374bee[_0x2f2e('0x37')],{'$or':_[_0x2f2e('0x2e')](_0x281d48,function(_0x539a33){if(_0x539a33[_0x2f2e('0x2b')]!==_0x2f2e('0x3a')){var _0x4727a1={};_0x4727a1[_0x539a33[_0x2f2e('0x27')]]={'$like':'%'+_0x5f5a79[_0x2f2e('0x2f')][_0x2f2e('0x3b')]+'%'};return _0x4727a1;}})});}_0x374bee=_['merge']({},_0x374bee,_0x5f5a79['options']);var _0x535c89={'where':_0x374bee['where']};return db[_0x2f2e('0x3c')][_0x2f2e('0x1c')](_0x535c89)[_0x2f2e('0x24')](function(_0x167ecb){_0x4a34f5[_0x2f2e('0x1c')]=_0x167ecb;if(_0x5f5a79['query']['includeAll']){_0x374bee['include']=[{'all':!![]}];}return db[_0x2f2e('0x3c')][_0x2f2e('0x3d')](_0x374bee);})[_0x2f2e('0x24')](function(_0x3255e4){_0x4a34f5['rows']=_0x3255e4;return _0x4a34f5;})[_0x2f2e('0x24')](respondWithFilteredResult(_0x5f9ee1,_0x374bee))[_0x2f2e('0x3e')](handleError(_0x5f9ee1,null));};exports['show']=function(_0x4ebaef,_0x325caf){var _0x4d081a={'raw':![],'where':{'id':_0x4ebaef[_0x2f2e('0x3f')]['id']}},_0x54a6e5={};_0x54a6e5['model']=_[_0x2f2e('0x40')](db['VtigerConfiguration'][_0x2f2e('0x2a')]);_0x54a6e5[_0x2f2e('0x2f')]=_[_0x2f2e('0x40')](_0x4ebaef[_0x2f2e('0x2f')]);_0x54a6e5[_0x2f2e('0x30')]=_[_0x2f2e('0x31')](_0x54a6e5[_0x2f2e('0x2d')],_0x54a6e5[_0x2f2e('0x2f')]);_0x4d081a[_0x2f2e('0x32')]=_['intersection'](_0x54a6e5[_0x2f2e('0x2d')],qs[_0x2f2e('0x33')](_0x4ebaef[_0x2f2e('0x2f')]['fields']));_0x4d081a[_0x2f2e('0x32')]=_0x4d081a[_0x2f2e('0x32')][_0x2f2e('0x34')]?_0x4d081a['attributes']:_0x54a6e5[_0x2f2e('0x2d')];if(_0x4ebaef[_0x2f2e('0x2f')][_0x2f2e('0x41')]){_0x4d081a[_0x2f2e('0x42')]=[{'all':!![]}];}_0x4d081a=_[_0x2f2e('0x39')]({},_0x4d081a,_0x4ebaef['options']);return db[_0x2f2e('0x3c')][_0x2f2e('0x43')](_0x4d081a)['then'](handleEntityNotFound(_0x325caf,null))['then'](respondWithResult(_0x325caf,null))['catch'](handleError(_0x325caf,null));};exports[_0x2f2e('0x44')]=function(_0x411004,_0x5c498b){return db[_0x2f2e('0x3c')]['create'](_0x411004[_0x2f2e('0x45')],{})[_0x2f2e('0x24')](respondWithResult(_0x5c498b,0xc9))[_0x2f2e('0x3e')](handleError(_0x5c498b,null));};exports[_0x2f2e('0x23')]=function(_0x211e5f,_0xab40){if(_0x211e5f[_0x2f2e('0x45')]['id']){delete _0x211e5f[_0x2f2e('0x45')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x211e5f[_0x2f2e('0x3f')]['id']}})[_0x2f2e('0x24')](handleEntityNotFound(_0xab40,null))[_0x2f2e('0x24')](saveUpdates(_0x211e5f[_0x2f2e('0x45')],null))[_0x2f2e('0x24')](respondWithResult(_0xab40,null))[_0x2f2e('0x3e')](handleError(_0xab40,null));};exports[_0x2f2e('0x25')]=function(_0x5a53cc,_0x3abe2e){return db[_0x2f2e('0x3c')][_0x2f2e('0x43')]({'where':{'id':_0x5a53cc[_0x2f2e('0x3f')]['id']}})[_0x2f2e('0x24')](handleEntityNotFound(_0x3abe2e,null))[_0x2f2e('0x24')](removeEntity(_0x3abe2e,null))[_0x2f2e('0x3e')](handleError(_0x3abe2e,null));};exports[_0x2f2e('0x46')]=function(_0x48ac4d,_0x5c72f2,_0xe3616b){var _0x18935c={};var _0x3db5e5={};var _0x2affa9;var _0x384303;return db[_0x2f2e('0x3c')][_0x2f2e('0x47')]({'where':{'id':_0x48ac4d['params']['id']}})[_0x2f2e('0x24')](handleEntityNotFound(_0x5c72f2,null))[_0x2f2e('0x24')](function(_0x49569e){if(_0x49569e){_0x2affa9=_0x49569e;_0x3db5e5['model']=_['keys'](db[_0x2f2e('0x48')][_0x2f2e('0x2a')]);_0x3db5e5[_0x2f2e('0x2f')]=_[_0x2f2e('0x40')](_0x48ac4d[_0x2f2e('0x2f')]);_0x3db5e5[_0x2f2e('0x30')]=_['intersection'](_0x3db5e5[_0x2f2e('0x2d')],_0x3db5e5[_0x2f2e('0x2f')]);_0x18935c['attributes']=_[_0x2f2e('0x31')](_0x3db5e5[_0x2f2e('0x2d')],qs['fields'](_0x48ac4d[_0x2f2e('0x2f')]['fields']));_0x18935c['attributes']=_0x18935c[_0x2f2e('0x32')]['length']?_0x18935c['attributes']:_0x3db5e5[_0x2f2e('0x2d')];_0x18935c['order']=qs[_0x2f2e('0x36')](_0x48ac4d[_0x2f2e('0x2f')]['sort']);_0x18935c[_0x2f2e('0x37')]=qs[_0x2f2e('0x30')](_['pick'](_0x48ac4d[_0x2f2e('0x2f')],_0x3db5e5[_0x2f2e('0x30')]));if(_0x48ac4d[_0x2f2e('0x2f')][_0x2f2e('0x3b')]){_0x18935c[_0x2f2e('0x37')]=_[_0x2f2e('0x39')](_0x18935c['where'],{'$or':_[_0x2f2e('0x2e')](_0x18935c[_0x2f2e('0x32')],function(_0x36ba06){var _0x25f4f9={};_0x25f4f9[_0x36ba06]={'$like':'%'+_0x48ac4d[_0x2f2e('0x2f')][_0x2f2e('0x3b')]+'%'};return _0x25f4f9;})});}_0x18935c=_['merge']({},_0x18935c,_0x48ac4d[_0x2f2e('0x49')]);return _0x2affa9[_0x2f2e('0x46')](_0x18935c);}})[_0x2f2e('0x24')](function(_0x3fcd78){if(_0x3fcd78){_0x384303=_0x3fcd78[_0x2f2e('0x34')];if(!_0x48ac4d[_0x2f2e('0x2f')][_0x2f2e('0x4a')](_0x2f2e('0x35'))){_0x18935c[_0x2f2e('0x1a')]=qs['limit'](_0x48ac4d[_0x2f2e('0x2f')][_0x2f2e('0x1a')]);_0x18935c['offset']=qs['offset'](_0x48ac4d[_0x2f2e('0x2f')][_0x2f2e('0x1d')]);}return _0x2affa9[_0x2f2e('0x46')](_0x18935c);}})['then'](function(_0x3fa61d){if(_0x3fa61d){return _0x3fa61d?{'count':_0x384303,'rows':_0x3fa61d}:null;}})[_0x2f2e('0x24')](respondWithResult(_0x5c72f2,null))['catch'](handleError(_0x5c72f2,null));};exports['getSubjects']=function(_0x195e95,_0x4bb840,_0x14886a){var _0x586225={};var _0xbb24={};var _0x331126;var _0x1076ba;return db[_0x2f2e('0x3c')][_0x2f2e('0x47')]({'where':{'id':_0x195e95[_0x2f2e('0x3f')]['id']}})[_0x2f2e('0x24')](handleEntityNotFound(_0x4bb840,null))[_0x2f2e('0x24')](function(_0x1acab9){if(_0x1acab9){_0x331126=_0x1acab9;_0xbb24['model']=_['keys'](db[_0x2f2e('0x48')]['rawAttributes']);_0xbb24[_0x2f2e('0x2f')]=_[_0x2f2e('0x40')](_0x195e95['query']);_0xbb24[_0x2f2e('0x30')]=_[_0x2f2e('0x31')](_0xbb24[_0x2f2e('0x2d')],_0xbb24[_0x2f2e('0x2f')]);_0x586225[_0x2f2e('0x32')]=_[_0x2f2e('0x31')](_0xbb24[_0x2f2e('0x2d')],qs[_0x2f2e('0x33')](_0x195e95[_0x2f2e('0x2f')][_0x2f2e('0x33')]));_0x586225['attributes']=_0x586225[_0x2f2e('0x32')][_0x2f2e('0x34')]?_0x586225[_0x2f2e('0x32')]:_0xbb24[_0x2f2e('0x2d')];_0x586225[_0x2f2e('0x4b')]=qs['sort'](_0x195e95[_0x2f2e('0x2f')][_0x2f2e('0x36')]);_0x586225[_0x2f2e('0x37')]=qs[_0x2f2e('0x30')](_[_0x2f2e('0x38')](_0x195e95['query'],_0xbb24['filters']));if(_0x195e95[_0x2f2e('0x2f')][_0x2f2e('0x3b')]){_0x586225[_0x2f2e('0x37')]=_['merge'](_0x586225['where'],{'$or':_[_0x2f2e('0x2e')](_0x586225['attributes'],function(_0x2309f9){var _0x46dbe2={};_0x46dbe2[_0x2309f9]={'$like':'%'+_0x195e95['query'][_0x2f2e('0x3b')]+'%'};return _0x46dbe2;})});}_0x586225=_[_0x2f2e('0x39')]({},_0x586225,_0x195e95['options']);return _0x331126[_0x2f2e('0x4c')](_0x586225);}})['then'](function(_0x5465ee){if(_0x5465ee){_0x1076ba=_0x5465ee[_0x2f2e('0x34')];if(!_0x195e95['query'][_0x2f2e('0x4a')](_0x2f2e('0x35'))){_0x586225[_0x2f2e('0x1a')]=qs[_0x2f2e('0x1a')](_0x195e95[_0x2f2e('0x2f')][_0x2f2e('0x1a')]);_0x586225[_0x2f2e('0x1d')]=qs[_0x2f2e('0x1d')](_0x195e95[_0x2f2e('0x2f')][_0x2f2e('0x1d')]);}return _0x331126[_0x2f2e('0x4c')](_0x586225);}})[_0x2f2e('0x24')](function(_0x246cfb){if(_0x246cfb){return _0x246cfb?{'count':_0x1076ba,'rows':_0x246cfb}:null;}})['then'](respondWithResult(_0x4bb840,null))['catch'](handleError(_0x4bb840,null));};exports[_0x2f2e('0x4d')]=function(_0xf52a67,_0x38d434,_0x2db6ae){var _0x37e472={};var _0x6ddc06={};var _0x39cd60;var _0x57f0a6;return db['VtigerConfiguration'][_0x2f2e('0x47')]({'where':{'id':_0xf52a67[_0x2f2e('0x3f')]['id']}})[_0x2f2e('0x24')](handleEntityNotFound(_0x38d434,null))[_0x2f2e('0x24')](function(_0x55c4ff){if(_0x55c4ff){_0x39cd60=_0x55c4ff;_0x6ddc06[_0x2f2e('0x2d')]=_[_0x2f2e('0x40')](db[_0x2f2e('0x48')][_0x2f2e('0x2a')]);_0x6ddc06[_0x2f2e('0x2f')]=_[_0x2f2e('0x40')](_0xf52a67['query']);_0x6ddc06[_0x2f2e('0x30')]=_[_0x2f2e('0x31')](_0x6ddc06['model'],_0x6ddc06['query']);_0x37e472['attributes']=_[_0x2f2e('0x31')](_0x6ddc06[_0x2f2e('0x2d')],qs['fields'](_0xf52a67[_0x2f2e('0x2f')][_0x2f2e('0x33')]));_0x37e472['attributes']=_0x37e472['attributes'][_0x2f2e('0x34')]?_0x37e472['attributes']:_0x6ddc06[_0x2f2e('0x2d')];_0x37e472['order']=qs[_0x2f2e('0x36')](_0xf52a67[_0x2f2e('0x2f')]['sort']);_0x37e472[_0x2f2e('0x37')]=qs['filters'](_['pick'](_0xf52a67[_0x2f2e('0x2f')],_0x6ddc06[_0x2f2e('0x30')]));if(_0xf52a67[_0x2f2e('0x2f')]['filter']){_0x37e472['where']=_['merge'](_0x37e472[_0x2f2e('0x37')],{'$or':_[_0x2f2e('0x2e')](_0x37e472[_0x2f2e('0x32')],function(_0x3f36b2){var _0x585d30={};_0x585d30[_0x3f36b2]={'$like':'%'+_0xf52a67['query'][_0x2f2e('0x3b')]+'%'};return _0x585d30;})});}_0x37e472=_[_0x2f2e('0x39')]({},_0x37e472,_0xf52a67['options']);return _0x39cd60[_0x2f2e('0x4d')](_0x37e472);}})['then'](function(_0x392694){if(_0x392694){_0x57f0a6=_0x392694[_0x2f2e('0x34')];if(!_0xf52a67['query'][_0x2f2e('0x4a')](_0x2f2e('0x35'))){_0x37e472[_0x2f2e('0x1a')]=qs[_0x2f2e('0x1a')](_0xf52a67[_0x2f2e('0x2f')][_0x2f2e('0x1a')]);_0x37e472['offset']=qs[_0x2f2e('0x1d')](_0xf52a67[_0x2f2e('0x2f')][_0x2f2e('0x1d')]);}return _0x39cd60['getDescriptions'](_0x37e472);}})['then'](function(_0x353f7c){if(_0x353f7c){return _0x353f7c?{'count':_0x57f0a6,'rows':_0x353f7c}:null;}})[_0x2f2e('0x24')](respondWithResult(_0x38d434,null))[_0x2f2e('0x3e')](handleError(_0x38d434,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index f08b3a3..56cd91c 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 _0x0e88=['bluebird','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','lodash','util','moment'];(function(_0xd4c417,_0x3ea1a6){var _0x2111b4=function(_0x244462){while(--_0x244462){_0xd4c417['push'](_0xd4c417['shift']());}};_0x2111b4(++_0x3ea1a6);}(_0x0e88,0x105));var _0x80e8=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0e88[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x80e8('0x0'));var util=require(_0x80e8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x80e8('0x2'));var BPromise=require(_0x80e8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x80e8('0x4'));var rimraf=require(_0x80e8('0x5'));var config=require(_0x80e8('0x6'));var attributes=require(_0x80e8('0x7'));module[_0x80e8('0x8')]=function(_0x41c59c,_0x57e9ea){return _0x41c59c[_0x80e8('0x9')](_0x80e8('0xa'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4df8=['VtigerConfiguration','int_vtiger_configurations','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define'];(function(_0x495630,_0x44449a){var _0x3da3ff=function(_0x133d91){while(--_0x133d91){_0x495630['push'](_0x495630['shift']());}};_0x3da3ff(++_0x44449a);}(_0x4df8,0xf2));var _0x84df=function(_0x5e3342,_0x5ceda0){_0x5e3342=_0x5e3342-0x0;var _0x572836=_0x4df8[_0x5e3342];return _0x572836;};'use strict';var _=require(_0x84df('0x0'));var util=require(_0x84df('0x1'));var logger=require('../../config/logger')(_0x84df('0x2'));var moment=require(_0x84df('0x3'));var BPromise=require(_0x84df('0x4'));var rp=require(_0x84df('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x84df('0x6'));var config=require(_0x84df('0x7'));var attributes=require(_0x84df('0x8'));module['exports']=function(_0x2ed108,_0x48e873){return _0x2ed108[_0x84df('0x9')](_0x84df('0xa'),attributes,{'tableName':_0x84df('0xb'),'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 11328d7..ec3c614 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 _0x1c21=['request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x45004f,_0x488dc8){var _0x53b0c9=function(_0x42caf8){while(--_0x42caf8){_0x45004f['push'](_0x45004f['shift']());}};_0x53b0c9(++_0x488dc8);}(_0x1c21,0xdd));var _0x11c2=function(_0x5ee929,_0x3ea8f){_0x5ee929=_0x5ee929-0x0;var _0x4881d0=_0x1c21[_0x5ee929];return _0x4881d0;};'use strict';var _=require(_0x11c2('0x0'));var util=require(_0x11c2('0x1'));var moment=require(_0x11c2('0x2'));var BPromise=require(_0x11c2('0x3'));var rs=require(_0x11c2('0x4'));var fs=require('fs');var Redis=require(_0x11c2('0x5'));var db=require(_0x11c2('0x6'))['db'];var utils=require(_0x11c2('0x7'));var logger=require(_0x11c2('0x8'))('rpc');var config=require(_0x11c2('0x9'));var jayson=require(_0x11c2('0xa'));var client=jayson[_0x11c2('0xb')][_0x11c2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c772f,_0x593d0d,_0x51e937){return new BPromise(function(_0x9cbef1,_0xd9a11d){return client[_0x11c2('0xd')](_0x5c772f,_0x51e937)[_0x11c2('0xe')](function(_0x4f7d79){logger[_0x11c2('0xf')](_0x11c2('0x10'),_0x593d0d,_0x11c2('0x11'));logger[_0x11c2('0x12')](_0x11c2('0x13'),_0x593d0d,'request\x20sent',JSON[_0x11c2('0x14')](_0x4f7d79));if(_0x4f7d79[_0x11c2('0x15')]){if(_0x4f7d79['error'][_0x11c2('0x16')]===0x1f4){logger[_0x11c2('0x15')](_0x11c2('0x10'),_0x593d0d,_0x4f7d79[_0x11c2('0x15')]['message']);return _0xd9a11d(_0x4f7d79[_0x11c2('0x15')][_0x11c2('0x17')]);}logger[_0x11c2('0x15')]('VtigerConfiguration,\x20%s,\x20%s',_0x593d0d,_0x4f7d79[_0x11c2('0x15')][_0x11c2('0x17')]);return _0x9cbef1(_0x4f7d79[_0x11c2('0x15')]['message']);}else{logger[_0x11c2('0xf')](_0x11c2('0x10'),_0x593d0d,_0x11c2('0x11'));_0x9cbef1(_0x4f7d79[_0x11c2('0x18')][_0x11c2('0x17')]);}})[_0x11c2('0x19')](function(_0x4994d0){logger[_0x11c2('0x15')](_0x11c2('0x10'),_0x593d0d,_0x4994d0);_0xd9a11d(_0x4994d0);});});} \ No newline at end of file +var _0x8d7d=['message','VtigerConfiguration,\x20%s,\x20%s','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1e8690,_0x5c6b4c){var _0x414bea=function(_0x6284dd){while(--_0x6284dd){_0x1e8690['push'](_0x1e8690['shift']());}};_0x414bea(++_0x5c6b4c);}(_0x8d7d,0x1b8));var _0xd8d7=function(_0x338328,_0x3d5c10){_0x338328=_0x338328-0x0;var _0x127e38=_0x8d7d[_0x338328];return _0x127e38;};'use strict';var _=require('lodash');var util=require(_0xd8d7('0x0'));var moment=require(_0xd8d7('0x1'));var BPromise=require(_0xd8d7('0x2'));var rs=require(_0xd8d7('0x3'));var fs=require('fs');var Redis=require(_0xd8d7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd8d7('0x5'));var logger=require(_0xd8d7('0x6'))(_0xd8d7('0x7'));var config=require(_0xd8d7('0x8'));var jayson=require(_0xd8d7('0x9'));var client=jayson[_0xd8d7('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x506db0,_0x724265,_0x2aa0bf){return new BPromise(function(_0x213fe4,_0x2f5c8a){return client[_0xd8d7('0xb')](_0x506db0,_0x2aa0bf)[_0xd8d7('0xc')](function(_0x25e0e6){logger[_0xd8d7('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x724265,_0xd8d7('0xe'));logger[_0xd8d7('0xf')](_0xd8d7('0x10'),_0x724265,'request\x20sent',JSON[_0xd8d7('0x11')](_0x25e0e6));if(_0x25e0e6['error']){if(_0x25e0e6[_0xd8d7('0x12')][_0xd8d7('0x13')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x724265,_0x25e0e6[_0xd8d7('0x12')]['message']);return _0x2f5c8a(_0x25e0e6[_0xd8d7('0x12')][_0xd8d7('0x14')]);}logger[_0xd8d7('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x724265,_0x25e0e6[_0xd8d7('0x12')][_0xd8d7('0x14')]);return _0x213fe4(_0x25e0e6[_0xd8d7('0x12')]['message']);}else{logger[_0xd8d7('0xd')](_0xd8d7('0x15'),_0x724265,_0xd8d7('0xe'));_0x213fe4(_0x25e0e6[_0xd8d7('0x16')][_0xd8d7('0x14')]);}})['catch'](function(_0x59a4e2){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x724265,_0x59a4e2);_0x2f5c8a(_0x59a4e2);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 2ea922d..73d91ff 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 _0x5273=['delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','index','/:id','isAuthenticated','show','post','create','put'];(function(_0x4fe4d2,_0x7995c4){var _0x56541d=function(_0x3542f5){while(--_0x3542f5){_0x4fe4d2['push'](_0x4fe4d2['shift']());}};_0x56541d(++_0x7995c4);}(_0x5273,0x1f0));var _0x3527=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5273[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x3527('0x0'));var path=require(_0x3527('0x1'));var timeout=require(_0x3527('0x2'));var express=require(_0x3527('0x3'));var router=express[_0x3527('0x4')]();var fs_extra=require(_0x3527('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3527('0x6'));var config=require(_0x3527('0x7'));var controller=require(_0x3527('0x8'));router[_0x3527('0x9')]('/',auth['isAuthenticated'](),controller[_0x3527('0xa')]);router['get'](_0x3527('0xb'),auth[_0x3527('0xc')](),controller[_0x3527('0xd')]);router[_0x3527('0xe')]('/',auth[_0x3527('0xc')](),controller[_0x3527('0xf')]);router[_0x3527('0x10')](_0x3527('0xb'),auth[_0x3527('0xc')](),controller['update']);router[_0x3527('0x11')](_0x3527('0xb'),auth[_0x3527('0xc')](),controller[_0x3527('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5970=['fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','/:id','show','post','create','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x1e7e7d,_0x26a06d){var _0x1d54ad=function(_0x4c210e){while(--_0x4c210e){_0x1e7e7d['push'](_0x1e7e7d['shift']());}};_0x1d54ad(++_0x26a06d);}(_0x5970,0x1f3));var _0x0597=function(_0x3cdc96,_0x2c1770){_0x3cdc96=_0x3cdc96-0x0;var _0x4c04dd=_0x5970[_0x3cdc96];return _0x4c04dd;};'use strict';var multer=require(_0x0597('0x0'));var util=require(_0x0597('0x1'));var path=require('path');var timeout=require(_0x0597('0x2'));var express=require(_0x0597('0x3'));var router=express[_0x0597('0x4')]();var fs_extra=require(_0x0597('0x5'));var auth=require(_0x0597('0x6'));var interaction=require(_0x0597('0x7'));var config=require('../../config/environment');var controller=require(_0x0597('0x8'));router[_0x0597('0x9')]('/',auth[_0x0597('0xa')](),controller['index']);router[_0x0597('0x9')](_0x0597('0xb'),auth['isAuthenticated'](),controller[_0x0597('0xc')]);router[_0x0597('0xd')]('/',auth['isAuthenticated'](),controller[_0x0597('0xe')]);router['put'](_0x0597('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x0597('0xf')](_0x0597('0xb'),auth[_0x0597('0xa')](),controller[_0x0597('0x10')]);module[_0x0597('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 98ebd1e..39a9e4e 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 _0x13bf=['BOOLEAN','exports','string','variable','customVariable','keyValue','STRING'];(function(_0x1c0fd0,_0x231306){var _0x5ac6b2=function(_0x2c03fb){while(--_0x2c03fb){_0x1c0fd0['push'](_0x1c0fd0['shift']());}};_0x5ac6b2(++_0x231306);}(_0x13bf,0x1ba));var _0xf13b=function(_0x44820d,_0x5d3bb0){_0x44820d=_0x44820d-0x0;var _0x46367d=_0x13bf[_0x44820d];return _0x46367d;};'use strict';var Sequelize=require('sequelize');module[_0xf13b('0x0')]={'type':{'type':Sequelize['ENUM'](_0xf13b('0x1'),_0xf13b('0x2'),_0xf13b('0x3'),_0xf13b('0x4'),'picklist'),'defaultValue':_0xf13b('0x1')},'content':{'type':Sequelize[_0xf13b('0x5')]},'key':{'type':Sequelize[_0xf13b('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xf13b('0x1'),_0xf13b('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0xf13b('0x5')]},'idField':{'type':Sequelize[_0xf13b('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf13b('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa22f=['string','variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xa22f,0xc3));var _0xfa22=function(_0x229450,_0x4d9d71){_0x229450=_0x229450-0x0;var _0x5e0484=_0xa22f[_0x229450];return _0x5e0484;};'use strict';var Sequelize=require(_0xfa22('0x0'));module[_0xfa22('0x1')]={'type':{'type':Sequelize[_0xfa22('0x2')](_0xfa22('0x3'),_0xfa22('0x4'),_0xfa22('0x5'),_0xfa22('0x6'),_0xfa22('0x7')),'defaultValue':_0xfa22('0x3')},'content':{'type':Sequelize[_0xfa22('0x8')]},'key':{'type':Sequelize[_0xfa22('0x8')]},'keyType':{'type':Sequelize[_0xfa22('0x2')](_0xfa22('0x3'),'variable',_0xfa22('0x5'))},'keyContent':{'type':Sequelize[_0xfa22('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xfa22('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 1fd5c67..ea66915 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 _0x08a3=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','save','update','destroy','then','error','stack','name','send','index','VtigerField','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','options','create','body','find'];(function(_0x3866ef,_0x2102a1){var _0xfdd865=function(_0x46fae5){while(--_0x46fae5){_0x3866ef['push'](_0x3866ef['shift']());}};_0xfdd865(++_0x2102a1);}(_0x08a3,0x12c));var _0x308a=function(_0x2651c9,_0x29e244){_0x2651c9=_0x2651c9-0x0;var _0x588e8a=_0x08a3[_0x2651c9];return _0x588e8a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x308a('0x0'));var jsonpatch=require(_0x308a('0x1'));var rp=require(_0x308a('0x2'));var moment=require('moment');var BPromise=require(_0x308a('0x3'));var Mustache=require(_0x308a('0x4'));var util=require(_0x308a('0x5'));var path=require(_0x308a('0x6'));var sox=require(_0x308a('0x7'));var csv=require('to-csv');var ejs=require(_0x308a('0x8'));var fs=require('fs');var fs_extra=require(_0x308a('0x9'));var _=require(_0x308a('0xa'));var squel=require(_0x308a('0xb'));var crypto=require(_0x308a('0xc'));var jsforce=require(_0x308a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x308a('0xe'));var querystring=require(_0x308a('0xf'));var Papa=require(_0x308a('0x10'));var Redis=require(_0x308a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x308a('0x12'));var as=require(_0x308a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x308a('0x14'));var utils=require(_0x308a('0x15'));var config=require(_0x308a('0x16'));var licenseUtil=require(_0x308a('0x17'));var db=require(_0x308a('0x18'))['db'];function respondWithStatusCode(_0x43e959,_0x4dd42a){_0x4dd42a=_0x4dd42a||0xcc;return function(_0x490217){if(_0x490217){return _0x43e959[_0x308a('0x19')](_0x4dd42a);}return _0x43e959[_0x308a('0x1a')](_0x4dd42a)[_0x308a('0x1b')]();};}function respondWithResult(_0x48378e,_0x2d83b7){_0x2d83b7=_0x2d83b7||0xc8;return function(_0x338453){if(_0x338453){return _0x48378e[_0x308a('0x1a')](_0x2d83b7)[_0x308a('0x1c')](_0x338453);}};}function respondWithFilteredResult(_0xf1dc76,_0x18526a){return function(_0x1d1aa1){if(_0x1d1aa1){var _0x48ee18=typeof _0x18526a[_0x308a('0x1d')]==='undefined'&&typeof _0x18526a[_0x308a('0x1e')]===_0x308a('0x1f');var _0x504b34=_0x1d1aa1[_0x308a('0x20')];var _0x4e6b06=_0x48ee18?0x0:_0x18526a[_0x308a('0x1d')];var _0x36814e=_0x48ee18?_0x1d1aa1['count']:_0x18526a[_0x308a('0x1d')]+_0x18526a[_0x308a('0x1e')];var _0x47e466;if(_0x36814e>=_0x504b34){_0x36814e=_0x504b34;_0x47e466=0xc8;}else{_0x47e466=0xce;}_0xf1dc76[_0x308a('0x1a')](_0x47e466);return _0xf1dc76[_0x308a('0x21')]('Content-Range',_0x4e6b06+'-'+_0x36814e+'/'+_0x504b34)[_0x308a('0x1c')](_0x1d1aa1);}return null;};}function patchUpdates(_0x18145b){return function(_0x1d1e9b){try{jsonpatch['apply'](_0x1d1e9b,_0x18145b,!![]);}catch(_0x451ce3){return BPromise['reject'](_0x451ce3);}return _0x1d1e9b[_0x308a('0x22')]();};}function saveUpdates(_0x50f5ae,_0x515003){return function(_0x1f59ed){if(_0x1f59ed){return _0x1f59ed[_0x308a('0x23')](_0x50f5ae)['then'](function(_0x23d036){return _0x23d036;});}return null;};}function removeEntity(_0x2bae1a,_0x301e90){return function(_0x44a349){if(_0x44a349){return _0x44a349[_0x308a('0x24')]()[_0x308a('0x25')](function(){_0x2bae1a[_0x308a('0x1a')](0xcc)[_0x308a('0x1b')]();});}};}function handleEntityNotFound(_0x43169f,_0x2bcaee){return function(_0x365b95){if(!_0x365b95){_0x43169f['sendStatus'](0x194);}return _0x365b95;};}function handleError(_0x3803dd,_0x567c35){_0x567c35=_0x567c35||0x1f4;return function(_0x1e06af){logger[_0x308a('0x26')](_0x1e06af[_0x308a('0x27')]);if(_0x1e06af['name']){delete _0x1e06af[_0x308a('0x28')];}_0x3803dd[_0x308a('0x1a')](_0x567c35)[_0x308a('0x29')](_0x1e06af);};}exports[_0x308a('0x2a')]=function(_0x428478,_0x3be30c){var _0x9e7182={},_0x358bc9={},_0x3df3bd={'count':0x0,'rows':[]};var _0x11390b=_['map'](db[_0x308a('0x2b')]['rawAttributes'],function(_0x3303e4){return{'name':_0x3303e4[_0x308a('0x2c')],'type':_0x3303e4[_0x308a('0x2d')][_0x308a('0x2e')]};});_0x358bc9['model']=_[_0x308a('0x2f')](_0x11390b,_0x308a('0x28'));_0x358bc9[_0x308a('0x30')]=_['keys'](_0x428478['query']);_0x358bc9[_0x308a('0x31')]=_[_0x308a('0x32')](_0x358bc9[_0x308a('0x33')],_0x358bc9[_0x308a('0x30')]);_0x9e7182[_0x308a('0x34')]=_['intersection'](_0x358bc9[_0x308a('0x33')],qs[_0x308a('0x35')](_0x428478[_0x308a('0x30')][_0x308a('0x35')]));_0x9e7182[_0x308a('0x34')]=_0x9e7182[_0x308a('0x34')][_0x308a('0x36')]?_0x9e7182[_0x308a('0x34')]:_0x358bc9[_0x308a('0x33')];if(!_0x428478['query'][_0x308a('0x37')](_0x308a('0x38'))){_0x9e7182[_0x308a('0x1e')]=qs[_0x308a('0x1e')](_0x428478[_0x308a('0x30')][_0x308a('0x1e')]);_0x9e7182[_0x308a('0x1d')]=qs[_0x308a('0x1d')](_0x428478[_0x308a('0x30')][_0x308a('0x1d')]);}_0x9e7182[_0x308a('0x39')]=qs[_0x308a('0x3a')](_0x428478[_0x308a('0x30')]['sort']);_0x9e7182[_0x308a('0x3b')]=qs[_0x308a('0x31')](_[_0x308a('0x3c')](_0x428478[_0x308a('0x30')],_0x358bc9[_0x308a('0x31')]),_0x11390b);if(_0x428478['query'][_0x308a('0x3d')]){_0x9e7182[_0x308a('0x3b')]=_['merge'](_0x9e7182[_0x308a('0x3b')],{'$or':_[_0x308a('0x2f')](_0x11390b,function(_0x40b60d){if(_0x40b60d[_0x308a('0x2d')]!=='VIRTUAL'){var _0x500c06={};_0x500c06[_0x40b60d[_0x308a('0x28')]]={'$like':'%'+_0x428478[_0x308a('0x30')][_0x308a('0x3d')]+'%'};return _0x500c06;}})});}_0x9e7182=_[_0x308a('0x3e')]({},_0x9e7182,_0x428478['options']);var _0x5377bb={'where':_0x9e7182['where']};return db['VtigerField'][_0x308a('0x20')](_0x5377bb)[_0x308a('0x25')](function(_0x29e6f7){_0x3df3bd[_0x308a('0x20')]=_0x29e6f7;if(_0x428478[_0x308a('0x30')][_0x308a('0x3f')]){_0x9e7182[_0x308a('0x40')]=[{'all':!![]}];}return db[_0x308a('0x2b')][_0x308a('0x41')](_0x9e7182);})[_0x308a('0x25')](function(_0x1ffa66){_0x3df3bd[_0x308a('0x42')]=_0x1ffa66;return _0x3df3bd;})[_0x308a('0x25')](respondWithFilteredResult(_0x3be30c,_0x9e7182))[_0x308a('0x43')](handleError(_0x3be30c,null));};exports['show']=function(_0x588c91,_0x14936e){var _0x5057a={'raw':!![],'where':{'id':_0x588c91[_0x308a('0x44')]['id']}},_0x5de3fe={};_0x5de3fe[_0x308a('0x33')]=_[_0x308a('0x45')](db[_0x308a('0x2b')][_0x308a('0x46')]);_0x5de3fe[_0x308a('0x30')]=_[_0x308a('0x45')](_0x588c91[_0x308a('0x30')]);_0x5de3fe[_0x308a('0x31')]=_[_0x308a('0x32')](_0x5de3fe[_0x308a('0x33')],_0x5de3fe[_0x308a('0x30')]);_0x5057a['attributes']=_[_0x308a('0x32')](_0x5de3fe[_0x308a('0x33')],qs[_0x308a('0x35')](_0x588c91[_0x308a('0x30')][_0x308a('0x35')]));_0x5057a['attributes']=_0x5057a[_0x308a('0x34')][_0x308a('0x36')]?_0x5057a[_0x308a('0x34')]:_0x5de3fe['model'];if(_0x588c91['query'][_0x308a('0x3f')]){_0x5057a[_0x308a('0x40')]=[{'all':!![]}];}_0x5057a=_[_0x308a('0x3e')]({},_0x5057a,_0x588c91[_0x308a('0x47')]);return db[_0x308a('0x2b')]['find'](_0x5057a)[_0x308a('0x25')](handleEntityNotFound(_0x14936e,null))['then'](respondWithResult(_0x14936e,null))[_0x308a('0x43')](handleError(_0x14936e,null));};exports[_0x308a('0x48')]=function(_0x39bd56,_0x2958bf){return db[_0x308a('0x2b')][_0x308a('0x48')](_0x39bd56['body'],{})[_0x308a('0x25')](respondWithResult(_0x2958bf,0xc9))[_0x308a('0x43')](handleError(_0x2958bf,null));};exports[_0x308a('0x23')]=function(_0x2193ed,_0x218e23){if(_0x2193ed['body']['id']){delete _0x2193ed[_0x308a('0x49')]['id'];}return db[_0x308a('0x2b')][_0x308a('0x4a')]({'where':{'id':_0x2193ed['params']['id']}})[_0x308a('0x25')](handleEntityNotFound(_0x218e23,null))[_0x308a('0x25')](saveUpdates(_0x2193ed[_0x308a('0x49')],null))[_0x308a('0x25')](respondWithResult(_0x218e23,null))[_0x308a('0x43')](handleError(_0x218e23,null));};exports['destroy']=function(_0x11eb65,_0x3d198e){return db[_0x308a('0x2b')][_0x308a('0x4a')]({'where':{'id':_0x11eb65[_0x308a('0x44')]['id']}})[_0x308a('0x25')](handleEntityNotFound(_0x3d198e,null))[_0x308a('0x25')](removeEntity(_0x3d198e,null))[_0x308a('0x43')](handleError(_0x3d198e,null));}; \ No newline at end of file +var _0xb3f5=['api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','map','VtigerField','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','count','includeAll','findAll','show','params','length','include','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','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x338b26,_0x45d064){var _0x21d9da=function(_0x10c8bb){while(--_0x10c8bb){_0x338b26['push'](_0x338b26['shift']());}};_0x21d9da(++_0x45d064);}(_0xb3f5,0x16a));var _0x5b3f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb3f5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5b3f('0x0'));var rimraf=require(_0x5b3f('0x1'));var zipdir=require(_0x5b3f('0x2'));var jsonpatch=require(_0x5b3f('0x3'));var rp=require(_0x5b3f('0x4'));var moment=require(_0x5b3f('0x5'));var BPromise=require(_0x5b3f('0x6'));var Mustache=require(_0x5b3f('0x7'));var util=require(_0x5b3f('0x8'));var path=require(_0x5b3f('0x9'));var sox=require(_0x5b3f('0xa'));var csv=require(_0x5b3f('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5b3f('0xc'));var _=require(_0x5b3f('0xd'));var squel=require(_0x5b3f('0xe'));var crypto=require(_0x5b3f('0xf'));var jsforce=require(_0x5b3f('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x5b3f('0xb'));var querystring=require(_0x5b3f('0x11'));var Papa=require(_0x5b3f('0x12'));var Redis=require('ioredis');var authService=require(_0x5b3f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5b3f('0x14'));var hardwareService=require(_0x5b3f('0x15'));var logger=require(_0x5b3f('0x16'))(_0x5b3f('0x17'));var utils=require(_0x5b3f('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x5b3f('0x19'));var db=require(_0x5b3f('0x1a'))['db'];function respondWithStatusCode(_0x1ac70f,_0x28c6b0){_0x28c6b0=_0x28c6b0||0xcc;return function(_0x558b48){if(_0x558b48){return _0x1ac70f['sendStatus'](_0x28c6b0);}return _0x1ac70f[_0x5b3f('0x1b')](_0x28c6b0)[_0x5b3f('0x1c')]();};}function respondWithResult(_0x5b9d36,_0x2e5b29){_0x2e5b29=_0x2e5b29||0xc8;return function(_0x2ee63f){if(_0x2ee63f){return _0x5b9d36[_0x5b3f('0x1b')](_0x2e5b29)['json'](_0x2ee63f);}};}function respondWithFilteredResult(_0x4c51ed,_0x6f70f5){return function(_0xbaad17){if(_0xbaad17){var _0xd8cc1a=typeof _0x6f70f5[_0x5b3f('0x1d')]===_0x5b3f('0x1e')&&typeof _0x6f70f5[_0x5b3f('0x1f')]===_0x5b3f('0x1e');var _0x51665=_0xbaad17['count'];var _0x453585=_0xd8cc1a?0x0:_0x6f70f5[_0x5b3f('0x1d')];var _0x465a11=_0xd8cc1a?_0xbaad17['count']:_0x6f70f5[_0x5b3f('0x1d')]+_0x6f70f5[_0x5b3f('0x1f')];var _0x5d618f;if(_0x465a11>=_0x51665){_0x465a11=_0x51665;_0x5d618f=0xc8;}else{_0x5d618f=0xce;}_0x4c51ed[_0x5b3f('0x1b')](_0x5d618f);return _0x4c51ed[_0x5b3f('0x20')](_0x5b3f('0x21'),_0x453585+'-'+_0x465a11+'/'+_0x51665)[_0x5b3f('0x22')](_0xbaad17);}return null;};}function patchUpdates(_0xe73b5b){return function(_0x2256ec){try{jsonpatch[_0x5b3f('0x23')](_0x2256ec,_0xe73b5b,!![]);}catch(_0x54ba61){return BPromise[_0x5b3f('0x24')](_0x54ba61);}return _0x2256ec[_0x5b3f('0x25')]();};}function saveUpdates(_0x48e758,_0x43249d){return function(_0x4b2009){if(_0x4b2009){return _0x4b2009[_0x5b3f('0x26')](_0x48e758)['then'](function(_0x2ee8c9){return _0x2ee8c9;});}return null;};}function removeEntity(_0x3bb81c,_0x1da231){return function(_0x48a572){if(_0x48a572){return _0x48a572[_0x5b3f('0x27')]()[_0x5b3f('0x28')](function(){_0x3bb81c[_0x5b3f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x111679,_0xc6eedc){return function(_0x2876ae){if(!_0x2876ae){_0x111679[_0x5b3f('0x29')](0x194);}return _0x2876ae;};}function handleError(_0x252e72,_0x57738a){_0x57738a=_0x57738a||0x1f4;return function(_0x281be2){logger[_0x5b3f('0x2a')](_0x281be2[_0x5b3f('0x2b')]);if(_0x281be2[_0x5b3f('0x2c')]){delete _0x281be2['name'];}_0x252e72[_0x5b3f('0x1b')](_0x57738a)[_0x5b3f('0x2d')](_0x281be2);};}exports['index']=function(_0x1d38d7,_0x423a05){var _0xac85={},_0xb15827={},_0x5d5b45={'count':0x0,'rows':[]};var _0x1a461c=_[_0x5b3f('0x2e')](db[_0x5b3f('0x2f')][_0x5b3f('0x30')],function(_0x43b0ea){return{'name':_0x43b0ea[_0x5b3f('0x31')],'type':_0x43b0ea[_0x5b3f('0x32')][_0x5b3f('0x33')]};});_0xb15827['model']=_[_0x5b3f('0x2e')](_0x1a461c,_0x5b3f('0x2c'));_0xb15827[_0x5b3f('0x34')]=_[_0x5b3f('0x35')](_0x1d38d7[_0x5b3f('0x34')]);_0xb15827['filters']=_['intersection'](_0xb15827[_0x5b3f('0x36')],_0xb15827[_0x5b3f('0x34')]);_0xac85[_0x5b3f('0x37')]=_[_0x5b3f('0x38')](_0xb15827['model'],qs['fields'](_0x1d38d7['query'][_0x5b3f('0x39')]));_0xac85[_0x5b3f('0x37')]=_0xac85[_0x5b3f('0x37')]['length']?_0xac85[_0x5b3f('0x37')]:_0xb15827[_0x5b3f('0x36')];if(!_0x1d38d7[_0x5b3f('0x34')][_0x5b3f('0x3a')](_0x5b3f('0x3b'))){_0xac85['limit']=qs[_0x5b3f('0x1f')](_0x1d38d7[_0x5b3f('0x34')][_0x5b3f('0x1f')]);_0xac85['offset']=qs[_0x5b3f('0x1d')](_0x1d38d7[_0x5b3f('0x34')][_0x5b3f('0x1d')]);}_0xac85[_0x5b3f('0x3c')]=qs[_0x5b3f('0x3d')](_0x1d38d7['query'][_0x5b3f('0x3d')]);_0xac85['where']=qs['filters'](_['pick'](_0x1d38d7[_0x5b3f('0x34')],_0xb15827['filters']),_0x1a461c);if(_0x1d38d7[_0x5b3f('0x34')][_0x5b3f('0x3e')]){_0xac85[_0x5b3f('0x3f')]=_['merge'](_0xac85[_0x5b3f('0x3f')],{'$or':_[_0x5b3f('0x2e')](_0x1a461c,function(_0x5512ac){if(_0x5512ac[_0x5b3f('0x32')]!==_0x5b3f('0x40')){var _0x3228f0={};_0x3228f0[_0x5512ac[_0x5b3f('0x2c')]]={'$like':'%'+_0x1d38d7[_0x5b3f('0x34')][_0x5b3f('0x3e')]+'%'};return _0x3228f0;}})});}_0xac85=_[_0x5b3f('0x41')]({},_0xac85,_0x1d38d7['options']);var _0x5a222b={'where':_0xac85[_0x5b3f('0x3f')]};return db[_0x5b3f('0x2f')][_0x5b3f('0x42')](_0x5a222b)[_0x5b3f('0x28')](function(_0xab4366){_0x5d5b45[_0x5b3f('0x42')]=_0xab4366;if(_0x1d38d7[_0x5b3f('0x34')][_0x5b3f('0x43')]){_0xac85['include']=[{'all':!![]}];}return db[_0x5b3f('0x2f')][_0x5b3f('0x44')](_0xac85);})['then'](function(_0xa70acc){_0x5d5b45['rows']=_0xa70acc;return _0x5d5b45;})['then'](respondWithFilteredResult(_0x423a05,_0xac85))['catch'](handleError(_0x423a05,null));};exports[_0x5b3f('0x45')]=function(_0x3043e9,_0x3357d0){var _0xbc136={'raw':!![],'where':{'id':_0x3043e9[_0x5b3f('0x46')]['id']}},_0x338ed9={};_0x338ed9['model']=_[_0x5b3f('0x35')](db[_0x5b3f('0x2f')][_0x5b3f('0x30')]);_0x338ed9[_0x5b3f('0x34')]=_[_0x5b3f('0x35')](_0x3043e9[_0x5b3f('0x34')]);_0x338ed9['filters']=_[_0x5b3f('0x38')](_0x338ed9[_0x5b3f('0x36')],_0x338ed9[_0x5b3f('0x34')]);_0xbc136[_0x5b3f('0x37')]=_[_0x5b3f('0x38')](_0x338ed9['model'],qs[_0x5b3f('0x39')](_0x3043e9['query'][_0x5b3f('0x39')]));_0xbc136[_0x5b3f('0x37')]=_0xbc136[_0x5b3f('0x37')][_0x5b3f('0x47')]?_0xbc136[_0x5b3f('0x37')]:_0x338ed9[_0x5b3f('0x36')];if(_0x3043e9[_0x5b3f('0x34')][_0x5b3f('0x43')]){_0xbc136[_0x5b3f('0x48')]=[{'all':!![]}];}_0xbc136=_[_0x5b3f('0x41')]({},_0xbc136,_0x3043e9['options']);return db[_0x5b3f('0x2f')][_0x5b3f('0x49')](_0xbc136)[_0x5b3f('0x28')](handleEntityNotFound(_0x3357d0,null))['then'](respondWithResult(_0x3357d0,null))[_0x5b3f('0x4a')](handleError(_0x3357d0,null));};exports['create']=function(_0x5edf4d,_0x5ed054){return db[_0x5b3f('0x2f')][_0x5b3f('0x4b')](_0x5edf4d['body'],{})[_0x5b3f('0x28')](respondWithResult(_0x5ed054,0xc9))[_0x5b3f('0x4a')](handleError(_0x5ed054,null));};exports['update']=function(_0x5ef9fb,_0x2449b2){if(_0x5ef9fb['body']['id']){delete _0x5ef9fb['body']['id'];}return db[_0x5b3f('0x2f')]['find']({'where':{'id':_0x5ef9fb['params']['id']}})[_0x5b3f('0x28')](handleEntityNotFound(_0x2449b2,null))[_0x5b3f('0x28')](saveUpdates(_0x5ef9fb[_0x5b3f('0x4c')],null))[_0x5b3f('0x28')](respondWithResult(_0x2449b2,null))[_0x5b3f('0x4a')](handleError(_0x2449b2,null));};exports[_0x5b3f('0x27')]=function(_0x576e35,_0x5255da){return db[_0x5b3f('0x2f')][_0x5b3f('0x49')]({'where':{'id':_0x576e35[_0x5b3f('0x46')]['id']}})['then'](handleEntityNotFound(_0x5255da,null))[_0x5b3f('0x28')](removeEntity(_0x5255da,null))['catch'](handleError(_0x5255da,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index cfe18bb..4293e1c 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 _0xcdfa=['lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','FieldId'];(function(_0x2a0377,_0x44da1c){var _0x1f1762=function(_0x4499d1){while(--_0x4499d1){_0x2a0377['push'](_0x2a0377['shift']());}};_0x1f1762(++_0x44da1c);}(_0xcdfa,0xfc));var _0xacdf=function(_0x2d949d,_0x52ef4b){_0x2d949d=_0x2d949d-0x0;var _0x57e835=_0xcdfa[_0x2d949d];return _0x57e835;};'use strict';var _=require(_0xacdf('0x0'));var util=require('util');var logger=require(_0xacdf('0x1'))(_0xacdf('0x2'));var moment=require(_0xacdf('0x3'));var BPromise=require('bluebird');var rp=require(_0xacdf('0x4'));var fs=require('fs');var path=require(_0xacdf('0x5'));var rimraf=require('rimraf');var config=require(_0xacdf('0x6'));var attributes=require(_0xacdf('0x7'));module[_0xacdf('0x8')]=function(_0x26db93,_0x228174){return _0x26db93[_0xacdf('0x9')](_0xacdf('0xa'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0xacdf('0xb'),'fields':[_0xacdf('0xc'),_0xacdf('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x155a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','define','VtigerField','vtiger_unique_index','FieldId'];(function(_0x205733,_0x350fa4){var _0x433f84=function(_0x5108d3){while(--_0x5108d3){_0x205733['push'](_0x205733['shift']());}};_0x433f84(++_0x350fa4);}(_0x155a,0x96));var _0xa155=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x155a[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xa155('0x0'));var util=require(_0xa155('0x1'));var logger=require(_0xa155('0x2'))(_0xa155('0x3'));var moment=require(_0xa155('0x4'));var BPromise=require(_0xa155('0x5'));var rp=require(_0xa155('0x6'));var fs=require('fs');var path=require(_0xa155('0x7'));var rimraf=require(_0xa155('0x8'));var config=require(_0xa155('0x9'));var attributes=require(_0xa155('0xa'));module['exports']=function(_0x5236ac,_0x5a85f8){return _0x5236ac[_0xa155('0xb')](_0xa155('0xc'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0xa155('0xd'),'fields':['idField',_0xa155('0xe')],'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 cb7e5c6..e94ee93 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 _0x690a=['randomstring','rpc','../../config/environment','jayson/promise','client','request','then','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment'];(function(_0x57edf0,_0x2848f3){var _0x1711dc=function(_0xf6ad88){while(--_0xf6ad88){_0x57edf0['push'](_0x57edf0['shift']());}};_0x1711dc(++_0x2848f3);}(_0x690a,0x165));var _0xa690=function(_0x4af491,_0x42e746){_0x4af491=_0x4af491-0x0;var _0x2a4cf6=_0x690a[_0x4af491];return _0x2a4cf6;};'use strict';var _=require(_0xa690('0x0'));var util=require(_0xa690('0x1'));var moment=require(_0xa690('0x2'));var BPromise=require('bluebird');var rs=require(_0xa690('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa690('0x4'));var config=require(_0xa690('0x5'));var jayson=require(_0xa690('0x6'));var client=jayson[_0xa690('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e6c36,_0x40dc9a,_0xcee6cc){return new BPromise(function(_0x88ad5b,_0x3b4682){return client[_0xa690('0x8')](_0x5e6c36,_0xcee6cc)[_0xa690('0x9')](function(_0x12b5b0){logger['info'](_0xa690('0xa'),_0x40dc9a,'request\x20sent');logger[_0xa690('0xb')](_0xa690('0xc'),_0x40dc9a,_0xa690('0xd'),JSON['stringify'](_0x12b5b0));if(_0x12b5b0[_0xa690('0xe')]){if(_0x12b5b0[_0xa690('0xe')][_0xa690('0xf')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x40dc9a,_0x12b5b0[_0xa690('0xe')][_0xa690('0x10')]);return _0x3b4682(_0x12b5b0[_0xa690('0xe')][_0xa690('0x10')]);}logger[_0xa690('0xe')](_0xa690('0xa'),_0x40dc9a,_0x12b5b0[_0xa690('0xe')][_0xa690('0x10')]);return _0x88ad5b(_0x12b5b0[_0xa690('0xe')][_0xa690('0x10')]);}else{logger['info'](_0xa690('0xa'),_0x40dc9a,'request\x20sent');_0x88ad5b(_0x12b5b0['result'][_0xa690('0x10')]);}})[_0xa690('0x11')](function(_0x5947eb){logger[_0xa690('0xe')]('VtigerField,\x20%s,\x20%s',_0x40dc9a,_0x5947eb);_0x3b4682(_0x5947eb);});});} \ No newline at end of file +var _0x7d48=['stringify','error','code','VtigerField,\x20%s,\x20%s','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s'];(function(_0x4e69ad,_0x42469f){var _0x52bf84=function(_0x535849){while(--_0x535849){_0x4e69ad['push'](_0x4e69ad['shift']());}};_0x52bf84(++_0x42469f);}(_0x7d48,0xd8));var _0x87d4=function(_0x2c5828,_0x1f5fcf){_0x2c5828=_0x2c5828-0x0;var _0x538aad=_0x7d48[_0x2c5828];return _0x538aad;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x87d4('0x0'));var BPromise=require(_0x87d4('0x1'));var rs=require(_0x87d4('0x2'));var fs=require('fs');var Redis=require(_0x87d4('0x3'));var db=require(_0x87d4('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x87d4('0x5'));var config=require(_0x87d4('0x6'));var jayson=require(_0x87d4('0x7'));var client=jayson[_0x87d4('0x8')][_0x87d4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4377f3,_0xcfff87,_0x10d6b6){return new BPromise(function(_0x212305,_0x1bb91e){return client['request'](_0x4377f3,_0x10d6b6)[_0x87d4('0xa')](function(_0x1b517b){logger[_0x87d4('0xb')]('VtigerField,\x20%s,\x20%s',_0xcfff87,_0x87d4('0xc'));logger[_0x87d4('0xd')](_0x87d4('0xe'),_0xcfff87,_0x87d4('0xc'),JSON[_0x87d4('0xf')](_0x1b517b));if(_0x1b517b[_0x87d4('0x10')]){if(_0x1b517b[_0x87d4('0x10')][_0x87d4('0x11')]===0x1f4){logger['error'](_0x87d4('0x12'),_0xcfff87,_0x1b517b[_0x87d4('0x10')][_0x87d4('0x13')]);return _0x1bb91e(_0x1b517b['error'][_0x87d4('0x13')]);}logger[_0x87d4('0x10')]('VtigerField,\x20%s,\x20%s',_0xcfff87,_0x1b517b[_0x87d4('0x10')][_0x87d4('0x13')]);return _0x212305(_0x1b517b[_0x87d4('0x10')][_0x87d4('0x13')]);}else{logger[_0x87d4('0xb')](_0x87d4('0x12'),_0xcfff87,'request\x20sent');_0x212305(_0x1b517b[_0x87d4('0x14')][_0x87d4('0x13')]);}})['catch'](function(_0x240e7b){logger[_0x87d4('0x10')](_0x87d4('0x12'),_0xcfff87,_0x240e7b);_0x1bb91e(_0x240e7b);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index aa4c3b3..70a2e96 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 _0x081c=['getFields','post','create','addConfiguration','update','delete','exports','multer','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x2b9ac8,_0xf820cb){var _0x3ceea9=function(_0x407d34){while(--_0x407d34){_0x2b9ac8['push'](_0x2b9ac8['shift']());}};_0x3ceea9(++_0xf820cb);}(_0x081c,0xeb));var _0xc081=function(_0x39fcd5,_0x474d5a){_0x39fcd5=_0x39fcd5-0x0;var _0xeb5477=_0x081c[_0x39fcd5];return _0xeb5477;};'use strict';var multer=require(_0xc081('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc081('0x1')]();var fs_extra=require(_0xc081('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xc081('0x3'));var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router[_0xc081('0x4')]('/',auth[_0xc081('0x5')](),controller[_0xc081('0x6')]);router['get'](_0xc081('0x7'),auth['isAuthenticated'](),controller[_0xc081('0x8')]);router['get'](_0xc081('0x9'),auth[_0xc081('0x5')](),controller[_0xc081('0xa')]);router['get'](_0xc081('0xb'),auth[_0xc081('0x5')](),controller[_0xc081('0xc')]);router[_0xc081('0xd')]('/',auth['isAuthenticated'](),controller[_0xc081('0xe')]);router[_0xc081('0xd')](_0xc081('0x9'),auth[_0xc081('0x5')](),controller[_0xc081('0xf')]);router['put'](_0xc081('0x7'),auth[_0xc081('0x5')](),controller[_0xc081('0x10')]);router[_0xc081('0x11')](_0xc081('0x7'),auth[_0xc081('0x5')](),controller['destroy']);module[_0xc081('0x12')]=router; \ No newline at end of file +var _0x8b6b=['update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','show','getConfigurations','/:id/fields','getFields','create','/:id/configurations','addConfiguration','put','/:id'];(function(_0x242e41,_0x2beb78){var _0x171510=function(_0x4d8a5a){while(--_0x4d8a5a){_0x242e41['push'](_0x242e41['shift']());}};_0x171510(++_0x2beb78);}(_0x8b6b,0x13d));var _0xb8b6=function(_0x51e49e,_0x2e95d2){_0x51e49e=_0x51e49e-0x0;var _0x429917=_0x8b6b[_0x51e49e];return _0x429917;};'use strict';var multer=require('multer');var util=require(_0xb8b6('0x0'));var path=require(_0xb8b6('0x1'));var timeout=require(_0xb8b6('0x2'));var express=require(_0xb8b6('0x3'));var router=express[_0xb8b6('0x4')]();var fs_extra=require(_0xb8b6('0x5'));var auth=require(_0xb8b6('0x6'));var interaction=require(_0xb8b6('0x7'));var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router[_0xb8b6('0x8')]('/',auth[_0xb8b6('0x9')](),controller['index']);router[_0xb8b6('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xb8b6('0xa')]);router[_0xb8b6('0x8')]('/:id/configurations',auth[_0xb8b6('0x9')](),controller[_0xb8b6('0xb')]);router[_0xb8b6('0x8')](_0xb8b6('0xc'),auth[_0xb8b6('0x9')](),controller[_0xb8b6('0xd')]);router['post']('/',auth[_0xb8b6('0x9')](),controller[_0xb8b6('0xe')]);router['post'](_0xb8b6('0xf'),auth[_0xb8b6('0x9')](),controller[_0xb8b6('0x10')]);router[_0xb8b6('0x11')](_0xb8b6('0x12'),auth[_0xb8b6('0x9')](),controller[_0xb8b6('0x13')]);router[_0xb8b6('0x14')](_0xb8b6('0x12'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index ed2ff8d..58befa1 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 _0xc4aa=['STRING','username','remoteUri','ENUM','password','token','integrationTab','sequelize','exports'];(function(_0x14e3ec,_0xa155db){var _0x12f1fe=function(_0x4c0d06){while(--_0x4c0d06){_0x14e3ec['push'](_0x14e3ec['shift']());}};_0x12f1fe(++_0xa155db);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xc4aa[_0x88cd7b];return _0x56fcc8;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'name':{'type':Sequelize[_0xac4a('0x2')]},'description':{'type':Sequelize[_0xac4a('0x2')]},'username':{'type':Sequelize[_0xac4a('0x2')],'unique':_0xac4a('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xac4a('0x4')},'authType':{'type':Sequelize[_0xac4a('0x5')](_0xac4a('0x6'),_0xac4a('0x7')),'defaultValue':_0xac4a('0x6')},'serverUrl':{'type':Sequelize[_0xac4a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xac4a('0x5')](_0xac4a('0x8'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x9c63=['exports','STRING','ENUM','password','token','newTab','integrationTab','sequelize'];(function(_0x158f64,_0x2d49fb){var _0x3b5ef1=function(_0x519b2f){while(--_0x519b2f){_0x158f64['push'](_0x158f64['shift']());}};_0x3b5ef1(++_0x2d49fb);}(_0x9c63,0x1a7));var _0x39c6=function(_0x54b8b5,_0x896520){_0x54b8b5=_0x54b8b5-0x0;var _0x3bc7a1=_0x9c63[_0x54b8b5];return _0x3bc7a1;};'use strict';var Sequelize=require(_0x39c6('0x0'));module[_0x39c6('0x1')]={'name':{'type':Sequelize[_0x39c6('0x2')]},'description':{'type':Sequelize[_0x39c6('0x2')]},'username':{'type':Sequelize[_0x39c6('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x39c6('0x2')]},'token':{'type':Sequelize[_0x39c6('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x39c6('0x3')](_0x39c6('0x4'),_0x39c6('0x5')),'defaultValue':_0x39c6('0x4')},'serverUrl':{'type':Sequelize[_0x39c6('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x39c6('0x3')]('integrationTab',_0x39c6('0x6')),'defaultValue':_0x39c6('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index ac65bac..5a213f6 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 _0x4fc2=['addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','token','authType','remoteUri','slice','substring','lastIndexOf','format','ticket_fields','password','headers','Basic\x20%s','%s:%s','toString','base64','Sequelize','Unknown\x20authentication\x20type','subject','description','remove','position','title','system_field_options','statusCode','error','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','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/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','stack','name','send','index','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','ZendeskAccount','includeAll','findAll','rows','show','params','rawAttributes','include','find','catch','create','body','update','getConfigurations','findOne','ZendeskConfiguration'];(function(_0x518849,_0x2a7ff3){var _0xc676=function(_0x32b8b9){while(--_0x32b8b9){_0x518849['push'](_0x518849['shift']());}};_0xc676(++_0x2a7ff3);}(_0x4fc2,0x111));var _0x24fc=function(_0x24ec40,_0x375368){_0x24ec40=_0x24ec40-0x0;var _0x517d60=_0x4fc2[_0x24ec40];return _0x517d60;};'use strict';var emlformat=require(_0x24fc('0x0'));var rimraf=require(_0x24fc('0x1'));var zipdir=require(_0x24fc('0x2'));var jsonpatch=require(_0x24fc('0x3'));var rp=require('request-promise');var moment=require(_0x24fc('0x4'));var BPromise=require(_0x24fc('0x5'));var Mustache=require(_0x24fc('0x6'));var util=require('util');var path=require(_0x24fc('0x7'));var sox=require(_0x24fc('0x8'));var csv=require('to-csv');var ejs=require(_0x24fc('0x9'));var fs=require('fs');var fs_extra=require(_0x24fc('0xa'));var _=require('lodash');var squel=require(_0x24fc('0xb'));var crypto=require(_0x24fc('0xc'));var jsforce=require(_0x24fc('0xd'));var deskjs=require(_0x24fc('0xe'));var toCsv=require(_0x24fc('0xf'));var querystring=require(_0x24fc('0x10'));var Papa=require('papaparse');var Redis=require(_0x24fc('0x11'));var authService=require(_0x24fc('0x12'));var qs=require(_0x24fc('0x13'));var as=require(_0x24fc('0x14'));var hardwareService=require(_0x24fc('0x15'));var logger=require(_0x24fc('0x16'))(_0x24fc('0x17'));var utils=require(_0x24fc('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x24fc('0x19'));var db=require(_0x24fc('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x306873,_0x76cb25){_0x76cb25=_0x76cb25||0xcc;return function(_0x3f6d8b){if(_0x3f6d8b){return _0x306873[_0x24fc('0x1b')](_0x76cb25);}return _0x306873[_0x24fc('0x1c')](_0x76cb25)[_0x24fc('0x1d')]();};}function respondWithResult(_0x537b5c,_0x2a0971){_0x2a0971=_0x2a0971||0xc8;return function(_0x18c0a7){if(_0x18c0a7){return _0x537b5c[_0x24fc('0x1c')](_0x2a0971)[_0x24fc('0x1e')](_0x18c0a7);}};}function respondWithFilteredResult(_0x4acd36,_0x2ac989){return function(_0x588543){if(_0x588543){var _0x4af098=typeof _0x2ac989[_0x24fc('0x1f')]===_0x24fc('0x20')&&typeof _0x2ac989[_0x24fc('0x21')]===_0x24fc('0x20');var _0x52a884=_0x588543[_0x24fc('0x22')];var _0x1cb3d0=_0x4af098?0x0:_0x2ac989[_0x24fc('0x1f')];var _0x8ac114=_0x4af098?_0x588543['count']:_0x2ac989[_0x24fc('0x1f')]+_0x2ac989[_0x24fc('0x21')];var _0x304881;if(_0x8ac114>=_0x52a884){_0x8ac114=_0x52a884;_0x304881=0xc8;}else{_0x304881=0xce;}_0x4acd36['status'](_0x304881);return _0x4acd36[_0x24fc('0x23')](_0x24fc('0x24'),_0x1cb3d0+'-'+_0x8ac114+'/'+_0x52a884)[_0x24fc('0x1e')](_0x588543);}return null;};}function patchUpdates(_0x2d0e3d){return function(_0x49a0ba){try{jsonpatch[_0x24fc('0x25')](_0x49a0ba,_0x2d0e3d,!![]);}catch(_0x545939){return BPromise[_0x24fc('0x26')](_0x545939);}return _0x49a0ba['save']();};}function saveUpdates(_0x3ed464,_0x44c121){return function(_0x2ffade){if(_0x2ffade){return _0x2ffade['update'](_0x3ed464)[_0x24fc('0x27')](function(_0x552035){return _0x552035;});}return null;};}function removeEntity(_0x35a9c7,_0x2bb93a){return function(_0x36a9b4){if(_0x36a9b4){return _0x36a9b4[_0x24fc('0x28')]()[_0x24fc('0x27')](function(){_0x35a9c7[_0x24fc('0x1c')](0xcc)[_0x24fc('0x1d')]();});}};}function handleEntityNotFound(_0x20192b,_0x168d98){return function(_0x2a5c4b){if(!_0x2a5c4b){_0x20192b['sendStatus'](0x194);}return _0x2a5c4b;};}function handleError(_0x11c913,_0x16f27f){_0x16f27f=_0x16f27f||0x1f4;return function(_0x3ee302){logger['error'](_0x3ee302[_0x24fc('0x29')]);if(_0x3ee302[_0x24fc('0x2a')]){delete _0x3ee302[_0x24fc('0x2a')];}_0x11c913[_0x24fc('0x1c')](_0x16f27f)[_0x24fc('0x2b')](_0x3ee302);};}exports[_0x24fc('0x2c')]=function(_0x5ac1f2,_0x240ae7){var _0x29a461={},_0x3c99ed={},_0x1c5146={'count':0x0,'rows':[]};var _0x9f7bbc=_['map'](db['ZendeskAccount']['rawAttributes'],function(_0x3df6f4){return{'name':_0x3df6f4['fieldName'],'type':_0x3df6f4[_0x24fc('0x2d')][_0x24fc('0x2e')]};});_0x3c99ed[_0x24fc('0x2f')]=_[_0x24fc('0x30')](_0x9f7bbc,'name');_0x3c99ed[_0x24fc('0x31')]=_[_0x24fc('0x32')](_0x5ac1f2['query']);_0x3c99ed[_0x24fc('0x33')]=_[_0x24fc('0x34')](_0x3c99ed['model'],_0x3c99ed['query']);_0x29a461[_0x24fc('0x35')]=_['intersection'](_0x3c99ed[_0x24fc('0x2f')],qs[_0x24fc('0x36')](_0x5ac1f2['query'][_0x24fc('0x36')]));_0x29a461[_0x24fc('0x35')]=_0x29a461[_0x24fc('0x35')][_0x24fc('0x37')]?_0x29a461[_0x24fc('0x35')]:_0x3c99ed[_0x24fc('0x2f')];if(!_0x5ac1f2[_0x24fc('0x31')][_0x24fc('0x38')](_0x24fc('0x39'))){_0x29a461['limit']=qs[_0x24fc('0x21')](_0x5ac1f2[_0x24fc('0x31')][_0x24fc('0x21')]);_0x29a461[_0x24fc('0x1f')]=qs[_0x24fc('0x1f')](_0x5ac1f2['query']['offset']);}_0x29a461[_0x24fc('0x3a')]=qs['sort'](_0x5ac1f2[_0x24fc('0x31')][_0x24fc('0x3b')]);_0x29a461[_0x24fc('0x3c')]=qs[_0x24fc('0x33')](_['pick'](_0x5ac1f2[_0x24fc('0x31')],_0x3c99ed['filters']),_0x9f7bbc);if(_0x5ac1f2[_0x24fc('0x31')][_0x24fc('0x3d')]){_0x29a461[_0x24fc('0x3c')]=_[_0x24fc('0x3e')](_0x29a461[_0x24fc('0x3c')],{'$or':_['map'](_0x9f7bbc,function(_0xadedb4){if(_0xadedb4[_0x24fc('0x2d')]!==_0x24fc('0x3f')){var _0x22a75c={};_0x22a75c[_0xadedb4['name']]={'$like':'%'+_0x5ac1f2[_0x24fc('0x31')][_0x24fc('0x3d')]+'%'};return _0x22a75c;}})});}_0x29a461=_['merge']({},_0x29a461,_0x5ac1f2[_0x24fc('0x40')]);var _0x52df2e={'where':_0x29a461[_0x24fc('0x3c')]};return db[_0x24fc('0x41')][_0x24fc('0x22')](_0x52df2e)[_0x24fc('0x27')](function(_0x431189){_0x1c5146[_0x24fc('0x22')]=_0x431189;if(_0x5ac1f2[_0x24fc('0x31')][_0x24fc('0x42')]){_0x29a461['include']=[{'all':!![]}];}return db[_0x24fc('0x41')][_0x24fc('0x43')](_0x29a461);})[_0x24fc('0x27')](function(_0x4fee9f){_0x1c5146[_0x24fc('0x44')]=_0x4fee9f;return _0x1c5146;})[_0x24fc('0x27')](respondWithFilteredResult(_0x240ae7,_0x29a461))['catch'](handleError(_0x240ae7,null));};exports[_0x24fc('0x45')]=function(_0x22f30b,_0x2c598c){var _0x5e4e9b={'raw':![],'where':{'id':_0x22f30b[_0x24fc('0x46')]['id']}},_0x31ddd0={};_0x31ddd0['model']=_[_0x24fc('0x32')](db[_0x24fc('0x41')][_0x24fc('0x47')]);_0x31ddd0[_0x24fc('0x31')]=_['keys'](_0x22f30b[_0x24fc('0x31')]);_0x31ddd0[_0x24fc('0x33')]=_[_0x24fc('0x34')](_0x31ddd0[_0x24fc('0x2f')],_0x31ddd0[_0x24fc('0x31')]);_0x5e4e9b['attributes']=_[_0x24fc('0x34')](_0x31ddd0[_0x24fc('0x2f')],qs[_0x24fc('0x36')](_0x22f30b[_0x24fc('0x31')]['fields']));_0x5e4e9b[_0x24fc('0x35')]=_0x5e4e9b[_0x24fc('0x35')]['length']?_0x5e4e9b['attributes']:_0x31ddd0[_0x24fc('0x2f')];if(_0x22f30b['query']['includeAll']){_0x5e4e9b[_0x24fc('0x48')]=[{'all':!![]}];}_0x5e4e9b=_['merge']({},_0x5e4e9b,_0x22f30b[_0x24fc('0x40')]);return db[_0x24fc('0x41')][_0x24fc('0x49')](_0x5e4e9b)['then'](handleEntityNotFound(_0x2c598c,null))[_0x24fc('0x27')](respondWithResult(_0x2c598c,null))[_0x24fc('0x4a')](handleError(_0x2c598c,null));};exports[_0x24fc('0x4b')]=function(_0x1ad8d6,_0x39873d){return db[_0x24fc('0x41')][_0x24fc('0x4b')](_0x1ad8d6[_0x24fc('0x4c')],{})['then'](respondWithResult(_0x39873d,0xc9))['catch'](handleError(_0x39873d,null));};exports[_0x24fc('0x4d')]=function(_0x2f1a99,_0x12e9f7){if(_0x2f1a99['body']['id']){delete _0x2f1a99['body']['id'];}return db[_0x24fc('0x41')][_0x24fc('0x49')]({'where':{'id':_0x2f1a99[_0x24fc('0x46')]['id']}})[_0x24fc('0x27')](handleEntityNotFound(_0x12e9f7,null))[_0x24fc('0x27')](saveUpdates(_0x2f1a99[_0x24fc('0x4c')],null))[_0x24fc('0x27')](respondWithResult(_0x12e9f7,null))[_0x24fc('0x4a')](handleError(_0x12e9f7,null));};exports[_0x24fc('0x28')]=function(_0x4574d3,_0x434700){return db[_0x24fc('0x41')]['find']({'where':{'id':_0x4574d3[_0x24fc('0x46')]['id']}})[_0x24fc('0x27')](handleEntityNotFound(_0x434700,null))[_0x24fc('0x27')](removeEntity(_0x434700,null))[_0x24fc('0x4a')](handleError(_0x434700,null));};exports[_0x24fc('0x4e')]=function(_0x5bdc4d,_0x428012,_0x4bf3a8){var _0x2c8f74={};var _0x2ee445={};var _0x446c14;var _0x41ddfb;return db[_0x24fc('0x41')][_0x24fc('0x4f')]({'where':{'id':_0x5bdc4d['params']['id']}})[_0x24fc('0x27')](handleEntityNotFound(_0x428012,null))[_0x24fc('0x27')](function(_0xc49d9f){if(_0xc49d9f){_0x446c14=_0xc49d9f;_0x2ee445[_0x24fc('0x2f')]=_[_0x24fc('0x32')](db[_0x24fc('0x50')]['rawAttributes']);_0x2ee445[_0x24fc('0x31')]=_[_0x24fc('0x32')](_0x5bdc4d[_0x24fc('0x31')]);_0x2ee445[_0x24fc('0x33')]=_[_0x24fc('0x34')](_0x2ee445[_0x24fc('0x2f')],_0x2ee445[_0x24fc('0x31')]);_0x2c8f74['attributes']=_[_0x24fc('0x34')](_0x2ee445[_0x24fc('0x2f')],qs['fields'](_0x5bdc4d[_0x24fc('0x31')][_0x24fc('0x36')]));_0x2c8f74[_0x24fc('0x35')]=_0x2c8f74[_0x24fc('0x35')][_0x24fc('0x37')]?_0x2c8f74[_0x24fc('0x35')]:_0x2ee445['model'];_0x2c8f74[_0x24fc('0x3a')]=qs['sort'](_0x5bdc4d[_0x24fc('0x31')][_0x24fc('0x3b')]);_0x2c8f74['where']=qs[_0x24fc('0x33')](_['pick'](_0x5bdc4d[_0x24fc('0x31')],_0x2ee445['filters']));if(_0x5bdc4d[_0x24fc('0x31')][_0x24fc('0x3d')]){_0x2c8f74['where']=_[_0x24fc('0x3e')](_0x2c8f74['where'],{'$or':_[_0x24fc('0x30')](_0x2c8f74[_0x24fc('0x35')],function(_0x59e46e){var _0xd1638f={};_0xd1638f[_0x59e46e]={'$like':'%'+_0x5bdc4d[_0x24fc('0x31')][_0x24fc('0x3d')]+'%'};return _0xd1638f;})});}_0x2c8f74=_[_0x24fc('0x3e')]({},_0x2c8f74,_0x5bdc4d[_0x24fc('0x40')]);return _0x446c14['getConfigurations'](_0x2c8f74);}})[_0x24fc('0x27')](function(_0x2f62b0){if(_0x2f62b0){_0x41ddfb=_0x2f62b0[_0x24fc('0x37')];if(!_0x5bdc4d[_0x24fc('0x31')][_0x24fc('0x38')]('nolimit')){_0x2c8f74['limit']=qs[_0x24fc('0x21')](_0x5bdc4d[_0x24fc('0x31')]['limit']);_0x2c8f74['offset']=qs[_0x24fc('0x1f')](_0x5bdc4d[_0x24fc('0x31')][_0x24fc('0x1f')]);}return _0x446c14[_0x24fc('0x4e')](_0x2c8f74);}})['then'](function(_0x20973d){if(_0x20973d){return _0x20973d?{'count':_0x41ddfb,'rows':_0x20973d}:null;}})[_0x24fc('0x27')](respondWithResult(_0x428012,null))[_0x24fc('0x4a')](handleError(_0x428012,null));};exports[_0x24fc('0x51')]=function(_0x1df0c4,_0x3e896f,_0x26ac2e){if(_0x1df0c4[_0x24fc('0x4c')]['id']){delete _0x1df0c4[_0x24fc('0x4c')]['id'];}return db[_0x24fc('0x41')][_0x24fc('0x4f')]({'where':{'id':_0x1df0c4[_0x24fc('0x46')]['id']}})[_0x24fc('0x27')](handleEntityNotFound(_0x3e896f,null))[_0x24fc('0x27')](function(_0x354fc6){if(_0x354fc6){_0x1df0c4['body'][_0x24fc('0x52')]=_0x354fc6['id'];_0x1df0c4[_0x24fc('0x4c')][_0x24fc('0x53')]=integrations[_0x24fc('0x54')](_0x1df0c4[_0x24fc('0x4c')][_0x24fc('0x55')],_0x1df0c4[_0x24fc('0x4c')][_0x24fc('0x2d')]);_0x1df0c4['body'][_0x24fc('0x56')]=integrations[_0x24fc('0x57')](_0x1df0c4[_0x24fc('0x4c')][_0x24fc('0x55')],_0x1df0c4['body'][_0x24fc('0x2d')]);return db[_0x24fc('0x50')]['create'](_0x1df0c4['body'],{'include':[{'model':db['ZendeskField'],'as':_0x24fc('0x53')},{'model':db[_0x24fc('0x58')],'as':_0x24fc('0x56')}]});}return null;})[_0x24fc('0x27')](respondWithResult(_0x3e896f,null))[_0x24fc('0x4a')](handleError(_0x3e896f,null));};exports[_0x24fc('0x59')]=function(_0x52e1aa,_0x11bafd,_0x15e8a3){var _0x5a2c09='';return db['ZendeskAccount'][_0x24fc('0x4f')]({'where':{'id':_0x52e1aa[_0x24fc('0x46')]['id']},'attributes':['id',_0x24fc('0x5a'),'password',_0x24fc('0x5b'),_0x24fc('0x5c'),_0x24fc('0x5d')]})['then'](handleEntityNotFound(_0x11bafd,null))['then'](function(_0x4c286d){if(_0x4c286d){_0x5a2c09=_0x4c286d['remoteUri'];var _0x4a1b8e=_0x5a2c09[_0x24fc('0x5e')](-0x1);if(_0x4a1b8e==='/'){_0x5a2c09=_0x5a2c09[_0x24fc('0x5f')](0x0,_0x5a2c09[_0x24fc('0x60')](_0x4a1b8e));}var _0x2a1236={'method':'GET','uri':util[_0x24fc('0x61')]('%s/%s',_0x5a2c09,_0x24fc('0x62')),'json':!![]};switch(_0x4c286d['authType']){case _0x24fc('0x63'):_0x2a1236[_0x24fc('0x64')]={'Authorization':util[_0x24fc('0x61')](_0x24fc('0x65'),new Buffer(util[_0x24fc('0x61')](_0x24fc('0x66'),_0x4c286d[_0x24fc('0x5a')],_0x4c286d['password']))[_0x24fc('0x67')](_0x24fc('0x68')))};break;case _0x24fc('0x5b'):_0x2a1236['headers']={'Authorization':util['format'](_0x24fc('0x65'),new Buffer(util[_0x24fc('0x61')]('%s/token:%s',_0x4c286d[_0x24fc('0x5a')],_0x4c286d[_0x24fc('0x5b')]))['toString'](_0x24fc('0x68')))};break;default:throw new db[(_0x24fc('0x69'))]['ValidationError'](_0x24fc('0x6a'));}return rp(_0x2a1236);}})[_0x24fc('0x27')](function(_0x24e717){if(_0x24e717){var _0x1efe4e=[_0x24fc('0x6b'),_0x24fc('0x6c'),'group','assignee'];_[_0x24fc('0x6d')](_0x24e717['ticket_fields'],function(_0x29bd9f){return _0x1efe4e['includes'](_0x29bd9f['type']);});return{'count':_0x24e717[_0x24fc('0x62')][_0x24fc('0x37')],'rows':_[_0x24fc('0x30')](_0x24e717[_0x24fc('0x62')],function(_0x66de4f){return{'id':_0x66de4f['id'],'name':_0x66de4f[_0x24fc('0x6e')]>0x7?_0x66de4f[_0x24fc('0x6f')]:_0x66de4f[_0x24fc('0x2d')],'custom':_0x66de4f['position']>0x7?!![]:![],'options':_0x66de4f[_0x24fc('0x70')]?_0x66de4f[_0x24fc('0x70')]:_0x66de4f['custom_field_options']?_0x66de4f['custom_field_options']:[]};})};}})[_0x24fc('0x27')](respondWithResult(_0x11bafd,null))[_0x24fc('0x4a')](function(_0x938dcf){var _0x1b2a97=_0x52e1aa[_0x24fc('0x31')]['test']?0x1f4:_0x938dcf[_0x24fc('0x71')]||0x1f4;logger[_0x24fc('0x72')]('getFields,\x20%s,\x20%s,\x20%s',_0x24fc('0x59'),_0x1b2a97,JSON[_0x24fc('0x73')](_0x938dcf));delete _0x938dcf[_0x24fc('0x2a')];if(_0x1b2a97===0x191){_0x1b2a97=0x190;}_0x11bafd['status'](_0x1b2a97)[_0x24fc('0x2b')](_0x52e1aa[_0x24fc('0x31')][_0x24fc('0x74')]?{'message':_0x24fc('0x75'),'statusCode':_0x938dcf[_0x24fc('0x71')]}:_0x938dcf);});}; \ No newline at end of file +var _0xe511=['getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','ZendeskConfiguration','create','getFields','username','password','authType','remoteUri','substring','format','ticket_fields','headers','Basic\x20%s','%s:%s','toString','token','%s/token:%s','base64','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','system_field_options','custom_field_options','send','test','statusCode','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','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','update','then','stack','index','fieldName','type','key','model','map','name','query','keys','filters','attributes','intersection','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','ZendeskAccount','includeAll','include','findAll','catch','show','params','rawAttributes','fields','options','body','find','nolimit'];(function(_0x56c024,_0x2d2949){var _0x16b5ec=function(_0x5706e1){while(--_0x5706e1){_0x56c024['push'](_0x56c024['shift']());}};_0x16b5ec(++_0x2d2949);}(_0xe511,0x16f));var _0x1e51=function(_0x4d2a51,_0x4b208c){_0x4d2a51=_0x4d2a51-0x0;var _0x7d9ab2=_0xe511[_0x4d2a51];return _0x7d9ab2;};'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'];var integrations=require(_0x1e51('0x18'));function respondWithStatusCode(_0x5544eb,_0x408a77){_0x408a77=_0x408a77||0xcc;return function(_0x102f01){if(_0x102f01){return _0x5544eb[_0x1e51('0x19')](_0x408a77);}return _0x5544eb[_0x1e51('0x1a')](_0x408a77)[_0x1e51('0x1b')]();};}function respondWithResult(_0x32945d,_0x441c70){_0x441c70=_0x441c70||0xc8;return function(_0x467e77){if(_0x467e77){return _0x32945d[_0x1e51('0x1a')](_0x441c70)[_0x1e51('0x1c')](_0x467e77);}};}function respondWithFilteredResult(_0x5a5c07,_0x3b01b7){return function(_0x24db4f){if(_0x24db4f){var _0x4526b4=typeof _0x3b01b7['offset']===_0x1e51('0x1d')&&typeof _0x3b01b7['limit']==='undefined';var _0x1f6f4e=_0x24db4f[_0x1e51('0x1e')];var _0x40ae4c=_0x4526b4?0x0:_0x3b01b7[_0x1e51('0x1f')];var _0x4d1aae=_0x4526b4?_0x24db4f[_0x1e51('0x1e')]:_0x3b01b7['offset']+_0x3b01b7[_0x1e51('0x20')];var _0x4a9272;if(_0x4d1aae>=_0x1f6f4e){_0x4d1aae=_0x1f6f4e;_0x4a9272=0xc8;}else{_0x4a9272=0xce;}_0x5a5c07[_0x1e51('0x1a')](_0x4a9272);return _0x5a5c07[_0x1e51('0x21')](_0x1e51('0x22'),_0x40ae4c+'-'+_0x4d1aae+'/'+_0x1f6f4e)[_0x1e51('0x1c')](_0x24db4f);}return null;};}function patchUpdates(_0x506f40){return function(_0x5223c3){try{jsonpatch['apply'](_0x5223c3,_0x506f40,!![]);}catch(_0x548c32){return BPromise[_0x1e51('0x23')](_0x548c32);}return _0x5223c3['save']();};}function saveUpdates(_0x3f7340,_0x28aacb){return function(_0x415154){if(_0x415154){return _0x415154[_0x1e51('0x24')](_0x3f7340)[_0x1e51('0x25')](function(_0xf9298){return _0xf9298;});}return null;};}function removeEntity(_0x270adf,_0x461d3d){return function(_0x4bcdd3){if(_0x4bcdd3){return _0x4bcdd3['destroy']()[_0x1e51('0x25')](function(){_0x270adf[_0x1e51('0x1a')](0xcc)[_0x1e51('0x1b')]();});}};}function handleEntityNotFound(_0x1386db,_0x505d79){return function(_0x54d031){if(!_0x54d031){_0x1386db['sendStatus'](0x194);}return _0x54d031;};}function handleError(_0x1eb83f,_0x2a1561){_0x2a1561=_0x2a1561||0x1f4;return function(_0x433c2d){logger['error'](_0x433c2d[_0x1e51('0x26')]);if(_0x433c2d['name']){delete _0x433c2d['name'];}_0x1eb83f[_0x1e51('0x1a')](_0x2a1561)['send'](_0x433c2d);};}exports[_0x1e51('0x27')]=function(_0x1eb79f,_0x56722f){var _0x3e6ef2={},_0x10ee23={},_0x71c7af={'count':0x0,'rows':[]};var _0x6862d1=_['map'](db['ZendeskAccount']['rawAttributes'],function(_0x20eb9b){return{'name':_0x20eb9b[_0x1e51('0x28')],'type':_0x20eb9b[_0x1e51('0x29')][_0x1e51('0x2a')]};});_0x10ee23[_0x1e51('0x2b')]=_[_0x1e51('0x2c')](_0x6862d1,_0x1e51('0x2d'));_0x10ee23[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x1eb79f[_0x1e51('0x2e')]);_0x10ee23[_0x1e51('0x30')]=_['intersection'](_0x10ee23[_0x1e51('0x2b')],_0x10ee23[_0x1e51('0x2e')]);_0x3e6ef2[_0x1e51('0x31')]=_[_0x1e51('0x32')](_0x10ee23[_0x1e51('0x2b')],qs['fields'](_0x1eb79f[_0x1e51('0x2e')]['fields']));_0x3e6ef2[_0x1e51('0x31')]=_0x3e6ef2[_0x1e51('0x31')][_0x1e51('0x33')]?_0x3e6ef2['attributes']:_0x10ee23[_0x1e51('0x2b')];if(!_0x1eb79f['query'][_0x1e51('0x34')]('nolimit')){_0x3e6ef2['limit']=qs[_0x1e51('0x20')](_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x20')]);_0x3e6ef2['offset']=qs[_0x1e51('0x1f')](_0x1eb79f['query'][_0x1e51('0x1f')]);}_0x3e6ef2[_0x1e51('0x35')]=qs['sort'](_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x36')]);_0x3e6ef2[_0x1e51('0x37')]=qs[_0x1e51('0x30')](_[_0x1e51('0x38')](_0x1eb79f[_0x1e51('0x2e')],_0x10ee23['filters']),_0x6862d1);if(_0x1eb79f['query'][_0x1e51('0x39')]){_0x3e6ef2['where']=_[_0x1e51('0x3a')](_0x3e6ef2[_0x1e51('0x37')],{'$or':_[_0x1e51('0x2c')](_0x6862d1,function(_0xcfa1d8){if(_0xcfa1d8[_0x1e51('0x29')]!==_0x1e51('0x3b')){var _0x845a62={};_0x845a62[_0xcfa1d8[_0x1e51('0x2d')]]={'$like':'%'+_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x39')]+'%'};return _0x845a62;}})});}_0x3e6ef2=_[_0x1e51('0x3a')]({},_0x3e6ef2,_0x1eb79f['options']);var _0x29a689={'where':_0x3e6ef2['where']};return db[_0x1e51('0x3c')][_0x1e51('0x1e')](_0x29a689)[_0x1e51('0x25')](function(_0x471386){_0x71c7af[_0x1e51('0x1e')]=_0x471386;if(_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x3d')]){_0x3e6ef2[_0x1e51('0x3e')]=[{'all':!![]}];}return db[_0x1e51('0x3c')][_0x1e51('0x3f')](_0x3e6ef2);})[_0x1e51('0x25')](function(_0x5b4b3f){_0x71c7af['rows']=_0x5b4b3f;return _0x71c7af;})[_0x1e51('0x25')](respondWithFilteredResult(_0x56722f,_0x3e6ef2))[_0x1e51('0x40')](handleError(_0x56722f,null));};exports[_0x1e51('0x41')]=function(_0x4650e4,_0x1ef3d3){var _0x1a9e0d={'raw':![],'where':{'id':_0x4650e4[_0x1e51('0x42')]['id']}},_0x25592c={};_0x25592c['model']=_[_0x1e51('0x2f')](db[_0x1e51('0x3c')][_0x1e51('0x43')]);_0x25592c[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x4650e4[_0x1e51('0x2e')]);_0x25592c[_0x1e51('0x30')]=_['intersection'](_0x25592c[_0x1e51('0x2b')],_0x25592c[_0x1e51('0x2e')]);_0x1a9e0d['attributes']=_[_0x1e51('0x32')](_0x25592c[_0x1e51('0x2b')],qs[_0x1e51('0x44')](_0x4650e4['query'][_0x1e51('0x44')]));_0x1a9e0d[_0x1e51('0x31')]=_0x1a9e0d[_0x1e51('0x31')][_0x1e51('0x33')]?_0x1a9e0d[_0x1e51('0x31')]:_0x25592c[_0x1e51('0x2b')];if(_0x4650e4[_0x1e51('0x2e')][_0x1e51('0x3d')]){_0x1a9e0d[_0x1e51('0x3e')]=[{'all':!![]}];}_0x1a9e0d=_['merge']({},_0x1a9e0d,_0x4650e4[_0x1e51('0x45')]);return db[_0x1e51('0x3c')]['find'](_0x1a9e0d)[_0x1e51('0x25')](handleEntityNotFound(_0x1ef3d3,null))[_0x1e51('0x25')](respondWithResult(_0x1ef3d3,null))[_0x1e51('0x40')](handleError(_0x1ef3d3,null));};exports['create']=function(_0x44468a,_0x4634de){return db[_0x1e51('0x3c')]['create'](_0x44468a[_0x1e51('0x46')],{})['then'](respondWithResult(_0x4634de,0xc9))['catch'](handleError(_0x4634de,null));};exports['update']=function(_0x169e6c,_0x2e79ca){if(_0x169e6c['body']['id']){delete _0x169e6c['body']['id'];}return db[_0x1e51('0x3c')][_0x1e51('0x47')]({'where':{'id':_0x169e6c[_0x1e51('0x42')]['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x2e79ca,null))[_0x1e51('0x25')](saveUpdates(_0x169e6c[_0x1e51('0x46')],null))['then'](respondWithResult(_0x2e79ca,null))[_0x1e51('0x40')](handleError(_0x2e79ca,null));};exports['destroy']=function(_0xf6bd35,_0x43589a){return db['ZendeskAccount']['find']({'where':{'id':_0xf6bd35['params']['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x43589a,null))[_0x1e51('0x25')](removeEntity(_0x43589a,null))[_0x1e51('0x40')](handleError(_0x43589a,null));};exports['getConfigurations']=function(_0x2fdee1,_0x1fe669,_0x4226da){var _0x2100d4={};var _0x1ccb55={};var _0x12584c;var _0x32fe1f;return db[_0x1e51('0x3c')]['findOne']({'where':{'id':_0x2fdee1[_0x1e51('0x42')]['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x1fe669,null))[_0x1e51('0x25')](function(_0x213edb){if(_0x213edb){_0x12584c=_0x213edb;_0x1ccb55[_0x1e51('0x2b')]=_[_0x1e51('0x2f')](db['ZendeskConfiguration'][_0x1e51('0x43')]);_0x1ccb55['query']=_['keys'](_0x2fdee1['query']);_0x1ccb55[_0x1e51('0x30')]=_[_0x1e51('0x32')](_0x1ccb55[_0x1e51('0x2b')],_0x1ccb55['query']);_0x2100d4[_0x1e51('0x31')]=_[_0x1e51('0x32')](_0x1ccb55[_0x1e51('0x2b')],qs['fields'](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x44')]));_0x2100d4[_0x1e51('0x31')]=_0x2100d4['attributes'][_0x1e51('0x33')]?_0x2100d4[_0x1e51('0x31')]:_0x1ccb55[_0x1e51('0x2b')];_0x2100d4[_0x1e51('0x35')]=qs[_0x1e51('0x36')](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x36')]);_0x2100d4[_0x1e51('0x37')]=qs['filters'](_[_0x1e51('0x38')](_0x2fdee1[_0x1e51('0x2e')],_0x1ccb55['filters']));if(_0x2fdee1['query']['filter']){_0x2100d4[_0x1e51('0x37')]=_[_0x1e51('0x3a')](_0x2100d4[_0x1e51('0x37')],{'$or':_[_0x1e51('0x2c')](_0x2100d4[_0x1e51('0x31')],function(_0x3c322c){var _0x45b649={};_0x45b649[_0x3c322c]={'$like':'%'+_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x39')]+'%'};return _0x45b649;})});}_0x2100d4=_['merge']({},_0x2100d4,_0x2fdee1['options']);return _0x12584c['getConfigurations'](_0x2100d4);}})[_0x1e51('0x25')](function(_0x4048a4){if(_0x4048a4){_0x32fe1f=_0x4048a4['length'];if(!_0x2fdee1['query'][_0x1e51('0x34')](_0x1e51('0x48'))){_0x2100d4['limit']=qs[_0x1e51('0x20')](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x20')]);_0x2100d4[_0x1e51('0x1f')]=qs[_0x1e51('0x1f')](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x1f')]);}return _0x12584c[_0x1e51('0x49')](_0x2100d4);}})[_0x1e51('0x25')](function(_0x32863f){if(_0x32863f){return _0x32863f?{'count':_0x32fe1f,'rows':_0x32863f}:null;}})['then'](respondWithResult(_0x1fe669,null))[_0x1e51('0x40')](handleError(_0x1fe669,null));};exports[_0x1e51('0x4a')]=function(_0x3657a2,_0x402bbd,_0xc720e2){if(_0x3657a2[_0x1e51('0x46')]['id']){delete _0x3657a2['body']['id'];}return db['ZendeskAccount'][_0x1e51('0x4b')]({'where':{'id':_0x3657a2[_0x1e51('0x42')]['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x402bbd,null))[_0x1e51('0x25')](function(_0x52a439){if(_0x52a439){_0x3657a2['body']['AccountId']=_0x52a439['id'];_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4c')]=integrations[_0x1e51('0x4d')](_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4e')],_0x3657a2['body'][_0x1e51('0x29')]);_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4f')]=integrations['getDescriptions'](_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4e')],_0x3657a2[_0x1e51('0x46')]['type']);return db[_0x1e51('0x50')][_0x1e51('0x51')](_0x3657a2['body'],{'include':[{'model':db['ZendeskField'],'as':_0x1e51('0x4c')},{'model':db['ZendeskField'],'as':_0x1e51('0x4f')}]});}return null;})['then'](respondWithResult(_0x402bbd,null))[_0x1e51('0x40')](handleError(_0x402bbd,null));};exports[_0x1e51('0x52')]=function(_0x35f12e,_0x457e4a,_0x5142ed){var _0x37f3e6='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x35f12e[_0x1e51('0x42')]['id']},'attributes':['id',_0x1e51('0x53'),_0x1e51('0x54'),'token',_0x1e51('0x55'),_0x1e51('0x56')]})[_0x1e51('0x25')](handleEntityNotFound(_0x457e4a,null))[_0x1e51('0x25')](function(_0x5b76ae){if(_0x5b76ae){_0x37f3e6=_0x5b76ae[_0x1e51('0x56')];var _0x5ef17b=_0x37f3e6['slice'](-0x1);if(_0x5ef17b==='/'){_0x37f3e6=_0x37f3e6[_0x1e51('0x57')](0x0,_0x37f3e6['lastIndexOf'](_0x5ef17b));}var _0x35ece9={'method':'GET','uri':util[_0x1e51('0x58')]('%s/%s',_0x37f3e6,_0x1e51('0x59')),'json':!![]};switch(_0x5b76ae[_0x1e51('0x55')]){case'password':_0x35ece9[_0x1e51('0x5a')]={'Authorization':util['format'](_0x1e51('0x5b'),new Buffer(util[_0x1e51('0x58')](_0x1e51('0x5c'),_0x5b76ae[_0x1e51('0x53')],_0x5b76ae[_0x1e51('0x54')]))[_0x1e51('0x5d')]('base64'))};break;case _0x1e51('0x5e'):_0x35ece9['headers']={'Authorization':util['format'](_0x1e51('0x5b'),new Buffer(util[_0x1e51('0x58')](_0x1e51('0x5f'),_0x5b76ae[_0x1e51('0x53')],_0x5b76ae[_0x1e51('0x5e')]))[_0x1e51('0x5d')](_0x1e51('0x60')))};break;default:throw new db['Sequelize'][(_0x1e51('0x61'))](_0x1e51('0x62'));}return rp(_0x35ece9);}})[_0x1e51('0x25')](function(_0x4c6920){if(_0x4c6920){var _0x4da887=[_0x1e51('0x63'),_0x1e51('0x64'),'group',_0x1e51('0x65')];_[_0x1e51('0x66')](_0x4c6920['ticket_fields'],function(_0x5eb939){return _0x4da887[_0x1e51('0x67')](_0x5eb939[_0x1e51('0x29')]);});return{'count':_0x4c6920[_0x1e51('0x59')][_0x1e51('0x33')],'rows':_[_0x1e51('0x2c')](_0x4c6920[_0x1e51('0x59')],function(_0x3718d9){return{'id':_0x3718d9['id'],'name':_0x3718d9['position']>0x7?_0x3718d9['title']:_0x3718d9[_0x1e51('0x29')],'custom':_0x3718d9[_0x1e51('0x68')]>0x7?!![]:![],'options':_0x3718d9['system_field_options']?_0x3718d9[_0x1e51('0x69')]:_0x3718d9[_0x1e51('0x6a')]?_0x3718d9['custom_field_options']:[]};})};}})[_0x1e51('0x25')](respondWithResult(_0x457e4a,null))['catch'](function(_0x34b98f){var _0x561812=_0x35f12e['query']['test']?0x1f4:_0x34b98f['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x1e51('0x52'),_0x561812,JSON['stringify'](_0x34b98f));delete _0x34b98f[_0x1e51('0x2d')];if(_0x561812===0x191){_0x561812=0x190;}_0x457e4a['status'](_0x561812)[_0x1e51('0x6b')](_0x35f12e[_0x1e51('0x2e')][_0x1e51('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x34b98f[_0x1e51('0x6d')]}:_0x34b98f);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 66f43ee..72b2426 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 _0x16a7=['request-promise','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api'];(function(_0x3c22e0,_0x1dc6ea){var _0x215811=function(_0x1b453c){while(--_0x1b453c){_0x3c22e0['push'](_0x3c22e0['shift']());}};_0x215811(++_0x1dc6ea);}(_0x16a7,0xa5));var _0x716a=function(_0x4ce984,_0x1c0de6){_0x4ce984=_0x4ce984-0x0;var _0x53b1a2=_0x16a7[_0x4ce984];return _0x53b1a2;};'use strict';var _=require(_0x716a('0x0'));var util=require(_0x716a('0x1'));var logger=require(_0x716a('0x2'))(_0x716a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x716a('0x4'));var fs=require('fs');var path=require(_0x716a('0x5'));var rimraf=require('rimraf');var config=require(_0x716a('0x6'));var attributes=require(_0x716a('0x7'));var integrations=require(_0x716a('0x8'));module[_0x716a('0x9')]=function(_0x22b026,_0x557d05){return _0x22b026[_0x716a('0xa')](_0x716a('0xb'),attributes,{'tableName':_0x716a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44bd=['moment','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x44bd,0x6c));var _0xd44b=function(_0x128e7e,_0x2f9b63){_0x128e7e=_0x128e7e-0x0;var _0x4ab22e=_0x44bd[_0x128e7e];return _0x4ab22e;};'use strict';var _=require(_0xd44b('0x0'));var util=require(_0xd44b('0x1'));var logger=require(_0xd44b('0x2'))(_0xd44b('0x3'));var moment=require(_0xd44b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd44b('0x5'));var rimraf=require(_0xd44b('0x6'));var config=require(_0xd44b('0x7'));var attributes=require(_0xd44b('0x8'));var integrations=require(_0xd44b('0x9'));module[_0xd44b('0xa')]=function(_0x58ce68,_0x4a031a){return _0x58ce68[_0xd44b('0xb')](_0xd44b('0xc'),attributes,{'tableName':_0xd44b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index f45c082..cf6cb7e 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 _0x9b70=['then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','find','ShowZendeskAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x314a8c,_0x1c2e8d){var _0x1d4607=function(_0x3df20c){while(--_0x3df20c){_0x314a8c['push'](_0x314a8c['shift']());}};_0x1d4607(++_0x1c2e8d);}(_0x9b70,0x8b));var _0x09b7=function(_0xcdf809,_0x2881f0){_0xcdf809=_0xcdf809-0x0;var _0x4d4d70=_0x9b70[_0xcdf809];return _0x4d4d70;};'use strict';var _=require(_0x09b7('0x0'));var util=require(_0x09b7('0x1'));var moment=require(_0x09b7('0x2'));var BPromise=require(_0x09b7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x09b7('0x4'));var db=require(_0x09b7('0x5'))['db'];var utils=require(_0x09b7('0x6'));var logger=require('../../config/logger')(_0x09b7('0x7'));var config=require(_0x09b7('0x8'));var jayson=require(_0x09b7('0x9'));var client=jayson[_0x09b7('0xa')][_0x09b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52ceeb,_0x53b182,_0x213ed8){return new BPromise(function(_0x17b2ec,_0x10922d){return client[_0x09b7('0xc')](_0x52ceeb,_0x213ed8)[_0x09b7('0xd')](function(_0x2e8ee5){logger[_0x09b7('0xe')](_0x09b7('0xf'),_0x53b182,_0x09b7('0x10'));logger['debug'](_0x09b7('0x11'),_0x53b182,_0x09b7('0x10'),JSON[_0x09b7('0x12')](_0x2e8ee5));if(_0x2e8ee5[_0x09b7('0x13')]){if(_0x2e8ee5[_0x09b7('0x13')][_0x09b7('0x14')]===0x1f4){logger[_0x09b7('0x13')](_0x09b7('0xf'),_0x53b182,_0x2e8ee5[_0x09b7('0x13')][_0x09b7('0x15')]);return _0x10922d(_0x2e8ee5[_0x09b7('0x13')]['message']);}logger[_0x09b7('0x13')](_0x09b7('0xf'),_0x53b182,_0x2e8ee5[_0x09b7('0x13')]['message']);return _0x17b2ec(_0x2e8ee5[_0x09b7('0x13')][_0x09b7('0x15')]);}else{logger['info'](_0x09b7('0xf'),_0x53b182,_0x09b7('0x10'));_0x17b2ec(_0x2e8ee5[_0x09b7('0x16')][_0x09b7('0x15')]);}})[_0x09b7('0x17')](function(_0x1482ce){logger[_0x09b7('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x53b182,_0x1482ce);_0x10922d(_0x1482ce);});});}exports[_0x09b7('0x18')]=function(_0x5bcf39){var _0x4097b1=this;return new Promise(function(_0xe6b7ef,_0x8e65d0){return db[_0x09b7('0x19')][_0x09b7('0x1a')]({'raw':_0x5bcf39[_0x09b7('0x1b')]?_0x5bcf39[_0x09b7('0x1b')][_0x09b7('0x1c')]===undefined?!![]:![]:!![],'where':_0x5bcf39[_0x09b7('0x1b')]?_0x5bcf39['options'][_0x09b7('0x1d')]||null:null,'attributes':_0x5bcf39[_0x09b7('0x1b')]?_0x5bcf39['options'][_0x09b7('0x1e')]||null:null,'limit':_0x5bcf39['options']?_0x5bcf39['options'][_0x09b7('0x1f')]||null:null,'include':_0x5bcf39[_0x09b7('0x1b')]?_0x5bcf39['options'][_0x09b7('0x20')]?_[_0x09b7('0x21')](_0x5bcf39[_0x09b7('0x1b')]['include'],function(_0x15d063){return{'model':db[_0x15d063[_0x09b7('0x22')]],'as':_0x15d063['as'],'attributes':_0x15d063[_0x09b7('0x1e')],'include':_0x15d063[_0x09b7('0x20')]?_[_0x09b7('0x21')](_0x15d063[_0x09b7('0x20')],function(_0x57283d){return{'model':db[_0x57283d[_0x09b7('0x22')]],'as':_0x57283d['as'],'attributes':_0x57283d['attributes'],'include':_0x57283d[_0x09b7('0x20')]?_[_0x09b7('0x21')](_0x57283d[_0x09b7('0x20')],function(_0x3a06c8){return{'model':db[_0x3a06c8[_0x09b7('0x22')]],'as':_0x3a06c8['as'],'attributes':_0x3a06c8[_0x09b7('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x22731d){logger[_0x09b7('0xe')]('GetZendeskAccount',_0x5bcf39);logger[_0x09b7('0x23')](_0x09b7('0x18'),_0x5bcf39,JSON['stringify'](_0x22731d));_0xe6b7ef(_0x22731d);})[_0x09b7('0x17')](function(_0x329422){logger[_0x09b7('0x13')](_0x09b7('0x18'),_0x329422[_0x09b7('0x15')],_0x5bcf39);_0x8e65d0(_0x4097b1[_0x09b7('0x13')](0x1f4,_0x329422[_0x09b7('0x15')]));});});};exports['ShowZendeskAccount']=function(_0x37f1ca){var _0xd294ea=this;return new Promise(function(_0x26dcc4,_0x14f3b0){return db[_0x09b7('0x19')][_0x09b7('0x24')]({'raw':_0x37f1ca[_0x09b7('0x1b')]?_0x37f1ca[_0x09b7('0x1b')][_0x09b7('0x1c')]===undefined?!![]:![]:!![],'where':_0x37f1ca[_0x09b7('0x1b')]?_0x37f1ca[_0x09b7('0x1b')]['where']||null:null,'attributes':_0x37f1ca['options']?_0x37f1ca[_0x09b7('0x1b')][_0x09b7('0x1e')]||null:null,'include':_0x37f1ca[_0x09b7('0x1b')]?_0x37f1ca[_0x09b7('0x1b')][_0x09b7('0x20')]?_[_0x09b7('0x21')](_0x37f1ca[_0x09b7('0x1b')][_0x09b7('0x20')],function(_0x433592){return{'model':db[_0x433592[_0x09b7('0x22')]],'as':_0x433592['as'],'attributes':_0x433592[_0x09b7('0x1e')],'include':_0x433592[_0x09b7('0x20')]?_[_0x09b7('0x21')](_0x433592[_0x09b7('0x20')],function(_0x55f24e){return{'model':db[_0x55f24e[_0x09b7('0x22')]],'as':_0x55f24e['as'],'attributes':_0x55f24e[_0x09b7('0x1e')],'include':_0x55f24e['include']?_['map'](_0x55f24e[_0x09b7('0x20')],function(_0xa26e72){return{'model':db[_0xa26e72[_0x09b7('0x22')]],'as':_0xa26e72['as'],'attributes':_0xa26e72[_0x09b7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x09b7('0xd')](function(_0x4f90fc){logger['info']('ShowZendeskAccount',_0x37f1ca);logger[_0x09b7('0x23')](_0x09b7('0x25'),_0x37f1ca,JSON['stringify'](_0x4f90fc));_0x26dcc4(_0x4f90fc);})[_0x09b7('0x17')](function(_0x1e18ed){logger[_0x09b7('0x13')]('ShowZendeskAccount',_0x1e18ed[_0x09b7('0x15')],_0x37f1ca);_0x14f3b0(_0xd294ea[_0x09b7('0x13')](0x1f4,_0x1e18ed[_0x09b7('0x15')]));});});}; \ No newline at end of file +var _0x33fa=['jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','options','raw','where','attributes','limit','include','map','model','GetZendeskAccount','stringify','ShowZendeskAccount','ZendeskAccount','find','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x413727,_0x17adb1){var _0x5f46d7=function(_0xbb668e){while(--_0xbb668e){_0x413727['push'](_0x413727['shift']());}};_0x5f46d7(++_0x17adb1);}(_0x33fa,0xd0));var _0xa33f=function(_0xd0baae,_0x3020f4){_0xd0baae=_0xd0baae-0x0;var _0x538549=_0x33fa[_0xd0baae];return _0x538549;};'use strict';var _=require(_0xa33f('0x0'));var util=require(_0xa33f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa33f('0x2'));var fs=require('fs');var Redis=require(_0xa33f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa33f('0x4'));var logger=require(_0xa33f('0x5'))(_0xa33f('0x6'));var config=require(_0xa33f('0x7'));var jayson=require(_0xa33f('0x8'));var client=jayson[_0xa33f('0x9')][_0xa33f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10892f,_0xaaf4a2,_0x59e581){return new BPromise(function(_0x6b67af,_0x20f097){return client[_0xa33f('0xb')](_0x10892f,_0x59e581)[_0xa33f('0xc')](function(_0xd19e30){logger[_0xa33f('0xd')](_0xa33f('0xe'),_0xaaf4a2,_0xa33f('0xf'));logger[_0xa33f('0x10')](_0xa33f('0x11'),_0xaaf4a2,_0xa33f('0xf'),JSON['stringify'](_0xd19e30));if(_0xd19e30[_0xa33f('0x12')]){if(_0xd19e30[_0xa33f('0x12')][_0xa33f('0x13')]===0x1f4){logger['error'](_0xa33f('0xe'),_0xaaf4a2,_0xd19e30[_0xa33f('0x12')]['message']);return _0x20f097(_0xd19e30['error'][_0xa33f('0x14')]);}logger['error'](_0xa33f('0xe'),_0xaaf4a2,_0xd19e30['error']['message']);return _0x6b67af(_0xd19e30['error'][_0xa33f('0x14')]);}else{logger[_0xa33f('0xd')](_0xa33f('0xe'),_0xaaf4a2,_0xa33f('0xf'));_0x6b67af(_0xd19e30[_0xa33f('0x15')][_0xa33f('0x14')]);}})[_0xa33f('0x16')](function(_0x14e2b0){logger['error'](_0xa33f('0xe'),_0xaaf4a2,_0x14e2b0);_0x20f097(_0x14e2b0);});});}exports['GetZendeskAccount']=function(_0x41d171){var _0x10c55c=this;return new Promise(function(_0x545d75,_0x2d07a3){return db['ZendeskAccount']['findAll']({'raw':_0x41d171[_0xa33f('0x17')]?_0x41d171[_0xa33f('0x17')][_0xa33f('0x18')]===undefined?!![]:![]:!![],'where':_0x41d171[_0xa33f('0x17')]?_0x41d171[_0xa33f('0x17')][_0xa33f('0x19')]||null:null,'attributes':_0x41d171['options']?_0x41d171['options'][_0xa33f('0x1a')]||null:null,'limit':_0x41d171[_0xa33f('0x17')]?_0x41d171[_0xa33f('0x17')][_0xa33f('0x1b')]||null:null,'include':_0x41d171[_0xa33f('0x17')]?_0x41d171[_0xa33f('0x17')]['include']?_['map'](_0x41d171[_0xa33f('0x17')]['include'],function(_0x520811){return{'model':db[_0x520811['model']],'as':_0x520811['as'],'attributes':_0x520811['attributes'],'include':_0x520811[_0xa33f('0x1c')]?_[_0xa33f('0x1d')](_0x520811['include'],function(_0x2dc7cf){return{'model':db[_0x2dc7cf[_0xa33f('0x1e')]],'as':_0x2dc7cf['as'],'attributes':_0x2dc7cf['attributes'],'include':_0x2dc7cf[_0xa33f('0x1c')]?_[_0xa33f('0x1d')](_0x2dc7cf[_0xa33f('0x1c')],function(_0x4ec7cd){return{'model':db[_0x4ec7cd['model']],'as':_0x4ec7cd['as'],'attributes':_0x4ec7cd[_0xa33f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa33f('0xc')](function(_0x33665c){logger[_0xa33f('0xd')](_0xa33f('0x1f'),_0x41d171);logger[_0xa33f('0x10')](_0xa33f('0x1f'),_0x41d171,JSON[_0xa33f('0x20')](_0x33665c));_0x545d75(_0x33665c);})[_0xa33f('0x16')](function(_0x569369){logger['error'](_0xa33f('0x1f'),_0x569369[_0xa33f('0x14')],_0x41d171);_0x2d07a3(_0x10c55c['error'](0x1f4,_0x569369[_0xa33f('0x14')]));});});};exports[_0xa33f('0x21')]=function(_0x86d051){var _0x284daa=this;return new Promise(function(_0xabd600,_0x191807){return db[_0xa33f('0x22')][_0xa33f('0x23')]({'raw':_0x86d051[_0xa33f('0x17')]?_0x86d051[_0xa33f('0x17')][_0xa33f('0x18')]===undefined?!![]:![]:!![],'where':_0x86d051[_0xa33f('0x17')]?_0x86d051[_0xa33f('0x17')][_0xa33f('0x19')]||null:null,'attributes':_0x86d051['options']?_0x86d051[_0xa33f('0x17')][_0xa33f('0x1a')]||null:null,'include':_0x86d051[_0xa33f('0x17')]?_0x86d051[_0xa33f('0x17')][_0xa33f('0x1c')]?_[_0xa33f('0x1d')](_0x86d051[_0xa33f('0x17')]['include'],function(_0x5ee8b1){return{'model':db[_0x5ee8b1[_0xa33f('0x1e')]],'as':_0x5ee8b1['as'],'attributes':_0x5ee8b1[_0xa33f('0x1a')],'include':_0x5ee8b1['include']?_['map'](_0x5ee8b1[_0xa33f('0x1c')],function(_0x38524d){return{'model':db[_0x38524d[_0xa33f('0x1e')]],'as':_0x38524d['as'],'attributes':_0x38524d['attributes'],'include':_0x38524d[_0xa33f('0x1c')]?_[_0xa33f('0x1d')](_0x38524d['include'],function(_0xe6dddf){return{'model':db[_0xe6dddf[_0xa33f('0x1e')]],'as':_0xe6dddf['as'],'attributes':_0xe6dddf[_0xa33f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa33f('0xc')](function(_0x2a1bab){logger[_0xa33f('0xd')](_0xa33f('0x21'),_0x86d051);logger['debug'](_0xa33f('0x21'),_0x86d051,JSON['stringify'](_0x2a1bab));_0xabd600(_0x2a1bab);})['catch'](function(_0x444f94){logger[_0xa33f('0x12')](_0xa33f('0x21'),_0x444f94[_0xa33f('0x14')],_0x86d051);_0x191807(_0x284daa[_0xa33f('0x12')](0x1f4,_0x444f94[_0xa33f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 97e7ff5..b13c1e0 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 _0x757a=['index','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','setTags','put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x308fa3,_0x35f77a){var _0x5640fc=function(_0x61faa8){while(--_0x61faa8){_0x308fa3['push'](_0x308fa3['shift']());}};_0x5640fc(++_0x35f77a);}(_0x757a,0xde));var _0xa757=function(_0x36fd1b,_0x45bda1){_0x36fd1b=_0x36fd1b-0x0;var _0x32b8d4=_0x757a[_0x36fd1b];return _0x32b8d4;};'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('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['getFields']);router[_0xa757('0x7')](_0xa757('0xc'),auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0x7')](_0xa757('0xe'),auth[_0xa757('0x9')](),controller['getDescriptions']);router['get']('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0xa757('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa757('0xf')]('/:id/tags',auth['isAuthenticated'](),controller[_0xa757('0x10')]);router[_0xa757('0x11')](_0xa757('0x12'),auth[_0xa757('0x9')](),controller[_0xa757('0x13')]);router[_0xa757('0x14')](_0xa757('0x12'),auth[_0xa757('0x9')](),controller[_0xa757('0x15')]);module[_0xa757('0x16')]=router; \ No newline at end of file +var _0xcb91=['get','index','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','create','post','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller'];(function(_0x1eeb15,_0x539688){var _0x12a9ce=function(_0x3933de){while(--_0x3933de){_0x1eeb15['push'](_0x1eeb15['shift']());}};_0x12a9ce(++_0x539688);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1f27df,_0x4f1a64){_0x1f27df=_0x1f27df-0x0;var _0x286ee2=_0xcb91[_0x1f27df];return _0x286ee2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/:id',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0x1cb9('0x7')](_0x1cb9('0xc'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0x7')]('/:id/descriptions',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xe')]);router[_0x1cb9('0x7')](_0x1cb9('0xf'),auth[_0x1cb9('0x9')](),controller['getTags']);router['post']('/',auth['isAuthenticated'](),controller[_0x1cb9('0x10')]);router[_0x1cb9('0x11')](_0x1cb9('0xf'),auth[_0x1cb9('0x9')](),controller['setTags']);router[_0x1cb9('0x12')](_0x1cb9('0x13'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);router[_0x1cb9('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x1cb9('0x16')]);module[_0x1cb9('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 75d71ab..605f364 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 _0xa3e6=['exports','STRING','sequelize'];(function(_0x150498,_0x4e4bd6){var _0x1bf8b4=function(_0x523b70){while(--_0x523b70){_0x150498['push'](_0x150498['shift']());}};_0x1bf8b4(++_0x4e4bd6);}(_0xa3e6,0x65));var _0x6a3e=function(_0x15e575,_0x2ddb64){_0x15e575=_0x15e575-0x0;var _0x1d31ef=_0xa3e6[_0x15e575];return _0x1d31ef;};'use strict';var Sequelize=require(_0x6a3e('0x0'));module[_0x6a3e('0x1')]={'name':{'type':Sequelize[_0x6a3e('0x2')]},'description':{'type':Sequelize[_0x6a3e('0x2')]}}; \ No newline at end of file +var _0xd84b=['sequelize','STRING'];(function(_0x2b8d5b,_0x62fcaa){var _0x261bbf=function(_0x28441d){while(--_0x28441d){_0x2b8d5b['push'](_0x2b8d5b['shift']());}};_0x261bbf(++_0x62fcaa);}(_0xd84b,0xc0));var _0xbd84=function(_0x3a5d65,_0x30ce02){_0x3a5d65=_0x3a5d65-0x0;var _0x7b8e61=_0xd84b[_0x3a5d65];return _0x7b8e61;};'use strict';var Sequelize=require(_0xbd84('0x0'));module['exports']={'name':{'type':Sequelize[_0xbd84('0x1')]},'description':{'type':Sequelize[_0xbd84('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 3b69fa9..bbf9d2e 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 _0xf8f2=['fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','include','findAll','rows','catch','show','params','includeAll','create','body','find','getFields','findOne','ZendeskField','length','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','Content-Range','json','reject','save','update','destroy','then','error','stack','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0xd9ce1f,_0x481e34){var _0x5c9e3a=function(_0x1801f3){while(--_0x1801f3){_0xd9ce1f['push'](_0xd9ce1f['shift']());}};_0x5c9e3a(++_0x481e34);}(_0xf8f2,0x74));var _0x2f8f=function(_0x9731fe,_0x3116cf){_0x9731fe=_0x9731fe-0x0;var _0x45adea=_0xf8f2[_0x9731fe];return _0x45adea;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2f8f('0x0'));var zipdir=require(_0x2f8f('0x1'));var jsonpatch=require(_0x2f8f('0x2'));var rp=require('request-promise');var moment=require(_0x2f8f('0x3'));var BPromise=require(_0x2f8f('0x4'));var Mustache=require(_0x2f8f('0x5'));var util=require(_0x2f8f('0x6'));var path=require(_0x2f8f('0x7'));var sox=require(_0x2f8f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2f8f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2f8f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2f8f('0xb'));var toCsv=require(_0x2f8f('0xc'));var querystring=require('querystring');var Papa=require(_0x2f8f('0xd'));var Redis=require('ioredis');var authService=require(_0x2f8f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2f8f('0xf'));var hardwareService=require(_0x2f8f('0x10'));var logger=require(_0x2f8f('0x11'))(_0x2f8f('0x12'));var utils=require(_0x2f8f('0x13'));var config=require(_0x2f8f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2f8f('0x15'))['db'];function respondWithStatusCode(_0x41a999,_0x20e656){_0x20e656=_0x20e656||0xcc;return function(_0x4f98e7){if(_0x4f98e7){return _0x41a999[_0x2f8f('0x16')](_0x20e656);}return _0x41a999[_0x2f8f('0x17')](_0x20e656)[_0x2f8f('0x18')]();};}function respondWithResult(_0x2e2cc6,_0x44415c){_0x44415c=_0x44415c||0xc8;return function(_0x24f3b0){if(_0x24f3b0){return _0x2e2cc6[_0x2f8f('0x17')](_0x44415c)['json'](_0x24f3b0);}};}function respondWithFilteredResult(_0x4bf327,_0x36712a){return function(_0x5c4e72){if(_0x5c4e72){var _0x479134=typeof _0x36712a[_0x2f8f('0x19')]==='undefined'&&typeof _0x36712a[_0x2f8f('0x1a')]===_0x2f8f('0x1b');var _0x14b893=_0x5c4e72['count'];var _0x4ae709=_0x479134?0x0:_0x36712a[_0x2f8f('0x19')];var _0x24839d=_0x479134?_0x5c4e72['count']:_0x36712a[_0x2f8f('0x19')]+_0x36712a[_0x2f8f('0x1a')];var _0x1f1947;if(_0x24839d>=_0x14b893){_0x24839d=_0x14b893;_0x1f1947=0xc8;}else{_0x1f1947=0xce;}_0x4bf327[_0x2f8f('0x17')](_0x1f1947);return _0x4bf327['set'](_0x2f8f('0x1c'),_0x4ae709+'-'+_0x24839d+'/'+_0x14b893)[_0x2f8f('0x1d')](_0x5c4e72);}return null;};}function patchUpdates(_0x42356e){return function(_0x2c5f7d){try{jsonpatch['apply'](_0x2c5f7d,_0x42356e,!![]);}catch(_0x1fdf30){return BPromise[_0x2f8f('0x1e')](_0x1fdf30);}return _0x2c5f7d[_0x2f8f('0x1f')]();};}function saveUpdates(_0x441226,_0x357fa7){return function(_0x201a1f){if(_0x201a1f){return _0x201a1f[_0x2f8f('0x20')](_0x441226)['then'](function(_0x54ffcd){return _0x54ffcd;});}return null;};}function removeEntity(_0x323917,_0x1facf4){return function(_0xbb2093){if(_0xbb2093){return _0xbb2093[_0x2f8f('0x21')]()[_0x2f8f('0x22')](function(){_0x323917[_0x2f8f('0x17')](0xcc)[_0x2f8f('0x18')]();});}};}function handleEntityNotFound(_0x68ee7,_0x464810){return function(_0x7399ab){if(!_0x7399ab){_0x68ee7[_0x2f8f('0x16')](0x194);}return _0x7399ab;};}function handleError(_0x3c45a1,_0x405baa){_0x405baa=_0x405baa||0x1f4;return function(_0x15bc95){logger[_0x2f8f('0x23')](_0x15bc95[_0x2f8f('0x24')]);if(_0x15bc95[_0x2f8f('0x25')]){delete _0x15bc95[_0x2f8f('0x25')];}_0x3c45a1[_0x2f8f('0x17')](_0x405baa)['send'](_0x15bc95);};}exports[_0x2f8f('0x26')]=function(_0x319dec,_0x7f9b8){var _0x2179fb={},_0x2aaa95={},_0x5835cb={'count':0x0,'rows':[]};var _0x276026=_[_0x2f8f('0x27')](db[_0x2f8f('0x28')][_0x2f8f('0x29')],function(_0x4b6d3d){return{'name':_0x4b6d3d[_0x2f8f('0x2a')],'type':_0x4b6d3d[_0x2f8f('0x2b')][_0x2f8f('0x2c')]};});_0x2aaa95[_0x2f8f('0x2d')]=_[_0x2f8f('0x27')](_0x276026,_0x2f8f('0x25'));_0x2aaa95[_0x2f8f('0x2e')]=_[_0x2f8f('0x2f')](_0x319dec[_0x2f8f('0x2e')]);_0x2aaa95[_0x2f8f('0x30')]=_[_0x2f8f('0x31')](_0x2aaa95['model'],_0x2aaa95['query']);_0x2179fb['attributes']=_['intersection'](_0x2aaa95[_0x2f8f('0x2d')],qs[_0x2f8f('0x32')](_0x319dec[_0x2f8f('0x2e')][_0x2f8f('0x32')]));_0x2179fb[_0x2f8f('0x33')]=_0x2179fb[_0x2f8f('0x33')]['length']?_0x2179fb[_0x2f8f('0x33')]:_0x2aaa95[_0x2f8f('0x2d')];if(!_0x319dec[_0x2f8f('0x2e')][_0x2f8f('0x34')](_0x2f8f('0x35'))){_0x2179fb[_0x2f8f('0x1a')]=qs['limit'](_0x319dec[_0x2f8f('0x2e')]['limit']);_0x2179fb[_0x2f8f('0x19')]=qs['offset'](_0x319dec['query'][_0x2f8f('0x19')]);}_0x2179fb[_0x2f8f('0x36')]=qs[_0x2f8f('0x37')](_0x319dec[_0x2f8f('0x2e')][_0x2f8f('0x37')]);_0x2179fb[_0x2f8f('0x38')]=qs[_0x2f8f('0x30')](_[_0x2f8f('0x39')](_0x319dec[_0x2f8f('0x2e')],_0x2aaa95[_0x2f8f('0x30')]),_0x276026);if(_0x319dec['query'][_0x2f8f('0x3a')]){_0x2179fb[_0x2f8f('0x38')]=_['merge'](_0x2179fb[_0x2f8f('0x38')],{'$or':_[_0x2f8f('0x27')](_0x276026,function(_0x27820c){if(_0x27820c[_0x2f8f('0x2b')]!==_0x2f8f('0x3b')){var _0x2bd071={};_0x2bd071[_0x27820c[_0x2f8f('0x25')]]={'$like':'%'+_0x319dec[_0x2f8f('0x2e')][_0x2f8f('0x3a')]+'%'};return _0x2bd071;}})});}_0x2179fb=_[_0x2f8f('0x3c')]({},_0x2179fb,_0x319dec[_0x2f8f('0x3d')]);var _0x430162={'where':_0x2179fb['where']};return db[_0x2f8f('0x28')][_0x2f8f('0x3e')](_0x430162)[_0x2f8f('0x22')](function(_0x169bfb){_0x5835cb['count']=_0x169bfb;if(_0x319dec['query']['includeAll']){_0x2179fb[_0x2f8f('0x3f')]=[{'all':!![]}];}return db[_0x2f8f('0x28')][_0x2f8f('0x40')](_0x2179fb);})[_0x2f8f('0x22')](function(_0x22c021){_0x5835cb[_0x2f8f('0x41')]=_0x22c021;return _0x5835cb;})['then'](respondWithFilteredResult(_0x7f9b8,_0x2179fb))[_0x2f8f('0x42')](handleError(_0x7f9b8,null));};exports[_0x2f8f('0x43')]=function(_0x16d085,_0x54b432){var _0x2be72c={'raw':![],'where':{'id':_0x16d085[_0x2f8f('0x44')]['id']}},_0x5db61b={};_0x5db61b['model']=_[_0x2f8f('0x2f')](db[_0x2f8f('0x28')][_0x2f8f('0x29')]);_0x5db61b[_0x2f8f('0x2e')]=_[_0x2f8f('0x2f')](_0x16d085[_0x2f8f('0x2e')]);_0x5db61b[_0x2f8f('0x30')]=_[_0x2f8f('0x31')](_0x5db61b['model'],_0x5db61b[_0x2f8f('0x2e')]);_0x2be72c[_0x2f8f('0x33')]=_[_0x2f8f('0x31')](_0x5db61b['model'],qs[_0x2f8f('0x32')](_0x16d085[_0x2f8f('0x2e')]['fields']));_0x2be72c['attributes']=_0x2be72c[_0x2f8f('0x33')]['length']?_0x2be72c[_0x2f8f('0x33')]:_0x5db61b[_0x2f8f('0x2d')];if(_0x16d085[_0x2f8f('0x2e')][_0x2f8f('0x45')]){_0x2be72c[_0x2f8f('0x3f')]=[{'all':!![]}];}_0x2be72c=_[_0x2f8f('0x3c')]({},_0x2be72c,_0x16d085['options']);return db[_0x2f8f('0x28')]['find'](_0x2be72c)[_0x2f8f('0x22')](handleEntityNotFound(_0x54b432,null))[_0x2f8f('0x22')](respondWithResult(_0x54b432,null))[_0x2f8f('0x42')](handleError(_0x54b432,null));};exports[_0x2f8f('0x46')]=function(_0x475ff9,_0xdcedea){return db[_0x2f8f('0x28')][_0x2f8f('0x46')](_0x475ff9[_0x2f8f('0x47')],{})['then'](respondWithResult(_0xdcedea,0xc9))[_0x2f8f('0x42')](handleError(_0xdcedea,null));};exports['update']=function(_0x11ae9f,_0x51d253){if(_0x11ae9f[_0x2f8f('0x47')]['id']){delete _0x11ae9f[_0x2f8f('0x47')]['id'];}return db[_0x2f8f('0x28')][_0x2f8f('0x48')]({'where':{'id':_0x11ae9f[_0x2f8f('0x44')]['id']}})['then'](handleEntityNotFound(_0x51d253,null))[_0x2f8f('0x22')](saveUpdates(_0x11ae9f[_0x2f8f('0x47')],null))[_0x2f8f('0x22')](respondWithResult(_0x51d253,null))[_0x2f8f('0x42')](handleError(_0x51d253,null));};exports['destroy']=function(_0x32438b,_0x2b04b2){return db[_0x2f8f('0x28')]['find']({'where':{'id':_0x32438b['params']['id']}})['then'](handleEntityNotFound(_0x2b04b2,null))['then'](removeEntity(_0x2b04b2,null))[_0x2f8f('0x42')](handleError(_0x2b04b2,null));};exports[_0x2f8f('0x49')]=function(_0x475d0c,_0x32dc31,_0x1b3f01){var _0x4ce74e={};var _0x2e9d7c={};var _0x4b2f58;var _0x51795e;return db['ZendeskConfiguration'][_0x2f8f('0x4a')]({'where':{'id':_0x475d0c[_0x2f8f('0x44')]['id']}})[_0x2f8f('0x22')](handleEntityNotFound(_0x32dc31,null))[_0x2f8f('0x22')](function(_0x279c4e){if(_0x279c4e){_0x4b2f58=_0x279c4e;_0x2e9d7c[_0x2f8f('0x2d')]=_[_0x2f8f('0x2f')](db[_0x2f8f('0x4b')][_0x2f8f('0x29')]);_0x2e9d7c[_0x2f8f('0x2e')]=_['keys'](_0x475d0c['query']);_0x2e9d7c[_0x2f8f('0x30')]=_[_0x2f8f('0x31')](_0x2e9d7c[_0x2f8f('0x2d')],_0x2e9d7c[_0x2f8f('0x2e')]);_0x4ce74e[_0x2f8f('0x33')]=_[_0x2f8f('0x31')](_0x2e9d7c[_0x2f8f('0x2d')],qs['fields'](_0x475d0c[_0x2f8f('0x2e')][_0x2f8f('0x32')]));_0x4ce74e['attributes']=_0x4ce74e[_0x2f8f('0x33')][_0x2f8f('0x4c')]?_0x4ce74e[_0x2f8f('0x33')]:_0x2e9d7c[_0x2f8f('0x2d')];_0x4ce74e['order']=qs['sort'](_0x475d0c[_0x2f8f('0x2e')]['sort']);_0x4ce74e[_0x2f8f('0x38')]=qs[_0x2f8f('0x30')](_[_0x2f8f('0x39')](_0x475d0c[_0x2f8f('0x2e')],_0x2e9d7c[_0x2f8f('0x30')]));if(_0x475d0c[_0x2f8f('0x2e')][_0x2f8f('0x3a')]){_0x4ce74e['where']=_[_0x2f8f('0x3c')](_0x4ce74e[_0x2f8f('0x38')],{'$or':_['map'](_0x4ce74e[_0x2f8f('0x33')],function(_0x1f800c){var _0x6aa39b={};_0x6aa39b[_0x1f800c]={'$like':'%'+_0x475d0c['query']['filter']+'%'};return _0x6aa39b;})});}_0x4ce74e=_[_0x2f8f('0x3c')]({},_0x4ce74e,_0x475d0c[_0x2f8f('0x3d')]);return _0x4b2f58[_0x2f8f('0x49')](_0x4ce74e);}})[_0x2f8f('0x22')](function(_0x28c844){if(_0x28c844){_0x51795e=_0x28c844[_0x2f8f('0x4c')];if(!_0x475d0c['query']['hasOwnProperty'](_0x2f8f('0x35'))){_0x4ce74e[_0x2f8f('0x1a')]=qs['limit'](_0x475d0c['query'][_0x2f8f('0x1a')]);_0x4ce74e['offset']=qs[_0x2f8f('0x19')](_0x475d0c['query'][_0x2f8f('0x19')]);}return _0x4b2f58[_0x2f8f('0x49')](_0x4ce74e);}})[_0x2f8f('0x22')](function(_0x384369){if(_0x384369){return _0x384369?{'count':_0x51795e,'rows':_0x384369}:null;}})[_0x2f8f('0x22')](respondWithResult(_0x32dc31,null))[_0x2f8f('0x42')](handleError(_0x32dc31,null));};exports[_0x2f8f('0x4d')]=function(_0x4c92d5,_0x48d67b,_0x245a62){var _0x55a966={};var _0x5880c1={};var _0x309256;var _0x469cda;return db[_0x2f8f('0x28')][_0x2f8f('0x4a')]({'where':{'id':_0x4c92d5[_0x2f8f('0x44')]['id']}})[_0x2f8f('0x22')](handleEntityNotFound(_0x48d67b,null))[_0x2f8f('0x22')](function(_0x5aabcd){if(_0x5aabcd){_0x309256=_0x5aabcd;_0x5880c1['model']=_[_0x2f8f('0x2f')](db[_0x2f8f('0x4b')][_0x2f8f('0x29')]);_0x5880c1[_0x2f8f('0x2e')]=_[_0x2f8f('0x2f')](_0x4c92d5[_0x2f8f('0x2e')]);_0x5880c1['filters']=_[_0x2f8f('0x31')](_0x5880c1[_0x2f8f('0x2d')],_0x5880c1[_0x2f8f('0x2e')]);_0x55a966[_0x2f8f('0x33')]=_[_0x2f8f('0x31')](_0x5880c1[_0x2f8f('0x2d')],qs[_0x2f8f('0x32')](_0x4c92d5[_0x2f8f('0x2e')][_0x2f8f('0x32')]));_0x55a966['attributes']=_0x55a966['attributes'][_0x2f8f('0x4c')]?_0x55a966['attributes']:_0x5880c1['model'];_0x55a966['order']=qs['sort'](_0x4c92d5[_0x2f8f('0x2e')]['sort']);_0x55a966[_0x2f8f('0x38')]=qs[_0x2f8f('0x30')](_[_0x2f8f('0x39')](_0x4c92d5[_0x2f8f('0x2e')],_0x5880c1['filters']));if(_0x4c92d5[_0x2f8f('0x2e')][_0x2f8f('0x3a')]){_0x55a966[_0x2f8f('0x38')]=_[_0x2f8f('0x3c')](_0x55a966[_0x2f8f('0x38')],{'$or':_[_0x2f8f('0x27')](_0x55a966[_0x2f8f('0x33')],function(_0x42ca2b){var _0x192f7d={};_0x192f7d[_0x42ca2b]={'$like':'%'+_0x4c92d5['query']['filter']+'%'};return _0x192f7d;})});}_0x55a966=_[_0x2f8f('0x3c')]({},_0x55a966,_0x4c92d5[_0x2f8f('0x3d')]);return _0x309256[_0x2f8f('0x4d')](_0x55a966);}})[_0x2f8f('0x22')](function(_0x12190a){if(_0x12190a){_0x469cda=_0x12190a[_0x2f8f('0x4c')];if(!_0x4c92d5[_0x2f8f('0x2e')][_0x2f8f('0x34')](_0x2f8f('0x35'))){_0x55a966[_0x2f8f('0x1a')]=qs[_0x2f8f('0x1a')](_0x4c92d5['query'][_0x2f8f('0x1a')]);_0x55a966[_0x2f8f('0x19')]=qs[_0x2f8f('0x19')](_0x4c92d5[_0x2f8f('0x2e')][_0x2f8f('0x19')]);}return _0x309256[_0x2f8f('0x4d')](_0x55a966);}})[_0x2f8f('0x22')](function(_0x32bfd7){if(_0x32bfd7){return _0x32bfd7?{'count':_0x469cda,'rows':_0x32bfd7}:null;}})[_0x2f8f('0x22')](respondWithResult(_0x48d67b,null))[_0x2f8f('0x42')](handleError(_0x48d67b,null));};exports[_0x2f8f('0x4e')]=function(_0x30945e,_0xa28e5,_0x4b7d9e){var _0x31cb2a={};var _0x3c4cfa={};var _0x11a97f;var _0x3111df;return db['ZendeskConfiguration'][_0x2f8f('0x4a')]({'where':{'id':_0x30945e[_0x2f8f('0x44')]['id']}})['then'](handleEntityNotFound(_0xa28e5,null))[_0x2f8f('0x22')](function(_0x558bbc){if(_0x558bbc){_0x11a97f=_0x558bbc;_0x3c4cfa[_0x2f8f('0x2d')]=_[_0x2f8f('0x2f')](db[_0x2f8f('0x4b')][_0x2f8f('0x29')]);_0x3c4cfa['query']=_[_0x2f8f('0x2f')](_0x30945e[_0x2f8f('0x2e')]);_0x3c4cfa[_0x2f8f('0x30')]=_[_0x2f8f('0x31')](_0x3c4cfa[_0x2f8f('0x2d')],_0x3c4cfa['query']);_0x31cb2a[_0x2f8f('0x33')]=_[_0x2f8f('0x31')](_0x3c4cfa[_0x2f8f('0x2d')],qs[_0x2f8f('0x32')](_0x30945e[_0x2f8f('0x2e')][_0x2f8f('0x32')]));_0x31cb2a[_0x2f8f('0x33')]=_0x31cb2a['attributes'][_0x2f8f('0x4c')]?_0x31cb2a[_0x2f8f('0x33')]:_0x3c4cfa[_0x2f8f('0x2d')];_0x31cb2a[_0x2f8f('0x36')]=qs['sort'](_0x30945e[_0x2f8f('0x2e')][_0x2f8f('0x37')]);_0x31cb2a[_0x2f8f('0x38')]=qs[_0x2f8f('0x30')](_['pick'](_0x30945e[_0x2f8f('0x2e')],_0x3c4cfa[_0x2f8f('0x30')]));if(_0x30945e['query'][_0x2f8f('0x3a')]){_0x31cb2a[_0x2f8f('0x38')]=_['merge'](_0x31cb2a[_0x2f8f('0x38')],{'$or':_['map'](_0x31cb2a[_0x2f8f('0x33')],function(_0x389fb7){var _0x4310ca={};_0x4310ca[_0x389fb7]={'$like':'%'+_0x30945e[_0x2f8f('0x2e')][_0x2f8f('0x3a')]+'%'};return _0x4310ca;})});}_0x31cb2a=_['merge']({},_0x31cb2a,_0x30945e[_0x2f8f('0x3d')]);return _0x11a97f[_0x2f8f('0x4e')](_0x31cb2a);}})[_0x2f8f('0x22')](function(_0x335023){if(_0x335023){_0x3111df=_0x335023[_0x2f8f('0x4c')];if(!_0x30945e[_0x2f8f('0x2e')]['hasOwnProperty']('nolimit')){_0x31cb2a[_0x2f8f('0x1a')]=qs['limit'](_0x30945e[_0x2f8f('0x2e')][_0x2f8f('0x1a')]);_0x31cb2a[_0x2f8f('0x19')]=qs[_0x2f8f('0x19')](_0x30945e[_0x2f8f('0x2e')][_0x2f8f('0x19')]);}return _0x11a97f[_0x2f8f('0x4e')](_0x31cb2a);}})[_0x2f8f('0x22')](function(_0x50235b){if(_0x50235b){return _0x50235b?{'count':_0x3111df,'rows':_0x50235b}:null;}})['then'](respondWithResult(_0xa28e5,null))['catch'](handleError(_0xa28e5,null));};exports[_0x2f8f('0x4f')]=function(_0x4816f8,_0x254db6,_0x2e4a69){var _0x5c892a={};var _0x2b5364={};var _0x36bc44;var _0x331d43;return db[_0x2f8f('0x28')]['findOne']({'where':{'id':_0x4816f8[_0x2f8f('0x44')]['id']}})[_0x2f8f('0x22')](handleEntityNotFound(_0x254db6,null))[_0x2f8f('0x22')](function(_0x311c85){if(_0x311c85){_0x36bc44=_0x311c85;_0x2b5364[_0x2f8f('0x2d')]=_[_0x2f8f('0x2f')](db[_0x2f8f('0x50')][_0x2f8f('0x29')]);_0x2b5364[_0x2f8f('0x2e')]=_[_0x2f8f('0x2f')](_0x4816f8[_0x2f8f('0x2e')]);_0x2b5364[_0x2f8f('0x30')]=_[_0x2f8f('0x31')](_0x2b5364[_0x2f8f('0x2d')],_0x2b5364[_0x2f8f('0x2e')]);_0x5c892a[_0x2f8f('0x33')]=_['intersection'](_0x2b5364[_0x2f8f('0x2d')],qs['fields'](_0x4816f8[_0x2f8f('0x2e')][_0x2f8f('0x32')]));_0x5c892a[_0x2f8f('0x33')]=_0x5c892a['attributes'][_0x2f8f('0x4c')]?_0x5c892a['attributes']:_0x2b5364['model'];_0x5c892a[_0x2f8f('0x36')]=qs[_0x2f8f('0x37')](_0x4816f8['query'][_0x2f8f('0x37')]);_0x5c892a[_0x2f8f('0x38')]=qs[_0x2f8f('0x30')](_[_0x2f8f('0x39')](_0x4816f8[_0x2f8f('0x2e')],_0x2b5364['filters']));if(_0x4816f8[_0x2f8f('0x2e')][_0x2f8f('0x3a')]){_0x5c892a[_0x2f8f('0x38')]=_['merge'](_0x5c892a[_0x2f8f('0x38')],{'$or':_['map'](_0x5c892a[_0x2f8f('0x33')],function(_0x26183b){var _0x1c6b54={};_0x1c6b54[_0x26183b]={'$like':'%'+_0x4816f8[_0x2f8f('0x2e')][_0x2f8f('0x3a')]+'%'};return _0x1c6b54;})});}_0x5c892a=_['merge']({},_0x5c892a,_0x4816f8[_0x2f8f('0x3d')]);return _0x36bc44['getTags'](_0x5c892a);}})[_0x2f8f('0x22')](function(_0xd92c44){if(_0xd92c44){_0x331d43=_0xd92c44[_0x2f8f('0x4c')];if(!_0x4816f8[_0x2f8f('0x2e')][_0x2f8f('0x34')]('nolimit')){_0x5c892a[_0x2f8f('0x1a')]=qs['limit'](_0x4816f8[_0x2f8f('0x2e')]['limit']);_0x5c892a['offset']=qs[_0x2f8f('0x19')](_0x4816f8[_0x2f8f('0x2e')][_0x2f8f('0x19')]);}return _0x36bc44[_0x2f8f('0x4f')](_0x5c892a);}})[_0x2f8f('0x22')](function(_0x2830cc){if(_0x2830cc){return _0x2830cc?{'count':_0x331d43,'rows':_0x2830cc}:null;}})[_0x2f8f('0x22')](respondWithResult(_0x254db6,null))['catch'](handleError(_0x254db6,null));};exports[_0x2f8f('0x51')]=function(_0x143803,_0x309785,_0xd3127c){if(_0x143803['body']['id']){delete _0x143803['body']['id'];}return db[_0x2f8f('0x28')]['findOne']({'where':{'id':_0x143803[_0x2f8f('0x44')]['id']}})[_0x2f8f('0x22')](handleEntityNotFound(_0x309785,null))[_0x2f8f('0x22')](function(_0x345471){if(_0x345471){return _0x345471['setTags'](_0x143803[_0x2f8f('0x47')][_0x2f8f('0x52')]||[]);}return null;})[_0x2f8f('0x22')](respondWithResult(_0x309785,null))[_0x2f8f('0x42')](handleError(_0x309785,null));}; \ No newline at end of file +var _0xfe3a=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count','limit','set','apply','reject','save','update','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ZendeskConfiguration','findAll','catch','show','params','rawAttributes','includeAll','include','find','create','body','getFields','ZendeskField','getSubjects','findOne','getDescriptions','getTags','setTags','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xfe3a,0x1e7));var _0xafe3=function(_0x193f85,_0x4c61fb){_0x193f85=_0x193f85-0x0;var _0x4a6979=_0xfe3a[_0x193f85];return _0x4a6979;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xafe3('0x0'));var zipdir=require(_0xafe3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xafe3('0x2'));var moment=require(_0xafe3('0x3'));var BPromise=require(_0xafe3('0x4'));var Mustache=require(_0xafe3('0x5'));var util=require(_0xafe3('0x6'));var path=require(_0xafe3('0x7'));var sox=require(_0xafe3('0x8'));var csv=require(_0xafe3('0x9'));var ejs=require(_0xafe3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xafe3('0xb'));var squel=require(_0xafe3('0xc'));var crypto=require(_0xafe3('0xd'));var jsforce=require(_0xafe3('0xe'));var deskjs=require(_0xafe3('0xf'));var toCsv=require(_0xafe3('0x9'));var querystring=require(_0xafe3('0x10'));var Papa=require(_0xafe3('0x11'));var Redis=require(_0xafe3('0x12'));var authService=require(_0xafe3('0x13'));var qs=require(_0xafe3('0x14'));var as=require(_0xafe3('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xafe3('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xafe3('0x17'));var licenseUtil=require(_0xafe3('0x18'));var db=require(_0xafe3('0x19'))['db'];function respondWithStatusCode(_0x5a86d3,_0x550896){_0x550896=_0x550896||0xcc;return function(_0x2bdce0){if(_0x2bdce0){return _0x5a86d3[_0xafe3('0x1a')](_0x550896);}return _0x5a86d3[_0xafe3('0x1b')](_0x550896)['end']();};}function respondWithResult(_0x4bf20c,_0x331445){_0x331445=_0x331445||0xc8;return function(_0xf38e96){if(_0xf38e96){return _0x4bf20c[_0xafe3('0x1b')](_0x331445)[_0xafe3('0x1c')](_0xf38e96);}};}function respondWithFilteredResult(_0x3ab84e,_0x3d6c72){return function(_0x48ed29){if(_0x48ed29){var _0x5608e7=typeof _0x3d6c72[_0xafe3('0x1d')]==='undefined'&&typeof _0x3d6c72['limit']==='undefined';var _0x54d8a2=_0x48ed29[_0xafe3('0x1e')];var _0x47d886=_0x5608e7?0x0:_0x3d6c72['offset'];var _0x19670c=_0x5608e7?_0x48ed29[_0xafe3('0x1e')]:_0x3d6c72[_0xafe3('0x1d')]+_0x3d6c72[_0xafe3('0x1f')];var _0x495a2d;if(_0x19670c>=_0x54d8a2){_0x19670c=_0x54d8a2;_0x495a2d=0xc8;}else{_0x495a2d=0xce;}_0x3ab84e['status'](_0x495a2d);return _0x3ab84e[_0xafe3('0x20')]('Content-Range',_0x47d886+'-'+_0x19670c+'/'+_0x54d8a2)['json'](_0x48ed29);}return null;};}function patchUpdates(_0xf50709){return function(_0x35f105){try{jsonpatch[_0xafe3('0x21')](_0x35f105,_0xf50709,!![]);}catch(_0x405568){return BPromise[_0xafe3('0x22')](_0x405568);}return _0x35f105[_0xafe3('0x23')]();};}function saveUpdates(_0x56eb95,_0x59dc92){return function(_0xd09ec){if(_0xd09ec){return _0xd09ec[_0xafe3('0x24')](_0x56eb95)[_0xafe3('0x25')](function(_0xacd9a8){return _0xacd9a8;});}return null;};}function removeEntity(_0xdea329,_0x47c5cf){return function(_0x557763){if(_0x557763){return _0x557763[_0xafe3('0x26')]()['then'](function(){_0xdea329['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3084ca,_0x44e41f){return function(_0x14f059){if(!_0x14f059){_0x3084ca[_0xafe3('0x1a')](0x194);}return _0x14f059;};}function handleError(_0x3cd594,_0x366e66){_0x366e66=_0x366e66||0x1f4;return function(_0x145fd1){logger[_0xafe3('0x27')](_0x145fd1['stack']);if(_0x145fd1[_0xafe3('0x28')]){delete _0x145fd1[_0xafe3('0x28')];}_0x3cd594[_0xafe3('0x1b')](_0x366e66)[_0xafe3('0x29')](_0x145fd1);};}exports[_0xafe3('0x2a')]=function(_0x4d6dd1,_0x1dee03){var _0x334d65={},_0x5a8a65={},_0x494738={'count':0x0,'rows':[]};var _0x51e55c=_['map'](db['ZendeskConfiguration']['rawAttributes'],function(_0x1006cf){return{'name':_0x1006cf[_0xafe3('0x2b')],'type':_0x1006cf[_0xafe3('0x2c')][_0xafe3('0x2d')]};});_0x5a8a65[_0xafe3('0x2e')]=_[_0xafe3('0x2f')](_0x51e55c,_0xafe3('0x28'));_0x5a8a65['query']=_[_0xafe3('0x30')](_0x4d6dd1[_0xafe3('0x31')]);_0x5a8a65[_0xafe3('0x32')]=_[_0xafe3('0x33')](_0x5a8a65['model'],_0x5a8a65['query']);_0x334d65[_0xafe3('0x34')]=_[_0xafe3('0x33')](_0x5a8a65[_0xafe3('0x2e')],qs[_0xafe3('0x35')](_0x4d6dd1[_0xafe3('0x31')]['fields']));_0x334d65[_0xafe3('0x34')]=_0x334d65['attributes'][_0xafe3('0x36')]?_0x334d65[_0xafe3('0x34')]:_0x5a8a65[_0xafe3('0x2e')];if(!_0x4d6dd1[_0xafe3('0x31')][_0xafe3('0x37')](_0xafe3('0x38'))){_0x334d65[_0xafe3('0x1f')]=qs[_0xafe3('0x1f')](_0x4d6dd1['query'][_0xafe3('0x1f')]);_0x334d65[_0xafe3('0x1d')]=qs[_0xafe3('0x1d')](_0x4d6dd1[_0xafe3('0x31')][_0xafe3('0x1d')]);}_0x334d65[_0xafe3('0x39')]=qs[_0xafe3('0x3a')](_0x4d6dd1[_0xafe3('0x31')]['sort']);_0x334d65[_0xafe3('0x3b')]=qs[_0xafe3('0x32')](_[_0xafe3('0x3c')](_0x4d6dd1['query'],_0x5a8a65['filters']),_0x51e55c);if(_0x4d6dd1[_0xafe3('0x31')][_0xafe3('0x3d')]){_0x334d65['where']=_[_0xafe3('0x3e')](_0x334d65[_0xafe3('0x3b')],{'$or':_[_0xafe3('0x2f')](_0x51e55c,function(_0x19392){if(_0x19392[_0xafe3('0x2c')]!==_0xafe3('0x3f')){var _0x225de4={};_0x225de4[_0x19392['name']]={'$like':'%'+_0x4d6dd1[_0xafe3('0x31')][_0xafe3('0x3d')]+'%'};return _0x225de4;}})});}_0x334d65=_[_0xafe3('0x3e')]({},_0x334d65,_0x4d6dd1[_0xafe3('0x40')]);var _0x31a28d={'where':_0x334d65['where']};return db['ZendeskConfiguration'][_0xafe3('0x1e')](_0x31a28d)[_0xafe3('0x25')](function(_0x403c77){_0x494738['count']=_0x403c77;if(_0x4d6dd1[_0xafe3('0x31')]['includeAll']){_0x334d65['include']=[{'all':!![]}];}return db[_0xafe3('0x41')][_0xafe3('0x42')](_0x334d65);})[_0xafe3('0x25')](function(_0x54edf2){_0x494738['rows']=_0x54edf2;return _0x494738;})['then'](respondWithFilteredResult(_0x1dee03,_0x334d65))[_0xafe3('0x43')](handleError(_0x1dee03,null));};exports[_0xafe3('0x44')]=function(_0x5793a8,_0x186477){var _0x214008={'raw':![],'where':{'id':_0x5793a8[_0xafe3('0x45')]['id']}},_0x1fd7c9={};_0x1fd7c9[_0xafe3('0x2e')]=_[_0xafe3('0x30')](db[_0xafe3('0x41')][_0xafe3('0x46')]);_0x1fd7c9['query']=_[_0xafe3('0x30')](_0x5793a8[_0xafe3('0x31')]);_0x1fd7c9[_0xafe3('0x32')]=_[_0xafe3('0x33')](_0x1fd7c9['model'],_0x1fd7c9['query']);_0x214008['attributes']=_[_0xafe3('0x33')](_0x1fd7c9['model'],qs['fields'](_0x5793a8[_0xafe3('0x31')][_0xafe3('0x35')]));_0x214008[_0xafe3('0x34')]=_0x214008[_0xafe3('0x34')][_0xafe3('0x36')]?_0x214008[_0xafe3('0x34')]:_0x1fd7c9[_0xafe3('0x2e')];if(_0x5793a8['query'][_0xafe3('0x47')]){_0x214008[_0xafe3('0x48')]=[{'all':!![]}];}_0x214008=_[_0xafe3('0x3e')]({},_0x214008,_0x5793a8[_0xafe3('0x40')]);return db[_0xafe3('0x41')][_0xafe3('0x49')](_0x214008)[_0xafe3('0x25')](handleEntityNotFound(_0x186477,null))[_0xafe3('0x25')](respondWithResult(_0x186477,null))['catch'](handleError(_0x186477,null));};exports[_0xafe3('0x4a')]=function(_0x5267b4,_0x2e2933){return db[_0xafe3('0x41')][_0xafe3('0x4a')](_0x5267b4[_0xafe3('0x4b')],{})['then'](respondWithResult(_0x2e2933,0xc9))[_0xafe3('0x43')](handleError(_0x2e2933,null));};exports[_0xafe3('0x24')]=function(_0x274870,_0x1ac0bf){if(_0x274870[_0xafe3('0x4b')]['id']){delete _0x274870[_0xafe3('0x4b')]['id'];}return db[_0xafe3('0x41')]['find']({'where':{'id':_0x274870[_0xafe3('0x45')]['id']}})[_0xafe3('0x25')](handleEntityNotFound(_0x1ac0bf,null))['then'](saveUpdates(_0x274870[_0xafe3('0x4b')],null))['then'](respondWithResult(_0x1ac0bf,null))[_0xafe3('0x43')](handleError(_0x1ac0bf,null));};exports[_0xafe3('0x26')]=function(_0x30da9e,_0x259056){return db[_0xafe3('0x41')][_0xafe3('0x49')]({'where':{'id':_0x30da9e[_0xafe3('0x45')]['id']}})[_0xafe3('0x25')](handleEntityNotFound(_0x259056,null))[_0xafe3('0x25')](removeEntity(_0x259056,null))[_0xafe3('0x43')](handleError(_0x259056,null));};exports[_0xafe3('0x4c')]=function(_0x3b9e52,_0x4850ea,_0x245c31){var _0x3eeef2={};var _0x47fbab={};var _0x1b3497;var _0x54787b;return db[_0xafe3('0x41')]['findOne']({'where':{'id':_0x3b9e52[_0xafe3('0x45')]['id']}})[_0xafe3('0x25')](handleEntityNotFound(_0x4850ea,null))[_0xafe3('0x25')](function(_0x37dbae){if(_0x37dbae){_0x1b3497=_0x37dbae;_0x47fbab[_0xafe3('0x2e')]=_[_0xafe3('0x30')](db[_0xafe3('0x4d')]['rawAttributes']);_0x47fbab['query']=_[_0xafe3('0x30')](_0x3b9e52[_0xafe3('0x31')]);_0x47fbab[_0xafe3('0x32')]=_[_0xafe3('0x33')](_0x47fbab[_0xafe3('0x2e')],_0x47fbab['query']);_0x3eeef2[_0xafe3('0x34')]=_[_0xafe3('0x33')](_0x47fbab['model'],qs[_0xafe3('0x35')](_0x3b9e52[_0xafe3('0x31')][_0xafe3('0x35')]));_0x3eeef2[_0xafe3('0x34')]=_0x3eeef2['attributes'][_0xafe3('0x36')]?_0x3eeef2[_0xafe3('0x34')]:_0x47fbab[_0xafe3('0x2e')];_0x3eeef2[_0xafe3('0x39')]=qs[_0xafe3('0x3a')](_0x3b9e52[_0xafe3('0x31')]['sort']);_0x3eeef2[_0xafe3('0x3b')]=qs[_0xafe3('0x32')](_[_0xafe3('0x3c')](_0x3b9e52[_0xafe3('0x31')],_0x47fbab[_0xafe3('0x32')]));if(_0x3b9e52[_0xafe3('0x31')]['filter']){_0x3eeef2['where']=_[_0xafe3('0x3e')](_0x3eeef2['where'],{'$or':_[_0xafe3('0x2f')](_0x3eeef2['attributes'],function(_0x58434d){var _0xfaf057={};_0xfaf057[_0x58434d]={'$like':'%'+_0x3b9e52[_0xafe3('0x31')]['filter']+'%'};return _0xfaf057;})});}_0x3eeef2=_[_0xafe3('0x3e')]({},_0x3eeef2,_0x3b9e52['options']);return _0x1b3497[_0xafe3('0x4c')](_0x3eeef2);}})[_0xafe3('0x25')](function(_0x5e6943){if(_0x5e6943){_0x54787b=_0x5e6943[_0xafe3('0x36')];if(!_0x3b9e52[_0xafe3('0x31')][_0xafe3('0x37')](_0xafe3('0x38'))){_0x3eeef2[_0xafe3('0x1f')]=qs['limit'](_0x3b9e52[_0xafe3('0x31')][_0xafe3('0x1f')]);_0x3eeef2[_0xafe3('0x1d')]=qs[_0xafe3('0x1d')](_0x3b9e52[_0xafe3('0x31')][_0xafe3('0x1d')]);}return _0x1b3497[_0xafe3('0x4c')](_0x3eeef2);}})[_0xafe3('0x25')](function(_0x3c47b4){if(_0x3c47b4){return _0x3c47b4?{'count':_0x54787b,'rows':_0x3c47b4}:null;}})['then'](respondWithResult(_0x4850ea,null))[_0xafe3('0x43')](handleError(_0x4850ea,null));};exports['getSubjects']=function(_0x4c969d,_0x2198db,_0x222bc9){var _0x21216b={};var _0x52b706={};var _0x2032a0;var _0x532bee;return db[_0xafe3('0x41')]['findOne']({'where':{'id':_0x4c969d[_0xafe3('0x45')]['id']}})[_0xafe3('0x25')](handleEntityNotFound(_0x2198db,null))['then'](function(_0x158f41){if(_0x158f41){_0x2032a0=_0x158f41;_0x52b706[_0xafe3('0x2e')]=_[_0xafe3('0x30')](db['ZendeskField'][_0xafe3('0x46')]);_0x52b706['query']=_[_0xafe3('0x30')](_0x4c969d[_0xafe3('0x31')]);_0x52b706['filters']=_[_0xafe3('0x33')](_0x52b706[_0xafe3('0x2e')],_0x52b706[_0xafe3('0x31')]);_0x21216b[_0xafe3('0x34')]=_['intersection'](_0x52b706[_0xafe3('0x2e')],qs['fields'](_0x4c969d[_0xafe3('0x31')]['fields']));_0x21216b['attributes']=_0x21216b[_0xafe3('0x34')]['length']?_0x21216b[_0xafe3('0x34')]:_0x52b706['model'];_0x21216b['order']=qs[_0xafe3('0x3a')](_0x4c969d['query'][_0xafe3('0x3a')]);_0x21216b[_0xafe3('0x3b')]=qs[_0xafe3('0x32')](_['pick'](_0x4c969d[_0xafe3('0x31')],_0x52b706[_0xafe3('0x32')]));if(_0x4c969d['query'][_0xafe3('0x3d')]){_0x21216b[_0xafe3('0x3b')]=_['merge'](_0x21216b['where'],{'$or':_[_0xafe3('0x2f')](_0x21216b[_0xafe3('0x34')],function(_0xe5169a){var _0xe8a9e9={};_0xe8a9e9[_0xe5169a]={'$like':'%'+_0x4c969d[_0xafe3('0x31')][_0xafe3('0x3d')]+'%'};return _0xe8a9e9;})});}_0x21216b=_['merge']({},_0x21216b,_0x4c969d[_0xafe3('0x40')]);return _0x2032a0[_0xafe3('0x4e')](_0x21216b);}})[_0xafe3('0x25')](function(_0x7f4a35){if(_0x7f4a35){_0x532bee=_0x7f4a35[_0xafe3('0x36')];if(!_0x4c969d[_0xafe3('0x31')][_0xafe3('0x37')](_0xafe3('0x38'))){_0x21216b['limit']=qs[_0xafe3('0x1f')](_0x4c969d['query'][_0xafe3('0x1f')]);_0x21216b[_0xafe3('0x1d')]=qs[_0xafe3('0x1d')](_0x4c969d[_0xafe3('0x31')][_0xafe3('0x1d')]);}return _0x2032a0[_0xafe3('0x4e')](_0x21216b);}})['then'](function(_0x594a2d){if(_0x594a2d){return _0x594a2d?{'count':_0x532bee,'rows':_0x594a2d}:null;}})[_0xafe3('0x25')](respondWithResult(_0x2198db,null))[_0xafe3('0x43')](handleError(_0x2198db,null));};exports['getDescriptions']=function(_0x157283,_0x447640,_0x2bd079){var _0x2f11ff={};var _0x1134fc={};var _0x541ed2;var _0x433f84;return db[_0xafe3('0x41')][_0xafe3('0x4f')]({'where':{'id':_0x157283[_0xafe3('0x45')]['id']}})[_0xafe3('0x25')](handleEntityNotFound(_0x447640,null))[_0xafe3('0x25')](function(_0x334777){if(_0x334777){_0x541ed2=_0x334777;_0x1134fc['model']=_[_0xafe3('0x30')](db[_0xafe3('0x4d')][_0xafe3('0x46')]);_0x1134fc[_0xafe3('0x31')]=_[_0xafe3('0x30')](_0x157283[_0xafe3('0x31')]);_0x1134fc[_0xafe3('0x32')]=_[_0xafe3('0x33')](_0x1134fc[_0xafe3('0x2e')],_0x1134fc[_0xafe3('0x31')]);_0x2f11ff[_0xafe3('0x34')]=_[_0xafe3('0x33')](_0x1134fc[_0xafe3('0x2e')],qs[_0xafe3('0x35')](_0x157283['query']['fields']));_0x2f11ff['attributes']=_0x2f11ff[_0xafe3('0x34')]['length']?_0x2f11ff[_0xafe3('0x34')]:_0x1134fc['model'];_0x2f11ff[_0xafe3('0x39')]=qs[_0xafe3('0x3a')](_0x157283[_0xafe3('0x31')][_0xafe3('0x3a')]);_0x2f11ff[_0xafe3('0x3b')]=qs[_0xafe3('0x32')](_['pick'](_0x157283[_0xafe3('0x31')],_0x1134fc[_0xafe3('0x32')]));if(_0x157283[_0xafe3('0x31')][_0xafe3('0x3d')]){_0x2f11ff[_0xafe3('0x3b')]=_[_0xafe3('0x3e')](_0x2f11ff[_0xafe3('0x3b')],{'$or':_[_0xafe3('0x2f')](_0x2f11ff[_0xafe3('0x34')],function(_0x52f427){var _0x1ebd73={};_0x1ebd73[_0x52f427]={'$like':'%'+_0x157283[_0xafe3('0x31')][_0xafe3('0x3d')]+'%'};return _0x1ebd73;})});}_0x2f11ff=_['merge']({},_0x2f11ff,_0x157283[_0xafe3('0x40')]);return _0x541ed2[_0xafe3('0x50')](_0x2f11ff);}})[_0xafe3('0x25')](function(_0x1e3e9c){if(_0x1e3e9c){_0x433f84=_0x1e3e9c[_0xafe3('0x36')];if(!_0x157283['query'][_0xafe3('0x37')](_0xafe3('0x38'))){_0x2f11ff['limit']=qs[_0xafe3('0x1f')](_0x157283[_0xafe3('0x31')][_0xafe3('0x1f')]);_0x2f11ff[_0xafe3('0x1d')]=qs[_0xafe3('0x1d')](_0x157283[_0xafe3('0x31')]['offset']);}return _0x541ed2[_0xafe3('0x50')](_0x2f11ff);}})[_0xafe3('0x25')](function(_0x40bf42){if(_0x40bf42){return _0x40bf42?{'count':_0x433f84,'rows':_0x40bf42}:null;}})[_0xafe3('0x25')](respondWithResult(_0x447640,null))[_0xafe3('0x43')](handleError(_0x447640,null));};exports[_0xafe3('0x51')]=function(_0x460aa5,_0x187eb9,_0x1faa78){var _0x1d1072={};var _0x249771={};var _0x41570b;var _0x477ee8;return db[_0xafe3('0x41')][_0xafe3('0x4f')]({'where':{'id':_0x460aa5[_0xafe3('0x45')]['id']}})[_0xafe3('0x25')](handleEntityNotFound(_0x187eb9,null))[_0xafe3('0x25')](function(_0x408c59){if(_0x408c59){_0x41570b=_0x408c59;_0x249771['model']=_[_0xafe3('0x30')](db['Tag'][_0xafe3('0x46')]);_0x249771[_0xafe3('0x31')]=_[_0xafe3('0x30')](_0x460aa5[_0xafe3('0x31')]);_0x249771[_0xafe3('0x32')]=_[_0xafe3('0x33')](_0x249771['model'],_0x249771[_0xafe3('0x31')]);_0x1d1072['attributes']=_[_0xafe3('0x33')](_0x249771[_0xafe3('0x2e')],qs[_0xafe3('0x35')](_0x460aa5[_0xafe3('0x31')]['fields']));_0x1d1072[_0xafe3('0x34')]=_0x1d1072[_0xafe3('0x34')][_0xafe3('0x36')]?_0x1d1072[_0xafe3('0x34')]:_0x249771[_0xafe3('0x2e')];_0x1d1072[_0xafe3('0x39')]=qs[_0xafe3('0x3a')](_0x460aa5[_0xafe3('0x31')]['sort']);_0x1d1072[_0xafe3('0x3b')]=qs['filters'](_[_0xafe3('0x3c')](_0x460aa5[_0xafe3('0x31')],_0x249771['filters']));if(_0x460aa5[_0xafe3('0x31')]['filter']){_0x1d1072[_0xafe3('0x3b')]=_['merge'](_0x1d1072[_0xafe3('0x3b')],{'$or':_['map'](_0x1d1072[_0xafe3('0x34')],function(_0x4b335b){var _0x3ace92={};_0x3ace92[_0x4b335b]={'$like':'%'+_0x460aa5[_0xafe3('0x31')][_0xafe3('0x3d')]+'%'};return _0x3ace92;})});}_0x1d1072=_['merge']({},_0x1d1072,_0x460aa5[_0xafe3('0x40')]);return _0x41570b[_0xafe3('0x51')](_0x1d1072);}})[_0xafe3('0x25')](function(_0x32a21d){if(_0x32a21d){_0x477ee8=_0x32a21d[_0xafe3('0x36')];if(!_0x460aa5[_0xafe3('0x31')][_0xafe3('0x37')](_0xafe3('0x38'))){_0x1d1072[_0xafe3('0x1f')]=qs[_0xafe3('0x1f')](_0x460aa5[_0xafe3('0x31')]['limit']);_0x1d1072[_0xafe3('0x1d')]=qs[_0xafe3('0x1d')](_0x460aa5['query'][_0xafe3('0x1d')]);}return _0x41570b[_0xafe3('0x51')](_0x1d1072);}})['then'](function(_0x4890b0){if(_0x4890b0){return _0x4890b0?{'count':_0x477ee8,'rows':_0x4890b0}:null;}})[_0xafe3('0x25')](respondWithResult(_0x187eb9,null))[_0xafe3('0x43')](handleError(_0x187eb9,null));};exports['setTags']=function(_0x936744,_0x4977bb,_0x560c0d){if(_0x936744[_0xafe3('0x4b')]['id']){delete _0x936744[_0xafe3('0x4b')]['id'];}return db['ZendeskConfiguration'][_0xafe3('0x4f')]({'where':{'id':_0x936744[_0xafe3('0x45')]['id']}})[_0xafe3('0x25')](handleEntityNotFound(_0x4977bb,null))[_0xafe3('0x25')](function(_0x1b31ee){if(_0x1b31ee){return _0x1b31ee[_0xafe3('0x52')](_0x936744[_0xafe3('0x4b')]['ids']||[]);}return null;})[_0xafe3('0x25')](respondWithResult(_0x4977bb,null))['catch'](handleError(_0x4977bb,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index a8e6f6a..1aa8ce4 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 _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','util'];(function(_0x514ab1,_0x2cf359){var _0x3a96a6=function(_0x14eb02){while(--_0x14eb02){_0x514ab1['push'](_0x514ab1['shift']());}};_0x3a96a6(++_0x2cf359);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1e3=['exports','ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes'];(function(_0x5cd65a,_0x301f8f){var _0x1606f8=function(_0x573494){while(--_0x573494){_0x5cd65a['push'](_0x5cd65a['shift']());}};_0x1606f8(++_0x301f8f);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0xab0346,_0x2f1ef1){_0xab0346=_0xab0346-0x0;var _0x4bfe92=_0xe1e3[_0xab0346];return _0x4bfe92;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var logger=require('../../config/logger')(_0x3e1e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3e1e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e1e('0x4'));var config=require(_0x3e1e('0x5'));var attributes=require(_0x3e1e('0x6'));module[_0x3e1e('0x7')]=function(_0x40d6d8,_0x25701f){return _0x40d6d8['define'](_0x3e1e('0x8'),attributes,{'tableName':_0x3e1e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 3ef2f14..f0bc696 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 _0x6318=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','util','moment'];(function(_0x2ddea4,_0x3b4d83){var _0xb3eb2=function(_0x11ab0a){while(--_0x11ab0a){_0x2ddea4['push'](_0x2ddea4['shift']());}};_0xb3eb2(++_0x3b4d83);}(_0x6318,0xf0));var _0x8631=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x6318[_0x1d24eb];return _0x1dc576;};'use strict';var _=require('lodash');var util=require(_0x8631('0x0'));var moment=require(_0x8631('0x1'));var BPromise=require('bluebird');var rs=require(_0x8631('0x2'));var fs=require('fs');var Redis=require(_0x8631('0x3'));var db=require(_0x8631('0x4'))['db'];var utils=require(_0x8631('0x5'));var logger=require(_0x8631('0x6'))(_0x8631('0x7'));var config=require(_0x8631('0x8'));var jayson=require(_0x8631('0x9'));var client=jayson[_0x8631('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1350b7,_0x5d4620,_0x23f7b5){return new BPromise(function(_0x3d1a0c,_0xf9fe3){return client[_0x8631('0xb')](_0x1350b7,_0x23f7b5)[_0x8631('0xc')](function(_0x126a5e){logger['info'](_0x8631('0xd'),_0x5d4620,_0x8631('0xe'));logger[_0x8631('0xf')](_0x8631('0x10'),_0x5d4620,_0x8631('0xe'),JSON['stringify'](_0x126a5e));if(_0x126a5e[_0x8631('0x11')]){if(_0x126a5e['error'][_0x8631('0x12')]===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x5d4620,_0x126a5e['error'][_0x8631('0x13')]);return _0xf9fe3(_0x126a5e[_0x8631('0x11')][_0x8631('0x13')]);}logger[_0x8631('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5d4620,_0x126a5e[_0x8631('0x11')][_0x8631('0x13')]);return _0x3d1a0c(_0x126a5e['error']['message']);}else{logger[_0x8631('0x14')](_0x8631('0xd'),_0x5d4620,_0x8631('0xe'));_0x3d1a0c(_0x126a5e[_0x8631('0x15')][_0x8631('0x13')]);}})['catch'](function(_0x3a6b92){logger[_0x8631('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5d4620,_0x3a6b92);_0xf9fe3(_0x3a6b92);});});} \ No newline at end of file +var _0xa424=['../../config/logger','rpc','../../config/environment','client','request','then','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','info','request\x20sent','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x130ffd,_0x40592a){var _0x4d21b3=function(_0x33a36e){while(--_0x33a36e){_0x130ffd['push'](_0x130ffd['shift']());}};_0x4d21b3(++_0x40592a);}(_0xa424,0x160));var _0x4a42=function(_0x28613d,_0x3574b5){_0x28613d=_0x28613d-0x0;var _0x3f77f0=_0xa424[_0x28613d];return _0x3f77f0;};'use strict';var _=require(_0x4a42('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4a42('0x1'));var rs=require(_0x4a42('0x2'));var fs=require('fs');var Redis=require(_0x4a42('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4a42('0x4'));var logger=require(_0x4a42('0x5'))(_0x4a42('0x6'));var config=require(_0x4a42('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4a42('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45ff10,_0x449829,_0x5bbeeb){return new BPromise(function(_0x394438,_0xe51b23){return client[_0x4a42('0x9')](_0x45ff10,_0x5bbeeb)[_0x4a42('0xa')](function(_0x1dee46){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x449829,'request\x20sent');logger[_0x4a42('0xb')](_0x4a42('0xc'),_0x449829,'request\x20sent',JSON['stringify'](_0x1dee46));if(_0x1dee46[_0x4a42('0xd')]){if(_0x1dee46[_0x4a42('0xd')][_0x4a42('0xe')]===0x1f4){logger[_0x4a42('0xd')](_0x4a42('0xf'),_0x449829,_0x1dee46[_0x4a42('0xd')][_0x4a42('0x10')]);return _0xe51b23(_0x1dee46[_0x4a42('0xd')][_0x4a42('0x10')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x449829,_0x1dee46[_0x4a42('0xd')][_0x4a42('0x10')]);return _0x394438(_0x1dee46[_0x4a42('0xd')]['message']);}else{logger[_0x4a42('0x11')](_0x4a42('0xf'),_0x449829,_0x4a42('0x12'));_0x394438(_0x1dee46[_0x4a42('0x13')][_0x4a42('0x10')]);}})[_0x4a42('0x14')](function(_0x16cef6){logger[_0x4a42('0xd')](_0x4a42('0xf'),_0x449829,_0x16cef6);_0xe51b23(_0x16cef6);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 6be79f2..ca624e0 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 _0xb5df=['index','post','isAuthenticated','create','put','update','delete','/:id','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intZendeskField.controller','get'];(function(_0x1d3791,_0x51c613){var _0x40fbf5=function(_0xe5d147){while(--_0xe5d147){_0x1d3791['push'](_0x1d3791['shift']());}};_0x40fbf5(++_0x51c613);}(_0xb5df,0x196));var _0xfb5d=function(_0x55b22a,_0x41445f){_0x55b22a=_0x55b22a-0x0;var _0x52c56f=_0xb5df[_0x55b22a];return _0x52c56f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfb5d('0x0'));var timeout=require(_0xfb5d('0x1'));var express=require(_0xfb5d('0x2'));var router=express[_0xfb5d('0x3')]();var fs_extra=require(_0xfb5d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfb5d('0x5'));var config=require('../../config/environment');var controller=require(_0xfb5d('0x6'));router[_0xfb5d('0x7')]('/',auth['isAuthenticated'](),controller[_0xfb5d('0x8')]);router[_0xfb5d('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xfb5d('0x9')]('/',auth[_0xfb5d('0xa')](),controller[_0xfb5d('0xb')]);router[_0xfb5d('0xc')]('/:id',auth[_0xfb5d('0xa')](),controller[_0xfb5d('0xd')]);router[_0xfb5d('0xe')](_0xfb5d('0xf'),auth['isAuthenticated'](),controller[_0xfb5d('0x10')]);module[_0xfb5d('0x11')]=router; \ No newline at end of file +var _0x0c66=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','get','show','/:id','update','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x300696,_0xdc8616){var _0x397507=function(_0x5667b9){while(--_0x5667b9){_0x300696['push'](_0x300696['shift']());}};_0x397507(++_0xdc8616);}(_0x0c66,0x12d));var _0x60c6=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x0c66[_0x12fc8d];return _0x3f9d04;};'use strict';var multer=require(_0x60c6('0x0'));var util=require(_0x60c6('0x1'));var path=require(_0x60c6('0x2'));var timeout=require(_0x60c6('0x3'));var express=require('express');var router=express[_0x60c6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x60c6('0x5'));var interaction=require(_0x60c6('0x6'));var config=require(_0x60c6('0x7'));var controller=require(_0x60c6('0x8'));router['get']('/',auth[_0x60c6('0x9')](),controller[_0x60c6('0xa')]);router[_0x60c6('0xb')]('/:id',auth[_0x60c6('0x9')](),controller[_0x60c6('0xc')]);router['post']('/',auth[_0x60c6('0x9')](),controller['create']);router['put'](_0x60c6('0xd'),auth[_0x60c6('0x9')](),controller[_0x60c6('0xe')]);router['delete'](_0x60c6('0xd'),auth[_0x60c6('0x9')](),controller[_0x60c6('0xf')]);module[_0x60c6('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index b7eeb99..7733c91 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 _0x8e28=['keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x4c3851,_0xbebbfd){var _0x43a1e2=function(_0x271b9f){while(--_0x271b9f){_0x4c3851['push'](_0x4c3851['shift']());}};_0x43a1e2(++_0xbebbfd);}(_0x8e28,0xa4));var _0x88e2=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x8e28[_0x47aa64];return _0x549c7a;};'use strict';var Sequelize=require(_0x88e2('0x0'));module[_0x88e2('0x1')]={'type':{'type':Sequelize[_0x88e2('0x2')](_0x88e2('0x3'),_0x88e2('0x4'),_0x88e2('0x5'),_0x88e2('0x6'),_0x88e2('0x7')),'defaultValue':_0x88e2('0x3')},'content':{'type':Sequelize[_0x88e2('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x88e2('0x2')](_0x88e2('0x3'),_0x88e2('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x88e2('0x8')]},'idField':{'type':Sequelize[_0x88e2('0x8')]},'nameField':{'type':Sequelize[_0x88e2('0x8')]},'customField':{'type':Sequelize[_0x88e2('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x88e2('0x8')]}}; \ No newline at end of file +var _0xe412=['sequelize','exports','ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN'];(function(_0x437e60,_0x2c7134){var _0x2b78c4=function(_0x39bab4){while(--_0x39bab4){_0x437e60['push'](_0x437e60['shift']());}};_0x2b78c4(++_0x2c7134);}(_0xe412,0xab));var _0x2e41=function(_0x2cdbbb,_0x570b6e){_0x2cdbbb=_0x2cdbbb-0x0;var _0x237bc1=_0xe412[_0x2cdbbb];return _0x237bc1;};'use strict';var Sequelize=require(_0x2e41('0x0'));module[_0x2e41('0x1')]={'type':{'type':Sequelize[_0x2e41('0x2')](_0x2e41('0x3'),'variable',_0x2e41('0x4'),_0x2e41('0x5'),'picklist'),'defaultValue':_0x2e41('0x3')},'content':{'type':Sequelize[_0x2e41('0x6')]},'key':{'type':Sequelize[_0x2e41('0x6')]},'keyType':{'type':Sequelize[_0x2e41('0x2')]('string',_0x2e41('0x7'),_0x2e41('0x4'))},'keyContent':{'type':Sequelize[_0x2e41('0x6')]},'idField':{'type':Sequelize[_0x2e41('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2e41('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2e41('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 81d40c1..33e6db9 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 _0xb75c=['sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','save','then','destroy','error','stack','name','send','index','map','ZendeskField','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','body','catch','find','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','fs-extra','lodash','squel','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x549f20,_0x23e210){var _0x56cbe0=function(_0x5a92f5){while(--_0x5a92f5){_0x549f20['push'](_0x549f20['shift']());}};_0x56cbe0(++_0x23e210);}(_0xb75c,0x1ce));var _0xcb75=function(_0x4e3a92,_0x35f2f7){_0x4e3a92=_0x4e3a92-0x0;var _0x24e926=_0xb75c[_0x4e3a92];return _0x24e926;};'use strict';var emlformat=require(_0xcb75('0x0'));var rimraf=require(_0xcb75('0x1'));var zipdir=require(_0xcb75('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcb75('0x3'));var moment=require('moment');var BPromise=require(_0xcb75('0x4'));var Mustache=require(_0xcb75('0x5'));var util=require(_0xcb75('0x6'));var path=require('path');var sox=require(_0xcb75('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcb75('0x8'));var _=require(_0xcb75('0x9'));var squel=require(_0xcb75('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcb75('0xb'));var querystring=require(_0xcb75('0xc'));var Papa=require(_0xcb75('0xd'));var Redis=require('ioredis');var authService=require(_0xcb75('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xcb75('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcb75('0x10'))('api');var utils=require(_0xcb75('0x11'));var config=require(_0xcb75('0x12'));var licenseUtil=require(_0xcb75('0x13'));var db=require(_0xcb75('0x14'))['db'];function respondWithStatusCode(_0x526c03,_0x1e0bba){_0x1e0bba=_0x1e0bba||0xcc;return function(_0x13c953){if(_0x13c953){return _0x526c03[_0xcb75('0x15')](_0x1e0bba);}return _0x526c03[_0xcb75('0x16')](_0x1e0bba)[_0xcb75('0x17')]();};}function respondWithResult(_0x3ae629,_0x23c719){_0x23c719=_0x23c719||0xc8;return function(_0x2c14a1){if(_0x2c14a1){return _0x3ae629['status'](_0x23c719)['json'](_0x2c14a1);}};}function respondWithFilteredResult(_0xa0ce25,_0x1af8c1){return function(_0x589afc){if(_0x589afc){var _0x1b9765=typeof _0x1af8c1[_0xcb75('0x18')]==='undefined'&&typeof _0x1af8c1[_0xcb75('0x19')]===_0xcb75('0x1a');var _0x1a0413=_0x589afc[_0xcb75('0x1b')];var _0x57ad84=_0x1b9765?0x0:_0x1af8c1[_0xcb75('0x18')];var _0x32a66f=_0x1b9765?_0x589afc['count']:_0x1af8c1[_0xcb75('0x18')]+_0x1af8c1[_0xcb75('0x19')];var _0x6be8f0;if(_0x32a66f>=_0x1a0413){_0x32a66f=_0x1a0413;_0x6be8f0=0xc8;}else{_0x6be8f0=0xce;}_0xa0ce25[_0xcb75('0x16')](_0x6be8f0);return _0xa0ce25['set'](_0xcb75('0x1c'),_0x57ad84+'-'+_0x32a66f+'/'+_0x1a0413)[_0xcb75('0x1d')](_0x589afc);}return null;};}function patchUpdates(_0x14bba7){return function(_0x2489e9){try{jsonpatch[_0xcb75('0x1e')](_0x2489e9,_0x14bba7,!![]);}catch(_0x232c57){return BPromise['reject'](_0x232c57);}return _0x2489e9[_0xcb75('0x1f')]();};}function saveUpdates(_0x4ca28b,_0x265cf2){return function(_0x78e743){if(_0x78e743){return _0x78e743['update'](_0x4ca28b)[_0xcb75('0x20')](function(_0x1a7154){return _0x1a7154;});}return null;};}function removeEntity(_0x5b0874,_0x29a56e){return function(_0x338222){if(_0x338222){return _0x338222[_0xcb75('0x21')]()[_0xcb75('0x20')](function(){_0x5b0874[_0xcb75('0x16')](0xcc)[_0xcb75('0x17')]();});}};}function handleEntityNotFound(_0x1f6df6,_0x5a61dd){return function(_0x263d46){if(!_0x263d46){_0x1f6df6[_0xcb75('0x15')](0x194);}return _0x263d46;};}function handleError(_0x501dcf,_0x417342){_0x417342=_0x417342||0x1f4;return function(_0x37928b){logger[_0xcb75('0x22')](_0x37928b[_0xcb75('0x23')]);if(_0x37928b[_0xcb75('0x24')]){delete _0x37928b[_0xcb75('0x24')];}_0x501dcf[_0xcb75('0x16')](_0x417342)[_0xcb75('0x25')](_0x37928b);};}exports[_0xcb75('0x26')]=function(_0x54d718,_0x1bcf39){var _0x41e5fe={},_0x567087={},_0x153370={'count':0x0,'rows':[]};var _0x1b5c0d=_[_0xcb75('0x27')](db[_0xcb75('0x28')][_0xcb75('0x29')],function(_0x4bd240){return{'name':_0x4bd240['fieldName'],'type':_0x4bd240['type']['key']};});_0x567087[_0xcb75('0x2a')]=_['map'](_0x1b5c0d,_0xcb75('0x24'));_0x567087['query']=_[_0xcb75('0x2b')](_0x54d718[_0xcb75('0x2c')]);_0x567087[_0xcb75('0x2d')]=_['intersection'](_0x567087['model'],_0x567087[_0xcb75('0x2c')]);_0x41e5fe[_0xcb75('0x2e')]=_[_0xcb75('0x2f')](_0x567087[_0xcb75('0x2a')],qs[_0xcb75('0x30')](_0x54d718[_0xcb75('0x2c')][_0xcb75('0x30')]));_0x41e5fe[_0xcb75('0x2e')]=_0x41e5fe[_0xcb75('0x2e')][_0xcb75('0x31')]?_0x41e5fe[_0xcb75('0x2e')]:_0x567087[_0xcb75('0x2a')];if(!_0x54d718['query'][_0xcb75('0x32')](_0xcb75('0x33'))){_0x41e5fe['limit']=qs[_0xcb75('0x19')](_0x54d718[_0xcb75('0x2c')][_0xcb75('0x19')]);_0x41e5fe['offset']=qs['offset'](_0x54d718[_0xcb75('0x2c')][_0xcb75('0x18')]);}_0x41e5fe['order']=qs[_0xcb75('0x34')](_0x54d718['query'][_0xcb75('0x34')]);_0x41e5fe[_0xcb75('0x35')]=qs[_0xcb75('0x2d')](_['pick'](_0x54d718[_0xcb75('0x2c')],_0x567087[_0xcb75('0x2d')]),_0x1b5c0d);if(_0x54d718[_0xcb75('0x2c')][_0xcb75('0x36')]){_0x41e5fe[_0xcb75('0x35')]=_[_0xcb75('0x37')](_0x41e5fe[_0xcb75('0x35')],{'$or':_[_0xcb75('0x27')](_0x1b5c0d,function(_0x117bbd){if(_0x117bbd[_0xcb75('0x38')]!==_0xcb75('0x39')){var _0x4b1dbb={};_0x4b1dbb[_0x117bbd['name']]={'$like':'%'+_0x54d718['query'][_0xcb75('0x36')]+'%'};return _0x4b1dbb;}})});}_0x41e5fe=_[_0xcb75('0x37')]({},_0x41e5fe,_0x54d718[_0xcb75('0x3a')]);var _0x409ac9={'where':_0x41e5fe['where']};return db[_0xcb75('0x28')][_0xcb75('0x1b')](_0x409ac9)[_0xcb75('0x20')](function(_0x401a61){_0x153370[_0xcb75('0x1b')]=_0x401a61;if(_0x54d718['query'][_0xcb75('0x3b')]){_0x41e5fe[_0xcb75('0x3c')]=[{'all':!![]}];}return db[_0xcb75('0x28')][_0xcb75('0x3d')](_0x41e5fe);})[_0xcb75('0x20')](function(_0x53db83){_0x153370[_0xcb75('0x3e')]=_0x53db83;return _0x153370;})[_0xcb75('0x20')](respondWithFilteredResult(_0x1bcf39,_0x41e5fe))['catch'](handleError(_0x1bcf39,null));};exports[_0xcb75('0x3f')]=function(_0x53a1d8,_0xba1470){var _0x3be469={'raw':!![],'where':{'id':_0x53a1d8[_0xcb75('0x40')]['id']}},_0x20996a={};_0x20996a[_0xcb75('0x2a')]=_[_0xcb75('0x2b')](db[_0xcb75('0x28')][_0xcb75('0x29')]);_0x20996a[_0xcb75('0x2c')]=_['keys'](_0x53a1d8[_0xcb75('0x2c')]);_0x20996a[_0xcb75('0x2d')]=_[_0xcb75('0x2f')](_0x20996a[_0xcb75('0x2a')],_0x20996a[_0xcb75('0x2c')]);_0x3be469[_0xcb75('0x2e')]=_[_0xcb75('0x2f')](_0x20996a[_0xcb75('0x2a')],qs[_0xcb75('0x30')](_0x53a1d8[_0xcb75('0x2c')][_0xcb75('0x30')]));_0x3be469[_0xcb75('0x2e')]=_0x3be469[_0xcb75('0x2e')][_0xcb75('0x31')]?_0x3be469[_0xcb75('0x2e')]:_0x20996a[_0xcb75('0x2a')];if(_0x53a1d8['query']['includeAll']){_0x3be469[_0xcb75('0x3c')]=[{'all':!![]}];}_0x3be469=_[_0xcb75('0x37')]({},_0x3be469,_0x53a1d8[_0xcb75('0x3a')]);return db[_0xcb75('0x28')]['find'](_0x3be469)[_0xcb75('0x20')](handleEntityNotFound(_0xba1470,null))[_0xcb75('0x20')](respondWithResult(_0xba1470,null))['catch'](handleError(_0xba1470,null));};exports[_0xcb75('0x41')]=function(_0x2bd64b,_0x44273a){return db[_0xcb75('0x28')][_0xcb75('0x41')](_0x2bd64b[_0xcb75('0x42')],{})[_0xcb75('0x20')](respondWithResult(_0x44273a,0xc9))[_0xcb75('0x43')](handleError(_0x44273a,null));};exports['update']=function(_0x1fb0a3,_0x122f3e){if(_0x1fb0a3['body']['id']){delete _0x1fb0a3[_0xcb75('0x42')]['id'];}return db['ZendeskField']['find']({'where':{'id':_0x1fb0a3[_0xcb75('0x40')]['id']}})[_0xcb75('0x20')](handleEntityNotFound(_0x122f3e,null))[_0xcb75('0x20')](saveUpdates(_0x1fb0a3[_0xcb75('0x42')],null))[_0xcb75('0x20')](respondWithResult(_0x122f3e,null))[_0xcb75('0x43')](handleError(_0x122f3e,null));};exports[_0xcb75('0x21')]=function(_0x12fa20,_0x19f174){return db[_0xcb75('0x28')][_0xcb75('0x44')]({'where':{'id':_0x12fa20[_0xcb75('0x40')]['id']}})[_0xcb75('0x20')](handleEntityNotFound(_0x19f174,null))[_0xcb75('0x20')](removeEntity(_0x19f174,null))[_0xcb75('0x43')](handleError(_0x19f174,null));}; \ No newline at end of file +var _0x5bb7=['limit','set','Content-Range','save','update','then','end','error','stack','name','send','map','ZendeskField','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','offset'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0x5bb7,0xc2));var _0x75bb=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x5bb7[_0x75f869];return _0x10af8b;};'use strict';var emlformat=require(_0x75bb('0x0'));var rimraf=require(_0x75bb('0x1'));var zipdir=require(_0x75bb('0x2'));var jsonpatch=require(_0x75bb('0x3'));var rp=require(_0x75bb('0x4'));var moment=require(_0x75bb('0x5'));var BPromise=require(_0x75bb('0x6'));var Mustache=require(_0x75bb('0x7'));var util=require(_0x75bb('0x8'));var path=require(_0x75bb('0x9'));var sox=require(_0x75bb('0xa'));var csv=require(_0x75bb('0xb'));var ejs=require(_0x75bb('0xc'));var fs=require('fs');var fs_extra=require(_0x75bb('0xd'));var _=require('lodash');var squel=require(_0x75bb('0xe'));var crypto=require('crypto');var jsforce=require(_0x75bb('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x75bb('0xb'));var querystring=require(_0x75bb('0x10'));var Papa=require('papaparse');var Redis=require(_0x75bb('0x11'));var authService=require(_0x75bb('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x75bb('0x13'));var logger=require('../../config/logger')(_0x75bb('0x14'));var utils=require('../../config/utils');var config=require(_0x75bb('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x75bb('0x16'))['db'];function respondWithStatusCode(_0x2f006d,_0x270418){_0x270418=_0x270418||0xcc;return function(_0x33dad6){if(_0x33dad6){return _0x2f006d[_0x75bb('0x17')](_0x270418);}return _0x2f006d[_0x75bb('0x18')](_0x270418)['end']();};}function respondWithResult(_0x1eecd1,_0x40ecaa){_0x40ecaa=_0x40ecaa||0xc8;return function(_0x328d30){if(_0x328d30){return _0x1eecd1[_0x75bb('0x18')](_0x40ecaa)[_0x75bb('0x19')](_0x328d30);}};}function respondWithFilteredResult(_0xe0cb6,_0x590e00){return function(_0x19eac8){if(_0x19eac8){var _0x4e91c5=typeof _0x590e00['offset']===_0x75bb('0x1a')&&typeof _0x590e00['limit']===_0x75bb('0x1a');var _0x1a1f31=_0x19eac8['count'];var _0x446759=_0x4e91c5?0x0:_0x590e00[_0x75bb('0x1b')];var _0x4166f1=_0x4e91c5?_0x19eac8['count']:_0x590e00['offset']+_0x590e00[_0x75bb('0x1c')];var _0x4654c5;if(_0x4166f1>=_0x1a1f31){_0x4166f1=_0x1a1f31;_0x4654c5=0xc8;}else{_0x4654c5=0xce;}_0xe0cb6[_0x75bb('0x18')](_0x4654c5);return _0xe0cb6[_0x75bb('0x1d')](_0x75bb('0x1e'),_0x446759+'-'+_0x4166f1+'/'+_0x1a1f31)[_0x75bb('0x19')](_0x19eac8);}return null;};}function patchUpdates(_0x38c3ea){return function(_0x1562fa){try{jsonpatch['apply'](_0x1562fa,_0x38c3ea,!![]);}catch(_0x3da770){return BPromise['reject'](_0x3da770);}return _0x1562fa[_0x75bb('0x1f')]();};}function saveUpdates(_0x443040,_0x58e1a5){return function(_0x50f51e){if(_0x50f51e){return _0x50f51e[_0x75bb('0x20')](_0x443040)[_0x75bb('0x21')](function(_0x285fdc){return _0x285fdc;});}return null;};}function removeEntity(_0x273581,_0x4cf7b3){return function(_0x89dee2){if(_0x89dee2){return _0x89dee2['destroy']()[_0x75bb('0x21')](function(){_0x273581[_0x75bb('0x18')](0xcc)[_0x75bb('0x22')]();});}};}function handleEntityNotFound(_0x3c4242,_0x51d0e2){return function(_0x5b5efa){if(!_0x5b5efa){_0x3c4242['sendStatus'](0x194);}return _0x5b5efa;};}function handleError(_0x5701be,_0x508c7e){_0x508c7e=_0x508c7e||0x1f4;return function(_0x3fa808){logger[_0x75bb('0x23')](_0x3fa808[_0x75bb('0x24')]);if(_0x3fa808[_0x75bb('0x25')]){delete _0x3fa808['name'];}_0x5701be[_0x75bb('0x18')](_0x508c7e)[_0x75bb('0x26')](_0x3fa808);};}exports['index']=function(_0x5649f4,_0x453948){var _0x56907d={},_0x484a72={},_0x1ecbb0={'count':0x0,'rows':[]};var _0xcb1bf9=_[_0x75bb('0x27')](db[_0x75bb('0x28')][_0x75bb('0x29')],function(_0xbe9bfe){return{'name':_0xbe9bfe[_0x75bb('0x2a')],'type':_0xbe9bfe[_0x75bb('0x2b')][_0x75bb('0x2c')]};});_0x484a72['model']=_[_0x75bb('0x27')](_0xcb1bf9,_0x75bb('0x25'));_0x484a72[_0x75bb('0x2d')]=_[_0x75bb('0x2e')](_0x5649f4['query']);_0x484a72['filters']=_[_0x75bb('0x2f')](_0x484a72[_0x75bb('0x30')],_0x484a72[_0x75bb('0x2d')]);_0x56907d[_0x75bb('0x31')]=_[_0x75bb('0x2f')](_0x484a72['model'],qs[_0x75bb('0x32')](_0x5649f4[_0x75bb('0x2d')][_0x75bb('0x32')]));_0x56907d['attributes']=_0x56907d[_0x75bb('0x31')][_0x75bb('0x33')]?_0x56907d[_0x75bb('0x31')]:_0x484a72['model'];if(!_0x5649f4['query'][_0x75bb('0x34')](_0x75bb('0x35'))){_0x56907d['limit']=qs[_0x75bb('0x1c')](_0x5649f4[_0x75bb('0x2d')][_0x75bb('0x1c')]);_0x56907d[_0x75bb('0x1b')]=qs[_0x75bb('0x1b')](_0x5649f4[_0x75bb('0x2d')][_0x75bb('0x1b')]);}_0x56907d[_0x75bb('0x36')]=qs[_0x75bb('0x37')](_0x5649f4[_0x75bb('0x2d')]['sort']);_0x56907d[_0x75bb('0x38')]=qs['filters'](_[_0x75bb('0x39')](_0x5649f4['query'],_0x484a72[_0x75bb('0x3a')]),_0xcb1bf9);if(_0x5649f4[_0x75bb('0x2d')][_0x75bb('0x3b')]){_0x56907d[_0x75bb('0x38')]=_[_0x75bb('0x3c')](_0x56907d[_0x75bb('0x38')],{'$or':_[_0x75bb('0x27')](_0xcb1bf9,function(_0x24c996){if(_0x24c996[_0x75bb('0x2b')]!==_0x75bb('0x3d')){var _0x2e845e={};_0x2e845e[_0x24c996[_0x75bb('0x25')]]={'$like':'%'+_0x5649f4[_0x75bb('0x2d')][_0x75bb('0x3b')]+'%'};return _0x2e845e;}})});}_0x56907d=_[_0x75bb('0x3c')]({},_0x56907d,_0x5649f4[_0x75bb('0x3e')]);var _0x59a78f={'where':_0x56907d['where']};return db['ZendeskField'][_0x75bb('0x3f')](_0x59a78f)[_0x75bb('0x21')](function(_0x48c0f7){_0x1ecbb0[_0x75bb('0x3f')]=_0x48c0f7;if(_0x5649f4['query'][_0x75bb('0x40')]){_0x56907d[_0x75bb('0x41')]=[{'all':!![]}];}return db[_0x75bb('0x28')][_0x75bb('0x42')](_0x56907d);})['then'](function(_0x2cb196){_0x1ecbb0[_0x75bb('0x43')]=_0x2cb196;return _0x1ecbb0;})['then'](respondWithFilteredResult(_0x453948,_0x56907d))[_0x75bb('0x44')](handleError(_0x453948,null));};exports['show']=function(_0x4c8173,_0x11968e){var _0x31a43c={'raw':!![],'where':{'id':_0x4c8173[_0x75bb('0x45')]['id']}},_0x345ad0={};_0x345ad0[_0x75bb('0x30')]=_['keys'](db[_0x75bb('0x28')][_0x75bb('0x29')]);_0x345ad0['query']=_[_0x75bb('0x2e')](_0x4c8173['query']);_0x345ad0[_0x75bb('0x3a')]=_[_0x75bb('0x2f')](_0x345ad0[_0x75bb('0x30')],_0x345ad0[_0x75bb('0x2d')]);_0x31a43c['attributes']=_['intersection'](_0x345ad0['model'],qs[_0x75bb('0x32')](_0x4c8173[_0x75bb('0x2d')]['fields']));_0x31a43c[_0x75bb('0x31')]=_0x31a43c[_0x75bb('0x31')][_0x75bb('0x33')]?_0x31a43c[_0x75bb('0x31')]:_0x345ad0[_0x75bb('0x30')];if(_0x4c8173[_0x75bb('0x2d')]['includeAll']){_0x31a43c['include']=[{'all':!![]}];}_0x31a43c=_[_0x75bb('0x3c')]({},_0x31a43c,_0x4c8173['options']);return db['ZendeskField'][_0x75bb('0x46')](_0x31a43c)['then'](handleEntityNotFound(_0x11968e,null))['then'](respondWithResult(_0x11968e,null))['catch'](handleError(_0x11968e,null));};exports[_0x75bb('0x47')]=function(_0x4fb027,_0x2e0ef5){return db[_0x75bb('0x28')]['create'](_0x4fb027['body'],{})[_0x75bb('0x21')](respondWithResult(_0x2e0ef5,0xc9))[_0x75bb('0x44')](handleError(_0x2e0ef5,null));};exports['update']=function(_0x40fce3,_0x3496cc){if(_0x40fce3[_0x75bb('0x48')]['id']){delete _0x40fce3[_0x75bb('0x48')]['id'];}return db[_0x75bb('0x28')][_0x75bb('0x46')]({'where':{'id':_0x40fce3['params']['id']}})[_0x75bb('0x21')](handleEntityNotFound(_0x3496cc,null))[_0x75bb('0x21')](saveUpdates(_0x40fce3['body'],null))['then'](respondWithResult(_0x3496cc,null))['catch'](handleError(_0x3496cc,null));};exports[_0x75bb('0x49')]=function(_0x567bc2,_0x187a2d){return db['ZendeskField'][_0x75bb('0x46')]({'where':{'id':_0x567bc2[_0x75bb('0x45')]['id']}})['then'](handleEntityNotFound(_0x187a2d,null))[_0x75bb('0x21')](removeEntity(_0x187a2d,null))[_0x75bb('0x44')](handleError(_0x187a2d,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 2effa3a..2c8bc35 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 _0x4d5e=['define','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskField.attributes','exports'];(function(_0x4db22f,_0x1ceff1){var _0x5aa6d6=function(_0x1e2026){while(--_0x1e2026){_0x4db22f['push'](_0x4db22f['shift']());}};_0x5aa6d6(++_0x1ceff1);}(_0x4d5e,0x17c));var _0xe4d5=function(_0x5549e7,_0x36dc5){_0x5549e7=_0x5549e7-0x0;var _0x449127=_0x4d5e[_0x5549e7];return _0x449127;};'use strict';var _=require(_0xe4d5('0x0'));var util=require('util');var logger=require(_0xe4d5('0x1'))(_0xe4d5('0x2'));var moment=require(_0xe4d5('0x3'));var BPromise=require(_0xe4d5('0x4'));var rp=require(_0xe4d5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe4d5('0x6'));var config=require(_0xe4d5('0x7'));var attributes=require(_0xe4d5('0x8'));module[_0xe4d5('0x9')]=function(_0x4c167c,_0x3a531c){return _0x4c167c[_0xe4d5('0xa')]('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xe4d5('0xb'),_0xe4d5('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb955=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intZendeskField.attributes','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField'];(function(_0x5b2bb6,_0x2c59d3){var _0x45e623=function(_0x5118ea){while(--_0x5118ea){_0x5b2bb6['push'](_0x5b2bb6['shift']());}};_0x45e623(++_0x2c59d3);}(_0xb955,0x71));var _0x5b95=function(_0x1f53ef,_0x43a2b6){_0x1f53ef=_0x1f53ef-0x0;var _0x4650d0=_0xb955[_0x1f53ef];return _0x4650d0;};'use strict';var _=require(_0x5b95('0x0'));var util=require(_0x5b95('0x1'));var logger=require(_0x5b95('0x2'))(_0x5b95('0x3'));var moment=require(_0x5b95('0x4'));var BPromise=require(_0x5b95('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b95('0x6'));var rimraf=require(_0x5b95('0x7'));var config=require(_0x5b95('0x8'));var attributes=require(_0x5b95('0x9'));module['exports']=function(_0x31d3a7,_0x87b19b){return _0x31d3a7[_0x5b95('0xa')](_0x5b95('0xb'),attributes,{'tableName':_0x5b95('0xc'),'paranoid':![],'indexes':[{'name':_0x5b95('0xd'),'fields':[_0x5b95('0xe'),_0x5b95('0xf')],'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 8c3c95b..fa78558 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 _0x491a=['result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3e2436,_0x3dcac3){var _0x16d72a=function(_0x2a88fe){while(--_0x2a88fe){_0x3e2436['push'](_0x3e2436['shift']());}};_0x16d72a(++_0x3dcac3);}(_0x491a,0x6f));var _0xa491=function(_0x53d0f2,_0x461fff){_0x53d0f2=_0x53d0f2-0x0;var _0x4039fe=_0x491a[_0x53d0f2];return _0x4039fe;};'use strict';var _=require(_0xa491('0x0'));var util=require(_0xa491('0x1'));var moment=require(_0xa491('0x2'));var BPromise=require(_0xa491('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa491('0x4'));var db=require(_0xa491('0x5'))['db'];var utils=require(_0xa491('0x6'));var logger=require(_0xa491('0x7'))(_0xa491('0x8'));var config=require(_0xa491('0x9'));var jayson=require(_0xa491('0xa'));var client=jayson[_0xa491('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfa311,_0x3ea5e4,_0x7857ff){return new BPromise(function(_0x47ffbf,_0x45d954){return client['request'](_0xfa311,_0x7857ff)[_0xa491('0xc')](function(_0x412f19){logger[_0xa491('0xd')](_0xa491('0xe'),_0x3ea5e4,_0xa491('0xf'));logger['debug'](_0xa491('0x10'),_0x3ea5e4,_0xa491('0xf'),JSON[_0xa491('0x11')](_0x412f19));if(_0x412f19[_0xa491('0x12')]){if(_0x412f19[_0xa491('0x12')][_0xa491('0x13')]===0x1f4){logger[_0xa491('0x12')](_0xa491('0xe'),_0x3ea5e4,_0x412f19[_0xa491('0x12')]['message']);return _0x45d954(_0x412f19[_0xa491('0x12')][_0xa491('0x14')]);}logger[_0xa491('0x12')](_0xa491('0xe'),_0x3ea5e4,_0x412f19['error'][_0xa491('0x14')]);return _0x47ffbf(_0x412f19[_0xa491('0x12')][_0xa491('0x14')]);}else{logger[_0xa491('0xd')](_0xa491('0xe'),_0x3ea5e4,_0xa491('0xf'));_0x47ffbf(_0x412f19[_0xa491('0x15')]['message']);}})['catch'](function(_0x2dec2a){logger[_0xa491('0x12')](_0xa491('0xe'),_0x3ea5e4,_0x2dec2a);_0x45d954(_0x2dec2a);});});} \ No newline at end of file +var _0x2e9b=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util'];(function(_0x8aa23e,_0x5e58c2){var _0x5efbb3=function(_0x9a0d24){while(--_0x9a0d24){_0x8aa23e['push'](_0x8aa23e['shift']());}};_0x5efbb3(++_0x5e58c2);}(_0x2e9b,0xc4));var _0xb2e9=function(_0x2f2796,_0x5c42a4){_0x2f2796=_0x2f2796-0x0;var _0x309cb6=_0x2e9b[_0x2f2796];return _0x309cb6;};'use strict';var _=require(_0xb2e9('0x0'));var util=require(_0xb2e9('0x1'));var moment=require(_0xb2e9('0x2'));var BPromise=require(_0xb2e9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb2e9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb2e9('0x5'));var logger=require(_0xb2e9('0x6'))(_0xb2e9('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb2e9('0x8')][_0xb2e9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe38b9,_0x42ca95,_0xc51faf){return new BPromise(function(_0x63e669,_0x2f7f28){return client[_0xb2e9('0xa')](_0xe38b9,_0xc51faf)[_0xb2e9('0xb')](function(_0x43a2b3){logger['info'](_0xb2e9('0xc'),_0x42ca95,_0xb2e9('0xd'));logger[_0xb2e9('0xe')](_0xb2e9('0xf'),_0x42ca95,'request\x20sent',JSON['stringify'](_0x43a2b3));if(_0x43a2b3[_0xb2e9('0x10')]){if(_0x43a2b3[_0xb2e9('0x10')][_0xb2e9('0x11')]===0x1f4){logger[_0xb2e9('0x10')](_0xb2e9('0xc'),_0x42ca95,_0x43a2b3[_0xb2e9('0x10')]['message']);return _0x2f7f28(_0x43a2b3['error']['message']);}logger[_0xb2e9('0x10')](_0xb2e9('0xc'),_0x42ca95,_0x43a2b3[_0xb2e9('0x10')]['message']);return _0x63e669(_0x43a2b3[_0xb2e9('0x10')][_0xb2e9('0x12')]);}else{logger[_0xb2e9('0x13')]('ZendeskField,\x20%s,\x20%s',_0x42ca95,'request\x20sent');_0x63e669(_0x43a2b3[_0xb2e9('0x14')][_0xb2e9('0x12')]);}})[_0xb2e9('0x15')](function(_0x135ff6){logger['error'](_0xb2e9('0xc'),_0x42ca95,_0x135ff6);_0x2f7f28(_0x135ff6);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index a5e036c..4d17a7a 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 _0xef29=['destroy','exports','multer','path','connect-timeout','../../config/environment','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','/:id','delete'];(function(_0x19c7a8,_0x10508d){var _0x1462ce=function(_0x33f2c8){while(--_0x33f2c8){_0x19c7a8['push'](_0x19c7a8['shift']());}};_0x1462ce(++_0x10508d);}(_0xef29,0xd3));var _0x9ef2=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xef29[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x9ef2('0x0'));var util=require('util');var path=require(_0x9ef2('0x1'));var timeout=require(_0x9ef2('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9ef2('0x3'));var controller=require('./intZohoAccount.controller');router['get']('/',auth[_0x9ef2('0x4')](),controller[_0x9ef2('0x5')]);router[_0x9ef2('0x6')]('/:id',auth[_0x9ef2('0x4')](),controller[_0x9ef2('0x7')]);router['get'](_0x9ef2('0x8'),auth[_0x9ef2('0x4')](),controller[_0x9ef2('0x9')]);router[_0x9ef2('0x6')]('/:id/fields',auth[_0x9ef2('0x4')](),controller[_0x9ef2('0xa')]);router[_0x9ef2('0xb')]('/',auth[_0x9ef2('0x4')](),controller[_0x9ef2('0xc')]);router[_0x9ef2('0xb')](_0x9ef2('0x8'),auth[_0x9ef2('0x4')](),controller[_0x9ef2('0xd')]);router[_0x9ef2('0xe')](_0x9ef2('0xf'),auth[_0x9ef2('0x4')](),controller['update']);router[_0x9ef2('0x10')](_0x9ef2('0xf'),auth[_0x9ef2('0x4')](),controller[_0x9ef2('0x11')]);module[_0x9ef2('0x12')]=router; \ No newline at end of file +var _0xf306=['express','Router','../../config/environment','./intZohoAccount.controller','isAuthenticated','get','/:id','show','/:id/configurations','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','util'];(function(_0x2fad1b,_0x426aae){var _0x3d6865=function(_0x3d7fe4){while(--_0x3d7fe4){_0x2fad1b['push'](_0x2fad1b['shift']());}};_0x3d6865(++_0x426aae);}(_0xf306,0x141));var _0x6f30=function(_0x2b8549,_0x28f62a){_0x2b8549=_0x2b8549-0x0;var _0x337bc8=_0xf306[_0x2b8549];return _0x337bc8;};'use strict';var multer=require(_0x6f30('0x0'));var util=require(_0x6f30('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6f30('0x2'));var router=express[_0x6f30('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6f30('0x4'));var controller=require(_0x6f30('0x5'));router['get']('/',auth[_0x6f30('0x6')](),controller['index']);router[_0x6f30('0x7')](_0x6f30('0x8'),auth[_0x6f30('0x6')](),controller[_0x6f30('0x9')]);router['get'](_0x6f30('0xa'),auth[_0x6f30('0x6')](),controller['getConfigurations']);router[_0x6f30('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x6f30('0xb')]);router[_0x6f30('0xc')]('/',auth['isAuthenticated'](),controller[_0x6f30('0xd')]);router[_0x6f30('0xc')](_0x6f30('0xa'),auth[_0x6f30('0x6')](),controller[_0x6f30('0xe')]);router[_0x6f30('0xf')](_0x6f30('0x8'),auth[_0x6f30('0x6')](),controller[_0x6f30('0x10')]);router['delete'](_0x6f30('0x8'),auth[_0x6f30('0x6')](),controller[_0x6f30('0x11')]);module[_0x6f30('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index c020280..aa85f5e 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 _0xbec5=['STRING','sequelize','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xbec5,0xe5));var _0x5bec=function(_0x485f35,_0x45a0fc){_0x485f35=_0x485f35-0x0;var _0x2ad118=_0xbec5[_0x485f35];return _0x2ad118;};'use strict';var Sequelize=require(_0x5bec('0x0'));module[_0x5bec('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5bec('0x2')]},'host':{'type':Sequelize[_0x5bec('0x2')]},'zone':{'type':Sequelize[_0x5bec('0x2')]},'clientId':{'type':Sequelize[_0x5bec('0x2')]},'clientSecret':{'type':Sequelize[_0x5bec('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0x5bec('0x2')]},'refreshToken':{'type':Sequelize[_0x5bec('0x2')]}}; \ No newline at end of file +var _0x99e9=['exports','STRING'];(function(_0x3df920,_0x49b512){var _0x20ae4c=function(_0x234d5e){while(--_0x234d5e){_0x3df920['push'](_0x3df920['shift']());}};_0x20ae4c(++_0x49b512);}(_0x99e9,0xb4));var _0x999e=function(_0x31b9cf,_0x1a809b){_0x31b9cf=_0x31b9cf-0x0;var _0x357b8a=_0x99e9[_0x31b9cf];return _0x357b8a;};'use strict';var Sequelize=require('sequelize');module[_0x999e('0x0')]={'name':{'type':Sequelize[_0x999e('0x1')]},'description':{'type':Sequelize[_0x999e('0x1')]},'host':{'type':Sequelize[_0x999e('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x999e('0x1')]},'clientSecret':{'type':Sequelize[_0x999e('0x1')]},'serverUrl':{'type':Sequelize[_0x999e('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x999e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index c16cc30..95e7cfb 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 _0x9145=['name','send','index','map','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','ZohoAccount','includeAll','findAll','rows','show','params','include','find','catch','create','body','update','destroy','getConfigurations','findOne','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refresh_token','access_token','getFields','zone','clientSecret','serverUrl','code','host','zoho.eu','com','slice','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Zoho-oauthtoken\x20','response','Owner','Subject','Description','Call_Duration','Call_Result','Call_Start_Time','remove','includes','api_name','system_mandatory','push','custom_field','data_type','picklist','pick_list_values','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','error','stack'];(function(_0x47d5dc,_0x89f6a9){var _0x1fa10a=function(_0x2e7729){while(--_0x2e7729){_0x47d5dc['push'](_0x47d5dc['shift']());}};_0x1fa10a(++_0x89f6a9);}(_0x9145,0x158));var _0x5914=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9145[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x5914('0x0'));var rimraf=require(_0x5914('0x1'));var zipdir=require(_0x5914('0x2'));var jsonpatch=require(_0x5914('0x3'));var rp=require(_0x5914('0x4'));var moment=require(_0x5914('0x5'));var BPromise=require(_0x5914('0x6'));var Mustache=require(_0x5914('0x7'));var util=require(_0x5914('0x8'));var path=require('path');var sox=require(_0x5914('0x9'));var csv=require(_0x5914('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5914('0xb'));var _=require('lodash');var squel=require(_0x5914('0xc'));var crypto=require(_0x5914('0xd'));var jsforce=require(_0x5914('0xe'));var deskjs=require(_0x5914('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5914('0x10'));var Papa=require(_0x5914('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5914('0x12'));var hardwareService=require(_0x5914('0x13'));var logger=require(_0x5914('0x14'))('api');var utils=require(_0x5914('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5914('0x16'));var db=require(_0x5914('0x17'))['db'];var integrations=require(_0x5914('0x18'));function respondWithStatusCode(_0x441ecc,_0x55ea05){_0x55ea05=_0x55ea05||0xcc;return function(_0x4f95d){if(_0x4f95d){return _0x441ecc[_0x5914('0x19')](_0x55ea05);}return _0x441ecc[_0x5914('0x1a')](_0x55ea05)[_0x5914('0x1b')]();};}function respondWithResult(_0x4a9116,_0x327393){_0x327393=_0x327393||0xc8;return function(_0x458952){if(_0x458952){return _0x4a9116[_0x5914('0x1a')](_0x327393)[_0x5914('0x1c')](_0x458952);}};}function respondWithFilteredResult(_0x12f715,_0x52c3a7){return function(_0x163f3b){if(_0x163f3b){var _0x4c0df6=typeof _0x52c3a7[_0x5914('0x1d')]===_0x5914('0x1e')&&typeof _0x52c3a7['limit']===_0x5914('0x1e');var _0x49df2f=_0x163f3b[_0x5914('0x1f')];var _0x16a628=_0x4c0df6?0x0:_0x52c3a7[_0x5914('0x1d')];var _0x2aeb31=_0x4c0df6?_0x163f3b[_0x5914('0x1f')]:_0x52c3a7['offset']+_0x52c3a7['limit'];var _0x5df32e;if(_0x2aeb31>=_0x49df2f){_0x2aeb31=_0x49df2f;_0x5df32e=0xc8;}else{_0x5df32e=0xce;}_0x12f715[_0x5914('0x1a')](_0x5df32e);return _0x12f715[_0x5914('0x20')](_0x5914('0x21'),_0x16a628+'-'+_0x2aeb31+'/'+_0x49df2f)[_0x5914('0x1c')](_0x163f3b);}return null;};}function patchUpdates(_0x4e3c3f){return function(_0x3a03d0){try{jsonpatch[_0x5914('0x22')](_0x3a03d0,_0x4e3c3f,!![]);}catch(_0x1a43a4){return BPromise[_0x5914('0x23')](_0x1a43a4);}return _0x3a03d0[_0x5914('0x24')]();};}function saveUpdates(_0x4c572d,_0x4043fe){return function(_0xc35583){if(_0xc35583){return _0xc35583['update'](_0x4c572d)['then'](function(_0x26efff){return _0x26efff;});}return null;};}function removeEntity(_0x5dac8f,_0x50eb81){return function(_0xecba9e){if(_0xecba9e){return _0xecba9e['destroy']()[_0x5914('0x25')](function(){_0x5dac8f[_0x5914('0x1a')](0xcc)[_0x5914('0x1b')]();});}};}function handleEntityNotFound(_0x567bb8,_0x479615){return function(_0x140179){if(!_0x140179){_0x567bb8[_0x5914('0x19')](0x194);}return _0x140179;};}function handleError(_0x302e8c,_0x589707){_0x589707=_0x589707||0x1f4;return function(_0x89581d){logger[_0x5914('0x26')](_0x89581d[_0x5914('0x27')]);if(_0x89581d[_0x5914('0x28')]){delete _0x89581d[_0x5914('0x28')];}_0x302e8c[_0x5914('0x1a')](_0x589707)[_0x5914('0x29')](_0x89581d);};}exports[_0x5914('0x2a')]=function(_0x243ac0,_0x312669){var _0x5c72a0={},_0x58973e={},_0x488a0b={'count':0x0,'rows':[]};var _0x4b77bf=_[_0x5914('0x2b')](db['ZohoAccount'][_0x5914('0x2c')],function(_0x60d573){return{'name':_0x60d573['fieldName'],'type':_0x60d573[_0x5914('0x2d')]['key']};});_0x58973e[_0x5914('0x2e')]=_[_0x5914('0x2b')](_0x4b77bf,_0x5914('0x28'));_0x58973e[_0x5914('0x2f')]=_[_0x5914('0x30')](_0x243ac0['query']);_0x58973e['filters']=_[_0x5914('0x31')](_0x58973e[_0x5914('0x2e')],_0x58973e[_0x5914('0x2f')]);_0x5c72a0[_0x5914('0x32')]=_[_0x5914('0x31')](_0x58973e[_0x5914('0x2e')],qs[_0x5914('0x33')](_0x243ac0[_0x5914('0x2f')][_0x5914('0x33')]));_0x5c72a0[_0x5914('0x32')]=_0x5c72a0['attributes'][_0x5914('0x34')]?_0x5c72a0[_0x5914('0x32')]:_0x58973e[_0x5914('0x2e')];if(!_0x243ac0[_0x5914('0x2f')][_0x5914('0x35')]('nolimit')){_0x5c72a0[_0x5914('0x36')]=qs[_0x5914('0x36')](_0x243ac0[_0x5914('0x2f')][_0x5914('0x36')]);_0x5c72a0[_0x5914('0x1d')]=qs['offset'](_0x243ac0['query'][_0x5914('0x1d')]);}_0x5c72a0['order']=qs[_0x5914('0x37')](_0x243ac0['query'][_0x5914('0x37')]);_0x5c72a0[_0x5914('0x38')]=qs[_0x5914('0x39')](_[_0x5914('0x3a')](_0x243ac0[_0x5914('0x2f')],_0x58973e[_0x5914('0x39')]),_0x4b77bf);if(_0x243ac0[_0x5914('0x2f')][_0x5914('0x3b')]){_0x5c72a0[_0x5914('0x38')]=_[_0x5914('0x3c')](_0x5c72a0[_0x5914('0x38')],{'$or':_['map'](_0x4b77bf,function(_0x52ba0e){if(_0x52ba0e['type']!==_0x5914('0x3d')){var _0x49101b={};_0x49101b[_0x52ba0e[_0x5914('0x28')]]={'$like':'%'+_0x243ac0[_0x5914('0x2f')][_0x5914('0x3b')]+'%'};return _0x49101b;}})});}_0x5c72a0=_[_0x5914('0x3c')]({},_0x5c72a0,_0x243ac0[_0x5914('0x3e')]);var _0x1ceafb={'where':_0x5c72a0[_0x5914('0x38')]};return db[_0x5914('0x3f')]['count'](_0x1ceafb)[_0x5914('0x25')](function(_0x112d7c){_0x488a0b[_0x5914('0x1f')]=_0x112d7c;if(_0x243ac0[_0x5914('0x2f')][_0x5914('0x40')]){_0x5c72a0['include']=[{'all':!![]}];}return db[_0x5914('0x3f')][_0x5914('0x41')](_0x5c72a0);})[_0x5914('0x25')](function(_0xb1eabf){_0x488a0b[_0x5914('0x42')]=_0xb1eabf;return _0x488a0b;})[_0x5914('0x25')](respondWithFilteredResult(_0x312669,_0x5c72a0))['catch'](handleError(_0x312669,null));};exports[_0x5914('0x43')]=function(_0x35ea30,_0x530463){var _0x1efcf7={'raw':![],'where':{'id':_0x35ea30[_0x5914('0x44')]['id']}},_0x49c98e={};_0x49c98e[_0x5914('0x2e')]=_[_0x5914('0x30')](db[_0x5914('0x3f')][_0x5914('0x2c')]);_0x49c98e[_0x5914('0x2f')]=_[_0x5914('0x30')](_0x35ea30[_0x5914('0x2f')]);_0x49c98e[_0x5914('0x39')]=_[_0x5914('0x31')](_0x49c98e['model'],_0x49c98e[_0x5914('0x2f')]);_0x1efcf7[_0x5914('0x32')]=_[_0x5914('0x31')](_0x49c98e[_0x5914('0x2e')],qs['fields'](_0x35ea30[_0x5914('0x2f')]['fields']));_0x1efcf7[_0x5914('0x32')]=_0x1efcf7[_0x5914('0x32')][_0x5914('0x34')]?_0x1efcf7[_0x5914('0x32')]:_0x49c98e[_0x5914('0x2e')];if(_0x35ea30['query'][_0x5914('0x40')]){_0x1efcf7[_0x5914('0x45')]=[{'all':!![]}];}_0x1efcf7=_[_0x5914('0x3c')]({},_0x1efcf7,_0x35ea30[_0x5914('0x3e')]);return db['ZohoAccount'][_0x5914('0x46')](_0x1efcf7)[_0x5914('0x25')](handleEntityNotFound(_0x530463,null))['then'](respondWithResult(_0x530463,null))[_0x5914('0x47')](handleError(_0x530463,null));};exports[_0x5914('0x48')]=function(_0x5118ae,_0x447b8c){return db[_0x5914('0x3f')][_0x5914('0x48')](_0x5118ae[_0x5914('0x49')],{})['then'](respondWithResult(_0x447b8c,0xc9))[_0x5914('0x47')](handleError(_0x447b8c,null));};exports[_0x5914('0x4a')]=function(_0x8c4910,_0x45fd51){if(_0x8c4910[_0x5914('0x49')]['id']){delete _0x8c4910[_0x5914('0x49')]['id'];}return db[_0x5914('0x3f')][_0x5914('0x46')]({'where':{'id':_0x8c4910['params']['id']}})['then'](handleEntityNotFound(_0x45fd51,null))[_0x5914('0x25')](saveUpdates(_0x8c4910[_0x5914('0x49')],null))[_0x5914('0x25')](respondWithResult(_0x45fd51,null))['catch'](handleError(_0x45fd51,null));};exports[_0x5914('0x4b')]=function(_0x2fa98a,_0x3fcde2){return db[_0x5914('0x3f')]['find']({'where':{'id':_0x2fa98a['params']['id']}})[_0x5914('0x25')](handleEntityNotFound(_0x3fcde2,null))[_0x5914('0x25')](removeEntity(_0x3fcde2,null))[_0x5914('0x47')](handleError(_0x3fcde2,null));};exports[_0x5914('0x4c')]=function(_0x45eae7,_0x41978b,_0x2f3282){var _0x3025c1={};var _0x94e0e0={};var _0x4085f1;var _0x29f7db;return db[_0x5914('0x3f')][_0x5914('0x4d')]({'where':{'id':_0x45eae7[_0x5914('0x44')]['id']}})['then'](handleEntityNotFound(_0x41978b,null))[_0x5914('0x25')](function(_0x5662be){if(_0x5662be){_0x4085f1=_0x5662be;_0x94e0e0[_0x5914('0x2e')]=_[_0x5914('0x30')](db['ZohoConfiguration'][_0x5914('0x2c')]);_0x94e0e0['query']=_[_0x5914('0x30')](_0x45eae7[_0x5914('0x2f')]);_0x94e0e0['filters']=_[_0x5914('0x31')](_0x94e0e0[_0x5914('0x2e')],_0x94e0e0[_0x5914('0x2f')]);_0x3025c1[_0x5914('0x32')]=_[_0x5914('0x31')](_0x94e0e0[_0x5914('0x2e')],qs[_0x5914('0x33')](_0x45eae7['query']['fields']));_0x3025c1[_0x5914('0x32')]=_0x3025c1[_0x5914('0x32')][_0x5914('0x34')]?_0x3025c1[_0x5914('0x32')]:_0x94e0e0[_0x5914('0x2e')];_0x3025c1['order']=qs[_0x5914('0x37')](_0x45eae7[_0x5914('0x2f')][_0x5914('0x37')]);_0x3025c1['where']=qs[_0x5914('0x39')](_['pick'](_0x45eae7[_0x5914('0x2f')],_0x94e0e0[_0x5914('0x39')]));if(_0x45eae7['query'][_0x5914('0x3b')]){_0x3025c1['where']=_[_0x5914('0x3c')](_0x3025c1[_0x5914('0x38')],{'$or':_[_0x5914('0x2b')](_0x3025c1[_0x5914('0x32')],function(_0x536370){var _0x18dcd3={};_0x18dcd3[_0x536370]={'$like':'%'+_0x45eae7['query'][_0x5914('0x3b')]+'%'};return _0x18dcd3;})});}_0x3025c1=_[_0x5914('0x3c')]({},_0x3025c1,_0x45eae7['options']);return _0x4085f1[_0x5914('0x4c')](_0x3025c1);}})['then'](function(_0x1914d2){if(_0x1914d2){_0x29f7db=_0x1914d2[_0x5914('0x34')];if(!_0x45eae7[_0x5914('0x2f')][_0x5914('0x35')](_0x5914('0x4e'))){_0x3025c1[_0x5914('0x36')]=qs['limit'](_0x45eae7['query']['limit']);_0x3025c1['offset']=qs[_0x5914('0x1d')](_0x45eae7['query'][_0x5914('0x1d')]);}return _0x4085f1[_0x5914('0x4c')](_0x3025c1);}})[_0x5914('0x25')](function(_0x5b88e8){if(_0x5b88e8){return _0x5b88e8?{'count':_0x29f7db,'rows':_0x5b88e8}:null;}})[_0x5914('0x25')](respondWithResult(_0x41978b,null))[_0x5914('0x47')](handleError(_0x41978b,null));};exports[_0x5914('0x4f')]=function(_0xdfef51,_0x308eed,_0x251829){if(_0xdfef51[_0x5914('0x49')]['id']){delete _0xdfef51[_0x5914('0x49')]['id'];}return db[_0x5914('0x3f')][_0x5914('0x4d')]({'where':{'id':_0xdfef51[_0x5914('0x44')]['id']}})[_0x5914('0x25')](handleEntityNotFound(_0x308eed,null))['then'](function(_0x545268){if(_0x545268){_0xdfef51['body'][_0x5914('0x50')]=_0x545268['id'];_0xdfef51[_0x5914('0x49')][_0x5914('0x51')]=integrations[_0x5914('0x52')](_0xdfef51[_0x5914('0x49')][_0x5914('0x53')],_0xdfef51[_0x5914('0x49')][_0x5914('0x2d')]);_0xdfef51[_0x5914('0x49')][_0x5914('0x54')]=integrations[_0x5914('0x55')](_0xdfef51[_0x5914('0x49')][_0x5914('0x53')],_0xdfef51[_0x5914('0x49')]['type']);return db['ZohoConfiguration'][_0x5914('0x48')](_0xdfef51['body'],{'include':[{'model':db['ZohoField'],'as':_0x5914('0x51')},{'model':db[_0x5914('0x56')],'as':_0x5914('0x54')}]});}return null;})[_0x5914('0x25')](respondWithResult(_0x308eed,null))[_0x5914('0x47')](handleError(_0x308eed,null));};function getAccessToken(_0x4bb7ef){return new Promise(function(_0x1c7dfd,_0xe28c57){var _0xd2a171;switch(_0x4bb7ef['zone']){case'US':_0xd2a171='https://accounts.zoho.com';break;case'AU':_0xd2a171=_0x5914('0x57');break;case'EU':_0xd2a171=_0x5914('0x58');break;case'IN':_0xd2a171=_0x5914('0x59');break;case'CN':_0xd2a171=_0x5914('0x5a');break;default:_0xd2a171=_0x5914('0x58');break;}var _0x2b9d4a={'method':_0x5914('0x5b'),'uri':_0xd2a171+_0x5914('0x5c'),'qs':{'refresh_token':_0x4bb7ef['refreshToken'],'client_id':_0x4bb7ef['clientId'],'client_secret':_0x4bb7ef['clientSecret'],'grant_type':_0x5914('0x5d')},'json':!![]};return rp(_0x2b9d4a)[_0x5914('0x25')](function(_0x26d82f){if(_0x26d82f[_0x5914('0x5e')]){_0x1c7dfd(_0x26d82f[_0x5914('0x5e')]);}else{_0xe28c57('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x5914('0x47')](function(_0x2a5e98){_0xe28c57(_0x2a5e98);});});}exports[_0x5914('0x5f')]=function(_0x5a0fb1,_0x45190e,_0xae9b80){var _0x24843d,_0x1ff9eb,_0x881bac,_0x1224fb,_0x24a925;return db[_0x5914('0x3f')][_0x5914('0x4d')]({'where':{'id':_0x5a0fb1[_0x5914('0x44')]['id']},'attributes':['id','host',_0x5914('0x60'),'clientId',_0x5914('0x61'),_0x5914('0x62'),_0x5914('0x63'),'refreshToken']})[_0x5914('0x25')](handleEntityNotFound(_0x45190e,null))['then'](function(_0x531bb6){_0x24a925=_0x531bb6;_0x24843d=_0x24a925[_0x5914('0x64')];_0x1ff9eb=_0x24843d===_0x5914('0x65')?'eu':_0x5914('0x66');_0x881bac=_0x24a925[_0x5914('0x62')];var _0x58c4f8=_0x881bac[_0x5914('0x67')](-0x1);if(_0x58c4f8==='/'||_0x58c4f8==='\x5c'||_0x58c4f8===':'){_0x881bac=_0x881bac['substring'](0x0,_0x881bac['lastIndexOf'](_0x58c4f8));}if(!_0x24a925['refreshToken']){throw new Error(_0x5914('0x68'));}return getAccessToken(_0x24a925);})[_0x5914('0x25')](function(_0x522d90){if(_0x522d90){return rp({'method':_0x5914('0x69'),'uri':util[_0x5914('0x6a')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x1ff9eb),'qs':{'module':'Calls'},'headers':{'Authorization':_0x5914('0x6b')+_0x522d90},'json':!![]});}})[_0x5914('0x25')](function(_0x5cae10){if(_0x5cae10){if(_0x5cae10[_0x5914('0x6c')]&&_0x5cae10[_0x5914('0x6c')]['error']){throw new Error(_0x5cae10['response']['error']['message']);}var _0x2af85c=[];var _0x103199=[];var _0x484fce=[_0x5914('0x6d'),_0x5914('0x6e'),_0x5914('0x6f'),'WhoId',_0x5914('0x70'),_0x5914('0x71'),_0x5914('0x72'),'Call_Type'];_0x103199=_[_0x5914('0x73')](_0x5cae10[_0x5914('0x33')],function(_0x79d406){return _0x484fce[_0x5914('0x74')](_0x79d406[_0x5914('0x75')]);});for(var _0x4749f3=0x0;_0x4749f3<_0x103199['length'];_0x4749f3++){if(_0x103199[_0x4749f3][_0x5914('0x76')]===![]){_0x2af85c[_0x5914('0x77')]({'id':_0x103199[_0x4749f3]['id'],'name':_0x103199[_0x4749f3]['display_label'],'custom':_0x103199[_0x4749f3][_0x5914('0x78')],'options':_0x103199[_0x4749f3][_0x5914('0x79')]===_0x5914('0x7a')&&_0x103199[_0x4749f3][_0x5914('0x7b')][_0x5914('0x34')]>-0x1?_[_0x5914('0x2b')](_0x103199[_0x4749f3]['pick_list_values'],function(_0x59f262){return{'name':_0x59f262,'value':_0x59f262};}):[]});}}return{'count':_0x2af85c['length'],'rows':_0x2af85c};}else{return{'count':0x0,'rows':[]};}})[_0x5914('0x25')](respondWithResult(_0x45190e,null))['catch'](function(_0x4d9847){var _0x19c54f=_0x5a0fb1['query']['test']?0x1f4:_0x4d9847['statusCode']||0x1f4;logger[_0x5914('0x26')](_0x5914('0x7c'),_0x5914('0x5f'),_0x19c54f,JSON[_0x5914('0x7d')](_0x4d9847));delete _0x4d9847[_0x5914('0x28')];if(_0x19c54f===0x191){_0x19c54f=0x190;}_0x45190e[_0x5914('0x1a')](_0x19c54f)['send'](_0x5a0fb1[_0x5914('0x2f')][_0x5914('0x7e')]?{'message':_0x5914('0x7f'),'statusCode':_0x4d9847['statusCode']}:_0x4d9847);});}; \ No newline at end of file +var _0x2274=['slice','substring','lastIndexOf','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Description','WhoId','Call_Result','includes','api_name','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','ZohoAccount','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','includeAll','include','findAll','catch','show','rawAttributes','keys','find','create','body','params','destroy','getConfigurations','findOne','addConfiguration','Subjects','getSubjects','channel','Descriptions','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','serverUrl','code','zoho.eu','com'];(function(_0x4aa4a5,_0x2504df){var _0x2784bf=function(_0x359691){while(--_0x359691){_0x4aa4a5['push'](_0x4aa4a5['shift']());}};_0x2784bf(++_0x2504df);}(_0x2274,0x9f));var _0x4227=function(_0x2b1781,_0x56f47f){_0x2b1781=_0x2b1781-0x0;var _0x474335=_0x2274[_0x2b1781];return _0x474335;};'use strict';var emlformat=require(_0x4227('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4227('0x1'));var rp=require(_0x4227('0x2'));var moment=require(_0x4227('0x3'));var BPromise=require(_0x4227('0x4'));var Mustache=require(_0x4227('0x5'));var util=require(_0x4227('0x6'));var path=require(_0x4227('0x7'));var sox=require(_0x4227('0x8'));var csv=require(_0x4227('0x9'));var ejs=require(_0x4227('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4227('0xb'));var squel=require(_0x4227('0xc'));var crypto=require(_0x4227('0xd'));var jsforce=require(_0x4227('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4227('0x9'));var querystring=require(_0x4227('0xf'));var Papa=require(_0x4227('0x10'));var Redis=require(_0x4227('0x11'));var authService=require(_0x4227('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4227('0x13'));var hardwareService=require(_0x4227('0x14'));var logger=require('../../config/logger')(_0x4227('0x15'));var utils=require(_0x4227('0x16'));var config=require(_0x4227('0x17'));var licenseUtil=require(_0x4227('0x18'));var db=require(_0x4227('0x19'))['db'];var integrations=require(_0x4227('0x1a'));function respondWithStatusCode(_0x11f51b,_0x2d8f49){_0x2d8f49=_0x2d8f49||0xcc;return function(_0x543ea6){if(_0x543ea6){return _0x11f51b[_0x4227('0x1b')](_0x2d8f49);}return _0x11f51b['status'](_0x2d8f49)[_0x4227('0x1c')]();};}function respondWithResult(_0x2a4f78,_0x5aaae8){_0x5aaae8=_0x5aaae8||0xc8;return function(_0xd75943){if(_0xd75943){return _0x2a4f78[_0x4227('0x1d')](_0x5aaae8)[_0x4227('0x1e')](_0xd75943);}};}function respondWithFilteredResult(_0x18d4e0,_0x3bc6e2){return function(_0x24bc9a){if(_0x24bc9a){var _0x1404b6=typeof _0x3bc6e2[_0x4227('0x1f')]===_0x4227('0x20')&&typeof _0x3bc6e2[_0x4227('0x21')]===_0x4227('0x20');var _0x40c631=_0x24bc9a[_0x4227('0x22')];var _0x3e5ac4=_0x1404b6?0x0:_0x3bc6e2[_0x4227('0x1f')];var _0x35918e=_0x1404b6?_0x24bc9a[_0x4227('0x22')]:_0x3bc6e2[_0x4227('0x1f')]+_0x3bc6e2[_0x4227('0x21')];var _0x14249e;if(_0x35918e>=_0x40c631){_0x35918e=_0x40c631;_0x14249e=0xc8;}else{_0x14249e=0xce;}_0x18d4e0['status'](_0x14249e);return _0x18d4e0[_0x4227('0x23')](_0x4227('0x24'),_0x3e5ac4+'-'+_0x35918e+'/'+_0x40c631)['json'](_0x24bc9a);}return null;};}function patchUpdates(_0x4231ab){return function(_0x5f46cd){try{jsonpatch[_0x4227('0x25')](_0x5f46cd,_0x4231ab,!![]);}catch(_0x30515a){return BPromise[_0x4227('0x26')](_0x30515a);}return _0x5f46cd[_0x4227('0x27')]();};}function saveUpdates(_0x315fcb,_0x18c66c){return function(_0x9ac2cc){if(_0x9ac2cc){return _0x9ac2cc[_0x4227('0x28')](_0x315fcb)[_0x4227('0x29')](function(_0x27676e){return _0x27676e;});}return null;};}function removeEntity(_0x103eee,_0x57f964){return function(_0x3046e7){if(_0x3046e7){return _0x3046e7['destroy']()[_0x4227('0x29')](function(){_0x103eee[_0x4227('0x1d')](0xcc)[_0x4227('0x1c')]();});}};}function handleEntityNotFound(_0x122aa4,_0x53f67e){return function(_0x36bd9f){if(!_0x36bd9f){_0x122aa4[_0x4227('0x1b')](0x194);}return _0x36bd9f;};}function handleError(_0x1bea20,_0x472f00){_0x472f00=_0x472f00||0x1f4;return function(_0x1fe896){logger[_0x4227('0x2a')](_0x1fe896[_0x4227('0x2b')]);if(_0x1fe896[_0x4227('0x2c')]){delete _0x1fe896[_0x4227('0x2c')];}_0x1bea20[_0x4227('0x1d')](_0x472f00)[_0x4227('0x2d')](_0x1fe896);};}exports[_0x4227('0x2e')]=function(_0x2d822a,_0x147a03){var _0xa734d2={},_0x5d782a={},_0x861896={'count':0x0,'rows':[]};var _0x1b3986=_[_0x4227('0x2f')](db[_0x4227('0x30')]['rawAttributes'],function(_0x5892a8){return{'name':_0x5892a8[_0x4227('0x31')],'type':_0x5892a8[_0x4227('0x32')][_0x4227('0x33')]};});_0x5d782a[_0x4227('0x34')]=_['map'](_0x1b3986,_0x4227('0x2c'));_0x5d782a[_0x4227('0x35')]=_['keys'](_0x2d822a[_0x4227('0x35')]);_0x5d782a[_0x4227('0x36')]=_[_0x4227('0x37')](_0x5d782a[_0x4227('0x34')],_0x5d782a[_0x4227('0x35')]);_0xa734d2['attributes']=_['intersection'](_0x5d782a[_0x4227('0x34')],qs[_0x4227('0x38')](_0x2d822a['query'][_0x4227('0x38')]));_0xa734d2[_0x4227('0x39')]=_0xa734d2['attributes'][_0x4227('0x3a')]?_0xa734d2[_0x4227('0x39')]:_0x5d782a[_0x4227('0x34')];if(!_0x2d822a[_0x4227('0x35')][_0x4227('0x3b')](_0x4227('0x3c'))){_0xa734d2[_0x4227('0x21')]=qs[_0x4227('0x21')](_0x2d822a[_0x4227('0x35')]['limit']);_0xa734d2[_0x4227('0x1f')]=qs[_0x4227('0x1f')](_0x2d822a['query'][_0x4227('0x1f')]);}_0xa734d2[_0x4227('0x3d')]=qs[_0x4227('0x3e')](_0x2d822a['query']['sort']);_0xa734d2['where']=qs[_0x4227('0x36')](_[_0x4227('0x3f')](_0x2d822a[_0x4227('0x35')],_0x5d782a[_0x4227('0x36')]),_0x1b3986);if(_0x2d822a['query'][_0x4227('0x40')]){_0xa734d2['where']=_[_0x4227('0x41')](_0xa734d2[_0x4227('0x42')],{'$or':_['map'](_0x1b3986,function(_0x3f06c7){if(_0x3f06c7[_0x4227('0x32')]!=='VIRTUAL'){var _0x48eebb={};_0x48eebb[_0x3f06c7['name']]={'$like':'%'+_0x2d822a[_0x4227('0x35')][_0x4227('0x40')]+'%'};return _0x48eebb;}})});}_0xa734d2=_[_0x4227('0x41')]({},_0xa734d2,_0x2d822a[_0x4227('0x43')]);var _0x2111f9={'where':_0xa734d2[_0x4227('0x42')]};return db[_0x4227('0x30')]['count'](_0x2111f9)['then'](function(_0xaa6973){_0x861896['count']=_0xaa6973;if(_0x2d822a['query'][_0x4227('0x44')]){_0xa734d2[_0x4227('0x45')]=[{'all':!![]}];}return db['ZohoAccount'][_0x4227('0x46')](_0xa734d2);})[_0x4227('0x29')](function(_0xd8312a){_0x861896['rows']=_0xd8312a;return _0x861896;})[_0x4227('0x29')](respondWithFilteredResult(_0x147a03,_0xa734d2))[_0x4227('0x47')](handleError(_0x147a03,null));};exports[_0x4227('0x48')]=function(_0xcdc849,_0x6982ab){var _0x358b85={'raw':![],'where':{'id':_0xcdc849['params']['id']}},_0x4d40fb={};_0x4d40fb[_0x4227('0x34')]=_['keys'](db[_0x4227('0x30')][_0x4227('0x49')]);_0x4d40fb[_0x4227('0x35')]=_[_0x4227('0x4a')](_0xcdc849['query']);_0x4d40fb['filters']=_[_0x4227('0x37')](_0x4d40fb[_0x4227('0x34')],_0x4d40fb[_0x4227('0x35')]);_0x358b85['attributes']=_[_0x4227('0x37')](_0x4d40fb[_0x4227('0x34')],qs[_0x4227('0x38')](_0xcdc849[_0x4227('0x35')]['fields']));_0x358b85['attributes']=_0x358b85[_0x4227('0x39')]['length']?_0x358b85[_0x4227('0x39')]:_0x4d40fb[_0x4227('0x34')];if(_0xcdc849[_0x4227('0x35')][_0x4227('0x44')]){_0x358b85['include']=[{'all':!![]}];}_0x358b85=_['merge']({},_0x358b85,_0xcdc849[_0x4227('0x43')]);return db[_0x4227('0x30')][_0x4227('0x4b')](_0x358b85)[_0x4227('0x29')](handleEntityNotFound(_0x6982ab,null))['then'](respondWithResult(_0x6982ab,null))[_0x4227('0x47')](handleError(_0x6982ab,null));};exports['create']=function(_0x560c3f,_0x3afe6b){return db[_0x4227('0x30')][_0x4227('0x4c')](_0x560c3f['body'],{})[_0x4227('0x29')](respondWithResult(_0x3afe6b,0xc9))[_0x4227('0x47')](handleError(_0x3afe6b,null));};exports[_0x4227('0x28')]=function(_0x4c4da8,_0xf2a3e7){if(_0x4c4da8['body']['id']){delete _0x4c4da8[_0x4227('0x4d')]['id'];}return db[_0x4227('0x30')][_0x4227('0x4b')]({'where':{'id':_0x4c4da8[_0x4227('0x4e')]['id']}})[_0x4227('0x29')](handleEntityNotFound(_0xf2a3e7,null))[_0x4227('0x29')](saveUpdates(_0x4c4da8[_0x4227('0x4d')],null))[_0x4227('0x29')](respondWithResult(_0xf2a3e7,null))[_0x4227('0x47')](handleError(_0xf2a3e7,null));};exports[_0x4227('0x4f')]=function(_0x2d94df,_0x689ee2){return db[_0x4227('0x30')]['find']({'where':{'id':_0x2d94df['params']['id']}})[_0x4227('0x29')](handleEntityNotFound(_0x689ee2,null))[_0x4227('0x29')](removeEntity(_0x689ee2,null))[_0x4227('0x47')](handleError(_0x689ee2,null));};exports[_0x4227('0x50')]=function(_0x5b52d2,_0x302b33,_0x2352ca){var _0x2fbb39={};var _0x966a65={};var _0x24d22a;var _0x3ec048;return db[_0x4227('0x30')][_0x4227('0x51')]({'where':{'id':_0x5b52d2[_0x4227('0x4e')]['id']}})[_0x4227('0x29')](handleEntityNotFound(_0x302b33,null))[_0x4227('0x29')](function(_0x395cc9){if(_0x395cc9){_0x24d22a=_0x395cc9;_0x966a65[_0x4227('0x34')]=_['keys'](db['ZohoConfiguration'][_0x4227('0x49')]);_0x966a65[_0x4227('0x35')]=_['keys'](_0x5b52d2['query']);_0x966a65[_0x4227('0x36')]=_[_0x4227('0x37')](_0x966a65['model'],_0x966a65[_0x4227('0x35')]);_0x2fbb39[_0x4227('0x39')]=_[_0x4227('0x37')](_0x966a65[_0x4227('0x34')],qs[_0x4227('0x38')](_0x5b52d2['query'][_0x4227('0x38')]));_0x2fbb39[_0x4227('0x39')]=_0x2fbb39[_0x4227('0x39')]['length']?_0x2fbb39[_0x4227('0x39')]:_0x966a65[_0x4227('0x34')];_0x2fbb39[_0x4227('0x3d')]=qs['sort'](_0x5b52d2[_0x4227('0x35')][_0x4227('0x3e')]);_0x2fbb39[_0x4227('0x42')]=qs[_0x4227('0x36')](_[_0x4227('0x3f')](_0x5b52d2[_0x4227('0x35')],_0x966a65[_0x4227('0x36')]));if(_0x5b52d2['query']['filter']){_0x2fbb39[_0x4227('0x42')]=_['merge'](_0x2fbb39[_0x4227('0x42')],{'$or':_[_0x4227('0x2f')](_0x2fbb39[_0x4227('0x39')],function(_0x424ff0){var _0x1271c5={};_0x1271c5[_0x424ff0]={'$like':'%'+_0x5b52d2[_0x4227('0x35')]['filter']+'%'};return _0x1271c5;})});}_0x2fbb39=_['merge']({},_0x2fbb39,_0x5b52d2['options']);return _0x24d22a[_0x4227('0x50')](_0x2fbb39);}})[_0x4227('0x29')](function(_0x333ada){if(_0x333ada){_0x3ec048=_0x333ada['length'];if(!_0x5b52d2[_0x4227('0x35')][_0x4227('0x3b')](_0x4227('0x3c'))){_0x2fbb39['limit']=qs[_0x4227('0x21')](_0x5b52d2['query'][_0x4227('0x21')]);_0x2fbb39[_0x4227('0x1f')]=qs[_0x4227('0x1f')](_0x5b52d2[_0x4227('0x35')][_0x4227('0x1f')]);}return _0x24d22a['getConfigurations'](_0x2fbb39);}})['then'](function(_0x3a4fac){if(_0x3a4fac){return _0x3a4fac?{'count':_0x3ec048,'rows':_0x3a4fac}:null;}})['then'](respondWithResult(_0x302b33,null))[_0x4227('0x47')](handleError(_0x302b33,null));};exports[_0x4227('0x52')]=function(_0x4ec161,_0x4edde9,_0x3d6517){if(_0x4ec161['body']['id']){delete _0x4ec161['body']['id'];}return db[_0x4227('0x30')][_0x4227('0x51')]({'where':{'id':_0x4ec161[_0x4227('0x4e')]['id']}})[_0x4227('0x29')](handleEntityNotFound(_0x4edde9,null))[_0x4227('0x29')](function(_0x10e4bc){if(_0x10e4bc){_0x4ec161[_0x4227('0x4d')]['AccountId']=_0x10e4bc['id'];_0x4ec161[_0x4227('0x4d')][_0x4227('0x53')]=integrations[_0x4227('0x54')](_0x4ec161[_0x4227('0x4d')][_0x4227('0x55')],_0x4ec161[_0x4227('0x4d')][_0x4227('0x32')]);_0x4ec161[_0x4227('0x4d')][_0x4227('0x56')]=integrations['getDescriptions'](_0x4ec161[_0x4227('0x4d')][_0x4227('0x55')],_0x4ec161[_0x4227('0x4d')][_0x4227('0x32')]);return db[_0x4227('0x57')][_0x4227('0x4c')](_0x4ec161[_0x4227('0x4d')],{'include':[{'model':db[_0x4227('0x58')],'as':_0x4227('0x53')},{'model':db['ZohoField'],'as':_0x4227('0x56')}]});}return null;})[_0x4227('0x29')](respondWithResult(_0x4edde9,null))['catch'](handleError(_0x4edde9,null));};function getAccessToken(_0x563eb1){return new Promise(function(_0x4fd42d,_0x1e59f7){var _0x4f1d94;switch(_0x563eb1[_0x4227('0x59')]){case'US':_0x4f1d94='https://accounts.zoho.com';break;case'AU':_0x4f1d94='https://accounts.zoho.com.au';break;case'EU':_0x4f1d94='https://accounts.zoho.eu';break;case'IN':_0x4f1d94=_0x4227('0x5a');break;case'CN':_0x4f1d94=_0x4227('0x5b');break;default:_0x4f1d94=_0x4227('0x5c');break;}var _0x521bc8={'method':'POST','uri':_0x4f1d94+_0x4227('0x5d'),'qs':{'refresh_token':_0x563eb1[_0x4227('0x5e')],'client_id':_0x563eb1[_0x4227('0x5f')],'client_secret':_0x563eb1[_0x4227('0x60')],'grant_type':_0x4227('0x61')},'json':!![]};return rp(_0x521bc8)[_0x4227('0x29')](function(_0x2a2234){if(_0x2a2234[_0x4227('0x62')]){_0x4fd42d(_0x2a2234[_0x4227('0x62')]);}else{_0x1e59f7(_0x4227('0x63'));}})[_0x4227('0x47')](function(_0x1bf354){_0x1e59f7(_0x1bf354);});});}exports['getFields']=function(_0x6c5534,_0x588da6,_0x2140f4){var _0x1e8178,_0x232e1f,_0x5cc1fc,_0x2dcfae,_0x58eed3;return db['ZohoAccount'][_0x4227('0x51')]({'where':{'id':_0x6c5534['params']['id']},'attributes':['id',_0x4227('0x64'),'zone',_0x4227('0x5f'),_0x4227('0x60'),_0x4227('0x65'),_0x4227('0x66'),_0x4227('0x5e')]})[_0x4227('0x29')](handleEntityNotFound(_0x588da6,null))[_0x4227('0x29')](function(_0x411bd0){_0x58eed3=_0x411bd0;_0x1e8178=_0x58eed3['host'];_0x232e1f=_0x1e8178===_0x4227('0x67')?'eu':_0x4227('0x68');_0x5cc1fc=_0x58eed3[_0x4227('0x65')];var _0x1224f5=_0x5cc1fc[_0x4227('0x69')](-0x1);if(_0x1224f5==='/'||_0x1224f5==='\x5c'||_0x1224f5===':'){_0x5cc1fc=_0x5cc1fc[_0x4227('0x6a')](0x0,_0x5cc1fc[_0x4227('0x6b')](_0x1224f5));}if(!_0x58eed3[_0x4227('0x5e')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x58eed3);})[_0x4227('0x29')](function(_0x4ad027){if(_0x4ad027){return rp({'method':_0x4227('0x6c'),'uri':util['format'](_0x4227('0x6d'),_0x232e1f),'qs':{'module':_0x4227('0x6e')},'headers':{'Authorization':_0x4227('0x6f')+_0x4ad027},'json':!![]});}})['then'](function(_0x279bd8){if(_0x279bd8){if(_0x279bd8['response']&&_0x279bd8[_0x4227('0x70')]['error']){throw new Error(_0x279bd8[_0x4227('0x70')][_0x4227('0x2a')][_0x4227('0x71')]);}var _0x8b1ab7=[];var _0x4b7847=[];var _0x11b6fc=[_0x4227('0x72'),'Subject',_0x4227('0x73'),_0x4227('0x74'),'Call_Duration',_0x4227('0x75'),'Call_Start_Time','Call_Type'];_0x4b7847=_['remove'](_0x279bd8[_0x4227('0x38')],function(_0x128caf){return _0x11b6fc[_0x4227('0x76')](_0x128caf[_0x4227('0x77')]);});for(var _0x243c76=0x0;_0x243c76<_0x4b7847[_0x4227('0x3a')];_0x243c76++){if(_0x4b7847[_0x243c76]['system_mandatory']===![]){_0x8b1ab7[_0x4227('0x78')]({'id':_0x4b7847[_0x243c76]['id'],'name':_0x4b7847[_0x243c76][_0x4227('0x79')],'custom':_0x4b7847[_0x243c76][_0x4227('0x7a')],'options':_0x4b7847[_0x243c76][_0x4227('0x7b')]===_0x4227('0x7c')&&_0x4b7847[_0x243c76][_0x4227('0x7d')]['length']>-0x1?_[_0x4227('0x2f')](_0x4b7847[_0x243c76][_0x4227('0x7d')],function(_0x2d4fbc){return{'name':_0x2d4fbc,'value':_0x2d4fbc};}):[]});}}return{'count':_0x8b1ab7[_0x4227('0x3a')],'rows':_0x8b1ab7};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x588da6,null))[_0x4227('0x47')](function(_0x17e039){var _0x502815=_0x6c5534[_0x4227('0x35')][_0x4227('0x7e')]?0x1f4:_0x17e039[_0x4227('0x7f')]||0x1f4;logger['error'](_0x4227('0x80'),_0x4227('0x81'),_0x502815,JSON[_0x4227('0x82')](_0x17e039));delete _0x17e039[_0x4227('0x2c')];if(_0x502815===0x191){_0x502815=0x190;}_0x588da6['status'](_0x502815)[_0x4227('0x2d')](_0x6c5534[_0x4227('0x35')][_0x4227('0x7e')]?{'message':_0x4227('0x83'),'statusCode':_0x17e039[_0x4227('0x7f')]}:_0x17e039);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 3677aa4..8b962a5 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 _0xb03c=['request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientSecret','code','host','slice','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId','application/x-www-form-urlencoded','refresh_token','refreshToken','info','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','substring','lastIndexOf','authorization_code','then','parse','format','util','../../config/logger'];(function(_0x54ffd9,_0x253d65){var _0x1f0ec1=function(_0x2e04ba){while(--_0x2e04ba){_0x54ffd9['push'](_0x54ffd9['shift']());}};_0x1f0ec1(++_0x253d65);}(_0xb03c,0x198));var _0xcb03=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0xb03c[_0x2261ce];return _0x524640;};'use strict';var _=require('lodash');var util=require(_0xcb03('0x0'));var logger=require(_0xcb03('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcb03('0x2'));var fs=require('fs');var path=require(_0xcb03('0x3'));var rimraf=require(_0xcb03('0x4'));var config=require(_0xcb03('0x5'));var attributes=require(_0xcb03('0x6'));var integrations=require(_0xcb03('0x7'));module['exports']=function(_0x327a07,_0x465b20){return _0x327a07['define'](_0xcb03('0x8'),attributes,{'tableName':_0xcb03('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5d5e48,_0x2d6ceb,_0x2288eb){if(_0x5d5e48[_0xcb03('0xa')](_0xcb03('0xb'))||_0x5d5e48['changed'](_0xcb03('0xc'))||_0x5d5e48[_0xcb03('0xa')]('clientId')||_0x5d5e48[_0xcb03('0xa')](_0xcb03('0xd'))||_0x5d5e48[_0xcb03('0xa')](_0xcb03('0xe'))||_0x5d5e48['changed'](_0xcb03('0xf'))){var _0x3febf7,_0xa44f00;_0x3febf7=_0x5d5e48[_0xcb03('0xc')];var _0x275a31=_0x3febf7[_0xcb03('0x10')](-0x1);if(_0x275a31==='/'||_0x275a31==='\x5c'||_0x275a31===':'){_0x3febf7=_0x3febf7['substring'](0x0,_0x3febf7['lastIndexOf'](_0x275a31));}switch(_0x5d5e48[_0xcb03('0xb')]){case'US':_0xa44f00=_0xcb03('0x11');break;case'AU':_0xa44f00=_0xcb03('0x12');break;case'IN':_0xa44f00=_0xcb03('0x13');break;case'CN':_0xa44f00=_0xcb03('0x14');break;default:_0xa44f00=_0xcb03('0x15');break;}var _0xdadc0e={'method':_0xcb03('0x16'),'uri':_0xa44f00+_0xcb03('0x17'),'form':{'grant_type':'authorization_code','client_id':_0x5d5e48[_0xcb03('0x18')],'client_secret':_0x5d5e48[_0xcb03('0xd')],'redirect_uri':_0x5d5e48[_0xcb03('0xc')],'code':_0x5d5e48[_0xcb03('0xe')]},'headers':{'Content-Type':_0xcb03('0x19')}};return rp(_0xdadc0e)['then'](function(_0x2e055d){var _0x19cf0f=JSON['parse'](_0x2e055d);if(_0x19cf0f[_0xcb03('0x1a')]){_0x5d5e48[_0xcb03('0x1b')]=_0x19cf0f[_0xcb03('0x1a')];logger[_0xcb03('0x1c')](util['format'](_0xcb03('0x1d'),_0x5d5e48[_0xcb03('0x1e')],_0x5d5e48['id']));}else{logger[_0xcb03('0x1f')](util['format'](_0xcb03('0x20'),_0x5d5e48[_0xcb03('0x1e')],_0x5d5e48['id']),util[_0xcb03('0x21')](_0x19cf0f,{'showHidden':![],'depth':null}));}return _0x2288eb(null,_0x2d6ceb);})[_0xcb03('0x22')](function(_0x7f58e7){logger['error'](util['format'](_0xcb03('0x20'),_0x5d5e48[_0xcb03('0x1e')],_0x5d5e48['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x2288eb(_0x7f58e7);});}else{return _0x2288eb(null,_0x2d6ceb);}},'beforeUpdate':function(_0x38d8d9,_0x564743,_0x2e6adb){if(_0x38d8d9[_0xcb03('0xa')](_0xcb03('0xb'))||_0x38d8d9[_0xcb03('0xa')](_0xcb03('0xc'))||_0x38d8d9[_0xcb03('0xa')](_0xcb03('0x18'))||_0x38d8d9[_0xcb03('0xa')](_0xcb03('0xd'))||_0x38d8d9[_0xcb03('0xa')]('code')||_0x38d8d9[_0xcb03('0xa')](_0xcb03('0xf'))){var _0xb1b489,_0x9e34ec;_0xb1b489=_0x38d8d9['serverUrl'];var _0x5c71a6=_0xb1b489[_0xcb03('0x10')](-0x1);if(_0x5c71a6==='/'||_0x5c71a6==='\x5c'||_0x5c71a6===':'){_0xb1b489=_0xb1b489[_0xcb03('0x23')](0x0,_0xb1b489[_0xcb03('0x24')](_0x5c71a6));}switch(_0x38d8d9[_0xcb03('0xb')]){case'US':_0x9e34ec=_0xcb03('0x11');break;case'AU':_0x9e34ec=_0xcb03('0x12');break;case'IN':_0x9e34ec=_0xcb03('0x13');break;case'CN':_0x9e34ec=_0xcb03('0x14');break;default:_0x9e34ec=_0xcb03('0x15');break;}var _0x29fb7a={'method':_0xcb03('0x16'),'uri':_0x9e34ec+_0xcb03('0x17'),'form':{'grant_type':_0xcb03('0x25'),'client_id':_0x38d8d9[_0xcb03('0x18')],'client_secret':_0x38d8d9['clientSecret'],'redirect_uri':_0x38d8d9[_0xcb03('0xc')],'code':_0x38d8d9[_0xcb03('0xe')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x29fb7a)[_0xcb03('0x26')](function(_0x39d777){var _0x23e484=JSON[_0xcb03('0x27')](_0x39d777);if(_0x23e484['refresh_token']){_0x38d8d9[_0xcb03('0x1b')]=_0x23e484[_0xcb03('0x1a')];logger[_0xcb03('0x1c')](util[_0xcb03('0x28')](_0xcb03('0x1d'),_0x38d8d9[_0xcb03('0x1e')],_0x38d8d9['id']));}else{logger['error'](util[_0xcb03('0x28')](_0xcb03('0x20'),_0x38d8d9[_0xcb03('0x1e')],_0x38d8d9['id']),util['inspect'](_0x23e484,{'showHidden':![],'depth':null}));}return _0x2e6adb(null,_0x564743);})[_0xcb03('0x22')](function(_0x9fa2c8){logger[_0xcb03('0x1f')](util[_0xcb03('0x28')](_0xcb03('0x20'),_0x38d8d9['name'],_0x38d8d9['id']),util[_0xcb03('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x2e6adb(_0x9fa2c8);});}else{return _0x2e6adb(null,_0x564743);}}}});}; \ No newline at end of file +var _0xe47d=['application/x-www-form-urlencoded','then','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','parse','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intZohoAccount.attributes','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code'];(function(_0x12f35c,_0x500384){var _0x3a318a=function(_0x2cd13e){while(--_0x2cd13e){_0x12f35c['push'](_0x12f35c['shift']());}};_0x3a318a(++_0x500384);}(_0xe47d,0x1c5));var _0xde47=function(_0x3bd52b,_0xbbc735){_0x3bd52b=_0x3bd52b-0x0;var _0x1e5b89=_0xe47d[_0x3bd52b];return _0x1e5b89;};'use strict';var _=require(_0xde47('0x0'));var util=require(_0xde47('0x1'));var logger=require(_0xde47('0x2'))(_0xde47('0x3'));var moment=require(_0xde47('0x4'));var BPromise=require(_0xde47('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xde47('0x6'));var rimraf=require(_0xde47('0x7'));var config=require(_0xde47('0x8'));var attributes=require(_0xde47('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xde47('0xa')]=function(_0x487ae2,_0x37f305){return _0x487ae2[_0xde47('0xb')](_0xde47('0xc'),attributes,{'tableName':_0xde47('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x432407,_0x5ad910,_0x44e5db){if(_0x432407[_0xde47('0xe')](_0xde47('0xf'))||_0x432407[_0xde47('0xe')](_0xde47('0x10'))||_0x432407[_0xde47('0xe')](_0xde47('0x11'))||_0x432407[_0xde47('0xe')](_0xde47('0x12'))||_0x432407['changed'](_0xde47('0x13'))||_0x432407['changed'](_0xde47('0x14'))){var _0x3b573c,_0x17fd78;_0x3b573c=_0x432407['serverUrl'];var _0x364a84=_0x3b573c[_0xde47('0x15')](-0x1);if(_0x364a84==='/'||_0x364a84==='\x5c'||_0x364a84===':'){_0x3b573c=_0x3b573c['substring'](0x0,_0x3b573c[_0xde47('0x16')](_0x364a84));}switch(_0x432407[_0xde47('0xf')]){case'US':_0x17fd78=_0xde47('0x17');break;case'AU':_0x17fd78=_0xde47('0x18');break;case'IN':_0x17fd78=_0xde47('0x19');break;case'CN':_0x17fd78=_0xde47('0x1a');break;default:_0x17fd78=_0xde47('0x1b');break;}var _0x273b09={'method':_0xde47('0x1c'),'uri':_0x17fd78+_0xde47('0x1d'),'form':{'grant_type':_0xde47('0x1e'),'client_id':_0x432407[_0xde47('0x11')],'client_secret':_0x432407[_0xde47('0x12')],'redirect_uri':_0x432407['serverUrl'],'code':_0x432407[_0xde47('0x13')]},'headers':{'Content-Type':_0xde47('0x1f')}};return rp(_0x273b09)[_0xde47('0x20')](function(_0x23753b){var _0x442249=JSON['parse'](_0x23753b);if(_0x442249[_0xde47('0x21')]){_0x432407[_0xde47('0x22')]=_0x442249[_0xde47('0x21')];logger[_0xde47('0x23')](util[_0xde47('0x24')](_0xde47('0x25'),_0x432407[_0xde47('0x26')],_0x432407['id']));}else{logger[_0xde47('0x27')](util[_0xde47('0x24')](_0xde47('0x28'),_0x432407[_0xde47('0x26')],_0x432407['id']),util[_0xde47('0x29')](_0x442249,{'showHidden':![],'depth':null}));}return _0x44e5db(null,_0x5ad910);})[_0xde47('0x2a')](function(_0x5148a0){logger[_0xde47('0x27')](util[_0xde47('0x24')](_0xde47('0x28'),_0x432407[_0xde47('0x26')],_0x432407['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x44e5db(_0x5148a0);});}else{return _0x44e5db(null,_0x5ad910);}},'beforeUpdate':function(_0x3ee42e,_0x3eb9d6,_0x2a532f){if(_0x3ee42e[_0xde47('0xe')](_0xde47('0xf'))||_0x3ee42e[_0xde47('0xe')]('serverUrl')||_0x3ee42e[_0xde47('0xe')]('clientId')||_0x3ee42e[_0xde47('0xe')]('clientSecret')||_0x3ee42e[_0xde47('0xe')]('code')||_0x3ee42e[_0xde47('0xe')](_0xde47('0x14'))){var _0x37b8e9,_0x1b5399;_0x37b8e9=_0x3ee42e[_0xde47('0x10')];var _0x153f47=_0x37b8e9['slice'](-0x1);if(_0x153f47==='/'||_0x153f47==='\x5c'||_0x153f47===':'){_0x37b8e9=_0x37b8e9['substring'](0x0,_0x37b8e9[_0xde47('0x16')](_0x153f47));}switch(_0x3ee42e[_0xde47('0xf')]){case'US':_0x1b5399=_0xde47('0x17');break;case'AU':_0x1b5399=_0xde47('0x18');break;case'IN':_0x1b5399=_0xde47('0x19');break;case'CN':_0x1b5399='https://accounts.zoho.com.cn';break;default:_0x1b5399=_0xde47('0x1b');break;}var _0x536ac7={'method':_0xde47('0x1c'),'uri':_0x1b5399+_0xde47('0x1d'),'form':{'grant_type':_0xde47('0x1e'),'client_id':_0x3ee42e['clientId'],'client_secret':_0x3ee42e[_0xde47('0x12')],'redirect_uri':_0x3ee42e[_0xde47('0x10')],'code':_0x3ee42e['code']},'headers':{'Content-Type':_0xde47('0x1f')}};return rp(_0x536ac7)[_0xde47('0x20')](function(_0x181601){var _0x5ca7a2=JSON[_0xde47('0x2b')](_0x181601);if(_0x5ca7a2[_0xde47('0x21')]){_0x3ee42e[_0xde47('0x22')]=_0x5ca7a2['refresh_token'];logger[_0xde47('0x23')](util[_0xde47('0x24')](_0xde47('0x25'),_0x3ee42e[_0xde47('0x26')],_0x3ee42e['id']));}else{logger['error'](util[_0xde47('0x24')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3ee42e[_0xde47('0x26')],_0x3ee42e['id']),util[_0xde47('0x29')](_0x5ca7a2,{'showHidden':![],'depth':null}));}return _0x2a532f(null,_0x3eb9d6);})[_0xde47('0x2a')](function(_0x24f25e){logger[_0xde47('0x27')](util[_0xde47('0x24')](_0xde47('0x28'),_0x3ee42e[_0xde47('0x26')],_0x3ee42e['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x2a532f(_0x24f25e);});}else{return _0x2a532f(null,_0x3eb9d6);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 65867c7..666a5e3 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 _0x6b19=['options','where','attributes','limit','include','map','model','debug','ShowZohoAccount','ZohoAccount','find','raw','stringify','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','GetZohoAccount'];(function(_0x25eb43,_0x402961){var _0x1ce0fe=function(_0x4734f2){while(--_0x4734f2){_0x25eb43['push'](_0x25eb43['shift']());}};_0x1ce0fe(++_0x402961);}(_0x6b19,0xf4));var _0x96b1=function(_0x1bfc5c,_0x55bd5e){_0x1bfc5c=_0x1bfc5c-0x0;var _0x25a605=_0x6b19[_0x1bfc5c];return _0x25a605;};'use strict';var _=require(_0x96b1('0x0'));var util=require('util');var moment=require(_0x96b1('0x1'));var BPromise=require(_0x96b1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96b1('0x3'));var db=require(_0x96b1('0x4'))['db'];var utils=require(_0x96b1('0x5'));var logger=require(_0x96b1('0x6'))('rpc');var config=require(_0x96b1('0x7'));var jayson=require(_0x96b1('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x288d77,_0x2347c5,_0x519fbe){return new BPromise(function(_0x280b00,_0x2300ad){return client['request'](_0x288d77,_0x519fbe)[_0x96b1('0x9')](function(_0x6323a6){logger[_0x96b1('0xa')](_0x96b1('0xb'),_0x2347c5,_0x96b1('0xc'));logger['debug'](_0x96b1('0xd'),_0x2347c5,'request\x20sent',JSON['stringify'](_0x6323a6));if(_0x6323a6['error']){if(_0x6323a6['error'][_0x96b1('0xe')]===0x1f4){logger[_0x96b1('0xf')](_0x96b1('0xb'),_0x2347c5,_0x6323a6[_0x96b1('0xf')][_0x96b1('0x10')]);return _0x2300ad(_0x6323a6['error'][_0x96b1('0x10')]);}logger[_0x96b1('0xf')](_0x96b1('0xb'),_0x2347c5,_0x6323a6[_0x96b1('0xf')][_0x96b1('0x10')]);return _0x280b00(_0x6323a6[_0x96b1('0xf')][_0x96b1('0x10')]);}else{logger[_0x96b1('0xa')](_0x96b1('0xb'),_0x2347c5,'request\x20sent');_0x280b00(_0x6323a6[_0x96b1('0x11')][_0x96b1('0x10')]);}})[_0x96b1('0x12')](function(_0x350b2c){logger[_0x96b1('0xf')](_0x96b1('0xb'),_0x2347c5,_0x350b2c);_0x2300ad(_0x350b2c);});});}exports[_0x96b1('0x13')]=function(_0x41227b){var _0x1749a7=this;return new Promise(function(_0x44cc44,_0xd1eebb){return db['ZohoAccount']['findAll']({'raw':_0x41227b[_0x96b1('0x14')]?_0x41227b['options']['raw']===undefined?!![]:![]:!![],'where':_0x41227b[_0x96b1('0x14')]?_0x41227b[_0x96b1('0x14')][_0x96b1('0x15')]||null:null,'attributes':_0x41227b['options']?_0x41227b[_0x96b1('0x14')][_0x96b1('0x16')]||null:null,'limit':_0x41227b[_0x96b1('0x14')]?_0x41227b[_0x96b1('0x14')][_0x96b1('0x17')]||null:null,'include':_0x41227b[_0x96b1('0x14')]?_0x41227b[_0x96b1('0x14')][_0x96b1('0x18')]?_[_0x96b1('0x19')](_0x41227b[_0x96b1('0x14')][_0x96b1('0x18')],function(_0x1b0f88){return{'model':db[_0x1b0f88[_0x96b1('0x1a')]],'as':_0x1b0f88['as'],'attributes':_0x1b0f88[_0x96b1('0x16')],'include':_0x1b0f88[_0x96b1('0x18')]?_[_0x96b1('0x19')](_0x1b0f88[_0x96b1('0x18')],function(_0x5b19b6){return{'model':db[_0x5b19b6[_0x96b1('0x1a')]],'as':_0x5b19b6['as'],'attributes':_0x5b19b6[_0x96b1('0x16')],'include':_0x5b19b6[_0x96b1('0x18')]?_[_0x96b1('0x19')](_0x5b19b6[_0x96b1('0x18')],function(_0x2ad760){return{'model':db[_0x2ad760['model']],'as':_0x2ad760['as'],'attributes':_0x2ad760['attributes']};}):[]};}):[]};}):[]:[]})[_0x96b1('0x9')](function(_0x4bc715){logger[_0x96b1('0xa')](_0x96b1('0x13'),_0x41227b);logger[_0x96b1('0x1b')](_0x96b1('0x13'),_0x41227b,JSON['stringify'](_0x4bc715));_0x44cc44(_0x4bc715);})['catch'](function(_0x45c20e){logger[_0x96b1('0xf')]('GetZohoAccount',_0x45c20e[_0x96b1('0x10')],_0x41227b);_0xd1eebb(_0x1749a7[_0x96b1('0xf')](0x1f4,_0x45c20e[_0x96b1('0x10')]));});});};exports[_0x96b1('0x1c')]=function(_0x378e04){var _0x5caa74=this;return new Promise(function(_0x5ac63c,_0x4716a4){return db[_0x96b1('0x1d')][_0x96b1('0x1e')]({'raw':_0x378e04[_0x96b1('0x14')]?_0x378e04[_0x96b1('0x14')][_0x96b1('0x1f')]===undefined?!![]:![]:!![],'where':_0x378e04[_0x96b1('0x14')]?_0x378e04[_0x96b1('0x14')]['where']||null:null,'attributes':_0x378e04[_0x96b1('0x14')]?_0x378e04[_0x96b1('0x14')][_0x96b1('0x16')]||null:null,'include':_0x378e04[_0x96b1('0x14')]?_0x378e04[_0x96b1('0x14')][_0x96b1('0x18')]?_[_0x96b1('0x19')](_0x378e04[_0x96b1('0x14')]['include'],function(_0x1ff61a){return{'model':db[_0x1ff61a[_0x96b1('0x1a')]],'as':_0x1ff61a['as'],'attributes':_0x1ff61a[_0x96b1('0x16')],'include':_0x1ff61a['include']?_['map'](_0x1ff61a[_0x96b1('0x18')],function(_0x3638e6){return{'model':db[_0x3638e6['model']],'as':_0x3638e6['as'],'attributes':_0x3638e6['attributes'],'include':_0x3638e6['include']?_[_0x96b1('0x19')](_0x3638e6[_0x96b1('0x18')],function(_0x3cc6e1){return{'model':db[_0x3cc6e1[_0x96b1('0x1a')]],'as':_0x3cc6e1['as'],'attributes':_0x3cc6e1[_0x96b1('0x16')]};}):[]};}):[]};}):[]:[]})[_0x96b1('0x9')](function(_0x39a97a){logger['info'](_0x96b1('0x1c'),_0x378e04);logger['debug']('ShowZohoAccount',_0x378e04,JSON[_0x96b1('0x20')](_0x39a97a));_0x5ac63c(_0x39a97a);})[_0x96b1('0x12')](function(_0x482e37){logger[_0x96b1('0xf')](_0x96b1('0x1c'),_0x482e37[_0x96b1('0x10')],_0x378e04);_0x4716a4(_0x5caa74[_0x96b1('0xf')](0x1f4,_0x482e37[_0x96b1('0x10')]));});});}; \ No newline at end of file +var _0x1aab=['options','raw','where','attributes','map','include','model','then','find','ShowZohoAccount','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','GetZohoAccount','ZohoAccount','findAll'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x1aab,0x122));var _0xb1aa=function(_0x590a38,_0x2bc65c){_0x590a38=_0x590a38-0x0;var _0xf36626=_0x1aab[_0x590a38];return _0xf36626;};'use strict';var _=require(_0xb1aa('0x0'));var util=require(_0xb1aa('0x1'));var moment=require(_0xb1aa('0x2'));var BPromise=require('bluebird');var rs=require(_0xb1aa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb1aa('0x4'))['db'];var utils=require(_0xb1aa('0x5'));var logger=require(_0xb1aa('0x6'))(_0xb1aa('0x7'));var config=require(_0xb1aa('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb1aa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x277448,_0x13a350,_0x283ad6){return new BPromise(function(_0x3415f7,_0x405387){return client[_0xb1aa('0xa')](_0x277448,_0x283ad6)['then'](function(_0x12067d){logger[_0xb1aa('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x13a350,_0xb1aa('0xc'));logger[_0xb1aa('0xd')](_0xb1aa('0xe'),_0x13a350,_0xb1aa('0xc'),JSON[_0xb1aa('0xf')](_0x12067d));if(_0x12067d[_0xb1aa('0x10')]){if(_0x12067d[_0xb1aa('0x10')][_0xb1aa('0x11')]===0x1f4){logger[_0xb1aa('0x10')](_0xb1aa('0x12'),_0x13a350,_0x12067d[_0xb1aa('0x10')][_0xb1aa('0x13')]);return _0x405387(_0x12067d[_0xb1aa('0x10')][_0xb1aa('0x13')]);}logger[_0xb1aa('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x13a350,_0x12067d['error'][_0xb1aa('0x13')]);return _0x3415f7(_0x12067d['error'][_0xb1aa('0x13')]);}else{logger['info'](_0xb1aa('0x12'),_0x13a350,'request\x20sent');_0x3415f7(_0x12067d[_0xb1aa('0x14')]['message']);}})[_0xb1aa('0x15')](function(_0x408bf8){logger['error'](_0xb1aa('0x12'),_0x13a350,_0x408bf8);_0x405387(_0x408bf8);});});}exports[_0xb1aa('0x16')]=function(_0x1d1450){var _0x471116=this;return new Promise(function(_0x2c67f3,_0x19aa4c){return db[_0xb1aa('0x17')][_0xb1aa('0x18')]({'raw':_0x1d1450[_0xb1aa('0x19')]?_0x1d1450[_0xb1aa('0x19')][_0xb1aa('0x1a')]===undefined?!![]:![]:!![],'where':_0x1d1450[_0xb1aa('0x19')]?_0x1d1450[_0xb1aa('0x19')][_0xb1aa('0x1b')]||null:null,'attributes':_0x1d1450['options']?_0x1d1450[_0xb1aa('0x19')][_0xb1aa('0x1c')]||null:null,'limit':_0x1d1450[_0xb1aa('0x19')]?_0x1d1450[_0xb1aa('0x19')]['limit']||null:null,'include':_0x1d1450[_0xb1aa('0x19')]?_0x1d1450[_0xb1aa('0x19')]['include']?_[_0xb1aa('0x1d')](_0x1d1450[_0xb1aa('0x19')][_0xb1aa('0x1e')],function(_0x5f2aa7){return{'model':db[_0x5f2aa7['model']],'as':_0x5f2aa7['as'],'attributes':_0x5f2aa7[_0xb1aa('0x1c')],'include':_0x5f2aa7[_0xb1aa('0x1e')]?_[_0xb1aa('0x1d')](_0x5f2aa7[_0xb1aa('0x1e')],function(_0x3a9c9e){return{'model':db[_0x3a9c9e[_0xb1aa('0x1f')]],'as':_0x3a9c9e['as'],'attributes':_0x3a9c9e[_0xb1aa('0x1c')],'include':_0x3a9c9e[_0xb1aa('0x1e')]?_[_0xb1aa('0x1d')](_0x3a9c9e[_0xb1aa('0x1e')],function(_0x1cd714){return{'model':db[_0x1cd714[_0xb1aa('0x1f')]],'as':_0x1cd714['as'],'attributes':_0x1cd714[_0xb1aa('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb1aa('0x20')](function(_0x40c7ff){logger['info'](_0xb1aa('0x16'),_0x1d1450);logger[_0xb1aa('0xd')](_0xb1aa('0x16'),_0x1d1450,JSON[_0xb1aa('0xf')](_0x40c7ff));_0x2c67f3(_0x40c7ff);})['catch'](function(_0xa4a319){logger[_0xb1aa('0x10')]('GetZohoAccount',_0xa4a319[_0xb1aa('0x13')],_0x1d1450);_0x19aa4c(_0x471116[_0xb1aa('0x10')](0x1f4,_0xa4a319[_0xb1aa('0x13')]));});});};exports['ShowZohoAccount']=function(_0x25df88){var _0x120cc3=this;return new Promise(function(_0x4a785e,_0x4b8b7c){return db[_0xb1aa('0x17')][_0xb1aa('0x21')]({'raw':_0x25df88[_0xb1aa('0x19')]?_0x25df88[_0xb1aa('0x19')][_0xb1aa('0x1a')]===undefined?!![]:![]:!![],'where':_0x25df88[_0xb1aa('0x19')]?_0x25df88['options'][_0xb1aa('0x1b')]||null:null,'attributes':_0x25df88['options']?_0x25df88['options']['attributes']||null:null,'include':_0x25df88[_0xb1aa('0x19')]?_0x25df88[_0xb1aa('0x19')][_0xb1aa('0x1e')]?_[_0xb1aa('0x1d')](_0x25df88[_0xb1aa('0x19')]['include'],function(_0x27a466){return{'model':db[_0x27a466[_0xb1aa('0x1f')]],'as':_0x27a466['as'],'attributes':_0x27a466[_0xb1aa('0x1c')],'include':_0x27a466['include']?_['map'](_0x27a466['include'],function(_0x4307b0){return{'model':db[_0x4307b0[_0xb1aa('0x1f')]],'as':_0x4307b0['as'],'attributes':_0x4307b0[_0xb1aa('0x1c')],'include':_0x4307b0[_0xb1aa('0x1e')]?_['map'](_0x4307b0[_0xb1aa('0x1e')],function(_0x8b71c){return{'model':db[_0x8b71c[_0xb1aa('0x1f')]],'as':_0x8b71c['as'],'attributes':_0x8b71c[_0xb1aa('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18989e){logger[_0xb1aa('0xb')](_0xb1aa('0x22'),_0x25df88);logger['debug'](_0xb1aa('0x22'),_0x25df88,JSON[_0xb1aa('0xf')](_0x18989e));_0x4a785e(_0x18989e);})[_0xb1aa('0x15')](function(_0x480ee3){logger[_0xb1aa('0x10')](_0xb1aa('0x22'),_0x480ee3[_0xb1aa('0x13')],_0x25df88);_0x4b8b7c(_0x120cc3[_0xb1aa('0x10')](0x1f4,_0x480ee3[_0xb1aa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 01e8c76..02f6ffc 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 _0x6779=['index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','delete','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated'];(function(_0x2676cf,_0x509894){var _0x5263b6=function(_0x1a516b){while(--_0x1a516b){_0x2676cf['push'](_0x2676cf['shift']());}};_0x5263b6(++_0x509894);}(_0x6779,0x140));var _0x9677=function(_0x2e190e,_0x36d7e8){_0x2e190e=_0x2e190e-0x0;var _0xe0bed=_0x6779[_0x2e190e];return _0xe0bed;};'use strict';var multer=require(_0x9677('0x0'));var util=require(_0x9677('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9677('0x2'));var router=express[_0x9677('0x3')]();var fs_extra=require(_0x9677('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9677('0x5'));var config=require(_0x9677('0x6'));var controller=require(_0x9677('0x7'));router[_0x9677('0x8')]('/',auth[_0x9677('0x9')](),controller[_0x9677('0xa')]);router[_0x9677('0x8')](_0x9677('0xb'),auth[_0x9677('0x9')](),controller[_0x9677('0xc')]);router[_0x9677('0x8')](_0x9677('0xd'),auth[_0x9677('0x9')](),controller[_0x9677('0xe')]);router[_0x9677('0x8')](_0x9677('0xf'),auth[_0x9677('0x9')](),controller[_0x9677('0x10')]);router[_0x9677('0x8')](_0x9677('0x11'),auth[_0x9677('0x9')](),controller[_0x9677('0x12')]);router['post']('/',auth[_0x9677('0x9')](),controller[_0x9677('0x13')]);router['put']('/:id',auth[_0x9677('0x9')](),controller['update']);router[_0x9677('0x14')]('/:id',auth[_0x9677('0x9')](),controller['destroy']);module[_0x9677('0x15')]=router; \ No newline at end of file +var _0xc55b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/descriptions','getDescriptions','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x4d83c5,_0x11a178){var _0x5a1752=function(_0x4bedf5){while(--_0x4bedf5){_0x4d83c5['push'](_0x4d83c5['shift']());}};_0x5a1752(++_0x11a178);}(_0xc55b,0x1de));var _0xbc55=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xc55b[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0xbc55('0x0'));var util=require(_0xbc55('0x1'));var path=require(_0xbc55('0x2'));var timeout=require(_0xbc55('0x3'));var express=require(_0xbc55('0x4'));var router=express[_0xbc55('0x5')]();var fs_extra=require(_0xbc55('0x6'));var auth=require(_0xbc55('0x7'));var interaction=require(_0xbc55('0x8'));var config=require('../../config/environment');var controller=require(_0xbc55('0x9'));router[_0xbc55('0xa')]('/',auth[_0xbc55('0xb')](),controller[_0xbc55('0xc')]);router[_0xbc55('0xa')](_0xbc55('0xd'),auth[_0xbc55('0xb')](),controller[_0xbc55('0xe')]);router[_0xbc55('0xa')]('/:id/fields',auth[_0xbc55('0xb')](),controller['getFields']);router[_0xbc55('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xbc55('0xa')](_0xbc55('0xf'),auth[_0xbc55('0xb')](),controller[_0xbc55('0x10')]);router['post']('/',auth[_0xbc55('0xb')](),controller['create']);router[_0xbc55('0x11')](_0xbc55('0xd'),auth[_0xbc55('0xb')](),controller['update']);router[_0xbc55('0x12')]('/:id',auth[_0xbc55('0xb')](),controller[_0xbc55('0x13')]);module[_0xbc55('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 97cd1fc..a46ddf6 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 _0x9fc5=['exports','STRING','lead','contact','nothing','ENUM','contact_lead'];(function(_0x4459b8,_0x3271b8){var _0x4a4b07=function(_0x3075f8){while(--_0x3075f8){_0x4459b8['push'](_0x4459b8['shift']());}};_0x4a4b07(++_0x3271b8);}(_0x9fc5,0xb6));var _0x59fc=function(_0x7275e9,_0x321fa5){_0x7275e9=_0x7275e9-0x0;var _0x17b99d=_0x9fc5[_0x7275e9];return _0x17b99d;};'use strict';var Sequelize=require('sequelize');module[_0x59fc('0x0')]={'name':{'type':Sequelize[_0x59fc('0x1')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x59fc('0x2'),_0x59fc('0x3'),_0x59fc('0x4')),'defaultValue':_0x59fc('0x2')},'moduleSearch':{'type':Sequelize[_0x59fc('0x5')](_0x59fc('0x6'),_0x59fc('0x3'),_0x59fc('0x2')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x59fc('0x1')]}}; \ No newline at end of file +var _0xb483=['nothing','lead','ENUM','STRING','sequelize','exports','contact'];(function(_0x3f9552,_0x3f7686){var _0x398355=function(_0x1bf64a){while(--_0x1bf64a){_0x3f9552['push'](_0x3f9552['shift']());}};_0x398355(++_0x3f7686);}(_0xb483,0x107));var _0x3b48=function(_0x2e382c,_0x3c19d6){_0x2e382c=_0x2e382c-0x0;var _0x2a248d=_0xb483[_0x2e382c];return _0x2a248d;};'use strict';var Sequelize=require(_0x3b48('0x0'));module[_0x3b48('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize['ENUM']('lead',_0x3b48('0x2'),_0x3b48('0x3')),'defaultValue':_0x3b48('0x4')},'moduleSearch':{'type':Sequelize[_0x3b48('0x5')]('contact_lead',_0x3b48('0x2'),_0x3b48('0x4')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x3b48('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 131d0d9..81267f2 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 _0xc6a7=['../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','map','ZohoConfiguration','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','merge','where','VIRTUAL','include','findAll','rows','catch','includeAll','options','create','body','find','params','getFields','findOne','filter','nolimit','ZohoField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x5d9437,_0x1e992f){var _0x4038d8=function(_0x1f8500){while(--_0x1f8500){_0x5d9437['push'](_0x5d9437['shift']());}};_0x4038d8(++_0x1e992f);}(_0xc6a7,0x124));var _0x7c6a=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0xc6a7[_0x45b034];return _0x509cb0;};'use strict';var emlformat=require(_0x7c6a('0x0'));var rimraf=require(_0x7c6a('0x1'));var zipdir=require(_0x7c6a('0x2'));var jsonpatch=require(_0x7c6a('0x3'));var rp=require(_0x7c6a('0x4'));var moment=require(_0x7c6a('0x5'));var BPromise=require(_0x7c6a('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x7c6a('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7c6a('0x8'));var _=require(_0x7c6a('0x9'));var squel=require(_0x7c6a('0xa'));var crypto=require(_0x7c6a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7c6a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7c6a('0xd'));var Papa=require(_0x7c6a('0xe'));var Redis=require(_0x7c6a('0xf'));var authService=require(_0x7c6a('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7c6a('0x11'));var logger=require(_0x7c6a('0x12'))(_0x7c6a('0x13'));var utils=require(_0x7c6a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7c6a('0x15'));var db=require(_0x7c6a('0x16'))['db'];function respondWithStatusCode(_0x374f89,_0x2e7891){_0x2e7891=_0x2e7891||0xcc;return function(_0x1ac0f){if(_0x1ac0f){return _0x374f89[_0x7c6a('0x17')](_0x2e7891);}return _0x374f89[_0x7c6a('0x18')](_0x2e7891)[_0x7c6a('0x19')]();};}function respondWithResult(_0x5a2fd7,_0x508154){_0x508154=_0x508154||0xc8;return function(_0x3eeb70){if(_0x3eeb70){return _0x5a2fd7[_0x7c6a('0x18')](_0x508154)[_0x7c6a('0x1a')](_0x3eeb70);}};}function respondWithFilteredResult(_0x591d00,_0x2c64f0){return function(_0x463027){if(_0x463027){var _0x3d779e=typeof _0x2c64f0[_0x7c6a('0x1b')]===_0x7c6a('0x1c')&&typeof _0x2c64f0[_0x7c6a('0x1d')]===_0x7c6a('0x1c');var _0x45e559=_0x463027[_0x7c6a('0x1e')];var _0x1daed1=_0x3d779e?0x0:_0x2c64f0[_0x7c6a('0x1b')];var _0x32fc6e=_0x3d779e?_0x463027[_0x7c6a('0x1e')]:_0x2c64f0[_0x7c6a('0x1b')]+_0x2c64f0[_0x7c6a('0x1d')];var _0x12d8dd;if(_0x32fc6e>=_0x45e559){_0x32fc6e=_0x45e559;_0x12d8dd=0xc8;}else{_0x12d8dd=0xce;}_0x591d00[_0x7c6a('0x18')](_0x12d8dd);return _0x591d00[_0x7c6a('0x1f')]('Content-Range',_0x1daed1+'-'+_0x32fc6e+'/'+_0x45e559)[_0x7c6a('0x1a')](_0x463027);}return null;};}function patchUpdates(_0x3a769d){return function(_0x4c38ed){try{jsonpatch[_0x7c6a('0x20')](_0x4c38ed,_0x3a769d,!![]);}catch(_0x2cd889){return BPromise[_0x7c6a('0x21')](_0x2cd889);}return _0x4c38ed[_0x7c6a('0x22')]();};}function saveUpdates(_0x3e3374,_0x9704f5){return function(_0x3a5751){if(_0x3a5751){return _0x3a5751[_0x7c6a('0x23')](_0x3e3374)[_0x7c6a('0x24')](function(_0x2dc6b4){return _0x2dc6b4;});}return null;};}function removeEntity(_0x2ae853,_0x198744){return function(_0x393ce1){if(_0x393ce1){return _0x393ce1[_0x7c6a('0x25')]()[_0x7c6a('0x24')](function(){_0x2ae853[_0x7c6a('0x18')](0xcc)[_0x7c6a('0x19')]();});}};}function handleEntityNotFound(_0x442872,_0x31cb40){return function(_0x3df220){if(!_0x3df220){_0x442872[_0x7c6a('0x17')](0x194);}return _0x3df220;};}function handleError(_0x5c00e8,_0x51fe6d){_0x51fe6d=_0x51fe6d||0x1f4;return function(_0x215d34){logger[_0x7c6a('0x26')](_0x215d34['stack']);if(_0x215d34[_0x7c6a('0x27')]){delete _0x215d34['name'];}_0x5c00e8[_0x7c6a('0x18')](_0x51fe6d)['send'](_0x215d34);};}exports['index']=function(_0x42b279,_0xb6e73d){var _0x3ee567={},_0xde69f3={},_0x323311={'count':0x0,'rows':[]};var _0x599479=_[_0x7c6a('0x28')](db[_0x7c6a('0x29')][_0x7c6a('0x2a')],function(_0x3656d5){return{'name':_0x3656d5[_0x7c6a('0x2b')],'type':_0x3656d5[_0x7c6a('0x2c')]['key']};});_0xde69f3[_0x7c6a('0x2d')]=_[_0x7c6a('0x28')](_0x599479,_0x7c6a('0x27'));_0xde69f3[_0x7c6a('0x2e')]=_[_0x7c6a('0x2f')](_0x42b279[_0x7c6a('0x2e')]);_0xde69f3['filters']=_[_0x7c6a('0x30')](_0xde69f3[_0x7c6a('0x2d')],_0xde69f3['query']);_0x3ee567[_0x7c6a('0x31')]=_[_0x7c6a('0x30')](_0xde69f3[_0x7c6a('0x2d')],qs[_0x7c6a('0x32')](_0x42b279[_0x7c6a('0x2e')][_0x7c6a('0x32')]));_0x3ee567[_0x7c6a('0x31')]=_0x3ee567['attributes'][_0x7c6a('0x33')]?_0x3ee567[_0x7c6a('0x31')]:_0xde69f3['model'];if(!_0x42b279[_0x7c6a('0x2e')][_0x7c6a('0x34')]('nolimit')){_0x3ee567['limit']=qs[_0x7c6a('0x1d')](_0x42b279[_0x7c6a('0x2e')][_0x7c6a('0x1d')]);_0x3ee567[_0x7c6a('0x1b')]=qs[_0x7c6a('0x1b')](_0x42b279['query'][_0x7c6a('0x1b')]);}_0x3ee567[_0x7c6a('0x35')]=qs[_0x7c6a('0x36')](_0x42b279[_0x7c6a('0x2e')][_0x7c6a('0x36')]);_0x3ee567['where']=qs[_0x7c6a('0x37')](_[_0x7c6a('0x38')](_0x42b279[_0x7c6a('0x2e')],_0xde69f3[_0x7c6a('0x37')]),_0x599479);if(_0x42b279[_0x7c6a('0x2e')]['filter']){_0x3ee567['where']=_[_0x7c6a('0x39')](_0x3ee567[_0x7c6a('0x3a')],{'$or':_[_0x7c6a('0x28')](_0x599479,function(_0x555909){if(_0x555909[_0x7c6a('0x2c')]!==_0x7c6a('0x3b')){var _0xaf6870={};_0xaf6870[_0x555909[_0x7c6a('0x27')]]={'$like':'%'+_0x42b279[_0x7c6a('0x2e')]['filter']+'%'};return _0xaf6870;}})});}_0x3ee567=_[_0x7c6a('0x39')]({},_0x3ee567,_0x42b279['options']);var _0x4d6a72={'where':_0x3ee567[_0x7c6a('0x3a')]};return db[_0x7c6a('0x29')][_0x7c6a('0x1e')](_0x4d6a72)['then'](function(_0x6c7674){_0x323311['count']=_0x6c7674;if(_0x42b279[_0x7c6a('0x2e')]['includeAll']){_0x3ee567[_0x7c6a('0x3c')]=[{'all':!![]}];}return db[_0x7c6a('0x29')][_0x7c6a('0x3d')](_0x3ee567);})[_0x7c6a('0x24')](function(_0x39e087){_0x323311[_0x7c6a('0x3e')]=_0x39e087;return _0x323311;})[_0x7c6a('0x24')](respondWithFilteredResult(_0xb6e73d,_0x3ee567))[_0x7c6a('0x3f')](handleError(_0xb6e73d,null));};exports['show']=function(_0x278551,_0xee2849){var _0x7db150={'raw':![],'where':{'id':_0x278551['params']['id']}},_0x414c2e={};_0x414c2e[_0x7c6a('0x2d')]=_[_0x7c6a('0x2f')](db[_0x7c6a('0x29')][_0x7c6a('0x2a')]);_0x414c2e[_0x7c6a('0x2e')]=_[_0x7c6a('0x2f')](_0x278551[_0x7c6a('0x2e')]);_0x414c2e[_0x7c6a('0x37')]=_[_0x7c6a('0x30')](_0x414c2e[_0x7c6a('0x2d')],_0x414c2e[_0x7c6a('0x2e')]);_0x7db150['attributes']=_[_0x7c6a('0x30')](_0x414c2e[_0x7c6a('0x2d')],qs['fields'](_0x278551['query'][_0x7c6a('0x32')]));_0x7db150['attributes']=_0x7db150['attributes'][_0x7c6a('0x33')]?_0x7db150[_0x7c6a('0x31')]:_0x414c2e[_0x7c6a('0x2d')];if(_0x278551['query'][_0x7c6a('0x40')]){_0x7db150[_0x7c6a('0x3c')]=[{'all':!![]}];}_0x7db150=_[_0x7c6a('0x39')]({},_0x7db150,_0x278551[_0x7c6a('0x41')]);return db[_0x7c6a('0x29')]['find'](_0x7db150)[_0x7c6a('0x24')](handleEntityNotFound(_0xee2849,null))[_0x7c6a('0x24')](respondWithResult(_0xee2849,null))[_0x7c6a('0x3f')](handleError(_0xee2849,null));};exports[_0x7c6a('0x42')]=function(_0x336f9a,_0x1811b4){return db[_0x7c6a('0x29')][_0x7c6a('0x42')](_0x336f9a[_0x7c6a('0x43')],{})['then'](respondWithResult(_0x1811b4,0xc9))['catch'](handleError(_0x1811b4,null));};exports[_0x7c6a('0x23')]=function(_0x5c930f,_0x314d01){if(_0x5c930f[_0x7c6a('0x43')]['id']){delete _0x5c930f[_0x7c6a('0x43')]['id'];}return db['ZohoConfiguration'][_0x7c6a('0x44')]({'where':{'id':_0x5c930f[_0x7c6a('0x45')]['id']}})['then'](handleEntityNotFound(_0x314d01,null))['then'](saveUpdates(_0x5c930f[_0x7c6a('0x43')],null))[_0x7c6a('0x24')](respondWithResult(_0x314d01,null))[_0x7c6a('0x3f')](handleError(_0x314d01,null));};exports[_0x7c6a('0x25')]=function(_0x6b301a,_0x440378){return db['ZohoConfiguration']['find']({'where':{'id':_0x6b301a[_0x7c6a('0x45')]['id']}})[_0x7c6a('0x24')](handleEntityNotFound(_0x440378,null))['then'](removeEntity(_0x440378,null))[_0x7c6a('0x3f')](handleError(_0x440378,null));};exports[_0x7c6a('0x46')]=function(_0x40b616,_0x1afdd0,_0x138789){var _0x3dc2a5={};var _0x3e0820={};var _0x482a8f;var _0x485715;return db['ZohoConfiguration'][_0x7c6a('0x47')]({'where':{'id':_0x40b616['params']['id']}})[_0x7c6a('0x24')](handleEntityNotFound(_0x1afdd0,null))[_0x7c6a('0x24')](function(_0xb156eb){if(_0xb156eb){_0x482a8f=_0xb156eb;_0x3e0820[_0x7c6a('0x2d')]=_[_0x7c6a('0x2f')](db['ZohoField'][_0x7c6a('0x2a')]);_0x3e0820[_0x7c6a('0x2e')]=_[_0x7c6a('0x2f')](_0x40b616[_0x7c6a('0x2e')]);_0x3e0820['filters']=_[_0x7c6a('0x30')](_0x3e0820[_0x7c6a('0x2d')],_0x3e0820[_0x7c6a('0x2e')]);_0x3dc2a5['attributes']=_[_0x7c6a('0x30')](_0x3e0820[_0x7c6a('0x2d')],qs[_0x7c6a('0x32')](_0x40b616[_0x7c6a('0x2e')][_0x7c6a('0x32')]));_0x3dc2a5[_0x7c6a('0x31')]=_0x3dc2a5[_0x7c6a('0x31')][_0x7c6a('0x33')]?_0x3dc2a5[_0x7c6a('0x31')]:_0x3e0820[_0x7c6a('0x2d')];_0x3dc2a5['order']=qs[_0x7c6a('0x36')](_0x40b616[_0x7c6a('0x2e')][_0x7c6a('0x36')]);_0x3dc2a5[_0x7c6a('0x3a')]=qs[_0x7c6a('0x37')](_[_0x7c6a('0x38')](_0x40b616['query'],_0x3e0820['filters']));if(_0x40b616['query'][_0x7c6a('0x48')]){_0x3dc2a5['where']=_[_0x7c6a('0x39')](_0x3dc2a5[_0x7c6a('0x3a')],{'$or':_[_0x7c6a('0x28')](_0x3dc2a5[_0x7c6a('0x31')],function(_0x544a96){var _0x18622c={};_0x18622c[_0x544a96]={'$like':'%'+_0x40b616[_0x7c6a('0x2e')]['filter']+'%'};return _0x18622c;})});}_0x3dc2a5=_[_0x7c6a('0x39')]({},_0x3dc2a5,_0x40b616[_0x7c6a('0x41')]);return _0x482a8f['getFields'](_0x3dc2a5);}})[_0x7c6a('0x24')](function(_0x2f3b85){if(_0x2f3b85){_0x485715=_0x2f3b85[_0x7c6a('0x33')];if(!_0x40b616['query'][_0x7c6a('0x34')](_0x7c6a('0x49'))){_0x3dc2a5['limit']=qs[_0x7c6a('0x1d')](_0x40b616[_0x7c6a('0x2e')]['limit']);_0x3dc2a5[_0x7c6a('0x1b')]=qs[_0x7c6a('0x1b')](_0x40b616['query'][_0x7c6a('0x1b')]);}return _0x482a8f[_0x7c6a('0x46')](_0x3dc2a5);}})[_0x7c6a('0x24')](function(_0x259839){if(_0x259839){return _0x259839?{'count':_0x485715,'rows':_0x259839}:null;}})[_0x7c6a('0x24')](respondWithResult(_0x1afdd0,null))[_0x7c6a('0x3f')](handleError(_0x1afdd0,null));};exports['getSubjects']=function(_0x2a120d,_0x13f7d5,_0x271115){var _0x41ecaf={};var _0x45782f={};var _0x2b3e7f;var _0x4d74a2;return db[_0x7c6a('0x29')][_0x7c6a('0x47')]({'where':{'id':_0x2a120d[_0x7c6a('0x45')]['id']}})[_0x7c6a('0x24')](handleEntityNotFound(_0x13f7d5,null))[_0x7c6a('0x24')](function(_0xe8d360){if(_0xe8d360){_0x2b3e7f=_0xe8d360;_0x45782f[_0x7c6a('0x2d')]=_[_0x7c6a('0x2f')](db[_0x7c6a('0x4a')][_0x7c6a('0x2a')]);_0x45782f[_0x7c6a('0x2e')]=_[_0x7c6a('0x2f')](_0x2a120d[_0x7c6a('0x2e')]);_0x45782f[_0x7c6a('0x37')]=_[_0x7c6a('0x30')](_0x45782f['model'],_0x45782f['query']);_0x41ecaf[_0x7c6a('0x31')]=_['intersection'](_0x45782f[_0x7c6a('0x2d')],qs['fields'](_0x2a120d[_0x7c6a('0x2e')][_0x7c6a('0x32')]));_0x41ecaf[_0x7c6a('0x31')]=_0x41ecaf[_0x7c6a('0x31')][_0x7c6a('0x33')]?_0x41ecaf['attributes']:_0x45782f[_0x7c6a('0x2d')];_0x41ecaf[_0x7c6a('0x35')]=qs[_0x7c6a('0x36')](_0x2a120d[_0x7c6a('0x2e')][_0x7c6a('0x36')]);_0x41ecaf[_0x7c6a('0x3a')]=qs['filters'](_[_0x7c6a('0x38')](_0x2a120d['query'],_0x45782f[_0x7c6a('0x37')]));if(_0x2a120d['query']['filter']){_0x41ecaf['where']=_[_0x7c6a('0x39')](_0x41ecaf[_0x7c6a('0x3a')],{'$or':_[_0x7c6a('0x28')](_0x41ecaf[_0x7c6a('0x31')],function(_0x1948f2){var _0x1f6b6c={};_0x1f6b6c[_0x1948f2]={'$like':'%'+_0x2a120d[_0x7c6a('0x2e')][_0x7c6a('0x48')]+'%'};return _0x1f6b6c;})});}_0x41ecaf=_[_0x7c6a('0x39')]({},_0x41ecaf,_0x2a120d[_0x7c6a('0x41')]);return _0x2b3e7f['getSubjects'](_0x41ecaf);}})['then'](function(_0xebf228){if(_0xebf228){_0x4d74a2=_0xebf228[_0x7c6a('0x33')];if(!_0x2a120d[_0x7c6a('0x2e')][_0x7c6a('0x34')](_0x7c6a('0x49'))){_0x41ecaf['limit']=qs[_0x7c6a('0x1d')](_0x2a120d['query']['limit']);_0x41ecaf[_0x7c6a('0x1b')]=qs[_0x7c6a('0x1b')](_0x2a120d['query']['offset']);}return _0x2b3e7f[_0x7c6a('0x4b')](_0x41ecaf);}})[_0x7c6a('0x24')](function(_0x136483){if(_0x136483){return _0x136483?{'count':_0x4d74a2,'rows':_0x136483}:null;}})[_0x7c6a('0x24')](respondWithResult(_0x13f7d5,null))[_0x7c6a('0x3f')](handleError(_0x13f7d5,null));};exports[_0x7c6a('0x4c')]=function(_0x5e1654,_0x3b2104,_0x287e29){var _0x34498b={};var _0xfcc7c2={};var _0x36cb1e;var _0x349bc0;return db[_0x7c6a('0x29')][_0x7c6a('0x47')]({'where':{'id':_0x5e1654['params']['id']}})['then'](handleEntityNotFound(_0x3b2104,null))[_0x7c6a('0x24')](function(_0xa19554){if(_0xa19554){_0x36cb1e=_0xa19554;_0xfcc7c2[_0x7c6a('0x2d')]=_[_0x7c6a('0x2f')](db['ZohoField']['rawAttributes']);_0xfcc7c2[_0x7c6a('0x2e')]=_[_0x7c6a('0x2f')](_0x5e1654[_0x7c6a('0x2e')]);_0xfcc7c2[_0x7c6a('0x37')]=_[_0x7c6a('0x30')](_0xfcc7c2[_0x7c6a('0x2d')],_0xfcc7c2[_0x7c6a('0x2e')]);_0x34498b[_0x7c6a('0x31')]=_['intersection'](_0xfcc7c2[_0x7c6a('0x2d')],qs['fields'](_0x5e1654[_0x7c6a('0x2e')][_0x7c6a('0x32')]));_0x34498b[_0x7c6a('0x31')]=_0x34498b['attributes']['length']?_0x34498b['attributes']:_0xfcc7c2['model'];_0x34498b[_0x7c6a('0x35')]=qs[_0x7c6a('0x36')](_0x5e1654[_0x7c6a('0x2e')][_0x7c6a('0x36')]);_0x34498b[_0x7c6a('0x3a')]=qs[_0x7c6a('0x37')](_['pick'](_0x5e1654[_0x7c6a('0x2e')],_0xfcc7c2['filters']));if(_0x5e1654['query'][_0x7c6a('0x48')]){_0x34498b[_0x7c6a('0x3a')]=_[_0x7c6a('0x39')](_0x34498b[_0x7c6a('0x3a')],{'$or':_[_0x7c6a('0x28')](_0x34498b['attributes'],function(_0x45cbac){var _0x1b84f0={};_0x1b84f0[_0x45cbac]={'$like':'%'+_0x5e1654[_0x7c6a('0x2e')][_0x7c6a('0x48')]+'%'};return _0x1b84f0;})});}_0x34498b=_['merge']({},_0x34498b,_0x5e1654[_0x7c6a('0x41')]);return _0x36cb1e[_0x7c6a('0x4c')](_0x34498b);}})[_0x7c6a('0x24')](function(_0x5bb7c9){if(_0x5bb7c9){_0x349bc0=_0x5bb7c9['length'];if(!_0x5e1654[_0x7c6a('0x2e')][_0x7c6a('0x34')]('nolimit')){_0x34498b['limit']=qs[_0x7c6a('0x1d')](_0x5e1654[_0x7c6a('0x2e')][_0x7c6a('0x1d')]);_0x34498b[_0x7c6a('0x1b')]=qs['offset'](_0x5e1654[_0x7c6a('0x2e')][_0x7c6a('0x1b')]);}return _0x36cb1e['getDescriptions'](_0x34498b);}})[_0x7c6a('0x24')](function(_0x432eff){if(_0x432eff){return _0x432eff?{'count':_0x349bc0,'rows':_0x432eff}:null;}})[_0x7c6a('0x24')](respondWithResult(_0x3b2104,null))[_0x7c6a('0x3f')](handleError(_0x3b2104,null));}; \ No newline at end of file +var _0xeea9=['fields','length','nolimit','order','sort','filters','pick','filter','merge','options','where','includeAll','include','findAll','catch','show','params','create','body','getFields','findOne','ZohoField','hasOwnProperty','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','sendStatus','error','stack','name','send','index','ZohoConfiguration','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes'];(function(_0x1681f8,_0xb1f14f){var _0x37539a=function(_0xed6b29){while(--_0xed6b29){_0x1681f8['push'](_0x1681f8['shift']());}};_0x37539a(++_0xb1f14f);}(_0xeea9,0x19a));var _0x9eea=function(_0xe9099e,_0x3e387d){_0xe9099e=_0xe9099e-0x0;var _0x25fedd=_0xeea9[_0xe9099e];return _0x25fedd;};'use strict';var emlformat=require(_0x9eea('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9eea('0x1'));var jsonpatch=require(_0x9eea('0x2'));var rp=require(_0x9eea('0x3'));var moment=require(_0x9eea('0x4'));var BPromise=require(_0x9eea('0x5'));var Mustache=require(_0x9eea('0x6'));var util=require('util');var path=require(_0x9eea('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9eea('0x8'));var fs=require('fs');var fs_extra=require(_0x9eea('0x9'));var _=require(_0x9eea('0xa'));var squel=require(_0x9eea('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9eea('0xc'));var toCsv=require(_0x9eea('0xd'));var querystring=require(_0x9eea('0xe'));var Papa=require(_0x9eea('0xf'));var Redis=require(_0x9eea('0x10'));var authService=require(_0x9eea('0x11'));var qs=require(_0x9eea('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9eea('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x9eea('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9eea('0x15'));var db=require(_0x9eea('0x16'))['db'];function respondWithStatusCode(_0x1efefd,_0x469c9b){_0x469c9b=_0x469c9b||0xcc;return function(_0x48a701){if(_0x48a701){return _0x1efefd['sendStatus'](_0x469c9b);}return _0x1efefd[_0x9eea('0x17')](_0x469c9b)[_0x9eea('0x18')]();};}function respondWithResult(_0x59bca4,_0x2155d1){_0x2155d1=_0x2155d1||0xc8;return function(_0x5367a7){if(_0x5367a7){return _0x59bca4['status'](_0x2155d1)[_0x9eea('0x19')](_0x5367a7);}};}function respondWithFilteredResult(_0x19ddf2,_0x124992){return function(_0x290d1b){if(_0x290d1b){var _0x4f8cbe=typeof _0x124992[_0x9eea('0x1a')]===_0x9eea('0x1b')&&typeof _0x124992['limit']===_0x9eea('0x1b');var _0x577b36=_0x290d1b[_0x9eea('0x1c')];var _0x3b0289=_0x4f8cbe?0x0:_0x124992[_0x9eea('0x1a')];var _0x5390d4=_0x4f8cbe?_0x290d1b[_0x9eea('0x1c')]:_0x124992[_0x9eea('0x1a')]+_0x124992[_0x9eea('0x1d')];var _0xdf0a0c;if(_0x5390d4>=_0x577b36){_0x5390d4=_0x577b36;_0xdf0a0c=0xc8;}else{_0xdf0a0c=0xce;}_0x19ddf2[_0x9eea('0x17')](_0xdf0a0c);return _0x19ddf2[_0x9eea('0x1e')](_0x9eea('0x1f'),_0x3b0289+'-'+_0x5390d4+'/'+_0x577b36)[_0x9eea('0x19')](_0x290d1b);}return null;};}function patchUpdates(_0x204bc0){return function(_0x487a10){try{jsonpatch[_0x9eea('0x20')](_0x487a10,_0x204bc0,!![]);}catch(_0x35d630){return BPromise['reject'](_0x35d630);}return _0x487a10['save']();};}function saveUpdates(_0x2308da,_0x4ef74f){return function(_0x57c666){if(_0x57c666){return _0x57c666[_0x9eea('0x21')](_0x2308da)[_0x9eea('0x22')](function(_0x1e3200){return _0x1e3200;});}return null;};}function removeEntity(_0x3f7c83,_0xae2701){return function(_0x3a6008){if(_0x3a6008){return _0x3a6008[_0x9eea('0x23')]()['then'](function(){_0x3f7c83[_0x9eea('0x17')](0xcc)[_0x9eea('0x18')]();});}};}function handleEntityNotFound(_0x384f30,_0x1b9df3){return function(_0x44f961){if(!_0x44f961){_0x384f30[_0x9eea('0x24')](0x194);}return _0x44f961;};}function handleError(_0x4d580a,_0x3e0bfb){_0x3e0bfb=_0x3e0bfb||0x1f4;return function(_0x437145){logger[_0x9eea('0x25')](_0x437145[_0x9eea('0x26')]);if(_0x437145[_0x9eea('0x27')]){delete _0x437145[_0x9eea('0x27')];}_0x4d580a['status'](_0x3e0bfb)[_0x9eea('0x28')](_0x437145);};}exports[_0x9eea('0x29')]=function(_0x59ea98,_0x2fbe87){var _0x22ecc3={},_0x38369e={},_0x362c78={'count':0x0,'rows':[]};var _0x2527b5=_['map'](db[_0x9eea('0x2a')][_0x9eea('0x2b')],function(_0x327f0f){return{'name':_0x327f0f[_0x9eea('0x2c')],'type':_0x327f0f[_0x9eea('0x2d')]['key']};});_0x38369e[_0x9eea('0x2e')]=_[_0x9eea('0x2f')](_0x2527b5,'name');_0x38369e[_0x9eea('0x30')]=_[_0x9eea('0x31')](_0x59ea98[_0x9eea('0x30')]);_0x38369e['filters']=_[_0x9eea('0x32')](_0x38369e[_0x9eea('0x2e')],_0x38369e[_0x9eea('0x30')]);_0x22ecc3[_0x9eea('0x33')]=_[_0x9eea('0x32')](_0x38369e[_0x9eea('0x2e')],qs[_0x9eea('0x34')](_0x59ea98[_0x9eea('0x30')][_0x9eea('0x34')]));_0x22ecc3[_0x9eea('0x33')]=_0x22ecc3['attributes'][_0x9eea('0x35')]?_0x22ecc3['attributes']:_0x38369e['model'];if(!_0x59ea98[_0x9eea('0x30')]['hasOwnProperty'](_0x9eea('0x36'))){_0x22ecc3[_0x9eea('0x1d')]=qs[_0x9eea('0x1d')](_0x59ea98[_0x9eea('0x30')][_0x9eea('0x1d')]);_0x22ecc3[_0x9eea('0x1a')]=qs[_0x9eea('0x1a')](_0x59ea98[_0x9eea('0x30')][_0x9eea('0x1a')]);}_0x22ecc3[_0x9eea('0x37')]=qs[_0x9eea('0x38')](_0x59ea98[_0x9eea('0x30')]['sort']);_0x22ecc3['where']=qs[_0x9eea('0x39')](_[_0x9eea('0x3a')](_0x59ea98[_0x9eea('0x30')],_0x38369e[_0x9eea('0x39')]),_0x2527b5);if(_0x59ea98['query'][_0x9eea('0x3b')]){_0x22ecc3['where']=_['merge'](_0x22ecc3['where'],{'$or':_['map'](_0x2527b5,function(_0xb255){if(_0xb255[_0x9eea('0x2d')]!=='VIRTUAL'){var _0x27a8b1={};_0x27a8b1[_0xb255[_0x9eea('0x27')]]={'$like':'%'+_0x59ea98[_0x9eea('0x30')][_0x9eea('0x3b')]+'%'};return _0x27a8b1;}})});}_0x22ecc3=_[_0x9eea('0x3c')]({},_0x22ecc3,_0x59ea98[_0x9eea('0x3d')]);var _0x3c8986={'where':_0x22ecc3[_0x9eea('0x3e')]};return db[_0x9eea('0x2a')][_0x9eea('0x1c')](_0x3c8986)['then'](function(_0x26256f){_0x362c78[_0x9eea('0x1c')]=_0x26256f;if(_0x59ea98[_0x9eea('0x30')][_0x9eea('0x3f')]){_0x22ecc3[_0x9eea('0x40')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x9eea('0x41')](_0x22ecc3);})[_0x9eea('0x22')](function(_0x587949){_0x362c78['rows']=_0x587949;return _0x362c78;})[_0x9eea('0x22')](respondWithFilteredResult(_0x2fbe87,_0x22ecc3))[_0x9eea('0x42')](handleError(_0x2fbe87,null));};exports[_0x9eea('0x43')]=function(_0x1a05d8,_0x1150cc){var _0x457ff1={'raw':![],'where':{'id':_0x1a05d8[_0x9eea('0x44')]['id']}},_0x59b287={};_0x59b287[_0x9eea('0x2e')]=_['keys'](db[_0x9eea('0x2a')]['rawAttributes']);_0x59b287[_0x9eea('0x30')]=_[_0x9eea('0x31')](_0x1a05d8[_0x9eea('0x30')]);_0x59b287[_0x9eea('0x39')]=_['intersection'](_0x59b287[_0x9eea('0x2e')],_0x59b287[_0x9eea('0x30')]);_0x457ff1[_0x9eea('0x33')]=_[_0x9eea('0x32')](_0x59b287[_0x9eea('0x2e')],qs[_0x9eea('0x34')](_0x1a05d8['query'][_0x9eea('0x34')]));_0x457ff1['attributes']=_0x457ff1[_0x9eea('0x33')]['length']?_0x457ff1[_0x9eea('0x33')]:_0x59b287['model'];if(_0x1a05d8[_0x9eea('0x30')]['includeAll']){_0x457ff1[_0x9eea('0x40')]=[{'all':!![]}];}_0x457ff1=_[_0x9eea('0x3c')]({},_0x457ff1,_0x1a05d8[_0x9eea('0x3d')]);return db[_0x9eea('0x2a')]['find'](_0x457ff1)[_0x9eea('0x22')](handleEntityNotFound(_0x1150cc,null))[_0x9eea('0x22')](respondWithResult(_0x1150cc,null))['catch'](handleError(_0x1150cc,null));};exports['create']=function(_0x442847,_0x266d5f){return db[_0x9eea('0x2a')][_0x9eea('0x45')](_0x442847[_0x9eea('0x46')],{})['then'](respondWithResult(_0x266d5f,0xc9))[_0x9eea('0x42')](handleError(_0x266d5f,null));};exports[_0x9eea('0x21')]=function(_0x4bc616,_0x4da01b){if(_0x4bc616['body']['id']){delete _0x4bc616[_0x9eea('0x46')]['id'];}return db[_0x9eea('0x2a')]['find']({'where':{'id':_0x4bc616[_0x9eea('0x44')]['id']}})[_0x9eea('0x22')](handleEntityNotFound(_0x4da01b,null))[_0x9eea('0x22')](saveUpdates(_0x4bc616[_0x9eea('0x46')],null))[_0x9eea('0x22')](respondWithResult(_0x4da01b,null))[_0x9eea('0x42')](handleError(_0x4da01b,null));};exports['destroy']=function(_0x2051fb,_0x51ebcb){return db[_0x9eea('0x2a')]['find']({'where':{'id':_0x2051fb[_0x9eea('0x44')]['id']}})[_0x9eea('0x22')](handleEntityNotFound(_0x51ebcb,null))[_0x9eea('0x22')](removeEntity(_0x51ebcb,null))['catch'](handleError(_0x51ebcb,null));};exports[_0x9eea('0x47')]=function(_0x381f2a,_0x4ba0e4,_0x1adb70){var _0x126f38={};var _0x1cde6e={};var _0x209bb2;var _0x47edbc;return db[_0x9eea('0x2a')][_0x9eea('0x48')]({'where':{'id':_0x381f2a[_0x9eea('0x44')]['id']}})[_0x9eea('0x22')](handleEntityNotFound(_0x4ba0e4,null))[_0x9eea('0x22')](function(_0x97c1d4){if(_0x97c1d4){_0x209bb2=_0x97c1d4;_0x1cde6e[_0x9eea('0x2e')]=_[_0x9eea('0x31')](db[_0x9eea('0x49')][_0x9eea('0x2b')]);_0x1cde6e[_0x9eea('0x30')]=_[_0x9eea('0x31')](_0x381f2a['query']);_0x1cde6e[_0x9eea('0x39')]=_[_0x9eea('0x32')](_0x1cde6e[_0x9eea('0x2e')],_0x1cde6e[_0x9eea('0x30')]);_0x126f38[_0x9eea('0x33')]=_[_0x9eea('0x32')](_0x1cde6e[_0x9eea('0x2e')],qs[_0x9eea('0x34')](_0x381f2a[_0x9eea('0x30')][_0x9eea('0x34')]));_0x126f38[_0x9eea('0x33')]=_0x126f38[_0x9eea('0x33')][_0x9eea('0x35')]?_0x126f38[_0x9eea('0x33')]:_0x1cde6e[_0x9eea('0x2e')];_0x126f38[_0x9eea('0x37')]=qs['sort'](_0x381f2a[_0x9eea('0x30')][_0x9eea('0x38')]);_0x126f38[_0x9eea('0x3e')]=qs['filters'](_[_0x9eea('0x3a')](_0x381f2a['query'],_0x1cde6e[_0x9eea('0x39')]));if(_0x381f2a[_0x9eea('0x30')]['filter']){_0x126f38[_0x9eea('0x3e')]=_[_0x9eea('0x3c')](_0x126f38['where'],{'$or':_[_0x9eea('0x2f')](_0x126f38[_0x9eea('0x33')],function(_0x512dea){var _0x51739c={};_0x51739c[_0x512dea]={'$like':'%'+_0x381f2a['query'][_0x9eea('0x3b')]+'%'};return _0x51739c;})});}_0x126f38=_['merge']({},_0x126f38,_0x381f2a['options']);return _0x209bb2[_0x9eea('0x47')](_0x126f38);}})[_0x9eea('0x22')](function(_0x5e2f7f){if(_0x5e2f7f){_0x47edbc=_0x5e2f7f['length'];if(!_0x381f2a[_0x9eea('0x30')][_0x9eea('0x4a')](_0x9eea('0x36'))){_0x126f38['limit']=qs[_0x9eea('0x1d')](_0x381f2a[_0x9eea('0x30')][_0x9eea('0x1d')]);_0x126f38[_0x9eea('0x1a')]=qs[_0x9eea('0x1a')](_0x381f2a['query'][_0x9eea('0x1a')]);}return _0x209bb2[_0x9eea('0x47')](_0x126f38);}})[_0x9eea('0x22')](function(_0x349cb9){if(_0x349cb9){return _0x349cb9?{'count':_0x47edbc,'rows':_0x349cb9}:null;}})[_0x9eea('0x22')](respondWithResult(_0x4ba0e4,null))[_0x9eea('0x42')](handleError(_0x4ba0e4,null));};exports['getSubjects']=function(_0x44086a,_0x21354a,_0x8d27aa){var _0x1daeb2={};var _0x32f930={};var _0x4e4816;var _0x4ee04d;return db[_0x9eea('0x2a')][_0x9eea('0x48')]({'where':{'id':_0x44086a[_0x9eea('0x44')]['id']}})['then'](handleEntityNotFound(_0x21354a,null))[_0x9eea('0x22')](function(_0x5f1442){if(_0x5f1442){_0x4e4816=_0x5f1442;_0x32f930[_0x9eea('0x2e')]=_[_0x9eea('0x31')](db[_0x9eea('0x49')][_0x9eea('0x2b')]);_0x32f930['query']=_['keys'](_0x44086a[_0x9eea('0x30')]);_0x32f930[_0x9eea('0x39')]=_[_0x9eea('0x32')](_0x32f930['model'],_0x32f930[_0x9eea('0x30')]);_0x1daeb2[_0x9eea('0x33')]=_[_0x9eea('0x32')](_0x32f930['model'],qs['fields'](_0x44086a['query'][_0x9eea('0x34')]));_0x1daeb2[_0x9eea('0x33')]=_0x1daeb2[_0x9eea('0x33')]['length']?_0x1daeb2[_0x9eea('0x33')]:_0x32f930[_0x9eea('0x2e')];_0x1daeb2['order']=qs['sort'](_0x44086a[_0x9eea('0x30')]['sort']);_0x1daeb2[_0x9eea('0x3e')]=qs['filters'](_[_0x9eea('0x3a')](_0x44086a['query'],_0x32f930[_0x9eea('0x39')]));if(_0x44086a[_0x9eea('0x30')][_0x9eea('0x3b')]){_0x1daeb2[_0x9eea('0x3e')]=_['merge'](_0x1daeb2[_0x9eea('0x3e')],{'$or':_[_0x9eea('0x2f')](_0x1daeb2[_0x9eea('0x33')],function(_0x38da1b){var _0xfc0e9a={};_0xfc0e9a[_0x38da1b]={'$like':'%'+_0x44086a[_0x9eea('0x30')][_0x9eea('0x3b')]+'%'};return _0xfc0e9a;})});}_0x1daeb2=_['merge']({},_0x1daeb2,_0x44086a[_0x9eea('0x3d')]);return _0x4e4816[_0x9eea('0x4b')](_0x1daeb2);}})['then'](function(_0x3aaee9){if(_0x3aaee9){_0x4ee04d=_0x3aaee9[_0x9eea('0x35')];if(!_0x44086a['query'][_0x9eea('0x4a')](_0x9eea('0x36'))){_0x1daeb2[_0x9eea('0x1d')]=qs[_0x9eea('0x1d')](_0x44086a[_0x9eea('0x30')]['limit']);_0x1daeb2[_0x9eea('0x1a')]=qs[_0x9eea('0x1a')](_0x44086a[_0x9eea('0x30')]['offset']);}return _0x4e4816[_0x9eea('0x4b')](_0x1daeb2);}})['then'](function(_0x4e7c90){if(_0x4e7c90){return _0x4e7c90?{'count':_0x4ee04d,'rows':_0x4e7c90}:null;}})['then'](respondWithResult(_0x21354a,null))['catch'](handleError(_0x21354a,null));};exports[_0x9eea('0x4c')]=function(_0x28c695,_0x2bde71,_0x25a526){var _0x26b8e5={};var _0x481760={};var _0x869b8a;var _0x31f9b5;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x28c695['params']['id']}})[_0x9eea('0x22')](handleEntityNotFound(_0x2bde71,null))[_0x9eea('0x22')](function(_0x4eb66d){if(_0x4eb66d){_0x869b8a=_0x4eb66d;_0x481760[_0x9eea('0x2e')]=_[_0x9eea('0x31')](db['ZohoField'][_0x9eea('0x2b')]);_0x481760['query']=_['keys'](_0x28c695['query']);_0x481760[_0x9eea('0x39')]=_[_0x9eea('0x32')](_0x481760[_0x9eea('0x2e')],_0x481760[_0x9eea('0x30')]);_0x26b8e5[_0x9eea('0x33')]=_[_0x9eea('0x32')](_0x481760['model'],qs['fields'](_0x28c695['query'][_0x9eea('0x34')]));_0x26b8e5['attributes']=_0x26b8e5['attributes'][_0x9eea('0x35')]?_0x26b8e5[_0x9eea('0x33')]:_0x481760[_0x9eea('0x2e')];_0x26b8e5[_0x9eea('0x37')]=qs[_0x9eea('0x38')](_0x28c695[_0x9eea('0x30')][_0x9eea('0x38')]);_0x26b8e5[_0x9eea('0x3e')]=qs[_0x9eea('0x39')](_[_0x9eea('0x3a')](_0x28c695[_0x9eea('0x30')],_0x481760[_0x9eea('0x39')]));if(_0x28c695[_0x9eea('0x30')]['filter']){_0x26b8e5[_0x9eea('0x3e')]=_['merge'](_0x26b8e5['where'],{'$or':_[_0x9eea('0x2f')](_0x26b8e5[_0x9eea('0x33')],function(_0x227903){var _0xe52434={};_0xe52434[_0x227903]={'$like':'%'+_0x28c695[_0x9eea('0x30')][_0x9eea('0x3b')]+'%'};return _0xe52434;})});}_0x26b8e5=_[_0x9eea('0x3c')]({},_0x26b8e5,_0x28c695[_0x9eea('0x3d')]);return _0x869b8a['getDescriptions'](_0x26b8e5);}})['then'](function(_0x444f00){if(_0x444f00){_0x31f9b5=_0x444f00[_0x9eea('0x35')];if(!_0x28c695[_0x9eea('0x30')][_0x9eea('0x4a')]('nolimit')){_0x26b8e5[_0x9eea('0x1d')]=qs['limit'](_0x28c695['query'][_0x9eea('0x1d')]);_0x26b8e5[_0x9eea('0x1a')]=qs[_0x9eea('0x1a')](_0x28c695[_0x9eea('0x30')]['offset']);}return _0x869b8a[_0x9eea('0x4c')](_0x26b8e5);}})[_0x9eea('0x22')](function(_0x8081c8){if(_0x8081c8){return _0x8081c8?{'count':_0x31f9b5,'rows':_0x8081c8}:null;}})['then'](respondWithResult(_0x2bde71,null))[_0x9eea('0x42')](handleError(_0x2bde71,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index b7700ec..f347223 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 _0x4a81=['../../config/environment','exports','ZohoConfiguration','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x6e1239,_0x3562ac){var _0x418150=function(_0x279f06){while(--_0x279f06){_0x6e1239['push'](_0x6e1239['shift']());}};_0x418150(++_0x3562ac);}(_0x4a81,0x137));var _0x14a8=function(_0xa99e39,_0x56c5e5){_0xa99e39=_0xa99e39-0x0;var _0x12400b=_0x4a81[_0xa99e39];return _0x12400b;};'use strict';var _=require(_0x14a8('0x0'));var util=require('util');var logger=require(_0x14a8('0x1'))(_0x14a8('0x2'));var moment=require(_0x14a8('0x3'));var BPromise=require(_0x14a8('0x4'));var rp=require(_0x14a8('0x5'));var fs=require('fs');var path=require(_0x14a8('0x6'));var rimraf=require(_0x14a8('0x7'));var config=require(_0x14a8('0x8'));var attributes=require('./intZohoConfiguration.attributes');module[_0x14a8('0x9')]=function(_0x7ed6b,_0x5377b8){return _0x7ed6b['define'](_0x14a8('0xa'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x616d=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','lodash'];(function(_0x44b792,_0x176619){var _0x2fd913=function(_0x375b16){while(--_0x375b16){_0x44b792['push'](_0x44b792['shift']());}};_0x2fd913(++_0x176619);}(_0x616d,0x81));var _0xd616=function(_0x3cccf1,_0x1ab506){_0x3cccf1=_0x3cccf1-0x0;var _0x3799be=_0x616d[_0x3cccf1];return _0x3799be;};'use strict';var _=require(_0xd616('0x0'));var util=require(_0xd616('0x1'));var logger=require('../../config/logger')(_0xd616('0x2'));var moment=require(_0xd616('0x3'));var BPromise=require(_0xd616('0x4'));var rp=require(_0xd616('0x5'));var fs=require('fs');var path=require(_0xd616('0x6'));var rimraf=require(_0xd616('0x7'));var config=require(_0xd616('0x8'));var attributes=require(_0xd616('0x9'));module[_0xd616('0xa')]=function(_0x122054,_0x3a9554){return _0x122054[_0xd616('0xb')]('ZohoConfiguration',attributes,{'tableName':_0xd616('0xc'),'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 a538739..f3508b6 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 _0x40b9=['http','request','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x1b85d7,_0x50e142){var _0x1c8a12=function(_0x216237){while(--_0x216237){_0x1b85d7['push'](_0x1b85d7['shift']());}};_0x1c8a12(++_0x50e142);}(_0x40b9,0xdc));var _0x940b=function(_0x10230f,_0xcaecbe){_0x10230f=_0x10230f-0x0;var _0x4a5d3e=_0x40b9[_0x10230f];return _0x4a5d3e;};'use strict';var _=require('lodash');var util=require(_0x940b('0x0'));var moment=require('moment');var BPromise=require(_0x940b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x940b('0x2'));var db=require(_0x940b('0x3'))['db'];var utils=require(_0x940b('0x4'));var logger=require(_0x940b('0x5'))('rpc');var config=require(_0x940b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x940b('0x7')][_0x940b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52672c,_0x40d3f2,_0xeca919){return new BPromise(function(_0x32bed8,_0x2fa12b){return client[_0x940b('0x9')](_0x52672c,_0xeca919)['then'](function(_0x229510){logger[_0x940b('0xa')]('ZohoConfiguration,\x20%s,\x20%s',_0x40d3f2,_0x940b('0xb'));logger[_0x940b('0xc')](_0x940b('0xd'),_0x40d3f2,'request\x20sent',JSON['stringify'](_0x229510));if(_0x229510[_0x940b('0xe')]){if(_0x229510[_0x940b('0xe')]['code']===0x1f4){logger['error'](_0x940b('0xf'),_0x40d3f2,_0x229510['error'][_0x940b('0x10')]);return _0x2fa12b(_0x229510[_0x940b('0xe')][_0x940b('0x10')]);}logger[_0x940b('0xe')](_0x940b('0xf'),_0x40d3f2,_0x229510[_0x940b('0xe')]['message']);return _0x32bed8(_0x229510[_0x940b('0xe')][_0x940b('0x10')]);}else{logger['info'](_0x940b('0xf'),_0x40d3f2,_0x940b('0xb'));_0x32bed8(_0x229510[_0x940b('0x11')][_0x940b('0x10')]);}})[_0x940b('0x12')](function(_0x483963){logger[_0x940b('0xe')](_0x940b('0xf'),_0x40d3f2,_0x483963);_0x2fa12b(_0x483963);});});} \ No newline at end of file +var _0x24c6=['info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x4c2faa,_0x1925eb){var _0x5328ff=function(_0x4241fe){while(--_0x4241fe){_0x4c2faa['push'](_0x4c2faa['shift']());}};_0x5328ff(++_0x1925eb);}(_0x24c6,0x14b));var _0x624c=function(_0x1aecf7,_0x41c2df){_0x1aecf7=_0x1aecf7-0x0;var _0x1fdc44=_0x24c6[_0x1aecf7];return _0x1fdc44;};'use strict';var _=require('lodash');var util=require(_0x624c('0x0'));var moment=require(_0x624c('0x1'));var BPromise=require(_0x624c('0x2'));var rs=require(_0x624c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x624c('0x4'))(_0x624c('0x5'));var config=require(_0x624c('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x624c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2911bd,_0x3bf4fb,_0x54aa9b){return new BPromise(function(_0x1541e7,_0x324abd){return client[_0x624c('0x8')](_0x2911bd,_0x54aa9b)['then'](function(_0x1b9f70){logger[_0x624c('0x9')](_0x624c('0xa'),_0x3bf4fb,_0x624c('0xb'));logger[_0x624c('0xc')](_0x624c('0xd'),_0x3bf4fb,_0x624c('0xb'),JSON[_0x624c('0xe')](_0x1b9f70));if(_0x1b9f70[_0x624c('0xf')]){if(_0x1b9f70[_0x624c('0xf')][_0x624c('0x10')]===0x1f4){logger[_0x624c('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x3bf4fb,_0x1b9f70[_0x624c('0xf')][_0x624c('0x11')]);return _0x324abd(_0x1b9f70[_0x624c('0xf')][_0x624c('0x11')]);}logger['error'](_0x624c('0xa'),_0x3bf4fb,_0x1b9f70[_0x624c('0xf')][_0x624c('0x11')]);return _0x1541e7(_0x1b9f70[_0x624c('0xf')]['message']);}else{logger[_0x624c('0x9')](_0x624c('0xa'),_0x3bf4fb,_0x624c('0xb'));_0x1541e7(_0x1b9f70[_0x624c('0x12')][_0x624c('0x11')]);}})[_0x624c('0x13')](function(_0x58c2d1){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x3bf4fb,_0x58c2d1);_0x324abd(_0x58c2d1);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 9933ba2..e7e693b 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 _0xa4e7=['isAuthenticated','index','get','/:id','post','create','put','delete','destroy','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller'];(function(_0x586e77,_0x48a175){var _0x1a752b=function(_0x3ecb53){while(--_0x3ecb53){_0x586e77['push'](_0x586e77['shift']());}};_0x1a752b(++_0x48a175);}(_0xa4e7,0x17f));var _0x7a4e=function(_0x1d5c4e,_0x1fdb36){_0x1d5c4e=_0x1d5c4e-0x0;var _0x2b3631=_0xa4e7[_0x1d5c4e];return _0x2b3631;};'use strict';var multer=require(_0x7a4e('0x0'));var util=require(_0x7a4e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7a4e('0x2'));var router=express[_0x7a4e('0x3')]();var fs_extra=require(_0x7a4e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7a4e('0x5'));var config=require(_0x7a4e('0x6'));var controller=require(_0x7a4e('0x7'));router['get']('/',auth[_0x7a4e('0x8')](),controller[_0x7a4e('0x9')]);router[_0x7a4e('0xa')](_0x7a4e('0xb'),auth[_0x7a4e('0x8')](),controller['show']);router[_0x7a4e('0xc')]('/',auth[_0x7a4e('0x8')](),controller[_0x7a4e('0xd')]);router[_0x7a4e('0xe')](_0x7a4e('0xb'),auth[_0x7a4e('0x8')](),controller['update']);router[_0x7a4e('0xf')]('/:id',auth[_0x7a4e('0x8')](),controller[_0x7a4e('0x10')]);module['exports']=router; \ No newline at end of file +var _0x712b=['Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoField.controller','isAuthenticated','index','get','show','put','/:id','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x712b,0xd4));var _0xb712=function(_0x2e2c3d,_0x86efac){_0x2e2c3d=_0x2e2c3d-0x0;var _0x2b9c92=_0x712b[_0x2e2c3d];return _0x2b9c92;};'use strict';var multer=require(_0xb712('0x0'));var util=require('util');var path=require(_0xb712('0x1'));var timeout=require(_0xb712('0x2'));var express=require(_0xb712('0x3'));var router=express[_0xb712('0x4')]();var fs_extra=require(_0xb712('0x5'));var auth=require(_0xb712('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb712('0x7'));var controller=require(_0xb712('0x8'));router['get']('/',auth[_0xb712('0x9')](),controller[_0xb712('0xa')]);router[_0xb712('0xb')]('/:id',auth[_0xb712('0x9')](),controller[_0xb712('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xb712('0xd')](_0xb712('0xe'),auth[_0xb712('0x9')](),controller[_0xb712('0xf')]);router['delete'](_0xb712('0xe'),auth[_0xb712('0x9')](),controller[_0xb712('0x10')]);module[_0xb712('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 6e1b3d1..90ba7e5 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 _0x9408=['BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable'];(function(_0x422b75,_0x598da1){var _0x3e6194=function(_0xa4daad){while(--_0xa4daad){_0x422b75['push'](_0x422b75['shift']());}};_0x3e6194(++_0x598da1);}(_0x9408,0x1eb));var _0x8940=function(_0xd41070,_0x32229d){_0xd41070=_0xd41070-0x0;var _0xbd475=_0x9408[_0xd41070];return _0xbd475;};'use strict';var Sequelize=require(_0x8940('0x0'));module[_0x8940('0x1')]={'type':{'type':Sequelize[_0x8940('0x2')](_0x8940('0x3'),'variable',_0x8940('0x4'),_0x8940('0x5'),_0x8940('0x6')),'defaultValue':_0x8940('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8940('0x7')]},'keyType':{'type':Sequelize[_0x8940('0x2')](_0x8940('0x3'),_0x8940('0x8'),_0x8940('0x4'))},'keyContent':{'type':Sequelize[_0x8940('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8940('0x7')]},'customField':{'type':Sequelize[_0x8940('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdc92=['picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0xf8f772,_0x26d95e){var _0x27583f=function(_0x39d1f1){while(--_0x39d1f1){_0xf8f772['push'](_0xf8f772['shift']());}};_0x27583f(++_0x26d95e);}(_0xdc92,0xda));var _0x2dc9=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xdc92[_0x2dadb9];return _0x2f0097;};'use strict';var Sequelize=require(_0x2dc9('0x0'));module[_0x2dc9('0x1')]={'type':{'type':Sequelize[_0x2dc9('0x2')](_0x2dc9('0x3'),_0x2dc9('0x4'),_0x2dc9('0x5'),_0x2dc9('0x6'),_0x2dc9('0x7')),'defaultValue':_0x2dc9('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2dc9('0x8')]},'keyType':{'type':Sequelize[_0x2dc9('0x2')](_0x2dc9('0x3'),_0x2dc9('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x2dc9('0x8')]},'idField':{'type':Sequelize[_0x2dc9('0x8')]},'nameField':{'type':Sequelize[_0x2dc9('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index b2b18f6..65f4246 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 _0x9bd1=['ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','then','destroy','stack','name','send','index','map','fieldName','type','key','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','ZohoField','findAll','rows','catch','params','rawAttributes','keys','include','find','create','body','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv'];(function(_0x17367c,_0x55ee6a){var _0x4b36b1=function(_0x153ff4){while(--_0x153ff4){_0x17367c['push'](_0x17367c['shift']());}};_0x4b36b1(++_0x55ee6a);}(_0x9bd1,0x155));var _0x19bd=function(_0x4e3100,_0x17a186){_0x4e3100=_0x4e3100-0x0;var _0x108467=_0x9bd1[_0x4e3100];return _0x108467;};'use strict';var emlformat=require(_0x19bd('0x0'));var rimraf=require(_0x19bd('0x1'));var zipdir=require(_0x19bd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x19bd('0x3'));var moment=require(_0x19bd('0x4'));var BPromise=require(_0x19bd('0x5'));var Mustache=require('mustache');var util=require(_0x19bd('0x6'));var path=require('path');var sox=require(_0x19bd('0x7'));var csv=require(_0x19bd('0x8'));var ejs=require(_0x19bd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x19bd('0xa'));var crypto=require('crypto');var jsforce=require(_0x19bd('0xb'));var deskjs=require(_0x19bd('0xc'));var toCsv=require(_0x19bd('0x8'));var querystring=require(_0x19bd('0xd'));var Papa=require(_0x19bd('0xe'));var Redis=require(_0x19bd('0xf'));var authService=require(_0x19bd('0x10'));var qs=require(_0x19bd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x19bd('0x12'));var logger=require('../../config/logger')(_0x19bd('0x13'));var utils=require(_0x19bd('0x14'));var config=require(_0x19bd('0x15'));var licenseUtil=require(_0x19bd('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1721de,_0x28313b){_0x28313b=_0x28313b||0xcc;return function(_0x3f12f3){if(_0x3f12f3){return _0x1721de[_0x19bd('0x17')](_0x28313b);}return _0x1721de[_0x19bd('0x18')](_0x28313b)[_0x19bd('0x19')]();};}function respondWithResult(_0x58db89,_0x6466ec){_0x6466ec=_0x6466ec||0xc8;return function(_0x5e03c5){if(_0x5e03c5){return _0x58db89[_0x19bd('0x18')](_0x6466ec)[_0x19bd('0x1a')](_0x5e03c5);}};}function respondWithFilteredResult(_0x4ab30d,_0x578de7){return function(_0x130163){if(_0x130163){var _0x507e53=typeof _0x578de7[_0x19bd('0x1b')]===_0x19bd('0x1c')&&typeof _0x578de7[_0x19bd('0x1d')]===_0x19bd('0x1c');var _0x3b9483=_0x130163[_0x19bd('0x1e')];var _0x3708fa=_0x507e53?0x0:_0x578de7[_0x19bd('0x1b')];var _0x49b3a8=_0x507e53?_0x130163[_0x19bd('0x1e')]:_0x578de7[_0x19bd('0x1b')]+_0x578de7[_0x19bd('0x1d')];var _0x402c7d;if(_0x49b3a8>=_0x3b9483){_0x49b3a8=_0x3b9483;_0x402c7d=0xc8;}else{_0x402c7d=0xce;}_0x4ab30d[_0x19bd('0x18')](_0x402c7d);return _0x4ab30d['set']('Content-Range',_0x3708fa+'-'+_0x49b3a8+'/'+_0x3b9483)[_0x19bd('0x1a')](_0x130163);}return null;};}function patchUpdates(_0x4c87dd){return function(_0x256210){try{jsonpatch['apply'](_0x256210,_0x4c87dd,!![]);}catch(_0x3d6535){return BPromise[_0x19bd('0x1f')](_0x3d6535);}return _0x256210[_0x19bd('0x20')]();};}function saveUpdates(_0x396afa,_0x323f4a){return function(_0x3d26b0){if(_0x3d26b0){return _0x3d26b0['update'](_0x396afa)[_0x19bd('0x21')](function(_0x33141e){return _0x33141e;});}return null;};}function removeEntity(_0x1779e5,_0x30034a){return function(_0x49afb2){if(_0x49afb2){return _0x49afb2[_0x19bd('0x22')]()[_0x19bd('0x21')](function(){_0x1779e5[_0x19bd('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32748b,_0x40de24){return function(_0x3732b0){if(!_0x3732b0){_0x32748b['sendStatus'](0x194);}return _0x3732b0;};}function handleError(_0x2f55b6,_0x101f38){_0x101f38=_0x101f38||0x1f4;return function(_0x2bbed6){logger['error'](_0x2bbed6[_0x19bd('0x23')]);if(_0x2bbed6[_0x19bd('0x24')]){delete _0x2bbed6[_0x19bd('0x24')];}_0x2f55b6[_0x19bd('0x18')](_0x101f38)[_0x19bd('0x25')](_0x2bbed6);};}exports[_0x19bd('0x26')]=function(_0x4081b1,_0x20040e){var _0x543713={},_0x51a7fe={},_0x281bd1={'count':0x0,'rows':[]};var _0x4dc238=_[_0x19bd('0x27')](db['ZohoField']['rawAttributes'],function(_0x4f5adb){return{'name':_0x4f5adb[_0x19bd('0x28')],'type':_0x4f5adb[_0x19bd('0x29')][_0x19bd('0x2a')]};});_0x51a7fe['model']=_['map'](_0x4dc238,_0x19bd('0x24'));_0x51a7fe['query']=_['keys'](_0x4081b1[_0x19bd('0x2b')]);_0x51a7fe[_0x19bd('0x2c')]=_[_0x19bd('0x2d')](_0x51a7fe['model'],_0x51a7fe[_0x19bd('0x2b')]);_0x543713[_0x19bd('0x2e')]=_[_0x19bd('0x2d')](_0x51a7fe[_0x19bd('0x2f')],qs['fields'](_0x4081b1['query'][_0x19bd('0x30')]));_0x543713[_0x19bd('0x2e')]=_0x543713['attributes']['length']?_0x543713[_0x19bd('0x2e')]:_0x51a7fe[_0x19bd('0x2f')];if(!_0x4081b1['query'][_0x19bd('0x31')](_0x19bd('0x32'))){_0x543713['limit']=qs['limit'](_0x4081b1[_0x19bd('0x2b')][_0x19bd('0x1d')]);_0x543713[_0x19bd('0x1b')]=qs['offset'](_0x4081b1['query']['offset']);}_0x543713[_0x19bd('0x33')]=qs['sort'](_0x4081b1[_0x19bd('0x2b')][_0x19bd('0x34')]);_0x543713[_0x19bd('0x35')]=qs[_0x19bd('0x2c')](_[_0x19bd('0x36')](_0x4081b1['query'],_0x51a7fe['filters']),_0x4dc238);if(_0x4081b1[_0x19bd('0x2b')][_0x19bd('0x37')]){_0x543713[_0x19bd('0x35')]=_['merge'](_0x543713['where'],{'$or':_[_0x19bd('0x27')](_0x4dc238,function(_0x4544f8){if(_0x4544f8[_0x19bd('0x29')]!=='VIRTUAL'){var _0x5935ec={};_0x5935ec[_0x4544f8[_0x19bd('0x24')]]={'$like':'%'+_0x4081b1[_0x19bd('0x2b')][_0x19bd('0x37')]+'%'};return _0x5935ec;}})});}_0x543713=_[_0x19bd('0x38')]({},_0x543713,_0x4081b1[_0x19bd('0x39')]);var _0xf534fb={'where':_0x543713['where']};return db[_0x19bd('0x3a')][_0x19bd('0x1e')](_0xf534fb)[_0x19bd('0x21')](function(_0x2089c3){_0x281bd1[_0x19bd('0x1e')]=_0x2089c3;if(_0x4081b1[_0x19bd('0x2b')]['includeAll']){_0x543713['include']=[{'all':!![]}];}return db[_0x19bd('0x3a')][_0x19bd('0x3b')](_0x543713);})['then'](function(_0x6e3e4c){_0x281bd1[_0x19bd('0x3c')]=_0x6e3e4c;return _0x281bd1;})[_0x19bd('0x21')](respondWithFilteredResult(_0x20040e,_0x543713))[_0x19bd('0x3d')](handleError(_0x20040e,null));};exports['show']=function(_0x192136,_0x2a21a5){var _0x2e2e82={'raw':!![],'where':{'id':_0x192136[_0x19bd('0x3e')]['id']}},_0x40ad93={};_0x40ad93['model']=_['keys'](db[_0x19bd('0x3a')][_0x19bd('0x3f')]);_0x40ad93['query']=_[_0x19bd('0x40')](_0x192136[_0x19bd('0x2b')]);_0x40ad93[_0x19bd('0x2c')]=_['intersection'](_0x40ad93['model'],_0x40ad93[_0x19bd('0x2b')]);_0x2e2e82[_0x19bd('0x2e')]=_['intersection'](_0x40ad93[_0x19bd('0x2f')],qs['fields'](_0x192136[_0x19bd('0x2b')][_0x19bd('0x30')]));_0x2e2e82['attributes']=_0x2e2e82[_0x19bd('0x2e')]['length']?_0x2e2e82[_0x19bd('0x2e')]:_0x40ad93[_0x19bd('0x2f')];if(_0x192136[_0x19bd('0x2b')]['includeAll']){_0x2e2e82[_0x19bd('0x41')]=[{'all':!![]}];}_0x2e2e82=_[_0x19bd('0x38')]({},_0x2e2e82,_0x192136[_0x19bd('0x39')]);return db[_0x19bd('0x3a')][_0x19bd('0x42')](_0x2e2e82)[_0x19bd('0x21')](handleEntityNotFound(_0x2a21a5,null))['then'](respondWithResult(_0x2a21a5,null))[_0x19bd('0x3d')](handleError(_0x2a21a5,null));};exports['create']=function(_0x410121,_0x8fff12){return db[_0x19bd('0x3a')][_0x19bd('0x43')](_0x410121[_0x19bd('0x44')],{})[_0x19bd('0x21')](respondWithResult(_0x8fff12,0xc9))['catch'](handleError(_0x8fff12,null));};exports[_0x19bd('0x45')]=function(_0x25a1cb,_0x1cbc30){if(_0x25a1cb[_0x19bd('0x44')]['id']){delete _0x25a1cb['body']['id'];}return db[_0x19bd('0x3a')][_0x19bd('0x42')]({'where':{'id':_0x25a1cb[_0x19bd('0x3e')]['id']}})[_0x19bd('0x21')](handleEntityNotFound(_0x1cbc30,null))[_0x19bd('0x21')](saveUpdates(_0x25a1cb['body'],null))[_0x19bd('0x21')](respondWithResult(_0x1cbc30,null))[_0x19bd('0x3d')](handleError(_0x1cbc30,null));};exports[_0x19bd('0x22')]=function(_0x10eaea,_0x4cd62e){return db[_0x19bd('0x3a')][_0x19bd('0x42')]({'where':{'id':_0x10eaea[_0x19bd('0x3e')]['id']}})[_0x19bd('0x21')](handleEntityNotFound(_0x4cd62e,null))[_0x19bd('0x21')](removeEntity(_0x4cd62e,null))[_0x19bd('0x3d')](handleError(_0x4cd62e,null));}; \ No newline at end of file +var _0x45ca=['intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','map','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','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','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','status','Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','send','index','ZohoField','rawAttributes','fieldName','model','keys','query','filters','attributes'];(function(_0x374b56,_0x564b00){var _0x4d65ff=function(_0x4d4439){while(--_0x4d4439){_0x374b56['push'](_0x374b56['shift']());}};_0x4d65ff(++_0x564b00);}(_0x45ca,0xfa));var _0xa45c=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x45ca[_0x4d8ed9];return _0x1e2140;};'use strict';var emlformat=require(_0xa45c('0x0'));var rimraf=require(_0xa45c('0x1'));var zipdir=require(_0xa45c('0x2'));var jsonpatch=require(_0xa45c('0x3'));var rp=require(_0xa45c('0x4'));var moment=require(_0xa45c('0x5'));var BPromise=require(_0xa45c('0x6'));var Mustache=require('mustache');var util=require(_0xa45c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa45c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa45c('0x9'));var _=require(_0xa45c('0xa'));var squel=require(_0xa45c('0xb'));var crypto=require(_0xa45c('0xc'));var jsforce=require(_0xa45c('0xd'));var deskjs=require(_0xa45c('0xe'));var toCsv=require(_0xa45c('0x8'));var querystring=require(_0xa45c('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa45c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa45c('0x11'));var hardwareService=require(_0xa45c('0x12'));var logger=require(_0xa45c('0x13'))(_0xa45c('0x14'));var utils=require(_0xa45c('0x15'));var config=require(_0xa45c('0x16'));var licenseUtil=require(_0xa45c('0x17'));var db=require(_0xa45c('0x18'))['db'];function respondWithStatusCode(_0x586723,_0xad029e){_0xad029e=_0xad029e||0xcc;return function(_0x43bc3a){if(_0x43bc3a){return _0x586723['sendStatus'](_0xad029e);}return _0x586723['status'](_0xad029e)[_0xa45c('0x19')]();};}function respondWithResult(_0x3efd47,_0x44aade){_0x44aade=_0x44aade||0xc8;return function(_0xe672){if(_0xe672){return _0x3efd47['status'](_0x44aade)[_0xa45c('0x1a')](_0xe672);}};}function respondWithFilteredResult(_0x2a464a,_0x520b59){return function(_0x2e3fc2){if(_0x2e3fc2){var _0x4b146a=typeof _0x520b59[_0xa45c('0x1b')]===_0xa45c('0x1c')&&typeof _0x520b59['limit']===_0xa45c('0x1c');var _0x56b0f0=_0x2e3fc2['count'];var _0x20f26a=_0x4b146a?0x0:_0x520b59[_0xa45c('0x1b')];var _0x30f613=_0x4b146a?_0x2e3fc2['count']:_0x520b59[_0xa45c('0x1b')]+_0x520b59[_0xa45c('0x1d')];var _0x2cc886;if(_0x30f613>=_0x56b0f0){_0x30f613=_0x56b0f0;_0x2cc886=0xc8;}else{_0x2cc886=0xce;}_0x2a464a[_0xa45c('0x1e')](_0x2cc886);return _0x2a464a['set'](_0xa45c('0x1f'),_0x20f26a+'-'+_0x30f613+'/'+_0x56b0f0)['json'](_0x2e3fc2);}return null;};}function patchUpdates(_0x157481){return function(_0x2145d7){try{jsonpatch['apply'](_0x2145d7,_0x157481,!![]);}catch(_0x3c8ef4){return BPromise[_0xa45c('0x20')](_0x3c8ef4);}return _0x2145d7[_0xa45c('0x21')]();};}function saveUpdates(_0x2ad87a,_0x47a6ca){return function(_0x33c7ef){if(_0x33c7ef){return _0x33c7ef['update'](_0x2ad87a)[_0xa45c('0x22')](function(_0x4b005a){return _0x4b005a;});}return null;};}function removeEntity(_0x26c463,_0x326512){return function(_0x8037f2){if(_0x8037f2){return _0x8037f2[_0xa45c('0x23')]()[_0xa45c('0x22')](function(){_0x26c463[_0xa45c('0x1e')](0xcc)[_0xa45c('0x19')]();});}};}function handleEntityNotFound(_0x442122,_0x3e00c8){return function(_0x27d575){if(!_0x27d575){_0x442122[_0xa45c('0x24')](0x194);}return _0x27d575;};}function handleError(_0x5ca0ba,_0x21bad1){_0x21bad1=_0x21bad1||0x1f4;return function(_0x41189c){logger[_0xa45c('0x25')](_0x41189c[_0xa45c('0x26')]);if(_0x41189c[_0xa45c('0x27')]){delete _0x41189c['name'];}_0x5ca0ba['status'](_0x21bad1)[_0xa45c('0x28')](_0x41189c);};}exports[_0xa45c('0x29')]=function(_0x5b6d74,_0x312b10){var _0x5e3cce={},_0x4d0f29={},_0x22be0d={'count':0x0,'rows':[]};var _0x5c3385=_['map'](db[_0xa45c('0x2a')][_0xa45c('0x2b')],function(_0x2fb838){return{'name':_0x2fb838[_0xa45c('0x2c')],'type':_0x2fb838['type']['key']};});_0x4d0f29[_0xa45c('0x2d')]=_['map'](_0x5c3385,'name');_0x4d0f29['query']=_[_0xa45c('0x2e')](_0x5b6d74[_0xa45c('0x2f')]);_0x4d0f29[_0xa45c('0x30')]=_['intersection'](_0x4d0f29[_0xa45c('0x2d')],_0x4d0f29[_0xa45c('0x2f')]);_0x5e3cce[_0xa45c('0x31')]=_[_0xa45c('0x32')](_0x4d0f29['model'],qs[_0xa45c('0x33')](_0x5b6d74['query'][_0xa45c('0x33')]));_0x5e3cce[_0xa45c('0x31')]=_0x5e3cce[_0xa45c('0x31')][_0xa45c('0x34')]?_0x5e3cce[_0xa45c('0x31')]:_0x4d0f29[_0xa45c('0x2d')];if(!_0x5b6d74[_0xa45c('0x2f')][_0xa45c('0x35')](_0xa45c('0x36'))){_0x5e3cce[_0xa45c('0x1d')]=qs['limit'](_0x5b6d74[_0xa45c('0x2f')][_0xa45c('0x1d')]);_0x5e3cce[_0xa45c('0x1b')]=qs[_0xa45c('0x1b')](_0x5b6d74[_0xa45c('0x2f')][_0xa45c('0x1b')]);}_0x5e3cce[_0xa45c('0x37')]=qs['sort'](_0x5b6d74[_0xa45c('0x2f')]['sort']);_0x5e3cce[_0xa45c('0x38')]=qs[_0xa45c('0x30')](_[_0xa45c('0x39')](_0x5b6d74[_0xa45c('0x2f')],_0x4d0f29[_0xa45c('0x30')]),_0x5c3385);if(_0x5b6d74[_0xa45c('0x2f')][_0xa45c('0x3a')]){_0x5e3cce[_0xa45c('0x38')]=_[_0xa45c('0x3b')](_0x5e3cce[_0xa45c('0x38')],{'$or':_[_0xa45c('0x3c')](_0x5c3385,function(_0x433dd4){if(_0x433dd4['type']!==_0xa45c('0x3d')){var _0x5b401d={};_0x5b401d[_0x433dd4['name']]={'$like':'%'+_0x5b6d74['query'][_0xa45c('0x3a')]+'%'};return _0x5b401d;}})});}_0x5e3cce=_[_0xa45c('0x3b')]({},_0x5e3cce,_0x5b6d74[_0xa45c('0x3e')]);var _0x3beed7={'where':_0x5e3cce[_0xa45c('0x38')]};return db['ZohoField'][_0xa45c('0x3f')](_0x3beed7)[_0xa45c('0x22')](function(_0x28efb8){_0x22be0d[_0xa45c('0x3f')]=_0x28efb8;if(_0x5b6d74['query'][_0xa45c('0x40')]){_0x5e3cce[_0xa45c('0x41')]=[{'all':!![]}];}return db[_0xa45c('0x2a')][_0xa45c('0x42')](_0x5e3cce);})['then'](function(_0x5a362b){_0x22be0d[_0xa45c('0x43')]=_0x5a362b;return _0x22be0d;})['then'](respondWithFilteredResult(_0x312b10,_0x5e3cce))[_0xa45c('0x44')](handleError(_0x312b10,null));};exports[_0xa45c('0x45')]=function(_0x34a6c8,_0x3c5487){var _0x51bee4={'raw':!![],'where':{'id':_0x34a6c8[_0xa45c('0x46')]['id']}},_0x357ebe={};_0x357ebe[_0xa45c('0x2d')]=_[_0xa45c('0x2e')](db['ZohoField']['rawAttributes']);_0x357ebe[_0xa45c('0x2f')]=_[_0xa45c('0x2e')](_0x34a6c8['query']);_0x357ebe[_0xa45c('0x30')]=_[_0xa45c('0x32')](_0x357ebe[_0xa45c('0x2d')],_0x357ebe[_0xa45c('0x2f')]);_0x51bee4['attributes']=_['intersection'](_0x357ebe[_0xa45c('0x2d')],qs[_0xa45c('0x33')](_0x34a6c8[_0xa45c('0x2f')][_0xa45c('0x33')]));_0x51bee4[_0xa45c('0x31')]=_0x51bee4[_0xa45c('0x31')][_0xa45c('0x34')]?_0x51bee4[_0xa45c('0x31')]:_0x357ebe[_0xa45c('0x2d')];if(_0x34a6c8[_0xa45c('0x2f')][_0xa45c('0x40')]){_0x51bee4['include']=[{'all':!![]}];}_0x51bee4=_[_0xa45c('0x3b')]({},_0x51bee4,_0x34a6c8[_0xa45c('0x3e')]);return db[_0xa45c('0x2a')][_0xa45c('0x47')](_0x51bee4)[_0xa45c('0x22')](handleEntityNotFound(_0x3c5487,null))[_0xa45c('0x22')](respondWithResult(_0x3c5487,null))[_0xa45c('0x44')](handleError(_0x3c5487,null));};exports[_0xa45c('0x48')]=function(_0x2bc589,_0x383760){return db[_0xa45c('0x2a')]['create'](_0x2bc589['body'],{})[_0xa45c('0x22')](respondWithResult(_0x383760,0xc9))[_0xa45c('0x44')](handleError(_0x383760,null));};exports[_0xa45c('0x49')]=function(_0x76404b,_0x22436f){if(_0x76404b[_0xa45c('0x4a')]['id']){delete _0x76404b[_0xa45c('0x4a')]['id'];}return db[_0xa45c('0x2a')][_0xa45c('0x47')]({'where':{'id':_0x76404b[_0xa45c('0x46')]['id']}})[_0xa45c('0x22')](handleEntityNotFound(_0x22436f,null))[_0xa45c('0x22')](saveUpdates(_0x76404b[_0xa45c('0x4a')],null))[_0xa45c('0x22')](respondWithResult(_0x22436f,null))[_0xa45c('0x44')](handleError(_0x22436f,null));};exports['destroy']=function(_0x2b6d2a,_0xc08d92){return db[_0xa45c('0x2a')][_0xa45c('0x47')]({'where':{'id':_0x2b6d2a[_0xa45c('0x46')]['id']}})[_0xa45c('0x22')](handleEntityNotFound(_0xc08d92,null))[_0xa45c('0x22')](removeEntity(_0xc08d92,null))['catch'](handleError(_0xc08d92,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 838af4d..768a5a1 100644 --- a/server/api/intZohoField/intZohoField.model.js +++ b/server/api/intZohoField/intZohoField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd943=['api','bluebird','request-promise','path','rimraf','../../config/environment','int_zoho_fields','zoho_unique_index','lodash','util','../../config/logger'];(function(_0x40497b,_0x6be374){var _0x140ad6=function(_0x357485){while(--_0x357485){_0x40497b['push'](_0x40497b['shift']());}};_0x140ad6(++_0x6be374);}(_0xd943,0x15d));var _0x3d94=function(_0x48863d,_0x33ffbb){_0x48863d=_0x48863d-0x0;var _0x27dabe=_0xd943[_0x48863d];return _0x27dabe;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var logger=require(_0x3d94('0x2'))(_0x3d94('0x3'));var moment=require('moment');var BPromise=require(_0x3d94('0x4'));var rp=require(_0x3d94('0x5'));var fs=require('fs');var path=require(_0x3d94('0x6'));var rimraf=require(_0x3d94('0x7'));var config=require(_0x3d94('0x8'));var attributes=require('./intZohoField.attributes');module['exports']=function(_0x34c9c3,_0x51cf1f){return _0x34c9c3['define']('ZohoField',attributes,{'tableName':_0x3d94('0x9'),'paranoid':![],'indexes':[{'name':_0x3d94('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x57ca=['moment','bluebird','request-promise','path','rimraf','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','util','../../config/logger'];(function(_0x343e07,_0x32ff6b){var _0x28c0a7=function(_0x5db7eb){while(--_0x5db7eb){_0x343e07['push'](_0x343e07['shift']());}};_0x28c0a7(++_0x32ff6b);}(_0x57ca,0x108));var _0xa57c=function(_0x2aee5d,_0x487ce9){_0x2aee5d=_0x2aee5d-0x0;var _0x4fe74b=_0x57ca[_0x2aee5d];return _0x4fe74b;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var logger=require(_0xa57c('0x1'))('api');var moment=require(_0xa57c('0x2'));var BPromise=require(_0xa57c('0x3'));var rp=require(_0xa57c('0x4'));var fs=require('fs');var path=require(_0xa57c('0x5'));var rimraf=require(_0xa57c('0x6'));var config=require('../../config/environment');var attributes=require(_0xa57c('0x7'));module[_0xa57c('0x8')]=function(_0x113dcf,_0x19473f){return _0x113dcf[_0xa57c('0x9')](_0xa57c('0xa'),attributes,{'tableName':_0xa57c('0xb'),'paranoid':![],'indexes':[{'name':_0xa57c('0xc'),'fields':['idField',_0xa57c('0xd')],'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 c0f7814..b95b8cc 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 _0x6b16=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x3c0dbb,_0x6242df){var _0x5d2263=function(_0x1ef006){while(--_0x1ef006){_0x3c0dbb['push'](_0x3c0dbb['shift']());}};_0x5d2263(++_0x6242df);}(_0x6b16,0xd1));var _0x66b1=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0x6b16[_0x4c440b];return _0x2d48cf;};'use strict';var _=require(_0x66b1('0x0'));var util=require('util');var moment=require(_0x66b1('0x1'));var BPromise=require(_0x66b1('0x2'));var rs=require(_0x66b1('0x3'));var fs=require('fs');var Redis=require(_0x66b1('0x4'));var db=require(_0x66b1('0x5'))['db'];var utils=require(_0x66b1('0x6'));var logger=require('../../config/logger')(_0x66b1('0x7'));var config=require(_0x66b1('0x8'));var jayson=require(_0x66b1('0x9'));var client=jayson[_0x66b1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25d1e0,_0x31bf44,_0x52a1ae){return new BPromise(function(_0x298251,_0x30cfb2){return client[_0x66b1('0xb')](_0x25d1e0,_0x52a1ae)['then'](function(_0x1514c1){logger['info'](_0x66b1('0xc'),_0x31bf44,_0x66b1('0xd'));logger['debug'](_0x66b1('0xe'),_0x31bf44,_0x66b1('0xd'),JSON[_0x66b1('0xf')](_0x1514c1));if(_0x1514c1[_0x66b1('0x10')]){if(_0x1514c1[_0x66b1('0x10')][_0x66b1('0x11')]===0x1f4){logger[_0x66b1('0x10')](_0x66b1('0xc'),_0x31bf44,_0x1514c1[_0x66b1('0x10')][_0x66b1('0x12')]);return _0x30cfb2(_0x1514c1[_0x66b1('0x10')][_0x66b1('0x12')]);}logger[_0x66b1('0x10')]('ZohoField,\x20%s,\x20%s',_0x31bf44,_0x1514c1[_0x66b1('0x10')]['message']);return _0x298251(_0x1514c1['error'][_0x66b1('0x12')]);}else{logger['info'](_0x66b1('0xc'),_0x31bf44,_0x66b1('0xd'));_0x298251(_0x1514c1[_0x66b1('0x13')]['message']);}})[_0x66b1('0x14')](function(_0x109afc){logger[_0x66b1('0x10')](_0x66b1('0xc'),_0x31bf44,_0x109afc);_0x30cfb2(_0x109afc);});});} \ No newline at end of file +var _0x8c20=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x430216,_0xea1437){var _0x1cb983=function(_0x27dad0){while(--_0x27dad0){_0x430216['push'](_0x430216['shift']());}};_0x1cb983(++_0xea1437);}(_0x8c20,0x1b1));var _0x08c2=function(_0x1005d4,_0x5199ab){_0x1005d4=_0x1005d4-0x0;var _0x421977=_0x8c20[_0x1005d4];return _0x421977;};'use strict';var _=require(_0x08c2('0x0'));var util=require(_0x08c2('0x1'));var moment=require(_0x08c2('0x2'));var BPromise=require(_0x08c2('0x3'));var rs=require(_0x08c2('0x4'));var fs=require('fs');var Redis=require(_0x08c2('0x5'));var db=require(_0x08c2('0x6'))['db'];var utils=require(_0x08c2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x08c2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x08c2('0x9')][_0x08c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57ddbe,_0x4fe84c,_0x40ffb8){return new BPromise(function(_0x5c365e,_0x4ff7b8){return client[_0x08c2('0xb')](_0x57ddbe,_0x40ffb8)[_0x08c2('0xc')](function(_0x335262){logger[_0x08c2('0xd')](_0x08c2('0xe'),_0x4fe84c,_0x08c2('0xf'));logger['debug'](_0x08c2('0x10'),_0x4fe84c,'request\x20sent',JSON[_0x08c2('0x11')](_0x335262));if(_0x335262[_0x08c2('0x12')]){if(_0x335262[_0x08c2('0x12')][_0x08c2('0x13')]===0x1f4){logger[_0x08c2('0x12')](_0x08c2('0xe'),_0x4fe84c,_0x335262[_0x08c2('0x12')]['message']);return _0x4ff7b8(_0x335262[_0x08c2('0x12')][_0x08c2('0x14')]);}logger[_0x08c2('0x12')]('ZohoField,\x20%s,\x20%s',_0x4fe84c,_0x335262['error']['message']);return _0x5c365e(_0x335262[_0x08c2('0x12')][_0x08c2('0x14')]);}else{logger[_0x08c2('0xd')](_0x08c2('0xe'),_0x4fe84c,_0x08c2('0xf'));_0x5c365e(_0x335262[_0x08c2('0x15')][_0x08c2('0x14')]);}})[_0x08c2('0x16')](function(_0x330558){logger[_0x08c2('0x12')](_0x08c2('0xe'),_0x4fe84c,_0x330558);_0x4ff7b8(_0x330558);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 8277bfa..da45702 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2755a2,_0x2a1197){var _0x719d22=function(_0x2083f3){while(--_0x2083f3){_0x2755a2['push'](_0x2755a2['shift']());}};_0x719d22(++_0x2a1197);}(_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(_0x567751,_0x4287c3){var _0x21a84c=function(_0x2471d4){while(--_0x2471d4){_0x567751['push'](_0x567751['shift']());}};_0x21a84c(++_0x4287c3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 6a69f64..0a4a2d1 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 _0xcf35=['state','sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN'];(function(_0x1f1f42,_0x168733){var _0x481157=function(_0x5e7628){while(--_0x5e7628){_0x1f1f42['push'](_0x1f1f42['shift']());}};_0x481157(++_0x168733);}(_0xcf35,0x1a9));var _0x5cf3=function(_0x4ab7af,_0x38eb6b){_0x4ab7af=_0x4ab7af-0x0;var _0x22746c=_0xcf35[_0x4ab7af];return _0x22746c;};'use strict';var Sequelize=require(_0x5cf3('0x0'));module[_0x5cf3('0x1')]={'name':{'type':Sequelize[_0x5cf3('0x2')],'allowNull':![],'unique':_0x5cf3('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5cf3('0x3')},'main':{'type':Sequelize[_0x5cf3('0x2')],'defaultValue':_0x5cf3('0x4')},'filename':{'type':Sequelize[_0x5cf3('0x2')]},'path':{'type':Sequelize[_0x5cf3('0x2')]},'type':{'type':Sequelize[_0x5cf3('0x2')]},'size':{'type':Sequelize[_0x5cf3('0x5')]},'active':{'type':Sequelize[_0x5cf3('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x5cf3('0x2')]},'state':{'type':Sequelize[_0x5cf3('0x2')],'unique':_0x5cf3('0x7')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x5cf3('0x2')]},'remoteUri':{'type':Sequelize[_0x5cf3('0x2')]},'link':{'type':Sequelize[_0x5cf3('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xc719=['STRING','unique_name_and_version','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x5751e6,_0x125e5e){var _0x4199e4=function(_0x559843){while(--_0x559843){_0x5751e6['push'](_0x5751e6['shift']());}};_0x4199e4(++_0x125e5e);}(_0xc719,0x1d2));var _0x9c71=function(_0x57fa7e,_0xd0b5ce){_0x57fa7e=_0x57fa7e-0x0;var _0x320671=_0xc719[_0x57fa7e];return _0x320671;};'use strict';var Sequelize=require(_0x9c71('0x0'));module[_0x9c71('0x1')]={'name':{'type':Sequelize[_0x9c71('0x2')],'allowNull':![],'unique':_0x9c71('0x3')},'version':{'type':Sequelize[_0x9c71('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x9c71('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x9c71('0x2')]},'path':{'type':Sequelize[_0x9c71('0x2')]},'type':{'type':Sequelize[_0x9c71('0x2')]},'size':{'type':Sequelize[_0x9c71('0x4')]},'active':{'type':Sequelize[_0x9c71('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x9c71('0x2')]},'logo':{'type':Sequelize[_0x9c71('0x2')]},'state':{'type':Sequelize[_0x9c71('0x2')],'unique':'state'},'description':{'type':Sequelize[_0x9c71('0x2')]},'title':{'type':Sequelize[_0x9c71('0x2')]},'remoteUri':{'type':Sequelize[_0x9c71('0x2')]},'link':{'type':Sequelize[_0x9c71('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index cfbf9d9..b6defa4 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 _0xe2fe=['include','catch','show','find','body','params','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','name','send','index','map','Integration','rawAttributes','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];function respondWithStatusCode(_0x346dbc,_0xa13e7b){_0xa13e7b=_0xa13e7b||0xcc;return function(_0x100449){if(_0x100449){return _0x346dbc[_0xee2f('0x11')](_0xa13e7b);}return _0x346dbc[_0xee2f('0x12')](_0xa13e7b)['end']();};}function respondWithResult(_0x3861e6,_0x531c3a){_0x531c3a=_0x531c3a||0xc8;return function(_0x36db10){if(_0x36db10){return _0x3861e6[_0xee2f('0x12')](_0x531c3a)['json'](_0x36db10);}};}function respondWithFilteredResult(_0x445ba8,_0x145241){return function(_0x28b614){if(_0x28b614){var _0x1bbf7d=typeof _0x145241[_0xee2f('0x13')]==='undefined'&&typeof _0x145241[_0xee2f('0x14')]==='undefined';var _0x17d288=_0x28b614[_0xee2f('0x15')];var _0x502eb6=_0x1bbf7d?0x0:_0x145241['offset'];var _0x40b5bc=_0x1bbf7d?_0x28b614['count']:_0x145241[_0xee2f('0x13')]+_0x145241[_0xee2f('0x14')];var _0x28549d;if(_0x40b5bc>=_0x17d288){_0x40b5bc=_0x17d288;_0x28549d=0xc8;}else{_0x28549d=0xce;}_0x445ba8['status'](_0x28549d);return _0x445ba8[_0xee2f('0x16')](_0xee2f('0x17'),_0x502eb6+'-'+_0x40b5bc+'/'+_0x17d288)[_0xee2f('0x18')](_0x28b614);}return null;};}function patchUpdates(_0x21fdf4){return function(_0x3d892d){try{jsonpatch['apply'](_0x3d892d,_0x21fdf4,!![]);}catch(_0x5e73ad){return BPromise[_0xee2f('0x19')](_0x5e73ad);}return _0x3d892d[_0xee2f('0x1a')]();};}function saveUpdates(_0x1ea808,_0x203b2f){return function(_0x472e3b){if(_0x472e3b){return _0x472e3b[_0xee2f('0x1b')](_0x1ea808)[_0xee2f('0x1c')](function(_0x4d68d3){return _0x4d68d3;});}return null;};}function removeEntity(_0x250399,_0x2c47c5){return function(_0x15ceda){if(_0x15ceda){return _0x15ceda[_0xee2f('0x1d')]()[_0xee2f('0x1c')](function(){_0x250399[_0xee2f('0x12')](0xcc)[_0xee2f('0x1e')]();});}};}function handleEntityNotFound(_0x13013f,_0x382174){return function(_0x1e394f){if(!_0x1e394f){_0x13013f[_0xee2f('0x11')](0x194);}return _0x1e394f;};}function handleError(_0x168adc,_0x1c8454){_0x1c8454=_0x1c8454||0x1f4;return function(_0x45c4a0){logger['error'](_0x45c4a0['stack']);if(_0x45c4a0['name']){delete _0x45c4a0[_0xee2f('0x1f')];}_0x168adc[_0xee2f('0x12')](_0x1c8454)[_0xee2f('0x20')](_0x45c4a0);};}exports[_0xee2f('0x21')]=function(_0x892a4e,_0x3737fd){var _0x4d8398={},_0x3d3806={},_0x52e1fa={'count':0x0,'rows':[]};var _0x235697=_[_0xee2f('0x22')](db[_0xee2f('0x23')][_0xee2f('0x24')],function(_0x3ddbe3){return{'name':_0x3ddbe3['fieldName'],'type':_0x3ddbe3[_0xee2f('0x25')][_0xee2f('0x26')]};});_0x3d3806['model']=_['map'](_0x235697,_0xee2f('0x1f'));_0x3d3806['query']=_[_0xee2f('0x27')](_0x892a4e[_0xee2f('0x28')]);_0x3d3806['filters']=_[_0xee2f('0x29')](_0x3d3806['model'],_0x3d3806['query']);_0x4d8398['attributes']=_[_0xee2f('0x29')](_0x3d3806[_0xee2f('0x2a')],qs['fields'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x2b')]));_0x4d8398[_0xee2f('0x2c')]=_0x4d8398[_0xee2f('0x2c')][_0xee2f('0x2d')]?_0x4d8398['attributes']:_0x3d3806[_0xee2f('0x2a')];if(!_0x892a4e['query'][_0xee2f('0x2e')](_0xee2f('0x2f'))){_0x4d8398[_0xee2f('0x14')]=qs['limit'](_0x892a4e[_0xee2f('0x28')]['limit']);_0x4d8398[_0xee2f('0x13')]=qs['offset'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x13')]);}_0x4d8398[_0xee2f('0x30')]=qs[_0xee2f('0x31')](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x31')]);_0x4d8398[_0xee2f('0x32')]=qs[_0xee2f('0x33')](_[_0xee2f('0x34')](_0x892a4e[_0xee2f('0x28')],_0x3d3806[_0xee2f('0x33')]),_0x235697);if(_0x892a4e['query'][_0xee2f('0x35')]){_0x4d8398['where']=_[_0xee2f('0x36')](_0x4d8398[_0xee2f('0x32')],{'$or':_[_0xee2f('0x22')](_0x235697,function(_0x2cbb89){if(_0x2cbb89[_0xee2f('0x25')]!==_0xee2f('0x37')){var _0x694950={};_0x694950[_0x2cbb89[_0xee2f('0x1f')]]={'$like':'%'+_0x892a4e['query']['filter']+'%'};return _0x694950;}})});}_0x4d8398=_['merge']({},_0x4d8398,_0x892a4e[_0xee2f('0x38')]);var _0x5483ae={'where':_0x4d8398[_0xee2f('0x32')]};return db['Integration']['count'](_0x5483ae)['then'](function(_0x58e361){_0x52e1fa[_0xee2f('0x15')]=_0x58e361;if(_0x892a4e[_0xee2f('0x28')][_0xee2f('0x39')]){_0x4d8398[_0xee2f('0x3a')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x4d8398);})[_0xee2f('0x1c')](function(_0x5e12b7){_0x52e1fa['rows']=_0x5e12b7;return _0x52e1fa;})[_0xee2f('0x1c')](respondWithFilteredResult(_0x3737fd,_0x4d8398))[_0xee2f('0x3b')](handleError(_0x3737fd,null));};exports[_0xee2f('0x3c')]=function(_0x54130b,_0x3bc173){var _0x27c447={'raw':![],'where':{'id':_0x54130b['params']['id']}},_0x19bd4d={};_0x19bd4d['model']=_[_0xee2f('0x27')](db[_0xee2f('0x23')][_0xee2f('0x24')]);_0x19bd4d[_0xee2f('0x28')]=_['keys'](_0x54130b[_0xee2f('0x28')]);_0x19bd4d[_0xee2f('0x33')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],_0x19bd4d[_0xee2f('0x28')]);_0x27c447[_0xee2f('0x2c')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],qs[_0xee2f('0x2b')](_0x54130b[_0xee2f('0x28')]['fields']));_0x27c447['attributes']=_0x27c447['attributes']['length']?_0x27c447[_0xee2f('0x2c')]:_0x19bd4d[_0xee2f('0x2a')];if(_0x54130b[_0xee2f('0x28')][_0xee2f('0x39')]){_0x27c447[_0xee2f('0x3a')]=[{'all':!![]}];}_0x27c447=_['merge']({},_0x27c447,_0x54130b[_0xee2f('0x38')]);return db[_0xee2f('0x23')][_0xee2f('0x3d')](_0x27c447)[_0xee2f('0x1c')](handleEntityNotFound(_0x3bc173,null))['then'](respondWithResult(_0x3bc173,null))['catch'](handleError(_0x3bc173,null));};exports['create']=function(_0x1609f0,_0x54cc44){return db['Integration']['create'](_0x1609f0['body'],{})[_0xee2f('0x1c')](respondWithResult(_0x54cc44,0xc9))[_0xee2f('0x3b')](handleError(_0x54cc44,null));};exports[_0xee2f('0x1b')]=function(_0x584383,_0x22506e){if(_0x584383['body']['id']){delete _0x584383[_0xee2f('0x3e')]['id'];}return db[_0xee2f('0x23')][_0xee2f('0x3d')]({'where':{'id':_0x584383[_0xee2f('0x3f')]['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x22506e,null))['then'](saveUpdates(_0x584383['body'],null))[_0xee2f('0x1c')](respondWithResult(_0x22506e,null))['catch'](handleError(_0x22506e,null));};exports[_0xee2f('0x1d')]=function(_0x282e89,_0x1928f8){return db[_0xee2f('0x23')]['find']({'where':{'id':_0x282e89['params']['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x1928f8,null))[_0xee2f('0x1c')](removeEntity(_0x1928f8,null))[_0xee2f('0x3b')](handleError(_0x1928f8,null));}; \ No newline at end of file +var _0x7880=['set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','Integration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','options','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit'];(function(_0x431a24,_0xdb94f4){var _0x24ae58=function(_0x4934cc){while(--_0x4934cc){_0x431a24['push'](_0x431a24['shift']());}};_0x24ae58(++_0xdb94f4);}(_0x7880,0x1f4));var _0x0788=function(_0xcc26d2,_0x20c921){_0xcc26d2=_0xcc26d2-0x0;var _0x3841e2=_0x7880[_0xcc26d2];return _0x3841e2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0788('0x0'));var zipdir=require(_0x0788('0x1'));var jsonpatch=require(_0x0788('0x2'));var rp=require(_0x0788('0x3'));var moment=require(_0x0788('0x4'));var BPromise=require(_0x0788('0x5'));var Mustache=require('mustache');var util=require(_0x0788('0x6'));var path=require(_0x0788('0x7'));var sox=require(_0x0788('0x8'));var csv=require(_0x0788('0x9'));var ejs=require(_0x0788('0xa'));var fs=require('fs');var fs_extra=require(_0x0788('0xb'));var _=require(_0x0788('0xc'));var squel=require(_0x0788('0xd'));var crypto=require(_0x0788('0xe'));var jsforce=require(_0x0788('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0788('0x9'));var querystring=require('querystring');var Papa=require(_0x0788('0x10'));var Redis=require('ioredis');var authService=require(_0x0788('0x11'));var qs=require(_0x0788('0x12'));var as=require(_0x0788('0x13'));var hardwareService=require(_0x0788('0x14'));var logger=require(_0x0788('0x15'))('api');var utils=require(_0x0788('0x16'));var config=require(_0x0788('0x17'));var licenseUtil=require(_0x0788('0x18'));var db=require(_0x0788('0x19'))['db'];function respondWithStatusCode(_0x311729,_0xce4342){_0xce4342=_0xce4342||0xcc;return function(_0x261ebc){if(_0x261ebc){return _0x311729['sendStatus'](_0xce4342);}return _0x311729[_0x0788('0x1a')](_0xce4342)[_0x0788('0x1b')]();};}function respondWithResult(_0x3bdcdf,_0x13cf07){_0x13cf07=_0x13cf07||0xc8;return function(_0x51e5d3){if(_0x51e5d3){return _0x3bdcdf[_0x0788('0x1a')](_0x13cf07)['json'](_0x51e5d3);}};}function respondWithFilteredResult(_0x195f14,_0x170d56){return function(_0x3fd1e4){if(_0x3fd1e4){var _0xb406fb=typeof _0x170d56[_0x0788('0x1c')]===_0x0788('0x1d')&&typeof _0x170d56['limit']==='undefined';var _0x17d805=_0x3fd1e4[_0x0788('0x1e')];var _0x5b2bdc=_0xb406fb?0x0:_0x170d56[_0x0788('0x1c')];var _0x415f19=_0xb406fb?_0x3fd1e4[_0x0788('0x1e')]:_0x170d56['offset']+_0x170d56[_0x0788('0x1f')];var _0x3fb723;if(_0x415f19>=_0x17d805){_0x415f19=_0x17d805;_0x3fb723=0xc8;}else{_0x3fb723=0xce;}_0x195f14['status'](_0x3fb723);return _0x195f14[_0x0788('0x20')]('Content-Range',_0x5b2bdc+'-'+_0x415f19+'/'+_0x17d805)[_0x0788('0x21')](_0x3fd1e4);}return null;};}function patchUpdates(_0x48bc5f){return function(_0x17cca3){try{jsonpatch[_0x0788('0x22')](_0x17cca3,_0x48bc5f,!![]);}catch(_0x18ff22){return BPromise[_0x0788('0x23')](_0x18ff22);}return _0x17cca3[_0x0788('0x24')]();};}function saveUpdates(_0x4f0005,_0x48ec43){return function(_0x2270d4){if(_0x2270d4){return _0x2270d4[_0x0788('0x25')](_0x4f0005)[_0x0788('0x26')](function(_0x7a99a1){return _0x7a99a1;});}return null;};}function removeEntity(_0x5ba1da,_0x4d5c93){return function(_0x79204e){if(_0x79204e){return _0x79204e[_0x0788('0x27')]()[_0x0788('0x26')](function(){_0x5ba1da['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x240459,_0xa1f7dc){return function(_0x5f2dda){if(!_0x5f2dda){_0x240459['sendStatus'](0x194);}return _0x5f2dda;};}function handleError(_0x5a54a5,_0x44798c){_0x44798c=_0x44798c||0x1f4;return function(_0x57fda1){logger[_0x0788('0x28')](_0x57fda1[_0x0788('0x29')]);if(_0x57fda1[_0x0788('0x2a')]){delete _0x57fda1[_0x0788('0x2a')];}_0x5a54a5[_0x0788('0x1a')](_0x44798c)[_0x0788('0x2b')](_0x57fda1);};}exports[_0x0788('0x2c')]=function(_0x3ffe4f,_0x5b7594){var _0x5a5178={},_0x3c5246={},_0x40d345={'count':0x0,'rows':[]};var _0x54979a=_['map'](db[_0x0788('0x2d')][_0x0788('0x2e')],function(_0x20fcd8){return{'name':_0x20fcd8[_0x0788('0x2f')],'type':_0x20fcd8[_0x0788('0x30')][_0x0788('0x31')]};});_0x3c5246[_0x0788('0x32')]=_[_0x0788('0x33')](_0x54979a,_0x0788('0x2a'));_0x3c5246[_0x0788('0x34')]=_['keys'](_0x3ffe4f[_0x0788('0x34')]);_0x3c5246[_0x0788('0x35')]=_[_0x0788('0x36')](_0x3c5246[_0x0788('0x32')],_0x3c5246[_0x0788('0x34')]);_0x5a5178[_0x0788('0x37')]=_[_0x0788('0x36')](_0x3c5246[_0x0788('0x32')],qs[_0x0788('0x38')](_0x3ffe4f[_0x0788('0x34')]['fields']));_0x5a5178['attributes']=_0x5a5178['attributes']['length']?_0x5a5178['attributes']:_0x3c5246['model'];if(!_0x3ffe4f[_0x0788('0x34')][_0x0788('0x39')](_0x0788('0x3a'))){_0x5a5178['limit']=qs[_0x0788('0x1f')](_0x3ffe4f[_0x0788('0x34')][_0x0788('0x1f')]);_0x5a5178[_0x0788('0x1c')]=qs['offset'](_0x3ffe4f[_0x0788('0x34')]['offset']);}_0x5a5178[_0x0788('0x3b')]=qs['sort'](_0x3ffe4f[_0x0788('0x34')][_0x0788('0x3c')]);_0x5a5178['where']=qs[_0x0788('0x35')](_[_0x0788('0x3d')](_0x3ffe4f['query'],_0x3c5246[_0x0788('0x35')]),_0x54979a);if(_0x3ffe4f['query'][_0x0788('0x3e')]){_0x5a5178['where']=_[_0x0788('0x3f')](_0x5a5178['where'],{'$or':_[_0x0788('0x33')](_0x54979a,function(_0x57fec9){if(_0x57fec9['type']!==_0x0788('0x40')){var _0x68d9d4={};_0x68d9d4[_0x57fec9[_0x0788('0x2a')]]={'$like':'%'+_0x3ffe4f[_0x0788('0x34')][_0x0788('0x3e')]+'%'};return _0x68d9d4;}})});}_0x5a5178=_['merge']({},_0x5a5178,_0x3ffe4f['options']);var _0x530d83={'where':_0x5a5178['where']};return db[_0x0788('0x2d')][_0x0788('0x1e')](_0x530d83)[_0x0788('0x26')](function(_0x358a22){_0x40d345[_0x0788('0x1e')]=_0x358a22;if(_0x3ffe4f['query']['includeAll']){_0x5a5178[_0x0788('0x41')]=[{'all':!![]}];}return db[_0x0788('0x2d')][_0x0788('0x42')](_0x5a5178);})[_0x0788('0x26')](function(_0x236b63){_0x40d345[_0x0788('0x43')]=_0x236b63;return _0x40d345;})[_0x0788('0x26')](respondWithFilteredResult(_0x5b7594,_0x5a5178))[_0x0788('0x44')](handleError(_0x5b7594,null));};exports[_0x0788('0x45')]=function(_0x50e8f5,_0x5581e6){var _0x441aec={'raw':![],'where':{'id':_0x50e8f5[_0x0788('0x46')]['id']}},_0x1d579d={};_0x1d579d['model']=_['keys'](db['Integration'][_0x0788('0x2e')]);_0x1d579d[_0x0788('0x34')]=_[_0x0788('0x47')](_0x50e8f5[_0x0788('0x34')]);_0x1d579d[_0x0788('0x35')]=_[_0x0788('0x36')](_0x1d579d[_0x0788('0x32')],_0x1d579d[_0x0788('0x34')]);_0x441aec['attributes']=_[_0x0788('0x36')](_0x1d579d[_0x0788('0x32')],qs[_0x0788('0x38')](_0x50e8f5[_0x0788('0x34')]['fields']));_0x441aec[_0x0788('0x37')]=_0x441aec[_0x0788('0x37')]['length']?_0x441aec['attributes']:_0x1d579d['model'];if(_0x50e8f5[_0x0788('0x34')]['includeAll']){_0x441aec[_0x0788('0x41')]=[{'all':!![]}];}_0x441aec=_[_0x0788('0x3f')]({},_0x441aec,_0x50e8f5[_0x0788('0x48')]);return db[_0x0788('0x2d')][_0x0788('0x49')](_0x441aec)[_0x0788('0x26')](handleEntityNotFound(_0x5581e6,null))[_0x0788('0x26')](respondWithResult(_0x5581e6,null))[_0x0788('0x44')](handleError(_0x5581e6,null));};exports['create']=function(_0x4c6366,_0x39c3cc){return db[_0x0788('0x2d')][_0x0788('0x4a')](_0x4c6366['body'],{})[_0x0788('0x26')](respondWithResult(_0x39c3cc,0xc9))[_0x0788('0x44')](handleError(_0x39c3cc,null));};exports[_0x0788('0x25')]=function(_0x4563cd,_0x2395ad){if(_0x4563cd['body']['id']){delete _0x4563cd['body']['id'];}return db[_0x0788('0x2d')][_0x0788('0x49')]({'where':{'id':_0x4563cd['params']['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x2395ad,null))['then'](saveUpdates(_0x4563cd[_0x0788('0x4b')],null))[_0x0788('0x26')](respondWithResult(_0x2395ad,null))[_0x0788('0x44')](handleError(_0x2395ad,null));};exports[_0x0788('0x27')]=function(_0x3c757a,_0x379928){return db[_0x0788('0x2d')][_0x0788('0x49')]({'where':{'id':_0x3c757a['params']['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x379928,null))[_0x0788('0x26')](removeEntity(_0x379928,null))[_0x0788('0x44')](handleError(_0x379928,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 6e924d0..c298f3b 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 _0x5ca7=['rimraf','./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5b142f,_0x10815a){var _0x327bbd=function(_0x56806f){while(--_0x56806f){_0x5b142f['push'](_0x5b142f['shift']());}};_0x327bbd(++_0x10815a);}(_0x5ca7,0x19c));var _0x75ca=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x5ca7[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0x75ca('0x0'));var util=require(_0x75ca('0x1'));var logger=require(_0x75ca('0x2'))(_0x75ca('0x3'));var moment=require(_0x75ca('0x4'));var BPromise=require(_0x75ca('0x5'));var rp=require(_0x75ca('0x6'));var fs=require('fs');var path=require(_0x75ca('0x7'));var rimraf=require(_0x75ca('0x8'));var config=require('../../config/environment');var attributes=require(_0x75ca('0x9'));module[_0x75ca('0xa')]=function(_0x5c1d38,_0x3f3688){return _0x5c1d38[_0x75ca('0xb')](_0x75ca('0xc'),attributes,{'tableName':_0x75ca('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c17=['path','rimraf','../../config/environment','./integration.attributes','exports','Integration','integrations','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x12b756,_0x43f6f3){var _0x40cc2e=function(_0x4cbae3){while(--_0x4cbae3){_0x12b756['push'](_0x12b756['shift']());}};_0x40cc2e(++_0x43f6f3);}(_0x3c17,0x1cf));var _0x73c1=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x3c17[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0x73c1('0x0'));var util=require('util');var logger=require(_0x73c1('0x1'))('api');var moment=require(_0x73c1('0x2'));var BPromise=require(_0x73c1('0x3'));var rp=require(_0x73c1('0x4'));var fs=require('fs');var path=require(_0x73c1('0x5'));var rimraf=require(_0x73c1('0x6'));var config=require(_0x73c1('0x7'));var attributes=require(_0x73c1('0x8'));module[_0x73c1('0x9')]=function(_0x2a90f1,_0x28d520){return _0x2a90f1['define'](_0x73c1('0xa'),attributes,{'tableName':_0x73c1('0xb'),'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 04c6a1f..1cc062f 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 _0xc6ac=['http','request','then','info','Integration,\x20%s,\x20%s','debug','Integration,\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(_0x35d4fd,_0x11a7e2){var _0x4235f4=function(_0x36de2b){while(--_0x36de2b){_0x35d4fd['push'](_0x35d4fd['shift']());}};_0x4235f4(++_0x11a7e2);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x57abb5,_0x3248bd){_0x57abb5=_0x57abb5-0x0;var _0x426712=_0xc6ac[_0x57abb5];return _0x426712;};'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']('Integration,\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 _0xba34=['../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x1ffc32,_0x2f4724){var _0x6dd4a2=function(_0x3c92cb){while(--_0x3c92cb){_0x1ffc32['push'](_0x1ffc32['shift']());}};_0x6dd4a2(++_0x2f4724);}(_0xba34,0x119));var _0x4ba3=function(_0x6dbc3e,_0x352946){_0x6dbc3e=_0x6dbc3e-0x0;var _0x6baa0a=_0xba34[_0x6dbc3e];return _0x6baa0a;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 17a30f6..902166b 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 _0x7880=['Router','fs-extra','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x1dca1c,_0x446582){var _0xb2b284=function(_0x48550b){while(--_0x48550b){_0x1dca1c['push'](_0x1dca1c['shift']());}};_0xb2b284(++_0x446582);}(_0x7880,0x1f4));var _0x0788=function(_0x149cf0,_0x3746f2){_0x149cf0=_0x149cf0-0x0;var _0x2ee2c8=_0x7880[_0x149cf0];return _0x2ee2c8;};'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['post']('/',auth[_0x0788('0xa')](),controller[_0x0788('0x10')]);router[_0x0788('0x11')](_0x0788('0xe'),auth[_0x0788('0xa')](),controller['update']);router[_0x0788('0x12')](_0x0788('0xe'),auth[_0x0788('0xa')](),controller[_0x0788('0x13')]);module[_0x0788('0x14')]=router; \ No newline at end of file +var _0x1a85=['../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service'];(function(_0x48eb11,_0x2a697c){var _0x2b1a9c=function(_0x10da82){while(--_0x10da82){_0x48eb11['push'](_0x48eb11['shift']());}};_0x2b1a9c(++_0x2a697c);}(_0x1a85,0x178));var _0x51a8=function(_0x1cf1c7,_0x1e0f72){_0x1cf1c7=_0x1cf1c7-0x0;var _0x362b0a=_0x1a85[_0x1cf1c7];return _0x362b0a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x51a8('0x0'));var timeout=require(_0x51a8('0x1'));var express=require(_0x51a8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x51a8('0x3'));var interaction=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var controller=require('./integrationReport.controller');router[_0x51a8('0x6')]('/',auth['isAuthenticated'](),controller[_0x51a8('0x7')]);router['get'](_0x51a8('0x8'),auth[_0x51a8('0x9')](),controller['describe']);router[_0x51a8('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x51a8('0xa')]);router[_0x51a8('0xb')]('/',auth[_0x51a8('0x9')](),controller[_0x51a8('0xc')]);router[_0x51a8('0xd')](_0x51a8('0xe'),auth[_0x51a8('0x9')](),controller[_0x51a8('0xf')]);router[_0x51a8('0x10')](_0x51a8('0xe'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x11')]);module[_0x51a8('0x12')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 7f78fe5..c23aec7 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 _0x7ece=['SENT','RECEIVED','FAILED','sequelize','exports','STRING','DATE','BOOLEAN','INTEGER','TEXT'];(function(_0x59b146,_0x8a74fe){var _0x5e7c4c=function(_0x12e3fd){while(--_0x12e3fd){_0x59b146['push'](_0x59b146['shift']());}};_0x5e7c4c(++_0x8a74fe);}(_0x7ece,0x1e3));var _0xe7ec=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x7ece[_0x51020b];return _0x371e47;};'use strict';var Sequelize=require(_0xe7ec('0x0'));module[_0xe7ec('0x1')]={'integration':{'type':Sequelize[_0xe7ec('0x2')]},'eventChannel':{'type':Sequelize[_0xe7ec('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0xe7ec('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xe7ec('0x2')]},'uniqueid':{'type':Sequelize[_0xe7ec('0x2')]},'calleridnum':{'type':Sequelize[_0xe7ec('0x2')]},'calleridname':{'type':Sequelize[_0xe7ec('0x2')]},'queue':{'type':Sequelize[_0xe7ec('0x2')]},'interface':{'type':Sequelize[_0xe7ec('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xe7ec('0x3')]},'agentconnectAt':{'type':Sequelize[_0xe7ec('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xe7ec('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xe7ec('0x5')]},'agentacw':{'type':Sequelize[_0xe7ec('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe7ec('0x5')]},'reason':{'type':Sequelize[_0xe7ec('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xe7ec('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xe7ec('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe7ec('0x2')]},'channelstate':{'type':Sequelize[_0xe7ec('0x5')]},'channelstatedesc':{'type':Sequelize[_0xe7ec('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe7ec('0x2')]},'connectedlinename':{'type':Sequelize[_0xe7ec('0x2')]},'language':{'type':Sequelize[_0xe7ec('0x2')]},'accountcode':{'type':Sequelize[_0xe7ec('0x2')]},'context':{'type':Sequelize[_0xe7ec('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xe7ec('0x2')]},'destchannel':{'type':Sequelize[_0xe7ec('0x2')]},'destchannelstate':{'type':Sequelize[_0xe7ec('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0xe7ec('0x2')]},'destcalleridnum':{'type':Sequelize[_0xe7ec('0x2')]},'destcalleridname':{'type':Sequelize[_0xe7ec('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xe7ec('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xe7ec('0x2')]},'destaccountcode':{'type':Sequelize[_0xe7ec('0x2')]},'destcontext':{'type':Sequelize[_0xe7ec('0x2')]},'destexten':{'type':Sequelize[_0xe7ec('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xe7ec('0x2')]},'messageId':{'type':Sequelize[_0xe7ec('0x2')]},'inReplyTo':{'type':Sequelize[_0xe7ec('0x2')]},'subject':{'type':Sequelize[_0xe7ec('0x2')]},'from':{'type':Sequelize[_0xe7ec('0x2')]},'to':{'type':Sequelize[_0xe7ec('0x2')]},'cc':{'type':Sequelize[_0xe7ec('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xe7ec('0x6')]},'status':{'type':Sequelize['ENUM'](_0xe7ec('0x7'),'SENDING',_0xe7ec('0x8'),_0xe7ec('0x9'))},'url':{'type':Sequelize[_0xe7ec('0x2')]},'app':{'type':Sequelize[_0xe7ec('0x2')]},'appdata':{'type':Sequelize[_0xe7ec('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x4b9b=['ENUM','SENT','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','TEXT'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0x4b9b,0xe0));var _0xb4b9=function(_0xf0ec6e,_0xa183d3){_0xf0ec6e=_0xf0ec6e-0x0;var _0x8bbc27=_0x4b9b[_0xf0ec6e];return _0x8bbc27;};'use strict';var Sequelize=require(_0xb4b9('0x0'));module[_0xb4b9('0x1')]={'integration':{'type':Sequelize[_0xb4b9('0x2')]},'eventChannel':{'type':Sequelize[_0xb4b9('0x2')]},'exitStatus':{'type':Sequelize[_0xb4b9('0x2')]},'ticketId':{'type':Sequelize[_0xb4b9('0x2')]},'integrationId':{'type':Sequelize[_0xb4b9('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb4b9('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xb4b9('0x2')]},'interface':{'type':Sequelize[_0xb4b9('0x2')]},'membername':{'type':Sequelize[_0xb4b9('0x2')]},'agentcalledAt':{'type':Sequelize[_0xb4b9('0x4')]},'agentconnectAt':{'type':Sequelize[_0xb4b9('0x4')]},'holdtime':{'type':Sequelize[_0xb4b9('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xb4b9('0x4')]},'talktime':{'type':Sequelize[_0xb4b9('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb4b9('0x3')]},'reason':{'type':Sequelize[_0xb4b9('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xb4b9('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xb4b9('0x4')]},'lastevent':{'type':Sequelize[_0xb4b9('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xb4b9('0x3')]},'channelstatedesc':{'type':Sequelize[_0xb4b9('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb4b9('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xb4b9('0x2')]},'exten':{'type':Sequelize[_0xb4b9('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xb4b9('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xb4b9('0x2')]},'destcalleridnum':{'type':Sequelize[_0xb4b9('0x2')]},'destcalleridname':{'type':Sequelize[_0xb4b9('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xb4b9('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb4b9('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xb4b9('0x2')]},'destcontext':{'type':Sequelize[_0xb4b9('0x2')]},'destexten':{'type':Sequelize[_0xb4b9('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xb4b9('0x2')]},'inReplyTo':{'type':Sequelize[_0xb4b9('0x2')]},'subject':{'type':Sequelize[_0xb4b9('0x2')]},'from':{'type':Sequelize[_0xb4b9('0x2')]},'to':{'type':Sequelize[_0xb4b9('0x2')]},'cc':{'type':Sequelize[_0xb4b9('0x2')]},'attachment':{'type':Sequelize[_0xb4b9('0x5')]},'html':{'type':Sequelize[_0xb4b9('0x5')]},'text':{'type':Sequelize[_0xb4b9('0x5')]},'status':{'type':Sequelize[_0xb4b9('0x6')](_0xb4b9('0x7'),'SENDING',_0xb4b9('0x8'),_0xb4b9('0x9'))},'url':{'type':Sequelize[_0xb4b9('0x2')]},'app':{'type':Sequelize[_0xb4b9('0x2')]},'appdata':{'type':Sequelize[_0xb4b9('0x2')]},'projectId':{'type':Sequelize[_0xb4b9('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 679eeb0..ca565ba 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 _0x473e=['../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','reject','save','update','then','destroy','error','stack','name','map','rawAttributes','fieldName','query','intersection','model','fields','attributes','length','order','where','filters','filter','merge','type','VIRTUAL','IntegrationReport','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x8ada36,_0x28eca6){var _0x24f2d9=function(_0x486d13){while(--_0x486d13){_0x8ada36['push'](_0x8ada36['shift']());}};_0x24f2d9(++_0x28eca6);}(_0x473e,0xbc));var _0xe473=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x473e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xe473('0x0'));var rimraf=require(_0xe473('0x1'));var zipdir=require(_0xe473('0x2'));var jsonpatch=require(_0xe473('0x3'));var rp=require(_0xe473('0x4'));var moment=require('moment');var BPromise=require(_0xe473('0x5'));var Mustache=require(_0xe473('0x6'));var util=require(_0xe473('0x7'));var path=require('path');var sox=require(_0xe473('0x8'));var csv=require(_0xe473('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe473('0xa'));var jsforce=require(_0xe473('0xb'));var deskjs=require(_0xe473('0xc'));var toCsv=require(_0xe473('0x9'));var querystring=require(_0xe473('0xd'));var Papa=require(_0xe473('0xe'));var Redis=require(_0xe473('0xf'));var authService=require(_0xe473('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe473('0x11'));var hardwareService=require(_0xe473('0x12'));var logger=require(_0xe473('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe473('0x14'));var db=require(_0xe473('0x15'))['db'];function respondWithStatusCode(_0x1f1113,_0x267acf){_0x267acf=_0x267acf||0xcc;return function(_0x3bd210){if(_0x3bd210){return _0x1f1113[_0xe473('0x16')](_0x267acf);}return _0x1f1113[_0xe473('0x17')](_0x267acf)[_0xe473('0x18')]();};}function respondWithResult(_0x229bfb,_0x9ff3a1){_0x9ff3a1=_0x9ff3a1||0xc8;return function(_0xe69c85){if(_0xe69c85){return _0x229bfb[_0xe473('0x17')](_0x9ff3a1)[_0xe473('0x19')](_0xe69c85);}};}function respondWithFilteredResult(_0x59627a,_0x9dd8a2){return function(_0xc4043c){if(_0xc4043c){var _0x310e79=typeof _0x9dd8a2['offset']==='undefined'&&typeof _0x9dd8a2[_0xe473('0x1a')]===_0xe473('0x1b');var _0x22da71=_0xc4043c['count'];var _0x3462e8=_0x310e79?0x0:_0x9dd8a2[_0xe473('0x1c')];var _0x5912d7=_0x310e79?_0xc4043c[_0xe473('0x1d')]:_0x9dd8a2[_0xe473('0x1c')]+_0x9dd8a2[_0xe473('0x1a')];var _0x33c712;if(_0x5912d7>=_0x22da71){_0x5912d7=_0x22da71;_0x33c712=0xc8;}else{_0x33c712=0xce;}_0x59627a[_0xe473('0x17')](_0x33c712);return _0x59627a[_0xe473('0x1e')]('Content-Range',_0x3462e8+'-'+_0x5912d7+'/'+_0x22da71)[_0xe473('0x19')](_0xc4043c);}return null;};}function patchUpdates(_0x8b11fd){return function(_0x2878e7){try{jsonpatch['apply'](_0x2878e7,_0x8b11fd,!![]);}catch(_0x277445){return BPromise[_0xe473('0x1f')](_0x277445);}return _0x2878e7[_0xe473('0x20')]();};}function saveUpdates(_0x10bb0f,_0x2ef7ed){return function(_0x434145){if(_0x434145){return _0x434145[_0xe473('0x21')](_0x10bb0f)[_0xe473('0x22')](function(_0x1b8703){return _0x1b8703;});}return null;};}function removeEntity(_0x4c6076,_0x97da0f){return function(_0x5db6fb){if(_0x5db6fb){return _0x5db6fb[_0xe473('0x23')]()[_0xe473('0x22')](function(){_0x4c6076['status'](0xcc)[_0xe473('0x18')]();});}};}function handleEntityNotFound(_0x160815,_0x2ddb7c){return function(_0x7aed71){if(!_0x7aed71){_0x160815[_0xe473('0x16')](0x194);}return _0x7aed71;};}function handleError(_0x3a54d4,_0x413ca9){_0x413ca9=_0x413ca9||0x1f4;return function(_0x53f039){logger[_0xe473('0x24')](_0x53f039[_0xe473('0x25')]);if(_0x53f039['name']){delete _0x53f039[_0xe473('0x26')];}_0x3a54d4[_0xe473('0x17')](_0x413ca9)['send'](_0x53f039);};}exports['index']=function(_0x51d896,_0x28d647){var _0x257817={},_0x2aa02b={},_0x515e9c={'count':0x0,'rows':[]};var _0x484f19=_[_0xe473('0x27')](db['IntegrationReport'][_0xe473('0x28')],function(_0xd6780b){return{'name':_0xd6780b[_0xe473('0x29')],'type':_0xd6780b['type']['key']};});_0x2aa02b['model']=_[_0xe473('0x27')](_0x484f19,'name');_0x2aa02b['query']=_['keys'](_0x51d896[_0xe473('0x2a')]);_0x2aa02b['filters']=_[_0xe473('0x2b')](_0x2aa02b[_0xe473('0x2c')],_0x2aa02b[_0xe473('0x2a')]);_0x257817['attributes']=_[_0xe473('0x2b')](_0x2aa02b[_0xe473('0x2c')],qs[_0xe473('0x2d')](_0x51d896[_0xe473('0x2a')][_0xe473('0x2d')]));_0x257817[_0xe473('0x2e')]=_0x257817[_0xe473('0x2e')][_0xe473('0x2f')]?_0x257817[_0xe473('0x2e')]:_0x2aa02b['model'];if(!_0x51d896[_0xe473('0x2a')]['hasOwnProperty']('nolimit')){_0x257817['limit']=qs['limit'](_0x51d896[_0xe473('0x2a')]['limit']);_0x257817[_0xe473('0x1c')]=qs[_0xe473('0x1c')](_0x51d896[_0xe473('0x2a')]['offset']);}_0x257817[_0xe473('0x30')]=qs['sort'](_0x51d896[_0xe473('0x2a')]['sort']);_0x257817[_0xe473('0x31')]=qs[_0xe473('0x32')](_['pick'](_0x51d896[_0xe473('0x2a')],_0x2aa02b[_0xe473('0x32')]),_0x484f19);if(_0x51d896[_0xe473('0x2a')][_0xe473('0x33')]){_0x257817[_0xe473('0x31')]=_[_0xe473('0x34')](_0x257817[_0xe473('0x31')],{'$or':_[_0xe473('0x27')](_0x484f19,function(_0x63340){if(_0x63340[_0xe473('0x35')]!==_0xe473('0x36')){var _0x3897a4={};_0x3897a4[_0x63340[_0xe473('0x26')]]={'$like':'%'+_0x51d896[_0xe473('0x2a')][_0xe473('0x33')]+'%'};return _0x3897a4;}})});}_0x257817=_['merge']({},_0x257817,_0x51d896['options']);var _0xfd1d67={'where':_0x257817[_0xe473('0x31')]};return db[_0xe473('0x37')]['count'](_0xfd1d67)[_0xe473('0x22')](function(_0x5e0247){_0x515e9c[_0xe473('0x1d')]=_0x5e0247;if(_0x51d896[_0xe473('0x2a')][_0xe473('0x38')]){_0x257817[_0xe473('0x39')]=[{'all':!![]}];}return db[_0xe473('0x37')][_0xe473('0x3a')](_0x257817);})['then'](function(_0x5d31f7){_0x515e9c[_0xe473('0x3b')]=_0x5d31f7;return _0x515e9c;})[_0xe473('0x22')](respondWithFilteredResult(_0x28d647,_0x257817))[_0xe473('0x3c')](handleError(_0x28d647,null));};exports[_0xe473('0x3d')]=function(_0x388f11,_0x2d73e0){var _0x2ed81e={'raw':![],'where':{'id':_0x388f11[_0xe473('0x3e')]['id']}},_0x3f326f={};_0x3f326f[_0xe473('0x2c')]=_[_0xe473('0x3f')](db[_0xe473('0x37')]['rawAttributes']);_0x3f326f[_0xe473('0x2a')]=_[_0xe473('0x3f')](_0x388f11[_0xe473('0x2a')]);_0x3f326f[_0xe473('0x32')]=_['intersection'](_0x3f326f[_0xe473('0x2c')],_0x3f326f[_0xe473('0x2a')]);_0x2ed81e[_0xe473('0x2e')]=_['intersection'](_0x3f326f[_0xe473('0x2c')],qs['fields'](_0x388f11[_0xe473('0x2a')][_0xe473('0x2d')]));_0x2ed81e[_0xe473('0x2e')]=_0x2ed81e[_0xe473('0x2e')][_0xe473('0x2f')]?_0x2ed81e['attributes']:_0x3f326f['model'];if(_0x388f11['query'][_0xe473('0x38')]){_0x2ed81e[_0xe473('0x39')]=[{'all':!![]}];}_0x2ed81e=_['merge']({},_0x2ed81e,_0x388f11[_0xe473('0x40')]);return db[_0xe473('0x37')][_0xe473('0x41')](_0x2ed81e)[_0xe473('0x22')](handleEntityNotFound(_0x2d73e0,null))['then'](respondWithResult(_0x2d73e0,null))[_0xe473('0x3c')](handleError(_0x2d73e0,null));};exports[_0xe473('0x42')]=function(_0x504357,_0x3aa6e7){return db[_0xe473('0x37')]['create'](_0x504357[_0xe473('0x43')],{})[_0xe473('0x22')](respondWithResult(_0x3aa6e7,0xc9))[_0xe473('0x3c')](handleError(_0x3aa6e7,null));};exports[_0xe473('0x21')]=function(_0x3ec89a,_0x5cbffa){if(_0x3ec89a[_0xe473('0x43')]['id']){delete _0x3ec89a[_0xe473('0x43')]['id'];}return db[_0xe473('0x37')]['find']({'where':{'id':_0x3ec89a[_0xe473('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5cbffa,null))[_0xe473('0x22')](saveUpdates(_0x3ec89a['body'],null))[_0xe473('0x22')](respondWithResult(_0x5cbffa,null))[_0xe473('0x3c')](handleError(_0x5cbffa,null));};exports[_0xe473('0x23')]=function(_0x10509a,_0x352d8e){return db['IntegrationReport'][_0xe473('0x41')]({'where':{'id':_0x10509a[_0xe473('0x3e')]['id']}})[_0xe473('0x22')](handleEntityNotFound(_0x352d8e,null))['then'](removeEntity(_0x352d8e,null))['catch'](handleError(_0x352d8e,null));};exports[_0xe473('0x44')]=function(_0x1d11de,_0x302d6f){return db[_0xe473('0x37')][_0xe473('0x44')]()[_0xe473('0x22')](respondWithResult(_0x302d6f,null))[_0xe473('0x3c')](handleError(_0x302d6f,null));}; \ No newline at end of file +var _0x3daf=['request-promise','moment','bluebird','mustache','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','stack','name','send','index','IntegrationReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','include','findAll','rows','catch','intersection','includeAll','options','find','create','body','params','eml-format','zip-dir','fast-json-patch'];(function(_0x143cc6,_0xf94536){var _0x2cedba=function(_0x15a2ad){while(--_0x15a2ad){_0x143cc6['push'](_0x143cc6['shift']());}};_0x2cedba(++_0xf94536);}(_0x3daf,0x89));var _0xf3da=function(_0x34f84f,_0x33d76d){_0x34f84f=_0x34f84f-0x0;var _0x473acd=_0x3daf[_0x34f84f];return _0x473acd;};'use strict';var emlformat=require(_0xf3da('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf3da('0x1'));var jsonpatch=require(_0xf3da('0x2'));var rp=require(_0xf3da('0x3'));var moment=require(_0xf3da('0x4'));var BPromise=require(_0xf3da('0x5'));var Mustache=require(_0xf3da('0x6'));var util=require('util');var path=require('path');var sox=require(_0xf3da('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf3da('0x8'));var _=require(_0xf3da('0x9'));var squel=require(_0xf3da('0xa'));var crypto=require('crypto');var jsforce=require(_0xf3da('0xb'));var deskjs=require(_0xf3da('0xc'));var toCsv=require(_0xf3da('0xd'));var querystring=require(_0xf3da('0xe'));var Papa=require('papaparse');var Redis=require(_0xf3da('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf3da('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf3da('0x11'))('api');var utils=require(_0xf3da('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf3da('0x13'))['db'];function respondWithStatusCode(_0x26585b,_0x6bcf55){_0x6bcf55=_0x6bcf55||0xcc;return function(_0x3e361d){if(_0x3e361d){return _0x26585b['sendStatus'](_0x6bcf55);}return _0x26585b['status'](_0x6bcf55)[_0xf3da('0x14')]();};}function respondWithResult(_0x4ef44a,_0x11335b){_0x11335b=_0x11335b||0xc8;return function(_0xe373f3){if(_0xe373f3){return _0x4ef44a[_0xf3da('0x15')](_0x11335b)[_0xf3da('0x16')](_0xe373f3);}};}function respondWithFilteredResult(_0x4e7ff4,_0x4291c6){return function(_0x426e73){if(_0x426e73){var _0x2d43a0=typeof _0x4291c6[_0xf3da('0x17')]===_0xf3da('0x18')&&typeof _0x4291c6['limit']===_0xf3da('0x18');var _0x2c50ce=_0x426e73['count'];var _0xf63e57=_0x2d43a0?0x0:_0x4291c6[_0xf3da('0x17')];var _0x28772b=_0x2d43a0?_0x426e73[_0xf3da('0x19')]:_0x4291c6[_0xf3da('0x17')]+_0x4291c6[_0xf3da('0x1a')];var _0x42b907;if(_0x28772b>=_0x2c50ce){_0x28772b=_0x2c50ce;_0x42b907=0xc8;}else{_0x42b907=0xce;}_0x4e7ff4['status'](_0x42b907);return _0x4e7ff4[_0xf3da('0x1b')](_0xf3da('0x1c'),_0xf63e57+'-'+_0x28772b+'/'+_0x2c50ce)[_0xf3da('0x16')](_0x426e73);}return null;};}function patchUpdates(_0x1e7a14){return function(_0x2365d7){try{jsonpatch['apply'](_0x2365d7,_0x1e7a14,!![]);}catch(_0x51b5fc){return BPromise[_0xf3da('0x1d')](_0x51b5fc);}return _0x2365d7[_0xf3da('0x1e')]();};}function saveUpdates(_0x479609,_0xb0d802){return function(_0x38662e){if(_0x38662e){return _0x38662e[_0xf3da('0x1f')](_0x479609)[_0xf3da('0x20')](function(_0x2f2470){return _0x2f2470;});}return null;};}function removeEntity(_0x27c237,_0x22779d){return function(_0x2c215d){if(_0x2c215d){return _0x2c215d['destroy']()['then'](function(){_0x27c237['status'](0xcc)[_0xf3da('0x14')]();});}};}function handleEntityNotFound(_0x53bae0,_0x67cd20){return function(_0x55b8a9){if(!_0x55b8a9){_0x53bae0['sendStatus'](0x194);}return _0x55b8a9;};}function handleError(_0x3d3c57,_0x102ecf){_0x102ecf=_0x102ecf||0x1f4;return function(_0x1a6383){logger[_0xf3da('0x21')](_0x1a6383[_0xf3da('0x22')]);if(_0x1a6383[_0xf3da('0x23')]){delete _0x1a6383['name'];}_0x3d3c57[_0xf3da('0x15')](_0x102ecf)[_0xf3da('0x24')](_0x1a6383);};}exports[_0xf3da('0x25')]=function(_0x4bc4a6,_0x59f829){var _0x20b8ee={},_0x25871e={},_0xc3cd77={'count':0x0,'rows':[]};var _0x5ede07=_['map'](db[_0xf3da('0x26')][_0xf3da('0x27')],function(_0x54a48e){return{'name':_0x54a48e[_0xf3da('0x28')],'type':_0x54a48e['type'][_0xf3da('0x29')]};});_0x25871e[_0xf3da('0x2a')]=_['map'](_0x5ede07,_0xf3da('0x23'));_0x25871e[_0xf3da('0x2b')]=_[_0xf3da('0x2c')](_0x4bc4a6['query']);_0x25871e[_0xf3da('0x2d')]=_['intersection'](_0x25871e['model'],_0x25871e[_0xf3da('0x2b')]);_0x20b8ee[_0xf3da('0x2e')]=_['intersection'](_0x25871e[_0xf3da('0x2a')],qs[_0xf3da('0x2f')](_0x4bc4a6[_0xf3da('0x2b')][_0xf3da('0x2f')]));_0x20b8ee[_0xf3da('0x2e')]=_0x20b8ee['attributes'][_0xf3da('0x30')]?_0x20b8ee[_0xf3da('0x2e')]:_0x25871e[_0xf3da('0x2a')];if(!_0x4bc4a6[_0xf3da('0x2b')][_0xf3da('0x31')](_0xf3da('0x32'))){_0x20b8ee[_0xf3da('0x1a')]=qs[_0xf3da('0x1a')](_0x4bc4a6['query'][_0xf3da('0x1a')]);_0x20b8ee[_0xf3da('0x17')]=qs[_0xf3da('0x17')](_0x4bc4a6['query'][_0xf3da('0x17')]);}_0x20b8ee[_0xf3da('0x33')]=qs[_0xf3da('0x34')](_0x4bc4a6[_0xf3da('0x2b')]['sort']);_0x20b8ee[_0xf3da('0x35')]=qs[_0xf3da('0x2d')](_[_0xf3da('0x36')](_0x4bc4a6['query'],_0x25871e[_0xf3da('0x2d')]),_0x5ede07);if(_0x4bc4a6['query'][_0xf3da('0x37')]){_0x20b8ee[_0xf3da('0x35')]=_[_0xf3da('0x38')](_0x20b8ee[_0xf3da('0x35')],{'$or':_[_0xf3da('0x39')](_0x5ede07,function(_0xda6008){if(_0xda6008['type']!==_0xf3da('0x3a')){var _0xa8d5df={};_0xa8d5df[_0xda6008[_0xf3da('0x23')]]={'$like':'%'+_0x4bc4a6[_0xf3da('0x2b')][_0xf3da('0x37')]+'%'};return _0xa8d5df;}})});}_0x20b8ee=_[_0xf3da('0x38')]({},_0x20b8ee,_0x4bc4a6['options']);var _0x481d56={'where':_0x20b8ee[_0xf3da('0x35')]};return db[_0xf3da('0x26')][_0xf3da('0x19')](_0x481d56)[_0xf3da('0x20')](function(_0x46271f){_0xc3cd77[_0xf3da('0x19')]=_0x46271f;if(_0x4bc4a6[_0xf3da('0x2b')]['includeAll']){_0x20b8ee[_0xf3da('0x3b')]=[{'all':!![]}];}return db[_0xf3da('0x26')][_0xf3da('0x3c')](_0x20b8ee);})[_0xf3da('0x20')](function(_0xbd010b){_0xc3cd77[_0xf3da('0x3d')]=_0xbd010b;return _0xc3cd77;})[_0xf3da('0x20')](respondWithFilteredResult(_0x59f829,_0x20b8ee))[_0xf3da('0x3e')](handleError(_0x59f829,null));};exports['show']=function(_0x358e93,_0x3fdfe6){var _0x2ad90e={'raw':![],'where':{'id':_0x358e93['params']['id']}},_0x49022d={};_0x49022d['model']=_[_0xf3da('0x2c')](db[_0xf3da('0x26')][_0xf3da('0x27')]);_0x49022d[_0xf3da('0x2b')]=_[_0xf3da('0x2c')](_0x358e93['query']);_0x49022d[_0xf3da('0x2d')]=_['intersection'](_0x49022d[_0xf3da('0x2a')],_0x49022d[_0xf3da('0x2b')]);_0x2ad90e[_0xf3da('0x2e')]=_[_0xf3da('0x3f')](_0x49022d[_0xf3da('0x2a')],qs[_0xf3da('0x2f')](_0x358e93[_0xf3da('0x2b')][_0xf3da('0x2f')]));_0x2ad90e[_0xf3da('0x2e')]=_0x2ad90e[_0xf3da('0x2e')][_0xf3da('0x30')]?_0x2ad90e[_0xf3da('0x2e')]:_0x49022d[_0xf3da('0x2a')];if(_0x358e93[_0xf3da('0x2b')][_0xf3da('0x40')]){_0x2ad90e[_0xf3da('0x3b')]=[{'all':!![]}];}_0x2ad90e=_[_0xf3da('0x38')]({},_0x2ad90e,_0x358e93[_0xf3da('0x41')]);return db[_0xf3da('0x26')][_0xf3da('0x42')](_0x2ad90e)['then'](handleEntityNotFound(_0x3fdfe6,null))[_0xf3da('0x20')](respondWithResult(_0x3fdfe6,null))['catch'](handleError(_0x3fdfe6,null));};exports[_0xf3da('0x43')]=function(_0x2085c9,_0x937bc){return db[_0xf3da('0x26')][_0xf3da('0x43')](_0x2085c9['body'],{})[_0xf3da('0x20')](respondWithResult(_0x937bc,0xc9))[_0xf3da('0x3e')](handleError(_0x937bc,null));};exports[_0xf3da('0x1f')]=function(_0x265421,_0x4b5849){if(_0x265421['body']['id']){delete _0x265421[_0xf3da('0x44')]['id'];}return db[_0xf3da('0x26')]['find']({'where':{'id':_0x265421[_0xf3da('0x45')]['id']}})[_0xf3da('0x20')](handleEntityNotFound(_0x4b5849,null))[_0xf3da('0x20')](saveUpdates(_0x265421['body'],null))[_0xf3da('0x20')](respondWithResult(_0x4b5849,null))['catch'](handleError(_0x4b5849,null));};exports['destroy']=function(_0x532932,_0x490998){return db['IntegrationReport'][_0xf3da('0x42')]({'where':{'id':_0x532932[_0xf3da('0x45')]['id']}})[_0xf3da('0x20')](handleEntityNotFound(_0x490998,null))['then'](removeEntity(_0x490998,null))['catch'](handleError(_0x490998,null));};exports['describe']=function(_0x2ddae5,_0x3d79ef){return db[_0xf3da('0x26')]['describe']()[_0xf3da('0x20')](respondWithResult(_0x3d79ef,null))['catch'](handleError(_0x3d79ef,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 29e60f4..c02c6ef 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 _0x691c=['define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports'];(function(_0xe3cdae,_0x152d75){var _0x427679=function(_0x58539b){while(--_0x58539b){_0xe3cdae['push'](_0xe3cdae['shift']());}};_0x427679(++_0x152d75);}(_0x691c,0xf3));var _0xc691=function(_0x950c48,_0x3acdaf){_0x950c48=_0x950c48-0x0;var _0x20398c=_0x691c[_0x950c48];return _0x20398c;};'use strict';var _=require(_0xc691('0x0'));var util=require(_0xc691('0x1'));var logger=require(_0xc691('0x2'))(_0xc691('0x3'));var moment=require(_0xc691('0x4'));var BPromise=require(_0xc691('0x5'));var rp=require(_0xc691('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc691('0x7'));var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0xc691('0x8')]=function(_0x18c8fc,_0x32683f){return _0x18c8fc[_0xc691('0x9')](_0xc691('0xa'),attributes,{'tableName':_0xc691('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b00=['define','report_integration','lodash','util','bluebird','request-promise','../../config/environment','./integrationReport.attributes'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x1b00,0x1c2));var _0x01b0=function(_0x13266c,_0x41db14){_0x13266c=_0x13266c-0x0;var _0x3afa06=_0x1b00[_0x13266c];return _0x3afa06;};'use strict';var _=require(_0x01b0('0x0'));var util=require(_0x01b0('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x01b0('0x2'));var rp=require(_0x01b0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x01b0('0x4'));var attributes=require(_0x01b0('0x5'));module['exports']=function(_0x41ae57,_0x3171cf){return _0x41ae57[_0x01b0('0x6')]('IntegrationReport',attributes,{'tableName':_0x01b0('0x7'),'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 f9bfb3c..246f87d 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4819=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment'];(function(_0x56fecd,_0x5350f0){var _0x53d636=function(_0xd697ef){while(--_0xd697ef){_0x56fecd['push'](_0x56fecd['shift']());}};_0x53d636(++_0x5350f0);}(_0x4819,0xcd));var _0x9481=function(_0xabca41,_0xbfdf4a){_0xabca41=_0xabca41-0x0;var _0x404ccb=_0x4819[_0xabca41];return _0x404ccb;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var moment=require(_0x9481('0x1'));var BPromise=require(_0x9481('0x2'));var rs=require(_0x9481('0x3'));var fs=require('fs');var Redis=require(_0x9481('0x4'));var db=require(_0x9481('0x5'))['db'];var utils=require(_0x9481('0x6'));var logger=require(_0x9481('0x7'))(_0x9481('0x8'));var config=require(_0x9481('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9481('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54cc78,_0x14e05a,_0x6c6a08){return new BPromise(function(_0x27c033,_0x3278ff){return client[_0x9481('0xb')](_0x54cc78,_0x6c6a08)['then'](function(_0x1818cf){logger['info'](_0x9481('0xc'),_0x14e05a,'request\x20sent');logger[_0x9481('0xd')](_0x9481('0xe'),_0x14e05a,_0x9481('0xf'),JSON[_0x9481('0x10')](_0x1818cf));if(_0x1818cf[_0x9481('0x11')]){if(_0x1818cf[_0x9481('0x11')][_0x9481('0x12')]===0x1f4){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf['error']['message']);return _0x3278ff(_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);}logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);return _0x27c033(_0x1818cf[_0x9481('0x11')]['message']);}else{logger[_0x9481('0x14')](_0x9481('0xc'),_0x14e05a,'request\x20sent');_0x27c033(_0x1818cf[_0x9481('0x15')]['message']);}})[_0x9481('0x16')](function(_0x7a2ac8){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x7a2ac8);_0x3278ff(_0x7a2ac8);});});} \ No newline at end of file +var _0x3f8a=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x57e18a,_0x199383){_0x57e18a=_0x57e18a-0x0;var _0x1181c7=_0x3f8a[_0x57e18a];return _0x1181c7;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var moment=require(_0xa3f8('0x2'));var BPromise=require(_0xa3f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3f8('0x4'));var db=require(_0xa3f8('0x5'))['db'];var utils=require(_0xa3f8('0x6'));var logger=require(_0xa3f8('0x7'))(_0xa3f8('0x8'));var config=require(_0xa3f8('0x9'));var jayson=require(_0xa3f8('0xa'));var client=jayson[_0xa3f8('0xb')][_0xa3f8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf895d9,_0xcfea5,_0x268332){return new BPromise(function(_0x2faf2e,_0x2448de){return client[_0xa3f8('0xd')](_0xf895d9,_0x268332)[_0xa3f8('0xe')](function(_0xcdb0d4){logger['info'](_0xa3f8('0xf'),_0xcfea5,_0xa3f8('0x10'));logger[_0xa3f8('0x11')](_0xa3f8('0x12'),_0xcfea5,'request\x20sent',JSON[_0xa3f8('0x13')](_0xcdb0d4));if(_0xcdb0d4[_0xa3f8('0x14')]){if(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x15')]===0x1f4){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);return _0x2448de(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4['error'][_0xa3f8('0x16')]);return _0x2faf2e(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}else{logger[_0xa3f8('0x17')]('IntegrationReport,\x20%s,\x20%s',_0xcfea5,_0xa3f8('0x10'));_0x2faf2e(_0xcdb0d4[_0xa3f8('0x18')][_0xa3f8('0x16')]);}})[_0xa3f8('0x19')](function(_0x45ef64){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0x45ef64);_0x2448de(_0x45ef64);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 58fc72e..ecb2d53 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 _0x2ba6=['/:id/sub_intervals','isAuthenticated','getIntervals','post','create','/:id/sub_intervals/create_many','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','index','/:id','show'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x2ba6,0x1ea));var _0x62ba=function(_0x3ea415,_0x33e421){_0x3ea415=_0x3ea415-0x0;var _0x1a6dde=_0x2ba6[_0x3ea415];return _0x1a6dde;};'use strict';var multer=require(_0x62ba('0x0'));var util=require(_0x62ba('0x1'));var path=require(_0x62ba('0x2'));var timeout=require(_0x62ba('0x3'));var express=require(_0x62ba('0x4'));var router=express['Router']();var fs_extra=require(_0x62ba('0x5'));var auth=require(_0x62ba('0x6'));var interaction=require(_0x62ba('0x7'));var config=require(_0x62ba('0x8'));var controller=require(_0x62ba('0x9'));router[_0x62ba('0xa')]('/',auth['isAuthenticated'](),controller[_0x62ba('0xb')]);router[_0x62ba('0xa')](_0x62ba('0xc'),auth['isAuthenticated'](),controller[_0x62ba('0xd')]);router['get'](_0x62ba('0xe'),auth[_0x62ba('0xf')](),controller[_0x62ba('0x10')]);router[_0x62ba('0x11')]('/',auth[_0x62ba('0xf')](),controller[_0x62ba('0x12')]);router[_0x62ba('0x11')](_0x62ba('0xe'),auth[_0x62ba('0xf')](),controller['addInterval']);router[_0x62ba('0x11')](_0x62ba('0x13'),auth[_0x62ba('0xf')](),controller['addIntervals']);router['put'](_0x62ba('0xc'),auth[_0x62ba('0xf')](),controller[_0x62ba('0x14')]);router[_0x62ba('0x15')](_0x62ba('0xc'),auth[_0x62ba('0xf')](),controller[_0x62ba('0x16')]);module[_0x62ba('0x17')]=router; \ No newline at end of file +var _0x029b=['destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','./interval.controller','get','isAuthenticated','index','post','create','addInterval','/:id/sub_intervals/create_many','put','update','delete','/:id'];(function(_0x79998c,_0x51c7b4){var _0xcbcd85=function(_0x2b287d){while(--_0x2b287d){_0x79998c['push'](_0x79998c['shift']());}};_0xcbcd85(++_0x51c7b4);}(_0x029b,0x66));var _0xb029=function(_0x49ae2c,_0x44c1af){_0x49ae2c=_0x49ae2c-0x0;var _0x184124=_0x029b[_0x49ae2c];return _0x184124;};'use strict';var multer=require(_0xb029('0x0'));var util=require(_0xb029('0x1'));var path=require('path');var timeout=require(_0xb029('0x2'));var express=require(_0xb029('0x3'));var router=express['Router']();var fs_extra=require(_0xb029('0x4'));var auth=require(_0xb029('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb029('0x6'));router[_0xb029('0x7')]('/',auth[_0xb029('0x8')](),controller[_0xb029('0x9')]);router[_0xb029('0x7')]('/:id',auth[_0xb029('0x8')](),controller['show']);router[_0xb029('0x7')]('/:id/sub_intervals',auth[_0xb029('0x8')](),controller['getIntervals']);router[_0xb029('0xa')]('/',auth['isAuthenticated'](),controller[_0xb029('0xb')]);router[_0xb029('0xa')]('/:id/sub_intervals',auth[_0xb029('0x8')](),controller[_0xb029('0xc')]);router[_0xb029('0xa')](_0xb029('0xd'),auth[_0xb029('0x8')](),controller['addIntervals']);router[_0xb029('0xe')]('/:id',auth[_0xb029('0x8')](),controller[_0xb029('0xf')]);router[_0xb029('0x10')](_0xb029('0x11'),auth['isAuthenticated'](),controller[_0xb029('0x12')]);module[_0xb029('0x13')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 629742a..aeaba23 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 _0x55a1=['STRING','sequelize','exports'];(function(_0x4ab32c,_0x44ab5e){var _0x2b9644=function(_0x498479){while(--_0x498479){_0x4ab32c['push'](_0x4ab32c['shift']());}};_0x2b9644(++_0x44ab5e);}(_0x55a1,0x169));var _0x155a=function(_0x127c30,_0x45dcef){_0x127c30=_0x127c30-0x0;var _0x172f51=_0x55a1[_0x127c30];return _0x172f51;};'use strict';var Sequelize=require(_0x155a('0x0'));module[_0x155a('0x1')]={'name':{'type':Sequelize[_0x155a('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x155a('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xe767=['sequelize','exports','STRING'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0xe767,0xbd));var _0x7e76=function(_0x39d300,_0x11c0e0){_0x39d300=_0x39d300-0x0;var _0x400063=_0xe767[_0x39d300];return _0x400063;};'use strict';var Sequelize=require(_0x7e76('0x0'));module[_0x7e76('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7e76('0x2')]},'interval':{'type':Sequelize[_0x7e76('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 1fc8dbb..fd44577 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 _0x1964=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','pick','options','sequelize','transaction','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','get','Intervals','UserProfileResource','error','name','send','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','params','find','create','body','user'];(function(_0x53e19f,_0x32f8bd){var _0x2e41eb=function(_0x514275){while(--_0x514275){_0x53e19f['push'](_0x53e19f['shift']());}};_0x2e41eb(++_0x32f8bd);}(_0x1964,0x185));var _0x4196=function(_0x2e4adb,_0x56688b){_0x2e4adb=_0x2e4adb-0x0;var _0x404de5=_0x1964[_0x2e4adb];return _0x404de5;};'use strict';var emlformat=require(_0x4196('0x0'));var rimraf=require(_0x4196('0x1'));var zipdir=require(_0x4196('0x2'));var jsonpatch=require(_0x4196('0x3'));var rp=require('request-promise');var moment=require(_0x4196('0x4'));var BPromise=require(_0x4196('0x5'));var Mustache=require(_0x4196('0x6'));var util=require(_0x4196('0x7'));var path=require(_0x4196('0x8'));var sox=require(_0x4196('0x9'));var csv=require(_0x4196('0xa'));var ejs=require(_0x4196('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4196('0xc'));var squel=require('squel');var crypto=require(_0x4196('0xd'));var jsforce=require(_0x4196('0xe'));var deskjs=require(_0x4196('0xf'));var toCsv=require(_0x4196('0xa'));var querystring=require(_0x4196('0x10'));var Papa=require(_0x4196('0x11'));var Redis=require(_0x4196('0x12'));var authService=require(_0x4196('0x13'));var qs=require(_0x4196('0x14'));var as=require(_0x4196('0x15'));var hardwareService=require(_0x4196('0x16'));var logger=require(_0x4196('0x17'))(_0x4196('0x18'));var utils=require(_0x4196('0x19'));var config=require(_0x4196('0x1a'));var licenseUtil=require(_0x4196('0x1b'));var db=require(_0x4196('0x1c'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x44c084,_0x1de7d7){_0x1de7d7=_0x1de7d7||0xcc;return function(_0x5a4ea1){if(_0x5a4ea1){return _0x44c084[_0x4196('0x1d')](_0x1de7d7);}return _0x44c084['status'](_0x1de7d7)[_0x4196('0x1e')]();};}function respondWithResult(_0x4130df,_0x207b1f){_0x207b1f=_0x207b1f||0xc8;return function(_0x1505c7){if(_0x1505c7){return _0x4130df[_0x4196('0x1f')](_0x207b1f)[_0x4196('0x20')](_0x1505c7);}};}function respondWithFilteredResult(_0x65e6d8,_0x1d5497){return function(_0x4004ba){if(_0x4004ba){var _0x312103=typeof _0x1d5497['offset']===_0x4196('0x21')&&typeof _0x1d5497[_0x4196('0x22')]===_0x4196('0x21');var _0x1a1fe9=_0x4004ba[_0x4196('0x23')];var _0xc8421a=_0x312103?0x0:_0x1d5497[_0x4196('0x24')];var _0x328ade=_0x312103?_0x4004ba[_0x4196('0x23')]:_0x1d5497['offset']+_0x1d5497[_0x4196('0x22')];var _0x6c580b;if(_0x328ade>=_0x1a1fe9){_0x328ade=_0x1a1fe9;_0x6c580b=0xc8;}else{_0x6c580b=0xce;}_0x65e6d8[_0x4196('0x1f')](_0x6c580b);return _0x65e6d8[_0x4196('0x25')](_0x4196('0x26'),_0xc8421a+'-'+_0x328ade+'/'+_0x1a1fe9)['json'](_0x4004ba);}return null;};}function patchUpdates(_0x472c52){return function(_0x1c3201){try{jsonpatch['apply'](_0x1c3201,_0x472c52,!![]);}catch(_0xd25f27){return BPromise[_0x4196('0x27')](_0xd25f27);}return _0x1c3201[_0x4196('0x28')]();};}function saveUpdates(_0x55df89,_0x57ad28){return function(_0x1f6b10){if(_0x1f6b10){return _0x1f6b10[_0x4196('0x29')](_0x55df89)[_0x4196('0x2a')](function(_0x2d965e){return _0x2d965e;});}return null;};}function removeEntity(_0x33c120,_0x2f4df9){return function(_0x258cb7){if(_0x258cb7){return _0x258cb7[_0x4196('0x2b')]()[_0x4196('0x2a')](function(){var _0x282fd6=_0x258cb7[_0x4196('0x2c')]({'plain':!![]});var _0x5e67d5=_0x4196('0x2d');return db[_0x4196('0x2e')][_0x4196('0x2b')]({'where':{'type':_0x5e67d5,'resourceId':_0x282fd6['id']}})['then'](function(){return _0x258cb7;});})[_0x4196('0x2a')](function(){_0x33c120[_0x4196('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15090c,_0x246ecc){return function(_0x397b8d){if(!_0x397b8d){_0x15090c[_0x4196('0x1d')](0x194);}return _0x397b8d;};}function handleError(_0x325ee9,_0x315740){_0x315740=_0x315740||0x1f4;return function(_0x5966ca){logger[_0x4196('0x2f')](_0x5966ca['stack']);if(_0x5966ca['name']){delete _0x5966ca[_0x4196('0x30')];}_0x325ee9[_0x4196('0x1f')](_0x315740)[_0x4196('0x31')](_0x5966ca);};}exports[_0x4196('0x32')]=function(_0x49a59c,_0x5b61ff){var _0x3d9554={},_0x1b4e99={},_0x15a69e={'count':0x0,'rows':[]};var _0x29becb=_[_0x4196('0x33')](db[_0x4196('0x34')][_0x4196('0x35')],function(_0x5a363b){return{'name':_0x5a363b[_0x4196('0x36')],'type':_0x5a363b[_0x4196('0x37')][_0x4196('0x38')]};});_0x1b4e99[_0x4196('0x39')]=_[_0x4196('0x33')](_0x29becb,_0x4196('0x30'));_0x1b4e99[_0x4196('0x3a')]=_[_0x4196('0x3b')](_0x49a59c[_0x4196('0x3a')]);_0x1b4e99[_0x4196('0x3c')]=_[_0x4196('0x3d')](_0x1b4e99[_0x4196('0x39')],_0x1b4e99['query']);_0x3d9554[_0x4196('0x3e')]=_[_0x4196('0x3d')](_0x1b4e99[_0x4196('0x39')],qs[_0x4196('0x3f')](_0x49a59c[_0x4196('0x3a')]['fields']));_0x3d9554['attributes']=_0x3d9554['attributes'][_0x4196('0x40')]?_0x3d9554['attributes']:_0x1b4e99[_0x4196('0x39')];if(!_0x49a59c[_0x4196('0x3a')]['hasOwnProperty'](_0x4196('0x41'))){_0x3d9554[_0x4196('0x22')]=qs[_0x4196('0x22')](_0x49a59c[_0x4196('0x3a')][_0x4196('0x22')]);_0x3d9554[_0x4196('0x24')]=qs['offset'](_0x49a59c[_0x4196('0x3a')][_0x4196('0x24')]);}_0x3d9554[_0x4196('0x42')]=qs[_0x4196('0x43')](_0x49a59c[_0x4196('0x3a')][_0x4196('0x43')]);_0x3d9554[_0x4196('0x44')]=qs[_0x4196('0x3c')](_['pick'](_0x49a59c[_0x4196('0x3a')],_0x1b4e99[_0x4196('0x3c')]),_0x29becb);if(_0x49a59c['query'][_0x4196('0x45')]){_0x3d9554[_0x4196('0x44')]=_['merge'](_0x3d9554[_0x4196('0x44')],{'$or':_['map'](_0x29becb,function(_0x1a3a6c){if(_0x1a3a6c[_0x4196('0x37')]!=='VIRTUAL'){var _0x2148f0={};_0x2148f0[_0x1a3a6c[_0x4196('0x30')]]={'$like':'%'+_0x49a59c[_0x4196('0x3a')][_0x4196('0x45')]+'%'};return _0x2148f0;}})});}_0x3d9554=_[_0x4196('0x46')]({},_0x3d9554,_0x49a59c['options']);var _0x108dc0={'where':_0x3d9554[_0x4196('0x44')]};return db[_0x4196('0x34')][_0x4196('0x23')](_0x108dc0)[_0x4196('0x2a')](function(_0x30fb4c){_0x15a69e[_0x4196('0x23')]=_0x30fb4c;if(_0x49a59c[_0x4196('0x3a')][_0x4196('0x47')]){_0x3d9554[_0x4196('0x48')]=[{'all':!![]}];}return db[_0x4196('0x34')][_0x4196('0x49')](_0x3d9554);})['then'](function(_0x2e7976){_0x15a69e[_0x4196('0x4a')]=_0x2e7976;return _0x15a69e;})[_0x4196('0x2a')](respondWithFilteredResult(_0x5b61ff,_0x3d9554))[_0x4196('0x4b')](handleError(_0x5b61ff,null));};exports['show']=function(_0x54a7ca,_0x5e55e5){var _0x2bd6bb={'raw':!![],'where':{'id':_0x54a7ca[_0x4196('0x4c')]['id']}},_0x5807b0={};_0x5807b0[_0x4196('0x39')]=_[_0x4196('0x3b')](db[_0x4196('0x34')][_0x4196('0x35')]);_0x5807b0[_0x4196('0x3a')]=_[_0x4196('0x3b')](_0x54a7ca[_0x4196('0x3a')]);_0x5807b0['filters']=_[_0x4196('0x3d')](_0x5807b0[_0x4196('0x39')],_0x5807b0['query']);_0x2bd6bb[_0x4196('0x3e')]=_[_0x4196('0x3d')](_0x5807b0[_0x4196('0x39')],qs['fields'](_0x54a7ca['query'][_0x4196('0x3f')]));_0x2bd6bb[_0x4196('0x3e')]=_0x2bd6bb['attributes'][_0x4196('0x40')]?_0x2bd6bb[_0x4196('0x3e')]:_0x5807b0[_0x4196('0x39')];if(_0x54a7ca[_0x4196('0x3a')][_0x4196('0x47')]){_0x2bd6bb['include']=[{'all':!![]}];}_0x2bd6bb=_[_0x4196('0x46')]({},_0x2bd6bb,_0x54a7ca['options']);return db[_0x4196('0x34')][_0x4196('0x4d')](_0x2bd6bb)['then'](handleEntityNotFound(_0x5e55e5,null))[_0x4196('0x2a')](respondWithResult(_0x5e55e5,null))[_0x4196('0x4b')](handleError(_0x5e55e5,null));};exports[_0x4196('0x4e')]=function(_0x2f9325,_0x191c21){return db[_0x4196('0x34')][_0x4196('0x4e')](_0x2f9325[_0x4196('0x4f')],{})[_0x4196('0x2a')](function(_0xb28b75){var _0x58fabd=_0x2f9325[_0x4196('0x50')][_0x4196('0x2c')]({'plain':!![]});if(!_0x58fabd)throw new Error(_0x4196('0x51'));if(_0x58fabd[_0x4196('0x52')]===_0x4196('0x50')){var _0x321941=_0xb28b75[_0x4196('0x2c')]({'plain':!![]});var _0x37c1ba=_0x4196('0x2d');return db['UserProfileSection']['find']({'where':{'name':_0x37c1ba,'userProfileId':_0x58fabd[_0x4196('0x53')]},'raw':!![]})['then'](function(_0x98a81){if(_0x98a81&&_0x98a81[_0x4196('0x54')]===0x0){return db['UserProfileResource'][_0x4196('0x4e')]({'name':_0x321941[_0x4196('0x30')],'resourceId':_0x321941['id'],'type':_0x98a81[_0x4196('0x30')],'sectionId':_0x98a81['id']},{})[_0x4196('0x2a')](function(){return _0xb28b75;});}else{return _0xb28b75;}})[_0x4196('0x4b')](function(_0x596620){logger[_0x4196('0x2f')](_0x4196('0x55'),_0x596620);throw _0x596620;});}return _0xb28b75;})[_0x4196('0x2a')](respondWithResult(_0x191c21,0xc9))[_0x4196('0x4b')](handleError(_0x191c21,null));};exports[_0x4196('0x29')]=function(_0xa29139,_0x7e8d5f){if(_0xa29139['body']['id']){delete _0xa29139[_0x4196('0x4f')]['id'];}return db['Interval']['find']({'where':{'id':_0xa29139[_0x4196('0x4c')]['id']}})[_0x4196('0x2a')](handleEntityNotFound(_0x7e8d5f,null))['then'](saveUpdates(_0xa29139['body'],null))[_0x4196('0x2a')](respondWithResult(_0x7e8d5f,null))['catch'](handleError(_0x7e8d5f,null));};exports[_0x4196('0x2b')]=function(_0x1c0092,_0x165132){return db[_0x4196('0x34')][_0x4196('0x4d')]({'where':{'id':_0x1c0092[_0x4196('0x4c')]['id']}})[_0x4196('0x2a')](handleEntityNotFound(_0x165132,null))[_0x4196('0x2a')](removeEntity(_0x165132,null))[_0x4196('0x4b')](handleError(_0x165132,null));};exports[_0x4196('0x56')]=function(_0x3e3b14,_0x20bfac,_0x2a9e9d){if(_0x3e3b14[_0x4196('0x4f')]['id']){delete _0x3e3b14[_0x4196('0x4f')]['id'];}return db[_0x4196('0x34')][_0x4196('0x4d')]({'where':{'id':_0x3e3b14[_0x4196('0x4c')]['id']}})['then'](handleEntityNotFound(_0x20bfac,null))[_0x4196('0x2a')](function(_0x3b6ffc){if(_0x3b6ffc){_0x3e3b14[_0x4196('0x4f')][_0x4196('0x57')]=_0x3b6ffc['id'];return db['Interval'][_0x4196('0x4e')](_0x3e3b14[_0x4196('0x4f')]);}})[_0x4196('0x2a')](respondWithResult(_0x20bfac,null))[_0x4196('0x4b')](handleError(_0x20bfac,null));};exports[_0x4196('0x58')]=function(_0x1bb73c,_0x4e3c3d,_0x53f923){var _0x4da1a0={};var _0x57eecf={};var _0x36f81a;var _0x4806bd;return db[_0x4196('0x34')][_0x4196('0x59')]({'where':{'id':_0x1bb73c['params']['id']}})[_0x4196('0x2a')](handleEntityNotFound(_0x4e3c3d,null))[_0x4196('0x2a')](function(_0x35146a){if(_0x35146a){_0x36f81a=_0x35146a;_0x57eecf[_0x4196('0x39')]=_[_0x4196('0x3b')](db[_0x4196('0x34')][_0x4196('0x35')]);_0x57eecf['query']=_[_0x4196('0x3b')](_0x1bb73c[_0x4196('0x3a')]);_0x57eecf['filters']=_[_0x4196('0x3d')](_0x57eecf['model'],_0x57eecf[_0x4196('0x3a')]);_0x4da1a0[_0x4196('0x3e')]=_['intersection'](_0x57eecf[_0x4196('0x39')],qs[_0x4196('0x3f')](_0x1bb73c[_0x4196('0x3a')][_0x4196('0x3f')]));_0x4da1a0['attributes']=_0x4da1a0[_0x4196('0x3e')][_0x4196('0x40')]?_0x4da1a0[_0x4196('0x3e')]:_0x57eecf['model'];_0x4da1a0[_0x4196('0x42')]=qs[_0x4196('0x43')](_0x1bb73c['query'][_0x4196('0x43')]);_0x4da1a0[_0x4196('0x44')]=qs[_0x4196('0x3c')](_[_0x4196('0x5a')](_0x1bb73c[_0x4196('0x3a')],_0x57eecf[_0x4196('0x3c')]));if(_0x1bb73c['query'][_0x4196('0x45')]){_0x4da1a0[_0x4196('0x44')]=_[_0x4196('0x46')](_0x4da1a0[_0x4196('0x44')],{'$or':_[_0x4196('0x33')](_0x4da1a0[_0x4196('0x3e')],function(_0x53fa3a){var _0x4406ef={};_0x4406ef[_0x53fa3a]={'$like':'%'+_0x1bb73c[_0x4196('0x3a')]['filter']+'%'};return _0x4406ef;})});}_0x4da1a0=_[_0x4196('0x46')]({},_0x4da1a0,_0x1bb73c[_0x4196('0x5b')]);return _0x36f81a[_0x4196('0x58')](_0x4da1a0);}})['then'](function(_0x193104){if(_0x193104){_0x4806bd=_0x193104[_0x4196('0x40')];if(!_0x1bb73c[_0x4196('0x3a')]['hasOwnProperty']('nolimit')){_0x4da1a0[_0x4196('0x22')]=qs[_0x4196('0x22')](_0x1bb73c['query'][_0x4196('0x22')]);_0x4da1a0[_0x4196('0x24')]=qs[_0x4196('0x24')](_0x1bb73c[_0x4196('0x3a')][_0x4196('0x24')]);}return _0x36f81a[_0x4196('0x58')](_0x4da1a0);}})[_0x4196('0x2a')](function(_0xea93){if(_0xea93){return _0xea93?{'count':_0x4806bd,'rows':_0xea93}:null;}})[_0x4196('0x2a')](respondWithResult(_0x4e3c3d,null))[_0x4196('0x4b')](handleError(_0x4e3c3d,null));};exports['addIntervals']=function(_0x2098f4,_0x14e1ad,_0x20bf3a){return db[_0x4196('0x34')][_0x4196('0x59')]({'where':{'id':_0x2098f4[_0x4196('0x4c')]['id']}})[_0x4196('0x2a')](handleEntityNotFound(_0x14e1ad,null))[_0x4196('0x2a')](function(_0x1af4f){if(_0x1af4f){return db[_0x4196('0x5c')][_0x4196('0x5d')](function(_0x45a893){return db[_0x4196('0x34')][_0x4196('0x2b')]({'where':{'IntervalId':_0x2098f4[_0x4196('0x4c')]['id']},'transaction':_0x45a893})[_0x4196('0x2a')](function(_0xe4a6d6){var _0x3b8d7a=_['map'](_0x2098f4[_0x4196('0x4f')],function(_0x45b903){delete _0x45b903['id'];_0x45b903['IntervalId']=_0x2098f4['params']['id'];return _0x45b903;});return db[_0x4196('0x34')]['bulkCreate'](_0x3b8d7a,{'transaction':_0x45a893});});})['then'](function(){return db[_0x4196('0x34')]['findAll']({'where':{'IntervalId':_0x2098f4[_0x4196('0x4c')]['id']}});});}})[_0x4196('0x2a')](respondWithResult(_0x14e1ad,null))['catch'](handleError(_0x14e1ad,null));}; \ No newline at end of file +var _0xc155=['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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','error','name','send','index','map','Interval','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','show','rawAttributes','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','getIntervals','addIntervals','findOne','sequelize','bulkCreate','eml-format','rimraf','zip-dir'];(function(_0xf7a9cf,_0x2cfa33){var _0x7fdc45=function(_0x44b354){while(--_0x44b354){_0xf7a9cf['push'](_0xf7a9cf['shift']());}};_0x7fdc45(++_0x2cfa33);}(_0xc155,0x117));var _0x5c15=function(_0x10fdb2,_0x252191){_0x10fdb2=_0x10fdb2-0x0;var _0x537c32=_0xc155[_0x10fdb2];return _0x537c32;};'use strict';var emlformat=require(_0x5c15('0x0'));var rimraf=require(_0x5c15('0x1'));var zipdir=require(_0x5c15('0x2'));var jsonpatch=require(_0x5c15('0x3'));var rp=require(_0x5c15('0x4'));var moment=require(_0x5c15('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5c15('0x6'));var util=require(_0x5c15('0x7'));var path=require(_0x5c15('0x8'));var sox=require(_0x5c15('0x9'));var csv=require(_0x5c15('0xa'));var ejs=require(_0x5c15('0xb'));var fs=require('fs');var fs_extra=require(_0x5c15('0xc'));var _=require(_0x5c15('0xd'));var squel=require('squel');var crypto=require(_0x5c15('0xe'));var jsforce=require(_0x5c15('0xf'));var deskjs=require(_0x5c15('0x10'));var toCsv=require('to-csv');var querystring=require(_0x5c15('0x11'));var Papa=require(_0x5c15('0x12'));var Redis=require(_0x5c15('0x13'));var authService=require(_0x5c15('0x14'));var qs=require(_0x5c15('0x15'));var as=require(_0x5c15('0x16'));var hardwareService=require(_0x5c15('0x17'));var logger=require(_0x5c15('0x18'))(_0x5c15('0x19'));var utils=require(_0x5c15('0x1a'));var config=require(_0x5c15('0x1b'));var licenseUtil=require(_0x5c15('0x1c'));var db=require(_0x5c15('0x1d'))['db'];var extensions=require(_0x5c15('0x1e'));function respondWithStatusCode(_0x39d5bd,_0x46d00e){_0x46d00e=_0x46d00e||0xcc;return function(_0x4bd78d){if(_0x4bd78d){return _0x39d5bd[_0x5c15('0x1f')](_0x46d00e);}return _0x39d5bd['status'](_0x46d00e)[_0x5c15('0x20')]();};}function respondWithResult(_0x259f66,_0x2a5a18){_0x2a5a18=_0x2a5a18||0xc8;return function(_0x5d62c9){if(_0x5d62c9){return _0x259f66[_0x5c15('0x21')](_0x2a5a18)[_0x5c15('0x22')](_0x5d62c9);}};}function respondWithFilteredResult(_0x1d1482,_0x362025){return function(_0x5baf53){if(_0x5baf53){var _0x1efcb5=typeof _0x362025[_0x5c15('0x23')]===_0x5c15('0x24')&&typeof _0x362025[_0x5c15('0x25')]===_0x5c15('0x24');var _0x46d390=_0x5baf53[_0x5c15('0x26')];var _0x4e3b5a=_0x1efcb5?0x0:_0x362025[_0x5c15('0x23')];var _0x4db7c9=_0x1efcb5?_0x5baf53[_0x5c15('0x26')]:_0x362025[_0x5c15('0x23')]+_0x362025['limit'];var _0x1da2d8;if(_0x4db7c9>=_0x46d390){_0x4db7c9=_0x46d390;_0x1da2d8=0xc8;}else{_0x1da2d8=0xce;}_0x1d1482[_0x5c15('0x21')](_0x1da2d8);return _0x1d1482[_0x5c15('0x27')]('Content-Range',_0x4e3b5a+'-'+_0x4db7c9+'/'+_0x46d390)[_0x5c15('0x22')](_0x5baf53);}return null;};}function patchUpdates(_0x52d163){return function(_0x3dd137){try{jsonpatch[_0x5c15('0x28')](_0x3dd137,_0x52d163,!![]);}catch(_0x18cd29){return BPromise[_0x5c15('0x29')](_0x18cd29);}return _0x3dd137[_0x5c15('0x2a')]();};}function saveUpdates(_0x11c0d8,_0x151680){return function(_0x2b6dd){if(_0x2b6dd){return _0x2b6dd[_0x5c15('0x2b')](_0x11c0d8)[_0x5c15('0x2c')](function(_0x56f5c1){return _0x56f5c1;});}return null;};}function removeEntity(_0x6ec0e,_0x44bd89){return function(_0x37103e){if(_0x37103e){return _0x37103e[_0x5c15('0x2d')]()[_0x5c15('0x2c')](function(){var _0x456360=_0x37103e[_0x5c15('0x2e')]({'plain':!![]});var _0x18e706='Intervals';return db['UserProfileResource'][_0x5c15('0x2d')]({'where':{'type':_0x18e706,'resourceId':_0x456360['id']}})['then'](function(){return _0x37103e;});})[_0x5c15('0x2c')](function(){_0x6ec0e[_0x5c15('0x21')](0xcc)[_0x5c15('0x20')]();});}};}function handleEntityNotFound(_0x4f5f6f,_0x435658){return function(_0x4676a6){if(!_0x4676a6){_0x4f5f6f[_0x5c15('0x1f')](0x194);}return _0x4676a6;};}function handleError(_0x3268a3,_0x1c6d5a){_0x1c6d5a=_0x1c6d5a||0x1f4;return function(_0xa5c90a){logger[_0x5c15('0x2f')](_0xa5c90a['stack']);if(_0xa5c90a[_0x5c15('0x30')]){delete _0xa5c90a[_0x5c15('0x30')];}_0x3268a3['status'](_0x1c6d5a)[_0x5c15('0x31')](_0xa5c90a);};}exports[_0x5c15('0x32')]=function(_0x2b811b,_0x12430c){var _0x46eb90={},_0x2a13f2={},_0x147531={'count':0x0,'rows':[]};var _0x1f301f=_[_0x5c15('0x33')](db[_0x5c15('0x34')]['rawAttributes'],function(_0xdb0d2c){return{'name':_0xdb0d2c['fieldName'],'type':_0xdb0d2c[_0x5c15('0x35')]['key']};});_0x2a13f2['model']=_[_0x5c15('0x33')](_0x1f301f,_0x5c15('0x30'));_0x2a13f2[_0x5c15('0x36')]=_[_0x5c15('0x37')](_0x2b811b[_0x5c15('0x36')]);_0x2a13f2['filters']=_[_0x5c15('0x38')](_0x2a13f2[_0x5c15('0x39')],_0x2a13f2[_0x5c15('0x36')]);_0x46eb90[_0x5c15('0x3a')]=_['intersection'](_0x2a13f2[_0x5c15('0x39')],qs[_0x5c15('0x3b')](_0x2b811b[_0x5c15('0x36')]['fields']));_0x46eb90['attributes']=_0x46eb90[_0x5c15('0x3a')][_0x5c15('0x3c')]?_0x46eb90[_0x5c15('0x3a')]:_0x2a13f2['model'];if(!_0x2b811b[_0x5c15('0x36')][_0x5c15('0x3d')](_0x5c15('0x3e'))){_0x46eb90[_0x5c15('0x25')]=qs[_0x5c15('0x25')](_0x2b811b['query'][_0x5c15('0x25')]);_0x46eb90[_0x5c15('0x23')]=qs[_0x5c15('0x23')](_0x2b811b[_0x5c15('0x36')][_0x5c15('0x23')]);}_0x46eb90[_0x5c15('0x3f')]=qs['sort'](_0x2b811b[_0x5c15('0x36')][_0x5c15('0x40')]);_0x46eb90[_0x5c15('0x41')]=qs[_0x5c15('0x42')](_[_0x5c15('0x43')](_0x2b811b[_0x5c15('0x36')],_0x2a13f2[_0x5c15('0x42')]),_0x1f301f);if(_0x2b811b[_0x5c15('0x36')]['filter']){_0x46eb90['where']=_[_0x5c15('0x44')](_0x46eb90[_0x5c15('0x41')],{'$or':_[_0x5c15('0x33')](_0x1f301f,function(_0x504db1){if(_0x504db1['type']!==_0x5c15('0x45')){var _0x155f52={};_0x155f52[_0x504db1[_0x5c15('0x30')]]={'$like':'%'+_0x2b811b[_0x5c15('0x36')][_0x5c15('0x46')]+'%'};return _0x155f52;}})});}_0x46eb90=_[_0x5c15('0x44')]({},_0x46eb90,_0x2b811b[_0x5c15('0x47')]);var _0x1d5935={'where':_0x46eb90['where']};return db[_0x5c15('0x34')][_0x5c15('0x26')](_0x1d5935)[_0x5c15('0x2c')](function(_0x2a1760){_0x147531[_0x5c15('0x26')]=_0x2a1760;if(_0x2b811b[_0x5c15('0x36')]['includeAll']){_0x46eb90['include']=[{'all':!![]}];}return db[_0x5c15('0x34')][_0x5c15('0x48')](_0x46eb90);})[_0x5c15('0x2c')](function(_0xfab835){_0x147531[_0x5c15('0x49')]=_0xfab835;return _0x147531;})[_0x5c15('0x2c')](respondWithFilteredResult(_0x12430c,_0x46eb90))[_0x5c15('0x4a')](handleError(_0x12430c,null));};exports[_0x5c15('0x4b')]=function(_0x124595,_0x515927){var _0x1b5284={'raw':!![],'where':{'id':_0x124595['params']['id']}},_0x188905={};_0x188905[_0x5c15('0x39')]=_['keys'](db[_0x5c15('0x34')][_0x5c15('0x4c')]);_0x188905[_0x5c15('0x36')]=_[_0x5c15('0x37')](_0x124595['query']);_0x188905[_0x5c15('0x42')]=_['intersection'](_0x188905[_0x5c15('0x39')],_0x188905['query']);_0x1b5284[_0x5c15('0x3a')]=_['intersection'](_0x188905[_0x5c15('0x39')],qs['fields'](_0x124595['query'][_0x5c15('0x3b')]));_0x1b5284[_0x5c15('0x3a')]=_0x1b5284[_0x5c15('0x3a')][_0x5c15('0x3c')]?_0x1b5284['attributes']:_0x188905[_0x5c15('0x39')];if(_0x124595['query'][_0x5c15('0x4d')]){_0x1b5284[_0x5c15('0x4e')]=[{'all':!![]}];}_0x1b5284=_[_0x5c15('0x44')]({},_0x1b5284,_0x124595[_0x5c15('0x47')]);return db[_0x5c15('0x34')][_0x5c15('0x4f')](_0x1b5284)[_0x5c15('0x2c')](handleEntityNotFound(_0x515927,null))['then'](respondWithResult(_0x515927,null))[_0x5c15('0x4a')](handleError(_0x515927,null));};exports[_0x5c15('0x50')]=function(_0x3cbd10,_0x5ce30f){return db[_0x5c15('0x34')]['create'](_0x3cbd10[_0x5c15('0x51')],{})['then'](function(_0x5d0cba){var _0x278b6b=_0x3cbd10['user']['get']({'plain':!![]});if(!_0x278b6b)throw new Error(_0x5c15('0x52'));if(_0x278b6b[_0x5c15('0x53')]==='user'){var _0x39bada=_0x5d0cba[_0x5c15('0x2e')]({'plain':!![]});var _0xbf978d=_0x5c15('0x54');return db[_0x5c15('0x55')][_0x5c15('0x4f')]({'where':{'name':_0xbf978d,'userProfileId':_0x278b6b['userProfileId']},'raw':!![]})[_0x5c15('0x2c')](function(_0x1458e0){if(_0x1458e0&&_0x1458e0['autoAssociation']===0x0){return db['UserProfileResource'][_0x5c15('0x50')]({'name':_0x39bada[_0x5c15('0x30')],'resourceId':_0x39bada['id'],'type':_0x1458e0['name'],'sectionId':_0x1458e0['id']},{})[_0x5c15('0x2c')](function(){return _0x5d0cba;});}else{return _0x5d0cba;}})['catch'](function(_0x297c70){logger['error'](_0x5c15('0x56'),_0x297c70);throw _0x297c70;});}return _0x5d0cba;})['then'](respondWithResult(_0x5ce30f,0xc9))['catch'](handleError(_0x5ce30f,null));};exports['update']=function(_0x5ea8c1,_0x496a14){if(_0x5ea8c1['body']['id']){delete _0x5ea8c1[_0x5c15('0x51')]['id'];}return db[_0x5c15('0x34')][_0x5c15('0x4f')]({'where':{'id':_0x5ea8c1[_0x5c15('0x57')]['id']}})[_0x5c15('0x2c')](handleEntityNotFound(_0x496a14,null))[_0x5c15('0x2c')](saveUpdates(_0x5ea8c1[_0x5c15('0x51')],null))['then'](respondWithResult(_0x496a14,null))[_0x5c15('0x4a')](handleError(_0x496a14,null));};exports[_0x5c15('0x2d')]=function(_0x54a46c,_0x14fdcb){return db['Interval'][_0x5c15('0x4f')]({'where':{'id':_0x54a46c[_0x5c15('0x57')]['id']}})[_0x5c15('0x2c')](handleEntityNotFound(_0x14fdcb,null))['then'](removeEntity(_0x14fdcb,null))['catch'](handleError(_0x14fdcb,null));};exports[_0x5c15('0x58')]=function(_0xc52445,_0x4d1091,_0x2ccb8f){if(_0xc52445[_0x5c15('0x51')]['id']){delete _0xc52445[_0x5c15('0x51')]['id'];}return db[_0x5c15('0x34')]['find']({'where':{'id':_0xc52445[_0x5c15('0x57')]['id']}})[_0x5c15('0x2c')](handleEntityNotFound(_0x4d1091,null))[_0x5c15('0x2c')](function(_0x5c82d3){if(_0x5c82d3){_0xc52445[_0x5c15('0x51')]['IntervalId']=_0x5c82d3['id'];return db[_0x5c15('0x34')][_0x5c15('0x50')](_0xc52445[_0x5c15('0x51')]);}})[_0x5c15('0x2c')](respondWithResult(_0x4d1091,null))['catch'](handleError(_0x4d1091,null));};exports[_0x5c15('0x59')]=function(_0x4ba939,_0x1c7430,_0x562376){var _0x190937={};var _0x14bf0a={};var _0x5462a2;var _0x23bef0;return db[_0x5c15('0x34')]['findOne']({'where':{'id':_0x4ba939[_0x5c15('0x57')]['id']}})[_0x5c15('0x2c')](handleEntityNotFound(_0x1c7430,null))[_0x5c15('0x2c')](function(_0x4b8cc1){if(_0x4b8cc1){_0x5462a2=_0x4b8cc1;_0x14bf0a['model']=_[_0x5c15('0x37')](db[_0x5c15('0x34')]['rawAttributes']);_0x14bf0a[_0x5c15('0x36')]=_[_0x5c15('0x37')](_0x4ba939[_0x5c15('0x36')]);_0x14bf0a[_0x5c15('0x42')]=_[_0x5c15('0x38')](_0x14bf0a[_0x5c15('0x39')],_0x14bf0a['query']);_0x190937[_0x5c15('0x3a')]=_[_0x5c15('0x38')](_0x14bf0a[_0x5c15('0x39')],qs['fields'](_0x4ba939[_0x5c15('0x36')][_0x5c15('0x3b')]));_0x190937['attributes']=_0x190937[_0x5c15('0x3a')][_0x5c15('0x3c')]?_0x190937['attributes']:_0x14bf0a[_0x5c15('0x39')];_0x190937[_0x5c15('0x3f')]=qs[_0x5c15('0x40')](_0x4ba939[_0x5c15('0x36')]['sort']);_0x190937['where']=qs[_0x5c15('0x42')](_[_0x5c15('0x43')](_0x4ba939[_0x5c15('0x36')],_0x14bf0a[_0x5c15('0x42')]));if(_0x4ba939[_0x5c15('0x36')]['filter']){_0x190937[_0x5c15('0x41')]=_[_0x5c15('0x44')](_0x190937[_0x5c15('0x41')],{'$or':_['map'](_0x190937[_0x5c15('0x3a')],function(_0x438d70){var _0x4ff423={};_0x4ff423[_0x438d70]={'$like':'%'+_0x4ba939['query'][_0x5c15('0x46')]+'%'};return _0x4ff423;})});}_0x190937=_[_0x5c15('0x44')]({},_0x190937,_0x4ba939[_0x5c15('0x47')]);return _0x5462a2[_0x5c15('0x59')](_0x190937);}})[_0x5c15('0x2c')](function(_0x2e2fea){if(_0x2e2fea){_0x23bef0=_0x2e2fea[_0x5c15('0x3c')];if(!_0x4ba939[_0x5c15('0x36')][_0x5c15('0x3d')](_0x5c15('0x3e'))){_0x190937[_0x5c15('0x25')]=qs[_0x5c15('0x25')](_0x4ba939[_0x5c15('0x36')][_0x5c15('0x25')]);_0x190937[_0x5c15('0x23')]=qs[_0x5c15('0x23')](_0x4ba939[_0x5c15('0x36')]['offset']);}return _0x5462a2['getIntervals'](_0x190937);}})[_0x5c15('0x2c')](function(_0x588dfa){if(_0x588dfa){return _0x588dfa?{'count':_0x23bef0,'rows':_0x588dfa}:null;}})['then'](respondWithResult(_0x1c7430,null))['catch'](handleError(_0x1c7430,null));};exports[_0x5c15('0x5a')]=function(_0x45ffed,_0x1eb54a,_0x14e82a){return db[_0x5c15('0x34')][_0x5c15('0x5b')]({'where':{'id':_0x45ffed[_0x5c15('0x57')]['id']}})[_0x5c15('0x2c')](handleEntityNotFound(_0x1eb54a,null))[_0x5c15('0x2c')](function(_0x4e4429){if(_0x4e4429){return db[_0x5c15('0x5c')]['transaction'](function(_0x5c6359){return db[_0x5c15('0x34')][_0x5c15('0x2d')]({'where':{'IntervalId':_0x45ffed['params']['id']},'transaction':_0x5c6359})[_0x5c15('0x2c')](function(_0x2971ac){var _0xb56e69=_[_0x5c15('0x33')](_0x45ffed['body'],function(_0x18c3bf){delete _0x18c3bf['id'];_0x18c3bf['IntervalId']=_0x45ffed[_0x5c15('0x57')]['id'];return _0x18c3bf;});return db[_0x5c15('0x34')][_0x5c15('0x5d')](_0xb56e69,{'transaction':_0x5c6359});});})[_0x5c15('0x2c')](function(){return db[_0x5c15('0x34')][_0x5c15('0x48')]({'where':{'IntervalId':_0x45ffed[_0x5c15('0x57')]['id']}});});}})[_0x5c15('0x2c')](respondWithResult(_0x1eb54a,null))[_0x5c15('0x4a')](handleError(_0x1eb54a,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index a36cae2..da42e24 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 _0xfde7=['then','all','map','ifTime','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','exports','define','Interval','tools_intervals','rewrite','string','interval'];(function(_0x25900b,_0x8d8ce7){var _0x29ba0d=function(_0x126070){while(--_0x126070){_0x25900b['push'](_0x25900b['shift']());}};_0x29ba0d(++_0x8d8ce7);}(_0xfde7,0x18c));var _0x7fde=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xfde7[_0x3b380d];return _0x54502b;};'use strict';var attributes=require(_0x7fde('0x0'));var extensions=require(_0x7fde('0x1'));var iftime=require(_0x7fde('0x2'))['iftime'];module[_0x7fde('0x3')]=function(_0x12a42b){return _0x12a42b[_0x7fde('0x4')](_0x7fde('0x5'),attributes,{'tableName':_0x7fde('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4c6b38){extensions[_0x7fde('0x7')](_0x12a42b,_0x4c6b38);},'afterBulkCreate':function(_0x3fb2d0,_0x35be39,_0x611b3a){_0x611b3a();extensions[_0x7fde('0x7')](_0x12a42b,_0x3fb2d0[0x0]);},'afterUpdate':function(_0x3e393e){extensions['rewrite'](_0x12a42b,_0x3e393e);},'afterDestroy':function(_0xee98e4){extensions['rewrite'](_0x12a42b,_0xee98e4);}},'instanceMethods':{'ifTime':function(_0x129a6c=undefined,_0x55a66d=new Date()){if(typeof this['interval']===_0x7fde('0x8')){return iftime(this[_0x7fde('0x9')],_0x129a6c,_0x55a66d);}else{return this['getIntervals']()[_0x7fde('0xa')](function(_0xfdee53){return Promise[_0x7fde('0xb')](_0xfdee53[_0x7fde('0xc')](function(_0x569809){return _0x569809[_0x7fde('0xd')](_0x129a6c,_0x55a66d);}));})[_0x7fde('0xa')](function(_0x4e46ff){return _0x4e46ff['reduce'](function(_0x5cdf98,_0x1caa4a){return _0x5cdf98||_0x1caa4a;},![]);});}}}});}; \ No newline at end of file +var _0x981e=['string','getIntervals','then','all','map','ifTime','./interval.attributes','../../utils/iftime','iftime','exports','define','Interval','rewrite','interval'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x981e,0x1c6));var _0xe981=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x981e[_0x42cae2];return _0x5f256f;};'use strict';var attributes=require(_0xe981('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0xe981('0x1'))[_0xe981('0x2')];module[_0xe981('0x3')]=function(_0xe2a28e){return _0xe2a28e[_0xe981('0x4')](_0xe981('0x5'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3348c6){extensions['rewrite'](_0xe2a28e,_0x3348c6);},'afterBulkCreate':function(_0x4edd01,_0x5716f5,_0x15eeeb){_0x15eeeb();extensions[_0xe981('0x6')](_0xe2a28e,_0x4edd01[0x0]);},'afterUpdate':function(_0x2305bc){extensions[_0xe981('0x6')](_0xe2a28e,_0x2305bc);},'afterDestroy':function(_0x59e83e){extensions[_0xe981('0x6')](_0xe2a28e,_0x59e83e);}},'instanceMethods':{'ifTime':function(_0xaa19fe=undefined,_0x40bb89=new Date()){if(typeof this[_0xe981('0x7')]===_0xe981('0x8')){return iftime(this[_0xe981('0x7')],_0xaa19fe,_0x40bb89);}else{return this[_0xe981('0x9')]()[_0xe981('0xa')](function(_0xd72cf7){return Promise[_0xe981('0xb')](_0xd72cf7[_0xe981('0xc')](function(_0x5205f2){return _0x5205f2[_0xe981('0xd')](_0xaa19fe,_0x40bb89);}));})[_0xe981('0xa')](function(_0x2910a5){return _0x2910a5['reduce'](function(_0x23b841,_0x5e830f){return _0x23b841||_0x5e830f;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 46056df..5350b4b 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 _0xfdf1=['findAll','options','raw','limit','include','model','attributes','map','then','info','debug','stringify','catch','error','message','ShowInterval','find','where','all','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','isArray','lodash','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','Interval'];(function(_0x437e12,_0x2ed185){var _0x13c0bc=function(_0x29948f){while(--_0x29948f){_0x437e12['push'](_0x437e12['shift']());}};_0x13c0bc(++_0x2ed185);}(_0xfdf1,0xdd));var _0x1fdf=function(_0xa5c4c2,_0x59f7f4){_0xa5c4c2=_0xa5c4c2-0x0;var _0x2aa977=_0xfdf1[_0xa5c4c2];return _0x2aa977;};'use strict';var _=require(_0x1fdf('0x0'));var util=require(_0x1fdf('0x1'));var db=require(_0x1fdf('0x2'))['db'];var iftime=require(_0x1fdf('0x3'))[_0x1fdf('0x4')];var logger=require(_0x1fdf('0x5'))(_0x1fdf('0x6'));exports[_0x1fdf('0x7')]=function(_0x58d5db){var _0x483965=this;return new Promise(function(_0xf4da61,_0x3be3fd){return db[_0x1fdf('0x8')][_0x1fdf('0x9')]({'raw':_0x58d5db[_0x1fdf('0xa')]?_0x58d5db[_0x1fdf('0xa')][_0x1fdf('0xb')]===undefined?!![]:![]:!![],'where':_0x58d5db[_0x1fdf('0xa')]?_0x58d5db[_0x1fdf('0xa')]['where']||null:null,'attributes':_0x58d5db[_0x1fdf('0xa')]?_0x58d5db[_0x1fdf('0xa')]['attributes']||null:null,'limit':_0x58d5db[_0x1fdf('0xa')]?_0x58d5db['options'][_0x1fdf('0xc')]||null:null,'include':_0x58d5db[_0x1fdf('0xa')]?_0x58d5db[_0x1fdf('0xa')][_0x1fdf('0xd')]?_['map'](_0x58d5db[_0x1fdf('0xa')][_0x1fdf('0xd')],function(_0x12f7ff){return{'model':db[_0x12f7ff[_0x1fdf('0xe')]],'as':_0x12f7ff['as'],'attributes':_0x12f7ff[_0x1fdf('0xf')],'include':_0x12f7ff[_0x1fdf('0xd')]?_[_0x1fdf('0x10')](_0x12f7ff[_0x1fdf('0xd')],function(_0x511fa4){return{'model':db[_0x511fa4['model']],'as':_0x511fa4['as'],'attributes':_0x511fa4['attributes'],'include':_0x511fa4[_0x1fdf('0xd')]?_[_0x1fdf('0x10')](_0x511fa4[_0x1fdf('0xd')],function(_0xb12cfc){return{'model':db[_0xb12cfc[_0x1fdf('0xe')]],'as':_0xb12cfc['as'],'attributes':_0xb12cfc[_0x1fdf('0xf')]};}):[]};}):[]};}):[]:[]})[_0x1fdf('0x11')](function(_0x22483f){logger[_0x1fdf('0x12')](_0x1fdf('0x7'),_0x58d5db);logger[_0x1fdf('0x13')](_0x1fdf('0x7'),_0x58d5db,JSON[_0x1fdf('0x14')](_0x22483f));_0xf4da61(_0x22483f);})[_0x1fdf('0x15')](function(_0x3573ef){logger[_0x1fdf('0x16')]('GetInterval',_0x3573ef[_0x1fdf('0x17')],_0x58d5db);_0x3be3fd(_0x483965[_0x1fdf('0x16')](0x1f4,_0x3573ef[_0x1fdf('0x17')]));});});};exports[_0x1fdf('0x18')]=function(_0x141036){var _0x3aea3c=this;return new Promise(function(_0x5e0900,_0x222349){return db[_0x1fdf('0x8')][_0x1fdf('0x19')]({'raw':_0x141036[_0x1fdf('0xa')]?_0x141036[_0x1fdf('0xa')]['raw']===undefined?!![]:![]:!![],'where':_0x141036[_0x1fdf('0xa')]?_0x141036['options'][_0x1fdf('0x1a')]||null:null,'attributes':_0x141036['options']?_0x141036[_0x1fdf('0xa')][_0x1fdf('0xf')]||null:null,'include':_0x141036[_0x1fdf('0xa')]?_0x141036['options'][_0x1fdf('0xd')]?_['map'](_0x141036[_0x1fdf('0xa')][_0x1fdf('0xd')],function(_0x5c6bb6){return{'model':db[_0x5c6bb6[_0x1fdf('0xe')]],'as':_0x5c6bb6['as'],'attributes':_0x5c6bb6['attributes'],'include':_0x5c6bb6[_0x1fdf('0xd')]?_[_0x1fdf('0x10')](_0x5c6bb6['include'],function(_0x34946e){return{'model':db[_0x34946e['model']],'as':_0x34946e['as'],'attributes':_0x34946e[_0x1fdf('0xf')],'include':_0x34946e['include']?_['map'](_0x34946e[_0x1fdf('0xd')],function(_0x38180b){return{'model':db[_0x38180b[_0x1fdf('0xe')]],'as':_0x38180b['as'],'attributes':_0x38180b[_0x1fdf('0xf')]};}):[]};}):[]};}):[]:[]})[_0x1fdf('0x11')](function(_0x2548ee){logger[_0x1fdf('0x12')]('ShowInterval',_0x141036);logger[_0x1fdf('0x13')](_0x1fdf('0x18'),_0x141036,JSON[_0x1fdf('0x14')](_0x2548ee));_0x5e0900(_0x2548ee);})[_0x1fdf('0x15')](function(_0x49dab7){logger[_0x1fdf('0x16')](_0x1fdf('0x18'),_0x49dab7[_0x1fdf('0x17')],_0x141036);_0x222349(_0x3aea3c[_0x1fdf('0x16')](0x1f4,_0x49dab7['message']));});});};function checkArrayOfIntervals(_0x5ed1fe,_0x1b1df7){var _0x25484d=[];return db['Interval']['findAll']({'where':{'id':_0x5ed1fe}})[_0x1fdf('0x11')](function(_0x54adaf){_0x25484d=_0x54adaf;return Promise[_0x1fdf('0x1b')](_0x25484d[_0x1fdf('0x10')](function(_0x4c33ed){return _0x4c33ed[_0x1fdf('0x1c')](_0x1b1df7);}));})[_0x1fdf('0x11')](function(_0x5e822a){var _0x413450=_0x5e822a[_0x1fdf('0x1d')](function(_0x20376d,_0x2d3d6f){return _0x20376d||_0x2d3d6f;},![]);logger[_0x1fdf('0x12')](util[_0x1fdf('0x1e')](_0x1fdf('0x1f'),_0x25484d[_0x1fdf('0x10')](function(_0x295245){return _0x295245[_0x1fdf('0x20')];})[_0x1fdf('0x21')](',\x20'),_0x25484d[_0x1fdf('0x10')](function(_0x449dc3){return _0x449dc3['id'];})[_0x1fdf('0x21')](',\x20')));return _0x413450;});}function checkSingleInterval(_0x15142f,_0x54d6c3){return db[_0x1fdf('0x8')][_0x1fdf('0x22')](_0x15142f)[_0x1fdf('0x11')](function(_0x204e22){if(_0x204e22){logger[_0x1fdf('0x12')](util[_0x1fdf('0x1e')](_0x1fdf('0x23'),_0x204e22[_0x1fdf('0x20')],_0x204e22['id']));return _0x204e22[_0x1fdf('0x1c')](_0x54d6c3);}});}exports[_0x1fdf('0x24')]=function(_0x293cc3){var _0x2197b9=_0x293cc3['intervalIds'];var _0x1121cf=Array['isArray'](_0x293cc3[_0x1fdf('0x25')])?_0x293cc3['intervals']:typeof _0x293cc3['intervals']===_0x1fdf('0x26')?[_0x293cc3[_0x1fdf('0x25')]]:[];var _0x10ce78=_0x293cc3[_0x1fdf('0x27')]||undefined;var _0x35f5bc=![];if(_0x1121cf[_0x1fdf('0x28')]){logger[_0x1fdf('0x12')](util['format'](_0x1fdf('0x29'),_0x1121cf[_0x1fdf('0x21')](';\x20')));}if(_0x10ce78){logger[_0x1fdf('0x12')](util[_0x1fdf('0x1e')](_0x1fdf('0x2a'),_0x10ce78));}logger[_0x1fdf('0x13')](_0x1fdf('0x2b'),_0x35f5bc);logger[_0x1fdf('0x2c')](_0x1fdf('0x24'),_0x293cc3);return Promise['resolve']()[_0x1fdf('0x11')](function(){if(Array[_0x1fdf('0x2d')](_0x2197b9)){return checkArrayOfIntervals(_0x2197b9,_0x10ce78);}else if(_0x2197b9){return checkSingleInterval(_0x2197b9,_0x10ce78);}})[_0x1fdf('0x11')](function(_0x4e6953){var _0x300ee2=_0x1121cf[_0x1fdf('0x1d')](function(_0x277213,_0x3c088a){return _0x277213||iftime(_0x3c088a,_0x10ce78);},![]);_0x35f5bc=_0x4e6953||_0x300ee2;return _0x35f5bc;})[_0x1fdf('0x15')](function(_0x40516d){logger[_0x1fdf('0x16')](_0x1fdf('0x24'),_0x293cc3,_0x40516d);throw this['error'](0x1f4,_0x40516d[_0x1fdf('0x17')]);});}; \ No newline at end of file +var _0x16e8=['error','message','ShowInterval','find','Interval','ifTime','reduce','name','join','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','format','resolve','lodash','util','../../config/logger','rpc','GetInterval','findAll','raw','options','where','attributes','limit','include','map','model','then','info','debug','stringify','catch'];(function(_0x22c684,_0x753309){var _0x39fcbb=function(_0x38b631){while(--_0x38b631){_0x22c684['push'](_0x22c684['shift']());}};_0x39fcbb(++_0x753309);}(_0x16e8,0x173));var _0x816e=function(_0x105699,_0x10f48e){_0x105699=_0x105699-0x0;var _0x53c233=_0x16e8[_0x105699];return _0x53c233;};'use strict';var _=require(_0x816e('0x0'));var util=require(_0x816e('0x1'));var db=require('../../mysqldb')['db'];var iftime=require('../../utils/iftime')['iftime'];var logger=require(_0x816e('0x2'))(_0x816e('0x3'));exports[_0x816e('0x4')]=function(_0x3ff53d){var _0x1f35fe=this;return new Promise(function(_0x4fd2ba,_0x32bfac){return db['Interval'][_0x816e('0x5')]({'raw':_0x3ff53d['options']?_0x3ff53d['options'][_0x816e('0x6')]===undefined?!![]:![]:!![],'where':_0x3ff53d[_0x816e('0x7')]?_0x3ff53d['options'][_0x816e('0x8')]||null:null,'attributes':_0x3ff53d[_0x816e('0x7')]?_0x3ff53d[_0x816e('0x7')][_0x816e('0x9')]||null:null,'limit':_0x3ff53d[_0x816e('0x7')]?_0x3ff53d[_0x816e('0x7')][_0x816e('0xa')]||null:null,'include':_0x3ff53d[_0x816e('0x7')]?_0x3ff53d[_0x816e('0x7')][_0x816e('0xb')]?_[_0x816e('0xc')](_0x3ff53d['options']['include'],function(_0x24fcd2){return{'model':db[_0x24fcd2[_0x816e('0xd')]],'as':_0x24fcd2['as'],'attributes':_0x24fcd2[_0x816e('0x9')],'include':_0x24fcd2[_0x816e('0xb')]?_[_0x816e('0xc')](_0x24fcd2[_0x816e('0xb')],function(_0x4614b1){return{'model':db[_0x4614b1[_0x816e('0xd')]],'as':_0x4614b1['as'],'attributes':_0x4614b1['attributes'],'include':_0x4614b1[_0x816e('0xb')]?_[_0x816e('0xc')](_0x4614b1[_0x816e('0xb')],function(_0x2bcbeb){return{'model':db[_0x2bcbeb[_0x816e('0xd')]],'as':_0x2bcbeb['as'],'attributes':_0x2bcbeb[_0x816e('0x9')]};}):[]};}):[]};}):[]:[]})[_0x816e('0xe')](function(_0x5957a5){logger[_0x816e('0xf')]('GetInterval',_0x3ff53d);logger[_0x816e('0x10')](_0x816e('0x4'),_0x3ff53d,JSON[_0x816e('0x11')](_0x5957a5));_0x4fd2ba(_0x5957a5);})[_0x816e('0x12')](function(_0x58418e){logger[_0x816e('0x13')](_0x816e('0x4'),_0x58418e[_0x816e('0x14')],_0x3ff53d);_0x32bfac(_0x1f35fe['error'](0x1f4,_0x58418e['message']));});});};exports[_0x816e('0x15')]=function(_0x7c85d9){var _0x3f8421=this;return new Promise(function(_0x47ba97,_0x5b99c7){return db['Interval'][_0x816e('0x16')]({'raw':_0x7c85d9[_0x816e('0x7')]?_0x7c85d9[_0x816e('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x7c85d9[_0x816e('0x7')]?_0x7c85d9[_0x816e('0x7')][_0x816e('0x8')]||null:null,'attributes':_0x7c85d9['options']?_0x7c85d9['options'][_0x816e('0x9')]||null:null,'include':_0x7c85d9[_0x816e('0x7')]?_0x7c85d9['options'][_0x816e('0xb')]?_[_0x816e('0xc')](_0x7c85d9[_0x816e('0x7')]['include'],function(_0x4ce592){return{'model':db[_0x4ce592['model']],'as':_0x4ce592['as'],'attributes':_0x4ce592[_0x816e('0x9')],'include':_0x4ce592['include']?_[_0x816e('0xc')](_0x4ce592[_0x816e('0xb')],function(_0x3c32eb){return{'model':db[_0x3c32eb['model']],'as':_0x3c32eb['as'],'attributes':_0x3c32eb['attributes'],'include':_0x3c32eb[_0x816e('0xb')]?_[_0x816e('0xc')](_0x3c32eb[_0x816e('0xb')],function(_0x58939f){return{'model':db[_0x58939f[_0x816e('0xd')]],'as':_0x58939f['as'],'attributes':_0x58939f[_0x816e('0x9')]};}):[]};}):[]};}):[]:[]})[_0x816e('0xe')](function(_0x19cf7){logger['info'](_0x816e('0x15'),_0x7c85d9);logger[_0x816e('0x10')](_0x816e('0x15'),_0x7c85d9,JSON[_0x816e('0x11')](_0x19cf7));_0x47ba97(_0x19cf7);})[_0x816e('0x12')](function(_0x80426e){logger[_0x816e('0x13')](_0x816e('0x15'),_0x80426e[_0x816e('0x14')],_0x7c85d9);_0x5b99c7(_0x3f8421[_0x816e('0x13')](0x1f4,_0x80426e[_0x816e('0x14')]));});});};function checkArrayOfIntervals(_0x491575,_0x3a4e5b){var _0x2c4502=[];return db[_0x816e('0x17')][_0x816e('0x5')]({'where':{'id':_0x491575}})['then'](function(_0x3423f8){_0x2c4502=_0x3423f8;return Promise['all'](_0x2c4502['map'](function(_0x421f86){return _0x421f86[_0x816e('0x18')](_0x3a4e5b);}));})[_0x816e('0xe')](function(_0x570b61){var _0x3f2cc8=_0x570b61[_0x816e('0x19')](function(_0x2f7a75,_0x43b090){return _0x2f7a75||_0x43b090;},![]);logger[_0x816e('0xf')](util['format']('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x2c4502['map'](function(_0x830ef0){return _0x830ef0[_0x816e('0x1a')];})[_0x816e('0x1b')](',\x20'),_0x2c4502[_0x816e('0xc')](function(_0x435248){return _0x435248['id'];})[_0x816e('0x1b')](',\x20')));return _0x3f2cc8;});}function checkSingleInterval(_0xc6c075,_0x146098){return db[_0x816e('0x17')]['findById'](_0xc6c075)[_0x816e('0xe')](function(_0x170328){if(_0x170328){logger[_0x816e('0xf')](util['format'](_0x816e('0x1c'),_0x170328[_0x816e('0x1a')],_0x170328['id']));return _0x170328['ifTime'](_0x146098);}});}exports[_0x816e('0x1d')]=function(_0xfcd09){var _0x1e52d0=_0xfcd09[_0x816e('0x1e')];var _0x2e52f0=Array[_0x816e('0x1f')](_0xfcd09[_0x816e('0x20')])?_0xfcd09[_0x816e('0x20')]:typeof _0xfcd09[_0x816e('0x20')]===_0x816e('0x21')?[_0xfcd09[_0x816e('0x20')]]:[];var _0x2c586d=_0xfcd09[_0x816e('0x22')]||undefined;var _0x54a5c2=![];if(_0x2e52f0[_0x816e('0x23')]){logger[_0x816e('0xf')](util['format'](_0x816e('0x24'),_0x2e52f0[_0x816e('0x1b')](';\x20')));}if(_0x2c586d){logger[_0x816e('0xf')](util[_0x816e('0x25')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x2c586d));}logger[_0x816e('0x10')]('Iftime',_0x54a5c2);logger['silly'](_0x816e('0x1d'),_0xfcd09);return Promise[_0x816e('0x26')]()[_0x816e('0xe')](function(){if(Array[_0x816e('0x1f')](_0x1e52d0)){return checkArrayOfIntervals(_0x1e52d0,_0x2c586d);}else if(_0x1e52d0){return checkSingleInterval(_0x1e52d0,_0x2c586d);}})[_0x816e('0xe')](function(_0x4cdfc0){var _0x5906d4=_0x2e52f0[_0x816e('0x19')](function(_0x530686,_0x43b7ac){return _0x530686||iftime(_0x43b7ac,_0x2c586d);},![]);_0x54a5c2=_0x4cdfc0||_0x5906d4;return _0x54a5c2;})[_0x816e('0x12')](function(_0x42390c){logger[_0x816e('0x13')](_0x816e('0x1d'),_0xfcd09,_0x42390c);throw this[_0x816e('0x13')](0x1f4,_0x42390c[_0x816e('0x14')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 435181e..ea5f4d0 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 _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x3435e7,_0xf8e628){var _0x26cdd7=function(_0x2d46d7){while(--_0x2d46d7){_0x3435e7['push'](_0x3435e7['shift']());}};_0x26cdd7(++_0xf8e628);}(_0xadb5,0xad));var _0x5adb=function(_0x267b6c,_0x4e76ea){_0x267b6c=_0x267b6c-0x0;var _0x3283b9=_0xadb5[_0x267b6c];return _0x3283b9;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file +var _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0xdbe2de,_0x3bdc5a){var _0x2facd7=function(_0x50df58){while(--_0x50df58){_0xdbe2de['push'](_0xdbe2de['shift']());}};_0x2facd7(++_0x3bdc5a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 63efd6a..a1e5740 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 _0xb573=['description','stringify','issuetype','Bug','fields','customfield_11500','customfield_11501','oldToken','customfield_11503','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','application/json','Basic\x20','base64','request','end','status','statusCode','parse','error','json','api.jira','send','body','headers','x-forwarded-for','remoteAddress','socket','connection','bluebird','https','../../config/logger','api','3eAmWpBVP0','MOTGUI','summary','Report','\x20from\x20'];(function(_0x44cfc7,_0x566868){var _0x114d02=function(_0xd8d9c0){while(--_0xd8d9c0){_0x44cfc7['push'](_0x44cfc7['shift']());}};_0x114d02(++_0x566868);}(_0xb573,0x11d));var _0x3b57=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb573[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x3b57('0x0'));var https=require(_0x3b57('0x1'));var logger=require(_0x3b57('0x2'))(_0x3b57('0x3'));var USERNAME='support';var PASSWORD=_0x3b57('0x4');function openIssue(_0x5e021,_0x5e22c6){var _0x5e37ab={'fields':{'project':{'key':_0x5e021['key']||_0x3b57('0x5')},'summary':(_0x5e021[_0x3b57('0x6')]||_0x3b57('0x7'))+_0x3b57('0x8')+_0x5e021['ip'],'description':_0x5e021[_0x3b57('0x9')]||JSON[_0x3b57('0xa')](_0x5e021),'issuetype':{'name':_0x5e021[_0x3b57('0xb')]||_0x3b57('0xc')}}};_0x5e37ab[_0x3b57('0xd')][_0x3b57('0xe')]=_0x5e021['email'];_0x5e37ab[_0x3b57('0xd')][_0x3b57('0xf')]=_0x5e021[_0x3b57('0x10')];_0x5e37ab[_0x3b57('0xd')]['customfield_11502']=_0x5e021['newToken'];_0x5e37ab['fields'][_0x3b57('0x11')]=_0x5e021[_0x3b57('0x12')];_0x5e37ab[_0x3b57('0xd')][_0x3b57('0x13')]=_0x5e021[_0x3b57('0x14')];_0x5e37ab[_0x3b57('0xd')][_0x3b57('0x15')]=_0x5e021['ip'];var _0x63f290={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x3b57('0x16'),'method':_0x3b57('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0x3b57('0x18'),'Authorization':_0x3b57('0x19')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x3b57('0x1a'))}};var _0x39948a=JSON[_0x3b57('0xa')](_0x5e37ab);var _0x43165f=https[_0x3b57('0x1b')](_0x63f290,function(_0x1044fe){_0x1044fe['setEncoding']('utf8');var _0x51496b='';_0x1044fe['on']('data',function(_0x123c4e){_0x51496b+=_0x123c4e;});_0x1044fe['on'](_0x3b57('0x1c'),function(){if(_0x5e22c6){return _0x5e22c6[_0x3b57('0x1d')](_0x1044fe[_0x3b57('0x1e')])['json'](JSON[_0x3b57('0x1f')](_0x51496b));}});});_0x43165f['on'](_0x3b57('0x20'),function(_0x3c44db){if(_0x5e22c6){return _0x5e22c6[_0x3b57('0x1d')](0x1f4)[_0x3b57('0x21')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x3b57('0x22')}]});}});_0x43165f['write'](_0x39948a);_0x43165f['end']();}exports['openIssue']=openIssue;exports[_0x3b57('0x23')]=function(_0x5758ca,_0x5d670b){_0x5758ca[_0x3b57('0x24')]['ip']=_0x5758ca[_0x3b57('0x25')][_0x3b57('0x26')]||_0x5758ca['connection'][_0x3b57('0x27')]||_0x5758ca[_0x3b57('0x28')]['remoteAddress']||_0x5758ca[_0x3b57('0x29')]['socket']['remoteAddress'];return openIssue(_0x5758ca[_0x3b57('0x24')],_0x5d670b);}; \ No newline at end of file +var _0x859b=['Report','\x20from\x20','description','stringify','Bug','fields','email','customfield_11501','customfield_11502','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','request','setEncoding','utf8','data','end','status','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','../../config/logger','api','support','key','MOTGUI'];(function(_0x55b35d,_0x55fbb8){var _0x599818=function(_0x131d18){while(--_0x131d18){_0x55b35d['push'](_0x55b35d['shift']());}};_0x599818(++_0x55fbb8);}(_0x859b,0x9e));var _0xb859=function(_0x5ef2db,_0x21cb97){_0x5ef2db=_0x5ef2db-0x0;var _0x47eb89=_0x859b[_0x5ef2db];return _0x47eb89;};'use strict';var BPromise=require(_0xb859('0x0'));var https=require('https');var logger=require(_0xb859('0x1'))(_0xb859('0x2'));var USERNAME=_0xb859('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x5dba3e,_0x239e78){var _0x2f4f59={'fields':{'project':{'key':_0x5dba3e[_0xb859('0x4')]||_0xb859('0x5')},'summary':(_0x5dba3e['summary']||_0xb859('0x6'))+_0xb859('0x7')+_0x5dba3e['ip'],'description':_0x5dba3e[_0xb859('0x8')]||JSON[_0xb859('0x9')](_0x5dba3e),'issuetype':{'name':_0x5dba3e['issuetype']||_0xb859('0xa')}}};_0x2f4f59[_0xb859('0xb')]['customfield_11500']=_0x5dba3e[_0xb859('0xc')];_0x2f4f59[_0xb859('0xb')][_0xb859('0xd')]=_0x5dba3e['oldToken'];_0x2f4f59[_0xb859('0xb')][_0xb859('0xe')]=_0x5dba3e['newToken'];_0x2f4f59[_0xb859('0xb')][_0xb859('0xf')]=_0x5dba3e[_0xb859('0x10')];_0x2f4f59['fields'][_0xb859('0x11')]=_0x5dba3e[_0xb859('0x12')];_0x2f4f59[_0xb859('0xb')][_0xb859('0x13')]=_0x5dba3e['ip'];var _0x2ea651={'host':_0xb859('0x14'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xb859('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0xb859('0x16'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x16898a=JSON['stringify'](_0x2f4f59);var _0x544421=https[_0xb859('0x17')](_0x2ea651,function(_0x11a71b){_0x11a71b[_0xb859('0x18')](_0xb859('0x19'));var _0x250ec4='';_0x11a71b['on'](_0xb859('0x1a'),function(_0x2b7a44){_0x250ec4+=_0x2b7a44;});_0x11a71b['on'](_0xb859('0x1b'),function(){if(_0x239e78){return _0x239e78[_0xb859('0x1c')](_0x11a71b['statusCode'])[_0xb859('0x1d')](JSON[_0xb859('0x1e')](_0x250ec4));}});});_0x544421['on']('error',function(_0x15a995){if(_0x239e78){return _0x239e78['status'](0x1f4)[_0xb859('0x1d')]({'errors':[{'message':_0xb859('0x1f'),'type':'api.jira'}]});}});_0x544421[_0xb859('0x20')](_0x16898a);_0x544421[_0xb859('0x1b')]();}exports[_0xb859('0x21')]=openIssue;exports[_0xb859('0x22')]=function(_0x41b768,_0x105de6){_0x41b768[_0xb859('0x23')]['ip']=_0x41b768[_0xb859('0x24')][_0xb859('0x25')]||_0x41b768[_0xb859('0x26')][_0xb859('0x27')]||_0x41b768[_0xb859('0x28')]['remoteAddress']||_0x41b768[_0xb859('0x26')][_0xb859('0x28')]['remoteAddress'];return openIssue(_0x41b768[_0xb859('0x23')],_0x105de6);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 8249da9..9c6daf0 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(_0x5d0430,_0x15cc32){var _0x4d964c=function(_0x392cbf){while(--_0x392cbf){_0x5d0430['push'](_0x5d0430['shift']());}};_0x4d964c(++_0x15cc32);}(_0x1339,0x1ed));var _0x9133=function(_0x21fda9,_0x3551cb){_0x21fda9=_0x21fda9-0x0;var _0x4566b4=_0x1339[_0x21fda9];return _0x4566b4;};'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 _0xe14d=['isAuthenticated','index','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get'];(function(_0x404459,_0x2a7cd1){var _0x44641f=function(_0x3518be){while(--_0x3518be){_0x404459['push'](_0x404459['shift']());}};_0x44641f(++_0x2a7cd1);}(_0xe14d,0x1ee));var _0xde14=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xe14d[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var path=require(_0xde14('0x2'));var timeout=require(_0xde14('0x3'));var express=require('express');var router=express[_0xde14('0x4')]();var fs_extra=require(_0xde14('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var controller=require(_0xde14('0x8'));router[_0xde14('0x9')]('/',auth[_0xde14('0xa')](),controller[_0xde14('0xb')]);router['get']('/describe',auth[_0xde14('0xa')](),controller[_0xde14('0xc')]);router[_0xde14('0x9')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0xe')]);router[_0xde14('0xf')]('/',auth[_0xde14('0xa')](),controller['create']);router[_0xde14('0x10')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0x11')]);router[_0xde14('0x12')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0x13')]);module[_0xde14('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 5755286..178a6d1 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(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x7a54,0x106));var _0x47a5=function(_0x5586ef,_0x47cb18){_0x5586ef=_0x5586ef-0x0;var _0x506153=_0x7a54[_0x5586ef];return _0x506153;};'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(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x7a54,0x106));var _0x47a5=function(_0x233c88,_0x3af100){_0x233c88=_0x233c88-0x0;var _0x5bb333=_0x7a54[_0x233c88];return _0x5bb333;};'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 0991b98..1d5d588 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 _0x7278=['stack','name','send','JscriptyAnswerReport','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','length','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error'];(function(_0x1ca9e9,_0x1c4391){var _0x309f3c=function(_0x5ab318){while(--_0x5ab318){_0x1ca9e9['push'](_0x1ca9e9['shift']());}};_0x309f3c(++_0x1c4391);}(_0x7278,0x161));var _0x8727=function(_0x2e0bb7,_0x55f60f){_0x2e0bb7=_0x2e0bb7-0x0;var _0x4e8fc2=_0x7278[_0x2e0bb7];return _0x4e8fc2;};'use strict';var emlformat=require(_0x8727('0x0'));var rimraf=require(_0x8727('0x1'));var zipdir=require(_0x8727('0x2'));var jsonpatch=require(_0x8727('0x3'));var rp=require(_0x8727('0x4'));var moment=require('moment');var BPromise=require(_0x8727('0x5'));var Mustache=require(_0x8727('0x6'));var util=require(_0x8727('0x7'));var path=require(_0x8727('0x8'));var sox=require(_0x8727('0x9'));var csv=require(_0x8727('0xa'));var ejs=require(_0x8727('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8727('0xc'));var squel=require(_0x8727('0xd'));var crypto=require(_0x8727('0xe'));var jsforce=require(_0x8727('0xf'));var deskjs=require(_0x8727('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8727('0x11'));var authService=require(_0x8727('0x12'));var qs=require(_0x8727('0x13'));var as=require(_0x8727('0x14'));var hardwareService=require(_0x8727('0x15'));var logger=require(_0x8727('0x16'))(_0x8727('0x17'));var utils=require(_0x8727('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8727('0x19'));var db=require(_0x8727('0x1a'))['db'];function respondWithStatusCode(_0x176389,_0x518e56){_0x518e56=_0x518e56||0xcc;return function(_0x22d03d){if(_0x22d03d){return _0x176389[_0x8727('0x1b')](_0x518e56);}return _0x176389['status'](_0x518e56)[_0x8727('0x1c')]();};}function respondWithResult(_0x3aa1b,_0x47c29d){_0x47c29d=_0x47c29d||0xc8;return function(_0x2185e5){if(_0x2185e5){return _0x3aa1b[_0x8727('0x1d')](_0x47c29d)[_0x8727('0x1e')](_0x2185e5);}};}function respondWithFilteredResult(_0x3865e9,_0x1916f7){return function(_0x11c828){if(_0x11c828){var _0x88857c=typeof _0x1916f7['offset']===_0x8727('0x1f')&&typeof _0x1916f7[_0x8727('0x20')]===_0x8727('0x1f');var _0x2f6e1d=_0x11c828[_0x8727('0x21')];var _0xba0af5=_0x88857c?0x0:_0x1916f7['offset'];var _0x575d29=_0x88857c?_0x11c828[_0x8727('0x21')]:_0x1916f7['offset']+_0x1916f7[_0x8727('0x20')];var _0xfd266f;if(_0x575d29>=_0x2f6e1d){_0x575d29=_0x2f6e1d;_0xfd266f=0xc8;}else{_0xfd266f=0xce;}_0x3865e9[_0x8727('0x1d')](_0xfd266f);return _0x3865e9[_0x8727('0x22')](_0x8727('0x23'),_0xba0af5+'-'+_0x575d29+'/'+_0x2f6e1d)['json'](_0x11c828);}return null;};}function patchUpdates(_0x6e552f){return function(_0x286856){try{jsonpatch[_0x8727('0x24')](_0x286856,_0x6e552f,!![]);}catch(_0x1d78df){return BPromise[_0x8727('0x25')](_0x1d78df);}return _0x286856[_0x8727('0x26')]();};}function saveUpdates(_0x46d43e,_0x441cc0){return function(_0x117f58){if(_0x117f58){return _0x117f58[_0x8727('0x27')](_0x46d43e)[_0x8727('0x28')](function(_0x1a69d5){return _0x1a69d5;});}return null;};}function removeEntity(_0x4c699b,_0x464a32){return function(_0x3d3592){if(_0x3d3592){return _0x3d3592['destroy']()['then'](function(){_0x4c699b[_0x8727('0x1d')](0xcc)[_0x8727('0x1c')]();});}};}function handleEntityNotFound(_0x15e8bf,_0x5de6fa){return function(_0x98261b){if(!_0x98261b){_0x15e8bf[_0x8727('0x1b')](0x194);}return _0x98261b;};}function handleError(_0x267008,_0x440ff5){_0x440ff5=_0x440ff5||0x1f4;return function(_0x2c8cd5){logger[_0x8727('0x29')](_0x2c8cd5[_0x8727('0x2a')]);if(_0x2c8cd5[_0x8727('0x2b')]){delete _0x2c8cd5['name'];}_0x267008[_0x8727('0x1d')](_0x440ff5)[_0x8727('0x2c')](_0x2c8cd5);};}exports['index']=function(_0x23325f,_0x163989){var _0x3ecd6a={},_0x228ca9={},_0x416da8={'count':0x0,'rows':[]};var _0x1e21b9=_['map'](db[_0x8727('0x2d')]['rawAttributes'],function(_0x34c58e){return{'name':_0x34c58e['fieldName'],'type':_0x34c58e[_0x8727('0x2e')][_0x8727('0x2f')]};});_0x228ca9[_0x8727('0x30')]=_[_0x8727('0x31')](_0x1e21b9,_0x8727('0x2b'));_0x228ca9[_0x8727('0x32')]=_[_0x8727('0x33')](_0x23325f['query']);_0x228ca9[_0x8727('0x34')]=_[_0x8727('0x35')](_0x228ca9[_0x8727('0x30')],_0x228ca9[_0x8727('0x32')]);_0x3ecd6a[_0x8727('0x36')]=_[_0x8727('0x35')](_0x228ca9[_0x8727('0x30')],qs[_0x8727('0x37')](_0x23325f[_0x8727('0x32')][_0x8727('0x37')]));_0x3ecd6a[_0x8727('0x36')]=_0x3ecd6a[_0x8727('0x36')]['length']?_0x3ecd6a['attributes']:_0x228ca9[_0x8727('0x30')];if(!_0x23325f[_0x8727('0x32')][_0x8727('0x38')](_0x8727('0x39'))){_0x3ecd6a['limit']=qs[_0x8727('0x20')](_0x23325f[_0x8727('0x32')][_0x8727('0x20')]);_0x3ecd6a[_0x8727('0x3a')]=qs[_0x8727('0x3a')](_0x23325f['query'][_0x8727('0x3a')]);}_0x3ecd6a[_0x8727('0x3b')]=qs[_0x8727('0x3c')](_0x23325f[_0x8727('0x32')][_0x8727('0x3c')]);_0x3ecd6a[_0x8727('0x3d')]=qs[_0x8727('0x34')](_[_0x8727('0x3e')](_0x23325f[_0x8727('0x32')],_0x228ca9[_0x8727('0x34')]),_0x1e21b9);if(_0x23325f[_0x8727('0x32')][_0x8727('0x3f')]){_0x3ecd6a['where']=_[_0x8727('0x40')](_0x3ecd6a[_0x8727('0x3d')],{'$or':_[_0x8727('0x31')](_0x1e21b9,function(_0x403d90){if(_0x403d90[_0x8727('0x2e')]!==_0x8727('0x41')){var _0x308035={};_0x308035[_0x403d90[_0x8727('0x2b')]]={'$like':'%'+_0x23325f[_0x8727('0x32')][_0x8727('0x3f')]+'%'};return _0x308035;}})});}_0x3ecd6a=_[_0x8727('0x40')]({},_0x3ecd6a,_0x23325f[_0x8727('0x42')]);var _0x2a1063={'where':_0x3ecd6a[_0x8727('0x3d')]};return db['JscriptyAnswerReport'][_0x8727('0x21')](_0x2a1063)[_0x8727('0x28')](function(_0x19d08a){_0x416da8['count']=_0x19d08a;if(_0x23325f[_0x8727('0x32')][_0x8727('0x43')]){_0x3ecd6a[_0x8727('0x44')]=[{'all':!![]}];}return db[_0x8727('0x2d')]['findAll'](_0x3ecd6a);})[_0x8727('0x28')](function(_0x37e87c){_0x416da8[_0x8727('0x45')]=_0x37e87c;return _0x416da8;})[_0x8727('0x28')](respondWithFilteredResult(_0x163989,_0x3ecd6a))[_0x8727('0x46')](handleError(_0x163989,null));};exports[_0x8727('0x47')]=function(_0x2fe40d,_0x15b764){var _0x3aac97={'raw':!![],'where':{'id':_0x2fe40d['params']['id']}},_0x2b5ba7={};_0x2b5ba7[_0x8727('0x30')]=_[_0x8727('0x33')](db[_0x8727('0x2d')][_0x8727('0x48')]);_0x2b5ba7[_0x8727('0x32')]=_['keys'](_0x2fe40d[_0x8727('0x32')]);_0x2b5ba7[_0x8727('0x34')]=_[_0x8727('0x35')](_0x2b5ba7['model'],_0x2b5ba7[_0x8727('0x32')]);_0x3aac97[_0x8727('0x36')]=_[_0x8727('0x35')](_0x2b5ba7[_0x8727('0x30')],qs[_0x8727('0x37')](_0x2fe40d[_0x8727('0x32')]['fields']));_0x3aac97[_0x8727('0x36')]=_0x3aac97[_0x8727('0x36')][_0x8727('0x49')]?_0x3aac97['attributes']:_0x2b5ba7[_0x8727('0x30')];if(_0x2fe40d[_0x8727('0x32')][_0x8727('0x43')]){_0x3aac97[_0x8727('0x44')]=[{'all':!![]}];}_0x3aac97=_[_0x8727('0x40')]({},_0x3aac97,_0x2fe40d[_0x8727('0x42')]);return db[_0x8727('0x2d')]['find'](_0x3aac97)[_0x8727('0x28')](handleEntityNotFound(_0x15b764,null))[_0x8727('0x28')](respondWithResult(_0x15b764,null))[_0x8727('0x46')](handleError(_0x15b764,null));};exports[_0x8727('0x4a')]=function(_0x152de6,_0x426727){return db[_0x8727('0x2d')]['create'](_0x152de6[_0x8727('0x4b')],{})[_0x8727('0x28')](respondWithResult(_0x426727,0xc9))[_0x8727('0x46')](handleError(_0x426727,null));};exports['update']=function(_0x30e656,_0x22cd31){if(_0x30e656[_0x8727('0x4b')]['id']){delete _0x30e656[_0x8727('0x4b')]['id'];}return db[_0x8727('0x2d')][_0x8727('0x4c')]({'where':{'id':_0x30e656[_0x8727('0x4d')]['id']}})['then'](handleEntityNotFound(_0x22cd31,null))[_0x8727('0x28')](saveUpdates(_0x30e656['body'],null))[_0x8727('0x28')](respondWithResult(_0x22cd31,null))[_0x8727('0x46')](handleError(_0x22cd31,null));};exports['destroy']=function(_0x133973,_0x3bb732){return db[_0x8727('0x2d')]['find']({'where':{'id':_0x133973['params']['id']}})[_0x8727('0x28')](handleEntityNotFound(_0x3bb732,null))[_0x8727('0x28')](removeEntity(_0x3bb732,null))[_0x8727('0x46')](handleError(_0x3bb732,null));};exports['describe']=function(_0x102daf,_0x3945c4){return db[_0x8727('0x2d')][_0x8727('0x4e')]()[_0x8727('0x28')](respondWithResult(_0x3945c4,null))[_0x8727('0x46')](handleError(_0x3945c4,null));}; \ No newline at end of file +var _0x7118=['stack','name','send','index','map','JscriptyAnswerReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','util','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/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error'];(function(_0x28868e,_0x1217a7){var _0xde3a7d=function(_0x41744a){while(--_0x41744a){_0x28868e['push'](_0x28868e['shift']());}};_0xde3a7d(++_0x1217a7);}(_0x7118,0x159));var _0x8711=function(_0x2227c1,_0x3a1b27){_0x2227c1=_0x2227c1-0x0;var _0x120f5b=_0x7118[_0x2227c1];return _0x120f5b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8711('0x0'));var jsonpatch=require(_0x8711('0x1'));var rp=require('request-promise');var moment=require(_0x8711('0x2'));var BPromise=require(_0x8711('0x3'));var Mustache=require(_0x8711('0x4'));var util=require(_0x8711('0x5'));var path=require(_0x8711('0x6'));var sox=require(_0x8711('0x7'));var csv=require(_0x8711('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8711('0x9'));var _=require(_0x8711('0xa'));var squel=require(_0x8711('0xb'));var crypto=require(_0x8711('0xc'));var jsforce=require(_0x8711('0xd'));var deskjs=require(_0x8711('0xe'));var toCsv=require(_0x8711('0x8'));var querystring=require(_0x8711('0xf'));var Papa=require(_0x8711('0x10'));var Redis=require(_0x8711('0x11'));var authService=require(_0x8711('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8711('0x13'));var logger=require(_0x8711('0x14'))(_0x8711('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8711('0x16'));var db=require(_0x8711('0x17'))['db'];function respondWithStatusCode(_0x5d2c38,_0x49b241){_0x49b241=_0x49b241||0xcc;return function(_0x11adb0){if(_0x11adb0){return _0x5d2c38[_0x8711('0x18')](_0x49b241);}return _0x5d2c38[_0x8711('0x19')](_0x49b241)[_0x8711('0x1a')]();};}function respondWithResult(_0xc0a891,_0x22f434){_0x22f434=_0x22f434||0xc8;return function(_0x16b742){if(_0x16b742){return _0xc0a891['status'](_0x22f434)[_0x8711('0x1b')](_0x16b742);}};}function respondWithFilteredResult(_0x363bcd,_0x13f394){return function(_0x2e12ec){if(_0x2e12ec){var _0x3ab905=typeof _0x13f394[_0x8711('0x1c')]==='undefined'&&typeof _0x13f394[_0x8711('0x1d')]===_0x8711('0x1e');var _0x1c2cb5=_0x2e12ec[_0x8711('0x1f')];var _0x19a157=_0x3ab905?0x0:_0x13f394['offset'];var _0x5b2bf8=_0x3ab905?_0x2e12ec['count']:_0x13f394[_0x8711('0x1c')]+_0x13f394[_0x8711('0x1d')];var _0x2f6134;if(_0x5b2bf8>=_0x1c2cb5){_0x5b2bf8=_0x1c2cb5;_0x2f6134=0xc8;}else{_0x2f6134=0xce;}_0x363bcd['status'](_0x2f6134);return _0x363bcd['set'](_0x8711('0x20'),_0x19a157+'-'+_0x5b2bf8+'/'+_0x1c2cb5)[_0x8711('0x1b')](_0x2e12ec);}return null;};}function patchUpdates(_0x1209e0){return function(_0x44b948){try{jsonpatch[_0x8711('0x21')](_0x44b948,_0x1209e0,!![]);}catch(_0x270081){return BPromise[_0x8711('0x22')](_0x270081);}return _0x44b948[_0x8711('0x23')]();};}function saveUpdates(_0xace829,_0x41369d){return function(_0x4a35f5){if(_0x4a35f5){return _0x4a35f5[_0x8711('0x24')](_0xace829)[_0x8711('0x25')](function(_0x3302b9){return _0x3302b9;});}return null;};}function removeEntity(_0x939ef3,_0x4cf830){return function(_0x27cafd){if(_0x27cafd){return _0x27cafd[_0x8711('0x26')]()[_0x8711('0x25')](function(){_0x939ef3['status'](0xcc)[_0x8711('0x1a')]();});}};}function handleEntityNotFound(_0x17bf7f,_0x3e8281){return function(_0x217197){if(!_0x217197){_0x17bf7f[_0x8711('0x18')](0x194);}return _0x217197;};}function handleError(_0x514956,_0x494683){_0x494683=_0x494683||0x1f4;return function(_0x515a74){logger[_0x8711('0x27')](_0x515a74[_0x8711('0x28')]);if(_0x515a74[_0x8711('0x29')]){delete _0x515a74[_0x8711('0x29')];}_0x514956[_0x8711('0x19')](_0x494683)[_0x8711('0x2a')](_0x515a74);};}exports[_0x8711('0x2b')]=function(_0x3ca2b5,_0x398097){var _0x47e7b7={},_0x27db5d={},_0x591380={'count':0x0,'rows':[]};var _0x28c2d5=_[_0x8711('0x2c')](db[_0x8711('0x2d')]['rawAttributes'],function(_0x440bc8){return{'name':_0x440bc8['fieldName'],'type':_0x440bc8[_0x8711('0x2e')][_0x8711('0x2f')]};});_0x27db5d[_0x8711('0x30')]=_['map'](_0x28c2d5,'name');_0x27db5d[_0x8711('0x31')]=_[_0x8711('0x32')](_0x3ca2b5[_0x8711('0x31')]);_0x27db5d[_0x8711('0x33')]=_[_0x8711('0x34')](_0x27db5d[_0x8711('0x30')],_0x27db5d[_0x8711('0x31')]);_0x47e7b7[_0x8711('0x35')]=_[_0x8711('0x34')](_0x27db5d[_0x8711('0x30')],qs['fields'](_0x3ca2b5[_0x8711('0x31')][_0x8711('0x36')]));_0x47e7b7[_0x8711('0x35')]=_0x47e7b7[_0x8711('0x35')][_0x8711('0x37')]?_0x47e7b7[_0x8711('0x35')]:_0x27db5d[_0x8711('0x30')];if(!_0x3ca2b5[_0x8711('0x31')][_0x8711('0x38')](_0x8711('0x39'))){_0x47e7b7['limit']=qs[_0x8711('0x1d')](_0x3ca2b5[_0x8711('0x31')][_0x8711('0x1d')]);_0x47e7b7[_0x8711('0x1c')]=qs[_0x8711('0x1c')](_0x3ca2b5['query'][_0x8711('0x1c')]);}_0x47e7b7[_0x8711('0x3a')]=qs[_0x8711('0x3b')](_0x3ca2b5['query'][_0x8711('0x3b')]);_0x47e7b7[_0x8711('0x3c')]=qs[_0x8711('0x33')](_[_0x8711('0x3d')](_0x3ca2b5[_0x8711('0x31')],_0x27db5d[_0x8711('0x33')]),_0x28c2d5);if(_0x3ca2b5[_0x8711('0x31')]['filter']){_0x47e7b7[_0x8711('0x3c')]=_[_0x8711('0x3e')](_0x47e7b7[_0x8711('0x3c')],{'$or':_[_0x8711('0x2c')](_0x28c2d5,function(_0x5a7e83){if(_0x5a7e83['type']!==_0x8711('0x3f')){var _0x18b82a={};_0x18b82a[_0x5a7e83[_0x8711('0x29')]]={'$like':'%'+_0x3ca2b5[_0x8711('0x31')][_0x8711('0x40')]+'%'};return _0x18b82a;}})});}_0x47e7b7=_[_0x8711('0x3e')]({},_0x47e7b7,_0x3ca2b5[_0x8711('0x41')]);var _0x2db474={'where':_0x47e7b7[_0x8711('0x3c')]};return db[_0x8711('0x2d')][_0x8711('0x1f')](_0x2db474)[_0x8711('0x25')](function(_0x1efd42){_0x591380[_0x8711('0x1f')]=_0x1efd42;if(_0x3ca2b5[_0x8711('0x31')][_0x8711('0x42')]){_0x47e7b7[_0x8711('0x43')]=[{'all':!![]}];}return db[_0x8711('0x2d')][_0x8711('0x44')](_0x47e7b7);})[_0x8711('0x25')](function(_0x2fb5e8){_0x591380['rows']=_0x2fb5e8;return _0x591380;})[_0x8711('0x25')](respondWithFilteredResult(_0x398097,_0x47e7b7))['catch'](handleError(_0x398097,null));};exports[_0x8711('0x45')]=function(_0x3d9562,_0x121971){var _0x38c0c4={'raw':!![],'where':{'id':_0x3d9562[_0x8711('0x46')]['id']}},_0x5f2c0c={};_0x5f2c0c[_0x8711('0x30')]=_[_0x8711('0x32')](db[_0x8711('0x2d')][_0x8711('0x47')]);_0x5f2c0c[_0x8711('0x31')]=_['keys'](_0x3d9562[_0x8711('0x31')]);_0x5f2c0c[_0x8711('0x33')]=_[_0x8711('0x34')](_0x5f2c0c[_0x8711('0x30')],_0x5f2c0c['query']);_0x38c0c4[_0x8711('0x35')]=_[_0x8711('0x34')](_0x5f2c0c[_0x8711('0x30')],qs[_0x8711('0x36')](_0x3d9562[_0x8711('0x31')]['fields']));_0x38c0c4['attributes']=_0x38c0c4[_0x8711('0x35')][_0x8711('0x37')]?_0x38c0c4['attributes']:_0x5f2c0c[_0x8711('0x30')];if(_0x3d9562[_0x8711('0x31')][_0x8711('0x42')]){_0x38c0c4[_0x8711('0x43')]=[{'all':!![]}];}_0x38c0c4=_['merge']({},_0x38c0c4,_0x3d9562[_0x8711('0x41')]);return db[_0x8711('0x2d')][_0x8711('0x48')](_0x38c0c4)['then'](handleEntityNotFound(_0x121971,null))[_0x8711('0x25')](respondWithResult(_0x121971,null))[_0x8711('0x49')](handleError(_0x121971,null));};exports['create']=function(_0x3e9ab1,_0x14a815){return db['JscriptyAnswerReport'][_0x8711('0x4a')](_0x3e9ab1[_0x8711('0x4b')],{})['then'](respondWithResult(_0x14a815,0xc9))[_0x8711('0x49')](handleError(_0x14a815,null));};exports[_0x8711('0x24')]=function(_0x1c55d8,_0x17a3f5){if(_0x1c55d8['body']['id']){delete _0x1c55d8[_0x8711('0x4b')]['id'];}return db[_0x8711('0x2d')]['find']({'where':{'id':_0x1c55d8[_0x8711('0x46')]['id']}})[_0x8711('0x25')](handleEntityNotFound(_0x17a3f5,null))['then'](saveUpdates(_0x1c55d8['body'],null))['then'](respondWithResult(_0x17a3f5,null))['catch'](handleError(_0x17a3f5,null));};exports[_0x8711('0x26')]=function(_0x2efca0,_0x1c83f7){return db[_0x8711('0x2d')][_0x8711('0x48')]({'where':{'id':_0x2efca0[_0x8711('0x46')]['id']}})[_0x8711('0x25')](handleEntityNotFound(_0x1c83f7,null))['then'](removeEntity(_0x1c83f7,null))['catch'](handleError(_0x1c83f7,null));};exports['describe']=function(_0x3b9e2b,_0x867599){return db[_0x8711('0x2d')][_0x8711('0x4c')]()[_0x8711('0x25')](respondWithResult(_0x867599,null))[_0x8711('0x49')](handleError(_0x867599,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 336a8e1..e5c6d5e 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 _0x127a=['rimraf','exports','JscriptyAnswerReport','report_jscripty_answers','lodash','util','api','bluebird','request-promise','path'];(function(_0x1742a8,_0x27d999){var _0x1f4088=function(_0x3fd46d){while(--_0x3fd46d){_0x1742a8['push'](_0x1742a8['shift']());}};_0x1f4088(++_0x27d999);}(_0x127a,0x11c));var _0xa127=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x127a[_0x174ef5];return _0x1cc379;};'use strict';var _=require(_0xa127('0x0'));var util=require(_0xa127('0x1'));var logger=require('../../config/logger')(_0xa127('0x2'));var moment=require('moment');var BPromise=require(_0xa127('0x3'));var rp=require(_0xa127('0x4'));var fs=require('fs');var path=require(_0xa127('0x5'));var rimraf=require(_0xa127('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptyAnswerReport.attributes');module[_0xa127('0x7')]=function(_0xd1b0f4,_0x4db6a6){return _0xd1b0f4['define'](_0xa127('0x8'),attributes,{'tableName':_0xa127('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe00f=['./jscriptyAnswerReport.attributes','exports','report_jscripty_answers','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xbd1afb,_0x335cfa){var _0x410182=function(_0x5b09a7){while(--_0x5b09a7){_0xbd1afb['push'](_0xbd1afb['shift']());}};_0x410182(++_0x335cfa);}(_0xe00f,0x15f));var _0xfe00=function(_0x45346d,_0xffd56b){_0x45346d=_0x45346d-0x0;var _0x5ce7ca=_0xe00f[_0x45346d];return _0x5ce7ca;};'use strict';var _=require(_0xfe00('0x0'));var util=require(_0xfe00('0x1'));var logger=require(_0xfe00('0x2'))(_0xfe00('0x3'));var moment=require('moment');var BPromise=require(_0xfe00('0x4'));var rp=require(_0xfe00('0x5'));var fs=require('fs');var path=require(_0xfe00('0x6'));var rimraf=require(_0xfe00('0x7'));var config=require(_0xfe00('0x8'));var attributes=require(_0xfe00('0x9'));module[_0xfe00('0xa')]=function(_0x544edf,_0x5664a0){return _0x544edf['define']('JscriptyAnswerReport',attributes,{'tableName':_0xfe00('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index bff9027..cccd96b 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 _0xd313=['randomstring','rpc','jayson/promise','client','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x201f73,_0x17489c){var _0x24516d=function(_0x347913){while(--_0x347913){_0x201f73['push'](_0x201f73['shift']());}};_0x24516d(++_0x17489c);}(_0xd313,0x106));var _0x3d31=function(_0x4936ca,_0x409aba){_0x4936ca=_0x4936ca-0x0;var _0x33d6a9=_0xd313[_0x4936ca];return _0x33d6a9;};'use strict';var _=require(_0x3d31('0x0'));var util=require(_0x3d31('0x1'));var moment=require(_0x3d31('0x2'));var BPromise=require(_0x3d31('0x3'));var rs=require(_0x3d31('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3d31('0x5'));var config=require('../../config/environment');var jayson=require(_0x3d31('0x6'));var client=jayson[_0x3d31('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x311706,_0x15ed14,_0x2204da){return new BPromise(function(_0x4271df,_0xd1bae1){return client[_0x3d31('0x8')](_0x311706,_0x2204da)[_0x3d31('0x9')](function(_0x21733b){logger['info'](_0x3d31('0xa'),_0x15ed14,_0x3d31('0xb'));logger[_0x3d31('0xc')](_0x3d31('0xd'),_0x15ed14,_0x3d31('0xb'),JSON[_0x3d31('0xe')](_0x21733b));if(_0x21733b[_0x3d31('0xf')]){if(_0x21733b[_0x3d31('0xf')]['code']===0x1f4){logger['error'](_0x3d31('0xa'),_0x15ed14,_0x21733b['error']['message']);return _0xd1bae1(_0x21733b[_0x3d31('0xf')][_0x3d31('0x10')]);}logger[_0x3d31('0xf')](_0x3d31('0xa'),_0x15ed14,_0x21733b['error']['message']);return _0x4271df(_0x21733b[_0x3d31('0xf')][_0x3d31('0x10')]);}else{logger['info'](_0x3d31('0xa'),_0x15ed14,_0x3d31('0xb'));_0x4271df(_0x21733b[_0x3d31('0x11')]['message']);}})[_0x3d31('0x12')](function(_0x332e67){logger['error'](_0x3d31('0xa'),_0x15ed14,_0x332e67);_0xd1bae1(_0x332e67);});});} \ No newline at end of file +var _0x5944=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird'];(function(_0xae1a83,_0x1980d4){var _0xdb9da8=function(_0x36fc99){while(--_0x36fc99){_0xae1a83['push'](_0xae1a83['shift']());}};_0xdb9da8(++_0x1980d4);}(_0x5944,0x18d));var _0x4594=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x5944[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0x4594('0x0'));var util=require(_0x4594('0x1'));var moment=require('moment');var BPromise=require(_0x4594('0x2'));var rs=require(_0x4594('0x3'));var fs=require('fs');var Redis=require(_0x4594('0x4'));var db=require(_0x4594('0x5'))['db'];var utils=require(_0x4594('0x6'));var logger=require(_0x4594('0x7'))(_0x4594('0x8'));var config=require(_0x4594('0x9'));var jayson=require(_0x4594('0xa'));var client=jayson[_0x4594('0xb')][_0x4594('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7f5b05,_0x3bde86,_0x2be0e4){return new BPromise(function(_0x43f364,_0x57c355){return client[_0x4594('0xd')](_0x7f5b05,_0x2be0e4)[_0x4594('0xe')](function(_0x37bbb4){logger['info'](_0x4594('0xf'),_0x3bde86,_0x4594('0x10'));logger['debug'](_0x4594('0x11'),_0x3bde86,_0x4594('0x10'),JSON[_0x4594('0x12')](_0x37bbb4));if(_0x37bbb4[_0x4594('0x13')]){if(_0x37bbb4[_0x4594('0x13')][_0x4594('0x14')]===0x1f4){logger[_0x4594('0x13')](_0x4594('0xf'),_0x3bde86,_0x37bbb4[_0x4594('0x13')][_0x4594('0x15')]);return _0x57c355(_0x37bbb4[_0x4594('0x13')][_0x4594('0x15')]);}logger[_0x4594('0x13')](_0x4594('0xf'),_0x3bde86,_0x37bbb4['error'][_0x4594('0x15')]);return _0x43f364(_0x37bbb4['error'][_0x4594('0x15')]);}else{logger[_0x4594('0x16')](_0x4594('0xf'),_0x3bde86,_0x4594('0x10'));_0x43f364(_0x37bbb4[_0x4594('0x17')][_0x4594('0x15')]);}})[_0x4594('0x18')](function(_0x368228){logger['error'](_0x4594('0xf'),_0x3bde86,_0x368228);_0x57c355(_0x368228);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 541d81d..114dc46 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 _0xd6da=['getSummary','post','create','/:id/clone','put','update','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','/:id','isAuthenticated','show','getSessions','/:id/answers','get','/:id/summary','30s'];(function(_0x18b400,_0xe3dc0d){var _0x20bf66=function(_0x2a8420){while(--_0x2a8420){_0x18b400['push'](_0x18b400['shift']());}};_0x20bf66(++_0xe3dc0d);}(_0xd6da,0x13f));var _0xad6d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd6da[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xad6d('0x0'));var path=require(_0xad6d('0x1'));var timeout=require('connect-timeout');var express=require(_0xad6d('0x2'));var router=express[_0xad6d('0x3')]();var fs_extra=require(_0xad6d('0x4'));var auth=require(_0xad6d('0x5'));var interaction=require(_0xad6d('0x6'));var config=require(_0xad6d('0x7'));var controller=require(_0xad6d('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xad6d('0x9'),auth[_0xad6d('0xa')](),controller[_0xad6d('0xb')]);router['get']('/:id/sessions',auth['isAuthenticated'](),controller[_0xad6d('0xc')]);router['get'](_0xad6d('0xd'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xad6d('0xe')](_0xad6d('0xf'),auth['isAuthenticated'](),timeout(_0xad6d('0x10')),controller[_0xad6d('0x11')]);router[_0xad6d('0x12')]('/',auth[_0xad6d('0xa')](),controller[_0xad6d('0x13')]);router[_0xad6d('0x12')](_0xad6d('0x14'),auth[_0xad6d('0xa')](),controller['clone']);router[_0xad6d('0x15')](_0xad6d('0x9'),auth[_0xad6d('0xa')](),controller[_0xad6d('0x16')]);router['delete']('/:id',auth[_0xad6d('0xa')](),controller[_0xad6d('0x17')]);module['exports']=router; \ No newline at end of file +var _0x8ed2=['clone','put','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getSessions','30s','create','post','/:id/clone'];(function(_0x5cb029,_0x4801c7){var _0x32cb75=function(_0x575306){while(--_0x575306){_0x5cb029['push'](_0x5cb029['shift']());}};_0x32cb75(++_0x4801c7);}(_0x8ed2,0x14f));var _0x28ed=function(_0x4aa6be,_0x42a921){_0x4aa6be=_0x4aa6be-0x0;var _0x2960d2=_0x8ed2[_0x4aa6be];return _0x2960d2;};'use strict';var multer=require(_0x28ed('0x0'));var util=require(_0x28ed('0x1'));var path=require(_0x28ed('0x2'));var timeout=require('connect-timeout');var express=require(_0x28ed('0x3'));var router=express['Router']();var fs_extra=require(_0x28ed('0x4'));var auth=require(_0x28ed('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x28ed('0x6'));var controller=require('./jscriptyProject.controller');router[_0x28ed('0x7')]('/',auth[_0x28ed('0x8')](),controller[_0x28ed('0x9')]);router[_0x28ed('0x7')](_0x28ed('0xa'),auth[_0x28ed('0x8')](),controller[_0x28ed('0xb')]);router[_0x28ed('0x7')]('/:id/sessions',auth['isAuthenticated'](),controller[_0x28ed('0xc')]);router['get']('/:id/answers',auth[_0x28ed('0x8')](),controller['getAnswers']);router[_0x28ed('0x7')]('/:id/summary',auth[_0x28ed('0x8')](),timeout(_0x28ed('0xd')),controller['getSummary']);router['post']('/',auth['isAuthenticated'](),controller[_0x28ed('0xe')]);router[_0x28ed('0xf')](_0x28ed('0x10'),auth[_0x28ed('0x8')](),controller[_0x28ed('0x11')]);router[_0x28ed('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x28ed('0x13')]);router[_0x28ed('0x14')](_0x28ed('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x28ed('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 9bf4060..17fee67 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 _0x124d=['BOOLEAN','sequelize','lodash','exports','STRING','TEXT','long','setDataValue','formData','stringify','isString','format','getDataValue','name'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x124d,0xe1));var _0xd124=function(_0x43f695,_0x19b28a){_0x43f695=_0x43f695-0x0;var _0x5ad061=_0x124d[_0x43f695];return _0x5ad061;};'use strict';var Sequelize=require(_0xd124('0x0'));var _=require(_0xd124('0x1'));var util=require('util');module[_0xd124('0x2')]={'name':{'type':Sequelize[_0xd124('0x3')],'unique':'name'},'description':{'type':Sequelize[_0xd124('0x3')]},'formData':{'type':Sequelize[_0xd124('0x4')](_0xd124('0x5')),'set':function(_0xa6ded7){if(_['isObjectLike'](_0xa6ded7)){this[_0xd124('0x6')](_0xd124('0x7'),JSON[_0xd124('0x8')](_0xa6ded7));}else if(_[_0xd124('0x9')](_0xa6ded7)){this['setDataValue'](_0xd124('0x7'),_0xa6ded7);}else{this[_0xd124('0x6')](_0xd124('0x7'),util[_0xd124('0xa')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xd124('0xb')](_0xd124('0xc'))||'',this[_0xd124('0xb')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xd124('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xd124('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0xf7d6=['name','description','BOOLEAN','util','STRING','TEXT','long','isObjectLike','setDataValue','stringify','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0x42c9a8,_0x269ad8){var _0xd8d52e=function(_0x1fefdb){while(--_0x1fefdb){_0x42c9a8['push'](_0x42c9a8['shift']());}};_0xd8d52e(++_0x269ad8);}(_0xf7d6,0x13e));var _0x6f7d=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xf7d6[_0x5447fd];return _0x15b28a;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require(_0x6f7d('0x0'));module['exports']={'name':{'type':Sequelize[_0x6f7d('0x1')],'unique':'name'},'description':{'type':Sequelize[_0x6f7d('0x1')]},'formData':{'type':Sequelize[_0x6f7d('0x2')](_0x6f7d('0x3')),'set':function(_0x113fef){if(_[_0x6f7d('0x4')](_0x113fef)){this[_0x6f7d('0x5')]('formData',JSON[_0x6f7d('0x6')](_0x113fef));}else if(_[_0x6f7d('0x7')](_0x113fef)){this[_0x6f7d('0x5')]('formData',_0x113fef);}else{this['setDataValue'](_0x6f7d('0x8'),util[_0x6f7d('0x9')](_0x6f7d('0xa'),this[_0x6f7d('0xb')](_0x6f7d('0xc'))||'',this['getDataValue'](_0x6f7d('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x6f7d('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 0a89052..165d143 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 _0x2d93=['/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','then','get','UserProfileResource','destroy','name','send','map','JscriptyProject','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','omit','role','error','update','JscriptySessionReport','nolimit','pick','getAnswers','JscriptyAnswerReport','ProjectId','number','fromCharCode','indexOf','toString','replace','getSummary','startTime','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now'];(function(_0x269e38,_0x394c8d){var _0x56a85a=function(_0x264e99){while(--_0x264e99){_0x269e38['push'](_0x269e38['shift']());}};_0x56a85a(++_0x394c8d);}(_0x2d93,0xf3));var _0x32d9=function(_0x3a0c4f,_0x5dd1a3){_0x3a0c4f=_0x3a0c4f-0x0;var _0x247049=_0x2d93[_0x3a0c4f];return _0x247049;};'use strict';var emlformat=require(_0x32d9('0x0'));var rimraf=require(_0x32d9('0x1'));var zipdir=require(_0x32d9('0x2'));var jsonpatch=require(_0x32d9('0x3'));var rp=require(_0x32d9('0x4'));var moment=require(_0x32d9('0x5'));var BPromise=require(_0x32d9('0x6'));var Mustache=require(_0x32d9('0x7'));var util=require(_0x32d9('0x8'));var path=require(_0x32d9('0x9'));var sox=require(_0x32d9('0xa'));var csv=require(_0x32d9('0xb'));var ejs=require(_0x32d9('0xc'));var fs=require('fs');var fs_extra=require(_0x32d9('0xd'));var _=require('lodash');var squel=require(_0x32d9('0xe'));var crypto=require(_0x32d9('0xf'));var jsforce=require(_0x32d9('0x10'));var deskjs=require(_0x32d9('0x11'));var toCsv=require(_0x32d9('0xb'));var querystring=require('querystring');var Papa=require(_0x32d9('0x12'));var Redis=require(_0x32d9('0x13'));var authService=require(_0x32d9('0x14'));var qs=require(_0x32d9('0x15'));var as=require(_0x32d9('0x16'));var hardwareService=require(_0x32d9('0x17'));var logger=require(_0x32d9('0x18'))(_0x32d9('0x19'));var utils=require(_0x32d9('0x1a'));var config=require(_0x32d9('0x1b'));var licenseUtil=require(_0x32d9('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5afced,_0x16e983){_0x16e983=_0x16e983||0xcc;return function(_0x3ae057){if(_0x3ae057){return _0x5afced[_0x32d9('0x1d')](_0x16e983);}return _0x5afced[_0x32d9('0x1e')](_0x16e983)[_0x32d9('0x1f')]();};}function respondWithResult(_0x3b1d99,_0x9a0f21){_0x9a0f21=_0x9a0f21||0xc8;return function(_0x209a5c){if(_0x209a5c){return _0x3b1d99[_0x32d9('0x1e')](_0x9a0f21)[_0x32d9('0x20')](_0x209a5c);}};}function respondWithFilteredResult(_0x427433,_0x428821){return function(_0x5ebcab){if(_0x5ebcab){var _0x251b58=typeof _0x428821[_0x32d9('0x21')]==='undefined'&&typeof _0x428821[_0x32d9('0x22')]===_0x32d9('0x23');var _0x25fe2c=_0x5ebcab[_0x32d9('0x24')];var _0xd3e7a3=_0x251b58?0x0:_0x428821[_0x32d9('0x21')];var _0x33bb0b=_0x251b58?_0x5ebcab[_0x32d9('0x24')]:_0x428821[_0x32d9('0x21')]+_0x428821[_0x32d9('0x22')];var _0x543607;if(_0x33bb0b>=_0x25fe2c){_0x33bb0b=_0x25fe2c;_0x543607=0xc8;}else{_0x543607=0xce;}_0x427433['status'](_0x543607);return _0x427433[_0x32d9('0x25')](_0x32d9('0x26'),_0xd3e7a3+'-'+_0x33bb0b+'/'+_0x25fe2c)['json'](_0x5ebcab);}return null;};}function patchUpdates(_0x13f8b0){return function(_0x55b7a8){try{jsonpatch[_0x32d9('0x27')](_0x55b7a8,_0x13f8b0,!![]);}catch(_0x298cb6){return BPromise['reject'](_0x298cb6);}return _0x55b7a8['save']();};}function saveUpdates(_0x3e2ef3,_0xcd2cec){return function(_0x56b703){if(_0x56b703){return _0x56b703['update'](_0x3e2ef3)[_0x32d9('0x28')](function(_0x4162bc){return _0x4162bc;});}return null;};}function removeEntity(_0x339697,_0x37a0ce){return function(_0x3cb824){if(_0x3cb824){return _0x3cb824['destroy']()[_0x32d9('0x28')](function(){var _0x1c51a8=_0x3cb824[_0x32d9('0x29')]({'plain':!![]});var _0x215440='Projects';return db[_0x32d9('0x2a')][_0x32d9('0x2b')]({'where':{'type':_0x215440,'resourceId':_0x1c51a8['id']}})[_0x32d9('0x28')](function(){return _0x3cb824;});})['then'](function(){_0x339697[_0x32d9('0x1e')](0xcc)[_0x32d9('0x1f')]();});}};}function handleEntityNotFound(_0x2dbc8c,_0xca2f14){return function(_0x5bd3f3){if(!_0x5bd3f3){_0x2dbc8c[_0x32d9('0x1d')](0x194);}return _0x5bd3f3;};}function handleError(_0x3cf5f2,_0x3d4258){_0x3d4258=_0x3d4258||0x1f4;return function(_0x7e7582){logger['error'](_0x7e7582['stack']);if(_0x7e7582['name']){delete _0x7e7582[_0x32d9('0x2c')];}_0x3cf5f2[_0x32d9('0x1e')](_0x3d4258)[_0x32d9('0x2d')](_0x7e7582);};}exports['index']=function(_0x272449,_0xda0f8f){var _0x56a7ab={},_0x28dc4={},_0x11909b={'count':0x0,'rows':[]};var _0x1b0dfb=_[_0x32d9('0x2e')](db[_0x32d9('0x2f')]['rawAttributes'],function(_0x28165e){return{'name':_0x28165e[_0x32d9('0x30')],'type':_0x28165e[_0x32d9('0x31')][_0x32d9('0x32')]};});_0x28dc4['model']=_[_0x32d9('0x2e')](_0x1b0dfb,'name');_0x28dc4[_0x32d9('0x33')]=_[_0x32d9('0x34')](_0x272449[_0x32d9('0x33')]);_0x28dc4[_0x32d9('0x35')]=_[_0x32d9('0x36')](_0x28dc4[_0x32d9('0x37')],_0x28dc4[_0x32d9('0x33')]);_0x56a7ab[_0x32d9('0x38')]=_[_0x32d9('0x36')](_0x28dc4['model'],qs[_0x32d9('0x39')](_0x272449[_0x32d9('0x33')][_0x32d9('0x39')]));_0x56a7ab[_0x32d9('0x38')]=_0x56a7ab[_0x32d9('0x38')][_0x32d9('0x3a')]?_0x56a7ab[_0x32d9('0x38')]:_0x28dc4[_0x32d9('0x37')];if(!_0x272449[_0x32d9('0x33')][_0x32d9('0x3b')]('nolimit')){_0x56a7ab['limit']=qs[_0x32d9('0x22')](_0x272449[_0x32d9('0x33')][_0x32d9('0x22')]);_0x56a7ab[_0x32d9('0x21')]=qs[_0x32d9('0x21')](_0x272449[_0x32d9('0x33')][_0x32d9('0x21')]);}_0x56a7ab[_0x32d9('0x3c')]=qs[_0x32d9('0x3d')](_0x272449[_0x32d9('0x33')]['sort']);_0x56a7ab[_0x32d9('0x3e')]=qs['filters'](_['pick'](_0x272449[_0x32d9('0x33')],_0x28dc4[_0x32d9('0x35')]),_0x1b0dfb);if(_0x272449['query'][_0x32d9('0x3f')]){_0x56a7ab['where']=_[_0x32d9('0x40')](_0x56a7ab[_0x32d9('0x3e')],{'$or':_[_0x32d9('0x2e')](_0x1b0dfb,function(_0x4a15af){if(_0x4a15af[_0x32d9('0x31')]!==_0x32d9('0x41')){var _0x2649d8={};_0x2649d8[_0x4a15af[_0x32d9('0x2c')]]={'$like':'%'+_0x272449[_0x32d9('0x33')][_0x32d9('0x3f')]+'%'};return _0x2649d8;}})});}_0x56a7ab=_[_0x32d9('0x40')]({},_0x56a7ab,_0x272449[_0x32d9('0x42')]);var _0x5eabdb={'where':_0x56a7ab['where']};return db[_0x32d9('0x2f')][_0x32d9('0x24')](_0x5eabdb)['then'](function(_0x2eeb32){_0x11909b[_0x32d9('0x24')]=_0x2eeb32;if(_0x272449[_0x32d9('0x33')][_0x32d9('0x43')]){_0x56a7ab['include']=[{'all':!![]}];}return db['JscriptyProject'][_0x32d9('0x44')](_0x56a7ab);})[_0x32d9('0x28')](function(_0x12c469){_0x11909b[_0x32d9('0x45')]=_0x12c469;return _0x11909b;})[_0x32d9('0x28')](respondWithFilteredResult(_0xda0f8f,_0x56a7ab))[_0x32d9('0x46')](handleError(_0xda0f8f,null));};exports[_0x32d9('0x47')]=function(_0x15f42f,_0x2edc21){var _0x4344dc={'raw':![],'where':{'id':_0x15f42f[_0x32d9('0x48')]['id']}},_0x56c419={};_0x56c419['model']=_[_0x32d9('0x34')](db[_0x32d9('0x2f')][_0x32d9('0x49')]);_0x56c419['query']=_['keys'](_0x15f42f['query']);_0x56c419[_0x32d9('0x35')]=_[_0x32d9('0x36')](_0x56c419['model'],_0x56c419[_0x32d9('0x33')]);_0x4344dc['attributes']=_[_0x32d9('0x36')](_0x56c419['model'],qs[_0x32d9('0x39')](_0x15f42f[_0x32d9('0x33')][_0x32d9('0x39')]));_0x4344dc[_0x32d9('0x38')]=_0x4344dc[_0x32d9('0x38')]['length']?_0x4344dc[_0x32d9('0x38')]:_0x56c419[_0x32d9('0x37')];if(_0x15f42f[_0x32d9('0x33')]['includeAll']){_0x4344dc[_0x32d9('0x4a')]=[{'all':!![]}];}_0x4344dc=_[_0x32d9('0x40')]({},_0x4344dc,_0x15f42f[_0x32d9('0x42')]);return db[_0x32d9('0x2f')][_0x32d9('0x4b')](_0x4344dc)['then'](handleEntityNotFound(_0x2edc21,null))[_0x32d9('0x28')](respondWithResult(_0x2edc21,null))[_0x32d9('0x46')](handleError(_0x2edc21,null));};exports[_0x32d9('0x4c')]=function(_0x433d90,_0x4f0df5){return db['JscriptyProject'][_0x32d9('0x4c')](_0x433d90[_0x32d9('0x4d')],{})[_0x32d9('0x28')](function(_0x39eee9){var _0x26959d=_0x433d90[_0x32d9('0x4e')][_0x32d9('0x29')]({'plain':!![]});if(!_0x26959d)throw new Error(_0x32d9('0x4f'));if(_0x26959d['role']===_0x32d9('0x4e')){var _0x1d7425=_0x39eee9[_0x32d9('0x29')]({'plain':!![]});var _0x4d1197='Projects';return db[_0x32d9('0x50')][_0x32d9('0x4b')]({'where':{'name':_0x4d1197,'userProfileId':_0x26959d[_0x32d9('0x51')]},'raw':!![]})[_0x32d9('0x28')](function(_0x144dac){if(_0x144dac&&_0x144dac[_0x32d9('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x1d7425[_0x32d9('0x2c')],'resourceId':_0x1d7425['id'],'type':_0x144dac[_0x32d9('0x2c')],'sectionId':_0x144dac['id']},{})['then'](function(){return _0x39eee9;});}else{return _0x39eee9;}})[_0x32d9('0x46')](function(_0x284127){logger['error'](_0x32d9('0x53'),_0x284127);throw _0x284127;});}return _0x39eee9;})[_0x32d9('0x28')](respondWithResult(_0x4f0df5,0xc9))[_0x32d9('0x46')](handleError(_0x4f0df5,null));};exports[_0x32d9('0x54')]=function(_0x1900da,_0xc3b38d){var _0x5a88a2={'where':{'id':_0x1900da[_0x32d9('0x48')]['id']}},_0x25d06b={};_0x25d06b[_0x32d9('0x37')]=_[_0x32d9('0x34')](db[_0x32d9('0x2f')]['rawAttributes']);_0x5a88a2[_0x32d9('0x38')]=_[_0x32d9('0x36')](_0x25d06b[_0x32d9('0x37')],qs[_0x32d9('0x39')](_0x1900da[_0x32d9('0x33')][_0x32d9('0x39')]));_0x5a88a2[_0x32d9('0x38')]=_0x5a88a2['attributes'][_0x32d9('0x3a')]?_0x5a88a2[_0x32d9('0x38')]:_0x25d06b[_0x32d9('0x37')];if(_0x1900da[_0x32d9('0x33')]['includeAll']){_0x5a88a2['include']=[{'all':!![]}];}_0x5a88a2=_[_0x32d9('0x40')]({},_0x5a88a2,_0x1900da[_0x32d9('0x42')]);return db[_0x32d9('0x2f')][_0x32d9('0x4b')](_0x5a88a2)['then'](handleEntityNotFound(_0xc3b38d,null))[_0x32d9('0x28')](function(_0x26e5bb){if(_0x26e5bb){var _0x5930dd=_0x26e5bb[_0x32d9('0x29')]({'plain':!![]});_0x5930dd=qs['omit'](_0x5930dd,['id','createdAt',_0x32d9('0x55')]);_0x1900da[_0x32d9('0x4d')]=_[_0x32d9('0x56')](_0x1900da[_0x32d9('0x4d')],['id','createdAt',_0x32d9('0x55')]);return db[_0x32d9('0x2f')]['create'](_['merge'](_0x5930dd,_0x1900da[_0x32d9('0x4d')]),{'include':_0x1900da[_0x32d9('0x33')][_0x32d9('0x43')]?[{'all':!![]}]:undefined})['then'](function(_0x29f194){var _0x144d16=_0x1900da[_0x32d9('0x4e')][_0x32d9('0x29')]({'plain':!![]});if(!_0x144d16)throw new Error(_0x32d9('0x4f'));if(_0x144d16[_0x32d9('0x57')]==='user'){var _0x371922=_0x29f194[_0x32d9('0x29')]({'plain':!![]});var _0x5127d8='Projects';return db[_0x32d9('0x50')][_0x32d9('0x4b')]({'where':{'name':_0x5127d8,'userProfileId':_0x144d16[_0x32d9('0x51')]},'raw':!![]})[_0x32d9('0x28')](function(_0x2f3f19){if(_0x2f3f19&&_0x2f3f19[_0x32d9('0x52')]===0x0){return db['UserProfileResource'][_0x32d9('0x4c')]({'name':_0x371922[_0x32d9('0x2c')],'resourceId':_0x371922['id'],'type':_0x2f3f19[_0x32d9('0x2c')],'sectionId':_0x2f3f19['id']},{})[_0x32d9('0x28')](function(){return _0x29f194;});}else{return _0x29f194;}})['catch'](function(_0x38a176){logger[_0x32d9('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38a176);throw _0x38a176;});}return _0x29f194;});}})['then'](respondWithResult(_0xc3b38d,0xc9))[_0x32d9('0x46')](handleError(_0xc3b38d,null));};exports[_0x32d9('0x59')]=function(_0x2e0601,_0x17f450){if(_0x2e0601['body']['id']){delete _0x2e0601['body']['id'];}return db[_0x32d9('0x2f')][_0x32d9('0x4b')]({'where':{'id':_0x2e0601[_0x32d9('0x48')]['id']}})[_0x32d9('0x28')](handleEntityNotFound(_0x17f450,null))[_0x32d9('0x28')](saveUpdates(_0x2e0601[_0x32d9('0x4d')],null))[_0x32d9('0x28')](respondWithResult(_0x17f450,null))['catch'](handleError(_0x17f450,null));};exports[_0x32d9('0x2b')]=function(_0x4a2dfe,_0x1aab0d){return db[_0x32d9('0x2f')][_0x32d9('0x4b')]({'where':{'id':_0x4a2dfe['params']['id']}})['then'](handleEntityNotFound(_0x1aab0d,null))[_0x32d9('0x28')](removeEntity(_0x1aab0d,null))[_0x32d9('0x46')](handleError(_0x1aab0d,null));};exports['getSessions']=function(_0x12fbc3,_0x5331c7,_0x17e95e){var _0x4d854d={'raw':!![],'where':{}};var _0x12bd39={};var _0x50f93f={'count':0x0,'rows':[]};return db[_0x32d9('0x2f')]['findOne']({'where':{'id':_0x12fbc3[_0x32d9('0x48')]['id']}})[_0x32d9('0x28')](handleEntityNotFound(_0x5331c7,null))['then'](function(_0x510ffc){if(_0x510ffc){_0x12bd39[_0x32d9('0x37')]=_[_0x32d9('0x34')](db[_0x32d9('0x5a')][_0x32d9('0x49')]);_0x12bd39[_0x32d9('0x33')]=_[_0x32d9('0x34')](_0x12fbc3[_0x32d9('0x33')]);_0x12bd39[_0x32d9('0x35')]=_[_0x32d9('0x36')](_0x12bd39['model'],_0x12bd39['query']);_0x4d854d[_0x32d9('0x38')]=_[_0x32d9('0x36')](_0x12bd39[_0x32d9('0x37')],qs[_0x32d9('0x39')](_0x12fbc3[_0x32d9('0x33')][_0x32d9('0x39')]));_0x4d854d[_0x32d9('0x38')]=_0x4d854d['attributes'][_0x32d9('0x3a')]?_0x4d854d[_0x32d9('0x38')]:_0x12bd39[_0x32d9('0x37')];if(!_0x12fbc3[_0x32d9('0x33')][_0x32d9('0x3b')](_0x32d9('0x5b'))){_0x4d854d[_0x32d9('0x22')]=qs[_0x32d9('0x22')](_0x12fbc3['query'][_0x32d9('0x22')]);_0x4d854d['offset']=qs['offset'](_0x12fbc3[_0x32d9('0x33')]['offset']);}_0x4d854d[_0x32d9('0x3c')]=qs[_0x32d9('0x3d')](_0x12fbc3[_0x32d9('0x33')][_0x32d9('0x3d')]);_0x4d854d[_0x32d9('0x3e')]=qs[_0x32d9('0x35')](_[_0x32d9('0x5c')](_0x12fbc3[_0x32d9('0x33')],_0x12bd39['filters']));_0x4d854d[_0x32d9('0x3e')]['ProjectId']=_0x510ffc['id'];if(_0x12fbc3[_0x32d9('0x33')][_0x32d9('0x3f')]){_0x4d854d['where']=_['merge'](_0x4d854d['where'],{'$or':_[_0x32d9('0x2e')](_0x4d854d['attributes'],function(_0x41bc2b){var _0x554a36={};_0x554a36[_0x41bc2b]={'$like':'%'+_0x12fbc3[_0x32d9('0x33')]['filter']+'%'};return _0x554a36;})});}_0x4d854d=_['merge']({},_0x4d854d,_0x12fbc3['options']);return db[_0x32d9('0x5a')][_0x32d9('0x24')]({'where':_0x4d854d['where']})[_0x32d9('0x28')](function(_0xd3fd19){_0x50f93f['count']=_0xd3fd19;if(_0x12fbc3[_0x32d9('0x33')][_0x32d9('0x43')]){_0x4d854d[_0x32d9('0x4a')]=[{'all':!![]}];}return db[_0x32d9('0x5a')]['findAll'](_0x4d854d);})[_0x32d9('0x28')](function(_0x874bb0){_0x50f93f[_0x32d9('0x45')]=_0x874bb0;return _0x50f93f;});}})[_0x32d9('0x28')](respondWithFilteredResult(_0x5331c7,_0x4d854d))[_0x32d9('0x46')](handleError(_0x5331c7,null));};exports[_0x32d9('0x5d')]=function(_0x13aff0,_0x157cbf,_0x4d916e){var _0x72cdce={'raw':!![],'where':{}};var _0x4bdb42={};var _0x5d6ddf={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x13aff0[_0x32d9('0x48')]['id']}})['then'](handleEntityNotFound(_0x157cbf,null))[_0x32d9('0x28')](function(_0x12b96a){if(_0x12b96a){_0x4bdb42[_0x32d9('0x37')]=_[_0x32d9('0x34')](db[_0x32d9('0x5e')][_0x32d9('0x49')]);_0x4bdb42[_0x32d9('0x33')]=_[_0x32d9('0x34')](_0x13aff0['query']);_0x4bdb42[_0x32d9('0x35')]=_['intersection'](_0x4bdb42[_0x32d9('0x37')],_0x4bdb42[_0x32d9('0x33')]);_0x72cdce[_0x32d9('0x38')]=_[_0x32d9('0x36')](_0x4bdb42[_0x32d9('0x37')],qs['fields'](_0x13aff0[_0x32d9('0x33')][_0x32d9('0x39')]));_0x72cdce[_0x32d9('0x38')]=_0x72cdce[_0x32d9('0x38')][_0x32d9('0x3a')]?_0x72cdce[_0x32d9('0x38')]:_0x4bdb42[_0x32d9('0x37')];if(!_0x13aff0['query'][_0x32d9('0x3b')](_0x32d9('0x5b'))){_0x72cdce[_0x32d9('0x22')]=qs[_0x32d9('0x22')](_0x13aff0[_0x32d9('0x33')][_0x32d9('0x22')]);_0x72cdce[_0x32d9('0x21')]=qs[_0x32d9('0x21')](_0x13aff0[_0x32d9('0x33')][_0x32d9('0x21')]);}_0x72cdce[_0x32d9('0x3c')]=qs[_0x32d9('0x3d')](_0x13aff0[_0x32d9('0x33')][_0x32d9('0x3d')]);_0x72cdce[_0x32d9('0x3e')]=qs[_0x32d9('0x35')](_[_0x32d9('0x5c')](_0x13aff0['query'],_0x4bdb42[_0x32d9('0x35')]));_0x72cdce[_0x32d9('0x3e')][_0x32d9('0x5f')]=_0x12b96a['id'];if(_0x13aff0[_0x32d9('0x33')][_0x32d9('0x3f')]){_0x72cdce[_0x32d9('0x3e')]=_[_0x32d9('0x40')](_0x72cdce['where'],{'$or':_[_0x32d9('0x2e')](_0x72cdce['attributes'],function(_0x28dffd){var _0x78fcbf={};_0x78fcbf[_0x28dffd]={'$like':'%'+_0x13aff0[_0x32d9('0x33')]['filter']+'%'};return _0x78fcbf;})});}_0x72cdce=_[_0x32d9('0x40')]({},_0x72cdce,_0x13aff0[_0x32d9('0x42')]);return db['JscriptyAnswerReport'][_0x32d9('0x24')]({'where':_0x72cdce[_0x32d9('0x3e')]})[_0x32d9('0x28')](function(_0x38ac3e){_0x5d6ddf[_0x32d9('0x24')]=_0x38ac3e;if(_0x13aff0[_0x32d9('0x33')][_0x32d9('0x43')]){_0x72cdce[_0x32d9('0x4a')]=[{'all':!![]}];}return db[_0x32d9('0x5e')][_0x32d9('0x44')](_0x72cdce);})[_0x32d9('0x28')](function(_0x44ef70){_0x5d6ddf[_0x32d9('0x45')]=_0x44ef70;return _0x5d6ddf;});}})[_0x32d9('0x28')](respondWithFilteredResult(_0x157cbf,_0x72cdce))[_0x32d9('0x46')](handleError(_0x157cbf,null));};function char(_0x529c1a){return _0x32d9('0x60')===typeof _0x529c1a?String[_0x32d9('0x61')][_0x32d9('0x27')](null,arguments):_0x529c1a;}function needsEncapsulation(_0x3c4d00){return!!_0x3c4d00&&(_0x3c4d00['toString']()[_0x32d9('0x62')](char(0xd))>=0x0||_0x3c4d00[_0x32d9('0x63')]()[_0x32d9('0x62')](char(0xa))>=0x0||_0x3c4d00[_0x32d9('0x63')]()[_0x32d9('0x62')](char(0x2c))>=0x0||_0x3c4d00[_0x32d9('0x63')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x11dbab){var _0x15ef59=char(0x22),_0x5bdb90='\x5c'+char(0x22),_0x4df99d=_0x11dbab[_0x32d9('0x63')]()[_0x32d9('0x64')](new RegExp(_0x15ef59,'g'),_0x5bdb90);return _0x15ef59+_0x4df99d+_0x15ef59;}exports[_0x32d9('0x65')]=function(_0x4c9fc1,_0x2cc671,_0xc40116){var _0xaaf11b,_0x3d38e1;var _0x1e2483={'where':{'ProjectId':_0x4c9fc1[_0x32d9('0x48')]['id']}};if(_0x4c9fc1[_0x32d9('0x33')]['startTime']){_0x1e2483[_0x32d9('0x3e')]['starttime']=JSON['parse'](_0x4c9fc1[_0x32d9('0x33')][_0x32d9('0x66')]);}return db['JscriptySessionReport']['findAll'](_0x1e2483)[_0x32d9('0x28')](handleEntityNotFound(_0x2cc671,null))[_0x32d9('0x28')](function(_0x77a931){if(_0x77a931){_0xaaf11b=_0x77a931;return db['JscriptyQuestionReport'][_0x32d9('0x44')]({'where':{'SessionId':{'$in':_[_0x32d9('0x2e')](_0xaaf11b,'id')},'ProjectId':_0x4c9fc1[_0x32d9('0x48')]['id']},'order':_0x32d9('0x67')});}})[_0x32d9('0x28')](handleEntityNotFound(_0x2cc671,null))[_0x32d9('0x28')](function(_0x4bb137){if(_0x4bb137){_0x3d38e1=_0x4bb137;var _0xaa266f={};for(var _0x443a16=0x0,_0x1fa63b=_0x3d38e1['length'];_0x443a16<_0x1fa63b;_0x443a16++){if(!_0xaa266f[_0x32d9('0x3b')](_0x3d38e1[_0x443a16][_0x32d9('0x68')])){_0xaa266f[_0x3d38e1[_0x443a16]['questionId']]=needsEncapsulation(_0x3d38e1[_0x443a16]['question'])?encapsulate(_0x3d38e1[_0x443a16][_0x32d9('0x69')]):_0x3d38e1[_0x443a16][_0x32d9('0x69')];}}var _0x2940bf=[],_0x2a1de0={};for(var _0x3e9f50=0x0,_0x461071=_0xaaf11b[_0x32d9('0x3a')];_0x3e9f50<_0x461071;_0x3e9f50++){_0x2a1de0={'ProjectId':_0x4c9fc1[_0x32d9('0x48')]['id'],'SessionId':_0xaaf11b[_0x3e9f50]['id'],'StartTime':moment(_0xaaf11b[_0x3e9f50][_0x32d9('0x6a')])[_0x32d9('0x6b')](_0x32d9('0x6c'))};for(var _0x1f5b62=0x0,_0x19720a=_0x3d38e1[_0x32d9('0x3a')];_0x1f5b62<_0x19720a;_0x1f5b62++){if(_0x3d38e1[_0x1f5b62][_0x32d9('0x6d')]==_0xaaf11b[_0x3e9f50]['id']&&_0xaa266f[_0x32d9('0x3b')](_0x3d38e1[_0x1f5b62][_0x32d9('0x68')])){_0x2a1de0[_0xaa266f[_0x3d38e1[_0x1f5b62][_0x32d9('0x68')]]]=_0x3d38e1[_0x1f5b62][_0x32d9('0x6e')];}}for(var _0x3add4b in _0xaa266f){if(!_0x2a1de0[_0x32d9('0x3b')](_0xaa266f[_0x3add4b])){_0x2a1de0[_0xaa266f[_0x3add4b]]=null;}}_0x2940bf[_0x32d9('0x6f')](_0x2a1de0);}return _0x2940bf;}})['then'](function(_0x460e82){if(!_[_0x32d9('0x70')](_0x460e82)){var _0x560e62=toCsv(_0x460e82);var _0x29dc11=Date[_0x32d9('0x71')]();fs['writeFileSync'](util['format'](_0x32d9('0x72'),_0x4c9fc1[_0x32d9('0x48')]['id'],_0x29dc11),_0x560e62);_0x2cc671[_0x32d9('0x73')](_0x32d9('0x74'),'attachment;\x20filename='+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x4c9fc1[_0x32d9('0x48')]['id'],_0x29dc11));_0x2cc671[_0x32d9('0x73')]('Content-type',_0x32d9('0x75'));return _0x2cc671[_0x32d9('0x76')](util[_0x32d9('0x6b')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4c9fc1[_0x32d9('0x48')]['id'],_0x29dc11));}else{return _0x2cc671['sendStatus'](0xcc);}})[_0x32d9('0x46')](handleError(_0x2cc671,null));}; \ No newline at end of file +var _0x02a4=['includeAll','rows','catch','show','params','intersection','length','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','error','clone','keys','createdAt','updatedAt','omit','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','filter','JscriptySessionReport','getAnswers','nolimit','ProjectId','JscriptyAnswerReport','findAll','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','parse','-createdAt','questionId','question','starttime','format','SessionId','answer','push','isEmpty','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','update','destroy','get','Projects','then','end','stack','name','index','JscriptyProject','rawAttributes','fieldName','type','model','query','filters','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','map','VIRTUAL','options'];(function(_0x2601b4,_0x315e78){var _0x3e3661=function(_0x13b45b){while(--_0x13b45b){_0x2601b4['push'](_0x2601b4['shift']());}};_0x3e3661(++_0x315e78);}(_0x02a4,0x19d));var _0x402a=function(_0x467cc2,_0x3fb983){_0x467cc2=_0x467cc2-0x0;var _0x12ddbb=_0x02a4[_0x467cc2];return _0x12ddbb;};'use strict';var emlformat=require(_0x402a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x402a('0x1'));var rp=require(_0x402a('0x2'));var moment=require(_0x402a('0x3'));var BPromise=require(_0x402a('0x4'));var Mustache=require(_0x402a('0x5'));var util=require('util');var path=require(_0x402a('0x6'));var sox=require(_0x402a('0x7'));var csv=require(_0x402a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x402a('0x9'));var _=require(_0x402a('0xa'));var squel=require(_0x402a('0xb'));var crypto=require('crypto');var jsforce=require(_0x402a('0xc'));var deskjs=require(_0x402a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x402a('0xe'));var Papa=require(_0x402a('0xf'));var Redis=require(_0x402a('0x10'));var authService=require(_0x402a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x402a('0x12'))(_0x402a('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x402a('0x14'));var db=require(_0x402a('0x15'))['db'];function respondWithStatusCode(_0x4b84f9,_0x394f73){_0x394f73=_0x394f73||0xcc;return function(_0x433eaa){if(_0x433eaa){return _0x4b84f9[_0x402a('0x16')](_0x394f73);}return _0x4b84f9['status'](_0x394f73)['end']();};}function respondWithResult(_0x419840,_0x429504){_0x429504=_0x429504||0xc8;return function(_0x171523){if(_0x171523){return _0x419840[_0x402a('0x17')](_0x429504)[_0x402a('0x18')](_0x171523);}};}function respondWithFilteredResult(_0x4dd0e9,_0x4897dc){return function(_0x1ef004){if(_0x1ef004){var _0x5dc2ae=typeof _0x4897dc[_0x402a('0x19')]===_0x402a('0x1a')&&typeof _0x4897dc[_0x402a('0x1b')]===_0x402a('0x1a');var _0x514acb=_0x1ef004[_0x402a('0x1c')];var _0x4d4941=_0x5dc2ae?0x0:_0x4897dc[_0x402a('0x19')];var _0x3df24a=_0x5dc2ae?_0x1ef004[_0x402a('0x1c')]:_0x4897dc[_0x402a('0x19')]+_0x4897dc[_0x402a('0x1b')];var _0x5bc0ab;if(_0x3df24a>=_0x514acb){_0x3df24a=_0x514acb;_0x5bc0ab=0xc8;}else{_0x5bc0ab=0xce;}_0x4dd0e9['status'](_0x5bc0ab);return _0x4dd0e9['set']('Content-Range',_0x4d4941+'-'+_0x3df24a+'/'+_0x514acb)['json'](_0x1ef004);}return null;};}function patchUpdates(_0x3a1f9c){return function(_0x1ca806){try{jsonpatch[_0x402a('0x1d')](_0x1ca806,_0x3a1f9c,!![]);}catch(_0x550eb0){return BPromise[_0x402a('0x1e')](_0x550eb0);}return _0x1ca806[_0x402a('0x1f')]();};}function saveUpdates(_0x46db73,_0x8b8dec){return function(_0x573d83){if(_0x573d83){return _0x573d83[_0x402a('0x20')](_0x46db73)['then'](function(_0x3e82c4){return _0x3e82c4;});}return null;};}function removeEntity(_0x406462,_0x1022b2){return function(_0x417aa5){if(_0x417aa5){return _0x417aa5[_0x402a('0x21')]()['then'](function(){var _0x34445e=_0x417aa5[_0x402a('0x22')]({'plain':!![]});var _0x521a7e=_0x402a('0x23');return db['UserProfileResource'][_0x402a('0x21')]({'where':{'type':_0x521a7e,'resourceId':_0x34445e['id']}})[_0x402a('0x24')](function(){return _0x417aa5;});})['then'](function(){_0x406462['status'](0xcc)[_0x402a('0x25')]();});}};}function handleEntityNotFound(_0x4910fa,_0x3ed63d){return function(_0x568956){if(!_0x568956){_0x4910fa[_0x402a('0x16')](0x194);}return _0x568956;};}function handleError(_0x4c82d3,_0x1fcba1){_0x1fcba1=_0x1fcba1||0x1f4;return function(_0x4d4e96){logger['error'](_0x4d4e96[_0x402a('0x26')]);if(_0x4d4e96['name']){delete _0x4d4e96[_0x402a('0x27')];}_0x4c82d3[_0x402a('0x17')](_0x1fcba1)['send'](_0x4d4e96);};}exports[_0x402a('0x28')]=function(_0x6ac4fa,_0x40f81c){var _0x441536={},_0xff80a7={},_0x302387={'count':0x0,'rows':[]};var _0x75b2ae=_['map'](db[_0x402a('0x29')][_0x402a('0x2a')],function(_0x131fa3){return{'name':_0x131fa3[_0x402a('0x2b')],'type':_0x131fa3[_0x402a('0x2c')]['key']};});_0xff80a7[_0x402a('0x2d')]=_['map'](_0x75b2ae,_0x402a('0x27'));_0xff80a7[_0x402a('0x2e')]=_['keys'](_0x6ac4fa[_0x402a('0x2e')]);_0xff80a7[_0x402a('0x2f')]=_['intersection'](_0xff80a7[_0x402a('0x2d')],_0xff80a7['query']);_0x441536['attributes']=_['intersection'](_0xff80a7[_0x402a('0x2d')],qs[_0x402a('0x30')](_0x6ac4fa['query'][_0x402a('0x30')]));_0x441536[_0x402a('0x31')]=_0x441536[_0x402a('0x31')]['length']?_0x441536[_0x402a('0x31')]:_0xff80a7[_0x402a('0x2d')];if(!_0x6ac4fa[_0x402a('0x2e')][_0x402a('0x32')]('nolimit')){_0x441536[_0x402a('0x1b')]=qs[_0x402a('0x1b')](_0x6ac4fa[_0x402a('0x2e')][_0x402a('0x1b')]);_0x441536[_0x402a('0x19')]=qs['offset'](_0x6ac4fa['query'][_0x402a('0x19')]);}_0x441536[_0x402a('0x33')]=qs[_0x402a('0x34')](_0x6ac4fa[_0x402a('0x2e')][_0x402a('0x34')]);_0x441536[_0x402a('0x35')]=qs[_0x402a('0x2f')](_[_0x402a('0x36')](_0x6ac4fa[_0x402a('0x2e')],_0xff80a7['filters']),_0x75b2ae);if(_0x6ac4fa['query']['filter']){_0x441536[_0x402a('0x35')]=_[_0x402a('0x37')](_0x441536[_0x402a('0x35')],{'$or':_[_0x402a('0x38')](_0x75b2ae,function(_0x339e64){if(_0x339e64[_0x402a('0x2c')]!==_0x402a('0x39')){var _0x58d36e={};_0x58d36e[_0x339e64[_0x402a('0x27')]]={'$like':'%'+_0x6ac4fa[_0x402a('0x2e')]['filter']+'%'};return _0x58d36e;}})});}_0x441536=_['merge']({},_0x441536,_0x6ac4fa[_0x402a('0x3a')]);var _0x50f81f={'where':_0x441536[_0x402a('0x35')]};return db[_0x402a('0x29')][_0x402a('0x1c')](_0x50f81f)[_0x402a('0x24')](function(_0x42bcc0){_0x302387[_0x402a('0x1c')]=_0x42bcc0;if(_0x6ac4fa[_0x402a('0x2e')][_0x402a('0x3b')]){_0x441536['include']=[{'all':!![]}];}return db[_0x402a('0x29')]['findAll'](_0x441536);})[_0x402a('0x24')](function(_0x93daa0){_0x302387[_0x402a('0x3c')]=_0x93daa0;return _0x302387;})[_0x402a('0x24')](respondWithFilteredResult(_0x40f81c,_0x441536))[_0x402a('0x3d')](handleError(_0x40f81c,null));};exports[_0x402a('0x3e')]=function(_0x14fc36,_0x2f8019){var _0xf6db94={'raw':![],'where':{'id':_0x14fc36[_0x402a('0x3f')]['id']}},_0x5f5670={};_0x5f5670[_0x402a('0x2d')]=_['keys'](db['JscriptyProject'][_0x402a('0x2a')]);_0x5f5670[_0x402a('0x2e')]=_['keys'](_0x14fc36[_0x402a('0x2e')]);_0x5f5670[_0x402a('0x2f')]=_[_0x402a('0x40')](_0x5f5670[_0x402a('0x2d')],_0x5f5670[_0x402a('0x2e')]);_0xf6db94['attributes']=_['intersection'](_0x5f5670[_0x402a('0x2d')],qs['fields'](_0x14fc36[_0x402a('0x2e')][_0x402a('0x30')]));_0xf6db94[_0x402a('0x31')]=_0xf6db94['attributes'][_0x402a('0x41')]?_0xf6db94[_0x402a('0x31')]:_0x5f5670['model'];if(_0x14fc36[_0x402a('0x2e')]['includeAll']){_0xf6db94[_0x402a('0x42')]=[{'all':!![]}];}_0xf6db94=_[_0x402a('0x37')]({},_0xf6db94,_0x14fc36[_0x402a('0x3a')]);return db[_0x402a('0x29')]['find'](_0xf6db94)['then'](handleEntityNotFound(_0x2f8019,null))[_0x402a('0x24')](respondWithResult(_0x2f8019,null))[_0x402a('0x3d')](handleError(_0x2f8019,null));};exports[_0x402a('0x43')]=function(_0x41b419,_0x4aea5a){return db[_0x402a('0x29')][_0x402a('0x43')](_0x41b419[_0x402a('0x44')],{})[_0x402a('0x24')](function(_0x92632a){var _0x243fe0=_0x41b419['user'][_0x402a('0x22')]({'plain':!![]});if(!_0x243fe0)throw new Error(_0x402a('0x45'));if(_0x243fe0[_0x402a('0x46')]===_0x402a('0x47')){var _0x5202c3=_0x92632a[_0x402a('0x22')]({'plain':!![]});var _0x2db3c1=_0x402a('0x23');return db['UserProfileSection'][_0x402a('0x48')]({'where':{'name':_0x2db3c1,'userProfileId':_0x243fe0['userProfileId']},'raw':!![]})[_0x402a('0x24')](function(_0x1910ef){if(_0x1910ef&&_0x1910ef['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5202c3['name'],'resourceId':_0x5202c3['id'],'type':_0x1910ef['name'],'sectionId':_0x1910ef['id']},{})['then'](function(){return _0x92632a;});}else{return _0x92632a;}})[_0x402a('0x3d')](function(_0x3c4686){logger[_0x402a('0x49')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c4686);throw _0x3c4686;});}return _0x92632a;})[_0x402a('0x24')](respondWithResult(_0x4aea5a,0xc9))['catch'](handleError(_0x4aea5a,null));};exports[_0x402a('0x4a')]=function(_0x829339,_0x1ccbfd){var _0x446d7c={'where':{'id':_0x829339[_0x402a('0x3f')]['id']}},_0x4bbf37={};_0x4bbf37['model']=_[_0x402a('0x4b')](db['JscriptyProject']['rawAttributes']);_0x446d7c[_0x402a('0x31')]=_['intersection'](_0x4bbf37['model'],qs['fields'](_0x829339[_0x402a('0x2e')][_0x402a('0x30')]));_0x446d7c['attributes']=_0x446d7c['attributes'][_0x402a('0x41')]?_0x446d7c[_0x402a('0x31')]:_0x4bbf37[_0x402a('0x2d')];if(_0x829339[_0x402a('0x2e')]['includeAll']){_0x446d7c[_0x402a('0x42')]=[{'all':!![]}];}_0x446d7c=_[_0x402a('0x37')]({},_0x446d7c,_0x829339['options']);return db[_0x402a('0x29')][_0x402a('0x48')](_0x446d7c)[_0x402a('0x24')](handleEntityNotFound(_0x1ccbfd,null))['then'](function(_0x239757){if(_0x239757){var _0x3add8c=_0x239757[_0x402a('0x22')]({'plain':!![]});_0x3add8c=qs['omit'](_0x3add8c,['id',_0x402a('0x4c'),_0x402a('0x4d')]);_0x829339[_0x402a('0x44')]=_[_0x402a('0x4e')](_0x829339[_0x402a('0x44')],['id',_0x402a('0x4c'),_0x402a('0x4d')]);return db[_0x402a('0x29')][_0x402a('0x43')](_[_0x402a('0x37')](_0x3add8c,_0x829339['body']),{'include':_0x829339[_0x402a('0x2e')][_0x402a('0x3b')]?[{'all':!![]}]:undefined})[_0x402a('0x24')](function(_0x56664f){var _0x51fdbf=_0x829339[_0x402a('0x47')][_0x402a('0x22')]({'plain':!![]});if(!_0x51fdbf)throw new Error(_0x402a('0x45'));if(_0x51fdbf[_0x402a('0x46')]===_0x402a('0x47')){var _0x531f3f=_0x56664f[_0x402a('0x22')]({'plain':!![]});var _0x547b71=_0x402a('0x23');return db[_0x402a('0x4f')]['find']({'where':{'name':_0x547b71,'userProfileId':_0x51fdbf[_0x402a('0x50')]},'raw':!![]})[_0x402a('0x24')](function(_0x94a77c){if(_0x94a77c&&_0x94a77c[_0x402a('0x51')]===0x0){return db[_0x402a('0x52')]['create']({'name':_0x531f3f[_0x402a('0x27')],'resourceId':_0x531f3f['id'],'type':_0x94a77c[_0x402a('0x27')],'sectionId':_0x94a77c['id']},{})[_0x402a('0x24')](function(){return _0x56664f;});}else{return _0x56664f;}})[_0x402a('0x3d')](function(_0x19c166){logger[_0x402a('0x49')](_0x402a('0x53'),_0x19c166);throw _0x19c166;});}return _0x56664f;});}})[_0x402a('0x24')](respondWithResult(_0x1ccbfd,0xc9))[_0x402a('0x3d')](handleError(_0x1ccbfd,null));};exports[_0x402a('0x20')]=function(_0x3a937d,_0x58165e){if(_0x3a937d['body']['id']){delete _0x3a937d[_0x402a('0x44')]['id'];}return db['JscriptyProject'][_0x402a('0x48')]({'where':{'id':_0x3a937d[_0x402a('0x3f')]['id']}})['then'](handleEntityNotFound(_0x58165e,null))[_0x402a('0x24')](saveUpdates(_0x3a937d[_0x402a('0x44')],null))[_0x402a('0x24')](respondWithResult(_0x58165e,null))['catch'](handleError(_0x58165e,null));};exports[_0x402a('0x21')]=function(_0x1b2dde,_0x4881f3){return db[_0x402a('0x29')][_0x402a('0x48')]({'where':{'id':_0x1b2dde[_0x402a('0x3f')]['id']}})[_0x402a('0x24')](handleEntityNotFound(_0x4881f3,null))[_0x402a('0x24')](removeEntity(_0x4881f3,null))[_0x402a('0x3d')](handleError(_0x4881f3,null));};exports[_0x402a('0x54')]=function(_0x61ff05,_0x56b02e,_0x5c38b2){var _0x282c50={'raw':!![],'where':{}};var _0xe7ade4={};var _0x34ba76={'count':0x0,'rows':[]};return db[_0x402a('0x29')][_0x402a('0x55')]({'where':{'id':_0x61ff05['params']['id']}})['then'](handleEntityNotFound(_0x56b02e,null))[_0x402a('0x24')](function(_0x5db717){if(_0x5db717){_0xe7ade4[_0x402a('0x2d')]=_[_0x402a('0x4b')](db['JscriptySessionReport'][_0x402a('0x2a')]);_0xe7ade4[_0x402a('0x2e')]=_['keys'](_0x61ff05[_0x402a('0x2e')]);_0xe7ade4['filters']=_['intersection'](_0xe7ade4[_0x402a('0x2d')],_0xe7ade4[_0x402a('0x2e')]);_0x282c50[_0x402a('0x31')]=_[_0x402a('0x40')](_0xe7ade4[_0x402a('0x2d')],qs['fields'](_0x61ff05[_0x402a('0x2e')]['fields']));_0x282c50['attributes']=_0x282c50[_0x402a('0x31')]['length']?_0x282c50[_0x402a('0x31')]:_0xe7ade4['model'];if(!_0x61ff05['query']['hasOwnProperty']('nolimit')){_0x282c50['limit']=qs[_0x402a('0x1b')](_0x61ff05['query']['limit']);_0x282c50['offset']=qs[_0x402a('0x19')](_0x61ff05[_0x402a('0x2e')]['offset']);}_0x282c50[_0x402a('0x33')]=qs['sort'](_0x61ff05[_0x402a('0x2e')][_0x402a('0x34')]);_0x282c50[_0x402a('0x35')]=qs[_0x402a('0x2f')](_['pick'](_0x61ff05['query'],_0xe7ade4[_0x402a('0x2f')]));_0x282c50[_0x402a('0x35')]['ProjectId']=_0x5db717['id'];if(_0x61ff05['query'][_0x402a('0x56')]){_0x282c50[_0x402a('0x35')]=_['merge'](_0x282c50['where'],{'$or':_[_0x402a('0x38')](_0x282c50[_0x402a('0x31')],function(_0x3f990a){var _0x354148={};_0x354148[_0x3f990a]={'$like':'%'+_0x61ff05[_0x402a('0x2e')][_0x402a('0x56')]+'%'};return _0x354148;})});}_0x282c50=_[_0x402a('0x37')]({},_0x282c50,_0x61ff05[_0x402a('0x3a')]);return db[_0x402a('0x57')][_0x402a('0x1c')]({'where':_0x282c50['where']})[_0x402a('0x24')](function(_0x275a39){_0x34ba76['count']=_0x275a39;if(_0x61ff05[_0x402a('0x2e')][_0x402a('0x3b')]){_0x282c50['include']=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x282c50);})[_0x402a('0x24')](function(_0x2dfb32){_0x34ba76[_0x402a('0x3c')]=_0x2dfb32;return _0x34ba76;});}})[_0x402a('0x24')](respondWithFilteredResult(_0x56b02e,_0x282c50))[_0x402a('0x3d')](handleError(_0x56b02e,null));};exports[_0x402a('0x58')]=function(_0x5585e3,_0x3a435e,_0x10e6c3){var _0x4e0ab0={'raw':!![],'where':{}};var _0x2b742d={};var _0x484bf8={'count':0x0,'rows':[]};return db[_0x402a('0x29')][_0x402a('0x55')]({'where':{'id':_0x5585e3[_0x402a('0x3f')]['id']}})[_0x402a('0x24')](handleEntityNotFound(_0x3a435e,null))[_0x402a('0x24')](function(_0x24b6bd){if(_0x24b6bd){_0x2b742d[_0x402a('0x2d')]=_[_0x402a('0x4b')](db['JscriptyAnswerReport']['rawAttributes']);_0x2b742d[_0x402a('0x2e')]=_[_0x402a('0x4b')](_0x5585e3[_0x402a('0x2e')]);_0x2b742d[_0x402a('0x2f')]=_['intersection'](_0x2b742d[_0x402a('0x2d')],_0x2b742d[_0x402a('0x2e')]);_0x4e0ab0[_0x402a('0x31')]=_['intersection'](_0x2b742d[_0x402a('0x2d')],qs['fields'](_0x5585e3[_0x402a('0x2e')][_0x402a('0x30')]));_0x4e0ab0[_0x402a('0x31')]=_0x4e0ab0['attributes'][_0x402a('0x41')]?_0x4e0ab0[_0x402a('0x31')]:_0x2b742d['model'];if(!_0x5585e3[_0x402a('0x2e')][_0x402a('0x32')](_0x402a('0x59'))){_0x4e0ab0['limit']=qs['limit'](_0x5585e3[_0x402a('0x2e')]['limit']);_0x4e0ab0['offset']=qs['offset'](_0x5585e3['query'][_0x402a('0x19')]);}_0x4e0ab0[_0x402a('0x33')]=qs[_0x402a('0x34')](_0x5585e3['query'][_0x402a('0x34')]);_0x4e0ab0['where']=qs[_0x402a('0x2f')](_[_0x402a('0x36')](_0x5585e3['query'],_0x2b742d[_0x402a('0x2f')]));_0x4e0ab0[_0x402a('0x35')][_0x402a('0x5a')]=_0x24b6bd['id'];if(_0x5585e3[_0x402a('0x2e')][_0x402a('0x56')]){_0x4e0ab0['where']=_[_0x402a('0x37')](_0x4e0ab0[_0x402a('0x35')],{'$or':_[_0x402a('0x38')](_0x4e0ab0[_0x402a('0x31')],function(_0x536fce){var _0x3da0aa={};_0x3da0aa[_0x536fce]={'$like':'%'+_0x5585e3[_0x402a('0x2e')]['filter']+'%'};return _0x3da0aa;})});}_0x4e0ab0=_['merge']({},_0x4e0ab0,_0x5585e3['options']);return db['JscriptyAnswerReport'][_0x402a('0x1c')]({'where':_0x4e0ab0[_0x402a('0x35')]})[_0x402a('0x24')](function(_0x15ce4b){_0x484bf8[_0x402a('0x1c')]=_0x15ce4b;if(_0x5585e3['query'][_0x402a('0x3b')]){_0x4e0ab0[_0x402a('0x42')]=[{'all':!![]}];}return db[_0x402a('0x5b')][_0x402a('0x5c')](_0x4e0ab0);})[_0x402a('0x24')](function(_0x335f2e){_0x484bf8[_0x402a('0x3c')]=_0x335f2e;return _0x484bf8;});}})[_0x402a('0x24')](respondWithFilteredResult(_0x3a435e,_0x4e0ab0))[_0x402a('0x3d')](handleError(_0x3a435e,null));};function char(_0x5f5d00){return _0x402a('0x5d')===typeof _0x5f5d00?String[_0x402a('0x5e')][_0x402a('0x1d')](null,arguments):_0x5f5d00;}function needsEncapsulation(_0x221979){return!!_0x221979&&(_0x221979[_0x402a('0x5f')]()['indexOf'](char(0xd))>=0x0||_0x221979['toString']()[_0x402a('0x60')](char(0xa))>=0x0||_0x221979[_0x402a('0x5f')]()[_0x402a('0x60')](char(0x2c))>=0x0||_0x221979['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0xef5d1a){var _0x4a9175=char(0x22),_0x225613='\x5c'+char(0x22),_0x2313a7=_0xef5d1a[_0x402a('0x5f')]()[_0x402a('0x61')](new RegExp(_0x4a9175,'g'),_0x225613);return _0x4a9175+_0x2313a7+_0x4a9175;}exports[_0x402a('0x62')]=function(_0x1f32fd,_0x703881,_0x5b42be){var _0x5df617,_0x123f2f;var _0x1b884c={'where':{'ProjectId':_0x1f32fd[_0x402a('0x3f')]['id']}};if(_0x1f32fd[_0x402a('0x2e')][_0x402a('0x63')]){_0x1b884c[_0x402a('0x35')]['starttime']=JSON[_0x402a('0x64')](_0x1f32fd[_0x402a('0x2e')][_0x402a('0x63')]);}return db[_0x402a('0x57')]['findAll'](_0x1b884c)['then'](handleEntityNotFound(_0x703881,null))['then'](function(_0x250fb7){if(_0x250fb7){_0x5df617=_0x250fb7;return db['JscriptyQuestionReport'][_0x402a('0x5c')]({'where':{'SessionId':{'$in':_['map'](_0x5df617,'id')},'ProjectId':_0x1f32fd[_0x402a('0x3f')]['id']},'order':_0x402a('0x65')});}})['then'](handleEntityNotFound(_0x703881,null))['then'](function(_0x499c79){if(_0x499c79){_0x123f2f=_0x499c79;var _0x517c97={};for(var _0x1223e9=0x0,_0x4414f0=_0x123f2f[_0x402a('0x41')];_0x1223e9<_0x4414f0;_0x1223e9++){if(!_0x517c97[_0x402a('0x32')](_0x123f2f[_0x1223e9][_0x402a('0x66')])){_0x517c97[_0x123f2f[_0x1223e9][_0x402a('0x66')]]=needsEncapsulation(_0x123f2f[_0x1223e9][_0x402a('0x67')])?encapsulate(_0x123f2f[_0x1223e9][_0x402a('0x67')]):_0x123f2f[_0x1223e9][_0x402a('0x67')];}}var _0x50ec2e=[],_0x1aca12={};for(var _0x401641=0x0,_0x448523=_0x5df617['length'];_0x401641<_0x448523;_0x401641++){_0x1aca12={'ProjectId':_0x1f32fd[_0x402a('0x3f')]['id'],'SessionId':_0x5df617[_0x401641]['id'],'StartTime':moment(_0x5df617[_0x401641][_0x402a('0x68')])[_0x402a('0x69')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x26db94=0x0,_0x358102=_0x123f2f['length'];_0x26db94<_0x358102;_0x26db94++){if(_0x123f2f[_0x26db94][_0x402a('0x6a')]==_0x5df617[_0x401641]['id']&&_0x517c97[_0x402a('0x32')](_0x123f2f[_0x26db94]['questionId'])){_0x1aca12[_0x517c97[_0x123f2f[_0x26db94][_0x402a('0x66')]]]=_0x123f2f[_0x26db94][_0x402a('0x6b')];}}for(var _0x2b1e20 in _0x517c97){if(!_0x1aca12[_0x402a('0x32')](_0x517c97[_0x2b1e20])){_0x1aca12[_0x517c97[_0x2b1e20]]=null;}}_0x50ec2e[_0x402a('0x6c')](_0x1aca12);}return _0x50ec2e;}})['then'](function(_0x1e9788){if(!_[_0x402a('0x6d')](_0x1e9788)){var _0x1d3ae3=toCsv(_0x1e9788);var _0x4793fd=Date['now']();fs['writeFileSync'](util[_0x402a('0x69')](_0x402a('0x6e'),_0x1f32fd[_0x402a('0x3f')]['id'],_0x4793fd),_0x1d3ae3);_0x703881[_0x402a('0x6f')](_0x402a('0x70'),_0x402a('0x71')+util[_0x402a('0x69')](_0x402a('0x72'),_0x1f32fd['params']['id'],_0x4793fd));_0x703881[_0x402a('0x6f')](_0x402a('0x73'),_0x402a('0x74'));return _0x703881[_0x402a('0x75')](util[_0x402a('0x69')](_0x402a('0x6e'),_0x1f32fd['params']['id'],_0x4793fd));}else{return _0x703881[_0x402a('0x16')](0xcc);}})[_0x402a('0x3d')](handleError(_0x703881,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 06d3453..7ff3259 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 _0x777f=['define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptyProject.attributes'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x777f,0x9f));var _0xf777=function(_0x3cfb0d,_0x4df584){_0x3cfb0d=_0x3cfb0d-0x0;var _0x3486b4=_0x777f[_0x3cfb0d];return _0x3486b4;};'use strict';var _=require(_0xf777('0x0'));var util=require(_0xf777('0x1'));var logger=require(_0xf777('0x2'))(_0xf777('0x3'));var moment=require(_0xf777('0x4'));var BPromise=require(_0xf777('0x5'));var rp=require(_0xf777('0x6'));var fs=require('fs');var path=require(_0xf777('0x7'));var rimraf=require('rimraf');var config=require(_0xf777('0x8'));var attributes=require(_0xf777('0x9'));module['exports']=function(_0x5b7903,_0x5df5dc){return _0x5b7903[_0xf777('0xa')](_0xf777('0xb'),attributes,{'tableName':_0xf777('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4074=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','JscriptyProject'];(function(_0x157712,_0xc29e01){var _0x23e9d9=function(_0x492bf5){while(--_0x492bf5){_0x157712['push'](_0x157712['shift']());}};_0x23e9d9(++_0xc29e01);}(_0x4074,0xf0));var _0x4407=function(_0x40f9ca,_0x1eeec0){_0x40f9ca=_0x40f9ca-0x0;var _0x37b71f=_0x4074[_0x40f9ca];return _0x37b71f;};'use strict';var _=require(_0x4407('0x0'));var util=require(_0x4407('0x1'));var logger=require(_0x4407('0x2'))('api');var moment=require(_0x4407('0x3'));var BPromise=require(_0x4407('0x4'));var rp=require(_0x4407('0x5'));var fs=require('fs');var path=require(_0x4407('0x6'));var rimraf=require(_0x4407('0x7'));var config=require(_0x4407('0x8'));var attributes=require(_0x4407('0x9'));module[_0x4407('0xa')]=function(_0x3f085d,_0x35899d){return _0x3f085d['define'](_0x4407('0xb'),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 7a6f0cc..eca569f 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(_0x2accbe,_0x5580a5){var _0x5ecbd4=function(_0x1a7098){while(--_0x1a7098){_0x2accbe['push'](_0x2accbe['shift']());}};_0x5ecbd4(++_0x5580a5);}(_0x70e0,0x17b));var _0x070e=function(_0x430977,_0x4b2573){_0x430977=_0x430977-0x0;var _0x2544e4=_0x70e0[_0x430977];return _0x2544e4;};'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 _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','JscriptyProject,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x87b9be,_0x21f311){var _0x5a0b89=function(_0x529266){while(--_0x529266){_0x87b9be['push'](_0x87b9be['shift']());}};_0x5a0b89(++_0x21f311);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 57592ed..dad98a3 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 _0x708d=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','/describe','isAuthenticated','/:id','show','create','put','update'];(function(_0x4bd06e,_0x593701){var _0x85ebb=function(_0x26a7f2){while(--_0x26a7f2){_0x4bd06e['push'](_0x4bd06e['shift']());}};_0x85ebb(++_0x593701);}(_0x708d,0x1e6));var _0xd708=function(_0x9e689c,_0x2600d8){_0x9e689c=_0x9e689c-0x0;var _0x13ee00=_0x708d[_0x9e689c];return _0x13ee00;};'use strict';var multer=require(_0xd708('0x0'));var util=require(_0xd708('0x1'));var path=require(_0xd708('0x2'));var timeout=require(_0xd708('0x3'));var express=require(_0xd708('0x4'));var router=express[_0xd708('0x5')]();var fs_extra=require(_0xd708('0x6'));var auth=require(_0xd708('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xd708('0x8'));var controller=require(_0xd708('0x9'));router[_0xd708('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd708('0xb'),auth[_0xd708('0xc')](),controller['describe']);router[_0xd708('0xa')](_0xd708('0xd'),auth[_0xd708('0xc')](),controller[_0xd708('0xe')]);router['post']('/',auth[_0xd708('0xc')](),controller[_0xd708('0xf')]);router[_0xd708('0x10')](_0xd708('0xd'),auth['isAuthenticated'](),controller[_0xd708('0x11')]);router[_0xd708('0x12')](_0xd708('0xd'),auth['isAuthenticated'](),controller[_0xd708('0x13')]);module[_0xd708('0x14')]=router; \ No newline at end of file +var _0x35c1=['multer','util','express','Router','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','delete','destroy','exports'];(function(_0x59d88c,_0x44a315){var _0x32ba75=function(_0x388308){while(--_0x388308){_0x59d88c['push'](_0x59d88c['shift']());}};_0x32ba75(++_0x44a315);}(_0x35c1,0x156));var _0x135c=function(_0x6b44b0,_0x5d293b){_0x6b44b0=_0x6b44b0-0x0;var _0x559f60=_0x35c1[_0x6b44b0];return _0x559f60;};'use strict';var multer=require(_0x135c('0x0'));var util=require(_0x135c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x135c('0x2'));var router=express[_0x135c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x135c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x135c('0x5'));var controller=require(_0x135c('0x6'));router[_0x135c('0x7')]('/',auth[_0x135c('0x8')](),controller[_0x135c('0x9')]);router[_0x135c('0x7')](_0x135c('0xa'),auth[_0x135c('0x8')](),controller[_0x135c('0xb')]);router['get'](_0x135c('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x135c('0xd')]('/',auth[_0x135c('0x8')](),controller['create']);router[_0x135c('0xe')]('/:id',auth[_0x135c('0x8')](),controller[_0x135c('0xf')]);router[_0x135c('0x10')]('/:id',auth[_0x135c('0x8')](),controller[_0x135c('0x11')]);module[_0x135c('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 0194bd1..c5c1e90 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(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x264f91,_0x5257f4){_0x264f91=_0x264f91-0x0;var _0x2f0a79=_0x7a54[_0x264f91];return _0x2f0a79;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x7a54,0x106));var _0x47a5=function(_0x4c521b,_0x8ad473){_0x4c521b=_0x4c521b-0x0;var _0x3b4386=_0x7a54[_0x4c521b];return _0x3b4386;};'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 b29636c..8a71ac2 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 _0xfa21=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','JscriptyQuestionReport','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','map','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x2e81f4,_0x44f46a){var _0x198f70=function(_0x3d41b4){while(--_0x3d41b4){_0x2e81f4['push'](_0x2e81f4['shift']());}};_0x198f70(++_0x44f46a);}(_0xfa21,0x127));var _0x1fa2=function(_0x113b35,_0x22a043){_0x113b35=_0x113b35-0x0;var _0x405ee4=_0xfa21[_0x113b35];return _0x405ee4;};'use strict';var emlformat=require(_0x1fa2('0x0'));var rimraf=require(_0x1fa2('0x1'));var zipdir=require(_0x1fa2('0x2'));var jsonpatch=require(_0x1fa2('0x3'));var rp=require('request-promise');var moment=require(_0x1fa2('0x4'));var BPromise=require(_0x1fa2('0x5'));var Mustache=require(_0x1fa2('0x6'));var util=require(_0x1fa2('0x7'));var path=require(_0x1fa2('0x8'));var sox=require(_0x1fa2('0x9'));var csv=require(_0x1fa2('0xa'));var ejs=require(_0x1fa2('0xb'));var fs=require('fs');var fs_extra=require(_0x1fa2('0xc'));var _=require(_0x1fa2('0xd'));var squel=require(_0x1fa2('0xe'));var crypto=require(_0x1fa2('0xf'));var jsforce=require(_0x1fa2('0x10'));var deskjs=require(_0x1fa2('0x11'));var toCsv=require(_0x1fa2('0xa'));var querystring=require(_0x1fa2('0x12'));var Papa=require(_0x1fa2('0x13'));var Redis=require(_0x1fa2('0x14'));var authService=require(_0x1fa2('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1fa2('0x16'))('api');var utils=require(_0x1fa2('0x17'));var config=require(_0x1fa2('0x18'));var licenseUtil=require(_0x1fa2('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41561e,_0x424d5e){_0x424d5e=_0x424d5e||0xcc;return function(_0x177acd){if(_0x177acd){return _0x41561e['sendStatus'](_0x424d5e);}return _0x41561e[_0x1fa2('0x1a')](_0x424d5e)[_0x1fa2('0x1b')]();};}function respondWithResult(_0x139670,_0x4423e9){_0x4423e9=_0x4423e9||0xc8;return function(_0x2c675f){if(_0x2c675f){return _0x139670['status'](_0x4423e9)[_0x1fa2('0x1c')](_0x2c675f);}};}function respondWithFilteredResult(_0x2990b9,_0x12631f){return function(_0x3e9392){if(_0x3e9392){var _0xb44052=typeof _0x12631f[_0x1fa2('0x1d')]==='undefined'&&typeof _0x12631f['limit']===_0x1fa2('0x1e');var _0x3e9541=_0x3e9392[_0x1fa2('0x1f')];var _0x433f28=_0xb44052?0x0:_0x12631f[_0x1fa2('0x1d')];var _0x4bd086=_0xb44052?_0x3e9392['count']:_0x12631f[_0x1fa2('0x1d')]+_0x12631f[_0x1fa2('0x20')];var _0x577e7c;if(_0x4bd086>=_0x3e9541){_0x4bd086=_0x3e9541;_0x577e7c=0xc8;}else{_0x577e7c=0xce;}_0x2990b9[_0x1fa2('0x1a')](_0x577e7c);return _0x2990b9[_0x1fa2('0x21')](_0x1fa2('0x22'),_0x433f28+'-'+_0x4bd086+'/'+_0x3e9541)['json'](_0x3e9392);}return null;};}function patchUpdates(_0x5d63a3){return function(_0x571b97){try{jsonpatch[_0x1fa2('0x23')](_0x571b97,_0x5d63a3,!![]);}catch(_0x5431e2){return BPromise[_0x1fa2('0x24')](_0x5431e2);}return _0x571b97[_0x1fa2('0x25')]();};}function saveUpdates(_0x195fa3,_0x2df072){return function(_0x6821a){if(_0x6821a){return _0x6821a[_0x1fa2('0x26')](_0x195fa3)['then'](function(_0x3056df){return _0x3056df;});}return null;};}function removeEntity(_0x56b8f6,_0x88d6dd){return function(_0x9d0a7c){if(_0x9d0a7c){return _0x9d0a7c[_0x1fa2('0x27')]()[_0x1fa2('0x28')](function(){_0x56b8f6[_0x1fa2('0x1a')](0xcc)[_0x1fa2('0x1b')]();});}};}function handleEntityNotFound(_0x72be9a,_0x4c520e){return function(_0x2c5327){if(!_0x2c5327){_0x72be9a['sendStatus'](0x194);}return _0x2c5327;};}function handleError(_0x14a725,_0x1cbd70){_0x1cbd70=_0x1cbd70||0x1f4;return function(_0x51d8fe){logger[_0x1fa2('0x29')](_0x51d8fe[_0x1fa2('0x2a')]);if(_0x51d8fe[_0x1fa2('0x2b')]){delete _0x51d8fe['name'];}_0x14a725[_0x1fa2('0x1a')](_0x1cbd70)[_0x1fa2('0x2c')](_0x51d8fe);};}exports[_0x1fa2('0x2d')]=function(_0x4739f3,_0x4c481d){var _0x28bf49={},_0x36ea51={},_0x5627f3={'count':0x0,'rows':[]};var _0x543a96=_['map'](db[_0x1fa2('0x2e')][_0x1fa2('0x2f')],function(_0x5b2667){return{'name':_0x5b2667[_0x1fa2('0x30')],'type':_0x5b2667['type']['key']};});_0x36ea51[_0x1fa2('0x31')]=_['map'](_0x543a96,_0x1fa2('0x2b'));_0x36ea51[_0x1fa2('0x32')]=_['keys'](_0x4739f3['query']);_0x36ea51[_0x1fa2('0x33')]=_[_0x1fa2('0x34')](_0x36ea51[_0x1fa2('0x31')],_0x36ea51[_0x1fa2('0x32')]);_0x28bf49[_0x1fa2('0x35')]=_[_0x1fa2('0x34')](_0x36ea51[_0x1fa2('0x31')],qs[_0x1fa2('0x36')](_0x4739f3[_0x1fa2('0x32')][_0x1fa2('0x36')]));_0x28bf49[_0x1fa2('0x35')]=_0x28bf49['attributes'][_0x1fa2('0x37')]?_0x28bf49['attributes']:_0x36ea51[_0x1fa2('0x31')];if(!_0x4739f3[_0x1fa2('0x32')]['hasOwnProperty'](_0x1fa2('0x38'))){_0x28bf49[_0x1fa2('0x20')]=qs['limit'](_0x4739f3[_0x1fa2('0x32')]['limit']);_0x28bf49[_0x1fa2('0x1d')]=qs[_0x1fa2('0x1d')](_0x4739f3[_0x1fa2('0x32')][_0x1fa2('0x1d')]);}_0x28bf49[_0x1fa2('0x39')]=qs['sort'](_0x4739f3[_0x1fa2('0x32')][_0x1fa2('0x3a')]);_0x28bf49[_0x1fa2('0x3b')]=qs['filters'](_['pick'](_0x4739f3['query'],_0x36ea51[_0x1fa2('0x33')]),_0x543a96);if(_0x4739f3[_0x1fa2('0x32')][_0x1fa2('0x3c')]){_0x28bf49['where']=_[_0x1fa2('0x3d')](_0x28bf49[_0x1fa2('0x3b')],{'$or':_[_0x1fa2('0x3e')](_0x543a96,function(_0x3c3657){if(_0x3c3657[_0x1fa2('0x3f')]!==_0x1fa2('0x40')){var _0x15b1ec={};_0x15b1ec[_0x3c3657[_0x1fa2('0x2b')]]={'$like':'%'+_0x4739f3[_0x1fa2('0x32')][_0x1fa2('0x3c')]+'%'};return _0x15b1ec;}})});}_0x28bf49=_[_0x1fa2('0x3d')]({},_0x28bf49,_0x4739f3[_0x1fa2('0x41')]);var _0x318e7={'where':_0x28bf49[_0x1fa2('0x3b')]};return db[_0x1fa2('0x2e')]['count'](_0x318e7)[_0x1fa2('0x28')](function(_0x39e3b4){_0x5627f3[_0x1fa2('0x1f')]=_0x39e3b4;if(_0x4739f3[_0x1fa2('0x32')][_0x1fa2('0x42')]){_0x28bf49[_0x1fa2('0x43')]=[{'all':!![]}];}return db[_0x1fa2('0x2e')]['findAll'](_0x28bf49);})['then'](function(_0x365f2b){_0x5627f3[_0x1fa2('0x44')]=_0x365f2b;return _0x5627f3;})[_0x1fa2('0x28')](respondWithFilteredResult(_0x4c481d,_0x28bf49))[_0x1fa2('0x45')](handleError(_0x4c481d,null));};exports[_0x1fa2('0x46')]=function(_0x301c0b,_0x41222f){var _0x2d4a54={'raw':!![],'where':{'id':_0x301c0b[_0x1fa2('0x47')]['id']}},_0x40f863={};_0x40f863[_0x1fa2('0x31')]=_['keys'](db[_0x1fa2('0x2e')][_0x1fa2('0x2f')]);_0x40f863[_0x1fa2('0x32')]=_[_0x1fa2('0x48')](_0x301c0b[_0x1fa2('0x32')]);_0x40f863[_0x1fa2('0x33')]=_[_0x1fa2('0x34')](_0x40f863['model'],_0x40f863['query']);_0x2d4a54[_0x1fa2('0x35')]=_[_0x1fa2('0x34')](_0x40f863[_0x1fa2('0x31')],qs['fields'](_0x301c0b[_0x1fa2('0x32')][_0x1fa2('0x36')]));_0x2d4a54[_0x1fa2('0x35')]=_0x2d4a54[_0x1fa2('0x35')][_0x1fa2('0x37')]?_0x2d4a54[_0x1fa2('0x35')]:_0x40f863[_0x1fa2('0x31')];if(_0x301c0b[_0x1fa2('0x32')]['includeAll']){_0x2d4a54['include']=[{'all':!![]}];}_0x2d4a54=_[_0x1fa2('0x3d')]({},_0x2d4a54,_0x301c0b['options']);return db[_0x1fa2('0x2e')]['find'](_0x2d4a54)['then'](handleEntityNotFound(_0x41222f,null))[_0x1fa2('0x28')](respondWithResult(_0x41222f,null))['catch'](handleError(_0x41222f,null));};exports[_0x1fa2('0x49')]=function(_0x4b5798,_0x2b82d2){return db['JscriptyQuestionReport'][_0x1fa2('0x49')](_0x4b5798[_0x1fa2('0x4a')],{})['then'](respondWithResult(_0x2b82d2,0xc9))[_0x1fa2('0x45')](handleError(_0x2b82d2,null));};exports[_0x1fa2('0x26')]=function(_0x1932f8,_0x210409){if(_0x1932f8['body']['id']){delete _0x1932f8[_0x1fa2('0x4a')]['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x1932f8[_0x1fa2('0x47')]['id']}})[_0x1fa2('0x28')](handleEntityNotFound(_0x210409,null))['then'](saveUpdates(_0x1932f8[_0x1fa2('0x4a')],null))['then'](respondWithResult(_0x210409,null))[_0x1fa2('0x45')](handleError(_0x210409,null));};exports[_0x1fa2('0x27')]=function(_0x29db58,_0x2a9989){return db[_0x1fa2('0x2e')][_0x1fa2('0x4b')]({'where':{'id':_0x29db58[_0x1fa2('0x47')]['id']}})['then'](handleEntityNotFound(_0x2a9989,null))['then'](removeEntity(_0x2a9989,null))['catch'](handleError(_0x2a9989,null));};exports[_0x1fa2('0x4c')]=function(_0x2f58a9,_0x2a7bcf){return db[_0x1fa2('0x2e')][_0x1fa2('0x4c')]()[_0x1fa2('0x28')](respondWithResult(_0x2a7bcf,null))['catch'](handleError(_0x2a7bcf,null));}; \ No newline at end of file +var _0x059d=['moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','destroy','error','index','map','JscriptyQuestionReport','fieldName','key','keys','query','filters','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','name','options','then','includeAll','include','findAll','catch','show','rawAttributes','intersection','create','body','params','find','describe','eml-format','rimraf','fast-json-patch'];(function(_0x291f7b,_0x50ab8a){var _0x988074=function(_0x50824c){while(--_0x50824c){_0x291f7b['push'](_0x291f7b['shift']());}};_0x988074(++_0x50ab8a);}(_0x059d,0x8f));var _0xd059=function(_0x4fdbf5,_0x396648){_0x4fdbf5=_0x4fdbf5-0x0;var _0x1a859a=_0x059d[_0x4fdbf5];return _0x1a859a;};'use strict';var emlformat=require(_0xd059('0x0'));var rimraf=require(_0xd059('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd059('0x2'));var rp=require('request-promise');var moment=require(_0xd059('0x3'));var BPromise=require(_0xd059('0x4'));var Mustache=require(_0xd059('0x5'));var util=require(_0xd059('0x6'));var path=require('path');var sox=require(_0xd059('0x7'));var csv=require('to-csv');var ejs=require(_0xd059('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd059('0x9'));var squel=require('squel');var crypto=require(_0xd059('0xa'));var jsforce=require(_0xd059('0xb'));var deskjs=require(_0xd059('0xc'));var toCsv=require(_0xd059('0xd'));var querystring=require(_0xd059('0xe'));var Papa=require('papaparse');var Redis=require(_0xd059('0xf'));var authService=require(_0xd059('0x10'));var qs=require(_0xd059('0x11'));var as=require(_0xd059('0x12'));var hardwareService=require(_0xd059('0x13'));var logger=require(_0xd059('0x14'))(_0xd059('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd059('0x16'));var db=require(_0xd059('0x17'))['db'];function respondWithStatusCode(_0x307807,_0x41cca8){_0x41cca8=_0x41cca8||0xcc;return function(_0x149642){if(_0x149642){return _0x307807['sendStatus'](_0x41cca8);}return _0x307807[_0xd059('0x18')](_0x41cca8)[_0xd059('0x19')]();};}function respondWithResult(_0x4ea292,_0x16c837){_0x16c837=_0x16c837||0xc8;return function(_0x143247){if(_0x143247){return _0x4ea292['status'](_0x16c837)[_0xd059('0x1a')](_0x143247);}};}function respondWithFilteredResult(_0x28703f,_0x331528){return function(_0x381bbd){if(_0x381bbd){var _0x2e7ce0=typeof _0x331528[_0xd059('0x1b')]==='undefined'&&typeof _0x331528[_0xd059('0x1c')]===_0xd059('0x1d');var _0x4bf98c=_0x381bbd[_0xd059('0x1e')];var _0x46e6e5=_0x2e7ce0?0x0:_0x331528[_0xd059('0x1b')];var _0xdb48cc=_0x2e7ce0?_0x381bbd[_0xd059('0x1e')]:_0x331528['offset']+_0x331528['limit'];var _0x3e4021;if(_0xdb48cc>=_0x4bf98c){_0xdb48cc=_0x4bf98c;_0x3e4021=0xc8;}else{_0x3e4021=0xce;}_0x28703f[_0xd059('0x18')](_0x3e4021);return _0x28703f[_0xd059('0x1f')]('Content-Range',_0x46e6e5+'-'+_0xdb48cc+'/'+_0x4bf98c)['json'](_0x381bbd);}return null;};}function patchUpdates(_0x29ceff){return function(_0x592496){try{jsonpatch[_0xd059('0x20')](_0x592496,_0x29ceff,!![]);}catch(_0x634b8b){return BPromise[_0xd059('0x21')](_0x634b8b);}return _0x592496[_0xd059('0x22')]();};}function saveUpdates(_0x3a656d,_0x135c2a){return function(_0x44d45c){if(_0x44d45c){return _0x44d45c[_0xd059('0x23')](_0x3a656d)['then'](function(_0x39f8ca){return _0x39f8ca;});}return null;};}function removeEntity(_0x2ad182,_0x4bb23f){return function(_0x3bfa2b){if(_0x3bfa2b){return _0x3bfa2b[_0xd059('0x24')]()['then'](function(){_0x2ad182[_0xd059('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3eea25,_0x4e731f){return function(_0xf09619){if(!_0xf09619){_0x3eea25['sendStatus'](0x194);}return _0xf09619;};}function handleError(_0x6a7060,_0x5145ce){_0x5145ce=_0x5145ce||0x1f4;return function(_0x11b961){logger[_0xd059('0x25')](_0x11b961['stack']);if(_0x11b961['name']){delete _0x11b961['name'];}_0x6a7060[_0xd059('0x18')](_0x5145ce)['send'](_0x11b961);};}exports[_0xd059('0x26')]=function(_0x184dc6,_0x581377){var _0x4cb4f4={},_0x1bc0a0={},_0xb97665={'count':0x0,'rows':[]};var _0x3bea44=_[_0xd059('0x27')](db[_0xd059('0x28')]['rawAttributes'],function(_0x278287){return{'name':_0x278287[_0xd059('0x29')],'type':_0x278287['type'][_0xd059('0x2a')]};});_0x1bc0a0['model']=_[_0xd059('0x27')](_0x3bea44,'name');_0x1bc0a0['query']=_[_0xd059('0x2b')](_0x184dc6[_0xd059('0x2c')]);_0x1bc0a0[_0xd059('0x2d')]=_['intersection'](_0x1bc0a0['model'],_0x1bc0a0[_0xd059('0x2c')]);_0x4cb4f4['attributes']=_['intersection'](_0x1bc0a0['model'],qs['fields'](_0x184dc6['query'][_0xd059('0x2e')]));_0x4cb4f4[_0xd059('0x2f')]=_0x4cb4f4[_0xd059('0x2f')][_0xd059('0x30')]?_0x4cb4f4[_0xd059('0x2f')]:_0x1bc0a0[_0xd059('0x31')];if(!_0x184dc6[_0xd059('0x2c')][_0xd059('0x32')](_0xd059('0x33'))){_0x4cb4f4['limit']=qs['limit'](_0x184dc6['query'][_0xd059('0x1c')]);_0x4cb4f4[_0xd059('0x1b')]=qs[_0xd059('0x1b')](_0x184dc6[_0xd059('0x2c')]['offset']);}_0x4cb4f4[_0xd059('0x34')]=qs['sort'](_0x184dc6[_0xd059('0x2c')][_0xd059('0x35')]);_0x4cb4f4[_0xd059('0x36')]=qs[_0xd059('0x2d')](_[_0xd059('0x37')](_0x184dc6['query'],_0x1bc0a0[_0xd059('0x2d')]),_0x3bea44);if(_0x184dc6[_0xd059('0x2c')][_0xd059('0x38')]){_0x4cb4f4[_0xd059('0x36')]=_['merge'](_0x4cb4f4['where'],{'$or':_[_0xd059('0x27')](_0x3bea44,function(_0x53cc2e){if(_0x53cc2e[_0xd059('0x39')]!=='VIRTUAL'){var _0x13d94e={};_0x13d94e[_0x53cc2e[_0xd059('0x3a')]]={'$like':'%'+_0x184dc6[_0xd059('0x2c')][_0xd059('0x38')]+'%'};return _0x13d94e;}})});}_0x4cb4f4=_['merge']({},_0x4cb4f4,_0x184dc6[_0xd059('0x3b')]);var _0x21e8f3={'where':_0x4cb4f4['where']};return db['JscriptyQuestionReport']['count'](_0x21e8f3)[_0xd059('0x3c')](function(_0x129f46){_0xb97665['count']=_0x129f46;if(_0x184dc6[_0xd059('0x2c')][_0xd059('0x3d')]){_0x4cb4f4[_0xd059('0x3e')]=[{'all':!![]}];}return db[_0xd059('0x28')][_0xd059('0x3f')](_0x4cb4f4);})['then'](function(_0x414cd6){_0xb97665['rows']=_0x414cd6;return _0xb97665;})['then'](respondWithFilteredResult(_0x581377,_0x4cb4f4))[_0xd059('0x40')](handleError(_0x581377,null));};exports[_0xd059('0x41')]=function(_0x1cab7b,_0x1c7d69){var _0x25c620={'raw':!![],'where':{'id':_0x1cab7b['params']['id']}},_0x33a3a7={};_0x33a3a7[_0xd059('0x31')]=_[_0xd059('0x2b')](db[_0xd059('0x28')][_0xd059('0x42')]);_0x33a3a7[_0xd059('0x2c')]=_[_0xd059('0x2b')](_0x1cab7b['query']);_0x33a3a7[_0xd059('0x2d')]=_[_0xd059('0x43')](_0x33a3a7[_0xd059('0x31')],_0x33a3a7[_0xd059('0x2c')]);_0x25c620['attributes']=_[_0xd059('0x43')](_0x33a3a7['model'],qs[_0xd059('0x2e')](_0x1cab7b[_0xd059('0x2c')]['fields']));_0x25c620[_0xd059('0x2f')]=_0x25c620['attributes'][_0xd059('0x30')]?_0x25c620[_0xd059('0x2f')]:_0x33a3a7[_0xd059('0x31')];if(_0x1cab7b['query']['includeAll']){_0x25c620[_0xd059('0x3e')]=[{'all':!![]}];}_0x25c620=_['merge']({},_0x25c620,_0x1cab7b[_0xd059('0x3b')]);return db[_0xd059('0x28')]['find'](_0x25c620)[_0xd059('0x3c')](handleEntityNotFound(_0x1c7d69,null))[_0xd059('0x3c')](respondWithResult(_0x1c7d69,null))[_0xd059('0x40')](handleError(_0x1c7d69,null));};exports[_0xd059('0x44')]=function(_0x7e4783,_0xff26fb){return db[_0xd059('0x28')][_0xd059('0x44')](_0x7e4783[_0xd059('0x45')],{})[_0xd059('0x3c')](respondWithResult(_0xff26fb,0xc9))[_0xd059('0x40')](handleError(_0xff26fb,null));};exports['update']=function(_0x464299,_0x2e0634){if(_0x464299[_0xd059('0x45')]['id']){delete _0x464299['body']['id'];}return db[_0xd059('0x28')]['find']({'where':{'id':_0x464299[_0xd059('0x46')]['id']}})[_0xd059('0x3c')](handleEntityNotFound(_0x2e0634,null))[_0xd059('0x3c')](saveUpdates(_0x464299[_0xd059('0x45')],null))[_0xd059('0x3c')](respondWithResult(_0x2e0634,null))[_0xd059('0x40')](handleError(_0x2e0634,null));};exports[_0xd059('0x24')]=function(_0xe9651b,_0x5787f5){return db[_0xd059('0x28')][_0xd059('0x47')]({'where':{'id':_0xe9651b[_0xd059('0x46')]['id']}})['then'](handleEntityNotFound(_0x5787f5,null))[_0xd059('0x3c')](removeEntity(_0x5787f5,null))[_0xd059('0x40')](handleError(_0x5787f5,null));};exports[_0xd059('0x48')]=function(_0x427da6,_0xf51a44){return db[_0xd059('0x28')][_0xd059('0x48')]()[_0xd059('0x3c')](respondWithResult(_0xf51a44,null))[_0xd059('0x40')](handleError(_0xf51a44,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 9a98b14..1342255 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 _0xec79=['define','report_jscripty_questions','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptyQuestionReport.attributes','exports'];(function(_0x258200,_0x59dabe){var _0x214d0f=function(_0x35fea1){while(--_0x35fea1){_0x258200['push'](_0x258200['shift']());}};_0x214d0f(++_0x59dabe);}(_0xec79,0x1a6));var _0x9ec7=function(_0x37cbeb,_0x5662bb){_0x37cbeb=_0x37cbeb-0x0;var _0x17155f=_0xec79[_0x37cbeb];return _0x17155f;};'use strict';var _=require(_0x9ec7('0x0'));var util=require(_0x9ec7('0x1'));var logger=require('../../config/logger')(_0x9ec7('0x2'));var moment=require(_0x9ec7('0x3'));var BPromise=require(_0x9ec7('0x4'));var rp=require(_0x9ec7('0x5'));var fs=require('fs');var path=require(_0x9ec7('0x6'));var rimraf=require('rimraf');var config=require(_0x9ec7('0x7'));var attributes=require(_0x9ec7('0x8'));module[_0x9ec7('0x9')]=function(_0x2aff6c,_0x575876){return _0x2aff6c[_0x9ec7('0xa')]('JscriptyQuestionReport',attributes,{'tableName':_0x9ec7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdef1=['bluebird','path','rimraf','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xdef1,0x1b4));var _0x1def=function(_0x234fb0,_0x563158){_0x234fb0=_0x234fb0-0x0;var _0x24cc55=_0xdef1[_0x234fb0];return _0x24cc55;};'use strict';var _=require(_0x1def('0x0'));var util=require(_0x1def('0x1'));var logger=require(_0x1def('0x2'))(_0x1def('0x3'));var moment=require('moment');var BPromise=require(_0x1def('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1def('0x5'));var rimraf=require(_0x1def('0x6'));var config=require('../../config/environment');var attributes=require(_0x1def('0x7'));module[_0x1def('0x8')]=function(_0x58d87c,_0xbe27ed){return _0x58d87c['define'](_0x1def('0x9'),attributes,{'tableName':_0x1def('0xa'),'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 dd3dd5f..ab83e34 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 _0x98fb=['catch','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyQuestionReport,\x20%s,\x20%s','result'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x98fb,0x6a));var _0xb98f=function(_0x58ca7d,_0x27f5ea){_0x58ca7d=_0x58ca7d-0x0;var _0x152c4c=_0x98fb[_0x58ca7d];return _0x152c4c;};'use strict';var _=require('lodash');var util=require(_0xb98f('0x0'));var moment=require('moment');var BPromise=require(_0xb98f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb98f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xb98f('0x3'));var logger=require(_0xb98f('0x4'))(_0xb98f('0x5'));var config=require(_0xb98f('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb98f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x472f87,_0x37e68e,_0x263fad){return new BPromise(function(_0x3a20d1,_0x40bf97){return client[_0xb98f('0x8')](_0x472f87,_0x263fad)[_0xb98f('0x9')](function(_0x267835){logger[_0xb98f('0xa')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x37e68e,_0xb98f('0xb'));logger[_0xb98f('0xc')](_0xb98f('0xd'),_0x37e68e,_0xb98f('0xb'),JSON[_0xb98f('0xe')](_0x267835));if(_0x267835[_0xb98f('0xf')]){if(_0x267835[_0xb98f('0xf')][_0xb98f('0x10')]===0x1f4){logger[_0xb98f('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x37e68e,_0x267835[_0xb98f('0xf')][_0xb98f('0x11')]);return _0x40bf97(_0x267835[_0xb98f('0xf')][_0xb98f('0x11')]);}logger[_0xb98f('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x37e68e,_0x267835['error'][_0xb98f('0x11')]);return _0x3a20d1(_0x267835['error']['message']);}else{logger[_0xb98f('0xa')](_0xb98f('0x12'),_0x37e68e,_0xb98f('0xb'));_0x3a20d1(_0x267835[_0xb98f('0x13')]['message']);}})[_0xb98f('0x14')](function(_0x465849){logger[_0xb98f('0xf')](_0xb98f('0x12'),_0x37e68e,_0x465849);_0x40bf97(_0x465849);});});} \ No newline at end of file +var _0x7057=['../../config/environment','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x11033b,_0x24a21f){var _0x24974e=function(_0x3d4a6e){while(--_0x3d4a6e){_0x11033b['push'](_0x11033b['shift']());}};_0x24974e(++_0x24a21f);}(_0x7057,0x1f1));var _0x7705=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7057[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7705('0x0'));var util=require('util');var moment=require(_0x7705('0x1'));var BPromise=require(_0x7705('0x2'));var rs=require(_0x7705('0x3'));var fs=require('fs');var Redis=require(_0x7705('0x4'));var db=require(_0x7705('0x5'))['db'];var utils=require(_0x7705('0x6'));var logger=require(_0x7705('0x7'))(_0x7705('0x8'));var config=require(_0x7705('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7705('0xa')][_0x7705('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x286f66,_0x3f12aa,_0x3fb02b){return new BPromise(function(_0x198ba3,_0x370856){return client[_0x7705('0xc')](_0x286f66,_0x3fb02b)[_0x7705('0xd')](function(_0xc041ff){logger[_0x7705('0xe')](_0x7705('0xf'),_0x3f12aa,_0x7705('0x10'));logger[_0x7705('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x3f12aa,_0x7705('0x10'),JSON[_0x7705('0x12')](_0xc041ff));if(_0xc041ff[_0x7705('0x13')]){if(_0xc041ff[_0x7705('0x13')][_0x7705('0x14')]===0x1f4){logger[_0x7705('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3f12aa,_0xc041ff['error']['message']);return _0x370856(_0xc041ff[_0x7705('0x13')][_0x7705('0x15')]);}logger[_0x7705('0x13')](_0x7705('0xf'),_0x3f12aa,_0xc041ff[_0x7705('0x13')][_0x7705('0x15')]);return _0x198ba3(_0xc041ff[_0x7705('0x13')][_0x7705('0x15')]);}else{logger[_0x7705('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3f12aa,_0x7705('0x10'));_0x198ba3(_0xc041ff['result']['message']);}})['catch'](function(_0x56afe4){logger[_0x7705('0x13')](_0x7705('0xf'),_0x3f12aa,_0x56afe4);_0x370856(_0x56afe4);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index e2ca3df..f66800c 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 _0x47c6=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','/describe','describe','get','show','/:id/questions','post','create','delete','/:id'];(function(_0x26d9ae,_0x416a73){var _0x3f46ab=function(_0x1b62f0){while(--_0x1b62f0){_0x26d9ae['push'](_0x26d9ae['shift']());}};_0x3f46ab(++_0x416a73);}(_0x47c6,0x1a4));var _0x647c=function(_0x51b52e,_0x3c2506){_0x51b52e=_0x51b52e-0x0;var _0x59a011=_0x47c6[_0x51b52e];return _0x59a011;};'use strict';var multer=require(_0x647c('0x0'));var util=require(_0x647c('0x1'));var path=require('path');var timeout=require(_0x647c('0x2'));var express=require(_0x647c('0x3'));var router=express[_0x647c('0x4')]();var fs_extra=require(_0x647c('0x5'));var auth=require(_0x647c('0x6'));var interaction=require(_0x647c('0x7'));var config=require(_0x647c('0x8'));var controller=require(_0x647c('0x9'));router['get']('/',auth[_0x647c('0xa')](),controller[_0x647c('0xb')]);router['get'](_0x647c('0xc'),auth[_0x647c('0xa')](),controller[_0x647c('0xd')]);router[_0x647c('0xe')]('/:id',auth[_0x647c('0xa')](),controller[_0x647c('0xf')]);router['get'](_0x647c('0x10'),auth[_0x647c('0xa')](),controller['getQuestions']);router[_0x647c('0x11')]('/',auth[_0x647c('0xa')](),controller[_0x647c('0x12')]);router['put']('/:id',auth[_0x647c('0xa')](),controller['update']);router[_0x647c('0x13')](_0x647c('0x14'),auth[_0x647c('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7d6f=['describe','/:id','isAuthenticated','show','/:id/questions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','index','get','/describe'];(function(_0x17d090,_0x4fc0c7){var _0x1c89b8=function(_0x22b90a){while(--_0x22b90a){_0x17d090['push'](_0x17d090['shift']());}};_0x1c89b8(++_0x4fc0c7);}(_0x7d6f,0xc4));var _0xf7d6=function(_0xfaa329,_0x1c3a4b){_0xfaa329=_0xfaa329-0x0;var _0x59805b=_0x7d6f[_0xfaa329];return _0x59805b;};'use strict';var multer=require(_0xf7d6('0x0'));var util=require(_0xf7d6('0x1'));var path=require(_0xf7d6('0x2'));var timeout=require('connect-timeout');var express=require(_0xf7d6('0x3'));var router=express[_0xf7d6('0x4')]();var fs_extra=require(_0xf7d6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf7d6('0x6'));var config=require(_0xf7d6('0x7'));var controller=require('./jscriptySessionReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xf7d6('0x8')]);router[_0xf7d6('0x9')](_0xf7d6('0xa'),auth['isAuthenticated'](),controller[_0xf7d6('0xb')]);router['get'](_0xf7d6('0xc'),auth[_0xf7d6('0xd')](),controller[_0xf7d6('0xe')]);router[_0xf7d6('0x9')](_0xf7d6('0xf'),auth[_0xf7d6('0xd')](),controller['getQuestions']);router[_0xf7d6('0x10')]('/',auth[_0xf7d6('0xd')](),controller[_0xf7d6('0x11')]);router[_0xf7d6('0x12')](_0xf7d6('0xc'),auth[_0xf7d6('0xd')](),controller[_0xf7d6('0x13')]);router[_0xf7d6('0x14')](_0xf7d6('0xc'),auth['isAuthenticated'](),controller[_0xf7d6('0x15')]);module[_0xf7d6('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 3139806..54d708d 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 _0x31dc=['setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','sequelize','exports','DATE'];(function(_0x330e29,_0x22f050){var _0x5d9492=function(_0x4183f2){while(--_0x4183f2){_0x330e29['push'](_0x330e29['shift']());}};_0x5d9492(++_0x22f050);}(_0x31dc,0x1ab));var _0xc31d=function(_0x24ec0b,_0x5303ad){_0x24ec0b=_0x24ec0b-0x0;var _0x12acc6=_0x31dc[_0x24ec0b];return _0x12acc6;};'use strict';var moment=require('moment');var Sequelize=require(_0xc31d('0x0'));module[_0xc31d('0x1')]={'starttime':{'type':Sequelize[_0xc31d('0x2')],'set':function(_0x191423){this[_0xc31d('0x3')](_0xc31d('0x4'),_0x191423);this[_0xc31d('0x3')](_0xc31d('0x5'),moment()[_0xc31d('0x6')](_0xc31d('0x7')));}},'endtime':{'type':Sequelize[_0xc31d('0x2')]},'membername':{'type':Sequelize[_0xc31d('0x8')]},'projectname':{'type':Sequelize[_0xc31d('0x8')]},'queue':{'type':Sequelize[_0xc31d('0x8')]},'uniqueid':{'type':Sequelize[_0xc31d('0x8')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc31d('0x8')]},'completed':{'type':Sequelize[_0xc31d('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x604c=['DATE','setDataValue','format','STRING','moment','exports'];(function(_0x53de12,_0xdd481a){var _0x437439=function(_0x2940f9){while(--_0x2940f9){_0x53de12['push'](_0x53de12['shift']());}};_0x437439(++_0xdd481a);}(_0x604c,0x1f0));var _0xc604=function(_0x5937cc,_0x19ce5a){_0x5937cc=_0x5937cc-0x0;var _0x200b89=_0x604c[_0x5937cc];return _0x200b89;};'use strict';var moment=require(_0xc604('0x0'));var Sequelize=require('sequelize');module[_0xc604('0x1')]={'starttime':{'type':Sequelize[_0xc604('0x2')],'set':function(_0x3a8128){this['setDataValue']('starttime',_0x3a8128);this[_0xc604('0x3')]('endtime',moment()[_0xc604('0x4')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0xc604('0x2')]},'membername':{'type':Sequelize[_0xc604('0x5')]},'projectname':{'type':Sequelize[_0xc604('0x5')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xc604('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 3fbc64c..393fe56 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 _0x89d6=['to-csv','ejs','lodash','squel','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','limit','undefined','count','offset','set','Content-Range','json','apply','update','then','destroy','end','stack','name','send','index','JscriptySessionReport','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','length','find','create','body','describe','getQuestions','findOne','SessionId','includeAll','JscriptyQuestionReport','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox'];(function(_0x2e2568,_0x3f4818){var _0x58c455=function(_0x272a58){while(--_0x272a58){_0x2e2568['push'](_0x2e2568['shift']());}};_0x58c455(++_0x3f4818);}(_0x89d6,0x1de));var _0x689d=function(_0x47d2d8,_0x4aed38){_0x47d2d8=_0x47d2d8-0x0;var _0x1dabe5=_0x89d6[_0x47d2d8];return _0x1dabe5;};'use strict';var emlformat=require(_0x689d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x689d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x689d('0x2'));var moment=require(_0x689d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x689d('0x4'));var util=require(_0x689d('0x5'));var path=require(_0x689d('0x6'));var sox=require(_0x689d('0x7'));var csv=require(_0x689d('0x8'));var ejs=require(_0x689d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x689d('0xa'));var squel=require(_0x689d('0xb'));var crypto=require('crypto');var jsforce=require(_0x689d('0xc'));var deskjs=require(_0x689d('0xd'));var toCsv=require(_0x689d('0x8'));var querystring=require(_0x689d('0xe'));var Papa=require(_0x689d('0xf'));var Redis=require(_0x689d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x689d('0x11'));var as=require(_0x689d('0x12'));var hardwareService=require(_0x689d('0x13'));var logger=require(_0x689d('0x14'))('api');var utils=require(_0x689d('0x15'));var config=require(_0x689d('0x16'));var licenseUtil=require(_0x689d('0x17'));var db=require(_0x689d('0x18'))['db'];function respondWithStatusCode(_0x1ba6cd,_0x42c475){_0x42c475=_0x42c475||0xcc;return function(_0x197eb2){if(_0x197eb2){return _0x1ba6cd[_0x689d('0x19')](_0x42c475);}return _0x1ba6cd[_0x689d('0x1a')](_0x42c475)['end']();};}function respondWithResult(_0x20bfed,_0xb305c5){_0xb305c5=_0xb305c5||0xc8;return function(_0x2ccc55){if(_0x2ccc55){return _0x20bfed[_0x689d('0x1a')](_0xb305c5)['json'](_0x2ccc55);}};}function respondWithFilteredResult(_0x45ccfb,_0x1f5211){return function(_0x232876){if(_0x232876){var _0x29d8c0=typeof _0x1f5211['offset']==='undefined'&&typeof _0x1f5211[_0x689d('0x1b')]===_0x689d('0x1c');var _0x5830c3=_0x232876[_0x689d('0x1d')];var _0x362366=_0x29d8c0?0x0:_0x1f5211[_0x689d('0x1e')];var _0x141300=_0x29d8c0?_0x232876[_0x689d('0x1d')]:_0x1f5211['offset']+_0x1f5211[_0x689d('0x1b')];var _0x3dc4de;if(_0x141300>=_0x5830c3){_0x141300=_0x5830c3;_0x3dc4de=0xc8;}else{_0x3dc4de=0xce;}_0x45ccfb[_0x689d('0x1a')](_0x3dc4de);return _0x45ccfb[_0x689d('0x1f')](_0x689d('0x20'),_0x362366+'-'+_0x141300+'/'+_0x5830c3)[_0x689d('0x21')](_0x232876);}return null;};}function patchUpdates(_0x36fc4b){return function(_0x1fa788){try{jsonpatch[_0x689d('0x22')](_0x1fa788,_0x36fc4b,!![]);}catch(_0x3f18cf){return BPromise['reject'](_0x3f18cf);}return _0x1fa788['save']();};}function saveUpdates(_0x122105,_0x464101){return function(_0x180da3){if(_0x180da3){return _0x180da3[_0x689d('0x23')](_0x122105)[_0x689d('0x24')](function(_0x3b56f2){return _0x3b56f2;});}return null;};}function removeEntity(_0x3063ec,_0x338a47){return function(_0x5277b9){if(_0x5277b9){return _0x5277b9[_0x689d('0x25')]()[_0x689d('0x24')](function(){_0x3063ec[_0x689d('0x1a')](0xcc)[_0x689d('0x26')]();});}};}function handleEntityNotFound(_0x29bee0,_0x2f58da){return function(_0x1a0418){if(!_0x1a0418){_0x29bee0[_0x689d('0x19')](0x194);}return _0x1a0418;};}function handleError(_0x4126c4,_0x22467a){_0x22467a=_0x22467a||0x1f4;return function(_0x6d9daa){logger['error'](_0x6d9daa[_0x689d('0x27')]);if(_0x6d9daa['name']){delete _0x6d9daa[_0x689d('0x28')];}_0x4126c4['status'](_0x22467a)[_0x689d('0x29')](_0x6d9daa);};}exports[_0x689d('0x2a')]=function(_0x5eff41,_0x345212){var _0x57ecff={},_0x42b092={},_0x944481={'count':0x0,'rows':[]};var _0x5c52b2=_['map'](db[_0x689d('0x2b')][_0x689d('0x2c')],function(_0x21b2c5){return{'name':_0x21b2c5[_0x689d('0x2d')],'type':_0x21b2c5[_0x689d('0x2e')][_0x689d('0x2f')]};});_0x42b092[_0x689d('0x30')]=_[_0x689d('0x31')](_0x5c52b2,_0x689d('0x28'));_0x42b092['query']=_[_0x689d('0x32')](_0x5eff41[_0x689d('0x33')]);_0x42b092['filters']=_[_0x689d('0x34')](_0x42b092[_0x689d('0x30')],_0x42b092[_0x689d('0x33')]);_0x57ecff[_0x689d('0x35')]=_[_0x689d('0x34')](_0x42b092[_0x689d('0x30')],qs['fields'](_0x5eff41[_0x689d('0x33')][_0x689d('0x36')]));_0x57ecff[_0x689d('0x35')]=_0x57ecff[_0x689d('0x35')]['length']?_0x57ecff[_0x689d('0x35')]:_0x42b092[_0x689d('0x30')];if(!_0x5eff41[_0x689d('0x33')][_0x689d('0x37')]('nolimit')){_0x57ecff[_0x689d('0x1b')]=qs[_0x689d('0x1b')](_0x5eff41[_0x689d('0x33')][_0x689d('0x1b')]);_0x57ecff[_0x689d('0x1e')]=qs['offset'](_0x5eff41['query'][_0x689d('0x1e')]);}_0x57ecff[_0x689d('0x38')]=qs[_0x689d('0x39')](_0x5eff41[_0x689d('0x33')][_0x689d('0x39')]);_0x57ecff['where']=qs[_0x689d('0x3a')](_[_0x689d('0x3b')](_0x5eff41[_0x689d('0x33')],_0x42b092[_0x689d('0x3a')]),_0x5c52b2);if(_0x5eff41[_0x689d('0x33')]['filter']){_0x57ecff[_0x689d('0x3c')]=_[_0x689d('0x3d')](_0x57ecff['where'],{'$or':_[_0x689d('0x31')](_0x5c52b2,function(_0xdd1e10){if(_0xdd1e10['type']!==_0x689d('0x3e')){var _0x2ea7d6={};_0x2ea7d6[_0xdd1e10[_0x689d('0x28')]]={'$like':'%'+_0x5eff41[_0x689d('0x33')][_0x689d('0x3f')]+'%'};return _0x2ea7d6;}})});}_0x57ecff=_[_0x689d('0x3d')]({},_0x57ecff,_0x5eff41[_0x689d('0x40')]);var _0x25893e={'where':_0x57ecff[_0x689d('0x3c')]};return db['JscriptySessionReport']['count'](_0x25893e)['then'](function(_0xaf5982){_0x944481[_0x689d('0x1d')]=_0xaf5982;if(_0x5eff41['query']['includeAll']){_0x57ecff[_0x689d('0x41')]=[{'all':!![]}];}return db[_0x689d('0x2b')][_0x689d('0x42')](_0x57ecff);})[_0x689d('0x24')](function(_0x110bd8){_0x944481[_0x689d('0x43')]=_0x110bd8;return _0x944481;})['then'](respondWithFilteredResult(_0x345212,_0x57ecff))[_0x689d('0x44')](handleError(_0x345212,null));};exports[_0x689d('0x45')]=function(_0x957bea,_0x4d027e){var _0x315586={'raw':!![],'where':{'id':_0x957bea[_0x689d('0x46')]['id']}},_0x2dfc42={};_0x2dfc42[_0x689d('0x30')]=_[_0x689d('0x32')](db[_0x689d('0x2b')][_0x689d('0x2c')]);_0x2dfc42[_0x689d('0x33')]=_[_0x689d('0x32')](_0x957bea[_0x689d('0x33')]);_0x2dfc42['filters']=_['intersection'](_0x2dfc42['model'],_0x2dfc42[_0x689d('0x33')]);_0x315586[_0x689d('0x35')]=_[_0x689d('0x34')](_0x2dfc42[_0x689d('0x30')],qs['fields'](_0x957bea[_0x689d('0x33')]['fields']));_0x315586[_0x689d('0x35')]=_0x315586['attributes'][_0x689d('0x47')]?_0x315586[_0x689d('0x35')]:_0x2dfc42[_0x689d('0x30')];if(_0x957bea['query']['includeAll']){_0x315586[_0x689d('0x41')]=[{'all':!![]}];}_0x315586=_[_0x689d('0x3d')]({},_0x315586,_0x957bea['options']);return db[_0x689d('0x2b')][_0x689d('0x48')](_0x315586)[_0x689d('0x24')](handleEntityNotFound(_0x4d027e,null))['then'](respondWithResult(_0x4d027e,null))[_0x689d('0x44')](handleError(_0x4d027e,null));};exports[_0x689d('0x49')]=function(_0x3a64c4,_0x41a833){return db['JscriptySessionReport']['create'](_0x3a64c4['body'],{})[_0x689d('0x24')](respondWithResult(_0x41a833,0xc9))[_0x689d('0x44')](handleError(_0x41a833,null));};exports[_0x689d('0x23')]=function(_0x490b4e,_0x45e77c){if(_0x490b4e['body']['id']){delete _0x490b4e['body']['id'];}return db[_0x689d('0x2b')]['find']({'where':{'id':_0x490b4e['params']['id']}})[_0x689d('0x24')](handleEntityNotFound(_0x45e77c,null))[_0x689d('0x24')](saveUpdates(_0x490b4e[_0x689d('0x4a')],null))[_0x689d('0x24')](respondWithResult(_0x45e77c,null))[_0x689d('0x44')](handleError(_0x45e77c,null));};exports[_0x689d('0x25')]=function(_0x40368a,_0x1749fe){return db['JscriptySessionReport'][_0x689d('0x48')]({'where':{'id':_0x40368a[_0x689d('0x46')]['id']}})[_0x689d('0x24')](handleEntityNotFound(_0x1749fe,null))[_0x689d('0x24')](removeEntity(_0x1749fe,null))['catch'](handleError(_0x1749fe,null));};exports['describe']=function(_0x8d8752,_0x2b0f54){return db[_0x689d('0x2b')][_0x689d('0x4b')]()[_0x689d('0x24')](respondWithResult(_0x2b0f54,null))[_0x689d('0x44')](handleError(_0x2b0f54,null));};exports[_0x689d('0x4c')]=function(_0x3e10cf,_0x5e6e9c,_0x44d79e){var _0x2e657e={'raw':!![],'where':{}};var _0x5771bf={};var _0x3e7f82={'count':0x0,'rows':[]};return db[_0x689d('0x2b')][_0x689d('0x4d')]({'where':{'id':_0x3e10cf['params']['id']}})[_0x689d('0x24')](handleEntityNotFound(_0x5e6e9c,null))[_0x689d('0x24')](function(_0x28662f){if(_0x28662f){_0x5771bf[_0x689d('0x30')]=_[_0x689d('0x32')](db['JscriptyQuestionReport'][_0x689d('0x2c')]);_0x5771bf[_0x689d('0x33')]=_[_0x689d('0x32')](_0x3e10cf[_0x689d('0x33')]);_0x5771bf[_0x689d('0x3a')]=_[_0x689d('0x34')](_0x5771bf['model'],_0x5771bf[_0x689d('0x33')]);_0x2e657e[_0x689d('0x35')]=_[_0x689d('0x34')](_0x5771bf[_0x689d('0x30')],qs[_0x689d('0x36')](_0x3e10cf['query']['fields']));_0x2e657e['attributes']=_0x2e657e[_0x689d('0x35')][_0x689d('0x47')]?_0x2e657e['attributes']:_0x5771bf[_0x689d('0x30')];if(!_0x3e10cf[_0x689d('0x33')]['hasOwnProperty']('nolimit')){_0x2e657e[_0x689d('0x1b')]=qs[_0x689d('0x1b')](_0x3e10cf[_0x689d('0x33')][_0x689d('0x1b')]);_0x2e657e[_0x689d('0x1e')]=qs[_0x689d('0x1e')](_0x3e10cf[_0x689d('0x33')][_0x689d('0x1e')]);}_0x2e657e[_0x689d('0x38')]=qs[_0x689d('0x39')](_0x3e10cf['query'][_0x689d('0x39')]);_0x2e657e[_0x689d('0x3c')]=qs[_0x689d('0x3a')](_[_0x689d('0x3b')](_0x3e10cf[_0x689d('0x33')],_0x5771bf[_0x689d('0x3a')]));_0x2e657e[_0x689d('0x3c')][_0x689d('0x4e')]=_0x28662f['id'];if(_0x3e10cf[_0x689d('0x33')][_0x689d('0x3f')]){_0x2e657e[_0x689d('0x3c')]=_[_0x689d('0x3d')](_0x2e657e['where'],{'$or':_[_0x689d('0x31')](_0x2e657e[_0x689d('0x35')],function(_0x529851){var _0x4e9350={};_0x4e9350[_0x529851]={'$like':'%'+_0x3e10cf['query'][_0x689d('0x3f')]+'%'};return _0x4e9350;})});}_0x2e657e=_[_0x689d('0x3d')]({},_0x2e657e,_0x3e10cf['options']);return db['JscriptyQuestionReport']['count']({'where':_0x2e657e[_0x689d('0x3c')]})[_0x689d('0x24')](function(_0x119d70){_0x3e7f82[_0x689d('0x1d')]=_0x119d70;if(_0x3e10cf[_0x689d('0x33')][_0x689d('0x4f')]){_0x2e657e[_0x689d('0x41')]=[{'all':!![]}];}return db[_0x689d('0x50')][_0x689d('0x42')](_0x2e657e);})[_0x689d('0x24')](function(_0x5c486d){_0x3e7f82[_0x689d('0x43')]=_0x5c486d;return _0x3e7f82;});}})[_0x689d('0x24')](respondWithFilteredResult(_0x5e6e9c,_0x2e657e))[_0x689d('0x44')](handleError(_0x5e6e9c,null));}; \ No newline at end of file +var _0xbca8=['../../config/utils','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','index','map','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','type','options','JscriptySessionReport','then','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','getQuestions','hasOwnProperty','pick','SessionId','JscriptyQuestionReport','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x4cc492,_0x162c85){var _0x1f36b9=function(_0xce4b2){while(--_0xce4b2){_0x4cc492['push'](_0x4cc492['shift']());}};_0x1f36b9(++_0x162c85);}(_0xbca8,0x122));var _0x8bca=function(_0x12b79d,_0x14a4dd){_0x12b79d=_0x12b79d-0x0;var _0x469b87=_0xbca8[_0x12b79d];return _0x469b87;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8bca('0x0'));var zipdir=require(_0x8bca('0x1'));var jsonpatch=require(_0x8bca('0x2'));var rp=require(_0x8bca('0x3'));var moment=require(_0x8bca('0x4'));var BPromise=require(_0x8bca('0x5'));var Mustache=require(_0x8bca('0x6'));var util=require(_0x8bca('0x7'));var path=require(_0x8bca('0x8'));var sox=require(_0x8bca('0x9'));var csv=require(_0x8bca('0xa'));var ejs=require(_0x8bca('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8bca('0xc'));var squel=require(_0x8bca('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8bca('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8bca('0xf'));var Papa=require(_0x8bca('0x10'));var Redis=require('ioredis');var authService=require(_0x8bca('0x11'));var qs=require(_0x8bca('0x12'));var as=require(_0x8bca('0x13'));var hardwareService=require(_0x8bca('0x14'));var logger=require('../../config/logger')(_0x8bca('0x15'));var utils=require(_0x8bca('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8bca('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x434f3,_0x38e756){_0x38e756=_0x38e756||0xcc;return function(_0x431753){if(_0x431753){return _0x434f3[_0x8bca('0x18')](_0x38e756);}return _0x434f3[_0x8bca('0x19')](_0x38e756)['end']();};}function respondWithResult(_0x514712,_0xf16bb0){_0xf16bb0=_0xf16bb0||0xc8;return function(_0x3d9e0c){if(_0x3d9e0c){return _0x514712[_0x8bca('0x19')](_0xf16bb0)['json'](_0x3d9e0c);}};}function respondWithFilteredResult(_0x531fe0,_0xc9ac4e){return function(_0x1065f7){if(_0x1065f7){var _0x4a3112=typeof _0xc9ac4e[_0x8bca('0x1a')]===_0x8bca('0x1b')&&typeof _0xc9ac4e[_0x8bca('0x1c')]===_0x8bca('0x1b');var _0x4cbec7=_0x1065f7[_0x8bca('0x1d')];var _0x564337=_0x4a3112?0x0:_0xc9ac4e[_0x8bca('0x1a')];var _0x2eba4c=_0x4a3112?_0x1065f7[_0x8bca('0x1d')]:_0xc9ac4e['offset']+_0xc9ac4e[_0x8bca('0x1c')];var _0x2ed3f2;if(_0x2eba4c>=_0x4cbec7){_0x2eba4c=_0x4cbec7;_0x2ed3f2=0xc8;}else{_0x2ed3f2=0xce;}_0x531fe0['status'](_0x2ed3f2);return _0x531fe0[_0x8bca('0x1e')](_0x8bca('0x1f'),_0x564337+'-'+_0x2eba4c+'/'+_0x4cbec7)['json'](_0x1065f7);}return null;};}function patchUpdates(_0x2bdc67){return function(_0x43cfd8){try{jsonpatch[_0x8bca('0x20')](_0x43cfd8,_0x2bdc67,!![]);}catch(_0x1d05b7){return BPromise[_0x8bca('0x21')](_0x1d05b7);}return _0x43cfd8[_0x8bca('0x22')]();};}function saveUpdates(_0x4836f8,_0x4270e8){return function(_0x1e53a3){if(_0x1e53a3){return _0x1e53a3[_0x8bca('0x23')](_0x4836f8)['then'](function(_0x543c37){return _0x543c37;});}return null;};}function removeEntity(_0x4d5b67,_0x5ea0c2){return function(_0xcaad5b){if(_0xcaad5b){return _0xcaad5b[_0x8bca('0x24')]()['then'](function(){_0x4d5b67[_0x8bca('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x554135,_0x25df58){return function(_0x55d4f5){if(!_0x55d4f5){_0x554135[_0x8bca('0x18')](0x194);}return _0x55d4f5;};}function handleError(_0x493ad5,_0xf65f9b){_0xf65f9b=_0xf65f9b||0x1f4;return function(_0xb04232){logger[_0x8bca('0x25')](_0xb04232[_0x8bca('0x26')]);if(_0xb04232[_0x8bca('0x27')]){delete _0xb04232['name'];}_0x493ad5[_0x8bca('0x19')](_0xf65f9b)['send'](_0xb04232);};}exports[_0x8bca('0x28')]=function(_0x20f9fd,_0x228feb){var _0x51524f={},_0x9f16be={},_0x4326d6={'count':0x0,'rows':[]};var _0x104311=_[_0x8bca('0x29')](db['JscriptySessionReport'][_0x8bca('0x2a')],function(_0x4d6592){return{'name':_0x4d6592['fieldName'],'type':_0x4d6592['type'][_0x8bca('0x2b')]};});_0x9f16be[_0x8bca('0x2c')]=_['map'](_0x104311,_0x8bca('0x27'));_0x9f16be['query']=_['keys'](_0x20f9fd[_0x8bca('0x2d')]);_0x9f16be[_0x8bca('0x2e')]=_[_0x8bca('0x2f')](_0x9f16be[_0x8bca('0x2c')],_0x9f16be[_0x8bca('0x2d')]);_0x51524f[_0x8bca('0x30')]=_[_0x8bca('0x2f')](_0x9f16be[_0x8bca('0x2c')],qs[_0x8bca('0x31')](_0x20f9fd[_0x8bca('0x2d')][_0x8bca('0x31')]));_0x51524f['attributes']=_0x51524f[_0x8bca('0x30')][_0x8bca('0x32')]?_0x51524f[_0x8bca('0x30')]:_0x9f16be[_0x8bca('0x2c')];if(!_0x20f9fd['query']['hasOwnProperty'](_0x8bca('0x33'))){_0x51524f[_0x8bca('0x1c')]=qs['limit'](_0x20f9fd['query'][_0x8bca('0x1c')]);_0x51524f[_0x8bca('0x1a')]=qs[_0x8bca('0x1a')](_0x20f9fd[_0x8bca('0x2d')][_0x8bca('0x1a')]);}_0x51524f[_0x8bca('0x34')]=qs[_0x8bca('0x35')](_0x20f9fd[_0x8bca('0x2d')][_0x8bca('0x35')]);_0x51524f['where']=qs[_0x8bca('0x2e')](_['pick'](_0x20f9fd[_0x8bca('0x2d')],_0x9f16be['filters']),_0x104311);if(_0x20f9fd[_0x8bca('0x2d')][_0x8bca('0x36')]){_0x51524f[_0x8bca('0x37')]=_[_0x8bca('0x38')](_0x51524f[_0x8bca('0x37')],{'$or':_[_0x8bca('0x29')](_0x104311,function(_0x28e8cb){if(_0x28e8cb[_0x8bca('0x39')]!=='VIRTUAL'){var _0x112612={};_0x112612[_0x28e8cb[_0x8bca('0x27')]]={'$like':'%'+_0x20f9fd[_0x8bca('0x2d')][_0x8bca('0x36')]+'%'};return _0x112612;}})});}_0x51524f=_[_0x8bca('0x38')]({},_0x51524f,_0x20f9fd[_0x8bca('0x3a')]);var _0x3fb441={'where':_0x51524f[_0x8bca('0x37')]};return db[_0x8bca('0x3b')][_0x8bca('0x1d')](_0x3fb441)[_0x8bca('0x3c')](function(_0x251d63){_0x4326d6['count']=_0x251d63;if(_0x20f9fd[_0x8bca('0x2d')][_0x8bca('0x3d')]){_0x51524f[_0x8bca('0x3e')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x8bca('0x3f')](_0x51524f);})[_0x8bca('0x3c')](function(_0x5c32f0){_0x4326d6[_0x8bca('0x40')]=_0x5c32f0;return _0x4326d6;})[_0x8bca('0x3c')](respondWithFilteredResult(_0x228feb,_0x51524f))[_0x8bca('0x41')](handleError(_0x228feb,null));};exports[_0x8bca('0x42')]=function(_0x23b292,_0x1373dd){var _0x594a96={'raw':!![],'where':{'id':_0x23b292[_0x8bca('0x43')]['id']}},_0x1a7527={};_0x1a7527[_0x8bca('0x2c')]=_[_0x8bca('0x44')](db[_0x8bca('0x3b')][_0x8bca('0x2a')]);_0x1a7527[_0x8bca('0x2d')]=_[_0x8bca('0x44')](_0x23b292[_0x8bca('0x2d')]);_0x1a7527[_0x8bca('0x2e')]=_[_0x8bca('0x2f')](_0x1a7527[_0x8bca('0x2c')],_0x1a7527[_0x8bca('0x2d')]);_0x594a96[_0x8bca('0x30')]=_['intersection'](_0x1a7527[_0x8bca('0x2c')],qs[_0x8bca('0x31')](_0x23b292[_0x8bca('0x2d')][_0x8bca('0x31')]));_0x594a96[_0x8bca('0x30')]=_0x594a96[_0x8bca('0x30')][_0x8bca('0x32')]?_0x594a96[_0x8bca('0x30')]:_0x1a7527[_0x8bca('0x2c')];if(_0x23b292[_0x8bca('0x2d')][_0x8bca('0x3d')]){_0x594a96[_0x8bca('0x3e')]=[{'all':!![]}];}_0x594a96=_[_0x8bca('0x38')]({},_0x594a96,_0x23b292[_0x8bca('0x3a')]);return db[_0x8bca('0x3b')][_0x8bca('0x45')](_0x594a96)['then'](handleEntityNotFound(_0x1373dd,null))['then'](respondWithResult(_0x1373dd,null))[_0x8bca('0x41')](handleError(_0x1373dd,null));};exports[_0x8bca('0x46')]=function(_0x31232b,_0x23124c){return db[_0x8bca('0x3b')][_0x8bca('0x46')](_0x31232b[_0x8bca('0x47')],{})[_0x8bca('0x3c')](respondWithResult(_0x23124c,0xc9))[_0x8bca('0x41')](handleError(_0x23124c,null));};exports[_0x8bca('0x23')]=function(_0x313866,_0x55f9bb){if(_0x313866['body']['id']){delete _0x313866['body']['id'];}return db[_0x8bca('0x3b')][_0x8bca('0x45')]({'where':{'id':_0x313866[_0x8bca('0x43')]['id']}})[_0x8bca('0x3c')](handleEntityNotFound(_0x55f9bb,null))['then'](saveUpdates(_0x313866[_0x8bca('0x47')],null))[_0x8bca('0x3c')](respondWithResult(_0x55f9bb,null))[_0x8bca('0x41')](handleError(_0x55f9bb,null));};exports[_0x8bca('0x24')]=function(_0x5b47a7,_0x31abaa){return db[_0x8bca('0x3b')]['find']({'where':{'id':_0x5b47a7[_0x8bca('0x43')]['id']}})[_0x8bca('0x3c')](handleEntityNotFound(_0x31abaa,null))[_0x8bca('0x3c')](removeEntity(_0x31abaa,null))['catch'](handleError(_0x31abaa,null));};exports[_0x8bca('0x48')]=function(_0x44a892,_0x520c27){return db[_0x8bca('0x3b')]['describe']()[_0x8bca('0x3c')](respondWithResult(_0x520c27,null))['catch'](handleError(_0x520c27,null));};exports[_0x8bca('0x49')]=function(_0x4174af,_0x4f01c6,_0x472467){var _0x1a7832={'raw':!![],'where':{}};var _0x1f6481={};var _0x1045f9={'count':0x0,'rows':[]};return db[_0x8bca('0x3b')]['findOne']({'where':{'id':_0x4174af[_0x8bca('0x43')]['id']}})[_0x8bca('0x3c')](handleEntityNotFound(_0x4f01c6,null))[_0x8bca('0x3c')](function(_0x30f670){if(_0x30f670){_0x1f6481[_0x8bca('0x2c')]=_['keys'](db['JscriptyQuestionReport'][_0x8bca('0x2a')]);_0x1f6481[_0x8bca('0x2d')]=_['keys'](_0x4174af[_0x8bca('0x2d')]);_0x1f6481['filters']=_['intersection'](_0x1f6481[_0x8bca('0x2c')],_0x1f6481[_0x8bca('0x2d')]);_0x1a7832[_0x8bca('0x30')]=_[_0x8bca('0x2f')](_0x1f6481[_0x8bca('0x2c')],qs[_0x8bca('0x31')](_0x4174af['query']['fields']));_0x1a7832['attributes']=_0x1a7832[_0x8bca('0x30')][_0x8bca('0x32')]?_0x1a7832[_0x8bca('0x30')]:_0x1f6481['model'];if(!_0x4174af[_0x8bca('0x2d')][_0x8bca('0x4a')](_0x8bca('0x33'))){_0x1a7832[_0x8bca('0x1c')]=qs[_0x8bca('0x1c')](_0x4174af[_0x8bca('0x2d')][_0x8bca('0x1c')]);_0x1a7832[_0x8bca('0x1a')]=qs[_0x8bca('0x1a')](_0x4174af[_0x8bca('0x2d')][_0x8bca('0x1a')]);}_0x1a7832[_0x8bca('0x34')]=qs['sort'](_0x4174af[_0x8bca('0x2d')]['sort']);_0x1a7832['where']=qs[_0x8bca('0x2e')](_[_0x8bca('0x4b')](_0x4174af[_0x8bca('0x2d')],_0x1f6481[_0x8bca('0x2e')]));_0x1a7832['where'][_0x8bca('0x4c')]=_0x30f670['id'];if(_0x4174af[_0x8bca('0x2d')][_0x8bca('0x36')]){_0x1a7832[_0x8bca('0x37')]=_['merge'](_0x1a7832[_0x8bca('0x37')],{'$or':_[_0x8bca('0x29')](_0x1a7832[_0x8bca('0x30')],function(_0x533922){var _0x32f19c={};_0x32f19c[_0x533922]={'$like':'%'+_0x4174af['query'][_0x8bca('0x36')]+'%'};return _0x32f19c;})});}_0x1a7832=_[_0x8bca('0x38')]({},_0x1a7832,_0x4174af[_0x8bca('0x3a')]);return db['JscriptyQuestionReport'][_0x8bca('0x1d')]({'where':_0x1a7832['where']})['then'](function(_0x30e0a1){_0x1045f9[_0x8bca('0x1d')]=_0x30e0a1;if(_0x4174af['query']['includeAll']){_0x1a7832[_0x8bca('0x3e')]=[{'all':!![]}];}return db[_0x8bca('0x4d')][_0x8bca('0x3f')](_0x1a7832);})[_0x8bca('0x3c')](function(_0x3e959c){_0x1045f9['rows']=_0x3e959c;return _0x1045f9;});}})['then'](respondWithFilteredResult(_0x4f01c6,_0x1a7832))[_0x8bca('0x41')](handleError(_0x4f01c6,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 54e3bdd..6b07206 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 _0x2eb2=['moment','bluebird','request-promise','rimraf','exports','define','JscriptySessionReport','report_jscripty_sessions','util','../../config/logger','api'];(function(_0xf89304,_0x5b65a7){var _0x50298f=function(_0x1b95c6){while(--_0x1b95c6){_0xf89304['push'](_0xf89304['shift']());}};_0x50298f(++_0x5b65a7);}(_0x2eb2,0x19f));var _0x22eb=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x2eb2[_0x110c3d];return _0x226d67;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var logger=require(_0x22eb('0x1'))(_0x22eb('0x2'));var moment=require(_0x22eb('0x3'));var BPromise=require(_0x22eb('0x4'));var rp=require(_0x22eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22eb('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x22eb('0x7')]=function(_0x10e116,_0x35dd5b){return _0x10e116[_0x22eb('0x8')](_0x22eb('0x9'),attributes,{'tableName':_0x22eb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda19=['exports','define','JscriptySessionReport','report_jscripty_sessions','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes'];(function(_0x523aa8,_0x1b8aa1){var _0xb8aef0=function(_0x37bec6){while(--_0x37bec6){_0x523aa8['push'](_0x523aa8['shift']());}};_0xb8aef0(++_0x1b8aa1);}(_0xda19,0xd5));var _0x9da1=function(_0x32b4cf,_0x93dbfe){_0x32b4cf=_0x32b4cf-0x0;var _0x404cec=_0xda19[_0x32b4cf];return _0x404cec;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var logger=require(_0x9da1('0x1'))('api');var moment=require(_0x9da1('0x2'));var BPromise=require('bluebird');var rp=require(_0x9da1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9da1('0x4'));var config=require(_0x9da1('0x5'));var attributes=require(_0x9da1('0x6'));module[_0x9da1('0x7')]=function(_0x156faf,_0x2dcbc6){return _0x156faf[_0x9da1('0x8')](_0x9da1('0x9'),attributes,{'tableName':_0x9da1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 6daa8e5..97f64aa 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 _0x896e=['JscriptySessionReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x48f1db,_0x554c57){var _0x27de48=function(_0x3cd347){while(--_0x3cd347){_0x48f1db['push'](_0x48f1db['shift']());}};_0x27de48(++_0x554c57);}(_0x896e,0x1e9));var _0xe896=function(_0xd6382e,_0x3823fe){_0xd6382e=_0xd6382e-0x0;var _0x361f37=_0x896e[_0xd6382e];return _0x361f37;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7a0721,_0x3b902c,_0x264eeb){return new BPromise(function(_0x43c619,_0x5a1909){return client[_0xe896('0xd')](_0x7a0721,_0x264eeb)[_0xe896('0xe')](function(_0x37a90d){logger['info'](_0xe896('0xf'),_0x3b902c,'request\x20sent');logger[_0xe896('0x10')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x3b902c,_0xe896('0x11'),JSON[_0xe896('0x12')](_0x37a90d));if(_0x37a90d[_0xe896('0x13')]){if(_0x37a90d['error'][_0xe896('0x14')]===0x1f4){logger[_0xe896('0x13')](_0xe896('0xf'),_0x3b902c,_0x37a90d['error'][_0xe896('0x15')]);return _0x5a1909(_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);}logger['error'](_0xe896('0xf'),_0x3b902c,_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);return _0x43c619(_0x37a90d['error']['message']);}else{logger[_0xe896('0x16')](_0xe896('0xf'),_0x3b902c,'request\x20sent');_0x43c619(_0x37a90d['result'][_0xe896('0x15')]);}})[_0xe896('0x17')](function(_0x57f04b){logger[_0xe896('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x3b902c,_0x57f04b);_0x5a1909(_0x57f04b);});});} \ No newline at end of file +var _0x3e24=['info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x15cae3,_0x458cb9){var _0x20596f=function(_0x1ad3e6){while(--_0x1ad3e6){_0x15cae3['push'](_0x15cae3['shift']());}};_0x20596f(++_0x458cb9);}(_0x3e24,0x167));var _0x43e2=function(_0x20ee5a,_0x409903){_0x20ee5a=_0x20ee5a-0x0;var _0x4573bf=_0x3e24[_0x20ee5a];return _0x4573bf;};'use strict';var _=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var moment=require(_0x43e2('0x2'));var BPromise=require(_0x43e2('0x3'));var rs=require(_0x43e2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43e2('0x5'))['db'];var utils=require(_0x43e2('0x6'));var logger=require('../../config/logger')(_0x43e2('0x7'));var config=require(_0x43e2('0x8'));var jayson=require(_0x43e2('0x9'));var client=jayson[_0x43e2('0xa')][_0x43e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x121e2e,_0x23b2d8,_0x59956d){return new BPromise(function(_0xb75b,_0x2357bc){return client['request'](_0x121e2e,_0x59956d)[_0x43e2('0xc')](function(_0x2fdf85){logger['info'](_0x43e2('0xd'),_0x23b2d8,_0x43e2('0xe'));logger['debug'](_0x43e2('0xf'),_0x23b2d8,'request\x20sent',JSON['stringify'](_0x2fdf85));if(_0x2fdf85['error']){if(_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x11')]===0x1f4){logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);return _0x2357bc(_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);}logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);return _0xb75b(_0x2fdf85['error'][_0x43e2('0x12')]);}else{logger[_0x43e2('0x13')](_0x43e2('0xd'),_0x23b2d8,_0x43e2('0xe'));_0xb75b(_0x2fdf85['result']['message']);}})[_0x43e2('0x14')](function(_0x417ce5){logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x417ce5);_0x2357bc(_0x417ce5);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index b91da36..cac9846 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 _0xd7d6=['/:id','isAuthenticated','update','downloadLogFile','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./license.controller','get'];(function(_0x3b0e74,_0x295ca1){var _0x2ebdc1=function(_0x4cd489){while(--_0x4cd489){_0x3b0e74['push'](_0x3b0e74['shift']());}};_0x2ebdc1(++_0x295ca1);}(_0xd7d6,0x83));var _0x6d7d=function(_0x20aadb,_0x5a607a){_0x20aadb=_0x20aadb-0x0;var _0x520018=_0xd7d6[_0x20aadb];return _0x520018;};'use strict';var multer=require('multer');var util=require(_0x6d7d('0x0'));var path=require(_0x6d7d('0x1'));var timeout=require(_0x6d7d('0x2'));var express=require(_0x6d7d('0x3'));var router=express[_0x6d7d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6d7d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6d7d('0x6'));var controller=require(_0x6d7d('0x7'));router[_0x6d7d('0x8')]('/',controller['index']);router['put'](_0x6d7d('0x9'),auth[_0x6d7d('0xa')](),controller[_0x6d7d('0xb')]);router[_0x6d7d('0x8')]('/download_log_file',auth[_0x6d7d('0xa')](),controller[_0x6d7d('0xc')]);module[_0x6d7d('0xd')]=router; \ No newline at end of file +var _0x3458=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','put','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','exports','multer','util','connect-timeout'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x3458,0x1b7));var _0x8345=function(_0x276ae3,_0x2cbbb8){_0x276ae3=_0x276ae3-0x0;var _0x1e7b5b=_0x3458[_0x276ae3];return _0x1e7b5b;};'use strict';var multer=require(_0x8345('0x0'));var util=require(_0x8345('0x1'));var path=require('path');var timeout=require(_0x8345('0x2'));var express=require('express');var router=express[_0x8345('0x3')]();var fs_extra=require(_0x8345('0x4'));var auth=require(_0x8345('0x5'));var interaction=require(_0x8345('0x6'));var config=require(_0x8345('0x7'));var controller=require(_0x8345('0x8'));router[_0x8345('0x9')]('/',controller['index']);router[_0x8345('0xa')](_0x8345('0xb'),auth[_0x8345('0xc')](),controller[_0x8345('0xd')]);router[_0x8345('0x9')](_0x8345('0xe'),auth['isAuthenticated'](),controller[_0x8345('0xf')]);module[_0x8345('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 9f59dbf..ec0eaaa 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 _0xb041=['sequelize','exports','TEXT','STRING','INTEGER'];(function(_0x1c1b4d,_0x1dc649){var _0x1bbe55=function(_0x2f617a){while(--_0x2f617a){_0x1c1b4d['push'](_0x1c1b4d['shift']());}};_0x1bbe55(++_0x1dc649);}(_0xb041,0xe6));var _0x1b04=function(_0x43778d,_0x5f37a9){_0x43778d=_0x43778d-0x0;var _0x49312a=_0xb041[_0x43778d];return _0x49312a;};'use strict';var Sequelize=require(_0x1b04('0x0'));module[_0x1b04('0x1')]={'license':{'type':Sequelize[_0x1b04('0x2')]},'data1':{'type':Sequelize[_0x1b04('0x3')]},'data2':{'type':Sequelize[_0x1b04('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x1b04('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6e6f=['sequelize','exports','TEXT','STRING','INTEGER'];(function(_0x5b94c5,_0x396323){var _0x1d9efd=function(_0x4796ca){while(--_0x4796ca){_0x5b94c5['push'](_0x5b94c5['shift']());}};_0x1d9efd(++_0x396323);}(_0x6e6f,0x11d));var _0xf6e6=function(_0x188edb,_0x19fed6){_0x188edb=_0x188edb-0x0;var _0x669a3d=_0x6e6f[_0x188edb];return _0x669a3d;};'use strict';var Sequelize=require(_0xf6e6('0x0'));module[_0xf6e6('0x1')]={'license':{'type':Sequelize[_0xf6e6('0x2')]},'data1':{'type':Sequelize[_0xf6e6('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0xf6e6('0x4')],'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 8162669..0cd7908 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 _0x6ab2=['params','get','key','demo','catch','join','/var','log','xcally','setHeader','attachment;\x20filename=','Content-Type','text/plain','eml-format','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','error','stack','name','model','keys','License','rawAttributes','query','intersection','attributes','length','getLicense','body','find'];(function(_0x4dc935,_0x205fa6){var _0x518b0e=function(_0x47572b){while(--_0x47572b){_0x4dc935['push'](_0x4dc935['shift']());}};_0x518b0e(++_0x205fa6);}(_0x6ab2,0x193));var _0x26ab=function(_0x5d923b,_0x3b7834){_0x5d923b=_0x5d923b-0x0;var _0x50ff88=_0x6ab2[_0x5d923b];return _0x50ff88;};'use strict';var emlformat=require(_0x26ab('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x26ab('0x1'));var rp=require('request-promise');var moment=require(_0x26ab('0x2'));var BPromise=require(_0x26ab('0x3'));var Mustache=require('mustache');var util=require(_0x26ab('0x4'));var path=require(_0x26ab('0x5'));var sox=require(_0x26ab('0x6'));var csv=require('to-csv');var ejs=require(_0x26ab('0x7'));var fs=require('fs');var fs_extra=require(_0x26ab('0x8'));var _=require(_0x26ab('0x9'));var squel=require('squel');var crypto=require(_0x26ab('0xa'));var jsforce=require(_0x26ab('0xb'));var deskjs=require(_0x26ab('0xc'));var toCsv=require(_0x26ab('0xd'));var querystring=require(_0x26ab('0xe'));var Papa=require(_0x26ab('0xf'));var Redis=require(_0x26ab('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x26ab('0x11'));var as=require(_0x26ab('0x12'));var hardwareService=require(_0x26ab('0x13'));var logger=require(_0x26ab('0x14'))(_0x26ab('0x15'));var utils=require(_0x26ab('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x26ab('0x17'));var db=require(_0x26ab('0x18'))['db'];function respondWithStatusCode(_0xe56f5c,_0x2714d2){_0x2714d2=_0x2714d2||0xcc;return function(_0x235c24){if(_0x235c24){return _0xe56f5c[_0x26ab('0x19')](_0x2714d2);}return _0xe56f5c[_0x26ab('0x1a')](_0x2714d2)[_0x26ab('0x1b')]();};}function respondWithResult(_0x50daf3,_0x5399f5){_0x5399f5=_0x5399f5||0xc8;return function(_0x18a0b4){if(_0x18a0b4){return _0x50daf3[_0x26ab('0x1a')](_0x5399f5)[_0x26ab('0x1c')](_0x18a0b4);}};}function respondWithFilteredResult(_0x3055ae,_0x26774c){return function(_0x445be5){if(_0x445be5){var _0x4fcc87=typeof _0x26774c['offset']===_0x26ab('0x1d')&&typeof _0x26774c[_0x26ab('0x1e')]==='undefined';var _0x180e21=_0x445be5[_0x26ab('0x1f')];var _0x31e868=_0x4fcc87?0x0:_0x26774c['offset'];var _0x4fe8ea=_0x4fcc87?_0x445be5['count']:_0x26774c[_0x26ab('0x20')]+_0x26774c[_0x26ab('0x1e')];var _0x5663b4;if(_0x4fe8ea>=_0x180e21){_0x4fe8ea=_0x180e21;_0x5663b4=0xc8;}else{_0x5663b4=0xce;}_0x3055ae[_0x26ab('0x1a')](_0x5663b4);return _0x3055ae[_0x26ab('0x21')](_0x26ab('0x22'),_0x31e868+'-'+_0x4fe8ea+'/'+_0x180e21)['json'](_0x445be5);}return null;};}function patchUpdates(_0x68e065){return function(_0x2250bf){try{jsonpatch[_0x26ab('0x23')](_0x2250bf,_0x68e065,!![]);}catch(_0x2bb33e){return BPromise['reject'](_0x2bb33e);}return _0x2250bf['save']();};}function saveUpdates(_0x2197cd,_0x259f55){return function(_0x5ab8b2){if(_0x5ab8b2){return _0x5ab8b2[_0x26ab('0x24')](_0x2197cd)[_0x26ab('0x25')](function(_0x4c4a3c){return _0x4c4a3c;});}return null;};}function removeEntity(_0x5f0b93,_0x1254d4){return function(_0x11a549){if(_0x11a549){return _0x11a549['destroy']()[_0x26ab('0x25')](function(){_0x5f0b93[_0x26ab('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x100d7d,_0x400d86){return function(_0x977b53){if(!_0x977b53){_0x100d7d[_0x26ab('0x19')](0x194);}return _0x977b53;};}function handleError(_0x25d217,_0x59114b){_0x59114b=_0x59114b||0x1f4;return function(_0x3765d9){logger[_0x26ab('0x26')](_0x3765d9[_0x26ab('0x27')]);if(_0x3765d9[_0x26ab('0x28')]){delete _0x3765d9['name'];}_0x25d217[_0x26ab('0x1a')](_0x59114b)['send'](_0x3765d9);};}var utilLicense=require(_0x26ab('0x17'));exports['index']=function(_0x530944,_0x4ad777){var _0x433c79={'raw':!![],'where':{'id':0x1}},_0x802cee={};_0x802cee[_0x26ab('0x29')]=_[_0x26ab('0x2a')](db[_0x26ab('0x2b')][_0x26ab('0x2c')]);_0x802cee[_0x26ab('0x2d')]=_[_0x26ab('0x2a')](_0x530944['query']);_0x802cee['filters']=_[_0x26ab('0x2e')](_0x802cee[_0x26ab('0x29')],_0x802cee[_0x26ab('0x2d')]);_0x433c79[_0x26ab('0x2f')]=_['intersection'](_0x802cee['model'],qs['fields'](_0x530944[_0x26ab('0x2d')]['fields']));_0x433c79[_0x26ab('0x2f')]=_0x433c79[_0x26ab('0x2f')][_0x26ab('0x30')]?_0x433c79[_0x26ab('0x2f')]:_0x802cee[_0x26ab('0x29')];_0x433c79=_['merge']({},_0x433c79,_0x530944['options']);return utilLicense[_0x26ab('0x31')](_0x433c79)[_0x26ab('0x25')](respondWithResult(_0x4ad777,null))['catch'](handleError(_0x4ad777,null));};exports[_0x26ab('0x24')]=function(_0x271d58,_0x29ee53){if(_0x271d58['body']['id']){delete _0x271d58[_0x26ab('0x32')]['id'];}return db[_0x26ab('0x2b')][_0x26ab('0x33')]({'where':{'id':_0x271d58[_0x26ab('0x34')]['id']}})[_0x26ab('0x25')](handleEntityNotFound(_0x29ee53,null))['then'](function(_0xf51732){var _0x10f62a=_0xf51732[_0x26ab('0x35')]({'plain':!![]});return utilLicense['checkLicense'](_0x10f62a,_0x271d58[_0x26ab('0x32')][_0x26ab('0x36')]);})[_0x26ab('0x25')](function(_0x22e1fd){if(!_0x22e1fd[_0x26ab('0x37')]){return saveUpdates(_0x271d58[_0x26ab('0x32')],null);}return _0x22e1fd;})[_0x26ab('0x25')](respondWithResult(_0x29ee53,null))[_0x26ab('0x38')](handleError(_0x29ee53,null));};exports['downloadLogFile']=function(_0x534ef3,_0x8b94a8){var _0x4aba0a='license-info.log';var _0x46474c=path[_0x26ab('0x39')](_0x26ab('0x3a'),_0x26ab('0x3b'),_0x26ab('0x3c'),_0x4aba0a);_0x8b94a8[_0x26ab('0x3d')]('Content-disposition',_0x26ab('0x3e')+_0x4aba0a);_0x8b94a8['set'](_0x26ab('0x3f'),_0x26ab('0x40'));_0x8b94a8['download'](_0x46474c);}; \ No newline at end of file +var _0xa1d6=['request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','save','update','then','name','send','index','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','merge','getLicense','body','find','params','get','checkLicense','key','demo','catch','downloadLogFile','license-info.log','join','/var','log','setHeader','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir'];(function(_0x2e7aa6,_0x53491c){var _0x3c277d=function(_0x282332){while(--_0x282332){_0x2e7aa6['push'](_0x2e7aa6['shift']());}};_0x3c277d(++_0x53491c);}(_0xa1d6,0xcc));var _0x6a1d=function(_0x4588e3,_0x323256){_0x4588e3=_0x4588e3-0x0;var _0x241516=_0xa1d6[_0x4588e3];return _0x241516;};'use strict';var emlformat=require(_0x6a1d('0x0'));var rimraf=require(_0x6a1d('0x1'));var zipdir=require(_0x6a1d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a1d('0x3'));var moment=require(_0x6a1d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6a1d('0x5'));var util=require(_0x6a1d('0x6'));var path=require(_0x6a1d('0x7'));var sox=require('sox');var csv=require(_0x6a1d('0x8'));var ejs=require(_0x6a1d('0x9'));var fs=require('fs');var fs_extra=require(_0x6a1d('0xa'));var _=require(_0x6a1d('0xb'));var squel=require(_0x6a1d('0xc'));var crypto=require(_0x6a1d('0xd'));var jsforce=require(_0x6a1d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6a1d('0x8'));var querystring=require('querystring');var Papa=require(_0x6a1d('0xf'));var Redis=require(_0x6a1d('0x10'));var authService=require(_0x6a1d('0x11'));var qs=require(_0x6a1d('0x12'));var as=require(_0x6a1d('0x13'));var hardwareService=require(_0x6a1d('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x6a1d('0x15'));var config=require(_0x6a1d('0x16'));var licenseUtil=require(_0x6a1d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf0590f,_0x4cd47d){_0x4cd47d=_0x4cd47d||0xcc;return function(_0x217468){if(_0x217468){return _0xf0590f[_0x6a1d('0x18')](_0x4cd47d);}return _0xf0590f['status'](_0x4cd47d)[_0x6a1d('0x19')]();};}function respondWithResult(_0x38ddea,_0x5e6d53){_0x5e6d53=_0x5e6d53||0xc8;return function(_0x13b152){if(_0x13b152){return _0x38ddea['status'](_0x5e6d53)[_0x6a1d('0x1a')](_0x13b152);}};}function respondWithFilteredResult(_0x47a278,_0x25aba6){return function(_0xb45e07){if(_0xb45e07){var _0x500e06=typeof _0x25aba6[_0x6a1d('0x1b')]===_0x6a1d('0x1c')&&typeof _0x25aba6[_0x6a1d('0x1d')]===_0x6a1d('0x1c');var _0x42f0bc=_0xb45e07[_0x6a1d('0x1e')];var _0x2a16ce=_0x500e06?0x0:_0x25aba6[_0x6a1d('0x1b')];var _0xe5b024=_0x500e06?_0xb45e07['count']:_0x25aba6['offset']+_0x25aba6[_0x6a1d('0x1d')];var _0x1bffea;if(_0xe5b024>=_0x42f0bc){_0xe5b024=_0x42f0bc;_0x1bffea=0xc8;}else{_0x1bffea=0xce;}_0x47a278[_0x6a1d('0x1f')](_0x1bffea);return _0x47a278[_0x6a1d('0x20')](_0x6a1d('0x21'),_0x2a16ce+'-'+_0xe5b024+'/'+_0x42f0bc)[_0x6a1d('0x1a')](_0xb45e07);}return null;};}function patchUpdates(_0x171298){return function(_0x2d00a7){try{jsonpatch['apply'](_0x2d00a7,_0x171298,!![]);}catch(_0x5c8fc0){return BPromise['reject'](_0x5c8fc0);}return _0x2d00a7[_0x6a1d('0x22')]();};}function saveUpdates(_0x42d877,_0x329db7){return function(_0xd263bd){if(_0xd263bd){return _0xd263bd[_0x6a1d('0x23')](_0x42d877)[_0x6a1d('0x24')](function(_0x34c7a9){return _0x34c7a9;});}return null;};}function removeEntity(_0x16100a,_0x27974f){return function(_0x584c95){if(_0x584c95){return _0x584c95['destroy']()[_0x6a1d('0x24')](function(){_0x16100a['status'](0xcc)[_0x6a1d('0x19')]();});}};}function handleEntityNotFound(_0x4c4442,_0x31a863){return function(_0x7327f7){if(!_0x7327f7){_0x4c4442[_0x6a1d('0x18')](0x194);}return _0x7327f7;};}function handleError(_0x14d573,_0x18b443){_0x18b443=_0x18b443||0x1f4;return function(_0x37ac64){logger['error'](_0x37ac64['stack']);if(_0x37ac64[_0x6a1d('0x25')]){delete _0x37ac64[_0x6a1d('0x25')];}_0x14d573['status'](_0x18b443)[_0x6a1d('0x26')](_0x37ac64);};}var utilLicense=require(_0x6a1d('0x17'));exports[_0x6a1d('0x27')]=function(_0x24e7e9,_0x4e7233){var _0xca69f8={'raw':!![],'where':{'id':0x1}},_0x1b25c1={};_0x1b25c1[_0x6a1d('0x28')]=_[_0x6a1d('0x29')](db['License'][_0x6a1d('0x2a')]);_0x1b25c1['query']=_['keys'](_0x24e7e9[_0x6a1d('0x2b')]);_0x1b25c1[_0x6a1d('0x2c')]=_[_0x6a1d('0x2d')](_0x1b25c1[_0x6a1d('0x28')],_0x1b25c1['query']);_0xca69f8['attributes']=_['intersection'](_0x1b25c1[_0x6a1d('0x28')],qs[_0x6a1d('0x2e')](_0x24e7e9[_0x6a1d('0x2b')][_0x6a1d('0x2e')]));_0xca69f8[_0x6a1d('0x2f')]=_0xca69f8['attributes'][_0x6a1d('0x30')]?_0xca69f8['attributes']:_0x1b25c1['model'];_0xca69f8=_[_0x6a1d('0x31')]({},_0xca69f8,_0x24e7e9['options']);return utilLicense[_0x6a1d('0x32')](_0xca69f8)['then'](respondWithResult(_0x4e7233,null))['catch'](handleError(_0x4e7233,null));};exports[_0x6a1d('0x23')]=function(_0xbc0797,_0x8f89e3){if(_0xbc0797[_0x6a1d('0x33')]['id']){delete _0xbc0797[_0x6a1d('0x33')]['id'];}return db['License'][_0x6a1d('0x34')]({'where':{'id':_0xbc0797[_0x6a1d('0x35')]['id']}})[_0x6a1d('0x24')](handleEntityNotFound(_0x8f89e3,null))[_0x6a1d('0x24')](function(_0x2c0c3e){var _0x16781a=_0x2c0c3e[_0x6a1d('0x36')]({'plain':!![]});return utilLicense[_0x6a1d('0x37')](_0x16781a,_0xbc0797[_0x6a1d('0x33')][_0x6a1d('0x38')]);})['then'](function(_0x1f8e73){if(!_0x1f8e73[_0x6a1d('0x39')]){return saveUpdates(_0xbc0797[_0x6a1d('0x33')],null);}return _0x1f8e73;})[_0x6a1d('0x24')](respondWithResult(_0x8f89e3,null))[_0x6a1d('0x3a')](handleError(_0x8f89e3,null));};exports[_0x6a1d('0x3b')]=function(_0x14ce32,_0x50c2b1){var _0x56c3b5=_0x6a1d('0x3c');var _0x327f25=path[_0x6a1d('0x3d')](_0x6a1d('0x3e'),_0x6a1d('0x3f'),'xcally',_0x56c3b5);_0x50c2b1[_0x6a1d('0x40')]('Content-disposition',_0x6a1d('0x41')+_0x56c3b5);_0x50c2b1[_0x6a1d('0x20')](_0x6a1d('0x42'),_0x6a1d('0x43'));_0x50c2b1[_0x6a1d('0x44')](_0x327f25);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 915ac3f..85c082d 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 _0x1be8=['request-promise','path','../../config/environment','./license.attributes','define','License','license','../../config/logger','api'];(function(_0x14082b,_0x3672d6){var _0x53a93d=function(_0x514882){while(--_0x514882){_0x14082b['push'](_0x14082b['shift']());}};_0x53a93d(++_0x3672d6);}(_0x1be8,0xc4));var _0x81be=function(_0x52c651,_0x4c1f4e){_0x52c651=_0x52c651-0x0;var _0x525ceb=_0x1be8[_0x52c651];return _0x525ceb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x81be('0x0'))(_0x81be('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x81be('0x2'));var fs=require('fs');var path=require(_0x81be('0x3'));var rimraf=require('rimraf');var config=require(_0x81be('0x4'));var attributes=require(_0x81be('0x5'));module['exports']=function(_0x382286,_0x81c913){return _0x382286[_0x81be('0x6')](_0x81be('0x7'),attributes,{'tableName':_0x81be('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ac4=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','util','../../config/logger','api'];(function(_0x488f1b,_0x5dfa62){var _0x32211a=function(_0x4ffd8b){while(--_0x4ffd8b){_0x488f1b['push'](_0x488f1b['shift']());}};_0x32211a(++_0x5dfa62);}(_0x6ac4,0x10b));var _0x46ac=function(_0x2bbd6c,_0x4430c0){_0x2bbd6c=_0x2bbd6c-0x0;var _0x22d0a9=_0x6ac4[_0x2bbd6c];return _0x22d0a9;};'use strict';var _=require('lodash');var util=require(_0x46ac('0x0'));var logger=require(_0x46ac('0x1'))(_0x46ac('0x2'));var moment=require(_0x46ac('0x3'));var BPromise=require(_0x46ac('0x4'));var rp=require(_0x46ac('0x5'));var fs=require('fs');var path=require(_0x46ac('0x6'));var rimraf=require(_0x46ac('0x7'));var config=require(_0x46ac('0x8'));var attributes=require('./license.attributes');module['exports']=function(_0x83d18b,_0x4a244e){return _0x83d18b[_0x46ac('0x9')]('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index aff91b1..42b8ec4 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 _0xebf7=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x10eb11,_0x1c2aaa){var _0x1aad42=function(_0x2192f6){while(--_0x2192f6){_0x10eb11['push'](_0x10eb11['shift']());}};_0x1aad42(++_0x1c2aaa);}(_0xebf7,0x11b));var _0x7ebf=function(_0xadee3,_0xfcc973){_0xadee3=_0xadee3-0x0;var _0x444f43=_0xebf7[_0xadee3];return _0x444f43;};'use strict';var _=require(_0x7ebf('0x0'));var util=require(_0x7ebf('0x1'));var moment=require(_0x7ebf('0x2'));var BPromise=require(_0x7ebf('0x3'));var rs=require(_0x7ebf('0x4'));var fs=require('fs');var Redis=require(_0x7ebf('0x5'));var db=require(_0x7ebf('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7ebf('0x7'))(_0x7ebf('0x8'));var config=require(_0x7ebf('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7ebf('0xa')][_0x7ebf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf878c5,_0x43e17b,_0x25c181){return new BPromise(function(_0x29f7d5,_0x2a6b1c){return client[_0x7ebf('0xc')](_0xf878c5,_0x25c181)['then'](function(_0x2a576f){logger[_0x7ebf('0xd')](_0x7ebf('0xe'),_0x43e17b,_0x7ebf('0xf'));logger[_0x7ebf('0x10')](_0x7ebf('0x11'),_0x43e17b,'request\x20sent',JSON[_0x7ebf('0x12')](_0x2a576f));if(_0x2a576f[_0x7ebf('0x13')]){if(_0x2a576f[_0x7ebf('0x13')][_0x7ebf('0x14')]===0x1f4){logger[_0x7ebf('0x13')]('License,\x20%s,\x20%s',_0x43e17b,_0x2a576f[_0x7ebf('0x13')][_0x7ebf('0x15')]);return _0x2a6b1c(_0x2a576f['error'][_0x7ebf('0x15')]);}logger['error'](_0x7ebf('0xe'),_0x43e17b,_0x2a576f[_0x7ebf('0x13')][_0x7ebf('0x15')]);return _0x29f7d5(_0x2a576f[_0x7ebf('0x13')][_0x7ebf('0x15')]);}else{logger[_0x7ebf('0xd')]('License,\x20%s,\x20%s',_0x43e17b,_0x7ebf('0xf'));_0x29f7d5(_0x2a576f[_0x7ebf('0x16')]['message']);}})[_0x7ebf('0x17')](function(_0x237fe3){logger[_0x7ebf('0x13')](_0x7ebf('0xe'),_0x43e17b,_0x237fe3);_0x2a6b1c(_0x237fe3);});});} \ No newline at end of file +var _0x7f78=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','License,\x20%s,\x20%s','message','info','result','catch'];(function(_0x520db8,_0x4606b5){var _0x4e658b=function(_0x7453d0){while(--_0x7453d0){_0x520db8['push'](_0x520db8['shift']());}};_0x4e658b(++_0x4606b5);}(_0x7f78,0x1f4));var _0x87f7=function(_0x6dd9e4,_0x1ad429){_0x6dd9e4=_0x6dd9e4-0x0;var _0x108b07=_0x7f78[_0x6dd9e4];return _0x108b07;};'use strict';var _=require('lodash');var util=require(_0x87f7('0x0'));var moment=require(_0x87f7('0x1'));var BPromise=require(_0x87f7('0x2'));var rs=require(_0x87f7('0x3'));var fs=require('fs');var Redis=require(_0x87f7('0x4'));var db=require(_0x87f7('0x5'))['db'];var utils=require(_0x87f7('0x6'));var logger=require(_0x87f7('0x7'))(_0x87f7('0x8'));var config=require(_0x87f7('0x9'));var jayson=require(_0x87f7('0xa'));var client=jayson[_0x87f7('0xb')][_0x87f7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1a9a88,_0x1dc0a1,_0xaae4de){return new BPromise(function(_0x4c169a,_0x4db787){return client[_0x87f7('0xd')](_0x1a9a88,_0xaae4de)[_0x87f7('0xe')](function(_0x54145d){logger['info']('License,\x20%s,\x20%s',_0x1dc0a1,_0x87f7('0xf'));logger[_0x87f7('0x10')]('License,\x20%s,\x20%s,\x20%s',_0x1dc0a1,_0x87f7('0xf'),JSON[_0x87f7('0x11')](_0x54145d));if(_0x54145d[_0x87f7('0x12')]){if(_0x54145d['error'][_0x87f7('0x13')]===0x1f4){logger[_0x87f7('0x12')](_0x87f7('0x14'),_0x1dc0a1,_0x54145d[_0x87f7('0x12')][_0x87f7('0x15')]);return _0x4db787(_0x54145d[_0x87f7('0x12')]['message']);}logger[_0x87f7('0x12')]('License,\x20%s,\x20%s',_0x1dc0a1,_0x54145d[_0x87f7('0x12')]['message']);return _0x4c169a(_0x54145d['error'][_0x87f7('0x15')]);}else{logger[_0x87f7('0x16')](_0x87f7('0x14'),_0x1dc0a1,_0x87f7('0xf'));_0x4c169a(_0x54145d[_0x87f7('0x17')][_0x87f7('0x15')]);}})[_0x87f7('0x18')](function(_0x3d58e0){logger[_0x87f7('0x12')](_0x87f7('0x14'),_0x1dc0a1,_0x3d58e0);_0x4db787(_0x3d58e0);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 4bbaaf3..ec712dc 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 _0x6199=['getAgents','addDisposition','addAnswer','post','addSmtp','addInteraction','/:id/applications','addApplications','/:id/send','send','/:id/users','addAgents','update','delete','removeDispositions','removeImap','removeSmtp','destroy','removeAgents','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','/:id/messages','getMessages','/:id/verify','verifySmtp'];(function(_0x5e2199,_0x1c6504){var _0x31e252=function(_0x54ce64){while(--_0x54ce64){_0x5e2199['push'](_0x5e2199['shift']());}};_0x31e252(++_0x1c6504);}(_0x6199,0xfe));var _0x9619=function(_0x2b0f6f,_0x21651a){_0x2b0f6f=_0x2b0f6f-0x0;var _0x54903c=_0x6199[_0x2b0f6f];return _0x54903c;};'use strict';var multer=require('multer');var util=require(_0x9619('0x0'));var path=require(_0x9619('0x1'));var timeout=require('connect-timeout');var express=require(_0x9619('0x2'));var router=express[_0x9619('0x3')]();var fs_extra=require(_0x9619('0x4'));var auth=require(_0x9619('0x5'));var interaction=require(_0x9619('0x6'));var config=require(_0x9619('0x7'));var controller=require(_0x9619('0x8'));router[_0x9619('0x9')]('/',auth[_0x9619('0xa')](),controller[_0x9619('0xb')]);router['get'](_0x9619('0xc'),auth['isAuthenticated'](),controller[_0x9619('0xd')]);router[_0x9619('0x9')](_0x9619('0xe'),auth[_0x9619('0xa')](),controller[_0x9619('0xf')]);router[_0x9619('0x9')](_0x9619('0x10'),auth[_0x9619('0xa')](),controller[_0x9619('0x11')]);router[_0x9619('0x9')](_0x9619('0x12'),auth[_0x9619('0xa')](),controller[_0x9619('0x13')]);router['get'](_0x9619('0x14'),auth[_0x9619('0xa')](),controller[_0x9619('0x15')]);router[_0x9619('0x9')](_0x9619('0x16'),auth[_0x9619('0xa')](),controller['getSmtp']);router['get'](_0x9619('0x17'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x9619('0x9')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0x9619('0x9')](_0x9619('0x18'),auth['isAuthenticated'](),controller[_0x9619('0x19')]);router[_0x9619('0x9')](_0x9619('0x1a'),auth['isAuthenticated'](),controller[_0x9619('0x1b')]);router[_0x9619('0x9')]('/:id/users',auth[_0x9619('0xa')](),controller[_0x9619('0x1c')]);router['post'](_0x9619('0x10'),auth['isAuthenticated'](),controller[_0x9619('0x1d')]);router['post'](_0x9619('0x12'),auth[_0x9619('0xa')](),controller[_0x9619('0x1e')]);router[_0x9619('0x1f')]('/',auth[_0x9619('0xa')](),controller['create']);router[_0x9619('0x1f')]('/:id/in_servers',auth['isAuthenticated'](),controller['addImap']);router['post'](_0x9619('0x16'),auth[_0x9619('0xa')](),controller[_0x9619('0x20')]);router[_0x9619('0x1f')](_0x9619('0x17'),auth['isAuthenticated'](),controller[_0x9619('0x21')]);router[_0x9619('0x1f')](_0x9619('0x22'),auth[_0x9619('0xa')](),controller[_0x9619('0x23')]);router[_0x9619('0x1f')](_0x9619('0x24'),auth[_0x9619('0xa')](),controller[_0x9619('0x25')]);router[_0x9619('0x1f')](_0x9619('0x26'),auth[_0x9619('0xa')](),controller[_0x9619('0x27')]);router['put'](_0x9619('0xe'),auth['isAuthenticated'](),controller[_0x9619('0x28')]);router[_0x9619('0x29')](_0x9619('0x10'),auth[_0x9619('0xa')](),controller[_0x9619('0x2a')]);router[_0x9619('0x29')](_0x9619('0x12'),auth[_0x9619('0xa')](),controller['removeAnswers']);router[_0x9619('0x29')](_0x9619('0x14'),auth[_0x9619('0xa')](),controller[_0x9619('0x2b')]);router[_0x9619('0x29')](_0x9619('0x16'),auth[_0x9619('0xa')](),controller[_0x9619('0x2c')]);router[_0x9619('0x29')]('/:id',auth['isAuthenticated'](),controller[_0x9619('0x2d')]);router[_0x9619('0x29')](_0x9619('0x26'),auth[_0x9619('0xa')](),controller[_0x9619('0x2e')]);module['exports']=router; \ No newline at end of file +var _0x3480=['path','connect-timeout','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/verify','/:id/users','getAgents','post','addDisposition','create','addImap','addSmtp','addInteraction','addApplications','put','/:id','update','delete','removeDispositions','removeAnswers','removeImap','destroy','removeAgents','exports','util'];(function(_0x25b79e,_0xb744f0){var _0x2bb51d=function(_0x5eb9d5){while(--_0x5eb9d5){_0x25b79e['push'](_0x25b79e['shift']());}};_0x2bb51d(++_0xb744f0);}(_0x3480,0x199));var _0x0348=function(_0x284a9f,_0x319ffe){_0x284a9f=_0x284a9f-0x0;var _0x2d6b98=_0x3480[_0x284a9f];return _0x2d6b98;};'use strict';var multer=require('multer');var util=require(_0x0348('0x0'));var path=require(_0x0348('0x1'));var timeout=require(_0x0348('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0348('0x3'));var controller=require(_0x0348('0x4'));router[_0x0348('0x5')]('/',auth[_0x0348('0x6')](),controller[_0x0348('0x7')]);router[_0x0348('0x5')](_0x0348('0x8'),auth[_0x0348('0x6')](),controller['describe']);router[_0x0348('0x5')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0348('0x5')](_0x0348('0x9'),auth[_0x0348('0x6')](),controller[_0x0348('0xa')]);router[_0x0348('0x5')](_0x0348('0xb'),auth[_0x0348('0x6')](),controller[_0x0348('0xc')]);router[_0x0348('0x5')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x0348('0xd')]);router[_0x0348('0x5')](_0x0348('0xe'),auth[_0x0348('0x6')](),controller[_0x0348('0xf')]);router[_0x0348('0x5')](_0x0348('0x10'),auth[_0x0348('0x6')](),controller[_0x0348('0x11')]);router[_0x0348('0x5')](_0x0348('0x12'),auth[_0x0348('0x6')](),controller['getApplications']);router['get'](_0x0348('0x13'),auth[_0x0348('0x6')](),controller[_0x0348('0x14')]);router[_0x0348('0x5')](_0x0348('0x15'),auth[_0x0348('0x6')](),controller['verifySmtp']);router[_0x0348('0x5')](_0x0348('0x16'),auth[_0x0348('0x6')](),controller[_0x0348('0x17')]);router[_0x0348('0x18')](_0x0348('0x9'),auth[_0x0348('0x6')](),controller[_0x0348('0x19')]);router[_0x0348('0x18')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router['post']('/',auth[_0x0348('0x6')](),controller[_0x0348('0x1a')]);router[_0x0348('0x18')]('/:id/in_servers',auth[_0x0348('0x6')](),controller[_0x0348('0x1b')]);router['post'](_0x0348('0xe'),auth[_0x0348('0x6')](),controller[_0x0348('0x1c')]);router[_0x0348('0x18')]('/:id/interactions',auth[_0x0348('0x6')](),controller[_0x0348('0x1d')]);router['post'](_0x0348('0x12'),auth['isAuthenticated'](),controller[_0x0348('0x1e')]);router[_0x0348('0x18')]('/:id/send',auth[_0x0348('0x6')](),controller['send']);router['post'](_0x0348('0x16'),auth[_0x0348('0x6')](),controller['addAgents']);router[_0x0348('0x1f')](_0x0348('0x20'),auth[_0x0348('0x6')](),controller[_0x0348('0x21')]);router[_0x0348('0x22')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x0348('0x23')]);router[_0x0348('0x22')]('/:id/canned_answers',auth[_0x0348('0x6')](),controller[_0x0348('0x24')]);router[_0x0348('0x22')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x0348('0x25')]);router['delete'](_0x0348('0xe'),auth[_0x0348('0x6')](),controller['removeSmtp']);router[_0x0348('0x22')](_0x0348('0x20'),auth[_0x0348('0x6')](),controller[_0x0348('0x26')]);router[_0x0348('0x22')](_0x0348('0x16'),auth[_0x0348('0x6')](),controller[_0x0348('0x27')]);module[_0x0348('0x28')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 11b8adb..bc408fd 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 _0x29d7=['mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','ENUM','gmail','yahoo','outlook365','provider','custom','getDataValue','sequelize','exports','BOOLEAN','STRING','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x2afb44,_0x249a57){var _0x15ccc2=function(_0x180748){while(--_0x180748){_0x2afb44['push'](_0x2afb44['shift']());}};_0x15ccc2(++_0x249a57);}(_0x29d7,0xdc));var _0x729d=function(_0x3855bc,_0x67095b){_0x3855bc=_0x3855bc-0x0;var _0x11501e=_0x29d7[_0x3855bc];return _0x11501e;};'use strict';var Sequelize=require(_0x729d('0x0'));module[_0x729d('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x729d('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x729d('0x3')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x729d('0x3')],'allowNull':![]},'template':{'type':Sequelize[_0x729d('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x729d('0x3')],'allowNull':![],'defaultValue':_0x729d('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x729d('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x729d('0x7');}},'notificationSound':{'type':Sequelize[_0x729d('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x729d('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x729d('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x729d('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x729d('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x729d('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x729d('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x729d('0x2')],'defaultValue':![],'comment':_0x729d('0xa'),'set':function(_0x459190){if(!_0x459190)this['setDataValue'](_0x729d('0xb'),null);this[_0x729d('0xc')](_0x729d('0xd'),_0x459190);}},'provider':{'type':Sequelize[_0x729d('0xe')](_0x729d('0xf'),'hotmail',_0x729d('0x10'),_0x729d('0x11')),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0x729d('0x12')))return _0x729d('0x13');return this[_0x729d('0x14')](_0x729d('0x12'));},'set':function(_0x18612b){if(_0x18612b===_0x729d('0x13'))_0x18612b=null;return this['setDataValue'](_0x729d('0x12'),_0x18612b);}}}; \ No newline at end of file +var _0x2b07=['BOOLEAN','UNSIGNED','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','hotmail','outlook365','provider','custom','sequelize','exports','STRING','TEXT'];(function(_0x4f676e,_0x571ace){var _0x542a9b=function(_0x31a202){while(--_0x31a202){_0x4f676e['push'](_0x4f676e['shift']());}};_0x542a9b(++_0x571ace);}(_0x2b07,0x7c));var _0x72b0=function(_0x1e5cc3,_0x238a87){_0x1e5cc3=_0x1e5cc3-0x0;var _0x15c596=_0x2b07[_0x1e5cc3];return _0x15c596;};'use strict';var Sequelize=require(_0x72b0('0x0'));module[_0x72b0('0x1')]={'description':{'type':Sequelize[_0x72b0('0x2')]},'name':{'type':Sequelize[_0x72b0('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x72b0('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x72b0('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x72b0('0x3')]},'markAsUnread':{'type':Sequelize[_0x72b0('0x4')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x72b0('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x72b0('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x72b0('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x72b0('0x4')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x72b0('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x72b0('0x4')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x72b0('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x72b0('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x72b0('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x72b0('0x4')],'defaultValue':![],'comment':_0x72b0('0x8'),'set':function(_0x5624e0){if(!_0x5624e0)this[_0x72b0('0x9')](_0x72b0('0xa'),null);this[_0x72b0('0x9')](_0x72b0('0xb'),_0x5624e0);}},'provider':{'type':Sequelize['ENUM']('gmail',_0x72b0('0xc'),'yahoo',_0x72b0('0xd')),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0x72b0('0xe')))return _0x72b0('0xf');return this['getDataValue'](_0x72b0('0xe'));},'set':function(_0x5482fa){if(_0x5482fa==='custom')_0x5482fa=null;return this['setDataValue']('provider',_0x5482fa);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 255768e..8a64782 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 _0x167a=['getImap','addImap','setImap','getSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','color','tag','addApplications','sequelize','transaction','MailApplication','priority','finally','getApplications','getMessages','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','format','attachments','join','root','server/files/attachments','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','defaults','ListId','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','moment','bluebird','util','path','juice','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./mailAccount.socket','register','client','request','then','info','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','update','destroy','get','MailAccounts','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.mail.yahoo.com','smtp-mail.outlook.com','outlook365','smtp.office365.com','user','password','pass','modernAuthentication','CloudProviderId','port','host','secure','service','username','authentication','Imap','Smtp','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','includeAll','find','body','provider','custom','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','email','isNil','active','description','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x1a1e00,_0x7464ca){var _0x4b44ae=function(_0x4f72f0){while(--_0x4f72f0){_0x1a1e00['push'](_0x1a1e00['shift']());}};_0x4b44ae(++_0x7464ca);}(_0x167a,0x1c7));var _0xa167=function(_0x4ac6c5,_0x232988){_0x4ac6c5=_0x4ac6c5-0x0;var _0x410f9c=_0x167a[_0x4ac6c5];return _0x410f9c;};'use strict';var moment=require(_0xa167('0x0'));var BPromise=require(_0xa167('0x1'));var util=require(_0xa167('0x2'));var path=require(_0xa167('0x3'));var _=require('lodash');var juice=require(_0xa167('0x4'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xa167('0x5'))(_0xa167('0x6'));var config=require(_0xa167('0x7'));var db=require('../../mysqldb')['db'];config[_0xa167('0x8')]=_['defaults'](config['redis'],{'host':_0xa167('0x9'),'port':0x18eb});var socket=require(_0xa167('0xa'))(new Redis(config['redis']));require(_0xa167('0xb'))[_0xa167('0xc')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa167('0xd')]['http']({'port':0x232b});function respondWithRpcPromise(_0x452f17,_0x4a7a70,_0xf31bb0,_0x5656df){return new BPromise(function(_0x1c7c8d,_0x44693c){var _0x367a6b=_0x5656df||client;return _0x367a6b[_0xa167('0xe')](_0x452f17,_0xf31bb0)[_0xa167('0xf')](function(_0x3de3ff){logger[_0xa167('0x10')]('MailAccount,\x20%s,\x20%s',_0x4a7a70,'request\x20sent');logger[_0xa167('0x11')](_0xa167('0x12'),_0x4a7a70,_0xa167('0x13'),JSON[_0xa167('0x14')](_0x3de3ff));if(_0x3de3ff[_0xa167('0x15')]){if(_0x3de3ff[_0xa167('0x15')][_0xa167('0x16')]===0x1f4){logger[_0xa167('0x15')](_0xa167('0x17'),_0x4a7a70,_0x3de3ff[_0xa167('0x15')][_0xa167('0x18')]);return _0x44693c(_0x3de3ff[_0xa167('0x15')][_0xa167('0x18')]);}logger['error'](_0xa167('0x17'),_0x4a7a70,_0x3de3ff[_0xa167('0x15')][_0xa167('0x18')]);return _0x1c7c8d(_0x3de3ff[_0xa167('0x15')][_0xa167('0x18')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x4a7a70,_0xa167('0x13'));_0x1c7c8d(_0x3de3ff[_0xa167('0x19')][_0xa167('0x18')]);}})[_0xa167('0x1a')](function(_0x585622){logger[_0xa167('0x15')](_0xa167('0x17'),_0x4a7a70,_0x585622);_0x44693c(_0x585622);});});}function respondWithStatusCode(_0x332005,_0x32f693){_0x32f693=_0x32f693||0xcc;return function(_0x5f1525){if(_0x5f1525){return _0x332005[_0xa167('0x1b')](_0x32f693);}return _0x332005['status'](_0x32f693)[_0xa167('0x1c')]();};}function respondWithResult(_0x42bcf3,_0x531086){_0x531086=_0x531086||0xc8;return function(_0x395158){if(_0x395158){return _0x42bcf3['status'](_0x531086)[_0xa167('0x1d')](_0x395158);}};}function respondWithFilteredResult(_0x156ce4,_0x583c76){return function(_0x58b675){if(_0x58b675){var _0x38d927=typeof _0x583c76[_0xa167('0x1e')]===_0xa167('0x1f')&&typeof _0x583c76[_0xa167('0x20')]===_0xa167('0x1f');var _0x25c681=_0x58b675[_0xa167('0x21')];var _0x54dde3=_0x38d927?0x0:_0x583c76[_0xa167('0x1e')];var _0x594f1f=_0x38d927?_0x58b675[_0xa167('0x21')]:_0x583c76[_0xa167('0x1e')]+_0x583c76[_0xa167('0x20')];var _0x25bb34;if(_0x594f1f>=_0x25c681){_0x594f1f=_0x25c681;_0x25bb34=0xc8;}else{_0x25bb34=0xce;}_0x156ce4[_0xa167('0x22')](_0x25bb34);return _0x156ce4[_0xa167('0x23')](_0xa167('0x24'),_0x54dde3+'-'+_0x594f1f+'/'+_0x25c681)[_0xa167('0x1d')](_0x58b675);}return null;};}function saveUpdates(_0x5a45a3){return function(_0x390526){if(_0x390526){return _0x390526[_0xa167('0x25')](_0x5a45a3)[_0xa167('0xf')](function(_0x54f7e2){return _0x54f7e2;});}return null;};}function removeEntity(_0x50aaac){return function(_0x4e13ea){if(_0x4e13ea){return _0x4e13ea[_0xa167('0x26')]()[_0xa167('0xf')](function(){var _0x26896b=_0x4e13ea[_0xa167('0x27')]({'plain':!![]});var _0x20be6e=_0xa167('0x28');return db['UserProfileResource'][_0xa167('0x26')]({'where':{'type':_0x20be6e,'resourceId':_0x26896b['id']}})[_0xa167('0xf')](function(){return _0x4e13ea;});})[_0xa167('0xf')](function(){_0x50aaac[_0xa167('0x22')](0xcc)[_0xa167('0x1c')]();});}};}function handleEntityNotFound(_0x507574){return function(_0x3d8044){if(!_0x3d8044){_0x507574['sendStatus'](0x194);}return _0x3d8044;};}function handleError(_0x14d0b7,_0x300030){_0x300030=_0x300030||0x1f4;return function(_0x31e17a){logger['error'](_0x31e17a[_0xa167('0x29')]);if(_0x31e17a['name']){delete _0x31e17a[_0xa167('0x2a')];}_0x14d0b7[_0xa167('0x22')](_0x300030)[_0xa167('0x2b')](_0x31e17a);};}function getImapHost(_0x41dd79){switch(_0x41dd79){case _0xa167('0x2c'):return _0xa167('0x2d');case _0xa167('0x2e'):return _0xa167('0x2f');case _0xa167('0x30'):return'imap-mail.outlook.com';case'outlook365':return _0xa167('0x31');}throw new Error(_0xa167('0x32'),_0x41dd79);}function getSmtpHost(_0x2cdfed){switch(_0x2cdfed){case _0xa167('0x2c'):return'smtp.gmail.com';case _0xa167('0x2e'):return _0xa167('0x33');case _0xa167('0x30'):return _0xa167('0x34');case _0xa167('0x35'):return _0xa167('0x36');}throw new Error(_0xa167('0x32'),_0x2cdfed);}function getAuthenticationOptions(_0x565550,_0x203c0a){var _0x5a6a29={};var _0x24a70f={};if(_0x565550){_0x5a6a29[_0xa167('0x37')]=_0x24a70f[_0xa167('0x37')]=_0x203c0a['username'];_0x5a6a29[_0xa167('0x38')]=_0x24a70f[_0xa167('0x39')]=_0x203c0a['password'];if(_0x203c0a[_0xa167('0x3a')]){_0x5a6a29[_0xa167('0x3a')]=_0x24a70f['modernAuthentication']=!![];_0x5a6a29[_0xa167('0x3b')]=_0x24a70f['CloudProviderId']=_0x203c0a[_0xa167('0x3b')];_0x5a6a29['password']=_0x24a70f[_0xa167('0x39')]=null;}else{_0x5a6a29[_0xa167('0x3b')]=_0x24a70f[_0xa167('0x3b')]=null;}_0x5a6a29['host']=getImapHost(_0x565550);_0x5a6a29[_0xa167('0x3c')]=0x3e1;_0x24a70f[_0xa167('0x3d')]=getSmtpHost(_0x565550);_0x24a70f[_0xa167('0x3c')]=0x24b;_0x24a70f[_0xa167('0x3e')]=![];_0x5a6a29[_0xa167('0x3f')]=_0x24a70f[_0xa167('0x3f')]=null;}else{if(_0x203c0a['authentication']){_0x5a6a29[_0xa167('0x37')]=_0x24a70f[_0xa167('0x37')]=_0x203c0a[_0xa167('0x40')];_0x5a6a29[_0xa167('0x38')]=_0x24a70f[_0xa167('0x39')]=_0x203c0a[_0xa167('0x38')];}else{_0x5a6a29[_0xa167('0x41')]=_0x24a70f[_0xa167('0x41')]=![];_0x5a6a29[_0xa167('0x37')]=_0x24a70f[_0xa167('0x37')]=null;_0x5a6a29[_0xa167('0x38')]=_0x24a70f[_0xa167('0x39')]=null;}_0x5a6a29[_0xa167('0x3d')]=_0x203c0a[_0xa167('0x42')][_0xa167('0x3d')];_0x5a6a29['port']=_0x203c0a['Imap'][_0xa167('0x3c')];_0x24a70f[_0xa167('0x3d')]=_0x203c0a[_0xa167('0x43')][_0xa167('0x3d')];_0x24a70f['port']=_0x203c0a[_0xa167('0x43')][_0xa167('0x3c')];}return{'Imap':_0x5a6a29,'Smtp':_0x24a70f};}exports['index']=function(_0x214384,_0x32d7a2){var _0x31f060={'include':[{'model':db[_0xa167('0x44')],'as':'Imap'},{'model':db[_0xa167('0x45')],'as':_0xa167('0x43')},{'model':db[_0xa167('0x46')],'as':_0xa167('0x47')}]},_0x59a81d={},_0xdd1b07={'count':0x0,'rows':[]};var _0x5c07f1=_[_0xa167('0x48')](db[_0xa167('0x49')][_0xa167('0x4a')],function(_0x551605){return{'name':_0x551605['fieldName'],'type':_0x551605['type'][_0xa167('0x4b')]};});_0x59a81d[_0xa167('0x4c')]=_[_0xa167('0x48')](_0x5c07f1,'name');_0x59a81d[_0xa167('0x4d')]=_[_0xa167('0x4e')](_0x214384[_0xa167('0x4d')]);_0x59a81d[_0xa167('0x4f')]=_['intersection'](_0x59a81d['model'],_0x59a81d[_0xa167('0x4d')]);_0x31f060[_0xa167('0x50')]=_[_0xa167('0x51')](_0x59a81d[_0xa167('0x4c')],qs[_0xa167('0x52')](_0x214384[_0xa167('0x4d')]['fields']));_0x31f060['attributes']=_0x31f060[_0xa167('0x50')][_0xa167('0x53')]?_0x31f060['attributes']:_0x59a81d[_0xa167('0x4c')];if(!_0x214384[_0xa167('0x4d')][_0xa167('0x54')](_0xa167('0x55'))){_0x31f060[_0xa167('0x20')]=qs[_0xa167('0x20')](_0x214384[_0xa167('0x4d')][_0xa167('0x20')]);_0x31f060[_0xa167('0x1e')]=qs[_0xa167('0x1e')](_0x214384['query'][_0xa167('0x1e')]);}_0x31f060[_0xa167('0x56')]=qs[_0xa167('0x57')](_0x214384[_0xa167('0x4d')][_0xa167('0x57')]);_0x31f060[_0xa167('0x58')]=qs[_0xa167('0x4f')](_['pick'](_0x214384[_0xa167('0x4d')],_0x59a81d[_0xa167('0x4f')]),_0x5c07f1);if(_0x214384[_0xa167('0x4d')][_0xa167('0x59')]){_0x31f060[_0xa167('0x58')]=_['merge'](_0x31f060[_0xa167('0x58')],{'$or':_[_0xa167('0x48')](_0x5c07f1,function(_0x202667){if(_0x202667['type']!==_0xa167('0x5a')){var _0x11e88b={};_0x11e88b[_0x202667[_0xa167('0x2a')]]={'$like':'%'+_0x214384[_0xa167('0x4d')][_0xa167('0x59')]+'%'};return _0x11e88b;}})});}_0x31f060=_[_0xa167('0x5b')]({},_0x31f060,_0x214384[_0xa167('0x5c')]);var _0x208904={'where':_0x31f060[_0xa167('0x58')]};return db[_0xa167('0x49')][_0xa167('0x21')](_0x208904)[_0xa167('0xf')](function(_0x1862a7){_0xdd1b07[_0xa167('0x21')]=_0x1862a7;if(_0x214384[_0xa167('0x4d')]['includeAll']){_0x31f060[_0xa167('0x5d')]=[{'all':!![]}];}return db['MailAccount'][_0xa167('0x5e')](_0x31f060);})[_0xa167('0xf')](function(_0x5c9773){_0xdd1b07[_0xa167('0x5f')]=_0x5c9773;return _0xdd1b07;})[_0xa167('0xf')](respondWithFilteredResult(_0x32d7a2,_0x31f060))['catch'](handleError(_0x32d7a2,null));};exports[_0xa167('0x60')]=function(_0x4c00b7,_0x39229c){var _0x17cf01={'raw':![],'where':{'id':_0x4c00b7[_0xa167('0x61')]['id']},'include':[{'model':db[_0xa167('0x44')],'as':_0xa167('0x42')},{'model':db[_0xa167('0x45')],'as':_0xa167('0x43')},{'model':db[_0xa167('0x46')],'as':_0xa167('0x47')}]},_0x20e9df={};_0x20e9df['model']=_['keys'](db[_0xa167('0x49')][_0xa167('0x4a')]);_0x20e9df[_0xa167('0x4d')]=_[_0xa167('0x4e')](_0x4c00b7[_0xa167('0x4d')]);_0x20e9df['filters']=_[_0xa167('0x51')](_0x20e9df[_0xa167('0x4c')],_0x20e9df[_0xa167('0x4d')]);_0x17cf01[_0xa167('0x50')]=_[_0xa167('0x51')](_0x20e9df['model'],qs['fields'](_0x4c00b7[_0xa167('0x4d')][_0xa167('0x52')]));_0x17cf01['attributes']=_0x17cf01[_0xa167('0x50')]['length']?_0x17cf01[_0xa167('0x50')]:_0x20e9df['model'];if(_0x4c00b7['query'][_0xa167('0x62')]){_0x17cf01[_0xa167('0x5d')]=[{'all':!![]}];}_0x17cf01=_[_0xa167('0x5b')]({},_0x17cf01,_0x4c00b7['options']);return db[_0xa167('0x49')][_0xa167('0x63')](_0x17cf01)[_0xa167('0xf')](handleEntityNotFound(_0x39229c,null))[_0xa167('0xf')](respondWithResult(_0x39229c,null))[_0xa167('0x1a')](handleError(_0x39229c,null));};exports[_0xa167('0x25')]=function(_0x2730ea,_0x511daa){if(_0x2730ea[_0xa167('0x64')]['id']){delete _0x2730ea[_0xa167('0x64')]['id'];}var _0x59b134=_0x2730ea[_0xa167('0x64')][_0xa167('0x65')]===_0xa167('0x66')?null:_0x2730ea[_0xa167('0x64')]['provider'];var _0x3c2c15=_0x2730ea['body'][_0xa167('0x42')]||{};var _0x562164=_0x2730ea[_0xa167('0x64')]['Smtp']||{};if(_0x59b134){_0x3c2c15[_0xa167('0x3d')]=getImapHost(_0x59b134);_0x3c2c15['port']=0x3e1;_0x562164[_0xa167('0x3d')]=getSmtpHost(_0x59b134);_0x562164[_0xa167('0x3c')]=0x24b;_0x562164['secure']=![];}if(_0x562164[_0xa167('0x3a')]){_0x562164[_0xa167('0x3e')]=![];}else{_0x562164[_0xa167('0x3b')]=null;}if(!_0x3c2c15[_0xa167('0x3a')])_0x3c2c15['CloudProviderId']=null;_0x2730ea[_0xa167('0x64')][_0xa167('0x42')]=_0x3c2c15;_0x2730ea[_0xa167('0x64')][_0xa167('0x43')]=_0x562164;return db[_0xa167('0x49')][_0xa167('0x63')]({'where':{'id':_0x2730ea[_0xa167('0x61')]['id']},'include':[{'model':db[_0xa167('0x44')],'as':'Imap'},{'model':db[_0xa167('0x45')],'as':_0xa167('0x43')},{'model':db[_0xa167('0x46')],'as':_0xa167('0x47')}]})[_0xa167('0xf')](handleEntityNotFound(_0x511daa,null))[_0xa167('0xf')](function(_0x4bd08e){if(!_0x4bd08e)throw new Error(_0xa167('0x67'));if(_0x4bd08e[_0xa167('0x3f')])delete _0x2730ea[_0xa167('0x64')]['Imap'];return _0x4bd08e;})[_0xa167('0xf')](saveUpdates(_0x2730ea[_0xa167('0x64')],null))[_0xa167('0xf')](function(_0x27cd0f){if(!_0x2730ea[_0xa167('0x64')][_0xa167('0x42')])return _0x27cd0f;return db[_0xa167('0x44')]['update'](_0x2730ea[_0xa167('0x64')][_0xa167('0x42')],{'where':{'MailAccountId':_0x27cd0f['id']}})[_0xa167('0xf')](function(){return _0x27cd0f;});})[_0xa167('0xf')](function(_0x4779cf){if(!_0x2730ea[_0xa167('0x64')]['Smtp'])return _0x4779cf;return db[_0xa167('0x45')][_0xa167('0x25')](_0x2730ea[_0xa167('0x64')][_0xa167('0x43')],{'where':{'MailAccountId':_0x4779cf['id']}})[_0xa167('0xf')](function(){return _0x4779cf;});})[_0xa167('0xf')](respondWithResult(_0x511daa,null))['catch'](handleError(_0x511daa,null));};exports[_0xa167('0x68')]=function(_0x2611ad,_0x4056a8){return db[_0xa167('0x49')][_0xa167('0x68')]()[_0xa167('0xf')](respondWithResult(_0x4056a8,null))[_0xa167('0x1a')](handleError(_0x4056a8,null));};exports[_0xa167('0x69')]=function(_0x9c0d1,_0x4c0178){if(_0x9c0d1[_0xa167('0x64')]['id']){delete _0x9c0d1['body']['id'];}return db['MailAccount'][_0xa167('0x63')]({'where':{'id':_0x9c0d1['params']['id']}})['then'](handleEntityNotFound(_0x4c0178,null))[_0xa167('0xf')](function(_0x1b8a72){if(_0x1b8a72){_0x9c0d1[_0xa167('0x64')][_0xa167('0x6a')]=_0x1b8a72['id'];return db[_0xa167('0x6b')][_0xa167('0x6c')](_0x9c0d1[_0xa167('0x64')]);}})[_0xa167('0xf')](respondWithResult(_0x4c0178,null))[_0xa167('0x1a')](handleError(_0x4c0178,null));};exports[_0xa167('0x6d')]=function(_0x4d8578,_0x198517){var _0x50a9b8={'raw':![],'where':{}};var _0x45b020={};var _0x8bc052={'count':0x0,'rows':[]};return db[_0xa167('0x49')][_0xa167('0x6e')]({'where':{'id':_0x4d8578[_0xa167('0x61')]['id']}})[_0xa167('0xf')](handleEntityNotFound(_0x198517,null))[_0xa167('0xf')](function(_0x182abb){if(_0x182abb){_0x45b020[_0xa167('0x4c')]=_['keys'](db['Disposition'][_0xa167('0x4a')]);_0x45b020[_0xa167('0x4d')]=_[_0xa167('0x4e')](_0x4d8578[_0xa167('0x4d')]);_0x45b020[_0xa167('0x4f')]=_[_0xa167('0x51')](_0x45b020[_0xa167('0x4c')],_0x45b020[_0xa167('0x4d')]);_0x50a9b8[_0xa167('0x50')]=_[_0xa167('0x51')](_0x45b020[_0xa167('0x4c')],qs[_0xa167('0x52')](_0x4d8578[_0xa167('0x4d')][_0xa167('0x52')]));_0x50a9b8[_0xa167('0x50')]=_0x50a9b8['attributes'][_0xa167('0x53')]?_0x50a9b8['attributes']:_0x45b020[_0xa167('0x4c')];if(!_0x4d8578[_0xa167('0x4d')]['hasOwnProperty'](_0xa167('0x55'))){_0x50a9b8[_0xa167('0x20')]=qs[_0xa167('0x20')](_0x4d8578[_0xa167('0x4d')][_0xa167('0x20')]);_0x50a9b8[_0xa167('0x1e')]=qs[_0xa167('0x1e')](_0x4d8578['query'][_0xa167('0x1e')]);}_0x50a9b8[_0xa167('0x56')]=qs[_0xa167('0x57')](_0x4d8578[_0xa167('0x4d')]['sort']);_0x50a9b8[_0xa167('0x58')]=qs[_0xa167('0x4f')](_[_0xa167('0x6f')](_0x4d8578[_0xa167('0x4d')],_0x45b020['filters']));_0x50a9b8[_0xa167('0x58')][_0xa167('0x6a')]=_0x182abb['id'];if(_0x4d8578[_0xa167('0x4d')][_0xa167('0x59')]){_0x50a9b8[_0xa167('0x58')]=_[_0xa167('0x5b')](_0x50a9b8[_0xa167('0x58')],{'$or':_[_0xa167('0x48')](_0x50a9b8['attributes'],function(_0x234b18){var _0x450203={};_0x450203[_0x234b18]={'$like':'%'+_0x4d8578[_0xa167('0x4d')]['filter']+'%'};return _0x450203;})});}_0x50a9b8=_[_0xa167('0x5b')]({},_0x50a9b8,_0x4d8578[_0xa167('0x5c')]);return db[_0xa167('0x6b')][_0xa167('0x21')]({'where':_0x50a9b8[_0xa167('0x58')]})[_0xa167('0xf')](function(_0x364358){_0x8bc052[_0xa167('0x21')]=_0x364358;if(_0x4d8578[_0xa167('0x4d')][_0xa167('0x62')]){_0x50a9b8['include']=[{'all':!![]}];}return db[_0xa167('0x6b')][_0xa167('0x5e')](_0x50a9b8);})[_0xa167('0xf')](function(_0x56ad59){_0x8bc052[_0xa167('0x5f')]=_0x56ad59;return _0x8bc052;});}})[_0xa167('0xf')](respondWithFilteredResult(_0x198517,_0x50a9b8))['catch'](handleError(_0x198517,null));};exports[_0xa167('0x70')]=function(_0x156b1b,_0x5dd8ea){return db[_0xa167('0x49')]['find']({'where':{'id':_0x156b1b['params']['id']}})['then'](handleEntityNotFound(_0x5dd8ea,null))[_0xa167('0xf')](function(_0x265556){if(_0x265556){return _0x265556[_0xa167('0x70')](_0x156b1b[_0xa167('0x4d')][_0xa167('0x71')]);}})['then'](respondWithStatusCode(_0x5dd8ea,null))[_0xa167('0x1a')](handleError(_0x5dd8ea,null));};exports[_0xa167('0x72')]=function(_0x436c08,_0x2184e7){if(_0x436c08[_0xa167('0x64')]['id']){delete _0x436c08[_0xa167('0x64')]['id'];}return db['MailAccount'][_0xa167('0x63')]({'where':{'id':_0x436c08[_0xa167('0x61')]['id']}})[_0xa167('0xf')](handleEntityNotFound(_0x2184e7,null))['then'](function(_0x1aef4f){if(_0x1aef4f){_0x436c08[_0xa167('0x64')]['MailAccountId']=_0x1aef4f['id'];return db[_0xa167('0x73')][_0xa167('0x6c')](_0x436c08[_0xa167('0x64')]);}})['then'](respondWithResult(_0x2184e7,null))[_0xa167('0x1a')](handleError(_0x2184e7,null));};exports[_0xa167('0x74')]=function(_0x524089,_0x1b4ce2){var _0x42dfb9={'raw':![],'where':{}};var _0x486ac0={};var _0x4f78b9={'count':0x0,'rows':[]};return db[_0xa167('0x49')]['findOne']({'where':{'id':_0x524089['params']['id']}})[_0xa167('0xf')](handleEntityNotFound(_0x1b4ce2,null))['then'](function(_0x2851ad){if(_0x2851ad){_0x486ac0[_0xa167('0x4c')]=_[_0xa167('0x4e')](db[_0xa167('0x73')]['rawAttributes']);_0x486ac0[_0xa167('0x4d')]=_[_0xa167('0x4e')](_0x524089[_0xa167('0x4d')]);_0x486ac0[_0xa167('0x4f')]=_[_0xa167('0x51')](_0x486ac0['model'],_0x486ac0[_0xa167('0x4d')]);_0x42dfb9[_0xa167('0x50')]=_[_0xa167('0x51')](_0x486ac0[_0xa167('0x4c')],qs[_0xa167('0x52')](_0x524089[_0xa167('0x4d')][_0xa167('0x52')]));_0x42dfb9[_0xa167('0x50')]=_0x42dfb9[_0xa167('0x50')][_0xa167('0x53')]?_0x42dfb9[_0xa167('0x50')]:_0x486ac0[_0xa167('0x4c')];if(!_0x524089[_0xa167('0x4d')]['hasOwnProperty'](_0xa167('0x55'))){_0x42dfb9[_0xa167('0x20')]=qs['limit'](_0x524089[_0xa167('0x4d')]['limit']);_0x42dfb9['offset']=qs['offset'](_0x524089[_0xa167('0x4d')][_0xa167('0x1e')]);}_0x42dfb9['order']=qs[_0xa167('0x57')](_0x524089[_0xa167('0x4d')][_0xa167('0x57')]);_0x42dfb9[_0xa167('0x58')]=qs[_0xa167('0x4f')](_[_0xa167('0x6f')](_0x524089['query'],_0x486ac0['filters']));_0x42dfb9[_0xa167('0x58')][_0xa167('0x6a')]=_0x2851ad['id'];if(_0x524089['query'][_0xa167('0x59')]){_0x42dfb9[_0xa167('0x58')]=_['merge'](_0x42dfb9['where'],{'$or':_[_0xa167('0x48')](_0x42dfb9[_0xa167('0x50')],function(_0x2d943d){var _0x143672={};_0x143672[_0x2d943d]={'$like':'%'+_0x524089['query'][_0xa167('0x59')]+'%'};return _0x143672;})});}_0x42dfb9=_[_0xa167('0x5b')]({},_0x42dfb9,_0x524089[_0xa167('0x5c')]);return db[_0xa167('0x73')][_0xa167('0x21')]({'where':_0x42dfb9['where']})[_0xa167('0xf')](function(_0x1bdef7){_0x4f78b9['count']=_0x1bdef7;if(_0x524089[_0xa167('0x4d')]['includeAll']){_0x42dfb9['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x42dfb9);})[_0xa167('0xf')](function(_0x178383){_0x4f78b9[_0xa167('0x5f')]=_0x178383;return _0x4f78b9;});}})[_0xa167('0xf')](respondWithFilteredResult(_0x1b4ce2,_0x42dfb9))[_0xa167('0x1a')](handleError(_0x1b4ce2,null));};exports[_0xa167('0x75')]=function(_0x16f34b,_0x592f90){return db[_0xa167('0x49')][_0xa167('0x63')]({'where':{'id':_0x16f34b[_0xa167('0x61')]['id']}})[_0xa167('0xf')](handleEntityNotFound(_0x592f90,null))[_0xa167('0xf')](function(_0xc2b7e1){if(_0xc2b7e1){return _0xc2b7e1[_0xa167('0x75')](_0x16f34b[_0xa167('0x4d')][_0xa167('0x71')]);}})[_0xa167('0xf')](respondWithStatusCode(_0x592f90,null))[_0xa167('0x1a')](handleError(_0x592f90,null));};exports[_0xa167('0x6c')]=function(_0x28d91a,_0x3dc9ad){var _0x3acc2e={'name':_0x28d91a['body'][_0xa167('0x2a')],'key':_0x28d91a['body'][_0xa167('0x4b')],'provider':_0x28d91a[_0xa167('0x64')][_0xa167('0x65')]===_0xa167('0x66')?null:_0x28d91a[_0xa167('0x64')][_0xa167('0x65')],'email':_0x28d91a[_0xa167('0x64')][_0xa167('0x76')],'ListId':_0x28d91a[_0xa167('0x64')]['ListId'],'active':!_[_0xa167('0x77')](_0x28d91a[_0xa167('0x64')]['active'])?_0x28d91a[_0xa167('0x64')][_0xa167('0x78')]:!![],'description':_0x28d91a[_0xa167('0x64')][_0xa167('0x79')]||null};var _0x29db7f=getAuthenticationOptions(_0x3acc2e['provider'],_0x28d91a[_0xa167('0x64')]);_0x3acc2e['Imap']=_0x29db7f[_0xa167('0x42')];_0x3acc2e['Smtp']=_0x29db7f[_0xa167('0x43')];return db[_0xa167('0x49')]['create'](_0x3acc2e,{'include':[{'model':db[_0xa167('0x45')],'as':'Smtp'},{'model':db[_0xa167('0x44')],'as':_0xa167('0x42')}]})[_0xa167('0xf')](function(_0x30287c){var _0x1e6a95=_0x28d91a[_0xa167('0x37')]['get']({'plain':!![]});if(!_0x1e6a95)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e6a95[_0xa167('0x7a')]===_0xa167('0x37')){var _0x1ccfd2=_0x30287c[_0xa167('0x27')]({'plain':!![]});return db[_0xa167('0x7b')][_0xa167('0x63')]({'where':{'name':'MailAccounts','userProfileId':_0x1e6a95[_0xa167('0x7c')]},'raw':!![]})[_0xa167('0xf')](function(_0x462672){if(_0x462672&&_0x462672['autoAssociation']===0x0){return db[_0xa167('0x7d')][_0xa167('0x6c')]({'name':_0x1ccfd2[_0xa167('0x2a')],'resourceId':_0x1ccfd2['id'],'type':_0x462672[_0xa167('0x2a')],'sectionId':_0x462672['id']},{})[_0xa167('0xf')](function(){return _0x30287c;});}else{return _0x30287c;}})[_0xa167('0x1a')](function(_0x1adf7c){logger[_0xa167('0x15')](_0xa167('0x7e'),_0x1adf7c);throw _0x1adf7c;});}return _0x30287c;})['then'](respondWithResult(_0x3dc9ad,0xc9))[_0xa167('0x1a')](handleError(_0x3dc9ad,null));};exports[_0xa167('0x7f')]=function(_0xbf894,_0x2458fa){return db['MailAccount'][_0xa167('0x6e')]({'where':{'id':_0xbf894['params']['id']}})[_0xa167('0xf')](handleEntityNotFound(_0x2458fa,null))[_0xa167('0xf')](function(_0xc9244d){if(_0xc9244d){return _0xc9244d[_0xa167('0x7f')]();}return null;})[_0xa167('0xf')](respondWithResult(_0x2458fa,null))[_0xa167('0x1a')](handleError(_0x2458fa,null));};exports[_0xa167('0x80')]=function(_0x48e8a6,_0x16dcb4){if(_0x48e8a6[_0xa167('0x64')]['id']){delete _0x48e8a6[_0xa167('0x64')]['id'];}return db[_0xa167('0x49')][_0xa167('0x63')]({'where':{'id':_0x48e8a6['params']['id']}})[_0xa167('0xf')](handleEntityNotFound(_0x16dcb4,null))[_0xa167('0xf')](function(_0x1be0bf){if(_0x1be0bf){_0x48e8a6[_0xa167('0x64')][_0xa167('0x6a')]=_0x1be0bf['id'];return db[_0xa167('0x44')][_0xa167('0x6c')](_0x48e8a6[_0xa167('0x64')]);}})['then'](respondWithResult(_0x16dcb4,null))[_0xa167('0x1a')](handleError(_0x16dcb4,null));};exports['removeImap']=function(_0x580d53,_0x567f54){return db[_0xa167('0x49')]['findOne']({'where':{'id':_0x580d53[_0xa167('0x61')]['id']}})[_0xa167('0xf')](handleEntityNotFound(_0x567f54,null))['then'](function(_0xc1b05f){if(_0xc1b05f){return _0xc1b05f[_0xa167('0x81')](null);}return null;})[_0xa167('0xf')](respondWithStatusCode(_0x567f54,null))[_0xa167('0x1a')](handleError(_0x567f54,null));};exports[_0xa167('0x82')]=function(_0x199211,_0x5e63e0){return db['MailAccount'][_0xa167('0x6e')]({'where':{'id':_0x199211[_0xa167('0x61')]['id']}})['then'](handleEntityNotFound(_0x5e63e0,null))[_0xa167('0xf')](function(_0x168d46){if(_0x168d46){return _0x168d46[_0xa167('0x82')]();}return null;})['then'](respondWithResult(_0x5e63e0,null))[_0xa167('0x1a')](handleError(_0x5e63e0,null));};exports['addSmtp']=function(_0x506bea,_0x1072f8){if(_0x506bea[_0xa167('0x64')]['id']){delete _0x506bea[_0xa167('0x64')]['id'];}return db[_0xa167('0x49')][_0xa167('0x63')]({'where':{'id':_0x506bea[_0xa167('0x61')]['id']}})[_0xa167('0xf')](handleEntityNotFound(_0x1072f8,null))['then'](function(_0x246515){if(_0x246515){_0x506bea[_0xa167('0x64')][_0xa167('0x6a')]=_0x246515['id'];return db['MailServerOut'][_0xa167('0x6c')](_0x506bea['body']);}})[_0xa167('0xf')](respondWithResult(_0x1072f8,null))[_0xa167('0x1a')](handleError(_0x1072f8,null));};exports['removeSmtp']=function(_0x288255,_0x163a73){return db[_0xa167('0x49')][_0xa167('0x6e')]({'where':{'id':_0x288255['params']['id']}})['then'](handleEntityNotFound(_0x163a73,null))[_0xa167('0xf')](function(_0x211864){if(_0x211864){return _0x211864[_0xa167('0x83')](null);}return null;})[_0xa167('0xf')](respondWithStatusCode(_0x163a73,null))[_0xa167('0x1a')](handleError(_0x163a73,null));};exports[_0xa167('0x84')]=function(_0x2b1b05,_0x2dee3d){return db[_0xa167('0x85')][_0xa167('0x63')]({'where':{'id':_0x2b1b05[_0xa167('0x61')]['id']}})['then'](handleEntityNotFound(_0x2dee3d,null))[_0xa167('0xf')](function(_0x100913){if(_0x100913){return _0x100913[_0xa167('0x84')](_0x2b1b05['body'][_0xa167('0x71')],_[_0xa167('0x86')](_0x2b1b05['body'],[_0xa167('0x71'),'id'])||{});}})[_0xa167('0xf')](respondWithResult(_0x2dee3d,null))[_0xa167('0x1a')](handleError(_0x2dee3d,null));};exports[_0xa167('0x87')]=function(_0x59a0a2,_0x2447f0){var _0x5a8919={'raw':![],'where':{}};var _0x156a5f={};var _0x4ebf90={'count':0x0,'rows':[]};return db[_0xa167('0x49')][_0xa167('0x6e')]({'where':{'id':_0x59a0a2[_0xa167('0x61')]['id']}})[_0xa167('0xf')](handleEntityNotFound(_0x2447f0,null))[_0xa167('0xf')](function(_0x5e3f84){if(_0x5e3f84){_0x156a5f[_0xa167('0x4c')]=_[_0xa167('0x4e')](db['MailInteraction']['rawAttributes']);_0x156a5f[_0xa167('0x4d')]=_['keys'](_0x59a0a2[_0xa167('0x4d')]);_0x156a5f[_0xa167('0x4f')]=_[_0xa167('0x51')](_0x156a5f[_0xa167('0x4c')],_0x156a5f[_0xa167('0x4d')]);_0x5a8919['attributes']=_[_0xa167('0x51')](_0x156a5f['model'],qs['fields'](_0x59a0a2[_0xa167('0x4d')][_0xa167('0x52')]));_0x5a8919[_0xa167('0x50')]=_0x5a8919[_0xa167('0x50')]['length']?_0x5a8919[_0xa167('0x50')]:_0x156a5f['model'];if(!_0x59a0a2[_0xa167('0x4d')][_0xa167('0x54')](_0xa167('0x55'))){_0x5a8919[_0xa167('0x20')]=qs['limit'](_0x59a0a2['query'][_0xa167('0x20')]);_0x5a8919[_0xa167('0x1e')]=qs[_0xa167('0x1e')](_0x59a0a2[_0xa167('0x4d')]['offset']);}_0x5a8919[_0xa167('0x56')]=qs['sort'](_0x59a0a2[_0xa167('0x4d')][_0xa167('0x57')]);_0x5a8919[_0xa167('0x58')]=qs['filters'](_[_0xa167('0x6f')](_0x59a0a2[_0xa167('0x4d')],_0x156a5f[_0xa167('0x4f')]));_0x5a8919[_0xa167('0x58')][_0xa167('0x6a')]=_0x5e3f84['id'];if(_0x59a0a2[_0xa167('0x4d')][_0xa167('0x59')]){_0x5a8919[_0xa167('0x58')]=_[_0xa167('0x5b')](_0x5a8919['where'],{'$or':_['map'](_0x5a8919[_0xa167('0x50')],function(_0xcbedad){var _0x2ab52c={};_0x2ab52c[_0xcbedad]={'$like':'%'+_0x59a0a2['query'][_0xa167('0x59')]+'%'};return _0x2ab52c;})});}_0x5a8919=_[_0xa167('0x5b')]({},_0x5a8919,_0x59a0a2[_0xa167('0x5c')]);return db[_0xa167('0x85')]['count']({'where':_0x5a8919[_0xa167('0x58')]})[_0xa167('0xf')](function(_0xc36f41){_0x4ebf90[_0xa167('0x21')]=_0xc36f41;if(_0x59a0a2[_0xa167('0x4d')][_0xa167('0x62')]){_0x5a8919[_0xa167('0x5d')]=[{'model':db[_0xa167('0x88')],'as':_0xa167('0x89'),'required':![]},{'model':db[_0xa167('0x8a')],'as':_0xa167('0x8b'),'attributes':[_0xa167('0x2a'),_0xa167('0x8c'),'internal'],'required':![]},{'model':db[_0xa167('0x8d')],'as':'Tags','attributes':['id','name',_0xa167('0x8e')],'where':_0x59a0a2[_0xa167('0x4d')]['tag']?{'id':_0x59a0a2[_0xa167('0x4d')][_0xa167('0x8f')]}:undefined,'required':_0x59a0a2[_0xa167('0x4d')][_0xa167('0x8f')]?!![]:![]}];}return db[_0xa167('0x85')]['findAll'](_0x5a8919);})['then'](function(_0x2490b6){_0x4ebf90['rows']=_0x2490b6;return _0x4ebf90;});}})[_0xa167('0xf')](respondWithFilteredResult(_0x2447f0,_0x5a8919))['catch'](handleError(_0x2447f0,null));};exports[_0xa167('0x90')]=function addApplications(_0x3d436f,_0x333c93){var _0x1fd1d4=_0x3d436f[_0xa167('0x61')]['id'];var _0x4d6a5b=_0x3d436f[_0xa167('0x64')];var _0x3894e0=0xc8;var _0x3d5ec0=null;return db[_0xa167('0x91')][_0xa167('0x92')]({'isolationLevel':db[_0xa167('0x91')]['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x3022cc){return db[_0xa167('0x49')][_0xa167('0x6e')]({'where':{'id':_0x1fd1d4},'transaction':_0x3022cc})['then'](function(_0x4b9d45){if(_0x4b9d45){return db[_0xa167('0x93')]['destroy']({'where':{'MailAccountId':_0x1fd1d4},'transaction':_0x3022cc})[_0xa167('0xf')](function(){var _0x599158=_[_0xa167('0x48')](_0x4d6a5b,function(_0x2626ad){_0x2626ad[_0xa167('0x6a')]=_0x1fd1d4;return _0x2626ad;});return db[_0xa167('0x93')]['bulkCreate'](_0x599158,{'transaction':_0x3022cc});});}else{_0x3894e0=0x194;_0x3d5ec0=[];}});})[_0xa167('0xf')](function(){if(_0x3894e0!==0x194){return db[_0xa167('0x93')]['findAndCountAll']({'where':{'MailAccountId':_0x1fd1d4},'order':_0xa167('0x94')})['then'](function(_0x44a2d9){_0x3d5ec0=_0x44a2d9;});}})[_0xa167('0x1a')](function(_0x341d46){_0x3894e0=0x1f4;logger[_0xa167('0x15')](_0x341d46[_0xa167('0x29')]);if(_0x341d46[_0xa167('0x2a')]){delete _0x341d46[_0xa167('0x2a')];}_0x3d5ec0=_0x341d46;})[_0xa167('0x95')](function(){if(_0x3d5ec0===null){_0x333c93['sendStatus'](_0x3894e0);}else{if(_0x3894e0===0x1f4){_0x333c93[_0xa167('0x22')](_0x3894e0)[_0xa167('0x2b')](_0x3d5ec0);}else{_0x333c93[_0xa167('0x22')](_0x3894e0)['json'](_0x3d5ec0);}}});};exports[_0xa167('0x96')]=function(_0x572869,_0x1e1ffc){var _0x2992a1={};var _0x5886b8={};var _0x6bb2e0;var _0x1d654e;return db[_0xa167('0x49')][_0xa167('0x6e')]({'where':{'id':_0x572869[_0xa167('0x61')]['id']}})[_0xa167('0xf')](handleEntityNotFound(_0x1e1ffc,null))[_0xa167('0xf')](function(_0x15a88b){if(_0x15a88b){_0x6bb2e0=_0x15a88b;_0x5886b8['model']=_[_0xa167('0x4e')](db['MailApplication']['rawAttributes']);_0x5886b8[_0xa167('0x4d')]=_[_0xa167('0x4e')](_0x572869[_0xa167('0x4d')]);_0x5886b8['filters']=_[_0xa167('0x51')](_0x5886b8[_0xa167('0x4c')],_0x5886b8[_0xa167('0x4d')]);_0x2992a1[_0xa167('0x50')]=_[_0xa167('0x51')](_0x5886b8[_0xa167('0x4c')],qs[_0xa167('0x52')](_0x572869[_0xa167('0x4d')][_0xa167('0x52')]));_0x2992a1[_0xa167('0x50')]=_0x2992a1[_0xa167('0x50')][_0xa167('0x53')]?_0x2992a1['attributes']:_0x5886b8[_0xa167('0x4c')];_0x2992a1[_0xa167('0x56')]=qs[_0xa167('0x57')](_0x572869[_0xa167('0x4d')]['sort']);_0x2992a1[_0xa167('0x58')]=qs[_0xa167('0x4f')](_['pick'](_0x572869[_0xa167('0x4d')],_0x5886b8['filters']));if(_0x572869[_0xa167('0x4d')][_0xa167('0x59')]){_0x2992a1[_0xa167('0x58')]=_[_0xa167('0x5b')](_0x2992a1[_0xa167('0x58')],{'$or':_[_0xa167('0x48')](_0x2992a1[_0xa167('0x50')],function(_0x1911d1){var _0x39c7dc={};_0x39c7dc[_0x1911d1]={'$like':'%'+_0x572869[_0xa167('0x4d')]['filter']+'%'};return _0x39c7dc;})});}_0x2992a1=_[_0xa167('0x5b')]({},_0x2992a1,_0x572869[_0xa167('0x5c')]);return _0x6bb2e0[_0xa167('0x96')](_0x2992a1);}})[_0xa167('0xf')](function(_0x9b1476){if(_0x9b1476){_0x1d654e=_0x9b1476['length'];if(!_0x572869['query'][_0xa167('0x54')](_0xa167('0x55'))){_0x2992a1[_0xa167('0x20')]=qs[_0xa167('0x20')](_0x572869['query'][_0xa167('0x20')]);_0x2992a1['offset']=qs['offset'](_0x572869[_0xa167('0x4d')][_0xa167('0x1e')]);}return _0x6bb2e0['getApplications'](_0x2992a1);}})['then'](function(_0x1993c1){if(_0x1993c1){return _0x1993c1?{'count':_0x1d654e,'rows':_0x1993c1}:null;}})[_0xa167('0xf')](respondWithResult(_0x1e1ffc,null))[_0xa167('0x1a')](handleError(_0x1e1ffc,null));};exports[_0xa167('0x97')]=function(_0x5254f8,_0x44168d){var _0x13d6ae={'raw':!![],'where':{}};var _0x3bfaaf={};var _0xab0f1d={'count':0x0,'rows':[]};return db[_0xa167('0x49')][_0xa167('0x6e')]({'where':{'id':_0x5254f8['params']['id']}})['then'](handleEntityNotFound(_0x44168d,null))[_0xa167('0xf')](function(_0x24f679){if(_0x24f679){_0x3bfaaf[_0xa167('0x4c')]=_[_0xa167('0x4e')](db[_0xa167('0x98')]['rawAttributes']);_0x3bfaaf[_0xa167('0x4d')]=_[_0xa167('0x4e')](_0x5254f8[_0xa167('0x4d')]);_0x3bfaaf[_0xa167('0x4f')]=_[_0xa167('0x51')](_0x3bfaaf['model'],_0x3bfaaf[_0xa167('0x4d')]);_0x13d6ae[_0xa167('0x50')]=_['intersection'](_0x3bfaaf[_0xa167('0x4c')],qs[_0xa167('0x52')](_0x5254f8[_0xa167('0x4d')][_0xa167('0x52')]));_0x13d6ae[_0xa167('0x50')]=_0x13d6ae[_0xa167('0x50')]['length']?_0x13d6ae['attributes']:_0x3bfaaf[_0xa167('0x4c')];if(!_0x5254f8[_0xa167('0x4d')][_0xa167('0x54')](_0xa167('0x55'))){_0x13d6ae['limit']=qs[_0xa167('0x20')](_0x5254f8[_0xa167('0x4d')][_0xa167('0x20')]);_0x13d6ae['offset']=qs[_0xa167('0x1e')](_0x5254f8[_0xa167('0x4d')][_0xa167('0x1e')]);}_0x13d6ae[_0xa167('0x56')]=qs['sort'](_0x5254f8[_0xa167('0x4d')]['sort']);_0x13d6ae[_0xa167('0x58')]=qs['filters'](_[_0xa167('0x6f')](_0x5254f8[_0xa167('0x4d')],_0x3bfaaf[_0xa167('0x4f')]));_0x13d6ae[_0xa167('0x58')]['MailAccountId']=_0x24f679['id'];if(_0x5254f8[_0xa167('0x4d')][_0xa167('0x59')]){_0x13d6ae[_0xa167('0x58')]=_['merge'](_0x13d6ae[_0xa167('0x58')],{'$or':_[_0xa167('0x48')](_0x13d6ae['attributes'],function(_0x5a76a0){var _0x4d6f1f={};_0x4d6f1f[_0x5a76a0]={'$like':'%'+_0x5254f8[_0xa167('0x4d')][_0xa167('0x59')]+'%'};return _0x4d6f1f;})});}if(_0x5254f8[_0xa167('0x4d')][_0xa167('0x99')]){var _0x5a564f=_0x5254f8['query'][_0xa167('0x99')][_0xa167('0x9a')](',');var _0x2bc3c2={};_0x2bc3c2[_0x5a564f[0x0]]={'$gte':moment(_0x5a564f[0x1])['format'](_0xa167('0x9b'))};_0x13d6ae[_0xa167('0x58')]=_[_0xa167('0x5b')](_0x13d6ae[_0xa167('0x58')],_0x2bc3c2);}_0x13d6ae=_[_0xa167('0x5b')]({},_0x13d6ae,_0x5254f8[_0xa167('0x5c')]);return db[_0xa167('0x98')][_0xa167('0x21')]({'where':_0x13d6ae['where']})[_0xa167('0xf')](function(_0x321f58){_0xab0f1d['count']=_0x321f58;if(_0x5254f8[_0xa167('0x4d')][_0xa167('0x62')]){_0x13d6ae[_0xa167('0x5d')]=[{'all':!![]}];}return db['MailMessage'][_0xa167('0x5e')](_0x13d6ae);})[_0xa167('0xf')](function(_0x1a39be){if(_0x5254f8[_0xa167('0x4d')][_0xa167('0x9c')]===_0xa167('0x9d')){for(var _0x19d2a5=0x0;_0x19d2a5<_0x1a39be['length'];_0x19d2a5++){_0x1a39be[_0x19d2a5][_0xa167('0x64')]=juice(_0x1a39be[_0x19d2a5][_0xa167('0x64')]);}}_0xab0f1d[_0xa167('0x5f')]=_0x1a39be;return _0xab0f1d;});}})[_0xa167('0xf')](respondWithFilteredResult(_0x44168d,_0x13d6ae))['catch'](handleError(_0x44168d,null));};exports['send']=function(_0x3264cc,_0x54e389){var _0x555e70,_0x35f0c5={},_0x2e8b65;if(_0x3264cc[_0xa167('0x64')]['to']){_0x2e8b65=_0x3264cc[_0xa167('0x64')]['to'][_0xa167('0x9a')](',')[0x0];}return db[_0xa167('0x49')][_0xa167('0x63')]({'where':{'id':_0x3264cc['params']['id']},'include':[{'model':db[_0xa167('0x9e')],'as':_0xa167('0x9f'),'include':[{'model':db['CmContact'],'as':_0xa167('0xa0'),'where':{'email':_0x2e8b65},'limit':0x1,'order':[[_0xa167('0xa1'),_0xa167('0xa2')]]}]},{'model':db[_0xa167('0x45')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xa167('0xa3')],'as':'CloudProvider','raw':!![]}]}]})[_0xa167('0xf')](handleEntityNotFound(_0x54e389,null))['then'](function(_0x40dbaf){if(!_0x40dbaf)return;_0x555e70=_0x40dbaf;if(!_0x40dbaf[_0xa167('0x43')])throw new Error(_0xa167('0xa4'));if(_[_0xa167('0x77')](_0x3264cc[_0xa167('0x64')][_0xa167('0xa5')])){_0x3264cc['body'][_0xa167('0xa5')]=util[_0xa167('0xa6')]('%s\x20<%s>',_0x40dbaf['name'],_0x40dbaf['email']||_0x40dbaf[_0xa167('0x43')]['user']);}if(_0x3264cc['body'][_0xa167('0xa7')]&&_0x3264cc['body']['attachments']['length']){for(var _0xfe10c2=0x0;_0xfe10c2<_0x3264cc[_0xa167('0x64')][_0xa167('0xa7')][_0xa167('0x53')];_0xfe10c2+=0x1){_0x3264cc['body'][_0xa167('0xa7')][_0xfe10c2]={'filename':_0x3264cc[_0xa167('0x64')][_0xa167('0xa7')][_0xfe10c2][_0xa167('0x2a')],'path':path[_0xa167('0xa8')](config[_0xa167('0xa9')],_0xa167('0xaa'),_0x3264cc['body'][_0xa167('0xa7')][_0xfe10c2]['basename'])};}}var _0x2cfaff=_0x40dbaf[_0xa167('0xab')]();return respondWithRpcPromise(_0xa167('0xac'),_0xa167('0xad'),{'account':_0x2cfaff,'message':_0x3264cc[_0xa167('0x64')]});})[_0xa167('0xf')](function(_0x303576){if(!_0x303576)return;_0x35f0c5=_0x303576;if(!_0x555e70['List'])throw new Error(_0xa167('0xae'));if(_0x555e70[_0xa167('0x9f')]['Contacts'][_0xa167('0x53')])return _0x555e70['List'][_0xa167('0xa0')][0x0];return db[_0xa167('0x88')][_0xa167('0x6c')](_[_0xa167('0xaf')](_0x3264cc['body'],{'firstName':_0x3264cc['body']['to'],'email':_0x3264cc['body']['to'],'phone':_0x3264cc['body']['to'],'ListId':_0x555e70[_0xa167('0xb0')]}));})[_0xa167('0xf')](function(_0x4d94b2){if(!_0x4d94b2)return;var _0x316317={'UserId':_0x3264cc[_0xa167('0x37')]['id'],'ContactId':_0x4d94b2['id'],'MailAccountId':_0x555e70['id'],'inReplyTo':_0x35f0c5[_0xa167('0xb1')],'to':_0x3264cc[_0xa167('0x64')]['from'],'cc':_0x3264cc[_0xa167('0x64')]['cc'],'subject':_0x3264cc[_0xa167('0x64')][_0xa167('0xb2')],'attach':_0x3264cc[_0xa167('0x64')][_0xa167('0xb3')],'firstMsgDirection':_0xa167('0xb4'),'lastMsgAt':moment()[_0xa167('0xa6')](_0xa167('0x9b')),'lastMsgDirection':_0xa167('0xb4'),'Messages':[_[_0xa167('0x5b')](_0x3264cc[_0xa167('0x64')],{'messageId':_0x35f0c5['messageId'],'sentAt':moment()[_0xa167('0xa6')](_0xa167('0x9b')),'read':!![],'MailAccountId':_0x555e70['id'],'UserId':_0x3264cc[_0xa167('0x37')]['id'],'ContactId':_0x4d94b2['id']})]};if(_0x3264cc[_0xa167('0x64')][_0xa167('0xb5')]){_0x316317=_[_0xa167('0x5b')](_0x316317,_0x3264cc['body'][_0xa167('0xb5')]);}return db[_0xa167('0x85')][_0xa167('0x6c')](_0x316317,{'include':[{'model':db[_0xa167('0x98')],'as':_0xa167('0xb6')}]});})[_0xa167('0xf')](respondWithResult(_0x54e389,null))[_0xa167('0x1a')](handleError(_0x54e389,null));};exports[_0xa167('0xb7')]=function(_0x433ed6,_0x41005b){return db[_0xa167('0x49')][_0xa167('0x63')]({'where':{'id':_0x433ed6[_0xa167('0x61')]['id']},'include':[{'model':db[_0xa167('0x45')],'as':_0xa167('0x43'),'raw':!![],'include':[{'model':db[_0xa167('0xa3')],'as':_0xa167('0xa3'),'raw':!![]}]}]})[_0xa167('0xf')](handleEntityNotFound(_0x41005b,null))[_0xa167('0xf')](function(_0x453c1a){if(!_0x453c1a[_0xa167('0x43')])return;var _0x4d54eb=_0x453c1a[_0xa167('0xab')]();return respondWithRpcPromise(_0xa167('0xb8'),_0xa167('0xb7'),{'account':_0x4d54eb});})[_0xa167('0xf')](respondWithResult(_0x41005b,null))[_0xa167('0x1a')](handleError(_0x41005b,null));};exports['destroy']=function(_0x12ac22,_0xa72ff0){return db['MailAccount'][_0xa167('0x63')]({'where':{'id':_0x12ac22[_0xa167('0x61')]['id']}})['then'](handleEntityNotFound(_0xa72ff0,null))[_0xa167('0xf')](function(_0x3aa9bf){if(_0x3aa9bf&&_0x3aa9bf[_0xa167('0x3f')]){throw new db['Sequelize']['ValidationError'](_0xa167('0xb9'));}return _0x3aa9bf;})[_0xa167('0xf')](removeEntity(_0xa72ff0,null))[_0xa167('0x1a')](handleError(_0xa72ff0,null));};exports['addAgents']=function(_0x130ec6,_0x540c74){return db[_0xa167('0x49')][_0xa167('0x63')]({'where':{'id':_0x130ec6[_0xa167('0x61')]['id']}})[_0xa167('0xf')](handleEntityNotFound(_0x540c74,null))[_0xa167('0xf')](function(_0x478b20){if(_0x478b20){return _0x478b20[_0xa167('0xba')](_0x130ec6[_0xa167('0x64')][_0xa167('0x71')],_[_0xa167('0x86')](_0x130ec6[_0xa167('0x64')],[_0xa167('0x71'),'id'])||{})[_0xa167('0xbb')](function(_0xf3bba7){for(var _0x19d162=0x0;_0x19d162<_0x130ec6[_0xa167('0x64')]['ids'][_0xa167('0x53')];_0x19d162+=0x1){socket['emit'](_0xa167('0xbc'),{'UserId':Number(_0x130ec6[_0xa167('0x64')][_0xa167('0x71')][_0x19d162]),'MailAccountId':Number(_0x130ec6[_0xa167('0x61')]['id'])});}return _0xf3bba7;});}})[_0xa167('0xf')](respondWithResult(_0x540c74,null))['catch'](handleError(_0x540c74,null));};exports[_0xa167('0xbd')]=function(_0x22a7de,_0x137d16){return db[_0xa167('0x49')]['find']({'where':{'id':_0x22a7de[_0xa167('0x61')]['id']}})[_0xa167('0xf')](handleEntityNotFound(_0x137d16,null))[_0xa167('0xf')](function(_0x503263){if(_0x503263){return _0x503263[_0xa167('0xbd')](_0x22a7de[_0xa167('0x4d')]['ids'])['then'](function(){if(_[_0xa167('0xbe')](_0x22a7de[_0xa167('0x4d')]['ids'])){for(var _0x1058a4=0x0;_0x1058a4<_0x22a7de[_0xa167('0x4d')][_0xa167('0x71')][_0xa167('0x53')];_0x1058a4+=0x1){socket[_0xa167('0xbf')]('userMailAccount:remove',{'UserId':Number(_0x22a7de[_0xa167('0x4d')][_0xa167('0x71')][_0x1058a4]),'MailAccountId':Number(_0x22a7de[_0xa167('0x61')]['id'])});}}else{socket[_0xa167('0xbf')](_0xa167('0xc0'),{'UserId':Number(_0x22a7de[_0xa167('0x4d')]['ids']),'MailAccountId':Number(_0x22a7de[_0xa167('0x61')]['id'])});}});}})['then'](respondWithStatusCode(_0x137d16,null))[_0xa167('0x1a')](handleError(_0x137d16,null));};exports[_0xa167('0xc1')]=function(_0x3f48e0,_0x3947e0){var _0x4c89f={};var _0x3a7d55={};var _0x3f1c84;var _0xf1f93d;return db[_0xa167('0x49')][_0xa167('0x6e')]({'where':{'id':_0x3f48e0[_0xa167('0x61')]['id']}})[_0xa167('0xf')](handleEntityNotFound(_0x3947e0,null))[_0xa167('0xf')](function(_0x28da15){if(_0x28da15){_0x3f1c84=_0x28da15;_0x3a7d55['model']=_[_0xa167('0x4e')](db[_0xa167('0x8a')][_0xa167('0x4a')]);_0x3a7d55[_0xa167('0x4d')]=_[_0xa167('0x4e')](_0x3f48e0[_0xa167('0x4d')]);_0x3a7d55[_0xa167('0x4f')]=_[_0xa167('0x51')](_0x3a7d55[_0xa167('0x4c')],_0x3a7d55[_0xa167('0x4d')]);_0x4c89f['attributes']=_['intersection'](_0x3a7d55[_0xa167('0x4c')],qs[_0xa167('0x52')](_0x3f48e0[_0xa167('0x4d')]['fields']));_0x4c89f[_0xa167('0x50')]=_0x4c89f[_0xa167('0x50')]['length']?_0x4c89f[_0xa167('0x50')]:_0x3a7d55[_0xa167('0x4c')];_0x4c89f[_0xa167('0x56')]=qs[_0xa167('0x57')](_0x3f48e0[_0xa167('0x4d')]['sort']);_0x4c89f[_0xa167('0x58')]=qs[_0xa167('0x4f')](_[_0xa167('0x6f')](_0x3f48e0['query'],_0x3a7d55[_0xa167('0x4f')]));if(_0x3f48e0['query']['filter']){_0x4c89f[_0xa167('0x58')]=_[_0xa167('0x5b')](_0x4c89f[_0xa167('0x58')],{'$or':_[_0xa167('0x48')](_0x4c89f['attributes'],function(_0x26f7ee){var _0x1c84b0={};_0x1c84b0[_0x26f7ee]={'$like':'%'+_0x3f48e0['query'][_0xa167('0x59')]+'%'};return _0x1c84b0;})});}_0x4c89f=_[_0xa167('0x5b')]({},_0x4c89f,_0x3f48e0[_0xa167('0x5c')]);return _0x3f1c84[_0xa167('0xc1')](_0x4c89f);}})[_0xa167('0xf')](function(_0x22ac2e){if(_0x22ac2e){_0xf1f93d=_0x22ac2e[_0xa167('0x53')];if(!_0x3f48e0[_0xa167('0x4d')]['hasOwnProperty'](_0xa167('0x55'))){_0x4c89f['limit']=qs[_0xa167('0x20')](_0x3f48e0[_0xa167('0x4d')][_0xa167('0x20')]);_0x4c89f[_0xa167('0x1e')]=qs['offset'](_0x3f48e0['query']['offset']);}return _0x3f1c84['getAgents'](_0x4c89f);}})['then'](function(_0x17d9dc){if(_0x17d9dc){return _0x17d9dc?{'count':_0xf1f93d,'rows':_0x17d9dc}:null;}})[_0xa167('0xf')](respondWithResult(_0x3947e0,null))[_0xa167('0x1a')](handleError(_0x3947e0,null));}; \ No newline at end of file +var _0x5c08=['util','path','lodash','juice','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','end','status','count','offset','limit','set','Content-Range','json','update','MailAccounts','UserProfileResource','destroy','stack','name','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','Unknown\x20email\x20service\x20provider','gmail','smtp.mail.yahoo.com','smtp-mail.outlook.com','outlook365','smtp.office365.com','user','username','password','modernAuthentication','CloudProviderId','pass','host','port','secure','service','authentication','Imap','Smtp','index','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','show','params','MailServerIn','include','find','catch','body','provider','custom','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','create','getDispositions','findOne','Disposition','order','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','email','ListId','isNil','active','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','addSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','priority','finally','send','getApplications','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','true','CmList','List','Contacts','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','from','format','%s\x20<%s>','attachments','join','root','basename','sendMail','List\x20not\x20found','subject','attach','out','Interaction','Messages','getSmtpOptions','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','bluebird'];(function(_0x352337,_0x21bcc1){var _0x4a147b=function(_0x1f551b){while(--_0x1f551b){_0x352337['push'](_0x352337['shift']());}};_0x4a147b(++_0x21bcc1);}(_0x5c08,0x18d));var _0x85c0=function(_0x341569,_0x1edec3){_0x341569=_0x341569-0x0;var _0x2cb5c7=_0x5c08[_0x341569];return _0x2cb5c7;};'use strict';var moment=require('moment');var BPromise=require(_0x85c0('0x0'));var util=require(_0x85c0('0x1'));var path=require(_0x85c0('0x2'));var _=require(_0x85c0('0x3'));var juice=require(_0x85c0('0x4'));var Redis=require(_0x85c0('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x85c0('0x6'))(_0x85c0('0x7'));var config=require(_0x85c0('0x8'));var db=require(_0x85c0('0x9'))['db'];config[_0x85c0('0xa')]=_[_0x85c0('0xb')](config[_0x85c0('0xa')],{'host':_0x85c0('0xc'),'port':0x18eb});var socket=require(_0x85c0('0xd'))(new Redis(config[_0x85c0('0xa')]));require(_0x85c0('0xe'))[_0x85c0('0xf')](socket);var jayson=require(_0x85c0('0x10'));var client=jayson[_0x85c0('0x11')][_0x85c0('0x12')]({'port':0x232b});function respondWithRpcPromise(_0x4ba7f2,_0x8ca7d9,_0x299634,_0x545b3d){return new BPromise(function(_0x389ba3,_0x537e67){var _0x246081=_0x545b3d||client;return _0x246081[_0x85c0('0x13')](_0x4ba7f2,_0x299634)[_0x85c0('0x14')](function(_0x26f364){logger[_0x85c0('0x15')](_0x85c0('0x16'),_0x8ca7d9,_0x85c0('0x17'));logger[_0x85c0('0x18')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x8ca7d9,_0x85c0('0x17'),JSON[_0x85c0('0x19')](_0x26f364));if(_0x26f364['error']){if(_0x26f364[_0x85c0('0x1a')][_0x85c0('0x1b')]===0x1f4){logger[_0x85c0('0x1a')](_0x85c0('0x16'),_0x8ca7d9,_0x26f364['error'][_0x85c0('0x1c')]);return _0x537e67(_0x26f364[_0x85c0('0x1a')][_0x85c0('0x1c')]);}logger[_0x85c0('0x1a')](_0x85c0('0x16'),_0x8ca7d9,_0x26f364['error']['message']);return _0x389ba3(_0x26f364[_0x85c0('0x1a')]['message']);}else{logger['info'](_0x85c0('0x16'),_0x8ca7d9,_0x85c0('0x17'));_0x389ba3(_0x26f364[_0x85c0('0x1d')][_0x85c0('0x1c')]);}})['catch'](function(_0x2b665d){logger[_0x85c0('0x1a')](_0x85c0('0x16'),_0x8ca7d9,_0x2b665d);_0x537e67(_0x2b665d);});});}function respondWithStatusCode(_0x1c8b08,_0x4e35cb){_0x4e35cb=_0x4e35cb||0xcc;return function(_0x27a13f){if(_0x27a13f){return _0x1c8b08[_0x85c0('0x1e')](_0x4e35cb);}return _0x1c8b08['status'](_0x4e35cb)[_0x85c0('0x1f')]();};}function respondWithResult(_0x478458,_0x38b5e3){_0x38b5e3=_0x38b5e3||0xc8;return function(_0x9fc458){if(_0x9fc458){return _0x478458[_0x85c0('0x20')](_0x38b5e3)['json'](_0x9fc458);}};}function respondWithFilteredResult(_0x437143,_0x2181c7){return function(_0x1f1806){if(_0x1f1806){var _0x274f4b=typeof _0x2181c7['offset']==='undefined'&&typeof _0x2181c7['limit']==='undefined';var _0x294d5b=_0x1f1806[_0x85c0('0x21')];var _0x404a9e=_0x274f4b?0x0:_0x2181c7[_0x85c0('0x22')];var _0x50b108=_0x274f4b?_0x1f1806[_0x85c0('0x21')]:_0x2181c7['offset']+_0x2181c7[_0x85c0('0x23')];var _0x55a210;if(_0x50b108>=_0x294d5b){_0x50b108=_0x294d5b;_0x55a210=0xc8;}else{_0x55a210=0xce;}_0x437143['status'](_0x55a210);return _0x437143[_0x85c0('0x24')](_0x85c0('0x25'),_0x404a9e+'-'+_0x50b108+'/'+_0x294d5b)[_0x85c0('0x26')](_0x1f1806);}return null;};}function saveUpdates(_0x2696d6){return function(_0x8c61e5){if(_0x8c61e5){return _0x8c61e5[_0x85c0('0x27')](_0x2696d6)[_0x85c0('0x14')](function(_0x4f1754){return _0x4f1754;});}return null;};}function removeEntity(_0x28a133){return function(_0x155e18){if(_0x155e18){return _0x155e18['destroy']()[_0x85c0('0x14')](function(){var _0x5e1c0c=_0x155e18['get']({'plain':!![]});var _0x53a107=_0x85c0('0x28');return db[_0x85c0('0x29')][_0x85c0('0x2a')]({'where':{'type':_0x53a107,'resourceId':_0x5e1c0c['id']}})['then'](function(){return _0x155e18;});})['then'](function(){_0x28a133[_0x85c0('0x20')](0xcc)[_0x85c0('0x1f')]();});}};}function handleEntityNotFound(_0x4ea58c){return function(_0x6ab9cf){if(!_0x6ab9cf){_0x4ea58c[_0x85c0('0x1e')](0x194);}return _0x6ab9cf;};}function handleError(_0x41d21d,_0x16521f){_0x16521f=_0x16521f||0x1f4;return function(_0x1748fc){logger[_0x85c0('0x1a')](_0x1748fc[_0x85c0('0x2b')]);if(_0x1748fc[_0x85c0('0x2c')]){delete _0x1748fc[_0x85c0('0x2c')];}_0x41d21d['status'](_0x16521f)['send'](_0x1748fc);};}function getImapHost(_0x36e335){switch(_0x36e335){case'gmail':return _0x85c0('0x2d');case _0x85c0('0x2e'):return _0x85c0('0x2f');case _0x85c0('0x30'):return _0x85c0('0x31');case'outlook365':return'outlook.office365.com';}throw new Error(_0x85c0('0x32'),_0x36e335);}function getSmtpHost(_0x1dedd0){switch(_0x1dedd0){case _0x85c0('0x33'):return'smtp.gmail.com';case _0x85c0('0x2e'):return _0x85c0('0x34');case _0x85c0('0x30'):return _0x85c0('0x35');case _0x85c0('0x36'):return _0x85c0('0x37');}throw new Error(_0x85c0('0x32'),_0x1dedd0);}function getAuthenticationOptions(_0x43f67a,_0x1f4808){var _0x163c9d={};var _0x5b5f77={};if(_0x43f67a){_0x163c9d[_0x85c0('0x38')]=_0x5b5f77['user']=_0x1f4808[_0x85c0('0x39')];_0x163c9d[_0x85c0('0x3a')]=_0x5b5f77['pass']=_0x1f4808[_0x85c0('0x3a')];if(_0x1f4808[_0x85c0('0x3b')]){_0x163c9d['modernAuthentication']=_0x5b5f77[_0x85c0('0x3b')]=!![];_0x163c9d[_0x85c0('0x3c')]=_0x5b5f77[_0x85c0('0x3c')]=_0x1f4808[_0x85c0('0x3c')];_0x163c9d[_0x85c0('0x3a')]=_0x5b5f77[_0x85c0('0x3d')]=null;}else{_0x163c9d['CloudProviderId']=_0x5b5f77[_0x85c0('0x3c')]=null;}_0x163c9d[_0x85c0('0x3e')]=getImapHost(_0x43f67a);_0x163c9d['port']=0x3e1;_0x5b5f77[_0x85c0('0x3e')]=getSmtpHost(_0x43f67a);_0x5b5f77[_0x85c0('0x3f')]=0x24b;_0x5b5f77[_0x85c0('0x40')]=![];_0x163c9d[_0x85c0('0x41')]=_0x5b5f77[_0x85c0('0x41')]=null;}else{if(_0x1f4808[_0x85c0('0x42')]){_0x163c9d['user']=_0x5b5f77[_0x85c0('0x38')]=_0x1f4808[_0x85c0('0x39')];_0x163c9d['password']=_0x5b5f77[_0x85c0('0x3d')]=_0x1f4808[_0x85c0('0x3a')];}else{_0x163c9d[_0x85c0('0x42')]=_0x5b5f77[_0x85c0('0x42')]=![];_0x163c9d['user']=_0x5b5f77[_0x85c0('0x38')]=null;_0x163c9d[_0x85c0('0x3a')]=_0x5b5f77[_0x85c0('0x3d')]=null;}_0x163c9d[_0x85c0('0x3e')]=_0x1f4808['Imap'][_0x85c0('0x3e')];_0x163c9d['port']=_0x1f4808[_0x85c0('0x43')][_0x85c0('0x3f')];_0x5b5f77[_0x85c0('0x3e')]=_0x1f4808[_0x85c0('0x44')]['host'];_0x5b5f77[_0x85c0('0x3f')]=_0x1f4808[_0x85c0('0x44')]['port'];}return{'Imap':_0x163c9d,'Smtp':_0x5b5f77};}exports[_0x85c0('0x45')]=function(_0x2e99ec,_0x100117){var _0x25f083={'include':[{'model':db['MailServerIn'],'as':_0x85c0('0x43')},{'model':db[_0x85c0('0x46')],'as':_0x85c0('0x44')},{'model':db[_0x85c0('0x47')],'as':_0x85c0('0x48')}]},_0x2eaf09={},_0xecf5cd={'count':0x0,'rows':[]};var _0x32ba11=_[_0x85c0('0x49')](db[_0x85c0('0x4a')][_0x85c0('0x4b')],function(_0x233cfa){return{'name':_0x233cfa[_0x85c0('0x4c')],'type':_0x233cfa[_0x85c0('0x4d')][_0x85c0('0x4e')]};});_0x2eaf09['model']=_[_0x85c0('0x49')](_0x32ba11,_0x85c0('0x2c'));_0x2eaf09[_0x85c0('0x4f')]=_[_0x85c0('0x50')](_0x2e99ec[_0x85c0('0x4f')]);_0x2eaf09[_0x85c0('0x51')]=_[_0x85c0('0x52')](_0x2eaf09[_0x85c0('0x53')],_0x2eaf09['query']);_0x25f083[_0x85c0('0x54')]=_[_0x85c0('0x52')](_0x2eaf09[_0x85c0('0x53')],qs['fields'](_0x2e99ec['query'][_0x85c0('0x55')]));_0x25f083[_0x85c0('0x54')]=_0x25f083[_0x85c0('0x54')][_0x85c0('0x56')]?_0x25f083[_0x85c0('0x54')]:_0x2eaf09[_0x85c0('0x53')];if(!_0x2e99ec[_0x85c0('0x4f')][_0x85c0('0x57')](_0x85c0('0x58'))){_0x25f083['limit']=qs['limit'](_0x2e99ec[_0x85c0('0x4f')][_0x85c0('0x23')]);_0x25f083[_0x85c0('0x22')]=qs[_0x85c0('0x22')](_0x2e99ec[_0x85c0('0x4f')][_0x85c0('0x22')]);}_0x25f083['order']=qs[_0x85c0('0x59')](_0x2e99ec[_0x85c0('0x4f')][_0x85c0('0x59')]);_0x25f083['where']=qs['filters'](_['pick'](_0x2e99ec[_0x85c0('0x4f')],_0x2eaf09[_0x85c0('0x51')]),_0x32ba11);if(_0x2e99ec[_0x85c0('0x4f')][_0x85c0('0x5a')]){_0x25f083[_0x85c0('0x5b')]=_[_0x85c0('0x5c')](_0x25f083[_0x85c0('0x5b')],{'$or':_['map'](_0x32ba11,function(_0x6a0268){if(_0x6a0268['type']!==_0x85c0('0x5d')){var _0x3461e1={};_0x3461e1[_0x6a0268[_0x85c0('0x2c')]]={'$like':'%'+_0x2e99ec[_0x85c0('0x4f')][_0x85c0('0x5a')]+'%'};return _0x3461e1;}})});}_0x25f083=_['merge']({},_0x25f083,_0x2e99ec[_0x85c0('0x5e')]);var _0x5e435e={'where':_0x25f083[_0x85c0('0x5b')]};return db[_0x85c0('0x4a')]['count'](_0x5e435e)['then'](function(_0x573d3a){_0xecf5cd[_0x85c0('0x21')]=_0x573d3a;if(_0x2e99ec['query'][_0x85c0('0x5f')]){_0x25f083['include']=[{'all':!![]}];}return db[_0x85c0('0x4a')][_0x85c0('0x60')](_0x25f083);})[_0x85c0('0x14')](function(_0x46e690){_0xecf5cd['rows']=_0x46e690;return _0xecf5cd;})[_0x85c0('0x14')](respondWithFilteredResult(_0x100117,_0x25f083))['catch'](handleError(_0x100117,null));};exports[_0x85c0('0x61')]=function(_0x3fa67d,_0x1a6d81){var _0x123004={'raw':![],'where':{'id':_0x3fa67d[_0x85c0('0x62')]['id']},'include':[{'model':db[_0x85c0('0x63')],'as':_0x85c0('0x43')},{'model':db[_0x85c0('0x46')],'as':_0x85c0('0x44')},{'model':db['Pause'],'as':_0x85c0('0x48')}]},_0x27ccea={};_0x27ccea[_0x85c0('0x53')]=_[_0x85c0('0x50')](db[_0x85c0('0x4a')]['rawAttributes']);_0x27ccea['query']=_[_0x85c0('0x50')](_0x3fa67d['query']);_0x27ccea['filters']=_[_0x85c0('0x52')](_0x27ccea[_0x85c0('0x53')],_0x27ccea[_0x85c0('0x4f')]);_0x123004[_0x85c0('0x54')]=_[_0x85c0('0x52')](_0x27ccea[_0x85c0('0x53')],qs[_0x85c0('0x55')](_0x3fa67d[_0x85c0('0x4f')]['fields']));_0x123004['attributes']=_0x123004[_0x85c0('0x54')]['length']?_0x123004[_0x85c0('0x54')]:_0x27ccea[_0x85c0('0x53')];if(_0x3fa67d['query'][_0x85c0('0x5f')]){_0x123004[_0x85c0('0x64')]=[{'all':!![]}];}_0x123004=_[_0x85c0('0x5c')]({},_0x123004,_0x3fa67d[_0x85c0('0x5e')]);return db[_0x85c0('0x4a')][_0x85c0('0x65')](_0x123004)[_0x85c0('0x14')](handleEntityNotFound(_0x1a6d81,null))[_0x85c0('0x14')](respondWithResult(_0x1a6d81,null))[_0x85c0('0x66')](handleError(_0x1a6d81,null));};exports['update']=function(_0x25f937,_0x50577a){if(_0x25f937['body']['id']){delete _0x25f937[_0x85c0('0x67')]['id'];}var _0xcd068b=_0x25f937[_0x85c0('0x67')][_0x85c0('0x68')]===_0x85c0('0x69')?null:_0x25f937[_0x85c0('0x67')][_0x85c0('0x68')];var _0x1e1742=_0x25f937[_0x85c0('0x67')][_0x85c0('0x43')]||{};var _0x845748=_0x25f937[_0x85c0('0x67')][_0x85c0('0x44')]||{};if(_0xcd068b){_0x1e1742[_0x85c0('0x3e')]=getImapHost(_0xcd068b);_0x1e1742[_0x85c0('0x3f')]=0x3e1;_0x845748[_0x85c0('0x3e')]=getSmtpHost(_0xcd068b);_0x845748[_0x85c0('0x3f')]=0x24b;_0x845748[_0x85c0('0x40')]=![];}if(_0x845748['modernAuthentication']){_0x845748[_0x85c0('0x40')]=![];}else{_0x845748[_0x85c0('0x3c')]=null;}if(!_0x1e1742['modernAuthentication'])_0x1e1742['CloudProviderId']=null;_0x25f937[_0x85c0('0x67')][_0x85c0('0x43')]=_0x1e1742;_0x25f937[_0x85c0('0x67')][_0x85c0('0x44')]=_0x845748;return db['MailAccount'][_0x85c0('0x65')]({'where':{'id':_0x25f937[_0x85c0('0x62')]['id']},'include':[{'model':db[_0x85c0('0x63')],'as':_0x85c0('0x43')},{'model':db[_0x85c0('0x46')],'as':'Smtp'},{'model':db[_0x85c0('0x47')],'as':_0x85c0('0x48')}]})[_0x85c0('0x14')](handleEntityNotFound(_0x50577a,null))[_0x85c0('0x14')](function(_0x2a084d){if(!_0x2a084d)throw new Error(_0x85c0('0x6a'));if(_0x2a084d[_0x85c0('0x41')])delete _0x25f937[_0x85c0('0x67')]['Imap'];return _0x2a084d;})[_0x85c0('0x14')](saveUpdates(_0x25f937['body'],null))[_0x85c0('0x14')](function(_0x16b201){if(!_0x25f937[_0x85c0('0x67')][_0x85c0('0x43')])return _0x16b201;return db[_0x85c0('0x63')]['update'](_0x25f937[_0x85c0('0x67')][_0x85c0('0x43')],{'where':{'MailAccountId':_0x16b201['id']}})[_0x85c0('0x14')](function(){return _0x16b201;});})[_0x85c0('0x14')](function(_0x34b4a6){if(!_0x25f937[_0x85c0('0x67')][_0x85c0('0x44')])return _0x34b4a6;return db[_0x85c0('0x46')]['update'](_0x25f937[_0x85c0('0x67')][_0x85c0('0x44')],{'where':{'MailAccountId':_0x34b4a6['id']}})[_0x85c0('0x14')](function(){return _0x34b4a6;});})[_0x85c0('0x14')](respondWithResult(_0x50577a,null))[_0x85c0('0x66')](handleError(_0x50577a,null));};exports['describe']=function(_0x1e106b,_0x590aba){return db['MailAccount'][_0x85c0('0x6b')]()[_0x85c0('0x14')](respondWithResult(_0x590aba,null))[_0x85c0('0x66')](handleError(_0x590aba,null));};exports[_0x85c0('0x6c')]=function(_0x2ff9fb,_0x480b0f){if(_0x2ff9fb[_0x85c0('0x67')]['id']){delete _0x2ff9fb[_0x85c0('0x67')]['id'];}return db[_0x85c0('0x4a')][_0x85c0('0x65')]({'where':{'id':_0x2ff9fb['params']['id']}})[_0x85c0('0x14')](handleEntityNotFound(_0x480b0f,null))['then'](function(_0x4dd817){if(_0x4dd817){_0x2ff9fb[_0x85c0('0x67')][_0x85c0('0x6d')]=_0x4dd817['id'];return db['Disposition'][_0x85c0('0x6e')](_0x2ff9fb['body']);}})[_0x85c0('0x14')](respondWithResult(_0x480b0f,null))[_0x85c0('0x66')](handleError(_0x480b0f,null));};exports[_0x85c0('0x6f')]=function(_0x3800a2,_0x19b90a){var _0x13cfb7={'raw':![],'where':{}};var _0x24d120={};var _0x1ab119={'count':0x0,'rows':[]};return db[_0x85c0('0x4a')][_0x85c0('0x70')]({'where':{'id':_0x3800a2[_0x85c0('0x62')]['id']}})[_0x85c0('0x14')](handleEntityNotFound(_0x19b90a,null))[_0x85c0('0x14')](function(_0x387505){if(_0x387505){_0x24d120[_0x85c0('0x53')]=_['keys'](db[_0x85c0('0x71')][_0x85c0('0x4b')]);_0x24d120[_0x85c0('0x4f')]=_[_0x85c0('0x50')](_0x3800a2['query']);_0x24d120[_0x85c0('0x51')]=_[_0x85c0('0x52')](_0x24d120[_0x85c0('0x53')],_0x24d120[_0x85c0('0x4f')]);_0x13cfb7['attributes']=_[_0x85c0('0x52')](_0x24d120[_0x85c0('0x53')],qs[_0x85c0('0x55')](_0x3800a2[_0x85c0('0x4f')][_0x85c0('0x55')]));_0x13cfb7[_0x85c0('0x54')]=_0x13cfb7[_0x85c0('0x54')][_0x85c0('0x56')]?_0x13cfb7[_0x85c0('0x54')]:_0x24d120['model'];if(!_0x3800a2['query'][_0x85c0('0x57')](_0x85c0('0x58'))){_0x13cfb7[_0x85c0('0x23')]=qs[_0x85c0('0x23')](_0x3800a2['query']['limit']);_0x13cfb7[_0x85c0('0x22')]=qs[_0x85c0('0x22')](_0x3800a2[_0x85c0('0x4f')][_0x85c0('0x22')]);}_0x13cfb7[_0x85c0('0x72')]=qs[_0x85c0('0x59')](_0x3800a2[_0x85c0('0x4f')]['sort']);_0x13cfb7['where']=qs['filters'](_[_0x85c0('0x73')](_0x3800a2['query'],_0x24d120[_0x85c0('0x51')]));_0x13cfb7[_0x85c0('0x5b')][_0x85c0('0x6d')]=_0x387505['id'];if(_0x3800a2['query'][_0x85c0('0x5a')]){_0x13cfb7[_0x85c0('0x5b')]=_[_0x85c0('0x5c')](_0x13cfb7[_0x85c0('0x5b')],{'$or':_[_0x85c0('0x49')](_0x13cfb7[_0x85c0('0x54')],function(_0x3c50f2){var _0x903a2c={};_0x903a2c[_0x3c50f2]={'$like':'%'+_0x3800a2[_0x85c0('0x4f')]['filter']+'%'};return _0x903a2c;})});}_0x13cfb7=_[_0x85c0('0x5c')]({},_0x13cfb7,_0x3800a2[_0x85c0('0x5e')]);return db['Disposition'][_0x85c0('0x21')]({'where':_0x13cfb7[_0x85c0('0x5b')]})['then'](function(_0x3d1628){_0x1ab119[_0x85c0('0x21')]=_0x3d1628;if(_0x3800a2[_0x85c0('0x4f')][_0x85c0('0x5f')]){_0x13cfb7['include']=[{'all':!![]}];}return db[_0x85c0('0x71')][_0x85c0('0x60')](_0x13cfb7);})['then'](function(_0x38871d){_0x1ab119[_0x85c0('0x74')]=_0x38871d;return _0x1ab119;});}})[_0x85c0('0x14')](respondWithFilteredResult(_0x19b90a,_0x13cfb7))[_0x85c0('0x66')](handleError(_0x19b90a,null));};exports['removeDispositions']=function(_0x39e63a,_0x293b50){return db[_0x85c0('0x4a')][_0x85c0('0x65')]({'where':{'id':_0x39e63a[_0x85c0('0x62')]['id']}})[_0x85c0('0x14')](handleEntityNotFound(_0x293b50,null))[_0x85c0('0x14')](function(_0x35eae1){if(_0x35eae1){return _0x35eae1[_0x85c0('0x75')](_0x39e63a['query'][_0x85c0('0x76')]);}})[_0x85c0('0x14')](respondWithStatusCode(_0x293b50,null))[_0x85c0('0x66')](handleError(_0x293b50,null));};exports[_0x85c0('0x77')]=function(_0x25ad90,_0x3987bb){if(_0x25ad90[_0x85c0('0x67')]['id']){delete _0x25ad90['body']['id'];}return db['MailAccount'][_0x85c0('0x65')]({'where':{'id':_0x25ad90[_0x85c0('0x62')]['id']}})[_0x85c0('0x14')](handleEntityNotFound(_0x3987bb,null))[_0x85c0('0x14')](function(_0x25f153){if(_0x25f153){_0x25ad90[_0x85c0('0x67')][_0x85c0('0x6d')]=_0x25f153['id'];return db[_0x85c0('0x78')][_0x85c0('0x6e')](_0x25ad90['body']);}})[_0x85c0('0x14')](respondWithResult(_0x3987bb,null))[_0x85c0('0x66')](handleError(_0x3987bb,null));};exports['getAnswers']=function(_0x153021,_0x254f57){var _0x36e891={'raw':![],'where':{}};var _0x218c6e={};var _0x33d77f={'count':0x0,'rows':[]};return db[_0x85c0('0x4a')]['findOne']({'where':{'id':_0x153021[_0x85c0('0x62')]['id']}})['then'](handleEntityNotFound(_0x254f57,null))[_0x85c0('0x14')](function(_0x2d284c){if(_0x2d284c){_0x218c6e[_0x85c0('0x53')]=_[_0x85c0('0x50')](db[_0x85c0('0x78')][_0x85c0('0x4b')]);_0x218c6e['query']=_[_0x85c0('0x50')](_0x153021[_0x85c0('0x4f')]);_0x218c6e[_0x85c0('0x51')]=_[_0x85c0('0x52')](_0x218c6e[_0x85c0('0x53')],_0x218c6e[_0x85c0('0x4f')]);_0x36e891['attributes']=_[_0x85c0('0x52')](_0x218c6e['model'],qs[_0x85c0('0x55')](_0x153021[_0x85c0('0x4f')][_0x85c0('0x55')]));_0x36e891['attributes']=_0x36e891[_0x85c0('0x54')][_0x85c0('0x56')]?_0x36e891['attributes']:_0x218c6e[_0x85c0('0x53')];if(!_0x153021[_0x85c0('0x4f')][_0x85c0('0x57')]('nolimit')){_0x36e891[_0x85c0('0x23')]=qs['limit'](_0x153021[_0x85c0('0x4f')]['limit']);_0x36e891['offset']=qs[_0x85c0('0x22')](_0x153021[_0x85c0('0x4f')][_0x85c0('0x22')]);}_0x36e891[_0x85c0('0x72')]=qs[_0x85c0('0x59')](_0x153021['query'][_0x85c0('0x59')]);_0x36e891[_0x85c0('0x5b')]=qs[_0x85c0('0x51')](_[_0x85c0('0x73')](_0x153021[_0x85c0('0x4f')],_0x218c6e[_0x85c0('0x51')]));_0x36e891[_0x85c0('0x5b')][_0x85c0('0x6d')]=_0x2d284c['id'];if(_0x153021[_0x85c0('0x4f')]['filter']){_0x36e891[_0x85c0('0x5b')]=_[_0x85c0('0x5c')](_0x36e891[_0x85c0('0x5b')],{'$or':_[_0x85c0('0x49')](_0x36e891['attributes'],function(_0x25ba16){var _0x420217={};_0x420217[_0x25ba16]={'$like':'%'+_0x153021[_0x85c0('0x4f')][_0x85c0('0x5a')]+'%'};return _0x420217;})});}_0x36e891=_['merge']({},_0x36e891,_0x153021[_0x85c0('0x5e')]);return db[_0x85c0('0x78')][_0x85c0('0x21')]({'where':_0x36e891[_0x85c0('0x5b')]})[_0x85c0('0x14')](function(_0xf42794){_0x33d77f[_0x85c0('0x21')]=_0xf42794;if(_0x153021[_0x85c0('0x4f')]['includeAll']){_0x36e891['include']=[{'all':!![]}];}return db[_0x85c0('0x78')]['findAll'](_0x36e891);})[_0x85c0('0x14')](function(_0x4ab951){_0x33d77f[_0x85c0('0x74')]=_0x4ab951;return _0x33d77f;});}})[_0x85c0('0x14')](respondWithFilteredResult(_0x254f57,_0x36e891))[_0x85c0('0x66')](handleError(_0x254f57,null));};exports['removeAnswers']=function(_0x4f3ab2,_0x145873){return db[_0x85c0('0x4a')][_0x85c0('0x65')]({'where':{'id':_0x4f3ab2['params']['id']}})[_0x85c0('0x14')](handleEntityNotFound(_0x145873,null))[_0x85c0('0x14')](function(_0x186019){if(_0x186019){return _0x186019[_0x85c0('0x79')](_0x4f3ab2[_0x85c0('0x4f')][_0x85c0('0x76')]);}})['then'](respondWithStatusCode(_0x145873,null))['catch'](handleError(_0x145873,null));};exports[_0x85c0('0x6e')]=function(_0x556f5a,_0x483770){var _0x1cfcf1={'name':_0x556f5a[_0x85c0('0x67')][_0x85c0('0x2c')],'key':_0x556f5a[_0x85c0('0x67')][_0x85c0('0x4e')],'provider':_0x556f5a['body'][_0x85c0('0x68')]===_0x85c0('0x69')?null:_0x556f5a[_0x85c0('0x67')][_0x85c0('0x68')],'email':_0x556f5a['body'][_0x85c0('0x7a')],'ListId':_0x556f5a['body'][_0x85c0('0x7b')],'active':!_[_0x85c0('0x7c')](_0x556f5a[_0x85c0('0x67')][_0x85c0('0x7d')])?_0x556f5a[_0x85c0('0x67')]['active']:!![],'description':_0x556f5a[_0x85c0('0x67')]['description']||null};var _0x106f68=getAuthenticationOptions(_0x1cfcf1['provider'],_0x556f5a[_0x85c0('0x67')]);_0x1cfcf1['Imap']=_0x106f68[_0x85c0('0x43')];_0x1cfcf1[_0x85c0('0x44')]=_0x106f68[_0x85c0('0x44')];return db[_0x85c0('0x4a')]['create'](_0x1cfcf1,{'include':[{'model':db[_0x85c0('0x46')],'as':_0x85c0('0x44')},{'model':db[_0x85c0('0x63')],'as':_0x85c0('0x43')}]})[_0x85c0('0x14')](function(_0x11e9c4){var _0xa0fe88=_0x556f5a[_0x85c0('0x38')][_0x85c0('0x7e')]({'plain':!![]});if(!_0xa0fe88)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa0fe88[_0x85c0('0x7f')]===_0x85c0('0x38')){var _0x293cf5=_0x11e9c4[_0x85c0('0x7e')]({'plain':!![]});return db[_0x85c0('0x80')][_0x85c0('0x65')]({'where':{'name':_0x85c0('0x28'),'userProfileId':_0xa0fe88[_0x85c0('0x81')]},'raw':!![]})[_0x85c0('0x14')](function(_0x4eb915){if(_0x4eb915&&_0x4eb915[_0x85c0('0x82')]===0x0){return db['UserProfileResource']['create']({'name':_0x293cf5[_0x85c0('0x2c')],'resourceId':_0x293cf5['id'],'type':_0x4eb915[_0x85c0('0x2c')],'sectionId':_0x4eb915['id']},{})['then'](function(){return _0x11e9c4;});}else{return _0x11e9c4;}})[_0x85c0('0x66')](function(_0x39d4c9){logger['error'](_0x85c0('0x83'),_0x39d4c9);throw _0x39d4c9;});}return _0x11e9c4;})[_0x85c0('0x14')](respondWithResult(_0x483770,0xc9))[_0x85c0('0x66')](handleError(_0x483770,null));};exports[_0x85c0('0x84')]=function(_0x1f7082,_0x43c3bb){return db['MailAccount'][_0x85c0('0x70')]({'where':{'id':_0x1f7082[_0x85c0('0x62')]['id']}})['then'](handleEntityNotFound(_0x43c3bb,null))[_0x85c0('0x14')](function(_0x7804da){if(_0x7804da){return _0x7804da[_0x85c0('0x84')]();}return null;})['then'](respondWithResult(_0x43c3bb,null))[_0x85c0('0x66')](handleError(_0x43c3bb,null));};exports[_0x85c0('0x85')]=function(_0x1cda77,_0x2df816){if(_0x1cda77[_0x85c0('0x67')]['id']){delete _0x1cda77['body']['id'];}return db['MailAccount'][_0x85c0('0x65')]({'where':{'id':_0x1cda77[_0x85c0('0x62')]['id']}})[_0x85c0('0x14')](handleEntityNotFound(_0x2df816,null))[_0x85c0('0x14')](function(_0x108fc7){if(_0x108fc7){_0x1cda77[_0x85c0('0x67')][_0x85c0('0x6d')]=_0x108fc7['id'];return db[_0x85c0('0x63')][_0x85c0('0x6e')](_0x1cda77[_0x85c0('0x67')]);}})[_0x85c0('0x14')](respondWithResult(_0x2df816,null))[_0x85c0('0x66')](handleError(_0x2df816,null));};exports['removeImap']=function(_0x4bf20c,_0x330e1a){return db[_0x85c0('0x4a')][_0x85c0('0x70')]({'where':{'id':_0x4bf20c['params']['id']}})[_0x85c0('0x14')](handleEntityNotFound(_0x330e1a,null))[_0x85c0('0x14')](function(_0x14e301){if(_0x14e301){return _0x14e301[_0x85c0('0x86')](null);}return null;})[_0x85c0('0x14')](respondWithStatusCode(_0x330e1a,null))[_0x85c0('0x66')](handleError(_0x330e1a,null));};exports['getSmtp']=function(_0x1cff31,_0x4e8708){return db['MailAccount']['findOne']({'where':{'id':_0x1cff31[_0x85c0('0x62')]['id']}})[_0x85c0('0x14')](handleEntityNotFound(_0x4e8708,null))[_0x85c0('0x14')](function(_0x2083f6){if(_0x2083f6){return _0x2083f6[_0x85c0('0x87')]();}return null;})[_0x85c0('0x14')](respondWithResult(_0x4e8708,null))[_0x85c0('0x66')](handleError(_0x4e8708,null));};exports[_0x85c0('0x88')]=function(_0x57ceb7,_0x11765c){if(_0x57ceb7['body']['id']){delete _0x57ceb7['body']['id'];}return db[_0x85c0('0x4a')][_0x85c0('0x65')]({'where':{'id':_0x57ceb7[_0x85c0('0x62')]['id']}})[_0x85c0('0x14')](handleEntityNotFound(_0x11765c,null))[_0x85c0('0x14')](function(_0x3bc720){if(_0x3bc720){_0x57ceb7[_0x85c0('0x67')][_0x85c0('0x6d')]=_0x3bc720['id'];return db['MailServerOut'][_0x85c0('0x6e')](_0x57ceb7[_0x85c0('0x67')]);}})[_0x85c0('0x14')](respondWithResult(_0x11765c,null))['catch'](handleError(_0x11765c,null));};exports['removeSmtp']=function(_0x49eb6f,_0x573316){return db[_0x85c0('0x4a')][_0x85c0('0x70')]({'where':{'id':_0x49eb6f[_0x85c0('0x62')]['id']}})[_0x85c0('0x14')](handleEntityNotFound(_0x573316,null))['then'](function(_0x23c0c7){if(_0x23c0c7){return _0x23c0c7[_0x85c0('0x89')](null);}return null;})[_0x85c0('0x14')](respondWithStatusCode(_0x573316,null))['catch'](handleError(_0x573316,null));};exports['addInteraction']=function(_0x2104e3,_0x1bc3e6){return db[_0x85c0('0x8a')][_0x85c0('0x65')]({'where':{'id':_0x2104e3['params']['id']}})['then'](handleEntityNotFound(_0x1bc3e6,null))[_0x85c0('0x14')](function(_0x3b6cd7){if(_0x3b6cd7){return _0x3b6cd7[_0x85c0('0x8b')](_0x2104e3['body']['ids'],_[_0x85c0('0x8c')](_0x2104e3[_0x85c0('0x67')],[_0x85c0('0x76'),'id'])||{});}})[_0x85c0('0x14')](respondWithResult(_0x1bc3e6,null))['catch'](handleError(_0x1bc3e6,null));};exports[_0x85c0('0x8d')]=function(_0x2ebb0b,_0x26700f){var _0x35a6ad={'raw':![],'where':{}};var _0x51e757={};var _0x2516d5={'count':0x0,'rows':[]};return db[_0x85c0('0x4a')][_0x85c0('0x70')]({'where':{'id':_0x2ebb0b['params']['id']}})['then'](handleEntityNotFound(_0x26700f,null))[_0x85c0('0x14')](function(_0x38e437){if(_0x38e437){_0x51e757[_0x85c0('0x53')]=_[_0x85c0('0x50')](db['MailInteraction'][_0x85c0('0x4b')]);_0x51e757[_0x85c0('0x4f')]=_[_0x85c0('0x50')](_0x2ebb0b[_0x85c0('0x4f')]);_0x51e757[_0x85c0('0x51')]=_[_0x85c0('0x52')](_0x51e757[_0x85c0('0x53')],_0x51e757[_0x85c0('0x4f')]);_0x35a6ad[_0x85c0('0x54')]=_['intersection'](_0x51e757[_0x85c0('0x53')],qs[_0x85c0('0x55')](_0x2ebb0b[_0x85c0('0x4f')][_0x85c0('0x55')]));_0x35a6ad[_0x85c0('0x54')]=_0x35a6ad[_0x85c0('0x54')][_0x85c0('0x56')]?_0x35a6ad[_0x85c0('0x54')]:_0x51e757['model'];if(!_0x2ebb0b[_0x85c0('0x4f')][_0x85c0('0x57')](_0x85c0('0x58'))){_0x35a6ad[_0x85c0('0x23')]=qs[_0x85c0('0x23')](_0x2ebb0b[_0x85c0('0x4f')][_0x85c0('0x23')]);_0x35a6ad[_0x85c0('0x22')]=qs[_0x85c0('0x22')](_0x2ebb0b[_0x85c0('0x4f')][_0x85c0('0x22')]);}_0x35a6ad[_0x85c0('0x72')]=qs['sort'](_0x2ebb0b[_0x85c0('0x4f')][_0x85c0('0x59')]);_0x35a6ad[_0x85c0('0x5b')]=qs['filters'](_[_0x85c0('0x73')](_0x2ebb0b[_0x85c0('0x4f')],_0x51e757[_0x85c0('0x51')]));_0x35a6ad['where']['MailAccountId']=_0x38e437['id'];if(_0x2ebb0b[_0x85c0('0x4f')][_0x85c0('0x5a')]){_0x35a6ad[_0x85c0('0x5b')]=_[_0x85c0('0x5c')](_0x35a6ad[_0x85c0('0x5b')],{'$or':_[_0x85c0('0x49')](_0x35a6ad[_0x85c0('0x54')],function(_0x2bc540){var _0x394c4d={};_0x394c4d[_0x2bc540]={'$like':'%'+_0x2ebb0b[_0x85c0('0x4f')][_0x85c0('0x5a')]+'%'};return _0x394c4d;})});}_0x35a6ad=_[_0x85c0('0x5c')]({},_0x35a6ad,_0x2ebb0b['options']);return db[_0x85c0('0x8a')][_0x85c0('0x21')]({'where':_0x35a6ad[_0x85c0('0x5b')]})[_0x85c0('0x14')](function(_0x5eb1bd){_0x2516d5['count']=_0x5eb1bd;if(_0x2ebb0b[_0x85c0('0x4f')][_0x85c0('0x5f')]){_0x35a6ad[_0x85c0('0x64')]=[{'model':db[_0x85c0('0x8e')],'as':_0x85c0('0x8f'),'required':![]},{'model':db[_0x85c0('0x90')],'as':_0x85c0('0x91'),'attributes':[_0x85c0('0x2c'),_0x85c0('0x92'),'internal'],'required':![]},{'model':db[_0x85c0('0x93')],'as':_0x85c0('0x94'),'attributes':['id',_0x85c0('0x2c'),_0x85c0('0x95')],'where':_0x2ebb0b[_0x85c0('0x4f')][_0x85c0('0x96')]?{'id':_0x2ebb0b[_0x85c0('0x4f')]['tag']}:undefined,'required':_0x2ebb0b[_0x85c0('0x4f')][_0x85c0('0x96')]?!![]:![]}];}return db['MailInteraction'][_0x85c0('0x60')](_0x35a6ad);})[_0x85c0('0x14')](function(_0x3ca370){_0x2516d5[_0x85c0('0x74')]=_0x3ca370;return _0x2516d5;});}})['then'](respondWithFilteredResult(_0x26700f,_0x35a6ad))[_0x85c0('0x66')](handleError(_0x26700f,null));};exports[_0x85c0('0x97')]=function addApplications(_0x155575,_0x1f0707){var _0x57afc1=_0x155575['params']['id'];var _0x5bc6a1=_0x155575['body'];var _0x1dc83d=0xc8;var _0x28bb34=null;return db['sequelize'][_0x85c0('0x98')]({'isolationLevel':db[_0x85c0('0x99')]['Transaction'][_0x85c0('0x9a')][_0x85c0('0x9b')]},function(_0x4017a9){return db['MailAccount']['findOne']({'where':{'id':_0x57afc1},'transaction':_0x4017a9})[_0x85c0('0x14')](function(_0x310017){if(_0x310017){return db['MailApplication'][_0x85c0('0x2a')]({'where':{'MailAccountId':_0x57afc1},'transaction':_0x4017a9})[_0x85c0('0x14')](function(){var _0x4199a3=_['map'](_0x5bc6a1,function(_0x44a9c9){_0x44a9c9['MailAccountId']=_0x57afc1;return _0x44a9c9;});return db[_0x85c0('0x9c')]['bulkCreate'](_0x4199a3,{'transaction':_0x4017a9});});}else{_0x1dc83d=0x194;_0x28bb34=[];}});})[_0x85c0('0x14')](function(){if(_0x1dc83d!==0x194){return db[_0x85c0('0x9c')][_0x85c0('0x9d')]({'where':{'MailAccountId':_0x57afc1},'order':_0x85c0('0x9e')})[_0x85c0('0x14')](function(_0x1ccec7){_0x28bb34=_0x1ccec7;});}})[_0x85c0('0x66')](function(_0x561da5){_0x1dc83d=0x1f4;logger[_0x85c0('0x1a')](_0x561da5['stack']);if(_0x561da5[_0x85c0('0x2c')]){delete _0x561da5[_0x85c0('0x2c')];}_0x28bb34=_0x561da5;})[_0x85c0('0x9f')](function(){if(_0x28bb34===null){_0x1f0707[_0x85c0('0x1e')](_0x1dc83d);}else{if(_0x1dc83d===0x1f4){_0x1f0707[_0x85c0('0x20')](_0x1dc83d)[_0x85c0('0xa0')](_0x28bb34);}else{_0x1f0707[_0x85c0('0x20')](_0x1dc83d)[_0x85c0('0x26')](_0x28bb34);}}});};exports[_0x85c0('0xa1')]=function(_0x27d218,_0x1e2afe){var _0x12b511={};var _0x34bdae={};var _0x16e1e6;var _0x6bcbfa;return db[_0x85c0('0x4a')][_0x85c0('0x70')]({'where':{'id':_0x27d218[_0x85c0('0x62')]['id']}})[_0x85c0('0x14')](handleEntityNotFound(_0x1e2afe,null))[_0x85c0('0x14')](function(_0x529b13){if(_0x529b13){_0x16e1e6=_0x529b13;_0x34bdae[_0x85c0('0x53')]=_[_0x85c0('0x50')](db['MailApplication'][_0x85c0('0x4b')]);_0x34bdae[_0x85c0('0x4f')]=_[_0x85c0('0x50')](_0x27d218[_0x85c0('0x4f')]);_0x34bdae[_0x85c0('0x51')]=_['intersection'](_0x34bdae[_0x85c0('0x53')],_0x34bdae[_0x85c0('0x4f')]);_0x12b511[_0x85c0('0x54')]=_[_0x85c0('0x52')](_0x34bdae[_0x85c0('0x53')],qs['fields'](_0x27d218[_0x85c0('0x4f')]['fields']));_0x12b511[_0x85c0('0x54')]=_0x12b511[_0x85c0('0x54')][_0x85c0('0x56')]?_0x12b511[_0x85c0('0x54')]:_0x34bdae[_0x85c0('0x53')];_0x12b511[_0x85c0('0x72')]=qs[_0x85c0('0x59')](_0x27d218['query'][_0x85c0('0x59')]);_0x12b511[_0x85c0('0x5b')]=qs[_0x85c0('0x51')](_['pick'](_0x27d218[_0x85c0('0x4f')],_0x34bdae[_0x85c0('0x51')]));if(_0x27d218[_0x85c0('0x4f')][_0x85c0('0x5a')]){_0x12b511['where']=_[_0x85c0('0x5c')](_0x12b511['where'],{'$or':_[_0x85c0('0x49')](_0x12b511[_0x85c0('0x54')],function(_0x4a34cb){var _0x324000={};_0x324000[_0x4a34cb]={'$like':'%'+_0x27d218[_0x85c0('0x4f')][_0x85c0('0x5a')]+'%'};return _0x324000;})});}_0x12b511=_['merge']({},_0x12b511,_0x27d218[_0x85c0('0x5e')]);return _0x16e1e6[_0x85c0('0xa1')](_0x12b511);}})['then'](function(_0x4b7ec7){if(_0x4b7ec7){_0x6bcbfa=_0x4b7ec7[_0x85c0('0x56')];if(!_0x27d218[_0x85c0('0x4f')][_0x85c0('0x57')](_0x85c0('0x58'))){_0x12b511[_0x85c0('0x23')]=qs[_0x85c0('0x23')](_0x27d218[_0x85c0('0x4f')]['limit']);_0x12b511['offset']=qs['offset'](_0x27d218['query'][_0x85c0('0x22')]);}return _0x16e1e6['getApplications'](_0x12b511);}})[_0x85c0('0x14')](function(_0x4c63e0){if(_0x4c63e0){return _0x4c63e0?{'count':_0x6bcbfa,'rows':_0x4c63e0}:null;}})[_0x85c0('0x14')](respondWithResult(_0x1e2afe,null))[_0x85c0('0x66')](handleError(_0x1e2afe,null));};exports['getMessages']=function(_0x9d438a,_0x26fcbc){var _0xc1bfb0={'raw':!![],'where':{}};var _0xf043c8={};var _0x47403a={'count':0x0,'rows':[]};return db['MailAccount'][_0x85c0('0x70')]({'where':{'id':_0x9d438a[_0x85c0('0x62')]['id']}})[_0x85c0('0x14')](handleEntityNotFound(_0x26fcbc,null))[_0x85c0('0x14')](function(_0x242271){if(_0x242271){_0xf043c8[_0x85c0('0x53')]=_[_0x85c0('0x50')](db[_0x85c0('0xa2')]['rawAttributes']);_0xf043c8[_0x85c0('0x4f')]=_[_0x85c0('0x50')](_0x9d438a[_0x85c0('0x4f')]);_0xf043c8[_0x85c0('0x51')]=_[_0x85c0('0x52')](_0xf043c8[_0x85c0('0x53')],_0xf043c8[_0x85c0('0x4f')]);_0xc1bfb0[_0x85c0('0x54')]=_['intersection'](_0xf043c8[_0x85c0('0x53')],qs['fields'](_0x9d438a[_0x85c0('0x4f')]['fields']));_0xc1bfb0[_0x85c0('0x54')]=_0xc1bfb0['attributes'][_0x85c0('0x56')]?_0xc1bfb0[_0x85c0('0x54')]:_0xf043c8[_0x85c0('0x53')];if(!_0x9d438a[_0x85c0('0x4f')][_0x85c0('0x57')](_0x85c0('0x58'))){_0xc1bfb0['limit']=qs[_0x85c0('0x23')](_0x9d438a['query'][_0x85c0('0x23')]);_0xc1bfb0[_0x85c0('0x22')]=qs['offset'](_0x9d438a[_0x85c0('0x4f')]['offset']);}_0xc1bfb0[_0x85c0('0x72')]=qs[_0x85c0('0x59')](_0x9d438a[_0x85c0('0x4f')][_0x85c0('0x59')]);_0xc1bfb0[_0x85c0('0x5b')]=qs[_0x85c0('0x51')](_['pick'](_0x9d438a[_0x85c0('0x4f')],_0xf043c8[_0x85c0('0x51')]));_0xc1bfb0[_0x85c0('0x5b')][_0x85c0('0x6d')]=_0x242271['id'];if(_0x9d438a[_0x85c0('0x4f')]['filter']){_0xc1bfb0[_0x85c0('0x5b')]=_[_0x85c0('0x5c')](_0xc1bfb0[_0x85c0('0x5b')],{'$or':_['map'](_0xc1bfb0[_0x85c0('0x54')],function(_0x2f5a9d){var _0x5b305f={};_0x5b305f[_0x2f5a9d]={'$like':'%'+_0x9d438a['query'][_0x85c0('0x5a')]+'%'};return _0x5b305f;})});}if(_0x9d438a['query'][_0x85c0('0xa3')]){var _0x5b0e25=_0x9d438a[_0x85c0('0x4f')]['$gte'][_0x85c0('0xa4')](',');var _0x4fec2e={};_0x4fec2e[_0x5b0e25[0x0]]={'$gte':moment(_0x5b0e25[0x1])['format'](_0x85c0('0xa5'))};_0xc1bfb0['where']=_[_0x85c0('0x5c')](_0xc1bfb0[_0x85c0('0x5b')],_0x4fec2e);}_0xc1bfb0=_['merge']({},_0xc1bfb0,_0x9d438a[_0x85c0('0x5e')]);return db[_0x85c0('0xa2')]['count']({'where':_0xc1bfb0[_0x85c0('0x5b')]})[_0x85c0('0x14')](function(_0x455572){_0x47403a[_0x85c0('0x21')]=_0x455572;if(_0x9d438a['query'][_0x85c0('0x5f')]){_0xc1bfb0['include']=[{'all':!![]}];}return db[_0x85c0('0xa2')][_0x85c0('0x60')](_0xc1bfb0);})[_0x85c0('0x14')](function(_0x3a6990){if(_0x9d438a['query']['inlineCss']===_0x85c0('0xa6')){for(var _0x47bb45=0x0;_0x47bb45<_0x3a6990[_0x85c0('0x56')];_0x47bb45++){_0x3a6990[_0x47bb45][_0x85c0('0x67')]=juice(_0x3a6990[_0x47bb45][_0x85c0('0x67')]);}}_0x47403a[_0x85c0('0x74')]=_0x3a6990;return _0x47403a;});}})[_0x85c0('0x14')](respondWithFilteredResult(_0x26fcbc,_0xc1bfb0))['catch'](handleError(_0x26fcbc,null));};exports[_0x85c0('0xa0')]=function(_0x5ddf41,_0x47a0c1){var _0x1cc575,_0x11347d={},_0x3d2ec0;if(_0x5ddf41[_0x85c0('0x67')]['to']){_0x3d2ec0=_0x5ddf41[_0x85c0('0x67')]['to'][_0x85c0('0xa4')](',')[0x0];}return db[_0x85c0('0x4a')][_0x85c0('0x65')]({'where':{'id':_0x5ddf41[_0x85c0('0x62')]['id']},'include':[{'model':db[_0x85c0('0xa7')],'as':_0x85c0('0xa8'),'include':[{'model':db[_0x85c0('0x8e')],'as':_0x85c0('0xa9'),'where':{'email':_0x3d2ec0},'limit':0x1,'order':[[_0x85c0('0xaa'),'DESC']]}]},{'model':db[_0x85c0('0x46')],'as':_0x85c0('0x44'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x85c0('0xab'),'raw':!![]}]}]})[_0x85c0('0x14')](handleEntityNotFound(_0x47a0c1,null))['then'](function(_0x2205bc){if(!_0x2205bc)return;_0x1cc575=_0x2205bc;if(!_0x2205bc[_0x85c0('0x44')])throw new Error(_0x85c0('0xac'));if(_[_0x85c0('0x7c')](_0x5ddf41['body'][_0x85c0('0xad')])){_0x5ddf41[_0x85c0('0x67')]['from']=util[_0x85c0('0xae')](_0x85c0('0xaf'),_0x2205bc['name'],_0x2205bc['email']||_0x2205bc[_0x85c0('0x44')][_0x85c0('0x38')]);}if(_0x5ddf41[_0x85c0('0x67')][_0x85c0('0xb0')]&&_0x5ddf41['body'][_0x85c0('0xb0')][_0x85c0('0x56')]){for(var _0x310070=0x0;_0x310070<_0x5ddf41['body'][_0x85c0('0xb0')][_0x85c0('0x56')];_0x310070+=0x1){_0x5ddf41['body'][_0x85c0('0xb0')][_0x310070]={'filename':_0x5ddf41[_0x85c0('0x67')][_0x85c0('0xb0')][_0x310070][_0x85c0('0x2c')],'path':path[_0x85c0('0xb1')](config[_0x85c0('0xb2')],'server/files/attachments',_0x5ddf41['body'][_0x85c0('0xb0')][_0x310070][_0x85c0('0xb3')])};}}var _0x2c78a5=_0x2205bc['getSmtpOptions']();return respondWithRpcPromise('SendMail',_0x85c0('0xb4'),{'account':_0x2c78a5,'message':_0x5ddf41[_0x85c0('0x67')]});})[_0x85c0('0x14')](function(_0x1bf996){if(!_0x1bf996)return;_0x11347d=_0x1bf996;if(!_0x1cc575[_0x85c0('0xa8')])throw new Error(_0x85c0('0xb5'));if(_0x1cc575['List'][_0x85c0('0xa9')]['length'])return _0x1cc575[_0x85c0('0xa8')][_0x85c0('0xa9')][0x0];return db[_0x85c0('0x8e')]['create'](_[_0x85c0('0xb')](_0x5ddf41['body'],{'firstName':_0x5ddf41[_0x85c0('0x67')]['to'],'email':_0x5ddf41[_0x85c0('0x67')]['to'],'phone':_0x5ddf41['body']['to'],'ListId':_0x1cc575[_0x85c0('0x7b')]}));})['then'](function(_0x3a9c58){if(!_0x3a9c58)return;var _0x4becff={'UserId':_0x5ddf41[_0x85c0('0x38')]['id'],'ContactId':_0x3a9c58['id'],'MailAccountId':_0x1cc575['id'],'inReplyTo':_0x11347d['messageId'],'to':_0x5ddf41['body'][_0x85c0('0xad')],'cc':_0x5ddf41[_0x85c0('0x67')]['cc'],'subject':_0x5ddf41[_0x85c0('0x67')][_0x85c0('0xb6')],'attach':_0x5ddf41[_0x85c0('0x67')][_0x85c0('0xb7')],'firstMsgDirection':_0x85c0('0xb8'),'lastMsgAt':moment()[_0x85c0('0xae')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','Messages':[_['merge'](_0x5ddf41[_0x85c0('0x67')],{'messageId':_0x11347d['messageId'],'sentAt':moment()[_0x85c0('0xae')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x1cc575['id'],'UserId':_0x5ddf41[_0x85c0('0x38')]['id'],'ContactId':_0x3a9c58['id']})]};if(_0x5ddf41[_0x85c0('0x67')][_0x85c0('0xb9')]){_0x4becff=_['merge'](_0x4becff,_0x5ddf41['body'][_0x85c0('0xb9')]);}return db[_0x85c0('0x8a')]['create'](_0x4becff,{'include':[{'model':db[_0x85c0('0xa2')],'as':_0x85c0('0xba')}]});})[_0x85c0('0x14')](respondWithResult(_0x47a0c1,null))[_0x85c0('0x66')](handleError(_0x47a0c1,null));};exports['verifySmtp']=function(_0x59f7b1,_0x2727bd){return db[_0x85c0('0x4a')][_0x85c0('0x65')]({'where':{'id':_0x59f7b1[_0x85c0('0x62')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x85c0('0x44'),'raw':!![],'include':[{'model':db[_0x85c0('0xab')],'as':_0x85c0('0xab'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x2727bd,null))[_0x85c0('0x14')](function(_0x27b13a){if(!_0x27b13a[_0x85c0('0x44')])return;var _0x237134=_0x27b13a[_0x85c0('0xbb')]();return respondWithRpcPromise(_0x85c0('0xbc'),'verifySmtp',{'account':_0x237134});})[_0x85c0('0x14')](respondWithResult(_0x2727bd,null))['catch'](handleError(_0x2727bd,null));};exports['destroy']=function(_0x53e375,_0x3dcdb6){return db['MailAccount'][_0x85c0('0x65')]({'where':{'id':_0x53e375['params']['id']}})[_0x85c0('0x14')](handleEntityNotFound(_0x3dcdb6,null))['then'](function(_0x30afe8){if(_0x30afe8&&_0x30afe8[_0x85c0('0x41')]){throw new db[(_0x85c0('0xbd'))][(_0x85c0('0xbe'))](_0x85c0('0xbf'));}return _0x30afe8;})[_0x85c0('0x14')](removeEntity(_0x3dcdb6,null))[_0x85c0('0x66')](handleError(_0x3dcdb6,null));};exports['addAgents']=function(_0x46b68e,_0x40d346){return db[_0x85c0('0x4a')][_0x85c0('0x65')]({'where':{'id':_0x46b68e[_0x85c0('0x62')]['id']}})[_0x85c0('0x14')](handleEntityNotFound(_0x40d346,null))[_0x85c0('0x14')](function(_0x2eb551){if(_0x2eb551){return _0x2eb551[_0x85c0('0xc0')](_0x46b68e[_0x85c0('0x67')][_0x85c0('0x76')],_['omit'](_0x46b68e[_0x85c0('0x67')],[_0x85c0('0x76'),'id'])||{})['spread'](function(_0x162626){for(var _0x35f213=0x0;_0x35f213<_0x46b68e[_0x85c0('0x67')]['ids']['length'];_0x35f213+=0x1){socket[_0x85c0('0xc1')](_0x85c0('0xc2'),{'UserId':Number(_0x46b68e[_0x85c0('0x67')][_0x85c0('0x76')][_0x35f213]),'MailAccountId':Number(_0x46b68e[_0x85c0('0x62')]['id'])});}return _0x162626;});}})[_0x85c0('0x14')](respondWithResult(_0x40d346,null))[_0x85c0('0x66')](handleError(_0x40d346,null));};exports[_0x85c0('0xc3')]=function(_0x1a277e,_0x5f413a){return db[_0x85c0('0x4a')][_0x85c0('0x65')]({'where':{'id':_0x1a277e[_0x85c0('0x62')]['id']}})[_0x85c0('0x14')](handleEntityNotFound(_0x5f413a,null))[_0x85c0('0x14')](function(_0x53c0c2){if(_0x53c0c2){return _0x53c0c2[_0x85c0('0xc3')](_0x1a277e['query'][_0x85c0('0x76')])[_0x85c0('0x14')](function(){if(_[_0x85c0('0xc4')](_0x1a277e[_0x85c0('0x4f')]['ids'])){for(var _0x5c1c38=0x0;_0x5c1c38<_0x1a277e[_0x85c0('0x4f')][_0x85c0('0x76')][_0x85c0('0x56')];_0x5c1c38+=0x1){socket[_0x85c0('0xc1')]('userMailAccount:remove',{'UserId':Number(_0x1a277e['query'][_0x85c0('0x76')][_0x5c1c38]),'MailAccountId':Number(_0x1a277e[_0x85c0('0x62')]['id'])});}}else{socket[_0x85c0('0xc1')](_0x85c0('0xc5'),{'UserId':Number(_0x1a277e[_0x85c0('0x4f')][_0x85c0('0x76')]),'MailAccountId':Number(_0x1a277e[_0x85c0('0x62')]['id'])});}});}})[_0x85c0('0x14')](respondWithStatusCode(_0x5f413a,null))[_0x85c0('0x66')](handleError(_0x5f413a,null));};exports[_0x85c0('0xc6')]=function(_0x554509,_0x2b8211){var _0x37b6e2={};var _0x1ab056={};var _0x363b58;var _0x1d9d0d;return db[_0x85c0('0x4a')]['findOne']({'where':{'id':_0x554509['params']['id']}})[_0x85c0('0x14')](handleEntityNotFound(_0x2b8211,null))[_0x85c0('0x14')](function(_0x3cd750){if(_0x3cd750){_0x363b58=_0x3cd750;_0x1ab056['model']=_[_0x85c0('0x50')](db[_0x85c0('0x90')][_0x85c0('0x4b')]);_0x1ab056[_0x85c0('0x4f')]=_[_0x85c0('0x50')](_0x554509[_0x85c0('0x4f')]);_0x1ab056[_0x85c0('0x51')]=_[_0x85c0('0x52')](_0x1ab056[_0x85c0('0x53')],_0x1ab056['query']);_0x37b6e2[_0x85c0('0x54')]=_[_0x85c0('0x52')](_0x1ab056[_0x85c0('0x53')],qs['fields'](_0x554509[_0x85c0('0x4f')][_0x85c0('0x55')]));_0x37b6e2[_0x85c0('0x54')]=_0x37b6e2[_0x85c0('0x54')][_0x85c0('0x56')]?_0x37b6e2[_0x85c0('0x54')]:_0x1ab056[_0x85c0('0x53')];_0x37b6e2[_0x85c0('0x72')]=qs[_0x85c0('0x59')](_0x554509[_0x85c0('0x4f')][_0x85c0('0x59')]);_0x37b6e2[_0x85c0('0x5b')]=qs['filters'](_[_0x85c0('0x73')](_0x554509[_0x85c0('0x4f')],_0x1ab056['filters']));if(_0x554509[_0x85c0('0x4f')]['filter']){_0x37b6e2[_0x85c0('0x5b')]=_[_0x85c0('0x5c')](_0x37b6e2[_0x85c0('0x5b')],{'$or':_[_0x85c0('0x49')](_0x37b6e2['attributes'],function(_0x31eb0e){var _0x51b294={};_0x51b294[_0x31eb0e]={'$like':'%'+_0x554509[_0x85c0('0x4f')]['filter']+'%'};return _0x51b294;})});}_0x37b6e2=_[_0x85c0('0x5c')]({},_0x37b6e2,_0x554509[_0x85c0('0x5e')]);return _0x363b58['getAgents'](_0x37b6e2);}})['then'](function(_0x2b303e){if(_0x2b303e){_0x1d9d0d=_0x2b303e[_0x85c0('0x56')];if(!_0x554509[_0x85c0('0x4f')][_0x85c0('0x57')](_0x85c0('0x58'))){_0x37b6e2[_0x85c0('0x23')]=qs[_0x85c0('0x23')](_0x554509[_0x85c0('0x4f')][_0x85c0('0x23')]);_0x37b6e2['offset']=qs['offset'](_0x554509[_0x85c0('0x4f')]['offset']);}return _0x363b58[_0x85c0('0xc6')](_0x37b6e2);}})['then'](function(_0x4349d1){if(_0x4349d1){return _0x4349d1?{'count':_0x1d9d0d,'rows':_0x4349d1}:null;}})[_0x85c0('0x14')](respondWithResult(_0x2b8211,null))[_0x85c0('0x66')](handleError(_0x2b8211,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 65b4798..b75acf3 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 _0xa282=['hook','exports','events','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x4f4a22,_0x11c7e6){var _0x31e962=function(_0x2ed38e){while(--_0x2ed38e){_0x4f4a22['push'](_0x4f4a22['shift']());}};_0x31e962(++_0x11c7e6);}(_0xa282,0x1f3));var _0x2a28=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xa282[_0x4792c8];return _0x35edb1;};'use strict';var EventEmitter=require(_0x2a28('0x0'));var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x2a28('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2a28('0x2'),'afterDestroy':'remove'};function emitEvent(_0xe7cd2e){return function(_0x1aec55,_0x2e12ef,_0x194226){MailAccountEvents[_0x2a28('0x3')](_0xe7cd2e+':'+_0x1aec55['id'],_0x1aec55);MailAccountEvents[_0x2a28('0x3')](_0xe7cd2e,_0x1aec55);_0x194226(null);};}for(var e in events){if(events[_0x2a28('0x4')](e)){var event=events[e];MailAccount[_0x2a28('0x5')](e,emitEvent(event));}}module[_0x2a28('0x6')]=MailAccountEvents; \ No newline at end of file +var _0xe558=['hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x556d89,_0x2941bd){var _0x55239b=function(_0x1e0bae){while(--_0x1e0bae){_0x556d89['push'](_0x556d89['shift']());}};_0x55239b(++_0x2941bd);}(_0xe558,0x70));var _0x8e55=function(_0x3df4c9,_0xd60207){_0x3df4c9=_0x3df4c9-0x0;var _0x3472f6=_0xe558[_0x3df4c9];return _0x3472f6;};'use strict';var EventEmitter=require(_0x8e55('0x0'));var MailAccount=require(_0x8e55('0x1'))['db'][_0x8e55('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x8e55('0x3')](0x0);var events={'afterCreate':_0x8e55('0x4'),'afterUpdate':_0x8e55('0x5'),'afterDestroy':_0x8e55('0x6')};function emitEvent(_0x3a5285){return function(_0x28c870,_0x5bc807,_0xf125cc){MailAccountEvents[_0x8e55('0x7')](_0x3a5285+':'+_0x28c870['id'],_0x28c870);MailAccountEvents[_0x8e55('0x7')](_0x3a5285,_0x28c870);_0xf125cc(null);};}for(var e in events){if(events[_0x8e55('0x8')](e)){var event=events[e];MailAccount[_0x8e55('0x9')](e,emitEvent(event));}}module[_0x8e55('0xa')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index fc6ad5d..da3a6f7 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 _0xf43a=['CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','auth','pass','exports','define','MailAccount','custom','host','Smtp','port','secure','authentication'];(function(_0x466fb9,_0x190fa6){var _0x56e3bd=function(_0x3a3445){while(--_0x3a3445){_0x466fb9['push'](_0x466fb9['shift']());}};_0x56e3bd(++_0x190fa6);}(_0xf43a,0xf6));var _0xaf43=function(_0x101cfc,_0x25ea9e){_0x101cfc=_0x101cfc-0x0;var _0xceeecf=_0xf43a[_0x101cfc];return _0xceeecf;};'use strict';var attributes=require('./mailAccount.attributes');module[_0xaf43('0x0')]=function(_0x245524){return _0x245524[_0xaf43('0x1')](_0xaf43('0x2'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x23a2d7=this;var _0x9aaec3={'id':_0x23a2d7['id'],'tls':{'rejectUnauthorized':![]}};if(_0x23a2d7['provider']!==_0xaf43('0x3')){_0x9aaec3['service']=_0x23a2d7['provider'];}else{_0x9aaec3[_0xaf43('0x4')]=_0x23a2d7[_0xaf43('0x5')][_0xaf43('0x4')];_0x9aaec3['port']=_0x23a2d7['Smtp'][_0xaf43('0x6')];_0x9aaec3[_0xaf43('0x7')]=_0x23a2d7[_0xaf43('0x5')]['secure'];}if(_0x23a2d7[_0xaf43('0x5')][_0xaf43('0x8')]){if(_0x23a2d7[_0xaf43('0x5')]['modernAuthentication']){if(!_0x23a2d7[_0xaf43('0x5')][_0xaf43('0x9')])throw new Error(_0xaf43('0xa'));_0x9aaec3['auth']={'type':_0xaf43('0xb'),'user':_0x23a2d7['Smtp'][_0xaf43('0xc')],'accessToken':_0x23a2d7[_0xaf43('0x5')][_0xaf43('0x9')]['data5']};}else{_0x9aaec3[_0xaf43('0xd')]={'user':_0x23a2d7[_0xaf43('0x5')][_0xaf43('0xc')],'pass':_0x23a2d7[_0xaf43('0x5')][_0xaf43('0xe')]};}}return _0x9aaec3;}}});}; \ No newline at end of file +var _0xe421=['port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','user','data5','pass','MailAccount','service','provider','host','Smtp'];(function(_0x308a9a,_0xd452bb){var _0xf317d1=function(_0x2df45c){while(--_0x2df45c){_0x308a9a['push'](_0x308a9a['shift']());}};_0xf317d1(++_0xd452bb);}(_0xe421,0x136));var _0x1e42=function(_0x3f2699,_0x8b3956){_0x3f2699=_0x3f2699-0x0;var _0x36932a=_0xe421[_0x3f2699];return _0x36932a;};'use strict';var attributes=require('./mailAccount.attributes');module['exports']=function(_0x26cca3){return _0x26cca3['define'](_0x1e42('0x0'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x3e5d4b=this;var _0x30731f={'id':_0x3e5d4b['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3e5d4b['provider']!=='custom'){_0x30731f[_0x1e42('0x1')]=_0x3e5d4b[_0x1e42('0x2')];}else{_0x30731f[_0x1e42('0x3')]=_0x3e5d4b[_0x1e42('0x4')][_0x1e42('0x3')];_0x30731f[_0x1e42('0x5')]=_0x3e5d4b[_0x1e42('0x4')][_0x1e42('0x5')];_0x30731f['secure']=_0x3e5d4b[_0x1e42('0x4')][_0x1e42('0x6')];}if(_0x3e5d4b['Smtp'][_0x1e42('0x7')]){if(_0x3e5d4b[_0x1e42('0x4')][_0x1e42('0x8')]){if(!_0x3e5d4b['Smtp'][_0x1e42('0x9')])throw new Error(_0x1e42('0xa'));_0x30731f[_0x1e42('0xb')]={'type':'OAuth2','user':_0x3e5d4b[_0x1e42('0x4')][_0x1e42('0xc')],'accessToken':_0x3e5d4b['Smtp'][_0x1e42('0x9')][_0x1e42('0xd')]};}else{_0x30731f[_0x1e42('0xb')]={'user':_0x3e5d4b[_0x1e42('0x4')][_0x1e42('0xc')],'pass':_0x3e5d4b[_0x1e42('0x4')][_0x1e42('0xe')]};}}return _0x30731f;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 6871c82..187597d 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 _0x2542=['MailServerOut','Smtp','CloudProvider','get','omit','getSmtpOptions','applications','list','orderBy','priority','asc','push','length','*,*,*,*','Contacts','contact','messageId','generate','attach','format','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','subject','YYYY-MM-DD\x20HH:mm:ss','interaction','created','originCc','ChatWebsiteId','originChannel','Email','Attachment','UserId','User','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','options','raw','attributes','map','include','model','ShowMailAccount','find','where','smtp','setDataValue','smtpOptions','NotifyMailAccount','body','mail','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','CmContact','DESC','MailApplication','Applications'];(function(_0x46f3f8,_0x12c74b){var _0xbc57cd=function(_0x34df37){while(--_0x34df37){_0x46f3f8['push'](_0x46f3f8['shift']());}};_0xbc57cd(++_0x12c74b);}(_0x2542,0x169));var _0x2254=function(_0x254fff,_0x392720){_0x254fff=_0x254fff-0x0;var _0x2dce44=_0x2542[_0x254fff];return _0x2dce44;};'use strict';var _=require(_0x2254('0x0'));var moment=require(_0x2254('0x1'));var BPromise=require(_0x2254('0x2'));var rs=require(_0x2254('0x3'));var Redis=require('ioredis');var db=require(_0x2254('0x4'))['db'];var logger=require('../../config/logger')(_0x2254('0x5'));var config=require(_0x2254('0x6'));var jayson=require(_0x2254('0x7'));var client=jayson[_0x2254('0x8')][_0x2254('0x9')]({'port':0x232c});config['redis']=_[_0x2254('0xa')](config[_0x2254('0xb')],{'host':_0x2254('0xc'),'port':0x18eb});var socket=require(_0x2254('0xd'))(new Redis(config[_0x2254('0xb')]));require(_0x2254('0xe'))[_0x2254('0xf')](socket);function respondWithRpcPromise(_0xbf1c18,_0xb395da,_0x1ae415){return new BPromise(function(_0x38fb2b,_0x5b1ab9){return client[_0x2254('0x10')](_0xbf1c18,_0x1ae415)[_0x2254('0x11')](function(_0x506abe){logger[_0x2254('0x12')]('MailAccount,\x20%s,\x20%s',_0xb395da,'request\x20sent');logger[_0x2254('0x13')](_0x2254('0x14'),_0xb395da,_0x2254('0x15'),JSON[_0x2254('0x16')](_0x506abe));if(_0x506abe[_0x2254('0x17')]){if(_0x506abe[_0x2254('0x17')]['code']===0x1f4){logger[_0x2254('0x17')](_0x2254('0x18'),_0xb395da,_0x506abe['error'][_0x2254('0x19')]);return _0x5b1ab9(_0x506abe[_0x2254('0x17')][_0x2254('0x19')]);}logger[_0x2254('0x17')](_0x2254('0x18'),_0xb395da,_0x506abe[_0x2254('0x17')]['message']);return _0x38fb2b(_0x506abe[_0x2254('0x17')]['message']);}else{logger[_0x2254('0x12')](_0x2254('0x18'),_0xb395da,_0x2254('0x15'));_0x38fb2b(_0x506abe[_0x2254('0x1a')][_0x2254('0x19')]);}})[_0x2254('0x1b')](function(_0x497724){logger['error']('MailAccount,\x20%s,\x20%s',_0xb395da,_0x497724);_0x5b1ab9(_0x497724);});});}exports[_0x2254('0x1c')]=function(_0x3a79f8){var _0x3c3a98=this;return new Promise(function(_0x1f1163,_0x2801d9){return db[_0x2254('0x1d')]['findAll']({'raw':_0x3a79f8[_0x2254('0x1e')]?_0x3a79f8[_0x2254('0x1e')][_0x2254('0x1f')]===undefined?!![]:![]:!![],'where':_0x3a79f8['options']?_0x3a79f8['options']['where']||null:null,'attributes':_0x3a79f8[_0x2254('0x1e')]?_0x3a79f8[_0x2254('0x1e')][_0x2254('0x20')]||null:null,'limit':_0x3a79f8['options']?_0x3a79f8['options']['limit']||null:null,'include':_0x3a79f8['options']?_0x3a79f8['options']['include']?_[_0x2254('0x21')](_0x3a79f8[_0x2254('0x1e')][_0x2254('0x22')],function(_0x265467){return{'model':db[_0x265467[_0x2254('0x23')]],'as':_0x265467['as'],'attributes':_0x265467[_0x2254('0x20')],'include':_0x265467['include']?_['map'](_0x265467[_0x2254('0x22')],function(_0x4f6877){return{'model':db[_0x4f6877[_0x2254('0x23')]],'as':_0x4f6877['as'],'attributes':_0x4f6877[_0x2254('0x20')],'include':_0x4f6877[_0x2254('0x22')]?_[_0x2254('0x21')](_0x4f6877[_0x2254('0x22')],function(_0x482688){return{'model':db[_0x482688[_0x2254('0x23')]],'as':_0x482688['as'],'attributes':_0x482688[_0x2254('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2254('0x11')](function(_0x37af8b){logger[_0x2254('0x12')](_0x2254('0x1c'),_0x3a79f8);logger[_0x2254('0x13')](_0x2254('0x1c'),_0x3a79f8,JSON[_0x2254('0x16')](_0x37af8b));_0x1f1163(_0x37af8b);})[_0x2254('0x1b')](function(_0x21c641){logger[_0x2254('0x17')](_0x2254('0x1c'),_0x21c641[_0x2254('0x19')],_0x3a79f8);_0x2801d9(_0x3c3a98[_0x2254('0x17')](0x1f4,_0x21c641[_0x2254('0x19')]));});});};exports[_0x2254('0x24')]=function(_0x291894){var _0x2f32f8=this;return new Promise(function(_0x4e3658,_0xe29526){return db[_0x2254('0x1d')][_0x2254('0x25')]({'raw':_0x291894[_0x2254('0x1e')]?_0x291894[_0x2254('0x1e')][_0x2254('0x1f')]===undefined?!![]:![]:!![],'where':_0x291894[_0x2254('0x1e')]?_0x291894[_0x2254('0x1e')][_0x2254('0x26')]||null:null,'attributes':_0x291894['options']?_0x291894[_0x2254('0x1e')][_0x2254('0x20')]||null:null,'include':_0x291894['options']?_0x291894[_0x2254('0x1e')][_0x2254('0x22')]?_[_0x2254('0x21')](_0x291894[_0x2254('0x1e')]['include'],function(_0x4a2df0){return{'model':db[_0x4a2df0[_0x2254('0x23')]],'as':_0x4a2df0['as'],'attributes':_0x4a2df0['attributes'],'include':_0x4a2df0[_0x2254('0x22')]?_[_0x2254('0x21')](_0x4a2df0[_0x2254('0x22')],function(_0x141ddc){return{'model':db[_0x141ddc[_0x2254('0x23')]],'as':_0x141ddc['as'],'attributes':_0x141ddc[_0x2254('0x20')],'include':_0x141ddc[_0x2254('0x22')]?_['map'](_0x141ddc[_0x2254('0x22')],function(_0x192e9f){return{'model':db[_0x192e9f[_0x2254('0x23')]],'as':_0x192e9f['as'],'attributes':_0x192e9f[_0x2254('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2254('0x11')](function(_0x3f6007){if(_0x291894[_0x2254('0x1e')][_0x2254('0x27')]===!![])_0x3f6007[_0x2254('0x28')](_0x2254('0x29'),_0x3f6007['getSmtpOptions']());logger[_0x2254('0x12')](_0x2254('0x24'),_0x291894);logger[_0x2254('0x13')](_0x2254('0x24'),_0x291894,JSON['stringify'](_0x3f6007));_0x4e3658(_0x3f6007);})[_0x2254('0x1b')](function(_0x160fec){logger[_0x2254('0x17')](_0x2254('0x24'),_0x160fec[_0x2254('0x19')],_0x291894);_0xe29526(_0x2f32f8[_0x2254('0x17')](0x1f4,_0x160fec[_0x2254('0x19')]));});});};exports[_0x2254('0x2a')]=function(_0x4db9a8){var _0x362ad1=this;return new Promise(function(_0x5c15d7,_0x1df9c3){var _0x19b580={'body':_0x4db9a8[_0x2254('0x2b')],'channel':_0x2254('0x2c')};var _0x460bb3=_[_0x2254('0x2d')](_[_0x2254('0x2e')](db['CmContact'][_0x2254('0x2f')]),[_0x2254('0x30'),_0x2254('0x31'),_0x2254('0x32'),_0x2254('0x33')]);var _0x57cda2=![];if(_0x4db9a8[_0x2254('0x2b')]['id']){delete _0x4db9a8[_0x2254('0x2b')]['id'];}if(_[_0x2254('0x34')](_0x4db9a8[_0x2254('0x2b')][_0x2254('0x35')])){return _0x1df9c3(_0x362ad1['error'](0x1f4,_0x2254('0x36')));}if(_['isNil'](_0x4db9a8[_0x2254('0x2b')][_0x2254('0x2b')])||_0x4db9a8[_0x2254('0x2b')][_0x2254('0x2b')]===''){return _0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x2254('0x37')));}if(_[_0x2254('0x34')](_0x4db9a8[_0x2254('0x2b')][_0x2254('0x38')])){return _0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x2254('0x39')+_0x460bb3));}if(!_[_0x2254('0x3a')](_0x460bb3,_0x4db9a8[_0x2254('0x2b')]['mapKey'])){return _0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x2254('0x3b')+_0x460bb3));}var _0x2c5609={};_0x2c5609[_0x4db9a8['body'][_0x2254('0x38')]]=_0x4db9a8[_0x2254('0x2b')][_0x2254('0x35')];return db[_0x2254('0x1d')][_0x2254('0x25')]({'where':{'id':_0x4db9a8[_0x2254('0x3c')]['id']},'include':[{'model':db[_0x2254('0x3d')],'as':_0x2254('0x3e'),'include':[{'model':db[_0x2254('0x3f')],'as':'Contacts','where':_0x2c5609,'limit':0x1,'order':[[_0x2254('0x31'),_0x2254('0x40')]]}]},{'model':db[_0x2254('0x41')],'as':_0x2254('0x42')},{'model':db[_0x2254('0x43')],'as':_0x2254('0x44'),'include':[{'model':db[_0x2254('0x45')],'as':_0x2254('0x45')}]}]})[_0x2254('0x11')](function(_0xa103ea){if(_0xa103ea&&_0xa103ea['List']){var _0x36b977=_0xa103ea[_0x2254('0x46')]({'plain':!![]});_0x19b580['account']=_[_0x2254('0x47')](_0x36b977,[_0x2254('0x42'),_0x2254('0x3e')]);_0x19b580[_0x2254('0x3c')]['smtpOptions']=_0xa103ea[_0x2254('0x48')]();_0x19b580[_0x2254('0x49')]=_0x36b977['Applications'];_0x19b580[_0x2254('0x4a')]=_0x36b977[_0x2254('0x3e')];_0x19b580[_0x2254('0x49')]=_[_0x2254('0x4b')](_0x19b580['applications'],[_0x2254('0x4c')],[_0x2254('0x4d')]);if(_0x19b580[_0x2254('0x3c')]&&_0x19b580['account']['autoclose']){_0x19b580[_0x2254('0x49')][_0x2254('0x4e')]({'id':0x0,'priority':_0x19b580['applications'][_0x2254('0x4f')]+0x1,'app':'close','appdata':'autoclose','interval':_0x2254('0x50')});}if(_0x19b580[_0x2254('0x3c')][_0x2254('0x42')]){delete _0x19b580[_0x2254('0x3c')][_0x2254('0x42')];}if(_0x19b580['account']['List']){delete _0x19b580[_0x2254('0x3c')]['List'];}if(_0x36b977[_0x2254('0x3e')][_0x2254('0x51')][_0x2254('0x4f')]){return _0x36b977[_0x2254('0x3e')]['Contacts'][0x0];}var _0xd5fb20=_[_0x2254('0xa')](_0x4db9a8['body'],{'firstName':_0x4db9a8['body'][_0x2254('0x35')],'ListId':_0x36b977['ListId']});_0xd5fb20[_0x4db9a8[_0x2254('0x2b')][_0x2254('0x38')]]=_0x4db9a8[_0x2254('0x2b')][_0x2254('0x35')];return db[_0x2254('0x3f')]['create'](_0xd5fb20);}else{throw new Error('List\x20not\x20found');}})[_0x2254('0x11')](function(_0x5b1bd8){_0x19b580[_0x2254('0x52')]=_0x5b1bd8;if(_0x5b1bd8){if(!_0x4db9a8['body']['message']['messageId']){_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x53')]=rs[_0x2254('0x54')]()+'\x20'+_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x35')];}var _0x25137c={'ContactId':_0x5b1bd8['id'],'MailAccountId':_0x4db9a8[_0x2254('0x3c')]['id'],'inReplyTo':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x53')],'to':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x35')],'cc':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['cc'],'subject':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['subject'],'attach':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x55')],'lastMsgAt':moment()[_0x2254('0x56')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0x2254('0x25')]({'where':{'closed':![],'MailAccountId':_0x4db9a8[_0x2254('0x3c')]['id']},'include':[{'model':db[_0x2254('0x57')],'as':_0x2254('0x58'),'attributes':[_0x2254('0x53')],'where':{'messageId':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x59')]}}]})[_0x2254('0x11')](function(_0x4a7d36){if(_0x4a7d36){return[_0x4a7d36,![]];}return db['MailInteraction'][_0x2254('0x5a')](_0x25137c)['then'](function(_0x294931){return[_0x294931,!![]];});});}else{throw new Error(_0x2254('0x5b'));}})['spread'](function(_0x3c091e,_0x1b154f){if(_0x3c091e){_0x57cda2=_0x1b154f;if(!_0x1b154f){return _0x3c091e['update']({'inReplyTo':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['messageId'],'to':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x35')],'cc':_0x4db9a8['body']['message']['cc'],'subject':_0x4db9a8[_0x2254('0x2b')]['message'][_0x2254('0x5c')],'attach':_0x3c091e['attach']?_0x3c091e[_0x2254('0x55')]:_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x55')],'substatus':null,'substatusAt':moment()['format'](_0x2254('0x5d')),'lastMsgAt':moment()['format'](_0x2254('0x5d')),'lastMsgDirection':'in'});}else{return _0x3c091e;}}})[_0x2254('0x11')](function(_0x5ed07f){_0x19b580[_0x2254('0x5e')]=_0x5ed07f[_0x2254('0x46')]({'plain':!![]});_0x19b580['interaction'][_0x2254('0x5f')]=_0x57cda2;return db[_0x2254('0x57')][_0x2254('0x5a')]({'body':_0x4db9a8[_0x2254('0x2b')]['body'],'MailAccountId':_0x4db9a8[_0x2254('0x3c')]['id'],'MailInteractionId':_0x5ed07f['id'],'direction':'in','ContactId':_0x19b580[_0x2254('0x52')]['id'],'messageId':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x53')],'from':_0x4db9a8['body'][_0x2254('0x19')]['from'],'to':_0x4db9a8[_0x2254('0x2b')]['message']['to'],'cc':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['cc'],'subject':_0x4db9a8['body'][_0x2254('0x19')]['subject'],'attach':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x55')],'Attachments':_0x4db9a8['body'][_0x2254('0x19')]['attachments'],'originTo':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['originTo'],'originCc':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x60')],'bcc':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['bcc'],'ChatWebsiteId':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x61')]||null,'originChannel':_0x4db9a8[_0x2254('0x2b')]['message'][_0x2254('0x62')]||_0x2254('0x63'),'ChatOfflineMessageId':_0x4db9a8['body'][_0x2254('0x19')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x2254('0x64')],'as':'Attachments'}]});})['then'](function(_0x4efb07){_0x19b580[_0x2254('0x19')]=_0x4efb07;if(_0x19b580['interaction'][_0x2254('0x65')]){return db[_0x2254('0x66')]['find']({'attributes':['id',_0x2254('0x67')],'where':{'id':_0x19b580[_0x2254('0x5e')][_0x2254('0x65')]}})[_0x2254('0x11')](function(_0x259e10){if(_0x259e10){_0x19b580[_0x2254('0x49')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x259e10[_0x2254('0x67')]+','+(_0x19b580[_0x2254('0x3c')][_0x2254('0x68')]||0xa),'interval':_0x2254('0x50')});}return respondWithRpcPromise(_0x2254('0x69'),_0x2254('0x6a'),_0x19b580);});}return respondWithRpcPromise(_0x2254('0x69'),_0x2254('0x6a'),_0x19b580);})[_0x2254('0x11')](function(_0x39b95b){_0x5c15d7(_0x39b95b);})['catch'](function(_0x25eb17){_0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x25eb17['message']));});});}; \ No newline at end of file +var _0x5f2f=['Attachments','UserId','User','agent','name','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','./mailAccount.socket','register','request','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetMailAccount','options','where','limit','include','model','attributes','map','MailAccount','find','raw','then','smtp','smtpOptions','getSmtpOptions','ShowMailAccount','NotifyMailAccount','body','mail','difference','keys','rawAttributes','createdAt','updatedAt','from','from\x20is\x20mandatory','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','account','CmList','List','CmContact','DESC','MailApplication','MailServerOut','Smtp','CloudProvider','get','omit','applications','Applications','priority','asc','autoclose','push','close','Contacts','length','create','messageId','subject','format','MailMessage','Messages','inReplyTo','MailInteraction','spread','update','attach','YYYY-MM-DD\x20HH:mm:ss','interaction','contact','attachments','originCc','originChannel','Email','ChatOfflineMessageId','Attachment'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x5f2f,0x73));var _0xf5f2=function(_0x479a83,_0x2c8226){_0x479a83=_0x479a83-0x0;var _0x36d90b=_0x5f2f[_0x479a83];return _0x36d90b;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var BPromise=require(_0xf5f2('0x2'));var rs=require(_0xf5f2('0x3'));var Redis=require(_0xf5f2('0x4'));var db=require(_0xf5f2('0x5'))['db'];var logger=require(_0xf5f2('0x6'))(_0xf5f2('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf5f2('0x8')][_0xf5f2('0x9')]({'port':0x232c});config[_0xf5f2('0xa')]=_[_0xf5f2('0xb')](config[_0xf5f2('0xa')],{'host':_0xf5f2('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf5f2('0xa')]));require(_0xf5f2('0xd'))[_0xf5f2('0xe')](socket);function respondWithRpcPromise(_0x56a69f,_0x375da4,_0x15dd7c){return new BPromise(function(_0x218ae3,_0x4e0e6b){return client[_0xf5f2('0xf')](_0x56a69f,_0x15dd7c)['then'](function(_0x53fb33){logger[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x375da4,'request\x20sent');logger[_0xf5f2('0x12')](_0xf5f2('0x13'),_0x375da4,_0xf5f2('0x14'),JSON[_0xf5f2('0x15')](_0x53fb33));if(_0x53fb33[_0xf5f2('0x16')]){if(_0x53fb33[_0xf5f2('0x16')]['code']===0x1f4){logger[_0xf5f2('0x16')](_0xf5f2('0x11'),_0x375da4,_0x53fb33[_0xf5f2('0x16')][_0xf5f2('0x17')]);return _0x4e0e6b(_0x53fb33[_0xf5f2('0x16')]['message']);}logger[_0xf5f2('0x16')](_0xf5f2('0x11'),_0x375da4,_0x53fb33[_0xf5f2('0x16')][_0xf5f2('0x17')]);return _0x218ae3(_0x53fb33[_0xf5f2('0x16')][_0xf5f2('0x17')]);}else{logger[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x375da4,_0xf5f2('0x14'));_0x218ae3(_0x53fb33[_0xf5f2('0x18')][_0xf5f2('0x17')]);}})[_0xf5f2('0x19')](function(_0x4ff59b){logger[_0xf5f2('0x16')](_0xf5f2('0x11'),_0x375da4,_0x4ff59b);_0x4e0e6b(_0x4ff59b);});});}exports[_0xf5f2('0x1a')]=function(_0x1bf655){var _0x56acc5=this;return new Promise(function(_0x34706d,_0x47101e){return db['MailAccount']['findAll']({'raw':_0x1bf655[_0xf5f2('0x1b')]?_0x1bf655[_0xf5f2('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1bf655[_0xf5f2('0x1b')]?_0x1bf655[_0xf5f2('0x1b')][_0xf5f2('0x1c')]||null:null,'attributes':_0x1bf655[_0xf5f2('0x1b')]?_0x1bf655[_0xf5f2('0x1b')]['attributes']||null:null,'limit':_0x1bf655[_0xf5f2('0x1b')]?_0x1bf655[_0xf5f2('0x1b')][_0xf5f2('0x1d')]||null:null,'include':_0x1bf655[_0xf5f2('0x1b')]?_0x1bf655[_0xf5f2('0x1b')]['include']?_['map'](_0x1bf655[_0xf5f2('0x1b')][_0xf5f2('0x1e')],function(_0x13da6f){return{'model':db[_0x13da6f[_0xf5f2('0x1f')]],'as':_0x13da6f['as'],'attributes':_0x13da6f[_0xf5f2('0x20')],'include':_0x13da6f[_0xf5f2('0x1e')]?_[_0xf5f2('0x21')](_0x13da6f[_0xf5f2('0x1e')],function(_0x294414){return{'model':db[_0x294414['model']],'as':_0x294414['as'],'attributes':_0x294414[_0xf5f2('0x20')],'include':_0x294414[_0xf5f2('0x1e')]?_[_0xf5f2('0x21')](_0x294414[_0xf5f2('0x1e')],function(_0x198c73){return{'model':db[_0x198c73[_0xf5f2('0x1f')]],'as':_0x198c73['as'],'attributes':_0x198c73['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x22c826){logger[_0xf5f2('0x10')](_0xf5f2('0x1a'),_0x1bf655);logger['debug']('GetMailAccount',_0x1bf655,JSON[_0xf5f2('0x15')](_0x22c826));_0x34706d(_0x22c826);})[_0xf5f2('0x19')](function(_0x17394a){logger[_0xf5f2('0x16')](_0xf5f2('0x1a'),_0x17394a['message'],_0x1bf655);_0x47101e(_0x56acc5['error'](0x1f4,_0x17394a[_0xf5f2('0x17')]));});});};exports['ShowMailAccount']=function(_0xb744b9){var _0x58a4df=this;return new Promise(function(_0x45b643,_0x31087c){return db[_0xf5f2('0x22')][_0xf5f2('0x23')]({'raw':_0xb744b9[_0xf5f2('0x1b')]?_0xb744b9[_0xf5f2('0x1b')][_0xf5f2('0x24')]===undefined?!![]:![]:!![],'where':_0xb744b9[_0xf5f2('0x1b')]?_0xb744b9['options'][_0xf5f2('0x1c')]||null:null,'attributes':_0xb744b9[_0xf5f2('0x1b')]?_0xb744b9[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null,'include':_0xb744b9[_0xf5f2('0x1b')]?_0xb744b9[_0xf5f2('0x1b')][_0xf5f2('0x1e')]?_['map'](_0xb744b9[_0xf5f2('0x1b')][_0xf5f2('0x1e')],function(_0x55989d){return{'model':db[_0x55989d[_0xf5f2('0x1f')]],'as':_0x55989d['as'],'attributes':_0x55989d['attributes'],'include':_0x55989d[_0xf5f2('0x1e')]?_[_0xf5f2('0x21')](_0x55989d[_0xf5f2('0x1e')],function(_0x2e3cca){return{'model':db[_0x2e3cca['model']],'as':_0x2e3cca['as'],'attributes':_0x2e3cca['attributes'],'include':_0x2e3cca[_0xf5f2('0x1e')]?_[_0xf5f2('0x21')](_0x2e3cca[_0xf5f2('0x1e')],function(_0x4ec8fb){return{'model':db[_0x4ec8fb[_0xf5f2('0x1f')]],'as':_0x4ec8fb['as'],'attributes':_0x4ec8fb['attributes']};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x25')](function(_0x566c47){if(_0xb744b9[_0xf5f2('0x1b')][_0xf5f2('0x26')]===!![])_0x566c47['setDataValue'](_0xf5f2('0x27'),_0x566c47[_0xf5f2('0x28')]());logger[_0xf5f2('0x10')](_0xf5f2('0x29'),_0xb744b9);logger['debug']('ShowMailAccount',_0xb744b9,JSON[_0xf5f2('0x15')](_0x566c47));_0x45b643(_0x566c47);})[_0xf5f2('0x19')](function(_0x22b20c){logger[_0xf5f2('0x16')](_0xf5f2('0x29'),_0x22b20c[_0xf5f2('0x17')],_0xb744b9);_0x31087c(_0x58a4df[_0xf5f2('0x16')](0x1f4,_0x22b20c['message']));});});};exports[_0xf5f2('0x2a')]=function(_0x3b4ea6){var _0x536501=this;return new Promise(function(_0xc6a1ae,_0x3f3895){var _0x71b0e7={'body':_0x3b4ea6[_0xf5f2('0x2b')],'channel':_0xf5f2('0x2c')};var _0x3b6372=_[_0xf5f2('0x2d')](_[_0xf5f2('0x2e')](db['CmContact'][_0xf5f2('0x2f')]),[_0xf5f2('0x30'),_0xf5f2('0x31'),'CompanyId','ListId']);var _0x59eb00=![];if(_0x3b4ea6[_0xf5f2('0x2b')]['id']){delete _0x3b4ea6[_0xf5f2('0x2b')]['id'];}if(_['isNil'](_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x32')])){return _0x3f3895(_0x536501[_0xf5f2('0x16')](0x1f4,_0xf5f2('0x33')));}if(_[_0xf5f2('0x34')](_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x2b')])||_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x2b')]===''){return _0x3f3895(_0x536501[_0xf5f2('0x16')](0x1f4,_0xf5f2('0x35')));}if(_[_0xf5f2('0x34')](_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x36')])){return _0x3f3895(_0x536501['error'](0x1f4,_0xf5f2('0x37')+_0x3b6372));}if(!_['includes'](_0x3b6372,_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x36')])){return _0x3f3895(_0x536501[_0xf5f2('0x16')](0x1f4,_0xf5f2('0x38')+_0x3b6372));}var _0x31bf0e={};_0x31bf0e[_0x3b4ea6[_0xf5f2('0x2b')]['mapKey']]=_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x32')];return db[_0xf5f2('0x22')][_0xf5f2('0x23')]({'where':{'id':_0x3b4ea6[_0xf5f2('0x39')]['id']},'include':[{'model':db[_0xf5f2('0x3a')],'as':_0xf5f2('0x3b'),'include':[{'model':db[_0xf5f2('0x3c')],'as':'Contacts','where':_0x31bf0e,'limit':0x1,'order':[[_0xf5f2('0x31'),_0xf5f2('0x3d')]]}]},{'model':db[_0xf5f2('0x3e')],'as':'Applications'},{'model':db[_0xf5f2('0x3f')],'as':_0xf5f2('0x40'),'include':[{'model':db[_0xf5f2('0x41')],'as':'CloudProvider'}]}]})['then'](function(_0x7bb942){if(_0x7bb942&&_0x7bb942[_0xf5f2('0x3b')]){var _0x5db519=_0x7bb942[_0xf5f2('0x42')]({'plain':!![]});_0x71b0e7['account']=_[_0xf5f2('0x43')](_0x5db519,['Applications',_0xf5f2('0x3b')]);_0x71b0e7['account'][_0xf5f2('0x27')]=_0x7bb942[_0xf5f2('0x28')]();_0x71b0e7[_0xf5f2('0x44')]=_0x5db519[_0xf5f2('0x45')];_0x71b0e7['list']=_0x5db519[_0xf5f2('0x3b')];_0x71b0e7[_0xf5f2('0x44')]=_['orderBy'](_0x71b0e7['applications'],[_0xf5f2('0x46')],[_0xf5f2('0x47')]);if(_0x71b0e7['account']&&_0x71b0e7[_0xf5f2('0x39')][_0xf5f2('0x48')]){_0x71b0e7[_0xf5f2('0x44')][_0xf5f2('0x49')]({'id':0x0,'priority':_0x71b0e7['applications']['length']+0x1,'app':_0xf5f2('0x4a'),'appdata':_0xf5f2('0x48'),'interval':'*,*,*,*'});}if(_0x71b0e7[_0xf5f2('0x39')][_0xf5f2('0x45')]){delete _0x71b0e7[_0xf5f2('0x39')][_0xf5f2('0x45')];}if(_0x71b0e7[_0xf5f2('0x39')][_0xf5f2('0x3b')]){delete _0x71b0e7[_0xf5f2('0x39')]['List'];}if(_0x5db519['List'][_0xf5f2('0x4b')][_0xf5f2('0x4c')]){return _0x5db519[_0xf5f2('0x3b')][_0xf5f2('0x4b')][0x0];}var _0x21b0d3=_['defaults'](_0x3b4ea6[_0xf5f2('0x2b')],{'firstName':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x32')],'ListId':_0x5db519['ListId']});_0x21b0d3[_0x3b4ea6[_0xf5f2('0x2b')]['mapKey']]=_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x32')];return db[_0xf5f2('0x3c')][_0xf5f2('0x4d')](_0x21b0d3);}else{throw new Error('List\x20not\x20found');}})['then'](function(_0x756f1f){_0x71b0e7['contact']=_0x756f1f;if(_0x756f1f){if(!_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['messageId']){_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x4e')]=rs['generate']()+'\x20'+_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x32')];}var _0x4579f4={'ContactId':_0x756f1f['id'],'MailAccountId':_0x3b4ea6['account']['id'],'inReplyTo':_0x3b4ea6[_0xf5f2('0x2b')]['message'][_0xf5f2('0x4e')],'to':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x32')],'cc':_0x3b4ea6[_0xf5f2('0x2b')]['message']['cc'],'subject':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x4f')],'attach':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['attach'],'lastMsgAt':moment()[_0xf5f2('0x50')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0xf5f2('0x23')]({'where':{'closed':![],'MailAccountId':_0x3b4ea6['account']['id']},'include':[{'model':db[_0xf5f2('0x51')],'as':_0xf5f2('0x52'),'attributes':[_0xf5f2('0x4e')],'where':{'messageId':_0x3b4ea6[_0xf5f2('0x2b')]['message'][_0xf5f2('0x53')]}}]})[_0xf5f2('0x25')](function(_0x1ec682){if(_0x1ec682){return[_0x1ec682,![]];}return db[_0xf5f2('0x54')][_0xf5f2('0x4d')](_0x4579f4)[_0xf5f2('0x25')](function(_0x158768){return[_0x158768,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xf5f2('0x55')](function(_0x2d171d,_0xb39a6e){if(_0x2d171d){_0x59eb00=_0xb39a6e;if(!_0xb39a6e){return _0x2d171d[_0xf5f2('0x56')]({'inReplyTo':_0x3b4ea6['body'][_0xf5f2('0x17')]['messageId'],'to':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['from'],'cc':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['cc'],'subject':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x4f')],'attach':_0x2d171d['attach']?_0x2d171d[_0xf5f2('0x57')]:_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x57')],'substatus':null,'substatusAt':moment()[_0xf5f2('0x50')](_0xf5f2('0x58')),'lastMsgAt':moment()['format'](_0xf5f2('0x58')),'lastMsgDirection':'in'});}else{return _0x2d171d;}}})[_0xf5f2('0x25')](function(_0x4800fe){_0x71b0e7[_0xf5f2('0x59')]=_0x4800fe[_0xf5f2('0x42')]({'plain':!![]});_0x71b0e7[_0xf5f2('0x59')]['created']=_0x59eb00;return db['MailMessage']['create']({'body':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x2b')],'MailAccountId':_0x3b4ea6[_0xf5f2('0x39')]['id'],'MailInteractionId':_0x4800fe['id'],'direction':'in','ContactId':_0x71b0e7[_0xf5f2('0x5a')]['id'],'messageId':_0x3b4ea6[_0xf5f2('0x2b')]['message'][_0xf5f2('0x4e')],'from':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x32')],'to':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['to'],'cc':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['cc'],'subject':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x4f')],'attach':_0x3b4ea6['body']['message']['attach'],'Attachments':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x5b')],'originTo':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['originTo'],'originCc':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x5c')],'bcc':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['bcc'],'ChatWebsiteId':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['ChatWebsiteId']||null,'originChannel':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x5d')]||_0xf5f2('0x5e'),'ChatOfflineMessageId':_0x3b4ea6['body'][_0xf5f2('0x17')][_0xf5f2('0x5f')]||null},{'include':[{'model':db[_0xf5f2('0x60')],'as':_0xf5f2('0x61')}]});})[_0xf5f2('0x25')](function(_0x4f47e1){_0x71b0e7['message']=_0x4f47e1;if(_0x71b0e7[_0xf5f2('0x59')][_0xf5f2('0x62')]){return db[_0xf5f2('0x63')][_0xf5f2('0x23')]({'attributes':['id','name'],'where':{'id':_0x71b0e7['interaction'][_0xf5f2('0x62')]}})['then'](function(_0x4c4420){if(_0x4c4420){_0x71b0e7['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xf5f2('0x64'),'appdata':_0x4c4420[_0xf5f2('0x65')]+','+(_0x71b0e7[_0xf5f2('0x39')][_0xf5f2('0x66')]||0xa),'interval':_0xf5f2('0x67')});}return respondWithRpcPromise(_0xf5f2('0x68'),_0xf5f2('0x69'),_0x71b0e7);});}return respondWithRpcPromise(_0xf5f2('0x68'),_0xf5f2('0x69'),_0x71b0e7);})[_0xf5f2('0x25')](function(_0x9afb3c){_0xc6a1ae(_0x9afb3c);})[_0xf5f2('0x19')](function(_0x1ba503){_0x3f3895(_0x536501[_0xf5f2('0x16')](0x1f4,_0x1ba503[_0xf5f2('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index b8f882a..e544de6 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 _0xe206=['update','emit','removeListener','register','length','save','remove'];(function(_0x5b673f,_0x4e69a8){var _0x5d6898=function(_0x273437){while(--_0x273437){_0x5b673f['push'](_0x5b673f['shift']());}};_0x5d6898(++_0x4e69a8);}(_0xe206,0x101));var _0x6e20=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xe206[_0x4c12ec];return _0x3ae42c;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x6e20('0x0'),_0x6e20('0x1'),_0x6e20('0x2')];function createListener(_0x44161a,_0x5de7ff){return function(_0x4ae79c){_0x5de7ff[_0x6e20('0x3')](_0x44161a,_0x4ae79c);};}function removeListener(_0x4083fe,_0x4c0282){return function(){MailAccountEvents[_0x6e20('0x4')](_0x4083fe,_0x4c0282);};}exports[_0x6e20('0x5')]=function(_0x4dd6ba){for(var _0x196f64=0x0,_0x28ae32=events[_0x6e20('0x6')];_0x196f64<_0x28ae32;_0x196f64++){var _0x31176c=events[_0x196f64];var _0x50e088=createListener('mailAccount:'+_0x31176c,_0x4dd6ba);MailAccountEvents['on'](_0x31176c,_0x50e088);}}; \ No newline at end of file +var _0xa0a3=['save','remove','emit','removeListener','register','length'];(function(_0x3a52a8,_0x51edd4){var _0x44ebbc=function(_0x27e311){while(--_0x27e311){_0x3a52a8['push'](_0x3a52a8['shift']());}};_0x44ebbc(++_0x51edd4);}(_0xa0a3,0x1e0));var _0x3a0a=function(_0x1fb94f,_0x2812e7){_0x1fb94f=_0x1fb94f-0x0;var _0x2a1bd0=_0xa0a3[_0x1fb94f];return _0x2a1bd0;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x3a0a('0x0'),_0x3a0a('0x1'),'update'];function createListener(_0x640eba,_0xd101d5){return function(_0x15bad5){_0xd101d5[_0x3a0a('0x2')](_0x640eba,_0x15bad5);};}function removeListener(_0x4f9090,_0x7f2ad7){return function(){MailAccountEvents[_0x3a0a('0x3')](_0x4f9090,_0x7f2ad7);};}exports[_0x3a0a('0x4')]=function(_0xa047cf){for(var _0x3d7dc7=0x0,_0x4719d=events[_0x3a0a('0x5')];_0x3d7dc7<_0x4719d;_0x3d7dc7++){var _0x1766c1=events[_0x3d7dc7];var _0x5d98d3=createListener('mailAccount:'+_0x1766c1,_0xa047cf);MailAccountEvents['on'](_0x1766c1,_0x5d98d3);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index a6fb4ed..3bb2040 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 _0x3823=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x39dd7e,_0x2cfad4){var _0x5c64f5=function(_0x20a462){while(--_0x20a462){_0x39dd7e['push'](_0x39dd7e['shift']());}};_0x5c64f5(++_0x2cfad4);}(_0x3823,0xf2));var _0x3382=function(_0x9d742e,_0x362c0e){_0x9d742e=_0x9d742e-0x0;var _0x4b8142=_0x3823[_0x9d742e];return _0x4b8142;};'use strict';var multer=require('multer');var util=require(_0x3382('0x0'));var path=require(_0x3382('0x1'));var timeout=require(_0x3382('0x2'));var express=require(_0x3382('0x3'));var router=express[_0x3382('0x4')]();var fs_extra=require(_0x3382('0x5'));var auth=require(_0x3382('0x6'));var interaction=require(_0x3382('0x7'));var config=require(_0x3382('0x8'));var controller=require(_0x3382('0x9'));router[_0x3382('0xa')](_0x3382('0xb'),auth[_0x3382('0xc')](),controller[_0x3382('0xd')]);router[_0x3382('0xe')](_0x3382('0xb'),auth[_0x3382('0xc')](),controller[_0x3382('0xf')]);router[_0x3382('0x10')](_0x3382('0xb'),auth[_0x3382('0xc')](),controller[_0x3382('0x11')]);module[_0x3382('0x12')]=router; \ No newline at end of file +var _0xcfcc=['delete','destroy','multer','path','express','fs-extra','../../components/interaction/service','/:id','isAuthenticated','show','put'];(function(_0x54a28a,_0x1ba1fe){var _0x3da1f1=function(_0x7231b5){while(--_0x7231b5){_0x54a28a['push'](_0x54a28a['shift']());}};_0x3da1f1(++_0x1ba1fe);}(_0xcfcc,0x16d));var _0xccfc=function(_0x19ab0c,_0x18829b){_0x19ab0c=_0x19ab0c-0x0;var _0x4aa890=_0xcfcc[_0x19ab0c];return _0x4aa890;};'use strict';var multer=require(_0xccfc('0x0'));var util=require('util');var path=require(_0xccfc('0x1'));var timeout=require('connect-timeout');var express=require(_0xccfc('0x2'));var router=express['Router']();var fs_extra=require(_0xccfc('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xccfc('0x4'));var config=require('../../config/environment');var controller=require('./mailApplication.controller');router['get'](_0xccfc('0x5'),auth[_0xccfc('0x6')](),controller[_0xccfc('0x7')]);router[_0xccfc('0x8')](_0xccfc('0x5'),auth['isAuthenticated'](),controller['update']);router[_0xccfc('0x9')]('/:id',auth[_0xccfc('0x6')](),controller[_0xccfc('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index b73282d..1dd3d6a 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 _0x83bb=['*,*,*,*','sequelize','exports','INTEGER','STRING','TEXT'];(function(_0x42fba6,_0x6d76b7){var _0x3a3312=function(_0x24fdc1){while(--_0x24fdc1){_0x42fba6['push'](_0x42fba6['shift']());}};_0x3a3312(++_0x6d76b7);}(_0x83bb,0x1b7));var _0xb83b=function(_0x43bdb2,_0x446e5b){_0x43bdb2=_0x43bdb2-0x0;var _0xc817e1=_0x83bb[_0x43bdb2];return _0xc817e1;};'use strict';var Sequelize=require(_0xb83b('0x0'));module[_0xb83b('0x1')]={'priority':{'type':Sequelize[_0xb83b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb83b('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb83b('0x4')]()},'description':{'type':Sequelize[_0xb83b('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xb83b('0x5')}}; \ No newline at end of file +var _0x48b1=['TEXT','STRING','sequelize','exports','INTEGER','noop'];(function(_0x1d58f0,_0x1a82db){var _0x2105a4=function(_0x5950b7){while(--_0x5950b7){_0x1d58f0['push'](_0x1d58f0['shift']());}};_0x2105a4(++_0x1a82db);}(_0x48b1,0x1b8));var _0x148b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x48b1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x148b('0x0'));module[_0x148b('0x1')]={'priority':{'type':Sequelize[_0x148b('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x148b('0x3')},'appdata':{'type':Sequelize[_0x148b('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x148b('0x5')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index eeef936..7956c7a 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 _0xda3f=['includeAll','include','merge','find','catch','body','MailApplication','destroy','rimraf','zip-dir','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','end','stack','name','send','params','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0xba359c,_0x155327){var _0x5a8b09=function(_0x597295){while(--_0x597295){_0xba359c['push'](_0xba359c['shift']());}};_0x5a8b09(++_0x155327);}(_0xda3f,0xec));var _0xfda3=function(_0x57b9a0,_0x330506){_0x57b9a0=_0x57b9a0-0x0;var _0x4092a1=_0xda3f[_0x57b9a0];return _0x4092a1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfda3('0x0'));var zipdir=require(_0xfda3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfda3('0x2'));var Mustache=require('mustache');var util=require(_0xfda3('0x3'));var path=require(_0xfda3('0x4'));var sox=require('sox');var csv=require(_0xfda3('0x5'));var ejs=require(_0xfda3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x5'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var licenseUtil=require(_0xfda3('0x15'));var db=require(_0xfda3('0x16'))['db'];function respondWithStatusCode(_0x4b77ea,_0x583125){_0x583125=_0x583125||0xcc;return function(_0x5d7d5b){if(_0x5d7d5b){return _0x4b77ea[_0xfda3('0x17')](_0x583125);}return _0x4b77ea[_0xfda3('0x18')](_0x583125)['end']();};}function respondWithResult(_0x501588,_0x587e9b){_0x587e9b=_0x587e9b||0xc8;return function(_0x227d72){if(_0x227d72){return _0x501588[_0xfda3('0x18')](_0x587e9b)['json'](_0x227d72);}};}function respondWithFilteredResult(_0x57a229,_0x533365){return function(_0x80ea80){if(_0x80ea80){var _0x474707=typeof _0x533365[_0xfda3('0x19')]===_0xfda3('0x1a')&&typeof _0x533365[_0xfda3('0x1b')]===_0xfda3('0x1a');var _0x2aadcb=_0x80ea80[_0xfda3('0x1c')];var _0x4680bf=_0x474707?0x0:_0x533365[_0xfda3('0x19')];var _0x54a7c6=_0x474707?_0x80ea80[_0xfda3('0x1c')]:_0x533365[_0xfda3('0x19')]+_0x533365[_0xfda3('0x1b')];var _0x32855a;if(_0x54a7c6>=_0x2aadcb){_0x54a7c6=_0x2aadcb;_0x32855a=0xc8;}else{_0x32855a=0xce;}_0x57a229['status'](_0x32855a);return _0x57a229[_0xfda3('0x1d')](_0xfda3('0x1e'),_0x4680bf+'-'+_0x54a7c6+'/'+_0x2aadcb)[_0xfda3('0x1f')](_0x80ea80);}return null;};}function patchUpdates(_0x51e731){return function(_0x5ad52a){try{jsonpatch[_0xfda3('0x20')](_0x5ad52a,_0x51e731,!![]);}catch(_0x38d428){return BPromise[_0xfda3('0x21')](_0x38d428);}return _0x5ad52a['save']();};}function saveUpdates(_0x3cf5a9,_0xef2535){return function(_0x1e15a8){if(_0x1e15a8){return _0x1e15a8[_0xfda3('0x22')](_0x3cf5a9)[_0xfda3('0x23')](function(_0x2b84b7){return _0x2b84b7;});}return null;};}function removeEntity(_0x2677f6,_0xc6fb9a){return function(_0x16eaa6){if(_0x16eaa6){return _0x16eaa6['destroy']()[_0xfda3('0x23')](function(){_0x2677f6[_0xfda3('0x18')](0xcc)[_0xfda3('0x24')]();});}};}function handleEntityNotFound(_0x4ae9b9,_0x45a977){return function(_0x39e246){if(!_0x39e246){_0x4ae9b9[_0xfda3('0x17')](0x194);}return _0x39e246;};}function handleError(_0x38946d,_0x1cb831){_0x1cb831=_0x1cb831||0x1f4;return function(_0xad9f7b){logger['error'](_0xad9f7b[_0xfda3('0x25')]);if(_0xad9f7b[_0xfda3('0x26')]){delete _0xad9f7b[_0xfda3('0x26')];}_0x38946d[_0xfda3('0x18')](_0x1cb831)[_0xfda3('0x27')](_0xad9f7b);};}exports['show']=function(_0x3c1549,_0x4101b1){var _0x301509={'raw':!![],'where':{'id':_0x3c1549[_0xfda3('0x28')]['id']}},_0x474992={};_0x474992[_0xfda3('0x29')]=_[_0xfda3('0x2a')](db['MailApplication']['rawAttributes']);_0x474992[_0xfda3('0x2b')]=_['keys'](_0x3c1549['query']);_0x474992[_0xfda3('0x2c')]=_[_0xfda3('0x2d')](_0x474992[_0xfda3('0x29')],_0x474992[_0xfda3('0x2b')]);_0x301509[_0xfda3('0x2e')]=_[_0xfda3('0x2d')](_0x474992[_0xfda3('0x29')],qs[_0xfda3('0x2f')](_0x3c1549[_0xfda3('0x2b')]['fields']));_0x301509[_0xfda3('0x2e')]=_0x301509[_0xfda3('0x2e')][_0xfda3('0x30')]?_0x301509[_0xfda3('0x2e')]:_0x474992[_0xfda3('0x29')];if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x31')]){_0x301509[_0xfda3('0x32')]=[{'all':!![]}];}_0x301509=_[_0xfda3('0x33')]({},_0x301509,_0x3c1549['options']);return db['MailApplication'][_0xfda3('0x34')](_0x301509)[_0xfda3('0x23')](handleEntityNotFound(_0x4101b1,null))['then'](respondWithResult(_0x4101b1,null))[_0xfda3('0x35')](handleError(_0x4101b1,null));};exports[_0xfda3('0x22')]=function(_0x28ca96,_0x52ee98){if(_0x28ca96[_0xfda3('0x36')]['id']){delete _0x28ca96[_0xfda3('0x36')]['id'];}return db[_0xfda3('0x37')][_0xfda3('0x34')]({'where':{'id':_0x28ca96[_0xfda3('0x28')]['id']}})['then'](handleEntityNotFound(_0x52ee98,null))[_0xfda3('0x23')](saveUpdates(_0x28ca96[_0xfda3('0x36')],null))[_0xfda3('0x23')](respondWithResult(_0x52ee98,null))['catch'](handleError(_0x52ee98,null));};exports[_0xfda3('0x38')]=function(_0x4854b1,_0x2d9a3f){return db[_0xfda3('0x37')][_0xfda3('0x34')]({'where':{'id':_0x4854b1[_0xfda3('0x28')]['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x2d9a3f,null))[_0xfda3('0x23')](removeEntity(_0x2d9a3f,null))[_0xfda3('0x35')](handleError(_0x2d9a3f,null));}; \ No newline at end of file +var _0x9bde=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','show','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','params','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x58391a,_0x3cc666){var _0xe02c18=function(_0x5c1887){while(--_0x5c1887){_0x58391a['push'](_0x58391a['shift']());}};_0xe02c18(++_0x3cc666);}(_0x9bde,0xe1));var _0xe9bd=function(_0xaee78d,_0x554f13){_0xaee78d=_0xaee78d-0x0;var _0x490e3a=_0x9bde[_0xaee78d];return _0x490e3a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x5e022a,_0x2c1d98){_0x2c1d98=_0x2c1d98||0xcc;return function(_0x4ac319){if(_0x4ac319){return _0x5e022a[_0xe9bd('0x19')](_0x2c1d98);}return _0x5e022a[_0xe9bd('0x1a')](_0x2c1d98)[_0xe9bd('0x1b')]();};}function respondWithResult(_0x51109f,_0x47ba5e){_0x47ba5e=_0x47ba5e||0xc8;return function(_0x46a95e){if(_0x46a95e){return _0x51109f[_0xe9bd('0x1a')](_0x47ba5e)[_0xe9bd('0x1c')](_0x46a95e);}};}function respondWithFilteredResult(_0x46a59b,_0x3360bd){return function(_0x389e7b){if(_0x389e7b){var _0x45a9f2=typeof _0x3360bd['offset']===_0xe9bd('0x1d')&&typeof _0x3360bd[_0xe9bd('0x1e')]===_0xe9bd('0x1d');var _0x494b27=_0x389e7b[_0xe9bd('0x1f')];var _0x3bae08=_0x45a9f2?0x0:_0x3360bd[_0xe9bd('0x20')];var _0x330733=_0x45a9f2?_0x389e7b['count']:_0x3360bd[_0xe9bd('0x20')]+_0x3360bd['limit'];var _0xc6b661;if(_0x330733>=_0x494b27){_0x330733=_0x494b27;_0xc6b661=0xc8;}else{_0xc6b661=0xce;}_0x46a59b['status'](_0xc6b661);return _0x46a59b[_0xe9bd('0x21')](_0xe9bd('0x22'),_0x3bae08+'-'+_0x330733+'/'+_0x494b27)[_0xe9bd('0x1c')](_0x389e7b);}return null;};}function patchUpdates(_0x3dda13){return function(_0x1acb82){try{jsonpatch[_0xe9bd('0x23')](_0x1acb82,_0x3dda13,!![]);}catch(_0x6593ce){return BPromise['reject'](_0x6593ce);}return _0x1acb82[_0xe9bd('0x24')]();};}function saveUpdates(_0x28cd17,_0x4ecaf5){return function(_0x37aec1){if(_0x37aec1){return _0x37aec1['update'](_0x28cd17)[_0xe9bd('0x25')](function(_0x1b9cc9){return _0x1b9cc9;});}return null;};}function removeEntity(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(_0x5bc4bf){return _0x5bc4bf[_0xe9bd('0x26')]()[_0xe9bd('0x25')](function(){_0x36f8c0[_0xe9bd('0x1a')](0xcc)[_0xe9bd('0x1b')]();});}};}function handleEntityNotFound(_0x2641be,_0xb52d45){return function(_0x399f3c){if(!_0x399f3c){_0x2641be[_0xe9bd('0x19')](0x194);}return _0x399f3c;};}function handleError(_0x1ae889,_0x5987af){_0x5987af=_0x5987af||0x1f4;return function(_0x3c211a){logger[_0xe9bd('0x27')](_0x3c211a['stack']);if(_0x3c211a[_0xe9bd('0x28')]){delete _0x3c211a[_0xe9bd('0x28')];}_0x1ae889[_0xe9bd('0x1a')](_0x5987af)[_0xe9bd('0x29')](_0x3c211a);};}exports[_0xe9bd('0x2a')]=function(_0x183601,_0x519f48){var _0x5b7f1d={'raw':!![],'where':{'id':_0x183601['params']['id']}},_0x1de54c={};_0x1de54c[_0xe9bd('0x2b')]=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')][_0xe9bd('0x2e')]);_0x1de54c[_0xe9bd('0x2f')]=_['keys'](_0x183601['query']);_0x1de54c[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],_0x1de54c[_0xe9bd('0x2f')]);_0x5b7f1d[_0xe9bd('0x32')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],qs[_0xe9bd('0x33')](_0x183601[_0xe9bd('0x2f')]['fields']));_0x5b7f1d[_0xe9bd('0x32')]=_0x5b7f1d[_0xe9bd('0x32')][_0xe9bd('0x34')]?_0x5b7f1d['attributes']:_0x1de54c['model'];if(_0x183601[_0xe9bd('0x2f')][_0xe9bd('0x35')]){_0x5b7f1d[_0xe9bd('0x36')]=[{'all':!![]}];}_0x5b7f1d=_[_0xe9bd('0x37')]({},_0x5b7f1d,_0x183601[_0xe9bd('0x38')]);return db[_0xe9bd('0x2d')][_0xe9bd('0x39')](_0x5b7f1d)[_0xe9bd('0x25')](handleEntityNotFound(_0x519f48,null))[_0xe9bd('0x25')](respondWithResult(_0x519f48,null))[_0xe9bd('0x3a')](handleError(_0x519f48,null));};exports[_0xe9bd('0x3b')]=function(_0x549dd1,_0x2ad46e){if(_0x549dd1[_0xe9bd('0x3c')]['id']){delete _0x549dd1[_0xe9bd('0x3c')]['id'];}return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x549dd1[_0xe9bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2ad46e,null))[_0xe9bd('0x25')](saveUpdates(_0x549dd1[_0xe9bd('0x3c')],null))['then'](respondWithResult(_0x2ad46e,null))[_0xe9bd('0x3a')](handleError(_0x2ad46e,null));};exports[_0xe9bd('0x26')]=function(_0x4c7d47,_0x4b1da0){return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x4c7d47['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x4b1da0,null))[_0xe9bd('0x25')](removeEntity(_0x4b1da0,null))[_0xe9bd('0x3a')](handleError(_0x4b1da0,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index eb1fc5f..b5327f8 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 _0xa64d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x333151,_0x347994){var _0x52ead1=function(_0x1d018e){while(--_0x1d018e){_0x333151['push'](_0x333151['shift']());}};_0x52ead1(++_0x347994);}(_0xa64d,0x140));var _0xda64=function(_0x42f16e,_0x365ebd){_0x42f16e=_0x42f16e-0x0;var _0x4e25fe=_0xa64d[_0x42f16e];return _0x4e25fe;};'use strict';var _=require(_0xda64('0x0'));var util=require(_0xda64('0x1'));var logger=require(_0xda64('0x2'))(_0xda64('0x3'));var moment=require(_0xda64('0x4'));var BPromise=require(_0xda64('0x5'));var rp=require(_0xda64('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xda64('0x7'));var config=require(_0xda64('0x8'));var attributes=require(_0xda64('0x9'));module[_0xda64('0xa')]=function(_0x848789,_0xe364b6){return _0x848789[_0xda64('0xb')](_0xda64('0xc'),attributes,{'tableName':_0xda64('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xda64('0xe'),'collate':_0xda64('0xf')});}; \ No newline at end of file +var _0x0cfb=['bluebird','request-promise','../../config/environment','exports','define','MailApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment'];(function(_0x39752b,_0x41c9f0){var _0x221636=function(_0x430b2b){while(--_0x430b2b){_0x39752b['push'](_0x39752b['shift']());}};_0x221636(++_0x41c9f0);}(_0x0cfb,0x110));var _0xb0cf=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x0cfb[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xb0cf('0x0'));var util=require('util');var logger=require(_0xb0cf('0x1'))('api');var moment=require(_0xb0cf('0x2'));var BPromise=require(_0xb0cf('0x3'));var rp=require(_0xb0cf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb0cf('0x5'));var attributes=require('./mailApplication.attributes');module[_0xb0cf('0x6')]=function(_0x4d3db6,_0x320046){return _0x4d3db6[_0xb0cf('0x7')](_0xb0cf('0x8'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb0cf('0x9'),'collate':_0xb0cf('0xa')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index acebf07..7dc4e45 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 _0x2752=['then','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes','limit','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x39ed9c,_0x58277d){var _0x30d1e7=function(_0x992b42){while(--_0x992b42){_0x39ed9c['push'](_0x39ed9c['shift']());}};_0x30d1e7(++_0x58277d);}(_0x2752,0x12b));var _0x2275=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2752[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x2275('0x0'));var util=require('util');var moment=require(_0x2275('0x1'));var BPromise=require('bluebird');var rs=require(_0x2275('0x2'));var fs=require('fs');var Redis=require(_0x2275('0x3'));var db=require(_0x2275('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2275('0x5'))(_0x2275('0x6'));var config=require(_0x2275('0x7'));var jayson=require(_0x2275('0x8'));var client=jayson[_0x2275('0x9')][_0x2275('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48e596,_0x1ef09f,_0x4ec32f){return new BPromise(function(_0x565af8,_0x275bdf){return client['request'](_0x48e596,_0x4ec32f)[_0x2275('0xb')](function(_0x8e8c7f){logger[_0x2275('0xc')](_0x2275('0xd'),_0x1ef09f,_0x2275('0xe'));logger['debug'](_0x2275('0xf'),_0x1ef09f,_0x2275('0xe'),JSON[_0x2275('0x10')](_0x8e8c7f));if(_0x8e8c7f[_0x2275('0x11')]){if(_0x8e8c7f[_0x2275('0x11')][_0x2275('0x12')]===0x1f4){logger['error'](_0x2275('0xd'),_0x1ef09f,_0x8e8c7f[_0x2275('0x11')][_0x2275('0x13')]);return _0x275bdf(_0x8e8c7f[_0x2275('0x11')][_0x2275('0x13')]);}logger[_0x2275('0x11')](_0x2275('0xd'),_0x1ef09f,_0x8e8c7f[_0x2275('0x11')][_0x2275('0x13')]);return _0x565af8(_0x8e8c7f[_0x2275('0x11')]['message']);}else{logger[_0x2275('0xc')]('MailApplication,\x20%s,\x20%s',_0x1ef09f,_0x2275('0xe'));_0x565af8(_0x8e8c7f[_0x2275('0x14')][_0x2275('0x13')]);}})[_0x2275('0x15')](function(_0x27248f){logger[_0x2275('0x11')]('MailApplication,\x20%s,\x20%s',_0x1ef09f,_0x27248f);_0x275bdf(_0x27248f);});});}exports[_0x2275('0x16')]=function(_0x1e1171){var _0x14b6bb=this;return new Promise(function(_0x30e1ad,_0x4f722d){return db[_0x2275('0x17')][_0x2275('0x18')](_0x1e1171[_0x2275('0x19')],{'raw':_0x1e1171[_0x2275('0x1a')]?_0x1e1171['options'][_0x2275('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e1171[_0x2275('0x1a')]?_0x1e1171[_0x2275('0x1a')][_0x2275('0x1c')]||null:null,'attributes':_0x1e1171['options']?_0x1e1171[_0x2275('0x1a')][_0x2275('0x1d')]||null:null,'limit':_0x1e1171['options']?_0x1e1171[_0x2275('0x1a')][_0x2275('0x1e')]||null:null})['then'](function(_0x151b84){logger['info']('UpdateMailApplication',_0x1e1171);logger['debug'](_0x2275('0x16'),_0x1e1171,JSON[_0x2275('0x10')](_0x151b84));_0x30e1ad(_0x151b84);})[_0x2275('0x15')](function(_0x2166ce){logger[_0x2275('0x11')](_0x2275('0x16'),_0x2166ce[_0x2275('0x13')],_0x1e1171);_0x4f722d(_0x14b6bb[_0x2275('0x11')](0x1f4,_0x2166ce['message']));});});}; \ No newline at end of file +var _0xd817=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','body','options','raw','attributes','lodash','util','moment','bluebird'];(function(_0x16fdcd,_0x207cf2){var _0x2c3fe8=function(_0x55e6f3){while(--_0x55e6f3){_0x16fdcd['push'](_0x16fdcd['shift']());}};_0x2c3fe8(++_0x207cf2);}(_0xd817,0xce));var _0x7d81=function(_0x20bc10,_0x35bed9){_0x20bc10=_0x20bc10-0x0;var _0x3bd5ce=_0xd817[_0x20bc10];return _0x3bd5ce;};'use strict';var _=require(_0x7d81('0x0'));var util=require(_0x7d81('0x1'));var moment=require(_0x7d81('0x2'));var BPromise=require(_0x7d81('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d81('0x4'));var db=require(_0x7d81('0x5'))['db'];var utils=require(_0x7d81('0x6'));var logger=require(_0x7d81('0x7'))(_0x7d81('0x8'));var config=require(_0x7d81('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7d81('0xa')][_0x7d81('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3716b4,_0x4559ce,_0x3d97e0){return new BPromise(function(_0x1c22cf,_0x5045b1){return client[_0x7d81('0xc')](_0x3716b4,_0x3d97e0)[_0x7d81('0xd')](function(_0x363883){logger[_0x7d81('0xe')](_0x7d81('0xf'),_0x4559ce,_0x7d81('0x10'));logger[_0x7d81('0x11')](_0x7d81('0x12'),_0x4559ce,_0x7d81('0x10'),JSON[_0x7d81('0x13')](_0x363883));if(_0x363883[_0x7d81('0x14')]){if(_0x363883[_0x7d81('0x14')][_0x7d81('0x15')]===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x4559ce,_0x363883[_0x7d81('0x14')][_0x7d81('0x16')]);return _0x5045b1(_0x363883[_0x7d81('0x14')][_0x7d81('0x16')]);}logger[_0x7d81('0x14')](_0x7d81('0xf'),_0x4559ce,_0x363883[_0x7d81('0x14')][_0x7d81('0x16')]);return _0x1c22cf(_0x363883['error'][_0x7d81('0x16')]);}else{logger[_0x7d81('0xe')](_0x7d81('0xf'),_0x4559ce,_0x7d81('0x10'));_0x1c22cf(_0x363883[_0x7d81('0x17')][_0x7d81('0x16')]);}})[_0x7d81('0x18')](function(_0x526a99){logger[_0x7d81('0x14')]('MailApplication,\x20%s,\x20%s',_0x4559ce,_0x526a99);_0x5045b1(_0x526a99);});});}exports[_0x7d81('0x19')]=function(_0xa57b8c){var _0x263134=this;return new Promise(function(_0x21e5c6,_0x43e7f0){return db['MailApplication']['update'](_0xa57b8c[_0x7d81('0x1a')],{'raw':_0xa57b8c['options']?_0xa57b8c[_0x7d81('0x1b')][_0x7d81('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa57b8c[_0x7d81('0x1b')]?_0xa57b8c[_0x7d81('0x1b')]['where']||null:null,'attributes':_0xa57b8c[_0x7d81('0x1b')]?_0xa57b8c[_0x7d81('0x1b')][_0x7d81('0x1d')]||null:null,'limit':_0xa57b8c[_0x7d81('0x1b')]?_0xa57b8c[_0x7d81('0x1b')]['limit']||null:null})['then'](function(_0x28e71e){logger[_0x7d81('0xe')](_0x7d81('0x19'),_0xa57b8c);logger['debug'](_0x7d81('0x19'),_0xa57b8c,JSON['stringify'](_0x28e71e));_0x21e5c6(_0x28e71e);})[_0x7d81('0x18')](function(_0x21156d){logger[_0x7d81('0x14')](_0x7d81('0x19'),_0x21156d[_0x7d81('0x16')],_0xa57b8c);_0x43e7f0(_0x263134[_0x7d81('0x14')](0x1f4,_0x21156d[_0x7d81('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index e48f73d..0fe8635 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 _0x4d50=['getMessages','download','post','create','/:id/tags','tracked','mail','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','removeTags','exports','express','Router','../../components/interaction/service','index','get','/describe','isAuthenticated','/:id','show','/:id/messages'];(function(_0x3d745c,_0x46e9b4){var _0x4827d4=function(_0x37d38e){while(--_0x37d38e){_0x3d745c['push'](_0x3d745c['shift']());}};_0x4827d4(++_0x46e9b4);}(_0x4d50,0x122));var _0x04d5=function(_0x5822e9,_0x2fed10){_0x5822e9=_0x5822e9-0x0;var _0x47a447=_0x4d50[_0x5822e9];return _0x47a447;};'use strict';var express=require(_0x04d5('0x0'));var router=express[_0x04d5('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x04d5('0x2'));var controller=require('./mailInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x04d5('0x3')]);router[_0x04d5('0x4')](_0x04d5('0x5'),auth[_0x04d5('0x6')](),controller['describe']);router[_0x04d5('0x4')](_0x04d5('0x7'),auth[_0x04d5('0x6')](),controller[_0x04d5('0x8')]);router[_0x04d5('0x4')](_0x04d5('0x9'),auth[_0x04d5('0x6')](),controller[_0x04d5('0xa')]);router['get']('/:id/download',auth[_0x04d5('0x6')](),controller[_0x04d5('0xb')]);router[_0x04d5('0xc')]('/',auth[_0x04d5('0x6')](),controller[_0x04d5('0xd')]);router['post'](_0x04d5('0x9'),auth[_0x04d5('0x6')](),controller['addMessage']);router[_0x04d5('0xc')](_0x04d5('0xe'),auth['isAuthenticated'](),interaction[_0x04d5('0xf')](_0x04d5('0x10'),'mailinteraction:addtags'),controller[_0x04d5('0x11')]);router[_0x04d5('0x12')](_0x04d5('0x7'),auth[_0x04d5('0x6')](),interaction[_0x04d5('0xf')](_0x04d5('0x10'),_0x04d5('0x13')),controller[_0x04d5('0x14')]);router[_0x04d5('0x15')](_0x04d5('0x7'),auth[_0x04d5('0x6')](),interaction[_0x04d5('0xf')](_0x04d5('0x10'),_0x04d5('0x16')),controller['destroy']);router['delete'](_0x04d5('0xe'),auth[_0x04d5('0x6')](),controller[_0x04d5('0x17')]);module[_0x04d5('0x18')]=router; \ No newline at end of file +var _0xea8a=['get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','put','tracked','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','Router','../../components/interaction/service','./mailInteraction.controller'];(function(_0x8e52f8,_0x263800){var _0x207335=function(_0x482ba6){while(--_0x482ba6){_0x8e52f8['push'](_0x8e52f8['shift']());}};_0x207335(++_0x263800);}(_0xea8a,0x10b));var _0xaea8=function(_0x1cb5cf,_0x3eaea8){_0x1cb5cf=_0x1cb5cf-0x0;var _0x35a284=_0xea8a[_0x1cb5cf];return _0x35a284;};'use strict';var express=require('express');var router=express[_0xaea8('0x0')]();var auth=require('../../components/auth/service');var interaction=require(_0xaea8('0x1'));var controller=require(_0xaea8('0x2'));router[_0xaea8('0x3')]('/',auth[_0xaea8('0x4')](),controller['index']);router[_0xaea8('0x3')](_0xaea8('0x5'),auth[_0xaea8('0x4')](),controller[_0xaea8('0x6')]);router[_0xaea8('0x3')](_0xaea8('0x7'),auth[_0xaea8('0x4')](),controller[_0xaea8('0x8')]);router[_0xaea8('0x3')](_0xaea8('0x9'),auth['isAuthenticated'](),controller[_0xaea8('0xa')]);router[_0xaea8('0x3')](_0xaea8('0xb'),auth[_0xaea8('0x4')](),controller['download']);router[_0xaea8('0xc')]('/',auth[_0xaea8('0x4')](),controller['create']);router['post'](_0xaea8('0x9'),auth['isAuthenticated'](),controller[_0xaea8('0xd')]);router['post'](_0xaea8('0xe'),auth[_0xaea8('0x4')](),interaction['tracked'](_0xaea8('0xf'),_0xaea8('0x10')),controller[_0xaea8('0x11')]);router[_0xaea8('0x12')](_0xaea8('0x7'),auth['isAuthenticated'](),interaction[_0xaea8('0x13')](_0xaea8('0xf'),_0xaea8('0x14')),controller[_0xaea8('0x15')]);router[_0xaea8('0x16')](_0xaea8('0x7'),auth[_0xaea8('0x4')](),interaction[_0xaea8('0x13')](_0xaea8('0xf'),_0xaea8('0x17')),controller[_0xaea8('0x18')]);router['delete'](_0xaea8('0xe'),auth['isAuthenticated'](),controller[_0xaea8('0x19')]);module[_0xaea8('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 512e3eb..9708117 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 _0xb50c=['out','sequelize','iconv','BOOLEAN','DATE','STRING','long','TEXT','ENUM'];(function(_0x3d3509,_0x3596c4){var _0x35e18b=function(_0x5ced62){while(--_0x5ced62){_0x3d3509['push'](_0x3d3509['shift']());}};_0x35e18b(++_0x3596c4);}(_0xb50c,0x1e7));var _0xcb50=function(_0x555cd9,_0x3c89a9){_0x555cd9=_0x555cd9-0x0;var _0x40bb82=_0xb50c[_0x555cd9];return _0x40bb82;};'use strict';var Sequelize=require(_0xcb50('0x0'));var iconv=require(_0xcb50('0x1'));module['exports']={'closed':{'type':Sequelize[_0xcb50('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcb50('0x3')]},'disposition':{'type':Sequelize[_0xcb50('0x4')]},'secondDisposition':{'type':Sequelize[_0xcb50('0x4')]},'thirdDisposition':{'type':Sequelize[_0xcb50('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xcb50('0x4')](0x1fe)},'to':{'type':Sequelize[_0xcb50('0x4')]},'cc':{'type':Sequelize['TEXT'](_0xcb50('0x5'))},'subject':{'type':Sequelize[_0xcb50('0x6')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xcb50('0x3')]},'substatus':{'type':Sequelize[_0xcb50('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xcb50('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xcb50('0x7')]('in',_0xcb50('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xcb50('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xcb50('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xec83=['exports','BOOLEAN','DATE','STRING','TEXT','ENUM','out','sequelize','iconv'];(function(_0x5015d4,_0x1aae87){var _0x2b8076=function(_0x30a0a6){while(--_0x30a0a6){_0x5015d4['push'](_0x5015d4['shift']());}};_0x2b8076(++_0x1aae87);}(_0xec83,0xfa));var _0x3ec8=function(_0x43de22,_0x1eced6){_0x43de22=_0x43de22-0x0;var _0x4b15ee=_0xec83[_0x43de22];return _0x4b15ee;};'use strict';var Sequelize=require(_0x3ec8('0x0'));var iconv=require(_0x3ec8('0x1'));module[_0x3ec8('0x2')]={'closed':{'type':Sequelize[_0x3ec8('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3ec8('0x4')]},'disposition':{'type':Sequelize[_0x3ec8('0x5')]},'secondDisposition':{'type':Sequelize[_0x3ec8('0x5')]},'thirdDisposition':{'type':Sequelize[_0x3ec8('0x5')]},'note':{'type':Sequelize[_0x3ec8('0x5')]},'inReplyTo':{'type':Sequelize[_0x3ec8('0x5')](0x1fe)},'to':{'type':Sequelize[_0x3ec8('0x5')]},'cc':{'type':Sequelize[_0x3ec8('0x6')]('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x3ec8('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x3ec8('0x4')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x3ec8('0x7')]('in',_0x3ec8('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3ec8('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x3ec8('0x7')]('in',_0x3ec8('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x3ec8('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index d0d4054..ba0fc6b 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 _0x70ed=['omit','findOne','sort','pick','filters','where','MailInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','rows','addTags','setTags','spread','Tag','emit','removeTags','download','unix','toString','root','server','files','tmp','join','attachments','Attachment','Attachments','from','bcc','createdAt','Messages','mkdirSync','each','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','push','build','writeFileSync','message%d.eml','eml-format','rimraf','zip-dir','moment','bluebird','util','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','offset','limit','count','set','Content-Range','update','then','destroy','end','error','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','mail','query','catch','model','keys','intersection','attributes','fields','length','include','merge','options','create','body','find','params','describe','MailMessage','ids'];(function(_0x3a83ed,_0x3eb477){var _0x2453e8=function(_0x15318f){while(--_0x15318f){_0x3a83ed['push'](_0x3a83ed['shift']());}};_0x2453e8(++_0x3eb477);}(_0x70ed,0x1e8));var _0xd70e=function(_0x28b0a4,_0x2ea758){_0x28b0a4=_0x28b0a4-0x0;var _0x105ce6=_0x70ed[_0x28b0a4];return _0x105ce6;};'use strict';var emlformat=require(_0xd70e('0x0'));var rimraf=require(_0xd70e('0x1'));var zipdir=require(_0xd70e('0x2'));var moment=require(_0xd70e('0x3'));var BPromise=require(_0xd70e('0x4'));var util=require(_0xd70e('0x5'));var path=require('path');var fs=require('fs');var _=require('lodash');var juice=require(_0xd70e('0x6'));var Redis=require(_0xd70e('0x7'));var interaction=require(_0xd70e('0x8'));var qs=require(_0xd70e('0x9'));var logger=require(_0xd70e('0xa'))('api');var config=require(_0xd70e('0xb'));var db=require(_0xd70e('0xc'))['db'];var htmlEntities=require(_0xd70e('0xd'));config[_0xd70e('0xe')]=_[_0xd70e('0xf')](config['redis'],{'host':_0xd70e('0x10'),'port':0x18eb});var socket=require(_0xd70e('0x11'))(new Redis(config[_0xd70e('0xe')]));require(_0xd70e('0x12'))[_0xd70e('0x13')](socket);function respondWithStatusCode(_0x491d21,_0x3f84b6){_0x3f84b6=_0x3f84b6||0xcc;return function(_0x527070){if(_0x527070){return _0x491d21[_0xd70e('0x14')](_0x3f84b6);}return _0x491d21[_0xd70e('0x15')](_0x3f84b6)['end']();};}function respondWithResult(_0x3b1444,_0x398d97){_0x398d97=_0x398d97||0xc8;return function(_0x4de898){if(_0x4de898){return _0x3b1444[_0xd70e('0x15')](_0x398d97)['json'](_0x4de898);}};}function respondWithFilteredResult(_0x257e48,_0x30cfde){return function(_0x2fc3d2){if(_0x2fc3d2){var _0x408cf6=typeof _0x30cfde[_0xd70e('0x16')]==='undefined'&&typeof _0x30cfde[_0xd70e('0x17')]==='undefined';var _0x2e2c80=_0x2fc3d2[_0xd70e('0x18')];var _0x234501=_0x408cf6?0x0:_0x30cfde[_0xd70e('0x16')];var _0x2978f6=_0x408cf6?_0x2fc3d2[_0xd70e('0x18')]:_0x30cfde[_0xd70e('0x16')]+_0x30cfde[_0xd70e('0x17')];var _0x20782c;if(_0x2978f6>=_0x2e2c80){_0x2978f6=_0x2e2c80;_0x20782c=0xc8;}else{_0x20782c=0xce;}_0x257e48[_0xd70e('0x15')](_0x20782c);return _0x257e48[_0xd70e('0x19')](_0xd70e('0x1a'),_0x234501+'-'+_0x2978f6+'/'+_0x2e2c80)['json'](_0x2fc3d2);}return null;};}function saveUpdates(_0x434698){return function(_0x165f6c){if(_0x165f6c){return _0x165f6c[_0xd70e('0x1b')](_0x434698)[_0xd70e('0x1c')](function(_0x557eea){return _0x557eea;});}return null;};}function removeEntity(_0x27dea1){return function(_0x3618da){if(_0x3618da){return _0x3618da[_0xd70e('0x1d')]()[_0xd70e('0x1c')](function(){_0x27dea1['status'](0xcc)[_0xd70e('0x1e')]();});}};}function handleEntityNotFound(_0x1c8ca3){return function(_0x52a45e){if(!_0x52a45e){_0x1c8ca3[_0xd70e('0x14')](0x194);}return _0x52a45e;};}function handleError(_0x48711c,_0x53ccc1){_0x53ccc1=_0x53ccc1||0x1f4;return function(_0x3419b5){logger[_0xd70e('0x1f')](_0x3419b5['stack']);if(_0x3419b5[_0xd70e('0x20')]){delete _0x3419b5[_0xd70e('0x20')];}_0x48711c['status'](_0x53ccc1)[_0xd70e('0x21')](_0x3419b5);};}exports[_0xd70e('0x22')]=function(_0x2eccb3,_0x69ce84){var _0x5ae433={};var _0x223329=_[_0xd70e('0x23')](db[_0xd70e('0x24')][_0xd70e('0x25')],function(_0x491184){return{'name':_0x491184[_0xd70e('0x26')],'type':_0x491184[_0xd70e('0x27')][_0xd70e('0x28')]};});_0x5ae433=qs[_0xd70e('0x29')](_0x223329,_0x2eccb3);return interaction[_0xd70e('0x2a')](_0xd70e('0x2b'),_0x2eccb3[_0xd70e('0x2c')],_0x2eccb3['user'],_0x5ae433,_0x223329)[_0xd70e('0x1c')](respondWithFilteredResult(_0x69ce84,_0x5ae433))[_0xd70e('0x2d')](handleError(_0x69ce84,null));};exports['show']=function(_0x57d3f8,_0x5f2fb7){var _0x35cefc={'raw':![],'where':{'id':_0x57d3f8['params']['id']}},_0x1eb9b5={};_0x1eb9b5[_0xd70e('0x2e')]=_[_0xd70e('0x2f')](db[_0xd70e('0x24')][_0xd70e('0x25')]);_0x1eb9b5[_0xd70e('0x2c')]=_['keys'](_0x57d3f8['query']);_0x1eb9b5['filters']=_[_0xd70e('0x30')](_0x1eb9b5['model'],_0x1eb9b5[_0xd70e('0x2c')]);_0x35cefc[_0xd70e('0x31')]=_[_0xd70e('0x30')](_0x1eb9b5[_0xd70e('0x2e')],qs['fields'](_0x57d3f8[_0xd70e('0x2c')][_0xd70e('0x32')]));_0x35cefc[_0xd70e('0x31')]=_0x35cefc[_0xd70e('0x31')][_0xd70e('0x33')]?_0x35cefc[_0xd70e('0x31')]:_0x1eb9b5[_0xd70e('0x2e')];if(_0x57d3f8[_0xd70e('0x2c')]['includeAll']){_0x35cefc[_0xd70e('0x34')]=[{'all':!![]}];}_0x35cefc=_[_0xd70e('0x35')]({},_0x35cefc,_0x57d3f8[_0xd70e('0x36')]);return db[_0xd70e('0x24')]['find'](_0x35cefc)[_0xd70e('0x1c')](handleEntityNotFound(_0x5f2fb7,null))[_0xd70e('0x1c')](respondWithResult(_0x5f2fb7,null))[_0xd70e('0x2d')](handleError(_0x5f2fb7,null));};exports['create']=function(_0x351e18,_0x2073f1){return db[_0xd70e('0x24')][_0xd70e('0x37')](_0x351e18['body'],{})[_0xd70e('0x1c')](respondWithResult(_0x2073f1,0xc9))[_0xd70e('0x2d')](handleError(_0x2073f1,null));};exports[_0xd70e('0x1b')]=function(_0x3cb28a,_0x51025f){if(_0x3cb28a[_0xd70e('0x38')]['id']){delete _0x3cb28a[_0xd70e('0x38')]['id'];}return db[_0xd70e('0x24')][_0xd70e('0x39')]({'where':{'id':_0x3cb28a[_0xd70e('0x3a')]['id']}})[_0xd70e('0x1c')](handleEntityNotFound(_0x51025f,null))['then'](saveUpdates(_0x3cb28a[_0xd70e('0x38')],null))[_0xd70e('0x1c')](respondWithResult(_0x51025f,null))[_0xd70e('0x2d')](handleError(_0x51025f,null));};exports[_0xd70e('0x1d')]=function(_0x1a2dc1,_0x505a97){return db[_0xd70e('0x24')]['find']({'where':{'id':_0x1a2dc1[_0xd70e('0x3a')]['id']}})[_0xd70e('0x1c')](handleEntityNotFound(_0x505a97,null))['then'](removeEntity(_0x505a97,null))[_0xd70e('0x2d')](handleError(_0x505a97,null));};exports['describe']=function(_0x262777,_0xf12c84){return db['MailInteraction'][_0xd70e('0x3b')]()[_0xd70e('0x1c')](respondWithResult(_0xf12c84,null))['catch'](handleError(_0xf12c84,null));};exports['addMessage']=function(_0x3bf488,_0x43df11){return db[_0xd70e('0x3c')][_0xd70e('0x39')]({'where':{'id':_0x3bf488[_0xd70e('0x3a')]['id']}})[_0xd70e('0x1c')](handleEntityNotFound(_0x43df11,null))[_0xd70e('0x1c')](function(_0x476344){if(_0x476344){return _0x476344['addMessage'](_0x3bf488[_0xd70e('0x38')][_0xd70e('0x3d')],_[_0xd70e('0x3e')](_0x3bf488[_0xd70e('0x38')],[_0xd70e('0x3d'),'id'])||{});}})[_0xd70e('0x1c')](respondWithResult(_0x43df11,null))[_0xd70e('0x2d')](handleError(_0x43df11,null));};exports['getMessages']=function(_0xad2f12,_0x2bc12a){var _0xa549a2={'raw':![],'where':{}};var _0x1ebb4d={};var _0x42221d={'count':0x0,'rows':[]};return db[_0xd70e('0x24')][_0xd70e('0x3f')]({'where':{'id':_0xad2f12[_0xd70e('0x3a')]['id']}})[_0xd70e('0x1c')](handleEntityNotFound(_0x2bc12a,null))[_0xd70e('0x1c')](function(_0x5f00c8){if(_0x5f00c8){_0x1ebb4d[_0xd70e('0x2e')]=_[_0xd70e('0x2f')](db[_0xd70e('0x3c')][_0xd70e('0x25')]);_0x1ebb4d[_0xd70e('0x2c')]=_[_0xd70e('0x2f')](_0xad2f12[_0xd70e('0x2c')]);_0x1ebb4d['filters']=_[_0xd70e('0x30')](_0x1ebb4d['model'],_0x1ebb4d['query']);_0xa549a2[_0xd70e('0x31')]=_[_0xd70e('0x30')](_0x1ebb4d['model'],qs[_0xd70e('0x32')](_0xad2f12['query'][_0xd70e('0x32')]));_0xa549a2[_0xd70e('0x31')]=_0xa549a2['attributes']['length']?_0xa549a2[_0xd70e('0x31')]:_0x1ebb4d[_0xd70e('0x2e')];if(!_0xad2f12[_0xd70e('0x2c')]['hasOwnProperty']('nolimit')){_0xa549a2[_0xd70e('0x17')]=qs[_0xd70e('0x17')](_0xad2f12[_0xd70e('0x2c')][_0xd70e('0x17')]);_0xa549a2[_0xd70e('0x16')]=qs[_0xd70e('0x16')](_0xad2f12[_0xd70e('0x2c')][_0xd70e('0x16')]);}_0xa549a2['order']=qs[_0xd70e('0x40')](_0xad2f12['query'][_0xd70e('0x40')]);_0xa549a2['where']=qs['filters'](_[_0xd70e('0x41')](_0xad2f12[_0xd70e('0x2c')],_0x1ebb4d[_0xd70e('0x42')]));_0xa549a2[_0xd70e('0x43')][_0xd70e('0x44')]=_0x5f00c8['id'];if(_0xad2f12[_0xd70e('0x2c')][_0xd70e('0x45')]){_0xa549a2[_0xd70e('0x43')]=_['merge'](_0xa549a2[_0xd70e('0x43')],{'$or':_[_0xd70e('0x23')](_0xa549a2[_0xd70e('0x31')],function(_0x3cad09){var _0x48c49c={};_0x48c49c[_0x3cad09]={'$like':'%'+_0xad2f12['query'][_0xd70e('0x45')]+'%'};return _0x48c49c;})});}if(_0xad2f12[_0xd70e('0x2c')]['$gte']){var _0x330b6e=_0xad2f12[_0xd70e('0x2c')][_0xd70e('0x46')]['split'](',');var _0x1a5b41={};_0x1a5b41[_0x330b6e[0x0]]={'$gte':moment(_0x330b6e[0x1])[_0xd70e('0x47')](_0xd70e('0x48'))};_0xa549a2[_0xd70e('0x43')]=_[_0xd70e('0x35')](_0xa549a2[_0xd70e('0x43')],_0x1a5b41);}_0xa549a2=_['merge']({},_0xa549a2,_0xad2f12[_0xd70e('0x36')]);return db[_0xd70e('0x3c')][_0xd70e('0x18')]({'where':_0xa549a2[_0xd70e('0x43')]})[_0xd70e('0x1c')](function(_0x1198c0){_0x42221d['count']=_0x1198c0;if(_0xad2f12[_0xd70e('0x2c')]['includeAll']){_0xa549a2[_0xd70e('0x34')]=[{'all':!![]}];}return db['MailMessage'][_0xd70e('0x2a')](_0xa549a2);})['then'](function(_0x2351f4){if(_0xad2f12[_0xd70e('0x2c')][_0xd70e('0x49')]===_0xd70e('0x4a')){for(var _0x31ac1e=0x0;_0x31ac1e<_0x2351f4[_0xd70e('0x33')];_0x31ac1e++){_0x2351f4[_0x31ac1e][_0xd70e('0x38')]=juice(_0x2351f4[_0x31ac1e]['body']);}}_0x42221d[_0xd70e('0x4b')]=_0x2351f4;return _0x42221d;});}})['then'](respondWithFilteredResult(_0x2bc12a,_0xa549a2))[_0xd70e('0x2d')](handleError(_0x2bc12a,null));};exports[_0xd70e('0x4c')]=function(_0x58f835,_0x146a14){return db[_0xd70e('0x24')][_0xd70e('0x39')]({'where':{'id':_0x58f835[_0xd70e('0x3a')]['id']}})[_0xd70e('0x1c')](handleEntityNotFound(_0x146a14,null))['then'](function(_0x2d9af2){if(_0x2d9af2){return _0x2d9af2[_0xd70e('0x4d')](_0x58f835['body'][_0xd70e('0x3d')],_[_0xd70e('0x3e')](_0x58f835[_0xd70e('0x38')],[_0xd70e('0x3d'),'id'])||{})[_0xd70e('0x4e')](function(){return db[_0xd70e('0x4f')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x58f835[_0xd70e('0x38')][_0xd70e('0x3d')]}});})[_0xd70e('0x1c')](function(_0x11e5c4){socket[_0xd70e('0x50')]('mailInteractionTags:save',{'id':Number(_0x58f835[_0xd70e('0x3a')]['id']),'tags':_0x11e5c4||[]});return{'id':Number(_0x58f835[_0xd70e('0x3a')]['id']),'tags':_0x11e5c4||[]};});}})[_0xd70e('0x1c')](respondWithResult(_0x146a14,null))[_0xd70e('0x2d')](handleError(_0x146a14,null));};exports[_0xd70e('0x51')]=function(_0x57b60a,_0x5eb6be){return db[_0xd70e('0x24')][_0xd70e('0x39')]({'where':{'id':_0x57b60a['params']['id']}})[_0xd70e('0x1c')](handleEntityNotFound(_0x5eb6be,null))[_0xd70e('0x1c')](function(_0x14f58c){if(_0x14f58c){return _0x14f58c[_0xd70e('0x51')](_0x57b60a['query'][_0xd70e('0x3d')]);}})[_0xd70e('0x1c')](respondWithStatusCode(_0x5eb6be,null))[_0xd70e('0x2d')](handleError(_0x5eb6be,null));};exports[_0xd70e('0x52')]=function(_0x30965c,_0x5c5d80){var _0xa3989b=moment()[_0xd70e('0x53')]()[_0xd70e('0x54')]();var _0x206124=path['join'](config[_0xd70e('0x55')],_0xd70e('0x56'),_0xd70e('0x57'),_0xd70e('0x58'));var _0x2d8506=path[_0xd70e('0x59')](config['root'],_0xd70e('0x56'),_0xd70e('0x57'),'attachments');var _0x3c1887=path['join'](_0x206124,_0xa3989b);var _0x3ff4e1=util[_0xd70e('0x47')]('transcript-%d-%s.zip',_0x30965c['params']['id'],_0xa3989b);var _0x31faab=path['join'](_0x206124,_0x3ff4e1);var _0x14108c=[];if(_0x30965c[_0xd70e('0x2c')][_0xd70e('0x5a')]){_0x14108c['push']({'model':db[_0xd70e('0x5b')],'as':_0xd70e('0x5c'),'raw':!![]});}var _0x2cf9fc=[{'model':db[_0xd70e('0x3c')],'as':'Messages','attributes':['id','body',_0xd70e('0x5d'),'to','cc',_0xd70e('0x5e'),'subject',_0xd70e('0x5f')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x14108c}];return db['MailInteraction'][_0xd70e('0x39')]({'where':{'id':_0x30965c[_0xd70e('0x3a')]['id']},'include':_0x2cf9fc})['then'](handleEntityNotFound(_0x5c5d80,null))[_0xd70e('0x1c')](function(_0x55dbd8){if(_0x55dbd8&&_0x55dbd8[_0xd70e('0x60')]){var _0x1bdbfa=_0x55dbd8['get']({'plain':!![]});fs[_0xd70e('0x61')](_0x3c1887);return BPromise[_0xd70e('0x62')](_0x1bdbfa[_0xd70e('0x60')],function(_0x17a611,_0x1df741){var _0x1a6a94={'from':_0x17a611[_0xd70e('0x5d')],'to':_0x17a611['to']||'missing.recipient@your.company.com','subject':_0x17a611[_0xd70e('0x63')],'html':htmlEntities[_0xd70e('0x64')](_0x17a611[_0xd70e('0x38')]),'headers':{'Date':moment(_0x17a611[_0xd70e('0x5f')])[_0xd70e('0x47')](_0xd70e('0x65'))},'attachments':[]};if(_0x17a611['cc']){_0x1a6a94[_0xd70e('0x66')]['Cc']=_0x17a611['cc'];}if(_0x17a611[_0xd70e('0x5e')]){_0x1a6a94[_0xd70e('0x66')][_0xd70e('0x67')]=_0x17a611[_0xd70e('0x5e')];}return new BPromise(function(_0x58fa41,_0x4ea4de){if(_0x17a611[_0xd70e('0x5c')]){for(var _0x27c6fd=0x0;_0x27c6fd<_0x17a611[_0xd70e('0x5c')]['length'];_0x27c6fd++){var _0x510935=_0x17a611[_0xd70e('0x5c')][_0x27c6fd];var _0x2d848f=path[_0xd70e('0x59')](_0x2d8506,_0x510935[_0xd70e('0x68')]);if(fs[_0xd70e('0x69')](_0x2d848f)){_0x1a6a94['attachments'][_0xd70e('0x6a')]({'name':_0x510935[_0xd70e('0x20')],'contentType':_0x510935[_0xd70e('0x27')],'data':fs['readFileSync'](_0x2d848f)});}}}emlformat[_0xd70e('0x6b')](_0x1a6a94,function(_0x1d5c67,_0x17de01){if(_0x1d5c67)return _0x4ea4de(_0x1d5c67);fs[_0xd70e('0x6c')](path[_0xd70e('0x59')](_0x3c1887,util[_0xd70e('0x47')](_0xd70e('0x6d'),_0x1df741)),_0x17de01);return _0x58fa41(_0x17de01);});});})[_0xd70e('0x1c')](function(){return new BPromise(function(_0x5784df,_0x196864){zipdir(_0x3c1887,{'saveTo':_0x31faab},function(_0x276da7,_0x30dca1){if(_0x276da7)return _0x196864(_0x276da7);return _0x5784df(_0x30dca1);});})[_0xd70e('0x1c')](function(){return new BPromise(function(_0x1d2a5d,_0x2b243e){rimraf(_0x3c1887,function(_0x50ba33){if(_0x50ba33)_0x2b243e(_0x50ba33);return _0x1d2a5d();});});})[_0xd70e('0x1c')](function(){return _0x5c5d80[_0xd70e('0x52')](_0x31faab,_0x3ff4e1,function(_0x430978){if(!_0x430978)fs['unlinkSync'](_0x31faab);});});});}else{return _0x5c5d80[_0xd70e('0x14')](0xc8);}})[_0xd70e('0x2d')](handleError(_0x5c5d80,null));}; \ No newline at end of file +var _0x4091=['../../config/logger','../../config/environment','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','error','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','mail','query','user','catch','params','model','keys','filters','intersection','attributes','includeAll','include','options','find','create','body','destroy','describe','addMessage','ids','getMessages','findOne','fields','length','hasOwnProperty','nolimit','order','sort','pick','MailInteractionId','filter','where','merge','$gte','split','format','MailMessage','inlineCss','true','rows','addTags','setTags','spread','Tag','mailInteractionTags:save','download','unix','join','root','server','files','tmp','transcript-%d-%s.zip','attachments','push','Attachments','Messages','from','bcc','createdAt','get','mkdirSync','each','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','path','lodash','juice','../../components/interaction/service','../../components/parsers/qs'];(function(_0x4850b5,_0x49b3c1){var _0x2ae1f9=function(_0x167c37){while(--_0x167c37){_0x4850b5['push'](_0x4850b5['shift']());}};_0x2ae1f9(++_0x49b3c1);}(_0x4091,0x6c));var _0x1409=function(_0x46275a,_0x157c56){_0x46275a=_0x46275a-0x0;var _0x1b6b39=_0x4091[_0x46275a];return _0x1b6b39;};'use strict';var emlformat=require(_0x1409('0x0'));var rimraf=require(_0x1409('0x1'));var zipdir=require(_0x1409('0x2'));var moment=require(_0x1409('0x3'));var BPromise=require(_0x1409('0x4'));var util=require(_0x1409('0x5'));var path=require(_0x1409('0x6'));var fs=require('fs');var _=require(_0x1409('0x7'));var juice=require(_0x1409('0x8'));var Redis=require('ioredis');var interaction=require(_0x1409('0x9'));var qs=require(_0x1409('0xa'));var logger=require(_0x1409('0xb'))('api');var config=require(_0x1409('0xc'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x1409('0xd'));config[_0x1409('0xe')]=_[_0x1409('0xf')](config['redis'],{'host':_0x1409('0x10'),'port':0x18eb});var socket=require(_0x1409('0x11'))(new Redis(config['redis']));require(_0x1409('0x12'))[_0x1409('0x13')](socket);function respondWithStatusCode(_0x222ccb,_0x3bd792){_0x3bd792=_0x3bd792||0xcc;return function(_0x3560f3){if(_0x3560f3){return _0x222ccb[_0x1409('0x14')](_0x3bd792);}return _0x222ccb[_0x1409('0x15')](_0x3bd792)[_0x1409('0x16')]();};}function respondWithResult(_0x28e872,_0xe72617){_0xe72617=_0xe72617||0xc8;return function(_0x4ffef5){if(_0x4ffef5){return _0x28e872['status'](_0xe72617)[_0x1409('0x17')](_0x4ffef5);}};}function respondWithFilteredResult(_0xe27d27,_0xf36192){return function(_0x138ca2){if(_0x138ca2){var _0x1a2040=typeof _0xf36192[_0x1409('0x18')]===_0x1409('0x19')&&typeof _0xf36192['limit']===_0x1409('0x19');var _0x597805=_0x138ca2[_0x1409('0x1a')];var _0x4ff07e=_0x1a2040?0x0:_0xf36192['offset'];var _0x489fcf=_0x1a2040?_0x138ca2[_0x1409('0x1a')]:_0xf36192[_0x1409('0x18')]+_0xf36192[_0x1409('0x1b')];var _0x369a28;if(_0x489fcf>=_0x597805){_0x489fcf=_0x597805;_0x369a28=0xc8;}else{_0x369a28=0xce;}_0xe27d27[_0x1409('0x15')](_0x369a28);return _0xe27d27[_0x1409('0x1c')](_0x1409('0x1d'),_0x4ff07e+'-'+_0x489fcf+'/'+_0x597805)['json'](_0x138ca2);}return null;};}function saveUpdates(_0x1765ed){return function(_0x118c65){if(_0x118c65){return _0x118c65[_0x1409('0x1e')](_0x1765ed)['then'](function(_0x3bb81f){return _0x3bb81f;});}return null;};}function removeEntity(_0x3bfd1e){return function(_0x434c9a){if(_0x434c9a){return _0x434c9a['destroy']()[_0x1409('0x1f')](function(){_0x3bfd1e[_0x1409('0x15')](0xcc)[_0x1409('0x16')]();});}};}function handleEntityNotFound(_0x3357b9){return function(_0x3574ce){if(!_0x3574ce){_0x3357b9[_0x1409('0x14')](0x194);}return _0x3574ce;};}function handleError(_0x3eeae8,_0x5d50a8){_0x5d50a8=_0x5d50a8||0x1f4;return function(_0x5a2328){logger[_0x1409('0x20')](_0x5a2328['stack']);if(_0x5a2328[_0x1409('0x21')]){delete _0x5a2328[_0x1409('0x21')];}_0x3eeae8[_0x1409('0x15')](_0x5d50a8)[_0x1409('0x22')](_0x5a2328);};}exports[_0x1409('0x23')]=function(_0x469ad3,_0x1e5aa8){var _0x5edcdc={};var _0x5a67c4=_[_0x1409('0x24')](db[_0x1409('0x25')][_0x1409('0x26')],function(_0x32f0b6){return{'name':_0x32f0b6[_0x1409('0x27')],'type':_0x32f0b6[_0x1409('0x28')][_0x1409('0x29')]};});_0x5edcdc=qs[_0x1409('0x2a')](_0x5a67c4,_0x469ad3);return interaction[_0x1409('0x2b')](_0x1409('0x2c'),_0x469ad3[_0x1409('0x2d')],_0x469ad3[_0x1409('0x2e')],_0x5edcdc,_0x5a67c4)[_0x1409('0x1f')](respondWithFilteredResult(_0x1e5aa8,_0x5edcdc))[_0x1409('0x2f')](handleError(_0x1e5aa8,null));};exports['show']=function(_0xaebf9e,_0x53e9e0){var _0x3d9900={'raw':![],'where':{'id':_0xaebf9e[_0x1409('0x30')]['id']}},_0x4422a3={};_0x4422a3[_0x1409('0x31')]=_[_0x1409('0x32')](db[_0x1409('0x25')][_0x1409('0x26')]);_0x4422a3[_0x1409('0x2d')]=_['keys'](_0xaebf9e[_0x1409('0x2d')]);_0x4422a3[_0x1409('0x33')]=_[_0x1409('0x34')](_0x4422a3[_0x1409('0x31')],_0x4422a3['query']);_0x3d9900[_0x1409('0x35')]=_[_0x1409('0x34')](_0x4422a3[_0x1409('0x31')],qs['fields'](_0xaebf9e[_0x1409('0x2d')]['fields']));_0x3d9900[_0x1409('0x35')]=_0x3d9900[_0x1409('0x35')]['length']?_0x3d9900[_0x1409('0x35')]:_0x4422a3[_0x1409('0x31')];if(_0xaebf9e[_0x1409('0x2d')][_0x1409('0x36')]){_0x3d9900[_0x1409('0x37')]=[{'all':!![]}];}_0x3d9900=_['merge']({},_0x3d9900,_0xaebf9e[_0x1409('0x38')]);return db['MailInteraction'][_0x1409('0x39')](_0x3d9900)['then'](handleEntityNotFound(_0x53e9e0,null))['then'](respondWithResult(_0x53e9e0,null))[_0x1409('0x2f')](handleError(_0x53e9e0,null));};exports[_0x1409('0x3a')]=function(_0x74c3f9,_0x3dbd9a){return db[_0x1409('0x25')][_0x1409('0x3a')](_0x74c3f9['body'],{})['then'](respondWithResult(_0x3dbd9a,0xc9))['catch'](handleError(_0x3dbd9a,null));};exports['update']=function(_0x1e561c,_0xdc82af){if(_0x1e561c['body']['id']){delete _0x1e561c[_0x1409('0x3b')]['id'];}return db['MailInteraction'][_0x1409('0x39')]({'where':{'id':_0x1e561c[_0x1409('0x30')]['id']}})[_0x1409('0x1f')](handleEntityNotFound(_0xdc82af,null))[_0x1409('0x1f')](saveUpdates(_0x1e561c[_0x1409('0x3b')],null))[_0x1409('0x1f')](respondWithResult(_0xdc82af,null))[_0x1409('0x2f')](handleError(_0xdc82af,null));};exports[_0x1409('0x3c')]=function(_0x57c8ce,_0x36eb0f){return db[_0x1409('0x25')]['find']({'where':{'id':_0x57c8ce[_0x1409('0x30')]['id']}})[_0x1409('0x1f')](handleEntityNotFound(_0x36eb0f,null))[_0x1409('0x1f')](removeEntity(_0x36eb0f,null))[_0x1409('0x2f')](handleError(_0x36eb0f,null));};exports[_0x1409('0x3d')]=function(_0x493e7e,_0x233d74){return db[_0x1409('0x25')][_0x1409('0x3d')]()[_0x1409('0x1f')](respondWithResult(_0x233d74,null))[_0x1409('0x2f')](handleError(_0x233d74,null));};exports['addMessage']=function(_0x2ccee5,_0x4c8eeb){return db['MailMessage'][_0x1409('0x39')]({'where':{'id':_0x2ccee5[_0x1409('0x30')]['id']}})[_0x1409('0x1f')](handleEntityNotFound(_0x4c8eeb,null))[_0x1409('0x1f')](function(_0x48b794){if(_0x48b794){return _0x48b794[_0x1409('0x3e')](_0x2ccee5[_0x1409('0x3b')][_0x1409('0x3f')],_['omit'](_0x2ccee5['body'],['ids','id'])||{});}})[_0x1409('0x1f')](respondWithResult(_0x4c8eeb,null))[_0x1409('0x2f')](handleError(_0x4c8eeb,null));};exports[_0x1409('0x40')]=function(_0x5d0e75,_0x53f18b){var _0x4d27e9={'raw':![],'where':{}};var _0x1ce789={};var _0x4e2244={'count':0x0,'rows':[]};return db['MailInteraction'][_0x1409('0x41')]({'where':{'id':_0x5d0e75[_0x1409('0x30')]['id']}})[_0x1409('0x1f')](handleEntityNotFound(_0x53f18b,null))[_0x1409('0x1f')](function(_0x48f8b5){if(_0x48f8b5){_0x1ce789['model']=_[_0x1409('0x32')](db['MailMessage'][_0x1409('0x26')]);_0x1ce789[_0x1409('0x2d')]=_[_0x1409('0x32')](_0x5d0e75[_0x1409('0x2d')]);_0x1ce789[_0x1409('0x33')]=_[_0x1409('0x34')](_0x1ce789[_0x1409('0x31')],_0x1ce789[_0x1409('0x2d')]);_0x4d27e9[_0x1409('0x35')]=_[_0x1409('0x34')](_0x1ce789[_0x1409('0x31')],qs[_0x1409('0x42')](_0x5d0e75['query']['fields']));_0x4d27e9[_0x1409('0x35')]=_0x4d27e9[_0x1409('0x35')][_0x1409('0x43')]?_0x4d27e9[_0x1409('0x35')]:_0x1ce789[_0x1409('0x31')];if(!_0x5d0e75[_0x1409('0x2d')][_0x1409('0x44')](_0x1409('0x45'))){_0x4d27e9[_0x1409('0x1b')]=qs[_0x1409('0x1b')](_0x5d0e75[_0x1409('0x2d')][_0x1409('0x1b')]);_0x4d27e9['offset']=qs[_0x1409('0x18')](_0x5d0e75[_0x1409('0x2d')]['offset']);}_0x4d27e9[_0x1409('0x46')]=qs[_0x1409('0x47')](_0x5d0e75[_0x1409('0x2d')][_0x1409('0x47')]);_0x4d27e9['where']=qs[_0x1409('0x33')](_[_0x1409('0x48')](_0x5d0e75['query'],_0x1ce789[_0x1409('0x33')]));_0x4d27e9['where'][_0x1409('0x49')]=_0x48f8b5['id'];if(_0x5d0e75[_0x1409('0x2d')][_0x1409('0x4a')]){_0x4d27e9[_0x1409('0x4b')]=_[_0x1409('0x4c')](_0x4d27e9[_0x1409('0x4b')],{'$or':_[_0x1409('0x24')](_0x4d27e9['attributes'],function(_0x2d8e17){var _0x494ce5={};_0x494ce5[_0x2d8e17]={'$like':'%'+_0x5d0e75['query'][_0x1409('0x4a')]+'%'};return _0x494ce5;})});}if(_0x5d0e75[_0x1409('0x2d')][_0x1409('0x4d')]){var _0x54039d=_0x5d0e75[_0x1409('0x2d')][_0x1409('0x4d')][_0x1409('0x4e')](',');var _0x5d88ee={};_0x5d88ee[_0x54039d[0x0]]={'$gte':moment(_0x54039d[0x1])[_0x1409('0x4f')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4d27e9[_0x1409('0x4b')]=_[_0x1409('0x4c')](_0x4d27e9[_0x1409('0x4b')],_0x5d88ee);}_0x4d27e9=_[_0x1409('0x4c')]({},_0x4d27e9,_0x5d0e75[_0x1409('0x38')]);return db[_0x1409('0x50')][_0x1409('0x1a')]({'where':_0x4d27e9[_0x1409('0x4b')]})[_0x1409('0x1f')](function(_0x2791b0){_0x4e2244[_0x1409('0x1a')]=_0x2791b0;if(_0x5d0e75[_0x1409('0x2d')][_0x1409('0x36')]){_0x4d27e9[_0x1409('0x37')]=[{'all':!![]}];}return db[_0x1409('0x50')][_0x1409('0x2b')](_0x4d27e9);})[_0x1409('0x1f')](function(_0x4b3420){if(_0x5d0e75[_0x1409('0x2d')][_0x1409('0x51')]===_0x1409('0x52')){for(var _0x4d0b23=0x0;_0x4d0b23<_0x4b3420[_0x1409('0x43')];_0x4d0b23++){_0x4b3420[_0x4d0b23][_0x1409('0x3b')]=juice(_0x4b3420[_0x4d0b23][_0x1409('0x3b')]);}}_0x4e2244[_0x1409('0x53')]=_0x4b3420;return _0x4e2244;});}})[_0x1409('0x1f')](respondWithFilteredResult(_0x53f18b,_0x4d27e9))[_0x1409('0x2f')](handleError(_0x53f18b,null));};exports[_0x1409('0x54')]=function(_0x30b49,_0x1829ed){return db[_0x1409('0x25')][_0x1409('0x39')]({'where':{'id':_0x30b49['params']['id']}})[_0x1409('0x1f')](handleEntityNotFound(_0x1829ed,null))[_0x1409('0x1f')](function(_0x1cb01b){if(_0x1cb01b){return _0x1cb01b[_0x1409('0x55')](_0x30b49[_0x1409('0x3b')][_0x1409('0x3f')],_['omit'](_0x30b49[_0x1409('0x3b')],[_0x1409('0x3f'),'id'])||{})[_0x1409('0x56')](function(){return db[_0x1409('0x57')][_0x1409('0x2b')]({'attributes':['id',_0x1409('0x21'),'color'],'where':{'id':_0x30b49[_0x1409('0x3b')][_0x1409('0x3f')]}});})[_0x1409('0x1f')](function(_0x2d8a72){socket['emit'](_0x1409('0x58'),{'id':Number(_0x30b49['params']['id']),'tags':_0x2d8a72||[]});return{'id':Number(_0x30b49[_0x1409('0x30')]['id']),'tags':_0x2d8a72||[]};});}})[_0x1409('0x1f')](respondWithResult(_0x1829ed,null))[_0x1409('0x2f')](handleError(_0x1829ed,null));};exports['removeTags']=function(_0x47e9de,_0x28a398){return db[_0x1409('0x25')][_0x1409('0x39')]({'where':{'id':_0x47e9de['params']['id']}})[_0x1409('0x1f')](handleEntityNotFound(_0x28a398,null))[_0x1409('0x1f')](function(_0x366a85){if(_0x366a85){return _0x366a85['removeTags'](_0x47e9de[_0x1409('0x2d')][_0x1409('0x3f')]);}})[_0x1409('0x1f')](respondWithStatusCode(_0x28a398,null))[_0x1409('0x2f')](handleError(_0x28a398,null));};exports[_0x1409('0x59')]=function(_0x1d2fdc,_0x2edbbc){var _0x24c4b1=moment()[_0x1409('0x5a')]()['toString']();var _0x13bf94=path[_0x1409('0x5b')](config[_0x1409('0x5c')],_0x1409('0x5d'),_0x1409('0x5e'),_0x1409('0x5f'));var _0x5bb142=path[_0x1409('0x5b')](config['root'],_0x1409('0x5d'),'files','attachments');var _0x575845=path[_0x1409('0x5b')](_0x13bf94,_0x24c4b1);var _0x58641b=util['format'](_0x1409('0x60'),_0x1d2fdc[_0x1409('0x30')]['id'],_0x24c4b1);var _0x23e399=path[_0x1409('0x5b')](_0x13bf94,_0x58641b);var _0x79fc76=[];if(_0x1d2fdc[_0x1409('0x2d')][_0x1409('0x61')]){_0x79fc76[_0x1409('0x62')]({'model':db['Attachment'],'as':_0x1409('0x63'),'raw':!![]});}var _0x12f77c=[{'model':db['MailMessage'],'as':_0x1409('0x64'),'attributes':['id','body',_0x1409('0x65'),'to','cc',_0x1409('0x66'),'subject',_0x1409('0x67')],'where':{'secret':![]},'order':qs[_0x1409('0x47')]('id'),'include':_0x79fc76}];return db[_0x1409('0x25')][_0x1409('0x39')]({'where':{'id':_0x1d2fdc[_0x1409('0x30')]['id']},'include':_0x12f77c})[_0x1409('0x1f')](handleEntityNotFound(_0x2edbbc,null))['then'](function(_0xb57f35){if(_0xb57f35&&_0xb57f35['Messages']){var _0x31152d=_0xb57f35[_0x1409('0x68')]({'plain':!![]});fs[_0x1409('0x69')](_0x575845);return BPromise[_0x1409('0x6a')](_0x31152d[_0x1409('0x64')],function(_0x19152d,_0x4092d8){var _0x52085a={'from':_0x19152d['from'],'to':_0x19152d['to']||'missing.recipient@your.company.com','subject':_0x19152d[_0x1409('0x6b')],'html':htmlEntities[_0x1409('0x6c')](_0x19152d[_0x1409('0x3b')]),'headers':{'Date':moment(_0x19152d[_0x1409('0x67')])[_0x1409('0x4f')](_0x1409('0x6d'))},'attachments':[]};if(_0x19152d['cc']){_0x52085a['headers']['Cc']=_0x19152d['cc'];}if(_0x19152d[_0x1409('0x66')]){_0x52085a[_0x1409('0x6e')][_0x1409('0x6f')]=_0x19152d[_0x1409('0x66')];}return new BPromise(function(_0x1b83ee,_0x56b43a){if(_0x19152d[_0x1409('0x63')]){for(var _0x45a602=0x0;_0x45a602<_0x19152d[_0x1409('0x63')][_0x1409('0x43')];_0x45a602++){var _0x47df0b=_0x19152d[_0x1409('0x63')][_0x45a602];var _0x5dfb6a=path[_0x1409('0x5b')](_0x5bb142,_0x47df0b[_0x1409('0x70')]);if(fs[_0x1409('0x71')](_0x5dfb6a)){_0x52085a[_0x1409('0x61')]['push']({'name':_0x47df0b['name'],'contentType':_0x47df0b[_0x1409('0x28')],'data':fs[_0x1409('0x72')](_0x5dfb6a)});}}}emlformat[_0x1409('0x73')](_0x52085a,function(_0x2cf3d8,_0xe9ccca){if(_0x2cf3d8)return _0x56b43a(_0x2cf3d8);fs[_0x1409('0x74')](path['join'](_0x575845,util[_0x1409('0x4f')](_0x1409('0x75'),_0x4092d8)),_0xe9ccca);return _0x1b83ee(_0xe9ccca);});});})['then'](function(){return new BPromise(function(_0x4f5f05,_0x1356d0){zipdir(_0x575845,{'saveTo':_0x23e399},function(_0x5f0917,_0x210c1d){if(_0x5f0917)return _0x1356d0(_0x5f0917);return _0x4f5f05(_0x210c1d);});})[_0x1409('0x1f')](function(){return new BPromise(function(_0x38eefa,_0x52025a){rimraf(_0x575845,function(_0x25c730){if(_0x25c730)_0x52025a(_0x25c730);return _0x38eefa();});});})[_0x1409('0x1f')](function(){return _0x2edbbc[_0x1409('0x59')](_0x23e399,_0x58641b,function(_0x5e8272){if(!_0x5e8272)fs[_0x1409('0x76')](_0x23e399);});});});}else{return _0x2edbbc[_0x1409('0x14')](0xc8);}})[_0x1409('0x2f')](handleError(_0x2edbbc,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index a116afc..9836e15 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 _0x1976=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x1976,0x1e3));var _0x6197=function(_0x4801c3,_0x5e2411){_0x4801c3=_0x4801c3-0x0;var _0x279ab3=_0x1976[_0x4801c3];return _0x279ab3;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x6197('0x0'))['db']['MailInteraction'];var MailMessage=require(_0x6197('0x0'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x6197('0x1')](0x0);var events={'afterCreate':_0x6197('0x2'),'afterUpdate':_0x6197('0x3'),'afterDestroy':_0x6197('0x4')};function emitEvent(_0x21518d){return function(_0x4dd34b,_0x26d53f,_0x399ab4){_0x4dd34b[_0x6197('0x5')]({'attributes':['id'],'raw':!![]})[_0x6197('0x6')](function(_0x15462b){_0x4dd34b[_0x6197('0x7')](_0x6197('0x8'),_0x15462b[_0x6197('0x9')](function(_0x2aa276){return{'id':_0x2aa276['id']};}));return MailMessage[_0x6197('0xa')]({'where':{'MailInteractionId':_0x4dd34b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6197('0x6')](function(_0x3d34a2){_0x4dd34b[_0x6197('0x7')](_0x6197('0xb'),_0x3d34a2[_0x6197('0xc')]);MailInteractionEvents[_0x6197('0xd')](_0x21518d+':'+_0x4dd34b['id'],_0x4dd34b);MailInteractionEvents['emit'](_0x21518d,_0x4dd34b);_0x399ab4(null);})[_0x6197('0xe')](_0x399ab4(null));};}for(var e in events){if(events[_0x6197('0xf')](e)){var event=events[e];MailInteraction[_0x6197('0x10')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x5104=['exports','events','MailInteraction','../../mysqldb','MailMessage','setMaxListeners','remove','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x5104,0x1bb));var _0x4510=function(_0xe7400f,_0x573b7d){_0xe7400f=_0xe7400f-0x0;var _0x2990f7=_0x5104[_0xe7400f];return _0x2990f7;};'use strict';var EventEmitter=require(_0x4510('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x4510('0x1')];var MailMessage=require(_0x4510('0x2'))['db'][_0x4510('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x4510('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4510('0x5')};function emitEvent(_0x3d6e06){return function(_0x572c75,_0x3e0d2c,_0x115aed){_0x572c75['getUsers']({'attributes':['id'],'raw':!![]})[_0x4510('0x6')](function(_0x27b5d8){_0x572c75[_0x4510('0x7')](_0x4510('0x8'),_0x27b5d8[_0x4510('0x9')](function(_0x2d5640){return{'id':_0x2d5640['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x572c75['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4510('0x6')](function(_0x290cb8){_0x572c75[_0x4510('0x7')](_0x4510('0xa'),_0x290cb8[_0x4510('0xb')]);MailInteractionEvents[_0x4510('0xc')](_0x3d6e06+':'+_0x572c75['id'],_0x572c75);MailInteractionEvents[_0x4510('0xc')](_0x3d6e06,_0x572c75);_0x115aed(null);})[_0x4510('0xd')](_0x115aed(null));};}for(var e in events){if(events[_0x4510('0xe')](e)){var event=events[e];MailInteraction[_0x4510('0xf')](e,emitEvent(event));}}module[_0x4510('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index c750489..823b7b1 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 _0x0c32=['util','api','moment','bluebird','request-promise','../../config/environment','./mailInteraction.attributes','define','MailInteraction','mail_interactions','fti_mail_interactions','FULLTEXT','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','substatus','substatusAt','changed','models','get','MailMessage','then','catch','utf8mb4','utf8mb4_unicode_ci'];(function(_0x302f4e,_0x399ac7){var _0x887dc5=function(_0x5f2e78){while(--_0x5f2e78){_0x302f4e['push'](_0x302f4e['shift']());}};_0x887dc5(++_0x399ac7);}(_0x0c32,0xd0));var _0x20c3=function(_0x5a1de6,_0x23c407){_0x5a1de6=_0x5a1de6-0x0;var _0x514b95=_0x0c32[_0x5a1de6];return _0x514b95;};'use strict';var _=require('lodash');var util=require(_0x20c3('0x0'));var logger=require('../../config/logger')(_0x20c3('0x1'));var moment=require(_0x20c3('0x2'));var BPromise=require(_0x20c3('0x3'));var rp=require(_0x20c3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x20c3('0x5'));var attributes=require(_0x20c3('0x6'));module['exports']=function(_0x1630fc,_0x1826a1){return _0x1630fc[_0x20c3('0x7')](_0x20c3('0x8'),attributes,{'tableName':_0x20c3('0x9'),'paranoid':![],'indexes':[{'name':_0x20c3('0xa'),'fields':['subject','to'],'type':_0x20c3('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x25f20c,_0x396697,_0x39a689){if(_0x25f20c['substatus']){_0x25f20c['substatusAt']=moment()[_0x20c3('0xc')](_0x20c3('0xd'));}if(_0x25f20c[_0x20c3('0xe')]){_0x25f20c[_0x20c3('0xf')]=moment()['format'](_0x20c3('0xd'));}_0x39a689(null,_0x396697);},'beforeUpdate':function(_0x43fac9,_0x18cc9d,_0x3ba16c){if(_0x43fac9['changed'](_0x20c3('0x10'))){_0x43fac9[_0x20c3('0x11')]=_0x43fac9[_0x20c3('0x10')]?moment()[_0x20c3('0xc')](_0x20c3('0xd')):null;}if(_0x43fac9[_0x20c3('0x12')](_0x20c3('0xe'))){_0x43fac9['closedAt']=moment()[_0x20c3('0xc')](_0x20c3('0xd'));_0x43fac9['substatus']=null;_0x43fac9[_0x20c3('0x11')]=null;}_0x3ba16c(null,_0x43fac9);},'afterUpdate':function(_0x5c7424,_0x3ec091,_0x506d86){var _0x486e62=_0x1630fc[_0x20c3('0x13')];var _0x228f13=_0x5c7424[_0x20c3('0x14')]({'plain':!![]});if(_0x228f13[_0x20c3('0xe')]){return _0x486e62[_0x20c3('0x15')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x228f13['id']}})[_0x20c3('0x16')](function(){_0x506d86();})[_0x20c3('0x17')](function(_0x41e7b7){_0x506d86(_0x41e7b7);});}else{_0x506d86();}}},'charset':_0x20c3('0x18'),'collate':_0x20c3('0x19')});}; \ No newline at end of file +var _0xf2ea=['path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','closed','YYYY-MM-DD\x20HH:mm:ss','changed','closedAt','models','get','MailMessage','update','then','utf8mb4','lodash','../../config/logger','request-promise'];(function(_0x30f30f,_0x1cce2e){var _0x5b65e1=function(_0x5c1c72){while(--_0x5c1c72){_0x30f30f['push'](_0x30f30f['shift']());}};_0x5b65e1(++_0x1cce2e);}(_0xf2ea,0xb3));var _0xaf2e=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xf2ea[_0x36884e];return _0x1cc367;};'use strict';var _=require(_0xaf2e('0x0'));var util=require('util');var logger=require(_0xaf2e('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xaf2e('0x2'));var fs=require('fs');var path=require(_0xaf2e('0x3'));var rimraf=require(_0xaf2e('0x4'));var config=require('../../config/environment');var attributes=require(_0xaf2e('0x5'));module[_0xaf2e('0x6')]=function(_0x2945cc,_0xf501e0){return _0x2945cc[_0xaf2e('0x7')](_0xaf2e('0x8'),attributes,{'tableName':_0xaf2e('0x9'),'paranoid':![],'indexes':[{'name':_0xaf2e('0xa'),'fields':[_0xaf2e('0xb'),'to'],'type':_0xaf2e('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5301c2,_0x85d7f9,_0xa971ab){if(_0x5301c2[_0xaf2e('0xd')]){_0x5301c2[_0xaf2e('0xe')]=moment()[_0xaf2e('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x5301c2[_0xaf2e('0x10')]){_0x5301c2['closedAt']=moment()[_0xaf2e('0xf')](_0xaf2e('0x11'));}_0xa971ab(null,_0x85d7f9);},'beforeUpdate':function(_0x49d422,_0x262c30,_0x33f6e2){if(_0x49d422[_0xaf2e('0x12')](_0xaf2e('0xd'))){_0x49d422['substatusAt']=_0x49d422[_0xaf2e('0xd')]?moment()[_0xaf2e('0xf')](_0xaf2e('0x11')):null;}if(_0x49d422['changed'](_0xaf2e('0x10'))){_0x49d422[_0xaf2e('0x13')]=moment()[_0xaf2e('0xf')](_0xaf2e('0x11'));_0x49d422[_0xaf2e('0xd')]=null;_0x49d422[_0xaf2e('0xe')]=null;}_0x33f6e2(null,_0x49d422);},'afterUpdate':function(_0x55c189,_0x5000ef,_0x570384){var _0x398887=_0x2945cc[_0xaf2e('0x14')];var _0x2676b3=_0x55c189[_0xaf2e('0x15')]({'plain':!![]});if(_0x2676b3['closed']){return _0x398887[_0xaf2e('0x16')][_0xaf2e('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x2676b3['id']}})[_0xaf2e('0x18')](function(){_0x570384();})['catch'](function(_0x46a79a){_0x570384(_0x46a79a);});}else{_0x570384();}}},'charset':_0xaf2e('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index bbfec61..683e0e6 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 _0xd064=['options','raw','where','limit','info','UpdateMailInteraction','AddTagsToMailInteraction','addTags','omit','ids','spread','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailInteraction','update','body'];(function(_0x1d714a,_0xc80c5e){var _0x802682=function(_0x42956a){while(--_0x42956a){_0x1d714a['push'](_0x1d714a['shift']());}};_0x802682(++_0xc80c5e);}(_0xd064,0xe8));var _0x4d06=function(_0xe84805,_0x2702d9){_0xe84805=_0xe84805-0x0;var _0x398efd=_0xd064[_0xe84805];return _0x398efd;};'use strict';var _=require(_0x4d06('0x0'));var util=require(_0x4d06('0x1'));var moment=require('moment');var BPromise=require(_0x4d06('0x2'));var rs=require(_0x4d06('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d06('0x4'))['db'];var utils=require(_0x4d06('0x5'));var logger=require(_0x4d06('0x6'))(_0x4d06('0x7'));var config=require(_0x4d06('0x8'));var jayson=require(_0x4d06('0x9'));var client=jayson[_0x4d06('0xa')][_0x4d06('0xb')]({'port':0x232a});config[_0x4d06('0xc')]=_['defaults'](config[_0x4d06('0xc')],{'host':_0x4d06('0xd'),'port':0x18eb});var socket=require(_0x4d06('0xe'))(new Redis(config[_0x4d06('0xc')]));require(_0x4d06('0xf'))[_0x4d06('0x10')](socket);function respondWithRpcPromise(_0xbfc5d3,_0x987806,_0x380be5){return new BPromise(function(_0x54a5e5,_0x3e9392){return client[_0x4d06('0x11')](_0xbfc5d3,_0x380be5)[_0x4d06('0x12')](function(_0x9c44b7){logger['info'](_0x4d06('0x13'),_0x987806,_0x4d06('0x14'));logger[_0x4d06('0x15')](_0x4d06('0x16'),_0x987806,_0x4d06('0x14'),JSON[_0x4d06('0x17')](_0x9c44b7));if(_0x9c44b7[_0x4d06('0x18')]){if(_0x9c44b7[_0x4d06('0x18')][_0x4d06('0x19')]===0x1f4){logger[_0x4d06('0x18')](_0x4d06('0x13'),_0x987806,_0x9c44b7['error'][_0x4d06('0x1a')]);return _0x3e9392(_0x9c44b7[_0x4d06('0x18')]['message']);}logger[_0x4d06('0x18')]('MailInteraction,\x20%s,\x20%s',_0x987806,_0x9c44b7[_0x4d06('0x18')][_0x4d06('0x1a')]);return _0x54a5e5(_0x9c44b7['error'][_0x4d06('0x1a')]);}else{logger['info'](_0x4d06('0x13'),_0x987806,_0x4d06('0x14'));_0x54a5e5(_0x9c44b7[_0x4d06('0x1b')][_0x4d06('0x1a')]);}})[_0x4d06('0x1c')](function(_0x4069be){logger['error'](_0x4d06('0x13'),_0x987806,_0x4069be);_0x3e9392(_0x4069be);});});}exports['UpdateMailInteraction']=function(_0x1dc45e){var _0x117af6=this;return new Promise(function(_0x1e71c8,_0x33dee9){return db[_0x4d06('0x1d')][_0x4d06('0x1e')](_0x1dc45e[_0x4d06('0x1f')],{'raw':_0x1dc45e[_0x4d06('0x20')]?_0x1dc45e[_0x4d06('0x20')][_0x4d06('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1dc45e['options']?_0x1dc45e[_0x4d06('0x20')][_0x4d06('0x22')]||null:null,'attributes':_0x1dc45e[_0x4d06('0x20')]?_0x1dc45e[_0x4d06('0x20')]['attributes']||null:null,'limit':_0x1dc45e['options']?_0x1dc45e[_0x4d06('0x20')][_0x4d06('0x23')]||null:null})[_0x4d06('0x12')](function(_0x353839){logger[_0x4d06('0x24')]('UpdateMailInteraction',_0x1dc45e);logger[_0x4d06('0x15')](_0x4d06('0x25'),_0x1dc45e,JSON[_0x4d06('0x17')](_0x353839));_0x1e71c8(_0x353839);})[_0x4d06('0x1c')](function(_0x5ec688){logger[_0x4d06('0x18')]('UpdateMailInteraction',_0x5ec688[_0x4d06('0x1a')],_0x1dc45e);_0x33dee9(_0x117af6['error'](0x1f4,_0x5ec688[_0x4d06('0x1a')]));});});};exports[_0x4d06('0x26')]=function(_0x399e87){return new Promise(function(_0x5c7dca,_0x3d892f){return db['MailInteraction']['find']({'where':_0x399e87[_0x4d06('0x20')]?_0x399e87['options']['where']||null:null})[_0x4d06('0x12')](function(_0x53a8fa){if(_0x53a8fa){return _0x53a8fa[_0x4d06('0x27')](_0x399e87['body']['ids'],_[_0x4d06('0x28')](_0x399e87['body'],[_0x4d06('0x29'),'id'])||{});}})[_0x4d06('0x2a')](function(_0x2ea2bd){logger['info'](_0x4d06('0x2b'),_0x399e87);logger[_0x4d06('0x15')](_0x4d06('0x2b'),_0x399e87,JSON[_0x4d06('0x17')](_0x2ea2bd));_0x5c7dca(_0x2ea2bd);})[_0x4d06('0x1c')](function(_0x4bfd35){logger[_0x4d06('0x18')](_0x4d06('0x2b'),_0x4bfd35['message'],_0x399e87);_0x3d892f(_this[_0x4d06('0x18')](0x1f4,_0x4bfd35[_0x4d06('0x1a')]));});});}; \ No newline at end of file +var _0x02a7=['ids','AddTags','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','code','message','error','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','where','attributes','limit','AddTagsToMailInteraction','find','addTags'];(function(_0x553ac9,_0x45b83e){var _0x5235f3=function(_0xb0b6d4){while(--_0xb0b6d4){_0x553ac9['push'](_0x553ac9['shift']());}};_0x5235f3(++_0x45b83e);}(_0x02a7,0x7a));var _0x702a=function(_0x473f6e,_0x18879e){_0x473f6e=_0x473f6e-0x0;var _0x1b00af=_0x02a7[_0x473f6e];return _0x1b00af;};'use strict';var _=require('lodash');var util=require(_0x702a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x702a('0x1'));var fs=require('fs');var Redis=require(_0x702a('0x2'));var db=require(_0x702a('0x3'))['db'];var utils=require(_0x702a('0x4'));var logger=require(_0x702a('0x5'))(_0x702a('0x6'));var config=require(_0x702a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x702a('0x8')]['http']({'port':0x232a});config[_0x702a('0x9')]=_[_0x702a('0xa')](config[_0x702a('0x9')],{'host':_0x702a('0xb'),'port':0x18eb});var socket=require(_0x702a('0xc'))(new Redis(config[_0x702a('0x9')]));require(_0x702a('0xd'))['register'](socket);function respondWithRpcPromise(_0x15acfb,_0x5293c6,_0x5c83a4){return new BPromise(function(_0x302c23,_0x3b81cb){return client[_0x702a('0xe')](_0x15acfb,_0x5c83a4)[_0x702a('0xf')](function(_0x534ae1){logger[_0x702a('0x10')](_0x702a('0x11'),_0x5293c6,_0x702a('0x12'));logger[_0x702a('0x13')](_0x702a('0x14'),_0x5293c6,_0x702a('0x12'),JSON[_0x702a('0x15')](_0x534ae1));if(_0x534ae1['error']){if(_0x534ae1['error'][_0x702a('0x16')]===0x1f4){logger['error']('MailInteraction,\x20%s,\x20%s',_0x5293c6,_0x534ae1['error']['message']);return _0x3b81cb(_0x534ae1['error'][_0x702a('0x17')]);}logger[_0x702a('0x18')](_0x702a('0x11'),_0x5293c6,_0x534ae1['error']['message']);return _0x302c23(_0x534ae1['error'][_0x702a('0x17')]);}else{logger[_0x702a('0x10')](_0x702a('0x11'),_0x5293c6,'request\x20sent');_0x302c23(_0x534ae1[_0x702a('0x19')]['message']);}})[_0x702a('0x1a')](function(_0x2c3b0d){logger['error']('MailInteraction,\x20%s,\x20%s',_0x5293c6,_0x2c3b0d);_0x3b81cb(_0x2c3b0d);});});}exports[_0x702a('0x1b')]=function(_0x18b8a0){var _0x1845a2=this;return new Promise(function(_0x2765d0,_0x332254){return db[_0x702a('0x1c')][_0x702a('0x1d')](_0x18b8a0[_0x702a('0x1e')],{'raw':_0x18b8a0[_0x702a('0x1f')]?_0x18b8a0[_0x702a('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18b8a0[_0x702a('0x1f')]?_0x18b8a0[_0x702a('0x1f')][_0x702a('0x20')]||null:null,'attributes':_0x18b8a0[_0x702a('0x1f')]?_0x18b8a0[_0x702a('0x1f')][_0x702a('0x21')]||null:null,'limit':_0x18b8a0[_0x702a('0x1f')]?_0x18b8a0[_0x702a('0x1f')][_0x702a('0x22')]||null:null})['then'](function(_0xc5329a){logger[_0x702a('0x10')]('UpdateMailInteraction',_0x18b8a0);logger[_0x702a('0x13')](_0x702a('0x1b'),_0x18b8a0,JSON[_0x702a('0x15')](_0xc5329a));_0x2765d0(_0xc5329a);})[_0x702a('0x1a')](function(_0x3d4ed0){logger[_0x702a('0x18')]('UpdateMailInteraction',_0x3d4ed0[_0x702a('0x17')],_0x18b8a0);_0x332254(_0x1845a2[_0x702a('0x18')](0x1f4,_0x3d4ed0['message']));});});};exports[_0x702a('0x23')]=function(_0x854763){return new Promise(function(_0xaa1f3d,_0x21ba99){return db[_0x702a('0x1c')][_0x702a('0x24')]({'where':_0x854763[_0x702a('0x1f')]?_0x854763['options'][_0x702a('0x20')]||null:null})[_0x702a('0xf')](function(_0x6ac060){if(_0x6ac060){return _0x6ac060[_0x702a('0x25')](_0x854763[_0x702a('0x1e')][_0x702a('0x26')],_['omit'](_0x854763[_0x702a('0x1e')],[_0x702a('0x26'),'id'])||{});}})['spread'](function(_0x584e57){logger[_0x702a('0x10')](_0x702a('0x27'),_0x854763);logger['debug'](_0x702a('0x27'),_0x854763,JSON['stringify'](_0x584e57));_0xaa1f3d(_0x584e57);})['catch'](function(_0x3bcf4c){logger[_0x702a('0x18')](_0x702a('0x27'),_0x3bcf4c['message'],_0x854763);_0x21ba99(_this[_0x702a('0x18')](0x1f4,_0x3bcf4c[_0x702a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index fdae94d..ce00dd0 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 _0x7ab4=['update','emit','removeListener','register','mailInteraction:'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7ab4,0x140));var _0x47ab=function(_0x35a9fd,_0x540c82){_0x35a9fd=_0x35a9fd-0x0;var _0x26242e=_0x7ab4[_0x35a9fd];return _0x26242e;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save','remove',_0x47ab('0x0')];function createListener(_0x21b8ac,_0x56780b){return function(_0x3a563d){_0x56780b[_0x47ab('0x1')](_0x21b8ac,_0x3a563d);};}function removeListener(_0x25c8cf,_0x35da5f){return function(){MailInteractionEvents[_0x47ab('0x2')](_0x25c8cf,_0x35da5f);};}exports[_0x47ab('0x3')]=function(_0x253a9a){for(var _0x2981c1=0x0,_0x2926dd=events['length'];_0x2981c1<_0x2926dd;_0x2981c1++){var _0x2aa52e=events[_0x2981c1];var _0x509d53=createListener(_0x47ab('0x4')+_0x2aa52e,_0x253a9a);MailInteractionEvents['on'](_0x2aa52e,_0x509d53);}}; \ No newline at end of file +var _0x02c6=['length','mailInteraction:','./mailInteraction.events','save','remove','update','emit','removeListener'];(function(_0x508986,_0x43d040){var _0x25d13a=function(_0x514412){while(--_0x514412){_0x508986['push'](_0x508986['shift']());}};_0x25d13a(++_0x43d040);}(_0x02c6,0x162));var _0x602c=function(_0x2d8ca8,_0x22bcb6){_0x2d8ca8=_0x2d8ca8-0x0;var _0x268164=_0x02c6[_0x2d8ca8];return _0x268164;};'use strict';var MailInteractionEvents=require(_0x602c('0x0'));var events=[_0x602c('0x1'),_0x602c('0x2'),_0x602c('0x3')];function createListener(_0x563bf4,_0x267e84){return function(_0x3b2ac3){_0x267e84[_0x602c('0x4')](_0x563bf4,_0x3b2ac3);};}function removeListener(_0x58550c,_0x5744e5){return function(){MailInteractionEvents[_0x602c('0x5')](_0x58550c,_0x5744e5);};}exports['register']=function(_0x4fb20b){for(var _0xa67f26=0x0,_0x4775ac=events[_0x602c('0x6')];_0xa67f26<_0x4775ac;_0xa67f26++){var _0xf671bd=events[_0xa67f26];var _0x4928ec=createListener(_0x602c('0x7')+_0xf671bd,_0x4fb20b);MailInteractionEvents['on'](_0xf671bd,_0x4928ec);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index a02aae1..b043057 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 _0x3715=['/:id','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','index','isAuthenticated','describe','/:id/download','download','tracked','mail','create','put'];(function(_0x29d4b5,_0x1913e2){var _0x3fbb01=function(_0x8b0a41){while(--_0x8b0a41){_0x29d4b5['push'](_0x29d4b5['shift']());}};_0x3fbb01(++_0x1913e2);}(_0x3715,0xc3));var _0x5371=function(_0x50acf3,_0xe2c988){_0x50acf3=_0x50acf3-0x0;var _0x20248f=_0x3715[_0x50acf3];return _0x20248f;};'use strict';var multer=require(_0x5371('0x0'));var util=require(_0x5371('0x1'));var path=require(_0x5371('0x2'));var timeout=require(_0x5371('0x3'));var express=require(_0x5371('0x4'));var router=express[_0x5371('0x5')]();var fs_extra=require(_0x5371('0x6'));var auth=require(_0x5371('0x7'));var interaction=require(_0x5371('0x8'));var config=require(_0x5371('0x9'));var controller=require(_0x5371('0xa'));router[_0x5371('0xb')]('/',auth['isAuthenticated'](),controller[_0x5371('0xc')]);router[_0x5371('0xb')]('/describe',auth[_0x5371('0xd')](),controller[_0x5371('0xe')]);router[_0x5371('0xb')]('/:id',auth[_0x5371('0xd')](),controller['show']);router['get'](_0x5371('0xf'),auth[_0x5371('0xd')](),controller[_0x5371('0x10')]);router['post']('/',auth[_0x5371('0xd')](),interaction[_0x5371('0x11')](_0x5371('0x12'),'mailmessage:create'),controller[_0x5371('0x13')]);router[_0x5371('0x14')](_0x5371('0x15'),auth[_0x5371('0xd')](),controller['update']);router[_0x5371('0x14')]('/:id/accept',auth[_0x5371('0xd')](),controller[_0x5371('0x16')]);router['put'](_0x5371('0x17'),auth[_0x5371('0xd')](),controller[_0x5371('0x18')]);router[_0x5371('0x19')](_0x5371('0x15'),auth[_0x5371('0xd')](),controller[_0x5371('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x09dd=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','isAuthenticated','get','/:id','show','post','tracked','mail','mailmessage:create','create','put','update','/:id/accept','/:id/reject','reject','delete'];(function(_0x5e7648,_0x2aa20d){var _0x28431b=function(_0x687a63){while(--_0x687a63){_0x5e7648['push'](_0x5e7648['shift']());}};_0x28431b(++_0x2aa20d);}(_0x09dd,0xb7));var _0xd09d=function(_0x55969b,_0x1ebe62){_0x55969b=_0x55969b-0x0;var _0x3d7fc1=_0x09dd[_0x55969b];return _0x3d7fc1;};'use strict';var multer=require(_0xd09d('0x0'));var util=require(_0xd09d('0x1'));var path=require(_0xd09d('0x2'));var timeout=require(_0xd09d('0x3'));var express=require(_0xd09d('0x4'));var router=express[_0xd09d('0x5')]();var fs_extra=require(_0xd09d('0x6'));var auth=require(_0xd09d('0x7'));var interaction=require(_0xd09d('0x8'));var config=require('../../config/environment');var controller=require(_0xd09d('0x9'));router['get']('/',auth[_0xd09d('0xa')](),controller['index']);router[_0xd09d('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xd09d('0xc'),auth['isAuthenticated'](),controller[_0xd09d('0xd')]);router[_0xd09d('0xb')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xd09d('0xe')]('/',auth[_0xd09d('0xa')](),interaction[_0xd09d('0xf')](_0xd09d('0x10'),_0xd09d('0x11')),controller[_0xd09d('0x12')]);router[_0xd09d('0x13')]('/:id',auth[_0xd09d('0xa')](),controller[_0xd09d('0x14')]);router[_0xd09d('0x13')](_0xd09d('0x15'),auth[_0xd09d('0xa')](),controller['accept']);router[_0xd09d('0x13')](_0xd09d('0x16'),auth[_0xd09d('0xa')](),controller[_0xd09d('0x17')]);router[_0xd09d('0x18')]('/:id',auth[_0xd09d('0xa')](),controller[_0xd09d('0x19')]);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 40a027d..6f21e7e 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 _0xb9b4=['lodash','exports','TEXT','medium','BOOLEAN','ENUM','STRING','long','DATE','Email','Chat','sequelize'];(function(_0x907137,_0x48f077){var _0xd242b7=function(_0xd38959){while(--_0xd38959){_0x907137['push'](_0x907137['shift']());}};_0xd242b7(++_0x48f077);}(_0xb9b4,0x137));var _0x4b9b=function(_0x25360e,_0x434a92){_0x25360e=_0x25360e-0x0;var _0x247642=_0xb9b4[_0x25360e];return _0x247642;};'use strict';var Sequelize=require(_0x4b9b('0x0'));var _=require(_0x4b9b('0x1'));module[_0x4b9b('0x2')]={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x4b9b('0x3')](_0x4b9b('0x4'))},'read':{'type':Sequelize[_0x4b9b('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4b9b('0x6')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x4b9b('0x7')](0x1fe)},'from':{'type':Sequelize[_0x4b9b('0x7')]},'to':{'type':Sequelize[_0x4b9b('0x3')]('long')},'cc':{'type':Sequelize['TEXT'](_0x4b9b('0x8'))},'bcc':{'type':Sequelize[_0x4b9b('0x3')](_0x4b9b('0x8'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x4b9b('0x9')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x4b9b('0x3')](_0x4b9b('0x8'))},'originCc':{'type':Sequelize['TEXT']('long')},'originChannel':{'type':Sequelize[_0x4b9b('0x6')](_0x4b9b('0xa'),_0x4b9b('0xb')),'defaultValue':_0x4b9b('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0x0ca4=['TEXT','long','medium','ENUM','out','STRING','DATE','INTEGER','BOOLEAN','Email','Chat','sequelize','exports'];(function(_0x782bc0,_0x2247f8){var _0x500efc=function(_0x2cd038){while(--_0x2cd038){_0x782bc0['push'](_0x782bc0['shift']());}};_0x500efc(++_0x2247f8);}(_0x0ca4,0xa7));var _0x40ca=function(_0x53518a,_0x1c2c14){_0x53518a=_0x53518a-0x0;var _0x4930aa=_0x0ca4[_0x53518a];return _0x4930aa;};'use strict';var Sequelize=require(_0x40ca('0x0'));var _=require('lodash');module[_0x40ca('0x1')]={'body':{'type':Sequelize[_0x40ca('0x2')](_0x40ca('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x40ca('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x40ca('0x5')]('in',_0x40ca('0x6')),'defaultValue':_0x40ca('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x40ca('0x7')](0x1fe)},'from':{'type':Sequelize[_0x40ca('0x7')]},'to':{'type':Sequelize[_0x40ca('0x2')](_0x40ca('0x3'))},'cc':{'type':Sequelize[_0x40ca('0x2')]('long')},'bcc':{'type':Sequelize[_0x40ca('0x2')](_0x40ca('0x3'))},'subject':{'type':Sequelize[_0x40ca('0x2')]},'sentAt':{'type':Sequelize[_0x40ca('0x8')]},'attach':{'type':Sequelize[_0x40ca('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x40ca('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x40ca('0x8')]},'originTo':{'type':Sequelize[_0x40ca('0x2')](_0x40ca('0x3'))},'originCc':{'type':Sequelize[_0x40ca('0x2')](_0x40ca('0x3'))},'originChannel':{'type':Sequelize[_0x40ca('0x5')](_0x40ca('0xb'),_0x40ca('0xc')),'defaultValue':_0x40ca('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 a8cb5be..2e2575a 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 _0x9391=['getSmtpOptions','attachments','join','root','server/files/attachments','Contacts','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','accept','mail','read','readAt','UserId','user','get','MailInteraction','MailInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','User','agent','fullname','internal','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','sequelize','SELECT','email','event','fromString','download','unix','toString','files','tmp','server','bcc','subject','createdAt','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','util','path','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','localhost','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','undefined','limit','count','offset','set','Content-Range','update','then','end','sendStatus','stack','name','MailMessage','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','show','params','rawAttributes','include','find','body','destroy','describe','create','direction','secret','split','MailAccount','findOne','CmList','List','CmContact','updatedAt','DESC','MailServerOut','CloudProvider','Smtp'];(function(_0x108273,_0x3ff045){var _0x4d201a=function(_0x54f9de){while(--_0x54f9de){_0x108273['push'](_0x108273['shift']());}};_0x4d201a(++_0x3ff045);}(_0x9391,0x18d));var _0x1939=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9391[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x1939('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x1939('0x1'));var path=require(_0x1939('0x2'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x1939('0x3'));var htmlToText=require(_0x1939('0x4'));var qs=require(_0x1939('0x5'));var logger=require(_0x1939('0x6'))(_0x1939('0x7'));var interaction_log=require(_0x1939('0x6'))(_0x1939('0x8'));var config=require(_0x1939('0x9'));var db=require(_0x1939('0xa'))['db'];config[_0x1939('0xb')]=_['defaults'](config[_0x1939('0xb')],{'host':_0x1939('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1939('0xb')]));var htmlEntities=require(_0x1939('0xd'));require(_0x1939('0xe'))[_0x1939('0xf')](socket);var jayson=require(_0x1939('0x10'));var client=jayson[_0x1939('0x11')]['http']({'port':0x232c});var client9003=jayson['client'][_0x1939('0x12')]({'port':0x232b});var client9002=jayson[_0x1939('0x11')][_0x1939('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x100b94,_0xeaba66,_0x16f798,_0x2a57e5){return new BPromise(function(_0x4d9851,_0x18986a){var _0x5e961e=_0x2a57e5||client;return _0x5e961e[_0x1939('0x13')](_0x100b94,_0x16f798)['then'](function(_0x1c788d){logger[_0x1939('0x14')](_0x1939('0x15'),_0xeaba66,_0x1939('0x16'));logger[_0x1939('0x17')](_0x1939('0x18'),_0xeaba66,_0x1939('0x16'),JSON[_0x1939('0x19')](_0x1c788d));if(_0x1c788d['error']){if(_0x1c788d[_0x1939('0x1a')]['code']===0x1f4){logger['error'](_0x1939('0x15'),_0xeaba66,_0x1c788d[_0x1939('0x1a')][_0x1939('0x1b')]);return _0x18986a(_0x1c788d['error'][_0x1939('0x1b')]);}logger[_0x1939('0x1a')]('MailMessage,\x20%s,\x20%s',_0xeaba66,_0x1c788d[_0x1939('0x1a')][_0x1939('0x1b')]);return _0x4d9851(_0x1c788d['error'][_0x1939('0x1b')]);}else{logger[_0x1939('0x14')](_0x1939('0x15'),_0xeaba66,'request\x20sent');_0x4d9851(_0x1c788d[_0x1939('0x1c')][_0x1939('0x1b')]);}})[_0x1939('0x1d')](function(_0x48f34e){logger['error']('MailMessage,\x20%s,\x20%s',_0xeaba66,_0x48f34e);_0x18986a(_0x48f34e);});});}function respondWithResult(_0x20fdb6,_0xa83132){_0xa83132=_0xa83132||0xc8;return function(_0x3188b5){if(_0x3188b5){return _0x20fdb6[_0x1939('0x1e')](_0xa83132)[_0x1939('0x1f')](_0x3188b5);}};}function respondWithFilteredResult(_0x4670e3,_0x249f6d){return function(_0x1167a9){if(_0x1167a9){var _0x9329a2=typeof _0x249f6d['offset']===_0x1939('0x20')&&typeof _0x249f6d[_0x1939('0x21')]===_0x1939('0x20');var _0x20762e=_0x1167a9[_0x1939('0x22')];var _0x592725=_0x9329a2?0x0:_0x249f6d['offset'];var _0x3c993b=_0x9329a2?_0x1167a9['count']:_0x249f6d[_0x1939('0x23')]+_0x249f6d['limit'];var _0x10fef4;if(_0x3c993b>=_0x20762e){_0x3c993b=_0x20762e;_0x10fef4=0xc8;}else{_0x10fef4=0xce;}_0x4670e3[_0x1939('0x1e')](_0x10fef4);return _0x4670e3[_0x1939('0x24')](_0x1939('0x25'),_0x592725+'-'+_0x3c993b+'/'+_0x20762e)['json'](_0x1167a9);}return null;};}function saveUpdates(_0x6db6c6){return function(_0xbc8b55){if(_0xbc8b55){return _0xbc8b55[_0x1939('0x26')](_0x6db6c6)['then'](function(_0x4dcb62){return _0x4dcb62;});}return null;};}function removeEntity(_0x2af370){return function(_0x4cb53d){if(_0x4cb53d){return _0x4cb53d['destroy']()[_0x1939('0x27')](function(){_0x2af370['status'](0xcc)[_0x1939('0x28')]();});}};}function handleEntityNotFound(_0x35b965){return function(_0x45dd62){if(!_0x45dd62){_0x35b965[_0x1939('0x29')](0x194);}return _0x45dd62;};}function handleError(_0x5c0843,_0x3d6d66){_0x3d6d66=_0x3d6d66||0x1f4;return function(_0x2ca488){logger[_0x1939('0x1a')](_0x2ca488[_0x1939('0x2a')]);if(_0x2ca488[_0x1939('0x2b')]){delete _0x2ca488[_0x1939('0x2b')];}_0x5c0843[_0x1939('0x1e')](_0x3d6d66)['send'](_0x2ca488);};}exports['index']=function(_0x2b5a3b,_0xf1cb13){var _0x27ad81={},_0xbd3b59={},_0xe710f4={'count':0x0,'rows':[]};var _0x33e769=_['map'](db[_0x1939('0x2c')]['rawAttributes'],function(_0x5b34a3){return{'name':_0x5b34a3[_0x1939('0x2d')],'type':_0x5b34a3[_0x1939('0x2e')]['key']};});_0xbd3b59[_0x1939('0x2f')]=_[_0x1939('0x30')](_0x33e769,_0x1939('0x2b'));_0xbd3b59[_0x1939('0x31')]=_[_0x1939('0x32')](_0x2b5a3b['query']);_0xbd3b59[_0x1939('0x33')]=_['intersection'](_0xbd3b59[_0x1939('0x2f')],_0xbd3b59[_0x1939('0x31')]);_0x27ad81[_0x1939('0x34')]=_[_0x1939('0x35')](_0xbd3b59[_0x1939('0x2f')],qs[_0x1939('0x36')](_0x2b5a3b[_0x1939('0x31')][_0x1939('0x36')]));_0x27ad81[_0x1939('0x34')]=_0x27ad81[_0x1939('0x34')][_0x1939('0x37')]?_0x27ad81[_0x1939('0x34')]:_0xbd3b59['model'];if(!_0x2b5a3b[_0x1939('0x31')][_0x1939('0x38')](_0x1939('0x39'))){_0x27ad81['limit']=qs[_0x1939('0x21')](_0x2b5a3b[_0x1939('0x31')][_0x1939('0x21')]);_0x27ad81[_0x1939('0x23')]=qs['offset'](_0x2b5a3b[_0x1939('0x31')][_0x1939('0x23')]);}_0x27ad81['order']=qs[_0x1939('0x3a')](_0x2b5a3b[_0x1939('0x31')][_0x1939('0x3a')]);_0x27ad81['where']=qs[_0x1939('0x33')](_[_0x1939('0x3b')](_0x2b5a3b[_0x1939('0x31')],_0xbd3b59[_0x1939('0x33')]),_0x33e769);if(_0x2b5a3b[_0x1939('0x31')][_0x1939('0x3c')]){_0x27ad81[_0x1939('0x3d')]=_[_0x1939('0x3e')](_0x27ad81[_0x1939('0x3d')],{'$or':_[_0x1939('0x30')](_0x33e769,function(_0x4aae77){if(_0x4aae77[_0x1939('0x2e')]!==_0x1939('0x3f')){var _0x11e171={};_0x11e171[_0x4aae77['name']]={'$like':'%'+_0x2b5a3b['query'][_0x1939('0x3c')]+'%'};return _0x11e171;}})});}_0x27ad81=_[_0x1939('0x3e')]({},_0x27ad81,_0x2b5a3b[_0x1939('0x40')]);var _0x4fbff6={'where':_0x27ad81[_0x1939('0x3d')]};return db[_0x1939('0x2c')][_0x1939('0x22')](_0x4fbff6)[_0x1939('0x27')](function(_0x3d5316){_0xe710f4['count']=_0x3d5316;if(_0x2b5a3b[_0x1939('0x31')]['includeAll']){_0x27ad81['include']=[{'all':!![]}];}return db[_0x1939('0x2c')][_0x1939('0x41')](_0x27ad81);})[_0x1939('0x27')](function(_0x459281){_0xe710f4[_0x1939('0x42')]=_0x459281;return _0xe710f4;})[_0x1939('0x27')](respondWithFilteredResult(_0xf1cb13,_0x27ad81))[_0x1939('0x1d')](handleError(_0xf1cb13,null));};exports[_0x1939('0x43')]=function(_0xec77f8,_0x4de783){var _0x4138eb={'raw':!![],'where':{'id':_0xec77f8[_0x1939('0x44')]['id']}},_0x3c2a9b={};_0x3c2a9b[_0x1939('0x2f')]=_['keys'](db['MailMessage'][_0x1939('0x45')]);_0x3c2a9b[_0x1939('0x31')]=_['keys'](_0xec77f8['query']);_0x3c2a9b[_0x1939('0x33')]=_[_0x1939('0x35')](_0x3c2a9b[_0x1939('0x2f')],_0x3c2a9b[_0x1939('0x31')]);_0x4138eb[_0x1939('0x34')]=_[_0x1939('0x35')](_0x3c2a9b['model'],qs[_0x1939('0x36')](_0xec77f8['query'][_0x1939('0x36')]));_0x4138eb[_0x1939('0x34')]=_0x4138eb['attributes'][_0x1939('0x37')]?_0x4138eb[_0x1939('0x34')]:_0x3c2a9b[_0x1939('0x2f')];if(_0xec77f8[_0x1939('0x31')]['includeAll']){_0x4138eb[_0x1939('0x46')]=[{'all':!![]}];}_0x4138eb=_[_0x1939('0x3e')]({},_0x4138eb,_0xec77f8[_0x1939('0x40')]);return db['MailMessage'][_0x1939('0x47')](_0x4138eb)[_0x1939('0x27')](handleEntityNotFound(_0x4de783,null))['then'](respondWithResult(_0x4de783,null))[_0x1939('0x1d')](handleError(_0x4de783,null));};exports['update']=function(_0xce74c5,_0x3944de){if(_0xce74c5[_0x1939('0x48')]['id']){delete _0xce74c5['body']['id'];}return db[_0x1939('0x2c')][_0x1939('0x47')]({'where':{'id':_0xce74c5[_0x1939('0x44')]['id']}})[_0x1939('0x27')](handleEntityNotFound(_0x3944de,null))[_0x1939('0x27')](saveUpdates(_0xce74c5[_0x1939('0x48')],null))['then'](respondWithResult(_0x3944de,null))[_0x1939('0x1d')](handleError(_0x3944de,null));};exports[_0x1939('0x49')]=function(_0xe56522,_0x21964e){return db[_0x1939('0x2c')][_0x1939('0x47')]({'where':{'id':_0xe56522['params']['id']}})[_0x1939('0x27')](handleEntityNotFound(_0x21964e,null))['then'](removeEntity(_0x21964e,null))[_0x1939('0x1d')](handleError(_0x21964e,null));};exports['describe']=function(_0x5d7a31,_0x128a78){return db[_0x1939('0x2c')][_0x1939('0x4a')]()[_0x1939('0x27')](respondWithResult(_0x128a78,null))[_0x1939('0x1d')](handleError(_0x128a78,null));};exports[_0x1939('0x4b')]=function(_0x1bd262,_0x52f459){return db['MailMessage'][_0x1939('0x4b')](_0x1bd262[_0x1939('0x48')])['then'](function(_0xa38711){if(_0xa38711){if(_0xa38711[_0x1939('0x4c')]==='out'&&!_0xa38711[_0x1939('0x4d')]){var _0x346bb6,_0x40d357,_0x36449a;if(_0x1bd262[_0x1939('0x48')]['to']){_0x40d357=_0x1bd262[_0x1939('0x48')]['to'][_0x1939('0x4e')](',')[0x0];}return db[_0x1939('0x4f')][_0x1939('0x50')]({'where':{'id':_0xa38711['MailAccountId']},'include':[{'model':db[_0x1939('0x51')],'as':_0x1939('0x52'),'include':[{'model':db[_0x1939('0x53')],'as':'Contacts','where':{'email':_0x40d357},'limit':0x1,'order':[[_0x1939('0x54'),_0x1939('0x55')]]}]},{'model':db[_0x1939('0x56')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x1939('0x57')],'as':_0x1939('0x57'),'raw':!![]}]}]})[_0x1939('0x27')](function(_0x4fa654){_0x346bb6=_0x4fa654;if(!_0x346bb6||!_0x346bb6[_0x1939('0x58')])return;var _0x4b735a=_0x346bb6[_0x1939('0x59')]();if(_0x1bd262[_0x1939('0x48')][_0x1939('0x5a')]&&_0x1bd262[_0x1939('0x48')]['attachments'][_0x1939('0x37')]){for(var _0x1c433d=0x0;_0x1c433d<_0x1bd262[_0x1939('0x48')][_0x1939('0x5a')][_0x1939('0x37')];_0x1c433d+=0x1){_0x1bd262[_0x1939('0x48')]['attachments'][_0x1c433d]={'filename':_0x1bd262[_0x1939('0x48')][_0x1939('0x5a')][_0x1c433d][_0x1939('0x2b')],'path':path[_0x1939('0x5b')](config[_0x1939('0x5c')],_0x1939('0x5d'),_0x1bd262[_0x1939('0x48')]['attachments'][_0x1c433d]['basename'])};}}_0x36449a={'account':_0x4b735a,'message':_0x1bd262[_0x1939('0x48')]};return;})['then'](function(){if(_0x346bb6[_0x1939('0x52')]){if(_0x346bb6['List'][_0x1939('0x5e')][_0x1939('0x37')]){return _0x346bb6['List'][_0x1939('0x5e')][0x0];}else{return db[_0x1939('0x53')][_0x1939('0x4b')](_['defaults'](_0x1bd262[_0x1939('0x48')],{'firstName':_0x1bd262[_0x1939('0x48')]['to'],'email':_0x1bd262[_0x1939('0x48')]['to'],'phone':_0x1bd262[_0x1939('0x48')]['to'],'ListId':_0x346bb6[_0x1939('0x5f')]}));}}else{throw new Error(_0x1939('0x60'));}})[_0x1939('0x27')](function(){if(_0x36449a){return respondWithRpcPromise(_0x1939('0x61'),_0x1939('0x62'),_0x36449a,client9003)['then'](function(_0x2bd89b){return _0xa38711[_0x1939('0x26')]({'read':!![],'messageId':_0x2bd89b[_0x1939('0x63')],'sentAt':moment()[_0x1939('0x64')]('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x1b965f){logger['error']('%s',JSON[_0x1939('0x19')](_0x1b965f));return _0xa38711;});}return _0xa38711;});}return _0xa38711;}})['then'](respondWithResult(_0x52f459,0xc9))[_0x1939('0x1d')](handleError(_0x52f459,null));};exports[_0x1939('0x65')]=function(_0x2e6310,_0x2eae4f){var _0x566446={'agent':{},'channel':_0x1939('0x66')};if(_0x2e6310['body']['id']){delete _0x2e6310[_0x1939('0x48')]['id'];}_0x2e6310[_0x1939('0x48')][_0x1939('0x67')]=!![];_0x2e6310['body'][_0x1939('0x68')]=moment()[_0x1939('0x64')]('YYYY-MM-DD\x20HH:mm:ss');_0x2e6310['body'][_0x1939('0x69')]=_0x2e6310[_0x1939('0x48')]['UserId']||_0x2e6310[_0x1939('0x6a')]['id'];_0x566446['agent']['id']=_0x2e6310['body']['UserId'];return db[_0x1939('0x2c')]['find']({'where':{'id':_0x2e6310['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2eae4f,null))['then'](saveUpdates(_0x2e6310[_0x1939('0x48')],null))[_0x1939('0x27')](function(_0x194140){if(_0x194140){_0x566446['message']=_0x194140[_0x1939('0x6b')]({'plain':!![]});return db[_0x1939('0x6c')]['find']({'where':{'id':_0x194140[_0x1939('0x6d')]}});}return null;})['then'](handleEntityNotFound(_0x2eae4f,null))['then'](function(_0x150634){if(_0x150634){return _0x150634[_0x1939('0x26')]({'UserId':_0x2e6310['body'][_0x1939('0x69')],'read1stAt':_[_0x1939('0x6e')](_0x150634['read1stAt'])?moment()[_0x1939('0x64')](_0x1939('0x6f')):undefined});}return null;})[_0x1939('0x27')](function(_0x5780f5){if(_0x5780f5){_0x566446[_0x1939('0x70')]=_0x5780f5[_0x1939('0x6b')]({'plain':!![]});interaction_log['info'](_0x1939('0x71'),_0x2e6310['user']['id'],_0x2e6310['user']['name'],_0x2e6310[_0x1939('0x6a')][_0x1939('0x72')],_0x566446[_0x1939('0x70')]['id'],_0x2e6310[_0x1939('0x48')]?JSON['stringify'](_0x2e6310[_0x1939('0x48')]):'null');return respondWithRpcPromise(_0x1939('0x73'),'acceptMessage',_0x566446);}return null;})[_0x1939('0x27')](function(_0x4cb516){var _0x1c14b9=_0x1939('0x74')+_0x4cb516[_0x1939('0x1b')][_0x1939('0x75')];return db['sequelize']['query'](_0x1c14b9,{'type':db[_0x1939('0x76')][_0x1939('0x77')]['SELECT'],'raw':!![]})['then'](function(_0x14c9f6){return _0x14c9f6;});})['then'](function(_0x31c92b){if(_0x31c92b){_0x566446[_0x1939('0x1b')][_0x1939('0x78')]=_0x31c92b[0x0];if(!_0x2e6310[_0x1939('0x48')]['UserId'])return;return db[_0x1939('0x79')][_0x1939('0x47')]({'where':{'id':_0x2e6310[_0x1939('0x48')]['UserId'],'role':_0x1939('0x7a')},'attributes':['id',_0x1939('0x2b'),_0x1939('0x7b'),'email',_0x1939('0x7c')],'raw':!![]});}return null;})['then'](function(_0x146d34){if(!_0x146d34)return null;_0x566446[_0x1939('0x1b')][_0x1939('0x7a')]=_0x146d34;return _0x566446;})[_0x1939('0x27')](function(_0x38539d){if(_0x38539d){if(_0x2e6310[_0x1939('0x48')]['manual']){_0x566446[_0x1939('0x1b')][_0x1939('0x7d')]=util[_0x1939('0x64')](_0x1939('0x7e'),_0x2e6310[_0x1939('0x6a')][_0x1939('0x2b')]);_0x566446[_0x1939('0x1b')]['channel']=_0x566446[_0x1939('0x7f')];_0x566446[_0x1939('0x1b')][_0x1939('0x80')]=_0x566446[_0x1939('0x7f')];_0x566446[_0x1939('0x1b')]['event']=_0x1939('0x65');_0x566446[_0x1939('0x1b')]['body']=htmlToText['fromString'](_0x566446[_0x1939('0x1b')][_0x1939('0x48')]);return respondWithRpcPromise('EventManager',_0x1939('0x81'),{'event':_0x1939('0x82'),'message':_0x566446[_0x1939('0x1b')]},client9002)['then'](function(){return _0x566446;});}return _0x566446;}return null;})[_0x1939('0x27')](respondWithResult(_0x2eae4f,null))[_0x1939('0x1d')](handleError(_0x2eae4f,null));};exports[_0x1939('0x83')]=function(_0x429182,_0x550a99){var _0x12d20f={'agent':{},'channel':_0x1939('0x66')};if(_0x429182[_0x1939('0x48')]['id']){delete _0x429182['body']['id'];}_0x429182[_0x1939('0x48')][_0x1939('0x69')]=_0x429182['body']['UserId']||_0x429182[_0x1939('0x6a')]['id'];_0x12d20f['agent']['id']=_0x429182[_0x1939('0x48')]['UserId'];return db[_0x1939('0x2c')][_0x1939('0x47')]({'where':{'id':_0x429182[_0x1939('0x44')]['id'],'UserId':null}})[_0x1939('0x27')](handleEntityNotFound(_0x550a99,null))[_0x1939('0x27')](function(_0x33458b){if(_0x33458b){_0x12d20f[_0x1939('0x1b')]=_0x33458b[_0x1939('0x6b')]({'plain':!![]});return db[_0x1939('0x6c')][_0x1939('0x47')]({'where':{'id':_0x33458b[_0x1939('0x6d')]}});}return null;})['then'](handleEntityNotFound(_0x550a99,null))[_0x1939('0x27')](function(_0x27eee9){if(_0x27eee9){_0x12d20f[_0x1939('0x70')]=_0x27eee9[_0x1939('0x6b')]({'plain':!![]});interaction_log[_0x1939('0x14')](_0x1939('0x84'),_0x429182[_0x1939('0x6a')]['id'],_0x429182[_0x1939('0x6a')][_0x1939('0x2b')],_0x429182['user'][_0x1939('0x72')],_0x12d20f[_0x1939('0x70')]['id'],_0x429182[_0x1939('0x48')]?JSON[_0x1939('0x19')](_0x429182['body']):_0x1939('0x85'));return respondWithRpcPromise(_0x1939('0x86'),_0x1939('0x87'),_0x12d20f);}return null;})[_0x1939('0x27')](function(_0x45f7af){var _0x335ab6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x45f7af[_0x1939('0x1b')][_0x1939('0x75')];return db[_0x1939('0x88')][_0x1939('0x31')](_0x335ab6,{'type':db[_0x1939('0x76')][_0x1939('0x77')][_0x1939('0x89')],'raw':!![]})[_0x1939('0x27')](function(_0x164d37){return _0x164d37;});})['then'](function(_0x3f9ce1){if(_0x3f9ce1){_0x12d20f[_0x1939('0x1b')][_0x1939('0x78')]=_0x3f9ce1[0x0];if(!_0x429182[_0x1939('0x48')][_0x1939('0x69')])return;return db['User']['find']({'where':{'id':_0x429182[_0x1939('0x48')][_0x1939('0x69')],'role':_0x1939('0x7a')},'attributes':['id',_0x1939('0x2b'),_0x1939('0x7b'),_0x1939('0x8a'),_0x1939('0x7c')],'raw':!![]});}return null;})[_0x1939('0x27')](function(_0x3eae44){if(!_0x3eae44)return null;_0x12d20f[_0x1939('0x1b')]['agent']=_0x3eae44;return _0x12d20f;})[_0x1939('0x27')](function(_0xb7b586){if(_0xb7b586){_0xb7b586[_0x1939('0x1b')][_0x1939('0x7d')]=util[_0x1939('0x64')](_0x1939('0x7e'),_0x429182[_0x1939('0x6a')][_0x1939('0x2b')]);_0xb7b586[_0x1939('0x1b')]['channel']=_0x12d20f[_0x1939('0x7f')];_0xb7b586['message'][_0x1939('0x80')]=_0x12d20f['channel'];_0xb7b586[_0x1939('0x1b')][_0x1939('0x8b')]=_0x1939('0x83');_0xb7b586[_0x1939('0x1b')][_0x1939('0x48')]=htmlToText[_0x1939('0x8c')](_0x12d20f[_0x1939('0x1b')][_0x1939('0x48')]);respondWithRpcPromise(_0x1939('0x81'),_0x1939('0x81'),{'event':'rejectmessage','message':_0xb7b586[_0x1939('0x1b')]},client9002);return _0x12d20f;}return null;})['then'](respondWithResult(_0x550a99,null))[_0x1939('0x1d')](handleError(_0x550a99,null));};exports[_0x1939('0x8d')]=function(_0x34d2ba,_0x482888){var _0x500ddc=moment()[_0x1939('0x8e')]()[_0x1939('0x8f')]();var _0x1e5008=path[_0x1939('0x5b')](config[_0x1939('0x5c')],'server',_0x1939('0x90'),_0x1939('0x91'));var _0x4be3a8=path[_0x1939('0x5b')](config['root'],_0x1939('0x92'),_0x1939('0x90'),_0x1939('0x5a'));var _0x4e0065=util[_0x1939('0x64')]('message-%s.eml',_0x500ddc);return db[_0x1939('0x2c')][_0x1939('0x47')]({'where':{'id':_0x34d2ba[_0x1939('0x44')]['id']},'attributes':['id',_0x1939('0x48'),'from','to','cc',_0x1939('0x93'),_0x1939('0x94'),_0x1939('0x95')],'include':_0x34d2ba[_0x1939('0x31')][_0x1939('0x5a')]?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})[_0x1939('0x27')](handleEntityNotFound(_0x482888,null))[_0x1939('0x27')](function(_0x2e09bc){if(_0x2e09bc){var _0x43086d=_0x2e09bc;var _0x2743cc={'from':_0x43086d[_0x1939('0x96')],'to':_0x43086d['to'],'subject':_0x43086d[_0x1939('0x94')],'html':htmlEntities[_0x1939('0x97')](_0x43086d[_0x1939('0x48')]),'headers':{'Date':moment(_0x43086d[_0x1939('0x95')])[_0x1939('0x64')](_0x1939('0x98'))},'attachments':[]};if(_0x2e09bc['cc']){_0x2743cc[_0x1939('0x99')]['Cc']=_0x2e09bc['cc'];}if(_0x2e09bc[_0x1939('0x93')]){_0x2743cc[_0x1939('0x99')][_0x1939('0x9a')]=_0x2e09bc[_0x1939('0x93')];}return new BPromise(function(_0x1ec219,_0x4bf2b0){if(_0x2e09bc['Attachments']){for(var _0xc4cec0=0x0;_0xc4cec0<_0x2e09bc[_0x1939('0x9b')][_0x1939('0x37')];_0xc4cec0++){var _0x241230=_0x2e09bc[_0x1939('0x9b')][_0xc4cec0];var _0x436c5f=path[_0x1939('0x5b')](_0x4be3a8,_0x241230[_0x1939('0x9c')]);if(fs['existsSync'](_0x436c5f)){_0x2743cc[_0x1939('0x5a')][_0x1939('0x9d')]({'name':_0x241230[_0x1939('0x2b')],'contentType':_0x241230[_0x1939('0x2e')],'data':fs[_0x1939('0x9e')](_0x436c5f)});}}}emlformat[_0x1939('0x9f')](_0x2743cc,function(_0x4c757f,_0x69eb08){if(_0x4c757f)return _0x4bf2b0(_0x4c757f);fs[_0x1939('0xa0')](path[_0x1939('0x5b')](_0x1e5008,_0x4e0065),_0x69eb08);return _0x1ec219(_0x69eb08);});});}})[_0x1939('0x27')](function(_0x2cd0a6){if(_0x2cd0a6){return _0x482888['download'](path[_0x1939('0x5b')](_0x1e5008,_0x4e0065),_0x4e0065,function(_0x20c530){if(!_0x20c530)fs[_0x1939('0xa1')](path['join'](_0x1e5008,_0x4e0065));});}})[_0x1939('0x1d')](handleError(_0x482888,null));}; \ No newline at end of file +var _0xb661=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','body','find','params','describe','direction','secret','split','MailAccount','findOne','MailAccountId','List','CmContact','updatedAt','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','Contacts','create','ListId','List\x20not\x20found','SendMail','update','messageId','YYYY-MM-DD\x20HH:mm:ss','mail','read','readAt','format','UserId','user','MailInteraction','MailInteractionId','isNil','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','SELECT','User','agent','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','accept','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','QueryTypes','contact','interface','rejectmessage','toString','server','tmp','files','from','bcc','createdAt','Attachment','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','api','../../config/logger','mail-interactions','redis','defaults','html-entities','./mailMessage.socket','register','jayson/promise','http','client','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','offset','undefined','count','limit','set','Content-Range','json','then','end','sendStatus','name','map','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x514137,_0xa8df92){var _0xe75f90=function(_0x36b1da){while(--_0x36b1da){_0x514137['push'](_0x514137['shift']());}};_0xe75f90(++_0xa8df92);}(_0xb661,0x10a));var _0x1b66=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0xb661[_0x4bb66f];return _0xf2772f;};'use strict';var emlformat=require(_0x1b66('0x0'));var moment=require(_0x1b66('0x1'));var BPromise=require(_0x1b66('0x2'));var util=require(_0x1b66('0x3'));var path=require(_0x1b66('0x4'));var fs=require('fs');var _=require(_0x1b66('0x5'));var Redis=require(_0x1b66('0x6'));var htmlToText=require('html-to-text');var qs=require(_0x1b66('0x7'));var logger=require('../../config/logger')(_0x1b66('0x8'));var interaction_log=require(_0x1b66('0x9'))(_0x1b66('0xa'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x1b66('0xb')]=_[_0x1b66('0xc')](config[_0x1b66('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1b66('0xb')]));var htmlEntities=require(_0x1b66('0xd'));require(_0x1b66('0xe'))[_0x1b66('0xf')](socket);var jayson=require(_0x1b66('0x10'));var client=jayson['client'][_0x1b66('0x11')]({'port':0x232c});var client9003=jayson[_0x1b66('0x12')]['http']({'port':0x232b});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x51b35,_0xfaa588,_0x48c704,_0x539aa6){return new BPromise(function(_0x31d8bd,_0x3b6707){var _0x171cc5=_0x539aa6||client;return _0x171cc5[_0x1b66('0x13')](_0x51b35,_0x48c704)['then'](function(_0x4af8ae){logger[_0x1b66('0x14')](_0x1b66('0x15'),_0xfaa588,_0x1b66('0x16'));logger[_0x1b66('0x17')](_0x1b66('0x18'),_0xfaa588,_0x1b66('0x16'),JSON[_0x1b66('0x19')](_0x4af8ae));if(_0x4af8ae[_0x1b66('0x1a')]){if(_0x4af8ae[_0x1b66('0x1a')][_0x1b66('0x1b')]===0x1f4){logger['error'](_0x1b66('0x15'),_0xfaa588,_0x4af8ae[_0x1b66('0x1a')]['message']);return _0x3b6707(_0x4af8ae[_0x1b66('0x1a')][_0x1b66('0x1c')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0xfaa588,_0x4af8ae['error']['message']);return _0x31d8bd(_0x4af8ae[_0x1b66('0x1a')][_0x1b66('0x1c')]);}else{logger[_0x1b66('0x14')](_0x1b66('0x15'),_0xfaa588,_0x1b66('0x16'));_0x31d8bd(_0x4af8ae[_0x1b66('0x1d')][_0x1b66('0x1c')]);}})['catch'](function(_0x1a6923){logger[_0x1b66('0x1a')]('MailMessage,\x20%s,\x20%s',_0xfaa588,_0x1a6923);_0x3b6707(_0x1a6923);});});}function respondWithResult(_0x45e27e,_0x3c964b){_0x3c964b=_0x3c964b||0xc8;return function(_0x5ad9d3){if(_0x5ad9d3){return _0x45e27e[_0x1b66('0x1e')](_0x3c964b)['json'](_0x5ad9d3);}};}function respondWithFilteredResult(_0x198954,_0x2bf143){return function(_0x38583a){if(_0x38583a){var _0x50e1cd=typeof _0x2bf143[_0x1b66('0x1f')]===_0x1b66('0x20')&&typeof _0x2bf143['limit']===_0x1b66('0x20');var _0x38db00=_0x38583a[_0x1b66('0x21')];var _0x3e26cf=_0x50e1cd?0x0:_0x2bf143[_0x1b66('0x1f')];var _0x5e402c=_0x50e1cd?_0x38583a['count']:_0x2bf143['offset']+_0x2bf143[_0x1b66('0x22')];var _0x3847aa;if(_0x5e402c>=_0x38db00){_0x5e402c=_0x38db00;_0x3847aa=0xc8;}else{_0x3847aa=0xce;}_0x198954[_0x1b66('0x1e')](_0x3847aa);return _0x198954[_0x1b66('0x23')](_0x1b66('0x24'),_0x3e26cf+'-'+_0x5e402c+'/'+_0x38db00)[_0x1b66('0x25')](_0x38583a);}return null;};}function saveUpdates(_0x52070b){return function(_0x1ded29){if(_0x1ded29){return _0x1ded29['update'](_0x52070b)[_0x1b66('0x26')](function(_0x3a2637){return _0x3a2637;});}return null;};}function removeEntity(_0x16a8c9){return function(_0x46ac1e){if(_0x46ac1e){return _0x46ac1e['destroy']()[_0x1b66('0x26')](function(){_0x16a8c9['status'](0xcc)[_0x1b66('0x27')]();});}};}function handleEntityNotFound(_0xc586b3){return function(_0x2fe838){if(!_0x2fe838){_0xc586b3[_0x1b66('0x28')](0x194);}return _0x2fe838;};}function handleError(_0x11b056,_0xe4e42e){_0xe4e42e=_0xe4e42e||0x1f4;return function(_0x531946){logger['error'](_0x531946['stack']);if(_0x531946[_0x1b66('0x29')]){delete _0x531946[_0x1b66('0x29')];}_0x11b056['status'](_0xe4e42e)['send'](_0x531946);};}exports['index']=function(_0x1ae1bd,_0x415aef){var _0x19236a={},_0x10c715={},_0x47bd1e={'count':0x0,'rows':[]};var _0x32ca34=_[_0x1b66('0x2a')](db[_0x1b66('0x2b')][_0x1b66('0x2c')],function(_0x4beb59){return{'name':_0x4beb59[_0x1b66('0x2d')],'type':_0x4beb59[_0x1b66('0x2e')][_0x1b66('0x2f')]};});_0x10c715[_0x1b66('0x30')]=_['map'](_0x32ca34,'name');_0x10c715[_0x1b66('0x31')]=_[_0x1b66('0x32')](_0x1ae1bd['query']);_0x10c715[_0x1b66('0x33')]=_[_0x1b66('0x34')](_0x10c715['model'],_0x10c715[_0x1b66('0x31')]);_0x19236a[_0x1b66('0x35')]=_['intersection'](_0x10c715[_0x1b66('0x30')],qs[_0x1b66('0x36')](_0x1ae1bd[_0x1b66('0x31')][_0x1b66('0x36')]));_0x19236a['attributes']=_0x19236a[_0x1b66('0x35')][_0x1b66('0x37')]?_0x19236a['attributes']:_0x10c715[_0x1b66('0x30')];if(!_0x1ae1bd[_0x1b66('0x31')][_0x1b66('0x38')](_0x1b66('0x39'))){_0x19236a[_0x1b66('0x22')]=qs[_0x1b66('0x22')](_0x1ae1bd[_0x1b66('0x31')][_0x1b66('0x22')]);_0x19236a[_0x1b66('0x1f')]=qs[_0x1b66('0x1f')](_0x1ae1bd[_0x1b66('0x31')][_0x1b66('0x1f')]);}_0x19236a[_0x1b66('0x3a')]=qs[_0x1b66('0x3b')](_0x1ae1bd[_0x1b66('0x31')][_0x1b66('0x3b')]);_0x19236a[_0x1b66('0x3c')]=qs['filters'](_[_0x1b66('0x3d')](_0x1ae1bd[_0x1b66('0x31')],_0x10c715[_0x1b66('0x33')]),_0x32ca34);if(_0x1ae1bd[_0x1b66('0x31')]['filter']){_0x19236a[_0x1b66('0x3c')]=_[_0x1b66('0x3e')](_0x19236a[_0x1b66('0x3c')],{'$or':_[_0x1b66('0x2a')](_0x32ca34,function(_0x7b98cd){if(_0x7b98cd[_0x1b66('0x2e')]!=='VIRTUAL'){var _0x564cc7={};_0x564cc7[_0x7b98cd[_0x1b66('0x29')]]={'$like':'%'+_0x1ae1bd['query'][_0x1b66('0x3f')]+'%'};return _0x564cc7;}})});}_0x19236a=_['merge']({},_0x19236a,_0x1ae1bd[_0x1b66('0x40')]);var _0x10622e={'where':_0x19236a[_0x1b66('0x3c')]};return db[_0x1b66('0x2b')][_0x1b66('0x21')](_0x10622e)['then'](function(_0x43509f){_0x47bd1e[_0x1b66('0x21')]=_0x43509f;if(_0x1ae1bd[_0x1b66('0x31')][_0x1b66('0x41')]){_0x19236a[_0x1b66('0x42')]=[{'all':!![]}];}return db['MailMessage'][_0x1b66('0x43')](_0x19236a);})[_0x1b66('0x26')](function(_0x246d49){_0x47bd1e[_0x1b66('0x44')]=_0x246d49;return _0x47bd1e;})[_0x1b66('0x26')](respondWithFilteredResult(_0x415aef,_0x19236a))[_0x1b66('0x45')](handleError(_0x415aef,null));};exports[_0x1b66('0x46')]=function(_0x14446f,_0x48b94c){var _0x4e9eaa={'raw':!![],'where':{'id':_0x14446f['params']['id']}},_0x41cd57={};_0x41cd57[_0x1b66('0x30')]=_[_0x1b66('0x32')](db[_0x1b66('0x2b')][_0x1b66('0x2c')]);_0x41cd57[_0x1b66('0x31')]=_[_0x1b66('0x32')](_0x14446f[_0x1b66('0x31')]);_0x41cd57[_0x1b66('0x33')]=_[_0x1b66('0x34')](_0x41cd57[_0x1b66('0x30')],_0x41cd57[_0x1b66('0x31')]);_0x4e9eaa[_0x1b66('0x35')]=_[_0x1b66('0x34')](_0x41cd57[_0x1b66('0x30')],qs[_0x1b66('0x36')](_0x14446f['query'][_0x1b66('0x36')]));_0x4e9eaa[_0x1b66('0x35')]=_0x4e9eaa[_0x1b66('0x35')][_0x1b66('0x37')]?_0x4e9eaa[_0x1b66('0x35')]:_0x41cd57[_0x1b66('0x30')];if(_0x14446f[_0x1b66('0x31')][_0x1b66('0x41')]){_0x4e9eaa[_0x1b66('0x42')]=[{'all':!![]}];}_0x4e9eaa=_[_0x1b66('0x3e')]({},_0x4e9eaa,_0x14446f[_0x1b66('0x40')]);return db[_0x1b66('0x2b')]['find'](_0x4e9eaa)[_0x1b66('0x26')](handleEntityNotFound(_0x48b94c,null))[_0x1b66('0x26')](respondWithResult(_0x48b94c,null))[_0x1b66('0x45')](handleError(_0x48b94c,null));};exports['update']=function(_0x579eed,_0x3fa4a1){if(_0x579eed[_0x1b66('0x47')]['id']){delete _0x579eed[_0x1b66('0x47')]['id'];}return db[_0x1b66('0x2b')][_0x1b66('0x48')]({'where':{'id':_0x579eed[_0x1b66('0x49')]['id']}})['then'](handleEntityNotFound(_0x3fa4a1,null))[_0x1b66('0x26')](saveUpdates(_0x579eed['body'],null))['then'](respondWithResult(_0x3fa4a1,null))[_0x1b66('0x45')](handleError(_0x3fa4a1,null));};exports['destroy']=function(_0x299620,_0x5dd057){return db[_0x1b66('0x2b')][_0x1b66('0x48')]({'where':{'id':_0x299620[_0x1b66('0x49')]['id']}})['then'](handleEntityNotFound(_0x5dd057,null))['then'](removeEntity(_0x5dd057,null))[_0x1b66('0x45')](handleError(_0x5dd057,null));};exports[_0x1b66('0x4a')]=function(_0x81dcd2,_0x193029){return db[_0x1b66('0x2b')]['describe']()[_0x1b66('0x26')](respondWithResult(_0x193029,null))[_0x1b66('0x45')](handleError(_0x193029,null));};exports['create']=function(_0x10f235,_0x597061){return db[_0x1b66('0x2b')]['create'](_0x10f235[_0x1b66('0x47')])['then'](function(_0x331ceb){if(_0x331ceb){if(_0x331ceb[_0x1b66('0x4b')]==='out'&&!_0x331ceb[_0x1b66('0x4c')]){var _0x240baf,_0x255968,_0x10cba3;if(_0x10f235[_0x1b66('0x47')]['to']){_0x255968=_0x10f235[_0x1b66('0x47')]['to'][_0x1b66('0x4d')](',')[0x0];}return db[_0x1b66('0x4e')][_0x1b66('0x4f')]({'where':{'id':_0x331ceb[_0x1b66('0x50')]},'include':[{'model':db['CmList'],'as':_0x1b66('0x51'),'include':[{'model':db[_0x1b66('0x52')],'as':'Contacts','where':{'email':_0x255968},'limit':0x1,'order':[[_0x1b66('0x53'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0x1b66('0x54'),'raw':!![],'include':[{'model':db[_0x1b66('0x55')],'as':'CloudProvider','raw':!![]}]}]})[_0x1b66('0x26')](function(_0x2d23d6){_0x240baf=_0x2d23d6;if(!_0x240baf||!_0x240baf['Smtp'])return;var _0x4650e9=_0x240baf[_0x1b66('0x56')]();if(_0x10f235[_0x1b66('0x47')][_0x1b66('0x57')]&&_0x10f235[_0x1b66('0x47')]['attachments'][_0x1b66('0x37')]){for(var _0x4a025e=0x0;_0x4a025e<_0x10f235[_0x1b66('0x47')]['attachments']['length'];_0x4a025e+=0x1){_0x10f235[_0x1b66('0x47')][_0x1b66('0x57')][_0x4a025e]={'filename':_0x10f235[_0x1b66('0x47')]['attachments'][_0x4a025e][_0x1b66('0x29')],'path':path[_0x1b66('0x58')](config[_0x1b66('0x59')],_0x1b66('0x5a'),_0x10f235['body'][_0x1b66('0x57')][_0x4a025e][_0x1b66('0x5b')])};}}_0x10cba3={'account':_0x4650e9,'message':_0x10f235[_0x1b66('0x47')]};return;})[_0x1b66('0x26')](function(){if(_0x240baf['List']){if(_0x240baf['List'][_0x1b66('0x5c')][_0x1b66('0x37')]){return _0x240baf['List']['Contacts'][0x0];}else{return db['CmContact'][_0x1b66('0x5d')](_['defaults'](_0x10f235[_0x1b66('0x47')],{'firstName':_0x10f235[_0x1b66('0x47')]['to'],'email':_0x10f235['body']['to'],'phone':_0x10f235['body']['to'],'ListId':_0x240baf[_0x1b66('0x5e')]}));}}else{throw new Error(_0x1b66('0x5f'));}})[_0x1b66('0x26')](function(){if(_0x10cba3){return respondWithRpcPromise(_0x1b66('0x60'),'sendMail',_0x10cba3,client9003)[_0x1b66('0x26')](function(_0x53981a){return _0x331ceb[_0x1b66('0x61')]({'read':!![],'messageId':_0x53981a[_0x1b66('0x62')],'sentAt':moment()['format'](_0x1b66('0x63'))});})[_0x1b66('0x45')](function(_0x14538e){logger[_0x1b66('0x1a')]('%s',JSON[_0x1b66('0x19')](_0x14538e));return _0x331ceb;});}return _0x331ceb;});}return _0x331ceb;}})[_0x1b66('0x26')](respondWithResult(_0x597061,0xc9))[_0x1b66('0x45')](handleError(_0x597061,null));};exports['accept']=function(_0xa14ba9,_0x85f270){var _0x59c252={'agent':{},'channel':_0x1b66('0x64')};if(_0xa14ba9[_0x1b66('0x47')]['id']){delete _0xa14ba9[_0x1b66('0x47')]['id'];}_0xa14ba9[_0x1b66('0x47')][_0x1b66('0x65')]=!![];_0xa14ba9[_0x1b66('0x47')][_0x1b66('0x66')]=moment()[_0x1b66('0x67')]('YYYY-MM-DD\x20HH:mm:ss');_0xa14ba9[_0x1b66('0x47')][_0x1b66('0x68')]=_0xa14ba9['body'][_0x1b66('0x68')]||_0xa14ba9[_0x1b66('0x69')]['id'];_0x59c252['agent']['id']=_0xa14ba9['body']['UserId'];return db[_0x1b66('0x2b')][_0x1b66('0x48')]({'where':{'id':_0xa14ba9[_0x1b66('0x49')]['id'],'UserId':null}})[_0x1b66('0x26')](handleEntityNotFound(_0x85f270,null))[_0x1b66('0x26')](saveUpdates(_0xa14ba9[_0x1b66('0x47')],null))[_0x1b66('0x26')](function(_0x1a1b5b){if(_0x1a1b5b){_0x59c252[_0x1b66('0x1c')]=_0x1a1b5b['get']({'plain':!![]});return db[_0x1b66('0x6a')][_0x1b66('0x48')]({'where':{'id':_0x1a1b5b[_0x1b66('0x6b')]}});}return null;})['then'](handleEntityNotFound(_0x85f270,null))['then'](function(_0xf64386){if(_0xf64386){return _0xf64386[_0x1b66('0x61')]({'UserId':_0xa14ba9[_0x1b66('0x47')][_0x1b66('0x68')],'read1stAt':_[_0x1b66('0x6c')](_0xf64386['read1stAt'])?moment()['format'](_0x1b66('0x63')):undefined});}return null;})[_0x1b66('0x26')](function(_0x230ec3){if(_0x230ec3){_0x59c252[_0x1b66('0x6d')]=_0x230ec3[_0x1b66('0x6e')]({'plain':!![]});interaction_log[_0x1b66('0x14')](_0x1b66('0x6f'),_0xa14ba9[_0x1b66('0x69')]['id'],_0xa14ba9[_0x1b66('0x69')][_0x1b66('0x29')],_0xa14ba9[_0x1b66('0x69')][_0x1b66('0x70')],_0x59c252[_0x1b66('0x6d')]['id'],_0xa14ba9['body']?JSON[_0x1b66('0x19')](_0xa14ba9['body']):_0x1b66('0x71'));return respondWithRpcPromise(_0x1b66('0x72'),_0x1b66('0x73'),_0x59c252);}return null;})[_0x1b66('0x26')](function(_0x3c9503){var _0x19caa1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3c9503[_0x1b66('0x1c')][_0x1b66('0x74')];return db[_0x1b66('0x75')]['query'](_0x19caa1,{'type':db[_0x1b66('0x76')]['QueryTypes'][_0x1b66('0x77')],'raw':!![]})['then'](function(_0x5a604f){return _0x5a604f;});})[_0x1b66('0x26')](function(_0x1e3a95){if(_0x1e3a95){_0x59c252[_0x1b66('0x1c')]['contact']=_0x1e3a95[0x0];if(!_0xa14ba9[_0x1b66('0x47')][_0x1b66('0x68')])return;return db[_0x1b66('0x78')][_0x1b66('0x48')]({'where':{'id':_0xa14ba9[_0x1b66('0x47')]['UserId'],'role':_0x1b66('0x79')},'attributes':['id',_0x1b66('0x29'),_0x1b66('0x7a'),_0x1b66('0x7b'),_0x1b66('0x7c')],'raw':!![]});}return null;})[_0x1b66('0x26')](function(_0x345921){if(!_0x345921)return null;_0x59c252[_0x1b66('0x1c')]['agent']=_0x345921;return _0x59c252;})[_0x1b66('0x26')](function(_0x10b8ea){if(_0x10b8ea){if(_0xa14ba9[_0x1b66('0x47')][_0x1b66('0x7d')]){_0x59c252[_0x1b66('0x1c')]['interface']=util['format'](_0x1b66('0x7e'),_0xa14ba9['user']['name']);_0x59c252[_0x1b66('0x1c')][_0x1b66('0x7f')]=_0x59c252['channel'];_0x59c252[_0x1b66('0x1c')][_0x1b66('0x80')]=_0x59c252[_0x1b66('0x7f')];_0x59c252[_0x1b66('0x1c')][_0x1b66('0x81')]=_0x1b66('0x82');_0x59c252[_0x1b66('0x1c')]['body']=htmlToText[_0x1b66('0x83')](_0x59c252[_0x1b66('0x1c')][_0x1b66('0x47')]);return respondWithRpcPromise(_0x1b66('0x84'),_0x1b66('0x84'),{'event':_0x1b66('0x85'),'message':_0x59c252['message']},client9002)[_0x1b66('0x26')](function(){return _0x59c252;});}return _0x59c252;}return null;})['then'](respondWithResult(_0x85f270,null))['catch'](handleError(_0x85f270,null));};exports[_0x1b66('0x86')]=function(_0x4147fc,_0x44fb56){var _0x3a6b35={'agent':{},'channel':_0x1b66('0x64')};if(_0x4147fc[_0x1b66('0x47')]['id']){delete _0x4147fc[_0x1b66('0x47')]['id'];}_0x4147fc[_0x1b66('0x47')][_0x1b66('0x68')]=_0x4147fc[_0x1b66('0x47')]['UserId']||_0x4147fc[_0x1b66('0x69')]['id'];_0x3a6b35[_0x1b66('0x79')]['id']=_0x4147fc[_0x1b66('0x47')][_0x1b66('0x68')];return db['MailMessage'][_0x1b66('0x48')]({'where':{'id':_0x4147fc[_0x1b66('0x49')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x44fb56,null))[_0x1b66('0x26')](function(_0x53d730){if(_0x53d730){_0x3a6b35[_0x1b66('0x1c')]=_0x53d730[_0x1b66('0x6e')]({'plain':!![]});return db[_0x1b66('0x6a')][_0x1b66('0x48')]({'where':{'id':_0x53d730['MailInteractionId']}});}return null;})[_0x1b66('0x26')](handleEntityNotFound(_0x44fb56,null))['then'](function(_0x58bd48){if(_0x58bd48){_0x3a6b35['interaction']=_0x58bd48['get']({'plain':!![]});interaction_log['info'](_0x1b66('0x87'),_0x4147fc['user']['id'],_0x4147fc[_0x1b66('0x69')][_0x1b66('0x29')],_0x4147fc[_0x1b66('0x69')][_0x1b66('0x70')],_0x3a6b35[_0x1b66('0x6d')]['id'],_0x4147fc[_0x1b66('0x47')]?JSON[_0x1b66('0x19')](_0x4147fc[_0x1b66('0x47')]):_0x1b66('0x71'));return respondWithRpcPromise(_0x1b66('0x88'),_0x1b66('0x89'),_0x3a6b35);}return null;})[_0x1b66('0x26')](function(_0xd0a446){var _0x2f42bf='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xd0a446['message']['ContactId'];return db['sequelize']['query'](_0x2f42bf,{'type':db[_0x1b66('0x76')][_0x1b66('0x8a')][_0x1b66('0x77')],'raw':!![]})[_0x1b66('0x26')](function(_0x3260a6){return _0x3260a6;});})[_0x1b66('0x26')](function(_0xa53dba){if(_0xa53dba){_0x3a6b35[_0x1b66('0x1c')][_0x1b66('0x8b')]=_0xa53dba[0x0];if(!_0x4147fc[_0x1b66('0x47')][_0x1b66('0x68')])return;return db['User'][_0x1b66('0x48')]({'where':{'id':_0x4147fc[_0x1b66('0x47')]['UserId'],'role':'agent'},'attributes':['id',_0x1b66('0x29'),_0x1b66('0x7a'),_0x1b66('0x7b'),_0x1b66('0x7c')],'raw':!![]});}return null;})[_0x1b66('0x26')](function(_0x269aed){if(!_0x269aed)return null;_0x3a6b35[_0x1b66('0x1c')]['agent']=_0x269aed;return _0x3a6b35;})['then'](function(_0x48637e){if(_0x48637e){_0x48637e['message'][_0x1b66('0x8c')]=util[_0x1b66('0x67')]('SIP/%s',_0x4147fc[_0x1b66('0x69')][_0x1b66('0x29')]);_0x48637e[_0x1b66('0x1c')][_0x1b66('0x7f')]=_0x3a6b35['channel'];_0x48637e[_0x1b66('0x1c')][_0x1b66('0x80')]=_0x3a6b35[_0x1b66('0x7f')];_0x48637e[_0x1b66('0x1c')]['event']=_0x1b66('0x86');_0x48637e[_0x1b66('0x1c')][_0x1b66('0x47')]=htmlToText[_0x1b66('0x83')](_0x3a6b35[_0x1b66('0x1c')]['body']);respondWithRpcPromise(_0x1b66('0x84'),'EventManager',{'event':_0x1b66('0x8d'),'message':_0x48637e['message']},client9002);return _0x3a6b35;}return null;})[_0x1b66('0x26')](respondWithResult(_0x44fb56,null))[_0x1b66('0x45')](handleError(_0x44fb56,null));};exports['download']=function(_0x15ad81,_0x2c57f7){var _0x20467e=moment()['unix']()[_0x1b66('0x8e')]();var _0x3efddd=path[_0x1b66('0x58')](config[_0x1b66('0x59')],_0x1b66('0x8f'),'files',_0x1b66('0x90'));var _0x171255=path[_0x1b66('0x58')](config[_0x1b66('0x59')],_0x1b66('0x8f'),_0x1b66('0x91'),_0x1b66('0x57'));var _0x4af4ad=util[_0x1b66('0x67')]('message-%s.eml',_0x20467e);return db[_0x1b66('0x2b')]['find']({'where':{'id':_0x15ad81[_0x1b66('0x49')]['id']},'attributes':['id','body',_0x1b66('0x92'),'to','cc',_0x1b66('0x93'),'subject',_0x1b66('0x94')],'include':_0x15ad81[_0x1b66('0x31')][_0x1b66('0x57')]?[{'model':db[_0x1b66('0x95')],'as':'Attachments'}]:undefined})[_0x1b66('0x26')](handleEntityNotFound(_0x2c57f7,null))[_0x1b66('0x26')](function(_0x3d51c3){if(_0x3d51c3){var _0x510046=_0x3d51c3;var _0x555f09={'from':_0x510046[_0x1b66('0x92')],'to':_0x510046['to'],'subject':_0x510046['subject'],'html':htmlEntities['decode'](_0x510046[_0x1b66('0x47')]),'headers':{'Date':moment(_0x510046[_0x1b66('0x94')])[_0x1b66('0x67')](_0x1b66('0x96'))},'attachments':[]};if(_0x3d51c3['cc']){_0x555f09[_0x1b66('0x97')]['Cc']=_0x3d51c3['cc'];}if(_0x3d51c3[_0x1b66('0x93')]){_0x555f09['headers'][_0x1b66('0x98')]=_0x3d51c3[_0x1b66('0x93')];}return new BPromise(function(_0x54c2f5,_0x7bc8e7){if(_0x3d51c3[_0x1b66('0x99')]){for(var _0x3e622a=0x0;_0x3e622a<_0x3d51c3[_0x1b66('0x99')][_0x1b66('0x37')];_0x3e622a++){var _0x33726b=_0x3d51c3['Attachments'][_0x3e622a];var _0x4b25a9=path[_0x1b66('0x58')](_0x171255,_0x33726b[_0x1b66('0x5b')]);if(fs[_0x1b66('0x9a')](_0x4b25a9)){_0x555f09[_0x1b66('0x57')][_0x1b66('0x9b')]({'name':_0x33726b[_0x1b66('0x29')],'contentType':_0x33726b[_0x1b66('0x2e')],'data':fs[_0x1b66('0x9c')](_0x4b25a9)});}}}emlformat[_0x1b66('0x9d')](_0x555f09,function(_0x4f6035,_0x21254c){if(_0x4f6035)return _0x7bc8e7(_0x4f6035);fs[_0x1b66('0x9e')](path['join'](_0x3efddd,_0x4af4ad),_0x21254c);return _0x54c2f5(_0x21254c);});});}})['then'](function(_0x5cbef9){if(_0x5cbef9){return _0x2c57f7['download'](path[_0x1b66('0x58')](_0x3efddd,_0x4af4ad),_0x4af4ad,function(_0x11fdc9){if(!_0x11fdc9)fs[_0x1b66('0x9f')](path[_0x1b66('0x58')](_0x3efddd,_0x4af4ad));});}})['catch'](handleError(_0x2c57f7,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 5e5a0dc..2c967b3 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 _0x39b4=['exports','MailMessage','setMaxListeners','save','remove','emit','hook'];(function(_0xc31be,_0x212ee6){var _0x409550=function(_0x2a0bb8){while(--_0x2a0bb8){_0xc31be['push'](_0xc31be['shift']());}};_0x409550(++_0x212ee6);}(_0x39b4,0xa2));var _0x439b=function(_0x2365dd,_0x5a04ad){_0x2365dd=_0x2365dd-0x0;var _0x247a1d=_0x39b4[_0x2365dd];return _0x247a1d;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db'][_0x439b('0x0')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x439b('0x1')](0x0);var events={'afterCreate':_0x439b('0x2'),'afterUpdate':'update','afterDestroy':_0x439b('0x3')};function emitEvent(_0x4ee5cf){return function(_0x2b1699,_0x42e285,_0x2c8d01){MailMessageEvents[_0x439b('0x4')](_0x4ee5cf+':'+_0x2b1699['id'],_0x2b1699);MailMessageEvents['emit'](_0x4ee5cf,_0x2b1699);_0x2c8d01(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x439b('0x5')](e,emitEvent(event));}}module[_0x439b('0x6')]=MailMessageEvents; \ No newline at end of file +var _0x9e52=['../../mysqldb','MailMessage','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x9e52,0xaa));var _0x29e5=function(_0x41cbcd,_0x2b455a){_0x41cbcd=_0x41cbcd-0x0;var _0x24f13a=_0x9e52[_0x41cbcd];return _0x24f13a;};'use strict';var EventEmitter=require(_0x29e5('0x0'));var MailMessage=require(_0x29e5('0x1'))['db'][_0x29e5('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x29e5('0x3'),'afterDestroy':_0x29e5('0x4')};function emitEvent(_0x3d8e79){return function(_0x35d2e7,_0x282d1f,_0x3be517){MailMessageEvents['emit'](_0x3d8e79+':'+_0x35d2e7['id'],_0x35d2e7);MailMessageEvents[_0x29e5('0x5')](_0x3d8e79,_0x35d2e7);_0x3be517(null);};}for(var e in events){if(events[_0x29e5('0x6')](e)){var event=events[e];MailMessage[_0x29e5('0x7')](e,emitEvent(event));}}module[_0x29e5('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 6ab5ab6..c6d1258 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 _0x7e65=['models','get','toLowerCase','direction','out','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','html-to-text','path','rimraf','./mailMessage.attributes','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString'];(function(_0x2b869b,_0x81ce74){var _0x494958=function(_0x240fd9){while(--_0x240fd9){_0x2b869b['push'](_0x2b869b['shift']());}};_0x494958(++_0x81ce74);}(_0x7e65,0xff));var _0x57e6=function(_0x10e983,_0x2f4eda){_0x10e983=_0x10e983-0x0;var _0x324138=_0x7e65[_0x10e983];return _0x324138;};'use strict';var _=require(_0x57e6('0x0'));var util=require(_0x57e6('0x1'));var logger=require(_0x57e6('0x2'))(_0x57e6('0x3'));var moment=require('moment');var BPromise=require(_0x57e6('0x4'));var rp=require('request-promise');var htmlToText=require(_0x57e6('0x5'));var fs=require('fs');var path=require(_0x57e6('0x6'));var rimraf=require(_0x57e6('0x7'));var config=require('../../config/environment');var attributes=require(_0x57e6('0x8'));module['exports']=function(_0x58852a,_0x12997f){return _0x58852a['define']('MailMessage',attributes,{'tableName':_0x57e6('0x9'),'paranoid':![],'indexes':[{'name':_0x57e6('0xa'),'fields':[_0x57e6('0xa')]},{'name':_0x57e6('0xb'),'fields':[_0x57e6('0xc'),_0x57e6('0xd')],'type':_0x57e6('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2dfbf3,_0xa47d08,_0x5945f9){if(_0x2dfbf3[_0x57e6('0xf')]){_0x2dfbf3['plainBody']=htmlToText[_0x57e6('0x10')](_0x2dfbf3[_0x57e6('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5945f9(null,_0xa47d08);},'afterCreate':function(_0x35e308,_0xf9d832,_0x2ed4f4){var _0x366e72=_0x58852a[_0x57e6('0x11')];var _0x43fad1=_0x35e308[_0x57e6('0x12')]({'plain':!![]});if(_0x43fad1['direction'][_0x57e6('0x13')]()==='in'||_0x43fad1[_0x57e6('0x14')][_0x57e6('0x13')]()===_0x57e6('0x15')&&!_0x43fad1['secret']&&!_[_0x57e6('0x16')](_0x43fad1[_0x57e6('0x17')])){_0x366e72[_0x57e6('0x18')][_0x57e6('0x19')]({'where':{'id':_0x43fad1[_0x57e6('0x1a')]}})[_0x57e6('0x1b')](function(_0xa09e1f){if(_0xa09e1f){_0xa09e1f[_0x57e6('0x1c')]({'lastMsgAt':_0x43fad1[_0x57e6('0x1d')],'lastMsgDirection':_0x43fad1[_0x57e6('0x14')][_0x57e6('0x13')]()});}})[_0x57e6('0x1e')](function(_0x4098c5){console[_0x57e6('0x1f')](_0x4098c5);});}_0x2ed4f4();}},'charset':_0x57e6('0x20'),'collate':_0x57e6('0x21')});}; \ No newline at end of file +var _0x7df9=['catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./mailMessage.attributes','exports','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','UserId','MailInteraction','findOne','then','update','createdAt'];(function(_0x134229,_0x198c73){var _0x169966=function(_0x597ac0){while(--_0x597ac0){_0x134229['push'](_0x134229['shift']());}};_0x169966(++_0x198c73);}(_0x7df9,0xa3));var _0x97df=function(_0x165b54,_0x28895d){_0x165b54=_0x165b54-0x0;var _0x396a8=_0x7df9[_0x165b54];return _0x396a8;};'use strict';var _=require(_0x97df('0x0'));var util=require(_0x97df('0x1'));var logger=require(_0x97df('0x2'))(_0x97df('0x3'));var moment=require(_0x97df('0x4'));var BPromise=require('bluebird');var rp=require(_0x97df('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x97df('0x6'));var rimraf=require('rimraf');var config=require(_0x97df('0x7'));var attributes=require(_0x97df('0x8'));module[_0x97df('0x9')]=function(_0x2b9ce0,_0x48a5a6){return _0x2b9ce0['define']('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x97df('0xa')]},{'name':_0x97df('0xb'),'fields':[_0x97df('0xc'),_0x97df('0xd')],'type':_0x97df('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x594d90,_0x227499,_0x336c4f){if(_0x594d90[_0x97df('0xf')]){_0x594d90[_0x97df('0xc')]=htmlToText[_0x97df('0x10')](_0x594d90[_0x97df('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x336c4f(null,_0x227499);},'afterCreate':function(_0x197fb5,_0x1762a6,_0x7b3586){var _0x25c89e=_0x2b9ce0[_0x97df('0x11')];var _0x52d355=_0x197fb5[_0x97df('0x12')]({'plain':!![]});if(_0x52d355[_0x97df('0x13')]['toLowerCase']()==='in'||_0x52d355[_0x97df('0x13')][_0x97df('0x14')]()===_0x97df('0x15')&&!_0x52d355[_0x97df('0x16')]&&!_['isNil'](_0x52d355[_0x97df('0x17')])){_0x25c89e[_0x97df('0x18')][_0x97df('0x19')]({'where':{'id':_0x52d355['MailInteractionId']}})[_0x97df('0x1a')](function(_0x5d27ce){if(_0x5d27ce){_0x5d27ce[_0x97df('0x1b')]({'lastMsgAt':_0x52d355[_0x97df('0x1c')],'lastMsgDirection':_0x52d355['direction'][_0x97df('0x14')]()});}})[_0x97df('0x1d')](function(_0x368349){console['error'](_0x368349);});}_0x7b3586();}},'charset':_0x97df('0x1e'),'collate':_0x97df('0x1f')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index abce51e..f4ada34 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 _0xcf2f=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','MailMessage,\x20%s,\x20%s','message','info','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x52e751,_0x1334f6){var _0x428b75=function(_0x5e3fb1){while(--_0x5e3fb1){_0x52e751['push'](_0x52e751['shift']());}};_0x428b75(++_0x1334f6);}(_0xcf2f,0xa7));var _0xfcf2=function(_0xa5c6f7,_0x281e3f){_0xa5c6f7=_0xa5c6f7-0x0;var _0x25aa41=_0xcf2f[_0xa5c6f7];return _0x25aa41;};'use strict';var _=require(_0xfcf2('0x0'));var util=require(_0xfcf2('0x1'));var moment=require(_0xfcf2('0x2'));var BPromise=require(_0xfcf2('0x3'));var rs=require(_0xfcf2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfcf2('0x5'))['db'];var utils=require(_0xfcf2('0x6'));var logger=require(_0xfcf2('0x7'))(_0xfcf2('0x8'));var config=require(_0xfcf2('0x9'));var jayson=require(_0xfcf2('0xa'));var client=jayson[_0xfcf2('0xb')][_0xfcf2('0xc')]({'port':0x232a});config[_0xfcf2('0xd')]=_[_0xfcf2('0xe')](config[_0xfcf2('0xd')],{'host':_0xfcf2('0xf'),'port':0x18eb});var socket=require(_0xfcf2('0x10'))(new Redis(config[_0xfcf2('0xd')]));require('./mailMessage.socket')['register'](socket);function respondWithRpcPromise(_0x4d6fc9,_0x91b579,_0x2a9ecb){return new BPromise(function(_0x481e38,_0xf38eab){return client[_0xfcf2('0x11')](_0x4d6fc9,_0x2a9ecb)[_0xfcf2('0x12')](function(_0x29e649){logger['info']('MailMessage,\x20%s,\x20%s',_0x91b579,_0xfcf2('0x13'));logger[_0xfcf2('0x14')](_0xfcf2('0x15'),_0x91b579,_0xfcf2('0x13'),JSON['stringify'](_0x29e649));if(_0x29e649[_0xfcf2('0x16')]){if(_0x29e649['error']['code']===0x1f4){logger['error'](_0xfcf2('0x17'),_0x91b579,_0x29e649['error'][_0xfcf2('0x18')]);return _0xf38eab(_0x29e649[_0xfcf2('0x16')][_0xfcf2('0x18')]);}logger[_0xfcf2('0x16')](_0xfcf2('0x17'),_0x91b579,_0x29e649[_0xfcf2('0x16')][_0xfcf2('0x18')]);return _0x481e38(_0x29e649['error'][_0xfcf2('0x18')]);}else{logger[_0xfcf2('0x19')](_0xfcf2('0x17'),_0x91b579,'request\x20sent');_0x481e38(_0x29e649[_0xfcf2('0x1a')][_0xfcf2('0x18')]);}})[_0xfcf2('0x1b')](function(_0x1cc67e){logger[_0xfcf2('0x16')]('MailMessage,\x20%s,\x20%s',_0x91b579,_0x1cc67e);_0xf38eab(_0x1cc67e);});});}exports[_0xfcf2('0x1c')]=function(_0x11c34f){var _0x4939e4=this;return new Promise(function(_0x9a1d9f,_0x23c079){return db[_0xfcf2('0x1d')][_0xfcf2('0x1e')](_0x11c34f[_0xfcf2('0x1f')],{'raw':_0x11c34f[_0xfcf2('0x20')]?_0x11c34f[_0xfcf2('0x20')][_0xfcf2('0x21')]===undefined?!![]:![]:!![]})[_0xfcf2('0x12')](function(_0x5afab5){logger[_0xfcf2('0x19')](_0xfcf2('0x1c'),_0x11c34f);logger[_0xfcf2('0x14')]('CreateMailMessage',_0x11c34f,JSON[_0xfcf2('0x22')](_0x5afab5));_0x9a1d9f(_0x5afab5);})[_0xfcf2('0x1b')](function(_0x5ddea1){logger[_0xfcf2('0x16')](_0xfcf2('0x1c'),_0x5ddea1['message'],_0x11c34f);_0x23c079(_0x4939e4[_0xfcf2('0x16')](0x1f4,_0x5ddea1[_0xfcf2('0x18')]));});});}; \ No newline at end of file +var _0x4024=['debug','stringify','error','code','message','info','catch','CreateMailMessage','MailMessage','create','body','options','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','redis','then','MailMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x2d3954,_0x13d066){var _0x54a52a=function(_0x50d6b0){while(--_0x50d6b0){_0x2d3954['push'](_0x2d3954['shift']());}};_0x54a52a(++_0x13d066);}(_0x4024,0x89));var _0x4402=function(_0x15c32d,_0x1bb90f){_0x15c32d=_0x15c32d-0x0;var _0x175994=_0x4024[_0x15c32d];return _0x175994;};'use strict';var _=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var moment=require('moment');var BPromise=require(_0x4402('0x2'));var rs=require(_0x4402('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4402('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4402('0x5'))(_0x4402('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4402('0x7')][_0x4402('0x8')]({'port':0x232a});config[_0x4402('0x9')]=_['defaults'](config[_0x4402('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4402('0x9')]));require('./mailMessage.socket')['register'](socket);function respondWithRpcPromise(_0x30fd34,_0x4f56aa,_0x1a4a47){return new BPromise(function(_0x4e1a7e,_0x34b4a6){return client['request'](_0x30fd34,_0x1a4a47)[_0x4402('0xa')](function(_0x251286){logger['info'](_0x4402('0xb'),_0x4f56aa,_0x4402('0xc'));logger[_0x4402('0xd')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x4f56aa,_0x4402('0xc'),JSON[_0x4402('0xe')](_0x251286));if(_0x251286[_0x4402('0xf')]){if(_0x251286[_0x4402('0xf')][_0x4402('0x10')]===0x1f4){logger[_0x4402('0xf')](_0x4402('0xb'),_0x4f56aa,_0x251286[_0x4402('0xf')][_0x4402('0x11')]);return _0x34b4a6(_0x251286[_0x4402('0xf')][_0x4402('0x11')]);}logger[_0x4402('0xf')](_0x4402('0xb'),_0x4f56aa,_0x251286[_0x4402('0xf')][_0x4402('0x11')]);return _0x4e1a7e(_0x251286[_0x4402('0xf')][_0x4402('0x11')]);}else{logger[_0x4402('0x12')](_0x4402('0xb'),_0x4f56aa,_0x4402('0xc'));_0x4e1a7e(_0x251286['result']['message']);}})[_0x4402('0x13')](function(_0x2a7afc){logger['error'](_0x4402('0xb'),_0x4f56aa,_0x2a7afc);_0x34b4a6(_0x2a7afc);});});}exports[_0x4402('0x14')]=function(_0x5cb0c5){var _0x38b459=this;return new Promise(function(_0x4e0340,_0x55cc8c){return db[_0x4402('0x15')][_0x4402('0x16')](_0x5cb0c5[_0x4402('0x17')],{'raw':_0x5cb0c5['options']?_0x5cb0c5[_0x4402('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x6f1f72){logger[_0x4402('0x12')](_0x4402('0x14'),_0x5cb0c5);logger[_0x4402('0xd')](_0x4402('0x14'),_0x5cb0c5,JSON[_0x4402('0xe')](_0x6f1f72));_0x4e0340(_0x6f1f72);})[_0x4402('0x13')](function(_0x6b1fc5){logger[_0x4402('0xf')]('CreateMailMessage',_0x6b1fc5[_0x4402('0x11')],_0x5cb0c5);_0x55cc8c(_0x38b459['error'](0x1f4,_0x6b1fc5[_0x4402('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 2be8bbd..51c7021 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 _0x1502=['emit','removeListener','length','./mailMessage.events','save','remove','update'];(function(_0x1b64dd,_0x2cf769){var _0xeb464c=function(_0x38272c){while(--_0x38272c){_0x1b64dd['push'](_0x1b64dd['shift']());}};_0xeb464c(++_0x2cf769);}(_0x1502,0x1c3));var _0x2150=function(_0x5a1ed5,_0x537d93){_0x5a1ed5=_0x5a1ed5-0x0;var _0x17b727=_0x1502[_0x5a1ed5];return _0x17b727;};'use strict';var MailMessageEvents=require(_0x2150('0x0'));var events=[_0x2150('0x1'),_0x2150('0x2'),_0x2150('0x3')];function createListener(_0x2af2e1,_0x208af9){return function(_0x5901c5){_0x208af9[_0x2150('0x4')](_0x2af2e1,_0x5901c5);};}function removeListener(_0x36d4c1,_0x42536d){return function(){MailMessageEvents[_0x2150('0x5')](_0x36d4c1,_0x42536d);};}exports['register']=function(_0x2e34e9){for(var _0x38dbdf=0x0,_0x4fd1ed=events[_0x2150('0x6')];_0x38dbdf<_0x4fd1ed;_0x38dbdf++){var _0x23985a=events[_0x38dbdf];var _0x467a0d=createListener('mailMessage:'+_0x23985a,_0x2e34e9);MailMessageEvents['on'](_0x23985a,_0x467a0d);}}; \ No newline at end of file +var _0x4ee1=['length','./mailMessage.events','save','emit','register'];(function(_0xe6ec8a,_0x44f4c7){var _0x255b1e=function(_0x4743f1){while(--_0x4743f1){_0xe6ec8a['push'](_0xe6ec8a['shift']());}};_0x255b1e(++_0x44f4c7);}(_0x4ee1,0x1a5));var _0x14ee=function(_0x35e12d,_0x34e988){_0x35e12d=_0x35e12d-0x0;var _0x47bd07=_0x4ee1[_0x35e12d];return _0x47bd07;};'use strict';var MailMessageEvents=require(_0x14ee('0x0'));var events=[_0x14ee('0x1'),'remove','update'];function createListener(_0x4b556a,_0x224785){return function(_0xf51f85){_0x224785[_0x14ee('0x2')](_0x4b556a,_0xf51f85);};}function removeListener(_0x329582,_0x31b2e5){return function(){MailMessageEvents['removeListener'](_0x329582,_0x31b2e5);};}exports[_0x14ee('0x3')]=function(_0x299402){for(var _0x58046b=0x0,_0x28cd44=events[_0x14ee('0x4')];_0x58046b<_0x28cd44;_0x58046b++){var _0x5b3cee=events[_0x58046b];var _0x53f5cf=createListener('mailMessage:'+_0x5b3cee,_0x299402);MailMessageEvents['on'](_0x5b3cee,_0x53f5cf);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 67abfe3..1c14126 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 _0x90aa=['getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','/:id/members'];(function(_0x2e5d19,_0x23cf52){var _0x27088c=function(_0x126ace){while(--_0x126ace){_0x2e5d19['push'](_0x2e5d19['shift']());}};_0x27088c(++_0x23cf52);}(_0x90aa,0x139));var _0xa90a=function(_0x5c8d28,_0xefa5f0){_0x5c8d28=_0x5c8d28-0x0;var _0xbd42e9=_0x90aa[_0x5c8d28];return _0xbd42e9;};'use strict';var multer=require(_0xa90a('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa90a('0x1'));var router=express[_0xa90a('0x2')]();var fs_extra=require(_0xa90a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa90a('0x4'));var config=require('../../config/environment');var controller=require('./mailQueue.controller');router[_0xa90a('0x5')]('/',auth[_0xa90a('0x6')](),controller[_0xa90a('0x7')]);router[_0xa90a('0x5')](_0xa90a('0x8'),auth[_0xa90a('0x6')](),controller[_0xa90a('0x9')]);router[_0xa90a('0x5')](_0xa90a('0xa'),auth[_0xa90a('0x6')](),controller['show']);router[_0xa90a('0x5')](_0xa90a('0xb'),auth[_0xa90a('0x6')](),controller[_0xa90a('0xc')]);router[_0xa90a('0x5')]('/:id/teams',auth[_0xa90a('0x6')](),controller[_0xa90a('0xd')]);router[_0xa90a('0x5')](_0xa90a('0xe'),auth[_0xa90a('0x6')](),controller[_0xa90a('0xf')]);router[_0xa90a('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa90a('0x10')](_0xa90a('0x11'),auth[_0xa90a('0x6')](),controller['addTeams']);router[_0xa90a('0x10')](_0xa90a('0xe'),auth[_0xa90a('0x6')](),controller[_0xa90a('0x12')]);router[_0xa90a('0x13')](_0xa90a('0xa'),auth[_0xa90a('0x6')](),controller[_0xa90a('0x14')]);router[_0xa90a('0x15')](_0xa90a('0xa'),auth[_0xa90a('0x6')](),controller[_0xa90a('0x16')]);router['delete'](_0xa90a('0x11'),auth[_0xa90a('0x6')](),controller[_0xa90a('0x17')]);router[_0xa90a('0x15')]('/:id/users',auth[_0xa90a('0x6')](),controller[_0xa90a('0x18')]);module['exports']=router; \ No newline at end of file +var _0xee50=['getMembers','/:id/teams','getTeams','/:id/users','post','create','addAgents','put','/:id','update','destroy','delete','removeTeams','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members'];(function(_0x4e3bc0,_0x349c7d){var _0x1c9e3a=function(_0x9596c0){while(--_0x9596c0){_0x4e3bc0['push'](_0x4e3bc0['shift']());}};_0x1c9e3a(++_0x349c7d);}(_0xee50,0xd1));var _0x0ee5=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xee50[_0x17b6e3];return _0x3906f3;};'use strict';var multer=require('multer');var util=require(_0x0ee5('0x0'));var path=require(_0x0ee5('0x1'));var timeout=require(_0x0ee5('0x2'));var express=require(_0x0ee5('0x3'));var router=express['Router']();var fs_extra=require(_0x0ee5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0ee5('0x5'));var config=require(_0x0ee5('0x6'));var controller=require(_0x0ee5('0x7'));router[_0x0ee5('0x8')]('/',auth[_0x0ee5('0x9')](),controller[_0x0ee5('0xa')]);router['get'](_0x0ee5('0xb'),auth[_0x0ee5('0x9')](),controller[_0x0ee5('0xc')]);router[_0x0ee5('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0ee5('0xd')]);router[_0x0ee5('0x8')](_0x0ee5('0xe'),auth['isAuthenticated'](),controller[_0x0ee5('0xf')]);router['get'](_0x0ee5('0x10'),auth[_0x0ee5('0x9')](),controller[_0x0ee5('0x11')]);router[_0x0ee5('0x8')](_0x0ee5('0x12'),auth[_0x0ee5('0x9')](),controller['getAgents']);router[_0x0ee5('0x13')]('/',auth[_0x0ee5('0x9')](),controller[_0x0ee5('0x14')]);router[_0x0ee5('0x13')](_0x0ee5('0x10'),auth['isAuthenticated'](),controller['addTeams']);router[_0x0ee5('0x13')](_0x0ee5('0x12'),auth[_0x0ee5('0x9')](),controller[_0x0ee5('0x15')]);router[_0x0ee5('0x16')](_0x0ee5('0x17'),auth[_0x0ee5('0x9')](),controller[_0x0ee5('0x18')]);router['delete'](_0x0ee5('0x17'),auth['isAuthenticated'](),controller[_0x0ee5('0x19')]);router[_0x0ee5('0x1a')]('/:id/teams',auth[_0x0ee5('0x9')](),controller[_0x0ee5('0x1b')]);router[_0x0ee5('0x1a')]('/:id/users',auth['isAuthenticated'](),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 6c12698..b626f3d 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 _0x2ff0=['ENUM','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0x1e85d5,_0x14081f){var _0x70301a=function(_0x588125){while(--_0x588125){_0x1e85d5['push'](_0x1e85d5['shift']());}};_0x70301a(++_0x14081f);}(_0x2ff0,0x1ea));var _0x02ff=function(_0x1519bf,_0x3ea7e4){_0x1519bf=_0x1519bf-0x0;var _0x4b9cc5=_0x2ff0[_0x1519bf];return _0x4b9cc5;};'use strict';var Sequelize=require(_0x02ff('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x02ff('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x02ff('0x2')](_0x02ff('0x3'),_0x02ff('0x4'),_0x02ff('0x5'))}}; \ No newline at end of file +var _0xe4e5=['STRING','name','roundrobin','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe4e5,0x67));var _0x5e4e=function(_0x282d8f,_0x576bb7){_0x282d8f=_0x282d8f-0x0;var _0x3a79cb=_0xe4e5[_0x282d8f];return _0x3a79cb;};'use strict';var Sequelize=require('sequelize');module[_0x5e4e('0x0')]={'name':{'type':Sequelize[_0x5e4e('0x1')],'unique':_0x5e4e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5e4e('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall',_0x5e4e('0x3'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 62c6c83..59ec1b6 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 _0xd810=['catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','get','UserMailQueue','nolimit','MailQueueId','findAll','User','findAndCountAll','UserId','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','Agents','online','interface','flatMap','transaction','each','emit','removeTeams','ids','select','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','compact','value','sequelize','isEmpty','removeAgents','forEach','addAgents','spread','userMailQueue:save','isArray','userMailQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','then','MailQueues','UserProfileResource','destroy','error','stack','name','send','index','MailQueue','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows'];(function(_0x179b9c,_0x2da181){var _0x460e79=function(_0x337b42){while(--_0x337b42){_0x179b9c['push'](_0x179b9c['shift']());}};_0x460e79(++_0x2da181);}(_0xd810,0x1dd));var _0x0d81=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0xd810[_0x1ae5ab];return _0x1ce001;};'use strict';var emlformat=require(_0x0d81('0x0'));var rimraf=require(_0x0d81('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0d81('0x2'));var rp=require(_0x0d81('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0d81('0x4'));var util=require('util');var path=require(_0x0d81('0x5'));var sox=require('sox');var csv=require(_0x0d81('0x6'));var ejs=require(_0x0d81('0x7'));var fs=require('fs');var fs_extra=require(_0x0d81('0x8'));var _=require(_0x0d81('0x9'));var squel=require(_0x0d81('0xa'));var crypto=require(_0x0d81('0xb'));var jsforce=require(_0x0d81('0xc'));var deskjs=require(_0x0d81('0xd'));var toCsv=require(_0x0d81('0x6'));var querystring=require('querystring');var Papa=require(_0x0d81('0xe'));var Redis=require('ioredis');var authService=require(_0x0d81('0xf'));var qs=require(_0x0d81('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d81('0x11'));var logger=require(_0x0d81('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x0d81('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0d81('0x14')]=_['defaults'](config[_0x0d81('0x14')],{'host':_0x0d81('0x15'),'port':0x18eb});var socket=require(_0x0d81('0x16'))(new Redis(config['redis']));require(_0x0d81('0x17'))[_0x0d81('0x18')](socket);function respondWithStatusCode(_0x328221,_0x5ed805){_0x5ed805=_0x5ed805||0xcc;return function(_0x3d0f74){if(_0x3d0f74){return _0x328221[_0x0d81('0x19')](_0x5ed805);}return _0x328221[_0x0d81('0x1a')](_0x5ed805)[_0x0d81('0x1b')]();};}function respondWithResult(_0x237e95,_0x27c279){_0x27c279=_0x27c279||0xc8;return function(_0x5dfe2c){if(_0x5dfe2c){return _0x237e95[_0x0d81('0x1a')](_0x27c279)[_0x0d81('0x1c')](_0x5dfe2c);}};}function respondWithFilteredResult(_0x15b797,_0x220bd4){return function(_0x58d9c7){if(_0x58d9c7){var _0x1b095d=typeof _0x220bd4['offset']===_0x0d81('0x1d')&&typeof _0x220bd4[_0x0d81('0x1e')]===_0x0d81('0x1d');var _0x37e74c=_0x58d9c7[_0x0d81('0x1f')];var _0x285868=_0x1b095d?0x0:_0x220bd4[_0x0d81('0x20')];var _0x29a9e2=_0x1b095d?_0x58d9c7[_0x0d81('0x1f')]:_0x220bd4[_0x0d81('0x20')]+_0x220bd4[_0x0d81('0x1e')];var _0x5ec324;if(_0x29a9e2>=_0x37e74c){_0x29a9e2=_0x37e74c;_0x5ec324=0xc8;}else{_0x5ec324=0xce;}_0x15b797[_0x0d81('0x1a')](_0x5ec324);return _0x15b797[_0x0d81('0x21')]('Content-Range',_0x285868+'-'+_0x29a9e2+'/'+_0x37e74c)['json'](_0x58d9c7);}return null;};}function patchUpdates(_0x1c2035){return function(_0x40d50f){try{jsonpatch[_0x0d81('0x22')](_0x40d50f,_0x1c2035,!![]);}catch(_0x96ffe8){return BPromise[_0x0d81('0x23')](_0x96ffe8);}return _0x40d50f[_0x0d81('0x24')]();};}function saveUpdates(_0x26536d,_0x3a3843){return function(_0x580970){if(_0x580970){return _0x580970['update'](_0x26536d)[_0x0d81('0x25')](function(_0x235353){return _0x235353;});}return null;};}function removeEntity(_0x47c326,_0x23cada){return function(_0x27861e){if(_0x27861e){return _0x27861e['destroy']()[_0x0d81('0x25')](function(){var _0x20bbeb=_0x27861e['get']({'plain':!![]});var _0x293d12=_0x0d81('0x26');return db[_0x0d81('0x27')][_0x0d81('0x28')]({'where':{'type':_0x293d12,'resourceId':_0x20bbeb['id']}})[_0x0d81('0x25')](function(){return _0x27861e;});})[_0x0d81('0x25')](function(){_0x47c326[_0x0d81('0x1a')](0xcc)[_0x0d81('0x1b')]();});}};}function handleEntityNotFound(_0x38b140,_0x238da2){return function(_0x4f3d6f){if(!_0x4f3d6f){_0x38b140[_0x0d81('0x19')](0x194);}return _0x4f3d6f;};}function handleError(_0x5a1466,_0x2a5a2d){_0x2a5a2d=_0x2a5a2d||0x1f4;return function(_0x5945b1){logger[_0x0d81('0x29')](_0x5945b1[_0x0d81('0x2a')]);if(_0x5945b1[_0x0d81('0x2b')]){delete _0x5945b1[_0x0d81('0x2b')];}_0x5a1466[_0x0d81('0x1a')](_0x2a5a2d)[_0x0d81('0x2c')](_0x5945b1);};}exports[_0x0d81('0x2d')]=function(_0x54363e,_0x32f707){var _0x16d795={},_0x2d02eb={},_0x3a8118={'count':0x0,'rows':[]};var _0x4428c2=_['map'](db[_0x0d81('0x2e')][_0x0d81('0x2f')],function(_0x4ae0a1){return{'name':_0x4ae0a1[_0x0d81('0x30')],'type':_0x4ae0a1[_0x0d81('0x31')]['key']};});_0x2d02eb[_0x0d81('0x32')]=_[_0x0d81('0x33')](_0x4428c2,_0x0d81('0x2b'));_0x2d02eb[_0x0d81('0x34')]=_[_0x0d81('0x35')](_0x54363e[_0x0d81('0x34')]);_0x2d02eb[_0x0d81('0x36')]=_[_0x0d81('0x37')](_0x2d02eb[_0x0d81('0x32')],_0x2d02eb[_0x0d81('0x34')]);_0x16d795[_0x0d81('0x38')]=_[_0x0d81('0x37')](_0x2d02eb['model'],qs[_0x0d81('0x39')](_0x54363e[_0x0d81('0x34')][_0x0d81('0x39')]));_0x16d795[_0x0d81('0x38')]=_0x16d795[_0x0d81('0x38')][_0x0d81('0x3a')]?_0x16d795[_0x0d81('0x38')]:_0x2d02eb[_0x0d81('0x32')];if(!_0x54363e['query'][_0x0d81('0x3b')]('nolimit')){_0x16d795[_0x0d81('0x1e')]=qs[_0x0d81('0x1e')](_0x54363e['query'][_0x0d81('0x1e')]);_0x16d795[_0x0d81('0x20')]=qs[_0x0d81('0x20')](_0x54363e[_0x0d81('0x34')][_0x0d81('0x20')]);}_0x16d795[_0x0d81('0x3c')]=qs[_0x0d81('0x3d')](_0x54363e[_0x0d81('0x34')][_0x0d81('0x3d')]);_0x16d795[_0x0d81('0x3e')]=qs[_0x0d81('0x36')](_[_0x0d81('0x3f')](_0x54363e['query'],_0x2d02eb['filters']),_0x4428c2);if(_0x54363e[_0x0d81('0x34')]['filter']){_0x16d795[_0x0d81('0x3e')]=_[_0x0d81('0x40')](_0x16d795['where'],{'$or':_[_0x0d81('0x33')](_0x4428c2,function(_0x12fbaa){if(_0x12fbaa[_0x0d81('0x31')]!==_0x0d81('0x41')){var _0x187098={};_0x187098[_0x12fbaa[_0x0d81('0x2b')]]={'$like':'%'+_0x54363e[_0x0d81('0x34')][_0x0d81('0x42')]+'%'};return _0x187098;}})});}_0x16d795=_['merge']({},_0x16d795,_0x54363e[_0x0d81('0x43')]);var _0x1ae092={'where':_0x16d795[_0x0d81('0x3e')]};return db[_0x0d81('0x2e')][_0x0d81('0x1f')](_0x1ae092)[_0x0d81('0x25')](function(_0x331b5c){_0x3a8118[_0x0d81('0x1f')]=_0x331b5c;if(_0x54363e[_0x0d81('0x34')][_0x0d81('0x44')]){_0x16d795[_0x0d81('0x45')]=[{'all':!![]}];}return db[_0x0d81('0x2e')]['findAll'](_0x16d795);})['then'](function(_0x38d0f0){_0x3a8118[_0x0d81('0x46')]=_0x38d0f0;return _0x3a8118;})[_0x0d81('0x25')](respondWithFilteredResult(_0x32f707,_0x16d795))[_0x0d81('0x47')](handleError(_0x32f707,null));};exports[_0x0d81('0x48')]=function(_0x19aba2,_0x11e3b8){var _0x57ed50={'raw':!![],'where':{'id':_0x19aba2[_0x0d81('0x49')]['id']}},_0x2da263={};_0x2da263[_0x0d81('0x32')]=_[_0x0d81('0x35')](db['MailQueue'][_0x0d81('0x2f')]);_0x2da263['query']=_[_0x0d81('0x35')](_0x19aba2['query']);_0x2da263[_0x0d81('0x36')]=_['intersection'](_0x2da263[_0x0d81('0x32')],_0x2da263[_0x0d81('0x34')]);_0x57ed50[_0x0d81('0x38')]=_['intersection'](_0x2da263['model'],qs[_0x0d81('0x39')](_0x19aba2[_0x0d81('0x34')][_0x0d81('0x39')]));_0x57ed50['attributes']=_0x57ed50[_0x0d81('0x38')]['length']?_0x57ed50[_0x0d81('0x38')]:_0x2da263[_0x0d81('0x32')];if(_0x19aba2['query'][_0x0d81('0x44')]){_0x57ed50['include']=[{'all':!![]}];}_0x57ed50=_[_0x0d81('0x40')]({},_0x57ed50,_0x19aba2['options']);return db[_0x0d81('0x2e')][_0x0d81('0x4a')](_0x57ed50)[_0x0d81('0x25')](handleEntityNotFound(_0x11e3b8,null))[_0x0d81('0x25')](respondWithResult(_0x11e3b8,null))[_0x0d81('0x47')](handleError(_0x11e3b8,null));};exports[_0x0d81('0x4b')]=function(_0x5c36c8,_0x477e49){return db[_0x0d81('0x2e')][_0x0d81('0x4b')](_0x5c36c8[_0x0d81('0x4c')],{})[_0x0d81('0x25')](function(_0xe598a9){var _0x2ac41a=_0x5c36c8[_0x0d81('0x4d')]['get']({'plain':!![]});if(!_0x2ac41a)throw new Error(_0x0d81('0x4e'));if(_0x2ac41a[_0x0d81('0x4f')]===_0x0d81('0x4d')){var _0x55822a=_0xe598a9['get']({'plain':!![]});var _0x388b59=_0x0d81('0x26');return db['UserProfileSection'][_0x0d81('0x4a')]({'where':{'name':_0x388b59,'userProfileId':_0x2ac41a[_0x0d81('0x50')]},'raw':!![]})[_0x0d81('0x25')](function(_0x393750){if(_0x393750&&_0x393750[_0x0d81('0x51')]===0x0){return db['UserProfileResource'][_0x0d81('0x4b')]({'name':_0x55822a[_0x0d81('0x2b')],'resourceId':_0x55822a['id'],'type':_0x393750['name'],'sectionId':_0x393750['id']},{})['then'](function(){return _0xe598a9;});}else{return _0xe598a9;}})[_0x0d81('0x47')](function(_0x184e58){logger[_0x0d81('0x29')](_0x0d81('0x52'),_0x184e58);throw _0x184e58;});}return _0xe598a9;})[_0x0d81('0x25')](respondWithResult(_0x477e49,0xc9))[_0x0d81('0x47')](handleError(_0x477e49,null));};exports[_0x0d81('0x53')]=function(_0x4aee18,_0x31653a){if(_0x4aee18[_0x0d81('0x4c')]['id']){delete _0x4aee18[_0x0d81('0x4c')]['id'];}return db[_0x0d81('0x2e')][_0x0d81('0x4a')]({'where':{'id':_0x4aee18[_0x0d81('0x49')]['id']}})['then'](handleEntityNotFound(_0x31653a,null))[_0x0d81('0x25')](saveUpdates(_0x4aee18[_0x0d81('0x4c')],null))[_0x0d81('0x25')](respondWithResult(_0x31653a,null))[_0x0d81('0x47')](handleError(_0x31653a,null));};exports[_0x0d81('0x28')]=function(_0x51162f,_0x44044a){return db[_0x0d81('0x2e')][_0x0d81('0x4a')]({'where':{'id':_0x51162f[_0x0d81('0x49')]['id']}})[_0x0d81('0x25')](handleEntityNotFound(_0x44044a,null))[_0x0d81('0x25')](removeEntity(_0x44044a,null))[_0x0d81('0x47')](handleError(_0x44044a,null));};exports[_0x0d81('0x54')]=function(_0x18dd3e,_0x4cf9e4){return db['MailQueue'][_0x0d81('0x54')]()['then'](respondWithResult(_0x4cf9e4,null))[_0x0d81('0x47')](handleError(_0x4cf9e4,null));};exports['getMembers']=function(_0x12906d,_0x2c86ef,_0x4f0689){var _0x5e9f46={'raw':!![],'where':{}},_0x34bc85={},_0x553734;return db[_0x0d81('0x2e')][_0x0d81('0x55')]({'where':{'id':_0x12906d[_0x0d81('0x49')]['id']}})[_0x0d81('0x25')](handleEntityNotFound(_0x2c86ef,null))['then'](function(_0x596746){if(_0x596746){_0x553734=_0x596746[_0x0d81('0x56')]({'plain':!![]});_0x34bc85['model']=_[_0x0d81('0x35')](db[_0x0d81('0x57')][_0x0d81('0x2f')]);_0x34bc85[_0x0d81('0x34')]=_[_0x0d81('0x35')](_0x12906d[_0x0d81('0x34')]);_0x34bc85['filters']=_[_0x0d81('0x37')](_0x34bc85[_0x0d81('0x32')],_0x34bc85[_0x0d81('0x34')]);_0x5e9f46[_0x0d81('0x38')]=_[_0x0d81('0x37')](_0x34bc85['model'],qs[_0x0d81('0x39')](_0x12906d[_0x0d81('0x34')][_0x0d81('0x39')]));_0x5e9f46[_0x0d81('0x38')]=_0x5e9f46[_0x0d81('0x38')]['length']?_0x5e9f46[_0x0d81('0x38')]:_0x34bc85[_0x0d81('0x32')];if(!_0x12906d[_0x0d81('0x34')]['hasOwnProperty'](_0x0d81('0x58'))){_0x5e9f46['limit']=qs[_0x0d81('0x1e')](_0x12906d[_0x0d81('0x34')][_0x0d81('0x1e')]);_0x5e9f46[_0x0d81('0x20')]=qs[_0x0d81('0x20')](_0x12906d[_0x0d81('0x34')]['offset']);}_0x5e9f46['order']=qs[_0x0d81('0x3d')](_0x12906d[_0x0d81('0x34')][_0x0d81('0x3d')]);_0x5e9f46[_0x0d81('0x3e')]=qs[_0x0d81('0x36')](_[_0x0d81('0x3f')](_0x12906d[_0x0d81('0x34')],_0x34bc85[_0x0d81('0x36')]));_0x5e9f46[_0x0d81('0x3e')][_0x0d81('0x59')]=_0x596746['id'];if(_0x12906d['query'][_0x0d81('0x42')]){_0x5e9f46[_0x0d81('0x3e')]=_[_0x0d81('0x40')](_0x5e9f46[_0x0d81('0x3e')],{'$or':_[_0x0d81('0x33')](_0x5e9f46[_0x0d81('0x38')],function(_0x2239b2){var _0x4ad412={};_0x4ad412[_0x2239b2]={'$like':'%'+_0x12906d[_0x0d81('0x34')]['filter']+'%'};return _0x4ad412;})});}_0x5e9f46=_[_0x0d81('0x40')]({},_0x5e9f46,_0x12906d[_0x0d81('0x43')]);return db[_0x0d81('0x57')][_0x0d81('0x5a')](_0x5e9f46);}})[_0x0d81('0x25')](function(_0x22579d){if(_0x22579d){return db[_0x0d81('0x5b')][_0x0d81('0x5c')]({'where':{'id':_[_0x0d81('0x33')](_0x22579d,_0x0d81('0x5d')),'role':'agent'},'attributes':['id',_0x0d81('0x2b'),_0x0d81('0x5e'),_0x0d81('0x5f'),_0x0d81('0x60')]});}})[_0x0d81('0x25')](function(_0xe1f5f8){if(_0xe1f5f8){return{'count':_0xe1f5f8[_0x0d81('0x1f')],'rows':_[_0x0d81('0x33')](_0xe1f5f8['rows'],function(_0x47cfbf){return{'membername':_0x47cfbf[_0x0d81('0x2b')],'UserId':_0x47cfbf['id'],'queue_name':_0x553734[_0x0d81('0x2b')],'MailQueueId':_0x553734['id'],'interface':util[_0x0d81('0x61')](_0x0d81('0x62'),_0x0d81('0x63'),_0x47cfbf[_0x0d81('0x2b')]),'penalty':0x0,'paused':_0x47cfbf['mailPause'],'createdAt':_0x47cfbf[_0x0d81('0x60')],'updatedAt':_0x47cfbf[_0x0d81('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2c86ef,_0x5e9f46))['catch'](handleError(_0x2c86ef,null));};exports[_0x0d81('0x64')]=function(_0x11b14b,_0x3a8134,_0x57b9ba){var _0x40faf3={};var _0x23e396={};var _0x1cdd71;var _0x1585ff;return db['MailQueue'][_0x0d81('0x55')]({'where':{'id':_0x11b14b['params']['id']}})[_0x0d81('0x25')](handleEntityNotFound(_0x3a8134,null))[_0x0d81('0x25')](function(_0x389225){if(_0x389225){_0x1cdd71=_0x389225;_0x23e396[_0x0d81('0x32')]=_[_0x0d81('0x35')](db[_0x0d81('0x65')]['rawAttributes']);_0x23e396[_0x0d81('0x34')]=_[_0x0d81('0x35')](_0x11b14b['query']);_0x23e396[_0x0d81('0x36')]=_[_0x0d81('0x37')](_0x23e396[_0x0d81('0x32')],_0x23e396[_0x0d81('0x34')]);_0x40faf3['attributes']=_['intersection'](_0x23e396['model'],qs[_0x0d81('0x39')](_0x11b14b[_0x0d81('0x34')][_0x0d81('0x39')]));_0x40faf3[_0x0d81('0x38')]=_0x40faf3[_0x0d81('0x38')][_0x0d81('0x3a')]?_0x40faf3['attributes']:_0x23e396[_0x0d81('0x32')];_0x40faf3[_0x0d81('0x3c')]=qs[_0x0d81('0x3d')](_0x11b14b[_0x0d81('0x34')][_0x0d81('0x3d')]);_0x40faf3[_0x0d81('0x3e')]=qs[_0x0d81('0x36')](_[_0x0d81('0x3f')](_0x11b14b[_0x0d81('0x34')],_0x23e396['filters']));if(_0x11b14b[_0x0d81('0x34')][_0x0d81('0x42')]){_0x40faf3[_0x0d81('0x3e')]=_[_0x0d81('0x40')](_0x40faf3[_0x0d81('0x3e')],{'$or':_[_0x0d81('0x33')](_0x40faf3['attributes'],function(_0xdef769){var _0x282ab4={};_0x282ab4[_0xdef769]={'$like':'%'+_0x11b14b[_0x0d81('0x34')]['filter']+'%'};return _0x282ab4;})});}_0x40faf3=_['merge']({},_0x40faf3,_0x11b14b['options']);return _0x1cdd71[_0x0d81('0x64')](_0x40faf3);}})['then'](function(_0x26c873){if(_0x26c873){_0x1585ff=_0x26c873[_0x0d81('0x3a')];if(!_0x11b14b[_0x0d81('0x34')][_0x0d81('0x3b')]('nolimit')){_0x40faf3[_0x0d81('0x1e')]=qs[_0x0d81('0x1e')](_0x11b14b[_0x0d81('0x34')][_0x0d81('0x1e')]);_0x40faf3[_0x0d81('0x20')]=qs['offset'](_0x11b14b['query']['offset']);}return _0x1cdd71[_0x0d81('0x64')](_0x40faf3);}})[_0x0d81('0x25')](function(_0x3ff60c){if(_0x3ff60c){return _0x3ff60c?{'count':_0x1585ff,'rows':_0x3ff60c}:null;}})[_0x0d81('0x25')](respondWithResult(_0x3a8134,null))[_0x0d81('0x47')](handleError(_0x3a8134,null));};exports[_0x0d81('0x66')]=function(_0x2e6820,_0x4bdd1c,_0x65af9d){var _0x15223a=_0x2e6820[_0x0d81('0x4c')]['ids'];return db[_0x0d81('0x65')][_0x0d81('0x5a')]({'where':{'id':_0x15223a},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0d81('0x67'),'attributes':['id',_0x0d81('0x2b'),_0x0d81('0x68'),'voicePause',_0x0d81('0x69')],'raw':!![]}]})[_0x0d81('0x25')](function(_0x5e62cb){if(_0x5e62cb){var _0x2d98b8=_[_0x0d81('0x6a')](_0x5e62cb,function(_0xba4ff0){var _0x3dfdc0=_0xba4ff0['get']({'plain':!![]});return _0x3dfdc0[_0x0d81('0x67')];});return db['MailQueue'][_0x0d81('0x4a')]({'where':{'id':_0x2e6820[_0x0d81('0x49')]['id']}})['then'](function(_0x14062b){return db['sequelize'][_0x0d81('0x6b')](function(_0x2a4f1c){return _0x14062b[_0x0d81('0x66')](_0x15223a,{'transaction':_0x2a4f1c})['then'](function(){return BPromise[_0x0d81('0x6c')](_0x2d98b8,function(_0x11b833){return db[_0x0d81('0x57')]['findOrCreate']({'where':{'UserId':_0x11b833['id'],'MailQueueId':_0x2e6820[_0x0d81('0x49')]['id']},'transaction':_0x2a4f1c});});})[_0x0d81('0x25')](function(){_0x2d98b8['forEach'](function(_0x1379f1){socket[_0x0d81('0x6d')]('userMailQueue:save',{'UserId':_0x1379f1['id'],'MailQueueId':_0x14062b['id']});});});});});}})['then'](respondWithStatusCode(_0x4bdd1c,null))[_0x0d81('0x47')](handleError(_0x4bdd1c,null));};exports[_0x0d81('0x6e')]=function(_0x57f9fb,_0x1263be,_0x24cdc2){return db['Team']['findAll']({'where':{'id':_0x57f9fb[_0x0d81('0x34')][_0x0d81('0x6f')]},'attributes':['id'],'include':[{'model':db[_0x0d81('0x5b')],'as':_0x0d81('0x67'),'attributes':['id'],'raw':!![]}]})[_0x0d81('0x25')](handleEntityNotFound(_0x1263be,null))[_0x0d81('0x25')](function(_0x53e340){var _0x2b2ca4=_[_0x0d81('0x33')](_0x53e340,'id');var _0x9f6ed2=[];var _0x2fad24=[];var _0x7cda27=squel[_0x0d81('0x70')]();_0x7cda27['field']('tq.TeamId')[_0x0d81('0x71')](_0x0d81('0x72'),'tq')['join'](_0x0d81('0x73'),'ut',_0x0d81('0x74'))[_0x0d81('0x3e')]('MailQueueId\x20=\x20?',_0x57f9fb[_0x0d81('0x49')]['id']);for(var _0x386268=0x0;_0x386268<_0x53e340['length'];_0x386268+=0x1){let _0x2b42fa=_0x53e340[_0x386268];for(var _0x3ba011=0x0;_0x3ba011<_0x2b42fa['Agents'][_0x0d81('0x3a')];_0x3ba011+=0x1){let _0x318bee=_0x2b42fa[_0x0d81('0x67')][_0x3ba011];var _0x208e3e=_0x7cda27[_0x0d81('0x75')]();_0x208e3e['where'](_0x0d81('0x76'),_0x318bee['id']);_0x2fad24[_0x0d81('0x77')](db['sequelize']['query'](_0x208e3e[_0x0d81('0x78')](),{'type':db['sequelize'][_0x0d81('0x79')][_0x0d81('0x7a')]})[_0x0d81('0x25')](function(_0x3373a4){if(_0x3373a4[_0x0d81('0x3a')]===0x1){return _0x318bee['id'];}else{var _0x2b5951=_['every'](_[_0x0d81('0x33')](_0x3373a4,_0x0d81('0x7b')),function(_0x451e1f){return _[_0x0d81('0x7c')](_0x2b2ca4,_0x451e1f);});if(_0x2b5951){return _0x318bee['id'];}}}));}}return BPromise['all'](_0x2fad24)['then'](function(_0x194f03){_0x9f6ed2=_(_0x9f6ed2)['union'](_0x194f03)[_0x0d81('0x7d')]()[_0x0d81('0x7e')]();return db[_0x0d81('0x2e')]['find']({'where':{'id':_0x57f9fb[_0x0d81('0x49')]['id']}})[_0x0d81('0x25')](function(_0x125205){return db[_0x0d81('0x7f')][_0x0d81('0x6b')](function(_0x555bcb){return _0x125205[_0x0d81('0x6e')](_0x57f9fb[_0x0d81('0x34')][_0x0d81('0x6f')],{'transaction':_0x555bcb})[_0x0d81('0x25')](function(){if(!_[_0x0d81('0x80')](_0x9f6ed2)){return _0x125205[_0x0d81('0x81')](_0x9f6ed2,{'transaction':_0x555bcb});}})[_0x0d81('0x25')](function(){_0x9f6ed2[_0x0d81('0x82')](function(_0x3fccb0){socket[_0x0d81('0x6d')]('userMailQueue:remove',{'UserId':_0x3fccb0,'MailQueueId':_0x125205['id']});});});});});});})[_0x0d81('0x25')](respondWithStatusCode(_0x1263be,null))[_0x0d81('0x47')](handleError(_0x1263be,null));};exports[_0x0d81('0x83')]=function(_0x251373,_0x11c0c1,_0x3dfcbc){return db[_0x0d81('0x2e')][_0x0d81('0x4a')]({'where':{'id':_0x251373['params']['id']}})[_0x0d81('0x25')](handleEntityNotFound(_0x11c0c1,null))[_0x0d81('0x25')](function(_0x55a7c2){if(_0x55a7c2){return _0x55a7c2[_0x0d81('0x83')](_0x251373[_0x0d81('0x4c')][_0x0d81('0x6f')],_['omit'](_0x251373[_0x0d81('0x4c')],[_0x0d81('0x6f'),'id'])||{})[_0x0d81('0x84')](function(_0x538297){for(var _0x3ce99d=0x0;_0x3ce99d<_0x251373[_0x0d81('0x4c')]['ids'][_0x0d81('0x3a')];_0x3ce99d+=0x1){socket[_0x0d81('0x6d')](_0x0d81('0x85'),{'UserId':Number(_0x251373[_0x0d81('0x4c')][_0x0d81('0x6f')][_0x3ce99d]),'MailQueueId':Number(_0x251373[_0x0d81('0x49')]['id'])});}return _0x538297;});}})['then'](respondWithResult(_0x11c0c1,null))[_0x0d81('0x47')](handleError(_0x11c0c1,null));};exports[_0x0d81('0x81')]=function(_0x4f10be,_0x2b2247,_0x5b7d43){return db['MailQueue'][_0x0d81('0x4a')]({'where':{'id':_0x4f10be['params']['id']}})[_0x0d81('0x25')](handleEntityNotFound(_0x2b2247,null))[_0x0d81('0x25')](function(_0x44f51a){if(_0x44f51a){return _0x44f51a['removeAgents'](_0x4f10be[_0x0d81('0x34')]['ids'])[_0x0d81('0x25')](function(){if(_[_0x0d81('0x86')](_0x4f10be[_0x0d81('0x34')][_0x0d81('0x6f')])){for(var _0x365599=0x0;_0x365599<_0x4f10be[_0x0d81('0x34')][_0x0d81('0x6f')][_0x0d81('0x3a')];_0x365599+=0x1){socket['emit'](_0x0d81('0x87'),{'UserId':Number(_0x4f10be['query'][_0x0d81('0x6f')][_0x365599]),'MailQueueId':Number(_0x4f10be[_0x0d81('0x49')]['id'])});}}else{socket[_0x0d81('0x6d')](_0x0d81('0x87'),{'UserId':Number(_0x4f10be[_0x0d81('0x34')]['ids']),'MailQueueId':Number(_0x4f10be[_0x0d81('0x49')]['id'])});}});}})[_0x0d81('0x25')](respondWithStatusCode(_0x2b2247,null))[_0x0d81('0x47')](handleError(_0x2b2247,null));};exports['getAgents']=function(_0x45460c,_0x5c1a7a,_0x4e6205){var _0x517df2={};var _0xe3c4f1={};var _0x2fa142;var _0x4a34e0;return db[_0x0d81('0x2e')][_0x0d81('0x55')]({'where':{'id':_0x45460c['params']['id']}})[_0x0d81('0x25')](handleEntityNotFound(_0x5c1a7a,null))[_0x0d81('0x25')](function(_0x37b87f){if(_0x37b87f){_0x2fa142=_0x37b87f;_0xe3c4f1[_0x0d81('0x32')]=_[_0x0d81('0x35')](db[_0x0d81('0x5b')][_0x0d81('0x2f')]);_0xe3c4f1[_0x0d81('0x34')]=_[_0x0d81('0x35')](_0x45460c['query']);_0xe3c4f1[_0x0d81('0x36')]=_['intersection'](_0xe3c4f1['model'],_0xe3c4f1['query']);_0x517df2['attributes']=_[_0x0d81('0x37')](_0xe3c4f1[_0x0d81('0x32')],qs[_0x0d81('0x39')](_0x45460c[_0x0d81('0x34')][_0x0d81('0x39')]));_0x517df2['attributes']=_0x517df2[_0x0d81('0x38')][_0x0d81('0x3a')]?_0x517df2[_0x0d81('0x38')]:_0xe3c4f1['model'];_0x517df2[_0x0d81('0x3c')]=qs[_0x0d81('0x3d')](_0x45460c[_0x0d81('0x34')][_0x0d81('0x3d')]);_0x517df2[_0x0d81('0x3e')]=qs['filters'](_['pick'](_0x45460c[_0x0d81('0x34')],_0xe3c4f1['filters']));if(_0x45460c[_0x0d81('0x34')][_0x0d81('0x42')]){_0x517df2[_0x0d81('0x3e')]=_['merge'](_0x517df2[_0x0d81('0x3e')],{'$or':_[_0x0d81('0x33')](_0x517df2[_0x0d81('0x38')],function(_0x1734a4){var _0x5d33df={};_0x5d33df[_0x1734a4]={'$like':'%'+_0x45460c['query'][_0x0d81('0x42')]+'%'};return _0x5d33df;})});}_0x517df2=_[_0x0d81('0x40')]({},_0x517df2,_0x45460c['options']);return _0x2fa142[_0x0d81('0x88')](_0x517df2);}})['then'](function(_0x2dd778){if(_0x2dd778){_0x4a34e0=_0x2dd778['length'];if(!_0x45460c[_0x0d81('0x34')][_0x0d81('0x3b')](_0x0d81('0x58'))){_0x517df2[_0x0d81('0x1e')]=qs['limit'](_0x45460c[_0x0d81('0x34')][_0x0d81('0x1e')]);_0x517df2[_0x0d81('0x20')]=qs['offset'](_0x45460c[_0x0d81('0x34')][_0x0d81('0x20')]);}return _0x2fa142[_0x0d81('0x88')](_0x517df2);}})['then'](function(_0x3d7619){if(_0x3d7619){return _0x3d7619?{'count':_0x4a34e0,'rows':_0x3d7619}:null;}})['then'](respondWithResult(_0x5c1a7a,null))[_0x0d81('0x47')](handleError(_0x5c1a7a,null));}; \ No newline at end of file +var _0xd1a8=['TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','getAgents','eml-format','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','include','options','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','findOne','MailQueueId','UserMailQueue','User','findAndCountAll','UserId','mailPause','createdAt','format','SIP','updatedAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','sequelize','findOrCreate','forEach','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT'];(function(_0x556634,_0x520958){var _0x4429fd=function(_0x1e7eb9){while(--_0x1e7eb9){_0x556634['push'](_0x556634['shift']());}};_0x4429fd(++_0x520958);}(_0xd1a8,0x9a));var _0x8d1a=function(_0x1a8329,_0x330805){_0x1a8329=_0x1a8329-0x0;var _0x41123e=_0xd1a8[_0x1a8329];return _0x41123e;};'use strict';var emlformat=require(_0x8d1a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8d1a('0x1'));var moment=require(_0x8d1a('0x2'));var BPromise=require(_0x8d1a('0x3'));var Mustache=require(_0x8d1a('0x4'));var util=require(_0x8d1a('0x5'));var path=require('path');var sox=require(_0x8d1a('0x6'));var csv=require(_0x8d1a('0x7'));var ejs=require(_0x8d1a('0x8'));var fs=require('fs');var fs_extra=require(_0x8d1a('0x9'));var _=require(_0x8d1a('0xa'));var squel=require(_0x8d1a('0xb'));var crypto=require(_0x8d1a('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8d1a('0x7'));var querystring=require(_0x8d1a('0xd'));var Papa=require('papaparse');var Redis=require(_0x8d1a('0xe'));var authService=require(_0x8d1a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8d1a('0x10'));var hardwareService=require(_0x8d1a('0x11'));var logger=require(_0x8d1a('0x12'))(_0x8d1a('0x13'));var utils=require(_0x8d1a('0x14'));var config=require(_0x8d1a('0x15'));var licenseUtil=require(_0x8d1a('0x16'));var db=require(_0x8d1a('0x17'))['db'];config[_0x8d1a('0x18')]=_[_0x8d1a('0x19')](config[_0x8d1a('0x18')],{'host':_0x8d1a('0x1a'),'port':0x18eb});var socket=require(_0x8d1a('0x1b'))(new Redis(config[_0x8d1a('0x18')]));require('./mailQueue.socket')[_0x8d1a('0x1c')](socket);function respondWithStatusCode(_0x3cfa54,_0x21994b){_0x21994b=_0x21994b||0xcc;return function(_0x1d7e27){if(_0x1d7e27){return _0x3cfa54[_0x8d1a('0x1d')](_0x21994b);}return _0x3cfa54[_0x8d1a('0x1e')](_0x21994b)[_0x8d1a('0x1f')]();};}function respondWithResult(_0x1cfaef,_0x1f936f){_0x1f936f=_0x1f936f||0xc8;return function(_0x2d8b1d){if(_0x2d8b1d){return _0x1cfaef[_0x8d1a('0x1e')](_0x1f936f)[_0x8d1a('0x20')](_0x2d8b1d);}};}function respondWithFilteredResult(_0x18ff65,_0x278fab){return function(_0x22439c){if(_0x22439c){var _0x341247=typeof _0x278fab[_0x8d1a('0x21')]===_0x8d1a('0x22')&&typeof _0x278fab[_0x8d1a('0x23')]==='undefined';var _0x58c5a4=_0x22439c[_0x8d1a('0x24')];var _0xd69103=_0x341247?0x0:_0x278fab['offset'];var _0x50d514=_0x341247?_0x22439c[_0x8d1a('0x24')]:_0x278fab[_0x8d1a('0x21')]+_0x278fab['limit'];var _0x52bd04;if(_0x50d514>=_0x58c5a4){_0x50d514=_0x58c5a4;_0x52bd04=0xc8;}else{_0x52bd04=0xce;}_0x18ff65[_0x8d1a('0x1e')](_0x52bd04);return _0x18ff65['set']('Content-Range',_0xd69103+'-'+_0x50d514+'/'+_0x58c5a4)['json'](_0x22439c);}return null;};}function patchUpdates(_0x44c0d2){return function(_0x4720c8){try{jsonpatch[_0x8d1a('0x25')](_0x4720c8,_0x44c0d2,!![]);}catch(_0x26f64d){return BPromise[_0x8d1a('0x26')](_0x26f64d);}return _0x4720c8['save']();};}function saveUpdates(_0x3dde95,_0x2ed74c){return function(_0x529fec){if(_0x529fec){return _0x529fec[_0x8d1a('0x27')](_0x3dde95)[_0x8d1a('0x28')](function(_0xb75ba7){return _0xb75ba7;});}return null;};}function removeEntity(_0x38c71b,_0x4a0bc1){return function(_0x53a1e8){if(_0x53a1e8){return _0x53a1e8[_0x8d1a('0x29')]()[_0x8d1a('0x28')](function(){var _0xc2517e=_0x53a1e8[_0x8d1a('0x2a')]({'plain':!![]});var _0x477a1c='MailQueues';return db[_0x8d1a('0x2b')][_0x8d1a('0x29')]({'where':{'type':_0x477a1c,'resourceId':_0xc2517e['id']}})['then'](function(){return _0x53a1e8;});})['then'](function(){_0x38c71b[_0x8d1a('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7aed38,_0x459c3d){return function(_0x7eade2){if(!_0x7eade2){_0x7aed38[_0x8d1a('0x1d')](0x194);}return _0x7eade2;};}function handleError(_0x24cc58,_0x35ed8c){_0x35ed8c=_0x35ed8c||0x1f4;return function(_0x42bb77){logger[_0x8d1a('0x2c')](_0x42bb77[_0x8d1a('0x2d')]);if(_0x42bb77[_0x8d1a('0x2e')]){delete _0x42bb77[_0x8d1a('0x2e')];}_0x24cc58['status'](_0x35ed8c)[_0x8d1a('0x2f')](_0x42bb77);};}exports[_0x8d1a('0x30')]=function(_0x662968,_0x2a2698){var _0x43bf4b={},_0x181130={},_0x2be00b={'count':0x0,'rows':[]};var _0x292b23=_[_0x8d1a('0x31')](db[_0x8d1a('0x32')][_0x8d1a('0x33')],function(_0x33b9a3){return{'name':_0x33b9a3[_0x8d1a('0x34')],'type':_0x33b9a3['type']['key']};});_0x181130['model']=_['map'](_0x292b23,'name');_0x181130[_0x8d1a('0x35')]=_[_0x8d1a('0x36')](_0x662968[_0x8d1a('0x35')]);_0x181130['filters']=_[_0x8d1a('0x37')](_0x181130[_0x8d1a('0x38')],_0x181130[_0x8d1a('0x35')]);_0x43bf4b[_0x8d1a('0x39')]=_[_0x8d1a('0x37')](_0x181130[_0x8d1a('0x38')],qs[_0x8d1a('0x3a')](_0x662968[_0x8d1a('0x35')][_0x8d1a('0x3a')]));_0x43bf4b[_0x8d1a('0x39')]=_0x43bf4b[_0x8d1a('0x39')][_0x8d1a('0x3b')]?_0x43bf4b[_0x8d1a('0x39')]:_0x181130[_0x8d1a('0x38')];if(!_0x662968[_0x8d1a('0x35')][_0x8d1a('0x3c')](_0x8d1a('0x3d'))){_0x43bf4b[_0x8d1a('0x23')]=qs[_0x8d1a('0x23')](_0x662968[_0x8d1a('0x35')][_0x8d1a('0x23')]);_0x43bf4b['offset']=qs[_0x8d1a('0x21')](_0x662968[_0x8d1a('0x35')]['offset']);}_0x43bf4b[_0x8d1a('0x3e')]=qs[_0x8d1a('0x3f')](_0x662968[_0x8d1a('0x35')][_0x8d1a('0x3f')]);_0x43bf4b['where']=qs[_0x8d1a('0x40')](_[_0x8d1a('0x41')](_0x662968['query'],_0x181130['filters']),_0x292b23);if(_0x662968['query'][_0x8d1a('0x42')]){_0x43bf4b[_0x8d1a('0x43')]=_[_0x8d1a('0x44')](_0x43bf4b[_0x8d1a('0x43')],{'$or':_[_0x8d1a('0x31')](_0x292b23,function(_0x58faa4){if(_0x58faa4[_0x8d1a('0x45')]!==_0x8d1a('0x46')){var _0x6e187e={};_0x6e187e[_0x58faa4[_0x8d1a('0x2e')]]={'$like':'%'+_0x662968[_0x8d1a('0x35')][_0x8d1a('0x42')]+'%'};return _0x6e187e;}})});}_0x43bf4b=_[_0x8d1a('0x44')]({},_0x43bf4b,_0x662968['options']);var _0x596f77={'where':_0x43bf4b['where']};return db[_0x8d1a('0x32')]['count'](_0x596f77)[_0x8d1a('0x28')](function(_0x326a43){_0x2be00b[_0x8d1a('0x24')]=_0x326a43;if(_0x662968[_0x8d1a('0x35')][_0x8d1a('0x47')]){_0x43bf4b['include']=[{'all':!![]}];}return db[_0x8d1a('0x32')][_0x8d1a('0x48')](_0x43bf4b);})['then'](function(_0x28b661){_0x2be00b[_0x8d1a('0x49')]=_0x28b661;return _0x2be00b;})[_0x8d1a('0x28')](respondWithFilteredResult(_0x2a2698,_0x43bf4b))[_0x8d1a('0x4a')](handleError(_0x2a2698,null));};exports[_0x8d1a('0x4b')]=function(_0xa77b07,_0x35ef72){var _0x440bbc={'raw':!![],'where':{'id':_0xa77b07['params']['id']}},_0x4335ef={};_0x4335ef[_0x8d1a('0x38')]=_[_0x8d1a('0x36')](db[_0x8d1a('0x32')][_0x8d1a('0x33')]);_0x4335ef['query']=_[_0x8d1a('0x36')](_0xa77b07[_0x8d1a('0x35')]);_0x4335ef[_0x8d1a('0x40')]=_[_0x8d1a('0x37')](_0x4335ef[_0x8d1a('0x38')],_0x4335ef[_0x8d1a('0x35')]);_0x440bbc['attributes']=_[_0x8d1a('0x37')](_0x4335ef[_0x8d1a('0x38')],qs[_0x8d1a('0x3a')](_0xa77b07[_0x8d1a('0x35')][_0x8d1a('0x3a')]));_0x440bbc[_0x8d1a('0x39')]=_0x440bbc[_0x8d1a('0x39')][_0x8d1a('0x3b')]?_0x440bbc[_0x8d1a('0x39')]:_0x4335ef[_0x8d1a('0x38')];if(_0xa77b07[_0x8d1a('0x35')]['includeAll']){_0x440bbc[_0x8d1a('0x4c')]=[{'all':!![]}];}_0x440bbc=_[_0x8d1a('0x44')]({},_0x440bbc,_0xa77b07[_0x8d1a('0x4d')]);return db['MailQueue'][_0x8d1a('0x4e')](_0x440bbc)[_0x8d1a('0x28')](handleEntityNotFound(_0x35ef72,null))[_0x8d1a('0x28')](respondWithResult(_0x35ef72,null))[_0x8d1a('0x4a')](handleError(_0x35ef72,null));};exports[_0x8d1a('0x4f')]=function(_0x4e39c6,_0x143ee8){return db[_0x8d1a('0x32')]['create'](_0x4e39c6['body'],{})['then'](function(_0x40e4f8){var _0x465825=_0x4e39c6[_0x8d1a('0x50')][_0x8d1a('0x2a')]({'plain':!![]});if(!_0x465825)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x465825[_0x8d1a('0x51')]===_0x8d1a('0x50')){var _0x45fb98=_0x40e4f8[_0x8d1a('0x2a')]({'plain':!![]});var _0x4d8880='MailQueues';return db[_0x8d1a('0x52')][_0x8d1a('0x4e')]({'where':{'name':_0x4d8880,'userProfileId':_0x465825[_0x8d1a('0x53')]},'raw':!![]})['then'](function(_0x228c37){if(_0x228c37&&_0x228c37[_0x8d1a('0x54')]===0x0){return db[_0x8d1a('0x2b')]['create']({'name':_0x45fb98[_0x8d1a('0x2e')],'resourceId':_0x45fb98['id'],'type':_0x228c37[_0x8d1a('0x2e')],'sectionId':_0x228c37['id']},{})[_0x8d1a('0x28')](function(){return _0x40e4f8;});}else{return _0x40e4f8;}})[_0x8d1a('0x4a')](function(_0x5712ed){logger['error'](_0x8d1a('0x55'),_0x5712ed);throw _0x5712ed;});}return _0x40e4f8;})[_0x8d1a('0x28')](respondWithResult(_0x143ee8,0xc9))[_0x8d1a('0x4a')](handleError(_0x143ee8,null));};exports['update']=function(_0x214908,_0xa5ebd3){if(_0x214908[_0x8d1a('0x56')]['id']){delete _0x214908[_0x8d1a('0x56')]['id'];}return db[_0x8d1a('0x32')][_0x8d1a('0x4e')]({'where':{'id':_0x214908[_0x8d1a('0x57')]['id']}})[_0x8d1a('0x28')](handleEntityNotFound(_0xa5ebd3,null))['then'](saveUpdates(_0x214908[_0x8d1a('0x56')],null))[_0x8d1a('0x28')](respondWithResult(_0xa5ebd3,null))['catch'](handleError(_0xa5ebd3,null));};exports[_0x8d1a('0x29')]=function(_0x5c3f02,_0x5db5f0){return db[_0x8d1a('0x32')][_0x8d1a('0x4e')]({'where':{'id':_0x5c3f02['params']['id']}})[_0x8d1a('0x28')](handleEntityNotFound(_0x5db5f0,null))['then'](removeEntity(_0x5db5f0,null))['catch'](handleError(_0x5db5f0,null));};exports['describe']=function(_0x3f255b,_0x2e027d){return db['MailQueue'][_0x8d1a('0x58')]()[_0x8d1a('0x28')](respondWithResult(_0x2e027d,null))[_0x8d1a('0x4a')](handleError(_0x2e027d,null));};exports['getMembers']=function(_0x2fd7de,_0x5c7a39,_0x530c37){var _0x133b52={'raw':!![],'where':{}},_0xfbf33f={},_0xa0a5e6;return db[_0x8d1a('0x32')][_0x8d1a('0x59')]({'where':{'id':_0x2fd7de[_0x8d1a('0x57')]['id']}})['then'](handleEntityNotFound(_0x5c7a39,null))[_0x8d1a('0x28')](function(_0x122b9b){if(_0x122b9b){_0xa0a5e6=_0x122b9b['get']({'plain':!![]});_0xfbf33f[_0x8d1a('0x38')]=_[_0x8d1a('0x36')](db['UserMailQueue']['rawAttributes']);_0xfbf33f['query']=_['keys'](_0x2fd7de[_0x8d1a('0x35')]);_0xfbf33f[_0x8d1a('0x40')]=_['intersection'](_0xfbf33f['model'],_0xfbf33f[_0x8d1a('0x35')]);_0x133b52[_0x8d1a('0x39')]=_[_0x8d1a('0x37')](_0xfbf33f[_0x8d1a('0x38')],qs[_0x8d1a('0x3a')](_0x2fd7de[_0x8d1a('0x35')][_0x8d1a('0x3a')]));_0x133b52['attributes']=_0x133b52['attributes']['length']?_0x133b52[_0x8d1a('0x39')]:_0xfbf33f[_0x8d1a('0x38')];if(!_0x2fd7de[_0x8d1a('0x35')][_0x8d1a('0x3c')](_0x8d1a('0x3d'))){_0x133b52[_0x8d1a('0x23')]=qs[_0x8d1a('0x23')](_0x2fd7de[_0x8d1a('0x35')]['limit']);_0x133b52[_0x8d1a('0x21')]=qs[_0x8d1a('0x21')](_0x2fd7de['query']['offset']);}_0x133b52[_0x8d1a('0x3e')]=qs['sort'](_0x2fd7de[_0x8d1a('0x35')][_0x8d1a('0x3f')]);_0x133b52[_0x8d1a('0x43')]=qs[_0x8d1a('0x40')](_['pick'](_0x2fd7de[_0x8d1a('0x35')],_0xfbf33f[_0x8d1a('0x40')]));_0x133b52[_0x8d1a('0x43')][_0x8d1a('0x5a')]=_0x122b9b['id'];if(_0x2fd7de[_0x8d1a('0x35')]['filter']){_0x133b52[_0x8d1a('0x43')]=_['merge'](_0x133b52[_0x8d1a('0x43')],{'$or':_['map'](_0x133b52['attributes'],function(_0x13654c){var _0x1e2595={};_0x1e2595[_0x13654c]={'$like':'%'+_0x2fd7de[_0x8d1a('0x35')][_0x8d1a('0x42')]+'%'};return _0x1e2595;})});}_0x133b52=_['merge']({},_0x133b52,_0x2fd7de['options']);return db[_0x8d1a('0x5b')]['findAll'](_0x133b52);}})[_0x8d1a('0x28')](function(_0x4ca649){if(_0x4ca649){return db[_0x8d1a('0x5c')][_0x8d1a('0x5d')]({'where':{'id':_[_0x8d1a('0x31')](_0x4ca649,_0x8d1a('0x5e')),'role':'agent'},'attributes':['id',_0x8d1a('0x2e'),_0x8d1a('0x5f'),'updatedAt',_0x8d1a('0x60')]});}})[_0x8d1a('0x28')](function(_0xf002af){if(_0xf002af){return{'count':_0xf002af[_0x8d1a('0x24')],'rows':_['map'](_0xf002af[_0x8d1a('0x49')],function(_0x40e076){return{'membername':_0x40e076[_0x8d1a('0x2e')],'UserId':_0x40e076['id'],'queue_name':_0xa0a5e6[_0x8d1a('0x2e')],'MailQueueId':_0xa0a5e6['id'],'interface':util[_0x8d1a('0x61')]('%s/%s',_0x8d1a('0x62'),_0x40e076['name']),'penalty':0x0,'paused':_0x40e076[_0x8d1a('0x5f')],'createdAt':_0x40e076['createdAt'],'updatedAt':_0x40e076[_0x8d1a('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8d1a('0x28')](respondWithFilteredResult(_0x5c7a39,_0x133b52))[_0x8d1a('0x4a')](handleError(_0x5c7a39,null));};exports[_0x8d1a('0x64')]=function(_0x85a330,_0x1f656d,_0x43088f){var _0xc07600={};var _0x26e1cc={};var _0xa1a20d;var _0x24ebd8;return db[_0x8d1a('0x32')][_0x8d1a('0x59')]({'where':{'id':_0x85a330[_0x8d1a('0x57')]['id']}})[_0x8d1a('0x28')](handleEntityNotFound(_0x1f656d,null))['then'](function(_0x231d87){if(_0x231d87){_0xa1a20d=_0x231d87;_0x26e1cc['model']=_[_0x8d1a('0x36')](db[_0x8d1a('0x65')][_0x8d1a('0x33')]);_0x26e1cc[_0x8d1a('0x35')]=_['keys'](_0x85a330[_0x8d1a('0x35')]);_0x26e1cc[_0x8d1a('0x40')]=_[_0x8d1a('0x37')](_0x26e1cc[_0x8d1a('0x38')],_0x26e1cc[_0x8d1a('0x35')]);_0xc07600[_0x8d1a('0x39')]=_[_0x8d1a('0x37')](_0x26e1cc[_0x8d1a('0x38')],qs[_0x8d1a('0x3a')](_0x85a330['query'][_0x8d1a('0x3a')]));_0xc07600['attributes']=_0xc07600[_0x8d1a('0x39')][_0x8d1a('0x3b')]?_0xc07600[_0x8d1a('0x39')]:_0x26e1cc[_0x8d1a('0x38')];_0xc07600[_0x8d1a('0x3e')]=qs['sort'](_0x85a330[_0x8d1a('0x35')][_0x8d1a('0x3f')]);_0xc07600[_0x8d1a('0x43')]=qs['filters'](_['pick'](_0x85a330[_0x8d1a('0x35')],_0x26e1cc[_0x8d1a('0x40')]));if(_0x85a330['query'][_0x8d1a('0x42')]){_0xc07600['where']=_['merge'](_0xc07600[_0x8d1a('0x43')],{'$or':_[_0x8d1a('0x31')](_0xc07600['attributes'],function(_0x6adbe7){var _0x498e2c={};_0x498e2c[_0x6adbe7]={'$like':'%'+_0x85a330[_0x8d1a('0x35')][_0x8d1a('0x42')]+'%'};return _0x498e2c;})});}_0xc07600=_[_0x8d1a('0x44')]({},_0xc07600,_0x85a330[_0x8d1a('0x4d')]);return _0xa1a20d['getTeams'](_0xc07600);}})[_0x8d1a('0x28')](function(_0x3657f7){if(_0x3657f7){_0x24ebd8=_0x3657f7[_0x8d1a('0x3b')];if(!_0x85a330[_0x8d1a('0x35')][_0x8d1a('0x3c')]('nolimit')){_0xc07600[_0x8d1a('0x23')]=qs[_0x8d1a('0x23')](_0x85a330['query']['limit']);_0xc07600[_0x8d1a('0x21')]=qs[_0x8d1a('0x21')](_0x85a330[_0x8d1a('0x35')][_0x8d1a('0x21')]);}return _0xa1a20d[_0x8d1a('0x64')](_0xc07600);}})[_0x8d1a('0x28')](function(_0x230ebb){if(_0x230ebb){return _0x230ebb?{'count':_0x24ebd8,'rows':_0x230ebb}:null;}})[_0x8d1a('0x28')](respondWithResult(_0x1f656d,null))['catch'](handleError(_0x1f656d,null));};exports[_0x8d1a('0x66')]=function(_0x21e394,_0x349a84,_0x4f8915){var _0x2c3fc1=_0x21e394[_0x8d1a('0x56')][_0x8d1a('0x67')];return db[_0x8d1a('0x65')]['findAll']({'where':{'id':_0x2c3fc1},'attributes':['id'],'include':[{'model':db[_0x8d1a('0x5c')],'as':_0x8d1a('0x68'),'attributes':['id',_0x8d1a('0x2e'),_0x8d1a('0x69'),_0x8d1a('0x6a'),_0x8d1a('0x6b')],'raw':!![]}]})[_0x8d1a('0x28')](function(_0x44ce25){if(_0x44ce25){var _0x2cb69b=_['flatMap'](_0x44ce25,function(_0x4d7129){var _0x19ca1c=_0x4d7129[_0x8d1a('0x2a')]({'plain':!![]});return _0x19ca1c[_0x8d1a('0x68')];});return db['MailQueue'][_0x8d1a('0x4e')]({'where':{'id':_0x21e394['params']['id']}})[_0x8d1a('0x28')](function(_0x4a3b06){return db[_0x8d1a('0x6c')]['transaction'](function(_0x4579da){return _0x4a3b06[_0x8d1a('0x66')](_0x2c3fc1,{'transaction':_0x4579da})[_0x8d1a('0x28')](function(){return BPromise['each'](_0x2cb69b,function(_0x286a44){return db[_0x8d1a('0x5b')][_0x8d1a('0x6d')]({'where':{'UserId':_0x286a44['id'],'MailQueueId':_0x21e394[_0x8d1a('0x57')]['id']},'transaction':_0x4579da});});})[_0x8d1a('0x28')](function(){_0x2cb69b[_0x8d1a('0x6e')](function(_0x3ae587){socket['emit'](_0x8d1a('0x6f'),{'UserId':_0x3ae587['id'],'MailQueueId':_0x4a3b06['id']});});});});});}})['then'](respondWithStatusCode(_0x349a84,null))[_0x8d1a('0x4a')](handleError(_0x349a84,null));};exports[_0x8d1a('0x70')]=function(_0x17d55b,_0x4d1364,_0x218589){return db['Team'][_0x8d1a('0x48')]({'where':{'id':_0x17d55b[_0x8d1a('0x35')]['ids']},'attributes':['id'],'include':[{'model':db[_0x8d1a('0x5c')],'as':_0x8d1a('0x68'),'attributes':['id'],'raw':!![]}]})[_0x8d1a('0x28')](handleEntityNotFound(_0x4d1364,null))[_0x8d1a('0x28')](function(_0x4740f0){var _0xadc9e3=_[_0x8d1a('0x31')](_0x4740f0,'id');var _0x1d1eba=[];var _0x23f1cd=[];var _0x50cb9b=squel[_0x8d1a('0x71')]();_0x50cb9b[_0x8d1a('0x72')](_0x8d1a('0x73'))[_0x8d1a('0x74')](_0x8d1a('0x75'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('MailQueueId\x20=\x20?',_0x17d55b['params']['id']);for(var _0x38f448=0x0;_0x38f448<_0x4740f0[_0x8d1a('0x3b')];_0x38f448+=0x1){let _0x136e09=_0x4740f0[_0x38f448];for(var _0x4bebb0=0x0;_0x4bebb0<_0x136e09['Agents']['length'];_0x4bebb0+=0x1){let _0x389cd7=_0x136e09[_0x8d1a('0x68')][_0x4bebb0];var _0x3ea5c2=_0x50cb9b[_0x8d1a('0x76')]();_0x3ea5c2[_0x8d1a('0x43')](_0x8d1a('0x77'),_0x389cd7['id']);_0x23f1cd[_0x8d1a('0x78')](db[_0x8d1a('0x6c')][_0x8d1a('0x35')](_0x3ea5c2[_0x8d1a('0x79')](),{'type':db['sequelize'][_0x8d1a('0x7a')][_0x8d1a('0x7b')]})[_0x8d1a('0x28')](function(_0x260f69){if(_0x260f69[_0x8d1a('0x3b')]===0x1){return _0x389cd7['id'];}else{var _0x1db625=_['every'](_[_0x8d1a('0x31')](_0x260f69,_0x8d1a('0x7c')),function(_0x5dd1f4){return _[_0x8d1a('0x7d')](_0xadc9e3,_0x5dd1f4);});if(_0x1db625){return _0x389cd7['id'];}}}));}}return BPromise[_0x8d1a('0x7e')](_0x23f1cd)[_0x8d1a('0x28')](function(_0xbf2b9b){_0x1d1eba=_(_0x1d1eba)[_0x8d1a('0x7f')](_0xbf2b9b)[_0x8d1a('0x80')]()[_0x8d1a('0x81')]();return db[_0x8d1a('0x32')][_0x8d1a('0x4e')]({'where':{'id':_0x17d55b[_0x8d1a('0x57')]['id']}})[_0x8d1a('0x28')](function(_0x332673){return db[_0x8d1a('0x6c')][_0x8d1a('0x82')](function(_0x1cf00){return _0x332673[_0x8d1a('0x70')](_0x17d55b[_0x8d1a('0x35')]['ids'],{'transaction':_0x1cf00})[_0x8d1a('0x28')](function(){if(!_[_0x8d1a('0x83')](_0x1d1eba)){return _0x332673[_0x8d1a('0x84')](_0x1d1eba,{'transaction':_0x1cf00});}})['then'](function(){_0x1d1eba[_0x8d1a('0x6e')](function(_0x2cb964){socket[_0x8d1a('0x85')](_0x8d1a('0x86'),{'UserId':_0x2cb964,'MailQueueId':_0x332673['id']});});});});});});})[_0x8d1a('0x28')](respondWithStatusCode(_0x4d1364,null))[_0x8d1a('0x4a')](handleError(_0x4d1364,null));};exports[_0x8d1a('0x87')]=function(_0x935eb4,_0x317021,_0x4ba4f9){return db[_0x8d1a('0x32')][_0x8d1a('0x4e')]({'where':{'id':_0x935eb4['params']['id']}})['then'](handleEntityNotFound(_0x317021,null))['then'](function(_0x4095e6){if(_0x4095e6){return _0x4095e6[_0x8d1a('0x87')](_0x935eb4[_0x8d1a('0x56')][_0x8d1a('0x67')],_[_0x8d1a('0x88')](_0x935eb4[_0x8d1a('0x56')],[_0x8d1a('0x67'),'id'])||{})[_0x8d1a('0x89')](function(_0x3de58e){for(var _0x4515c9=0x0;_0x4515c9<_0x935eb4[_0x8d1a('0x56')][_0x8d1a('0x67')][_0x8d1a('0x3b')];_0x4515c9+=0x1){socket[_0x8d1a('0x85')]('userMailQueue:save',{'UserId':Number(_0x935eb4[_0x8d1a('0x56')][_0x8d1a('0x67')][_0x4515c9]),'MailQueueId':Number(_0x935eb4['params']['id'])});}return _0x3de58e;});}})['then'](respondWithResult(_0x317021,null))['catch'](handleError(_0x317021,null));};exports['removeAgents']=function(_0x268170,_0x2e347a,_0x5017ea){return db[_0x8d1a('0x32')][_0x8d1a('0x4e')]({'where':{'id':_0x268170['params']['id']}})['then'](handleEntityNotFound(_0x2e347a,null))['then'](function(_0x2b5a1f){if(_0x2b5a1f){return _0x2b5a1f[_0x8d1a('0x84')](_0x268170['query'][_0x8d1a('0x67')])['then'](function(){if(_['isArray'](_0x268170['query'][_0x8d1a('0x67')])){for(var _0x57dfe9=0x0;_0x57dfe9<_0x268170[_0x8d1a('0x35')][_0x8d1a('0x67')][_0x8d1a('0x3b')];_0x57dfe9+=0x1){socket['emit'](_0x8d1a('0x86'),{'UserId':Number(_0x268170[_0x8d1a('0x35')]['ids'][_0x57dfe9]),'MailQueueId':Number(_0x268170['params']['id'])});}}else{socket[_0x8d1a('0x85')](_0x8d1a('0x86'),{'UserId':Number(_0x268170[_0x8d1a('0x35')][_0x8d1a('0x67')]),'MailQueueId':Number(_0x268170['params']['id'])});}});}})[_0x8d1a('0x28')](respondWithStatusCode(_0x2e347a,null))[_0x8d1a('0x4a')](handleError(_0x2e347a,null));};exports[_0x8d1a('0x8a')]=function(_0x1be5a0,_0x5c53fe,_0x281304){var _0x42ad25={};var _0x1320e6={};var _0x35da48;var _0x467f7e;return db[_0x8d1a('0x32')][_0x8d1a('0x59')]({'where':{'id':_0x1be5a0['params']['id']}})[_0x8d1a('0x28')](handleEntityNotFound(_0x5c53fe,null))[_0x8d1a('0x28')](function(_0x338b6a){if(_0x338b6a){_0x35da48=_0x338b6a;_0x1320e6[_0x8d1a('0x38')]=_[_0x8d1a('0x36')](db[_0x8d1a('0x5c')][_0x8d1a('0x33')]);_0x1320e6['query']=_[_0x8d1a('0x36')](_0x1be5a0[_0x8d1a('0x35')]);_0x1320e6['filters']=_[_0x8d1a('0x37')](_0x1320e6['model'],_0x1320e6[_0x8d1a('0x35')]);_0x42ad25[_0x8d1a('0x39')]=_[_0x8d1a('0x37')](_0x1320e6[_0x8d1a('0x38')],qs[_0x8d1a('0x3a')](_0x1be5a0[_0x8d1a('0x35')]['fields']));_0x42ad25[_0x8d1a('0x39')]=_0x42ad25['attributes']['length']?_0x42ad25[_0x8d1a('0x39')]:_0x1320e6[_0x8d1a('0x38')];_0x42ad25[_0x8d1a('0x3e')]=qs[_0x8d1a('0x3f')](_0x1be5a0[_0x8d1a('0x35')][_0x8d1a('0x3f')]);_0x42ad25[_0x8d1a('0x43')]=qs['filters'](_[_0x8d1a('0x41')](_0x1be5a0[_0x8d1a('0x35')],_0x1320e6[_0x8d1a('0x40')]));if(_0x1be5a0[_0x8d1a('0x35')]['filter']){_0x42ad25[_0x8d1a('0x43')]=_[_0x8d1a('0x44')](_0x42ad25['where'],{'$or':_[_0x8d1a('0x31')](_0x42ad25[_0x8d1a('0x39')],function(_0x23c235){var _0x3212e1={};_0x3212e1[_0x23c235]={'$like':'%'+_0x1be5a0[_0x8d1a('0x35')][_0x8d1a('0x42')]+'%'};return _0x3212e1;})});}_0x42ad25=_[_0x8d1a('0x44')]({},_0x42ad25,_0x1be5a0[_0x8d1a('0x4d')]);return _0x35da48[_0x8d1a('0x8a')](_0x42ad25);}})[_0x8d1a('0x28')](function(_0x2ea1ac){if(_0x2ea1ac){_0x467f7e=_0x2ea1ac[_0x8d1a('0x3b')];if(!_0x1be5a0[_0x8d1a('0x35')]['hasOwnProperty']('nolimit')){_0x42ad25['limit']=qs[_0x8d1a('0x23')](_0x1be5a0[_0x8d1a('0x35')][_0x8d1a('0x23')]);_0x42ad25['offset']=qs[_0x8d1a('0x21')](_0x1be5a0[_0x8d1a('0x35')][_0x8d1a('0x21')]);}return _0x35da48[_0x8d1a('0x8a')](_0x42ad25);}})[_0x8d1a('0x28')](function(_0x2665a2){if(_0x2665a2){return _0x2665a2?{'count':_0x467f7e,'rows':_0x2665a2}:null;}})['then'](respondWithResult(_0x5c53fe,null))[_0x8d1a('0x4a')](handleError(_0x5c53fe,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 386dc93..3abbfcf 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 _0x86e7=['MailQueue','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x86e7,0x10f));var _0x786e=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x86e7[_0x209941];return _0x1e8729;};'use strict';var EventEmitter=require(_0x786e('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x786e('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x786e('0x2'),'afterUpdate':_0x786e('0x3'),'afterDestroy':_0x786e('0x4')};function emitEvent(_0x5759df){return function(_0x4c35e3,_0x15fd1c,_0x344fa8){MailQueueEvents[_0x786e('0x5')](_0x5759df+':'+_0x4c35e3['id'],_0x4c35e3);MailQueueEvents['emit'](_0x5759df,_0x4c35e3);_0x344fa8(null);};}for(var e in events){if(events[_0x786e('0x6')](e)){var event=events[e];MailQueue[_0x786e('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x9a79=['remove','emit','hook','events','MailQueue','setMaxListeners','save','update'];(function(_0x5a02d8,_0x404eb1){var _0x103ee7=function(_0x3b8c7a){while(--_0x3b8c7a){_0x5a02d8['push'](_0x5a02d8['shift']());}};_0x103ee7(++_0x404eb1);}(_0x9a79,0xc3));var _0x99a7=function(_0x4bc6bc,_0x4519bd){_0x4bc6bc=_0x4bc6bc-0x0;var _0x54bf9e=_0x9a79[_0x4bc6bc];return _0x54bf9e;};'use strict';var EventEmitter=require(_0x99a7('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x99a7('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x99a7('0x2')](0x0);var events={'afterCreate':_0x99a7('0x3'),'afterUpdate':_0x99a7('0x4'),'afterDestroy':_0x99a7('0x5')};function emitEvent(_0x4e827d){return function(_0x26b36e,_0x34e303,_0x34d382){MailQueueEvents[_0x99a7('0x6')](_0x4e827d+':'+_0x26b36e['id'],_0x26b36e);MailQueueEvents['emit'](_0x4e827d,_0x26b36e);_0x34d382(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x99a7('0x7')](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 24b74ca..d954bc9 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 _0x959a=['define','MailQueue','mail_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes'];(function(_0x40ced5,_0x2b8fe9){var _0x51024e=function(_0xa97f42){while(--_0xa97f42){_0x40ced5['push'](_0x40ced5['shift']());}};_0x51024e(++_0x2b8fe9);}(_0x959a,0x13b));var _0xa959=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x959a[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xa959('0x0'));var util=require(_0xa959('0x1'));var logger=require('../../config/logger')(_0xa959('0x2'));var moment=require(_0xa959('0x3'));var BPromise=require(_0xa959('0x4'));var rp=require(_0xa959('0x5'));var fs=require('fs');var path=require(_0xa959('0x6'));var rimraf=require(_0xa959('0x7'));var config=require(_0xa959('0x8'));var attributes=require(_0xa959('0x9'));module['exports']=function(_0x4485d4,_0x23c21d){return _0x4485d4[_0xa959('0xa')](_0xa959('0xb'),attributes,{'tableName':_0xa959('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d33=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailQueue.attributes','exports','MailQueue','mail_queues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d33,0x1e0));var _0x31d3=function(_0x2c7e4e,_0x24848a){_0x2c7e4e=_0x2c7e4e-0x0;var _0x3a0270=_0x1d33[_0x2c7e4e];return _0x3a0270;};'use strict';var _=require(_0x31d3('0x0'));var util=require('util');var logger=require(_0x31d3('0x1'))(_0x31d3('0x2'));var moment=require(_0x31d3('0x3'));var BPromise=require(_0x31d3('0x4'));var rp=require(_0x31d3('0x5'));var fs=require('fs');var path=require(_0x31d3('0x6'));var rimraf=require('rimraf');var config=require(_0x31d3('0x7'));var attributes=require(_0x31d3('0x8'));module[_0x31d3('0x9')]=function(_0x36a82a,_0x168a5a){return _0x36a82a['define'](_0x31d3('0xa'),attributes,{'tableName':_0x31d3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 1343844..65f5a2f 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 _0xd5fe=['MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetMailQueue','findAll','raw','options','where','limit','map','include','model','attributes','catch','ShowMailQueue','find','lodash','util','bluebird','ioredis','../../config/logger','rpc','client','http','redis','defaults','localhost','register','request','then','MailQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1c95ab,_0x40197d){var _0x2fc8db=function(_0x220b17){while(--_0x220b17){_0x1c95ab['push'](_0x1c95ab['shift']());}};_0x2fc8db(++_0x40197d);}(_0xd5fe,0x1ab));var _0xed5f=function(_0x2e6dbf,_0x57dd06){_0x2e6dbf=_0x2e6dbf-0x0;var _0x2680e5=_0xd5fe[_0x2e6dbf];return _0x2680e5;};'use strict';var _=require(_0xed5f('0x0'));var util=require(_0xed5f('0x1'));var moment=require('moment');var BPromise=require(_0xed5f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed5f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xed5f('0x4'))(_0xed5f('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xed5f('0x6')][_0xed5f('0x7')]({'port':0x232a});config[_0xed5f('0x8')]=_[_0xed5f('0x9')](config[_0xed5f('0x8')],{'host':_0xed5f('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xed5f('0x8')]));require('./mailQueue.socket')[_0xed5f('0xb')](socket);function respondWithRpcPromise(_0x580e2e,_0x1910ee,_0x34806f){return new BPromise(function(_0x4ae013,_0x2b5155){return client[_0xed5f('0xc')](_0x580e2e,_0x34806f)[_0xed5f('0xd')](function(_0x17ed13){logger['info'](_0xed5f('0xe'),_0x1910ee,_0xed5f('0xf'));logger[_0xed5f('0x10')](_0xed5f('0x11'),_0x1910ee,'request\x20sent',JSON[_0xed5f('0x12')](_0x17ed13));if(_0x17ed13[_0xed5f('0x13')]){if(_0x17ed13[_0xed5f('0x13')][_0xed5f('0x14')]===0x1f4){logger[_0xed5f('0x13')](_0xed5f('0xe'),_0x1910ee,_0x17ed13[_0xed5f('0x13')][_0xed5f('0x15')]);return _0x2b5155(_0x17ed13[_0xed5f('0x13')][_0xed5f('0x15')]);}logger[_0xed5f('0x13')](_0xed5f('0xe'),_0x1910ee,_0x17ed13[_0xed5f('0x13')]['message']);return _0x4ae013(_0x17ed13[_0xed5f('0x13')][_0xed5f('0x15')]);}else{logger[_0xed5f('0x16')]('MailQueue,\x20%s,\x20%s',_0x1910ee,_0xed5f('0xf'));_0x4ae013(_0x17ed13[_0xed5f('0x17')][_0xed5f('0x15')]);}})['catch'](function(_0x464fb4){logger[_0xed5f('0x13')](_0xed5f('0xe'),_0x1910ee,_0x464fb4);_0x2b5155(_0x464fb4);});});}exports[_0xed5f('0x18')]=function(_0x2750fc){var _0xd3ca42=this;return new Promise(function(_0x56657c,_0x304bd9){return db['MailQueue'][_0xed5f('0x19')]({'raw':_0x2750fc['options']?_0x2750fc['options'][_0xed5f('0x1a')]===undefined?!![]:![]:!![],'where':_0x2750fc[_0xed5f('0x1b')]?_0x2750fc['options'][_0xed5f('0x1c')]||null:null,'attributes':_0x2750fc['options']?_0x2750fc['options']['attributes']||null:null,'limit':_0x2750fc[_0xed5f('0x1b')]?_0x2750fc[_0xed5f('0x1b')][_0xed5f('0x1d')]||null:null,'include':_0x2750fc[_0xed5f('0x1b')]?_0x2750fc[_0xed5f('0x1b')]['include']?_[_0xed5f('0x1e')](_0x2750fc[_0xed5f('0x1b')][_0xed5f('0x1f')],function(_0x151037){return{'model':db[_0x151037[_0xed5f('0x20')]],'as':_0x151037['as'],'attributes':_0x151037[_0xed5f('0x21')],'include':_0x151037[_0xed5f('0x1f')]?_[_0xed5f('0x1e')](_0x151037[_0xed5f('0x1f')],function(_0x2980f6){return{'model':db[_0x2980f6[_0xed5f('0x20')]],'as':_0x2980f6['as'],'attributes':_0x2980f6['attributes'],'include':_0x2980f6[_0xed5f('0x1f')]?_[_0xed5f('0x1e')](_0x2980f6[_0xed5f('0x1f')],function(_0x3c7906){return{'model':db[_0x3c7906['model']],'as':_0x3c7906['as'],'attributes':_0x3c7906['attributes']};}):[]};}):[]};}):[]:[]})[_0xed5f('0xd')](function(_0x2883db){logger[_0xed5f('0x16')](_0xed5f('0x18'),_0x2750fc);logger[_0xed5f('0x10')](_0xed5f('0x18'),_0x2750fc,JSON[_0xed5f('0x12')](_0x2883db));_0x56657c(_0x2883db);})[_0xed5f('0x22')](function(_0x218831){logger[_0xed5f('0x13')](_0xed5f('0x18'),_0x218831['message'],_0x2750fc);_0x304bd9(_0xd3ca42[_0xed5f('0x13')](0x1f4,_0x218831[_0xed5f('0x15')]));});});};exports[_0xed5f('0x23')]=function(_0x466b25){var _0x5d2227=this;return new Promise(function(_0x43e845,_0x28c1d8){return db['MailQueue'][_0xed5f('0x24')]({'raw':_0x466b25['options']?_0x466b25[_0xed5f('0x1b')][_0xed5f('0x1a')]===undefined?!![]:![]:!![],'where':_0x466b25[_0xed5f('0x1b')]?_0x466b25['options']['where']||null:null,'attributes':_0x466b25[_0xed5f('0x1b')]?_0x466b25['options'][_0xed5f('0x21')]||null:null,'include':_0x466b25[_0xed5f('0x1b')]?_0x466b25[_0xed5f('0x1b')]['include']?_[_0xed5f('0x1e')](_0x466b25[_0xed5f('0x1b')]['include'],function(_0x1101fe){return{'model':db[_0x1101fe['model']],'as':_0x1101fe['as'],'attributes':_0x1101fe[_0xed5f('0x21')],'include':_0x1101fe[_0xed5f('0x1f')]?_['map'](_0x1101fe['include'],function(_0x52d6f9){return{'model':db[_0x52d6f9[_0xed5f('0x20')]],'as':_0x52d6f9['as'],'attributes':_0x52d6f9[_0xed5f('0x21')],'include':_0x52d6f9['include']?_[_0xed5f('0x1e')](_0x52d6f9[_0xed5f('0x1f')],function(_0x52be9c){return{'model':db[_0x52be9c[_0xed5f('0x20')]],'as':_0x52be9c['as'],'attributes':_0x52be9c['attributes']};}):[]};}):[]};}):[]:[]})[_0xed5f('0xd')](function(_0x3b8d10){logger[_0xed5f('0x16')](_0xed5f('0x23'),_0x466b25);logger[_0xed5f('0x10')](_0xed5f('0x23'),_0x466b25,JSON[_0xed5f('0x12')](_0x3b8d10));_0x43e845(_0x3b8d10);})[_0xed5f('0x22')](function(_0x2f97b9){logger['error']('ShowMailQueue',_0x2f97b9[_0xed5f('0x15')],_0x466b25);_0x28c1d8(_0x5d2227[_0xed5f('0x13')](0x1f4,_0x2f97b9[_0xed5f('0x15')]));});});}; \ No newline at end of file +var _0x4c58=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetMailQueue','findAll','options','raw','attributes','limit','include','map','model','debug','ShowMailQueue','MailQueue','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x26ef4a,_0x40e33c){var _0x24f5c5=function(_0x419314){while(--_0x419314){_0x26ef4a['push'](_0x26ef4a['shift']());}};_0x24f5c5(++_0x40e33c);}(_0x4c58,0xed));var _0x84c5=function(_0x5ee348,_0x28c870){_0x5ee348=_0x5ee348-0x0;var _0x1e755c=_0x4c58[_0x5ee348];return _0x1e755c;};'use strict';var _=require(_0x84c5('0x0'));var util=require('util');var moment=require(_0x84c5('0x1'));var BPromise=require(_0x84c5('0x2'));var rs=require(_0x84c5('0x3'));var fs=require('fs');var Redis=require(_0x84c5('0x4'));var db=require(_0x84c5('0x5'))['db'];var utils=require(_0x84c5('0x6'));var logger=require(_0x84c5('0x7'))('rpc');var config=require(_0x84c5('0x8'));var jayson=require(_0x84c5('0x9'));var client=jayson[_0x84c5('0xa')][_0x84c5('0xb')]({'port':0x232a});config[_0x84c5('0xc')]=_[_0x84c5('0xd')](config[_0x84c5('0xc')],{'host':_0x84c5('0xe'),'port':0x18eb});var socket=require(_0x84c5('0xf'))(new Redis(config[_0x84c5('0xc')]));require(_0x84c5('0x10'))[_0x84c5('0x11')](socket);function respondWithRpcPromise(_0x6acec6,_0x26ba48,_0x2ff065){return new BPromise(function(_0x4ef3f9,_0x248f82){return client[_0x84c5('0x12')](_0x6acec6,_0x2ff065)[_0x84c5('0x13')](function(_0x49d147){logger[_0x84c5('0x14')](_0x84c5('0x15'),_0x26ba48,_0x84c5('0x16'));logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0x26ba48,_0x84c5('0x16'),JSON[_0x84c5('0x17')](_0x49d147));if(_0x49d147['error']){if(_0x49d147[_0x84c5('0x18')][_0x84c5('0x19')]===0x1f4){logger[_0x84c5('0x18')](_0x84c5('0x15'),_0x26ba48,_0x49d147[_0x84c5('0x18')][_0x84c5('0x1a')]);return _0x248f82(_0x49d147[_0x84c5('0x18')]['message']);}logger[_0x84c5('0x18')](_0x84c5('0x15'),_0x26ba48,_0x49d147[_0x84c5('0x18')][_0x84c5('0x1a')]);return _0x4ef3f9(_0x49d147['error']['message']);}else{logger[_0x84c5('0x14')](_0x84c5('0x15'),_0x26ba48,'request\x20sent');_0x4ef3f9(_0x49d147['result'][_0x84c5('0x1a')]);}})[_0x84c5('0x1b')](function(_0x46f19e){logger[_0x84c5('0x18')](_0x84c5('0x15'),_0x26ba48,_0x46f19e);_0x248f82(_0x46f19e);});});}exports[_0x84c5('0x1c')]=function(_0x25412d){var _0x1ce70b=this;return new Promise(function(_0x38c45e,_0x386f46){return db['MailQueue'][_0x84c5('0x1d')]({'raw':_0x25412d[_0x84c5('0x1e')]?_0x25412d['options'][_0x84c5('0x1f')]===undefined?!![]:![]:!![],'where':_0x25412d['options']?_0x25412d[_0x84c5('0x1e')]['where']||null:null,'attributes':_0x25412d[_0x84c5('0x1e')]?_0x25412d[_0x84c5('0x1e')][_0x84c5('0x20')]||null:null,'limit':_0x25412d[_0x84c5('0x1e')]?_0x25412d[_0x84c5('0x1e')][_0x84c5('0x21')]||null:null,'include':_0x25412d[_0x84c5('0x1e')]?_0x25412d[_0x84c5('0x1e')][_0x84c5('0x22')]?_[_0x84c5('0x23')](_0x25412d[_0x84c5('0x1e')][_0x84c5('0x22')],function(_0x272598){return{'model':db[_0x272598[_0x84c5('0x24')]],'as':_0x272598['as'],'attributes':_0x272598[_0x84c5('0x20')],'include':_0x272598[_0x84c5('0x22')]?_[_0x84c5('0x23')](_0x272598['include'],function(_0x4deb9c){return{'model':db[_0x4deb9c[_0x84c5('0x24')]],'as':_0x4deb9c['as'],'attributes':_0x4deb9c[_0x84c5('0x20')],'include':_0x4deb9c[_0x84c5('0x22')]?_['map'](_0x4deb9c['include'],function(_0x540b36){return{'model':db[_0x540b36['model']],'as':_0x540b36['as'],'attributes':_0x540b36[_0x84c5('0x20')]};}):[]};}):[]};}):[]:[]})[_0x84c5('0x13')](function(_0xb9252b){logger[_0x84c5('0x14')](_0x84c5('0x1c'),_0x25412d);logger[_0x84c5('0x25')](_0x84c5('0x1c'),_0x25412d,JSON[_0x84c5('0x17')](_0xb9252b));_0x38c45e(_0xb9252b);})[_0x84c5('0x1b')](function(_0x29c804){logger['error'](_0x84c5('0x1c'),_0x29c804['message'],_0x25412d);_0x386f46(_0x1ce70b[_0x84c5('0x18')](0x1f4,_0x29c804[_0x84c5('0x1a')]));});});};exports[_0x84c5('0x26')]=function(_0x275d4a){var _0x1083f0=this;return new Promise(function(_0x2ecd6f,_0x2aba8d){return db[_0x84c5('0x27')]['find']({'raw':_0x275d4a['options']?_0x275d4a[_0x84c5('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x275d4a[_0x84c5('0x1e')]?_0x275d4a[_0x84c5('0x1e')][_0x84c5('0x28')]||null:null,'attributes':_0x275d4a[_0x84c5('0x1e')]?_0x275d4a[_0x84c5('0x1e')][_0x84c5('0x20')]||null:null,'include':_0x275d4a[_0x84c5('0x1e')]?_0x275d4a['options']['include']?_[_0x84c5('0x23')](_0x275d4a[_0x84c5('0x1e')][_0x84c5('0x22')],function(_0x209103){return{'model':db[_0x209103[_0x84c5('0x24')]],'as':_0x209103['as'],'attributes':_0x209103['attributes'],'include':_0x209103[_0x84c5('0x22')]?_[_0x84c5('0x23')](_0x209103[_0x84c5('0x22')],function(_0x4ad588){return{'model':db[_0x4ad588[_0x84c5('0x24')]],'as':_0x4ad588['as'],'attributes':_0x4ad588[_0x84c5('0x20')],'include':_0x4ad588[_0x84c5('0x22')]?_['map'](_0x4ad588['include'],function(_0x158607){return{'model':db[_0x158607[_0x84c5('0x24')]],'as':_0x158607['as'],'attributes':_0x158607[_0x84c5('0x20')]};}):[]};}):[]};}):[]:[]})[_0x84c5('0x13')](function(_0x3b51ba){logger[_0x84c5('0x14')]('ShowMailQueue',_0x275d4a);logger[_0x84c5('0x25')](_0x84c5('0x26'),_0x275d4a,JSON[_0x84c5('0x17')](_0x3b51ba));_0x2ecd6f(_0x3b51ba);})[_0x84c5('0x1b')](function(_0x5662d0){logger[_0x84c5('0x18')](_0x84c5('0x26'),_0x5662d0[_0x84c5('0x1a')],_0x275d4a);_0x2aba8d(_0x1083f0[_0x84c5('0x18')](0x1f4,_0x5662d0[_0x84c5('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 7f587fb..e67a7dd 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(_0x2c98db,_0x19a9e6){var _0x1b2142=function(_0xbea8d7){while(--_0xbea8d7){_0x2c98db['push'](_0x2c98db['shift']());}};_0x1b2142(++_0x19a9e6);}(_0xa810,0x101));var _0x0a81=function(_0x460358,_0x45d45e){_0x460358=_0x460358-0x0;var _0x2e6a60=_0xa810[_0x460358];return _0x2e6a60;};'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 _0x5e6c=['save','remove','update','register','length','mailQueue:','./mailQueue.events'];(function(_0x3a58a1,_0x26ceac){var _0x530a3e=function(_0x4a5549){while(--_0x4a5549){_0x3a58a1['push'](_0x3a58a1['shift']());}};_0x530a3e(++_0x26ceac);}(_0x5e6c,0x1b8));var _0xc5e6=function(_0x388927,_0x442897){_0x388927=_0x388927-0x0;var _0x4dc39d=_0x5e6c[_0x388927];return _0x4dc39d;};'use strict';var MailQueueEvents=require(_0xc5e6('0x0'));var events=[_0xc5e6('0x1'),_0xc5e6('0x2'),_0xc5e6('0x3')];function createListener(_0x10f3e4,_0xf5d4b3){return function(_0xdb4fae){_0xf5d4b3['emit'](_0x10f3e4,_0xdb4fae);};}function removeListener(_0x3aaf95,_0x491e50){return function(){MailQueueEvents['removeListener'](_0x3aaf95,_0x491e50);};}exports[_0xc5e6('0x4')]=function(_0x590a6a){for(var _0x57fb60=0x0,_0x165948=events[_0xc5e6('0x5')];_0x57fb60<_0x165948;_0x57fb60++){var _0x24f428=events[_0x57fb60];var _0x2986ab=createListener(_0xc5e6('0x6')+_0x24f428,_0x590a6a);MailQueueEvents['on'](_0x24f428,_0x2986ab);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index b71f740..7561f16 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 _0x869d=['post','create','put','/:id','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../config/environment','./mailQueueReport.controller','isAuthenticated','get','/describe','describe','show'];(function(_0x107ce5,_0x3978f2){var _0x15bf71=function(_0x3ea69e){while(--_0x3ea69e){_0x107ce5['push'](_0x107ce5['shift']());}};_0x15bf71(++_0x3978f2);}(_0x869d,0x6c));var _0xd869=function(_0x4de1a4,_0x3d21d7){_0x4de1a4=_0x4de1a4-0x0;var _0x2be3fb=_0x869d[_0x4de1a4];return _0x2be3fb;};'use strict';var multer=require(_0xd869('0x0'));var util=require(_0xd869('0x1'));var path=require(_0xd869('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd869('0x3')]();var fs_extra=require(_0xd869('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd869('0x5'));var controller=require(_0xd869('0x6'));router['get']('/',auth[_0xd869('0x7')](),controller['index']);router[_0xd869('0x8')](_0xd869('0x9'),auth[_0xd869('0x7')](),controller[_0xd869('0xa')]);router[_0xd869('0x8')]('/:id',auth[_0xd869('0x7')](),controller[_0xd869('0xb')]);router[_0xd869('0xc')]('/',auth[_0xd869('0x7')](),controller[_0xd869('0xd')]);router[_0xd869('0xe')](_0xd869('0xf'),auth[_0xd869('0x7')](),controller[_0xd869('0x10')]);router[_0xd869('0x11')]('/:id',auth[_0xd869('0x7')](),controller[_0xd869('0x12')]);module[_0xd869('0x13')]=router; \ No newline at end of file +var _0x3fca=['./mailQueueReport.controller','index','get','/describe','isAuthenticated','describe','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xbc2974,_0xec3342){var _0x3a5b4f=function(_0x5ec5b5){while(--_0x5ec5b5){_0xbc2974['push'](_0xbc2974['shift']());}};_0x3a5b4f(++_0xec3342);}(_0x3fca,0x199));var _0xa3fc=function(_0x3fbdae,_0x573656){_0x3fbdae=_0x3fbdae-0x0;var _0x588031=_0x3fca[_0x3fbdae];return _0x588031;};'use strict';var multer=require(_0xa3fc('0x0'));var util=require(_0xa3fc('0x1'));var path=require(_0xa3fc('0x2'));var timeout=require(_0xa3fc('0x3'));var express=require(_0xa3fc('0x4'));var router=express[_0xa3fc('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa3fc('0x6'));var interaction=require(_0xa3fc('0x7'));var config=require(_0xa3fc('0x8'));var controller=require(_0xa3fc('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xa3fc('0xa')]);router[_0xa3fc('0xb')](_0xa3fc('0xc'),auth[_0xa3fc('0xd')](),controller[_0xa3fc('0xe')]);router[_0xa3fc('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa3fc('0xf')]('/',auth[_0xa3fc('0xd')](),controller[_0xa3fc('0x10')]);router[_0xa3fc('0x11')](_0xa3fc('0x12'),auth[_0xa3fc('0xd')](),controller[_0xa3fc('0x13')]);router['delete'](_0xa3fc('0x12'),auth[_0xa3fc('0xd')](),controller[_0xa3fc('0x14')]);module[_0xa3fc('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 712f667..5301096 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 _0x7e88=['STRING','DATE','moment'];(function(_0x5a65c4,_0xecc8ed){var _0x2d5a3c=function(_0x33416d){while(--_0x33416d){_0x5a65c4['push'](_0x5a65c4['shift']());}};_0x2d5a3c(++_0xecc8ed);}(_0x7e88,0x149));var _0x87e8=function(_0x5908f7,_0x1c8a3b){_0x5908f7=_0x5908f7-0x0;var _0x453fc8=_0x7e88[_0x5908f7];return _0x453fc8;};'use strict';var moment=require(_0x87e8('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x87e8('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x87e8('0x1')]},'joinAt':{'type':Sequelize[_0x87e8('0x2')]},'leaveAt':{'type':Sequelize[_0x87e8('0x2')]},'acceptAt':{'type':Sequelize[_0x87e8('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x87e8('0x1')]}}; \ No newline at end of file +var _0x310b=['STRING','DATE','moment','exports'];(function(_0x3961f7,_0x549dd4){var _0x2bdea0=function(_0x547b8f){while(--_0x547b8f){_0x3961f7['push'](_0x3961f7['shift']());}};_0x2bdea0(++_0x549dd4);}(_0x310b,0x19e));var _0xb310=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x310b[_0xa8883];return _0x479426;};'use strict';var moment=require(_0xb310('0x0'));var Sequelize=require('sequelize');module[_0xb310('0x1')]={'uniqueid':{'type':Sequelize[_0xb310('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xb310('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xb310('0x3')]},'reason':{'type':Sequelize[_0xb310('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index f9a432d..bd822cb 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 _0x8f4c=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','filter','merge','options','MailQueueReport','includeAll','include','findAll','catch','show','params','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x1cdabe,_0x286194){var _0x3dcc9c=function(_0x5aa9c7){while(--_0x5aa9c7){_0x1cdabe['push'](_0x1cdabe['shift']());}};_0x3dcc9c(++_0x286194);}(_0x8f4c,0x113));var _0xc8f4=function(_0x5aa18b,_0x20743b){_0x5aa18b=_0x5aa18b-0x0;var _0x157187=_0x8f4c[_0x5aa18b];return _0x157187;};'use strict';var emlformat=require(_0xc8f4('0x0'));var rimraf=require(_0xc8f4('0x1'));var zipdir=require(_0xc8f4('0x2'));var jsonpatch=require(_0xc8f4('0x3'));var rp=require(_0xc8f4('0x4'));var moment=require(_0xc8f4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc8f4('0x6'));var util=require(_0xc8f4('0x7'));var path=require(_0xc8f4('0x8'));var sox=require('sox');var csv=require(_0xc8f4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc8f4('0xa'));var crypto=require('crypto');var jsforce=require(_0xc8f4('0xb'));var deskjs=require(_0xc8f4('0xc'));var toCsv=require(_0xc8f4('0x9'));var querystring=require(_0xc8f4('0xd'));var Papa=require(_0xc8f4('0xe'));var Redis=require('ioredis');var authService=require(_0xc8f4('0xf'));var qs=require(_0xc8f4('0x10'));var as=require(_0xc8f4('0x11'));var hardwareService=require(_0xc8f4('0x12'));var logger=require('../../config/logger')(_0xc8f4('0x13'));var utils=require('../../config/utils');var config=require(_0xc8f4('0x14'));var licenseUtil=require(_0xc8f4('0x15'));var db=require(_0xc8f4('0x16'))['db'];function respondWithStatusCode(_0x729f8f,_0x39b785){_0x39b785=_0x39b785||0xcc;return function(_0x4e31cf){if(_0x4e31cf){return _0x729f8f[_0xc8f4('0x17')](_0x39b785);}return _0x729f8f[_0xc8f4('0x18')](_0x39b785)[_0xc8f4('0x19')]();};}function respondWithResult(_0x14bc11,_0x1dcee5){_0x1dcee5=_0x1dcee5||0xc8;return function(_0x411c5c){if(_0x411c5c){return _0x14bc11['status'](_0x1dcee5)[_0xc8f4('0x1a')](_0x411c5c);}};}function respondWithFilteredResult(_0x2c7bc1,_0x1518a6){return function(_0x46ac15){if(_0x46ac15){var _0x22c08a=typeof _0x1518a6['offset']===_0xc8f4('0x1b')&&typeof _0x1518a6['limit']==='undefined';var _0x14bc02=_0x46ac15[_0xc8f4('0x1c')];var _0x108076=_0x22c08a?0x0:_0x1518a6[_0xc8f4('0x1d')];var _0x4763c1=_0x22c08a?_0x46ac15[_0xc8f4('0x1c')]:_0x1518a6[_0xc8f4('0x1d')]+_0x1518a6[_0xc8f4('0x1e')];var _0x1982bb;if(_0x4763c1>=_0x14bc02){_0x4763c1=_0x14bc02;_0x1982bb=0xc8;}else{_0x1982bb=0xce;}_0x2c7bc1[_0xc8f4('0x18')](_0x1982bb);return _0x2c7bc1[_0xc8f4('0x1f')](_0xc8f4('0x20'),_0x108076+'-'+_0x4763c1+'/'+_0x14bc02)[_0xc8f4('0x1a')](_0x46ac15);}return null;};}function patchUpdates(_0x5f3264){return function(_0x378f56){try{jsonpatch[_0xc8f4('0x21')](_0x378f56,_0x5f3264,!![]);}catch(_0x29e52d){return BPromise[_0xc8f4('0x22')](_0x29e52d);}return _0x378f56[_0xc8f4('0x23')]();};}function saveUpdates(_0x3b42ee,_0xaeee7d){return function(_0x43eb57){if(_0x43eb57){return _0x43eb57['update'](_0x3b42ee)[_0xc8f4('0x24')](function(_0x205c41){return _0x205c41;});}return null;};}function removeEntity(_0x3195ff,_0x1d159e){return function(_0x5d54a9){if(_0x5d54a9){return _0x5d54a9[_0xc8f4('0x25')]()['then'](function(){_0x3195ff[_0xc8f4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x177a44,_0x3dd717){return function(_0x5c94c6){if(!_0x5c94c6){_0x177a44[_0xc8f4('0x17')](0x194);}return _0x5c94c6;};}function handleError(_0x21062f,_0x11f766){_0x11f766=_0x11f766||0x1f4;return function(_0x2fa052){logger['error'](_0x2fa052[_0xc8f4('0x26')]);if(_0x2fa052[_0xc8f4('0x27')]){delete _0x2fa052['name'];}_0x21062f[_0xc8f4('0x18')](_0x11f766)[_0xc8f4('0x28')](_0x2fa052);};}exports[_0xc8f4('0x29')]=function(_0x1b70bc,_0x24bef0){var _0x385e41={},_0x4a25da={},_0x45f972={'count':0x0,'rows':[]};var _0x24bb78=_[_0xc8f4('0x2a')](db['MailQueueReport'][_0xc8f4('0x2b')],function(_0x3a4b1b){return{'name':_0x3a4b1b['fieldName'],'type':_0x3a4b1b['type']['key']};});_0x4a25da[_0xc8f4('0x2c')]=_[_0xc8f4('0x2a')](_0x24bb78,_0xc8f4('0x27'));_0x4a25da[_0xc8f4('0x2d')]=_[_0xc8f4('0x2e')](_0x1b70bc[_0xc8f4('0x2d')]);_0x4a25da[_0xc8f4('0x2f')]=_[_0xc8f4('0x30')](_0x4a25da['model'],_0x4a25da[_0xc8f4('0x2d')]);_0x385e41[_0xc8f4('0x31')]=_[_0xc8f4('0x30')](_0x4a25da['model'],qs[_0xc8f4('0x32')](_0x1b70bc[_0xc8f4('0x2d')]['fields']));_0x385e41[_0xc8f4('0x31')]=_0x385e41[_0xc8f4('0x31')][_0xc8f4('0x33')]?_0x385e41['attributes']:_0x4a25da[_0xc8f4('0x2c')];if(!_0x1b70bc[_0xc8f4('0x2d')][_0xc8f4('0x34')]('nolimit')){_0x385e41[_0xc8f4('0x1e')]=qs[_0xc8f4('0x1e')](_0x1b70bc[_0xc8f4('0x2d')][_0xc8f4('0x1e')]);_0x385e41[_0xc8f4('0x1d')]=qs[_0xc8f4('0x1d')](_0x1b70bc[_0xc8f4('0x2d')][_0xc8f4('0x1d')]);}_0x385e41[_0xc8f4('0x35')]=qs[_0xc8f4('0x36')](_0x1b70bc[_0xc8f4('0x2d')][_0xc8f4('0x36')]);_0x385e41[_0xc8f4('0x37')]=qs[_0xc8f4('0x2f')](_[_0xc8f4('0x38')](_0x1b70bc[_0xc8f4('0x2d')],_0x4a25da['filters']),_0x24bb78);if(_0x1b70bc[_0xc8f4('0x2d')]['filter']){_0x385e41[_0xc8f4('0x37')]=_['merge'](_0x385e41[_0xc8f4('0x37')],{'$or':_[_0xc8f4('0x2a')](_0x24bb78,function(_0x7ef69a){if(_0x7ef69a[_0xc8f4('0x39')]!==_0xc8f4('0x3a')){var _0x724060={};_0x724060[_0x7ef69a[_0xc8f4('0x27')]]={'$like':'%'+_0x1b70bc['query'][_0xc8f4('0x3b')]+'%'};return _0x724060;}})});}_0x385e41=_[_0xc8f4('0x3c')]({},_0x385e41,_0x1b70bc[_0xc8f4('0x3d')]);var _0x14ce2e={'where':_0x385e41['where']};return db[_0xc8f4('0x3e')][_0xc8f4('0x1c')](_0x14ce2e)[_0xc8f4('0x24')](function(_0x1d0b2d){_0x45f972[_0xc8f4('0x1c')]=_0x1d0b2d;if(_0x1b70bc[_0xc8f4('0x2d')][_0xc8f4('0x3f')]){_0x385e41[_0xc8f4('0x40')]=[{'all':!![]}];}return db[_0xc8f4('0x3e')][_0xc8f4('0x41')](_0x385e41);})[_0xc8f4('0x24')](function(_0xd56415){_0x45f972['rows']=_0xd56415;return _0x45f972;})[_0xc8f4('0x24')](respondWithFilteredResult(_0x24bef0,_0x385e41))[_0xc8f4('0x42')](handleError(_0x24bef0,null));};exports[_0xc8f4('0x43')]=function(_0x275f4a,_0x588ff9){var _0x49da16={'raw':!![],'where':{'id':_0x275f4a[_0xc8f4('0x44')]['id']}},_0x413a55={};_0x413a55['model']=_[_0xc8f4('0x2e')](db[_0xc8f4('0x3e')]['rawAttributes']);_0x413a55['query']=_[_0xc8f4('0x2e')](_0x275f4a[_0xc8f4('0x2d')]);_0x413a55[_0xc8f4('0x2f')]=_[_0xc8f4('0x30')](_0x413a55[_0xc8f4('0x2c')],_0x413a55[_0xc8f4('0x2d')]);_0x49da16['attributes']=_['intersection'](_0x413a55[_0xc8f4('0x2c')],qs[_0xc8f4('0x32')](_0x275f4a[_0xc8f4('0x2d')]['fields']));_0x49da16['attributes']=_0x49da16['attributes']['length']?_0x49da16['attributes']:_0x413a55[_0xc8f4('0x2c')];if(_0x275f4a[_0xc8f4('0x2d')][_0xc8f4('0x3f')]){_0x49da16[_0xc8f4('0x40')]=[{'all':!![]}];}_0x49da16=_[_0xc8f4('0x3c')]({},_0x49da16,_0x275f4a[_0xc8f4('0x3d')]);return db['MailQueueReport'][_0xc8f4('0x45')](_0x49da16)[_0xc8f4('0x24')](handleEntityNotFound(_0x588ff9,null))['then'](respondWithResult(_0x588ff9,null))['catch'](handleError(_0x588ff9,null));};exports[_0xc8f4('0x46')]=function(_0x82a5e,_0x3ca0d6){return db[_0xc8f4('0x3e')]['create'](_0x82a5e['body'],{})[_0xc8f4('0x24')](respondWithResult(_0x3ca0d6,0xc9))[_0xc8f4('0x42')](handleError(_0x3ca0d6,null));};exports[_0xc8f4('0x47')]=function(_0x2bc4db,_0x141f81){if(_0x2bc4db[_0xc8f4('0x48')]['id']){delete _0x2bc4db['body']['id'];}return db['MailQueueReport'][_0xc8f4('0x45')]({'where':{'id':_0x2bc4db[_0xc8f4('0x44')]['id']}})[_0xc8f4('0x24')](handleEntityNotFound(_0x141f81,null))[_0xc8f4('0x24')](saveUpdates(_0x2bc4db[_0xc8f4('0x48')],null))[_0xc8f4('0x24')](respondWithResult(_0x141f81,null))[_0xc8f4('0x42')](handleError(_0x141f81,null));};exports[_0xc8f4('0x25')]=function(_0x3d9d67,_0x5b4035){return db['MailQueueReport'][_0xc8f4('0x45')]({'where':{'id':_0x3d9d67[_0xc8f4('0x44')]['id']}})[_0xc8f4('0x24')](handleEntityNotFound(_0x5b4035,null))[_0xc8f4('0x24')](removeEntity(_0x5b4035,null))[_0xc8f4('0x42')](handleError(_0x5b4035,null));};exports[_0xc8f4('0x49')]=function(_0x4715f3,_0x36c304){return db[_0xc8f4('0x3e')][_0xc8f4('0x49')]()[_0xc8f4('0x24')](respondWithResult(_0x36c304,null))[_0xc8f4('0x42')](handleError(_0x36c304,null));}; \ No newline at end of file +var _0x0b0e=['merge','where','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','include','find','create','body','params','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','MailQueueReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter'];(function(_0x4109e8,_0x450578){var _0x55a635=function(_0x2fde78){while(--_0x2fde78){_0x4109e8['push'](_0x4109e8['shift']());}};_0x55a635(++_0x450578);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2b1551,_0x1776fe){_0x2b1551=_0x2b1551-0x0;var _0x2fc2a1=_0x0b0e[_0x2b1551];return _0x2fc2a1;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['MailQueueReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'all':!![]}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x41')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x402a0e){_0x36d137[_0xe0b0('0x42')]=_0x402a0e;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))[_0xe0b0('0x43')](handleError(_0x5b7a64,null));};exports[_0xe0b0('0x44')]=function(_0x52ffe4,_0x2aad80){var _0x309bbf={'raw':!![],'where':{'id':_0x52ffe4['params']['id']}},_0x528818={};_0x528818[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db['MailQueueReport'][_0xe0b0('0x2b')]);_0x528818[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x52ffe4[_0xe0b0('0x2e')]);_0x528818[_0xe0b0('0x39')]=_['intersection'](_0x528818['model'],_0x528818['query']);_0x309bbf[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x528818['model'],qs[_0xe0b0('0x33')](_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x309bbf[_0xe0b0('0x32')]=_0x309bbf[_0xe0b0('0x32')]['length']?_0x309bbf['attributes']:_0x528818[_0xe0b0('0x31')];if(_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x309bbf[_0xe0b0('0x45')]=[{'all':!![]}];}_0x309bbf=_[_0xe0b0('0x3b')]({},_0x309bbf,_0x52ffe4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x46')](_0x309bbf)['then'](handleEntityNotFound(_0x2aad80,null))['then'](respondWithResult(_0x2aad80,null))['catch'](handleError(_0x2aad80,null));};exports[_0xe0b0('0x47')]=function(_0x2184d3,_0x2419ce){return db[_0xe0b0('0x2a')]['create'](_0x2184d3[_0xe0b0('0x48')],{})[_0xe0b0('0x23')](respondWithResult(_0x2419ce,0xc9))['catch'](handleError(_0x2419ce,null));};exports['update']=function(_0x2365be,_0x1bc6e0){if(_0x2365be['body']['id']){delete _0x2365be[_0xe0b0('0x48')]['id'];}return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x2365be['params']['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x1bc6e0,null))['then'](saveUpdates(_0x2365be[_0xe0b0('0x48')],null))[_0xe0b0('0x23')](respondWithResult(_0x1bc6e0,null))[_0xe0b0('0x43')](handleError(_0x1bc6e0,null));};exports[_0xe0b0('0x24')]=function(_0x19ee71,_0xf9e694){return db['MailQueueReport']['find']({'where':{'id':_0x19ee71[_0xe0b0('0x49')]['id']}})['then'](handleEntityNotFound(_0xf9e694,null))['then'](removeEntity(_0xf9e694,null))[_0xe0b0('0x43')](handleError(_0xf9e694,null));};exports[_0xe0b0('0x4a')]=function(_0x54cf7b,_0x4b65d1){return db[_0xe0b0('0x2a')][_0xe0b0('0x4a')]()[_0xe0b0('0x23')](respondWithResult(_0x4b65d1,null))[_0xe0b0('0x43')](handleError(_0x4b65d1,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index e483656..0713190 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 _0x1b6e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','define','report_mail_queue','uniqueid','lodash'];(function(_0x142524,_0x482cc3){var _0x52c966=function(_0x229afd){while(--_0x229afd){_0x142524['push'](_0x142524['shift']());}};_0x52c966(++_0x482cc3);}(_0x1b6e,0x1d8));var _0xe1b6=function(_0xbfb8af,_0x8caee5){_0xbfb8af=_0xbfb8af-0x0;var _0x38fc6e=_0x1b6e[_0xbfb8af];return _0x38fc6e;};'use strict';var _=require(_0xe1b6('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe1b6('0x1'));var BPromise=require(_0xe1b6('0x2'));var rp=require(_0xe1b6('0x3'));var fs=require('fs');var path=require(_0xe1b6('0x4'));var rimraf=require(_0xe1b6('0x5'));var config=require(_0xe1b6('0x6'));var attributes=require(_0xe1b6('0x7'));module['exports']=function(_0x21af11,_0x33df65){return _0x21af11[_0xe1b6('0x8')]('MailQueueReport',attributes,{'tableName':_0xe1b6('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe1b6('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x91f1=['define','MailQueueReport','report_mail_queue','uniqueid','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x91f1,0x160));var _0x191f=function(_0x203294,_0x1fc628){_0x203294=_0x203294-0x0;var _0x745f0e=_0x91f1[_0x203294];return _0x745f0e;};'use strict';var _=require('lodash');var util=require(_0x191f('0x0'));var logger=require(_0x191f('0x1'))(_0x191f('0x2'));var moment=require(_0x191f('0x3'));var BPromise=require(_0x191f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x191f('0x5'));var config=require(_0x191f('0x6'));var attributes=require('./mailQueueReport.attributes');module[_0x191f('0x7')]=function(_0x469509,_0x2b104d){return _0x469509[_0x191f('0x8')](_0x191f('0x9'),attributes,{'tableName':_0x191f('0xa'),'paranoid':![],'indexes':[{'name':_0x191f('0xb'),'fields':[_0x191f('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 054a5cd..b29310d 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 _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(_0x16889f,_0x1fc476){var _0x3a5ff3=function(_0x5c8a4d){while(--_0x5c8a4d){_0x16889f['push'](_0x16889f['shift']());}};_0x3a5ff3(++_0x1fc476);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xc4aa[_0x1caf6a];return _0x1bf493;};'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 +var _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x1b81fe,_0xdfbe1b){var _0x8920b1=function(_0x21ba01){while(--_0x21ba01){_0x1b81fe['push'](_0x1b81fe['shift']());}};_0x8920b1(++_0xdfbe1b);}(_0xadb5,0xad));var _0x5adb=function(_0x4d179f,_0x5c68f3){_0x4d179f=_0x4d179f-0x0;var _0x4c99d6=_0xadb5[_0x4d179f];return _0x4c99d6;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailQueueReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index c6e2ac1..bd1e8ae 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5aec09,_0x3e7e00){var _0x49e4e3=function(_0x463dac){while(--_0x463dac){_0x5aec09['push'](_0x5aec09['shift']());}};_0x49e4e3(++_0x3e7e00);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3e2fcf,_0x579110){_0x3e2fcf=_0x3e2fcf-0x0;var _0x497db7=_0xcb91[_0x3e2fcf];return _0x497db7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3054f1,_0x1c160b){var _0x51f5eb=function(_0x27a9a4){while(--_0x27a9a4){_0x3054f1['push'](_0x3054f1['shift']());}};_0x51f5eb(++_0x1c160b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 42beb78..0e51992 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 _0x89f5=['INBOX','STRING','INTEGER','BOOLEAN'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x89f5,0x1d5));var _0x589f=function(_0x24909e,_0x1f5f6b){_0x24909e=_0x24909e-0x0;var _0x4bef1c=_0x89f5[_0x24909e];return _0x4bef1c;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x589f('0x0')]},'host':{'type':Sequelize[_0x589f('0x0')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x589f('0x0')]},'password':{'type':Sequelize[_0x589f('0x0')]},'port':{'type':Sequelize[_0x589f('0x1')]},'tls':{'type':Sequelize[_0x589f('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x589f('0x0')],'defaultValue':_0x589f('0x3')},'connTimeout':{'type':Sequelize[_0x589f('0x1')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x589f('0x1')],'defaultValue':0x5},'service':{'type':Sequelize[_0x589f('0x0')]},'modernAuthentication':{'type':Sequelize[_0x589f('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xad0a=['INTEGER','INBOX','exports','STRING','BOOLEAN'];(function(_0x4c71f5,_0x2c2601){var _0xde53f7=function(_0x3e93d4){while(--_0x3e93d4){_0x4c71f5['push'](_0x4c71f5['shift']());}};_0xde53f7(++_0x2c2601);}(_0xad0a,0xe3));var _0xaad0=function(_0xb057ca,_0x19cd08){_0xb057ca=_0xb057ca-0x0;var _0x4be66f=_0xad0a[_0xb057ca];return _0x4be66f;};'use strict';var Sequelize=require('sequelize');module[_0xaad0('0x0')]={'description':{'type':Sequelize[_0xaad0('0x1')]},'host':{'type':Sequelize[_0xaad0('0x1')]},'authentication':{'type':Sequelize[_0xaad0('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xaad0('0x1')]},'port':{'type':Sequelize[_0xaad0('0x3')]},'tls':{'type':Sequelize[_0xaad0('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xaad0('0x1')],'defaultValue':_0xaad0('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xaad0('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0xaad0('0x1')]},'modernAuthentication':{'type':Sequelize[_0xaad0('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 6e6d599..1e7f79d 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 _0x0151=['mail_servers_in','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','MailServerIn'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x0151,0x1ef));var _0x1015=function(_0x10f9e1,_0x4c7e0b){_0x10f9e1=_0x10f9e1-0x0;var _0x371f06=_0x0151[_0x10f9e1];return _0x371f06;};'use strict';var _=require(_0x1015('0x0'));var util=require(_0x1015('0x1'));var logger=require(_0x1015('0x2'))('api');var moment=require(_0x1015('0x3'));var BPromise=require(_0x1015('0x4'));var rp=require(_0x1015('0x5'));var fs=require('fs');var path=require(_0x1015('0x6'));var rimraf=require(_0x1015('0x7'));var config=require(_0x1015('0x8'));var attributes=require(_0x1015('0x9'));module[_0x1015('0xa')]=function(_0x24c8b6,_0x1eccdd){return _0x24c8b6['define'](_0x1015('0xb'),attributes,{'tableName':_0x1015('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56fe=['define','MailServerIn','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./mailServerIn.attributes','exports'];(function(_0x592281,_0xb4f4c6){var _0x919037=function(_0x4c7077){while(--_0x4c7077){_0x592281['push'](_0x592281['shift']());}};_0x919037(++_0xb4f4c6);}(_0x56fe,0x1f1));var _0xe56f=function(_0x28c368,_0x41dad4){_0x28c368=_0x28c368-0x0;var _0x59e75f=_0x56fe[_0x28c368];return _0x59e75f;};'use strict';var _=require(_0xe56f('0x0'));var util=require(_0xe56f('0x1'));var logger=require('../../config/logger')(_0xe56f('0x2'));var moment=require(_0xe56f('0x3'));var BPromise=require(_0xe56f('0x4'));var rp=require(_0xe56f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe56f('0x6'));var attributes=require(_0xe56f('0x7'));module[_0xe56f('0x8')]=function(_0xe445a6,_0x6699d){return _0xe445a6[_0xe56f('0x9')](_0xe56f('0xa'),attributes,{'tableName':'mail_servers_in','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 68c8cff..f09296e 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 _0xa7b5=['then','info','MailServerIn,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','findAll','options','where','attributes','limit','include','model','map','GetMailServerIn','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x9fafa0,_0x10f969){var _0x5b4fff=function(_0x4acf55){while(--_0x4acf55){_0x9fafa0['push'](_0x9fafa0['shift']());}};_0x5b4fff(++_0x10f969);}(_0xa7b5,0x162));var _0x5a7b=function(_0x20591f,_0x343a0c){_0x20591f=_0x20591f-0x0;var _0x1d6813=_0xa7b5[_0x20591f];return _0x1d6813;};'use strict';var _=require(_0x5a7b('0x0'));var util=require(_0x5a7b('0x1'));var moment=require(_0x5a7b('0x2'));var BPromise=require(_0x5a7b('0x3'));var rs=require(_0x5a7b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a7b('0x5'))['db'];var utils=require(_0x5a7b('0x6'));var logger=require(_0x5a7b('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5a7b('0x8'));var client=jayson[_0x5a7b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38dac6,_0xe45788,_0x390a68){return new BPromise(function(_0x265597,_0x14c477){return client['request'](_0x38dac6,_0x390a68)[_0x5a7b('0xa')](function(_0x59b6df){logger[_0x5a7b('0xb')](_0x5a7b('0xc'),_0xe45788,'request\x20sent');logger[_0x5a7b('0xd')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0xe45788,_0x5a7b('0xe'),JSON[_0x5a7b('0xf')](_0x59b6df));if(_0x59b6df[_0x5a7b('0x10')]){if(_0x59b6df[_0x5a7b('0x10')]['code']===0x1f4){logger['error'](_0x5a7b('0xc'),_0xe45788,_0x59b6df['error']['message']);return _0x14c477(_0x59b6df[_0x5a7b('0x10')][_0x5a7b('0x11')]);}logger['error'](_0x5a7b('0xc'),_0xe45788,_0x59b6df[_0x5a7b('0x10')][_0x5a7b('0x11')]);return _0x265597(_0x59b6df['error'][_0x5a7b('0x11')]);}else{logger[_0x5a7b('0xb')]('MailServerIn,\x20%s,\x20%s',_0xe45788,_0x5a7b('0xe'));_0x265597(_0x59b6df['result'][_0x5a7b('0x11')]);}})['catch'](function(_0x34804c){logger[_0x5a7b('0x10')](_0x5a7b('0xc'),_0xe45788,_0x34804c);_0x14c477(_0x34804c);});});}exports['GetMailServerIn']=function(_0xe59f65){var _0x2dd166=this;return new Promise(function(_0x466758,_0x47ce0f){return db['MailServerIn'][_0x5a7b('0x12')]({'raw':_0xe59f65['options']?_0xe59f65[_0x5a7b('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0xe59f65[_0x5a7b('0x13')]?_0xe59f65[_0x5a7b('0x13')][_0x5a7b('0x14')]||null:null,'attributes':_0xe59f65['options']?_0xe59f65[_0x5a7b('0x13')][_0x5a7b('0x15')]||null:null,'limit':_0xe59f65['options']?_0xe59f65[_0x5a7b('0x13')][_0x5a7b('0x16')]||null:null,'include':_0xe59f65['options']?_0xe59f65[_0x5a7b('0x13')][_0x5a7b('0x17')]?_['map'](_0xe59f65['options'][_0x5a7b('0x17')],function(_0x32cc44){return{'model':db[_0x32cc44[_0x5a7b('0x18')]],'as':_0x32cc44['as'],'attributes':_0x32cc44[_0x5a7b('0x15')],'include':_0x32cc44[_0x5a7b('0x17')]?_[_0x5a7b('0x19')](_0x32cc44[_0x5a7b('0x17')],function(_0x4f204d){return{'model':db[_0x4f204d['model']],'as':_0x4f204d['as'],'attributes':_0x4f204d[_0x5a7b('0x15')],'include':_0x4f204d[_0x5a7b('0x17')]?_[_0x5a7b('0x19')](_0x4f204d[_0x5a7b('0x17')],function(_0x48ee7e){return{'model':db[_0x48ee7e[_0x5a7b('0x18')]],'as':_0x48ee7e['as'],'attributes':_0x48ee7e['attributes']};}):[]};}):[]};}):[]:[]})[_0x5a7b('0xa')](function(_0x3531cf){logger[_0x5a7b('0xb')](_0x5a7b('0x1a'),_0xe59f65);logger['debug'](_0x5a7b('0x1a'),_0xe59f65,JSON[_0x5a7b('0xf')](_0x3531cf));_0x466758(_0x3531cf);})[_0x5a7b('0x1b')](function(_0x1ad5da){logger[_0x5a7b('0x10')]('GetMailServerIn',_0x1ad5da[_0x5a7b('0x11')],_0xe59f65);_0x47ce0f(_0x2dd166['error'](0x1f4,_0x1ad5da['message']));});});}; \ No newline at end of file +var _0xf330=['raw','attributes','limit','map','include','model','debug','GetMailServerIn','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','then','info','MailServerIn,\x20%s,\x20%s','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','MailServerIn','options'];(function(_0x11643a,_0x46c5ec){var _0x3f2ece=function(_0x3886e7){while(--_0x3886e7){_0x11643a['push'](_0x11643a['shift']());}};_0x3f2ece(++_0x46c5ec);}(_0xf330,0x147));var _0x0f33=function(_0x29f83d,_0x5a8df2){_0x29f83d=_0x29f83d-0x0;var _0x146c40=_0xf330[_0x29f83d];return _0x146c40;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0f33('0x0'));var BPromise=require(_0x0f33('0x1'));var rs=require(_0x0f33('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f33('0x3'))['db'];var utils=require(_0x0f33('0x4'));var logger=require('../../config/logger')(_0x0f33('0x5'));var config=require('../../config/environment');var jayson=require(_0x0f33('0x6'));var client=jayson[_0x0f33('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4512b9,_0x4225e8,_0x4ebb93){return new BPromise(function(_0x56b673,_0x10b9cb){return client['request'](_0x4512b9,_0x4ebb93)[_0x0f33('0x8')](function(_0x5790d5){logger[_0x0f33('0x9')](_0x0f33('0xa'),_0x4225e8,'request\x20sent');logger['debug'](_0x0f33('0xb'),_0x4225e8,_0x0f33('0xc'),JSON[_0x0f33('0xd')](_0x5790d5));if(_0x5790d5[_0x0f33('0xe')]){if(_0x5790d5[_0x0f33('0xe')][_0x0f33('0xf')]===0x1f4){logger[_0x0f33('0xe')](_0x0f33('0xa'),_0x4225e8,_0x5790d5['error'][_0x0f33('0x10')]);return _0x10b9cb(_0x5790d5[_0x0f33('0xe')][_0x0f33('0x10')]);}logger['error'](_0x0f33('0xa'),_0x4225e8,_0x5790d5[_0x0f33('0xe')][_0x0f33('0x10')]);return _0x56b673(_0x5790d5['error'][_0x0f33('0x10')]);}else{logger[_0x0f33('0x9')](_0x0f33('0xa'),_0x4225e8,_0x0f33('0xc'));_0x56b673(_0x5790d5[_0x0f33('0x11')][_0x0f33('0x10')]);}})[_0x0f33('0x12')](function(_0x39c609){logger['error'](_0x0f33('0xa'),_0x4225e8,_0x39c609);_0x10b9cb(_0x39c609);});});}exports['GetMailServerIn']=function(_0x5540f6){var _0x19f26b=this;return new Promise(function(_0x35d2d4,_0x585c31){return db[_0x0f33('0x13')]['findAll']({'raw':_0x5540f6['options']?_0x5540f6[_0x0f33('0x14')][_0x0f33('0x15')]===undefined?!![]:![]:!![],'where':_0x5540f6['options']?_0x5540f6[_0x0f33('0x14')]['where']||null:null,'attributes':_0x5540f6[_0x0f33('0x14')]?_0x5540f6[_0x0f33('0x14')][_0x0f33('0x16')]||null:null,'limit':_0x5540f6[_0x0f33('0x14')]?_0x5540f6[_0x0f33('0x14')][_0x0f33('0x17')]||null:null,'include':_0x5540f6[_0x0f33('0x14')]?_0x5540f6[_0x0f33('0x14')]['include']?_[_0x0f33('0x18')](_0x5540f6['options'][_0x0f33('0x19')],function(_0x106410){return{'model':db[_0x106410[_0x0f33('0x1a')]],'as':_0x106410['as'],'attributes':_0x106410['attributes'],'include':_0x106410[_0x0f33('0x19')]?_['map'](_0x106410[_0x0f33('0x19')],function(_0xf4461b){return{'model':db[_0xf4461b[_0x0f33('0x1a')]],'as':_0xf4461b['as'],'attributes':_0xf4461b['attributes'],'include':_0xf4461b[_0x0f33('0x19')]?_[_0x0f33('0x18')](_0xf4461b['include'],function(_0x1e84a0){return{'model':db[_0x1e84a0['model']],'as':_0x1e84a0['as'],'attributes':_0x1e84a0[_0x0f33('0x16')]};}):[]};}):[]};}):[]:[]})[_0x0f33('0x8')](function(_0x5aebef){logger[_0x0f33('0x9')]('GetMailServerIn',_0x5540f6);logger[_0x0f33('0x1b')](_0x0f33('0x1c'),_0x5540f6,JSON[_0x0f33('0xd')](_0x5aebef));_0x35d2d4(_0x5aebef);})[_0x0f33('0x12')](function(_0x17feb5){logger[_0x0f33('0xe')]('GetMailServerIn',_0x17feb5['message'],_0x5540f6);_0x585c31(_0x19f26b[_0x0f33('0xe')](0x1f4,_0x17feb5[_0x0f33('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index d8640f6..611ee05 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(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _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(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index fbb55b8..0f6ca10 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 _0x351d=['sequelize','STRING','INTEGER','BOOLEAN'];(function(_0x5047ac,_0x1c8f81){var _0x3cdee5=function(_0x2e1426){while(--_0x2e1426){_0x5047ac['push'](_0x5047ac['shift']());}};_0x3cdee5(++_0x1c8f81);}(_0x351d,0x90));var _0xd351=function(_0x44f55b,_0x47734c){_0x44f55b=_0x44f55b-0x0;var _0x1e8183=_0x351d[_0x44f55b];return _0x1e8183;};'use strict';var Sequelize=require(_0xd351('0x0'));module['exports']={'description':{'type':Sequelize[_0xd351('0x1')]},'host':{'type':Sequelize[_0xd351('0x1')]},'user':{'type':Sequelize[_0xd351('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xd351('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xd351('0x1')]},'authentication':{'type':Sequelize[_0xd351('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1339=['BOOLEAN','STRING','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1339,0x1ed));var _0x9133=function(_0x346e9d,_0x545f59){_0x346e9d=_0x346e9d-0x0;var _0x2b56a2=_0x1339[_0x346e9d];return _0x2b56a2;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x9133('0x0')]},'host':{'type':Sequelize[_0x9133('0x0')]},'user':{'type':Sequelize[_0x9133('0x0')]},'pass':{'type':Sequelize[_0x9133('0x0')]},'port':{'type':Sequelize[_0x9133('0x1')]},'secure':{'type':Sequelize[_0x9133('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0x9133('0x0')]},'authentication':{'type':Sequelize[_0x9133('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 9ff0b0a..7de4a2b 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 _0xbb8e=['VIRTUAL','options','includeAll','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','map','MailServerOut','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb8e,0x17d));var _0xebb8=function(_0x1e3827,_0x926bcf){_0x1e3827=_0x1e3827-0x0;var _0x2d1497=_0xbb8e[_0x1e3827];return _0x2d1497;};'use strict';var emlformat=require(_0xebb8('0x0'));var rimraf=require(_0xebb8('0x1'));var zipdir=require(_0xebb8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xebb8('0x3'));var moment=require(_0xebb8('0x4'));var BPromise=require(_0xebb8('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xebb8('0x6'));var sox=require(_0xebb8('0x7'));var csv=require(_0xebb8('0x8'));var ejs=require(_0xebb8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xebb8('0xa'));var squel=require(_0xebb8('0xb'));var crypto=require('crypto');var jsforce=require(_0xebb8('0xc'));var deskjs=require(_0xebb8('0xd'));var toCsv=require(_0xebb8('0x8'));var querystring=require(_0xebb8('0xe'));var Papa=require('papaparse');var Redis=require(_0xebb8('0xf'));var authService=require(_0xebb8('0x10'));var qs=require(_0xebb8('0x11'));var as=require(_0xebb8('0x12'));var hardwareService=require(_0xebb8('0x13'));var logger=require('../../config/logger')(_0xebb8('0x14'));var utils=require(_0xebb8('0x15'));var config=require(_0xebb8('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35f82b,_0x48ba88){_0x48ba88=_0x48ba88||0xcc;return function(_0x127364){if(_0x127364){return _0x35f82b[_0xebb8('0x17')](_0x48ba88);}return _0x35f82b[_0xebb8('0x18')](_0x48ba88)['end']();};}function respondWithResult(_0x1a6c36,_0x45e326){_0x45e326=_0x45e326||0xc8;return function(_0x325b65){if(_0x325b65){return _0x1a6c36[_0xebb8('0x18')](_0x45e326)[_0xebb8('0x19')](_0x325b65);}};}function respondWithFilteredResult(_0x544073,_0x5d1659){return function(_0x4de058){if(_0x4de058){var _0x4bd394=typeof _0x5d1659['offset']===_0xebb8('0x1a')&&typeof _0x5d1659[_0xebb8('0x1b')]===_0xebb8('0x1a');var _0x4a809a=_0x4de058[_0xebb8('0x1c')];var _0x1eb38e=_0x4bd394?0x0:_0x5d1659['offset'];var _0x46da8f=_0x4bd394?_0x4de058[_0xebb8('0x1c')]:_0x5d1659[_0xebb8('0x1d')]+_0x5d1659[_0xebb8('0x1b')];var _0x491aec;if(_0x46da8f>=_0x4a809a){_0x46da8f=_0x4a809a;_0x491aec=0xc8;}else{_0x491aec=0xce;}_0x544073[_0xebb8('0x18')](_0x491aec);return _0x544073[_0xebb8('0x1e')](_0xebb8('0x1f'),_0x1eb38e+'-'+_0x46da8f+'/'+_0x4a809a)[_0xebb8('0x19')](_0x4de058);}return null;};}function patchUpdates(_0x25e652){return function(_0x396ea3){try{jsonpatch[_0xebb8('0x20')](_0x396ea3,_0x25e652,!![]);}catch(_0x2d0df2){return BPromise[_0xebb8('0x21')](_0x2d0df2);}return _0x396ea3['save']();};}function saveUpdates(_0x5c42e3,_0x45d5cc){return function(_0x2ded09){if(_0x2ded09){return _0x2ded09[_0xebb8('0x22')](_0x5c42e3)[_0xebb8('0x23')](function(_0x5949ab){return _0x5949ab;});}return null;};}function removeEntity(_0x254ed2,_0xc4e771){return function(_0x4fd921){if(_0x4fd921){return _0x4fd921[_0xebb8('0x24')]()[_0xebb8('0x23')](function(){_0x254ed2['status'](0xcc)[_0xebb8('0x25')]();});}};}function handleEntityNotFound(_0x4d3b64,_0x5549d4){return function(_0x1efd38){if(!_0x1efd38){_0x4d3b64[_0xebb8('0x17')](0x194);}return _0x1efd38;};}function handleError(_0x395678,_0x29f172){_0x29f172=_0x29f172||0x1f4;return function(_0x522248){logger[_0xebb8('0x26')](_0x522248[_0xebb8('0x27')]);if(_0x522248[_0xebb8('0x28')]){delete _0x522248[_0xebb8('0x28')];}_0x395678[_0xebb8('0x18')](_0x29f172)[_0xebb8('0x29')](_0x522248);};}exports['index']=function(_0x44c41d,_0x2c1c48){var _0x253cb2={},_0x515f69={},_0x54d0e4={'count':0x0,'rows':[]};var _0x5b8584=_[_0xebb8('0x2a')](db[_0xebb8('0x2b')][_0xebb8('0x2c')],function(_0x4422dd){return{'name':_0x4422dd['fieldName'],'type':_0x4422dd[_0xebb8('0x2d')][_0xebb8('0x2e')]};});_0x515f69[_0xebb8('0x2f')]=_['map'](_0x5b8584,_0xebb8('0x28'));_0x515f69[_0xebb8('0x30')]=_[_0xebb8('0x31')](_0x44c41d[_0xebb8('0x30')]);_0x515f69[_0xebb8('0x32')]=_[_0xebb8('0x33')](_0x515f69[_0xebb8('0x2f')],_0x515f69['query']);_0x253cb2[_0xebb8('0x34')]=_[_0xebb8('0x33')](_0x515f69['model'],qs[_0xebb8('0x35')](_0x44c41d[_0xebb8('0x30')][_0xebb8('0x35')]));_0x253cb2[_0xebb8('0x34')]=_0x253cb2['attributes'][_0xebb8('0x36')]?_0x253cb2['attributes']:_0x515f69['model'];if(!_0x44c41d[_0xebb8('0x30')][_0xebb8('0x37')](_0xebb8('0x38'))){_0x253cb2[_0xebb8('0x1b')]=qs['limit'](_0x44c41d[_0xebb8('0x30')][_0xebb8('0x1b')]);_0x253cb2[_0xebb8('0x1d')]=qs[_0xebb8('0x1d')](_0x44c41d[_0xebb8('0x30')]['offset']);}_0x253cb2[_0xebb8('0x39')]=qs[_0xebb8('0x3a')](_0x44c41d['query'][_0xebb8('0x3a')]);_0x253cb2[_0xebb8('0x3b')]=qs['filters'](_[_0xebb8('0x3c')](_0x44c41d[_0xebb8('0x30')],_0x515f69[_0xebb8('0x32')]),_0x5b8584);if(_0x44c41d['query'][_0xebb8('0x3d')]){_0x253cb2[_0xebb8('0x3b')]=_[_0xebb8('0x3e')](_0x253cb2[_0xebb8('0x3b')],{'$or':_['map'](_0x5b8584,function(_0x115772){if(_0x115772['type']!==_0xebb8('0x3f')){var _0x44d8d5={};_0x44d8d5[_0x115772['name']]={'$like':'%'+_0x44c41d[_0xebb8('0x30')][_0xebb8('0x3d')]+'%'};return _0x44d8d5;}})});}_0x253cb2=_['merge']({},_0x253cb2,_0x44c41d[_0xebb8('0x40')]);var _0x515a88={'where':_0x253cb2['where']};return db[_0xebb8('0x2b')][_0xebb8('0x1c')](_0x515a88)[_0xebb8('0x23')](function(_0x2d332a){_0x54d0e4[_0xebb8('0x1c')]=_0x2d332a;if(_0x44c41d[_0xebb8('0x30')][_0xebb8('0x41')]){_0x253cb2['include']=[{'all':!![]}];}return db['MailServerOut'][_0xebb8('0x42')](_0x253cb2);})[_0xebb8('0x23')](function(_0x5f24a7){_0x54d0e4[_0xebb8('0x43')]=_0x5f24a7;return _0x54d0e4;})[_0xebb8('0x23')](respondWithFilteredResult(_0x2c1c48,_0x253cb2))[_0xebb8('0x44')](handleError(_0x2c1c48,null));};exports[_0xebb8('0x45')]=function(_0x49a057,_0x1f8ad1){var _0x4f35ee={'raw':!![],'where':{'id':_0x49a057[_0xebb8('0x46')]['id']}},_0x11a97a={};_0x11a97a['model']=_[_0xebb8('0x31')](db[_0xebb8('0x2b')][_0xebb8('0x2c')]);_0x11a97a['query']=_[_0xebb8('0x31')](_0x49a057[_0xebb8('0x30')]);_0x11a97a[_0xebb8('0x32')]=_['intersection'](_0x11a97a['model'],_0x11a97a[_0xebb8('0x30')]);_0x4f35ee[_0xebb8('0x34')]=_[_0xebb8('0x33')](_0x11a97a[_0xebb8('0x2f')],qs[_0xebb8('0x35')](_0x49a057[_0xebb8('0x30')]['fields']));_0x4f35ee['attributes']=_0x4f35ee[_0xebb8('0x34')][_0xebb8('0x36')]?_0x4f35ee[_0xebb8('0x34')]:_0x11a97a[_0xebb8('0x2f')];if(_0x49a057[_0xebb8('0x30')]['includeAll']){_0x4f35ee['include']=[{'all':!![]}];}_0x4f35ee=_[_0xebb8('0x3e')]({},_0x4f35ee,_0x49a057[_0xebb8('0x40')]);return db[_0xebb8('0x2b')]['find'](_0x4f35ee)[_0xebb8('0x23')](handleEntityNotFound(_0x1f8ad1,null))[_0xebb8('0x23')](respondWithResult(_0x1f8ad1,null))[_0xebb8('0x44')](handleError(_0x1f8ad1,null));};exports[_0xebb8('0x47')]=function(_0x38f7e2,_0x2ccc64){return db[_0xebb8('0x2b')][_0xebb8('0x47')](_0x38f7e2[_0xebb8('0x48')],{})[_0xebb8('0x23')](respondWithResult(_0x2ccc64,0xc9))['catch'](handleError(_0x2ccc64,null));};exports[_0xebb8('0x22')]=function(_0x56f9c3,_0x3f4a49){if(_0x56f9c3[_0xebb8('0x48')]['id']){delete _0x56f9c3[_0xebb8('0x48')]['id'];}return db['MailServerOut'][_0xebb8('0x49')]({'where':{'id':_0x56f9c3[_0xebb8('0x46')]['id']}})[_0xebb8('0x23')](handleEntityNotFound(_0x3f4a49,null))[_0xebb8('0x23')](saveUpdates(_0x56f9c3[_0xebb8('0x48')],null))['then'](respondWithResult(_0x3f4a49,null))[_0xebb8('0x44')](handleError(_0x3f4a49,null));};exports[_0xebb8('0x24')]=function(_0x2f1219,_0x5680fd){return db[_0xebb8('0x2b')][_0xebb8('0x49')]({'where':{'id':_0x2f1219[_0xebb8('0x46')]['id']}})[_0xebb8('0x23')](handleEntityNotFound(_0x5680fd,null))[_0xebb8('0x23')](removeEntity(_0x5680fd,null))[_0xebb8('0x44')](handleError(_0x5680fd,null));}; \ No newline at end of file +var _0xb865=['nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','MailServerOut','findAll','rows','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x1eaf15,_0x187a54){var _0x5900e6=function(_0x491913){while(--_0x491913){_0x1eaf15['push'](_0x1eaf15['shift']());}};_0x5900e6(++_0x187a54);}(_0xb865,0xf8));var _0x5b86=function(_0x100a95,_0x3188df){_0x100a95=_0x100a95-0x0;var _0x19c632=_0xb865[_0x100a95];return _0x19c632;};'use strict';var emlformat=require(_0x5b86('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5b86('0x1'));var jsonpatch=require(_0x5b86('0x2'));var rp=require(_0x5b86('0x3'));var moment=require(_0x5b86('0x4'));var BPromise=require(_0x5b86('0x5'));var Mustache=require(_0x5b86('0x6'));var util=require(_0x5b86('0x7'));var path=require(_0x5b86('0x8'));var sox=require(_0x5b86('0x9'));var csv=require(_0x5b86('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5b86('0xb'));var _=require('lodash');var squel=require(_0x5b86('0xc'));var crypto=require(_0x5b86('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5b86('0xe'));var toCsv=require(_0x5b86('0xa'));var querystring=require(_0x5b86('0xf'));var Papa=require(_0x5b86('0x10'));var Redis=require(_0x5b86('0x11'));var authService=require(_0x5b86('0x12'));var qs=require(_0x5b86('0x13'));var as=require(_0x5b86('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5b86('0x15'))('api');var utils=require(_0x5b86('0x16'));var config=require(_0x5b86('0x17'));var licenseUtil=require(_0x5b86('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x115141,_0x555cfb){_0x555cfb=_0x555cfb||0xcc;return function(_0x531fdd){if(_0x531fdd){return _0x115141[_0x5b86('0x19')](_0x555cfb);}return _0x115141[_0x5b86('0x1a')](_0x555cfb)['end']();};}function respondWithResult(_0x203021,_0x4d0482){_0x4d0482=_0x4d0482||0xc8;return function(_0x3a2f08){if(_0x3a2f08){return _0x203021[_0x5b86('0x1a')](_0x4d0482)[_0x5b86('0x1b')](_0x3a2f08);}};}function respondWithFilteredResult(_0x2c041e,_0x477542){return function(_0x2a7799){if(_0x2a7799){var _0x24628f=typeof _0x477542['offset']==='undefined'&&typeof _0x477542[_0x5b86('0x1c')]===_0x5b86('0x1d');var _0x439ad4=_0x2a7799[_0x5b86('0x1e')];var _0x1f7f5e=_0x24628f?0x0:_0x477542[_0x5b86('0x1f')];var _0xc832a2=_0x24628f?_0x2a7799[_0x5b86('0x1e')]:_0x477542[_0x5b86('0x1f')]+_0x477542[_0x5b86('0x1c')];var _0x15a1b1;if(_0xc832a2>=_0x439ad4){_0xc832a2=_0x439ad4;_0x15a1b1=0xc8;}else{_0x15a1b1=0xce;}_0x2c041e[_0x5b86('0x1a')](_0x15a1b1);return _0x2c041e[_0x5b86('0x20')](_0x5b86('0x21'),_0x1f7f5e+'-'+_0xc832a2+'/'+_0x439ad4)[_0x5b86('0x1b')](_0x2a7799);}return null;};}function patchUpdates(_0x2756d2){return function(_0x5eb14d){try{jsonpatch['apply'](_0x5eb14d,_0x2756d2,!![]);}catch(_0x4272a9){return BPromise['reject'](_0x4272a9);}return _0x5eb14d[_0x5b86('0x22')]();};}function saveUpdates(_0xe80928,_0x5cc245){return function(_0x4fd82e){if(_0x4fd82e){return _0x4fd82e[_0x5b86('0x23')](_0xe80928)[_0x5b86('0x24')](function(_0x1903fe){return _0x1903fe;});}return null;};}function removeEntity(_0x48f919,_0x4f512d){return function(_0x57c034){if(_0x57c034){return _0x57c034[_0x5b86('0x25')]()[_0x5b86('0x24')](function(){_0x48f919[_0x5b86('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4185f8,_0x2f7d64){return function(_0x4cbaca){if(!_0x4cbaca){_0x4185f8[_0x5b86('0x19')](0x194);}return _0x4cbaca;};}function handleError(_0x8aa9d5,_0x45867e){_0x45867e=_0x45867e||0x1f4;return function(_0x3c7cf3){logger[_0x5b86('0x26')](_0x3c7cf3[_0x5b86('0x27')]);if(_0x3c7cf3[_0x5b86('0x28')]){delete _0x3c7cf3[_0x5b86('0x28')];}_0x8aa9d5['status'](_0x45867e)[_0x5b86('0x29')](_0x3c7cf3);};}exports[_0x5b86('0x2a')]=function(_0x51f200,_0x102a77){var _0x2e8ced={},_0x11e939={},_0x57e37e={'count':0x0,'rows':[]};var _0x474693=_[_0x5b86('0x2b')](db['MailServerOut'][_0x5b86('0x2c')],function(_0x442d72){return{'name':_0x442d72['fieldName'],'type':_0x442d72[_0x5b86('0x2d')][_0x5b86('0x2e')]};});_0x11e939[_0x5b86('0x2f')]=_[_0x5b86('0x2b')](_0x474693,'name');_0x11e939[_0x5b86('0x30')]=_[_0x5b86('0x31')](_0x51f200[_0x5b86('0x30')]);_0x11e939[_0x5b86('0x32')]=_[_0x5b86('0x33')](_0x11e939['model'],_0x11e939['query']);_0x2e8ced[_0x5b86('0x34')]=_[_0x5b86('0x33')](_0x11e939[_0x5b86('0x2f')],qs[_0x5b86('0x35')](_0x51f200['query'][_0x5b86('0x35')]));_0x2e8ced[_0x5b86('0x34')]=_0x2e8ced[_0x5b86('0x34')][_0x5b86('0x36')]?_0x2e8ced[_0x5b86('0x34')]:_0x11e939[_0x5b86('0x2f')];if(!_0x51f200[_0x5b86('0x30')][_0x5b86('0x37')](_0x5b86('0x38'))){_0x2e8ced[_0x5b86('0x1c')]=qs[_0x5b86('0x1c')](_0x51f200[_0x5b86('0x30')][_0x5b86('0x1c')]);_0x2e8ced['offset']=qs[_0x5b86('0x1f')](_0x51f200[_0x5b86('0x30')][_0x5b86('0x1f')]);}_0x2e8ced[_0x5b86('0x39')]=qs['sort'](_0x51f200[_0x5b86('0x30')][_0x5b86('0x3a')]);_0x2e8ced[_0x5b86('0x3b')]=qs['filters'](_[_0x5b86('0x3c')](_0x51f200[_0x5b86('0x30')],_0x11e939[_0x5b86('0x32')]),_0x474693);if(_0x51f200['query']['filter']){_0x2e8ced[_0x5b86('0x3b')]=_[_0x5b86('0x3d')](_0x2e8ced[_0x5b86('0x3b')],{'$or':_[_0x5b86('0x2b')](_0x474693,function(_0x153b91){if(_0x153b91[_0x5b86('0x2d')]!==_0x5b86('0x3e')){var _0xd22b2a={};_0xd22b2a[_0x153b91[_0x5b86('0x28')]]={'$like':'%'+_0x51f200[_0x5b86('0x30')][_0x5b86('0x3f')]+'%'};return _0xd22b2a;}})});}_0x2e8ced=_[_0x5b86('0x3d')]({},_0x2e8ced,_0x51f200[_0x5b86('0x40')]);var _0x471b06={'where':_0x2e8ced[_0x5b86('0x3b')]};return db['MailServerOut'][_0x5b86('0x1e')](_0x471b06)[_0x5b86('0x24')](function(_0x2d12f8){_0x57e37e[_0x5b86('0x1e')]=_0x2d12f8;if(_0x51f200[_0x5b86('0x30')][_0x5b86('0x41')]){_0x2e8ced[_0x5b86('0x42')]=[{'all':!![]}];}return db[_0x5b86('0x43')][_0x5b86('0x44')](_0x2e8ced);})[_0x5b86('0x24')](function(_0x3e82e9){_0x57e37e[_0x5b86('0x45')]=_0x3e82e9;return _0x57e37e;})[_0x5b86('0x24')](respondWithFilteredResult(_0x102a77,_0x2e8ced))[_0x5b86('0x46')](handleError(_0x102a77,null));};exports[_0x5b86('0x47')]=function(_0x305768,_0x26d511){var _0x20e89e={'raw':!![],'where':{'id':_0x305768[_0x5b86('0x48')]['id']}},_0x41445a={};_0x41445a[_0x5b86('0x2f')]=_[_0x5b86('0x31')](db['MailServerOut'][_0x5b86('0x2c')]);_0x41445a['query']=_[_0x5b86('0x31')](_0x305768[_0x5b86('0x30')]);_0x41445a[_0x5b86('0x32')]=_[_0x5b86('0x33')](_0x41445a[_0x5b86('0x2f')],_0x41445a['query']);_0x20e89e[_0x5b86('0x34')]=_[_0x5b86('0x33')](_0x41445a[_0x5b86('0x2f')],qs[_0x5b86('0x35')](_0x305768[_0x5b86('0x30')][_0x5b86('0x35')]));_0x20e89e[_0x5b86('0x34')]=_0x20e89e[_0x5b86('0x34')][_0x5b86('0x36')]?_0x20e89e[_0x5b86('0x34')]:_0x41445a[_0x5b86('0x2f')];if(_0x305768['query'][_0x5b86('0x41')]){_0x20e89e[_0x5b86('0x42')]=[{'all':!![]}];}_0x20e89e=_[_0x5b86('0x3d')]({},_0x20e89e,_0x305768[_0x5b86('0x40')]);return db[_0x5b86('0x43')][_0x5b86('0x49')](_0x20e89e)[_0x5b86('0x24')](handleEntityNotFound(_0x26d511,null))[_0x5b86('0x24')](respondWithResult(_0x26d511,null))[_0x5b86('0x46')](handleError(_0x26d511,null));};exports[_0x5b86('0x4a')]=function(_0x9b8d82,_0x4654c1){return db[_0x5b86('0x43')][_0x5b86('0x4a')](_0x9b8d82[_0x5b86('0x4b')],{})[_0x5b86('0x24')](respondWithResult(_0x4654c1,0xc9))[_0x5b86('0x46')](handleError(_0x4654c1,null));};exports['update']=function(_0x323440,_0x134691){if(_0x323440[_0x5b86('0x4b')]['id']){delete _0x323440[_0x5b86('0x4b')]['id'];}return db[_0x5b86('0x43')][_0x5b86('0x49')]({'where':{'id':_0x323440[_0x5b86('0x48')]['id']}})[_0x5b86('0x24')](handleEntityNotFound(_0x134691,null))[_0x5b86('0x24')](saveUpdates(_0x323440[_0x5b86('0x4b')],null))[_0x5b86('0x24')](respondWithResult(_0x134691,null))[_0x5b86('0x46')](handleError(_0x134691,null));};exports['destroy']=function(_0x284786,_0x10b410){return db['MailServerOut'][_0x5b86('0x49')]({'where':{'id':_0x284786[_0x5b86('0x48')]['id']}})[_0x5b86('0x24')](handleEntityNotFound(_0x10b410,null))['then'](removeEntity(_0x10b410,null))['catch'](handleError(_0x10b410,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 1e733c9..5006967 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 _0x1729=['api','moment','bluebird','rimraf','../../config/environment','./mailServerOut.attributes','exports','MailServerOut','mail_servers_out','lodash','util'];(function(_0x4830fa,_0x6bc819){var _0x2f8d5b=function(_0x17704d){while(--_0x17704d){_0x4830fa['push'](_0x4830fa['shift']());}};_0x2f8d5b(++_0x6bc819);}(_0x1729,0xf0));var _0x9172=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x1729[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x9172('0x0'));var util=require(_0x9172('0x1'));var logger=require('../../config/logger')(_0x9172('0x2'));var moment=require(_0x9172('0x3'));var BPromise=require(_0x9172('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9172('0x5'));var config=require(_0x9172('0x6'));var attributes=require(_0x9172('0x7'));module[_0x9172('0x8')]=function(_0x29a0b9,_0x932d7f){return _0x29a0b9['define'](_0x9172('0x9'),attributes,{'tableName':_0x9172('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd547=['./mailServerOut.attributes','exports','MailServerOut','mail_servers_out','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x867b0a,_0x587ccf){var _0x137438=function(_0xbeafa6){while(--_0xbeafa6){_0x867b0a['push'](_0x867b0a['shift']());}};_0x137438(++_0x587ccf);}(_0xd547,0xdc));var _0x7d54=function(_0x468c3d,_0x4cb0c8){_0x468c3d=_0x468c3d-0x0;var _0x461549=_0xd547[_0x468c3d];return _0x461549;};'use strict';var _=require('lodash');var util=require(_0x7d54('0x0'));var logger=require(_0x7d54('0x1'))(_0x7d54('0x2'));var moment=require(_0x7d54('0x3'));var BPromise=require('bluebird');var rp=require(_0x7d54('0x4'));var fs=require('fs');var path=require(_0x7d54('0x5'));var rimraf=require(_0x7d54('0x6'));var config=require(_0x7d54('0x7'));var attributes=require(_0x7d54('0x8'));module[_0x7d54('0x9')]=function(_0x58da8e,_0x2940ca){return _0x58da8e['define'](_0x7d54('0xa'),attributes,{'tableName':_0x7d54('0xb'),'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 46bc131..e3385a0 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(_0x2cda48,_0x49b254){var _0x2fb41e=function(_0x5b9731){while(--_0x5b9731){_0x2cda48['push'](_0x2cda48['shift']());}};_0x2fb41e(++_0x49b254);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xc4aa[_0x1caf6a];return _0x1bf493;};'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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x4d91d6,_0x49071f){var _0x2bfee3=function(_0x3a2020){while(--_0x3a2020){_0x4d91d6['push'](_0x4d91d6['shift']());}};_0x2bfee3(++_0x49071f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x127d1d,_0x32fcdc){_0x127d1d=_0x127d1d-0x0;var _0x5848a3=_0x5f2f[_0x127d1d];return _0x5848a3;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index af66bd6..ece2d93 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 _0xc297=['show','post','put','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','index','/describe'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xc297,0x16a));var _0x7c29=function(_0x1a8bbc,_0x17a086){_0x1a8bbc=_0x1a8bbc-0x0;var _0x212fc2=_0xc297[_0x1a8bbc];return _0x212fc2;};'use strict';var multer=require('multer');var util=require(_0x7c29('0x0'));var path=require(_0x7c29('0x1'));var timeout=require(_0x7c29('0x2'));var express=require(_0x7c29('0x3'));var router=express[_0x7c29('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7c29('0x5'));var interaction=require(_0x7c29('0x6'));var config=require('../../config/environment');var controller=require(_0x7c29('0x7'));router[_0x7c29('0x8')]('/',auth[_0x7c29('0x9')](),controller[_0x7c29('0xa')]);router['get'](_0x7c29('0xb'),auth[_0x7c29('0x9')](),controller['describe']);router[_0x7c29('0x8')]('/:id',auth[_0x7c29('0x9')](),controller[_0x7c29('0xc')]);router[_0x7c29('0xd')]('/',auth[_0x7c29('0x9')](),controller['create']);router[_0x7c29('0xe')]('/:id',auth[_0x7c29('0x9')](),controller[_0x7c29('0xf')]);router['delete']('/:id',auth[_0x7c29('0x9')](),controller['destroy']);module[_0x7c29('0x10')]=router; \ No newline at end of file +var _0xd6aa=['Router','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','/describe','post','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express'];(function(_0x6c3a85,_0x11061e){var _0x8969fb=function(_0x4a57c5){while(--_0x4a57c5){_0x6c3a85['push'](_0x6c3a85['shift']());}};_0x8969fb(++_0x11061e);}(_0xd6aa,0xe6));var _0xad6a=function(_0x4ebff3,_0x327a1a){_0x4ebff3=_0x4ebff3-0x0;var _0x1b419d=_0xd6aa[_0x4ebff3];return _0x1b419d;};'use strict';var multer=require(_0xad6a('0x0'));var util=require(_0xad6a('0x1'));var path=require('path');var timeout=require(_0xad6a('0x2'));var express=require(_0xad6a('0x3'));var router=express[_0xad6a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xad6a('0x5'));var interaction=require(_0xad6a('0x6'));var config=require('../../config/environment');var controller=require(_0xad6a('0x7'));router[_0xad6a('0x8')]('/',auth[_0xad6a('0x9')](),controller['index']);router['get'](_0xad6a('0xa'),auth[_0xad6a('0x9')](),controller['describe']);router[_0xad6a('0x8')]('/:id',auth[_0xad6a('0x9')](),controller['show']);router[_0xad6a('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xad6a('0xc')]('/:id',auth[_0xad6a('0x9')](),controller[_0xad6a('0xd')]);router[_0xad6a('0xe')](_0xad6a('0xf'),auth[_0xad6a('0x9')](),controller[_0xad6a('0x10')]);module[_0xad6a('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index e8fc7f3..9b90b0b 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 _0x4317=['name','exports','STRING'];(function(_0x3d8c29,_0x11b887){var _0x31a1c3=function(_0x5dff10){while(--_0x5dff10){_0x3d8c29['push'](_0x3d8c29['shift']());}};_0x31a1c3(++_0x11b887);}(_0x4317,0x7c));var _0x7431=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x4317[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require('sequelize');module[_0x7431('0x0')]={'name':{'type':Sequelize[_0x7431('0x1')],'unique':_0x7431('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8ca9=['sequelize','exports','STRING','name'];(function(_0x31a576,_0x424419){var _0x30b1d3=function(_0x4710e8){while(--_0x4710e8){_0x31a576['push'](_0x31a576['shift']());}};_0x30b1d3(++_0x424419);}(_0x8ca9,0x9c));var _0x98ca=function(_0x2ffc18,_0x25327b){_0x2ffc18=_0x2ffc18-0x0;var _0x13dad7=_0x8ca9[_0x2ffc18];return _0x13dad7;};'use strict';var Sequelize=require(_0x98ca('0x0'));module[_0x98ca('0x1')]={'name':{'type':Sequelize[_0x98ca('0x2')],'unique':_0x98ca('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x98ca('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 33f7db3..3655634 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 _0xafab=['order','sort','where','filter','merge','includeAll','include','findAll','catch','params','fields','options','find','create','body','update','describe','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','MailSubstatus','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit'];(function(_0x38abbd,_0x547fa3){var _0x330555=function(_0x16355c){while(--_0x16355c){_0x38abbd['push'](_0x38abbd['shift']());}};_0x330555(++_0x547fa3);}(_0xafab,0x13d));var _0xbafa=function(_0x510886,_0x1f9fe3){_0x510886=_0x510886-0x0;var _0x5e776d=_0xafab[_0x510886];return _0x5e776d;};'use strict';var emlformat=require(_0xbafa('0x0'));var rimraf=require(_0xbafa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbafa('0x2'));var moment=require(_0xbafa('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbafa('0x4'));var util=require(_0xbafa('0x5'));var path=require(_0xbafa('0x6'));var sox=require(_0xbafa('0x7'));var csv=require(_0xbafa('0x8'));var ejs=require(_0xbafa('0x9'));var fs=require('fs');var fs_extra=require(_0xbafa('0xa'));var _=require(_0xbafa('0xb'));var squel=require(_0xbafa('0xc'));var crypto=require(_0xbafa('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbafa('0xe'));var authService=require(_0xbafa('0xf'));var qs=require(_0xbafa('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbafa('0x11'));var logger=require(_0xbafa('0x12'))(_0xbafa('0x13'));var utils=require(_0xbafa('0x14'));var config=require(_0xbafa('0x15'));var licenseUtil=require(_0xbafa('0x16'));var db=require(_0xbafa('0x17'))['db'];function respondWithStatusCode(_0x519d99,_0x1d7db7){_0x1d7db7=_0x1d7db7||0xcc;return function(_0x53237c){if(_0x53237c){return _0x519d99[_0xbafa('0x18')](_0x1d7db7);}return _0x519d99[_0xbafa('0x19')](_0x1d7db7)[_0xbafa('0x1a')]();};}function respondWithResult(_0x5b6fb5,_0x11e999){_0x11e999=_0x11e999||0xc8;return function(_0xe15b11){if(_0xe15b11){return _0x5b6fb5[_0xbafa('0x19')](_0x11e999)[_0xbafa('0x1b')](_0xe15b11);}};}function respondWithFilteredResult(_0x4d4b1f,_0x4951e0){return function(_0x19799c){if(_0x19799c){var _0x31f4a3=typeof _0x4951e0[_0xbafa('0x1c')]===_0xbafa('0x1d')&&typeof _0x4951e0['limit']===_0xbafa('0x1d');var _0x8575cc=_0x19799c[_0xbafa('0x1e')];var _0x5f3caf=_0x31f4a3?0x0:_0x4951e0[_0xbafa('0x1c')];var _0x87e1a1=_0x31f4a3?_0x19799c['count']:_0x4951e0[_0xbafa('0x1c')]+_0x4951e0[_0xbafa('0x1f')];var _0x17581d;if(_0x87e1a1>=_0x8575cc){_0x87e1a1=_0x8575cc;_0x17581d=0xc8;}else{_0x17581d=0xce;}_0x4d4b1f[_0xbafa('0x19')](_0x17581d);return _0x4d4b1f[_0xbafa('0x20')](_0xbafa('0x21'),_0x5f3caf+'-'+_0x87e1a1+'/'+_0x8575cc)[_0xbafa('0x1b')](_0x19799c);}return null;};}function patchUpdates(_0x11a5aa){return function(_0x482083){try{jsonpatch[_0xbafa('0x22')](_0x482083,_0x11a5aa,!![]);}catch(_0x13785c){return BPromise[_0xbafa('0x23')](_0x13785c);}return _0x482083[_0xbafa('0x24')]();};}function saveUpdates(_0x283704,_0x91051b){return function(_0x3efd4c){if(_0x3efd4c){return _0x3efd4c['update'](_0x283704)[_0xbafa('0x25')](function(_0x469f35){return _0x469f35;});}return null;};}function removeEntity(_0x4398cc,_0x14b74e){return function(_0x4089b1){if(_0x4089b1){return _0x4089b1[_0xbafa('0x26')]()[_0xbafa('0x25')](function(){_0x4398cc[_0xbafa('0x19')](0xcc)[_0xbafa('0x1a')]();});}};}function handleEntityNotFound(_0x44988f,_0x1584a8){return function(_0x56be10){if(!_0x56be10){_0x44988f[_0xbafa('0x18')](0x194);}return _0x56be10;};}function handleError(_0x40487d,_0x444ec5){_0x444ec5=_0x444ec5||0x1f4;return function(_0x37b2bf){logger[_0xbafa('0x27')](_0x37b2bf[_0xbafa('0x28')]);if(_0x37b2bf[_0xbafa('0x29')]){delete _0x37b2bf[_0xbafa('0x29')];}_0x40487d['status'](_0x444ec5)[_0xbafa('0x2a')](_0x37b2bf);};}exports[_0xbafa('0x2b')]=function(_0x7bd027,_0x587bf8){var _0xfcec8e={},_0x51deff={},_0x55ef6f={'count':0x0,'rows':[]};var _0x55f4db=_[_0xbafa('0x2c')](db[_0xbafa('0x2d')][_0xbafa('0x2e')],function(_0x813a92){return{'name':_0x813a92['fieldName'],'type':_0x813a92[_0xbafa('0x2f')][_0xbafa('0x30')]};});_0x51deff[_0xbafa('0x31')]=_[_0xbafa('0x2c')](_0x55f4db,_0xbafa('0x29'));_0x51deff[_0xbafa('0x32')]=_[_0xbafa('0x33')](_0x7bd027[_0xbafa('0x32')]);_0x51deff[_0xbafa('0x34')]=_[_0xbafa('0x35')](_0x51deff['model'],_0x51deff[_0xbafa('0x32')]);_0xfcec8e[_0xbafa('0x36')]=_[_0xbafa('0x35')](_0x51deff['model'],qs['fields'](_0x7bd027[_0xbafa('0x32')]['fields']));_0xfcec8e[_0xbafa('0x36')]=_0xfcec8e[_0xbafa('0x36')][_0xbafa('0x37')]?_0xfcec8e[_0xbafa('0x36')]:_0x51deff['model'];if(!_0x7bd027[_0xbafa('0x32')][_0xbafa('0x38')](_0xbafa('0x39'))){_0xfcec8e['limit']=qs[_0xbafa('0x1f')](_0x7bd027[_0xbafa('0x32')][_0xbafa('0x1f')]);_0xfcec8e[_0xbafa('0x1c')]=qs[_0xbafa('0x1c')](_0x7bd027[_0xbafa('0x32')]['offset']);}_0xfcec8e[_0xbafa('0x3a')]=qs['sort'](_0x7bd027[_0xbafa('0x32')][_0xbafa('0x3b')]);_0xfcec8e[_0xbafa('0x3c')]=qs['filters'](_['pick'](_0x7bd027[_0xbafa('0x32')],_0x51deff['filters']),_0x55f4db);if(_0x7bd027['query'][_0xbafa('0x3d')]){_0xfcec8e[_0xbafa('0x3c')]=_[_0xbafa('0x3e')](_0xfcec8e[_0xbafa('0x3c')],{'$or':_[_0xbafa('0x2c')](_0x55f4db,function(_0x240e5b){if(_0x240e5b[_0xbafa('0x2f')]!=='VIRTUAL'){var _0x46f583={};_0x46f583[_0x240e5b[_0xbafa('0x29')]]={'$like':'%'+_0x7bd027[_0xbafa('0x32')][_0xbafa('0x3d')]+'%'};return _0x46f583;}})});}_0xfcec8e=_[_0xbafa('0x3e')]({},_0xfcec8e,_0x7bd027['options']);var _0x47f05f={'where':_0xfcec8e[_0xbafa('0x3c')]};return db[_0xbafa('0x2d')][_0xbafa('0x1e')](_0x47f05f)[_0xbafa('0x25')](function(_0x237ffe){_0x55ef6f[_0xbafa('0x1e')]=_0x237ffe;if(_0x7bd027[_0xbafa('0x32')][_0xbafa('0x3f')]){_0xfcec8e[_0xbafa('0x40')]=[{'all':!![]}];}return db[_0xbafa('0x2d')][_0xbafa('0x41')](_0xfcec8e);})[_0xbafa('0x25')](function(_0x544e07){_0x55ef6f['rows']=_0x544e07;return _0x55ef6f;})[_0xbafa('0x25')](respondWithFilteredResult(_0x587bf8,_0xfcec8e))[_0xbafa('0x42')](handleError(_0x587bf8,null));};exports['show']=function(_0x142b33,_0x117186){var _0x5ce16a={'raw':!![],'where':{'id':_0x142b33[_0xbafa('0x43')]['id']}},_0x45e09b={};_0x45e09b[_0xbafa('0x31')]=_[_0xbafa('0x33')](db['MailSubstatus'][_0xbafa('0x2e')]);_0x45e09b[_0xbafa('0x32')]=_[_0xbafa('0x33')](_0x142b33[_0xbafa('0x32')]);_0x45e09b['filters']=_[_0xbafa('0x35')](_0x45e09b['model'],_0x45e09b[_0xbafa('0x32')]);_0x5ce16a[_0xbafa('0x36')]=_[_0xbafa('0x35')](_0x45e09b[_0xbafa('0x31')],qs['fields'](_0x142b33[_0xbafa('0x32')][_0xbafa('0x44')]));_0x5ce16a[_0xbafa('0x36')]=_0x5ce16a['attributes']['length']?_0x5ce16a[_0xbafa('0x36')]:_0x45e09b[_0xbafa('0x31')];if(_0x142b33[_0xbafa('0x32')]['includeAll']){_0x5ce16a[_0xbafa('0x40')]=[{'all':!![]}];}_0x5ce16a=_['merge']({},_0x5ce16a,_0x142b33[_0xbafa('0x45')]);return db[_0xbafa('0x2d')][_0xbafa('0x46')](_0x5ce16a)[_0xbafa('0x25')](handleEntityNotFound(_0x117186,null))[_0xbafa('0x25')](respondWithResult(_0x117186,null))[_0xbafa('0x42')](handleError(_0x117186,null));};exports[_0xbafa('0x47')]=function(_0x1e29b8,_0x2cb5ac){return db[_0xbafa('0x2d')][_0xbafa('0x47')](_0x1e29b8[_0xbafa('0x48')],{})[_0xbafa('0x25')](respondWithResult(_0x2cb5ac,0xc9))['catch'](handleError(_0x2cb5ac,null));};exports[_0xbafa('0x49')]=function(_0x29fc99,_0x5d7d8a){if(_0x29fc99[_0xbafa('0x48')]['id']){delete _0x29fc99[_0xbafa('0x48')]['id'];}return db[_0xbafa('0x2d')]['find']({'where':{'id':_0x29fc99[_0xbafa('0x43')]['id']}})[_0xbafa('0x25')](handleEntityNotFound(_0x5d7d8a,null))[_0xbafa('0x25')](saveUpdates(_0x29fc99['body'],null))[_0xbafa('0x25')](respondWithResult(_0x5d7d8a,null))[_0xbafa('0x42')](handleError(_0x5d7d8a,null));};exports[_0xbafa('0x26')]=function(_0x24b6e8,_0x43baac){return db['MailSubstatus']['find']({'where':{'id':_0x24b6e8[_0xbafa('0x43')]['id']}})['then'](handleEntityNotFound(_0x43baac,null))['then'](removeEntity(_0x43baac,null))[_0xbafa('0x42')](handleError(_0x43baac,null));};exports['describe']=function(_0x3da7d2,_0x2795a0){return db[_0xbafa('0x2d')][_0xbafa('0x4a')]()[_0xbafa('0x25')](respondWithResult(_0x2795a0,null))[_0xbafa('0x42')](handleError(_0x2795a0,null));}; \ No newline at end of file +var _0x3324=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','pick','where','merge','VIRTUAL','filter','options','MailSubstatus','include','findAll','rows','catch','show','params','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring'];(function(_0x3eaa6e,_0x554e7e){var _0x26bc33=function(_0x524909){while(--_0x524909){_0x3eaa6e['push'](_0x3eaa6e['shift']());}};_0x26bc33(++_0x554e7e);}(_0x3324,0x15e));var _0x4332=function(_0x1ef9ef,_0x197016){_0x1ef9ef=_0x1ef9ef-0x0;var _0x1f42b8=_0x3324[_0x1ef9ef];return _0x1f42b8;};'use strict';var emlformat=require(_0x4332('0x0'));var rimraf=require(_0x4332('0x1'));var zipdir=require(_0x4332('0x2'));var jsonpatch=require(_0x4332('0x3'));var rp=require('request-promise');var moment=require(_0x4332('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4332('0x5'));var util=require(_0x4332('0x6'));var path=require(_0x4332('0x7'));var sox=require(_0x4332('0x8'));var csv=require(_0x4332('0x9'));var ejs=require(_0x4332('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4332('0xb'));var squel=require('squel');var crypto=require(_0x4332('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4332('0xd'));var toCsv=require(_0x4332('0x9'));var querystring=require(_0x4332('0xe'));var Papa=require('papaparse');var Redis=require(_0x4332('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4332('0x10'));var as=require(_0x4332('0x11'));var hardwareService=require(_0x4332('0x12'));var logger=require(_0x4332('0x13'))(_0x4332('0x14'));var utils=require('../../config/utils');var config=require(_0x4332('0x15'));var licenseUtil=require(_0x4332('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58d8db,_0x263aef){_0x263aef=_0x263aef||0xcc;return function(_0x2b476c){if(_0x2b476c){return _0x58d8db['sendStatus'](_0x263aef);}return _0x58d8db[_0x4332('0x17')](_0x263aef)[_0x4332('0x18')]();};}function respondWithResult(_0x5add2d,_0x56cf55){_0x56cf55=_0x56cf55||0xc8;return function(_0xd81549){if(_0xd81549){return _0x5add2d[_0x4332('0x17')](_0x56cf55)[_0x4332('0x19')](_0xd81549);}};}function respondWithFilteredResult(_0x2911e9,_0x11fd9c){return function(_0x52784c){if(_0x52784c){var _0x3bb0e8=typeof _0x11fd9c[_0x4332('0x1a')]===_0x4332('0x1b')&&typeof _0x11fd9c[_0x4332('0x1c')]===_0x4332('0x1b');var _0x308317=_0x52784c['count'];var _0x47aed5=_0x3bb0e8?0x0:_0x11fd9c[_0x4332('0x1a')];var _0x290361=_0x3bb0e8?_0x52784c[_0x4332('0x1d')]:_0x11fd9c[_0x4332('0x1a')]+_0x11fd9c[_0x4332('0x1c')];var _0x5dca43;if(_0x290361>=_0x308317){_0x290361=_0x308317;_0x5dca43=0xc8;}else{_0x5dca43=0xce;}_0x2911e9[_0x4332('0x17')](_0x5dca43);return _0x2911e9[_0x4332('0x1e')]('Content-Range',_0x47aed5+'-'+_0x290361+'/'+_0x308317)[_0x4332('0x19')](_0x52784c);}return null;};}function patchUpdates(_0x3d1563){return function(_0x58e3dd){try{jsonpatch[_0x4332('0x1f')](_0x58e3dd,_0x3d1563,!![]);}catch(_0x3886db){return BPromise[_0x4332('0x20')](_0x3886db);}return _0x58e3dd[_0x4332('0x21')]();};}function saveUpdates(_0x172864,_0x52f259){return function(_0x28e37c){if(_0x28e37c){return _0x28e37c[_0x4332('0x22')](_0x172864)[_0x4332('0x23')](function(_0xd01902){return _0xd01902;});}return null;};}function removeEntity(_0x4ad2d7,_0x578b99){return function(_0x1a8841){if(_0x1a8841){return _0x1a8841[_0x4332('0x24')]()[_0x4332('0x23')](function(){_0x4ad2d7[_0x4332('0x17')](0xcc)[_0x4332('0x18')]();});}};}function handleEntityNotFound(_0x529eaa,_0x2569ec){return function(_0x18299e){if(!_0x18299e){_0x529eaa[_0x4332('0x25')](0x194);}return _0x18299e;};}function handleError(_0x48cf7a,_0x27b401){_0x27b401=_0x27b401||0x1f4;return function(_0x540c17){logger['error'](_0x540c17['stack']);if(_0x540c17[_0x4332('0x26')]){delete _0x540c17[_0x4332('0x26')];}_0x48cf7a[_0x4332('0x17')](_0x27b401)[_0x4332('0x27')](_0x540c17);};}exports[_0x4332('0x28')]=function(_0x171132,_0x513652){var _0x1221fc={},_0x5ce804={},_0xa9ad0a={'count':0x0,'rows':[]};var _0x5db779=_[_0x4332('0x29')](db['MailSubstatus'][_0x4332('0x2a')],function(_0x1afeec){return{'name':_0x1afeec[_0x4332('0x2b')],'type':_0x1afeec[_0x4332('0x2c')][_0x4332('0x2d')]};});_0x5ce804[_0x4332('0x2e')]=_[_0x4332('0x29')](_0x5db779,_0x4332('0x26'));_0x5ce804[_0x4332('0x2f')]=_[_0x4332('0x30')](_0x171132[_0x4332('0x2f')]);_0x5ce804[_0x4332('0x31')]=_[_0x4332('0x32')](_0x5ce804[_0x4332('0x2e')],_0x5ce804[_0x4332('0x2f')]);_0x1221fc[_0x4332('0x33')]=_[_0x4332('0x32')](_0x5ce804[_0x4332('0x2e')],qs[_0x4332('0x34')](_0x171132[_0x4332('0x2f')]['fields']));_0x1221fc[_0x4332('0x33')]=_0x1221fc[_0x4332('0x33')][_0x4332('0x35')]?_0x1221fc['attributes']:_0x5ce804['model'];if(!_0x171132[_0x4332('0x2f')]['hasOwnProperty']('nolimit')){_0x1221fc[_0x4332('0x1c')]=qs[_0x4332('0x1c')](_0x171132[_0x4332('0x2f')][_0x4332('0x1c')]);_0x1221fc[_0x4332('0x1a')]=qs[_0x4332('0x1a')](_0x171132['query']['offset']);}_0x1221fc['order']=qs[_0x4332('0x36')](_0x171132[_0x4332('0x2f')][_0x4332('0x36')]);_0x1221fc['where']=qs['filters'](_[_0x4332('0x37')](_0x171132[_0x4332('0x2f')],_0x5ce804[_0x4332('0x31')]),_0x5db779);if(_0x171132[_0x4332('0x2f')]['filter']){_0x1221fc[_0x4332('0x38')]=_[_0x4332('0x39')](_0x1221fc['where'],{'$or':_[_0x4332('0x29')](_0x5db779,function(_0x1ac5fd){if(_0x1ac5fd[_0x4332('0x2c')]!==_0x4332('0x3a')){var _0xd19e70={};_0xd19e70[_0x1ac5fd[_0x4332('0x26')]]={'$like':'%'+_0x171132[_0x4332('0x2f')][_0x4332('0x3b')]+'%'};return _0xd19e70;}})});}_0x1221fc=_['merge']({},_0x1221fc,_0x171132[_0x4332('0x3c')]);var _0x1c6bf0={'where':_0x1221fc[_0x4332('0x38')]};return db[_0x4332('0x3d')]['count'](_0x1c6bf0)[_0x4332('0x23')](function(_0x2601b5){_0xa9ad0a[_0x4332('0x1d')]=_0x2601b5;if(_0x171132['query']['includeAll']){_0x1221fc[_0x4332('0x3e')]=[{'all':!![]}];}return db[_0x4332('0x3d')][_0x4332('0x3f')](_0x1221fc);})[_0x4332('0x23')](function(_0x56bc8c){_0xa9ad0a[_0x4332('0x40')]=_0x56bc8c;return _0xa9ad0a;})['then'](respondWithFilteredResult(_0x513652,_0x1221fc))[_0x4332('0x41')](handleError(_0x513652,null));};exports[_0x4332('0x42')]=function(_0x38fe10,_0x4331f8){var _0x1819dc={'raw':!![],'where':{'id':_0x38fe10[_0x4332('0x43')]['id']}},_0x523d2c={};_0x523d2c[_0x4332('0x2e')]=_[_0x4332('0x30')](db[_0x4332('0x3d')][_0x4332('0x2a')]);_0x523d2c[_0x4332('0x2f')]=_[_0x4332('0x30')](_0x38fe10['query']);_0x523d2c['filters']=_[_0x4332('0x32')](_0x523d2c[_0x4332('0x2e')],_0x523d2c[_0x4332('0x2f')]);_0x1819dc[_0x4332('0x33')]=_[_0x4332('0x32')](_0x523d2c['model'],qs[_0x4332('0x34')](_0x38fe10[_0x4332('0x2f')]['fields']));_0x1819dc[_0x4332('0x33')]=_0x1819dc[_0x4332('0x33')][_0x4332('0x35')]?_0x1819dc[_0x4332('0x33')]:_0x523d2c[_0x4332('0x2e')];if(_0x38fe10[_0x4332('0x2f')][_0x4332('0x44')]){_0x1819dc[_0x4332('0x3e')]=[{'all':!![]}];}_0x1819dc=_['merge']({},_0x1819dc,_0x38fe10[_0x4332('0x3c')]);return db[_0x4332('0x3d')]['find'](_0x1819dc)['then'](handleEntityNotFound(_0x4331f8,null))[_0x4332('0x23')](respondWithResult(_0x4331f8,null))[_0x4332('0x41')](handleError(_0x4331f8,null));};exports['create']=function(_0x5d748a,_0xf2188f){return db['MailSubstatus'][_0x4332('0x45')](_0x5d748a[_0x4332('0x46')],{})[_0x4332('0x23')](respondWithResult(_0xf2188f,0xc9))['catch'](handleError(_0xf2188f,null));};exports['update']=function(_0x594d49,_0x242620){if(_0x594d49[_0x4332('0x46')]['id']){delete _0x594d49['body']['id'];}return db['MailSubstatus'][_0x4332('0x47')]({'where':{'id':_0x594d49[_0x4332('0x43')]['id']}})[_0x4332('0x23')](handleEntityNotFound(_0x242620,null))[_0x4332('0x23')](saveUpdates(_0x594d49[_0x4332('0x46')],null))['then'](respondWithResult(_0x242620,null))[_0x4332('0x41')](handleError(_0x242620,null));};exports['destroy']=function(_0x5bd5ae,_0x4d0120){return db[_0x4332('0x3d')][_0x4332('0x47')]({'where':{'id':_0x5bd5ae[_0x4332('0x43')]['id']}})[_0x4332('0x23')](handleEntityNotFound(_0x4d0120,null))['then'](removeEntity(_0x4d0120,null))[_0x4332('0x41')](handleError(_0x4d0120,null));};exports[_0x4332('0x48')]=function(_0x31e9a9,_0x151bff){return db[_0x4332('0x3d')][_0x4332('0x48')]()['then'](respondWithResult(_0x151bff,null))[_0x4332('0x41')](handleError(_0x151bff,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index c3763de..54d1dd7 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 _0xa93d=['hasOwnProperty','hook','exports','events','MailSubstatus','setMaxListeners','update','emit'];(function(_0x4389d6,_0x58768d){var _0x3f279b=function(_0x1a4764){while(--_0x1a4764){_0x4389d6['push'](_0x4389d6['shift']());}};_0x3f279b(++_0x58768d);}(_0xa93d,0x18b));var _0xda93=function(_0x136032,_0xe0aa1e){_0x136032=_0x136032-0x0;var _0x109a79=_0xa93d[_0x136032];return _0x109a79;};'use strict';var EventEmitter=require(_0xda93('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0xda93('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xda93('0x2')](0x0);var events={'afterUpdate':_0xda93('0x3')};function emitEvent(_0x5e7889){return function(_0x3ce5b2,_0x565990,_0x3e885b){MailSubstatusEvents['emit'](_0x5e7889+':'+_0x3ce5b2['id'],_0x3ce5b2);MailSubstatusEvents[_0xda93('0x4')](_0x5e7889,_0x3ce5b2);_0x3e885b(null);};}for(var e in events){if(events[_0xda93('0x5')](e)){var event=events[e];MailSubstatus[_0xda93('0x6')](e,emitEvent(event));}}module[_0xda93('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0x491a=['events','../../mysqldb','MailSubstatus','update','emit','exports'];(function(_0x3d03e4,_0x2b855c){var _0x227fea=function(_0x36e419){while(--_0x36e419){_0x3d03e4['push'](_0x3d03e4['shift']());}};_0x227fea(++_0x2b855c);}(_0x491a,0x1c2));var _0xa491=function(_0x1fd4d7,_0x2feafd){_0x1fd4d7=_0x1fd4d7-0x0;var _0x7efe8a=_0x491a[_0x1fd4d7];return _0x7efe8a;};'use strict';var EventEmitter=require(_0xa491('0x0'));var MailSubstatus=require(_0xa491('0x1'))['db'][_0xa491('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0xa491('0x3')};function emitEvent(_0x1c2ff5){return function(_0x89e2da,_0x59837c,_0x2aa3f8){MailSubstatusEvents[_0xa491('0x4')](_0x1c2ff5+':'+_0x89e2da['id'],_0x89e2da);MailSubstatusEvents[_0xa491('0x4')](_0x1c2ff5,_0x89e2da);_0x2aa3f8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0xa491('0x5')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 80d0d15..2155d97 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 _0xa122=['name','mailSubstatus','_previousDataValues','then','catch','MailSubstatus','mail_substatuses'];(function(_0x1c1589,_0x44d1fd){var _0x17792d=function(_0x2e9ed1){while(--_0x2e9ed1){_0x1c1589['push'](_0x1c1589['shift']());}};_0x17792d(++_0x44d1fd);}(_0xa122,0x116));var _0x2a12=function(_0x4e9e2b,_0x337519){_0x4e9e2b=_0x4e9e2b-0x0;var _0x1c1965=_0xa122[_0x4e9e2b];return _0x1c1965;};'use strict';var attributes=require('./mailSubstatus.attributes');module['exports']=function(_0x5577f1){var _0x44ca26=_0x5577f1['models'];return _0x5577f1['define'](_0x2a12('0x0'),attributes,{'tableName':_0x2a12('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x4e4ed7,_0x4c9eed,_0x10a731){return _0x44ca26['Condition']['update']({'value':_0x4e4ed7[_0x2a12('0x2')]},{'where':{'field':_0x2a12('0x3'),'value':_0x4e4ed7[_0x2a12('0x4')][_0x2a12('0x2')]}})[_0x2a12('0x5')](function(){_0x10a731();})[_0x2a12('0x6')](function(_0x54b660){_0x10a731(_0x54b660);});}}});}; \ No newline at end of file +var _0x7816=['update','name','mailSubstatus','catch','./mailSubstatus.attributes','exports','models','define','mail_substatuses'];(function(_0x6dd5c,_0x4bfc19){var _0x5a87fa=function(_0x3b068b){while(--_0x3b068b){_0x6dd5c['push'](_0x6dd5c['shift']());}};_0x5a87fa(++_0x4bfc19);}(_0x7816,0x13f));var _0x6781=function(_0x5e82ae,_0x1bf62f){_0x5e82ae=_0x5e82ae-0x0;var _0x2e3d18=_0x7816[_0x5e82ae];return _0x2e3d18;};'use strict';var attributes=require(_0x6781('0x0'));module[_0x6781('0x1')]=function(_0x358ae1){var _0x4750a8=_0x358ae1[_0x6781('0x2')];return _0x358ae1[_0x6781('0x3')]('MailSubstatus',attributes,{'tableName':_0x6781('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0xbced80,_0x894852,_0x35785d){return _0x4750a8['Condition'][_0x6781('0x5')]({'value':_0xbced80[_0x6781('0x6')]},{'where':{'field':_0x6781('0x7'),'value':_0xbced80['_previousDataValues'][_0x6781('0x6')]}})['then'](function(){_0x35785d();})[_0x6781('0x8')](function(_0x1a6570){_0x35785d(_0x1a6570);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 8078251..50253d5 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 _0x4e54=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x55f4ed,_0x14fc4d){var _0x369343=function(_0x26465e){while(--_0x26465e){_0x55f4ed['push'](_0x55f4ed['shift']());}};_0x369343(++_0x14fc4d);}(_0x4e54,0x12c));var _0x44e5=function(_0x315971,_0x53646e){_0x315971=_0x315971-0x0;var _0x262c48=_0x4e54[_0x315971];return _0x262c48;};'use strict';var _=require(_0x44e5('0x0'));var util=require(_0x44e5('0x1'));var moment=require(_0x44e5('0x2'));var BPromise=require(_0x44e5('0x3'));var rs=require(_0x44e5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x44e5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x44e5('0x6'))(_0x44e5('0x7'));var config=require(_0x44e5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x44e5('0x9')][_0x44e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x454b70,_0x1027b0,_0x43fd08){return new BPromise(function(_0x50d977,_0x4e18e6){return client[_0x44e5('0xb')](_0x454b70,_0x43fd08)[_0x44e5('0xc')](function(_0x3139d4){logger[_0x44e5('0xd')](_0x44e5('0xe'),_0x1027b0,_0x44e5('0xf'));logger['debug'](_0x44e5('0x10'),_0x1027b0,'request\x20sent',JSON[_0x44e5('0x11')](_0x3139d4));if(_0x3139d4[_0x44e5('0x12')]){if(_0x3139d4['error'][_0x44e5('0x13')]===0x1f4){logger[_0x44e5('0x12')](_0x44e5('0xe'),_0x1027b0,_0x3139d4['error'][_0x44e5('0x14')]);return _0x4e18e6(_0x3139d4[_0x44e5('0x12')][_0x44e5('0x14')]);}logger[_0x44e5('0x12')](_0x44e5('0xe'),_0x1027b0,_0x3139d4['error'][_0x44e5('0x14')]);return _0x50d977(_0x3139d4['error'][_0x44e5('0x14')]);}else{logger['info'](_0x44e5('0xe'),_0x1027b0,'request\x20sent');_0x50d977(_0x3139d4[_0x44e5('0x15')][_0x44e5('0x14')]);}})[_0x44e5('0x16')](function(_0x47fbd5){logger['error'](_0x44e5('0xe'),_0x1027b0,_0x47fbd5);_0x4e18e6(_0x47fbd5);});});} \ No newline at end of file +var _0x8b9e=['../../config/utils','rpc','client','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8b9e,0x19e));var _0xe8b9=function(_0x1d2c76,_0x4fd0e5){_0x1d2c76=_0x1d2c76-0x0;var _0x4cf6fc=_0x8b9e[_0x1d2c76];return _0x4cf6fc;};'use strict';var _=require(_0xe8b9('0x0'));var util=require(_0xe8b9('0x1'));var moment=require(_0xe8b9('0x2'));var BPromise=require('bluebird');var rs=require(_0xe8b9('0x3'));var fs=require('fs');var Redis=require(_0xe8b9('0x4'));var db=require(_0xe8b9('0x5'))['db'];var utils=require(_0xe8b9('0x6'));var logger=require('../../config/logger')(_0xe8b9('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe8b9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13ec84,_0x731c80,_0x1ce327){return new BPromise(function(_0x2374e9,_0x1039dd){return client[_0xe8b9('0x9')](_0x13ec84,_0x1ce327)['then'](function(_0x151d1c){logger[_0xe8b9('0xa')](_0xe8b9('0xb'),_0x731c80,_0xe8b9('0xc'));logger[_0xe8b9('0xd')](_0xe8b9('0xe'),_0x731c80,'request\x20sent',JSON['stringify'](_0x151d1c));if(_0x151d1c[_0xe8b9('0xf')]){if(_0x151d1c[_0xe8b9('0xf')][_0xe8b9('0x10')]===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x731c80,_0x151d1c['error'][_0xe8b9('0x11')]);return _0x1039dd(_0x151d1c[_0xe8b9('0xf')][_0xe8b9('0x11')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x731c80,_0x151d1c[_0xe8b9('0xf')][_0xe8b9('0x11')]);return _0x2374e9(_0x151d1c[_0xe8b9('0xf')][_0xe8b9('0x11')]);}else{logger[_0xe8b9('0xa')]('MailSubstatus,\x20%s,\x20%s',_0x731c80,_0xe8b9('0xc'));_0x2374e9(_0x151d1c[_0xe8b9('0x12')][_0xe8b9('0x11')]);}})[_0xe8b9('0x13')](function(_0x46ed49){logger[_0xe8b9('0xf')](_0xe8b9('0xb'),_0x731c80,_0x46ed49);_0x1039dd(_0x46ed49);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 9f73a5e..79edc05 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 _0x8eac=['show','post','put','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id'];(function(_0x52ca59,_0x279dda){var _0x1ab7e5=function(_0x2b8c74){while(--_0x2b8c74){_0x52ca59['push'](_0x52ca59['shift']());}};_0x1ab7e5(++_0x279dda);}(_0x8eac,0x14a));var _0xc8ea=function(_0x261b08,_0x563d91){_0x261b08=_0x261b08-0x0;var _0xeeaf84=_0x8eac[_0x261b08];return _0xeeaf84;};'use strict';var multer=require('multer');var util=require(_0xc8ea('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc8ea('0x1'));var router=express[_0xc8ea('0x2')]();var fs_extra=require(_0xc8ea('0x3'));var auth=require(_0xc8ea('0x4'));var interaction=require(_0xc8ea('0x5'));var config=require(_0xc8ea('0x6'));var controller=require('./mailTransferReport.controller');router[_0xc8ea('0x7')]('/',auth['isAuthenticated'](),controller[_0xc8ea('0x8')]);router[_0xc8ea('0x7')]('/describe',auth[_0xc8ea('0x9')](),controller[_0xc8ea('0xa')]);router['get'](_0xc8ea('0xb'),auth[_0xc8ea('0x9')](),controller[_0xc8ea('0xc')]);router[_0xc8ea('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc8ea('0xe')](_0xc8ea('0xb'),auth[_0xc8ea('0x9')](),controller[_0xc8ea('0xf')]);router[_0xc8ea('0x10')](_0xc8ea('0xb'),auth[_0xc8ea('0x9')](),controller[_0xc8ea('0x11')]);module[_0xc8ea('0x12')]=router; \ No newline at end of file +var _0x03be=['/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./mailTransferReport.controller','get','isAuthenticated','index','describe'];(function(_0x466f51,_0x1393ed){var _0x2db305=function(_0x126ae3){while(--_0x126ae3){_0x466f51['push'](_0x466f51['shift']());}};_0x2db305(++_0x1393ed);}(_0x03be,0x143));var _0xe03b=function(_0x2e0d63,_0x2fe00f){_0x2e0d63=_0x2e0d63-0x0;var _0xf4943d=_0x03be[_0x2e0d63];return _0xf4943d;};'use strict';var multer=require(_0xe03b('0x0'));var util=require(_0xe03b('0x1'));var path=require(_0xe03b('0x2'));var timeout=require(_0xe03b('0x3'));var express=require(_0xe03b('0x4'));var router=express[_0xe03b('0x5')]();var fs_extra=require(_0xe03b('0x6'));var auth=require(_0xe03b('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe03b('0x8'));router[_0xe03b('0x9')]('/',auth[_0xe03b('0xa')](),controller[_0xe03b('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xe03b('0xc')]);router[_0xe03b('0x9')](_0xe03b('0xd'),auth[_0xe03b('0xa')](),controller[_0xe03b('0xe')]);router[_0xe03b('0xf')]('/',auth['isAuthenticated'](),controller[_0xe03b('0x10')]);router[_0xe03b('0x11')](_0xe03b('0xd'),auth[_0xe03b('0xa')](),controller[_0xe03b('0x12')]);router[_0xe03b('0x13')](_0xe03b('0xd'),auth[_0xe03b('0xa')](),controller[_0xe03b('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 3f41ec4..44d0b88 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x4a15b3,_0x3463ce){var _0x4de43f=function(_0x314c35){while(--_0x314c35){_0x4a15b3['push'](_0x4a15b3['shift']());}};_0x4de43f(++_0x3463ce);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x568363,_0x2e79a7){_0x568363=_0x568363-0x0;var _0x47f0ed=_0xf3cd[_0x568363];return _0x47f0ed;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x777641,_0x19607d){var _0x54a378=function(_0x501b92){while(--_0x501b92){_0x777641['push'](_0x777641['shift']());}};_0x54a378(++_0x19607d);}(_0x34e8,0x12c));var _0x834e=function(_0x3de875,_0x3b5a25){_0x3de875=_0x3de875-0x0;var _0x467e9d=_0x34e8[_0x3de875];return _0x467e9d;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index d966bbb..d1f7e59 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 _0x267b=['type','model','map','query','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','Content-Range','reject','save','update','destroy','then','end','error','name','send','index','MailTransferReport','rawAttributes'];(function(_0xe2fbb6,_0x405640){var _0x558791=function(_0x8d23f7){while(--_0x8d23f7){_0xe2fbb6['push'](_0xe2fbb6['shift']());}};_0x558791(++_0x405640);}(_0x267b,0x1d7));var _0xb267=function(_0x1e85e9,_0x49674c){_0x1e85e9=_0x1e85e9-0x0;var _0x55dd2f=_0x267b[_0x1e85e9];return _0x55dd2f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb267('0x0'));var jsonpatch=require(_0xb267('0x1'));var rp=require(_0xb267('0x2'));var moment=require(_0xb267('0x3'));var BPromise=require(_0xb267('0x4'));var Mustache=require(_0xb267('0x5'));var util=require(_0xb267('0x6'));var path=require(_0xb267('0x7'));var sox=require('sox');var csv=require(_0xb267('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb267('0x9'));var _=require(_0xb267('0xa'));var squel=require(_0xb267('0xb'));var crypto=require(_0xb267('0xc'));var jsforce=require(_0xb267('0xd'));var deskjs=require(_0xb267('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb267('0xf'));var Papa=require(_0xb267('0x10'));var Redis=require(_0xb267('0x11'));var authService=require(_0xb267('0x12'));var qs=require(_0xb267('0x13'));var as=require(_0xb267('0x14'));var hardwareService=require(_0xb267('0x15'));var logger=require(_0xb267('0x16'))(_0xb267('0x17'));var utils=require('../../config/utils');var config=require(_0xb267('0x18'));var licenseUtil=require(_0xb267('0x19'));var db=require(_0xb267('0x1a'))['db'];function respondWithStatusCode(_0x35401d,_0x396785){_0x396785=_0x396785||0xcc;return function(_0xa179ac){if(_0xa179ac){return _0x35401d[_0xb267('0x1b')](_0x396785);}return _0x35401d[_0xb267('0x1c')](_0x396785)['end']();};}function respondWithResult(_0x28a09e,_0xfea285){_0xfea285=_0xfea285||0xc8;return function(_0x521fc4){if(_0x521fc4){return _0x28a09e[_0xb267('0x1c')](_0xfea285)[_0xb267('0x1d')](_0x521fc4);}};}function respondWithFilteredResult(_0x34cdaf,_0x47bcf8){return function(_0x2bebc8){if(_0x2bebc8){var _0x2448d9=typeof _0x47bcf8['offset']==='undefined'&&typeof _0x47bcf8[_0xb267('0x1e')]===_0xb267('0x1f');var _0x40b04=_0x2bebc8[_0xb267('0x20')];var _0x2694ec=_0x2448d9?0x0:_0x47bcf8['offset'];var _0x5b509a=_0x2448d9?_0x2bebc8[_0xb267('0x20')]:_0x47bcf8[_0xb267('0x21')]+_0x47bcf8[_0xb267('0x1e')];var _0x1bdcee;if(_0x5b509a>=_0x40b04){_0x5b509a=_0x40b04;_0x1bdcee=0xc8;}else{_0x1bdcee=0xce;}_0x34cdaf['status'](_0x1bdcee);return _0x34cdaf['set'](_0xb267('0x22'),_0x2694ec+'-'+_0x5b509a+'/'+_0x40b04)[_0xb267('0x1d')](_0x2bebc8);}return null;};}function patchUpdates(_0x26c5bb){return function(_0x45041b){try{jsonpatch['apply'](_0x45041b,_0x26c5bb,!![]);}catch(_0x449873){return BPromise[_0xb267('0x23')](_0x449873);}return _0x45041b[_0xb267('0x24')]();};}function saveUpdates(_0x538231,_0x214a3d){return function(_0x4eb177){if(_0x4eb177){return _0x4eb177[_0xb267('0x25')](_0x538231)['then'](function(_0x477553){return _0x477553;});}return null;};}function removeEntity(_0x4a01d6,_0x1fcfd7){return function(_0x2f28e1){if(_0x2f28e1){return _0x2f28e1[_0xb267('0x26')]()[_0xb267('0x27')](function(){_0x4a01d6['status'](0xcc)[_0xb267('0x28')]();});}};}function handleEntityNotFound(_0x48f142,_0x12f5bc){return function(_0x2b60d2){if(!_0x2b60d2){_0x48f142['sendStatus'](0x194);}return _0x2b60d2;};}function handleError(_0x509d64,_0x289a0b){_0x289a0b=_0x289a0b||0x1f4;return function(_0x1cb694){logger[_0xb267('0x29')](_0x1cb694['stack']);if(_0x1cb694[_0xb267('0x2a')]){delete _0x1cb694[_0xb267('0x2a')];}_0x509d64[_0xb267('0x1c')](_0x289a0b)[_0xb267('0x2b')](_0x1cb694);};}exports[_0xb267('0x2c')]=function(_0x10f91b,_0x2602f7){var _0x16ca16={},_0x40c0b7={},_0x389a33={'count':0x0,'rows':[]};var _0x7b4793=_['map'](db[_0xb267('0x2d')][_0xb267('0x2e')],function(_0x151efb){return{'name':_0x151efb['fieldName'],'type':_0x151efb[_0xb267('0x2f')]['key']};});_0x40c0b7[_0xb267('0x30')]=_[_0xb267('0x31')](_0x7b4793,_0xb267('0x2a'));_0x40c0b7[_0xb267('0x32')]=_['keys'](_0x10f91b[_0xb267('0x32')]);_0x40c0b7['filters']=_[_0xb267('0x33')](_0x40c0b7[_0xb267('0x30')],_0x40c0b7[_0xb267('0x32')]);_0x16ca16['attributes']=_[_0xb267('0x33')](_0x40c0b7['model'],qs[_0xb267('0x34')](_0x10f91b['query']['fields']));_0x16ca16[_0xb267('0x35')]=_0x16ca16[_0xb267('0x35')][_0xb267('0x36')]?_0x16ca16['attributes']:_0x40c0b7['model'];if(!_0x10f91b['query']['hasOwnProperty'](_0xb267('0x37'))){_0x16ca16['limit']=qs[_0xb267('0x1e')](_0x10f91b['query'][_0xb267('0x1e')]);_0x16ca16[_0xb267('0x21')]=qs[_0xb267('0x21')](_0x10f91b[_0xb267('0x32')][_0xb267('0x21')]);}_0x16ca16['order']=qs[_0xb267('0x38')](_0x10f91b[_0xb267('0x32')][_0xb267('0x38')]);_0x16ca16[_0xb267('0x39')]=qs[_0xb267('0x3a')](_[_0xb267('0x3b')](_0x10f91b[_0xb267('0x32')],_0x40c0b7[_0xb267('0x3a')]),_0x7b4793);if(_0x10f91b['query'][_0xb267('0x3c')]){_0x16ca16[_0xb267('0x39')]=_[_0xb267('0x3d')](_0x16ca16[_0xb267('0x39')],{'$or':_[_0xb267('0x31')](_0x7b4793,function(_0xb6bc81){if(_0xb6bc81[_0xb267('0x2f')]!==_0xb267('0x3e')){var _0x3c2849={};_0x3c2849[_0xb6bc81['name']]={'$like':'%'+_0x10f91b['query'][_0xb267('0x3c')]+'%'};return _0x3c2849;}})});}_0x16ca16=_[_0xb267('0x3d')]({},_0x16ca16,_0x10f91b['options']);var _0x1e3a55={'where':_0x16ca16[_0xb267('0x39')]};return db[_0xb267('0x2d')][_0xb267('0x20')](_0x1e3a55)[_0xb267('0x27')](function(_0x3ce6e0){_0x389a33['count']=_0x3ce6e0;if(_0x10f91b[_0xb267('0x32')]['includeAll']){_0x16ca16[_0xb267('0x3f')]=[{'all':!![]}];}return db[_0xb267('0x2d')][_0xb267('0x40')](_0x16ca16);})[_0xb267('0x27')](function(_0x5a7f31){_0x389a33[_0xb267('0x41')]=_0x5a7f31;return _0x389a33;})[_0xb267('0x27')](respondWithFilteredResult(_0x2602f7,_0x16ca16))[_0xb267('0x42')](handleError(_0x2602f7,null));};exports[_0xb267('0x43')]=function(_0x4b583b,_0x4a31f2){var _0x148582={'raw':!![],'where':{'id':_0x4b583b[_0xb267('0x44')]['id']}},_0x389a0b={};_0x389a0b[_0xb267('0x30')]=_[_0xb267('0x45')](db[_0xb267('0x2d')][_0xb267('0x2e')]);_0x389a0b[_0xb267('0x32')]=_['keys'](_0x4b583b[_0xb267('0x32')]);_0x389a0b[_0xb267('0x3a')]=_['intersection'](_0x389a0b[_0xb267('0x30')],_0x389a0b[_0xb267('0x32')]);_0x148582[_0xb267('0x35')]=_[_0xb267('0x33')](_0x389a0b[_0xb267('0x30')],qs[_0xb267('0x34')](_0x4b583b['query'][_0xb267('0x34')]));_0x148582[_0xb267('0x35')]=_0x148582[_0xb267('0x35')][_0xb267('0x36')]?_0x148582[_0xb267('0x35')]:_0x389a0b['model'];if(_0x4b583b['query']['includeAll']){_0x148582[_0xb267('0x3f')]=[{'all':!![]}];}_0x148582=_[_0xb267('0x3d')]({},_0x148582,_0x4b583b['options']);return db[_0xb267('0x2d')][_0xb267('0x46')](_0x148582)['then'](handleEntityNotFound(_0x4a31f2,null))[_0xb267('0x27')](respondWithResult(_0x4a31f2,null))['catch'](handleError(_0x4a31f2,null));};exports[_0xb267('0x47')]=function(_0x141e75,_0xdde06c){return db[_0xb267('0x2d')][_0xb267('0x47')](_0x141e75[_0xb267('0x48')],{})[_0xb267('0x27')](respondWithResult(_0xdde06c,0xc9))[_0xb267('0x42')](handleError(_0xdde06c,null));};exports[_0xb267('0x25')]=function(_0x328ffc,_0x5dd8cc){if(_0x328ffc[_0xb267('0x48')]['id']){delete _0x328ffc['body']['id'];}return db[_0xb267('0x2d')][_0xb267('0x46')]({'where':{'id':_0x328ffc['params']['id']}})['then'](handleEntityNotFound(_0x5dd8cc,null))[_0xb267('0x27')](saveUpdates(_0x328ffc[_0xb267('0x48')],null))[_0xb267('0x27')](respondWithResult(_0x5dd8cc,null))[_0xb267('0x42')](handleError(_0x5dd8cc,null));};exports[_0xb267('0x26')]=function(_0xd181cc,_0x5f153f){return db[_0xb267('0x2d')][_0xb267('0x46')]({'where':{'id':_0xd181cc[_0xb267('0x44')]['id']}})[_0xb267('0x27')](handleEntityNotFound(_0x5f153f,null))[_0xb267('0x27')](removeEntity(_0x5f153f,null))['catch'](handleError(_0x5f153f,null));};exports[_0xb267('0x49')]=function(_0x3c2a7c,_0x70a1b9){return db[_0xb267('0x2d')]['describe']()[_0xb267('0x27')](respondWithResult(_0x70a1b9,null))[_0xb267('0x42')](handleError(_0x70a1b9,null));}; \ No newline at end of file +var _0x16ad=['status','json','undefined','count','offset','set','Content-Range','apply','reject','update','then','end','name','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','merge','options','where','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x16ad,0xc2));var _0xd16a=function(_0x3cf9ea,_0x3db697){_0x3cf9ea=_0x3cf9ea-0x0;var _0x3c2def=_0x16ad[_0x3cf9ea];return _0x3c2def;};'use strict';var emlformat=require(_0xd16a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd16a('0x1'));var rp=require(_0xd16a('0x2'));var moment=require(_0xd16a('0x3'));var BPromise=require(_0xd16a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd16a('0x5'));var sox=require('sox');var csv=require(_0xd16a('0x6'));var ejs=require(_0xd16a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd16a('0x8'));var squel=require(_0xd16a('0x9'));var crypto=require(_0xd16a('0xa'));var jsforce=require(_0xd16a('0xb'));var deskjs=require(_0xd16a('0xc'));var toCsv=require(_0xd16a('0x6'));var querystring=require('querystring');var Papa=require(_0xd16a('0xd'));var Redis=require(_0xd16a('0xe'));var authService=require(_0xd16a('0xf'));var qs=require(_0xd16a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd16a('0x11'));var logger=require(_0xd16a('0x12'))(_0xd16a('0x13'));var utils=require(_0xd16a('0x14'));var config=require(_0xd16a('0x15'));var licenseUtil=require(_0xd16a('0x16'));var db=require(_0xd16a('0x17'))['db'];function respondWithStatusCode(_0x36cbbd,_0x3f1237){_0x3f1237=_0x3f1237||0xcc;return function(_0x1f670e){if(_0x1f670e){return _0x36cbbd[_0xd16a('0x18')](_0x3f1237);}return _0x36cbbd[_0xd16a('0x19')](_0x3f1237)['end']();};}function respondWithResult(_0x67ac09,_0xf782b7){_0xf782b7=_0xf782b7||0xc8;return function(_0x2df0f6){if(_0x2df0f6){return _0x67ac09[_0xd16a('0x19')](_0xf782b7)[_0xd16a('0x1a')](_0x2df0f6);}};}function respondWithFilteredResult(_0x581276,_0x23c788){return function(_0x5a5f19){if(_0x5a5f19){var _0x26c1cb=typeof _0x23c788['offset']===_0xd16a('0x1b')&&typeof _0x23c788['limit']===_0xd16a('0x1b');var _0x381fa4=_0x5a5f19[_0xd16a('0x1c')];var _0x5c9351=_0x26c1cb?0x0:_0x23c788[_0xd16a('0x1d')];var _0x313e9e=_0x26c1cb?_0x5a5f19['count']:_0x23c788[_0xd16a('0x1d')]+_0x23c788['limit'];var _0x2004d8;if(_0x313e9e>=_0x381fa4){_0x313e9e=_0x381fa4;_0x2004d8=0xc8;}else{_0x2004d8=0xce;}_0x581276[_0xd16a('0x19')](_0x2004d8);return _0x581276[_0xd16a('0x1e')](_0xd16a('0x1f'),_0x5c9351+'-'+_0x313e9e+'/'+_0x381fa4)['json'](_0x5a5f19);}return null;};}function patchUpdates(_0x2b2021){return function(_0x11f49f){try{jsonpatch[_0xd16a('0x20')](_0x11f49f,_0x2b2021,!![]);}catch(_0xbd2890){return BPromise[_0xd16a('0x21')](_0xbd2890);}return _0x11f49f['save']();};}function saveUpdates(_0x2c1330,_0x3f9719){return function(_0x3cb087){if(_0x3cb087){return _0x3cb087[_0xd16a('0x22')](_0x2c1330)[_0xd16a('0x23')](function(_0x51e6de){return _0x51e6de;});}return null;};}function removeEntity(_0x2663e6,_0x15956d){return function(_0x2a32f9){if(_0x2a32f9){return _0x2a32f9['destroy']()[_0xd16a('0x23')](function(){_0x2663e6[_0xd16a('0x19')](0xcc)[_0xd16a('0x24')]();});}};}function handleEntityNotFound(_0x226a62,_0x111bad){return function(_0x12b9b8){if(!_0x12b9b8){_0x226a62[_0xd16a('0x18')](0x194);}return _0x12b9b8;};}function handleError(_0x2c53a3,_0x2eaad6){_0x2eaad6=_0x2eaad6||0x1f4;return function(_0x49ace3){logger['error'](_0x49ace3['stack']);if(_0x49ace3[_0xd16a('0x25')]){delete _0x49ace3['name'];}_0x2c53a3[_0xd16a('0x19')](_0x2eaad6)['send'](_0x49ace3);};}exports[_0xd16a('0x26')]=function(_0xe8cdd3,_0x2cb085){var _0x34bfb9={},_0x41bff2={},_0x4ab4e0={'count':0x0,'rows':[]};var _0xe3a399=_[_0xd16a('0x27')](db[_0xd16a('0x28')][_0xd16a('0x29')],function(_0x2be0cd){return{'name':_0x2be0cd[_0xd16a('0x2a')],'type':_0x2be0cd[_0xd16a('0x2b')][_0xd16a('0x2c')]};});_0x41bff2[_0xd16a('0x2d')]=_[_0xd16a('0x27')](_0xe3a399,_0xd16a('0x25'));_0x41bff2[_0xd16a('0x2e')]=_[_0xd16a('0x2f')](_0xe8cdd3[_0xd16a('0x2e')]);_0x41bff2[_0xd16a('0x30')]=_[_0xd16a('0x31')](_0x41bff2[_0xd16a('0x2d')],_0x41bff2['query']);_0x34bfb9[_0xd16a('0x32')]=_[_0xd16a('0x31')](_0x41bff2[_0xd16a('0x2d')],qs[_0xd16a('0x33')](_0xe8cdd3['query'][_0xd16a('0x33')]));_0x34bfb9['attributes']=_0x34bfb9[_0xd16a('0x32')][_0xd16a('0x34')]?_0x34bfb9[_0xd16a('0x32')]:_0x41bff2['model'];if(!_0xe8cdd3[_0xd16a('0x2e')]['hasOwnProperty'](_0xd16a('0x35'))){_0x34bfb9[_0xd16a('0x36')]=qs[_0xd16a('0x36')](_0xe8cdd3[_0xd16a('0x2e')]['limit']);_0x34bfb9[_0xd16a('0x1d')]=qs['offset'](_0xe8cdd3[_0xd16a('0x2e')][_0xd16a('0x1d')]);}_0x34bfb9[_0xd16a('0x37')]=qs[_0xd16a('0x38')](_0xe8cdd3[_0xd16a('0x2e')][_0xd16a('0x38')]);_0x34bfb9['where']=qs[_0xd16a('0x30')](_[_0xd16a('0x39')](_0xe8cdd3['query'],_0x41bff2['filters']),_0xe3a399);if(_0xe8cdd3[_0xd16a('0x2e')][_0xd16a('0x3a')]){_0x34bfb9['where']=_[_0xd16a('0x3b')](_0x34bfb9['where'],{'$or':_[_0xd16a('0x27')](_0xe3a399,function(_0x1474c5){if(_0x1474c5['type']!=='VIRTUAL'){var _0x9971f={};_0x9971f[_0x1474c5[_0xd16a('0x25')]]={'$like':'%'+_0xe8cdd3[_0xd16a('0x2e')][_0xd16a('0x3a')]+'%'};return _0x9971f;}})});}_0x34bfb9=_[_0xd16a('0x3b')]({},_0x34bfb9,_0xe8cdd3[_0xd16a('0x3c')]);var _0x2cf1aa={'where':_0x34bfb9[_0xd16a('0x3d')]};return db[_0xd16a('0x28')][_0xd16a('0x1c')](_0x2cf1aa)['then'](function(_0x51f51e){_0x4ab4e0['count']=_0x51f51e;if(_0xe8cdd3[_0xd16a('0x2e')][_0xd16a('0x3e')]){_0x34bfb9[_0xd16a('0x3f')]=[{'all':!![]}];}return db[_0xd16a('0x28')][_0xd16a('0x40')](_0x34bfb9);})['then'](function(_0x1c43ad){_0x4ab4e0[_0xd16a('0x41')]=_0x1c43ad;return _0x4ab4e0;})['then'](respondWithFilteredResult(_0x2cb085,_0x34bfb9))[_0xd16a('0x42')](handleError(_0x2cb085,null));};exports[_0xd16a('0x43')]=function(_0xdb052a,_0x1624ab){var _0x171a15={'raw':!![],'where':{'id':_0xdb052a[_0xd16a('0x44')]['id']}},_0x3ee2d4={};_0x3ee2d4[_0xd16a('0x2d')]=_[_0xd16a('0x2f')](db[_0xd16a('0x28')][_0xd16a('0x29')]);_0x3ee2d4[_0xd16a('0x2e')]=_[_0xd16a('0x2f')](_0xdb052a[_0xd16a('0x2e')]);_0x3ee2d4[_0xd16a('0x30')]=_[_0xd16a('0x31')](_0x3ee2d4[_0xd16a('0x2d')],_0x3ee2d4[_0xd16a('0x2e')]);_0x171a15[_0xd16a('0x32')]=_['intersection'](_0x3ee2d4[_0xd16a('0x2d')],qs[_0xd16a('0x33')](_0xdb052a['query'][_0xd16a('0x33')]));_0x171a15[_0xd16a('0x32')]=_0x171a15[_0xd16a('0x32')][_0xd16a('0x34')]?_0x171a15[_0xd16a('0x32')]:_0x3ee2d4['model'];if(_0xdb052a[_0xd16a('0x2e')][_0xd16a('0x3e')]){_0x171a15[_0xd16a('0x3f')]=[{'all':!![]}];}_0x171a15=_[_0xd16a('0x3b')]({},_0x171a15,_0xdb052a[_0xd16a('0x3c')]);return db[_0xd16a('0x28')]['find'](_0x171a15)[_0xd16a('0x23')](handleEntityNotFound(_0x1624ab,null))[_0xd16a('0x23')](respondWithResult(_0x1624ab,null))[_0xd16a('0x42')](handleError(_0x1624ab,null));};exports['create']=function(_0x3bc030,_0x130906){return db[_0xd16a('0x28')][_0xd16a('0x45')](_0x3bc030['body'],{})[_0xd16a('0x23')](respondWithResult(_0x130906,0xc9))[_0xd16a('0x42')](handleError(_0x130906,null));};exports[_0xd16a('0x22')]=function(_0x48405f,_0x4a7bd1){if(_0x48405f[_0xd16a('0x46')]['id']){delete _0x48405f[_0xd16a('0x46')]['id'];}return db[_0xd16a('0x28')][_0xd16a('0x47')]({'where':{'id':_0x48405f[_0xd16a('0x44')]['id']}})['then'](handleEntityNotFound(_0x4a7bd1,null))[_0xd16a('0x23')](saveUpdates(_0x48405f[_0xd16a('0x46')],null))['then'](respondWithResult(_0x4a7bd1,null))[_0xd16a('0x42')](handleError(_0x4a7bd1,null));};exports['destroy']=function(_0x106184,_0x410836){return db[_0xd16a('0x28')][_0xd16a('0x47')]({'where':{'id':_0x106184[_0xd16a('0x44')]['id']}})[_0xd16a('0x23')](handleEntityNotFound(_0x410836,null))[_0xd16a('0x23')](removeEntity(_0x410836,null))['catch'](handleError(_0x410836,null));};exports[_0xd16a('0x48')]=function(_0x5909f4,_0x170f2e){return db[_0xd16a('0x28')][_0xd16a('0x48')]()[_0xd16a('0x23')](respondWithResult(_0x170f2e,null))[_0xd16a('0x42')](handleError(_0x170f2e,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 163188f..1c61690 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 _0x3d5d=['request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','moment','bluebird'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x3d5d,0x104));var _0xd3d5=function(_0x4ec7f2,_0x3d92d2){_0x4ec7f2=_0x4ec7f2-0x0;var _0x118004=_0x3d5d[_0x4ec7f2];return _0x118004;};'use strict';var _=require(_0xd3d5('0x0'));var util=require(_0xd3d5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd3d5('0x2'));var BPromise=require(_0xd3d5('0x3'));var rp=require(_0xd3d5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd3d5('0x5'));var config=require(_0xd3d5('0x6'));var attributes=require(_0xd3d5('0x7'));module[_0xd3d5('0x8')]=function(_0x5542ef,_0x3b857d){return _0x5542ef['define'](_0xd3d5('0x9'),attributes,{'tableName':_0xd3d5('0xa'),'paranoid':![],'indexes':[{'name':_0xd3d5('0xb'),'fields':[_0xd3d5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb3c2=['report_mail_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb3c2,0x152));var _0x2b3c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb3c2[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x2b3c('0x0'));var util=require(_0x2b3c('0x1'));var logger=require('../../config/logger')(_0x2b3c('0x2'));var moment=require(_0x2b3c('0x3'));var BPromise=require(_0x2b3c('0x4'));var rp=require(_0x2b3c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2b3c('0x6'));var config=require(_0x2b3c('0x7'));var attributes=require(_0x2b3c('0x8'));module[_0x2b3c('0x9')]=function(_0x45937a,_0x4c8010){return _0x45937a[_0x2b3c('0xa')](_0x2b3c('0xb'),attributes,{'tableName':_0x2b3c('0xc'),'paranoid':![],'indexes':[{'name':_0x2b3c('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index c1037ac..171cd1d 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 _0xf13f=['request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','MailTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x4f167e,_0x416f9b){var _0x55e71c=function(_0x2cb410){while(--_0x2cb410){_0x4f167e['push'](_0x4f167e['shift']());}};_0x55e71c(++_0x416f9b);}(_0xf13f,0x1c1));var _0xff13=function(_0x12706b,_0x577f72){_0x12706b=_0x12706b-0x0;var _0xa71c3=_0xf13f[_0x12706b];return _0xa71c3;};'use strict';var _=require('lodash');var util=require(_0xff13('0x0'));var moment=require(_0xff13('0x1'));var BPromise=require(_0xff13('0x2'));var rs=require(_0xff13('0x3'));var fs=require('fs');var Redis=require(_0xff13('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xff13('0x5'))(_0xff13('0x6'));var config=require('../../config/environment');var jayson=require(_0xff13('0x7'));var client=jayson[_0xff13('0x8')][_0xff13('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x156502,_0x450184,_0x44b933){return new BPromise(function(_0x26efef,_0x3b9022){return client[_0xff13('0xa')](_0x156502,_0x44b933)[_0xff13('0xb')](function(_0x1e67a4){logger[_0xff13('0xc')]('MailTransferReport,\x20%s,\x20%s',_0x450184,_0xff13('0xd'));logger[_0xff13('0xe')](_0xff13('0xf'),_0x450184,_0xff13('0xd'),JSON[_0xff13('0x10')](_0x1e67a4));if(_0x1e67a4[_0xff13('0x11')]){if(_0x1e67a4[_0xff13('0x11')]['code']===0x1f4){logger['error'](_0xff13('0x12'),_0x450184,_0x1e67a4[_0xff13('0x11')][_0xff13('0x13')]);return _0x3b9022(_0x1e67a4[_0xff13('0x11')][_0xff13('0x13')]);}logger['error'](_0xff13('0x12'),_0x450184,_0x1e67a4[_0xff13('0x11')][_0xff13('0x13')]);return _0x26efef(_0x1e67a4[_0xff13('0x11')][_0xff13('0x13')]);}else{logger[_0xff13('0xc')](_0xff13('0x12'),_0x450184,_0xff13('0xd'));_0x26efef(_0x1e67a4[_0xff13('0x14')][_0xff13('0x13')]);}})[_0xff13('0x15')](function(_0x461512){logger['error'](_0xff13('0x12'),_0x450184,_0x461512);_0x3b9022(_0x461512);});});} \ No newline at end of file +var _0x0718=['MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x0718,0xa1));var _0x8071=function(_0x313a00,_0x107929){_0x313a00=_0x313a00-0x0;var _0x46d07b=_0x0718[_0x313a00];return _0x46d07b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8071('0x0'));var BPromise=require('bluebird');var rs=require(_0x8071('0x1'));var fs=require('fs');var Redis=require(_0x8071('0x2'));var db=require(_0x8071('0x3'))['db'];var utils=require(_0x8071('0x4'));var logger=require(_0x8071('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8071('0x6'));var client=jayson[_0x8071('0x7')][_0x8071('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c3167,_0x51b87a,_0x4a0443){return new BPromise(function(_0x517f82,_0x1e4f36){return client[_0x8071('0x9')](_0x1c3167,_0x4a0443)[_0x8071('0xa')](function(_0x55989e){logger[_0x8071('0xb')](_0x8071('0xc'),_0x51b87a,_0x8071('0xd'));logger[_0x8071('0xe')](_0x8071('0xf'),_0x51b87a,_0x8071('0xd'),JSON[_0x8071('0x10')](_0x55989e));if(_0x55989e['error']){if(_0x55989e[_0x8071('0x11')][_0x8071('0x12')]===0x1f4){logger[_0x8071('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x51b87a,_0x55989e['error'][_0x8071('0x13')]);return _0x1e4f36(_0x55989e[_0x8071('0x11')][_0x8071('0x13')]);}logger[_0x8071('0x11')](_0x8071('0xc'),_0x51b87a,_0x55989e[_0x8071('0x11')][_0x8071('0x13')]);return _0x517f82(_0x55989e[_0x8071('0x11')]['message']);}else{logger[_0x8071('0xb')](_0x8071('0xc'),_0x51b87a,_0x8071('0xd'));_0x517f82(_0x55989e[_0x8071('0x14')][_0x8071('0x13')]);}})[_0x8071('0x15')](function(_0x1441ea){logger[_0x8071('0x11')](_0x8071('0xc'),_0x51b87a,_0x1441ea);_0x1e4f36(_0x1441ea);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 75667d1..fe1636d 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 _0xb0bd=['/describe','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get'];(function(_0x329437,_0x1de73a){var _0x3789d9=function(_0x37832e){while(--_0x37832e){_0x329437['push'](_0x329437['shift']());}};_0x3789d9(++_0x1de73a);}(_0xb0bd,0x11d));var _0xdb0b=function(_0x5e937c,_0xdc8230){_0x5e937c=_0x5e937c-0x0;var _0x1cc4d8=_0xb0bd[_0x5e937c];return _0x1cc4d8;};'use strict';var multer=require('multer');var util=require(_0xdb0b('0x0'));var path=require(_0xdb0b('0x1'));var timeout=require('connect-timeout');var express=require(_0xdb0b('0x2'));var router=express[_0xdb0b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdb0b('0x4'));var interaction=require(_0xdb0b('0x5'));var config=require(_0xdb0b('0x6'));var controller=require(_0xdb0b('0x7'));router[_0xdb0b('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xdb0b('0x9'),auth[_0xdb0b('0xa')](),controller[_0xdb0b('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xdb0b('0xc')]);router[_0xdb0b('0xd')]('/',auth[_0xdb0b('0xa')](),controller[_0xdb0b('0xe')]);router[_0xdb0b('0xf')](_0xdb0b('0x10'),auth[_0xdb0b('0xa')](),controller[_0xdb0b('0x11')]);router[_0xdb0b('0x12')](_0xdb0b('0x10'),auth[_0xdb0b('0xa')](),controller[_0xdb0b('0x13')]);module[_0xdb0b('0x14')]=router; \ No newline at end of file +var _0x0ff8=['fs-extra','../../components/interaction/service','../../config/environment','./memberReport.controller','index','/describe','isAuthenticated','describe','get','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0ff8,0xed));var _0x80ff=function(_0x456da0,_0x279430){_0x456da0=_0x456da0-0x0;var _0xe9b7cd=_0x0ff8[_0x456da0];return _0xe9b7cd;};'use strict';var multer=require(_0x80ff('0x0'));var util=require(_0x80ff('0x1'));var path=require(_0x80ff('0x2'));var timeout=require(_0x80ff('0x3'));var express=require(_0x80ff('0x4'));var router=express['Router']();var fs_extra=require(_0x80ff('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x80ff('0x6'));var config=require(_0x80ff('0x7'));var controller=require(_0x80ff('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x80ff('0x9')]);router['get'](_0x80ff('0xa'),auth[_0x80ff('0xb')](),controller[_0x80ff('0xc')]);router[_0x80ff('0xd')](_0x80ff('0xe'),auth[_0x80ff('0xb')](),controller[_0x80ff('0xf')]);router['post']('/',auth[_0x80ff('0xb')](),controller[_0x80ff('0x10')]);router[_0x80ff('0x11')]('/:id',auth[_0x80ff('0xb')](),controller[_0x80ff('0x12')]);router[_0x80ff('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x80ff('0x14')]);module[_0x80ff('0x15')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index a4811e6..7eb98d4 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 _0xeadf=['DATE','getDataValue','diff','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','INTEGER','sequelize','moment','STRING','LOGIN,\x20PAUSE,\x20TALKING'];(function(_0x1c0d28,_0x2d366d){var _0x357de8=function(_0x29808a){while(--_0x29808a){_0x1c0d28['push'](_0x1c0d28['shift']());}};_0x357de8(++_0x2d366d);}(_0xeadf,0x8b));var _0xfead=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0xeadf[_0x163040];return _0x364667;};'use strict';var Sequelize=require(_0xfead('0x0'));var moment=require(_0xfead('0x1'));module['exports']={'channel':{'type':Sequelize[_0xfead('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xfead('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xfead('0x3')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xfead('0x4')],'set':function(_0x513d42){var _0x88de22=moment(_0x513d42);var _0x49d4f8=moment(this[_0xfead('0x5')]('enterAt'));var _0x1db725=_0x88de22[_0xfead('0x6')](_0x49d4f8,'seconds');this[_0xfead('0x7')](_0xfead('0x8'),_0x513d42);this['setDataValue']('duration',_0x1db725>=0x0?_0x1db725:null);}},'data1':{'type':Sequelize[_0xfead('0x2')],'comment':_0xfead('0x9')},'data2':{'type':Sequelize['STRING'],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xfead('0x2')],'comment':_0xfead('0xa')},'data4':{'type':Sequelize[_0xfead('0x2')],'comment':_0xfead('0xb')},'data5':{'type':Sequelize[_0xfead('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xfead('0x2')]},'internal':{'type':Sequelize[_0xfead('0xc')]},'uniqueid':{'type':Sequelize[_0xfead('0x2')]}}; \ No newline at end of file +var _0x75fd=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[dial\x20string]','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','exitAt','setDataValue'];(function(_0xbf5e16,_0x146ce3){var _0x5975a5=function(_0x2387a7){while(--_0x2387a7){_0xbf5e16['push'](_0xbf5e16['shift']());}};_0x5975a5(++_0x146ce3);}(_0x75fd,0x197));var _0xd75f=function(_0x34a1cf,_0xcdd7ea){_0x34a1cf=_0x34a1cf-0x0;var _0x1e5c38=_0x75fd[_0x34a1cf];return _0x1e5c38;};'use strict';var Sequelize=require(_0xd75f('0x0'));var moment=require('moment');module[_0xd75f('0x1')]={'channel':{'type':Sequelize[_0xd75f('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xd75f('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xd75f('0x3'),'comment':_0xd75f('0x4')},'duration':{'type':Sequelize[_0xd75f('0x5')]},'enterAt':{'type':Sequelize[_0xd75f('0x6')]},'exitAt':{'type':Sequelize[_0xd75f('0x6')],'set':function(_0x16776b){var _0x5b96b0=moment(_0x16776b);var _0x4613eb=moment(this[_0xd75f('0x7')](_0xd75f('0x8')));var _0x14d6a3=_0x5b96b0[_0xd75f('0x9')](_0x4613eb,_0xd75f('0xa'));this['setDataValue'](_0xd75f('0xb'),_0x16776b);this[_0xd75f('0xc')]('duration',_0x14d6a3>=0x0?_0x14d6a3:null);}},'data1':{'type':Sequelize[_0xd75f('0x2')],'comment':_0xd75f('0xd')},'data2':{'type':Sequelize[_0xd75f('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xd75f('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize['STRING'],'comment':_0xd75f('0xe')},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xd75f('0x2')]},'internal':{'type':Sequelize[_0xd75f('0x5')]},'uniqueid':{'type':Sequelize[_0xd75f('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 0ed0e00..e3436fc 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(_0x37087e,_0x719222){var _0x117e6f=function(_0x1591bf){while(--_0x1591bf){_0x37087e['push'](_0x37087e['shift']());}};_0x117e6f(++_0x719222);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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 _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x34e8,0x12c));var _0x834e=function(_0x51920a,_0x40bd94){_0x51920a=_0x51920a-0x0;var _0x474d6f=_0x34e8[_0x51920a];return _0x474d6f;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index f8ce35b..888e652 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 _0x2eb2=['request-promise','rimraf','exports','define','MemberReport','report_member','membername_interface','membername','interface','util','../../config/logger','api','moment','bluebird'];(function(_0x106703,_0x24c607){var _0x4aff25=function(_0x468f13){while(--_0x468f13){_0x106703['push'](_0x106703['shift']());}};_0x4aff25(++_0x24c607);}(_0x2eb2,0x19f));var _0x22eb=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x2eb2[_0x4baae2];return _0x1a2285;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var logger=require(_0x22eb('0x1'))(_0x22eb('0x2'));var moment=require(_0x22eb('0x3'));var BPromise=require(_0x22eb('0x4'));var rp=require(_0x22eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22eb('0x6'));var config=require('../../config/environment');var attributes=require('./memberReport.attributes');module[_0x22eb('0x7')]=function(_0x10e116,_0x35dd5b){return _0x10e116[_0x22eb('0x8')](_0x22eb('0x9'),attributes,{'tableName':_0x22eb('0xa'),'paranoid':![],'indexes':[{'name':_0x22eb('0xb'),'fields':[_0x22eb('0xc'),_0x22eb('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x63b1=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','interface'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x63b1,0x177));var _0x163b=function(_0x592673,_0x10efcf){_0x592673=_0x592673-0x0;var _0x35388f=_0x63b1[_0x592673];return _0x35388f;};'use strict';var _=require(_0x163b('0x0'));var util=require(_0x163b('0x1'));var logger=require(_0x163b('0x2'))(_0x163b('0x3'));var moment=require('moment');var BPromise=require(_0x163b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x163b('0x5'));var rimraf=require(_0x163b('0x6'));var config=require(_0x163b('0x7'));var attributes=require(_0x163b('0x8'));module[_0x163b('0x9')]=function(_0x455dac,_0x27de79){return _0x455dac[_0x163b('0xa')](_0x163b('0xb'),attributes,{'tableName':_0x163b('0xc'),'paranoid':![],'indexes':[{'name':_0x163b('0xd'),'fields':['membername',_0x163b('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 b9cfb74..80c57fa 100644 --- a/server/api/memberReport/memberReport.rpc.js +++ b/server/api/memberReport/memberReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4cff=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','result','catch','MemberReport','options','raw','attributes','limit','include','map','model','GetMemberReport','CreateMemberReport','create','body','update','UpdateMemberReport','lodash','util','bluebird'];(function(_0x145848,_0x5ccb90){var _0x2bcf67=function(_0x223745){while(--_0x223745){_0x145848['push'](_0x145848['shift']());}};_0x2bcf67(++_0x5ccb90);}(_0x4cff,0x14a));var _0xf4cf=function(_0x50ca98,_0x21cc09){_0x50ca98=_0x50ca98-0x0;var _0x4ec576=_0x4cff[_0x50ca98];return _0x4ec576;};'use strict';var _=require(_0xf4cf('0x0'));var util=require(_0xf4cf('0x1'));var moment=require('moment');var BPromise=require(_0xf4cf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4cf('0x3'));var db=require(_0xf4cf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf4cf('0x5'))(_0xf4cf('0x6'));var config=require(_0xf4cf('0x7'));var jayson=require(_0xf4cf('0x8'));var client=jayson[_0xf4cf('0x9')][_0xf4cf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53a3e6,_0x25d0cf,_0x125a37){return new BPromise(function(_0x1f06c6,_0x3882b2){return client['request'](_0x53a3e6,_0x125a37)[_0xf4cf('0xb')](function(_0x36b238){logger[_0xf4cf('0xc')](_0xf4cf('0xd'),_0x25d0cf,'request\x20sent');logger[_0xf4cf('0xe')](_0xf4cf('0xf'),_0x25d0cf,_0xf4cf('0x10'),JSON[_0xf4cf('0x11')](_0x36b238));if(_0x36b238['error']){if(_0x36b238['error'][_0xf4cf('0x12')]===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x25d0cf,_0x36b238['error'][_0xf4cf('0x13')]);return _0x3882b2(_0x36b238[_0xf4cf('0x14')][_0xf4cf('0x13')]);}logger[_0xf4cf('0x14')](_0xf4cf('0xd'),_0x25d0cf,_0x36b238[_0xf4cf('0x14')][_0xf4cf('0x13')]);return _0x1f06c6(_0x36b238[_0xf4cf('0x14')][_0xf4cf('0x13')]);}else{logger[_0xf4cf('0xc')]('MemberReport,\x20%s,\x20%s',_0x25d0cf,_0xf4cf('0x10'));_0x1f06c6(_0x36b238[_0xf4cf('0x15')][_0xf4cf('0x13')]);}})[_0xf4cf('0x16')](function(_0x5260aa){logger[_0xf4cf('0x14')](_0xf4cf('0xd'),_0x25d0cf,_0x5260aa);_0x3882b2(_0x5260aa);});});}exports['GetMemberReport']=function(_0x3999e7){var _0x2aa048=this;return new Promise(function(_0x329347,_0x5469e2){return db[_0xf4cf('0x17')]['findAll']({'raw':_0x3999e7[_0xf4cf('0x18')]?_0x3999e7['options'][_0xf4cf('0x19')]===undefined?!![]:![]:!![],'where':_0x3999e7['options']?_0x3999e7['options']['where']||null:null,'attributes':_0x3999e7[_0xf4cf('0x18')]?_0x3999e7[_0xf4cf('0x18')][_0xf4cf('0x1a')]||null:null,'limit':_0x3999e7[_0xf4cf('0x18')]?_0x3999e7[_0xf4cf('0x18')][_0xf4cf('0x1b')]||null:null,'include':_0x3999e7[_0xf4cf('0x18')]?_0x3999e7['options'][_0xf4cf('0x1c')]?_[_0xf4cf('0x1d')](_0x3999e7[_0xf4cf('0x18')][_0xf4cf('0x1c')],function(_0xba64fe){return{'model':db[_0xba64fe[_0xf4cf('0x1e')]],'as':_0xba64fe['as'],'attributes':_0xba64fe['attributes'],'include':_0xba64fe[_0xf4cf('0x1c')]?_[_0xf4cf('0x1d')](_0xba64fe['include'],function(_0x1d26b0){return{'model':db[_0x1d26b0['model']],'as':_0x1d26b0['as'],'attributes':_0x1d26b0['attributes'],'include':_0x1d26b0[_0xf4cf('0x1c')]?_[_0xf4cf('0x1d')](_0x1d26b0['include'],function(_0x230a18){return{'model':db[_0x230a18['model']],'as':_0x230a18['as'],'attributes':_0x230a18[_0xf4cf('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf4cf('0xb')](function(_0x97e3e4){logger['info']('GetMemberReport',_0x3999e7);logger[_0xf4cf('0xe')](_0xf4cf('0x1f'),_0x3999e7,JSON[_0xf4cf('0x11')](_0x97e3e4));_0x329347(_0x97e3e4);})[_0xf4cf('0x16')](function(_0x164ee8){logger[_0xf4cf('0x14')](_0xf4cf('0x1f'),_0x164ee8['message'],_0x3999e7);_0x5469e2(_0x2aa048[_0xf4cf('0x14')](0x1f4,_0x164ee8[_0xf4cf('0x13')]));});});};exports[_0xf4cf('0x20')]=function(_0x471a0f){var _0x33b5c2=this;return new Promise(function(_0x47de20,_0x5d1dc0){return db[_0xf4cf('0x17')][_0xf4cf('0x21')](_0x471a0f[_0xf4cf('0x22')],{'raw':_0x471a0f[_0xf4cf('0x18')]?_0x471a0f[_0xf4cf('0x18')][_0xf4cf('0x19')]===undefined?!![]:![]:!![]})[_0xf4cf('0xb')](function(_0xe3524d){logger[_0xf4cf('0xc')]('CreateMemberReport',_0x471a0f);logger['debug'](_0xf4cf('0x20'),_0x471a0f,JSON[_0xf4cf('0x11')](_0xe3524d));_0x47de20(_0xe3524d);})[_0xf4cf('0x16')](function(_0x23ca65){logger[_0xf4cf('0x14')]('CreateMemberReport',_0x23ca65[_0xf4cf('0x13')],_0x471a0f);_0x5d1dc0(_0x33b5c2['error'](0x1f4,_0x23ca65[_0xf4cf('0x13')]));});});};exports['UpdateMemberReport']=function(_0x2ef5fe){var _0x22de0d=this;return new Promise(function(_0x28b524,_0x4590ec){return db['MemberReport'][_0xf4cf('0x23')](_0x2ef5fe['body'],{'raw':_0x2ef5fe[_0xf4cf('0x18')]?_0x2ef5fe['options'][_0xf4cf('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ef5fe[_0xf4cf('0x18')]?_0x2ef5fe['options']['where']||null:null,'attributes':_0x2ef5fe[_0xf4cf('0x18')]?_0x2ef5fe[_0xf4cf('0x18')]['attributes']||null:null,'limit':_0x2ef5fe[_0xf4cf('0x18')]?_0x2ef5fe[_0xf4cf('0x18')]['limit']||null:null})['then'](function(_0x33fe63){logger['info'](_0xf4cf('0x24'),_0x2ef5fe);logger[_0xf4cf('0xe')](_0xf4cf('0x24'),_0x2ef5fe,JSON[_0xf4cf('0x11')](_0x33fe63));_0x28b524(_0x33fe63);})[_0xf4cf('0x16')](function(_0xbf80dc){logger[_0xf4cf('0x14')](_0xf4cf('0x24'),_0xbf80dc[_0xf4cf('0x13')],_0x2ef5fe);_0x4590ec(_0x22de0d[_0xf4cf('0x14')](0x1f4,_0xbf80dc[_0xf4cf('0x13')]));});});}; \ No newline at end of file +var _0xb2ad=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','MemberReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetMemberReport','options','raw','attributes','limit','map','include','model','info','debug','CreateMemberReport','MemberReport','create','body','UpdateMemberReport','update','where','catch','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1d84b1,_0x599872){var _0x54fa39=function(_0x48ef05){while(--_0x48ef05){_0x1d84b1['push'](_0x1d84b1['shift']());}};_0x54fa39(++_0x599872);}(_0xb2ad,0x16d));var _0xdb2a=function(_0x20cd32,_0x5a17d3){_0x20cd32=_0x20cd32-0x0;var _0x1fe102=_0xb2ad[_0x20cd32];return _0x1fe102;};'use strict';var _=require('lodash');var util=require(_0xdb2a('0x0'));var moment=require('moment');var BPromise=require(_0xdb2a('0x1'));var rs=require(_0xdb2a('0x2'));var fs=require('fs');var Redis=require(_0xdb2a('0x3'));var db=require(_0xdb2a('0x4'))['db'];var utils=require(_0xdb2a('0x5'));var logger=require('../../config/logger')(_0xdb2a('0x6'));var config=require(_0xdb2a('0x7'));var jayson=require(_0xdb2a('0x8'));var client=jayson[_0xdb2a('0x9')][_0xdb2a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e6649,_0x4f8127,_0x2ed71e){return new BPromise(function(_0xc23925,_0x78ee){return client['request'](_0x4e6649,_0x2ed71e)[_0xdb2a('0xb')](function(_0x29f542){logger['info'](_0xdb2a('0xc'),_0x4f8127,_0xdb2a('0xd'));logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x4f8127,_0xdb2a('0xd'),JSON[_0xdb2a('0xe')](_0x29f542));if(_0x29f542[_0xdb2a('0xf')]){if(_0x29f542['error'][_0xdb2a('0x10')]===0x1f4){logger[_0xdb2a('0xf')]('MemberReport,\x20%s,\x20%s',_0x4f8127,_0x29f542['error']['message']);return _0x78ee(_0x29f542[_0xdb2a('0xf')]['message']);}logger[_0xdb2a('0xf')](_0xdb2a('0xc'),_0x4f8127,_0x29f542['error'][_0xdb2a('0x11')]);return _0xc23925(_0x29f542['error']['message']);}else{logger['info']('MemberReport,\x20%s,\x20%s',_0x4f8127,_0xdb2a('0xd'));_0xc23925(_0x29f542[_0xdb2a('0x12')]['message']);}})['catch'](function(_0x21cb82){logger[_0xdb2a('0xf')](_0xdb2a('0xc'),_0x4f8127,_0x21cb82);_0x78ee(_0x21cb82);});});}exports[_0xdb2a('0x13')]=function(_0x52508d){var _0x2bc67d=this;return new Promise(function(_0x2de4cf,_0x1f6111){return db['MemberReport']['findAll']({'raw':_0x52508d[_0xdb2a('0x14')]?_0x52508d[_0xdb2a('0x14')][_0xdb2a('0x15')]===undefined?!![]:![]:!![],'where':_0x52508d[_0xdb2a('0x14')]?_0x52508d[_0xdb2a('0x14')]['where']||null:null,'attributes':_0x52508d[_0xdb2a('0x14')]?_0x52508d['options'][_0xdb2a('0x16')]||null:null,'limit':_0x52508d['options']?_0x52508d['options'][_0xdb2a('0x17')]||null:null,'include':_0x52508d[_0xdb2a('0x14')]?_0x52508d[_0xdb2a('0x14')]['include']?_[_0xdb2a('0x18')](_0x52508d[_0xdb2a('0x14')][_0xdb2a('0x19')],function(_0x391378){return{'model':db[_0x391378[_0xdb2a('0x1a')]],'as':_0x391378['as'],'attributes':_0x391378[_0xdb2a('0x16')],'include':_0x391378['include']?_[_0xdb2a('0x18')](_0x391378[_0xdb2a('0x19')],function(_0x5f00fb){return{'model':db[_0x5f00fb[_0xdb2a('0x1a')]],'as':_0x5f00fb['as'],'attributes':_0x5f00fb[_0xdb2a('0x16')],'include':_0x5f00fb[_0xdb2a('0x19')]?_[_0xdb2a('0x18')](_0x5f00fb['include'],function(_0xc50c3d){return{'model':db[_0xc50c3d[_0xdb2a('0x1a')]],'as':_0xc50c3d['as'],'attributes':_0xc50c3d[_0xdb2a('0x16')]};}):[]};}):[]};}):[]:[]})[_0xdb2a('0xb')](function(_0x4ed637){logger[_0xdb2a('0x1b')](_0xdb2a('0x13'),_0x52508d);logger[_0xdb2a('0x1c')](_0xdb2a('0x13'),_0x52508d,JSON[_0xdb2a('0xe')](_0x4ed637));_0x2de4cf(_0x4ed637);})['catch'](function(_0x852103){logger[_0xdb2a('0xf')](_0xdb2a('0x13'),_0x852103[_0xdb2a('0x11')],_0x52508d);_0x1f6111(_0x2bc67d[_0xdb2a('0xf')](0x1f4,_0x852103[_0xdb2a('0x11')]));});});};exports[_0xdb2a('0x1d')]=function(_0x2b01e5){var _0x3c55cc=this;return new Promise(function(_0x24b30a,_0x39c5cc){return db[_0xdb2a('0x1e')][_0xdb2a('0x1f')](_0x2b01e5[_0xdb2a('0x20')],{'raw':_0x2b01e5[_0xdb2a('0x14')]?_0x2b01e5[_0xdb2a('0x14')][_0xdb2a('0x15')]===undefined?!![]:![]:!![]})[_0xdb2a('0xb')](function(_0x1053d0){logger[_0xdb2a('0x1b')]('CreateMemberReport',_0x2b01e5);logger[_0xdb2a('0x1c')](_0xdb2a('0x1d'),_0x2b01e5,JSON[_0xdb2a('0xe')](_0x1053d0));_0x24b30a(_0x1053d0);})['catch'](function(_0x49ec05){logger[_0xdb2a('0xf')](_0xdb2a('0x1d'),_0x49ec05[_0xdb2a('0x11')],_0x2b01e5);_0x39c5cc(_0x3c55cc[_0xdb2a('0xf')](0x1f4,_0x49ec05[_0xdb2a('0x11')]));});});};exports[_0xdb2a('0x21')]=function(_0xaeb30b){var _0x17bec7=this;return new Promise(function(_0x185297,_0x444cc2){return db[_0xdb2a('0x1e')][_0xdb2a('0x22')](_0xaeb30b[_0xdb2a('0x20')],{'raw':_0xaeb30b[_0xdb2a('0x14')]?_0xaeb30b['options'][_0xdb2a('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xaeb30b['options']?_0xaeb30b['options'][_0xdb2a('0x23')]||null:null,'attributes':_0xaeb30b[_0xdb2a('0x14')]?_0xaeb30b[_0xdb2a('0x14')][_0xdb2a('0x16')]||null:null,'limit':_0xaeb30b[_0xdb2a('0x14')]?_0xaeb30b['options']['limit']||null:null})[_0xdb2a('0xb')](function(_0x4ad3bc){logger['info'](_0xdb2a('0x21'),_0xaeb30b);logger[_0xdb2a('0x1c')](_0xdb2a('0x21'),_0xaeb30b,JSON['stringify'](_0x4ad3bc));_0x185297(_0x4ad3bc);})[_0xdb2a('0x24')](function(_0x91d489){logger[_0xdb2a('0xf')]('UpdateMemberReport',_0x91d489[_0xdb2a('0x11')],_0xaeb30b);_0x444cc2(_0x17bec7[_0xdb2a('0xf')](0x1f4,_0x91d489[_0xdb2a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 470f227..e3d6985 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 _0x6170=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./migration.controller','get','index'];(function(_0x5126dc,_0xcb914){var _0x31fc0c=function(_0x178d47){while(--_0x178d47){_0x5126dc['push'](_0x5126dc['shift']());}};_0x31fc0c(++_0xcb914);}(_0x6170,0x1d5));var _0x0617=function(_0x3427ef,_0x513bb3){_0x3427ef=_0x3427ef-0x0;var _0x443ed2=_0x6170[_0x3427ef];return _0x443ed2;};'use strict';var multer=require(_0x0617('0x0'));var util=require('util');var path=require(_0x0617('0x1'));var timeout=require(_0x0617('0x2'));var express=require(_0x0617('0x3'));var router=express[_0x0617('0x4')]();var fs_extra=require(_0x0617('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0617('0x6'));var config=require(_0x0617('0x7'));var controller=require(_0x0617('0x8'));router[_0x0617('0x9')]('/',controller[_0x0617('0xa')]);module[_0x0617('0xb')]=router; \ No newline at end of file +var _0x57c2=['../../components/auth/service','../../config/environment','exports','multer','path','connect-timeout','express','fs-extra'];(function(_0x498e3c,_0x2455c4){var _0x1e5f5f=function(_0x1d981b){while(--_0x1d981b){_0x498e3c['push'](_0x498e3c['shift']());}};_0x1e5f5f(++_0x2455c4);}(_0x57c2,0x113));var _0x257c=function(_0x12acef,_0x1c8876){_0x12acef=_0x12acef-0x0;var _0x225f0d=_0x57c2[_0x12acef];return _0x225f0d;};'use strict';var multer=require(_0x257c('0x0'));var util=require('util');var path=require(_0x257c('0x1'));var timeout=require(_0x257c('0x2'));var express=require(_0x257c('0x3'));var router=express['Router']();var fs_extra=require(_0x257c('0x4'));var auth=require(_0x257c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x257c('0x6'));var controller=require('./migration.controller');router['get']('/',controller['index']);module[_0x257c('0x7')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index e72905f..9c30fb3 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 _0xef94=['exports'];(function(_0x2fcd90,_0x4780cc){var _0x55b596=function(_0xe475f6){while(--_0xe475f6){_0x2fcd90['push'](_0x2fcd90['shift']());}};_0x55b596(++_0x4780cc);}(_0xef94,0x13e));var _0x4ef9=function(_0x50917f,_0x446aa8){_0x50917f=_0x50917f-0x0;var _0x37c7bb=_0xef94[_0x50917f];return _0x37c7bb;};'use strict';var Sequelize=require('sequelize');module[_0x4ef9('0x0')]={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file +var _0xb78b=['STRING','version','sequelize','exports'];(function(_0x114265,_0x559cc4){var _0x45bb01=function(_0x92c7a9){while(--_0x92c7a9){_0x114265['push'](_0x114265['shift']());}};_0x45bb01(++_0x559cc4);}(_0xb78b,0x1a2));var _0xbb78=function(_0x2b633e,_0x5db23f){_0x2b633e=_0x2b633e-0x0;var _0x371240=_0xb78b[_0x2b633e];return _0x371240;};'use strict';var Sequelize=require(_0xbb78('0x0'));module[_0xbb78('0x1')]={'version':{'type':Sequelize[_0xbb78('0x2')],'unique':_0xbb78('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index a93a9fc..8615c1f 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 _0x2af6=['squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','save','update','then','destroy','error','stack','index','map','Migration','rawAttributes','fieldName','key','name','query','keys','filters','model','attributes','intersection','hasOwnProperty','nolimit','order','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash'];(function(_0x5ee0ee,_0x3ce413){var _0x198093=function(_0x29dcc9){while(--_0x29dcc9){_0x5ee0ee['push'](_0x5ee0ee['shift']());}};_0x198093(++_0x3ce413);}(_0x2af6,0x170));var _0x62af=function(_0x12b753,_0x1f6e5d){_0x12b753=_0x12b753-0x0;var _0x50dbe4=_0x2af6[_0x12b753];return _0x50dbe4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x62af('0x0'));var jsonpatch=require(_0x62af('0x1'));var rp=require('request-promise');var moment=require(_0x62af('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x62af('0x3'));var util=require(_0x62af('0x4'));var path=require(_0x62af('0x5'));var sox=require('sox');var csv=require(_0x62af('0x6'));var ejs=require(_0x62af('0x7'));var fs=require('fs');var fs_extra=require(_0x62af('0x8'));var _=require(_0x62af('0x9'));var squel=require(_0x62af('0xa'));var crypto=require('crypto');var jsforce=require(_0x62af('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x62af('0x6'));var querystring=require(_0x62af('0xc'));var Papa=require(_0x62af('0xd'));var Redis=require('ioredis');var authService=require(_0x62af('0xe'));var qs=require(_0x62af('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x62af('0x10'))(_0x62af('0x11'));var utils=require(_0x62af('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x62af('0x13'));var db=require(_0x62af('0x14'))['db'];function respondWithStatusCode(_0x16b6f4,_0x18ae90){_0x18ae90=_0x18ae90||0xcc;return function(_0x41b0b3){if(_0x41b0b3){return _0x16b6f4[_0x62af('0x15')](_0x18ae90);}return _0x16b6f4[_0x62af('0x16')](_0x18ae90)['end']();};}function respondWithResult(_0x2b93d8,_0x353d59){_0x353d59=_0x353d59||0xc8;return function(_0x3e52b3){if(_0x3e52b3){return _0x2b93d8[_0x62af('0x16')](_0x353d59)[_0x62af('0x17')](_0x3e52b3);}};}function respondWithFilteredResult(_0x460ba7,_0x4db9c8){return function(_0x515cfe){if(_0x515cfe){var _0x15adac=typeof _0x4db9c8[_0x62af('0x18')]===_0x62af('0x19')&&typeof _0x4db9c8['limit']===_0x62af('0x19');var _0x19da98=_0x515cfe[_0x62af('0x1a')];var _0x119c2d=_0x15adac?0x0:_0x4db9c8[_0x62af('0x18')];var _0x3af8ba=_0x15adac?_0x515cfe[_0x62af('0x1a')]:_0x4db9c8[_0x62af('0x18')]+_0x4db9c8[_0x62af('0x1b')];var _0x372abd;if(_0x3af8ba>=_0x19da98){_0x3af8ba=_0x19da98;_0x372abd=0xc8;}else{_0x372abd=0xce;}_0x460ba7[_0x62af('0x16')](_0x372abd);return _0x460ba7['set'](_0x62af('0x1c'),_0x119c2d+'-'+_0x3af8ba+'/'+_0x19da98)[_0x62af('0x17')](_0x515cfe);}return null;};}function patchUpdates(_0x5efb67){return function(_0x172bca){try{jsonpatch['apply'](_0x172bca,_0x5efb67,!![]);}catch(_0x464cd4){return BPromise['reject'](_0x464cd4);}return _0x172bca[_0x62af('0x1d')]();};}function saveUpdates(_0x7c79fc,_0x47ecf1){return function(_0x1e30fe){if(_0x1e30fe){return _0x1e30fe[_0x62af('0x1e')](_0x7c79fc)[_0x62af('0x1f')](function(_0xbd1a28){return _0xbd1a28;});}return null;};}function removeEntity(_0x1c489d,_0x2d9f1b){return function(_0x3b9f82){if(_0x3b9f82){return _0x3b9f82[_0x62af('0x20')]()[_0x62af('0x1f')](function(){_0x1c489d[_0x62af('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3efd31,_0x51a607){return function(_0x480f67){if(!_0x480f67){_0x3efd31[_0x62af('0x15')](0x194);}return _0x480f67;};}function handleError(_0x6ab911,_0x57e3c4){_0x57e3c4=_0x57e3c4||0x1f4;return function(_0x396623){logger[_0x62af('0x21')](_0x396623[_0x62af('0x22')]);if(_0x396623['name']){delete _0x396623['name'];}_0x6ab911[_0x62af('0x16')](_0x57e3c4)['send'](_0x396623);};}exports[_0x62af('0x23')]=function(_0x4c27de,_0x122c77){var _0x21f781={},_0x76f43a={},_0xd9f1ed={'count':0x0,'rows':[]};var _0x461519=_[_0x62af('0x24')](db[_0x62af('0x25')][_0x62af('0x26')],function(_0x46ef5b){return{'name':_0x46ef5b[_0x62af('0x27')],'type':_0x46ef5b['type'][_0x62af('0x28')]};});_0x76f43a['model']=_[_0x62af('0x24')](_0x461519,_0x62af('0x29'));_0x76f43a[_0x62af('0x2a')]=_[_0x62af('0x2b')](_0x4c27de['query']);_0x76f43a[_0x62af('0x2c')]=_['intersection'](_0x76f43a[_0x62af('0x2d')],_0x76f43a[_0x62af('0x2a')]);_0x21f781[_0x62af('0x2e')]=_[_0x62af('0x2f')](_0x76f43a['model'],qs['fields'](_0x4c27de['query']['fields']));_0x21f781[_0x62af('0x2e')]=_0x21f781[_0x62af('0x2e')]['length']?_0x21f781[_0x62af('0x2e')]:_0x76f43a[_0x62af('0x2d')];if(!_0x4c27de[_0x62af('0x2a')][_0x62af('0x30')](_0x62af('0x31'))){_0x21f781[_0x62af('0x1b')]=qs[_0x62af('0x1b')](_0x4c27de[_0x62af('0x2a')]['limit']);_0x21f781[_0x62af('0x18')]=qs[_0x62af('0x18')](_0x4c27de[_0x62af('0x2a')][_0x62af('0x18')]);}_0x21f781[_0x62af('0x32')]=qs['sort'](_0x4c27de[_0x62af('0x2a')]['sort']);_0x21f781[_0x62af('0x33')]=qs[_0x62af('0x2c')](_[_0x62af('0x34')](_0x4c27de[_0x62af('0x2a')],_0x76f43a[_0x62af('0x2c')]),_0x461519);if(_0x4c27de[_0x62af('0x2a')][_0x62af('0x35')]){_0x21f781[_0x62af('0x33')]=_['merge'](_0x21f781[_0x62af('0x33')],{'$or':_[_0x62af('0x24')](_0x461519,function(_0x144624){if(_0x144624[_0x62af('0x36')]!==_0x62af('0x37')){var _0x1c7d11={};_0x1c7d11[_0x144624[_0x62af('0x29')]]={'$like':'%'+_0x4c27de[_0x62af('0x2a')][_0x62af('0x35')]+'%'};return _0x1c7d11;}})});}_0x21f781=_[_0x62af('0x38')]({},_0x21f781,_0x4c27de[_0x62af('0x39')]);var _0x57a84d={'where':_0x21f781['where']};return db[_0x62af('0x25')][_0x62af('0x1a')](_0x57a84d)[_0x62af('0x1f')](function(_0x2be81d){_0xd9f1ed['count']=_0x2be81d;if(_0x4c27de['query'][_0x62af('0x3a')]){_0x21f781[_0x62af('0x3b')]=[{'all':!![]}];}return db[_0x62af('0x25')][_0x62af('0x3c')](_0x21f781);})[_0x62af('0x1f')](function(_0x629b53){_0xd9f1ed[_0x62af('0x3d')]=_0x629b53;return _0xd9f1ed;})[_0x62af('0x1f')](respondWithFilteredResult(_0x122c77,_0x21f781))[_0x62af('0x3e')](handleError(_0x122c77,null));}; \ No newline at end of file +var _0xb76c=['name','send','index','map','Migration','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','set','apply','reject','save','update','destroy','then','sendStatus','error','stack'];(function(_0x5c9bbc,_0x1c8307){var _0x53a157=function(_0x3a3260){while(--_0x3a3260){_0x5c9bbc['push'](_0x5c9bbc['shift']());}};_0x53a157(++_0x1c8307);}(_0xb76c,0xf7));var _0xcb76=function(_0x5b7788,_0x309ae5){_0x5b7788=_0x5b7788-0x0;var _0x573871=_0xb76c[_0x5b7788];return _0x573871;};'use strict';var emlformat=require(_0xcb76('0x0'));var rimraf=require(_0xcb76('0x1'));var zipdir=require(_0xcb76('0x2'));var jsonpatch=require(_0xcb76('0x3'));var rp=require(_0xcb76('0x4'));var moment=require(_0xcb76('0x5'));var BPromise=require(_0xcb76('0x6'));var Mustache=require('mustache');var util=require(_0xcb76('0x7'));var path=require(_0xcb76('0x8'));var sox=require(_0xcb76('0x9'));var csv=require(_0xcb76('0xa'));var ejs=require(_0xcb76('0xb'));var fs=require('fs');var fs_extra=require(_0xcb76('0xc'));var _=require(_0xcb76('0xd'));var squel=require(_0xcb76('0xe'));var crypto=require(_0xcb76('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcb76('0xa'));var querystring=require('querystring');var Papa=require(_0xcb76('0x10'));var Redis=require(_0xcb76('0x11'));var authService=require(_0xcb76('0x12'));var qs=require(_0xcb76('0x13'));var as=require(_0xcb76('0x14'));var hardwareService=require(_0xcb76('0x15'));var logger=require(_0xcb76('0x16'))(_0xcb76('0x17'));var utils=require(_0xcb76('0x18'));var config=require(_0xcb76('0x19'));var licenseUtil=require(_0xcb76('0x1a'));var db=require(_0xcb76('0x1b'))['db'];function respondWithStatusCode(_0x12b13a,_0x27c738){_0x27c738=_0x27c738||0xcc;return function(_0x4dd583){if(_0x4dd583){return _0x12b13a['sendStatus'](_0x27c738);}return _0x12b13a['status'](_0x27c738)[_0xcb76('0x1c')]();};}function respondWithResult(_0x80d0bc,_0x3c5ea8){_0x3c5ea8=_0x3c5ea8||0xc8;return function(_0x592a24){if(_0x592a24){return _0x80d0bc[_0xcb76('0x1d')](_0x3c5ea8)[_0xcb76('0x1e')](_0x592a24);}};}function respondWithFilteredResult(_0xa920f1,_0x15c083){return function(_0xb7519){if(_0xb7519){var _0x5b9438=typeof _0x15c083[_0xcb76('0x1f')]==='undefined'&&typeof _0x15c083[_0xcb76('0x20')]===_0xcb76('0x21');var _0x2ffa5b=_0xb7519[_0xcb76('0x22')];var _0x340afa=_0x5b9438?0x0:_0x15c083[_0xcb76('0x1f')];var _0xab3f06=_0x5b9438?_0xb7519[_0xcb76('0x22')]:_0x15c083[_0xcb76('0x1f')]+_0x15c083['limit'];var _0x45dba2;if(_0xab3f06>=_0x2ffa5b){_0xab3f06=_0x2ffa5b;_0x45dba2=0xc8;}else{_0x45dba2=0xce;}_0xa920f1[_0xcb76('0x1d')](_0x45dba2);return _0xa920f1[_0xcb76('0x23')]('Content-Range',_0x340afa+'-'+_0xab3f06+'/'+_0x2ffa5b)[_0xcb76('0x1e')](_0xb7519);}return null;};}function patchUpdates(_0x49c765){return function(_0x5958d9){try{jsonpatch[_0xcb76('0x24')](_0x5958d9,_0x49c765,!![]);}catch(_0x5ccb82){return BPromise[_0xcb76('0x25')](_0x5ccb82);}return _0x5958d9[_0xcb76('0x26')]();};}function saveUpdates(_0xf51596,_0x4bd3c4){return function(_0x30cbef){if(_0x30cbef){return _0x30cbef[_0xcb76('0x27')](_0xf51596)['then'](function(_0x55afeb){return _0x55afeb;});}return null;};}function removeEntity(_0x1571c5,_0x62d49b){return function(_0x212c0f){if(_0x212c0f){return _0x212c0f[_0xcb76('0x28')]()[_0xcb76('0x29')](function(){_0x1571c5[_0xcb76('0x1d')](0xcc)[_0xcb76('0x1c')]();});}};}function handleEntityNotFound(_0x4220c5,_0x22d6a1){return function(_0x5acbaa){if(!_0x5acbaa){_0x4220c5[_0xcb76('0x2a')](0x194);}return _0x5acbaa;};}function handleError(_0x401c6a,_0x49917e){_0x49917e=_0x49917e||0x1f4;return function(_0x292c8d){logger[_0xcb76('0x2b')](_0x292c8d[_0xcb76('0x2c')]);if(_0x292c8d[_0xcb76('0x2d')]){delete _0x292c8d[_0xcb76('0x2d')];}_0x401c6a[_0xcb76('0x1d')](_0x49917e)[_0xcb76('0x2e')](_0x292c8d);};}exports[_0xcb76('0x2f')]=function(_0x142bf9,_0x2a8587){var _0x27cb1b={},_0xf280d3={},_0x14cc4b={'count':0x0,'rows':[]};var _0x35806b=_[_0xcb76('0x30')](db[_0xcb76('0x31')][_0xcb76('0x32')],function(_0x4ecb5a){return{'name':_0x4ecb5a[_0xcb76('0x33')],'type':_0x4ecb5a['type'][_0xcb76('0x34')]};});_0xf280d3[_0xcb76('0x35')]=_[_0xcb76('0x30')](_0x35806b,'name');_0xf280d3[_0xcb76('0x36')]=_[_0xcb76('0x37')](_0x142bf9['query']);_0xf280d3['filters']=_[_0xcb76('0x38')](_0xf280d3[_0xcb76('0x35')],_0xf280d3['query']);_0x27cb1b[_0xcb76('0x39')]=_['intersection'](_0xf280d3['model'],qs['fields'](_0x142bf9[_0xcb76('0x36')]['fields']));_0x27cb1b[_0xcb76('0x39')]=_0x27cb1b[_0xcb76('0x39')][_0xcb76('0x3a')]?_0x27cb1b[_0xcb76('0x39')]:_0xf280d3[_0xcb76('0x35')];if(!_0x142bf9[_0xcb76('0x36')][_0xcb76('0x3b')](_0xcb76('0x3c'))){_0x27cb1b[_0xcb76('0x20')]=qs[_0xcb76('0x20')](_0x142bf9[_0xcb76('0x36')][_0xcb76('0x20')]);_0x27cb1b[_0xcb76('0x1f')]=qs[_0xcb76('0x1f')](_0x142bf9['query'][_0xcb76('0x1f')]);}_0x27cb1b[_0xcb76('0x3d')]=qs['sort'](_0x142bf9[_0xcb76('0x36')][_0xcb76('0x3e')]);_0x27cb1b[_0xcb76('0x3f')]=qs[_0xcb76('0x40')](_['pick'](_0x142bf9['query'],_0xf280d3['filters']),_0x35806b);if(_0x142bf9[_0xcb76('0x36')][_0xcb76('0x41')]){_0x27cb1b[_0xcb76('0x3f')]=_[_0xcb76('0x42')](_0x27cb1b[_0xcb76('0x3f')],{'$or':_[_0xcb76('0x30')](_0x35806b,function(_0x1e4d2d){if(_0x1e4d2d['type']!=='VIRTUAL'){var _0xd79130={};_0xd79130[_0x1e4d2d[_0xcb76('0x2d')]]={'$like':'%'+_0x142bf9['query'][_0xcb76('0x41')]+'%'};return _0xd79130;}})});}_0x27cb1b=_['merge']({},_0x27cb1b,_0x142bf9[_0xcb76('0x43')]);var _0x39af7e={'where':_0x27cb1b[_0xcb76('0x3f')]};return db['Migration'][_0xcb76('0x22')](_0x39af7e)[_0xcb76('0x29')](function(_0x1730bb){_0x14cc4b[_0xcb76('0x22')]=_0x1730bb;if(_0x142bf9[_0xcb76('0x36')][_0xcb76('0x44')]){_0x27cb1b[_0xcb76('0x45')]=[{'all':!![]}];}return db[_0xcb76('0x31')][_0xcb76('0x46')](_0x27cb1b);})[_0xcb76('0x29')](function(_0x44759c){_0x14cc4b[_0xcb76('0x47')]=_0x44759c;return _0x14cc4b;})[_0xcb76('0x29')](respondWithFilteredResult(_0x2a8587,_0x27cb1b))[_0xcb76('0x48')](handleError(_0x2a8587,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 05a201c..849d503 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 _0x3453=['request-promise','path','./migration.attributes','exports','Migration','migrations','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3453,0x1a8));var _0x3345=function(_0x49c663,_0x37d7a3){_0x49c663=_0x49c663-0x0;var _0x5a3e7e=_0x3453[_0x49c663];return _0x5a3e7e;};'use strict';var _=require(_0x3345('0x0'));var util=require('util');var logger=require(_0x3345('0x1'))(_0x3345('0x2'));var moment=require(_0x3345('0x3'));var BPromise=require(_0x3345('0x4'));var rp=require(_0x3345('0x5'));var fs=require('fs');var path=require(_0x3345('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3345('0x7'));module[_0x3345('0x8')]=function(_0x4178fa,_0x95f410){return _0x4178fa['define'](_0x3345('0x9'),attributes,{'tableName':_0x3345('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x635b=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','define','migrations','lodash'];(function(_0x3f2ebf,_0x5bd45a){var _0x3fc2bf=function(_0x154f6e){while(--_0x154f6e){_0x3f2ebf['push'](_0x3f2ebf['shift']());}};_0x3fc2bf(++_0x5bd45a);}(_0x635b,0x8e));var _0xb635=function(_0x1817a0,_0x2c41da){_0x1817a0=_0x1817a0-0x0;var _0x216dc4=_0x635b[_0x1817a0];return _0x216dc4;};'use strict';var _=require(_0xb635('0x0'));var util=require(_0xb635('0x1'));var logger=require(_0xb635('0x2'))(_0xb635('0x3'));var moment=require(_0xb635('0x4'));var BPromise=require('bluebird');var rp=require(_0xb635('0x5'));var fs=require('fs');var path=require(_0xb635('0x6'));var rimraf=require(_0xb635('0x7'));var config=require(_0xb635('0x8'));var attributes=require(_0xb635('0x9'));module[_0xb635('0xa')]=function(_0x59ff62,_0x3b1df0){return _0x59ff62[_0xb635('0xb')]('Migration',attributes,{'tableName':_0xb635('0xc'),'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 af420d5..af0751e 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 _0x4a3c=['info','Migration,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3d8130,_0x2d75d9){var _0x5c0013=function(_0x3d0bc){while(--_0x3d0bc){_0x3d8130['push'](_0x3d8130['shift']());}};_0x5c0013(++_0x2d75d9);}(_0x4a3c,0x13c));var _0xc4a3=function(_0x5937fa,_0x2fcb44){_0x5937fa=_0x5937fa-0x0;var _0x67edcb=_0x4a3c[_0x5937fa];return _0x67edcb;};'use strict';var _=require(_0xc4a3('0x0'));var util=require('util');var moment=require(_0xc4a3('0x1'));var BPromise=require(_0xc4a3('0x2'));var rs=require(_0xc4a3('0x3'));var fs=require('fs');var Redis=require(_0xc4a3('0x4'));var db=require(_0xc4a3('0x5'))['db'];var utils=require(_0xc4a3('0x6'));var logger=require(_0xc4a3('0x7'))('rpc');var config=require(_0xc4a3('0x8'));var jayson=require(_0xc4a3('0x9'));var client=jayson[_0xc4a3('0xa')][_0xc4a3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b1c84,_0x49fa26,_0x596b01){return new BPromise(function(_0xc11c29,_0x58bdcd){return client[_0xc4a3('0xc')](_0x4b1c84,_0x596b01)[_0xc4a3('0xd')](function(_0x1e7f27){logger[_0xc4a3('0xe')](_0xc4a3('0xf'),_0x49fa26,_0xc4a3('0x10'));logger[_0xc4a3('0x11')]('Migration,\x20%s,\x20%s,\x20%s',_0x49fa26,'request\x20sent',JSON['stringify'](_0x1e7f27));if(_0x1e7f27['error']){if(_0x1e7f27['error']['code']===0x1f4){logger['error'](_0xc4a3('0xf'),_0x49fa26,_0x1e7f27[_0xc4a3('0x12')][_0xc4a3('0x13')]);return _0x58bdcd(_0x1e7f27[_0xc4a3('0x12')]['message']);}logger[_0xc4a3('0x12')](_0xc4a3('0xf'),_0x49fa26,_0x1e7f27['error'][_0xc4a3('0x13')]);return _0xc11c29(_0x1e7f27[_0xc4a3('0x12')][_0xc4a3('0x13')]);}else{logger[_0xc4a3('0xe')](_0xc4a3('0xf'),_0x49fa26,_0xc4a3('0x10'));_0xc11c29(_0x1e7f27[_0xc4a3('0x14')][_0xc4a3('0x13')]);}})[_0xc4a3('0x15')](function(_0x584b6d){logger[_0xc4a3('0x12')](_0xc4a3('0xf'),_0x49fa26,_0x584b6d);_0x58bdcd(_0x584b6d);});});} \ No newline at end of file +var _0xdca3=['code','message','Migration,\x20%s,\x20%s','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1c0dcd,_0x1975b0){var _0x13da9c=function(_0x344698){while(--_0x344698){_0x1c0dcd['push'](_0x1c0dcd['shift']());}};_0x13da9c(++_0x1975b0);}(_0xdca3,0x64));var _0x3dca=function(_0x3bd138,_0x244943){_0x3bd138=_0x3bd138-0x0;var _0x250080=_0xdca3[_0x3bd138];return _0x250080;};'use strict';var _=require(_0x3dca('0x0'));var util=require('util');var moment=require(_0x3dca('0x1'));var BPromise=require(_0x3dca('0x2'));var rs=require(_0x3dca('0x3'));var fs=require('fs');var Redis=require(_0x3dca('0x4'));var db=require(_0x3dca('0x5'))['db'];var utils=require(_0x3dca('0x6'));var logger=require(_0x3dca('0x7'))(_0x3dca('0x8'));var config=require(_0x3dca('0x9'));var jayson=require(_0x3dca('0xa'));var client=jayson[_0x3dca('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4234a1,_0x5d52c3,_0x57264a){return new BPromise(function(_0xdea879,_0x576218){return client[_0x3dca('0xc')](_0x4234a1,_0x57264a)[_0x3dca('0xd')](function(_0x123b66){logger[_0x3dca('0xe')]('Migration,\x20%s,\x20%s',_0x5d52c3,_0x3dca('0xf'));logger[_0x3dca('0x10')](_0x3dca('0x11'),_0x5d52c3,_0x3dca('0xf'),JSON[_0x3dca('0x12')](_0x123b66));if(_0x123b66[_0x3dca('0x13')]){if(_0x123b66['error'][_0x3dca('0x14')]===0x1f4){logger['error']('Migration,\x20%s,\x20%s',_0x5d52c3,_0x123b66[_0x3dca('0x13')][_0x3dca('0x15')]);return _0x576218(_0x123b66[_0x3dca('0x13')][_0x3dca('0x15')]);}logger[_0x3dca('0x13')](_0x3dca('0x16'),_0x5d52c3,_0x123b66[_0x3dca('0x13')][_0x3dca('0x15')]);return _0xdea879(_0x123b66[_0x3dca('0x13')][_0x3dca('0x15')]);}else{logger[_0x3dca('0xe')](_0x3dca('0x16'),_0x5d52c3,_0x3dca('0xf'));_0xdea879(_0x123b66['result']['message']);}})[_0x3dca('0x17')](function(_0xb5b508){logger[_0x3dca('0x13')](_0x3dca('0x16'),_0x5d52c3,_0xb5b508);_0x576218(_0xb5b508);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index fcb24af..a9c0ea7 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 _0xd98a=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x41d931,_0x556666){var _0x3d5592=function(_0x161993){while(--_0x161993){_0x41d931['push'](_0x41d931['shift']());}};_0x3d5592(++_0x556666);}(_0xd98a,0xfc));var _0xad98=function(_0x922df1,_0x28f053){_0x922df1=_0x922df1-0x0;var _0x3291dc=_0xd98a[_0x922df1];return _0x3291dc;};'use strict';var multer=require(_0xad98('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xad98('0x1'));var express=require(_0xad98('0x2'));var router=express[_0xad98('0x3')]();var fs_extra=require(_0xad98('0x4'));var auth=require(_0xad98('0x5'));var interaction=require(_0xad98('0x6'));var config=require('../../config/environment');var controller=require('./network.controller');router[_0xad98('0x7')]('/',auth[_0xad98('0x8')](),controller[_0xad98('0x9')]);router[_0xad98('0x7')](_0xad98('0xa'),auth['isAuthenticated'](),controller[_0xad98('0xb')]);router[_0xad98('0xc')]('/',auth['isAuthenticated'](),controller[_0xad98('0xd')]);router['put'](_0xad98('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xad98('0xa'),auth[_0xad98('0x8')](),controller[_0xad98('0xe')]);module[_0xad98('0xf')]=router; \ No newline at end of file +var _0x7b77=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./network.controller','get','isAuthenticated','index','show','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x876ede,_0x41acdb){var _0x4f9e39=function(_0x20f2a0){while(--_0x20f2a0){_0x876ede['push'](_0x876ede['shift']());}};_0x4f9e39(++_0x41acdb);}(_0x7b77,0x179));var _0x77b7=function(_0x5eef05,_0x1be989){_0x5eef05=_0x5eef05-0x0;var _0x56d4b8=_0x7b77[_0x5eef05];return _0x56d4b8;};'use strict';var multer=require(_0x77b7('0x0'));var util=require(_0x77b7('0x1'));var path=require(_0x77b7('0x2'));var timeout=require(_0x77b7('0x3'));var express=require('express');var router=express[_0x77b7('0x4')]();var fs_extra=require(_0x77b7('0x5'));var auth=require(_0x77b7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x77b7('0x7'));var controller=require(_0x77b7('0x8'));router[_0x77b7('0x9')]('/',auth[_0x77b7('0xa')](),controller[_0x77b7('0xb')]);router[_0x77b7('0x9')]('/:id',auth[_0x77b7('0xa')](),controller[_0x77b7('0xc')]);router[_0x77b7('0xd')]('/',auth['isAuthenticated'](),controller[_0x77b7('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x77b7('0xf')]);router[_0x77b7('0x10')]('/:id',auth[_0x77b7('0xa')](),controller[_0x77b7('0x11')]);module[_0x77b7('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 898ccc2..2856be1 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 _0x91f6=['ENUM','localnet','externip','stun','turn','STRING','sequelize','exports'];(function(_0x4f3c9b,_0x28e078){var _0x84e58a=function(_0x37bf49){while(--_0x37bf49){_0x4f3c9b['push'](_0x4f3c9b['shift']());}};_0x84e58a(++_0x28e078);}(_0x91f6,0x17e));var _0x691f=function(_0x4bbd64,_0x120e52){_0x4bbd64=_0x4bbd64-0x0;var _0x31b17a=_0x91f6[_0x4bbd64];return _0x31b17a;};'use strict';var Sequelize=require(_0x691f('0x0'));module[_0x691f('0x1')]={'type':{'type':Sequelize[_0x691f('0x2')](_0x691f('0x3'),_0x691f('0x4'),_0x691f('0x5'),_0x691f('0x6'))},'value':{'type':Sequelize[_0x691f('0x7')]},'username':{'type':Sequelize[_0x691f('0x7')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x033a=['STRING','sequelize','exports','localnet','stun','turn'];(function(_0x388b56,_0x447c34){var _0x1f0d4c=function(_0x2d26e3){while(--_0x2d26e3){_0x388b56['push'](_0x388b56['shift']());}};_0x1f0d4c(++_0x447c34);}(_0x033a,0x14b));var _0xa033=function(_0x430f44,_0x4ae21b){_0x430f44=_0x430f44-0x0;var _0x1f6b0f=_0x033a[_0x430f44];return _0x1f6b0f;};'use strict';var Sequelize=require(_0xa033('0x0'));module[_0xa033('0x1')]={'type':{'type':Sequelize['ENUM'](_0xa033('0x2'),'externip',_0xa033('0x3'),_0xa033('0x4'))},'value':{'type':Sequelize[_0xa033('0x5')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xa033('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 0704716..bf64585 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 _0xe92d=['then','sendStatus','stack','name','send','index','map','Network','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','nolimit','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','rows','params','length','options','create','body','findAll','toUpperCase','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','join','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','format','toLowerCase','chan_sip.so','find','STUN','update','TURN','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','destroy','path','ejs','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count'];(function(_0x5a4ca9,_0x38478f){var _0x300e8b=function(_0x3f6dc4){while(--_0x3f6dc4){_0x5a4ca9['push'](_0x5a4ca9['shift']());}};_0x300e8b(++_0x38478f);}(_0xe92d,0x8d));var _0xde92=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xe92d[_0x126558];return _0x1f6d14;};'use strict';var util=require('util');var path=require(_0xde92('0x0'));var ejs=require(_0xde92('0x1'));var fs=require('fs');var _=require(_0xde92('0x2'));var qs=require(_0xde92('0x3'));var logger=require('../../config/logger')(_0xde92('0x4'));var config=require(_0xde92('0x5'));var db=require(_0xde92('0x6'))['db'];var jayson=require(_0xde92('0x7'));var client=jayson[_0xde92('0x8')][_0xde92('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24249f,_0x149f1b,_0x49edd3,_0x396259){return new Promise(function(_0x381abe,_0x1a726b){var _0x4d6fd1=_0x396259||client;return _0x4d6fd1[_0xde92('0xa')](_0x24249f,_0x49edd3)['then'](function(_0x1cab13){logger[_0xde92('0xb')](_0xde92('0xc'),_0x149f1b,_0xde92('0xd'));logger['debug'](_0xde92('0xe'),_0x149f1b,'request\x20sent',JSON[_0xde92('0xf')](_0x1cab13));if(_0x1cab13[_0xde92('0x10')]){if(_0x1cab13[_0xde92('0x10')][_0xde92('0x11')]===0x1f4){logger[_0xde92('0x10')]('Network,\x20%s,\x20%s',_0x149f1b,_0x1cab13[_0xde92('0x10')][_0xde92('0x12')]);return _0x1a726b(_0x1cab13[_0xde92('0x10')][_0xde92('0x12')]);}logger['error'](_0xde92('0xc'),_0x149f1b,_0x1cab13[_0xde92('0x10')][_0xde92('0x12')]);return _0x381abe(_0x1cab13[_0xde92('0x10')][_0xde92('0x12')]);}else{logger[_0xde92('0xb')](_0xde92('0xc'),_0x149f1b,_0xde92('0xd'));_0x381abe(_0x1cab13[_0xde92('0x13')][_0xde92('0x12')]);}})[_0xde92('0x14')](function(_0x37ced3){logger[_0xde92('0x10')](_0xde92('0xc'),_0x149f1b,_0x37ced3);_0x1a726b(_0x37ced3);});});}function respondWithResult(_0x13742c,_0x2eef51){_0x2eef51=_0x2eef51||0xc8;return function(_0x5dcb05){if(_0x5dcb05){return _0x13742c[_0xde92('0x15')](_0x2eef51)[_0xde92('0x16')](_0x5dcb05);}};}function respondWithFilteredResult(_0x6ed195,_0x10391a){return function(_0xac9401){if(_0xac9401){var _0x3b19e9=typeof _0x10391a[_0xde92('0x17')]===_0xde92('0x18')&&typeof _0x10391a[_0xde92('0x19')]===_0xde92('0x18');var _0x38084c=_0xac9401[_0xde92('0x1a')];var _0xa2b5f5=_0x3b19e9?0x0:_0x10391a['offset'];var _0x2c4c78=_0x3b19e9?_0xac9401['count']:_0x10391a[_0xde92('0x17')]+_0x10391a['limit'];var _0x21f6f7;if(_0x2c4c78>=_0x38084c){_0x2c4c78=_0x38084c;_0x21f6f7=0xc8;}else{_0x21f6f7=0xce;}_0x6ed195[_0xde92('0x15')](_0x21f6f7);return _0x6ed195['set']('Content-Range',_0xa2b5f5+'-'+_0x2c4c78+'/'+_0x38084c)[_0xde92('0x16')](_0xac9401);}return null;};}function saveUpdates(_0xd95ad6){return function(_0x4163a9){if(_0x4163a9){return _0x4163a9['update'](_0xd95ad6)[_0xde92('0x1b')](function(_0x41492a){return _0x41492a;});}return null;};}function removeEntity(_0x1d5e6d){return function(_0x4551c9){if(_0x4551c9){return _0x4551c9['destroy']()[_0xde92('0x1b')](function(){_0x1d5e6d[_0xde92('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b3646){return function(_0x420bff){if(!_0x420bff){_0x2b3646[_0xde92('0x1c')](0x194);}return _0x420bff;};}function handleError(_0x4a6b6f,_0x5cf27b){_0x5cf27b=_0x5cf27b||0x1f4;return function(_0x305e13){logger[_0xde92('0x10')](_0x305e13[_0xde92('0x1d')]);if(_0x305e13['name']){delete _0x305e13[_0xde92('0x1e')];}_0x4a6b6f[_0xde92('0x15')](_0x5cf27b)[_0xde92('0x1f')](_0x305e13);};}exports[_0xde92('0x20')]=function(_0x421d06,_0x2cf706){var _0x235955={},_0x1a51c2={},_0x308aa8={'count':0x0,'rows':[]};var _0x28f1a4=_[_0xde92('0x21')](db[_0xde92('0x22')][_0xde92('0x23')],function(_0x3b88f4){return{'name':_0x3b88f4[_0xde92('0x24')],'type':_0x3b88f4[_0xde92('0x25')][_0xde92('0x26')]};});_0x1a51c2[_0xde92('0x27')]=_[_0xde92('0x21')](_0x28f1a4,'name');_0x1a51c2['query']=_[_0xde92('0x28')](_0x421d06[_0xde92('0x29')]);_0x1a51c2['filters']=_[_0xde92('0x2a')](_0x1a51c2[_0xde92('0x27')],_0x1a51c2[_0xde92('0x29')]);_0x235955[_0xde92('0x2b')]=_['intersection'](_0x1a51c2['model'],qs[_0xde92('0x2c')](_0x421d06[_0xde92('0x29')][_0xde92('0x2c')]));_0x235955['attributes']=_0x235955[_0xde92('0x2b')]['length']?_0x235955['attributes']:_0x1a51c2[_0xde92('0x27')];if(!_0x421d06[_0xde92('0x29')]['hasOwnProperty'](_0xde92('0x2d'))){_0x235955[_0xde92('0x19')]=qs[_0xde92('0x19')](_0x421d06['query'][_0xde92('0x19')]);_0x235955[_0xde92('0x17')]=qs[_0xde92('0x17')](_0x421d06['query'][_0xde92('0x17')]);}_0x235955['order']=qs['sort'](_0x421d06[_0xde92('0x29')][_0xde92('0x2e')]);_0x235955[_0xde92('0x2f')]=qs[_0xde92('0x30')](_['pick'](_0x421d06[_0xde92('0x29')],_0x1a51c2[_0xde92('0x30')]),_0x28f1a4);if(_0x421d06['query'][_0xde92('0x31')]){_0x235955['where']=_[_0xde92('0x32')](_0x235955[_0xde92('0x2f')],{'$or':_[_0xde92('0x21')](_0x28f1a4,function(_0x2f9d4a){if(_0x2f9d4a[_0xde92('0x25')]!==_0xde92('0x33')){var _0x8e90a1={};_0x8e90a1[_0x2f9d4a[_0xde92('0x1e')]]={'$like':'%'+_0x421d06[_0xde92('0x29')][_0xde92('0x31')]+'%'};return _0x8e90a1;}})});}_0x235955=_[_0xde92('0x32')]({},_0x235955,_0x421d06['options']);var _0x471f83={'where':_0x235955[_0xde92('0x2f')]};return db[_0xde92('0x22')][_0xde92('0x1a')](_0x471f83)[_0xde92('0x1b')](function(_0x5f4dcb){_0x308aa8[_0xde92('0x1a')]=_0x5f4dcb;if(_0x421d06[_0xde92('0x29')][_0xde92('0x34')]){_0x235955[_0xde92('0x35')]=[{'all':!![]}];}return db[_0xde92('0x22')]['findAll'](_0x235955);})[_0xde92('0x1b')](function(_0x47f94e){_0x308aa8[_0xde92('0x36')]=_0x47f94e;return _0x308aa8;})[_0xde92('0x1b')](respondWithFilteredResult(_0x2cf706,_0x235955))[_0xde92('0x14')](handleError(_0x2cf706,null));};exports['show']=function(_0x5d0f03,_0x1dea4d){var _0x199ace={'raw':!![],'where':{'id':_0x5d0f03[_0xde92('0x37')]['id']}},_0x351a71={};_0x351a71[_0xde92('0x27')]=_[_0xde92('0x28')](db[_0xde92('0x22')][_0xde92('0x23')]);_0x351a71[_0xde92('0x29')]=_[_0xde92('0x28')](_0x5d0f03[_0xde92('0x29')]);_0x351a71[_0xde92('0x30')]=_[_0xde92('0x2a')](_0x351a71[_0xde92('0x27')],_0x351a71[_0xde92('0x29')]);_0x199ace[_0xde92('0x2b')]=_[_0xde92('0x2a')](_0x351a71[_0xde92('0x27')],qs[_0xde92('0x2c')](_0x5d0f03[_0xde92('0x29')][_0xde92('0x2c')]));_0x199ace[_0xde92('0x2b')]=_0x199ace[_0xde92('0x2b')][_0xde92('0x38')]?_0x199ace[_0xde92('0x2b')]:_0x351a71[_0xde92('0x27')];if(_0x5d0f03[_0xde92('0x29')]['includeAll']){_0x199ace['include']=[{'all':!![]}];}_0x199ace=_[_0xde92('0x32')]({},_0x199ace,_0x5d0f03[_0xde92('0x39')]);return db[_0xde92('0x22')]['find'](_0x199ace)[_0xde92('0x1b')](handleEntityNotFound(_0x1dea4d,null))[_0xde92('0x1b')](respondWithResult(_0x1dea4d,null))['catch'](handleError(_0x1dea4d,null));};exports[_0xde92('0x3a')]=function(_0x425abd,_0x2feeff){var _0x383771;return db[_0xde92('0x22')][_0xde92('0x3a')](_0x425abd[_0xde92('0x3b')],{'raw':!![]})[_0xde92('0x1b')](function(_0x5042be){_0x383771=_0x5042be;return db['Network'][_0xde92('0x3c')]({'where':{'type':_0x425abd['body']['type']},'raw':!![]});})['then'](function(_0x356be0){if(_0x383771[_0xde92('0x25')][_0xde92('0x3d')]()=='STUN'){var _0xe22895=fs[_0xde92('0x3e')](path['join'](config[_0xde92('0x3f')],_0xde92('0x40')),_0xde92('0x41'));var _0x92987f=ejs[_0xde92('0x42')](_0xe22895,{'networks':_0x356be0||[]});fs[_0xde92('0x43')](_0xde92('0x44'),_0x92987f);return respondWithRpcPromise(_0xde92('0x45'),_0xde92('0x3a'),{'module':_0xde92('0x46')});}else if(_0x383771['type'][_0xde92('0x3d')]()=='TURN'){var _0x5d3a58=fs[_0xde92('0x3e')](path[_0xde92('0x47')](config[_0xde92('0x3f')],_0xde92('0x48')),_0xde92('0x41'));var _0x554fef=ejs[_0xde92('0x42')](_0x5d3a58,{'networks':_0x356be0||[]});fs[_0xde92('0x43')](_0xde92('0x49'),_0x554fef);return respondWithRpcPromise(_0xde92('0x45'),_0xde92('0x3a'),{'module':'res_stun_monitor.so'});}else{var _0x3fac88=fs[_0xde92('0x3e')](path[_0xde92('0x47')](config[_0xde92('0x3f')],'server/files/templates/network.ejs'),'utf8');var _0x165238=ejs[_0xde92('0x42')](_0x3fac88,{'networks':_0x356be0||[]});fs[_0xde92('0x43')](util[_0xde92('0x4a')]('/etc/asterisk/sip_xcally_%s.conf',_0x425abd[_0xde92('0x3b')]['type'][_0xde92('0x4b')]()),_0x165238);return respondWithRpcPromise('Reload',_0xde92('0x3a'),{'module':_0xde92('0x4c')});}})[_0xde92('0x1b')](function(){return _0x383771;})[_0xde92('0x1b')](respondWithResult(_0x2feeff,0xc9))[_0xde92('0x14')](handleError(_0x2feeff,null));};exports['update']=function(_0x422621,_0x268556){var _0x5d6308;return db['Network'][_0xde92('0x4d')]({'where':{'id':_0x422621[_0xde92('0x37')]['id']}})[_0xde92('0x1b')](handleEntityNotFound(_0x268556,null))['then'](saveUpdates(_0x422621[_0xde92('0x3b')],null))['then'](function(_0x3e5e29){if(_0x3e5e29){_0x5d6308=_0x3e5e29;return db['Network'][_0xde92('0x3c')]({'where':{'type':_0x5d6308[_0xde92('0x25')]},'raw':!![]});}return null;})[_0xde92('0x1b')](function(_0x224ce9){if(_0x5d6308[_0xde92('0x25')][_0xde92('0x3d')]()==_0xde92('0x4e')){var _0x132eec=fs[_0xde92('0x3e')](path[_0xde92('0x47')](config['root'],_0xde92('0x40')),'utf8');var _0x42f393=ejs[_0xde92('0x42')](_0x132eec,{'networks':_0x224ce9||[]});fs[_0xde92('0x43')](_0xde92('0x44'),_0x42f393);return respondWithRpcPromise(_0xde92('0x45'),_0xde92('0x4f'),{'module':_0xde92('0x46')});}else if(_0x5d6308['type'][_0xde92('0x3d')]()==_0xde92('0x50')){var _0x37820b=fs[_0xde92('0x3e')](path[_0xde92('0x47')](config[_0xde92('0x3f')],_0xde92('0x48')),'utf8');var _0x88d668=ejs[_0xde92('0x42')](_0x37820b,{'networks':_0x224ce9||[]});fs[_0xde92('0x43')](_0xde92('0x49'),_0x88d668);return respondWithRpcPromise(_0xde92('0x45'),_0xde92('0x4f'),{'module':_0xde92('0x46')});}else{var _0x1078e5=fs[_0xde92('0x3e')](path['join'](config[_0xde92('0x3f')],_0xde92('0x51')),_0xde92('0x41'));var _0x566d99=ejs[_0xde92('0x42')](_0x1078e5,{'networks':_0x224ce9||[]});fs[_0xde92('0x43')](util[_0xde92('0x4a')](_0xde92('0x52'),_0x422621['body']['type']['toLowerCase']()),_0x566d99);return respondWithRpcPromise(_0xde92('0x45'),_0xde92('0x4f'),{'module':_0xde92('0x4c')});}})[_0xde92('0x1b')](function(_0x46988d){if(_0x46988d){return _0x5d6308;}return null;})['then'](respondWithResult(_0x268556,null))[_0xde92('0x14')](handleError(_0x268556,null));};exports[_0xde92('0x53')]=function(_0x316060,_0x5a2bbe){var _0x2ba36d;return db[_0xde92('0x22')]['find']({'where':{'id':_0x316060['params']['id']}})[_0xde92('0x1b')](function(_0x1cc661){_0x2ba36d=_0x1cc661;return _0x1cc661;})[_0xde92('0x1b')](handleEntityNotFound(_0x5a2bbe,null))['then'](removeEntity(_0x5a2bbe,null))[_0xde92('0x1b')](function(){if(_0x2ba36d){return db[_0xde92('0x22')][_0xde92('0x3c')]({'where':{'type':_0x2ba36d[_0xde92('0x25')]},'raw':!![]});}})[_0xde92('0x1b')](function(_0x281f4e){if(_0x2ba36d[_0xde92('0x25')][_0xde92('0x3d')]()==_0xde92('0x4e')){var _0x529682=fs[_0xde92('0x3e')](path[_0xde92('0x47')](config['root'],_0xde92('0x40')),_0xde92('0x41'));var _0x3d3272=ejs[_0xde92('0x42')](_0x529682,{'networks':_0x281f4e||[]});fs['writeFileSync'](_0xde92('0x44'),_0x3d3272);return respondWithRpcPromise(_0xde92('0x45'),_0xde92('0x53'),{'module':_0xde92('0x46')});}else if(_0x2ba36d['type'][_0xde92('0x3d')]()==_0xde92('0x50')){var _0x39637d=fs[_0xde92('0x3e')](path[_0xde92('0x47')](config[_0xde92('0x3f')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0xb23945=ejs[_0xde92('0x42')](_0x39637d,{'networks':_0x281f4e||[]});fs[_0xde92('0x43')](_0xde92('0x49'),_0xb23945);return respondWithRpcPromise(_0xde92('0x45'),_0xde92('0x53'),{'module':'res_stun_monitor.so'});}else{var _0x56427b=fs[_0xde92('0x3e')](path['join'](config[_0xde92('0x3f')],_0xde92('0x51')),_0xde92('0x41'));var _0x3b4158=ejs[_0xde92('0x42')](_0x56427b,{'networks':_0x281f4e||[]});fs[_0xde92('0x43')](util[_0xde92('0x4a')](_0xde92('0x52'),_0x2ba36d['type'][_0xde92('0x4b')]()),_0x3b4158);return respondWithRpcPromise('Reload',_0xde92('0x53'),{'module':'chan_sip.so'});}})['catch'](handleError(_0x5a2bbe,null));}; \ No newline at end of file +var _0xa7b7=['../../mysqldb','client','http','then','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','json','offset','undefined','limit','count','status','Content-Range','update','end','sendStatus','stack','name','send','Network','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','show','params','length','options','find','create','body','toUpperCase','STUN','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','res_stun_monitor.so','TURN','chan_sip.so','destroy','util','path','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment'];(function(_0x1f9364,_0x203cbd){var _0x3b63a3=function(_0xa440bf){while(--_0xa440bf){_0x1f9364['push'](_0x1f9364['shift']());}};_0x3b63a3(++_0x203cbd);}(_0xa7b7,0xf8));var _0x7a7b=function(_0x156430,_0x4165d4){_0x156430=_0x156430-0x0;var _0x536d73=_0xa7b7[_0x156430];return _0x536d73;};'use strict';var util=require(_0x7a7b('0x0'));var path=require(_0x7a7b('0x1'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7a7b('0x2'));var qs=require(_0x7a7b('0x3'));var logger=require(_0x7a7b('0x4'))(_0x7a7b('0x5'));var config=require(_0x7a7b('0x6'));var db=require(_0x7a7b('0x7'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x7a7b('0x8')][_0x7a7b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53263c,_0x36f5ea,_0x5ca9e5,_0x35b316){return new Promise(function(_0x1a1d70,_0x8f5bf5){var _0x42aa8a=_0x35b316||client;return _0x42aa8a['request'](_0x53263c,_0x5ca9e5)[_0x7a7b('0xa')](function(_0x24af0b){logger['info'](_0x7a7b('0xb'),_0x36f5ea,_0x7a7b('0xc'));logger[_0x7a7b('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x36f5ea,_0x7a7b('0xc'),JSON[_0x7a7b('0xe')](_0x24af0b));if(_0x24af0b[_0x7a7b('0xf')]){if(_0x24af0b[_0x7a7b('0xf')][_0x7a7b('0x10')]===0x1f4){logger['error'](_0x7a7b('0xb'),_0x36f5ea,_0x24af0b['error'][_0x7a7b('0x11')]);return _0x8f5bf5(_0x24af0b[_0x7a7b('0xf')]['message']);}logger[_0x7a7b('0xf')](_0x7a7b('0xb'),_0x36f5ea,_0x24af0b['error'][_0x7a7b('0x11')]);return _0x1a1d70(_0x24af0b[_0x7a7b('0xf')][_0x7a7b('0x11')]);}else{logger[_0x7a7b('0x12')]('Network,\x20%s,\x20%s',_0x36f5ea,'request\x20sent');_0x1a1d70(_0x24af0b[_0x7a7b('0x13')][_0x7a7b('0x11')]);}})[_0x7a7b('0x14')](function(_0x50e52a){logger[_0x7a7b('0xf')](_0x7a7b('0xb'),_0x36f5ea,_0x50e52a);_0x8f5bf5(_0x50e52a);});});}function respondWithResult(_0xcdd838,_0x40fecf){_0x40fecf=_0x40fecf||0xc8;return function(_0x440537){if(_0x440537){return _0xcdd838['status'](_0x40fecf)[_0x7a7b('0x15')](_0x440537);}};}function respondWithFilteredResult(_0x4f0d67,_0x2c5592){return function(_0x2feb84){if(_0x2feb84){var _0x5d14b8=typeof _0x2c5592[_0x7a7b('0x16')]===_0x7a7b('0x17')&&typeof _0x2c5592[_0x7a7b('0x18')]===_0x7a7b('0x17');var _0x507acc=_0x2feb84[_0x7a7b('0x19')];var _0x342864=_0x5d14b8?0x0:_0x2c5592['offset'];var _0x5a37c4=_0x5d14b8?_0x2feb84[_0x7a7b('0x19')]:_0x2c5592[_0x7a7b('0x16')]+_0x2c5592[_0x7a7b('0x18')];var _0x198631;if(_0x5a37c4>=_0x507acc){_0x5a37c4=_0x507acc;_0x198631=0xc8;}else{_0x198631=0xce;}_0x4f0d67[_0x7a7b('0x1a')](_0x198631);return _0x4f0d67['set'](_0x7a7b('0x1b'),_0x342864+'-'+_0x5a37c4+'/'+_0x507acc)[_0x7a7b('0x15')](_0x2feb84);}return null;};}function saveUpdates(_0x4abf28){return function(_0x1e69aa){if(_0x1e69aa){return _0x1e69aa[_0x7a7b('0x1c')](_0x4abf28)[_0x7a7b('0xa')](function(_0x2dfed0){return _0x2dfed0;});}return null;};}function removeEntity(_0x308ad0){return function(_0x42099f){if(_0x42099f){return _0x42099f['destroy']()[_0x7a7b('0xa')](function(){_0x308ad0[_0x7a7b('0x1a')](0xcc)[_0x7a7b('0x1d')]();});}};}function handleEntityNotFound(_0x55c199){return function(_0x12ab58){if(!_0x12ab58){_0x55c199[_0x7a7b('0x1e')](0x194);}return _0x12ab58;};}function handleError(_0x54af9e,_0x4e28ef){_0x4e28ef=_0x4e28ef||0x1f4;return function(_0x653e5a){logger[_0x7a7b('0xf')](_0x653e5a[_0x7a7b('0x1f')]);if(_0x653e5a[_0x7a7b('0x20')]){delete _0x653e5a[_0x7a7b('0x20')];}_0x54af9e[_0x7a7b('0x1a')](_0x4e28ef)[_0x7a7b('0x21')](_0x653e5a);};}exports['index']=function(_0x519bb5,_0x5d7a6c){var _0x56d690={},_0xfaa8b0={},_0x2b20b9={'count':0x0,'rows':[]};var _0x163899=_['map'](db[_0x7a7b('0x22')][_0x7a7b('0x23')],function(_0x502b1b){return{'name':_0x502b1b[_0x7a7b('0x24')],'type':_0x502b1b[_0x7a7b('0x25')][_0x7a7b('0x26')]};});_0xfaa8b0[_0x7a7b('0x27')]=_[_0x7a7b('0x28')](_0x163899,'name');_0xfaa8b0[_0x7a7b('0x29')]=_[_0x7a7b('0x2a')](_0x519bb5[_0x7a7b('0x29')]);_0xfaa8b0[_0x7a7b('0x2b')]=_[_0x7a7b('0x2c')](_0xfaa8b0['model'],_0xfaa8b0[_0x7a7b('0x29')]);_0x56d690[_0x7a7b('0x2d')]=_[_0x7a7b('0x2c')](_0xfaa8b0[_0x7a7b('0x27')],qs['fields'](_0x519bb5[_0x7a7b('0x29')][_0x7a7b('0x2e')]));_0x56d690[_0x7a7b('0x2d')]=_0x56d690['attributes']['length']?_0x56d690['attributes']:_0xfaa8b0[_0x7a7b('0x27')];if(!_0x519bb5[_0x7a7b('0x29')][_0x7a7b('0x2f')]('nolimit')){_0x56d690[_0x7a7b('0x18')]=qs[_0x7a7b('0x18')](_0x519bb5[_0x7a7b('0x29')]['limit']);_0x56d690[_0x7a7b('0x16')]=qs['offset'](_0x519bb5[_0x7a7b('0x29')][_0x7a7b('0x16')]);}_0x56d690[_0x7a7b('0x30')]=qs[_0x7a7b('0x31')](_0x519bb5[_0x7a7b('0x29')][_0x7a7b('0x31')]);_0x56d690['where']=qs[_0x7a7b('0x2b')](_[_0x7a7b('0x32')](_0x519bb5[_0x7a7b('0x29')],_0xfaa8b0[_0x7a7b('0x2b')]),_0x163899);if(_0x519bb5[_0x7a7b('0x29')][_0x7a7b('0x33')]){_0x56d690['where']=_[_0x7a7b('0x34')](_0x56d690[_0x7a7b('0x35')],{'$or':_[_0x7a7b('0x28')](_0x163899,function(_0x15eca4){if(_0x15eca4[_0x7a7b('0x25')]!==_0x7a7b('0x36')){var _0xd34ec2={};_0xd34ec2[_0x15eca4[_0x7a7b('0x20')]]={'$like':'%'+_0x519bb5[_0x7a7b('0x29')][_0x7a7b('0x33')]+'%'};return _0xd34ec2;}})});}_0x56d690=_[_0x7a7b('0x34')]({},_0x56d690,_0x519bb5['options']);var _0x3bdacd={'where':_0x56d690[_0x7a7b('0x35')]};return db[_0x7a7b('0x22')][_0x7a7b('0x19')](_0x3bdacd)[_0x7a7b('0xa')](function(_0x4d9e87){_0x2b20b9['count']=_0x4d9e87;if(_0x519bb5[_0x7a7b('0x29')][_0x7a7b('0x37')]){_0x56d690[_0x7a7b('0x38')]=[{'all':!![]}];}return db[_0x7a7b('0x22')][_0x7a7b('0x39')](_0x56d690);})[_0x7a7b('0xa')](function(_0x1935f6){_0x2b20b9['rows']=_0x1935f6;return _0x2b20b9;})[_0x7a7b('0xa')](respondWithFilteredResult(_0x5d7a6c,_0x56d690))[_0x7a7b('0x14')](handleError(_0x5d7a6c,null));};exports[_0x7a7b('0x3a')]=function(_0xdf987d,_0x4ff1e4){var _0x1e5625={'raw':!![],'where':{'id':_0xdf987d[_0x7a7b('0x3b')]['id']}},_0x1a51db={};_0x1a51db[_0x7a7b('0x27')]=_[_0x7a7b('0x2a')](db[_0x7a7b('0x22')]['rawAttributes']);_0x1a51db[_0x7a7b('0x29')]=_[_0x7a7b('0x2a')](_0xdf987d[_0x7a7b('0x29')]);_0x1a51db[_0x7a7b('0x2b')]=_[_0x7a7b('0x2c')](_0x1a51db['model'],_0x1a51db[_0x7a7b('0x29')]);_0x1e5625[_0x7a7b('0x2d')]=_[_0x7a7b('0x2c')](_0x1a51db[_0x7a7b('0x27')],qs[_0x7a7b('0x2e')](_0xdf987d[_0x7a7b('0x29')]['fields']));_0x1e5625['attributes']=_0x1e5625[_0x7a7b('0x2d')][_0x7a7b('0x3c')]?_0x1e5625[_0x7a7b('0x2d')]:_0x1a51db[_0x7a7b('0x27')];if(_0xdf987d[_0x7a7b('0x29')][_0x7a7b('0x37')]){_0x1e5625[_0x7a7b('0x38')]=[{'all':!![]}];}_0x1e5625=_[_0x7a7b('0x34')]({},_0x1e5625,_0xdf987d[_0x7a7b('0x3d')]);return db[_0x7a7b('0x22')][_0x7a7b('0x3e')](_0x1e5625)[_0x7a7b('0xa')](handleEntityNotFound(_0x4ff1e4,null))[_0x7a7b('0xa')](respondWithResult(_0x4ff1e4,null))['catch'](handleError(_0x4ff1e4,null));};exports[_0x7a7b('0x3f')]=function(_0x15394d,_0xf6cf0a){var _0x4aa2fc;return db[_0x7a7b('0x22')]['create'](_0x15394d['body'],{'raw':!![]})['then'](function(_0x26fdfa){_0x4aa2fc=_0x26fdfa;return db[_0x7a7b('0x22')][_0x7a7b('0x39')]({'where':{'type':_0x15394d[_0x7a7b('0x40')]['type']},'raw':!![]});})[_0x7a7b('0xa')](function(_0x2359ab){if(_0x4aa2fc[_0x7a7b('0x25')][_0x7a7b('0x41')]()==_0x7a7b('0x42')){var _0x21e5bb=fs[_0x7a7b('0x43')](path[_0x7a7b('0x44')](config[_0x7a7b('0x45')],'server/files/templates/stun_multiple.ejs'),_0x7a7b('0x46'));var _0x4302a3=ejs[_0x7a7b('0x47')](_0x21e5bb,{'networks':_0x2359ab||[]});fs[_0x7a7b('0x48')](_0x7a7b('0x49'),_0x4302a3);return respondWithRpcPromise(_0x7a7b('0x4a'),_0x7a7b('0x3f'),{'module':'res_stun_monitor.so'});}else if(_0x4aa2fc[_0x7a7b('0x25')][_0x7a7b('0x41')]()=='TURN'){var _0x21f9fb=fs[_0x7a7b('0x43')](path[_0x7a7b('0x44')](config['root'],_0x7a7b('0x4b')),_0x7a7b('0x46'));var _0x2641ca=ejs['render'](_0x21f9fb,{'networks':_0x2359ab||[]});fs[_0x7a7b('0x48')](_0x7a7b('0x4c'),_0x2641ca);return respondWithRpcPromise(_0x7a7b('0x4a'),'create',{'module':'res_stun_monitor.so'});}else{var _0x35e9e3=fs[_0x7a7b('0x43')](path['join'](config[_0x7a7b('0x45')],_0x7a7b('0x4d')),_0x7a7b('0x46'));var _0x18dfe5=ejs[_0x7a7b('0x47')](_0x35e9e3,{'networks':_0x2359ab||[]});fs[_0x7a7b('0x48')](util[_0x7a7b('0x4e')](_0x7a7b('0x4f'),_0x15394d['body'][_0x7a7b('0x25')][_0x7a7b('0x50')]()),_0x18dfe5);return respondWithRpcPromise(_0x7a7b('0x4a'),_0x7a7b('0x3f'),{'module':'chan_sip.so'});}})[_0x7a7b('0xa')](function(){return _0x4aa2fc;})[_0x7a7b('0xa')](respondWithResult(_0xf6cf0a,0xc9))[_0x7a7b('0x14')](handleError(_0xf6cf0a,null));};exports['update']=function(_0x456ecc,_0x33e4d0){var _0x1234b1;return db['Network']['find']({'where':{'id':_0x456ecc[_0x7a7b('0x3b')]['id']}})[_0x7a7b('0xa')](handleEntityNotFound(_0x33e4d0,null))[_0x7a7b('0xa')](saveUpdates(_0x456ecc[_0x7a7b('0x40')],null))[_0x7a7b('0xa')](function(_0xf06d5f){if(_0xf06d5f){_0x1234b1=_0xf06d5f;return db['Network'][_0x7a7b('0x39')]({'where':{'type':_0x1234b1[_0x7a7b('0x25')]},'raw':!![]});}return null;})[_0x7a7b('0xa')](function(_0x2d6a5a){if(_0x1234b1[_0x7a7b('0x25')][_0x7a7b('0x41')]()==_0x7a7b('0x42')){var _0x3a65ef=fs['readFileSync'](path[_0x7a7b('0x44')](config[_0x7a7b('0x45')],'server/files/templates/stun_multiple.ejs'),_0x7a7b('0x46'));var _0x4e125d=ejs[_0x7a7b('0x47')](_0x3a65ef,{'networks':_0x2d6a5a||[]});fs[_0x7a7b('0x48')]('/etc/asterisk/stun_xcally.conf',_0x4e125d);return respondWithRpcPromise(_0x7a7b('0x4a'),_0x7a7b('0x1c'),{'module':_0x7a7b('0x51')});}else if(_0x1234b1['type'][_0x7a7b('0x41')]()==_0x7a7b('0x52')){var _0x5dc944=fs[_0x7a7b('0x43')](path['join'](config['root'],_0x7a7b('0x4b')),'utf8');var _0x71437e=ejs[_0x7a7b('0x47')](_0x5dc944,{'networks':_0x2d6a5a||[]});fs[_0x7a7b('0x48')](_0x7a7b('0x4c'),_0x71437e);return respondWithRpcPromise(_0x7a7b('0x4a'),_0x7a7b('0x1c'),{'module':_0x7a7b('0x51')});}else{var _0x46fc49=fs['readFileSync'](path[_0x7a7b('0x44')](config[_0x7a7b('0x45')],_0x7a7b('0x4d')),_0x7a7b('0x46'));var _0x2470c9=ejs[_0x7a7b('0x47')](_0x46fc49,{'networks':_0x2d6a5a||[]});fs['writeFileSync'](util[_0x7a7b('0x4e')](_0x7a7b('0x4f'),_0x456ecc[_0x7a7b('0x40')][_0x7a7b('0x25')][_0x7a7b('0x50')]()),_0x2470c9);return respondWithRpcPromise('Reload',_0x7a7b('0x1c'),{'module':_0x7a7b('0x53')});}})[_0x7a7b('0xa')](function(_0x5b3431){if(_0x5b3431){return _0x1234b1;}return null;})[_0x7a7b('0xa')](respondWithResult(_0x33e4d0,null))[_0x7a7b('0x14')](handleError(_0x33e4d0,null));};exports[_0x7a7b('0x54')]=function(_0x574aa3,_0x1b6fdb){var _0x3f0395;return db[_0x7a7b('0x22')][_0x7a7b('0x3e')]({'where':{'id':_0x574aa3['params']['id']}})['then'](function(_0x2cfbac){_0x3f0395=_0x2cfbac;return _0x2cfbac;})[_0x7a7b('0xa')](handleEntityNotFound(_0x1b6fdb,null))['then'](removeEntity(_0x1b6fdb,null))['then'](function(){if(_0x3f0395){return db[_0x7a7b('0x22')][_0x7a7b('0x39')]({'where':{'type':_0x3f0395[_0x7a7b('0x25')]},'raw':!![]});}})[_0x7a7b('0xa')](function(_0x3cf57b){if(_0x3f0395['type'][_0x7a7b('0x41')]()==_0x7a7b('0x42')){var _0x1f0505=fs['readFileSync'](path[_0x7a7b('0x44')](config[_0x7a7b('0x45')],'server/files/templates/stun_multiple.ejs'),_0x7a7b('0x46'));var _0x4b1b85=ejs[_0x7a7b('0x47')](_0x1f0505,{'networks':_0x3cf57b||[]});fs[_0x7a7b('0x48')](_0x7a7b('0x49'),_0x4b1b85);return respondWithRpcPromise('Reload','destroy',{'module':_0x7a7b('0x51')});}else if(_0x3f0395[_0x7a7b('0x25')][_0x7a7b('0x41')]()=='TURN'){var _0x165449=fs[_0x7a7b('0x43')](path[_0x7a7b('0x44')](config[_0x7a7b('0x45')],_0x7a7b('0x4b')),'utf8');var _0x86355=ejs[_0x7a7b('0x47')](_0x165449,{'networks':_0x3cf57b||[]});fs[_0x7a7b('0x48')](_0x7a7b('0x4c'),_0x86355);return respondWithRpcPromise(_0x7a7b('0x4a'),_0x7a7b('0x54'),{'module':'res_stun_monitor.so'});}else{var _0x158420=fs[_0x7a7b('0x43')](path[_0x7a7b('0x44')](config[_0x7a7b('0x45')],_0x7a7b('0x4d')),_0x7a7b('0x46'));var _0x48bbab=ejs['render'](_0x158420,{'networks':_0x3cf57b||[]});fs[_0x7a7b('0x48')](util[_0x7a7b('0x4e')]('/etc/asterisk/sip_xcally_%s.conf',_0x3f0395['type']['toLowerCase']()),_0x48bbab);return respondWithRpcPromise(_0x7a7b('0x4a'),_0x7a7b('0x54'),{'module':_0x7a7b('0x53')});}})[_0x7a7b('0x14')](handleError(_0x1b6fdb,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 49c0b98..f5f1fae 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 _0x99e9=['util','../../config/logger','api','moment','request-promise','path','rimraf','./network.attributes','define','Network'];(function(_0x37362e,_0x3c1b38){var _0x485ee5=function(_0x5edf03){while(--_0x5edf03){_0x37362e['push'](_0x37362e['shift']());}};_0x485ee5(++_0x3c1b38);}(_0x99e9,0xb4));var _0x999e=function(_0x4695e2,_0x3d5f15){_0x4695e2=_0x4695e2-0x0;var _0x160563=_0x99e9[_0x4695e2];return _0x160563;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var logger=require(_0x999e('0x1'))(_0x999e('0x2'));var moment=require(_0x999e('0x3'));var BPromise=require('bluebird');var rp=require(_0x999e('0x4'));var fs=require('fs');var path=require(_0x999e('0x5'));var rimraf=require(_0x999e('0x6'));var config=require('../../config/environment');var attributes=require(_0x999e('0x7'));module['exports']=function(_0x25421f,_0x1bda0a){return _0x25421f[_0x999e('0x8')](_0x999e('0x9'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa0bc=['request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','Network','network','util','../../config/logger','moment','bluebird'];(function(_0x420b5c,_0x57ad37){var _0x51760b=function(_0xfe381e){while(--_0xfe381e){_0x420b5c['push'](_0x420b5c['shift']());}};_0x51760b(++_0x57ad37);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xca0b('0x0'));var logger=require(_0xca0b('0x1'))('api');var moment=require(_0xca0b('0x2'));var BPromise=require(_0xca0b('0x3'));var rp=require(_0xca0b('0x4'));var fs=require('fs');var path=require(_0xca0b('0x5'));var rimraf=require(_0xca0b('0x6'));var config=require(_0xca0b('0x7'));var attributes=require(_0xca0b('0x8'));module[_0xca0b('0x9')]=function(_0x3cb084,_0x1aac00){return _0x3cb084[_0xca0b('0xa')](_0xca0b('0xb'),attributes,{'tableName':_0xca0b('0xc'),'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 adeb97a..a7f4014 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2e2630,_0x40cd39){var _0x1e6e23=function(_0x172984){while(--_0x172984){_0x2e2630['push'](_0x2e2630['shift']());}};_0x1e6e23(++_0x40cd39);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5cfbc4,_0xb63f18){var _0x1fd580=function(_0x112bcc){while(--_0x112bcc){_0x5cfbc4['push'](_0x5cfbc4['shift']());}};_0x1fd580(++_0xb63f18);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index e1f2fd1..48f1269 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 _0xe928=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','getAgents','create','post','/:id/dispositions','addDisposition','addAnswer','/:id/notify','/:id/applications','addApplications','/:id/users','addAgents','put','destroy','delete','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xe928,0x133));var _0x8e92=function(_0xb95a73,_0x5c7951){_0xb95a73=_0xb95a73-0x0;var _0x51b118=_0xe928[_0xb95a73];return _0x51b118;};'use strict';var multer=require(_0x8e92('0x0'));var util=require(_0x8e92('0x1'));var path=require(_0x8e92('0x2'));var timeout=require(_0x8e92('0x3'));var express=require(_0x8e92('0x4'));var router=express[_0x8e92('0x5')]();var fs_extra=require(_0x8e92('0x6'));var auth=require(_0x8e92('0x7'));var interaction=require(_0x8e92('0x8'));var config=require(_0x8e92('0x9'));var controller=require(_0x8e92('0xa'));router[_0x8e92('0xb')]('/',auth[_0x8e92('0xc')](),controller[_0x8e92('0xd')]);router['get'](_0x8e92('0xe'),auth[_0x8e92('0xc')](),controller[_0x8e92('0xf')]);router['get'](_0x8e92('0x10'),auth[_0x8e92('0xc')](),controller[_0x8e92('0x11')]);router[_0x8e92('0xb')]('/:id/dispositions',auth[_0x8e92('0xc')](),controller['getDispositions']);router[_0x8e92('0xb')](_0x8e92('0x12'),auth[_0x8e92('0xc')](),controller[_0x8e92('0x13')]);router[_0x8e92('0xb')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0x8e92('0xb')](_0x8e92('0x14'),auth[_0x8e92('0xc')](),controller[_0x8e92('0x15')]);router[_0x8e92('0xb')]('/:id/users',auth[_0x8e92('0xc')](),controller[_0x8e92('0x16')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8e92('0x17')]);router[_0x8e92('0x18')](_0x8e92('0x19'),auth['isAuthenticated'](),controller[_0x8e92('0x1a')]);router[_0x8e92('0x18')](_0x8e92('0x12'),auth[_0x8e92('0xc')](),controller[_0x8e92('0x1b')]);router[_0x8e92('0x18')](_0x8e92('0x1c'),controller['notify']);router[_0x8e92('0x18')](_0x8e92('0x1d'),auth['isAuthenticated'](),controller[_0x8e92('0x1e')]);router[_0x8e92('0x18')](_0x8e92('0x1f'),auth['isAuthenticated'](),controller[_0x8e92('0x20')]);router[_0x8e92('0x18')]('/:id/send',auth['isAuthenticated'](),controller['send']);router[_0x8e92('0x21')](_0x8e92('0x10'),auth[_0x8e92('0xc')](),controller['update']);router['delete'](_0x8e92('0x10'),auth[_0x8e92('0xc')](),controller[_0x8e92('0x22')]);router[_0x8e92('0x23')](_0x8e92('0x19'),auth[_0x8e92('0xc')](),controller[_0x8e92('0x24')]);router['delete'](_0x8e92('0x12'),auth[_0x8e92('0xc')](),controller[_0x8e92('0x25')]);router[_0x8e92('0x23')](_0x8e92('0x1f'),auth[_0x8e92('0xc')](),controller[_0x8e92('0x26')]);module['exports']=router; \ No newline at end of file +var _0x411a=['/:id/applications','getApplications','/:id/interactions','post','create','/:id/notify','notify','/:id/users','send','put','update','delete','/:id','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers'];(function(_0x3a1565,_0x176cd8){var _0xc4cb70=function(_0x38cd6f){while(--_0x38cd6f){_0x3a1565['push'](_0x3a1565['shift']());}};_0xc4cb70(++_0x176cd8);}(_0x411a,0xf6));var _0xa411=function(_0xf4666e,_0x571140){_0xf4666e=_0xf4666e-0x0;var _0x1853f1=_0x411a[_0xf4666e];return _0x1853f1;};'use strict';var multer=require(_0xa411('0x0'));var util=require(_0xa411('0x1'));var path=require(_0xa411('0x2'));var timeout=require(_0xa411('0x3'));var express=require(_0xa411('0x4'));var router=express[_0xa411('0x5')]();var fs_extra=require(_0xa411('0x6'));var auth=require(_0xa411('0x7'));var interaction=require(_0xa411('0x8'));var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router[_0xa411('0x9')]('/',auth[_0xa411('0xa')](),controller[_0xa411('0xb')]);router[_0xa411('0x9')](_0xa411('0xc'),auth['isAuthenticated'](),controller[_0xa411('0xd')]);router['get']('/:id',auth[_0xa411('0xa')](),controller[_0xa411('0xe')]);router[_0xa411('0x9')](_0xa411('0xf'),auth[_0xa411('0xa')](),controller[_0xa411('0x10')]);router['get'](_0xa411('0x11'),auth[_0xa411('0xa')](),controller['getAnswers']);router[_0xa411('0x9')](_0xa411('0x12'),auth[_0xa411('0xa')](),controller[_0xa411('0x13')]);router[_0xa411('0x9')](_0xa411('0x14'),auth[_0xa411('0xa')](),controller['getInteractions']);router[_0xa411('0x9')]('/:id/users',auth[_0xa411('0xa')](),controller['getAgents']);router[_0xa411('0x15')]('/',auth[_0xa411('0xa')](),controller[_0xa411('0x16')]);router[_0xa411('0x15')](_0xa411('0xf'),auth[_0xa411('0xa')](),controller['addDisposition']);router[_0xa411('0x15')](_0xa411('0x11'),auth[_0xa411('0xa')](),controller['addAnswer']);router[_0xa411('0x15')](_0xa411('0x17'),controller[_0xa411('0x18')]);router['post']('/:id/applications',auth[_0xa411('0xa')](),controller['addApplications']);router[_0xa411('0x15')](_0xa411('0x19'),auth[_0xa411('0xa')](),controller['addAgents']);router[_0xa411('0x15')]('/:id/send',auth[_0xa411('0xa')](),controller[_0xa411('0x1a')]);router[_0xa411('0x1b')]('/:id',auth[_0xa411('0xa')](),controller[_0xa411('0x1c')]);router[_0xa411('0x1d')](_0xa411('0x1e'),auth['isAuthenticated'](),controller['destroy']);router[_0xa411('0x1d')](_0xa411('0xf'),auth[_0xa411('0xa')](),controller[_0xa411('0x1f')]);router[_0xa411('0x1d')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0xa411('0x1d')](_0xa411('0x19'),auth[_0xa411('0xa')](),controller['removeAgents']);module[_0xa411('0x20')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 137130d..3945f3b 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 _0x1a38=['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','STRING','name','generate','TEXT'];(function(_0x1099d4,_0x38ca0a){var _0x3d51f3=function(_0x16673b){while(--_0x16673b){_0x1099d4['push'](_0x1099d4['shift']());}};_0x3d51f3(++_0x38ca0a);}(_0x1a38,0x14b));var _0x81a3=function(_0x44d869,_0x49425f){_0x44d869=_0x44d869-0x0;var _0x1ed521=_0x1a38[_0x44d869];return _0x1ed521;};'use strict';var Sequelize=require(_0x81a3('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x81a3('0x1')],'unique':_0x81a3('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x81a3('0x1')]},'token':{'type':Sequelize[_0x81a3('0x1')],'defaultValue':function(){return rs[_0x81a3('0x3')]();}},'replyUri':{'type':Sequelize[_0x81a3('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x81a3('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x81a3('0x4')],'defaultValue':function(){return _0x81a3('0x5');}},'notificationSound':{'type':Sequelize[_0x81a3('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x81a3('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x81a3('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x81a3('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x81a3('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x81a3('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x81a3('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x81a3('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5dfc5a){if(!_0x5dfc5a)this[_0x81a3('0x9')](_0x81a3('0xa'),null);this[_0x81a3('0x9')](_0x81a3('0xb'),_0x5dfc5a);}}}; \ No newline at end of file +var _0x509d=['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','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING'];(function(_0x5e9250,_0x147e30){var _0x369f39=function(_0x580f58){while(--_0x580f58){_0x5e9250['push'](_0x5e9250['shift']());}};_0x369f39(++_0x147e30);}(_0x509d,0x14c));var _0xd509=function(_0x4667b2,_0x135b67){_0x4667b2=_0x4667b2-0x0;var _0x1070f2=_0x509d[_0x4667b2];return _0x1070f2;};'use strict';var Sequelize=require(_0xd509('0x0'));var rs=require(_0xd509('0x1'));module[_0xd509('0x2')]={'name':{'type':Sequelize[_0xd509('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xd509('0x3')],'defaultValue':function(){return rs[_0xd509('0x4')]();}},'replyUri':{'type':Sequelize[_0xd509('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xd509('0x5')],'defaultValue':function(){return _0xd509('0x6');}},'notificationSound':{'type':Sequelize[_0xd509('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd509('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd509('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xd509('0x3')]},'queueTransfer':{'type':Sequelize[_0xd509('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd509('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd509('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd509('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd509('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xd509('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xd509('0xa'),'set':function(_0x1b2a86){if(!_0x1b2a86)this['setDataValue'](_0xd509('0xb'),null);this['setDataValue']('mandatoryDisposition',_0x1b2a86);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index d54c4e4..62c9295 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 _0x27bf=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','findOne','order','OpenchannelAccountId','removeDispositions','ids','CannedAnswer','removeAnswers','notify','openchannel','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','isNil','from','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','priority','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','push','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','finally','getApplications','User','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','save','update','then','destroy','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','include','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId'];(function(_0x4b8c02,_0x1a889d){var _0x551cec=function(_0x2a371a){while(--_0x2a371a){_0x4b8c02['push'](_0x4b8c02['shift']());}};_0x551cec(++_0x1a889d);}(_0x27bf,0x117));var _0xf27b=function(_0x56f143,_0x420212){_0x56f143=_0x56f143-0x0;var _0x2e552b=_0x27bf[_0x56f143];return _0x2e552b;};'use strict';var emlformat=require(_0xf27b('0x0'));var rimraf=require(_0xf27b('0x1'));var zipdir=require(_0xf27b('0x2'));var jsonpatch=require(_0xf27b('0x3'));var rp=require(_0xf27b('0x4'));var moment=require(_0xf27b('0x5'));var BPromise=require(_0xf27b('0x6'));var Mustache=require(_0xf27b('0x7'));var util=require(_0xf27b('0x8'));var path=require(_0xf27b('0x9'));var sox=require(_0xf27b('0xa'));var csv=require('to-csv');var ejs=require(_0xf27b('0xb'));var fs=require('fs');var fs_extra=require(_0xf27b('0xc'));var _=require(_0xf27b('0xd'));var squel=require(_0xf27b('0xe'));var crypto=require(_0xf27b('0xf'));var jsforce=require(_0xf27b('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xf27b('0x11'));var querystring=require(_0xf27b('0x12'));var Papa=require(_0xf27b('0x13'));var Redis=require(_0xf27b('0x14'));var authService=require(_0xf27b('0x15'));var qs=require(_0xf27b('0x16'));var as=require(_0xf27b('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf27b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf27b('0x19'));var db=require(_0xf27b('0x1a'))['db'];config[_0xf27b('0x1b')]=_[_0xf27b('0x1c')](config['redis'],{'host':_0xf27b('0x1d'),'port':0x18eb});var socket=require(_0xf27b('0x1e'))(new Redis(config[_0xf27b('0x1b')]));require(_0xf27b('0x1f'))['register'](socket);var jayson=require(_0xf27b('0x20'));var client=jayson[_0xf27b('0x21')]['http']({'port':0x232c});var client9002=jayson['client'][_0xf27b('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x589455,_0x24f610,_0x12db19,_0x1fc319){return new BPromise(function(_0x5305d9,_0x42f512){var _0x216423=_0x1fc319||client;return _0x216423[_0xf27b('0x23')](_0x589455,_0x12db19)['then'](function(_0x472f1a){logger[_0xf27b('0x24')](_0xf27b('0x25'),_0x24f610,_0xf27b('0x26'));logger[_0xf27b('0x27')](_0xf27b('0x28'),_0x24f610,_0xf27b('0x26'),JSON[_0xf27b('0x29')](_0x472f1a));if(_0x472f1a[_0xf27b('0x2a')]){if(_0x472f1a['error'][_0xf27b('0x2b')]===0x1f4){logger['error'](_0xf27b('0x25'),_0x24f610,_0x472f1a[_0xf27b('0x2a')][_0xf27b('0x2c')]);return _0x42f512(_0x472f1a[_0xf27b('0x2a')]['message']);}logger[_0xf27b('0x2a')](_0xf27b('0x25'),_0x24f610,_0x472f1a[_0xf27b('0x2a')][_0xf27b('0x2c')]);return _0x5305d9(_0x472f1a['error'][_0xf27b('0x2c')]);}else{logger[_0xf27b('0x24')](_0xf27b('0x25'),_0x24f610,_0xf27b('0x26'));_0x5305d9(_0x472f1a[_0xf27b('0x2d')][_0xf27b('0x2c')]);}})['catch'](function(_0x4d9e29){logger['error'](_0xf27b('0x25'),_0x24f610,_0x4d9e29);_0x42f512(_0x4d9e29);});});}function respondWithStatusCode(_0x3e26c9,_0x1166db){_0x1166db=_0x1166db||0xcc;return function(_0x4b8e93){if(_0x4b8e93){return _0x3e26c9[_0xf27b('0x2e')](_0x1166db);}return _0x3e26c9['status'](_0x1166db)[_0xf27b('0x2f')]();};}function respondWithResult(_0x190729,_0x2817cd){_0x2817cd=_0x2817cd||0xc8;return function(_0x1502ad){if(_0x1502ad){return _0x190729['status'](_0x2817cd)[_0xf27b('0x30')](_0x1502ad);}};}function respondWithFilteredResult(_0x280246,_0x564943){return function(_0x3ead4d){if(_0x3ead4d){var _0x409df3=typeof _0x564943[_0xf27b('0x31')]===_0xf27b('0x32')&&typeof _0x564943[_0xf27b('0x33')]===_0xf27b('0x32');var _0x5eddd6=_0x3ead4d[_0xf27b('0x34')];var _0x780e4=_0x409df3?0x0:_0x564943[_0xf27b('0x31')];var _0x364691=_0x409df3?_0x3ead4d[_0xf27b('0x34')]:_0x564943[_0xf27b('0x31')]+_0x564943[_0xf27b('0x33')];var _0x9b7f;if(_0x364691>=_0x5eddd6){_0x364691=_0x5eddd6;_0x9b7f=0xc8;}else{_0x9b7f=0xce;}_0x280246[_0xf27b('0x35')](_0x9b7f);return _0x280246[_0xf27b('0x36')]('Content-Range',_0x780e4+'-'+_0x364691+'/'+_0x5eddd6)[_0xf27b('0x30')](_0x3ead4d);}return null;};}function patchUpdates(_0x616d93){return function(_0x442597){try{jsonpatch[_0xf27b('0x37')](_0x442597,_0x616d93,!![]);}catch(_0x1a0067){return BPromise['reject'](_0x1a0067);}return _0x442597[_0xf27b('0x38')]();};}function saveUpdates(_0x65c659,_0x4c1a55){return function(_0x5f3356){if(_0x5f3356){return _0x5f3356[_0xf27b('0x39')](_0x65c659)[_0xf27b('0x3a')](function(_0x3afeca){return _0x3afeca;});}return null;};}function removeEntity(_0x457291,_0x4ce989){return function(_0x5dacdb){if(_0x5dacdb){return _0x5dacdb[_0xf27b('0x3b')]()[_0xf27b('0x3a')](function(){var _0x48f8fc=_0x5dacdb['get']({'plain':!![]});var _0xbeec8b=_0xf27b('0x3c');return db[_0xf27b('0x3d')][_0xf27b('0x3b')]({'where':{'type':_0xbeec8b,'resourceId':_0x48f8fc['id']}})[_0xf27b('0x3a')](function(){return _0x5dacdb;});})['then'](function(){_0x457291['status'](0xcc)[_0xf27b('0x2f')]();});}};}function handleEntityNotFound(_0x210ae4,_0x18f143){return function(_0x105ea7){if(!_0x105ea7){_0x210ae4['sendStatus'](0x194);}return _0x105ea7;};}function handleError(_0x2272a4,_0x29d26a){_0x29d26a=_0x29d26a||0x1f4;return function(_0x37d21e){logger[_0xf27b('0x2a')](_0x37d21e[_0xf27b('0x3e')]);if(_0x37d21e['name']){delete _0x37d21e[_0xf27b('0x3f')];}_0x2272a4[_0xf27b('0x35')](_0x29d26a)[_0xf27b('0x40')](_0x37d21e);};}exports[_0xf27b('0x41')]=function(_0x2a185e,_0x1e0eb5){var _0x54faa2={'include':[{'model':db[_0xf27b('0x42')],'as':_0xf27b('0x43')}]},_0x2cc34f={},_0x577123={'count':0x0,'rows':[]};var _0xb0efd0=_['map'](db[_0xf27b('0x44')][_0xf27b('0x45')],function(_0x38e208){return{'name':_0x38e208['fieldName'],'type':_0x38e208[_0xf27b('0x46')][_0xf27b('0x47')]};});_0x2cc34f[_0xf27b('0x48')]=_[_0xf27b('0x49')](_0xb0efd0,'name');_0x2cc34f['query']=_['keys'](_0x2a185e[_0xf27b('0x4a')]);_0x2cc34f[_0xf27b('0x4b')]=_[_0xf27b('0x4c')](_0x2cc34f[_0xf27b('0x48')],_0x2cc34f['query']);_0x54faa2[_0xf27b('0x4d')]=_['intersection'](_0x2cc34f[_0xf27b('0x48')],qs[_0xf27b('0x4e')](_0x2a185e[_0xf27b('0x4a')][_0xf27b('0x4e')]));_0x54faa2[_0xf27b('0x4d')]=_0x54faa2[_0xf27b('0x4d')][_0xf27b('0x4f')]?_0x54faa2[_0xf27b('0x4d')]:_0x2cc34f[_0xf27b('0x48')];if(!_0x2a185e[_0xf27b('0x4a')][_0xf27b('0x50')](_0xf27b('0x51'))){_0x54faa2[_0xf27b('0x33')]=qs[_0xf27b('0x33')](_0x2a185e[_0xf27b('0x4a')][_0xf27b('0x33')]);_0x54faa2['offset']=qs[_0xf27b('0x31')](_0x2a185e[_0xf27b('0x4a')][_0xf27b('0x31')]);}_0x54faa2['order']=qs[_0xf27b('0x52')](_0x2a185e[_0xf27b('0x4a')][_0xf27b('0x52')]);_0x54faa2[_0xf27b('0x53')]=qs[_0xf27b('0x4b')](_[_0xf27b('0x54')](_0x2a185e[_0xf27b('0x4a')],_0x2cc34f[_0xf27b('0x4b')]),_0xb0efd0);if(_0x2a185e[_0xf27b('0x4a')][_0xf27b('0x55')]){_0x54faa2['where']=_[_0xf27b('0x56')](_0x54faa2[_0xf27b('0x53')],{'$or':_[_0xf27b('0x49')](_0xb0efd0,function(_0xbac06e){if(_0xbac06e[_0xf27b('0x46')]!==_0xf27b('0x57')){var _0x4ec502={};_0x4ec502[_0xbac06e['name']]={'$like':'%'+_0x2a185e[_0xf27b('0x4a')][_0xf27b('0x55')]+'%'};return _0x4ec502;}})});}_0x54faa2=_[_0xf27b('0x56')]({},_0x54faa2,_0x2a185e[_0xf27b('0x58')]);var _0x1abb9e={'where':_0x54faa2[_0xf27b('0x53')]};return db['OpenchannelAccount'][_0xf27b('0x34')](_0x1abb9e)['then'](function(_0x2bd074){_0x577123[_0xf27b('0x34')]=_0x2bd074;if(_0x2a185e[_0xf27b('0x4a')][_0xf27b('0x59')]){_0x54faa2['include']=[{'all':!![]}];}return db['OpenchannelAccount'][_0xf27b('0x5a')](_0x54faa2);})[_0xf27b('0x3a')](function(_0x458583){_0x577123[_0xf27b('0x5b')]=_0x458583;return _0x577123;})['then'](respondWithFilteredResult(_0x1e0eb5,_0x54faa2))['catch'](handleError(_0x1e0eb5,null));};exports[_0xf27b('0x5c')]=function(_0x19e9dd,_0x54bd0a){var _0xe4ea01={'raw':![],'where':{'id':_0x19e9dd[_0xf27b('0x5d')]['id']},'include':[{'model':db['Pause'],'as':_0xf27b('0x43')}]},_0x2bc83c={};_0x2bc83c['model']=_[_0xf27b('0x5e')](db['OpenchannelAccount'][_0xf27b('0x45')]);_0x2bc83c[_0xf27b('0x4a')]=_['keys'](_0x19e9dd[_0xf27b('0x4a')]);_0x2bc83c['filters']=_['intersection'](_0x2bc83c[_0xf27b('0x48')],_0x2bc83c[_0xf27b('0x4a')]);_0xe4ea01['attributes']=_['intersection'](_0x2bc83c['model'],qs[_0xf27b('0x4e')](_0x19e9dd[_0xf27b('0x4a')][_0xf27b('0x4e')]));_0xe4ea01[_0xf27b('0x4d')]=_0xe4ea01[_0xf27b('0x4d')][_0xf27b('0x4f')]?_0xe4ea01[_0xf27b('0x4d')]:_0x2bc83c[_0xf27b('0x48')];if(_0x19e9dd[_0xf27b('0x4a')]['includeAll']){_0xe4ea01[_0xf27b('0x5f')]=[{'all':!![]}];}_0xe4ea01=_[_0xf27b('0x56')]({},_0xe4ea01,_0x19e9dd['options']);return db['OpenchannelAccount']['find'](_0xe4ea01)[_0xf27b('0x3a')](handleEntityNotFound(_0x54bd0a,null))['then'](respondWithResult(_0x54bd0a,null))[_0xf27b('0x60')](handleError(_0x54bd0a,null));};exports[_0xf27b('0x61')]=function(_0xdd9506,_0x161fd5){return db[_0xf27b('0x44')][_0xf27b('0x61')](_0xdd9506[_0xf27b('0x62')],{})[_0xf27b('0x3a')](function(_0x578c4d){var _0x479a0a=_0xdd9506[_0xf27b('0x63')][_0xf27b('0x64')]({'plain':!![]});if(!_0x479a0a)throw new Error(_0xf27b('0x65'));if(_0x479a0a[_0xf27b('0x66')]===_0xf27b('0x63')){var _0x417b4d=_0x578c4d[_0xf27b('0x64')]({'plain':!![]});var _0x234040=_0xf27b('0x3c');return db['UserProfileSection'][_0xf27b('0x67')]({'where':{'name':_0x234040,'userProfileId':_0x479a0a[_0xf27b('0x68')]},'raw':!![]})[_0xf27b('0x3a')](function(_0x575664){if(_0x575664&&_0x575664[_0xf27b('0x69')]===0x0){return db['UserProfileResource'][_0xf27b('0x61')]({'name':_0x417b4d[_0xf27b('0x3f')],'resourceId':_0x417b4d['id'],'type':_0x575664[_0xf27b('0x3f')],'sectionId':_0x575664['id']},{})['then'](function(){return _0x578c4d;});}else{return _0x578c4d;}})[_0xf27b('0x60')](function(_0x397532){logger[_0xf27b('0x2a')](_0xf27b('0x6a'),_0x397532);throw _0x397532;});}return _0x578c4d;})[_0xf27b('0x3a')](respondWithResult(_0x161fd5,0xc9))[_0xf27b('0x60')](handleError(_0x161fd5,null));};exports[_0xf27b('0x39')]=function(_0x1aa28b,_0x3ba538){if(_0x1aa28b[_0xf27b('0x62')]['id']){delete _0x1aa28b[_0xf27b('0x62')]['id'];}return db[_0xf27b('0x44')][_0xf27b('0x67')]({'where':{'id':_0x1aa28b[_0xf27b('0x5d')]['id']},'include':[{'model':db[_0xf27b('0x42')],'as':_0xf27b('0x43')}]})[_0xf27b('0x3a')](handleEntityNotFound(_0x3ba538,null))['then'](saveUpdates(_0x1aa28b[_0xf27b('0x62')],null))[_0xf27b('0x3a')](respondWithResult(_0x3ba538,null))[_0xf27b('0x60')](handleError(_0x3ba538,null));};exports[_0xf27b('0x3b')]=function(_0x4d5652,_0x5f4298){return db['OpenchannelAccount'][_0xf27b('0x67')]({'where':{'id':_0x4d5652[_0xf27b('0x5d')]['id']}})[_0xf27b('0x3a')](handleEntityNotFound(_0x5f4298,null))[_0xf27b('0x3a')](removeEntity(_0x5f4298,null))['catch'](handleError(_0x5f4298,null));};exports[_0xf27b('0x6b')]=function(_0x254fd6,_0x4482ef){return db[_0xf27b('0x44')][_0xf27b('0x6b')]()[_0xf27b('0x3a')](respondWithResult(_0x4482ef,null))[_0xf27b('0x60')](handleError(_0x4482ef,null));};exports[_0xf27b('0x6c')]=function(_0x314681,_0x581926,_0x133e97){if(_0x314681[_0xf27b('0x62')]['id']){delete _0x314681['body']['id'];}return db[_0xf27b('0x44')]['find']({'where':{'id':_0x314681[_0xf27b('0x5d')]['id']}})['then'](handleEntityNotFound(_0x581926,null))[_0xf27b('0x3a')](function(_0x18cff4){if(_0x18cff4){_0x314681[_0xf27b('0x62')]['OpenchannelAccountId']=_0x18cff4['id'];return db[_0xf27b('0x6d')][_0xf27b('0x61')](_0x314681[_0xf27b('0x62')]);}})[_0xf27b('0x3a')](respondWithResult(_0x581926,null))[_0xf27b('0x60')](handleError(_0x581926,null));};exports['getDispositions']=function(_0x906b83,_0x2e6ab8,_0xeba5ca){var _0x26da8c={'raw':![],'where':{}};var _0x2b9165={};var _0xc89047={'count':0x0,'rows':[]};return db[_0xf27b('0x44')][_0xf27b('0x6e')]({'where':{'id':_0x906b83[_0xf27b('0x5d')]['id']}})[_0xf27b('0x3a')](handleEntityNotFound(_0x2e6ab8,null))[_0xf27b('0x3a')](function(_0x4468f9){if(_0x4468f9){_0x2b9165['model']=_['keys'](db[_0xf27b('0x6d')][_0xf27b('0x45')]);_0x2b9165[_0xf27b('0x4a')]=_[_0xf27b('0x5e')](_0x906b83['query']);_0x2b9165[_0xf27b('0x4b')]=_[_0xf27b('0x4c')](_0x2b9165[_0xf27b('0x48')],_0x2b9165[_0xf27b('0x4a')]);_0x26da8c[_0xf27b('0x4d')]=_[_0xf27b('0x4c')](_0x2b9165[_0xf27b('0x48')],qs[_0xf27b('0x4e')](_0x906b83[_0xf27b('0x4a')]['fields']));_0x26da8c[_0xf27b('0x4d')]=_0x26da8c[_0xf27b('0x4d')][_0xf27b('0x4f')]?_0x26da8c[_0xf27b('0x4d')]:_0x2b9165[_0xf27b('0x48')];if(!_0x906b83[_0xf27b('0x4a')]['hasOwnProperty'](_0xf27b('0x51'))){_0x26da8c[_0xf27b('0x33')]=qs[_0xf27b('0x33')](_0x906b83['query'][_0xf27b('0x33')]);_0x26da8c[_0xf27b('0x31')]=qs[_0xf27b('0x31')](_0x906b83['query']['offset']);}_0x26da8c[_0xf27b('0x6f')]=qs['sort'](_0x906b83[_0xf27b('0x4a')]['sort']);_0x26da8c[_0xf27b('0x53')]=qs[_0xf27b('0x4b')](_[_0xf27b('0x54')](_0x906b83[_0xf27b('0x4a')],_0x2b9165[_0xf27b('0x4b')]));_0x26da8c[_0xf27b('0x53')][_0xf27b('0x70')]=_0x4468f9['id'];if(_0x906b83[_0xf27b('0x4a')][_0xf27b('0x55')]){_0x26da8c[_0xf27b('0x53')]=_['merge'](_0x26da8c[_0xf27b('0x53')],{'$or':_[_0xf27b('0x49')](_0x26da8c[_0xf27b('0x4d')],function(_0x3e2cb5){var _0x78efc7={};_0x78efc7[_0x3e2cb5]={'$like':'%'+_0x906b83[_0xf27b('0x4a')][_0xf27b('0x55')]+'%'};return _0x78efc7;})});}_0x26da8c=_[_0xf27b('0x56')]({},_0x26da8c,_0x906b83[_0xf27b('0x58')]);return db[_0xf27b('0x6d')]['count']({'where':_0x26da8c[_0xf27b('0x53')]})[_0xf27b('0x3a')](function(_0x4eaa6b){_0xc89047[_0xf27b('0x34')]=_0x4eaa6b;if(_0x906b83[_0xf27b('0x4a')][_0xf27b('0x59')]){_0x26da8c['include']=[{'all':!![]}];}return db[_0xf27b('0x6d')][_0xf27b('0x5a')](_0x26da8c);})[_0xf27b('0x3a')](function(_0x4de258){_0xc89047[_0xf27b('0x5b')]=_0x4de258;return _0xc89047;});}})[_0xf27b('0x3a')](respondWithFilteredResult(_0x2e6ab8,_0x26da8c))[_0xf27b('0x60')](handleError(_0x2e6ab8,null));};exports[_0xf27b('0x71')]=function(_0x554d97,_0x5caf45,_0x11a101){return db[_0xf27b('0x44')][_0xf27b('0x67')]({'where':{'id':_0x554d97[_0xf27b('0x5d')]['id']}})[_0xf27b('0x3a')](handleEntityNotFound(_0x5caf45,null))['then'](function(_0x20c747){if(_0x20c747){return _0x20c747[_0xf27b('0x71')](_0x554d97['query'][_0xf27b('0x72')]);}})[_0xf27b('0x3a')](respondWithStatusCode(_0x5caf45,null))['catch'](handleError(_0x5caf45,null));};exports['addAnswer']=function(_0x591db4,_0x17f3a4,_0x4fc5bc){if(_0x591db4[_0xf27b('0x62')]['id']){delete _0x591db4['body']['id'];}return db[_0xf27b('0x44')]['find']({'where':{'id':_0x591db4[_0xf27b('0x5d')]['id']}})[_0xf27b('0x3a')](handleEntityNotFound(_0x17f3a4,null))['then'](function(_0x5da1c2){if(_0x5da1c2){_0x591db4['body'][_0xf27b('0x70')]=_0x5da1c2['id'];return db['CannedAnswer'][_0xf27b('0x61')](_0x591db4[_0xf27b('0x62')]);}})[_0xf27b('0x3a')](respondWithResult(_0x17f3a4,null))['catch'](handleError(_0x17f3a4,null));};exports['getAnswers']=function(_0x593508,_0x468c78,_0x4ad94a){var _0x11be44={'raw':![],'where':{}};var _0x3b1543={};var _0x191a01={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xf27b('0x6e')]({'where':{'id':_0x593508[_0xf27b('0x5d')]['id']}})['then'](handleEntityNotFound(_0x468c78,null))['then'](function(_0x4f3e85){if(_0x4f3e85){_0x3b1543[_0xf27b('0x48')]=_[_0xf27b('0x5e')](db[_0xf27b('0x73')]['rawAttributes']);_0x3b1543[_0xf27b('0x4a')]=_[_0xf27b('0x5e')](_0x593508[_0xf27b('0x4a')]);_0x3b1543['filters']=_[_0xf27b('0x4c')](_0x3b1543[_0xf27b('0x48')],_0x3b1543['query']);_0x11be44['attributes']=_['intersection'](_0x3b1543[_0xf27b('0x48')],qs['fields'](_0x593508[_0xf27b('0x4a')]['fields']));_0x11be44['attributes']=_0x11be44[_0xf27b('0x4d')]['length']?_0x11be44[_0xf27b('0x4d')]:_0x3b1543[_0xf27b('0x48')];if(!_0x593508[_0xf27b('0x4a')][_0xf27b('0x50')](_0xf27b('0x51'))){_0x11be44[_0xf27b('0x33')]=qs[_0xf27b('0x33')](_0x593508[_0xf27b('0x4a')][_0xf27b('0x33')]);_0x11be44[_0xf27b('0x31')]=qs[_0xf27b('0x31')](_0x593508[_0xf27b('0x4a')][_0xf27b('0x31')]);}_0x11be44[_0xf27b('0x6f')]=qs['sort'](_0x593508[_0xf27b('0x4a')]['sort']);_0x11be44[_0xf27b('0x53')]=qs[_0xf27b('0x4b')](_[_0xf27b('0x54')](_0x593508[_0xf27b('0x4a')],_0x3b1543['filters']));_0x11be44[_0xf27b('0x53')][_0xf27b('0x70')]=_0x4f3e85['id'];if(_0x593508['query'][_0xf27b('0x55')]){_0x11be44['where']=_[_0xf27b('0x56')](_0x11be44[_0xf27b('0x53')],{'$or':_['map'](_0x11be44[_0xf27b('0x4d')],function(_0x248619){var _0x14cb71={};_0x14cb71[_0x248619]={'$like':'%'+_0x593508[_0xf27b('0x4a')][_0xf27b('0x55')]+'%'};return _0x14cb71;})});}_0x11be44=_['merge']({},_0x11be44,_0x593508[_0xf27b('0x58')]);return db[_0xf27b('0x73')][_0xf27b('0x34')]({'where':_0x11be44['where']})[_0xf27b('0x3a')](function(_0x1c57a8){_0x191a01['count']=_0x1c57a8;if(_0x593508[_0xf27b('0x4a')][_0xf27b('0x59')]){_0x11be44['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xf27b('0x5a')](_0x11be44);})['then'](function(_0x5e48d2){_0x191a01['rows']=_0x5e48d2;return _0x191a01;});}})['then'](respondWithFilteredResult(_0x468c78,_0x11be44))[_0xf27b('0x60')](handleError(_0x468c78,null));};exports[_0xf27b('0x74')]=function(_0x5ed024,_0x4bc73d,_0x1f4aaf){return db['OpenchannelAccount'][_0xf27b('0x67')]({'where':{'id':_0x5ed024[_0xf27b('0x5d')]['id']}})[_0xf27b('0x3a')](handleEntityNotFound(_0x4bc73d,null))[_0xf27b('0x3a')](function(_0x494b81){if(_0x494b81){return _0x494b81['removeAnswers'](_0x5ed024[_0xf27b('0x4a')][_0xf27b('0x72')]);}})[_0xf27b('0x3a')](respondWithStatusCode(_0x4bc73d,null))['catch'](handleError(_0x4bc73d,null));};exports[_0xf27b('0x75')]=function(_0x496298,_0x47c2b8,_0x30b892){var _0x20bcc7={'body':_0x496298['body'],'channel':_0xf27b('0x76')};var _0x222a8b=[];var _0x509fb2=[];var _0x5d269e={};var _0xb191b7=![];return db['CmContact']['describe']()[_0xf27b('0x3a')](function(_0x25d710){if(!_0x25d710){throw new db['Sequelize'][(_0xf27b('0x77'))](_0xf27b('0x78'));}_0x222a8b=_['difference'](_[_0xf27b('0x5e')](_0x25d710),['createdAt','updatedAt']);_0x509fb2=_[_0xf27b('0x79')](_[_0xf27b('0x5e')](_0x25d710),['createdAt',_0xf27b('0x7a'),_0xf27b('0x7b'),_0xf27b('0x7c')]);if(_0x496298[_0xf27b('0x62')]['id']){delete _0x496298['body']['id'];}if(_[_0xf27b('0x7d')](_0x496298['body'][_0xf27b('0x7e')])){throw new db[(_0xf27b('0x7f'))][(_0xf27b('0x77'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x496298[_0xf27b('0x62')][_0xf27b('0x62')])||_0x496298[_0xf27b('0x62')]['body']===''){throw new db[(_0xf27b('0x7f'))][(_0xf27b('0x77'))](_0xf27b('0x80'));}if(_['isNil'](_0x496298[_0xf27b('0x62')][_0xf27b('0x81')])){throw new db[(_0xf27b('0x7f'))][(_0xf27b('0x77'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x509fb2);}if(!_['includes'](_0x509fb2,_0x496298['body']['mapKey'])){throw new db[(_0xf27b('0x7f'))][(_0xf27b('0x77'))](_0xf27b('0x82')+_0x509fb2);}_0x5d269e[_0x496298[_0xf27b('0x62')][_0xf27b('0x81')]]=_0x496298[_0xf27b('0x62')][_0xf27b('0x7e')];})[_0xf27b('0x3a')](function(){return db[_0xf27b('0x44')][_0xf27b('0x67')]({'where':{'id':_0x496298[_0xf27b('0x5d')]['id']},'include':[{'model':db[_0xf27b('0x83')],'as':_0xf27b('0x84'),'include':[{'model':db[_0xf27b('0x85')],'as':_0xf27b('0x86'),'where':_0x5d269e,'limit':0x1,'order':[[_0xf27b('0x7a'),_0xf27b('0x87')]]}]},{'model':db[_0xf27b('0x88')],'as':_0xf27b('0x89')}]});})['then'](handleEntityNotFound(_0x47c2b8,null))['then'](function(_0x69aab6){if(_0x69aab6&&_0x69aab6[_0xf27b('0x84')]){_0x20bcc7[_0xf27b('0x8a')]=_0x69aab6;_0x20bcc7[_0xf27b('0x8b')]=_0x69aab6[_0xf27b('0x89')];_0x20bcc7[_0xf27b('0x8c')]=_0x69aab6[_0xf27b('0x84')];_0x20bcc7[_0xf27b('0x8b')]=_['orderBy'](_0x20bcc7['applications'],[_0xf27b('0x8d')],[_0xf27b('0x8e')]);if(_0x20bcc7[_0xf27b('0x8a')][_0xf27b('0x89')]){delete _0x20bcc7[_0xf27b('0x8a')][_0xf27b('0x89')];}if(_0x20bcc7[_0xf27b('0x8a')][_0xf27b('0x84')]&&_0x20bcc7['account'][_0xf27b('0x84')][_0xf27b('0x86')]['length']){return _0x20bcc7[_0xf27b('0x8a')]['List'][_0xf27b('0x86')][0x0];}var _0x5eacca=_[_0xf27b('0x1c')](_0x496298[_0xf27b('0x62')],{'firstName':_0x496298[_0xf27b('0x62')][_0xf27b('0x7e')],'ListId':_0x69aab6[_0xf27b('0x7c')]});_0x5eacca[_0x496298[_0xf27b('0x62')]['mapKey']]=_0x496298[_0xf27b('0x62')][_0xf27b('0x7e')];return db[_0xf27b('0x85')][_0xf27b('0x61')](_0x5eacca,{'fields':_0x222a8b,'raw':!![]});}})[_0xf27b('0x3a')](handleEntityNotFound(_0x47c2b8,null))['then'](function(_0x486573){_0x20bcc7[_0xf27b('0x8f')]=_0x486573;if(_0x486573){var _0x277297={'ContactId':_0x486573['id'],'OpenchannelAccountId':_0x496298[_0xf27b('0x5d')]['id'],'from':(_0x486573[_0xf27b('0x90')]||'')+'\x20'+(_0x486573[_0xf27b('0x91')]||'')};var _0x3298a4={'OpenchannelAccountId':_0x496298[_0xf27b('0x5d')]['id'],'closed':![]};if(_0x496298[_0xf27b('0x62')][_0xf27b('0x92')]){_0x3298a4[_0xf27b('0x92')]=_0x496298[_0xf27b('0x62')]['threadId'];return db[_0xf27b('0x93')][_0xf27b('0x67')]({'where':_0x3298a4})[_0xf27b('0x3a')](function(_0x3fa476){if(_0x3fa476){return[_0x3fa476,![]];}_0x277297[_0xf27b('0x92')]=_0x496298['body']['threadId'];_0x277297[_0xf27b('0x94')]=_0x496298['body']['externalUrl'];return db[_0xf27b('0x93')][_0xf27b('0x61')](_0x277297)[_0xf27b('0x3a')](function(_0x590177){return[_0x590177,!![]];});});}else{_0x3298a4[_0xf27b('0x92')]=null;}_0x3298a4[_0xf27b('0x95')]=_0x486573['id'];return db[_0xf27b('0x93')][_0xf27b('0x67')]({'where':_0x3298a4})[_0xf27b('0x3a')](function(_0x6c21e6){if(_0x6c21e6){return[_0x6c21e6,![]];}return db[_0xf27b('0x93')][_0xf27b('0x61')](_0x277297)[_0xf27b('0x3a')](function(_0x7937eb){return[_0x7937eb,!![]];});});}})[_0xf27b('0x96')](function(_0xab169d,_0x285d34){if(_0xab169d){_0xb191b7=_0x285d34;if(!_0x285d34){var _0x40f489={'from':(_0x20bcc7['contact'][_0xf27b('0x90')]||'')+'\x20'+(_0x20bcc7[_0xf27b('0x8f')]['lastName']||'')};if(_0x496298[_0xf27b('0x62')][_0xf27b('0x92')]&&_0x496298[_0xf27b('0x62')]['messageId']&&_0x496298['body'][_0xf27b('0x92')]!=_0x496298['body'][_0xf27b('0x97')]){_0x40f489['threadId']=_0x496298[_0xf27b('0x62')][_0xf27b('0x97')];}return _0xab169d[_0xf27b('0x39')](_0x40f489);}else{return _0xab169d;}}})[_0xf27b('0x3a')](function(_0x1acfeb){_0x20bcc7[_0xf27b('0x98')]=_0x1acfeb[_0xf27b('0x64')]({'plain':!![]});_0x20bcc7[_0xf27b('0x98')][_0xf27b('0x99')]=_0xb191b7;if(_0x20bcc7[_0xf27b('0x98')][_0xf27b('0x99')]){if(_0x20bcc7[_0xf27b('0x8a')]['autoclose']){_0x20bcc7[_0xf27b('0x8b')][_0xf27b('0x9a')]({'id':0x0,'priority':_0x20bcc7['applications']['length']+0x1,'app':'close','appdata':_0xf27b('0x9b'),'interval':_0xf27b('0x9c')});}}return db['OpenchannelMessage'][_0xf27b('0x61')]({'body':_0x496298['body'][_0xf27b('0x62')],'OpenchannelAccountId':_0x496298[_0xf27b('0x5d')]['id'],'OpenchannelInteractionId':_0x1acfeb['id'],'direction':'in','ContactId':_0x20bcc7[_0xf27b('0x8f')]['id'],'AttachmentId':_0x496298[_0xf27b('0x62')][_0xf27b('0x9d')]});})[_0xf27b('0x3a')](function(_0x54026f){_0x20bcc7[_0xf27b('0x2c')]=_0x54026f;if(_0x20bcc7[_0xf27b('0x98')][_0xf27b('0x9e')]){return db['User']['find']({'attributes':['id',_0xf27b('0x3f')],'where':{'id':_0x20bcc7[_0xf27b('0x98')][_0xf27b('0x9e')]}})[_0xf27b('0x3a')](function(_0x1e16ac){if(_0x1e16ac){_0x20bcc7[_0xf27b('0x8b')][_0xf27b('0x9f')]({'id':0x0,'priority':0x0,'app':_0xf27b('0xa0'),'appdata':_0x1e16ac[_0xf27b('0x3f')]+','+(_0x20bcc7['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x20bcc7[_0xf27b('0xa1')]=![];}return respondWithRpcPromise(_0xf27b('0xa2'),_0xf27b('0xa3'),_0x20bcc7);});}return respondWithRpcPromise(_0xf27b('0xa2'),_0xf27b('0xa3'),_0x20bcc7);})['then'](function(_0x48e0ad){respondWithRpcPromise(_0xf27b('0xa4'),_0xf27b('0xa4'),{'event':_0xf27b('0x75'),'message':_0x48e0ad},client9002);return _0x48e0ad;})[_0xf27b('0x3a')](respondWithResult(_0x47c2b8,null))[_0xf27b('0x60')](handleError(_0x47c2b8,null));};exports[_0xf27b('0xa5')]=function(_0x12cdee,_0x39053f){var _0x83dd3a=_0x12cdee['params']['id'];var _0x5da548=_0x12cdee[_0xf27b('0x62')];var _0x46ffb3=0xc8;var _0x577394=null;return db[_0xf27b('0xa6')][_0xf27b('0xa7')]({'isolationLevel':db['sequelize'][_0xf27b('0xa8')][_0xf27b('0xa9')]['READ_COMMITTED']},function(_0x544cd4){return db[_0xf27b('0x44')]['findOne']({'where':{'id':_0x83dd3a},'transaction':_0x544cd4})['then'](function(_0x137156){if(_0x137156){return db[_0xf27b('0x88')][_0xf27b('0x3b')]({'where':{'OpenchannelAccountId':_0x83dd3a},'transaction':_0x544cd4})[_0xf27b('0x3a')](function(){var _0xf6dcd9=_[_0xf27b('0x49')](_0x5da548,function(_0x3cccd7){_0x3cccd7['OpenchannelAccountId']=_0x83dd3a;return _0x3cccd7;});return db[_0xf27b('0x88')][_0xf27b('0xaa')](_0xf6dcd9,{'transaction':_0x544cd4});});}else{_0x46ffb3=0x194;_0x577394=[];}});})[_0xf27b('0x3a')](function(){if(_0x46ffb3!==0x194){return db[_0xf27b('0x88')][_0xf27b('0xab')]({'where':{'OpenchannelAccountId':_0x83dd3a},'order':_0xf27b('0x8d')})[_0xf27b('0x3a')](function(_0x698412){_0x577394=_0x698412;});}})[_0xf27b('0x60')](function(_0x40be7e){_0x46ffb3=0x1f4;logger[_0xf27b('0x2a')](_0x40be7e[_0xf27b('0x3e')]);if(_0x40be7e[_0xf27b('0x3f')]){delete _0x40be7e[_0xf27b('0x3f')];}_0x577394=_0x40be7e;})[_0xf27b('0xac')](function(){if(_0x577394===null){_0x39053f[_0xf27b('0x2e')](_0x46ffb3);}else{if(_0x46ffb3===0x1f4){_0x39053f['status'](_0x46ffb3)[_0xf27b('0x40')](_0x577394);}else{_0x39053f['status'](_0x46ffb3)[_0xf27b('0x30')](_0x577394);}}});};exports[_0xf27b('0xad')]=function(_0x52abb6,_0x1bdf9c,_0x35cd99){var _0x38153c={};var _0x27f3de={};var _0x29e5b1;var _0x18683b;return db[_0xf27b('0x44')][_0xf27b('0x6e')]({'where':{'id':_0x52abb6[_0xf27b('0x5d')]['id']}})[_0xf27b('0x3a')](handleEntityNotFound(_0x1bdf9c,null))[_0xf27b('0x3a')](function(_0x583737){if(_0x583737){_0x29e5b1=_0x583737;_0x27f3de['model']=_['keys'](db[_0xf27b('0x88')][_0xf27b('0x45')]);_0x27f3de[_0xf27b('0x4a')]=_[_0xf27b('0x5e')](_0x52abb6[_0xf27b('0x4a')]);_0x27f3de[_0xf27b('0x4b')]=_[_0xf27b('0x4c')](_0x27f3de[_0xf27b('0x48')],_0x27f3de[_0xf27b('0x4a')]);_0x38153c[_0xf27b('0x4d')]=_['intersection'](_0x27f3de[_0xf27b('0x48')],qs[_0xf27b('0x4e')](_0x52abb6[_0xf27b('0x4a')]['fields']));_0x38153c[_0xf27b('0x4d')]=_0x38153c['attributes'][_0xf27b('0x4f')]?_0x38153c[_0xf27b('0x4d')]:_0x27f3de[_0xf27b('0x48')];_0x38153c[_0xf27b('0x6f')]=qs['sort'](_0x52abb6['query'][_0xf27b('0x52')]);_0x38153c[_0xf27b('0x53')]=qs['filters'](_['pick'](_0x52abb6[_0xf27b('0x4a')],_0x27f3de['filters']));if(_0x52abb6[_0xf27b('0x4a')][_0xf27b('0x55')]){_0x38153c[_0xf27b('0x53')]=_[_0xf27b('0x56')](_0x38153c[_0xf27b('0x53')],{'$or':_[_0xf27b('0x49')](_0x38153c['attributes'],function(_0x482d63){var _0x505a6d={};_0x505a6d[_0x482d63]={'$like':'%'+_0x52abb6['query']['filter']+'%'};return _0x505a6d;})});}_0x38153c=_[_0xf27b('0x56')]({},_0x38153c,_0x52abb6['options']);return _0x29e5b1['getApplications'](_0x38153c);}})[_0xf27b('0x3a')](function(_0x19e0cc){if(_0x19e0cc){_0x18683b=_0x19e0cc[_0xf27b('0x4f')];if(!_0x52abb6[_0xf27b('0x4a')][_0xf27b('0x50')](_0xf27b('0x51'))){_0x38153c['limit']=qs[_0xf27b('0x33')](_0x52abb6[_0xf27b('0x4a')][_0xf27b('0x33')]);_0x38153c[_0xf27b('0x31')]=qs[_0xf27b('0x31')](_0x52abb6[_0xf27b('0x4a')][_0xf27b('0x31')]);}return _0x29e5b1[_0xf27b('0xad')](_0x38153c);}})[_0xf27b('0x3a')](function(_0x23584d){if(_0x23584d){return _0x23584d?{'count':_0x18683b,'rows':_0x23584d}:null;}})[_0xf27b('0x3a')](respondWithResult(_0x1bdf9c,null))[_0xf27b('0x60')](handleError(_0x1bdf9c,null));};exports['getInteractions']=function(_0x376ea6,_0x2d10f1,_0x2a8e09){var _0x50228f={'raw':![],'where':{}};var _0x185e61={};var _0x1d8a04={'count':0x0,'rows':[]};return db[_0xf27b('0x44')][_0xf27b('0x6e')]({'where':{'id':_0x376ea6[_0xf27b('0x5d')]['id']}})[_0xf27b('0x3a')](handleEntityNotFound(_0x2d10f1,null))[_0xf27b('0x3a')](function(_0x2e0466){if(_0x2e0466){_0x185e61[_0xf27b('0x48')]=_[_0xf27b('0x5e')](db['OpenchannelInteraction'][_0xf27b('0x45')]);_0x185e61[_0xf27b('0x4a')]=_[_0xf27b('0x5e')](_0x376ea6[_0xf27b('0x4a')]);_0x185e61['filters']=_['intersection'](_0x185e61[_0xf27b('0x48')],_0x185e61[_0xf27b('0x4a')]);_0x50228f[_0xf27b('0x4d')]=_[_0xf27b('0x4c')](_0x185e61[_0xf27b('0x48')],qs[_0xf27b('0x4e')](_0x376ea6[_0xf27b('0x4a')]['fields']));_0x50228f[_0xf27b('0x4d')]=_0x50228f[_0xf27b('0x4d')][_0xf27b('0x4f')]?_0x50228f[_0xf27b('0x4d')]:_0x185e61[_0xf27b('0x48')];if(!_0x376ea6[_0xf27b('0x4a')][_0xf27b('0x50')](_0xf27b('0x51'))){_0x50228f[_0xf27b('0x33')]=qs[_0xf27b('0x33')](_0x376ea6[_0xf27b('0x4a')][_0xf27b('0x33')]);_0x50228f[_0xf27b('0x31')]=qs[_0xf27b('0x31')](_0x376ea6[_0xf27b('0x4a')]['offset']);}_0x50228f[_0xf27b('0x6f')]=qs[_0xf27b('0x52')](_0x376ea6[_0xf27b('0x4a')][_0xf27b('0x52')]);_0x50228f['where']=qs['filters'](_[_0xf27b('0x54')](_0x376ea6[_0xf27b('0x4a')],_0x185e61[_0xf27b('0x4b')]));_0x50228f['where']['OpenchannelAccountId']=_0x2e0466['id'];if(_0x376ea6[_0xf27b('0x4a')]['filter']){_0x50228f[_0xf27b('0x53')]=_[_0xf27b('0x56')](_0x50228f['where'],{'$or':_['map'](_0x50228f[_0xf27b('0x4d')],function(_0x1670a2){var _0x3f93c1={};_0x3f93c1[_0x1670a2]={'$like':'%'+_0x376ea6[_0xf27b('0x4a')][_0xf27b('0x55')]+'%'};return _0x3f93c1;})});}_0x50228f=_['merge']({},_0x50228f,_0x376ea6[_0xf27b('0x58')]);return db[_0xf27b('0x93')][_0xf27b('0x34')]({'where':_0x50228f[_0xf27b('0x53')]})[_0xf27b('0x3a')](function(_0x398f09){_0x1d8a04['count']=_0x398f09;if(_0x376ea6[_0xf27b('0x4a')]['includeAll']){_0x50228f['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xf27b('0xae')],'as':'Owner','attributes':[_0xf27b('0x3f'),'fullname',_0xf27b('0xaf')],'required':![]},{'model':db[_0xf27b('0xb0')],'as':_0xf27b('0xb1'),'attributes':['id','name',_0xf27b('0xb2')],'where':_0x376ea6[_0xf27b('0x4a')]['tag']?{'id':_0x376ea6[_0xf27b('0x4a')][_0xf27b('0xb3')]}:undefined,'required':_0x376ea6[_0xf27b('0x4a')][_0xf27b('0xb3')]?!![]:![]}];}return db[_0xf27b('0x93')]['findAll'](_0x50228f);})[_0xf27b('0x3a')](function(_0x3fd4f9){_0x1d8a04[_0xf27b('0x5b')]=_0x3fd4f9;return _0x1d8a04;});}})['then'](respondWithFilteredResult(_0x2d10f1,_0x50228f))[_0xf27b('0x60')](handleError(_0x2d10f1,null));};exports[_0xf27b('0xb4')]=function(_0xda56b5,_0x36b8ce,_0x42f0b3){return db['OpenchannelAccount'][_0xf27b('0x67')]({'where':{'id':_0xda56b5[_0xf27b('0x5d')]['id']}})[_0xf27b('0x3a')](handleEntityNotFound(_0x36b8ce,null))[_0xf27b('0x3a')](function(_0x4d8663){if(_0x4d8663){return _0x4d8663[_0xf27b('0xb4')](_0xda56b5[_0xf27b('0x62')][_0xf27b('0x72')],_[_0xf27b('0xb5')](_0xda56b5[_0xf27b('0x62')],[_0xf27b('0x72'),'id'])||{})['spread'](function(_0x5ed9ee){for(var _0x5cfae5=0x0;_0x5cfae5<_0xda56b5['body'][_0xf27b('0x72')][_0xf27b('0x4f')];_0x5cfae5+=0x1){socket[_0xf27b('0xb6')](_0xf27b('0xb7'),{'UserId':Number(_0xda56b5[_0xf27b('0x62')][_0xf27b('0x72')][_0x5cfae5]),'OpenchannelAccountId':Number(_0xda56b5[_0xf27b('0x5d')]['id'])});}return _0x5ed9ee;});}})[_0xf27b('0x3a')](respondWithResult(_0x36b8ce,null))[_0xf27b('0x60')](handleError(_0x36b8ce,null));};exports[_0xf27b('0xb8')]=function(_0x5eec84,_0x52ea0d,_0x414a99){return db[_0xf27b('0x44')][_0xf27b('0x67')]({'where':{'id':_0x5eec84[_0xf27b('0x5d')]['id']}})['then'](handleEntityNotFound(_0x52ea0d,null))['then'](function(_0x545be9){if(_0x545be9){return _0x545be9[_0xf27b('0xb8')](_0x5eec84[_0xf27b('0x4a')]['ids'])['then'](function(){if(_[_0xf27b('0xb9')](_0x5eec84['query'][_0xf27b('0x72')])){for(var _0x19621f=0x0;_0x19621f<_0x5eec84['query']['ids']['length'];_0x19621f+=0x1){socket[_0xf27b('0xb6')]('userOpenchannelAccount:remove',{'UserId':Number(_0x5eec84[_0xf27b('0x4a')][_0xf27b('0x72')][_0x19621f]),'OpenchannelAccountId':Number(_0x5eec84[_0xf27b('0x5d')]['id'])});}}else{socket[_0xf27b('0xb6')](_0xf27b('0xba'),{'UserId':Number(_0x5eec84[_0xf27b('0x4a')][_0xf27b('0x72')]),'OpenchannelAccountId':Number(_0x5eec84['params']['id'])});}});}})[_0xf27b('0x3a')](respondWithStatusCode(_0x52ea0d,null))[_0xf27b('0x60')](handleError(_0x52ea0d,null));};exports['getAgents']=function(_0x4c452,_0xa5cbf2,_0x2a24ae){var _0x1ca0e2={};var _0x526cc5={};var _0x26c923;var _0x195f15;return db[_0xf27b('0x44')][_0xf27b('0x6e')]({'where':{'id':_0x4c452[_0xf27b('0x5d')]['id']}})[_0xf27b('0x3a')](handleEntityNotFound(_0xa5cbf2,null))['then'](function(_0x46b416){if(_0x46b416){_0x26c923=_0x46b416;_0x526cc5[_0xf27b('0x48')]=_[_0xf27b('0x5e')](db['User'][_0xf27b('0x45')]);_0x526cc5['query']=_[_0xf27b('0x5e')](_0x4c452[_0xf27b('0x4a')]);_0x526cc5[_0xf27b('0x4b')]=_[_0xf27b('0x4c')](_0x526cc5['model'],_0x526cc5['query']);_0x1ca0e2[_0xf27b('0x4d')]=_[_0xf27b('0x4c')](_0x526cc5[_0xf27b('0x48')],qs['fields'](_0x4c452[_0xf27b('0x4a')][_0xf27b('0x4e')]));_0x1ca0e2['attributes']=_0x1ca0e2['attributes'][_0xf27b('0x4f')]?_0x1ca0e2[_0xf27b('0x4d')]:_0x526cc5[_0xf27b('0x48')];_0x1ca0e2[_0xf27b('0x6f')]=qs[_0xf27b('0x52')](_0x4c452[_0xf27b('0x4a')]['sort']);_0x1ca0e2['where']=qs[_0xf27b('0x4b')](_[_0xf27b('0x54')](_0x4c452['query'],_0x526cc5[_0xf27b('0x4b')]));if(_0x4c452['query'][_0xf27b('0x55')]){_0x1ca0e2[_0xf27b('0x53')]=_[_0xf27b('0x56')](_0x1ca0e2[_0xf27b('0x53')],{'$or':_[_0xf27b('0x49')](_0x1ca0e2['attributes'],function(_0x423344){var _0x180bba={};_0x180bba[_0x423344]={'$like':'%'+_0x4c452[_0xf27b('0x4a')][_0xf27b('0x55')]+'%'};return _0x180bba;})});}_0x1ca0e2=_[_0xf27b('0x56')]({},_0x1ca0e2,_0x4c452[_0xf27b('0x58')]);return _0x26c923[_0xf27b('0xbb')](_0x1ca0e2);}})['then'](function(_0x37de80){if(_0x37de80){_0x195f15=_0x37de80[_0xf27b('0x4f')];if(!_0x4c452[_0xf27b('0x4a')][_0xf27b('0x50')](_0xf27b('0x51'))){_0x1ca0e2['limit']=qs['limit'](_0x4c452['query'][_0xf27b('0x33')]);_0x1ca0e2['offset']=qs['offset'](_0x4c452[_0xf27b('0x4a')][_0xf27b('0x31')]);}return _0x26c923[_0xf27b('0xbb')](_0x1ca0e2);}})[_0xf27b('0x3a')](function(_0x504a36){if(_0x504a36){return _0x504a36?{'count':_0x195f15,'rows':_0x504a36}:null;}})[_0xf27b('0x3a')](respondWithResult(_0xa5cbf2,null))[_0xf27b('0x60')](handleError(_0xa5cbf2,null));};exports[_0xf27b('0x40')]=function(_0x45b0f4,_0x44dd2f,_0x4df56e){var _0x5288d7,_0x287d1f,_0x5ea651;if(_[_0xf27b('0x7d')](_0x45b0f4[_0xf27b('0x62')]['body'])||_0x45b0f4[_0xf27b('0x62')]['body']===''){throw new db[(_0xf27b('0x7f'))][(_0xf27b('0x77'))](_0xf27b('0x80'));}if(_[_0xf27b('0x7d')](_0x45b0f4[_0xf27b('0x62')]['to'])){}_0x5288d7=_0x45b0f4[_0xf27b('0x62')]['to'];return db[_0xf27b('0x44')][_0xf27b('0x6e')]({'where':{'id':_0x45b0f4['params']['id']}})[_0xf27b('0x3a')](handleEntityNotFound(_0x44dd2f,null))[_0xf27b('0x3a')](function(_0x37b2cb){if(_0x37b2cb){return db[_0xf27b('0x44')][_0xf27b('0x67')]({'where':{'id':_0x37b2cb['id']},'include':[{'model':db['CmList'],'as':_0xf27b('0x84'),'include':[{'model':db[_0xf27b('0x85')],'as':_0xf27b('0x86'),'where':{[_0x37b2cb[_0xf27b('0x81')]]:_0x5288d7},'limit':0x1,'order':[[_0xf27b('0x7a'),'DESC']]}]}]})[_0xf27b('0x3a')](handleEntityNotFound(_0x44dd2f,null))[_0xf27b('0x3a')](function(_0x377f66){if(_0x377f66&&_0x377f66[_0xf27b('0x84')]){_0x287d1f=_0x377f66[_0xf27b('0x64')]({'plain':!![]});if(_0x287d1f['List']&&_0x287d1f['List'][_0xf27b('0x86')][_0xf27b('0x4f')]){return _0x287d1f[_0xf27b('0x84')][_0xf27b('0x86')][0x0];}return db[_0xf27b('0x85')][_0xf27b('0x61')](_['defaults'](_0x45b0f4[_0xf27b('0x62')],{'firstName':_0x5288d7,[_0x377f66['mapKey']]:_0x5288d7,'phone':_0x5288d7,'ListId':_0x287d1f[_0xf27b('0x7c')]}));}})['then'](handleEntityNotFound(_0x44dd2f,null))[_0xf27b('0x3a')](function(_0x576eef){if(_0x576eef){_0x5ea651=_0x576eef;return db['OpenchannelInteraction'][_0xf27b('0x67')]({'where':{'ContactId':_0x5ea651['id'],'closed':![],'OpenchannelAccountId':_0x287d1f['id']}})[_0xf27b('0x3a')](function(_0x244e1c){if(_0x244e1c){return[_0x244e1c,![]];}return db[_0xf27b('0x93')][_0xf27b('0x61')]({'UserId':_0x45b0f4[_0xf27b('0x63')]['id'],'ContactId':_0x5ea651['id'],'OpenchannelAccountId':_0x287d1f['id'],'lastMsgDirection':_0xf27b('0xbc'),'firstMsgDirection':_0xf27b('0xbc'),'Messages':[_['merge'](_0x45b0f4['body'],{'read':![],'body':_0x45b0f4[_0xf27b('0x62')][_0xf27b('0x62')],'OpenchannelAccountId':_0x287d1f['id'],'UserId':_0x45b0f4[_0xf27b('0x63')]['id'],'ContactId':_0x5ea651['id']})]},{'include':[{'model':db[_0xf27b('0xbd')],'as':_0xf27b('0xbe')}]})['then'](function(_0x3f4c2c){return[_0x3f4c2c,!![]];});});}})[_0xf27b('0x96')](function(_0x182e03,_0x5bbecb){if(_0x5bbecb){return _0x182e03;}return db['OpenchannelMessage']['create'](_[_0xf27b('0x56')](_0x45b0f4[_0xf27b('0x62')],{'read':![],'body':_0x45b0f4['body']['body'],'OpenchannelAccountId':_0x287d1f['id'],'OpenchannelInteractionId':_0x182e03['id'],'UserId':_0x45b0f4[_0xf27b('0x63')]['id'],'ContactId':_0x5ea651['id']}))['then'](function(_0x11b51d){_0x182e03['dataValues'][_0xf27b('0xbe')]=[];_0x182e03['dataValues'][_0xf27b('0xbe')][_0xf27b('0x9a')](_0x11b51d[_0xf27b('0xbf')]);return _0x182e03;});});}})[_0xf27b('0x3a')](respondWithResult(_0x44dd2f,null))[_0xf27b('0x60')](handleError(_0x44dd2f,null));}; \ No newline at end of file +var _0xcea5=['autoclose','push','close','AttachmentId','UserId','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','startRouting','Start','EventManager','notify','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','bulkCreate','stack','finally','send','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','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','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','destroy','get','OpenchannelAccounts','UserProfileResource','name','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','List','CmContact','DESC','Applications','account','applications','list','orderBy','priority','asc','Contacts','from','ListId','contact','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xcea5,0xed));var _0x5cea=function(_0x192145,_0xe7d79c){_0x192145=_0x192145-0x0;var _0x5086a5=_0xcea5[_0x192145];return _0x5086a5;};'use strict';var emlformat=require(_0x5cea('0x0'));var rimraf=require(_0x5cea('0x1'));var zipdir=require(_0x5cea('0x2'));var jsonpatch=require(_0x5cea('0x3'));var rp=require(_0x5cea('0x4'));var moment=require('moment');var BPromise=require(_0x5cea('0x5'));var Mustache=require(_0x5cea('0x6'));var util=require(_0x5cea('0x7'));var path=require(_0x5cea('0x8'));var sox=require('sox');var csv=require(_0x5cea('0x9'));var ejs=require(_0x5cea('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(_0x5cea('0xb'));var deskjs=require(_0x5cea('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5cea('0xd'));var Papa=require('papaparse');var Redis=require(_0x5cea('0xe'));var authService=require(_0x5cea('0xf'));var qs=require(_0x5cea('0x10'));var as=require(_0x5cea('0x11'));var hardwareService=require(_0x5cea('0x12'));var logger=require(_0x5cea('0x13'))(_0x5cea('0x14'));var utils=require(_0x5cea('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5cea('0x16'));var db=require(_0x5cea('0x17'))['db'];config[_0x5cea('0x18')]=_[_0x5cea('0x19')](config[_0x5cea('0x18')],{'host':_0x5cea('0x1a'),'port':0x18eb});var socket=require(_0x5cea('0x1b'))(new Redis(config[_0x5cea('0x18')]));require(_0x5cea('0x1c'))[_0x5cea('0x1d')](socket);var jayson=require(_0x5cea('0x1e'));var client=jayson[_0x5cea('0x1f')][_0x5cea('0x20')]({'port':0x232c});var client9002=jayson[_0x5cea('0x1f')][_0x5cea('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x84a9c4,_0x1c9a30,_0x209046,_0x44f9c0){return new BPromise(function(_0x9a670,_0x3eee17){var _0x326b50=_0x44f9c0||client;return _0x326b50[_0x5cea('0x21')](_0x84a9c4,_0x209046)[_0x5cea('0x22')](function(_0xd2a67e){logger[_0x5cea('0x23')](_0x5cea('0x24'),_0x1c9a30,_0x5cea('0x25'));logger[_0x5cea('0x26')](_0x5cea('0x27'),_0x1c9a30,'request\x20sent',JSON[_0x5cea('0x28')](_0xd2a67e));if(_0xd2a67e['error']){if(_0xd2a67e[_0x5cea('0x29')][_0x5cea('0x2a')]===0x1f4){logger[_0x5cea('0x29')](_0x5cea('0x24'),_0x1c9a30,_0xd2a67e['error'][_0x5cea('0x2b')]);return _0x3eee17(_0xd2a67e['error'][_0x5cea('0x2b')]);}logger[_0x5cea('0x29')](_0x5cea('0x24'),_0x1c9a30,_0xd2a67e[_0x5cea('0x29')][_0x5cea('0x2b')]);return _0x9a670(_0xd2a67e[_0x5cea('0x29')][_0x5cea('0x2b')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x1c9a30,_0x5cea('0x25'));_0x9a670(_0xd2a67e[_0x5cea('0x2c')]['message']);}})[_0x5cea('0x2d')](function(_0x21708c){logger[_0x5cea('0x29')]('OpenchannelAccount,\x20%s,\x20%s',_0x1c9a30,_0x21708c);_0x3eee17(_0x21708c);});});}function respondWithStatusCode(_0x5d36d7,_0x168052){_0x168052=_0x168052||0xcc;return function(_0x1b295f){if(_0x1b295f){return _0x5d36d7[_0x5cea('0x2e')](_0x168052);}return _0x5d36d7['status'](_0x168052)[_0x5cea('0x2f')]();};}function respondWithResult(_0xaddd21,_0x2e9f9a){_0x2e9f9a=_0x2e9f9a||0xc8;return function(_0x3bcee2){if(_0x3bcee2){return _0xaddd21['status'](_0x2e9f9a)[_0x5cea('0x30')](_0x3bcee2);}};}function respondWithFilteredResult(_0x18c4e5,_0x282054){return function(_0x370c0c){if(_0x370c0c){var _0x1f2dd1=typeof _0x282054[_0x5cea('0x31')]===_0x5cea('0x32')&&typeof _0x282054[_0x5cea('0x33')]==='undefined';var _0x5e17af=_0x370c0c[_0x5cea('0x34')];var _0x122639=_0x1f2dd1?0x0:_0x282054[_0x5cea('0x31')];var _0x3592ab=_0x1f2dd1?_0x370c0c[_0x5cea('0x34')]:_0x282054['offset']+_0x282054[_0x5cea('0x33')];var _0xfcbc13;if(_0x3592ab>=_0x5e17af){_0x3592ab=_0x5e17af;_0xfcbc13=0xc8;}else{_0xfcbc13=0xce;}_0x18c4e5[_0x5cea('0x35')](_0xfcbc13);return _0x18c4e5[_0x5cea('0x36')](_0x5cea('0x37'),_0x122639+'-'+_0x3592ab+'/'+_0x5e17af)[_0x5cea('0x30')](_0x370c0c);}return null;};}function patchUpdates(_0x37aa73){return function(_0x16704d){try{jsonpatch[_0x5cea('0x38')](_0x16704d,_0x37aa73,!![]);}catch(_0x1efa2b){return BPromise[_0x5cea('0x39')](_0x1efa2b);}return _0x16704d['save']();};}function saveUpdates(_0x39d233,_0x411c77){return function(_0x1e2163){if(_0x1e2163){return _0x1e2163[_0x5cea('0x3a')](_0x39d233)['then'](function(_0x10d3ec){return _0x10d3ec;});}return null;};}function removeEntity(_0x3745cd,_0xdbe6fd){return function(_0xc08209){if(_0xc08209){return _0xc08209[_0x5cea('0x3b')]()[_0x5cea('0x22')](function(){var _0x9ebaf4=_0xc08209[_0x5cea('0x3c')]({'plain':!![]});var _0x324e4b=_0x5cea('0x3d');return db[_0x5cea('0x3e')][_0x5cea('0x3b')]({'where':{'type':_0x324e4b,'resourceId':_0x9ebaf4['id']}})[_0x5cea('0x22')](function(){return _0xc08209;});})[_0x5cea('0x22')](function(){_0x3745cd['status'](0xcc)[_0x5cea('0x2f')]();});}};}function handleEntityNotFound(_0x35baf5,_0x1742b1){return function(_0x7ad292){if(!_0x7ad292){_0x35baf5[_0x5cea('0x2e')](0x194);}return _0x7ad292;};}function handleError(_0x43a73d,_0x2f1edb){_0x2f1edb=_0x2f1edb||0x1f4;return function(_0x4c3342){logger[_0x5cea('0x29')](_0x4c3342['stack']);if(_0x4c3342[_0x5cea('0x3f')]){delete _0x4c3342[_0x5cea('0x3f')];}_0x43a73d[_0x5cea('0x35')](_0x2f1edb)['send'](_0x4c3342);};}exports[_0x5cea('0x40')]=function(_0x55118a,_0x3df2d0){var _0x532211={'include':[{'model':db[_0x5cea('0x41')],'as':_0x5cea('0x42')}]},_0x5895d1={},_0x4bda52={'count':0x0,'rows':[]};var _0x347f11=_['map'](db[_0x5cea('0x43')][_0x5cea('0x44')],function(_0x1b1ea7){return{'name':_0x1b1ea7['fieldName'],'type':_0x1b1ea7[_0x5cea('0x45')][_0x5cea('0x46')]};});_0x5895d1[_0x5cea('0x47')]=_[_0x5cea('0x48')](_0x347f11,_0x5cea('0x3f'));_0x5895d1[_0x5cea('0x49')]=_[_0x5cea('0x4a')](_0x55118a[_0x5cea('0x49')]);_0x5895d1[_0x5cea('0x4b')]=_[_0x5cea('0x4c')](_0x5895d1[_0x5cea('0x47')],_0x5895d1[_0x5cea('0x49')]);_0x532211[_0x5cea('0x4d')]=_[_0x5cea('0x4c')](_0x5895d1['model'],qs[_0x5cea('0x4e')](_0x55118a['query']['fields']));_0x532211[_0x5cea('0x4d')]=_0x532211['attributes'][_0x5cea('0x4f')]?_0x532211[_0x5cea('0x4d')]:_0x5895d1[_0x5cea('0x47')];if(!_0x55118a['query'][_0x5cea('0x50')](_0x5cea('0x51'))){_0x532211[_0x5cea('0x33')]=qs[_0x5cea('0x33')](_0x55118a[_0x5cea('0x49')][_0x5cea('0x33')]);_0x532211[_0x5cea('0x31')]=qs['offset'](_0x55118a['query']['offset']);}_0x532211[_0x5cea('0x52')]=qs[_0x5cea('0x53')](_0x55118a[_0x5cea('0x49')]['sort']);_0x532211['where']=qs[_0x5cea('0x4b')](_['pick'](_0x55118a['query'],_0x5895d1[_0x5cea('0x4b')]),_0x347f11);if(_0x55118a[_0x5cea('0x49')][_0x5cea('0x54')]){_0x532211['where']=_[_0x5cea('0x55')](_0x532211[_0x5cea('0x56')],{'$or':_[_0x5cea('0x48')](_0x347f11,function(_0x597f1c){if(_0x597f1c['type']!==_0x5cea('0x57')){var _0x28515b={};_0x28515b[_0x597f1c['name']]={'$like':'%'+_0x55118a[_0x5cea('0x49')]['filter']+'%'};return _0x28515b;}})});}_0x532211=_['merge']({},_0x532211,_0x55118a[_0x5cea('0x58')]);var _0x441872={'where':_0x532211[_0x5cea('0x56')]};return db[_0x5cea('0x43')][_0x5cea('0x34')](_0x441872)[_0x5cea('0x22')](function(_0x41a5d5){_0x4bda52[_0x5cea('0x34')]=_0x41a5d5;if(_0x55118a['query'][_0x5cea('0x59')]){_0x532211[_0x5cea('0x5a')]=[{'all':!![]}];}return db[_0x5cea('0x43')][_0x5cea('0x5b')](_0x532211);})['then'](function(_0x1ca9b0){_0x4bda52[_0x5cea('0x5c')]=_0x1ca9b0;return _0x4bda52;})[_0x5cea('0x22')](respondWithFilteredResult(_0x3df2d0,_0x532211))[_0x5cea('0x2d')](handleError(_0x3df2d0,null));};exports['show']=function(_0x5b144b,_0xb5baa1){var _0x2ff7a2={'raw':![],'where':{'id':_0x5b144b[_0x5cea('0x5d')]['id']},'include':[{'model':db[_0x5cea('0x41')],'as':_0x5cea('0x42')}]},_0x31a7aa={};_0x31a7aa['model']=_['keys'](db[_0x5cea('0x43')][_0x5cea('0x44')]);_0x31a7aa[_0x5cea('0x49')]=_[_0x5cea('0x4a')](_0x5b144b[_0x5cea('0x49')]);_0x31a7aa[_0x5cea('0x4b')]=_[_0x5cea('0x4c')](_0x31a7aa['model'],_0x31a7aa[_0x5cea('0x49')]);_0x2ff7a2[_0x5cea('0x4d')]=_['intersection'](_0x31a7aa['model'],qs[_0x5cea('0x4e')](_0x5b144b[_0x5cea('0x49')]['fields']));_0x2ff7a2['attributes']=_0x2ff7a2[_0x5cea('0x4d')][_0x5cea('0x4f')]?_0x2ff7a2['attributes']:_0x31a7aa[_0x5cea('0x47')];if(_0x5b144b[_0x5cea('0x49')][_0x5cea('0x59')]){_0x2ff7a2[_0x5cea('0x5a')]=[{'all':!![]}];}_0x2ff7a2=_[_0x5cea('0x55')]({},_0x2ff7a2,_0x5b144b[_0x5cea('0x58')]);return db['OpenchannelAccount']['find'](_0x2ff7a2)[_0x5cea('0x22')](handleEntityNotFound(_0xb5baa1,null))[_0x5cea('0x22')](respondWithResult(_0xb5baa1,null))[_0x5cea('0x2d')](handleError(_0xb5baa1,null));};exports[_0x5cea('0x5e')]=function(_0x1a2311,_0x533711){return db[_0x5cea('0x43')][_0x5cea('0x5e')](_0x1a2311[_0x5cea('0x5f')],{})[_0x5cea('0x22')](function(_0x35cfed){var _0x250980=_0x1a2311['user']['get']({'plain':!![]});if(!_0x250980)throw new Error(_0x5cea('0x60'));if(_0x250980['role']===_0x5cea('0x61')){var _0x1425b3=_0x35cfed['get']({'plain':!![]});var _0x58389d=_0x5cea('0x3d');return db['UserProfileSection'][_0x5cea('0x62')]({'where':{'name':_0x58389d,'userProfileId':_0x250980[_0x5cea('0x63')]},'raw':!![]})['then'](function(_0x854753){if(_0x854753&&_0x854753[_0x5cea('0x64')]===0x0){return db['UserProfileResource'][_0x5cea('0x5e')]({'name':_0x1425b3[_0x5cea('0x3f')],'resourceId':_0x1425b3['id'],'type':_0x854753[_0x5cea('0x3f')],'sectionId':_0x854753['id']},{})[_0x5cea('0x22')](function(){return _0x35cfed;});}else{return _0x35cfed;}})[_0x5cea('0x2d')](function(_0x448e88){logger[_0x5cea('0x29')](_0x5cea('0x65'),_0x448e88);throw _0x448e88;});}return _0x35cfed;})[_0x5cea('0x22')](respondWithResult(_0x533711,0xc9))[_0x5cea('0x2d')](handleError(_0x533711,null));};exports[_0x5cea('0x3a')]=function(_0x5d89d2,_0x2d0755){if(_0x5d89d2[_0x5cea('0x5f')]['id']){delete _0x5d89d2['body']['id'];}return db[_0x5cea('0x43')][_0x5cea('0x62')]({'where':{'id':_0x5d89d2[_0x5cea('0x5d')]['id']},'include':[{'model':db['Pause'],'as':_0x5cea('0x42')}]})[_0x5cea('0x22')](handleEntityNotFound(_0x2d0755,null))[_0x5cea('0x22')](saveUpdates(_0x5d89d2[_0x5cea('0x5f')],null))[_0x5cea('0x22')](respondWithResult(_0x2d0755,null))[_0x5cea('0x2d')](handleError(_0x2d0755,null));};exports[_0x5cea('0x3b')]=function(_0x5c438a,_0x5d21e8){return db['OpenchannelAccount'][_0x5cea('0x62')]({'where':{'id':_0x5c438a[_0x5cea('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5d21e8,null))[_0x5cea('0x22')](removeEntity(_0x5d21e8,null))[_0x5cea('0x2d')](handleError(_0x5d21e8,null));};exports['describe']=function(_0x4fad4f,_0x3be9d3){return db[_0x5cea('0x43')][_0x5cea('0x66')]()['then'](respondWithResult(_0x3be9d3,null))[_0x5cea('0x2d')](handleError(_0x3be9d3,null));};exports[_0x5cea('0x67')]=function(_0x20b056,_0x1e9ac3,_0x33ec9a){if(_0x20b056[_0x5cea('0x5f')]['id']){delete _0x20b056[_0x5cea('0x5f')]['id'];}return db[_0x5cea('0x43')][_0x5cea('0x62')]({'where':{'id':_0x20b056['params']['id']}})['then'](handleEntityNotFound(_0x1e9ac3,null))[_0x5cea('0x22')](function(_0x37ec2e){if(_0x37ec2e){_0x20b056[_0x5cea('0x5f')][_0x5cea('0x68')]=_0x37ec2e['id'];return db[_0x5cea('0x69')][_0x5cea('0x5e')](_0x20b056[_0x5cea('0x5f')]);}})['then'](respondWithResult(_0x1e9ac3,null))['catch'](handleError(_0x1e9ac3,null));};exports[_0x5cea('0x6a')]=function(_0x94dbd3,_0xe9dd60,_0x5ad3c6){var _0x3a1ba2={'raw':![],'where':{}};var _0x5c7244={};var _0x1a4f87={'count':0x0,'rows':[]};return db[_0x5cea('0x43')][_0x5cea('0x6b')]({'where':{'id':_0x94dbd3[_0x5cea('0x5d')]['id']}})[_0x5cea('0x22')](handleEntityNotFound(_0xe9dd60,null))[_0x5cea('0x22')](function(_0x6b71c2){if(_0x6b71c2){_0x5c7244[_0x5cea('0x47')]=_[_0x5cea('0x4a')](db[_0x5cea('0x69')][_0x5cea('0x44')]);_0x5c7244[_0x5cea('0x49')]=_['keys'](_0x94dbd3['query']);_0x5c7244['filters']=_['intersection'](_0x5c7244[_0x5cea('0x47')],_0x5c7244[_0x5cea('0x49')]);_0x3a1ba2[_0x5cea('0x4d')]=_['intersection'](_0x5c7244[_0x5cea('0x47')],qs[_0x5cea('0x4e')](_0x94dbd3['query'][_0x5cea('0x4e')]));_0x3a1ba2[_0x5cea('0x4d')]=_0x3a1ba2['attributes'][_0x5cea('0x4f')]?_0x3a1ba2[_0x5cea('0x4d')]:_0x5c7244[_0x5cea('0x47')];if(!_0x94dbd3['query'][_0x5cea('0x50')](_0x5cea('0x51'))){_0x3a1ba2[_0x5cea('0x33')]=qs[_0x5cea('0x33')](_0x94dbd3[_0x5cea('0x49')][_0x5cea('0x33')]);_0x3a1ba2['offset']=qs[_0x5cea('0x31')](_0x94dbd3[_0x5cea('0x49')][_0x5cea('0x31')]);}_0x3a1ba2[_0x5cea('0x52')]=qs[_0x5cea('0x53')](_0x94dbd3[_0x5cea('0x49')][_0x5cea('0x53')]);_0x3a1ba2[_0x5cea('0x56')]=qs['filters'](_[_0x5cea('0x6c')](_0x94dbd3[_0x5cea('0x49')],_0x5c7244[_0x5cea('0x4b')]));_0x3a1ba2[_0x5cea('0x56')][_0x5cea('0x68')]=_0x6b71c2['id'];if(_0x94dbd3['query'][_0x5cea('0x54')]){_0x3a1ba2[_0x5cea('0x56')]=_[_0x5cea('0x55')](_0x3a1ba2[_0x5cea('0x56')],{'$or':_['map'](_0x3a1ba2['attributes'],function(_0x67ac90){var _0x1c206d={};_0x1c206d[_0x67ac90]={'$like':'%'+_0x94dbd3[_0x5cea('0x49')]['filter']+'%'};return _0x1c206d;})});}_0x3a1ba2=_[_0x5cea('0x55')]({},_0x3a1ba2,_0x94dbd3['options']);return db[_0x5cea('0x69')][_0x5cea('0x34')]({'where':_0x3a1ba2[_0x5cea('0x56')]})[_0x5cea('0x22')](function(_0x2624f3){_0x1a4f87['count']=_0x2624f3;if(_0x94dbd3[_0x5cea('0x49')][_0x5cea('0x59')]){_0x3a1ba2['include']=[{'all':!![]}];}return db[_0x5cea('0x69')][_0x5cea('0x5b')](_0x3a1ba2);})[_0x5cea('0x22')](function(_0x595180){_0x1a4f87['rows']=_0x595180;return _0x1a4f87;});}})[_0x5cea('0x22')](respondWithFilteredResult(_0xe9dd60,_0x3a1ba2))[_0x5cea('0x2d')](handleError(_0xe9dd60,null));};exports[_0x5cea('0x6d')]=function(_0x2cd339,_0x496a6a,_0x585bcb){return db[_0x5cea('0x43')]['find']({'where':{'id':_0x2cd339['params']['id']}})['then'](handleEntityNotFound(_0x496a6a,null))[_0x5cea('0x22')](function(_0x18fa7a){if(_0x18fa7a){return _0x18fa7a[_0x5cea('0x6d')](_0x2cd339[_0x5cea('0x49')][_0x5cea('0x6e')]);}})[_0x5cea('0x22')](respondWithStatusCode(_0x496a6a,null))[_0x5cea('0x2d')](handleError(_0x496a6a,null));};exports[_0x5cea('0x6f')]=function(_0x5ce7fc,_0x2bab60,_0xb2a4a1){if(_0x5ce7fc[_0x5cea('0x5f')]['id']){delete _0x5ce7fc['body']['id'];}return db['OpenchannelAccount'][_0x5cea('0x62')]({'where':{'id':_0x5ce7fc[_0x5cea('0x5d')]['id']}})[_0x5cea('0x22')](handleEntityNotFound(_0x2bab60,null))[_0x5cea('0x22')](function(_0xd8eb0){if(_0xd8eb0){_0x5ce7fc[_0x5cea('0x5f')]['OpenchannelAccountId']=_0xd8eb0['id'];return db[_0x5cea('0x70')]['create'](_0x5ce7fc[_0x5cea('0x5f')]);}})[_0x5cea('0x22')](respondWithResult(_0x2bab60,null))[_0x5cea('0x2d')](handleError(_0x2bab60,null));};exports[_0x5cea('0x71')]=function(_0x46491e,_0x15fb07,_0x1b7418){var _0x387ec7={'raw':![],'where':{}};var _0x5b81bb={};var _0x3a6d9c={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x46491e['params']['id']}})[_0x5cea('0x22')](handleEntityNotFound(_0x15fb07,null))[_0x5cea('0x22')](function(_0x546385){if(_0x546385){_0x5b81bb['model']=_[_0x5cea('0x4a')](db[_0x5cea('0x70')][_0x5cea('0x44')]);_0x5b81bb[_0x5cea('0x49')]=_[_0x5cea('0x4a')](_0x46491e[_0x5cea('0x49')]);_0x5b81bb[_0x5cea('0x4b')]=_[_0x5cea('0x4c')](_0x5b81bb['model'],_0x5b81bb[_0x5cea('0x49')]);_0x387ec7[_0x5cea('0x4d')]=_[_0x5cea('0x4c')](_0x5b81bb[_0x5cea('0x47')],qs[_0x5cea('0x4e')](_0x46491e[_0x5cea('0x49')][_0x5cea('0x4e')]));_0x387ec7[_0x5cea('0x4d')]=_0x387ec7['attributes'][_0x5cea('0x4f')]?_0x387ec7[_0x5cea('0x4d')]:_0x5b81bb[_0x5cea('0x47')];if(!_0x46491e[_0x5cea('0x49')][_0x5cea('0x50')](_0x5cea('0x51'))){_0x387ec7[_0x5cea('0x33')]=qs[_0x5cea('0x33')](_0x46491e[_0x5cea('0x49')][_0x5cea('0x33')]);_0x387ec7['offset']=qs[_0x5cea('0x31')](_0x46491e[_0x5cea('0x49')]['offset']);}_0x387ec7['order']=qs[_0x5cea('0x53')](_0x46491e[_0x5cea('0x49')][_0x5cea('0x53')]);_0x387ec7[_0x5cea('0x56')]=qs[_0x5cea('0x4b')](_['pick'](_0x46491e[_0x5cea('0x49')],_0x5b81bb[_0x5cea('0x4b')]));_0x387ec7[_0x5cea('0x56')]['OpenchannelAccountId']=_0x546385['id'];if(_0x46491e[_0x5cea('0x49')][_0x5cea('0x54')]){_0x387ec7[_0x5cea('0x56')]=_['merge'](_0x387ec7[_0x5cea('0x56')],{'$or':_[_0x5cea('0x48')](_0x387ec7[_0x5cea('0x4d')],function(_0x18e041){var _0x5d6382={};_0x5d6382[_0x18e041]={'$like':'%'+_0x46491e[_0x5cea('0x49')][_0x5cea('0x54')]+'%'};return _0x5d6382;})});}_0x387ec7=_[_0x5cea('0x55')]({},_0x387ec7,_0x46491e[_0x5cea('0x58')]);return db[_0x5cea('0x70')][_0x5cea('0x34')]({'where':_0x387ec7[_0x5cea('0x56')]})[_0x5cea('0x22')](function(_0x4cc3bc){_0x3a6d9c[_0x5cea('0x34')]=_0x4cc3bc;if(_0x46491e[_0x5cea('0x49')]['includeAll']){_0x387ec7[_0x5cea('0x5a')]=[{'all':!![]}];}return db['CannedAnswer'][_0x5cea('0x5b')](_0x387ec7);})[_0x5cea('0x22')](function(_0xd69ee1){_0x3a6d9c[_0x5cea('0x5c')]=_0xd69ee1;return _0x3a6d9c;});}})['then'](respondWithFilteredResult(_0x15fb07,_0x387ec7))[_0x5cea('0x2d')](handleError(_0x15fb07,null));};exports[_0x5cea('0x72')]=function(_0x4f8c6a,_0x26fe73,_0x5ec0af){return db['OpenchannelAccount']['find']({'where':{'id':_0x4f8c6a[_0x5cea('0x5d')]['id']}})['then'](handleEntityNotFound(_0x26fe73,null))[_0x5cea('0x22')](function(_0x56f00f){if(_0x56f00f){return _0x56f00f[_0x5cea('0x72')](_0x4f8c6a['query'][_0x5cea('0x6e')]);}})[_0x5cea('0x22')](respondWithStatusCode(_0x26fe73,null))['catch'](handleError(_0x26fe73,null));};exports['notify']=function(_0x391f60,_0x7f925b,_0x161b15){var _0x24ff4c={'body':_0x391f60['body'],'channel':'openchannel'};var _0x40a17a=[];var _0x373cd7=[];var _0x16fb20={};var _0x3e9233=![];return db['CmContact'][_0x5cea('0x66')]()[_0x5cea('0x22')](function(_0x1172ca){if(!_0x1172ca){throw new db['Sequelize'][(_0x5cea('0x73'))](_0x5cea('0x74'));}_0x40a17a=_[_0x5cea('0x75')](_['keys'](_0x1172ca),[_0x5cea('0x76'),_0x5cea('0x77')]);_0x373cd7=_[_0x5cea('0x75')](_[_0x5cea('0x4a')](_0x1172ca),[_0x5cea('0x76'),_0x5cea('0x77'),'CompanyId','ListId']);if(_0x391f60['body']['id']){delete _0x391f60[_0x5cea('0x5f')]['id'];}if(_[_0x5cea('0x78')](_0x391f60[_0x5cea('0x5f')]['from'])){throw new db['Sequelize']['ValidationError'](_0x5cea('0x79'));}if(_[_0x5cea('0x78')](_0x391f60[_0x5cea('0x5f')][_0x5cea('0x5f')])||_0x391f60[_0x5cea('0x5f')]['body']===''){throw new db['Sequelize'][(_0x5cea('0x73'))](_0x5cea('0x7a'));}if(_[_0x5cea('0x78')](_0x391f60[_0x5cea('0x5f')]['mapKey'])){throw new db[(_0x5cea('0x7b'))]['ValidationError'](_0x5cea('0x7c')+_0x373cd7);}if(!_['includes'](_0x373cd7,_0x391f60[_0x5cea('0x5f')][_0x5cea('0x7d')])){throw new db[(_0x5cea('0x7b'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x373cd7);}_0x16fb20[_0x391f60[_0x5cea('0x5f')][_0x5cea('0x7d')]]=_0x391f60[_0x5cea('0x5f')]['from'];})[_0x5cea('0x22')](function(){return db['OpenchannelAccount'][_0x5cea('0x62')]({'where':{'id':_0x391f60['params']['id']},'include':[{'model':db[_0x5cea('0x7e')],'as':_0x5cea('0x7f'),'include':[{'model':db[_0x5cea('0x80')],'as':'Contacts','where':_0x16fb20,'limit':0x1,'order':[[_0x5cea('0x77'),_0x5cea('0x81')]]}]},{'model':db['OpenchannelApplication'],'as':_0x5cea('0x82')}]});})[_0x5cea('0x22')](handleEntityNotFound(_0x7f925b,null))[_0x5cea('0x22')](function(_0x200a19){if(_0x200a19&&_0x200a19[_0x5cea('0x7f')]){_0x24ff4c[_0x5cea('0x83')]=_0x200a19;_0x24ff4c[_0x5cea('0x84')]=_0x200a19[_0x5cea('0x82')];_0x24ff4c[_0x5cea('0x85')]=_0x200a19[_0x5cea('0x7f')];_0x24ff4c[_0x5cea('0x84')]=_[_0x5cea('0x86')](_0x24ff4c[_0x5cea('0x84')],[_0x5cea('0x87')],[_0x5cea('0x88')]);if(_0x24ff4c[_0x5cea('0x83')][_0x5cea('0x82')]){delete _0x24ff4c[_0x5cea('0x83')][_0x5cea('0x82')];}if(_0x24ff4c['account'][_0x5cea('0x7f')]&&_0x24ff4c[_0x5cea('0x83')]['List'][_0x5cea('0x89')]['length']){return _0x24ff4c[_0x5cea('0x83')][_0x5cea('0x7f')]['Contacts'][0x0];}var _0x1352f6=_[_0x5cea('0x19')](_0x391f60['body'],{'firstName':_0x391f60[_0x5cea('0x5f')][_0x5cea('0x8a')],'ListId':_0x200a19[_0x5cea('0x8b')]});_0x1352f6[_0x391f60['body']['mapKey']]=_0x391f60[_0x5cea('0x5f')][_0x5cea('0x8a')];return db[_0x5cea('0x80')][_0x5cea('0x5e')](_0x1352f6,{'fields':_0x40a17a,'raw':!![]});}})['then'](handleEntityNotFound(_0x7f925b,null))[_0x5cea('0x22')](function(_0x23cddf){_0x24ff4c[_0x5cea('0x8c')]=_0x23cddf;if(_0x23cddf){var _0x2bcfbb={'ContactId':_0x23cddf['id'],'OpenchannelAccountId':_0x391f60[_0x5cea('0x5d')]['id'],'from':(_0x23cddf['firstName']||'')+'\x20'+(_0x23cddf[_0x5cea('0x8d')]||'')};var _0x35d787={'OpenchannelAccountId':_0x391f60['params']['id'],'closed':![]};if(_0x391f60[_0x5cea('0x5f')]['threadId']){_0x35d787[_0x5cea('0x8e')]=_0x391f60[_0x5cea('0x5f')][_0x5cea('0x8e')];return db[_0x5cea('0x8f')][_0x5cea('0x62')]({'where':_0x35d787})[_0x5cea('0x22')](function(_0x1db1b6){if(_0x1db1b6){return[_0x1db1b6,![]];}_0x2bcfbb[_0x5cea('0x8e')]=_0x391f60[_0x5cea('0x5f')][_0x5cea('0x8e')];_0x2bcfbb[_0x5cea('0x90')]=_0x391f60[_0x5cea('0x5f')][_0x5cea('0x90')];return db['OpenchannelInteraction'][_0x5cea('0x5e')](_0x2bcfbb)[_0x5cea('0x22')](function(_0x4d2e13){return[_0x4d2e13,!![]];});});}else{_0x35d787[_0x5cea('0x8e')]=null;}_0x35d787['ContactId']=_0x23cddf['id'];return db['OpenchannelInteraction']['find']({'where':_0x35d787})[_0x5cea('0x22')](function(_0xd2f789){if(_0xd2f789){return[_0xd2f789,![]];}return db[_0x5cea('0x8f')][_0x5cea('0x5e')](_0x2bcfbb)['then'](function(_0x3cb6fd){return[_0x3cb6fd,!![]];});});}})[_0x5cea('0x91')](function(_0x5a78c5,_0x21b25d){if(_0x5a78c5){_0x3e9233=_0x21b25d;if(!_0x21b25d){var _0x38220f={'from':(_0x24ff4c['contact']['firstName']||'')+'\x20'+(_0x24ff4c[_0x5cea('0x8c')][_0x5cea('0x8d')]||'')};if(_0x391f60['body']['threadId']&&_0x391f60['body'][_0x5cea('0x92')]&&_0x391f60[_0x5cea('0x5f')][_0x5cea('0x8e')]!=_0x391f60['body'][_0x5cea('0x92')]){_0x38220f['threadId']=_0x391f60[_0x5cea('0x5f')][_0x5cea('0x92')];}return _0x5a78c5[_0x5cea('0x3a')](_0x38220f);}else{return _0x5a78c5;}}})['then'](function(_0x47a672){_0x24ff4c[_0x5cea('0x93')]=_0x47a672['get']({'plain':!![]});_0x24ff4c['interaction'][_0x5cea('0x94')]=_0x3e9233;if(_0x24ff4c[_0x5cea('0x93')][_0x5cea('0x94')]){if(_0x24ff4c[_0x5cea('0x83')][_0x5cea('0x95')]){_0x24ff4c[_0x5cea('0x84')][_0x5cea('0x96')]({'id':0x0,'priority':_0x24ff4c[_0x5cea('0x84')][_0x5cea('0x4f')]+0x1,'app':_0x5cea('0x97'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db['OpenchannelMessage'][_0x5cea('0x5e')]({'body':_0x391f60[_0x5cea('0x5f')][_0x5cea('0x5f')],'OpenchannelAccountId':_0x391f60[_0x5cea('0x5d')]['id'],'OpenchannelInteractionId':_0x47a672['id'],'direction':'in','ContactId':_0x24ff4c[_0x5cea('0x8c')]['id'],'AttachmentId':_0x391f60[_0x5cea('0x5f')][_0x5cea('0x98')]});})[_0x5cea('0x22')](function(_0x7d942b){_0x24ff4c['message']=_0x7d942b;if(_0x24ff4c['interaction'][_0x5cea('0x99')]){return db['User'][_0x5cea('0x62')]({'attributes':['id','name'],'where':{'id':_0x24ff4c[_0x5cea('0x93')][_0x5cea('0x99')]}})['then'](function(_0x4ee6de){if(_0x4ee6de){_0x24ff4c[_0x5cea('0x84')]['unshift']({'id':0x0,'priority':0x0,'app':_0x5cea('0x9a'),'appdata':_0x4ee6de[_0x5cea('0x3f')]+','+(_0x24ff4c['account'][_0x5cea('0x9b')]||0xa),'interval':_0x5cea('0x9c')});_0x24ff4c[_0x5cea('0x9d')]=![];}return respondWithRpcPromise('Start',_0x5cea('0x9e'),_0x24ff4c);});}return respondWithRpcPromise(_0x5cea('0x9f'),'startRouting',_0x24ff4c);})[_0x5cea('0x22')](function(_0x1b98bb){respondWithRpcPromise(_0x5cea('0xa0'),_0x5cea('0xa0'),{'event':_0x5cea('0xa1'),'message':_0x1b98bb},client9002);return _0x1b98bb;})[_0x5cea('0x22')](respondWithResult(_0x7f925b,null))[_0x5cea('0x2d')](handleError(_0x7f925b,null));};exports['addApplications']=function(_0x435094,_0x88c122){var _0x2c9669=_0x435094[_0x5cea('0x5d')]['id'];var _0x22bfd7=_0x435094[_0x5cea('0x5f')];var _0xf9b4f=0xc8;var _0x1e2148=null;return db[_0x5cea('0xa2')][_0x5cea('0xa3')]({'isolationLevel':db['sequelize'][_0x5cea('0xa4')][_0x5cea('0xa5')][_0x5cea('0xa6')]},function(_0x34971d){return db[_0x5cea('0x43')][_0x5cea('0x6b')]({'where':{'id':_0x2c9669},'transaction':_0x34971d})[_0x5cea('0x22')](function(_0x476f0f){if(_0x476f0f){return db['OpenchannelApplication'][_0x5cea('0x3b')]({'where':{'OpenchannelAccountId':_0x2c9669},'transaction':_0x34971d})[_0x5cea('0x22')](function(){var _0x2fa36c=_[_0x5cea('0x48')](_0x22bfd7,function(_0x3ffb53){_0x3ffb53[_0x5cea('0x68')]=_0x2c9669;return _0x3ffb53;});return db[_0x5cea('0xa7')][_0x5cea('0xa8')](_0x2fa36c,{'transaction':_0x34971d});});}else{_0xf9b4f=0x194;_0x1e2148=[];}});})[_0x5cea('0x22')](function(){if(_0xf9b4f!==0x194){return db[_0x5cea('0xa7')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x2c9669},'order':_0x5cea('0x87')})['then'](function(_0x575f6a){_0x1e2148=_0x575f6a;});}})['catch'](function(_0x56cd77){_0xf9b4f=0x1f4;logger[_0x5cea('0x29')](_0x56cd77[_0x5cea('0xa9')]);if(_0x56cd77[_0x5cea('0x3f')]){delete _0x56cd77[_0x5cea('0x3f')];}_0x1e2148=_0x56cd77;})[_0x5cea('0xaa')](function(){if(_0x1e2148===null){_0x88c122[_0x5cea('0x2e')](_0xf9b4f);}else{if(_0xf9b4f===0x1f4){_0x88c122[_0x5cea('0x35')](_0xf9b4f)[_0x5cea('0xab')](_0x1e2148);}else{_0x88c122[_0x5cea('0x35')](_0xf9b4f)[_0x5cea('0x30')](_0x1e2148);}}});};exports[_0x5cea('0xac')]=function(_0x4812f7,_0x5ba304,_0x4a3490){var _0x544b23={};var _0x3fb0e2={};var _0x218030;var _0x57f7db;return db[_0x5cea('0x43')][_0x5cea('0x6b')]({'where':{'id':_0x4812f7['params']['id']}})['then'](handleEntityNotFound(_0x5ba304,null))['then'](function(_0x44e5f2){if(_0x44e5f2){_0x218030=_0x44e5f2;_0x3fb0e2[_0x5cea('0x47')]=_[_0x5cea('0x4a')](db[_0x5cea('0xa7')][_0x5cea('0x44')]);_0x3fb0e2['query']=_['keys'](_0x4812f7[_0x5cea('0x49')]);_0x3fb0e2[_0x5cea('0x4b')]=_[_0x5cea('0x4c')](_0x3fb0e2[_0x5cea('0x47')],_0x3fb0e2[_0x5cea('0x49')]);_0x544b23['attributes']=_['intersection'](_0x3fb0e2[_0x5cea('0x47')],qs[_0x5cea('0x4e')](_0x4812f7[_0x5cea('0x49')]['fields']));_0x544b23[_0x5cea('0x4d')]=_0x544b23['attributes'][_0x5cea('0x4f')]?_0x544b23[_0x5cea('0x4d')]:_0x3fb0e2[_0x5cea('0x47')];_0x544b23[_0x5cea('0x52')]=qs['sort'](_0x4812f7[_0x5cea('0x49')][_0x5cea('0x53')]);_0x544b23['where']=qs[_0x5cea('0x4b')](_[_0x5cea('0x6c')](_0x4812f7['query'],_0x3fb0e2['filters']));if(_0x4812f7[_0x5cea('0x49')][_0x5cea('0x54')]){_0x544b23[_0x5cea('0x56')]=_[_0x5cea('0x55')](_0x544b23['where'],{'$or':_[_0x5cea('0x48')](_0x544b23['attributes'],function(_0x23806f){var _0x568f1f={};_0x568f1f[_0x23806f]={'$like':'%'+_0x4812f7['query'][_0x5cea('0x54')]+'%'};return _0x568f1f;})});}_0x544b23=_[_0x5cea('0x55')]({},_0x544b23,_0x4812f7[_0x5cea('0x58')]);return _0x218030[_0x5cea('0xac')](_0x544b23);}})[_0x5cea('0x22')](function(_0x2e833f){if(_0x2e833f){_0x57f7db=_0x2e833f['length'];if(!_0x4812f7['query']['hasOwnProperty'](_0x5cea('0x51'))){_0x544b23[_0x5cea('0x33')]=qs[_0x5cea('0x33')](_0x4812f7['query'][_0x5cea('0x33')]);_0x544b23[_0x5cea('0x31')]=qs['offset'](_0x4812f7[_0x5cea('0x49')][_0x5cea('0x31')]);}return _0x218030[_0x5cea('0xac')](_0x544b23);}})[_0x5cea('0x22')](function(_0x46ab0c){if(_0x46ab0c){return _0x46ab0c?{'count':_0x57f7db,'rows':_0x46ab0c}:null;}})['then'](respondWithResult(_0x5ba304,null))[_0x5cea('0x2d')](handleError(_0x5ba304,null));};exports[_0x5cea('0xad')]=function(_0x390509,_0x3f1ba8,_0x4fa260){var _0x345982={'raw':![],'where':{}};var _0x52e567={};var _0x12d81f={'count':0x0,'rows':[]};return db[_0x5cea('0x43')][_0x5cea('0x6b')]({'where':{'id':_0x390509[_0x5cea('0x5d')]['id']}})[_0x5cea('0x22')](handleEntityNotFound(_0x3f1ba8,null))[_0x5cea('0x22')](function(_0x3f0945){if(_0x3f0945){_0x52e567['model']=_[_0x5cea('0x4a')](db[_0x5cea('0x8f')][_0x5cea('0x44')]);_0x52e567[_0x5cea('0x49')]=_[_0x5cea('0x4a')](_0x390509[_0x5cea('0x49')]);_0x52e567[_0x5cea('0x4b')]=_[_0x5cea('0x4c')](_0x52e567[_0x5cea('0x47')],_0x52e567[_0x5cea('0x49')]);_0x345982[_0x5cea('0x4d')]=_[_0x5cea('0x4c')](_0x52e567[_0x5cea('0x47')],qs['fields'](_0x390509[_0x5cea('0x49')][_0x5cea('0x4e')]));_0x345982[_0x5cea('0x4d')]=_0x345982[_0x5cea('0x4d')][_0x5cea('0x4f')]?_0x345982[_0x5cea('0x4d')]:_0x52e567['model'];if(!_0x390509[_0x5cea('0x49')]['hasOwnProperty'](_0x5cea('0x51'))){_0x345982[_0x5cea('0x33')]=qs['limit'](_0x390509['query'][_0x5cea('0x33')]);_0x345982[_0x5cea('0x31')]=qs[_0x5cea('0x31')](_0x390509[_0x5cea('0x49')][_0x5cea('0x31')]);}_0x345982['order']=qs['sort'](_0x390509['query'][_0x5cea('0x53')]);_0x345982['where']=qs[_0x5cea('0x4b')](_[_0x5cea('0x6c')](_0x390509[_0x5cea('0x49')],_0x52e567[_0x5cea('0x4b')]));_0x345982['where'][_0x5cea('0x68')]=_0x3f0945['id'];if(_0x390509[_0x5cea('0x49')][_0x5cea('0x54')]){_0x345982['where']=_[_0x5cea('0x55')](_0x345982[_0x5cea('0x56')],{'$or':_['map'](_0x345982['attributes'],function(_0x1cf3ef){var _0x42f4f1={};_0x42f4f1[_0x1cf3ef]={'$like':'%'+_0x390509['query'][_0x5cea('0x54')]+'%'};return _0x42f4f1;})});}_0x345982=_[_0x5cea('0x55')]({},_0x345982,_0x390509[_0x5cea('0x58')]);return db['OpenchannelInteraction']['count']({'where':_0x345982[_0x5cea('0x56')]})['then'](function(_0x5ddd8b){_0x12d81f['count']=_0x5ddd8b;if(_0x390509[_0x5cea('0x49')]['includeAll']){_0x345982[_0x5cea('0x5a')]=[{'model':db['CmContact'],'as':_0x5cea('0xae'),'required':![]},{'model':db['User'],'as':'Owner','attributes':['name',_0x5cea('0xaf'),_0x5cea('0xb0')],'required':![]},{'model':db[_0x5cea('0xb1')],'as':_0x5cea('0xb2'),'attributes':['id',_0x5cea('0x3f'),_0x5cea('0xb3')],'where':_0x390509[_0x5cea('0x49')][_0x5cea('0xb4')]?{'id':_0x390509[_0x5cea('0x49')]['tag']}:undefined,'required':_0x390509['query']['tag']?!![]:![]}];}return db['OpenchannelInteraction']['findAll'](_0x345982);})[_0x5cea('0x22')](function(_0x194214){_0x12d81f[_0x5cea('0x5c')]=_0x194214;return _0x12d81f;});}})[_0x5cea('0x22')](respondWithFilteredResult(_0x3f1ba8,_0x345982))[_0x5cea('0x2d')](handleError(_0x3f1ba8,null));};exports[_0x5cea('0xb5')]=function(_0x17e65e,_0x3a5cb0,_0x2d99bd){return db[_0x5cea('0x43')]['find']({'where':{'id':_0x17e65e[_0x5cea('0x5d')]['id']}})[_0x5cea('0x22')](handleEntityNotFound(_0x3a5cb0,null))[_0x5cea('0x22')](function(_0x54b991){if(_0x54b991){return _0x54b991['addAgents'](_0x17e65e[_0x5cea('0x5f')]['ids'],_[_0x5cea('0xb6')](_0x17e65e[_0x5cea('0x5f')],['ids','id'])||{})[_0x5cea('0x91')](function(_0x507185){for(var _0xf09034=0x0;_0xf09034<_0x17e65e[_0x5cea('0x5f')][_0x5cea('0x6e')][_0x5cea('0x4f')];_0xf09034+=0x1){socket[_0x5cea('0xb7')](_0x5cea('0xb8'),{'UserId':Number(_0x17e65e[_0x5cea('0x5f')][_0x5cea('0x6e')][_0xf09034]),'OpenchannelAccountId':Number(_0x17e65e['params']['id'])});}return _0x507185;});}})[_0x5cea('0x22')](respondWithResult(_0x3a5cb0,null))['catch'](handleError(_0x3a5cb0,null));};exports[_0x5cea('0xb9')]=function(_0x259379,_0x53e083,_0x2742a2){return db[_0x5cea('0x43')]['find']({'where':{'id':_0x259379['params']['id']}})[_0x5cea('0x22')](handleEntityNotFound(_0x53e083,null))[_0x5cea('0x22')](function(_0x19c80e){if(_0x19c80e){return _0x19c80e[_0x5cea('0xb9')](_0x259379[_0x5cea('0x49')][_0x5cea('0x6e')])[_0x5cea('0x22')](function(){if(_[_0x5cea('0xba')](_0x259379[_0x5cea('0x49')][_0x5cea('0x6e')])){for(var _0x4120d1=0x0;_0x4120d1<_0x259379[_0x5cea('0x49')][_0x5cea('0x6e')][_0x5cea('0x4f')];_0x4120d1+=0x1){socket['emit'](_0x5cea('0xbb'),{'UserId':Number(_0x259379[_0x5cea('0x49')][_0x5cea('0x6e')][_0x4120d1]),'OpenchannelAccountId':Number(_0x259379[_0x5cea('0x5d')]['id'])});}}else{socket[_0x5cea('0xb7')](_0x5cea('0xbb'),{'UserId':Number(_0x259379[_0x5cea('0x49')][_0x5cea('0x6e')]),'OpenchannelAccountId':Number(_0x259379[_0x5cea('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x53e083,null))[_0x5cea('0x2d')](handleError(_0x53e083,null));};exports[_0x5cea('0xbc')]=function(_0x448912,_0x15570e,_0x6b3a4f){var _0x4bd613={};var _0x5ed837={};var _0x3b1b80;var _0x451884;return db[_0x5cea('0x43')][_0x5cea('0x6b')]({'where':{'id':_0x448912[_0x5cea('0x5d')]['id']}})[_0x5cea('0x22')](handleEntityNotFound(_0x15570e,null))[_0x5cea('0x22')](function(_0x191642){if(_0x191642){_0x3b1b80=_0x191642;_0x5ed837[_0x5cea('0x47')]=_[_0x5cea('0x4a')](db['User'][_0x5cea('0x44')]);_0x5ed837[_0x5cea('0x49')]=_[_0x5cea('0x4a')](_0x448912[_0x5cea('0x49')]);_0x5ed837[_0x5cea('0x4b')]=_['intersection'](_0x5ed837['model'],_0x5ed837['query']);_0x4bd613[_0x5cea('0x4d')]=_[_0x5cea('0x4c')](_0x5ed837['model'],qs[_0x5cea('0x4e')](_0x448912['query'][_0x5cea('0x4e')]));_0x4bd613['attributes']=_0x4bd613['attributes'][_0x5cea('0x4f')]?_0x4bd613[_0x5cea('0x4d')]:_0x5ed837[_0x5cea('0x47')];_0x4bd613['order']=qs[_0x5cea('0x53')](_0x448912[_0x5cea('0x49')][_0x5cea('0x53')]);_0x4bd613[_0x5cea('0x56')]=qs[_0x5cea('0x4b')](_[_0x5cea('0x6c')](_0x448912[_0x5cea('0x49')],_0x5ed837[_0x5cea('0x4b')]));if(_0x448912[_0x5cea('0x49')][_0x5cea('0x54')]){_0x4bd613['where']=_[_0x5cea('0x55')](_0x4bd613[_0x5cea('0x56')],{'$or':_[_0x5cea('0x48')](_0x4bd613['attributes'],function(_0x4dacb9){var _0x5ac566={};_0x5ac566[_0x4dacb9]={'$like':'%'+_0x448912[_0x5cea('0x49')][_0x5cea('0x54')]+'%'};return _0x5ac566;})});}_0x4bd613=_[_0x5cea('0x55')]({},_0x4bd613,_0x448912[_0x5cea('0x58')]);return _0x3b1b80[_0x5cea('0xbc')](_0x4bd613);}})[_0x5cea('0x22')](function(_0x3dcaa4){if(_0x3dcaa4){_0x451884=_0x3dcaa4[_0x5cea('0x4f')];if(!_0x448912[_0x5cea('0x49')][_0x5cea('0x50')](_0x5cea('0x51'))){_0x4bd613['limit']=qs['limit'](_0x448912[_0x5cea('0x49')][_0x5cea('0x33')]);_0x4bd613[_0x5cea('0x31')]=qs[_0x5cea('0x31')](_0x448912[_0x5cea('0x49')][_0x5cea('0x31')]);}return _0x3b1b80[_0x5cea('0xbc')](_0x4bd613);}})[_0x5cea('0x22')](function(_0x261627){if(_0x261627){return _0x261627?{'count':_0x451884,'rows':_0x261627}:null;}})[_0x5cea('0x22')](respondWithResult(_0x15570e,null))[_0x5cea('0x2d')](handleError(_0x15570e,null));};exports[_0x5cea('0xab')]=function(_0x54d01a,_0x144ff1,_0x3632a5){var _0x18d77f,_0x2f05f8,_0x5e1f86;if(_[_0x5cea('0x78')](_0x54d01a[_0x5cea('0x5f')][_0x5cea('0x5f')])||_0x54d01a[_0x5cea('0x5f')]['body']===''){throw new db[(_0x5cea('0x7b'))][(_0x5cea('0x73'))](_0x5cea('0x7a'));}if(_[_0x5cea('0x78')](_0x54d01a['body']['to'])){}_0x18d77f=_0x54d01a[_0x5cea('0x5f')]['to'];return db[_0x5cea('0x43')][_0x5cea('0x6b')]({'where':{'id':_0x54d01a[_0x5cea('0x5d')]['id']}})['then'](handleEntityNotFound(_0x144ff1,null))[_0x5cea('0x22')](function(_0x50f248){if(_0x50f248){return db[_0x5cea('0x43')]['find']({'where':{'id':_0x50f248['id']},'include':[{'model':db[_0x5cea('0x7e')],'as':_0x5cea('0x7f'),'include':[{'model':db[_0x5cea('0x80')],'as':_0x5cea('0x89'),'where':{[_0x50f248[_0x5cea('0x7d')]]:_0x18d77f},'limit':0x1,'order':[[_0x5cea('0x77'),'DESC']]}]}]})[_0x5cea('0x22')](handleEntityNotFound(_0x144ff1,null))[_0x5cea('0x22')](function(_0x2d1885){if(_0x2d1885&&_0x2d1885[_0x5cea('0x7f')]){_0x2f05f8=_0x2d1885[_0x5cea('0x3c')]({'plain':!![]});if(_0x2f05f8[_0x5cea('0x7f')]&&_0x2f05f8[_0x5cea('0x7f')][_0x5cea('0x89')]['length']){return _0x2f05f8['List'][_0x5cea('0x89')][0x0];}return db[_0x5cea('0x80')]['create'](_[_0x5cea('0x19')](_0x54d01a[_0x5cea('0x5f')],{'firstName':_0x18d77f,[_0x2d1885['mapKey']]:_0x18d77f,'phone':_0x18d77f,'ListId':_0x2f05f8[_0x5cea('0x8b')]}));}})[_0x5cea('0x22')](handleEntityNotFound(_0x144ff1,null))[_0x5cea('0x22')](function(_0x28ab5d){if(_0x28ab5d){_0x5e1f86=_0x28ab5d;return db['OpenchannelInteraction'][_0x5cea('0x62')]({'where':{'ContactId':_0x5e1f86['id'],'closed':![],'OpenchannelAccountId':_0x2f05f8['id']}})[_0x5cea('0x22')](function(_0x54444a){if(_0x54444a){return[_0x54444a,![]];}return db[_0x5cea('0x8f')][_0x5cea('0x5e')]({'UserId':_0x54d01a['user']['id'],'ContactId':_0x5e1f86['id'],'OpenchannelAccountId':_0x2f05f8['id'],'lastMsgDirection':_0x5cea('0xbd'),'firstMsgDirection':'out','Messages':[_[_0x5cea('0x55')](_0x54d01a[_0x5cea('0x5f')],{'read':![],'body':_0x54d01a[_0x5cea('0x5f')][_0x5cea('0x5f')],'OpenchannelAccountId':_0x2f05f8['id'],'UserId':_0x54d01a['user']['id'],'ContactId':_0x5e1f86['id']})]},{'include':[{'model':db[_0x5cea('0xbe')],'as':_0x5cea('0xbf')}]})[_0x5cea('0x22')](function(_0xb1410e){return[_0xb1410e,!![]];});});}})[_0x5cea('0x91')](function(_0x5a54d9,_0x307a0c){if(_0x307a0c){return _0x5a54d9;}return db[_0x5cea('0xbe')][_0x5cea('0x5e')](_['merge'](_0x54d01a[_0x5cea('0x5f')],{'read':![],'body':_0x54d01a['body'][_0x5cea('0x5f')],'OpenchannelAccountId':_0x2f05f8['id'],'OpenchannelInteractionId':_0x5a54d9['id'],'UserId':_0x54d01a[_0x5cea('0x61')]['id'],'ContactId':_0x5e1f86['id']}))[_0x5cea('0x22')](function(_0x1486a1){_0x5a54d9[_0x5cea('0xc0')]['Messages']=[];_0x5a54d9[_0x5cea('0xc0')][_0x5cea('0xbf')]['push'](_0x1486a1['dataValues']);return _0x5a54d9;});});}})[_0x5cea('0x22')](respondWithResult(_0x144ff1,null))[_0x5cea('0x2d')](handleError(_0x144ff1,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index be88163..b3aa9b9 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 _0x702d=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount'];(function(_0x387670,_0x58176c){var _0x374350=function(_0x2eae21){while(--_0x2eae21){_0x387670['push'](_0x387670['shift']());}};_0x374350(++_0x58176c);}(_0x702d,0x147));var _0xd702=function(_0x2eef28,_0x2e9492){_0x2eef28=_0x2eef28-0x0;var _0x143de6=_0x702d[_0x2eef28];return _0x143de6;};'use strict';var EventEmitter=require(_0xd702('0x0'));var OpenchannelAccount=require(_0xd702('0x1'))['db'][_0xd702('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xd702('0x3')](0x0);var events={'afterCreate':_0xd702('0x4'),'afterUpdate':'update','afterDestroy':_0xd702('0x5')};function emitEvent(_0xebbd7c){return function(_0x27b260,_0x1c5a32,_0x481ee0){OpenchannelAccountEvents[_0xd702('0x6')](_0xebbd7c+':'+_0x27b260['id'],_0x27b260);OpenchannelAccountEvents['emit'](_0xebbd7c,_0x27b260);_0x481ee0(null);};}for(var e in events){if(events[_0xd702('0x7')](e)){var event=events[e];OpenchannelAccount[_0xd702('0x8')](e,emitEvent(event));}}module[_0xd702('0x9')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xcb91=['save','update','emit','hasOwnProperty','hook','OpenchannelAccount','setMaxListeners'];(function(_0x55852e,_0x35e58d){var _0x3ced5d=function(_0x465d3c){while(--_0x465d3c){_0x55852e['push'](_0x55852e['shift']());}};_0x3ced5d(++_0x35e58d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xd816e2,_0x5edac2){_0xd816e2=_0xd816e2-0x0;var _0x1f5924=_0xcb91[_0xd816e2];return _0x1f5924;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x1cb9('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x1cb9('0x1')](0x0);var events={'afterCreate':_0x1cb9('0x2'),'afterUpdate':_0x1cb9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x8c392f){return function(_0x2c17b8,_0x545a34,_0x13d5fd){OpenchannelAccountEvents[_0x1cb9('0x4')](_0x8c392f+':'+_0x2c17b8['id'],_0x2c17b8);OpenchannelAccountEvents['emit'](_0x8c392f,_0x2c17b8);_0x13d5fd(null);};}for(var e in events){if(events[_0x1cb9('0x5')](e)){var event=events[e];OpenchannelAccount[_0x1cb9('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index ac2712b..0880161 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(_0x3f5a2c,_0x52a3d){var _0x3af55d=function(_0x4077fa){while(--_0x4077fa){_0x3f5a2c['push'](_0x3f5a2c['shift']());}};_0x3af55d(++_0x52a3d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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(_0x39e5ff,_0x5c404e){var _0x332f9a=function(_0x2e7792){while(--_0x2e7792){_0x39e5ff['push'](_0x39e5ff['shift']());}};_0x332f9a(++_0x5c404e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 91af9d6..a778fe2 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 _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(_0x373684,_0xb7811e){var _0x1cf0f7=function(_0x51d451){while(--_0x51d451){_0x373684['push'](_0x373684['shift']());}};_0x1cf0f7(++_0xb7811e);}(_0x0bb5,0x148));var _0x50bb=function(_0xaba03d,_0xd928ec){_0xaba03d=_0xaba03d-0x0;var _0xe69732=_0x0bb5[_0xaba03d];return _0xe69732;};'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 +var _0x6cb4=['register','request','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter'];(function(_0x1cd1d1,_0x52d54f){var _0x589132=function(_0xd8ab73){while(--_0xd8ab73){_0x1cd1d1['push'](_0x1cd1d1['shift']());}};_0x589132(++_0x52d54f);}(_0x6cb4,0xff));var _0x46cb=function(_0x39924b,_0x5a0b35){_0x39924b=_0x39924b-0x0;var _0x2236d=_0x6cb4[_0x39924b];return _0x2236d;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var moment=require(_0x46cb('0x2'));var BPromise=require(_0x46cb('0x3'));var rs=require(_0x46cb('0x4'));var fs=require('fs');var Redis=require(_0x46cb('0x5'));var db=require(_0x46cb('0x6'))['db'];var utils=require(_0x46cb('0x7'));var logger=require(_0x46cb('0x8'))('rpc');var config=require(_0x46cb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x46cb('0xa')]['http']({'port':0x232a});config[_0x46cb('0xb')]=_[_0x46cb('0xc')](config[_0x46cb('0xb')],{'host':_0x46cb('0xd'),'port':0x18eb});var socket=require(_0x46cb('0xe'))(new Redis(config[_0x46cb('0xb')]));require('./openchannelAccount.socket')[_0x46cb('0xf')](socket);function respondWithRpcPromise(_0x34f9e9,_0x48101c,_0x206f10){return new BPromise(function(_0x106a87,_0x4a60b2){return client[_0x46cb('0x10')](_0x34f9e9,_0x206f10)[_0x46cb('0x11')](function(_0x570cfd){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x48101c,_0x46cb('0x12'));logger[_0x46cb('0x13')](_0x46cb('0x14'),_0x48101c,_0x46cb('0x12'),JSON['stringify'](_0x570cfd));if(_0x570cfd[_0x46cb('0x15')]){if(_0x570cfd[_0x46cb('0x15')][_0x46cb('0x16')]===0x1f4){logger[_0x46cb('0x15')](_0x46cb('0x17'),_0x48101c,_0x570cfd[_0x46cb('0x15')][_0x46cb('0x18')]);return _0x4a60b2(_0x570cfd[_0x46cb('0x15')][_0x46cb('0x18')]);}logger[_0x46cb('0x15')](_0x46cb('0x17'),_0x48101c,_0x570cfd['error'][_0x46cb('0x18')]);return _0x106a87(_0x570cfd['error'][_0x46cb('0x18')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x48101c,'request\x20sent');_0x106a87(_0x570cfd[_0x46cb('0x19')][_0x46cb('0x18')]);}})[_0x46cb('0x1a')](function(_0xcc8e2){logger[_0x46cb('0x15')](_0x46cb('0x17'),_0x48101c,_0xcc8e2);_0x4a60b2(_0xcc8e2);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 147e5d4..de675ba 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 _0xdecb=['length','openchannelAccount:','save','remove','update','emit','removeListener','register'];(function(_0x5e6cb8,_0x1d1eb5){var _0x41754f=function(_0x5ef4ef){while(--_0x5ef4ef){_0x5e6cb8['push'](_0x5e6cb8['shift']());}};_0x41754f(++_0x1d1eb5);}(_0xdecb,0xe2));var _0xbdec=function(_0x5aedd3,_0x36d94e){_0x5aedd3=_0x5aedd3-0x0;var _0x332e44=_0xdecb[_0x5aedd3];return _0x332e44;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xbdec('0x0'),_0xbdec('0x1'),_0xbdec('0x2')];function createListener(_0x48a8f2,_0xf5506d){return function(_0x50154c){_0xf5506d[_0xbdec('0x3')](_0x48a8f2,_0x50154c);};}function removeListener(_0x17c436,_0x140e68){return function(){OpenchannelAccountEvents[_0xbdec('0x4')](_0x17c436,_0x140e68);};}exports[_0xbdec('0x5')]=function(_0x26fef3){for(var _0x13d9f8=0x0,_0x532f8e=events[_0xbdec('0x6')];_0x13d9f8<_0x532f8e;_0x13d9f8++){var _0x22f7d4=events[_0x13d9f8];var _0x2e8942=createListener(_0xbdec('0x7')+_0x22f7d4,_0x26fef3);OpenchannelAccountEvents['on'](_0x22f7d4,_0x2e8942);}}; \ No newline at end of file +var _0xd1d4=['save','update','emit','removeListener','register','length','./openchannelAccount.events'];(function(_0x5b1d35,_0x325242){var _0x2c2965=function(_0x3ae9d0){while(--_0x3ae9d0){_0x5b1d35['push'](_0x5b1d35['shift']());}};_0x2c2965(++_0x325242);}(_0xd1d4,0xfb));var _0x4d1d=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xd1d4[_0x5f0089];return _0x193892;};'use strict';var OpenchannelAccountEvents=require(_0x4d1d('0x0'));var events=[_0x4d1d('0x1'),'remove',_0x4d1d('0x2')];function createListener(_0x54f44c,_0x5ed209){return function(_0x2fdf2e){_0x5ed209[_0x4d1d('0x3')](_0x54f44c,_0x2fdf2e);};}function removeListener(_0x260e6a,_0x3bcfda){return function(){OpenchannelAccountEvents[_0x4d1d('0x4')](_0x260e6a,_0x3bcfda);};}exports[_0x4d1d('0x5')]=function(_0x30466a){for(var _0xb8a403=0x0,_0x1547d5=events[_0x4d1d('0x6')];_0xb8a403<_0x1547d5;_0xb8a403++){var _0x23f6c4=events[_0xb8a403];var _0x54da0f=createListener('openchannelAccount:'+_0x23f6c4,_0x30466a);OpenchannelAccountEvents['on'](_0x23f6c4,_0x54da0f);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 28a289d..52cb7bd 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 _0x84af=['./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x5a60ce,_0x48f080){var _0x393e5e=function(_0x1c58fc){while(--_0x1c58fc){_0x5a60ce['push'](_0x5a60ce['shift']());}};_0x393e5e(++_0x48f080);}(_0x84af,0x185));var _0xf84a=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x84af[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xf84a('0x0'));var util=require(_0xf84a('0x1'));var path=require(_0xf84a('0x2'));var timeout=require('connect-timeout');var express=require(_0xf84a('0x3'));var router=express['Router']();var fs_extra=require(_0xf84a('0x4'));var auth=require(_0xf84a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf84a('0x6'));var controller=require(_0xf84a('0x7'));router[_0xf84a('0x8')]('/',auth[_0xf84a('0x9')](),controller[_0xf84a('0xa')]);router[_0xf84a('0x8')](_0xf84a('0xb'),auth[_0xf84a('0x9')](),controller[_0xf84a('0xc')]);router[_0xf84a('0xd')]('/',auth[_0xf84a('0x9')](),controller[_0xf84a('0xe')]);router[_0xf84a('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xf84a('0x10')]);router['delete'](_0xf84a('0xb'),auth[_0xf84a('0x9')](),controller['destroy']);module[_0xf84a('0x11')]=router; \ No newline at end of file +var _0xb7af=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','/:id','show','post','isAuthenticated','create','put','destroy','exports','multer'];(function(_0x2fc8a8,_0x71c3a2){var _0x3597b4=function(_0x41c345){while(--_0x41c345){_0x2fc8a8['push'](_0x2fc8a8['shift']());}};_0x3597b4(++_0x71c3a2);}(_0xb7af,0x1c1));var _0xfb7a=function(_0xbf5e16,_0x146ce3){_0xbf5e16=_0xbf5e16-0x0;var _0x5975a5=_0xb7af[_0xbf5e16];return _0x5975a5;};'use strict';var multer=require(_0xfb7a('0x0'));var util=require('util');var path=require(_0xfb7a('0x1'));var timeout=require(_0xfb7a('0x2'));var express=require(_0xfb7a('0x3'));var router=express[_0xfb7a('0x4')]();var fs_extra=require(_0xfb7a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfb7a('0x6'));var config=require(_0xfb7a('0x7'));var controller=require(_0xfb7a('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xfb7a('0x9')](_0xfb7a('0xa'),auth['isAuthenticated'](),controller[_0xfb7a('0xb')]);router[_0xfb7a('0xc')]('/',auth[_0xfb7a('0xd')](),controller[_0xfb7a('0xe')]);router[_0xfb7a('0xf')]('/:id',auth[_0xfb7a('0xd')](),controller['update']);router['delete'](_0xfb7a('0xa'),auth[_0xfb7a('0xd')](),controller[_0xfb7a('0x10')]);module[_0xfb7a('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 7a544b2..fa1dae6 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 _0xc90d=['*,*,*,*','sequelize','exports','INTEGER','TEXT','STRING'];(function(_0x5af97c,_0x24a49f){var _0x3472ae=function(_0x54cdc3){while(--_0x54cdc3){_0x5af97c['push'](_0x5af97c['shift']());}};_0x3472ae(++_0x24a49f);}(_0xc90d,0xdf));var _0xdc90=function(_0xa6df52,_0x1b8584){_0xa6df52=_0xa6df52-0x0;var _0x5edd57=_0xc90d[_0xa6df52];return _0x5edd57;};'use strict';var Sequelize=require(_0xdc90('0x0'));module[_0xdc90('0x1')]={'priority':{'type':Sequelize[_0xdc90('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xdc90('0x3')]()},'description':{'type':Sequelize[_0xdc90('0x4')]},'interval':{'type':Sequelize[_0xdc90('0x4')],'defaultValue':_0xdc90('0x5')}}; \ No newline at end of file +var _0x685c=['*,*,*,*','sequelize','exports','INTEGER','STRING','TEXT'];(function(_0x1202a6,_0x29b04e){var _0x31dc2a=function(_0x9f5c31){while(--_0x9f5c31){_0x1202a6['push'](_0x1202a6['shift']());}};_0x31dc2a(++_0x29b04e);}(_0x685c,0xd3));var _0xc685=function(_0x3c5dd5,_0x26e153){_0x3c5dd5=_0x3c5dd5-0x0;var _0xf9fcdb=_0x685c[_0x3c5dd5];return _0xf9fcdb;};'use strict';var Sequelize=require(_0xc685('0x0'));module[_0xc685('0x1')]={'priority':{'type':Sequelize[_0xc685('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc685('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xc685('0x4')]()},'description':{'type':Sequelize[_0xc685('0x3')]},'interval':{'type':Sequelize[_0xc685('0x3')],'defaultValue':_0xc685('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 8bf0a7d..bfca633 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 _0x18dd=['rawAttributes','fieldName','type','filters','intersection','query','attributes','fields','length','model','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','then','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','status','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','end','sendStatus','error','stack','name','send','index','map','OpenchannelApplication'];(function(_0x42b2bf,_0x31af45){var _0x2c3020=function(_0x4a060d){while(--_0x4a060d){_0x42b2bf['push'](_0x42b2bf['shift']());}};_0x2c3020(++_0x31af45);}(_0x18dd,0x139));var _0xd18d=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x18dd[_0x2d7f0e];return _0x110b07;};'use strict';var emlformat=require(_0xd18d('0x0'));var rimraf=require(_0xd18d('0x1'));var zipdir=require(_0xd18d('0x2'));var jsonpatch=require(_0xd18d('0x3'));var rp=require('request-promise');var moment=require(_0xd18d('0x4'));var BPromise=require(_0xd18d('0x5'));var Mustache=require(_0xd18d('0x6'));var util=require(_0xd18d('0x7'));var path=require(_0xd18d('0x8'));var sox=require(_0xd18d('0x9'));var csv=require(_0xd18d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd18d('0xb'));var squel=require(_0xd18d('0xc'));var crypto=require('crypto');var jsforce=require(_0xd18d('0xd'));var deskjs=require(_0xd18d('0xe'));var toCsv=require(_0xd18d('0xa'));var querystring=require('querystring');var Papa=require(_0xd18d('0xf'));var Redis=require(_0xd18d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd18d('0x11'));var as=require(_0xd18d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd18d('0x13'))(_0xd18d('0x14'));var utils=require(_0xd18d('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10b73d,_0x1875f7){_0x1875f7=_0x1875f7||0xcc;return function(_0xa3d857){if(_0xa3d857){return _0x10b73d['sendStatus'](_0x1875f7);}return _0x10b73d[_0xd18d('0x16')](_0x1875f7)['end']();};}function respondWithResult(_0xf25f0a,_0x241af6){_0x241af6=_0x241af6||0xc8;return function(_0x27e3c2){if(_0x27e3c2){return _0xf25f0a[_0xd18d('0x16')](_0x241af6)['json'](_0x27e3c2);}};}function respondWithFilteredResult(_0x30791c,_0x5d7b8e){return function(_0x440a3d){if(_0x440a3d){var _0x11cf58=typeof _0x5d7b8e[_0xd18d('0x17')]==='undefined'&&typeof _0x5d7b8e[_0xd18d('0x18')]===_0xd18d('0x19');var _0x400845=_0x440a3d[_0xd18d('0x1a')];var _0x213ae8=_0x11cf58?0x0:_0x5d7b8e[_0xd18d('0x17')];var _0x5f2158=_0x11cf58?_0x440a3d[_0xd18d('0x1a')]:_0x5d7b8e[_0xd18d('0x17')]+_0x5d7b8e[_0xd18d('0x18')];var _0x1b7fd1;if(_0x5f2158>=_0x400845){_0x5f2158=_0x400845;_0x1b7fd1=0xc8;}else{_0x1b7fd1=0xce;}_0x30791c['status'](_0x1b7fd1);return _0x30791c[_0xd18d('0x1b')](_0xd18d('0x1c'),_0x213ae8+'-'+_0x5f2158+'/'+_0x400845)[_0xd18d('0x1d')](_0x440a3d);}return null;};}function patchUpdates(_0x3547dc){return function(_0x4a0854){try{jsonpatch[_0xd18d('0x1e')](_0x4a0854,_0x3547dc,!![]);}catch(_0x185625){return BPromise['reject'](_0x185625);}return _0x4a0854[_0xd18d('0x1f')]();};}function saveUpdates(_0x1eb697,_0xae32f5){return function(_0x149b6e){if(_0x149b6e){return _0x149b6e[_0xd18d('0x20')](_0x1eb697)['then'](function(_0x557beb){return _0x557beb;});}return null;};}function removeEntity(_0x27c505,_0x551b9c){return function(_0xd4486f){if(_0xd4486f){return _0xd4486f['destroy']()['then'](function(){_0x27c505['status'](0xcc)[_0xd18d('0x21')]();});}};}function handleEntityNotFound(_0x42098c,_0x1f396e){return function(_0x1fcdd2){if(!_0x1fcdd2){_0x42098c[_0xd18d('0x22')](0x194);}return _0x1fcdd2;};}function handleError(_0x4d0466,_0x4da4b4){_0x4da4b4=_0x4da4b4||0x1f4;return function(_0x2ed587){logger[_0xd18d('0x23')](_0x2ed587[_0xd18d('0x24')]);if(_0x2ed587[_0xd18d('0x25')]){delete _0x2ed587['name'];}_0x4d0466[_0xd18d('0x16')](_0x4da4b4)[_0xd18d('0x26')](_0x2ed587);};}exports[_0xd18d('0x27')]=function(_0xc69ac0,_0x32aab4){var _0x544e56={},_0x21d250={},_0x3b6d38={'count':0x0,'rows':[]};var _0x101f04=_[_0xd18d('0x28')](db[_0xd18d('0x29')][_0xd18d('0x2a')],function(_0x6c8a4c){return{'name':_0x6c8a4c[_0xd18d('0x2b')],'type':_0x6c8a4c[_0xd18d('0x2c')]['key']};});_0x21d250['model']=_['map'](_0x101f04,_0xd18d('0x25'));_0x21d250['query']=_['keys'](_0xc69ac0['query']);_0x21d250[_0xd18d('0x2d')]=_[_0xd18d('0x2e')](_0x21d250['model'],_0x21d250[_0xd18d('0x2f')]);_0x544e56[_0xd18d('0x30')]=_[_0xd18d('0x2e')](_0x21d250['model'],qs[_0xd18d('0x31')](_0xc69ac0['query'][_0xd18d('0x31')]));_0x544e56[_0xd18d('0x30')]=_0x544e56['attributes'][_0xd18d('0x32')]?_0x544e56[_0xd18d('0x30')]:_0x21d250[_0xd18d('0x33')];if(!_0xc69ac0[_0xd18d('0x2f')]['hasOwnProperty'](_0xd18d('0x34'))){_0x544e56[_0xd18d('0x18')]=qs[_0xd18d('0x18')](_0xc69ac0['query']['limit']);_0x544e56[_0xd18d('0x17')]=qs[_0xd18d('0x17')](_0xc69ac0[_0xd18d('0x2f')][_0xd18d('0x17')]);}_0x544e56['order']=qs[_0xd18d('0x35')](_0xc69ac0[_0xd18d('0x2f')][_0xd18d('0x35')]);_0x544e56[_0xd18d('0x36')]=qs['filters'](_[_0xd18d('0x37')](_0xc69ac0['query'],_0x21d250['filters']),_0x101f04);if(_0xc69ac0[_0xd18d('0x2f')][_0xd18d('0x38')]){_0x544e56[_0xd18d('0x36')]=_[_0xd18d('0x39')](_0x544e56[_0xd18d('0x36')],{'$or':_['map'](_0x101f04,function(_0x53d83c){if(_0x53d83c[_0xd18d('0x2c')]!==_0xd18d('0x3a')){var _0x1feca6={};_0x1feca6[_0x53d83c['name']]={'$like':'%'+_0xc69ac0['query'][_0xd18d('0x38')]+'%'};return _0x1feca6;}})});}_0x544e56=_[_0xd18d('0x39')]({},_0x544e56,_0xc69ac0[_0xd18d('0x3b')]);var _0x22867b={'where':_0x544e56[_0xd18d('0x36')]};return db[_0xd18d('0x29')][_0xd18d('0x1a')](_0x22867b)['then'](function(_0x2af86b){_0x3b6d38[_0xd18d('0x1a')]=_0x2af86b;if(_0xc69ac0[_0xd18d('0x2f')][_0xd18d('0x3c')]){_0x544e56[_0xd18d('0x3d')]=[{'all':!![]}];}return db[_0xd18d('0x29')][_0xd18d('0x3e')](_0x544e56);})['then'](function(_0x41f96c){_0x3b6d38[_0xd18d('0x3f')]=_0x41f96c;return _0x3b6d38;})['then'](respondWithFilteredResult(_0x32aab4,_0x544e56))[_0xd18d('0x40')](handleError(_0x32aab4,null));};exports['show']=function(_0x313766,_0x2fe7da){var _0x361c45={'raw':!![],'where':{'id':_0x313766[_0xd18d('0x41')]['id']}},_0x1c8162={};_0x1c8162['model']=_[_0xd18d('0x42')](db[_0xd18d('0x29')][_0xd18d('0x2a')]);_0x1c8162['query']=_['keys'](_0x313766['query']);_0x1c8162[_0xd18d('0x2d')]=_['intersection'](_0x1c8162[_0xd18d('0x33')],_0x1c8162[_0xd18d('0x2f')]);_0x361c45['attributes']=_[_0xd18d('0x2e')](_0x1c8162['model'],qs[_0xd18d('0x31')](_0x313766['query'][_0xd18d('0x31')]));_0x361c45[_0xd18d('0x30')]=_0x361c45[_0xd18d('0x30')][_0xd18d('0x32')]?_0x361c45[_0xd18d('0x30')]:_0x1c8162[_0xd18d('0x33')];if(_0x313766[_0xd18d('0x2f')][_0xd18d('0x3c')]){_0x361c45[_0xd18d('0x3d')]=[{'all':!![]}];}_0x361c45=_['merge']({},_0x361c45,_0x313766['options']);return db[_0xd18d('0x29')]['find'](_0x361c45)[_0xd18d('0x43')](handleEntityNotFound(_0x2fe7da,null))[_0xd18d('0x43')](respondWithResult(_0x2fe7da,null))[_0xd18d('0x40')](handleError(_0x2fe7da,null));};exports[_0xd18d('0x44')]=function(_0x3ebae4,_0x481cd5){return db['OpenchannelApplication'][_0xd18d('0x44')](_0x3ebae4[_0xd18d('0x45')],{})[_0xd18d('0x43')](respondWithResult(_0x481cd5,0xc9))['catch'](handleError(_0x481cd5,null));};exports[_0xd18d('0x20')]=function(_0x1d5d99,_0x1301d8){if(_0x1d5d99['body']['id']){delete _0x1d5d99[_0xd18d('0x45')]['id'];}return db[_0xd18d('0x29')][_0xd18d('0x46')]({'where':{'id':_0x1d5d99['params']['id']}})['then'](handleEntityNotFound(_0x1301d8,null))[_0xd18d('0x43')](saveUpdates(_0x1d5d99[_0xd18d('0x45')],null))[_0xd18d('0x43')](respondWithResult(_0x1301d8,null))[_0xd18d('0x40')](handleError(_0x1301d8,null));};exports['destroy']=function(_0x28379d,_0x449a92){return db[_0xd18d('0x29')][_0xd18d('0x46')]({'where':{'id':_0x28379d[_0xd18d('0x41')]['id']}})['then'](handleEntityNotFound(_0x449a92,null))[_0xd18d('0x43')](removeEntity(_0x449a92,null))['catch'](handleError(_0x449a92,null));}; \ No newline at end of file +var _0x5e1e=['apply','reject','save','update','then','destroy','status','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','fields','include','find','catch','create','body','params','eml-format','zip-dir','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','offset','limit','undefined','count','set','Content-Range','json'];(function(_0x3140fa,_0x4c9cdd){var _0x30551e=function(_0x275987){while(--_0x275987){_0x3140fa['push'](_0x3140fa['shift']());}};_0x30551e(++_0x4c9cdd);}(_0x5e1e,0x101));var _0xe5e1=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x5e1e[_0x164eca];return _0x2ce562;};'use strict';var emlformat=require(_0xe5e1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe5e1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe5e1('0x2'));var moment=require(_0xe5e1('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xe5e1('0x4'));var sox=require(_0xe5e1('0x5'));var csv=require(_0xe5e1('0x6'));var ejs=require(_0xe5e1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe5e1('0x8'));var squel=require(_0xe5e1('0x9'));var crypto=require(_0xe5e1('0xa'));var jsforce=require(_0xe5e1('0xb'));var deskjs=require(_0xe5e1('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe5e1('0xd'));var Papa=require(_0xe5e1('0xe'));var Redis=require('ioredis');var authService=require(_0xe5e1('0xf'));var qs=require(_0xe5e1('0x10'));var as=require(_0xe5e1('0x11'));var hardwareService=require(_0xe5e1('0x12'));var logger=require('../../config/logger')(_0xe5e1('0x13'));var utils=require('../../config/utils');var config=require(_0xe5e1('0x14'));var licenseUtil=require(_0xe5e1('0x15'));var db=require(_0xe5e1('0x16'))['db'];function respondWithStatusCode(_0x48a2ba,_0x43f870){_0x43f870=_0x43f870||0xcc;return function(_0x12d878){if(_0x12d878){return _0x48a2ba[_0xe5e1('0x17')](_0x43f870);}return _0x48a2ba['status'](_0x43f870)['end']();};}function respondWithResult(_0x4129ea,_0x3290d0){_0x3290d0=_0x3290d0||0xc8;return function(_0x1accdc){if(_0x1accdc){return _0x4129ea['status'](_0x3290d0)['json'](_0x1accdc);}};}function respondWithFilteredResult(_0x477988,_0x110000){return function(_0xad53f5){if(_0xad53f5){var _0x5d5b47=typeof _0x110000[_0xe5e1('0x18')]==='undefined'&&typeof _0x110000[_0xe5e1('0x19')]===_0xe5e1('0x1a');var _0x5bb7d1=_0xad53f5[_0xe5e1('0x1b')];var _0x48b946=_0x5d5b47?0x0:_0x110000[_0xe5e1('0x18')];var _0x2dec72=_0x5d5b47?_0xad53f5[_0xe5e1('0x1b')]:_0x110000[_0xe5e1('0x18')]+_0x110000['limit'];var _0x97cc4d;if(_0x2dec72>=_0x5bb7d1){_0x2dec72=_0x5bb7d1;_0x97cc4d=0xc8;}else{_0x97cc4d=0xce;}_0x477988['status'](_0x97cc4d);return _0x477988[_0xe5e1('0x1c')](_0xe5e1('0x1d'),_0x48b946+'-'+_0x2dec72+'/'+_0x5bb7d1)[_0xe5e1('0x1e')](_0xad53f5);}return null;};}function patchUpdates(_0x2a08f3){return function(_0x4590bd){try{jsonpatch[_0xe5e1('0x1f')](_0x4590bd,_0x2a08f3,!![]);}catch(_0x147106){return BPromise[_0xe5e1('0x20')](_0x147106);}return _0x4590bd[_0xe5e1('0x21')]();};}function saveUpdates(_0xe54fd9,_0x140ada){return function(_0x37ac2a){if(_0x37ac2a){return _0x37ac2a[_0xe5e1('0x22')](_0xe54fd9)[_0xe5e1('0x23')](function(_0x4c5be8){return _0x4c5be8;});}return null;};}function removeEntity(_0x4005fe,_0x339587){return function(_0xab3560){if(_0xab3560){return _0xab3560[_0xe5e1('0x24')]()[_0xe5e1('0x23')](function(){_0x4005fe[_0xe5e1('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x475c37,_0x4676a6){return function(_0x55d136){if(!_0x55d136){_0x475c37[_0xe5e1('0x17')](0x194);}return _0x55d136;};}function handleError(_0x4c426e,_0x1dfacb){_0x1dfacb=_0x1dfacb||0x1f4;return function(_0x16f628){logger[_0xe5e1('0x26')](_0x16f628[_0xe5e1('0x27')]);if(_0x16f628[_0xe5e1('0x28')]){delete _0x16f628[_0xe5e1('0x28')];}_0x4c426e[_0xe5e1('0x25')](_0x1dfacb)[_0xe5e1('0x29')](_0x16f628);};}exports[_0xe5e1('0x2a')]=function(_0xef3f76,_0x3d1685){var _0x5998d3={},_0x382f59={},_0x16f5e9={'count':0x0,'rows':[]};var _0x41ee7f=_[_0xe5e1('0x2b')](db[_0xe5e1('0x2c')][_0xe5e1('0x2d')],function(_0x3b7268){return{'name':_0x3b7268[_0xe5e1('0x2e')],'type':_0x3b7268[_0xe5e1('0x2f')]['key']};});_0x382f59[_0xe5e1('0x30')]=_['map'](_0x41ee7f,_0xe5e1('0x28'));_0x382f59[_0xe5e1('0x31')]=_[_0xe5e1('0x32')](_0xef3f76[_0xe5e1('0x31')]);_0x382f59['filters']=_[_0xe5e1('0x33')](_0x382f59[_0xe5e1('0x30')],_0x382f59[_0xe5e1('0x31')]);_0x5998d3[_0xe5e1('0x34')]=_[_0xe5e1('0x33')](_0x382f59[_0xe5e1('0x30')],qs['fields'](_0xef3f76['query']['fields']));_0x5998d3[_0xe5e1('0x34')]=_0x5998d3[_0xe5e1('0x34')][_0xe5e1('0x35')]?_0x5998d3['attributes']:_0x382f59[_0xe5e1('0x30')];if(!_0xef3f76['query']['hasOwnProperty'](_0xe5e1('0x36'))){_0x5998d3[_0xe5e1('0x19')]=qs[_0xe5e1('0x19')](_0xef3f76[_0xe5e1('0x31')][_0xe5e1('0x19')]);_0x5998d3[_0xe5e1('0x18')]=qs[_0xe5e1('0x18')](_0xef3f76[_0xe5e1('0x31')][_0xe5e1('0x18')]);}_0x5998d3[_0xe5e1('0x37')]=qs['sort'](_0xef3f76[_0xe5e1('0x31')][_0xe5e1('0x38')]);_0x5998d3[_0xe5e1('0x39')]=qs['filters'](_['pick'](_0xef3f76['query'],_0x382f59[_0xe5e1('0x3a')]),_0x41ee7f);if(_0xef3f76[_0xe5e1('0x31')][_0xe5e1('0x3b')]){_0x5998d3[_0xe5e1('0x39')]=_[_0xe5e1('0x3c')](_0x5998d3[_0xe5e1('0x39')],{'$or':_[_0xe5e1('0x2b')](_0x41ee7f,function(_0x3fd2b3){if(_0x3fd2b3[_0xe5e1('0x2f')]!==_0xe5e1('0x3d')){var _0x4095e9={};_0x4095e9[_0x3fd2b3[_0xe5e1('0x28')]]={'$like':'%'+_0xef3f76[_0xe5e1('0x31')]['filter']+'%'};return _0x4095e9;}})});}_0x5998d3=_[_0xe5e1('0x3c')]({},_0x5998d3,_0xef3f76[_0xe5e1('0x3e')]);var _0x305ab4={'where':_0x5998d3[_0xe5e1('0x39')]};return db[_0xe5e1('0x2c')][_0xe5e1('0x1b')](_0x305ab4)[_0xe5e1('0x23')](function(_0x3b8b22){_0x16f5e9[_0xe5e1('0x1b')]=_0x3b8b22;if(_0xef3f76[_0xe5e1('0x31')][_0xe5e1('0x3f')]){_0x5998d3['include']=[{'all':!![]}];}return db[_0xe5e1('0x2c')][_0xe5e1('0x40')](_0x5998d3);})[_0xe5e1('0x23')](function(_0x170067){_0x16f5e9['rows']=_0x170067;return _0x16f5e9;})['then'](respondWithFilteredResult(_0x3d1685,_0x5998d3))['catch'](handleError(_0x3d1685,null));};exports['show']=function(_0x35997a,_0x42625f){var _0x2bdfbd={'raw':!![],'where':{'id':_0x35997a['params']['id']}},_0x56cb1f={};_0x56cb1f['model']=_[_0xe5e1('0x32')](db[_0xe5e1('0x2c')][_0xe5e1('0x2d')]);_0x56cb1f[_0xe5e1('0x31')]=_[_0xe5e1('0x32')](_0x35997a[_0xe5e1('0x31')]);_0x56cb1f[_0xe5e1('0x3a')]=_['intersection'](_0x56cb1f[_0xe5e1('0x30')],_0x56cb1f['query']);_0x2bdfbd[_0xe5e1('0x34')]=_['intersection'](_0x56cb1f[_0xe5e1('0x30')],qs[_0xe5e1('0x41')](_0x35997a['query'][_0xe5e1('0x41')]));_0x2bdfbd['attributes']=_0x2bdfbd[_0xe5e1('0x34')][_0xe5e1('0x35')]?_0x2bdfbd[_0xe5e1('0x34')]:_0x56cb1f[_0xe5e1('0x30')];if(_0x35997a[_0xe5e1('0x31')][_0xe5e1('0x3f')]){_0x2bdfbd[_0xe5e1('0x42')]=[{'all':!![]}];}_0x2bdfbd=_[_0xe5e1('0x3c')]({},_0x2bdfbd,_0x35997a[_0xe5e1('0x3e')]);return db[_0xe5e1('0x2c')][_0xe5e1('0x43')](_0x2bdfbd)[_0xe5e1('0x23')](handleEntityNotFound(_0x42625f,null))[_0xe5e1('0x23')](respondWithResult(_0x42625f,null))[_0xe5e1('0x44')](handleError(_0x42625f,null));};exports[_0xe5e1('0x45')]=function(_0x4270d5,_0x3223af){return db[_0xe5e1('0x2c')]['create'](_0x4270d5['body'],{})[_0xe5e1('0x23')](respondWithResult(_0x3223af,0xc9))['catch'](handleError(_0x3223af,null));};exports[_0xe5e1('0x22')]=function(_0x2c9798,_0x47ca83){if(_0x2c9798[_0xe5e1('0x46')]['id']){delete _0x2c9798[_0xe5e1('0x46')]['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x2c9798[_0xe5e1('0x47')]['id']}})['then'](handleEntityNotFound(_0x47ca83,null))[_0xe5e1('0x23')](saveUpdates(_0x2c9798[_0xe5e1('0x46')],null))[_0xe5e1('0x23')](respondWithResult(_0x47ca83,null))['catch'](handleError(_0x47ca83,null));};exports[_0xe5e1('0x24')]=function(_0x36c907,_0x4bb8d4){return db['OpenchannelApplication']['find']({'where':{'id':_0x36c907[_0xe5e1('0x47')]['id']}})['then'](handleEntityNotFound(_0x4bb8d4,null))[_0xe5e1('0x23')](removeEntity(_0x4bb8d4,null))[_0xe5e1('0x44')](handleError(_0x4bb8d4,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 0263c02..1e28f4e 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 _0xb3c4=['moment','bluebird','path','rimraf','../../config/environment','exports','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x2ca2c1,_0x2dc485){var _0x563133=function(_0x1c84b9){while(--_0x1c84b9){_0x2ca2c1['push'](_0x2ca2c1['shift']());}};_0x563133(++_0x2dc485);}(_0xb3c4,0x128));var _0x4b3c=function(_0x335712,_0x321dd0){_0x335712=_0x335712-0x0;var _0x13949a=_0xb3c4[_0x335712];return _0x13949a;};'use strict';var _=require(_0x4b3c('0x0'));var util=require(_0x4b3c('0x1'));var logger=require(_0x4b3c('0x2'))('api');var moment=require(_0x4b3c('0x3'));var BPromise=require(_0x4b3c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4b3c('0x5'));var rimraf=require(_0x4b3c('0x6'));var config=require(_0x4b3c('0x7'));var attributes=require('./openchannelApplication.attributes');module[_0x4b3c('0x8')]=function(_0x3ece85,_0x4370d5){return _0x3ece85[_0x4b3c('0x9')]('OpenchannelApplication',attributes,{'tableName':_0x4b3c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4b3c('0xb'),'collate':_0x4b3c('0xc')});}; \ No newline at end of file +var _0x2098=['moment','bluebird','request-promise','../../config/environment','define','OpenchannelApplication','openchannel_applications','lodash','util','../../config/logger'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x2098,0x151));var _0x8209=function(_0x29f63b,_0x4aae71){_0x29f63b=_0x29f63b-0x0;var _0x3a0768=_0x2098[_0x29f63b];return _0x3a0768;};'use strict';var _=require(_0x8209('0x0'));var util=require(_0x8209('0x1'));var logger=require(_0x8209('0x2'))('api');var moment=require(_0x8209('0x3'));var BPromise=require(_0x8209('0x4'));var rp=require(_0x8209('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8209('0x6'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x21753a,_0x3124c2){return _0x21753a[_0x8209('0x7')](_0x8209('0x8'),attributes,{'tableName':_0x8209('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index cfb6c05..25aca0a 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 _0x0935=['OpenchannelApplication','update','options','raw','where','attributes','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateOpenchannelApplication'];(function(_0x35a9e9,_0xa06a82){var _0x30aac2=function(_0x57cd37){while(--_0x57cd37){_0x35a9e9['push'](_0x35a9e9['shift']());}};_0x30aac2(++_0xa06a82);}(_0x0935,0x1c7));var _0x5093=function(_0x2c7ef6,_0x5aa3ab){_0x2c7ef6=_0x2c7ef6-0x0;var _0x30cbb9=_0x0935[_0x2c7ef6];return _0x30cbb9;};'use strict';var _=require(_0x5093('0x0'));var util=require('util');var moment=require(_0x5093('0x1'));var BPromise=require(_0x5093('0x2'));var rs=require(_0x5093('0x3'));var fs=require('fs');var Redis=require(_0x5093('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5093('0x5'));var logger=require('../../config/logger')(_0x5093('0x6'));var config=require(_0x5093('0x7'));var jayson=require(_0x5093('0x8'));var client=jayson[_0x5093('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x434ec2,_0x131500,_0x1c5598){return new BPromise(function(_0xdd3c14,_0x61d8e9){return client['request'](_0x434ec2,_0x1c5598)['then'](function(_0xb96800){logger[_0x5093('0xa')](_0x5093('0xb'),_0x131500,_0x5093('0xc'));logger[_0x5093('0xd')](_0x5093('0xe'),_0x131500,'request\x20sent',JSON[_0x5093('0xf')](_0xb96800));if(_0xb96800['error']){if(_0xb96800[_0x5093('0x10')][_0x5093('0x11')]===0x1f4){logger[_0x5093('0x10')](_0x5093('0xb'),_0x131500,_0xb96800['error'][_0x5093('0x12')]);return _0x61d8e9(_0xb96800[_0x5093('0x10')][_0x5093('0x12')]);}logger[_0x5093('0x10')](_0x5093('0xb'),_0x131500,_0xb96800[_0x5093('0x10')][_0x5093('0x12')]);return _0xdd3c14(_0xb96800[_0x5093('0x10')][_0x5093('0x12')]);}else{logger['info'](_0x5093('0xb'),_0x131500,_0x5093('0xc'));_0xdd3c14(_0xb96800['result'][_0x5093('0x12')]);}})[_0x5093('0x13')](function(_0x2fa572){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x131500,_0x2fa572);_0x61d8e9(_0x2fa572);});});}exports[_0x5093('0x14')]=function(_0x4466e1){var _0x7d2157=this;return new Promise(function(_0x3e80ab,_0x596862){return db[_0x5093('0x15')][_0x5093('0x16')](_0x4466e1['body'],{'raw':_0x4466e1['options']?_0x4466e1[_0x5093('0x17')][_0x5093('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4466e1[_0x5093('0x17')]?_0x4466e1[_0x5093('0x17')][_0x5093('0x19')]||null:null,'attributes':_0x4466e1[_0x5093('0x17')]?_0x4466e1[_0x5093('0x17')][_0x5093('0x1a')]||null:null,'limit':_0x4466e1[_0x5093('0x17')]?_0x4466e1['options']['limit']||null:null})[_0x5093('0x1b')](function(_0x424505){logger[_0x5093('0xa')](_0x5093('0x14'),_0x4466e1);logger[_0x5093('0xd')](_0x5093('0x14'),_0x4466e1,JSON['stringify'](_0x424505));_0x3e80ab(_0x424505);})[_0x5093('0x13')](function(_0x602ad1){logger[_0x5093('0x10')](_0x5093('0x14'),_0x602ad1[_0x5093('0x12')],_0x4466e1);_0x596862(_0x7d2157[_0x5093('0x10')](0x1f4,_0x602ad1[_0x5093('0x12')]));});});}; \ No newline at end of file +var _0x96bf=['where','attributes','limit','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateOpenchannelApplication','OpenchannelApplication','options'];(function(_0x3bf428,_0x43a591){var _0x2b18a7=function(_0xd49b27){while(--_0xd49b27){_0x3bf428['push'](_0x3bf428['shift']());}};_0x2b18a7(++_0x43a591);}(_0x96bf,0x143));var _0xf96b=function(_0x45fe9c,_0x55e0d7){_0x45fe9c=_0x45fe9c-0x0;var _0x233d48=_0x96bf[_0x45fe9c];return _0x233d48;};'use strict';var _=require('lodash');var util=require(_0xf96b('0x0'));var moment=require(_0xf96b('0x1'));var BPromise=require(_0xf96b('0x2'));var rs=require(_0xf96b('0x3'));var fs=require('fs');var Redis=require(_0xf96b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf96b('0x5'));var logger=require(_0xf96b('0x6'))(_0xf96b('0x7'));var config=require('../../config/environment');var jayson=require(_0xf96b('0x8'));var client=jayson['client'][_0xf96b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a4692,_0x741ba7,_0x491c29){return new BPromise(function(_0x299ee,_0x28f758){return client[_0xf96b('0xa')](_0x5a4692,_0x491c29)[_0xf96b('0xb')](function(_0x3d1d1d){logger[_0xf96b('0xc')](_0xf96b('0xd'),_0x741ba7,_0xf96b('0xe'));logger[_0xf96b('0xf')](_0xf96b('0x10'),_0x741ba7,_0xf96b('0xe'),JSON[_0xf96b('0x11')](_0x3d1d1d));if(_0x3d1d1d[_0xf96b('0x12')]){if(_0x3d1d1d[_0xf96b('0x12')][_0xf96b('0x13')]===0x1f4){logger[_0xf96b('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0x741ba7,_0x3d1d1d[_0xf96b('0x12')][_0xf96b('0x14')]);return _0x28f758(_0x3d1d1d[_0xf96b('0x12')][_0xf96b('0x14')]);}logger[_0xf96b('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0x741ba7,_0x3d1d1d[_0xf96b('0x12')][_0xf96b('0x14')]);return _0x299ee(_0x3d1d1d[_0xf96b('0x12')][_0xf96b('0x14')]);}else{logger[_0xf96b('0xc')](_0xf96b('0xd'),_0x741ba7,_0xf96b('0xe'));_0x299ee(_0x3d1d1d[_0xf96b('0x15')]['message']);}})['catch'](function(_0x514ce1){logger['error'](_0xf96b('0xd'),_0x741ba7,_0x514ce1);_0x28f758(_0x514ce1);});});}exports[_0xf96b('0x16')]=function(_0x552794){var _0x17c01b=this;return new Promise(function(_0x1c3b8d,_0x36788d){return db[_0xf96b('0x17')]['update'](_0x552794['body'],{'raw':_0x552794[_0xf96b('0x18')]?_0x552794[_0xf96b('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x552794[_0xf96b('0x18')]?_0x552794[_0xf96b('0x18')][_0xf96b('0x19')]||null:null,'attributes':_0x552794[_0xf96b('0x18')]?_0x552794['options'][_0xf96b('0x1a')]||null:null,'limit':_0x552794[_0xf96b('0x18')]?_0x552794[_0xf96b('0x18')][_0xf96b('0x1b')]||null:null})[_0xf96b('0xb')](function(_0x4251a3){logger[_0xf96b('0xc')](_0xf96b('0x16'),_0x552794);logger[_0xf96b('0xf')](_0xf96b('0x16'),_0x552794,JSON['stringify'](_0x4251a3));_0x1c3b8d(_0x4251a3);})[_0xf96b('0x1c')](function(_0x200ca4){logger[_0xf96b('0x12')](_0xf96b('0x16'),_0x200ca4['message'],_0x552794);_0x36788d(_0x17c01b[_0xf96b('0x12')](0x1f4,_0x200ca4['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 50cbeb2..86e004f 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 _0x4c2e=['/:id','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4c2e,0x142));var _0xe4c2=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x4c2e[_0x565ed7];return _0x183ad7;};'use strict';var multer=require(_0xe4c2('0x0'));var util=require(_0xe4c2('0x1'));var path=require(_0xe4c2('0x2'));var timeout=require(_0xe4c2('0x3'));var express=require(_0xe4c2('0x4'));var router=express[_0xe4c2('0x5')]();var fs_extra=require(_0xe4c2('0x6'));var auth=require(_0xe4c2('0x7'));var interaction=require(_0xe4c2('0x8'));var config=require(_0xe4c2('0x9'));var controller=require(_0xe4c2('0xa'));router[_0xe4c2('0xb')]('/',auth[_0xe4c2('0xc')](),controller[_0xe4c2('0xd')]);router['get'](_0xe4c2('0xe'),auth[_0xe4c2('0xc')](),controller[_0xe4c2('0xf')]);router['get']('/:id',auth[_0xe4c2('0xc')](),controller[_0xe4c2('0x10')]);router['get']('/:id/messages',auth[_0xe4c2('0xc')](),controller['getMessages']);router[_0xe4c2('0xb')](_0xe4c2('0x11'),auth[_0xe4c2('0xc')](),controller[_0xe4c2('0x12')]);router[_0xe4c2('0x13')]('/',auth[_0xe4c2('0xc')](),controller[_0xe4c2('0x14')]);router[_0xe4c2('0x13')](_0xe4c2('0x15'),auth[_0xe4c2('0xc')](),controller[_0xe4c2('0x16')]);router['post'](_0xe4c2('0x17'),auth[_0xe4c2('0xc')](),interaction[_0xe4c2('0x18')](_0xe4c2('0x19'),_0xe4c2('0x1a')),controller[_0xe4c2('0x1b')]);router['put'](_0xe4c2('0x1c'),auth['isAuthenticated'](),interaction[_0xe4c2('0x18')](_0xe4c2('0x19'),_0xe4c2('0x1d')),controller[_0xe4c2('0x1e')]);router['delete'](_0xe4c2('0x1c'),auth[_0xe4c2('0xc')](),interaction[_0xe4c2('0x18')](_0xe4c2('0x19'),_0xe4c2('0x1f')),controller[_0xe4c2('0x20')]);router[_0xe4c2('0x21')]('/:id/tags',auth['isAuthenticated'](),controller[_0xe4c2('0x22')]);module['exports']=router; \ No newline at end of file +var _0xb40c=['openchannel','openchannelinteraction:addtags','addTags','put','/:id','update','openchannelinteraction:destroy','destroy','/:id/tags','exports','multer','path','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/describe','show','/:id/messages','getMessages','download','post','create','addMessage','tracked'];(function(_0x296187,_0x66707b){var _0x4565d2=function(_0xb3f7cb){while(--_0xb3f7cb){_0x296187['push'](_0x296187['shift']());}};_0x4565d2(++_0x66707b);}(_0xb40c,0xea));var _0xcb40=function(_0x6bf179,_0x5e35d4){_0x6bf179=_0x6bf179-0x0;var _0x23a085=_0xb40c[_0x6bf179];return _0x23a085;};'use strict';var multer=require(_0xcb40('0x0'));var util=require('util');var path=require(_0xcb40('0x1'));var timeout=require('connect-timeout');var express=require(_0xcb40('0x2'));var router=express['Router']();var fs_extra=require(_0xcb40('0x3'));var auth=require(_0xcb40('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcb40('0x5'));var controller=require(_0xcb40('0x6'));router[_0xcb40('0x7')]('/',auth[_0xcb40('0x8')](),controller['index']);router['get'](_0xcb40('0x9'),auth[_0xcb40('0x8')](),controller['describe']);router[_0xcb40('0x7')]('/:id',auth[_0xcb40('0x8')](),controller[_0xcb40('0xa')]);router[_0xcb40('0x7')](_0xcb40('0xb'),auth[_0xcb40('0x8')](),controller[_0xcb40('0xc')]);router[_0xcb40('0x7')]('/:id/download',auth[_0xcb40('0x8')](),controller[_0xcb40('0xd')]);router[_0xcb40('0xe')]('/',auth[_0xcb40('0x8')](),controller[_0xcb40('0xf')]);router['post'](_0xcb40('0xb'),auth['isAuthenticated'](),controller[_0xcb40('0x10')]);router[_0xcb40('0xe')]('/:id/tags',auth[_0xcb40('0x8')](),interaction[_0xcb40('0x11')](_0xcb40('0x12'),_0xcb40('0x13')),controller[_0xcb40('0x14')]);router[_0xcb40('0x15')](_0xcb40('0x16'),auth[_0xcb40('0x8')](),interaction[_0xcb40('0x11')](_0xcb40('0x12'),'openchannelinteraction:update'),controller[_0xcb40('0x17')]);router['delete'](_0xcb40('0x16'),auth[_0xcb40('0x8')](),interaction['tracked'](_0xcb40('0x12'),_0xcb40('0x18')),controller[_0xcb40('0x19')]);router['delete'](_0xcb40('0x1a'),auth['isAuthenticated'](),controller['removeTags']);module[_0xcb40('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index face4e0..e7c8230 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 _0xed8a=['out','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x3f993e,_0x2d5757){var _0x39c135=function(_0x39e00b){while(--_0x39e00b){_0x3f993e['push'](_0x3f993e['shift']());}};_0x39c135(++_0x2d5757);}(_0xed8a,0xc5));var _0xaed8=function(_0x41c1aa,_0x50f458){_0x41c1aa=_0x41c1aa-0x0;var _0x2dd136=_0xed8a[_0x41c1aa];return _0x2dd136;};'use strict';var Sequelize=require(_0xaed8('0x0'));module[_0xaed8('0x1')]={'closed':{'type':Sequelize[_0xaed8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xaed8('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xaed8('0x4')]},'thirdDisposition':{'type':Sequelize[_0xaed8('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xaed8('0x3')]},'threadId':{'type':Sequelize[_0xaed8('0x4')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xaed8('0x5')]('in',_0xaed8('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xaed8('0x5')]('in',_0xaed8('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xaed8('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xaed8('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x949d=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x2a55f8,_0x540ac4){var _0x245efd=function(_0x4dbc19){while(--_0x4dbc19){_0x2a55f8['push'](_0x2a55f8['shift']());}};_0x245efd(++_0x540ac4);}(_0x949d,0x162));var _0xd949=function(_0xad2086,_0x40a8ef){_0xad2086=_0xad2086-0x0;var _0x10b76b=_0x949d[_0xad2086];return _0x10b76b;};'use strict';var Sequelize=require(_0xd949('0x0'));module[_0xd949('0x1')]={'closed':{'type':Sequelize[_0xd949('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd949('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xd949('0x4')]},'note':{'type':Sequelize[_0xd949('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xd949('0x4')]},'externalUrl':{'type':Sequelize[_0xd949('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xd949('0x5')]('in',_0xd949('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xd949('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xd949('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xd949('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index b23c1a4..3b6df85 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 _0x2dff=['moment','util','path','lodash','../../components/parsers/qs','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','update','then','destroy','end','error','stack','name','index','map','rawAttributes','type','key','findAll','openchannel','query','user','catch','from','params','model','OpenchannelInteraction','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','create','body','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne','keys','hasOwnProperty','nolimit','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','omit','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','server','tmp','files','format','push','User','fullname','CmContact','firstName','lastName','attachments','Attachment','direction','secret','read','OpenchannelAccount','get','mkdirSync','Account','Owner','createdAt','closed','closedAt','threadId','Public','basename','existsSync','createReadStream','createWriteStream','System','Contact','out','value','renderFile','transcript-','Openchannel','createPdfFromHTML','unlinkSync','rimraf','zip-dir'];(function(_0x3207aa,_0xe86a72){var _0x51758f=function(_0x9ff790){while(--_0x9ff790){_0x3207aa['push'](_0x3207aa['shift']());}};_0x51758f(++_0xe86a72);}(_0x2dff,0x77));var _0xf2df=function(_0x30bc33,_0x4bc04c){_0x30bc33=_0x30bc33-0x0;var _0x1ee4cf=_0x2dff[_0x30bc33];return _0x1ee4cf;};'use strict';var rimraf=require(_0xf2df('0x0'));var zipdir=require(_0xf2df('0x1'));var moment=require(_0xf2df('0x2'));var util=require(_0xf2df('0x3'));var path=require(_0xf2df('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf2df('0x5'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0xf2df('0x6'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0xf2df('0x7'));var config=require(_0xf2df('0x8'));var db=require('../../mysqldb')['db'];config[_0xf2df('0x9')]=_[_0xf2df('0xa')](config[_0xf2df('0x9')],{'host':_0xf2df('0xb'),'port':0x18eb});var socket=require(_0xf2df('0xc'))(new Redis(config[_0xf2df('0x9')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0x3eb8d6,_0x1ed99b){_0x1ed99b=_0x1ed99b||0xcc;return function(_0x153852){if(_0x153852){return _0x3eb8d6[_0xf2df('0xd')](_0x1ed99b);}return _0x3eb8d6[_0xf2df('0xe')](_0x1ed99b)['end']();};}function respondWithResult(_0x4bf721,_0x9026ce){_0x9026ce=_0x9026ce||0xc8;return function(_0x35d8d9){if(_0x35d8d9){return _0x4bf721[_0xf2df('0xe')](_0x9026ce)[_0xf2df('0xf')](_0x35d8d9);}};}function respondWithFilteredResult(_0x510592,_0x47cdc7){return function(_0x57ddff){if(_0x57ddff){var _0x3a025d=typeof _0x47cdc7[_0xf2df('0x10')]===_0xf2df('0x11')&&typeof _0x47cdc7[_0xf2df('0x12')]===_0xf2df('0x11');var _0x4d10ad=_0x57ddff[_0xf2df('0x13')];var _0x5c5d9e=_0x3a025d?0x0:_0x47cdc7[_0xf2df('0x10')];var _0x3516ea=_0x3a025d?_0x57ddff[_0xf2df('0x13')]:_0x47cdc7['offset']+_0x47cdc7['limit'];var _0x28c601;if(_0x3516ea>=_0x4d10ad){_0x3516ea=_0x4d10ad;_0x28c601=0xc8;}else{_0x28c601=0xce;}_0x510592[_0xf2df('0xe')](_0x28c601);return _0x510592['set']('Content-Range',_0x5c5d9e+'-'+_0x3516ea+'/'+_0x4d10ad)[_0xf2df('0xf')](_0x57ddff);}return null;};}function saveUpdates(_0x55b264){return function(_0x1ce3cc){if(_0x1ce3cc){return _0x1ce3cc[_0xf2df('0x14')](_0x55b264)[_0xf2df('0x15')](function(_0x28f85b){return _0x28f85b;});}return null;};}function removeEntity(_0x422c4b){return function(_0x1b8780){if(_0x1b8780){return _0x1b8780[_0xf2df('0x16')]()[_0xf2df('0x15')](function(){_0x422c4b[_0xf2df('0xe')](0xcc)[_0xf2df('0x17')]();});}};}function handleEntityNotFound(_0x3e6947){return function(_0x5e4c53){if(!_0x5e4c53){_0x3e6947[_0xf2df('0xd')](0x194);}return _0x5e4c53;};}function handleError(_0x25e247,_0x5455f7){_0x5455f7=_0x5455f7||0x1f4;return function(_0x2db353){logger[_0xf2df('0x18')](_0x2db353[_0xf2df('0x19')]);if(_0x2db353[_0xf2df('0x1a')]){delete _0x2db353[_0xf2df('0x1a')];}_0x25e247['status'](_0x5455f7)['send'](_0x2db353);};}exports[_0xf2df('0x1b')]=function(_0x597a6,_0x3b0fb3){var _0x330613={};var _0x3b3e48=_[_0xf2df('0x1c')](db['OpenchannelInteraction'][_0xf2df('0x1d')],function(_0x5916ba){return{'name':_0x5916ba['fieldName'],'type':_0x5916ba[_0xf2df('0x1e')][_0xf2df('0x1f')]};});_0x330613=qs['getOptions'](_0x3b3e48,_0x597a6);return interaction[_0xf2df('0x20')](_0xf2df('0x21'),_0x597a6[_0xf2df('0x22')],_0x597a6[_0xf2df('0x23')],_0x330613,_0x3b3e48)[_0xf2df('0x15')](respondWithFilteredResult(_0x3b0fb3,_0x330613))[_0xf2df('0x24')](handleError(_0x3b0fb3,null));};exports['show']=function(_0x44f075,_0x59f077){var _0x2c9915={};if(_0x44f075[_0xf2df('0x22')][_0xf2df('0x1e')]&&_0x44f075['query'][_0xf2df('0x1e')]===_0xf2df('0x25')){_0x2c9915['from']=_0x44f075[_0xf2df('0x26')]['id'];}else{_0x2c9915['id']=_0x44f075[_0xf2df('0x26')]['id'];}var _0x4f0c5e={'raw':![],'where':_0x2c9915},_0x478a02={};_0x478a02[_0xf2df('0x27')]=_['keys'](db[_0xf2df('0x28')][_0xf2df('0x1d')]);_0x478a02[_0xf2df('0x22')]=_['keys'](_0x44f075['query']);_0x478a02[_0xf2df('0x29')]=_[_0xf2df('0x2a')](_0x478a02[_0xf2df('0x27')],_0x478a02[_0xf2df('0x22')]);_0x4f0c5e['attributes']=_[_0xf2df('0x2a')](_0x478a02[_0xf2df('0x27')],qs[_0xf2df('0x2b')](_0x44f075['query'][_0xf2df('0x2b')]));_0x4f0c5e['attributes']=_0x4f0c5e[_0xf2df('0x2c')][_0xf2df('0x2d')]?_0x4f0c5e[_0xf2df('0x2c')]:_0x478a02[_0xf2df('0x27')];if(_0x44f075[_0xf2df('0x22')][_0xf2df('0x2e')]){_0x4f0c5e[_0xf2df('0x2f')]=[{'all':!![]}];}_0x4f0c5e=_[_0xf2df('0x30')]({},_0x4f0c5e,_0x44f075[_0xf2df('0x31')]);return db[_0xf2df('0x28')][_0xf2df('0x32')](_0x4f0c5e)[_0xf2df('0x15')](handleEntityNotFound(_0x59f077,null))[_0xf2df('0x15')](respondWithResult(_0x59f077,null))[_0xf2df('0x24')](handleError(_0x59f077,null));};exports[_0xf2df('0x33')]=function(_0x4d4b3b,_0x408259){return db[_0xf2df('0x28')][_0xf2df('0x33')](_0x4d4b3b[_0xf2df('0x34')],{})[_0xf2df('0x15')](respondWithResult(_0x408259,0xc9))['catch'](handleError(_0x408259,null));};exports[_0xf2df('0x14')]=function(_0x2a3da8,_0x58a48e){if(_0x2a3da8[_0xf2df('0x34')]['id']){delete _0x2a3da8[_0xf2df('0x34')]['id'];}return db[_0xf2df('0x28')][_0xf2df('0x32')]({'where':{'id':_0x2a3da8[_0xf2df('0x26')]['id']}})['then'](handleEntityNotFound(_0x58a48e,null))[_0xf2df('0x15')](saveUpdates(_0x2a3da8[_0xf2df('0x34')],null))[_0xf2df('0x15')](respondWithResult(_0x58a48e,null))[_0xf2df('0x24')](handleError(_0x58a48e,null));};exports['destroy']=function(_0x3ef605,_0x12a3fb){return db[_0xf2df('0x28')]['find']({'where':{'id':_0x3ef605[_0xf2df('0x26')]['id']}})['then'](handleEntityNotFound(_0x12a3fb,null))[_0xf2df('0x15')](removeEntity(_0x12a3fb,null))['catch'](handleError(_0x12a3fb,null));};exports['describe']=function(_0x511197,_0x318b04){return db[_0xf2df('0x28')][_0xf2df('0x35')]()[_0xf2df('0x15')](respondWithResult(_0x318b04,null))[_0xf2df('0x24')](handleError(_0x318b04,null));};exports[_0xf2df('0x36')]=function(_0x139e42,_0x1eeb13){return db[_0xf2df('0x37')]['find']({'where':{'id':_0x139e42['params']['id']}})[_0xf2df('0x15')](handleEntityNotFound(_0x1eeb13,null))['then'](function(_0x5a689b){if(_0x5a689b){return _0x5a689b[_0xf2df('0x36')](_0x139e42[_0xf2df('0x34')][_0xf2df('0x38')],_['omit'](_0x139e42['body'],[_0xf2df('0x38'),'id'])||{});}})[_0xf2df('0x15')](respondWithResult(_0x1eeb13,null))[_0xf2df('0x24')](handleError(_0x1eeb13,null));};exports[_0xf2df('0x39')]=function(_0x4cbf04,_0x134442){var _0x3575f8={'raw':![],'where':{}};var _0x51f743={};var _0x474ece={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xf2df('0x3a')]({'where':{'id':_0x4cbf04[_0xf2df('0x26')]['id']}})[_0xf2df('0x15')](handleEntityNotFound(_0x134442,null))[_0xf2df('0x15')](function(_0x26e7dd){if(_0x26e7dd){_0x51f743[_0xf2df('0x27')]=_[_0xf2df('0x3b')](db[_0xf2df('0x37')][_0xf2df('0x1d')]);_0x51f743['query']=_[_0xf2df('0x3b')](_0x4cbf04[_0xf2df('0x22')]);_0x51f743[_0xf2df('0x29')]=_[_0xf2df('0x2a')](_0x51f743[_0xf2df('0x27')],_0x51f743[_0xf2df('0x22')]);_0x3575f8[_0xf2df('0x2c')]=_[_0xf2df('0x2a')](_0x51f743[_0xf2df('0x27')],qs[_0xf2df('0x2b')](_0x4cbf04[_0xf2df('0x22')]['fields']));_0x3575f8['attributes']=_0x3575f8[_0xf2df('0x2c')][_0xf2df('0x2d')]?_0x3575f8[_0xf2df('0x2c')]:_0x51f743[_0xf2df('0x27')];if(!_0x4cbf04[_0xf2df('0x22')][_0xf2df('0x3c')](_0xf2df('0x3d'))){_0x3575f8['limit']=qs[_0xf2df('0x12')](_0x4cbf04['query'][_0xf2df('0x12')]);_0x3575f8[_0xf2df('0x10')]=qs['offset'](_0x4cbf04[_0xf2df('0x22')][_0xf2df('0x10')]);}_0x3575f8['order']=qs[_0xf2df('0x3e')](_0x4cbf04[_0xf2df('0x22')]['sort']);_0x3575f8[_0xf2df('0x3f')]=qs[_0xf2df('0x29')](_[_0xf2df('0x40')](_0x4cbf04[_0xf2df('0x22')],_0x51f743['filters']));_0x3575f8[_0xf2df('0x3f')][_0xf2df('0x41')]=_0x26e7dd['id'];if(_0x4cbf04[_0xf2df('0x22')]['filter']){_0x3575f8[_0xf2df('0x3f')]=_[_0xf2df('0x30')](_0x3575f8[_0xf2df('0x3f')],{'$or':_[_0xf2df('0x1c')](_0x3575f8[_0xf2df('0x2c')],function(_0x22e060){var _0xc76f19={};_0xc76f19[_0x22e060]={'$like':'%'+_0x4cbf04['query'][_0xf2df('0x42')]+'%'};return _0xc76f19;})});}if(_0x4cbf04[_0xf2df('0x22')][_0xf2df('0x43')]){var _0x54881b=_0x4cbf04['query'][_0xf2df('0x43')][_0xf2df('0x44')](',');var _0x5099c8={};_0x5099c8[_0x54881b[0x0]]={'$gte':moment(_0x54881b[0x1])['format'](_0xf2df('0x45'))};_0x3575f8['where']=_['merge'](_0x3575f8[_0xf2df('0x3f')],_0x5099c8);}_0x3575f8=_['merge']({},_0x3575f8,_0x4cbf04[_0xf2df('0x31')]);return db[_0xf2df('0x37')][_0xf2df('0x13')]({'where':_0x3575f8[_0xf2df('0x3f')]})[_0xf2df('0x15')](function(_0x485fdb){_0x474ece[_0xf2df('0x13')]=_0x485fdb;if(_0x4cbf04[_0xf2df('0x22')]['includeAll']){_0x3575f8[_0xf2df('0x2f')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x3575f8);})[_0xf2df('0x15')](function(_0x362425){_0x474ece[_0xf2df('0x46')]=_0x362425;return _0x474ece;});}})[_0xf2df('0x15')](respondWithFilteredResult(_0x134442,_0x3575f8))['catch'](handleError(_0x134442,null));};exports['addTags']=function(_0x306415,_0x5c4968){return db['OpenchannelInteraction'][_0xf2df('0x32')]({'where':{'id':_0x306415[_0xf2df('0x26')]['id']}})['then'](handleEntityNotFound(_0x5c4968,null))['then'](function(_0x135b90){if(_0x135b90){return _0x135b90['setTags'](_0x306415['body'][_0xf2df('0x38')],_[_0xf2df('0x47')](_0x306415[_0xf2df('0x34')],[_0xf2df('0x38'),'id'])||{})[_0xf2df('0x48')](function(){return db[_0xf2df('0x49')][_0xf2df('0x20')]({'attributes':['id',_0xf2df('0x1a'),_0xf2df('0x4a')],'where':{'id':_0x306415['body'][_0xf2df('0x38')]}});})[_0xf2df('0x15')](function(_0x3d1b2b){socket[_0xf2df('0x4b')](_0xf2df('0x4c'),{'id':Number(_0x306415[_0xf2df('0x26')]['id']),'tags':_0x3d1b2b||[]});return{'id':Number(_0x306415[_0xf2df('0x26')]['id']),'tags':_0x3d1b2b||[]};});}})[_0xf2df('0x15')](respondWithResult(_0x5c4968,null))[_0xf2df('0x24')](handleError(_0x5c4968,null));};exports[_0xf2df('0x4d')]=function(_0x553463,_0x4a0b12){return db[_0xf2df('0x28')][_0xf2df('0x32')]({'where':{'id':_0x553463[_0xf2df('0x26')]['id']}})[_0xf2df('0x15')](handleEntityNotFound(_0x4a0b12,null))[_0xf2df('0x15')](function(_0x3e5dbf){if(_0x3e5dbf){return _0x3e5dbf[_0xf2df('0x4d')](_0x553463['query'][_0xf2df('0x38')]);}})[_0xf2df('0x15')](respondWithStatusCode(_0x4a0b12,null))[_0xf2df('0x24')](handleError(_0x4a0b12,null));};exports[_0xf2df('0x4e')]=function(_0x213723,_0x3bf4b2){var _0x5f2240=moment()[_0xf2df('0x4f')]()[_0xf2df('0x50')]();var _0x65a910=path[_0xf2df('0x51')](config[_0xf2df('0x52')],_0xf2df('0x53'),'files',_0xf2df('0x54'));var _0x520dc1=path[_0xf2df('0x51')](config[_0xf2df('0x52')],_0xf2df('0x53'),_0xf2df('0x55'),'attachments');var _0x159c7b=path[_0xf2df('0x51')](_0x65a910,_0x5f2240);var _0xee57fb=util[_0xf2df('0x56')]('transcript-%d-%s.zip',_0x213723['params']['id'],_0x5f2240);var _0x5603bd=path[_0xf2df('0x51')](_0x65a910,_0xee57fb);var _0x48bae5=[];_0x48bae5[_0xf2df('0x57')]({'model':db[_0xf2df('0x58')],'as':_0xf2df('0x58'),'attributes':['id',_0xf2df('0x59')],'raw':!![]});_0x48bae5[_0xf2df('0x57')]({'model':db[_0xf2df('0x5a')],'as':'Contact','attributes':['id',_0xf2df('0x5b'),_0xf2df('0x5c')],'raw':!![]});if(_0x213723[_0xf2df('0x22')][_0xf2df('0x5d')]){_0x48bae5[_0xf2df('0x57')]({'model':db[_0xf2df('0x5e')],'as':_0xf2df('0x5e'),'raw':!![]});}var _0xb9ca8d=[{'model':db[_0xf2df('0x37')],'as':'Messages','attributes':['id',_0xf2df('0x34'),'createdAt',_0xf2df('0x5f'),_0xf2df('0x60'),_0xf2df('0x61')],'include':_0x48bae5}];_0xb9ca8d[_0xf2df('0x57')]({'model':db[_0xf2df('0x62')],'as':'Account','attributes':['id',_0xf2df('0x1a')]});_0xb9ca8d['push']({'model':db[_0xf2df('0x58')],'as':'Owner','attributes':['id',_0xf2df('0x59')]});return db['OpenchannelInteraction'][_0xf2df('0x32')]({'where':{'id':_0x213723['params']['id']},'include':_0xb9ca8d})[_0xf2df('0x15')](handleEntityNotFound(_0x3bf4b2,null))[_0xf2df('0x15')](function(_0x588f21){if(_0x588f21){var _0x50e892=_0x588f21[_0xf2df('0x63')]({'plain':!![]});fs[_0xf2df('0x64')](_0x159c7b);var _0x429e43={'channel':'Openchannel','account':_0x50e892[_0xf2df('0x65')]['name'],'agent':_0x50e892[_0xf2df('0x66')]?_0x50e892[_0xf2df('0x66')][_0xf2df('0x59')]:'N.A.','createdAt':moment(_0x50e892[_0xf2df('0x67')])[_0xf2df('0x56')](_0xf2df('0x45'))[_0xf2df('0x50')](),'closedAt':_0x50e892[_0xf2df('0x68')]?moment(_0x50e892[_0xf2df('0x69')])[_0xf2df('0x56')](_0xf2df('0x45'))[_0xf2df('0x50')]():'','disposition':_0x50e892['disposition'],'visibility':_0x50e892[_0xf2df('0x6a')]?_0xf2df('0x6b'):'Private','messages':_(_0x50e892['Messages'])[_0xf2df('0x42')]({'secret':![]})[_0xf2df('0x1c')](function(_0x4aab55){if(_0x4aab55[_0xf2df('0x5e')]){var _0x45d005=path[_0xf2df('0x51')](_0x520dc1,_0x4aab55[_0xf2df('0x5e')][_0xf2df('0x6c')]);if(fs[_0xf2df('0x6d')](_0x45d005)){fs[_0xf2df('0x6e')](_0x45d005)['pipe'](fs[_0xf2df('0x6f')](path[_0xf2df('0x51')](_0x159c7b,_0x4aab55[_0xf2df('0x5e')][_0xf2df('0x6c')])));}}return{'date':moment(_0x4aab55[_0xf2df('0x67')])['format'](_0xf2df('0x45'))[_0xf2df('0x50')](),'sender':_0x4aab55['direction']==='out'?_0x4aab55[_0xf2df('0x58')]?_0x4aab55[_0xf2df('0x58')][_0xf2df('0x59')]:_0xf2df('0x70'):_0x4aab55[_0xf2df('0x71')]['firstName']+(_0x4aab55[_0xf2df('0x71')][_0xf2df('0x5c')]?'\x20'+_0x4aab55[_0xf2df('0x71')][_0xf2df('0x5c')]:''),'body':_0x4aab55['Attachment']?_0x4aab55[_0xf2df('0x5e')][_0xf2df('0x6c')]:_0x4aab55['body'],'direction':_0x4aab55[_0xf2df('0x5f')]===_0xf2df('0x72')?'A':'C','secret':_0x4aab55[_0xf2df('0x60')],'read':_0x4aab55[_0xf2df('0x61')],'attachment':_0x4aab55[_0xf2df('0x5e')]};})[_0xf2df('0x73')]()};return ejs[_0xf2df('0x74')](path['join'](config[_0xf2df('0x52')],_0xf2df('0x53'),'views','downloadInteraction.ejs'),{'interaction':_0x429e43})[_0xf2df('0x15')](function(_0x2e2288){var _0xf5a7ad=path['join'](_0x159c7b,_0xf2df('0x75')+_0x50e892['id']+'-'+_0x5f2240+'.pdf');var _0x348e0c={'path':_0xf5a7ad,'channel':_0xf2df('0x76'),'interactionId':_0x50e892['id']};return pdf[_0xf2df('0x77')](_0x2e2288,_0x348e0c);})[_0xf2df('0x15')](function(){return new Promise(function(_0x1d0007,_0x19bf18){zipdir(_0x159c7b,{'saveTo':_0x5603bd},function(_0x4b6200,_0x4d8ff1){if(_0x4b6200)return _0x19bf18(_0x4b6200);return _0x1d0007(_0x4d8ff1);});})[_0xf2df('0x15')](function(){return new Promise(function(_0xd2dcd,_0x4af641){rimraf(_0x159c7b,function(_0x1ea946){if(_0x1ea946)_0x4af641(_0x1ea946);return _0xd2dcd();});});})[_0xf2df('0x15')](function(){return _0x3bf4b2[_0xf2df('0x4e')](_0x5603bd,_0xee57fb,function(_0x10b6fa){if(_0x10b6fa){logger[_0xf2df('0x18')]('Unable\x20to\x20delete\x20zip\x20file',_0x10b6fa);}else{fs[_0xf2df('0x78')](_0x5603bd);}});});});}else{return _0x3bf4b2[_0xf2df('0xd')](0xc8);}})[_0xf2df('0x24')](handleError(_0x3bf4b2,null));}; \ No newline at end of file +var _0xc87a=['include','merge','options','find','catch','create','body','destroy','describe','addMessage','OpenchannelMessage','omit','ids','getMessages','findOne','hasOwnProperty','nolimit','sort','where','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','Account','Owner','fullname','N.A.','closed','closedAt','threadId','Public','Private','basename','createReadStream','createWriteStream','out','System','read','value','renderFile','views','transcript-','.pdf','Openchannel','error','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','update','then','stack','name','map','OpenchannelInteraction','rawAttributes','type','key','getOptions','findAll','openchannel','user','show','query','from','params','model','keys','filters','intersection','attributes','fields','length'];(function(_0x56daff,_0xadca9a){var _0x132c82=function(_0x19e0d7){while(--_0x19e0d7){_0x56daff['push'](_0x56daff['shift']());}};_0x132c82(++_0xadca9a);}(_0xc87a,0xcd));var _0xac87=function(_0x533883,_0x438734){_0x533883=_0x533883-0x0;var _0x4108f5=_0xc87a[_0x533883];return _0x4108f5;};'use strict';var rimraf=require(_0xac87('0x0'));var zipdir=require(_0xac87('0x1'));var moment=require(_0xac87('0x2'));var util=require(_0xac87('0x3'));var path=require(_0xac87('0x4'));var ejs=require(_0xac87('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0xac87('0x6'));var qs=require(_0xac87('0x7'));var pdf=require(_0xac87('0x8'));var logger=require(_0xac87('0x9'))(_0xac87('0xa'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xac87('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xac87('0xc'))(new Redis(config['redis']));require(_0xac87('0xd'))[_0xac87('0xe')](socket);function respondWithStatusCode(_0x3335b5,_0x456b1d){_0x456b1d=_0x456b1d||0xcc;return function(_0x2eba40){if(_0x2eba40){return _0x3335b5[_0xac87('0xf')](_0x456b1d);}return _0x3335b5[_0xac87('0x10')](_0x456b1d)[_0xac87('0x11')]();};}function respondWithResult(_0x4b8f65,_0x5950a3){_0x5950a3=_0x5950a3||0xc8;return function(_0x296c29){if(_0x296c29){return _0x4b8f65[_0xac87('0x10')](_0x5950a3)[_0xac87('0x12')](_0x296c29);}};}function respondWithFilteredResult(_0x17d052,_0x8693c8){return function(_0x1565e1){if(_0x1565e1){var _0x2fada3=typeof _0x8693c8['offset']==='undefined'&&typeof _0x8693c8['limit']===_0xac87('0x13');var _0x153499=_0x1565e1[_0xac87('0x14')];var _0x3f2c1d=_0x2fada3?0x0:_0x8693c8[_0xac87('0x15')];var _0x803ec0=_0x2fada3?_0x1565e1[_0xac87('0x14')]:_0x8693c8[_0xac87('0x15')]+_0x8693c8[_0xac87('0x16')];var _0x4bbb43;if(_0x803ec0>=_0x153499){_0x803ec0=_0x153499;_0x4bbb43=0xc8;}else{_0x4bbb43=0xce;}_0x17d052['status'](_0x4bbb43);return _0x17d052[_0xac87('0x17')](_0xac87('0x18'),_0x3f2c1d+'-'+_0x803ec0+'/'+_0x153499)[_0xac87('0x12')](_0x1565e1);}return null;};}function saveUpdates(_0x2b3557){return function(_0x5c0cde){if(_0x5c0cde){return _0x5c0cde[_0xac87('0x19')](_0x2b3557)[_0xac87('0x1a')](function(_0x485686){return _0x485686;});}return null;};}function removeEntity(_0x2ccef1){return function(_0x2fb2be){if(_0x2fb2be){return _0x2fb2be['destroy']()[_0xac87('0x1a')](function(){_0x2ccef1[_0xac87('0x10')](0xcc)[_0xac87('0x11')]();});}};}function handleEntityNotFound(_0x357c7d){return function(_0x550c96){if(!_0x550c96){_0x357c7d[_0xac87('0xf')](0x194);}return _0x550c96;};}function handleError(_0x2eb8c0,_0x36934f){_0x36934f=_0x36934f||0x1f4;return function(_0x24cf35){logger['error'](_0x24cf35[_0xac87('0x1b')]);if(_0x24cf35[_0xac87('0x1c')]){delete _0x24cf35[_0xac87('0x1c')];}_0x2eb8c0[_0xac87('0x10')](_0x36934f)['send'](_0x24cf35);};}exports['index']=function(_0x4c7075,_0x4a3d21){var _0x581bd9={};var _0x50e740=_[_0xac87('0x1d')](db[_0xac87('0x1e')][_0xac87('0x1f')],function(_0x2aae9e){return{'name':_0x2aae9e['fieldName'],'type':_0x2aae9e[_0xac87('0x20')][_0xac87('0x21')]};});_0x581bd9=qs[_0xac87('0x22')](_0x50e740,_0x4c7075);return interaction[_0xac87('0x23')](_0xac87('0x24'),_0x4c7075['query'],_0x4c7075[_0xac87('0x25')],_0x581bd9,_0x50e740)[_0xac87('0x1a')](respondWithFilteredResult(_0x4a3d21,_0x581bd9))['catch'](handleError(_0x4a3d21,null));};exports[_0xac87('0x26')]=function(_0x412ddc,_0x31c694){var _0x324b48={};if(_0x412ddc[_0xac87('0x27')][_0xac87('0x20')]&&_0x412ddc[_0xac87('0x27')]['type']==='from'){_0x324b48[_0xac87('0x28')]=_0x412ddc[_0xac87('0x29')]['id'];}else{_0x324b48['id']=_0x412ddc[_0xac87('0x29')]['id'];}var _0x115c9f={'raw':![],'where':_0x324b48},_0x192e47={};_0x192e47[_0xac87('0x2a')]=_['keys'](db[_0xac87('0x1e')][_0xac87('0x1f')]);_0x192e47['query']=_[_0xac87('0x2b')](_0x412ddc[_0xac87('0x27')]);_0x192e47[_0xac87('0x2c')]=_[_0xac87('0x2d')](_0x192e47['model'],_0x192e47[_0xac87('0x27')]);_0x115c9f[_0xac87('0x2e')]=_['intersection'](_0x192e47[_0xac87('0x2a')],qs[_0xac87('0x2f')](_0x412ddc[_0xac87('0x27')][_0xac87('0x2f')]));_0x115c9f[_0xac87('0x2e')]=_0x115c9f[_0xac87('0x2e')][_0xac87('0x30')]?_0x115c9f[_0xac87('0x2e')]:_0x192e47[_0xac87('0x2a')];if(_0x412ddc[_0xac87('0x27')]['includeAll']){_0x115c9f[_0xac87('0x31')]=[{'all':!![]}];}_0x115c9f=_[_0xac87('0x32')]({},_0x115c9f,_0x412ddc[_0xac87('0x33')]);return db[_0xac87('0x1e')][_0xac87('0x34')](_0x115c9f)['then'](handleEntityNotFound(_0x31c694,null))['then'](respondWithResult(_0x31c694,null))[_0xac87('0x35')](handleError(_0x31c694,null));};exports[_0xac87('0x36')]=function(_0x904137,_0x1701c6){return db[_0xac87('0x1e')]['create'](_0x904137[_0xac87('0x37')],{})[_0xac87('0x1a')](respondWithResult(_0x1701c6,0xc9))[_0xac87('0x35')](handleError(_0x1701c6,null));};exports[_0xac87('0x19')]=function(_0xfb73c2,_0x528e89){if(_0xfb73c2[_0xac87('0x37')]['id']){delete _0xfb73c2['body']['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0xfb73c2[_0xac87('0x29')]['id']}})[_0xac87('0x1a')](handleEntityNotFound(_0x528e89,null))[_0xac87('0x1a')](saveUpdates(_0xfb73c2[_0xac87('0x37')],null))[_0xac87('0x1a')](respondWithResult(_0x528e89,null))[_0xac87('0x35')](handleError(_0x528e89,null));};exports[_0xac87('0x38')]=function(_0xc7f507,_0x9d41ba){return db[_0xac87('0x1e')][_0xac87('0x34')]({'where':{'id':_0xc7f507[_0xac87('0x29')]['id']}})['then'](handleEntityNotFound(_0x9d41ba,null))['then'](removeEntity(_0x9d41ba,null))[_0xac87('0x35')](handleError(_0x9d41ba,null));};exports[_0xac87('0x39')]=function(_0xe1df8d,_0x303817){return db[_0xac87('0x1e')][_0xac87('0x39')]()[_0xac87('0x1a')](respondWithResult(_0x303817,null))[_0xac87('0x35')](handleError(_0x303817,null));};exports[_0xac87('0x3a')]=function(_0x21f949,_0x33ae94){return db[_0xac87('0x3b')][_0xac87('0x34')]({'where':{'id':_0x21f949['params']['id']}})[_0xac87('0x1a')](handleEntityNotFound(_0x33ae94,null))[_0xac87('0x1a')](function(_0x3cd9fe){if(_0x3cd9fe){return _0x3cd9fe[_0xac87('0x3a')](_0x21f949['body']['ids'],_[_0xac87('0x3c')](_0x21f949[_0xac87('0x37')],[_0xac87('0x3d'),'id'])||{});}})['then'](respondWithResult(_0x33ae94,null))['catch'](handleError(_0x33ae94,null));};exports[_0xac87('0x3e')]=function(_0x431bad,_0x1454d5){var _0x14b0f4={'raw':![],'where':{}};var _0x3ff019={};var _0x21c1ba={'count':0x0,'rows':[]};return db[_0xac87('0x1e')][_0xac87('0x3f')]({'where':{'id':_0x431bad['params']['id']}})['then'](handleEntityNotFound(_0x1454d5,null))[_0xac87('0x1a')](function(_0x505fab){if(_0x505fab){_0x3ff019[_0xac87('0x2a')]=_['keys'](db[_0xac87('0x3b')][_0xac87('0x1f')]);_0x3ff019[_0xac87('0x27')]=_[_0xac87('0x2b')](_0x431bad[_0xac87('0x27')]);_0x3ff019['filters']=_[_0xac87('0x2d')](_0x3ff019[_0xac87('0x2a')],_0x3ff019['query']);_0x14b0f4['attributes']=_[_0xac87('0x2d')](_0x3ff019[_0xac87('0x2a')],qs[_0xac87('0x2f')](_0x431bad[_0xac87('0x27')][_0xac87('0x2f')]));_0x14b0f4[_0xac87('0x2e')]=_0x14b0f4[_0xac87('0x2e')][_0xac87('0x30')]?_0x14b0f4['attributes']:_0x3ff019['model'];if(!_0x431bad[_0xac87('0x27')][_0xac87('0x40')](_0xac87('0x41'))){_0x14b0f4[_0xac87('0x16')]=qs[_0xac87('0x16')](_0x431bad[_0xac87('0x27')][_0xac87('0x16')]);_0x14b0f4[_0xac87('0x15')]=qs[_0xac87('0x15')](_0x431bad['query'][_0xac87('0x15')]);}_0x14b0f4['order']=qs[_0xac87('0x42')](_0x431bad[_0xac87('0x27')][_0xac87('0x42')]);_0x14b0f4['where']=qs[_0xac87('0x2c')](_['pick'](_0x431bad[_0xac87('0x27')],_0x3ff019['filters']));_0x14b0f4[_0xac87('0x43')][_0xac87('0x44')]=_0x505fab['id'];if(_0x431bad[_0xac87('0x27')][_0xac87('0x45')]){_0x14b0f4[_0xac87('0x43')]=_[_0xac87('0x32')](_0x14b0f4['where'],{'$or':_[_0xac87('0x1d')](_0x14b0f4[_0xac87('0x2e')],function(_0x16f428){var _0x6cec62={};_0x6cec62[_0x16f428]={'$like':'%'+_0x431bad[_0xac87('0x27')][_0xac87('0x45')]+'%'};return _0x6cec62;})});}if(_0x431bad[_0xac87('0x27')]['$gte']){var _0x3356a1=_0x431bad[_0xac87('0x27')][_0xac87('0x46')][_0xac87('0x47')](',');var _0x425612={};_0x425612[_0x3356a1[0x0]]={'$gte':moment(_0x3356a1[0x1])[_0xac87('0x48')](_0xac87('0x49'))};_0x14b0f4[_0xac87('0x43')]=_[_0xac87('0x32')](_0x14b0f4[_0xac87('0x43')],_0x425612);}_0x14b0f4=_[_0xac87('0x32')]({},_0x14b0f4,_0x431bad['options']);return db[_0xac87('0x3b')][_0xac87('0x14')]({'where':_0x14b0f4['where']})['then'](function(_0x1fdc63){_0x21c1ba[_0xac87('0x14')]=_0x1fdc63;if(_0x431bad[_0xac87('0x27')][_0xac87('0x4a')]){_0x14b0f4[_0xac87('0x31')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xac87('0x23')](_0x14b0f4);})[_0xac87('0x1a')](function(_0x404fc5){_0x21c1ba[_0xac87('0x4b')]=_0x404fc5;return _0x21c1ba;});}})[_0xac87('0x1a')](respondWithFilteredResult(_0x1454d5,_0x14b0f4))[_0xac87('0x35')](handleError(_0x1454d5,null));};exports[_0xac87('0x4c')]=function(_0x13a125,_0x406af6){return db[_0xac87('0x1e')][_0xac87('0x34')]({'where':{'id':_0x13a125['params']['id']}})[_0xac87('0x1a')](handleEntityNotFound(_0x406af6,null))[_0xac87('0x1a')](function(_0x1abd17){if(_0x1abd17){return _0x1abd17['setTags'](_0x13a125[_0xac87('0x37')][_0xac87('0x3d')],_[_0xac87('0x3c')](_0x13a125[_0xac87('0x37')],[_0xac87('0x3d'),'id'])||{})[_0xac87('0x4d')](function(){return db[_0xac87('0x4e')][_0xac87('0x23')]({'attributes':['id',_0xac87('0x1c'),_0xac87('0x4f')],'where':{'id':_0x13a125[_0xac87('0x37')]['ids']}});})[_0xac87('0x1a')](function(_0x213874){socket[_0xac87('0x50')](_0xac87('0x51'),{'id':Number(_0x13a125['params']['id']),'tags':_0x213874||[]});return{'id':Number(_0x13a125[_0xac87('0x29')]['id']),'tags':_0x213874||[]};});}})[_0xac87('0x1a')](respondWithResult(_0x406af6,null))[_0xac87('0x35')](handleError(_0x406af6,null));};exports[_0xac87('0x52')]=function(_0x12dc98,_0x4e6a3d){return db['OpenchannelInteraction'][_0xac87('0x34')]({'where':{'id':_0x12dc98[_0xac87('0x29')]['id']}})[_0xac87('0x1a')](handleEntityNotFound(_0x4e6a3d,null))['then'](function(_0x59f9f7){if(_0x59f9f7){return _0x59f9f7['removeTags'](_0x12dc98[_0xac87('0x27')][_0xac87('0x3d')]);}})[_0xac87('0x1a')](respondWithStatusCode(_0x4e6a3d,null))[_0xac87('0x35')](handleError(_0x4e6a3d,null));};exports[_0xac87('0x53')]=function(_0x5f1de3,_0x40e661){var _0x459d6a=moment()[_0xac87('0x54')]()[_0xac87('0x55')]();var _0x2cf1ec=path[_0xac87('0x56')](config[_0xac87('0x57')],_0xac87('0x58'),_0xac87('0x59'),_0xac87('0x5a'));var _0x528c9e=path['join'](config[_0xac87('0x57')],_0xac87('0x58'),'files',_0xac87('0x5b'));var _0x24c859=path['join'](_0x2cf1ec,_0x459d6a);var _0x145d6f=util[_0xac87('0x48')](_0xac87('0x5c'),_0x5f1de3[_0xac87('0x29')]['id'],_0x459d6a);var _0x2ffa50=path[_0xac87('0x56')](_0x2cf1ec,_0x145d6f);var _0x156d8f=[];_0x156d8f[_0xac87('0x5d')]({'model':db[_0xac87('0x5e')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x156d8f[_0xac87('0x5d')]({'model':db[_0xac87('0x5f')],'as':_0xac87('0x60'),'attributes':['id',_0xac87('0x61'),_0xac87('0x62')],'raw':!![]});if(_0x5f1de3['query'][_0xac87('0x5b')]){_0x156d8f[_0xac87('0x5d')]({'model':db['Attachment'],'as':_0xac87('0x63'),'raw':!![]});}var _0x573163=[{'model':db[_0xac87('0x3b')],'as':_0xac87('0x64'),'attributes':['id',_0xac87('0x37'),_0xac87('0x65'),_0xac87('0x66'),_0xac87('0x67'),'read'],'include':_0x156d8f}];_0x573163[_0xac87('0x5d')]({'model':db['OpenchannelAccount'],'as':_0xac87('0x68'),'attributes':['id',_0xac87('0x1c')]});_0x573163[_0xac87('0x5d')]({'model':db['User'],'as':_0xac87('0x69'),'attributes':['id',_0xac87('0x6a')]});return db['OpenchannelInteraction'][_0xac87('0x34')]({'where':{'id':_0x5f1de3[_0xac87('0x29')]['id']},'include':_0x573163})[_0xac87('0x1a')](handleEntityNotFound(_0x40e661,null))['then'](function(_0x1be252){if(_0x1be252){var _0x56038a=_0x1be252['get']({'plain':!![]});fs['mkdirSync'](_0x24c859);var _0x12c47f={'channel':'Openchannel','account':_0x56038a[_0xac87('0x68')][_0xac87('0x1c')],'agent':_0x56038a['Owner']?_0x56038a[_0xac87('0x69')][_0xac87('0x6a')]:_0xac87('0x6b'),'createdAt':moment(_0x56038a[_0xac87('0x65')])['format'](_0xac87('0x49'))[_0xac87('0x55')](),'closedAt':_0x56038a[_0xac87('0x6c')]?moment(_0x56038a[_0xac87('0x6d')])['format'](_0xac87('0x49'))['toString']():'','disposition':_0x56038a['disposition'],'visibility':_0x56038a[_0xac87('0x6e')]?_0xac87('0x6f'):_0xac87('0x70'),'messages':_(_0x56038a[_0xac87('0x64')])[_0xac87('0x45')]({'secret':![]})[_0xac87('0x1d')](function(_0x20af67){if(_0x20af67[_0xac87('0x63')]){var _0x2e0239=path[_0xac87('0x56')](_0x528c9e,_0x20af67[_0xac87('0x63')][_0xac87('0x71')]);if(fs['existsSync'](_0x2e0239)){fs[_0xac87('0x72')](_0x2e0239)['pipe'](fs[_0xac87('0x73')](path['join'](_0x24c859,_0x20af67[_0xac87('0x63')][_0xac87('0x71')])));}}return{'date':moment(_0x20af67[_0xac87('0x65')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x20af67[_0xac87('0x66')]===_0xac87('0x74')?_0x20af67['User']?_0x20af67[_0xac87('0x5e')][_0xac87('0x6a')]:_0xac87('0x75'):_0x20af67['Contact']['firstName']+(_0x20af67['Contact'][_0xac87('0x62')]?'\x20'+_0x20af67[_0xac87('0x60')][_0xac87('0x62')]:''),'body':_0x20af67[_0xac87('0x63')]?_0x20af67[_0xac87('0x63')]['basename']:_0x20af67[_0xac87('0x37')],'direction':_0x20af67['direction']===_0xac87('0x74')?'A':'C','secret':_0x20af67[_0xac87('0x67')],'read':_0x20af67[_0xac87('0x76')],'attachment':_0x20af67['Attachment']};})[_0xac87('0x77')]()};return ejs[_0xac87('0x78')](path['join'](config[_0xac87('0x57')],_0xac87('0x58'),_0xac87('0x79'),'downloadInteraction.ejs'),{'interaction':_0x12c47f})[_0xac87('0x1a')](function(_0x2667cd){var _0x31df8f=path[_0xac87('0x56')](_0x24c859,_0xac87('0x7a')+_0x56038a['id']+'-'+_0x459d6a+_0xac87('0x7b'));var _0x1277aa={'path':_0x31df8f,'channel':_0xac87('0x7c'),'interactionId':_0x56038a['id']};return pdf['createPdfFromHTML'](_0x2667cd,_0x1277aa);})['then'](function(){return new Promise(function(_0x8f6c62,_0x509351){zipdir(_0x24c859,{'saveTo':_0x2ffa50},function(_0x3c6a28,_0x2799d7){if(_0x3c6a28)return _0x509351(_0x3c6a28);return _0x8f6c62(_0x2799d7);});})[_0xac87('0x1a')](function(){return new Promise(function(_0x48d30a,_0x2d4c65){rimraf(_0x24c859,function(_0x1e3624){if(_0x1e3624)_0x2d4c65(_0x1e3624);return _0x48d30a();});});})[_0xac87('0x1a')](function(){return _0x40e661[_0xac87('0x53')](_0x2ffa50,_0x145d6f,function(_0x159ec2){if(_0x159ec2){logger[_0xac87('0x7d')]('Unable\x20to\x20delete\x20zip\x20file',_0x159ec2);}else{fs[_0xac87('0x7e')](_0x2ffa50);}});});});}else{return _0x40e661['sendStatus'](0xc8);}})[_0xac87('0x35')](handleError(_0x40e661,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 2404b4d..865ac25 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 _0x0684=['getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x293067,_0x15c85c){var _0x3ab198=function(_0x3f52c8){while(--_0x3f52c8){_0x293067['push'](_0x293067['shift']());}};_0x3ab198(++_0x15c85c);}(_0x0684,0xbc));var _0x4068=function(_0x473b9d,_0x471734){_0x473b9d=_0x473b9d-0x0;var _0x37a0fe=_0x0684[_0x473b9d];return _0x37a0fe;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x4068('0x0'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x4068('0x0'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4068('0x1')](0x0);var events={'afterCreate':_0x4068('0x2'),'afterUpdate':_0x4068('0x3'),'afterDestroy':'remove'};function emitEvent(_0x238447){return function(_0xf2ec0f,_0x28d3f0,_0x2429d3){_0xf2ec0f[_0x4068('0x4')]({'attributes':['id'],'raw':!![]})[_0x4068('0x5')](function(_0x1fb0b8){_0xf2ec0f[_0x4068('0x6')]('Users',_0x1fb0b8[_0x4068('0x7')](function(_0x493487){return{'id':_0x493487['id']};}));return OpenchannelMessage[_0x4068('0x8')]({'where':{'OpenchannelInteractionId':_0xf2ec0f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4068('0x5')](function(_0x156b8b){_0xf2ec0f[_0x4068('0x6')](_0x4068('0x9'),_0x156b8b[_0x4068('0xa')]);OpenchannelInteractionEvents[_0x4068('0xb')](_0x238447+':'+_0xf2ec0f['id'],_0xf2ec0f);OpenchannelInteractionEvents[_0x4068('0xb')](_0x238447,_0xf2ec0f);_0x2429d3(null);})[_0x4068('0xc')](_0x2429d3(null));};}for(var e in events){if(events[_0x4068('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x4068('0xe')](e,emitEvent(event));}}module[_0x4068('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x857c=['remove','getUsers','then','Users','emit','catch','hasOwnProperty','hook','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','update'];(function(_0x1f6702,_0x48787c){var _0x9a7d50=function(_0x579480){while(--_0x579480){_0x1f6702['push'](_0x1f6702['shift']());}};_0x9a7d50(++_0x48787c);}(_0x857c,0x19b));var _0xc857=function(_0x453a81,_0xa594c1){_0x453a81=_0x453a81-0x0;var _0x4812e6=_0x857c[_0x453a81];return _0x4812e6;};'use strict';var EventEmitter=require(_0xc857('0x0'));var OpenchannelInteraction=require(_0xc857('0x1'))['db'][_0xc857('0x2')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xc857('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc857('0x4'),'afterDestroy':_0xc857('0x5')};function emitEvent(_0x594578){return function(_0x3d67d7,_0x55a7bb,_0x1bb43d){_0x3d67d7[_0xc857('0x6')]({'attributes':['id'],'raw':!![]})[_0xc857('0x7')](function(_0x310449){_0x3d67d7['setDataValue'](_0xc857('0x8'),_0x310449['map'](function(_0x99d091){return{'id':_0x99d091['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x3d67d7['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc857('0x7')](function(_0x2a0b62){_0x3d67d7['setDataValue']('unreadMessages',_0x2a0b62['length']);OpenchannelInteractionEvents[_0xc857('0x9')](_0x594578+':'+_0x3d67d7['id'],_0x3d67d7);OpenchannelInteractionEvents['emit'](_0x594578,_0x3d67d7);_0x1bb43d(null);})[_0xc857('0xa')](_0x1bb43d(null));};}for(var e in events){if(events[_0xc857('0xb')](e)){var event=events[e];OpenchannelInteraction[_0xc857('0xc')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 714432a..9876c93 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 _0x5041=['../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','request-promise','path','rimraf'];(function(_0x32652e,_0x57bac1){var _0xc0c13d=function(_0x484399){while(--_0x484399){_0x32652e['push'](_0x32652e['shift']());}};_0xc0c13d(++_0x57bac1);}(_0x5041,0x1ce));var _0x1504=function(_0x4ea6b7,_0x51567e){_0x4ea6b7=_0x4ea6b7-0x0;var _0x3aaca2=_0x5041[_0x4ea6b7];return _0x3aaca2;};'use strict';var _=require('lodash');var util=require(_0x1504('0x0'));var logger=require('../../config/logger')(_0x1504('0x1'));var moment=require(_0x1504('0x2'));var BPromise=require('bluebird');var rp=require(_0x1504('0x3'));var fs=require('fs');var path=require(_0x1504('0x4'));var rimraf=require(_0x1504('0x5'));var config=require(_0x1504('0x6'));var attributes=require(_0x1504('0x7'));module[_0x1504('0x8')]=function(_0x40bf61,_0x2f689d){return _0x40bf61[_0x1504('0x9')](_0x1504('0xa'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1504('0xb'),'collate':_0x1504('0xc'),'hooks':{'beforeUpdate':function(_0x339b9a,_0x326205,_0x4e1dc7){if(_0x339b9a[_0x1504('0xd')](_0x1504('0xe'))){_0x339b9a[_0x1504('0xf')]=moment()[_0x1504('0x10')](_0x1504('0x11'));}_0x4e1dc7(null,_0x339b9a);}}});}; \ No newline at end of file +var _0xdf97=['utf8mb4','utf8mb4_unicode_ci','changed','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','path','./openchannelInteraction.attributes','OpenchannelInteraction','openchannel_interactions'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xdf97,0x11d));var _0x7df9=function(_0x144310,_0x3f3931){_0x144310=_0x144310-0x0;var _0x3ac520=_0xdf97[_0x144310];return _0x3ac520;};'use strict';var _=require('lodash');var util=require(_0x7df9('0x0'));var logger=require(_0x7df9('0x1'))(_0x7df9('0x2'));var moment=require(_0x7df9('0x3'));var BPromise=require(_0x7df9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7df9('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7df9('0x6'));module['exports']=function(_0x1840e0,_0x1db556){return _0x1840e0['define'](_0x7df9('0x7'),attributes,{'tableName':_0x7df9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7df9('0x9'),'collate':_0x7df9('0xa'),'hooks':{'beforeUpdate':function(_0x3bd2d9,_0x3db607,_0x35e3eb){if(_0x3bd2d9[_0x7df9('0xb')]('closed')){_0x3bd2d9['closedAt']=moment()[_0x7df9('0xc')](_0x7df9('0xd'));}_0x35e3eb(null,_0x3bd2d9);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 926a229..a6bbcc5 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 _0xd4eb=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','UpdateOpenchannelInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment'];(function(_0x2f7f6f,_0xc9e54d){var _0x52aca6=function(_0x1ec821){while(--_0x1ec821){_0x2f7f6f['push'](_0x2f7f6f['shift']());}};_0x52aca6(++_0xc9e54d);}(_0xd4eb,0x7e));var _0xbd4e=function(_0x45259b,_0x37f635){_0x45259b=_0x45259b-0x0;var _0x42db02=_0xd4eb[_0x45259b];return _0x42db02;};'use strict';var _=require(_0xbd4e('0x0'));var util=require(_0xbd4e('0x1'));var moment=require(_0xbd4e('0x2'));var BPromise=require(_0xbd4e('0x3'));var rs=require(_0xbd4e('0x4'));var fs=require('fs');var Redis=require(_0xbd4e('0x5'));var db=require(_0xbd4e('0x6'))['db'];var utils=require(_0xbd4e('0x7'));var logger=require('../../config/logger')(_0xbd4e('0x8'));var config=require(_0xbd4e('0x9'));var jayson=require(_0xbd4e('0xa'));var client=jayson['client'][_0xbd4e('0xb')]({'port':0x232a});config[_0xbd4e('0xc')]=_['defaults'](config[_0xbd4e('0xc')],{'host':_0xbd4e('0xd'),'port':0x18eb});var socket=require(_0xbd4e('0xe'))(new Redis(config[_0xbd4e('0xc')]));require('./openchannelInteraction.socket')[_0xbd4e('0xf')](socket);function respondWithRpcPromise(_0x5000ad,_0x4ca0e3,_0x2ded07){return new BPromise(function(_0x44d602,_0x327fb8){return client['request'](_0x5000ad,_0x2ded07)[_0xbd4e('0x10')](function(_0x427ca){logger[_0xbd4e('0x11')](_0xbd4e('0x12'),_0x4ca0e3,'request\x20sent');logger[_0xbd4e('0x13')](_0xbd4e('0x14'),_0x4ca0e3,_0xbd4e('0x15'),JSON['stringify'](_0x427ca));if(_0x427ca[_0xbd4e('0x16')]){if(_0x427ca['error']['code']===0x1f4){logger['error'](_0xbd4e('0x12'),_0x4ca0e3,_0x427ca[_0xbd4e('0x16')][_0xbd4e('0x17')]);return _0x327fb8(_0x427ca[_0xbd4e('0x16')][_0xbd4e('0x17')]);}logger[_0xbd4e('0x16')](_0xbd4e('0x12'),_0x4ca0e3,_0x427ca[_0xbd4e('0x16')][_0xbd4e('0x17')]);return _0x44d602(_0x427ca[_0xbd4e('0x16')][_0xbd4e('0x17')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x4ca0e3,_0xbd4e('0x15'));_0x44d602(_0x427ca[_0xbd4e('0x18')]['message']);}})[_0xbd4e('0x19')](function(_0x38bc87){logger[_0xbd4e('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4ca0e3,_0x38bc87);_0x327fb8(_0x38bc87);});});}exports[_0xbd4e('0x1a')]=function(_0x490466){var _0x62b9f0=this;return new Promise(function(_0x21aa3b,_0xa1a6d7){return db['OpenchannelInteraction'][_0xbd4e('0x1b')](_0x490466[_0xbd4e('0x1c')],{'raw':_0x490466[_0xbd4e('0x1d')]?_0x490466[_0xbd4e('0x1d')][_0xbd4e('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x490466[_0xbd4e('0x1d')]?_0x490466[_0xbd4e('0x1d')][_0xbd4e('0x1f')]||null:null,'attributes':_0x490466[_0xbd4e('0x1d')]?_0x490466[_0xbd4e('0x1d')][_0xbd4e('0x20')]||null:null,'limit':_0x490466['options']?_0x490466[_0xbd4e('0x1d')][_0xbd4e('0x21')]||null:null})[_0xbd4e('0x10')](function(_0x5862ee){logger['info'](_0xbd4e('0x1a'),_0x490466);logger['debug'](_0xbd4e('0x1a'),_0x490466,JSON[_0xbd4e('0x22')](_0x5862ee));_0x21aa3b(_0x5862ee);})[_0xbd4e('0x19')](function(_0x570651){logger[_0xbd4e('0x16')]('UpdateOpenchannelInteraction',_0x570651[_0xbd4e('0x17')],_0x490466);_0xa1a6d7(_0x62b9f0[_0xbd4e('0x16')](0x1f4,_0x570651[_0xbd4e('0x17')]));});});};exports[_0xbd4e('0x23')]=function(_0x3fa541){return new Promise(function(_0x35eac4,_0x193724){return db[_0xbd4e('0x24')][_0xbd4e('0x25')]({'where':_0x3fa541[_0xbd4e('0x1d')]?_0x3fa541['options']['where']||null:null})[_0xbd4e('0x10')](function(_0x31f861){if(_0x31f861){return _0x31f861[_0xbd4e('0x26')](_0x3fa541['body'][_0xbd4e('0x27')],_[_0xbd4e('0x28')](_0x3fa541[_0xbd4e('0x1c')],['ids','id'])||{});}})[_0xbd4e('0x29')](function(_0x7f52f3){logger[_0xbd4e('0x11')](_0xbd4e('0x2a'),_0x3fa541);logger[_0xbd4e('0x13')]('AddTags',_0x3fa541,JSON['stringify'](_0x7f52f3));_0x35eac4(_0x7f52f3);})[_0xbd4e('0x19')](function(_0x1a1703){logger[_0xbd4e('0x16')](_0xbd4e('0x2a'),_0x1a1703[_0xbd4e('0x17')],_0x3fa541);_0x193724(_this[_0xbd4e('0x16')](0x1f4,_0x1a1703[_0xbd4e('0x17')]));});});}; \ No newline at end of file +var _0xf51a=['find','addTags','ids','omit','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','register','request','info','request\x20sent','stringify','error','code','message','OpenchannelInteraction,\x20%s,\x20%s','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','where','attributes','limit','then','debug','AddTagsToOpenchannelInteraction'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xf51a,0x16d));var _0xaf51=function(_0x2fdec1,_0x5ded03){_0x2fdec1=_0x2fdec1-0x0;var _0xd12ec1=_0xf51a[_0x2fdec1];return _0xd12ec1;};'use strict';var _=require(_0xaf51('0x0'));var util=require('util');var moment=require(_0xaf51('0x1'));var BPromise=require(_0xaf51('0x2'));var rs=require(_0xaf51('0x3'));var fs=require('fs');var Redis=require(_0xaf51('0x4'));var db=require(_0xaf51('0x5'))['db'];var utils=require(_0xaf51('0x6'));var logger=require(_0xaf51('0x7'))(_0xaf51('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaf51('0x9')]['http']({'port':0x232a});config[_0xaf51('0xa')]=_[_0xaf51('0xb')](config[_0xaf51('0xa')],{'host':_0xaf51('0xc'),'port':0x18eb});var socket=require(_0xaf51('0xd'))(new Redis(config[_0xaf51('0xa')]));require('./openchannelInteraction.socket')[_0xaf51('0xe')](socket);function respondWithRpcPromise(_0x36471d,_0x136fb4,_0x367e4e){return new BPromise(function(_0x3f5ca3,_0x334711){return client[_0xaf51('0xf')](_0x36471d,_0x367e4e)['then'](function(_0x80980c){logger[_0xaf51('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x136fb4,_0xaf51('0x11'));logger['debug']('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x136fb4,_0xaf51('0x11'),JSON[_0xaf51('0x12')](_0x80980c));if(_0x80980c['error']){if(_0x80980c[_0xaf51('0x13')][_0xaf51('0x14')]===0x1f4){logger[_0xaf51('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x136fb4,_0x80980c[_0xaf51('0x13')][_0xaf51('0x15')]);return _0x334711(_0x80980c[_0xaf51('0x13')][_0xaf51('0x15')]);}logger['error'](_0xaf51('0x16'),_0x136fb4,_0x80980c[_0xaf51('0x13')][_0xaf51('0x15')]);return _0x3f5ca3(_0x80980c[_0xaf51('0x13')]['message']);}else{logger[_0xaf51('0x10')](_0xaf51('0x16'),_0x136fb4,_0xaf51('0x11'));_0x3f5ca3(_0x80980c[_0xaf51('0x17')]['message']);}})[_0xaf51('0x18')](function(_0xba73d4){logger['error'](_0xaf51('0x16'),_0x136fb4,_0xba73d4);_0x334711(_0xba73d4);});});}exports[_0xaf51('0x19')]=function(_0x3a9a32){var _0x22177f=this;return new Promise(function(_0x37d042,_0x1616e2){return db[_0xaf51('0x1a')]['update'](_0x3a9a32[_0xaf51('0x1b')],{'raw':_0x3a9a32['options']?_0x3a9a32[_0xaf51('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a9a32[_0xaf51('0x1c')]?_0x3a9a32[_0xaf51('0x1c')][_0xaf51('0x1d')]||null:null,'attributes':_0x3a9a32[_0xaf51('0x1c')]?_0x3a9a32[_0xaf51('0x1c')][_0xaf51('0x1e')]||null:null,'limit':_0x3a9a32[_0xaf51('0x1c')]?_0x3a9a32['options'][_0xaf51('0x1f')]||null:null})[_0xaf51('0x20')](function(_0x1a9ee1){logger['info'](_0xaf51('0x19'),_0x3a9a32);logger[_0xaf51('0x21')](_0xaf51('0x19'),_0x3a9a32,JSON[_0xaf51('0x12')](_0x1a9ee1));_0x37d042(_0x1a9ee1);})[_0xaf51('0x18')](function(_0x566fd7){logger[_0xaf51('0x13')](_0xaf51('0x19'),_0x566fd7['message'],_0x3a9a32);_0x1616e2(_0x22177f[_0xaf51('0x13')](0x1f4,_0x566fd7[_0xaf51('0x15')]));});});};exports[_0xaf51('0x22')]=function(_0x3a0491){return new Promise(function(_0x3ac3df,_0x56c1ba){return db[_0xaf51('0x1a')][_0xaf51('0x23')]({'where':_0x3a0491['options']?_0x3a0491[_0xaf51('0x1c')]['where']||null:null})[_0xaf51('0x20')](function(_0x4fc84a){if(_0x4fc84a){return _0x4fc84a[_0xaf51('0x24')](_0x3a0491[_0xaf51('0x1b')][_0xaf51('0x25')],_[_0xaf51('0x26')](_0x3a0491['body'],[_0xaf51('0x25'),'id'])||{});}})['spread'](function(_0x10ed7d){logger[_0xaf51('0x10')](_0xaf51('0x27'),_0x3a0491);logger[_0xaf51('0x21')]('AddTags',_0x3a0491,JSON[_0xaf51('0x12')](_0x10ed7d));_0x3ac3df(_0x10ed7d);})[_0xaf51('0x18')](function(_0x1d4785){logger[_0xaf51('0x13')](_0xaf51('0x27'),_0x1d4785['message'],_0x3a0491);_0x56c1ba(_this['error'](0x1f4,_0x1d4785[_0xaf51('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 5d3b8d8..a20c77a 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 _0x7b54=['openchannelInteraction:','./openchannelInteraction.events','save','update','emit','removeListener','length'];(function(_0x11f895,_0x584c30){var _0x5ee01e=function(_0x351dae){while(--_0x351dae){_0x11f895['push'](_0x11f895['shift']());}};_0x5ee01e(++_0x584c30);}(_0x7b54,0xfd));var _0x47b5=function(_0x312abc,_0x17f25c){_0x312abc=_0x312abc-0x0;var _0x314298=_0x7b54[_0x312abc];return _0x314298;};'use strict';var OpenchannelInteractionEvents=require(_0x47b5('0x0'));var events=[_0x47b5('0x1'),'remove',_0x47b5('0x2')];function createListener(_0x776030,_0x435b4f){return function(_0x83f5af){_0x435b4f[_0x47b5('0x3')](_0x776030,_0x83f5af);};}function removeListener(_0x449eda,_0x32a6f8){return function(){OpenchannelInteractionEvents[_0x47b5('0x4')](_0x449eda,_0x32a6f8);};}exports['register']=function(_0x32d9c9){for(var _0x2ba08d=0x0,_0x5d910d=events[_0x47b5('0x5')];_0x2ba08d<_0x5d910d;_0x2ba08d++){var _0x1938ba=events[_0x2ba08d];var _0x24c29f=createListener(_0x47b5('0x6')+_0x1938ba,_0x32d9c9);OpenchannelInteractionEvents['on'](_0x1938ba,_0x24c29f);}}; \ No newline at end of file +var _0xde57=['removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit'];(function(_0x449158,_0x44e1b0){var _0x1f3c3a=function(_0x5f1053){while(--_0x5f1053){_0x449158['push'](_0x449158['shift']());}};_0x1f3c3a(++_0x44e1b0);}(_0xde57,0x199));var _0x7de5=function(_0x4ec13d,_0x358a8f){_0x4ec13d=_0x4ec13d-0x0;var _0x3c3fa7=_0xde57[_0x4ec13d];return _0x3c3fa7;};'use strict';var OpenchannelInteractionEvents=require(_0x7de5('0x0'));var events=[_0x7de5('0x1'),_0x7de5('0x2'),_0x7de5('0x3')];function createListener(_0x413705,_0x1a2244){return function(_0x48f222){_0x1a2244[_0x7de5('0x4')](_0x413705,_0x48f222);};}function removeListener(_0x253405,_0x39c007){return function(){OpenchannelInteractionEvents[_0x7de5('0x5')](_0x253405,_0x39c007);};}exports[_0x7de5('0x6')]=function(_0x1d39e3){for(var _0x2a317e=0x0,_0x66ab8b=events[_0x7de5('0x7')];_0x2a317e<_0x66ab8b;_0x2a317e++){var _0xc619d6=events[_0x2a317e];var _0x19ac99=createListener(_0x7de5('0x8')+_0xc619d6,_0x1d39e3);OpenchannelInteractionEvents['on'](_0xc619d6,_0x19ac99);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index b7f0e18..c40e119 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 _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x518af1,_0x3d017a){var _0x1677d7=function(_0x39e68b){while(--_0x39e68b){_0x518af1['push'](_0x518af1['shift']());}};_0x1677d7(++_0x3d017a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file +var _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x70e0,0x17b));var _0x070e=function(_0x155345,_0x41a07b){_0x155345=_0x155345-0x0;var _0x2fb119=_0x70e0[_0x155345];return _0x2fb119;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 3b3d9ab..d0ece72 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 _0x282b=['BOOLEAN','out','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x4068f3,_0x42afad){var _0x1c60fd=function(_0x466c74){while(--_0x466c74){_0x4068f3['push'](_0x4068f3['shift']());}};_0x1c60fd(++_0x42afad);}(_0x282b,0xec));var _0xb282=function(_0x1d834f,_0x161441){_0x1d834f=_0x1d834f-0x0;var _0x25a8dd=_0x282b[_0x1d834f];return _0x25a8dd;};'use strict';var Sequelize=require(_0xb282('0x0'));module[_0xb282('0x1')]={'body':{'type':Sequelize[_0xb282('0x2')](_0xb282('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xb282('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xb282('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xb282('0x6')]},'providerName':{'type':Sequelize[_0xb282('0x7')]},'providerResponse':{'type':Sequelize[_0xb282('0x2')]}}; \ No newline at end of file +var _0x7497=['TEXT','ENUM','out','DATE','STRING','sequelize','exports'];(function(_0x240201,_0xfcdaa1){var _0x24fe3c=function(_0x5a9e8b){while(--_0x5a9e8b){_0x240201['push'](_0x240201['shift']());}};_0x24fe3c(++_0xfcdaa1);}(_0x7497,0xd0));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7749('0x0'));module[_0x7749('0x1')]={'body':{'type':Sequelize[_0x7749('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x7749('0x3')]('in',_0x7749('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x7749('0x5')]},'providerName':{'type':Sequelize[_0x7749('0x6')]},'providerResponse':{'type':Sequelize[_0x7749('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index fcee8ac..a0be11b 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 _0x2bd4=['moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','undefined','limit','offset','set','Content-Range','json','reject','save','update','destroy','stack','name','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','pick','filter','where','merge','options','OpenchannelMessage','count','includeAll','include','findAll','rows','params','keys','length','create','body','find','describe','../../config/logger','openchannel-interactions','accept','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','rejectMessage','contact','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x13908d,_0x5c8872){var _0x137b76=function(_0x418e00){while(--_0x418e00){_0x13908d['push'](_0x13908d['shift']());}};_0x137b76(++_0x5c8872);}(_0x2bd4,0x103));var _0x42bd=function(_0x3748d9,_0x1e4862){_0x3748d9=_0x3748d9-0x0;var _0x4c5423=_0x2bd4[_0x3748d9];return _0x4c5423;};'use strict';var emlformat=require(_0x42bd('0x0'));var rimraf=require(_0x42bd('0x1'));var zipdir=require(_0x42bd('0x2'));var jsonpatch=require(_0x42bd('0x3'));var rp=require(_0x42bd('0x4'));var moment=require(_0x42bd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x42bd('0x6'));var util=require(_0x42bd('0x7'));var path=require(_0x42bd('0x8'));var sox=require(_0x42bd('0x9'));var csv=require(_0x42bd('0xa'));var ejs=require(_0x42bd('0xb'));var fs=require('fs');var fs_extra=require(_0x42bd('0xc'));var _=require('lodash');var squel=require(_0x42bd('0xd'));var crypto=require(_0x42bd('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x42bd('0xf'));var toCsv=require('to-csv');var querystring=require(_0x42bd('0x10'));var Papa=require('papaparse');var Redis=require(_0x42bd('0x11'));var authService=require(_0x42bd('0x12'));var qs=require(_0x42bd('0x13'));var as=require(_0x42bd('0x14'));var hardwareService=require(_0x42bd('0x15'));var logger=require('../../config/logger')(_0x42bd('0x16'));var utils=require(_0x42bd('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x42bd('0x18'));var db=require(_0x42bd('0x19'))['db'];config['redis']=_[_0x42bd('0x1a')](config[_0x42bd('0x1b')],{'host':_0x42bd('0x1c'),'port':0x18eb});var socket=require(_0x42bd('0x1d'))(new Redis(config[_0x42bd('0x1b')]));require('./openchannelMessage.socket')[_0x42bd('0x1e')](socket);var jayson=require(_0x42bd('0x1f'));var client=jayson[_0x42bd('0x20')][_0x42bd('0x21')]({'port':0x232c});var client9002=jayson[_0x42bd('0x20')][_0x42bd('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x477aa6,_0x3e8501,_0x4c64a4,_0x44a155){return new BPromise(function(_0x5c8a8a,_0x10e6ba){var _0x9321d4=_0x44a155||client;return _0x9321d4[_0x42bd('0x22')](_0x477aa6,_0x4c64a4)[_0x42bd('0x23')](function(_0x28b13f){logger[_0x42bd('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x3e8501,_0x42bd('0x25'));logger[_0x42bd('0x26')](_0x42bd('0x27'),_0x3e8501,_0x42bd('0x25'),JSON[_0x42bd('0x28')](_0x28b13f));if(_0x28b13f[_0x42bd('0x29')]){if(_0x28b13f[_0x42bd('0x29')][_0x42bd('0x2a')]===0x1f4){logger[_0x42bd('0x29')](_0x42bd('0x2b'),_0x3e8501,_0x28b13f['error'][_0x42bd('0x2c')]);return _0x10e6ba(_0x28b13f[_0x42bd('0x29')][_0x42bd('0x2c')]);}logger[_0x42bd('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x3e8501,_0x28b13f[_0x42bd('0x29')]['message']);return _0x5c8a8a(_0x28b13f['error'][_0x42bd('0x2c')]);}else{logger[_0x42bd('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x3e8501,_0x42bd('0x25'));_0x5c8a8a(_0x28b13f[_0x42bd('0x2d')][_0x42bd('0x2c')]);}})[_0x42bd('0x2e')](function(_0x40b0c0){logger[_0x42bd('0x29')](_0x42bd('0x2b'),_0x3e8501,_0x40b0c0);_0x10e6ba(_0x40b0c0);});});}function respondWithStatusCode(_0xb174ec,_0x2be60d){_0x2be60d=_0x2be60d||0xcc;return function(_0x59f1b0){if(_0x59f1b0){return _0xb174ec[_0x42bd('0x2f')](_0x2be60d);}return _0xb174ec['status'](_0x2be60d)[_0x42bd('0x30')]();};}function respondWithResult(_0x3111d1,_0x4de071){_0x4de071=_0x4de071||0xc8;return function(_0x3b3520){if(_0x3b3520){return _0x3111d1[_0x42bd('0x31')](_0x4de071)['json'](_0x3b3520);}};}function respondWithFilteredResult(_0x58d57b,_0x49984e){return function(_0x2d281f){if(_0x2d281f){var _0xa9e4ce=typeof _0x49984e['offset']===_0x42bd('0x32')&&typeof _0x49984e[_0x42bd('0x33')]==='undefined';var _0x38a0a1=_0x2d281f['count'];var _0x328025=_0xa9e4ce?0x0:_0x49984e[_0x42bd('0x34')];var _0x149f18=_0xa9e4ce?_0x2d281f['count']:_0x49984e[_0x42bd('0x34')]+_0x49984e['limit'];var _0x159b4a;if(_0x149f18>=_0x38a0a1){_0x149f18=_0x38a0a1;_0x159b4a=0xc8;}else{_0x159b4a=0xce;}_0x58d57b[_0x42bd('0x31')](_0x159b4a);return _0x58d57b[_0x42bd('0x35')](_0x42bd('0x36'),_0x328025+'-'+_0x149f18+'/'+_0x38a0a1)[_0x42bd('0x37')](_0x2d281f);}return null;};}function patchUpdates(_0xc4fdb0){return function(_0x20488b){try{jsonpatch['apply'](_0x20488b,_0xc4fdb0,!![]);}catch(_0x3ca4cd){return BPromise[_0x42bd('0x38')](_0x3ca4cd);}return _0x20488b[_0x42bd('0x39')]();};}function saveUpdates(_0x15f360,_0x49b1f0){return function(_0x536bcc){if(_0x536bcc){return _0x536bcc[_0x42bd('0x3a')](_0x15f360)[_0x42bd('0x23')](function(_0x34b836){return _0x34b836;});}return null;};}function removeEntity(_0x242e97,_0x50fdd8){return function(_0x5c9dc0){if(_0x5c9dc0){return _0x5c9dc0[_0x42bd('0x3b')]()[_0x42bd('0x23')](function(){_0x242e97['status'](0xcc)[_0x42bd('0x30')]();});}};}function handleEntityNotFound(_0x462275,_0x10b1d2){return function(_0x4cbbe2){if(!_0x4cbbe2){_0x462275[_0x42bd('0x2f')](0x194);}return _0x4cbbe2;};}function handleError(_0x5243b1,_0x35aa48){_0x35aa48=_0x35aa48||0x1f4;return function(_0x56d0e1){logger[_0x42bd('0x29')](_0x56d0e1[_0x42bd('0x3c')]);if(_0x56d0e1[_0x42bd('0x3d')]){delete _0x56d0e1['name'];}_0x5243b1[_0x42bd('0x31')](_0x35aa48)['send'](_0x56d0e1);};}exports[_0x42bd('0x3e')]=function(_0x38f622,_0x46a163){var _0x29465f={},_0x1d9d50={},_0x27033b={'count':0x0,'rows':[]};var _0x1c5a9f=_[_0x42bd('0x3f')](db['OpenchannelMessage'][_0x42bd('0x40')],function(_0x593ab5){return{'name':_0x593ab5['fieldName'],'type':_0x593ab5[_0x42bd('0x41')][_0x42bd('0x42')]};});_0x1d9d50[_0x42bd('0x43')]=_['map'](_0x1c5a9f,_0x42bd('0x3d'));_0x1d9d50['query']=_['keys'](_0x38f622[_0x42bd('0x44')]);_0x1d9d50[_0x42bd('0x45')]=_[_0x42bd('0x46')](_0x1d9d50[_0x42bd('0x43')],_0x1d9d50[_0x42bd('0x44')]);_0x29465f[_0x42bd('0x47')]=_[_0x42bd('0x46')](_0x1d9d50[_0x42bd('0x43')],qs[_0x42bd('0x48')](_0x38f622[_0x42bd('0x44')][_0x42bd('0x48')]));_0x29465f[_0x42bd('0x47')]=_0x29465f[_0x42bd('0x47')]['length']?_0x29465f['attributes']:_0x1d9d50[_0x42bd('0x43')];if(!_0x38f622[_0x42bd('0x44')][_0x42bd('0x49')](_0x42bd('0x4a'))){_0x29465f[_0x42bd('0x33')]=qs['limit'](_0x38f622['query']['limit']);_0x29465f[_0x42bd('0x34')]=qs[_0x42bd('0x34')](_0x38f622[_0x42bd('0x44')][_0x42bd('0x34')]);}_0x29465f['order']=qs['sort'](_0x38f622['query']['sort']);_0x29465f['where']=qs['filters'](_[_0x42bd('0x4b')](_0x38f622[_0x42bd('0x44')],_0x1d9d50['filters']),_0x1c5a9f);if(_0x38f622[_0x42bd('0x44')][_0x42bd('0x4c')]){_0x29465f[_0x42bd('0x4d')]=_[_0x42bd('0x4e')](_0x29465f[_0x42bd('0x4d')],{'$or':_[_0x42bd('0x3f')](_0x1c5a9f,function(_0x1f0e0e){if(_0x1f0e0e[_0x42bd('0x41')]!=='VIRTUAL'){var _0x261d08={};_0x261d08[_0x1f0e0e[_0x42bd('0x3d')]]={'$like':'%'+_0x38f622['query'][_0x42bd('0x4c')]+'%'};return _0x261d08;}})});}_0x29465f=_['merge']({},_0x29465f,_0x38f622[_0x42bd('0x4f')]);var _0x1aca88={'where':_0x29465f[_0x42bd('0x4d')]};return db[_0x42bd('0x50')]['count'](_0x1aca88)[_0x42bd('0x23')](function(_0x5b2072){_0x27033b[_0x42bd('0x51')]=_0x5b2072;if(_0x38f622[_0x42bd('0x44')][_0x42bd('0x52')]){_0x29465f[_0x42bd('0x53')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x42bd('0x54')](_0x29465f);})['then'](function(_0x3774db){_0x27033b[_0x42bd('0x55')]=_0x3774db;return _0x27033b;})[_0x42bd('0x23')](respondWithFilteredResult(_0x46a163,_0x29465f))[_0x42bd('0x2e')](handleError(_0x46a163,null));};exports['show']=function(_0x170b3a,_0x496adb){var _0x5e8b35={'raw':!![],'where':{'id':_0x170b3a[_0x42bd('0x56')]['id']}},_0x5872da={};_0x5872da[_0x42bd('0x43')]=_[_0x42bd('0x57')](db[_0x42bd('0x50')][_0x42bd('0x40')]);_0x5872da['query']=_[_0x42bd('0x57')](_0x170b3a['query']);_0x5872da[_0x42bd('0x45')]=_[_0x42bd('0x46')](_0x5872da['model'],_0x5872da[_0x42bd('0x44')]);_0x5e8b35['attributes']=_['intersection'](_0x5872da['model'],qs[_0x42bd('0x48')](_0x170b3a[_0x42bd('0x44')][_0x42bd('0x48')]));_0x5e8b35[_0x42bd('0x47')]=_0x5e8b35[_0x42bd('0x47')][_0x42bd('0x58')]?_0x5e8b35['attributes']:_0x5872da[_0x42bd('0x43')];if(_0x170b3a[_0x42bd('0x44')][_0x42bd('0x52')]){_0x5e8b35[_0x42bd('0x53')]=[{'all':!![]}];}_0x5e8b35=_['merge']({},_0x5e8b35,_0x170b3a['options']);return db[_0x42bd('0x50')]['find'](_0x5e8b35)[_0x42bd('0x23')](handleEntityNotFound(_0x496adb,null))[_0x42bd('0x23')](respondWithResult(_0x496adb,null))[_0x42bd('0x2e')](handleError(_0x496adb,null));};exports[_0x42bd('0x59')]=function(_0x536f9f,_0xf6de42){return db[_0x42bd('0x50')][_0x42bd('0x59')](_0x536f9f['body'],{})[_0x42bd('0x23')](respondWithResult(_0xf6de42,0xc9))[_0x42bd('0x2e')](handleError(_0xf6de42,null));};exports[_0x42bd('0x3a')]=function(_0x102b3e,_0x36830c){if(_0x102b3e[_0x42bd('0x5a')]['id']){delete _0x102b3e[_0x42bd('0x5a')]['id'];}return db[_0x42bd('0x50')][_0x42bd('0x5b')]({'where':{'id':_0x102b3e['params']['id']}})[_0x42bd('0x23')](handleEntityNotFound(_0x36830c,null))[_0x42bd('0x23')](saveUpdates(_0x102b3e[_0x42bd('0x5a')],null))[_0x42bd('0x23')](respondWithResult(_0x36830c,null))[_0x42bd('0x2e')](handleError(_0x36830c,null));};exports[_0x42bd('0x3b')]=function(_0x104b88,_0x26154c){return db[_0x42bd('0x50')][_0x42bd('0x5b')]({'where':{'id':_0x104b88[_0x42bd('0x56')]['id']}})[_0x42bd('0x23')](handleEntityNotFound(_0x26154c,null))['then'](removeEntity(_0x26154c,null))[_0x42bd('0x2e')](handleError(_0x26154c,null));};exports[_0x42bd('0x5c')]=function(_0x98e54e,_0x3d1726){return db[_0x42bd('0x50')][_0x42bd('0x5c')]()[_0x42bd('0x23')](respondWithResult(_0x3d1726,null))[_0x42bd('0x2e')](handleError(_0x3d1726,null));};var interaction_log=require(_0x42bd('0x5d'))(_0x42bd('0x5e'));exports[_0x42bd('0x5f')]=function(_0xa95b41,_0x577479,_0x8d4e13){var _0x459d06={'agent':{},'channel':_0x42bd('0x60')};if(_0xa95b41[_0x42bd('0x5a')]['id']){delete _0xa95b41[_0x42bd('0x5a')]['id'];}_0xa95b41[_0x42bd('0x5a')][_0x42bd('0x61')]=!![];_0xa95b41['body']['readAt']=moment()[_0x42bd('0x62')](_0x42bd('0x63'));_0xa95b41[_0x42bd('0x5a')][_0x42bd('0x64')]=_0xa95b41[_0x42bd('0x5a')]['UserId']||_0xa95b41[_0x42bd('0x65')]['id'];_0x459d06[_0x42bd('0x66')]['id']=_0xa95b41[_0x42bd('0x5a')][_0x42bd('0x64')];return db['OpenchannelMessage'][_0x42bd('0x5b')]({'where':{'id':_0xa95b41['params']['id'],'UserId':null}})[_0x42bd('0x23')](handleEntityNotFound(_0x577479,null))['then'](saveUpdates(_0xa95b41[_0x42bd('0x5a')],null))[_0x42bd('0x23')](function(_0x87508f){if(_0x87508f){_0x459d06['message']=_0x87508f['get']({'plain':!![]});return db[_0x42bd('0x67')][_0x42bd('0x5b')]({'where':{'id':_0x87508f[_0x42bd('0x68')]}});}return null;})[_0x42bd('0x23')](handleEntityNotFound(_0x577479,null))[_0x42bd('0x23')](function(_0x5c0cfe){if(_0x5c0cfe){return _0x5c0cfe[_0x42bd('0x3a')]({'UserId':_0xa95b41[_0x42bd('0x5a')][_0x42bd('0x64')],'read1stAt':_['isNil'](_0x5c0cfe['read1stAt'])?moment()[_0x42bd('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x42bd('0x23')](function(_0x3b6104){if(_0x3b6104){_0x459d06[_0x42bd('0x69')]=_0x3b6104[_0x42bd('0x6a')]({'plain':!![]});interaction_log[_0x42bd('0x24')](_0x42bd('0x6b'),_0xa95b41[_0x42bd('0x65')]['id'],_0xa95b41[_0x42bd('0x65')]['name'],_0xa95b41[_0x42bd('0x65')]['role'],_0x459d06[_0x42bd('0x69')]['id'],_0xa95b41[_0x42bd('0x5a')]?JSON[_0x42bd('0x28')](_0xa95b41['body']):'null');return respondWithRpcPromise(_0x42bd('0x6c'),_0x42bd('0x6d'),_0x459d06);}return null;})[_0x42bd('0x23')](function(_0xc8c3a1){var _0x33a16b=_0x42bd('0x6e')+_0xc8c3a1[_0x42bd('0x2c')][_0x42bd('0x6f')];return db[_0x42bd('0x70')][_0x42bd('0x44')](_0x33a16b,{'type':db[_0x42bd('0x71')][_0x42bd('0x72')][_0x42bd('0x73')],'raw':!![]})[_0x42bd('0x23')](function(_0x2d7f18){return _0x2d7f18;});})[_0x42bd('0x23')](function(_0x43ba38){if(_0x43ba38){_0x459d06['message']['contact']=_0x43ba38[0x0];if(!_0xa95b41[_0x42bd('0x5a')][_0x42bd('0x64')])return;return db[_0x42bd('0x74')][_0x42bd('0x5b')]({'where':{'id':_0xa95b41[_0x42bd('0x5a')][_0x42bd('0x64')],'role':_0x42bd('0x66')},'attributes':['id',_0x42bd('0x3d'),_0x42bd('0x75'),'email',_0x42bd('0x76')],'raw':!![]});}return null;})[_0x42bd('0x23')](function(_0x45391d){if(!_0x45391d)return null;_0x459d06['message'][_0x42bd('0x66')]=_0x45391d;return _0x459d06;})['then'](function(_0x33206d){if(_0x33206d){if(_0xa95b41[_0x42bd('0x5a')]['manual']){_0x459d06[_0x42bd('0x2c')][_0x42bd('0x77')]=util[_0x42bd('0x62')](_0x42bd('0x78'),_0xa95b41['user']['name']);_0x459d06['message'][_0x42bd('0x79')]=_0x459d06[_0x42bd('0x79')];_0x459d06[_0x42bd('0x2c')][_0x42bd('0x7a')]=_0x459d06[_0x42bd('0x79')];_0x459d06[_0x42bd('0x2c')][_0x42bd('0x7b')]='accept';return respondWithRpcPromise(_0x42bd('0x7c'),_0x42bd('0x7c'),{'event':_0x42bd('0x7d'),'message':_0x459d06[_0x42bd('0x2c')]},client9002)[_0x42bd('0x23')](function(){return _0x459d06;});}return _0x459d06;}return null;})['then'](respondWithResult(_0x577479,null))[_0x42bd('0x2e')](handleError(_0x577479,null));};var interaction_log=require(_0x42bd('0x5d'))(_0x42bd('0x5e'));exports[_0x42bd('0x38')]=function(_0x18481d,_0x1540e0,_0x54adf5){var _0x52c3ea={'agent':{},'channel':_0x42bd('0x60')};if(_0x18481d[_0x42bd('0x5a')]['id']){delete _0x18481d[_0x42bd('0x5a')]['id'];}_0x18481d['body']['UserId']=_0x18481d[_0x42bd('0x5a')][_0x42bd('0x64')]||_0x18481d[_0x42bd('0x65')]['id'];_0x52c3ea['agent']['id']=_0x18481d[_0x42bd('0x5a')]['UserId'];return db[_0x42bd('0x50')][_0x42bd('0x5b')]({'where':{'id':_0x18481d[_0x42bd('0x56')]['id'],'UserId':null}})[_0x42bd('0x23')](handleEntityNotFound(_0x1540e0,null))['then'](function(_0xad9477){if(_0xad9477){_0x52c3ea[_0x42bd('0x2c')]=_0xad9477['get']({'plain':!![]});return db[_0x42bd('0x67')][_0x42bd('0x5b')]({'where':{'id':_0xad9477[_0x42bd('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x1540e0,null))['then'](function(_0x712fa9){if(_0x712fa9){_0x52c3ea[_0x42bd('0x69')]=_0x712fa9['get']({'plain':!![]});interaction_log[_0x42bd('0x24')](_0x42bd('0x7e'),_0x18481d[_0x42bd('0x65')]['id'],_0x18481d[_0x42bd('0x65')]['name'],_0x18481d[_0x42bd('0x65')][_0x42bd('0x7f')],_0x52c3ea[_0x42bd('0x69')]['id'],_0x18481d['body']?JSON[_0x42bd('0x28')](_0x18481d[_0x42bd('0x5a')]):_0x42bd('0x80'));return respondWithRpcPromise('RejectMessage',_0x42bd('0x81'),_0x52c3ea);}return null;})['then'](function(_0x30ddae){var _0x31f653=_0x42bd('0x6e')+_0x30ddae[_0x42bd('0x2c')][_0x42bd('0x6f')];return db[_0x42bd('0x70')][_0x42bd('0x44')](_0x31f653,{'type':db['Sequelize']['QueryTypes'][_0x42bd('0x73')],'raw':!![]})[_0x42bd('0x23')](function(_0xfa1c68){return _0xfa1c68;});})[_0x42bd('0x23')](function(_0x21c55c){if(_0x21c55c){_0x52c3ea[_0x42bd('0x2c')][_0x42bd('0x82')]=_0x21c55c[0x0];if(!_0x18481d[_0x42bd('0x5a')][_0x42bd('0x64')])return;return db[_0x42bd('0x74')][_0x42bd('0x5b')]({'where':{'id':_0x18481d[_0x42bd('0x5a')][_0x42bd('0x64')],'role':_0x42bd('0x66')},'attributes':['id',_0x42bd('0x3d'),_0x42bd('0x75'),'email',_0x42bd('0x76')],'raw':!![]});}return null;})[_0x42bd('0x23')](function(_0x4f501c){if(!_0x4f501c)return null;_0x52c3ea['message'][_0x42bd('0x66')]=_0x4f501c;return _0x52c3ea;})[_0x42bd('0x23')](function(_0x5d7d97){if(_0x5d7d97){_0x5d7d97['message']['interface']=util[_0x42bd('0x62')](_0x42bd('0x78'),_0x18481d[_0x42bd('0x65')][_0x42bd('0x3d')]);_0x5d7d97['message'][_0x42bd('0x79')]=_0x52c3ea[_0x42bd('0x79')];_0x5d7d97[_0x42bd('0x2c')][_0x42bd('0x7a')]=_0x52c3ea['channel'];_0x5d7d97[_0x42bd('0x2c')][_0x42bd('0x7b')]=_0x42bd('0x38');respondWithRpcPromise(_0x42bd('0x7c'),_0x42bd('0x7c'),{'event':_0x42bd('0x83'),'message':_0x5d7d97[_0x42bd('0x2c')]},client9002);return _0x52c3ea;}return null;})['then'](respondWithResult(_0x1540e0,null))[_0x42bd('0x2e')](handleError(_0x1540e0,null));}; \ No newline at end of file +var _0x1174=['json','undefined','limit','offset','apply','reject','save','update','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','OpenchannelMessage','count','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','describe','accept','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteractionId','format','role','null','AcceptMessage','QueryTypes','SELECT','contact','email','internal','agent','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel-interactions','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','RejectMessage','sequelize','Sequelize','User','fullname','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','sendStatus','status'];(function(_0x329a7a,_0x21c078){var _0x506ad5=function(_0x12c8a0){while(--_0x12c8a0){_0x329a7a['push'](_0x329a7a['shift']());}};_0x506ad5(++_0x21c078);}(_0x1174,0x146));var _0x4117=function(_0x222245,_0x334f8a){_0x222245=_0x222245-0x0;var _0x271de6=_0x1174[_0x222245];return _0x271de6;};'use strict';var emlformat=require(_0x4117('0x0'));var rimraf=require(_0x4117('0x1'));var zipdir=require(_0x4117('0x2'));var jsonpatch=require(_0x4117('0x3'));var rp=require(_0x4117('0x4'));var moment=require(_0x4117('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4117('0x6'));var util=require(_0x4117('0x7'));var path=require(_0x4117('0x8'));var sox=require(_0x4117('0x9'));var csv=require(_0x4117('0xa'));var ejs=require(_0x4117('0xb'));var fs=require('fs');var fs_extra=require(_0x4117('0xc'));var _=require('lodash');var squel=require(_0x4117('0xd'));var crypto=require(_0x4117('0xe'));var jsforce=require(_0x4117('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x4117('0xa'));var querystring=require(_0x4117('0x10'));var Papa=require(_0x4117('0x11'));var Redis=require('ioredis');var authService=require(_0x4117('0x12'));var qs=require(_0x4117('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4117('0x14'))(_0x4117('0x15'));var utils=require(_0x4117('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4117('0x17'));var db=require(_0x4117('0x18'))['db'];config['redis']=_[_0x4117('0x19')](config[_0x4117('0x1a')],{'host':_0x4117('0x1b'),'port':0x18eb});var socket=require(_0x4117('0x1c'))(new Redis(config[_0x4117('0x1a')]));require(_0x4117('0x1d'))['register'](socket);var jayson=require(_0x4117('0x1e'));var client=jayson[_0x4117('0x1f')][_0x4117('0x20')]({'port':0x232c});var client9002=jayson[_0x4117('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32bd3b,_0x1e8ced,_0x491af4,_0x509c17){return new BPromise(function(_0x5bdbfb,_0x44f136){var _0x4aebd2=_0x509c17||client;return _0x4aebd2['request'](_0x32bd3b,_0x491af4)[_0x4117('0x21')](function(_0x44ca51){logger[_0x4117('0x22')](_0x4117('0x23'),_0x1e8ced,_0x4117('0x24'));logger[_0x4117('0x25')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x1e8ced,_0x4117('0x24'),JSON[_0x4117('0x26')](_0x44ca51));if(_0x44ca51[_0x4117('0x27')]){if(_0x44ca51[_0x4117('0x27')]['code']===0x1f4){logger[_0x4117('0x27')](_0x4117('0x23'),_0x1e8ced,_0x44ca51[_0x4117('0x27')][_0x4117('0x28')]);return _0x44f136(_0x44ca51[_0x4117('0x27')][_0x4117('0x28')]);}logger['error'](_0x4117('0x23'),_0x1e8ced,_0x44ca51[_0x4117('0x27')][_0x4117('0x28')]);return _0x5bdbfb(_0x44ca51[_0x4117('0x27')]['message']);}else{logger[_0x4117('0x22')](_0x4117('0x23'),_0x1e8ced,'request\x20sent');_0x5bdbfb(_0x44ca51['result']['message']);}})['catch'](function(_0x14eb7a){logger[_0x4117('0x27')](_0x4117('0x23'),_0x1e8ced,_0x14eb7a);_0x44f136(_0x14eb7a);});});}function respondWithStatusCode(_0x4109b4,_0x3e3f48){_0x3e3f48=_0x3e3f48||0xcc;return function(_0x37b6da){if(_0x37b6da){return _0x4109b4[_0x4117('0x29')](_0x3e3f48);}return _0x4109b4[_0x4117('0x2a')](_0x3e3f48)['end']();};}function respondWithResult(_0x358d9b,_0x4f6cb1){_0x4f6cb1=_0x4f6cb1||0xc8;return function(_0x23a4b9){if(_0x23a4b9){return _0x358d9b[_0x4117('0x2a')](_0x4f6cb1)[_0x4117('0x2b')](_0x23a4b9);}};}function respondWithFilteredResult(_0x1082db,_0x18f142){return function(_0x2932e9){if(_0x2932e9){var _0x4f882c=typeof _0x18f142['offset']===_0x4117('0x2c')&&typeof _0x18f142[_0x4117('0x2d')]===_0x4117('0x2c');var _0x1b2c82=_0x2932e9['count'];var _0xedaee7=_0x4f882c?0x0:_0x18f142[_0x4117('0x2e')];var _0x4de93e=_0x4f882c?_0x2932e9['count']:_0x18f142[_0x4117('0x2e')]+_0x18f142[_0x4117('0x2d')];var _0x2983d3;if(_0x4de93e>=_0x1b2c82){_0x4de93e=_0x1b2c82;_0x2983d3=0xc8;}else{_0x2983d3=0xce;}_0x1082db[_0x4117('0x2a')](_0x2983d3);return _0x1082db['set']('Content-Range',_0xedaee7+'-'+_0x4de93e+'/'+_0x1b2c82)[_0x4117('0x2b')](_0x2932e9);}return null;};}function patchUpdates(_0x36c2ce){return function(_0x4a5bca){try{jsonpatch[_0x4117('0x2f')](_0x4a5bca,_0x36c2ce,!![]);}catch(_0x31d32f){return BPromise[_0x4117('0x30')](_0x31d32f);}return _0x4a5bca[_0x4117('0x31')]();};}function saveUpdates(_0x491029,_0x21acde){return function(_0x9d598d){if(_0x9d598d){return _0x9d598d[_0x4117('0x32')](_0x491029)[_0x4117('0x21')](function(_0x2cd0ca){return _0x2cd0ca;});}return null;};}function removeEntity(_0x2c55f0,_0x2e6cd6){return function(_0x167cdd){if(_0x167cdd){return _0x167cdd['destroy']()[_0x4117('0x21')](function(){_0x2c55f0[_0x4117('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46cd95,_0x1d0c21){return function(_0x1c3909){if(!_0x1c3909){_0x46cd95[_0x4117('0x29')](0x194);}return _0x1c3909;};}function handleError(_0x103037,_0x4ce9b4){_0x4ce9b4=_0x4ce9b4||0x1f4;return function(_0x42da4a){logger[_0x4117('0x27')](_0x42da4a[_0x4117('0x33')]);if(_0x42da4a[_0x4117('0x34')]){delete _0x42da4a['name'];}_0x103037['status'](_0x4ce9b4)[_0x4117('0x35')](_0x42da4a);};}exports[_0x4117('0x36')]=function(_0xdc20a1,_0xc22f07){var _0x207c59={},_0x450ae9={},_0x35d25d={'count':0x0,'rows':[]};var _0x4297a3=_[_0x4117('0x37')](db['OpenchannelMessage'][_0x4117('0x38')],function(_0x228711){return{'name':_0x228711[_0x4117('0x39')],'type':_0x228711[_0x4117('0x3a')]['key']};});_0x450ae9[_0x4117('0x3b')]=_[_0x4117('0x37')](_0x4297a3,'name');_0x450ae9['query']=_[_0x4117('0x3c')](_0xdc20a1[_0x4117('0x3d')]);_0x450ae9[_0x4117('0x3e')]=_[_0x4117('0x3f')](_0x450ae9[_0x4117('0x3b')],_0x450ae9[_0x4117('0x3d')]);_0x207c59[_0x4117('0x40')]=_[_0x4117('0x3f')](_0x450ae9[_0x4117('0x3b')],qs[_0x4117('0x41')](_0xdc20a1[_0x4117('0x3d')][_0x4117('0x41')]));_0x207c59[_0x4117('0x40')]=_0x207c59['attributes'][_0x4117('0x42')]?_0x207c59[_0x4117('0x40')]:_0x450ae9[_0x4117('0x3b')];if(!_0xdc20a1['query'][_0x4117('0x43')](_0x4117('0x44'))){_0x207c59[_0x4117('0x2d')]=qs[_0x4117('0x2d')](_0xdc20a1[_0x4117('0x3d')][_0x4117('0x2d')]);_0x207c59[_0x4117('0x2e')]=qs['offset'](_0xdc20a1['query'][_0x4117('0x2e')]);}_0x207c59[_0x4117('0x45')]=qs[_0x4117('0x46')](_0xdc20a1['query'][_0x4117('0x46')]);_0x207c59[_0x4117('0x47')]=qs['filters'](_[_0x4117('0x48')](_0xdc20a1['query'],_0x450ae9[_0x4117('0x3e')]),_0x4297a3);if(_0xdc20a1['query'][_0x4117('0x49')]){_0x207c59[_0x4117('0x47')]=_[_0x4117('0x4a')](_0x207c59[_0x4117('0x47')],{'$or':_[_0x4117('0x37')](_0x4297a3,function(_0x598144){if(_0x598144['type']!=='VIRTUAL'){var _0x11a3d9={};_0x11a3d9[_0x598144[_0x4117('0x34')]]={'$like':'%'+_0xdc20a1[_0x4117('0x3d')][_0x4117('0x49')]+'%'};return _0x11a3d9;}})});}_0x207c59=_[_0x4117('0x4a')]({},_0x207c59,_0xdc20a1['options']);var _0x5035ab={'where':_0x207c59[_0x4117('0x47')]};return db[_0x4117('0x4b')][_0x4117('0x4c')](_0x5035ab)[_0x4117('0x21')](function(_0x3f12db){_0x35d25d[_0x4117('0x4c')]=_0x3f12db;if(_0xdc20a1[_0x4117('0x3d')][_0x4117('0x4d')]){_0x207c59[_0x4117('0x4e')]=[{'all':!![]}];}return db[_0x4117('0x4b')][_0x4117('0x4f')](_0x207c59);})[_0x4117('0x21')](function(_0x27bebc){_0x35d25d[_0x4117('0x50')]=_0x27bebc;return _0x35d25d;})[_0x4117('0x21')](respondWithFilteredResult(_0xc22f07,_0x207c59))['catch'](handleError(_0xc22f07,null));};exports[_0x4117('0x51')]=function(_0x2b309d,_0x38ff3e){var _0x2912df={'raw':!![],'where':{'id':_0x2b309d[_0x4117('0x52')]['id']}},_0x5c8968={};_0x5c8968['model']=_[_0x4117('0x3c')](db[_0x4117('0x4b')][_0x4117('0x38')]);_0x5c8968[_0x4117('0x3d')]=_[_0x4117('0x3c')](_0x2b309d[_0x4117('0x3d')]);_0x5c8968[_0x4117('0x3e')]=_[_0x4117('0x3f')](_0x5c8968[_0x4117('0x3b')],_0x5c8968['query']);_0x2912df[_0x4117('0x40')]=_[_0x4117('0x3f')](_0x5c8968[_0x4117('0x3b')],qs[_0x4117('0x41')](_0x2b309d[_0x4117('0x3d')]['fields']));_0x2912df[_0x4117('0x40')]=_0x2912df[_0x4117('0x40')][_0x4117('0x42')]?_0x2912df[_0x4117('0x40')]:_0x5c8968[_0x4117('0x3b')];if(_0x2b309d['query']['includeAll']){_0x2912df[_0x4117('0x4e')]=[{'all':!![]}];}_0x2912df=_[_0x4117('0x4a')]({},_0x2912df,_0x2b309d[_0x4117('0x53')]);return db[_0x4117('0x4b')][_0x4117('0x54')](_0x2912df)[_0x4117('0x21')](handleEntityNotFound(_0x38ff3e,null))[_0x4117('0x21')](respondWithResult(_0x38ff3e,null))[_0x4117('0x55')](handleError(_0x38ff3e,null));};exports['create']=function(_0x95c5d7,_0x4ddb06){return db['OpenchannelMessage'][_0x4117('0x56')](_0x95c5d7['body'],{})['then'](respondWithResult(_0x4ddb06,0xc9))[_0x4117('0x55')](handleError(_0x4ddb06,null));};exports[_0x4117('0x32')]=function(_0x251cd2,_0x37aa38){if(_0x251cd2[_0x4117('0x57')]['id']){delete _0x251cd2[_0x4117('0x57')]['id'];}return db[_0x4117('0x4b')]['find']({'where':{'id':_0x251cd2[_0x4117('0x52')]['id']}})[_0x4117('0x21')](handleEntityNotFound(_0x37aa38,null))[_0x4117('0x21')](saveUpdates(_0x251cd2[_0x4117('0x57')],null))[_0x4117('0x21')](respondWithResult(_0x37aa38,null))[_0x4117('0x55')](handleError(_0x37aa38,null));};exports['destroy']=function(_0x27b0d8,_0x2cd560){return db[_0x4117('0x4b')][_0x4117('0x54')]({'where':{'id':_0x27b0d8[_0x4117('0x52')]['id']}})[_0x4117('0x21')](handleEntityNotFound(_0x2cd560,null))[_0x4117('0x21')](removeEntity(_0x2cd560,null))[_0x4117('0x55')](handleError(_0x2cd560,null));};exports['describe']=function(_0x2824ec,_0x46a89a){return db[_0x4117('0x4b')][_0x4117('0x58')]()['then'](respondWithResult(_0x46a89a,null))[_0x4117('0x55')](handleError(_0x46a89a,null));};var interaction_log=require(_0x4117('0x14'))('openchannel-interactions');exports[_0x4117('0x59')]=function(_0x54dd21,_0x2ff304,_0x2f2413){var _0x603db0={'agent':{},'channel':'openchannel'};if(_0x54dd21['body']['id']){delete _0x54dd21['body']['id'];}_0x54dd21['body'][_0x4117('0x5a')]=!![];_0x54dd21[_0x4117('0x57')]['readAt']=moment()['format'](_0x4117('0x5b'));_0x54dd21[_0x4117('0x57')][_0x4117('0x5c')]=_0x54dd21[_0x4117('0x57')][_0x4117('0x5c')]||_0x54dd21[_0x4117('0x5d')]['id'];_0x603db0['agent']['id']=_0x54dd21[_0x4117('0x57')][_0x4117('0x5c')];return db['OpenchannelMessage'][_0x4117('0x54')]({'where':{'id':_0x54dd21['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2ff304,null))[_0x4117('0x21')](saveUpdates(_0x54dd21[_0x4117('0x57')],null))['then'](function(_0x294391){if(_0x294391){_0x603db0['message']=_0x294391[_0x4117('0x5e')]({'plain':!![]});return db['OpenchannelInteraction'][_0x4117('0x54')]({'where':{'id':_0x294391[_0x4117('0x5f')]}});}return null;})[_0x4117('0x21')](handleEntityNotFound(_0x2ff304,null))[_0x4117('0x21')](function(_0x4ee469){if(_0x4ee469){return _0x4ee469['update']({'UserId':_0x54dd21[_0x4117('0x57')][_0x4117('0x5c')],'read1stAt':_['isNil'](_0x4ee469['read1stAt'])?moment()[_0x4117('0x60')](_0x4117('0x5b')):undefined});}return null;})[_0x4117('0x21')](function(_0x4024a0){if(_0x4024a0){_0x603db0['interaction']=_0x4024a0[_0x4117('0x5e')]({'plain':!![]});interaction_log[_0x4117('0x22')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x54dd21[_0x4117('0x5d')]['id'],_0x54dd21[_0x4117('0x5d')]['name'],_0x54dd21[_0x4117('0x5d')][_0x4117('0x61')],_0x603db0['interaction']['id'],_0x54dd21[_0x4117('0x57')]?JSON[_0x4117('0x26')](_0x54dd21[_0x4117('0x57')]):_0x4117('0x62'));return respondWithRpcPromise(_0x4117('0x63'),'acceptMessage',_0x603db0);}return null;})[_0x4117('0x21')](function(_0x34ac49){var _0x273920='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x34ac49['message']['ContactId'];return db['sequelize'][_0x4117('0x3d')](_0x273920,{'type':db['Sequelize'][_0x4117('0x64')][_0x4117('0x65')],'raw':!![]})[_0x4117('0x21')](function(_0x54f008){return _0x54f008;});})['then'](function(_0x1e02ba){if(_0x1e02ba){_0x603db0[_0x4117('0x28')][_0x4117('0x66')]=_0x1e02ba[0x0];if(!_0x54dd21[_0x4117('0x57')][_0x4117('0x5c')])return;return db['User'][_0x4117('0x54')]({'where':{'id':_0x54dd21[_0x4117('0x57')][_0x4117('0x5c')],'role':'agent'},'attributes':['id','name','fullname',_0x4117('0x67'),_0x4117('0x68')],'raw':!![]});}return null;})[_0x4117('0x21')](function(_0x5ee9d0){if(!_0x5ee9d0)return null;_0x603db0['message'][_0x4117('0x69')]=_0x5ee9d0;return _0x603db0;})[_0x4117('0x21')](function(_0x3a161f){if(_0x3a161f){if(_0x54dd21['body'][_0x4117('0x6a')]){_0x603db0['message'][_0x4117('0x6b')]=util[_0x4117('0x60')](_0x4117('0x6c'),_0x54dd21[_0x4117('0x5d')][_0x4117('0x34')]);_0x603db0[_0x4117('0x28')][_0x4117('0x6d')]=_0x603db0[_0x4117('0x6d')];_0x603db0[_0x4117('0x28')][_0x4117('0x6e')]=_0x603db0['channel'];_0x603db0['message'][_0x4117('0x6f')]=_0x4117('0x59');return respondWithRpcPromise(_0x4117('0x70'),_0x4117('0x70'),{'event':_0x4117('0x71'),'message':_0x603db0[_0x4117('0x28')]},client9002)[_0x4117('0x21')](function(){return _0x603db0;});}return _0x603db0;}return null;})[_0x4117('0x21')](respondWithResult(_0x2ff304,null))[_0x4117('0x55')](handleError(_0x2ff304,null));};var interaction_log=require(_0x4117('0x14'))(_0x4117('0x72'));exports[_0x4117('0x30')]=function(_0x52d04c,_0x466645,_0x207b19){var _0x28f6c6={'agent':{},'channel':'openchannel'};if(_0x52d04c['body']['id']){delete _0x52d04c['body']['id'];}_0x52d04c[_0x4117('0x57')][_0x4117('0x5c')]=_0x52d04c[_0x4117('0x57')][_0x4117('0x5c')]||_0x52d04c['user']['id'];_0x28f6c6[_0x4117('0x69')]['id']=_0x52d04c[_0x4117('0x57')]['UserId'];return db[_0x4117('0x4b')][_0x4117('0x54')]({'where':{'id':_0x52d04c[_0x4117('0x52')]['id'],'UserId':null}})[_0x4117('0x21')](handleEntityNotFound(_0x466645,null))['then'](function(_0xe62493){if(_0xe62493){_0x28f6c6['message']=_0xe62493['get']({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0xe62493[_0x4117('0x5f')]}});}return null;})[_0x4117('0x21')](handleEntityNotFound(_0x466645,null))[_0x4117('0x21')](function(_0x4a5778){if(_0x4a5778){_0x28f6c6['interaction']=_0x4a5778[_0x4117('0x5e')]({'plain':!![]});interaction_log['info'](_0x4117('0x73'),_0x52d04c[_0x4117('0x5d')]['id'],_0x52d04c[_0x4117('0x5d')][_0x4117('0x34')],_0x52d04c[_0x4117('0x5d')][_0x4117('0x61')],_0x28f6c6[_0x4117('0x74')]['id'],_0x52d04c[_0x4117('0x57')]?JSON[_0x4117('0x26')](_0x52d04c[_0x4117('0x57')]):_0x4117('0x62'));return respondWithRpcPromise(_0x4117('0x75'),'rejectMessage',_0x28f6c6);}return null;})[_0x4117('0x21')](function(_0x5b1a83){var _0x3c63d8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5b1a83[_0x4117('0x28')]['ContactId'];return db[_0x4117('0x76')][_0x4117('0x3d')](_0x3c63d8,{'type':db[_0x4117('0x77')]['QueryTypes'][_0x4117('0x65')],'raw':!![]})[_0x4117('0x21')](function(_0x578c08){return _0x578c08;});})[_0x4117('0x21')](function(_0x1993d9){if(_0x1993d9){_0x28f6c6['message']['contact']=_0x1993d9[0x0];if(!_0x52d04c[_0x4117('0x57')][_0x4117('0x5c')])return;return db[_0x4117('0x78')][_0x4117('0x54')]({'where':{'id':_0x52d04c[_0x4117('0x57')][_0x4117('0x5c')],'role':_0x4117('0x69')},'attributes':['id','name',_0x4117('0x79'),_0x4117('0x67'),'internal'],'raw':!![]});}return null;})[_0x4117('0x21')](function(_0x5ea09a){if(!_0x5ea09a)return null;_0x28f6c6[_0x4117('0x28')][_0x4117('0x69')]=_0x5ea09a;return _0x28f6c6;})[_0x4117('0x21')](function(_0x2d44be){if(_0x2d44be){_0x2d44be['message'][_0x4117('0x6b')]=util[_0x4117('0x60')](_0x4117('0x6c'),_0x52d04c[_0x4117('0x5d')]['name']);_0x2d44be[_0x4117('0x28')][_0x4117('0x6d')]=_0x28f6c6[_0x4117('0x6d')];_0x2d44be[_0x4117('0x28')][_0x4117('0x6e')]=_0x28f6c6[_0x4117('0x6d')];_0x2d44be['message']['event']=_0x4117('0x30');respondWithRpcPromise(_0x4117('0x70'),_0x4117('0x70'),{'event':_0x4117('0x7a'),'message':_0x2d44be['message']},client9002);return _0x28f6c6;}return null;})[_0x4117('0x21')](respondWithResult(_0x466645,null))[_0x4117('0x55')](handleError(_0x466645,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 725a5ff..84951cf 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 _0x7618=['hook','exports','events','OpenchannelMessage','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x2b1beb,_0x545b08){var _0x4b2332=function(_0x37228a){while(--_0x37228a){_0x2b1beb['push'](_0x2b1beb['shift']());}};_0x4b2332(++_0x545b08);}(_0x7618,0x17c));var _0x8761=function(_0x4eae7b,_0x1cb78e){_0x4eae7b=_0x4eae7b-0x0;var _0x332913=_0x7618[_0x4eae7b];return _0x332913;};'use strict';var EventEmitter=require(_0x8761('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x8761('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x8761('0x2')](0x0);var events={'afterCreate':_0x8761('0x3'),'afterUpdate':'update','afterDestroy':_0x8761('0x4')};function emitEvent(_0x511ba1){return function(_0x18521c,_0x289231,_0x1b5408){OpenchannelMessageEvents[_0x8761('0x5')](_0x511ba1+':'+_0x18521c['id'],_0x18521c);OpenchannelMessageEvents['emit'](_0x511ba1,_0x18521c);_0x1b5408(null);};}for(var e in events){if(events[_0x8761('0x6')](e)){var event=events[e];OpenchannelMessage[_0x8761('0x7')](e,emitEvent(event));}}module[_0x8761('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x6f78=['events','../../mysqldb','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x3734da,_0x463cf2){var _0x1944c8=function(_0x14322e){while(--_0x14322e){_0x3734da['push'](_0x3734da['shift']());}};_0x1944c8(++_0x463cf2);}(_0x6f78,0x158));var _0x86f7=function(_0x359cbf,_0x16f257){_0x359cbf=_0x359cbf-0x0;var _0x16f2be=_0x6f78[_0x359cbf];return _0x16f2be;};'use strict';var EventEmitter=require(_0x86f7('0x0'));var OpenchannelMessage=require(_0x86f7('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x86f7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x86f7('0x3'),'afterDestroy':'remove'};function emitEvent(_0x62ca30){return function(_0x31cf76,_0x54a71c,_0x14b63a){OpenchannelMessageEvents[_0x86f7('0x4')](_0x62ca30+':'+_0x31cf76['id'],_0x31cf76);OpenchannelMessageEvents[_0x86f7('0x4')](_0x62ca30,_0x31cf76);_0x14b63a(null);};}for(var e in events){if(events[_0x86f7('0x5')](e)){var event=events[e];OpenchannelMessage[_0x86f7('0x6')](e,emitEvent(event));}}module[_0x86f7('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index a768792..6163bd9 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 _0x52c7=['info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','describe','OpenchannelAccount','find','Interactions','Contact','keys','replyUri'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x52c7,0x1d9));var _0x752c=function(_0x343e70,_0xe5f373){_0x343e70=_0x343e70-0x0;var _0x2742fd=_0x52c7[_0x343e70];return _0x2742fd;};'use strict';var _=require(_0x752c('0x0'));var util=require(_0x752c('0x1'));var logger=require(_0x752c('0x2'))(_0x752c('0x3'));var moment=require(_0x752c('0x4'));var BPromise=require('bluebird');var rp=require(_0x752c('0x5'));var fs=require('fs');var path=require(_0x752c('0x6'));var rimraf=require(_0x752c('0x7'));var config=require(_0x752c('0x8'));var attributes=require(_0x752c('0x9'));module[_0x752c('0xa')]=function(_0x2031ae,_0x40bad8){return _0x2031ae[_0x752c('0xb')]('OpenchannelMessage',attributes,{'tableName':_0x752c('0xc'),'paranoid':![],'indexes':[{'name':_0x752c('0xd'),'fields':[_0x752c('0xe')],'type':_0x752c('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x119c3e,_0x5549ba,_0x44d045){var _0x35430d=_0x2031ae[_0x752c('0x10')];var _0x360ec8=_0x119c3e[_0x752c('0x11')]({'plain':!![]});if(_0x360ec8['direction'][_0x752c('0x12')]()==='in'||_0x360ec8[_0x752c('0x13')][_0x752c('0x12')]()===_0x752c('0x14')&&!_0x360ec8[_0x752c('0x15')]&&!_[_0x752c('0x16')](_0x360ec8[_0x752c('0x17')])){_0x35430d[_0x752c('0x18')][_0x752c('0x19')]({'where':{'id':_0x360ec8[_0x752c('0x1a')]}})[_0x752c('0x1b')](function(_0x280a4e){if(_0x280a4e){_0x280a4e[_0x752c('0x1c')]({'lastMsgAt':_0x360ec8[_0x752c('0x1d')],'lastMsgDirection':_0x360ec8['direction']['toLowerCase']()});}})[_0x752c('0x1e')](function(_0x506df6){console[_0x752c('0x1f')](_0x506df6);});}if(_0x360ec8[_0x752c('0x13')]==='out'&&!_0x360ec8[_0x752c('0x15')]){var _0x3a88fe;_0x35430d[_0x752c('0x20')][_0x752c('0x21')]()['then'](function(_0x327aac){return _0x35430d[_0x752c('0x22')][_0x752c('0x23')]({'where':{'id':_0x360ec8['OpenchannelAccountId']},'include':[{'model':_0x35430d['OpenchannelInteraction'],'as':_0x752c('0x24'),'where':{'id':_0x360ec8[_0x752c('0x1a')]},'limit':0x1,'include':[{'model':_0x35430d[_0x752c('0x20')],'as':_0x752c('0x25'),'attributes':_[_0x752c('0x26')](_0x327aac)}]}]});})[_0x752c('0x1b')](function(_0x52d45f){_0x3a88fe=_0x52d45f[_0x752c('0x11')]({'plain':!![]});if(_0x3a88fe&&_0x3a88fe[_0x752c('0x27')]){logger[_0x752c('0x28')](_0x752c('0x29'),_0x752c('0x2a'),util[_0x752c('0x2b')](_0x752c('0x2c'),_0x360ec8['id'],_0x3a88fe[_0x752c('0x27')]));if(_0x3a88fe['Interactions']&&_0x3a88fe[_0x752c('0x24')][_0x752c('0x2d')]){_0x360ec8[_0x752c('0x2e')]=_[_0x752c('0x2f')](_0x3a88fe[_0x752c('0x24')][0x0],'Contact');_0x360ec8['Contact']=_0x3a88fe[_0x752c('0x24')][0x0][_0x752c('0x25')];}var _0x5549ba={'method':_0x752c('0x30'),'uri':encodeURI(_0x3a88fe[_0x752c('0x27')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5549ba[_0x752c('0x31')]){case _0x752c('0x32'):_0x5549ba['qs']=_0x360ec8;break;case _0x752c('0x30'):_0x5549ba['body']=_0x360ec8;break;}return rp(_0x5549ba)[_0x752c('0x1b')](function(_0x431959){logger[_0x752c('0x28')](_0x752c('0x29'),_0x752c('0x2a'),util[_0x752c('0x2b')](_0x752c('0x33'),_0x360ec8['id'],_0x3a88fe[_0x752c('0x27')]));if(_0x431959[_0x752c('0xe')][_0x752c('0x34')]&&_0x431959[_0x752c('0xe')]['threadId']!=_0x360ec8[_0x752c('0x2e')][_0x752c('0x34')]){return _0x35430d[_0x752c('0x18')][_0x752c('0x1c')]({'threadId':_0x431959['body'][_0x752c('0x34')]},{'where':{'id':_0x360ec8['Interaction']['id']}});}else{return;}})[_0x752c('0x1b')](function(){return _0x119c3e[_0x752c('0x1c')]({'read':!![]});})['catch'](function(_0x20efc3){logger['error']('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x752c('0x35')](_0x20efc3,{'showHidden':![],'depth':null}));_0x44d045();});}else{_0x44d045();}})[_0x752c('0x36')](function(){_0x44d045();});}else{_0x44d045();}}},'charset':_0x752c('0x37'),'collate':_0x752c('0x38')});}; \ No newline at end of file +var _0xb403=['keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','length','Interaction','omit','method','GET','POST','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','describe','OpenchannelAccount','OpenchannelAccountId','Interactions','Contact'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb403,0x10b));var _0x3b40=function(_0x4b634f,_0x4c0372){_0x4b634f=_0x4b634f-0x0;var _0x302e3c=_0xb403[_0x4b634f];return _0x302e3c;};'use strict';var _=require(_0x3b40('0x0'));var util=require('util');var logger=require(_0x3b40('0x1'))(_0x3b40('0x2'));var moment=require('moment');var BPromise=require(_0x3b40('0x3'));var rp=require(_0x3b40('0x4'));var fs=require('fs');var path=require(_0x3b40('0x5'));var rimraf=require(_0x3b40('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelMessage.attributes');module['exports']=function(_0x88bce0,_0x17bbc7){return _0x88bce0['define'](_0x3b40('0x7'),attributes,{'tableName':_0x3b40('0x8'),'paranoid':![],'indexes':[{'name':_0x3b40('0x9'),'fields':[_0x3b40('0xa')],'type':_0x3b40('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x48f36a,_0x32bdc4,_0x55ef42){var _0x12da84=_0x88bce0[_0x3b40('0xc')];var _0x453006=_0x48f36a[_0x3b40('0xd')]({'plain':!![]});if(_0x453006[_0x3b40('0xe')]['toLowerCase']()==='in'||_0x453006[_0x3b40('0xe')][_0x3b40('0xf')]()===_0x3b40('0x10')&&!_0x453006[_0x3b40('0x11')]&&!_[_0x3b40('0x12')](_0x453006['UserId'])){_0x12da84[_0x3b40('0x13')][_0x3b40('0x14')]({'where':{'id':_0x453006[_0x3b40('0x15')]}})[_0x3b40('0x16')](function(_0xe8114a){if(_0xe8114a){_0xe8114a[_0x3b40('0x17')]({'lastMsgAt':_0x453006[_0x3b40('0x18')],'lastMsgDirection':_0x453006[_0x3b40('0xe')]['toLowerCase']()});}})[_0x3b40('0x19')](function(_0x3ca79c){console[_0x3b40('0x1a')](_0x3ca79c);});}if(_0x453006[_0x3b40('0xe')]===_0x3b40('0x10')&&!_0x453006[_0x3b40('0x11')]){var _0xb5019d;_0x12da84[_0x3b40('0x1b')][_0x3b40('0x1c')]()['then'](function(_0xb3124e){return _0x12da84[_0x3b40('0x1d')]['find']({'where':{'id':_0x453006[_0x3b40('0x1e')]},'include':[{'model':_0x12da84[_0x3b40('0x13')],'as':_0x3b40('0x1f'),'where':{'id':_0x453006[_0x3b40('0x15')]},'limit':0x1,'include':[{'model':_0x12da84['CmContact'],'as':_0x3b40('0x20'),'attributes':_[_0x3b40('0x21')](_0xb3124e)}]}]});})['then'](function(_0x24bf57){_0xb5019d=_0x24bf57['get']({'plain':!![]});if(_0xb5019d&&_0xb5019d[_0x3b40('0x22')]){logger[_0x3b40('0x23')](_0x3b40('0x24'),_0x3b40('0x25'),util[_0x3b40('0x26')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x453006['id'],_0xb5019d['replyUri']));if(_0xb5019d[_0x3b40('0x1f')]&&_0xb5019d[_0x3b40('0x1f')][_0x3b40('0x27')]){_0x453006[_0x3b40('0x28')]=_[_0x3b40('0x29')](_0xb5019d[_0x3b40('0x1f')][0x0],'Contact');_0x453006['Contact']=_0xb5019d[_0x3b40('0x1f')][0x0]['Contact'];}var _0x32bdc4={'method':'POST','uri':encodeURI(_0xb5019d[_0x3b40('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x32bdc4[_0x3b40('0x2a')]){case _0x3b40('0x2b'):_0x32bdc4['qs']=_0x453006;break;case _0x3b40('0x2c'):_0x32bdc4[_0x3b40('0xa')]=_0x453006;break;}return rp(_0x32bdc4)[_0x3b40('0x16')](function(_0x52944b){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x3b40('0x25'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x453006['id'],_0xb5019d[_0x3b40('0x22')]));if(_0x52944b[_0x3b40('0xa')][_0x3b40('0x2d')]&&_0x52944b[_0x3b40('0xa')]['threadId']!=_0x453006[_0x3b40('0x28')][_0x3b40('0x2d')]){return _0x12da84[_0x3b40('0x13')][_0x3b40('0x17')]({'threadId':_0x52944b[_0x3b40('0xa')]['threadId']},{'where':{'id':_0x453006[_0x3b40('0x28')]['id']}});}else{return;}})['then'](function(){return _0x48f36a[_0x3b40('0x17')]({'read':!![]});})[_0x3b40('0x19')](function(_0x3c2180){logger['error'](_0x3b40('0x24'),_0x3b40('0x25'),util[_0x3b40('0x2e')](_0x3c2180,{'showHidden':![],'depth':null}));_0x55ef42();});}else{_0x55ef42();}})[_0x3b40('0x2f')](function(){_0x55ef42();});}else{_0x55ef42();}}},'charset':_0x3b40('0x30'),'collate':_0x3b40('0x31')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 702226e..ca3b9d4 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 _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x227bd0,_0x29e109){var _0x1d48c0=function(_0x53e0c6){while(--_0x53e0c6){_0x227bd0['push'](_0x227bd0['shift']());}};_0x1d48c0(++_0x29e109);}(_0x2ef3,0xba));var _0x32ef=function(_0xf3d19,_0x368fec){_0xf3d19=_0xf3d19-0x0;var _0x6c500a=_0x2ef3[_0xf3d19];return _0x6c500a;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file +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(_0x11bfc8,_0xc95100){var _0x4ad0bd=function(_0x1b9907){while(--_0x1b9907){_0x11bfc8['push'](_0x11bfc8['shift']());}};_0x4ad0bd(++_0xc95100);}(_0x1261,0x144));var _0x1126=function(_0x4f6afc,_0x4dfa88){_0x4f6afc=_0x4f6afc-0x0;var _0x256eeb=_0x1261[_0x4f6afc];return _0x256eeb;};'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 diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 7863444..1018b52 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 _0xf015=['remove','emit','removeListener','register','length'];(function(_0x1037c6,_0xeef231){var _0x505213=function(_0x17be84){while(--_0x17be84){_0x1037c6['push'](_0x1037c6['shift']());}};_0x505213(++_0xeef231);}(_0xf015,0x13b));var _0x5f01=function(_0x2e79da,_0xada0bf){_0x2e79da=_0x2e79da-0x0;var _0x83e84d=_0xf015[_0x2e79da];return _0x83e84d;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x5f01('0x0'),'update'];function createListener(_0x4ee3fd,_0x36cf4c){return function(_0x484077){_0x36cf4c[_0x5f01('0x1')](_0x4ee3fd,_0x484077);};}function removeListener(_0x524009,_0x33fd75){return function(){OpenchannelMessageEvents[_0x5f01('0x2')](_0x524009,_0x33fd75);};}exports[_0x5f01('0x3')]=function(_0x454de5){for(var _0x122dd0=0x0,_0x5bc7a3=events[_0x5f01('0x4')];_0x122dd0<_0x5bc7a3;_0x122dd0++){var _0x3d35da=events[_0x122dd0];var _0xb5cfef=createListener('openchannelMessage:'+_0x3d35da,_0x454de5);OpenchannelMessageEvents['on'](_0x3d35da,_0xb5cfef);}}; \ No newline at end of file +var _0x9d3e=['openchannelMessage:','./openchannelMessage.events','save','remove','update','emit','removeListener','register','length'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x9d3e,0x1c3));var _0xe9d3=function(_0x49af5a,_0xdac72){_0x49af5a=_0x49af5a-0x0;var _0x5e8982=_0x9d3e[_0x49af5a];return _0x5e8982;};'use strict';var OpenchannelMessageEvents=require(_0xe9d3('0x0'));var events=[_0xe9d3('0x1'),_0xe9d3('0x2'),_0xe9d3('0x3')];function createListener(_0x2be465,_0x38c5f4){return function(_0x1ece9c){_0x38c5f4[_0xe9d3('0x4')](_0x2be465,_0x1ece9c);};}function removeListener(_0x4c067e,_0x3be476){return function(){OpenchannelMessageEvents[_0xe9d3('0x5')](_0x4c067e,_0x3be476);};}exports[_0xe9d3('0x6')]=function(_0x11c97b){for(var _0x36b7ba=0x0,_0x2af894=events[_0xe9d3('0x7')];_0x36b7ba<_0x2af894;_0x36b7ba++){var _0x5d44dc=events[_0x36b7ba];var _0x448288=createListener(_0xe9d3('0x8')+_0x5d44dc,_0x11c97b);OpenchannelMessageEvents['on'](_0x5d44dc,_0x448288);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index f1e2ef5..58bc717 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 _0x3e59=['/:id','show','/:id/members','getMembers','getTeams','post','create','/:id/teams','addTeams','/:id/users','put','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x3c6a65,_0x56fb98){var _0x48df1e=function(_0x567402){while(--_0x567402){_0x3c6a65['push'](_0x3c6a65['shift']());}};_0x48df1e(++_0x56fb98);}(_0x3e59,0x1f0));var _0x93e5=function(_0x2e04ef,_0x31a596){_0x2e04ef=_0x2e04ef-0x0;var _0x5722b0=_0x3e59[_0x2e04ef];return _0x5722b0;};'use strict';var multer=require(_0x93e5('0x0'));var util=require(_0x93e5('0x1'));var path=require(_0x93e5('0x2'));var timeout=require(_0x93e5('0x3'));var express=require(_0x93e5('0x4'));var router=express[_0x93e5('0x5')]();var fs_extra=require(_0x93e5('0x6'));var auth=require(_0x93e5('0x7'));var interaction=require(_0x93e5('0x8'));var config=require(_0x93e5('0x9'));var controller=require(_0x93e5('0xa'));router[_0x93e5('0xb')]('/',auth[_0x93e5('0xc')](),controller[_0x93e5('0xd')]);router[_0x93e5('0xb')](_0x93e5('0xe'),auth['isAuthenticated'](),controller[_0x93e5('0xf')]);router['get'](_0x93e5('0x10'),auth[_0x93e5('0xc')](),controller[_0x93e5('0x11')]);router[_0x93e5('0xb')](_0x93e5('0x12'),auth[_0x93e5('0xc')](),controller[_0x93e5('0x13')]);router[_0x93e5('0xb')]('/:id/teams',auth[_0x93e5('0xc')](),controller[_0x93e5('0x14')]);router[_0x93e5('0xb')]('/:id/users',auth[_0x93e5('0xc')](),controller['getAgents']);router[_0x93e5('0x15')]('/',auth[_0x93e5('0xc')](),controller[_0x93e5('0x16')]);router['post'](_0x93e5('0x17'),auth['isAuthenticated'](),controller[_0x93e5('0x18')]);router['post'](_0x93e5('0x19'),auth['isAuthenticated'](),controller['addAgents']);router[_0x93e5('0x1a')](_0x93e5('0x10'),auth['isAuthenticated'](),controller[_0x93e5('0x1b')]);router[_0x93e5('0x1c')](_0x93e5('0x10'),auth[_0x93e5('0xc')](),controller[_0x93e5('0x1d')]);router[_0x93e5('0x1c')](_0x93e5('0x17'),auth['isAuthenticated'](),controller[_0x93e5('0x1e')]);router['delete'](_0x93e5('0x19'),auth[_0x93e5('0xc')](),controller[_0x93e5('0x1f')]);module['exports']=router; \ No newline at end of file +var _0xd422=['addAgents','update','delete','destroy','removeAgents','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','/describe','describe','get','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','post','addTeams'];(function(_0x3c0084,_0x1e37eb){var _0x356f94=function(_0xfccbcc){while(--_0xfccbcc){_0x3c0084['push'](_0x3c0084['shift']());}};_0x356f94(++_0x1e37eb);}(_0xd422,0x13e));var _0x2d42=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xd422[_0xbd08b4];return _0x314f1e;};'use strict';var multer=require(_0x2d42('0x0'));var util=require('util');var path=require(_0x2d42('0x1'));var timeout=require(_0x2d42('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2d42('0x3'));var auth=require(_0x2d42('0x4'));var interaction=require(_0x2d42('0x5'));var config=require(_0x2d42('0x6'));var controller=require(_0x2d42('0x7'));router['get']('/',auth[_0x2d42('0x8')](),controller['index']);router['get'](_0x2d42('0x9'),auth['isAuthenticated'](),controller[_0x2d42('0xa')]);router[_0x2d42('0xb')](_0x2d42('0xc'),auth[_0x2d42('0x8')](),controller[_0x2d42('0xd')]);router[_0x2d42('0xb')](_0x2d42('0xe'),auth['isAuthenticated'](),controller[_0x2d42('0xf')]);router[_0x2d42('0xb')](_0x2d42('0x10'),auth[_0x2d42('0x8')](),controller[_0x2d42('0x11')]);router[_0x2d42('0xb')]('/:id/users',auth[_0x2d42('0x8')](),controller['getAgents']);router[_0x2d42('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2d42('0x12')](_0x2d42('0x10'),auth['isAuthenticated'](),controller[_0x2d42('0x13')]);router[_0x2d42('0x12')]('/:id/users',auth[_0x2d42('0x8')](),controller[_0x2d42('0x14')]);router['put'](_0x2d42('0xc'),auth[_0x2d42('0x8')](),controller[_0x2d42('0x15')]);router[_0x2d42('0x16')]('/:id',auth[_0x2d42('0x8')](),controller[_0x2d42('0x17')]);router['delete']('/:id/teams',auth[_0x2d42('0x8')](),controller['removeTeams']);router[_0x2d42('0x16')]('/:id/users',auth[_0x2d42('0x8')](),controller[_0x2d42('0x18')]);module[_0x2d42('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 5d9848c..cd0fb3b 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 _0x3bc3=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','name'];(function(_0x308bb2,_0x28ba87){var _0x2a67ea=function(_0x3dfe33){while(--_0x3dfe33){_0x308bb2['push'](_0x308bb2['shift']());}};_0x2a67ea(++_0x28ba87);}(_0x3bc3,0x15c));var _0x33bc=function(_0x8ac776,_0x3d4684){_0x8ac776=_0x8ac776-0x0;var _0x49a75d=_0x3bc3[_0x8ac776];return _0x49a75d;};'use strict';var Sequelize=require(_0x33bc('0x0'));module[_0x33bc('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x33bc('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x33bc('0x3')]},'timeout':{'type':Sequelize[_0x33bc('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x33bc('0x5')](_0x33bc('0x6'),_0x33bc('0x7'),_0x33bc('0x8'))}}; \ No newline at end of file +var _0x9e4d=['sequelize','exports','name','STRING','ENUM','rrmemory','beepall','roundrobin'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x9e4d,0xc0));var _0xd9e4=function(_0x1cdf49,_0xe1aafb){_0x1cdf49=_0x1cdf49-0x0;var _0x5cd17d=_0x9e4d[_0x1cdf49];return _0x5cd17d;};'use strict';var Sequelize=require(_0xd9e4('0x0'));module[_0xd9e4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd9e4('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd9e4('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd9e4('0x4')](_0xd9e4('0x5'),_0xd9e4('0x6'),_0xd9e4('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 1239cce..f70d5df 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 _0xa5aa=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','OpenchannelQueue','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','body','describe','findOne','UserOpenchannelQueue','OpenchannelQueueId','findAll','User','findAndCountAll','openchannelPause','updatedAt','createdAt','getTeams','addTeams','ids','Team','Agents','voicePause','flatMap','transaction','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','sequelize','toString','SELECT','every','TeamId','all','union','compact','value','removeAgents','emit','userOpenchannelQueue:remove','spread','isArray','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x4a4bde,_0x3fcd53){var _0x7532f1=function(_0x36746f){while(--_0x36746f){_0x4a4bde['push'](_0x4a4bde['shift']());}};_0x7532f1(++_0x3fcd53);}(_0xa5aa,0x192));var _0xaa5a=function(_0x33d00e,_0x39914d){_0x33d00e=_0x33d00e-0x0;var _0x3886f3=_0xa5aa[_0x33d00e];return _0x3886f3;};'use strict';var emlformat=require(_0xaa5a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaa5a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa5a('0x2'));var moment=require(_0xaa5a('0x3'));var BPromise=require(_0xaa5a('0x4'));var Mustache=require('mustache');var util=require(_0xaa5a('0x5'));var path=require('path');var sox=require(_0xaa5a('0x6'));var csv=require(_0xaa5a('0x7'));var ejs=require(_0xaa5a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa5a('0x9'));var squel=require(_0xaa5a('0xa'));var crypto=require(_0xaa5a('0xb'));var jsforce=require(_0xaa5a('0xc'));var deskjs=require(_0xaa5a('0xd'));var toCsv=require('to-csv');var querystring=require(_0xaa5a('0xe'));var Papa=require(_0xaa5a('0xf'));var Redis=require(_0xaa5a('0x10'));var authService=require(_0xaa5a('0x11'));var qs=require(_0xaa5a('0x12'));var as=require(_0xaa5a('0x13'));var hardwareService=require(_0xaa5a('0x14'));var logger=require(_0xaa5a('0x15'))(_0xaa5a('0x16'));var utils=require(_0xaa5a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xaa5a('0x18'));var db=require(_0xaa5a('0x19'))['db'];config[_0xaa5a('0x1a')]=_['defaults'](config[_0xaa5a('0x1a')],{'host':_0xaa5a('0x1b'),'port':0x18eb});var socket=require(_0xaa5a('0x1c'))(new Redis(config[_0xaa5a('0x1a')]));require(_0xaa5a('0x1d'))[_0xaa5a('0x1e')](socket);function respondWithStatusCode(_0x1e78bf,_0x44c1b8){_0x44c1b8=_0x44c1b8||0xcc;return function(_0xaf8ab8){if(_0xaf8ab8){return _0x1e78bf[_0xaa5a('0x1f')](_0x44c1b8);}return _0x1e78bf[_0xaa5a('0x20')](_0x44c1b8)[_0xaa5a('0x21')]();};}function respondWithResult(_0x577b3a,_0x11bb01){_0x11bb01=_0x11bb01||0xc8;return function(_0x1150ab){if(_0x1150ab){return _0x577b3a[_0xaa5a('0x20')](_0x11bb01)['json'](_0x1150ab);}};}function respondWithFilteredResult(_0x3996ae,_0x589240){return function(_0x3f648d){if(_0x3f648d){var _0x1ddc77=typeof _0x589240[_0xaa5a('0x22')]===_0xaa5a('0x23')&&typeof _0x589240[_0xaa5a('0x24')]===_0xaa5a('0x23');var _0x3e94a8=_0x3f648d['count'];var _0x7d1a5b=_0x1ddc77?0x0:_0x589240['offset'];var _0x24a4f0=_0x1ddc77?_0x3f648d[_0xaa5a('0x25')]:_0x589240[_0xaa5a('0x22')]+_0x589240[_0xaa5a('0x24')];var _0x5a57a9;if(_0x24a4f0>=_0x3e94a8){_0x24a4f0=_0x3e94a8;_0x5a57a9=0xc8;}else{_0x5a57a9=0xce;}_0x3996ae[_0xaa5a('0x20')](_0x5a57a9);return _0x3996ae[_0xaa5a('0x26')](_0xaa5a('0x27'),_0x7d1a5b+'-'+_0x24a4f0+'/'+_0x3e94a8)[_0xaa5a('0x28')](_0x3f648d);}return null;};}function patchUpdates(_0x9771b6){return function(_0x3b2e53){try{jsonpatch['apply'](_0x3b2e53,_0x9771b6,!![]);}catch(_0x5ad460){return BPromise[_0xaa5a('0x29')](_0x5ad460);}return _0x3b2e53[_0xaa5a('0x2a')]();};}function saveUpdates(_0x31ad20,_0x3d49b1){return function(_0x185774){if(_0x185774){return _0x185774[_0xaa5a('0x2b')](_0x31ad20)[_0xaa5a('0x2c')](function(_0x1e45e9){return _0x1e45e9;});}return null;};}function removeEntity(_0x43fc39,_0x34f216){return function(_0x47ba58){if(_0x47ba58){return _0x47ba58[_0xaa5a('0x2d')]()[_0xaa5a('0x2c')](function(){var _0x4f6ff2=_0x47ba58['get']({'plain':!![]});var _0x26fa5b=_0xaa5a('0x2e');return db[_0xaa5a('0x2f')][_0xaa5a('0x2d')]({'where':{'type':_0x26fa5b,'resourceId':_0x4f6ff2['id']}})[_0xaa5a('0x2c')](function(){return _0x47ba58;});})[_0xaa5a('0x2c')](function(){_0x43fc39[_0xaa5a('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d0457,_0x426940){return function(_0x4dfa87){if(!_0x4dfa87){_0x4d0457[_0xaa5a('0x1f')](0x194);}return _0x4dfa87;};}function handleError(_0x84afe1,_0x8250a6){_0x8250a6=_0x8250a6||0x1f4;return function(_0x11c448){logger[_0xaa5a('0x30')](_0x11c448[_0xaa5a('0x31')]);if(_0x11c448[_0xaa5a('0x32')]){delete _0x11c448['name'];}_0x84afe1[_0xaa5a('0x20')](_0x8250a6)[_0xaa5a('0x33')](_0x11c448);};}exports[_0xaa5a('0x34')]=function(_0x5320f0,_0x5e8c3b){var _0x49ef00={},_0x115259={},_0x16b4c9={'count':0x0,'rows':[]};var _0x16f3b2=_[_0xaa5a('0x35')](db['OpenchannelQueue'][_0xaa5a('0x36')],function(_0x403620){return{'name':_0x403620[_0xaa5a('0x37')],'type':_0x403620['type'][_0xaa5a('0x38')]};});_0x115259[_0xaa5a('0x39')]=_[_0xaa5a('0x35')](_0x16f3b2,_0xaa5a('0x32'));_0x115259[_0xaa5a('0x3a')]=_[_0xaa5a('0x3b')](_0x5320f0[_0xaa5a('0x3a')]);_0x115259[_0xaa5a('0x3c')]=_['intersection'](_0x115259['model'],_0x115259[_0xaa5a('0x3a')]);_0x49ef00[_0xaa5a('0x3d')]=_[_0xaa5a('0x3e')](_0x115259[_0xaa5a('0x39')],qs[_0xaa5a('0x3f')](_0x5320f0['query'][_0xaa5a('0x3f')]));_0x49ef00[_0xaa5a('0x3d')]=_0x49ef00[_0xaa5a('0x3d')][_0xaa5a('0x40')]?_0x49ef00[_0xaa5a('0x3d')]:_0x115259[_0xaa5a('0x39')];if(!_0x5320f0['query'][_0xaa5a('0x41')](_0xaa5a('0x42'))){_0x49ef00[_0xaa5a('0x24')]=qs[_0xaa5a('0x24')](_0x5320f0['query'][_0xaa5a('0x24')]);_0x49ef00['offset']=qs[_0xaa5a('0x22')](_0x5320f0[_0xaa5a('0x3a')]['offset']);}_0x49ef00[_0xaa5a('0x43')]=qs['sort'](_0x5320f0[_0xaa5a('0x3a')][_0xaa5a('0x44')]);_0x49ef00[_0xaa5a('0x45')]=qs[_0xaa5a('0x3c')](_[_0xaa5a('0x46')](_0x5320f0[_0xaa5a('0x3a')],_0x115259[_0xaa5a('0x3c')]),_0x16f3b2);if(_0x5320f0[_0xaa5a('0x3a')][_0xaa5a('0x47')]){_0x49ef00['where']=_[_0xaa5a('0x48')](_0x49ef00[_0xaa5a('0x45')],{'$or':_['map'](_0x16f3b2,function(_0x43ea04){if(_0x43ea04[_0xaa5a('0x49')]!==_0xaa5a('0x4a')){var _0x569d62={};_0x569d62[_0x43ea04[_0xaa5a('0x32')]]={'$like':'%'+_0x5320f0[_0xaa5a('0x3a')][_0xaa5a('0x47')]+'%'};return _0x569d62;}})});}_0x49ef00=_[_0xaa5a('0x48')]({},_0x49ef00,_0x5320f0[_0xaa5a('0x4b')]);var _0xaded7={'where':_0x49ef00[_0xaa5a('0x45')]};return db['OpenchannelQueue'][_0xaa5a('0x25')](_0xaded7)[_0xaa5a('0x2c')](function(_0x2b607f){_0x16b4c9[_0xaa5a('0x25')]=_0x2b607f;if(_0x5320f0[_0xaa5a('0x3a')][_0xaa5a('0x4c')]){_0x49ef00[_0xaa5a('0x4d')]=[{'all':!![]}];}return db['OpenchannelQueue']['findAll'](_0x49ef00);})[_0xaa5a('0x2c')](function(_0x374650){_0x16b4c9[_0xaa5a('0x4e')]=_0x374650;return _0x16b4c9;})[_0xaa5a('0x2c')](respondWithFilteredResult(_0x5e8c3b,_0x49ef00))[_0xaa5a('0x4f')](handleError(_0x5e8c3b,null));};exports[_0xaa5a('0x50')]=function(_0x2685a4,_0x32d3c6){var _0x5c342b={'raw':!![],'where':{'id':_0x2685a4[_0xaa5a('0x51')]['id']}},_0x4c6717={};_0x4c6717[_0xaa5a('0x39')]=_[_0xaa5a('0x3b')](db[_0xaa5a('0x52')]['rawAttributes']);_0x4c6717[_0xaa5a('0x3a')]=_[_0xaa5a('0x3b')](_0x2685a4[_0xaa5a('0x3a')]);_0x4c6717['filters']=_[_0xaa5a('0x3e')](_0x4c6717[_0xaa5a('0x39')],_0x4c6717['query']);_0x5c342b['attributes']=_['intersection'](_0x4c6717['model'],qs['fields'](_0x2685a4[_0xaa5a('0x3a')][_0xaa5a('0x3f')]));_0x5c342b['attributes']=_0x5c342b[_0xaa5a('0x3d')][_0xaa5a('0x40')]?_0x5c342b[_0xaa5a('0x3d')]:_0x4c6717[_0xaa5a('0x39')];if(_0x2685a4[_0xaa5a('0x3a')][_0xaa5a('0x4c')]){_0x5c342b[_0xaa5a('0x4d')]=[{'all':!![]}];}_0x5c342b=_['merge']({},_0x5c342b,_0x2685a4['options']);return db[_0xaa5a('0x52')][_0xaa5a('0x53')](_0x5c342b)[_0xaa5a('0x2c')](handleEntityNotFound(_0x32d3c6,null))[_0xaa5a('0x2c')](respondWithResult(_0x32d3c6,null))['catch'](handleError(_0x32d3c6,null));};exports[_0xaa5a('0x54')]=function(_0x213c03,_0x1ae2f9){return db['OpenchannelQueue'][_0xaa5a('0x54')](_0x213c03['body'],{})[_0xaa5a('0x2c')](function(_0xb28542){var _0x127022=_0x213c03['user'][_0xaa5a('0x55')]({'plain':!![]});if(!_0x127022)throw new Error(_0xaa5a('0x56'));if(_0x127022[_0xaa5a('0x57')]===_0xaa5a('0x58')){var _0x22d965=_0xb28542[_0xaa5a('0x55')]({'plain':!![]});var _0x2d83da=_0xaa5a('0x2e');return db[_0xaa5a('0x59')][_0xaa5a('0x53')]({'where':{'name':_0x2d83da,'userProfileId':_0x127022[_0xaa5a('0x5a')]},'raw':!![]})[_0xaa5a('0x2c')](function(_0x71ddbe){if(_0x71ddbe&&_0x71ddbe[_0xaa5a('0x5b')]===0x0){return db['UserProfileResource']['create']({'name':_0x22d965[_0xaa5a('0x32')],'resourceId':_0x22d965['id'],'type':_0x71ddbe[_0xaa5a('0x32')],'sectionId':_0x71ddbe['id']},{})[_0xaa5a('0x2c')](function(){return _0xb28542;});}else{return _0xb28542;}})[_0xaa5a('0x4f')](function(_0xf08e95){logger[_0xaa5a('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf08e95);throw _0xf08e95;});}return _0xb28542;})['then'](respondWithResult(_0x1ae2f9,0xc9))[_0xaa5a('0x4f')](handleError(_0x1ae2f9,null));};exports[_0xaa5a('0x2b')]=function(_0x45299c,_0x59755d){if(_0x45299c[_0xaa5a('0x5c')]['id']){delete _0x45299c[_0xaa5a('0x5c')]['id'];}return db[_0xaa5a('0x52')][_0xaa5a('0x53')]({'where':{'id':_0x45299c[_0xaa5a('0x51')]['id']}})[_0xaa5a('0x2c')](handleEntityNotFound(_0x59755d,null))[_0xaa5a('0x2c')](saveUpdates(_0x45299c['body'],null))[_0xaa5a('0x2c')](respondWithResult(_0x59755d,null))[_0xaa5a('0x4f')](handleError(_0x59755d,null));};exports[_0xaa5a('0x2d')]=function(_0x13a5e0,_0x31e3b3){return db[_0xaa5a('0x52')]['find']({'where':{'id':_0x13a5e0['params']['id']}})[_0xaa5a('0x2c')](handleEntityNotFound(_0x31e3b3,null))[_0xaa5a('0x2c')](removeEntity(_0x31e3b3,null))[_0xaa5a('0x4f')](handleError(_0x31e3b3,null));};exports['describe']=function(_0x9970c8,_0x1cf1ab){return db[_0xaa5a('0x52')][_0xaa5a('0x5d')]()['then'](respondWithResult(_0x1cf1ab,null))[_0xaa5a('0x4f')](handleError(_0x1cf1ab,null));};exports['getMembers']=function(_0x31e2f5,_0x2ecaab,_0x127f42){var _0x1cf402={'raw':!![],'where':{}},_0x3880bf={},_0x1f3519;return db[_0xaa5a('0x52')][_0xaa5a('0x5e')]({'where':{'id':_0x31e2f5[_0xaa5a('0x51')]['id']}})['then'](handleEntityNotFound(_0x2ecaab,null))[_0xaa5a('0x2c')](function(_0x11ec7e){if(_0x11ec7e){_0x1f3519=_0x11ec7e[_0xaa5a('0x55')]({'plain':!![]});_0x3880bf[_0xaa5a('0x39')]=_[_0xaa5a('0x3b')](db[_0xaa5a('0x5f')][_0xaa5a('0x36')]);_0x3880bf[_0xaa5a('0x3a')]=_['keys'](_0x31e2f5[_0xaa5a('0x3a')]);_0x3880bf['filters']=_['intersection'](_0x3880bf[_0xaa5a('0x39')],_0x3880bf['query']);_0x1cf402['attributes']=_[_0xaa5a('0x3e')](_0x3880bf[_0xaa5a('0x39')],qs[_0xaa5a('0x3f')](_0x31e2f5['query'][_0xaa5a('0x3f')]));_0x1cf402[_0xaa5a('0x3d')]=_0x1cf402[_0xaa5a('0x3d')][_0xaa5a('0x40')]?_0x1cf402[_0xaa5a('0x3d')]:_0x3880bf[_0xaa5a('0x39')];if(!_0x31e2f5['query'][_0xaa5a('0x41')]('nolimit')){_0x1cf402[_0xaa5a('0x24')]=qs[_0xaa5a('0x24')](_0x31e2f5['query']['limit']);_0x1cf402[_0xaa5a('0x22')]=qs['offset'](_0x31e2f5[_0xaa5a('0x3a')][_0xaa5a('0x22')]);}_0x1cf402[_0xaa5a('0x43')]=qs[_0xaa5a('0x44')](_0x31e2f5[_0xaa5a('0x3a')][_0xaa5a('0x44')]);_0x1cf402[_0xaa5a('0x45')]=qs[_0xaa5a('0x3c')](_[_0xaa5a('0x46')](_0x31e2f5[_0xaa5a('0x3a')],_0x3880bf[_0xaa5a('0x3c')]));_0x1cf402['where'][_0xaa5a('0x60')]=_0x11ec7e['id'];if(_0x31e2f5[_0xaa5a('0x3a')][_0xaa5a('0x47')]){_0x1cf402[_0xaa5a('0x45')]=_[_0xaa5a('0x48')](_0x1cf402['where'],{'$or':_[_0xaa5a('0x35')](_0x1cf402[_0xaa5a('0x3d')],function(_0x56160e){var _0x8fb1e2={};_0x8fb1e2[_0x56160e]={'$like':'%'+_0x31e2f5['query'][_0xaa5a('0x47')]+'%'};return _0x8fb1e2;})});}_0x1cf402=_[_0xaa5a('0x48')]({},_0x1cf402,_0x31e2f5[_0xaa5a('0x4b')]);return db[_0xaa5a('0x5f')][_0xaa5a('0x61')](_0x1cf402);}})[_0xaa5a('0x2c')](function(_0x1b9462){if(_0x1b9462){return db[_0xaa5a('0x62')][_0xaa5a('0x63')]({'where':{'id':_[_0xaa5a('0x35')](_0x1b9462,'UserId'),'role':'agent'},'attributes':['id',_0xaa5a('0x32'),_0xaa5a('0x64'),_0xaa5a('0x65'),_0xaa5a('0x66')]});}})[_0xaa5a('0x2c')](function(_0x4e291e){if(_0x4e291e){return{'count':_0x4e291e['count'],'rows':_[_0xaa5a('0x35')](_0x4e291e['rows'],function(_0x5c01d0){return{'membername':_0x5c01d0[_0xaa5a('0x32')],'UserId':_0x5c01d0['id'],'queue_name':_0x1f3519[_0xaa5a('0x32')],'OpenchannelQueueId':_0x1f3519['id'],'interface':util['format']('%s/%s','SIP',_0x5c01d0['name']),'penalty':0x0,'paused':_0x5c01d0[_0xaa5a('0x64')],'createdAt':_0x5c01d0[_0xaa5a('0x66')],'updatedAt':_0x5c01d0[_0xaa5a('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xaa5a('0x2c')](respondWithFilteredResult(_0x2ecaab,_0x1cf402))[_0xaa5a('0x4f')](handleError(_0x2ecaab,null));};exports[_0xaa5a('0x67')]=function(_0x5e713e,_0x187d71,_0x580836){var _0x398b81={};var _0x4cb0af={};var _0x2a7912;var _0x31ae00;return db[_0xaa5a('0x52')]['findOne']({'where':{'id':_0x5e713e[_0xaa5a('0x51')]['id']}})[_0xaa5a('0x2c')](handleEntityNotFound(_0x187d71,null))[_0xaa5a('0x2c')](function(_0x51d2f3){if(_0x51d2f3){_0x2a7912=_0x51d2f3;_0x4cb0af[_0xaa5a('0x39')]=_[_0xaa5a('0x3b')](db['Team'][_0xaa5a('0x36')]);_0x4cb0af[_0xaa5a('0x3a')]=_[_0xaa5a('0x3b')](_0x5e713e['query']);_0x4cb0af['filters']=_[_0xaa5a('0x3e')](_0x4cb0af[_0xaa5a('0x39')],_0x4cb0af[_0xaa5a('0x3a')]);_0x398b81[_0xaa5a('0x3d')]=_[_0xaa5a('0x3e')](_0x4cb0af[_0xaa5a('0x39')],qs[_0xaa5a('0x3f')](_0x5e713e['query']['fields']));_0x398b81[_0xaa5a('0x3d')]=_0x398b81[_0xaa5a('0x3d')][_0xaa5a('0x40')]?_0x398b81['attributes']:_0x4cb0af['model'];_0x398b81[_0xaa5a('0x43')]=qs[_0xaa5a('0x44')](_0x5e713e[_0xaa5a('0x3a')][_0xaa5a('0x44')]);_0x398b81[_0xaa5a('0x45')]=qs[_0xaa5a('0x3c')](_[_0xaa5a('0x46')](_0x5e713e[_0xaa5a('0x3a')],_0x4cb0af[_0xaa5a('0x3c')]));if(_0x5e713e[_0xaa5a('0x3a')][_0xaa5a('0x47')]){_0x398b81[_0xaa5a('0x45')]=_[_0xaa5a('0x48')](_0x398b81[_0xaa5a('0x45')],{'$or':_['map'](_0x398b81[_0xaa5a('0x3d')],function(_0x54b81c){var _0x1a11b5={};_0x1a11b5[_0x54b81c]={'$like':'%'+_0x5e713e[_0xaa5a('0x3a')][_0xaa5a('0x47')]+'%'};return _0x1a11b5;})});}_0x398b81=_['merge']({},_0x398b81,_0x5e713e[_0xaa5a('0x4b')]);return _0x2a7912[_0xaa5a('0x67')](_0x398b81);}})[_0xaa5a('0x2c')](function(_0x4927d3){if(_0x4927d3){_0x31ae00=_0x4927d3[_0xaa5a('0x40')];if(!_0x5e713e[_0xaa5a('0x3a')][_0xaa5a('0x41')](_0xaa5a('0x42'))){_0x398b81[_0xaa5a('0x24')]=qs[_0xaa5a('0x24')](_0x5e713e[_0xaa5a('0x3a')][_0xaa5a('0x24')]);_0x398b81[_0xaa5a('0x22')]=qs['offset'](_0x5e713e[_0xaa5a('0x3a')]['offset']);}return _0x2a7912[_0xaa5a('0x67')](_0x398b81);}})[_0xaa5a('0x2c')](function(_0x49153f){if(_0x49153f){return _0x49153f?{'count':_0x31ae00,'rows':_0x49153f}:null;}})[_0xaa5a('0x2c')](respondWithResult(_0x187d71,null))[_0xaa5a('0x4f')](handleError(_0x187d71,null));};exports[_0xaa5a('0x68')]=function(_0x2239d3,_0x374eda,_0x2bcad4){var _0x4592f7=_0x2239d3['body'][_0xaa5a('0x69')];return db[_0xaa5a('0x6a')][_0xaa5a('0x61')]({'where':{'id':_0x4592f7},'attributes':['id'],'include':[{'model':db[_0xaa5a('0x62')],'as':_0xaa5a('0x6b'),'attributes':['id',_0xaa5a('0x32'),'online',_0xaa5a('0x6c'),'interface'],'raw':!![]}]})[_0xaa5a('0x2c')](function(_0x57a941){if(_0x57a941){var _0x47d90c=_[_0xaa5a('0x6d')](_0x57a941,function(_0x33c5d4){var _0x311548=_0x33c5d4[_0xaa5a('0x55')]({'plain':!![]});return _0x311548[_0xaa5a('0x6b')];});return db[_0xaa5a('0x52')][_0xaa5a('0x53')]({'where':{'id':_0x2239d3[_0xaa5a('0x51')]['id']}})['then'](function(_0x591d66){return db['sequelize'][_0xaa5a('0x6e')](function(_0x3187d2){return _0x591d66[_0xaa5a('0x68')](_0x4592f7,{'transaction':_0x3187d2})['then'](function(){return BPromise['each'](_0x47d90c,function(_0x60f6e6){return db['UserOpenchannelQueue'][_0xaa5a('0x6f')]({'where':{'UserId':_0x60f6e6['id'],'OpenchannelQueueId':_0x2239d3['params']['id']},'transaction':_0x3187d2});});})[_0xaa5a('0x2c')](function(){_0x47d90c[_0xaa5a('0x70')](function(_0x18693b){socket['emit'](_0xaa5a('0x71'),{'UserId':_0x18693b['id'],'OpenchannelQueueId':_0x591d66['id']});});});});});}})[_0xaa5a('0x2c')](respondWithStatusCode(_0x374eda,null))['catch'](handleError(_0x374eda,null));};exports[_0xaa5a('0x72')]=function(_0x56db3e,_0x120479,_0x3187c3){return db['Team'][_0xaa5a('0x61')]({'where':{'id':_0x56db3e[_0xaa5a('0x3a')][_0xaa5a('0x69')]},'attributes':['id'],'include':[{'model':db[_0xaa5a('0x62')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xaa5a('0x2c')](handleEntityNotFound(_0x120479,null))['then'](function(_0xd694fb){var _0x234b8b=_['map'](_0xd694fb,'id');var _0x308ba3=[];var _0x188dd1=[];var _0x19c7ac=squel[_0xaa5a('0x73')]();_0x19c7ac[_0xaa5a('0x74')](_0xaa5a('0x75'))[_0xaa5a('0x76')](_0xaa5a('0x77'),'tq')['join'](_0xaa5a('0x78'),'ut',_0xaa5a('0x79'))[_0xaa5a('0x45')](_0xaa5a('0x7a'),_0x56db3e[_0xaa5a('0x51')]['id']);for(var _0xb0ae41=0x0;_0xb0ae41<_0xd694fb['length'];_0xb0ae41+=0x1){let _0x30de0a=_0xd694fb[_0xb0ae41];for(var _0x2b8999=0x0;_0x2b8999<_0x30de0a[_0xaa5a('0x6b')][_0xaa5a('0x40')];_0x2b8999+=0x1){let _0x15db0d=_0x30de0a[_0xaa5a('0x6b')][_0x2b8999];var _0x230f75=_0x19c7ac[_0xaa5a('0x7b')]();_0x230f75[_0xaa5a('0x45')]('ut.UserId\x20=\x20?',_0x15db0d['id']);_0x188dd1[_0xaa5a('0x7c')](db[_0xaa5a('0x7d')]['query'](_0x230f75[_0xaa5a('0x7e')](),{'type':db['sequelize']['QueryTypes'][_0xaa5a('0x7f')]})[_0xaa5a('0x2c')](function(_0x345d91){if(_0x345d91[_0xaa5a('0x40')]===0x1){return _0x15db0d['id'];}else{var _0x1a2374=_[_0xaa5a('0x80')](_[_0xaa5a('0x35')](_0x345d91,_0xaa5a('0x81')),function(_0xf031b2){return _['includes'](_0x234b8b,_0xf031b2);});if(_0x1a2374){return _0x15db0d['id'];}}}));}}return BPromise[_0xaa5a('0x82')](_0x188dd1)[_0xaa5a('0x2c')](function(_0x5ee603){_0x308ba3=_(_0x308ba3)[_0xaa5a('0x83')](_0x5ee603)[_0xaa5a('0x84')]()[_0xaa5a('0x85')]();return db[_0xaa5a('0x52')][_0xaa5a('0x53')]({'where':{'id':_0x56db3e[_0xaa5a('0x51')]['id']}})['then'](function(_0x25ba6f){return db['sequelize'][_0xaa5a('0x6e')](function(_0x2b6209){return _0x25ba6f[_0xaa5a('0x72')](_0x56db3e[_0xaa5a('0x3a')][_0xaa5a('0x69')],{'transaction':_0x2b6209})['then'](function(){if(!_['isEmpty'](_0x308ba3)){return _0x25ba6f[_0xaa5a('0x86')](_0x308ba3,{'transaction':_0x2b6209});}})[_0xaa5a('0x2c')](function(){_0x308ba3[_0xaa5a('0x70')](function(_0x5d8d99){socket[_0xaa5a('0x87')](_0xaa5a('0x88'),{'UserId':_0x5d8d99,'OpenchannelQueueId':_0x25ba6f['id']});});});});});});})['then'](respondWithStatusCode(_0x120479,null))[_0xaa5a('0x4f')](handleError(_0x120479,null));};exports['addAgents']=function(_0x1eefea,_0x388915,_0x32ec16){return db[_0xaa5a('0x52')]['find']({'where':{'id':_0x1eefea['params']['id']}})[_0xaa5a('0x2c')](handleEntityNotFound(_0x388915,null))[_0xaa5a('0x2c')](function(_0x473b25){if(_0x473b25){return _0x473b25['addAgents'](_0x1eefea[_0xaa5a('0x5c')]['ids'],_['omit'](_0x1eefea[_0xaa5a('0x5c')],[_0xaa5a('0x69'),'id'])||{})[_0xaa5a('0x89')](function(_0x1865e8){for(var _0x1d60b2=0x0;_0x1d60b2<_0x1eefea['body'][_0xaa5a('0x69')][_0xaa5a('0x40')];_0x1d60b2+=0x1){socket[_0xaa5a('0x87')](_0xaa5a('0x71'),{'UserId':Number(_0x1eefea[_0xaa5a('0x5c')]['ids'][_0x1d60b2]),'OpenchannelQueueId':Number(_0x1eefea[_0xaa5a('0x51')]['id'])});}return _0x1865e8;});}})[_0xaa5a('0x2c')](respondWithResult(_0x388915,null))[_0xaa5a('0x4f')](handleError(_0x388915,null));};exports[_0xaa5a('0x86')]=function(_0x3f8e42,_0x1bb044,_0x20db15){return db[_0xaa5a('0x52')][_0xaa5a('0x53')]({'where':{'id':_0x3f8e42[_0xaa5a('0x51')]['id']}})[_0xaa5a('0x2c')](handleEntityNotFound(_0x1bb044,null))['then'](function(_0x5696b5){if(_0x5696b5){return _0x5696b5[_0xaa5a('0x86')](_0x3f8e42[_0xaa5a('0x3a')][_0xaa5a('0x69')])['then'](function(){if(_[_0xaa5a('0x8a')](_0x3f8e42[_0xaa5a('0x3a')][_0xaa5a('0x69')])){for(var _0x1a0d0e=0x0;_0x1a0d0e<_0x3f8e42[_0xaa5a('0x3a')][_0xaa5a('0x69')]['length'];_0x1a0d0e+=0x1){socket[_0xaa5a('0x87')](_0xaa5a('0x88'),{'UserId':Number(_0x3f8e42['query'][_0xaa5a('0x69')][_0x1a0d0e]),'OpenchannelQueueId':Number(_0x3f8e42[_0xaa5a('0x51')]['id'])});}}else{socket[_0xaa5a('0x87')](_0xaa5a('0x88'),{'UserId':Number(_0x3f8e42[_0xaa5a('0x3a')][_0xaa5a('0x69')]),'OpenchannelQueueId':Number(_0x3f8e42['params']['id'])});}});}})[_0xaa5a('0x2c')](respondWithStatusCode(_0x1bb044,null))[_0xaa5a('0x4f')](handleError(_0x1bb044,null));};exports[_0xaa5a('0x8b')]=function(_0x3d408c,_0x11bf5e,_0x2e12a4){var _0x3b6081={};var _0x494b42={};var _0x3ba75a;var _0x1002d0;return db[_0xaa5a('0x52')][_0xaa5a('0x5e')]({'where':{'id':_0x3d408c[_0xaa5a('0x51')]['id']}})[_0xaa5a('0x2c')](handleEntityNotFound(_0x11bf5e,null))[_0xaa5a('0x2c')](function(_0x1453c0){if(_0x1453c0){_0x3ba75a=_0x1453c0;_0x494b42[_0xaa5a('0x39')]=_['keys'](db[_0xaa5a('0x62')][_0xaa5a('0x36')]);_0x494b42['query']=_[_0xaa5a('0x3b')](_0x3d408c[_0xaa5a('0x3a')]);_0x494b42[_0xaa5a('0x3c')]=_[_0xaa5a('0x3e')](_0x494b42['model'],_0x494b42[_0xaa5a('0x3a')]);_0x3b6081[_0xaa5a('0x3d')]=_[_0xaa5a('0x3e')](_0x494b42['model'],qs[_0xaa5a('0x3f')](_0x3d408c[_0xaa5a('0x3a')][_0xaa5a('0x3f')]));_0x3b6081[_0xaa5a('0x3d')]=_0x3b6081[_0xaa5a('0x3d')][_0xaa5a('0x40')]?_0x3b6081[_0xaa5a('0x3d')]:_0x494b42['model'];_0x3b6081[_0xaa5a('0x43')]=qs[_0xaa5a('0x44')](_0x3d408c['query'][_0xaa5a('0x44')]);_0x3b6081['where']=qs[_0xaa5a('0x3c')](_[_0xaa5a('0x46')](_0x3d408c[_0xaa5a('0x3a')],_0x494b42[_0xaa5a('0x3c')]));if(_0x3d408c[_0xaa5a('0x3a')][_0xaa5a('0x47')]){_0x3b6081[_0xaa5a('0x45')]=_['merge'](_0x3b6081[_0xaa5a('0x45')],{'$or':_[_0xaa5a('0x35')](_0x3b6081[_0xaa5a('0x3d')],function(_0x303a4d){var _0x24d093={};_0x24d093[_0x303a4d]={'$like':'%'+_0x3d408c[_0xaa5a('0x3a')][_0xaa5a('0x47')]+'%'};return _0x24d093;})});}_0x3b6081=_[_0xaa5a('0x48')]({},_0x3b6081,_0x3d408c[_0xaa5a('0x4b')]);return _0x3ba75a['getAgents'](_0x3b6081);}})['then'](function(_0x2e6b32){if(_0x2e6b32){_0x1002d0=_0x2e6b32[_0xaa5a('0x40')];if(!_0x3d408c['query'][_0xaa5a('0x41')]('nolimit')){_0x3b6081['limit']=qs[_0xaa5a('0x24')](_0x3d408c[_0xaa5a('0x3a')][_0xaa5a('0x24')]);_0x3b6081[_0xaa5a('0x22')]=qs[_0xaa5a('0x22')](_0x3d408c[_0xaa5a('0x3a')][_0xaa5a('0x22')]);}return _0x3ba75a[_0xaa5a('0x8b')](_0x3b6081);}})[_0xaa5a('0x2c')](function(_0x1c6e6a){if(_0x1c6e6a){return _0x1c6e6a?{'count':_0x1002d0,'rows':_0x1c6e6a}:null;}})[_0xaa5a('0x2c')](respondWithResult(_0x11bf5e,null))[_0xaa5a('0x4f')](handleError(_0x11bf5e,null));}; \ No newline at end of file +var _0xdee4=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','OpenchannelQueue','includeAll','rows','catch','show','options','create','body','user','role','OpenchannelQueues','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserOpenchannelQueue','length','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','SIP','Team','pick','getTeams','addTeams','findAll','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','union','compact','value','transaction','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse'];(function(_0x4b57a9,_0x241578){var _0x55ca62=function(_0x17d9e2){while(--_0x17d9e2){_0x4b57a9['push'](_0x4b57a9['shift']());}};_0x55ca62(++_0x241578);}(_0xdee4,0x7d));var _0x4dee=function(_0x43b08c,_0x15e99e){_0x43b08c=_0x43b08c-0x0;var _0x3c2958=_0xdee4[_0x43b08c];return _0x3c2958;};'use strict';var emlformat=require(_0x4dee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4dee('0x1'));var jsonpatch=require(_0x4dee('0x2'));var rp=require(_0x4dee('0x3'));var moment=require('moment');var BPromise=require(_0x4dee('0x4'));var Mustache=require('mustache');var util=require(_0x4dee('0x5'));var path=require(_0x4dee('0x6'));var sox=require(_0x4dee('0x7'));var csv=require(_0x4dee('0x8'));var ejs=require(_0x4dee('0x9'));var fs=require('fs');var fs_extra=require(_0x4dee('0xa'));var _=require(_0x4dee('0xb'));var squel=require(_0x4dee('0xc'));var crypto=require(_0x4dee('0xd'));var jsforce=require(_0x4dee('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4dee('0x8'));var querystring=require(_0x4dee('0xf'));var Papa=require(_0x4dee('0x10'));var Redis=require(_0x4dee('0x11'));var authService=require(_0x4dee('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4dee('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4dee('0x14'));var utils=require('../../config/utils');var config=require(_0x4dee('0x15'));var licenseUtil=require(_0x4dee('0x16'));var db=require(_0x4dee('0x17'))['db'];config['redis']=_['defaults'](config[_0x4dee('0x18')],{'host':_0x4dee('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4dee('0x18')]));require(_0x4dee('0x1a'))[_0x4dee('0x1b')](socket);function respondWithStatusCode(_0x250afd,_0x9fc2cb){_0x9fc2cb=_0x9fc2cb||0xcc;return function(_0x2e14ca){if(_0x2e14ca){return _0x250afd[_0x4dee('0x1c')](_0x9fc2cb);}return _0x250afd[_0x4dee('0x1d')](_0x9fc2cb)[_0x4dee('0x1e')]();};}function respondWithResult(_0x1a34ee,_0xf660a9){_0xf660a9=_0xf660a9||0xc8;return function(_0x19c14f){if(_0x19c14f){return _0x1a34ee[_0x4dee('0x1d')](_0xf660a9)[_0x4dee('0x1f')](_0x19c14f);}};}function respondWithFilteredResult(_0x355909,_0x149123){return function(_0x5ac9f2){if(_0x5ac9f2){var _0x217113=typeof _0x149123[_0x4dee('0x20')]==='undefined'&&typeof _0x149123[_0x4dee('0x21')]===_0x4dee('0x22');var _0x4ea8dc=_0x5ac9f2[_0x4dee('0x23')];var _0x21cb12=_0x217113?0x0:_0x149123[_0x4dee('0x20')];var _0x1599cc=_0x217113?_0x5ac9f2[_0x4dee('0x23')]:_0x149123[_0x4dee('0x20')]+_0x149123['limit'];var _0x11c143;if(_0x1599cc>=_0x4ea8dc){_0x1599cc=_0x4ea8dc;_0x11c143=0xc8;}else{_0x11c143=0xce;}_0x355909['status'](_0x11c143);return _0x355909['set'](_0x4dee('0x24'),_0x21cb12+'-'+_0x1599cc+'/'+_0x4ea8dc)[_0x4dee('0x1f')](_0x5ac9f2);}return null;};}function patchUpdates(_0x49e01d){return function(_0x13611c){try{jsonpatch[_0x4dee('0x25')](_0x13611c,_0x49e01d,!![]);}catch(_0x4d5467){return BPromise['reject'](_0x4d5467);}return _0x13611c[_0x4dee('0x26')]();};}function saveUpdates(_0x1e875a,_0x3b6348){return function(_0x185ff4){if(_0x185ff4){return _0x185ff4[_0x4dee('0x27')](_0x1e875a)[_0x4dee('0x28')](function(_0x5325c5){return _0x5325c5;});}return null;};}function removeEntity(_0x449299,_0x1e044b){return function(_0x46fdc8){if(_0x46fdc8){return _0x46fdc8[_0x4dee('0x29')]()[_0x4dee('0x28')](function(){var _0x39089e=_0x46fdc8[_0x4dee('0x2a')]({'plain':!![]});var _0x17a656='OpenchannelQueues';return db[_0x4dee('0x2b')][_0x4dee('0x29')]({'where':{'type':_0x17a656,'resourceId':_0x39089e['id']}})[_0x4dee('0x28')](function(){return _0x46fdc8;});})[_0x4dee('0x28')](function(){_0x449299[_0x4dee('0x1d')](0xcc)[_0x4dee('0x1e')]();});}};}function handleEntityNotFound(_0xd52f3a,_0x43194e){return function(_0x1a0715){if(!_0x1a0715){_0xd52f3a[_0x4dee('0x1c')](0x194);}return _0x1a0715;};}function handleError(_0x4ec5fb,_0x612b76){_0x612b76=_0x612b76||0x1f4;return function(_0x2a04c8){logger[_0x4dee('0x2c')](_0x2a04c8[_0x4dee('0x2d')]);if(_0x2a04c8['name']){delete _0x2a04c8[_0x4dee('0x2e')];}_0x4ec5fb[_0x4dee('0x1d')](_0x612b76)[_0x4dee('0x2f')](_0x2a04c8);};}exports['index']=function(_0x2e5a29,_0x75c572){var _0x2373b2={},_0x241e88={},_0x2285a6={'count':0x0,'rows':[]};var _0x10c119=_[_0x4dee('0x30')](db['OpenchannelQueue'][_0x4dee('0x31')],function(_0x43bb65){return{'name':_0x43bb65[_0x4dee('0x32')],'type':_0x43bb65[_0x4dee('0x33')][_0x4dee('0x34')]};});_0x241e88[_0x4dee('0x35')]=_[_0x4dee('0x30')](_0x10c119,_0x4dee('0x2e'));_0x241e88['query']=_[_0x4dee('0x36')](_0x2e5a29[_0x4dee('0x37')]);_0x241e88[_0x4dee('0x38')]=_[_0x4dee('0x39')](_0x241e88[_0x4dee('0x35')],_0x241e88[_0x4dee('0x37')]);_0x2373b2[_0x4dee('0x3a')]=_[_0x4dee('0x39')](_0x241e88[_0x4dee('0x35')],qs[_0x4dee('0x3b')](_0x2e5a29[_0x4dee('0x37')][_0x4dee('0x3b')]));_0x2373b2[_0x4dee('0x3a')]=_0x2373b2[_0x4dee('0x3a')]['length']?_0x2373b2[_0x4dee('0x3a')]:_0x241e88['model'];if(!_0x2e5a29['query'][_0x4dee('0x3c')](_0x4dee('0x3d'))){_0x2373b2[_0x4dee('0x21')]=qs['limit'](_0x2e5a29[_0x4dee('0x37')][_0x4dee('0x21')]);_0x2373b2[_0x4dee('0x20')]=qs[_0x4dee('0x20')](_0x2e5a29[_0x4dee('0x37')][_0x4dee('0x20')]);}_0x2373b2[_0x4dee('0x3e')]=qs['sort'](_0x2e5a29['query'][_0x4dee('0x3f')]);_0x2373b2[_0x4dee('0x40')]=qs['filters'](_['pick'](_0x2e5a29[_0x4dee('0x37')],_0x241e88[_0x4dee('0x38')]),_0x10c119);if(_0x2e5a29['query'][_0x4dee('0x41')]){_0x2373b2[_0x4dee('0x40')]=_[_0x4dee('0x42')](_0x2373b2['where'],{'$or':_['map'](_0x10c119,function(_0x280cd3){if(_0x280cd3[_0x4dee('0x33')]!==_0x4dee('0x43')){var _0x5a5a1c={};_0x5a5a1c[_0x280cd3[_0x4dee('0x2e')]]={'$like':'%'+_0x2e5a29['query']['filter']+'%'};return _0x5a5a1c;}})});}_0x2373b2=_[_0x4dee('0x42')]({},_0x2373b2,_0x2e5a29['options']);var _0x2caa10={'where':_0x2373b2[_0x4dee('0x40')]};return db[_0x4dee('0x44')][_0x4dee('0x23')](_0x2caa10)['then'](function(_0x56013f){_0x2285a6[_0x4dee('0x23')]=_0x56013f;if(_0x2e5a29[_0x4dee('0x37')][_0x4dee('0x45')]){_0x2373b2['include']=[{'all':!![]}];}return db[_0x4dee('0x44')]['findAll'](_0x2373b2);})['then'](function(_0x38e298){_0x2285a6[_0x4dee('0x46')]=_0x38e298;return _0x2285a6;})[_0x4dee('0x28')](respondWithFilteredResult(_0x75c572,_0x2373b2))[_0x4dee('0x47')](handleError(_0x75c572,null));};exports[_0x4dee('0x48')]=function(_0x120268,_0x3a12bc){var _0x47464c={'raw':!![],'where':{'id':_0x120268['params']['id']}},_0x417188={};_0x417188[_0x4dee('0x35')]=_['keys'](db['OpenchannelQueue'][_0x4dee('0x31')]);_0x417188[_0x4dee('0x37')]=_[_0x4dee('0x36')](_0x120268[_0x4dee('0x37')]);_0x417188[_0x4dee('0x38')]=_[_0x4dee('0x39')](_0x417188[_0x4dee('0x35')],_0x417188[_0x4dee('0x37')]);_0x47464c['attributes']=_[_0x4dee('0x39')](_0x417188['model'],qs['fields'](_0x120268[_0x4dee('0x37')][_0x4dee('0x3b')]));_0x47464c[_0x4dee('0x3a')]=_0x47464c[_0x4dee('0x3a')]['length']?_0x47464c[_0x4dee('0x3a')]:_0x417188[_0x4dee('0x35')];if(_0x120268[_0x4dee('0x37')][_0x4dee('0x45')]){_0x47464c['include']=[{'all':!![]}];}_0x47464c=_[_0x4dee('0x42')]({},_0x47464c,_0x120268[_0x4dee('0x49')]);return db[_0x4dee('0x44')]['find'](_0x47464c)['then'](handleEntityNotFound(_0x3a12bc,null))[_0x4dee('0x28')](respondWithResult(_0x3a12bc,null))[_0x4dee('0x47')](handleError(_0x3a12bc,null));};exports[_0x4dee('0x4a')]=function(_0x909881,_0x2eea0e){return db['OpenchannelQueue'][_0x4dee('0x4a')](_0x909881[_0x4dee('0x4b')],{})[_0x4dee('0x28')](function(_0x5f1488){var _0x2679aa=_0x909881[_0x4dee('0x4c')][_0x4dee('0x2a')]({'plain':!![]});if(!_0x2679aa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2679aa[_0x4dee('0x4d')]===_0x4dee('0x4c')){var _0x6c7c64=_0x5f1488[_0x4dee('0x2a')]({'plain':!![]});var _0x259f5f=_0x4dee('0x4e');return db['UserProfileSection'][_0x4dee('0x4f')]({'where':{'name':_0x259f5f,'userProfileId':_0x2679aa[_0x4dee('0x50')]},'raw':!![]})[_0x4dee('0x28')](function(_0x1fe9d5){if(_0x1fe9d5&&_0x1fe9d5[_0x4dee('0x51')]===0x0){return db[_0x4dee('0x2b')][_0x4dee('0x4a')]({'name':_0x6c7c64['name'],'resourceId':_0x6c7c64['id'],'type':_0x1fe9d5[_0x4dee('0x2e')],'sectionId':_0x1fe9d5['id']},{})[_0x4dee('0x28')](function(){return _0x5f1488;});}else{return _0x5f1488;}})[_0x4dee('0x47')](function(_0x2f924c){logger[_0x4dee('0x2c')](_0x4dee('0x52'),_0x2f924c);throw _0x2f924c;});}return _0x5f1488;})['then'](respondWithResult(_0x2eea0e,0xc9))[_0x4dee('0x47')](handleError(_0x2eea0e,null));};exports['update']=function(_0x4664fa,_0x4588c1){if(_0x4664fa[_0x4dee('0x4b')]['id']){delete _0x4664fa[_0x4dee('0x4b')]['id'];}return db['OpenchannelQueue'][_0x4dee('0x4f')]({'where':{'id':_0x4664fa[_0x4dee('0x53')]['id']}})[_0x4dee('0x28')](handleEntityNotFound(_0x4588c1,null))['then'](saveUpdates(_0x4664fa['body'],null))[_0x4dee('0x28')](respondWithResult(_0x4588c1,null))[_0x4dee('0x47')](handleError(_0x4588c1,null));};exports['destroy']=function(_0x210aaa,_0x2eb665){return db[_0x4dee('0x44')][_0x4dee('0x4f')]({'where':{'id':_0x210aaa[_0x4dee('0x53')]['id']}})[_0x4dee('0x28')](handleEntityNotFound(_0x2eb665,null))[_0x4dee('0x28')](removeEntity(_0x2eb665,null))[_0x4dee('0x47')](handleError(_0x2eb665,null));};exports['describe']=function(_0x105f58,_0x374c0d){return db[_0x4dee('0x44')][_0x4dee('0x54')]()[_0x4dee('0x28')](respondWithResult(_0x374c0d,null))[_0x4dee('0x47')](handleError(_0x374c0d,null));};exports[_0x4dee('0x55')]=function(_0x4819be,_0xb6a3b0,_0xe62401){var _0x37d491={'raw':!![],'where':{}},_0x1e0898={},_0x4dce45;return db['OpenchannelQueue'][_0x4dee('0x56')]({'where':{'id':_0x4819be[_0x4dee('0x53')]['id']}})['then'](handleEntityNotFound(_0xb6a3b0,null))[_0x4dee('0x28')](function(_0x870288){if(_0x870288){_0x4dce45=_0x870288[_0x4dee('0x2a')]({'plain':!![]});_0x1e0898['model']=_[_0x4dee('0x36')](db[_0x4dee('0x57')]['rawAttributes']);_0x1e0898['query']=_['keys'](_0x4819be[_0x4dee('0x37')]);_0x1e0898[_0x4dee('0x38')]=_[_0x4dee('0x39')](_0x1e0898[_0x4dee('0x35')],_0x1e0898[_0x4dee('0x37')]);_0x37d491[_0x4dee('0x3a')]=_[_0x4dee('0x39')](_0x1e0898[_0x4dee('0x35')],qs['fields'](_0x4819be[_0x4dee('0x37')][_0x4dee('0x3b')]));_0x37d491[_0x4dee('0x3a')]=_0x37d491[_0x4dee('0x3a')][_0x4dee('0x58')]?_0x37d491['attributes']:_0x1e0898[_0x4dee('0x35')];if(!_0x4819be['query'][_0x4dee('0x3c')]('nolimit')){_0x37d491['limit']=qs[_0x4dee('0x21')](_0x4819be[_0x4dee('0x37')]['limit']);_0x37d491[_0x4dee('0x20')]=qs['offset'](_0x4819be[_0x4dee('0x37')]['offset']);}_0x37d491[_0x4dee('0x3e')]=qs[_0x4dee('0x3f')](_0x4819be['query'][_0x4dee('0x3f')]);_0x37d491['where']=qs[_0x4dee('0x38')](_['pick'](_0x4819be[_0x4dee('0x37')],_0x1e0898['filters']));_0x37d491[_0x4dee('0x40')][_0x4dee('0x59')]=_0x870288['id'];if(_0x4819be[_0x4dee('0x37')][_0x4dee('0x41')]){_0x37d491[_0x4dee('0x40')]=_[_0x4dee('0x42')](_0x37d491['where'],{'$or':_[_0x4dee('0x30')](_0x37d491[_0x4dee('0x3a')],function(_0x2dbe13){var _0x10e95e={};_0x10e95e[_0x2dbe13]={'$like':'%'+_0x4819be[_0x4dee('0x37')][_0x4dee('0x41')]+'%'};return _0x10e95e;})});}_0x37d491=_[_0x4dee('0x42')]({},_0x37d491,_0x4819be[_0x4dee('0x49')]);return db['UserOpenchannelQueue']['findAll'](_0x37d491);}})[_0x4dee('0x28')](function(_0x339c15){if(_0x339c15){return db[_0x4dee('0x5a')][_0x4dee('0x5b')]({'where':{'id':_[_0x4dee('0x30')](_0x339c15,_0x4dee('0x5c')),'role':_0x4dee('0x5d')},'attributes':['id',_0x4dee('0x2e'),_0x4dee('0x5e'),_0x4dee('0x5f'),_0x4dee('0x60')]});}})[_0x4dee('0x28')](function(_0x4fdf07){if(_0x4fdf07){return{'count':_0x4fdf07[_0x4dee('0x23')],'rows':_['map'](_0x4fdf07['rows'],function(_0x2c34b9){return{'membername':_0x2c34b9[_0x4dee('0x2e')],'UserId':_0x2c34b9['id'],'queue_name':_0x4dce45[_0x4dee('0x2e')],'OpenchannelQueueId':_0x4dce45['id'],'interface':util[_0x4dee('0x61')]('%s/%s',_0x4dee('0x62'),_0x2c34b9[_0x4dee('0x2e')]),'penalty':0x0,'paused':_0x2c34b9['openchannelPause'],'createdAt':_0x2c34b9[_0x4dee('0x60')],'updatedAt':_0x2c34b9[_0x4dee('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xb6a3b0,_0x37d491))[_0x4dee('0x47')](handleError(_0xb6a3b0,null));};exports['getTeams']=function(_0x51d2ad,_0x58d8f3,_0x185d31){var _0x2780c3={};var _0x667e74={};var _0x9de4b;var _0x53a50e;return db[_0x4dee('0x44')][_0x4dee('0x56')]({'where':{'id':_0x51d2ad['params']['id']}})[_0x4dee('0x28')](handleEntityNotFound(_0x58d8f3,null))['then'](function(_0x39894d){if(_0x39894d){_0x9de4b=_0x39894d;_0x667e74[_0x4dee('0x35')]=_[_0x4dee('0x36')](db[_0x4dee('0x63')][_0x4dee('0x31')]);_0x667e74['query']=_[_0x4dee('0x36')](_0x51d2ad[_0x4dee('0x37')]);_0x667e74['filters']=_[_0x4dee('0x39')](_0x667e74[_0x4dee('0x35')],_0x667e74[_0x4dee('0x37')]);_0x2780c3[_0x4dee('0x3a')]=_[_0x4dee('0x39')](_0x667e74[_0x4dee('0x35')],qs['fields'](_0x51d2ad[_0x4dee('0x37')][_0x4dee('0x3b')]));_0x2780c3[_0x4dee('0x3a')]=_0x2780c3[_0x4dee('0x3a')]['length']?_0x2780c3[_0x4dee('0x3a')]:_0x667e74[_0x4dee('0x35')];_0x2780c3['order']=qs[_0x4dee('0x3f')](_0x51d2ad[_0x4dee('0x37')][_0x4dee('0x3f')]);_0x2780c3[_0x4dee('0x40')]=qs[_0x4dee('0x38')](_[_0x4dee('0x64')](_0x51d2ad['query'],_0x667e74['filters']));if(_0x51d2ad['query'][_0x4dee('0x41')]){_0x2780c3['where']=_['merge'](_0x2780c3[_0x4dee('0x40')],{'$or':_[_0x4dee('0x30')](_0x2780c3[_0x4dee('0x3a')],function(_0x3c60cc){var _0x53bfaf={};_0x53bfaf[_0x3c60cc]={'$like':'%'+_0x51d2ad[_0x4dee('0x37')][_0x4dee('0x41')]+'%'};return _0x53bfaf;})});}_0x2780c3=_[_0x4dee('0x42')]({},_0x2780c3,_0x51d2ad[_0x4dee('0x49')]);return _0x9de4b[_0x4dee('0x65')](_0x2780c3);}})[_0x4dee('0x28')](function(_0x46c773){if(_0x46c773){_0x53a50e=_0x46c773['length'];if(!_0x51d2ad['query'][_0x4dee('0x3c')]('nolimit')){_0x2780c3[_0x4dee('0x21')]=qs[_0x4dee('0x21')](_0x51d2ad[_0x4dee('0x37')][_0x4dee('0x21')]);_0x2780c3[_0x4dee('0x20')]=qs[_0x4dee('0x20')](_0x51d2ad[_0x4dee('0x37')][_0x4dee('0x20')]);}return _0x9de4b[_0x4dee('0x65')](_0x2780c3);}})[_0x4dee('0x28')](function(_0x3cc1a4){if(_0x3cc1a4){return _0x3cc1a4?{'count':_0x53a50e,'rows':_0x3cc1a4}:null;}})['then'](respondWithResult(_0x58d8f3,null))[_0x4dee('0x47')](handleError(_0x58d8f3,null));};exports[_0x4dee('0x66')]=function(_0x1cdf88,_0x1c8755,_0x1ced0d){var _0x400990=_0x1cdf88['body']['ids'];return db['Team'][_0x4dee('0x67')]({'where':{'id':_0x400990},'attributes':['id'],'include':[{'model':db[_0x4dee('0x5a')],'as':_0x4dee('0x68'),'attributes':['id',_0x4dee('0x2e'),_0x4dee('0x69'),_0x4dee('0x6a'),_0x4dee('0x6b')],'raw':!![]}]})[_0x4dee('0x28')](function(_0x3540be){if(_0x3540be){var _0x59ea64=_[_0x4dee('0x6c')](_0x3540be,function(_0x4ee64c){var _0x3b2427=_0x4ee64c['get']({'plain':!![]});return _0x3b2427['Agents'];});return db[_0x4dee('0x44')][_0x4dee('0x4f')]({'where':{'id':_0x1cdf88[_0x4dee('0x53')]['id']}})[_0x4dee('0x28')](function(_0x57a137){return db[_0x4dee('0x6d')]['transaction'](function(_0x4c8a69){return _0x57a137[_0x4dee('0x66')](_0x400990,{'transaction':_0x4c8a69})[_0x4dee('0x28')](function(){return BPromise[_0x4dee('0x6e')](_0x59ea64,function(_0x1d3e9c){return db['UserOpenchannelQueue'][_0x4dee('0x6f')]({'where':{'UserId':_0x1d3e9c['id'],'OpenchannelQueueId':_0x1cdf88[_0x4dee('0x53')]['id']},'transaction':_0x4c8a69});});})[_0x4dee('0x28')](function(){_0x59ea64[_0x4dee('0x70')](function(_0x2eed4b){socket[_0x4dee('0x71')](_0x4dee('0x72'),{'UserId':_0x2eed4b['id'],'OpenchannelQueueId':_0x57a137['id']});});});});});}})[_0x4dee('0x28')](respondWithStatusCode(_0x1c8755,null))[_0x4dee('0x47')](handleError(_0x1c8755,null));};exports[_0x4dee('0x73')]=function(_0x29902a,_0x21c742,_0x53f7dd){return db['Team'][_0x4dee('0x67')]({'where':{'id':_0x29902a['query'][_0x4dee('0x74')]},'attributes':['id'],'include':[{'model':db[_0x4dee('0x5a')],'as':_0x4dee('0x68'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x21c742,null))[_0x4dee('0x28')](function(_0x114511){var _0x5aab19=_['map'](_0x114511,'id');var _0x22fecc=[];var _0x124de8=[];var _0x59d2b0=squel[_0x4dee('0x75')]();_0x59d2b0[_0x4dee('0x76')](_0x4dee('0x77'))[_0x4dee('0x78')](_0x4dee('0x79'),'tq')[_0x4dee('0x7a')](_0x4dee('0x7b'),'ut',_0x4dee('0x7c'))['where']('OpenchannelQueueId\x20=\x20?',_0x29902a[_0x4dee('0x53')]['id']);for(var _0x5a486d=0x0;_0x5a486d<_0x114511['length'];_0x5a486d+=0x1){let _0x5b1c7a=_0x114511[_0x5a486d];for(var _0x48e0aa=0x0;_0x48e0aa<_0x5b1c7a[_0x4dee('0x68')][_0x4dee('0x58')];_0x48e0aa+=0x1){let _0x2e0c59=_0x5b1c7a['Agents'][_0x48e0aa];var _0x801ae8=_0x59d2b0['clone']();_0x801ae8[_0x4dee('0x40')](_0x4dee('0x7d'),_0x2e0c59['id']);_0x124de8[_0x4dee('0x7e')](db[_0x4dee('0x6d')][_0x4dee('0x37')](_0x801ae8[_0x4dee('0x7f')](),{'type':db[_0x4dee('0x6d')][_0x4dee('0x80')][_0x4dee('0x81')]})[_0x4dee('0x28')](function(_0x32a94e){if(_0x32a94e[_0x4dee('0x58')]===0x1){return _0x2e0c59['id'];}else{var _0x5c76d1=_[_0x4dee('0x82')](_[_0x4dee('0x30')](_0x32a94e,'TeamId'),function(_0x1020ed){return _['includes'](_0x5aab19,_0x1020ed);});if(_0x5c76d1){return _0x2e0c59['id'];}}}));}}return BPromise['all'](_0x124de8)[_0x4dee('0x28')](function(_0x546260){_0x22fecc=_(_0x22fecc)[_0x4dee('0x83')](_0x546260)[_0x4dee('0x84')]()[_0x4dee('0x85')]();return db[_0x4dee('0x44')][_0x4dee('0x4f')]({'where':{'id':_0x29902a[_0x4dee('0x53')]['id']}})[_0x4dee('0x28')](function(_0x441c24){return db[_0x4dee('0x6d')][_0x4dee('0x86')](function(_0x4226df){return _0x441c24[_0x4dee('0x73')](_0x29902a[_0x4dee('0x37')][_0x4dee('0x74')],{'transaction':_0x4226df})[_0x4dee('0x28')](function(){if(!_[_0x4dee('0x87')](_0x22fecc)){return _0x441c24[_0x4dee('0x88')](_0x22fecc,{'transaction':_0x4226df});}})[_0x4dee('0x28')](function(){_0x22fecc[_0x4dee('0x70')](function(_0x5c6e10){socket[_0x4dee('0x71')](_0x4dee('0x89'),{'UserId':_0x5c6e10,'OpenchannelQueueId':_0x441c24['id']});});});});});});})[_0x4dee('0x28')](respondWithStatusCode(_0x21c742,null))[_0x4dee('0x47')](handleError(_0x21c742,null));};exports[_0x4dee('0x8a')]=function(_0x5f501f,_0x57e27d,_0xe01c43){return db[_0x4dee('0x44')][_0x4dee('0x4f')]({'where':{'id':_0x5f501f['params']['id']}})[_0x4dee('0x28')](handleEntityNotFound(_0x57e27d,null))[_0x4dee('0x28')](function(_0x3d9430){if(_0x3d9430){return _0x3d9430[_0x4dee('0x8a')](_0x5f501f['body']['ids'],_[_0x4dee('0x8b')](_0x5f501f[_0x4dee('0x4b')],[_0x4dee('0x74'),'id'])||{})[_0x4dee('0x8c')](function(_0x467b04){for(var _0x2523c0=0x0;_0x2523c0<_0x5f501f['body'][_0x4dee('0x74')][_0x4dee('0x58')];_0x2523c0+=0x1){socket[_0x4dee('0x71')]('userOpenchannelQueue:save',{'UserId':Number(_0x5f501f['body'][_0x4dee('0x74')][_0x2523c0]),'OpenchannelQueueId':Number(_0x5f501f[_0x4dee('0x53')]['id'])});}return _0x467b04;});}})['then'](respondWithResult(_0x57e27d,null))['catch'](handleError(_0x57e27d,null));};exports[_0x4dee('0x88')]=function(_0x3ee5cf,_0x282414,_0x21e27a){return db[_0x4dee('0x44')][_0x4dee('0x4f')]({'where':{'id':_0x3ee5cf[_0x4dee('0x53')]['id']}})[_0x4dee('0x28')](handleEntityNotFound(_0x282414,null))[_0x4dee('0x28')](function(_0x36f1ad){if(_0x36f1ad){return _0x36f1ad[_0x4dee('0x88')](_0x3ee5cf[_0x4dee('0x37')][_0x4dee('0x74')])[_0x4dee('0x28')](function(){if(_['isArray'](_0x3ee5cf['query'][_0x4dee('0x74')])){for(var _0x372a7c=0x0;_0x372a7c<_0x3ee5cf[_0x4dee('0x37')]['ids']['length'];_0x372a7c+=0x1){socket['emit'](_0x4dee('0x89'),{'UserId':Number(_0x3ee5cf[_0x4dee('0x37')]['ids'][_0x372a7c]),'OpenchannelQueueId':Number(_0x3ee5cf[_0x4dee('0x53')]['id'])});}}else{socket['emit'](_0x4dee('0x89'),{'UserId':Number(_0x3ee5cf[_0x4dee('0x37')][_0x4dee('0x74')]),'OpenchannelQueueId':Number(_0x3ee5cf[_0x4dee('0x53')]['id'])});}});}})[_0x4dee('0x28')](respondWithStatusCode(_0x282414,null))['catch'](handleError(_0x282414,null));};exports[_0x4dee('0x8d')]=function(_0x4a96f8,_0x3a5d75,_0x525fad){var _0x1c4d8c={};var _0x349a33={};var _0x520fb2;var _0x14b7de;return db[_0x4dee('0x44')][_0x4dee('0x56')]({'where':{'id':_0x4a96f8[_0x4dee('0x53')]['id']}})['then'](handleEntityNotFound(_0x3a5d75,null))[_0x4dee('0x28')](function(_0x3d269d){if(_0x3d269d){_0x520fb2=_0x3d269d;_0x349a33[_0x4dee('0x35')]=_[_0x4dee('0x36')](db['User'][_0x4dee('0x31')]);_0x349a33[_0x4dee('0x37')]=_[_0x4dee('0x36')](_0x4a96f8[_0x4dee('0x37')]);_0x349a33[_0x4dee('0x38')]=_['intersection'](_0x349a33[_0x4dee('0x35')],_0x349a33['query']);_0x1c4d8c[_0x4dee('0x3a')]=_[_0x4dee('0x39')](_0x349a33['model'],qs[_0x4dee('0x3b')](_0x4a96f8[_0x4dee('0x37')]['fields']));_0x1c4d8c[_0x4dee('0x3a')]=_0x1c4d8c[_0x4dee('0x3a')][_0x4dee('0x58')]?_0x1c4d8c['attributes']:_0x349a33['model'];_0x1c4d8c[_0x4dee('0x3e')]=qs['sort'](_0x4a96f8[_0x4dee('0x37')][_0x4dee('0x3f')]);_0x1c4d8c[_0x4dee('0x40')]=qs['filters'](_[_0x4dee('0x64')](_0x4a96f8[_0x4dee('0x37')],_0x349a33[_0x4dee('0x38')]));if(_0x4a96f8[_0x4dee('0x37')]['filter']){_0x1c4d8c[_0x4dee('0x40')]=_[_0x4dee('0x42')](_0x1c4d8c[_0x4dee('0x40')],{'$or':_[_0x4dee('0x30')](_0x1c4d8c[_0x4dee('0x3a')],function(_0x2df31c){var _0x2c0efd={};_0x2c0efd[_0x2df31c]={'$like':'%'+_0x4a96f8[_0x4dee('0x37')][_0x4dee('0x41')]+'%'};return _0x2c0efd;})});}_0x1c4d8c=_[_0x4dee('0x42')]({},_0x1c4d8c,_0x4a96f8[_0x4dee('0x49')]);return _0x520fb2[_0x4dee('0x8d')](_0x1c4d8c);}})['then'](function(_0x252756){if(_0x252756){_0x14b7de=_0x252756[_0x4dee('0x58')];if(!_0x4a96f8['query'][_0x4dee('0x3c')](_0x4dee('0x3d'))){_0x1c4d8c[_0x4dee('0x21')]=qs[_0x4dee('0x21')](_0x4a96f8['query'][_0x4dee('0x21')]);_0x1c4d8c[_0x4dee('0x20')]=qs[_0x4dee('0x20')](_0x4a96f8[_0x4dee('0x37')][_0x4dee('0x20')]);}return _0x520fb2['getAgents'](_0x1c4d8c);}})[_0x4dee('0x28')](function(_0x585c44){if(_0x585c44){return _0x585c44?{'count':_0x14b7de,'rows':_0x585c44}:null;}})[_0x4dee('0x28')](respondWithResult(_0x3a5d75,null))[_0x4dee('0x47')](handleError(_0x3a5d75,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 1bf1282..8122d5f 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 _0xccbd=['OpenchannelQueue','setMaxListeners','remove','emit','hook','exports','events'];(function(_0x5678ec,_0x4ea246){var _0x188d2f=function(_0x2585ac){while(--_0x2585ac){_0x5678ec['push'](_0x5678ec['shift']());}};_0x188d2f(++_0x4ea246);}(_0xccbd,0x1aa));var _0xdccb=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xccbd[_0x465a0c];return _0x1e202e;};'use strict';var EventEmitter=require(_0xdccb('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0xdccb('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xdccb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xdccb('0x3')};function emitEvent(_0x586ab9){return function(_0x2f15c1,_0x512522,_0x2c683a){OpenchannelQueueEvents[_0xdccb('0x4')](_0x586ab9+':'+_0x2f15c1['id'],_0x2f15c1);OpenchannelQueueEvents[_0xdccb('0x4')](_0x586ab9,_0x2f15c1);_0x2c683a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xdccb('0x5')](e,emitEvent(event));}}module[_0xdccb('0x6')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xb7f6=['OpenchannelQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x2a0e1e,_0x208bc6){var _0x4f7063=function(_0x2eb876){while(--_0x2eb876){_0x2a0e1e['push'](_0x2a0e1e['shift']());}};_0x4f7063(++_0x208bc6);}(_0xb7f6,0x1db));var _0x6b7f=function(_0x3bc257,_0x55e53c){_0x3bc257=_0x3bc257-0x0;var _0x4ae7c5=_0xb7f6[_0x3bc257];return _0x4ae7c5;};'use strict';var EventEmitter=require(_0x6b7f('0x0'));var OpenchannelQueue=require(_0x6b7f('0x1'))['db'][_0x6b7f('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x6b7f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6b7f('0x4'),'afterDestroy':_0x6b7f('0x5')};function emitEvent(_0x25d5fc){return function(_0x5c4919,_0x25c3eb,_0x4b4705){OpenchannelQueueEvents[_0x6b7f('0x6')](_0x25d5fc+':'+_0x5c4919['id'],_0x5c4919);OpenchannelQueueEvents[_0x6b7f('0x6')](_0x25d5fc,_0x5c4919);_0x4b4705(null);};}for(var e in events){if(events[_0x6b7f('0x7')](e)){var event=events[e];OpenchannelQueue[_0x6b7f('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 940c69a..f189792 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 _0x5c4b=['request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','openchannel_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x2423d7,_0xe6ec57){var _0x151d17=function(_0x559e15){while(--_0x559e15){_0x2423d7['push'](_0x2423d7['shift']());}};_0x151d17(++_0xe6ec57);}(_0x5c4b,0x1b5));var _0xb5c4=function(_0x59672c,_0x2bf7b2){_0x59672c=_0x59672c-0x0;var _0x1a4998=_0x5c4b[_0x59672c];return _0x1a4998;};'use strict';var _=require(_0xb5c4('0x0'));var util=require(_0xb5c4('0x1'));var logger=require(_0xb5c4('0x2'))('api');var moment=require(_0xb5c4('0x3'));var BPromise=require(_0xb5c4('0x4'));var rp=require(_0xb5c4('0x5'));var fs=require('fs');var path=require(_0xb5c4('0x6'));var rimraf=require(_0xb5c4('0x7'));var config=require(_0xb5c4('0x8'));var attributes=require(_0xb5c4('0x9'));module[_0xb5c4('0xa')]=function(_0x770060,_0xd6f8a9){return _0x770060[_0xb5c4('0xb')]('OpenchannelQueue',attributes,{'tableName':_0xb5c4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x77e8=['request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelQueue','openchannel_queues','util','../../config/logger','api','moment'];(function(_0x545ced,_0x2eb3d3){var _0x40da32=function(_0x2eb6ef){while(--_0x2eb6ef){_0x545ced['push'](_0x545ced['shift']());}};_0x40da32(++_0x2eb3d3);}(_0x77e8,0x17c));var _0x877e=function(_0x200af4,_0x8416e8){_0x200af4=_0x200af4-0x0;var _0x3831b6=_0x77e8[_0x200af4];return _0x3831b6;};'use strict';var _=require('lodash');var util=require(_0x877e('0x0'));var logger=require(_0x877e('0x1'))(_0x877e('0x2'));var moment=require(_0x877e('0x3'));var BPromise=require('bluebird');var rp=require(_0x877e('0x4'));var fs=require('fs');var path=require(_0x877e('0x5'));var rimraf=require(_0x877e('0x6'));var config=require(_0x877e('0x7'));var attributes=require('./openchannelQueue.attributes');module[_0x877e('0x8')]=function(_0x18524e,_0x449a6c){return _0x18524e[_0x877e('0x9')](_0x877e('0xa'),attributes,{'tableName':_0x877e('0xb'),'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 1484db3..c32f715 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 _0x7bf4=['../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','OpenchannelQueue','options','where','attributes','limit','include','map','model','GetOpenchannelQueue','stringify','ShowOpenchannelQueue','find','raw','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xa1c1e7,_0x32d897){var _0x1e7dbd=function(_0x456c0c){while(--_0x456c0c){_0xa1c1e7['push'](_0xa1c1e7['shift']());}};_0x1e7dbd(++_0x32d897);}(_0x7bf4,0x9b));var _0x47bf=function(_0x3d33e3,_0x3d3ad9){_0x3d33e3=_0x3d33e3-0x0;var _0x4566e0=_0x7bf4[_0x3d33e3];return _0x4566e0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x47bf('0x0'));var BPromise=require(_0x47bf('0x1'));var rs=require(_0x47bf('0x2'));var fs=require('fs');var Redis=require(_0x47bf('0x3'));var db=require(_0x47bf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x47bf('0x5'))(_0x47bf('0x6'));var config=require(_0x47bf('0x7'));var jayson=require(_0x47bf('0x8'));var client=jayson[_0x47bf('0x9')]['http']({'port':0x232a});config[_0x47bf('0xa')]=_['defaults'](config['redis'],{'host':_0x47bf('0xb'),'port':0x18eb});var socket=require(_0x47bf('0xc'))(new Redis(config[_0x47bf('0xa')]));require(_0x47bf('0xd'))[_0x47bf('0xe')](socket);function respondWithRpcPromise(_0x5d0083,_0x4a6f13,_0x4b5438){return new BPromise(function(_0x1ef1ab,_0x24090c){return client[_0x47bf('0xf')](_0x5d0083,_0x4b5438)[_0x47bf('0x10')](function(_0x4888d6){logger[_0x47bf('0x11')](_0x47bf('0x12'),_0x4a6f13,_0x47bf('0x13'));logger[_0x47bf('0x14')](_0x47bf('0x15'),_0x4a6f13,_0x47bf('0x13'),JSON['stringify'](_0x4888d6));if(_0x4888d6[_0x47bf('0x16')]){if(_0x4888d6['error'][_0x47bf('0x17')]===0x1f4){logger[_0x47bf('0x16')](_0x47bf('0x12'),_0x4a6f13,_0x4888d6[_0x47bf('0x16')]['message']);return _0x24090c(_0x4888d6[_0x47bf('0x16')]['message']);}logger['error'](_0x47bf('0x12'),_0x4a6f13,_0x4888d6[_0x47bf('0x16')][_0x47bf('0x18')]);return _0x1ef1ab(_0x4888d6[_0x47bf('0x16')][_0x47bf('0x18')]);}else{logger[_0x47bf('0x11')](_0x47bf('0x12'),_0x4a6f13,_0x47bf('0x13'));_0x1ef1ab(_0x4888d6[_0x47bf('0x19')]['message']);}})[_0x47bf('0x1a')](function(_0x4b1388){logger[_0x47bf('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x4a6f13,_0x4b1388);_0x24090c(_0x4b1388);});});}exports['GetOpenchannelQueue']=function(_0x19e22e){var _0x41624f=this;return new Promise(function(_0x1edf11,_0x58d5dd){return db[_0x47bf('0x1b')]['findAll']({'raw':_0x19e22e[_0x47bf('0x1c')]?_0x19e22e[_0x47bf('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x19e22e['options']?_0x19e22e[_0x47bf('0x1c')][_0x47bf('0x1d')]||null:null,'attributes':_0x19e22e[_0x47bf('0x1c')]?_0x19e22e[_0x47bf('0x1c')][_0x47bf('0x1e')]||null:null,'limit':_0x19e22e[_0x47bf('0x1c')]?_0x19e22e[_0x47bf('0x1c')][_0x47bf('0x1f')]||null:null,'include':_0x19e22e['options']?_0x19e22e[_0x47bf('0x1c')][_0x47bf('0x20')]?_[_0x47bf('0x21')](_0x19e22e['options'][_0x47bf('0x20')],function(_0x4a1595){return{'model':db[_0x4a1595[_0x47bf('0x22')]],'as':_0x4a1595['as'],'attributes':_0x4a1595[_0x47bf('0x1e')],'include':_0x4a1595['include']?_['map'](_0x4a1595[_0x47bf('0x20')],function(_0x371d61){return{'model':db[_0x371d61[_0x47bf('0x22')]],'as':_0x371d61['as'],'attributes':_0x371d61[_0x47bf('0x1e')],'include':_0x371d61['include']?_[_0x47bf('0x21')](_0x371d61['include'],function(_0x5556dd){return{'model':db[_0x5556dd[_0x47bf('0x22')]],'as':_0x5556dd['as'],'attributes':_0x5556dd[_0x47bf('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d3da0){logger[_0x47bf('0x11')](_0x47bf('0x23'),_0x19e22e);logger[_0x47bf('0x14')](_0x47bf('0x23'),_0x19e22e,JSON[_0x47bf('0x24')](_0x5d3da0));_0x1edf11(_0x5d3da0);})[_0x47bf('0x1a')](function(_0x3c92ca){logger[_0x47bf('0x16')]('GetOpenchannelQueue',_0x3c92ca[_0x47bf('0x18')],_0x19e22e);_0x58d5dd(_0x41624f[_0x47bf('0x16')](0x1f4,_0x3c92ca[_0x47bf('0x18')]));});});};exports[_0x47bf('0x25')]=function(_0x44b580){var _0x4f871f=this;return new Promise(function(_0x15c0ca,_0x4b03e7){return db['OpenchannelQueue'][_0x47bf('0x26')]({'raw':_0x44b580[_0x47bf('0x1c')]?_0x44b580[_0x47bf('0x1c')][_0x47bf('0x27')]===undefined?!![]:![]:!![],'where':_0x44b580[_0x47bf('0x1c')]?_0x44b580['options']['where']||null:null,'attributes':_0x44b580[_0x47bf('0x1c')]?_0x44b580[_0x47bf('0x1c')][_0x47bf('0x1e')]||null:null,'include':_0x44b580['options']?_0x44b580[_0x47bf('0x1c')]['include']?_[_0x47bf('0x21')](_0x44b580[_0x47bf('0x1c')][_0x47bf('0x20')],function(_0x323b25){return{'model':db[_0x323b25[_0x47bf('0x22')]],'as':_0x323b25['as'],'attributes':_0x323b25[_0x47bf('0x1e')],'include':_0x323b25['include']?_[_0x47bf('0x21')](_0x323b25[_0x47bf('0x20')],function(_0x72533d){return{'model':db[_0x72533d[_0x47bf('0x22')]],'as':_0x72533d['as'],'attributes':_0x72533d[_0x47bf('0x1e')],'include':_0x72533d['include']?_[_0x47bf('0x21')](_0x72533d[_0x47bf('0x20')],function(_0x459dd1){return{'model':db[_0x459dd1['model']],'as':_0x459dd1['as'],'attributes':_0x459dd1[_0x47bf('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x47bf('0x10')](function(_0x3af3fa){logger[_0x47bf('0x11')]('ShowOpenchannelQueue',_0x44b580);logger['debug'](_0x47bf('0x25'),_0x44b580,JSON[_0x47bf('0x24')](_0x3af3fa));_0x15c0ca(_0x3af3fa);})[_0x47bf('0x1a')](function(_0x37f377){logger['error'](_0x47bf('0x25'),_0x37f377[_0x47bf('0x18')],_0x44b580);_0x4b03e7(_0x4f871f['error'](0x1f4,_0x37f377[_0x47bf('0x18')]));});});}; \ No newline at end of file +var _0xb973=['register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','map','model','include','catch','ShowOpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','http','redis','localhost','socket.io-emitter','./openchannelQueue.socket'];(function(_0x5ec594,_0x4aae4d){var _0x24b9de=function(_0x3fb282){while(--_0x3fb282){_0x5ec594['push'](_0x5ec594['shift']());}};_0x24b9de(++_0x4aae4d);}(_0xb973,0x1bc));var _0x3b97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb973[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3b97('0x0'));var util=require(_0x3b97('0x1'));var moment=require(_0x3b97('0x2'));var BPromise=require(_0x3b97('0x3'));var rs=require(_0x3b97('0x4'));var fs=require('fs');var Redis=require(_0x3b97('0x5'));var db=require(_0x3b97('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3b97('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3b97('0x8')],{'host':_0x3b97('0x9'),'port':0x18eb});var socket=require(_0x3b97('0xa'))(new Redis(config['redis']));require(_0x3b97('0xb'))[_0x3b97('0xc')](socket);function respondWithRpcPromise(_0x3dfd49,_0x8aebe7,_0x445ae5){return new BPromise(function(_0x2499f8,_0x52db0e){return client[_0x3b97('0xd')](_0x3dfd49,_0x445ae5)[_0x3b97('0xe')](function(_0x2d72ea){logger[_0x3b97('0xf')](_0x3b97('0x10'),_0x8aebe7,_0x3b97('0x11'));logger[_0x3b97('0x12')](_0x3b97('0x13'),_0x8aebe7,_0x3b97('0x11'),JSON[_0x3b97('0x14')](_0x2d72ea));if(_0x2d72ea[_0x3b97('0x15')]){if(_0x2d72ea[_0x3b97('0x15')][_0x3b97('0x16')]===0x1f4){logger['error'](_0x3b97('0x10'),_0x8aebe7,_0x2d72ea[_0x3b97('0x15')][_0x3b97('0x17')]);return _0x52db0e(_0x2d72ea[_0x3b97('0x15')]['message']);}logger[_0x3b97('0x15')](_0x3b97('0x10'),_0x8aebe7,_0x2d72ea[_0x3b97('0x15')][_0x3b97('0x17')]);return _0x2499f8(_0x2d72ea['error']['message']);}else{logger[_0x3b97('0xf')](_0x3b97('0x10'),_0x8aebe7,_0x3b97('0x11'));_0x2499f8(_0x2d72ea[_0x3b97('0x18')][_0x3b97('0x17')]);}})['catch'](function(_0x3d0d09){logger[_0x3b97('0x15')](_0x3b97('0x10'),_0x8aebe7,_0x3d0d09);_0x52db0e(_0x3d0d09);});});}exports[_0x3b97('0x19')]=function(_0x35df00){var _0x4fd96a=this;return new Promise(function(_0x24f59c,_0x1c9601){return db[_0x3b97('0x1a')][_0x3b97('0x1b')]({'raw':_0x35df00[_0x3b97('0x1c')]?_0x35df00[_0x3b97('0x1c')][_0x3b97('0x1d')]===undefined?!![]:![]:!![],'where':_0x35df00[_0x3b97('0x1c')]?_0x35df00[_0x3b97('0x1c')][_0x3b97('0x1e')]||null:null,'attributes':_0x35df00[_0x3b97('0x1c')]?_0x35df00[_0x3b97('0x1c')][_0x3b97('0x1f')]||null:null,'limit':_0x35df00[_0x3b97('0x1c')]?_0x35df00[_0x3b97('0x1c')]['limit']||null:null,'include':_0x35df00[_0x3b97('0x1c')]?_0x35df00[_0x3b97('0x1c')]['include']?_[_0x3b97('0x20')](_0x35df00['options']['include'],function(_0x117e0b){return{'model':db[_0x117e0b[_0x3b97('0x21')]],'as':_0x117e0b['as'],'attributes':_0x117e0b[_0x3b97('0x1f')],'include':_0x117e0b[_0x3b97('0x22')]?_[_0x3b97('0x20')](_0x117e0b[_0x3b97('0x22')],function(_0x406cbd){return{'model':db[_0x406cbd['model']],'as':_0x406cbd['as'],'attributes':_0x406cbd[_0x3b97('0x1f')],'include':_0x406cbd[_0x3b97('0x22')]?_[_0x3b97('0x20')](_0x406cbd[_0x3b97('0x22')],function(_0x424a9a){return{'model':db[_0x424a9a[_0x3b97('0x21')]],'as':_0x424a9a['as'],'attributes':_0x424a9a[_0x3b97('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x259873){logger['info']('GetOpenchannelQueue',_0x35df00);logger['debug'](_0x3b97('0x19'),_0x35df00,JSON[_0x3b97('0x14')](_0x259873));_0x24f59c(_0x259873);})[_0x3b97('0x23')](function(_0x299f58){logger[_0x3b97('0x15')]('GetOpenchannelQueue',_0x299f58[_0x3b97('0x17')],_0x35df00);_0x1c9601(_0x4fd96a['error'](0x1f4,_0x299f58[_0x3b97('0x17')]));});});};exports[_0x3b97('0x24')]=function(_0x587478){var _0x2d7628=this;return new Promise(function(_0x6e68f7,_0x54dd75){return db['OpenchannelQueue'][_0x3b97('0x25')]({'raw':_0x587478[_0x3b97('0x1c')]?_0x587478['options'][_0x3b97('0x1d')]===undefined?!![]:![]:!![],'where':_0x587478[_0x3b97('0x1c')]?_0x587478['options']['where']||null:null,'attributes':_0x587478[_0x3b97('0x1c')]?_0x587478['options']['attributes']||null:null,'include':_0x587478[_0x3b97('0x1c')]?_0x587478[_0x3b97('0x1c')][_0x3b97('0x22')]?_['map'](_0x587478[_0x3b97('0x1c')][_0x3b97('0x22')],function(_0x534762){return{'model':db[_0x534762['model']],'as':_0x534762['as'],'attributes':_0x534762[_0x3b97('0x1f')],'include':_0x534762[_0x3b97('0x22')]?_[_0x3b97('0x20')](_0x534762[_0x3b97('0x22')],function(_0x2dccc2){return{'model':db[_0x2dccc2[_0x3b97('0x21')]],'as':_0x2dccc2['as'],'attributes':_0x2dccc2[_0x3b97('0x1f')],'include':_0x2dccc2[_0x3b97('0x22')]?_[_0x3b97('0x20')](_0x2dccc2[_0x3b97('0x22')],function(_0x3d1f2c){return{'model':db[_0x3d1f2c[_0x3b97('0x21')]],'as':_0x3d1f2c['as'],'attributes':_0x3d1f2c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a918d){logger[_0x3b97('0xf')]('ShowOpenchannelQueue',_0x587478);logger[_0x3b97('0x12')](_0x3b97('0x24'),_0x587478,JSON[_0x3b97('0x14')](_0x4a918d));_0x6e68f7(_0x4a918d);})[_0x3b97('0x23')](function(_0x518dbd){logger[_0x3b97('0x15')](_0x3b97('0x24'),_0x518dbd['message'],_0x587478);_0x54dd75(_0x2d7628['error'](0x1f4,_0x518dbd[_0x3b97('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 379e797..3249579 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 _0xd539=['save','update','emit','removeListener','length','openchannelQueue:'];(function(_0x1bfe2b,_0x34856e){var _0x1477d4=function(_0x1d558c){while(--_0x1d558c){_0x1bfe2b['push'](_0x1bfe2b['shift']());}};_0x1477d4(++_0x34856e);}(_0xd539,0xc0));var _0x9d53=function(_0x424fca,_0x1f2869){_0x424fca=_0x424fca-0x0;var _0x58b858=_0xd539[_0x424fca];return _0x58b858;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x9d53('0x0'),'remove',_0x9d53('0x1')];function createListener(_0x3f0e21,_0x460926){return function(_0xff54b4){_0x460926[_0x9d53('0x2')](_0x3f0e21,_0xff54b4);};}function removeListener(_0x4428f3,_0x4e6cff){return function(){OpenchannelQueueEvents[_0x9d53('0x3')](_0x4428f3,_0x4e6cff);};}exports['register']=function(_0x2f5e5b){for(var _0x4a0484=0x0,_0x20ce7d=events[_0x9d53('0x4')];_0x4a0484<_0x20ce7d;_0x4a0484++){var _0x2b90e4=events[_0x4a0484];var _0x5be4ec=createListener(_0x9d53('0x5')+_0x2b90e4,_0x2f5e5b);OpenchannelQueueEvents['on'](_0x2b90e4,_0x5be4ec);}}; \ No newline at end of file +var _0x27a4=['register','length','remove','emit','removeListener'];(function(_0x1d1eab,_0x4000d5){var _0x35c2e0=function(_0x401481){while(--_0x401481){_0x1d1eab['push'](_0x1d1eab['shift']());}};_0x35c2e0(++_0x4000d5);}(_0x27a4,0x1ab));var _0x427a=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x27a4[_0x1cc8fe];return _0x230054;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save',_0x427a('0x0'),'update'];function createListener(_0x4151e1,_0x398588){return function(_0x5b3f0b){_0x398588[_0x427a('0x1')](_0x4151e1,_0x5b3f0b);};}function removeListener(_0x2b509d,_0x479db5){return function(){OpenchannelQueueEvents[_0x427a('0x2')](_0x2b509d,_0x479db5);};}exports[_0x427a('0x3')]=function(_0x48cf75){for(var _0x39347b=0x0,_0x4f467c=events[_0x427a('0x4')];_0x39347b<_0x4f467c;_0x39347b++){var _0x2168cc=events[_0x39347b];var _0xb2ae2e=createListener('openchannelQueue:'+_0x2168cc,_0x48cf75);OpenchannelQueueEvents['on'](_0x2168cc,_0xb2ae2e);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index f383a3c..2e129b5 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 _0xf1a6=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller'];(function(_0xb2300f,_0x3e1e5a){var _0x521388=function(_0x2be30d){while(--_0x2be30d){_0xb2300f['push'](_0xb2300f['shift']());}};_0x521388(++_0x3e1e5a);}(_0xf1a6,0xca));var _0x6f1a=function(_0x583f45,_0x28aeea){_0x583f45=_0x583f45-0x0;var _0x3753b9=_0xf1a6[_0x583f45];return _0x3753b9;};'use strict';var multer=require(_0x6f1a('0x0'));var util=require(_0x6f1a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6f1a('0x2'));var router=express[_0x6f1a('0x3')]();var fs_extra=require(_0x6f1a('0x4'));var auth=require(_0x6f1a('0x5'));var interaction=require(_0x6f1a('0x6'));var config=require('../../config/environment');var controller=require(_0x6f1a('0x7'));router[_0x6f1a('0x8')]('/',auth[_0x6f1a('0x9')](),controller[_0x6f1a('0xa')]);router[_0x6f1a('0x8')](_0x6f1a('0xb'),auth['isAuthenticated'](),controller[_0x6f1a('0xc')]);router['get'](_0x6f1a('0xd'),auth[_0x6f1a('0x9')](),controller[_0x6f1a('0xe')]);router[_0x6f1a('0xf')]('/',auth[_0x6f1a('0x9')](),controller[_0x6f1a('0x10')]);router['put'](_0x6f1a('0xd'),auth['isAuthenticated'](),controller[_0x6f1a('0x11')]);router[_0x6f1a('0x12')](_0x6f1a('0xd'),auth[_0x6f1a('0x9')](),controller[_0x6f1a('0x13')]);module[_0x6f1a('0x14')]=router; \ No newline at end of file +var _0x2273=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','/:id','show','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x39aec2,_0x2c1ed9){var _0x36c904=function(_0x4d29fa){while(--_0x4d29fa){_0x39aec2['push'](_0x39aec2['shift']());}};_0x36c904(++_0x2c1ed9);}(_0x2273,0xc2));var _0x3227=function(_0x5c4172,_0x2e8348){_0x5c4172=_0x5c4172-0x0;var _0x110de4=_0x2273[_0x5c4172];return _0x110de4;};'use strict';var multer=require('multer');var util=require(_0x3227('0x0'));var path=require('path');var timeout=require(_0x3227('0x1'));var express=require(_0x3227('0x2'));var router=express[_0x3227('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3227('0x4'));var interaction=require(_0x3227('0x5'));var config=require(_0x3227('0x6'));var controller=require('./openchannelQueueReport.controller');router['get']('/',auth[_0x3227('0x7')](),controller['index']);router[_0x3227('0x8')]('/describe',auth[_0x3227('0x7')](),controller[_0x3227('0x9')]);router[_0x3227('0x8')](_0x3227('0xa'),auth[_0x3227('0x7')](),controller[_0x3227('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3227('0xc')]);router[_0x3227('0xd')](_0x3227('0xa'),auth['isAuthenticated'](),controller[_0x3227('0xe')]);router[_0x3227('0xf')](_0x3227('0xa'),auth[_0x3227('0x7')](),controller[_0x3227('0x10')]);module[_0x3227('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 10dd778..62cdb6d 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 _0x951e=['DATE','moment','sequelize','exports','STRING'];(function(_0x355ce8,_0x5f1d0a){var _0x1db8b8=function(_0x277eb2){while(--_0x277eb2){_0x355ce8['push'](_0x355ce8['shift']());}};_0x1db8b8(++_0x5f1d0a);}(_0x951e,0xc9));var _0xe951=function(_0x25e655,_0x35246b){_0x25e655=_0x25e655-0x0;var _0x48da6b=_0x951e[_0x25e655];return _0x48da6b;};'use strict';var moment=require(_0xe951('0x0'));var Sequelize=require(_0xe951('0x1'));module[_0xe951('0x2')]={'uniqueid':{'type':Sequelize[_0xe951('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xe951('0x3')]},'joinAt':{'type':Sequelize[_0xe951('0x4')]},'leaveAt':{'type':Sequelize[_0xe951('0x4')]},'acceptAt':{'type':Sequelize[_0xe951('0x4')]},'exitAt':{'type':Sequelize[_0xe951('0x4')]},'reason':{'type':Sequelize[_0xe951('0x3')]}}; \ No newline at end of file +var _0x3710=['DATE','moment','STRING'];(function(_0x1d1ce2,_0x11ba1d){var _0x357e03=function(_0x34e55a){while(--_0x34e55a){_0x1d1ce2['push'](_0x1d1ce2['shift']());}};_0x357e03(++_0x11ba1d);}(_0x3710,0x17e));var _0x0371=function(_0x4b437d,_0x51446d){_0x4b437d=_0x4b437d-0x0;var _0x4822e3=_0x3710[_0x4b437d];return _0x4822e3;};'use strict';var moment=require(_0x0371('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x0371('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x0371('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x0371('0x2')]},'acceptAt':{'type':Sequelize[_0x0371('0x2')]},'exitAt':{'type':Sequelize[_0x0371('0x2')]},'reason':{'type':Sequelize[_0x0371('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 1192da4..0a04a85 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 _0x6686=['sendStatus','status','end','offset','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','index','rawAttributes','fieldName','model','map','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','merge','where','type','VIRTUAL','filter','options','OpenchannelQueueReport','includeAll','findAll','rows','catch','keys','include','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x55ef8b,_0x5deb5e){var _0x359c84=function(_0x437673){while(--_0x437673){_0x55ef8b['push'](_0x55ef8b['shift']());}};_0x359c84(++_0x5deb5e);}(_0x6686,0x7d));var _0x6668=function(_0x5a0b38,_0x222085){_0x5a0b38=_0x5a0b38-0x0;var _0x3b7b8f=_0x6686[_0x5a0b38];return _0x3b7b8f;};'use strict';var emlformat=require(_0x6668('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6668('0x1'));var jsonpatch=require(_0x6668('0x2'));var rp=require(_0x6668('0x3'));var moment=require('moment');var BPromise=require(_0x6668('0x4'));var Mustache=require(_0x6668('0x5'));var util=require('util');var path=require(_0x6668('0x6'));var sox=require(_0x6668('0x7'));var csv=require(_0x6668('0x8'));var ejs=require(_0x6668('0x9'));var fs=require('fs');var fs_extra=require(_0x6668('0xa'));var _=require(_0x6668('0xb'));var squel=require(_0x6668('0xc'));var crypto=require(_0x6668('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6668('0xe'));var toCsv=require(_0x6668('0x8'));var querystring=require(_0x6668('0xf'));var Papa=require(_0x6668('0x10'));var Redis=require(_0x6668('0x11'));var authService=require(_0x6668('0x12'));var qs=require(_0x6668('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6668('0x14'));var logger=require(_0x6668('0x15'))(_0x6668('0x16'));var utils=require(_0x6668('0x17'));var config=require(_0x6668('0x18'));var licenseUtil=require(_0x6668('0x19'));var db=require(_0x6668('0x1a'))['db'];function respondWithStatusCode(_0x22adcf,_0x24a7f8){_0x24a7f8=_0x24a7f8||0xcc;return function(_0x9b4f75){if(_0x9b4f75){return _0x22adcf[_0x6668('0x1b')](_0x24a7f8);}return _0x22adcf[_0x6668('0x1c')](_0x24a7f8)[_0x6668('0x1d')]();};}function respondWithResult(_0x13718c,_0x5b7ca3){_0x5b7ca3=_0x5b7ca3||0xc8;return function(_0x3bfc75){if(_0x3bfc75){return _0x13718c[_0x6668('0x1c')](_0x5b7ca3)['json'](_0x3bfc75);}};}function respondWithFilteredResult(_0x360ed8,_0x55c230){return function(_0x39ce9b){if(_0x39ce9b){var _0xf30ed9=typeof _0x55c230['offset']==='undefined'&&typeof _0x55c230['limit']==='undefined';var _0x547be2=_0x39ce9b['count'];var _0x100b37=_0xf30ed9?0x0:_0x55c230[_0x6668('0x1e')];var _0x4c8d98=_0xf30ed9?_0x39ce9b[_0x6668('0x1f')]:_0x55c230[_0x6668('0x1e')]+_0x55c230['limit'];var _0x17db72;if(_0x4c8d98>=_0x547be2){_0x4c8d98=_0x547be2;_0x17db72=0xc8;}else{_0x17db72=0xce;}_0x360ed8[_0x6668('0x1c')](_0x17db72);return _0x360ed8[_0x6668('0x20')](_0x6668('0x21'),_0x100b37+'-'+_0x4c8d98+'/'+_0x547be2)[_0x6668('0x22')](_0x39ce9b);}return null;};}function patchUpdates(_0x51c199){return function(_0xdb2a7){try{jsonpatch[_0x6668('0x23')](_0xdb2a7,_0x51c199,!![]);}catch(_0x10d19b){return BPromise['reject'](_0x10d19b);}return _0xdb2a7[_0x6668('0x24')]();};}function saveUpdates(_0x349bce,_0x2c3c08){return function(_0x403f02){if(_0x403f02){return _0x403f02[_0x6668('0x25')](_0x349bce)[_0x6668('0x26')](function(_0x2bb4f5){return _0x2bb4f5;});}return null;};}function removeEntity(_0x1dd8c3,_0x2c8556){return function(_0x39ef0e){if(_0x39ef0e){return _0x39ef0e[_0x6668('0x27')]()['then'](function(){_0x1dd8c3['status'](0xcc)[_0x6668('0x1d')]();});}};}function handleEntityNotFound(_0x2f2a54,_0x515c8d){return function(_0x5c1c5b){if(!_0x5c1c5b){_0x2f2a54[_0x6668('0x1b')](0x194);}return _0x5c1c5b;};}function handleError(_0x4017ed,_0x3482f1){_0x3482f1=_0x3482f1||0x1f4;return function(_0x551975){logger[_0x6668('0x28')](_0x551975[_0x6668('0x29')]);if(_0x551975[_0x6668('0x2a')]){delete _0x551975['name'];}_0x4017ed[_0x6668('0x1c')](_0x3482f1)['send'](_0x551975);};}exports[_0x6668('0x2b')]=function(_0x4db573,_0x5e82c9){var _0x50c729={},_0x4f6b56={},_0x229f26={'count':0x0,'rows':[]};var _0x95c58d=_['map'](db['OpenchannelQueueReport'][_0x6668('0x2c')],function(_0x14ba25){return{'name':_0x14ba25[_0x6668('0x2d')],'type':_0x14ba25['type']['key']};});_0x4f6b56[_0x6668('0x2e')]=_[_0x6668('0x2f')](_0x95c58d,_0x6668('0x2a'));_0x4f6b56[_0x6668('0x30')]=_['keys'](_0x4db573[_0x6668('0x30')]);_0x4f6b56[_0x6668('0x31')]=_[_0x6668('0x32')](_0x4f6b56[_0x6668('0x2e')],_0x4f6b56[_0x6668('0x30')]);_0x50c729[_0x6668('0x33')]=_['intersection'](_0x4f6b56[_0x6668('0x2e')],qs[_0x6668('0x34')](_0x4db573['query'][_0x6668('0x34')]));_0x50c729[_0x6668('0x33')]=_0x50c729[_0x6668('0x33')][_0x6668('0x35')]?_0x50c729[_0x6668('0x33')]:_0x4f6b56['model'];if(!_0x4db573[_0x6668('0x30')]['hasOwnProperty'](_0x6668('0x36'))){_0x50c729[_0x6668('0x37')]=qs[_0x6668('0x37')](_0x4db573[_0x6668('0x30')][_0x6668('0x37')]);_0x50c729[_0x6668('0x1e')]=qs['offset'](_0x4db573[_0x6668('0x30')]['offset']);}_0x50c729[_0x6668('0x38')]=qs[_0x6668('0x39')](_0x4db573[_0x6668('0x30')][_0x6668('0x39')]);_0x50c729['where']=qs['filters'](_['pick'](_0x4db573[_0x6668('0x30')],_0x4f6b56[_0x6668('0x31')]),_0x95c58d);if(_0x4db573['query']['filter']){_0x50c729['where']=_[_0x6668('0x3a')](_0x50c729[_0x6668('0x3b')],{'$or':_[_0x6668('0x2f')](_0x95c58d,function(_0x6a6bf5){if(_0x6a6bf5[_0x6668('0x3c')]!==_0x6668('0x3d')){var _0x77ed49={};_0x77ed49[_0x6a6bf5[_0x6668('0x2a')]]={'$like':'%'+_0x4db573[_0x6668('0x30')][_0x6668('0x3e')]+'%'};return _0x77ed49;}})});}_0x50c729=_[_0x6668('0x3a')]({},_0x50c729,_0x4db573[_0x6668('0x3f')]);var _0x2e6ffa={'where':_0x50c729[_0x6668('0x3b')]};return db[_0x6668('0x40')][_0x6668('0x1f')](_0x2e6ffa)['then'](function(_0x415a1f){_0x229f26[_0x6668('0x1f')]=_0x415a1f;if(_0x4db573[_0x6668('0x30')][_0x6668('0x41')]){_0x50c729['include']=[{'all':!![]}];}return db[_0x6668('0x40')][_0x6668('0x42')](_0x50c729);})[_0x6668('0x26')](function(_0x179d75){_0x229f26[_0x6668('0x43')]=_0x179d75;return _0x229f26;})[_0x6668('0x26')](respondWithFilteredResult(_0x5e82c9,_0x50c729))[_0x6668('0x44')](handleError(_0x5e82c9,null));};exports['show']=function(_0xf1147f,_0x3a6fbe){var _0x5d40d6={'raw':!![],'where':{'id':_0xf1147f['params']['id']}},_0x1e3b6b={};_0x1e3b6b['model']=_['keys'](db[_0x6668('0x40')][_0x6668('0x2c')]);_0x1e3b6b['query']=_[_0x6668('0x45')](_0xf1147f[_0x6668('0x30')]);_0x1e3b6b[_0x6668('0x31')]=_[_0x6668('0x32')](_0x1e3b6b[_0x6668('0x2e')],_0x1e3b6b[_0x6668('0x30')]);_0x5d40d6[_0x6668('0x33')]=_[_0x6668('0x32')](_0x1e3b6b[_0x6668('0x2e')],qs[_0x6668('0x34')](_0xf1147f[_0x6668('0x30')]['fields']));_0x5d40d6[_0x6668('0x33')]=_0x5d40d6[_0x6668('0x33')][_0x6668('0x35')]?_0x5d40d6[_0x6668('0x33')]:_0x1e3b6b['model'];if(_0xf1147f['query'][_0x6668('0x41')]){_0x5d40d6[_0x6668('0x46')]=[{'all':!![]}];}_0x5d40d6=_['merge']({},_0x5d40d6,_0xf1147f['options']);return db[_0x6668('0x40')][_0x6668('0x47')](_0x5d40d6)[_0x6668('0x26')](handleEntityNotFound(_0x3a6fbe,null))[_0x6668('0x26')](respondWithResult(_0x3a6fbe,null))[_0x6668('0x44')](handleError(_0x3a6fbe,null));};exports[_0x6668('0x48')]=function(_0x4a09f8,_0x18d8d4){return db[_0x6668('0x40')][_0x6668('0x48')](_0x4a09f8[_0x6668('0x49')],{})[_0x6668('0x26')](respondWithResult(_0x18d8d4,0xc9))['catch'](handleError(_0x18d8d4,null));};exports[_0x6668('0x25')]=function(_0x3275c8,_0x7019e6){if(_0x3275c8[_0x6668('0x49')]['id']){delete _0x3275c8['body']['id'];}return db[_0x6668('0x40')][_0x6668('0x47')]({'where':{'id':_0x3275c8[_0x6668('0x4a')]['id']}})[_0x6668('0x26')](handleEntityNotFound(_0x7019e6,null))[_0x6668('0x26')](saveUpdates(_0x3275c8[_0x6668('0x49')],null))[_0x6668('0x26')](respondWithResult(_0x7019e6,null))[_0x6668('0x44')](handleError(_0x7019e6,null));};exports[_0x6668('0x27')]=function(_0x25c36c,_0x1aa350){return db['OpenchannelQueueReport'][_0x6668('0x47')]({'where':{'id':_0x25c36c[_0x6668('0x4a')]['id']}})[_0x6668('0x26')](handleEntityNotFound(_0x1aa350,null))['then'](removeEntity(_0x1aa350,null))['catch'](handleError(_0x1aa350,null));};exports[_0x6668('0x4b')]=function(_0x163085,_0xea767e){return db[_0x6668('0x40')]['describe']()[_0x6668('0x26')](respondWithResult(_0xea767e,null))[_0x6668('0x44')](handleError(_0xea767e,null));}; \ No newline at end of file +var _0x3c01=['destroy','sendStatus','error','stack','name','send','index','map','OpenchannelQueueReport','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','params','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','offset','undefined','limit','status','set','Content-Range','json','apply','reject','update','then'];(function(_0x331cdd,_0x54a027){var _0xfaa28=function(_0x2b94f5){while(--_0x2b94f5){_0x331cdd['push'](_0x331cdd['shift']());}};_0xfaa28(++_0x54a027);}(_0x3c01,0x1a3));var _0x13c0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3c01[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x13c0('0x0'));var zipdir=require(_0x13c0('0x1'));var jsonpatch=require(_0x13c0('0x2'));var rp=require(_0x13c0('0x3'));var moment=require('moment');var BPromise=require(_0x13c0('0x4'));var Mustache=require(_0x13c0('0x5'));var util=require(_0x13c0('0x6'));var path=require(_0x13c0('0x7'));var sox=require('sox');var csv=require(_0x13c0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x13c0('0x9'));var _=require(_0x13c0('0xa'));var squel=require(_0x13c0('0xb'));var crypto=require('crypto');var jsforce=require(_0x13c0('0xc'));var deskjs=require(_0x13c0('0xd'));var toCsv=require(_0x13c0('0x8'));var querystring=require(_0x13c0('0xe'));var Papa=require(_0x13c0('0xf'));var Redis=require(_0x13c0('0x10'));var authService=require(_0x13c0('0x11'));var qs=require(_0x13c0('0x12'));var as=require(_0x13c0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x13c0('0x14'))(_0x13c0('0x15'));var utils=require(_0x13c0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x13c0('0x17'));var db=require(_0x13c0('0x18'))['db'];function respondWithStatusCode(_0x2acc2c,_0x233610){_0x233610=_0x233610||0xcc;return function(_0x374295){if(_0x374295){return _0x2acc2c['sendStatus'](_0x233610);}return _0x2acc2c['status'](_0x233610)[_0x13c0('0x19')]();};}function respondWithResult(_0x38877e,_0x580712){_0x580712=_0x580712||0xc8;return function(_0x14a32c){if(_0x14a32c){return _0x38877e['status'](_0x580712)['json'](_0x14a32c);}};}function respondWithFilteredResult(_0x274b65,_0x5daa86){return function(_0xbd4b6d){if(_0xbd4b6d){var _0x212a2e=typeof _0x5daa86[_0x13c0('0x1a')]===_0x13c0('0x1b')&&typeof _0x5daa86[_0x13c0('0x1c')]==='undefined';var _0x2d802c=_0xbd4b6d['count'];var _0x31360d=_0x212a2e?0x0:_0x5daa86[_0x13c0('0x1a')];var _0x56725e=_0x212a2e?_0xbd4b6d['count']:_0x5daa86[_0x13c0('0x1a')]+_0x5daa86['limit'];var _0x4ff4d8;if(_0x56725e>=_0x2d802c){_0x56725e=_0x2d802c;_0x4ff4d8=0xc8;}else{_0x4ff4d8=0xce;}_0x274b65[_0x13c0('0x1d')](_0x4ff4d8);return _0x274b65[_0x13c0('0x1e')](_0x13c0('0x1f'),_0x31360d+'-'+_0x56725e+'/'+_0x2d802c)[_0x13c0('0x20')](_0xbd4b6d);}return null;};}function patchUpdates(_0x539bd7){return function(_0x4181bf){try{jsonpatch[_0x13c0('0x21')](_0x4181bf,_0x539bd7,!![]);}catch(_0x3b7270){return BPromise[_0x13c0('0x22')](_0x3b7270);}return _0x4181bf['save']();};}function saveUpdates(_0x3a2a5f,_0x33ce4a){return function(_0x5f4939){if(_0x5f4939){return _0x5f4939[_0x13c0('0x23')](_0x3a2a5f)[_0x13c0('0x24')](function(_0x35a65a){return _0x35a65a;});}return null;};}function removeEntity(_0x377f3f,_0x243ca5){return function(_0x29acbc){if(_0x29acbc){return _0x29acbc[_0x13c0('0x25')]()[_0x13c0('0x24')](function(){_0x377f3f[_0x13c0('0x1d')](0xcc)[_0x13c0('0x19')]();});}};}function handleEntityNotFound(_0x1e8bc8,_0x1d5f2c){return function(_0x1a5a27){if(!_0x1a5a27){_0x1e8bc8[_0x13c0('0x26')](0x194);}return _0x1a5a27;};}function handleError(_0x1dd552,_0x4732c3){_0x4732c3=_0x4732c3||0x1f4;return function(_0x411532){logger[_0x13c0('0x27')](_0x411532[_0x13c0('0x28')]);if(_0x411532[_0x13c0('0x29')]){delete _0x411532[_0x13c0('0x29')];}_0x1dd552[_0x13c0('0x1d')](_0x4732c3)[_0x13c0('0x2a')](_0x411532);};}exports[_0x13c0('0x2b')]=function(_0x130daf,_0x3b78fe){var _0xe14d7c={},_0x36391d={},_0x3ffd3b={'count':0x0,'rows':[]};var _0x273f77=_[_0x13c0('0x2c')](db[_0x13c0('0x2d')]['rawAttributes'],function(_0x22f47d){return{'name':_0x22f47d[_0x13c0('0x2e')],'type':_0x22f47d[_0x13c0('0x2f')]['key']};});_0x36391d[_0x13c0('0x30')]=_[_0x13c0('0x2c')](_0x273f77,_0x13c0('0x29'));_0x36391d[_0x13c0('0x31')]=_[_0x13c0('0x32')](_0x130daf['query']);_0x36391d['filters']=_[_0x13c0('0x33')](_0x36391d[_0x13c0('0x30')],_0x36391d[_0x13c0('0x31')]);_0xe14d7c[_0x13c0('0x34')]=_[_0x13c0('0x33')](_0x36391d[_0x13c0('0x30')],qs[_0x13c0('0x35')](_0x130daf[_0x13c0('0x31')][_0x13c0('0x35')]));_0xe14d7c[_0x13c0('0x34')]=_0xe14d7c[_0x13c0('0x34')][_0x13c0('0x36')]?_0xe14d7c[_0x13c0('0x34')]:_0x36391d[_0x13c0('0x30')];if(!_0x130daf[_0x13c0('0x31')][_0x13c0('0x37')](_0x13c0('0x38'))){_0xe14d7c[_0x13c0('0x1c')]=qs[_0x13c0('0x1c')](_0x130daf['query'][_0x13c0('0x1c')]);_0xe14d7c[_0x13c0('0x1a')]=qs[_0x13c0('0x1a')](_0x130daf[_0x13c0('0x31')][_0x13c0('0x1a')]);}_0xe14d7c[_0x13c0('0x39')]=qs['sort'](_0x130daf[_0x13c0('0x31')][_0x13c0('0x3a')]);_0xe14d7c[_0x13c0('0x3b')]=qs[_0x13c0('0x3c')](_['pick'](_0x130daf[_0x13c0('0x31')],_0x36391d[_0x13c0('0x3c')]),_0x273f77);if(_0x130daf['query'][_0x13c0('0x3d')]){_0xe14d7c[_0x13c0('0x3b')]=_[_0x13c0('0x3e')](_0xe14d7c['where'],{'$or':_[_0x13c0('0x2c')](_0x273f77,function(_0x308155){if(_0x308155[_0x13c0('0x2f')]!==_0x13c0('0x3f')){var _0xfc9d49={};_0xfc9d49[_0x308155['name']]={'$like':'%'+_0x130daf[_0x13c0('0x31')][_0x13c0('0x3d')]+'%'};return _0xfc9d49;}})});}_0xe14d7c=_['merge']({},_0xe14d7c,_0x130daf[_0x13c0('0x40')]);var _0x424b32={'where':_0xe14d7c[_0x13c0('0x3b')]};return db[_0x13c0('0x2d')][_0x13c0('0x41')](_0x424b32)['then'](function(_0x57b2cb){_0x3ffd3b[_0x13c0('0x41')]=_0x57b2cb;if(_0x130daf['query'][_0x13c0('0x42')]){_0xe14d7c['include']=[{'all':!![]}];}return db[_0x13c0('0x2d')][_0x13c0('0x43')](_0xe14d7c);})['then'](function(_0x58096f){_0x3ffd3b[_0x13c0('0x44')]=_0x58096f;return _0x3ffd3b;})['then'](respondWithFilteredResult(_0x3b78fe,_0xe14d7c))[_0x13c0('0x45')](handleError(_0x3b78fe,null));};exports['show']=function(_0x22bf9c,_0x57424b){var _0x46e8d7={'raw':!![],'where':{'id':_0x22bf9c[_0x13c0('0x46')]['id']}},_0x1bded3={};_0x1bded3[_0x13c0('0x30')]=_[_0x13c0('0x32')](db['OpenchannelQueueReport']['rawAttributes']);_0x1bded3['query']=_[_0x13c0('0x32')](_0x22bf9c[_0x13c0('0x31')]);_0x1bded3[_0x13c0('0x3c')]=_[_0x13c0('0x33')](_0x1bded3['model'],_0x1bded3[_0x13c0('0x31')]);_0x46e8d7[_0x13c0('0x34')]=_[_0x13c0('0x33')](_0x1bded3[_0x13c0('0x30')],qs[_0x13c0('0x35')](_0x22bf9c[_0x13c0('0x31')][_0x13c0('0x35')]));_0x46e8d7[_0x13c0('0x34')]=_0x46e8d7[_0x13c0('0x34')][_0x13c0('0x36')]?_0x46e8d7['attributes']:_0x1bded3['model'];if(_0x22bf9c[_0x13c0('0x31')][_0x13c0('0x42')]){_0x46e8d7[_0x13c0('0x47')]=[{'all':!![]}];}_0x46e8d7=_[_0x13c0('0x3e')]({},_0x46e8d7,_0x22bf9c[_0x13c0('0x40')]);return db[_0x13c0('0x2d')][_0x13c0('0x48')](_0x46e8d7)[_0x13c0('0x24')](handleEntityNotFound(_0x57424b,null))[_0x13c0('0x24')](respondWithResult(_0x57424b,null))[_0x13c0('0x45')](handleError(_0x57424b,null));};exports[_0x13c0('0x49')]=function(_0x485aa4,_0xf29b30){return db[_0x13c0('0x2d')]['create'](_0x485aa4['body'],{})['then'](respondWithResult(_0xf29b30,0xc9))[_0x13c0('0x45')](handleError(_0xf29b30,null));};exports[_0x13c0('0x23')]=function(_0xba1843,_0x20f771){if(_0xba1843['body']['id']){delete _0xba1843[_0x13c0('0x4a')]['id'];}return db[_0x13c0('0x2d')][_0x13c0('0x48')]({'where':{'id':_0xba1843[_0x13c0('0x46')]['id']}})[_0x13c0('0x24')](handleEntityNotFound(_0x20f771,null))[_0x13c0('0x24')](saveUpdates(_0xba1843[_0x13c0('0x4a')],null))['then'](respondWithResult(_0x20f771,null))[_0x13c0('0x45')](handleError(_0x20f771,null));};exports[_0x13c0('0x25')]=function(_0x11dc79,_0x5c8617){return db[_0x13c0('0x2d')]['find']({'where':{'id':_0x11dc79['params']['id']}})['then'](handleEntityNotFound(_0x5c8617,null))['then'](removeEntity(_0x5c8617,null))[_0x13c0('0x45')](handleError(_0x5c8617,null));};exports['describe']=function(_0xc2b90f,_0x54e3e8){return db['OpenchannelQueueReport'][_0x13c0('0x4b')]()['then'](respondWithResult(_0x54e3e8,null))['catch'](handleError(_0x54e3e8,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 9fd6146..4ff6610 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 _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0x4d7aaf,_0xb955da){var _0x33fb7b=function(_0x59ce86){while(--_0x59ce86){_0x4d7aaf['push'](_0x4d7aaf['shift']());}};_0x33fb7b(++_0xb955da);}(_0xe14b,0x93));var _0xbe14=function(_0x11df3a,_0x244119){_0x11df3a=_0x11df3a-0x0;var _0x3dc03c=_0xe14b[_0x11df3a];return _0x3dc03c;};'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':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x2c6706,_0x21bb65){var _0x2f2930=function(_0x504c71){while(--_0x504c71){_0x2c6706['push'](_0x2c6706['shift']());}};_0x2f2930(++_0x21bb65);}(_0x1261,0x144));var _0x1126=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x1261[_0x34843e];return _0x598f7f;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 385b3ee..5fec54b 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 _0x236c=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','body','options','raw','UpdateOpenchannelQueueReport','update','attributes'];(function(_0x33ed44,_0x541d70){var _0x275f40=function(_0xcf367b){while(--_0xcf367b){_0x33ed44['push'](_0x33ed44['shift']());}};_0x275f40(++_0x541d70);}(_0x236c,0x155));var _0xc236=function(_0xe7366b,_0xeedc32){_0xe7366b=_0xe7366b-0x0;var _0x43e4a8=_0x236c[_0xe7366b];return _0x43e4a8;};'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});function respondWithRpcPromise(_0x5abd65,_0xd612c6,_0x4d349b){return new BPromise(function(_0x51a13b,_0x5bc6a2){return client['request'](_0x5abd65,_0x4d349b)[_0xc236('0xc')](function(_0x4b8dc6){logger[_0xc236('0xd')](_0xc236('0xe'),_0xd612c6,_0xc236('0xf'));logger[_0xc236('0x10')](_0xc236('0x11'),_0xd612c6,'request\x20sent',JSON[_0xc236('0x12')](_0x4b8dc6));if(_0x4b8dc6[_0xc236('0x13')]){if(_0x4b8dc6['error'][_0xc236('0x14')]===0x1f4){logger[_0xc236('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xd612c6,_0x4b8dc6[_0xc236('0x13')]['message']);return _0x5bc6a2(_0x4b8dc6['error'][_0xc236('0x15')]);}logger[_0xc236('0x13')](_0xc236('0xe'),_0xd612c6,_0x4b8dc6[_0xc236('0x13')]['message']);return _0x51a13b(_0x4b8dc6[_0xc236('0x13')]['message']);}else{logger['info'](_0xc236('0xe'),_0xd612c6,_0xc236('0xf'));_0x51a13b(_0x4b8dc6[_0xc236('0x16')][_0xc236('0x15')]);}})[_0xc236('0x17')](function(_0x5ac3ed){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0xd612c6,_0x5ac3ed);_0x5bc6a2(_0x5ac3ed);});});}exports[_0xc236('0x18')]=function(_0x76f45){var _0x11ec65=this;return new Promise(function(_0x541a20,_0x13b432){return db['OpenchannelQueueReport']['create'](_0x76f45[_0xc236('0x19')],{'raw':_0x76f45[_0xc236('0x1a')]?_0x76f45[_0xc236('0x1a')][_0xc236('0x1b')]===undefined?!![]:![]:!![]})[_0xc236('0xc')](function(_0x27c6ab){logger[_0xc236('0xd')](_0xc236('0x18'),_0x76f45);logger[_0xc236('0x10')](_0xc236('0x18'),_0x76f45,JSON[_0xc236('0x12')](_0x27c6ab));_0x541a20(_0x27c6ab);})['catch'](function(_0x208c3f){logger[_0xc236('0x13')](_0xc236('0x18'),_0x208c3f[_0xc236('0x15')],_0x76f45);_0x13b432(_0x11ec65[_0xc236('0x13')](0x1f4,_0x208c3f[_0xc236('0x15')]));});});};exports[_0xc236('0x1c')]=function(_0xf921e6){var _0x1d65e2=this;return new Promise(function(_0x3b4059,_0x17cb3b){return db['OpenchannelQueueReport'][_0xc236('0x1d')](_0xf921e6[_0xc236('0x19')],{'raw':_0xf921e6[_0xc236('0x1a')]?_0xf921e6[_0xc236('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf921e6[_0xc236('0x1a')]?_0xf921e6['options']['where']||null:null,'attributes':_0xf921e6[_0xc236('0x1a')]?_0xf921e6['options'][_0xc236('0x1e')]||null:null,'limit':_0xf921e6['options']?_0xf921e6[_0xc236('0x1a')]['limit']||null:null})[_0xc236('0xc')](function(_0x1d144b){logger['info']('UpdateOpenchannelQueueReport',_0xf921e6);logger[_0xc236('0x10')](_0xc236('0x1c'),_0xf921e6,JSON[_0xc236('0x12')](_0x1d144b));_0x3b4059(_0x1d144b);})[_0xc236('0x17')](function(_0x5f3891){logger['error'](_0xc236('0x1c'),_0x5f3891['message'],_0xf921e6);_0x17cb3b(_0x1d65e2[_0xc236('0x13')](0x1f4,_0x5f3891['message']));});});}; \ No newline at end of file +var _0x2b65=['jayson/promise','client','http','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','options','raw','stringify','UpdateOpenchannelQueueReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x39e164,_0x2cb93b){var _0x13fa6b=function(_0x511cb2){while(--_0x511cb2){_0x39e164['push'](_0x39e164['shift']());}};_0x13fa6b(++_0x2cb93b);}(_0x2b65,0x131));var _0x52b6=function(_0x276232,_0x20b6b8){_0x276232=_0x276232-0x0;var _0x427024=_0x2b65[_0x276232];return _0x427024;};'use strict';var _=require(_0x52b6('0x0'));var util=require(_0x52b6('0x1'));var moment=require(_0x52b6('0x2'));var BPromise=require(_0x52b6('0x3'));var rs=require(_0x52b6('0x4'));var fs=require('fs');var Redis=require(_0x52b6('0x5'));var db=require(_0x52b6('0x6'))['db'];var utils=require(_0x52b6('0x7'));var logger=require('../../config/logger')(_0x52b6('0x8'));var config=require(_0x52b6('0x9'));var jayson=require(_0x52b6('0xa'));var client=jayson[_0x52b6('0xb')][_0x52b6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d451f,_0x70579,_0x1af78f){return new BPromise(function(_0x432726,_0x27c5b9){return client['request'](_0x2d451f,_0x1af78f)[_0x52b6('0xd')](function(_0x1c2cb5){logger[_0x52b6('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x70579,_0x52b6('0xf'));logger[_0x52b6('0x10')](_0x52b6('0x11'),_0x70579,_0x52b6('0xf'),JSON['stringify'](_0x1c2cb5));if(_0x1c2cb5[_0x52b6('0x12')]){if(_0x1c2cb5[_0x52b6('0x12')][_0x52b6('0x13')]===0x1f4){logger['error'](_0x52b6('0x14'),_0x70579,_0x1c2cb5[_0x52b6('0x12')]['message']);return _0x27c5b9(_0x1c2cb5[_0x52b6('0x12')]['message']);}logger['error'](_0x52b6('0x14'),_0x70579,_0x1c2cb5[_0x52b6('0x12')][_0x52b6('0x15')]);return _0x432726(_0x1c2cb5[_0x52b6('0x12')][_0x52b6('0x15')]);}else{logger[_0x52b6('0xe')](_0x52b6('0x14'),_0x70579,_0x52b6('0xf'));_0x432726(_0x1c2cb5[_0x52b6('0x16')][_0x52b6('0x15')]);}})[_0x52b6('0x17')](function(_0x307594){logger[_0x52b6('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x70579,_0x307594);_0x27c5b9(_0x307594);});});}exports[_0x52b6('0x18')]=function(_0x2fa3ed){var _0x9bab0a=this;return new Promise(function(_0x47d203,_0x36d376){return db[_0x52b6('0x19')]['create'](_0x2fa3ed['body'],{'raw':_0x2fa3ed[_0x52b6('0x1a')]?_0x2fa3ed['options'][_0x52b6('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x2e472f){logger[_0x52b6('0xe')](_0x52b6('0x18'),_0x2fa3ed);logger[_0x52b6('0x10')]('CreateOpenchannelQueueReport',_0x2fa3ed,JSON[_0x52b6('0x1c')](_0x2e472f));_0x47d203(_0x2e472f);})[_0x52b6('0x17')](function(_0x1246db){logger[_0x52b6('0x12')](_0x52b6('0x18'),_0x1246db[_0x52b6('0x15')],_0x2fa3ed);_0x36d376(_0x9bab0a[_0x52b6('0x12')](0x1f4,_0x1246db[_0x52b6('0x15')]));});});};exports[_0x52b6('0x1d')]=function(_0x55aa4c){var _0x2a97c0=this;return new Promise(function(_0x2ff6f4,_0x3a2fb0){return db[_0x52b6('0x19')][_0x52b6('0x1e')](_0x55aa4c[_0x52b6('0x1f')],{'raw':_0x55aa4c[_0x52b6('0x1a')]?_0x55aa4c[_0x52b6('0x1a')][_0x52b6('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55aa4c[_0x52b6('0x1a')]?_0x55aa4c[_0x52b6('0x1a')][_0x52b6('0x20')]||null:null,'attributes':_0x55aa4c[_0x52b6('0x1a')]?_0x55aa4c[_0x52b6('0x1a')][_0x52b6('0x21')]||null:null,'limit':_0x55aa4c[_0x52b6('0x1a')]?_0x55aa4c['options'][_0x52b6('0x22')]||null:null})[_0x52b6('0xd')](function(_0x1716b6){logger[_0x52b6('0xe')](_0x52b6('0x1d'),_0x55aa4c);logger[_0x52b6('0x10')](_0x52b6('0x1d'),_0x55aa4c,JSON['stringify'](_0x1716b6));_0x2ff6f4(_0x1716b6);})[_0x52b6('0x17')](function(_0x42ac9b){logger['error'](_0x52b6('0x1d'),_0x42ac9b[_0x52b6('0x15')],_0x55aa4c);_0x3a2fb0(_0x2a97c0[_0x52b6('0x12')](0x1f4,_0x42ac9b[_0x52b6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index c827618..04308ba 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 _0x0f61=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2298f0,_0x3bbf4f){var _0x39b136=function(_0xc2cd6e){while(--_0xc2cd6e){_0x2298f0['push'](_0x2298f0['shift']());}};_0x39b136(++_0x3bbf4f);}(_0x0f61,0x1ba));var _0x10f6=function(_0x422424,_0x2f3913){_0x422424=_0x422424-0x0;var _0x419af4=_0x0f61[_0x422424];return _0x419af4;};'use strict';var multer=require(_0x10f6('0x0'));var util=require('util');var path=require(_0x10f6('0x1'));var timeout=require(_0x10f6('0x2'));var express=require(_0x10f6('0x3'));var router=express[_0x10f6('0x4')]();var fs_extra=require(_0x10f6('0x5'));var auth=require(_0x10f6('0x6'));var interaction=require(_0x10f6('0x7'));var config=require(_0x10f6('0x8'));var controller=require('./openchannelTransferReport.controller');router[_0x10f6('0x9')]('/',auth[_0x10f6('0xa')](),controller['index']);router[_0x10f6('0x9')]('/describe',auth[_0x10f6('0xa')](),controller['describe']);router[_0x10f6('0x9')](_0x10f6('0xb'),auth[_0x10f6('0xa')](),controller[_0x10f6('0xc')]);router[_0x10f6('0xd')]('/',auth[_0x10f6('0xa')](),controller[_0x10f6('0xe')]);router[_0x10f6('0xf')](_0x10f6('0xb'),auth[_0x10f6('0xa')](),controller[_0x10f6('0x10')]);router[_0x10f6('0x11')](_0x10f6('0xb'),auth[_0x10f6('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf46d=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','delete','destroy','exports'];(function(_0x20ab29,_0x12dfdc){var _0x5406e4=function(_0xab5b9c){while(--_0xab5b9c){_0x20ab29['push'](_0x20ab29['shift']());}};_0x5406e4(++_0x12dfdc);}(_0xf46d,0x140));var _0xdf46=function(_0x55c00d,_0x520cb6){_0x55c00d=_0x55c00d-0x0;var _0x254a8f=_0xf46d[_0x55c00d];return _0x254a8f;};'use strict';var multer=require(_0xdf46('0x0'));var util=require(_0xdf46('0x1'));var path=require('path');var timeout=require(_0xdf46('0x2'));var express=require(_0xdf46('0x3'));var router=express[_0xdf46('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdf46('0x5'));var interaction=require(_0xdf46('0x6'));var config=require(_0xdf46('0x7'));var controller=require('./openchannelTransferReport.controller');router[_0xdf46('0x8')]('/',auth[_0xdf46('0x9')](),controller['index']);router[_0xdf46('0x8')](_0xdf46('0xa'),auth['isAuthenticated'](),controller[_0xdf46('0xb')]);router[_0xdf46('0x8')]('/:id',auth[_0xdf46('0x9')](),controller[_0xdf46('0xc')]);router[_0xdf46('0xd')]('/',auth[_0xdf46('0x9')](),controller[_0xdf46('0xe')]);router[_0xdf46('0xf')](_0xdf46('0x10'),auth[_0xdf46('0x9')](),controller['update']);router[_0xdf46('0x11')](_0xdf46('0x10'),auth[_0xdf46('0x9')](),controller[_0xdf46('0x12')]);module[_0xdf46('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index c565649..4065aaa 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x357461,_0x43e0fe){var _0x7960f=function(_0x3d57ae){while(--_0x3d57ae){_0x357461['push'](_0x357461['shift']());}};_0x7960f(++_0x43e0fe);}(_0xedd9,0xfc));var _0x9edd=function(_0x1d9ec8,_0x210c79){_0x1d9ec8=_0x1d9ec8-0x0;var _0x5a2a9c=_0xedd9[_0x1d9ec8];return _0x5a2a9c;};'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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x4d8199,_0x2ff8af){var _0x356a64=function(_0x45060a){while(--_0x45060a){_0x4d8199['push'](_0x4d8199['shift']());}};_0x356a64(++_0x2ff8af);}(_0xaa88,0x137));var _0x8aa8=function(_0x2fdce0,_0x496242){_0x2fdce0=_0x2fdce0-0x0;var _0x36f07e=_0xaa88[_0x2fdce0];return _0x36f07e;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index bd48c95..1b04a2e 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 _0xea69=['pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','body','find','describe','zip-dir','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','sendStatus','error','name','send','index','map','OpenchannelTransferReport','rawAttributes','type','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where'];(function(_0x3a94e8,_0x3b271a){var _0x16069d=function(_0x2809b9){while(--_0x2809b9){_0x3a94e8['push'](_0x3a94e8['shift']());}};_0x16069d(++_0x3b271a);}(_0xea69,0xd8));var _0x9ea6=function(_0xb4c7b,_0x56dcfb){_0xb4c7b=_0xb4c7b-0x0;var _0x11f0ab=_0xea69[_0xb4c7b];return _0x11f0ab;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9ea6('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ea6('0x1'));var moment=require('moment');var BPromise=require(_0x9ea6('0x2'));var Mustache=require(_0x9ea6('0x3'));var util=require('util');var path=require(_0x9ea6('0x4'));var sox=require(_0x9ea6('0x5'));var csv=require('to-csv');var ejs=require(_0x9ea6('0x6'));var fs=require('fs');var fs_extra=require(_0x9ea6('0x7'));var _=require(_0x9ea6('0x8'));var squel=require(_0x9ea6('0x9'));var crypto=require(_0x9ea6('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9ea6('0xb'));var querystring=require('querystring');var Papa=require(_0x9ea6('0xc'));var Redis=require('ioredis');var authService=require(_0x9ea6('0xd'));var qs=require(_0x9ea6('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9ea6('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x9ea6('0x10'));var licenseUtil=require(_0x9ea6('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x444036,_0x55b8dc){_0x55b8dc=_0x55b8dc||0xcc;return function(_0x11e79c){if(_0x11e79c){return _0x444036['sendStatus'](_0x55b8dc);}return _0x444036[_0x9ea6('0x12')](_0x55b8dc)[_0x9ea6('0x13')]();};}function respondWithResult(_0x3b329c,_0x3ffb45){_0x3ffb45=_0x3ffb45||0xc8;return function(_0x52c5d7){if(_0x52c5d7){return _0x3b329c['status'](_0x3ffb45)['json'](_0x52c5d7);}};}function respondWithFilteredResult(_0xa63fe9,_0x4a9dab){return function(_0x412c89){if(_0x412c89){var _0x10c8b9=typeof _0x4a9dab[_0x9ea6('0x14')]===_0x9ea6('0x15')&&typeof _0x4a9dab[_0x9ea6('0x16')]==='undefined';var _0x5b642d=_0x412c89[_0x9ea6('0x17')];var _0x16a51a=_0x10c8b9?0x0:_0x4a9dab[_0x9ea6('0x14')];var _0x1fba6d=_0x10c8b9?_0x412c89[_0x9ea6('0x17')]:_0x4a9dab['offset']+_0x4a9dab[_0x9ea6('0x16')];var _0x254ccd;if(_0x1fba6d>=_0x5b642d){_0x1fba6d=_0x5b642d;_0x254ccd=0xc8;}else{_0x254ccd=0xce;}_0xa63fe9['status'](_0x254ccd);return _0xa63fe9[_0x9ea6('0x18')]('Content-Range',_0x16a51a+'-'+_0x1fba6d+'/'+_0x5b642d)[_0x9ea6('0x19')](_0x412c89);}return null;};}function patchUpdates(_0xd57783){return function(_0x27fb37){try{jsonpatch[_0x9ea6('0x1a')](_0x27fb37,_0xd57783,!![]);}catch(_0x50c81f){return BPromise[_0x9ea6('0x1b')](_0x50c81f);}return _0x27fb37['save']();};}function saveUpdates(_0xa83f46,_0x471d99){return function(_0x4344f5){if(_0x4344f5){return _0x4344f5[_0x9ea6('0x1c')](_0xa83f46)[_0x9ea6('0x1d')](function(_0x55d803){return _0x55d803;});}return null;};}function removeEntity(_0x566487,_0x3f3364){return function(_0x4d3308){if(_0x4d3308){return _0x4d3308[_0x9ea6('0x1e')]()[_0x9ea6('0x1d')](function(){_0x566487[_0x9ea6('0x12')](0xcc)[_0x9ea6('0x13')]();});}};}function handleEntityNotFound(_0x4de924,_0x4f405f){return function(_0x1573c3){if(!_0x1573c3){_0x4de924[_0x9ea6('0x1f')](0x194);}return _0x1573c3;};}function handleError(_0x356f95,_0x1a757c){_0x1a757c=_0x1a757c||0x1f4;return function(_0x5b9e38){logger[_0x9ea6('0x20')](_0x5b9e38['stack']);if(_0x5b9e38[_0x9ea6('0x21')]){delete _0x5b9e38[_0x9ea6('0x21')];}_0x356f95[_0x9ea6('0x12')](_0x1a757c)[_0x9ea6('0x22')](_0x5b9e38);};}exports[_0x9ea6('0x23')]=function(_0xf600f8,_0x224674){var _0x5aef27={},_0x443a97={},_0x3d7b42={'count':0x0,'rows':[]};var _0x3c965e=_[_0x9ea6('0x24')](db[_0x9ea6('0x25')][_0x9ea6('0x26')],function(_0x23c7cc){return{'name':_0x23c7cc['fieldName'],'type':_0x23c7cc[_0x9ea6('0x27')]['key']};});_0x443a97['model']=_[_0x9ea6('0x24')](_0x3c965e,_0x9ea6('0x21'));_0x443a97[_0x9ea6('0x28')]=_[_0x9ea6('0x29')](_0xf600f8[_0x9ea6('0x28')]);_0x443a97[_0x9ea6('0x2a')]=_[_0x9ea6('0x2b')](_0x443a97['model'],_0x443a97['query']);_0x5aef27['attributes']=_[_0x9ea6('0x2b')](_0x443a97[_0x9ea6('0x2c')],qs[_0x9ea6('0x2d')](_0xf600f8['query'][_0x9ea6('0x2d')]));_0x5aef27[_0x9ea6('0x2e')]=_0x5aef27[_0x9ea6('0x2e')][_0x9ea6('0x2f')]?_0x5aef27[_0x9ea6('0x2e')]:_0x443a97[_0x9ea6('0x2c')];if(!_0xf600f8[_0x9ea6('0x28')]['hasOwnProperty'](_0x9ea6('0x30'))){_0x5aef27[_0x9ea6('0x16')]=qs['limit'](_0xf600f8[_0x9ea6('0x28')]['limit']);_0x5aef27[_0x9ea6('0x14')]=qs[_0x9ea6('0x14')](_0xf600f8[_0x9ea6('0x28')][_0x9ea6('0x14')]);}_0x5aef27[_0x9ea6('0x31')]=qs[_0x9ea6('0x32')](_0xf600f8[_0x9ea6('0x28')]['sort']);_0x5aef27[_0x9ea6('0x33')]=qs[_0x9ea6('0x2a')](_[_0x9ea6('0x34')](_0xf600f8[_0x9ea6('0x28')],_0x443a97[_0x9ea6('0x2a')]),_0x3c965e);if(_0xf600f8['query'][_0x9ea6('0x35')]){_0x5aef27['where']=_['merge'](_0x5aef27['where'],{'$or':_[_0x9ea6('0x24')](_0x3c965e,function(_0x4969e8){if(_0x4969e8['type']!==_0x9ea6('0x36')){var _0x2f7f3e={};_0x2f7f3e[_0x4969e8[_0x9ea6('0x21')]]={'$like':'%'+_0xf600f8[_0x9ea6('0x28')]['filter']+'%'};return _0x2f7f3e;}})});}_0x5aef27=_[_0x9ea6('0x37')]({},_0x5aef27,_0xf600f8[_0x9ea6('0x38')]);var _0x57ea47={'where':_0x5aef27[_0x9ea6('0x33')]};return db['OpenchannelTransferReport']['count'](_0x57ea47)[_0x9ea6('0x1d')](function(_0xb681df){_0x3d7b42[_0x9ea6('0x17')]=_0xb681df;if(_0xf600f8[_0x9ea6('0x28')]['includeAll']){_0x5aef27[_0x9ea6('0x39')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x9ea6('0x3a')](_0x5aef27);})[_0x9ea6('0x1d')](function(_0x37f078){_0x3d7b42[_0x9ea6('0x3b')]=_0x37f078;return _0x3d7b42;})['then'](respondWithFilteredResult(_0x224674,_0x5aef27))[_0x9ea6('0x3c')](handleError(_0x224674,null));};exports[_0x9ea6('0x3d')]=function(_0x4f1ff0,_0x1b935e){var _0x2f3fb4={'raw':!![],'where':{'id':_0x4f1ff0[_0x9ea6('0x3e')]['id']}},_0x339016={};_0x339016[_0x9ea6('0x2c')]=_['keys'](db[_0x9ea6('0x25')]['rawAttributes']);_0x339016[_0x9ea6('0x28')]=_[_0x9ea6('0x29')](_0x4f1ff0[_0x9ea6('0x28')]);_0x339016['filters']=_[_0x9ea6('0x2b')](_0x339016[_0x9ea6('0x2c')],_0x339016['query']);_0x2f3fb4['attributes']=_['intersection'](_0x339016[_0x9ea6('0x2c')],qs[_0x9ea6('0x2d')](_0x4f1ff0['query'][_0x9ea6('0x2d')]));_0x2f3fb4[_0x9ea6('0x2e')]=_0x2f3fb4[_0x9ea6('0x2e')]['length']?_0x2f3fb4[_0x9ea6('0x2e')]:_0x339016['model'];if(_0x4f1ff0['query'][_0x9ea6('0x3f')]){_0x2f3fb4['include']=[{'all':!![]}];}_0x2f3fb4=_[_0x9ea6('0x37')]({},_0x2f3fb4,_0x4f1ff0['options']);return db[_0x9ea6('0x25')]['find'](_0x2f3fb4)[_0x9ea6('0x1d')](handleEntityNotFound(_0x1b935e,null))['then'](respondWithResult(_0x1b935e,null))[_0x9ea6('0x3c')](handleError(_0x1b935e,null));};exports['create']=function(_0x5608a8,_0x46e9b9){return db['OpenchannelTransferReport']['create'](_0x5608a8[_0x9ea6('0x40')],{})[_0x9ea6('0x1d')](respondWithResult(_0x46e9b9,0xc9))['catch'](handleError(_0x46e9b9,null));};exports[_0x9ea6('0x1c')]=function(_0x448844,_0x5c1860){if(_0x448844[_0x9ea6('0x40')]['id']){delete _0x448844[_0x9ea6('0x40')]['id'];}return db[_0x9ea6('0x25')][_0x9ea6('0x41')]({'where':{'id':_0x448844[_0x9ea6('0x3e')]['id']}})[_0x9ea6('0x1d')](handleEntityNotFound(_0x5c1860,null))['then'](saveUpdates(_0x448844[_0x9ea6('0x40')],null))['then'](respondWithResult(_0x5c1860,null))[_0x9ea6('0x3c')](handleError(_0x5c1860,null));};exports[_0x9ea6('0x1e')]=function(_0x48e6ad,_0xaa4604){return db[_0x9ea6('0x25')]['find']({'where':{'id':_0x48e6ad[_0x9ea6('0x3e')]['id']}})[_0x9ea6('0x1d')](handleEntityNotFound(_0xaa4604,null))[_0x9ea6('0x1d')](removeEntity(_0xaa4604,null))['catch'](handleError(_0xaa4604,null));};exports[_0x9ea6('0x42')]=function(_0x2580f0,_0xfb3bdb){return db[_0x9ea6('0x25')]['describe']()[_0x9ea6('0x1d')](respondWithResult(_0xfb3bdb,null))[_0x9ea6('0x3c')](handleError(_0xfb3bdb,null));}; \ No newline at end of file +var _0x67d3=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','OpenchannelTransferReport','catch','show','params','keys','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x53c4f8,_0x44ccaf){var _0x416458=function(_0x2632aa){while(--_0x2632aa){_0x53c4f8['push'](_0x53c4f8['shift']());}};_0x416458(++_0x44ccaf);}(_0x67d3,0x1a4));var _0x367d=function(_0x4e648d,_0x37d3ce){_0x4e648d=_0x4e648d-0x0;var _0x2d229d=_0x67d3[_0x4e648d];return _0x2d229d;};'use strict';var emlformat=require(_0x367d('0x0'));var rimraf=require(_0x367d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x367d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x367d('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x367d('0x4'));var csv=require(_0x367d('0x5'));var ejs=require(_0x367d('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x367d('0x7'));var squel=require(_0x367d('0x8'));var crypto=require(_0x367d('0x9'));var jsforce=require(_0x367d('0xa'));var deskjs=require(_0x367d('0xb'));var toCsv=require(_0x367d('0x5'));var querystring=require(_0x367d('0xc'));var Papa=require(_0x367d('0xd'));var Redis=require('ioredis');var authService=require(_0x367d('0xe'));var qs=require(_0x367d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x367d('0x10'));var logger=require('../../config/logger')(_0x367d('0x11'));var utils=require(_0x367d('0x12'));var config=require(_0x367d('0x13'));var licenseUtil=require(_0x367d('0x14'));var db=require(_0x367d('0x15'))['db'];function respondWithStatusCode(_0x51d77c,_0x3c7ef0){_0x3c7ef0=_0x3c7ef0||0xcc;return function(_0x54193b){if(_0x54193b){return _0x51d77c[_0x367d('0x16')](_0x3c7ef0);}return _0x51d77c[_0x367d('0x17')](_0x3c7ef0)[_0x367d('0x18')]();};}function respondWithResult(_0x510138,_0x41bb9f){_0x41bb9f=_0x41bb9f||0xc8;return function(_0x24c0e9){if(_0x24c0e9){return _0x510138['status'](_0x41bb9f)[_0x367d('0x19')](_0x24c0e9);}};}function respondWithFilteredResult(_0x9ef726,_0xe7885d){return function(_0x5a9ecf){if(_0x5a9ecf){var _0x4a26b9=typeof _0xe7885d[_0x367d('0x1a')]===_0x367d('0x1b')&&typeof _0xe7885d[_0x367d('0x1c')]===_0x367d('0x1b');var _0x514435=_0x5a9ecf[_0x367d('0x1d')];var _0x52c19b=_0x4a26b9?0x0:_0xe7885d[_0x367d('0x1a')];var _0xea6af4=_0x4a26b9?_0x5a9ecf[_0x367d('0x1d')]:_0xe7885d[_0x367d('0x1a')]+_0xe7885d[_0x367d('0x1c')];var _0x4b7c0c;if(_0xea6af4>=_0x514435){_0xea6af4=_0x514435;_0x4b7c0c=0xc8;}else{_0x4b7c0c=0xce;}_0x9ef726['status'](_0x4b7c0c);return _0x9ef726[_0x367d('0x1e')](_0x367d('0x1f'),_0x52c19b+'-'+_0xea6af4+'/'+_0x514435)[_0x367d('0x19')](_0x5a9ecf);}return null;};}function patchUpdates(_0x225e10){return function(_0x3de75a){try{jsonpatch[_0x367d('0x20')](_0x3de75a,_0x225e10,!![]);}catch(_0x46f69c){return BPromise[_0x367d('0x21')](_0x46f69c);}return _0x3de75a[_0x367d('0x22')]();};}function saveUpdates(_0x1d7888,_0x35de8b){return function(_0x211db6){if(_0x211db6){return _0x211db6[_0x367d('0x23')](_0x1d7888)[_0x367d('0x24')](function(_0x43f73b){return _0x43f73b;});}return null;};}function removeEntity(_0x3f6b5d,_0x5d377b){return function(_0x258096){if(_0x258096){return _0x258096[_0x367d('0x25')]()[_0x367d('0x24')](function(){_0x3f6b5d[_0x367d('0x17')](0xcc)[_0x367d('0x18')]();});}};}function handleEntityNotFound(_0x320c9d,_0x3df218){return function(_0x2b33fa){if(!_0x2b33fa){_0x320c9d[_0x367d('0x16')](0x194);}return _0x2b33fa;};}function handleError(_0x10bc47,_0xd279aa){_0xd279aa=_0xd279aa||0x1f4;return function(_0x3e2d7e){logger[_0x367d('0x26')](_0x3e2d7e['stack']);if(_0x3e2d7e[_0x367d('0x27')]){delete _0x3e2d7e['name'];}_0x10bc47[_0x367d('0x17')](_0xd279aa)[_0x367d('0x28')](_0x3e2d7e);};}exports[_0x367d('0x29')]=function(_0x5efc97,_0x5f67fc){var _0x1f89ff={},_0x152f40={},_0x4bb67f={'count':0x0,'rows':[]};var _0x5b4022=_[_0x367d('0x2a')](db['OpenchannelTransferReport']['rawAttributes'],function(_0xe83aa1){return{'name':_0xe83aa1[_0x367d('0x2b')],'type':_0xe83aa1[_0x367d('0x2c')][_0x367d('0x2d')]};});_0x152f40['model']=_['map'](_0x5b4022,'name');_0x152f40[_0x367d('0x2e')]=_['keys'](_0x5efc97[_0x367d('0x2e')]);_0x152f40['filters']=_[_0x367d('0x2f')](_0x152f40[_0x367d('0x30')],_0x152f40['query']);_0x1f89ff[_0x367d('0x31')]=_['intersection'](_0x152f40[_0x367d('0x30')],qs[_0x367d('0x32')](_0x5efc97[_0x367d('0x2e')]['fields']));_0x1f89ff['attributes']=_0x1f89ff[_0x367d('0x31')][_0x367d('0x33')]?_0x1f89ff['attributes']:_0x152f40[_0x367d('0x30')];if(!_0x5efc97[_0x367d('0x2e')][_0x367d('0x34')](_0x367d('0x35'))){_0x1f89ff[_0x367d('0x1c')]=qs[_0x367d('0x1c')](_0x5efc97[_0x367d('0x2e')]['limit']);_0x1f89ff['offset']=qs[_0x367d('0x1a')](_0x5efc97[_0x367d('0x2e')][_0x367d('0x1a')]);}_0x1f89ff[_0x367d('0x36')]=qs[_0x367d('0x37')](_0x5efc97[_0x367d('0x2e')]['sort']);_0x1f89ff[_0x367d('0x38')]=qs[_0x367d('0x39')](_[_0x367d('0x3a')](_0x5efc97['query'],_0x152f40['filters']),_0x5b4022);if(_0x5efc97[_0x367d('0x2e')]['filter']){_0x1f89ff['where']=_[_0x367d('0x3b')](_0x1f89ff[_0x367d('0x38')],{'$or':_[_0x367d('0x2a')](_0x5b4022,function(_0x410ed5){if(_0x410ed5[_0x367d('0x2c')]!==_0x367d('0x3c')){var _0x24e612={};_0x24e612[_0x410ed5[_0x367d('0x27')]]={'$like':'%'+_0x5efc97[_0x367d('0x2e')][_0x367d('0x3d')]+'%'};return _0x24e612;}})});}_0x1f89ff=_[_0x367d('0x3b')]({},_0x1f89ff,_0x5efc97['options']);var _0x5e2892={'where':_0x1f89ff[_0x367d('0x38')]};return db['OpenchannelTransferReport'][_0x367d('0x1d')](_0x5e2892)[_0x367d('0x24')](function(_0x1bf717){_0x4bb67f['count']=_0x1bf717;if(_0x5efc97[_0x367d('0x2e')][_0x367d('0x3e')]){_0x1f89ff[_0x367d('0x3f')]=[{'all':!![]}];}return db[_0x367d('0x40')]['findAll'](_0x1f89ff);})[_0x367d('0x24')](function(_0x172659){_0x4bb67f['rows']=_0x172659;return _0x4bb67f;})[_0x367d('0x24')](respondWithFilteredResult(_0x5f67fc,_0x1f89ff))[_0x367d('0x41')](handleError(_0x5f67fc,null));};exports[_0x367d('0x42')]=function(_0x41b8b1,_0x1ffbaa){var _0x20412f={'raw':!![],'where':{'id':_0x41b8b1[_0x367d('0x43')]['id']}},_0x2ef00f={};_0x2ef00f[_0x367d('0x30')]=_[_0x367d('0x44')](db[_0x367d('0x40')]['rawAttributes']);_0x2ef00f[_0x367d('0x2e')]=_[_0x367d('0x44')](_0x41b8b1[_0x367d('0x2e')]);_0x2ef00f[_0x367d('0x39')]=_[_0x367d('0x2f')](_0x2ef00f[_0x367d('0x30')],_0x2ef00f[_0x367d('0x2e')]);_0x20412f[_0x367d('0x31')]=_[_0x367d('0x2f')](_0x2ef00f[_0x367d('0x30')],qs[_0x367d('0x32')](_0x41b8b1['query'][_0x367d('0x32')]));_0x20412f[_0x367d('0x31')]=_0x20412f[_0x367d('0x31')]['length']?_0x20412f['attributes']:_0x2ef00f[_0x367d('0x30')];if(_0x41b8b1[_0x367d('0x2e')][_0x367d('0x3e')]){_0x20412f[_0x367d('0x3f')]=[{'all':!![]}];}_0x20412f=_[_0x367d('0x3b')]({},_0x20412f,_0x41b8b1[_0x367d('0x45')]);return db[_0x367d('0x40')][_0x367d('0x46')](_0x20412f)['then'](handleEntityNotFound(_0x1ffbaa,null))[_0x367d('0x24')](respondWithResult(_0x1ffbaa,null))[_0x367d('0x41')](handleError(_0x1ffbaa,null));};exports[_0x367d('0x47')]=function(_0x3f9178,_0x1e4325){return db[_0x367d('0x40')][_0x367d('0x47')](_0x3f9178[_0x367d('0x48')],{})['then'](respondWithResult(_0x1e4325,0xc9))[_0x367d('0x41')](handleError(_0x1e4325,null));};exports[_0x367d('0x23')]=function(_0x308e7e,_0x50244c){if(_0x308e7e[_0x367d('0x48')]['id']){delete _0x308e7e[_0x367d('0x48')]['id'];}return db[_0x367d('0x40')][_0x367d('0x46')]({'where':{'id':_0x308e7e[_0x367d('0x43')]['id']}})['then'](handleEntityNotFound(_0x50244c,null))[_0x367d('0x24')](saveUpdates(_0x308e7e[_0x367d('0x48')],null))[_0x367d('0x24')](respondWithResult(_0x50244c,null))[_0x367d('0x41')](handleError(_0x50244c,null));};exports[_0x367d('0x25')]=function(_0x51225b,_0x52d00c){return db['OpenchannelTransferReport'][_0x367d('0x46')]({'where':{'id':_0x51225b[_0x367d('0x43')]['id']}})[_0x367d('0x24')](handleEntityNotFound(_0x52d00c,null))['then'](removeEntity(_0x52d00c,null))[_0x367d('0x41')](handleError(_0x52d00c,null));};exports[_0x367d('0x49')]=function(_0x351566,_0x483dbb){return db[_0x367d('0x40')]['describe']()[_0x367d('0x24')](respondWithResult(_0x483dbb,null))[_0x367d('0x41')](handleError(_0x483dbb,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 9401deb..539b244 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 _0x3c6f=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash'];(function(_0x54bdde,_0x2db916){var _0x445ecc=function(_0x2ed731){while(--_0x2ed731){_0x54bdde['push'](_0x54bdde['shift']());}};_0x445ecc(++_0x2db916);}(_0x3c6f,0x1e0));var _0xf3c6=function(_0x4665f3,_0x1a84a3){_0x4665f3=_0x4665f3-0x0;var _0x1fd002=_0x3c6f[_0x4665f3];return _0x1fd002;};'use strict';var _=require(_0xf3c6('0x0'));var util=require('util');var logger=require(_0xf3c6('0x1'))(_0xf3c6('0x2'));var moment=require(_0xf3c6('0x3'));var BPromise=require(_0xf3c6('0x4'));var rp=require(_0xf3c6('0x5'));var fs=require('fs');var path=require(_0xf3c6('0x6'));var rimraf=require(_0xf3c6('0x7'));var config=require(_0xf3c6('0x8'));var attributes=require('./openchannelTransferReport.attributes');module[_0xf3c6('0x9')]=function(_0xd8f858,_0x2f9fe8){return _0xd8f858['define'](_0xf3c6('0xa'),attributes,{'tableName':_0xf3c6('0xb'),'paranoid':![],'indexes':[{'name':_0xf3c6('0xc'),'fields':[_0xf3c6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9f94=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util'];(function(_0x239a9b,_0x34fc09){var _0x56d797=function(_0x33f928){while(--_0x33f928){_0x239a9b['push'](_0x239a9b['shift']());}};_0x56d797(++_0x34fc09);}(_0x9f94,0x1c0));var _0x49f9=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x9f94[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x49f9('0x0'));var util=require(_0x49f9('0x1'));var logger=require(_0x49f9('0x2'))(_0x49f9('0x3'));var moment=require(_0x49f9('0x4'));var BPromise=require(_0x49f9('0x5'));var rp=require(_0x49f9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x49f9('0x7'));var config=require(_0x49f9('0x8'));var attributes=require(_0x49f9('0x9'));module[_0x49f9('0xa')]=function(_0x5a6240,_0x13608d){return _0x5a6240[_0x49f9('0xb')](_0x49f9('0xc'),attributes,{'tableName':_0x49f9('0xd'),'paranoid':![],'indexes':[{'name':_0x49f9('0xe'),'fields':[_0x49f9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index e7a66b1..559125b 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 _0x814b=['info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\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(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x814b,0x1a2));var _0xb814=function(_0x31a37b,_0x826249){_0x31a37b=_0x31a37b-0x0;var _0x49ae16=_0x814b[_0x31a37b];return _0x49ae16;};'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')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file +var _0x8784=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x144aab,_0x11101d){var _0xbc43ea=function(_0x557084){while(--_0x557084){_0x144aab['push'](_0x144aab['shift']());}};_0xbc43ea(++_0x11101d);}(_0x8784,0x172));var _0x4878=function(_0x2e3545,_0x20a6ec){_0x2e3545=_0x2e3545-0x0;var _0xcf18f=_0x8784[_0x2e3545];return _0xcf18f;};'use strict';var _=require(_0x4878('0x0'));var util=require(_0x4878('0x1'));var moment=require('moment');var BPromise=require(_0x4878('0x2'));var rs=require(_0x4878('0x3'));var fs=require('fs');var Redis=require(_0x4878('0x4'));var db=require(_0x4878('0x5'))['db'];var utils=require(_0x4878('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4878('0x7'));var jayson=require(_0x4878('0x8'));var client=jayson[_0x4878('0x9')][_0x4878('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe22936,_0x4148dd,_0x131e82){return new BPromise(function(_0x35cd6a,_0x29d02e){return client['request'](_0xe22936,_0x131e82)[_0x4878('0xb')](function(_0xfe196b){logger[_0x4878('0xc')](_0x4878('0xd'),_0x4148dd,_0x4878('0xe'));logger[_0x4878('0xf')](_0x4878('0x10'),_0x4148dd,_0x4878('0xe'),JSON[_0x4878('0x11')](_0xfe196b));if(_0xfe196b[_0x4878('0x12')]){if(_0xfe196b[_0x4878('0x12')][_0x4878('0x13')]===0x1f4){logger['error'](_0x4878('0xd'),_0x4148dd,_0xfe196b[_0x4878('0x12')][_0x4878('0x14')]);return _0x29d02e(_0xfe196b['error'][_0x4878('0x14')]);}logger[_0x4878('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4148dd,_0xfe196b[_0x4878('0x12')]['message']);return _0x35cd6a(_0xfe196b['error'][_0x4878('0x14')]);}else{logger[_0x4878('0xc')](_0x4878('0xd'),_0x4148dd,_0x4878('0xe'));_0x35cd6a(_0xfe196b[_0x4878('0x15')]['message']);}})[_0x4878('0x16')](function(_0x25282f){logger['error'](_0x4878('0xd'),_0x4148dd,_0x25282f);_0x29d02e(_0x25282f);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 672b7e9..434fa5d 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 _0x2fe6=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','get','/:id','post','create','put','update','delete','destroy','multer','util','path'];(function(_0x390a19,_0x5dd137){var _0x5d8230=function(_0x2e6234){while(--_0x2e6234){_0x390a19['push'](_0x390a19['shift']());}};_0x5d8230(++_0x5dd137);}(_0x2fe6,0x1cb));var _0x62fe=function(_0x130b0a,_0x320d01){_0x130b0a=_0x130b0a-0x0;var _0x495e55=_0x2fe6[_0x130b0a];return _0x495e55;};'use strict';var multer=require(_0x62fe('0x0'));var util=require(_0x62fe('0x1'));var path=require(_0x62fe('0x2'));var timeout=require(_0x62fe('0x3'));var express=require(_0x62fe('0x4'));var router=express[_0x62fe('0x5')]();var fs_extra=require(_0x62fe('0x6'));var auth=require(_0x62fe('0x7'));var interaction=require(_0x62fe('0x8'));var config=require(_0x62fe('0x9'));var controller=require(_0x62fe('0xa'));router['get']('/',auth[_0x62fe('0xb')](),controller[_0x62fe('0xc')]);router[_0x62fe('0xd')](_0x62fe('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x62fe('0xf')]('/',auth[_0x62fe('0xb')](),controller[_0x62fe('0x10')]);router[_0x62fe('0x11')]('/:id',auth[_0x62fe('0xb')](),controller[_0x62fe('0x12')]);router[_0x62fe('0x13')](_0x62fe('0xe'),auth[_0x62fe('0xb')](),controller[_0x62fe('0x14')]);module['exports']=router; \ No newline at end of file +var _0xaaa2=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./pause.controller','get','isAuthenticated','index','put','update','delete'];(function(_0x403115,_0x2d6d03){var _0x596ef3=function(_0x145d97){while(--_0x145d97){_0x403115['push'](_0x403115['shift']());}};_0x596ef3(++_0x2d6d03);}(_0xaaa2,0xac));var _0x2aaa=function(_0x355a8f,_0x1437c9){_0x355a8f=_0x355a8f-0x0;var _0x49c40f=_0xaaa2[_0x355a8f];return _0x49c40f;};'use strict';var multer=require(_0x2aaa('0x0'));var util=require(_0x2aaa('0x1'));var path=require(_0x2aaa('0x2'));var timeout=require(_0x2aaa('0x3'));var express=require(_0x2aaa('0x4'));var router=express[_0x2aaa('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2aaa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2aaa('0x7'));var controller=require(_0x2aaa('0x8'));router[_0x2aaa('0x9')]('/',auth[_0x2aaa('0xa')](),controller[_0x2aaa('0xb')]);router[_0x2aaa('0x9')]('/:id',auth[_0x2aaa('0xa')](),controller['show']);router['post']('/',auth[_0x2aaa('0xa')](),controller['create']);router[_0x2aaa('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x2aaa('0xd')]);router[_0x2aaa('0xe')]('/:id',auth[_0x2aaa('0xa')](),controller[_0x2aaa('0xf')]);module[_0x2aaa('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 11da38f..243d113 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 _0xc38c=['name','exports','STRING'];(function(_0x18f2bd,_0x431ec2){var _0x1247f4=function(_0x4ae0d9){while(--_0x4ae0d9){_0x18f2bd['push'](_0x18f2bd['shift']());}};_0x1247f4(++_0x431ec2);}(_0xc38c,0x16c));var _0xcc38=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc38c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xcc38('0x0')]={'name':{'type':Sequelize[_0xcc38('0x1')],'unique':_0xcc38('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9342=['STRING','sequelize'];(function(_0x2ac5e5,_0x1909fc){var _0x47f776=function(_0x2eaf5f){while(--_0x2eaf5f){_0x2ac5e5['push'](_0x2ac5e5['shift']());}};_0x47f776(++_0x1909fc);}(_0x9342,0x16f));var _0x2934=function(_0x17965b,_0x99c7fe){_0x17965b=_0x17965b-0x0;var _0xa998bc=_0x9342[_0x17965b];return _0xa998bc;};'use strict';var Sequelize=require(_0x2934('0x0'));module['exports']={'name':{'type':Sequelize[_0x2934('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x2934('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 230cea0..53d8e1a 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 _0xf7ce=['Pauses','error','stack','send','index','Pause','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','VIRTUAL','name','filter','options','includeAll','include','findAll','rows','catch','params','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x11817f,_0x2c37ef){var _0x4f444b=function(_0x970a5b){while(--_0x970a5b){_0x11817f['push'](_0x11817f['shift']());}};_0x4f444b(++_0x2c37ef);}(_0xf7ce,0x1d6));var _0xef7c=function(_0x1d4923,_0x4e222f){_0x1d4923=_0x1d4923-0x0;var _0x14ea9a=_0xf7ce[_0x1d4923];return _0x14ea9a;};'use strict';var emlformat=require(_0xef7c('0x0'));var rimraf=require(_0xef7c('0x1'));var zipdir=require(_0xef7c('0x2'));var jsonpatch=require(_0xef7c('0x3'));var rp=require(_0xef7c('0x4'));var moment=require(_0xef7c('0x5'));var BPromise=require(_0xef7c('0x6'));var Mustache=require(_0xef7c('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xef7c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef7c('0x9'));var _=require(_0xef7c('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xef7c('0xb'));var deskjs=require(_0xef7c('0xc'));var toCsv=require(_0xef7c('0x8'));var querystring=require(_0xef7c('0xd'));var Papa=require(_0xef7c('0xe'));var Redis=require(_0xef7c('0xf'));var authService=require(_0xef7c('0x10'));var qs=require(_0xef7c('0x11'));var as=require(_0xef7c('0x12'));var hardwareService=require(_0xef7c('0x13'));var logger=require(_0xef7c('0x14'))(_0xef7c('0x15'));var utils=require(_0xef7c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xef7c('0x17'));var db=require(_0xef7c('0x18'))['db'];function respondWithStatusCode(_0x1b2737,_0x203f8d){_0x203f8d=_0x203f8d||0xcc;return function(_0xdac3db){if(_0xdac3db){return _0x1b2737[_0xef7c('0x19')](_0x203f8d);}return _0x1b2737[_0xef7c('0x1a')](_0x203f8d)[_0xef7c('0x1b')]();};}function respondWithResult(_0x43cbe3,_0x115e23){_0x115e23=_0x115e23||0xc8;return function(_0x4552e0){if(_0x4552e0){return _0x43cbe3[_0xef7c('0x1a')](_0x115e23)[_0xef7c('0x1c')](_0x4552e0);}};}function respondWithFilteredResult(_0x153135,_0x222cff){return function(_0x14071){if(_0x14071){var _0x43c749=typeof _0x222cff['offset']==='undefined'&&typeof _0x222cff[_0xef7c('0x1d')]==='undefined';var _0x283d6a=_0x14071[_0xef7c('0x1e')];var _0x31f9c4=_0x43c749?0x0:_0x222cff[_0xef7c('0x1f')];var _0x381dff=_0x43c749?_0x14071[_0xef7c('0x1e')]:_0x222cff[_0xef7c('0x1f')]+_0x222cff[_0xef7c('0x1d')];var _0x290330;if(_0x381dff>=_0x283d6a){_0x381dff=_0x283d6a;_0x290330=0xc8;}else{_0x290330=0xce;}_0x153135[_0xef7c('0x1a')](_0x290330);return _0x153135[_0xef7c('0x20')](_0xef7c('0x21'),_0x31f9c4+'-'+_0x381dff+'/'+_0x283d6a)[_0xef7c('0x1c')](_0x14071);}return null;};}function patchUpdates(_0x347dc0){return function(_0x1366bd){try{jsonpatch[_0xef7c('0x22')](_0x1366bd,_0x347dc0,!![]);}catch(_0x5f2fdd){return BPromise[_0xef7c('0x23')](_0x5f2fdd);}return _0x1366bd[_0xef7c('0x24')]();};}function saveUpdates(_0xc697f9,_0x115a36){return function(_0x108eed){if(_0x108eed){return _0x108eed[_0xef7c('0x25')](_0xc697f9)[_0xef7c('0x26')](function(_0x4acdc5){return _0x4acdc5;});}return null;};}function removeEntity(_0x6f0835,_0x25e516){return function(_0x1f0d87){if(_0x1f0d87){return _0x1f0d87[_0xef7c('0x27')]()['then'](function(){var _0x35b1c3=_0x1f0d87['get']({'plain':!![]});var _0x27691c=_0xef7c('0x28');return db['UserProfileResource'][_0xef7c('0x27')]({'where':{'type':_0x27691c,'resourceId':_0x35b1c3['id']}})['then'](function(){return _0x1f0d87;});})[_0xef7c('0x26')](function(){_0x6f0835[_0xef7c('0x1a')](0xcc)[_0xef7c('0x1b')]();});}};}function handleEntityNotFound(_0x286826,_0x4daa1f){return function(_0x1081b1){if(!_0x1081b1){_0x286826[_0xef7c('0x19')](0x194);}return _0x1081b1;};}function handleError(_0x57aca7,_0x163382){_0x163382=_0x163382||0x1f4;return function(_0x450368){logger[_0xef7c('0x29')](_0x450368[_0xef7c('0x2a')]);if(_0x450368['name']){delete _0x450368['name'];}_0x57aca7[_0xef7c('0x1a')](_0x163382)[_0xef7c('0x2b')](_0x450368);};}exports[_0xef7c('0x2c')]=function(_0x523aef,_0x2695b9){var _0x102a6e={},_0x1c009e={},_0x5416fe={'count':0x0,'rows':[]};var _0x5cc6da=_['map'](db[_0xef7c('0x2d')][_0xef7c('0x2e')],function(_0x281d7c){return{'name':_0x281d7c[_0xef7c('0x2f')],'type':_0x281d7c[_0xef7c('0x30')][_0xef7c('0x31')]};});_0x1c009e[_0xef7c('0x32')]=_[_0xef7c('0x33')](_0x5cc6da,'name');_0x1c009e[_0xef7c('0x34')]=_[_0xef7c('0x35')](_0x523aef[_0xef7c('0x34')]);_0x1c009e['filters']=_[_0xef7c('0x36')](_0x1c009e['model'],_0x1c009e[_0xef7c('0x34')]);_0x102a6e[_0xef7c('0x37')]=_['intersection'](_0x1c009e[_0xef7c('0x32')],qs[_0xef7c('0x38')](_0x523aef[_0xef7c('0x34')]['fields']));_0x102a6e['attributes']=_0x102a6e[_0xef7c('0x37')][_0xef7c('0x39')]?_0x102a6e[_0xef7c('0x37')]:_0x1c009e['model'];if(!_0x523aef[_0xef7c('0x34')][_0xef7c('0x3a')]('nolimit')){_0x102a6e[_0xef7c('0x1d')]=qs['limit'](_0x523aef[_0xef7c('0x34')][_0xef7c('0x1d')]);_0x102a6e[_0xef7c('0x1f')]=qs['offset'](_0x523aef[_0xef7c('0x34')][_0xef7c('0x1f')]);}_0x102a6e[_0xef7c('0x3b')]=qs[_0xef7c('0x3c')](_0x523aef[_0xef7c('0x34')][_0xef7c('0x3c')]);_0x102a6e[_0xef7c('0x3d')]=qs[_0xef7c('0x3e')](_[_0xef7c('0x3f')](_0x523aef['query'],_0x1c009e[_0xef7c('0x3e')]),_0x5cc6da);if(_0x523aef[_0xef7c('0x34')]['filter']){_0x102a6e[_0xef7c('0x3d')]=_['merge'](_0x102a6e['where'],{'$or':_[_0xef7c('0x33')](_0x5cc6da,function(_0x21edd6){if(_0x21edd6[_0xef7c('0x30')]!==_0xef7c('0x40')){var _0x495839={};_0x495839[_0x21edd6[_0xef7c('0x41')]]={'$like':'%'+_0x523aef[_0xef7c('0x34')][_0xef7c('0x42')]+'%'};return _0x495839;}})});}_0x102a6e=_['merge']({},_0x102a6e,_0x523aef[_0xef7c('0x43')]);var _0x3d4f28={'where':_0x102a6e[_0xef7c('0x3d')]};return db[_0xef7c('0x2d')][_0xef7c('0x1e')](_0x3d4f28)[_0xef7c('0x26')](function(_0x473a52){_0x5416fe[_0xef7c('0x1e')]=_0x473a52;if(_0x523aef[_0xef7c('0x34')][_0xef7c('0x44')]){_0x102a6e[_0xef7c('0x45')]=[{'all':!![]}];}return db[_0xef7c('0x2d')][_0xef7c('0x46')](_0x102a6e);})['then'](function(_0x27b829){_0x5416fe[_0xef7c('0x47')]=_0x27b829;return _0x5416fe;})[_0xef7c('0x26')](respondWithFilteredResult(_0x2695b9,_0x102a6e))[_0xef7c('0x48')](handleError(_0x2695b9,null));};exports['show']=function(_0x3d2d96,_0x39acce){var _0x5d7761={'raw':!![],'where':{'id':_0x3d2d96[_0xef7c('0x49')]['id']}},_0x447d47={};_0x447d47[_0xef7c('0x32')]=_[_0xef7c('0x35')](db[_0xef7c('0x2d')][_0xef7c('0x2e')]);_0x447d47[_0xef7c('0x34')]=_[_0xef7c('0x35')](_0x3d2d96[_0xef7c('0x34')]);_0x447d47[_0xef7c('0x3e')]=_[_0xef7c('0x36')](_0x447d47[_0xef7c('0x32')],_0x447d47[_0xef7c('0x34')]);_0x5d7761[_0xef7c('0x37')]=_['intersection'](_0x447d47[_0xef7c('0x32')],qs[_0xef7c('0x38')](_0x3d2d96['query'][_0xef7c('0x38')]));_0x5d7761['attributes']=_0x5d7761['attributes'][_0xef7c('0x39')]?_0x5d7761['attributes']:_0x447d47[_0xef7c('0x32')];if(_0x3d2d96['query']['includeAll']){_0x5d7761[_0xef7c('0x45')]=[{'all':!![]}];}_0x5d7761=_[_0xef7c('0x4a')]({},_0x5d7761,_0x3d2d96[_0xef7c('0x43')]);return db[_0xef7c('0x2d')]['find'](_0x5d7761)[_0xef7c('0x26')](handleEntityNotFound(_0x39acce,null))[_0xef7c('0x26')](respondWithResult(_0x39acce,null))[_0xef7c('0x48')](handleError(_0x39acce,null));};exports[_0xef7c('0x4b')]=function(_0x51939a,_0x5259a1){return db[_0xef7c('0x2d')][_0xef7c('0x4b')](_0x51939a[_0xef7c('0x4c')],{})[_0xef7c('0x26')](function(_0x5f23a3){var _0x3f6eaa=_0x51939a[_0xef7c('0x4d')]['get']({'plain':!![]});if(!_0x3f6eaa)throw new Error(_0xef7c('0x4e'));if(_0x3f6eaa['role']===_0xef7c('0x4d')){var _0x2f25a2=_0x5f23a3['get']({'plain':!![]});var _0x2ec430=_0xef7c('0x28');return db[_0xef7c('0x4f')][_0xef7c('0x50')]({'where':{'name':_0x2ec430,'userProfileId':_0x3f6eaa[_0xef7c('0x51')]},'raw':!![]})[_0xef7c('0x26')](function(_0x462fb7){if(_0x462fb7&&_0x462fb7[_0xef7c('0x52')]===0x0){return db[_0xef7c('0x53')][_0xef7c('0x4b')]({'name':_0x2f25a2[_0xef7c('0x41')],'resourceId':_0x2f25a2['id'],'type':_0x462fb7[_0xef7c('0x41')],'sectionId':_0x462fb7['id']},{})[_0xef7c('0x26')](function(){return _0x5f23a3;});}else{return _0x5f23a3;}})['catch'](function(_0x99679c){logger[_0xef7c('0x29')](_0xef7c('0x54'),_0x99679c);throw _0x99679c;});}return _0x5f23a3;})['then'](respondWithResult(_0x5259a1,0xc9))[_0xef7c('0x48')](handleError(_0x5259a1,null));};exports['update']=function(_0x57ffb2,_0x109a20){if(_0x57ffb2['body']['id']){delete _0x57ffb2['body']['id'];}return db[_0xef7c('0x2d')][_0xef7c('0x50')]({'where':{'id':_0x57ffb2[_0xef7c('0x49')]['id']}})[_0xef7c('0x26')](handleEntityNotFound(_0x109a20,null))[_0xef7c('0x26')](saveUpdates(_0x57ffb2[_0xef7c('0x4c')],null))['then'](respondWithResult(_0x109a20,null))[_0xef7c('0x48')](handleError(_0x109a20,null));};exports[_0xef7c('0x27')]=function(_0x25f6bd,_0x1dcbbe){return db[_0xef7c('0x2d')][_0xef7c('0x50')]({'where':{'id':_0x25f6bd[_0xef7c('0x49')]['id']}})[_0xef7c('0x26')](handleEntityNotFound(_0x1dcbbe,null))['then'](removeEntity(_0x1dcbbe,null))['catch'](handleError(_0x1dcbbe,null));}; \ No newline at end of file +var _0x56b4=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','get','Pauses','UserProfileResource','error','stack','name','index','Pause','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','map','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','ioredis'];(function(_0x5b110c,_0x1ff704){var _0x272c9c=function(_0x166b13){while(--_0x166b13){_0x5b110c['push'](_0x5b110c['shift']());}};_0x272c9c(++_0x1ff704);}(_0x56b4,0x98));var _0x456b=function(_0x84503,_0x1abf35){_0x84503=_0x84503-0x0;var _0x2edb40=_0x56b4[_0x84503];return _0x2edb40;};'use strict';var emlformat=require(_0x456b('0x0'));var rimraf=require(_0x456b('0x1'));var zipdir=require(_0x456b('0x2'));var jsonpatch=require(_0x456b('0x3'));var rp=require(_0x456b('0x4'));var moment=require(_0x456b('0x5'));var BPromise=require(_0x456b('0x6'));var Mustache=require(_0x456b('0x7'));var util=require('util');var path=require('path');var sox=require(_0x456b('0x8'));var csv=require(_0x456b('0x9'));var ejs=require(_0x456b('0xa'));var fs=require('fs');var fs_extra=require(_0x456b('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x456b('0xc'));var jsforce=require(_0x456b('0xd'));var deskjs=require(_0x456b('0xe'));var toCsv=require(_0x456b('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x456b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x456b('0x10'));var as=require(_0x456b('0x11'));var hardwareService=require(_0x456b('0x12'));var logger=require('../../config/logger')(_0x456b('0x13'));var utils=require(_0x456b('0x14'));var config=require(_0x456b('0x15'));var licenseUtil=require(_0x456b('0x16'));var db=require(_0x456b('0x17'))['db'];function respondWithStatusCode(_0x16f584,_0x39c410){_0x39c410=_0x39c410||0xcc;return function(_0x310562){if(_0x310562){return _0x16f584[_0x456b('0x18')](_0x39c410);}return _0x16f584[_0x456b('0x19')](_0x39c410)[_0x456b('0x1a')]();};}function respondWithResult(_0x22bee9,_0x5f43cd){_0x5f43cd=_0x5f43cd||0xc8;return function(_0x27f03d){if(_0x27f03d){return _0x22bee9[_0x456b('0x19')](_0x5f43cd)[_0x456b('0x1b')](_0x27f03d);}};}function respondWithFilteredResult(_0x335e58,_0x46db3c){return function(_0x38a714){if(_0x38a714){var _0x30bf27=typeof _0x46db3c[_0x456b('0x1c')]===_0x456b('0x1d')&&typeof _0x46db3c[_0x456b('0x1e')]===_0x456b('0x1d');var _0x1a8629=_0x38a714[_0x456b('0x1f')];var _0x571603=_0x30bf27?0x0:_0x46db3c[_0x456b('0x1c')];var _0x19c6fc=_0x30bf27?_0x38a714['count']:_0x46db3c['offset']+_0x46db3c[_0x456b('0x1e')];var _0x32c505;if(_0x19c6fc>=_0x1a8629){_0x19c6fc=_0x1a8629;_0x32c505=0xc8;}else{_0x32c505=0xce;}_0x335e58[_0x456b('0x19')](_0x32c505);return _0x335e58[_0x456b('0x20')](_0x456b('0x21'),_0x571603+'-'+_0x19c6fc+'/'+_0x1a8629)[_0x456b('0x1b')](_0x38a714);}return null;};}function patchUpdates(_0x1c3f07){return function(_0x137b2d){try{jsonpatch[_0x456b('0x22')](_0x137b2d,_0x1c3f07,!![]);}catch(_0x406e2b){return BPromise['reject'](_0x406e2b);}return _0x137b2d['save']();};}function saveUpdates(_0x151bbe,_0x24b0f1){return function(_0x33cbdb){if(_0x33cbdb){return _0x33cbdb[_0x456b('0x23')](_0x151bbe)['then'](function(_0x4ea2cb){return _0x4ea2cb;});}return null;};}function removeEntity(_0x336673,_0x2c093f){return function(_0x4c32d4){if(_0x4c32d4){return _0x4c32d4[_0x456b('0x24')]()[_0x456b('0x25')](function(){var _0x5787a9=_0x4c32d4[_0x456b('0x26')]({'plain':!![]});var _0x150370=_0x456b('0x27');return db[_0x456b('0x28')][_0x456b('0x24')]({'where':{'type':_0x150370,'resourceId':_0x5787a9['id']}})[_0x456b('0x25')](function(){return _0x4c32d4;});})[_0x456b('0x25')](function(){_0x336673[_0x456b('0x19')](0xcc)[_0x456b('0x1a')]();});}};}function handleEntityNotFound(_0x183f65,_0x277560){return function(_0x37f58e){if(!_0x37f58e){_0x183f65[_0x456b('0x18')](0x194);}return _0x37f58e;};}function handleError(_0xedbdfd,_0x477a){_0x477a=_0x477a||0x1f4;return function(_0x362907){logger[_0x456b('0x29')](_0x362907[_0x456b('0x2a')]);if(_0x362907[_0x456b('0x2b')]){delete _0x362907[_0x456b('0x2b')];}_0xedbdfd[_0x456b('0x19')](_0x477a)['send'](_0x362907);};}exports[_0x456b('0x2c')]=function(_0x1f4603,_0x300406){var _0x19866c={},_0x1d6114={},_0x38540e={'count':0x0,'rows':[]};var _0x4a9c57=_['map'](db[_0x456b('0x2d')]['rawAttributes'],function(_0x5ef64b){return{'name':_0x5ef64b[_0x456b('0x2e')],'type':_0x5ef64b[_0x456b('0x2f')][_0x456b('0x30')]};});_0x1d6114[_0x456b('0x31')]=_['map'](_0x4a9c57,_0x456b('0x2b'));_0x1d6114[_0x456b('0x32')]=_[_0x456b('0x33')](_0x1f4603['query']);_0x1d6114['filters']=_['intersection'](_0x1d6114[_0x456b('0x31')],_0x1d6114[_0x456b('0x32')]);_0x19866c[_0x456b('0x34')]=_[_0x456b('0x35')](_0x1d6114[_0x456b('0x31')],qs[_0x456b('0x36')](_0x1f4603[_0x456b('0x32')]['fields']));_0x19866c[_0x456b('0x34')]=_0x19866c[_0x456b('0x34')][_0x456b('0x37')]?_0x19866c[_0x456b('0x34')]:_0x1d6114[_0x456b('0x31')];if(!_0x1f4603[_0x456b('0x32')][_0x456b('0x38')](_0x456b('0x39'))){_0x19866c[_0x456b('0x1e')]=qs['limit'](_0x1f4603[_0x456b('0x32')][_0x456b('0x1e')]);_0x19866c['offset']=qs['offset'](_0x1f4603[_0x456b('0x32')]['offset']);}_0x19866c[_0x456b('0x3a')]=qs[_0x456b('0x3b')](_0x1f4603[_0x456b('0x32')]['sort']);_0x19866c[_0x456b('0x3c')]=qs['filters'](_[_0x456b('0x3d')](_0x1f4603[_0x456b('0x32')],_0x1d6114[_0x456b('0x3e')]),_0x4a9c57);if(_0x1f4603[_0x456b('0x32')][_0x456b('0x3f')]){_0x19866c[_0x456b('0x3c')]=_[_0x456b('0x40')](_0x19866c['where'],{'$or':_[_0x456b('0x41')](_0x4a9c57,function(_0x2f63fb){if(_0x2f63fb[_0x456b('0x2f')]!=='VIRTUAL'){var _0x24d46c={};_0x24d46c[_0x2f63fb[_0x456b('0x2b')]]={'$like':'%'+_0x1f4603[_0x456b('0x32')][_0x456b('0x3f')]+'%'};return _0x24d46c;}})});}_0x19866c=_[_0x456b('0x40')]({},_0x19866c,_0x1f4603['options']);var _0x29349f={'where':_0x19866c[_0x456b('0x3c')]};return db[_0x456b('0x2d')][_0x456b('0x1f')](_0x29349f)[_0x456b('0x25')](function(_0xe8e02e){_0x38540e[_0x456b('0x1f')]=_0xe8e02e;if(_0x1f4603['query'][_0x456b('0x42')]){_0x19866c[_0x456b('0x43')]=[{'all':!![]}];}return db[_0x456b('0x2d')][_0x456b('0x44')](_0x19866c);})[_0x456b('0x25')](function(_0x3498f0){_0x38540e[_0x456b('0x45')]=_0x3498f0;return _0x38540e;})[_0x456b('0x25')](respondWithFilteredResult(_0x300406,_0x19866c))[_0x456b('0x46')](handleError(_0x300406,null));};exports[_0x456b('0x47')]=function(_0xe7fd86,_0x5c3a18){var _0x12fac7={'raw':!![],'where':{'id':_0xe7fd86[_0x456b('0x48')]['id']}},_0x28e97e={};_0x28e97e[_0x456b('0x31')]=_[_0x456b('0x33')](db[_0x456b('0x2d')][_0x456b('0x49')]);_0x28e97e['query']=_[_0x456b('0x33')](_0xe7fd86[_0x456b('0x32')]);_0x28e97e[_0x456b('0x3e')]=_[_0x456b('0x35')](_0x28e97e['model'],_0x28e97e[_0x456b('0x32')]);_0x12fac7['attributes']=_[_0x456b('0x35')](_0x28e97e[_0x456b('0x31')],qs['fields'](_0xe7fd86['query']['fields']));_0x12fac7[_0x456b('0x34')]=_0x12fac7['attributes'][_0x456b('0x37')]?_0x12fac7[_0x456b('0x34')]:_0x28e97e[_0x456b('0x31')];if(_0xe7fd86[_0x456b('0x32')]['includeAll']){_0x12fac7[_0x456b('0x43')]=[{'all':!![]}];}_0x12fac7=_['merge']({},_0x12fac7,_0xe7fd86[_0x456b('0x4a')]);return db[_0x456b('0x2d')]['find'](_0x12fac7)[_0x456b('0x25')](handleEntityNotFound(_0x5c3a18,null))['then'](respondWithResult(_0x5c3a18,null))[_0x456b('0x46')](handleError(_0x5c3a18,null));};exports[_0x456b('0x4b')]=function(_0x2822dd,_0x1a75b6){return db[_0x456b('0x2d')]['create'](_0x2822dd['body'],{})[_0x456b('0x25')](function(_0x4fe08d){var _0xc05b9=_0x2822dd[_0x456b('0x4c')][_0x456b('0x26')]({'plain':!![]});if(!_0xc05b9)throw new Error(_0x456b('0x4d'));if(_0xc05b9['role']==='user'){var _0x169b85=_0x4fe08d[_0x456b('0x26')]({'plain':!![]});var _0x52cd7c=_0x456b('0x27');return db[_0x456b('0x4e')][_0x456b('0x4f')]({'where':{'name':_0x52cd7c,'userProfileId':_0xc05b9[_0x456b('0x50')]},'raw':!![]})[_0x456b('0x25')](function(_0x3db0bd){if(_0x3db0bd&&_0x3db0bd[_0x456b('0x51')]===0x0){return db['UserProfileResource'][_0x456b('0x4b')]({'name':_0x169b85[_0x456b('0x2b')],'resourceId':_0x169b85['id'],'type':_0x3db0bd[_0x456b('0x2b')],'sectionId':_0x3db0bd['id']},{})[_0x456b('0x25')](function(){return _0x4fe08d;});}else{return _0x4fe08d;}})['catch'](function(_0x3a6107){logger['error'](_0x456b('0x52'),_0x3a6107);throw _0x3a6107;});}return _0x4fe08d;})[_0x456b('0x25')](respondWithResult(_0x1a75b6,0xc9))[_0x456b('0x46')](handleError(_0x1a75b6,null));};exports[_0x456b('0x23')]=function(_0x2efa0f,_0x57d043){if(_0x2efa0f[_0x456b('0x53')]['id']){delete _0x2efa0f[_0x456b('0x53')]['id'];}return db[_0x456b('0x2d')]['find']({'where':{'id':_0x2efa0f[_0x456b('0x48')]['id']}})[_0x456b('0x25')](handleEntityNotFound(_0x57d043,null))[_0x456b('0x25')](saveUpdates(_0x2efa0f[_0x456b('0x53')],null))[_0x456b('0x25')](respondWithResult(_0x57d043,null))[_0x456b('0x46')](handleError(_0x57d043,null));};exports[_0x456b('0x24')]=function(_0x473729,_0x392e65){return db['Pause']['find']({'where':{'id':_0x473729[_0x456b('0x48')]['id']}})['then'](handleEntityNotFound(_0x392e65,null))[_0x456b('0x25')](removeEntity(_0x392e65,null))[_0x456b('0x46')](handleError(_0x392e65,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 8e30aa5..1fa0d64 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 _0x9957=['exports','define','Pause','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./pause.attributes'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Pause','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./pause.attributes'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'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 4f0762b..4774071 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 _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(_0x4275d7,_0x3b0d23){var _0x3196af=function(_0x525f1c){while(--_0x525f1c){_0x4275d7['push'](_0x4275d7['shift']());}};_0x3196af(++_0x3b0d23);}(_0xb10b,0x12a));var _0xbb10=function(_0x18d710,_0x153c7c){_0x18d710=_0x18d710-0x0;var _0x54f4eb=_0xb10b[_0x18d710];return _0x54f4eb;};'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 +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(_0x4f90a0,_0x5715c4){var _0x4ab42f=function(_0xa1dc16){while(--_0xa1dc16){_0x4f90a0['push'](_0x4f90a0['shift']());}};_0x4ab42f(++_0x5715c4);}(_0x7a54,0x106));var _0x47a5=function(_0x39177b,_0x5ef62a){_0x39177b=_0x39177b-0x0;var _0x1fac9c=_0x7a54[_0x39177b];return _0x1fac9c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index f8a6d9c..b6df526 100644 --- a/server/api/plugin/index.js +++ b/server/api/plugin/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d0e=['basename','extname','now','post','file','upload','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','index','get','/webhook','webhookGet','/:id','isAuthenticated','show','/:id/download','download','join','root','server/files/plugins','originalname','replace'];(function(_0x4d52a3,_0x427a08){var _0x48915e=function(_0x5ee62e){while(--_0x5ee62e){_0x4d52a3['push'](_0x4d52a3['shift']());}};_0x48915e(++_0x427a08);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x5a497b,_0x5518e3){_0x5a497b=_0x5a497b-0x0;var _0x87db6=_0x8d0e[_0x5a497b];return _0x87db6;};'use strict';var multer=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var path=require(_0xe8d0('0x2'));var timeout=require(_0xe8d0('0x3'));var express=require(_0xe8d0('0x4'));var router=express[_0xe8d0('0x5')]();var fs_extra=require(_0xe8d0('0x6'));var auth=require(_0xe8d0('0x7'));var interaction=require(_0xe8d0('0x8'));var config=require('../../config/environment');var controller=require(_0xe8d0('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xe8d0('0xa')]);router[_0xe8d0('0xb')](_0xe8d0('0xc'),controller[_0xe8d0('0xd')]);router[_0xe8d0('0xb')](_0xe8d0('0xe'),auth[_0xe8d0('0xf')](),controller[_0xe8d0('0x10')]);router['get'](_0xe8d0('0x11'),auth[_0xe8d0('0xf')](),controller[_0xe8d0('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x580aab,_0x42e0c2,_0x25e6b8){_0x25e6b8(null,path[_0xe8d0('0x13')](config[_0xe8d0('0x14')],_0xe8d0('0x15')));},'filename':function(_0x41de69,_0x5934b2,_0x38fac0){_0x5934b2[_0xe8d0('0x16')]=_0x5934b2['originalname'][_0xe8d0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x38fac0(null,util['format']('%s-%s%s',path[_0xe8d0('0x18')](_0x5934b2[_0xe8d0('0x16')],path[_0xe8d0('0x19')](_0x5934b2[_0xe8d0('0x16')])),Date[_0xe8d0('0x1a')](),path[_0xe8d0('0x19')](_0x5934b2['originalname'])));}})});router[_0xe8d0('0x1b')]('/',upload['single'](_0xe8d0('0x1c')),controller[_0xe8d0('0x1d')]);router[_0xe8d0('0x1b')]('/webhook',controller['webhookPost']);router['put'](_0xe8d0('0xe'),auth[_0xe8d0('0xf')](),controller[_0xe8d0('0x1e')]);router[_0xe8d0('0x1f')](_0xe8d0('0xe'),auth['isAuthenticated'](),controller[_0xe8d0('0x1f')]);module[_0xe8d0('0x20')]=router; \ No newline at end of file +var _0xc874=['originalname','extname','now','post','single','webhookPost','/:id','update','delete','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','index','/webhook','webhookGet','isAuthenticated','/:id/download','download','diskStorage','root','server/files/plugins','format','%s-%s%s','basename'];(function(_0x2a9977,_0x959630){var _0x40857b=function(_0x3b88b9){while(--_0x3b88b9){_0x2a9977['push'](_0x2a9977['shift']());}};_0x40857b(++_0x959630);}(_0xc874,0x154));var _0x4c87=function(_0x3ab353,_0x5d5283){_0x3ab353=_0x3ab353-0x0;var _0x1e2285=_0xc874[_0x3ab353];return _0x1e2285;};'use strict';var multer=require(_0x4c87('0x0'));var util=require('util');var path=require(_0x4c87('0x1'));var timeout=require(_0x4c87('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4c87('0x3'));var auth=require(_0x4c87('0x4'));var interaction=require(_0x4c87('0x5'));var config=require('../../config/environment');var controller=require(_0x4c87('0x6'));router[_0x4c87('0x7')]('/',auth['isAuthenticated'](),controller[_0x4c87('0x8')]);router[_0x4c87('0x7')](_0x4c87('0x9'),controller[_0x4c87('0xa')]);router[_0x4c87('0x7')]('/:id',auth[_0x4c87('0xb')](),controller['show']);router[_0x4c87('0x7')](_0x4c87('0xc'),auth[_0x4c87('0xb')](),controller[_0x4c87('0xd')]);var upload=multer({'storage':multer[_0x4c87('0xe')]({'destination':function(_0x548e1a,_0x1fcc99,_0x2b82cb){_0x2b82cb(null,path['join'](config[_0x4c87('0xf')],_0x4c87('0x10')));},'filename':function(_0x1e0530,_0x3b01bb,_0x3a2aa2){_0x3b01bb['originalname']=_0x3b01bb['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3a2aa2(null,util[_0x4c87('0x11')](_0x4c87('0x12'),path[_0x4c87('0x13')](_0x3b01bb[_0x4c87('0x14')],path[_0x4c87('0x15')](_0x3b01bb[_0x4c87('0x14')])),Date[_0x4c87('0x16')](),path[_0x4c87('0x15')](_0x3b01bb['originalname'])));}})});router[_0x4c87('0x17')]('/',upload[_0x4c87('0x18')]('file'),controller['upload']);router[_0x4c87('0x17')](_0x4c87('0x9'),controller[_0x4c87('0x19')]);router['put'](_0x4c87('0x1a'),auth['isAuthenticated'](),controller[_0x4c87('0x1b')]);router[_0x4c87('0x1c')](_0x4c87('0x1a'),auth[_0x4c87('0xb')](),controller['delete']);module[_0x4c87('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 80d37eb..ccc2860 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 _0xb86c=['STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','sequelize','exports'];(function(_0x1e993d,_0x1c7fc8){var _0x14db39=function(_0xd89cb9){while(--_0xd89cb9){_0x1e993d['push'](_0x1e993d['shift']());}};_0x14db39(++_0x1c7fc8);}(_0xb86c,0x1c5));var _0xcb86=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xb86c[_0x59c301];return _0x3866b9;};'use strict';var Sequelize=require(_0xcb86('0x0'));module[_0xcb86('0x1')]={'name':{'type':Sequelize[_0xcb86('0x2')]},'type':{'type':Sequelize[_0xcb86('0x3')](_0xcb86('0x4'),'script')},'description':{'type':Sequelize[_0xcb86('0x5')]},'version':{'type':Sequelize[_0xcb86('0x5')]},'path':{'type':Sequelize[_0xcb86('0x2')],'comment':_0xcb86('0x6')},'active':{'type':Sequelize[_0xcb86('0x7')],'defaultValue':0x0,'comment':_0xcb86('0x8')},'sidebar':{'type':Sequelize[_0xcb86('0x3')](_0xcb86('0x9'),_0xcb86('0xa'),_0xcb86('0xb'),_0xcb86('0xc')),'defaultValue':_0xcb86('0xb'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xcb86('0x2')]},'adminUrl':{'type':Sequelize[_0xcb86('0x2')]},'agentUrl':{'type':Sequelize[_0xcb86('0x2')]},'scriptName':{'type':Sequelize[_0xcb86('0x2')]},'scriptPath':{'type':Sequelize[_0xcb86('0x2')]}}; \ No newline at end of file +var _0x4a4c=['BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','sequelize','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x16e0c8,_0x4861eb){var _0xe4b5af=function(_0x5248bc){while(--_0x5248bc){_0x16e0c8['push'](_0x16e0c8['shift']());}};_0xe4b5af(++_0x4861eb);}(_0x4a4c,0x92));var _0xc4a4=function(_0x540773,_0x43253b){_0x540773=_0x540773-0x0;var _0x113dba=_0x4a4c[_0x540773];return _0x113dba;};'use strict';var Sequelize=require(_0xc4a4('0x0'));module[_0xc4a4('0x1')]={'name':{'type':Sequelize[_0xc4a4('0x2')]},'type':{'type':Sequelize[_0xc4a4('0x3')](_0xc4a4('0x4'),_0xc4a4('0x5'))},'description':{'type':Sequelize[_0xc4a4('0x6')]},'version':{'type':Sequelize[_0xc4a4('0x6')]},'path':{'type':Sequelize[_0xc4a4('0x2')],'comment':_0xc4a4('0x7')},'active':{'type':Sequelize[_0xc4a4('0x8')],'defaultValue':0x0,'comment':_0xc4a4('0x9')},'sidebar':{'type':Sequelize[_0xc4a4('0x3')](_0xc4a4('0xa'),_0xc4a4('0xb'),_0xc4a4('0xc'),_0xc4a4('0xd')),'defaultValue':_0xc4a4('0xc'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xc4a4('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xc4a4('0x2')]},'scriptName':{'type':Sequelize[_0xc4a4('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 6eab5f2..b43a237 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 _0xeef6=['Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-length','content-type','endsWith','statusCode','%s%s','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','get','Plugins','UserProfileResource','sendStatus','error','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','find','download','root','format','basename','createWriteStream','zip','warning','code','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','dirname','join','node_modules/**/*','finalize','existsSync','Plugin\x20not\x20found','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','server/files/plugins','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','test','plugins','agent','scriptPath','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x48b0a1,_0x2f21e3){var _0xc3b72f=function(_0x4c42b1){while(--_0x4c42b1){_0x48b0a1['push'](_0x48b0a1['shift']());}};_0xc3b72f(++_0x2f21e3);}(_0xeef6,0x16f));var _0x6eef=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xeef6[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require(_0x6eef('0x0'));var rimraf=require(_0x6eef('0x1'));var zipdir=require(_0x6eef('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6eef('0x3'));var moment=require('moment');var BPromise=require(_0x6eef('0x4'));var Mustache=require(_0x6eef('0x5'));var util=require(_0x6eef('0x6'));var path=require(_0x6eef('0x7'));var sox=require(_0x6eef('0x8'));var csv=require(_0x6eef('0x9'));var ejs=require(_0x6eef('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6eef('0xb'));var squel=require(_0x6eef('0xc'));var crypto=require(_0x6eef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6eef('0xe'));var toCsv=require(_0x6eef('0x9'));var querystring=require('querystring');var Papa=require(_0x6eef('0xf'));var extract=require(_0x6eef('0x10'));var rimraf=require('rimraf');var archiver=require(_0x6eef('0x11'));var Redis=require(_0x6eef('0x12'));var authService=require(_0x6eef('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6eef('0x14'));var hardwareService=require(_0x6eef('0x15'));var logger=require(_0x6eef('0x16'))(_0x6eef('0x17'));var utils=require(_0x6eef('0x18'));var config=require(_0x6eef('0x19'));var licenseUtil=require(_0x6eef('0x1a'));var db=require('../../mysqldb')['db'];config[_0x6eef('0x1b')]=_[_0x6eef('0x1c')](config[_0x6eef('0x1b')],{'host':_0x6eef('0x1d'),'port':0x18eb});var socket=require(_0x6eef('0x1e'))(new Redis(config[_0x6eef('0x1b')]));require(_0x6eef('0x1f'))[_0x6eef('0x20')](socket);function respondWithStatusCode(_0x29b503,_0x432294){_0x432294=_0x432294||0xcc;return function(_0x5dbe96){if(_0x5dbe96){return _0x29b503['sendStatus'](_0x432294);}return _0x29b503[_0x6eef('0x21')](_0x432294)[_0x6eef('0x22')]();};}function respondWithResult(_0x273f64,_0x4e0bd2){_0x4e0bd2=_0x4e0bd2||0xc8;return function(_0x215158){if(_0x215158){return _0x273f64[_0x6eef('0x21')](_0x4e0bd2)[_0x6eef('0x23')](_0x215158);}};}function respondWithFilteredResult(_0x3afac9,_0xc47eb6){return function(_0x4c3d65){if(_0x4c3d65){var _0x35dd54=typeof _0xc47eb6[_0x6eef('0x24')]===_0x6eef('0x25')&&typeof _0xc47eb6[_0x6eef('0x26')]===_0x6eef('0x25');var _0x65ad55=_0x4c3d65[_0x6eef('0x27')];var _0x4625ed=_0x35dd54?0x0:_0xc47eb6[_0x6eef('0x24')];var _0x3c27e1=_0x35dd54?_0x4c3d65['count']:_0xc47eb6[_0x6eef('0x24')]+_0xc47eb6[_0x6eef('0x26')];var _0x2c889a;if(_0x3c27e1>=_0x65ad55){_0x3c27e1=_0x65ad55;_0x2c889a=0xc8;}else{_0x2c889a=0xce;}_0x3afac9[_0x6eef('0x21')](_0x2c889a);return _0x3afac9[_0x6eef('0x28')](_0x6eef('0x29'),_0x4625ed+'-'+_0x3c27e1+'/'+_0x65ad55)[_0x6eef('0x23')](_0x4c3d65);}return null;};}function patchUpdates(_0x4ac330){return function(_0x5197d8){try{jsonpatch[_0x6eef('0x2a')](_0x5197d8,_0x4ac330,!![]);}catch(_0x25c61a){return BPromise['reject'](_0x25c61a);}return _0x5197d8[_0x6eef('0x2b')]();};}function saveUpdates(_0x473c71,_0x4dc0c4){return function(_0x9e34dd){if(_0x9e34dd){return _0x9e34dd[_0x6eef('0x2c')](_0x473c71)['then'](function(_0x423e11){return _0x423e11;});}return null;};}function removeEntity(_0x26db0b,_0x3d11d5){return function(_0x463959){if(_0x463959){return _0x463959[_0x6eef('0x2d')]()[_0x6eef('0x2e')](function(){var _0x173fd2=_0x463959[_0x6eef('0x2f')]({'plain':!![]});var _0x218aeb=_0x6eef('0x30');return db[_0x6eef('0x31')]['destroy']({'where':{'type':_0x218aeb,'resourceId':_0x173fd2['id']}})['then'](function(){return _0x463959;});})['then'](function(){_0x26db0b[_0x6eef('0x21')](0xcc)[_0x6eef('0x22')]();});}};}function handleEntityNotFound(_0x11dcd7,_0x4f50a6){return function(_0x1725f7){if(!_0x1725f7){_0x11dcd7[_0x6eef('0x32')](0x194);}return _0x1725f7;};}function handleError(_0x5c8dd9,_0x5d32e3){_0x5d32e3=_0x5d32e3||0x1f4;return function(_0x3c2dec){logger[_0x6eef('0x33')](_0x3c2dec['stack']);if(_0x3c2dec[_0x6eef('0x34')]){delete _0x3c2dec[_0x6eef('0x34')];}_0x5c8dd9['status'](_0x5d32e3)[_0x6eef('0x35')](_0x3c2dec);};}exports[_0x6eef('0x36')]=function(_0x5ddbf4,_0x186413){var _0x313240={},_0xeade76={},_0x3b1b21={'count':0x0,'rows':[]};var _0x18c597=_[_0x6eef('0x37')](db[_0x6eef('0x38')][_0x6eef('0x39')],function(_0x443688){return{'name':_0x443688[_0x6eef('0x3a')],'type':_0x443688[_0x6eef('0x3b')][_0x6eef('0x3c')]};});_0xeade76['model']=_[_0x6eef('0x37')](_0x18c597,'name');_0xeade76[_0x6eef('0x3d')]=_[_0x6eef('0x3e')](_0x5ddbf4['query']);_0xeade76[_0x6eef('0x3f')]=_[_0x6eef('0x40')](_0xeade76[_0x6eef('0x41')],_0xeade76[_0x6eef('0x3d')]);_0x313240['attributes']=_['intersection'](_0xeade76[_0x6eef('0x41')],qs[_0x6eef('0x42')](_0x5ddbf4[_0x6eef('0x3d')]['fields']));_0x313240[_0x6eef('0x43')]=_0x313240[_0x6eef('0x43')]['length']?_0x313240[_0x6eef('0x43')]:_0xeade76[_0x6eef('0x41')];if(!_0x5ddbf4[_0x6eef('0x3d')][_0x6eef('0x44')](_0x6eef('0x45'))){_0x313240[_0x6eef('0x26')]=qs[_0x6eef('0x26')](_0x5ddbf4['query'][_0x6eef('0x26')]);_0x313240[_0x6eef('0x24')]=qs[_0x6eef('0x24')](_0x5ddbf4[_0x6eef('0x3d')][_0x6eef('0x24')]);}_0x313240[_0x6eef('0x46')]=qs[_0x6eef('0x47')](_0x5ddbf4[_0x6eef('0x3d')][_0x6eef('0x47')]);_0x313240[_0x6eef('0x48')]=qs[_0x6eef('0x3f')](_['pick'](_0x5ddbf4[_0x6eef('0x3d')],_0xeade76[_0x6eef('0x3f')]),_0x18c597);if(_0x5ddbf4[_0x6eef('0x3d')][_0x6eef('0x49')]){_0x313240['where']=_[_0x6eef('0x4a')](_0x313240[_0x6eef('0x48')],{'$or':_[_0x6eef('0x37')](_0x18c597,function(_0x23a110){if(_0x23a110[_0x6eef('0x3b')]!==_0x6eef('0x4b')){var _0x261d1e={};_0x261d1e[_0x23a110[_0x6eef('0x34')]]={'$like':'%'+_0x5ddbf4['query'][_0x6eef('0x49')]+'%'};return _0x261d1e;}})});}_0x313240=_[_0x6eef('0x4a')]({},_0x313240,_0x5ddbf4[_0x6eef('0x4c')]);var _0x209b73={'where':_0x313240[_0x6eef('0x48')]};return db[_0x6eef('0x38')][_0x6eef('0x27')](_0x209b73)['then'](function(_0x6a3b58){_0x3b1b21['count']=_0x6a3b58;if(_0x5ddbf4[_0x6eef('0x3d')][_0x6eef('0x4d')]){_0x313240[_0x6eef('0x4e')]=[{'all':!![]}];}return db['Plugin'][_0x6eef('0x4f')](_0x313240);})[_0x6eef('0x2e')](function(_0xb4e8fe){_0x3b1b21['rows']=_0xb4e8fe;return _0x3b1b21;})[_0x6eef('0x2e')](respondWithFilteredResult(_0x186413,_0x313240))[_0x6eef('0x50')](handleError(_0x186413,null));};exports[_0x6eef('0x51')]=function(_0x368cc9,_0x5c8df6){var _0x29aefe={'raw':!![],'where':{'id':_0x368cc9[_0x6eef('0x52')]['id']}},_0x1f0c13={};_0x1f0c13[_0x6eef('0x41')]=_[_0x6eef('0x3e')](db['Plugin'][_0x6eef('0x39')]);_0x1f0c13[_0x6eef('0x3d')]=_[_0x6eef('0x3e')](_0x368cc9[_0x6eef('0x3d')]);_0x1f0c13['filters']=_[_0x6eef('0x40')](_0x1f0c13[_0x6eef('0x41')],_0x1f0c13[_0x6eef('0x3d')]);_0x29aefe['attributes']=_[_0x6eef('0x40')](_0x1f0c13[_0x6eef('0x41')],qs['fields'](_0x368cc9[_0x6eef('0x3d')][_0x6eef('0x42')]));_0x29aefe[_0x6eef('0x43')]=_0x29aefe[_0x6eef('0x43')][_0x6eef('0x53')]?_0x29aefe[_0x6eef('0x43')]:_0x1f0c13[_0x6eef('0x41')];if(_0x368cc9[_0x6eef('0x3d')]['includeAll']){_0x29aefe[_0x6eef('0x4e')]=[{'all':!![]}];}_0x29aefe=_[_0x6eef('0x4a')]({},_0x29aefe,_0x368cc9['options']);return db[_0x6eef('0x38')][_0x6eef('0x54')](_0x29aefe)[_0x6eef('0x2e')](handleEntityNotFound(_0x5c8df6,null))[_0x6eef('0x2e')](respondWithResult(_0x5c8df6,null))[_0x6eef('0x50')](handleError(_0x5c8df6,null));};exports[_0x6eef('0x55')]=function(_0x34c3c2,_0x175edc,_0x29eb02){return db[_0x6eef('0x38')][_0x6eef('0x54')]({'where':{'id':_0x34c3c2[_0x6eef('0x52')]['id']},'attributes':[_0x6eef('0x34'),_0x6eef('0x7')],'raw':!![]})[_0x6eef('0x2e')](handleEntityNotFound(_0x175edc,null))[_0x6eef('0x2e')](function(_0x2a10dd){if(_0x2a10dd){var _0x60cd66=path['join'](config[_0x6eef('0x56')],'server/files/plugins',util[_0x6eef('0x57')]('%s.zip',path[_0x6eef('0x58')](_0x2a10dd[_0x6eef('0x7')])));var _0x117c5d=fs[_0x6eef('0x59')](_0x60cd66);var _0x46b1e8=archiver(_0x6eef('0x5a'),{'zlib':{'level':0x9}});_0x46b1e8['on'](_0x6eef('0x5b'),function(_0x386a1c){if(_0x386a1c[_0x6eef('0x5c')]==='ENOENT'){logger[_0x6eef('0x33')](_0x386a1c);}else{throw new db['Sequelize'][(_0x6eef('0x5d'))](_0x6eef('0x5e'));}});_0x46b1e8['on']('error',function(_0x4df4f6){throw new db[(_0x6eef('0x5f'))][(_0x6eef('0x5d'))](_0x6eef('0x5e'));});_0x46b1e8[_0x6eef('0x60')](_0x117c5d);_0x46b1e8[_0x6eef('0x61')]('**/*',{'cwd':path['join'](config[_0x6eef('0x56')],'server/files/plugins',path[_0x6eef('0x62')](_0x2a10dd['path'])),'ignore':[path[_0x6eef('0x63')](path[_0x6eef('0x58')](_0x2a10dd['path']),_0x6eef('0x64')),path[_0x6eef('0x63')](path['basename'](_0x2a10dd[_0x6eef('0x7')]),'attachments/**/*')],'nodir':!![]})[_0x6eef('0x65')]();_0x117c5d['on']('close',function(){if(!fs[_0x6eef('0x66')](_0x60cd66)){throw new db[(_0x6eef('0x5f'))][(_0x6eef('0x5d'))](_0x6eef('0x67'));}return _0x175edc['download'](_0x60cd66,util[_0x6eef('0x57')](_0x6eef('0x68'),path[_0x6eef('0x58')](_0x2a10dd[_0x6eef('0x7')])),function(_0x1ff153){if(_0x1ff153){throw new db[(_0x6eef('0x5f'))][(_0x6eef('0x5d'))](_0x6eef('0x69'));}fs[_0x6eef('0x6a')](_0x60cd66);logger[_0x6eef('0x6b')](_0x6eef('0x6c'));logger[_0x6eef('0x6b')](_0x6eef('0x6d'));});});}return null;})[_0x6eef('0x50')](handleError(_0x175edc,null));};exports[_0x6eef('0x6e')]=function(_0x59ed86,_0x1d6e57,_0x11a565){var _0x587114=path['basename'](_0x59ed86[_0x6eef('0x6f')][_0x6eef('0x70')],path[_0x6eef('0x71')](_0x59ed86[_0x6eef('0x6f')]['filename']));var _0x278c05=path[_0x6eef('0x63')](config[_0x6eef('0x56')],_0x6eef('0x72'),_0x59ed86['file'][_0x6eef('0x70')]);var _0x160046=path[_0x6eef('0x63')](config[_0x6eef('0x56')],_0x6eef('0x72'),_0x587114);logger[_0x6eef('0x6b')]('Plugin\x20upload\x20filepath:\x20%s',_0x278c05);logger[_0x6eef('0x6b')]('Plugin\x20upload\x20destination:\x20%s',_0x160046);try{fs[_0x6eef('0x73')](_0x278c05,parseInt(_0x6eef('0x74'),0x8));extract(_0x278c05,{'dir':_0x160046},function(_0x1c7501){if(_0x1c7501){logger[_0x6eef('0x33')](_0x1c7501);handleError(_0x1c7501,!![]);};var _0xde9358=fs[_0x6eef('0x75')](_0x160046);if(_0xde9358['length']>0x1){removeReferences(_0x278c05,_0x160046);logger[_0x6eef('0x33')]('Invalid\x20plugin\x20structure');return _0x11a565(new Error(_0x6eef('0x76')));}var _0x3e7ab4=fs['lstatSync'](path[_0x6eef('0x63')](_0x160046,_0xde9358[0x0]));if(_0x3e7ab4[_0x6eef('0x77')]()){removeReferences(_0x278c05,_0x160046);logger[_0x6eef('0x33')](_0x6eef('0x76'));return _0x11a565(new Error(_0x6eef('0x76')));}if(_0x3e7ab4[_0x6eef('0x78')]()){var _0x25870c=fs[_0x6eef('0x75')](path['join'](_0x160046,_0xde9358[0x0]));if(_0x25870c['length']===0x0){removeReferences(_0x278c05,_0x160046);logger[_0x6eef('0x33')](_0x6eef('0x76'));return _0x11a565(new Error(_0x6eef('0x76')));}var _0x1e80f7=_0x25870c[_0x6eef('0x79')](function(_0x3a4d47){return _0x3a4d47===_0x6eef('0x7a');});if(!_0x1e80f7){return _0x11a565(new Error(_0x6eef('0x7b')));}var _0x9a3d16=fs[_0x6eef('0x7c')](path['join'](_0x160046,_0xde9358[0x0],_0x6eef('0x7a')));var _0x513638=JSON[_0x6eef('0x7d')](_0x9a3d16);if(_0x6eef('0x25')==typeof _0x513638[_0x6eef('0x34')]){return _0x11a565(new Error(_0x6eef('0x7e')));}if(_0x6eef('0x25')==typeof _0x513638[_0x6eef('0x3b')]){return _0x11a565(new Error(_0x6eef('0x7f')));}if(_0x6eef('0x25')==typeof _0x513638[_0x6eef('0x80')]){return _0x11a565(new Error(_0x6eef('0x81')));}if(_0x6eef('0x25')==typeof _0x513638['parameters']){return _0x11a565(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x513638[_0x6eef('0x3b')]===_0x6eef('0x82')){if(_0x6eef('0x25')==typeof _0x513638[_0x6eef('0x83')][_0x6eef('0x84')]){return _0x11a565(new Error(_0x6eef('0x85')));}if(_0x6eef('0x25')==typeof _0x513638['parameters'][_0x6eef('0x84')][_0x6eef('0x86')]&&_0x6eef('0x25')==typeof _0x513638[_0x6eef('0x83')]['views']['agent']){return _0x11a565(new Error(_0x6eef('0x87')));}}else if(_0x513638[_0x6eef('0x3b')]===_0x6eef('0x88')){if('undefined'==typeof _0x513638[_0x6eef('0x83')][_0x6eef('0x89')]){return _0x11a565(new Error(_0x6eef('0x8a')));}if(_0x6eef('0x25')==typeof _0x513638[_0x6eef('0x83')]['scriptPath']){return _0x11a565(new Error(_0x6eef('0x8b')));}}else{return _0x11a565(new Error(_0x6eef('0x8c')));}var _0x2219df=_0x513638[_0x6eef('0x34')];var _0xc01e9f=_0x513638[_0x6eef('0x8d')];var _0x4d0d67=_0x513638[_0x6eef('0x3b')];var _0x1fc1b3=_0x513638['sidebar']?_0x513638[_0x6eef('0x8e')]:_0x6eef('0x8f');var _0x4ce875=_0x513638[_0x6eef('0x90')]?_0x513638[_0x6eef('0x90')]:'icon-apps';var _0x1e3884='';var _0x31e310='';var _0x234bb2='';var _0x2bc5d9='';var _0xbb3139=_0x513638[_0x6eef('0x80')];if(_0x4d0d67==='html'){if(_0x6eef('0x25')!=typeof _0x513638[_0x6eef('0x83')][_0x6eef('0x84')][_0x6eef('0x86')]){var _0x209f40=_0x513638[_0x6eef('0x83')][_0x6eef('0x84')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x6eef('0x91')](_0x209f40)){_0x1e3884=path['join'](_0x6eef('0x92'),_0x587114,_0xde9358[0x0],_0x209f40);}else{_0x1e3884=_0x209f40;}}else{logger[_0x6eef('0x6b')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x6eef('0x25')!=typeof _0x513638[_0x6eef('0x83')]['views'][_0x6eef('0x93')]){var _0x160e0d=_0x513638[_0x6eef('0x83')][_0x6eef('0x84')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x6eef('0x91')](_0x160e0d)){_0x31e310=path[_0x6eef('0x63')](_0x6eef('0x92'),_0x587114,_0xde9358[0x0],_0x160e0d);}else{_0x31e310=_0x160e0d;}}else{logger[_0x6eef('0x6b')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x4d0d67===_0x6eef('0x88')){_0x234bb2=_0x513638[_0x6eef('0x83')][_0x6eef('0x89')];_0x2bc5d9=_0x513638['parameters'][_0x6eef('0x94')];if(_0x6eef('0x25')!=typeof _0x513638[_0x6eef('0x83')][_0x6eef('0x84')]){if(_0x6eef('0x25')!=typeof _0x513638[_0x6eef('0x83')][_0x6eef('0x84')][_0x6eef('0x86')]){var _0x209f40=_0x513638[_0x6eef('0x83')][_0x6eef('0x84')][_0x6eef('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x6eef('0x91')](_0x209f40)){_0x1e3884=path[_0x6eef('0x63')](_0x6eef('0x92'),_0x587114,_0xde9358[0x0],_0x209f40);}else{_0x1e3884=_0x209f40;}}if('undefined'!=typeof _0x513638[_0x6eef('0x83')][_0x6eef('0x84')]['agent']){var _0x160e0d=_0x513638[_0x6eef('0x83')][_0x6eef('0x84')][_0x6eef('0x93')];if(!/^(f|ht)tps?:\/\//i[_0x6eef('0x91')](_0x160e0d)){_0x31e310=path[_0x6eef('0x63')](_0x6eef('0x92'),_0x587114,_0xde9358[0x0],_0x160e0d);}else{_0x31e310=_0x160e0d;}}}}var _0xba3700={'name':_0x2219df,'description':_0xc01e9f,'path':path[_0x6eef('0x63')](_0x587114,_0xde9358[0x0]),'type':_0x4d0d67,'sidebar':_0x1fc1b3,'icon':_0x4ce875,'adminUrl':_0x1e3884,'agentUrl':_0x31e310,'scriptName':_0x234bb2,'scriptPath':_0x2bc5d9,'version':_0xbb3139};removeReferences(_0x278c05,null);return db[_0x6eef('0x38')][_0x6eef('0x95')](_0xba3700)['then'](function(_0x203ecf){var _0x2a2f25={'role':_0x59ed86[_0x6eef('0x96')][_0x6eef('0x97')],'userProfileId':_0x59ed86['body'][_0x6eef('0x98')]};if(!_0x2a2f25)throw new Error(_0x6eef('0x99'));if(_0x2a2f25[_0x6eef('0x97')]===_0x6eef('0x9a')){var _0xd47b3d=_0x203ecf[_0x6eef('0x2f')]({'plain':!![]});return db[_0x6eef('0x9b')]['find']({'where':{'name':'Plugins','userProfileId':_0x2a2f25[_0x6eef('0x98')]},'raw':!![]})[_0x6eef('0x2e')](function(_0x584d98){if(_0x584d98&&_0x584d98[_0x6eef('0x9c')]===0x0){return db[_0x6eef('0x31')][_0x6eef('0x95')]({'name':_0xd47b3d[_0x6eef('0x34')],'resourceId':_0xd47b3d['id'],'type':_0x584d98['name'],'sectionId':_0x584d98['id']},{})[_0x6eef('0x2e')](function(){return _0x203ecf;});}else{return _0x203ecf;}})['catch'](function(_0x40b8b6){logger[_0x6eef('0x33')](_0x6eef('0x9d'),_0x40b8b6);throw _0x40b8b6;});}return _0x203ecf;})[_0x6eef('0x2e')](respondWithResult(_0x1d6e57,null))[_0x6eef('0x50')](handleError(_0x1d6e57,null));}});}catch(_0x56307e){_0x1d6e57[_0x6eef('0x21')](0x1f4)['send'](_0x56307e);}};function removeReferences(_0x2f4cd4,_0x34eeff){try{if(_0x2f4cd4){fs['unlinkSync'](_0x2f4cd4);logger[_0x6eef('0x6b')](_0x6eef('0x9e'));}if(_0x34eeff){rimraf(_0x34eeff,function(){});logger[_0x6eef('0x6b')](_0x6eef('0x9f'));}}catch(_0x3c60b5){logger['error'](_0x3c60b5);}}exports[_0x6eef('0x2c')]=function(_0x9a0897,_0x4fab73,_0x1e7541){return db[_0x6eef('0x38')][_0x6eef('0x54')]({'where':{'id':_0x9a0897[_0x6eef('0x52')]['id']}})['then'](handleEntityNotFound(_0x4fab73,null))[_0x6eef('0x2e')](saveUpdates(_0x9a0897[_0x6eef('0x96')],null))[_0x6eef('0x2e')](respondWithResult(_0x4fab73,null))['catch'](handleError(_0x4fab73,null));};exports[_0x6eef('0xa0')]=function(_0x19c3f9,_0x54900e,_0x36acd7){return db[_0x6eef('0x38')]['find']({'where':{'id':_0x19c3f9[_0x6eef('0x52')]['id']}})[_0x6eef('0x2e')](function(_0x15662c){if(_0x15662c){return _0x15662c['destroy']();}})[_0x6eef('0x2e')](function(_0x414b34){rimraf(path['join'](config['root'],'server/files/plugins',path[_0x6eef('0x62')](_0x414b34['path'])),function(){});return _0x414b34;})[_0x6eef('0x2e')](handleEntityNotFound(_0x54900e,null))[_0x6eef('0x2e')](respondWithStatusCode(_0x54900e,null))['catch'](handleError(_0x54900e,null));};exports['webhookGet']=function(_0x1cedee,_0x4343a5,_0x339f79){return BPromise[_0x6eef('0xa1')]()[_0x6eef('0x2e')](function(){if(!_0x1cedee[_0x6eef('0x3d')][_0x6eef('0x7')]){throw new Error(_0x6eef('0xa2'));}if(!_0x1cedee['query'][_0x6eef('0xa3')]){throw new Error(_0x6eef('0xa4'));}var _0x23e998=_0x1cedee[_0x6eef('0x3d')][_0x6eef('0xa5')]?_0x1cedee[_0x6eef('0x3d')][_0x6eef('0xa5')]+':'+_0x1cedee[_0x6eef('0x3d')][_0x6eef('0xa3')]:_0x6eef('0xa6')+_0x1cedee[_0x6eef('0x3d')][_0x6eef('0xa3')];var _0x3e3b88=_0x1cedee[_0x6eef('0x3d')][_0x6eef('0x23')]?_0x1cedee[_0x6eef('0x3d')][_0x6eef('0x23')]:!![];var _0x49ef06=_0x1cedee[_0x6eef('0x3d')][_0x6eef('0xa7')]?_0x1cedee['query'][_0x6eef('0xa7')]:null;var _0x4128ef={'method':_0x1cedee[_0x6eef('0xa8')],'uri':util[_0x6eef('0x57')]('%s%s',_0x23e998,_0x1cedee[_0x6eef('0x3d')]['path']),'json':_0x3e3b88,'resolveWithFullResponse':!![],'encoding':_0x49ef06,'qs':_0x1cedee[_0x6eef('0x3d')]};if(_0x1cedee[_0x6eef('0xa9')]){_0x4128ef[_0x6eef('0xa9')]=_0x1cedee[_0x6eef('0xa9')];if(_0x4128ef[_0x6eef('0xa9')][_0x6eef('0xaa')]){delete _0x4128ef[_0x6eef('0xa9')][_0x6eef('0xaa')];}}if(_0x4128ef[_0x6eef('0xa9')][_0x6eef('0xab')]){delete _0x4128ef[_0x6eef('0xa9')]['content-type'];}return rp(_0x4128ef);})[_0x6eef('0x2e')](function(_0x4e9c75){if(_0x4e9c75){_0x4343a5['set'](_0x4e9c75[_0x6eef('0xa9')]);logger[_0x6eef('0x6b')](_0x4e9c75[_0x6eef('0x96')]);if(_[_0x6eef('0xac')](_0x1cedee[_0x6eef('0x3d')]['path'],'download')&&_0x4e9c75[_0x6eef('0xad')]==0x1f4){return _0x4343a5[_0x6eef('0x32')](_0x4e9c75[_0x6eef('0xad')]);}else{return _0x4343a5[_0x6eef('0x21')](_0x4e9c75[_0x6eef('0xad')])['send'](_0x4e9c75['body']);}}else{return _0x4343a5[_0x6eef('0x32')](0xc8);}})[_0x6eef('0x50')](handleError(_0x4343a5,null));};exports['webhookPost']=function(_0x4ebf15,_0x5d933c,_0x4a35a3){return BPromise[_0x6eef('0xa1')]()[_0x6eef('0x2e')](function(){if(!_0x4ebf15[_0x6eef('0x3d')][_0x6eef('0x7')]){throw new Error(_0x6eef('0xa2'));}if(!_0x4ebf15[_0x6eef('0x3d')][_0x6eef('0xa3')]){throw new Error(_0x6eef('0xa4'));}var _0x166d8f=_0x4ebf15[_0x6eef('0x3d')]['hostname']?_0x4ebf15[_0x6eef('0x3d')][_0x6eef('0xa5')]+':'+_0x4ebf15[_0x6eef('0x3d')][_0x6eef('0xa3')]:_0x6eef('0xa6')+_0x4ebf15['query'][_0x6eef('0xa3')];var _0x4bb103=_0x4ebf15[_0x6eef('0x3d')][_0x6eef('0x23')]?_0x4ebf15[_0x6eef('0x3d')]['json']:!![];var _0x192b00=_0x4ebf15[_0x6eef('0x3d')][_0x6eef('0xa7')]?_0x4ebf15[_0x6eef('0x3d')][_0x6eef('0xa7')]:null;var _0x230588={'method':_0x4ebf15[_0x6eef('0xa8')],'uri':util[_0x6eef('0x57')](_0x6eef('0xae'),_0x166d8f,_0x4ebf15['query'][_0x6eef('0x7')]),'json':_0x4bb103,'resolveWithFullResponse':!![],'encoding':_0x192b00,'body':_0x4ebf15[_0x6eef('0x96')]};if(_0x4ebf15[_0x6eef('0xa9')]){_0x230588[_0x6eef('0xa9')]=_0x4ebf15[_0x6eef('0xa9')];if(_0x230588[_0x6eef('0xa9')][_0x6eef('0xaa')]){delete _0x230588[_0x6eef('0xa9')][_0x6eef('0xaa')];}}if(_0x230588[_0x6eef('0xa9')][_0x6eef('0xab')]){delete _0x230588[_0x6eef('0xa9')][_0x6eef('0xab')];}return rp(_0x230588);})[_0x6eef('0x2e')](function(_0x4d742f){if(_0x4d742f){_0x5d933c[_0x6eef('0x28')](_0x4d742f['headers']);logger[_0x6eef('0x6b')](_0x4d742f[_0x6eef('0x96')]);return _0x5d933c[_0x6eef('0x21')](_0x4d742f['statusCode'])[_0x6eef('0x35')](_0x4d742f[_0x6eef('0x96')]);}else{return _0x5d933c[_0x6eef('0x32')](0xc8);}})['catch'](handleError(_0x5d933c,null));}; \ No newline at end of file +var _0xcf2a=['update','destroy','then','get','Plugins','UserProfileResource','sendStatus','error','name','send','map','Plugin','rawAttributes','fieldName','key','model','keys','query','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','type','merge','options','includeAll','include','rows','catch','show','intersection','find','download','params','join','root','server/files/plugins','format','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','%s.zip','unlinkSync','info','Temporary\x20file\x20removed','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','version','admin','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./plugin.socket','register','status','json','offset','limit','undefined','count','set','Content-Range','reject','save'];(function(_0x341b0e,_0x22bc63){var _0x165837=function(_0x58bc92){while(--_0x58bc92){_0x341b0e['push'](_0x341b0e['shift']());}};_0x165837(++_0x22bc63);}(_0xcf2a,0x1db));var _0xacf2=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0xcf2a[_0x28aea5];return _0x6a55f9;};'use strict';var emlformat=require(_0xacf2('0x0'));var rimraf=require(_0xacf2('0x1'));var zipdir=require(_0xacf2('0x2'));var jsonpatch=require(_0xacf2('0x3'));var rp=require(_0xacf2('0x4'));var moment=require(_0xacf2('0x5'));var BPromise=require(_0xacf2('0x6'));var Mustache=require(_0xacf2('0x7'));var util=require('util');var path=require(_0xacf2('0x8'));var sox=require('sox');var csv=require(_0xacf2('0x9'));var ejs=require(_0xacf2('0xa'));var fs=require('fs');var fs_extra=require(_0xacf2('0xb'));var _=require(_0xacf2('0xc'));var squel=require(_0xacf2('0xd'));var crypto=require(_0xacf2('0xe'));var jsforce=require(_0xacf2('0xf'));var deskjs=require(_0xacf2('0x10'));var toCsv=require(_0xacf2('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var extract=require(_0xacf2('0x11'));var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0xacf2('0x12'));var authService=require(_0xacf2('0x13'));var qs=require(_0xacf2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xacf2('0x15'));var logger=require(_0xacf2('0x16'))(_0xacf2('0x17'));var utils=require(_0xacf2('0x18'));var config=require(_0xacf2('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xacf2('0x1a'))['db'];config[_0xacf2('0x1b')]=_['defaults'](config[_0xacf2('0x1b')],{'host':_0xacf2('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xacf2('0x1b')]));require(_0xacf2('0x1d'))[_0xacf2('0x1e')](socket);function respondWithStatusCode(_0x2455b2,_0x500312){_0x500312=_0x500312||0xcc;return function(_0x9af82){if(_0x9af82){return _0x2455b2['sendStatus'](_0x500312);}return _0x2455b2[_0xacf2('0x1f')](_0x500312)['end']();};}function respondWithResult(_0x8921e2,_0x1d9113){_0x1d9113=_0x1d9113||0xc8;return function(_0x572611){if(_0x572611){return _0x8921e2[_0xacf2('0x1f')](_0x1d9113)[_0xacf2('0x20')](_0x572611);}};}function respondWithFilteredResult(_0x25e1de,_0x1a7d89){return function(_0x50591){if(_0x50591){var _0x4c68ee=typeof _0x1a7d89[_0xacf2('0x21')]==='undefined'&&typeof _0x1a7d89[_0xacf2('0x22')]===_0xacf2('0x23');var _0x43c440=_0x50591[_0xacf2('0x24')];var _0x59b2ce=_0x4c68ee?0x0:_0x1a7d89['offset'];var _0xcb9e00=_0x4c68ee?_0x50591[_0xacf2('0x24')]:_0x1a7d89[_0xacf2('0x21')]+_0x1a7d89[_0xacf2('0x22')];var _0x56aae3;if(_0xcb9e00>=_0x43c440){_0xcb9e00=_0x43c440;_0x56aae3=0xc8;}else{_0x56aae3=0xce;}_0x25e1de['status'](_0x56aae3);return _0x25e1de[_0xacf2('0x25')](_0xacf2('0x26'),_0x59b2ce+'-'+_0xcb9e00+'/'+_0x43c440)[_0xacf2('0x20')](_0x50591);}return null;};}function patchUpdates(_0x5d2c23){return function(_0x42d7d3){try{jsonpatch['apply'](_0x42d7d3,_0x5d2c23,!![]);}catch(_0x364df6){return BPromise[_0xacf2('0x27')](_0x364df6);}return _0x42d7d3[_0xacf2('0x28')]();};}function saveUpdates(_0x4ceccc,_0x4ad224){return function(_0x32952b){if(_0x32952b){return _0x32952b[_0xacf2('0x29')](_0x4ceccc)['then'](function(_0x5f58b3){return _0x5f58b3;});}return null;};}function removeEntity(_0x3a3325,_0x45e33a){return function(_0x67ba6f){if(_0x67ba6f){return _0x67ba6f[_0xacf2('0x2a')]()[_0xacf2('0x2b')](function(){var _0x307326=_0x67ba6f[_0xacf2('0x2c')]({'plain':!![]});var _0x2e8ef1=_0xacf2('0x2d');return db[_0xacf2('0x2e')][_0xacf2('0x2a')]({'where':{'type':_0x2e8ef1,'resourceId':_0x307326['id']}})[_0xacf2('0x2b')](function(){return _0x67ba6f;});})[_0xacf2('0x2b')](function(){_0x3a3325[_0xacf2('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c03f9,_0x520e26){return function(_0x704d21){if(!_0x704d21){_0x1c03f9[_0xacf2('0x2f')](0x194);}return _0x704d21;};}function handleError(_0x8912dd,_0x3ca0db){_0x3ca0db=_0x3ca0db||0x1f4;return function(_0xe0bdb){logger[_0xacf2('0x30')](_0xe0bdb['stack']);if(_0xe0bdb[_0xacf2('0x31')]){delete _0xe0bdb[_0xacf2('0x31')];}_0x8912dd[_0xacf2('0x1f')](_0x3ca0db)[_0xacf2('0x32')](_0xe0bdb);};}exports['index']=function(_0x477b4c,_0x3fd90b){var _0x2dc9aa={},_0x3964bb={},_0x302b2e={'count':0x0,'rows':[]};var _0x1c8a0e=_[_0xacf2('0x33')](db[_0xacf2('0x34')][_0xacf2('0x35')],function(_0xeb46c9){return{'name':_0xeb46c9[_0xacf2('0x36')],'type':_0xeb46c9['type'][_0xacf2('0x37')]};});_0x3964bb[_0xacf2('0x38')]=_[_0xacf2('0x33')](_0x1c8a0e,_0xacf2('0x31'));_0x3964bb['query']=_[_0xacf2('0x39')](_0x477b4c[_0xacf2('0x3a')]);_0x3964bb['filters']=_['intersection'](_0x3964bb[_0xacf2('0x38')],_0x3964bb[_0xacf2('0x3a')]);_0x2dc9aa['attributes']=_['intersection'](_0x3964bb[_0xacf2('0x38')],qs[_0xacf2('0x3b')](_0x477b4c['query']['fields']));_0x2dc9aa['attributes']=_0x2dc9aa[_0xacf2('0x3c')][_0xacf2('0x3d')]?_0x2dc9aa[_0xacf2('0x3c')]:_0x3964bb[_0xacf2('0x38')];if(!_0x477b4c[_0xacf2('0x3a')][_0xacf2('0x3e')]('nolimit')){_0x2dc9aa[_0xacf2('0x22')]=qs[_0xacf2('0x22')](_0x477b4c[_0xacf2('0x3a')][_0xacf2('0x22')]);_0x2dc9aa['offset']=qs[_0xacf2('0x21')](_0x477b4c[_0xacf2('0x3a')]['offset']);}_0x2dc9aa[_0xacf2('0x3f')]=qs[_0xacf2('0x40')](_0x477b4c[_0xacf2('0x3a')][_0xacf2('0x40')]);_0x2dc9aa[_0xacf2('0x41')]=qs[_0xacf2('0x42')](_[_0xacf2('0x43')](_0x477b4c[_0xacf2('0x3a')],_0x3964bb['filters']),_0x1c8a0e);if(_0x477b4c[_0xacf2('0x3a')][_0xacf2('0x44')]){_0x2dc9aa[_0xacf2('0x41')]=_['merge'](_0x2dc9aa[_0xacf2('0x41')],{'$or':_[_0xacf2('0x33')](_0x1c8a0e,function(_0x38305f){if(_0x38305f[_0xacf2('0x45')]!=='VIRTUAL'){var _0x18ecdf={};_0x18ecdf[_0x38305f['name']]={'$like':'%'+_0x477b4c[_0xacf2('0x3a')][_0xacf2('0x44')]+'%'};return _0x18ecdf;}})});}_0x2dc9aa=_[_0xacf2('0x46')]({},_0x2dc9aa,_0x477b4c[_0xacf2('0x47')]);var _0x397044={'where':_0x2dc9aa['where']};return db[_0xacf2('0x34')][_0xacf2('0x24')](_0x397044)['then'](function(_0x340a2f){_0x302b2e[_0xacf2('0x24')]=_0x340a2f;if(_0x477b4c[_0xacf2('0x3a')][_0xacf2('0x48')]){_0x2dc9aa[_0xacf2('0x49')]=[{'all':!![]}];}return db[_0xacf2('0x34')]['findAll'](_0x2dc9aa);})[_0xacf2('0x2b')](function(_0x50d8e3){_0x302b2e[_0xacf2('0x4a')]=_0x50d8e3;return _0x302b2e;})[_0xacf2('0x2b')](respondWithFilteredResult(_0x3fd90b,_0x2dc9aa))[_0xacf2('0x4b')](handleError(_0x3fd90b,null));};exports[_0xacf2('0x4c')]=function(_0x13d816,_0x1bb4f4){var _0x5852e4={'raw':!![],'where':{'id':_0x13d816['params']['id']}},_0x2be6be={};_0x2be6be[_0xacf2('0x38')]=_[_0xacf2('0x39')](db[_0xacf2('0x34')][_0xacf2('0x35')]);_0x2be6be[_0xacf2('0x3a')]=_[_0xacf2('0x39')](_0x13d816[_0xacf2('0x3a')]);_0x2be6be[_0xacf2('0x42')]=_[_0xacf2('0x4d')](_0x2be6be[_0xacf2('0x38')],_0x2be6be[_0xacf2('0x3a')]);_0x5852e4[_0xacf2('0x3c')]=_[_0xacf2('0x4d')](_0x2be6be[_0xacf2('0x38')],qs[_0xacf2('0x3b')](_0x13d816[_0xacf2('0x3a')][_0xacf2('0x3b')]));_0x5852e4[_0xacf2('0x3c')]=_0x5852e4['attributes']['length']?_0x5852e4[_0xacf2('0x3c')]:_0x2be6be[_0xacf2('0x38')];if(_0x13d816[_0xacf2('0x3a')][_0xacf2('0x48')]){_0x5852e4[_0xacf2('0x49')]=[{'all':!![]}];}_0x5852e4=_[_0xacf2('0x46')]({},_0x5852e4,_0x13d816[_0xacf2('0x47')]);return db['Plugin'][_0xacf2('0x4e')](_0x5852e4)[_0xacf2('0x2b')](handleEntityNotFound(_0x1bb4f4,null))[_0xacf2('0x2b')](respondWithResult(_0x1bb4f4,null))[_0xacf2('0x4b')](handleError(_0x1bb4f4,null));};exports[_0xacf2('0x4f')]=function(_0x2aa8c5,_0x47098f,_0x551337){return db[_0xacf2('0x34')][_0xacf2('0x4e')]({'where':{'id':_0x2aa8c5[_0xacf2('0x50')]['id']},'attributes':[_0xacf2('0x31'),'path'],'raw':!![]})[_0xacf2('0x2b')](handleEntityNotFound(_0x47098f,null))['then'](function(_0x18237f){if(_0x18237f){var _0x257f51=path[_0xacf2('0x51')](config[_0xacf2('0x52')],_0xacf2('0x53'),util[_0xacf2('0x54')]('%s.zip',path[_0xacf2('0x55')](_0x18237f[_0xacf2('0x8')])));var _0x3e3476=fs[_0xacf2('0x56')](_0x257f51);var _0x58d583=archiver(_0xacf2('0x57'),{'zlib':{'level':0x9}});_0x58d583['on'](_0xacf2('0x58'),function(_0x5543a3){if(_0x5543a3[_0xacf2('0x59')]===_0xacf2('0x5a')){logger[_0xacf2('0x30')](_0x5543a3);}else{throw new db[(_0xacf2('0x5b'))][(_0xacf2('0x5c'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x58d583['on'](_0xacf2('0x30'),function(_0xeff567){throw new db[(_0xacf2('0x5b'))][(_0xacf2('0x5c'))](_0xacf2('0x5d'));});_0x58d583[_0xacf2('0x5e')](_0x3e3476);_0x58d583[_0xacf2('0x5f')](_0xacf2('0x60'),{'cwd':path[_0xacf2('0x51')](config[_0xacf2('0x52')],_0xacf2('0x53'),path[_0xacf2('0x61')](_0x18237f[_0xacf2('0x8')])),'ignore':[path[_0xacf2('0x51')](path[_0xacf2('0x55')](_0x18237f[_0xacf2('0x8')]),_0xacf2('0x62')),path[_0xacf2('0x51')](path[_0xacf2('0x55')](_0x18237f[_0xacf2('0x8')]),_0xacf2('0x63'))],'nodir':!![]})[_0xacf2('0x64')]();_0x3e3476['on']('close',function(){if(!fs[_0xacf2('0x65')](_0x257f51)){throw new db[(_0xacf2('0x5b'))]['Error'](_0xacf2('0x66'));}return _0x47098f[_0xacf2('0x4f')](_0x257f51,util['format'](_0xacf2('0x67'),path['basename'](_0x18237f[_0xacf2('0x8')])),function(_0x4f7556){if(_0x4f7556){throw new db[(_0xacf2('0x5b'))][(_0xacf2('0x5c'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xacf2('0x68')](_0x257f51);logger[_0xacf2('0x69')]('Download\x20completed');logger['info'](_0xacf2('0x6a'));});});}return null;})[_0xacf2('0x4b')](handleError(_0x47098f,null));};exports[_0xacf2('0x6b')]=function(_0x69990f,_0x164732,_0x42e4ee){var _0x121b95=path[_0xacf2('0x55')](_0x69990f[_0xacf2('0x6c')]['filename'],path[_0xacf2('0x6d')](_0x69990f['file'][_0xacf2('0x6e')]));var _0x1a8bd2=path[_0xacf2('0x51')](config[_0xacf2('0x52')],_0xacf2('0x53'),_0x69990f[_0xacf2('0x6c')][_0xacf2('0x6e')]);var _0x43afe7=path[_0xacf2('0x51')](config['root'],'server/files/plugins',_0x121b95);logger[_0xacf2('0x69')](_0xacf2('0x6f'),_0x1a8bd2);logger[_0xacf2('0x69')](_0xacf2('0x70'),_0x43afe7);try{fs['chmodSync'](_0x1a8bd2,parseInt(_0xacf2('0x71'),0x8));extract(_0x1a8bd2,{'dir':_0x43afe7},function(_0x255d72){if(_0x255d72){logger[_0xacf2('0x30')](_0x255d72);handleError(_0x255d72,!![]);};var _0x3b1d00=fs[_0xacf2('0x72')](_0x43afe7);if(_0x3b1d00[_0xacf2('0x3d')]>0x1){removeReferences(_0x1a8bd2,_0x43afe7);logger['error'](_0xacf2('0x73'));return _0x42e4ee(new Error(_0xacf2('0x73')));}var _0x19b956=fs['lstatSync'](path['join'](_0x43afe7,_0x3b1d00[0x0]));if(_0x19b956[_0xacf2('0x74')]()){removeReferences(_0x1a8bd2,_0x43afe7);logger[_0xacf2('0x30')](_0xacf2('0x73'));return _0x42e4ee(new Error('Invalid\x20plugin\x20structure'));}if(_0x19b956['isDirectory']()){var _0x19a7d4=fs[_0xacf2('0x72')](path[_0xacf2('0x51')](_0x43afe7,_0x3b1d00[0x0]));if(_0x19a7d4[_0xacf2('0x3d')]===0x0){removeReferences(_0x1a8bd2,_0x43afe7);logger[_0xacf2('0x30')]('Invalid\x20plugin\x20structure');return _0x42e4ee(new Error(_0xacf2('0x73')));}var _0x35d86c=_0x19a7d4[_0xacf2('0x75')](function(_0x1837cf){return _0x1837cf==='manifest.json';});if(!_0x35d86c){return _0x42e4ee(new Error(_0xacf2('0x76')));}var _0x409830=fs[_0xacf2('0x77')](path[_0xacf2('0x51')](_0x43afe7,_0x3b1d00[0x0],_0xacf2('0x78')));var _0x4f63bd=JSON[_0xacf2('0x79')](_0x409830);if(_0xacf2('0x23')==typeof _0x4f63bd[_0xacf2('0x31')]){return _0x42e4ee(new Error(_0xacf2('0x7a')));}if(_0xacf2('0x23')==typeof _0x4f63bd['type']){return _0x42e4ee(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xacf2('0x23')==typeof _0x4f63bd['version']){return _0x42e4ee(new Error(_0xacf2('0x7b')));}if(_0xacf2('0x23')==typeof _0x4f63bd['parameters']){return _0x42e4ee(new Error(_0xacf2('0x7c')));}if(_0x4f63bd[_0xacf2('0x45')]===_0xacf2('0x7d')){if(_0xacf2('0x23')==typeof _0x4f63bd[_0xacf2('0x7e')][_0xacf2('0x7f')]){return _0x42e4ee(new Error(_0xacf2('0x80')));}if('undefined'==typeof _0x4f63bd[_0xacf2('0x7e')]['views']['admin']&&_0xacf2('0x23')==typeof _0x4f63bd[_0xacf2('0x7e')][_0xacf2('0x7f')][_0xacf2('0x81')]){return _0x42e4ee(new Error(_0xacf2('0x82')));}}else if(_0x4f63bd[_0xacf2('0x45')]===_0xacf2('0x83')){if(_0xacf2('0x23')==typeof _0x4f63bd[_0xacf2('0x7e')]['scriptName']){return _0x42e4ee(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0x4f63bd[_0xacf2('0x7e')]['scriptPath']){return _0x42e4ee(new Error(_0xacf2('0x84')));}}else{return _0x42e4ee(new Error(_0xacf2('0x85')));}var _0x578da1=_0x4f63bd[_0xacf2('0x31')];var _0x1ded58=_0x4f63bd[_0xacf2('0x86')];var _0x401a23=_0x4f63bd[_0xacf2('0x45')];var _0x271591=_0x4f63bd['sidebar']?_0x4f63bd[_0xacf2('0x87')]:_0xacf2('0x88');var _0x26c522=_0x4f63bd[_0xacf2('0x89')]?_0x4f63bd['icon']:_0xacf2('0x8a');var _0x1792ee='';var _0x4ec64f='';var _0x3b0fdf='';var _0x59352d='';var _0x4f3cac=_0x4f63bd[_0xacf2('0x8b')];if(_0x401a23==='html'){if(_0xacf2('0x23')!=typeof _0x4f63bd[_0xacf2('0x7e')][_0xacf2('0x7f')]['admin']){var _0x1ebab0=_0x4f63bd[_0xacf2('0x7e')][_0xacf2('0x7f')][_0xacf2('0x8c')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1ebab0)){_0x1792ee=path[_0xacf2('0x51')](_0xacf2('0x8d'),_0x121b95,_0x3b1d00[0x0],_0x1ebab0);}else{_0x1792ee=_0x1ebab0;}}else{logger['info'](_0xacf2('0x8e'));}if(_0xacf2('0x23')!=typeof _0x4f63bd[_0xacf2('0x7e')][_0xacf2('0x7f')]['agent']){var _0x54cbd2=_0x4f63bd[_0xacf2('0x7e')][_0xacf2('0x7f')][_0xacf2('0x81')];if(!/^(f|ht)tps?:\/\//i[_0xacf2('0x8f')](_0x54cbd2)){_0x4ec64f=path[_0xacf2('0x51')]('plugins',_0x121b95,_0x3b1d00[0x0],_0x54cbd2);}else{_0x4ec64f=_0x54cbd2;}}else{logger['info'](_0xacf2('0x90'));}}else if(_0x401a23===_0xacf2('0x83')){_0x3b0fdf=_0x4f63bd[_0xacf2('0x7e')][_0xacf2('0x91')];_0x59352d=_0x4f63bd[_0xacf2('0x7e')]['scriptPath'];if(_0xacf2('0x23')!=typeof _0x4f63bd[_0xacf2('0x7e')][_0xacf2('0x7f')]){if(_0xacf2('0x23')!=typeof _0x4f63bd[_0xacf2('0x7e')][_0xacf2('0x7f')][_0xacf2('0x8c')]){var _0x1ebab0=_0x4f63bd[_0xacf2('0x7e')][_0xacf2('0x7f')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xacf2('0x8f')](_0x1ebab0)){_0x1792ee=path[_0xacf2('0x51')](_0xacf2('0x8d'),_0x121b95,_0x3b1d00[0x0],_0x1ebab0);}else{_0x1792ee=_0x1ebab0;}}if(_0xacf2('0x23')!=typeof _0x4f63bd[_0xacf2('0x7e')]['views'][_0xacf2('0x81')]){var _0x54cbd2=_0x4f63bd['parameters']['views'][_0xacf2('0x81')];if(!/^(f|ht)tps?:\/\//i['test'](_0x54cbd2)){_0x4ec64f=path[_0xacf2('0x51')]('plugins',_0x121b95,_0x3b1d00[0x0],_0x54cbd2);}else{_0x4ec64f=_0x54cbd2;}}}}var _0x44bdf9={'name':_0x578da1,'description':_0x1ded58,'path':path['join'](_0x121b95,_0x3b1d00[0x0]),'type':_0x401a23,'sidebar':_0x271591,'icon':_0x26c522,'adminUrl':_0x1792ee,'agentUrl':_0x4ec64f,'scriptName':_0x3b0fdf,'scriptPath':_0x59352d,'version':_0x4f3cac};removeReferences(_0x1a8bd2,null);return db[_0xacf2('0x34')][_0xacf2('0x92')](_0x44bdf9)[_0xacf2('0x2b')](function(_0x4d2a62){var _0xac10e9={'role':_0x69990f['body'][_0xacf2('0x93')],'userProfileId':_0x69990f[_0xacf2('0x94')][_0xacf2('0x95')]};if(!_0xac10e9)throw new Error(_0xacf2('0x96'));if(_0xac10e9[_0xacf2('0x93')]==='user'){var _0x42036e=_0x4d2a62[_0xacf2('0x2c')]({'plain':!![]});return db[_0xacf2('0x97')][_0xacf2('0x4e')]({'where':{'name':_0xacf2('0x2d'),'userProfileId':_0xac10e9[_0xacf2('0x95')]},'raw':!![]})[_0xacf2('0x2b')](function(_0x467d0b){if(_0x467d0b&&_0x467d0b[_0xacf2('0x98')]===0x0){return db[_0xacf2('0x2e')][_0xacf2('0x92')]({'name':_0x42036e[_0xacf2('0x31')],'resourceId':_0x42036e['id'],'type':_0x467d0b[_0xacf2('0x31')],'sectionId':_0x467d0b['id']},{})[_0xacf2('0x2b')](function(){return _0x4d2a62;});}else{return _0x4d2a62;}})[_0xacf2('0x4b')](function(_0x113af2){logger['error'](_0xacf2('0x99'),_0x113af2);throw _0x113af2;});}return _0x4d2a62;})[_0xacf2('0x2b')](respondWithResult(_0x164732,null))[_0xacf2('0x4b')](handleError(_0x164732,null));}});}catch(_0x163db2){_0x164732[_0xacf2('0x1f')](0x1f4)[_0xacf2('0x32')](_0x163db2);}};function removeReferences(_0x440068,_0x194f2c){try{if(_0x440068){fs['unlinkSync'](_0x440068);logger[_0xacf2('0x69')](_0xacf2('0x9a'));}if(_0x194f2c){rimraf(_0x194f2c,function(){});logger['info'](_0xacf2('0x9b'));}}catch(_0x447612){logger[_0xacf2('0x30')](_0x447612);}}exports[_0xacf2('0x29')]=function(_0x20ca56,_0x5cf9f2,_0x3e5219){return db['Plugin'][_0xacf2('0x4e')]({'where':{'id':_0x20ca56[_0xacf2('0x50')]['id']}})['then'](handleEntityNotFound(_0x5cf9f2,null))[_0xacf2('0x2b')](saveUpdates(_0x20ca56[_0xacf2('0x94')],null))[_0xacf2('0x2b')](respondWithResult(_0x5cf9f2,null))[_0xacf2('0x4b')](handleError(_0x5cf9f2,null));};exports[_0xacf2('0x9c')]=function(_0x2e1d35,_0x11623f,_0x54331e){return db[_0xacf2('0x34')][_0xacf2('0x4e')]({'where':{'id':_0x2e1d35[_0xacf2('0x50')]['id']}})[_0xacf2('0x2b')](function(_0x3c8e8a){if(_0x3c8e8a){return _0x3c8e8a[_0xacf2('0x2a')]();}})[_0xacf2('0x2b')](function(_0x59faf5){rimraf(path[_0xacf2('0x51')](config[_0xacf2('0x52')],_0xacf2('0x53'),path['dirname'](_0x59faf5[_0xacf2('0x8')])),function(){});return _0x59faf5;})[_0xacf2('0x2b')](handleEntityNotFound(_0x11623f,null))[_0xacf2('0x2b')](respondWithStatusCode(_0x11623f,null))[_0xacf2('0x4b')](handleError(_0x11623f,null));};exports['webhookGet']=function(_0xc7a59a,_0x58fb6a,_0x10cfb7){return BPromise['resolve']()[_0xacf2('0x2b')](function(){if(!_0xc7a59a[_0xacf2('0x3a')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0xc7a59a[_0xacf2('0x3a')][_0xacf2('0x9d')]){throw new Error(_0xacf2('0x9e'));}var _0x206bdf=_0xc7a59a[_0xacf2('0x3a')][_0xacf2('0x9f')]?_0xc7a59a[_0xacf2('0x3a')][_0xacf2('0x9f')]+':'+_0xc7a59a['query'][_0xacf2('0x9d')]:_0xacf2('0xa0')+_0xc7a59a[_0xacf2('0x3a')][_0xacf2('0x9d')];var _0x510079=_0xc7a59a[_0xacf2('0x3a')]['json']?_0xc7a59a['query']['json']:!![];var _0xbd7779=_0xc7a59a[_0xacf2('0x3a')][_0xacf2('0xa1')]?_0xc7a59a['query'][_0xacf2('0xa1')]:null;var _0x300112={'method':_0xc7a59a[_0xacf2('0xa2')],'uri':util[_0xacf2('0x54')](_0xacf2('0xa3'),_0x206bdf,_0xc7a59a[_0xacf2('0x3a')]['path']),'json':_0x510079,'resolveWithFullResponse':!![],'encoding':_0xbd7779,'qs':_0xc7a59a[_0xacf2('0x3a')]};if(_0xc7a59a[_0xacf2('0xa4')]){_0x300112[_0xacf2('0xa4')]=_0xc7a59a[_0xacf2('0xa4')];if(_0x300112[_0xacf2('0xa4')]['content-length']){delete _0x300112[_0xacf2('0xa4')][_0xacf2('0xa5')];}}if(_0x300112[_0xacf2('0xa4')][_0xacf2('0xa6')]){delete _0x300112[_0xacf2('0xa4')][_0xacf2('0xa6')];}return rp(_0x300112);})[_0xacf2('0x2b')](function(_0x2b95fe){if(_0x2b95fe){_0x58fb6a[_0xacf2('0x25')](_0x2b95fe[_0xacf2('0xa4')]);logger[_0xacf2('0x69')](_0x2b95fe[_0xacf2('0x94')]);if(_[_0xacf2('0xa7')](_0xc7a59a[_0xacf2('0x3a')]['path'],_0xacf2('0x4f'))&&_0x2b95fe[_0xacf2('0xa8')]==0x1f4){return _0x58fb6a['sendStatus'](_0x2b95fe[_0xacf2('0xa8')]);}else{return _0x58fb6a[_0xacf2('0x1f')](_0x2b95fe['statusCode'])['send'](_0x2b95fe[_0xacf2('0x94')]);}}else{return _0x58fb6a[_0xacf2('0x2f')](0xc8);}})[_0xacf2('0x4b')](handleError(_0x58fb6a,null));};exports[_0xacf2('0xa9')]=function(_0x1a224b,_0x11dec4,_0x40eb46){return BPromise[_0xacf2('0xaa')]()[_0xacf2('0x2b')](function(){if(!_0x1a224b['query'][_0xacf2('0x8')]){throw new Error(_0xacf2('0xab'));}if(!_0x1a224b[_0xacf2('0x3a')]['port']){throw new Error(_0xacf2('0x9e'));}var _0x2b633e=_0x1a224b[_0xacf2('0x3a')][_0xacf2('0x9f')]?_0x1a224b[_0xacf2('0x3a')][_0xacf2('0x9f')]+':'+_0x1a224b['query']['port']:_0xacf2('0xa0')+_0x1a224b[_0xacf2('0x3a')][_0xacf2('0x9d')];var _0x3144b3=_0x1a224b[_0xacf2('0x3a')][_0xacf2('0x20')]?_0x1a224b[_0xacf2('0x3a')]['json']:!![];var _0x244343=_0x1a224b['query']['encoding']?_0x1a224b[_0xacf2('0x3a')]['encoding']:null;var _0xedb93e={'method':_0x1a224b['method'],'uri':util[_0xacf2('0x54')]('%s%s',_0x2b633e,_0x1a224b[_0xacf2('0x3a')]['path']),'json':_0x3144b3,'resolveWithFullResponse':!![],'encoding':_0x244343,'body':_0x1a224b[_0xacf2('0x94')]};if(_0x1a224b[_0xacf2('0xa4')]){_0xedb93e[_0xacf2('0xa4')]=_0x1a224b[_0xacf2('0xa4')];if(_0xedb93e[_0xacf2('0xa4')][_0xacf2('0xa5')]){delete _0xedb93e[_0xacf2('0xa4')][_0xacf2('0xa5')];}}if(_0xedb93e[_0xacf2('0xa4')][_0xacf2('0xa6')]){delete _0xedb93e[_0xacf2('0xa4')][_0xacf2('0xa6')];}return rp(_0xedb93e);})['then'](function(_0x255aa2){if(_0x255aa2){_0x11dec4['set'](_0x255aa2['headers']);logger['info'](_0x255aa2[_0xacf2('0x94')]);return _0x11dec4[_0xacf2('0x1f')](_0x255aa2['statusCode'])[_0xacf2('0x32')](_0x255aa2[_0xacf2('0x94')]);}else{return _0x11dec4[_0xacf2('0x2f')](0xc8);}})['catch'](handleError(_0x11dec4,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index ecf7ef5..166a470 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 _0x0024=['../../mysqldb','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x577b68,_0x5de18b){var _0x48fbfa=function(_0x5ee2fa){while(--_0x5ee2fa){_0x577b68['push'](_0x577b68['shift']());}};_0x48fbfa(++_0x5de18b);}(_0x0024,0xa8));var _0x4002=function(_0x3f3c56,_0x568017){_0x3f3c56=_0x3f3c56-0x0;var _0x4810a1=_0x0024[_0x3f3c56];return _0x4810a1;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x4002('0x0'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x4002('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4002('0x2'),'afterDestroy':'remove'};function emitEvent(_0x4f3b32){return function(_0x423907,_0x1190e7,_0x5ca2fe){PluginEvents['emit'](_0x4f3b32+':'+_0x423907['id'],_0x423907);PluginEvents[_0x4002('0x3')](_0x4f3b32,_0x423907);_0x5ca2fe(null);};}for(var e in events){if(events[_0x4002('0x4')](e)){var event=events[e];Plugin[_0x4002('0x5')](e,emitEvent(event));}}module[_0x4002('0x6')]=PluginEvents; \ No newline at end of file +var _0xdd68=['setMaxListeners','save','update','emit','hasOwnProperty','exports','events','Plugin'];(function(_0x19bd96,_0xdd0e6){var _0x2b5b25=function(_0x4342fb){while(--_0x4342fb){_0x19bd96['push'](_0x19bd96['shift']());}};_0x2b5b25(++_0xdd0e6);}(_0xdd68,0x196));var _0x8dd6=function(_0x3b2369,_0x4c68b9){_0x3b2369=_0x3b2369-0x0;var _0x5a1367=_0xdd68[_0x3b2369];return _0x5a1367;};'use strict';var EventEmitter=require(_0x8dd6('0x0'));var Plugin=require('../../mysqldb')['db'][_0x8dd6('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x8dd6('0x2')](0x0);var events={'afterCreate':_0x8dd6('0x3'),'afterUpdate':_0x8dd6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x37b71c){return function(_0x469e0c,_0x5c7c72,_0x310895){PluginEvents[_0x8dd6('0x5')](_0x37b71c+':'+_0x469e0c['id'],_0x469e0c);PluginEvents['emit'](_0x37b71c,_0x469e0c);_0x310895(null);};}for(var e in events){if(events[_0x8dd6('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x8dd6('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 7f10b6b..6bb8937 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 _0x7e95=['Plugin','plugins','lodash','util','../../config/logger','api','moment','path','../../config/environment','./plugin.attributes','exports','define'];(function(_0x3be7ff,_0x12e714){var _0x186721=function(_0x2bc9e1){while(--_0x2bc9e1){_0x3be7ff['push'](_0x3be7ff['shift']());}};_0x186721(++_0x12e714);}(_0x7e95,0x1d6));var _0x57e9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7e95[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x57e9('0x0'));var util=require(_0x57e9('0x1'));var logger=require(_0x57e9('0x2'))(_0x57e9('0x3'));var moment=require(_0x57e9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x57e9('0x5'));var rimraf=require('rimraf');var config=require(_0x57e9('0x6'));var attributes=require(_0x57e9('0x7'));module[_0x57e9('0x8')]=function(_0x438a70,_0x5958a3){return _0x438a70[_0x57e9('0x9')](_0x57e9('0xa'),attributes,{'tableName':_0x57e9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9f0=['util','api','moment','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','define','plugins','lodash'];(function(_0x463683,_0x403c60){var _0x1c7fa1=function(_0x224c11){while(--_0x224c11){_0x463683['push'](_0x463683['shift']());}};_0x1c7fa1(++_0x403c60);}(_0xb9f0,0x1df));var _0x0b9f=function(_0x34d6bd,_0x55b744){_0x34d6bd=_0x34d6bd-0x0;var _0x248396=_0xb9f0[_0x34d6bd];return _0x248396;};'use strict';var _=require(_0x0b9f('0x0'));var util=require(_0x0b9f('0x1'));var logger=require('../../config/logger')(_0x0b9f('0x2'));var moment=require(_0x0b9f('0x3'));var BPromise=require('bluebird');var rp=require(_0x0b9f('0x4'));var fs=require('fs');var path=require(_0x0b9f('0x5'));var rimraf=require(_0x0b9f('0x6'));var config=require(_0x0b9f('0x7'));var attributes=require(_0x0b9f('0x8'));module[_0x0b9f('0x9')]=function(_0x73bb6f,_0x5d4f9b){return _0x73bb6f[_0x0b9f('0xa')]('Plugin',attributes,{'tableName':_0x0b9f('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 9f6ff74..df01151 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 _0x9994=['jayson/promise','client','redis','localhost','./plugin.socket','register','request','then','info','request\x20sent','debug','error','code','message','Plugin,\x20%s,\x20%s','result','catch','CreatePlugin','Plugin','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9994,0x77));var _0x4999=function(_0x4a6979,_0x5f3d1a){_0x4a6979=_0x4a6979-0x0;var _0x226f93=_0x9994[_0x4a6979];return _0x226f93;};'use strict';var _=require(_0x4999('0x0'));var util=require(_0x4999('0x1'));var moment=require(_0x4999('0x2'));var BPromise=require(_0x4999('0x3'));var rs=require(_0x4999('0x4'));var fs=require('fs');var Redis=require(_0x4999('0x5'));var db=require(_0x4999('0x6'))['db'];var utils=require(_0x4999('0x7'));var logger=require(_0x4999('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4999('0x9'));var client=jayson[_0x4999('0xa')]['http']({'port':0x232a});config[_0x4999('0xb')]=_['defaults'](config[_0x4999('0xb')],{'host':_0x4999('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4999('0xb')]));require(_0x4999('0xd'))[_0x4999('0xe')](socket);function respondWithRpcPromise(_0x521c32,_0xc589ac,_0x12c637){return new BPromise(function(_0x2f521e,_0x43ff05){return client[_0x4999('0xf')](_0x521c32,_0x12c637)[_0x4999('0x10')](function(_0xc1388f){logger[_0x4999('0x11')]('Plugin,\x20%s,\x20%s',_0xc589ac,_0x4999('0x12'));logger[_0x4999('0x13')]('Plugin,\x20%s,\x20%s,\x20%s',_0xc589ac,_0x4999('0x12'),JSON['stringify'](_0xc1388f));if(_0xc1388f[_0x4999('0x14')]){if(_0xc1388f[_0x4999('0x14')][_0x4999('0x15')]===0x1f4){logger['error']('Plugin,\x20%s,\x20%s',_0xc589ac,_0xc1388f[_0x4999('0x14')][_0x4999('0x16')]);return _0x43ff05(_0xc1388f['error'][_0x4999('0x16')]);}logger['error'](_0x4999('0x17'),_0xc589ac,_0xc1388f[_0x4999('0x14')][_0x4999('0x16')]);return _0x2f521e(_0xc1388f[_0x4999('0x14')]['message']);}else{logger[_0x4999('0x11')](_0x4999('0x17'),_0xc589ac,_0x4999('0x12'));_0x2f521e(_0xc1388f[_0x4999('0x18')][_0x4999('0x16')]);}})[_0x4999('0x19')](function(_0x4e40dc){logger[_0x4999('0x14')](_0x4999('0x17'),_0xc589ac,_0x4e40dc);_0x43ff05(_0x4e40dc);});});}exports[_0x4999('0x1a')]=function(_0x1ca31d){var _0xd4cebe=this;return new Promise(function(_0x216983,_0x57cd8a){return db[_0x4999('0x1b')][_0x4999('0x1c')](_0x1ca31d[_0x4999('0x1d')],{'raw':_0x1ca31d[_0x4999('0x1e')]?_0x1ca31d['options'][_0x4999('0x1f')]===undefined?!![]:![]:!![]})[_0x4999('0x10')](function(_0x5ae6d3){logger['info'](_0x4999('0x1a'),_0x1ca31d);logger[_0x4999('0x13')](_0x4999('0x1a'),_0x1ca31d,JSON['stringify'](_0x5ae6d3));_0x216983(_0x5ae6d3);})['catch'](function(_0x51c59f){logger['error'](_0x4999('0x1a'),_0x51c59f[_0x4999('0x16')],_0x1ca31d);_0x57cd8a(_0xd4cebe[_0x4999('0x14')](0x1f4,_0x51c59f[_0x4999('0x16')]));});});}; \ No newline at end of file +var _0x7a97=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','then','moment','randomstring'];(function(_0x37914d,_0x4209c0){var _0x2b4118=function(_0x10de2){while(--_0x10de2){_0x37914d['push'](_0x37914d['shift']());}};_0x2b4118(++_0x4209c0);}(_0x7a97,0x9e));var _0x77a9=function(_0x2d1284,_0x12d78a){_0x2d1284=_0x2d1284-0x0;var _0x552b69=_0x7a97[_0x2d1284];return _0x552b69;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x77a9('0x0'));var BPromise=require('bluebird');var rs=require(_0x77a9('0x1'));var fs=require('fs');var Redis=require(_0x77a9('0x2'));var db=require(_0x77a9('0x3'))['db'];var utils=require(_0x77a9('0x4'));var logger=require(_0x77a9('0x5'))(_0x77a9('0x6'));var config=require(_0x77a9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x77a9('0x8')]['http']({'port':0x232a});config[_0x77a9('0x9')]=_['defaults'](config[_0x77a9('0x9')],{'host':_0x77a9('0xa'),'port':0x18eb});var socket=require(_0x77a9('0xb'))(new Redis(config['redis']));require(_0x77a9('0xc'))[_0x77a9('0xd')](socket);function respondWithRpcPromise(_0x13674d,_0x570ba4,_0x5d1dff){return new BPromise(function(_0x1ad625,_0x13f49e){return client[_0x77a9('0xe')](_0x13674d,_0x5d1dff)['then'](function(_0x2f2246){logger[_0x77a9('0xf')](_0x77a9('0x10'),_0x570ba4,_0x77a9('0x11'));logger[_0x77a9('0x12')](_0x77a9('0x13'),_0x570ba4,_0x77a9('0x11'),JSON['stringify'](_0x2f2246));if(_0x2f2246[_0x77a9('0x14')]){if(_0x2f2246[_0x77a9('0x14')][_0x77a9('0x15')]===0x1f4){logger[_0x77a9('0x14')](_0x77a9('0x10'),_0x570ba4,_0x2f2246[_0x77a9('0x14')][_0x77a9('0x16')]);return _0x13f49e(_0x2f2246[_0x77a9('0x14')]['message']);}logger['error'](_0x77a9('0x10'),_0x570ba4,_0x2f2246[_0x77a9('0x14')][_0x77a9('0x16')]);return _0x1ad625(_0x2f2246['error'][_0x77a9('0x16')]);}else{logger[_0x77a9('0xf')](_0x77a9('0x10'),_0x570ba4,'request\x20sent');_0x1ad625(_0x2f2246[_0x77a9('0x17')][_0x77a9('0x16')]);}})[_0x77a9('0x18')](function(_0x41a12c){logger[_0x77a9('0x14')](_0x77a9('0x10'),_0x570ba4,_0x41a12c);_0x13f49e(_0x41a12c);});});}exports[_0x77a9('0x19')]=function(_0x5eef23){var _0x35edc0=this;return new Promise(function(_0x2ba22d,_0x39107f){return db[_0x77a9('0x1a')][_0x77a9('0x1b')](_0x5eef23[_0x77a9('0x1c')],{'raw':_0x5eef23['options']?_0x5eef23[_0x77a9('0x1d')][_0x77a9('0x1e')]===undefined?!![]:![]:!![]})[_0x77a9('0x1f')](function(_0x1ef734){logger[_0x77a9('0xf')](_0x77a9('0x19'),_0x5eef23);logger[_0x77a9('0x12')]('CreatePlugin',_0x5eef23,JSON['stringify'](_0x1ef734));_0x2ba22d(_0x1ef734);})[_0x77a9('0x18')](function(_0x2d195e){logger[_0x77a9('0x14')](_0x77a9('0x19'),_0x2d195e[_0x77a9('0x16')],_0x5eef23);_0x39107f(_0x35edc0['error'](0x1f4,_0x2d195e[_0x77a9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index aca202a..0c970a9 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 _0xb0c5=['remove','update','emit','length','plugin:','./plugin.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb0c5,0x140));var _0x5b0c=function(_0x4965ca,_0x331e73){_0x4965ca=_0x4965ca-0x0;var _0x47ca8a=_0xb0c5[_0x4965ca];return _0x47ca8a;};'use strict';var PluginEvents=require(_0x5b0c('0x0'));var events=[_0x5b0c('0x1'),_0x5b0c('0x2'),_0x5b0c('0x3')];function createListener(_0x5dae1f,_0x50551e){return function(_0x3203ee){_0x50551e[_0x5b0c('0x4')](_0x5dae1f,_0x3203ee);};}function removeListener(_0x54e290,_0xdde472){return function(){PluginEvents['removeListener'](_0x54e290,_0xdde472);};}exports['register']=function(_0x91d10d){for(var _0x227cdb=0x0,_0x2a2354=events[_0x5b0c('0x5')];_0x227cdb<_0x2a2354;_0x227cdb++){var _0x2f1436=events[_0x227cdb];var _0x1b1bde=createListener(_0x5b0c('0x6')+_0x2f1436,_0x91d10d);PluginEvents['on'](_0x2f1436,_0x1b1bde);}}; \ No newline at end of file +var _0xc74d=['remove','update','emit','removeListener','register','plugin:','./plugin.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc74d,0x126));var _0xdc74=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xc74d[_0x178e48];return _0x440d7e;};'use strict';var PluginEvents=require(_0xdc74('0x0'));var events=[_0xdc74('0x1'),_0xdc74('0x2'),_0xdc74('0x3')];function createListener(_0x12581b,_0x1af138){return function(_0x3fa5c9){_0x1af138[_0xdc74('0x4')](_0x12581b,_0x3fa5c9);};}function removeListener(_0x2c91af,_0x4c6b9e){return function(){PluginEvents[_0xdc74('0x5')](_0x2c91af,_0x4c6b9e);};}exports[_0xdc74('0x6')]=function(_0x451331){for(var _0xe81b23=0x0,_0x194227=events['length'];_0xe81b23<_0x194227;_0xe81b23++){var _0x26a771=events[_0xe81b23];var _0x691186=createListener(_0xdc74('0x7')+_0x26a771,_0x451331);PluginEvents['on'](_0x26a771,_0x691186);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 8b97d79..d9a146c 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(_0x18a841,_0x393d43){var _0x159f0b=function(_0x2135b1){while(--_0x2135b1){_0x18a841['push'](_0x18a841['shift']());}};_0x159f0b(++_0x393d43);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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(_0xe0a43b,_0xddcb99){var _0x212ae5=function(_0x158720){while(--_0x158720){_0xe0a43b['push'](_0xe0a43b['shift']());}};_0x212ae5(++_0xddcb99);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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 1ea8d6c..f24a5b7 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 _0x7a2c=['start','dump','catch','status','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','destroy','Unknown\x20id','lodash','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','json','stack','name','send','npm\x20install','info','index','list','then','reject','express','motion2','length','show','describe','params','create','body','join','script','cwd','chdir','dirname'];(function(_0x4a49c2,_0x411669){var _0x59c9c8=function(_0x5ff4a4){while(--_0x5ff4a4){_0x4a49c2['push'](_0x4a49c2['shift']());}};_0x59c9c8(++_0x411669);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x38f044,_0x4cb991){_0x38f044=_0x38f044-0x0;var _0x2a1a8d=_0x7a2c[_0x38f044];return _0x2a1a8d;};'use strict';var _=require(_0xc7a2('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xc7a2('0x1'))(_0xc7a2('0x2'));var path=require(_0xc7a2('0x3'));var exec=require(_0xc7a2('0x4'))[_0xc7a2('0x5')];var BPromise=require(_0xc7a2('0x6'));function handleEntityNotFound(_0x3f2b0d,_0x34cd60){return function(_0x489232){if(!_0x489232){_0x3f2b0d[_0xc7a2('0x7')](0x194);;}return _0x489232;};}function respondWithResult(_0x1ddbae,_0x5f334e){_0x5f334e=_0x5f334e||0xc8;return function(_0x481430){if(_0x481430){return _0x1ddbae['status'](_0x5f334e)[_0xc7a2('0x8')](_0x481430);}return null;};}function handleError(_0x3de428,_0x3f0573){_0x3f0573=_0x3f0573||0x1f4;return function(_0x426fea){logger['error'](_0x426fea[_0xc7a2('0x9')]);if(_0x426fea[_0xc7a2('0xa')]){delete _0x426fea[_0xc7a2('0xa')];}_0x3de428['status'](_0x3f0573)[_0xc7a2('0xb')](_0x426fea);};}function execChildProcess(){return new BPromise(function(_0x4a44c7,_0x3e216a){exec(_0xc7a2('0xc'),function(_0x1a9b38,_0x540267,_0x226982){logger[_0xc7a2('0xd')](_0x540267);logger[_0xc7a2('0xd')](_0x226982);if(_0x1a9b38){logger['error'](_0x1a9b38);return _0x3e216a(_0x1a9b38);}return _0x4a44c7(_0x540267);});});}exports[_0xc7a2('0xe')]=function(_0x1b7844,_0x181f0c){return pm2[_0xc7a2('0xf')]()[_0xc7a2('0x10')](function(_0x2af363){if(_0x2af363){var _0x15d4cf=_[_0xc7a2('0x11')](_0x2af363,function(_0x275be9){return _0x275be9[_0xc7a2('0xa')]===_0xc7a2('0x12')||_0x275be9[_0xc7a2('0xa')]===_0xc7a2('0x13');});return{'rows':_0x15d4cf,'count':_0x15d4cf[_0xc7a2('0x14')]};}return null;})[_0xc7a2('0x10')](respondWithResult(_0x181f0c,null))['catch'](handleError(_0x181f0c,null));};exports[_0xc7a2('0x15')]=function(_0x59e8ad,_0x2414f4){return pm2[_0xc7a2('0x16')](_0x59e8ad[_0xc7a2('0x17')]['id'])[_0xc7a2('0x10')](respondWithResult(_0x2414f4,null))['then'](handleEntityNotFound(_0x2414f4,null))['catch'](handleError(_0x2414f4,null));};exports[_0xc7a2('0x18')]=function(_0x22e80a,_0x51cbb3){if(_0x22e80a['body']['name']&&_0x22e80a[_0xc7a2('0x19')]['script']){var _0x155c42=path[_0xc7a2('0x1a')](__dirname,'../../files/plugins',_0x22e80a[_0xc7a2('0x19')][_0xc7a2('0x1b')]);var _0x1b51a1=process[_0xc7a2('0x1c')]();process[_0xc7a2('0x1d')](path[_0xc7a2('0x1e')](_0x155c42));return execChildProcess()[_0xc7a2('0x10')](function(_0x4a05e1){process['chdir'](_0x1b51a1);return pm2[_0xc7a2('0x1f')]({'name':_0x22e80a[_0xc7a2('0x19')]['name'],'script':_0x155c42});})[_0xc7a2('0x10')](function(_0x3cad61){pm2[_0xc7a2('0x20')]();return _0x3cad61[0x0];})[_0xc7a2('0x10')](respondWithResult(_0x51cbb3,0xc9))[_0xc7a2('0x21')](handleError(_0x51cbb3,null));}else{return _0x51cbb3[_0xc7a2('0x22')](0x1f4)[_0xc7a2('0xb')]({'message':_0xc7a2('0x23')});}};exports['update']=function(_0x35a6e0,_0x505fe8){if(_0x35a6e0[_0xc7a2('0x19')]['id']){delete _0x35a6e0['body']['id'];}var _0x20404b={'online':_0xc7a2('0x24'),'stopped':_0xc7a2('0x25')};if(_0x20404b[_0xc7a2('0x26')](_0x35a6e0['body']['status'])){return pm2[_0x20404b[_0x35a6e0[_0xc7a2('0x19')][_0xc7a2('0x22')]]](_0x35a6e0[_0xc7a2('0x17')]['id'])[_0xc7a2('0x10')](respondWithResult(_0x505fe8,0xc8))[_0xc7a2('0x21')](handleError(_0x505fe8,null));}else{return _0x505fe8[_0xc7a2('0x22')](0x1f4)[_0xc7a2('0xb')]({'message':'Unknown\x20status'});}};exports[_0xc7a2('0x27')]=function(_0x926b6c,_0x496386){if(_0x926b6c[_0xc7a2('0x19')]['id']){delete _0x926b6c[_0xc7a2('0x19')]['id'];}if(_0x926b6c[_0xc7a2('0x17')]['id']){return pm2['delete'](_0x926b6c[_0xc7a2('0x17')]['id'])['then'](function(_0x1f9bdc){pm2['dump']();return _0x1f9bdc[0x0];})['then'](respondWithResult(_0x496386,null))[_0xc7a2('0x21')](handleError(_0x496386,null));}else{return _0x496386['status'](0x1f4)['send']({'message':_0xc7a2('0x28')});}}; \ No newline at end of file +var _0xb332=['dirname','start','dump','Missing\x20name\x20and/or\x20path','restart','hasOwnProperty','Unknown\x20id','lodash','../../config/logger','api','child_process','bluebird','sendStatus','error','stack','name','status','send','npm\x20install','info','list','reject','motion2','length','then','catch','show','params','create','body','script','join','../../files/plugins','cwd','chdir'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb332,0xd9));var _0x2b33=function(_0xd13a88,_0x3c5269){_0xd13a88=_0xd13a88-0x0;var _0x1c993c=_0xb332[_0xd13a88];return _0x1c993c;};'use strict';var _=require(_0x2b33('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x2b33('0x1'))(_0x2b33('0x2'));var path=require('path');var exec=require(_0x2b33('0x3'))['exec'];var BPromise=require(_0x2b33('0x4'));function handleEntityNotFound(_0x4c6634,_0x34b111){return function(_0x5e5e86){if(!_0x5e5e86){_0x4c6634[_0x2b33('0x5')](0x194);;}return _0x5e5e86;};}function respondWithResult(_0x22d66,_0x478214){_0x478214=_0x478214||0xc8;return function(_0x461d44){if(_0x461d44){return _0x22d66['status'](_0x478214)['json'](_0x461d44);}return null;};}function handleError(_0x4302b7,_0x5f29ab){_0x5f29ab=_0x5f29ab||0x1f4;return function(_0xb3aeab){logger[_0x2b33('0x6')](_0xb3aeab[_0x2b33('0x7')]);if(_0xb3aeab[_0x2b33('0x8')]){delete _0xb3aeab['name'];}_0x4302b7[_0x2b33('0x9')](_0x5f29ab)[_0x2b33('0xa')](_0xb3aeab);};}function execChildProcess(){return new BPromise(function(_0x1be19d,_0x1d83a6){exec(_0x2b33('0xb'),function(_0xf1e5e5,_0x5251b,_0x2b106e){logger[_0x2b33('0xc')](_0x5251b);logger[_0x2b33('0xc')](_0x2b106e);if(_0xf1e5e5){logger[_0x2b33('0x6')](_0xf1e5e5);return _0x1d83a6(_0xf1e5e5);}return _0x1be19d(_0x5251b);});});}exports['index']=function(_0x183773,_0xa44d45){return pm2[_0x2b33('0xd')]()['then'](function(_0x173c75){if(_0x173c75){var _0x4d39db=_[_0x2b33('0xe')](_0x173c75,function(_0x17292f){return _0x17292f[_0x2b33('0x8')]==='express'||_0x17292f['name']===_0x2b33('0xf');});return{'rows':_0x4d39db,'count':_0x4d39db[_0x2b33('0x10')]};}return null;})[_0x2b33('0x11')](respondWithResult(_0xa44d45,null))[_0x2b33('0x12')](handleError(_0xa44d45,null));};exports[_0x2b33('0x13')]=function(_0x4d69d0,_0x554ab3){return pm2['describe'](_0x4d69d0[_0x2b33('0x14')]['id'])['then'](respondWithResult(_0x554ab3,null))['then'](handleEntityNotFound(_0x554ab3,null))[_0x2b33('0x12')](handleError(_0x554ab3,null));};exports[_0x2b33('0x15')]=function(_0x205d8f,_0x539c5f){if(_0x205d8f[_0x2b33('0x16')]['name']&&_0x205d8f[_0x2b33('0x16')][_0x2b33('0x17')]){var _0x8c8dc2=path[_0x2b33('0x18')](__dirname,_0x2b33('0x19'),_0x205d8f[_0x2b33('0x16')][_0x2b33('0x17')]);var _0x4fb725=process[_0x2b33('0x1a')]();process[_0x2b33('0x1b')](path[_0x2b33('0x1c')](_0x8c8dc2));return execChildProcess()[_0x2b33('0x11')](function(_0x58998e){process[_0x2b33('0x1b')](_0x4fb725);return pm2[_0x2b33('0x1d')]({'name':_0x205d8f[_0x2b33('0x16')]['name'],'script':_0x8c8dc2});})[_0x2b33('0x11')](function(_0x1b9a48){pm2[_0x2b33('0x1e')]();return _0x1b9a48[0x0];})[_0x2b33('0x11')](respondWithResult(_0x539c5f,0xc9))['catch'](handleError(_0x539c5f,null));}else{return _0x539c5f[_0x2b33('0x9')](0x1f4)['send']({'message':_0x2b33('0x1f')});}};exports['update']=function(_0x2e74d0,_0x341e0e){if(_0x2e74d0['body']['id']){delete _0x2e74d0[_0x2b33('0x16')]['id'];}var _0x53c2ad={'online':_0x2b33('0x20'),'stopped':'stop'};if(_0x53c2ad[_0x2b33('0x21')](_0x2e74d0[_0x2b33('0x16')][_0x2b33('0x9')])){return pm2[_0x53c2ad[_0x2e74d0[_0x2b33('0x16')][_0x2b33('0x9')]]](_0x2e74d0[_0x2b33('0x14')]['id'])[_0x2b33('0x11')](respondWithResult(_0x341e0e,0xc8))[_0x2b33('0x12')](handleError(_0x341e0e,null));}else{return _0x341e0e[_0x2b33('0x9')](0x1f4)[_0x2b33('0xa')]({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x106ea0,_0x2a081c){if(_0x106ea0[_0x2b33('0x16')]['id']){delete _0x106ea0[_0x2b33('0x16')]['id'];}if(_0x106ea0[_0x2b33('0x14')]['id']){return pm2['delete'](_0x106ea0['params']['id'])[_0x2b33('0x11')](function(_0x3d2aaa){pm2[_0x2b33('0x1e')]();return _0x3d2aaa[0x0];})[_0x2b33('0x11')](respondWithResult(_0x2a081c,null))[_0x2b33('0x12')](handleError(_0x2a081c,null));}else{return _0x2a081c[_0x2b33('0x9')](0x1f4)['send']({'message':_0x2b33('0x22')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 76b3c53..bb22f1f 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 _0x03af=['getAgents','exports','express','../../components/auth/service','get','/agents','isAuthenticated'];(function(_0x75dd04,_0xcca125){var _0x5bcc9e=function(_0x4fe5d6){while(--_0x4fe5d6){_0x75dd04['push'](_0x75dd04['shift']());}};_0x5bcc9e(++_0xcca125);}(_0x03af,0xcd));var _0xf03a=function(_0x30f8ef,_0x2b21d0){_0x30f8ef=_0x30f8ef-0x0;var _0x22bf87=_0x03af[_0x30f8ef];return _0x22bf87;};'use strict';var express=require(_0xf03a('0x0'));var router=express['Router']();var auth=require(_0xf03a('0x1'));var controller=require('./realtime.controller');router[_0xf03a('0x2')](_0xf03a('0x3'),auth[_0xf03a('0x4')](),controller[_0xf03a('0x5')]);router[_0xf03a('0x2')]('/queues',auth[_0xf03a('0x4')](),controller['getQueues']);module[_0xf03a('0x6')]=router; \ No newline at end of file +var _0x8cd2=['express','Router','./realtime.controller','get','getAgents','getQueues','exports'];(function(_0x170679,_0x20c787){var _0x5db9c0=function(_0x375a4c){while(--_0x375a4c){_0x170679['push'](_0x170679['shift']());}};_0x5db9c0(++_0x20c787);}(_0x8cd2,0x149));var _0x28cd=function(_0x49aa99,_0x4ef618){_0x49aa99=_0x49aa99-0x0;var _0x1786d7=_0x8cd2[_0x49aa99];return _0x1786d7;};'use strict';var express=require(_0x28cd('0x0'));var router=express[_0x28cd('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x28cd('0x2'));router[_0x28cd('0x3')]('/agents',auth['isAuthenticated'](),controller[_0x28cd('0x4')]);router[_0x28cd('0x3')]('/queues',auth['isAuthenticated'](),controller[_0x28cd('0x5')]);module[_0x28cd('0x6')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index fba864f..9c03ba9 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 _0xa971=['getAgentStatus','pause','Status','catch','getQueues','Queue','voice','outbound','Queues','filter','getResources','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','APIBadRequestError','offset','undefined','limit','count','status','set','Content-Range','getAgents','getChannels','globalQueueFilter','globalStatusFilter','query','*pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','sort','includes','validateSortParameter','getUpdatedSortOptions','fields','join','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','type','key','agent','online','getOptions','raw','push','literal','FIELD(id,','order','forEach','Pause','where','user','userProfileId','Agents','extraQueryConditions','UserProfile','findAndCountAll','find','filterAgentAttributes','globalStatus'];(function(_0x54de36,_0x5e621d){var _0x3f78f0=function(_0x2b7cd9){while(--_0x2b7cd9){_0x54de36['push'](_0x54de36['shift']());}};_0x3f78f0(++_0x5e621d);}(_0xa971,0x141));var _0x1a97=function(_0x3f8b74,_0x4386bd){_0x3f8b74=_0x3f8b74-0x0;var _0x182d00=_0xa971[_0x3f8b74];return _0x182d00;};'use strict';var _=require(_0x1a97('0x0'));var util=require(_0x1a97('0x1'));var rta=require(_0x1a97('0x2'));var rtq=require(_0x1a97('0x3'));var qs=require(_0x1a97('0x4'));var utils=require(_0x1a97('0x5'));var db=require(_0x1a97('0x6'))['db'];var APIBadRequestError=require('../../errors/api')[_0x1a97('0x7')];var APIHandleError=require('../../errors/api')['handleError'];function respondWithFilteredResult(_0x3e4a9c,_0x1e87d1){return function(_0x343e96){if(_0x343e96){var _0x591f7f=typeof _0x1e87d1[_0x1a97('0x8')]===_0x1a97('0x9')&&typeof _0x1e87d1[_0x1a97('0xa')]==='undefined';var _0x9089fc=_0x343e96[_0x1a97('0xb')];var _0x20656c=_0x591f7f?0x0:_0x1e87d1[_0x1a97('0x8')];var _0x205624=_0x591f7f?_0x343e96[_0x1a97('0xb')]:_0x1e87d1[_0x1a97('0x8')]+_0x1e87d1[_0x1a97('0xa')];var _0x532ed3;if(_0x205624>=_0x9089fc){_0x205624=_0x9089fc;_0x532ed3=0xc8;}else{_0x532ed3=0xce;}_0x3e4a9c[_0x1a97('0xc')](_0x532ed3);return _0x3e4a9c[_0x1a97('0xd')](_0x1a97('0xe'),_0x20656c+'-'+_0x205624+'/'+_0x9089fc)['json'](_0x343e96);}return null;};}exports[_0x1a97('0xf')]=function(_0x24f2ec,_0x7dc26a){var _0x326bad={'count':0x0,'rows':[]};var _0x31657d={};var _0x5d3d53;var _0x794f03=utils[_0x1a97('0x10')]();var _0x200c05;var _0x17b6f3;var _0x343659=_0x24f2ec['query'][_0x1a97('0x11')];var _0x59e003=_0x24f2ec['query'][_0x1a97('0x12')];var _0x343f09=_0x24f2ec[_0x1a97('0x13')]['pauseTypeFilter'];var _0x469d1c=_0x59e003==='pause'||_0x59e003===_0x1a97('0x14')?!![]:![];var _0x5db0c7=[];var _0x22ee2e;var _0x4c959c;Promise[_0x1a97('0x15')]()[_0x1a97('0x16')](function(){if(_0x24f2ec[_0x1a97('0x13')][_0x1a97('0x17')]){if(!utils[_0x1a97('0x18')](_0x24f2ec['query']['channel'])){throw new APIBadRequestError(util[_0x1a97('0x19')](_0x1a97('0x1a'),_0x24f2ec['query'][_0x1a97('0x17')]));}_0x5d3d53=_0x24f2ec[_0x1a97('0x13')][_0x1a97('0x17')]['toLowerCase']();}if(!_0x24f2ec[_0x1a97('0x13')][_0x1a97('0x1b')]||!_0x24f2ec['query'][_0x1a97('0x1b')][_0x1a97('0x1c')]('globalStatus')){_0x24f2ec['query'][_0x1a97('0x1b')]=rta[_0x1a97('0x1d')](_0x24f2ec[_0x1a97('0x13')][_0x1a97('0x1b')]);return;}var _0x5d7abb=rta[_0x1a97('0x1e')](_0x24f2ec['query'][_0x1a97('0x1b')]);_0x24f2ec[_0x1a97('0x13')][_0x1a97('0x1b')]=_0x5d7abb[_0x1a97('0x1f')][_0x1a97('0x20')](',');_0x22ee2e=_0x5d7abb['order'];})[_0x1a97('0x16')](function(){if(!_0x343659){return[];}return rta['getAgentIdsByQueues'](_0x343659,_0x5d3d53);})[_0x1a97('0x16')](function(_0x25fe38){_0x5db0c7=_0x25fe38;return rta[_0x1a97('0x21')]();})[_0x1a97('0x16')](function(_0x4db4b1){_0x17b6f3=_0x4db4b1[_0x1a97('0x22')];if((!_0x59e003||_0x469d1c)&&!_0x22ee2e){return _0x5db0c7;}if(_0x22ee2e&&!_0x59e003){return rta[_0x1a97('0x23')](_0x17b6f3,_0x5db0c7,_0x22ee2e);}else{return rta[_0x1a97('0x24')](_0x17b6f3,_0x5db0c7,_0x59e003);}})['then'](function(_0x4b0f1c){_0x5db0c7=_0x4b0f1c;var _0x1f479f=![];if(_0x5db0c7[_0x1a97('0x25')]===0x0){if(_0x343659||_0x59e003){_0x1f479f=!![];}if(_0x469d1c){_0x1f479f=![];}}if(_0x1f479f){return _0x326bad;}var _0x2f0e91=_[_0x1a97('0x26')](db[_0x1a97('0x27')][_0x1a97('0x28')],function(_0x1d327b){return{'name':_0x1d327b[_0x1a97('0x29')],'type':_0x1d327b[_0x1a97('0x2a')][_0x1a97('0x2b')]};});_0x24f2ec[_0x1a97('0x13')]['role']=_0x1a97('0x2c');_0x24f2ec[_0x1a97('0x13')][_0x1a97('0x2d')]=!![];_0x31657d=qs[_0x1a97('0x2e')](_0x2f0e91,_0x24f2ec);_0x31657d[_0x1a97('0x2f')]=!![];var _0x2b1f97=[];if(_0x5db0c7[_0x1a97('0x25')]>0x0){_0x2b1f97[_0x1a97('0x30')]({'id':{'$in':_0x5db0c7}});if(_0x22ee2e&&!_0x59e003){_0x4c959c=[db['sequelize'][_0x1a97('0x31')](_0x1a97('0x32')+_0x5db0c7+')')];_0x31657d[_0x1a97('0x33')]=_0x4c959c;}}if(_0x469d1c){_0x794f03[_0x1a97('0x34')](function(_0x55491){var _0x511f83=!![];if(_0x59e003===_0x1a97('0x14')&&_0x5d3d53!==_0x55491){_0x511f83=![];}_0x2b1f97['push']({[_0x55491+_0x1a97('0x35')]:_0x511f83});});if(_0x343f09){_0x2b1f97[_0x1a97('0x30')]({'pauseType':_0x343f09});}}else if(_0x59e003){_0x794f03['forEach'](function(_0x3b5c6b){_0x2b1f97[_0x1a97('0x30')]({[_0x3b5c6b+_0x1a97('0x35')]:![]});});}_0x31657d[_0x1a97('0x36')]=_['merge'](_0x31657d[_0x1a97('0x36')],{'$and':_0x2b1f97});if(_0x24f2ec[_0x1a97('0x37')]['role']===_0x1a97('0x37')){var _0x154719={'params':{'id':_0x24f2ec[_0x1a97('0x37')][_0x1a97('0x38')]},'query':{'section':_0x1a97('0x39'),'role':_0x1a97('0x2c'),'online':!![],'raw':!![],'ids':_0x5db0c7,'customSorting':_0x4c959c}};if(_0x469d1c){_0x154719[_0x1a97('0x13')][_0x1a97('0x3a')]=_0x2b1f97;}_0x154719[_0x1a97('0x13')]=Object['assign'](_0x154719[_0x1a97('0x13')],_0x24f2ec['query']);delete _0x154719[_0x1a97('0x13')]['id'];return db[_0x1a97('0x3b')]['getResources'](_0x154719);}return db['User'][_0x1a97('0x3c')](_0x31657d);})[_0x1a97('0x16')](function(_0x43cb54){_0x326bad[_0x1a97('0xb')]=_0x43cb54['count'];_0x200c05=_0x43cb54[_0x1a97('0x22')];return _0x200c05['map'](function(_0x4e7af8){var _0xd897ac=_[_0x1a97('0x3d')](_0x17b6f3,['id',_0x4e7af8['id']]);if(_0xd897ac){var _0x1fb194=rta[_0x1a97('0x3e')](_0xd897ac);_['merge'](_0x4e7af8,_0x1fb194);}_0x4e7af8[_0x1a97('0x3f')]=rta[_0x1a97('0x40')](_0x4e7af8);if(_0x4e7af8[_0x1a97('0x3f')][_0x1a97('0x1c')](_0x1a97('0x41'))){_0x794f03[_0x1a97('0x34')](function(_0x1afea6){if(_0x4e7af8[_0x1afea6+_0x1a97('0x35')]){_0x4e7af8[_0x1afea6+_0x1a97('0x42')]=_0x1a97('0x41');}});}return _0x4e7af8;});})[_0x1a97('0x16')](function(_0x23da34){if(!_0x22ee2e||_0x4c959c){return _0x23da34;}return rta['sortAgentsByStatus'](_0x23da34,_0x22ee2e);})[_0x1a97('0x16')](function(_0x4691de){var _0x2612fc=null;if(_0x24f2ec['query']['fields']){var _0x16e9d8=_0x24f2ec[_0x1a97('0x13')][_0x1a97('0x1f')]['split'](',');_0x2612fc=_0x4691de['map'](function(_0x1fbe3c){return _['pick'](_0x1fbe3c,_0x16e9d8);});}_0x326bad[_0x1a97('0x22')]=_0x2612fc||_0x4691de;return _0x326bad;})[_0x1a97('0x16')](respondWithFilteredResult(_0x7dc26a,_0x31657d))[_0x1a97('0x43')](APIHandleError(_0x7dc26a));};exports[_0x1a97('0x44')]=function(_0x221db4,_0x8476b2){var _0x44c9e3={'count':0x0,'rows':[]};var _0x9c9780={};var _0x5f3dfa;var _0xe9dc31;var _0x3cec92;Promise[_0x1a97('0x15')]()[_0x1a97('0x16')](function(){if(_0x221db4['query'][_0x1a97('0x17')]){if(!utils['isValidChannel'](_0x221db4['query'][_0x1a97('0x17')])){throw new APIBadRequestError(util[_0x1a97('0x19')](_0x1a97('0x1a'),_0x221db4['query'][_0x1a97('0x17')]));}_0x5f3dfa=_0x221db4['query'][_0x1a97('0x17')]['toLowerCase']();}var _0x4ae941=_['startCase'](_0x5f3dfa)+_0x1a97('0x45');var _0x1e0cf7=_[_0x1a97('0x26')](db[_0x4ae941]['rawAttributes'],function(_0x3f510c){return{'name':_0x3f510c[_0x1a97('0x29')],'type':_0x3f510c[_0x1a97('0x2a')][_0x1a97('0x2b')]};});if(!_0x221db4[_0x1a97('0x13')][_0x1a97('0x1f')]){var _0xce833f=['id','name'];if(_0x5f3dfa===_0x1a97('0x46')){_0xce833f[_0x1a97('0x30')](_0x1a97('0x2a'));if(_0x221db4[_0x1a97('0x13')][_0x1a97('0x2a')]==='outbound'){_0xce833f[_0x1a97('0x30')](['dialActive','dialMethod']);}}_0x221db4['query'][_0x1a97('0x1f')]=_0xce833f[_0x1a97('0x20')](',');}_0x9c9780=qs['getOptions'](_0x1e0cf7,_0x221db4);if(_0x221db4[_0x1a97('0x37')]['role']===_0x1a97('0x37')){var _0x3655b9={'params':{'id':_0x221db4[_0x1a97('0x37')][_0x1a97('0x38')]},'query':{'section':_0x5f3dfa===_0x1a97('0x46')&&_0x221db4[_0x1a97('0x13')][_0x1a97('0x2a')]===_0x1a97('0x47')?'QueueCampaigns':_['startCase'](_0x5f3dfa)+_0x1a97('0x48'),'type':_0x221db4[_0x1a97('0x13')][_0x1a97('0x2a')],'nolimit':!![],'sort':'name','filter':_0x221db4['query'][_0x1a97('0x49')]}};return db[_0x1a97('0x3b')][_0x1a97('0x4a')](_0x3655b9);}return db[_0x4ae941][_0x1a97('0x3c')](_0x9c9780);})[_0x1a97('0x16')](function(_0x241e36){_0x44c9e3[_0x1a97('0xb')]=_0x241e36[_0x1a97('0xb')];_0xe9dc31=_0x241e36[_0x1a97('0x22')];return rtq[_0x1a97('0x4b')](_0x221db4,_0x5f3dfa);})[_0x1a97('0x16')](function(_0x1f8d7d){_0x3cec92=_0x1f8d7d[_0x1a97('0x22')];return rtq[_0x1a97('0x4c')](_0xe9dc31,_0x3cec92,_0x5f3dfa,_0x221db4[_0x1a97('0x13')][_0x1a97('0x2a')]);})['then'](function(_0x3edec8){_0x44c9e3[_0x1a97('0x22')]=_0x3edec8;return _0x44c9e3;})['then'](respondWithFilteredResult(_0x8476b2,_0x9c9780))[_0x1a97('0x43')](APIHandleError(_0x8476b2));}; \ No newline at end of file +var _0x59b5=['role','userProfileId','Agents','assign','UserProfile','getResources','findAndCountAll','rows','map','find','filterAgentAttributes','globalStatus','getAgentStatus','Status','getQueues','resolve','startCase','name','voice','outbound','dialActive','dialMethod','QueueCampaigns','Queues','filter','getRealtimeQueues','initializeQueues','catch','lodash','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','offset','undefined','limit','count','status','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','rawAttributes','fieldName','type','agent','getOptions','raw','push','sequelize','literal','forEach','Pause','where','merge','user'];(function(_0x49e558,_0x56e935){var _0x44c9d4=function(_0x9245e7){while(--_0x9245e7){_0x49e558['push'](_0x49e558['shift']());}};_0x44c9d4(++_0x56e935);}(_0x59b5,0xba));var _0x559b=function(_0x44cbc5,_0x5bf31f){_0x44cbc5=_0x44cbc5-0x0;var _0x3fba89=_0x59b5[_0x44cbc5];return _0x3fba89;};'use strict';var _=require(_0x559b('0x0'));var util=require('util');var rta=require('../../components/realtime/agents');var rtq=require('../../components/realtime/queues');var qs=require('../../components/parsers/qs');var utils=require(_0x559b('0x1'));var db=require(_0x559b('0x2'))['db'];var APIBadRequestError=require(_0x559b('0x3'))[_0x559b('0x4')];var APIHandleError=require('../../errors/api')['handleError'];function respondWithFilteredResult(_0x4409b9,_0xe48c43){return function(_0x3e41b0){if(_0x3e41b0){var _0x3fc726=typeof _0xe48c43[_0x559b('0x5')]===_0x559b('0x6')&&typeof _0xe48c43[_0x559b('0x7')]===_0x559b('0x6');var _0x26c825=_0x3e41b0[_0x559b('0x8')];var _0x4f69df=_0x3fc726?0x0:_0xe48c43[_0x559b('0x5')];var _0x49737f=_0x3fc726?_0x3e41b0['count']:_0xe48c43[_0x559b('0x5')]+_0xe48c43[_0x559b('0x7')];var _0x5695ff;if(_0x49737f>=_0x26c825){_0x49737f=_0x26c825;_0x5695ff=0xc8;}else{_0x5695ff=0xce;}_0x4409b9[_0x559b('0x9')](_0x5695ff);return _0x4409b9[_0x559b('0xa')](_0x559b('0xb'),_0x4f69df+'-'+_0x49737f+'/'+_0x26c825)[_0x559b('0xc')](_0x3e41b0);}return null;};}exports[_0x559b('0xd')]=function(_0x3a36dd,_0x3adf3c){var _0x312a06={'count':0x0,'rows':[]};var _0x104fb7={};var _0x266f74;var _0x34345f=utils[_0x559b('0xe')]();var _0x58e8e0;var _0x3af130;var _0x3ffcd9=_0x3a36dd[_0x559b('0xf')][_0x559b('0x10')];var _0xe9f593=_0x3a36dd['query'][_0x559b('0x11')];var _0x4da12e=_0x3a36dd[_0x559b('0xf')][_0x559b('0x12')];var _0x250cbb=_0xe9f593===_0x559b('0x13')||_0xe9f593===_0x559b('0x14')?!![]:![];var _0x57ccdc=[];var _0x4b348d;var _0x5188b5;Promise['resolve']()[_0x559b('0x15')](function(){if(_0x3a36dd[_0x559b('0xf')][_0x559b('0x16')]){if(!utils[_0x559b('0x17')](_0x3a36dd[_0x559b('0xf')][_0x559b('0x16')])){throw new APIBadRequestError(util[_0x559b('0x18')](_0x559b('0x19'),_0x3a36dd['query'][_0x559b('0x16')]));}_0x266f74=_0x3a36dd['query'][_0x559b('0x16')][_0x559b('0x1a')]();}if(!_0x3a36dd[_0x559b('0xf')][_0x559b('0x1b')]||!_0x3a36dd[_0x559b('0xf')]['sort'][_0x559b('0x1c')]('globalStatus')){_0x3a36dd['query'][_0x559b('0x1b')]=rta['validateSortParameter'](_0x3a36dd[_0x559b('0xf')][_0x559b('0x1b')]);return;}var _0x7201e0=rta['getUpdatedSortOptions'](_0x3a36dd[_0x559b('0xf')][_0x559b('0x1b')]);_0x3a36dd[_0x559b('0xf')][_0x559b('0x1b')]=_0x7201e0[_0x559b('0x1d')][_0x559b('0x1e')](',');_0x4b348d=_0x7201e0[_0x559b('0x1f')];})[_0x559b('0x15')](function(){if(!_0x3ffcd9){return[];}return rta[_0x559b('0x20')](_0x3ffcd9,_0x266f74);})[_0x559b('0x15')](function(_0x56f2c6){_0x57ccdc=_0x56f2c6;return rta[_0x559b('0x21')]();})[_0x559b('0x15')](function(_0x184ded){_0x3af130=_0x184ded['rows'];if((!_0xe9f593||_0x250cbb)&&!_0x4b348d){return _0x57ccdc;}if(_0x4b348d&&!_0xe9f593){return rta[_0x559b('0x22')](_0x3af130,_0x57ccdc,_0x4b348d);}else{return rta[_0x559b('0x23')](_0x3af130,_0x57ccdc,_0xe9f593);}})[_0x559b('0x15')](function(_0x528f01){_0x57ccdc=_0x528f01;var _0x27285d=![];if(_0x57ccdc[_0x559b('0x24')]===0x0){if(_0x3ffcd9||_0xe9f593){_0x27285d=!![];}if(_0x250cbb){_0x27285d=![];}}if(_0x27285d){return _0x312a06;}var _0x38d8fe=_['map'](db['User'][_0x559b('0x25')],function(_0xcf3175){return{'name':_0xcf3175[_0x559b('0x26')],'type':_0xcf3175[_0x559b('0x27')]['key']};});_0x3a36dd[_0x559b('0xf')]['role']=_0x559b('0x28');_0x3a36dd[_0x559b('0xf')]['online']=!![];_0x104fb7=qs[_0x559b('0x29')](_0x38d8fe,_0x3a36dd);_0x104fb7[_0x559b('0x2a')]=!![];var _0xe7605d=[];if(_0x57ccdc[_0x559b('0x24')]>0x0){_0xe7605d[_0x559b('0x2b')]({'id':{'$in':_0x57ccdc}});if(_0x4b348d&&!_0xe9f593){_0x5188b5=[db[_0x559b('0x2c')][_0x559b('0x2d')]('FIELD(id,'+_0x57ccdc+')')];_0x104fb7['order']=_0x5188b5;}}if(_0x250cbb){_0x34345f[_0x559b('0x2e')](function(_0x4fda49){var _0x5d7c02=!![];if(_0xe9f593===_0x559b('0x14')&&_0x266f74!==_0x4fda49){_0x5d7c02=![];}_0xe7605d[_0x559b('0x2b')]({[_0x4fda49+_0x559b('0x2f')]:_0x5d7c02});});if(_0x4da12e){_0xe7605d[_0x559b('0x2b')]({'pauseType':_0x4da12e});}}else if(_0xe9f593){_0x34345f['forEach'](function(_0x447ace){_0xe7605d[_0x559b('0x2b')]({[_0x447ace+_0x559b('0x2f')]:![]});});}_0x104fb7[_0x559b('0x30')]=_[_0x559b('0x31')](_0x104fb7[_0x559b('0x30')],{'$and':_0xe7605d});if(_0x3a36dd[_0x559b('0x32')][_0x559b('0x33')]===_0x559b('0x32')){var _0x59769b={'params':{'id':_0x3a36dd['user'][_0x559b('0x34')]},'query':{'section':_0x559b('0x35'),'role':_0x559b('0x28'),'online':!![],'raw':!![],'ids':_0x57ccdc,'customSorting':_0x5188b5}};if(_0x250cbb){_0x59769b[_0x559b('0xf')]['extraQueryConditions']=_0xe7605d;}_0x59769b[_0x559b('0xf')]=Object[_0x559b('0x36')](_0x59769b[_0x559b('0xf')],_0x3a36dd[_0x559b('0xf')]);delete _0x59769b[_0x559b('0xf')]['id'];return db[_0x559b('0x37')][_0x559b('0x38')](_0x59769b);}return db['User'][_0x559b('0x39')](_0x104fb7);})[_0x559b('0x15')](function(_0x347029){_0x312a06[_0x559b('0x8')]=_0x347029[_0x559b('0x8')];_0x58e8e0=_0x347029[_0x559b('0x3a')];return _0x58e8e0[_0x559b('0x3b')](function(_0x252b12){var _0x190235=_[_0x559b('0x3c')](_0x3af130,['id',_0x252b12['id']]);if(_0x190235){var _0x24e612=rta[_0x559b('0x3d')](_0x190235);_['merge'](_0x252b12,_0x24e612);}_0x252b12[_0x559b('0x3e')]=rta[_0x559b('0x3f')](_0x252b12);if(_0x252b12[_0x559b('0x3e')][_0x559b('0x1c')]('pause')){_0x34345f['forEach'](function(_0x3a446e){if(_0x252b12[_0x3a446e+'Pause']){_0x252b12[_0x3a446e+_0x559b('0x40')]=_0x559b('0x13');}});}return _0x252b12;});})[_0x559b('0x15')](function(_0x1a7c66){if(!_0x4b348d||_0x5188b5){return _0x1a7c66;}return rta['sortAgentsByStatus'](_0x1a7c66,_0x4b348d);})[_0x559b('0x15')](function(_0x196be6){var _0x34c50b=null;if(_0x3a36dd[_0x559b('0xf')][_0x559b('0x1d')]){var _0x44f760=_0x3a36dd[_0x559b('0xf')]['fields']['split'](',');_0x34c50b=_0x196be6[_0x559b('0x3b')](function(_0x16352e){return _['pick'](_0x16352e,_0x44f760);});}_0x312a06[_0x559b('0x3a')]=_0x34c50b||_0x196be6;return _0x312a06;})[_0x559b('0x15')](respondWithFilteredResult(_0x3adf3c,_0x104fb7))['catch'](APIHandleError(_0x3adf3c));};exports[_0x559b('0x41')]=function(_0x3151ab,_0x28c75d){var _0x45ff9a={'count':0x0,'rows':[]};var _0x90dd14={};var _0x555d1f;var _0x55fe89;var _0x4f3791;Promise[_0x559b('0x42')]()[_0x559b('0x15')](function(){if(_0x3151ab[_0x559b('0xf')]['channel']){if(!utils[_0x559b('0x17')](_0x3151ab[_0x559b('0xf')]['channel'])){throw new APIBadRequestError(util[_0x559b('0x18')](_0x559b('0x19'),_0x3151ab[_0x559b('0xf')][_0x559b('0x16')]));}_0x555d1f=_0x3151ab['query'][_0x559b('0x16')]['toLowerCase']();}var _0x9ae75f=_[_0x559b('0x43')](_0x555d1f)+'Queue';var _0x2ebe88=_[_0x559b('0x3b')](db[_0x9ae75f][_0x559b('0x25')],function(_0x4dec0f){return{'name':_0x4dec0f[_0x559b('0x26')],'type':_0x4dec0f['type']['key']};});if(!_0x3151ab[_0x559b('0xf')][_0x559b('0x1d')]){var _0x43f967=['id',_0x559b('0x44')];if(_0x555d1f===_0x559b('0x45')){_0x43f967[_0x559b('0x2b')](_0x559b('0x27'));if(_0x3151ab[_0x559b('0xf')][_0x559b('0x27')]===_0x559b('0x46')){_0x43f967['push']([_0x559b('0x47'),_0x559b('0x48')]);}}_0x3151ab[_0x559b('0xf')][_0x559b('0x1d')]=_0x43f967[_0x559b('0x1e')](',');}_0x90dd14=qs[_0x559b('0x29')](_0x2ebe88,_0x3151ab);if(_0x3151ab[_0x559b('0x32')][_0x559b('0x33')]===_0x559b('0x32')){var _0xb1fc40={'params':{'id':_0x3151ab['user']['userProfileId']},'query':{'section':_0x555d1f===_0x559b('0x45')&&_0x3151ab['query'][_0x559b('0x27')]===_0x559b('0x46')?_0x559b('0x49'):_[_0x559b('0x43')](_0x555d1f)+_0x559b('0x4a'),'type':_0x3151ab[_0x559b('0xf')][_0x559b('0x27')],'nolimit':!![],'sort':_0x559b('0x44'),'filter':_0x3151ab[_0x559b('0xf')][_0x559b('0x4b')]}};return db[_0x559b('0x37')][_0x559b('0x38')](_0xb1fc40);}return db[_0x9ae75f]['findAndCountAll'](_0x90dd14);})[_0x559b('0x15')](function(_0x1e530e){_0x45ff9a['count']=_0x1e530e[_0x559b('0x8')];_0x55fe89=_0x1e530e[_0x559b('0x3a')];return rtq[_0x559b('0x4c')](_0x3151ab,_0x555d1f);})[_0x559b('0x15')](function(_0xe1e5c4){_0x4f3791=_0xe1e5c4[_0x559b('0x3a')];return rtq[_0x559b('0x4d')](_0x55fe89,_0x4f3791,_0x555d1f,_0x3151ab['query'][_0x559b('0x27')]);})[_0x559b('0x15')](function(_0x3c8c18){_0x45ff9a[_0x559b('0x3a')]=_0x3c8c18;return _0x45ff9a;})[_0x559b('0x15')](respondWithFilteredResult(_0x28c75d,_0x90dd14))[_0x559b('0x4e')](APIHandleError(_0x28c75d));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 065489a..a3cf254 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x11d486,_0x275600){var _0x24695b=function(_0x5ceb03){while(--_0x5ceb03){_0x11d486['push'](_0x11d486['shift']());}};_0x24695b(++_0x275600);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2cd980,_0x1c026a){var _0x316ea6=function(_0x45d6de){while(--_0x45d6de){_0x2cd980['push'](_0x2cd980['shift']());}};_0x316ea6(++_0x1c026a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 3a472e5..bce3b1d 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 _0x6144=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x25c34b,_0x51b7d5){var _0x12a716=function(_0x34fd8c){while(--_0x34fd8c){_0x25c34b['push'](_0x25c34b['shift']());}};_0x12a716(++_0x51b7d5);}(_0x6144,0x99));var _0x4614=function(_0x80097b,_0x128ee1){_0x80097b=_0x80097b-0x0;var _0x4ba6f3=_0x6144[_0x80097b];return _0x4ba6f3;};'use strict';var Sequelize=require(_0x4614('0x0'));module[_0x4614('0x1')]={'state':{'type':Sequelize[_0x4614('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x4614('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x4614('0x3')]},'starttime':{'type':Sequelize[_0x4614('0x4')]},'responsetime':{'type':Sequelize[_0x4614('0x4')]},'ringtime':{'type':Sequelize[_0x4614('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x4614('0x3')]},'membername':{'type':Sequelize[_0x4614('0x3')]}}; \ No newline at end of file +var _0x2d06=['INTEGER','STRING','DATE','exports'];(function(_0x123654,_0x2f2ea7){var _0x42de86=function(_0x488c44){while(--_0x488c44){_0x123654['push'](_0x123654['shift']());}};_0x42de86(++_0x2f2ea7);}(_0x2d06,0x157));var _0x62d0=function(_0x16af3b,_0x5651d3){_0x16af3b=_0x16af3b-0x0;var _0x5a83d4=_0x2d06[_0x16af3b];return _0x5a83d4;};'use strict';var Sequelize=require('sequelize');module[_0x62d0('0x0')]={'state':{'type':Sequelize[_0x62d0('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x62d0('0x2')]},'scheduledat':{'type':Sequelize[_0x62d0('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x62d0('0x3')]},'responsetime':{'type':Sequelize[_0x62d0('0x3')]},'ringtime':{'type':Sequelize[_0x62d0('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x62d0('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x62d0('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 52a6598..982583f 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 _0xc3f1=['request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','api','moment','bluebird'];(function(_0x33e023,_0x739c22){var _0x1656fa=function(_0x19a293){while(--_0x19a293){_0x33e023['push'](_0x33e023['shift']());}};_0x1656fa(++_0x739c22);}(_0xc3f1,0x13d));var _0x1c3f=function(_0x4a8b5f,_0xbfd3ad){_0x4a8b5f=_0x4a8b5f-0x0;var _0x5aa80d=_0xc3f1[_0x4a8b5f];return _0x5aa80d;};'use strict';var _=require(_0x1c3f('0x0'));var util=require(_0x1c3f('0x1'));var logger=require('../../config/logger')(_0x1c3f('0x2'));var moment=require(_0x1c3f('0x3'));var BPromise=require(_0x1c3f('0x4'));var rp=require(_0x1c3f('0x5'));var fs=require('fs');var path=require(_0x1c3f('0x6'));var rimraf=require(_0x1c3f('0x7'));var config=require(_0x1c3f('0x8'));var attributes=require(_0x1c3f('0x9'));module[_0x1c3f('0xa')]=function(_0x39f1ff,_0x1f64c9){return _0x39f1ff[_0x1c3f('0xb')](_0x1c3f('0xc'),attributes,{'tableName':_0x1c3f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1293=['bluebird','request-promise','path','../../config/environment','./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview','lodash','api','moment'];(function(_0x20a15,_0x45537d){var _0x5d09b5=function(_0x36f699){while(--_0x36f699){_0x20a15['push'](_0x20a15['shift']());}};_0x5d09b5(++_0x45537d);}(_0x1293,0x105));var _0x3129=function(_0xa7e669,_0x2a73d6){_0xa7e669=_0xa7e669-0x0;var _0x329ae2=_0x1293[_0xa7e669];return _0x329ae2;};'use strict';var _=require(_0x3129('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3129('0x1'));var moment=require(_0x3129('0x2'));var BPromise=require(_0x3129('0x3'));var rp=require(_0x3129('0x4'));var fs=require('fs');var path=require(_0x3129('0x5'));var rimraf=require('rimraf');var config=require(_0x3129('0x6'));var attributes=require(_0x3129('0x7'));module['exports']=function(_0x5e85e0,_0xc029a1){return _0x5e85e0[_0x3129('0x8')](_0x3129('0x9'),attributes,{'tableName':_0x3129('0xa'),'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 4e61605..1e47b55 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 _0x520f=['debug','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','ReportAgentPreview','create','body','options','raw','CreateReportAgentPreview','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','request\x20sent'];(function(_0x42e179,_0x12fe7f){var _0x538938=function(_0x4d76b0){while(--_0x4d76b0){_0x42e179['push'](_0x42e179['shift']());}};_0x538938(++_0x12fe7f);}(_0x520f,0x11c));var _0xf520=function(_0x1cfc39,_0x15adef){_0x1cfc39=_0x1cfc39-0x0;var _0x1ae59b=_0x520f[_0x1cfc39];return _0x1ae59b;};'use strict';var _=require(_0xf520('0x0'));var util=require(_0xf520('0x1'));var moment=require(_0xf520('0x2'));var BPromise=require(_0xf520('0x3'));var rs=require(_0xf520('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf520('0x5'))['db'];var utils=require(_0xf520('0x6'));var logger=require('../../config/logger')(_0xf520('0x7'));var config=require('../../config/environment');var jayson=require(_0xf520('0x8'));var client=jayson[_0xf520('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c85e8,_0x1193c6,_0x4d22ba){return new BPromise(function(_0x27a668,_0x574208){return client[_0xf520('0xa')](_0x5c85e8,_0x4d22ba)[_0xf520('0xb')](function(_0x1a9c61){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x1193c6,_0xf520('0xc'));logger[_0xf520('0xd')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x1193c6,_0xf520('0xc'),JSON[_0xf520('0xe')](_0x1a9c61));if(_0x1a9c61[_0xf520('0xf')]){if(_0x1a9c61[_0xf520('0xf')][_0xf520('0x10')]===0x1f4){logger[_0xf520('0xf')](_0xf520('0x11'),_0x1193c6,_0x1a9c61[_0xf520('0xf')][_0xf520('0x12')]);return _0x574208(_0x1a9c61['error'][_0xf520('0x12')]);}logger['error'](_0xf520('0x11'),_0x1193c6,_0x1a9c61[_0xf520('0xf')][_0xf520('0x12')]);return _0x27a668(_0x1a9c61[_0xf520('0xf')][_0xf520('0x12')]);}else{logger['info'](_0xf520('0x11'),_0x1193c6,_0xf520('0xc'));_0x27a668(_0x1a9c61[_0xf520('0x13')]['message']);}})[_0xf520('0x14')](function(_0x4b7c70){logger['error'](_0xf520('0x11'),_0x1193c6,_0x4b7c70);_0x574208(_0x4b7c70);});});}exports['CreateReportAgentPreview']=function(_0x1b0ecc){var _0x3c57e4=this;return new Promise(function(_0x1abb32,_0x4cbef0){return db[_0xf520('0x15')][_0xf520('0x16')](_0x1b0ecc[_0xf520('0x17')],{'raw':_0x1b0ecc['options']?_0x1b0ecc[_0xf520('0x18')][_0xf520('0x19')]===undefined?!![]:![]:!![]})[_0xf520('0xb')](function(_0x10ead7){logger['info'](_0xf520('0x1a'),_0x1b0ecc);logger[_0xf520('0xd')](_0xf520('0x1a'),_0x1b0ecc,JSON[_0xf520('0xe')](_0x10ead7));_0x1abb32(_0x10ead7);})[_0xf520('0x14')](function(_0xe3c960){logger[_0xf520('0xf')]('CreateReportAgentPreview',_0xe3c960['message'],_0x1b0ecc);_0x4cbef0(_0x3c57e4[_0xf520('0xf')](0x1f4,_0xe3c960[_0xf520('0x12')]));});});}; \ No newline at end of file +var _0x1680=['options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x1680,0x84));var _0x0168=function(_0x1529a3,_0x529f63){_0x1529a3=_0x1529a3-0x0;var _0x1a0d4b=_0x1680[_0x1529a3];return _0x1a0d4b;};'use strict';var _=require(_0x0168('0x0'));var util=require(_0x0168('0x1'));var moment=require(_0x0168('0x2'));var BPromise=require(_0x0168('0x3'));var rs=require(_0x0168('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0168('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0168('0x6'))('rpc');var config=require(_0x0168('0x7'));var jayson=require(_0x0168('0x8'));var client=jayson[_0x0168('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5522f2,_0x5dc5ed,_0x473fec){return new BPromise(function(_0x12152e,_0x210d50){return client[_0x0168('0xa')](_0x5522f2,_0x473fec)['then'](function(_0x2ed43e){logger[_0x0168('0xb')](_0x0168('0xc'),_0x5dc5ed,_0x0168('0xd'));logger['debug'](_0x0168('0xe'),_0x5dc5ed,_0x0168('0xd'),JSON['stringify'](_0x2ed43e));if(_0x2ed43e[_0x0168('0xf')]){if(_0x2ed43e[_0x0168('0xf')][_0x0168('0x10')]===0x1f4){logger[_0x0168('0xf')]('ReportAgentPreview,\x20%s,\x20%s',_0x5dc5ed,_0x2ed43e[_0x0168('0xf')][_0x0168('0x11')]);return _0x210d50(_0x2ed43e['error']['message']);}logger[_0x0168('0xf')]('ReportAgentPreview,\x20%s,\x20%s',_0x5dc5ed,_0x2ed43e[_0x0168('0xf')][_0x0168('0x11')]);return _0x12152e(_0x2ed43e[_0x0168('0xf')][_0x0168('0x11')]);}else{logger['info'](_0x0168('0xc'),_0x5dc5ed,'request\x20sent');_0x12152e(_0x2ed43e[_0x0168('0x12')][_0x0168('0x11')]);}})[_0x0168('0x13')](function(_0x549154){logger[_0x0168('0xf')](_0x0168('0xc'),_0x5dc5ed,_0x549154);_0x210d50(_0x549154);});});}exports[_0x0168('0x14')]=function(_0x2aa2bd){var _0x63ed0d=this;return new Promise(function(_0x4d57c6,_0x15ec1b){return db[_0x0168('0x15')][_0x0168('0x16')](_0x2aa2bd[_0x0168('0x17')],{'raw':_0x2aa2bd[_0x0168('0x18')]?_0x2aa2bd[_0x0168('0x18')][_0x0168('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3351ef){logger[_0x0168('0xb')](_0x0168('0x14'),_0x2aa2bd);logger['debug'](_0x0168('0x14'),_0x2aa2bd,JSON['stringify'](_0x3351ef));_0x4d57c6(_0x3351ef);})[_0x0168('0x13')](function(_0x576b11){logger[_0x0168('0xf')](_0x0168('0x14'),_0x576b11[_0x0168('0x11')],_0x2aa2bd);_0x15ec1b(_0x63ed0d[_0x0168('0xf')](0x1f4,_0x576b11[_0x0168('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 4b8a847..f767d15 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 _0x1fd9=['/agents/:id/capacity','agentCapacity','telephones','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','queueNotify','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','showSmsQueues','/agents/:id/notify','agentNotify','exports','util','express','Router','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','get','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','outbound','/outbound/channels','/agents','put'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1fd9,0x1b8));var _0x91fd=function(_0xaf8035,_0x19ecd1){_0xaf8035=_0xaf8035-0x0;var _0xe90cff=_0x1fd9[_0xaf8035];return _0xe90cff;};'use strict';var multer=require('multer');var util=require(_0x91fd('0x0'));var path=require('path');var express=require(_0x91fd('0x1'));var router=express[_0x91fd('0x2')]();var auth=require(_0x91fd('0x3'));var controller=require(_0x91fd('0x4'));router['get'](_0x91fd('0x5'),auth[_0x91fd('0x6')](),controller[_0x91fd('0x7')]);router['get']('/voice/channels/:uniqueid/mixmonitor',auth[_0x91fd('0x6')](),controller[_0x91fd('0x8')]);router[_0x91fd('0x9')]('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller[_0x91fd('0xa')]);router[_0x91fd('0x9')](_0x91fd('0xb'),auth[_0x91fd('0x6')](),controller[_0x91fd('0xc')]);router[_0x91fd('0x9')](_0x91fd('0xd'),auth[_0x91fd('0x6')](),controller[_0x91fd('0xe')]);router[_0x91fd('0x9')](_0x91fd('0xf'),auth[_0x91fd('0x6')](),controller[_0x91fd('0x10')]);router['get'](_0x91fd('0x11'),auth['isAuthenticated'](),controller[_0x91fd('0x12')]);router[_0x91fd('0x9')](_0x91fd('0x13'),auth[_0x91fd('0x6')](),controller[_0x91fd('0x14')]);router[_0x91fd('0x9')](_0x91fd('0x15'),auth['isAuthenticated'](),controller[_0x91fd('0x16')]);router['get'](_0x91fd('0x17'),auth[_0x91fd('0x6')](),controller['whatsappQueues']);router[_0x91fd('0x9')]('/fax/queues',auth['isAuthenticated'](),controller[_0x91fd('0x18')]);router[_0x91fd('0x9')](_0x91fd('0x19'),auth['isAuthenticated'](),controller[_0x91fd('0x1a')]);router[_0x91fd('0x9')]('/voice/queues/channels',auth[_0x91fd('0x6')](),controller[_0x91fd('0x1b')]);router[_0x91fd('0x9')]('/voice/queues/channels/:uniqueid',auth[_0x91fd('0x6')](),controller[_0x91fd('0x1c')]);router['get'](_0x91fd('0x1d'),auth[_0x91fd('0x6')](),controller[_0x91fd('0x1e')]);router['get'](_0x91fd('0x1f'),auth[_0x91fd('0x6')](),controller[_0x91fd('0x20')]);router[_0x91fd('0x9')](_0x91fd('0x21'),auth[_0x91fd('0x6')](),controller[_0x91fd('0x22')]);router['put'](_0x91fd('0x21'),auth[_0x91fd('0x6')](),controller['updateVoiceQueue']);router[_0x91fd('0x9')](_0x91fd('0x23'),auth[_0x91fd('0x6')](),controller[_0x91fd('0x24')]);router[_0x91fd('0x9')](_0x91fd('0x25'),auth[_0x91fd('0x6')](),controller['outboundChannels']);router['get'](_0x91fd('0x26'),auth[_0x91fd('0x6')](),controller['agents']);router[_0x91fd('0x27')](_0x91fd('0x28'),auth[_0x91fd('0x6')](),controller[_0x91fd('0x29')]);router[_0x91fd('0x9')]('/telephones',auth['isAuthenticated'](),controller[_0x91fd('0x2a')]);router[_0x91fd('0x9')]('/trunks',auth[_0x91fd('0x6')](),controller['trunks']);router[_0x91fd('0x9')]('/campaigns',auth[_0x91fd('0x6')](),controller[_0x91fd('0x2b')]);router[_0x91fd('0x9')](_0x91fd('0x2c'),auth[_0x91fd('0x6')](),controller[_0x91fd('0x2d')]);router[_0x91fd('0x9')]('/chat/queues/waitinginteractions',auth[_0x91fd('0x6')](),controller[_0x91fd('0x2e')]);router['get'](_0x91fd('0x2f'),auth[_0x91fd('0x6')](),controller[_0x91fd('0x30')]);router[_0x91fd('0x9')](_0x91fd('0x31'),auth[_0x91fd('0x6')](),controller[_0x91fd('0x32')]);router['get'](_0x91fd('0x33'),auth[_0x91fd('0x6')](),controller[_0x91fd('0x34')]);router[_0x91fd('0x9')](_0x91fd('0x35'),auth['isAuthenticated'](),controller[_0x91fd('0x36')]);router['get'](_0x91fd('0x37'),auth[_0x91fd('0x6')](),controller['whatsappQueuesWaitingInteractions']);router[_0x91fd('0x9')]('/fax/queues/waitinginteractions',auth[_0x91fd('0x6')](),controller[_0x91fd('0x38')]);router[_0x91fd('0x39')](_0x91fd('0x3a'),auth[_0x91fd('0x6')](),controller['queueNotify'](_0x91fd('0x3b')));router['get'](_0x91fd('0x3c'),auth[_0x91fd('0x6')](),controller[_0x91fd('0x3d')]);router[_0x91fd('0x39')](_0x91fd('0x3e'),auth[_0x91fd('0x6')](),controller['queueNotify'](_0x91fd('0x3f')));router['get'](_0x91fd('0x40'),auth[_0x91fd('0x6')](),controller[_0x91fd('0x41')]);router[_0x91fd('0x39')](_0x91fd('0x42'),auth[_0x91fd('0x6')](),controller[_0x91fd('0x43')]('fax'));router['get'](_0x91fd('0x44'),auth['isAuthenticated'](),controller['showFaxQueues']);router[_0x91fd('0x39')](_0x91fd('0x45'),auth[_0x91fd('0x6')](),controller[_0x91fd('0x43')](_0x91fd('0x46')));router[_0x91fd('0x9')](_0x91fd('0x47'),auth[_0x91fd('0x6')](),controller[_0x91fd('0x48')]);router[_0x91fd('0x39')](_0x91fd('0x49'),auth[_0x91fd('0x6')](),controller['queueNotify'](_0x91fd('0x4a')));router['post']('/whatsapp/queues/:id/notify',auth[_0x91fd('0x6')](),controller[_0x91fd('0x43')](_0x91fd('0x4b')));router[_0x91fd('0x9')]('/sms/queues/:id',auth['isAuthenticated'](),controller[_0x91fd('0x4c')]);router[_0x91fd('0x9')]('/whatsapp/queues/:id',auth[_0x91fd('0x6')](),controller['showWhatsappQueues']);router['post'](_0x91fd('0x4d'),auth['isAuthenticated'](),controller[_0x91fd('0x4e')]);module[_0x91fd('0x4f')]=router; \ No newline at end of file +var _0x3fa0=['chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','agentNotify','exports','util','path','express','Router','isAuthenticated','voiceChannels','get','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','put','updateVoiceQueue','/outbound','outbound','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','telephones','trunks','/campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify'];(function(_0x3b150c,_0x2f93f8){var _0x5cd414=function(_0x26305e){while(--_0x26305e){_0x3b150c['push'](_0x3b150c['shift']());}};_0x5cd414(++_0x2f93f8);}(_0x3fa0,0x100));var _0x03fa=function(_0x10bf7d,_0x34cd03){_0x10bf7d=_0x10bf7d-0x0;var _0x35a485=_0x3fa0[_0x10bf7d];return _0x35a485;};'use strict';var multer=require('multer');var util=require(_0x03fa('0x0'));var path=require(_0x03fa('0x1'));var express=require(_0x03fa('0x2'));var router=express[_0x03fa('0x3')]();var auth=require('../../components/auth/service');var controller=require('./rpc.controller');router['get']('/voice/channels',auth[_0x03fa('0x4')](),controller[_0x03fa('0x5')]);router[_0x03fa('0x6')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x03fa('0x4')](),controller[_0x03fa('0x7')]);router[_0x03fa('0x6')](_0x03fa('0x8'),auth[_0x03fa('0x4')](),controller[_0x03fa('0x9')]);router[_0x03fa('0x6')](_0x03fa('0xa'),auth['isAuthenticated'](),controller[_0x03fa('0xb')]);router['get']('/chat/queues',auth[_0x03fa('0x4')](),controller[_0x03fa('0xc')]);router[_0x03fa('0x6')](_0x03fa('0xd'),auth[_0x03fa('0x4')](),controller[_0x03fa('0xe')]);router['get'](_0x03fa('0xf'),auth[_0x03fa('0x4')](),controller[_0x03fa('0x10')]);router['get'](_0x03fa('0x11'),auth[_0x03fa('0x4')](),controller[_0x03fa('0x12')]);router['get'](_0x03fa('0x13'),auth['isAuthenticated'](),controller[_0x03fa('0x14')]);router[_0x03fa('0x6')](_0x03fa('0x15'),auth[_0x03fa('0x4')](),controller[_0x03fa('0x16')]);router[_0x03fa('0x6')](_0x03fa('0x17'),auth[_0x03fa('0x4')](),controller[_0x03fa('0x18')]);router['get'](_0x03fa('0x19'),auth[_0x03fa('0x4')](),controller[_0x03fa('0x1a')]);router[_0x03fa('0x6')](_0x03fa('0x1b'),auth[_0x03fa('0x4')](),controller[_0x03fa('0x1c')]);router[_0x03fa('0x6')](_0x03fa('0x1d'),auth['isAuthenticated'](),controller[_0x03fa('0x1e')]);router[_0x03fa('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller['voiceQueuesChannelHangup']);router[_0x03fa('0x6')](_0x03fa('0x1f'),auth[_0x03fa('0x4')](),controller[_0x03fa('0x20')]);router[_0x03fa('0x6')](_0x03fa('0x21'),auth[_0x03fa('0x4')](),controller['showVoiceQueues']);router[_0x03fa('0x22')](_0x03fa('0x21'),auth[_0x03fa('0x4')](),controller[_0x03fa('0x23')]);router[_0x03fa('0x6')](_0x03fa('0x24'),auth['isAuthenticated'](),controller[_0x03fa('0x25')]);router[_0x03fa('0x6')]('/outbound/channels',auth[_0x03fa('0x4')](),controller[_0x03fa('0x26')]);router[_0x03fa('0x6')](_0x03fa('0x27'),auth[_0x03fa('0x4')](),controller[_0x03fa('0x28')]);router[_0x03fa('0x22')](_0x03fa('0x29'),auth[_0x03fa('0x4')](),controller[_0x03fa('0x2a')]);router[_0x03fa('0x6')]('/telephones',auth[_0x03fa('0x4')](),controller[_0x03fa('0x2b')]);router[_0x03fa('0x6')]('/trunks',auth['isAuthenticated'](),controller[_0x03fa('0x2c')]);router[_0x03fa('0x6')](_0x03fa('0x2d'),auth['isAuthenticated'](),controller['campaigns']);router['get'](_0x03fa('0x2e'),auth[_0x03fa('0x4')](),controller['faxAccounts']);router[_0x03fa('0x6')](_0x03fa('0x2f'),auth[_0x03fa('0x4')](),controller[_0x03fa('0x30')]);router[_0x03fa('0x6')](_0x03fa('0x31'),auth['isAuthenticated'](),controller['mailQueuesWaitingInteractions']);router[_0x03fa('0x6')](_0x03fa('0x32'),auth['isAuthenticated'](),controller[_0x03fa('0x33')]);router[_0x03fa('0x6')](_0x03fa('0x34'),auth[_0x03fa('0x4')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x03fa('0x6')](_0x03fa('0x35'),auth[_0x03fa('0x4')](),controller[_0x03fa('0x36')]);router[_0x03fa('0x6')]('/whatsapp/queues/waitinginteractions',auth['isAuthenticated'](),controller['whatsappQueuesWaitingInteractions']);router[_0x03fa('0x6')](_0x03fa('0x37'),auth[_0x03fa('0x4')](),controller[_0x03fa('0x38')]);router[_0x03fa('0x39')](_0x03fa('0x3a'),auth['isAuthenticated'](),controller[_0x03fa('0x3b')](_0x03fa('0x3c')));router[_0x03fa('0x6')](_0x03fa('0x3d'),auth['isAuthenticated'](),controller[_0x03fa('0x3e')]);router[_0x03fa('0x39')](_0x03fa('0x3f'),auth[_0x03fa('0x4')](),controller[_0x03fa('0x3b')](_0x03fa('0x40')));router['get'](_0x03fa('0x41'),auth[_0x03fa('0x4')](),controller[_0x03fa('0x42')]);router[_0x03fa('0x39')](_0x03fa('0x43'),auth[_0x03fa('0x4')](),controller[_0x03fa('0x3b')]('fax'));router[_0x03fa('0x6')](_0x03fa('0x44'),auth[_0x03fa('0x4')](),controller[_0x03fa('0x45')]);router[_0x03fa('0x39')]('/openchannel/queues/:id/notify',auth[_0x03fa('0x4')](),controller['queueNotify']('openchannel'));router[_0x03fa('0x6')](_0x03fa('0x46'),auth[_0x03fa('0x4')](),controller[_0x03fa('0x47')]);router['post'](_0x03fa('0x48'),auth[_0x03fa('0x4')](),controller['queueNotify'](_0x03fa('0x49')));router[_0x03fa('0x39')](_0x03fa('0x4a'),auth[_0x03fa('0x4')](),controller[_0x03fa('0x3b')](_0x03fa('0x4b')));router[_0x03fa('0x6')](_0x03fa('0x4c'),auth[_0x03fa('0x4')](),controller[_0x03fa('0x4d')]);router[_0x03fa('0x6')]('/whatsapp/queues/:id',auth[_0x03fa('0x4')](),controller['showWhatsappQueues']);router[_0x03fa('0x39')]('/agents/:id/notify',auth[_0x03fa('0x4')](),controller[_0x03fa('0x4e')]);module[_0x03fa('0x4f')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index f738e54..91541e3 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 _0x46ed=['send','isNil','rows','VoiceChannels','query','then','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','agentCapacity','interaction','user','hasOwnProperty','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','MemberReport','findOrCreate','interface','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','MailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','uniq','indexOf','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','User','\x20Message\x20not\x20found','bluebird','moment','util','../../mysqldb','../../config/logger','jayson/promise','client','http','request','error','code','message','result','status','name'];(function(_0x1c1431,_0x44d3a0){var _0x447a7d=function(_0x2bbf10){while(--_0x2bbf10){_0x1c1431['push'](_0x1c1431['shift']());}};_0x447a7d(++_0x44d3a0);}(_0x46ed,0x168));var _0xd46e=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x46ed[_0x4ff09b];return _0x3f5c2e;};'use strict';var BPromise=require(_0xd46e('0x0'));var moment=require(_0xd46e('0x1'));var _=require('lodash');var util=require(_0xd46e('0x2'));var db=require(_0xd46e('0x3'))['db'];var logger=require(_0xd46e('0x4'))('api');var jayson=require(_0xd46e('0x5'));var amiClient=jayson[_0xd46e('0x6')]['http']({'port':0x232a});var mailClient=jayson[_0xd46e('0x6')][_0xd46e('0x7')]({'port':0x232b});var routingClient=jayson[_0xd46e('0x6')][_0xd46e('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x45e680,_0x855f24,_0x437ea0){return new BPromise(function(_0x144687,_0x31259b){var _0x19e4f4=_0x437ea0?_0x437ea0:amiClient;return _0x19e4f4[_0xd46e('0x8')](_0x45e680,_0x855f24)['then'](function(_0x7b2d69){if(_0x7b2d69[_0xd46e('0x9')]){if(_0x7b2d69['error'][_0xd46e('0xa')]===0x1f4){return _0x31259b(_0x7b2d69[_0xd46e('0x9')][_0xd46e('0xb')]);}return _0x144687(_0x7b2d69[_0xd46e('0x9')][_0xd46e('0xb')]);}else{_0x144687(_0x7b2d69[_0xd46e('0xc')]);}})['catch'](function(_0x24c54b){_0x31259b(_0x24c54b);});});}function respondWithResult(_0x5bc1da,_0x48550b){_0x48550b=_0x48550b||0xc8;return function(_0xf3048c){if(_0xf3048c){return _0x5bc1da[_0xd46e('0xd')](_0x48550b)['json'](_0xf3048c);}return _0x5bc1da['sendStatus'](0x194);};}function handleError(_0xacd799,_0x4688ae){_0x4688ae=_0x4688ae||0x1f4;return function(_0x1e9aae){logger[_0xd46e('0x9')](_0x1e9aae['stack']);if(_0x1e9aae[_0xd46e('0xe')]){delete _0x1e9aae[_0xd46e('0xe')];}_0xacd799[_0xd46e('0xd')](_0x4688ae)[_0xd46e('0xf')](_0x1e9aae);};}function findById(_0x36a317){return function(_0x47fa8f){if(!_[_0xd46e('0x10')](_0x36a317)&&!_[_0xd46e('0x10')](_0x47fa8f)&&!_[_0xd46e('0x10')](_0x47fa8f['rows'])){return _['find'](_0x47fa8f[_0xd46e('0x11')],function(_0x1bd574){return _0x1bd574['id']==_0x36a317;});}return null;};}exports['voiceChannels']=function(_0x4fd1f2,_0x2d6f2c){return respondWithRpcPromise(_0xd46e('0x12'),_0x4fd1f2[_0xd46e('0x13')])[_0xd46e('0x14')](respondWithResult(_0x2d6f2c,null))[_0xd46e('0x15')](handleError(_0x2d6f2c,null));};exports[_0xd46e('0x16')]=function(_0x3b5fa4,_0x327b7e){return respondWithRpcPromise(_0xd46e('0x17'),_[_0xd46e('0x18')](_0x3b5fa4[_0xd46e('0x13')],_0x3b5fa4['params']))[_0xd46e('0x14')](respondWithResult(_0x327b7e,null))[_0xd46e('0x15')](handleError(_0x327b7e,null));};exports[_0xd46e('0x19')]=function(_0x45ce0b,_0x128246){return respondWithRpcPromise(_0xd46e('0x1a'),_[_0xd46e('0x18')](_0x45ce0b[_0xd46e('0x13')],_0x45ce0b[_0xd46e('0x1b')]))['then'](respondWithResult(_0x128246,null))[_0xd46e('0x15')](handleError(_0x128246,null));};exports['voiceQueues']=function(_0x4b8f6a,_0x371054){return respondWithRpcPromise(_0xd46e('0x1c'),_0x4b8f6a[_0xd46e('0x13')])[_0xd46e('0x14')](respondWithResult(_0x371054,null))[_0xd46e('0x15')](handleError(_0x371054,null));};exports[_0xd46e('0x1d')]=function(_0x1740d1,_0x4dab6a){return respondWithRpcPromise(_0xd46e('0x1c'),_0x1740d1[_0xd46e('0x13')])[_0xd46e('0x14')](findById(_0x1740d1[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x4dab6a,null))[_0xd46e('0x15')](handleError(_0x4dab6a,null));};exports['updateVoiceQueue']=function(_0x465d54,_0x3a1ced){return respondWithRpcPromise(_0xd46e('0x1e'),_[_0xd46e('0x18')](_0x465d54[_0xd46e('0x1f')],_0x465d54[_0xd46e('0x1b')]))[_0xd46e('0x14')](respondWithResult(_0x3a1ced,null))[_0xd46e('0x15')](handleError(_0x3a1ced,null));};exports[_0xd46e('0x20')]=function(_0x45ea47,_0x2ff785){return respondWithRpcPromise(_0xd46e('0x21'),_[_0xd46e('0x18')](_0x45ea47['query'],_0x45ea47[_0xd46e('0x1b')]))[_0xd46e('0x14')](respondWithResult(_0x2ff785,null))[_0xd46e('0x15')](handleError(_0x2ff785,null));};exports[_0xd46e('0x22')]=function(_0x5ef248,_0x2eed3a){return respondWithRpcPromise(_0xd46e('0x23'),_0x5ef248['query'])[_0xd46e('0x14')](respondWithResult(_0x2eed3a,null))[_0xd46e('0x15')](handleError(_0x2eed3a,null));};exports['voiceQueuesChannel']=function(_0x306458,_0x1c15c9){return respondWithRpcPromise(_0xd46e('0x24'),_['merge'](_0x306458['query'],_0x306458[_0xd46e('0x1b')]))[_0xd46e('0x14')](respondWithResult(_0x1c15c9,null))[_0xd46e('0x15')](handleError(_0x1c15c9,null));};exports[_0xd46e('0x25')]=function(_0x83526a,_0x423de9){return respondWithRpcPromise(_0xd46e('0x26'),_[_0xd46e('0x18')](_0x83526a['query'],_0x83526a[_0xd46e('0x1b')]))[_0xd46e('0x14')](respondWithResult(_0x423de9,null))[_0xd46e('0x15')](handleError(_0x423de9,null));};exports[_0xd46e('0x27')]=function(_0x1fa66c,_0x1e0897){return respondWithRpcPromise(_0xd46e('0x28'),_['merge'](_0x1fa66c[_0xd46e('0x13')],_0x1fa66c[_0xd46e('0x1b')]))['then'](respondWithResult(_0x1e0897,null))[_0xd46e('0x15')](handleError(_0x1e0897,null));};exports[_0xd46e('0x29')]=function(_0x12ccf8,_0x3b6e67){return respondWithRpcPromise('Outbound',_0x12ccf8[_0xd46e('0x13')])[_0xd46e('0x14')](respondWithResult(_0x3b6e67,null))[_0xd46e('0x15')](handleError(_0x3b6e67,null));};exports[_0xd46e('0x2a')]=function(_0xefe5f4,_0x1f58ad){return respondWithRpcPromise(_0xd46e('0x2b'),_0xefe5f4[_0xd46e('0x13')])['then'](respondWithResult(_0x1f58ad,null))[_0xd46e('0x15')](handleError(_0x1f58ad,null));};exports[_0xd46e('0x2c')]=function(_0xc83ea1,_0x25657a){var _0x165ce8;return respondWithRpcPromise('Agents',_0xc83ea1[_0xd46e('0x13')])['then'](function(_0x55230d){_0x165ce8=_0x55230d;return respondWithRpcPromise('Agents',_0xc83ea1['query'],routingClient);})[_0xd46e('0x14')](function(_0x54949f){return _[_0xd46e('0x18')]({},_0x54949f,_0x165ce8);})[_0xd46e('0x14')](respondWithResult(_0x25657a,null))['catch'](handleError(_0x25657a,null));};exports[_0xd46e('0x2d')]=function(_0x4114e6,_0x3bd5e9){if(_0x4114e6[_0xd46e('0x1f')]&&_0x4114e6[_0xd46e('0x1f')][_0xd46e('0x2e')]&&_0x4114e6[_0xd46e('0x2f')]&&_0x4114e6[_0xd46e('0x2f')][_0xd46e('0xe')]){for(var _0xec367d in _0x4114e6[_0xd46e('0x1f')]['interaction']){if(_0x4114e6['body']['interaction'][_0xd46e('0x30')](_0xec367d)){db['MemberReport'][_0xd46e('0x31')]({'where':{'channel':_0xec367d,'membername':_0x4114e6[_0xd46e('0x2f')][_0xd46e('0xe')],'type':_0xd46e('0x32'),'exitAt':null,'uniqueid':_0x4114e6[_0xd46e('0x1f')][_0xd46e('0x2e')][_0xec367d]&&_0x4114e6[_0xd46e('0x1f')][_0xd46e('0x2e')][_0xec367d]['length']?{'$notIn':_0x4114e6[_0xd46e('0x1f')]['interaction'][_0xec367d]}:{'$ne':null}}})[_0xd46e('0x14')](function(_0x196e51){var _0x41a983=moment()[_0xd46e('0x33')](_0xd46e('0x34'));for(var _0x5d65ca=0x0,_0x384b6e=_0x196e51[_0xd46e('0x35')];_0x5d65ca<_0x384b6e;_0x5d65ca+=0x1){_0x196e51[_0x5d65ca][_0xd46e('0x36')]({'exitAt':_0x41a983});}});for(var _0xac268d=0x0;_0xac268d<_0x4114e6[_0xd46e('0x1f')]['interaction'][_0xec367d][_0xd46e('0x35')];_0xac268d+=0x1){db[_0xd46e('0x37')][_0xd46e('0x38')]({'where':{'channel':_0xec367d,'membername':_0x4114e6[_0xd46e('0x2f')][_0xd46e('0xe')],'type':'INTERACTION','uniqueid':_0x4114e6[_0xd46e('0x1f')][_0xd46e('0x2e')][_0xec367d][_0xac268d],'exitAt':null},'defaults':{'channel':_0xec367d,'membername':_0x4114e6[_0xd46e('0x2f')][_0xd46e('0xe')],'interface':_[_0xd46e('0x10')](_0x4114e6[_0xd46e('0x2f')][_0xd46e('0x39')])?util[_0xd46e('0x33')]('SIP/%s',_0x4114e6[_0xd46e('0x2f')][_0xd46e('0xe')]):_0x4114e6[_0xd46e('0x2f')][_0xd46e('0x39')],'type':_0xd46e('0x32'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xd46e('0x3a'),'internal':_0x4114e6[_0xd46e('0x2f')][_0xd46e('0x3b')],'uniqueid':_0x4114e6['body']['interaction'][_0xec367d][_0xac268d]}});}}}}return respondWithRpcPromise(_0xd46e('0x3c'),{'id':_0x4114e6[_0xd46e('0x1b')]['id'],'capacity':_0x4114e6['body'][_0xd46e('0x3d')]},routingClient)[_0xd46e('0x14')](respondWithResult(_0x3bd5e9,null))[_0xd46e('0x15')](handleError(_0x3bd5e9,null));};exports[_0xd46e('0x3e')]=function(_0x1bd8a5,_0x34d4ca){return respondWithRpcPromise(_0xd46e('0x3f'),_0x1bd8a5[_0xd46e('0x13')])['then'](respondWithResult(_0x34d4ca,null))[_0xd46e('0x15')](handleError(_0x34d4ca,null));};exports[_0xd46e('0x40')]=function(_0x1c7f92,_0x63ee74){return respondWithRpcPromise('Trunks',_0x1c7f92['query'])[_0xd46e('0x14')](respondWithResult(_0x63ee74,null))['catch'](handleError(_0x63ee74,null));};exports[_0xd46e('0x41')]=function(_0x2af20b,_0x393cb9){return respondWithRpcPromise(_0xd46e('0x42'),_0x2af20b[_0xd46e('0x13')])[_0xd46e('0x14')](respondWithResult(_0x393cb9,null))['catch'](handleError(_0x393cb9,null));};exports[_0xd46e('0x43')]=function(_0x354739,_0x51f45a){return respondWithRpcPromise('ChatQueues',_0x354739[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x51f45a,null))[_0xd46e('0x15')](handleError(_0x51f45a,null));};exports[_0xd46e('0x44')]=function(_0x1886e6,_0x2cc676){return respondWithRpcPromise(_0xd46e('0x45'),_0x1886e6[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](findById(_0x1886e6[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x2cc676,null))[_0xd46e('0x15')](handleError(_0x2cc676,null));};exports[_0xd46e('0x46')]=function(_0x402df2,_0x47a86c){return respondWithRpcPromise(_0xd46e('0x47'),_0x402df2[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x47a86c,null))[_0xd46e('0x15')](handleError(_0x47a86c,null));};exports['showMailQueues']=function(_0x636f15,_0x36e18a){return respondWithRpcPromise(_0xd46e('0x47'),_0x636f15[_0xd46e('0x13')],routingClient)['then'](findById(_0x636f15[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x36e18a,null))['catch'](handleError(_0x36e18a,null));};exports['mailAccounts']=function(_0x45e102,_0xd59920){return respondWithRpcPromise(_0xd46e('0x48'),_0x45e102['query'],mailClient)['then'](respondWithResult(_0xd59920,null))[_0xd46e('0x15')](handleError(_0xd59920,null));};exports[_0xd46e('0x49')]=function(_0x1f310d,_0x263425){return respondWithRpcPromise(_0xd46e('0x4a'),_0x1f310d[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x263425,null))[_0xd46e('0x15')](handleError(_0x263425,null));};exports[_0xd46e('0x4b')]=function(_0x2a172c,_0x4af44){return respondWithRpcPromise(_0xd46e('0x4a'),_0x2a172c[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](findById(_0x2a172c[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x4af44,null))['catch'](handleError(_0x4af44,null));};exports[_0xd46e('0x4c')]=function(_0x1a3771,_0x3a2dec){return respondWithRpcPromise('SmsQueues',_0x1a3771[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x3a2dec,null))['catch'](handleError(_0x3a2dec,null));};exports[_0xd46e('0x4d')]=function(_0x2c86fe,_0x1801d4){return respondWithRpcPromise('SmsQueues',_0x2c86fe[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](findById(_0x2c86fe[_0xd46e('0x1b')]['id']))['then'](respondWithResult(_0x1801d4,null))[_0xd46e('0x15')](handleError(_0x1801d4,null));};exports['whatsappQueues']=function(_0x32eed0,_0x148187){return respondWithRpcPromise(_0xd46e('0x4e'),_0x32eed0['query'],routingClient)[_0xd46e('0x14')](respondWithResult(_0x148187,null))[_0xd46e('0x15')](handleError(_0x148187,null));};exports[_0xd46e('0x4f')]=function(_0xbce76f,_0x502f37){return respondWithRpcPromise(_0xd46e('0x4e'),_0xbce76f[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](findById(_0xbce76f[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x502f37,null))[_0xd46e('0x15')](handleError(_0x502f37,null));};exports[_0xd46e('0x50')]=function(_0x41057c,_0x24be84){return respondWithRpcPromise('FaxQueues',_0x41057c['query'],routingClient)[_0xd46e('0x14')](respondWithResult(_0x24be84,null))[_0xd46e('0x15')](handleError(_0x24be84,null));};exports[_0xd46e('0x51')]=function(_0x2fff69,_0x249938){return respondWithRpcPromise('FaxQueues',_0x2fff69[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](findById(_0x2fff69[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x249938,null))['catch'](handleError(_0x249938,null));};exports[_0xd46e('0x52')]=function(_0x9dd439,_0x5a36df){return respondWithRpcPromise(_0xd46e('0x53'),_0x9dd439[_0xd46e('0x13')])['then'](respondWithResult(_0x5a36df,null))[_0xd46e('0x15')](handleError(_0x5a36df,null));};exports[_0xd46e('0x54')]=function(_0x566e65,_0x44ba36){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x566e65[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x44ba36,null))['catch'](handleError(_0x44ba36,null));};exports['mailQueuesWaitingInteractions']=function(_0x475133,_0x3eb6b){return respondWithRpcPromise(_0xd46e('0x55'),_0x475133[_0xd46e('0x13')],routingClient)['then'](respondWithResult(_0x3eb6b,null))[_0xd46e('0x15')](handleError(_0x3eb6b,null));};exports[_0xd46e('0x56')]=function(_0x510a1e,_0x10bcdb){return respondWithRpcPromise(_0xd46e('0x57'),_0x510a1e[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x10bcdb,null))[_0xd46e('0x15')](handleError(_0x10bcdb,null));};exports[_0xd46e('0x58')]=function(_0x21f193,_0xaf7c79){return respondWithRpcPromise(_0xd46e('0x57'),_0x21f193['query'],routingClient)[_0xd46e('0x14')](function(_0x1c1bae){if(_0x21f193['query'][_0xd46e('0x59')]!==undefined){var _0x3ba83f=_(_0x1c1bae[_0xd46e('0x11')])[_0xd46e('0x5a')]([_0x21f193[_0xd46e('0x13')][_0xd46e('0x59')],_0x21f193['params']['id']])['map'](_0xd46e('0x5b'))[_0xd46e('0x5c')]()['value']();return _0x1c1bae['rows']['filter'](function(_0x825746){return _0x3ba83f[_0xd46e('0x5d')](_0x825746[_0xd46e('0x5b')])>-0x1;});}else{return _0x1c1bae['rows'][_0xd46e('0x5a')](function(_0x69ade9){return _0x69ade9[_0xd46e('0x5b')]===parseInt(_0x21f193['params']['id']);});}})['then'](respondWithResult(_0xaf7c79,null))['catch'](handleError(_0xaf7c79,null));};exports['smsQueuesWaitingInteractions']=function(_0x2d4410,_0x5d7c51){return respondWithRpcPromise(_0xd46e('0x5e'),_0x2d4410['query'],routingClient)['then'](respondWithResult(_0x5d7c51,null))[_0xd46e('0x15')](handleError(_0x5d7c51,null));};exports[_0xd46e('0x5f')]=function(_0x3df2c2,_0x2754ff){return respondWithRpcPromise(_0xd46e('0x60'),_0x3df2c2[_0xd46e('0x13')],routingClient)['then'](respondWithResult(_0x2754ff,null))['catch'](handleError(_0x2754ff,null));};exports[_0xd46e('0x61')]=function(_0x383919,_0x114f2c){return respondWithRpcPromise(_0xd46e('0x62'),_0x383919['query'],routingClient)[_0xd46e('0x14')](respondWithResult(_0x114f2c,null))[_0xd46e('0x15')](handleError(_0x114f2c,null));};exports['queueNotify']=function(_0x1309b5){return function(_0x483ef1,_0x2abaee){var _0x24a2e1,_0x5b54b6;var _0x59fb83=_[_0xd46e('0x63')](_0x1309b5);var _0x2c11b8=_0x1309b5===_0xd46e('0x64')?'Website':_0xd46e('0x65');return db[_0x59fb83+_0xd46e('0x66')][_0xd46e('0x67')]({'raw':!![],'where':{'id':_0x483ef1[_0xd46e('0x1b')]['id']}})[_0xd46e('0x14')](function(_0x88460a){if(_[_0xd46e('0x10')](_0x88460a)){throw new Error(_0x59fb83+_0xd46e('0x68'));}_0x24a2e1=_0x88460a;return db[_0x59fb83+_0xd46e('0x69')][_0xd46e('0x67')]({'where':{'id':_0x483ef1[_0xd46e('0x1f')][_0xd46e('0x6a')]},'include':[{'model':db[_0x59fb83+_0xd46e('0x6b')],'as':_0xd46e('0x6b')},{'model':db[_0x59fb83+_0x2c11b8],'as':_0xd46e('0x65')}]});})[_0xd46e('0x14')](function(_0x441f73){if(_[_0xd46e('0x10')](_0x441f73)){throw new Error(_0x59fb83+'\x20Message\x20not\x20found');}_0x5b54b6=_0x441f73;return _0x441f73[_0xd46e('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3436ff={'uniqueid':_0x1309b5+'.'+_0x5b54b6['id']+'.'+_0x5b54b6[_0xd46e('0x6b')]['id'],'FromUserId':_0x483ef1['user']['id'],'type':_0xd46e('0x6d')};_0x3436ff[_0x59fb83+_0xd46e('0x6e')]=_0x5b54b6['id'];_0x3436ff[_0x59fb83+_0xd46e('0x6f')]=_0x5b54b6[_0xd46e('0x6b')]['id'];_0x3436ff[_0xd46e('0x70')+_0x59fb83+_0x2c11b8+'Id']=_0x5b54b6[_0xd46e('0x65')]['id'];_0x3436ff['To'+_0x59fb83+_0xd46e('0x71')]=_0x24a2e1['id'];return db[_0x59fb83+_0xd46e('0x72')][_0xd46e('0x73')](_0x3436ff);})[_0xd46e('0x14')](function(){return respondWithRpcPromise(_0xd46e('0x74'),{'channel':_0x1309b5,'interaction':_0x5b54b6['Interaction'],'message':_0x5b54b6,'account':_0x5b54b6['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xd46e('0x6d'),'appdata':_0x24a2e1[_0xd46e('0xe')]+','+(_0x5b54b6[_0xd46e('0x65')][_0xd46e('0x75')]||0x12c),'interval':_0xd46e('0x76')}]},routingClient);})[_0xd46e('0x14')](respondWithResult(_0x2abaee,null))['catch'](handleError(_0x2abaee,null));};};exports[_0xd46e('0x77')]=function(_0x127604,_0xa254f5){var _0x2c9703,_0x41443d;if(_[_0xd46e('0x10')](_0x127604['body'][_0xd46e('0x78')])){throw new Error(_0xd46e('0x79'));}var _0x59067a=_0x127604[_0xd46e('0x1f')][_0xd46e('0x78')];var _0x9e222d=_[_0xd46e('0x63')](_0x59067a);var _0x97ee80=_0x59067a===_0xd46e('0x64')?_0xd46e('0x7a'):_0xd46e('0x65');return db[_0xd46e('0x7b')][_0xd46e('0x67')]({'raw':!![],'where':{'id':_0x127604[_0xd46e('0x1b')]['id'],'role':_0xd46e('0x3a')}})[_0xd46e('0x14')](function(_0x30dcfc){if(_['isNil'](_0x30dcfc)){throw new Error('Agent\x20not\x20found');}_0x2c9703=_0x30dcfc;return db[_0x9e222d+_0xd46e('0x69')][_0xd46e('0x67')]({'where':{'id':_0x127604[_0xd46e('0x1f')][_0xd46e('0x6a')]},'include':[{'model':db[_0x9e222d+_0xd46e('0x6b')],'as':_0xd46e('0x6b')},{'model':db[_0x9e222d+_0x97ee80],'as':'Account'}]});})[_0xd46e('0x14')](function(_0x216143){if(_[_0xd46e('0x10')](_0x216143)){throw new Error(_0x9e222d+_0xd46e('0x7c'));}_0x41443d=_0x216143;return _0x216143['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xd46e('0x14')](function(){var _0x191b48={'uniqueid':_0x59067a+'.'+_0x41443d['id']+'.'+_0x41443d['Interaction']['id'],'FromUserId':_0x127604[_0xd46e('0x2f')]['id'],'type':'queue','ToUserId':_0x2c9703['id']};_0x191b48[_0x9e222d+'MessageId']=_0x41443d['id'];_0x191b48[_0x9e222d+_0xd46e('0x6f')]=_0x41443d[_0xd46e('0x6b')]['id'];_0x191b48[_0xd46e('0x70')+_0x9e222d+_0x97ee80+'Id']=_0x41443d[_0xd46e('0x65')]['id'];return db[_0x9e222d+'TransferReport']['create'](_0x191b48);})[_0xd46e('0x14')](function(){return respondWithRpcPromise('Start',{'channel':_0x59067a,'interaction':_0x41443d[_0xd46e('0x6b')],'message':_0x41443d,'account':_0x41443d['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x2c9703[_0xd46e('0xe')]+','+(_0x41443d[_0xd46e('0x65')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xd46e('0x14')](respondWithResult(_0xa254f5,null))[_0xd46e('0x15')](handleError(_0xa254f5,null));}; \ No newline at end of file +var _0xed1f=['voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','then','voiceChannelStopMixMonitor','params','voiceQueues','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','OutboundChannels','agents','Agents','interaction','user','hasOwnProperty','MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','interface','SIP/%s','agent','internal','AgentCapacity','telephones','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','filter','type','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','queue','MessageId','From','QueueId','TransferReport','create','Start','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','capitalize','chat','User','update','InteractionId','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','error','code','message','catch','json','sendStatus','stack','name','status','isNil','rows','find','VoiceChannels','query'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xed1f,0x6a));var _0xfed1=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xed1f[_0x45783c];return _0x1161da;};'use strict';var BPromise=require(_0xfed1('0x0'));var moment=require(_0xfed1('0x1'));var _=require(_0xfed1('0x2'));var util=require(_0xfed1('0x3'));var db=require(_0xfed1('0x4'))['db'];var logger=require(_0xfed1('0x5'))(_0xfed1('0x6'));var jayson=require(_0xfed1('0x7'));var amiClient=jayson[_0xfed1('0x8')][_0xfed1('0x9')]({'port':0x232a});var mailClient=jayson[_0xfed1('0x8')][_0xfed1('0x9')]({'port':0x232b});var routingClient=jayson[_0xfed1('0x8')][_0xfed1('0x9')]({'port':0x232c});function respondWithRpcPromise(_0x380e18,_0x612b38,_0x2a6082){return new BPromise(function(_0x2967ef,_0x568d48){var _0x42dd5c=_0x2a6082?_0x2a6082:amiClient;return _0x42dd5c[_0xfed1('0xa')](_0x380e18,_0x612b38)['then'](function(_0x1414be){if(_0x1414be[_0xfed1('0xb')]){if(_0x1414be['error'][_0xfed1('0xc')]===0x1f4){return _0x568d48(_0x1414be['error'][_0xfed1('0xd')]);}return _0x2967ef(_0x1414be[_0xfed1('0xb')]['message']);}else{_0x2967ef(_0x1414be['result']);}})[_0xfed1('0xe')](function(_0xe84ba6){_0x568d48(_0xe84ba6);});});}function respondWithResult(_0x569a6e,_0x17f4fe){_0x17f4fe=_0x17f4fe||0xc8;return function(_0x5a3469){if(_0x5a3469){return _0x569a6e['status'](_0x17f4fe)[_0xfed1('0xf')](_0x5a3469);}return _0x569a6e[_0xfed1('0x10')](0x194);};}function handleError(_0x532537,_0x2dde3a){_0x2dde3a=_0x2dde3a||0x1f4;return function(_0x5b9455){logger['error'](_0x5b9455[_0xfed1('0x11')]);if(_0x5b9455[_0xfed1('0x12')]){delete _0x5b9455[_0xfed1('0x12')];}_0x532537[_0xfed1('0x13')](_0x2dde3a)['send'](_0x5b9455);};}function findById(_0x1a00f6){return function(_0x4af928){if(!_[_0xfed1('0x14')](_0x1a00f6)&&!_[_0xfed1('0x14')](_0x4af928)&&!_['isNil'](_0x4af928[_0xfed1('0x15')])){return _[_0xfed1('0x16')](_0x4af928['rows'],function(_0x59509b){return _0x59509b['id']==_0x1a00f6;});}return null;};}exports['voiceChannels']=function(_0x1e5afb,_0x51f12a){return respondWithRpcPromise(_0xfed1('0x17'),_0x1e5afb[_0xfed1('0x18')])['then'](respondWithResult(_0x51f12a,null))[_0xfed1('0xe')](handleError(_0x51f12a,null));};exports[_0xfed1('0x19')]=function(_0x59ee9d,_0x3ce944){return respondWithRpcPromise(_0xfed1('0x1a'),_[_0xfed1('0x1b')](_0x59ee9d[_0xfed1('0x18')],_0x59ee9d['params']))[_0xfed1('0x1c')](respondWithResult(_0x3ce944,null))['catch'](handleError(_0x3ce944,null));};exports[_0xfed1('0x1d')]=function(_0x1317c8,_0x37c384){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0xfed1('0x1b')](_0x1317c8['query'],_0x1317c8[_0xfed1('0x1e')]))[_0xfed1('0x1c')](respondWithResult(_0x37c384,null))[_0xfed1('0xe')](handleError(_0x37c384,null));};exports[_0xfed1('0x1f')]=function(_0x186ecc,_0x1199b7){return respondWithRpcPromise('VoiceQueues',_0x186ecc[_0xfed1('0x18')])[_0xfed1('0x1c')](respondWithResult(_0x1199b7,null))['catch'](handleError(_0x1199b7,null));};exports[_0xfed1('0x20')]=function(_0x2b9dd2,_0x1b871a){return respondWithRpcPromise(_0xfed1('0x21'),_0x2b9dd2[_0xfed1('0x18')])[_0xfed1('0x1c')](findById(_0x2b9dd2['params']['id']))[_0xfed1('0x1c')](respondWithResult(_0x1b871a,null))['catch'](handleError(_0x1b871a,null));};exports[_0xfed1('0x22')]=function(_0x4e5249,_0x53b0c9){return respondWithRpcPromise(_0xfed1('0x23'),_[_0xfed1('0x1b')](_0x4e5249[_0xfed1('0x24')],_0x4e5249['params']))[_0xfed1('0x1c')](respondWithResult(_0x53b0c9,null))[_0xfed1('0xe')](handleError(_0x53b0c9,null));};exports[_0xfed1('0x25')]=function(_0x383955,_0x12399f){return respondWithRpcPromise(_0xfed1('0x26'),_['merge'](_0x383955[_0xfed1('0x18')],_0x383955[_0xfed1('0x1e')]))['then'](respondWithResult(_0x12399f,null))['catch'](handleError(_0x12399f,null));};exports[_0xfed1('0x27')]=function(_0x2d10f5,_0x2def09){return respondWithRpcPromise(_0xfed1('0x28'),_0x2d10f5[_0xfed1('0x18')])['then'](respondWithResult(_0x2def09,null))[_0xfed1('0xe')](handleError(_0x2def09,null));};exports[_0xfed1('0x29')]=function(_0x10143b,_0x349de1){return respondWithRpcPromise(_0xfed1('0x2a'),_['merge'](_0x10143b[_0xfed1('0x18')],_0x10143b['params']))[_0xfed1('0x1c')](respondWithResult(_0x349de1,null))[_0xfed1('0xe')](handleError(_0x349de1,null));};exports[_0xfed1('0x2b')]=function(_0x321c1b,_0x1c0523){return respondWithRpcPromise(_0xfed1('0x2c'),_[_0xfed1('0x1b')](_0x321c1b[_0xfed1('0x18')],_0x321c1b['params']))[_0xfed1('0x1c')](respondWithResult(_0x1c0523,null))[_0xfed1('0xe')](handleError(_0x1c0523,null));};exports[_0xfed1('0x2d')]=function(_0x28adfc,_0x57da75){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xfed1('0x1b')](_0x28adfc[_0xfed1('0x18')],_0x28adfc[_0xfed1('0x1e')]))[_0xfed1('0x1c')](respondWithResult(_0x57da75,null))[_0xfed1('0xe')](handleError(_0x57da75,null));};exports[_0xfed1('0x2e')]=function(_0x46a150,_0x2f183c){return respondWithRpcPromise('Outbound',_0x46a150['query'])[_0xfed1('0x1c')](respondWithResult(_0x2f183c,null))[_0xfed1('0xe')](handleError(_0x2f183c,null));};exports['outboundChannels']=function(_0x1dae7c,_0x15339c){return respondWithRpcPromise(_0xfed1('0x2f'),_0x1dae7c[_0xfed1('0x18')])[_0xfed1('0x1c')](respondWithResult(_0x15339c,null))[_0xfed1('0xe')](handleError(_0x15339c,null));};exports[_0xfed1('0x30')]=function(_0x4118d4,_0x3c27de){var _0x5f3e1f;return respondWithRpcPromise('Agents',_0x4118d4['query'])[_0xfed1('0x1c')](function(_0x340e3c){_0x5f3e1f=_0x340e3c;return respondWithRpcPromise(_0xfed1('0x31'),_0x4118d4['query'],routingClient);})[_0xfed1('0x1c')](function(_0x4a0b04){return _[_0xfed1('0x1b')]({},_0x4a0b04,_0x5f3e1f);})[_0xfed1('0x1c')](respondWithResult(_0x3c27de,null))[_0xfed1('0xe')](handleError(_0x3c27de,null));};exports['agentCapacity']=function(_0x20bdae,_0x6f1647){if(_0x20bdae[_0xfed1('0x24')]&&_0x20bdae['body'][_0xfed1('0x32')]&&_0x20bdae['user']&&_0x20bdae[_0xfed1('0x33')][_0xfed1('0x12')]){for(var _0x229fc7 in _0x20bdae[_0xfed1('0x24')][_0xfed1('0x32')]){if(_0x20bdae[_0xfed1('0x24')][_0xfed1('0x32')][_0xfed1('0x34')](_0x229fc7)){db[_0xfed1('0x35')]['findAll']({'where':{'channel':_0x229fc7,'membername':_0x20bdae[_0xfed1('0x33')][_0xfed1('0x12')],'type':_0xfed1('0x36'),'exitAt':null,'uniqueid':_0x20bdae['body']['interaction'][_0x229fc7]&&_0x20bdae[_0xfed1('0x24')][_0xfed1('0x32')][_0x229fc7][_0xfed1('0x37')]?{'$notIn':_0x20bdae[_0xfed1('0x24')][_0xfed1('0x32')][_0x229fc7]}:{'$ne':null}}})[_0xfed1('0x1c')](function(_0x2547ee){var _0x24bf7a=moment()[_0xfed1('0x38')](_0xfed1('0x39'));for(var _0x61f65b=0x0,_0x1db6dc=_0x2547ee['length'];_0x61f65b<_0x1db6dc;_0x61f65b+=0x1){_0x2547ee[_0x61f65b][_0xfed1('0x3a')]({'exitAt':_0x24bf7a});}});for(var _0xb61d09=0x0;_0xb61d09<_0x20bdae[_0xfed1('0x24')][_0xfed1('0x32')][_0x229fc7][_0xfed1('0x37')];_0xb61d09+=0x1){db[_0xfed1('0x35')]['findOrCreate']({'where':{'channel':_0x229fc7,'membername':_0x20bdae[_0xfed1('0x33')][_0xfed1('0x12')],'type':_0xfed1('0x36'),'uniqueid':_0x20bdae['body'][_0xfed1('0x32')][_0x229fc7][_0xb61d09],'exitAt':null},'defaults':{'channel':_0x229fc7,'membername':_0x20bdae[_0xfed1('0x33')][_0xfed1('0x12')],'interface':_[_0xfed1('0x14')](_0x20bdae['user'][_0xfed1('0x3b')])?util[_0xfed1('0x38')](_0xfed1('0x3c'),_0x20bdae[_0xfed1('0x33')][_0xfed1('0x12')]):_0x20bdae[_0xfed1('0x33')][_0xfed1('0x3b')],'type':_0xfed1('0x36'),'enterAt':moment()[_0xfed1('0x38')](_0xfed1('0x39')),'role':_0xfed1('0x3d'),'internal':_0x20bdae[_0xfed1('0x33')][_0xfed1('0x3e')],'uniqueid':_0x20bdae[_0xfed1('0x24')][_0xfed1('0x32')][_0x229fc7][_0xb61d09]}});}}}}return respondWithRpcPromise(_0xfed1('0x3f'),{'id':_0x20bdae[_0xfed1('0x1e')]['id'],'capacity':_0x20bdae[_0xfed1('0x24')]['capacity']},routingClient)['then'](respondWithResult(_0x6f1647,null))[_0xfed1('0xe')](handleError(_0x6f1647,null));};exports[_0xfed1('0x40')]=function(_0x5be0c3,_0x1358c1){return respondWithRpcPromise('Telephones',_0x5be0c3[_0xfed1('0x18')])[_0xfed1('0x1c')](respondWithResult(_0x1358c1,null))['catch'](handleError(_0x1358c1,null));};exports['trunks']=function(_0x49f696,_0x2376b3){return respondWithRpcPromise(_0xfed1('0x41'),_0x49f696[_0xfed1('0x18')])[_0xfed1('0x1c')](respondWithResult(_0x2376b3,null))[_0xfed1('0xe')](handleError(_0x2376b3,null));};exports[_0xfed1('0x42')]=function(_0x1a9f22,_0x144102){return respondWithRpcPromise(_0xfed1('0x43'),_0x1a9f22[_0xfed1('0x18')])['then'](respondWithResult(_0x144102,null))['catch'](handleError(_0x144102,null));};exports[_0xfed1('0x44')]=function(_0x2a2eaa,_0x3f4db7){return respondWithRpcPromise(_0xfed1('0x45'),_0x2a2eaa[_0xfed1('0x18')],routingClient)[_0xfed1('0x1c')](respondWithResult(_0x3f4db7,null))[_0xfed1('0xe')](handleError(_0x3f4db7,null));};exports[_0xfed1('0x46')]=function(_0x117e25,_0x427fa6){return respondWithRpcPromise(_0xfed1('0x45'),_0x117e25[_0xfed1('0x18')],routingClient)[_0xfed1('0x1c')](findById(_0x117e25[_0xfed1('0x1e')]['id']))[_0xfed1('0x1c')](respondWithResult(_0x427fa6,null))[_0xfed1('0xe')](handleError(_0x427fa6,null));};exports[_0xfed1('0x47')]=function(_0x54eb53,_0x5b167b){return respondWithRpcPromise(_0xfed1('0x48'),_0x54eb53[_0xfed1('0x18')],routingClient)[_0xfed1('0x1c')](respondWithResult(_0x5b167b,null))[_0xfed1('0xe')](handleError(_0x5b167b,null));};exports[_0xfed1('0x49')]=function(_0x41a22a,_0x2ccdc3){return respondWithRpcPromise(_0xfed1('0x48'),_0x41a22a[_0xfed1('0x18')],routingClient)[_0xfed1('0x1c')](findById(_0x41a22a[_0xfed1('0x1e')]['id']))[_0xfed1('0x1c')](respondWithResult(_0x2ccdc3,null))[_0xfed1('0xe')](handleError(_0x2ccdc3,null));};exports[_0xfed1('0x4a')]=function(_0x59ecc4,_0x30cf99){return respondWithRpcPromise('MailAccounts',_0x59ecc4['query'],mailClient)[_0xfed1('0x1c')](respondWithResult(_0x30cf99,null))['catch'](handleError(_0x30cf99,null));};exports[_0xfed1('0x4b')]=function(_0x5acc45,_0x390fc0){return respondWithRpcPromise(_0xfed1('0x4c'),_0x5acc45['query'],routingClient)[_0xfed1('0x1c')](respondWithResult(_0x390fc0,null))[_0xfed1('0xe')](handleError(_0x390fc0,null));};exports['showOpenchannelQueues']=function(_0x29b51e,_0x41b407){return respondWithRpcPromise(_0xfed1('0x4c'),_0x29b51e[_0xfed1('0x18')],routingClient)['then'](findById(_0x29b51e[_0xfed1('0x1e')]['id']))[_0xfed1('0x1c')](respondWithResult(_0x41b407,null))[_0xfed1('0xe')](handleError(_0x41b407,null));};exports[_0xfed1('0x4d')]=function(_0x23347a,_0xf4e660){return respondWithRpcPromise(_0xfed1('0x4e'),_0x23347a[_0xfed1('0x18')],routingClient)['then'](respondWithResult(_0xf4e660,null))[_0xfed1('0xe')](handleError(_0xf4e660,null));};exports[_0xfed1('0x4f')]=function(_0x18e958,_0x4112c1){return respondWithRpcPromise(_0xfed1('0x4e'),_0x18e958[_0xfed1('0x18')],routingClient)['then'](findById(_0x18e958['params']['id']))['then'](respondWithResult(_0x4112c1,null))[_0xfed1('0xe')](handleError(_0x4112c1,null));};exports[_0xfed1('0x50')]=function(_0x3aea22,_0x2fb9b2){return respondWithRpcPromise('WhatsappQueues',_0x3aea22[_0xfed1('0x18')],routingClient)['then'](respondWithResult(_0x2fb9b2,null))[_0xfed1('0xe')](handleError(_0x2fb9b2,null));};exports[_0xfed1('0x51')]=function(_0x18af7d,_0x3beef3){return respondWithRpcPromise(_0xfed1('0x52'),_0x18af7d['query'],routingClient)[_0xfed1('0x1c')](findById(_0x18af7d[_0xfed1('0x1e')]['id']))[_0xfed1('0x1c')](respondWithResult(_0x3beef3,null))['catch'](handleError(_0x3beef3,null));};exports[_0xfed1('0x53')]=function(_0x103628,_0x28dbaa){return respondWithRpcPromise(_0xfed1('0x54'),_0x103628['query'],routingClient)[_0xfed1('0x1c')](respondWithResult(_0x28dbaa,null))['catch'](handleError(_0x28dbaa,null));};exports[_0xfed1('0x55')]=function(_0x2d64d3,_0x4b685b){return respondWithRpcPromise('FaxQueues',_0x2d64d3[_0xfed1('0x18')],routingClient)[_0xfed1('0x1c')](findById(_0x2d64d3[_0xfed1('0x1e')]['id']))[_0xfed1('0x1c')](respondWithResult(_0x4b685b,null))['catch'](handleError(_0x4b685b,null));};exports[_0xfed1('0x56')]=function(_0x440e40,_0x42bc11){return respondWithRpcPromise(_0xfed1('0x57'),_0x440e40[_0xfed1('0x18')])[_0xfed1('0x1c')](respondWithResult(_0x42bc11,null))['catch'](handleError(_0x42bc11,null));};exports[_0xfed1('0x58')]=function(_0x93411d,_0x5ceedd){return respondWithRpcPromise(_0xfed1('0x59'),_0x93411d[_0xfed1('0x18')],routingClient)[_0xfed1('0x1c')](respondWithResult(_0x5ceedd,null))[_0xfed1('0xe')](handleError(_0x5ceedd,null));};exports[_0xfed1('0x5a')]=function(_0x26ecb9,_0x4fc7b5){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x26ecb9[_0xfed1('0x18')],routingClient)['then'](respondWithResult(_0x4fc7b5,null))[_0xfed1('0xe')](handleError(_0x4fc7b5,null));};exports[_0xfed1('0x5b')]=function(_0x5d8742,_0xdc237c){return respondWithRpcPromise(_0xfed1('0x5c'),_0x5d8742[_0xfed1('0x18')],routingClient)[_0xfed1('0x1c')](respondWithResult(_0xdc237c,null))[_0xfed1('0xe')](handleError(_0xdc237c,null));};exports[_0xfed1('0x5d')]=function(_0x4104fe,_0x49213b){return respondWithRpcPromise(_0xfed1('0x5c'),_0x4104fe[_0xfed1('0x18')],routingClient)['then'](function(_0x544605){if(_0x4104fe[_0xfed1('0x18')]['type']!==undefined){var _0x1f4e2b=_(_0x544605[_0xfed1('0x15')])[_0xfed1('0x5e')]([_0x4104fe['query'][_0xfed1('0x5f')],_0x4104fe[_0xfed1('0x1e')]['id']])[_0xfed1('0x60')](_0xfed1('0x61'))[_0xfed1('0x62')]()['value']();return _0x544605[_0xfed1('0x15')][_0xfed1('0x5e')](function(_0x45348d){return _0x1f4e2b[_0xfed1('0x63')](_0x45348d[_0xfed1('0x61')])>-0x1;});}else{return _0x544605['rows'][_0xfed1('0x5e')](function(_0xe74336){return _0xe74336[_0xfed1('0x61')]===parseInt(_0x4104fe[_0xfed1('0x1e')]['id']);});}})[_0xfed1('0x1c')](respondWithResult(_0x49213b,null))[_0xfed1('0xe')](handleError(_0x49213b,null));};exports[_0xfed1('0x64')]=function(_0x4238bd,_0x390eb0){return respondWithRpcPromise(_0xfed1('0x65'),_0x4238bd['query'],routingClient)[_0xfed1('0x1c')](respondWithResult(_0x390eb0,null))[_0xfed1('0xe')](handleError(_0x390eb0,null));};exports[_0xfed1('0x66')]=function(_0x383d34,_0x194f42){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x383d34[_0xfed1('0x18')],routingClient)[_0xfed1('0x1c')](respondWithResult(_0x194f42,null))[_0xfed1('0xe')](handleError(_0x194f42,null));};exports[_0xfed1('0x67')]=function(_0x221ed8,_0xb76860){return respondWithRpcPromise(_0xfed1('0x68'),_0x221ed8[_0xfed1('0x18')],routingClient)[_0xfed1('0x1c')](respondWithResult(_0xb76860,null))['catch'](handleError(_0xb76860,null));};exports['queueNotify']=function(_0xc3b72a){return function(_0x547d9c,_0x25cebc){var _0x3ab92e,_0x483b16;var _0x4b355d=_['capitalize'](_0xc3b72a);var _0x304cc0=_0xc3b72a==='chat'?_0xfed1('0x69'):'Account';return db[_0x4b355d+_0xfed1('0x6a')][_0xfed1('0x6b')]({'raw':!![],'where':{'id':_0x547d9c[_0xfed1('0x1e')]['id']}})[_0xfed1('0x1c')](function(_0x3c6ddd){if(_['isNil'](_0x3c6ddd)){throw new Error(_0x4b355d+_0xfed1('0x6c'));}_0x3ab92e=_0x3c6ddd;return db[_0x4b355d+_0xfed1('0x6d')]['findOne']({'where':{'id':_0x547d9c[_0xfed1('0x24')][_0xfed1('0x6e')]},'include':[{'model':db[_0x4b355d+'Interaction'],'as':_0xfed1('0x6f')},{'model':db[_0x4b355d+_0x304cc0],'as':_0xfed1('0x70')}]});})[_0xfed1('0x1c')](function(_0x5cf634){if(_[_0xfed1('0x14')](_0x5cf634)){throw new Error(_0x4b355d+_0xfed1('0x71'));}_0x483b16=_0x5cf634;return _0x5cf634['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xfed1('0x1c')](function(){var _0xc81c8f={'uniqueid':_0xc3b72a+'.'+_0x483b16['id']+'.'+_0x483b16[_0xfed1('0x6f')]['id'],'FromUserId':_0x547d9c['user']['id'],'type':_0xfed1('0x72')};_0xc81c8f[_0x4b355d+_0xfed1('0x73')]=_0x483b16['id'];_0xc81c8f[_0x4b355d+'InteractionId']=_0x483b16['Interaction']['id'];_0xc81c8f[_0xfed1('0x74')+_0x4b355d+_0x304cc0+'Id']=_0x483b16[_0xfed1('0x70')]['id'];_0xc81c8f['To'+_0x4b355d+_0xfed1('0x75')]=_0x3ab92e['id'];return db[_0x4b355d+_0xfed1('0x76')][_0xfed1('0x77')](_0xc81c8f);})[_0xfed1('0x1c')](function(){return respondWithRpcPromise(_0xfed1('0x78'),{'channel':_0xc3b72a,'interaction':_0x483b16[_0xfed1('0x6f')],'message':_0x483b16,'account':_0x483b16[_0xfed1('0x70')],'applications':[{'id':0x0,'priority':0x1,'app':_0xfed1('0x72'),'appdata':_0x3ab92e[_0xfed1('0x12')]+','+(_0x483b16[_0xfed1('0x70')]['queueTransferTimeout']||0x12c),'interval':_0xfed1('0x79')}]},routingClient);})[_0xfed1('0x1c')](respondWithResult(_0x25cebc,null))['catch'](handleError(_0x25cebc,null));};};exports[_0xfed1('0x7a')]=function(_0x1f721d,_0x5f5d42){var _0x3d4aee,_0x408ee0;if(_[_0xfed1('0x14')](_0x1f721d[_0xfed1('0x24')]['channel'])){throw new Error(_0xfed1('0x7b'));}var _0x24ab18=_0x1f721d[_0xfed1('0x24')][_0xfed1('0x7c')];var _0x1ecef6=_[_0xfed1('0x7d')](_0x24ab18);var _0x2d0cbb=_0x24ab18===_0xfed1('0x7e')?'Website':_0xfed1('0x70');return db[_0xfed1('0x7f')][_0xfed1('0x6b')]({'raw':!![],'where':{'id':_0x1f721d['params']['id'],'role':_0xfed1('0x3d')}})[_0xfed1('0x1c')](function(_0x45a677){if(_['isNil'](_0x45a677)){throw new Error('Agent\x20not\x20found');}_0x3d4aee=_0x45a677;return db[_0x1ecef6+_0xfed1('0x6d')][_0xfed1('0x6b')]({'where':{'id':_0x1f721d[_0xfed1('0x24')][_0xfed1('0x6e')]},'include':[{'model':db[_0x1ecef6+_0xfed1('0x6f')],'as':_0xfed1('0x6f')},{'model':db[_0x1ecef6+_0x2d0cbb],'as':_0xfed1('0x70')}]});})[_0xfed1('0x1c')](function(_0x130eb2){if(_[_0xfed1('0x14')](_0x130eb2)){throw new Error(_0x1ecef6+_0xfed1('0x71'));}_0x408ee0=_0x130eb2;return _0x130eb2[_0xfed1('0x80')]({'read':0x0,'readAt':null,'UserId':null});})[_0xfed1('0x1c')](function(){var _0x18b086={'uniqueid':_0x24ab18+'.'+_0x408ee0['id']+'.'+_0x408ee0[_0xfed1('0x6f')]['id'],'FromUserId':_0x1f721d[_0xfed1('0x33')]['id'],'type':_0xfed1('0x72'),'ToUserId':_0x3d4aee['id']};_0x18b086[_0x1ecef6+_0xfed1('0x73')]=_0x408ee0['id'];_0x18b086[_0x1ecef6+_0xfed1('0x81')]=_0x408ee0[_0xfed1('0x6f')]['id'];_0x18b086['From'+_0x1ecef6+_0x2d0cbb+'Id']=_0x408ee0[_0xfed1('0x70')]['id'];return db[_0x1ecef6+_0xfed1('0x76')][_0xfed1('0x77')](_0x18b086);})['then'](function(){return respondWithRpcPromise(_0xfed1('0x78'),{'channel':_0x24ab18,'interaction':_0x408ee0[_0xfed1('0x6f')],'message':_0x408ee0,'account':_0x408ee0[_0xfed1('0x70')],'applications':[{'id':0x0,'priority':0x1,'app':_0xfed1('0x3d'),'appdata':_0x3d4aee[_0xfed1('0x12')]+','+(_0x408ee0[_0xfed1('0x70')][_0xfed1('0x82')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x5f5d42,null))[_0xfed1('0xe')](handleError(_0x5f5d42,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 3254413..5acc85b 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 _0x8481=['/:id','show','/:id/run','run','post','put','update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment','./schedule.controller','get','isAuthenticated','index'];(function(_0x215758,_0x212174){var _0x15e526=function(_0x39757d){while(--_0x39757d){_0x215758['push'](_0x215758['shift']());}};_0x15e526(++_0x212174);}(_0x8481,0x1be));var _0x1848=function(_0x122d9f,_0x2c9e5b){_0x122d9f=_0x122d9f-0x0;var _0x41a09e=_0x8481[_0x122d9f];return _0x41a09e;};'use strict';var multer=require(_0x1848('0x0'));var util=require(_0x1848('0x1'));var path=require('path');var timeout=require(_0x1848('0x2'));var express=require('express');var router=express[_0x1848('0x3')]();var fs_extra=require(_0x1848('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1848('0x5'));var controller=require(_0x1848('0x6'));router[_0x1848('0x7')]('/',auth[_0x1848('0x8')](),controller[_0x1848('0x9')]);router[_0x1848('0x7')](_0x1848('0xa'),auth['isAuthenticated'](),controller[_0x1848('0xb')]);router[_0x1848('0x7')](_0x1848('0xc'),auth['isAuthenticated'](),controller[_0x1848('0xd')]);router[_0x1848('0xe')]('/',auth[_0x1848('0x8')](),controller['create']);router[_0x1848('0xf')](_0x1848('0xa'),auth[_0x1848('0x8')](),controller[_0x1848('0x10')]);router[_0x1848('0x11')](_0x1848('0xa'),auth[_0x1848('0x8')](),controller['destroy']);module[_0x1848('0x12')]=router; \ No newline at end of file +var _0x67ed=['../../config/environment','./schedule.controller','isAuthenticated','index','get','/:id','show','/:id/run','run','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x67ed,0x101));var _0xd67e=function(_0x50e095,_0x1e1fd6){_0x50e095=_0x50e095-0x0;var _0xc0d9fa=_0x67ed[_0x50e095];return _0xc0d9fa;};'use strict';var multer=require(_0xd67e('0x0'));var util=require('util');var path=require(_0xd67e('0x1'));var timeout=require(_0xd67e('0x2'));var express=require(_0xd67e('0x3'));var router=express[_0xd67e('0x4')]();var fs_extra=require(_0xd67e('0x5'));var auth=require(_0xd67e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd67e('0x7'));var controller=require(_0xd67e('0x8'));router['get']('/',auth[_0xd67e('0x9')](),controller[_0xd67e('0xa')]);router[_0xd67e('0xb')](_0xd67e('0xc'),auth[_0xd67e('0x9')](),controller[_0xd67e('0xd')]);router['get'](_0xd67e('0xe'),auth[_0xd67e('0x9')](),controller[_0xd67e('0xf')]);router[_0xd67e('0x10')]('/',auth[_0xd67e('0x9')](),controller[_0xd67e('0x11')]);router[_0xd67e('0x12')](_0xd67e('0xc'),auth[_0xd67e('0x9')](),controller['update']);router[_0xd67e('0x13')](_0xd67e('0xc'),auth['isAuthenticated'](),controller[_0xd67e('0x14')]);module[_0xd67e('0x15')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index ab87216..ef53b28 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 _0x3c8c=['days','hours','minutes','csv','pdf','xlsx','custom','default','TEXT','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM','quarters','months','weeks'];(function(_0x3f3f31,_0x405858){var _0x3aa03b=function(_0x46d208){while(--_0x46d208){_0x3f3f31['push'](_0x3f3f31['shift']());}};_0x3aa03b(++_0x405858);}(_0x3c8c,0x15d));var _0xc3c8=function(_0x40991c,_0x44b859){_0x40991c=_0x40991c-0x0;var _0x2fcf03=_0x3c8c[_0x40991c];return _0x2fcf03;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc3c8('0x0')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xc3c8('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xc3c8('0x0')],'allowNull':![],'defaultValue':_0xc3c8('0x2')},'startAt':{'type':Sequelize[_0xc3c8('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0xc3c8('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xc3c8('0x4')]('years',_0xc3c8('0x5'),_0xc3c8('0x6'),_0xc3c8('0x7'),_0xc3c8('0x8'),_0xc3c8('0x9'),_0xc3c8('0xa')),'allowNull':![],'defaultValue':_0xc3c8('0x8')},'output':{'type':Sequelize[_0xc3c8('0x4')](_0xc3c8('0xb'),_0xc3c8('0xc'),_0xc3c8('0xd')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM'](_0xc3c8('0xe'),_0xc3c8('0xf')),'allowNull':![],'defaultValue':_0xc3c8('0xe')},'sendMail':{'type':Sequelize[_0xc3c8('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0xc3c8('0x0')]},'cc':{'type':Sequelize[_0xc3c8('0x10')]},'bcc':{'type':Sequelize[_0xc3c8('0x10')]},'sendIfEmpty':{'type':Sequelize[_0xc3c8('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0xdc7a=['days','csv','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','months','weeks'];(function(_0x1a1b6e,_0x3a07a9){var _0x571e2c=function(_0x6cea62){while(--_0x6cea62){_0x1a1b6e['push'](_0x1a1b6e['shift']());}};_0x571e2c(++_0x3a07a9);}(_0xdc7a,0x193));var _0xadc7=function(_0x2c07fb,_0x5ccb42){_0x2c07fb=_0x2c07fb-0x0;var _0x384859=_0xdc7a[_0x2c07fb];return _0x384859;};'use strict';var Sequelize=require(_0xadc7('0x0'));module[_0xadc7('0x1')]={'name':{'type':Sequelize[_0xadc7('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xadc7('0x2')]},'active':{'type':Sequelize[_0xadc7('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xadc7('0x2')],'allowNull':![],'defaultValue':_0xadc7('0x4')},'startAt':{'type':Sequelize[_0xadc7('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xadc7('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xadc7('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xadc7('0x7')](_0xadc7('0x8'),'quarters',_0xadc7('0x9'),_0xadc7('0xa'),_0xadc7('0xb'),'hours','minutes'),'allowNull':![],'defaultValue':_0xadc7('0xb')},'output':{'type':Sequelize['ENUM'](_0xadc7('0xc'),_0xadc7('0xd'),_0xadc7('0xe')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM'](_0xadc7('0xf'),_0xadc7('0x10')),'allowNull':![],'defaultValue':_0xadc7('0xf')},'sendMail':{'type':Sequelize[_0xadc7('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xadc7('0x2')]},'cc':{'type':Sequelize[_0xadc7('0x11')]},'bcc':{'type':Sequelize[_0xadc7('0x11')]},'sendIfEmpty':{'type':Sequelize[_0xadc7('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 644a710..ee7228f 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 _0xf744=['to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','status','json','undefined','limit','count','offset','set','reject','save','update','destroy','get','Scheduler','UserProfileResource','then','end','error','stack','name','send','index','Schedule','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','catch','show','params','find','create','body','user','role','autoAssociation','run','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x185725,_0x2f1361){var _0x59728a=function(_0x148935){while(--_0x148935){_0x185725['push'](_0x185725['shift']());}};_0x59728a(++_0x2f1361);}(_0xf744,0x1c1));var _0x4f74=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xf744[_0x1d24eb];return _0x1dc576;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4f74('0x0'));var zipdir=require(_0x4f74('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f74('0x2'));var moment=require(_0x4f74('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4f74('0x4'));var util=require(_0x4f74('0x5'));var path=require(_0x4f74('0x6'));var sox=require('sox');var csv=require(_0x4f74('0x7'));var ejs=require(_0x4f74('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4f74('0x9'));var crypto=require(_0x4f74('0xa'));var jsforce=require(_0x4f74('0xb'));var deskjs=require(_0x4f74('0xc'));var toCsv=require(_0x4f74('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4f74('0xd'));var authService=require(_0x4f74('0xe'));var qs=require(_0x4f74('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f74('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x4f74('0x11'));var config=require(_0x4f74('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x363d27,_0x360920){_0x360920=_0x360920||0xcc;return function(_0x2a26f7){if(_0x2a26f7){return _0x363d27['sendStatus'](_0x360920);}return _0x363d27['status'](_0x360920)['end']();};}function respondWithResult(_0x5521b5,_0x5f58eb){_0x5f58eb=_0x5f58eb||0xc8;return function(_0x2b4c51){if(_0x2b4c51){return _0x5521b5[_0x4f74('0x13')](_0x5f58eb)[_0x4f74('0x14')](_0x2b4c51);}};}function respondWithFilteredResult(_0x52ad39,_0x4d91d3){return function(_0x2c98e7){if(_0x2c98e7){var _0x479b17=typeof _0x4d91d3['offset']===_0x4f74('0x15')&&typeof _0x4d91d3[_0x4f74('0x16')]==='undefined';var _0x52ab96=_0x2c98e7['count'];var _0x1645b8=_0x479b17?0x0:_0x4d91d3['offset'];var _0x4c2bfd=_0x479b17?_0x2c98e7[_0x4f74('0x17')]:_0x4d91d3[_0x4f74('0x18')]+_0x4d91d3[_0x4f74('0x16')];var _0x2855a5;if(_0x4c2bfd>=_0x52ab96){_0x4c2bfd=_0x52ab96;_0x2855a5=0xc8;}else{_0x2855a5=0xce;}_0x52ad39[_0x4f74('0x13')](_0x2855a5);return _0x52ad39[_0x4f74('0x19')]('Content-Range',_0x1645b8+'-'+_0x4c2bfd+'/'+_0x52ab96)[_0x4f74('0x14')](_0x2c98e7);}return null;};}function patchUpdates(_0x234f6f){return function(_0x2e1237){try{jsonpatch['apply'](_0x2e1237,_0x234f6f,!![]);}catch(_0x5a0da4){return BPromise[_0x4f74('0x1a')](_0x5a0da4);}return _0x2e1237[_0x4f74('0x1b')]();};}function saveUpdates(_0x10396f,_0x26a22d){return function(_0xa1c553){if(_0xa1c553){return _0xa1c553[_0x4f74('0x1c')](_0x10396f)['then'](function(_0x1af234){return _0x1af234;});}return null;};}function removeEntity(_0x2fa2ec,_0x4e2bed){return function(_0x21e879){if(_0x21e879){return _0x21e879[_0x4f74('0x1d')]()['then'](function(){var _0xe26e50=_0x21e879[_0x4f74('0x1e')]({'plain':!![]});var _0x113c40=_0x4f74('0x1f');return db[_0x4f74('0x20')]['destroy']({'where':{'type':_0x113c40,'resourceId':_0xe26e50['id']}})[_0x4f74('0x21')](function(){return _0x21e879;});})[_0x4f74('0x21')](function(){_0x2fa2ec[_0x4f74('0x13')](0xcc)[_0x4f74('0x22')]();});}};}function handleEntityNotFound(_0x555baa,_0x491d81){return function(_0xf818c2){if(!_0xf818c2){_0x555baa['sendStatus'](0x194);}return _0xf818c2;};}function handleError(_0xb278fb,_0x9674c9){_0x9674c9=_0x9674c9||0x1f4;return function(_0x158b8e){logger[_0x4f74('0x23')](_0x158b8e[_0x4f74('0x24')]);if(_0x158b8e[_0x4f74('0x25')]){delete _0x158b8e[_0x4f74('0x25')];}_0xb278fb[_0x4f74('0x13')](_0x9674c9)[_0x4f74('0x26')](_0x158b8e);};}exports[_0x4f74('0x27')]=function(_0x2fee19,_0x4c3ed0){var _0x65cd91={},_0x51814={},_0xb56e1a={'count':0x0,'rows':[]};var _0x58db1f=_['map'](db[_0x4f74('0x28')][_0x4f74('0x29')],function(_0x14ca37){return{'name':_0x14ca37[_0x4f74('0x2a')],'type':_0x14ca37['type'][_0x4f74('0x2b')]};});_0x51814[_0x4f74('0x2c')]=_[_0x4f74('0x2d')](_0x58db1f,_0x4f74('0x25'));_0x51814[_0x4f74('0x2e')]=_[_0x4f74('0x2f')](_0x2fee19[_0x4f74('0x2e')]);_0x51814[_0x4f74('0x30')]=_[_0x4f74('0x31')](_0x51814[_0x4f74('0x2c')],_0x51814[_0x4f74('0x2e')]);_0x65cd91[_0x4f74('0x32')]=_[_0x4f74('0x31')](_0x51814[_0x4f74('0x2c')],qs[_0x4f74('0x33')](_0x2fee19['query'][_0x4f74('0x33')]));_0x65cd91[_0x4f74('0x32')]=_0x65cd91['attributes'][_0x4f74('0x34')]?_0x65cd91[_0x4f74('0x32')]:_0x51814['model'];if(!_0x2fee19[_0x4f74('0x2e')][_0x4f74('0x35')](_0x4f74('0x36'))){_0x65cd91[_0x4f74('0x16')]=qs[_0x4f74('0x16')](_0x2fee19[_0x4f74('0x2e')][_0x4f74('0x16')]);_0x65cd91[_0x4f74('0x18')]=qs['offset'](_0x2fee19[_0x4f74('0x2e')][_0x4f74('0x18')]);}_0x65cd91[_0x4f74('0x37')]=qs[_0x4f74('0x38')](_0x2fee19[_0x4f74('0x2e')][_0x4f74('0x38')]);_0x65cd91[_0x4f74('0x39')]=qs['filters'](_[_0x4f74('0x3a')](_0x2fee19['query'],_0x51814[_0x4f74('0x30')]),_0x58db1f);if(_0x2fee19['query'][_0x4f74('0x3b')]){_0x65cd91['where']=_[_0x4f74('0x3c')](_0x65cd91[_0x4f74('0x39')],{'$or':_[_0x4f74('0x2d')](_0x58db1f,function(_0x59b1bf){if(_0x59b1bf[_0x4f74('0x3d')]!==_0x4f74('0x3e')){var _0x49e297={};_0x49e297[_0x59b1bf[_0x4f74('0x25')]]={'$like':'%'+_0x2fee19[_0x4f74('0x2e')][_0x4f74('0x3b')]+'%'};return _0x49e297;}})});}_0x65cd91=_[_0x4f74('0x3c')]({},_0x65cd91,_0x2fee19['options']);var _0xa76074={'where':_0x65cd91[_0x4f74('0x39')]};return db['Schedule'][_0x4f74('0x17')](_0xa76074)[_0x4f74('0x21')](function(_0x81b2f7){_0xb56e1a[_0x4f74('0x17')]=_0x81b2f7;if(_0x2fee19[_0x4f74('0x2e')]['includeAll']){_0x65cd91[_0x4f74('0x3f')]=[{'all':!![]}];}return db[_0x4f74('0x28')][_0x4f74('0x40')](_0x65cd91);})[_0x4f74('0x21')](function(_0x34460e){_0xb56e1a[_0x4f74('0x41')]=_0x34460e;return _0xb56e1a;})[_0x4f74('0x21')](respondWithFilteredResult(_0x4c3ed0,_0x65cd91))[_0x4f74('0x42')](handleError(_0x4c3ed0,null));};exports[_0x4f74('0x43')]=function(_0x2f8cd5,_0x211546){var _0x5a2c19={'raw':![],'where':{'id':_0x2f8cd5[_0x4f74('0x44')]['id']}},_0x5991d3={};_0x5991d3[_0x4f74('0x2c')]=_[_0x4f74('0x2f')](db[_0x4f74('0x28')][_0x4f74('0x29')]);_0x5991d3[_0x4f74('0x2e')]=_[_0x4f74('0x2f')](_0x2f8cd5['query']);_0x5991d3['filters']=_[_0x4f74('0x31')](_0x5991d3['model'],_0x5991d3['query']);_0x5a2c19[_0x4f74('0x32')]=_[_0x4f74('0x31')](_0x5991d3[_0x4f74('0x2c')],qs[_0x4f74('0x33')](_0x2f8cd5[_0x4f74('0x2e')][_0x4f74('0x33')]));_0x5a2c19[_0x4f74('0x32')]=_0x5a2c19['attributes'][_0x4f74('0x34')]?_0x5a2c19[_0x4f74('0x32')]:_0x5991d3['model'];if(_0x2f8cd5['query']['includeAll']){_0x5a2c19['include']=[{'all':!![]}];}_0x5a2c19=_['merge']({},_0x5a2c19,_0x2f8cd5['options']);return db['Schedule'][_0x4f74('0x45')](_0x5a2c19)[_0x4f74('0x21')](handleEntityNotFound(_0x211546,null))[_0x4f74('0x21')](respondWithResult(_0x211546,null))[_0x4f74('0x42')](handleError(_0x211546,null));};exports[_0x4f74('0x46')]=function(_0x1d35db,_0xbdd4d1){return db['Schedule'][_0x4f74('0x46')](_0x1d35db[_0x4f74('0x47')],{})[_0x4f74('0x21')](function(_0x1e641a){var _0x592a0c=_0x1d35db[_0x4f74('0x48')][_0x4f74('0x1e')]({'plain':!![]});if(!_0x592a0c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x592a0c[_0x4f74('0x49')]===_0x4f74('0x48')){var _0x326a04=_0x1e641a[_0x4f74('0x1e')]({'plain':!![]});var _0x2e76d0='Scheduler';return db['UserProfileSection'][_0x4f74('0x45')]({'where':{'name':_0x2e76d0,'userProfileId':_0x592a0c['userProfileId']},'raw':!![]})[_0x4f74('0x21')](function(_0x534219){if(_0x534219&&_0x534219[_0x4f74('0x4a')]===0x0){return db[_0x4f74('0x20')][_0x4f74('0x46')]({'name':_0x326a04[_0x4f74('0x25')],'resourceId':_0x326a04['id'],'type':_0x534219[_0x4f74('0x25')],'sectionId':_0x534219['id']},{})['then'](function(){return _0x1e641a;});}else{return _0x1e641a;}})[_0x4f74('0x42')](function(_0x4fd0a4){logger[_0x4f74('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4fd0a4);throw _0x4fd0a4;});}return _0x1e641a;})[_0x4f74('0x21')](respondWithResult(_0xbdd4d1,0xc9))[_0x4f74('0x42')](handleError(_0xbdd4d1,null));};exports[_0x4f74('0x1c')]=function(_0x37290d,_0x379b26){if(_0x37290d[_0x4f74('0x47')]['id']){delete _0x37290d['body']['id'];}return db[_0x4f74('0x28')]['find']({'where':{'id':_0x37290d[_0x4f74('0x44')]['id']}})['then'](handleEntityNotFound(_0x379b26,null))['then'](saveUpdates(_0x37290d[_0x4f74('0x47')],null))[_0x4f74('0x21')](respondWithResult(_0x379b26,null))[_0x4f74('0x42')](handleError(_0x379b26,null));};exports[_0x4f74('0x1d')]=function(_0x225d26,_0x54254b){return db['Schedule'][_0x4f74('0x45')]({'where':{'id':_0x225d26['params']['id']}})['then'](handleEntityNotFound(_0x54254b,null))[_0x4f74('0x21')](removeEntity(_0x54254b,null))[_0x4f74('0x42')](handleError(_0x54254b,null));};exports['run']=function(_0x108996,_0x233055,_0x5878bb){var _0x161582=require('../../config/schedule');return db[_0x4f74('0x28')][_0x4f74('0x45')]({'where':{'id':_0x108996[_0x4f74('0x44')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x233055,null))[_0x4f74('0x21')](function(){_0x161582[_0x4f74('0x4b')](_0x108996[_0x4f74('0x44')]['id']);})[_0x4f74('0x21')](respondWithStatusCode(_0x233055,null))[_0x4f74('0x42')](handleError(_0x233055,null));}; \ No newline at end of file +var _0x025e=['util','path','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','Content-Range','reject','save','then','destroy','Scheduler','UserProfileResource','stack','name','send','Schedule','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','show','keys','length','find','create','body','user','get','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','../../config/schedule','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0x025e,0x99));var _0xe025=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x025e[_0x126558];return _0x1f6d14;};'use strict';var emlformat=require(_0xe025('0x0'));var rimraf=require(_0xe025('0x1'));var zipdir=require(_0xe025('0x2'));var jsonpatch=require(_0xe025('0x3'));var rp=require(_0xe025('0x4'));var moment=require(_0xe025('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe025('0x6'));var util=require(_0xe025('0x7'));var path=require(_0xe025('0x8'));var sox=require('sox');var csv=require(_0xe025('0x9'));var ejs=require(_0xe025('0xa'));var fs=require('fs');var fs_extra=require(_0xe025('0xb'));var _=require(_0xe025('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe025('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe025('0x9'));var querystring=require(_0xe025('0xe'));var Papa=require(_0xe025('0xf'));var Redis=require(_0xe025('0x10'));var authService=require(_0xe025('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe025('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe025('0x13'))(_0xe025('0x14'));var utils=require('../../config/utils');var config=require(_0xe025('0x15'));var licenseUtil=require(_0xe025('0x16'));var db=require(_0xe025('0x17'))['db'];function respondWithStatusCode(_0x51b213,_0x17960e){_0x17960e=_0x17960e||0xcc;return function(_0x55ab34){if(_0x55ab34){return _0x51b213[_0xe025('0x18')](_0x17960e);}return _0x51b213['status'](_0x17960e)[_0xe025('0x19')]();};}function respondWithResult(_0x4ac5f2,_0x44d3a5){_0x44d3a5=_0x44d3a5||0xc8;return function(_0x4d6d31){if(_0x4d6d31){return _0x4ac5f2[_0xe025('0x1a')](_0x44d3a5)[_0xe025('0x1b')](_0x4d6d31);}};}function respondWithFilteredResult(_0x447f8e,_0x2cf4be){return function(_0x57b5ab){if(_0x57b5ab){var _0x3b6e71=typeof _0x2cf4be['offset']===_0xe025('0x1c')&&typeof _0x2cf4be['limit']===_0xe025('0x1c');var _0x5b4c46=_0x57b5ab[_0xe025('0x1d')];var _0xa46ed2=_0x3b6e71?0x0:_0x2cf4be[_0xe025('0x1e')];var _0x24991c=_0x3b6e71?_0x57b5ab[_0xe025('0x1d')]:_0x2cf4be['offset']+_0x2cf4be[_0xe025('0x1f')];var _0x1954d1;if(_0x24991c>=_0x5b4c46){_0x24991c=_0x5b4c46;_0x1954d1=0xc8;}else{_0x1954d1=0xce;}_0x447f8e['status'](_0x1954d1);return _0x447f8e['set'](_0xe025('0x20'),_0xa46ed2+'-'+_0x24991c+'/'+_0x5b4c46)[_0xe025('0x1b')](_0x57b5ab);}return null;};}function patchUpdates(_0x27ccf7){return function(_0x4226a5){try{jsonpatch['apply'](_0x4226a5,_0x27ccf7,!![]);}catch(_0x30efe0){return BPromise[_0xe025('0x21')](_0x30efe0);}return _0x4226a5[_0xe025('0x22')]();};}function saveUpdates(_0x41ee4e,_0x28b730){return function(_0x5efc2e){if(_0x5efc2e){return _0x5efc2e['update'](_0x41ee4e)[_0xe025('0x23')](function(_0x100ddd){return _0x100ddd;});}return null;};}function removeEntity(_0x286904,_0x3521bf){return function(_0xe667d){if(_0xe667d){return _0xe667d[_0xe025('0x24')]()[_0xe025('0x23')](function(){var _0x2d377a=_0xe667d['get']({'plain':!![]});var _0x3e34d8=_0xe025('0x25');return db[_0xe025('0x26')][_0xe025('0x24')]({'where':{'type':_0x3e34d8,'resourceId':_0x2d377a['id']}})[_0xe025('0x23')](function(){return _0xe667d;});})['then'](function(){_0x286904[_0xe025('0x1a')](0xcc)[_0xe025('0x19')]();});}};}function handleEntityNotFound(_0x25c67f,_0x59b880){return function(_0x1175cf){if(!_0x1175cf){_0x25c67f[_0xe025('0x18')](0x194);}return _0x1175cf;};}function handleError(_0x59d67e,_0x5caac4){_0x5caac4=_0x5caac4||0x1f4;return function(_0x55de91){logger['error'](_0x55de91[_0xe025('0x27')]);if(_0x55de91[_0xe025('0x28')]){delete _0x55de91[_0xe025('0x28')];}_0x59d67e['status'](_0x5caac4)[_0xe025('0x29')](_0x55de91);};}exports['index']=function(_0x2e9b0a,_0x885640){var _0x5dd289={},_0xbe49d1={},_0x1e98ed={'count':0x0,'rows':[]};var _0x111cd1=_['map'](db[_0xe025('0x2a')][_0xe025('0x2b')],function(_0x2e6c6f){return{'name':_0x2e6c6f[_0xe025('0x2c')],'type':_0x2e6c6f[_0xe025('0x2d')][_0xe025('0x2e')]};});_0xbe49d1[_0xe025('0x2f')]=_[_0xe025('0x30')](_0x111cd1,_0xe025('0x28'));_0xbe49d1[_0xe025('0x31')]=_['keys'](_0x2e9b0a[_0xe025('0x31')]);_0xbe49d1[_0xe025('0x32')]=_[_0xe025('0x33')](_0xbe49d1[_0xe025('0x2f')],_0xbe49d1['query']);_0x5dd289[_0xe025('0x34')]=_['intersection'](_0xbe49d1[_0xe025('0x2f')],qs[_0xe025('0x35')](_0x2e9b0a[_0xe025('0x31')][_0xe025('0x35')]));_0x5dd289['attributes']=_0x5dd289['attributes']['length']?_0x5dd289[_0xe025('0x34')]:_0xbe49d1[_0xe025('0x2f')];if(!_0x2e9b0a[_0xe025('0x31')]['hasOwnProperty']('nolimit')){_0x5dd289[_0xe025('0x1f')]=qs[_0xe025('0x1f')](_0x2e9b0a[_0xe025('0x31')][_0xe025('0x1f')]);_0x5dd289[_0xe025('0x1e')]=qs[_0xe025('0x1e')](_0x2e9b0a['query'][_0xe025('0x1e')]);}_0x5dd289[_0xe025('0x36')]=qs[_0xe025('0x37')](_0x2e9b0a[_0xe025('0x31')][_0xe025('0x37')]);_0x5dd289[_0xe025('0x38')]=qs[_0xe025('0x32')](_[_0xe025('0x39')](_0x2e9b0a['query'],_0xbe49d1[_0xe025('0x32')]),_0x111cd1);if(_0x2e9b0a['query'][_0xe025('0x3a')]){_0x5dd289['where']=_[_0xe025('0x3b')](_0x5dd289[_0xe025('0x38')],{'$or':_[_0xe025('0x30')](_0x111cd1,function(_0x3328ff){if(_0x3328ff[_0xe025('0x2d')]!==_0xe025('0x3c')){var _0x41547a={};_0x41547a[_0x3328ff['name']]={'$like':'%'+_0x2e9b0a[_0xe025('0x31')][_0xe025('0x3a')]+'%'};return _0x41547a;}})});}_0x5dd289=_['merge']({},_0x5dd289,_0x2e9b0a[_0xe025('0x3d')]);var _0x35e442={'where':_0x5dd289['where']};return db[_0xe025('0x2a')][_0xe025('0x1d')](_0x35e442)['then'](function(_0x200ffa){_0x1e98ed[_0xe025('0x1d')]=_0x200ffa;if(_0x2e9b0a[_0xe025('0x31')]['includeAll']){_0x5dd289[_0xe025('0x3e')]=[{'all':!![]}];}return db[_0xe025('0x2a')]['findAll'](_0x5dd289);})['then'](function(_0x5e0845){_0x1e98ed['rows']=_0x5e0845;return _0x1e98ed;})[_0xe025('0x23')](respondWithFilteredResult(_0x885640,_0x5dd289))[_0xe025('0x3f')](handleError(_0x885640,null));};exports[_0xe025('0x40')]=function(_0xff8bc7,_0x5f2f8b){var _0x35a46d={'raw':![],'where':{'id':_0xff8bc7['params']['id']}},_0x20d95e={};_0x20d95e[_0xe025('0x2f')]=_[_0xe025('0x41')](db[_0xe025('0x2a')][_0xe025('0x2b')]);_0x20d95e[_0xe025('0x31')]=_[_0xe025('0x41')](_0xff8bc7[_0xe025('0x31')]);_0x20d95e[_0xe025('0x32')]=_[_0xe025('0x33')](_0x20d95e['model'],_0x20d95e[_0xe025('0x31')]);_0x35a46d[_0xe025('0x34')]=_['intersection'](_0x20d95e[_0xe025('0x2f')],qs[_0xe025('0x35')](_0xff8bc7[_0xe025('0x31')][_0xe025('0x35')]));_0x35a46d[_0xe025('0x34')]=_0x35a46d[_0xe025('0x34')][_0xe025('0x42')]?_0x35a46d[_0xe025('0x34')]:_0x20d95e[_0xe025('0x2f')];if(_0xff8bc7['query']['includeAll']){_0x35a46d[_0xe025('0x3e')]=[{'all':!![]}];}_0x35a46d=_[_0xe025('0x3b')]({},_0x35a46d,_0xff8bc7[_0xe025('0x3d')]);return db[_0xe025('0x2a')][_0xe025('0x43')](_0x35a46d)[_0xe025('0x23')](handleEntityNotFound(_0x5f2f8b,null))[_0xe025('0x23')](respondWithResult(_0x5f2f8b,null))[_0xe025('0x3f')](handleError(_0x5f2f8b,null));};exports[_0xe025('0x44')]=function(_0x55cb49,_0x264411){return db[_0xe025('0x2a')][_0xe025('0x44')](_0x55cb49[_0xe025('0x45')],{})[_0xe025('0x23')](function(_0x5b6e01){var _0x2d5469=_0x55cb49[_0xe025('0x46')][_0xe025('0x47')]({'plain':!![]});if(!_0x2d5469)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d5469['role']===_0xe025('0x46')){var _0xae029d=_0x5b6e01[_0xe025('0x47')]({'plain':!![]});var _0x5772be=_0xe025('0x25');return db['UserProfileSection'][_0xe025('0x43')]({'where':{'name':_0x5772be,'userProfileId':_0x2d5469[_0xe025('0x48')]},'raw':!![]})[_0xe025('0x23')](function(_0x230984){if(_0x230984&&_0x230984[_0xe025('0x49')]===0x0){return db[_0xe025('0x26')]['create']({'name':_0xae029d[_0xe025('0x28')],'resourceId':_0xae029d['id'],'type':_0x230984['name'],'sectionId':_0x230984['id']},{})[_0xe025('0x23')](function(){return _0x5b6e01;});}else{return _0x5b6e01;}})['catch'](function(_0x794f8e){logger[_0xe025('0x4a')](_0xe025('0x4b'),_0x794f8e);throw _0x794f8e;});}return _0x5b6e01;})[_0xe025('0x23')](respondWithResult(_0x264411,0xc9))[_0xe025('0x3f')](handleError(_0x264411,null));};exports[_0xe025('0x4c')]=function(_0x1f82f9,_0x549823){if(_0x1f82f9[_0xe025('0x45')]['id']){delete _0x1f82f9['body']['id'];}return db[_0xe025('0x2a')]['find']({'where':{'id':_0x1f82f9[_0xe025('0x4d')]['id']}})[_0xe025('0x23')](handleEntityNotFound(_0x549823,null))['then'](saveUpdates(_0x1f82f9[_0xe025('0x45')],null))[_0xe025('0x23')](respondWithResult(_0x549823,null))[_0xe025('0x3f')](handleError(_0x549823,null));};exports[_0xe025('0x24')]=function(_0x42b76e,_0x3b118b){return db['Schedule']['find']({'where':{'id':_0x42b76e['params']['id']}})['then'](handleEntityNotFound(_0x3b118b,null))['then'](removeEntity(_0x3b118b,null))[_0xe025('0x3f')](handleError(_0x3b118b,null));};exports['run']=function(_0x2818dc,_0x43b3c2,_0x3613ec){var _0x25299c=require(_0xe025('0x4e'));return db[_0xe025('0x2a')][_0xe025('0x43')]({'where':{'id':_0x2818dc[_0xe025('0x4d')]['id']},'raw':!![]})[_0xe025('0x23')](handleEntityNotFound(_0x43b3c2,null))[_0xe025('0x23')](function(){_0x25299c[_0xe025('0x4f')](_0x2818dc[_0xe025('0x4d')]['id']);})[_0xe025('0x23')](respondWithStatusCode(_0x43b3c2,null))['catch'](handleError(_0x43b3c2,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 6c27cde..6abcb62 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 _0xe687=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Schedule','tools_schedules','lodash','util','api'];(function(_0x133d16,_0x5c1238){var _0x341727=function(_0x8b182b){while(--_0x8b182b){_0x133d16['push'](_0x133d16['shift']());}};_0x341727(++_0x5c1238);}(_0xe687,0x1ad));var _0x7e68=function(_0x332f30,_0x34a75a){_0x332f30=_0x332f30-0x0;var _0x38718f=_0xe687[_0x332f30];return _0x38718f;};'use strict';var _=require(_0x7e68('0x0'));var util=require(_0x7e68('0x1'));var logger=require('../../config/logger')(_0x7e68('0x2'));var moment=require('moment');var BPromise=require(_0x7e68('0x3'));var rp=require(_0x7e68('0x4'));var fs=require('fs');var path=require(_0x7e68('0x5'));var rimraf=require(_0x7e68('0x6'));var config=require(_0x7e68('0x7'));var attributes=require('./schedule.attributes');module[_0x7e68('0x8')]=function(_0x25ff79,_0x1cceb6){return _0x25ff79[_0x7e68('0x9')](_0x7e68('0xa'),attributes,{'tableName':_0x7e68('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc66=['path','../../config/environment','./schedule.attributes','define','Schedule','tools_schedules','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x1ce8e8,_0x48d5bb){var _0x545c39=function(_0x5bb7d0){while(--_0x5bb7d0){_0x1ce8e8['push'](_0x1ce8e8['shift']());}};_0x545c39(++_0x48d5bb);}(_0xcc66,0x1d4));var _0x6cc6=function(_0x259b24,_0x17127a){_0x259b24=_0x259b24-0x0;var _0x3dec70=_0xcc66[_0x259b24];return _0x3dec70;};'use strict';var _=require(_0x6cc6('0x0'));var util=require(_0x6cc6('0x1'));var logger=require(_0x6cc6('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6cc6('0x3'));var rp=require(_0x6cc6('0x4'));var fs=require('fs');var path=require(_0x6cc6('0x5'));var rimraf=require('rimraf');var config=require(_0x6cc6('0x6'));var attributes=require(_0x6cc6('0x7'));module['exports']=function(_0x119315,_0x574cc5){return _0x119315[_0x6cc6('0x8')](_0x6cc6('0x9'),attributes,{'tableName':_0x6cc6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index eb40aa9..1fa0f41 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 _0x89dc=['stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Schedule,\x20%s,\x20%s','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x59ea6a,_0x2b4ad1){var _0x2e360a=function(_0x23ebae){while(--_0x23ebae){_0x59ea6a['push'](_0x59ea6a['shift']());}};_0x2e360a(++_0x2b4ad1);}(_0x89dc,0x141));var _0xc89d=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x89dc[_0x4e6ae6];return _0x23c108;};'use strict';var _=require(_0xc89d('0x0'));var util=require('util');var moment=require(_0xc89d('0x1'));var BPromise=require('bluebird');var rs=require(_0xc89d('0x2'));var fs=require('fs');var Redis=require(_0xc89d('0x3'));var db=require(_0xc89d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc89d('0x5'))(_0xc89d('0x6'));var config=require(_0xc89d('0x7'));var jayson=require(_0xc89d('0x8'));var client=jayson['client'][_0xc89d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1106af,_0x57a054,_0x38d467){return new BPromise(function(_0x3ddfde,_0x28e017){return client[_0xc89d('0xa')](_0x1106af,_0x38d467)[_0xc89d('0xb')](function(_0x5defe5){logger['info'](_0xc89d('0xc'),_0x57a054,'request\x20sent');logger['debug'](_0xc89d('0xd'),_0x57a054,_0xc89d('0xe'),JSON[_0xc89d('0xf')](_0x5defe5));if(_0x5defe5['error']){if(_0x5defe5[_0xc89d('0x10')][_0xc89d('0x11')]===0x1f4){logger[_0xc89d('0x10')](_0xc89d('0xc'),_0x57a054,_0x5defe5['error'][_0xc89d('0x12')]);return _0x28e017(_0x5defe5[_0xc89d('0x10')][_0xc89d('0x12')]);}logger[_0xc89d('0x10')]('Schedule,\x20%s,\x20%s',_0x57a054,_0x5defe5[_0xc89d('0x10')][_0xc89d('0x12')]);return _0x3ddfde(_0x5defe5['error'][_0xc89d('0x12')]);}else{logger['info'](_0xc89d('0xc'),_0x57a054,_0xc89d('0xe'));_0x3ddfde(_0x5defe5[_0xc89d('0x13')][_0xc89d('0x12')]);}})[_0xc89d('0x14')](function(_0x42e63c){logger[_0xc89d('0x10')](_0xc89d('0xc'),_0x57a054,_0x42e63c);_0x28e017(_0x42e63c);});});} \ No newline at end of file +var _0xa35f=['bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x1f3fd8,_0x50bb37){var _0x385f23=function(_0x17f694){while(--_0x17f694){_0x1f3fd8['push'](_0x1f3fd8['shift']());}};_0x385f23(++_0x50bb37);}(_0xa35f,0x1b6));var _0xfa35=function(_0x1c06f4,_0x2feba6){_0x1c06f4=_0x1c06f4-0x0;var _0x1a727e=_0xa35f[_0x1c06f4];return _0x1a727e;};'use strict';var _=require(_0xfa35('0x0'));var util=require(_0xfa35('0x1'));var moment=require(_0xfa35('0x2'));var BPromise=require(_0xfa35('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa35('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfa35('0x5'))(_0xfa35('0x6'));var config=require(_0xfa35('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfa35('0x8')][_0xfa35('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37eb70,_0x293af9,_0x363db8){return new BPromise(function(_0x2fb2bf,_0x39ddf2){return client[_0xfa35('0xa')](_0x37eb70,_0x363db8)[_0xfa35('0xb')](function(_0x103d3a){logger[_0xfa35('0xc')](_0xfa35('0xd'),_0x293af9,_0xfa35('0xe'));logger['debug'](_0xfa35('0xf'),_0x293af9,_0xfa35('0xe'),JSON[_0xfa35('0x10')](_0x103d3a));if(_0x103d3a[_0xfa35('0x11')]){if(_0x103d3a[_0xfa35('0x11')][_0xfa35('0x12')]===0x1f4){logger['error'](_0xfa35('0xd'),_0x293af9,_0x103d3a['error'][_0xfa35('0x13')]);return _0x39ddf2(_0x103d3a[_0xfa35('0x11')][_0xfa35('0x13')]);}logger[_0xfa35('0x11')]('Schedule,\x20%s,\x20%s',_0x293af9,_0x103d3a[_0xfa35('0x11')]['message']);return _0x2fb2bf(_0x103d3a[_0xfa35('0x11')][_0xfa35('0x13')]);}else{logger[_0xfa35('0xc')]('Schedule,\x20%s,\x20%s',_0x293af9,_0xfa35('0xe'));_0x2fb2bf(_0x103d3a['result'][_0xfa35('0x13')]);}})[_0xfa35('0x14')](function(_0x1318b7){logger[_0xfa35('0x11')](_0xfa35('0xd'),_0x293af9,_0x1318b7);_0x39ddf2(_0x1318b7);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index ce54ecb..302f5cf 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 _0x2889=['/:id/download','put','update','destroy','exports','multer','util','path','express','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe'];(function(_0x271167,_0x1e35b3){var _0xe802ed=function(_0x1d8783){while(--_0x1d8783){_0x271167['push'](_0x271167['shift']());}};_0xe802ed(++_0x1e35b3);}(_0x2889,0xd7));var _0x9288=function(_0x352be5,_0x5011b3){_0x352be5=_0x352be5-0x0;var _0x40caff=_0x2889[_0x352be5];return _0x40caff;};'use strict';var multer=require(_0x9288('0x0'));var util=require(_0x9288('0x1'));var path=require(_0x9288('0x2'));var timeout=require('connect-timeout');var express=require(_0x9288('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9288('0x4'));var config=require(_0x9288('0x5'));var controller=require('./screenRecording.controller');router['get']('/',auth[_0x9288('0x6')](),controller['index']);router[_0x9288('0x7')](_0x9288('0x8'),auth[_0x9288('0x6')](),controller[_0x9288('0x9')]);router[_0x9288('0x7')]('/:id',auth[_0x9288('0x6')](),controller['show']);router[_0x9288('0x7')](_0x9288('0xa'),auth[_0x9288('0x6')](),controller['download']);router['post']('/',auth[_0x9288('0x6')](),controller['create']);router[_0x9288('0xb')]('/:id',auth[_0x9288('0x6')](),controller[_0x9288('0xc')]);router['delete']('/:id',auth[_0x9288('0x6')](),controller[_0x9288('0xd')]);module[_0x9288('0xe')]=router; \ No newline at end of file +var _0x3c70=['index','/describe','describe','show','/:id/download','download','post','create','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated'];(function(_0x10a8d8,_0x28f292){var _0x3b2b79=function(_0x55a3fe){while(--_0x55a3fe){_0x10a8d8['push'](_0x10a8d8['shift']());}};_0x3b2b79(++_0x28f292);}(_0x3c70,0x1e8));var _0x03c7=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x3c70[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0x03c7('0x0'));var util=require(_0x03c7('0x1'));var path=require(_0x03c7('0x2'));var timeout=require('connect-timeout');var express=require(_0x03c7('0x3'));var router=express[_0x03c7('0x4')]();var fs_extra=require(_0x03c7('0x5'));var auth=require(_0x03c7('0x6'));var interaction=require(_0x03c7('0x7'));var config=require(_0x03c7('0x8'));var controller=require(_0x03c7('0x9'));router[_0x03c7('0xa')]('/',auth[_0x03c7('0xb')](),controller[_0x03c7('0xc')]);router[_0x03c7('0xa')](_0x03c7('0xd'),auth[_0x03c7('0xb')](),controller[_0x03c7('0xe')]);router[_0x03c7('0xa')]('/:id',auth[_0x03c7('0xb')](),controller[_0x03c7('0xf')]);router[_0x03c7('0xa')](_0x03c7('0x10'),auth[_0x03c7('0xb')](),controller[_0x03c7('0x11')]);router[_0x03c7('0x12')]('/',auth[_0x03c7('0xb')](),controller[_0x03c7('0x13')]);router['put'](_0x03c7('0x14'),auth['isAuthenticated'](),controller[_0x03c7('0x15')]);router[_0x03c7('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x03c7('0x17')]);module[_0x03c7('0x18')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 0444340..71f9395 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 _0x0ffc=['value','extname','STRING','replace','setDataValue','INTEGER','startedAt','closedAt','duration','DATE','MM-DD-YYYY\x20HH:mm','toString','format','updatedAt','moment','path','exports','getDataValue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0ffc,0x9e));var _0xc0ff=function(_0x2a3b16,_0x22c241){_0x2a3b16=_0x2a3b16-0x0;var _0x41fed5=_0x0ffc[_0x2a3b16];return _0x41fed5;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc0ff('0x0'));var path=require(_0xc0ff('0x1'));var config=require('../../config/environment');module[_0xc0ff('0x2')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xc0ff('0x3')](_0xc0ff('0x4'))?path[_0xc0ff('0x5')](this[_0xc0ff('0x3')](_0xc0ff('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0xc0ff('0x6')]},'channel':{'type':Sequelize[_0xc0ff('0x6')]},'value':{'type':Sequelize[_0xc0ff('0x6')],'set':function(_0x245f10){var _0x51695d=_0x245f10[_0xc0ff('0x7')](/\\/g,'/');this[_0xc0ff('0x8')](_0xc0ff('0x4'),_0x51695d);}},'rating':{'type':Sequelize[_0xc0ff('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xc0ff('0x9')],'set':function(_0x380604){this[_0xc0ff('0x8')](_0xc0ff('0xa'),moment()['subtract'](_0x380604,'ms'));this['setDataValue'](_0xc0ff('0xb'),moment());this['setDataValue'](_0xc0ff('0xc'),_0x380604);}},'startedAt':{'type':Sequelize[_0xc0ff('0xd')],'get':function(){return moment(this[_0xc0ff('0x3')](_0xc0ff('0xa')))['format'](_0xc0ff('0xe'))[_0xc0ff('0xf')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xc0ff('0x3')]('closedAt'))['format']('MM-DD-YYYY\x20HH:mm')[_0xc0ff('0xf')]();}},'createdAt':{'type':Sequelize[_0xc0ff('0xd')],'get':function(){return moment(this[_0xc0ff('0x3')]('createdAt'))[_0xc0ff('0x10')](_0xc0ff('0xe'))[_0xc0ff('0xf')]();}},'updatedAt':{'type':Sequelize[_0xc0ff('0xd')],'get':function(){return moment(this[_0xc0ff('0x3')](_0xc0ff('0x11')))[_0xc0ff('0x10')](_0xc0ff('0xe'))[_0xc0ff('0xf')]();}}}; \ No newline at end of file +var _0xf277=['updatedAt','sequelize','moment','../../config/environment','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','duration','DATE','startedAt','format','toString','closedAt','MM-DD-YYYY\x20HH:mm','createdAt'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xf277,0x1e1));var _0x7f27=function(_0x594b48,_0x34afd5){_0x594b48=_0x594b48-0x0;var _0x3110b7=_0xf277[_0x594b48];return _0x3110b7;};'use strict';var Sequelize=require(_0x7f27('0x0'));var moment=require(_0x7f27('0x1'));var path=require('path');var config=require(_0x7f27('0x2'));module['exports']={'format':{'type':Sequelize[_0x7f27('0x3')],'get':function(){return this[_0x7f27('0x4')](_0x7f27('0x5'))?path[_0x7f27('0x6')](this[_0x7f27('0x4')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x7f27('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x7f27('0x7')],'set':function(_0x39dcee){var _0x480cd6=_0x39dcee[_0x7f27('0x8')](/\\/g,'/');this[_0x7f27('0x9')]('value',_0x480cd6);}},'rating':{'type':Sequelize[_0x7f27('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x7f27('0xa')],'set':function(_0x8ecc84){this[_0x7f27('0x9')]('startedAt',moment()['subtract'](_0x8ecc84,'ms'));this[_0x7f27('0x9')]('closedAt',moment());this[_0x7f27('0x9')](_0x7f27('0xb'),_0x8ecc84);}},'startedAt':{'type':Sequelize[_0x7f27('0xc')],'get':function(){return moment(this[_0x7f27('0x4')](_0x7f27('0xd')))[_0x7f27('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x7f27('0xf')]();}},'closedAt':{'type':Sequelize[_0x7f27('0xc')],'get':function(){return moment(this['getDataValue'](_0x7f27('0x10')))[_0x7f27('0xe')](_0x7f27('0x11'))[_0x7f27('0xf')]();}},'createdAt':{'type':Sequelize[_0x7f27('0xc')],'get':function(){return moment(this[_0x7f27('0x4')](_0x7f27('0x12')))[_0x7f27('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x7f27('0xf')]();}},'updatedAt':{'type':Sequelize[_0x7f27('0xc')],'get':function(){return moment(this['getDataValue'](_0x7f27('0x13')))[_0x7f27('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x7f27('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 86e94ed..db8755e 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 _0xee14=['path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','ScreenRecording','includeAll','include','findAll','rows','catch','params','find','create','body','duration','describe','../../components/encryptor','uniqueid','value','server/files/screen_recordings','existsSync','decryptFile','secrets','recording','root','Sequelize','ValidationError','filename','download','unlink','ScreenRecording\x20not\x20found','isNil','Entity\x20not\x20found','join','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x2fbe75,_0x1490f3){var _0x3d74b2=function(_0x2623b3){while(--_0x2623b3){_0x2fbe75['push'](_0x2fbe75['shift']());}};_0x3d74b2(++_0x1490f3);}(_0xee14,0x13a));var _0x4ee1=function(_0x303f08,_0xcd04bc){_0x303f08=_0x303f08-0x0;var _0x1cab0c=_0xee14[_0x303f08];return _0x1cab0c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4ee1('0x0'));var jsonpatch=require(_0x4ee1('0x1'));var rp=require(_0x4ee1('0x2'));var moment=require(_0x4ee1('0x3'));var BPromise=require(_0x4ee1('0x4'));var Mustache=require(_0x4ee1('0x5'));var util=require(_0x4ee1('0x6'));var path=require(_0x4ee1('0x7'));var sox=require(_0x4ee1('0x8'));var csv=require('to-csv');var ejs=require(_0x4ee1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ee1('0xa'));var squel=require(_0x4ee1('0xb'));var crypto=require(_0x4ee1('0xc'));var jsforce=require(_0x4ee1('0xd'));var deskjs=require(_0x4ee1('0xe'));var toCsv=require(_0x4ee1('0xf'));var querystring=require('querystring');var Papa=require(_0x4ee1('0x10'));var Redis=require(_0x4ee1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4ee1('0x12'));var as=require(_0x4ee1('0x13'));var hardwareService=require(_0x4ee1('0x14'));var logger=require(_0x4ee1('0x15'))('api');var utils=require(_0x4ee1('0x16'));var config=require(_0x4ee1('0x17'));var licenseUtil=require(_0x4ee1('0x18'));var db=require(_0x4ee1('0x19'))['db'];function respondWithStatusCode(_0x2f864e,_0x174427){_0x174427=_0x174427||0xcc;return function(_0x5616d6){if(_0x5616d6){return _0x2f864e[_0x4ee1('0x1a')](_0x174427);}return _0x2f864e[_0x4ee1('0x1b')](_0x174427)[_0x4ee1('0x1c')]();};}function respondWithResult(_0x24a915,_0x46d2c2){_0x46d2c2=_0x46d2c2||0xc8;return function(_0x1c342a){if(_0x1c342a){return _0x24a915[_0x4ee1('0x1b')](_0x46d2c2)[_0x4ee1('0x1d')](_0x1c342a);}};}function respondWithFilteredResult(_0xb7eafd,_0x4e3490){return function(_0x2f9194){if(_0x2f9194){var _0x38008f=typeof _0x4e3490[_0x4ee1('0x1e')]===_0x4ee1('0x1f')&&typeof _0x4e3490[_0x4ee1('0x20')]===_0x4ee1('0x1f');var _0x2eff91=_0x2f9194[_0x4ee1('0x21')];var _0x360056=_0x38008f?0x0:_0x4e3490[_0x4ee1('0x1e')];var _0x274de5=_0x38008f?_0x2f9194['count']:_0x4e3490[_0x4ee1('0x1e')]+_0x4e3490[_0x4ee1('0x20')];var _0x173388;if(_0x274de5>=_0x2eff91){_0x274de5=_0x2eff91;_0x173388=0xc8;}else{_0x173388=0xce;}_0xb7eafd[_0x4ee1('0x1b')](_0x173388);return _0xb7eafd[_0x4ee1('0x22')](_0x4ee1('0x23'),_0x360056+'-'+_0x274de5+'/'+_0x2eff91)['json'](_0x2f9194);}return null;};}function patchUpdates(_0x8a631f){return function(_0x333e96){try{jsonpatch[_0x4ee1('0x24')](_0x333e96,_0x8a631f,!![]);}catch(_0x3f0d59){return BPromise[_0x4ee1('0x25')](_0x3f0d59);}return _0x333e96[_0x4ee1('0x26')]();};}function saveUpdates(_0x328f21,_0x40fd98){return function(_0x1dc1a8){if(_0x1dc1a8){return _0x1dc1a8[_0x4ee1('0x27')](_0x328f21)['then'](function(_0x53d43f){return _0x53d43f;});}return null;};}function removeEntity(_0x14110c,_0x459e2e){return function(_0xaf87e7){if(_0xaf87e7){return _0xaf87e7[_0x4ee1('0x28')]()[_0x4ee1('0x29')](function(){_0x14110c[_0x4ee1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cc0b5,_0x442c71){return function(_0x28b7e1){if(!_0x28b7e1){_0x5cc0b5['sendStatus'](0x194);}return _0x28b7e1;};}function handleError(_0x35900d,_0x213db8){_0x213db8=_0x213db8||0x1f4;return function(_0x36654c){logger[_0x4ee1('0x2a')](_0x36654c[_0x4ee1('0x2b')]);if(_0x36654c[_0x4ee1('0x2c')]){delete _0x36654c[_0x4ee1('0x2c')];}_0x35900d['status'](_0x213db8)[_0x4ee1('0x2d')](_0x36654c);};}exports['index']=function(_0x4746c2,_0x4ec408){var _0x3dc870={},_0x1d91be={},_0x59a34e={'count':0x0,'rows':[]};var _0x13944c=_[_0x4ee1('0x2e')](db['ScreenRecording'][_0x4ee1('0x2f')],function(_0x5b3792){return{'name':_0x5b3792[_0x4ee1('0x30')],'type':_0x5b3792[_0x4ee1('0x31')][_0x4ee1('0x32')]};});_0x1d91be[_0x4ee1('0x33')]=_[_0x4ee1('0x34')](_['map'](_0x13944c,_0x4ee1('0x2c')),[_0x4ee1('0x35')]);_0x1d91be[_0x4ee1('0x36')]=_[_0x4ee1('0x37')](_0x4746c2[_0x4ee1('0x36')]);_0x1d91be[_0x4ee1('0x38')]=_['intersection'](_0x1d91be['model'],_0x1d91be[_0x4ee1('0x36')]);_0x3dc870[_0x4ee1('0x39')]=_[_0x4ee1('0x3a')](_0x1d91be['model'],qs[_0x4ee1('0x3b')](_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x3b')]));_0x3dc870[_0x4ee1('0x39')]=_0x3dc870[_0x4ee1('0x39')][_0x4ee1('0x3c')]?_0x3dc870[_0x4ee1('0x39')]:_0x1d91be[_0x4ee1('0x33')];if(!_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x3d')](_0x4ee1('0x3e'))){_0x3dc870[_0x4ee1('0x20')]=qs[_0x4ee1('0x20')](_0x4746c2['query'][_0x4ee1('0x20')]);_0x3dc870[_0x4ee1('0x1e')]=qs[_0x4ee1('0x1e')](_0x4746c2['query']['offset']);}_0x3dc870[_0x4ee1('0x3f')]=qs[_0x4ee1('0x40')](_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x40')]);_0x3dc870['where']=qs[_0x4ee1('0x38')](_[_0x4ee1('0x41')](_0x4746c2[_0x4ee1('0x36')],_0x1d91be[_0x4ee1('0x38')]),_0x13944c);if(_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x42')]){_0x3dc870[_0x4ee1('0x43')]=_[_0x4ee1('0x44')](_0x3dc870['where'],{'$or':_[_0x4ee1('0x2e')](_0x13944c,function(_0x1116b4){if(_0x1116b4[_0x4ee1('0x31')]!==_0x4ee1('0x45')){var _0x45bb22={};_0x45bb22[_0x1116b4[_0x4ee1('0x2c')]]={'$like':'%'+_0x4746c2['query'][_0x4ee1('0x42')]+'%'};return _0x45bb22;}})});}_0x3dc870=_[_0x4ee1('0x44')]({},_0x3dc870,_0x4746c2[_0x4ee1('0x46')]);var _0x333690={'where':_0x3dc870[_0x4ee1('0x43')]};return db[_0x4ee1('0x47')][_0x4ee1('0x21')](_0x333690)[_0x4ee1('0x29')](function(_0x23bb5f){_0x59a34e[_0x4ee1('0x21')]=_0x23bb5f;if(_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x48')]){_0x3dc870[_0x4ee1('0x49')]=[{'all':!![]}];}return db['ScreenRecording'][_0x4ee1('0x4a')](_0x3dc870);})[_0x4ee1('0x29')](function(_0x5ee7b4){_0x59a34e[_0x4ee1('0x4b')]=_0x5ee7b4;return _0x59a34e;})['then'](respondWithFilteredResult(_0x4ec408,_0x3dc870))[_0x4ee1('0x4c')](handleError(_0x4ec408,null));};exports['show']=function(_0x14c333,_0xc7580c){var _0x557126={'raw':![],'where':{'id':_0x14c333[_0x4ee1('0x4d')]['id']}},_0x25d683={};_0x25d683[_0x4ee1('0x33')]=_[_0x4ee1('0x37')](db['ScreenRecording'][_0x4ee1('0x2f')]);_0x25d683[_0x4ee1('0x36')]=_[_0x4ee1('0x37')](_0x14c333['query']);_0x25d683['filters']=_[_0x4ee1('0x3a')](_0x25d683[_0x4ee1('0x33')],_0x25d683[_0x4ee1('0x36')]);_0x557126[_0x4ee1('0x39')]=_[_0x4ee1('0x3a')](_0x25d683['model'],qs['fields'](_0x14c333[_0x4ee1('0x36')][_0x4ee1('0x3b')]));_0x557126[_0x4ee1('0x39')]=_0x557126[_0x4ee1('0x39')]['length']?_0x557126[_0x4ee1('0x39')]:_0x25d683[_0x4ee1('0x33')];if(_0x14c333['query'][_0x4ee1('0x48')]){_0x557126[_0x4ee1('0x49')]=[{'all':!![]}];}_0x557126=_[_0x4ee1('0x44')]({},_0x557126,_0x14c333[_0x4ee1('0x46')]);return db[_0x4ee1('0x47')][_0x4ee1('0x4e')](_0x557126)[_0x4ee1('0x29')](handleEntityNotFound(_0xc7580c,null))[_0x4ee1('0x29')](respondWithResult(_0xc7580c,null))[_0x4ee1('0x4c')](handleError(_0xc7580c,null));};exports['create']=function(_0x49b667,_0x1a972b){return db[_0x4ee1('0x47')][_0x4ee1('0x4f')](_0x49b667[_0x4ee1('0x50')],{})['then'](respondWithResult(_0x1a972b,0xc9))[_0x4ee1('0x4c')](handleError(_0x1a972b,null));};exports[_0x4ee1('0x27')]=function(_0x42dd8d,_0x2bc77f){if(_0x42dd8d[_0x4ee1('0x50')]['id']){delete _0x42dd8d['body']['id'];}delete _0x42dd8d[_0x4ee1('0x50')][_0x4ee1('0x51')];delete _0x42dd8d[_0x4ee1('0x50')]['createdAt'];delete _0x42dd8d[_0x4ee1('0x50')]['closedAt'];delete _0x42dd8d[_0x4ee1('0x50')]['value'];return db[_0x4ee1('0x47')]['find']({'where':{'id':_0x42dd8d[_0x4ee1('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2bc77f,null))[_0x4ee1('0x29')](saveUpdates(_0x42dd8d[_0x4ee1('0x50')],null))[_0x4ee1('0x29')](respondWithResult(_0x2bc77f,null))['catch'](handleError(_0x2bc77f,null));};exports[_0x4ee1('0x52')]=function(_0x4118d7,_0xcdb873){return db[_0x4ee1('0x47')][_0x4ee1('0x52')]()[_0x4ee1('0x29')](respondWithResult(_0xcdb873,null))[_0x4ee1('0x4c')](handleError(_0xcdb873,null));};exports['download']=function(_0x4c4178,_0x1feb78,_0xcddc5d){var _0xf58cd8=require(_0x4ee1('0x53'));var _0x44e65f=![];var _0x31e82d={};if(_0x4c4178[_0x4ee1('0x36')][_0x4ee1('0x31')]&&_0x4c4178[_0x4ee1('0x36')][_0x4ee1('0x31')]===_0x4ee1('0x54')){_0x31e82d[_0x4ee1('0x54')]=_0x4c4178[_0x4ee1('0x4d')]['id'];}else{_0x31e82d['id']=_0x4c4178['params']['id'];}return db[_0x4ee1('0x47')]['find']({'where':_0x31e82d,'attributes':['id',_0x4ee1('0x55')],'raw':!![]})[_0x4ee1('0x29')](handleEntityNotFound(_0x1feb78,null))['then'](function(_0x1e0aac){if(_0x1e0aac){var _0x184e36=path['join'](config['root'],_0x4ee1('0x56'),_0x1e0aac['value']);var _0x1ce99e=util[_0x4ee1('0x35')]('%s.cypher',_0x184e36);if(fs[_0x4ee1('0x57')](_0x1ce99e)){_0x44e65f=!![];return _0xf58cd8[_0x4ee1('0x58')](_0x1ce99e,_0x184e36,config[_0x4ee1('0x59')][_0x4ee1('0x5a')])[_0x4ee1('0x29')](function(){return _0x1e0aac;});}return _0x1e0aac;}})[_0x4ee1('0x29')](function(_0x11f619){if(_0x11f619){var _0x5f5694=path['join'](config[_0x4ee1('0x5b')],_0x4ee1('0x56'),_0x11f619['value']);if(!fs[_0x4ee1('0x57')](_0x5f5694)){throw new db[(_0x4ee1('0x5c'))][(_0x4ee1('0x5d'))]('ScreenRecording\x20not\x20found');}if(_0x11f619[_0x4ee1('0x5e')]){return _0x1feb78['download'](_0x5f5694,_0x11f619[_0x4ee1('0x5e')]+path['extname'](_0x5f5694),function(){if(_0x44e65f){fs['unlink'](_0x5f5694);}});}else{return _0x1feb78[_0x4ee1('0x5f')](_0x5f5694,function(_0x16fcd0){if(_0x44e65f){fs[_0x4ee1('0x60')](_0x5f5694);}});}}})[_0x4ee1('0x4c')](function(_0x38e889){if(_0x38e889['message']===_0x4ee1('0x61')){_0x1feb78[_0x4ee1('0x1b')](0x194)[_0x4ee1('0x2d')]('Not\x20found');}else{return handleError(_0x1feb78,null);}});};exports[_0x4ee1('0x28')]=function(_0x109dc6,_0x3fdd61){return db[_0x4ee1('0x47')][_0x4ee1('0x4e')]({'where':{'id':_0x109dc6[_0x4ee1('0x4d')]['id']}})[_0x4ee1('0x29')](function(_0x20ca0b){if(_[_0x4ee1('0x62')](_0x20ca0b)){throw new ReferenceError(_0x4ee1('0x63'));}return _0x20ca0b;})[_0x4ee1('0x29')](function(_0x38e86f){var _0x5d396c=path[_0x4ee1('0x64')](config['root'],_0x4ee1('0x56'),_0x38e86f['value']);logger[_0x4ee1('0x65')](_0x4ee1('0x66'),_0x5d396c);if(!_[_0x4ee1('0x62')](_0x38e86f[_0x4ee1('0x55')])&&fs[_0x4ee1('0x57')](_0x5d396c)){logger[_0x4ee1('0x65')](_0x4ee1('0x67')+_0x5d396c+_0x4ee1('0x68'));fs[_0x4ee1('0x69')](_0x5d396c);}_0x5d396c=_0x5d396c+_0x4ee1('0x6a');if(!_[_0x4ee1('0x62')](_0x38e86f[_0x4ee1('0x55')])&&fs['existsSync'](_0x5d396c)){logger[_0x4ee1('0x65')](_0x4ee1('0x67')+_0x5d396c+_0x4ee1('0x68'));fs['unlinkSync'](_0x5d396c);}return _0x38e86f;})['then'](function(_0x40dac3){if(!_0x40dac3)throw new InternalError();return _0x40dac3[_0x4ee1('0x28')]();})['then'](function(){_0x3fdd61[_0x4ee1('0x1b')](0xcc)[_0x4ee1('0x1c')]();})[_0x4ee1('0x4c')](handleError(_0x3fdd61,null));}; \ No newline at end of file +var _0xbd50=['unlinkSync','.cypher','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','error','stack','name','send','index','map','rawAttributes','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','ScreenRecording','includeAll','findAll','rows','catch','params','include','find','create','body','update','duration','value','describe','../../components/encryptor','uniqueid','join','root','%s.cypher','existsSync','decryptFile','recording','server/files/screen_recordings','ValidationError','filename','extname','download','unlink','message','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione'];(function(_0x36974d,_0xfc8cad){var _0x459ad7=function(_0xf5e029){while(--_0xf5e029){_0x36974d['push'](_0x36974d['shift']());}};_0x459ad7(++_0xfc8cad);}(_0xbd50,0x196));var _0x0bd5=function(_0xf81b9a,_0x536bf6){_0xf81b9a=_0xf81b9a-0x0;var _0x2105a4=_0xbd50[_0xf81b9a];return _0x2105a4;};'use strict';var emlformat=require(_0x0bd5('0x0'));var rimraf=require(_0x0bd5('0x1'));var zipdir=require(_0x0bd5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0bd5('0x3'));var moment=require(_0x0bd5('0x4'));var BPromise=require(_0x0bd5('0x5'));var Mustache=require(_0x0bd5('0x6'));var util=require(_0x0bd5('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0bd5('0x8'));var fs=require('fs');var fs_extra=require(_0x0bd5('0x9'));var _=require(_0x0bd5('0xa'));var squel=require(_0x0bd5('0xb'));var crypto=require(_0x0bd5('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0bd5('0xd'));var querystring=require(_0x0bd5('0xe'));var Papa=require(_0x0bd5('0xf'));var Redis=require('ioredis');var authService=require(_0x0bd5('0x10'));var qs=require(_0x0bd5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0bd5('0x12'));var logger=require(_0x0bd5('0x13'))('api');var utils=require(_0x0bd5('0x14'));var config=require(_0x0bd5('0x15'));var licenseUtil=require(_0x0bd5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f7a0c,_0x23982f){_0x23982f=_0x23982f||0xcc;return function(_0x2f9588){if(_0x2f9588){return _0x2f7a0c[_0x0bd5('0x17')](_0x23982f);}return _0x2f7a0c[_0x0bd5('0x18')](_0x23982f)[_0x0bd5('0x19')]();};}function respondWithResult(_0x30765e,_0x1e961d){_0x1e961d=_0x1e961d||0xc8;return function(_0x4f485b){if(_0x4f485b){return _0x30765e[_0x0bd5('0x18')](_0x1e961d)[_0x0bd5('0x1a')](_0x4f485b);}};}function respondWithFilteredResult(_0x574315,_0x31349f){return function(_0x23ef4e){if(_0x23ef4e){var _0x3a34e4=typeof _0x31349f[_0x0bd5('0x1b')]==='undefined'&&typeof _0x31349f[_0x0bd5('0x1c')]===_0x0bd5('0x1d');var _0xa890be=_0x23ef4e[_0x0bd5('0x1e')];var _0x833c14=_0x3a34e4?0x0:_0x31349f[_0x0bd5('0x1b')];var _0xc58e12=_0x3a34e4?_0x23ef4e[_0x0bd5('0x1e')]:_0x31349f[_0x0bd5('0x1b')]+_0x31349f[_0x0bd5('0x1c')];var _0x27bc1e;if(_0xc58e12>=_0xa890be){_0xc58e12=_0xa890be;_0x27bc1e=0xc8;}else{_0x27bc1e=0xce;}_0x574315[_0x0bd5('0x18')](_0x27bc1e);return _0x574315[_0x0bd5('0x1f')](_0x0bd5('0x20'),_0x833c14+'-'+_0xc58e12+'/'+_0xa890be)['json'](_0x23ef4e);}return null;};}function patchUpdates(_0x5ba943){return function(_0x596b6a){try{jsonpatch['apply'](_0x596b6a,_0x5ba943,!![]);}catch(_0x47d74a){return BPromise[_0x0bd5('0x21')](_0x47d74a);}return _0x596b6a[_0x0bd5('0x22')]();};}function saveUpdates(_0x13ce46,_0x4a6910){return function(_0x6ee1a8){if(_0x6ee1a8){return _0x6ee1a8['update'](_0x13ce46)[_0x0bd5('0x23')](function(_0x3b235b){return _0x3b235b;});}return null;};}function removeEntity(_0x38c21d,_0x5a8139){return function(_0x5b6dde){if(_0x5b6dde){return _0x5b6dde['destroy']()['then'](function(){_0x38c21d[_0x0bd5('0x18')](0xcc)[_0x0bd5('0x19')]();});}};}function handleEntityNotFound(_0x184db3,_0x4fde84){return function(_0x42428c){if(!_0x42428c){_0x184db3['sendStatus'](0x194);}return _0x42428c;};}function handleError(_0x456e87,_0x3ffb08){_0x3ffb08=_0x3ffb08||0x1f4;return function(_0x18cec3){logger[_0x0bd5('0x24')](_0x18cec3[_0x0bd5('0x25')]);if(_0x18cec3[_0x0bd5('0x26')]){delete _0x18cec3[_0x0bd5('0x26')];}_0x456e87[_0x0bd5('0x18')](_0x3ffb08)[_0x0bd5('0x27')](_0x18cec3);};}exports[_0x0bd5('0x28')]=function(_0x15561b,_0xcbfc51){var _0x2e10ce={},_0x2704ee={},_0x5e5a33={'count':0x0,'rows':[]};var _0x461ae3=_[_0x0bd5('0x29')](db['ScreenRecording'][_0x0bd5('0x2a')],function(_0x8eccc9){return{'name':_0x8eccc9['fieldName'],'type':_0x8eccc9[_0x0bd5('0x2b')][_0x0bd5('0x2c')]};});_0x2704ee[_0x0bd5('0x2d')]=_[_0x0bd5('0x2e')](_['map'](_0x461ae3,_0x0bd5('0x26')),[_0x0bd5('0x2f')]);_0x2704ee[_0x0bd5('0x30')]=_[_0x0bd5('0x31')](_0x15561b[_0x0bd5('0x30')]);_0x2704ee[_0x0bd5('0x32')]=_['intersection'](_0x2704ee[_0x0bd5('0x2d')],_0x2704ee['query']);_0x2e10ce[_0x0bd5('0x33')]=_[_0x0bd5('0x34')](_0x2704ee[_0x0bd5('0x2d')],qs[_0x0bd5('0x35')](_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x35')]));_0x2e10ce[_0x0bd5('0x33')]=_0x2e10ce[_0x0bd5('0x33')][_0x0bd5('0x36')]?_0x2e10ce[_0x0bd5('0x33')]:_0x2704ee[_0x0bd5('0x2d')];if(!_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x37')]('nolimit')){_0x2e10ce[_0x0bd5('0x1c')]=qs[_0x0bd5('0x1c')](_0x15561b['query']['limit']);_0x2e10ce[_0x0bd5('0x1b')]=qs[_0x0bd5('0x1b')](_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x1b')]);}_0x2e10ce[_0x0bd5('0x38')]=qs[_0x0bd5('0x39')](_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x39')]);_0x2e10ce[_0x0bd5('0x3a')]=qs[_0x0bd5('0x32')](_[_0x0bd5('0x3b')](_0x15561b[_0x0bd5('0x30')],_0x2704ee[_0x0bd5('0x32')]),_0x461ae3);if(_0x15561b['query'][_0x0bd5('0x3c')]){_0x2e10ce['where']=_[_0x0bd5('0x3d')](_0x2e10ce[_0x0bd5('0x3a')],{'$or':_[_0x0bd5('0x29')](_0x461ae3,function(_0x1fcc49){if(_0x1fcc49[_0x0bd5('0x2b')]!==_0x0bd5('0x3e')){var _0x53a682={};_0x53a682[_0x1fcc49[_0x0bd5('0x26')]]={'$like':'%'+_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x3c')]+'%'};return _0x53a682;}})});}_0x2e10ce=_[_0x0bd5('0x3d')]({},_0x2e10ce,_0x15561b[_0x0bd5('0x3f')]);var _0x493089={'where':_0x2e10ce[_0x0bd5('0x3a')]};return db[_0x0bd5('0x40')][_0x0bd5('0x1e')](_0x493089)['then'](function(_0x177aa3){_0x5e5a33['count']=_0x177aa3;if(_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x41')]){_0x2e10ce['include']=[{'all':!![]}];}return db[_0x0bd5('0x40')][_0x0bd5('0x42')](_0x2e10ce);})[_0x0bd5('0x23')](function(_0x3ec4b0){_0x5e5a33[_0x0bd5('0x43')]=_0x3ec4b0;return _0x5e5a33;})[_0x0bd5('0x23')](respondWithFilteredResult(_0xcbfc51,_0x2e10ce))[_0x0bd5('0x44')](handleError(_0xcbfc51,null));};exports['show']=function(_0x4d3ca5,_0x994f24){var _0x545b63={'raw':![],'where':{'id':_0x4d3ca5[_0x0bd5('0x45')]['id']}},_0x5dd42b={};_0x5dd42b[_0x0bd5('0x2d')]=_['keys'](db['ScreenRecording']['rawAttributes']);_0x5dd42b[_0x0bd5('0x30')]=_['keys'](_0x4d3ca5['query']);_0x5dd42b[_0x0bd5('0x32')]=_[_0x0bd5('0x34')](_0x5dd42b['model'],_0x5dd42b['query']);_0x545b63[_0x0bd5('0x33')]=_[_0x0bd5('0x34')](_0x5dd42b[_0x0bd5('0x2d')],qs[_0x0bd5('0x35')](_0x4d3ca5['query'][_0x0bd5('0x35')]));_0x545b63[_0x0bd5('0x33')]=_0x545b63[_0x0bd5('0x33')][_0x0bd5('0x36')]?_0x545b63[_0x0bd5('0x33')]:_0x5dd42b[_0x0bd5('0x2d')];if(_0x4d3ca5['query'][_0x0bd5('0x41')]){_0x545b63[_0x0bd5('0x46')]=[{'all':!![]}];}_0x545b63=_[_0x0bd5('0x3d')]({},_0x545b63,_0x4d3ca5['options']);return db[_0x0bd5('0x40')][_0x0bd5('0x47')](_0x545b63)[_0x0bd5('0x23')](handleEntityNotFound(_0x994f24,null))['then'](respondWithResult(_0x994f24,null))[_0x0bd5('0x44')](handleError(_0x994f24,null));};exports[_0x0bd5('0x48')]=function(_0x54cd78,_0x18c7c7){return db[_0x0bd5('0x40')]['create'](_0x54cd78[_0x0bd5('0x49')],{})[_0x0bd5('0x23')](respondWithResult(_0x18c7c7,0xc9))['catch'](handleError(_0x18c7c7,null));};exports[_0x0bd5('0x4a')]=function(_0x20960a,_0x146bdc){if(_0x20960a[_0x0bd5('0x49')]['id']){delete _0x20960a[_0x0bd5('0x49')]['id'];}delete _0x20960a['body'][_0x0bd5('0x4b')];delete _0x20960a[_0x0bd5('0x49')]['createdAt'];delete _0x20960a[_0x0bd5('0x49')]['closedAt'];delete _0x20960a[_0x0bd5('0x49')][_0x0bd5('0x4c')];return db[_0x0bd5('0x40')][_0x0bd5('0x47')]({'where':{'id':_0x20960a['params']['id']}})[_0x0bd5('0x23')](handleEntityNotFound(_0x146bdc,null))['then'](saveUpdates(_0x20960a['body'],null))[_0x0bd5('0x23')](respondWithResult(_0x146bdc,null))[_0x0bd5('0x44')](handleError(_0x146bdc,null));};exports[_0x0bd5('0x4d')]=function(_0x4c9a79,_0x424187){return db['ScreenRecording'][_0x0bd5('0x4d')]()[_0x0bd5('0x23')](respondWithResult(_0x424187,null))[_0x0bd5('0x44')](handleError(_0x424187,null));};exports['download']=function(_0x512fe3,_0x4f0467,_0x122f84){var _0x21db5d=require(_0x0bd5('0x4e'));var _0x5b06c6=![];var _0x2b174a={};if(_0x512fe3[_0x0bd5('0x30')]['type']&&_0x512fe3[_0x0bd5('0x30')]['type']==='uniqueid'){_0x2b174a[_0x0bd5('0x4f')]=_0x512fe3[_0x0bd5('0x45')]['id'];}else{_0x2b174a['id']=_0x512fe3[_0x0bd5('0x45')]['id'];}return db[_0x0bd5('0x40')]['find']({'where':_0x2b174a,'attributes':['id',_0x0bd5('0x4c')],'raw':!![]})[_0x0bd5('0x23')](handleEntityNotFound(_0x4f0467,null))[_0x0bd5('0x23')](function(_0x5cf2f2){if(_0x5cf2f2){var _0x504e46=path[_0x0bd5('0x50')](config[_0x0bd5('0x51')],'server/files/screen_recordings',_0x5cf2f2['value']);var _0x2b11e8=util['format'](_0x0bd5('0x52'),_0x504e46);if(fs[_0x0bd5('0x53')](_0x2b11e8)){_0x5b06c6=!![];return _0x21db5d[_0x0bd5('0x54')](_0x2b11e8,_0x504e46,config['secrets'][_0x0bd5('0x55')])[_0x0bd5('0x23')](function(){return _0x5cf2f2;});}return _0x5cf2f2;}})[_0x0bd5('0x23')](function(_0x38aae5){if(_0x38aae5){var _0x5e93fa=path[_0x0bd5('0x50')](config[_0x0bd5('0x51')],_0x0bd5('0x56'),_0x38aae5[_0x0bd5('0x4c')]);if(!fs[_0x0bd5('0x53')](_0x5e93fa)){throw new db['Sequelize'][(_0x0bd5('0x57'))]('ScreenRecording\x20not\x20found');}if(_0x38aae5[_0x0bd5('0x58')]){return _0x4f0467['download'](_0x5e93fa,_0x38aae5['filename']+path[_0x0bd5('0x59')](_0x5e93fa),function(){if(_0x5b06c6){fs['unlink'](_0x5e93fa);}});}else{return _0x4f0467[_0x0bd5('0x5a')](_0x5e93fa,function(_0x3087de){if(_0x5b06c6){fs[_0x0bd5('0x5b')](_0x5e93fa);}});}}})['catch'](function(_0x4f7e86){if(_0x4f7e86[_0x0bd5('0x5c')]==='ScreenRecording\x20not\x20found'){_0x4f0467[_0x0bd5('0x18')](0x194)[_0x0bd5('0x27')]('Not\x20found');}else{return handleError(_0x4f0467,null);}});};exports[_0x0bd5('0x5d')]=function(_0x5a38b1,_0x45ccf5){return db[_0x0bd5('0x40')][_0x0bd5('0x47')]({'where':{'id':_0x5a38b1[_0x0bd5('0x45')]['id']}})[_0x0bd5('0x23')](function(_0x467488){if(_[_0x0bd5('0x5e')](_0x467488)){throw new ReferenceError('Entity\x20not\x20found');}return _0x467488;})[_0x0bd5('0x23')](function(_0x1e5e7d){var _0x33c5eb=path['join'](config['root'],_0x0bd5('0x56'),_0x1e5e7d[_0x0bd5('0x4c')]);logger[_0x0bd5('0x5f')](_0x0bd5('0x60'),_0x33c5eb);if(!_[_0x0bd5('0x5e')](_0x1e5e7d[_0x0bd5('0x4c')])&&fs[_0x0bd5('0x53')](_0x33c5eb)){logger[_0x0bd5('0x5f')](_0x0bd5('0x61')+_0x33c5eb+_0x0bd5('0x62'));fs[_0x0bd5('0x63')](_0x33c5eb);}_0x33c5eb=_0x33c5eb+_0x0bd5('0x64');if(!_[_0x0bd5('0x5e')](_0x1e5e7d[_0x0bd5('0x4c')])&&fs[_0x0bd5('0x53')](_0x33c5eb)){logger[_0x0bd5('0x5f')](_0x0bd5('0x61')+_0x33c5eb+_0x0bd5('0x62'));fs['unlinkSync'](_0x33c5eb);}return _0x1e5e7d;})[_0x0bd5('0x23')](function(_0x32eaaf){if(!_0x32eaaf)throw new InternalError();return _0x32eaaf['destroy']();})[_0x0bd5('0x23')](function(){_0x45ccf5['status'](0xcc)[_0x0bd5('0x19')]();})[_0x0bd5('0x44')](handleError(_0x45ccf5,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 2d80ba0..52476aa 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 _0x88fb=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x88fb,0xdc));var _0xb88f=function(_0x1b986c,_0x304375){_0x1b986c=_0x1b986c-0x0;var _0x262cbc=_0x88fb[_0x1b986c];return _0x262cbc;};'use strict';var _=require(_0xb88f('0x0'));var util=require('util');var logger=require(_0xb88f('0x1'))(_0xb88f('0x2'));var moment=require(_0xb88f('0x3'));var BPromise=require(_0xb88f('0x4'));var rp=require(_0xb88f('0x5'));var fs=require('fs');var path=require(_0xb88f('0x6'));var rimraf=require('rimraf');var config=require(_0xb88f('0x7'));var attributes=require(_0xb88f('0x8'));module[_0xb88f('0x9')]=function(_0x20e661,_0x570979){return _0x20e661['define'](_0xb88f('0xa'),attributes,{'tableName':_0xb88f('0xb'),'paranoid':![],'indexes':[{'name':_0xb88f('0xc'),'fields':[_0xb88f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1524=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid'];(function(_0x4c2222,_0x36b84f){var _0x5424ef=function(_0x175c64){while(--_0x175c64){_0x4c2222['push'](_0x4c2222['shift']());}};_0x5424ef(++_0x36b84f);}(_0x1524,0x70));var _0x4152=function(_0x33ba78,_0xbcaa2d){_0x33ba78=_0x33ba78-0x0;var _0x24a8a8=_0x1524[_0x33ba78];return _0x24a8a8;};'use strict';var _=require(_0x4152('0x0'));var util=require(_0x4152('0x1'));var logger=require(_0x4152('0x2'))(_0x4152('0x3'));var moment=require(_0x4152('0x4'));var BPromise=require(_0x4152('0x5'));var rp=require(_0x4152('0x6'));var fs=require('fs');var path=require(_0x4152('0x7'));var rimraf=require(_0x4152('0x8'));var config=require(_0x4152('0x9'));var attributes=require(_0x4152('0xa'));module[_0x4152('0xb')]=function(_0x6e15d8,_0x516271){return _0x6e15d8[_0x4152('0xc')](_0x4152('0xd'),attributes,{'tableName':_0x4152('0xe'),'paranoid':![],'indexes':[{'name':_0x4152('0xf'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 84dee6c..03187ed 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 _0x69ca=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','ScreenRecording,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xd8de75,_0x2b1975){var _0x1fe673=function(_0x394f42){while(--_0x394f42){_0xd8de75['push'](_0xd8de75['shift']());}};_0x1fe673(++_0x2b1975);}(_0x69ca,0x170));var _0xa69c=function(_0x50f288,_0xfecd76){_0x50f288=_0x50f288-0x0;var _0x2a0755=_0x69ca[_0x50f288];return _0x2a0755;};'use strict';var _=require(_0xa69c('0x0'));var util=require(_0xa69c('0x1'));var moment=require(_0xa69c('0x2'));var BPromise=require(_0xa69c('0x3'));var rs=require(_0xa69c('0x4'));var fs=require('fs');var Redis=require(_0xa69c('0x5'));var db=require(_0xa69c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa69c('0x7'))(_0xa69c('0x8'));var config=require(_0xa69c('0x9'));var jayson=require(_0xa69c('0xa'));var client=jayson[_0xa69c('0xb')][_0xa69c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e7dc1,_0x42c21d,_0x4b44d4){return new BPromise(function(_0x542ac6,_0x2108bc){return client[_0xa69c('0xd')](_0x3e7dc1,_0x4b44d4)['then'](function(_0xd23e92){logger[_0xa69c('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x42c21d,_0xa69c('0xf'));logger[_0xa69c('0x10')](_0xa69c('0x11'),_0x42c21d,'request\x20sent',JSON[_0xa69c('0x12')](_0xd23e92));if(_0xd23e92[_0xa69c('0x13')]){if(_0xd23e92['error'][_0xa69c('0x14')]===0x1f4){logger[_0xa69c('0x13')](_0xa69c('0x15'),_0x42c21d,_0xd23e92[_0xa69c('0x13')][_0xa69c('0x16')]);return _0x2108bc(_0xd23e92[_0xa69c('0x13')][_0xa69c('0x16')]);}logger[_0xa69c('0x13')](_0xa69c('0x15'),_0x42c21d,_0xd23e92['error'][_0xa69c('0x16')]);return _0x542ac6(_0xd23e92[_0xa69c('0x13')][_0xa69c('0x16')]);}else{logger['info'](_0xa69c('0x15'),_0x42c21d,_0xa69c('0xf'));_0x542ac6(_0xd23e92[_0xa69c('0x17')][_0xa69c('0x16')]);}})[_0xa69c('0x18')](function(_0x24b509){logger[_0xa69c('0x13')]('ScreenRecording,\x20%s,\x20%s',_0x42c21d,_0x24b509);_0x2108bc(_0x24b509);});});} \ No newline at end of file +var _0xaac4=['message','request\x20sent','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x421526,_0x368eca){var _0xc44c07=function(_0x31b0cc){while(--_0x31b0cc){_0x421526['push'](_0x421526['shift']());}};_0xc44c07(++_0x368eca);}(_0xaac4,0x164));var _0x4aac=function(_0x4c06a3,_0x1e6b6f){_0x4c06a3=_0x4c06a3-0x0;var _0x7ff53c=_0xaac4[_0x4c06a3];return _0x7ff53c;};'use strict';var _=require(_0x4aac('0x0'));var util=require(_0x4aac('0x1'));var moment=require(_0x4aac('0x2'));var BPromise=require(_0x4aac('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4aac('0x4'));var logger=require(_0x4aac('0x5'))(_0x4aac('0x6'));var config=require(_0x4aac('0x7'));var jayson=require(_0x4aac('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e2def,_0x2f76df,_0xb7283d){return new BPromise(function(_0x3dac6f,_0x6dd91d){return client[_0x4aac('0x9')](_0x3e2def,_0xb7283d)[_0x4aac('0xa')](function(_0x4a52d9){logger[_0x4aac('0xb')](_0x4aac('0xc'),_0x2f76df,'request\x20sent');logger[_0x4aac('0xd')](_0x4aac('0xe'),_0x2f76df,'request\x20sent',JSON[_0x4aac('0xf')](_0x4a52d9));if(_0x4a52d9['error']){if(_0x4a52d9['error'][_0x4aac('0x10')]===0x1f4){logger[_0x4aac('0x11')](_0x4aac('0xc'),_0x2f76df,_0x4a52d9[_0x4aac('0x11')][_0x4aac('0x12')]);return _0x6dd91d(_0x4a52d9['error']['message']);}logger[_0x4aac('0x11')](_0x4aac('0xc'),_0x2f76df,_0x4a52d9[_0x4aac('0x11')]['message']);return _0x3dac6f(_0x4a52d9[_0x4aac('0x11')]['message']);}else{logger[_0x4aac('0xb')](_0x4aac('0xc'),_0x2f76df,_0x4aac('0x13'));_0x3dac6f(_0x4a52d9[_0x4aac('0x14')][_0x4aac('0x12')]);}})[_0x4aac('0x15')](function(_0x1378aa){logger[_0x4aac('0x11')](_0x4aac('0xc'),_0x2f76df,_0x1378aa);_0x6dd91d(_0x1378aa);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 4552aef..b724070 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 _0x406d=['/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','%s%s','extname','originalname','post','file','addLogo','format','logologin','/:id/logo_login','addLogoLogin','preferred','addPreferred','favicon','single','/:id','update','multer','util','path','Router','fs-extra','../../components/auth/service','./setting.controller','isAuthenticated','index','get','/now','show','/:id/logo','getLogo','getLogoLogin'];(function(_0x4901c6,_0x3de057){var _0x4af485=function(_0x2efeea){while(--_0x2efeea){_0x4901c6['push'](_0x4901c6['shift']());}};_0x4af485(++_0x3de057);}(_0x406d,0x1d1));var _0xd406=function(_0x10faf1,_0x4641bb){_0x10faf1=_0x10faf1-0x0;var _0x33e27e=_0x406d[_0x10faf1];return _0x33e27e;};'use strict';var multer=require(_0xd406('0x0'));var util=require(_0xd406('0x1'));var path=require(_0xd406('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd406('0x3')]();var fs_extra=require(_0xd406('0x4'));var auth=require(_0xd406('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd406('0x6'));router['get']('/',auth[_0xd406('0x7')](),controller[_0xd406('0x8')]);router[_0xd406('0x9')](_0xd406('0xa'),controller['getDate']);router[_0xd406('0x9')]('/:id',controller[_0xd406('0xb')]);router['get'](_0xd406('0xc'),controller[_0xd406('0xd')]);router[_0xd406('0x9')]('/:id/logo_login',controller[_0xd406('0xe')]);router[_0xd406('0x9')](_0xd406('0xf'),controller['gdpr']);router[_0xd406('0x9')](_0xd406('0x10'),controller[_0xd406('0x11')]);router[_0xd406('0x9')](_0xd406('0x12'),controller[_0xd406('0x13')]);var upload=multer({'storage':multer[_0xd406('0x14')]({'destination':function(_0x5ab1ac,_0x58bac0,_0xe9d0a8){_0xe9d0a8(null,path[_0xd406('0x15')](config[_0xd406('0x16')],_0xd406('0x17')));},'filename':function(_0x46f850,_0x35bab4,_0x12386e){_0x12386e(null,util['format'](_0xd406('0x18'),'logo',path[_0xd406('0x19')](_0x35bab4[_0xd406('0x1a')])));}})});router[_0xd406('0x1b')](_0xd406('0xc'),upload['single'](_0xd406('0x1c')),controller[_0xd406('0x1d')]);var upload=multer({'storage':multer[_0xd406('0x14')]({'destination':function(_0x5844da,_0x5bd0e2,_0x15fef5){_0x15fef5(null,path['join'](config[_0xd406('0x16')],_0xd406('0x17')));},'filename':function(_0x53d84e,_0x1885c7,_0x40922f){_0x40922f(null,util[_0xd406('0x1e')](_0xd406('0x18'),_0xd406('0x1f'),path['extname'](_0x1885c7[_0xd406('0x1a')])));}})});router['post'](_0xd406('0x20'),upload['single'](_0xd406('0x1c')),controller[_0xd406('0x21')]);var upload=multer({'storage':multer[_0xd406('0x14')]({'destination':function(_0x55a9e8,_0x3a59bf,_0x560a27){_0x560a27(null,path[_0xd406('0x15')](config[_0xd406('0x16')],_0xd406('0x17')));},'filename':function(_0x386159,_0x1fe82b,_0x36cbe9){_0x36cbe9(null,util[_0xd406('0x1e')]('%s%s',_0xd406('0x22'),path['extname'](_0x1fe82b[_0xd406('0x1a')])));}})});router[_0xd406('0x1b')](_0xd406('0x10'),upload['single'](_0xd406('0x1c')),controller[_0xd406('0x23')]);var upload=multer({'storage':multer[_0xd406('0x14')]({'destination':function(_0x25c1bb,_0x7e0d28,_0x109955){_0x109955(null,path['join'](config[_0xd406('0x16')],_0xd406('0x17')));},'filename':function(_0xc7adfe,_0x3fad3f,_0x446def){_0x446def(null,util[_0xd406('0x1e')]('%s%s',_0xd406('0x24'),path[_0xd406('0x19')](_0x3fad3f[_0xd406('0x1a')])));}})});router[_0xd406('0x1b')]('/:id/favicon',upload[_0xd406('0x25')](_0xd406('0x1c')),controller['addFavicon']);router['put'](_0xd406('0x26'),auth[_0xd406('0x7')](),controller[_0xd406('0x27')]);module['exports']=router; \ No newline at end of file +var _0xfbda=['%s%s','logo','originalname','post','file','addLogo','diskStorage','join','root','logologin','extname','addLogoLogin','preferred','single','addPreferred','favicon','addFavicon','put','isAuthenticated','update','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','/now','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','getFavicon','server/files/images/logos/','format'];(function(_0x4faa19,_0xff2e9e){var _0x5e751b=function(_0x584955){while(--_0x584955){_0x4faa19['push'](_0x4faa19['shift']());}};_0x5e751b(++_0xff2e9e);}(_0xfbda,0x6c));var _0xafbd=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xfbda[_0xaa0309];return _0x5de7ce;};'use strict';var multer=require(_0xafbd('0x0'));var util=require('util');var path=require(_0xafbd('0x1'));var timeout=require(_0xafbd('0x2'));var express=require('express');var router=express[_0xafbd('0x3')]();var fs_extra=require(_0xafbd('0x4'));var auth=require(_0xafbd('0x5'));var interaction=require(_0xafbd('0x6'));var config=require(_0xafbd('0x7'));var controller=require(_0xafbd('0x8'));router[_0xafbd('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xafbd('0x9')](_0xafbd('0xa'),controller['getDate']);router[_0xafbd('0x9')](_0xafbd('0xb'),controller[_0xafbd('0xc')]);router[_0xafbd('0x9')](_0xafbd('0xd'),controller[_0xafbd('0xe')]);router[_0xafbd('0x9')](_0xafbd('0xf'),controller[_0xafbd('0x10')]);router[_0xafbd('0x9')](_0xafbd('0x11'),controller[_0xafbd('0x12')]);router[_0xafbd('0x9')](_0xafbd('0x13'),controller['getPreferred']);router['get'](_0xafbd('0x14'),controller[_0xafbd('0x15')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x268875,_0x60f2d0,_0x544157){_0x544157(null,path['join'](config['root'],_0xafbd('0x16')));},'filename':function(_0x5530c1,_0x27e202,_0x205ab1){_0x205ab1(null,util[_0xafbd('0x17')](_0xafbd('0x18'),_0xafbd('0x19'),path['extname'](_0x27e202[_0xafbd('0x1a')])));}})});router[_0xafbd('0x1b')](_0xafbd('0xd'),upload['single'](_0xafbd('0x1c')),controller[_0xafbd('0x1d')]);var upload=multer({'storage':multer[_0xafbd('0x1e')]({'destination':function(_0x1291e6,_0x27eb15,_0x386b41){_0x386b41(null,path[_0xafbd('0x1f')](config[_0xafbd('0x20')],'server/files/images/logos/'));},'filename':function(_0x4217e5,_0x1d1060,_0x38bace){_0x38bace(null,util[_0xafbd('0x17')]('%s%s',_0xafbd('0x21'),path[_0xafbd('0x22')](_0x1d1060[_0xafbd('0x1a')])));}})});router[_0xafbd('0x1b')](_0xafbd('0xf'),upload['single'](_0xafbd('0x1c')),controller[_0xafbd('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5858fb,_0xf28026,_0x21e75b){_0x21e75b(null,path[_0xafbd('0x1f')](config[_0xafbd('0x20')],_0xafbd('0x16')));},'filename':function(_0x1714a1,_0x53fce1,_0xdcb6d5){_0xdcb6d5(null,util[_0xafbd('0x17')]('%s%s',_0xafbd('0x24'),path['extname'](_0x53fce1['originalname'])));}})});router[_0xafbd('0x1b')]('/:id/preferred',upload[_0xafbd('0x25')](_0xafbd('0x1c')),controller[_0xafbd('0x26')]);var upload=multer({'storage':multer[_0xafbd('0x1e')]({'destination':function(_0xb53fc3,_0x482aaf,_0x44eb85){_0x44eb85(null,path[_0xafbd('0x1f')](config['root'],'server/files/images/logos/'));},'filename':function(_0x3a4c18,_0x537df9,_0x1f2270){_0x1f2270(null,util[_0xafbd('0x17')](_0xafbd('0x18'),_0xafbd('0x27'),path['extname'](_0x537df9['originalname'])));}})});router[_0xafbd('0x1b')](_0xafbd('0x14'),upload[_0xafbd('0x25')](_0xafbd('0x1c')),controller[_0xafbd('0x28')]);router[_0xafbd('0x29')](_0xafbd('0xb'),auth[_0xafbd('0x2a')](),controller[_0xafbd('0x2b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index d5810e3..d118a13 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x334f11,_0x43d43b){var _0x344c9a=function(_0x4c517c){while(--_0x4c517c){_0x334f11['push'](_0x334f11['shift']());}};_0x344c9a(++_0x43d43b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x303e49,_0x45e239){var _0x4fff7a=function(_0xf81d23){while(--_0xf81d23){_0x303e49['push'](_0x303e49['shift']());}};_0x4fff7a(++_0x45e239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 3f49b00..84bd956 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 _0x46cc=['rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','include','findAll','rows','params','includeAll','find','catch','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','default_logo.svg','default','upperFirst','custom','root','Sequelize','download','getLogoLogin','defaultLogo','default_loginLogo.svg','securePassword','addPreferred','getPreferred','default_preferred.png','ValidationError','\x20not\x20found','addFavicon','default_favicon.ico','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','sendStatus','stack','name','map','Setting'];(function(_0x3bd158,_0x533145){var _0x2c5f9c=function(_0x36fd1c){while(--_0x36fd1c){_0x3bd158['push'](_0x3bd158['shift']());}};_0x2c5f9c(++_0x533145);}(_0x46cc,0xc1));var _0xc46c=function(_0x12e3f4,_0x4a3923){_0x12e3f4=_0x12e3f4-0x0;var _0x50d9b4=_0x46cc[_0x12e3f4];return _0x50d9b4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc46c('0x0'));var zipdir=require(_0xc46c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc46c('0x2'));var moment=require(_0xc46c('0x3'));var BPromise=require(_0xc46c('0x4'));var Mustache=require(_0xc46c('0x5'));var util=require('util');var path=require('path');var sox=require(_0xc46c('0x6'));var csv=require(_0xc46c('0x7'));var ejs=require(_0xc46c('0x8'));var fs=require('fs');var fs_extra=require(_0xc46c('0x9'));var _=require(_0xc46c('0xa'));var squel=require(_0xc46c('0xb'));var crypto=require(_0xc46c('0xc'));var jsforce=require(_0xc46c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc46c('0x7'));var querystring=require(_0xc46c('0xe'));var Papa=require('papaparse');var Redis=require(_0xc46c('0xf'));var authService=require(_0xc46c('0x10'));var qs=require(_0xc46c('0x11'));var as=require(_0xc46c('0x12'));var hardwareService=require(_0xc46c('0x13'));var logger=require(_0xc46c('0x14'))(_0xc46c('0x15'));var utils=require(_0xc46c('0x16'));var config=require(_0xc46c('0x17'));var licenseUtil=require(_0xc46c('0x18'));var db=require(_0xc46c('0x19'))['db'];var jayson=require(_0xc46c('0x1a'));var client=jayson[_0xc46c('0x1b')][_0xc46c('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3bb544,_0x28132e,_0x2c9766,_0x5aaf37){return new BPromise(function(_0x1a9cc0,_0x240d60){var _0x13d794=_0x5aaf37||client;return _0x13d794['request'](_0x3bb544,_0x2c9766)['then'](function(_0x26e968){logger[_0xc46c('0x1d')](_0xc46c('0x1e'),_0x28132e,_0xc46c('0x1f'));logger[_0xc46c('0x20')](_0xc46c('0x21'),_0x28132e,'request\x20sent',JSON[_0xc46c('0x22')](_0x26e968));if(_0x26e968[_0xc46c('0x23')]){if(_0x26e968[_0xc46c('0x23')][_0xc46c('0x24')]===0x1f4){logger[_0xc46c('0x23')](_0xc46c('0x1e'),_0x28132e,_0x26e968[_0xc46c('0x23')]['message']);return _0x240d60(_0x26e968[_0xc46c('0x23')][_0xc46c('0x25')]);}logger['error'](_0xc46c('0x1e'),_0x28132e,_0x26e968['error'][_0xc46c('0x25')]);return _0x1a9cc0(_0x26e968['error']['message']);}else{logger['info'](_0xc46c('0x1e'),_0x28132e,_0xc46c('0x1f'));_0x1a9cc0(_0x26e968[_0xc46c('0x26')][_0xc46c('0x25')]);}})['catch'](function(_0x52ada4){logger[_0xc46c('0x23')](_0xc46c('0x1e'),_0x28132e,_0x52ada4);_0x240d60(_0x52ada4);});});}function respondWithStatusCode(_0x58e7ec,_0x13b316){_0x13b316=_0x13b316||0xcc;return function(_0x4de3f4){if(_0x4de3f4){return _0x58e7ec['sendStatus'](_0x13b316);}return _0x58e7ec[_0xc46c('0x27')](_0x13b316)[_0xc46c('0x28')]();};}function respondWithResult(_0xadcbc4,_0x554741){_0x554741=_0x554741||0xc8;return function(_0x166932){if(_0x166932){return _0xadcbc4[_0xc46c('0x27')](_0x554741)[_0xc46c('0x29')](_0x166932);}};}function respondWithFilteredResult(_0x177090,_0x51c67d){return function(_0x3f9ad5){if(_0x3f9ad5){var _0x4474b2=typeof _0x51c67d[_0xc46c('0x2a')]===_0xc46c('0x2b')&&typeof _0x51c67d[_0xc46c('0x2c')]==='undefined';var _0x44084e=_0x3f9ad5['count'];var _0x183004=_0x4474b2?0x0:_0x51c67d[_0xc46c('0x2a')];var _0x168ef1=_0x4474b2?_0x3f9ad5[_0xc46c('0x2d')]:_0x51c67d[_0xc46c('0x2a')]+_0x51c67d[_0xc46c('0x2c')];var _0x2c2c13;if(_0x168ef1>=_0x44084e){_0x168ef1=_0x44084e;_0x2c2c13=0xc8;}else{_0x2c2c13=0xce;}_0x177090[_0xc46c('0x27')](_0x2c2c13);return _0x177090[_0xc46c('0x2e')]('Content-Range',_0x183004+'-'+_0x168ef1+'/'+_0x44084e)[_0xc46c('0x29')](_0x3f9ad5);}return null;};}function patchUpdates(_0x3d5d8c){return function(_0x5d1787){try{jsonpatch[_0xc46c('0x2f')](_0x5d1787,_0x3d5d8c,!![]);}catch(_0x849754){return BPromise[_0xc46c('0x30')](_0x849754);}return _0x5d1787['save']();};}function saveUpdates(_0x923ea5,_0x282846){return function(_0x2558a9){if(_0x2558a9){return _0x2558a9[_0xc46c('0x31')](_0x923ea5)[_0xc46c('0x32')](function(_0x499856){return _0x499856;});}return null;};}function removeEntity(_0x45f173,_0x5a8078){return function(_0x78eeb0){if(_0x78eeb0){return _0x78eeb0[_0xc46c('0x33')]()[_0xc46c('0x32')](function(){_0x45f173['status'](0xcc)[_0xc46c('0x28')]();});}};}function handleEntityNotFound(_0x5d46cb,_0xf3a60d){return function(_0x311035){if(!_0x311035){_0x5d46cb[_0xc46c('0x34')](0x194);}return _0x311035;};}function handleError(_0x24e107,_0x1a29ee){_0x1a29ee=_0x1a29ee||0x1f4;return function(_0x477989){logger[_0xc46c('0x23')](_0x477989[_0xc46c('0x35')]);if(_0x477989[_0xc46c('0x36')]){delete _0x477989[_0xc46c('0x36')];}_0x24e107[_0xc46c('0x27')](_0x1a29ee)['send'](_0x477989);};}exports['index']=function(_0x5776a5,_0x5bbdc4){var _0x2dc452={},_0x1e6695={},_0x927c93={'count':0x0,'rows':[]};var _0x54ac31=_[_0xc46c('0x37')](db[_0xc46c('0x38')][_0xc46c('0x39')],function(_0x291679){return{'name':_0x291679[_0xc46c('0x3a')],'type':_0x291679['type'][_0xc46c('0x3b')]};});_0x1e6695[_0xc46c('0x3c')]=_['map'](_0x54ac31,_0xc46c('0x36'));_0x1e6695[_0xc46c('0x3d')]=_[_0xc46c('0x3e')](_0x5776a5[_0xc46c('0x3d')]);_0x1e6695['filters']=_['intersection'](_0x1e6695['model'],_0x1e6695[_0xc46c('0x3d')]);_0x2dc452[_0xc46c('0x3f')]=_[_0xc46c('0x40')](_0x1e6695[_0xc46c('0x3c')],qs['fields'](_0x5776a5['query'][_0xc46c('0x41')]));_0x2dc452[_0xc46c('0x3f')]=_0x2dc452[_0xc46c('0x3f')][_0xc46c('0x42')]?_0x2dc452[_0xc46c('0x3f')]:_0x1e6695[_0xc46c('0x3c')];if(!_0x5776a5[_0xc46c('0x3d')][_0xc46c('0x43')](_0xc46c('0x44'))){_0x2dc452['limit']=qs[_0xc46c('0x2c')](_0x5776a5[_0xc46c('0x3d')][_0xc46c('0x2c')]);_0x2dc452['offset']=qs[_0xc46c('0x2a')](_0x5776a5[_0xc46c('0x3d')][_0xc46c('0x2a')]);}_0x2dc452[_0xc46c('0x45')]=qs[_0xc46c('0x46')](_0x5776a5[_0xc46c('0x3d')][_0xc46c('0x46')]);_0x2dc452[_0xc46c('0x47')]=qs['filters'](_[_0xc46c('0x48')](_0x5776a5[_0xc46c('0x3d')],_0x1e6695[_0xc46c('0x49')]),_0x54ac31);if(_0x5776a5['query'][_0xc46c('0x4a')]){_0x2dc452[_0xc46c('0x47')]=_[_0xc46c('0x4b')](_0x2dc452['where'],{'$or':_['map'](_0x54ac31,function(_0x5324aa){if(_0x5324aa['type']!=='VIRTUAL'){var _0x3fc3e3={};_0x3fc3e3[_0x5324aa[_0xc46c('0x36')]]={'$like':'%'+_0x5776a5[_0xc46c('0x3d')][_0xc46c('0x4a')]+'%'};return _0x3fc3e3;}})});}_0x2dc452=_[_0xc46c('0x4b')]({},_0x2dc452,_0x5776a5[_0xc46c('0x4c')]);var _0x31bb3b={'where':_0x2dc452[_0xc46c('0x47')]};return db[_0xc46c('0x38')][_0xc46c('0x2d')](_0x31bb3b)['then'](function(_0x8bb723){_0x927c93[_0xc46c('0x2d')]=_0x8bb723;if(_0x5776a5[_0xc46c('0x3d')]['includeAll']){_0x2dc452[_0xc46c('0x4d')]=[{'all':!![]}];}return db['Setting'][_0xc46c('0x4e')](_0x2dc452);})[_0xc46c('0x32')](function(_0x2e43c8){_0x927c93[_0xc46c('0x4f')]=_0x2e43c8;return _0x927c93;})[_0xc46c('0x32')](respondWithFilteredResult(_0x5bbdc4,_0x2dc452))['catch'](handleError(_0x5bbdc4,null));};exports['show']=function(_0x2a5943,_0x31df70){var _0x5c8abb={'raw':![],'where':{'id':_0x2a5943[_0xc46c('0x50')]['id']}},_0x274db9={};_0x274db9[_0xc46c('0x3c')]=_[_0xc46c('0x3e')](db[_0xc46c('0x38')][_0xc46c('0x39')]);_0x274db9[_0xc46c('0x3d')]=_['keys'](_0x2a5943[_0xc46c('0x3d')]);_0x274db9['filters']=_[_0xc46c('0x40')](_0x274db9[_0xc46c('0x3c')],_0x274db9[_0xc46c('0x3d')]);_0x5c8abb[_0xc46c('0x3f')]=_[_0xc46c('0x40')](_0x274db9[_0xc46c('0x3c')],qs[_0xc46c('0x41')](_0x2a5943[_0xc46c('0x3d')]['fields']));_0x5c8abb[_0xc46c('0x3f')]=_0x5c8abb[_0xc46c('0x3f')][_0xc46c('0x42')]?_0x5c8abb[_0xc46c('0x3f')]:_0x274db9[_0xc46c('0x3c')];if(_0x2a5943[_0xc46c('0x3d')][_0xc46c('0x51')]){_0x5c8abb[_0xc46c('0x4d')]=[{'all':!![]}];}_0x5c8abb=_[_0xc46c('0x4b')]({},_0x5c8abb,_0x2a5943['options']);return db[_0xc46c('0x38')][_0xc46c('0x52')](_0x5c8abb)[_0xc46c('0x32')](handleEntityNotFound(_0x31df70,null))['then'](respondWithResult(_0x31df70,null))[_0xc46c('0x53')](handleError(_0x31df70,null));};exports[_0xc46c('0x31')]=function(_0x2a125c,_0x62f8fc){if(_0x2a125c[_0xc46c('0x54')]['id']){delete _0x2a125c[_0xc46c('0x54')]['id'];}return db[_0xc46c('0x38')]['find']({'where':{'id':_0x2a125c['params']['id']}})[_0xc46c('0x32')](handleEntityNotFound(_0x62f8fc,null))['then'](saveUpdates(_0x2a125c['body'],null))[_0xc46c('0x32')](respondWithResult(_0x62f8fc,null))[_0xc46c('0x53')](handleError(_0x62f8fc,null));};exports[_0xc46c('0x55')]=function(_0x36fd4d,_0x3375f8,_0x52dc88){if(_0x36fd4d[_0xc46c('0x56')]&&_0x36fd4d[_0xc46c('0x56')][_0xc46c('0x57')]){_0x36fd4d['body'][_0xc46c('0x58')]=_0x36fd4d[_0xc46c('0x56')][_0xc46c('0x57')];}return db[_0xc46c('0x38')][_0xc46c('0x52')]({'where':{'id':_0x36fd4d[_0xc46c('0x50')]['id']}})[_0xc46c('0x32')](handleEntityNotFound(_0x3375f8,null))[_0xc46c('0x32')](saveUpdates(_0x36fd4d['body'],null))[_0xc46c('0x32')](respondWithResult(_0x3375f8,null))['catch'](handleError(_0x3375f8,null));};exports[_0xc46c('0x59')]=function(_0x58fcfb,_0x4d094e,_0x40ef33){if(_0x58fcfb['file']&&_0x58fcfb[_0xc46c('0x56')][_0xc46c('0x57')]){_0x58fcfb['body'][_0xc46c('0x5a')]=_0x58fcfb[_0xc46c('0x56')][_0xc46c('0x57')];}return db[_0xc46c('0x38')][_0xc46c('0x52')]({'where':{'id':_0x58fcfb[_0xc46c('0x50')]['id']}})[_0xc46c('0x32')](handleEntityNotFound(_0x4d094e,null))[_0xc46c('0x32')](saveUpdates(_0x58fcfb['body'],null))[_0xc46c('0x32')](respondWithResult(_0x4d094e,null))[_0xc46c('0x53')](handleError(_0x4d094e,null));};var utilLicense=require(_0xc46c('0x18'));exports['getLogo']=function(_0x2a210a,_0x2c3136,_0x12a4b2){var _0x361805=_0xc46c('0x5b');var _0x2ec108={'custom':![]};return utilLicense[_0xc46c('0x5c')]()[_0xc46c('0x32')](function(_0x629e8e){if(_0x629e8e){_0x2ec108=_0x629e8e;}return db['Setting']['find']({'where':{'id':_0x2a210a[_0xc46c('0x50')]['id']},'attributes':[_0xc46c('0x58'),_0xc46c('0x5a'),_0xc46c('0x5d'),_0xc46c('0x5e'),'defaultLogo',_0xc46c('0x5f'),_0xc46c('0x60'),_0xc46c('0x61')],'raw':!![]});})[_0xc46c('0x32')](handleEntityNotFound(_0x2c3136,null))[_0xc46c('0x32')](function(_0x220987){if(_0x220987){var _0x212c6e=_0x220987[_0xc46c('0x58')]&&fs[_0xc46c('0x62')](path[_0xc46c('0x63')](config['root'],_0x361805,_[_0xc46c('0x64')](_0x220987[_0xc46c('0x58')])))?path[_0xc46c('0x63')](config['root'],_0x361805,_[_0xc46c('0x64')](_0x220987[_0xc46c('0x58')])):path[_0xc46c('0x63')](config['root'],_0x361805,_[_0xc46c('0x64')](_0xc46c('0x65')));var _0x3dc424=_0xc46c('0x66')+_[_0xc46c('0x67')](_0xc46c('0x58'));if(_0x220987[_0x3dc424]||!_0x2ec108[_0xc46c('0x68')]){_0x212c6e=path[_0xc46c('0x63')](config[_0xc46c('0x69')],_0x361805,_[_0xc46c('0x64')](_0xc46c('0x65')));}if(!fs[_0xc46c('0x62')](_0x212c6e)){throw new db[(_0xc46c('0x6a'))]['ValidationError'](_[_0xc46c('0x67')](_0xc46c('0x58'))+'\x20not\x20found');}return _0x2c3136[_0xc46c('0x6b')](_0x212c6e);}})[_0xc46c('0x53')](handleError(_0x2c3136,null));};var utilLicense=require(_0xc46c('0x18'));exports[_0xc46c('0x6c')]=function(_0x2ee274,_0x374b51,_0x8b05dc){var _0x114f99='server/files/images/logos';var _0x1ed5ad={'custom':![]};return utilLicense['getLicense']()[_0xc46c('0x32')](function(_0x59584e){if(_0x59584e){_0x1ed5ad=_0x59584e;}return db[_0xc46c('0x38')][_0xc46c('0x52')]({'where':{'id':_0x2ee274[_0xc46c('0x50')]['id']},'attributes':[_0xc46c('0x58'),'loginLogo',_0xc46c('0x5d'),_0xc46c('0x5e'),_0xc46c('0x6d'),_0xc46c('0x5f'),_0xc46c('0x60'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x374b51,null))[_0xc46c('0x32')](function(_0x239cb9){if(_0x239cb9){var _0x4224c1=_0x239cb9['loginLogo']&&fs[_0xc46c('0x62')](path['join'](config['root'],_0x114f99,_['toLower'](_0x239cb9[_0xc46c('0x5a')])))?path[_0xc46c('0x63')](config[_0xc46c('0x69')],_0x114f99,_['toLower'](_0x239cb9['loginLogo'])):path[_0xc46c('0x63')](config['root'],_0x114f99,_[_0xc46c('0x64')](_0xc46c('0x6e')));var _0x314473=_0xc46c('0x66')+_[_0xc46c('0x67')]('loginLogo');if(_0x239cb9[_0x314473]||!_0x1ed5ad[_0xc46c('0x68')]){_0x4224c1=path[_0xc46c('0x63')](config[_0xc46c('0x69')],_0x114f99,_[_0xc46c('0x64')](_0xc46c('0x6e')));}if(!fs[_0xc46c('0x62')](_0x4224c1)){throw new db['Sequelize']['ValidationError'](_[_0xc46c('0x67')](_0xc46c('0x5a'))+'\x20not\x20found');}return _0x374b51[_0xc46c('0x6b')](_0x4224c1);}})[_0xc46c('0x53')](handleError(_0x374b51,null));};exports['gdpr']=function(_0x31b1e4,_0xcb0321){return db[_0xc46c('0x38')]['find']({'where':{'id':_0x31b1e4[_0xc46c('0x50')]['id']},'attributes':[_0xc46c('0x6f')]})[_0xc46c('0x32')](respondWithResult(_0xcb0321,null))[_0xc46c('0x53')](handleError(_0xcb0321,null));};exports[_0xc46c('0x70')]=function(_0x22bfe1,_0x5a90f2,_0x276aec){if(_0x22bfe1[_0xc46c('0x56')]&&_0x22bfe1[_0xc46c('0x56')][_0xc46c('0x57')]){_0x22bfe1[_0xc46c('0x54')][_0xc46c('0x5d')]=_0x22bfe1[_0xc46c('0x56')][_0xc46c('0x57')];}return db['Setting']['find']({'where':{'id':_0x22bfe1['params']['id']}})[_0xc46c('0x32')](handleEntityNotFound(_0x5a90f2,null))[_0xc46c('0x32')](saveUpdates(_0x22bfe1[_0xc46c('0x54')],null))[_0xc46c('0x32')](respondWithResult(_0x5a90f2,null))[_0xc46c('0x53')](handleError(_0x5a90f2,null));};var utilLicense=require(_0xc46c('0x18'));exports[_0xc46c('0x71')]=function(_0x5d3d90,_0x15c1fa,_0x460e01){var _0x437607='server/files/images/logos';var _0x5adc0f={'custom':![]};return utilLicense[_0xc46c('0x5c')]()[_0xc46c('0x32')](function(_0x111901){if(_0x111901){_0x5adc0f=_0x111901;}return db[_0xc46c('0x38')]['find']({'where':{'id':_0x5d3d90[_0xc46c('0x50')]['id']},'attributes':['logo',_0xc46c('0x5a'),_0xc46c('0x5d'),_0xc46c('0x5e'),_0xc46c('0x6d'),_0xc46c('0x5f'),_0xc46c('0x60'),_0xc46c('0x61')],'raw':!![]});})['then'](handleEntityNotFound(_0x15c1fa,null))[_0xc46c('0x32')](function(_0x20af9f){if(_0x20af9f){var _0x855ebf=_0x20af9f[_0xc46c('0x5d')]&&fs[_0xc46c('0x62')](path[_0xc46c('0x63')](config[_0xc46c('0x69')],_0x437607,_[_0xc46c('0x64')](_0x20af9f[_0xc46c('0x5d')])))?path[_0xc46c('0x63')](config['root'],_0x437607,_[_0xc46c('0x64')](_0x20af9f['preferred'])):path[_0xc46c('0x63')](config[_0xc46c('0x69')],_0x437607,_[_0xc46c('0x64')](_0xc46c('0x72')));var _0x1bb82f=_0xc46c('0x66')+_[_0xc46c('0x67')](_0xc46c('0x5d'));if(_0x20af9f[_0x1bb82f]||!_0x5adc0f[_0xc46c('0x68')]||!_0x5adc0f[_0xc46c('0x5d')]){_0x855ebf=path[_0xc46c('0x63')](config[_0xc46c('0x69')],_0x437607,_[_0xc46c('0x64')](_0xc46c('0x72')));}if(!fs['existsSync'](_0x855ebf)){throw new db[(_0xc46c('0x6a'))][(_0xc46c('0x73'))](_['upperFirst'](_0xc46c('0x5d'))+_0xc46c('0x74'));}return _0x15c1fa[_0xc46c('0x6b')](_0x855ebf);}})[_0xc46c('0x53')](handleError(_0x15c1fa,null));};exports[_0xc46c('0x75')]=function(_0x5d036c,_0x21f3b5,_0x1dcacf){if(_0x5d036c[_0xc46c('0x56')]&&_0x5d036c[_0xc46c('0x56')][_0xc46c('0x57')]){_0x5d036c[_0xc46c('0x54')][_0xc46c('0x5e')]=_0x5d036c[_0xc46c('0x56')][_0xc46c('0x57')];}return db['Setting'][_0xc46c('0x52')]({'where':{'id':_0x5d036c[_0xc46c('0x50')]['id']}})[_0xc46c('0x32')](handleEntityNotFound(_0x21f3b5,null))[_0xc46c('0x32')](saveUpdates(_0x5d036c[_0xc46c('0x54')],null))[_0xc46c('0x32')](respondWithResult(_0x21f3b5,null))['catch'](handleError(_0x21f3b5,null));};var utilLicense=require(_0xc46c('0x18'));exports['getFavicon']=function(_0x1951b8,_0x121588,_0x2bad98){var _0x4566f9=_0xc46c('0x5b');var _0x5a7e94={'custom':![]};return utilLicense[_0xc46c('0x5c')]()['then'](function(_0x5cec76){if(_0x5cec76){_0x5a7e94=_0x5cec76;}return db[_0xc46c('0x38')][_0xc46c('0x52')]({'where':{'id':_0x1951b8['params']['id']},'attributes':[_0xc46c('0x58'),'loginLogo',_0xc46c('0x5d'),_0xc46c('0x5e'),_0xc46c('0x6d'),'defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xc46c('0x32')](handleEntityNotFound(_0x121588,null))[_0xc46c('0x32')](function(_0x497a90){if(_0x497a90){var _0x2c6a60=_0x497a90['favicon']&&fs[_0xc46c('0x62')](path[_0xc46c('0x63')](config[_0xc46c('0x69')],_0x4566f9,_[_0xc46c('0x64')](_0x497a90[_0xc46c('0x5e')])))?path['join'](config[_0xc46c('0x69')],_0x4566f9,_[_0xc46c('0x64')](_0x497a90[_0xc46c('0x5e')])):path[_0xc46c('0x63')](config[_0xc46c('0x69')],_0x4566f9,_[_0xc46c('0x64')](_0xc46c('0x76')));var _0x1a3ed5='default'+_[_0xc46c('0x67')](_0xc46c('0x5e'));if(_0x497a90[_0x1a3ed5]||!_0x5a7e94[_0xc46c('0x68')]){_0x2c6a60=path['join'](config['root'],_0x4566f9,_[_0xc46c('0x64')](_0xc46c('0x76')));}if(!fs['existsSync'](_0x2c6a60)){throw new db[(_0xc46c('0x6a'))][(_0xc46c('0x73'))](_[_0xc46c('0x67')](_0xc46c('0x5e'))+_0xc46c('0x74'));}return _0x121588['download'](_0x2c6a60);}})['catch'](handleError(_0x121588,null));};exports[_0xc46c('0x77')]=function(_0x162789,_0x371735){var _0x3f382e={'offset':moment()['utcOffset']()};_0x3f382e[_0xc46c('0x78')]=moment()[_0xc46c('0x79')](_0x3f382e['offset'])[_0xc46c('0x7a')](_0xc46c('0x7b'));return _0x371735[_0xc46c('0x27')](0xc8)[_0xc46c('0x7c')](_0x3f382e);}; \ No newline at end of file +var _0x20ef=['api','../../config/utils','../../config/license/util','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','sendStatus','status','offset','undefined','count','limit','set','apply','save','update','destroy','end','name','send','map','Setting','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','addLogo','file','logo','filename','addLogoLogin','getLogo','server/files/images/logos','getLicense','loginLogo','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','upperFirst','custom','existsSync','Sequelize','ValidationError','\x20not\x20found','getLogoLogin','defaultLoginLogo','default_loginLogo.svg','default','download','gdpr','securePassword','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x36d955,_0x2a6d31){var _0x1a9a6b=function(_0x3189d5){while(--_0x3189d5){_0x36d955['push'](_0x36d955['shift']());}};_0x1a9a6b(++_0x2a6d31);}(_0x20ef,0xe6));var _0xf20e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20ef[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf20e('0x0'));var rimraf=require(_0xf20e('0x1'));var zipdir=require(_0xf20e('0x2'));var jsonpatch=require(_0xf20e('0x3'));var rp=require(_0xf20e('0x4'));var moment=require(_0xf20e('0x5'));var BPromise=require(_0xf20e('0x6'));var Mustache=require(_0xf20e('0x7'));var util=require(_0xf20e('0x8'));var path=require(_0xf20e('0x9'));var sox=require(_0xf20e('0xa'));var csv=require(_0xf20e('0xb'));var ejs=require(_0xf20e('0xc'));var fs=require('fs');var fs_extra=require(_0xf20e('0xd'));var _=require(_0xf20e('0xe'));var squel=require(_0xf20e('0xf'));var crypto=require('crypto');var jsforce=require(_0xf20e('0x10'));var deskjs=require(_0xf20e('0x11'));var toCsv=require(_0xf20e('0xb'));var querystring=require(_0xf20e('0x12'));var Papa=require(_0xf20e('0x13'));var Redis=require(_0xf20e('0x14'));var authService=require(_0xf20e('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xf20e('0x16'));var hardwareService=require(_0xf20e('0x17'));var logger=require('../../config/logger')(_0xf20e('0x18'));var utils=require(_0xf20e('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xf20e('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0xf20e('0x1b'));var client=jayson[_0xf20e('0x1c')][_0xf20e('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x19d8a5,_0x493e60,_0xf761ec,_0xb510d4){return new BPromise(function(_0x4facb2,_0x13c407){var _0xe89778=_0xb510d4||client;return _0xe89778[_0xf20e('0x1e')](_0x19d8a5,_0xf761ec)[_0xf20e('0x1f')](function(_0x780268){logger[_0xf20e('0x20')](_0xf20e('0x21'),_0x493e60,_0xf20e('0x22'));logger[_0xf20e('0x23')](_0xf20e('0x24'),_0x493e60,_0xf20e('0x22'),JSON[_0xf20e('0x25')](_0x780268));if(_0x780268['error']){if(_0x780268['error'][_0xf20e('0x26')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x493e60,_0x780268[_0xf20e('0x27')][_0xf20e('0x28')]);return _0x13c407(_0x780268[_0xf20e('0x27')][_0xf20e('0x28')]);}logger[_0xf20e('0x27')](_0xf20e('0x21'),_0x493e60,_0x780268['error'][_0xf20e('0x28')]);return _0x4facb2(_0x780268[_0xf20e('0x27')]['message']);}else{logger[_0xf20e('0x20')](_0xf20e('0x21'),_0x493e60,_0xf20e('0x22'));_0x4facb2(_0x780268[_0xf20e('0x29')][_0xf20e('0x28')]);}})['catch'](function(_0x332ba2){logger[_0xf20e('0x27')]('Setting,\x20%s,\x20%s',_0x493e60,_0x332ba2);_0x13c407(_0x332ba2);});});}function respondWithStatusCode(_0x2cc57d,_0x35d484){_0x35d484=_0x35d484||0xcc;return function(_0xe73b3e){if(_0xe73b3e){return _0x2cc57d[_0xf20e('0x2a')](_0x35d484);}return _0x2cc57d['status'](_0x35d484)['end']();};}function respondWithResult(_0x21535d,_0x50825f){_0x50825f=_0x50825f||0xc8;return function(_0x44e683){if(_0x44e683){return _0x21535d[_0xf20e('0x2b')](_0x50825f)['json'](_0x44e683);}};}function respondWithFilteredResult(_0x1b4df5,_0x2c9127){return function(_0x37226a){if(_0x37226a){var _0x23280a=typeof _0x2c9127[_0xf20e('0x2c')]===_0xf20e('0x2d')&&typeof _0x2c9127['limit']==='undefined';var _0x7a06d2=_0x37226a[_0xf20e('0x2e')];var _0x22cc11=_0x23280a?0x0:_0x2c9127[_0xf20e('0x2c')];var _0x589a11=_0x23280a?_0x37226a['count']:_0x2c9127[_0xf20e('0x2c')]+_0x2c9127[_0xf20e('0x2f')];var _0x392823;if(_0x589a11>=_0x7a06d2){_0x589a11=_0x7a06d2;_0x392823=0xc8;}else{_0x392823=0xce;}_0x1b4df5['status'](_0x392823);return _0x1b4df5[_0xf20e('0x30')]('Content-Range',_0x22cc11+'-'+_0x589a11+'/'+_0x7a06d2)['json'](_0x37226a);}return null;};}function patchUpdates(_0x42599a){return function(_0x4d96cb){try{jsonpatch[_0xf20e('0x31')](_0x4d96cb,_0x42599a,!![]);}catch(_0x3208e6){return BPromise['reject'](_0x3208e6);}return _0x4d96cb[_0xf20e('0x32')]();};}function saveUpdates(_0x2dd42d,_0xfb876e){return function(_0x25cb08){if(_0x25cb08){return _0x25cb08[_0xf20e('0x33')](_0x2dd42d)[_0xf20e('0x1f')](function(_0x2f1c3d){return _0x2f1c3d;});}return null;};}function removeEntity(_0x4efb96,_0x223d66){return function(_0x2ca591){if(_0x2ca591){return _0x2ca591[_0xf20e('0x34')]()[_0xf20e('0x1f')](function(){_0x4efb96[_0xf20e('0x2b')](0xcc)[_0xf20e('0x35')]();});}};}function handleEntityNotFound(_0x97fb43,_0xc4536){return function(_0x338cdc){if(!_0x338cdc){_0x97fb43[_0xf20e('0x2a')](0x194);}return _0x338cdc;};}function handleError(_0x23f199,_0x1e0b34){_0x1e0b34=_0x1e0b34||0x1f4;return function(_0x23eaf1){logger[_0xf20e('0x27')](_0x23eaf1['stack']);if(_0x23eaf1[_0xf20e('0x36')]){delete _0x23eaf1[_0xf20e('0x36')];}_0x23f199[_0xf20e('0x2b')](_0x1e0b34)[_0xf20e('0x37')](_0x23eaf1);};}exports['index']=function(_0x39c233,_0x50d428){var _0x51a668={},_0x385318={},_0x3f25ec={'count':0x0,'rows':[]};var _0x3725d9=_[_0xf20e('0x38')](db[_0xf20e('0x39')]['rawAttributes'],function(_0xf641cd){return{'name':_0xf641cd[_0xf20e('0x3a')],'type':_0xf641cd[_0xf20e('0x3b')][_0xf20e('0x3c')]};});_0x385318[_0xf20e('0x3d')]=_[_0xf20e('0x38')](_0x3725d9,'name');_0x385318[_0xf20e('0x3e')]=_[_0xf20e('0x3f')](_0x39c233['query']);_0x385318[_0xf20e('0x40')]=_[_0xf20e('0x41')](_0x385318['model'],_0x385318['query']);_0x51a668[_0xf20e('0x42')]=_[_0xf20e('0x41')](_0x385318[_0xf20e('0x3d')],qs[_0xf20e('0x43')](_0x39c233[_0xf20e('0x3e')][_0xf20e('0x43')]));_0x51a668['attributes']=_0x51a668[_0xf20e('0x42')][_0xf20e('0x44')]?_0x51a668[_0xf20e('0x42')]:_0x385318[_0xf20e('0x3d')];if(!_0x39c233[_0xf20e('0x3e')][_0xf20e('0x45')](_0xf20e('0x46'))){_0x51a668['limit']=qs[_0xf20e('0x2f')](_0x39c233[_0xf20e('0x3e')][_0xf20e('0x2f')]);_0x51a668['offset']=qs[_0xf20e('0x2c')](_0x39c233[_0xf20e('0x3e')][_0xf20e('0x2c')]);}_0x51a668['order']=qs[_0xf20e('0x47')](_0x39c233[_0xf20e('0x3e')][_0xf20e('0x47')]);_0x51a668[_0xf20e('0x48')]=qs[_0xf20e('0x40')](_['pick'](_0x39c233[_0xf20e('0x3e')],_0x385318['filters']),_0x3725d9);if(_0x39c233['query'][_0xf20e('0x49')]){_0x51a668['where']=_['merge'](_0x51a668[_0xf20e('0x48')],{'$or':_[_0xf20e('0x38')](_0x3725d9,function(_0xea997f){if(_0xea997f[_0xf20e('0x3b')]!==_0xf20e('0x4a')){var _0x1d483d={};_0x1d483d[_0xea997f[_0xf20e('0x36')]]={'$like':'%'+_0x39c233['query']['filter']+'%'};return _0x1d483d;}})});}_0x51a668=_[_0xf20e('0x4b')]({},_0x51a668,_0x39c233[_0xf20e('0x4c')]);var _0x303199={'where':_0x51a668[_0xf20e('0x48')]};return db[_0xf20e('0x39')][_0xf20e('0x2e')](_0x303199)['then'](function(_0x4b650f){_0x3f25ec[_0xf20e('0x2e')]=_0x4b650f;if(_0x39c233[_0xf20e('0x3e')][_0xf20e('0x4d')]){_0x51a668[_0xf20e('0x4e')]=[{'all':!![]}];}return db[_0xf20e('0x39')][_0xf20e('0x4f')](_0x51a668);})[_0xf20e('0x1f')](function(_0x53b084){_0x3f25ec[_0xf20e('0x50')]=_0x53b084;return _0x3f25ec;})['then'](respondWithFilteredResult(_0x50d428,_0x51a668))[_0xf20e('0x51')](handleError(_0x50d428,null));};exports[_0xf20e('0x52')]=function(_0x273e72,_0x4e6f6c){var _0x3348bc={'raw':![],'where':{'id':_0x273e72[_0xf20e('0x53')]['id']}},_0x53cf2a={};_0x53cf2a['model']=_[_0xf20e('0x3f')](db[_0xf20e('0x39')][_0xf20e('0x54')]);_0x53cf2a['query']=_[_0xf20e('0x3f')](_0x273e72['query']);_0x53cf2a[_0xf20e('0x40')]=_[_0xf20e('0x41')](_0x53cf2a[_0xf20e('0x3d')],_0x53cf2a['query']);_0x3348bc['attributes']=_[_0xf20e('0x41')](_0x53cf2a['model'],qs[_0xf20e('0x43')](_0x273e72['query']['fields']));_0x3348bc[_0xf20e('0x42')]=_0x3348bc[_0xf20e('0x42')]['length']?_0x3348bc[_0xf20e('0x42')]:_0x53cf2a[_0xf20e('0x3d')];if(_0x273e72[_0xf20e('0x3e')]['includeAll']){_0x3348bc['include']=[{'all':!![]}];}_0x3348bc=_[_0xf20e('0x4b')]({},_0x3348bc,_0x273e72['options']);return db[_0xf20e('0x39')][_0xf20e('0x55')](_0x3348bc)[_0xf20e('0x1f')](handleEntityNotFound(_0x4e6f6c,null))[_0xf20e('0x1f')](respondWithResult(_0x4e6f6c,null))['catch'](handleError(_0x4e6f6c,null));};exports[_0xf20e('0x33')]=function(_0x1d0153,_0xce3625){if(_0x1d0153['body']['id']){delete _0x1d0153[_0xf20e('0x56')]['id'];}return db['Setting'][_0xf20e('0x55')]({'where':{'id':_0x1d0153[_0xf20e('0x53')]['id']}})['then'](handleEntityNotFound(_0xce3625,null))[_0xf20e('0x1f')](saveUpdates(_0x1d0153[_0xf20e('0x56')],null))[_0xf20e('0x1f')](respondWithResult(_0xce3625,null))[_0xf20e('0x51')](handleError(_0xce3625,null));};exports[_0xf20e('0x57')]=function(_0x57f18a,_0x1be20e,_0x2ed202){if(_0x57f18a[_0xf20e('0x58')]&&_0x57f18a[_0xf20e('0x58')]['filename']){_0x57f18a[_0xf20e('0x56')][_0xf20e('0x59')]=_0x57f18a[_0xf20e('0x58')][_0xf20e('0x5a')];}return db[_0xf20e('0x39')][_0xf20e('0x55')]({'where':{'id':_0x57f18a[_0xf20e('0x53')]['id']}})['then'](handleEntityNotFound(_0x1be20e,null))['then'](saveUpdates(_0x57f18a[_0xf20e('0x56')],null))['then'](respondWithResult(_0x1be20e,null))[_0xf20e('0x51')](handleError(_0x1be20e,null));};exports[_0xf20e('0x5b')]=function(_0x2bf911,_0x11f0b4,_0x20b778){if(_0x2bf911['file']&&_0x2bf911[_0xf20e('0x58')][_0xf20e('0x5a')]){_0x2bf911['body']['loginLogo']=_0x2bf911[_0xf20e('0x58')][_0xf20e('0x5a')];}return db[_0xf20e('0x39')][_0xf20e('0x55')]({'where':{'id':_0x2bf911[_0xf20e('0x53')]['id']}})[_0xf20e('0x1f')](handleEntityNotFound(_0x11f0b4,null))[_0xf20e('0x1f')](saveUpdates(_0x2bf911['body'],null))['then'](respondWithResult(_0x11f0b4,null))[_0xf20e('0x51')](handleError(_0x11f0b4,null));};var utilLicense=require(_0xf20e('0x1a'));exports[_0xf20e('0x5c')]=function(_0x2cd25a,_0x4974a6,_0x4d7b2d){var _0x258345=_0xf20e('0x5d');var _0x26cbe0={'custom':![]};return utilLicense[_0xf20e('0x5e')]()[_0xf20e('0x1f')](function(_0x25a30b){if(_0x25a30b){_0x26cbe0=_0x25a30b;}return db[_0xf20e('0x39')][_0xf20e('0x55')]({'where':{'id':_0x2cd25a['params']['id']},'attributes':[_0xf20e('0x59'),_0xf20e('0x5f'),_0xf20e('0x60'),_0xf20e('0x61'),_0xf20e('0x62'),'defaultLoginLogo',_0xf20e('0x63'),_0xf20e('0x64')],'raw':!![]});})[_0xf20e('0x1f')](handleEntityNotFound(_0x4974a6,null))[_0xf20e('0x1f')](function(_0x4371bd){if(_0x4371bd){var _0x11825b=_0x4371bd[_0xf20e('0x59')]&&fs['existsSync'](path[_0xf20e('0x65')](config[_0xf20e('0x66')],_0x258345,_[_0xf20e('0x67')](_0x4371bd['logo'])))?path[_0xf20e('0x65')](config[_0xf20e('0x66')],_0x258345,_['toLower'](_0x4371bd['logo'])):path[_0xf20e('0x65')](config['root'],_0x258345,_[_0xf20e('0x67')](_0xf20e('0x68')));var _0x4e4d40='default'+_[_0xf20e('0x69')](_0xf20e('0x59'));if(_0x4371bd[_0x4e4d40]||!_0x26cbe0[_0xf20e('0x6a')]){_0x11825b=path['join'](config['root'],_0x258345,_['toLower'](_0xf20e('0x68')));}if(!fs[_0xf20e('0x6b')](_0x11825b)){throw new db[(_0xf20e('0x6c'))][(_0xf20e('0x6d'))](_[_0xf20e('0x69')](_0xf20e('0x59'))+_0xf20e('0x6e'));}return _0x4974a6['download'](_0x11825b);}})[_0xf20e('0x51')](handleError(_0x4974a6,null));};var utilLicense=require(_0xf20e('0x1a'));exports[_0xf20e('0x6f')]=function(_0x463fdd,_0x39ddaf,_0x5710c2){var _0x494cfa=_0xf20e('0x5d');var _0x1cc5dc={'custom':![]};return utilLicense[_0xf20e('0x5e')]()['then'](function(_0x30fd14){if(_0x30fd14){_0x1cc5dc=_0x30fd14;}return db[_0xf20e('0x39')][_0xf20e('0x55')]({'where':{'id':_0x463fdd[_0xf20e('0x53')]['id']},'attributes':[_0xf20e('0x59'),_0xf20e('0x5f'),'preferred',_0xf20e('0x61'),_0xf20e('0x62'),_0xf20e('0x70'),_0xf20e('0x63'),_0xf20e('0x64')],'raw':!![]});})['then'](handleEntityNotFound(_0x39ddaf,null))[_0xf20e('0x1f')](function(_0x4c81ef){if(_0x4c81ef){var _0x5d3076=_0x4c81ef[_0xf20e('0x5f')]&&fs[_0xf20e('0x6b')](path['join'](config[_0xf20e('0x66')],_0x494cfa,_[_0xf20e('0x67')](_0x4c81ef[_0xf20e('0x5f')])))?path[_0xf20e('0x65')](config['root'],_0x494cfa,_['toLower'](_0x4c81ef['loginLogo'])):path[_0xf20e('0x65')](config[_0xf20e('0x66')],_0x494cfa,_[_0xf20e('0x67')](_0xf20e('0x71')));var _0x5d6c01=_0xf20e('0x72')+_[_0xf20e('0x69')]('loginLogo');if(_0x4c81ef[_0x5d6c01]||!_0x1cc5dc[_0xf20e('0x6a')]){_0x5d3076=path[_0xf20e('0x65')](config[_0xf20e('0x66')],_0x494cfa,_[_0xf20e('0x67')](_0xf20e('0x71')));}if(!fs[_0xf20e('0x6b')](_0x5d3076)){throw new db[(_0xf20e('0x6c'))]['ValidationError'](_[_0xf20e('0x69')](_0xf20e('0x5f'))+_0xf20e('0x6e'));}return _0x39ddaf[_0xf20e('0x73')](_0x5d3076);}})[_0xf20e('0x51')](handleError(_0x39ddaf,null));};exports[_0xf20e('0x74')]=function(_0x20f9f8,_0x283a95){return db[_0xf20e('0x39')][_0xf20e('0x55')]({'where':{'id':_0x20f9f8[_0xf20e('0x53')]['id']},'attributes':[_0xf20e('0x75')]})[_0xf20e('0x1f')](respondWithResult(_0x283a95,null))[_0xf20e('0x51')](handleError(_0x283a95,null));};exports['addPreferred']=function(_0x3832a4,_0x1599f3,_0x6e1260){if(_0x3832a4[_0xf20e('0x58')]&&_0x3832a4[_0xf20e('0x58')][_0xf20e('0x5a')]){_0x3832a4['body'][_0xf20e('0x60')]=_0x3832a4[_0xf20e('0x58')]['filename'];}return db[_0xf20e('0x39')]['find']({'where':{'id':_0x3832a4[_0xf20e('0x53')]['id']}})[_0xf20e('0x1f')](handleEntityNotFound(_0x1599f3,null))[_0xf20e('0x1f')](saveUpdates(_0x3832a4[_0xf20e('0x56')],null))['then'](respondWithResult(_0x1599f3,null))['catch'](handleError(_0x1599f3,null));};var utilLicense=require(_0xf20e('0x1a'));exports[_0xf20e('0x76')]=function(_0x38a351,_0x273d9b,_0x599749){var _0x7f98eb='server/files/images/logos';var _0x55da2e={'custom':![]};return utilLicense[_0xf20e('0x5e')]()[_0xf20e('0x1f')](function(_0x13884f){if(_0x13884f){_0x55da2e=_0x13884f;}return db[_0xf20e('0x39')]['find']({'where':{'id':_0x38a351['params']['id']},'attributes':[_0xf20e('0x59'),_0xf20e('0x5f'),'preferred',_0xf20e('0x61'),_0xf20e('0x62'),_0xf20e('0x70'),_0xf20e('0x63'),'defaultFavicon'],'raw':!![]});})[_0xf20e('0x1f')](handleEntityNotFound(_0x273d9b,null))[_0xf20e('0x1f')](function(_0x27b4d2){if(_0x27b4d2){var _0x41c163=_0x27b4d2[_0xf20e('0x60')]&&fs['existsSync'](path[_0xf20e('0x65')](config[_0xf20e('0x66')],_0x7f98eb,_[_0xf20e('0x67')](_0x27b4d2[_0xf20e('0x60')])))?path[_0xf20e('0x65')](config['root'],_0x7f98eb,_[_0xf20e('0x67')](_0x27b4d2[_0xf20e('0x60')])):path[_0xf20e('0x65')](config[_0xf20e('0x66')],_0x7f98eb,_['toLower'](_0xf20e('0x77')));var _0x26faee=_0xf20e('0x72')+_[_0xf20e('0x69')]('preferred');if(_0x27b4d2[_0x26faee]||!_0x55da2e[_0xf20e('0x6a')]||!_0x55da2e['preferred']){_0x41c163=path[_0xf20e('0x65')](config[_0xf20e('0x66')],_0x7f98eb,_[_0xf20e('0x67')](_0xf20e('0x77')));}if(!fs[_0xf20e('0x6b')](_0x41c163)){throw new db[(_0xf20e('0x6c'))][(_0xf20e('0x6d'))](_['upperFirst'](_0xf20e('0x60'))+_0xf20e('0x6e'));}return _0x273d9b['download'](_0x41c163);}})['catch'](handleError(_0x273d9b,null));};exports[_0xf20e('0x78')]=function(_0x4c6865,_0x4eb8dc,_0x1c89f3){if(_0x4c6865['file']&&_0x4c6865[_0xf20e('0x58')][_0xf20e('0x5a')]){_0x4c6865[_0xf20e('0x56')][_0xf20e('0x61')]=_0x4c6865['file']['filename'];}return db[_0xf20e('0x39')][_0xf20e('0x55')]({'where':{'id':_0x4c6865[_0xf20e('0x53')]['id']}})[_0xf20e('0x1f')](handleEntityNotFound(_0x4eb8dc,null))['then'](saveUpdates(_0x4c6865[_0xf20e('0x56')],null))[_0xf20e('0x1f')](respondWithResult(_0x4eb8dc,null))[_0xf20e('0x51')](handleError(_0x4eb8dc,null));};var utilLicense=require('../../config/license/util');exports[_0xf20e('0x79')]=function(_0x3ef6b7,_0x355e53,_0x3b28d5){var _0x8a1a=_0xf20e('0x5d');var _0x14103f={'custom':![]};return utilLicense[_0xf20e('0x5e')]()['then'](function(_0x18fb36){if(_0x18fb36){_0x14103f=_0x18fb36;}return db[_0xf20e('0x39')][_0xf20e('0x55')]({'where':{'id':_0x3ef6b7['params']['id']},'attributes':['logo','loginLogo',_0xf20e('0x60'),_0xf20e('0x61'),_0xf20e('0x62'),_0xf20e('0x70'),_0xf20e('0x63'),_0xf20e('0x64')],'raw':!![]});})[_0xf20e('0x1f')](handleEntityNotFound(_0x355e53,null))[_0xf20e('0x1f')](function(_0x5a4419){if(_0x5a4419){var _0x2305b4=_0x5a4419[_0xf20e('0x61')]&&fs[_0xf20e('0x6b')](path['join'](config[_0xf20e('0x66')],_0x8a1a,_[_0xf20e('0x67')](_0x5a4419[_0xf20e('0x61')])))?path[_0xf20e('0x65')](config['root'],_0x8a1a,_[_0xf20e('0x67')](_0x5a4419[_0xf20e('0x61')])):path[_0xf20e('0x65')](config[_0xf20e('0x66')],_0x8a1a,_[_0xf20e('0x67')]('default_favicon.ico'));var _0x332f6d=_0xf20e('0x72')+_[_0xf20e('0x69')](_0xf20e('0x61'));if(_0x5a4419[_0x332f6d]||!_0x14103f[_0xf20e('0x6a')]){_0x2305b4=path[_0xf20e('0x65')](config['root'],_0x8a1a,_[_0xf20e('0x67')](_0xf20e('0x7a')));}if(!fs[_0xf20e('0x6b')](_0x2305b4)){throw new db[(_0xf20e('0x6c'))][(_0xf20e('0x6d'))](_['upperFirst'](_0xf20e('0x61'))+'\x20not\x20found');}return _0x355e53[_0xf20e('0x73')](_0x2305b4);}})['catch'](handleError(_0x355e53,null));};exports[_0xf20e('0x7b')]=function(_0x4afaaf,_0x5d0584){var _0x45924d={'offset':moment()[_0xf20e('0x7c')]()};_0x45924d[_0xf20e('0x7d')]=moment()[_0xf20e('0x7c')](_0x45924d[_0xf20e('0x2c')])['format'](_0xf20e('0x7e'));return _0x5d0584[_0xf20e('0x2b')](0xc8)[_0xf20e('0x37')](_0x45924d);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 719a8d6..4d10719 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x55ca,0x126));var _0xa55c=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x55ca[_0x2faddb];return _0x273c05;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x1bf8e3,_0x53d853){var _0x24d515=function(_0x1c8767){while(--_0x1c8767){_0x1bf8e3['push'](_0x1bf8e3['shift']());}};_0x24d515(++_0x53d853);}(_0xedd9,0xfc));var _0x9edd=function(_0x395f2c,_0x50271c){_0x395f2c=_0x395f2c-0x0;var _0x185525=_0xedd9[_0x395f2c];return _0x185525;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index b464196..89e7b42 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 _0x1f7e=['find','raw','options','where','attributes','include','map','model','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','code','message','catch','ShowSetting','Setting'];(function(_0x1dc257,_0x651aa3){var _0x46df6a=function(_0x2f57a6){while(--_0x2f57a6){_0x1dc257['push'](_0x1dc257['shift']());}};_0x46df6a(++_0x651aa3);}(_0x1f7e,0xf1));var _0xe1f7=function(_0x1623ce,_0x18705d){_0x1623ce=_0x1623ce-0x0;var _0x26d697=_0x1f7e[_0x1623ce];return _0x26d697;};'use strict';var _=require(_0xe1f7('0x0'));var util=require(_0xe1f7('0x1'));var moment=require(_0xe1f7('0x2'));var BPromise=require(_0xe1f7('0x3'));var rs=require(_0xe1f7('0x4'));var fs=require('fs');var Redis=require(_0xe1f7('0x5'));var db=require(_0xe1f7('0x6'))['db'];var utils=require(_0xe1f7('0x7'));var logger=require(_0xe1f7('0x8'))(_0xe1f7('0x9'));var config=require(_0xe1f7('0xa'));var jayson=require(_0xe1f7('0xb'));var client=jayson['client'][_0xe1f7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ba08d,_0x6adbd4,_0xe8ca4f){return new BPromise(function(_0xa397c8,_0x2c22fe){return client['request'](_0x4ba08d,_0xe8ca4f)['then'](function(_0x3aad54){logger[_0xe1f7('0xd')](_0xe1f7('0xe'),_0x6adbd4,_0xe1f7('0xf'));logger['debug'](_0xe1f7('0x10'),_0x6adbd4,_0xe1f7('0xf'),JSON['stringify'](_0x3aad54));if(_0x3aad54[_0xe1f7('0x11')]){if(_0x3aad54[_0xe1f7('0x11')][_0xe1f7('0x12')]===0x1f4){logger['error'](_0xe1f7('0xe'),_0x6adbd4,_0x3aad54[_0xe1f7('0x11')][_0xe1f7('0x13')]);return _0x2c22fe(_0x3aad54['error']['message']);}logger[_0xe1f7('0x11')]('Setting,\x20%s,\x20%s',_0x6adbd4,_0x3aad54[_0xe1f7('0x11')][_0xe1f7('0x13')]);return _0xa397c8(_0x3aad54[_0xe1f7('0x11')]['message']);}else{logger['info'](_0xe1f7('0xe'),_0x6adbd4,_0xe1f7('0xf'));_0xa397c8(_0x3aad54['result'][_0xe1f7('0x13')]);}})[_0xe1f7('0x14')](function(_0x151e7f){logger[_0xe1f7('0x11')](_0xe1f7('0xe'),_0x6adbd4,_0x151e7f);_0x2c22fe(_0x151e7f);});});}exports[_0xe1f7('0x15')]=function(_0x572cc2){var _0x1deac6=this;return new Promise(function(_0x43cbf0,_0x2ca4cb){return db[_0xe1f7('0x16')][_0xe1f7('0x17')]({'raw':_0x572cc2['options']?_0x572cc2['options'][_0xe1f7('0x18')]===undefined?!![]:![]:!![],'where':_0x572cc2['options']?_0x572cc2[_0xe1f7('0x19')][_0xe1f7('0x1a')]||null:null,'attributes':_0x572cc2[_0xe1f7('0x19')]?_0x572cc2[_0xe1f7('0x19')][_0xe1f7('0x1b')]||null:null,'include':_0x572cc2['options']?_0x572cc2[_0xe1f7('0x19')][_0xe1f7('0x1c')]?_[_0xe1f7('0x1d')](_0x572cc2[_0xe1f7('0x19')]['include'],function(_0x56867c){return{'model':db[_0x56867c[_0xe1f7('0x1e')]],'as':_0x56867c['as'],'attributes':_0x56867c[_0xe1f7('0x1b')],'include':_0x56867c[_0xe1f7('0x1c')]?_[_0xe1f7('0x1d')](_0x56867c['include'],function(_0x2ec7d4){return{'model':db[_0x2ec7d4['model']],'as':_0x2ec7d4['as'],'attributes':_0x2ec7d4['attributes'],'include':_0x2ec7d4[_0xe1f7('0x1c')]?_[_0xe1f7('0x1d')](_0x2ec7d4[_0xe1f7('0x1c')],function(_0x2e900c){return{'model':db[_0x2e900c[_0xe1f7('0x1e')]],'as':_0x2e900c['as'],'attributes':_0x2e900c[_0xe1f7('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe1f7('0x1f')](function(_0x4e2efd){logger['info'](_0xe1f7('0x15'),_0x572cc2);logger[_0xe1f7('0x20')](_0xe1f7('0x15'),_0x572cc2,JSON['stringify'](_0x4e2efd));_0x43cbf0(_0x4e2efd);})['catch'](function(_0x39000a){logger[_0xe1f7('0x11')]('ShowSetting',_0x39000a[_0xe1f7('0x13')],_0x572cc2);_0x2ca4cb(_0x1deac6[_0xe1f7('0x11')](0x1f4,_0x39000a[_0xe1f7('0x13')]));});});}; \ No newline at end of file +var _0x8c04=['ShowSetting','find','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch'];(function(_0x2a8f1b,_0x5dcf87){var _0x534bf2=function(_0x3b3005){while(--_0x3b3005){_0x2a8f1b['push'](_0x2a8f1b['shift']());}};_0x534bf2(++_0x5dcf87);}(_0x8c04,0x174));var _0x48c0=function(_0x4e8e31,_0x497e28){_0x4e8e31=_0x4e8e31-0x0;var _0x3a47ac=_0x8c04[_0x4e8e31];return _0x3a47ac;};'use strict';var _=require(_0x48c0('0x0'));var util=require(_0x48c0('0x1'));var moment=require(_0x48c0('0x2'));var BPromise=require(_0x48c0('0x3'));var rs=require(_0x48c0('0x4'));var fs=require('fs');var Redis=require(_0x48c0('0x5'));var db=require(_0x48c0('0x6'))['db'];var utils=require(_0x48c0('0x7'));var logger=require(_0x48c0('0x8'))(_0x48c0('0x9'));var config=require(_0x48c0('0xa'));var jayson=require(_0x48c0('0xb'));var client=jayson[_0x48c0('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e4312,_0x8e66ed,_0x45d466){return new BPromise(function(_0x59569e,_0x14ebb0){return client['request'](_0x1e4312,_0x45d466)[_0x48c0('0xd')](function(_0x5c509b){logger['info'](_0x48c0('0xe'),_0x8e66ed,_0x48c0('0xf'));logger[_0x48c0('0x10')]('Setting,\x20%s,\x20%s,\x20%s',_0x8e66ed,_0x48c0('0xf'),JSON[_0x48c0('0x11')](_0x5c509b));if(_0x5c509b['error']){if(_0x5c509b[_0x48c0('0x12')][_0x48c0('0x13')]===0x1f4){logger[_0x48c0('0x12')](_0x48c0('0xe'),_0x8e66ed,_0x5c509b['error'][_0x48c0('0x14')]);return _0x14ebb0(_0x5c509b[_0x48c0('0x12')][_0x48c0('0x14')]);}logger[_0x48c0('0x12')](_0x48c0('0xe'),_0x8e66ed,_0x5c509b[_0x48c0('0x12')]['message']);return _0x59569e(_0x5c509b[_0x48c0('0x12')][_0x48c0('0x14')]);}else{logger[_0x48c0('0x15')](_0x48c0('0xe'),_0x8e66ed,_0x48c0('0xf'));_0x59569e(_0x5c509b[_0x48c0('0x16')][_0x48c0('0x14')]);}})[_0x48c0('0x17')](function(_0x4d31f9){logger[_0x48c0('0x12')]('Setting,\x20%s,\x20%s',_0x8e66ed,_0x4d31f9);_0x14ebb0(_0x4d31f9);});});}exports[_0x48c0('0x18')]=function(_0x55d335){var _0x226dbe=this;return new Promise(function(_0x570cba,_0x20849b){return db['Setting'][_0x48c0('0x19')]({'raw':_0x55d335[_0x48c0('0x1a')]?_0x55d335[_0x48c0('0x1a')][_0x48c0('0x1b')]===undefined?!![]:![]:!![],'where':_0x55d335['options']?_0x55d335['options'][_0x48c0('0x1c')]||null:null,'attributes':_0x55d335['options']?_0x55d335[_0x48c0('0x1a')][_0x48c0('0x1d')]||null:null,'include':_0x55d335[_0x48c0('0x1a')]?_0x55d335[_0x48c0('0x1a')][_0x48c0('0x1e')]?_[_0x48c0('0x1f')](_0x55d335[_0x48c0('0x1a')][_0x48c0('0x1e')],function(_0x5d942c){return{'model':db[_0x5d942c[_0x48c0('0x20')]],'as':_0x5d942c['as'],'attributes':_0x5d942c['attributes'],'include':_0x5d942c[_0x48c0('0x1e')]?_[_0x48c0('0x1f')](_0x5d942c['include'],function(_0x51ae32){return{'model':db[_0x51ae32[_0x48c0('0x20')]],'as':_0x51ae32['as'],'attributes':_0x51ae32[_0x48c0('0x1d')],'include':_0x51ae32[_0x48c0('0x1e')]?_[_0x48c0('0x1f')](_0x51ae32['include'],function(_0x36d71c){return{'model':db[_0x36d71c[_0x48c0('0x20')]],'as':_0x36d71c['as'],'attributes':_0x36d71c[_0x48c0('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14bb77){logger[_0x48c0('0x15')](_0x48c0('0x18'),_0x55d335);logger[_0x48c0('0x10')](_0x48c0('0x18'),_0x55d335,JSON['stringify'](_0x14bb77));_0x570cba(_0x14bb77);})[_0x48c0('0x17')](function(_0x2e6402){logger[_0x48c0('0x12')](_0x48c0('0x18'),_0x2e6402[_0x48c0('0x14')],_0x55d335);_0x20849b(_0x226dbe[_0x48c0('0x12')](0x1f4,_0x2e6402['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index ed156f0..2441dd6 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 _0x326f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/status','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer'];(function(_0x4de1b5,_0x2a7626){var _0xed55cf=function(_0x5f1115){while(--_0x5f1115){_0x4de1b5['push'](_0x4de1b5['shift']());}};_0xed55cf(++_0x2a7626);}(_0x326f,0xd1));var _0xf326=function(_0x313ab2,_0x44ef88){_0x313ab2=_0x313ab2-0x0;var _0x120092=_0x326f[_0x313ab2];return _0x120092;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0x9')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router['get'](_0xf326('0x10'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);router['get'](_0xf326('0x12'),auth['isAuthenticated'](),controller[_0xf326('0x13')]);router[_0xf326('0x9')]('/:id/interactions',auth[_0xf326('0xa')](),controller[_0xf326('0x14')]);router[_0xf326('0x9')](_0xf326('0x15'),controller['statusGet']);router[_0xf326('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xf326('0x16')]);router[_0xf326('0x17')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0x18')]);router[_0xf326('0x17')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0x19')]);router['post'](_0xf326('0x10'),auth[_0xf326('0xa')](),controller[_0xf326('0x1a')]);router[_0xf326('0x17')](_0xf326('0x1b'),controller[_0xf326('0x1c')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xf326('0x1d')]);router[_0xf326('0x17')]('/:id/send',auth['isAuthenticated'](),controller[_0xf326('0x1e')]);router['post']('/:id/status',controller[_0xf326('0x1f')]);router[_0xf326('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0xf326('0x20')]);router[_0xf326('0x21')]('/:id',auth[_0xf326('0xa')](),controller[_0xf326('0x22')]);router[_0xf326('0x23')](_0xf326('0x24'),auth[_0xf326('0xa')](),controller[_0xf326('0x25')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf326('0x26')]);router[_0xf326('0x23')](_0xf326('0x10'),auth[_0xf326('0xa')](),controller[_0xf326('0x27')]);router[_0xf326('0x23')]('/:id/users',auth[_0xf326('0xa')](),controller[_0xf326('0x28')]);module[_0xf326('0x29')]=router; \ No newline at end of file +var _0xf494=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','/:id/applications','addApplications','/:id/send','send','/:id/users','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf494,0x1c6));var _0x4f49=function(_0xcc464a,_0x58cec3){_0xcc464a=_0xcc464a-0x0;var _0x58f48a=_0xf494[_0xcc464a];return _0x58f48a;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0xa')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['getDispositions']);router[_0x4f49('0xa')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x12')]);router['get']('/:id/applications',auth[_0x4f49('0xb')](),controller[_0x4f49('0x13')]);router['get'](_0x4f49('0x14'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x15')]);router[_0x4f49('0xa')](_0x4f49('0x16'),controller[_0x4f49('0x17')]);router[_0x4f49('0xa')]('/:id/users',auth[_0x4f49('0xb')](),controller[_0x4f49('0x18')]);router[_0x4f49('0x19')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4f49('0x19')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['addDisposition']);router[_0x4f49('0x19')](_0x4f49('0x11'),auth[_0x4f49('0xb')](),controller['addAnswer']);router['post']('/:id/notify',controller['notify']);router[_0x4f49('0x19')](_0x4f49('0x1a'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1b')]);router['post'](_0x4f49('0x1c'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1d')]);router[_0x4f49('0x19')](_0x4f49('0x16'),controller['status']);router[_0x4f49('0x19')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller['addAgents']);router[_0x4f49('0x1f')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x20')]);router[_0x4f49('0x21')](_0x4f49('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0x4f49('0x21')](_0x4f49('0x10'),auth['isAuthenticated'](),controller[_0x4f49('0x22')]);router[_0x4f49('0x21')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x23')]);router[_0x4f49('0x21')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x24')]);module[_0x4f49('0x25')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 912683b..755deb8 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 _0xc893=['skebby','clicksend','plivo','clickatell','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','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','twilio'];(function(_0x38f77e,_0x4de736){var _0x4c654d=function(_0x3b7d0a){while(--_0x3b7d0a){_0x38f77e['push'](_0x38f77e['shift']());}};_0x4c654d(++_0x4de736);}(_0xc893,0x1aa));var _0x3c89=function(_0x142cdf,_0x8516c0){_0x142cdf=_0x142cdf-0x0;var _0x238b23=_0xc893[_0x142cdf];return _0x238b23;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x3c89('0x0'));module[_0x3c89('0x1')]={'name':{'type':Sequelize[_0x3c89('0x2')],'unique':_0x3c89('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x3c89('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x3c89('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x3c89('0x2')],'defaultValue':function(){return rs[_0x3c89('0x4')]();}},'phone':{'type':Sequelize[_0x3c89('0x2')]},'type':{'type':Sequelize['ENUM'](_0x3c89('0x5'),_0x3c89('0x6'),'connectel',_0x3c89('0x7'),_0x3c89('0x8'),_0x3c89('0x9'),_0x3c89('0xa'),_0x3c89('0xb'),_0x3c89('0xc'),_0x3c89('0xd'))},'accountSid':{'type':Sequelize[_0x3c89('0x2')]},'authId':{'type':Sequelize[_0x3c89('0x2')]},'authToken':{'type':Sequelize[_0x3c89('0x2')]},'smsMethod':{'type':Sequelize[_0x3c89('0xe')]('SI','TI','GP')},'username':{'type':Sequelize[_0x3c89('0x2')]},'password':{'type':Sequelize[_0x3c89('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x3c89('0x2')]},'accountId':{'type':Sequelize[_0x3c89('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x3c89('0x2')]},'notificationTemplate':{'type':Sequelize[_0x3c89('0xf')],'defaultValue':function(){return _0x3c89('0x10');}},'notificationSound':{'type':Sequelize[_0x3c89('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3c89('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3c89('0x12')],'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[_0x3c89('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x3c89('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x3c89('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x3c89('0x14'),'set':function(_0xc219f2){if(!_0xc219f2)this[_0x3c89('0x15')](_0x3c89('0x16'),null);this['setDataValue'](_0x3c89('0x17'),_0xc219f2);}}}; \ No newline at end of file +var _0xb05c=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','generate','ENUM','twilio','skebby','plivo','clickatell','bandwidth','csc','TEXT'];(function(_0x3132a9,_0x243da2){var _0x44c409=function(_0x582972){while(--_0x582972){_0x3132a9['push'](_0x3132a9['shift']());}};_0x44c409(++_0x243da2);}(_0xb05c,0x86));var _0xcb05=function(_0x484cb9,_0x103489){_0x484cb9=_0x484cb9-0x0;var _0x59517e=_0xb05c[_0x484cb9];return _0x59517e;};'use strict';var Sequelize=require(_0xcb05('0x0'));var rs=require('randomstring');module[_0xcb05('0x1')]={'name':{'type':Sequelize[_0xcb05('0x2')],'unique':_0xcb05('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xcb05('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xcb05('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xcb05('0x4')]();}},'phone':{'type':Sequelize[_0xcb05('0x2')]},'type':{'type':Sequelize[_0xcb05('0x5')](_0xcb05('0x6'),_0xcb05('0x7'),'connectel','clicksend',_0xcb05('0x8'),_0xcb05('0x9'),_0xcb05('0xa'),_0xcb05('0xb'),'infobip','intelepeer')},'accountSid':{'type':Sequelize[_0xcb05('0x2')]},'authId':{'type':Sequelize[_0xcb05('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0xcb05('0x2')]},'accountId':{'type':Sequelize[_0xcb05('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xcb05('0x2')]},'notificationTemplate':{'type':Sequelize[_0xcb05('0xc')],'defaultValue':function(){return _0xcb05('0xd');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcb05('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcb05('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcb05('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcb05('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcb05('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xcb05('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcb05('0xe')],'comment':_0xcb05('0x10')},'mandatoryDisposition':{'type':Sequelize[_0xcb05('0xf')],'defaultValue':![],'comment':_0xcb05('0x11'),'set':function(_0x4a9fe2){if(!_0x4a9fe2)this[_0xcb05('0x12')](_0xcb05('0x13'),null);this[_0xcb05('0x12')](_0xcb05('0x14'),_0x4a9fe2);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 6564922..cd02d03 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 _0xe7b5=['../../config/license/hardware','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','undefined','limit','count','offset','set','apply','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','Pause','map','SmsAccount','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','catch','show','params','mandatoryDispositionPause','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','describe','addDisposition','SmsAccountId','Disposition','findOne','pick','options','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','findAll','removeAnswers','sms','SmsApplication','Applications','account','applications','orderBy','priority','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','text','connectel','clicksend','plivo','From','Text','MessageUUID','results','csc','segmentedMessage','fromNumber','bandwidth','intelepeer','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','SmsInteraction','spread','created','autoclose','push','close','*,*,*,*','interaction','SmsMessage','UserId','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','entity\x20found','Content-Type','text/xml','\x0a','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','json','getApplications','User','Owner','fullname','internal','Tag','Tags','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','CmList','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','message_id','status_code','infobip','groupName','redif','DELIVERED','clickatell','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','statusGet','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','fs-extra','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3877c1,_0x238c29){var _0x59056a=function(_0x3567cd){while(--_0x3567cd){_0x3877c1['push'](_0x3877c1['shift']());}};_0x59056a(++_0x238c29);}(_0xe7b5,0x1a6));var _0x5e7b=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xe7b5[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5e7b('0x0'));var jsonpatch=require(_0x5e7b('0x1'));var rp=require(_0x5e7b('0x2'));var moment=require(_0x5e7b('0x3'));var BPromise=require(_0x5e7b('0x4'));var Mustache=require(_0x5e7b('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5e7b('0x6'));var fs=require('fs');var fs_extra=require(_0x5e7b('0x7'));var _=require(_0x5e7b('0x8'));var squel=require(_0x5e7b('0x9'));var crypto=require(_0x5e7b('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5e7b('0xb'));var authService=require(_0x5e7b('0xc'));var qs=require(_0x5e7b('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e7b('0xe'));var logger=require('../../config/logger')(_0x5e7b('0xf'));var utils=require('../../config/utils');var config=require(_0x5e7b('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x5e7b('0x11'))['db'];config['redis']=_[_0x5e7b('0x12')](config[_0x5e7b('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x5e7b('0x14'))(new Redis(config[_0x5e7b('0x13')]));require('./smsAccount.socket')[_0x5e7b('0x15')](socket);var jayson=require(_0x5e7b('0x16'));var client=jayson[_0x5e7b('0x17')][_0x5e7b('0x18')]({'port':0x232c});function respondWithRpcPromise(_0x2ab8cc,_0x3ee1c4,_0x51e2d7,_0x128595){return new BPromise(function(_0x1e4941,_0x256eab){var _0x291166=_0x128595||client;return _0x291166[_0x5e7b('0x19')](_0x2ab8cc,_0x51e2d7)[_0x5e7b('0x1a')](function(_0x46a824){logger[_0x5e7b('0x1b')](_0x5e7b('0x1c'),_0x3ee1c4,_0x5e7b('0x1d'));logger[_0x5e7b('0x1e')](_0x5e7b('0x1f'),_0x3ee1c4,_0x5e7b('0x1d'),JSON[_0x5e7b('0x20')](_0x46a824));if(_0x46a824[_0x5e7b('0x21')]){if(_0x46a824['error'][_0x5e7b('0x22')]===0x1f4){logger['error'](_0x5e7b('0x1c'),_0x3ee1c4,_0x46a824[_0x5e7b('0x21')]['message']);return _0x256eab(_0x46a824[_0x5e7b('0x21')][_0x5e7b('0x23')]);}logger[_0x5e7b('0x21')](_0x5e7b('0x1c'),_0x3ee1c4,_0x46a824[_0x5e7b('0x21')][_0x5e7b('0x23')]);return _0x1e4941(_0x46a824[_0x5e7b('0x21')]['message']);}else{logger[_0x5e7b('0x1b')](_0x5e7b('0x1c'),_0x3ee1c4,_0x5e7b('0x1d'));_0x1e4941(_0x46a824[_0x5e7b('0x24')][_0x5e7b('0x23')]);}})['catch'](function(_0x4704b7){logger[_0x5e7b('0x21')]('SmsAccount,\x20%s,\x20%s',_0x3ee1c4,_0x4704b7);_0x256eab(_0x4704b7);});});}function respondWithStatusCode(_0x2ecd5b,_0x3b4fc9){_0x3b4fc9=_0x3b4fc9||0xcc;return function(_0x1ccc3f){if(_0x1ccc3f){return _0x2ecd5b[_0x5e7b('0x25')](_0x3b4fc9);}return _0x2ecd5b[_0x5e7b('0x26')](_0x3b4fc9)['end']();};}function respondWithResult(_0x1fca47,_0x487453){_0x487453=_0x487453||0xc8;return function(_0xf4e9f4){if(_0xf4e9f4){return _0x1fca47['status'](_0x487453)['json'](_0xf4e9f4);}};}function respondWithFilteredResult(_0x416880,_0x239ac0){return function(_0x51dd63){if(_0x51dd63){var _0x4a0135=typeof _0x239ac0['offset']===_0x5e7b('0x27')&&typeof _0x239ac0[_0x5e7b('0x28')]===_0x5e7b('0x27');var _0x28b35c=_0x51dd63[_0x5e7b('0x29')];var _0x4152a2=_0x4a0135?0x0:_0x239ac0['offset'];var _0x522b4d=_0x4a0135?_0x51dd63[_0x5e7b('0x29')]:_0x239ac0[_0x5e7b('0x2a')]+_0x239ac0[_0x5e7b('0x28')];var _0x1bb222;if(_0x522b4d>=_0x28b35c){_0x522b4d=_0x28b35c;_0x1bb222=0xc8;}else{_0x1bb222=0xce;}_0x416880[_0x5e7b('0x26')](_0x1bb222);return _0x416880[_0x5e7b('0x2b')]('Content-Range',_0x4152a2+'-'+_0x522b4d+'/'+_0x28b35c)['json'](_0x51dd63);}return null;};}function patchUpdates(_0x51010e){return function(_0x5472d2){try{jsonpatch[_0x5e7b('0x2c')](_0x5472d2,_0x51010e,!![]);}catch(_0x462552){return BPromise[_0x5e7b('0x2d')](_0x462552);}return _0x5472d2[_0x5e7b('0x2e')]();};}function saveUpdates(_0x1c733f,_0x53f3e7){return function(_0x2609e7){if(_0x2609e7){return _0x2609e7[_0x5e7b('0x2f')](_0x1c733f)[_0x5e7b('0x1a')](function(_0x3bd53c){return _0x3bd53c;});}return null;};}function removeEntity(_0x6246e3,_0x3d4ca8){return function(_0x3177c3){if(_0x3177c3){return _0x3177c3[_0x5e7b('0x30')]()['then'](function(){var _0x5e0f22=_0x3177c3[_0x5e7b('0x31')]({'plain':!![]});var _0x4994d2=_0x5e7b('0x32');return db[_0x5e7b('0x33')]['destroy']({'where':{'type':_0x4994d2,'resourceId':_0x5e0f22['id']}})[_0x5e7b('0x1a')](function(){return _0x3177c3;});})['then'](function(){_0x6246e3[_0x5e7b('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25cfc2,_0x4822f4){return function(_0x4c114a){if(!_0x4c114a){_0x25cfc2['sendStatus'](0x194);}return _0x4c114a;};}function handleError(_0xfdc856,_0x5c8c99){_0x5c8c99=_0x5c8c99||0x1f4;return function(_0x326914){logger[_0x5e7b('0x21')](_0x326914[_0x5e7b('0x34')]);if(_0x326914[_0x5e7b('0x35')]){delete _0x326914[_0x5e7b('0x35')];}_0xfdc856[_0x5e7b('0x26')](_0x5c8c99)[_0x5e7b('0x36')](_0x326914);};}exports['index']=function(_0x1e9bd1,_0xf5c0de){var _0x37bb3e={'include':[{'model':db[_0x5e7b('0x37')],'as':'mandatoryDispositionPause'}]},_0x195138={},_0x23f955={'count':0x0,'rows':[]};var _0x3df037=_[_0x5e7b('0x38')](db[_0x5e7b('0x39')]['rawAttributes'],function(_0x16e63c){return{'name':_0x16e63c['fieldName'],'type':_0x16e63c[_0x5e7b('0x3a')][_0x5e7b('0x3b')]};});_0x195138['model']=_[_0x5e7b('0x38')](_0x3df037,_0x5e7b('0x35'));_0x195138[_0x5e7b('0x3c')]=_[_0x5e7b('0x3d')](_0x1e9bd1[_0x5e7b('0x3c')]);_0x195138[_0x5e7b('0x3e')]=_[_0x5e7b('0x3f')](_0x195138[_0x5e7b('0x40')],_0x195138[_0x5e7b('0x3c')]);_0x37bb3e['attributes']=_[_0x5e7b('0x3f')](_0x195138[_0x5e7b('0x40')],qs[_0x5e7b('0x41')](_0x1e9bd1[_0x5e7b('0x3c')][_0x5e7b('0x41')]));_0x37bb3e[_0x5e7b('0x42')]=_0x37bb3e[_0x5e7b('0x42')][_0x5e7b('0x43')]?_0x37bb3e[_0x5e7b('0x42')]:_0x195138[_0x5e7b('0x40')];if(!_0x1e9bd1[_0x5e7b('0x3c')][_0x5e7b('0x44')](_0x5e7b('0x45'))){_0x37bb3e['limit']=qs[_0x5e7b('0x28')](_0x1e9bd1[_0x5e7b('0x3c')][_0x5e7b('0x28')]);_0x37bb3e[_0x5e7b('0x2a')]=qs[_0x5e7b('0x2a')](_0x1e9bd1['query']['offset']);}_0x37bb3e[_0x5e7b('0x46')]=qs[_0x5e7b('0x47')](_0x1e9bd1['query'][_0x5e7b('0x47')]);_0x37bb3e['where']=qs[_0x5e7b('0x3e')](_['pick'](_0x1e9bd1[_0x5e7b('0x3c')],_0x195138[_0x5e7b('0x3e')]),_0x3df037);if(_0x1e9bd1[_0x5e7b('0x3c')][_0x5e7b('0x48')]){_0x37bb3e[_0x5e7b('0x49')]=_[_0x5e7b('0x4a')](_0x37bb3e[_0x5e7b('0x49')],{'$or':_[_0x5e7b('0x38')](_0x3df037,function(_0x5cae20){if(_0x5cae20[_0x5e7b('0x3a')]!==_0x5e7b('0x4b')){var _0x434ea8={};_0x434ea8[_0x5cae20[_0x5e7b('0x35')]]={'$like':'%'+_0x1e9bd1[_0x5e7b('0x3c')][_0x5e7b('0x48')]+'%'};return _0x434ea8;}})});}_0x37bb3e=_[_0x5e7b('0x4a')]({},_0x37bb3e,_0x1e9bd1['options']);var _0xba14e3={'where':_0x37bb3e['where']};return db[_0x5e7b('0x39')][_0x5e7b('0x29')](_0xba14e3)['then'](function(_0x5bd679){_0x23f955[_0x5e7b('0x29')]=_0x5bd679;if(_0x1e9bd1[_0x5e7b('0x3c')][_0x5e7b('0x4c')]){_0x37bb3e[_0x5e7b('0x4d')]=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x37bb3e);})[_0x5e7b('0x1a')](function(_0xcdab37){_0x23f955['rows']=_0xcdab37;return _0x23f955;})[_0x5e7b('0x1a')](respondWithFilteredResult(_0xf5c0de,_0x37bb3e))[_0x5e7b('0x4e')](handleError(_0xf5c0de,null));};exports[_0x5e7b('0x4f')]=function(_0x465621,_0x5e7fc9){var _0x713ecd={'raw':![],'where':{'id':_0x465621[_0x5e7b('0x50')]['id']},'include':[{'model':db[_0x5e7b('0x37')],'as':_0x5e7b('0x51')}]},_0x3239cf={};_0x3239cf[_0x5e7b('0x40')]=_[_0x5e7b('0x3d')](db['SmsAccount'][_0x5e7b('0x52')]);_0x3239cf[_0x5e7b('0x3c')]=_[_0x5e7b('0x3d')](_0x465621[_0x5e7b('0x3c')]);_0x3239cf[_0x5e7b('0x3e')]=_[_0x5e7b('0x3f')](_0x3239cf[_0x5e7b('0x40')],_0x3239cf[_0x5e7b('0x3c')]);_0x713ecd[_0x5e7b('0x42')]=_[_0x5e7b('0x3f')](_0x3239cf[_0x5e7b('0x40')],qs[_0x5e7b('0x41')](_0x465621['query'][_0x5e7b('0x41')]));_0x713ecd[_0x5e7b('0x42')]=_0x713ecd[_0x5e7b('0x42')][_0x5e7b('0x43')]?_0x713ecd[_0x5e7b('0x42')]:_0x3239cf['model'];if(_0x465621[_0x5e7b('0x3c')][_0x5e7b('0x4c')]){_0x713ecd[_0x5e7b('0x4d')]=[{'all':!![]}];}_0x713ecd=_[_0x5e7b('0x4a')]({},_0x713ecd,_0x465621['options']);return db[_0x5e7b('0x39')][_0x5e7b('0x53')](_0x713ecd)[_0x5e7b('0x1a')](handleEntityNotFound(_0x5e7fc9,null))['then'](respondWithResult(_0x5e7fc9,null))[_0x5e7b('0x4e')](handleError(_0x5e7fc9,null));};exports['create']=function(_0x42cb8f,_0x5545a4){return db['SmsAccount'][_0x5e7b('0x54')](_0x42cb8f[_0x5e7b('0x55')],{})[_0x5e7b('0x1a')](function(_0x46e1c3){var _0x9a3725=_0x42cb8f[_0x5e7b('0x56')]['get']({'plain':!![]});if(!_0x9a3725)throw new Error(_0x5e7b('0x57'));if(_0x9a3725[_0x5e7b('0x58')]==='user'){var _0x585ddc=_0x46e1c3[_0x5e7b('0x31')]({'plain':!![]});var _0x4f4c47=_0x5e7b('0x32');return db[_0x5e7b('0x59')][_0x5e7b('0x53')]({'where':{'name':_0x4f4c47,'userProfileId':_0x9a3725[_0x5e7b('0x5a')]},'raw':!![]})[_0x5e7b('0x1a')](function(_0x497e1f){if(_0x497e1f&&_0x497e1f['autoAssociation']===0x0){return db[_0x5e7b('0x33')][_0x5e7b('0x54')]({'name':_0x585ddc['name'],'resourceId':_0x585ddc['id'],'type':_0x497e1f[_0x5e7b('0x35')],'sectionId':_0x497e1f['id']},{})[_0x5e7b('0x1a')](function(){return _0x46e1c3;});}else{return _0x46e1c3;}})['catch'](function(_0x436a26){logger[_0x5e7b('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x436a26);throw _0x436a26;});}return _0x46e1c3;})[_0x5e7b('0x1a')](respondWithResult(_0x5545a4,0xc9))[_0x5e7b('0x4e')](handleError(_0x5545a4,null));};exports[_0x5e7b('0x2f')]=function(_0x3896a6,_0x44c4f6){if(_0x3896a6[_0x5e7b('0x55')]['id']){delete _0x3896a6[_0x5e7b('0x55')]['id'];}return db[_0x5e7b('0x39')][_0x5e7b('0x53')]({'where':{'id':_0x3896a6['params']['id']},'include':[{'model':db[_0x5e7b('0x37')],'as':_0x5e7b('0x51')}]})[_0x5e7b('0x1a')](handleEntityNotFound(_0x44c4f6,null))[_0x5e7b('0x1a')](saveUpdates(_0x3896a6[_0x5e7b('0x55')],null))[_0x5e7b('0x1a')](respondWithResult(_0x44c4f6,null))[_0x5e7b('0x4e')](handleError(_0x44c4f6,null));};exports[_0x5e7b('0x30')]=function(_0xc0ffca,_0x378c08){return db[_0x5e7b('0x39')][_0x5e7b('0x53')]({'where':{'id':_0xc0ffca['params']['id']}})[_0x5e7b('0x1a')](handleEntityNotFound(_0x378c08,null))[_0x5e7b('0x1a')](removeEntity(_0x378c08,null))[_0x5e7b('0x4e')](handleError(_0x378c08,null));};exports['describe']=function(_0xc577d5,_0x506a1e){return db[_0x5e7b('0x39')][_0x5e7b('0x5b')]()[_0x5e7b('0x1a')](respondWithResult(_0x506a1e,null))[_0x5e7b('0x4e')](handleError(_0x506a1e,null));};exports[_0x5e7b('0x5c')]=function(_0x5cae4d,_0xc3bbcb,_0x474584){if(_0x5cae4d[_0x5e7b('0x55')]['id']){delete _0x5cae4d[_0x5e7b('0x55')]['id'];}return db['SmsAccount'][_0x5e7b('0x53')]({'where':{'id':_0x5cae4d[_0x5e7b('0x50')]['id']}})[_0x5e7b('0x1a')](handleEntityNotFound(_0xc3bbcb,null))[_0x5e7b('0x1a')](function(_0x367b53){if(_0x367b53){_0x5cae4d[_0x5e7b('0x55')][_0x5e7b('0x5d')]=_0x367b53['id'];return db[_0x5e7b('0x5e')][_0x5e7b('0x54')](_0x5cae4d['body']);}})[_0x5e7b('0x1a')](respondWithResult(_0xc3bbcb,null))[_0x5e7b('0x4e')](handleError(_0xc3bbcb,null));};exports['getDispositions']=function(_0x1f0e5c,_0x13f972,_0x4d93b0){var _0x3a0d3c={'raw':![],'where':{}};var _0x3eaba1={};var _0x25f335={'count':0x0,'rows':[]};return db['SmsAccount'][_0x5e7b('0x5f')]({'where':{'id':_0x1f0e5c[_0x5e7b('0x50')]['id']}})[_0x5e7b('0x1a')](handleEntityNotFound(_0x13f972,null))['then'](function(_0x25c688){if(_0x25c688){_0x3eaba1[_0x5e7b('0x40')]=_[_0x5e7b('0x3d')](db['Disposition'][_0x5e7b('0x52')]);_0x3eaba1[_0x5e7b('0x3c')]=_[_0x5e7b('0x3d')](_0x1f0e5c[_0x5e7b('0x3c')]);_0x3eaba1[_0x5e7b('0x3e')]=_[_0x5e7b('0x3f')](_0x3eaba1['model'],_0x3eaba1[_0x5e7b('0x3c')]);_0x3a0d3c[_0x5e7b('0x42')]=_[_0x5e7b('0x3f')](_0x3eaba1['model'],qs['fields'](_0x1f0e5c[_0x5e7b('0x3c')][_0x5e7b('0x41')]));_0x3a0d3c['attributes']=_0x3a0d3c[_0x5e7b('0x42')][_0x5e7b('0x43')]?_0x3a0d3c['attributes']:_0x3eaba1[_0x5e7b('0x40')];if(!_0x1f0e5c['query'][_0x5e7b('0x44')](_0x5e7b('0x45'))){_0x3a0d3c[_0x5e7b('0x28')]=qs[_0x5e7b('0x28')](_0x1f0e5c[_0x5e7b('0x3c')][_0x5e7b('0x28')]);_0x3a0d3c[_0x5e7b('0x2a')]=qs['offset'](_0x1f0e5c[_0x5e7b('0x3c')][_0x5e7b('0x2a')]);}_0x3a0d3c[_0x5e7b('0x46')]=qs[_0x5e7b('0x47')](_0x1f0e5c['query'][_0x5e7b('0x47')]);_0x3a0d3c[_0x5e7b('0x49')]=qs['filters'](_[_0x5e7b('0x60')](_0x1f0e5c[_0x5e7b('0x3c')],_0x3eaba1[_0x5e7b('0x3e')]));_0x3a0d3c['where']['SmsAccountId']=_0x25c688['id'];if(_0x1f0e5c[_0x5e7b('0x3c')][_0x5e7b('0x48')]){_0x3a0d3c[_0x5e7b('0x49')]=_[_0x5e7b('0x4a')](_0x3a0d3c[_0x5e7b('0x49')],{'$or':_['map'](_0x3a0d3c[_0x5e7b('0x42')],function(_0x5c5e2f){var _0x5236e4={};_0x5236e4[_0x5c5e2f]={'$like':'%'+_0x1f0e5c['query']['filter']+'%'};return _0x5236e4;})});}_0x3a0d3c=_[_0x5e7b('0x4a')]({},_0x3a0d3c,_0x1f0e5c[_0x5e7b('0x61')]);return db[_0x5e7b('0x5e')]['count']({'where':_0x3a0d3c['where']})[_0x5e7b('0x1a')](function(_0x30d202){_0x25f335['count']=_0x30d202;if(_0x1f0e5c[_0x5e7b('0x3c')][_0x5e7b('0x4c')]){_0x3a0d3c['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x3a0d3c);})[_0x5e7b('0x1a')](function(_0x2ae0ea){_0x25f335[_0x5e7b('0x62')]=_0x2ae0ea;return _0x25f335;});}})[_0x5e7b('0x1a')](respondWithFilteredResult(_0x13f972,_0x3a0d3c))['catch'](handleError(_0x13f972,null));};exports[_0x5e7b('0x63')]=function(_0x442d50,_0x4fb832,_0x518ca8){return db[_0x5e7b('0x39')][_0x5e7b('0x53')]({'where':{'id':_0x442d50[_0x5e7b('0x50')]['id']}})[_0x5e7b('0x1a')](handleEntityNotFound(_0x4fb832,null))['then'](function(_0x1153f0){if(_0x1153f0){return _0x1153f0[_0x5e7b('0x63')](_0x442d50[_0x5e7b('0x3c')][_0x5e7b('0x64')]);}})[_0x5e7b('0x1a')](respondWithStatusCode(_0x4fb832,null))[_0x5e7b('0x4e')](handleError(_0x4fb832,null));};exports[_0x5e7b('0x65')]=function(_0xb087c4,_0x2ae4c3,_0xbce657){if(_0xb087c4['body']['id']){delete _0xb087c4[_0x5e7b('0x55')]['id'];}return db['SmsAccount'][_0x5e7b('0x53')]({'where':{'id':_0xb087c4[_0x5e7b('0x50')]['id']}})[_0x5e7b('0x1a')](handleEntityNotFound(_0x2ae4c3,null))['then'](function(_0x28ef34){if(_0x28ef34){_0xb087c4[_0x5e7b('0x55')]['SmsAccountId']=_0x28ef34['id'];return db['CannedAnswer'][_0x5e7b('0x54')](_0xb087c4[_0x5e7b('0x55')]);}})[_0x5e7b('0x1a')](respondWithResult(_0x2ae4c3,null))[_0x5e7b('0x4e')](handleError(_0x2ae4c3,null));};exports[_0x5e7b('0x66')]=function(_0x54e5b1,_0x578545,_0x36fa4e){var _0x4139da={'raw':![],'where':{}};var _0x64a057={};var _0x3e1b7d={'count':0x0,'rows':[]};return db[_0x5e7b('0x39')][_0x5e7b('0x5f')]({'where':{'id':_0x54e5b1[_0x5e7b('0x50')]['id']}})[_0x5e7b('0x1a')](handleEntityNotFound(_0x578545,null))[_0x5e7b('0x1a')](function(_0x1536e9){if(_0x1536e9){_0x64a057['model']=_['keys'](db['CannedAnswer'][_0x5e7b('0x52')]);_0x64a057['query']=_[_0x5e7b('0x3d')](_0x54e5b1[_0x5e7b('0x3c')]);_0x64a057[_0x5e7b('0x3e')]=_[_0x5e7b('0x3f')](_0x64a057['model'],_0x64a057[_0x5e7b('0x3c')]);_0x4139da[_0x5e7b('0x42')]=_[_0x5e7b('0x3f')](_0x64a057['model'],qs[_0x5e7b('0x41')](_0x54e5b1['query']['fields']));_0x4139da['attributes']=_0x4139da[_0x5e7b('0x42')][_0x5e7b('0x43')]?_0x4139da[_0x5e7b('0x42')]:_0x64a057[_0x5e7b('0x40')];if(!_0x54e5b1['query']['hasOwnProperty'](_0x5e7b('0x45'))){_0x4139da['limit']=qs[_0x5e7b('0x28')](_0x54e5b1['query'][_0x5e7b('0x28')]);_0x4139da[_0x5e7b('0x2a')]=qs[_0x5e7b('0x2a')](_0x54e5b1[_0x5e7b('0x3c')][_0x5e7b('0x2a')]);}_0x4139da['order']=qs[_0x5e7b('0x47')](_0x54e5b1[_0x5e7b('0x3c')][_0x5e7b('0x47')]);_0x4139da[_0x5e7b('0x49')]=qs['filters'](_[_0x5e7b('0x60')](_0x54e5b1[_0x5e7b('0x3c')],_0x64a057[_0x5e7b('0x3e')]));_0x4139da[_0x5e7b('0x49')][_0x5e7b('0x5d')]=_0x1536e9['id'];if(_0x54e5b1[_0x5e7b('0x3c')][_0x5e7b('0x48')]){_0x4139da[_0x5e7b('0x49')]=_[_0x5e7b('0x4a')](_0x4139da[_0x5e7b('0x49')],{'$or':_['map'](_0x4139da[_0x5e7b('0x42')],function(_0x369079){var _0x3b2a1d={};_0x3b2a1d[_0x369079]={'$like':'%'+_0x54e5b1['query'][_0x5e7b('0x48')]+'%'};return _0x3b2a1d;})});}_0x4139da=_[_0x5e7b('0x4a')]({},_0x4139da,_0x54e5b1[_0x5e7b('0x61')]);return db[_0x5e7b('0x67')][_0x5e7b('0x29')]({'where':_0x4139da[_0x5e7b('0x49')]})['then'](function(_0x1afd06){_0x3e1b7d['count']=_0x1afd06;if(_0x54e5b1['query'][_0x5e7b('0x4c')]){_0x4139da[_0x5e7b('0x4d')]=[{'all':!![]}];}return db[_0x5e7b('0x67')][_0x5e7b('0x68')](_0x4139da);})[_0x5e7b('0x1a')](function(_0x1a1cad){_0x3e1b7d[_0x5e7b('0x62')]=_0x1a1cad;return _0x3e1b7d;});}})['then'](respondWithFilteredResult(_0x578545,_0x4139da))[_0x5e7b('0x4e')](handleError(_0x578545,null));};exports[_0x5e7b('0x69')]=function(_0x2e0808,_0x20310e,_0x3e04bd){return db[_0x5e7b('0x39')][_0x5e7b('0x53')]({'where':{'id':_0x2e0808[_0x5e7b('0x50')]['id']}})[_0x5e7b('0x1a')](handleEntityNotFound(_0x20310e,null))['then'](function(_0x47389d){if(_0x47389d){return _0x47389d['removeAnswers'](_0x2e0808[_0x5e7b('0x3c')][_0x5e7b('0x64')]);}})['then'](respondWithStatusCode(_0x20310e,null))[_0x5e7b('0x4e')](handleError(_0x20310e,null));};exports['notify']=function(_0x247019,_0xf5869a,_0x1025b5){var _0x386b08={'channel':_0x5e7b('0x6a')};var _0xc38ef0=[];var _0x11bcee=[];var _0xe0dae0={};return db[_0x5e7b('0x39')][_0x5e7b('0x53')]({'where':{'id':_0x247019[_0x5e7b('0x50')]['id']},'include':[{'model':db[_0x5e7b('0x6b')],'as':_0x5e7b('0x6c')}]})[_0x5e7b('0x1a')](handleEntityNotFound(_0xf5869a,null))[_0x5e7b('0x1a')](function(_0x4be173){_0x386b08[_0x5e7b('0x6d')]=_0x4be173;_0x386b08[_0x5e7b('0x6e')]=_[_0x5e7b('0x6f')](_0x4be173[_0x5e7b('0x6c')],[_0x5e7b('0x70')],['asc']);if(_0x386b08[_0x5e7b('0x6d')]['Applications']){delete _0x386b08[_0x5e7b('0x6d')][_0x5e7b('0x6c')];}return db[_0x5e7b('0x71')][_0x5e7b('0x5b')]();})['then'](function(_0x584b42){if(!_0x584b42){throw new db[(_0x5e7b('0x72'))][(_0x5e7b('0x73'))](_0x5e7b('0x74'));}_0xc38ef0=_[_0x5e7b('0x75')](_[_0x5e7b('0x3d')](_0x584b42),['createdAt',_0x5e7b('0x76')]);_0x11bcee=_[_0x5e7b('0x75')](_[_0x5e7b('0x3d')](_0x584b42),['createdAt',_0x5e7b('0x76'),'CompanyId',_0x5e7b('0x77')]);_0x386b08['body']={'mapKey':_0x5e7b('0x78')};if(_0x386b08[_0x5e7b('0x6d')][_0x5e7b('0x3a')]){switch(_0x386b08[_0x5e7b('0x6d')][_0x5e7b('0x3a')]){case _0x5e7b('0x79'):_0x386b08[_0x5e7b('0x55')][_0x5e7b('0x7a')]=_0x247019[_0x5e7b('0x55')]['From'];_0x386b08['body']['body']=_0x247019[_0x5e7b('0x55')][_0x5e7b('0x7b')];_0x386b08[_0x5e7b('0x55')][_0x5e7b('0x7c')]=_0x247019['body'][_0x5e7b('0x7d')];break;case _0x5e7b('0x7e'):_0x386b08[_0x5e7b('0x55')][_0x5e7b('0x7a')]='+'+_0x247019[_0x5e7b('0x55')]['sender'];_0x386b08[_0x5e7b('0x55')]['body']=_0x247019[_0x5e7b('0x55')][_0x5e7b('0x7f')];break;case _0x5e7b('0x80'):_0x386b08[_0x5e7b('0x55')][_0x5e7b('0x7a')]=_0x247019['body'][_0x5e7b('0x7a')];_0x386b08[_0x5e7b('0x55')][_0x5e7b('0x55')]=_0x247019[_0x5e7b('0x55')]['message'];break;case _0x5e7b('0x81'):_0x386b08['body'][_0x5e7b('0x7a')]=_0x247019[_0x5e7b('0x55')][_0x5e7b('0x7a')];_0x386b08[_0x5e7b('0x55')][_0x5e7b('0x55')]=_0x247019[_0x5e7b('0x55')][_0x5e7b('0x55')];_0x386b08[_0x5e7b('0x55')]['messageId']=_0x247019[_0x5e7b('0x55')]['message_id'];break;case _0x5e7b('0x82'):_0x386b08[_0x5e7b('0x55')][_0x5e7b('0x7a')]=_0x247019[_0x5e7b('0x55')][_0x5e7b('0x83')];_0x386b08[_0x5e7b('0x55')][_0x5e7b('0x55')]=_0x247019[_0x5e7b('0x55')][_0x5e7b('0x84')];_0x386b08[_0x5e7b('0x55')][_0x5e7b('0x7c')]=_0x247019[_0x5e7b('0x55')][_0x5e7b('0x85')];break;case'infobip':_0x386b08['body'][_0x5e7b('0x7a')]='+'+_0x247019[_0x5e7b('0x55')][_0x5e7b('0x86')][0x0][_0x5e7b('0x7a')];_0x386b08[_0x5e7b('0x55')]['body']=_0x247019[_0x5e7b('0x55')][_0x5e7b('0x86')][0x0][_0x5e7b('0x7f')];_0x386b08[_0x5e7b('0x55')][_0x5e7b('0x7c')]=_0x247019[_0x5e7b('0x55')]['results'][0x0][_0x5e7b('0x7c')];break;case _0x5e7b('0x87'):_0x386b08[_0x5e7b('0x55')][_0x5e7b('0x7a')]=_0x247019[_0x5e7b('0x55')]['originatingAddress'];_0x386b08[_0x5e7b('0x55')]['body']=_0x247019[_0x5e7b('0x55')][_0x5e7b('0x88')]['message'];break;case'clickatell':_0x386b08[_0x5e7b('0x55')][_0x5e7b('0x7a')]=_0x247019['body'][_0x5e7b('0x89')];_0x386b08[_0x5e7b('0x55')]['body']=_0x247019[_0x5e7b('0x55')]['text'];_0x386b08[_0x5e7b('0x55')][_0x5e7b('0x7c')]=_0x247019[_0x5e7b('0x55')]['replyMessageId'];break;case _0x5e7b('0x8a'):_0x386b08[_0x5e7b('0x55')]['messageId']=_0x247019[_0x5e7b('0x55')][0x0]['message']['id'];_0x386b08[_0x5e7b('0x55')][_0x5e7b('0x7a')]=_0x247019['body'][0x0][_0x5e7b('0x23')][_0x5e7b('0x7a')];_0x386b08['body'][_0x5e7b('0x55')]=_0x247019[_0x5e7b('0x55')][0x0][_0x5e7b('0x23')][_0x5e7b('0x7f')];break;case _0x5e7b('0x8b'):_0x386b08[_0x5e7b('0x55')][_0x5e7b('0x7a')]=_0x247019[_0x5e7b('0x55')][_0x5e7b('0x7a')];_0x386b08[_0x5e7b('0x55')][_0x5e7b('0x55')]=_0x247019[_0x5e7b('0x55')][_0x5e7b('0x23')];_0x386b08[_0x5e7b('0x55')]['messageId']=_0x247019[_0x5e7b('0x55')]['refid'];break;}}if(_0x386b08[_0x5e7b('0x55')]['id']){delete _0x386b08[_0x5e7b('0x55')]['id'];}if(_[_0x5e7b('0x8c')](_0x386b08['body']['from'])){throw new db[(_0x5e7b('0x72'))][(_0x5e7b('0x73'))](_0x5e7b('0x8d'));}if(_[_0x5e7b('0x8c')](_0x386b08['body'][_0x5e7b('0x55')])||_0x386b08['body'][_0x5e7b('0x55')]===''){throw new db['Sequelize'][(_0x5e7b('0x73'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x386b08[_0x5e7b('0x55')][_0x5e7b('0x8e')])){throw new db[(_0x5e7b('0x72'))][(_0x5e7b('0x73'))](_0x5e7b('0x8f')+_0x11bcee);}if(!_[_0x5e7b('0x90')](_0x11bcee,_0x386b08['body'][_0x5e7b('0x8e')])){throw new db[(_0x5e7b('0x72'))][(_0x5e7b('0x73'))](_0x5e7b('0x91')+_0x11bcee);}_0xe0dae0[_0x386b08[_0x5e7b('0x55')][_0x5e7b('0x8e')]]=_0x386b08[_0x5e7b('0x55')][_0x5e7b('0x7a')];return db['CmList']['find']({'where':{'id':_0x386b08[_0x5e7b('0x6d')][_0x5e7b('0x77')]},'include':[{'model':db[_0x5e7b('0x71')],'as':_0x5e7b('0x92'),'where':_0xe0dae0,'limit':0x1,'order':[[_0x5e7b('0x76'),_0x5e7b('0x93')]]}]});})[_0x5e7b('0x1a')](handleEntityNotFound(_0xf5869a,null))[_0x5e7b('0x1a')](function(_0x3f3742){if(_0x3f3742){_0x386b08[_0x5e7b('0x94')]=_['omit'](_0x3f3742,['Contacts']);if(_0x3f3742['Contacts']['length']){return _0x3f3742[_0x5e7b('0x92')][0x0];}var _0x534ac3=_[_0x5e7b('0x12')](_0x386b08[_0x5e7b('0x55')],{'firstName':_0x386b08[_0x5e7b('0x55')][_0x5e7b('0x7a')],'ListId':_0x3f3742['id']});_0x534ac3[_0x386b08[_0x5e7b('0x55')][_0x5e7b('0x8e')]]=_0x386b08[_0x5e7b('0x55')][_0x5e7b('0x7a')];return db[_0x5e7b('0x71')]['create'](_0x534ac3,{'fields':_0xc38ef0,'raw':!![]});}})[_0x5e7b('0x1a')](handleEntityNotFound(_0xf5869a,null))[_0x5e7b('0x1a')](function(_0x4a3a43){if(_0x4a3a43){_0x386b08['contact']=_0x4a3a43;var _0x3ab043={'ContactId':_0x4a3a43['id'],'phone':_0x386b08[_0x5e7b('0x55')][_0x5e7b('0x7a')],'SmsAccountId':_0x247019[_0x5e7b('0x50')]['id']};var _0x32023c={'ContactId':_0x4a3a43['id'],'SmsAccountId':_0x247019['params']['id'],'closed':![]};return db[_0x5e7b('0x95')][_0x5e7b('0x53')]({'where':_0x32023c})['then'](function(_0xfbe409){if(_0xfbe409){return[_0xfbe409,![]];}return db[_0x5e7b('0x95')][_0x5e7b('0x54')](_0x3ab043)['then'](function(_0x40504e){return[_0x40504e,!![]];});});}})[_0x5e7b('0x96')](function(_0x186ad1,_0x27c370){_0x386b08['interaction']=_0x186ad1[_0x5e7b('0x31')]({'plain':!![]});_0x386b08['interaction'][_0x5e7b('0x97')]=![];if(_0x27c370){if(_0x386b08[_0x5e7b('0x6d')][_0x5e7b('0x98')]){_0x386b08[_0x5e7b('0x6e')][_0x5e7b('0x99')]({'id':0x0,'priority':_0x386b08[_0x5e7b('0x6e')][_0x5e7b('0x43')]+0x1,'app':_0x5e7b('0x9a'),'appdata':'unmanaged','interval':_0x5e7b('0x9b')});}_0x386b08[_0x5e7b('0x9c')]['created']=!![];}return db[_0x5e7b('0x9d')]['create']({'phone':_0x386b08[_0x5e7b('0x55')]['from'],'messageId':_0x386b08[_0x5e7b('0x55')][_0x5e7b('0x7c')],'body':_0x386b08[_0x5e7b('0x55')][_0x5e7b('0x55')],'SmsAccountId':_0x247019[_0x5e7b('0x50')]['id'],'SmsInteractionId':_0x186ad1['id'],'direction':'in','ContactId':_0x186ad1['ContactId'],'AttachmentId':_0x386b08['body']['AttachmentId']});})['then'](function(_0x7a46de){_0x386b08[_0x5e7b('0x23')]=_0x7a46de;if(_0x386b08[_0x5e7b('0x9c')][_0x5e7b('0x9e')]){return db['User'][_0x5e7b('0x53')]({'attributes':['id',_0x5e7b('0x35')],'where':{'id':_0x386b08[_0x5e7b('0x9c')][_0x5e7b('0x9e')]}})[_0x5e7b('0x1a')](function(_0x52014b){if(_0x52014b){_0x386b08[_0x5e7b('0x6e')]['unshift']({'id':0x0,'priority':0x0,'app':_0x5e7b('0x9f'),'appdata':_0x52014b[_0x5e7b('0x35')]+','+(_0x386b08[_0x5e7b('0x6d')][_0x5e7b('0xa0')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x5e7b('0xa1'),_0x386b08);});}return respondWithRpcPromise(_0x5e7b('0xa2'),_0x5e7b('0xa1'),_0x386b08);})[_0x5e7b('0x1a')](function(_0x40b25a){if(_0x40b25a){var _0x1d7413=0xc8;var _0xacbc59=_0x5e7b('0xa3');logger[_0x5e7b('0x1b')](_0x5e7b('0x1f'),_0xacbc59,_0x1d7413,_0x5e7b('0xa4'));logger[_0x5e7b('0x1e')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0xacbc59,_0x1d7413,_0x5e7b('0xa4'),JSON[_0x5e7b('0x20')](_0x40b25a));if(_0x386b08[_0x5e7b('0x6d')][_0x5e7b('0x3a')]===_0x5e7b('0x79')){return _0xf5869a[_0x5e7b('0x26')](_0x1d7413)['set'](_0x5e7b('0xa5'),_0x5e7b('0xa6'))[_0x5e7b('0x36')](_0x5e7b('0xa7'));}else{return _0xf5869a[_0x5e7b('0x26')](_0x1d7413)['json'](_0x40b25a);}}})[_0x5e7b('0x4e')](handleError(_0xf5869a,null));};exports[_0x5e7b('0xa8')]=function(_0x1dac78,_0x37b725){var _0x5a0412=_0x1dac78[_0x5e7b('0x50')]['id'];var _0x2a7bd1=_0x1dac78[_0x5e7b('0x55')];var _0x567b6a=0xc8;var _0x4730a4=null;return db[_0x5e7b('0xa9')]['transaction']({'isolationLevel':db[_0x5e7b('0xa9')][_0x5e7b('0xaa')][_0x5e7b('0xab')][_0x5e7b('0xac')]},function(_0x220ac5){return db[_0x5e7b('0x39')]['findOne']({'where':{'id':_0x5a0412},'transaction':_0x220ac5})['then'](function(_0x126383){if(_0x126383){return db[_0x5e7b('0x6b')][_0x5e7b('0x30')]({'where':{'SmsAccountId':_0x5a0412},'transaction':_0x220ac5})[_0x5e7b('0x1a')](function(){var _0x2712cf=_['map'](_0x2a7bd1,function(_0x162975){_0x162975[_0x5e7b('0x5d')]=_0x5a0412;return _0x162975;});return db[_0x5e7b('0x6b')]['bulkCreate'](_0x2712cf,{'transaction':_0x220ac5});});}else{_0x567b6a=0x194;_0x4730a4=[];}});})[_0x5e7b('0x1a')](function(){if(_0x567b6a!==0x194){return db[_0x5e7b('0x6b')][_0x5e7b('0xad')]({'where':{'SmsAccountId':_0x5a0412},'order':_0x5e7b('0x70')})[_0x5e7b('0x1a')](function(_0x3b5cdc){_0x4730a4=_0x3b5cdc;});}})['catch'](function(_0x3d50c4){_0x567b6a=0x1f4;logger[_0x5e7b('0x21')](_0x3d50c4['stack']);if(_0x3d50c4['name']){delete _0x3d50c4['name'];}_0x4730a4=_0x3d50c4;})[_0x5e7b('0xae')](function(){if(_0x4730a4===null){_0x37b725['sendStatus'](_0x567b6a);}else{if(_0x567b6a===0x1f4){_0x37b725[_0x5e7b('0x26')](_0x567b6a)['send'](_0x4730a4);}else{_0x37b725[_0x5e7b('0x26')](_0x567b6a)[_0x5e7b('0xaf')](_0x4730a4);}}});};exports[_0x5e7b('0xb0')]=function(_0x18eb2e,_0x4a0780,_0x4f87fe){var _0x346443={};var _0xe90fcb={};var _0x51accb;var _0x2f7c08;return db[_0x5e7b('0x39')][_0x5e7b('0x5f')]({'where':{'id':_0x18eb2e[_0x5e7b('0x50')]['id']}})[_0x5e7b('0x1a')](handleEntityNotFound(_0x4a0780,null))[_0x5e7b('0x1a')](function(_0x5879ca){if(_0x5879ca){_0x51accb=_0x5879ca;_0xe90fcb[_0x5e7b('0x40')]=_[_0x5e7b('0x3d')](db[_0x5e7b('0x6b')]['rawAttributes']);_0xe90fcb[_0x5e7b('0x3c')]=_['keys'](_0x18eb2e[_0x5e7b('0x3c')]);_0xe90fcb[_0x5e7b('0x3e')]=_[_0x5e7b('0x3f')](_0xe90fcb[_0x5e7b('0x40')],_0xe90fcb['query']);_0x346443[_0x5e7b('0x42')]=_[_0x5e7b('0x3f')](_0xe90fcb[_0x5e7b('0x40')],qs[_0x5e7b('0x41')](_0x18eb2e[_0x5e7b('0x3c')][_0x5e7b('0x41')]));_0x346443[_0x5e7b('0x42')]=_0x346443['attributes'][_0x5e7b('0x43')]?_0x346443[_0x5e7b('0x42')]:_0xe90fcb['model'];_0x346443['order']=qs['sort'](_0x18eb2e[_0x5e7b('0x3c')][_0x5e7b('0x47')]);_0x346443['where']=qs[_0x5e7b('0x3e')](_['pick'](_0x18eb2e[_0x5e7b('0x3c')],_0xe90fcb['filters']));if(_0x18eb2e[_0x5e7b('0x3c')]['filter']){_0x346443[_0x5e7b('0x49')]=_[_0x5e7b('0x4a')](_0x346443[_0x5e7b('0x49')],{'$or':_[_0x5e7b('0x38')](_0x346443[_0x5e7b('0x42')],function(_0x310df1){var _0x3130e3={};_0x3130e3[_0x310df1]={'$like':'%'+_0x18eb2e[_0x5e7b('0x3c')][_0x5e7b('0x48')]+'%'};return _0x3130e3;})});}_0x346443=_['merge']({},_0x346443,_0x18eb2e['options']);return _0x51accb['getApplications'](_0x346443);}})[_0x5e7b('0x1a')](function(_0x234111){if(_0x234111){_0x2f7c08=_0x234111[_0x5e7b('0x43')];if(!_0x18eb2e[_0x5e7b('0x3c')][_0x5e7b('0x44')]('nolimit')){_0x346443[_0x5e7b('0x28')]=qs[_0x5e7b('0x28')](_0x18eb2e['query']['limit']);_0x346443[_0x5e7b('0x2a')]=qs['offset'](_0x18eb2e['query'][_0x5e7b('0x2a')]);}return _0x51accb[_0x5e7b('0xb0')](_0x346443);}})[_0x5e7b('0x1a')](function(_0x419dfd){if(_0x419dfd){return _0x419dfd?{'count':_0x2f7c08,'rows':_0x419dfd}:null;}})[_0x5e7b('0x1a')](respondWithResult(_0x4a0780,null))[_0x5e7b('0x4e')](handleError(_0x4a0780,null));};exports['getInteractions']=function(_0x55f8e1,_0x3fb5ac,_0x3c6270){var _0x4393cb={'raw':![],'where':{}};var _0x299819={};var _0x45c7e2={'count':0x0,'rows':[]};return db[_0x5e7b('0x39')][_0x5e7b('0x5f')]({'where':{'id':_0x55f8e1[_0x5e7b('0x50')]['id']}})[_0x5e7b('0x1a')](handleEntityNotFound(_0x3fb5ac,null))[_0x5e7b('0x1a')](function(_0x4f56b1){if(_0x4f56b1){_0x299819[_0x5e7b('0x40')]=_['keys'](db[_0x5e7b('0x95')]['rawAttributes']);_0x299819[_0x5e7b('0x3c')]=_[_0x5e7b('0x3d')](_0x55f8e1['query']);_0x299819['filters']=_['intersection'](_0x299819[_0x5e7b('0x40')],_0x299819[_0x5e7b('0x3c')]);_0x4393cb['attributes']=_[_0x5e7b('0x3f')](_0x299819[_0x5e7b('0x40')],qs[_0x5e7b('0x41')](_0x55f8e1[_0x5e7b('0x3c')][_0x5e7b('0x41')]));_0x4393cb[_0x5e7b('0x42')]=_0x4393cb[_0x5e7b('0x42')]['length']?_0x4393cb[_0x5e7b('0x42')]:_0x299819['model'];if(!_0x55f8e1[_0x5e7b('0x3c')][_0x5e7b('0x44')](_0x5e7b('0x45'))){_0x4393cb['limit']=qs[_0x5e7b('0x28')](_0x55f8e1['query'][_0x5e7b('0x28')]);_0x4393cb[_0x5e7b('0x2a')]=qs['offset'](_0x55f8e1['query'][_0x5e7b('0x2a')]);}_0x4393cb[_0x5e7b('0x46')]=qs[_0x5e7b('0x47')](_0x55f8e1[_0x5e7b('0x3c')][_0x5e7b('0x47')]);_0x4393cb[_0x5e7b('0x49')]=qs[_0x5e7b('0x3e')](_[_0x5e7b('0x60')](_0x55f8e1[_0x5e7b('0x3c')],_0x299819['filters']));_0x4393cb[_0x5e7b('0x49')][_0x5e7b('0x5d')]=_0x4f56b1['id'];if(_0x55f8e1[_0x5e7b('0x3c')][_0x5e7b('0x48')]){_0x4393cb[_0x5e7b('0x49')]=_[_0x5e7b('0x4a')](_0x4393cb['where'],{'$or':_[_0x5e7b('0x38')](_0x4393cb['attributes'],function(_0x5404f8){var _0x44a609={};_0x44a609[_0x5404f8]={'$like':'%'+_0x55f8e1['query'][_0x5e7b('0x48')]+'%'};return _0x44a609;})});}_0x4393cb=_[_0x5e7b('0x4a')]({},_0x4393cb,_0x55f8e1[_0x5e7b('0x61')]);return db[_0x5e7b('0x95')]['count']({'where':_0x4393cb[_0x5e7b('0x49')]})[_0x5e7b('0x1a')](function(_0x2aa4d6){_0x45c7e2[_0x5e7b('0x29')]=_0x2aa4d6;if(_0x55f8e1[_0x5e7b('0x3c')]['includeAll']){_0x4393cb['include']=[{'model':db[_0x5e7b('0x71')],'as':'Contact','required':![]},{'model':db[_0x5e7b('0xb1')],'as':_0x5e7b('0xb2'),'attributes':['name',_0x5e7b('0xb3'),_0x5e7b('0xb4')],'required':![]},{'model':db[_0x5e7b('0xb5')],'as':_0x5e7b('0xb6'),'attributes':['id',_0x5e7b('0x35'),'color'],'where':_0x55f8e1[_0x5e7b('0x3c')][_0x5e7b('0xb7')]?{'id':_0x55f8e1[_0x5e7b('0x3c')]['tag']}:undefined,'required':_0x55f8e1[_0x5e7b('0x3c')][_0x5e7b('0xb7')]?!![]:![]}];}return db[_0x5e7b('0x95')]['findAll'](_0x4393cb);})[_0x5e7b('0x1a')](function(_0x22b935){_0x45c7e2[_0x5e7b('0x62')]=_0x22b935;return _0x45c7e2;});}})[_0x5e7b('0x1a')](respondWithFilteredResult(_0x3fb5ac,_0x4393cb))[_0x5e7b('0x4e')](handleError(_0x3fb5ac,null));};exports[_0x5e7b('0x36')]=function(_0x161ae2,_0x52307c,_0x244534){var _0x5a9a58,_0x598a7d,_0x59433d;if(_[_0x5e7b('0x8c')](_0x161ae2['body'][_0x5e7b('0x55')])||_0x161ae2['body']['body']===''){throw new db['Sequelize'][(_0x5e7b('0x73'))](_0x5e7b('0xb8'));}if(_['isNil'](_0x161ae2[_0x5e7b('0x55')]['to'])){throw new db[(_0x5e7b('0x72'))][(_0x5e7b('0x73'))](_0x5e7b('0xb9'));}_0x5a9a58=_0x161ae2[_0x5e7b('0x55')]['to'];return db[_0x5e7b('0x39')][_0x5e7b('0x53')]({'where':{'id':_0x161ae2[_0x5e7b('0x50')]['id']},'include':[{'model':db[_0x5e7b('0xba')],'as':'List','include':[{'model':db[_0x5e7b('0x71')],'as':_0x5e7b('0x92'),'where':{'mobile':_0x5a9a58},'limit':0x1,'order':[['updatedAt',_0x5e7b('0x93')]]}]}]})['then'](handleEntityNotFound(_0x52307c,null))[_0x5e7b('0x1a')](function(_0x10c7fc){if(_0x10c7fc&&_0x10c7fc[_0x5e7b('0xbb')]){_0x598a7d=_0x10c7fc[_0x5e7b('0x31')]({'plain':!![]});if(_0x598a7d[_0x5e7b('0xbb')]&&_0x598a7d['List']['Contacts'][_0x5e7b('0x43')]){return _0x598a7d['List'][_0x5e7b('0x92')][0x0];}return db[_0x5e7b('0x71')][_0x5e7b('0x54')](_[_0x5e7b('0x12')](_0x161ae2[_0x5e7b('0x55')],{'firstName':_0x5a9a58,'mobile':_0x5a9a58,'phone':_0x5a9a58,'ListId':_0x598a7d[_0x5e7b('0x77')]}));}})[_0x5e7b('0x1a')](handleEntityNotFound(_0x52307c,null))[_0x5e7b('0x1a')](function(_0x5dd31a){if(_0x5dd31a){_0x59433d=_0x5dd31a;return db['SmsInteraction'][_0x5e7b('0x53')]({'where':{'ContactId':_0x59433d['id'],'closed':![],'SmsAccountId':_0x598a7d['id']}})['then'](function(_0x58d098){if(_0x58d098){return[_0x58d098,![]];}return db['SmsInteraction']['create']({'UserId':_0x161ae2[_0x5e7b('0x56')]['id'],'ContactId':_0x59433d['id'],'SmsAccountId':_0x598a7d['id'],'phone':_0x5a9a58,'firstMsgDirection':_0x5e7b('0xbc'),'Messages':[_[_0x5e7b('0x4a')](_0x161ae2[_0x5e7b('0x55')],{'read':![],'body':_0x161ae2['body'][_0x5e7b('0x55')],'phone':_0x5a9a58,'SmsAccountId':_0x598a7d['id'],'UserId':_0x161ae2[_0x5e7b('0x56')]['id'],'ContactId':_0x59433d['id']})]},{'include':[{'model':db[_0x5e7b('0x9d')],'as':_0x5e7b('0xbd')}]})[_0x5e7b('0x1a')](function(_0x45e6af){return[_0x45e6af,!![]];});});}})[_0x5e7b('0x96')](function(_0x39f7d8,_0x194d6e){if(_0x194d6e){return _0x39f7d8;}return db[_0x5e7b('0x9d')][_0x5e7b('0x54')](_[_0x5e7b('0x4a')](_0x161ae2[_0x5e7b('0x55')],{'read':![],'body':_0x161ae2[_0x5e7b('0x55')][_0x5e7b('0x55')],'phone':_0x5a9a58,'SmsAccountId':_0x598a7d['id'],'SmsInteractionId':_0x39f7d8['id'],'UserId':_0x161ae2[_0x5e7b('0x56')]['id'],'ContactId':_0x59433d['id']}))[_0x5e7b('0x1a')](function(_0x3451ca){_0x39f7d8[_0x5e7b('0xbe')][_0x5e7b('0xbd')]=[];_0x39f7d8[_0x5e7b('0xbe')][_0x5e7b('0xbd')]['push'](_0x3451ca['dataValues']);return _0x39f7d8;});})['then'](respondWithResult(_0x52307c,null))[_0x5e7b('0x4e')](handleError(_0x52307c,null));};exports[_0x5e7b('0x26')]=function(_0x10cb14,_0x4636e2,_0xde179){if(_0x10cb14[_0x5e7b('0x55')]['id']){delete _0x10cb14[_0x5e7b('0x55')]['id'];}var _0x25e697,_0x2e3d9c,_0x3364d2;return db[_0x5e7b('0x39')][_0x5e7b('0x53')]({'where':{'id':_0x10cb14[_0x5e7b('0x50')]['id']}})[_0x5e7b('0x1a')](handleEntityNotFound(_0x4636e2,null))[_0x5e7b('0x1a')](function(_0x61f9ef){if(_0x61f9ef){_0x3364d2=_0x61f9ef;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5e7b('0x26'),_0x5e7b('0xbf'),_0x61f9ef[_0x5e7b('0x3a')],util[_0x5e7b('0xc0')](_0x10cb14['body'],{'showHidden':![],'depth':null}));switch(_0x61f9ef[_0x5e7b('0x3a')]){case _0x5e7b('0x7e'):if(_0x10cb14[_0x5e7b('0x55')][_0x5e7b('0xc1')]&&_0x10cb14[_0x5e7b('0x55')]['status']){_0x2e3d9c=_0x10cb14[_0x5e7b('0x55')][_0x5e7b('0x26')];return db[_0x5e7b('0x9d')][_0x5e7b('0x53')]({'where':{'messageId':_0x10cb14['body'][_0x5e7b('0xc1')]}});}break;case'connectel':if(_0x10cb14[_0x5e7b('0x55')][_0x5e7b('0xc2')]&&_0x10cb14[_0x5e7b('0x55')][_0x5e7b('0xc3')]){_0x2e3d9c=_0x10cb14[_0x5e7b('0x55')]['statusInt'];return db[_0x5e7b('0x9d')][_0x5e7b('0x53')]({'where':{'messageId':_0x10cb14[_0x5e7b('0x55')][_0x5e7b('0xc2')]}});}break;case _0x5e7b('0x81'):if(_0x10cb14['body'][_0x5e7b('0xc4')]&&_0x10cb14[_0x5e7b('0x55')][_0x5e7b('0xc5')]){_0x2e3d9c=_0x10cb14[_0x5e7b('0x55')][_0x5e7b('0xc5')];return db[_0x5e7b('0x9d')][_0x5e7b('0x53')]({'where':{'messageId':_0x10cb14[_0x5e7b('0x55')][_0x5e7b('0xc4')]}});}break;case _0x5e7b('0xc6'):var _0x468ede=_0x10cb14['body'][_0x5e7b('0x86')][0x0];if(_0x468ede[_0x5e7b('0x7c')]&&_0x468ede[_0x5e7b('0x26')][_0x5e7b('0xc7')]==='DELIVERED'){_0x2e3d9c=_0x468ede[_0x5e7b('0x26')]['groupName'];return db[_0x5e7b('0x9d')][_0x5e7b('0x53')]({'where':{'messageId':_0x468ede['messageId']}});}break;case'clickatell':if(_0x10cb14[_0x5e7b('0x55')][_0x5e7b('0x7c')]&&_0x10cb14[_0x5e7b('0x55')][_0x5e7b('0x26')]){_0x2e3d9c=_0x10cb14[_0x5e7b('0x55')][_0x5e7b('0x26')];return db[_0x5e7b('0x9d')][_0x5e7b('0x53')]({'where':{'messageId':_0x10cb14[_0x5e7b('0x55')][_0x5e7b('0x7c')]}});}break;case _0x5e7b('0x8a'):if(_0x10cb14[_0x5e7b('0x55')][0x0][_0x5e7b('0x23')]['id']){_0x2e3d9c=_0x10cb14['body'][0x0][_0x5e7b('0x3a')];return db[_0x5e7b('0x9d')][_0x5e7b('0x53')]({'where':{'messageId':_0x10cb14['body'][0x0][_0x5e7b('0x23')]['id']}});}break;case'intelepeer':if(_0x10cb14[_0x5e7b('0x55')][_0x5e7b('0xc8')]&&_0x10cb14['body'][_0x5e7b('0x26')]){_0x2e3d9c=_0x10cb14[_0x5e7b('0x55')][_0x5e7b('0x26')];return db['SmsMessage']['find']({'where':{'messageId':_0x10cb14[_0x5e7b('0x55')][_0x5e7b('0xc8')]}});}break;}}})[_0x5e7b('0x1a')](handleEntityNotFound(_0x4636e2,null))[_0x5e7b('0x1a')](function(_0x3ebc70){if(_0x3ebc70){_0x25e697=_0x3ebc70;switch(_0x3364d2[_0x5e7b('0x3a')]){case _0x5e7b('0x7e'):if(_0x2e3d9c===_0x5e7b('0xc9')){return _0x25e697[_0x5e7b('0x2f')]({'read':!![]});}else{logger[_0x5e7b('0x21')](_0x5e7b('0x1f'),'status','skebby',util[_0x5e7b('0xc0')](_0x10cb14[_0x5e7b('0x55')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x2e3d9c==='1'){return _0x25e697[_0x5e7b('0x2f')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5e7b('0x26'),_0x5e7b('0x7e'),util['inspect'](_0x10cb14[_0x5e7b('0x55')],{'showHidden':![],'depth':null}));}break;case _0x5e7b('0x81'):if(!_0x10cb14[_0x5e7b('0x55')]['error_code']&&_0x2e3d9c>=0xc8&&_0x2e3d9c<=0xce){return _0x25e697[_0x5e7b('0x2f')]({'read':!![]});}else{logger['error'](_0x5e7b('0x1f'),_0x5e7b('0x26'),_0x5e7b('0x81'),util[_0x5e7b('0xc0')](_0x10cb14[_0x5e7b('0x55')],{'showHidden':![],'depth':null}));}break;case _0x5e7b('0xc6'):var _0x567de2=_0x10cb14[_0x5e7b('0x55')][_0x5e7b('0x86')][0x0];if(_0x567de2['status'][_0x5e7b('0xc7')]==='DELIVERED'){return _0x25e697[_0x5e7b('0x2f')]({'read':!![]});}else{logger['error'](_0x5e7b('0x1f'),'status','infobip',util[_0x5e7b('0xc0')](_0x10cb14['body'],{'showHidden':![],'depth':null}));}break;case _0x5e7b('0xca'):if(_0x2e3d9c==_0x5e7b('0xcb')||_0x2e3d9c==_0x5e7b('0xcc')){return _0x25e697['update']({'read':!![]});}else{logger[_0x5e7b('0x21')](_0x5e7b('0x1f'),_0x5e7b('0x26'),_0x5e7b('0xca'),util[_0x5e7b('0xc0')](_0x10cb14[_0x5e7b('0x55')],{'showHidden':![],'depth':null}));}break;case _0x5e7b('0x8a'):if(_0x2e3d9c==_0x5e7b('0xcd')){return _0x25e697[_0x5e7b('0x2f')]({'read':!![]});}else{logger[_0x5e7b('0x21')](_0x5e7b('0x1f'),_0x5e7b('0x26'),_0x5e7b('0x8a'),util[_0x5e7b('0xc0')](_0x10cb14[_0x5e7b('0x55')],{'showHidden':![],'depth':null}));}break;case _0x5e7b('0x8b'):if(_0x2e3d9c==='DELIVRD'||_0x2e3d9c===_0x5e7b('0xce')){return _0x25e697[_0x5e7b('0x2f')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5e7b('0x26'),_0x5e7b('0x8b'),util[_0x5e7b('0xc0')](_0x10cb14[_0x5e7b('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x25e697;}})['then'](respondWithResult(_0x4636e2,null))[_0x5e7b('0x4e')](handleError(_0x4636e2,null));};exports[_0x5e7b('0xcf')]=function(_0x2d7e8a,_0x108be1,_0x4a1b9f){var _0x1dcc8b,_0x34eae0,_0x3b647e;return db[_0x5e7b('0x39')][_0x5e7b('0x53')]({'where':{'id':_0x2d7e8a['params']['id']}})[_0x5e7b('0x1a')](handleEntityNotFound(_0x108be1,null))['then'](function(_0x4da76e){if(_0x4da76e){_0x3b647e=_0x4da76e;logger[_0x5e7b('0x1e')](_0x5e7b('0x1f'),_0x5e7b('0x26'),_0x5e7b('0xbf'),_0x4da76e[_0x5e7b('0x3a')],util[_0x5e7b('0xc0')](_0x2d7e8a[_0x5e7b('0x3c')],{'showHidden':![],'depth':null}));switch(_0x4da76e[_0x5e7b('0x3a')]){case'csc':if(_0x2d7e8a[_0x5e7b('0x3c')][_0x5e7b('0xd0')]&&_0x2d7e8a[_0x5e7b('0x3c')][_0x5e7b('0xd1')]){_0x34eae0=_0x2d7e8a[_0x5e7b('0x3c')][_0x5e7b('0xd1')];return db[_0x5e7b('0x9d')][_0x5e7b('0x53')]({'where':{'messageId':_0x2d7e8a[_0x5e7b('0x3c')][_0x5e7b('0xd0')]}});}break;}}})['then'](handleEntityNotFound(_0x108be1,null))[_0x5e7b('0x1a')](function(_0x5c40f4){if(_0x5c40f4){_0x1dcc8b=_0x5c40f4;switch(_0x3b647e[_0x5e7b('0x3a')]){case'csc':if(_0x34eae0==='2'||_0x34eae0==='6'){return _0x1dcc8b[_0x5e7b('0x2f')]({'read':!![]});}else{logger[_0x5e7b('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5e7b('0x26'),_0x5e7b('0x87'),util[_0x5e7b('0xc0')](_0x2d7e8a[_0x5e7b('0x3c')],{'showHidden':![],'depth':null}));};break;}return _0x1dcc8b;}})['then'](respondWithResult(_0x108be1,null))['catch'](handleError(_0x108be1,null));};exports['addAgents']=function(_0x50099e,_0xe7e7df,_0x3e0654){return db['SmsAccount'][_0x5e7b('0x53')]({'where':{'id':_0x50099e[_0x5e7b('0x50')]['id']}})[_0x5e7b('0x1a')](handleEntityNotFound(_0xe7e7df,null))['then'](function(_0x4f0ed4){if(_0x4f0ed4){return _0x4f0ed4[_0x5e7b('0xd2')](_0x50099e[_0x5e7b('0x55')]['ids'],_[_0x5e7b('0xd3')](_0x50099e['body'],[_0x5e7b('0x64'),'id'])||{})[_0x5e7b('0x96')](function(_0x507e85){for(var _0x572a24=0x0;_0x572a24<_0x50099e[_0x5e7b('0x55')][_0x5e7b('0x64')][_0x5e7b('0x43')];_0x572a24+=0x1){socket[_0x5e7b('0xd4')](_0x5e7b('0xd5'),{'UserId':Number(_0x50099e[_0x5e7b('0x55')][_0x5e7b('0x64')][_0x572a24]),'SmsAccountId':Number(_0x50099e['params']['id'])});}return _0x507e85;});}})[_0x5e7b('0x1a')](respondWithResult(_0xe7e7df,null))['catch'](handleError(_0xe7e7df,null));};exports[_0x5e7b('0xd6')]=function(_0x48b9a7,_0x29e097,_0x3185f3){return db['SmsAccount'][_0x5e7b('0x53')]({'where':{'id':_0x48b9a7['params']['id']}})['then'](handleEntityNotFound(_0x29e097,null))[_0x5e7b('0x1a')](function(_0x13922d){if(_0x13922d){return _0x13922d[_0x5e7b('0xd6')](_0x48b9a7[_0x5e7b('0x3c')][_0x5e7b('0x64')])[_0x5e7b('0x1a')](function(){if(_[_0x5e7b('0xd7')](_0x48b9a7['query'][_0x5e7b('0x64')])){for(var _0x42d650=0x0;_0x42d650<_0x48b9a7[_0x5e7b('0x3c')][_0x5e7b('0x64')][_0x5e7b('0x43')];_0x42d650+=0x1){socket[_0x5e7b('0xd4')]('userSmsAccount:remove',{'UserId':Number(_0x48b9a7['query'][_0x5e7b('0x64')][_0x42d650]),'SmsAccountId':Number(_0x48b9a7['params']['id'])});}}else{socket[_0x5e7b('0xd4')](_0x5e7b('0xd8'),{'UserId':Number(_0x48b9a7['query'][_0x5e7b('0x64')]),'SmsAccountId':Number(_0x48b9a7[_0x5e7b('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x29e097,null))['catch'](handleError(_0x29e097,null));};exports[_0x5e7b('0xd9')]=function(_0x5510fa,_0x26ebe7,_0x4307a6){var _0x3f569c={};var _0x3da710={};var _0x580647;var _0x2ebfc8;return db[_0x5e7b('0x39')]['findOne']({'where':{'id':_0x5510fa[_0x5e7b('0x50')]['id']}})[_0x5e7b('0x1a')](handleEntityNotFound(_0x26ebe7,null))[_0x5e7b('0x1a')](function(_0x556e21){if(_0x556e21){_0x580647=_0x556e21;_0x3da710[_0x5e7b('0x40')]=_[_0x5e7b('0x3d')](db['User']['rawAttributes']);_0x3da710[_0x5e7b('0x3c')]=_[_0x5e7b('0x3d')](_0x5510fa[_0x5e7b('0x3c')]);_0x3da710[_0x5e7b('0x3e')]=_[_0x5e7b('0x3f')](_0x3da710['model'],_0x3da710[_0x5e7b('0x3c')]);_0x3f569c['attributes']=_[_0x5e7b('0x3f')](_0x3da710[_0x5e7b('0x40')],qs['fields'](_0x5510fa[_0x5e7b('0x3c')][_0x5e7b('0x41')]));_0x3f569c[_0x5e7b('0x42')]=_0x3f569c['attributes'][_0x5e7b('0x43')]?_0x3f569c[_0x5e7b('0x42')]:_0x3da710[_0x5e7b('0x40')];_0x3f569c[_0x5e7b('0x46')]=qs[_0x5e7b('0x47')](_0x5510fa[_0x5e7b('0x3c')][_0x5e7b('0x47')]);_0x3f569c['where']=qs['filters'](_[_0x5e7b('0x60')](_0x5510fa[_0x5e7b('0x3c')],_0x3da710[_0x5e7b('0x3e')]));if(_0x5510fa['query'][_0x5e7b('0x48')]){_0x3f569c['where']=_[_0x5e7b('0x4a')](_0x3f569c[_0x5e7b('0x49')],{'$or':_[_0x5e7b('0x38')](_0x3f569c[_0x5e7b('0x42')],function(_0x4d296b){var _0x4f6582={};_0x4f6582[_0x4d296b]={'$like':'%'+_0x5510fa[_0x5e7b('0x3c')][_0x5e7b('0x48')]+'%'};return _0x4f6582;})});}_0x3f569c=_['merge']({},_0x3f569c,_0x5510fa[_0x5e7b('0x61')]);return _0x580647['getAgents'](_0x3f569c);}})[_0x5e7b('0x1a')](function(_0x57cf74){if(_0x57cf74){_0x2ebfc8=_0x57cf74[_0x5e7b('0x43')];if(!_0x5510fa[_0x5e7b('0x3c')][_0x5e7b('0x44')](_0x5e7b('0x45'))){_0x3f569c[_0x5e7b('0x28')]=qs[_0x5e7b('0x28')](_0x5510fa[_0x5e7b('0x3c')]['limit']);_0x3f569c[_0x5e7b('0x2a')]=qs[_0x5e7b('0x2a')](_0x5510fa['query'][_0x5e7b('0x2a')]);}return _0x580647[_0x5e7b('0xd9')](_0x3f569c);}})[_0x5e7b('0x1a')](function(_0x2af304){if(_0x2af304){return _0x2af304?{'count':_0x2ebfc8,'rows':_0x2af304}:null;}})['then'](respondWithResult(_0x26ebe7,null))[_0x5e7b('0x4e')](handleError(_0x26ebe7,null));}; \ No newline at end of file +var _0x593d=['mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','list','omit','Contacts','SmsInteraction','interaction','created','autoclose','push','unmanaged','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','entity\x20found','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','bulkCreate','finally','getApplications','getInteractions','Contact','Owner','fullname','Tag','tag','to\x20is\x20mandatory','List','DESC','out','SmsMessage','Messages','spread','dataValues','debug','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsAccount.socket','jayson/promise','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','save','update','destroy','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','includeAll','include','SmsAccount','findAll','rows','show','params','options','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','create','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','order','pick','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','applications','priority','asc','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','difference','CompanyId','ListId','mobile','type','twilio','From','Body','messageId','MessageSid','skebby','sender','connectel','from','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','clickatell','fromNumber','text','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes'];(function(_0x41355f,_0xecbc5){var _0x42329a=function(_0x376150){while(--_0x376150){_0x41355f['push'](_0x41355f['shift']());}};_0x42329a(++_0xecbc5);}(_0x593d,0x129));var _0xd593=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x593d[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0xd593('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd593('0x1'));var jsonpatch=require(_0xd593('0x2'));var rp=require(_0xd593('0x3'));var moment=require(_0xd593('0x4'));var BPromise=require(_0xd593('0x5'));var Mustache=require(_0xd593('0x6'));var util=require(_0xd593('0x7'));var path=require(_0xd593('0x8'));var sox=require(_0xd593('0x9'));var csv=require(_0xd593('0xa'));var ejs=require(_0xd593('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd593('0xc'));var squel=require('squel');var crypto=require(_0xd593('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd593('0xe'));var toCsv=require(_0xd593('0xa'));var querystring=require(_0xd593('0xf'));var Papa=require(_0xd593('0x10'));var Redis=require('ioredis');var authService=require(_0xd593('0x11'));var qs=require(_0xd593('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd593('0x13'));var logger=require('../../config/logger')(_0xd593('0x14'));var utils=require(_0xd593('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd593('0x16'));var db=require(_0xd593('0x17'))['db'];config[_0xd593('0x18')]=_[_0xd593('0x19')](config[_0xd593('0x18')],{'host':_0xd593('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd593('0x18')]));require(_0xd593('0x1b'))['register'](socket);var jayson=require(_0xd593('0x1c'));var client=jayson['client'][_0xd593('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x4f368f,_0x17d37e,_0x160bc5,_0x557d56){return new BPromise(function(_0x4fd233,_0x313a23){var _0x4f9bf5=_0x557d56||client;return _0x4f9bf5[_0xd593('0x1e')](_0x4f368f,_0x160bc5)[_0xd593('0x1f')](function(_0x41cff9){logger[_0xd593('0x20')](_0xd593('0x21'),_0x17d37e,_0xd593('0x22'));logger['debug'](_0xd593('0x23'),_0x17d37e,_0xd593('0x22'),JSON[_0xd593('0x24')](_0x41cff9));if(_0x41cff9[_0xd593('0x25')]){if(_0x41cff9[_0xd593('0x25')]['code']===0x1f4){logger[_0xd593('0x25')]('SmsAccount,\x20%s,\x20%s',_0x17d37e,_0x41cff9[_0xd593('0x25')]['message']);return _0x313a23(_0x41cff9['error'][_0xd593('0x26')]);}logger[_0xd593('0x25')](_0xd593('0x21'),_0x17d37e,_0x41cff9[_0xd593('0x25')][_0xd593('0x26')]);return _0x4fd233(_0x41cff9[_0xd593('0x25')][_0xd593('0x26')]);}else{logger[_0xd593('0x20')]('SmsAccount,\x20%s,\x20%s',_0x17d37e,_0xd593('0x22'));_0x4fd233(_0x41cff9[_0xd593('0x27')][_0xd593('0x26')]);}})[_0xd593('0x28')](function(_0x54b00e){logger[_0xd593('0x25')](_0xd593('0x21'),_0x17d37e,_0x54b00e);_0x313a23(_0x54b00e);});});}function respondWithStatusCode(_0x19f775,_0x7ab639){_0x7ab639=_0x7ab639||0xcc;return function(_0x304554){if(_0x304554){return _0x19f775[_0xd593('0x29')](_0x7ab639);}return _0x19f775[_0xd593('0x2a')](_0x7ab639)[_0xd593('0x2b')]();};}function respondWithResult(_0x5c6586,_0x18c1a4){_0x18c1a4=_0x18c1a4||0xc8;return function(_0x2ef917){if(_0x2ef917){return _0x5c6586['status'](_0x18c1a4)[_0xd593('0x2c')](_0x2ef917);}};}function respondWithFilteredResult(_0x5250b5,_0x4b22da){return function(_0x956317){if(_0x956317){var _0x4c3626=typeof _0x4b22da['offset']===_0xd593('0x2d')&&typeof _0x4b22da['limit']==='undefined';var _0x1482d5=_0x956317[_0xd593('0x2e')];var _0x4ee34f=_0x4c3626?0x0:_0x4b22da[_0xd593('0x2f')];var _0x409942=_0x4c3626?_0x956317[_0xd593('0x2e')]:_0x4b22da[_0xd593('0x2f')]+_0x4b22da[_0xd593('0x30')];var _0x752c8d;if(_0x409942>=_0x1482d5){_0x409942=_0x1482d5;_0x752c8d=0xc8;}else{_0x752c8d=0xce;}_0x5250b5['status'](_0x752c8d);return _0x5250b5[_0xd593('0x31')]('Content-Range',_0x4ee34f+'-'+_0x409942+'/'+_0x1482d5)[_0xd593('0x2c')](_0x956317);}return null;};}function patchUpdates(_0x2a11a0){return function(_0x2bed89){try{jsonpatch[_0xd593('0x32')](_0x2bed89,_0x2a11a0,!![]);}catch(_0x22536b){return BPromise[_0xd593('0x33')](_0x22536b);}return _0x2bed89[_0xd593('0x34')]();};}function saveUpdates(_0x2260af,_0x2c06dd){return function(_0x55812f){if(_0x55812f){return _0x55812f[_0xd593('0x35')](_0x2260af)['then'](function(_0x4cfd58){return _0x4cfd58;});}return null;};}function removeEntity(_0x31a232,_0x2b0298){return function(_0x580f9f){if(_0x580f9f){return _0x580f9f[_0xd593('0x36')]()[_0xd593('0x1f')](function(){var _0x271f6=_0x580f9f['get']({'plain':!![]});var _0x29f8c6=_0xd593('0x37');return db['UserProfileResource'][_0xd593('0x36')]({'where':{'type':_0x29f8c6,'resourceId':_0x271f6['id']}})['then'](function(){return _0x580f9f;});})[_0xd593('0x1f')](function(){_0x31a232[_0xd593('0x2a')](0xcc)[_0xd593('0x2b')]();});}};}function handleEntityNotFound(_0x186ced,_0x9d0beb){return function(_0x50ec9e){if(!_0x50ec9e){_0x186ced['sendStatus'](0x194);}return _0x50ec9e;};}function handleError(_0x57e09c,_0x2b887d){_0x2b887d=_0x2b887d||0x1f4;return function(_0xd9840b){logger[_0xd593('0x25')](_0xd9840b[_0xd593('0x38')]);if(_0xd9840b[_0xd593('0x39')]){delete _0xd9840b[_0xd593('0x39')];}_0x57e09c[_0xd593('0x2a')](_0x2b887d)[_0xd593('0x3a')](_0xd9840b);};}exports[_0xd593('0x3b')]=function(_0xf18b7f,_0xff97aa){var _0x20d949={'include':[{'model':db[_0xd593('0x3c')],'as':_0xd593('0x3d')}]},_0x19bd20={},_0x16cb46={'count':0x0,'rows':[]};var _0xe11228=_['map'](db['SmsAccount'][_0xd593('0x3e')],function(_0x19e47f){return{'name':_0x19e47f['fieldName'],'type':_0x19e47f['type'][_0xd593('0x3f')]};});_0x19bd20[_0xd593('0x40')]=_[_0xd593('0x41')](_0xe11228,_0xd593('0x39'));_0x19bd20[_0xd593('0x42')]=_[_0xd593('0x43')](_0xf18b7f[_0xd593('0x42')]);_0x19bd20[_0xd593('0x44')]=_[_0xd593('0x45')](_0x19bd20[_0xd593('0x40')],_0x19bd20['query']);_0x20d949[_0xd593('0x46')]=_[_0xd593('0x45')](_0x19bd20[_0xd593('0x40')],qs[_0xd593('0x47')](_0xf18b7f[_0xd593('0x42')][_0xd593('0x47')]));_0x20d949[_0xd593('0x46')]=_0x20d949[_0xd593('0x46')][_0xd593('0x48')]?_0x20d949[_0xd593('0x46')]:_0x19bd20['model'];if(!_0xf18b7f[_0xd593('0x42')][_0xd593('0x49')]('nolimit')){_0x20d949['limit']=qs[_0xd593('0x30')](_0xf18b7f[_0xd593('0x42')][_0xd593('0x30')]);_0x20d949['offset']=qs[_0xd593('0x2f')](_0xf18b7f['query'][_0xd593('0x2f')]);}_0x20d949['order']=qs[_0xd593('0x4a')](_0xf18b7f[_0xd593('0x42')][_0xd593('0x4a')]);_0x20d949[_0xd593('0x4b')]=qs[_0xd593('0x44')](_['pick'](_0xf18b7f[_0xd593('0x42')],_0x19bd20[_0xd593('0x44')]),_0xe11228);if(_0xf18b7f['query'][_0xd593('0x4c')]){_0x20d949['where']=_[_0xd593('0x4d')](_0x20d949[_0xd593('0x4b')],{'$or':_[_0xd593('0x41')](_0xe11228,function(_0x38ad8f){if(_0x38ad8f['type']!==_0xd593('0x4e')){var _0x2a27e9={};_0x2a27e9[_0x38ad8f[_0xd593('0x39')]]={'$like':'%'+_0xf18b7f[_0xd593('0x42')][_0xd593('0x4c')]+'%'};return _0x2a27e9;}})});}_0x20d949=_['merge']({},_0x20d949,_0xf18b7f['options']);var _0x584a1f={'where':_0x20d949[_0xd593('0x4b')]};return db['SmsAccount'][_0xd593('0x2e')](_0x584a1f)[_0xd593('0x1f')](function(_0x21b9d3){_0x16cb46[_0xd593('0x2e')]=_0x21b9d3;if(_0xf18b7f[_0xd593('0x42')][_0xd593('0x4f')]){_0x20d949[_0xd593('0x50')]=[{'all':!![]}];}return db[_0xd593('0x51')][_0xd593('0x52')](_0x20d949);})[_0xd593('0x1f')](function(_0x5ab0d7){_0x16cb46[_0xd593('0x53')]=_0x5ab0d7;return _0x16cb46;})[_0xd593('0x1f')](respondWithFilteredResult(_0xff97aa,_0x20d949))[_0xd593('0x28')](handleError(_0xff97aa,null));};exports[_0xd593('0x54')]=function(_0x61cbce,_0x54f1a5){var _0x183995={'raw':![],'where':{'id':_0x61cbce[_0xd593('0x55')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x29aaf8={};_0x29aaf8['model']=_['keys'](db['SmsAccount'][_0xd593('0x3e')]);_0x29aaf8[_0xd593('0x42')]=_[_0xd593('0x43')](_0x61cbce[_0xd593('0x42')]);_0x29aaf8[_0xd593('0x44')]=_[_0xd593('0x45')](_0x29aaf8[_0xd593('0x40')],_0x29aaf8[_0xd593('0x42')]);_0x183995[_0xd593('0x46')]=_[_0xd593('0x45')](_0x29aaf8['model'],qs[_0xd593('0x47')](_0x61cbce[_0xd593('0x42')][_0xd593('0x47')]));_0x183995['attributes']=_0x183995[_0xd593('0x46')]['length']?_0x183995[_0xd593('0x46')]:_0x29aaf8[_0xd593('0x40')];if(_0x61cbce[_0xd593('0x42')][_0xd593('0x4f')]){_0x183995[_0xd593('0x50')]=[{'all':!![]}];}_0x183995=_[_0xd593('0x4d')]({},_0x183995,_0x61cbce[_0xd593('0x56')]);return db[_0xd593('0x51')]['find'](_0x183995)[_0xd593('0x1f')](handleEntityNotFound(_0x54f1a5,null))[_0xd593('0x1f')](respondWithResult(_0x54f1a5,null))[_0xd593('0x28')](handleError(_0x54f1a5,null));};exports['create']=function(_0x4bd395,_0x1cedc8){return db[_0xd593('0x51')]['create'](_0x4bd395['body'],{})[_0xd593('0x1f')](function(_0x538674){var _0x1bc61e=_0x4bd395[_0xd593('0x57')][_0xd593('0x58')]({'plain':!![]});if(!_0x1bc61e)throw new Error(_0xd593('0x59'));if(_0x1bc61e[_0xd593('0x5a')]===_0xd593('0x57')){var _0x3820e4=_0x538674[_0xd593('0x58')]({'plain':!![]});var _0x297179=_0xd593('0x37');return db[_0xd593('0x5b')][_0xd593('0x5c')]({'where':{'name':_0x297179,'userProfileId':_0x1bc61e['userProfileId']},'raw':!![]})[_0xd593('0x1f')](function(_0x442cf6){if(_0x442cf6&&_0x442cf6[_0xd593('0x5d')]===0x0){return db['UserProfileResource'][_0xd593('0x5e')]({'name':_0x3820e4['name'],'resourceId':_0x3820e4['id'],'type':_0x442cf6[_0xd593('0x39')],'sectionId':_0x442cf6['id']},{})[_0xd593('0x1f')](function(){return _0x538674;});}else{return _0x538674;}})[_0xd593('0x28')](function(_0x2b429d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b429d);throw _0x2b429d;});}return _0x538674;})[_0xd593('0x1f')](respondWithResult(_0x1cedc8,0xc9))['catch'](handleError(_0x1cedc8,null));};exports[_0xd593('0x35')]=function(_0x518527,_0x5d7f30){if(_0x518527[_0xd593('0x5f')]['id']){delete _0x518527[_0xd593('0x5f')]['id'];}return db[_0xd593('0x51')][_0xd593('0x5c')]({'where':{'id':_0x518527[_0xd593('0x55')]['id']},'include':[{'model':db[_0xd593('0x3c')],'as':_0xd593('0x3d')}]})['then'](handleEntityNotFound(_0x5d7f30,null))[_0xd593('0x1f')](saveUpdates(_0x518527[_0xd593('0x5f')],null))[_0xd593('0x1f')](respondWithResult(_0x5d7f30,null))[_0xd593('0x28')](handleError(_0x5d7f30,null));};exports[_0xd593('0x36')]=function(_0x4357a4,_0x557b91){return db['SmsAccount'][_0xd593('0x5c')]({'where':{'id':_0x4357a4['params']['id']}})['then'](handleEntityNotFound(_0x557b91,null))['then'](removeEntity(_0x557b91,null))[_0xd593('0x28')](handleError(_0x557b91,null));};exports[_0xd593('0x60')]=function(_0x4edc16,_0x55b3db){return db[_0xd593('0x51')][_0xd593('0x60')]()[_0xd593('0x1f')](respondWithResult(_0x55b3db,null))['catch'](handleError(_0x55b3db,null));};exports[_0xd593('0x61')]=function(_0x36056c,_0x603f0c,_0x57a6b5){if(_0x36056c[_0xd593('0x5f')]['id']){delete _0x36056c['body']['id'];}return db[_0xd593('0x51')][_0xd593('0x5c')]({'where':{'id':_0x36056c[_0xd593('0x55')]['id']}})['then'](handleEntityNotFound(_0x603f0c,null))[_0xd593('0x1f')](function(_0x3b9486){if(_0x3b9486){_0x36056c['body'][_0xd593('0x62')]=_0x3b9486['id'];return db[_0xd593('0x63')][_0xd593('0x5e')](_0x36056c[_0xd593('0x5f')]);}})[_0xd593('0x1f')](respondWithResult(_0x603f0c,null))[_0xd593('0x28')](handleError(_0x603f0c,null));};exports[_0xd593('0x64')]=function(_0x502151,_0x1c54e4,_0x436278){var _0x4d6e8d={'raw':![],'where':{}};var _0x4680f5={};var _0x286f61={'count':0x0,'rows':[]};return db[_0xd593('0x51')][_0xd593('0x65')]({'where':{'id':_0x502151[_0xd593('0x55')]['id']}})['then'](handleEntityNotFound(_0x1c54e4,null))[_0xd593('0x1f')](function(_0x29d300){if(_0x29d300){_0x4680f5[_0xd593('0x40')]=_[_0xd593('0x43')](db[_0xd593('0x63')]['rawAttributes']);_0x4680f5[_0xd593('0x42')]=_['keys'](_0x502151['query']);_0x4680f5['filters']=_[_0xd593('0x45')](_0x4680f5[_0xd593('0x40')],_0x4680f5[_0xd593('0x42')]);_0x4d6e8d[_0xd593('0x46')]=_[_0xd593('0x45')](_0x4680f5[_0xd593('0x40')],qs['fields'](_0x502151[_0xd593('0x42')][_0xd593('0x47')]));_0x4d6e8d[_0xd593('0x46')]=_0x4d6e8d['attributes'][_0xd593('0x48')]?_0x4d6e8d[_0xd593('0x46')]:_0x4680f5[_0xd593('0x40')];if(!_0x502151[_0xd593('0x42')]['hasOwnProperty'](_0xd593('0x66'))){_0x4d6e8d[_0xd593('0x30')]=qs[_0xd593('0x30')](_0x502151['query'][_0xd593('0x30')]);_0x4d6e8d[_0xd593('0x2f')]=qs[_0xd593('0x2f')](_0x502151[_0xd593('0x42')][_0xd593('0x2f')]);}_0x4d6e8d[_0xd593('0x67')]=qs[_0xd593('0x4a')](_0x502151[_0xd593('0x42')][_0xd593('0x4a')]);_0x4d6e8d[_0xd593('0x4b')]=qs[_0xd593('0x44')](_[_0xd593('0x68')](_0x502151[_0xd593('0x42')],_0x4680f5[_0xd593('0x44')]));_0x4d6e8d['where'][_0xd593('0x62')]=_0x29d300['id'];if(_0x502151['query'][_0xd593('0x4c')]){_0x4d6e8d[_0xd593('0x4b')]=_[_0xd593('0x4d')](_0x4d6e8d[_0xd593('0x4b')],{'$or':_[_0xd593('0x41')](_0x4d6e8d[_0xd593('0x46')],function(_0x512bd4){var _0x153d8a={};_0x153d8a[_0x512bd4]={'$like':'%'+_0x502151[_0xd593('0x42')][_0xd593('0x4c')]+'%'};return _0x153d8a;})});}_0x4d6e8d=_[_0xd593('0x4d')]({},_0x4d6e8d,_0x502151[_0xd593('0x56')]);return db[_0xd593('0x63')][_0xd593('0x2e')]({'where':_0x4d6e8d['where']})[_0xd593('0x1f')](function(_0x3e537e){_0x286f61[_0xd593('0x2e')]=_0x3e537e;if(_0x502151[_0xd593('0x42')][_0xd593('0x4f')]){_0x4d6e8d[_0xd593('0x50')]=[{'all':!![]}];}return db[_0xd593('0x63')]['findAll'](_0x4d6e8d);})[_0xd593('0x1f')](function(_0x2d203b){_0x286f61['rows']=_0x2d203b;return _0x286f61;});}})[_0xd593('0x1f')](respondWithFilteredResult(_0x1c54e4,_0x4d6e8d))[_0xd593('0x28')](handleError(_0x1c54e4,null));};exports[_0xd593('0x69')]=function(_0x1137fd,_0x30b277,_0x2c7d2f){return db[_0xd593('0x51')][_0xd593('0x5c')]({'where':{'id':_0x1137fd[_0xd593('0x55')]['id']}})[_0xd593('0x1f')](handleEntityNotFound(_0x30b277,null))['then'](function(_0x5713f3){if(_0x5713f3){return _0x5713f3[_0xd593('0x69')](_0x1137fd[_0xd593('0x42')][_0xd593('0x6a')]);}})[_0xd593('0x1f')](respondWithStatusCode(_0x30b277,null))[_0xd593('0x28')](handleError(_0x30b277,null));};exports['addAnswer']=function(_0x1e5210,_0x285dac,_0x760c8e){if(_0x1e5210[_0xd593('0x5f')]['id']){delete _0x1e5210[_0xd593('0x5f')]['id'];}return db['SmsAccount'][_0xd593('0x5c')]({'where':{'id':_0x1e5210[_0xd593('0x55')]['id']}})['then'](handleEntityNotFound(_0x285dac,null))[_0xd593('0x1f')](function(_0x1777f5){if(_0x1777f5){_0x1e5210[_0xd593('0x5f')][_0xd593('0x62')]=_0x1777f5['id'];return db[_0xd593('0x6b')][_0xd593('0x5e')](_0x1e5210[_0xd593('0x5f')]);}})[_0xd593('0x1f')](respondWithResult(_0x285dac,null))[_0xd593('0x28')](handleError(_0x285dac,null));};exports[_0xd593('0x6c')]=function(_0x1169b1,_0x53beb7,_0x23ef77){var _0xb2f060={'raw':![],'where':{}};var _0x282c03={};var _0x1b2713={'count':0x0,'rows':[]};return db[_0xd593('0x51')][_0xd593('0x65')]({'where':{'id':_0x1169b1[_0xd593('0x55')]['id']}})['then'](handleEntityNotFound(_0x53beb7,null))[_0xd593('0x1f')](function(_0x12791a){if(_0x12791a){_0x282c03['model']=_['keys'](db['CannedAnswer']['rawAttributes']);_0x282c03[_0xd593('0x42')]=_['keys'](_0x1169b1[_0xd593('0x42')]);_0x282c03[_0xd593('0x44')]=_[_0xd593('0x45')](_0x282c03[_0xd593('0x40')],_0x282c03['query']);_0xb2f060[_0xd593('0x46')]=_[_0xd593('0x45')](_0x282c03[_0xd593('0x40')],qs['fields'](_0x1169b1[_0xd593('0x42')][_0xd593('0x47')]));_0xb2f060['attributes']=_0xb2f060['attributes']['length']?_0xb2f060['attributes']:_0x282c03[_0xd593('0x40')];if(!_0x1169b1[_0xd593('0x42')][_0xd593('0x49')](_0xd593('0x66'))){_0xb2f060[_0xd593('0x30')]=qs[_0xd593('0x30')](_0x1169b1[_0xd593('0x42')]['limit']);_0xb2f060[_0xd593('0x2f')]=qs[_0xd593('0x2f')](_0x1169b1[_0xd593('0x42')][_0xd593('0x2f')]);}_0xb2f060[_0xd593('0x67')]=qs['sort'](_0x1169b1[_0xd593('0x42')][_0xd593('0x4a')]);_0xb2f060[_0xd593('0x4b')]=qs[_0xd593('0x44')](_[_0xd593('0x68')](_0x1169b1[_0xd593('0x42')],_0x282c03[_0xd593('0x44')]));_0xb2f060[_0xd593('0x4b')]['SmsAccountId']=_0x12791a['id'];if(_0x1169b1[_0xd593('0x42')][_0xd593('0x4c')]){_0xb2f060['where']=_['merge'](_0xb2f060[_0xd593('0x4b')],{'$or':_['map'](_0xb2f060[_0xd593('0x46')],function(_0x204a5a){var _0x428673={};_0x428673[_0x204a5a]={'$like':'%'+_0x1169b1['query']['filter']+'%'};return _0x428673;})});}_0xb2f060=_[_0xd593('0x4d')]({},_0xb2f060,_0x1169b1['options']);return db[_0xd593('0x6b')][_0xd593('0x2e')]({'where':_0xb2f060[_0xd593('0x4b')]})[_0xd593('0x1f')](function(_0x23c842){_0x1b2713[_0xd593('0x2e')]=_0x23c842;if(_0x1169b1[_0xd593('0x42')][_0xd593('0x4f')]){_0xb2f060[_0xd593('0x50')]=[{'all':!![]}];}return db['CannedAnswer'][_0xd593('0x52')](_0xb2f060);})[_0xd593('0x1f')](function(_0x40ba30){_0x1b2713[_0xd593('0x53')]=_0x40ba30;return _0x1b2713;});}})['then'](respondWithFilteredResult(_0x53beb7,_0xb2f060))[_0xd593('0x28')](handleError(_0x53beb7,null));};exports[_0xd593('0x6d')]=function(_0x56b50c,_0x46186c,_0x2247d1){return db[_0xd593('0x51')]['find']({'where':{'id':_0x56b50c['params']['id']}})['then'](handleEntityNotFound(_0x46186c,null))['then'](function(_0x46a278){if(_0x46a278){return _0x46a278[_0xd593('0x6d')](_0x56b50c[_0xd593('0x42')][_0xd593('0x6a')]);}})[_0xd593('0x1f')](respondWithStatusCode(_0x46186c,null))['catch'](handleError(_0x46186c,null));};exports[_0xd593('0x6e')]=function(_0x29c588,_0x2981df,_0x2714d2){var _0x1cba26={'channel':_0xd593('0x6f')};var _0x30e7f3=[];var _0x9d543e=[];var _0x593544={};return db[_0xd593('0x51')][_0xd593('0x5c')]({'where':{'id':_0x29c588['params']['id']},'include':[{'model':db[_0xd593('0x70')],'as':_0xd593('0x71')}]})[_0xd593('0x1f')](handleEntityNotFound(_0x2981df,null))[_0xd593('0x1f')](function(_0x4be877){_0x1cba26['account']=_0x4be877;_0x1cba26[_0xd593('0x72')]=_['orderBy'](_0x4be877[_0xd593('0x71')],[_0xd593('0x73')],[_0xd593('0x74')]);if(_0x1cba26['account']['Applications']){delete _0x1cba26[_0xd593('0x75')][_0xd593('0x71')];}return db[_0xd593('0x76')][_0xd593('0x60')]();})[_0xd593('0x1f')](function(_0x1c4cfc){if(!_0x1c4cfc){throw new db[(_0xd593('0x77'))][(_0xd593('0x78'))](_0xd593('0x79'));}_0x30e7f3=_['difference'](_[_0xd593('0x43')](_0x1c4cfc),['createdAt',_0xd593('0x7a')]);_0x9d543e=_[_0xd593('0x7b')](_[_0xd593('0x43')](_0x1c4cfc),['createdAt','updatedAt',_0xd593('0x7c'),_0xd593('0x7d')]);_0x1cba26[_0xd593('0x5f')]={'mapKey':_0xd593('0x7e')};if(_0x1cba26[_0xd593('0x75')][_0xd593('0x7f')]){switch(_0x1cba26[_0xd593('0x75')]['type']){case _0xd593('0x80'):_0x1cba26[_0xd593('0x5f')]['from']=_0x29c588[_0xd593('0x5f')][_0xd593('0x81')];_0x1cba26[_0xd593('0x5f')]['body']=_0x29c588['body'][_0xd593('0x82')];_0x1cba26[_0xd593('0x5f')][_0xd593('0x83')]=_0x29c588['body'][_0xd593('0x84')];break;case _0xd593('0x85'):_0x1cba26[_0xd593('0x5f')]['from']='+'+_0x29c588[_0xd593('0x5f')][_0xd593('0x86')];_0x1cba26[_0xd593('0x5f')][_0xd593('0x5f')]=_0x29c588[_0xd593('0x5f')]['text'];break;case _0xd593('0x87'):_0x1cba26['body'][_0xd593('0x88')]=_0x29c588[_0xd593('0x5f')][_0xd593('0x88')];_0x1cba26[_0xd593('0x5f')][_0xd593('0x5f')]=_0x29c588[_0xd593('0x5f')][_0xd593('0x26')];break;case _0xd593('0x89'):_0x1cba26[_0xd593('0x5f')][_0xd593('0x88')]=_0x29c588['body'][_0xd593('0x88')];_0x1cba26[_0xd593('0x5f')][_0xd593('0x5f')]=_0x29c588[_0xd593('0x5f')][_0xd593('0x5f')];_0x1cba26[_0xd593('0x5f')][_0xd593('0x83')]=_0x29c588[_0xd593('0x5f')][_0xd593('0x8a')];break;case _0xd593('0x8b'):_0x1cba26[_0xd593('0x5f')][_0xd593('0x88')]=_0x29c588[_0xd593('0x5f')]['From'];_0x1cba26['body'][_0xd593('0x5f')]=_0x29c588[_0xd593('0x5f')][_0xd593('0x8c')];_0x1cba26['body'][_0xd593('0x83')]=_0x29c588[_0xd593('0x5f')][_0xd593('0x8d')];break;case _0xd593('0x8e'):_0x1cba26[_0xd593('0x5f')][_0xd593('0x88')]='+'+_0x29c588[_0xd593('0x5f')][_0xd593('0x8f')][0x0]['from'];_0x1cba26[_0xd593('0x5f')][_0xd593('0x5f')]=_0x29c588[_0xd593('0x5f')][_0xd593('0x8f')][0x0]['text'];_0x1cba26['body'][_0xd593('0x83')]=_0x29c588['body'][_0xd593('0x8f')][0x0][_0xd593('0x83')];break;case _0xd593('0x90'):_0x1cba26[_0xd593('0x5f')]['from']=_0x29c588[_0xd593('0x5f')][_0xd593('0x91')];_0x1cba26[_0xd593('0x5f')][_0xd593('0x5f')]=_0x29c588[_0xd593('0x5f')]['segmentedMessage']['message'];break;case _0xd593('0x92'):_0x1cba26[_0xd593('0x5f')][_0xd593('0x88')]=_0x29c588[_0xd593('0x5f')][_0xd593('0x93')];_0x1cba26[_0xd593('0x5f')][_0xd593('0x5f')]=_0x29c588[_0xd593('0x5f')][_0xd593('0x94')];_0x1cba26['body'][_0xd593('0x83')]=_0x29c588['body'][_0xd593('0x95')];break;case _0xd593('0x96'):_0x1cba26[_0xd593('0x5f')][_0xd593('0x83')]=_0x29c588['body'][0x0][_0xd593('0x26')]['id'];_0x1cba26[_0xd593('0x5f')]['from']=_0x29c588['body'][0x0]['message'][_0xd593('0x88')];_0x1cba26[_0xd593('0x5f')][_0xd593('0x5f')]=_0x29c588[_0xd593('0x5f')][0x0]['message'][_0xd593('0x94')];break;case _0xd593('0x97'):_0x1cba26[_0xd593('0x5f')][_0xd593('0x88')]=_0x29c588['body'][_0xd593('0x88')];_0x1cba26[_0xd593('0x5f')][_0xd593('0x5f')]=_0x29c588[_0xd593('0x5f')]['message'];_0x1cba26[_0xd593('0x5f')]['messageId']=_0x29c588[_0xd593('0x5f')][_0xd593('0x98')];break;}}if(_0x1cba26[_0xd593('0x5f')]['id']){delete _0x1cba26['body']['id'];}if(_[_0xd593('0x99')](_0x1cba26['body'][_0xd593('0x88')])){throw new db[(_0xd593('0x77'))][(_0xd593('0x78'))](_0xd593('0x9a'));}if(_[_0xd593('0x99')](_0x1cba26[_0xd593('0x5f')]['body'])||_0x1cba26[_0xd593('0x5f')][_0xd593('0x5f')]===''){throw new db[(_0xd593('0x77'))][(_0xd593('0x78'))](_0xd593('0x9b'));}if(_[_0xd593('0x99')](_0x1cba26[_0xd593('0x5f')][_0xd593('0x9c')])){throw new db[(_0xd593('0x77'))]['ValidationError'](_0xd593('0x9d')+_0x9d543e);}if(!_[_0xd593('0x9e')](_0x9d543e,_0x1cba26[_0xd593('0x5f')]['mapKey'])){throw new db[(_0xd593('0x77'))][(_0xd593('0x78'))](_0xd593('0x9f')+_0x9d543e);}_0x593544[_0x1cba26[_0xd593('0x5f')][_0xd593('0x9c')]]=_0x1cba26['body'][_0xd593('0x88')];return db[_0xd593('0xa0')][_0xd593('0x5c')]({'where':{'id':_0x1cba26['account'][_0xd593('0x7d')]},'include':[{'model':db[_0xd593('0x76')],'as':'Contacts','where':_0x593544,'limit':0x1,'order':[[_0xd593('0x7a'),'DESC']]}]});})['then'](handleEntityNotFound(_0x2981df,null))[_0xd593('0x1f')](function(_0x25b82b){if(_0x25b82b){_0x1cba26[_0xd593('0xa1')]=_[_0xd593('0xa2')](_0x25b82b,['Contacts']);if(_0x25b82b[_0xd593('0xa3')][_0xd593('0x48')]){return _0x25b82b[_0xd593('0xa3')][0x0];}var _0x44f2ba=_[_0xd593('0x19')](_0x1cba26['body'],{'firstName':_0x1cba26[_0xd593('0x5f')][_0xd593('0x88')],'ListId':_0x25b82b['id']});_0x44f2ba[_0x1cba26[_0xd593('0x5f')][_0xd593('0x9c')]]=_0x1cba26[_0xd593('0x5f')][_0xd593('0x88')];return db[_0xd593('0x76')]['create'](_0x44f2ba,{'fields':_0x30e7f3,'raw':!![]});}})[_0xd593('0x1f')](handleEntityNotFound(_0x2981df,null))[_0xd593('0x1f')](function(_0x46243d){if(_0x46243d){_0x1cba26['contact']=_0x46243d;var _0xd74fbd={'ContactId':_0x46243d['id'],'phone':_0x1cba26[_0xd593('0x5f')][_0xd593('0x88')],'SmsAccountId':_0x29c588[_0xd593('0x55')]['id']};var _0x379685={'ContactId':_0x46243d['id'],'SmsAccountId':_0x29c588[_0xd593('0x55')]['id'],'closed':![]};return db['SmsInteraction'][_0xd593('0x5c')]({'where':_0x379685})[_0xd593('0x1f')](function(_0x477e5c){if(_0x477e5c){return[_0x477e5c,![]];}return db[_0xd593('0xa4')][_0xd593('0x5e')](_0xd74fbd)[_0xd593('0x1f')](function(_0x3f0910){return[_0x3f0910,!![]];});});}})['spread'](function(_0x21bf78,_0x424b41){_0x1cba26[_0xd593('0xa5')]=_0x21bf78[_0xd593('0x58')]({'plain':!![]});_0x1cba26['interaction'][_0xd593('0xa6')]=![];if(_0x424b41){if(_0x1cba26[_0xd593('0x75')][_0xd593('0xa7')]){_0x1cba26['applications'][_0xd593('0xa8')]({'id':0x0,'priority':_0x1cba26[_0xd593('0x72')]['length']+0x1,'app':'close','appdata':_0xd593('0xa9'),'interval':'*,*,*,*'});}_0x1cba26[_0xd593('0xa5')]['created']=!![];}return db['SmsMessage'][_0xd593('0x5e')]({'phone':_0x1cba26['body'][_0xd593('0x88')],'messageId':_0x1cba26[_0xd593('0x5f')][_0xd593('0x83')],'body':_0x1cba26[_0xd593('0x5f')][_0xd593('0x5f')],'SmsAccountId':_0x29c588[_0xd593('0x55')]['id'],'SmsInteractionId':_0x21bf78['id'],'direction':'in','ContactId':_0x21bf78[_0xd593('0xaa')],'AttachmentId':_0x1cba26[_0xd593('0x5f')][_0xd593('0xab')]});})[_0xd593('0x1f')](function(_0x183749){_0x1cba26[_0xd593('0x26')]=_0x183749;if(_0x1cba26[_0xd593('0xa5')][_0xd593('0xac')]){return db[_0xd593('0xad')][_0xd593('0x5c')]({'attributes':['id','name'],'where':{'id':_0x1cba26['interaction']['UserId']}})[_0xd593('0x1f')](function(_0x1af44e){if(_0x1af44e){_0x1cba26[_0xd593('0x72')][_0xd593('0xae')]({'id':0x0,'priority':0x0,'app':_0xd593('0xaf'),'appdata':_0x1af44e[_0xd593('0x39')]+','+(_0x1cba26['account'][_0xd593('0xb0')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xd593('0xb1'),_0xd593('0xb2'),_0x1cba26);});}return respondWithRpcPromise(_0xd593('0xb1'),_0xd593('0xb2'),_0x1cba26);})['then'](function(_0x54a05b){if(_0x54a05b){var _0x4d7834=0xc8;var _0x3cf4a4='receiveMessage';logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3cf4a4,_0x4d7834,'entity\x20found');logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x3cf4a4,_0x4d7834,_0xd593('0xb3'),JSON['stringify'](_0x54a05b));if(_0x1cba26[_0xd593('0x75')][_0xd593('0x7f')]===_0xd593('0x80')){return _0x2981df['status'](_0x4d7834)[_0xd593('0x31')](_0xd593('0xb4'),_0xd593('0xb5'))[_0xd593('0x3a')](_0xd593('0xb6'));}else{return _0x2981df[_0xd593('0x2a')](_0x4d7834)[_0xd593('0x2c')](_0x54a05b);}}})[_0xd593('0x28')](handleError(_0x2981df,null));};exports[_0xd593('0xb7')]=function(_0x45fb39,_0x14874e){var _0x26ca68=_0x45fb39['params']['id'];var _0x5c44b3=_0x45fb39[_0xd593('0x5f')];var _0x14b4cd=0xc8;var _0x1f3dec=null;return db[_0xd593('0xb8')][_0xd593('0xb9')]({'isolationLevel':db[_0xd593('0xb8')]['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x41f4a5){return db[_0xd593('0x51')][_0xd593('0x65')]({'where':{'id':_0x26ca68},'transaction':_0x41f4a5})[_0xd593('0x1f')](function(_0xea1d00){if(_0xea1d00){return db[_0xd593('0x70')]['destroy']({'where':{'SmsAccountId':_0x26ca68},'transaction':_0x41f4a5})[_0xd593('0x1f')](function(){var _0x4000bd=_[_0xd593('0x41')](_0x5c44b3,function(_0x3aa70a){_0x3aa70a[_0xd593('0x62')]=_0x26ca68;return _0x3aa70a;});return db[_0xd593('0x70')][_0xd593('0xba')](_0x4000bd,{'transaction':_0x41f4a5});});}else{_0x14b4cd=0x194;_0x1f3dec=[];}});})[_0xd593('0x1f')](function(){if(_0x14b4cd!==0x194){return db[_0xd593('0x70')]['findAndCountAll']({'where':{'SmsAccountId':_0x26ca68},'order':_0xd593('0x73')})[_0xd593('0x1f')](function(_0x2d46bf){_0x1f3dec=_0x2d46bf;});}})['catch'](function(_0x3d79ee){_0x14b4cd=0x1f4;logger[_0xd593('0x25')](_0x3d79ee[_0xd593('0x38')]);if(_0x3d79ee['name']){delete _0x3d79ee[_0xd593('0x39')];}_0x1f3dec=_0x3d79ee;})[_0xd593('0xbb')](function(){if(_0x1f3dec===null){_0x14874e[_0xd593('0x29')](_0x14b4cd);}else{if(_0x14b4cd===0x1f4){_0x14874e[_0xd593('0x2a')](_0x14b4cd)['send'](_0x1f3dec);}else{_0x14874e[_0xd593('0x2a')](_0x14b4cd)[_0xd593('0x2c')](_0x1f3dec);}}});};exports[_0xd593('0xbc')]=function(_0x2a1f32,_0x21b117,_0x1c7e22){var _0x488034={};var _0x11e93f={};var _0xb6a39f;var _0x3deba3;return db['SmsAccount'][_0xd593('0x65')]({'where':{'id':_0x2a1f32['params']['id']}})[_0xd593('0x1f')](handleEntityNotFound(_0x21b117,null))['then'](function(_0x2a2605){if(_0x2a2605){_0xb6a39f=_0x2a2605;_0x11e93f[_0xd593('0x40')]=_['keys'](db[_0xd593('0x70')][_0xd593('0x3e')]);_0x11e93f['query']=_['keys'](_0x2a1f32[_0xd593('0x42')]);_0x11e93f[_0xd593('0x44')]=_['intersection'](_0x11e93f[_0xd593('0x40')],_0x11e93f['query']);_0x488034[_0xd593('0x46')]=_['intersection'](_0x11e93f[_0xd593('0x40')],qs['fields'](_0x2a1f32[_0xd593('0x42')][_0xd593('0x47')]));_0x488034[_0xd593('0x46')]=_0x488034[_0xd593('0x46')][_0xd593('0x48')]?_0x488034[_0xd593('0x46')]:_0x11e93f[_0xd593('0x40')];_0x488034[_0xd593('0x67')]=qs['sort'](_0x2a1f32[_0xd593('0x42')]['sort']);_0x488034[_0xd593('0x4b')]=qs['filters'](_[_0xd593('0x68')](_0x2a1f32[_0xd593('0x42')],_0x11e93f['filters']));if(_0x2a1f32[_0xd593('0x42')][_0xd593('0x4c')]){_0x488034[_0xd593('0x4b')]=_[_0xd593('0x4d')](_0x488034['where'],{'$or':_[_0xd593('0x41')](_0x488034[_0xd593('0x46')],function(_0x32d24a){var _0x57900b={};_0x57900b[_0x32d24a]={'$like':'%'+_0x2a1f32[_0xd593('0x42')][_0xd593('0x4c')]+'%'};return _0x57900b;})});}_0x488034=_[_0xd593('0x4d')]({},_0x488034,_0x2a1f32[_0xd593('0x56')]);return _0xb6a39f[_0xd593('0xbc')](_0x488034);}})['then'](function(_0x212177){if(_0x212177){_0x3deba3=_0x212177[_0xd593('0x48')];if(!_0x2a1f32[_0xd593('0x42')]['hasOwnProperty'](_0xd593('0x66'))){_0x488034[_0xd593('0x30')]=qs[_0xd593('0x30')](_0x2a1f32[_0xd593('0x42')][_0xd593('0x30')]);_0x488034['offset']=qs[_0xd593('0x2f')](_0x2a1f32[_0xd593('0x42')][_0xd593('0x2f')]);}return _0xb6a39f[_0xd593('0xbc')](_0x488034);}})[_0xd593('0x1f')](function(_0x451b90){if(_0x451b90){return _0x451b90?{'count':_0x3deba3,'rows':_0x451b90}:null;}})[_0xd593('0x1f')](respondWithResult(_0x21b117,null))[_0xd593('0x28')](handleError(_0x21b117,null));};exports[_0xd593('0xbd')]=function(_0x4eff5e,_0x1e738b,_0x5bd0ae){var _0x5da671={'raw':![],'where':{}};var _0xd82ae4={};var _0xe6f395={'count':0x0,'rows':[]};return db[_0xd593('0x51')]['findOne']({'where':{'id':_0x4eff5e[_0xd593('0x55')]['id']}})[_0xd593('0x1f')](handleEntityNotFound(_0x1e738b,null))[_0xd593('0x1f')](function(_0x3b8a00){if(_0x3b8a00){_0xd82ae4[_0xd593('0x40')]=_[_0xd593('0x43')](db[_0xd593('0xa4')]['rawAttributes']);_0xd82ae4[_0xd593('0x42')]=_[_0xd593('0x43')](_0x4eff5e[_0xd593('0x42')]);_0xd82ae4[_0xd593('0x44')]=_[_0xd593('0x45')](_0xd82ae4[_0xd593('0x40')],_0xd82ae4[_0xd593('0x42')]);_0x5da671['attributes']=_['intersection'](_0xd82ae4[_0xd593('0x40')],qs['fields'](_0x4eff5e['query'][_0xd593('0x47')]));_0x5da671[_0xd593('0x46')]=_0x5da671[_0xd593('0x46')][_0xd593('0x48')]?_0x5da671[_0xd593('0x46')]:_0xd82ae4['model'];if(!_0x4eff5e[_0xd593('0x42')]['hasOwnProperty'](_0xd593('0x66'))){_0x5da671[_0xd593('0x30')]=qs[_0xd593('0x30')](_0x4eff5e[_0xd593('0x42')][_0xd593('0x30')]);_0x5da671['offset']=qs[_0xd593('0x2f')](_0x4eff5e['query']['offset']);}_0x5da671['order']=qs[_0xd593('0x4a')](_0x4eff5e[_0xd593('0x42')][_0xd593('0x4a')]);_0x5da671['where']=qs['filters'](_[_0xd593('0x68')](_0x4eff5e['query'],_0xd82ae4['filters']));_0x5da671[_0xd593('0x4b')][_0xd593('0x62')]=_0x3b8a00['id'];if(_0x4eff5e['query'][_0xd593('0x4c')]){_0x5da671['where']=_[_0xd593('0x4d')](_0x5da671['where'],{'$or':_[_0xd593('0x41')](_0x5da671['attributes'],function(_0x34570b){var _0x50fde3={};_0x50fde3[_0x34570b]={'$like':'%'+_0x4eff5e[_0xd593('0x42')]['filter']+'%'};return _0x50fde3;})});}_0x5da671=_[_0xd593('0x4d')]({},_0x5da671,_0x4eff5e['options']);return db[_0xd593('0xa4')][_0xd593('0x2e')]({'where':_0x5da671[_0xd593('0x4b')]})[_0xd593('0x1f')](function(_0xbc1f24){_0xe6f395['count']=_0xbc1f24;if(_0x4eff5e[_0xd593('0x42')]['includeAll']){_0x5da671[_0xd593('0x50')]=[{'model':db[_0xd593('0x76')],'as':_0xd593('0xbe'),'required':![]},{'model':db[_0xd593('0xad')],'as':_0xd593('0xbf'),'attributes':[_0xd593('0x39'),_0xd593('0xc0'),'internal'],'required':![]},{'model':db[_0xd593('0xc1')],'as':'Tags','attributes':['id','name','color'],'where':_0x4eff5e[_0xd593('0x42')][_0xd593('0xc2')]?{'id':_0x4eff5e[_0xd593('0x42')][_0xd593('0xc2')]}:undefined,'required':_0x4eff5e['query'][_0xd593('0xc2')]?!![]:![]}];}return db['SmsInteraction'][_0xd593('0x52')](_0x5da671);})[_0xd593('0x1f')](function(_0x2c1f92){_0xe6f395['rows']=_0x2c1f92;return _0xe6f395;});}})[_0xd593('0x1f')](respondWithFilteredResult(_0x1e738b,_0x5da671))['catch'](handleError(_0x1e738b,null));};exports[_0xd593('0x3a')]=function(_0x54b8ac,_0x4e1b3f,_0x7137cc){var _0x2f94a8,_0x45ba52,_0x9d6fcd;if(_[_0xd593('0x99')](_0x54b8ac[_0xd593('0x5f')][_0xd593('0x5f')])||_0x54b8ac[_0xd593('0x5f')][_0xd593('0x5f')]===''){throw new db[(_0xd593('0x77'))][(_0xd593('0x78'))](_0xd593('0x9b'));}if(_[_0xd593('0x99')](_0x54b8ac[_0xd593('0x5f')]['to'])){throw new db[(_0xd593('0x77'))][(_0xd593('0x78'))](_0xd593('0xc3'));}_0x2f94a8=_0x54b8ac[_0xd593('0x5f')]['to'];return db[_0xd593('0x51')][_0xd593('0x5c')]({'where':{'id':_0x54b8ac[_0xd593('0x55')]['id']},'include':[{'model':db[_0xd593('0xa0')],'as':_0xd593('0xc4'),'include':[{'model':db[_0xd593('0x76')],'as':_0xd593('0xa3'),'where':{'mobile':_0x2f94a8},'limit':0x1,'order':[['updatedAt',_0xd593('0xc5')]]}]}]})[_0xd593('0x1f')](handleEntityNotFound(_0x4e1b3f,null))['then'](function(_0x42002a){if(_0x42002a&&_0x42002a[_0xd593('0xc4')]){_0x45ba52=_0x42002a['get']({'plain':!![]});if(_0x45ba52['List']&&_0x45ba52[_0xd593('0xc4')][_0xd593('0xa3')]['length']){return _0x45ba52[_0xd593('0xc4')][_0xd593('0xa3')][0x0];}return db['CmContact']['create'](_[_0xd593('0x19')](_0x54b8ac[_0xd593('0x5f')],{'firstName':_0x2f94a8,'mobile':_0x2f94a8,'phone':_0x2f94a8,'ListId':_0x45ba52['ListId']}));}})['then'](handleEntityNotFound(_0x4e1b3f,null))[_0xd593('0x1f')](function(_0x1f94ec){if(_0x1f94ec){_0x9d6fcd=_0x1f94ec;return db[_0xd593('0xa4')][_0xd593('0x5c')]({'where':{'ContactId':_0x9d6fcd['id'],'closed':![],'SmsAccountId':_0x45ba52['id']}})[_0xd593('0x1f')](function(_0x10f933){if(_0x10f933){return[_0x10f933,![]];}return db[_0xd593('0xa4')][_0xd593('0x5e')]({'UserId':_0x54b8ac[_0xd593('0x57')]['id'],'ContactId':_0x9d6fcd['id'],'SmsAccountId':_0x45ba52['id'],'phone':_0x2f94a8,'firstMsgDirection':_0xd593('0xc6'),'Messages':[_['merge'](_0x54b8ac[_0xd593('0x5f')],{'read':![],'body':_0x54b8ac['body']['body'],'phone':_0x2f94a8,'SmsAccountId':_0x45ba52['id'],'UserId':_0x54b8ac[_0xd593('0x57')]['id'],'ContactId':_0x9d6fcd['id']})]},{'include':[{'model':db[_0xd593('0xc7')],'as':_0xd593('0xc8')}]})[_0xd593('0x1f')](function(_0x319974){return[_0x319974,!![]];});});}})[_0xd593('0xc9')](function(_0x1bfc3f,_0x267e9d){if(_0x267e9d){return _0x1bfc3f;}return db[_0xd593('0xc7')]['create'](_['merge'](_0x54b8ac[_0xd593('0x5f')],{'read':![],'body':_0x54b8ac[_0xd593('0x5f')][_0xd593('0x5f')],'phone':_0x2f94a8,'SmsAccountId':_0x45ba52['id'],'SmsInteractionId':_0x1bfc3f['id'],'UserId':_0x54b8ac[_0xd593('0x57')]['id'],'ContactId':_0x9d6fcd['id']}))[_0xd593('0x1f')](function(_0x3c3eb0){_0x1bfc3f[_0xd593('0xca')]['Messages']=[];_0x1bfc3f[_0xd593('0xca')]['Messages'][_0xd593('0xa8')](_0x3c3eb0['dataValues']);return _0x1bfc3f;});})[_0xd593('0x1f')](respondWithResult(_0x4e1b3f,null))[_0xd593('0x28')](handleError(_0x4e1b3f,null));};exports[_0xd593('0x2a')]=function(_0x5dfe46,_0x3be700,_0x99f34f){if(_0x5dfe46[_0xd593('0x5f')]['id']){delete _0x5dfe46['body']['id'];}var _0x31a94e,_0x5d72dd,_0x20ce44;return db[_0xd593('0x51')][_0xd593('0x5c')]({'where':{'id':_0x5dfe46[_0xd593('0x55')]['id']}})[_0xd593('0x1f')](handleEntityNotFound(_0x3be700,null))[_0xd593('0x1f')](function(_0x2018f0){if(_0x2018f0){_0x20ce44=_0x2018f0;logger[_0xd593('0xcb')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd593('0x2a'),_0xd593('0xcc'),_0x2018f0[_0xd593('0x7f')],util[_0xd593('0xcd')](_0x5dfe46[_0xd593('0x5f')],{'showHidden':![],'depth':null}));switch(_0x2018f0[_0xd593('0x7f')]){case _0xd593('0x85'):if(_0x5dfe46[_0xd593('0x5f')][_0xd593('0xce')]&&_0x5dfe46[_0xd593('0x5f')][_0xd593('0x2a')]){_0x5d72dd=_0x5dfe46['body'][_0xd593('0x2a')];return db[_0xd593('0xc7')][_0xd593('0x5c')]({'where':{'messageId':_0x5dfe46[_0xd593('0x5f')]['skebby_dispatch_id']}});}break;case _0xd593('0x87'):if(_0x5dfe46[_0xd593('0x5f')][_0xd593('0xcf')]&&_0x5dfe46[_0xd593('0x5f')][_0xd593('0xd0')]){_0x5d72dd=_0x5dfe46[_0xd593('0x5f')][_0xd593('0xd0')];return db[_0xd593('0xc7')][_0xd593('0x5c')]({'where':{'messageId':_0x5dfe46[_0xd593('0x5f')][_0xd593('0xcf')]}});}break;case _0xd593('0x89'):if(_0x5dfe46['body'][_0xd593('0x8a')]&&_0x5dfe46[_0xd593('0x5f')][_0xd593('0xd1')]){_0x5d72dd=_0x5dfe46[_0xd593('0x5f')][_0xd593('0xd1')];return db[_0xd593('0xc7')][_0xd593('0x5c')]({'where':{'messageId':_0x5dfe46['body'][_0xd593('0x8a')]}});}break;case _0xd593('0x8e'):var _0x4bc453=_0x5dfe46['body']['results'][0x0];if(_0x4bc453[_0xd593('0x83')]&&_0x4bc453[_0xd593('0x2a')][_0xd593('0xd2')]===_0xd593('0xd3')){_0x5d72dd=_0x4bc453[_0xd593('0x2a')][_0xd593('0xd2')];return db[_0xd593('0xc7')][_0xd593('0x5c')]({'where':{'messageId':_0x4bc453['messageId']}});}break;case _0xd593('0x92'):if(_0x5dfe46['body'][_0xd593('0x83')]&&_0x5dfe46['body']['status']){_0x5d72dd=_0x5dfe46['body'][_0xd593('0x2a')];return db[_0xd593('0xc7')]['find']({'where':{'messageId':_0x5dfe46[_0xd593('0x5f')]['messageId']}});}break;case _0xd593('0x96'):if(_0x5dfe46[_0xd593('0x5f')][0x0][_0xd593('0x26')]['id']){_0x5d72dd=_0x5dfe46[_0xd593('0x5f')][0x0][_0xd593('0x7f')];return db[_0xd593('0xc7')][_0xd593('0x5c')]({'where':{'messageId':_0x5dfe46[_0xd593('0x5f')][0x0]['message']['id']}});}break;case _0xd593('0x97'):if(_0x5dfe46['body'][_0xd593('0xd4')]&&_0x5dfe46[_0xd593('0x5f')][_0xd593('0x2a')]){_0x5d72dd=_0x5dfe46[_0xd593('0x5f')][_0xd593('0x2a')];return db[_0xd593('0xc7')][_0xd593('0x5c')]({'where':{'messageId':_0x5dfe46[_0xd593('0x5f')][_0xd593('0xd4')]}});}break;}}})['then'](handleEntityNotFound(_0x3be700,null))[_0xd593('0x1f')](function(_0x2eabfc){if(_0x2eabfc){_0x31a94e=_0x2eabfc;switch(_0x20ce44[_0xd593('0x7f')]){case'skebby':if(_0x5d72dd===_0xd593('0xd3')){return _0x31a94e['update']({'read':!![]});}else{logger[_0xd593('0x25')](_0xd593('0x23'),'status',_0xd593('0x85'),util[_0xd593('0xcd')](_0x5dfe46[_0xd593('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xd593('0x87'):if(_0x5d72dd==='1'){return _0x31a94e[_0xd593('0x35')]({'read':!![]});}else{logger[_0xd593('0x25')](_0xd593('0x23'),_0xd593('0x2a'),_0xd593('0x85'),util[_0xd593('0xcd')](_0x5dfe46[_0xd593('0x5f')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x5dfe46['body'][_0xd593('0xd5')]&&_0x5d72dd>=0xc8&&_0x5d72dd<=0xce){return _0x31a94e[_0xd593('0x35')]({'read':!![]});}else{logger['error'](_0xd593('0x23'),_0xd593('0x2a'),_0xd593('0x89'),util['inspect'](_0x5dfe46[_0xd593('0x5f')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x585cb8=_0x5dfe46[_0xd593('0x5f')][_0xd593('0x8f')][0x0];if(_0x585cb8[_0xd593('0x2a')]['groupName']===_0xd593('0xd3')){return _0x31a94e[_0xd593('0x35')]({'read':!![]});}else{logger[_0xd593('0x25')](_0xd593('0x23'),_0xd593('0x2a'),_0xd593('0x8e'),util[_0xd593('0xcd')](_0x5dfe46[_0xd593('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xd593('0x92'):if(_0x5d72dd==_0xd593('0xd6')||_0x5d72dd==_0xd593('0xd7')){return _0x31a94e[_0xd593('0x35')]({'read':!![]});}else{logger[_0xd593('0x25')](_0xd593('0x23'),_0xd593('0x2a'),_0xd593('0x92'),util['inspect'](_0x5dfe46['body'],{'showHidden':![],'depth':null}));}break;case _0xd593('0x96'):if(_0x5d72dd==_0xd593('0xd8')){return _0x31a94e[_0xd593('0x35')]({'read':!![]});}else{logger[_0xd593('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xd593('0x96'),util[_0xd593('0xcd')](_0x5dfe46[_0xd593('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xd593('0x97'):if(_0x5d72dd===_0xd593('0xd9')||_0x5d72dd==='ACCEPTD'){return _0x31a94e[_0xd593('0x35')]({'read':!![]});}else{logger[_0xd593('0x25')](_0xd593('0x23'),_0xd593('0x2a'),_0xd593('0x97'),util['inspect'](_0x5dfe46[_0xd593('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x31a94e;}})['then'](respondWithResult(_0x3be700,null))[_0xd593('0x28')](handleError(_0x3be700,null));};exports[_0xd593('0xda')]=function(_0x268049,_0x298bfa,_0x35fbe0){var _0x484471,_0x1049f4,_0x1d3221;return db[_0xd593('0x51')][_0xd593('0x5c')]({'where':{'id':_0x268049[_0xd593('0x55')]['id']}})[_0xd593('0x1f')](handleEntityNotFound(_0x298bfa,null))[_0xd593('0x1f')](function(_0x37e7a9){if(_0x37e7a9){_0x1d3221=_0x37e7a9;logger['debug'](_0xd593('0x23'),'status',_0xd593('0xcc'),_0x37e7a9[_0xd593('0x7f')],util[_0xd593('0xcd')](_0x268049[_0xd593('0x42')],{'showHidden':![],'depth':null}));switch(_0x37e7a9[_0xd593('0x7f')]){case _0xd593('0x90'):if(_0x268049['query'][_0xd593('0xdb')]&&_0x268049['query']['state']){_0x1049f4=_0x268049[_0xd593('0x42')][_0xd593('0xdc')];return db[_0xd593('0xc7')][_0xd593('0x5c')]({'where':{'messageId':_0x268049[_0xd593('0x42')][_0xd593('0xdb')]}});}break;}}})['then'](handleEntityNotFound(_0x298bfa,null))['then'](function(_0x208748){if(_0x208748){_0x484471=_0x208748;switch(_0x1d3221[_0xd593('0x7f')]){case _0xd593('0x90'):if(_0x1049f4==='2'||_0x1049f4==='6'){return _0x484471[_0xd593('0x35')]({'read':!![]});}else{logger[_0xd593('0x25')](_0xd593('0x23'),'status',_0xd593('0x90'),util[_0xd593('0xcd')](_0x268049[_0xd593('0x42')],{'showHidden':![],'depth':null}));};break;}return _0x484471;}})[_0xd593('0x1f')](respondWithResult(_0x298bfa,null))[_0xd593('0x28')](handleError(_0x298bfa,null));};exports[_0xd593('0xdd')]=function(_0x3389fb,_0x81389b,_0x25ac91){return db[_0xd593('0x51')][_0xd593('0x5c')]({'where':{'id':_0x3389fb['params']['id']}})[_0xd593('0x1f')](handleEntityNotFound(_0x81389b,null))[_0xd593('0x1f')](function(_0x3040b1){if(_0x3040b1){return _0x3040b1[_0xd593('0xdd')](_0x3389fb[_0xd593('0x5f')][_0xd593('0x6a')],_['omit'](_0x3389fb[_0xd593('0x5f')],[_0xd593('0x6a'),'id'])||{})[_0xd593('0xc9')](function(_0x1e0893){for(var _0xc763d2=0x0;_0xc763d2<_0x3389fb[_0xd593('0x5f')][_0xd593('0x6a')][_0xd593('0x48')];_0xc763d2+=0x1){socket['emit'](_0xd593('0xde'),{'UserId':Number(_0x3389fb[_0xd593('0x5f')][_0xd593('0x6a')][_0xc763d2]),'SmsAccountId':Number(_0x3389fb[_0xd593('0x55')]['id'])});}return _0x1e0893;});}})['then'](respondWithResult(_0x81389b,null))['catch'](handleError(_0x81389b,null));};exports['removeAgents']=function(_0x5d0829,_0x3b092a,_0x448247){return db[_0xd593('0x51')]['find']({'where':{'id':_0x5d0829[_0xd593('0x55')]['id']}})[_0xd593('0x1f')](handleEntityNotFound(_0x3b092a,null))['then'](function(_0x410ca9){if(_0x410ca9){return _0x410ca9[_0xd593('0xdf')](_0x5d0829[_0xd593('0x42')]['ids'])['then'](function(){if(_[_0xd593('0xe0')](_0x5d0829['query'][_0xd593('0x6a')])){for(var _0x216c45=0x0;_0x216c45<_0x5d0829[_0xd593('0x42')][_0xd593('0x6a')]['length'];_0x216c45+=0x1){socket[_0xd593('0xe1')]('userSmsAccount:remove',{'UserId':Number(_0x5d0829[_0xd593('0x42')]['ids'][_0x216c45]),'SmsAccountId':Number(_0x5d0829[_0xd593('0x55')]['id'])});}}else{socket['emit'](_0xd593('0xe2'),{'UserId':Number(_0x5d0829[_0xd593('0x42')][_0xd593('0x6a')]),'SmsAccountId':Number(_0x5d0829['params']['id'])});}});}})[_0xd593('0x1f')](respondWithStatusCode(_0x3b092a,null))[_0xd593('0x28')](handleError(_0x3b092a,null));};exports[_0xd593('0xe3')]=function(_0x288b04,_0x6a4302,_0x22f9f7){var _0x4d0b9a={};var _0x1b35e9={};var _0x13f642;var _0x2a4e3b;return db[_0xd593('0x51')][_0xd593('0x65')]({'where':{'id':_0x288b04['params']['id']}})[_0xd593('0x1f')](handleEntityNotFound(_0x6a4302,null))[_0xd593('0x1f')](function(_0xc5563e){if(_0xc5563e){_0x13f642=_0xc5563e;_0x1b35e9[_0xd593('0x40')]=_[_0xd593('0x43')](db[_0xd593('0xad')][_0xd593('0x3e')]);_0x1b35e9[_0xd593('0x42')]=_['keys'](_0x288b04[_0xd593('0x42')]);_0x1b35e9[_0xd593('0x44')]=_[_0xd593('0x45')](_0x1b35e9['model'],_0x1b35e9[_0xd593('0x42')]);_0x4d0b9a[_0xd593('0x46')]=_[_0xd593('0x45')](_0x1b35e9[_0xd593('0x40')],qs['fields'](_0x288b04[_0xd593('0x42')][_0xd593('0x47')]));_0x4d0b9a[_0xd593('0x46')]=_0x4d0b9a['attributes'][_0xd593('0x48')]?_0x4d0b9a['attributes']:_0x1b35e9[_0xd593('0x40')];_0x4d0b9a[_0xd593('0x67')]=qs[_0xd593('0x4a')](_0x288b04[_0xd593('0x42')][_0xd593('0x4a')]);_0x4d0b9a[_0xd593('0x4b')]=qs[_0xd593('0x44')](_['pick'](_0x288b04[_0xd593('0x42')],_0x1b35e9[_0xd593('0x44')]));if(_0x288b04[_0xd593('0x42')]['filter']){_0x4d0b9a[_0xd593('0x4b')]=_['merge'](_0x4d0b9a[_0xd593('0x4b')],{'$or':_[_0xd593('0x41')](_0x4d0b9a[_0xd593('0x46')],function(_0x2aeb14){var _0x374e56={};_0x374e56[_0x2aeb14]={'$like':'%'+_0x288b04[_0xd593('0x42')][_0xd593('0x4c')]+'%'};return _0x374e56;})});}_0x4d0b9a=_['merge']({},_0x4d0b9a,_0x288b04['options']);return _0x13f642[_0xd593('0xe3')](_0x4d0b9a);}})[_0xd593('0x1f')](function(_0x16cccc){if(_0x16cccc){_0x2a4e3b=_0x16cccc['length'];if(!_0x288b04[_0xd593('0x42')][_0xd593('0x49')](_0xd593('0x66'))){_0x4d0b9a[_0xd593('0x30')]=qs[_0xd593('0x30')](_0x288b04[_0xd593('0x42')][_0xd593('0x30')]);_0x4d0b9a[_0xd593('0x2f')]=qs[_0xd593('0x2f')](_0x288b04[_0xd593('0x42')][_0xd593('0x2f')]);}return _0x13f642[_0xd593('0xe3')](_0x4d0b9a);}})[_0xd593('0x1f')](function(_0xe5c19b){if(_0xe5c19b){return _0xe5c19b?{'count':_0x2a4e3b,'rows':_0xe5c19b}:null;}})[_0xd593('0x1f')](respondWithResult(_0x6a4302,null))['catch'](handleError(_0x6a4302,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 0715ffd..ff18a38 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 _0x7797=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x41cde8,_0x403375){var _0x473e3e=function(_0x3ed575){while(--_0x3ed575){_0x41cde8['push'](_0x41cde8['shift']());}};_0x473e3e(++_0x403375);}(_0x7797,0x161));var _0x7779=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x7797[_0x15c421];return _0x5e5ed5;};'use strict';var EventEmitter=require(_0x7779('0x0'));var SmsAccount=require(_0x7779('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x7779('0x2')](0x0);var events={'afterCreate':_0x7779('0x3'),'afterUpdate':_0x7779('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5e25b1){return function(_0x2e004b,_0x194e6b,_0x29a36a){SmsAccountEvents[_0x7779('0x5')](_0x5e25b1+':'+_0x2e004b['id'],_0x2e004b);SmsAccountEvents[_0x7779('0x5')](_0x5e25b1,_0x2e004b);_0x29a36a(null);};}for(var e in events){if(events[_0x7779('0x6')](e)){var event=events[e];SmsAccount[_0x7779('0x7')](e,emitEvent(event));}}module[_0x7779('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0xf4bf=['remove','emit','hasOwnProperty','exports','save'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0xf4bf,0x11c));var _0xff4b=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0xf4bf[_0x4dc7b9];return _0x3ab114;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xff4b('0x0'),'afterUpdate':'update','afterDestroy':_0xff4b('0x1')};function emitEvent(_0x61ba3a){return function(_0x5ea11a,_0x1051af,_0x3ea11d){SmsAccountEvents[_0xff4b('0x2')](_0x61ba3a+':'+_0x5ea11a['id'],_0x5ea11a);SmsAccountEvents['emit'](_0x61ba3a,_0x5ea11a);_0x3ea11d(null);};}for(var e in events){if(events[_0xff4b('0x3')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0xff4b('0x4')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 212c405..6fb3fc7 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 _0xfcbd=['request-promise','path','../../config/environment','./smsAccount.attributes','define','SmsAccount','util','api','moment','bluebird'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xfcbd,0xe2));var _0xdfcb=function(_0x1e5522,_0x6b8484){_0x1e5522=_0x1e5522-0x0;var _0x588c24=_0xfcbd[_0x1e5522];return _0x588c24;};'use strict';var _=require('lodash');var util=require(_0xdfcb('0x0'));var logger=require('../../config/logger')(_0xdfcb('0x1'));var moment=require(_0xdfcb('0x2'));var BPromise=require(_0xdfcb('0x3'));var rp=require(_0xdfcb('0x4'));var fs=require('fs');var path=require(_0xdfcb('0x5'));var rimraf=require('rimraf');var config=require(_0xdfcb('0x6'));var attributes=require(_0xdfcb('0x7'));module['exports']=function(_0x5ef50f,_0x511441){return _0x5ef50f[_0xdfcb('0x8')](_0xdfcb('0x9'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5a8=['exports','define','sms_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes'];(function(_0x3e1a9e,_0x147132){var _0x330883=function(_0x222c3a){while(--_0x222c3a){_0x3e1a9e['push'](_0x3e1a9e['shift']());}};_0x330883(++_0x147132);}(_0xd5a8,0x8f));var _0x8d5a=function(_0x1373f5,_0x30a026){_0x1373f5=_0x1373f5-0x0;var _0x549b54=_0xd5a8[_0x1373f5];return _0x549b54;};'use strict';var _=require(_0x8d5a('0x0'));var util=require(_0x8d5a('0x1'));var logger=require(_0x8d5a('0x2'))(_0x8d5a('0x3'));var moment=require(_0x8d5a('0x4'));var BPromise=require(_0x8d5a('0x5'));var rp=require(_0x8d5a('0x6'));var fs=require('fs');var path=require(_0x8d5a('0x7'));var rimraf=require(_0x8d5a('0x8'));var config=require(_0x8d5a('0x9'));var attributes=require(_0x8d5a('0xa'));module[_0x8d5a('0xb')]=function(_0x152760,_0x5a6739){return _0x152760[_0x8d5a('0xc')]('SmsAccount',attributes,{'tableName':_0x8d5a('0xd'),'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 29f6a24..d810265 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 _0x1c24=['map','info','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','./smsAccount.socket','register','request','then','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SmsAccount,\x20%s,\x20%s','ShowSmsAccount','SmsAccount','find','options','where','attributes','include','model'];(function(_0x4d3a38,_0x464072){var _0x3ca174=function(_0xa86bf6){while(--_0xa86bf6){_0x4d3a38['push'](_0x4d3a38['shift']());}};_0x3ca174(++_0x464072);}(_0x1c24,0xbb));var _0x41c2=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x1c24[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var util=require(_0x41c2('0x0'));var moment=require(_0x41c2('0x1'));var BPromise=require(_0x41c2('0x2'));var rs=require(_0x41c2('0x3'));var fs=require('fs');var Redis=require(_0x41c2('0x4'));var db=require(_0x41c2('0x5'))['db'];var utils=require(_0x41c2('0x6'));var logger=require(_0x41c2('0x7'))(_0x41c2('0x8'));var config=require(_0x41c2('0x9'));var jayson=require(_0x41c2('0xa'));var client=jayson['client'][_0x41c2('0xb')]({'port':0x232a});config['redis']=_[_0x41c2('0xc')](config[_0x41c2('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x41c2('0xd')]));require(_0x41c2('0xe'))[_0x41c2('0xf')](socket);function respondWithRpcPromise(_0x24ec19,_0x54c262,_0x56acc5){return new BPromise(function(_0x12d033,_0x3482a8){return client[_0x41c2('0x10')](_0x24ec19,_0x56acc5)[_0x41c2('0x11')](function(_0x591196){logger['info']('SmsAccount,\x20%s,\x20%s',_0x54c262,'request\x20sent');logger['debug'](_0x41c2('0x12'),_0x54c262,_0x41c2('0x13'),JSON[_0x41c2('0x14')](_0x591196));if(_0x591196['error']){if(_0x591196[_0x41c2('0x15')][_0x41c2('0x16')]===0x1f4){logger[_0x41c2('0x15')]('SmsAccount,\x20%s,\x20%s',_0x54c262,_0x591196['error'][_0x41c2('0x17')]);return _0x3482a8(_0x591196['error'][_0x41c2('0x17')]);}logger[_0x41c2('0x15')]('SmsAccount,\x20%s,\x20%s',_0x54c262,_0x591196[_0x41c2('0x15')][_0x41c2('0x17')]);return _0x12d033(_0x591196[_0x41c2('0x15')][_0x41c2('0x17')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x54c262,_0x41c2('0x13'));_0x12d033(_0x591196[_0x41c2('0x18')][_0x41c2('0x17')]);}})[_0x41c2('0x19')](function(_0x4439ff){logger[_0x41c2('0x15')](_0x41c2('0x1a'),_0x54c262,_0x4439ff);_0x3482a8(_0x4439ff);});});}exports[_0x41c2('0x1b')]=function(_0x3595d8){var _0x1a70a6=this;return new Promise(function(_0x5b88cf,_0xe1f300){return db[_0x41c2('0x1c')][_0x41c2('0x1d')]({'raw':_0x3595d8[_0x41c2('0x1e')]?_0x3595d8[_0x41c2('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3595d8['options']?_0x3595d8[_0x41c2('0x1e')][_0x41c2('0x1f')]||null:null,'attributes':_0x3595d8[_0x41c2('0x1e')]?_0x3595d8[_0x41c2('0x1e')][_0x41c2('0x20')]||null:null,'include':_0x3595d8[_0x41c2('0x1e')]?_0x3595d8['options'][_0x41c2('0x21')]?_['map'](_0x3595d8[_0x41c2('0x1e')][_0x41c2('0x21')],function(_0x387dbc){return{'model':db[_0x387dbc[_0x41c2('0x22')]],'as':_0x387dbc['as'],'attributes':_0x387dbc[_0x41c2('0x20')],'include':_0x387dbc[_0x41c2('0x21')]?_[_0x41c2('0x23')](_0x387dbc[_0x41c2('0x21')],function(_0x1e8453){return{'model':db[_0x1e8453[_0x41c2('0x22')]],'as':_0x1e8453['as'],'attributes':_0x1e8453[_0x41c2('0x20')],'include':_0x1e8453[_0x41c2('0x21')]?_['map'](_0x1e8453[_0x41c2('0x21')],function(_0x268a08){return{'model':db[_0x268a08['model']],'as':_0x268a08['as'],'attributes':_0x268a08[_0x41c2('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b2e6a){logger[_0x41c2('0x24')](_0x41c2('0x1b'),_0x3595d8);logger['debug'](_0x41c2('0x1b'),_0x3595d8,JSON[_0x41c2('0x14')](_0x1b2e6a));_0x5b88cf(_0x1b2e6a);})[_0x41c2('0x19')](function(_0x293a13){logger[_0x41c2('0x15')](_0x41c2('0x1b'),_0x293a13[_0x41c2('0x17')],_0x3595d8);_0xe1f300(_0x1a70a6[_0x41c2('0x15')](0x1f4,_0x293a13[_0x41c2('0x17')]));});});}; \ No newline at end of file +var _0x6006=['jayson/promise','client','http','redis','localhost','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','options','attributes','include','map','model','ShowSmsAccount','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x29ae06,_0x377bcf){var _0x3b5b65=function(_0x472462){while(--_0x472462){_0x29ae06['push'](_0x29ae06['shift']());}};_0x3b5b65(++_0x377bcf);}(_0x6006,0x164));var _0x6600=function(_0x1a04ef,_0x541e36){_0x1a04ef=_0x1a04ef-0x0;var _0x3b8f4c=_0x6006[_0x1a04ef];return _0x3b8f4c;};'use strict';var _=require('lodash');var util=require(_0x6600('0x0'));var moment=require(_0x6600('0x1'));var BPromise=require(_0x6600('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6600('0x3'));var db=require(_0x6600('0x4'))['db'];var utils=require(_0x6600('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x6600('0x6'));var jayson=require(_0x6600('0x7'));var client=jayson[_0x6600('0x8')][_0x6600('0x9')]({'port':0x232a});config[_0x6600('0xa')]=_['defaults'](config[_0x6600('0xa')],{'host':_0x6600('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6600('0xa')]));require(_0x6600('0xc'))[_0x6600('0xd')](socket);function respondWithRpcPromise(_0x4d6150,_0x391e7c,_0x352ced){return new BPromise(function(_0x1d231c,_0x25ffbe){return client[_0x6600('0xe')](_0x4d6150,_0x352ced)[_0x6600('0xf')](function(_0x4d1eb3){logger[_0x6600('0x10')](_0x6600('0x11'),_0x391e7c,'request\x20sent');logger[_0x6600('0x12')](_0x6600('0x13'),_0x391e7c,_0x6600('0x14'),JSON[_0x6600('0x15')](_0x4d1eb3));if(_0x4d1eb3[_0x6600('0x16')]){if(_0x4d1eb3['error'][_0x6600('0x17')]===0x1f4){logger['error'](_0x6600('0x11'),_0x391e7c,_0x4d1eb3[_0x6600('0x16')][_0x6600('0x18')]);return _0x25ffbe(_0x4d1eb3[_0x6600('0x16')]['message']);}logger[_0x6600('0x16')](_0x6600('0x11'),_0x391e7c,_0x4d1eb3[_0x6600('0x16')][_0x6600('0x18')]);return _0x1d231c(_0x4d1eb3[_0x6600('0x16')]['message']);}else{logger[_0x6600('0x10')](_0x6600('0x11'),_0x391e7c,_0x6600('0x14'));_0x1d231c(_0x4d1eb3[_0x6600('0x19')]['message']);}})[_0x6600('0x1a')](function(_0x12f0e4){logger[_0x6600('0x16')](_0x6600('0x11'),_0x391e7c,_0x12f0e4);_0x25ffbe(_0x12f0e4);});});}exports['ShowSmsAccount']=function(_0x13e702){var _0xfe4f12=this;return new Promise(function(_0x17a775,_0xdc098d){return db['SmsAccount']['find']({'raw':_0x13e702[_0x6600('0x1b')]?_0x13e702[_0x6600('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x13e702[_0x6600('0x1b')]?_0x13e702[_0x6600('0x1b')]['where']||null:null,'attributes':_0x13e702[_0x6600('0x1b')]?_0x13e702[_0x6600('0x1b')][_0x6600('0x1c')]||null:null,'include':_0x13e702[_0x6600('0x1b')]?_0x13e702['options'][_0x6600('0x1d')]?_[_0x6600('0x1e')](_0x13e702[_0x6600('0x1b')][_0x6600('0x1d')],function(_0x67c755){return{'model':db[_0x67c755[_0x6600('0x1f')]],'as':_0x67c755['as'],'attributes':_0x67c755['attributes'],'include':_0x67c755['include']?_[_0x6600('0x1e')](_0x67c755[_0x6600('0x1d')],function(_0x71f1d){return{'model':db[_0x71f1d[_0x6600('0x1f')]],'as':_0x71f1d['as'],'attributes':_0x71f1d[_0x6600('0x1c')],'include':_0x71f1d[_0x6600('0x1d')]?_['map'](_0x71f1d['include'],function(_0x15ae23){return{'model':db[_0x15ae23[_0x6600('0x1f')]],'as':_0x15ae23['as'],'attributes':_0x15ae23['attributes']};}):[]};}):[]};}):[]:[]})[_0x6600('0xf')](function(_0x373aa4){logger[_0x6600('0x10')](_0x6600('0x20'),_0x13e702);logger[_0x6600('0x12')](_0x6600('0x20'),_0x13e702,JSON['stringify'](_0x373aa4));_0x17a775(_0x373aa4);})[_0x6600('0x1a')](function(_0x4a99a1){logger[_0x6600('0x16')](_0x6600('0x20'),_0x4a99a1[_0x6600('0x18')],_0x13e702);_0xdc098d(_0xfe4f12[_0x6600('0x16')](0x1f4,_0x4a99a1[_0x6600('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index ae0d4e1..fcb9e94 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 0ea0b5a..64153ba 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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +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(_0x764397,_0x13654c){var _0x138255=function(_0x4d75d0){while(--_0x4d75d0){_0x764397['push'](_0x764397['shift']());}};_0x138255(++_0x13654c);}(_0x3e74,0x175));var _0x43e7=function(_0x4fbde6,_0x3499b2){_0x4fbde6=_0x4fbde6-0x0;var _0x4d18f5=_0x3e74[_0x4fbde6];return _0x4d18f5;};'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 db2df53..09f08a8 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 _0x3b7d=['sequelize','STRING','TEXT'];(function(_0x4ca796,_0x10dc47){var _0x171f87=function(_0x198d29){while(--_0x198d29){_0x4ca796['push'](_0x4ca796['shift']());}};_0x171f87(++_0x10dc47);}(_0x3b7d,0xbd));var _0xd3b7=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x3b7d[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0xd3b7('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xd3b7('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xd3b7('0x2')]()},'description':{'type':Sequelize[_0xd3b7('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xfba3=['STRING','*,*,*,*','sequelize','TEXT'];(function(_0x215b9f,_0x484ce3){var _0x4ad616=function(_0x77bbb1){while(--_0x77bbb1){_0x215b9f['push'](_0x215b9f['shift']());}};_0x4ad616(++_0x484ce3);}(_0xfba3,0x152));var _0x3fba=function(_0x2bb345,_0x487bc1){_0x2bb345=_0x2bb345-0x0;var _0xee5264=_0xfba3[_0x2bb345];return _0xee5264;};'use strict';var Sequelize=require(_0x3fba('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x3fba('0x1')]()},'description':{'type':Sequelize[_0x3fba('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x3fba('0x3')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index e67abb2..1740319 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 _0x484c=['length','options','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','params'];(function(_0xf6e99f,_0x58daf8){var _0x34f260=function(_0x297d26){while(--_0x297d26){_0xf6e99f['push'](_0xf6e99f['shift']());}};_0x34f260(++_0x58daf8);}(_0x484c,0x177));var _0xc484=function(_0x321ca3,_0x525b6c){_0x321ca3=_0x321ca3-0x0;var _0x157ca3=_0x484c[_0x321ca3];return _0x157ca3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc484('0x0'));var zipdir=require(_0xc484('0x1'));var jsonpatch=require(_0xc484('0x2'));var rp=require(_0xc484('0x3'));var moment=require(_0xc484('0x4'));var BPromise=require(_0xc484('0x5'));var Mustache=require('mustache');var util=require(_0xc484('0x6'));var path=require(_0xc484('0x7'));var sox=require(_0xc484('0x8'));var csv=require(_0xc484('0x9'));var ejs=require(_0xc484('0xa'));var fs=require('fs');var fs_extra=require(_0xc484('0xb'));var _=require(_0xc484('0xc'));var squel=require(_0xc484('0xd'));var crypto=require(_0xc484('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc484('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc484('0x10'));var Papa=require(_0xc484('0x11'));var Redis=require(_0xc484('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc484('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc484('0x14'))(_0xc484('0x15'));var utils=require(_0xc484('0x16'));var config=require(_0xc484('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc484('0x18'))['db'];function respondWithStatusCode(_0x3445e0,_0x372358){_0x372358=_0x372358||0xcc;return function(_0xe34971){if(_0xe34971){return _0x3445e0[_0xc484('0x19')](_0x372358);}return _0x3445e0['status'](_0x372358)[_0xc484('0x1a')]();};}function respondWithResult(_0x29dff3,_0x55e964){_0x55e964=_0x55e964||0xc8;return function(_0xa7ae4b){if(_0xa7ae4b){return _0x29dff3[_0xc484('0x1b')](_0x55e964)['json'](_0xa7ae4b);}};}function respondWithFilteredResult(_0x8672bf,_0x2f01c3){return function(_0x4c3969){if(_0x4c3969){var _0x48d335=typeof _0x2f01c3[_0xc484('0x1c')]==='undefined'&&typeof _0x2f01c3[_0xc484('0x1d')]===_0xc484('0x1e');var _0x7d1104=_0x4c3969['count'];var _0x273dad=_0x48d335?0x0:_0x2f01c3[_0xc484('0x1c')];var _0x48066b=_0x48d335?_0x4c3969[_0xc484('0x1f')]:_0x2f01c3[_0xc484('0x1c')]+_0x2f01c3[_0xc484('0x1d')];var _0x20358d;if(_0x48066b>=_0x7d1104){_0x48066b=_0x7d1104;_0x20358d=0xc8;}else{_0x20358d=0xce;}_0x8672bf[_0xc484('0x1b')](_0x20358d);return _0x8672bf[_0xc484('0x20')](_0xc484('0x21'),_0x273dad+'-'+_0x48066b+'/'+_0x7d1104)[_0xc484('0x22')](_0x4c3969);}return null;};}function patchUpdates(_0x4d22a6){return function(_0xe7b764){try{jsonpatch[_0xc484('0x23')](_0xe7b764,_0x4d22a6,!![]);}catch(_0x335837){return BPromise['reject'](_0x335837);}return _0xe7b764[_0xc484('0x24')]();};}function saveUpdates(_0x353021,_0x402362){return function(_0x5abd36){if(_0x5abd36){return _0x5abd36[_0xc484('0x25')](_0x353021)[_0xc484('0x26')](function(_0x43f6eb){return _0x43f6eb;});}return null;};}function removeEntity(_0x5606ff,_0x188fb8){return function(_0x1d9bb2){if(_0x1d9bb2){return _0x1d9bb2[_0xc484('0x27')]()[_0xc484('0x26')](function(){_0x5606ff[_0xc484('0x1b')](0xcc)[_0xc484('0x1a')]();});}};}function handleEntityNotFound(_0x140282,_0x4617fb){return function(_0x4c8af9){if(!_0x4c8af9){_0x140282[_0xc484('0x19')](0x194);}return _0x4c8af9;};}function handleError(_0x3785c0,_0x187975){_0x187975=_0x187975||0x1f4;return function(_0x1099dd){logger[_0xc484('0x28')](_0x1099dd[_0xc484('0x29')]);if(_0x1099dd[_0xc484('0x2a')]){delete _0x1099dd[_0xc484('0x2a')];}_0x3785c0[_0xc484('0x1b')](_0x187975)['send'](_0x1099dd);};}exports['index']=function(_0x3cdc57,_0x2895b2){var _0xacc72b={},_0x42da1a={},_0x16900d={'count':0x0,'rows':[]};var _0xa989cd=_[_0xc484('0x2b')](db[_0xc484('0x2c')][_0xc484('0x2d')],function(_0x5afc43){return{'name':_0x5afc43[_0xc484('0x2e')],'type':_0x5afc43[_0xc484('0x2f')][_0xc484('0x30')]};});_0x42da1a[_0xc484('0x31')]=_[_0xc484('0x2b')](_0xa989cd,_0xc484('0x2a'));_0x42da1a[_0xc484('0x32')]=_[_0xc484('0x33')](_0x3cdc57[_0xc484('0x32')]);_0x42da1a[_0xc484('0x34')]=_[_0xc484('0x35')](_0x42da1a['model'],_0x42da1a['query']);_0xacc72b['attributes']=_[_0xc484('0x35')](_0x42da1a[_0xc484('0x31')],qs[_0xc484('0x36')](_0x3cdc57[_0xc484('0x32')]['fields']));_0xacc72b['attributes']=_0xacc72b[_0xc484('0x37')]['length']?_0xacc72b[_0xc484('0x37')]:_0x42da1a[_0xc484('0x31')];if(!_0x3cdc57[_0xc484('0x32')][_0xc484('0x38')]('nolimit')){_0xacc72b['limit']=qs[_0xc484('0x1d')](_0x3cdc57[_0xc484('0x32')][_0xc484('0x1d')]);_0xacc72b[_0xc484('0x1c')]=qs['offset'](_0x3cdc57[_0xc484('0x32')]['offset']);}_0xacc72b[_0xc484('0x39')]=qs['sort'](_0x3cdc57['query'][_0xc484('0x3a')]);_0xacc72b[_0xc484('0x3b')]=qs[_0xc484('0x34')](_[_0xc484('0x3c')](_0x3cdc57['query'],_0x42da1a[_0xc484('0x34')]),_0xa989cd);if(_0x3cdc57[_0xc484('0x32')][_0xc484('0x3d')]){_0xacc72b[_0xc484('0x3b')]=_[_0xc484('0x3e')](_0xacc72b['where'],{'$or':_[_0xc484('0x2b')](_0xa989cd,function(_0x377cb6){if(_0x377cb6[_0xc484('0x2f')]!==_0xc484('0x3f')){var _0x41832e={};_0x41832e[_0x377cb6['name']]={'$like':'%'+_0x3cdc57[_0xc484('0x32')][_0xc484('0x3d')]+'%'};return _0x41832e;}})});}_0xacc72b=_['merge']({},_0xacc72b,_0x3cdc57['options']);var _0x3cd109={'where':_0xacc72b['where']};return db[_0xc484('0x2c')][_0xc484('0x1f')](_0x3cd109)[_0xc484('0x26')](function(_0x4c5673){_0x16900d['count']=_0x4c5673;if(_0x3cdc57[_0xc484('0x32')][_0xc484('0x40')]){_0xacc72b[_0xc484('0x41')]=[{'all':!![]}];}return db[_0xc484('0x2c')]['findAll'](_0xacc72b);})[_0xc484('0x26')](function(_0x3447a7){_0x16900d['rows']=_0x3447a7;return _0x16900d;})[_0xc484('0x26')](respondWithFilteredResult(_0x2895b2,_0xacc72b))[_0xc484('0x42')](handleError(_0x2895b2,null));};exports[_0xc484('0x43')]=function(_0x103d49,_0x366916){var _0x21adca={'raw':!![],'where':{'id':_0x103d49[_0xc484('0x44')]['id']}},_0x5af51c={};_0x5af51c['model']=_[_0xc484('0x33')](db[_0xc484('0x2c')][_0xc484('0x2d')]);_0x5af51c['query']=_[_0xc484('0x33')](_0x103d49[_0xc484('0x32')]);_0x5af51c[_0xc484('0x34')]=_[_0xc484('0x35')](_0x5af51c['model'],_0x5af51c[_0xc484('0x32')]);_0x21adca[_0xc484('0x37')]=_[_0xc484('0x35')](_0x5af51c['model'],qs[_0xc484('0x36')](_0x103d49[_0xc484('0x32')][_0xc484('0x36')]));_0x21adca[_0xc484('0x37')]=_0x21adca[_0xc484('0x37')][_0xc484('0x45')]?_0x21adca[_0xc484('0x37')]:_0x5af51c[_0xc484('0x31')];if(_0x103d49[_0xc484('0x32')][_0xc484('0x40')]){_0x21adca[_0xc484('0x41')]=[{'all':!![]}];}_0x21adca=_[_0xc484('0x3e')]({},_0x21adca,_0x103d49[_0xc484('0x46')]);return db[_0xc484('0x2c')]['find'](_0x21adca)[_0xc484('0x26')](handleEntityNotFound(_0x366916,null))['then'](respondWithResult(_0x366916,null))[_0xc484('0x42')](handleError(_0x366916,null));};exports[_0xc484('0x47')]=function(_0x149a16,_0xc2c381){return db[_0xc484('0x2c')][_0xc484('0x47')](_0x149a16['body'],{})[_0xc484('0x26')](respondWithResult(_0xc2c381,0xc9))[_0xc484('0x42')](handleError(_0xc2c381,null));};exports[_0xc484('0x25')]=function(_0x41ed85,_0x3fc07c){if(_0x41ed85[_0xc484('0x48')]['id']){delete _0x41ed85[_0xc484('0x48')]['id'];}return db[_0xc484('0x2c')][_0xc484('0x49')]({'where':{'id':_0x41ed85[_0xc484('0x44')]['id']}})['then'](handleEntityNotFound(_0x3fc07c,null))[_0xc484('0x26')](saveUpdates(_0x41ed85[_0xc484('0x48')],null))[_0xc484('0x26')](respondWithResult(_0x3fc07c,null))[_0xc484('0x42')](handleError(_0x3fc07c,null));};exports[_0xc484('0x27')]=function(_0x6b6266,_0x3b59b7){return db[_0xc484('0x2c')][_0xc484('0x49')]({'where':{'id':_0x6b6266[_0xc484('0x44')]['id']}})[_0xc484('0x26')](handleEntityNotFound(_0x3b59b7,null))[_0xc484('0x26')](removeEntity(_0x3b59b7,null))[_0xc484('0x42')](handleError(_0x3b59b7,null));}; \ No newline at end of file +var _0x2568=['reject','save','update','destroy','status','end','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','then','includeAll','findAll','catch','show','params','include','options','SmsApplication','body','find','eml-format','rimraf','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','offset','undefined','count','limit','set','Content-Range'];(function(_0x5d0b40,_0x5c1ac6){var _0x16259b=function(_0x22661b){while(--_0x22661b){_0x5d0b40['push'](_0x5d0b40['shift']());}};_0x16259b(++_0x5c1ac6);}(_0x2568,0x192));var _0x8256=function(_0x3738ae,_0x7a360e){_0x3738ae=_0x3738ae-0x0;var _0x38e539=_0x2568[_0x3738ae];return _0x38e539;};'use strict';var emlformat=require(_0x8256('0x0'));var rimraf=require(_0x8256('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8256('0x2'));var rp=require(_0x8256('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8256('0x4'));var path=require(_0x8256('0x5'));var sox=require('sox');var csv=require(_0x8256('0x6'));var ejs=require(_0x8256('0x7'));var fs=require('fs');var fs_extra=require(_0x8256('0x8'));var _=require(_0x8256('0x9'));var squel=require(_0x8256('0xa'));var crypto=require(_0x8256('0xb'));var jsforce=require(_0x8256('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8256('0x6'));var querystring=require(_0x8256('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8256('0xe'));var qs=require(_0x8256('0xf'));var as=require(_0x8256('0x10'));var hardwareService=require(_0x8256('0x11'));var logger=require(_0x8256('0x12'))(_0x8256('0x13'));var utils=require(_0x8256('0x14'));var config=require(_0x8256('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8256('0x16'))['db'];function respondWithStatusCode(_0x5e4be1,_0xf74664){_0xf74664=_0xf74664||0xcc;return function(_0x22354d){if(_0x22354d){return _0x5e4be1[_0x8256('0x17')](_0xf74664);}return _0x5e4be1['status'](_0xf74664)['end']();};}function respondWithResult(_0xeae90b,_0x43f9a7){_0x43f9a7=_0x43f9a7||0xc8;return function(_0x22ad3b){if(_0x22ad3b){return _0xeae90b['status'](_0x43f9a7)['json'](_0x22ad3b);}};}function respondWithFilteredResult(_0x1f0caa,_0x3772b4){return function(_0x4d9e7f){if(_0x4d9e7f){var _0x460464=typeof _0x3772b4[_0x8256('0x18')]===_0x8256('0x19')&&typeof _0x3772b4['limit']==='undefined';var _0x1942dd=_0x4d9e7f[_0x8256('0x1a')];var _0x3c44dd=_0x460464?0x0:_0x3772b4[_0x8256('0x18')];var _0x18c2c9=_0x460464?_0x4d9e7f['count']:_0x3772b4['offset']+_0x3772b4[_0x8256('0x1b')];var _0x5ab950;if(_0x18c2c9>=_0x1942dd){_0x18c2c9=_0x1942dd;_0x5ab950=0xc8;}else{_0x5ab950=0xce;}_0x1f0caa['status'](_0x5ab950);return _0x1f0caa[_0x8256('0x1c')](_0x8256('0x1d'),_0x3c44dd+'-'+_0x18c2c9+'/'+_0x1942dd)['json'](_0x4d9e7f);}return null;};}function patchUpdates(_0x3c1fb5){return function(_0x143051){try{jsonpatch['apply'](_0x143051,_0x3c1fb5,!![]);}catch(_0x2d4c54){return BPromise[_0x8256('0x1e')](_0x2d4c54);}return _0x143051[_0x8256('0x1f')]();};}function saveUpdates(_0x2e8da5,_0x3b5747){return function(_0x5e42a9){if(_0x5e42a9){return _0x5e42a9[_0x8256('0x20')](_0x2e8da5)['then'](function(_0x3f9f59){return _0x3f9f59;});}return null;};}function removeEntity(_0x32b331,_0x50d6a8){return function(_0xfa8c2f){if(_0xfa8c2f){return _0xfa8c2f[_0x8256('0x21')]()['then'](function(){_0x32b331[_0x8256('0x22')](0xcc)[_0x8256('0x23')]();});}};}function handleEntityNotFound(_0x39981d,_0x4b2d91){return function(_0x476001){if(!_0x476001){_0x39981d[_0x8256('0x17')](0x194);}return _0x476001;};}function handleError(_0x53a345,_0x574b90){_0x574b90=_0x574b90||0x1f4;return function(_0x486832){logger['error'](_0x486832[_0x8256('0x24')]);if(_0x486832[_0x8256('0x25')]){delete _0x486832[_0x8256('0x25')];}_0x53a345[_0x8256('0x22')](_0x574b90)[_0x8256('0x26')](_0x486832);};}exports[_0x8256('0x27')]=function(_0x30d888,_0x325ad8){var _0x49eb01={},_0x1a4ec6={},_0x443e9d={'count':0x0,'rows':[]};var _0x4727fb=_['map'](db['SmsApplication'][_0x8256('0x28')],function(_0x1e4f43){return{'name':_0x1e4f43['fieldName'],'type':_0x1e4f43[_0x8256('0x29')][_0x8256('0x2a')]};});_0x1a4ec6[_0x8256('0x2b')]=_[_0x8256('0x2c')](_0x4727fb,_0x8256('0x25'));_0x1a4ec6[_0x8256('0x2d')]=_[_0x8256('0x2e')](_0x30d888[_0x8256('0x2d')]);_0x1a4ec6['filters']=_['intersection'](_0x1a4ec6['model'],_0x1a4ec6[_0x8256('0x2d')]);_0x49eb01[_0x8256('0x2f')]=_[_0x8256('0x30')](_0x1a4ec6['model'],qs[_0x8256('0x31')](_0x30d888['query']['fields']));_0x49eb01[_0x8256('0x2f')]=_0x49eb01[_0x8256('0x2f')][_0x8256('0x32')]?_0x49eb01[_0x8256('0x2f')]:_0x1a4ec6[_0x8256('0x2b')];if(!_0x30d888[_0x8256('0x2d')][_0x8256('0x33')](_0x8256('0x34'))){_0x49eb01[_0x8256('0x1b')]=qs[_0x8256('0x1b')](_0x30d888[_0x8256('0x2d')][_0x8256('0x1b')]);_0x49eb01[_0x8256('0x18')]=qs[_0x8256('0x18')](_0x30d888[_0x8256('0x2d')][_0x8256('0x18')]);}_0x49eb01[_0x8256('0x35')]=qs[_0x8256('0x36')](_0x30d888['query'][_0x8256('0x36')]);_0x49eb01[_0x8256('0x37')]=qs[_0x8256('0x38')](_[_0x8256('0x39')](_0x30d888[_0x8256('0x2d')],_0x1a4ec6[_0x8256('0x38')]),_0x4727fb);if(_0x30d888['query'][_0x8256('0x3a')]){_0x49eb01['where']=_[_0x8256('0x3b')](_0x49eb01[_0x8256('0x37')],{'$or':_['map'](_0x4727fb,function(_0x33d3d0){if(_0x33d3d0[_0x8256('0x29')]!==_0x8256('0x3c')){var _0x4869db={};_0x4869db[_0x33d3d0[_0x8256('0x25')]]={'$like':'%'+_0x30d888[_0x8256('0x2d')][_0x8256('0x3a')]+'%'};return _0x4869db;}})});}_0x49eb01=_['merge']({},_0x49eb01,_0x30d888['options']);var _0x19500e={'where':_0x49eb01[_0x8256('0x37')]};return db['SmsApplication'][_0x8256('0x1a')](_0x19500e)[_0x8256('0x3d')](function(_0x207097){_0x443e9d[_0x8256('0x1a')]=_0x207097;if(_0x30d888[_0x8256('0x2d')][_0x8256('0x3e')]){_0x49eb01['include']=[{'all':!![]}];}return db['SmsApplication'][_0x8256('0x3f')](_0x49eb01);})[_0x8256('0x3d')](function(_0xd706a8){_0x443e9d['rows']=_0xd706a8;return _0x443e9d;})[_0x8256('0x3d')](respondWithFilteredResult(_0x325ad8,_0x49eb01))[_0x8256('0x40')](handleError(_0x325ad8,null));};exports[_0x8256('0x41')]=function(_0x4d40fa,_0x2362dd){var _0x133110={'raw':!![],'where':{'id':_0x4d40fa[_0x8256('0x42')]['id']}},_0x1e04f8={};_0x1e04f8[_0x8256('0x2b')]=_['keys'](db['SmsApplication']['rawAttributes']);_0x1e04f8[_0x8256('0x2d')]=_[_0x8256('0x2e')](_0x4d40fa['query']);_0x1e04f8[_0x8256('0x38')]=_[_0x8256('0x30')](_0x1e04f8[_0x8256('0x2b')],_0x1e04f8[_0x8256('0x2d')]);_0x133110[_0x8256('0x2f')]=_[_0x8256('0x30')](_0x1e04f8['model'],qs['fields'](_0x4d40fa[_0x8256('0x2d')]['fields']));_0x133110[_0x8256('0x2f')]=_0x133110[_0x8256('0x2f')][_0x8256('0x32')]?_0x133110[_0x8256('0x2f')]:_0x1e04f8[_0x8256('0x2b')];if(_0x4d40fa[_0x8256('0x2d')]['includeAll']){_0x133110[_0x8256('0x43')]=[{'all':!![]}];}_0x133110=_[_0x8256('0x3b')]({},_0x133110,_0x4d40fa[_0x8256('0x44')]);return db[_0x8256('0x45')]['find'](_0x133110)[_0x8256('0x3d')](handleEntityNotFound(_0x2362dd,null))['then'](respondWithResult(_0x2362dd,null))['catch'](handleError(_0x2362dd,null));};exports['create']=function(_0x3571f9,_0x41fb00){return db[_0x8256('0x45')]['create'](_0x3571f9[_0x8256('0x46')],{})[_0x8256('0x3d')](respondWithResult(_0x41fb00,0xc9))[_0x8256('0x40')](handleError(_0x41fb00,null));};exports[_0x8256('0x20')]=function(_0x9dc2ce,_0x4c352e){if(_0x9dc2ce[_0x8256('0x46')]['id']){delete _0x9dc2ce['body']['id'];}return db[_0x8256('0x45')][_0x8256('0x47')]({'where':{'id':_0x9dc2ce[_0x8256('0x42')]['id']}})[_0x8256('0x3d')](handleEntityNotFound(_0x4c352e,null))['then'](saveUpdates(_0x9dc2ce[_0x8256('0x46')],null))['then'](respondWithResult(_0x4c352e,null))[_0x8256('0x40')](handleError(_0x4c352e,null));};exports[_0x8256('0x21')]=function(_0x8d311c,_0x5b245f){return db[_0x8256('0x45')][_0x8256('0x47')]({'where':{'id':_0x8d311c[_0x8256('0x42')]['id']}})[_0x8256('0x3d')](handleEntityNotFound(_0x5b245f,null))[_0x8256('0x3d')](removeEntity(_0x5b245f,null))['catch'](handleError(_0x5b245f,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 83ef89c..7984e24 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 _0x7f2d=['bluebird','request-promise','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment'];(function(_0x32ac5a,_0x2a5a44){var _0x57649d=function(_0x529dd2){while(--_0x529dd2){_0x32ac5a['push'](_0x32ac5a['shift']());}};_0x57649d(++_0x2a5a44);}(_0x7f2d,0x1ea));var _0xd7f2=function(_0x23f769,_0x462b22){_0x23f769=_0x23f769-0x0;var _0x14bfac=_0x7f2d[_0x23f769];return _0x14bfac;};'use strict';var _=require(_0xd7f2('0x0'));var util=require(_0xd7f2('0x1'));var logger=require('../../config/logger')(_0xd7f2('0x2'));var moment=require(_0xd7f2('0x3'));var BPromise=require(_0xd7f2('0x4'));var rp=require(_0xd7f2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd7f2('0x6'));module[_0xd7f2('0x7')]=function(_0x1366ff,_0x212421){return _0x1366ff[_0xd7f2('0x8')](_0xd7f2('0x9'),attributes,{'tableName':_0xd7f2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd7f2('0xb'),'collate':_0xd7f2('0xc')});}; \ No newline at end of file +var _0x37ba=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications'];(function(_0x33f072,_0x43f623){var _0x493ccd=function(_0x41e75d){while(--_0x41e75d){_0x33f072['push'](_0x33f072['shift']());}};_0x493ccd(++_0x43f623);}(_0x37ba,0x113));var _0xa37b=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x37ba[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0xa37b('0x0'));var util=require('util');var logger=require(_0xa37b('0x1'))('api');var moment=require(_0xa37b('0x2'));var BPromise=require('bluebird');var rp=require(_0xa37b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa37b('0x4'));var config=require(_0xa37b('0x5'));var attributes=require(_0xa37b('0x6'));module[_0xa37b('0x7')]=function(_0x4e070c,_0x33fd7d){return _0x4e070c[_0xa37b('0x8')](_0xa37b('0x9'),attributes,{'tableName':_0xa37b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa37b('0xb'),'collate':_0xa37b('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 677a2a9..9e95b64 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 _0x4c50=['moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x29f68d,_0x20a0e9){var _0x2184fa=function(_0x407c57){while(--_0x407c57){_0x29f68d['push'](_0x29f68d['shift']());}};_0x2184fa(++_0x20a0e9);}(_0x4c50,0x10f));var _0x04c5=function(_0x3226cb,_0x2996e3){_0x3226cb=_0x3226cb-0x0;var _0x4447ad=_0x4c50[_0x3226cb];return _0x4447ad;};'use strict';var _=require(_0x04c5('0x0'));var util=require(_0x04c5('0x1'));var moment=require(_0x04c5('0x2'));var BPromise=require(_0x04c5('0x3'));var rs=require(_0x04c5('0x4'));var fs=require('fs');var Redis=require(_0x04c5('0x5'));var db=require(_0x04c5('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x04c5('0x7'));var config=require(_0x04c5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x04c5('0x9')][_0x04c5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22535c,_0x34961a,_0x1fb2db){return new BPromise(function(_0x40a846,_0x411e7f){return client[_0x04c5('0xb')](_0x22535c,_0x1fb2db)['then'](function(_0x4ebad1){logger['info'](_0x04c5('0xc'),_0x34961a,_0x04c5('0xd'));logger[_0x04c5('0xe')](_0x04c5('0xf'),_0x34961a,_0x04c5('0xd'),JSON[_0x04c5('0x10')](_0x4ebad1));if(_0x4ebad1[_0x04c5('0x11')]){if(_0x4ebad1[_0x04c5('0x11')][_0x04c5('0x12')]===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x34961a,_0x4ebad1[_0x04c5('0x11')][_0x04c5('0x13')]);return _0x411e7f(_0x4ebad1['error'][_0x04c5('0x13')]);}logger[_0x04c5('0x11')](_0x04c5('0xc'),_0x34961a,_0x4ebad1[_0x04c5('0x11')][_0x04c5('0x13')]);return _0x40a846(_0x4ebad1['error']['message']);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0x34961a,'request\x20sent');_0x40a846(_0x4ebad1[_0x04c5('0x14')]['message']);}})['catch'](function(_0x1ee3a0){logger[_0x04c5('0x11')]('SmsApplication,\x20%s,\x20%s',_0x34961a,_0x1ee3a0);_0x411e7f(_0x1ee3a0);});});} \ No newline at end of file +var _0x17a7=['SmsApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info'];(function(_0x344e99,_0x530098){var _0x172d28=function(_0x1e68f4){while(--_0x1e68f4){_0x344e99['push'](_0x344e99['shift']());}};_0x172d28(++_0x530098);}(_0x17a7,0xc2));var _0x717a=function(_0x5217df,_0x4360ff){_0x5217df=_0x5217df-0x0;var _0x2b308d=_0x17a7[_0x5217df];return _0x2b308d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x717a('0x0'));var rs=require(_0x717a('0x1'));var fs=require('fs');var Redis=require(_0x717a('0x2'));var db=require(_0x717a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x717a('0x4'))('rpc');var config=require(_0x717a('0x5'));var jayson=require(_0x717a('0x6'));var client=jayson['client'][_0x717a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1ca7a6,_0xd7d2ce,_0x311738){return new BPromise(function(_0x536824,_0x1066d4){return client['request'](_0x1ca7a6,_0x311738)[_0x717a('0x8')](function(_0x567130){logger[_0x717a('0x9')](_0x717a('0xa'),_0xd7d2ce,_0x717a('0xb'));logger['debug']('SmsApplication,\x20%s,\x20%s,\x20%s',_0xd7d2ce,_0x717a('0xb'),JSON[_0x717a('0xc')](_0x567130));if(_0x567130[_0x717a('0xd')]){if(_0x567130[_0x717a('0xd')][_0x717a('0xe')]===0x1f4){logger['error'](_0x717a('0xa'),_0xd7d2ce,_0x567130['error'][_0x717a('0xf')]);return _0x1066d4(_0x567130['error']['message']);}logger['error']('SmsApplication,\x20%s,\x20%s',_0xd7d2ce,_0x567130[_0x717a('0xd')]['message']);return _0x536824(_0x567130[_0x717a('0xd')]['message']);}else{logger[_0x717a('0x9')]('SmsApplication,\x20%s,\x20%s',_0xd7d2ce,_0x717a('0xb'));_0x536824(_0x567130[_0x717a('0x10')][_0x717a('0xf')]);}})['catch'](function(_0x186b4d){logger['error'](_0x717a('0xa'),_0xd7d2ce,_0x186b4d);_0x1066d4(_0x186b4d);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index faaf03b..7d1ab62 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 _0x5eb8=['smsinteraction:update','update','delete','smsinteraction:destroy','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put'];(function(_0x116d47,_0x334c20){var _0x38fdd2=function(_0x21d23e){while(--_0x21d23e){_0x116d47['push'](_0x116d47['shift']());}};_0x38fdd2(++_0x334c20);}(_0x5eb8,0xb0));var _0x85eb=function(_0x3d4ef1,_0x5a957c){_0x3d4ef1=_0x3d4ef1-0x0;var _0x409423=_0x5eb8[_0x3d4ef1];return _0x409423;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['get'](_0x85eb('0xe'),auth['isAuthenticated'](),controller[_0x85eb('0xf')]);router[_0x85eb('0x9')](_0x85eb('0x10'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x11')]);router[_0x85eb('0x9')](_0x85eb('0x12'),auth['isAuthenticated'](),controller[_0x85eb('0x13')]);router[_0x85eb('0x14')]('/',auth['isAuthenticated'](),controller[_0x85eb('0x15')]);router[_0x85eb('0x14')](_0x85eb('0x10'),auth[_0x85eb('0xa')](),controller['addMessage']);router['post'](_0x85eb('0x16'),auth['isAuthenticated'](),interaction[_0x85eb('0x17')](_0x85eb('0x18'),_0x85eb('0x19')),controller[_0x85eb('0x1a')]);router[_0x85eb('0x1b')]('/:id',auth[_0x85eb('0xa')](),interaction['tracked'](_0x85eb('0x18'),_0x85eb('0x1c')),controller[_0x85eb('0x1d')]);router[_0x85eb('0x1e')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x85eb('0x18'),_0x85eb('0x1f')),controller[_0x85eb('0x20')]);router[_0x85eb('0x1e')](_0x85eb('0x16'),auth[_0x85eb('0xa')](),controller['removeTags']);module[_0x85eb('0x21')]=router; \ No newline at end of file +var _0x2032=['./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','create','/:id/tags','sms','smsinteraction:addtags','addTags','put','/:id','tracked','smsinteraction:update','update','smsinteraction:destroy','delete','removeTags','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x19cfac,_0x3745dc){var _0x25d2a5=function(_0x2bad78){while(--_0x2bad78){_0x19cfac['push'](_0x19cfac['shift']());}};_0x25d2a5(++_0x3745dc);}(_0x2032,0xd9));var _0x2203=function(_0x288a1d,_0x4f954c){_0x288a1d=_0x288a1d-0x0;var _0x4f480e=_0x2032[_0x288a1d];return _0x4f480e;};'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['post']('/',auth[_0x2203('0x9')](),controller[_0x2203('0x12')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router['post'](_0x2203('0x13'),auth['isAuthenticated'](),interaction['tracked'](_0x2203('0x14'),_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0x18'),auth[_0x2203('0x9')](),interaction[_0x2203('0x19')](_0x2203('0x14'),_0x2203('0x1a')),controller[_0x2203('0x1b')]);router['delete'](_0x2203('0x18'),auth[_0x2203('0x9')](),interaction['tracked'](_0x2203('0x14'),_0x2203('0x1c')),controller['destroy']);router[_0x2203('0x1d')]('/:id/tags',auth[_0x2203('0x9')](),controller[_0x2203('0x1e')]);module[_0x2203('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index f02ec80..586b59f 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 _0xe35c=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0x1ab758,_0x3dbede){var _0x5788a0=function(_0x324d24){while(--_0x324d24){_0x1ab758['push'](_0x1ab758['shift']());}};_0x5788a0(++_0x3dbede);}(_0xe35c,0x146));var _0xce35=function(_0x1b8e33,_0xce6db5){_0x1b8e33=_0x1b8e33-0x0;var _0xd2a5b9=_0xe35c[_0x1b8e33];return _0xd2a5b9;};'use strict';var Sequelize=require(_0xce35('0x0'));var moment=require(_0xce35('0x1'));module[_0xce35('0x2')]={'closed':{'type':Sequelize[_0xce35('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xce35('0x4')]},'disposition':{'type':Sequelize[_0xce35('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xce35('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xce35('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xce35('0x6')]('in',_0xce35('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xce35('0x6')]('in',_0xce35('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xce35('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x9330=['sequelize','BOOLEAN','STRING','DATE','ENUM','out'];(function(_0x501864,_0xb33d3f){var _0x32bfc0=function(_0x1f9395){while(--_0x1f9395){_0x501864['push'](_0x501864['shift']());}};_0x32bfc0(++_0xb33d3f);}(_0x9330,0x14a));var _0x0933=function(_0xacb4c1,_0x48e800){_0xacb4c1=_0xacb4c1-0x0;var _0x49ff5b=_0x9330[_0xacb4c1];return _0x49ff5b;};'use strict';var Sequelize=require(_0x0933('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0x0933('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x0933('0x2')]},'thirdDisposition':{'type':Sequelize[_0x0933('0x2')]},'note':{'type':Sequelize[_0x0933('0x2')]},'phone':{'type':Sequelize[_0x0933('0x2')]},'read1stAt':{'type':Sequelize[_0x0933('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0933('0x4')]('in',_0x0933('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x0933('0x4')]('in',_0x0933('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0933('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index d0ebeb9..53bfc0c 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 _0x2731=['omit','ids','getMessages','findOne','nolimit','limit','order','sort','where','pick','SmsInteractionId','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','Tag','color','emit','removeTags','download','unix','toString','join','root','server','tmp','format','push','User','fullname','CmContact','lastName','Messages','direction','secret','read','SmsAccount','Account','Owner','get','mkdirSync','N.A.','createdAt','closedAt','disposition','filter','System','Contact','firstName','out','value','renderFile','views','downloadInteraction.ejs','.pdf','Sms','createPdfFromHTML','log','err','rimraf','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','SmsInteraction','fieldName','type','key','findAll','query','user','catch','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','params','describe','addMessage','SmsMessage'];(function(_0x24e373,_0x2bd453){var _0x2bf3ea=function(_0xfac880){while(--_0xfac880){_0x24e373['push'](_0x24e373['shift']());}};_0x2bf3ea(++_0x2bd453);}(_0x2731,0xbb));var _0x1273=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2731[_0x20a584];return _0x4b41a8;};'use strict';var rimraf=require(_0x1273('0x0'));var zipdir=require('zip-dir');var moment=require(_0x1273('0x1'));var BPromise=require(_0x1273('0x2'));var util=require(_0x1273('0x3'));var path=require(_0x1273('0x4'));var ejs=require(_0x1273('0x5'));var fs=require('fs');var _=require(_0x1273('0x6'));var Redis=require(_0x1273('0x7'));var interaction=require(_0x1273('0x8'));var qs=require(_0x1273('0x9'));var pdf=require(_0x1273('0xa'));var logger=require(_0x1273('0xb'))('api');var config=require(_0x1273('0xc'));var db=require(_0x1273('0xd'))['db'];config[_0x1273('0xe')]=_[_0x1273('0xf')](config['redis'],{'host':_0x1273('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1273('0x11'))[_0x1273('0x12')](socket);function respondWithStatusCode(_0x188776,_0x48ee9d){_0x48ee9d=_0x48ee9d||0xcc;return function(_0x5461c7){if(_0x5461c7){return _0x188776[_0x1273('0x13')](_0x48ee9d);}return _0x188776[_0x1273('0x14')](_0x48ee9d)[_0x1273('0x15')]();};}function respondWithResult(_0x28ac33,_0x33c526){_0x33c526=_0x33c526||0xc8;return function(_0x3b9bce){if(_0x3b9bce){return _0x28ac33[_0x1273('0x14')](_0x33c526)[_0x1273('0x16')](_0x3b9bce);}};}function respondWithFilteredResult(_0x3fc1ca,_0x278d63){return function(_0x176c8d){if(_0x176c8d){var _0xfc1931=typeof _0x278d63[_0x1273('0x17')]===_0x1273('0x18')&&typeof _0x278d63['limit']===_0x1273('0x18');var _0x465f7f=_0x176c8d[_0x1273('0x19')];var _0xe3f95d=_0xfc1931?0x0:_0x278d63[_0x1273('0x17')];var _0x4d3b61=_0xfc1931?_0x176c8d[_0x1273('0x19')]:_0x278d63['offset']+_0x278d63['limit'];var _0x2d63e9;if(_0x4d3b61>=_0x465f7f){_0x4d3b61=_0x465f7f;_0x2d63e9=0xc8;}else{_0x2d63e9=0xce;}_0x3fc1ca[_0x1273('0x14')](_0x2d63e9);return _0x3fc1ca[_0x1273('0x1a')](_0x1273('0x1b'),_0xe3f95d+'-'+_0x4d3b61+'/'+_0x465f7f)[_0x1273('0x16')](_0x176c8d);}return null;};}function saveUpdates(_0x3167e2){return function(_0x34cb55){if(_0x34cb55){return _0x34cb55[_0x1273('0x1c')](_0x3167e2)[_0x1273('0x1d')](function(_0x57e1d4){return _0x57e1d4;});}return null;};}function removeEntity(_0x59f894){return function(_0x236298){if(_0x236298){return _0x236298[_0x1273('0x1e')]()['then'](function(){_0x59f894[_0x1273('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50780c){return function(_0x15d1de){if(!_0x15d1de){_0x50780c[_0x1273('0x13')](0x194);}return _0x15d1de;};}function handleError(_0x676424,_0xb912f){_0xb912f=_0xb912f||0x1f4;return function(_0x113382){logger[_0x1273('0x1f')](_0x113382[_0x1273('0x20')]);if(_0x113382[_0x1273('0x21')]){delete _0x113382[_0x1273('0x21')];}_0x676424['status'](_0xb912f)[_0x1273('0x22')](_0x113382);};}exports[_0x1273('0x23')]=function(_0x3206fe,_0x234795){var _0x4ed731={};var _0x3fe32b=_['map'](db[_0x1273('0x24')]['rawAttributes'],function(_0x42726a){return{'name':_0x42726a[_0x1273('0x25')],'type':_0x42726a[_0x1273('0x26')][_0x1273('0x27')]};});_0x4ed731=qs['getOptions'](_0x3fe32b,_0x3206fe);return interaction[_0x1273('0x28')]('sms',_0x3206fe[_0x1273('0x29')],_0x3206fe[_0x1273('0x2a')],_0x4ed731,_0x3fe32b)[_0x1273('0x1d')](respondWithFilteredResult(_0x234795,_0x4ed731))[_0x1273('0x2b')](handleError(_0x234795,null));};exports['show']=function(_0xa399d4,_0x17721b){var _0x56fea0={'raw':![],'where':{'id':_0xa399d4['params']['id']}},_0x3af70d={};_0x3af70d[_0x1273('0x2c')]=_[_0x1273('0x2d')](db[_0x1273('0x24')][_0x1273('0x2e')]);_0x3af70d[_0x1273('0x29')]=_[_0x1273('0x2d')](_0xa399d4[_0x1273('0x29')]);_0x3af70d[_0x1273('0x2f')]=_[_0x1273('0x30')](_0x3af70d['model'],_0x3af70d['query']);_0x56fea0[_0x1273('0x31')]=_['intersection'](_0x3af70d[_0x1273('0x2c')],qs[_0x1273('0x32')](_0xa399d4[_0x1273('0x29')][_0x1273('0x32')]));_0x56fea0[_0x1273('0x31')]=_0x56fea0[_0x1273('0x31')][_0x1273('0x33')]?_0x56fea0['attributes']:_0x3af70d[_0x1273('0x2c')];if(_0xa399d4['query'][_0x1273('0x34')]){_0x56fea0[_0x1273('0x35')]=[{'all':!![]}];}_0x56fea0=_[_0x1273('0x36')]({},_0x56fea0,_0xa399d4[_0x1273('0x37')]);return db['SmsInteraction'][_0x1273('0x38')](_0x56fea0)[_0x1273('0x1d')](handleEntityNotFound(_0x17721b,null))[_0x1273('0x1d')](respondWithResult(_0x17721b,null))[_0x1273('0x2b')](handleError(_0x17721b,null));};exports[_0x1273('0x39')]=function(_0x22145f,_0x5de79f){return db['SmsInteraction']['create'](_0x22145f['body'],{})[_0x1273('0x1d')](respondWithResult(_0x5de79f,0xc9))['catch'](handleError(_0x5de79f,null));};exports[_0x1273('0x1c')]=function(_0x2f2035,_0xa0d863){if(_0x2f2035[_0x1273('0x3a')]['id']){delete _0x2f2035[_0x1273('0x3a')]['id'];}return db[_0x1273('0x24')]['find']({'where':{'id':_0x2f2035[_0x1273('0x3b')]['id']}})[_0x1273('0x1d')](handleEntityNotFound(_0xa0d863,null))['then'](saveUpdates(_0x2f2035[_0x1273('0x3a')],null))[_0x1273('0x1d')](respondWithResult(_0xa0d863,null))[_0x1273('0x2b')](handleError(_0xa0d863,null));};exports[_0x1273('0x1e')]=function(_0x2efb3b,_0x23ddec){return db[_0x1273('0x24')][_0x1273('0x38')]({'where':{'id':_0x2efb3b[_0x1273('0x3b')]['id']}})[_0x1273('0x1d')](handleEntityNotFound(_0x23ddec,null))[_0x1273('0x1d')](removeEntity(_0x23ddec,null))[_0x1273('0x2b')](handleError(_0x23ddec,null));};exports[_0x1273('0x3c')]=function(_0x4e9085,_0x59dc59){return db[_0x1273('0x24')][_0x1273('0x3c')]()[_0x1273('0x1d')](respondWithResult(_0x59dc59,null))[_0x1273('0x2b')](handleError(_0x59dc59,null));};exports[_0x1273('0x3d')]=function(_0x2c238d,_0x1a751c){return db[_0x1273('0x3e')]['find']({'where':{'id':_0x2c238d[_0x1273('0x3b')]['id']}})[_0x1273('0x1d')](handleEntityNotFound(_0x1a751c,null))[_0x1273('0x1d')](function(_0x383ba5){if(_0x383ba5){return _0x383ba5[_0x1273('0x3d')](_0x2c238d['body']['ids'],_[_0x1273('0x3f')](_0x2c238d[_0x1273('0x3a')],[_0x1273('0x40'),'id'])||{});}})[_0x1273('0x1d')](respondWithResult(_0x1a751c,null))[_0x1273('0x2b')](handleError(_0x1a751c,null));};exports[_0x1273('0x41')]=function(_0x1a9a98,_0x4f6b06){var _0x141e95={'raw':![],'where':{}};var _0x54eed5={};var _0x25aaad={'count':0x0,'rows':[]};return db[_0x1273('0x24')][_0x1273('0x42')]({'where':{'id':_0x1a9a98[_0x1273('0x3b')]['id']}})[_0x1273('0x1d')](handleEntityNotFound(_0x4f6b06,null))['then'](function(_0x23f163){if(_0x23f163){_0x54eed5[_0x1273('0x2c')]=_[_0x1273('0x2d')](db[_0x1273('0x3e')][_0x1273('0x2e')]);_0x54eed5['query']=_['keys'](_0x1a9a98['query']);_0x54eed5['filters']=_['intersection'](_0x54eed5[_0x1273('0x2c')],_0x54eed5[_0x1273('0x29')]);_0x141e95[_0x1273('0x31')]=_[_0x1273('0x30')](_0x54eed5[_0x1273('0x2c')],qs['fields'](_0x1a9a98['query'][_0x1273('0x32')]));_0x141e95[_0x1273('0x31')]=_0x141e95['attributes']['length']?_0x141e95[_0x1273('0x31')]:_0x54eed5['model'];if(!_0x1a9a98['query']['hasOwnProperty'](_0x1273('0x43'))){_0x141e95['limit']=qs[_0x1273('0x44')](_0x1a9a98[_0x1273('0x29')][_0x1273('0x44')]);_0x141e95[_0x1273('0x17')]=qs[_0x1273('0x17')](_0x1a9a98[_0x1273('0x29')][_0x1273('0x17')]);}_0x141e95[_0x1273('0x45')]=qs[_0x1273('0x46')](_0x1a9a98[_0x1273('0x29')][_0x1273('0x46')]);_0x141e95[_0x1273('0x47')]=qs[_0x1273('0x2f')](_[_0x1273('0x48')](_0x1a9a98['query'],_0x54eed5[_0x1273('0x2f')]));_0x141e95[_0x1273('0x47')][_0x1273('0x49')]=_0x23f163['id'];if(_0x1a9a98[_0x1273('0x29')]['filter']){_0x141e95[_0x1273('0x47')]=_[_0x1273('0x36')](_0x141e95['where'],{'$or':_[_0x1273('0x4a')](_0x141e95[_0x1273('0x31')],function(_0xaefbc2){var _0x3938f8={};_0x3938f8[_0xaefbc2]={'$like':'%'+_0x1a9a98[_0x1273('0x29')]['filter']+'%'};return _0x3938f8;})});}if(_0x1a9a98[_0x1273('0x29')][_0x1273('0x4b')]){var _0x541a17=_0x1a9a98[_0x1273('0x29')][_0x1273('0x4b')][_0x1273('0x4c')](',');var _0x4d7767={};_0x4d7767[_0x541a17[0x0]]={'$gte':moment(_0x541a17[0x1])['format'](_0x1273('0x4d'))};_0x141e95['where']=_[_0x1273('0x36')](_0x141e95[_0x1273('0x47')],_0x4d7767);}_0x141e95=_[_0x1273('0x36')]({},_0x141e95,_0x1a9a98[_0x1273('0x37')]);return db[_0x1273('0x3e')]['count']({'where':_0x141e95[_0x1273('0x47')]})['then'](function(_0x2d32eb){_0x25aaad['count']=_0x2d32eb;if(_0x1a9a98[_0x1273('0x29')][_0x1273('0x34')]){_0x141e95[_0x1273('0x35')]=[{'all':!![]}];}return db[_0x1273('0x3e')][_0x1273('0x28')](_0x141e95);})[_0x1273('0x1d')](function(_0x36b8eb){_0x25aaad[_0x1273('0x4e')]=_0x36b8eb;return _0x25aaad;});}})[_0x1273('0x1d')](respondWithFilteredResult(_0x4f6b06,_0x141e95))[_0x1273('0x2b')](handleError(_0x4f6b06,null));};exports[_0x1273('0x4f')]=function(_0x57f1cd,_0xc97a98){return db['SmsInteraction'][_0x1273('0x38')]({'where':{'id':_0x57f1cd[_0x1273('0x3b')]['id']}})['then'](handleEntityNotFound(_0xc97a98,null))[_0x1273('0x1d')](function(_0x44c179){if(_0x44c179){return _0x44c179[_0x1273('0x50')](_0x57f1cd['body'][_0x1273('0x40')],_[_0x1273('0x3f')](_0x57f1cd[_0x1273('0x3a')],['ids','id'])||{})['spread'](function(){return db[_0x1273('0x51')]['findAll']({'attributes':['id',_0x1273('0x21'),_0x1273('0x52')],'where':{'id':_0x57f1cd['body'][_0x1273('0x40')]}});})[_0x1273('0x1d')](function(_0x20ac8f){socket[_0x1273('0x53')]('smsInteractionTags:save',{'id':Number(_0x57f1cd[_0x1273('0x3b')]['id']),'tags':_0x20ac8f||[]});return{'id':Number(_0x57f1cd[_0x1273('0x3b')]['id']),'tags':_0x20ac8f||[]};});}})['then'](respondWithResult(_0xc97a98,null))[_0x1273('0x2b')](handleError(_0xc97a98,null));};exports['removeTags']=function(_0x4d403b,_0x1f8521){return db[_0x1273('0x24')][_0x1273('0x38')]({'where':{'id':_0x4d403b[_0x1273('0x3b')]['id']}})['then'](handleEntityNotFound(_0x1f8521,null))[_0x1273('0x1d')](function(_0x48f81f){if(_0x48f81f){return _0x48f81f[_0x1273('0x54')](_0x4d403b[_0x1273('0x29')]['ids']);}})[_0x1273('0x1d')](respondWithStatusCode(_0x1f8521,null))[_0x1273('0x2b')](handleError(_0x1f8521,null));};exports[_0x1273('0x55')]=function(_0x10b18a,_0x2f1b4c){var _0x5e2bac=moment()[_0x1273('0x56')]()[_0x1273('0x57')]();var _0x483ec2=path[_0x1273('0x58')](config[_0x1273('0x59')],_0x1273('0x5a'),'files',_0x1273('0x5b'));var _0x842b9a=path['join'](_0x483ec2,_0x5e2bac);var _0x138027=util[_0x1273('0x5c')]('transcript-%d-%s.zip',_0x10b18a[_0x1273('0x3b')]['id'],_0x5e2bac);var _0x2f7a0b=path[_0x1273('0x58')](_0x483ec2,_0x138027);var _0x3bb483=[];_0x3bb483[_0x1273('0x5d')]({'model':db[_0x1273('0x5e')],'as':_0x1273('0x5e'),'attributes':['id',_0x1273('0x5f')],'raw':!![]});_0x3bb483['push']({'model':db[_0x1273('0x60')],'as':'Contact','attributes':['id','firstName',_0x1273('0x61')],'raw':!![]});var _0x4c1fb8=[{'model':db[_0x1273('0x3e')],'as':_0x1273('0x62'),'attributes':['id','body','createdAt',_0x1273('0x63'),_0x1273('0x64'),_0x1273('0x65')],'include':_0x3bb483}];_0x4c1fb8[_0x1273('0x5d')]({'model':db[_0x1273('0x66')],'as':_0x1273('0x67'),'attributes':['id','name']});_0x4c1fb8[_0x1273('0x5d')]({'model':db[_0x1273('0x5e')],'as':_0x1273('0x68'),'attributes':['id',_0x1273('0x5f')]});return db[_0x1273('0x24')][_0x1273('0x38')]({'where':{'id':_0x10b18a[_0x1273('0x3b')]['id']},'include':_0x4c1fb8})[_0x1273('0x1d')](handleEntityNotFound(_0x2f1b4c,null))[_0x1273('0x1d')](function(_0x33bbbe){if(_0x33bbbe){var _0x31bd95=_0x33bbbe[_0x1273('0x69')]({'plain':!![]});fs[_0x1273('0x6a')](_0x842b9a);var _0x290ca9={'channel':'Sms','account':_0x31bd95[_0x1273('0x67')]['name'],'agent':_0x31bd95[_0x1273('0x68')]?_0x31bd95['Owner'][_0x1273('0x5f')]:_0x1273('0x6b'),'createdAt':moment(_0x31bd95[_0x1273('0x6c')])['format'](_0x1273('0x4d'))[_0x1273('0x57')](),'closedAt':_0x31bd95['closed']?moment(_0x31bd95[_0x1273('0x6d')])[_0x1273('0x5c')](_0x1273('0x4d'))[_0x1273('0x57')]():'','disposition':_0x31bd95[_0x1273('0x6e')],'messages':_(_0x31bd95['Messages'])[_0x1273('0x6f')]({'secret':![]})[_0x1273('0x4a')](function(_0x76196){return{'date':moment(_0x76196[_0x1273('0x6c')])[_0x1273('0x5c')](_0x1273('0x4d'))[_0x1273('0x57')](),'sender':_0x76196[_0x1273('0x63')]==='out'?_0x76196[_0x1273('0x5e')]?_0x76196['User']['fullname']:_0x1273('0x70'):_0x76196[_0x1273('0x71')][_0x1273('0x72')]+(_0x76196[_0x1273('0x71')][_0x1273('0x61')]?'\x20'+_0x76196[_0x1273('0x71')][_0x1273('0x61')]:''),'body':_0x76196[_0x1273('0x3a')],'direction':_0x76196[_0x1273('0x63')]===_0x1273('0x73')?'A':'C','secret':_0x76196[_0x1273('0x64')],'read':_0x76196['read']};})[_0x1273('0x74')]()};return ejs[_0x1273('0x75')](path['join'](config[_0x1273('0x59')],_0x1273('0x5a'),_0x1273('0x76'),_0x1273('0x77')),{'interaction':_0x290ca9})[_0x1273('0x1d')](function(_0x4834a3){var _0x2cacba=path['join'](_0x842b9a,'transcript-'+_0x31bd95['id']+'-'+_0x5e2bac+_0x1273('0x78'));var _0x5e48bb={'path':_0x2cacba,'channel':_0x1273('0x79'),'interactionId':_0x31bd95['id']};return pdf[_0x1273('0x7a')](_0x4834a3,_0x5e48bb);})[_0x1273('0x1d')](function(){return new BPromise(function(_0x432368,_0x5818f9){zipdir(_0x842b9a,{'saveTo':_0x2f7a0b},function(_0x2f30c9,_0x5e852e){if(_0x2f30c9)return _0x5818f9(_0x2f30c9);return _0x432368(_0x5e852e);});})['then'](function(){return new BPromise(function(_0x582eaf,_0x319616){rimraf(_0x842b9a,function(_0x4a7093){if(_0x4a7093)_0x319616(_0x4a7093);return _0x582eaf();});});})[_0x1273('0x1d')](function(){return _0x2f1b4c[_0x1273('0x55')](_0x2f7a0b,_0x138027,function(_0x3f346){if(_0x3f346){console[_0x1273('0x7b')](_0x1273('0x7c'),_0x3f346);}else{fs['unlinkSync'](_0x2f7a0b);}});});});}else{return _0x2f1b4c[_0x1273('0x13')](0xc8);}})[_0x1273('0x2b')](handleError(_0x2f1b4c,null));}; \ No newline at end of file +var _0x1949=['count','Content-Range','then','error','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','query','user','catch','show','params','model','keys','filters','attributes','fields','length','includeAll','include','options','create','update','body','find','destroy','describe','addMessage','ids','omit','getMessages','findOne','intersection','hasOwnProperty','nolimit','order','where','pick','SmsInteractionId','merge','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','SmsMessage','addTags','spread','Tag','color','emit','removeTags','download','unix','toString','join','root','server','tmp','transcript-%d-%s.zip','push','User','CmContact','Contact','Messages','createdAt','direction','secret','read','SmsAccount','Account','Owner','fullname','get','mkdirSync','Sms','N.A.','closedAt','format','disposition','out','System','lastName','value','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','moment','bluebird','util','path','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','sendStatus','status','end','json','offset','limit'];(function(_0x1da55c,_0x49a42d){var _0x25c267=function(_0x276051){while(--_0x276051){_0x1da55c['push'](_0x1da55c['shift']());}};_0x25c267(++_0x49a42d);}(_0x1949,0x1ca));var _0x9194=function(_0x12d080,_0x568283){_0x12d080=_0x12d080-0x0;var _0x2088b1=_0x1949[_0x12d080];return _0x2088b1;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x9194('0x0'));var BPromise=require(_0x9194('0x1'));var util=require(_0x9194('0x2'));var path=require(_0x9194('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x9194('0x4'));var interaction=require('../../components/interaction/service');var qs=require(_0x9194('0x5'));var pdf=require(_0x9194('0x6'));var logger=require(_0x9194('0x7'))(_0x9194('0x8'));var config=require(_0x9194('0x9'));var db=require(_0x9194('0xa'))['db'];config[_0x9194('0xb')]=_[_0x9194('0xc')](config[_0x9194('0xb')],{'host':_0x9194('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9194('0xb')]));require(_0x9194('0xe'))[_0x9194('0xf')](socket);function respondWithStatusCode(_0x3d303b,_0x55a667){_0x55a667=_0x55a667||0xcc;return function(_0x29df46){if(_0x29df46){return _0x3d303b[_0x9194('0x10')](_0x55a667);}return _0x3d303b[_0x9194('0x11')](_0x55a667)[_0x9194('0x12')]();};}function respondWithResult(_0x218222,_0x59c5b0){_0x59c5b0=_0x59c5b0||0xc8;return function(_0xae45d3){if(_0xae45d3){return _0x218222[_0x9194('0x11')](_0x59c5b0)[_0x9194('0x13')](_0xae45d3);}};}function respondWithFilteredResult(_0x1766fe,_0x311d83){return function(_0x4a10f9){if(_0x4a10f9){var _0xfa12d=typeof _0x311d83[_0x9194('0x14')]==='undefined'&&typeof _0x311d83[_0x9194('0x15')]==='undefined';var _0x1d4d88=_0x4a10f9['count'];var _0x48a84d=_0xfa12d?0x0:_0x311d83[_0x9194('0x14')];var _0x1fe445=_0xfa12d?_0x4a10f9[_0x9194('0x16')]:_0x311d83['offset']+_0x311d83[_0x9194('0x15')];var _0x436baa;if(_0x1fe445>=_0x1d4d88){_0x1fe445=_0x1d4d88;_0x436baa=0xc8;}else{_0x436baa=0xce;}_0x1766fe[_0x9194('0x11')](_0x436baa);return _0x1766fe['set'](_0x9194('0x17'),_0x48a84d+'-'+_0x1fe445+'/'+_0x1d4d88)[_0x9194('0x13')](_0x4a10f9);}return null;};}function saveUpdates(_0x11b2d3){return function(_0x11b85c){if(_0x11b85c){return _0x11b85c['update'](_0x11b2d3)[_0x9194('0x18')](function(_0xef3e87){return _0xef3e87;});}return null;};}function removeEntity(_0x37697c){return function(_0x9cf735){if(_0x9cf735){return _0x9cf735['destroy']()[_0x9194('0x18')](function(){_0x37697c['status'](0xcc)[_0x9194('0x12')]();});}};}function handleEntityNotFound(_0xfc7c01){return function(_0x542abc){if(!_0x542abc){_0xfc7c01[_0x9194('0x10')](0x194);}return _0x542abc;};}function handleError(_0xd90b99,_0x4e0c6f){_0x4e0c6f=_0x4e0c6f||0x1f4;return function(_0x2289c5){logger[_0x9194('0x19')](_0x2289c5[_0x9194('0x1a')]);if(_0x2289c5['name']){delete _0x2289c5[_0x9194('0x1b')];}_0xd90b99[_0x9194('0x11')](_0x4e0c6f)[_0x9194('0x1c')](_0x2289c5);};}exports[_0x9194('0x1d')]=function(_0x5d5259,_0x1ed3ed){var _0x33c8b0={};var _0x412287=_[_0x9194('0x1e')](db[_0x9194('0x1f')][_0x9194('0x20')],function(_0x4959ba){return{'name':_0x4959ba[_0x9194('0x21')],'type':_0x4959ba[_0x9194('0x22')][_0x9194('0x23')]};});_0x33c8b0=qs[_0x9194('0x24')](_0x412287,_0x5d5259);return interaction[_0x9194('0x25')]('sms',_0x5d5259[_0x9194('0x26')],_0x5d5259[_0x9194('0x27')],_0x33c8b0,_0x412287)['then'](respondWithFilteredResult(_0x1ed3ed,_0x33c8b0))[_0x9194('0x28')](handleError(_0x1ed3ed,null));};exports[_0x9194('0x29')]=function(_0x1f1be8,_0x44992d){var _0x42c823={'raw':![],'where':{'id':_0x1f1be8[_0x9194('0x2a')]['id']}},_0xf34a70={};_0xf34a70[_0x9194('0x2b')]=_[_0x9194('0x2c')](db[_0x9194('0x1f')][_0x9194('0x20')]);_0xf34a70[_0x9194('0x26')]=_[_0x9194('0x2c')](_0x1f1be8[_0x9194('0x26')]);_0xf34a70[_0x9194('0x2d')]=_['intersection'](_0xf34a70[_0x9194('0x2b')],_0xf34a70['query']);_0x42c823[_0x9194('0x2e')]=_['intersection'](_0xf34a70[_0x9194('0x2b')],qs['fields'](_0x1f1be8[_0x9194('0x26')][_0x9194('0x2f')]));_0x42c823[_0x9194('0x2e')]=_0x42c823['attributes'][_0x9194('0x30')]?_0x42c823[_0x9194('0x2e')]:_0xf34a70[_0x9194('0x2b')];if(_0x1f1be8[_0x9194('0x26')][_0x9194('0x31')]){_0x42c823[_0x9194('0x32')]=[{'all':!![]}];}_0x42c823=_['merge']({},_0x42c823,_0x1f1be8[_0x9194('0x33')]);return db[_0x9194('0x1f')]['find'](_0x42c823)[_0x9194('0x18')](handleEntityNotFound(_0x44992d,null))['then'](respondWithResult(_0x44992d,null))[_0x9194('0x28')](handleError(_0x44992d,null));};exports[_0x9194('0x34')]=function(_0x9482db,_0x1905f1){return db[_0x9194('0x1f')]['create'](_0x9482db['body'],{})[_0x9194('0x18')](respondWithResult(_0x1905f1,0xc9))[_0x9194('0x28')](handleError(_0x1905f1,null));};exports[_0x9194('0x35')]=function(_0x5a8354,_0x4ea85){if(_0x5a8354['body']['id']){delete _0x5a8354[_0x9194('0x36')]['id'];}return db[_0x9194('0x1f')][_0x9194('0x37')]({'where':{'id':_0x5a8354['params']['id']}})[_0x9194('0x18')](handleEntityNotFound(_0x4ea85,null))[_0x9194('0x18')](saveUpdates(_0x5a8354[_0x9194('0x36')],null))['then'](respondWithResult(_0x4ea85,null))['catch'](handleError(_0x4ea85,null));};exports[_0x9194('0x38')]=function(_0x547670,_0x6ba75f){return db[_0x9194('0x1f')]['find']({'where':{'id':_0x547670[_0x9194('0x2a')]['id']}})['then'](handleEntityNotFound(_0x6ba75f,null))[_0x9194('0x18')](removeEntity(_0x6ba75f,null))[_0x9194('0x28')](handleError(_0x6ba75f,null));};exports[_0x9194('0x39')]=function(_0x272702,_0x103ba4){return db[_0x9194('0x1f')][_0x9194('0x39')]()[_0x9194('0x18')](respondWithResult(_0x103ba4,null))['catch'](handleError(_0x103ba4,null));};exports[_0x9194('0x3a')]=function(_0x1eeb82,_0x39d42c){return db['SmsMessage'][_0x9194('0x37')]({'where':{'id':_0x1eeb82[_0x9194('0x2a')]['id']}})[_0x9194('0x18')](handleEntityNotFound(_0x39d42c,null))['then'](function(_0x5abded){if(_0x5abded){return _0x5abded[_0x9194('0x3a')](_0x1eeb82[_0x9194('0x36')][_0x9194('0x3b')],_[_0x9194('0x3c')](_0x1eeb82['body'],['ids','id'])||{});}})[_0x9194('0x18')](respondWithResult(_0x39d42c,null))[_0x9194('0x28')](handleError(_0x39d42c,null));};exports[_0x9194('0x3d')]=function(_0x5aa3b5,_0x529ae7){var _0x55c54f={'raw':![],'where':{}};var _0x1857fb={};var _0x1f4996={'count':0x0,'rows':[]};return db[_0x9194('0x1f')][_0x9194('0x3e')]({'where':{'id':_0x5aa3b5['params']['id']}})[_0x9194('0x18')](handleEntityNotFound(_0x529ae7,null))[_0x9194('0x18')](function(_0x30f0a9){if(_0x30f0a9){_0x1857fb[_0x9194('0x2b')]=_[_0x9194('0x2c')](db['SmsMessage'][_0x9194('0x20')]);_0x1857fb[_0x9194('0x26')]=_['keys'](_0x5aa3b5['query']);_0x1857fb['filters']=_[_0x9194('0x3f')](_0x1857fb[_0x9194('0x2b')],_0x1857fb[_0x9194('0x26')]);_0x55c54f[_0x9194('0x2e')]=_['intersection'](_0x1857fb[_0x9194('0x2b')],qs['fields'](_0x5aa3b5['query'][_0x9194('0x2f')]));_0x55c54f['attributes']=_0x55c54f[_0x9194('0x2e')]['length']?_0x55c54f[_0x9194('0x2e')]:_0x1857fb[_0x9194('0x2b')];if(!_0x5aa3b5[_0x9194('0x26')][_0x9194('0x40')](_0x9194('0x41'))){_0x55c54f['limit']=qs[_0x9194('0x15')](_0x5aa3b5[_0x9194('0x26')][_0x9194('0x15')]);_0x55c54f[_0x9194('0x14')]=qs['offset'](_0x5aa3b5[_0x9194('0x26')][_0x9194('0x14')]);}_0x55c54f[_0x9194('0x42')]=qs['sort'](_0x5aa3b5['query']['sort']);_0x55c54f[_0x9194('0x43')]=qs[_0x9194('0x2d')](_[_0x9194('0x44')](_0x5aa3b5[_0x9194('0x26')],_0x1857fb[_0x9194('0x2d')]));_0x55c54f[_0x9194('0x43')][_0x9194('0x45')]=_0x30f0a9['id'];if(_0x5aa3b5[_0x9194('0x26')]['filter']){_0x55c54f[_0x9194('0x43')]=_[_0x9194('0x46')](_0x55c54f[_0x9194('0x43')],{'$or':_['map'](_0x55c54f[_0x9194('0x2e')],function(_0x237bef){var _0x4e95e8={};_0x4e95e8[_0x237bef]={'$like':'%'+_0x5aa3b5[_0x9194('0x26')][_0x9194('0x47')]+'%'};return _0x4e95e8;})});}if(_0x5aa3b5[_0x9194('0x26')][_0x9194('0x48')]){var _0x3dd96e=_0x5aa3b5[_0x9194('0x26')][_0x9194('0x48')]['split'](',');var _0x5f3293={};_0x5f3293[_0x3dd96e[0x0]]={'$gte':moment(_0x3dd96e[0x1])['format'](_0x9194('0x49'))};_0x55c54f[_0x9194('0x43')]=_[_0x9194('0x46')](_0x55c54f[_0x9194('0x43')],_0x5f3293);}_0x55c54f=_[_0x9194('0x46')]({},_0x55c54f,_0x5aa3b5[_0x9194('0x33')]);return db['SmsMessage'][_0x9194('0x16')]({'where':_0x55c54f[_0x9194('0x43')]})[_0x9194('0x18')](function(_0x3bba5d){_0x1f4996['count']=_0x3bba5d;if(_0x5aa3b5['query'][_0x9194('0x31')]){_0x55c54f[_0x9194('0x32')]=[{'all':!![]}];}return db[_0x9194('0x4a')][_0x9194('0x25')](_0x55c54f);})[_0x9194('0x18')](function(_0x228865){_0x1f4996['rows']=_0x228865;return _0x1f4996;});}})[_0x9194('0x18')](respondWithFilteredResult(_0x529ae7,_0x55c54f))['catch'](handleError(_0x529ae7,null));};exports[_0x9194('0x4b')]=function(_0x54cf27,_0x55acd9){return db[_0x9194('0x1f')][_0x9194('0x37')]({'where':{'id':_0x54cf27['params']['id']}})['then'](handleEntityNotFound(_0x55acd9,null))[_0x9194('0x18')](function(_0x5aa935){if(_0x5aa935){return _0x5aa935['setTags'](_0x54cf27[_0x9194('0x36')]['ids'],_['omit'](_0x54cf27[_0x9194('0x36')],[_0x9194('0x3b'),'id'])||{})[_0x9194('0x4c')](function(){return db[_0x9194('0x4d')][_0x9194('0x25')]({'attributes':['id',_0x9194('0x1b'),_0x9194('0x4e')],'where':{'id':_0x54cf27['body'][_0x9194('0x3b')]}});})[_0x9194('0x18')](function(_0x336e36){socket[_0x9194('0x4f')]('smsInteractionTags:save',{'id':Number(_0x54cf27[_0x9194('0x2a')]['id']),'tags':_0x336e36||[]});return{'id':Number(_0x54cf27[_0x9194('0x2a')]['id']),'tags':_0x336e36||[]};});}})[_0x9194('0x18')](respondWithResult(_0x55acd9,null))[_0x9194('0x28')](handleError(_0x55acd9,null));};exports[_0x9194('0x50')]=function(_0x4fc26b,_0x170d10){return db['SmsInteraction'][_0x9194('0x37')]({'where':{'id':_0x4fc26b['params']['id']}})[_0x9194('0x18')](handleEntityNotFound(_0x170d10,null))[_0x9194('0x18')](function(_0x6dcc74){if(_0x6dcc74){return _0x6dcc74[_0x9194('0x50')](_0x4fc26b[_0x9194('0x26')][_0x9194('0x3b')]);}})[_0x9194('0x18')](respondWithStatusCode(_0x170d10,null))[_0x9194('0x28')](handleError(_0x170d10,null));};exports[_0x9194('0x51')]=function(_0x433508,_0x15b7b6){var _0x1bf700=moment()[_0x9194('0x52')]()[_0x9194('0x53')]();var _0x6f8a11=path[_0x9194('0x54')](config[_0x9194('0x55')],_0x9194('0x56'),'files',_0x9194('0x57'));var _0x219ca3=path[_0x9194('0x54')](_0x6f8a11,_0x1bf700);var _0x14004e=util['format'](_0x9194('0x58'),_0x433508[_0x9194('0x2a')]['id'],_0x1bf700);var _0x3b4ced=path[_0x9194('0x54')](_0x6f8a11,_0x14004e);var _0x4e177e=[];_0x4e177e[_0x9194('0x59')]({'model':db[_0x9194('0x5a')],'as':_0x9194('0x5a'),'attributes':['id','fullname'],'raw':!![]});_0x4e177e[_0x9194('0x59')]({'model':db[_0x9194('0x5b')],'as':_0x9194('0x5c'),'attributes':['id','firstName','lastName'],'raw':!![]});var _0x19eb58=[{'model':db[_0x9194('0x4a')],'as':_0x9194('0x5d'),'attributes':['id','body',_0x9194('0x5e'),_0x9194('0x5f'),_0x9194('0x60'),_0x9194('0x61')],'include':_0x4e177e}];_0x19eb58[_0x9194('0x59')]({'model':db[_0x9194('0x62')],'as':_0x9194('0x63'),'attributes':['id',_0x9194('0x1b')]});_0x19eb58[_0x9194('0x59')]({'model':db[_0x9194('0x5a')],'as':_0x9194('0x64'),'attributes':['id',_0x9194('0x65')]});return db[_0x9194('0x1f')]['find']({'where':{'id':_0x433508[_0x9194('0x2a')]['id']},'include':_0x19eb58})[_0x9194('0x18')](handleEntityNotFound(_0x15b7b6,null))[_0x9194('0x18')](function(_0x1b3124){if(_0x1b3124){var _0x3e6f61=_0x1b3124[_0x9194('0x66')]({'plain':!![]});fs[_0x9194('0x67')](_0x219ca3);var _0x4fb67e={'channel':_0x9194('0x68'),'account':_0x3e6f61['Account']['name'],'agent':_0x3e6f61[_0x9194('0x64')]?_0x3e6f61[_0x9194('0x64')][_0x9194('0x65')]:_0x9194('0x69'),'createdAt':moment(_0x3e6f61[_0x9194('0x5e')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x9194('0x53')](),'closedAt':_0x3e6f61['closed']?moment(_0x3e6f61[_0x9194('0x6a')])[_0x9194('0x6b')](_0x9194('0x49'))[_0x9194('0x53')]():'','disposition':_0x3e6f61[_0x9194('0x6c')],'messages':_(_0x3e6f61[_0x9194('0x5d')])[_0x9194('0x47')]({'secret':![]})[_0x9194('0x1e')](function(_0x3b59cc){return{'date':moment(_0x3b59cc['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x9194('0x53')](),'sender':_0x3b59cc[_0x9194('0x5f')]===_0x9194('0x6d')?_0x3b59cc[_0x9194('0x5a')]?_0x3b59cc[_0x9194('0x5a')][_0x9194('0x65')]:_0x9194('0x6e'):_0x3b59cc[_0x9194('0x5c')]['firstName']+(_0x3b59cc[_0x9194('0x5c')][_0x9194('0x6f')]?'\x20'+_0x3b59cc[_0x9194('0x5c')][_0x9194('0x6f')]:''),'body':_0x3b59cc['body'],'direction':_0x3b59cc[_0x9194('0x5f')]===_0x9194('0x6d')?'A':'C','secret':_0x3b59cc[_0x9194('0x60')],'read':_0x3b59cc['read']};})[_0x9194('0x70')]()};return ejs['renderFile'](path[_0x9194('0x54')](config[_0x9194('0x55')],'server',_0x9194('0x71'),_0x9194('0x72')),{'interaction':_0x4fb67e})[_0x9194('0x18')](function(_0x3eac5a){var _0x54af8f=path['join'](_0x219ca3,_0x9194('0x73')+_0x3e6f61['id']+'-'+_0x1bf700+_0x9194('0x74'));var _0x3a4034={'path':_0x54af8f,'channel':_0x9194('0x68'),'interactionId':_0x3e6f61['id']};return pdf['createPdfFromHTML'](_0x3eac5a,_0x3a4034);})[_0x9194('0x18')](function(){return new BPromise(function(_0x5ce156,_0x368d9a){zipdir(_0x219ca3,{'saveTo':_0x3b4ced},function(_0x32b7e6,_0x2fb436){if(_0x32b7e6)return _0x368d9a(_0x32b7e6);return _0x5ce156(_0x2fb436);});})['then'](function(){return new BPromise(function(_0x4a323f,_0x478871){rimraf(_0x219ca3,function(_0x2c0e0a){if(_0x2c0e0a)_0x478871(_0x2c0e0a);return _0x4a323f();});});})[_0x9194('0x18')](function(){return _0x15b7b6[_0x9194('0x51')](_0x3b4ced,_0x14004e,function(_0x574591){if(_0x574591){console[_0x9194('0x75')](_0x9194('0x76'),_0x574591);}else{fs[_0x9194('0x77')](_0x3b4ced);}});});});}else{return _0x15b7b6['sendStatus'](0xc8);}})[_0x9194('0x28')](handleError(_0x15b7b6,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index de7bff5..1631dbf 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 _0xd4a2=['getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x3e95a8,_0xa7af87){var _0x1d8724=function(_0xd751a7){while(--_0xd751a7){_0x3e95a8['push'](_0x3e95a8['shift']());}};_0x1d8724(++_0xa7af87);}(_0xd4a2,0x173));var _0x2d4a=function(_0x9b5e,_0xb76b79){_0x9b5e=_0x9b5e-0x0;var _0x8362cb=_0xd4a2[_0x9b5e];return _0x8362cb;};'use strict';var EventEmitter=require(_0x2d4a('0x0'));var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsMessage=require(_0x2d4a('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x2d4a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2d4a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x32af9e){return function(_0x40d744,_0x2624b5,_0x3a88e2){_0x40d744[_0x2d4a('0x4')]({'attributes':['id'],'raw':!![]})['then'](function(_0x45fefb){_0x40d744[_0x2d4a('0x5')](_0x2d4a('0x6'),_0x45fefb[_0x2d4a('0x7')](function(_0x3b8d7b){return{'id':_0x3b8d7b['id']};}));return SmsMessage[_0x2d4a('0x8')]({'where':{'SmsInteractionId':_0x40d744['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2d4a('0x9')](function(_0x113839){_0x40d744[_0x2d4a('0x5')](_0x2d4a('0xa'),_0x113839[_0x2d4a('0xb')]);SmsInteractionEvents[_0x2d4a('0xc')](_0x32af9e+':'+_0x40d744['id'],_0x40d744);SmsInteractionEvents['emit'](_0x32af9e,_0x40d744);_0x3a88e2(null);})['catch'](_0x3a88e2(null));};}for(var e in events){if(events[_0x2d4a('0xd')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x2d4a('0xe')]=SmsInteractionEvents; \ No newline at end of file +var _0x3d04=['SmsInteraction','SmsMessage','setMaxListeners','save','update','Users','map','findAll','then','unreadMessages','emit','catch','hasOwnProperty','hook','events','../../mysqldb'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x3d04,0xbe));var _0x43d0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3d04[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require(_0x43d0('0x0'));var SmsInteraction=require(_0x43d0('0x1'))['db'][_0x43d0('0x2')];var SmsMessage=require(_0x43d0('0x1'))['db'][_0x43d0('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x43d0('0x4')](0x0);var events={'afterCreate':_0x43d0('0x5'),'afterUpdate':_0x43d0('0x6'),'afterDestroy':'remove'};function emitEvent(_0x2a4d4c){return function(_0x1a75d4,_0x746f5e,_0x617bf){_0x1a75d4['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x50919e){_0x1a75d4['setDataValue'](_0x43d0('0x7'),_0x50919e[_0x43d0('0x8')](function(_0x331421){return{'id':_0x331421['id']};}));return SmsMessage[_0x43d0('0x9')]({'where':{'SmsInteractionId':_0x1a75d4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x43d0('0xa')](function(_0x4d75d9){_0x1a75d4['setDataValue'](_0x43d0('0xb'),_0x4d75d9['length']);SmsInteractionEvents['emit'](_0x2a4d4c+':'+_0x1a75d4['id'],_0x1a75d4);SmsInteractionEvents[_0x43d0('0xc')](_0x2a4d4c,_0x1a75d4);_0x617bf(null);})[_0x43d0('0xd')](_0x617bf(null));};}for(var e in events){if(events[_0x43d0('0xe')](e)){var event=events[e];SmsInteraction[_0x43d0('0xf')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 9da92e7..9314e28 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 _0x1c82=['path','../../config/environment','exports','define','sms_interactions','changed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x91aa06,_0x2d2a2d){var _0x533ff6=function(_0x4cdd8d){while(--_0x4cdd8d){_0x91aa06['push'](_0x91aa06['shift']());}};_0x533ff6(++_0x2d2a2d);}(_0x1c82,0xad));var _0x21c8=function(_0xf325c7,_0x105c57){_0xf325c7=_0xf325c7-0x0;var _0x440666=_0x1c82[_0xf325c7];return _0x440666;};'use strict';var _=require(_0x21c8('0x0'));var util=require(_0x21c8('0x1'));var logger=require(_0x21c8('0x2'))(_0x21c8('0x3'));var moment=require(_0x21c8('0x4'));var BPromise=require(_0x21c8('0x5'));var rp=require(_0x21c8('0x6'));var fs=require('fs');var path=require(_0x21c8('0x7'));var rimraf=require('rimraf');var config=require(_0x21c8('0x8'));var attributes=require('./smsInteraction.attributes');module[_0x21c8('0x9')]=function(_0x172489,_0x41cffe){return _0x172489[_0x21c8('0xa')]('SmsInteraction',attributes,{'tableName':_0x21c8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xf4e2da,_0x4bfeb5,_0x66970a){if(_0xf4e2da[_0x21c8('0xc')]('closed')){_0xf4e2da['closedAt']=moment()[_0x21c8('0xd')](_0x21c8('0xe'));}_0x66970a(null,_0xf4e2da);}}});}; \ No newline at end of file +var _0xa0ac=['moment','bluebird','request-promise','rimraf','exports','define','SmsInteraction','sms_interactions','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x100325,_0x346070){var _0x1d42e9=function(_0x489d86){while(--_0x489d86){_0x100325['push'](_0x100325['shift']());}};_0x1d42e9(++_0x346070);}(_0xa0ac,0x9a));var _0xca0a=function(_0x263901,_0x325b0b){_0x263901=_0x263901-0x0;var _0x2240a2=_0xa0ac[_0x263901];return _0x2240a2;};'use strict';var _=require(_0xca0a('0x0'));var util=require(_0xca0a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xca0a('0x2'));var BPromise=require(_0xca0a('0x3'));var rp=require(_0xca0a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xca0a('0x5'));var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module[_0xca0a('0x6')]=function(_0x13f830,_0x2e2b27){return _0x13f830[_0xca0a('0x7')](_0xca0a('0x8'),attributes,{'tableName':_0xca0a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d0dbd,_0x6ed3da,_0x1b7ef7){if(_0x3d0dbd['changed']('closed')){_0x3d0dbd[_0xca0a('0xa')]=moment()['format'](_0xca0a('0xb'));}_0x1b7ef7(null,_0x3d0dbd);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index a92a473..d75a1d7 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 _0x40ff=['addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','debug','AddTagsToSmsInteraction'];(function(_0x55ec85,_0x209bff){var _0x3a80c5=function(_0x19901d){while(--_0x19901d){_0x55ec85['push'](_0x55ec85['shift']());}};_0x3a80c5(++_0x209bff);}(_0x40ff,0x1bd));var _0xf40f=function(_0x8dba7,_0x29082e){_0x8dba7=_0x8dba7-0x0;var _0x542462=_0x40ff[_0x8dba7];return _0x542462;};'use strict';var _=require(_0xf40f('0x0'));var util=require(_0xf40f('0x1'));var moment=require(_0xf40f('0x2'));var BPromise=require('bluebird');var rs=require(_0xf40f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf40f('0x4'))['db'];var utils=require(_0xf40f('0x5'));var logger=require(_0xf40f('0x6'))(_0xf40f('0x7'));var config=require('../../config/environment');var jayson=require(_0xf40f('0x8'));var client=jayson[_0xf40f('0x9')][_0xf40f('0xa')]({'port':0x232a});config['redis']=_[_0xf40f('0xb')](config['redis'],{'host':_0xf40f('0xc'),'port':0x18eb});var socket=require(_0xf40f('0xd'))(new Redis(config['redis']));require(_0xf40f('0xe'))[_0xf40f('0xf')](socket);function respondWithRpcPromise(_0x193cba,_0x34f219,_0x143678){return new BPromise(function(_0x1d8404,_0x396a5d){return client[_0xf40f('0x10')](_0x193cba,_0x143678)[_0xf40f('0x11')](function(_0x1cdd27){logger['info'](_0xf40f('0x12'),_0x34f219,'request\x20sent');logger['debug']('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x34f219,_0xf40f('0x13'),JSON[_0xf40f('0x14')](_0x1cdd27));if(_0x1cdd27['error']){if(_0x1cdd27[_0xf40f('0x15')]['code']===0x1f4){logger[_0xf40f('0x15')](_0xf40f('0x12'),_0x34f219,_0x1cdd27[_0xf40f('0x15')][_0xf40f('0x16')]);return _0x396a5d(_0x1cdd27[_0xf40f('0x15')]['message']);}logger[_0xf40f('0x15')](_0xf40f('0x12'),_0x34f219,_0x1cdd27[_0xf40f('0x15')][_0xf40f('0x16')]);return _0x1d8404(_0x1cdd27[_0xf40f('0x15')][_0xf40f('0x16')]);}else{logger[_0xf40f('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x34f219,'request\x20sent');_0x1d8404(_0x1cdd27[_0xf40f('0x18')][_0xf40f('0x16')]);}})[_0xf40f('0x19')](function(_0x438bd2){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x34f219,_0x438bd2);_0x396a5d(_0x438bd2);});});}exports[_0xf40f('0x1a')]=function(_0x7adfd){var _0x1afb86=this;return new Promise(function(_0x58d658,_0x137d9e){return db[_0xf40f('0x1b')][_0xf40f('0x1c')](_0x7adfd[_0xf40f('0x1d')],{'raw':_0x7adfd[_0xf40f('0x1e')]?_0x7adfd[_0xf40f('0x1e')][_0xf40f('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7adfd[_0xf40f('0x1e')]?_0x7adfd[_0xf40f('0x1e')][_0xf40f('0x20')]||null:null,'attributes':_0x7adfd[_0xf40f('0x1e')]?_0x7adfd['options']['attributes']||null:null,'limit':_0x7adfd[_0xf40f('0x1e')]?_0x7adfd[_0xf40f('0x1e')]['limit']||null:null})[_0xf40f('0x11')](function(_0x47077d){logger[_0xf40f('0x17')](_0xf40f('0x1a'),_0x7adfd);logger[_0xf40f('0x21')](_0xf40f('0x1a'),_0x7adfd,JSON[_0xf40f('0x14')](_0x47077d));_0x58d658(_0x47077d);})['catch'](function(_0x28586a){logger[_0xf40f('0x15')](_0xf40f('0x1a'),_0x28586a[_0xf40f('0x16')],_0x7adfd);_0x137d9e(_0x1afb86[_0xf40f('0x15')](0x1f4,_0x28586a[_0xf40f('0x16')]));});});};exports[_0xf40f('0x22')]=function(_0x1875ba){return new Promise(function(_0x899782,_0x245c9f){return db[_0xf40f('0x1b')]['find']({'where':_0x1875ba[_0xf40f('0x1e')]?_0x1875ba[_0xf40f('0x1e')][_0xf40f('0x20')]||null:null})[_0xf40f('0x11')](function(_0x1a3fce){if(_0x1a3fce){return _0x1a3fce[_0xf40f('0x23')](_0x1875ba[_0xf40f('0x1d')][_0xf40f('0x24')],_[_0xf40f('0x25')](_0x1875ba[_0xf40f('0x1d')],[_0xf40f('0x24'),'id'])||{});}})[_0xf40f('0x26')](function(_0x4de485){logger[_0xf40f('0x17')](_0xf40f('0x27'),_0x1875ba);logger[_0xf40f('0x21')](_0xf40f('0x27'),_0x1875ba,JSON['stringify'](_0x4de485));_0x899782(_0x4de485);})[_0xf40f('0x19')](function(_0x23900f){logger[_0xf40f('0x15')]('AddTags',_0x23900f[_0xf40f('0x16')],_0x1875ba);_0x245c9f(_this[_0xf40f('0x15')](0x1f4,_0x23900f[_0xf40f('0x16')]));});});}; \ No newline at end of file +var _0xbf18=['then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','where','attributes','limit','AddTagsToSmsInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','request'];(function(_0x94d8b5,_0x5733ea){var _0x4f7dab=function(_0x5ea960){while(--_0x5ea960){_0x94d8b5['push'](_0x94d8b5['shift']());}};_0x4f7dab(++_0x5733ea);}(_0xbf18,0x102));var _0x8bf1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbf18[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8bf1('0x0'));var util=require(_0x8bf1('0x1'));var moment=require(_0x8bf1('0x2'));var BPromise=require(_0x8bf1('0x3'));var rs=require(_0x8bf1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8bf1('0x5'))['db'];var utils=require(_0x8bf1('0x6'));var logger=require(_0x8bf1('0x7'))('rpc');var config=require(_0x8bf1('0x8'));var jayson=require(_0x8bf1('0x9'));var client=jayson[_0x8bf1('0xa')][_0x8bf1('0xb')]({'port':0x232a});config[_0x8bf1('0xc')]=_[_0x8bf1('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8bf1('0xe'))(new Redis(config['redis']));require(_0x8bf1('0xf'))[_0x8bf1('0x10')](socket);function respondWithRpcPromise(_0x48fed8,_0x4ab08b,_0x3ebeac){return new BPromise(function(_0x2b1c4c,_0x548a6e){return client[_0x8bf1('0x11')](_0x48fed8,_0x3ebeac)[_0x8bf1('0x12')](function(_0x435578){logger[_0x8bf1('0x13')](_0x8bf1('0x14'),_0x4ab08b,_0x8bf1('0x15'));logger[_0x8bf1('0x16')](_0x8bf1('0x17'),_0x4ab08b,_0x8bf1('0x15'),JSON[_0x8bf1('0x18')](_0x435578));if(_0x435578[_0x8bf1('0x19')]){if(_0x435578['error'][_0x8bf1('0x1a')]===0x1f4){logger[_0x8bf1('0x19')]('SmsInteraction,\x20%s,\x20%s',_0x4ab08b,_0x435578['error'][_0x8bf1('0x1b')]);return _0x548a6e(_0x435578[_0x8bf1('0x19')]['message']);}logger[_0x8bf1('0x19')](_0x8bf1('0x14'),_0x4ab08b,_0x435578[_0x8bf1('0x19')]['message']);return _0x2b1c4c(_0x435578['error']['message']);}else{logger[_0x8bf1('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x4ab08b,_0x8bf1('0x15'));_0x2b1c4c(_0x435578[_0x8bf1('0x1c')][_0x8bf1('0x1b')]);}})[_0x8bf1('0x1d')](function(_0xe9bbc){logger[_0x8bf1('0x19')](_0x8bf1('0x14'),_0x4ab08b,_0xe9bbc);_0x548a6e(_0xe9bbc);});});}exports[_0x8bf1('0x1e')]=function(_0x23406b){var _0x5a694b=this;return new Promise(function(_0x364db4,_0x366a84){return db[_0x8bf1('0x1f')][_0x8bf1('0x20')](_0x23406b['body'],{'raw':_0x23406b[_0x8bf1('0x21')]?_0x23406b[_0x8bf1('0x21')][_0x8bf1('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23406b['options']?_0x23406b[_0x8bf1('0x21')][_0x8bf1('0x23')]||null:null,'attributes':_0x23406b[_0x8bf1('0x21')]?_0x23406b[_0x8bf1('0x21')][_0x8bf1('0x24')]||null:null,'limit':_0x23406b[_0x8bf1('0x21')]?_0x23406b['options'][_0x8bf1('0x25')]||null:null})[_0x8bf1('0x12')](function(_0x1635da){logger[_0x8bf1('0x13')]('UpdateSmsInteraction',_0x23406b);logger['debug'](_0x8bf1('0x1e'),_0x23406b,JSON[_0x8bf1('0x18')](_0x1635da));_0x364db4(_0x1635da);})[_0x8bf1('0x1d')](function(_0x6ccd8d){logger[_0x8bf1('0x19')](_0x8bf1('0x1e'),_0x6ccd8d['message'],_0x23406b);_0x366a84(_0x5a694b['error'](0x1f4,_0x6ccd8d[_0x8bf1('0x1b')]));});});};exports[_0x8bf1('0x26')]=function(_0x141915){return new Promise(function(_0x3d8750,_0x235669){return db[_0x8bf1('0x1f')][_0x8bf1('0x27')]({'where':_0x141915[_0x8bf1('0x21')]?_0x141915[_0x8bf1('0x21')][_0x8bf1('0x23')]||null:null})[_0x8bf1('0x12')](function(_0x558746){if(_0x558746){return _0x558746[_0x8bf1('0x28')](_0x141915[_0x8bf1('0x29')][_0x8bf1('0x2a')],_[_0x8bf1('0x2b')](_0x141915['body'],[_0x8bf1('0x2a'),'id'])||{});}})[_0x8bf1('0x2c')](function(_0x544e27){logger['info'](_0x8bf1('0x2d'),_0x141915);logger[_0x8bf1('0x16')]('AddTags',_0x141915,JSON['stringify'](_0x544e27));_0x3d8750(_0x544e27);})['catch'](function(_0x5c7bb1){logger[_0x8bf1('0x19')](_0x8bf1('0x2d'),_0x5c7bb1[_0x8bf1('0x1b')],_0x141915);_0x235669(_this[_0x8bf1('0x19')](0x1f4,_0x5c7bb1[_0x8bf1('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index e18bceb..312df89 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 _0x1f04=['length','smsInteraction:','save','remove','update'];(function(_0x433795,_0x253d09){var _0x27661e=function(_0x1c4870){while(--_0x1c4870){_0x433795['push'](_0x433795['shift']());}};_0x27661e(++_0x253d09);}(_0x1f04,0x1c4));var _0x41f0=function(_0x59ffd4,_0x4bda83){_0x59ffd4=_0x59ffd4-0x0;var _0x31fb33=_0x1f04[_0x59ffd4];return _0x31fb33;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x41f0('0x0'),_0x41f0('0x1'),_0x41f0('0x2')];function createListener(_0x29ab9c,_0x1b806d){return function(_0x7ae718){_0x1b806d['emit'](_0x29ab9c,_0x7ae718);};}function removeListener(_0x1f679d,_0x3104f1){return function(){SmsInteractionEvents['removeListener'](_0x1f679d,_0x3104f1);};}exports['register']=function(_0x1bc04b){for(var _0x17ef9e=0x0,_0x583f71=events[_0x41f0('0x3')];_0x17ef9e<_0x583f71;_0x17ef9e++){var _0x5c6bd4=events[_0x17ef9e];var _0x4e739c=createListener(_0x41f0('0x4')+_0x5c6bd4,_0x1bc04b);SmsInteractionEvents['on'](_0x5c6bd4,_0x4e739c);}}; \ No newline at end of file +var _0xe207=['length','smsInteraction:','./smsInteraction.events','save','remove','update','emit'];(function(_0x27472b,_0x1e5ca1){var _0x249243=function(_0x5b304f){while(--_0x5b304f){_0x27472b['push'](_0x27472b['shift']());}};_0x249243(++_0x1e5ca1);}(_0xe207,0x1e5));var _0x7e20=function(_0x40ce28,_0x1c7514){_0x40ce28=_0x40ce28-0x0;var _0x5be237=_0xe207[_0x40ce28];return _0x5be237;};'use strict';var SmsInteractionEvents=require(_0x7e20('0x0'));var events=[_0x7e20('0x1'),_0x7e20('0x2'),_0x7e20('0x3')];function createListener(_0x115a32,_0x463f41){return function(_0x445ff7){_0x463f41[_0x7e20('0x4')](_0x115a32,_0x445ff7);};}function removeListener(_0x238a70,_0x24648b){return function(){SmsInteractionEvents['removeListener'](_0x238a70,_0x24648b);};}exports['register']=function(_0xd12cf2){for(var _0x12e915=0x0,_0x56c0c9=events[_0x7e20('0x5')];_0x12e915<_0x56c0c9;_0x12e915++){var _0x4d121a=events[_0x12e915];var _0x324c4=createListener(_0x7e20('0x6')+_0x4d121a,_0xd12cf2);SmsInteractionEvents['on'](_0x4d121a,_0x324c4);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 6ca4ca1..d180c9f 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 _0x1bc8=['index','/describe','describe','/:id','show','post','tracked','smsmessage:create','create','status','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','express','Router','fs-extra','./smsMessage.controller','get','isAuthenticated'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x1bc8,0x94));var _0x81bc=function(_0x225f50,_0x48a77d){_0x225f50=_0x225f50-0x0;var _0x19d003=_0x1bc8[_0x225f50];return _0x19d003;};'use strict';var multer=require(_0x81bc('0x0'));var util=require(_0x81bc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x81bc('0x2'));var router=express[_0x81bc('0x3')]();var fs_extra=require(_0x81bc('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x81bc('0x5'));router[_0x81bc('0x6')]('/',auth[_0x81bc('0x7')](),controller[_0x81bc('0x8')]);router[_0x81bc('0x6')](_0x81bc('0x9'),auth[_0x81bc('0x7')](),controller[_0x81bc('0xa')]);router[_0x81bc('0x6')](_0x81bc('0xb'),auth[_0x81bc('0x7')](),controller[_0x81bc('0xc')]);router[_0x81bc('0xd')]('/',auth[_0x81bc('0x7')](),interaction[_0x81bc('0xe')]('sms',_0x81bc('0xf')),controller[_0x81bc('0x10')]);router[_0x81bc('0xd')]('/:id/status',controller[_0x81bc('0x11')]);router[_0x81bc('0x12')](_0x81bc('0xb'),auth[_0x81bc('0x7')](),controller[_0x81bc('0x13')]);router[_0x81bc('0x12')](_0x81bc('0x14'),auth[_0x81bc('0x7')](),controller[_0x81bc('0x15')]);router[_0x81bc('0x12')](_0x81bc('0x16'),auth[_0x81bc('0x7')](),controller['reject']);router[_0x81bc('0x17')](_0x81bc('0xb'),auth[_0x81bc('0x7')](),controller[_0x81bc('0x18')]);module[_0x81bc('0x19')]=router; \ No newline at end of file +var _0x9f37=['get','isAuthenticated','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','create','status','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','express','fs-extra','../../components/interaction/service','./smsMessage.controller'];(function(_0x2bd9db,_0x2f6076){var _0x28441e=function(_0x354695){while(--_0x354695){_0x2bd9db['push'](_0x2bd9db['shift']());}};_0x28441e(++_0x2f6076);}(_0x9f37,0xb6));var _0x79f3=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x9f37[_0x2aec52];return _0x3b8835;};'use strict';var multer=require(_0x79f3('0x0'));var util=require(_0x79f3('0x1'));var path=require(_0x79f3('0x2'));var timeout=require('connect-timeout');var express=require(_0x79f3('0x3'));var router=express['Router']();var fs_extra=require(_0x79f3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x79f3('0x5'));var config=require('../../config/environment');var controller=require(_0x79f3('0x6'));router[_0x79f3('0x7')]('/',auth[_0x79f3('0x8')](),controller['index']);router[_0x79f3('0x7')](_0x79f3('0x9'),auth[_0x79f3('0x8')](),controller[_0x79f3('0xa')]);router['get'](_0x79f3('0xb'),auth[_0x79f3('0x8')](),controller[_0x79f3('0xc')]);router[_0x79f3('0xd')]('/',auth[_0x79f3('0x8')](),interaction[_0x79f3('0xe')](_0x79f3('0xf'),_0x79f3('0x10')),controller[_0x79f3('0x11')]);router['post']('/:id/status',controller[_0x79f3('0x12')]);router['put'](_0x79f3('0xb'),auth[_0x79f3('0x8')](),controller[_0x79f3('0x13')]);router[_0x79f3('0x14')](_0x79f3('0x15'),auth[_0x79f3('0x8')](),controller[_0x79f3('0x16')]);router[_0x79f3('0x14')](_0x79f3('0x17'),auth[_0x79f3('0x8')](),controller[_0x79f3('0x18')]);router[_0x79f3('0x19')](_0x79f3('0xb'),auth[_0x79f3('0x8')](),controller[_0x79f3('0x1a')]);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 df0fce8..35650b4 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 _0x45aa=['TEXT','medium','BOOLEAN','out','STRING','DATE','exports'];(function(_0x596c08,_0x262c3d){var _0x4bf37f=function(_0x4df873){while(--_0x4df873){_0x596c08['push'](_0x596c08['shift']());}};_0x4bf37f(++_0x262c3d);}(_0x45aa,0xdf));var _0xa45a=function(_0x1fb4d7,_0x5c252d){_0x1fb4d7=_0x1fb4d7-0x0;var _0x37b2bd=_0x45aa[_0x1fb4d7];return _0x37b2bd;};'use strict';var Sequelize=require('sequelize');module[_0xa45a('0x0')]={'body':{'type':Sequelize[_0xa45a('0x1')](_0xa45a('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa45a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa45a('0x4')),'defaultValue':_0xa45a('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa45a('0x5')](0xbe)},'phone':{'type':Sequelize[_0xa45a('0x5')]},'readAt':{'type':Sequelize[_0xa45a('0x6')]},'secret':{'type':Sequelize[_0xa45a('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa45a('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x689c=['out','STRING','TEXT','medium','BOOLEAN','ENUM'];(function(_0x5ccec4,_0x2c28ac){var _0xee7754=function(_0x5cbef1){while(--_0x5cbef1){_0x5ccec4['push'](_0x5ccec4['shift']());}};_0xee7754(++_0x2c28ac);}(_0x689c,0x9e));var _0xc689=function(_0x577f25,_0x309337){_0x577f25=_0x577f25-0x0;var _0x476aa5=_0x689c[_0x577f25];return _0x476aa5;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xc689('0x0')](_0xc689('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xc689('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc689('0x3')]('in',_0xc689('0x4')),'defaultValue':_0xc689('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xc689('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xc689('0x5')]},'providerResponse':{'type':Sequelize[_0xc689('0x0')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 3a60f6e..12434e9 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 _0x0733=['destroy','describe','accept','sms','read','format','UserId','user','agent','SmsInteraction','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','sms-interactions','reject','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','infobip','results','groupName','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','update','stack','name','send','SmsMessage','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','order','filters','filter','merge','where','VIRTUAL','options','include','findAll','rows','params','rawAttributes','create','body','find'];(function(_0x4ae7f3,_0x57f4a7){var _0x1aeed6=function(_0x1435a1){while(--_0x1435a1){_0x4ae7f3['push'](_0x4ae7f3['shift']());}};_0x1aeed6(++_0x57f4a7);}(_0x0733,0xc4));var _0x3073=function(_0x3b9185,_0x1c3a33){_0x3b9185=_0x3b9185-0x0;var _0x448659=_0x0733[_0x3b9185];return _0x448659;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3073('0x0'));var jsonpatch=require(_0x3073('0x1'));var rp=require(_0x3073('0x2'));var moment=require('moment');var BPromise=require(_0x3073('0x3'));var Mustache=require(_0x3073('0x4'));var util=require('util');var path=require(_0x3073('0x5'));var sox=require(_0x3073('0x6'));var csv=require(_0x3073('0x7'));var ejs=require(_0x3073('0x8'));var fs=require('fs');var fs_extra=require(_0x3073('0x9'));var _=require(_0x3073('0xa'));var squel=require(_0x3073('0xb'));var crypto=require(_0x3073('0xc'));var jsforce=require(_0x3073('0xd'));var deskjs=require(_0x3073('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3073('0xf'));var Redis=require(_0x3073('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3073('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3073('0x12'))(_0x3073('0x13'));var utils=require(_0x3073('0x14'));var config=require(_0x3073('0x15'));var licenseUtil=require(_0x3073('0x16'));var db=require(_0x3073('0x17'))['db'];config['redis']=_[_0x3073('0x18')](config[_0x3073('0x19')],{'host':_0x3073('0x1a'),'port':0x18eb});var socket=require(_0x3073('0x1b'))(new Redis(config[_0x3073('0x19')]));require(_0x3073('0x1c'))['register'](socket);var jayson=require(_0x3073('0x1d'));var client=jayson[_0x3073('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x3073('0x1e')][_0x3073('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5efc8d,_0x169772,_0x11fdf5,_0x15d485){return new BPromise(function(_0x5092bb,_0xf0c54){var _0x3b2714=_0x15d485||client;return _0x3b2714[_0x3073('0x20')](_0x5efc8d,_0x11fdf5)[_0x3073('0x21')](function(_0x53d147){logger[_0x3073('0x22')](_0x3073('0x23'),_0x169772,'request\x20sent');logger[_0x3073('0x24')](_0x3073('0x25'),_0x169772,_0x3073('0x26'),JSON['stringify'](_0x53d147));if(_0x53d147[_0x3073('0x27')]){if(_0x53d147['error']['code']===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x169772,_0x53d147[_0x3073('0x27')][_0x3073('0x28')]);return _0xf0c54(_0x53d147['error'][_0x3073('0x28')]);}logger[_0x3073('0x27')](_0x3073('0x23'),_0x169772,_0x53d147[_0x3073('0x27')][_0x3073('0x28')]);return _0x5092bb(_0x53d147[_0x3073('0x27')][_0x3073('0x28')]);}else{logger[_0x3073('0x22')](_0x3073('0x23'),_0x169772,_0x3073('0x26'));_0x5092bb(_0x53d147['result'][_0x3073('0x28')]);}})[_0x3073('0x29')](function(_0x5cb529){logger[_0x3073('0x27')](_0x3073('0x23'),_0x169772,_0x5cb529);_0xf0c54(_0x5cb529);});});}function respondWithStatusCode(_0x11a1d8,_0x1e3b1d){_0x1e3b1d=_0x1e3b1d||0xcc;return function(_0x2cebe3){if(_0x2cebe3){return _0x11a1d8[_0x3073('0x2a')](_0x1e3b1d);}return _0x11a1d8[_0x3073('0x2b')](_0x1e3b1d)[_0x3073('0x2c')]();};}function respondWithResult(_0x4f6cf8,_0x7a8bbf){_0x7a8bbf=_0x7a8bbf||0xc8;return function(_0x25dd5c){if(_0x25dd5c){return _0x4f6cf8[_0x3073('0x2b')](_0x7a8bbf)[_0x3073('0x2d')](_0x25dd5c);}};}function respondWithFilteredResult(_0x1fdbcd,_0x484c47){return function(_0x22cc0f){if(_0x22cc0f){var _0x1bc498=typeof _0x484c47['offset']===_0x3073('0x2e')&&typeof _0x484c47['limit']===_0x3073('0x2e');var _0xe91ff4=_0x22cc0f[_0x3073('0x2f')];var _0x53b76e=_0x1bc498?0x0:_0x484c47[_0x3073('0x30')];var _0xe1604=_0x1bc498?_0x22cc0f[_0x3073('0x2f')]:_0x484c47[_0x3073('0x30')]+_0x484c47[_0x3073('0x31')];var _0x31cfd6;if(_0xe1604>=_0xe91ff4){_0xe1604=_0xe91ff4;_0x31cfd6=0xc8;}else{_0x31cfd6=0xce;}_0x1fdbcd[_0x3073('0x2b')](_0x31cfd6);return _0x1fdbcd['set'](_0x3073('0x32'),_0x53b76e+'-'+_0xe1604+'/'+_0xe91ff4)[_0x3073('0x2d')](_0x22cc0f);}return null;};}function patchUpdates(_0x3c2059){return function(_0x215994){try{jsonpatch['apply'](_0x215994,_0x3c2059,!![]);}catch(_0x19bfc4){return BPromise['reject'](_0x19bfc4);}return _0x215994['save']();};}function saveUpdates(_0x6114b3,_0x57315d){return function(_0x26ea33){if(_0x26ea33){return _0x26ea33[_0x3073('0x33')](_0x6114b3)[_0x3073('0x21')](function(_0x2ea12e){return _0x2ea12e;});}return null;};}function removeEntity(_0x4fed16,_0x380e0e){return function(_0x9556d4){if(_0x9556d4){return _0x9556d4['destroy']()['then'](function(){_0x4fed16[_0x3073('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1553b2,_0x4498c7){return function(_0x19b937){if(!_0x19b937){_0x1553b2[_0x3073('0x2a')](0x194);}return _0x19b937;};}function handleError(_0x398f26,_0x5eaf42){_0x5eaf42=_0x5eaf42||0x1f4;return function(_0x2c6558){logger[_0x3073('0x27')](_0x2c6558[_0x3073('0x34')]);if(_0x2c6558[_0x3073('0x35')]){delete _0x2c6558[_0x3073('0x35')];}_0x398f26[_0x3073('0x2b')](_0x5eaf42)[_0x3073('0x36')](_0x2c6558);};}exports['index']=function(_0xb22b7e,_0xcc7d92){var _0x1bf71e={},_0x1b8e5b={},_0x499c05={'count':0x0,'rows':[]};var _0x52308c=_['map'](db[_0x3073('0x37')]['rawAttributes'],function(_0x569153){return{'name':_0x569153[_0x3073('0x38')],'type':_0x569153[_0x3073('0x39')][_0x3073('0x3a')]};});_0x1b8e5b['model']=_[_0x3073('0x3b')](_0x52308c,_0x3073('0x35'));_0x1b8e5b[_0x3073('0x3c')]=_[_0x3073('0x3d')](_0xb22b7e['query']);_0x1b8e5b['filters']=_[_0x3073('0x3e')](_0x1b8e5b[_0x3073('0x3f')],_0x1b8e5b[_0x3073('0x3c')]);_0x1bf71e[_0x3073('0x40')]=_['intersection'](_0x1b8e5b[_0x3073('0x3f')],qs['fields'](_0xb22b7e[_0x3073('0x3c')][_0x3073('0x41')]));_0x1bf71e[_0x3073('0x40')]=_0x1bf71e[_0x3073('0x40')][_0x3073('0x42')]?_0x1bf71e['attributes']:_0x1b8e5b['model'];if(!_0xb22b7e[_0x3073('0x3c')]['hasOwnProperty']('nolimit')){_0x1bf71e['limit']=qs[_0x3073('0x31')](_0xb22b7e[_0x3073('0x3c')]['limit']);_0x1bf71e[_0x3073('0x30')]=qs[_0x3073('0x30')](_0xb22b7e[_0x3073('0x3c')][_0x3073('0x30')]);}_0x1bf71e[_0x3073('0x43')]=qs['sort'](_0xb22b7e[_0x3073('0x3c')]['sort']);_0x1bf71e['where']=qs[_0x3073('0x44')](_['pick'](_0xb22b7e['query'],_0x1b8e5b[_0x3073('0x44')]),_0x52308c);if(_0xb22b7e['query'][_0x3073('0x45')]){_0x1bf71e['where']=_[_0x3073('0x46')](_0x1bf71e[_0x3073('0x47')],{'$or':_[_0x3073('0x3b')](_0x52308c,function(_0x47e3fb){if(_0x47e3fb[_0x3073('0x39')]!==_0x3073('0x48')){var _0x17ad0d={};_0x17ad0d[_0x47e3fb[_0x3073('0x35')]]={'$like':'%'+_0xb22b7e[_0x3073('0x3c')][_0x3073('0x45')]+'%'};return _0x17ad0d;}})});}_0x1bf71e=_[_0x3073('0x46')]({},_0x1bf71e,_0xb22b7e[_0x3073('0x49')]);var _0x293fec={'where':_0x1bf71e[_0x3073('0x47')]};return db[_0x3073('0x37')][_0x3073('0x2f')](_0x293fec)[_0x3073('0x21')](function(_0x122b0a){_0x499c05[_0x3073('0x2f')]=_0x122b0a;if(_0xb22b7e[_0x3073('0x3c')]['includeAll']){_0x1bf71e[_0x3073('0x4a')]=[{'all':!![]}];}return db[_0x3073('0x37')][_0x3073('0x4b')](_0x1bf71e);})[_0x3073('0x21')](function(_0x40ae29){_0x499c05[_0x3073('0x4c')]=_0x40ae29;return _0x499c05;})['then'](respondWithFilteredResult(_0xcc7d92,_0x1bf71e))['catch'](handleError(_0xcc7d92,null));};exports['show']=function(_0x4ce38d,_0x53b44e){var _0x5690fd={'raw':!![],'where':{'id':_0x4ce38d[_0x3073('0x4d')]['id']}},_0x2de6df={};_0x2de6df['model']=_[_0x3073('0x3d')](db[_0x3073('0x37')][_0x3073('0x4e')]);_0x2de6df[_0x3073('0x3c')]=_[_0x3073('0x3d')](_0x4ce38d[_0x3073('0x3c')]);_0x2de6df[_0x3073('0x44')]=_['intersection'](_0x2de6df['model'],_0x2de6df[_0x3073('0x3c')]);_0x5690fd['attributes']=_[_0x3073('0x3e')](_0x2de6df['model'],qs[_0x3073('0x41')](_0x4ce38d[_0x3073('0x3c')][_0x3073('0x41')]));_0x5690fd[_0x3073('0x40')]=_0x5690fd[_0x3073('0x40')]['length']?_0x5690fd[_0x3073('0x40')]:_0x2de6df[_0x3073('0x3f')];if(_0x4ce38d[_0x3073('0x3c')]['includeAll']){_0x5690fd['include']=[{'all':!![]}];}_0x5690fd=_[_0x3073('0x46')]({},_0x5690fd,_0x4ce38d[_0x3073('0x49')]);return db[_0x3073('0x37')]['find'](_0x5690fd)[_0x3073('0x21')](handleEntityNotFound(_0x53b44e,null))[_0x3073('0x21')](respondWithResult(_0x53b44e,null))[_0x3073('0x29')](handleError(_0x53b44e,null));};exports[_0x3073('0x4f')]=function(_0x2fbcc2,_0x3078c9){return db[_0x3073('0x37')][_0x3073('0x4f')](_0x2fbcc2['body'],{})[_0x3073('0x21')](respondWithResult(_0x3078c9,0xc9))[_0x3073('0x29')](handleError(_0x3078c9,null));};exports['update']=function(_0x3294ac,_0x2571cf){if(_0x3294ac[_0x3073('0x50')]['id']){delete _0x3294ac[_0x3073('0x50')]['id'];}return db[_0x3073('0x37')][_0x3073('0x51')]({'where':{'id':_0x3294ac[_0x3073('0x4d')]['id']}})[_0x3073('0x21')](handleEntityNotFound(_0x2571cf,null))[_0x3073('0x21')](saveUpdates(_0x3294ac[_0x3073('0x50')],null))[_0x3073('0x21')](respondWithResult(_0x2571cf,null))[_0x3073('0x29')](handleError(_0x2571cf,null));};exports[_0x3073('0x52')]=function(_0x258ce2,_0x5f01e6){return db[_0x3073('0x37')]['find']({'where':{'id':_0x258ce2[_0x3073('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5f01e6,null))[_0x3073('0x21')](removeEntity(_0x5f01e6,null))[_0x3073('0x29')](handleError(_0x5f01e6,null));};exports[_0x3073('0x53')]=function(_0x302c31,_0x2bbf7b){return db[_0x3073('0x37')][_0x3073('0x53')]()[_0x3073('0x21')](respondWithResult(_0x2bbf7b,null))[_0x3073('0x29')](handleError(_0x2bbf7b,null));};var interaction_log=require(_0x3073('0x12'))('sms-interactions');exports[_0x3073('0x54')]=function(_0x3feabf,_0x49b82c,_0x5e1e53){var _0xac8467={'agent':{},'channel':_0x3073('0x55')};if(_0x3feabf[_0x3073('0x50')]['id']){delete _0x3feabf[_0x3073('0x50')]['id'];}_0x3feabf[_0x3073('0x50')][_0x3073('0x56')]=!![];_0x3feabf['body']['readAt']=moment()[_0x3073('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x3feabf[_0x3073('0x50')][_0x3073('0x58')]=_0x3feabf[_0x3073('0x50')][_0x3073('0x58')]||_0x3feabf[_0x3073('0x59')]['id'];_0xac8467[_0x3073('0x5a')]['id']=_0x3feabf[_0x3073('0x50')][_0x3073('0x58')];return db[_0x3073('0x37')]['find']({'where':{'id':_0x3feabf[_0x3073('0x4d')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x49b82c,null))['then'](saveUpdates(_0x3feabf[_0x3073('0x50')],null))[_0x3073('0x21')](function(_0x47bf90){if(_0x47bf90){_0xac8467['message']=_0x47bf90['get']({'plain':!![]});return db[_0x3073('0x5b')]['find']({'where':{'id':_0x47bf90['SmsInteractionId']}});}return null;})[_0x3073('0x21')](handleEntityNotFound(_0x49b82c,null))[_0x3073('0x21')](function(_0x1f6c71){if(_0x1f6c71){return _0x1f6c71['update']({'UserId':_0x3feabf[_0x3073('0x50')][_0x3073('0x58')],'read1stAt':_[_0x3073('0x5c')](_0x1f6c71['read1stAt'])?moment()[_0x3073('0x57')](_0x3073('0x5d')):undefined});}return null;})[_0x3073('0x21')](function(_0x333170){if(_0x333170){_0xac8467[_0x3073('0x5e')]=_0x333170[_0x3073('0x5f')]({'plain':!![]});interaction_log[_0x3073('0x22')](_0x3073('0x60'),_0x3feabf[_0x3073('0x59')]['id'],_0x3feabf['user'][_0x3073('0x35')],_0x3feabf['user'][_0x3073('0x61')],_0xac8467[_0x3073('0x5e')]['id'],_0x3feabf['body']?JSON[_0x3073('0x62')](_0x3feabf[_0x3073('0x50')]):'null');return respondWithRpcPromise(_0x3073('0x63'),'acceptMessage',_0xac8467);}return null;})[_0x3073('0x21')](function(_0x19750d){var _0x1c38ea='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x19750d[_0x3073('0x28')][_0x3073('0x64')];return db[_0x3073('0x65')][_0x3073('0x3c')](_0x1c38ea,{'type':db[_0x3073('0x66')][_0x3073('0x67')][_0x3073('0x68')],'raw':!![]})[_0x3073('0x21')](function(_0x2c41d1){return _0x2c41d1;});})[_0x3073('0x21')](function(_0x355473){if(_0x355473){_0xac8467['message']['contact']=_0x355473[0x0];if(!_0x3feabf[_0x3073('0x50')][_0x3073('0x58')])return;return db[_0x3073('0x69')]['find']({'where':{'id':_0x3feabf[_0x3073('0x50')][_0x3073('0x58')],'role':'agent'},'attributes':['id',_0x3073('0x35'),'fullname',_0x3073('0x6a'),_0x3073('0x6b')],'raw':!![]});}return null;})[_0x3073('0x21')](function(_0x442132){if(!_0x442132)return null;_0xac8467[_0x3073('0x28')][_0x3073('0x5a')]=_0x442132;return _0xac8467;})[_0x3073('0x21')](function(_0xde06fa){if(_0xde06fa){if(_0x3feabf[_0x3073('0x50')][_0x3073('0x6c')]){_0xac8467[_0x3073('0x28')][_0x3073('0x6d')]=util['format'](_0x3073('0x6e'),_0x3feabf['user'][_0x3073('0x35')]);_0xac8467[_0x3073('0x28')]['channel']=_0xac8467[_0x3073('0x6f')];_0xac8467['message'][_0x3073('0x70')]=_0xac8467[_0x3073('0x6f')];_0xac8467[_0x3073('0x28')][_0x3073('0x71')]=_0x3073('0x54');return respondWithRpcPromise(_0x3073('0x72'),_0x3073('0x72'),{'event':_0x3073('0x73'),'message':_0xac8467['message']},client9002)[_0x3073('0x21')](function(){return _0xac8467;});}return _0xac8467;}return null;})[_0x3073('0x21')](respondWithResult(_0x49b82c,null))[_0x3073('0x29')](handleError(_0x49b82c,null));};var interaction_log=require('../../config/logger')(_0x3073('0x74'));exports[_0x3073('0x75')]=function(_0x51fa4d,_0x158b4c,_0x75ecd0){var _0x4189d7={'agent':{},'channel':_0x3073('0x55')};if(_0x51fa4d[_0x3073('0x50')]['id']){delete _0x51fa4d[_0x3073('0x50')]['id'];}_0x51fa4d['body'][_0x3073('0x58')]=_0x51fa4d[_0x3073('0x50')][_0x3073('0x58')]||_0x51fa4d[_0x3073('0x59')]['id'];_0x4189d7[_0x3073('0x5a')]['id']=_0x51fa4d[_0x3073('0x50')][_0x3073('0x58')];return db[_0x3073('0x37')][_0x3073('0x51')]({'where':{'id':_0x51fa4d['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x158b4c,null))[_0x3073('0x21')](function(_0x16a736){if(_0x16a736){_0x4189d7[_0x3073('0x28')]=_0x16a736[_0x3073('0x5f')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x16a736['SmsInteractionId']}});}return null;})[_0x3073('0x21')](handleEntityNotFound(_0x158b4c,null))['then'](function(_0x36cac2){if(_0x36cac2){_0x4189d7[_0x3073('0x5e')]=_0x36cac2[_0x3073('0x5f')]({'plain':!![]});interaction_log[_0x3073('0x22')](_0x3073('0x76'),_0x51fa4d[_0x3073('0x59')]['id'],_0x51fa4d[_0x3073('0x59')][_0x3073('0x35')],_0x51fa4d[_0x3073('0x59')][_0x3073('0x61')],_0x4189d7[_0x3073('0x5e')]['id'],_0x51fa4d[_0x3073('0x50')]?JSON[_0x3073('0x62')](_0x51fa4d[_0x3073('0x50')]):_0x3073('0x77'));return respondWithRpcPromise(_0x3073('0x78'),_0x3073('0x79'),_0x4189d7);}return null;})[_0x3073('0x21')](function(_0x2421a5){var _0x20e3b3=_0x3073('0x7a')+_0x2421a5['message'][_0x3073('0x64')];return db[_0x3073('0x65')][_0x3073('0x3c')](_0x20e3b3,{'type':db['Sequelize'][_0x3073('0x67')]['SELECT'],'raw':!![]})['then'](function(_0x436909){return _0x436909;});})[_0x3073('0x21')](function(_0x44f057){if(_0x44f057){_0x4189d7[_0x3073('0x28')][_0x3073('0x7b')]=_0x44f057[0x0];if(!_0x51fa4d['body'][_0x3073('0x58')])return;return db[_0x3073('0x69')][_0x3073('0x51')]({'where':{'id':_0x51fa4d[_0x3073('0x50')][_0x3073('0x58')],'role':'agent'},'attributes':['id',_0x3073('0x35'),'fullname',_0x3073('0x6a'),_0x3073('0x6b')],'raw':!![]});}return null;})[_0x3073('0x21')](function(_0x3a82c7){if(!_0x3a82c7)return null;_0x4189d7[_0x3073('0x28')]['agent']=_0x3a82c7;return _0x4189d7;})[_0x3073('0x21')](function(_0x336d5f){if(_0x336d5f){_0x336d5f[_0x3073('0x28')]['interface']=util['format']('SIP/%s',_0x51fa4d[_0x3073('0x59')]['name']);_0x336d5f['message'][_0x3073('0x6f')]=_0x4189d7[_0x3073('0x6f')];_0x336d5f[_0x3073('0x28')][_0x3073('0x70')]=_0x4189d7['channel'];_0x336d5f[_0x3073('0x28')][_0x3073('0x71')]=_0x3073('0x75');respondWithRpcPromise(_0x3073('0x72'),_0x3073('0x72'),{'event':_0x3073('0x7c'),'message':_0x336d5f[_0x3073('0x28')]},client9002);return _0x4189d7;}return null;})[_0x3073('0x21')](respondWithResult(_0x158b4c,null))['catch'](handleError(_0x158b4c,null));};exports[_0x3073('0x2b')]=function(_0x1b5578,_0x3b7273,_0x2eeae7){if(_0x1b5578[_0x3073('0x50')]['id']){delete _0x1b5578['body']['id'];}var _0x58a97a;return db[_0x3073('0x37')]['find']({'where':{'id':_0x1b5578[_0x3073('0x4d')]['id']}})[_0x3073('0x21')](handleEntityNotFound(_0x3b7273,null))[_0x3073('0x21')](function(_0x55747c){if(_0x55747c){_0x58a97a=_0x55747c;return db[_0x3073('0x7d')][_0x3073('0x51')]({'where':{'id':_0x55747c['SmsAccountId']}});}})[_0x3073('0x21')](handleEntityNotFound(_0x3b7273,null))[_0x3073('0x21')](function(_0x382d29){if(_0x382d29){logger['debug'](_0x3073('0x25'),_0x3073('0x2b'),_0x3073('0x7e'),_0x382d29[_0x3073('0x39')],util['inspect'](_0x1b5578[_0x3073('0x50')],{'showHidden':![],'depth':null}));switch(_0x382d29[_0x3073('0x39')]){case _0x3073('0x7f'):if(_0x1b5578[_0x3073('0x50')]['MessageSid']&&_0x1b5578[_0x3073('0x50')][_0x3073('0x80')]===_0x58a97a[_0x3073('0x81')]){return _0x58a97a[_0x3073('0x33')]({'read':!![]});}else{logger[_0x3073('0x27')](_0x3073('0x82'),_0x3073('0x2b'),_0x3073('0x7f'),util[_0x3073('0x83')](_0x1b5578[_0x3073('0x50')],{'showHidden':![],'depth':null}));}break;case _0x3073('0x84'):if(_0x1b5578['body'][_0x3073('0x85')]&&_0x1b5578[_0x3073('0x50')][_0x3073('0x85')]===_0x58a97a[_0x3073('0x81')]&&_[_0x3073('0x86')]([_0x3073('0x87'),'delivered'],_0x1b5578[_0x3073('0x50')]['Status'])>=0x0){return _0x58a97a['update']({'read':!![]});}else{logger['error'](_0x3073('0x82'),_0x3073('0x2b'),'plivio',util[_0x3073('0x83')](_0x1b5578[_0x3073('0x50')],{'showHidden':![],'depth':null}));}break;case _0x3073('0x88'):var _0x5c5c98=_0x1b5578['body'][_0x3073('0x89')][0x0];if(_0x5c5c98[_0x3073('0x2b')][_0x3073('0x8a')]==='DELIVERED'){return _0x58a97a['update']({'read':!![]});}else{logger[_0x3073('0x27')](_0x3073('0x82'),'status','infobip',util['inspect'](_0x1b5578[_0x3073('0x50')],{'showHidden':![],'depth':null}));}break;}return _0x58a97a;}})['then'](respondWithResult(_0x3b7273,null))['catch'](handleError(_0x3b7273,null));}; \ No newline at end of file +var _0x4efb=['apply','reject','save','update','then','destroy','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','options','include','rows','show','params','SmsMessage','fields','length','includeAll','merge','create','body','find','describe','sms-interactions','accept','sms','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','User','fullname','interface','format','channel','motionChannel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','Sequelize','email','internal','SIP/%s','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','sent','delivered','Status','plivio','groupName','DELIVERED','infobip','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','Content-Range'];(function(_0x2fc113,_0x45ec6e){var _0x5144ce=function(_0x47fd29){while(--_0x47fd29){_0x2fc113['push'](_0x2fc113['shift']());}};_0x5144ce(++_0x45ec6e);}(_0x4efb,0xfa));var _0xb4ef=function(_0x511d8b,_0x596662){_0x511d8b=_0x511d8b-0x0;var _0x1f8e88=_0x4efb[_0x511d8b];return _0x1f8e88;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb4ef('0x0'));var zipdir=require(_0xb4ef('0x1'));var jsonpatch=require(_0xb4ef('0x2'));var rp=require('request-promise');var moment=require(_0xb4ef('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb4ef('0x4'));var util=require(_0xb4ef('0x5'));var path=require('path');var sox=require(_0xb4ef('0x6'));var csv=require('to-csv');var ejs=require(_0xb4ef('0x7'));var fs=require('fs');var fs_extra=require(_0xb4ef('0x8'));var _=require(_0xb4ef('0x9'));var squel=require(_0xb4ef('0xa'));var crypto=require(_0xb4ef('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb4ef('0xc'));var toCsv=require(_0xb4ef('0xd'));var querystring=require(_0xb4ef('0xe'));var Papa=require(_0xb4ef('0xf'));var Redis=require(_0xb4ef('0x10'));var authService=require(_0xb4ef('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb4ef('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb4ef('0x13'))(_0xb4ef('0x14'));var utils=require(_0xb4ef('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb4ef('0x16'));var db=require(_0xb4ef('0x17'))['db'];config[_0xb4ef('0x18')]=_[_0xb4ef('0x19')](config[_0xb4ef('0x18')],{'host':_0xb4ef('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb4ef('0x18')]));require('./smsMessage.socket')[_0xb4ef('0x1b')](socket);var jayson=require(_0xb4ef('0x1c'));var client=jayson[_0xb4ef('0x1d')][_0xb4ef('0x1e')]({'port':0x232c});var client9002=jayson[_0xb4ef('0x1d')][_0xb4ef('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x187370,_0x4a20a6,_0x3c9671,_0x6a401a){return new BPromise(function(_0x3cb21e,_0x2b9b20){var _0x3cc3b7=_0x6a401a||client;return _0x3cc3b7[_0xb4ef('0x1f')](_0x187370,_0x3c9671)['then'](function(_0x1d8bca){logger[_0xb4ef('0x20')](_0xb4ef('0x21'),_0x4a20a6,_0xb4ef('0x22'));logger[_0xb4ef('0x23')](_0xb4ef('0x24'),_0x4a20a6,_0xb4ef('0x22'),JSON['stringify'](_0x1d8bca));if(_0x1d8bca[_0xb4ef('0x25')]){if(_0x1d8bca['error'][_0xb4ef('0x26')]===0x1f4){logger[_0xb4ef('0x25')](_0xb4ef('0x21'),_0x4a20a6,_0x1d8bca[_0xb4ef('0x25')][_0xb4ef('0x27')]);return _0x2b9b20(_0x1d8bca[_0xb4ef('0x25')][_0xb4ef('0x27')]);}logger[_0xb4ef('0x25')](_0xb4ef('0x21'),_0x4a20a6,_0x1d8bca[_0xb4ef('0x25')]['message']);return _0x3cb21e(_0x1d8bca[_0xb4ef('0x25')][_0xb4ef('0x27')]);}else{logger['info'](_0xb4ef('0x21'),_0x4a20a6,'request\x20sent');_0x3cb21e(_0x1d8bca[_0xb4ef('0x28')]['message']);}})[_0xb4ef('0x29')](function(_0x4b702d){logger[_0xb4ef('0x25')](_0xb4ef('0x21'),_0x4a20a6,_0x4b702d);_0x2b9b20(_0x4b702d);});});}function respondWithStatusCode(_0x50e25a,_0x5e3a6b){_0x5e3a6b=_0x5e3a6b||0xcc;return function(_0x7e0dd0){if(_0x7e0dd0){return _0x50e25a[_0xb4ef('0x2a')](_0x5e3a6b);}return _0x50e25a[_0xb4ef('0x2b')](_0x5e3a6b)[_0xb4ef('0x2c')]();};}function respondWithResult(_0x3e0917,_0x594747){_0x594747=_0x594747||0xc8;return function(_0x4e3cb2){if(_0x4e3cb2){return _0x3e0917['status'](_0x594747)[_0xb4ef('0x2d')](_0x4e3cb2);}};}function respondWithFilteredResult(_0x16d6cc,_0x4ce2c5){return function(_0x145476){if(_0x145476){var _0x2a5f05=typeof _0x4ce2c5[_0xb4ef('0x2e')]==='undefined'&&typeof _0x4ce2c5['limit']===_0xb4ef('0x2f');var _0x27b3fb=_0x145476[_0xb4ef('0x30')];var _0x4db567=_0x2a5f05?0x0:_0x4ce2c5[_0xb4ef('0x2e')];var _0x465f91=_0x2a5f05?_0x145476[_0xb4ef('0x30')]:_0x4ce2c5[_0xb4ef('0x2e')]+_0x4ce2c5['limit'];var _0x14160f;if(_0x465f91>=_0x27b3fb){_0x465f91=_0x27b3fb;_0x14160f=0xc8;}else{_0x14160f=0xce;}_0x16d6cc[_0xb4ef('0x2b')](_0x14160f);return _0x16d6cc['set'](_0xb4ef('0x31'),_0x4db567+'-'+_0x465f91+'/'+_0x27b3fb)['json'](_0x145476);}return null;};}function patchUpdates(_0x1545d3){return function(_0x3f13ec){try{jsonpatch[_0xb4ef('0x32')](_0x3f13ec,_0x1545d3,!![]);}catch(_0x11278d){return BPromise[_0xb4ef('0x33')](_0x11278d);}return _0x3f13ec[_0xb4ef('0x34')]();};}function saveUpdates(_0x597d00,_0x30f4a0){return function(_0x2252e5){if(_0x2252e5){return _0x2252e5[_0xb4ef('0x35')](_0x597d00)[_0xb4ef('0x36')](function(_0x518a7c){return _0x518a7c;});}return null;};}function removeEntity(_0xe1f26c,_0x49e78a){return function(_0x37daa0){if(_0x37daa0){return _0x37daa0[_0xb4ef('0x37')]()[_0xb4ef('0x36')](function(){_0xe1f26c['status'](0xcc)[_0xb4ef('0x2c')]();});}};}function handleEntityNotFound(_0x23e348,_0x36c1b4){return function(_0x88311f){if(!_0x88311f){_0x23e348['sendStatus'](0x194);}return _0x88311f;};}function handleError(_0x1fa01c,_0x332413){_0x332413=_0x332413||0x1f4;return function(_0x478084){logger[_0xb4ef('0x25')](_0x478084[_0xb4ef('0x38')]);if(_0x478084['name']){delete _0x478084[_0xb4ef('0x39')];}_0x1fa01c[_0xb4ef('0x2b')](_0x332413)[_0xb4ef('0x3a')](_0x478084);};}exports[_0xb4ef('0x3b')]=function(_0x3e02e4,_0x5a4904){var _0x5389c0={},_0x4b4ec9={},_0x1ba436={'count':0x0,'rows':[]};var _0x519658=_[_0xb4ef('0x3c')](db['SmsMessage']['rawAttributes'],function(_0x1e589e){return{'name':_0x1e589e[_0xb4ef('0x3d')],'type':_0x1e589e[_0xb4ef('0x3e')][_0xb4ef('0x3f')]};});_0x4b4ec9[_0xb4ef('0x40')]=_['map'](_0x519658,'name');_0x4b4ec9[_0xb4ef('0x41')]=_[_0xb4ef('0x42')](_0x3e02e4[_0xb4ef('0x41')]);_0x4b4ec9[_0xb4ef('0x43')]=_[_0xb4ef('0x44')](_0x4b4ec9[_0xb4ef('0x40')],_0x4b4ec9['query']);_0x5389c0[_0xb4ef('0x45')]=_[_0xb4ef('0x44')](_0x4b4ec9['model'],qs['fields'](_0x3e02e4[_0xb4ef('0x41')]['fields']));_0x5389c0[_0xb4ef('0x45')]=_0x5389c0[_0xb4ef('0x45')]['length']?_0x5389c0[_0xb4ef('0x45')]:_0x4b4ec9['model'];if(!_0x3e02e4[_0xb4ef('0x41')][_0xb4ef('0x46')](_0xb4ef('0x47'))){_0x5389c0['limit']=qs[_0xb4ef('0x48')](_0x3e02e4[_0xb4ef('0x41')]['limit']);_0x5389c0['offset']=qs[_0xb4ef('0x2e')](_0x3e02e4[_0xb4ef('0x41')][_0xb4ef('0x2e')]);}_0x5389c0[_0xb4ef('0x49')]=qs[_0xb4ef('0x4a')](_0x3e02e4[_0xb4ef('0x41')][_0xb4ef('0x4a')]);_0x5389c0[_0xb4ef('0x4b')]=qs[_0xb4ef('0x43')](_[_0xb4ef('0x4c')](_0x3e02e4['query'],_0x4b4ec9[_0xb4ef('0x43')]),_0x519658);if(_0x3e02e4['query']['filter']){_0x5389c0['where']=_['merge'](_0x5389c0[_0xb4ef('0x4b')],{'$or':_[_0xb4ef('0x3c')](_0x519658,function(_0xec9f35){if(_0xec9f35[_0xb4ef('0x3e')]!=='VIRTUAL'){var _0x447f4d={};_0x447f4d[_0xec9f35[_0xb4ef('0x39')]]={'$like':'%'+_0x3e02e4[_0xb4ef('0x41')][_0xb4ef('0x4d')]+'%'};return _0x447f4d;}})});}_0x5389c0=_['merge']({},_0x5389c0,_0x3e02e4[_0xb4ef('0x4e')]);var _0x588ae2={'where':_0x5389c0[_0xb4ef('0x4b')]};return db['SmsMessage'][_0xb4ef('0x30')](_0x588ae2)['then'](function(_0x357d9d){_0x1ba436['count']=_0x357d9d;if(_0x3e02e4[_0xb4ef('0x41')]['includeAll']){_0x5389c0[_0xb4ef('0x4f')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x5389c0);})[_0xb4ef('0x36')](function(_0x4ae7bd){_0x1ba436[_0xb4ef('0x50')]=_0x4ae7bd;return _0x1ba436;})['then'](respondWithFilteredResult(_0x5a4904,_0x5389c0))[_0xb4ef('0x29')](handleError(_0x5a4904,null));};exports[_0xb4ef('0x51')]=function(_0x1cd3c3,_0x5da32d){var _0x12f2e2={'raw':!![],'where':{'id':_0x1cd3c3[_0xb4ef('0x52')]['id']}},_0x4662be={};_0x4662be[_0xb4ef('0x40')]=_['keys'](db[_0xb4ef('0x53')]['rawAttributes']);_0x4662be['query']=_[_0xb4ef('0x42')](_0x1cd3c3[_0xb4ef('0x41')]);_0x4662be[_0xb4ef('0x43')]=_['intersection'](_0x4662be[_0xb4ef('0x40')],_0x4662be[_0xb4ef('0x41')]);_0x12f2e2[_0xb4ef('0x45')]=_[_0xb4ef('0x44')](_0x4662be[_0xb4ef('0x40')],qs['fields'](_0x1cd3c3['query'][_0xb4ef('0x54')]));_0x12f2e2['attributes']=_0x12f2e2[_0xb4ef('0x45')][_0xb4ef('0x55')]?_0x12f2e2[_0xb4ef('0x45')]:_0x4662be['model'];if(_0x1cd3c3[_0xb4ef('0x41')][_0xb4ef('0x56')]){_0x12f2e2['include']=[{'all':!![]}];}_0x12f2e2=_[_0xb4ef('0x57')]({},_0x12f2e2,_0x1cd3c3['options']);return db[_0xb4ef('0x53')]['find'](_0x12f2e2)[_0xb4ef('0x36')](handleEntityNotFound(_0x5da32d,null))[_0xb4ef('0x36')](respondWithResult(_0x5da32d,null))[_0xb4ef('0x29')](handleError(_0x5da32d,null));};exports['create']=function(_0x2dca79,_0x2caacd){return db[_0xb4ef('0x53')][_0xb4ef('0x58')](_0x2dca79[_0xb4ef('0x59')],{})[_0xb4ef('0x36')](respondWithResult(_0x2caacd,0xc9))['catch'](handleError(_0x2caacd,null));};exports[_0xb4ef('0x35')]=function(_0x507d7c,_0x38db2a){if(_0x507d7c[_0xb4ef('0x59')]['id']){delete _0x507d7c[_0xb4ef('0x59')]['id'];}return db[_0xb4ef('0x53')][_0xb4ef('0x5a')]({'where':{'id':_0x507d7c[_0xb4ef('0x52')]['id']}})[_0xb4ef('0x36')](handleEntityNotFound(_0x38db2a,null))[_0xb4ef('0x36')](saveUpdates(_0x507d7c[_0xb4ef('0x59')],null))[_0xb4ef('0x36')](respondWithResult(_0x38db2a,null))[_0xb4ef('0x29')](handleError(_0x38db2a,null));};exports[_0xb4ef('0x37')]=function(_0xd20996,_0x3d059d){return db[_0xb4ef('0x53')][_0xb4ef('0x5a')]({'where':{'id':_0xd20996['params']['id']}})[_0xb4ef('0x36')](handleEntityNotFound(_0x3d059d,null))['then'](removeEntity(_0x3d059d,null))[_0xb4ef('0x29')](handleError(_0x3d059d,null));};exports[_0xb4ef('0x5b')]=function(_0x402493,_0x22c73b){return db['SmsMessage'][_0xb4ef('0x5b')]()[_0xb4ef('0x36')](respondWithResult(_0x22c73b,null))[_0xb4ef('0x29')](handleError(_0x22c73b,null));};var interaction_log=require(_0xb4ef('0x13'))(_0xb4ef('0x5c'));exports[_0xb4ef('0x5d')]=function(_0x1c7c90,_0x503fe9,_0x286ec3){var _0x308db7={'agent':{},'channel':_0xb4ef('0x5e')};if(_0x1c7c90[_0xb4ef('0x59')]['id']){delete _0x1c7c90['body']['id'];}_0x1c7c90[_0xb4ef('0x59')][_0xb4ef('0x5f')]=!![];_0x1c7c90[_0xb4ef('0x59')]['readAt']=moment()['format'](_0xb4ef('0x60'));_0x1c7c90[_0xb4ef('0x59')][_0xb4ef('0x61')]=_0x1c7c90[_0xb4ef('0x59')]['UserId']||_0x1c7c90[_0xb4ef('0x62')]['id'];_0x308db7[_0xb4ef('0x63')]['id']=_0x1c7c90['body'][_0xb4ef('0x61')];return db[_0xb4ef('0x53')]['find']({'where':{'id':_0x1c7c90[_0xb4ef('0x52')]['id'],'UserId':null}})[_0xb4ef('0x36')](handleEntityNotFound(_0x503fe9,null))[_0xb4ef('0x36')](saveUpdates(_0x1c7c90[_0xb4ef('0x59')],null))[_0xb4ef('0x36')](function(_0x1f6f66){if(_0x1f6f66){_0x308db7[_0xb4ef('0x27')]=_0x1f6f66[_0xb4ef('0x64')]({'plain':!![]});return db[_0xb4ef('0x65')][_0xb4ef('0x5a')]({'where':{'id':_0x1f6f66[_0xb4ef('0x66')]}});}return null;})[_0xb4ef('0x36')](handleEntityNotFound(_0x503fe9,null))[_0xb4ef('0x36')](function(_0x27237c){if(_0x27237c){return _0x27237c[_0xb4ef('0x35')]({'UserId':_0x1c7c90[_0xb4ef('0x59')]['UserId'],'read1stAt':_[_0xb4ef('0x67')](_0x27237c[_0xb4ef('0x68')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xb4ef('0x36')](function(_0x364982){if(_0x364982){_0x308db7[_0xb4ef('0x69')]=_0x364982[_0xb4ef('0x64')]({'plain':!![]});interaction_log[_0xb4ef('0x20')](_0xb4ef('0x6a'),_0x1c7c90[_0xb4ef('0x62')]['id'],_0x1c7c90['user'][_0xb4ef('0x39')],_0x1c7c90[_0xb4ef('0x62')][_0xb4ef('0x6b')],_0x308db7[_0xb4ef('0x69')]['id'],_0x1c7c90['body']?JSON[_0xb4ef('0x6c')](_0x1c7c90[_0xb4ef('0x59')]):_0xb4ef('0x6d'));return respondWithRpcPromise(_0xb4ef('0x6e'),_0xb4ef('0x6f'),_0x308db7);}return null;})[_0xb4ef('0x36')](function(_0x5b93c0){var _0x197a0f=_0xb4ef('0x70')+_0x5b93c0['message'][_0xb4ef('0x71')];return db['sequelize'][_0xb4ef('0x41')](_0x197a0f,{'type':db['Sequelize'][_0xb4ef('0x72')][_0xb4ef('0x73')],'raw':!![]})[_0xb4ef('0x36')](function(_0x42e1b6){return _0x42e1b6;});})[_0xb4ef('0x36')](function(_0x57a953){if(_0x57a953){_0x308db7[_0xb4ef('0x27')][_0xb4ef('0x74')]=_0x57a953[0x0];if(!_0x1c7c90[_0xb4ef('0x59')]['UserId'])return;return db[_0xb4ef('0x75')]['find']({'where':{'id':_0x1c7c90[_0xb4ef('0x59')]['UserId'],'role':'agent'},'attributes':['id','name',_0xb4ef('0x76'),'email','internal'],'raw':!![]});}return null;})[_0xb4ef('0x36')](function(_0x40c8fb){if(!_0x40c8fb)return null;_0x308db7['message']['agent']=_0x40c8fb;return _0x308db7;})[_0xb4ef('0x36')](function(_0x31bfeb){if(_0x31bfeb){if(_0x1c7c90[_0xb4ef('0x59')]['manual']){_0x308db7['message'][_0xb4ef('0x77')]=util[_0xb4ef('0x78')]('SIP/%s',_0x1c7c90['user']['name']);_0x308db7[_0xb4ef('0x27')][_0xb4ef('0x79')]=_0x308db7[_0xb4ef('0x79')];_0x308db7[_0xb4ef('0x27')][_0xb4ef('0x7a')]=_0x308db7[_0xb4ef('0x79')];_0x308db7[_0xb4ef('0x27')][_0xb4ef('0x7b')]=_0xb4ef('0x5d');return respondWithRpcPromise(_0xb4ef('0x7c'),_0xb4ef('0x7c'),{'event':_0xb4ef('0x7d'),'message':_0x308db7[_0xb4ef('0x27')]},client9002)[_0xb4ef('0x36')](function(){return _0x308db7;});}return _0x308db7;}return null;})[_0xb4ef('0x36')](respondWithResult(_0x503fe9,null))[_0xb4ef('0x29')](handleError(_0x503fe9,null));};var interaction_log=require(_0xb4ef('0x13'))('sms-interactions');exports[_0xb4ef('0x33')]=function(_0x4b82ea,_0x12b04e,_0x1c84ba){var _0x55de43={'agent':{},'channel':_0xb4ef('0x5e')};if(_0x4b82ea['body']['id']){delete _0x4b82ea[_0xb4ef('0x59')]['id'];}_0x4b82ea[_0xb4ef('0x59')]['UserId']=_0x4b82ea[_0xb4ef('0x59')][_0xb4ef('0x61')]||_0x4b82ea[_0xb4ef('0x62')]['id'];_0x55de43[_0xb4ef('0x63')]['id']=_0x4b82ea[_0xb4ef('0x59')][_0xb4ef('0x61')];return db[_0xb4ef('0x53')][_0xb4ef('0x5a')]({'where':{'id':_0x4b82ea['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x12b04e,null))['then'](function(_0x288ee7){if(_0x288ee7){_0x55de43[_0xb4ef('0x27')]=_0x288ee7['get']({'plain':!![]});return db['SmsInteraction'][_0xb4ef('0x5a')]({'where':{'id':_0x288ee7[_0xb4ef('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x12b04e,null))[_0xb4ef('0x36')](function(_0x58408f){if(_0x58408f){_0x55de43[_0xb4ef('0x69')]=_0x58408f[_0xb4ef('0x64')]({'plain':!![]});interaction_log['info'](_0xb4ef('0x7e'),_0x4b82ea[_0xb4ef('0x62')]['id'],_0x4b82ea[_0xb4ef('0x62')][_0xb4ef('0x39')],_0x4b82ea[_0xb4ef('0x62')]['role'],_0x55de43[_0xb4ef('0x69')]['id'],_0x4b82ea[_0xb4ef('0x59')]?JSON[_0xb4ef('0x6c')](_0x4b82ea['body']):'null');return respondWithRpcPromise(_0xb4ef('0x7f'),_0xb4ef('0x80'),_0x55de43);}return null;})[_0xb4ef('0x36')](function(_0x369804){var _0x210ddf=_0xb4ef('0x70')+_0x369804[_0xb4ef('0x27')][_0xb4ef('0x71')];return db[_0xb4ef('0x81')][_0xb4ef('0x41')](_0x210ddf,{'type':db[_0xb4ef('0x82')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x2dcfee){return _0x2dcfee;});})['then'](function(_0x366aed){if(_0x366aed){_0x55de43[_0xb4ef('0x27')][_0xb4ef('0x74')]=_0x366aed[0x0];if(!_0x4b82ea['body'][_0xb4ef('0x61')])return;return db[_0xb4ef('0x75')][_0xb4ef('0x5a')]({'where':{'id':_0x4b82ea[_0xb4ef('0x59')][_0xb4ef('0x61')],'role':_0xb4ef('0x63')},'attributes':['id',_0xb4ef('0x39'),'fullname',_0xb4ef('0x83'),_0xb4ef('0x84')],'raw':!![]});}return null;})[_0xb4ef('0x36')](function(_0x35e239){if(!_0x35e239)return null;_0x55de43[_0xb4ef('0x27')][_0xb4ef('0x63')]=_0x35e239;return _0x55de43;})[_0xb4ef('0x36')](function(_0x342c78){if(_0x342c78){_0x342c78['message'][_0xb4ef('0x77')]=util[_0xb4ef('0x78')](_0xb4ef('0x85'),_0x4b82ea[_0xb4ef('0x62')]['name']);_0x342c78[_0xb4ef('0x27')]['channel']=_0x55de43[_0xb4ef('0x79')];_0x342c78[_0xb4ef('0x27')][_0xb4ef('0x7a')]=_0x55de43['channel'];_0x342c78['message'][_0xb4ef('0x7b')]=_0xb4ef('0x33');respondWithRpcPromise(_0xb4ef('0x7c'),_0xb4ef('0x7c'),{'event':'rejectmessage','message':_0x342c78['message']},client9002);return _0x55de43;}return null;})['then'](respondWithResult(_0x12b04e,null))['catch'](handleError(_0x12b04e,null));};exports[_0xb4ef('0x2b')]=function(_0x2df886,_0x5c9e03,_0xa09e86){if(_0x2df886[_0xb4ef('0x59')]['id']){delete _0x2df886['body']['id'];}var _0x45ca3a;return db[_0xb4ef('0x53')]['find']({'where':{'id':_0x2df886[_0xb4ef('0x52')]['id']}})['then'](handleEntityNotFound(_0x5c9e03,null))[_0xb4ef('0x36')](function(_0x2b16dd){if(_0x2b16dd){_0x45ca3a=_0x2b16dd;return db['SmsAccount'][_0xb4ef('0x5a')]({'where':{'id':_0x2b16dd[_0xb4ef('0x86')]}});}})[_0xb4ef('0x36')](handleEntityNotFound(_0x5c9e03,null))[_0xb4ef('0x36')](function(_0x195a25){if(_0x195a25){logger[_0xb4ef('0x23')](_0xb4ef('0x24'),_0xb4ef('0x2b'),_0xb4ef('0x87'),_0x195a25[_0xb4ef('0x3e')],util[_0xb4ef('0x88')](_0x2df886[_0xb4ef('0x59')],{'showHidden':![],'depth':null}));switch(_0x195a25[_0xb4ef('0x3e')]){case _0xb4ef('0x89'):if(_0x2df886[_0xb4ef('0x59')][_0xb4ef('0x8a')]&&_0x2df886[_0xb4ef('0x59')][_0xb4ef('0x8a')]===_0x45ca3a[_0xb4ef('0x8b')]){return _0x45ca3a[_0xb4ef('0x35')]({'read':!![]});}else{logger[_0xb4ef('0x25')](_0xb4ef('0x8c'),'status','twilio',util['inspect'](_0x2df886[_0xb4ef('0x59')],{'showHidden':![],'depth':null}));}break;case _0xb4ef('0x8d'):if(_0x2df886[_0xb4ef('0x59')][_0xb4ef('0x8e')]&&_0x2df886[_0xb4ef('0x59')][_0xb4ef('0x8e')]===_0x45ca3a['messageId']&&_['indexOf']([_0xb4ef('0x8f'),_0xb4ef('0x90')],_0x2df886[_0xb4ef('0x59')][_0xb4ef('0x91')])>=0x0){return _0x45ca3a[_0xb4ef('0x35')]({'read':!![]});}else{logger[_0xb4ef('0x25')](_0xb4ef('0x8c'),'status',_0xb4ef('0x92'),util[_0xb4ef('0x88')](_0x2df886[_0xb4ef('0x59')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0xd1ccc8=_0x2df886[_0xb4ef('0x59')]['results'][0x0];if(_0xd1ccc8[_0xb4ef('0x2b')][_0xb4ef('0x93')]===_0xb4ef('0x94')){return _0x45ca3a[_0xb4ef('0x35')]({'read':!![]});}else{logger[_0xb4ef('0x25')](_0xb4ef('0x8c'),_0xb4ef('0x2b'),_0xb4ef('0x95'),util[_0xb4ef('0x88')](_0x2df886[_0xb4ef('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x45ca3a;}})['then'](respondWithResult(_0x5c9e03,null))[_0xb4ef('0x29')](handleError(_0x5c9e03,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 0a3cc16..4dfab07 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 _0x7581=['SmsMessage','save','update','emit','hook','events','../../mysqldb'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7581,0xf3));var _0x1758=function(_0x1b5783,_0x2b572d){_0x1b5783=_0x1b5783-0x0;var _0x5182d8=_0x7581[_0x1b5783];return _0x5182d8;};'use strict';var EventEmitter=require(_0x1758('0x0'));var SmsMessage=require(_0x1758('0x1'))['db'][_0x1758('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1758('0x3'),'afterUpdate':_0x1758('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2beb91){return function(_0x3273e6,_0x5a7e46,_0x12e989){SmsMessageEvents[_0x1758('0x5')](_0x2beb91+':'+_0x3273e6['id'],_0x3273e6);SmsMessageEvents[_0x1758('0x5')](_0x2beb91,_0x3273e6);_0x12e989(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x1758('0x6')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x7e1e=['../../mysqldb','SmsMessage','setMaxListeners','save','emit','hasOwnProperty','exports','events'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x7e1e,0xa7));var _0xe7e1=function(_0x1e40e2,_0x1a2ce2){_0x1e40e2=_0x1e40e2-0x0;var _0x1962e7=_0x7e1e[_0x1e40e2];return _0x1962e7;};'use strict';var EventEmitter=require(_0xe7e1('0x0'));var SmsMessage=require(_0xe7e1('0x1'))['db'][_0xe7e1('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xe7e1('0x3')](0x0);var events={'afterCreate':_0xe7e1('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5393c7){return function(_0x56acf0,_0x59e221,_0x1eb7fe){SmsMessageEvents[_0xe7e1('0x5')](_0x5393c7+':'+_0x56acf0['id'],_0x56acf0);SmsMessageEvents[_0xe7e1('0x5')](_0x5393c7,_0x56acf0);_0x1eb7fe(null);};}for(var e in events){if(events[_0xe7e1('0x6')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xe7e1('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index aa516df..7676656 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 _0x2786=['SmsInteractionId','then','createdAt','toLowerCase','catch','error','SmsAccountId','type','twilio','authToken','phone','accountSid','create','remote','/api/sms/messages/','token','sid','update','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','afterCreate','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','Basic\x20%s','base64','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','messages','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','keys','sort','length','createHash','md5','digest','hex','/external/get/send.php?','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','secret','isNil','UserId','findOne'];(function(_0x409deb,_0x2b731){var _0x15a4f7=function(_0x556510){while(--_0x556510){_0x409deb['push'](_0x409deb['shift']());}};_0x15a4f7(++_0x2b731);}(_0x2786,0x6a));var _0x6278=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2786[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6278('0x0'));var util=require('util');var logger=require(_0x6278('0x1'))('api');var moment=require(_0x6278('0x2'));var BPromise=require(_0x6278('0x3'));var rp=require(_0x6278('0x4'));var fs=require('fs');var path=require(_0x6278('0x5'));var rimraf=require('rimraf');var config=require(_0x6278('0x6'));var attributes=require(_0x6278('0x7'));module['exports']=function(_0x5dc25f,_0x4a2291){return _0x5dc25f[_0x6278('0x8')](_0x6278('0x9'),attributes,{'tableName':_0x6278('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x6278('0xb')]},{'name':_0x6278('0xc'),'fields':[_0x6278('0xd')],'type':_0x6278('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b9323,_0x5c5ad7,_0xd045cb){var _0x102fbc=_0x5dc25f[_0x6278('0xf')];var _0x1d5788=_0x4b9323[_0x6278('0x10')]({'plain':!![]});if(_0x1d5788[_0x6278('0x11')]['toLowerCase']()==='in'||_0x1d5788[_0x6278('0x11')]['toLowerCase']()==='out'&&!_0x1d5788[_0x6278('0x12')]&&!_[_0x6278('0x13')](_0x1d5788[_0x6278('0x14')])&&!_[_0x6278('0x13')](_0x1d5788['SmsInteractionId'])){_0x102fbc['SmsInteraction'][_0x6278('0x15')]({'where':{'id':_0x1d5788[_0x6278('0x16')]}})[_0x6278('0x17')](function(_0x4a1759){if(_0x4a1759){_0x4a1759['update']({'lastMsgAt':_0x1d5788[_0x6278('0x18')],'lastMsgDirection':_0x1d5788[_0x6278('0x11')][_0x6278('0x19')]()});}})[_0x6278('0x1a')](function(_0x4ce2f8){console[_0x6278('0x1b')](_0x4ce2f8);});}if(_0x1d5788[_0x6278('0x11')]==='out'&&!_0x1d5788['secret']){var _0xe6f028;_0x102fbc['SmsAccount']['find']({'where':{'id':_0x1d5788[_0x6278('0x1c')]},'raw':!![]})[_0x6278('0x17')](function(_0x3f58f7){_0xe6f028=_0x3f58f7;if(_0xe6f028&&_0xe6f028[_0x6278('0x1d')]){switch(_0xe6f028['type']){case _0x6278('0x1e'):var _0x252133=require(_0x6278('0x1e'));if(_0xe6f028['accountSid']&&_0xe6f028[_0x6278('0x1f')]&&_0xe6f028[_0x6278('0x20')]){var _0x4eb894=new _0x252133(_0xe6f028[_0x6278('0x21')],_0xe6f028[_0x6278('0x1f')]);_0x4eb894['messages'][_0x6278('0x22')]({'body':_0x1d5788['body'],'to':_0x1d5788[_0x6278('0x20')],'from':_0xe6f028[_0x6278('0x20')],'statusCallback':_0xe6f028[_0x6278('0x23')]+_0x6278('0x24')+_0x1d5788['id']+'/status?token='+_0xe6f028[_0x6278('0x25')]})[_0x6278('0x17')](function(_0x42886b){if(_0x42886b[_0x6278('0x26')]){return _0x4b9323[_0x6278('0x27')]({'messageId':_0x42886b[_0x6278('0x26')]});}})[_0x6278('0x1a')](function(_0x2cb82d){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6278('0x1e'),util[_0x6278('0x28')](_0x2cb82d,{'showHidden':![],'depth':null}));});}else{logger[_0x6278('0x1b')](_0x6278('0x29'),'afterCreate',_0x6278('0x1e'),_0x6278('0x2a'));}break;case _0x6278('0x2b'):var _0x4cf204='https://api.skebby.it/API/v1.0/REST/';if(_0xe6f028[_0x6278('0x2c')]&&_0xe6f028[_0x6278('0x2d')]){var _0x2b3e2c={'recipient':[_0x1d5788[_0x6278('0x20')]],'message':_0x1d5788[_0x6278('0xd')],'message_type':_0xe6f028[_0x6278('0x2e')]};if(_0xe6f028['smsMethod']&&_0xe6f028[_0x6278('0x2e')]!=='SI'){_0x2b3e2c[_0x6278('0x2f')]=_0xe6f028[_0x6278('0x20')];}var _0x5b8289={'url':_0x4cf204+_0x6278('0x30')+_0xe6f028[_0x6278('0x2c')]+_0x6278('0x31')+_0xe6f028[_0x6278('0x2d')],'method':_0x6278('0x32')};rp(_0x5b8289)[_0x6278('0x17')](function(_0x290dc4){var _0x40c5c5=_0x290dc4[_0x6278('0x33')](';');var _0x1daf87={'user_key':_0x40c5c5[0x0],'session_key':_0x40c5c5[0x1]};_0x5b8289={'url':_0x4cf204+_0x6278('0x34'),'method':_0x6278('0x35'),'headers':{'user_key':_0x1daf87[_0x6278('0x36')],'Session_key':_0x1daf87[_0x6278('0x37')]},'json':!![],'body':_0x2b3e2c};return rp(_0x5b8289);})[_0x6278('0x17')](function(_0x5a0118){if(_0x5a0118[_0x6278('0x38')]>=0x1){var _0x38a66d={'messageId':_0x5a0118[_0x6278('0x39')]};if(_0xe6f028[_0x6278('0x2e')]!=='GP'||!_0xe6f028[_0x6278('0x3a')]){_0x38a66d[_0x6278('0x3b')]=!![];}return _0x4b9323['update'](_0x38a66d);}else{return logger[_0x6278('0x1b')](_0x6278('0x29'),_0x6278('0x3c'),'skebby',util[_0x6278('0x28')](_0x5a0118,{'showHidden':![],'depth':null}));}})['catch'](function(_0x254ae5){return logger['error'](_0x6278('0x29'),'afterCreate',_0x6278('0x2b'),util[_0x6278('0x28')](_0x254ae5,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6278('0x29'),_0x6278('0x3c'),_0x6278('0x2b'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0xe6f028[_0x6278('0x1f')]){var _0x316bd0={'recipient':_0x1d5788[_0x6278('0x20')],'message':_0x1d5788[_0x6278('0xd')],'sender':_0xe6f028[_0x6278('0x3d')]||_0xe6f028[_0x6278('0x20')],'authorization':_0xe6f028[_0x6278('0x1f')]};var _0x5c5ad7={'method':'POST','uri':_0x6278('0x3e'),'body':_0x316bd0,'json':!![]};rp(_0x5c5ad7)[_0x6278('0x17')](function(_0x1ef364){var _0x10b400={'messageId':_0x1ef364[_0x6278('0x3f')]};if(!_0xe6f028[_0x6278('0x3a')]){_0x10b400[_0x6278('0x3b')]=!![];}return _0x4b9323[_0x6278('0x27')](_0x10b400);})[_0x6278('0x1a')](function(_0x247a40){logger[_0x6278('0x1b')](_0x6278('0x29'),_0x6278('0x3c'),_0x6278('0x40'),util[_0x6278('0x28')](_0x247a40,{'showHidden':![],'depth':null}));});}else{logger[_0x6278('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6278('0x3c'),_0x6278('0x40'),_0x6278('0x41'));}break;case _0x6278('0x42'):if(_0xe6f028[_0x6278('0x2c')]&&_0xe6f028[_0x6278('0x2d')]){var _0x316bd0={'messages':[{'source':_0x6278('0x43'),'to':_0x1d5788[_0x6278('0x20')],'body':_0x1d5788[_0x6278('0xd')],'from':_0xe6f028['senderString']||_0xe6f028[_0x6278('0x20')]}]};var _0x1fad2a=util[_0x6278('0x44')](_0x6278('0x45'),_0xe6f028[_0x6278('0x2c')],_0xe6f028[_0x6278('0x2d')]);var _0x5c5ad7={'method':_0x6278('0x35'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x316bd0,'headers':{'Authorization':util['format'](_0x6278('0x46'),new Buffer(_0x1fad2a)['toString'](_0x6278('0x47')))},'json':!![]};rp(_0x5c5ad7)['then'](function(_0x43555e){if(_0x43555e[_0x6278('0x48')]>=0xc8&&_0x43555e['http_code']<=0xce){if(_0x43555e[_0x6278('0x49')]&&_0x43555e[_0x6278('0x49')][_0x6278('0x4a')]>0x0){var _0x2dae71=_[_0x6278('0x4b')](_0x43555e[_0x6278('0x49')]['messages']);var _0x50fbe9={'messageId':_0x2dae71[_0x6278('0x4c')]};if(!_0xe6f028[_0x6278('0x3a')]){_0x50fbe9[_0x6278('0x3b')]=!![];}return _0x4b9323[_0x6278('0x27')](_0x50fbe9);}else{logger[_0x6278('0x1b')](_0x6278('0x29'),_0x6278('0x3c'),_0x6278('0x4d'),util[_0x6278('0x28')](_0x43555e,{'showHidden':![],'depth':null}));}}else{logger[_0x6278('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6278('0x3c'),'clickSend',util[_0x6278('0x28')](_0x43555e,{'showHidden':![],'depth':null}));}})[_0x6278('0x1a')](function(_0x2bd2fe){logger[_0x6278('0x1b')](_0x6278('0x29'),_0x6278('0x3c'),_0x6278('0x4d'),util[_0x6278('0x28')](_0x2bd2fe,{'showHidden':![],'depth':null}));});}else{logger[_0x6278('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6278('0x3c'),'clickSend',_0x6278('0x4e'));}break;case _0x6278('0x4f'):if(_0xe6f028[_0x6278('0x50')]&&_0xe6f028[_0x6278('0x1f')]){var _0x316bd0={'dst':_0x1d5788['phone'],'text':_0x1d5788[_0x6278('0xd')],'src':_0xe6f028['senderString']||_0xe6f028[_0x6278('0x20')],'url':_0xe6f028[_0x6278('0x23')]+'/api/sms/messages/'+_0x1d5788['id']+_0x6278('0x51')+_0xe6f028[_0x6278('0x25')]};var _0x1fad2a=util[_0x6278('0x44')](_0x6278('0x45'),_0xe6f028[_0x6278('0x50')],_0xe6f028[_0x6278('0x1f')]);var _0x5c5ad7={'method':'POST','uri':util[_0x6278('0x44')](_0x6278('0x52'),_0xe6f028[_0x6278('0x50')]),'body':_0x316bd0,'headers':{'Authorization':util[_0x6278('0x44')](_0x6278('0x46'),new Buffer(_0x1fad2a)[_0x6278('0x53')](_0x6278('0x47')))},'json':!![]};rp(_0x5c5ad7)['then'](function(_0x57cbc0){var _0x5b3eb6={'messageId':_0x57cbc0[_0x6278('0x54')][0x0]};return _0x4b9323['update'](_0x5b3eb6);})[_0x6278('0x1a')](function(_0x1dcfe0){logger[_0x6278('0x1b')](_0x6278('0x29'),_0x6278('0x3c'),_0x6278('0x4f'),util[_0x6278('0x28')](_0x1dcfe0,{'showHidden':![],'depth':null}));});}else{logger[_0x6278('0x1b')](_0x6278('0x29'),_0x6278('0x3c'),'plivo',_0x6278('0x55'));}break;case'infobip':if(_0xe6f028[_0x6278('0x2c')]&&_0xe6f028[_0x6278('0x2d')]){if(_0xe6f028[_0x6278('0x56')]){var _0x289a3d={'method':'POST','uri':_0xe6f028[_0x6278('0x56')]+_0x6278('0x57'),'body':{'username':_0xe6f028[_0x6278('0x2c')],'password':_0xe6f028[_0x6278('0x2d')]},'json':!![]};return rp(_0x289a3d)[_0x6278('0x17')](function(_0x5ce2ce){var _0x495b9d={'method':_0x6278('0x35'),'uri':_0xe6f028[_0x6278('0x56')]+_0x6278('0x58'),'body':{'messages':[{'from':_0xe6f028[_0x6278('0x20')],'destinations':[{'to':_0x1d5788[_0x6278('0x20')]}],'text':_0x1d5788[_0x6278('0xd')],'notifyUrl':_0xe6f028[_0x6278('0x23')]+_0x6278('0x24')+_0x1d5788['id']+_0x6278('0x51')+_0xe6f028[_0x6278('0x25')],'notifyContentType':_0x6278('0x59'),'callbackData':_0xe6f028[_0x6278('0x20')]+';'+_0x1d5788[_0x6278('0xd')]}]},'headers':{'Authorization':_0x6278('0x5a')+_0x5ce2ce[_0x6278('0x25')]},'json':!![]};return rp(_0x495b9d)[_0x6278('0x17')](function(_0x295f7f){if(_0x295f7f[_0x6278('0x5b')]){var _0x5d26d2={'messageId':_0x295f7f[_0x6278('0x5b')][0x0][_0x6278('0xb')]};if(!_0xe6f028['deliveryReport']){_0x5d26d2['read']=!![];}return _0x4b9323[_0x6278('0x27')](_0x5d26d2);}else{return logger[_0x6278('0x1b')](_0x6278('0x29'),_0x6278('0x3c'),_0x6278('0x5c'),util[_0x6278('0x28')](_0x295f7f,{'showHidden':![],'depth':null}));}});})[_0x6278('0x1a')](function(_0x58a6f6){return logger[_0x6278('0x1b')](_0x6278('0x29'),_0x6278('0x3c'),_0x6278('0x5c'),util[_0x6278('0x28')](_0x58a6f6,{'showHidden':![],'depth':null}));});}else{logger[_0x6278('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6278('0x5c'),_0x6278('0x5d'));}}else{logger[_0x6278('0x1b')](_0x6278('0x29'),_0x6278('0x3c'),_0x6278('0x5c'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x6278('0x5e'):var _0x5610e8=require(_0x6278('0x5f'));if(_0xe6f028[_0x6278('0x60')]){var _0x5913a1={};_0x5913a1[_0x6278('0x61')]=_0xe6f028[_0x6278('0x2c')];_0x5913a1[_0x6278('0x20')]=_0x1d5788[_0x6278('0x20')];_0x5913a1[_0x6278('0x2f')]=_0xe6f028['phone'];_0x5913a1[_0x6278('0x62')]=_0x1d5788['body'];_0x5913a1['timestamp']=+new Date();var _0x10add3='';var _0x149fd7='';var _0x3f95eb=Object[_0x6278('0x63')](_0x5913a1);_0x3f95eb[_0x6278('0x64')]();for(var _0x1e4058=0x0;_0x1e4058<_0x3f95eb[_0x6278('0x65')];_0x1e4058++){if(_0x10add3!=''){_0x10add3+='&';}_0x10add3+=_0x3f95eb[_0x1e4058]+'='+encodeURIComponent(_0x5913a1[_0x3f95eb[_0x1e4058]]);_0x149fd7+=_0x5913a1[_0x3f95eb[_0x1e4058]];}_0x149fd7+=_0xe6f028[_0x6278('0x60')];_0x149fd7=_0x5610e8[_0x6278('0x66')](_0x6278('0x67'))['update'](_0x149fd7)[_0x6278('0x68')](_0x6278('0x69'));if(_0x10add3!==''){_0x10add3+='&';}_0x10add3+='signature='+_0x149fd7;var _0x5b8289={'method':_0x6278('0x32'),'uri':_0xe6f028[_0x6278('0x56')]+_0x6278('0x6a')+_0x10add3,'json':!![]};return rp(_0x5b8289)['then'](function(_0x35c99b){var _0x256c8b=Object[_0x6278('0x63')](_0x35c99b);if(_0x35c99b[_0x256c8b[0x0]]['error']&&parseInt(_0x35c99b[_0x256c8b[0x0]]['error'])===0x0){var _0x4a44a9={'messageId':_0x35c99b[_0x256c8b[0x0]]['id_sms']};if(!_0xe6f028[_0x6278('0x3a')]){_0x4a44a9[_0x6278('0x3b')]=!![];}return _0x4b9323[_0x6278('0x27')](_0x4a44a9);}else{return logger[_0x6278('0x1b')](_0x6278('0x29'),_0x6278('0x3c'),_0x6278('0x5e'),util['inspect'](_0x35c99b['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x18399a){return logger[_0x6278('0x1b')](_0x6278('0x29'),'afterCreate',_0x6278('0x5e'),util[_0x6278('0x28')](_0x18399a,{'showHidden':![],'depth':null}));});}else{logger[_0x6278('0x1b')](_0x6278('0x29'),_0x6278('0x3c'),_0x6278('0x5e'),_0x6278('0x6b'));}break;case'clickatell':if(_0xe6f028['apiKey']){var _0x2e953b={'method':_0x6278('0x35'),'uri':_0x6278('0x6c'),'headers':{'Authorization':_0xe6f028['apiKey']},'body':{'content':_0x1d5788[_0x6278('0xd')],'to':[_0x1d5788[_0x6278('0x20')]],'from':_0xe6f028['phone'],'binary':![],'clientMessageId':_0x6278('0x6d'),'charset':_0x6278('0x6e')},'json':!![]};rp(_0x2e953b)['then'](function(_0x2eb2d8){if(!_0x2eb2d8[_0x6278('0x1b')]){var _0x43ef1e={'messageId':_0x2eb2d8['messages'][0x0][_0x6278('0x6f')]};if(!_0xe6f028['deliveryReport']){_0x43ef1e['read']=!![];}return _0x4b9323['update'](_0x43ef1e);}else{return logger[_0x6278('0x1b')](_0x6278('0x29'),_0x6278('0x3c'),'clickatell',util[_0x6278('0x28')](_0x2eb2d8[_0x6278('0x1b')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x520105){return logger[_0x6278('0x1b')](_0x6278('0x29'),_0x6278('0x3c'),_0x6278('0x70'),util[_0x6278('0x28')](_0x520105,{'showHidden':![],'depth':null}));});}else{logger[_0x6278('0x1b')](_0x6278('0x29'),'afterCreate',_0x6278('0x70'),'Missing\x20parameters:\x20apiKey');}break;case'bandwidth':if(_0xe6f028[_0x6278('0x2c')]&&_0xe6f028[_0x6278('0x2d')]){var _0x1fad2a=util['format'](_0x6278('0x45'),_0xe6f028[_0x6278('0x2c')],_0xe6f028[_0x6278('0x2d')]);var _0x5c5ad7={'method':_0x6278('0x35'),'uri':_0x6278('0x71')+_0xe6f028['accountId']+_0x6278('0x72'),'body':{'to':[_0x1d5788[_0x6278('0x20')]],'text':_0x1d5788[_0x6278('0xd')],'from':_0xe6f028[_0x6278('0x20')],'applicationId':_0xe6f028[_0x6278('0x73')]},'headers':{'Authorization':util[_0x6278('0x44')](_0x6278('0x46'),new Buffer(_0x1fad2a)['toString'](_0x6278('0x47')))},'json':!![]};rp(_0x5c5ad7)['then'](function(_0x39d2ff){if(_0x39d2ff['id']){var _0x20a13f={'messageId':_0x39d2ff['id']};return _0x4b9323[_0x6278('0x27')](_0x20a13f);}else{logger[_0x6278('0x1b')](_0x6278('0x29'),_0x6278('0x3c'),'bandwidth',util[_0x6278('0x28')](_0x39d2ff,{'showHidden':![],'depth':null}));}})[_0x6278('0x1a')](function(_0x497f11){logger[_0x6278('0x1b')](_0x6278('0x29'),_0x6278('0x3c'),_0x6278('0x74'),util['inspect'](_0x497f11,{'showHidden':![],'depth':null}));});}else{logger[_0x6278('0x1b')](_0x6278('0x29'),_0x6278('0x3c'),_0x6278('0x74'),_0x6278('0x4e'));}break;case _0x6278('0x75'):if(_0xe6f028[_0x6278('0x60')]){var _0x5e0a68={};var _0x5b8289={'method':'POST','uri':_0x6278('0x76'),'headers':{'Authorization':_0x6278('0x77')+_0xe6f028[_0x6278('0x60')],'Content-Type':_0x6278('0x59')},'body':{'from':_0xe6f028[_0x6278('0x20')],'to':_0x1d5788[_0x6278('0x20')],'text':_0x1d5788[_0x6278('0xd')]},'json':!![]};return rp(_0x5b8289)['then'](function(_0x63cc65){if(_0x63cc65['code']==0xca){_0x5e0a68[_0x6278('0x78')]=_0x63cc65;var _0x3797f4={'method':_0x6278('0x35'),'uri':_0x6278('0x79'),'headers':{'Authorization':_0x6278('0x77')+_0xe6f028[_0x6278('0x60')],'Content-Type':_0x6278('0x59')},'body':{'refid':_0x5e0a68[_0x6278('0x78')]['refid']},'json':!![]};return rp(_0x3797f4)[_0x6278('0x17')](function(_0x5c46fa){_0x5e0a68[_0x6278('0x7a')]=_0x5c46fa;var _0x4fc46b={'messageId':_0x5e0a68[_0x6278('0x78')][_0x6278('0x7b')],'read':!![]};return _0x4b9323[_0x6278('0x27')](_0x4fc46b);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6278('0x3c'),'intelepeer',util['inspect'](_0x63cc65,{'showHidden':![],'depth':null}));}})['catch'](function(_0x158fd8){return logger[_0x6278('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6278('0x3c'),_0x6278('0x75'),util[_0x6278('0x28')](_0x158fd8,{'showHidden':![],'depth':null}));});}else{return logger[_0x6278('0x1b')](_0x6278('0x29'),_0x6278('0x3c'),_0x6278('0x75'),_0x6278('0x7c'));}break;}}})[_0x6278('0x7d')](function(){_0xd045cb();});}else{_0xd045cb();}}},'charset':_0x6278('0x7e'),'collate':_0x6278('0x7f')});}; \ No newline at end of file +var _0x21ab=['uuid','UTF-8','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Token\x20not\x20received','finally','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','define','SmsMessage','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','then','update','error','type','twilio','accountSid','authToken','phone','remote','/status?token=','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','smsMethod','login?username=','&password=','GET','session_key','internal_order_id','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','xCALLY\x20Motion','%s:%s','format','toString','base64','http_code','data','queued_count','head','messages','message_id','deliveryReport','clickSend','plivo','token','POST','authId','Basic\x20%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','/auth/1/session','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','text','keys','sort','createHash','md5','digest','hex','signature=','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','apiKey'];(function(_0x1cbce8,_0x26ae0b){var _0xb150c4=function(_0x3ab6ba){while(--_0x3ab6ba){_0x1cbce8['push'](_0x1cbce8['shift']());}};_0xb150c4(++_0x26ae0b);}(_0x21ab,0x1cc));var _0xb21a=function(_0x5bd4f6,_0xf4e45c){_0x5bd4f6=_0x5bd4f6-0x0;var _0x33a165=_0x21ab[_0x5bd4f6];return _0x33a165;};'use strict';var _=require('lodash');var util=require(_0xb21a('0x0'));var logger=require(_0xb21a('0x1'))(_0xb21a('0x2'));var moment=require(_0xb21a('0x3'));var BPromise=require(_0xb21a('0x4'));var rp=require(_0xb21a('0x5'));var fs=require('fs');var path=require(_0xb21a('0x6'));var rimraf=require(_0xb21a('0x7'));var config=require(_0xb21a('0x8'));var attributes=require(_0xb21a('0x9'));module['exports']=function(_0x559ee0,_0x31834b){return _0x559ee0[_0xb21a('0xa')](_0xb21a('0xb'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0xb21a('0xc')]},{'name':'fti_sms_messages','fields':[_0xb21a('0xd')],'type':_0xb21a('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f78c2,_0x321310,_0x219c9b){var _0x3b0ebe=_0x559ee0[_0xb21a('0xf')];var _0x5e0d75=_0x1f78c2[_0xb21a('0x10')]({'plain':!![]});if(_0x5e0d75[_0xb21a('0x11')][_0xb21a('0x12')]()==='in'||_0x5e0d75['direction'][_0xb21a('0x12')]()===_0xb21a('0x13')&&!_0x5e0d75[_0xb21a('0x14')]&&!_[_0xb21a('0x15')](_0x5e0d75[_0xb21a('0x16')])&&!_[_0xb21a('0x15')](_0x5e0d75['SmsInteractionId'])){_0x3b0ebe['SmsInteraction']['findOne']({'where':{'id':_0x5e0d75[_0xb21a('0x17')]}})[_0xb21a('0x18')](function(_0x45518e){if(_0x45518e){_0x45518e[_0xb21a('0x19')]({'lastMsgAt':_0x5e0d75['createdAt'],'lastMsgDirection':_0x5e0d75['direction'][_0xb21a('0x12')]()});}})['catch'](function(_0x25981d){console[_0xb21a('0x1a')](_0x25981d);});}if(_0x5e0d75[_0xb21a('0x11')]==='out'&&!_0x5e0d75[_0xb21a('0x14')]){var _0x210237;_0x3b0ebe['SmsAccount']['find']({'where':{'id':_0x5e0d75['SmsAccountId']},'raw':!![]})[_0xb21a('0x18')](function(_0x4e8060){_0x210237=_0x4e8060;if(_0x210237&&_0x210237[_0xb21a('0x1b')]){switch(_0x210237['type']){case _0xb21a('0x1c'):var _0x4ec7f6=require(_0xb21a('0x1c'));if(_0x210237[_0xb21a('0x1d')]&&_0x210237[_0xb21a('0x1e')]&&_0x210237[_0xb21a('0x1f')]){var _0x3cf2f9=new _0x4ec7f6(_0x210237['accountSid'],_0x210237[_0xb21a('0x1e')]);_0x3cf2f9['messages']['create']({'body':_0x5e0d75[_0xb21a('0xd')],'to':_0x5e0d75[_0xb21a('0x1f')],'from':_0x210237['phone'],'statusCallback':_0x210237[_0xb21a('0x20')]+'/api/sms/messages/'+_0x5e0d75['id']+_0xb21a('0x21')+_0x210237['token']})[_0xb21a('0x18')](function(_0x1133fc){if(_0x1133fc[_0xb21a('0x22')]){return _0x1f78c2[_0xb21a('0x19')]({'messageId':_0x1133fc[_0xb21a('0x22')]});}})[_0xb21a('0x23')](function(_0xa454bc){logger[_0xb21a('0x1a')](_0xb21a('0x24'),_0xb21a('0x25'),_0xb21a('0x1c'),util[_0xb21a('0x26')](_0xa454bc,{'showHidden':![],'depth':null}));});}else{logger[_0xb21a('0x1a')](_0xb21a('0x24'),'afterCreate',_0xb21a('0x1c'),_0xb21a('0x27'));}break;case _0xb21a('0x28'):var _0x501174='https://api.skebby.it/API/v1.0/REST/';if(_0x210237[_0xb21a('0x29')]&&_0x210237[_0xb21a('0x2a')]){var _0x2ee081={'recipient':[_0x5e0d75[_0xb21a('0x1f')]],'message':_0x5e0d75[_0xb21a('0xd')],'message_type':_0x210237['smsMethod']};if(_0x210237[_0xb21a('0x2b')]&&_0x210237[_0xb21a('0x2b')]!=='SI'){_0x2ee081['sender']=_0x210237[_0xb21a('0x1f')];}var _0xf3e2f1={'url':_0x501174+_0xb21a('0x2c')+_0x210237[_0xb21a('0x29')]+_0xb21a('0x2d')+_0x210237[_0xb21a('0x2a')],'method':_0xb21a('0x2e')};rp(_0xf3e2f1)['then'](function(_0x5d7980){var _0x50f2d7=_0x5d7980['split'](';');var _0x4141ee={'user_key':_0x50f2d7[0x0],'session_key':_0x50f2d7[0x1]};_0xf3e2f1={'url':_0x501174+'sms','method':'POST','headers':{'user_key':_0x4141ee['user_key'],'Session_key':_0x4141ee[_0xb21a('0x2f')]},'json':!![],'body':_0x2ee081};return rp(_0xf3e2f1);})[_0xb21a('0x18')](function(_0x50a247){if(_0x50a247['total_sent']>=0x1){var _0x3b3a8a={'messageId':_0x50a247[_0xb21a('0x30')]};if(_0x210237[_0xb21a('0x2b')]!=='GP'||!_0x210237['deliveryReport']){_0x3b3a8a[_0xb21a('0x31')]=!![];}return _0x1f78c2[_0xb21a('0x19')](_0x3b3a8a);}else{return logger[_0xb21a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb21a('0x25'),_0xb21a('0x28'),util[_0xb21a('0x26')](_0x50a247,{'showHidden':![],'depth':null}));}})[_0xb21a('0x23')](function(_0x20b388){return logger['error'](_0xb21a('0x24'),_0xb21a('0x25'),_0xb21a('0x28'),util[_0xb21a('0x26')](_0x20b388,{'showHidden':![],'depth':null}));});}else{logger[_0xb21a('0x1a')](_0xb21a('0x24'),_0xb21a('0x25'),_0xb21a('0x28'),_0xb21a('0x32'));}break;case _0xb21a('0x33'):if(_0x210237[_0xb21a('0x1e')]){var _0x4b5412={'recipient':_0x5e0d75[_0xb21a('0x1f')],'message':_0x5e0d75[_0xb21a('0xd')],'sender':_0x210237[_0xb21a('0x34')]||_0x210237[_0xb21a('0x1f')],'authorization':_0x210237['authToken']};var _0x321310={'method':'POST','uri':_0xb21a('0x35'),'body':_0x4b5412,'json':!![]};rp(_0x321310)[_0xb21a('0x18')](function(_0x50a546){var _0xaa48d7={'messageId':_0x50a546[_0xb21a('0x36')]};if(!_0x210237['deliveryReport']){_0xaa48d7[_0xb21a('0x31')]=!![];}return _0x1f78c2['update'](_0xaa48d7);})[_0xb21a('0x23')](function(_0x13fb19){logger[_0xb21a('0x1a')](_0xb21a('0x24'),_0xb21a('0x25'),_0xb21a('0x33'),util[_0xb21a('0x26')](_0x13fb19,{'showHidden':![],'depth':null}));});}else{logger[_0xb21a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb21a('0x25'),_0xb21a('0x33'),'Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x210237['username']&&_0x210237[_0xb21a('0x2a')]){var _0x4b5412={'messages':[{'source':_0xb21a('0x37'),'to':_0x5e0d75[_0xb21a('0x1f')],'body':_0x5e0d75['body'],'from':_0x210237[_0xb21a('0x34')]||_0x210237[_0xb21a('0x1f')]}]};var _0x40b801=util['format'](_0xb21a('0x38'),_0x210237[_0xb21a('0x29')],_0x210237[_0xb21a('0x2a')]);var _0x321310={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x4b5412,'headers':{'Authorization':util[_0xb21a('0x39')]('Basic\x20%s',new Buffer(_0x40b801)[_0xb21a('0x3a')](_0xb21a('0x3b')))},'json':!![]};rp(_0x321310)['then'](function(_0x4e18de){if(_0x4e18de[_0xb21a('0x3c')]>=0xc8&&_0x4e18de[_0xb21a('0x3c')]<=0xce){if(_0x4e18de[_0xb21a('0x3d')]&&_0x4e18de['data'][_0xb21a('0x3e')]>0x0){var _0x567bf6=_[_0xb21a('0x3f')](_0x4e18de[_0xb21a('0x3d')][_0xb21a('0x40')]);var _0x15bd54={'messageId':_0x567bf6[_0xb21a('0x41')]};if(!_0x210237[_0xb21a('0x42')]){_0x15bd54['read']=!![];}return _0x1f78c2[_0xb21a('0x19')](_0x15bd54);}else{logger[_0xb21a('0x1a')](_0xb21a('0x24'),_0xb21a('0x25'),_0xb21a('0x43'),util['inspect'](_0x4e18de,{'showHidden':![],'depth':null}));}}else{logger[_0xb21a('0x1a')](_0xb21a('0x24'),'afterCreate','clickSend',util[_0xb21a('0x26')](_0x4e18de,{'showHidden':![],'depth':null}));}})[_0xb21a('0x23')](function(_0x563d02){logger[_0xb21a('0x1a')](_0xb21a('0x24'),'afterCreate','clickSend',util[_0xb21a('0x26')](_0x563d02,{'showHidden':![],'depth':null}));});}else{logger[_0xb21a('0x1a')](_0xb21a('0x24'),_0xb21a('0x25'),_0xb21a('0x43'),_0xb21a('0x32'));}break;case _0xb21a('0x44'):if(_0x210237['authId']&&_0x210237[_0xb21a('0x1e')]){var _0x4b5412={'dst':_0x5e0d75[_0xb21a('0x1f')],'text':_0x5e0d75[_0xb21a('0xd')],'src':_0x210237[_0xb21a('0x34')]||_0x210237[_0xb21a('0x1f')],'url':_0x210237[_0xb21a('0x20')]+'/api/sms/messages/'+_0x5e0d75['id']+_0xb21a('0x21')+_0x210237[_0xb21a('0x45')]};var _0x40b801=util['format'](_0xb21a('0x38'),_0x210237['authId'],_0x210237[_0xb21a('0x1e')]);var _0x321310={'method':_0xb21a('0x46'),'uri':util[_0xb21a('0x39')]('https://api.plivo.com/v1/Account/%s/Message/',_0x210237[_0xb21a('0x47')]),'body':_0x4b5412,'headers':{'Authorization':util['format'](_0xb21a('0x48'),new Buffer(_0x40b801)['toString']('base64'))},'json':!![]};rp(_0x321310)['then'](function(_0x42115e){var _0x45c17c={'messageId':_0x42115e[_0xb21a('0x49')][0x0]};return _0x1f78c2[_0xb21a('0x19')](_0x45c17c);})[_0xb21a('0x23')](function(_0x31e1b3){logger[_0xb21a('0x1a')](_0xb21a('0x24'),_0xb21a('0x25'),'plivo',util[_0xb21a('0x26')](_0x31e1b3,{'showHidden':![],'depth':null}));});}else{logger[_0xb21a('0x1a')](_0xb21a('0x24'),_0xb21a('0x25'),_0xb21a('0x44'),_0xb21a('0x4a'));}break;case'infobip':if(_0x210237[_0xb21a('0x29')]&&_0x210237[_0xb21a('0x2a')]){if(_0x210237['baseUrl']){var _0x59c341={'method':_0xb21a('0x46'),'uri':_0x210237['baseUrl']+_0xb21a('0x4b'),'body':{'username':_0x210237['username'],'password':_0x210237[_0xb21a('0x2a')]},'json':!![]};return rp(_0x59c341)[_0xb21a('0x18')](function(_0xfa1f74){var _0x361140={'method':'POST','uri':_0x210237[_0xb21a('0x4c')]+_0xb21a('0x4d'),'body':{'messages':[{'from':_0x210237[_0xb21a('0x1f')],'destinations':[{'to':_0x5e0d75[_0xb21a('0x1f')]}],'text':_0x5e0d75[_0xb21a('0xd')],'notifyUrl':_0x210237[_0xb21a('0x20')]+'/api/sms/messages/'+_0x5e0d75['id']+_0xb21a('0x21')+_0x210237['token'],'notifyContentType':_0xb21a('0x4e'),'callbackData':_0x210237[_0xb21a('0x1f')]+';'+_0x5e0d75[_0xb21a('0xd')]}]},'headers':{'Authorization':_0xb21a('0x4f')+_0xfa1f74[_0xb21a('0x45')]},'json':!![]};return rp(_0x361140)[_0xb21a('0x18')](function(_0x24289a){if(_0x24289a[_0xb21a('0x40')]){var _0x590809={'messageId':_0x24289a['messages'][0x0][_0xb21a('0xc')]};if(!_0x210237[_0xb21a('0x42')]){_0x590809[_0xb21a('0x31')]=!![];}return _0x1f78c2[_0xb21a('0x19')](_0x590809);}else{return logger['error'](_0xb21a('0x24'),_0xb21a('0x25'),'infobip',util[_0xb21a('0x26')](_0x24289a,{'showHidden':![],'depth':null}));}});})[_0xb21a('0x23')](function(_0x192d12){return logger[_0xb21a('0x1a')](_0xb21a('0x24'),_0xb21a('0x25'),_0xb21a('0x50'),util[_0xb21a('0x26')](_0x192d12,{'showHidden':![],'depth':null}));});}else{logger[_0xb21a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip',_0xb21a('0x51'));}}else{logger[_0xb21a('0x1a')](_0xb21a('0x24'),_0xb21a('0x25'),'infobip',_0xb21a('0x32'));}break;case _0xb21a('0x52'):var _0x3809ed=require('crypto');if(_0x210237['apiKey']){var _0x575f65={};_0x575f65['login']=_0x210237[_0xb21a('0x29')];_0x575f65[_0xb21a('0x1f')]=_0x5e0d75['phone'];_0x575f65['sender']=_0x210237['phone'];_0x575f65[_0xb21a('0x53')]=_0x5e0d75[_0xb21a('0xd')];_0x575f65['timestamp']=+new Date();var _0x43b996='';var _0x46a3c4='';var _0xbbea81=Object[_0xb21a('0x54')](_0x575f65);_0xbbea81[_0xb21a('0x55')]();for(var _0x47d379=0x0;_0x47d379<_0xbbea81['length'];_0x47d379++){if(_0x43b996!=''){_0x43b996+='&';}_0x43b996+=_0xbbea81[_0x47d379]+'='+encodeURIComponent(_0x575f65[_0xbbea81[_0x47d379]]);_0x46a3c4+=_0x575f65[_0xbbea81[_0x47d379]];}_0x46a3c4+=_0x210237['apiKey'];_0x46a3c4=_0x3809ed[_0xb21a('0x56')](_0xb21a('0x57'))[_0xb21a('0x19')](_0x46a3c4)[_0xb21a('0x58')](_0xb21a('0x59'));if(_0x43b996!==''){_0x43b996+='&';}_0x43b996+=_0xb21a('0x5a')+_0x46a3c4;var _0xf3e2f1={'method':'GET','uri':_0x210237['baseUrl']+'/external/get/send.php?'+_0x43b996,'json':!![]};return rp(_0xf3e2f1)[_0xb21a('0x18')](function(_0x17ccec){var _0x9b2055=Object[_0xb21a('0x54')](_0x17ccec);if(_0x17ccec[_0x9b2055[0x0]][_0xb21a('0x1a')]&&parseInt(_0x17ccec[_0x9b2055[0x0]][_0xb21a('0x1a')])===0x0){var _0x4b6b84={'messageId':_0x17ccec[_0x9b2055[0x0]][_0xb21a('0x5b')]};if(!_0x210237[_0xb21a('0x42')]){_0x4b6b84[_0xb21a('0x31')]=!![];}return _0x1f78c2['update'](_0x4b6b84);}else{return logger[_0xb21a('0x1a')](_0xb21a('0x24'),'afterCreate',_0xb21a('0x52'),util[_0xb21a('0x26')](_0x17ccec['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0xa176cb){return logger[_0xb21a('0x1a')](_0xb21a('0x24'),_0xb21a('0x25'),_0xb21a('0x52'),util[_0xb21a('0x26')](_0xa176cb,{'showHidden':![],'depth':null}));});}else{logger[_0xb21a('0x1a')](_0xb21a('0x24'),_0xb21a('0x25'),_0xb21a('0x52'),_0xb21a('0x5c'));}break;case'clickatell':if(_0x210237['apiKey']){var _0xea12bf={'method':_0xb21a('0x46'),'uri':_0xb21a('0x5d'),'headers':{'Authorization':_0x210237[_0xb21a('0x5e')]},'body':{'content':_0x5e0d75[_0xb21a('0xd')],'to':[_0x5e0d75[_0xb21a('0x1f')]],'from':_0x210237['phone'],'binary':![],'clientMessageId':_0xb21a('0x5f'),'charset':_0xb21a('0x60')},'json':!![]};rp(_0xea12bf)[_0xb21a('0x18')](function(_0x561e4c){if(!_0x561e4c[_0xb21a('0x1a')]){var _0x4b7e17={'messageId':_0x561e4c[_0xb21a('0x40')][0x0][_0xb21a('0x61')]};if(!_0x210237[_0xb21a('0x42')]){_0x4b7e17[_0xb21a('0x31')]=!![];}return _0x1f78c2[_0xb21a('0x19')](_0x4b7e17);}else{return logger[_0xb21a('0x1a')](_0xb21a('0x24'),'afterCreate','clickatell',util['inspect'](_0x561e4c['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x32a885){return logger['error'](_0xb21a('0x24'),_0xb21a('0x25'),'clickatell',util[_0xb21a('0x26')](_0x32a885,{'showHidden':![],'depth':null}));});}else{logger[_0xb21a('0x1a')](_0xb21a('0x24'),'afterCreate',_0xb21a('0x62'),_0xb21a('0x5c'));}break;case _0xb21a('0x63'):if(_0x210237[_0xb21a('0x29')]&&_0x210237[_0xb21a('0x2a')]){var _0x40b801=util['format'](_0xb21a('0x38'),_0x210237['username'],_0x210237['password']);var _0x321310={'method':_0xb21a('0x46'),'uri':_0xb21a('0x64')+_0x210237['accountId']+_0xb21a('0x65'),'body':{'to':[_0x5e0d75[_0xb21a('0x1f')]],'text':_0x5e0d75[_0xb21a('0xd')],'from':_0x210237[_0xb21a('0x1f')],'applicationId':_0x210237[_0xb21a('0x66')]},'headers':{'Authorization':util[_0xb21a('0x39')](_0xb21a('0x48'),new Buffer(_0x40b801)['toString'](_0xb21a('0x3b')))},'json':!![]};rp(_0x321310)[_0xb21a('0x18')](function(_0x2638f0){if(_0x2638f0['id']){var _0x3c7586={'messageId':_0x2638f0['id']};return _0x1f78c2[_0xb21a('0x19')](_0x3c7586);}else{logger[_0xb21a('0x1a')](_0xb21a('0x24'),_0xb21a('0x25'),'bandwidth',util[_0xb21a('0x26')](_0x2638f0,{'showHidden':![],'depth':null}));}})[_0xb21a('0x23')](function(_0x55dba4){logger[_0xb21a('0x1a')](_0xb21a('0x24'),_0xb21a('0x25'),_0xb21a('0x63'),util[_0xb21a('0x26')](_0x55dba4,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb21a('0x24'),_0xb21a('0x25'),_0xb21a('0x63'),_0xb21a('0x32'));}break;case _0xb21a('0x67'):if(_0x210237['apiKey']){var _0x4e1a93={};var _0xf3e2f1={'method':_0xb21a('0x46'),'uri':_0xb21a('0x68'),'headers':{'Authorization':_0xb21a('0x69')+_0x210237[_0xb21a('0x5e')],'Content-Type':'application/json'},'body':{'from':_0x210237['phone'],'to':_0x5e0d75[_0xb21a('0x1f')],'text':_0x5e0d75['body']},'json':!![]};return rp(_0xf3e2f1)[_0xb21a('0x18')](function(_0x5e8c4a){if(_0x5e8c4a['code']==0xca){_0x4e1a93[_0xb21a('0x6a')]=_0x5e8c4a;var _0x1b8747={'method':_0xb21a('0x46'),'uri':_0xb21a('0x6b'),'headers':{'Authorization':_0xb21a('0x69')+_0x210237[_0xb21a('0x5e')],'Content-Type':_0xb21a('0x4e')},'body':{'refid':_0x4e1a93[_0xb21a('0x6a')]['refid']},'json':!![]};return rp(_0x1b8747)['then'](function(_0x7c3dfe){_0x4e1a93['status']=_0x7c3dfe;var _0xf58ead={'messageId':_0x4e1a93[_0xb21a('0x6a')]['refid'],'read':!![]};return _0x1f78c2[_0xb21a('0x19')](_0xf58ead);});}else{return logger[_0xb21a('0x1a')](_0xb21a('0x24'),_0xb21a('0x25'),'intelepeer',util[_0xb21a('0x26')](_0x5e8c4a,{'showHidden':![],'depth':null}));}})[_0xb21a('0x23')](function(_0x14b336){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xb21a('0x67'),util[_0xb21a('0x26')](_0x14b336,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb21a('0x25'),_0xb21a('0x67'),_0xb21a('0x6c'));}break;}}})[_0xb21a('0x6d')](function(){_0x219c9b();});}else{_0x219c9b();}}},'charset':'utf8mb4','collate':_0xb21a('0x6e')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index fd35025..9f1c346 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 _0x9148=['client','redis','localhost','socket.io-emitter','register','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','SmsMessage','create','body','options','raw','CreateSmsMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2a8b73,_0x617ca1){var _0x2d895d=function(_0x2a36f6){while(--_0x2a36f6){_0x2a8b73['push'](_0x2a8b73['shift']());}};_0x2d895d(++_0x617ca1);}(_0x9148,0x10d));var _0x8914=function(_0x3bb077,_0x39643a){_0x3bb077=_0x3bb077-0x0;var _0x44ab12=_0x9148[_0x3bb077];return _0x44ab12;};'use strict';var _=require(_0x8914('0x0'));var util=require(_0x8914('0x1'));var moment=require(_0x8914('0x2'));var BPromise=require(_0x8914('0x3'));var rs=require(_0x8914('0x4'));var fs=require('fs');var Redis=require(_0x8914('0x5'));var db=require(_0x8914('0x6'))['db'];var utils=require(_0x8914('0x7'));var logger=require(_0x8914('0x8'))(_0x8914('0x9'));var config=require(_0x8914('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x8914('0xb')]['http']({'port':0x232a});config[_0x8914('0xc')]=_['defaults'](config[_0x8914('0xc')],{'host':_0x8914('0xd'),'port':0x18eb});var socket=require(_0x8914('0xe'))(new Redis(config[_0x8914('0xc')]));require('./smsMessage.socket')[_0x8914('0xf')](socket);function respondWithRpcPromise(_0x38defa,_0x63bdb4,_0x6e296e){return new BPromise(function(_0x3e8af9,_0x569386){return client[_0x8914('0x10')](_0x38defa,_0x6e296e)[_0x8914('0x11')](function(_0x4c8007){logger['info'](_0x8914('0x12'),_0x63bdb4,_0x8914('0x13'));logger[_0x8914('0x14')](_0x8914('0x15'),_0x63bdb4,_0x8914('0x13'),JSON[_0x8914('0x16')](_0x4c8007));if(_0x4c8007['error']){if(_0x4c8007[_0x8914('0x17')][_0x8914('0x18')]===0x1f4){logger['error'](_0x8914('0x12'),_0x63bdb4,_0x4c8007[_0x8914('0x17')][_0x8914('0x19')]);return _0x569386(_0x4c8007[_0x8914('0x17')][_0x8914('0x19')]);}logger[_0x8914('0x17')](_0x8914('0x12'),_0x63bdb4,_0x4c8007[_0x8914('0x17')][_0x8914('0x19')]);return _0x3e8af9(_0x4c8007['error'][_0x8914('0x19')]);}else{logger[_0x8914('0x1a')](_0x8914('0x12'),_0x63bdb4,_0x8914('0x13'));_0x3e8af9(_0x4c8007[_0x8914('0x1b')][_0x8914('0x19')]);}})[_0x8914('0x1c')](function(_0x4a93b5){logger[_0x8914('0x17')](_0x8914('0x12'),_0x63bdb4,_0x4a93b5);_0x569386(_0x4a93b5);});});}exports['CreateSmsMessage']=function(_0x5de618){var _0x3e4dcc=this;return new Promise(function(_0x564292,_0x5b4f7a){return db[_0x8914('0x1d')][_0x8914('0x1e')](_0x5de618[_0x8914('0x1f')],{'raw':_0x5de618[_0x8914('0x20')]?_0x5de618[_0x8914('0x20')][_0x8914('0x21')]===undefined?!![]:![]:!![]})[_0x8914('0x11')](function(_0x28ba81){logger[_0x8914('0x1a')](_0x8914('0x22'),_0x5de618);logger[_0x8914('0x14')](_0x8914('0x22'),_0x5de618,JSON[_0x8914('0x16')](_0x28ba81));_0x564292(_0x28ba81);})[_0x8914('0x1c')](function(_0x1398f9){logger['error']('CreateSmsMessage',_0x1398f9[_0x8914('0x19')],_0x5de618);_0x5b4f7a(_0x3e4dcc['error'](0x1f4,_0x1398f9['message']));});});}; \ No newline at end of file +var _0xd667=['stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','socket.io-emitter','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd667,0x18b));var _0x7d66=function(_0x1f057d,_0x47e3ad){_0x1f057d=_0x1f057d-0x0;var _0x5a7b87=_0xd667[_0x1f057d];return _0x5a7b87;};'use strict';var _=require(_0x7d66('0x0'));var util=require(_0x7d66('0x1'));var moment=require('moment');var BPromise=require(_0x7d66('0x2'));var rs=require(_0x7d66('0x3'));var fs=require('fs');var Redis=require(_0x7d66('0x4'));var db=require(_0x7d66('0x5'))['db'];var utils=require(_0x7d66('0x6'));var logger=require(_0x7d66('0x7'))(_0x7d66('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7d66('0x9')][_0x7d66('0xa')]({'port':0x232a});config[_0x7d66('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7d66('0xc'))(new Redis(config[_0x7d66('0xb')]));require('./smsMessage.socket')[_0x7d66('0xd')](socket);function respondWithRpcPromise(_0x59eff1,_0x2e35f5,_0x4ef855){return new BPromise(function(_0x1f7464,_0xdb9f1c){return client[_0x7d66('0xe')](_0x59eff1,_0x4ef855)[_0x7d66('0xf')](function(_0x549e0f){logger[_0x7d66('0x10')](_0x7d66('0x11'),_0x2e35f5,_0x7d66('0x12'));logger[_0x7d66('0x13')](_0x7d66('0x14'),_0x2e35f5,_0x7d66('0x12'),JSON[_0x7d66('0x15')](_0x549e0f));if(_0x549e0f[_0x7d66('0x16')]){if(_0x549e0f[_0x7d66('0x16')][_0x7d66('0x17')]===0x1f4){logger[_0x7d66('0x16')](_0x7d66('0x11'),_0x2e35f5,_0x549e0f[_0x7d66('0x16')]['message']);return _0xdb9f1c(_0x549e0f[_0x7d66('0x16')][_0x7d66('0x18')]);}logger['error'](_0x7d66('0x11'),_0x2e35f5,_0x549e0f['error'][_0x7d66('0x18')]);return _0x1f7464(_0x549e0f[_0x7d66('0x16')][_0x7d66('0x18')]);}else{logger[_0x7d66('0x10')](_0x7d66('0x11'),_0x2e35f5,_0x7d66('0x12'));_0x1f7464(_0x549e0f[_0x7d66('0x19')][_0x7d66('0x18')]);}})[_0x7d66('0x1a')](function(_0x7fcff9){logger[_0x7d66('0x16')](_0x7d66('0x11'),_0x2e35f5,_0x7fcff9);_0xdb9f1c(_0x7fcff9);});});}exports[_0x7d66('0x1b')]=function(_0x3c2283){var _0x211ec7=this;return new Promise(function(_0x5e75fc,_0x224b35){return db[_0x7d66('0x1c')][_0x7d66('0x1d')](_0x3c2283[_0x7d66('0x1e')],{'raw':_0x3c2283[_0x7d66('0x1f')]?_0x3c2283[_0x7d66('0x1f')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2a119b){logger[_0x7d66('0x10')](_0x7d66('0x1b'),_0x3c2283);logger[_0x7d66('0x13')](_0x7d66('0x1b'),_0x3c2283,JSON[_0x7d66('0x15')](_0x2a119b));_0x5e75fc(_0x2a119b);})[_0x7d66('0x1a')](function(_0x261d5b){logger[_0x7d66('0x16')]('CreateSmsMessage',_0x261d5b['message'],_0x3c2283);_0x224b35(_0x211ec7[_0x7d66('0x16')](0x1f4,_0x261d5b[_0x7d66('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index a1e3368..51a11da 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 _0x726b=['remove','update','emit','removeListener','register','length','smsMessage:','save'];(function(_0x57a670,_0x30e402){var _0x41ce21=function(_0x11bd34){while(--_0x11bd34){_0x57a670['push'](_0x57a670['shift']());}};_0x41ce21(++_0x30e402);}(_0x726b,0x1af));var _0xb726=function(_0x4d27da,_0x2648d5){_0x4d27da=_0x4d27da-0x0;var _0x19f779=_0x726b[_0x4d27da];return _0x19f779;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xb726('0x0'),_0xb726('0x1'),_0xb726('0x2')];function createListener(_0xad4df4,_0x44da0d){return function(_0x2c724a){_0x44da0d[_0xb726('0x3')](_0xad4df4,_0x2c724a);};}function removeListener(_0x2686ff,_0x521dac){return function(){SmsMessageEvents[_0xb726('0x4')](_0x2686ff,_0x521dac);};}exports[_0xb726('0x5')]=function(_0x2c0364){for(var _0x234a90=0x0,_0x2e4577=events[_0xb726('0x6')];_0x234a90<_0x2e4577;_0x234a90++){var _0x3ec26e=events[_0x234a90];var _0x3b9f1b=createListener(_0xb726('0x7')+_0x3ec26e,_0x2c0364);SmsMessageEvents['on'](_0x3ec26e,_0x3b9f1b);}}; \ No newline at end of file +var _0x21c9=['removeListener','smsMessage:','./smsMessage.events','save','remove','update','emit'];(function(_0x3899be,_0x160c27){var _0x4a77e5=function(_0x1cc12f){while(--_0x1cc12f){_0x3899be['push'](_0x3899be['shift']());}};_0x4a77e5(++_0x160c27);}(_0x21c9,0x10c));var _0x921c=function(_0x2555e5,_0xd91f0a){_0x2555e5=_0x2555e5-0x0;var _0x1a97ec=_0x21c9[_0x2555e5];return _0x1a97ec;};'use strict';var SmsMessageEvents=require(_0x921c('0x0'));var events=[_0x921c('0x1'),_0x921c('0x2'),_0x921c('0x3')];function createListener(_0x30b84f,_0x5d8f33){return function(_0x4d0512){_0x5d8f33[_0x921c('0x4')](_0x30b84f,_0x4d0512);};}function removeListener(_0x3eef39,_0x45f3b1){return function(){SmsMessageEvents[_0x921c('0x5')](_0x3eef39,_0x45f3b1);};}exports['register']=function(_0x214d8e){for(var _0x2d72a7=0x0,_0x4b02a1=events['length'];_0x2d72a7<_0x4b02a1;_0x2d72a7++){var _0x49238e=events[_0x2d72a7];var _0x310a72=createListener(_0x921c('0x6')+_0x49238e,_0x214d8e);SmsMessageEvents['on'](_0x49238e,_0x310a72);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 0f47b44..5a88903 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 _0x9413=['removeAgents','multer','util','path','express','Router','fs-extra','./smsQueue.controller','get','isAuthenticated','/describe','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id','update','delete','destroy','removeTeams','/:id/users'];(function(_0x4a29f1,_0x23e312){var _0xe71461=function(_0x552bff){while(--_0x552bff){_0x4a29f1['push'](_0x4a29f1['shift']());}};_0xe71461(++_0x23e312);}(_0x9413,0x83));var _0x3941=function(_0x1b4002,_0x5b4094){_0x1b4002=_0x1b4002-0x0;var _0x1716f3=_0x9413[_0x1b4002];return _0x1716f3;};'use strict';var multer=require(_0x3941('0x0'));var util=require(_0x3941('0x1'));var path=require(_0x3941('0x2'));var timeout=require('connect-timeout');var express=require(_0x3941('0x3'));var router=express[_0x3941('0x4')]();var fs_extra=require(_0x3941('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3941('0x6'));router[_0x3941('0x7')]('/',auth[_0x3941('0x8')](),controller['index']);router['get'](_0x3941('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x3941('0x7')]('/:id',auth[_0x3941('0x8')](),controller[_0x3941('0xa')]);router[_0x3941('0x7')](_0x3941('0xb'),auth[_0x3941('0x8')](),controller[_0x3941('0xc')]);router[_0x3941('0x7')](_0x3941('0xd'),auth[_0x3941('0x8')](),controller[_0x3941('0xe')]);router['get']('/:id/users',auth[_0x3941('0x8')](),controller[_0x3941('0xf')]);router[_0x3941('0x10')]('/',auth[_0x3941('0x8')](),controller[_0x3941('0x11')]);router[_0x3941('0x10')](_0x3941('0xd'),auth[_0x3941('0x8')](),controller[_0x3941('0x12')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x3941('0x13'),auth[_0x3941('0x8')](),controller[_0x3941('0x14')]);router[_0x3941('0x15')]('/:id',auth[_0x3941('0x8')](),controller[_0x3941('0x16')]);router[_0x3941('0x15')]('/:id/teams',auth[_0x3941('0x8')](),controller[_0x3941('0x17')]);router[_0x3941('0x15')](_0x3941('0x18'),auth[_0x3941('0x8')](),controller[_0x3941('0x19')]);module['exports']=router; \ No newline at end of file +var _0x098a=['post','addTeams','addAgents','put','/:id','update','delete','removeAgents','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x452bcf,_0x62ad6b){var _0x4fcff5=function(_0x5215bb){while(--_0x5215bb){_0x452bcf['push'](_0x452bcf['shift']());}};_0x4fcff5(++_0x62ad6b);}(_0x098a,0x10d));var _0xa098=function(_0x36b257,_0x10d661){_0x36b257=_0x36b257-0x0;var _0xbaf692=_0x098a[_0x36b257];return _0xbaf692;};'use strict';var multer=require(_0xa098('0x0'));var util=require(_0xa098('0x1'));var path=require('path');var timeout=require(_0xa098('0x2'));var express=require(_0xa098('0x3'));var router=express['Router']();var fs_extra=require(_0xa098('0x4'));var auth=require(_0xa098('0x5'));var interaction=require(_0xa098('0x6'));var config=require('../../config/environment');var controller=require('./smsQueue.controller');router[_0xa098('0x7')]('/',auth[_0xa098('0x8')](),controller['index']);router[_0xa098('0x7')](_0xa098('0x9'),auth[_0xa098('0x8')](),controller[_0xa098('0xa')]);router[_0xa098('0x7')]('/:id',auth[_0xa098('0x8')](),controller[_0xa098('0xb')]);router['get'](_0xa098('0xc'),auth[_0xa098('0x8')](),controller[_0xa098('0xd')]);router[_0xa098('0x7')](_0xa098('0xe'),auth[_0xa098('0x8')](),controller[_0xa098('0xf')]);router[_0xa098('0x7')](_0xa098('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0xa098('0x11')]('/',auth[_0xa098('0x8')](),controller['create']);router[_0xa098('0x11')](_0xa098('0xe'),auth[_0xa098('0x8')](),controller[_0xa098('0x12')]);router[_0xa098('0x11')]('/:id/users',auth['isAuthenticated'](),controller[_0xa098('0x13')]);router[_0xa098('0x14')](_0xa098('0x15'),auth[_0xa098('0x8')](),controller[_0xa098('0x16')]);router['delete'](_0xa098('0x15'),auth[_0xa098('0x8')](),controller['destroy']);router[_0xa098('0x17')]('/:id/teams',auth[_0xa098('0x8')](),controller['removeTeams']);router[_0xa098('0x17')](_0xa098('0x10'),auth[_0xa098('0x8')](),controller[_0xa098('0x18')]);module[_0xa098('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index d837b32..c80618d 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 _0xe52e=['sequelize','exports','name','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x143290,_0x4637b1){var _0x794a32=function(_0x52e2e3){while(--_0x52e2e3){_0x143290['push'](_0x143290['shift']());}};_0x794a32(++_0x4637b1);}(_0xe52e,0xb4));var _0xee52=function(_0x2c3a88,_0x48637e){_0x2c3a88=_0x2c3a88-0x0;var _0x4a7925=_0xe52e[_0x2c3a88];return _0x4a7925;};'use strict';var Sequelize=require(_0xee52('0x0'));module[_0xee52('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xee52('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xee52('0x3')]},'timeout':{'type':Sequelize[_0xee52('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xee52('0x5')](_0xee52('0x6'),_0xee52('0x7'),_0xee52('0x8'))}}; \ No newline at end of file +var _0x9e6e=['beepall','roundrobin','STRING','INTEGER','ENUM','rrmemory'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x9e6e,0xc2));var _0xe9e6=function(_0x261062,_0x4145b9){_0x261062=_0x261062-0x0;var _0x38ef4f=_0x9e6e[_0x261062];return _0x38ef4f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe9e6('0x0')]},'timeout':{'type':Sequelize[_0xe9e6('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe9e6('0x2')](_0xe9e6('0x3'),_0xe9e6('0x4'),_0xe9e6('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index efa2535..d021da1 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 _0x9627=['fs-extra','lodash','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','defaults','redis','localhost','./smsQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','SmsQueues','UserProfileResource','stack','name','send','index','map','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','options','SmsQueue','includeAll','findAll','catch','show','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','pick','SmsQueueId','filter','User','findAndCountAll','agent','smsPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','Agents','online','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','userSmsQueue:remove','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs'];(function(_0x52709a,_0x574fe8){var _0x2e62d5=function(_0x5c0459){while(--_0x5c0459){_0x52709a['push'](_0x52709a['shift']());}};_0x2e62d5(++_0x574fe8);}(_0x9627,0x8a));var _0x7962=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x9627[_0x4fbfd9];return _0x31dc94;};'use strict';var emlformat=require(_0x7962('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7962('0x1'));var jsonpatch=require(_0x7962('0x2'));var rp=require(_0x7962('0x3'));var moment=require(_0x7962('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7962('0x5'));var util=require('util');var path=require('path');var sox=require(_0x7962('0x6'));var csv=require(_0x7962('0x7'));var ejs=require(_0x7962('0x8'));var fs=require('fs');var fs_extra=require(_0x7962('0x9'));var _=require(_0x7962('0xa'));var squel=require('squel');var crypto=require(_0x7962('0xb'));var jsforce=require(_0x7962('0xc'));var deskjs=require(_0x7962('0xd'));var toCsv=require(_0x7962('0x7'));var querystring=require(_0x7962('0xe'));var Papa=require(_0x7962('0xf'));var Redis=require(_0x7962('0x10'));var authService=require(_0x7962('0x11'));var qs=require(_0x7962('0x12'));var as=require(_0x7962('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7962('0x14'))(_0x7962('0x15'));var utils=require(_0x7962('0x16'));var config=require(_0x7962('0x17'));var licenseUtil=require(_0x7962('0x18'));var db=require(_0x7962('0x19'))['db'];config['redis']=_[_0x7962('0x1a')](config[_0x7962('0x1b')],{'host':_0x7962('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7962('0x1b')]));require(_0x7962('0x1d'))[_0x7962('0x1e')](socket);function respondWithStatusCode(_0x2c877c,_0xe212c){_0xe212c=_0xe212c||0xcc;return function(_0x2315a6){if(_0x2315a6){return _0x2c877c[_0x7962('0x1f')](_0xe212c);}return _0x2c877c[_0x7962('0x20')](_0xe212c)[_0x7962('0x21')]();};}function respondWithResult(_0x2d4b4e,_0x43339c){_0x43339c=_0x43339c||0xc8;return function(_0x3bc3c4){if(_0x3bc3c4){return _0x2d4b4e[_0x7962('0x20')](_0x43339c)[_0x7962('0x22')](_0x3bc3c4);}};}function respondWithFilteredResult(_0x44466f,_0x115f8c){return function(_0x1a1e5d){if(_0x1a1e5d){var _0x9f2745=typeof _0x115f8c[_0x7962('0x23')]===_0x7962('0x24')&&typeof _0x115f8c[_0x7962('0x25')]===_0x7962('0x24');var _0x1e206a=_0x1a1e5d[_0x7962('0x26')];var _0x87fef4=_0x9f2745?0x0:_0x115f8c['offset'];var _0x30bffb=_0x9f2745?_0x1a1e5d[_0x7962('0x26')]:_0x115f8c[_0x7962('0x23')]+_0x115f8c[_0x7962('0x25')];var _0x3767ed;if(_0x30bffb>=_0x1e206a){_0x30bffb=_0x1e206a;_0x3767ed=0xc8;}else{_0x3767ed=0xce;}_0x44466f[_0x7962('0x20')](_0x3767ed);return _0x44466f[_0x7962('0x27')](_0x7962('0x28'),_0x87fef4+'-'+_0x30bffb+'/'+_0x1e206a)[_0x7962('0x22')](_0x1a1e5d);}return null;};}function patchUpdates(_0x2e7d7){return function(_0x51b051){try{jsonpatch[_0x7962('0x29')](_0x51b051,_0x2e7d7,!![]);}catch(_0x431c14){return BPromise[_0x7962('0x2a')](_0x431c14);}return _0x51b051[_0x7962('0x2b')]();};}function saveUpdates(_0x16e0c6,_0x17275e){return function(_0x5aceea){if(_0x5aceea){return _0x5aceea[_0x7962('0x2c')](_0x16e0c6)[_0x7962('0x2d')](function(_0x3ad1f7){return _0x3ad1f7;});}return null;};}function removeEntity(_0x2fd7ad,_0x908e11){return function(_0x37709b){if(_0x37709b){return _0x37709b[_0x7962('0x2e')]()[_0x7962('0x2d')](function(){var _0x553f5f=_0x37709b['get']({'plain':!![]});var _0x2ca49b=_0x7962('0x2f');return db[_0x7962('0x30')]['destroy']({'where':{'type':_0x2ca49b,'resourceId':_0x553f5f['id']}})[_0x7962('0x2d')](function(){return _0x37709b;});})['then'](function(){_0x2fd7ad[_0x7962('0x20')](0xcc)[_0x7962('0x21')]();});}};}function handleEntityNotFound(_0x371f18,_0xa3d21d){return function(_0x1b9de2){if(!_0x1b9de2){_0x371f18[_0x7962('0x1f')](0x194);}return _0x1b9de2;};}function handleError(_0x466e58,_0x533a87){_0x533a87=_0x533a87||0x1f4;return function(_0x20606d){logger['error'](_0x20606d[_0x7962('0x31')]);if(_0x20606d['name']){delete _0x20606d[_0x7962('0x32')];}_0x466e58[_0x7962('0x20')](_0x533a87)[_0x7962('0x33')](_0x20606d);};}exports[_0x7962('0x34')]=function(_0x29c61a,_0x4210d1){var _0x5ba587={},_0xc1b465={},_0xd1b075={'count':0x0,'rows':[]};var _0x3522db=_[_0x7962('0x35')](db['SmsQueue']['rawAttributes'],function(_0x5200d8){return{'name':_0x5200d8[_0x7962('0x36')],'type':_0x5200d8[_0x7962('0x37')]['key']};});_0xc1b465[_0x7962('0x38')]=_[_0x7962('0x35')](_0x3522db,_0x7962('0x32'));_0xc1b465[_0x7962('0x39')]=_[_0x7962('0x3a')](_0x29c61a['query']);_0xc1b465['filters']=_[_0x7962('0x3b')](_0xc1b465[_0x7962('0x38')],_0xc1b465['query']);_0x5ba587[_0x7962('0x3c')]=_[_0x7962('0x3b')](_0xc1b465[_0x7962('0x38')],qs[_0x7962('0x3d')](_0x29c61a[_0x7962('0x39')]['fields']));_0x5ba587[_0x7962('0x3c')]=_0x5ba587[_0x7962('0x3c')][_0x7962('0x3e')]?_0x5ba587[_0x7962('0x3c')]:_0xc1b465[_0x7962('0x38')];if(!_0x29c61a[_0x7962('0x39')][_0x7962('0x3f')](_0x7962('0x40'))){_0x5ba587[_0x7962('0x25')]=qs[_0x7962('0x25')](_0x29c61a[_0x7962('0x39')][_0x7962('0x25')]);_0x5ba587[_0x7962('0x23')]=qs[_0x7962('0x23')](_0x29c61a[_0x7962('0x39')][_0x7962('0x23')]);}_0x5ba587[_0x7962('0x41')]=qs[_0x7962('0x42')](_0x29c61a[_0x7962('0x39')]['sort']);_0x5ba587[_0x7962('0x43')]=qs['filters'](_['pick'](_0x29c61a[_0x7962('0x39')],_0xc1b465[_0x7962('0x44')]),_0x3522db);if(_0x29c61a['query']['filter']){_0x5ba587['where']=_[_0x7962('0x45')](_0x5ba587['where'],{'$or':_['map'](_0x3522db,function(_0x35c951){if(_0x35c951[_0x7962('0x37')]!==_0x7962('0x46')){var _0x31badf={};_0x31badf[_0x35c951['name']]={'$like':'%'+_0x29c61a[_0x7962('0x39')]['filter']+'%'};return _0x31badf;}})});}_0x5ba587=_[_0x7962('0x45')]({},_0x5ba587,_0x29c61a[_0x7962('0x47')]);var _0x502c58={'where':_0x5ba587['where']};return db[_0x7962('0x48')][_0x7962('0x26')](_0x502c58)['then'](function(_0x21cbe8){_0xd1b075[_0x7962('0x26')]=_0x21cbe8;if(_0x29c61a[_0x7962('0x39')][_0x7962('0x49')]){_0x5ba587['include']=[{'all':!![]}];}return db[_0x7962('0x48')][_0x7962('0x4a')](_0x5ba587);})[_0x7962('0x2d')](function(_0x4dbced){_0xd1b075['rows']=_0x4dbced;return _0xd1b075;})[_0x7962('0x2d')](respondWithFilteredResult(_0x4210d1,_0x5ba587))[_0x7962('0x4b')](handleError(_0x4210d1,null));};exports[_0x7962('0x4c')]=function(_0x3be7f4,_0x38bc10){var _0x830b9b={'raw':!![],'where':{'id':_0x3be7f4[_0x7962('0x4d')]['id']}},_0xc20cef={};_0xc20cef[_0x7962('0x38')]=_['keys'](db[_0x7962('0x48')][_0x7962('0x4e')]);_0xc20cef[_0x7962('0x39')]=_[_0x7962('0x3a')](_0x3be7f4[_0x7962('0x39')]);_0xc20cef[_0x7962('0x44')]=_[_0x7962('0x3b')](_0xc20cef['model'],_0xc20cef['query']);_0x830b9b['attributes']=_[_0x7962('0x3b')](_0xc20cef[_0x7962('0x38')],qs[_0x7962('0x3d')](_0x3be7f4[_0x7962('0x39')]['fields']));_0x830b9b[_0x7962('0x3c')]=_0x830b9b['attributes']['length']?_0x830b9b[_0x7962('0x3c')]:_0xc20cef['model'];if(_0x3be7f4[_0x7962('0x39')][_0x7962('0x49')]){_0x830b9b[_0x7962('0x4f')]=[{'all':!![]}];}_0x830b9b=_[_0x7962('0x45')]({},_0x830b9b,_0x3be7f4[_0x7962('0x47')]);return db[_0x7962('0x48')][_0x7962('0x50')](_0x830b9b)[_0x7962('0x2d')](handleEntityNotFound(_0x38bc10,null))['then'](respondWithResult(_0x38bc10,null))[_0x7962('0x4b')](handleError(_0x38bc10,null));};exports[_0x7962('0x51')]=function(_0x1feeb5,_0x21362c){return db[_0x7962('0x48')][_0x7962('0x51')](_0x1feeb5[_0x7962('0x52')],{})[_0x7962('0x2d')](function(_0x1d8e29){var _0x1d340f=_0x1feeb5[_0x7962('0x53')]['get']({'plain':!![]});if(!_0x1d340f)throw new Error(_0x7962('0x54'));if(_0x1d340f[_0x7962('0x55')]==='user'){var _0xe0ac41=_0x1d8e29[_0x7962('0x56')]({'plain':!![]});var _0x5ea7a9=_0x7962('0x2f');return db[_0x7962('0x57')][_0x7962('0x50')]({'where':{'name':_0x5ea7a9,'userProfileId':_0x1d340f['userProfileId']},'raw':!![]})[_0x7962('0x2d')](function(_0x53a0f9){if(_0x53a0f9&&_0x53a0f9['autoAssociation']===0x0){return db[_0x7962('0x30')][_0x7962('0x51')]({'name':_0xe0ac41[_0x7962('0x32')],'resourceId':_0xe0ac41['id'],'type':_0x53a0f9[_0x7962('0x32')],'sectionId':_0x53a0f9['id']},{})[_0x7962('0x2d')](function(){return _0x1d8e29;});}else{return _0x1d8e29;}})[_0x7962('0x4b')](function(_0x4cdab5){logger['error'](_0x7962('0x58'),_0x4cdab5);throw _0x4cdab5;});}return _0x1d8e29;})['then'](respondWithResult(_0x21362c,0xc9))['catch'](handleError(_0x21362c,null));};exports[_0x7962('0x2c')]=function(_0x3a6a3c,_0x5e4e28){if(_0x3a6a3c[_0x7962('0x52')]['id']){delete _0x3a6a3c[_0x7962('0x52')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x3a6a3c['params']['id']}})[_0x7962('0x2d')](handleEntityNotFound(_0x5e4e28,null))[_0x7962('0x2d')](saveUpdates(_0x3a6a3c['body'],null))[_0x7962('0x2d')](respondWithResult(_0x5e4e28,null))[_0x7962('0x4b')](handleError(_0x5e4e28,null));};exports['destroy']=function(_0x214101,_0x1f7857){return db[_0x7962('0x48')][_0x7962('0x50')]({'where':{'id':_0x214101[_0x7962('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1f7857,null))[_0x7962('0x2d')](removeEntity(_0x1f7857,null))[_0x7962('0x4b')](handleError(_0x1f7857,null));};exports[_0x7962('0x59')]=function(_0x17ba21,_0x73cfbe){return db[_0x7962('0x48')][_0x7962('0x59')]()['then'](respondWithResult(_0x73cfbe,null))[_0x7962('0x4b')](handleError(_0x73cfbe,null));};exports[_0x7962('0x5a')]=function(_0xf106d7,_0x2e2117,_0x2b8fc5){var _0x129c66={'raw':!![],'where':{}},_0x1bfd2a={},_0x788fbb;return db['SmsQueue'][_0x7962('0x5b')]({'where':{'id':_0xf106d7['params']['id']}})[_0x7962('0x2d')](handleEntityNotFound(_0x2e2117,null))[_0x7962('0x2d')](function(_0x56e5c5){if(_0x56e5c5){_0x788fbb=_0x56e5c5['get']({'plain':!![]});_0x1bfd2a[_0x7962('0x38')]=_[_0x7962('0x3a')](db[_0x7962('0x5c')][_0x7962('0x4e')]);_0x1bfd2a['query']=_[_0x7962('0x3a')](_0xf106d7[_0x7962('0x39')]);_0x1bfd2a[_0x7962('0x44')]=_[_0x7962('0x3b')](_0x1bfd2a['model'],_0x1bfd2a[_0x7962('0x39')]);_0x129c66[_0x7962('0x3c')]=_['intersection'](_0x1bfd2a['model'],qs['fields'](_0xf106d7[_0x7962('0x39')][_0x7962('0x3d')]));_0x129c66[_0x7962('0x3c')]=_0x129c66['attributes'][_0x7962('0x3e')]?_0x129c66[_0x7962('0x3c')]:_0x1bfd2a[_0x7962('0x38')];if(!_0xf106d7[_0x7962('0x39')][_0x7962('0x3f')](_0x7962('0x40'))){_0x129c66[_0x7962('0x25')]=qs[_0x7962('0x25')](_0xf106d7[_0x7962('0x39')][_0x7962('0x25')]);_0x129c66['offset']=qs[_0x7962('0x23')](_0xf106d7['query'][_0x7962('0x23')]);}_0x129c66[_0x7962('0x41')]=qs[_0x7962('0x42')](_0xf106d7[_0x7962('0x39')]['sort']);_0x129c66[_0x7962('0x43')]=qs[_0x7962('0x44')](_[_0x7962('0x5d')](_0xf106d7['query'],_0x1bfd2a[_0x7962('0x44')]));_0x129c66[_0x7962('0x43')][_0x7962('0x5e')]=_0x56e5c5['id'];if(_0xf106d7[_0x7962('0x39')][_0x7962('0x5f')]){_0x129c66[_0x7962('0x43')]=_[_0x7962('0x45')](_0x129c66['where'],{'$or':_['map'](_0x129c66[_0x7962('0x3c')],function(_0x444ce0){var _0x1d98f6={};_0x1d98f6[_0x444ce0]={'$like':'%'+_0xf106d7[_0x7962('0x39')][_0x7962('0x5f')]+'%'};return _0x1d98f6;})});}_0x129c66=_[_0x7962('0x45')]({},_0x129c66,_0xf106d7[_0x7962('0x47')]);return db[_0x7962('0x5c')][_0x7962('0x4a')](_0x129c66);}})[_0x7962('0x2d')](function(_0x3a78a5){if(_0x3a78a5){return db[_0x7962('0x60')][_0x7962('0x61')]({'where':{'id':_[_0x7962('0x35')](_0x3a78a5,'UserId'),'role':_0x7962('0x62')},'attributes':['id',_0x7962('0x32'),_0x7962('0x63'),_0x7962('0x64'),_0x7962('0x65')]});}})['then'](function(_0x4471b4){if(_0x4471b4){return{'count':_0x4471b4[_0x7962('0x26')],'rows':_['map'](_0x4471b4[_0x7962('0x66')],function(_0x76aab1){return{'membername':_0x76aab1[_0x7962('0x32')],'UserId':_0x76aab1['id'],'queue_name':_0x788fbb[_0x7962('0x32')],'SmsQueueId':_0x788fbb['id'],'interface':util[_0x7962('0x67')](_0x7962('0x68'),_0x7962('0x69'),_0x76aab1[_0x7962('0x32')]),'penalty':0x0,'paused':_0x76aab1[_0x7962('0x63')],'createdAt':_0x76aab1[_0x7962('0x65')],'updatedAt':_0x76aab1[_0x7962('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7962('0x2d')](respondWithFilteredResult(_0x2e2117,_0x129c66))[_0x7962('0x4b')](handleError(_0x2e2117,null));};exports[_0x7962('0x6a')]=function(_0x2d1a7d,_0x4876a8,_0x556e39){var _0x49c913={};var _0x2ab95f={};var _0x7456ae;var _0x38352b;return db[_0x7962('0x48')][_0x7962('0x5b')]({'where':{'id':_0x2d1a7d[_0x7962('0x4d')]['id']}})[_0x7962('0x2d')](handleEntityNotFound(_0x4876a8,null))[_0x7962('0x2d')](function(_0x2f19a5){if(_0x2f19a5){_0x7456ae=_0x2f19a5;_0x2ab95f[_0x7962('0x38')]=_['keys'](db[_0x7962('0x6b')][_0x7962('0x4e')]);_0x2ab95f[_0x7962('0x39')]=_[_0x7962('0x3a')](_0x2d1a7d[_0x7962('0x39')]);_0x2ab95f[_0x7962('0x44')]=_[_0x7962('0x3b')](_0x2ab95f['model'],_0x2ab95f[_0x7962('0x39')]);_0x49c913[_0x7962('0x3c')]=_[_0x7962('0x3b')](_0x2ab95f['model'],qs['fields'](_0x2d1a7d['query'][_0x7962('0x3d')]));_0x49c913[_0x7962('0x3c')]=_0x49c913[_0x7962('0x3c')][_0x7962('0x3e')]?_0x49c913[_0x7962('0x3c')]:_0x2ab95f[_0x7962('0x38')];_0x49c913[_0x7962('0x41')]=qs['sort'](_0x2d1a7d[_0x7962('0x39')][_0x7962('0x42')]);_0x49c913[_0x7962('0x43')]=qs['filters'](_['pick'](_0x2d1a7d['query'],_0x2ab95f['filters']));if(_0x2d1a7d[_0x7962('0x39')]['filter']){_0x49c913[_0x7962('0x43')]=_['merge'](_0x49c913[_0x7962('0x43')],{'$or':_[_0x7962('0x35')](_0x49c913['attributes'],function(_0xabb380){var _0x5a96c6={};_0x5a96c6[_0xabb380]={'$like':'%'+_0x2d1a7d['query'][_0x7962('0x5f')]+'%'};return _0x5a96c6;})});}_0x49c913=_[_0x7962('0x45')]({},_0x49c913,_0x2d1a7d[_0x7962('0x47')]);return _0x7456ae['getTeams'](_0x49c913);}})[_0x7962('0x2d')](function(_0x3f0408){if(_0x3f0408){_0x38352b=_0x3f0408['length'];if(!_0x2d1a7d[_0x7962('0x39')][_0x7962('0x3f')](_0x7962('0x40'))){_0x49c913['limit']=qs[_0x7962('0x25')](_0x2d1a7d[_0x7962('0x39')][_0x7962('0x25')]);_0x49c913[_0x7962('0x23')]=qs[_0x7962('0x23')](_0x2d1a7d[_0x7962('0x39')][_0x7962('0x23')]);}return _0x7456ae[_0x7962('0x6a')](_0x49c913);}})[_0x7962('0x2d')](function(_0x499d20){if(_0x499d20){return _0x499d20?{'count':_0x38352b,'rows':_0x499d20}:null;}})[_0x7962('0x2d')](respondWithResult(_0x4876a8,null))[_0x7962('0x4b')](handleError(_0x4876a8,null));};exports['addTeams']=function(_0x388c7a,_0x38aeb6,_0x17c467){var _0x5a43fb=_0x388c7a[_0x7962('0x52')]['ids'];return db[_0x7962('0x6b')]['findAll']({'where':{'id':_0x5a43fb},'attributes':['id'],'include':[{'model':db[_0x7962('0x60')],'as':_0x7962('0x6c'),'attributes':['id',_0x7962('0x32'),_0x7962('0x6d'),'voicePause',_0x7962('0x6e')],'raw':!![]}]})[_0x7962('0x2d')](function(_0x4ecea8){if(_0x4ecea8){var _0x2f2d8f=_[_0x7962('0x6f')](_0x4ecea8,function(_0x1d4e95){var _0x478913=_0x1d4e95[_0x7962('0x56')]({'plain':!![]});return _0x478913[_0x7962('0x6c')];});return db[_0x7962('0x48')][_0x7962('0x50')]({'where':{'id':_0x388c7a[_0x7962('0x4d')]['id']}})[_0x7962('0x2d')](function(_0x56fcaf){return db[_0x7962('0x70')][_0x7962('0x71')](function(_0x11085c){return _0x56fcaf[_0x7962('0x72')](_0x5a43fb,{'transaction':_0x11085c})[_0x7962('0x2d')](function(){return BPromise[_0x7962('0x73')](_0x2f2d8f,function(_0x1e0a3c){return db[_0x7962('0x5c')][_0x7962('0x74')]({'where':{'UserId':_0x1e0a3c['id'],'SmsQueueId':_0x388c7a[_0x7962('0x4d')]['id']},'transaction':_0x11085c});});})[_0x7962('0x2d')](function(){_0x2f2d8f[_0x7962('0x75')](function(_0x4852fc){socket[_0x7962('0x76')](_0x7962('0x77'),{'UserId':_0x4852fc['id'],'SmsQueueId':_0x56fcaf['id']});});});});});}})['then'](respondWithStatusCode(_0x38aeb6,null))[_0x7962('0x4b')](handleError(_0x38aeb6,null));};exports[_0x7962('0x78')]=function(_0x26b80b,_0x9b94ca,_0x59380c){return db[_0x7962('0x6b')][_0x7962('0x4a')]({'where':{'id':_0x26b80b[_0x7962('0x39')][_0x7962('0x79')]},'attributes':['id'],'include':[{'model':db[_0x7962('0x60')],'as':_0x7962('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x7962('0x2d')](handleEntityNotFound(_0x9b94ca,null))['then'](function(_0xc7e29){var _0xf05968=_['map'](_0xc7e29,'id');var _0x1279fa=[];var _0x4cffb1=[];var _0x259f94=squel[_0x7962('0x7a')]();_0x259f94[_0x7962('0x7b')](_0x7962('0x7c'))[_0x7962('0x7d')](_0x7962('0x7e'),'tq')[_0x7962('0x7f')](_0x7962('0x80'),'ut',_0x7962('0x81'))['where']('SmsQueueId\x20=\x20?',_0x26b80b[_0x7962('0x4d')]['id']);for(var _0x1f4e14=0x0;_0x1f4e14<_0xc7e29[_0x7962('0x3e')];_0x1f4e14+=0x1){let _0x30fc40=_0xc7e29[_0x1f4e14];for(var _0x5bf210=0x0;_0x5bf210<_0x30fc40[_0x7962('0x6c')][_0x7962('0x3e')];_0x5bf210+=0x1){let _0x57581e=_0x30fc40[_0x7962('0x6c')][_0x5bf210];var _0x4f82c4=_0x259f94[_0x7962('0x82')]();_0x4f82c4[_0x7962('0x43')](_0x7962('0x83'),_0x57581e['id']);_0x4cffb1[_0x7962('0x84')](db[_0x7962('0x70')][_0x7962('0x39')](_0x4f82c4[_0x7962('0x85')](),{'type':db[_0x7962('0x70')][_0x7962('0x86')][_0x7962('0x87')]})[_0x7962('0x2d')](function(_0x5787bb){if(_0x5787bb['length']===0x1){return _0x57581e['id'];}else{var _0x51622a=_[_0x7962('0x88')](_[_0x7962('0x35')](_0x5787bb,_0x7962('0x89')),function(_0x3835f6){return _[_0x7962('0x8a')](_0xf05968,_0x3835f6);});if(_0x51622a){return _0x57581e['id'];}}}));}}return BPromise[_0x7962('0x8b')](_0x4cffb1)['then'](function(_0x30785d){_0x1279fa=_(_0x1279fa)[_0x7962('0x8c')](_0x30785d)[_0x7962('0x8d')]()[_0x7962('0x8e')]();return db[_0x7962('0x48')]['find']({'where':{'id':_0x26b80b[_0x7962('0x4d')]['id']}})['then'](function(_0x470c46){return db['sequelize'][_0x7962('0x71')](function(_0x315774){return _0x470c46[_0x7962('0x78')](_0x26b80b[_0x7962('0x39')][_0x7962('0x79')],{'transaction':_0x315774})[_0x7962('0x2d')](function(){if(!_['isEmpty'](_0x1279fa)){return _0x470c46[_0x7962('0x8f')](_0x1279fa,{'transaction':_0x315774});}})[_0x7962('0x2d')](function(){_0x1279fa[_0x7962('0x75')](function(_0x3d58cc){socket['emit'](_0x7962('0x90'),{'UserId':_0x3d58cc,'SmsQueueId':_0x470c46['id']});});});});});});})['then'](respondWithStatusCode(_0x9b94ca,null))[_0x7962('0x4b')](handleError(_0x9b94ca,null));};exports['addAgents']=function(_0x7ea851,_0x5597b5,_0x3cbbe1){return db[_0x7962('0x48')][_0x7962('0x50')]({'where':{'id':_0x7ea851[_0x7962('0x4d')]['id']}})[_0x7962('0x2d')](handleEntityNotFound(_0x5597b5,null))[_0x7962('0x2d')](function(_0x128a0b){if(_0x128a0b){return _0x128a0b['addAgents'](_0x7ea851[_0x7962('0x52')][_0x7962('0x79')],_['omit'](_0x7ea851[_0x7962('0x52')],[_0x7962('0x79'),'id'])||{})['spread'](function(_0x1bae2a){for(var _0x214511=0x0;_0x214511<_0x7ea851[_0x7962('0x52')][_0x7962('0x79')]['length'];_0x214511+=0x1){socket[_0x7962('0x76')](_0x7962('0x77'),{'UserId':Number(_0x7ea851[_0x7962('0x52')][_0x7962('0x79')][_0x214511]),'SmsQueueId':Number(_0x7ea851['params']['id'])});}return _0x1bae2a;});}})[_0x7962('0x2d')](respondWithResult(_0x5597b5,null))[_0x7962('0x4b')](handleError(_0x5597b5,null));};exports[_0x7962('0x8f')]=function(_0x4ca090,_0x2a50c9,_0x43c3a6){return db[_0x7962('0x48')][_0x7962('0x50')]({'where':{'id':_0x4ca090[_0x7962('0x4d')]['id']}})[_0x7962('0x2d')](handleEntityNotFound(_0x2a50c9,null))[_0x7962('0x2d')](function(_0x5ca013){if(_0x5ca013){return _0x5ca013['removeAgents'](_0x4ca090[_0x7962('0x39')]['ids'])[_0x7962('0x2d')](function(){if(_[_0x7962('0x91')](_0x4ca090[_0x7962('0x39')][_0x7962('0x79')])){for(var _0x68eab0=0x0;_0x68eab0<_0x4ca090[_0x7962('0x39')]['ids'][_0x7962('0x3e')];_0x68eab0+=0x1){socket[_0x7962('0x76')](_0x7962('0x90'),{'UserId':Number(_0x4ca090[_0x7962('0x39')][_0x7962('0x79')][_0x68eab0]),'SmsQueueId':Number(_0x4ca090[_0x7962('0x4d')]['id'])});}}else{socket['emit'](_0x7962('0x90'),{'UserId':Number(_0x4ca090[_0x7962('0x39')][_0x7962('0x79')]),'SmsQueueId':Number(_0x4ca090[_0x7962('0x4d')]['id'])});}});}})[_0x7962('0x2d')](respondWithStatusCode(_0x2a50c9,null))[_0x7962('0x4b')](handleError(_0x2a50c9,null));};exports[_0x7962('0x92')]=function(_0x4eb3e1,_0x4f1ba4,_0x776bff){var _0x777913={};var _0x2bd147={};var _0xf811dc;var _0xb530e1;return db['SmsQueue']['findOne']({'where':{'id':_0x4eb3e1[_0x7962('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4f1ba4,null))[_0x7962('0x2d')](function(_0x279457){if(_0x279457){_0xf811dc=_0x279457;_0x2bd147['model']=_[_0x7962('0x3a')](db[_0x7962('0x60')][_0x7962('0x4e')]);_0x2bd147['query']=_[_0x7962('0x3a')](_0x4eb3e1[_0x7962('0x39')]);_0x2bd147[_0x7962('0x44')]=_[_0x7962('0x3b')](_0x2bd147[_0x7962('0x38')],_0x2bd147['query']);_0x777913[_0x7962('0x3c')]=_[_0x7962('0x3b')](_0x2bd147[_0x7962('0x38')],qs[_0x7962('0x3d')](_0x4eb3e1[_0x7962('0x39')][_0x7962('0x3d')]));_0x777913[_0x7962('0x3c')]=_0x777913[_0x7962('0x3c')][_0x7962('0x3e')]?_0x777913[_0x7962('0x3c')]:_0x2bd147[_0x7962('0x38')];_0x777913['order']=qs[_0x7962('0x42')](_0x4eb3e1[_0x7962('0x39')][_0x7962('0x42')]);_0x777913[_0x7962('0x43')]=qs[_0x7962('0x44')](_[_0x7962('0x5d')](_0x4eb3e1[_0x7962('0x39')],_0x2bd147[_0x7962('0x44')]));if(_0x4eb3e1[_0x7962('0x39')][_0x7962('0x5f')]){_0x777913[_0x7962('0x43')]=_['merge'](_0x777913[_0x7962('0x43')],{'$or':_[_0x7962('0x35')](_0x777913[_0x7962('0x3c')],function(_0x13cd84){var _0x379457={};_0x379457[_0x13cd84]={'$like':'%'+_0x4eb3e1[_0x7962('0x39')][_0x7962('0x5f')]+'%'};return _0x379457;})});}_0x777913=_[_0x7962('0x45')]({},_0x777913,_0x4eb3e1[_0x7962('0x47')]);return _0xf811dc[_0x7962('0x92')](_0x777913);}})[_0x7962('0x2d')](function(_0x42059b){if(_0x42059b){_0xb530e1=_0x42059b[_0x7962('0x3e')];if(!_0x4eb3e1[_0x7962('0x39')][_0x7962('0x3f')](_0x7962('0x40'))){_0x777913[_0x7962('0x25')]=qs['limit'](_0x4eb3e1['query'][_0x7962('0x25')]);_0x777913[_0x7962('0x23')]=qs[_0x7962('0x23')](_0x4eb3e1[_0x7962('0x39')][_0x7962('0x23')]);}return _0xf811dc[_0x7962('0x92')](_0x777913);}})['then'](function(_0x125622){if(_0x125622){return _0x125622?{'count':_0xb530e1,'rows':_0x125622}:null;}})['then'](respondWithResult(_0x4f1ba4,null))[_0x7962('0x4b')](handleError(_0x4f1ba4,null));}; \ No newline at end of file +var _0xbb4d=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SmsQueue','includeAll','include','catch','show','params','intersection','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SmsQueues','UserProfileSection','find','userProfileId','UserProfileResource','error','describe','getMembers','findOne','hasOwnProperty','UserSmsQueue','findAll','User','findAndCountAll','smsPause','updatedAt','createdAt','rows','%s/%s','Team','getTeams','ids','Agents','online','voicePause','interface','sequelize','addTeams','each','findOrCreate','forEach','emit','userSmsQueue:save','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','includes','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra'];(function(_0x4ded65,_0xc8d7c1){var _0x5864fb=function(_0x40df9d){while(--_0x40df9d){_0x4ded65['push'](_0x4ded65['shift']());}};_0x5864fb(++_0xc8d7c1);}(_0xbb4d,0x19f));var _0xdbb4=function(_0x278679,_0x1eb219){_0x278679=_0x278679-0x0;var _0x4874aa=_0xbb4d[_0x278679];return _0x4874aa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdbb4('0x0'));var zipdir=require(_0xdbb4('0x1'));var jsonpatch=require(_0xdbb4('0x2'));var rp=require(_0xdbb4('0x3'));var moment=require(_0xdbb4('0x4'));var BPromise=require(_0xdbb4('0x5'));var Mustache=require('mustache');var util=require(_0xdbb4('0x6'));var path=require(_0xdbb4('0x7'));var sox=require(_0xdbb4('0x8'));var csv=require(_0xdbb4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdbb4('0xa'));var _=require(_0xdbb4('0xb'));var squel=require(_0xdbb4('0xc'));var crypto=require(_0xdbb4('0xd'));var jsforce=require(_0xdbb4('0xe'));var deskjs=require(_0xdbb4('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdbb4('0x10'));var Papa=require(_0xdbb4('0x11'));var Redis=require(_0xdbb4('0x12'));var authService=require(_0xdbb4('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xdbb4('0x14'));var hardwareService=require(_0xdbb4('0x15'));var logger=require(_0xdbb4('0x16'))(_0xdbb4('0x17'));var utils=require(_0xdbb4('0x18'));var config=require(_0xdbb4('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xdbb4('0x1a')],{'host':_0xdbb4('0x1b'),'port':0x18eb});var socket=require(_0xdbb4('0x1c'))(new Redis(config[_0xdbb4('0x1a')]));require(_0xdbb4('0x1d'))[_0xdbb4('0x1e')](socket);function respondWithStatusCode(_0x5a3f47,_0x13c769){_0x13c769=_0x13c769||0xcc;return function(_0x11af11){if(_0x11af11){return _0x5a3f47[_0xdbb4('0x1f')](_0x13c769);}return _0x5a3f47[_0xdbb4('0x20')](_0x13c769)[_0xdbb4('0x21')]();};}function respondWithResult(_0x2dfa83,_0x3e1e57){_0x3e1e57=_0x3e1e57||0xc8;return function(_0x3f3a82){if(_0x3f3a82){return _0x2dfa83[_0xdbb4('0x20')](_0x3e1e57)[_0xdbb4('0x22')](_0x3f3a82);}};}function respondWithFilteredResult(_0x42a297,_0x465fdb){return function(_0x323ae0){if(_0x323ae0){var _0x1da36c=typeof _0x465fdb[_0xdbb4('0x23')]===_0xdbb4('0x24')&&typeof _0x465fdb[_0xdbb4('0x25')]===_0xdbb4('0x24');var _0x4bdb0a=_0x323ae0[_0xdbb4('0x26')];var _0x2596c9=_0x1da36c?0x0:_0x465fdb['offset'];var _0x22e0d2=_0x1da36c?_0x323ae0[_0xdbb4('0x26')]:_0x465fdb[_0xdbb4('0x23')]+_0x465fdb[_0xdbb4('0x25')];var _0x535477;if(_0x22e0d2>=_0x4bdb0a){_0x22e0d2=_0x4bdb0a;_0x535477=0xc8;}else{_0x535477=0xce;}_0x42a297[_0xdbb4('0x20')](_0x535477);return _0x42a297[_0xdbb4('0x27')](_0xdbb4('0x28'),_0x2596c9+'-'+_0x22e0d2+'/'+_0x4bdb0a)[_0xdbb4('0x22')](_0x323ae0);}return null;};}function patchUpdates(_0x4fa166){return function(_0x460755){try{jsonpatch[_0xdbb4('0x29')](_0x460755,_0x4fa166,!![]);}catch(_0x4c080b){return BPromise[_0xdbb4('0x2a')](_0x4c080b);}return _0x460755[_0xdbb4('0x2b')]();};}function saveUpdates(_0x6a1199,_0x2e6fc1){return function(_0x59aed1){if(_0x59aed1){return _0x59aed1[_0xdbb4('0x2c')](_0x6a1199)[_0xdbb4('0x2d')](function(_0xd2c648){return _0xd2c648;});}return null;};}function removeEntity(_0x2510b1,_0x1979fb){return function(_0x147a23){if(_0x147a23){return _0x147a23[_0xdbb4('0x2e')]()[_0xdbb4('0x2d')](function(){var _0x5e6be1=_0x147a23[_0xdbb4('0x2f')]({'plain':!![]});var _0x164b2c='SmsQueues';return db['UserProfileResource'][_0xdbb4('0x2e')]({'where':{'type':_0x164b2c,'resourceId':_0x5e6be1['id']}})[_0xdbb4('0x2d')](function(){return _0x147a23;});})['then'](function(){_0x2510b1[_0xdbb4('0x20')](0xcc)[_0xdbb4('0x21')]();});}};}function handleEntityNotFound(_0x433add,_0x155839){return function(_0x1fcc8c){if(!_0x1fcc8c){_0x433add[_0xdbb4('0x1f')](0x194);}return _0x1fcc8c;};}function handleError(_0x17d403,_0x49ae7c){_0x49ae7c=_0x49ae7c||0x1f4;return function(_0x1ed9fa){logger['error'](_0x1ed9fa['stack']);if(_0x1ed9fa['name']){delete _0x1ed9fa[_0xdbb4('0x30')];}_0x17d403['status'](_0x49ae7c)['send'](_0x1ed9fa);};}exports[_0xdbb4('0x31')]=function(_0x211ecd,_0x4f6f77){var _0x45a105={},_0x1aa8cd={},_0x18e1f3={'count':0x0,'rows':[]};var _0x2be27b=_[_0xdbb4('0x32')](db['SmsQueue'][_0xdbb4('0x33')],function(_0x579b77){return{'name':_0x579b77[_0xdbb4('0x34')],'type':_0x579b77[_0xdbb4('0x35')][_0xdbb4('0x36')]};});_0x1aa8cd[_0xdbb4('0x37')]=_[_0xdbb4('0x32')](_0x2be27b,_0xdbb4('0x30'));_0x1aa8cd[_0xdbb4('0x38')]=_[_0xdbb4('0x39')](_0x211ecd[_0xdbb4('0x38')]);_0x1aa8cd[_0xdbb4('0x3a')]=_['intersection'](_0x1aa8cd['model'],_0x1aa8cd['query']);_0x45a105[_0xdbb4('0x3b')]=_['intersection'](_0x1aa8cd[_0xdbb4('0x37')],qs['fields'](_0x211ecd['query']['fields']));_0x45a105[_0xdbb4('0x3b')]=_0x45a105[_0xdbb4('0x3b')][_0xdbb4('0x3c')]?_0x45a105[_0xdbb4('0x3b')]:_0x1aa8cd[_0xdbb4('0x37')];if(!_0x211ecd[_0xdbb4('0x38')]['hasOwnProperty'](_0xdbb4('0x3d'))){_0x45a105[_0xdbb4('0x25')]=qs[_0xdbb4('0x25')](_0x211ecd[_0xdbb4('0x38')][_0xdbb4('0x25')]);_0x45a105[_0xdbb4('0x23')]=qs[_0xdbb4('0x23')](_0x211ecd['query'][_0xdbb4('0x23')]);}_0x45a105[_0xdbb4('0x3e')]=qs[_0xdbb4('0x3f')](_0x211ecd['query'][_0xdbb4('0x3f')]);_0x45a105[_0xdbb4('0x40')]=qs[_0xdbb4('0x3a')](_[_0xdbb4('0x41')](_0x211ecd[_0xdbb4('0x38')],_0x1aa8cd[_0xdbb4('0x3a')]),_0x2be27b);if(_0x211ecd[_0xdbb4('0x38')][_0xdbb4('0x42')]){_0x45a105[_0xdbb4('0x40')]=_[_0xdbb4('0x43')](_0x45a105[_0xdbb4('0x40')],{'$or':_[_0xdbb4('0x32')](_0x2be27b,function(_0x65adfb){if(_0x65adfb[_0xdbb4('0x35')]!==_0xdbb4('0x44')){var _0x1a619e={};_0x1a619e[_0x65adfb[_0xdbb4('0x30')]]={'$like':'%'+_0x211ecd[_0xdbb4('0x38')]['filter']+'%'};return _0x1a619e;}})});}_0x45a105=_[_0xdbb4('0x43')]({},_0x45a105,_0x211ecd[_0xdbb4('0x45')]);var _0x3186b={'where':_0x45a105['where']};return db[_0xdbb4('0x46')][_0xdbb4('0x26')](_0x3186b)[_0xdbb4('0x2d')](function(_0x2bc1fd){_0x18e1f3['count']=_0x2bc1fd;if(_0x211ecd[_0xdbb4('0x38')][_0xdbb4('0x47')]){_0x45a105[_0xdbb4('0x48')]=[{'all':!![]}];}return db[_0xdbb4('0x46')]['findAll'](_0x45a105);})[_0xdbb4('0x2d')](function(_0x3d5fce){_0x18e1f3['rows']=_0x3d5fce;return _0x18e1f3;})[_0xdbb4('0x2d')](respondWithFilteredResult(_0x4f6f77,_0x45a105))[_0xdbb4('0x49')](handleError(_0x4f6f77,null));};exports[_0xdbb4('0x4a')]=function(_0x4ab9a5,_0x5af774){var _0x3a6f16={'raw':!![],'where':{'id':_0x4ab9a5[_0xdbb4('0x4b')]['id']}},_0x179be4={};_0x179be4['model']=_[_0xdbb4('0x39')](db[_0xdbb4('0x46')]['rawAttributes']);_0x179be4['query']=_[_0xdbb4('0x39')](_0x4ab9a5[_0xdbb4('0x38')]);_0x179be4[_0xdbb4('0x3a')]=_[_0xdbb4('0x4c')](_0x179be4[_0xdbb4('0x37')],_0x179be4[_0xdbb4('0x38')]);_0x3a6f16[_0xdbb4('0x3b')]=_[_0xdbb4('0x4c')](_0x179be4[_0xdbb4('0x37')],qs['fields'](_0x4ab9a5[_0xdbb4('0x38')][_0xdbb4('0x4d')]));_0x3a6f16[_0xdbb4('0x3b')]=_0x3a6f16[_0xdbb4('0x3b')][_0xdbb4('0x3c')]?_0x3a6f16[_0xdbb4('0x3b')]:_0x179be4[_0xdbb4('0x37')];if(_0x4ab9a5['query'][_0xdbb4('0x47')]){_0x3a6f16[_0xdbb4('0x48')]=[{'all':!![]}];}_0x3a6f16=_[_0xdbb4('0x43')]({},_0x3a6f16,_0x4ab9a5[_0xdbb4('0x45')]);return db[_0xdbb4('0x46')]['find'](_0x3a6f16)[_0xdbb4('0x2d')](handleEntityNotFound(_0x5af774,null))[_0xdbb4('0x2d')](respondWithResult(_0x5af774,null))['catch'](handleError(_0x5af774,null));};exports[_0xdbb4('0x4e')]=function(_0x41c23a,_0x5dec0){return db[_0xdbb4('0x46')][_0xdbb4('0x4e')](_0x41c23a[_0xdbb4('0x4f')],{})[_0xdbb4('0x2d')](function(_0x54a4dc){var _0x5b78ae=_0x41c23a[_0xdbb4('0x50')][_0xdbb4('0x2f')]({'plain':!![]});if(!_0x5b78ae)throw new Error(_0xdbb4('0x51'));if(_0x5b78ae['role']===_0xdbb4('0x50')){var _0x4d0065=_0x54a4dc[_0xdbb4('0x2f')]({'plain':!![]});var _0x28f8a2=_0xdbb4('0x52');return db[_0xdbb4('0x53')][_0xdbb4('0x54')]({'where':{'name':_0x28f8a2,'userProfileId':_0x5b78ae[_0xdbb4('0x55')]},'raw':!![]})[_0xdbb4('0x2d')](function(_0x312e88){if(_0x312e88&&_0x312e88['autoAssociation']===0x0){return db[_0xdbb4('0x56')]['create']({'name':_0x4d0065[_0xdbb4('0x30')],'resourceId':_0x4d0065['id'],'type':_0x312e88[_0xdbb4('0x30')],'sectionId':_0x312e88['id']},{})[_0xdbb4('0x2d')](function(){return _0x54a4dc;});}else{return _0x54a4dc;}})[_0xdbb4('0x49')](function(_0x29aa2f){logger[_0xdbb4('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29aa2f);throw _0x29aa2f;});}return _0x54a4dc;})[_0xdbb4('0x2d')](respondWithResult(_0x5dec0,0xc9))[_0xdbb4('0x49')](handleError(_0x5dec0,null));};exports[_0xdbb4('0x2c')]=function(_0x57675e,_0x27b00f){if(_0x57675e['body']['id']){delete _0x57675e[_0xdbb4('0x4f')]['id'];}return db[_0xdbb4('0x46')][_0xdbb4('0x54')]({'where':{'id':_0x57675e[_0xdbb4('0x4b')]['id']}})[_0xdbb4('0x2d')](handleEntityNotFound(_0x27b00f,null))[_0xdbb4('0x2d')](saveUpdates(_0x57675e[_0xdbb4('0x4f')],null))['then'](respondWithResult(_0x27b00f,null))['catch'](handleError(_0x27b00f,null));};exports[_0xdbb4('0x2e')]=function(_0x535160,_0x45e6d1){return db[_0xdbb4('0x46')][_0xdbb4('0x54')]({'where':{'id':_0x535160[_0xdbb4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x45e6d1,null))['then'](removeEntity(_0x45e6d1,null))[_0xdbb4('0x49')](handleError(_0x45e6d1,null));};exports[_0xdbb4('0x58')]=function(_0x4e3dd3,_0x2e30c8){return db[_0xdbb4('0x46')]['describe']()[_0xdbb4('0x2d')](respondWithResult(_0x2e30c8,null))[_0xdbb4('0x49')](handleError(_0x2e30c8,null));};exports[_0xdbb4('0x59')]=function(_0x238618,_0x43424c,_0x4c3540){var _0x1c6b8e={'raw':!![],'where':{}},_0x2e8b03={},_0x468f51;return db[_0xdbb4('0x46')][_0xdbb4('0x5a')]({'where':{'id':_0x238618['params']['id']}})[_0xdbb4('0x2d')](handleEntityNotFound(_0x43424c,null))[_0xdbb4('0x2d')](function(_0x5ef58d){if(_0x5ef58d){_0x468f51=_0x5ef58d[_0xdbb4('0x2f')]({'plain':!![]});_0x2e8b03['model']=_[_0xdbb4('0x39')](db['UserSmsQueue'][_0xdbb4('0x33')]);_0x2e8b03[_0xdbb4('0x38')]=_[_0xdbb4('0x39')](_0x238618['query']);_0x2e8b03[_0xdbb4('0x3a')]=_[_0xdbb4('0x4c')](_0x2e8b03[_0xdbb4('0x37')],_0x2e8b03[_0xdbb4('0x38')]);_0x1c6b8e['attributes']=_[_0xdbb4('0x4c')](_0x2e8b03[_0xdbb4('0x37')],qs[_0xdbb4('0x4d')](_0x238618[_0xdbb4('0x38')]['fields']));_0x1c6b8e[_0xdbb4('0x3b')]=_0x1c6b8e['attributes'][_0xdbb4('0x3c')]?_0x1c6b8e[_0xdbb4('0x3b')]:_0x2e8b03[_0xdbb4('0x37')];if(!_0x238618['query'][_0xdbb4('0x5b')](_0xdbb4('0x3d'))){_0x1c6b8e[_0xdbb4('0x25')]=qs['limit'](_0x238618[_0xdbb4('0x38')][_0xdbb4('0x25')]);_0x1c6b8e[_0xdbb4('0x23')]=qs[_0xdbb4('0x23')](_0x238618['query']['offset']);}_0x1c6b8e[_0xdbb4('0x3e')]=qs[_0xdbb4('0x3f')](_0x238618['query'][_0xdbb4('0x3f')]);_0x1c6b8e['where']=qs[_0xdbb4('0x3a')](_[_0xdbb4('0x41')](_0x238618[_0xdbb4('0x38')],_0x2e8b03[_0xdbb4('0x3a')]));_0x1c6b8e[_0xdbb4('0x40')]['SmsQueueId']=_0x5ef58d['id'];if(_0x238618[_0xdbb4('0x38')]['filter']){_0x1c6b8e[_0xdbb4('0x40')]=_[_0xdbb4('0x43')](_0x1c6b8e[_0xdbb4('0x40')],{'$or':_[_0xdbb4('0x32')](_0x1c6b8e['attributes'],function(_0x48483e){var _0x20e0d2={};_0x20e0d2[_0x48483e]={'$like':'%'+_0x238618[_0xdbb4('0x38')][_0xdbb4('0x42')]+'%'};return _0x20e0d2;})});}_0x1c6b8e=_['merge']({},_0x1c6b8e,_0x238618[_0xdbb4('0x45')]);return db[_0xdbb4('0x5c')][_0xdbb4('0x5d')](_0x1c6b8e);}})[_0xdbb4('0x2d')](function(_0x15b771){if(_0x15b771){return db[_0xdbb4('0x5e')][_0xdbb4('0x5f')]({'where':{'id':_[_0xdbb4('0x32')](_0x15b771,'UserId'),'role':'agent'},'attributes':['id',_0xdbb4('0x30'),_0xdbb4('0x60'),_0xdbb4('0x61'),_0xdbb4('0x62')]});}})['then'](function(_0x38c6f5){if(_0x38c6f5){return{'count':_0x38c6f5['count'],'rows':_[_0xdbb4('0x32')](_0x38c6f5[_0xdbb4('0x63')],function(_0x278848){return{'membername':_0x278848[_0xdbb4('0x30')],'UserId':_0x278848['id'],'queue_name':_0x468f51[_0xdbb4('0x30')],'SmsQueueId':_0x468f51['id'],'interface':util['format'](_0xdbb4('0x64'),'SIP',_0x278848[_0xdbb4('0x30')]),'penalty':0x0,'paused':_0x278848[_0xdbb4('0x60')],'createdAt':_0x278848[_0xdbb4('0x62')],'updatedAt':_0x278848[_0xdbb4('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xdbb4('0x2d')](respondWithFilteredResult(_0x43424c,_0x1c6b8e))[_0xdbb4('0x49')](handleError(_0x43424c,null));};exports['getTeams']=function(_0x96e596,_0x28a969,_0x45a535){var _0x1d53e7={};var _0x5363f0={};var _0x45103d;var _0x4a2b75;return db[_0xdbb4('0x46')]['findOne']({'where':{'id':_0x96e596[_0xdbb4('0x4b')]['id']}})[_0xdbb4('0x2d')](handleEntityNotFound(_0x28a969,null))[_0xdbb4('0x2d')](function(_0x34dbe6){if(_0x34dbe6){_0x45103d=_0x34dbe6;_0x5363f0[_0xdbb4('0x37')]=_[_0xdbb4('0x39')](db[_0xdbb4('0x65')]['rawAttributes']);_0x5363f0[_0xdbb4('0x38')]=_[_0xdbb4('0x39')](_0x96e596['query']);_0x5363f0[_0xdbb4('0x3a')]=_[_0xdbb4('0x4c')](_0x5363f0[_0xdbb4('0x37')],_0x5363f0[_0xdbb4('0x38')]);_0x1d53e7[_0xdbb4('0x3b')]=_['intersection'](_0x5363f0['model'],qs[_0xdbb4('0x4d')](_0x96e596['query'][_0xdbb4('0x4d')]));_0x1d53e7[_0xdbb4('0x3b')]=_0x1d53e7['attributes'][_0xdbb4('0x3c')]?_0x1d53e7[_0xdbb4('0x3b')]:_0x5363f0[_0xdbb4('0x37')];_0x1d53e7[_0xdbb4('0x3e')]=qs['sort'](_0x96e596[_0xdbb4('0x38')][_0xdbb4('0x3f')]);_0x1d53e7[_0xdbb4('0x40')]=qs[_0xdbb4('0x3a')](_['pick'](_0x96e596['query'],_0x5363f0[_0xdbb4('0x3a')]));if(_0x96e596['query']['filter']){_0x1d53e7['where']=_[_0xdbb4('0x43')](_0x1d53e7[_0xdbb4('0x40')],{'$or':_[_0xdbb4('0x32')](_0x1d53e7[_0xdbb4('0x3b')],function(_0xd1304f){var _0x2ac506={};_0x2ac506[_0xd1304f]={'$like':'%'+_0x96e596[_0xdbb4('0x38')][_0xdbb4('0x42')]+'%'};return _0x2ac506;})});}_0x1d53e7=_['merge']({},_0x1d53e7,_0x96e596[_0xdbb4('0x45')]);return _0x45103d[_0xdbb4('0x66')](_0x1d53e7);}})[_0xdbb4('0x2d')](function(_0xaa9cde){if(_0xaa9cde){_0x4a2b75=_0xaa9cde[_0xdbb4('0x3c')];if(!_0x96e596[_0xdbb4('0x38')][_0xdbb4('0x5b')](_0xdbb4('0x3d'))){_0x1d53e7[_0xdbb4('0x25')]=qs[_0xdbb4('0x25')](_0x96e596['query']['limit']);_0x1d53e7['offset']=qs[_0xdbb4('0x23')](_0x96e596[_0xdbb4('0x38')]['offset']);}return _0x45103d[_0xdbb4('0x66')](_0x1d53e7);}})[_0xdbb4('0x2d')](function(_0x5a2e3f){if(_0x5a2e3f){return _0x5a2e3f?{'count':_0x4a2b75,'rows':_0x5a2e3f}:null;}})[_0xdbb4('0x2d')](respondWithResult(_0x28a969,null))[_0xdbb4('0x49')](handleError(_0x28a969,null));};exports['addTeams']=function(_0x4a15d4,_0x2896f2,_0x4b3260){var _0x27bb21=_0x4a15d4[_0xdbb4('0x4f')][_0xdbb4('0x67')];return db['Team']['findAll']({'where':{'id':_0x27bb21},'attributes':['id'],'include':[{'model':db[_0xdbb4('0x5e')],'as':_0xdbb4('0x68'),'attributes':['id','name',_0xdbb4('0x69'),_0xdbb4('0x6a'),_0xdbb4('0x6b')],'raw':!![]}]})[_0xdbb4('0x2d')](function(_0x59601d){if(_0x59601d){var _0x1bdea5=_['flatMap'](_0x59601d,function(_0x48e70f){var _0x2fb9c2=_0x48e70f[_0xdbb4('0x2f')]({'plain':!![]});return _0x2fb9c2['Agents'];});return db[_0xdbb4('0x46')][_0xdbb4('0x54')]({'where':{'id':_0x4a15d4[_0xdbb4('0x4b')]['id']}})['then'](function(_0x493cc7){return db[_0xdbb4('0x6c')]['transaction'](function(_0x107f84){return _0x493cc7[_0xdbb4('0x6d')](_0x27bb21,{'transaction':_0x107f84})['then'](function(){return BPromise[_0xdbb4('0x6e')](_0x1bdea5,function(_0x43c899){return db[_0xdbb4('0x5c')][_0xdbb4('0x6f')]({'where':{'UserId':_0x43c899['id'],'SmsQueueId':_0x4a15d4[_0xdbb4('0x4b')]['id']},'transaction':_0x107f84});});})[_0xdbb4('0x2d')](function(){_0x1bdea5[_0xdbb4('0x70')](function(_0x571100){socket[_0xdbb4('0x71')](_0xdbb4('0x72'),{'UserId':_0x571100['id'],'SmsQueueId':_0x493cc7['id']});});});});});}})['then'](respondWithStatusCode(_0x2896f2,null))['catch'](handleError(_0x2896f2,null));};exports['removeTeams']=function(_0x97fbcf,_0x5cdf56,_0x5da2e2){return db['Team'][_0xdbb4('0x5d')]({'where':{'id':_0x97fbcf[_0xdbb4('0x38')][_0xdbb4('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5cdf56,null))['then'](function(_0x535c62){var _0x36b1cc=_[_0xdbb4('0x32')](_0x535c62,'id');var _0x11e5fd=[];var _0x4c92e0=[];var _0x428efb=squel[_0xdbb4('0x73')]();_0x428efb[_0xdbb4('0x74')](_0xdbb4('0x75'))[_0xdbb4('0x76')](_0xdbb4('0x77'),'tq')[_0xdbb4('0x78')](_0xdbb4('0x79'),'ut',_0xdbb4('0x7a'))[_0xdbb4('0x40')](_0xdbb4('0x7b'),_0x97fbcf[_0xdbb4('0x4b')]['id']);for(var _0x3b64bd=0x0;_0x3b64bd<_0x535c62[_0xdbb4('0x3c')];_0x3b64bd+=0x1){let _0x1c8cf1=_0x535c62[_0x3b64bd];for(var _0x268a6b=0x0;_0x268a6b<_0x1c8cf1[_0xdbb4('0x68')]['length'];_0x268a6b+=0x1){let _0x131c0c=_0x1c8cf1[_0xdbb4('0x68')][_0x268a6b];var _0xabe430=_0x428efb[_0xdbb4('0x7c')]();_0xabe430[_0xdbb4('0x40')]('ut.UserId\x20=\x20?',_0x131c0c['id']);_0x4c92e0[_0xdbb4('0x7d')](db['sequelize'][_0xdbb4('0x38')](_0xabe430[_0xdbb4('0x7e')](),{'type':db[_0xdbb4('0x6c')][_0xdbb4('0x7f')][_0xdbb4('0x80')]})[_0xdbb4('0x2d')](function(_0x2b7ad6){if(_0x2b7ad6[_0xdbb4('0x3c')]===0x1){return _0x131c0c['id'];}else{var _0xc5a96d=_[_0xdbb4('0x81')](_['map'](_0x2b7ad6,'TeamId'),function(_0x2d8232){return _[_0xdbb4('0x82')](_0x36b1cc,_0x2d8232);});if(_0xc5a96d){return _0x131c0c['id'];}}}));}}return BPromise['all'](_0x4c92e0)[_0xdbb4('0x2d')](function(_0x349eee){_0x11e5fd=_(_0x11e5fd)[_0xdbb4('0x83')](_0x349eee)[_0xdbb4('0x84')]()[_0xdbb4('0x85')]();return db[_0xdbb4('0x46')][_0xdbb4('0x54')]({'where':{'id':_0x97fbcf[_0xdbb4('0x4b')]['id']}})[_0xdbb4('0x2d')](function(_0x308240){return db['sequelize']['transaction'](function(_0x4bdc71){return _0x308240['removeTeams'](_0x97fbcf[_0xdbb4('0x38')][_0xdbb4('0x67')],{'transaction':_0x4bdc71})['then'](function(){if(!_[_0xdbb4('0x86')](_0x11e5fd)){return _0x308240[_0xdbb4('0x87')](_0x11e5fd,{'transaction':_0x4bdc71});}})[_0xdbb4('0x2d')](function(){_0x11e5fd['forEach'](function(_0x4f9fb1){socket[_0xdbb4('0x71')](_0xdbb4('0x88'),{'UserId':_0x4f9fb1,'SmsQueueId':_0x308240['id']});});});});});});})[_0xdbb4('0x2d')](respondWithStatusCode(_0x5cdf56,null))['catch'](handleError(_0x5cdf56,null));};exports[_0xdbb4('0x89')]=function(_0x1399d0,_0x578491,_0x5b1674){return db[_0xdbb4('0x46')][_0xdbb4('0x54')]({'where':{'id':_0x1399d0[_0xdbb4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x578491,null))[_0xdbb4('0x2d')](function(_0x543c74){if(_0x543c74){return _0x543c74[_0xdbb4('0x89')](_0x1399d0[_0xdbb4('0x4f')][_0xdbb4('0x67')],_[_0xdbb4('0x8a')](_0x1399d0[_0xdbb4('0x4f')],['ids','id'])||{})[_0xdbb4('0x8b')](function(_0x53e025){for(var _0x3ac192=0x0;_0x3ac192<_0x1399d0[_0xdbb4('0x4f')][_0xdbb4('0x67')][_0xdbb4('0x3c')];_0x3ac192+=0x1){socket[_0xdbb4('0x71')](_0xdbb4('0x72'),{'UserId':Number(_0x1399d0[_0xdbb4('0x4f')][_0xdbb4('0x67')][_0x3ac192]),'SmsQueueId':Number(_0x1399d0[_0xdbb4('0x4b')]['id'])});}return _0x53e025;});}})['then'](respondWithResult(_0x578491,null))[_0xdbb4('0x49')](handleError(_0x578491,null));};exports[_0xdbb4('0x87')]=function(_0x4616f6,_0x411df3,_0x4daeb8){return db[_0xdbb4('0x46')][_0xdbb4('0x54')]({'where':{'id':_0x4616f6[_0xdbb4('0x4b')]['id']}})[_0xdbb4('0x2d')](handleEntityNotFound(_0x411df3,null))[_0xdbb4('0x2d')](function(_0xbc94a2){if(_0xbc94a2){return _0xbc94a2[_0xdbb4('0x87')](_0x4616f6[_0xdbb4('0x38')][_0xdbb4('0x67')])[_0xdbb4('0x2d')](function(){if(_[_0xdbb4('0x8c')](_0x4616f6['query']['ids'])){for(var _0x4602e4=0x0;_0x4602e4<_0x4616f6[_0xdbb4('0x38')][_0xdbb4('0x67')]['length'];_0x4602e4+=0x1){socket[_0xdbb4('0x71')](_0xdbb4('0x88'),{'UserId':Number(_0x4616f6[_0xdbb4('0x38')]['ids'][_0x4602e4]),'SmsQueueId':Number(_0x4616f6['params']['id'])});}}else{socket[_0xdbb4('0x71')]('userSmsQueue:remove',{'UserId':Number(_0x4616f6[_0xdbb4('0x38')][_0xdbb4('0x67')]),'SmsQueueId':Number(_0x4616f6[_0xdbb4('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x411df3,null))['catch'](handleError(_0x411df3,null));};exports['getAgents']=function(_0x5a51f1,_0x297476,_0x51a6a5){var _0x4f81ed={};var _0x29b78f={};var _0x301b39;var _0x1c46be;return db[_0xdbb4('0x46')][_0xdbb4('0x5a')]({'where':{'id':_0x5a51f1[_0xdbb4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x297476,null))[_0xdbb4('0x2d')](function(_0x48ac80){if(_0x48ac80){_0x301b39=_0x48ac80;_0x29b78f[_0xdbb4('0x37')]=_['keys'](db[_0xdbb4('0x5e')][_0xdbb4('0x33')]);_0x29b78f[_0xdbb4('0x38')]=_[_0xdbb4('0x39')](_0x5a51f1[_0xdbb4('0x38')]);_0x29b78f[_0xdbb4('0x3a')]=_[_0xdbb4('0x4c')](_0x29b78f['model'],_0x29b78f[_0xdbb4('0x38')]);_0x4f81ed[_0xdbb4('0x3b')]=_[_0xdbb4('0x4c')](_0x29b78f[_0xdbb4('0x37')],qs['fields'](_0x5a51f1[_0xdbb4('0x38')]['fields']));_0x4f81ed[_0xdbb4('0x3b')]=_0x4f81ed[_0xdbb4('0x3b')][_0xdbb4('0x3c')]?_0x4f81ed[_0xdbb4('0x3b')]:_0x29b78f[_0xdbb4('0x37')];_0x4f81ed[_0xdbb4('0x3e')]=qs[_0xdbb4('0x3f')](_0x5a51f1[_0xdbb4('0x38')][_0xdbb4('0x3f')]);_0x4f81ed[_0xdbb4('0x40')]=qs[_0xdbb4('0x3a')](_[_0xdbb4('0x41')](_0x5a51f1[_0xdbb4('0x38')],_0x29b78f[_0xdbb4('0x3a')]));if(_0x5a51f1[_0xdbb4('0x38')]['filter']){_0x4f81ed['where']=_[_0xdbb4('0x43')](_0x4f81ed[_0xdbb4('0x40')],{'$or':_['map'](_0x4f81ed[_0xdbb4('0x3b')],function(_0xaf1757){var _0x1a2fbd={};_0x1a2fbd[_0xaf1757]={'$like':'%'+_0x5a51f1[_0xdbb4('0x38')][_0xdbb4('0x42')]+'%'};return _0x1a2fbd;})});}_0x4f81ed=_[_0xdbb4('0x43')]({},_0x4f81ed,_0x5a51f1[_0xdbb4('0x45')]);return _0x301b39[_0xdbb4('0x8d')](_0x4f81ed);}})[_0xdbb4('0x2d')](function(_0x99107a){if(_0x99107a){_0x1c46be=_0x99107a[_0xdbb4('0x3c')];if(!_0x5a51f1[_0xdbb4('0x38')]['hasOwnProperty']('nolimit')){_0x4f81ed['limit']=qs[_0xdbb4('0x25')](_0x5a51f1[_0xdbb4('0x38')][_0xdbb4('0x25')]);_0x4f81ed[_0xdbb4('0x23')]=qs[_0xdbb4('0x23')](_0x5a51f1['query'][_0xdbb4('0x23')]);}return _0x301b39['getAgents'](_0x4f81ed);}})['then'](function(_0x49e5ab){if(_0x49e5ab){return _0x49e5ab?{'count':_0x1c46be,'rows':_0x49e5ab}:null;}})[_0xdbb4('0x2d')](respondWithResult(_0x297476,null))['catch'](handleError(_0x297476,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 1e7b120..6b0440d 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 _0x1111=['hook','exports','events','SmsQueue','save','emit'];(function(_0x2c4776,_0x2fa2d9){var _0xfbb9df=function(_0x5a2098){while(--_0x5a2098){_0x2c4776['push'](_0x2c4776['shift']());}};_0xfbb9df(++_0x2fa2d9);}(_0x1111,0xb0));var _0x1111=function(_0x411f78,_0x59e966){_0x411f78=_0x411f78-0x0;var _0x274d13=_0x1111[_0x411f78];return _0x274d13;};'use strict';var EventEmitter=require(_0x1111('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x1111('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1111('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x59ece3){return function(_0x2af248,_0xf0ffa2,_0x532c74){SmsQueueEvents[_0x1111('0x3')](_0x59ece3+':'+_0x2af248['id'],_0x2af248);SmsQueueEvents[_0x1111('0x3')](_0x59ece3,_0x2af248);_0x532c74(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x1111('0x4')](e,emitEvent(event));}}module[_0x1111('0x5')]=SmsQueueEvents; \ No newline at end of file +var _0x7b59=['save','update','remove','emit','exports','events','../../mysqldb','SmsQueue','setMaxListeners'];(function(_0x17d229,_0x265a8f){var _0x2318da=function(_0x4a9fd5){while(--_0x4a9fd5){_0x17d229['push'](_0x17d229['shift']());}};_0x2318da(++_0x265a8f);}(_0x7b59,0xb0));var _0x97b5=function(_0x4193ef,_0x1df925){_0x4193ef=_0x4193ef-0x0;var _0x1aab60=_0x7b59[_0x4193ef];return _0x1aab60;};'use strict';var EventEmitter=require(_0x97b5('0x0'));var SmsQueue=require(_0x97b5('0x1'))['db'][_0x97b5('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x97b5('0x3')](0x0);var events={'afterCreate':_0x97b5('0x4'),'afterUpdate':_0x97b5('0x5'),'afterDestroy':_0x97b5('0x6')};function emitEvent(_0x32bf61){return function(_0x73e584,_0x588b6f,_0x59f88e){SmsQueueEvents[_0x97b5('0x7')](_0x32bf61+':'+_0x73e584['id'],_0x73e584);SmsQueueEvents['emit'](_0x32bf61,_0x73e584);_0x59f88e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x97b5('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 122bdb7..6142e22 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 _0x9dd8=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsQueue.attributes','exports','lodash','util'];(function(_0x409090,_0x229646){var _0x36386e=function(_0x4bc60f){while(--_0x4bc60f){_0x409090['push'](_0x409090['shift']());}};_0x36386e(++_0x229646);}(_0x9dd8,0x106));var _0x89dd=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x9dd8[_0x2d34d6];return _0x1d3d12;};'use strict';var _=require(_0x89dd('0x0'));var util=require(_0x89dd('0x1'));var logger=require(_0x89dd('0x2'))(_0x89dd('0x3'));var moment=require(_0x89dd('0x4'));var BPromise=require(_0x89dd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x89dd('0x6'));var rimraf=require(_0x89dd('0x7'));var config=require(_0x89dd('0x8'));var attributes=require(_0x89dd('0x9'));module[_0x89dd('0xa')]=function(_0x35505d,_0x58540e){return _0x35505d['define']('SmsQueue',attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc589=['lodash','util','../../config/logger','api','bluebird','path','rimraf','exports','define','sms_queues'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xc589,0xd2));var _0x9c58=function(_0x1254d9,_0x48a6eb){_0x1254d9=_0x1254d9-0x0;var _0x51e934=_0xc589[_0x1254d9];return _0x51e934;};'use strict';var _=require(_0x9c58('0x0'));var util=require(_0x9c58('0x1'));var logger=require(_0x9c58('0x2'))(_0x9c58('0x3'));var moment=require('moment');var BPromise=require(_0x9c58('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c58('0x5'));var rimraf=require(_0x9c58('0x6'));var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0x9c58('0x7')]=function(_0x53e168,_0x1aa0b5){return _0x53e168[_0x9c58('0x8')]('SmsQueue',attributes,{'tableName':_0x9c58('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 2d7ac15..4e0d9fb 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 _0x17c4=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','request','then','info','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','result','GetSmsQueue','findAll','options','where','attributes','limit','include','map','model','debug','catch','ShowSmsQueue','SmsQueue','lodash','util'];(function(_0x1463e3,_0x2d2703){var _0x15ca0a=function(_0x34c792){while(--_0x34c792){_0x1463e3['push'](_0x1463e3['shift']());}};_0x15ca0a(++_0x2d2703);}(_0x17c4,0x1ec));var _0x417c=function(_0x39834d,_0x4fa4c8){_0x39834d=_0x39834d-0x0;var _0x336d1c=_0x17c4[_0x39834d];return _0x336d1c;};'use strict';var _=require(_0x417c('0x0'));var util=require(_0x417c('0x1'));var moment=require('moment');var BPromise=require(_0x417c('0x2'));var rs=require(_0x417c('0x3'));var fs=require('fs');var Redis=require(_0x417c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x417c('0x5'));var logger=require(_0x417c('0x6'))('rpc');var config=require(_0x417c('0x7'));var jayson=require(_0x417c('0x8'));var client=jayson['client'][_0x417c('0x9')]({'port':0x232a});config[_0x417c('0xa')]=_[_0x417c('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x417c('0xc'))(new Redis(config[_0x417c('0xa')]));require('./smsQueue.socket')[_0x417c('0xd')](socket);function respondWithRpcPromise(_0x5348f3,_0x297a45,_0x185d5e){return new BPromise(function(_0x172c80,_0x51730c){return client[_0x417c('0xe')](_0x5348f3,_0x185d5e)[_0x417c('0xf')](function(_0x112c8c){logger[_0x417c('0x10')]('SmsQueue,\x20%s,\x20%s',_0x297a45,_0x417c('0x11'));logger['debug'](_0x417c('0x12'),_0x297a45,_0x417c('0x11'),JSON[_0x417c('0x13')](_0x112c8c));if(_0x112c8c['error']){if(_0x112c8c[_0x417c('0x14')][_0x417c('0x15')]===0x1f4){logger[_0x417c('0x14')](_0x417c('0x16'),_0x297a45,_0x112c8c[_0x417c('0x14')][_0x417c('0x17')]);return _0x51730c(_0x112c8c[_0x417c('0x14')][_0x417c('0x17')]);}logger[_0x417c('0x14')](_0x417c('0x16'),_0x297a45,_0x112c8c[_0x417c('0x14')][_0x417c('0x17')]);return _0x172c80(_0x112c8c[_0x417c('0x14')][_0x417c('0x17')]);}else{logger[_0x417c('0x10')](_0x417c('0x16'),_0x297a45,_0x417c('0x11'));_0x172c80(_0x112c8c[_0x417c('0x18')]['message']);}})['catch'](function(_0x5c1c2f){logger[_0x417c('0x14')](_0x417c('0x16'),_0x297a45,_0x5c1c2f);_0x51730c(_0x5c1c2f);});});}exports[_0x417c('0x19')]=function(_0x4cbea5){var _0x44bedf=this;return new Promise(function(_0x32479a,_0x51ee63){return db['SmsQueue'][_0x417c('0x1a')]({'raw':_0x4cbea5[_0x417c('0x1b')]?_0x4cbea5[_0x417c('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4cbea5[_0x417c('0x1b')]?_0x4cbea5[_0x417c('0x1b')][_0x417c('0x1c')]||null:null,'attributes':_0x4cbea5[_0x417c('0x1b')]?_0x4cbea5[_0x417c('0x1b')][_0x417c('0x1d')]||null:null,'limit':_0x4cbea5['options']?_0x4cbea5[_0x417c('0x1b')][_0x417c('0x1e')]||null:null,'include':_0x4cbea5['options']?_0x4cbea5[_0x417c('0x1b')][_0x417c('0x1f')]?_[_0x417c('0x20')](_0x4cbea5[_0x417c('0x1b')][_0x417c('0x1f')],function(_0x5a50a8){return{'model':db[_0x5a50a8[_0x417c('0x21')]],'as':_0x5a50a8['as'],'attributes':_0x5a50a8[_0x417c('0x1d')],'include':_0x5a50a8['include']?_['map'](_0x5a50a8[_0x417c('0x1f')],function(_0x26f4a8){return{'model':db[_0x26f4a8[_0x417c('0x21')]],'as':_0x26f4a8['as'],'attributes':_0x26f4a8[_0x417c('0x1d')],'include':_0x26f4a8[_0x417c('0x1f')]?_[_0x417c('0x20')](_0x26f4a8[_0x417c('0x1f')],function(_0x567e1b){return{'model':db[_0x567e1b['model']],'as':_0x567e1b['as'],'attributes':_0x567e1b['attributes']};}):[]};}):[]};}):[]:[]})[_0x417c('0xf')](function(_0x278d4c){logger[_0x417c('0x10')](_0x417c('0x19'),_0x4cbea5);logger[_0x417c('0x22')](_0x417c('0x19'),_0x4cbea5,JSON[_0x417c('0x13')](_0x278d4c));_0x32479a(_0x278d4c);})[_0x417c('0x23')](function(_0x517271){logger[_0x417c('0x14')](_0x417c('0x19'),_0x517271[_0x417c('0x17')],_0x4cbea5);_0x51ee63(_0x44bedf[_0x417c('0x14')](0x1f4,_0x517271[_0x417c('0x17')]));});});};exports[_0x417c('0x24')]=function(_0x493501){var _0x1d9992=this;return new Promise(function(_0x50e168,_0x34a454){return db[_0x417c('0x25')]['find']({'raw':_0x493501[_0x417c('0x1b')]?_0x493501['options']['raw']===undefined?!![]:![]:!![],'where':_0x493501['options']?_0x493501[_0x417c('0x1b')]['where']||null:null,'attributes':_0x493501[_0x417c('0x1b')]?_0x493501[_0x417c('0x1b')][_0x417c('0x1d')]||null:null,'include':_0x493501[_0x417c('0x1b')]?_0x493501[_0x417c('0x1b')][_0x417c('0x1f')]?_['map'](_0x493501['options'][_0x417c('0x1f')],function(_0x20d5cc){return{'model':db[_0x20d5cc[_0x417c('0x21')]],'as':_0x20d5cc['as'],'attributes':_0x20d5cc[_0x417c('0x1d')],'include':_0x20d5cc[_0x417c('0x1f')]?_['map'](_0x20d5cc[_0x417c('0x1f')],function(_0x38d167){return{'model':db[_0x38d167[_0x417c('0x21')]],'as':_0x38d167['as'],'attributes':_0x38d167[_0x417c('0x1d')],'include':_0x38d167[_0x417c('0x1f')]?_[_0x417c('0x20')](_0x38d167[_0x417c('0x1f')],function(_0x4597de){return{'model':db[_0x4597de[_0x417c('0x21')]],'as':_0x4597de['as'],'attributes':_0x4597de['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x16bb3e){logger[_0x417c('0x10')](_0x417c('0x24'),_0x493501);logger['debug']('ShowSmsQueue',_0x493501,JSON[_0x417c('0x13')](_0x16bb3e));_0x50e168(_0x16bb3e);})['catch'](function(_0x563c6c){logger[_0x417c('0x14')](_0x417c('0x24'),_0x563c6c[_0x417c('0x17')],_0x493501);_0x34a454(_0x1d9992[_0x417c('0x14')](0x1f4,_0x563c6c[_0x417c('0x17')]));});});}; \ No newline at end of file +var _0x2c38=['GetSmsQueue','findAll','options','raw','where','limit','include','map','model','attributes','ShowSmsQueue','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','register','request','then','info','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SmsQueue,\x20%s,\x20%s','message','result','catch'];(function(_0x40c091,_0x223f24){var _0x51ff31=function(_0x320bdd){while(--_0x320bdd){_0x40c091['push'](_0x40c091['shift']());}};_0x51ff31(++_0x223f24);}(_0x2c38,0x146));var _0x82c3=function(_0x603220,_0x3428a9){_0x603220=_0x603220-0x0;var _0x135f2e=_0x2c38[_0x603220];return _0x135f2e;};'use strict';var _=require(_0x82c3('0x0'));var util=require(_0x82c3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x82c3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x82c3('0x3'))['db'];var utils=require(_0x82c3('0x4'));var logger=require('../../config/logger')(_0x82c3('0x5'));var config=require(_0x82c3('0x6'));var jayson=require(_0x82c3('0x7'));var client=jayson['client'][_0x82c3('0x8')]({'port':0x232a});config[_0x82c3('0x9')]=_['defaults'](config[_0x82c3('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x82c3('0xa'))(new Redis(config['redis']));require('./smsQueue.socket')[_0x82c3('0xb')](socket);function respondWithRpcPromise(_0xfeb67b,_0x104cff,_0x1d110f){return new BPromise(function(_0x1fc3b7,_0x247ac3){return client[_0x82c3('0xc')](_0xfeb67b,_0x1d110f)[_0x82c3('0xd')](function(_0x542238){logger[_0x82c3('0xe')]('SmsQueue,\x20%s,\x20%s',_0x104cff,'request\x20sent');logger[_0x82c3('0xf')](_0x82c3('0x10'),_0x104cff,_0x82c3('0x11'),JSON[_0x82c3('0x12')](_0x542238));if(_0x542238[_0x82c3('0x13')]){if(_0x542238[_0x82c3('0x13')]['code']===0x1f4){logger[_0x82c3('0x13')](_0x82c3('0x14'),_0x104cff,_0x542238[_0x82c3('0x13')][_0x82c3('0x15')]);return _0x247ac3(_0x542238[_0x82c3('0x13')][_0x82c3('0x15')]);}logger['error'](_0x82c3('0x14'),_0x104cff,_0x542238['error'][_0x82c3('0x15')]);return _0x1fc3b7(_0x542238[_0x82c3('0x13')][_0x82c3('0x15')]);}else{logger['info'](_0x82c3('0x14'),_0x104cff,_0x82c3('0x11'));_0x1fc3b7(_0x542238[_0x82c3('0x16')]['message']);}})[_0x82c3('0x17')](function(_0x47048d){logger['error']('SmsQueue,\x20%s,\x20%s',_0x104cff,_0x47048d);_0x247ac3(_0x47048d);});});}exports[_0x82c3('0x18')]=function(_0x16dfaf){var _0x3da85d=this;return new Promise(function(_0x8960c7,_0x3bd7e9){return db['SmsQueue'][_0x82c3('0x19')]({'raw':_0x16dfaf[_0x82c3('0x1a')]?_0x16dfaf[_0x82c3('0x1a')][_0x82c3('0x1b')]===undefined?!![]:![]:!![],'where':_0x16dfaf['options']?_0x16dfaf[_0x82c3('0x1a')][_0x82c3('0x1c')]||null:null,'attributes':_0x16dfaf[_0x82c3('0x1a')]?_0x16dfaf[_0x82c3('0x1a')]['attributes']||null:null,'limit':_0x16dfaf[_0x82c3('0x1a')]?_0x16dfaf[_0x82c3('0x1a')][_0x82c3('0x1d')]||null:null,'include':_0x16dfaf[_0x82c3('0x1a')]?_0x16dfaf['options'][_0x82c3('0x1e')]?_[_0x82c3('0x1f')](_0x16dfaf['options']['include'],function(_0x5ef2ce){return{'model':db[_0x5ef2ce[_0x82c3('0x20')]],'as':_0x5ef2ce['as'],'attributes':_0x5ef2ce[_0x82c3('0x21')],'include':_0x5ef2ce[_0x82c3('0x1e')]?_[_0x82c3('0x1f')](_0x5ef2ce['include'],function(_0x1e6996){return{'model':db[_0x1e6996[_0x82c3('0x20')]],'as':_0x1e6996['as'],'attributes':_0x1e6996[_0x82c3('0x21')],'include':_0x1e6996[_0x82c3('0x1e')]?_['map'](_0x1e6996['include'],function(_0xf1b25){return{'model':db[_0xf1b25[_0x82c3('0x20')]],'as':_0xf1b25['as'],'attributes':_0xf1b25['attributes']};}):[]};}):[]};}):[]:[]})[_0x82c3('0xd')](function(_0x4cc6b4){logger['info'](_0x82c3('0x18'),_0x16dfaf);logger['debug']('GetSmsQueue',_0x16dfaf,JSON[_0x82c3('0x12')](_0x4cc6b4));_0x8960c7(_0x4cc6b4);})[_0x82c3('0x17')](function(_0x35c890){logger[_0x82c3('0x13')](_0x82c3('0x18'),_0x35c890[_0x82c3('0x15')],_0x16dfaf);_0x3bd7e9(_0x3da85d[_0x82c3('0x13')](0x1f4,_0x35c890[_0x82c3('0x15')]));});});};exports[_0x82c3('0x22')]=function(_0x276ccb){var _0x1d456e=this;return new Promise(function(_0x59d18f,_0x1376eb){return db['SmsQueue']['find']({'raw':_0x276ccb[_0x82c3('0x1a')]?_0x276ccb[_0x82c3('0x1a')][_0x82c3('0x1b')]===undefined?!![]:![]:!![],'where':_0x276ccb[_0x82c3('0x1a')]?_0x276ccb[_0x82c3('0x1a')][_0x82c3('0x1c')]||null:null,'attributes':_0x276ccb[_0x82c3('0x1a')]?_0x276ccb[_0x82c3('0x1a')][_0x82c3('0x21')]||null:null,'include':_0x276ccb['options']?_0x276ccb[_0x82c3('0x1a')]['include']?_['map'](_0x276ccb['options'][_0x82c3('0x1e')],function(_0x2ce0e9){return{'model':db[_0x2ce0e9['model']],'as':_0x2ce0e9['as'],'attributes':_0x2ce0e9[_0x82c3('0x21')],'include':_0x2ce0e9[_0x82c3('0x1e')]?_[_0x82c3('0x1f')](_0x2ce0e9[_0x82c3('0x1e')],function(_0x16418f){return{'model':db[_0x16418f[_0x82c3('0x20')]],'as':_0x16418f['as'],'attributes':_0x16418f[_0x82c3('0x21')],'include':_0x16418f[_0x82c3('0x1e')]?_[_0x82c3('0x1f')](_0x16418f['include'],function(_0x54f0da){return{'model':db[_0x54f0da['model']],'as':_0x54f0da['as'],'attributes':_0x54f0da[_0x82c3('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f47c4){logger[_0x82c3('0xe')](_0x82c3('0x22'),_0x276ccb);logger[_0x82c3('0xf')]('ShowSmsQueue',_0x276ccb,JSON[_0x82c3('0x12')](_0x1f47c4));_0x59d18f(_0x1f47c4);})[_0x82c3('0x17')](function(_0x187160){logger[_0x82c3('0x13')](_0x82c3('0x22'),_0x187160[_0x82c3('0x15')],_0x276ccb);_0x1376eb(_0x1d456e[_0x82c3('0x13')](0x1f4,_0x187160['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 701f2e5..65e6a13 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 _0xd948=['register','length','./smsQueue.events','remove','update','emit','removeListener'];(function(_0x37914d,_0x4209c0){var _0x2b4118=function(_0x10de2){while(--_0x10de2){_0x37914d['push'](_0x37914d['shift']());}};_0x2b4118(++_0x4209c0);}(_0xd948,0xb1));var _0x8d94=function(_0x246235,_0x26a40f){_0x246235=_0x246235-0x0;var _0x58e3ed=_0xd948[_0x246235];return _0x58e3ed;};'use strict';var SmsQueueEvents=require(_0x8d94('0x0'));var events=['save',_0x8d94('0x1'),_0x8d94('0x2')];function createListener(_0x36fc61,_0x24118f){return function(_0x573ae2){_0x24118f[_0x8d94('0x3')](_0x36fc61,_0x573ae2);};}function removeListener(_0x4aa471,_0x189f90){return function(){SmsQueueEvents[_0x8d94('0x4')](_0x4aa471,_0x189f90);};}exports[_0x8d94('0x5')]=function(_0x3eba0a){for(var _0x50dd99=0x0,_0x178cf3=events[_0x8d94('0x6')];_0x50dd99<_0x178cf3;_0x50dd99++){var _0x47accf=events[_0x50dd99];var _0x51fe71=createListener('smsQueue:'+_0x47accf,_0x3eba0a);SmsQueueEvents['on'](_0x47accf,_0x51fe71);}}; \ No newline at end of file +var _0x7676=['./smsQueue.events','save','update','emit','removeListener','register'];(function(_0x1b8dd3,_0x3b04d7){var _0x1ffb13=function(_0x3d3cc0){while(--_0x3d3cc0){_0x1b8dd3['push'](_0x1b8dd3['shift']());}};_0x1ffb13(++_0x3b04d7);}(_0x7676,0x1e0));var _0x6767=function(_0x22675f,_0x422038){_0x22675f=_0x22675f-0x0;var _0x563a09=_0x7676[_0x22675f];return _0x563a09;};'use strict';var SmsQueueEvents=require(_0x6767('0x0'));var events=[_0x6767('0x1'),'remove',_0x6767('0x2')];function createListener(_0x3c07a5,_0x2b41eb){return function(_0x475986){_0x2b41eb[_0x6767('0x3')](_0x3c07a5,_0x475986);};}function removeListener(_0x25ae27,_0x356535){return function(){SmsQueueEvents[_0x6767('0x4')](_0x25ae27,_0x356535);};}exports[_0x6767('0x5')]=function(_0x2fe144){for(var _0x473e77=0x0,_0x59c726=events['length'];_0x473e77<_0x59c726;_0x473e77++){var _0x2b4cf8=events[_0x473e77];var _0x2f6d11=createListener('smsQueue:'+_0x2b4cf8,_0x2fe144);SmsQueueEvents['on'](_0x2b4cf8,_0x2f6d11);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index c5c3d87..0a6ae1e 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 _0xede7=['../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','isAuthenticated','describe','/:id','show','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x2aa16c,_0x228266){var _0x59d251=function(_0x1ec998){while(--_0x1ec998){_0x2aa16c['push'](_0x2aa16c['shift']());}};_0x59d251(++_0x228266);}(_0xede7,0xcc));var _0x7ede=function(_0x49fffd,_0x534844){_0x49fffd=_0x49fffd-0x0;var _0x4c90ed=_0xede7[_0x49fffd];return _0x4c90ed;};'use strict';var multer=require(_0x7ede('0x0'));var util=require('util');var path=require(_0x7ede('0x1'));var timeout=require(_0x7ede('0x2'));var express=require(_0x7ede('0x3'));var router=express[_0x7ede('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7ede('0x5'));var config=require(_0x7ede('0x6'));var controller=require(_0x7ede('0x7'));router[_0x7ede('0x8')]('/',auth['isAuthenticated'](),controller[_0x7ede('0x9')]);router[_0x7ede('0x8')]('/describe',auth[_0x7ede('0xa')](),controller[_0x7ede('0xb')]);router[_0x7ede('0x8')](_0x7ede('0xc'),auth[_0x7ede('0xa')](),controller[_0x7ede('0xd')]);router['post']('/',auth[_0x7ede('0xa')](),controller['create']);router[_0x7ede('0xe')](_0x7ede('0xc'),auth[_0x7ede('0xa')](),controller[_0x7ede('0xf')]);router[_0x7ede('0x10')]('/:id',auth[_0x7ede('0xa')](),controller[_0x7ede('0x11')]);module[_0x7ede('0x12')]=router; \ No newline at end of file +var _0xd90b=['connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer'];(function(_0x59104e,_0x416d05){var _0x59deb2=function(_0x56c9bb){while(--_0x56c9bb){_0x59104e['push'](_0x59104e['shift']());}};_0x59deb2(++_0x416d05);}(_0xd90b,0xbd));var _0xbd90=function(_0x5a7433,_0x3d38e7){_0x5a7433=_0x5a7433-0x0;var _0x11cba0=_0xd90b[_0x5a7433];return _0x11cba0;};'use strict';var multer=require(_0xbd90('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbd90('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbd90('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xbd90('0x3'));var config=require(_0xbd90('0x4'));var controller=require(_0xbd90('0x5'));router[_0xbd90('0x6')]('/',auth[_0xbd90('0x7')](),controller[_0xbd90('0x8')]);router['get'](_0xbd90('0x9'),auth[_0xbd90('0x7')](),controller[_0xbd90('0xa')]);router[_0xbd90('0x6')](_0xbd90('0xb'),auth[_0xbd90('0x7')](),controller[_0xbd90('0xc')]);router[_0xbd90('0xd')]('/',auth[_0xbd90('0x7')](),controller[_0xbd90('0xe')]);router[_0xbd90('0xf')]('/:id',auth[_0xbd90('0x7')](),controller[_0xbd90('0x10')]);router['delete']('/:id',auth[_0xbd90('0x7')](),controller[_0xbd90('0x11')]);module[_0xbd90('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index a1c5d26..05955c9 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 _0xef4b=['sequelize','DATE'];(function(_0x38b31a,_0x155285){var _0x3da938=function(_0x8b8a0e){while(--_0x8b8a0e){_0x38b31a['push'](_0x38b31a['shift']());}};_0x3da938(++_0x155285);}(_0xef4b,0x86));var _0xbef4=function(_0x43d0e6,_0x3c1489){_0x43d0e6=_0x43d0e6-0x0;var _0x51d841=_0xef4b[_0x43d0e6];return _0x51d841;};'use strict';var moment=require('moment');var Sequelize=require(_0xbef4('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xbef4('0x1')]},'acceptAt':{'type':Sequelize[_0xbef4('0x1')]},'exitAt':{'type':Sequelize[_0xbef4('0x1')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x64d0=['sequelize','exports','STRING','DATE','moment'];(function(_0x2197bb,_0x2d7033){var _0x255158=function(_0x45dcbb){while(--_0x45dcbb){_0x2197bb['push'](_0x2197bb['shift']());}};_0x255158(++_0x2d7033);}(_0x64d0,0x171));var _0x064d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x64d0[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x064d('0x0'));var Sequelize=require(_0x064d('0x1'));module[_0x064d('0x2')]={'uniqueid':{'type':Sequelize[_0x064d('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x064d('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x064d('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x064d('0x4')]},'reason':{'type':Sequelize[_0x064d('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index b9f784d..92f8019 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 _0x97cb=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','SmsQueueReport','rawAttributes','fieldName','type','map','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','show','length','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x1480ab,_0x219a96){var _0x3ac72f=function(_0x5923c8){while(--_0x5923c8){_0x1480ab['push'](_0x1480ab['shift']());}};_0x3ac72f(++_0x219a96);}(_0x97cb,0x125));var _0xb97c=function(_0x19c60e,_0x5f31a5){_0x19c60e=_0x19c60e-0x0;var _0x476274=_0x97cb[_0x19c60e];return _0x476274;};'use strict';var emlformat=require(_0xb97c('0x0'));var rimraf=require(_0xb97c('0x1'));var zipdir=require(_0xb97c('0x2'));var jsonpatch=require(_0xb97c('0x3'));var rp=require('request-promise');var moment=require(_0xb97c('0x4'));var BPromise=require(_0xb97c('0x5'));var Mustache=require(_0xb97c('0x6'));var util=require('util');var path=require(_0xb97c('0x7'));var sox=require(_0xb97c('0x8'));var csv=require(_0xb97c('0x9'));var ejs=require(_0xb97c('0xa'));var fs=require('fs');var fs_extra=require(_0xb97c('0xb'));var _=require(_0xb97c('0xc'));var squel=require(_0xb97c('0xd'));var crypto=require(_0xb97c('0xe'));var jsforce=require(_0xb97c('0xf'));var deskjs=require(_0xb97c('0x10'));var toCsv=require(_0xb97c('0x9'));var querystring=require('querystring');var Papa=require(_0xb97c('0x11'));var Redis=require(_0xb97c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb97c('0x13'));var as=require(_0xb97c('0x14'));var hardwareService=require(_0xb97c('0x15'));var logger=require(_0xb97c('0x16'))(_0xb97c('0x17'));var utils=require(_0xb97c('0x18'));var config=require(_0xb97c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xb97c('0x1a'))['db'];function respondWithStatusCode(_0x1f61b3,_0x468d43){_0x468d43=_0x468d43||0xcc;return function(_0x5b2f22){if(_0x5b2f22){return _0x1f61b3[_0xb97c('0x1b')](_0x468d43);}return _0x1f61b3[_0xb97c('0x1c')](_0x468d43)[_0xb97c('0x1d')]();};}function respondWithResult(_0x559ff8,_0x46dc44){_0x46dc44=_0x46dc44||0xc8;return function(_0x1a0de3){if(_0x1a0de3){return _0x559ff8[_0xb97c('0x1c')](_0x46dc44)[_0xb97c('0x1e')](_0x1a0de3);}};}function respondWithFilteredResult(_0x12d214,_0x29e2a4){return function(_0x1f8839){if(_0x1f8839){var _0xa6606d=typeof _0x29e2a4['offset']===_0xb97c('0x1f')&&typeof _0x29e2a4['limit']===_0xb97c('0x1f');var _0x448fcd=_0x1f8839[_0xb97c('0x20')];var _0x1de949=_0xa6606d?0x0:_0x29e2a4[_0xb97c('0x21')];var _0x443e92=_0xa6606d?_0x1f8839[_0xb97c('0x20')]:_0x29e2a4[_0xb97c('0x21')]+_0x29e2a4[_0xb97c('0x22')];var _0x376659;if(_0x443e92>=_0x448fcd){_0x443e92=_0x448fcd;_0x376659=0xc8;}else{_0x376659=0xce;}_0x12d214[_0xb97c('0x1c')](_0x376659);return _0x12d214[_0xb97c('0x23')](_0xb97c('0x24'),_0x1de949+'-'+_0x443e92+'/'+_0x448fcd)['json'](_0x1f8839);}return null;};}function patchUpdates(_0x363152){return function(_0xcdb787){try{jsonpatch[_0xb97c('0x25')](_0xcdb787,_0x363152,!![]);}catch(_0xd13aa8){return BPromise['reject'](_0xd13aa8);}return _0xcdb787[_0xb97c('0x26')]();};}function saveUpdates(_0x6876cc,_0x26c5ab){return function(_0x369fcd){if(_0x369fcd){return _0x369fcd[_0xb97c('0x27')](_0x6876cc)['then'](function(_0x4194d1){return _0x4194d1;});}return null;};}function removeEntity(_0x527f66,_0x108745){return function(_0x15eaf5){if(_0x15eaf5){return _0x15eaf5[_0xb97c('0x28')]()[_0xb97c('0x29')](function(){_0x527f66[_0xb97c('0x1c')](0xcc)[_0xb97c('0x1d')]();});}};}function handleEntityNotFound(_0x3fda7a,_0x245787){return function(_0x4b1226){if(!_0x4b1226){_0x3fda7a[_0xb97c('0x1b')](0x194);}return _0x4b1226;};}function handleError(_0x1733fd,_0x1ee31d){_0x1ee31d=_0x1ee31d||0x1f4;return function(_0x1b4512){logger[_0xb97c('0x2a')](_0x1b4512[_0xb97c('0x2b')]);if(_0x1b4512[_0xb97c('0x2c')]){delete _0x1b4512[_0xb97c('0x2c')];}_0x1733fd[_0xb97c('0x1c')](_0x1ee31d)[_0xb97c('0x2d')](_0x1b4512);};}exports['index']=function(_0x92c0b4,_0x2509a3){var _0x112642={},_0xaa7de3={},_0x2c0cdd={'count':0x0,'rows':[]};var _0x3233d8=_['map'](db[_0xb97c('0x2e')][_0xb97c('0x2f')],function(_0x17e365){return{'name':_0x17e365[_0xb97c('0x30')],'type':_0x17e365[_0xb97c('0x31')]['key']};});_0xaa7de3['model']=_[_0xb97c('0x32')](_0x3233d8,_0xb97c('0x2c'));_0xaa7de3['query']=_[_0xb97c('0x33')](_0x92c0b4[_0xb97c('0x34')]);_0xaa7de3[_0xb97c('0x35')]=_[_0xb97c('0x36')](_0xaa7de3[_0xb97c('0x37')],_0xaa7de3[_0xb97c('0x34')]);_0x112642['attributes']=_[_0xb97c('0x36')](_0xaa7de3[_0xb97c('0x37')],qs[_0xb97c('0x38')](_0x92c0b4[_0xb97c('0x34')][_0xb97c('0x38')]));_0x112642['attributes']=_0x112642[_0xb97c('0x39')]['length']?_0x112642['attributes']:_0xaa7de3[_0xb97c('0x37')];if(!_0x92c0b4[_0xb97c('0x34')][_0xb97c('0x3a')](_0xb97c('0x3b'))){_0x112642[_0xb97c('0x22')]=qs['limit'](_0x92c0b4[_0xb97c('0x34')][_0xb97c('0x22')]);_0x112642[_0xb97c('0x21')]=qs[_0xb97c('0x21')](_0x92c0b4['query'][_0xb97c('0x21')]);}_0x112642[_0xb97c('0x3c')]=qs['sort'](_0x92c0b4[_0xb97c('0x34')][_0xb97c('0x3d')]);_0x112642[_0xb97c('0x3e')]=qs[_0xb97c('0x35')](_[_0xb97c('0x3f')](_0x92c0b4[_0xb97c('0x34')],_0xaa7de3[_0xb97c('0x35')]),_0x3233d8);if(_0x92c0b4[_0xb97c('0x34')]['filter']){_0x112642['where']=_[_0xb97c('0x40')](_0x112642[_0xb97c('0x3e')],{'$or':_[_0xb97c('0x32')](_0x3233d8,function(_0x21adda){if(_0x21adda[_0xb97c('0x31')]!==_0xb97c('0x41')){var _0x5a1956={};_0x5a1956[_0x21adda[_0xb97c('0x2c')]]={'$like':'%'+_0x92c0b4[_0xb97c('0x34')][_0xb97c('0x42')]+'%'};return _0x5a1956;}})});}_0x112642=_[_0xb97c('0x40')]({},_0x112642,_0x92c0b4[_0xb97c('0x43')]);var _0x25f449={'where':_0x112642['where']};return db[_0xb97c('0x2e')]['count'](_0x25f449)[_0xb97c('0x29')](function(_0xb7adcd){_0x2c0cdd[_0xb97c('0x20')]=_0xb7adcd;if(_0x92c0b4[_0xb97c('0x34')][_0xb97c('0x44')]){_0x112642['include']=[{'all':!![]}];}return db[_0xb97c('0x2e')]['findAll'](_0x112642);})[_0xb97c('0x29')](function(_0x225364){_0x2c0cdd[_0xb97c('0x45')]=_0x225364;return _0x2c0cdd;})[_0xb97c('0x29')](respondWithFilteredResult(_0x2509a3,_0x112642))['catch'](handleError(_0x2509a3,null));};exports[_0xb97c('0x46')]=function(_0x3b32bf,_0x49488c){var _0x49e9da={'raw':!![],'where':{'id':_0x3b32bf['params']['id']}},_0x56d5e9={};_0x56d5e9[_0xb97c('0x37')]=_[_0xb97c('0x33')](db['SmsQueueReport'][_0xb97c('0x2f')]);_0x56d5e9[_0xb97c('0x34')]=_[_0xb97c('0x33')](_0x3b32bf[_0xb97c('0x34')]);_0x56d5e9[_0xb97c('0x35')]=_['intersection'](_0x56d5e9[_0xb97c('0x37')],_0x56d5e9[_0xb97c('0x34')]);_0x49e9da[_0xb97c('0x39')]=_[_0xb97c('0x36')](_0x56d5e9['model'],qs[_0xb97c('0x38')](_0x3b32bf['query'][_0xb97c('0x38')]));_0x49e9da[_0xb97c('0x39')]=_0x49e9da[_0xb97c('0x39')][_0xb97c('0x47')]?_0x49e9da['attributes']:_0x56d5e9['model'];if(_0x3b32bf['query'][_0xb97c('0x44')]){_0x49e9da['include']=[{'all':!![]}];}_0x49e9da=_['merge']({},_0x49e9da,_0x3b32bf['options']);return db[_0xb97c('0x2e')]['find'](_0x49e9da)[_0xb97c('0x29')](handleEntityNotFound(_0x49488c,null))[_0xb97c('0x29')](respondWithResult(_0x49488c,null))[_0xb97c('0x48')](handleError(_0x49488c,null));};exports[_0xb97c('0x49')]=function(_0x19368b,_0x56604c){return db[_0xb97c('0x2e')][_0xb97c('0x49')](_0x19368b[_0xb97c('0x4a')],{})[_0xb97c('0x29')](respondWithResult(_0x56604c,0xc9))[_0xb97c('0x48')](handleError(_0x56604c,null));};exports[_0xb97c('0x27')]=function(_0x166696,_0x23384c){if(_0x166696['body']['id']){delete _0x166696['body']['id'];}return db[_0xb97c('0x2e')][_0xb97c('0x4b')]({'where':{'id':_0x166696[_0xb97c('0x4c')]['id']}})[_0xb97c('0x29')](handleEntityNotFound(_0x23384c,null))[_0xb97c('0x29')](saveUpdates(_0x166696[_0xb97c('0x4a')],null))[_0xb97c('0x29')](respondWithResult(_0x23384c,null))[_0xb97c('0x48')](handleError(_0x23384c,null));};exports[_0xb97c('0x28')]=function(_0x30e0a5,_0x5eb670){return db[_0xb97c('0x2e')]['find']({'where':{'id':_0x30e0a5[_0xb97c('0x4c')]['id']}})[_0xb97c('0x29')](handleEntityNotFound(_0x5eb670,null))[_0xb97c('0x29')](removeEntity(_0x5eb670,null))[_0xb97c('0x48')](handleError(_0x5eb670,null));};exports[_0xb97c('0x4d')]=function(_0x1c7ced,_0x518316){return db[_0xb97c('0x2e')][_0xb97c('0x4d')]()[_0xb97c('0x29')](respondWithResult(_0x518316,null))[_0xb97c('0x48')](handleError(_0x518316,null));}; \ No newline at end of file +var _0x80b1=['then','destroy','error','name','send','map','SmsQueueReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','find','create','update','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','apply','save'];(function(_0x3eb36c,_0x190bd0){var _0x429a15=function(_0x890841){while(--_0x890841){_0x3eb36c['push'](_0x3eb36c['shift']());}};_0x429a15(++_0x190bd0);}(_0x80b1,0x146));var _0x180b=function(_0x1adda4,_0x537884){_0x1adda4=_0x1adda4-0x0;var _0x4f9025=_0x80b1[_0x1adda4];return _0x4f9025;};'use strict';var emlformat=require(_0x180b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x180b('0x1'));var rp=require(_0x180b('0x2'));var moment=require(_0x180b('0x3'));var BPromise=require(_0x180b('0x4'));var Mustache=require(_0x180b('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x180b('0x6'));var ejs=require(_0x180b('0x7'));var fs=require('fs');var fs_extra=require(_0x180b('0x8'));var _=require(_0x180b('0x9'));var squel=require(_0x180b('0xa'));var crypto=require(_0x180b('0xb'));var jsforce=require(_0x180b('0xc'));var deskjs=require(_0x180b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x180b('0xe'));var Papa=require(_0x180b('0xf'));var Redis=require(_0x180b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x180b('0x11'));var as=require(_0x180b('0x12'));var hardwareService=require(_0x180b('0x13'));var logger=require(_0x180b('0x14'))(_0x180b('0x15'));var utils=require(_0x180b('0x16'));var config=require(_0x180b('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c6939,_0x1b59a7){_0x1b59a7=_0x1b59a7||0xcc;return function(_0x1bdd75){if(_0x1bdd75){return _0x5c6939[_0x180b('0x18')](_0x1b59a7);}return _0x5c6939[_0x180b('0x19')](_0x1b59a7)[_0x180b('0x1a')]();};}function respondWithResult(_0x5026da,_0x312883){_0x312883=_0x312883||0xc8;return function(_0x5014a3){if(_0x5014a3){return _0x5026da[_0x180b('0x19')](_0x312883)[_0x180b('0x1b')](_0x5014a3);}};}function respondWithFilteredResult(_0x1aa6d4,_0x5c989c){return function(_0x1434e8){if(_0x1434e8){var _0x580d73=typeof _0x5c989c[_0x180b('0x1c')]===_0x180b('0x1d')&&typeof _0x5c989c[_0x180b('0x1e')]===_0x180b('0x1d');var _0x3abecd=_0x1434e8[_0x180b('0x1f')];var _0x45f620=_0x580d73?0x0:_0x5c989c[_0x180b('0x1c')];var _0x3bd2e6=_0x580d73?_0x1434e8['count']:_0x5c989c[_0x180b('0x1c')]+_0x5c989c[_0x180b('0x1e')];var _0x284163;if(_0x3bd2e6>=_0x3abecd){_0x3bd2e6=_0x3abecd;_0x284163=0xc8;}else{_0x284163=0xce;}_0x1aa6d4[_0x180b('0x19')](_0x284163);return _0x1aa6d4['set']('Content-Range',_0x45f620+'-'+_0x3bd2e6+'/'+_0x3abecd)['json'](_0x1434e8);}return null;};}function patchUpdates(_0x545f86){return function(_0x15caa4){try{jsonpatch[_0x180b('0x20')](_0x15caa4,_0x545f86,!![]);}catch(_0x24f5e6){return BPromise['reject'](_0x24f5e6);}return _0x15caa4[_0x180b('0x21')]();};}function saveUpdates(_0x6aa374,_0x4fd6d2){return function(_0x139d36){if(_0x139d36){return _0x139d36['update'](_0x6aa374)[_0x180b('0x22')](function(_0x27681f){return _0x27681f;});}return null;};}function removeEntity(_0x29e3e0,_0x25d98e){return function(_0x3a7255){if(_0x3a7255){return _0x3a7255[_0x180b('0x23')]()[_0x180b('0x22')](function(){_0x29e3e0[_0x180b('0x19')](0xcc)[_0x180b('0x1a')]();});}};}function handleEntityNotFound(_0x2f722a,_0x1e3635){return function(_0x3061ba){if(!_0x3061ba){_0x2f722a[_0x180b('0x18')](0x194);}return _0x3061ba;};}function handleError(_0x112abc,_0xa6b723){_0xa6b723=_0xa6b723||0x1f4;return function(_0x114d16){logger[_0x180b('0x24')](_0x114d16['stack']);if(_0x114d16[_0x180b('0x25')]){delete _0x114d16[_0x180b('0x25')];}_0x112abc['status'](_0xa6b723)[_0x180b('0x26')](_0x114d16);};}exports['index']=function(_0x1ed270,_0x2f7f39){var _0x1f2f6b={},_0x21ba5b={},_0x4a751f={'count':0x0,'rows':[]};var _0x523973=_[_0x180b('0x27')](db[_0x180b('0x28')][_0x180b('0x29')],function(_0x47c720){return{'name':_0x47c720[_0x180b('0x2a')],'type':_0x47c720[_0x180b('0x2b')][_0x180b('0x2c')]};});_0x21ba5b['model']=_['map'](_0x523973,_0x180b('0x25'));_0x21ba5b[_0x180b('0x2d')]=_[_0x180b('0x2e')](_0x1ed270[_0x180b('0x2d')]);_0x21ba5b['filters']=_[_0x180b('0x2f')](_0x21ba5b[_0x180b('0x30')],_0x21ba5b[_0x180b('0x2d')]);_0x1f2f6b[_0x180b('0x31')]=_['intersection'](_0x21ba5b['model'],qs['fields'](_0x1ed270[_0x180b('0x2d')][_0x180b('0x32')]));_0x1f2f6b[_0x180b('0x31')]=_0x1f2f6b['attributes']['length']?_0x1f2f6b[_0x180b('0x31')]:_0x21ba5b[_0x180b('0x30')];if(!_0x1ed270[_0x180b('0x2d')]['hasOwnProperty'](_0x180b('0x33'))){_0x1f2f6b[_0x180b('0x1e')]=qs[_0x180b('0x1e')](_0x1ed270['query'][_0x180b('0x1e')]);_0x1f2f6b[_0x180b('0x1c')]=qs[_0x180b('0x1c')](_0x1ed270[_0x180b('0x2d')][_0x180b('0x1c')]);}_0x1f2f6b['order']=qs['sort'](_0x1ed270[_0x180b('0x2d')][_0x180b('0x34')]);_0x1f2f6b[_0x180b('0x35')]=qs[_0x180b('0x36')](_[_0x180b('0x37')](_0x1ed270[_0x180b('0x2d')],_0x21ba5b[_0x180b('0x36')]),_0x523973);if(_0x1ed270[_0x180b('0x2d')][_0x180b('0x38')]){_0x1f2f6b[_0x180b('0x35')]=_[_0x180b('0x39')](_0x1f2f6b['where'],{'$or':_['map'](_0x523973,function(_0x457ab4){if(_0x457ab4['type']!==_0x180b('0x3a')){var _0x31b1a3={};_0x31b1a3[_0x457ab4[_0x180b('0x25')]]={'$like':'%'+_0x1ed270['query'][_0x180b('0x38')]+'%'};return _0x31b1a3;}})});}_0x1f2f6b=_[_0x180b('0x39')]({},_0x1f2f6b,_0x1ed270[_0x180b('0x3b')]);var _0x3ce5c0={'where':_0x1f2f6b[_0x180b('0x35')]};return db['SmsQueueReport'][_0x180b('0x1f')](_0x3ce5c0)[_0x180b('0x22')](function(_0x5561eb){_0x4a751f[_0x180b('0x1f')]=_0x5561eb;if(_0x1ed270['query'][_0x180b('0x3c')]){_0x1f2f6b[_0x180b('0x3d')]=[{'all':!![]}];}return db[_0x180b('0x28')][_0x180b('0x3e')](_0x1f2f6b);})[_0x180b('0x22')](function(_0x178b15){_0x4a751f['rows']=_0x178b15;return _0x4a751f;})[_0x180b('0x22')](respondWithFilteredResult(_0x2f7f39,_0x1f2f6b))[_0x180b('0x3f')](handleError(_0x2f7f39,null));};exports[_0x180b('0x40')]=function(_0x5d11ac,_0x364acd){var _0x545bcb={'raw':!![],'where':{'id':_0x5d11ac[_0x180b('0x41')]['id']}},_0x2f2f83={};_0x2f2f83[_0x180b('0x30')]=_[_0x180b('0x2e')](db[_0x180b('0x28')][_0x180b('0x29')]);_0x2f2f83[_0x180b('0x2d')]=_[_0x180b('0x2e')](_0x5d11ac['query']);_0x2f2f83[_0x180b('0x36')]=_['intersection'](_0x2f2f83[_0x180b('0x30')],_0x2f2f83[_0x180b('0x2d')]);_0x545bcb[_0x180b('0x31')]=_[_0x180b('0x2f')](_0x2f2f83['model'],qs[_0x180b('0x32')](_0x5d11ac[_0x180b('0x2d')][_0x180b('0x32')]));_0x545bcb[_0x180b('0x31')]=_0x545bcb[_0x180b('0x31')][_0x180b('0x42')]?_0x545bcb[_0x180b('0x31')]:_0x2f2f83['model'];if(_0x5d11ac[_0x180b('0x2d')][_0x180b('0x3c')]){_0x545bcb['include']=[{'all':!![]}];}_0x545bcb=_[_0x180b('0x39')]({},_0x545bcb,_0x5d11ac[_0x180b('0x3b')]);return db[_0x180b('0x28')][_0x180b('0x43')](_0x545bcb)[_0x180b('0x22')](handleEntityNotFound(_0x364acd,null))['then'](respondWithResult(_0x364acd,null))[_0x180b('0x3f')](handleError(_0x364acd,null));};exports[_0x180b('0x44')]=function(_0x27685a,_0x5763ad){return db[_0x180b('0x28')][_0x180b('0x44')](_0x27685a['body'],{})[_0x180b('0x22')](respondWithResult(_0x5763ad,0xc9))['catch'](handleError(_0x5763ad,null));};exports[_0x180b('0x45')]=function(_0x537bd5,_0x151891){if(_0x537bd5[_0x180b('0x46')]['id']){delete _0x537bd5[_0x180b('0x46')]['id'];}return db['SmsQueueReport'][_0x180b('0x43')]({'where':{'id':_0x537bd5['params']['id']}})[_0x180b('0x22')](handleEntityNotFound(_0x151891,null))[_0x180b('0x22')](saveUpdates(_0x537bd5[_0x180b('0x46')],null))[_0x180b('0x22')](respondWithResult(_0x151891,null))[_0x180b('0x3f')](handleError(_0x151891,null));};exports[_0x180b('0x23')]=function(_0x438adb,_0x118bc8){return db['SmsQueueReport'][_0x180b('0x43')]({'where':{'id':_0x438adb[_0x180b('0x41')]['id']}})['then'](handleEntityNotFound(_0x118bc8,null))[_0x180b('0x22')](removeEntity(_0x118bc8,null))[_0x180b('0x3f')](handleError(_0x118bc8,null));};exports[_0x180b('0x47')]=function(_0x4e441e,_0x3b2a56){return db['SmsQueueReport'][_0x180b('0x47')]()['then'](respondWithResult(_0x3b2a56,null))[_0x180b('0x3f')](handleError(_0x3b2a56,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index bb3e866..0c3b1a2 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4a817e,_0xec3b79){var _0x8b5ae1=function(_0x1c5a2c){while(--_0x1c5a2c){_0x4a817e['push'](_0x4a817e['shift']());}};_0x8b5ae1(++_0xec3b79);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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 diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 1b741df..ae94495 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 _0x1448=['body','options','UpdateSmsQueueReport','update','where','limit','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create'];(function(_0x38e656,_0x21bcb0){var _0x411375=function(_0x1582c3){while(--_0x1582c3){_0x38e656['push'](_0x38e656['shift']());}};_0x411375(++_0x21bcb0);}(_0x1448,0x1c6));var _0x8144=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1448[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8144('0x0'));var BPromise=require('bluebird');var rs=require(_0x8144('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8144('0x2'))['db'];var utils=require(_0x8144('0x3'));var logger=require('../../config/logger')(_0x8144('0x4'));var config=require('../../config/environment');var jayson=require(_0x8144('0x5'));var client=jayson['client'][_0x8144('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1614de,_0x3bd8e5,_0x9a4e5a){return new BPromise(function(_0x5b2b41,_0x14d4b0){return client[_0x8144('0x7')](_0x1614de,_0x9a4e5a)[_0x8144('0x8')](function(_0x5ce362){logger[_0x8144('0x9')](_0x8144('0xa'),_0x3bd8e5,_0x8144('0xb'));logger[_0x8144('0xc')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x3bd8e5,'request\x20sent',JSON[_0x8144('0xd')](_0x5ce362));if(_0x5ce362[_0x8144('0xe')]){if(_0x5ce362[_0x8144('0xe')][_0x8144('0xf')]===0x1f4){logger[_0x8144('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x3bd8e5,_0x5ce362['error'][_0x8144('0x10')]);return _0x14d4b0(_0x5ce362['error'][_0x8144('0x10')]);}logger[_0x8144('0xe')](_0x8144('0xa'),_0x3bd8e5,_0x5ce362[_0x8144('0xe')][_0x8144('0x10')]);return _0x5b2b41(_0x5ce362[_0x8144('0xe')][_0x8144('0x10')]);}else{logger['info'](_0x8144('0xa'),_0x3bd8e5,'request\x20sent');_0x5b2b41(_0x5ce362[_0x8144('0x11')][_0x8144('0x10')]);}})[_0x8144('0x12')](function(_0x322e84){logger['error'](_0x8144('0xa'),_0x3bd8e5,_0x322e84);_0x14d4b0(_0x322e84);});});}exports[_0x8144('0x13')]=function(_0x1f2eae){var _0xfe6e06=this;return new Promise(function(_0x143a28,_0xd6ee48){return db[_0x8144('0x14')][_0x8144('0x15')](_0x1f2eae[_0x8144('0x16')],{'raw':_0x1f2eae[_0x8144('0x17')]?_0x1f2eae[_0x8144('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x8144('0x8')](function(_0x21a6c5){logger[_0x8144('0x9')](_0x8144('0x13'),_0x1f2eae);logger[_0x8144('0xc')]('CreateSmsQueueReport',_0x1f2eae,JSON[_0x8144('0xd')](_0x21a6c5));_0x143a28(_0x21a6c5);})['catch'](function(_0x1842c7){logger['error'](_0x8144('0x13'),_0x1842c7[_0x8144('0x10')],_0x1f2eae);_0xd6ee48(_0xfe6e06[_0x8144('0xe')](0x1f4,_0x1842c7[_0x8144('0x10')]));});});};exports[_0x8144('0x18')]=function(_0x3b70e3){var _0x5b99f9=this;return new Promise(function(_0x130550,_0x23b268){return db['SmsQueueReport'][_0x8144('0x19')](_0x3b70e3['body'],{'raw':_0x3b70e3['options']?_0x3b70e3[_0x8144('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b70e3[_0x8144('0x17')]?_0x3b70e3[_0x8144('0x17')][_0x8144('0x1a')]||null:null,'attributes':_0x3b70e3[_0x8144('0x17')]?_0x3b70e3[_0x8144('0x17')]['attributes']||null:null,'limit':_0x3b70e3['options']?_0x3b70e3[_0x8144('0x17')][_0x8144('0x1b')]||null:null})[_0x8144('0x8')](function(_0x363848){logger['info'](_0x8144('0x18'),_0x3b70e3);logger[_0x8144('0xc')](_0x8144('0x18'),_0x3b70e3,JSON[_0x8144('0xd')](_0x363848));_0x130550(_0x363848);})[_0x8144('0x12')](function(_0x29178a){logger[_0x8144('0xe')](_0x8144('0x18'),_0x29178a['message'],_0x3b70e3);_0x23b268(_0x5b99f9[_0x8144('0xe')](0x1f4,_0x29178a[_0x8144('0x10')]));});});}; \ No newline at end of file +var _0x1f26=['request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSmsQueueReport','create','options','raw','update','body','where','attributes','limit','UpdateSmsQueueReport','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2d5aca,_0x19beca){var _0x24ae42=function(_0x35b99c){while(--_0x35b99c){_0x2d5aca['push'](_0x2d5aca['shift']());}};_0x24ae42(++_0x19beca);}(_0x1f26,0x76));var _0x61f2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1f26[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x61f2('0x0'));var BPromise=require(_0x61f2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x61f2('0x2'));var db=require(_0x61f2('0x3'))['db'];var utils=require(_0x61f2('0x4'));var logger=require('../../config/logger')(_0x61f2('0x5'));var config=require(_0x61f2('0x6'));var jayson=require(_0x61f2('0x7'));var client=jayson[_0x61f2('0x8')][_0x61f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d3c87,_0x3699a4,_0x3337ec){return new BPromise(function(_0x324afa,_0x2f48da){return client[_0x61f2('0xa')](_0x2d3c87,_0x3337ec)[_0x61f2('0xb')](function(_0x49cccc){logger[_0x61f2('0xc')](_0x61f2('0xd'),_0x3699a4,_0x61f2('0xe'));logger[_0x61f2('0xf')](_0x61f2('0x10'),_0x3699a4,_0x61f2('0xe'),JSON[_0x61f2('0x11')](_0x49cccc));if(_0x49cccc['error']){if(_0x49cccc[_0x61f2('0x12')]['code']===0x1f4){logger[_0x61f2('0x12')](_0x61f2('0xd'),_0x3699a4,_0x49cccc[_0x61f2('0x12')][_0x61f2('0x13')]);return _0x2f48da(_0x49cccc[_0x61f2('0x12')][_0x61f2('0x13')]);}logger[_0x61f2('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x3699a4,_0x49cccc[_0x61f2('0x12')][_0x61f2('0x13')]);return _0x324afa(_0x49cccc[_0x61f2('0x12')]['message']);}else{logger[_0x61f2('0xc')](_0x61f2('0xd'),_0x3699a4,'request\x20sent');_0x324afa(_0x49cccc[_0x61f2('0x14')][_0x61f2('0x13')]);}})[_0x61f2('0x15')](function(_0x57f809){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x3699a4,_0x57f809);_0x2f48da(_0x57f809);});});}exports[_0x61f2('0x16')]=function(_0x2adfc9){var _0xb3a312=this;return new Promise(function(_0x5c0767,_0x2deb87){return db['SmsQueueReport'][_0x61f2('0x17')](_0x2adfc9['body'],{'raw':_0x2adfc9[_0x61f2('0x18')]?_0x2adfc9[_0x61f2('0x18')][_0x61f2('0x19')]===undefined?!![]:![]:!![]})[_0x61f2('0xb')](function(_0xca26e1){logger[_0x61f2('0xc')](_0x61f2('0x16'),_0x2adfc9);logger[_0x61f2('0xf')]('CreateSmsQueueReport',_0x2adfc9,JSON[_0x61f2('0x11')](_0xca26e1));_0x5c0767(_0xca26e1);})[_0x61f2('0x15')](function(_0x5c0c32){logger['error'](_0x61f2('0x16'),_0x5c0c32['message'],_0x2adfc9);_0x2deb87(_0xb3a312[_0x61f2('0x12')](0x1f4,_0x5c0c32['message']));});});};exports['UpdateSmsQueueReport']=function(_0xd88b63){var _0x23707a=this;return new Promise(function(_0x48d294,_0x29cffa){return db['SmsQueueReport'][_0x61f2('0x1a')](_0xd88b63[_0x61f2('0x1b')],{'raw':_0xd88b63[_0x61f2('0x18')]?_0xd88b63[_0x61f2('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd88b63[_0x61f2('0x18')]?_0xd88b63[_0x61f2('0x18')][_0x61f2('0x1c')]||null:null,'attributes':_0xd88b63['options']?_0xd88b63[_0x61f2('0x18')][_0x61f2('0x1d')]||null:null,'limit':_0xd88b63[_0x61f2('0x18')]?_0xd88b63[_0x61f2('0x18')][_0x61f2('0x1e')]||null:null})[_0x61f2('0xb')](function(_0x49f9f1){logger[_0x61f2('0xc')](_0x61f2('0x1f'),_0xd88b63);logger[_0x61f2('0xf')](_0x61f2('0x1f'),_0xd88b63,JSON[_0x61f2('0x11')](_0x49f9f1));_0x48d294(_0x49f9f1);})['catch'](function(_0x5c642f){logger[_0x61f2('0x12')]('UpdateSmsQueueReport',_0x5c642f['message'],_0xd88b63);_0x29cffa(_0x23707a[_0x61f2('0x12')](0x1f4,_0x5c642f[_0x61f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 5c2814c..40a6acc 100644 --- a/server/api/smsTransferReport/index.js +++ b/server/api/smsTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe015=['../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index','describe','get','/:id','show','put','update','multer','util','path','Router','../../components/auth/service'];(function(_0x5de930,_0x549653){var _0x26972c=function(_0x4dcc8f){while(--_0x4dcc8f){_0x5de930['push'](_0x5de930['shift']());}};_0x26972c(++_0x549653);}(_0xe015,0x13b));var _0x5e01=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xe015[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var path=require(_0x5e01('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5e01('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5e01('0x4'));var interaction=require(_0x5e01('0x5'));var config=require(_0x5e01('0x6'));var controller=require(_0x5e01('0x7'));router['get']('/',auth[_0x5e01('0x8')](),controller[_0x5e01('0x9')]);router['get']('/describe',auth[_0x5e01('0x8')](),controller[_0x5e01('0xa')]);router[_0x5e01('0xb')](_0x5e01('0xc'),auth[_0x5e01('0x8')](),controller[_0x5e01('0xd')]);router['post']('/',auth[_0x5e01('0x8')](),controller['create']);router[_0x5e01('0xe')]('/:id',auth[_0x5e01('0x8')](),controller[_0x5e01('0xf')]);router['delete'](_0x5e01('0xc'),auth[_0x5e01('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x84ab=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','/describe','describe','isAuthenticated','post','create','update','delete','/:id','destroy','multer'];(function(_0x4404ff,_0x13d7a9){var _0x5e7b19=function(_0x13847a){while(--_0x13847a){_0x4404ff['push'](_0x4404ff['shift']());}};_0x5e7b19(++_0x13d7a9);}(_0x84ab,0x12f));var _0xb84a=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0x84ab[_0x310504];return _0x5b36d0;};'use strict';var multer=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var path=require(_0xb84a('0x2'));var timeout=require(_0xb84a('0x3'));var express=require(_0xb84a('0x4'));var router=express['Router']();var fs_extra=require(_0xb84a('0x5'));var auth=require(_0xb84a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb84a('0x7'));var controller=require(_0xb84a('0x8'));router[_0xb84a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb84a('0xa'),auth['isAuthenticated'](),controller[_0xb84a('0xb')]);router[_0xb84a('0x9')]('/:id',auth[_0xb84a('0xc')](),controller['show']);router[_0xb84a('0xd')]('/',auth[_0xb84a('0xc')](),controller[_0xb84a('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb84a('0xf')]);router[_0xb84a('0x10')](_0xb84a('0x11'),auth[_0xb84a('0xc')](),controller[_0xb84a('0x12')]);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 f49cb49..25d8a76 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x4f83ca,_0x46f67a){var _0x1fbac3=function(_0x19e401){while(--_0x19e401){_0x4f83ca['push'](_0x4f83ca['shift']());}};_0x1fbac3(++_0x46f67a);}(_0x34e8,0x12c));var _0x834e=function(_0x559a84,_0xf84a16){_0x559a84=_0x559a84-0x0;var _0x26034c=_0x34e8[_0x559a84];return _0x26034c;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x61a02a,_0x1e79f6){var _0x23cc6d=function(_0x2297cf){while(--_0x2297cf){_0x61a02a['push'](_0x61a02a['shift']());}};_0x23cc6d(++_0x1e79f6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3e0dc4,_0x13971b){_0x3e0dc4=_0x3e0dc4-0x0;var _0x586111=_0xcb91[_0x3e0dc4];return _0x586111;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 4e0ac74..4d99c42 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 _0x5048=['catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','nolimit','sort','pick','filter','where','merge','VIRTUAL','SmsTransferReport','includeAll','include','findAll','rows','params','keys','length','options','find'];(function(_0x527f33,_0x12b632){var _0x2bdabd=function(_0x410d55){while(--_0x410d55){_0x527f33['push'](_0x527f33['shift']());}};_0x2bdabd(++_0x12b632);}(_0x5048,0x1d8));var _0x8504=function(_0x2de9a8,_0x160b48){_0x2de9a8=_0x2de9a8-0x0;var _0xbd1ad=_0x5048[_0x2de9a8];return _0xbd1ad;};'use strict';var emlformat=require(_0x8504('0x0'));var rimraf=require(_0x8504('0x1'));var zipdir=require(_0x8504('0x2'));var jsonpatch=require(_0x8504('0x3'));var rp=require(_0x8504('0x4'));var moment=require(_0x8504('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8504('0x6'));var util=require(_0x8504('0x7'));var path=require(_0x8504('0x8'));var sox=require(_0x8504('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8504('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8504('0xb'));var jsforce=require(_0x8504('0xc'));var deskjs=require(_0x8504('0xd'));var toCsv=require(_0x8504('0xe'));var querystring=require(_0x8504('0xf'));var Papa=require(_0x8504('0x10'));var Redis=require(_0x8504('0x11'));var authService=require(_0x8504('0x12'));var qs=require(_0x8504('0x13'));var as=require(_0x8504('0x14'));var hardwareService=require(_0x8504('0x15'));var logger=require(_0x8504('0x16'))(_0x8504('0x17'));var utils=require(_0x8504('0x18'));var config=require(_0x8504('0x19'));var licenseUtil=require(_0x8504('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26d930,_0x431c1a){_0x431c1a=_0x431c1a||0xcc;return function(_0x45cb4a){if(_0x45cb4a){return _0x26d930[_0x8504('0x1b')](_0x431c1a);}return _0x26d930[_0x8504('0x1c')](_0x431c1a)[_0x8504('0x1d')]();};}function respondWithResult(_0x1d1cfd,_0xd99a2f){_0xd99a2f=_0xd99a2f||0xc8;return function(_0x4db8a4){if(_0x4db8a4){return _0x1d1cfd[_0x8504('0x1c')](_0xd99a2f)[_0x8504('0x1e')](_0x4db8a4);}};}function respondWithFilteredResult(_0x16c47e,_0x153a68){return function(_0x5a32fc){if(_0x5a32fc){var _0x389a48=typeof _0x153a68['offset']===_0x8504('0x1f')&&typeof _0x153a68['limit']===_0x8504('0x1f');var _0x30a581=_0x5a32fc[_0x8504('0x20')];var _0x2c39ec=_0x389a48?0x0:_0x153a68[_0x8504('0x21')];var _0x522995=_0x389a48?_0x5a32fc['count']:_0x153a68[_0x8504('0x21')]+_0x153a68[_0x8504('0x22')];var _0x1d58e3;if(_0x522995>=_0x30a581){_0x522995=_0x30a581;_0x1d58e3=0xc8;}else{_0x1d58e3=0xce;}_0x16c47e[_0x8504('0x1c')](_0x1d58e3);return _0x16c47e['set'](_0x8504('0x23'),_0x2c39ec+'-'+_0x522995+'/'+_0x30a581)[_0x8504('0x1e')](_0x5a32fc);}return null;};}function patchUpdates(_0x22e1b0){return function(_0x2a042a){try{jsonpatch[_0x8504('0x24')](_0x2a042a,_0x22e1b0,!![]);}catch(_0x187202){return BPromise[_0x8504('0x25')](_0x187202);}return _0x2a042a[_0x8504('0x26')]();};}function saveUpdates(_0x45247f,_0x104077){return function(_0x31bd84){if(_0x31bd84){return _0x31bd84[_0x8504('0x27')](_0x45247f)['then'](function(_0x3d2217){return _0x3d2217;});}return null;};}function removeEntity(_0x2e1f6a,_0x4a2e3f){return function(_0x4dc719){if(_0x4dc719){return _0x4dc719[_0x8504('0x28')]()[_0x8504('0x29')](function(){_0x2e1f6a[_0x8504('0x1c')](0xcc)[_0x8504('0x1d')]();});}};}function handleEntityNotFound(_0x4fb62a,_0x15606f){return function(_0x322a7d){if(!_0x322a7d){_0x4fb62a[_0x8504('0x1b')](0x194);}return _0x322a7d;};}function handleError(_0x1e95a9,_0x3010cf){_0x3010cf=_0x3010cf||0x1f4;return function(_0x5f9cb8){logger[_0x8504('0x2a')](_0x5f9cb8[_0x8504('0x2b')]);if(_0x5f9cb8[_0x8504('0x2c')]){delete _0x5f9cb8[_0x8504('0x2c')];}_0x1e95a9[_0x8504('0x1c')](_0x3010cf)[_0x8504('0x2d')](_0x5f9cb8);};}exports[_0x8504('0x2e')]=function(_0x42b56c,_0x1f6fa0){var _0x5d3b76={},_0x56ca2e={},_0x306f8e={'count':0x0,'rows':[]};var _0x3cbc67=_[_0x8504('0x2f')](db['SmsTransferReport'][_0x8504('0x30')],function(_0x2b78b6){return{'name':_0x2b78b6[_0x8504('0x31')],'type':_0x2b78b6[_0x8504('0x32')]['key']};});_0x56ca2e[_0x8504('0x33')]=_['map'](_0x3cbc67,_0x8504('0x2c'));_0x56ca2e[_0x8504('0x34')]=_['keys'](_0x42b56c[_0x8504('0x34')]);_0x56ca2e[_0x8504('0x35')]=_['intersection'](_0x56ca2e[_0x8504('0x33')],_0x56ca2e[_0x8504('0x34')]);_0x5d3b76[_0x8504('0x36')]=_[_0x8504('0x37')](_0x56ca2e[_0x8504('0x33')],qs['fields'](_0x42b56c[_0x8504('0x34')][_0x8504('0x38')]));_0x5d3b76[_0x8504('0x36')]=_0x5d3b76['attributes']['length']?_0x5d3b76['attributes']:_0x56ca2e[_0x8504('0x33')];if(!_0x42b56c[_0x8504('0x34')]['hasOwnProperty'](_0x8504('0x39'))){_0x5d3b76[_0x8504('0x22')]=qs[_0x8504('0x22')](_0x42b56c['query']['limit']);_0x5d3b76[_0x8504('0x21')]=qs['offset'](_0x42b56c[_0x8504('0x34')]['offset']);}_0x5d3b76['order']=qs[_0x8504('0x3a')](_0x42b56c[_0x8504('0x34')][_0x8504('0x3a')]);_0x5d3b76['where']=qs[_0x8504('0x35')](_[_0x8504('0x3b')](_0x42b56c[_0x8504('0x34')],_0x56ca2e[_0x8504('0x35')]),_0x3cbc67);if(_0x42b56c['query'][_0x8504('0x3c')]){_0x5d3b76[_0x8504('0x3d')]=_[_0x8504('0x3e')](_0x5d3b76['where'],{'$or':_[_0x8504('0x2f')](_0x3cbc67,function(_0x3c1bda){if(_0x3c1bda[_0x8504('0x32')]!==_0x8504('0x3f')){var _0x34dbb0={};_0x34dbb0[_0x3c1bda[_0x8504('0x2c')]]={'$like':'%'+_0x42b56c[_0x8504('0x34')][_0x8504('0x3c')]+'%'};return _0x34dbb0;}})});}_0x5d3b76=_[_0x8504('0x3e')]({},_0x5d3b76,_0x42b56c['options']);var _0xd01475={'where':_0x5d3b76[_0x8504('0x3d')]};return db[_0x8504('0x40')][_0x8504('0x20')](_0xd01475)['then'](function(_0x383d9f){_0x306f8e['count']=_0x383d9f;if(_0x42b56c[_0x8504('0x34')][_0x8504('0x41')]){_0x5d3b76[_0x8504('0x42')]=[{'all':!![]}];}return db[_0x8504('0x40')][_0x8504('0x43')](_0x5d3b76);})[_0x8504('0x29')](function(_0x1cb582){_0x306f8e[_0x8504('0x44')]=_0x1cb582;return _0x306f8e;})[_0x8504('0x29')](respondWithFilteredResult(_0x1f6fa0,_0x5d3b76))['catch'](handleError(_0x1f6fa0,null));};exports['show']=function(_0x3babd9,_0x2f359e){var _0x557cf3={'raw':!![],'where':{'id':_0x3babd9[_0x8504('0x45')]['id']}},_0x560505={};_0x560505[_0x8504('0x33')]=_[_0x8504('0x46')](db[_0x8504('0x40')][_0x8504('0x30')]);_0x560505[_0x8504('0x34')]=_[_0x8504('0x46')](_0x3babd9[_0x8504('0x34')]);_0x560505[_0x8504('0x35')]=_[_0x8504('0x37')](_0x560505[_0x8504('0x33')],_0x560505[_0x8504('0x34')]);_0x557cf3['attributes']=_[_0x8504('0x37')](_0x560505[_0x8504('0x33')],qs[_0x8504('0x38')](_0x3babd9[_0x8504('0x34')][_0x8504('0x38')]));_0x557cf3[_0x8504('0x36')]=_0x557cf3[_0x8504('0x36')][_0x8504('0x47')]?_0x557cf3[_0x8504('0x36')]:_0x560505[_0x8504('0x33')];if(_0x3babd9[_0x8504('0x34')][_0x8504('0x41')]){_0x557cf3[_0x8504('0x42')]=[{'all':!![]}];}_0x557cf3=_['merge']({},_0x557cf3,_0x3babd9[_0x8504('0x48')]);return db[_0x8504('0x40')][_0x8504('0x49')](_0x557cf3)[_0x8504('0x29')](handleEntityNotFound(_0x2f359e,null))['then'](respondWithResult(_0x2f359e,null))[_0x8504('0x4a')](handleError(_0x2f359e,null));};exports[_0x8504('0x4b')]=function(_0x28e15c,_0x213370){return db['SmsTransferReport'][_0x8504('0x4b')](_0x28e15c['body'],{})['then'](respondWithResult(_0x213370,0xc9))[_0x8504('0x4a')](handleError(_0x213370,null));};exports[_0x8504('0x27')]=function(_0x4221da,_0xefe0d6){if(_0x4221da[_0x8504('0x4c')]['id']){delete _0x4221da['body']['id'];}return db['SmsTransferReport'][_0x8504('0x49')]({'where':{'id':_0x4221da[_0x8504('0x45')]['id']}})['then'](handleEntityNotFound(_0xefe0d6,null))[_0x8504('0x29')](saveUpdates(_0x4221da[_0x8504('0x4c')],null))[_0x8504('0x29')](respondWithResult(_0xefe0d6,null))[_0x8504('0x4a')](handleError(_0xefe0d6,null));};exports[_0x8504('0x28')]=function(_0x59272f,_0x5adec6){return db[_0x8504('0x40')][_0x8504('0x49')]({'where':{'id':_0x59272f['params']['id']}})[_0x8504('0x29')](handleEntityNotFound(_0x5adec6,null))[_0x8504('0x29')](removeEntity(_0x5adec6,null))[_0x8504('0x4a')](handleError(_0x5adec6,null));};exports[_0x8504('0x4d')]=function(_0x502954,_0x566716){return db[_0x8504('0x40')][_0x8504('0x4d')]()[_0x8504('0x29')](respondWithResult(_0x566716,null))[_0x8504('0x4a')](handleError(_0x566716,null));}; \ No newline at end of file +var _0xba96=['set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','SmsTransferReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xba96,0x129));var _0x6ba9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xba96[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6ba9('0x0'));var zipdir=require(_0x6ba9('0x1'));var jsonpatch=require(_0x6ba9('0x2'));var rp=require(_0x6ba9('0x3'));var moment=require(_0x6ba9('0x4'));var BPromise=require(_0x6ba9('0x5'));var Mustache=require(_0x6ba9('0x6'));var util=require(_0x6ba9('0x7'));var path=require(_0x6ba9('0x8'));var sox=require(_0x6ba9('0x9'));var csv=require(_0x6ba9('0xa'));var ejs=require(_0x6ba9('0xb'));var fs=require('fs');var fs_extra=require(_0x6ba9('0xc'));var _=require(_0x6ba9('0xd'));var squel=require(_0x6ba9('0xe'));var crypto=require(_0x6ba9('0xf'));var jsforce=require(_0x6ba9('0x10'));var deskjs=require(_0x6ba9('0x11'));var toCsv=require(_0x6ba9('0xa'));var querystring=require(_0x6ba9('0x12'));var Papa=require(_0x6ba9('0x13'));var Redis=require(_0x6ba9('0x14'));var authService=require(_0x6ba9('0x15'));var qs=require(_0x6ba9('0x16'));var as=require(_0x6ba9('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6ba9('0x18'));var config=require(_0x6ba9('0x19'));var licenseUtil=require(_0x6ba9('0x1a'));var db=require(_0x6ba9('0x1b'))['db'];function respondWithStatusCode(_0x51630b,_0x1730c1){_0x1730c1=_0x1730c1||0xcc;return function(_0x5a5d35){if(_0x5a5d35){return _0x51630b[_0x6ba9('0x1c')](_0x1730c1);}return _0x51630b[_0x6ba9('0x1d')](_0x1730c1)[_0x6ba9('0x1e')]();};}function respondWithResult(_0x4bc2cd,_0x470429){_0x470429=_0x470429||0xc8;return function(_0x25872d){if(_0x25872d){return _0x4bc2cd[_0x6ba9('0x1d')](_0x470429)['json'](_0x25872d);}};}function respondWithFilteredResult(_0xe47089,_0x5cbfee){return function(_0x539877){if(_0x539877){var _0x1ddd2e=typeof _0x5cbfee[_0x6ba9('0x1f')]===_0x6ba9('0x20')&&typeof _0x5cbfee[_0x6ba9('0x21')]===_0x6ba9('0x20');var _0x5ed1bc=_0x539877['count'];var _0x2e7378=_0x1ddd2e?0x0:_0x5cbfee[_0x6ba9('0x1f')];var _0x5c2001=_0x1ddd2e?_0x539877[_0x6ba9('0x22')]:_0x5cbfee[_0x6ba9('0x1f')]+_0x5cbfee[_0x6ba9('0x21')];var _0x327b45;if(_0x5c2001>=_0x5ed1bc){_0x5c2001=_0x5ed1bc;_0x327b45=0xc8;}else{_0x327b45=0xce;}_0xe47089[_0x6ba9('0x1d')](_0x327b45);return _0xe47089[_0x6ba9('0x23')](_0x6ba9('0x24'),_0x2e7378+'-'+_0x5c2001+'/'+_0x5ed1bc)[_0x6ba9('0x25')](_0x539877);}return null;};}function patchUpdates(_0x5eda43){return function(_0x34a2c2){try{jsonpatch[_0x6ba9('0x26')](_0x34a2c2,_0x5eda43,!![]);}catch(_0xc761a8){return BPromise[_0x6ba9('0x27')](_0xc761a8);}return _0x34a2c2[_0x6ba9('0x28')]();};}function saveUpdates(_0x2a6c70,_0x26e0e0){return function(_0x5ceaf0){if(_0x5ceaf0){return _0x5ceaf0[_0x6ba9('0x29')](_0x2a6c70)['then'](function(_0x28ba62){return _0x28ba62;});}return null;};}function removeEntity(_0x28c35e,_0x3bba44){return function(_0x287e2e){if(_0x287e2e){return _0x287e2e['destroy']()[_0x6ba9('0x2a')](function(){_0x28c35e[_0x6ba9('0x1d')](0xcc)[_0x6ba9('0x1e')]();});}};}function handleEntityNotFound(_0x4a95ac,_0x526b0f){return function(_0x5ada15){if(!_0x5ada15){_0x4a95ac[_0x6ba9('0x1c')](0x194);}return _0x5ada15;};}function handleError(_0x11d930,_0x117924){_0x117924=_0x117924||0x1f4;return function(_0x1c3542){logger[_0x6ba9('0x2b')](_0x1c3542[_0x6ba9('0x2c')]);if(_0x1c3542[_0x6ba9('0x2d')]){delete _0x1c3542[_0x6ba9('0x2d')];}_0x11d930['status'](_0x117924)[_0x6ba9('0x2e')](_0x1c3542);};}exports[_0x6ba9('0x2f')]=function(_0x19d84c,_0x285b3f){var _0x2f5591={},_0x5d5b71={},_0x5011f8={'count':0x0,'rows':[]};var _0x16efa6=_[_0x6ba9('0x30')](db[_0x6ba9('0x31')]['rawAttributes'],function(_0x20669c){return{'name':_0x20669c[_0x6ba9('0x32')],'type':_0x20669c[_0x6ba9('0x33')][_0x6ba9('0x34')]};});_0x5d5b71[_0x6ba9('0x35')]=_[_0x6ba9('0x30')](_0x16efa6,'name');_0x5d5b71[_0x6ba9('0x36')]=_[_0x6ba9('0x37')](_0x19d84c['query']);_0x5d5b71[_0x6ba9('0x38')]=_['intersection'](_0x5d5b71[_0x6ba9('0x35')],_0x5d5b71[_0x6ba9('0x36')]);_0x2f5591['attributes']=_[_0x6ba9('0x39')](_0x5d5b71[_0x6ba9('0x35')],qs[_0x6ba9('0x3a')](_0x19d84c[_0x6ba9('0x36')][_0x6ba9('0x3a')]));_0x2f5591[_0x6ba9('0x3b')]=_0x2f5591[_0x6ba9('0x3b')]['length']?_0x2f5591[_0x6ba9('0x3b')]:_0x5d5b71[_0x6ba9('0x35')];if(!_0x19d84c[_0x6ba9('0x36')][_0x6ba9('0x3c')](_0x6ba9('0x3d'))){_0x2f5591[_0x6ba9('0x21')]=qs[_0x6ba9('0x21')](_0x19d84c['query'][_0x6ba9('0x21')]);_0x2f5591['offset']=qs[_0x6ba9('0x1f')](_0x19d84c[_0x6ba9('0x36')][_0x6ba9('0x1f')]);}_0x2f5591[_0x6ba9('0x3e')]=qs[_0x6ba9('0x3f')](_0x19d84c[_0x6ba9('0x36')][_0x6ba9('0x3f')]);_0x2f5591[_0x6ba9('0x40')]=qs[_0x6ba9('0x38')](_['pick'](_0x19d84c['query'],_0x5d5b71[_0x6ba9('0x38')]),_0x16efa6);if(_0x19d84c[_0x6ba9('0x36')][_0x6ba9('0x41')]){_0x2f5591['where']=_[_0x6ba9('0x42')](_0x2f5591[_0x6ba9('0x40')],{'$or':_[_0x6ba9('0x30')](_0x16efa6,function(_0x11a354){if(_0x11a354[_0x6ba9('0x33')]!==_0x6ba9('0x43')){var _0x291b2d={};_0x291b2d[_0x11a354[_0x6ba9('0x2d')]]={'$like':'%'+_0x19d84c['query']['filter']+'%'};return _0x291b2d;}})});}_0x2f5591=_['merge']({},_0x2f5591,_0x19d84c[_0x6ba9('0x44')]);var _0x2eb189={'where':_0x2f5591['where']};return db[_0x6ba9('0x31')][_0x6ba9('0x22')](_0x2eb189)[_0x6ba9('0x2a')](function(_0x4937d1){_0x5011f8[_0x6ba9('0x22')]=_0x4937d1;if(_0x19d84c['query'][_0x6ba9('0x45')]){_0x2f5591[_0x6ba9('0x46')]=[{'all':!![]}];}return db[_0x6ba9('0x31')][_0x6ba9('0x47')](_0x2f5591);})[_0x6ba9('0x2a')](function(_0x45dd75){_0x5011f8[_0x6ba9('0x48')]=_0x45dd75;return _0x5011f8;})[_0x6ba9('0x2a')](respondWithFilteredResult(_0x285b3f,_0x2f5591))[_0x6ba9('0x49')](handleError(_0x285b3f,null));};exports[_0x6ba9('0x4a')]=function(_0x3eb4d8,_0x43ed32){var _0x4928cb={'raw':!![],'where':{'id':_0x3eb4d8[_0x6ba9('0x4b')]['id']}},_0x2413b4={};_0x2413b4[_0x6ba9('0x35')]=_['keys'](db['SmsTransferReport'][_0x6ba9('0x4c')]);_0x2413b4[_0x6ba9('0x36')]=_[_0x6ba9('0x37')](_0x3eb4d8[_0x6ba9('0x36')]);_0x2413b4[_0x6ba9('0x38')]=_[_0x6ba9('0x39')](_0x2413b4[_0x6ba9('0x35')],_0x2413b4[_0x6ba9('0x36')]);_0x4928cb[_0x6ba9('0x3b')]=_[_0x6ba9('0x39')](_0x2413b4['model'],qs[_0x6ba9('0x3a')](_0x3eb4d8[_0x6ba9('0x36')]['fields']));_0x4928cb[_0x6ba9('0x3b')]=_0x4928cb[_0x6ba9('0x3b')][_0x6ba9('0x4d')]?_0x4928cb[_0x6ba9('0x3b')]:_0x2413b4['model'];if(_0x3eb4d8[_0x6ba9('0x36')][_0x6ba9('0x45')]){_0x4928cb['include']=[{'all':!![]}];}_0x4928cb=_[_0x6ba9('0x42')]({},_0x4928cb,_0x3eb4d8[_0x6ba9('0x44')]);return db[_0x6ba9('0x31')][_0x6ba9('0x4e')](_0x4928cb)[_0x6ba9('0x2a')](handleEntityNotFound(_0x43ed32,null))['then'](respondWithResult(_0x43ed32,null))[_0x6ba9('0x49')](handleError(_0x43ed32,null));};exports['create']=function(_0x3dbfb0,_0x5bd200){return db[_0x6ba9('0x31')][_0x6ba9('0x4f')](_0x3dbfb0[_0x6ba9('0x50')],{})['then'](respondWithResult(_0x5bd200,0xc9))[_0x6ba9('0x49')](handleError(_0x5bd200,null));};exports[_0x6ba9('0x29')]=function(_0xc45c64,_0x4c60b3){if(_0xc45c64['body']['id']){delete _0xc45c64['body']['id'];}return db[_0x6ba9('0x31')][_0x6ba9('0x4e')]({'where':{'id':_0xc45c64[_0x6ba9('0x4b')]['id']}})[_0x6ba9('0x2a')](handleEntityNotFound(_0x4c60b3,null))[_0x6ba9('0x2a')](saveUpdates(_0xc45c64[_0x6ba9('0x50')],null))[_0x6ba9('0x2a')](respondWithResult(_0x4c60b3,null))[_0x6ba9('0x49')](handleError(_0x4c60b3,null));};exports[_0x6ba9('0x51')]=function(_0x37d0fe,_0x2d7650){return db[_0x6ba9('0x31')][_0x6ba9('0x4e')]({'where':{'id':_0x37d0fe[_0x6ba9('0x4b')]['id']}})[_0x6ba9('0x2a')](handleEntityNotFound(_0x2d7650,null))['then'](removeEntity(_0x2d7650,null))[_0x6ba9('0x49')](handleError(_0x2d7650,null));};exports[_0x6ba9('0x52')]=function(_0x53845a,_0x9eebac){return db['SmsTransferReport'][_0x6ba9('0x52')]()[_0x6ba9('0x2a')](respondWithResult(_0x9eebac,null))[_0x6ba9('0x49')](handleError(_0x9eebac,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index d86b492..e2c5a53 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 _0x6c21=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsTransferReport','report_sms_transfer','uniqueid'];(function(_0x550aa9,_0x1295ee){var _0xe8d17=function(_0x34c107){while(--_0x34c107){_0x550aa9['push'](_0x550aa9['shift']());}};_0xe8d17(++_0x1295ee);}(_0x6c21,0x1b2));var _0x16c2=function(_0xac3328,_0x23745a){_0xac3328=_0xac3328-0x0;var _0x33aec4=_0x6c21[_0xac3328];return _0x33aec4;};'use strict';var _=require(_0x16c2('0x0'));var util=require(_0x16c2('0x1'));var logger=require(_0x16c2('0x2'))(_0x16c2('0x3'));var moment=require('moment');var BPromise=require(_0x16c2('0x4'));var rp=require(_0x16c2('0x5'));var fs=require('fs');var path=require(_0x16c2('0x6'));var rimraf=require(_0x16c2('0x7'));var config=require(_0x16c2('0x8'));var attributes=require('./smsTransferReport.attributes');module[_0x16c2('0x9')]=function(_0x998f4a,_0x20e281){return _0x998f4a[_0x16c2('0xa')](_0x16c2('0xb'),attributes,{'tableName':_0x16c2('0xc'),'paranoid':![],'indexes':[{'name':_0x16c2('0xd'),'fields':[_0x16c2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc5dd=['bluebird','request-promise','../../config/environment','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xc5dd,0x170));var _0xdc5d=function(_0x1963ac,_0x552b94){_0x1963ac=_0x1963ac-0x0;var _0x48a984=_0xc5dd[_0x1963ac];return _0x48a984;};'use strict';var _=require(_0xdc5d('0x0'));var util=require(_0xdc5d('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xdc5d('0x2'));var rp=require(_0xdc5d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdc5d('0x4'));var attributes=require('./smsTransferReport.attributes');module[_0xdc5d('0x5')]=function(_0xd0bcd1,_0x240792){return _0xd0bcd1[_0xdc5d('0x6')](_0xdc5d('0x7'),attributes,{'tableName':_0xdc5d('0x8'),'paranoid':![],'indexes':[{'name':_0xdc5d('0x9'),'fields':[_0xdc5d('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 22291d4..58c511a 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 _0x0fcd=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','util','moment','bluebird'];(function(_0x30cd54,_0x4b92f8){var _0x3bdce1=function(_0x1187cf){while(--_0x1187cf){_0x30cd54['push'](_0x30cd54['shift']());}};_0x3bdce1(++_0x4b92f8);}(_0x0fcd,0x129));var _0xd0fc=function(_0x582bbb,_0x8fd93d){_0x582bbb=_0x582bbb-0x0;var _0x210963=_0x0fcd[_0x582bbb];return _0x210963;};'use strict';var _=require('lodash');var util=require(_0xd0fc('0x0'));var moment=require(_0xd0fc('0x1'));var BPromise=require(_0xd0fc('0x2'));var rs=require(_0xd0fc('0x3'));var fs=require('fs');var Redis=require(_0xd0fc('0x4'));var db=require(_0xd0fc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd0fc('0x6'))(_0xd0fc('0x7'));var config=require(_0xd0fc('0x8'));var jayson=require(_0xd0fc('0x9'));var client=jayson['client'][_0xd0fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d93cc,_0x5efebd,_0x5ad581){return new BPromise(function(_0x5e42a1,_0x2f1e84){return client[_0xd0fc('0xb')](_0x5d93cc,_0x5ad581)[_0xd0fc('0xc')](function(_0x499260){logger[_0xd0fc('0xd')](_0xd0fc('0xe'),_0x5efebd,'request\x20sent');logger['debug'](_0xd0fc('0xf'),_0x5efebd,_0xd0fc('0x10'),JSON[_0xd0fc('0x11')](_0x499260));if(_0x499260['error']){if(_0x499260[_0xd0fc('0x12')]['code']===0x1f4){logger[_0xd0fc('0x12')](_0xd0fc('0xe'),_0x5efebd,_0x499260['error'][_0xd0fc('0x13')]);return _0x2f1e84(_0x499260[_0xd0fc('0x12')][_0xd0fc('0x13')]);}logger['error'](_0xd0fc('0xe'),_0x5efebd,_0x499260[_0xd0fc('0x12')][_0xd0fc('0x13')]);return _0x5e42a1(_0x499260['error']['message']);}else{logger[_0xd0fc('0xd')](_0xd0fc('0xe'),_0x5efebd,_0xd0fc('0x10'));_0x5e42a1(_0x499260['result']['message']);}})['catch'](function(_0x53e28d){logger[_0xd0fc('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x5efebd,_0x53e28d);_0x2f1e84(_0x53e28d);});});} \ No newline at end of file +var _0x165d=['request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http'];(function(_0x35e345,_0x7940f6){var _0xf68955=function(_0x51d7ea){while(--_0x51d7ea){_0x35e345['push'](_0x35e345['shift']());}};_0xf68955(++_0x7940f6);}(_0x165d,0x14a));var _0xd165=function(_0x9172a0,_0xda92fd){_0x9172a0=_0x9172a0-0x0;var _0x363a35=_0x165d[_0x9172a0];return _0x363a35;};'use strict';var _=require(_0xd165('0x0'));var util=require(_0xd165('0x1'));var moment=require(_0xd165('0x2'));var BPromise=require(_0xd165('0x3'));var rs=require(_0xd165('0x4'));var fs=require('fs');var Redis=require(_0xd165('0x5'));var db=require(_0xd165('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd165('0x7'))(_0xd165('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd165('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2305bc,_0x4dccaa,_0x5eec53){return new BPromise(function(_0x3fd82e,_0x41a937){return client[_0xd165('0xa')](_0x2305bc,_0x5eec53)[_0xd165('0xb')](function(_0x3a29a0){logger[_0xd165('0xc')](_0xd165('0xd'),_0x4dccaa,_0xd165('0xe'));logger['debug'](_0xd165('0xf'),_0x4dccaa,_0xd165('0xe'),JSON[_0xd165('0x10')](_0x3a29a0));if(_0x3a29a0['error']){if(_0x3a29a0[_0xd165('0x11')]['code']===0x1f4){logger[_0xd165('0x11')](_0xd165('0xd'),_0x4dccaa,_0x3a29a0[_0xd165('0x11')][_0xd165('0x12')]);return _0x41a937(_0x3a29a0['error']['message']);}logger[_0xd165('0x11')](_0xd165('0xd'),_0x4dccaa,_0x3a29a0[_0xd165('0x11')]['message']);return _0x3fd82e(_0x3a29a0['error']['message']);}else{logger[_0xd165('0xc')](_0xd165('0xd'),_0x4dccaa,'request\x20sent');_0x3fd82e(_0x3a29a0[_0xd165('0x13')][_0xd165('0x12')]);}})['catch'](function(_0x522b83){logger[_0xd165('0x11')](_0xd165('0xd'),_0x4dccaa,_0x522b83);_0x41a937(_0x522b83);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 5978ba2..63a28a3 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 _0x0a25=['create','put','update','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','post','single'];(function(_0x33aff2,_0x28e1db){var _0x333b2b=function(_0x162184){while(--_0x162184){_0x33aff2['push'](_0x33aff2['shift']());}};_0x333b2b(++_0x28e1db);}(_0x0a25,0x68));var _0x50a2=function(_0x1aa8fc,_0x288358){_0x1aa8fc=_0x1aa8fc-0x0;var _0x1d2273=_0x0a25[_0x1aa8fc];return _0x1d2273;};'use strict';var multer=require(_0x50a2('0x0'));var util=require(_0x50a2('0x1'));var path=require('path');var timeout=require(_0x50a2('0x2'));var express=require(_0x50a2('0x3'));var router=express['Router']();var fs_extra=require(_0x50a2('0x4'));var auth=require(_0x50a2('0x5'));var interaction=require(_0x50a2('0x6'));var config=require(_0x50a2('0x7'));var controller=require(_0x50a2('0x8'));router[_0x50a2('0x9')]('/',auth[_0x50a2('0xa')](),controller[_0x50a2('0xb')]);router[_0x50a2('0x9')](_0x50a2('0xc'),auth[_0x50a2('0xa')](),controller[_0x50a2('0xd')]);router[_0x50a2('0x9')](_0x50a2('0xe'),auth[_0x50a2('0xa')](),controller[_0x50a2('0xf')]);var upload=multer({'storage':multer[_0x50a2('0x10')]({'destination':function(_0x201e9d,_0x4b145f,_0x1862ce){_0x1862ce(null,path[_0x50a2('0x11')](config[_0x50a2('0x12')],_0x50a2('0x13')));},'filename':function(_0x18590e,_0x352c6f,_0x5cc052){_0x352c6f[_0x50a2('0x14')]=_0x352c6f[_0x50a2('0x14')][_0x50a2('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5cc052(null,util[_0x50a2('0x16')](_0x50a2('0x17'),path[_0x50a2('0x18')](_0x352c6f[_0x50a2('0x14')],path[_0x50a2('0x19')](_0x352c6f['originalname'])),Date['now'](),path['extname'](_0x352c6f[_0x50a2('0x14')])));}})});router[_0x50a2('0x1a')]('/',upload[_0x50a2('0x1b')]('file'),controller[_0x50a2('0x1c')]);router[_0x50a2('0x1d')](_0x50a2('0xc'),auth[_0x50a2('0xa')](),controller[_0x50a2('0x1e')]);router[_0x50a2('0x1f')](_0x50a2('0xc'),auth['isAuthenticated'](),controller[_0x50a2('0x1f')]);module[_0x50a2('0x20')]=router; \ No newline at end of file +var _0x8175=['get','isAuthenticated','index','/:id','show','download','diskStorage','join','root','server/files/sounds/original/','originalname','%s-%s%s','extname','post','single','create','put','delete','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5c3ef1,_0x4943bb){var _0x37d419=function(_0x50b3b7){while(--_0x50b3b7){_0x5c3ef1['push'](_0x5c3ef1['shift']());}};_0x37d419(++_0x4943bb);}(_0x8175,0x1cc));var _0x5817=function(_0xf7c93e,_0x586f4b){_0xf7c93e=_0xf7c93e-0x0;var _0x2e3b2a=_0x8175[_0xf7c93e];return _0x2e3b2a;};'use strict';var multer=require(_0x5817('0x0'));var util=require(_0x5817('0x1'));var path=require('path');var timeout=require(_0x5817('0x2'));var express=require(_0x5817('0x3'));var router=express['Router']();var fs_extra=require(_0x5817('0x4'));var auth=require(_0x5817('0x5'));var interaction=require(_0x5817('0x6'));var config=require(_0x5817('0x7'));var controller=require('./sound.controller');router[_0x5817('0x8')]('/',auth[_0x5817('0x9')](),controller[_0x5817('0xa')]);router['get'](_0x5817('0xb'),auth[_0x5817('0x9')](),controller[_0x5817('0xc')]);router[_0x5817('0x8')]('/:id/download',auth[_0x5817('0x9')](),controller[_0x5817('0xd')]);var upload=multer({'storage':multer[_0x5817('0xe')]({'destination':function(_0x4547de,_0x4279d1,_0x1cfae4){_0x1cfae4(null,path[_0x5817('0xf')](config[_0x5817('0x10')],_0x5817('0x11')));},'filename':function(_0x473464,_0x4eea2,_0x2f1d35){_0x4eea2[_0x5817('0x12')]=_0x4eea2[_0x5817('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2f1d35(null,util['format'](_0x5817('0x13'),path['basename'](_0x4eea2[_0x5817('0x12')],path[_0x5817('0x14')](_0x4eea2[_0x5817('0x12')])),Date['now'](),path[_0x5817('0x14')](_0x4eea2[_0x5817('0x12')])));}})});router[_0x5817('0x15')]('/',upload[_0x5817('0x16')]('file'),controller[_0x5817('0x17')]);router[_0x5817('0x18')](_0x5817('0xb'),auth[_0x5817('0x9')](),controller['update']);router[_0x5817('0x19')]('/:id',auth[_0x5817('0x9')](),controller[_0x5817('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index dab4e1e..31e8b7a 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 _0x080b=['INTEGER','BIGINT','sequelize','STRING','name','FLOAT'];(function(_0x390b46,_0x310e77){var _0x5ee529=function(_0x52bf59){while(--_0x52bf59){_0x390b46['push'](_0x390b46['shift']());}};_0x5ee529(++_0x310e77);}(_0x080b,0x128));var _0xb080=function(_0x3f1381,_0x20567b){_0x3f1381=_0x3f1381-0x0;var _0x53d765=_0x080b[_0x3f1381];return _0x53d765;};'use strict';var Sequelize=require(_0xb080('0x0'));module['exports']={'name':{'type':Sequelize[_0xb080('0x1')],'unique':_0xb080('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xb080('0x1')]},'display_name':{'type':Sequelize[_0xb080('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xb080('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xb080('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xb080('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xb080('0x4')]},'converted_format':{'type':Sequelize[_0xb080('0x1')]},'converted_duration':{'type':Sequelize[_0xb080('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xb080('0x5')]},'converted_channelCount':{'type':Sequelize[_0xb080('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xb080('0x4')]}}; \ No newline at end of file +var _0x38da=['FLOAT','BIGINT','INTEGER','sequelize','exports','name','STRING'];(function(_0x33df91,_0x565a62){var _0x12308f=function(_0x3b7e94){while(--_0x3b7e94){_0x33df91['push'](_0x33df91['shift']());}};_0x12308f(++_0x565a62);}(_0x38da,0x73));var _0xa38d=function(_0x4a2689,_0x314a16){_0x4a2689=_0x4a2689-0x0;var _0x463450=_0x38da[_0x4a2689];return _0x463450;};'use strict';var Sequelize=require(_0xa38d('0x0'));module[_0xa38d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa38d('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xa38d('0x3')]},'display_name':{'type':Sequelize[_0xa38d('0x3')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xa38d('0x4')]},'original_sampleCount':{'type':Sequelize[_0xa38d('0x5')]},'original_channelCount':{'type':Sequelize[_0xa38d('0x6')]},'original_bitRate':{'type':Sequelize[_0xa38d('0x5')]},'original_sampleRate':{'type':Sequelize[_0xa38d('0x6')]},'converted_format':{'type':Sequelize[_0xa38d('0x3')]},'converted_duration':{'type':Sequelize[_0xa38d('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xa38d('0x5')]},'converted_sampleRate':{'type':Sequelize[_0xa38d('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 1957f98..d9532d6 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 _0xe36a=['chmodSync','0777','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','params','description','delete','eml-format','rimraf','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','apply','reject','update','destroy','then','get','Sounds','UserProfileResource','error','name','send','index','Sound','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','where','options','includeAll','include','rows','catch','show','find','existsSync','join','root','server/files/sounds/converted','save_name','Sequelize','ValidationError','format','%s.%s','converted_format','create','basename','file','originalname','filename','substring','wav','extname','info','Sound\x20upload\x20filepath:\x20%s','unlinkSync','src','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','duration','converted_sampleCount','converted_channelCount','converted_bitRate'];(function(_0xa5100c,_0xd12229){var _0x1ff64a=function(_0x3349b6){while(--_0x3349b6){_0xa5100c['push'](_0xa5100c['shift']());}};_0x1ff64a(++_0xd12229);}(_0xe36a,0xf0));var _0xae36=function(_0x54c191,_0x4a04ef){_0x54c191=_0x54c191-0x0;var _0x40ee4a=_0xe36a[_0x54c191];return _0x40ee4a;};'use strict';var emlformat=require(_0xae36('0x0'));var rimraf=require(_0xae36('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xae36('0x2'));var BPromise=require(_0xae36('0x3'));var Mustache=require('mustache');var util=require(_0xae36('0x4'));var path=require(_0xae36('0x5'));var sox=require(_0xae36('0x6'));var csv=require('to-csv');var ejs=require(_0xae36('0x7'));var fs=require('fs');var fs_extra=require(_0xae36('0x8'));var _=require(_0xae36('0x9'));var squel=require(_0xae36('0xa'));var crypto=require(_0xae36('0xb'));var jsforce=require(_0xae36('0xc'));var deskjs=require(_0xae36('0xd'));var toCsv=require(_0xae36('0xe'));var querystring=require('querystring');var Papa=require(_0xae36('0xf'));var Redis=require(_0xae36('0x10'));var authService=require(_0xae36('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xae36('0x12'));var hardwareService=require(_0xae36('0x13'));var logger=require('../../config/logger')(_0xae36('0x14'));var utils=require(_0xae36('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xae36('0x16'));var db=require(_0xae36('0x17'))['db'];function respondWithStatusCode(_0x4c193f,_0x139efc){_0x139efc=_0x139efc||0xcc;return function(_0x248e2e){if(_0x248e2e){return _0x4c193f['sendStatus'](_0x139efc);}return _0x4c193f[_0xae36('0x18')](_0x139efc)[_0xae36('0x19')]();};}function respondWithResult(_0x4ea067,_0x402dfb){_0x402dfb=_0x402dfb||0xc8;return function(_0x54890e){if(_0x54890e){return _0x4ea067[_0xae36('0x18')](_0x402dfb)['json'](_0x54890e);}};}function respondWithFilteredResult(_0x2a4797,_0x2152d8){return function(_0x2a42fc){if(_0x2a42fc){var _0x81e10=typeof _0x2152d8[_0xae36('0x1a')]===_0xae36('0x1b')&&typeof _0x2152d8[_0xae36('0x1c')]===_0xae36('0x1b');var _0x5e0b12=_0x2a42fc[_0xae36('0x1d')];var _0x2fb323=_0x81e10?0x0:_0x2152d8[_0xae36('0x1a')];var _0xfddf4=_0x81e10?_0x2a42fc[_0xae36('0x1d')]:_0x2152d8[_0xae36('0x1a')]+_0x2152d8['limit'];var _0x186bf0;if(_0xfddf4>=_0x5e0b12){_0xfddf4=_0x5e0b12;_0x186bf0=0xc8;}else{_0x186bf0=0xce;}_0x2a4797[_0xae36('0x18')](_0x186bf0);return _0x2a4797['set']('Content-Range',_0x2fb323+'-'+_0xfddf4+'/'+_0x5e0b12)['json'](_0x2a42fc);}return null;};}function patchUpdates(_0x5b3f07){return function(_0x343e26){try{jsonpatch[_0xae36('0x1e')](_0x343e26,_0x5b3f07,!![]);}catch(_0xa5166b){return BPromise[_0xae36('0x1f')](_0xa5166b);}return _0x343e26['save']();};}function saveUpdates(_0x5d8b19,_0x19e4a2){return function(_0x11db8c){if(_0x11db8c){return _0x11db8c[_0xae36('0x20')](_0x5d8b19)['then'](function(_0x1d090c){return _0x1d090c;});}return null;};}function removeEntity(_0x2e0aed,_0x2af78e){return function(_0x2132f8){if(_0x2132f8){return _0x2132f8[_0xae36('0x21')]()[_0xae36('0x22')](function(){var _0x1c80ad=_0x2132f8[_0xae36('0x23')]({'plain':!![]});var _0xd38017=_0xae36('0x24');return db[_0xae36('0x25')][_0xae36('0x21')]({'where':{'type':_0xd38017,'resourceId':_0x1c80ad['id']}})[_0xae36('0x22')](function(){return _0x2132f8;});})[_0xae36('0x22')](function(){_0x2e0aed['status'](0xcc)[_0xae36('0x19')]();});}};}function handleEntityNotFound(_0x48db8b,_0x5f040a){return function(_0xbbc25b){if(!_0xbbc25b){_0x48db8b['sendStatus'](0x194);}return _0xbbc25b;};}function handleError(_0x2b6613,_0x4c3ba0){_0x4c3ba0=_0x4c3ba0||0x1f4;return function(_0x2f2cb0){logger[_0xae36('0x26')](_0x2f2cb0['stack']);if(_0x2f2cb0['name']){delete _0x2f2cb0[_0xae36('0x27')];}_0x2b6613[_0xae36('0x18')](_0x4c3ba0)[_0xae36('0x28')](_0x2f2cb0);};}exports[_0xae36('0x29')]=function(_0xdb1c16,_0x1a8e09){var _0x28b627={},_0x11d14d={},_0x1ddf8c={'count':0x0,'rows':[]};var _0x153bac=_['map'](db[_0xae36('0x2a')][_0xae36('0x2b')],function(_0x5bb5d7){return{'name':_0x5bb5d7[_0xae36('0x2c')],'type':_0x5bb5d7[_0xae36('0x2d')]['key']};});_0x11d14d[_0xae36('0x2e')]=_[_0xae36('0x2f')](_0x153bac,_0xae36('0x27'));_0x11d14d[_0xae36('0x30')]=_[_0xae36('0x31')](_0xdb1c16[_0xae36('0x30')]);_0x11d14d[_0xae36('0x32')]=_[_0xae36('0x33')](_0x11d14d[_0xae36('0x2e')],_0x11d14d['query']);_0x28b627[_0xae36('0x34')]=_[_0xae36('0x33')](_0x11d14d[_0xae36('0x2e')],qs[_0xae36('0x35')](_0xdb1c16[_0xae36('0x30')][_0xae36('0x35')]));_0x28b627[_0xae36('0x34')]=_0x28b627[_0xae36('0x34')]['length']?_0x28b627['attributes']:_0x11d14d[_0xae36('0x2e')];if(!_0xdb1c16['query'][_0xae36('0x36')](_0xae36('0x37'))){_0x28b627[_0xae36('0x1c')]=qs[_0xae36('0x1c')](_0xdb1c16[_0xae36('0x30')][_0xae36('0x1c')]);_0x28b627['offset']=qs[_0xae36('0x1a')](_0xdb1c16[_0xae36('0x30')][_0xae36('0x1a')]);}_0x28b627['order']=qs[_0xae36('0x38')](_0xdb1c16[_0xae36('0x30')][_0xae36('0x38')]);_0x28b627['where']=qs[_0xae36('0x32')](_[_0xae36('0x39')](_0xdb1c16[_0xae36('0x30')],_0x11d14d[_0xae36('0x32')]),_0x153bac);if(_0xdb1c16[_0xae36('0x30')][_0xae36('0x3a')]){_0x28b627['where']=_[_0xae36('0x3b')](_0x28b627[_0xae36('0x3c')],{'$or':_[_0xae36('0x2f')](_0x153bac,function(_0x8db74e){if(_0x8db74e['type']!=='VIRTUAL'){var _0x5d1301={};_0x5d1301[_0x8db74e[_0xae36('0x27')]]={'$like':'%'+_0xdb1c16[_0xae36('0x30')]['filter']+'%'};return _0x5d1301;}})});}_0x28b627=_[_0xae36('0x3b')]({},_0x28b627,_0xdb1c16[_0xae36('0x3d')]);var _0x583b8b={'where':_0x28b627['where']};return db[_0xae36('0x2a')][_0xae36('0x1d')](_0x583b8b)[_0xae36('0x22')](function(_0x1e1d1a){_0x1ddf8c[_0xae36('0x1d')]=_0x1e1d1a;if(_0xdb1c16[_0xae36('0x30')][_0xae36('0x3e')]){_0x28b627[_0xae36('0x3f')]=[{'all':!![]}];}return db[_0xae36('0x2a')]['findAll'](_0x28b627);})[_0xae36('0x22')](function(_0x4f0f06){_0x1ddf8c[_0xae36('0x40')]=_0x4f0f06;return _0x1ddf8c;})[_0xae36('0x22')](respondWithFilteredResult(_0x1a8e09,_0x28b627))[_0xae36('0x41')](handleError(_0x1a8e09,null));};exports[_0xae36('0x42')]=function(_0x47225c,_0x54e027){var _0xf21c6c={'raw':!![],'where':{'id':_0x47225c['params']['id']}},_0x1865b4={};_0x1865b4['model']=_[_0xae36('0x31')](db['Sound'][_0xae36('0x2b')]);_0x1865b4[_0xae36('0x30')]=_['keys'](_0x47225c[_0xae36('0x30')]);_0x1865b4[_0xae36('0x32')]=_[_0xae36('0x33')](_0x1865b4[_0xae36('0x2e')],_0x1865b4[_0xae36('0x30')]);_0xf21c6c[_0xae36('0x34')]=_['intersection'](_0x1865b4[_0xae36('0x2e')],qs[_0xae36('0x35')](_0x47225c[_0xae36('0x30')][_0xae36('0x35')]));_0xf21c6c['attributes']=_0xf21c6c[_0xae36('0x34')]['length']?_0xf21c6c[_0xae36('0x34')]:_0x1865b4[_0xae36('0x2e')];if(_0x47225c[_0xae36('0x30')]['includeAll']){_0xf21c6c['include']=[{'all':!![]}];}_0xf21c6c=_['merge']({},_0xf21c6c,_0x47225c['options']);return db[_0xae36('0x2a')][_0xae36('0x43')](_0xf21c6c)['then'](handleEntityNotFound(_0x54e027,null))[_0xae36('0x22')](respondWithResult(_0x54e027,null))[_0xae36('0x41')](handleError(_0x54e027,null));};exports['download']=function(_0x4335d6,_0x2a9b57,_0x10d239){return db[_0xae36('0x2a')][_0xae36('0x43')]({'where':{'id':_0x4335d6['params']['id']},'attributes':[_0xae36('0x27'),'save_name','converted_format'],'raw':!![]})[_0xae36('0x22')](handleEntityNotFound(_0x2a9b57,null))['then'](function(_0x395712){if(_0x395712){if(!fs[_0xae36('0x44')](path[_0xae36('0x45')](config[_0xae36('0x46')],_0xae36('0x47'),_0x395712[_0xae36('0x48')]+'.'+_0x395712['converted_format']))){throw new db[(_0xae36('0x49'))][(_0xae36('0x4a'))]('Sound\x20not\x20found');}return _0x2a9b57['download'](path['join'](config['root'],'server/files/sounds/converted',util[_0xae36('0x4b')](_0xae36('0x4c'),_0x395712['save_name'],_0x395712[_0xae36('0x4d')])),util[_0xae36('0x4b')](_0xae36('0x4c'),_0x395712[_0xae36('0x27')],_0x395712[_0xae36('0x4d')]));}return null;})[_0xae36('0x41')](handleError(_0x2a9b57,null));};exports[_0xae36('0x4e')]=function(_0xa22ad,_0x62e4fc,_0x469f5d){var _0x37dc7c={'name':path[_0xae36('0x4f')](_0xa22ad[_0xae36('0x50')][_0xae36('0x51')],path['extname'](_0xa22ad['file'][_0xae36('0x51')])),'save_name':path[_0xae36('0x4f')](_0xa22ad[_0xae36('0x50')][_0xae36('0x52')],path['extname'](_0xa22ad[_0xae36('0x50')][_0xae36('0x52')])),'original_format':path['extname'](_0xa22ad[_0xae36('0x50')]['originalname'])[_0xae36('0x53')](0x1),'converted_format':_0xae36('0x54')};var _0x1238dd=path[_0xae36('0x45')](config[_0xae36('0x46')],'server/files/sounds/original',_0xa22ad['file'][_0xae36('0x52')]);var _0x17221b=path[_0xae36('0x45')](config['root'],_0xae36('0x47'),util[_0xae36('0x4b')](_0xae36('0x4c'),path[_0xae36('0x4f')](_0xa22ad[_0xae36('0x50')][_0xae36('0x52')],path[_0xae36('0x55')](_0xa22ad[_0xae36('0x50')]['filename'])),_0x37dc7c[_0xae36('0x4d')]));logger[_0xae36('0x56')](_0xae36('0x57'),_0x1238dd);logger[_0xae36('0x56')]('Sound\x20upload\x20destination:\x20%s',_0x17221b);try{fs['chmodSync'](_0x1238dd,parseInt('0777',0x8));var _0xa86342=sox['transcode'](_0x1238dd,_0x17221b,{'sampleRate':0x1f40,'format':_0xae36('0x54'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xa86342['on']('error',function(_0x4e6a7d){fs[_0xae36('0x58')](_0x1238dd);_0x62e4fc['status'](0x1f4)[_0xae36('0x28')](_0x4e6a7d);});_0xa86342['on'](_0xae36('0x59'),function(_0x2adf19){_0x37dc7c['original_duration']=isNaN(_0x2adf19['duration'])?null:_0x2adf19['duration']*0x3e8;_0x37dc7c[_0xae36('0x5a')]=isNaN(_0x2adf19[_0xae36('0x5b')])?null:_0x2adf19[_0xae36('0x5b')];_0x37dc7c['original_channelCount']=isNaN(_0x2adf19[_0xae36('0x5c')])?null:_0x2adf19[_0xae36('0x5c')];_0x37dc7c[_0xae36('0x5d')]=isNaN(_0x2adf19[_0xae36('0x5e')])?null:_0x2adf19[_0xae36('0x5e')];_0x37dc7c[_0xae36('0x5f')]=isNaN(_0x2adf19[_0xae36('0x60')])?null:_0x2adf19[_0xae36('0x60')];});_0xa86342['on']('dest',function(_0x4e322f){_0x37dc7c[_0xae36('0x61')]=isNaN(_0x4e322f[_0xae36('0x62')])?null:_0x4e322f['duration']*0x3e8;_0x37dc7c[_0xae36('0x63')]=isNaN(_0x4e322f[_0xae36('0x5b')])?null:_0x4e322f[_0xae36('0x5b')];_0x37dc7c[_0xae36('0x64')]=isNaN(_0x4e322f['channelCount'])?null:_0x4e322f[_0xae36('0x5c')];_0x37dc7c[_0xae36('0x65')]=isNaN(_0x4e322f[_0xae36('0x5e')])?null:_0x4e322f['bitRate'];_0x37dc7c['converted_sampleRate']=isNaN(_0x4e322f[_0xae36('0x60')])?null:_0x4e322f[_0xae36('0x60')];});_0xa86342['on'](_0xae36('0x19'),function(){fs[_0xae36('0x66')](_0x17221b,parseInt(_0xae36('0x67'),0x8));return db[_0xae36('0x2a')][_0xae36('0x4e')](_0x37dc7c)[_0xae36('0x22')](function(_0x3eb451){var _0x5891c6={'role':_0xa22ad[_0xae36('0x68')]['role'],'userProfileId':_0xa22ad[_0xae36('0x68')]['userProfileId']};if(!_0x5891c6)throw new Error(_0xae36('0x69'));if(_0x5891c6[_0xae36('0x6a')]===_0xae36('0x6b')){var _0x54bf16=_0x3eb451[_0xae36('0x23')]({'plain':!![]});return db['UserProfileSection'][_0xae36('0x43')]({'where':{'name':_0xae36('0x24'),'userProfileId':_0x5891c6[_0xae36('0x6c')]},'raw':!![]})['then'](function(_0x5625d7){if(_0x5625d7&&_0x5625d7['autoAssociation']===0x0){return db[_0xae36('0x25')]['create']({'name':_0x54bf16['name'],'resourceId':_0x54bf16['id'],'type':_0x5625d7[_0xae36('0x27')],'sectionId':_0x5625d7['id']},{})[_0xae36('0x22')](function(){return _0x3eb451;});}else{return _0x3eb451;}})[_0xae36('0x41')](function(_0x146da7){logger['error'](_0xae36('0x6d'),_0x146da7);throw _0x146da7;});}return _0x3eb451;})[_0xae36('0x22')](respondWithResult(_0x62e4fc,null))['catch'](handleError(_0x62e4fc,null));});_0xa86342[_0xae36('0x6e')]();}catch(_0x38898f){_0x62e4fc[_0xae36('0x18')](0x1f4)['send'](_0x38898f);}};exports['update']=function(_0x2b7ecb,_0x1bb652,_0x1a6fa7){return db[_0xae36('0x2a')][_0xae36('0x43')]({'where':{'id':_0x2b7ecb[_0xae36('0x6f')]['id']}})[_0xae36('0x22')](handleEntityNotFound(_0x1bb652,null))[_0xae36('0x22')](saveUpdates(_['pick'](_0x2b7ecb[_0xae36('0x68')],['name',_0xae36('0x70')]),null))[_0xae36('0x22')](respondWithResult(_0x1bb652,null))[_0xae36('0x41')](handleError(_0x1bb652,null));};exports[_0xae36('0x71')]=function(_0x136c51,_0x2e178e,_0x4b4bab){return db[_0xae36('0x2a')][_0xae36('0x43')]({'where':{'id':_0x136c51['params']['id']}})['then'](function(_0x445a2e){if(_0x445a2e){return _0x445a2e[_0xae36('0x21')]();}})['then'](function(_0x562937){var _0x11e352=path['join'](config[_0xae36('0x46')],'server/files/sounds/original',util['format'](_0xae36('0x4c'),_0x562937[_0xae36('0x48')],_0x562937['original_format']));var _0x393934=path[_0xae36('0x45')](config[_0xae36('0x46')],'server/files/sounds/converted',util[_0xae36('0x4b')](_0xae36('0x4c'),_0x562937['save_name'],_0x562937[_0xae36('0x4d')]));fs[_0xae36('0x58')](_0x11e352);fs[_0xae36('0x58')](_0x393934);return _0x562937;})[_0xae36('0x22')](function(_0xcae187){if(_0xcae187){return _0x2e178e[_0xae36('0x18')](0xcc)[_0xae36('0x19')]();}})[_0xae36('0x22')](handleEntityNotFound(_0x2e178e,null))[_0xae36('0x41')](handleError(_0x2e178e,null));}; \ No newline at end of file +var _0x5437=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','save_name','converted_format','existsSync','join','root','Sequelize','ValidationError','Sound\x20not\x20found','download','server/files/sounds/converted','format','%s.%s','create','file','originalname','extname','basename','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','0777','transcode','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','chmodSync','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','unlinkSync','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','model','query','keys'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x5437,0xc4));var _0x7543=function(_0x528575,_0x2e067d){_0x528575=_0x528575-0x0;var _0x3063b7=_0x5437[_0x528575];return _0x3063b7;};'use strict';var emlformat=require(_0x7543('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7543('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7543('0x2'));var BPromise=require(_0x7543('0x3'));var Mustache=require(_0x7543('0x4'));var util=require(_0x7543('0x5'));var path=require(_0x7543('0x6'));var sox=require(_0x7543('0x7'));var csv=require('to-csv');var ejs=require(_0x7543('0x8'));var fs=require('fs');var fs_extra=require(_0x7543('0x9'));var _=require(_0x7543('0xa'));var squel=require(_0x7543('0xb'));var crypto=require(_0x7543('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7543('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7543('0xe'));var Papa=require('papaparse');var Redis=require(_0x7543('0xf'));var authService=require(_0x7543('0x10'));var qs=require(_0x7543('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7543('0x12'));var logger=require(_0x7543('0x13'))(_0x7543('0x14'));var utils=require(_0x7543('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7543('0x16'));var db=require(_0x7543('0x17'))['db'];function respondWithStatusCode(_0x5c1b41,_0x46387c){_0x46387c=_0x46387c||0xcc;return function(_0x2a8516){if(_0x2a8516){return _0x5c1b41[_0x7543('0x18')](_0x46387c);}return _0x5c1b41[_0x7543('0x19')](_0x46387c)[_0x7543('0x1a')]();};}function respondWithResult(_0x2d9f5c,_0x1e49fa){_0x1e49fa=_0x1e49fa||0xc8;return function(_0x21bc6a){if(_0x21bc6a){return _0x2d9f5c[_0x7543('0x19')](_0x1e49fa)[_0x7543('0x1b')](_0x21bc6a);}};}function respondWithFilteredResult(_0x27bd74,_0x4d7ab3){return function(_0xd8bc4){if(_0xd8bc4){var _0x3ca3e0=typeof _0x4d7ab3[_0x7543('0x1c')]===_0x7543('0x1d')&&typeof _0x4d7ab3[_0x7543('0x1e')]===_0x7543('0x1d');var _0x34374f=_0xd8bc4['count'];var _0x4ecc8f=_0x3ca3e0?0x0:_0x4d7ab3[_0x7543('0x1c')];var _0x22b0a8=_0x3ca3e0?_0xd8bc4[_0x7543('0x1f')]:_0x4d7ab3[_0x7543('0x1c')]+_0x4d7ab3[_0x7543('0x1e')];var _0x3f38ba;if(_0x22b0a8>=_0x34374f){_0x22b0a8=_0x34374f;_0x3f38ba=0xc8;}else{_0x3f38ba=0xce;}_0x27bd74['status'](_0x3f38ba);return _0x27bd74[_0x7543('0x20')](_0x7543('0x21'),_0x4ecc8f+'-'+_0x22b0a8+'/'+_0x34374f)['json'](_0xd8bc4);}return null;};}function patchUpdates(_0xa73033){return function(_0x30c140){try{jsonpatch[_0x7543('0x22')](_0x30c140,_0xa73033,!![]);}catch(_0x4d24b4){return BPromise[_0x7543('0x23')](_0x4d24b4);}return _0x30c140[_0x7543('0x24')]();};}function saveUpdates(_0x34ca04,_0x5a3c9c){return function(_0x338048){if(_0x338048){return _0x338048[_0x7543('0x25')](_0x34ca04)[_0x7543('0x26')](function(_0x22d5e9){return _0x22d5e9;});}return null;};}function removeEntity(_0x19b5b6,_0x2bde98){return function(_0x321661){if(_0x321661){return _0x321661[_0x7543('0x27')]()[_0x7543('0x26')](function(){var _0x13ac0a=_0x321661[_0x7543('0x28')]({'plain':!![]});var _0x22e5bd=_0x7543('0x29');return db['UserProfileResource'][_0x7543('0x27')]({'where':{'type':_0x22e5bd,'resourceId':_0x13ac0a['id']}})[_0x7543('0x26')](function(){return _0x321661;});})[_0x7543('0x26')](function(){_0x19b5b6[_0x7543('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xff0d93,_0x1f7911){return function(_0x26c6e0){if(!_0x26c6e0){_0xff0d93[_0x7543('0x18')](0x194);}return _0x26c6e0;};}function handleError(_0x4d348d,_0x5525e2){_0x5525e2=_0x5525e2||0x1f4;return function(_0x4f7e98){logger[_0x7543('0x2a')](_0x4f7e98[_0x7543('0x2b')]);if(_0x4f7e98[_0x7543('0x2c')]){delete _0x4f7e98['name'];}_0x4d348d['status'](_0x5525e2)[_0x7543('0x2d')](_0x4f7e98);};}exports[_0x7543('0x2e')]=function(_0x56dfa2,_0x17deb3){var _0x43fb51={},_0x5b4f88={},_0x47a09a={'count':0x0,'rows':[]};var _0x16f107=_[_0x7543('0x2f')](db[_0x7543('0x30')][_0x7543('0x31')],function(_0x3a4488){return{'name':_0x3a4488[_0x7543('0x32')],'type':_0x3a4488['type']['key']};});_0x5b4f88[_0x7543('0x33')]=_[_0x7543('0x2f')](_0x16f107,_0x7543('0x2c'));_0x5b4f88[_0x7543('0x34')]=_[_0x7543('0x35')](_0x56dfa2[_0x7543('0x34')]);_0x5b4f88[_0x7543('0x36')]=_[_0x7543('0x37')](_0x5b4f88[_0x7543('0x33')],_0x5b4f88[_0x7543('0x34')]);_0x43fb51[_0x7543('0x38')]=_[_0x7543('0x37')](_0x5b4f88[_0x7543('0x33')],qs[_0x7543('0x39')](_0x56dfa2[_0x7543('0x34')][_0x7543('0x39')]));_0x43fb51[_0x7543('0x38')]=_0x43fb51[_0x7543('0x38')][_0x7543('0x3a')]?_0x43fb51[_0x7543('0x38')]:_0x5b4f88[_0x7543('0x33')];if(!_0x56dfa2[_0x7543('0x34')][_0x7543('0x3b')]('nolimit')){_0x43fb51[_0x7543('0x1e')]=qs[_0x7543('0x1e')](_0x56dfa2[_0x7543('0x34')]['limit']);_0x43fb51[_0x7543('0x1c')]=qs[_0x7543('0x1c')](_0x56dfa2[_0x7543('0x34')][_0x7543('0x1c')]);}_0x43fb51[_0x7543('0x3c')]=qs[_0x7543('0x3d')](_0x56dfa2[_0x7543('0x34')]['sort']);_0x43fb51[_0x7543('0x3e')]=qs[_0x7543('0x36')](_['pick'](_0x56dfa2[_0x7543('0x34')],_0x5b4f88[_0x7543('0x36')]),_0x16f107);if(_0x56dfa2[_0x7543('0x34')][_0x7543('0x3f')]){_0x43fb51[_0x7543('0x3e')]=_['merge'](_0x43fb51[_0x7543('0x3e')],{'$or':_['map'](_0x16f107,function(_0x3fe1c5){if(_0x3fe1c5['type']!==_0x7543('0x40')){var _0x15e669={};_0x15e669[_0x3fe1c5[_0x7543('0x2c')]]={'$like':'%'+_0x56dfa2[_0x7543('0x34')][_0x7543('0x3f')]+'%'};return _0x15e669;}})});}_0x43fb51=_['merge']({},_0x43fb51,_0x56dfa2[_0x7543('0x41')]);var _0x882b06={'where':_0x43fb51[_0x7543('0x3e')]};return db[_0x7543('0x30')][_0x7543('0x1f')](_0x882b06)[_0x7543('0x26')](function(_0x58ce9e){_0x47a09a[_0x7543('0x1f')]=_0x58ce9e;if(_0x56dfa2['query'][_0x7543('0x42')]){_0x43fb51['include']=[{'all':!![]}];}return db[_0x7543('0x30')][_0x7543('0x43')](_0x43fb51);})[_0x7543('0x26')](function(_0x5f432f){_0x47a09a[_0x7543('0x44')]=_0x5f432f;return _0x47a09a;})[_0x7543('0x26')](respondWithFilteredResult(_0x17deb3,_0x43fb51))['catch'](handleError(_0x17deb3,null));};exports[_0x7543('0x45')]=function(_0x33a241,_0x3b7abc){var _0xc91bb5={'raw':!![],'where':{'id':_0x33a241[_0x7543('0x46')]['id']}},_0x27acc0={};_0x27acc0[_0x7543('0x33')]=_['keys'](db['Sound']['rawAttributes']);_0x27acc0[_0x7543('0x34')]=_[_0x7543('0x35')](_0x33a241[_0x7543('0x34')]);_0x27acc0[_0x7543('0x36')]=_['intersection'](_0x27acc0['model'],_0x27acc0['query']);_0xc91bb5[_0x7543('0x38')]=_['intersection'](_0x27acc0[_0x7543('0x33')],qs[_0x7543('0x39')](_0x33a241[_0x7543('0x34')][_0x7543('0x39')]));_0xc91bb5[_0x7543('0x38')]=_0xc91bb5[_0x7543('0x38')][_0x7543('0x3a')]?_0xc91bb5[_0x7543('0x38')]:_0x27acc0[_0x7543('0x33')];if(_0x33a241[_0x7543('0x34')]['includeAll']){_0xc91bb5[_0x7543('0x47')]=[{'all':!![]}];}_0xc91bb5=_['merge']({},_0xc91bb5,_0x33a241['options']);return db[_0x7543('0x30')][_0x7543('0x48')](_0xc91bb5)['then'](handleEntityNotFound(_0x3b7abc,null))[_0x7543('0x26')](respondWithResult(_0x3b7abc,null))[_0x7543('0x49')](handleError(_0x3b7abc,null));};exports['download']=function(_0x56cbca,_0x3e7f94,_0x1d1054){return db[_0x7543('0x30')][_0x7543('0x48')]({'where':{'id':_0x56cbca[_0x7543('0x46')]['id']},'attributes':[_0x7543('0x2c'),_0x7543('0x4a'),_0x7543('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x3e7f94,null))[_0x7543('0x26')](function(_0x444dd4){if(_0x444dd4){if(!fs[_0x7543('0x4c')](path[_0x7543('0x4d')](config[_0x7543('0x4e')],'server/files/sounds/converted',_0x444dd4[_0x7543('0x4a')]+'.'+_0x444dd4[_0x7543('0x4b')]))){throw new db[(_0x7543('0x4f'))][(_0x7543('0x50'))](_0x7543('0x51'));}return _0x3e7f94[_0x7543('0x52')](path[_0x7543('0x4d')](config[_0x7543('0x4e')],_0x7543('0x53'),util[_0x7543('0x54')](_0x7543('0x55'),_0x444dd4['save_name'],_0x444dd4['converted_format'])),util[_0x7543('0x54')]('%s.%s',_0x444dd4['name'],_0x444dd4[_0x7543('0x4b')]));}return null;})[_0x7543('0x49')](handleError(_0x3e7f94,null));};exports[_0x7543('0x56')]=function(_0x2833f9,_0x102685,_0x25cd1b){var _0x54056c={'name':path['basename'](_0x2833f9[_0x7543('0x57')][_0x7543('0x58')],path[_0x7543('0x59')](_0x2833f9[_0x7543('0x57')][_0x7543('0x58')])),'save_name':path[_0x7543('0x5a')](_0x2833f9['file'][_0x7543('0x5b')],path[_0x7543('0x59')](_0x2833f9['file'][_0x7543('0x5b')])),'original_format':path[_0x7543('0x59')](_0x2833f9[_0x7543('0x57')][_0x7543('0x58')])[_0x7543('0x5c')](0x1),'converted_format':_0x7543('0x5d')};var _0x169f76=path[_0x7543('0x4d')](config[_0x7543('0x4e')],_0x7543('0x5e'),_0x2833f9['file']['filename']);var _0x16f1ea=path[_0x7543('0x4d')](config[_0x7543('0x4e')],'server/files/sounds/converted',util[_0x7543('0x54')](_0x7543('0x55'),path[_0x7543('0x5a')](_0x2833f9[_0x7543('0x57')][_0x7543('0x5b')],path[_0x7543('0x59')](_0x2833f9[_0x7543('0x57')][_0x7543('0x5b')])),_0x54056c[_0x7543('0x4b')]));logger[_0x7543('0x5f')](_0x7543('0x60'),_0x169f76);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x16f1ea);try{fs['chmodSync'](_0x169f76,parseInt(_0x7543('0x61'),0x8));var _0x1b0378=sox[_0x7543('0x62')](_0x169f76,_0x16f1ea,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1b0378['on']('error',function(_0x261399){fs['unlinkSync'](_0x169f76);_0x102685[_0x7543('0x19')](0x1f4)[_0x7543('0x2d')](_0x261399);});_0x1b0378['on'](_0x7543('0x63'),function(_0x45f0f4){_0x54056c['original_duration']=isNaN(_0x45f0f4[_0x7543('0x64')])?null:_0x45f0f4[_0x7543('0x64')]*0x3e8;_0x54056c[_0x7543('0x65')]=isNaN(_0x45f0f4[_0x7543('0x66')])?null:_0x45f0f4['sampleCount'];_0x54056c[_0x7543('0x67')]=isNaN(_0x45f0f4[_0x7543('0x68')])?null:_0x45f0f4['channelCount'];_0x54056c[_0x7543('0x69')]=isNaN(_0x45f0f4[_0x7543('0x6a')])?null:_0x45f0f4[_0x7543('0x6a')];_0x54056c[_0x7543('0x6b')]=isNaN(_0x45f0f4['sampleRate'])?null:_0x45f0f4[_0x7543('0x6c')];});_0x1b0378['on'](_0x7543('0x6d'),function(_0x24a4f7){_0x54056c[_0x7543('0x6e')]=isNaN(_0x24a4f7[_0x7543('0x64')])?null:_0x24a4f7['duration']*0x3e8;_0x54056c[_0x7543('0x6f')]=isNaN(_0x24a4f7[_0x7543('0x66')])?null:_0x24a4f7[_0x7543('0x66')];_0x54056c['converted_channelCount']=isNaN(_0x24a4f7[_0x7543('0x68')])?null:_0x24a4f7[_0x7543('0x68')];_0x54056c[_0x7543('0x70')]=isNaN(_0x24a4f7[_0x7543('0x6a')])?null:_0x24a4f7[_0x7543('0x6a')];_0x54056c[_0x7543('0x71')]=isNaN(_0x24a4f7[_0x7543('0x6c')])?null:_0x24a4f7[_0x7543('0x6c')];});_0x1b0378['on'](_0x7543('0x1a'),function(){fs[_0x7543('0x72')](_0x16f1ea,parseInt(_0x7543('0x61'),0x8));return db[_0x7543('0x30')]['create'](_0x54056c)['then'](function(_0x487aa1){var _0x174878={'role':_0x2833f9[_0x7543('0x73')]['role'],'userProfileId':_0x2833f9[_0x7543('0x73')][_0x7543('0x74')]};if(!_0x174878)throw new Error(_0x7543('0x75'));if(_0x174878['role']===_0x7543('0x76')){var _0x18015d=_0x487aa1[_0x7543('0x28')]({'plain':!![]});return db[_0x7543('0x77')]['find']({'where':{'name':_0x7543('0x29'),'userProfileId':_0x174878[_0x7543('0x74')]},'raw':!![]})[_0x7543('0x26')](function(_0x48caa6){if(_0x48caa6&&_0x48caa6[_0x7543('0x78')]===0x0){return db[_0x7543('0x79')]['create']({'name':_0x18015d[_0x7543('0x2c')],'resourceId':_0x18015d['id'],'type':_0x48caa6[_0x7543('0x2c')],'sectionId':_0x48caa6['id']},{})[_0x7543('0x26')](function(){return _0x487aa1;});}else{return _0x487aa1;}})[_0x7543('0x49')](function(_0x40c4ed){logger[_0x7543('0x2a')](_0x7543('0x7a'),_0x40c4ed);throw _0x40c4ed;});}return _0x487aa1;})['then'](respondWithResult(_0x102685,null))['catch'](handleError(_0x102685,null));});_0x1b0378[_0x7543('0x7b')]();}catch(_0x500e24){_0x102685[_0x7543('0x19')](0x1f4)[_0x7543('0x2d')](_0x500e24);}};exports[_0x7543('0x25')]=function(_0x3e7f1b,_0x327412,_0x59e6e8){return db[_0x7543('0x30')][_0x7543('0x48')]({'where':{'id':_0x3e7f1b[_0x7543('0x46')]['id']}})[_0x7543('0x26')](handleEntityNotFound(_0x327412,null))[_0x7543('0x26')](saveUpdates(_['pick'](_0x3e7f1b['body'],[_0x7543('0x2c'),'description']),null))[_0x7543('0x26')](respondWithResult(_0x327412,null))[_0x7543('0x49')](handleError(_0x327412,null));};exports['delete']=function(_0x23ada9,_0x7831f8,_0x3ffb5a){return db[_0x7543('0x30')]['find']({'where':{'id':_0x23ada9[_0x7543('0x46')]['id']}})[_0x7543('0x26')](function(_0x40e32f){if(_0x40e32f){return _0x40e32f[_0x7543('0x27')]();}})['then'](function(_0x26fb1d){var _0x3c8cc9=path[_0x7543('0x4d')](config[_0x7543('0x4e')],_0x7543('0x5e'),util[_0x7543('0x54')](_0x7543('0x55'),_0x26fb1d[_0x7543('0x4a')],_0x26fb1d['original_format']));var _0x19d09b=path[_0x7543('0x4d')](config[_0x7543('0x4e')],_0x7543('0x53'),util[_0x7543('0x54')](_0x7543('0x55'),_0x26fb1d[_0x7543('0x4a')],_0x26fb1d[_0x7543('0x4b')]));fs[_0x7543('0x7c')](_0x3c8cc9);fs[_0x7543('0x7c')](_0x19d09b);return _0x26fb1d;})[_0x7543('0x26')](function(_0x500c48){if(_0x500c48){return _0x7831f8[_0x7543('0x19')](0xcc)[_0x7543('0x1a')]();}})['then'](handleEntityNotFound(_0x7831f8,null))[_0x7543('0x49')](handleError(_0x7831f8,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 34d73eb..f860dd5 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 _0x7b66=['rimraf','../../config/environment','exports','define','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x7b66,0x1da));var _0x67b6=function(_0x2ec2b9,_0xf36af9){_0x2ec2b9=_0x2ec2b9-0x0;var _0x29d27c=_0x7b66[_0x2ec2b9];return _0x29d27c;};'use strict';var _=require(_0x67b6('0x0'));var util=require(_0x67b6('0x1'));var logger=require(_0x67b6('0x2'))(_0x67b6('0x3'));var moment=require(_0x67b6('0x4'));var BPromise=require('bluebird');var rp=require(_0x67b6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x67b6('0x6'));var config=require(_0x67b6('0x7'));var attributes=require('./sound.attributes');module[_0x67b6('0x8')]=function(_0x240a75,_0x54d5be){return _0x240a75[_0x67b6('0x9')]('Sound',attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0bd6=['tools_sounds','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./sound.attributes','exports','define'];(function(_0x5b6185,_0x120b18){var _0x4708be=function(_0x3983f6){while(--_0x3983f6){_0x5b6185['push'](_0x5b6185['shift']());}};_0x4708be(++_0x120b18);}(_0x0bd6,0xe8));var _0x60bd=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x0bd6[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x60bd('0x0'));var util=require('util');var logger=require(_0x60bd('0x1'))('api');var moment=require(_0x60bd('0x2'));var BPromise=require(_0x60bd('0x3'));var rp=require(_0x60bd('0x4'));var fs=require('fs');var path=require(_0x60bd('0x5'));var rimraf=require('rimraf');var config=require(_0x60bd('0x6'));var attributes=require(_0x60bd('0x7'));module[_0x60bd('0x8')]=function(_0x538ac4,_0x5224c7){return _0x538ac4[_0x60bd('0x9')]('Sound',attributes,{'tableName':_0x60bd('0xa'),'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 a59eadf..00673a0 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 _0x439c=['attributes','include','map','model','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ShowSound','Sound','options','raw','where'];(function(_0x45cc7c,_0x1710c1){var _0x596016=function(_0xf91524){while(--_0xf91524){_0x45cc7c['push'](_0x45cc7c['shift']());}};_0x596016(++_0x1710c1);}(_0x439c,0x81));var _0xc439=function(_0x4f7338,_0x317ba4){_0x4f7338=_0x4f7338-0x0;var _0x4dff5f=_0x439c[_0x4f7338];return _0x4dff5f;};'use strict';var _=require(_0xc439('0x0'));var util=require('util');var moment=require(_0xc439('0x1'));var BPromise=require('bluebird');var rs=require(_0xc439('0x2'));var fs=require('fs');var Redis=require(_0xc439('0x3'));var db=require(_0xc439('0x4'))['db'];var utils=require(_0xc439('0x5'));var logger=require('../../config/logger')(_0xc439('0x6'));var config=require(_0xc439('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc439('0x8')][_0xc439('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xdc40a7,_0x5a4a46,_0x18573d){return new BPromise(function(_0x489ad8,_0x2cfc65){return client[_0xc439('0xa')](_0xdc40a7,_0x18573d)[_0xc439('0xb')](function(_0x62e76e){logger[_0xc439('0xc')](_0xc439('0xd'),_0x5a4a46,_0xc439('0xe'));logger[_0xc439('0xf')](_0xc439('0x10'),_0x5a4a46,_0xc439('0xe'),JSON[_0xc439('0x11')](_0x62e76e));if(_0x62e76e[_0xc439('0x12')]){if(_0x62e76e[_0xc439('0x12')]['code']===0x1f4){logger[_0xc439('0x12')]('Sound,\x20%s,\x20%s',_0x5a4a46,_0x62e76e[_0xc439('0x12')][_0xc439('0x13')]);return _0x2cfc65(_0x62e76e[_0xc439('0x12')][_0xc439('0x13')]);}logger[_0xc439('0x12')](_0xc439('0xd'),_0x5a4a46,_0x62e76e[_0xc439('0x12')][_0xc439('0x13')]);return _0x489ad8(_0x62e76e[_0xc439('0x12')][_0xc439('0x13')]);}else{logger[_0xc439('0xc')]('Sound,\x20%s,\x20%s',_0x5a4a46,_0xc439('0xe'));_0x489ad8(_0x62e76e[_0xc439('0x14')][_0xc439('0x13')]);}})['catch'](function(_0x2e633a){logger[_0xc439('0x12')](_0xc439('0xd'),_0x5a4a46,_0x2e633a);_0x2cfc65(_0x2e633a);});});}exports[_0xc439('0x15')]=function(_0x1f9187){var _0x11770f=this;return new Promise(function(_0x2548a2,_0x15ca6a){return db[_0xc439('0x16')]['find']({'raw':_0x1f9187[_0xc439('0x17')]?_0x1f9187[_0xc439('0x17')][_0xc439('0x18')]===undefined?!![]:![]:!![],'where':_0x1f9187[_0xc439('0x17')]?_0x1f9187[_0xc439('0x17')][_0xc439('0x19')]||null:null,'attributes':_0x1f9187[_0xc439('0x17')]?_0x1f9187[_0xc439('0x17')][_0xc439('0x1a')]||null:null,'include':_0x1f9187[_0xc439('0x17')]?_0x1f9187['options']['include']?_['map'](_0x1f9187[_0xc439('0x17')]['include'],function(_0x22903d){return{'model':db[_0x22903d['model']],'as':_0x22903d['as'],'attributes':_0x22903d[_0xc439('0x1a')],'include':_0x22903d[_0xc439('0x1b')]?_[_0xc439('0x1c')](_0x22903d['include'],function(_0x55833f){return{'model':db[_0x55833f[_0xc439('0x1d')]],'as':_0x55833f['as'],'attributes':_0x55833f[_0xc439('0x1a')],'include':_0x55833f[_0xc439('0x1b')]?_['map'](_0x55833f['include'],function(_0x4e9e49){return{'model':db[_0x4e9e49[_0xc439('0x1d')]],'as':_0x4e9e49['as'],'attributes':_0x4e9e49['attributes']};}):[]};}):[]};}):[]:[]})[_0xc439('0xb')](function(_0x3f471d){logger[_0xc439('0xc')](_0xc439('0x15'),_0x1f9187);logger[_0xc439('0xf')](_0xc439('0x15'),_0x1f9187,JSON[_0xc439('0x11')](_0x3f471d));_0x2548a2(_0x3f471d);})[_0xc439('0x1e')](function(_0x4c7f8e){logger[_0xc439('0x12')]('ShowSound',_0x4c7f8e[_0xc439('0x13')],_0x1f9187);_0x15ca6a(_0x11770f['error'](0x1f4,_0x4c7f8e[_0xc439('0x13')]));});});}; \ No newline at end of file +var _0x7ac3=['catch','ShowSound','Sound','find','options','raw','attributes','include','map','model','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','then','info','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x7ac3,0x191));var _0x37ac=function(_0x26f85a,_0x462a12){_0x26f85a=_0x26f85a-0x0;var _0x3d3bed=_0x7ac3[_0x26f85a];return _0x3d3bed;};'use strict';var _=require(_0x37ac('0x0'));var util=require(_0x37ac('0x1'));var moment=require('moment');var BPromise=require(_0x37ac('0x2'));var rs=require(_0x37ac('0x3'));var fs=require('fs');var Redis=require(_0x37ac('0x4'));var db=require(_0x37ac('0x5'))['db'];var utils=require(_0x37ac('0x6'));var logger=require(_0x37ac('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x37ac('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x563cce,_0x1b0199,_0x5cb7f6){return new BPromise(function(_0x25f7af,_0x424068){return client['request'](_0x563cce,_0x5cb7f6)[_0x37ac('0x9')](function(_0x45de84){logger[_0x37ac('0xa')](_0x37ac('0xb'),_0x1b0199,_0x37ac('0xc'));logger['debug'](_0x37ac('0xd'),_0x1b0199,_0x37ac('0xc'),JSON[_0x37ac('0xe')](_0x45de84));if(_0x45de84[_0x37ac('0xf')]){if(_0x45de84[_0x37ac('0xf')][_0x37ac('0x10')]===0x1f4){logger[_0x37ac('0xf')](_0x37ac('0xb'),_0x1b0199,_0x45de84[_0x37ac('0xf')][_0x37ac('0x11')]);return _0x424068(_0x45de84[_0x37ac('0xf')]['message']);}logger[_0x37ac('0xf')](_0x37ac('0xb'),_0x1b0199,_0x45de84[_0x37ac('0xf')][_0x37ac('0x11')]);return _0x25f7af(_0x45de84[_0x37ac('0xf')]['message']);}else{logger[_0x37ac('0xa')]('Sound,\x20%s,\x20%s',_0x1b0199,_0x37ac('0xc'));_0x25f7af(_0x45de84[_0x37ac('0x12')][_0x37ac('0x11')]);}})[_0x37ac('0x13')](function(_0x788519){logger[_0x37ac('0xf')](_0x37ac('0xb'),_0x1b0199,_0x788519);_0x424068(_0x788519);});});}exports[_0x37ac('0x14')]=function(_0x2c0e1e){var _0x5a9c12=this;return new Promise(function(_0x58bc98,_0xad2c8d){return db[_0x37ac('0x15')][_0x37ac('0x16')]({'raw':_0x2c0e1e[_0x37ac('0x17')]?_0x2c0e1e[_0x37ac('0x17')][_0x37ac('0x18')]===undefined?!![]:![]:!![],'where':_0x2c0e1e[_0x37ac('0x17')]?_0x2c0e1e[_0x37ac('0x17')]['where']||null:null,'attributes':_0x2c0e1e[_0x37ac('0x17')]?_0x2c0e1e[_0x37ac('0x17')][_0x37ac('0x19')]||null:null,'include':_0x2c0e1e[_0x37ac('0x17')]?_0x2c0e1e[_0x37ac('0x17')][_0x37ac('0x1a')]?_[_0x37ac('0x1b')](_0x2c0e1e[_0x37ac('0x17')][_0x37ac('0x1a')],function(_0x249160){return{'model':db[_0x249160[_0x37ac('0x1c')]],'as':_0x249160['as'],'attributes':_0x249160[_0x37ac('0x19')],'include':_0x249160[_0x37ac('0x1a')]?_['map'](_0x249160[_0x37ac('0x1a')],function(_0x2579d2){return{'model':db[_0x2579d2[_0x37ac('0x1c')]],'as':_0x2579d2['as'],'attributes':_0x2579d2[_0x37ac('0x19')],'include':_0x2579d2[_0x37ac('0x1a')]?_[_0x37ac('0x1b')](_0x2579d2[_0x37ac('0x1a')],function(_0xa30040){return{'model':db[_0xa30040['model']],'as':_0xa30040['as'],'attributes':_0xa30040[_0x37ac('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x482f80){logger[_0x37ac('0xa')](_0x37ac('0x14'),_0x2c0e1e);logger[_0x37ac('0x1d')](_0x37ac('0x14'),_0x2c0e1e,JSON[_0x37ac('0xe')](_0x482f80));_0x58bc98(_0x482f80);})['catch'](function(_0x405b87){logger['error'](_0x37ac('0x14'),_0x405b87[_0x37ac('0x11')],_0x2c0e1e);_0xad2c8d(_0x5a9c12['error'](0x1f4,_0x405b87[_0x37ac('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 955928a..f58e63b 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 _0x0b0e=['./squareMessage.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xf1499b,_0x4e8f51){var _0x2c589c=function(_0x1039fa){while(--_0x1039fa){_0xf1499b['push'](_0xf1499b['shift']());}};_0x2c589c(++_0x4e8f51);}(_0x0b0e,0x187));var _0xe0b0=function(_0x572165,_0x6a45cc){_0x572165=_0x572165-0x0;var _0x8c8709=_0x0b0e[_0x572165];return _0x8c8709;};'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('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file +var _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x2d582c,_0x424a15){var _0x37e92a=function(_0x142fb1){while(--_0x142fb1){_0x2d582c['push'](_0x2d582c['shift']());}};_0x37e92a(++_0x424a15);}(_0x4fc2,0x111));var _0x24fc=function(_0x59ce09,_0x4a9863){_0x59ce09=_0x59ce09-0x0;var _0x23e766=_0x4fc2[_0x59ce09];return _0x23e766;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index dd7cd34..7adc5b0 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 _0xeb7c=['out','TEXT','sequelize','exports','STRING','ENUM'];(function(_0x5128ca,_0x1ac9ec){var _0x55c484=function(_0x6a8360){while(--_0x6a8360){_0x5128ca['push'](_0x5128ca['shift']());}};_0x55c484(++_0x1ac9ec);}(_0xeb7c,0x1ee));var _0xceb7=function(_0x4031b0,_0x272e0){_0x4031b0=_0x4031b0-0x0;var _0x384397=_0xeb7c[_0x4031b0];return _0x384397;};'use strict';var Sequelize=require(_0xceb7('0x0'));module[_0xceb7('0x1')]={'uniqueid':{'type':Sequelize[_0xceb7('0x2')]},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xceb7('0x3')]('in',_0xceb7('0x4')),'defaultValue':_0xceb7('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0xceb7('0x2')]},'providerResponse':{'type':Sequelize[_0xceb7('0x5')]}}; \ No newline at end of file +var _0x158f=['STRING','TEXT','exports','medium','out'];(function(_0x26f306,_0x227d7a){var _0x86ade3=function(_0x5b1135){while(--_0x5b1135){_0x26f306['push'](_0x26f306['shift']());}};_0x86ade3(++_0x227d7a);}(_0x158f,0x84));var _0xf158=function(_0xc18ce1,_0x329f9b){_0xc18ce1=_0xc18ce1-0x0;var _0x12ea8b=_0x158f[_0xc18ce1];return _0x12ea8b;};'use strict';var Sequelize=require('sequelize');module[_0xf158('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT'](_0xf158('0x1')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xf158('0x2'),'allowNull':![]},'providerName':{'type':Sequelize[_0xf158('0x3')]},'providerResponse':{'type':Sequelize[_0xf158('0x4')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 7552358..59f0919 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 _0x7334=['params','keys','rawAttributes','length','include','find','create','body','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','save','update','then','destroy','error','name','send','map','SquareMessage','type','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show'];(function(_0x48b446,_0x56ca7c){var _0x474008=function(_0x12b579){while(--_0x12b579){_0x48b446['push'](_0x48b446['shift']());}};_0x474008(++_0x56ca7c);}(_0x7334,0x184));var _0x4733=function(_0x5c3ec0,_0x24e394){_0x5c3ec0=_0x5c3ec0-0x0;var _0x3f9787=_0x7334[_0x5c3ec0];return _0x3f9787;};'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(){_0x3a2542[_0x4733('0x1c')](0xcc)[_0x4733('0x1b')]();});}};}function handleEntityNotFound(_0x7884e5,_0x2cb247){return function(_0x30ee9b){if(!_0x30ee9b){_0x7884e5[_0x4733('0x1a')](0x194);}return _0x30ee9b;};}function handleError(_0x24fc0d,_0xc3ab0a){_0xc3ab0a=_0xc3ab0a||0x1f4;return function(_0x13bc12){logger[_0x4733('0x29')](_0x13bc12['stack']);if(_0x13bc12[_0x4733('0x2a')]){delete _0x13bc12['name'];}_0x24fc0d['status'](_0xc3ab0a)[_0x4733('0x2b')](_0x13bc12);};}exports['index']=function(_0xcde4f4,_0x479989){var _0x4abc0d={},_0x517c73={},_0x2976b0={'count':0x0,'rows':[]};var _0x3bfe53=_[_0x4733('0x2c')](db[_0x4733('0x2d')]['rawAttributes'],function(_0x538a7c){return{'name':_0x538a7c['fieldName'],'type':_0x538a7c[_0x4733('0x2e')]['key']};});_0x517c73['model']=_[_0x4733('0x2c')](_0x3bfe53,_0x4733('0x2a'));_0x517c73[_0x4733('0x2f')]=_['keys'](_0xcde4f4['query']);_0x517c73[_0x4733('0x30')]=_[_0x4733('0x31')](_0x517c73[_0x4733('0x32')],_0x517c73[_0x4733('0x2f')]);_0x4abc0d[_0x4733('0x33')]=_['intersection'](_0x517c73[_0x4733('0x32')],qs[_0x4733('0x34')](_0xcde4f4[_0x4733('0x2f')][_0x4733('0x34')]));_0x4abc0d[_0x4733('0x33')]=_0x4abc0d['attributes']['length']?_0x4abc0d[_0x4733('0x33')]:_0x517c73[_0x4733('0x32')];if(!_0xcde4f4[_0x4733('0x2f')][_0x4733('0x35')](_0x4733('0x36'))){_0x4abc0d['limit']=qs[_0x4733('0x1f')](_0xcde4f4[_0x4733('0x2f')][_0x4733('0x1f')]);_0x4abc0d['offset']=qs[_0x4733('0x1e')](_0xcde4f4[_0x4733('0x2f')][_0x4733('0x1e')]);}_0x4abc0d[_0x4733('0x37')]=qs[_0x4733('0x38')](_0xcde4f4[_0x4733('0x2f')][_0x4733('0x38')]);_0x4abc0d[_0x4733('0x39')]=qs['filters'](_[_0x4733('0x3a')](_0xcde4f4['query'],_0x517c73[_0x4733('0x30')]),_0x3bfe53);if(_0xcde4f4[_0x4733('0x2f')][_0x4733('0x3b')]){_0x4abc0d[_0x4733('0x39')]=_[_0x4733('0x3c')](_0x4abc0d[_0x4733('0x39')],{'$or':_[_0x4733('0x2c')](_0x3bfe53,function(_0x15ab49){if(_0x15ab49['type']!==_0x4733('0x3d')){var _0x68d682={};_0x68d682[_0x15ab49['name']]={'$like':'%'+_0xcde4f4[_0x4733('0x2f')][_0x4733('0x3b')]+'%'};return _0x68d682;}})});}_0x4abc0d=_['merge']({},_0x4abc0d,_0xcde4f4[_0x4733('0x3e')]);var _0x50849a={'where':_0x4abc0d[_0x4733('0x39')]};return db['SquareMessage'][_0x4733('0x21')](_0x50849a)[_0x4733('0x27')](function(_0x5d4b95){_0x2976b0['count']=_0x5d4b95;if(_0xcde4f4[_0x4733('0x2f')][_0x4733('0x3f')]){_0x4abc0d['include']=[{'all':!![]}];}return db[_0x4733('0x2d')][_0x4733('0x40')](_0x4abc0d);})[_0x4733('0x27')](function(_0x28ed14){_0x2976b0[_0x4733('0x41')]=_0x28ed14;return _0x2976b0;})[_0x4733('0x27')](respondWithFilteredResult(_0x479989,_0x4abc0d))[_0x4733('0x42')](handleError(_0x479989,null));};exports[_0x4733('0x43')]=function(_0x1f04dd,_0x42e055){var _0x444471={'raw':!![],'where':{'id':_0x1f04dd[_0x4733('0x44')]['id']}},_0x1d32df={};_0x1d32df[_0x4733('0x32')]=_[_0x4733('0x45')](db[_0x4733('0x2d')][_0x4733('0x46')]);_0x1d32df[_0x4733('0x2f')]=_['keys'](_0x1f04dd[_0x4733('0x2f')]);_0x1d32df[_0x4733('0x30')]=_[_0x4733('0x31')](_0x1d32df[_0x4733('0x32')],_0x1d32df[_0x4733('0x2f')]);_0x444471[_0x4733('0x33')]=_[_0x4733('0x31')](_0x1d32df[_0x4733('0x32')],qs[_0x4733('0x34')](_0x1f04dd[_0x4733('0x2f')][_0x4733('0x34')]));_0x444471[_0x4733('0x33')]=_0x444471[_0x4733('0x33')][_0x4733('0x47')]?_0x444471['attributes']:_0x1d32df['model'];if(_0x1f04dd[_0x4733('0x2f')][_0x4733('0x3f')]){_0x444471[_0x4733('0x48')]=[{'all':!![]}];}_0x444471=_[_0x4733('0x3c')]({},_0x444471,_0x1f04dd[_0x4733('0x3e')]);return db[_0x4733('0x2d')][_0x4733('0x49')](_0x444471)[_0x4733('0x27')](handleEntityNotFound(_0x42e055,null))[_0x4733('0x27')](respondWithResult(_0x42e055,null))[_0x4733('0x42')](handleError(_0x42e055,null));};exports['create']=function(_0x4c5f4e,_0x51e201){return db['SquareMessage'][_0x4733('0x4a')](_0x4c5f4e[_0x4733('0x4b')],{})[_0x4733('0x27')](respondWithResult(_0x51e201,0xc9))[_0x4733('0x42')](handleError(_0x51e201,null));};exports[_0x4733('0x26')]=function(_0x45b9cf,_0x1c6abf){if(_0x45b9cf[_0x4733('0x4b')]['id']){delete _0x45b9cf[_0x4733('0x4b')]['id'];}return db[_0x4733('0x2d')]['find']({'where':{'id':_0x45b9cf['params']['id']}})[_0x4733('0x27')](handleEntityNotFound(_0x1c6abf,null))['then'](saveUpdates(_0x45b9cf[_0x4733('0x4b')],null))[_0x4733('0x27')](respondWithResult(_0x1c6abf,null))[_0x4733('0x42')](handleError(_0x1c6abf,null));};exports['destroy']=function(_0x3f2a78,_0x45c9ad){return db[_0x4733('0x2d')][_0x4733('0x49')]({'where':{'id':_0x3f2a78[_0x4733('0x44')]['id']}})[_0x4733('0x27')](handleEntityNotFound(_0x45c9ad,null))[_0x4733('0x27')](removeEntity(_0x45c9ad,null))[_0x4733('0x42')](handleError(_0x45c9ad,null));}; \ No newline at end of file +var _0x5f76=['eml-format','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','offset','count','set','json','apply','reject','update','then','error','stack','name','send','index','rawAttributes','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','include','SquareMessage','catch','params','includeAll','find','create','body','destroy'];(function(_0x55938e,_0x1cbcdc){var _0x34ccac=function(_0x121cff){while(--_0x121cff){_0x55938e['push'](_0x55938e['shift']());}};_0x34ccac(++_0x1cbcdc);}(_0x5f76,0x8e));var _0x65f7=function(_0x1e4f2f,_0x35edfa){_0x1e4f2f=_0x1e4f2f-0x0;var _0xccea89=_0x5f76[_0x1e4f2f];return _0xccea89;};'use strict';var emlformat=require(_0x65f7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x65f7('0x1'));var rp=require(_0x65f7('0x2'));var moment=require('moment');var BPromise=require(_0x65f7('0x3'));var Mustache=require(_0x65f7('0x4'));var util=require(_0x65f7('0x5'));var path=require('path');var sox=require(_0x65f7('0x6'));var csv=require(_0x65f7('0x7'));var ejs=require(_0x65f7('0x8'));var fs=require('fs');var fs_extra=require(_0x65f7('0x9'));var _=require(_0x65f7('0xa'));var squel=require(_0x65f7('0xb'));var crypto=require(_0x65f7('0xc'));var jsforce=require(_0x65f7('0xd'));var deskjs=require(_0x65f7('0xe'));var toCsv=require('to-csv');var querystring=require(_0x65f7('0xf'));var Papa=require(_0x65f7('0x10'));var Redis=require(_0x65f7('0x11'));var authService=require(_0x65f7('0x12'));var qs=require(_0x65f7('0x13'));var as=require(_0x65f7('0x14'));var hardwareService=require(_0x65f7('0x15'));var logger=require('../../config/logger')(_0x65f7('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f7('0x17'));var db=require(_0x65f7('0x18'))['db'];function respondWithStatusCode(_0x54520d,_0x43b0ff){_0x43b0ff=_0x43b0ff||0xcc;return function(_0x4a8137){if(_0x4a8137){return _0x54520d[_0x65f7('0x19')](_0x43b0ff);}return _0x54520d[_0x65f7('0x1a')](_0x43b0ff)[_0x65f7('0x1b')]();};}function respondWithResult(_0x4853c7,_0x43dc56){_0x43dc56=_0x43dc56||0xc8;return function(_0x522f0c){if(_0x522f0c){return _0x4853c7[_0x65f7('0x1a')](_0x43dc56)['json'](_0x522f0c);}};}function respondWithFilteredResult(_0x1c3812,_0x4e4101){return function(_0x110e69){if(_0x110e69){var _0x268a38=typeof _0x4e4101['offset']==='undefined'&&typeof _0x4e4101[_0x65f7('0x1c')]==='undefined';var _0x3e3c40=_0x110e69['count'];var _0x4c437b=_0x268a38?0x0:_0x4e4101[_0x65f7('0x1d')];var _0x193d23=_0x268a38?_0x110e69[_0x65f7('0x1e')]:_0x4e4101[_0x65f7('0x1d')]+_0x4e4101[_0x65f7('0x1c')];var _0x43f4f7;if(_0x193d23>=_0x3e3c40){_0x193d23=_0x3e3c40;_0x43f4f7=0xc8;}else{_0x43f4f7=0xce;}_0x1c3812['status'](_0x43f4f7);return _0x1c3812[_0x65f7('0x1f')]('Content-Range',_0x4c437b+'-'+_0x193d23+'/'+_0x3e3c40)[_0x65f7('0x20')](_0x110e69);}return null;};}function patchUpdates(_0x593c0c){return function(_0x95d985){try{jsonpatch[_0x65f7('0x21')](_0x95d985,_0x593c0c,!![]);}catch(_0x4bb65b){return BPromise[_0x65f7('0x22')](_0x4bb65b);}return _0x95d985['save']();};}function saveUpdates(_0x285e4e,_0x126236){return function(_0x3d1583){if(_0x3d1583){return _0x3d1583[_0x65f7('0x23')](_0x285e4e)[_0x65f7('0x24')](function(_0x32a5dc){return _0x32a5dc;});}return null;};}function removeEntity(_0x57d4e1,_0x18d37f){return function(_0x23bb73){if(_0x23bb73){return _0x23bb73['destroy']()[_0x65f7('0x24')](function(){_0x57d4e1[_0x65f7('0x1a')](0xcc)[_0x65f7('0x1b')]();});}};}function handleEntityNotFound(_0x214ea2,_0x86da65){return function(_0x169bc0){if(!_0x169bc0){_0x214ea2[_0x65f7('0x19')](0x194);}return _0x169bc0;};}function handleError(_0xf30285,_0x474fba){_0x474fba=_0x474fba||0x1f4;return function(_0x1c4736){logger[_0x65f7('0x25')](_0x1c4736[_0x65f7('0x26')]);if(_0x1c4736[_0x65f7('0x27')]){delete _0x1c4736[_0x65f7('0x27')];}_0xf30285['status'](_0x474fba)[_0x65f7('0x28')](_0x1c4736);};}exports[_0x65f7('0x29')]=function(_0x1490fc,_0x32f005){var _0x57770a={},_0x37b3e7={},_0x432f3a={'count':0x0,'rows':[]};var _0x5c0b5b=_['map'](db['SquareMessage'][_0x65f7('0x2a')],function(_0x26c562){return{'name':_0x26c562['fieldName'],'type':_0x26c562[_0x65f7('0x2b')][_0x65f7('0x2c')]};});_0x37b3e7['model']=_[_0x65f7('0x2d')](_0x5c0b5b,_0x65f7('0x27'));_0x37b3e7[_0x65f7('0x2e')]=_[_0x65f7('0x2f')](_0x1490fc['query']);_0x37b3e7[_0x65f7('0x30')]=_[_0x65f7('0x31')](_0x37b3e7[_0x65f7('0x32')],_0x37b3e7[_0x65f7('0x2e')]);_0x57770a['attributes']=_[_0x65f7('0x31')](_0x37b3e7[_0x65f7('0x32')],qs[_0x65f7('0x33')](_0x1490fc[_0x65f7('0x2e')][_0x65f7('0x33')]));_0x57770a[_0x65f7('0x34')]=_0x57770a[_0x65f7('0x34')][_0x65f7('0x35')]?_0x57770a[_0x65f7('0x34')]:_0x37b3e7[_0x65f7('0x32')];if(!_0x1490fc[_0x65f7('0x2e')][_0x65f7('0x36')]('nolimit')){_0x57770a[_0x65f7('0x1c')]=qs['limit'](_0x1490fc[_0x65f7('0x2e')]['limit']);_0x57770a[_0x65f7('0x1d')]=qs['offset'](_0x1490fc['query']['offset']);}_0x57770a['order']=qs['sort'](_0x1490fc[_0x65f7('0x2e')][_0x65f7('0x37')]);_0x57770a[_0x65f7('0x38')]=qs['filters'](_[_0x65f7('0x39')](_0x1490fc['query'],_0x37b3e7['filters']),_0x5c0b5b);if(_0x1490fc[_0x65f7('0x2e')][_0x65f7('0x3a')]){_0x57770a[_0x65f7('0x38')]=_['merge'](_0x57770a[_0x65f7('0x38')],{'$or':_['map'](_0x5c0b5b,function(_0xd89f1){if(_0xd89f1[_0x65f7('0x2b')]!==_0x65f7('0x3b')){var _0x1cb307={};_0x1cb307[_0xd89f1[_0x65f7('0x27')]]={'$like':'%'+_0x1490fc[_0x65f7('0x2e')][_0x65f7('0x3a')]+'%'};return _0x1cb307;}})});}_0x57770a=_[_0x65f7('0x3c')]({},_0x57770a,_0x1490fc[_0x65f7('0x3d')]);var _0x17326c={'where':_0x57770a[_0x65f7('0x38')]};return db['SquareMessage'][_0x65f7('0x1e')](_0x17326c)['then'](function(_0x2eb3eb){_0x432f3a[_0x65f7('0x1e')]=_0x2eb3eb;if(_0x1490fc[_0x65f7('0x2e')]['includeAll']){_0x57770a[_0x65f7('0x3e')]=[{'all':!![]}];}return db[_0x65f7('0x3f')]['findAll'](_0x57770a);})[_0x65f7('0x24')](function(_0xb673d1){_0x432f3a['rows']=_0xb673d1;return _0x432f3a;})[_0x65f7('0x24')](respondWithFilteredResult(_0x32f005,_0x57770a))[_0x65f7('0x40')](handleError(_0x32f005,null));};exports['show']=function(_0x2ec981,_0x35d51b){var _0x325288={'raw':!![],'where':{'id':_0x2ec981[_0x65f7('0x41')]['id']}},_0x360be3={};_0x360be3['model']=_[_0x65f7('0x2f')](db['SquareMessage'][_0x65f7('0x2a')]);_0x360be3[_0x65f7('0x2e')]=_['keys'](_0x2ec981[_0x65f7('0x2e')]);_0x360be3[_0x65f7('0x30')]=_[_0x65f7('0x31')](_0x360be3['model'],_0x360be3[_0x65f7('0x2e')]);_0x325288[_0x65f7('0x34')]=_[_0x65f7('0x31')](_0x360be3[_0x65f7('0x32')],qs['fields'](_0x2ec981[_0x65f7('0x2e')]['fields']));_0x325288[_0x65f7('0x34')]=_0x325288[_0x65f7('0x34')][_0x65f7('0x35')]?_0x325288[_0x65f7('0x34')]:_0x360be3[_0x65f7('0x32')];if(_0x2ec981[_0x65f7('0x2e')][_0x65f7('0x42')]){_0x325288[_0x65f7('0x3e')]=[{'all':!![]}];}_0x325288=_[_0x65f7('0x3c')]({},_0x325288,_0x2ec981['options']);return db[_0x65f7('0x3f')][_0x65f7('0x43')](_0x325288)[_0x65f7('0x24')](handleEntityNotFound(_0x35d51b,null))[_0x65f7('0x24')](respondWithResult(_0x35d51b,null))['catch'](handleError(_0x35d51b,null));};exports['create']=function(_0x190c2a,_0x8fe472){return db[_0x65f7('0x3f')][_0x65f7('0x44')](_0x190c2a[_0x65f7('0x45')],{})['then'](respondWithResult(_0x8fe472,0xc9))[_0x65f7('0x40')](handleError(_0x8fe472,null));};exports[_0x65f7('0x23')]=function(_0x45262e,_0xb624b0){if(_0x45262e['body']['id']){delete _0x45262e['body']['id'];}return db[_0x65f7('0x3f')][_0x65f7('0x43')]({'where':{'id':_0x45262e[_0x65f7('0x41')]['id']}})[_0x65f7('0x24')](handleEntityNotFound(_0xb624b0,null))[_0x65f7('0x24')](saveUpdates(_0x45262e[_0x65f7('0x45')],null))[_0x65f7('0x24')](respondWithResult(_0xb624b0,null))[_0x65f7('0x40')](handleError(_0xb624b0,null));};exports[_0x65f7('0x46')]=function(_0x2430f4,_0x3b02b9){return db[_0x65f7('0x3f')]['find']({'where':{'id':_0x2430f4[_0x65f7('0x41')]['id']}})[_0x65f7('0x24')](handleEntityNotFound(_0x3b02b9,null))[_0x65f7('0x24')](removeEntity(_0x3b02b9,null))[_0x65f7('0x40')](handleError(_0x3b02b9,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 7cdb8b9..586ddfe 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 _0x63df=['../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x56917b,_0x210955){var _0x3577bc=function(_0x2e016b){while(--_0x2e016b){_0x56917b['push'](_0x56917b['shift']());}};_0x3577bc(++_0x210955);}(_0x63df,0xa1));var _0xf63d=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x63df[_0x2112d4];return _0x434972;};'use strict';var _=require(_0xf63d('0x0'));var util=require(_0xf63d('0x1'));var logger=require(_0xf63d('0x2'))(_0xf63d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf63d('0x4'));var fs=require('fs');var path=require(_0xf63d('0x5'));var rimraf=require(_0xf63d('0x6'));var config=require(_0xf63d('0x7'));var attributes=require(_0xf63d('0x8'));module[_0xf63d('0x9')]=function(_0xe527df,_0x13f16b){return _0xe527df[_0xf63d('0xa')](_0xf63d('0xb'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf1da=['bluebird','request-promise','./squareMessage.attributes','define','SquareMessage','square_messages','util','../../config/logger','moment'];(function(_0x137187,_0x55af6e){var _0x3ab5e1=function(_0x42745b){while(--_0x42745b){_0x137187['push'](_0x137187['shift']());}};_0x3ab5e1(++_0x55af6e);}(_0xf1da,0x165));var _0xaf1d=function(_0x2224d2,_0x295428){_0x2224d2=_0x2224d2-0x0;var _0x5cb690=_0xf1da[_0x2224d2];return _0x5cb690;};'use strict';var _=require('lodash');var util=require(_0xaf1d('0x0'));var logger=require(_0xaf1d('0x1'))('api');var moment=require(_0xaf1d('0x2'));var BPromise=require(_0xaf1d('0x3'));var rp=require(_0xaf1d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xaf1d('0x5'));module['exports']=function(_0x1f52cc,_0xfdddb5){return _0x1f52cc[_0xaf1d('0x6')](_0xaf1d('0x7'),attributes,{'tableName':_0xaf1d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index bcf3f4d..bdadc7e 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 _0x505c=['error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','debug','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4b4b0e,_0x6c674){var _0x4c2d91=function(_0x4d440d){while(--_0x4d440d){_0x4b4b0e['push'](_0x4b4b0e['shift']());}};_0x4c2d91(++_0x6c674);}(_0x505c,0xd7));var _0xc505=function(_0x2583a7,_0x3beef9){_0x2583a7=_0x2583a7-0x0;var _0x35de7b=_0x505c[_0x2583a7];return _0x35de7b;};'use strict';var _=require(_0xc505('0x0'));var util=require(_0xc505('0x1'));var moment=require(_0xc505('0x2'));var BPromise=require(_0xc505('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc505('0x4'));var logger=require('../../config/logger')(_0xc505('0x5'));var config=require(_0xc505('0x6'));var jayson=require(_0xc505('0x7'));var client=jayson[_0xc505('0x8')][_0xc505('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbb8f4f,_0x20c319,_0x42b624){return new BPromise(function(_0xb89a9d,_0x393e11){return client[_0xc505('0xa')](_0xbb8f4f,_0x42b624)[_0xc505('0xb')](function(_0x4ff151){logger[_0xc505('0xc')](_0xc505('0xd'),_0x20c319,'request\x20sent');logger['debug'](_0xc505('0xe'),_0x20c319,_0xc505('0xf'),JSON[_0xc505('0x10')](_0x4ff151));if(_0x4ff151[_0xc505('0x11')]){if(_0x4ff151[_0xc505('0x11')][_0xc505('0x12')]===0x1f4){logger['error'](_0xc505('0xd'),_0x20c319,_0x4ff151['error']['message']);return _0x393e11(_0x4ff151['error']['message']);}logger[_0xc505('0x11')]('SquareMessage,\x20%s,\x20%s',_0x20c319,_0x4ff151[_0xc505('0x11')]['message']);return _0xb89a9d(_0x4ff151[_0xc505('0x11')][_0xc505('0x13')]);}else{logger[_0xc505('0xc')](_0xc505('0xd'),_0x20c319,_0xc505('0xf'));_0xb89a9d(_0x4ff151[_0xc505('0x14')][_0xc505('0x13')]);}})[_0xc505('0x15')](function(_0x4ec985){logger[_0xc505('0x11')]('SquareMessage,\x20%s,\x20%s',_0x20c319,_0x4ec985);_0x393e11(_0x4ec985);});});}exports[_0xc505('0x16')]=function(_0x15fce8){var _0x44cdc1=this;return new Promise(function(_0x350fa2,_0x15dcde){return db[_0xc505('0x17')][_0xc505('0x18')](_0x15fce8[_0xc505('0x19')],{'raw':_0x15fce8[_0xc505('0x1a')]?_0x15fce8['options'][_0xc505('0x1b')]===undefined?!![]:![]:!![]})[_0xc505('0xb')](function(_0x4837a2){logger[_0xc505('0xc')]('CreateSquareMessage',_0x15fce8);logger[_0xc505('0x1c')](_0xc505('0x16'),_0x15fce8,JSON['stringify'](_0x4837a2));_0x350fa2(_0x4837a2);})[_0xc505('0x15')](function(_0x8ae6f1){logger[_0xc505('0x11')](_0xc505('0x16'),_0x8ae6f1[_0xc505('0x13')],_0x15fce8);_0x15dcde(_0x44cdc1[_0xc505('0x11')](0x1f4,_0x8ae6f1[_0xc505('0x13')]));});});}; \ No newline at end of file +var _0x1072=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SquareMessage','create','body','options','raw','CreateSquareMessage','debug','lodash','util','moment','bluebird','randomstring'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x1072,0xd3));var _0x2107=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x1072[_0xac151d];return _0x111dba;};'use strict';var _=require(_0x2107('0x0'));var util=require(_0x2107('0x1'));var moment=require(_0x2107('0x2'));var BPromise=require(_0x2107('0x3'));var rs=require(_0x2107('0x4'));var fs=require('fs');var Redis=require(_0x2107('0x5'));var db=require(_0x2107('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2107('0x7'))(_0x2107('0x8'));var config=require('../../config/environment');var jayson=require(_0x2107('0x9'));var client=jayson['client'][_0x2107('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22af86,_0x565d79,_0x44f3eb){return new BPromise(function(_0x36a154,_0x11f3a1){return client[_0x2107('0xb')](_0x22af86,_0x44f3eb)[_0x2107('0xc')](function(_0x38eddc){logger[_0x2107('0xd')](_0x2107('0xe'),_0x565d79,_0x2107('0xf'));logger['debug']('SquareMessage,\x20%s,\x20%s,\x20%s',_0x565d79,_0x2107('0xf'),JSON[_0x2107('0x10')](_0x38eddc));if(_0x38eddc[_0x2107('0x11')]){if(_0x38eddc[_0x2107('0x11')][_0x2107('0x12')]===0x1f4){logger[_0x2107('0x11')](_0x2107('0xe'),_0x565d79,_0x38eddc[_0x2107('0x11')][_0x2107('0x13')]);return _0x11f3a1(_0x38eddc[_0x2107('0x11')][_0x2107('0x13')]);}logger[_0x2107('0x11')](_0x2107('0xe'),_0x565d79,_0x38eddc['error'][_0x2107('0x13')]);return _0x36a154(_0x38eddc[_0x2107('0x11')]['message']);}else{logger['info'](_0x2107('0xe'),_0x565d79,_0x2107('0xf'));_0x36a154(_0x38eddc['result']['message']);}})['catch'](function(_0x4d54a8){logger[_0x2107('0x11')](_0x2107('0xe'),_0x565d79,_0x4d54a8);_0x11f3a1(_0x4d54a8);});});}exports['CreateSquareMessage']=function(_0x47eda3){var _0x1a2ae2=this;return new Promise(function(_0x39b069,_0x444f7f){return db[_0x2107('0x14')][_0x2107('0x15')](_0x47eda3[_0x2107('0x16')],{'raw':_0x47eda3[_0x2107('0x17')]?_0x47eda3['options'][_0x2107('0x18')]===undefined?!![]:![]:!![]})[_0x2107('0xc')](function(_0x1314a9){logger[_0x2107('0xd')](_0x2107('0x19'),_0x47eda3);logger[_0x2107('0x1a')](_0x2107('0x19'),_0x47eda3,JSON[_0x2107('0x10')](_0x1314a9));_0x39b069(_0x1314a9);})['catch'](function(_0x1a0d02){logger[_0x2107('0x11')](_0x2107('0x19'),_0x1a0d02[_0x2107('0x13')],_0x47eda3);_0x444f7f(_0x1a2ae2[_0x2107('0x11')](0x1f4,_0x1a0d02[_0x2107('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 0a318b4..1ea451b 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 _0xebb9=['get','isAuthenticated','index','/:id','/:id/test','15s','test','put','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/interaction/service','./squareOdbc.controller'];(function(_0x57efe4,_0x572b1b){var _0x4abbae=function(_0x5a6af9){while(--_0x5a6af9){_0x57efe4['push'](_0x57efe4['shift']());}};_0x4abbae(++_0x572b1b);}(_0xebb9,0x150));var _0x9ebb=function(_0x3d8ff,_0x20ece7){_0x3d8ff=_0x3d8ff-0x0;var _0x36da3d=_0xebb9[_0x3d8ff];return _0x36da3d;};'use strict';var multer=require(_0x9ebb('0x0'));var util=require('util');var path=require(_0x9ebb('0x1'));var timeout=require('connect-timeout');var express=require(_0x9ebb('0x2'));var router=express['Router']();var fs_extra=require(_0x9ebb('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9ebb('0x4'));var config=require('../../config/environment');var controller=require(_0x9ebb('0x5'));router[_0x9ebb('0x6')]('/',auth[_0x9ebb('0x7')](),controller[_0x9ebb('0x8')]);router[_0x9ebb('0x6')](_0x9ebb('0x9'),auth[_0x9ebb('0x7')](),controller['show']);router['get'](_0x9ebb('0xa'),auth[_0x9ebb('0x7')](),timeout(_0x9ebb('0xb')),controller[_0x9ebb('0xc')]);router['post']('/',auth[_0x9ebb('0x7')](),controller['create']);router[_0x9ebb('0xd')]('/:id',auth[_0x9ebb('0x7')](),controller[_0x9ebb('0xe')]);router[_0x9ebb('0xf')]('/:id',auth[_0x9ebb('0x7')](),controller[_0x9ebb('0x10')]);module[_0x9ebb('0x11')]=router; \ No newline at end of file +var _0x974c=['../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/:id/test','test','put','/:id','update','destroy','exports','util','path','express','Router'];(function(_0x1ad8e6,_0x389cff){var _0x1283fd=function(_0x165104){while(--_0x165104){_0x1ad8e6['push'](_0x1ad8e6['shift']());}};_0x1283fd(++_0x389cff);}(_0x974c,0x65));var _0xc974=function(_0x2962c5,_0x497c9b){_0x2962c5=_0x2962c5-0x0;var _0x4a8761=_0x974c[_0x2962c5];return _0x4a8761;};'use strict';var multer=require('multer');var util=require(_0xc974('0x0'));var path=require(_0xc974('0x1'));var timeout=require('connect-timeout');var express=require(_0xc974('0x2'));var router=express[_0xc974('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc974('0x4'));var interaction=require(_0xc974('0x5'));var config=require('../../config/environment');var controller=require('./squareOdbc.controller');router['get']('/',auth[_0xc974('0x6')](),controller['index']);router[_0xc974('0x7')]('/:id',auth[_0xc974('0x6')](),controller['show']);router['get'](_0xc974('0x8'),auth[_0xc974('0x6')](),timeout('15s'),controller[_0xc974('0x9')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xc974('0xa')](_0xc974('0xb'),auth[_0xc974('0x6')](),controller[_0xc974('0xc')]);router['delete']('/:id',auth[_0xc974('0x6')](),controller[_0xc974('0xd')]);module[_0xc974('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index bd81a4e..1a04db9 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 _0xeef0=['exports','name','STRING','sequelize'];(function(_0x869432,_0x298980){var _0x48a9cc=function(_0x3e4e8c){while(--_0x3e4e8c){_0x869432['push'](_0x869432['shift']());}};_0x48a9cc(++_0x298980);}(_0xeef0,0xef));var _0x0eef=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0xeef0[_0x4c445a];return _0x2f611c;};'use strict';var Sequelize=require(_0x0eef('0x0'));module[_0x0eef('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0eef('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x0eef('0x3')]},'description':{'type':Sequelize[_0x0eef('0x3')]}}; \ No newline at end of file +var _0x0842=['name','exports','STRING'];(function(_0x10c05b,_0x260792){var _0x605e68=function(_0x30b837){while(--_0x30b837){_0x10c05b['push'](_0x10c05b['shift']());}};_0x605e68(++_0x260792);}(_0x0842,0xa3));var _0x2084=function(_0x2c2cac,_0xd72cfe){_0x2c2cac=_0x2c2cac-0x0;var _0x2ee6e3=_0x0842[_0x2c2cac];return _0x2ee6e3;};'use strict';var Sequelize=require('sequelize');module[_0x2084('0x0')]={'name':{'type':Sequelize[_0x2084('0x1')],'unique':_0x2084('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x2084('0x1')]},'description':{'type':Sequelize[_0x2084('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index ed02148..34843ee 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 _0x6c07=['map','SquareOdbc','fieldName','model','keys','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','openSync','closeSync','eml-format','rimraf','fast-json-patch','request-promise','moment','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','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','ODBC','UserProfileResource','error','stack','name'];(function(_0x30cd7e,_0x4db10a){var _0x462a02=function(_0x157d81){while(--_0x157d81){_0x30cd7e['push'](_0x30cd7e['shift']());}};_0x462a02(++_0x4db10a);}(_0x6c07,0x185));var _0x76c0=function(_0x161bbe,_0x580d2b){_0x161bbe=_0x161bbe-0x0;var _0x206207=_0x6c07[_0x161bbe];return _0x206207;};'use strict';var emlformat=require(_0x76c0('0x0'));var rimraf=require(_0x76c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x76c0('0x2'));var rp=require(_0x76c0('0x3'));var moment=require(_0x76c0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x76c0('0x5'));var csv=require(_0x76c0('0x6'));var ejs=require(_0x76c0('0x7'));var fs=require('fs');var fs_extra=require(_0x76c0('0x8'));var _=require(_0x76c0('0x9'));var squel=require(_0x76c0('0xa'));var crypto=require(_0x76c0('0xb'));var jsforce=require(_0x76c0('0xc'));var deskjs=require(_0x76c0('0xd'));var toCsv=require(_0x76c0('0x6'));var querystring=require(_0x76c0('0xe'));var Papa=require('papaparse');var Redis=require(_0x76c0('0xf'));var authService=require(_0x76c0('0x10'));var qs=require(_0x76c0('0x11'));var as=require(_0x76c0('0x12'));var hardwareService=require(_0x76c0('0x13'));var logger=require(_0x76c0('0x14'))(_0x76c0('0x15'));var utils=require(_0x76c0('0x16'));var config=require(_0x76c0('0x17'));var licenseUtil=require(_0x76c0('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e8ec3,_0x2cffe8){_0x2cffe8=_0x2cffe8||0xcc;return function(_0x46b021){if(_0x46b021){return _0x3e8ec3[_0x76c0('0x19')](_0x2cffe8);}return _0x3e8ec3['status'](_0x2cffe8)[_0x76c0('0x1a')]();};}function respondWithResult(_0x1ed7fb,_0x2e52a5){_0x2e52a5=_0x2e52a5||0xc8;return function(_0xcf2024){if(_0xcf2024){return _0x1ed7fb[_0x76c0('0x1b')](_0x2e52a5)[_0x76c0('0x1c')](_0xcf2024);}};}function respondWithFilteredResult(_0x173de3,_0x487983){return function(_0x55976a){if(_0x55976a){var _0x60a3ed=typeof _0x487983[_0x76c0('0x1d')]===_0x76c0('0x1e')&&typeof _0x487983[_0x76c0('0x1f')]==='undefined';var _0x17c307=_0x55976a[_0x76c0('0x20')];var _0x508622=_0x60a3ed?0x0:_0x487983[_0x76c0('0x1d')];var _0x956fef=_0x60a3ed?_0x55976a[_0x76c0('0x20')]:_0x487983[_0x76c0('0x1d')]+_0x487983[_0x76c0('0x1f')];var _0x4c414d;if(_0x956fef>=_0x17c307){_0x956fef=_0x17c307;_0x4c414d=0xc8;}else{_0x4c414d=0xce;}_0x173de3['status'](_0x4c414d);return _0x173de3[_0x76c0('0x21')]('Content-Range',_0x508622+'-'+_0x956fef+'/'+_0x17c307)[_0x76c0('0x1c')](_0x55976a);}return null;};}function patchUpdates(_0x20ab61){return function(_0x433ed1){try{jsonpatch[_0x76c0('0x22')](_0x433ed1,_0x20ab61,!![]);}catch(_0x5811ec){return BPromise[_0x76c0('0x23')](_0x5811ec);}return _0x433ed1[_0x76c0('0x24')]();};}function saveUpdates(_0x494f74,_0x151e75){return function(_0x5da421){if(_0x5da421){return _0x5da421[_0x76c0('0x25')](_0x494f74)[_0x76c0('0x26')](function(_0x6d6776){return _0x6d6776;});}return null;};}function removeEntity(_0x4cdfbb,_0x4e534d){return function(_0x17d662){if(_0x17d662){return _0x17d662[_0x76c0('0x27')]()[_0x76c0('0x26')](function(){var _0x10d7d0=_0x17d662[_0x76c0('0x28')]({'plain':!![]});var _0xb747a1=_0x76c0('0x29');return db[_0x76c0('0x2a')][_0x76c0('0x27')]({'where':{'type':_0xb747a1,'resourceId':_0x10d7d0['id']}})[_0x76c0('0x26')](function(){return _0x17d662;});})[_0x76c0('0x26')](function(){_0x4cdfbb[_0x76c0('0x1b')](0xcc)[_0x76c0('0x1a')]();});}};}function handleEntityNotFound(_0x526ac9,_0x363558){return function(_0x32ecc5){if(!_0x32ecc5){_0x526ac9['sendStatus'](0x194);}return _0x32ecc5;};}function handleError(_0x137d2d,_0x85f5ae){_0x85f5ae=_0x85f5ae||0x1f4;return function(_0x29c915){logger[_0x76c0('0x2b')](_0x29c915[_0x76c0('0x2c')]);if(_0x29c915[_0x76c0('0x2d')]){delete _0x29c915[_0x76c0('0x2d')];}_0x137d2d[_0x76c0('0x1b')](_0x85f5ae)['send'](_0x29c915);};}exports['index']=function(_0x5639c8,_0x55765f){var _0x18ddac={},_0x33e758={},_0x5dc8e1={'count':0x0,'rows':[]};var _0x3a3bd8=_[_0x76c0('0x2e')](db[_0x76c0('0x2f')]['rawAttributes'],function(_0x5733c8){return{'name':_0x5733c8[_0x76c0('0x30')],'type':_0x5733c8['type']['key']};});_0x33e758[_0x76c0('0x31')]=_[_0x76c0('0x2e')](_0x3a3bd8,_0x76c0('0x2d'));_0x33e758['query']=_[_0x76c0('0x32')](_0x5639c8['query']);_0x33e758[_0x76c0('0x33')]=_['intersection'](_0x33e758[_0x76c0('0x31')],_0x33e758['query']);_0x18ddac['attributes']=_[_0x76c0('0x34')](_0x33e758['model'],qs[_0x76c0('0x35')](_0x5639c8[_0x76c0('0x36')][_0x76c0('0x35')]));_0x18ddac[_0x76c0('0x37')]=_0x18ddac[_0x76c0('0x37')][_0x76c0('0x38')]?_0x18ddac['attributes']:_0x33e758['model'];if(!_0x5639c8[_0x76c0('0x36')][_0x76c0('0x39')](_0x76c0('0x3a'))){_0x18ddac[_0x76c0('0x1f')]=qs[_0x76c0('0x1f')](_0x5639c8['query'][_0x76c0('0x1f')]);_0x18ddac[_0x76c0('0x1d')]=qs[_0x76c0('0x1d')](_0x5639c8[_0x76c0('0x36')][_0x76c0('0x1d')]);}_0x18ddac[_0x76c0('0x3b')]=qs['sort'](_0x5639c8[_0x76c0('0x36')][_0x76c0('0x3c')]);_0x18ddac[_0x76c0('0x3d')]=qs[_0x76c0('0x33')](_['pick'](_0x5639c8[_0x76c0('0x36')],_0x33e758['filters']),_0x3a3bd8);if(_0x5639c8[_0x76c0('0x36')][_0x76c0('0x3e')]){_0x18ddac[_0x76c0('0x3d')]=_['merge'](_0x18ddac['where'],{'$or':_[_0x76c0('0x2e')](_0x3a3bd8,function(_0x59c84b){if(_0x59c84b[_0x76c0('0x3f')]!==_0x76c0('0x40')){var _0x18cbcf={};_0x18cbcf[_0x59c84b[_0x76c0('0x2d')]]={'$like':'%'+_0x5639c8[_0x76c0('0x36')][_0x76c0('0x3e')]+'%'};return _0x18cbcf;}})});}_0x18ddac=_[_0x76c0('0x41')]({},_0x18ddac,_0x5639c8[_0x76c0('0x42')]);var _0x37defe={'where':_0x18ddac[_0x76c0('0x3d')]};return db[_0x76c0('0x2f')][_0x76c0('0x20')](_0x37defe)[_0x76c0('0x26')](function(_0x353e3c){_0x5dc8e1[_0x76c0('0x20')]=_0x353e3c;if(_0x5639c8[_0x76c0('0x36')]['includeAll']){_0x18ddac[_0x76c0('0x43')]=[{'all':!![]}];}return db['SquareOdbc'][_0x76c0('0x44')](_0x18ddac);})['then'](function(_0x2f5040){_0x5dc8e1[_0x76c0('0x45')]=_0x2f5040;return _0x5dc8e1;})['then'](respondWithFilteredResult(_0x55765f,_0x18ddac))['catch'](handleError(_0x55765f,null));};exports[_0x76c0('0x46')]=function(_0x3c041d,_0x278aa7){var _0x29ea2a={'raw':!![],'where':{'id':_0x3c041d[_0x76c0('0x47')]['id']}},_0x4d7835={};_0x4d7835[_0x76c0('0x31')]=_[_0x76c0('0x32')](db[_0x76c0('0x2f')][_0x76c0('0x48')]);_0x4d7835[_0x76c0('0x36')]=_['keys'](_0x3c041d['query']);_0x4d7835['filters']=_[_0x76c0('0x34')](_0x4d7835[_0x76c0('0x31')],_0x4d7835['query']);_0x29ea2a[_0x76c0('0x37')]=_[_0x76c0('0x34')](_0x4d7835[_0x76c0('0x31')],qs[_0x76c0('0x35')](_0x3c041d['query'][_0x76c0('0x35')]));_0x29ea2a[_0x76c0('0x37')]=_0x29ea2a['attributes']['length']?_0x29ea2a[_0x76c0('0x37')]:_0x4d7835[_0x76c0('0x31')];if(_0x3c041d[_0x76c0('0x36')]['includeAll']){_0x29ea2a[_0x76c0('0x43')]=[{'all':!![]}];}_0x29ea2a=_[_0x76c0('0x41')]({},_0x29ea2a,_0x3c041d[_0x76c0('0x42')]);return db[_0x76c0('0x2f')][_0x76c0('0x49')](_0x29ea2a)[_0x76c0('0x26')](handleEntityNotFound(_0x278aa7,null))['then'](respondWithResult(_0x278aa7,null))[_0x76c0('0x4a')](handleError(_0x278aa7,null));};exports[_0x76c0('0x4b')]=function(_0x24d493,_0x74004){return db[_0x76c0('0x2f')]['create'](_0x24d493[_0x76c0('0x4c')],{})[_0x76c0('0x26')](function(_0x1fa551){var _0x5d0119=_0x24d493['user']['get']({'plain':!![]});if(!_0x5d0119)throw new Error(_0x76c0('0x4d'));if(_0x5d0119[_0x76c0('0x4e')]===_0x76c0('0x4f')){var _0x33b6a7=_0x1fa551[_0x76c0('0x28')]({'plain':!![]});var _0x47dcb6=_0x76c0('0x29');return db[_0x76c0('0x50')][_0x76c0('0x49')]({'where':{'name':_0x47dcb6,'userProfileId':_0x5d0119[_0x76c0('0x51')]},'raw':!![]})['then'](function(_0x4fbdba){if(_0x4fbdba&&_0x4fbdba[_0x76c0('0x52')]===0x0){return db['UserProfileResource'][_0x76c0('0x4b')]({'name':_0x33b6a7[_0x76c0('0x2d')],'resourceId':_0x33b6a7['id'],'type':_0x4fbdba[_0x76c0('0x2d')],'sectionId':_0x4fbdba['id']},{})[_0x76c0('0x26')](function(){return _0x1fa551;});}else{return _0x1fa551;}})[_0x76c0('0x4a')](function(_0x308ae2){logger[_0x76c0('0x2b')](_0x76c0('0x53'),_0x308ae2);throw _0x308ae2;});}return _0x1fa551;})[_0x76c0('0x26')](respondWithResult(_0x74004,0xc9))[_0x76c0('0x4a')](handleError(_0x74004,null));};exports['update']=function(_0x54c891,_0x20b166){if(_0x54c891[_0x76c0('0x4c')]['id']){delete _0x54c891[_0x76c0('0x4c')]['id'];}return db[_0x76c0('0x2f')][_0x76c0('0x49')]({'where':{'id':_0x54c891[_0x76c0('0x47')]['id']}})[_0x76c0('0x26')](handleEntityNotFound(_0x20b166,null))[_0x76c0('0x26')](saveUpdates(_0x54c891['body'],null))[_0x76c0('0x26')](respondWithResult(_0x20b166,null))[_0x76c0('0x4a')](handleError(_0x20b166,null));};exports[_0x76c0('0x27')]=function(_0x559326,_0x39e19d){return db[_0x76c0('0x2f')][_0x76c0('0x49')]({'where':{'id':_0x559326[_0x76c0('0x47')]['id']}})[_0x76c0('0x26')](handleEntityNotFound(_0x39e19d,null))[_0x76c0('0x26')](removeEntity(_0x39e19d,null))['catch'](handleError(_0x39e19d,null));};exports[_0x76c0('0x54')]=function(_0x45a237,_0x7502c0,_0x2143b8){var _0x17f945;return db[_0x76c0('0x2f')][_0x76c0('0x49')]({'where':{'id':_0x45a237[_0x76c0('0x47')]['id']},'attributes':['id','dsn']})[_0x76c0('0x26')](handleEntityNotFound(_0x7502c0,null))['then'](function(_0x3c41c5){if(_0x3c41c5){var _0x4ad2e0=require('odbc')();_0x4ad2e0[_0x76c0('0x55')](_0x3c41c5['dsn']);_0x4ad2e0[_0x76c0('0x56')]();return _0x3c41c5;}})['then'](respondWithResult(_0x7502c0,null))[_0x76c0('0x4a')](handleError(_0x7502c0,null));}; \ No newline at end of file +var _0xcddd=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','get','ODBC','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','SquareOdbc','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','rows','show','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','params','dsn','odbc','openSync','closeSync','eml-format','rimraf','fast-json-patch','request-promise','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x57b861,_0xf2d2e8){var _0x2eaa9c=function(_0x52bae8){while(--_0x52bae8){_0x57b861['push'](_0x57b861['shift']());}};_0x2eaa9c(++_0xf2d2e8);}(_0xcddd,0xf0));var _0xdcdd=function(_0x4cb851,_0x2419bf){_0x4cb851=_0x4cb851-0x0;var _0x321887=_0xcddd[_0x4cb851];return _0x321887;};'use strict';var emlformat=require(_0xdcdd('0x0'));var rimraf=require(_0xdcdd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdcdd('0x2'));var rp=require(_0xdcdd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdcdd('0x4'));var path=require(_0xdcdd('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdcdd('0x6'));var fs=require('fs');var fs_extra=require(_0xdcdd('0x7'));var _=require(_0xdcdd('0x8'));var squel=require(_0xdcdd('0x9'));var crypto=require(_0xdcdd('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xdcdd('0xb'));var toCsv=require(_0xdcdd('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdcdd('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xdcdd('0xe'));var as=require(_0xdcdd('0xf'));var hardwareService=require(_0xdcdd('0x10'));var logger=require(_0xdcdd('0x11'))(_0xdcdd('0x12'));var utils=require(_0xdcdd('0x13'));var config=require(_0xdcdd('0x14'));var licenseUtil=require(_0xdcdd('0x15'));var db=require(_0xdcdd('0x16'))['db'];function respondWithStatusCode(_0x9e654c,_0x980a33){_0x980a33=_0x980a33||0xcc;return function(_0x51c031){if(_0x51c031){return _0x9e654c['sendStatus'](_0x980a33);}return _0x9e654c[_0xdcdd('0x17')](_0x980a33)['end']();};}function respondWithResult(_0x5eb38e,_0x1243d2){_0x1243d2=_0x1243d2||0xc8;return function(_0x2af802){if(_0x2af802){return _0x5eb38e[_0xdcdd('0x17')](_0x1243d2)[_0xdcdd('0x18')](_0x2af802);}};}function respondWithFilteredResult(_0x4690d5,_0x387110){return function(_0x35d4a4){if(_0x35d4a4){var _0x89cf6b=typeof _0x387110['offset']===_0xdcdd('0x19')&&typeof _0x387110[_0xdcdd('0x1a')]===_0xdcdd('0x19');var _0x27781b=_0x35d4a4[_0xdcdd('0x1b')];var _0x482969=_0x89cf6b?0x0:_0x387110[_0xdcdd('0x1c')];var _0x37b39d=_0x89cf6b?_0x35d4a4[_0xdcdd('0x1b')]:_0x387110[_0xdcdd('0x1c')]+_0x387110[_0xdcdd('0x1a')];var _0x442008;if(_0x37b39d>=_0x27781b){_0x37b39d=_0x27781b;_0x442008=0xc8;}else{_0x442008=0xce;}_0x4690d5[_0xdcdd('0x17')](_0x442008);return _0x4690d5['set']('Content-Range',_0x482969+'-'+_0x37b39d+'/'+_0x27781b)[_0xdcdd('0x18')](_0x35d4a4);}return null;};}function patchUpdates(_0x3aa8a6){return function(_0x40f38a){try{jsonpatch[_0xdcdd('0x1d')](_0x40f38a,_0x3aa8a6,!![]);}catch(_0x4b27fc){return BPromise[_0xdcdd('0x1e')](_0x4b27fc);}return _0x40f38a[_0xdcdd('0x1f')]();};}function saveUpdates(_0x1b6550,_0x125c10){return function(_0x6e933){if(_0x6e933){return _0x6e933[_0xdcdd('0x20')](_0x1b6550)[_0xdcdd('0x21')](function(_0x964f2f){return _0x964f2f;});}return null;};}function removeEntity(_0x71008a,_0x404dc9){return function(_0x41e9f6){if(_0x41e9f6){return _0x41e9f6[_0xdcdd('0x22')]()[_0xdcdd('0x21')](function(){var _0x47ec8e=_0x41e9f6[_0xdcdd('0x23')]({'plain':!![]});var _0x3100f6=_0xdcdd('0x24');return db[_0xdcdd('0x25')][_0xdcdd('0x22')]({'where':{'type':_0x3100f6,'resourceId':_0x47ec8e['id']}})[_0xdcdd('0x21')](function(){return _0x41e9f6;});})[_0xdcdd('0x21')](function(){_0x71008a[_0xdcdd('0x17')](0xcc)[_0xdcdd('0x26')]();});}};}function handleEntityNotFound(_0x1230ad,_0x1faf4f){return function(_0x2f3a61){if(!_0x2f3a61){_0x1230ad[_0xdcdd('0x27')](0x194);}return _0x2f3a61;};}function handleError(_0x32fc94,_0x5155e9){_0x5155e9=_0x5155e9||0x1f4;return function(_0x1391eb){logger[_0xdcdd('0x28')](_0x1391eb[_0xdcdd('0x29')]);if(_0x1391eb['name']){delete _0x1391eb[_0xdcdd('0x2a')];}_0x32fc94[_0xdcdd('0x17')](_0x5155e9)[_0xdcdd('0x2b')](_0x1391eb);};}exports[_0xdcdd('0x2c')]=function(_0x45dd9e,_0xc29859){var _0x4775b0={},_0x313ba4={},_0x283bbe={'count':0x0,'rows':[]};var _0x58b9aa=_[_0xdcdd('0x2d')](db[_0xdcdd('0x2e')][_0xdcdd('0x2f')],function(_0x570e77){return{'name':_0x570e77['fieldName'],'type':_0x570e77[_0xdcdd('0x30')][_0xdcdd('0x31')]};});_0x313ba4[_0xdcdd('0x32')]=_[_0xdcdd('0x2d')](_0x58b9aa,'name');_0x313ba4[_0xdcdd('0x33')]=_[_0xdcdd('0x34')](_0x45dd9e[_0xdcdd('0x33')]);_0x313ba4[_0xdcdd('0x35')]=_[_0xdcdd('0x36')](_0x313ba4[_0xdcdd('0x32')],_0x313ba4[_0xdcdd('0x33')]);_0x4775b0['attributes']=_['intersection'](_0x313ba4[_0xdcdd('0x32')],qs['fields'](_0x45dd9e[_0xdcdd('0x33')][_0xdcdd('0x37')]));_0x4775b0['attributes']=_0x4775b0[_0xdcdd('0x38')][_0xdcdd('0x39')]?_0x4775b0[_0xdcdd('0x38')]:_0x313ba4[_0xdcdd('0x32')];if(!_0x45dd9e[_0xdcdd('0x33')]['hasOwnProperty'](_0xdcdd('0x3a'))){_0x4775b0[_0xdcdd('0x1a')]=qs[_0xdcdd('0x1a')](_0x45dd9e['query'][_0xdcdd('0x1a')]);_0x4775b0['offset']=qs['offset'](_0x45dd9e[_0xdcdd('0x33')]['offset']);}_0x4775b0[_0xdcdd('0x3b')]=qs[_0xdcdd('0x3c')](_0x45dd9e[_0xdcdd('0x33')][_0xdcdd('0x3c')]);_0x4775b0[_0xdcdd('0x3d')]=qs[_0xdcdd('0x35')](_[_0xdcdd('0x3e')](_0x45dd9e[_0xdcdd('0x33')],_0x313ba4[_0xdcdd('0x35')]),_0x58b9aa);if(_0x45dd9e[_0xdcdd('0x33')][_0xdcdd('0x3f')]){_0x4775b0[_0xdcdd('0x3d')]=_[_0xdcdd('0x40')](_0x4775b0[_0xdcdd('0x3d')],{'$or':_[_0xdcdd('0x2d')](_0x58b9aa,function(_0x66f65){if(_0x66f65[_0xdcdd('0x30')]!=='VIRTUAL'){var _0x60b92f={};_0x60b92f[_0x66f65[_0xdcdd('0x2a')]]={'$like':'%'+_0x45dd9e[_0xdcdd('0x33')]['filter']+'%'};return _0x60b92f;}})});}_0x4775b0=_[_0xdcdd('0x40')]({},_0x4775b0,_0x45dd9e[_0xdcdd('0x41')]);var _0xcc583={'where':_0x4775b0[_0xdcdd('0x3d')]};return db[_0xdcdd('0x2e')][_0xdcdd('0x1b')](_0xcc583)[_0xdcdd('0x21')](function(_0x554f48){_0x283bbe[_0xdcdd('0x1b')]=_0x554f48;if(_0x45dd9e[_0xdcdd('0x33')][_0xdcdd('0x42')]){_0x4775b0['include']=[{'all':!![]}];}return db[_0xdcdd('0x2e')]['findAll'](_0x4775b0);})['then'](function(_0x33edf8){_0x283bbe[_0xdcdd('0x43')]=_0x33edf8;return _0x283bbe;})[_0xdcdd('0x21')](respondWithFilteredResult(_0xc29859,_0x4775b0))['catch'](handleError(_0xc29859,null));};exports[_0xdcdd('0x44')]=function(_0xb6f1e2,_0x4bc6b1){var _0x38230d={'raw':!![],'where':{'id':_0xb6f1e2['params']['id']}},_0x498134={};_0x498134[_0xdcdd('0x32')]=_[_0xdcdd('0x34')](db[_0xdcdd('0x2e')][_0xdcdd('0x2f')]);_0x498134[_0xdcdd('0x33')]=_['keys'](_0xb6f1e2[_0xdcdd('0x33')]);_0x498134[_0xdcdd('0x35')]=_[_0xdcdd('0x36')](_0x498134[_0xdcdd('0x32')],_0x498134[_0xdcdd('0x33')]);_0x38230d[_0xdcdd('0x38')]=_[_0xdcdd('0x36')](_0x498134[_0xdcdd('0x32')],qs[_0xdcdd('0x37')](_0xb6f1e2[_0xdcdd('0x33')][_0xdcdd('0x37')]));_0x38230d['attributes']=_0x38230d[_0xdcdd('0x38')][_0xdcdd('0x39')]?_0x38230d[_0xdcdd('0x38')]:_0x498134['model'];if(_0xb6f1e2[_0xdcdd('0x33')][_0xdcdd('0x42')]){_0x38230d[_0xdcdd('0x45')]=[{'all':!![]}];}_0x38230d=_[_0xdcdd('0x40')]({},_0x38230d,_0xb6f1e2[_0xdcdd('0x41')]);return db[_0xdcdd('0x2e')]['find'](_0x38230d)[_0xdcdd('0x21')](handleEntityNotFound(_0x4bc6b1,null))[_0xdcdd('0x21')](respondWithResult(_0x4bc6b1,null))[_0xdcdd('0x46')](handleError(_0x4bc6b1,null));};exports[_0xdcdd('0x47')]=function(_0x36956b,_0x554b21){return db[_0xdcdd('0x2e')][_0xdcdd('0x47')](_0x36956b[_0xdcdd('0x48')],{})['then'](function(_0x20a0be){var _0x1d39c9=_0x36956b[_0xdcdd('0x49')][_0xdcdd('0x23')]({'plain':!![]});if(!_0x1d39c9)throw new Error(_0xdcdd('0x4a'));if(_0x1d39c9[_0xdcdd('0x4b')]===_0xdcdd('0x49')){var _0x4dce86=_0x20a0be[_0xdcdd('0x23')]({'plain':!![]});var _0x286b73=_0xdcdd('0x24');return db[_0xdcdd('0x4c')][_0xdcdd('0x4d')]({'where':{'name':_0x286b73,'userProfileId':_0x1d39c9[_0xdcdd('0x4e')]},'raw':!![]})['then'](function(_0x55d1cb){if(_0x55d1cb&&_0x55d1cb['autoAssociation']===0x0){return db[_0xdcdd('0x25')][_0xdcdd('0x47')]({'name':_0x4dce86[_0xdcdd('0x2a')],'resourceId':_0x4dce86['id'],'type':_0x55d1cb[_0xdcdd('0x2a')],'sectionId':_0x55d1cb['id']},{})[_0xdcdd('0x21')](function(){return _0x20a0be;});}else{return _0x20a0be;}})[_0xdcdd('0x46')](function(_0x518080){logger[_0xdcdd('0x28')](_0xdcdd('0x4f'),_0x518080);throw _0x518080;});}return _0x20a0be;})['then'](respondWithResult(_0x554b21,0xc9))['catch'](handleError(_0x554b21,null));};exports[_0xdcdd('0x20')]=function(_0x1ddc9d,_0x1ad3e6){if(_0x1ddc9d[_0xdcdd('0x48')]['id']){delete _0x1ddc9d[_0xdcdd('0x48')]['id'];}return db[_0xdcdd('0x2e')][_0xdcdd('0x4d')]({'where':{'id':_0x1ddc9d['params']['id']}})[_0xdcdd('0x21')](handleEntityNotFound(_0x1ad3e6,null))[_0xdcdd('0x21')](saveUpdates(_0x1ddc9d['body'],null))[_0xdcdd('0x21')](respondWithResult(_0x1ad3e6,null))['catch'](handleError(_0x1ad3e6,null));};exports['destroy']=function(_0x30f851,_0x56ba7f){return db[_0xdcdd('0x2e')][_0xdcdd('0x4d')]({'where':{'id':_0x30f851['params']['id']}})[_0xdcdd('0x21')](handleEntityNotFound(_0x56ba7f,null))['then'](removeEntity(_0x56ba7f,null))['catch'](handleError(_0x56ba7f,null));};exports[_0xdcdd('0x50')]=function(_0x15f64e,_0x144eb5,_0x8133b7){var _0x1c9815;return db['SquareOdbc'][_0xdcdd('0x4d')]({'where':{'id':_0x15f64e[_0xdcdd('0x51')]['id']},'attributes':['id',_0xdcdd('0x52')]})[_0xdcdd('0x21')](handleEntityNotFound(_0x144eb5,null))[_0xdcdd('0x21')](function(_0x1c6014){if(_0x1c6014){var _0x1f957a=require(_0xdcdd('0x53'))();_0x1f957a[_0xdcdd('0x54')](_0x1c6014[_0xdcdd('0x52')]);_0x1f957a[_0xdcdd('0x55')]();return _0x1c6014;}})[_0xdcdd('0x21')](respondWithResult(_0x144eb5,null))['catch'](handleError(_0x144eb5,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index c943324..1fb6c93 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 _0xdc9c=['exports','define','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x430d92,_0x23b922){var _0x3b6d50=function(_0x59d73d){while(--_0x59d73d){_0x430d92['push'](_0x430d92['shift']());}};_0x3b6d50(++_0x23b922);}(_0xdc9c,0x87));var _0xcdc9=function(_0x47b64f,_0x394a7e){_0x47b64f=_0x47b64f-0x0;var _0x6e2293=_0xdc9c[_0x47b64f];return _0x6e2293;};'use strict';var _=require('lodash');var util=require(_0xcdc9('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xcdc9('0x1'));var rp=require(_0xcdc9('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcdc9('0x3'));var config=require(_0xcdc9('0x4'));var attributes=require('./squareOdbc.attributes');module[_0xcdc9('0x5')]=function(_0x92f0a7,_0x4e7801){return _0x92f0a7[_0xcdc9('0x6')]('SquareOdbc',attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb2d=['moment','path','rimraf','../../config/environment','./squareOdbc.attributes','define','SquareOdbc','lodash','util','api'];(function(_0x13329a,_0x2866b9){var _0x3560de=function(_0x538938){while(--_0x538938){_0x13329a['push'](_0x13329a['shift']());}};_0x3560de(++_0x2866b9);}(_0xfb2d,0x147));var _0xdfb2=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0xfb2d[_0x164af1];return _0x5d81a2;};'use strict';var _=require(_0xdfb2('0x0'));var util=require(_0xdfb2('0x1'));var logger=require('../../config/logger')(_0xdfb2('0x2'));var moment=require(_0xdfb2('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdfb2('0x4'));var rimraf=require(_0xdfb2('0x5'));var config=require(_0xdfb2('0x6'));var attributes=require(_0xdfb2('0x7'));module['exports']=function(_0x32df94,_0x3eeca9){return _0x32df94[_0xdfb2('0x8')](_0xdfb2('0x9'),attributes,{'tableName':'square_odbc','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 1a96ab7..eab8302 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 _0xe172=['debug','stringify','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent'];(function(_0x1347f8,_0x233feb){var _0x218368=function(_0x3f4ca3){while(--_0x3f4ca3){_0x1347f8['push'](_0x1347f8['shift']());}};_0x218368(++_0x233feb);}(_0xe172,0x170));var _0x2e17=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xe172[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x2e17('0x0'));var util=require(_0x2e17('0x1'));var moment=require(_0x2e17('0x2'));var BPromise=require(_0x2e17('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e17('0x4'));var db=require(_0x2e17('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e17('0x6'))(_0x2e17('0x7'));var config=require(_0x2e17('0x8'));var jayson=require(_0x2e17('0x9'));var client=jayson['client'][_0x2e17('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x203f9c,_0x35bb1e,_0x548a5a){return new BPromise(function(_0x53cd2d,_0x47d8d1){return client[_0x2e17('0xb')](_0x203f9c,_0x548a5a)[_0x2e17('0xc')](function(_0x52d9ba){logger[_0x2e17('0xd')](_0x2e17('0xe'),_0x35bb1e,_0x2e17('0xf'));logger[_0x2e17('0x10')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x35bb1e,_0x2e17('0xf'),JSON[_0x2e17('0x11')](_0x52d9ba));if(_0x52d9ba[_0x2e17('0x12')]){if(_0x52d9ba[_0x2e17('0x12')][_0x2e17('0x13')]===0x1f4){logger[_0x2e17('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x35bb1e,_0x52d9ba[_0x2e17('0x12')][_0x2e17('0x14')]);return _0x47d8d1(_0x52d9ba['error'][_0x2e17('0x14')]);}logger[_0x2e17('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x35bb1e,_0x52d9ba[_0x2e17('0x12')][_0x2e17('0x14')]);return _0x53cd2d(_0x52d9ba[_0x2e17('0x12')]['message']);}else{logger[_0x2e17('0xd')](_0x2e17('0xe'),_0x35bb1e,'request\x20sent');_0x53cd2d(_0x52d9ba[_0x2e17('0x15')][_0x2e17('0x14')]);}})[_0x2e17('0x16')](function(_0x2dabfc){logger['error'](_0x2e17('0xe'),_0x35bb1e,_0x2dabfc);_0x47d8d1(_0x2dabfc);});});}exports[_0x2e17('0x17')]=function(_0xd7a60){var _0x598bfa=this;return new Promise(function(_0x20f700,_0x533e92){return db[_0x2e17('0x18')][_0x2e17('0x19')]({'raw':_0xd7a60[_0x2e17('0x1a')]?_0xd7a60[_0x2e17('0x1a')][_0x2e17('0x1b')]===undefined?!![]:![]:!![],'where':_0xd7a60[_0x2e17('0x1a')]?_0xd7a60[_0x2e17('0x1a')]['where']||null:null,'attributes':_0xd7a60[_0x2e17('0x1a')]?_0xd7a60[_0x2e17('0x1a')][_0x2e17('0x1c')]||null:null,'include':_0xd7a60[_0x2e17('0x1a')]?_0xd7a60['options'][_0x2e17('0x1d')]?_['map'](_0xd7a60[_0x2e17('0x1a')][_0x2e17('0x1d')],function(_0x10ed1b){return{'model':db[_0x10ed1b['model']],'as':_0x10ed1b['as'],'attributes':_0x10ed1b[_0x2e17('0x1c')],'include':_0x10ed1b[_0x2e17('0x1d')]?_[_0x2e17('0x1e')](_0x10ed1b[_0x2e17('0x1d')],function(_0xb82b35){return{'model':db[_0xb82b35[_0x2e17('0x1f')]],'as':_0xb82b35['as'],'attributes':_0xb82b35[_0x2e17('0x1c')],'include':_0xb82b35[_0x2e17('0x1d')]?_[_0x2e17('0x1e')](_0xb82b35['include'],function(_0x4a8f80){return{'model':db[_0x4a8f80[_0x2e17('0x1f')]],'as':_0x4a8f80['as'],'attributes':_0x4a8f80[_0x2e17('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2e17('0xc')](function(_0x32d57e){logger[_0x2e17('0xd')](_0x2e17('0x17'),_0xd7a60);logger[_0x2e17('0x10')](_0x2e17('0x17'),_0xd7a60,JSON[_0x2e17('0x11')](_0x32d57e));_0x20f700(_0x32d57e);})[_0x2e17('0x16')](function(_0xc634dc){logger[_0x2e17('0x12')]('ShowSquareOdbc',_0xc634dc[_0x2e17('0x14')],_0xd7a60);_0x533e92(_0x598bfa[_0x2e17('0x12')](0x1f4,_0xc634dc[_0x2e17('0x14')]));});});}; \ No newline at end of file +var _0x414f=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','attributes','map','include','model','info','lodash','util','bluebird'];(function(_0x24989c,_0x3b9a9a){var _0x288947=function(_0x51102c){while(--_0x51102c){_0x24989c['push'](_0x24989c['shift']());}};_0x288947(++_0x3b9a9a);}(_0x414f,0xd5));var _0xf414=function(_0x1f2dda,_0x539c5f){_0x1f2dda=_0x1f2dda-0x0;var _0x29b49e=_0x414f[_0x1f2dda];return _0x29b49e;};'use strict';var _=require(_0xf414('0x0'));var util=require(_0xf414('0x1'));var moment=require('moment');var BPromise=require(_0xf414('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf414('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf414('0x4'))(_0xf414('0x5'));var config=require(_0xf414('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf414('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bd534,_0x112eb2,_0x28b30f){return new BPromise(function(_0x212202,_0x44d29d){return client[_0xf414('0x8')](_0x1bd534,_0x28b30f)[_0xf414('0x9')](function(_0x42a74d){logger['info'](_0xf414('0xa'),_0x112eb2,_0xf414('0xb'));logger['debug'](_0xf414('0xc'),_0x112eb2,_0xf414('0xb'),JSON[_0xf414('0xd')](_0x42a74d));if(_0x42a74d[_0xf414('0xe')]){if(_0x42a74d[_0xf414('0xe')]['code']===0x1f4){logger[_0xf414('0xe')]('SquareOdbc,\x20%s,\x20%s',_0x112eb2,_0x42a74d[_0xf414('0xe')][_0xf414('0xf')]);return _0x44d29d(_0x42a74d[_0xf414('0xe')][_0xf414('0xf')]);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x112eb2,_0x42a74d[_0xf414('0xe')][_0xf414('0xf')]);return _0x212202(_0x42a74d['error'][_0xf414('0xf')]);}else{logger['info'](_0xf414('0xa'),_0x112eb2,_0xf414('0xb'));_0x212202(_0x42a74d['result'][_0xf414('0xf')]);}})[_0xf414('0x10')](function(_0x2c97d3){logger[_0xf414('0xe')](_0xf414('0xa'),_0x112eb2,_0x2c97d3);_0x44d29d(_0x2c97d3);});});}exports[_0xf414('0x11')]=function(_0x5e60ad){var _0x75725b=this;return new Promise(function(_0x9734a3,_0x140979){return db[_0xf414('0x12')][_0xf414('0x13')]({'raw':_0x5e60ad[_0xf414('0x14')]?_0x5e60ad[_0xf414('0x14')][_0xf414('0x15')]===undefined?!![]:![]:!![],'where':_0x5e60ad['options']?_0x5e60ad[_0xf414('0x14')]['where']||null:null,'attributes':_0x5e60ad[_0xf414('0x14')]?_0x5e60ad[_0xf414('0x14')][_0xf414('0x16')]||null:null,'include':_0x5e60ad[_0xf414('0x14')]?_0x5e60ad[_0xf414('0x14')]['include']?_[_0xf414('0x17')](_0x5e60ad[_0xf414('0x14')][_0xf414('0x18')],function(_0x488994){return{'model':db[_0x488994['model']],'as':_0x488994['as'],'attributes':_0x488994[_0xf414('0x16')],'include':_0x488994[_0xf414('0x18')]?_[_0xf414('0x17')](_0x488994['include'],function(_0x2498ac){return{'model':db[_0x2498ac[_0xf414('0x19')]],'as':_0x2498ac['as'],'attributes':_0x2498ac[_0xf414('0x16')],'include':_0x2498ac[_0xf414('0x18')]?_[_0xf414('0x17')](_0x2498ac[_0xf414('0x18')],function(_0x1f0355){return{'model':db[_0x1f0355[_0xf414('0x19')]],'as':_0x1f0355['as'],'attributes':_0x1f0355[_0xf414('0x16')]};}):[]};}):[]};}):[]:[]})[_0xf414('0x9')](function(_0xde8791){logger[_0xf414('0x1a')](_0xf414('0x11'),_0x5e60ad);logger['debug']('ShowSquareOdbc',_0x5e60ad,JSON[_0xf414('0xd')](_0xde8791));_0x9734a3(_0xde8791);})[_0xf414('0x10')](function(_0x446e67){logger[_0xf414('0xe')]('ShowSquareOdbc',_0x446e67[_0xf414('0xf')],_0x5e60ad);_0x140979(_0x75725b['error'](0x1f4,_0x446e67[_0xf414('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 56057fd..9a19202 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 _0x321c=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./squareProject.controller','get','index','/:id','isAuthenticated','show','put','update','destroy'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x321c,0x199));var _0xc321=function(_0xca8b0b,_0x1aa33b){_0xca8b0b=_0xca8b0b-0x0;var _0x41c49c=_0x321c[_0xca8b0b];return _0x41c49c;};'use strict';var multer=require(_0xc321('0x0'));var util=require(_0xc321('0x1'));var path=require(_0xc321('0x2'));var timeout=require(_0xc321('0x3'));var express=require(_0xc321('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc321('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc321('0x6'));var controller=require(_0xc321('0x7'));router[_0xc321('0x8')]('/',auth['isAuthenticated'](),controller[_0xc321('0x9')]);router[_0xc321('0x8')](_0xc321('0xa'),auth[_0xc321('0xb')](),controller[_0xc321('0xc')]);router['post']('/',auth[_0xc321('0xb')](),controller['create']);router[_0xc321('0xd')](_0xc321('0xa'),auth[_0xc321('0xb')](),controller[_0xc321('0xe')]);router['delete'](_0xc321('0xa'),auth[_0xc321('0xb')](),controller[_0xc321('0xf')]);module[_0xc321('0x10')]=router; \ No newline at end of file +var _0xa839=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index'];(function(_0x5c587b,_0x3accf1){var _0x5207e8=function(_0xe78e02){while(--_0xe78e02){_0x5c587b['push'](_0x5c587b['shift']());}};_0x5207e8(++_0x3accf1);}(_0xa839,0x77));var _0x9a83=function(_0xd03507,_0x3a9258){_0xd03507=_0xd03507-0x0;var _0x8a76fa=_0xa839[_0xd03507];return _0x8a76fa;};'use strict';var multer=require(_0x9a83('0x0'));var util=require(_0x9a83('0x1'));var path=require('path');var timeout=require(_0x9a83('0x2'));var express=require(_0x9a83('0x3'));var router=express[_0x9a83('0x4')]();var fs_extra=require(_0x9a83('0x5'));var auth=require(_0x9a83('0x6'));var interaction=require(_0x9a83('0x7'));var config=require(_0x9a83('0x8'));var controller=require(_0x9a83('0x9'));router[_0x9a83('0xa')]('/',auth[_0x9a83('0xb')](),controller[_0x9a83('0xc')]);router[_0x9a83('0xa')](_0x9a83('0xd'),auth[_0x9a83('0xb')](),controller[_0x9a83('0xe')]);router[_0x9a83('0xf')]('/',auth[_0x9a83('0xb')](),controller[_0x9a83('0x10')]);router[_0x9a83('0x11')](_0x9a83('0xd'),auth['isAuthenticated'](),controller[_0x9a83('0x12')]);router[_0x9a83('0x13')](_0x9a83('0xd'),auth[_0x9a83('0xb')](),controller[_0x9a83('0x14')]);module[_0x9a83('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 5322a57..3aae4bc 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 _0xbb36=['TEXT','BLOB','getDataValue','preproduction','toString','utf8','long','production','DATE','sequelize','exports','STRING'];(function(_0xf18f5c,_0x547fbd){var _0x5b0939=function(_0x1824a5){while(--_0x1824a5){_0xf18f5c['push'](_0xf18f5c['shift']());}};_0x5b0939(++_0x547fbd);}(_0xbb36,0x105));var _0x6bb3=function(_0x199c77,_0xb8b6d7){_0x199c77=_0x199c77-0x0;var _0x57541d=_0xbb36[_0x199c77];return _0x57541d;};'use strict';var Sequelize=require(_0x6bb3('0x0'));module[_0x6bb3('0x1')]={'name':{'type':Sequelize[_0x6bb3('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x6bb3('0x2')]},'notes':{'type':Sequelize[_0x6bb3('0x3')]},'preproduction':{'type':Sequelize[_0x6bb3('0x4')]('long'),'get':function(){if(this[_0x6bb3('0x5')](_0x6bb3('0x6'))){return this[_0x6bb3('0x5')](_0x6bb3('0x6'))[_0x6bb3('0x7')](_0x6bb3('0x8'));}}},'production':{'type':Sequelize[_0x6bb3('0x4')](_0x6bb3('0x9')),'get':function(){if(this[_0x6bb3('0x5')]('production')){return this[_0x6bb3('0x5')](_0x6bb3('0xa'))[_0x6bb3('0x7')](_0x6bb3('0x8'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x6bb3('0xb')]}}; \ No newline at end of file +var _0x7e0a=['preproduction','utf8','long','production','DATE','sequelize','STRING','name','TEXT','BLOB','getDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e0a,0x15a));var _0xa7e0=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x7e0a[_0x36c5b0];return _0xf19333;};'use strict';var Sequelize=require(_0xa7e0('0x0'));module['exports']={'name':{'type':Sequelize[_0xa7e0('0x1')],'unique':_0xa7e0('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xa7e0('0x1')]},'notes':{'type':Sequelize[_0xa7e0('0x3')]},'preproduction':{'type':Sequelize[_0xa7e0('0x4')]('long'),'get':function(){if(this[_0xa7e0('0x5')](_0xa7e0('0x6'))){return this['getDataValue']('preproduction')['toString'](_0xa7e0('0x7'));}}},'production':{'type':Sequelize[_0xa7e0('0x4')](_0xa7e0('0x8')),'get':function(){if(this['getDataValue'](_0xa7e0('0x9'))){return this[_0xa7e0('0x5')](_0xa7e0('0x9'))['toString'](_0xa7e0('0x7'));}}},'savedAt':{'type':Sequelize[_0xa7e0('0xa')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 324ce4c..1402470 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 _0x2bf5=['userProfileId','autoAssociation','error','production','ioredis','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./squareProject.socket','status','json','limit','undefined','count','set','Content-Range','update','then','get','SquareProjects','UserProfileResource','destroy','publish','agi','stringify','end','stack','name','send','map','SquareProject','rawAttributes','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','offset','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x39c089,_0x4b7d7c){var _0x371a82=function(_0x121ce7){while(--_0x121ce7){_0x39c089['push'](_0x39c089['shift']());}};_0x371a82(++_0x4b7d7c);}(_0x2bf5,0xcd));var _0x52bf=function(_0x1bb7eb,_0x21b2b1){_0x1bb7eb=_0x1bb7eb-0x0;var _0x1ca17b=_0x2bf5[_0x1bb7eb];return _0x1ca17b;};'use strict';var _=require('lodash');var Redis=require(_0x52bf('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x52bf('0x1'))('api');var config=require(_0x52bf('0x2'));var db=require(_0x52bf('0x3'))['db'];config['redis']=_[_0x52bf('0x4')](config[_0x52bf('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x52bf('0x6'))(new Redis(config[_0x52bf('0x5')]));require(_0x52bf('0x7'))['register'](socket);function respondWithResult(_0x2a1f5b,_0x19fd33){_0x19fd33=_0x19fd33||0xc8;return function(_0x386bc7){if(_0x386bc7){return _0x2a1f5b[_0x52bf('0x8')](_0x19fd33)[_0x52bf('0x9')](_0x386bc7);}};}function respondWithFilteredResult(_0x4f986d,_0x119034){return function(_0x1d5cab){if(_0x1d5cab){var _0x4b5ae9=typeof _0x119034['offset']==='undefined'&&typeof _0x119034[_0x52bf('0xa')]===_0x52bf('0xb');var _0x517cd1=_0x1d5cab[_0x52bf('0xc')];var _0x19f316=_0x4b5ae9?0x0:_0x119034['offset'];var _0x40a636=_0x4b5ae9?_0x1d5cab[_0x52bf('0xc')]:_0x119034['offset']+_0x119034['limit'];var _0x5d9e03;if(_0x40a636>=_0x517cd1){_0x40a636=_0x517cd1;_0x5d9e03=0xc8;}else{_0x5d9e03=0xce;}_0x4f986d[_0x52bf('0x8')](_0x5d9e03);return _0x4f986d[_0x52bf('0xd')](_0x52bf('0xe'),_0x19f316+'-'+_0x40a636+'/'+_0x517cd1)[_0x52bf('0x9')](_0x1d5cab);}return null;};}function saveUpdates(_0x1bd124){return function(_0x45a81a){if(_0x45a81a){return _0x45a81a[_0x52bf('0xf')](_0x1bd124)[_0x52bf('0x10')](function(_0x4aa534){return _0x4aa534;});}return null;};}function removeEntity(_0x5e2a2d){return function(_0x5b2d82){if(_0x5b2d82){return _0x5b2d82['destroy']()[_0x52bf('0x10')](function(){var _0x19d28b=_0x5b2d82[_0x52bf('0x11')]({'plain':!![]});var _0xa4e85f=_0x52bf('0x12');return db[_0x52bf('0x13')][_0x52bf('0x14')]({'where':{'type':_0xa4e85f,'resourceId':_0x19d28b['id']}})['then'](function(){return _0x5b2d82;});})[_0x52bf('0x10')](function(){var _0x5e24f6=new Redis(config[_0x52bf('0x5')]);_0x5e24f6[_0x52bf('0x15')](_0x52bf('0x16'),JSON[_0x52bf('0x17')]({'id':_0x5b2d82['id'],'deleted':!![]}));})[_0x52bf('0x10')](function(){_0x5e2a2d[_0x52bf('0x8')](0xcc)[_0x52bf('0x18')]();});}};}function handleEntityNotFound(_0x2d57c3){return function(_0x53e51c){if(!_0x53e51c){_0x2d57c3['sendStatus'](0x194);}return _0x53e51c;};}function handleError(_0x5c34aa,_0xcd6e09){_0xcd6e09=_0xcd6e09||0x1f4;return function(_0xc12e21){logger['error'](_0xc12e21[_0x52bf('0x19')]);if(_0xc12e21[_0x52bf('0x1a')]){delete _0xc12e21[_0x52bf('0x1a')];}_0x5c34aa['status'](_0xcd6e09)[_0x52bf('0x1b')](_0xc12e21);};}exports['index']=function(_0x12c485,_0x3be2b1){var _0x2df1f8={},_0x56fc19={},_0x1226a6={'count':0x0,'rows':[]};var _0x467b9c=_[_0x52bf('0x1c')](db[_0x52bf('0x1d')][_0x52bf('0x1e')],function(_0x3806ba){return{'name':_0x3806ba['fieldName'],'type':_0x3806ba['type'][_0x52bf('0x1f')]};});_0x56fc19[_0x52bf('0x20')]=_[_0x52bf('0x1c')](_0x467b9c,_0x52bf('0x1a'));_0x56fc19['query']=_['keys'](_0x12c485['query']);_0x56fc19['filters']=_['intersection'](_0x56fc19[_0x52bf('0x20')],_0x56fc19[_0x52bf('0x21')]);_0x2df1f8['attributes']=_[_0x52bf('0x22')](_0x56fc19['model'],qs[_0x52bf('0x23')](_0x12c485['query'][_0x52bf('0x23')]));_0x2df1f8['attributes']=_0x2df1f8[_0x52bf('0x24')]['length']?_0x2df1f8[_0x52bf('0x24')]:_0x56fc19[_0x52bf('0x20')];if(!_0x12c485[_0x52bf('0x21')][_0x52bf('0x25')](_0x52bf('0x26'))){_0x2df1f8['limit']=qs[_0x52bf('0xa')](_0x12c485['query'][_0x52bf('0xa')]);_0x2df1f8[_0x52bf('0x27')]=qs[_0x52bf('0x27')](_0x12c485[_0x52bf('0x21')][_0x52bf('0x27')]);}_0x2df1f8['order']=qs[_0x52bf('0x28')](_0x12c485[_0x52bf('0x21')]['sort']);_0x2df1f8[_0x52bf('0x29')]=qs[_0x52bf('0x2a')](_[_0x52bf('0x2b')](_0x12c485['query'],_0x56fc19[_0x52bf('0x2a')]),_0x467b9c);if(_0x12c485[_0x52bf('0x21')]['filter']){_0x2df1f8['where']=_[_0x52bf('0x2c')](_0x2df1f8[_0x52bf('0x29')],{'$or':_['map'](_0x467b9c,function(_0x4ef442){if(_0x4ef442['type']!=='VIRTUAL'){var _0xcac48a={};_0xcac48a[_0x4ef442[_0x52bf('0x1a')]]={'$like':'%'+_0x12c485['query'][_0x52bf('0x2d')]+'%'};return _0xcac48a;}})});}_0x2df1f8=_[_0x52bf('0x2c')]({},_0x2df1f8,_0x12c485[_0x52bf('0x2e')]);var _0x4f1e9a={'where':_0x2df1f8['where']};return db[_0x52bf('0x1d')][_0x52bf('0xc')](_0x4f1e9a)[_0x52bf('0x10')](function(_0x2d33bd){_0x1226a6[_0x52bf('0xc')]=_0x2d33bd;if(_0x12c485['query'][_0x52bf('0x2f')]){_0x2df1f8[_0x52bf('0x30')]=[{'all':!![]}];}return db[_0x52bf('0x1d')][_0x52bf('0x31')](_0x2df1f8);})[_0x52bf('0x10')](function(_0x39f109){_0x1226a6[_0x52bf('0x32')]=_0x39f109;return _0x1226a6;})[_0x52bf('0x10')](respondWithFilteredResult(_0x3be2b1,_0x2df1f8))[_0x52bf('0x33')](handleError(_0x3be2b1,null));};exports[_0x52bf('0x34')]=function(_0x48e37e,_0x2abbad){var _0x1c45d={'raw':![],'where':{'id':_0x48e37e[_0x52bf('0x35')]['id']}},_0x760ea5={};_0x760ea5[_0x52bf('0x20')]=_[_0x52bf('0x36')](db[_0x52bf('0x1d')][_0x52bf('0x1e')]);_0x760ea5['query']=_[_0x52bf('0x36')](_0x48e37e[_0x52bf('0x21')]);_0x760ea5['filters']=_[_0x52bf('0x22')](_0x760ea5['model'],_0x760ea5[_0x52bf('0x21')]);_0x1c45d[_0x52bf('0x24')]=_[_0x52bf('0x22')](_0x760ea5['model'],qs['fields'](_0x48e37e[_0x52bf('0x21')]['fields']));_0x1c45d[_0x52bf('0x24')]=_0x1c45d[_0x52bf('0x24')][_0x52bf('0x37')]?_0x1c45d[_0x52bf('0x24')]:_0x760ea5['model'];if(_0x48e37e['query']['includeAll']){_0x1c45d[_0x52bf('0x30')]=[{'all':!![]}];}_0x1c45d=_[_0x52bf('0x2c')]({},_0x1c45d,_0x48e37e[_0x52bf('0x2e')]);return db[_0x52bf('0x1d')][_0x52bf('0x38')](_0x1c45d)[_0x52bf('0x10')](handleEntityNotFound(_0x2abbad,null))[_0x52bf('0x10')](respondWithResult(_0x2abbad,null))[_0x52bf('0x33')](handleError(_0x2abbad,null));};exports[_0x52bf('0x39')]=function(_0x1dd55e,_0x32b720){return db[_0x52bf('0x1d')][_0x52bf('0x39')](_0x1dd55e[_0x52bf('0x3a')],{})['then'](function(_0x4338d5){var _0x4d2cab=_0x1dd55e[_0x52bf('0x3b')]['get']({'plain':!![]});if(!_0x4d2cab)throw new Error(_0x52bf('0x3c'));if(_0x4d2cab[_0x52bf('0x3d')]==='user'){var _0x226088=_0x4338d5[_0x52bf('0x11')]({'plain':!![]});var _0x261608=_0x52bf('0x12');return db[_0x52bf('0x3e')][_0x52bf('0x38')]({'where':{'name':_0x261608,'userProfileId':_0x4d2cab[_0x52bf('0x3f')]},'raw':!![]})[_0x52bf('0x10')](function(_0x3a7f3c){if(_0x3a7f3c&&_0x3a7f3c[_0x52bf('0x40')]===0x0){return db['UserProfileResource'][_0x52bf('0x39')]({'name':_0x226088[_0x52bf('0x1a')],'resourceId':_0x226088['id'],'type':_0x3a7f3c[_0x52bf('0x1a')],'sectionId':_0x3a7f3c['id']},{})[_0x52bf('0x10')](function(){return _0x4338d5;});}else{return _0x4338d5;}})[_0x52bf('0x33')](function(_0x204210){logger[_0x52bf('0x41')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x204210);throw _0x204210;});}return _0x4338d5;})[_0x52bf('0x10')](respondWithResult(_0x32b720,0xc9))[_0x52bf('0x33')](handleError(_0x32b720,null));};exports[_0x52bf('0xf')]=function(_0xd29812,_0x490a34){if(_0xd29812['body']['id']){delete _0xd29812['body']['id'];}return db[_0x52bf('0x1d')][_0x52bf('0x38')]({'where':{'id':_0xd29812[_0x52bf('0x35')]['id']}})['then'](handleEntityNotFound(_0x490a34,null))[_0x52bf('0x10')](saveUpdates(_0xd29812['body'],null))['then'](function(_0x331fd7){if(!_0x331fd7)return;var _0x47750c=_0x331fd7['get']({'plain':!![]});return _0x47750c;})[_0x52bf('0x10')](function(_0x20a059){var _0x9892ad=new Redis(config[_0x52bf('0x5')]);_0x9892ad['publish']('agi',JSON[_0x52bf('0x17')](_[_0x52bf('0x2b')](_0x20a059,['id',_0x52bf('0x1a'),_0x52bf('0x42')])));return _0x20a059;})[_0x52bf('0x10')](respondWithResult(_0x490a34,null))[_0x52bf('0x33')](handleError(_0x490a34,null));};exports['destroy']=function(_0x22cebe,_0x3e670b){return db[_0x52bf('0x1d')][_0x52bf('0x38')]({'where':{'id':_0x22cebe[_0x52bf('0x35')]['id']}})[_0x52bf('0x10')](handleEntityNotFound(_0x3e670b,null))[_0x52bf('0x10')](removeEntity(_0x3e670b,null))[_0x52bf('0x33')](handleError(_0x3e670b,null));}; \ No newline at end of file +var _0x3318=['rows','catch','params','rawAttributes','fields','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','update','pick','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','status','json','offset','undefined','limit','count','set','then','destroy','get','SquareProjects','UserProfileResource','publish','agi','stringify','sendStatus','error','stack','name','send','SquareProject','fieldName','type','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll'];(function(_0x290ba2,_0x42b61f){var _0x5f172c=function(_0x549791){while(--_0x549791){_0x290ba2['push'](_0x290ba2['shift']());}};_0x5f172c(++_0x42b61f);}(_0x3318,0x124));var _0x8331=function(_0x1a3848,_0x28dc57){_0x1a3848=_0x1a3848-0x0;var _0x287b0f=_0x3318[_0x1a3848];return _0x287b0f;};'use strict';var _=require(_0x8331('0x0'));var Redis=require(_0x8331('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x8331('0x2'))(_0x8331('0x3'));var config=require(_0x8331('0x4'));var db=require(_0x8331('0x5'))['db'];config[_0x8331('0x6')]=_[_0x8331('0x7')](config[_0x8331('0x6')],{'host':_0x8331('0x8'),'port':0x18eb});var socket=require(_0x8331('0x9'))(new Redis(config[_0x8331('0x6')]));require(_0x8331('0xa'))['register'](socket);function respondWithResult(_0x333204,_0x401494){_0x401494=_0x401494||0xc8;return function(_0x5eb9eb){if(_0x5eb9eb){return _0x333204[_0x8331('0xb')](_0x401494)[_0x8331('0xc')](_0x5eb9eb);}};}function respondWithFilteredResult(_0x5ba390,_0xc60b75){return function(_0x154366){if(_0x154366){var _0x5b08ee=typeof _0xc60b75[_0x8331('0xd')]===_0x8331('0xe')&&typeof _0xc60b75[_0x8331('0xf')]===_0x8331('0xe');var _0x29e850=_0x154366[_0x8331('0x10')];var _0x4dc8c6=_0x5b08ee?0x0:_0xc60b75[_0x8331('0xd')];var _0x558795=_0x5b08ee?_0x154366[_0x8331('0x10')]:_0xc60b75[_0x8331('0xd')]+_0xc60b75[_0x8331('0xf')];var _0x2d3db3;if(_0x558795>=_0x29e850){_0x558795=_0x29e850;_0x2d3db3=0xc8;}else{_0x2d3db3=0xce;}_0x5ba390[_0x8331('0xb')](_0x2d3db3);return _0x5ba390[_0x8331('0x11')]('Content-Range',_0x4dc8c6+'-'+_0x558795+'/'+_0x29e850)[_0x8331('0xc')](_0x154366);}return null;};}function saveUpdates(_0x924a3d){return function(_0x1ba468){if(_0x1ba468){return _0x1ba468['update'](_0x924a3d)[_0x8331('0x12')](function(_0x2a3f64){return _0x2a3f64;});}return null;};}function removeEntity(_0x5d3c25){return function(_0x3650ff){if(_0x3650ff){return _0x3650ff[_0x8331('0x13')]()[_0x8331('0x12')](function(){var _0x580390=_0x3650ff[_0x8331('0x14')]({'plain':!![]});var _0x330323=_0x8331('0x15');return db[_0x8331('0x16')]['destroy']({'where':{'type':_0x330323,'resourceId':_0x580390['id']}})[_0x8331('0x12')](function(){return _0x3650ff;});})[_0x8331('0x12')](function(){var _0x191821=new Redis(config[_0x8331('0x6')]);_0x191821[_0x8331('0x17')](_0x8331('0x18'),JSON[_0x8331('0x19')]({'id':_0x3650ff['id'],'deleted':!![]}));})[_0x8331('0x12')](function(){_0x5d3c25['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c0f27){return function(_0x429143){if(!_0x429143){_0x5c0f27[_0x8331('0x1a')](0x194);}return _0x429143;};}function handleError(_0xadeb97,_0x54f19a){_0x54f19a=_0x54f19a||0x1f4;return function(_0xe85c4){logger[_0x8331('0x1b')](_0xe85c4[_0x8331('0x1c')]);if(_0xe85c4[_0x8331('0x1d')]){delete _0xe85c4['name'];}_0xadeb97['status'](_0x54f19a)[_0x8331('0x1e')](_0xe85c4);};}exports['index']=function(_0x3ac259,_0x48c4d1){var _0xeda099={},_0xf01466={},_0xb6cbe8={'count':0x0,'rows':[]};var _0x306d7b=_['map'](db[_0x8331('0x1f')]['rawAttributes'],function(_0x2cf7a3){return{'name':_0x2cf7a3[_0x8331('0x20')],'type':_0x2cf7a3[_0x8331('0x21')]['key']};});_0xf01466[_0x8331('0x22')]=_[_0x8331('0x23')](_0x306d7b,_0x8331('0x1d'));_0xf01466[_0x8331('0x24')]=_[_0x8331('0x25')](_0x3ac259[_0x8331('0x24')]);_0xf01466[_0x8331('0x26')]=_[_0x8331('0x27')](_0xf01466[_0x8331('0x22')],_0xf01466['query']);_0xeda099[_0x8331('0x28')]=_[_0x8331('0x27')](_0xf01466['model'],qs['fields'](_0x3ac259[_0x8331('0x24')]['fields']));_0xeda099[_0x8331('0x28')]=_0xeda099[_0x8331('0x28')][_0x8331('0x29')]?_0xeda099[_0x8331('0x28')]:_0xf01466[_0x8331('0x22')];if(!_0x3ac259[_0x8331('0x24')][_0x8331('0x2a')](_0x8331('0x2b'))){_0xeda099['limit']=qs['limit'](_0x3ac259[_0x8331('0x24')]['limit']);_0xeda099[_0x8331('0xd')]=qs[_0x8331('0xd')](_0x3ac259[_0x8331('0x24')][_0x8331('0xd')]);}_0xeda099[_0x8331('0x2c')]=qs[_0x8331('0x2d')](_0x3ac259[_0x8331('0x24')][_0x8331('0x2d')]);_0xeda099[_0x8331('0x2e')]=qs['filters'](_['pick'](_0x3ac259['query'],_0xf01466[_0x8331('0x26')]),_0x306d7b);if(_0x3ac259[_0x8331('0x24')][_0x8331('0x2f')]){_0xeda099['where']=_['merge'](_0xeda099[_0x8331('0x2e')],{'$or':_[_0x8331('0x23')](_0x306d7b,function(_0x390749){if(_0x390749[_0x8331('0x21')]!==_0x8331('0x30')){var _0x1dab80={};_0x1dab80[_0x390749[_0x8331('0x1d')]]={'$like':'%'+_0x3ac259[_0x8331('0x24')][_0x8331('0x2f')]+'%'};return _0x1dab80;}})});}_0xeda099=_['merge']({},_0xeda099,_0x3ac259[_0x8331('0x31')]);var _0x40213c={'where':_0xeda099[_0x8331('0x2e')]};return db[_0x8331('0x1f')][_0x8331('0x10')](_0x40213c)[_0x8331('0x12')](function(_0x2cf8a3){_0xb6cbe8[_0x8331('0x10')]=_0x2cf8a3;if(_0x3ac259[_0x8331('0x24')][_0x8331('0x32')]){_0xeda099[_0x8331('0x33')]=[{'all':!![]}];}return db[_0x8331('0x1f')][_0x8331('0x34')](_0xeda099);})[_0x8331('0x12')](function(_0x393880){_0xb6cbe8[_0x8331('0x35')]=_0x393880;return _0xb6cbe8;})[_0x8331('0x12')](respondWithFilteredResult(_0x48c4d1,_0xeda099))[_0x8331('0x36')](handleError(_0x48c4d1,null));};exports['show']=function(_0x25385e,_0xf4c74f){var _0x2c8f98={'raw':![],'where':{'id':_0x25385e[_0x8331('0x37')]['id']}},_0x349cbc={};_0x349cbc[_0x8331('0x22')]=_[_0x8331('0x25')](db[_0x8331('0x1f')][_0x8331('0x38')]);_0x349cbc[_0x8331('0x24')]=_[_0x8331('0x25')](_0x25385e[_0x8331('0x24')]);_0x349cbc[_0x8331('0x26')]=_[_0x8331('0x27')](_0x349cbc[_0x8331('0x22')],_0x349cbc[_0x8331('0x24')]);_0x2c8f98['attributes']=_[_0x8331('0x27')](_0x349cbc[_0x8331('0x22')],qs[_0x8331('0x39')](_0x25385e[_0x8331('0x24')][_0x8331('0x39')]));_0x2c8f98[_0x8331('0x28')]=_0x2c8f98[_0x8331('0x28')][_0x8331('0x29')]?_0x2c8f98[_0x8331('0x28')]:_0x349cbc[_0x8331('0x22')];if(_0x25385e[_0x8331('0x24')][_0x8331('0x32')]){_0x2c8f98[_0x8331('0x33')]=[{'all':!![]}];}_0x2c8f98=_[_0x8331('0x3a')]({},_0x2c8f98,_0x25385e[_0x8331('0x31')]);return db[_0x8331('0x1f')][_0x8331('0x3b')](_0x2c8f98)[_0x8331('0x12')](handleEntityNotFound(_0xf4c74f,null))[_0x8331('0x12')](respondWithResult(_0xf4c74f,null))[_0x8331('0x36')](handleError(_0xf4c74f,null));};exports[_0x8331('0x3c')]=function(_0x523ef9,_0x513ee3){return db[_0x8331('0x1f')][_0x8331('0x3c')](_0x523ef9[_0x8331('0x3d')],{})[_0x8331('0x12')](function(_0xf9ba3b){var _0x16ab37=_0x523ef9[_0x8331('0x3e')][_0x8331('0x14')]({'plain':!![]});if(!_0x16ab37)throw new Error(_0x8331('0x3f'));if(_0x16ab37[_0x8331('0x40')]==='user'){var _0x5ab970=_0xf9ba3b[_0x8331('0x14')]({'plain':!![]});var _0x4cef5d=_0x8331('0x15');return db[_0x8331('0x41')][_0x8331('0x3b')]({'where':{'name':_0x4cef5d,'userProfileId':_0x16ab37[_0x8331('0x42')]},'raw':!![]})[_0x8331('0x12')](function(_0xddb215){if(_0xddb215&&_0xddb215['autoAssociation']===0x0){return db['UserProfileResource'][_0x8331('0x3c')]({'name':_0x5ab970[_0x8331('0x1d')],'resourceId':_0x5ab970['id'],'type':_0xddb215['name'],'sectionId':_0xddb215['id']},{})['then'](function(){return _0xf9ba3b;});}else{return _0xf9ba3b;}})['catch'](function(_0x705eb7){logger[_0x8331('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x705eb7);throw _0x705eb7;});}return _0xf9ba3b;})[_0x8331('0x12')](respondWithResult(_0x513ee3,0xc9))[_0x8331('0x36')](handleError(_0x513ee3,null));};exports[_0x8331('0x43')]=function(_0x4920a4,_0x15fc83){if(_0x4920a4['body']['id']){delete _0x4920a4['body']['id'];}return db[_0x8331('0x1f')][_0x8331('0x3b')]({'where':{'id':_0x4920a4[_0x8331('0x37')]['id']}})[_0x8331('0x12')](handleEntityNotFound(_0x15fc83,null))['then'](saveUpdates(_0x4920a4[_0x8331('0x3d')],null))[_0x8331('0x12')](function(_0x21d7b4){if(!_0x21d7b4)return;var _0xcb8d2c=_0x21d7b4['get']({'plain':!![]});return _0xcb8d2c;})[_0x8331('0x12')](function(_0x25f2f8){var _0x270048=new Redis(config[_0x8331('0x6')]);_0x270048['publish']('agi',JSON['stringify'](_[_0x8331('0x44')](_0x25f2f8,['id',_0x8331('0x1d'),'production'])));return _0x25f2f8;})[_0x8331('0x12')](respondWithResult(_0x15fc83,null))['catch'](handleError(_0x15fc83,null));};exports[_0x8331('0x13')]=function(_0x5096e8,_0x4c8c3a){return db[_0x8331('0x1f')][_0x8331('0x3b')]({'where':{'id':_0x5096e8[_0x8331('0x37')]['id']}})[_0x8331('0x12')](handleEntityNotFound(_0x4c8c3a,null))[_0x8331('0x12')](removeEntity(_0x4c8c3a,null))[_0x8331('0x36')](handleError(_0x4c8c3a,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 01d5070..513a242 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 _0x2fcf=['hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','remove','emit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2fcf,0x9b));var _0xf2fc=function(_0xb11639,_0x9c8aa8){_0xb11639=_0xb11639-0x0;var _0x2f87de=_0x2fcf[_0xb11639];return _0x2f87de;};'use strict';var EventEmitter=require(_0xf2fc('0x0'));var SquareProject=require(_0xf2fc('0x1'))['db'][_0xf2fc('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf2fc('0x3')};function emitEvent(_0x4b9dad){return function(_0x4c7e7e,_0x52d6c8,_0x174dbf){SquareProjectEvents[_0xf2fc('0x4')](_0x4b9dad+':'+_0x4c7e7e['id'],_0x4c7e7e);SquareProjectEvents[_0xf2fc('0x4')](_0x4b9dad,_0x4c7e7e);_0x174dbf(null);};}for(var e in events){if(events[_0xf2fc('0x5')](e)){var event=events[e];SquareProject[_0xf2fc('0x6')](e,emitEvent(event));}}module[_0xf2fc('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x01d7=['emit','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update'];(function(_0xd02554,_0x20e086){var _0x3ed600=function(_0x5890f5){while(--_0x5890f5){_0xd02554['push'](_0xd02554['shift']());}};_0x3ed600(++_0x20e086);}(_0x01d7,0x9a));var _0x701d=function(_0x1b5435,_0x1f812c){_0x1b5435=_0x1b5435-0x0;var _0x49e14f=_0x01d7[_0x1b5435];return _0x49e14f;};'use strict';var EventEmitter=require(_0x701d('0x0'));var SquareProject=require(_0x701d('0x1'))['db'][_0x701d('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x701d('0x3')](0x0);var events={'afterCreate':_0x701d('0x4'),'afterUpdate':_0x701d('0x5'),'afterDestroy':'remove'};function emitEvent(_0xceba5c){return function(_0x3bbd1e,_0x4474fc,_0x10cced){SquareProjectEvents[_0x701d('0x6')](_0xceba5c+':'+_0x3bbd1e['id'],_0x3bbd1e);SquareProjectEvents[_0x701d('0x6')](_0xceba5c,_0x3bbd1e);_0x10cced(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x701d('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 864245f..a56ed34 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 _0x96b2=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./squareProject.attributes','exports','define','changed','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','production','format','util'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x96b2,0x1cf));var _0x296b=function(_0x37d307,_0xd5b663){_0x37d307=_0x37d307-0x0;var _0xc19be1=_0x96b2[_0x37d307];return _0xc19be1;};'use strict';var _=require('lodash');var util=require(_0x296b('0x0'));var logger=require(_0x296b('0x1'))(_0x296b('0x2'));var moment=require('moment');var BPromise=require(_0x296b('0x3'));var rp=require(_0x296b('0x4'));var fs=require('fs');var path=require(_0x296b('0x5'));var rimraf=require('rimraf');var config=require(_0x296b('0x6'));var attributes=require(_0x296b('0x7'));module[_0x296b('0x8')]=function(_0x1a97b7,_0x57cba3){return _0x1a97b7[_0x296b('0x9')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5fe136,_0x22d3a2,_0x15ecbe){if(_0x5fe136[_0x296b('0xa')](_0x296b('0xb'))){_0x5fe136[_0x296b('0xc')]=moment()['format'](_0x296b('0xd'));}if(_0x5fe136[_0x296b('0xa')](_0x296b('0xe'))){_0x5fe136['publishedAt']=moment()[_0x296b('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x15ecbe(null,_0x5fe136);}}});}; \ No newline at end of file +var _0x0812=['define','SquareProject','square_projects','changed','preproduction','savedAt','publishedAt','format','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./squareProject.attributes','exports'];(function(_0x30f030,_0xd03b7a){var _0xf7614f=function(_0x261cac){while(--_0x261cac){_0x30f030['push'](_0x30f030['shift']());}};_0xf7614f(++_0xd03b7a);}(_0x0812,0xaa));var _0x2081=function(_0xca2d0c,_0x27bcce){_0xca2d0c=_0xca2d0c-0x0;var _0x221fa8=_0x0812[_0xca2d0c];return _0x221fa8;};'use strict';var _=require(_0x2081('0x0'));var util=require(_0x2081('0x1'));var logger=require(_0x2081('0x2'))(_0x2081('0x3'));var moment=require(_0x2081('0x4'));var BPromise=require('bluebird');var rp=require(_0x2081('0x5'));var fs=require('fs');var path=require(_0x2081('0x6'));var rimraf=require('rimraf');var config=require(_0x2081('0x7'));var attributes=require(_0x2081('0x8'));module[_0x2081('0x9')]=function(_0x379b55,_0x49b218){return _0x379b55[_0x2081('0xa')](_0x2081('0xb'),attributes,{'tableName':_0x2081('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x13c8d2,_0xa4ad1,_0x54a7c7){if(_0x13c8d2[_0x2081('0xd')](_0x2081('0xe'))){_0x13c8d2[_0x2081('0xf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x13c8d2['changed']('production')){_0x13c8d2[_0x2081('0x10')]=moment()[_0x2081('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x54a7c7(null,_0x13c8d2);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 5f91d7a..f36f785 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 _0xc3a2=['debug','stringify','catch','error','message','find','info','ShowSquareProject','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','register','GetSquareProjects','SquareProject','findAll','options','raw','where','map','model','include','attributes','then'];(function(_0x32e77f,_0x14464d){var _0x47e651=function(_0x3c318e){while(--_0x3c318e){_0x32e77f['push'](_0x32e77f['shift']());}};_0x47e651(++_0x14464d);}(_0xc3a2,0x1e4));var _0x2c3a=function(_0x4915cb,_0x17a442){_0x4915cb=_0x4915cb-0x0;var _0x1d4383=_0xc3a2[_0x4915cb];return _0x1d4383;};'use strict';var _=require('lodash');var Redis=require(_0x2c3a('0x0'));var db=require(_0x2c3a('0x1'))['db'];var logger=require(_0x2c3a('0x2'))(_0x2c3a('0x3'));var config=require(_0x2c3a('0x4'));config['redis']=_['defaults'](config[_0x2c3a('0x5')],{'host':_0x2c3a('0x6'),'port':0x18eb});var socket=require(_0x2c3a('0x7'))(new Redis(config[_0x2c3a('0x5')]));require('./squareProject.socket')[_0x2c3a('0x8')](socket);exports[_0x2c3a('0x9')]=function(_0x171885){var _0x1b2946=this;return new Promise(function(_0x37dcc4,_0x351054){return db[_0x2c3a('0xa')][_0x2c3a('0xb')]({'raw':_0x171885[_0x2c3a('0xc')]?_0x171885['options'][_0x2c3a('0xd')]===undefined?!![]:![]:!![],'where':_0x171885[_0x2c3a('0xc')]?_0x171885[_0x2c3a('0xc')][_0x2c3a('0xe')]||null:null,'attributes':_0x171885[_0x2c3a('0xc')]?_0x171885['options']['attributes']||null:null,'limit':_0x171885[_0x2c3a('0xc')]?_0x171885[_0x2c3a('0xc')]['limit']||null:null,'include':_0x171885[_0x2c3a('0xc')]?_0x171885[_0x2c3a('0xc')]['include']?_[_0x2c3a('0xf')](_0x171885['options']['include'],function(_0x2414ea){return{'model':db[_0x2414ea[_0x2c3a('0x10')]],'as':_0x2414ea['as'],'attributes':_0x2414ea['attributes'],'include':_0x2414ea[_0x2c3a('0x11')]?_[_0x2c3a('0xf')](_0x2414ea['include'],function(_0x4e0cce){return{'model':db[_0x4e0cce[_0x2c3a('0x10')]],'as':_0x4e0cce['as'],'attributes':_0x4e0cce[_0x2c3a('0x12')],'include':_0x4e0cce[_0x2c3a('0x11')]?_[_0x2c3a('0xf')](_0x4e0cce['include'],function(_0x5adfbc){return{'model':db[_0x5adfbc[_0x2c3a('0x10')]],'as':_0x5adfbc['as'],'attributes':_0x5adfbc[_0x2c3a('0x12')]};}):[]};}):[]};}):[]:[]})[_0x2c3a('0x13')](function(_0x2d4ad4){logger['info'](_0x2c3a('0x9'),_0x171885);logger[_0x2c3a('0x14')]('GetSquareProjects',_0x171885,JSON[_0x2c3a('0x15')](_0x2d4ad4));_0x37dcc4(_0x2d4ad4);})[_0x2c3a('0x16')](function(_0x530af3){logger[_0x2c3a('0x17')](_0x2c3a('0x9'),_0x530af3['message'],_0x171885);_0x351054(_0x1b2946[_0x2c3a('0x17')](0x1f4,_0x530af3[_0x2c3a('0x18')]));});});};exports['ShowSquareProject']=function(_0x2ededc){var _0x2aee0d=this;return new Promise(function(_0x5beabe,_0x2b7326){return db[_0x2c3a('0xa')][_0x2c3a('0x19')]({'raw':_0x2ededc[_0x2c3a('0xc')]?_0x2ededc['options']['raw']===undefined?!![]:![]:!![],'where':_0x2ededc['options']?_0x2ededc['options'][_0x2c3a('0xe')]||null:null,'attributes':_0x2ededc[_0x2c3a('0xc')]?_0x2ededc[_0x2c3a('0xc')][_0x2c3a('0x12')]||null:null,'include':_0x2ededc[_0x2c3a('0xc')]?_0x2ededc['options'][_0x2c3a('0x11')]?_['map'](_0x2ededc[_0x2c3a('0xc')]['include'],function(_0x58b868){return{'model':db[_0x58b868[_0x2c3a('0x10')]],'as':_0x58b868['as'],'attributes':_0x58b868[_0x2c3a('0x12')],'include':_0x58b868[_0x2c3a('0x11')]?_['map'](_0x58b868['include'],function(_0x10cae7){return{'model':db[_0x10cae7[_0x2c3a('0x10')]],'as':_0x10cae7['as'],'attributes':_0x10cae7[_0x2c3a('0x12')],'include':_0x10cae7[_0x2c3a('0x11')]?_[_0x2c3a('0xf')](_0x10cae7[_0x2c3a('0x11')],function(_0x5649a5){return{'model':db[_0x5649a5[_0x2c3a('0x10')]],'as':_0x5649a5['as'],'attributes':_0x5649a5['attributes']};}):[]};}):[]};}):[]:[]})[_0x2c3a('0x13')](function(_0x1cde5a){logger[_0x2c3a('0x1a')](_0x2c3a('0x1b'),_0x2ededc);logger['debug'](_0x2c3a('0x1b'),_0x2ededc,JSON['stringify'](_0x1cde5a));_0x5beabe(_0x1cde5a);})[_0x2c3a('0x16')](function(_0x21dae9){logger[_0x2c3a('0x17')](_0x2c3a('0x1b'),_0x21dae9[_0x2c3a('0x18')],_0x2ededc);_0x2b7326(_0x2aee0d['error'](0x1f4,_0x21dae9[_0x2c3a('0x18')]));});});}; \ No newline at end of file +var _0x2d3a=['redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','options','raw','where','include','map','model','attributes','then','info','debug','stringify','catch','error','message','find','ShowSquareProject','lodash','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x2d3a,0x168));var _0xa2d3=function(_0xbc4659,_0x578fba){_0xbc4659=_0xbc4659-0x0;var _0x5831f9=_0x2d3a[_0xbc4659];return _0x5831f9;};'use strict';var _=require(_0xa2d3('0x0'));var Redis=require('ioredis');var db=require(_0xa2d3('0x1'))['db'];var logger=require(_0xa2d3('0x2'))('rpc');var config=require(_0xa2d3('0x3'));config[_0xa2d3('0x4')]=_[_0xa2d3('0x5')](config[_0xa2d3('0x4')],{'host':_0xa2d3('0x6'),'port':0x18eb});var socket=require(_0xa2d3('0x7'))(new Redis(config[_0xa2d3('0x4')]));require(_0xa2d3('0x8'))[_0xa2d3('0x9')](socket);exports[_0xa2d3('0xa')]=function(_0x3d931f){var _0x46f51b=this;return new Promise(function(_0x3c1359,_0xa19344){return db[_0xa2d3('0xb')]['findAll']({'raw':_0x3d931f[_0xa2d3('0xc')]?_0x3d931f[_0xa2d3('0xc')][_0xa2d3('0xd')]===undefined?!![]:![]:!![],'where':_0x3d931f[_0xa2d3('0xc')]?_0x3d931f[_0xa2d3('0xc')][_0xa2d3('0xe')]||null:null,'attributes':_0x3d931f[_0xa2d3('0xc')]?_0x3d931f[_0xa2d3('0xc')]['attributes']||null:null,'limit':_0x3d931f[_0xa2d3('0xc')]?_0x3d931f[_0xa2d3('0xc')]['limit']||null:null,'include':_0x3d931f[_0xa2d3('0xc')]?_0x3d931f[_0xa2d3('0xc')][_0xa2d3('0xf')]?_[_0xa2d3('0x10')](_0x3d931f[_0xa2d3('0xc')][_0xa2d3('0xf')],function(_0x228e01){return{'model':db[_0x228e01[_0xa2d3('0x11')]],'as':_0x228e01['as'],'attributes':_0x228e01[_0xa2d3('0x12')],'include':_0x228e01[_0xa2d3('0xf')]?_[_0xa2d3('0x10')](_0x228e01[_0xa2d3('0xf')],function(_0x49c768){return{'model':db[_0x49c768[_0xa2d3('0x11')]],'as':_0x49c768['as'],'attributes':_0x49c768[_0xa2d3('0x12')],'include':_0x49c768[_0xa2d3('0xf')]?_[_0xa2d3('0x10')](_0x49c768['include'],function(_0x4e045a){return{'model':db[_0x4e045a[_0xa2d3('0x11')]],'as':_0x4e045a['as'],'attributes':_0x4e045a[_0xa2d3('0x12')]};}):[]};}):[]};}):[]:[]})[_0xa2d3('0x13')](function(_0x39005f){logger[_0xa2d3('0x14')]('GetSquareProjects',_0x3d931f);logger[_0xa2d3('0x15')](_0xa2d3('0xa'),_0x3d931f,JSON[_0xa2d3('0x16')](_0x39005f));_0x3c1359(_0x39005f);})[_0xa2d3('0x17')](function(_0x298d2d){logger[_0xa2d3('0x18')](_0xa2d3('0xa'),_0x298d2d[_0xa2d3('0x19')],_0x3d931f);_0xa19344(_0x46f51b[_0xa2d3('0x18')](0x1f4,_0x298d2d['message']));});});};exports['ShowSquareProject']=function(_0x4f355a){var _0x239bda=this;return new Promise(function(_0x507037,_0x474630){return db[_0xa2d3('0xb')][_0xa2d3('0x1a')]({'raw':_0x4f355a[_0xa2d3('0xc')]?_0x4f355a['options'][_0xa2d3('0xd')]===undefined?!![]:![]:!![],'where':_0x4f355a[_0xa2d3('0xc')]?_0x4f355a['options'][_0xa2d3('0xe')]||null:null,'attributes':_0x4f355a[_0xa2d3('0xc')]?_0x4f355a[_0xa2d3('0xc')][_0xa2d3('0x12')]||null:null,'include':_0x4f355a['options']?_0x4f355a[_0xa2d3('0xc')][_0xa2d3('0xf')]?_['map'](_0x4f355a['options'][_0xa2d3('0xf')],function(_0x5c1bb8){return{'model':db[_0x5c1bb8[_0xa2d3('0x11')]],'as':_0x5c1bb8['as'],'attributes':_0x5c1bb8[_0xa2d3('0x12')],'include':_0x5c1bb8[_0xa2d3('0xf')]?_[_0xa2d3('0x10')](_0x5c1bb8[_0xa2d3('0xf')],function(_0x2457b5){return{'model':db[_0x2457b5[_0xa2d3('0x11')]],'as':_0x2457b5['as'],'attributes':_0x2457b5[_0xa2d3('0x12')],'include':_0x2457b5[_0xa2d3('0xf')]?_[_0xa2d3('0x10')](_0x2457b5[_0xa2d3('0xf')],function(_0x5d22da){return{'model':db[_0x5d22da[_0xa2d3('0x11')]],'as':_0x5d22da['as'],'attributes':_0x5d22da[_0xa2d3('0x12')]};}):[]};}):[]};}):[]:[]})[_0xa2d3('0x13')](function(_0x2cbce2){logger[_0xa2d3('0x14')](_0xa2d3('0x1b'),_0x4f355a);logger[_0xa2d3('0x15')]('ShowSquareProject',_0x4f355a,JSON[_0xa2d3('0x16')](_0x2cbce2));_0x507037(_0x2cbce2);})[_0xa2d3('0x17')](function(_0x3e0827){logger[_0xa2d3('0x18')](_0xa2d3('0x1b'),_0x3e0827[_0xa2d3('0x19')],_0x4f355a);_0x474630(_0x239bda[_0xa2d3('0x18')](0x1f4,_0x3e0827[_0xa2d3('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 528d949..1f4964c 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 _0xb26f=['length','squareProject:','./squareProject.events','remove','emit','removeListener','register'];(function(_0x591db7,_0x150445){var _0x4ad760=function(_0x5dd24e){while(--_0x5dd24e){_0x591db7['push'](_0x591db7['shift']());}};_0x4ad760(++_0x150445);}(_0xb26f,0xdb));var _0xfb26=function(_0x4cc280,_0x3b77f3){_0x4cc280=_0x4cc280-0x0;var _0x16ed24=_0xb26f[_0x4cc280];return _0x16ed24;};'use strict';var SquareProjectEvents=require(_0xfb26('0x0'));var events=['save',_0xfb26('0x1'),'update'];function createListener(_0x205dab,_0x430306){return function(_0x548d4c){_0x430306[_0xfb26('0x2')](_0x205dab,_0x548d4c);};}function removeListener(_0x15f103,_0x148fce){return function(){SquareProjectEvents[_0xfb26('0x3')](_0x15f103,_0x148fce);};}exports[_0xfb26('0x4')]=function(_0x3b098c){for(var _0x5bddd8=0x0,_0x3ae7e6=events[_0xfb26('0x5')];_0x5bddd8<_0x3ae7e6;_0x5bddd8++){var _0x5ee4fb=events[_0x5bddd8];var _0x3cf71c=createListener(_0xfb26('0x6')+_0x5ee4fb,_0x3b098c);SquareProjectEvents['on'](_0x5ee4fb,_0x3cf71c);}}; \ No newline at end of file +var _0xd636=['register','length','squareProject:','remove','update','emit'];(function(_0x5c98cc,_0x58190a){var _0x164644=function(_0x540bae){while(--_0x540bae){_0x5c98cc['push'](_0x5c98cc['shift']());}};_0x164644(++_0x58190a);}(_0xd636,0x117));var _0x6d63=function(_0x1e53c1,_0x21e2af){_0x1e53c1=_0x1e53c1-0x0;var _0x18e6cd=_0xd636[_0x1e53c1];return _0x18e6cd;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=['save',_0x6d63('0x0'),_0x6d63('0x1')];function createListener(_0x37e517,_0x1a2033){return function(_0x579ac7){_0x1a2033[_0x6d63('0x2')](_0x37e517,_0x579ac7);};}function removeListener(_0x452bae,_0x554c85){return function(){SquareProjectEvents['removeListener'](_0x452bae,_0x554c85);};}exports[_0x6d63('0x3')]=function(_0x5f336a){for(var _0x404cb6=0x0,_0x2c74d1=events[_0x6d63('0x4')];_0x404cb6<_0x2c74d1;_0x404cb6++){var _0x544184=events[_0x404cb6];var _0x4170e8=createListener(_0x6d63('0x5')+_0x544184,_0x5f336a);SquareProjectEvents['on'](_0x544184,_0x4170e8);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index ac6fbf9..7f325d6 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 _0x53ec=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','isAuthenticated','get','/:id','show','/:id/download','download','post','create','put'];(function(_0xbf23d9,_0x2f4f8d){var _0x5d5f9f=function(_0xcb67df){while(--_0xcb67df){_0xbf23d9['push'](_0xbf23d9['shift']());}};_0x5d5f9f(++_0x2f4f8d);}(_0x53ec,0x192));var _0xc53e=function(_0x107f31,_0x1bcd53){_0x107f31=_0x107f31-0x0;var _0x10560c=_0x53ec[_0x107f31];return _0x10560c;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x13')]);module[_0xc53e('0x14')]=router; \ No newline at end of file +var _0xabce=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','download','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x10919b,_0x25ec3e){var _0x335258=function(_0x27f75d){while(--_0x27f75d){_0x10919b['push'](_0x10919b['shift']());}};_0x335258(++_0x25ec3e);}(_0xabce,0x103));var _0xeabc=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xabce[_0x3ff085];return _0x2b68c3;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./squareRecording.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id/download',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);router[_0xeabc('0x11')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x12')]);module[_0xeabc('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index b994bc8..96c8126 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 _0x98a8=['exports','STRING','VIRTUAL','savePath','substring','lastIndexOf','sequelize'];(function(_0x284a61,_0x231686){var _0x220e3c=function(_0x104496){while(--_0x104496){_0x284a61['push'](_0x284a61['shift']());}};_0x220e3c(++_0x231686);}(_0x98a8,0x12c));var _0x898a=function(_0x2c6acb,_0xeb01a8){_0x2c6acb=_0x2c6acb-0x0;var _0x5a6958=_0x98a8[_0x2c6acb];return _0x5a6958;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'uniqueid':{'type':Sequelize[_0x898a('0x2')]},'callerid':{'type':Sequelize[_0x898a('0x2')]},'calleridname':{'type':Sequelize[_0x898a('0x2')]},'context':{'type':Sequelize[_0x898a('0x2')]},'extension':{'type':Sequelize[_0x898a('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x898a('0x2')]},'dnid':{'type':Sequelize[_0x898a('0x2')]},'projectName':{'type':Sequelize[_0x898a('0x2')]},'saveName':{'type':Sequelize[_0x898a('0x2')]},'filename':{'type':Sequelize[_0x898a('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x898a('0x3')],'get':function(){var _0x564583='';var _0xfa8c50=this['getDataValue'](_0x898a('0x4'));if(_0xfa8c50){_0x564583=_0xfa8c50[_0x898a('0x5')](_0xfa8c50[_0x898a('0x6')]('.'));}return _0x564583;}}}; \ No newline at end of file +var _0x3eea=['getDataValue','substring','sequelize','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3eea,0x1ca));var _0xa3ee=function(_0xdc16fc,_0x1e4f3b){_0xdc16fc=_0xdc16fc-0x0;var _0x4dd8c0=_0x3eea[_0xdc16fc];return _0x4dd8c0;};'use strict';var Sequelize=require(_0xa3ee('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xa3ee('0x1')]},'callerid':{'type':Sequelize[_0xa3ee('0x1')]},'calleridname':{'type':Sequelize[_0xa3ee('0x1')]},'context':{'type':Sequelize[_0xa3ee('0x1')]},'extension':{'type':Sequelize[_0xa3ee('0x1')]},'priority':{'type':Sequelize[_0xa3ee('0x1')]},'accountcode':{'type':Sequelize[_0xa3ee('0x1')]},'dnid':{'type':Sequelize[_0xa3ee('0x1')]},'projectName':{'type':Sequelize[_0xa3ee('0x1')]},'saveName':{'type':Sequelize[_0xa3ee('0x1')]},'filename':{'type':Sequelize[_0xa3ee('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x4183ee='';var _0x4e4588=this[_0xa3ee('0x2')]('savePath');if(_0x4e4588){_0x4183ee=_0x4e4588[_0xa3ee('0x3')](_0x4e4588['lastIndexOf']('.'));}return _0x4183ee;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index a520ee6..aaed655 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 _0xb5bb=['uniqueid','savePath','format','existsSync','decryptFile','secrets','recording','filename','extname','unlink','SquareRecording\x20not\x20found','Not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info','destroy','eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','options','find','create','body','download','../../components/encryptor'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xb5bb,0xda));var _0xbb5b=function(_0x107f4f,_0x2e431c){_0x107f4f=_0x107f4f-0x0;var _0x1d8fd5=_0xb5bb[_0x107f4f];return _0x1d8fd5;};'use strict';var emlformat=require(_0xbb5b('0x0'));var rimraf=require(_0xbb5b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbb5b('0x2'));var moment=require('moment');var BPromise=require(_0xbb5b('0x3'));var Mustache=require(_0xbb5b('0x4'));var util=require(_0xbb5b('0x5'));var path=require(_0xbb5b('0x6'));var sox=require('sox');var csv=require(_0xbb5b('0x7'));var ejs=require(_0xbb5b('0x8'));var fs=require('fs');var fs_extra=require(_0xbb5b('0x9'));var _=require(_0xbb5b('0xa'));var squel=require('squel');var crypto=require(_0xbb5b('0xb'));var jsforce=require(_0xbb5b('0xc'));var deskjs=require(_0xbb5b('0xd'));var toCsv=require(_0xbb5b('0x7'));var querystring=require(_0xbb5b('0xe'));var Papa=require(_0xbb5b('0xf'));var Redis=require(_0xbb5b('0x10'));var authService=require(_0xbb5b('0x11'));var qs=require(_0xbb5b('0x12'));var as=require(_0xbb5b('0x13'));var hardwareService=require(_0xbb5b('0x14'));var logger=require(_0xbb5b('0x15'))('api');var utils=require(_0xbb5b('0x16'));var config=require(_0xbb5b('0x17'));var licenseUtil=require(_0xbb5b('0x18'));var db=require(_0xbb5b('0x19'))['db'];function respondWithStatusCode(_0x6fbbf,_0x18dfb6){_0x18dfb6=_0x18dfb6||0xcc;return function(_0x4f946f){if(_0x4f946f){return _0x6fbbf[_0xbb5b('0x1a')](_0x18dfb6);}return _0x6fbbf[_0xbb5b('0x1b')](_0x18dfb6)[_0xbb5b('0x1c')]();};}function respondWithResult(_0x3d5586,_0xab8a8b){_0xab8a8b=_0xab8a8b||0xc8;return function(_0x1b1e5b){if(_0x1b1e5b){return _0x3d5586['status'](_0xab8a8b)['json'](_0x1b1e5b);}};}function respondWithFilteredResult(_0x2f0dfc,_0x23e147){return function(_0x1fe314){if(_0x1fe314){var _0x395f82=typeof _0x23e147[_0xbb5b('0x1d')]===_0xbb5b('0x1e')&&typeof _0x23e147['limit']===_0xbb5b('0x1e');var _0xd85463=_0x1fe314[_0xbb5b('0x1f')];var _0x389248=_0x395f82?0x0:_0x23e147[_0xbb5b('0x1d')];var _0x5a2c62=_0x395f82?_0x1fe314['count']:_0x23e147['offset']+_0x23e147[_0xbb5b('0x20')];var _0x4d49c9;if(_0x5a2c62>=_0xd85463){_0x5a2c62=_0xd85463;_0x4d49c9=0xc8;}else{_0x4d49c9=0xce;}_0x2f0dfc[_0xbb5b('0x1b')](_0x4d49c9);return _0x2f0dfc['set'](_0xbb5b('0x21'),_0x389248+'-'+_0x5a2c62+'/'+_0xd85463)[_0xbb5b('0x22')](_0x1fe314);}return null;};}function patchUpdates(_0x18be07){return function(_0x5a5d00){try{jsonpatch[_0xbb5b('0x23')](_0x5a5d00,_0x18be07,!![]);}catch(_0x566bc5){return BPromise[_0xbb5b('0x24')](_0x566bc5);}return _0x5a5d00[_0xbb5b('0x25')]();};}function saveUpdates(_0x59e7cc,_0x1a6bcc){return function(_0x181d80){if(_0x181d80){return _0x181d80[_0xbb5b('0x26')](_0x59e7cc)[_0xbb5b('0x27')](function(_0x9de532){return _0x9de532;});}return null;};}function removeEntity(_0xd5134f,_0x16aed3){return function(_0x1d2d23){if(_0x1d2d23){return _0x1d2d23['destroy']()[_0xbb5b('0x27')](function(){_0xd5134f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bd805,_0x276cdd){return function(_0x387f02){if(!_0x387f02){_0x5bd805['sendStatus'](0x194);}return _0x387f02;};}function handleError(_0x1f0f3d,_0x4845c7){_0x4845c7=_0x4845c7||0x1f4;return function(_0x2ec027){logger[_0xbb5b('0x28')](_0x2ec027[_0xbb5b('0x29')]);if(_0x2ec027[_0xbb5b('0x2a')]){delete _0x2ec027[_0xbb5b('0x2a')];}_0x1f0f3d[_0xbb5b('0x1b')](_0x4845c7)[_0xbb5b('0x2b')](_0x2ec027);};}exports[_0xbb5b('0x2c')]=function(_0x244868,_0x228a96){var _0x2a5f56={},_0x508f28={},_0x40e26e={'count':0x0,'rows':[]};var _0x4781ef=_[_0xbb5b('0x2d')](db[_0xbb5b('0x2e')][_0xbb5b('0x2f')],function(_0x58a07f){return{'name':_0x58a07f[_0xbb5b('0x30')],'type':_0x58a07f[_0xbb5b('0x31')][_0xbb5b('0x32')]};});_0x508f28['model']=_[_0xbb5b('0x2d')](_0x4781ef,'name');_0x508f28[_0xbb5b('0x33')]=_['keys'](_0x244868[_0xbb5b('0x33')]);_0x508f28[_0xbb5b('0x34')]=_[_0xbb5b('0x35')](_0x508f28['model'],_0x508f28[_0xbb5b('0x33')]);_0x2a5f56[_0xbb5b('0x36')]=_[_0xbb5b('0x35')](_0x508f28[_0xbb5b('0x37')],qs[_0xbb5b('0x38')](_0x244868[_0xbb5b('0x33')][_0xbb5b('0x38')]));_0x2a5f56['attributes']=_0x2a5f56['attributes']['length']?_0x2a5f56[_0xbb5b('0x36')]:_0x508f28['model'];if(!_0x244868[_0xbb5b('0x33')]['hasOwnProperty'](_0xbb5b('0x39'))){_0x2a5f56[_0xbb5b('0x20')]=qs[_0xbb5b('0x20')](_0x244868[_0xbb5b('0x33')][_0xbb5b('0x20')]);_0x2a5f56['offset']=qs[_0xbb5b('0x1d')](_0x244868[_0xbb5b('0x33')][_0xbb5b('0x1d')]);}_0x2a5f56['order']=qs[_0xbb5b('0x3a')](_0x244868[_0xbb5b('0x33')][_0xbb5b('0x3a')]);_0x2a5f56[_0xbb5b('0x3b')]=qs['filters'](_[_0xbb5b('0x3c')](_0x244868['query'],_0x508f28[_0xbb5b('0x34')]),_0x4781ef);if(_0x244868[_0xbb5b('0x33')][_0xbb5b('0x3d')]){_0x2a5f56[_0xbb5b('0x3b')]=_[_0xbb5b('0x3e')](_0x2a5f56['where'],{'$or':_[_0xbb5b('0x2d')](_0x4781ef,function(_0x1907aa){if(_0x1907aa['type']!==_0xbb5b('0x3f')){var _0x32ac98={};_0x32ac98[_0x1907aa['name']]={'$like':'%'+_0x244868[_0xbb5b('0x33')][_0xbb5b('0x3d')]+'%'};return _0x32ac98;}})});}_0x2a5f56=_[_0xbb5b('0x3e')]({},_0x2a5f56,_0x244868['options']);var _0x269902={'where':_0x2a5f56['where']};return db['SquareRecording'][_0xbb5b('0x1f')](_0x269902)['then'](function(_0x331669){_0x40e26e[_0xbb5b('0x1f')]=_0x331669;if(_0x244868[_0xbb5b('0x33')][_0xbb5b('0x40')]){_0x2a5f56[_0xbb5b('0x41')]=[{'all':!![]}];}return db[_0xbb5b('0x2e')][_0xbb5b('0x42')](_0x2a5f56);})[_0xbb5b('0x27')](function(_0x2f9295){_0x40e26e[_0xbb5b('0x43')]=_0x2f9295;return _0x40e26e;})[_0xbb5b('0x27')](respondWithFilteredResult(_0x228a96,_0x2a5f56))[_0xbb5b('0x44')](handleError(_0x228a96,null));};exports[_0xbb5b('0x45')]=function(_0x3d8ffc,_0x4310f6){var _0x268fd4={'raw':!![],'where':{'id':_0x3d8ffc[_0xbb5b('0x46')]['id']}},_0x4e5c72={};_0x4e5c72[_0xbb5b('0x37')]=_[_0xbb5b('0x47')](db['SquareRecording'][_0xbb5b('0x2f')]);_0x4e5c72['query']=_[_0xbb5b('0x47')](_0x3d8ffc['query']);_0x4e5c72['filters']=_[_0xbb5b('0x35')](_0x4e5c72[_0xbb5b('0x37')],_0x4e5c72['query']);_0x268fd4[_0xbb5b('0x36')]=_[_0xbb5b('0x35')](_0x4e5c72[_0xbb5b('0x37')],qs[_0xbb5b('0x38')](_0x3d8ffc[_0xbb5b('0x33')][_0xbb5b('0x38')]));_0x268fd4['attributes']=_0x268fd4[_0xbb5b('0x36')][_0xbb5b('0x48')]?_0x268fd4[_0xbb5b('0x36')]:_0x4e5c72[_0xbb5b('0x37')];if(_0x3d8ffc[_0xbb5b('0x33')][_0xbb5b('0x40')]){_0x268fd4['include']=[{'all':!![]}];}_0x268fd4=_[_0xbb5b('0x3e')]({},_0x268fd4,_0x3d8ffc[_0xbb5b('0x49')]);return db[_0xbb5b('0x2e')][_0xbb5b('0x4a')](_0x268fd4)[_0xbb5b('0x27')](handleEntityNotFound(_0x4310f6,null))[_0xbb5b('0x27')](respondWithResult(_0x4310f6,null))[_0xbb5b('0x44')](handleError(_0x4310f6,null));};exports[_0xbb5b('0x4b')]=function(_0x369e87,_0x47e417){return db[_0xbb5b('0x2e')][_0xbb5b('0x4b')](_0x369e87[_0xbb5b('0x4c')],{})['then'](respondWithResult(_0x47e417,0xc9))[_0xbb5b('0x44')](handleError(_0x47e417,null));};exports[_0xbb5b('0x26')]=function(_0x4b42f8,_0x3634a7){if(_0x4b42f8[_0xbb5b('0x4c')]['id']){delete _0x4b42f8[_0xbb5b('0x4c')]['id'];}return db['SquareRecording'][_0xbb5b('0x4a')]({'where':{'id':_0x4b42f8['params']['id']}})['then'](handleEntityNotFound(_0x3634a7,null))[_0xbb5b('0x27')](saveUpdates(_0x4b42f8[_0xbb5b('0x4c')],null))[_0xbb5b('0x27')](respondWithResult(_0x3634a7,null))[_0xbb5b('0x44')](handleError(_0x3634a7,null));};exports[_0xbb5b('0x4d')]=function(_0x3ef527,_0x282e76,_0x41552a){var _0x5878a2=require(_0xbb5b('0x4e'));var _0x3d3b65=![];var _0x227dc8={};if(_0x3ef527[_0xbb5b('0x33')][_0xbb5b('0x31')]&&_0x3ef527[_0xbb5b('0x33')]['type']===_0xbb5b('0x4f')){_0x227dc8[_0xbb5b('0x4f')]=_0x3ef527[_0xbb5b('0x46')]['id'];}else{_0x227dc8['id']=_0x3ef527[_0xbb5b('0x46')]['id'];}return db[_0xbb5b('0x2e')][_0xbb5b('0x4a')]({'where':_0x227dc8,'attributes':['id',_0xbb5b('0x50'),'filename'],'raw':!![]})[_0xbb5b('0x27')](handleEntityNotFound(_0x282e76,null))[_0xbb5b('0x27')](function(_0x16a004){if(_0x16a004){var _0x3aad40=_0x16a004[_0xbb5b('0x50')];var _0x18c64a=util[_0xbb5b('0x51')]('%s.cypher',_0x3aad40);if(fs[_0xbb5b('0x52')](_0x18c64a)){_0x3d3b65=!![];return _0x5878a2[_0xbb5b('0x53')](_0x18c64a,_0x3aad40,config[_0xbb5b('0x54')][_0xbb5b('0x55')])[_0xbb5b('0x27')](function(){return _0x16a004;});}return _0x16a004;}})[_0xbb5b('0x27')](function(_0x8fbaec){if(_0x8fbaec){var _0x14b290=_0x8fbaec['savePath'];if(!fs[_0xbb5b('0x52')](_0x14b290)){throw new db['Sequelize']['ValidationError']('SquareRecording\x20not\x20found');}if(_0x8fbaec[_0xbb5b('0x56')]){return _0x282e76[_0xbb5b('0x4d')](_0x14b290,_0x8fbaec['filename']+path[_0xbb5b('0x57')](_0x14b290),function(){if(_0x3d3b65){fs[_0xbb5b('0x58')](_0x14b290);}});}else{return _0x282e76[_0xbb5b('0x4d')](_0x14b290,function(_0x13628c){if(_0x3d3b65){fs[_0xbb5b('0x58')](_0x14b290);}});}}})[_0xbb5b('0x44')](function(_0x1911ae){if(_0x1911ae['message']===_0xbb5b('0x59')){_0x282e76[_0xbb5b('0x1b')](0x194)[_0xbb5b('0x2b')](_0xbb5b('0x5a'));}else{return handleError(_0x282e76,null);}});};exports['destroy']=function(_0x369297,_0x2a5ed4){return db[_0xbb5b('0x2e')]['find']({'where':{'id':_0x369297['params']['id']}})[_0xbb5b('0x27')](function(_0x300e56){if(_['isNil'](_0x300e56)){throw new ReferenceError('Entity\x20not\x20found');}return _0x300e56;})[_0xbb5b('0x27')](function(_0x14773c){var _0x20e792=_0x14773c['savePath'];logger['info'](_0xbb5b('0x5b'),_0x20e792);if(!_[_0xbb5b('0x5c')](_0x14773c[_0xbb5b('0x50')])&&fs['existsSync'](_0x20e792)){logger['info'](_0xbb5b('0x5d')+_0x20e792+_0xbb5b('0x5e'));fs[_0xbb5b('0x5f')](_0x20e792);}_0x20e792=_0x20e792+_0xbb5b('0x60');if(!_['isNil'](_0x14773c[_0xbb5b('0x50')])&&fs[_0xbb5b('0x52')](_0x20e792)){logger[_0xbb5b('0x61')](_0xbb5b('0x5d')+_0x20e792+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xbb5b('0x5f')](_0x20e792);}return _0x14773c;})[_0xbb5b('0x27')](function(_0x6b8298){if(!_0x6b8298)throw new InternalError();return _0x6b8298[_0xbb5b('0x62')]();})['then'](function(){_0x2a5ed4['status'](0xcc)[_0xbb5b('0x1c')]();})[_0xbb5b('0x44')](handleError(_0x2a5ed4,null));}; \ No newline at end of file +var _0x0c4b=['create','body','download','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','unlink','message','send','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','rawAttributes','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','options','SquareRecording','include','findAll','rows','show','params','keys','length','includeAll','find','catch'];(function(_0x597a21,_0x13bd9f){var _0x1e0d18=function(_0xabfdb8){while(--_0xabfdb8){_0x597a21['push'](_0x597a21['shift']());}};_0x1e0d18(++_0x13bd9f);}(_0x0c4b,0x13e));var _0xb0c4=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x0c4b[_0x381589];return _0x2a075d;};'use strict';var emlformat=require(_0xb0c4('0x0'));var rimraf=require(_0xb0c4('0x1'));var zipdir=require(_0xb0c4('0x2'));var jsonpatch=require(_0xb0c4('0x3'));var rp=require(_0xb0c4('0x4'));var moment=require(_0xb0c4('0x5'));var BPromise=require(_0xb0c4('0x6'));var Mustache=require(_0xb0c4('0x7'));var util=require(_0xb0c4('0x8'));var path=require(_0xb0c4('0x9'));var sox=require(_0xb0c4('0xa'));var csv=require(_0xb0c4('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb0c4('0xc'));var squel=require(_0xb0c4('0xd'));var crypto=require(_0xb0c4('0xe'));var jsforce=require(_0xb0c4('0xf'));var deskjs=require(_0xb0c4('0x10'));var toCsv=require(_0xb0c4('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb0c4('0x11'));var qs=require(_0xb0c4('0x12'));var as=require(_0xb0c4('0x13'));var hardwareService=require(_0xb0c4('0x14'));var logger=require(_0xb0c4('0x15'))(_0xb0c4('0x16'));var utils=require(_0xb0c4('0x17'));var config=require(_0xb0c4('0x18'));var licenseUtil=require(_0xb0c4('0x19'));var db=require(_0xb0c4('0x1a'))['db'];function respondWithStatusCode(_0x3297a5,_0x15c9f8){_0x15c9f8=_0x15c9f8||0xcc;return function(_0x40d331){if(_0x40d331){return _0x3297a5[_0xb0c4('0x1b')](_0x15c9f8);}return _0x3297a5[_0xb0c4('0x1c')](_0x15c9f8)[_0xb0c4('0x1d')]();};}function respondWithResult(_0x2ddd83,_0x2839d2){_0x2839d2=_0x2839d2||0xc8;return function(_0x2e8b18){if(_0x2e8b18){return _0x2ddd83['status'](_0x2839d2)[_0xb0c4('0x1e')](_0x2e8b18);}};}function respondWithFilteredResult(_0x2aef36,_0x115b3b){return function(_0x5180dc){if(_0x5180dc){var _0xfb3bf=typeof _0x115b3b[_0xb0c4('0x1f')]===_0xb0c4('0x20')&&typeof _0x115b3b['limit']===_0xb0c4('0x20');var _0xa7ac04=_0x5180dc[_0xb0c4('0x21')];var _0x50bbf5=_0xfb3bf?0x0:_0x115b3b[_0xb0c4('0x1f')];var _0x471fda=_0xfb3bf?_0x5180dc[_0xb0c4('0x21')]:_0x115b3b[_0xb0c4('0x1f')]+_0x115b3b[_0xb0c4('0x22')];var _0x33f576;if(_0x471fda>=_0xa7ac04){_0x471fda=_0xa7ac04;_0x33f576=0xc8;}else{_0x33f576=0xce;}_0x2aef36[_0xb0c4('0x1c')](_0x33f576);return _0x2aef36[_0xb0c4('0x23')](_0xb0c4('0x24'),_0x50bbf5+'-'+_0x471fda+'/'+_0xa7ac04)[_0xb0c4('0x1e')](_0x5180dc);}return null;};}function patchUpdates(_0x2832d0){return function(_0x4d82a9){try{jsonpatch[_0xb0c4('0x25')](_0x4d82a9,_0x2832d0,!![]);}catch(_0x57ae28){return BPromise[_0xb0c4('0x26')](_0x57ae28);}return _0x4d82a9[_0xb0c4('0x27')]();};}function saveUpdates(_0x236029,_0xb83de3){return function(_0x17c817){if(_0x17c817){return _0x17c817[_0xb0c4('0x28')](_0x236029)[_0xb0c4('0x29')](function(_0x46ff8f){return _0x46ff8f;});}return null;};}function removeEntity(_0x4f1dc5,_0x5318c6){return function(_0x108a06){if(_0x108a06){return _0x108a06['destroy']()[_0xb0c4('0x29')](function(){_0x4f1dc5['status'](0xcc)[_0xb0c4('0x1d')]();});}};}function handleEntityNotFound(_0x4b1f5c,_0x50eb3b){return function(_0x23f2e1){if(!_0x23f2e1){_0x4b1f5c[_0xb0c4('0x1b')](0x194);}return _0x23f2e1;};}function handleError(_0x5db940,_0x1606de){_0x1606de=_0x1606de||0x1f4;return function(_0x49d115){logger[_0xb0c4('0x2a')](_0x49d115[_0xb0c4('0x2b')]);if(_0x49d115[_0xb0c4('0x2c')]){delete _0x49d115[_0xb0c4('0x2c')];}_0x5db940[_0xb0c4('0x1c')](_0x1606de)['send'](_0x49d115);};}exports[_0xb0c4('0x2d')]=function(_0x524f10,_0x49c033){var _0x6c62f9={},_0x58c317={},_0x1080a8={'count':0x0,'rows':[]};var _0x2160bc=_['map'](db['SquareRecording'][_0xb0c4('0x2e')],function(_0x557bac){return{'name':_0x557bac['fieldName'],'type':_0x557bac['type']['key']};});_0x58c317[_0xb0c4('0x2f')]=_[_0xb0c4('0x30')](_0x2160bc,'name');_0x58c317[_0xb0c4('0x31')]=_['keys'](_0x524f10[_0xb0c4('0x31')]);_0x58c317['filters']=_[_0xb0c4('0x32')](_0x58c317['model'],_0x58c317[_0xb0c4('0x31')]);_0x6c62f9[_0xb0c4('0x33')]=_[_0xb0c4('0x32')](_0x58c317['model'],qs[_0xb0c4('0x34')](_0x524f10[_0xb0c4('0x31')]['fields']));_0x6c62f9[_0xb0c4('0x33')]=_0x6c62f9[_0xb0c4('0x33')]['length']?_0x6c62f9['attributes']:_0x58c317[_0xb0c4('0x2f')];if(!_0x524f10[_0xb0c4('0x31')][_0xb0c4('0x35')](_0xb0c4('0x36'))){_0x6c62f9[_0xb0c4('0x22')]=qs[_0xb0c4('0x22')](_0x524f10[_0xb0c4('0x31')]['limit']);_0x6c62f9[_0xb0c4('0x1f')]=qs['offset'](_0x524f10[_0xb0c4('0x31')][_0xb0c4('0x1f')]);}_0x6c62f9[_0xb0c4('0x37')]=qs[_0xb0c4('0x38')](_0x524f10[_0xb0c4('0x31')][_0xb0c4('0x38')]);_0x6c62f9[_0xb0c4('0x39')]=qs[_0xb0c4('0x3a')](_['pick'](_0x524f10[_0xb0c4('0x31')],_0x58c317[_0xb0c4('0x3a')]),_0x2160bc);if(_0x524f10[_0xb0c4('0x31')][_0xb0c4('0x3b')]){_0x6c62f9[_0xb0c4('0x39')]=_[_0xb0c4('0x3c')](_0x6c62f9[_0xb0c4('0x39')],{'$or':_[_0xb0c4('0x30')](_0x2160bc,function(_0x2ea136){if(_0x2ea136[_0xb0c4('0x3d')]!=='VIRTUAL'){var _0x582643={};_0x582643[_0x2ea136['name']]={'$like':'%'+_0x524f10[_0xb0c4('0x31')][_0xb0c4('0x3b')]+'%'};return _0x582643;}})});}_0x6c62f9=_[_0xb0c4('0x3c')]({},_0x6c62f9,_0x524f10[_0xb0c4('0x3e')]);var _0x42e96d={'where':_0x6c62f9[_0xb0c4('0x39')]};return db[_0xb0c4('0x3f')]['count'](_0x42e96d)['then'](function(_0x1b7893){_0x1080a8[_0xb0c4('0x21')]=_0x1b7893;if(_0x524f10[_0xb0c4('0x31')]['includeAll']){_0x6c62f9[_0xb0c4('0x40')]=[{'all':!![]}];}return db[_0xb0c4('0x3f')][_0xb0c4('0x41')](_0x6c62f9);})[_0xb0c4('0x29')](function(_0x46a62f){_0x1080a8[_0xb0c4('0x42')]=_0x46a62f;return _0x1080a8;})[_0xb0c4('0x29')](respondWithFilteredResult(_0x49c033,_0x6c62f9))['catch'](handleError(_0x49c033,null));};exports[_0xb0c4('0x43')]=function(_0x24a946,_0x15af76){var _0x2bef59={'raw':!![],'where':{'id':_0x24a946[_0xb0c4('0x44')]['id']}},_0x252de3={};_0x252de3[_0xb0c4('0x2f')]=_[_0xb0c4('0x45')](db[_0xb0c4('0x3f')]['rawAttributes']);_0x252de3[_0xb0c4('0x31')]=_['keys'](_0x24a946[_0xb0c4('0x31')]);_0x252de3[_0xb0c4('0x3a')]=_['intersection'](_0x252de3[_0xb0c4('0x2f')],_0x252de3['query']);_0x2bef59[_0xb0c4('0x33')]=_['intersection'](_0x252de3[_0xb0c4('0x2f')],qs[_0xb0c4('0x34')](_0x24a946[_0xb0c4('0x31')][_0xb0c4('0x34')]));_0x2bef59['attributes']=_0x2bef59['attributes'][_0xb0c4('0x46')]?_0x2bef59[_0xb0c4('0x33')]:_0x252de3[_0xb0c4('0x2f')];if(_0x24a946[_0xb0c4('0x31')][_0xb0c4('0x47')]){_0x2bef59[_0xb0c4('0x40')]=[{'all':!![]}];}_0x2bef59=_[_0xb0c4('0x3c')]({},_0x2bef59,_0x24a946[_0xb0c4('0x3e')]);return db[_0xb0c4('0x3f')][_0xb0c4('0x48')](_0x2bef59)[_0xb0c4('0x29')](handleEntityNotFound(_0x15af76,null))['then'](respondWithResult(_0x15af76,null))[_0xb0c4('0x49')](handleError(_0x15af76,null));};exports[_0xb0c4('0x4a')]=function(_0x4d1458,_0x46a8e8){return db[_0xb0c4('0x3f')]['create'](_0x4d1458[_0xb0c4('0x4b')],{})[_0xb0c4('0x29')](respondWithResult(_0x46a8e8,0xc9))[_0xb0c4('0x49')](handleError(_0x46a8e8,null));};exports[_0xb0c4('0x28')]=function(_0x1b9314,_0x3ade34){if(_0x1b9314[_0xb0c4('0x4b')]['id']){delete _0x1b9314[_0xb0c4('0x4b')]['id'];}return db['SquareRecording'][_0xb0c4('0x48')]({'where':{'id':_0x1b9314[_0xb0c4('0x44')]['id']}})[_0xb0c4('0x29')](handleEntityNotFound(_0x3ade34,null))['then'](saveUpdates(_0x1b9314[_0xb0c4('0x4b')],null))['then'](respondWithResult(_0x3ade34,null))['catch'](handleError(_0x3ade34,null));};exports[_0xb0c4('0x4c')]=function(_0x233dd6,_0x56878a,_0x544802){var _0x11c14e=require(_0xb0c4('0x4d'));var _0x3c6355=![];var _0x24810f={};if(_0x233dd6[_0xb0c4('0x31')][_0xb0c4('0x3d')]&&_0x233dd6[_0xb0c4('0x31')][_0xb0c4('0x3d')]===_0xb0c4('0x4e')){_0x24810f['uniqueid']=_0x233dd6[_0xb0c4('0x44')]['id'];}else{_0x24810f['id']=_0x233dd6[_0xb0c4('0x44')]['id'];}return db[_0xb0c4('0x3f')]['find']({'where':_0x24810f,'attributes':['id',_0xb0c4('0x4f'),_0xb0c4('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x56878a,null))[_0xb0c4('0x29')](function(_0x3d8466){if(_0x3d8466){var _0x2cb54d=_0x3d8466[_0xb0c4('0x4f')];var _0x42957d=util['format'](_0xb0c4('0x51'),_0x2cb54d);if(fs['existsSync'](_0x42957d)){_0x3c6355=!![];return _0x11c14e['decryptFile'](_0x42957d,_0x2cb54d,config['secrets'][_0xb0c4('0x52')])['then'](function(){return _0x3d8466;});}return _0x3d8466;}})['then'](function(_0x5af9b7){if(_0x5af9b7){var _0x9d0826=_0x5af9b7[_0xb0c4('0x4f')];if(!fs[_0xb0c4('0x53')](_0x9d0826)){throw new db[(_0xb0c4('0x54'))][(_0xb0c4('0x55'))](_0xb0c4('0x56'));}if(_0x5af9b7[_0xb0c4('0x50')]){return _0x56878a[_0xb0c4('0x4c')](_0x9d0826,_0x5af9b7[_0xb0c4('0x50')]+path['extname'](_0x9d0826),function(){if(_0x3c6355){fs[_0xb0c4('0x57')](_0x9d0826);}});}else{return _0x56878a['download'](_0x9d0826,function(_0x3d16ad){if(_0x3c6355){fs[_0xb0c4('0x57')](_0x9d0826);}});}}})[_0xb0c4('0x49')](function(_0x12cced){if(_0x12cced[_0xb0c4('0x58')]==='SquareRecording\x20not\x20found'){_0x56878a['status'](0x194)[_0xb0c4('0x59')](_0xb0c4('0x5a'));}else{return handleError(_0x56878a,null);}});};exports[_0xb0c4('0x5b')]=function(_0x105d60,_0x4fab0f){return db[_0xb0c4('0x3f')][_0xb0c4('0x48')]({'where':{'id':_0x105d60[_0xb0c4('0x44')]['id']}})[_0xb0c4('0x29')](function(_0x2ea930){if(_[_0xb0c4('0x5c')](_0x2ea930)){throw new ReferenceError(_0xb0c4('0x5d'));}return _0x2ea930;})[_0xb0c4('0x29')](function(_0x4eef17){var _0x109a1e=_0x4eef17[_0xb0c4('0x4f')];logger[_0xb0c4('0x5e')]('cancellazione\x20fisica\x20documento\x20%s',_0x109a1e);if(!_[_0xb0c4('0x5c')](_0x4eef17['savePath'])&&fs[_0xb0c4('0x53')](_0x109a1e)){logger[_0xb0c4('0x5e')]('File:\x20\x22'+_0x109a1e+_0xb0c4('0x5f'));fs[_0xb0c4('0x60')](_0x109a1e);}_0x109a1e=_0x109a1e+'.cypher';if(!_[_0xb0c4('0x5c')](_0x4eef17[_0xb0c4('0x4f')])&&fs[_0xb0c4('0x53')](_0x109a1e)){logger[_0xb0c4('0x5e')](_0xb0c4('0x61')+_0x109a1e+_0xb0c4('0x5f'));fs[_0xb0c4('0x60')](_0x109a1e);}return _0x4eef17;})[_0xb0c4('0x29')](function(_0xcb2e77){if(!_0xcb2e77)throw new InternalError();return _0xcb2e77[_0xb0c4('0x5b')]();})[_0xb0c4('0x29')](function(){_0x4fab0f[_0xb0c4('0x1c')](0xcc)[_0xb0c4('0x1d')]();})['catch'](handleError(_0x4fab0f,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 38e2570..7db37b3 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 _0x1b64=['util','api','path','rimraf','../../config/environment','./squareRecording.attributes','lodash'];(function(_0x28f6a4,_0x329f15){var _0x96bf1a=function(_0x581c0e){while(--_0x581c0e){_0x28f6a4['push'](_0x28f6a4['shift']());}};_0x96bf1a(++_0x329f15);}(_0x1b64,0x76));var _0x41b6=function(_0x44acde,_0x14e4d2){_0x44acde=_0x44acde-0x0;var _0x10fdef=_0x1b64[_0x44acde];return _0x10fdef;};'use strict';var _=require(_0x41b6('0x0'));var util=require(_0x41b6('0x1'));var logger=require('../../config/logger')(_0x41b6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x41b6('0x3'));var rimraf=require(_0x41b6('0x4'));var config=require(_0x41b6('0x5'));var attributes=require(_0x41b6('0x6'));module['exports']=function(_0x4562da,_0x2d8af3){return _0x4562da['define']('SquareRecording',attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0309=['square_recordings','lodash','util','../../config/logger','api','moment','request-promise','path','./squareRecording.attributes','define'];(function(_0x51ceb5,_0x415d2b){var _0x43fb10=function(_0x5339bb){while(--_0x5339bb){_0x51ceb5['push'](_0x51ceb5['shift']());}};_0x43fb10(++_0x415d2b);}(_0x0309,0x8d));var _0x9030=function(_0x36a0e4,_0x4f47e9){_0x36a0e4=_0x36a0e4-0x0;var _0x265b3f=_0x0309[_0x36a0e4];return _0x265b3f;};'use strict';var _=require(_0x9030('0x0'));var util=require(_0x9030('0x1'));var logger=require(_0x9030('0x2'))(_0x9030('0x3'));var moment=require(_0x9030('0x4'));var BPromise=require('bluebird');var rp=require(_0x9030('0x5'));var fs=require('fs');var path=require(_0x9030('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9030('0x7'));module['exports']=function(_0x56913f,_0x58c3db){return _0x56913f[_0x9030('0x8')]('SquareRecording',attributes,{'tableName':_0x9030('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 0edbc4a..b4c9694 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 _0xd226=['catch','CreateSquareRecording','create','body','options','raw','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x111311,_0x1e2f69){var _0x4cef39=function(_0x382ab2){while(--_0x382ab2){_0x111311['push'](_0x111311['shift']());}};_0x4cef39(++_0x1e2f69);}(_0xd226,0x13e));var _0x6d22=function(_0x3bd478,_0x1bb19a){_0x3bd478=_0x3bd478-0x0;var _0x5d4211=_0xd226[_0x3bd478];return _0x5d4211;};'use strict';var _=require(_0x6d22('0x0'));var util=require('util');var moment=require(_0x6d22('0x1'));var BPromise=require('bluebird');var rs=require(_0x6d22('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d22('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6d22('0x4'))(_0x6d22('0x5'));var config=require(_0x6d22('0x6'));var jayson=require(_0x6d22('0x7'));var client=jayson[_0x6d22('0x8')][_0x6d22('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x196a1f,_0xe012a3,_0x55e6d5){return new BPromise(function(_0x269af4,_0x37e06b){return client[_0x6d22('0xa')](_0x196a1f,_0x55e6d5)[_0x6d22('0xb')](function(_0x1f4984){logger[_0x6d22('0xc')](_0x6d22('0xd'),_0xe012a3,_0x6d22('0xe'));logger[_0x6d22('0xf')](_0x6d22('0x10'),_0xe012a3,_0x6d22('0xe'),JSON[_0x6d22('0x11')](_0x1f4984));if(_0x1f4984['error']){if(_0x1f4984['error']['code']===0x1f4){logger[_0x6d22('0x12')](_0x6d22('0xd'),_0xe012a3,_0x1f4984[_0x6d22('0x12')][_0x6d22('0x13')]);return _0x37e06b(_0x1f4984['error'][_0x6d22('0x13')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0xe012a3,_0x1f4984[_0x6d22('0x12')][_0x6d22('0x13')]);return _0x269af4(_0x1f4984[_0x6d22('0x12')][_0x6d22('0x13')]);}else{logger[_0x6d22('0xc')](_0x6d22('0xd'),_0xe012a3,_0x6d22('0xe'));_0x269af4(_0x1f4984['result'][_0x6d22('0x13')]);}})[_0x6d22('0x14')](function(_0x2efcd7){logger[_0x6d22('0x12')](_0x6d22('0xd'),_0xe012a3,_0x2efcd7);_0x37e06b(_0x2efcd7);});});}exports[_0x6d22('0x15')]=function(_0x300911){var _0x2f9ad2=this;return new Promise(function(_0x2c43a6,_0x2b9afe){return db['SquareRecording'][_0x6d22('0x16')](_0x300911[_0x6d22('0x17')],{'raw':_0x300911[_0x6d22('0x18')]?_0x300911[_0x6d22('0x18')][_0x6d22('0x19')]===undefined?!![]:![]:!![]})[_0x6d22('0xb')](function(_0x3bf758){logger[_0x6d22('0xc')](_0x6d22('0x15'),_0x300911);logger[_0x6d22('0xf')](_0x6d22('0x15'),_0x300911,JSON[_0x6d22('0x11')](_0x3bf758));_0x2c43a6(_0x3bf758);})[_0x6d22('0x14')](function(_0x45def6){logger[_0x6d22('0x12')](_0x6d22('0x15'),_0x45def6[_0x6d22('0x13')],_0x300911);_0x2b9afe(_0x2f9ad2[_0x6d22('0x12')](0x1f4,_0x45def6[_0x6d22('0x13')]));});});}; \ No newline at end of file +var _0x5ff5=['debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareRecording','SquareRecording','body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent'];(function(_0x280a2e,_0x244c6f){var _0x286f67=function(_0xe4620b){while(--_0xe4620b){_0x280a2e['push'](_0x280a2e['shift']());}};_0x286f67(++_0x244c6f);}(_0x5ff5,0x16b));var _0x55ff=function(_0x54ebc3,_0x69c128){_0x54ebc3=_0x54ebc3-0x0;var _0x145d78=_0x5ff5[_0x54ebc3];return _0x145d78;};'use strict';var _=require(_0x55ff('0x0'));var util=require(_0x55ff('0x1'));var moment=require(_0x55ff('0x2'));var BPromise=require(_0x55ff('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x55ff('0x4'));var db=require(_0x55ff('0x5'))['db'];var utils=require(_0x55ff('0x6'));var logger=require(_0x55ff('0x7'))('rpc');var config=require(_0x55ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x55ff('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa3bdd7,_0x5f5b2c,_0xb4888b){return new BPromise(function(_0x283027,_0x5090b9){return client[_0x55ff('0xa')](_0xa3bdd7,_0xb4888b)[_0x55ff('0xb')](function(_0x20f870){logger[_0x55ff('0xc')](_0x55ff('0xd'),_0x5f5b2c,_0x55ff('0xe'));logger[_0x55ff('0xf')](_0x55ff('0x10'),_0x5f5b2c,_0x55ff('0xe'),JSON[_0x55ff('0x11')](_0x20f870));if(_0x20f870[_0x55ff('0x12')]){if(_0x20f870[_0x55ff('0x12')][_0x55ff('0x13')]===0x1f4){logger[_0x55ff('0x12')](_0x55ff('0xd'),_0x5f5b2c,_0x20f870['error'][_0x55ff('0x14')]);return _0x5090b9(_0x20f870[_0x55ff('0x12')][_0x55ff('0x14')]);}logger[_0x55ff('0x12')]('SquareRecording,\x20%s,\x20%s',_0x5f5b2c,_0x20f870[_0x55ff('0x12')][_0x55ff('0x14')]);return _0x283027(_0x20f870[_0x55ff('0x12')][_0x55ff('0x14')]);}else{logger[_0x55ff('0xc')](_0x55ff('0xd'),_0x5f5b2c,_0x55ff('0xe'));_0x283027(_0x20f870[_0x55ff('0x15')][_0x55ff('0x14')]);}})['catch'](function(_0x4406e0){logger[_0x55ff('0x12')](_0x55ff('0xd'),_0x5f5b2c,_0x4406e0);_0x5090b9(_0x4406e0);});});}exports[_0x55ff('0x16')]=function(_0x35570a){var _0x1011d3=this;return new Promise(function(_0x4717db,_0xa86da4){return db[_0x55ff('0x17')]['create'](_0x35570a[_0x55ff('0x18')],{'raw':_0x35570a[_0x55ff('0x19')]?_0x35570a[_0x55ff('0x19')][_0x55ff('0x1a')]===undefined?!![]:![]:!![]})[_0x55ff('0xb')](function(_0x58f973){logger[_0x55ff('0xc')](_0x55ff('0x16'),_0x35570a);logger[_0x55ff('0xf')]('CreateSquareRecording',_0x35570a,JSON[_0x55ff('0x11')](_0x58f973));_0x4717db(_0x58f973);})['catch'](function(_0x6414c5){logger[_0x55ff('0x12')](_0x55ff('0x16'),_0x6414c5[_0x55ff('0x14')],_0x35570a);_0xa86da4(_0x1011d3[_0x55ff('0x12')](0x1f4,_0x6414c5['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 767841b..50000bb 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x1389de,_0x54250f){var _0x2dba13=function(_0x31ad66){while(--_0x31ad66){_0x1389de['push'](_0x1389de['shift']());}};_0x2dba13(++_0x54250f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x4b88a0,_0x999916){var _0x1d00b1=function(_0x5bc667){while(--_0x5bc667){_0x4b88a0['push'](_0x4b88a0['shift']());}};_0x1d00b1(++_0x999916);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 0d61d23..9641fc0 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 _0xe496=['exports','STRING','DATE'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xe496,0x114));var _0x6e49=function(_0x1bbc86,_0x27e57b){_0x1bbc86=_0x1bbc86-0x0;var _0x5de2f4=_0xe496[_0x1bbc86];return _0x5de2f4;};'use strict';var Sequelize=require('sequelize');module[_0x6e49('0x0')]={'network':{'type':Sequelize[_0x6e49('0x1')]},'network_script':{'type':Sequelize[_0x6e49('0x1')]},'request':{'type':Sequelize[_0x6e49('0x1')]},'channel':{'type':Sequelize[_0x6e49('0x1')]},'language':{'type':Sequelize[_0x6e49('0x1')]},'type':{'type':Sequelize[_0x6e49('0x1')]},'uniqueid':{'type':Sequelize[_0x6e49('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x6e49('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x6e49('0x1')]},'callingtns':{'type':Sequelize[_0x6e49('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x6e49('0x1')]},'context':{'type':Sequelize[_0x6e49('0x1')]},'extension':{'type':Sequelize[_0x6e49('0x1')]},'priority':{'type':Sequelize[_0x6e49('0x1')]},'enhanced':{'type':Sequelize[_0x6e49('0x1')]},'accountcode':{'type':Sequelize[_0x6e49('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x6e49('0x1')]},'joinAt':{'type':Sequelize[_0x6e49('0x2')]},'leaveAt':{'type':Sequelize[_0x6e49('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xf03e=['BOOLEAN','sequelize','exports','STRING'];(function(_0x3068c8,_0x1f5504){var _0x40c6e4=function(_0x4e1f11){while(--_0x4e1f11){_0x3068c8['push'](_0x3068c8['shift']());}};_0x40c6e4(++_0x1f5504);}(_0xf03e,0x129));var _0xef03=function(_0x9f2f79,_0x5d8d53){_0x9f2f79=_0x9f2f79-0x0;var _0x4f066b=_0xf03e[_0x9f2f79];return _0x4f066b;};'use strict';var Sequelize=require(_0xef03('0x0'));module[_0xef03('0x1')]={'network':{'type':Sequelize[_0xef03('0x2')]},'network_script':{'type':Sequelize[_0xef03('0x2')]},'request':{'type':Sequelize[_0xef03('0x2')]},'channel':{'type':Sequelize[_0xef03('0x2')]},'language':{'type':Sequelize[_0xef03('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xef03('0x2')]},'version':{'type':Sequelize[_0xef03('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xef03('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xef03('0x2')]},'callington':{'type':Sequelize[_0xef03('0x2')]},'callingtns':{'type':Sequelize[_0xef03('0x2')]},'dnid':{'type':Sequelize[_0xef03('0x2')]},'rdnis':{'type':Sequelize[_0xef03('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xef03('0x2')]},'priority':{'type':Sequelize[_0xef03('0x2')]},'enhanced':{'type':Sequelize[_0xef03('0x2')]},'accountcode':{'type':Sequelize[_0xef03('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xef03('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index ab91966..9403cfe 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 _0x64cb=['ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','destroy','then','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse'];(function(_0x3af6d5,_0x170dbc){var _0x5458a3=function(_0x2cb06a){while(--_0x2cb06a){_0x3af6d5['push'](_0x3af6d5['shift']());}};_0x5458a3(++_0x170dbc);}(_0x64cb,0x86));var _0xb64c=function(_0x28d252,_0x160cb9){_0x28d252=_0x28d252-0x0;var _0x48d8cb=_0x64cb[_0x28d252];return _0x48d8cb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb64c('0x0'));var zipdir=require(_0xb64c('0x1'));var jsonpatch=require(_0xb64c('0x2'));var rp=require(_0xb64c('0x3'));var moment=require(_0xb64c('0x4'));var BPromise=require(_0xb64c('0x5'));var Mustache=require(_0xb64c('0x6'));var util=require(_0xb64c('0x7'));var path=require(_0xb64c('0x8'));var sox=require(_0xb64c('0x9'));var csv=require(_0xb64c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb64c('0xb'));var squel=require('squel');var crypto=require(_0xb64c('0xc'));var jsforce=require(_0xb64c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb64c('0xe'));var Papa=require(_0xb64c('0xf'));var Redis=require(_0xb64c('0x10'));var authService=require(_0xb64c('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb64c('0x12'))(_0xb64c('0x13'));var utils=require(_0xb64c('0x14'));var config=require(_0xb64c('0x15'));var licenseUtil=require(_0xb64c('0x16'));var db=require(_0xb64c('0x17'))['db'];function respondWithStatusCode(_0x581c22,_0x2f492d){_0x2f492d=_0x2f492d||0xcc;return function(_0x89d8de){if(_0x89d8de){return _0x581c22[_0xb64c('0x18')](_0x2f492d);}return _0x581c22['status'](_0x2f492d)[_0xb64c('0x19')]();};}function respondWithResult(_0x25d354,_0x53de44){_0x53de44=_0x53de44||0xc8;return function(_0xa7998){if(_0xa7998){return _0x25d354[_0xb64c('0x1a')](_0x53de44)['json'](_0xa7998);}};}function respondWithFilteredResult(_0x2ffd1b,_0x2bc425){return function(_0x43115e){if(_0x43115e){var _0xb8d321=typeof _0x2bc425[_0xb64c('0x1b')]===_0xb64c('0x1c')&&typeof _0x2bc425[_0xb64c('0x1d')]===_0xb64c('0x1c');var _0x5590f8=_0x43115e[_0xb64c('0x1e')];var _0x58a0b6=_0xb8d321?0x0:_0x2bc425[_0xb64c('0x1b')];var _0x16055f=_0xb8d321?_0x43115e['count']:_0x2bc425[_0xb64c('0x1b')]+_0x2bc425['limit'];var _0x4daef0;if(_0x16055f>=_0x5590f8){_0x16055f=_0x5590f8;_0x4daef0=0xc8;}else{_0x4daef0=0xce;}_0x2ffd1b[_0xb64c('0x1a')](_0x4daef0);return _0x2ffd1b[_0xb64c('0x1f')](_0xb64c('0x20'),_0x58a0b6+'-'+_0x16055f+'/'+_0x5590f8)[_0xb64c('0x21')](_0x43115e);}return null;};}function patchUpdates(_0x44c5b2){return function(_0x3ce093){try{jsonpatch['apply'](_0x3ce093,_0x44c5b2,!![]);}catch(_0x3ae3a0){return BPromise['reject'](_0x3ae3a0);}return _0x3ce093['save']();};}function saveUpdates(_0x3c55b7,_0x4144aa){return function(_0x19cdd8){if(_0x19cdd8){return _0x19cdd8['update'](_0x3c55b7)['then'](function(_0x15a3eb){return _0x15a3eb;});}return null;};}function removeEntity(_0x4c749e,_0x244a37){return function(_0x2b8646){if(_0x2b8646){return _0x2b8646[_0xb64c('0x22')]()[_0xb64c('0x23')](function(){_0x4c749e[_0xb64c('0x1a')](0xcc)[_0xb64c('0x19')]();});}};}function handleEntityNotFound(_0x1b2501,_0x5e88eb){return function(_0xcaa377){if(!_0xcaa377){_0x1b2501[_0xb64c('0x18')](0x194);}return _0xcaa377;};}function handleError(_0x2d5edd,_0x14e226){_0x14e226=_0x14e226||0x1f4;return function(_0x3dca7c){logger[_0xb64c('0x24')](_0x3dca7c[_0xb64c('0x25')]);if(_0x3dca7c[_0xb64c('0x26')]){delete _0x3dca7c[_0xb64c('0x26')];}_0x2d5edd['status'](_0x14e226)[_0xb64c('0x27')](_0x3dca7c);};}exports[_0xb64c('0x28')]=function(_0x5ae468,_0x577bc6){var _0x1f19d9={},_0x598241={},_0x559948={'count':0x0,'rows':[]};var _0x1d0c2c=_[_0xb64c('0x29')](db[_0xb64c('0x2a')][_0xb64c('0x2b')],function(_0x507f00){return{'name':_0x507f00[_0xb64c('0x2c')],'type':_0x507f00[_0xb64c('0x2d')]['key']};});_0x598241['model']=_[_0xb64c('0x29')](_0x1d0c2c,'name');_0x598241[_0xb64c('0x2e')]=_['keys'](_0x5ae468[_0xb64c('0x2e')]);_0x598241['filters']=_['intersection'](_0x598241[_0xb64c('0x2f')],_0x598241['query']);_0x1f19d9[_0xb64c('0x30')]=_[_0xb64c('0x31')](_0x598241[_0xb64c('0x2f')],qs[_0xb64c('0x32')](_0x5ae468['query']['fields']));_0x1f19d9[_0xb64c('0x30')]=_0x1f19d9[_0xb64c('0x30')][_0xb64c('0x33')]?_0x1f19d9[_0xb64c('0x30')]:_0x598241[_0xb64c('0x2f')];if(!_0x5ae468[_0xb64c('0x2e')][_0xb64c('0x34')](_0xb64c('0x35'))){_0x1f19d9[_0xb64c('0x1d')]=qs[_0xb64c('0x1d')](_0x5ae468['query'][_0xb64c('0x1d')]);_0x1f19d9[_0xb64c('0x1b')]=qs[_0xb64c('0x1b')](_0x5ae468['query']['offset']);}_0x1f19d9[_0xb64c('0x36')]=qs[_0xb64c('0x37')](_0x5ae468[_0xb64c('0x2e')][_0xb64c('0x37')]);_0x1f19d9[_0xb64c('0x38')]=qs[_0xb64c('0x39')](_[_0xb64c('0x3a')](_0x5ae468['query'],_0x598241[_0xb64c('0x39')]),_0x1d0c2c);if(_0x5ae468[_0xb64c('0x2e')][_0xb64c('0x3b')]){_0x1f19d9[_0xb64c('0x38')]=_[_0xb64c('0x3c')](_0x1f19d9[_0xb64c('0x38')],{'$or':_[_0xb64c('0x29')](_0x1d0c2c,function(_0x531637){if(_0x531637['type']!=='VIRTUAL'){var _0x50f95d={};_0x50f95d[_0x531637[_0xb64c('0x26')]]={'$like':'%'+_0x5ae468[_0xb64c('0x2e')][_0xb64c('0x3b')]+'%'};return _0x50f95d;}})});}_0x1f19d9=_[_0xb64c('0x3c')]({},_0x1f19d9,_0x5ae468[_0xb64c('0x3d')]);var _0x83d224={'where':_0x1f19d9[_0xb64c('0x38')]};return db[_0xb64c('0x2a')][_0xb64c('0x1e')](_0x83d224)[_0xb64c('0x23')](function(_0x3ad115){_0x559948[_0xb64c('0x1e')]=_0x3ad115;if(_0x5ae468['query'][_0xb64c('0x3e')]){_0x1f19d9[_0xb64c('0x3f')]=[{'all':!![]}];}return db[_0xb64c('0x2a')][_0xb64c('0x40')](_0x1f19d9);})[_0xb64c('0x23')](function(_0x127eea){_0x559948[_0xb64c('0x41')]=_0x127eea;return _0x559948;})[_0xb64c('0x23')](respondWithFilteredResult(_0x577bc6,_0x1f19d9))[_0xb64c('0x42')](handleError(_0x577bc6,null));};exports[_0xb64c('0x43')]=function(_0x50e602,_0x27b3c5){var _0x5d7b64={'raw':!![],'where':{'id':_0x50e602[_0xb64c('0x44')]['id']}},_0x2f62c0={};_0x2f62c0['model']=_['keys'](db[_0xb64c('0x2a')]['rawAttributes']);_0x2f62c0[_0xb64c('0x2e')]=_[_0xb64c('0x45')](_0x50e602[_0xb64c('0x2e')]);_0x2f62c0[_0xb64c('0x39')]=_['intersection'](_0x2f62c0[_0xb64c('0x2f')],_0x2f62c0[_0xb64c('0x2e')]);_0x5d7b64[_0xb64c('0x30')]=_[_0xb64c('0x31')](_0x2f62c0['model'],qs[_0xb64c('0x32')](_0x50e602['query'][_0xb64c('0x32')]));_0x5d7b64['attributes']=_0x5d7b64['attributes']['length']?_0x5d7b64[_0xb64c('0x30')]:_0x2f62c0['model'];if(_0x50e602[_0xb64c('0x2e')]['includeAll']){_0x5d7b64[_0xb64c('0x3f')]=[{'all':!![]}];}_0x5d7b64=_[_0xb64c('0x3c')]({},_0x5d7b64,_0x50e602[_0xb64c('0x3d')]);return db['SquareReport'][_0xb64c('0x46')](_0x5d7b64)[_0xb64c('0x23')](handleEntityNotFound(_0x27b3c5,null))[_0xb64c('0x23')](respondWithResult(_0x27b3c5,null))[_0xb64c('0x42')](handleError(_0x27b3c5,null));};exports[_0xb64c('0x47')]=function(_0x4b952c,_0x43e380){return db[_0xb64c('0x2a')][_0xb64c('0x47')](_0x4b952c[_0xb64c('0x48')],{})[_0xb64c('0x23')](respondWithResult(_0x43e380,0xc9))[_0xb64c('0x42')](handleError(_0x43e380,null));};exports[_0xb64c('0x49')]=function(_0x15ea54,_0x5e1daa){if(_0x15ea54[_0xb64c('0x48')]['id']){delete _0x15ea54[_0xb64c('0x48')]['id'];}return db['SquareReport'][_0xb64c('0x46')]({'where':{'id':_0x15ea54[_0xb64c('0x44')]['id']}})['then'](handleEntityNotFound(_0x5e1daa,null))[_0xb64c('0x23')](saveUpdates(_0x15ea54['body'],null))[_0xb64c('0x23')](respondWithResult(_0x5e1daa,null))[_0xb64c('0x42')](handleError(_0x5e1daa,null));};exports[_0xb64c('0x22')]=function(_0x1223f3,_0x28aa61){return db[_0xb64c('0x2a')]['find']({'where':{'id':_0x1223f3[_0xb64c('0x44')]['id']}})[_0xb64c('0x23')](handleEntityNotFound(_0x28aa61,null))[_0xb64c('0x23')](removeEntity(_0x28aa61,null))[_0xb64c('0x42')](handleError(_0x28aa61,null));};exports[_0xb64c('0x4a')]=function(_0x19c1d2,_0x418c21){return db[_0xb64c('0x2a')][_0xb64c('0x4a')]()[_0xb64c('0x23')](respondWithResult(_0x418c21,null))[_0xb64c('0x42')](handleError(_0x418c21,null));}; \ No newline at end of file +var _0x6fe6=['ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareReport','includeAll','findAll','rows','catch','show','params','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring'];(function(_0x4e029f,_0x177074){var _0x135b7e=function(_0x37caff){while(--_0x37caff){_0x4e029f['push'](_0x4e029f['shift']());}};_0x135b7e(++_0x177074);}(_0x6fe6,0x15c));var _0x66fe=function(_0x414d13,_0x408f14){_0x414d13=_0x414d13-0x0;var _0xeef0b=_0x6fe6[_0x414d13];return _0xeef0b;};'use strict';var emlformat=require(_0x66fe('0x0'));var rimraf=require(_0x66fe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x66fe('0x2'));var rp=require(_0x66fe('0x3'));var moment=require(_0x66fe('0x4'));var BPromise=require(_0x66fe('0x5'));var Mustache=require(_0x66fe('0x6'));var util=require(_0x66fe('0x7'));var path=require(_0x66fe('0x8'));var sox=require(_0x66fe('0x9'));var csv=require(_0x66fe('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x66fe('0xb'));var _=require(_0x66fe('0xc'));var squel=require(_0x66fe('0xd'));var crypto=require(_0x66fe('0xe'));var jsforce=require(_0x66fe('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x66fe('0x10'));var Papa=require('papaparse');var Redis=require(_0x66fe('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x66fe('0x12'));var hardwareService=require(_0x66fe('0x13'));var logger=require(_0x66fe('0x14'))('api');var utils=require(_0x66fe('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x66fe('0x16'));var db=require(_0x66fe('0x17'))['db'];function respondWithStatusCode(_0x4ab326,_0x1693e5){_0x1693e5=_0x1693e5||0xcc;return function(_0x50d848){if(_0x50d848){return _0x4ab326[_0x66fe('0x18')](_0x1693e5);}return _0x4ab326[_0x66fe('0x19')](_0x1693e5)[_0x66fe('0x1a')]();};}function respondWithResult(_0x410b64,_0x45a795){_0x45a795=_0x45a795||0xc8;return function(_0x476e1e){if(_0x476e1e){return _0x410b64['status'](_0x45a795)[_0x66fe('0x1b')](_0x476e1e);}};}function respondWithFilteredResult(_0x4e56e0,_0x136064){return function(_0x1a0b88){if(_0x1a0b88){var _0x3204e5=typeof _0x136064[_0x66fe('0x1c')]===_0x66fe('0x1d')&&typeof _0x136064['limit']==='undefined';var _0x1b846e=_0x1a0b88['count'];var _0x7383e8=_0x3204e5?0x0:_0x136064[_0x66fe('0x1c')];var _0xa21d97=_0x3204e5?_0x1a0b88[_0x66fe('0x1e')]:_0x136064[_0x66fe('0x1c')]+_0x136064['limit'];var _0x22c3a3;if(_0xa21d97>=_0x1b846e){_0xa21d97=_0x1b846e;_0x22c3a3=0xc8;}else{_0x22c3a3=0xce;}_0x4e56e0['status'](_0x22c3a3);return _0x4e56e0[_0x66fe('0x1f')](_0x66fe('0x20'),_0x7383e8+'-'+_0xa21d97+'/'+_0x1b846e)['json'](_0x1a0b88);}return null;};}function patchUpdates(_0x9b806f){return function(_0x42f8eb){try{jsonpatch[_0x66fe('0x21')](_0x42f8eb,_0x9b806f,!![]);}catch(_0x36ec7d){return BPromise[_0x66fe('0x22')](_0x36ec7d);}return _0x42f8eb[_0x66fe('0x23')]();};}function saveUpdates(_0x63c0e1,_0x56180c){return function(_0x2c2df5){if(_0x2c2df5){return _0x2c2df5[_0x66fe('0x24')](_0x63c0e1)[_0x66fe('0x25')](function(_0x5e5011){return _0x5e5011;});}return null;};}function removeEntity(_0x1d339b,_0x38e761){return function(_0x5f4e56){if(_0x5f4e56){return _0x5f4e56[_0x66fe('0x26')]()[_0x66fe('0x25')](function(){_0x1d339b['status'](0xcc)[_0x66fe('0x1a')]();});}};}function handleEntityNotFound(_0x4cec36,_0x569507){return function(_0xf70b2b){if(!_0xf70b2b){_0x4cec36['sendStatus'](0x194);}return _0xf70b2b;};}function handleError(_0x4cbccd,_0x5cac40){_0x5cac40=_0x5cac40||0x1f4;return function(_0x26d75d){logger[_0x66fe('0x27')](_0x26d75d['stack']);if(_0x26d75d[_0x66fe('0x28')]){delete _0x26d75d[_0x66fe('0x28')];}_0x4cbccd['status'](_0x5cac40)['send'](_0x26d75d);};}exports['index']=function(_0x13ba4d,_0x281609){var _0x3b6013={},_0x410d3c={},_0x321543={'count':0x0,'rows':[]};var _0x57a2bd=_['map'](db['SquareReport']['rawAttributes'],function(_0x2fcd8d){return{'name':_0x2fcd8d['fieldName'],'type':_0x2fcd8d[_0x66fe('0x29')][_0x66fe('0x2a')]};});_0x410d3c[_0x66fe('0x2b')]=_[_0x66fe('0x2c')](_0x57a2bd,_0x66fe('0x28'));_0x410d3c[_0x66fe('0x2d')]=_[_0x66fe('0x2e')](_0x13ba4d['query']);_0x410d3c[_0x66fe('0x2f')]=_[_0x66fe('0x30')](_0x410d3c[_0x66fe('0x2b')],_0x410d3c[_0x66fe('0x2d')]);_0x3b6013[_0x66fe('0x31')]=_[_0x66fe('0x30')](_0x410d3c['model'],qs[_0x66fe('0x32')](_0x13ba4d[_0x66fe('0x2d')][_0x66fe('0x32')]));_0x3b6013['attributes']=_0x3b6013[_0x66fe('0x31')][_0x66fe('0x33')]?_0x3b6013['attributes']:_0x410d3c['model'];if(!_0x13ba4d[_0x66fe('0x2d')][_0x66fe('0x34')](_0x66fe('0x35'))){_0x3b6013[_0x66fe('0x36')]=qs[_0x66fe('0x36')](_0x13ba4d[_0x66fe('0x2d')][_0x66fe('0x36')]);_0x3b6013[_0x66fe('0x1c')]=qs[_0x66fe('0x1c')](_0x13ba4d['query']['offset']);}_0x3b6013[_0x66fe('0x37')]=qs[_0x66fe('0x38')](_0x13ba4d[_0x66fe('0x2d')][_0x66fe('0x38')]);_0x3b6013[_0x66fe('0x39')]=qs[_0x66fe('0x2f')](_[_0x66fe('0x3a')](_0x13ba4d['query'],_0x410d3c['filters']),_0x57a2bd);if(_0x13ba4d['query'][_0x66fe('0x3b')]){_0x3b6013[_0x66fe('0x39')]=_[_0x66fe('0x3c')](_0x3b6013[_0x66fe('0x39')],{'$or':_[_0x66fe('0x2c')](_0x57a2bd,function(_0x3b6048){if(_0x3b6048['type']!==_0x66fe('0x3d')){var _0x4d7b60={};_0x4d7b60[_0x3b6048['name']]={'$like':'%'+_0x13ba4d[_0x66fe('0x2d')]['filter']+'%'};return _0x4d7b60;}})});}_0x3b6013=_[_0x66fe('0x3c')]({},_0x3b6013,_0x13ba4d[_0x66fe('0x3e')]);var _0x573040={'where':_0x3b6013[_0x66fe('0x39')]};return db[_0x66fe('0x3f')]['count'](_0x573040)[_0x66fe('0x25')](function(_0x540343){_0x321543[_0x66fe('0x1e')]=_0x540343;if(_0x13ba4d['query'][_0x66fe('0x40')]){_0x3b6013['include']=[{'all':!![]}];}return db[_0x66fe('0x3f')][_0x66fe('0x41')](_0x3b6013);})['then'](function(_0x2e53ab){_0x321543[_0x66fe('0x42')]=_0x2e53ab;return _0x321543;})[_0x66fe('0x25')](respondWithFilteredResult(_0x281609,_0x3b6013))[_0x66fe('0x43')](handleError(_0x281609,null));};exports[_0x66fe('0x44')]=function(_0x100814,_0x5dcf41){var _0x5011bf={'raw':!![],'where':{'id':_0x100814[_0x66fe('0x45')]['id']}},_0x124716={};_0x124716[_0x66fe('0x2b')]=_['keys'](db[_0x66fe('0x3f')]['rawAttributes']);_0x124716[_0x66fe('0x2d')]=_[_0x66fe('0x2e')](_0x100814[_0x66fe('0x2d')]);_0x124716[_0x66fe('0x2f')]=_[_0x66fe('0x30')](_0x124716[_0x66fe('0x2b')],_0x124716[_0x66fe('0x2d')]);_0x5011bf['attributes']=_[_0x66fe('0x30')](_0x124716[_0x66fe('0x2b')],qs[_0x66fe('0x32')](_0x100814[_0x66fe('0x2d')][_0x66fe('0x32')]));_0x5011bf[_0x66fe('0x31')]=_0x5011bf[_0x66fe('0x31')][_0x66fe('0x33')]?_0x5011bf[_0x66fe('0x31')]:_0x124716[_0x66fe('0x2b')];if(_0x100814['query'][_0x66fe('0x40')]){_0x5011bf['include']=[{'all':!![]}];}_0x5011bf=_[_0x66fe('0x3c')]({},_0x5011bf,_0x100814[_0x66fe('0x3e')]);return db['SquareReport']['find'](_0x5011bf)[_0x66fe('0x25')](handleEntityNotFound(_0x5dcf41,null))[_0x66fe('0x25')](respondWithResult(_0x5dcf41,null))[_0x66fe('0x43')](handleError(_0x5dcf41,null));};exports['create']=function(_0x2463ee,_0x1d1542){return db[_0x66fe('0x3f')]['create'](_0x2463ee[_0x66fe('0x46')],{})['then'](respondWithResult(_0x1d1542,0xc9))['catch'](handleError(_0x1d1542,null));};exports[_0x66fe('0x24')]=function(_0x26e648,_0x284c2b){if(_0x26e648['body']['id']){delete _0x26e648[_0x66fe('0x46')]['id'];}return db[_0x66fe('0x3f')][_0x66fe('0x47')]({'where':{'id':_0x26e648[_0x66fe('0x45')]['id']}})[_0x66fe('0x25')](handleEntityNotFound(_0x284c2b,null))[_0x66fe('0x25')](saveUpdates(_0x26e648[_0x66fe('0x46')],null))['then'](respondWithResult(_0x284c2b,null))[_0x66fe('0x43')](handleError(_0x284c2b,null));};exports['destroy']=function(_0x31b6a7,_0x426322){return db[_0x66fe('0x3f')][_0x66fe('0x47')]({'where':{'id':_0x31b6a7[_0x66fe('0x45')]['id']}})['then'](handleEntityNotFound(_0x426322,null))[_0x66fe('0x25')](removeEntity(_0x426322,null))['catch'](handleError(_0x426322,null));};exports[_0x66fe('0x48')]=function(_0x57e8aa,_0x2aab5d){return db['SquareReport'][_0x66fe('0x48')]()[_0x66fe('0x25')](respondWithResult(_0x2aab5d,null))[_0x66fe('0x43')](handleError(_0x2aab5d,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 4a59e69..caf2d9b 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 _0xc9a0=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','util'];(function(_0x3a493c,_0x2db3f8){var _0x46c900=function(_0xf4bad4){while(--_0xf4bad4){_0x3a493c['push'](_0x3a493c['shift']());}};_0x46c900(++_0x2db3f8);}(_0xc9a0,0x1ec));var _0x0c9a=function(_0x314f47,_0x3b1d4e){_0x314f47=_0x314f47-0x0;var _0x470ad9=_0xc9a0[_0x314f47];return _0x470ad9;};'use strict';var _=require('lodash');var util=require(_0x0c9a('0x0'));var logger=require('../../config/logger')(_0x0c9a('0x1'));var moment=require(_0x0c9a('0x2'));var BPromise=require(_0x0c9a('0x3'));var rp=require(_0x0c9a('0x4'));var fs=require('fs');var path=require(_0x0c9a('0x5'));var rimraf=require(_0x0c9a('0x6'));var config=require(_0x0c9a('0x7'));var attributes=require(_0x0c9a('0x8'));module[_0x0c9a('0x9')]=function(_0x1744f7,_0x61b468){return _0x1744f7[_0x0c9a('0xa')](_0x0c9a('0xb'),attributes,{'tableName':_0x0c9a('0xc'),'paranoid':![],'indexes':[{'name':_0x0c9a('0xd'),'fields':[_0x0c9a('0xe'),_0x0c9a('0xf')]},{'name':'leaveAt','fields':[_0x0c9a('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0e64=['rimraf','../../config/environment','define','SquareReport','report_square','uniqueid','project_name','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0xbb701e,_0x3b704f){var _0xc53f35=function(_0x3094a9){while(--_0x3094a9){_0xbb701e['push'](_0xbb701e['shift']());}};_0xc53f35(++_0x3b704f);}(_0x0e64,0x157));var _0x40e6=function(_0x3cdbdc,_0x1c1439){_0x3cdbdc=_0x3cdbdc-0x0;var _0x3e001d=_0x0e64[_0x3cdbdc];return _0x3e001d;};'use strict';var _=require(_0x40e6('0x0'));var util=require(_0x40e6('0x1'));var logger=require(_0x40e6('0x2'))(_0x40e6('0x3'));var moment=require('moment');var BPromise=require(_0x40e6('0x4'));var rp=require(_0x40e6('0x5'));var fs=require('fs');var path=require(_0x40e6('0x6'));var rimraf=require(_0x40e6('0x7'));var config=require(_0x40e6('0x8'));var attributes=require('./squareReport.attributes');module['exports']=function(_0x57b67f,_0x2c44f7){return _0x57b67f[_0x40e6('0x9')](_0x40e6('0xa'),attributes,{'tableName':_0x40e6('0xb'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x40e6('0xc'),_0x40e6('0xd')]},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 5731266..972c28f 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 _0xbf69=['debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SquareReport','create','body','options','raw','catch','UpdateSquareReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xbf69,0x78));var _0x9bf6=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xbf69[_0x24f31b];return _0x488401;};'use strict';var _=require(_0x9bf6('0x0'));var util=require(_0x9bf6('0x1'));var moment=require(_0x9bf6('0x2'));var BPromise=require(_0x9bf6('0x3'));var rs=require(_0x9bf6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9bf6('0x5'))['db'];var utils=require(_0x9bf6('0x6'));var logger=require('../../config/logger')(_0x9bf6('0x7'));var config=require('../../config/environment');var jayson=require(_0x9bf6('0x8'));var client=jayson[_0x9bf6('0x9')][_0x9bf6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38e310,_0xe3f075,_0x187090){return new BPromise(function(_0x1c6041,_0x24df54){return client[_0x9bf6('0xb')](_0x38e310,_0x187090)[_0x9bf6('0xc')](function(_0x44fbb1){logger[_0x9bf6('0xd')](_0x9bf6('0xe'),_0xe3f075,_0x9bf6('0xf'));logger[_0x9bf6('0x10')](_0x9bf6('0x11'),_0xe3f075,'request\x20sent',JSON[_0x9bf6('0x12')](_0x44fbb1));if(_0x44fbb1[_0x9bf6('0x13')]){if(_0x44fbb1[_0x9bf6('0x13')][_0x9bf6('0x14')]===0x1f4){logger['error'](_0x9bf6('0xe'),_0xe3f075,_0x44fbb1['error']['message']);return _0x24df54(_0x44fbb1[_0x9bf6('0x13')][_0x9bf6('0x15')]);}logger['error']('SquareReport,\x20%s,\x20%s',_0xe3f075,_0x44fbb1[_0x9bf6('0x13')][_0x9bf6('0x15')]);return _0x1c6041(_0x44fbb1[_0x9bf6('0x13')][_0x9bf6('0x15')]);}else{logger[_0x9bf6('0xd')](_0x9bf6('0xe'),_0xe3f075,'request\x20sent');_0x1c6041(_0x44fbb1[_0x9bf6('0x16')][_0x9bf6('0x15')]);}})['catch'](function(_0x435da3){logger[_0x9bf6('0x13')]('SquareReport,\x20%s,\x20%s',_0xe3f075,_0x435da3);_0x24df54(_0x435da3);});});}exports['CreateSquareReport']=function(_0x52553e){var _0x6bbb65=this;return new Promise(function(_0x30a044,_0x8db428){return db[_0x9bf6('0x17')][_0x9bf6('0x18')](_0x52553e[_0x9bf6('0x19')],{'raw':_0x52553e['options']?_0x52553e[_0x9bf6('0x1a')][_0x9bf6('0x1b')]===undefined?!![]:![]:!![]})[_0x9bf6('0xc')](function(_0x721de8){logger[_0x9bf6('0xd')]('CreateSquareReport',_0x52553e);logger[_0x9bf6('0x10')]('CreateSquareReport',_0x52553e,JSON[_0x9bf6('0x12')](_0x721de8));_0x30a044(_0x721de8);})[_0x9bf6('0x1c')](function(_0x466db0){logger[_0x9bf6('0x13')]('CreateSquareReport',_0x466db0[_0x9bf6('0x15')],_0x52553e);_0x8db428(_0x6bbb65[_0x9bf6('0x13')](0x1f4,_0x466db0[_0x9bf6('0x15')]));});});};exports[_0x9bf6('0x1d')]=function(_0x53dc11){var _0x5c9377=this;return new Promise(function(_0x6d04c6,_0x2cacc8){return db['SquareReport'][_0x9bf6('0x1e')](_0x53dc11[_0x9bf6('0x19')],{'raw':_0x53dc11[_0x9bf6('0x1a')]?_0x53dc11[_0x9bf6('0x1a')][_0x9bf6('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53dc11[_0x9bf6('0x1a')]?_0x53dc11[_0x9bf6('0x1a')][_0x9bf6('0x1f')]||null:null,'attributes':_0x53dc11[_0x9bf6('0x1a')]?_0x53dc11['options'][_0x9bf6('0x20')]||null:null,'limit':_0x53dc11['options']?_0x53dc11['options'][_0x9bf6('0x21')]||null:null})[_0x9bf6('0xc')](function(_0x165765){logger['info'](_0x9bf6('0x1d'),_0x53dc11);logger['debug'](_0x9bf6('0x1d'),_0x53dc11,JSON['stringify'](_0x165765));_0x6d04c6(_0x165765);})[_0x9bf6('0x1c')](function(_0x4bbcd3){logger['error'](_0x9bf6('0x1d'),_0x4bbcd3[_0x9bf6('0x15')],_0x53dc11);_0x2cacc8(_0x5c9377[_0x9bf6('0x13')](0x1f4,_0x4bbcd3['message']));});});}; \ No newline at end of file +var _0xb598=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','UpdateSquareReport','update','raw','where','attributes','limit'];(function(_0x5c1b0c,_0x12cfba){var _0x268a79=function(_0x30af08){while(--_0x30af08){_0x5c1b0c['push'](_0x5c1b0c['shift']());}};_0x268a79(++_0x12cfba);}(_0xb598,0x168));var _0x8b59=function(_0x513152,_0x5eb35d){_0x513152=_0x513152-0x0;var _0x1cd08b=_0xb598[_0x513152];return _0x1cd08b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8b59('0x0'));var BPromise=require(_0x8b59('0x1'));var rs=require(_0x8b59('0x2'));var fs=require('fs');var Redis=require(_0x8b59('0x3'));var db=require(_0x8b59('0x4'))['db'];var utils=require(_0x8b59('0x5'));var logger=require(_0x8b59('0x6'))(_0x8b59('0x7'));var config=require(_0x8b59('0x8'));var jayson=require(_0x8b59('0x9'));var client=jayson[_0x8b59('0xa')][_0x8b59('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f9165,_0x55f5dd,_0x2a768a){return new BPromise(function(_0x19be3f,_0x318893){return client[_0x8b59('0xc')](_0x1f9165,_0x2a768a)[_0x8b59('0xd')](function(_0x481c8d){logger[_0x8b59('0xe')](_0x8b59('0xf'),_0x55f5dd,'request\x20sent');logger[_0x8b59('0x10')](_0x8b59('0x11'),_0x55f5dd,_0x8b59('0x12'),JSON[_0x8b59('0x13')](_0x481c8d));if(_0x481c8d[_0x8b59('0x14')]){if(_0x481c8d[_0x8b59('0x14')][_0x8b59('0x15')]===0x1f4){logger[_0x8b59('0x14')](_0x8b59('0xf'),_0x55f5dd,_0x481c8d['error']['message']);return _0x318893(_0x481c8d[_0x8b59('0x14')][_0x8b59('0x16')]);}logger[_0x8b59('0x14')](_0x8b59('0xf'),_0x55f5dd,_0x481c8d[_0x8b59('0x14')][_0x8b59('0x16')]);return _0x19be3f(_0x481c8d[_0x8b59('0x14')][_0x8b59('0x16')]);}else{logger[_0x8b59('0xe')](_0x8b59('0xf'),_0x55f5dd,'request\x20sent');_0x19be3f(_0x481c8d[_0x8b59('0x17')]['message']);}})[_0x8b59('0x18')](function(_0x473a8f){logger['error']('SquareReport,\x20%s,\x20%s',_0x55f5dd,_0x473a8f);_0x318893(_0x473a8f);});});}exports[_0x8b59('0x19')]=function(_0x5c5d39){var _0x2a1bb8=this;return new Promise(function(_0x3fbd33,_0x4aec1a){return db[_0x8b59('0x1a')][_0x8b59('0x1b')](_0x5c5d39[_0x8b59('0x1c')],{'raw':_0x5c5d39[_0x8b59('0x1d')]?_0x5c5d39[_0x8b59('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x8b59('0xd')](function(_0x2c7841){logger[_0x8b59('0xe')](_0x8b59('0x19'),_0x5c5d39);logger['debug'](_0x8b59('0x19'),_0x5c5d39,JSON[_0x8b59('0x13')](_0x2c7841));_0x3fbd33(_0x2c7841);})[_0x8b59('0x18')](function(_0x378737){logger['error'](_0x8b59('0x19'),_0x378737[_0x8b59('0x16')],_0x5c5d39);_0x4aec1a(_0x2a1bb8['error'](0x1f4,_0x378737[_0x8b59('0x16')]));});});};exports[_0x8b59('0x1e')]=function(_0xb1d9a5){var _0xe1b75b=this;return new Promise(function(_0xd092b1,_0x18ce16){return db[_0x8b59('0x1a')][_0x8b59('0x1f')](_0xb1d9a5['body'],{'raw':_0xb1d9a5[_0x8b59('0x1d')]?_0xb1d9a5[_0x8b59('0x1d')][_0x8b59('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb1d9a5['options']?_0xb1d9a5[_0x8b59('0x1d')][_0x8b59('0x21')]||null:null,'attributes':_0xb1d9a5[_0x8b59('0x1d')]?_0xb1d9a5[_0x8b59('0x1d')][_0x8b59('0x22')]||null:null,'limit':_0xb1d9a5['options']?_0xb1d9a5[_0x8b59('0x1d')][_0x8b59('0x23')]||null:null})[_0x8b59('0xd')](function(_0x16f7bf){logger['info'](_0x8b59('0x1e'),_0xb1d9a5);logger['debug'](_0x8b59('0x1e'),_0xb1d9a5,JSON[_0x8b59('0x13')](_0x16f7bf));_0xd092b1(_0x16f7bf);})[_0x8b59('0x18')](function(_0x5cd87c){logger[_0x8b59('0x14')](_0x8b59('0x1e'),_0x5cd87c[_0x8b59('0x16')],_0xb1d9a5);_0x18ce16(_0xe1b75b[_0x8b59('0x14')](0x1f4,_0x5cd87c['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 551a3c5..f207d4c 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 _0x5bdf=['../../config/environment','/describe','isAuthenticated','describe','get','/:id','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x219632,_0x476c58){var _0x192b37=function(_0x53fa1){while(--_0x53fa1){_0x219632['push'](_0x219632['shift']());}};_0x192b37(++_0x476c58);}(_0x5bdf,0x91));var _0xf5bd=function(_0x38befb,_0x416a0a){_0x38befb=_0x38befb-0x0;var _0x35909f=_0x5bdf[_0x38befb];return _0x35909f;};'use strict';var multer=require(_0xf5bd('0x0'));var util=require(_0xf5bd('0x1'));var path=require(_0xf5bd('0x2'));var timeout=require(_0xf5bd('0x3'));var express=require(_0xf5bd('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf5bd('0x5'));var interaction=require(_0xf5bd('0x6'));var config=require(_0xf5bd('0x7'));var controller=require('./squareReportDetail.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf5bd('0x8'),auth[_0xf5bd('0x9')](),controller[_0xf5bd('0xa')]);router[_0xf5bd('0xb')](_0xf5bd('0xc'),auth[_0xf5bd('0x9')](),controller[_0xf5bd('0xd')]);router[_0xf5bd('0xe')]('/',auth[_0xf5bd('0x9')](),controller[_0xf5bd('0xf')]);router[_0xf5bd('0x10')]('/:id',auth[_0xf5bd('0x9')](),controller['update']);router[_0xf5bd('0x11')](_0xf5bd('0xc'),auth[_0xf5bd('0x9')](),controller[_0xf5bd('0x12')]);module['exports']=router; \ No newline at end of file +var _0xf5af=['connect-timeout','express','Router','../../components/auth/service','./squareReportDetail.controller','isAuthenticated','index','describe','get','/:id','show','post','put','update','delete','destroy','exports','util','path'];(function(_0x210b75,_0x6b167e){var _0x57afa2=function(_0x51950f){while(--_0x51950f){_0x210b75['push'](_0x210b75['shift']());}};_0x57afa2(++_0x6b167e);}(_0xf5af,0x1b3));var _0xff5a=function(_0x569d6c,_0x38e90e){_0x569d6c=_0x569d6c-0x0;var _0x5462bd=_0xf5af[_0x569d6c];return _0x5462bd;};'use strict';var multer=require('multer');var util=require(_0xff5a('0x0'));var path=require(_0xff5a('0x1'));var timeout=require(_0xff5a('0x2'));var express=require(_0xff5a('0x3'));var router=express[_0xff5a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xff5a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xff5a('0x6'));router['get']('/',auth[_0xff5a('0x7')](),controller[_0xff5a('0x8')]);router['get']('/describe',auth[_0xff5a('0x7')](),controller[_0xff5a('0x9')]);router[_0xff5a('0xa')](_0xff5a('0xb'),auth[_0xff5a('0x7')](),controller[_0xff5a('0xc')]);router[_0xff5a('0xd')]('/',auth[_0xff5a('0x7')](),controller['create']);router[_0xff5a('0xe')]('/:id',auth[_0xff5a('0x7')](),controller[_0xff5a('0xf')]);router[_0xff5a('0x10')]('/:id',auth[_0xff5a('0x7')](),controller[_0xff5a('0x11')]);module[_0xff5a('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 7f44202..d58b6df 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 _0xac5f=['TEXT','sequelize','exports','STRING'];(function(_0x1cd4d5,_0x40bd09){var _0x348028=function(_0x10ffb3){while(--_0x10ffb3){_0x1cd4d5['push'](_0x1cd4d5['shift']());}};_0x348028(++_0x40bd09);}(_0xac5f,0x1e5));var _0xfac5=function(_0x387618,_0x53767b){_0x387618=_0x387618-0x0;var _0x3a1b2e=_0xac5f[_0x387618];return _0x3a1b2e;};'use strict';var Sequelize=require(_0xfac5('0x0'));module[_0xfac5('0x1')]={'uniqueid':{'type':Sequelize[_0xfac5('0x2')]},'node':{'type':Sequelize[_0xfac5('0x2')]},'application':{'type':Sequelize[_0xfac5('0x2')]},'data':{'type':Sequelize[_0xfac5('0x3')]},'project_name':{'type':Sequelize[_0xfac5('0x2')]},'callerid':{'type':Sequelize[_0xfac5('0x2')]}}; \ No newline at end of file +var _0x23a8=['exports','STRING','TEXT','sequelize'];(function(_0x4d6174,_0x137377){var _0xb5e21=function(_0x4419f3){while(--_0x4419f3){_0x4d6174['push'](_0x4d6174['shift']());}};_0xb5e21(++_0x137377);}(_0x23a8,0xeb));var _0x823a=function(_0x3ced98,_0x3eea97){_0x3ced98=_0x3ced98-0x0;var _0x1c7c06=_0x23a8[_0x3ced98];return _0x1c7c06;};'use strict';var Sequelize=require(_0x823a('0x0'));module[_0x823a('0x1')]={'uniqueid':{'type':Sequelize[_0x823a('0x2')]},'node':{'type':Sequelize[_0x823a('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x823a('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index a3e02b6..18a3d3a 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 _0x0a45=['create','body','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','end','stack','name','send','index','map','SquareDetailsReport','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','find'];(function(_0x539b55,_0x2688d0){var _0x25dd5c=function(_0x731aa0){while(--_0x731aa0){_0x539b55['push'](_0x539b55['shift']());}};_0x25dd5c(++_0x2688d0);}(_0x0a45,0x123));var _0x50a4=function(_0x112f93,_0x481a66){_0x112f93=_0x112f93-0x0;var _0x4ecb83=_0x0a45[_0x112f93];return _0x4ecb83;};'use strict';var emlformat=require(_0x50a4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x50a4('0x1'));var rp=require(_0x50a4('0x2'));var moment=require('moment');var BPromise=require(_0x50a4('0x3'));var Mustache=require(_0x50a4('0x4'));var util=require('util');var path=require(_0x50a4('0x5'));var sox=require(_0x50a4('0x6'));var csv=require(_0x50a4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x50a4('0x8'));var _=require('lodash');var squel=require(_0x50a4('0x9'));var crypto=require(_0x50a4('0xa'));var jsforce=require(_0x50a4('0xb'));var deskjs=require(_0x50a4('0xc'));var toCsv=require('to-csv');var querystring=require(_0x50a4('0xd'));var Papa=require(_0x50a4('0xe'));var Redis=require(_0x50a4('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x50a4('0x10'));var hardwareService=require(_0x50a4('0x11'));var logger=require('../../config/logger')(_0x50a4('0x12'));var utils=require(_0x50a4('0x13'));var config=require(_0x50a4('0x14'));var licenseUtil=require(_0x50a4('0x15'));var db=require(_0x50a4('0x16'))['db'];function respondWithStatusCode(_0x19147b,_0x29224e){_0x29224e=_0x29224e||0xcc;return function(_0x586fbf){if(_0x586fbf){return _0x19147b[_0x50a4('0x17')](_0x29224e);}return _0x19147b[_0x50a4('0x18')](_0x29224e)['end']();};}function respondWithResult(_0x30a3b1,_0x454270){_0x454270=_0x454270||0xc8;return function(_0x5c4b46){if(_0x5c4b46){return _0x30a3b1[_0x50a4('0x18')](_0x454270)[_0x50a4('0x19')](_0x5c4b46);}};}function respondWithFilteredResult(_0x19edf3,_0x2acba2){return function(_0x3e11d1){if(_0x3e11d1){var _0x5e8363=typeof _0x2acba2[_0x50a4('0x1a')]===_0x50a4('0x1b')&&typeof _0x2acba2[_0x50a4('0x1c')]===_0x50a4('0x1b');var _0x1ca7fe=_0x3e11d1[_0x50a4('0x1d')];var _0x59dadd=_0x5e8363?0x0:_0x2acba2[_0x50a4('0x1a')];var _0x30b803=_0x5e8363?_0x3e11d1[_0x50a4('0x1d')]:_0x2acba2['offset']+_0x2acba2[_0x50a4('0x1c')];var _0x3f33f3;if(_0x30b803>=_0x1ca7fe){_0x30b803=_0x1ca7fe;_0x3f33f3=0xc8;}else{_0x3f33f3=0xce;}_0x19edf3[_0x50a4('0x18')](_0x3f33f3);return _0x19edf3[_0x50a4('0x1e')]('Content-Range',_0x59dadd+'-'+_0x30b803+'/'+_0x1ca7fe)[_0x50a4('0x19')](_0x3e11d1);}return null;};}function patchUpdates(_0x5d3fd8){return function(_0x132659){try{jsonpatch['apply'](_0x132659,_0x5d3fd8,!![]);}catch(_0x859b16){return BPromise[_0x50a4('0x1f')](_0x859b16);}return _0x132659[_0x50a4('0x20')]();};}function saveUpdates(_0xcb416c,_0x4bf428){return function(_0x23d49e){if(_0x23d49e){return _0x23d49e[_0x50a4('0x21')](_0xcb416c)[_0x50a4('0x22')](function(_0x2024bf){return _0x2024bf;});}return null;};}function removeEntity(_0x16df0f,_0xd3d461){return function(_0xd49dda){if(_0xd49dda){return _0xd49dda[_0x50a4('0x23')]()[_0x50a4('0x22')](function(){_0x16df0f[_0x50a4('0x18')](0xcc)[_0x50a4('0x24')]();});}};}function handleEntityNotFound(_0x4977f4,_0x18a73c){return function(_0x3ade93){if(!_0x3ade93){_0x4977f4[_0x50a4('0x17')](0x194);}return _0x3ade93;};}function handleError(_0x45485e,_0x4131d3){_0x4131d3=_0x4131d3||0x1f4;return function(_0x55cefe){logger['error'](_0x55cefe[_0x50a4('0x25')]);if(_0x55cefe[_0x50a4('0x26')]){delete _0x55cefe[_0x50a4('0x26')];}_0x45485e[_0x50a4('0x18')](_0x4131d3)[_0x50a4('0x27')](_0x55cefe);};}exports[_0x50a4('0x28')]=function(_0x38ae55,_0x418281){var _0x2c53ab={},_0x46deb1={},_0x2b694d={'count':0x0,'rows':[]};var _0x3ae355=_[_0x50a4('0x29')](db[_0x50a4('0x2a')][_0x50a4('0x2b')],function(_0xcc8513){return{'name':_0xcc8513['fieldName'],'type':_0xcc8513[_0x50a4('0x2c')][_0x50a4('0x2d')]};});_0x46deb1['model']=_[_0x50a4('0x29')](_0x3ae355,_0x50a4('0x26'));_0x46deb1[_0x50a4('0x2e')]=_[_0x50a4('0x2f')](_0x38ae55[_0x50a4('0x2e')]);_0x46deb1[_0x50a4('0x30')]=_[_0x50a4('0x31')](_0x46deb1[_0x50a4('0x32')],_0x46deb1[_0x50a4('0x2e')]);_0x2c53ab[_0x50a4('0x33')]=_['intersection'](_0x46deb1[_0x50a4('0x32')],qs[_0x50a4('0x34')](_0x38ae55[_0x50a4('0x2e')]['fields']));_0x2c53ab[_0x50a4('0x33')]=_0x2c53ab[_0x50a4('0x33')][_0x50a4('0x35')]?_0x2c53ab[_0x50a4('0x33')]:_0x46deb1['model'];if(!_0x38ae55[_0x50a4('0x2e')][_0x50a4('0x36')]('nolimit')){_0x2c53ab['limit']=qs['limit'](_0x38ae55[_0x50a4('0x2e')][_0x50a4('0x1c')]);_0x2c53ab[_0x50a4('0x1a')]=qs[_0x50a4('0x1a')](_0x38ae55[_0x50a4('0x2e')][_0x50a4('0x1a')]);}_0x2c53ab['order']=qs[_0x50a4('0x37')](_0x38ae55[_0x50a4('0x2e')]['sort']);_0x2c53ab[_0x50a4('0x38')]=qs[_0x50a4('0x30')](_[_0x50a4('0x39')](_0x38ae55['query'],_0x46deb1[_0x50a4('0x30')]),_0x3ae355);if(_0x38ae55[_0x50a4('0x2e')][_0x50a4('0x3a')]){_0x2c53ab[_0x50a4('0x38')]=_[_0x50a4('0x3b')](_0x2c53ab['where'],{'$or':_[_0x50a4('0x29')](_0x3ae355,function(_0x1ba709){if(_0x1ba709[_0x50a4('0x2c')]!==_0x50a4('0x3c')){var _0x4ed79a={};_0x4ed79a[_0x1ba709[_0x50a4('0x26')]]={'$like':'%'+_0x38ae55[_0x50a4('0x2e')]['filter']+'%'};return _0x4ed79a;}})});}_0x2c53ab=_[_0x50a4('0x3b')]({},_0x2c53ab,_0x38ae55[_0x50a4('0x3d')]);var _0x35cb1d={'where':_0x2c53ab[_0x50a4('0x38')]};return db[_0x50a4('0x2a')][_0x50a4('0x1d')](_0x35cb1d)[_0x50a4('0x22')](function(_0x22ae6e){_0x2b694d[_0x50a4('0x1d')]=_0x22ae6e;if(_0x38ae55['query']['includeAll']){_0x2c53ab['include']=[{'all':!![]}];}return db['SquareDetailsReport'][_0x50a4('0x3e')](_0x2c53ab);})['then'](function(_0x2e1502){_0x2b694d[_0x50a4('0x3f')]=_0x2e1502;return _0x2b694d;})[_0x50a4('0x22')](respondWithFilteredResult(_0x418281,_0x2c53ab))[_0x50a4('0x40')](handleError(_0x418281,null));};exports[_0x50a4('0x41')]=function(_0x3dd7a1,_0x411038){var _0xa90b55={'raw':!![],'where':{'id':_0x3dd7a1[_0x50a4('0x42')]['id']}},_0x2ad470={};_0x2ad470[_0x50a4('0x32')]=_[_0x50a4('0x2f')](db['SquareDetailsReport']['rawAttributes']);_0x2ad470[_0x50a4('0x2e')]=_[_0x50a4('0x2f')](_0x3dd7a1[_0x50a4('0x2e')]);_0x2ad470[_0x50a4('0x30')]=_[_0x50a4('0x31')](_0x2ad470[_0x50a4('0x32')],_0x2ad470['query']);_0xa90b55[_0x50a4('0x33')]=_[_0x50a4('0x31')](_0x2ad470[_0x50a4('0x32')],qs[_0x50a4('0x34')](_0x3dd7a1[_0x50a4('0x2e')][_0x50a4('0x34')]));_0xa90b55[_0x50a4('0x33')]=_0xa90b55['attributes'][_0x50a4('0x35')]?_0xa90b55[_0x50a4('0x33')]:_0x2ad470[_0x50a4('0x32')];if(_0x3dd7a1[_0x50a4('0x2e')][_0x50a4('0x43')]){_0xa90b55['include']=[{'all':!![]}];}_0xa90b55=_[_0x50a4('0x3b')]({},_0xa90b55,_0x3dd7a1[_0x50a4('0x3d')]);return db[_0x50a4('0x2a')][_0x50a4('0x44')](_0xa90b55)[_0x50a4('0x22')](handleEntityNotFound(_0x411038,null))['then'](respondWithResult(_0x411038,null))[_0x50a4('0x40')](handleError(_0x411038,null));};exports[_0x50a4('0x45')]=function(_0x5d8429,_0x167845){return db[_0x50a4('0x2a')][_0x50a4('0x45')](_0x5d8429[_0x50a4('0x46')],{})['then'](respondWithResult(_0x167845,0xc9))[_0x50a4('0x40')](handleError(_0x167845,null));};exports[_0x50a4('0x21')]=function(_0x4a82e8,_0x31fb61){if(_0x4a82e8[_0x50a4('0x46')]['id']){delete _0x4a82e8[_0x50a4('0x46')]['id'];}return db[_0x50a4('0x2a')][_0x50a4('0x44')]({'where':{'id':_0x4a82e8['params']['id']}})[_0x50a4('0x22')](handleEntityNotFound(_0x31fb61,null))[_0x50a4('0x22')](saveUpdates(_0x4a82e8[_0x50a4('0x46')],null))['then'](respondWithResult(_0x31fb61,null))[_0x50a4('0x40')](handleError(_0x31fb61,null));};exports['destroy']=function(_0x21719b,_0xe29d22){return db[_0x50a4('0x2a')]['find']({'where':{'id':_0x21719b['params']['id']}})[_0x50a4('0x22')](handleEntityNotFound(_0xe29d22,null))['then'](removeEntity(_0xe29d22,null))['catch'](handleError(_0xe29d22,null));};exports[_0x50a4('0x47')]=function(_0x2e3e0b,_0x58a3bc){return db[_0x50a4('0x2a')][_0x50a4('0x47')]()[_0x50a4('0x22')](respondWithResult(_0x58a3bc,null))[_0x50a4('0x40')](handleError(_0x58a3bc,null));}; \ No newline at end of file +var _0xbc76=['set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','fieldName','type','map','keys','filters','intersection','model','attributes','fields','length','query','nolimit','order','sort','pick','where','VIRTUAL','filter','options','SquareDetailsReport','includeAll','include','findAll','catch','show','params','rawAttributes','merge','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count'];(function(_0x4ac090,_0x421ff1){var _0x592f58=function(_0x5b8f3e){while(--_0x5b8f3e){_0x4ac090['push'](_0x4ac090['shift']());}};_0x592f58(++_0x421ff1);}(_0xbc76,0x152));var _0x6bc7=function(_0x41b299,_0x3fb1b5){_0x41b299=_0x41b299-0x0;var _0x5ae711=_0xbc76[_0x41b299];return _0x5ae711;};'use strict';var emlformat=require(_0x6bc7('0x0'));var rimraf=require(_0x6bc7('0x1'));var zipdir=require(_0x6bc7('0x2'));var jsonpatch=require(_0x6bc7('0x3'));var rp=require(_0x6bc7('0x4'));var moment=require('moment');var BPromise=require(_0x6bc7('0x5'));var Mustache=require('mustache');var util=require(_0x6bc7('0x6'));var path=require(_0x6bc7('0x7'));var sox=require(_0x6bc7('0x8'));var csv=require(_0x6bc7('0x9'));var ejs=require(_0x6bc7('0xa'));var fs=require('fs');var fs_extra=require(_0x6bc7('0xb'));var _=require(_0x6bc7('0xc'));var squel=require(_0x6bc7('0xd'));var crypto=require(_0x6bc7('0xe'));var jsforce=require(_0x6bc7('0xf'));var deskjs=require(_0x6bc7('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6bc7('0x11'));var Redis=require(_0x6bc7('0x12'));var authService=require(_0x6bc7('0x13'));var qs=require(_0x6bc7('0x14'));var as=require(_0x6bc7('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6bc7('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6bc7('0x17'));var db=require(_0x6bc7('0x18'))['db'];function respondWithStatusCode(_0x33d5ed,_0x354d46){_0x354d46=_0x354d46||0xcc;return function(_0x285a84){if(_0x285a84){return _0x33d5ed[_0x6bc7('0x19')](_0x354d46);}return _0x33d5ed[_0x6bc7('0x1a')](_0x354d46)['end']();};}function respondWithResult(_0xd505f7,_0xccf739){_0xccf739=_0xccf739||0xc8;return function(_0x5c1209){if(_0x5c1209){return _0xd505f7[_0x6bc7('0x1a')](_0xccf739)[_0x6bc7('0x1b')](_0x5c1209);}};}function respondWithFilteredResult(_0x4cf199,_0x54dc22){return function(_0xd3fff3){if(_0xd3fff3){var _0x2fa803=typeof _0x54dc22[_0x6bc7('0x1c')]==='undefined'&&typeof _0x54dc22[_0x6bc7('0x1d')]===_0x6bc7('0x1e');var _0x15a073=_0xd3fff3['count'];var _0x146676=_0x2fa803?0x0:_0x54dc22[_0x6bc7('0x1c')];var _0x56709d=_0x2fa803?_0xd3fff3[_0x6bc7('0x1f')]:_0x54dc22['offset']+_0x54dc22[_0x6bc7('0x1d')];var _0x2d165b;if(_0x56709d>=_0x15a073){_0x56709d=_0x15a073;_0x2d165b=0xc8;}else{_0x2d165b=0xce;}_0x4cf199[_0x6bc7('0x1a')](_0x2d165b);return _0x4cf199[_0x6bc7('0x20')](_0x6bc7('0x21'),_0x146676+'-'+_0x56709d+'/'+_0x15a073)[_0x6bc7('0x1b')](_0xd3fff3);}return null;};}function patchUpdates(_0xdb90cf){return function(_0xb47e72){try{jsonpatch['apply'](_0xb47e72,_0xdb90cf,!![]);}catch(_0x28f973){return BPromise[_0x6bc7('0x22')](_0x28f973);}return _0xb47e72[_0x6bc7('0x23')]();};}function saveUpdates(_0x506c01,_0x25b1de){return function(_0x2a9087){if(_0x2a9087){return _0x2a9087[_0x6bc7('0x24')](_0x506c01)[_0x6bc7('0x25')](function(_0x1b9eb7){return _0x1b9eb7;});}return null;};}function removeEntity(_0x459f50,_0x2dd270){return function(_0x249ee4){if(_0x249ee4){return _0x249ee4[_0x6bc7('0x26')]()[_0x6bc7('0x25')](function(){_0x459f50[_0x6bc7('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x808c7f,_0x571d48){return function(_0x262a46){if(!_0x262a46){_0x808c7f['sendStatus'](0x194);}return _0x262a46;};}function handleError(_0x412765,_0xb905d1){_0xb905d1=_0xb905d1||0x1f4;return function(_0x2bec6c){logger[_0x6bc7('0x27')](_0x2bec6c[_0x6bc7('0x28')]);if(_0x2bec6c[_0x6bc7('0x29')]){delete _0x2bec6c[_0x6bc7('0x29')];}_0x412765[_0x6bc7('0x1a')](_0xb905d1)['send'](_0x2bec6c);};}exports[_0x6bc7('0x2a')]=function(_0x3ba449,_0x318e08){var _0x51bbfb={},_0x4000ce={},_0x210014={'count':0x0,'rows':[]};var _0x32c071=_['map'](db['SquareDetailsReport']['rawAttributes'],function(_0x455c94){return{'name':_0x455c94[_0x6bc7('0x2b')],'type':_0x455c94[_0x6bc7('0x2c')]['key']};});_0x4000ce['model']=_[_0x6bc7('0x2d')](_0x32c071,_0x6bc7('0x29'));_0x4000ce['query']=_[_0x6bc7('0x2e')](_0x3ba449['query']);_0x4000ce[_0x6bc7('0x2f')]=_[_0x6bc7('0x30')](_0x4000ce[_0x6bc7('0x31')],_0x4000ce['query']);_0x51bbfb[_0x6bc7('0x32')]=_['intersection'](_0x4000ce['model'],qs[_0x6bc7('0x33')](_0x3ba449['query']['fields']));_0x51bbfb[_0x6bc7('0x32')]=_0x51bbfb[_0x6bc7('0x32')][_0x6bc7('0x34')]?_0x51bbfb[_0x6bc7('0x32')]:_0x4000ce['model'];if(!_0x3ba449[_0x6bc7('0x35')]['hasOwnProperty'](_0x6bc7('0x36'))){_0x51bbfb[_0x6bc7('0x1d')]=qs[_0x6bc7('0x1d')](_0x3ba449[_0x6bc7('0x35')][_0x6bc7('0x1d')]);_0x51bbfb[_0x6bc7('0x1c')]=qs[_0x6bc7('0x1c')](_0x3ba449['query'][_0x6bc7('0x1c')]);}_0x51bbfb[_0x6bc7('0x37')]=qs[_0x6bc7('0x38')](_0x3ba449['query'][_0x6bc7('0x38')]);_0x51bbfb['where']=qs[_0x6bc7('0x2f')](_[_0x6bc7('0x39')](_0x3ba449[_0x6bc7('0x35')],_0x4000ce[_0x6bc7('0x2f')]),_0x32c071);if(_0x3ba449[_0x6bc7('0x35')]['filter']){_0x51bbfb[_0x6bc7('0x3a')]=_['merge'](_0x51bbfb['where'],{'$or':_[_0x6bc7('0x2d')](_0x32c071,function(_0x2a2f55){if(_0x2a2f55[_0x6bc7('0x2c')]!==_0x6bc7('0x3b')){var _0x440a18={};_0x440a18[_0x2a2f55[_0x6bc7('0x29')]]={'$like':'%'+_0x3ba449[_0x6bc7('0x35')][_0x6bc7('0x3c')]+'%'};return _0x440a18;}})});}_0x51bbfb=_['merge']({},_0x51bbfb,_0x3ba449[_0x6bc7('0x3d')]);var _0x53a0b9={'where':_0x51bbfb['where']};return db[_0x6bc7('0x3e')][_0x6bc7('0x1f')](_0x53a0b9)['then'](function(_0x9c7580){_0x210014[_0x6bc7('0x1f')]=_0x9c7580;if(_0x3ba449['query'][_0x6bc7('0x3f')]){_0x51bbfb[_0x6bc7('0x40')]=[{'all':!![]}];}return db[_0x6bc7('0x3e')][_0x6bc7('0x41')](_0x51bbfb);})['then'](function(_0x20007a){_0x210014['rows']=_0x20007a;return _0x210014;})[_0x6bc7('0x25')](respondWithFilteredResult(_0x318e08,_0x51bbfb))[_0x6bc7('0x42')](handleError(_0x318e08,null));};exports[_0x6bc7('0x43')]=function(_0x4bc117,_0x335d9d){var _0x497668={'raw':!![],'where':{'id':_0x4bc117[_0x6bc7('0x44')]['id']}},_0x23d3e0={};_0x23d3e0[_0x6bc7('0x31')]=_[_0x6bc7('0x2e')](db[_0x6bc7('0x3e')][_0x6bc7('0x45')]);_0x23d3e0['query']=_[_0x6bc7('0x2e')](_0x4bc117['query']);_0x23d3e0[_0x6bc7('0x2f')]=_[_0x6bc7('0x30')](_0x23d3e0['model'],_0x23d3e0[_0x6bc7('0x35')]);_0x497668[_0x6bc7('0x32')]=_[_0x6bc7('0x30')](_0x23d3e0[_0x6bc7('0x31')],qs[_0x6bc7('0x33')](_0x4bc117[_0x6bc7('0x35')][_0x6bc7('0x33')]));_0x497668['attributes']=_0x497668[_0x6bc7('0x32')]['length']?_0x497668[_0x6bc7('0x32')]:_0x23d3e0[_0x6bc7('0x31')];if(_0x4bc117[_0x6bc7('0x35')][_0x6bc7('0x3f')]){_0x497668[_0x6bc7('0x40')]=[{'all':!![]}];}_0x497668=_[_0x6bc7('0x46')]({},_0x497668,_0x4bc117[_0x6bc7('0x3d')]);return db[_0x6bc7('0x3e')]['find'](_0x497668)[_0x6bc7('0x25')](handleEntityNotFound(_0x335d9d,null))['then'](respondWithResult(_0x335d9d,null))[_0x6bc7('0x42')](handleError(_0x335d9d,null));};exports['create']=function(_0x4b2be2,_0x145039){return db[_0x6bc7('0x3e')][_0x6bc7('0x47')](_0x4b2be2[_0x6bc7('0x48')],{})[_0x6bc7('0x25')](respondWithResult(_0x145039,0xc9))['catch'](handleError(_0x145039,null));};exports[_0x6bc7('0x24')]=function(_0xc4ba6f,_0x313a8e){if(_0xc4ba6f[_0x6bc7('0x48')]['id']){delete _0xc4ba6f['body']['id'];}return db[_0x6bc7('0x3e')]['find']({'where':{'id':_0xc4ba6f[_0x6bc7('0x44')]['id']}})[_0x6bc7('0x25')](handleEntityNotFound(_0x313a8e,null))[_0x6bc7('0x25')](saveUpdates(_0xc4ba6f[_0x6bc7('0x48')],null))[_0x6bc7('0x25')](respondWithResult(_0x313a8e,null))[_0x6bc7('0x42')](handleError(_0x313a8e,null));};exports['destroy']=function(_0xc09b,_0x5ec5e2){return db['SquareDetailsReport']['find']({'where':{'id':_0xc09b[_0x6bc7('0x44')]['id']}})[_0x6bc7('0x25')](handleEntityNotFound(_0x5ec5e2,null))['then'](removeEntity(_0x5ec5e2,null))[_0x6bc7('0x42')](handleError(_0x5ec5e2,null));};exports[_0x6bc7('0x49')]=function(_0x5e2dcd,_0x35222a){return db['SquareDetailsReport'][_0x6bc7('0x49')]()[_0x6bc7('0x25')](respondWithResult(_0x35222a,null))['catch'](handleError(_0x35222a,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index bb8dc79..f6c86b2 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 _0x8fbe=['util','../../config/logger','bluebird','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash'];(function(_0x3d487e,_0x4f1340){var _0x5771a3=function(_0x10f2f5){while(--_0x10f2f5){_0x3d487e['push'](_0x3d487e['shift']());}};_0x5771a3(++_0x4f1340);}(_0x8fbe,0x173));var _0xe8fb=function(_0x2a6895,_0x29b01f){_0x2a6895=_0x2a6895-0x0;var _0x532f2e=_0x8fbe[_0x2a6895];return _0x532f2e;};'use strict';var _=require(_0xe8fb('0x0'));var util=require(_0xe8fb('0x1'));var logger=require(_0xe8fb('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe8fb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe8fb('0x4'));var rimraf=require(_0xe8fb('0x5'));var config=require(_0xe8fb('0x6'));var attributes=require(_0xe8fb('0x7'));module[_0xe8fb('0x8')]=function(_0x47d5e0,_0x1fd1fc){return _0x47d5e0[_0xe8fb('0x9')](_0xe8fb('0xa'),attributes,{'tableName':_0xe8fb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3cf=['rimraf','./squareReportDetail.attributes','exports','lodash','api','bluebird','path'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xe3cf,0xc0));var _0xfe3c=function(_0x128d9c,_0x508eb5){_0x128d9c=_0x128d9c-0x0;var _0xbcc91b=_0xe3cf[_0x128d9c];return _0xbcc91b;};'use strict';var _=require(_0xfe3c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfe3c('0x1'));var moment=require('moment');var BPromise=require(_0xfe3c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe3c('0x3'));var rimraf=require(_0xfe3c('0x4'));var config=require('../../config/environment');var attributes=require(_0xfe3c('0x5'));module[_0xfe3c('0x6')]=function(_0x532031,_0x2dcfe3){return _0x532031['define']('SquareDetailsReport',attributes,{'tableName':'report_square_details','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 2dc6d1b..7aff83b 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 _0x937d=['CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','debug','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareDetailsReport,\x20%s,\x20%s','result','catch'];(function(_0x21ab76,_0x1e8f2){var _0x12322a=function(_0x214872){while(--_0x214872){_0x21ab76['push'](_0x21ab76['shift']());}};_0x12322a(++_0x1e8f2);}(_0x937d,0x1f4));var _0xd937=function(_0x3b872b,_0x2bb6c5){_0x3b872b=_0x3b872b-0x0;var _0x214ec9=_0x937d[_0x3b872b];return _0x214ec9;};'use strict';var _=require(_0xd937('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd937('0x1'));var fs=require('fs');var Redis=require(_0xd937('0x2'));var db=require(_0xd937('0x3'))['db'];var utils=require(_0xd937('0x4'));var logger=require(_0xd937('0x5'))(_0xd937('0x6'));var config=require('../../config/environment');var jayson=require(_0xd937('0x7'));var client=jayson[_0xd937('0x8')][_0xd937('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f6cd9,_0x2454f9,_0x4dc790){return new BPromise(function(_0x490b1d,_0x372dff){return client[_0xd937('0xa')](_0x4f6cd9,_0x4dc790)[_0xd937('0xb')](function(_0xa97338){logger[_0xd937('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x2454f9,_0xd937('0xd'));logger['debug'](_0xd937('0xe'),_0x2454f9,'request\x20sent',JSON[_0xd937('0xf')](_0xa97338));if(_0xa97338[_0xd937('0x10')]){if(_0xa97338[_0xd937('0x10')][_0xd937('0x11')]===0x1f4){logger[_0xd937('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x2454f9,_0xa97338[_0xd937('0x10')][_0xd937('0x12')]);return _0x372dff(_0xa97338[_0xd937('0x10')][_0xd937('0x12')]);}logger[_0xd937('0x10')](_0xd937('0x13'),_0x2454f9,_0xa97338[_0xd937('0x10')][_0xd937('0x12')]);return _0x490b1d(_0xa97338[_0xd937('0x10')][_0xd937('0x12')]);}else{logger['info'](_0xd937('0x13'),_0x2454f9,_0xd937('0xd'));_0x490b1d(_0xa97338[_0xd937('0x14')]['message']);}})[_0xd937('0x15')](function(_0x16d2ba){logger[_0xd937('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x2454f9,_0x16d2ba);_0x372dff(_0x16d2ba);});});}exports[_0xd937('0x16')]=function(_0x3d6b1c){var _0x1d1b8b=this;return new Promise(function(_0x1bd7ee,_0x26d5ca){return db[_0xd937('0x17')][_0xd937('0x18')](_0x3d6b1c[_0xd937('0x19')],{'raw':_0x3d6b1c[_0xd937('0x1a')]?_0x3d6b1c[_0xd937('0x1a')][_0xd937('0x1b')]===undefined?!![]:![]:!![]})[_0xd937('0xb')](function(_0x2c18ea){logger[_0xd937('0xc')](_0xd937('0x16'),_0x3d6b1c);logger[_0xd937('0x1c')](_0xd937('0x16'),_0x3d6b1c,JSON['stringify'](_0x2c18ea));_0x1bd7ee(_0x2c18ea);})[_0xd937('0x15')](function(_0x168f3e){logger[_0xd937('0x10')](_0xd937('0x16'),_0x168f3e[_0xd937('0x12')],_0x3d6b1c);_0x26d5ca(_0x1d1b8b[_0xd937('0x10')](0x1f4,_0x168f3e[_0xd937('0x12')]));});});}; \ No newline at end of file +var _0x1c9a=['catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1c9a,0x98));var _0xa1c9=function(_0x10d1a7,_0xae7944){_0x10d1a7=_0x10d1a7-0x0;var _0x962931=_0x1c9a[_0x10d1a7];return _0x962931;};'use strict';var _=require(_0xa1c9('0x0'));var util=require('util');var moment=require(_0xa1c9('0x1'));var BPromise=require('bluebird');var rs=require(_0xa1c9('0x2'));var fs=require('fs');var Redis=require(_0xa1c9('0x3'));var db=require(_0xa1c9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1c9('0x5'))(_0xa1c9('0x6'));var config=require(_0xa1c9('0x7'));var jayson=require(_0xa1c9('0x8'));var client=jayson['client'][_0xa1c9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5448f2,_0x222624,_0x463c9c){return new BPromise(function(_0x3f07c2,_0x5059df){return client[_0xa1c9('0xa')](_0x5448f2,_0x463c9c)[_0xa1c9('0xb')](function(_0x24136d){logger[_0xa1c9('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x222624,_0xa1c9('0xd'));logger[_0xa1c9('0xe')](_0xa1c9('0xf'),_0x222624,_0xa1c9('0xd'),JSON[_0xa1c9('0x10')](_0x24136d));if(_0x24136d[_0xa1c9('0x11')]){if(_0x24136d[_0xa1c9('0x11')][_0xa1c9('0x12')]===0x1f4){logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x222624,_0x24136d['error'][_0xa1c9('0x14')]);return _0x5059df(_0x24136d[_0xa1c9('0x11')][_0xa1c9('0x14')]);}logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x222624,_0x24136d['error'][_0xa1c9('0x14')]);return _0x3f07c2(_0x24136d[_0xa1c9('0x11')][_0xa1c9('0x14')]);}else{logger[_0xa1c9('0xc')](_0xa1c9('0x13'),_0x222624,_0xa1c9('0xd'));_0x3f07c2(_0x24136d[_0xa1c9('0x15')][_0xa1c9('0x14')]);}})[_0xa1c9('0x16')](function(_0x373f5d){logger['error'](_0xa1c9('0x13'),_0x222624,_0x373f5d);_0x5059df(_0x373f5d);});});}exports[_0xa1c9('0x17')]=function(_0x224ae4){var _0x50db9b=this;return new Promise(function(_0x2fb81e,_0x5ab911){return db[_0xa1c9('0x18')][_0xa1c9('0x19')](_0x224ae4[_0xa1c9('0x1a')],{'raw':_0x224ae4['options']?_0x224ae4[_0xa1c9('0x1b')][_0xa1c9('0x1c')]===undefined?!![]:![]:!![]})[_0xa1c9('0xb')](function(_0x4edf37){logger[_0xa1c9('0xc')](_0xa1c9('0x17'),_0x224ae4);logger['debug'](_0xa1c9('0x17'),_0x224ae4,JSON[_0xa1c9('0x10')](_0x4edf37));_0x2fb81e(_0x4edf37);})[_0xa1c9('0x16')](function(_0x4d05d0){logger[_0xa1c9('0x11')](_0xa1c9('0x17'),_0x4d05d0[_0xa1c9('0x14')],_0x224ae4);_0x5ab911(_0x50db9b[_0xa1c9('0x11')](0x1f4,_0x4d05d0[_0xa1c9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 49f5324..55a24bb 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 _0xc39b=['express','Router','../../components/auth/service','./system.controller','isAuthenticated','get','/process/:pid/kill','killProcess','exports'];(function(_0x22b1a3,_0x3b3f34){var _0x3bc6b4=function(_0x5a6ef8){while(--_0x5a6ef8){_0x22b1a3['push'](_0x22b1a3['shift']());}};_0x3bc6b4(++_0x3b3f34);}(_0xc39b,0x10e));var _0xbc39=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0xc39b[_0xbf8ebe];return _0x1e25e8;};'use strict';var express=require(_0xbc39('0x0'));var router=express[_0xbc39('0x1')]();var auth=require(_0xbc39('0x2'));var controller=require(_0xbc39('0x3'));router['get']('/',auth[_0xbc39('0x4')](),controller['index']);router[_0xbc39('0x5')](_0xbc39('0x6'),auth[_0xbc39('0x4')](),controller[_0xbc39('0x7')]);module[_0xbc39('0x8')]=router; \ No newline at end of file +var _0x25ea=['./system.controller','isAuthenticated','/process/:pid/kill','killProcess','exports','express','Router','../../components/auth/service'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0x25ea,0x85));var _0xa25e=function(_0x45518f,_0x475a6b){_0x45518f=_0x45518f-0x0;var _0x198175=_0x25ea[_0x45518f];return _0x198175;};'use strict';var express=require(_0xa25e('0x0'));var router=express[_0xa25e('0x1')]();var auth=require(_0xa25e('0x2'));var controller=require(_0xa25e('0x3'));router['get']('/',auth[_0xa25e('0x4')](),controller['index']);router['get'](_0xa25e('0x5'),auth['isAuthenticated'](),controller[_0xa25e('0x6')]);module[_0xa25e('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 8e48a8f..5ece451 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 _0x65f6=['../../config/logger','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','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation'];(function(_0x5a3202,_0x4a9c0d){var _0xb4cf2=function(_0x169a51){while(--_0x169a51){_0x5a3202['push'](_0x5a3202['shift']());}};_0xb4cf2(++_0x4a9c0d);}(_0x65f6,0xd1));var _0x665f=function(_0x377cd4,_0x39b33c){_0x377cd4=_0x377cd4-0x0;var _0x3179d2=_0x65f6[_0x377cd4];return _0x3179d2;};'use strict';var info=require(_0x665f('0x0'));var exec=require('child_process')['exec'];var logger=require(_0x665f('0x1'))(_0x665f('0x2'));var util=require(_0x665f('0x3'));var BPromise=require(_0x665f('0x4'));var _=require(_0x665f('0x5'));function handleError(_0x559f6b,_0x11312d,_0x126f26){_0x11312d=_0x11312d||0x1f4;return function(_0x4b97d3){logger[_0x665f('0x6')](_0x665f('0x7'),_0x126f26,_0x11312d,util[_0x665f('0x8')](_0x4b97d3,{'showHidden':![],'depth':null}));delete _0x4b97d3[_0x665f('0x9')];_0x559f6b[_0x665f('0xa')](_0x11312d)[_0x665f('0xb')](_0x4b97d3);};}exports[_0x665f('0xc')]=function(_0xf96db7,_0x2299cc){return info[_0x665f('0xd')]()[_0x665f('0xe')](function(_0x103bd4){return _0x2299cc[_0x665f('0xa')](0xc8)[_0x665f('0xf')](_0x103bd4);})[_0x665f('0x10')](function(_0x353b6e){return _0x2299cc['status'](0x1f4)['json'](_0x353b6e);});};exports['killProcess']=function(_0x44d975,_0x3ad525){var _0x57bbd1=[_0x665f('0x11')];return new BPromise(function(_0x45785e,_0x2bf613){return exec(util[_0x665f('0x12')](_0x665f('0x13'),_0x44d975[_0x665f('0x14')][_0x665f('0x15')]),function(_0x24a132,_0x284a91,_0xa18d46){if(_0x24a132){return _0x2bf613(_0x24a132);}return _0x45785e(_0x284a91);});})[_0x665f('0xe')](function(_0x22b365){var _0x794558=![];var _0x595555=_0x22b365[_0x665f('0x16')](/\n/);for(var _0x58186c=0x0,_0x1de9ea=_0x57bbd1[_0x665f('0x17')];_0x58186c<_0x1de9ea,_0x794558===![];_0x58186c+=0x1){if(_0x22b365[_0x665f('0x18')](_0x57bbd1[_0x58186c])>=0x0){_0x794558=!![];}}if(!_0x794558){throw new Error(util['format'](_0x665f('0x19'),_0x44d975[_0x665f('0x14')][_0x665f('0x15')]));}process[_0x665f('0x1a')](_0x44d975[_0x665f('0x14')][_0x665f('0x15')],_0x665f('0x1b'));return _0x3ad525[_0x665f('0xa')](0xc8)[_0x665f('0xf')]({'message':util[_0x665f('0x12')](_0x665f('0x1c'),_0x44d975[_0x665f('0x14')][_0x665f('0x15')])});})['catch'](handleError(_0x3ad525,null,_0x665f('0x1d')));}; \ No newline at end of file +var _0xe084=['bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','getAllData','then','json','catch','status','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','format','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','../../config/logger','api','util'];(function(_0x3c4d46,_0x46ed6f){var _0x1572d9=function(_0x1d2db1){while(--_0x1d2db1){_0x3c4d46['push'](_0x3c4d46['shift']());}};_0x1572d9(++_0x46ed6f);}(_0xe084,0x134));var _0x4e08=function(_0x50f715,_0x1bc03b){_0x50f715=_0x50f715-0x0;var _0x55bf5d=_0xe084[_0x50f715];return _0x55bf5d;};'use strict';var info=require(_0x4e08('0x0'));var exec=require('child_process')['exec'];var logger=require(_0x4e08('0x1'))(_0x4e08('0x2'));var util=require(_0x4e08('0x3'));var BPromise=require(_0x4e08('0x4'));var _=require(_0x4e08('0x5'));function handleError(_0x1ba953,_0x312781,_0x31464d){_0x312781=_0x312781||0x1f4;return function(_0x492a35){logger[_0x4e08('0x6')](_0x4e08('0x7'),_0x31464d,_0x312781,util['inspect'](_0x492a35,{'showHidden':![],'depth':null}));delete _0x492a35[_0x4e08('0x8')];_0x1ba953['status'](_0x312781)['send'](_0x492a35);};}exports['index']=function(_0x2d913c,_0x3f703a){return info[_0x4e08('0x9')]()[_0x4e08('0xa')](function(_0x148ea3){return _0x3f703a['status'](0xc8)[_0x4e08('0xb')](_0x148ea3);})[_0x4e08('0xc')](function(_0x4d5d08){return _0x3f703a[_0x4e08('0xd')](0x1f4)['json'](_0x4d5d08);});};exports['killProcess']=function(_0x8dfb10,_0x38cda6){var _0x3565e2=[_0x4e08('0xe')];return new BPromise(function(_0x24087d,_0x47bd01){return exec(util['format'](_0x4e08('0xf'),_0x8dfb10[_0x4e08('0x10')][_0x4e08('0x11')]),function(_0x3e905a,_0x1db966,_0x1340a8){if(_0x3e905a){return _0x47bd01(_0x3e905a);}return _0x24087d(_0x1db966);});})[_0x4e08('0xa')](function(_0x41a30e){var _0x15748d=![];var _0x2d6223=_0x41a30e[_0x4e08('0x12')](/\n/);for(var _0x25e9cb=0x0,_0x4d1c00=_0x3565e2[_0x4e08('0x13')];_0x25e9cb<_0x4d1c00,_0x15748d===![];_0x25e9cb+=0x1){if(_0x41a30e['indexOf'](_0x3565e2[_0x25e9cb])>=0x0){_0x15748d=!![];}}if(!_0x15748d){throw new Error(util[_0x4e08('0x14')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x8dfb10[_0x4e08('0x10')][_0x4e08('0x11')]));}process[_0x4e08('0x15')](_0x8dfb10[_0x4e08('0x10')][_0x4e08('0x11')],'SIGINT');return _0x38cda6['status'](0xc8)[_0x4e08('0xb')]({'message':util[_0x4e08('0x14')](_0x4e08('0x16'),_0x8dfb10[_0x4e08('0x10')]['pid'])});})[_0x4e08('0xc')](handleError(_0x38cda6,null,_0x4e08('0x17')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 76308b7..d6da3e1 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 _0xb999=['Router','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','/:id','show','put','update','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x430481,_0x3133c4){var _0xe4aafb=function(_0x274bf1){while(--_0x274bf1){_0x430481['push'](_0x430481['shift']());}};_0xe4aafb(++_0x3133c4);}(_0xb999,0xad));var _0x9b99=function(_0x66d15c,_0x48d145){_0x66d15c=_0x66d15c-0x0;var _0x2baf1a=_0xb999[_0x66d15c];return _0x2baf1a;};'use strict';var multer=require(_0x9b99('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9b99('0x1'));var express=require(_0x9b99('0x2'));var router=express[_0x9b99('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9b99('0x4'));var config=require(_0x9b99('0x5'));var controller=require(_0x9b99('0x6'));router[_0x9b99('0x7')]('/',auth[_0x9b99('0x8')](),controller['index']);router[_0x9b99('0x7')](_0x9b99('0x9'),auth['isAuthenticated'](),controller[_0x9b99('0xa')]);router['post']('/',auth[_0x9b99('0x8')](),controller['create']);router[_0x9b99('0xb')]('/:id',auth[_0x9b99('0x8')](),controller[_0x9b99('0xc')]);router[_0x9b99('0xd')]('/:id',auth[_0x9b99('0x8')](),controller[_0x9b99('0xe')]);module[_0x9b99('0xf')]=router; \ No newline at end of file +var _0x65ba=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy','exports'];(function(_0x24a186,_0x1ab34e){var _0x1ec221=function(_0x53f8e1){while(--_0x53f8e1){_0x24a186['push'](_0x24a186['shift']());}};_0x1ec221(++_0x1ab34e);}(_0x65ba,0x110));var _0xa65b=function(_0x4fa3cf,_0x5ee88d){_0x4fa3cf=_0x4fa3cf-0x0;var _0x1d1e2c=_0x65ba[_0x4fa3cf];return _0x1d1e2c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa65b('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa65b('0x1')]();var fs_extra=require(_0xa65b('0x2'));var auth=require(_0xa65b('0x3'));var interaction=require(_0xa65b('0x4'));var config=require(_0xa65b('0x5'));var controller=require('./tag.controller');router[_0xa65b('0x6')]('/',auth[_0xa65b('0x7')](),controller[_0xa65b('0x8')]);router[_0xa65b('0x6')]('/:id',auth[_0xa65b('0x7')](),controller[_0xa65b('0x9')]);router['post']('/',auth[_0xa65b('0x7')](),controller[_0xa65b('0xa')]);router[_0xa65b('0xb')](_0xa65b('0xc'),auth['isAuthenticated'](),controller[_0xa65b('0xd')]);router[_0xa65b('0xe')](_0xa65b('0xc'),auth['isAuthenticated'](),controller[_0xa65b('0xf')]);module[_0xa65b('0x10')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 695775a..2785dd1 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 _0x5523=['name','#0091EA','STRING'];(function(_0x1c6412,_0x143f92){var _0xc2872=function(_0x3d04af){while(--_0x3d04af){_0x1c6412['push'](_0x1c6412['shift']());}};_0xc2872(++_0x143f92);}(_0x5523,0x137));var _0x3552=function(_0x58488d,_0x8d907b){_0x58488d=_0x58488d-0x0;var _0x8b052d=_0x5523[_0x58488d];return _0x8b052d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3552('0x0')],'unique':_0x3552('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x3552('0x0')],'defaultValue':_0x3552('0x2')},'description':{'type':Sequelize[_0x3552('0x0')]}}; \ No newline at end of file +var _0xaf60=['STRING','#0091EA','sequelize','exports'];(function(_0x5e28c2,_0x1e48ab){var _0x1a8cc6=function(_0x1218bf){while(--_0x1218bf){_0x5e28c2['push'](_0x5e28c2['shift']());}};_0x1a8cc6(++_0x1e48ab);}(_0xaf60,0x82));var _0x0af6=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xaf60[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require(_0x0af6('0x0'));module[_0x0af6('0x1')]={'name':{'type':Sequelize[_0x0af6('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x0af6('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 316e809..8d10c70 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 _0x3685=['squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','error','stack','name','send','index','Tag','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','map','options','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','body','user','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','path','sox','to-csv','fs-extra','lodash'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x3685,0xf8));var _0x5368=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3685[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x5368('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5368('0x1'));var jsonpatch=require(_0x5368('0x2'));var rp=require(_0x5368('0x3'));var moment=require(_0x5368('0x4'));var BPromise=require(_0x5368('0x5'));var Mustache=require(_0x5368('0x6'));var util=require(_0x5368('0x7'));var path=require(_0x5368('0x8'));var sox=require(_0x5368('0x9'));var csv=require(_0x5368('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5368('0xb'));var _=require(_0x5368('0xc'));var squel=require(_0x5368('0xd'));var crypto=require(_0x5368('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5368('0xf'));var toCsv=require(_0x5368('0xa'));var querystring=require(_0x5368('0x10'));var Papa=require(_0x5368('0x11'));var Redis=require(_0x5368('0x12'));var authService=require(_0x5368('0x13'));var qs=require(_0x5368('0x14'));var as=require(_0x5368('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5368('0x16'))(_0x5368('0x17'));var utils=require(_0x5368('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x5368('0x19'));var db=require(_0x5368('0x1a'))['db'];function respondWithStatusCode(_0x4940af,_0x5d6a86){_0x5d6a86=_0x5d6a86||0xcc;return function(_0x5c626a){if(_0x5c626a){return _0x4940af[_0x5368('0x1b')](_0x5d6a86);}return _0x4940af[_0x5368('0x1c')](_0x5d6a86)[_0x5368('0x1d')]();};}function respondWithResult(_0x5df43,_0xa5ce3c){_0xa5ce3c=_0xa5ce3c||0xc8;return function(_0x2f18dd){if(_0x2f18dd){return _0x5df43[_0x5368('0x1c')](_0xa5ce3c)[_0x5368('0x1e')](_0x2f18dd);}};}function respondWithFilteredResult(_0x3a3b8e,_0x5b1da2){return function(_0x524fbf){if(_0x524fbf){var _0x41ce0e=typeof _0x5b1da2[_0x5368('0x1f')]==='undefined'&&typeof _0x5b1da2[_0x5368('0x20')]===_0x5368('0x21');var _0x973143=_0x524fbf[_0x5368('0x22')];var _0x5b10e9=_0x41ce0e?0x0:_0x5b1da2[_0x5368('0x1f')];var _0x56ac4d=_0x41ce0e?_0x524fbf['count']:_0x5b1da2[_0x5368('0x1f')]+_0x5b1da2['limit'];var _0x52afa9;if(_0x56ac4d>=_0x973143){_0x56ac4d=_0x973143;_0x52afa9=0xc8;}else{_0x52afa9=0xce;}_0x3a3b8e['status'](_0x52afa9);return _0x3a3b8e[_0x5368('0x23')](_0x5368('0x24'),_0x5b10e9+'-'+_0x56ac4d+'/'+_0x973143)[_0x5368('0x1e')](_0x524fbf);}return null;};}function patchUpdates(_0x5cef40){return function(_0x4e3267){try{jsonpatch[_0x5368('0x25')](_0x4e3267,_0x5cef40,!![]);}catch(_0x3c891a){return BPromise[_0x5368('0x26')](_0x3c891a);}return _0x4e3267[_0x5368('0x27')]();};}function saveUpdates(_0x1c2fcd,_0x1093e2){return function(_0x4885d0){if(_0x4885d0){return _0x4885d0[_0x5368('0x28')](_0x1c2fcd)[_0x5368('0x29')](function(_0x4705f2){return _0x4705f2;});}return null;};}function removeEntity(_0x57108b,_0x45884f){return function(_0xb994f4){if(_0xb994f4){return _0xb994f4[_0x5368('0x2a')]()[_0x5368('0x29')](function(){var _0x1c287f=_0xb994f4[_0x5368('0x2b')]({'plain':!![]});var _0xabac8c=_0x5368('0x2c');return db[_0x5368('0x2d')]['destroy']({'where':{'type':_0xabac8c,'resourceId':_0x1c287f['id']}})['then'](function(){return _0xb994f4;});})[_0x5368('0x29')](function(){_0x57108b[_0x5368('0x1c')](0xcc)[_0x5368('0x1d')]();});}};}function handleEntityNotFound(_0x452c81,_0x131722){return function(_0x4b94cd){if(!_0x4b94cd){_0x452c81[_0x5368('0x1b')](0x194);}return _0x4b94cd;};}function handleError(_0x200ad0,_0x2e18e0){_0x2e18e0=_0x2e18e0||0x1f4;return function(_0x2bcf41){logger[_0x5368('0x2e')](_0x2bcf41[_0x5368('0x2f')]);if(_0x2bcf41[_0x5368('0x30')]){delete _0x2bcf41[_0x5368('0x30')];}_0x200ad0[_0x5368('0x1c')](_0x2e18e0)[_0x5368('0x31')](_0x2bcf41);};}exports[_0x5368('0x32')]=function(_0x46ea22,_0x7449cd){var _0x5810cb={},_0x73111b={},_0x256abd={'count':0x0,'rows':[]};var _0x36e230=_['map'](db[_0x5368('0x33')]['rawAttributes'],function(_0x26fc48){return{'name':_0x26fc48[_0x5368('0x34')],'type':_0x26fc48['type'][_0x5368('0x35')]};});_0x73111b[_0x5368('0x36')]=_['map'](_0x36e230,'name');_0x73111b[_0x5368('0x37')]=_[_0x5368('0x38')](_0x46ea22['query']);_0x73111b[_0x5368('0x39')]=_[_0x5368('0x3a')](_0x73111b[_0x5368('0x36')],_0x73111b['query']);_0x5810cb[_0x5368('0x3b')]=_['intersection'](_0x73111b[_0x5368('0x36')],qs[_0x5368('0x3c')](_0x46ea22[_0x5368('0x37')]['fields']));_0x5810cb[_0x5368('0x3b')]=_0x5810cb[_0x5368('0x3b')][_0x5368('0x3d')]?_0x5810cb[_0x5368('0x3b')]:_0x73111b['model'];if(!_0x46ea22[_0x5368('0x37')]['hasOwnProperty'](_0x5368('0x3e'))){_0x5810cb[_0x5368('0x20')]=qs['limit'](_0x46ea22[_0x5368('0x37')][_0x5368('0x20')]);_0x5810cb[_0x5368('0x1f')]=qs[_0x5368('0x1f')](_0x46ea22['query'][_0x5368('0x1f')]);}_0x5810cb[_0x5368('0x3f')]=qs[_0x5368('0x40')](_0x46ea22[_0x5368('0x37')][_0x5368('0x40')]);_0x5810cb['where']=qs[_0x5368('0x39')](_[_0x5368('0x41')](_0x46ea22['query'],_0x73111b[_0x5368('0x39')]),_0x36e230);if(_0x46ea22[_0x5368('0x37')][_0x5368('0x42')]){_0x5810cb['where']=_[_0x5368('0x43')](_0x5810cb[_0x5368('0x44')],{'$or':_[_0x5368('0x45')](_0x36e230,function(_0x25e432){if(_0x25e432['type']!=='VIRTUAL'){var _0x1be46a={};_0x1be46a[_0x25e432[_0x5368('0x30')]]={'$like':'%'+_0x46ea22[_0x5368('0x37')]['filter']+'%'};return _0x1be46a;}})});}_0x5810cb=_['merge']({},_0x5810cb,_0x46ea22[_0x5368('0x46')]);var _0x5ae3f1={'where':_0x5810cb[_0x5368('0x44')]};return db[_0x5368('0x33')]['count'](_0x5ae3f1)[_0x5368('0x29')](function(_0x3b57a2){_0x256abd[_0x5368('0x22')]=_0x3b57a2;if(_0x46ea22[_0x5368('0x37')][_0x5368('0x47')]){_0x5810cb[_0x5368('0x48')]=[{'all':!![]}];}return db[_0x5368('0x33')][_0x5368('0x49')](_0x5810cb);})[_0x5368('0x29')](function(_0x43c776){_0x256abd[_0x5368('0x4a')]=_0x43c776;return _0x256abd;})[_0x5368('0x29')](respondWithFilteredResult(_0x7449cd,_0x5810cb))['catch'](handleError(_0x7449cd,null));};exports[_0x5368('0x4b')]=function(_0x61b1a1,_0xd4e247){var _0x4cb800={'raw':!![],'where':{'id':_0x61b1a1[_0x5368('0x4c')]['id']}},_0x1b66a1={};_0x1b66a1['model']=_[_0x5368('0x38')](db[_0x5368('0x33')][_0x5368('0x4d')]);_0x1b66a1[_0x5368('0x37')]=_[_0x5368('0x38')](_0x61b1a1[_0x5368('0x37')]);_0x1b66a1[_0x5368('0x39')]=_[_0x5368('0x3a')](_0x1b66a1[_0x5368('0x36')],_0x1b66a1[_0x5368('0x37')]);_0x4cb800['attributes']=_['intersection'](_0x1b66a1[_0x5368('0x36')],qs[_0x5368('0x3c')](_0x61b1a1[_0x5368('0x37')][_0x5368('0x3c')]));_0x4cb800['attributes']=_0x4cb800['attributes'][_0x5368('0x3d')]?_0x4cb800['attributes']:_0x1b66a1[_0x5368('0x36')];if(_0x61b1a1['query'][_0x5368('0x47')]){_0x4cb800['include']=[{'all':!![]}];}_0x4cb800=_[_0x5368('0x43')]({},_0x4cb800,_0x61b1a1[_0x5368('0x46')]);return db['Tag']['find'](_0x4cb800)[_0x5368('0x29')](handleEntityNotFound(_0xd4e247,null))['then'](respondWithResult(_0xd4e247,null))[_0x5368('0x4e')](handleError(_0xd4e247,null));};exports[_0x5368('0x4f')]=function(_0x2ee00b,_0x121d8d){return db['Tag'][_0x5368('0x4f')](_0x2ee00b[_0x5368('0x50')],{})[_0x5368('0x29')](function(_0x1d9c87){var _0x20e641=_0x2ee00b[_0x5368('0x51')][_0x5368('0x2b')]({'plain':!![]});if(!_0x20e641)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x20e641['role']===_0x5368('0x51')){var _0x7d7a5=_0x1d9c87[_0x5368('0x2b')]({'plain':!![]});var _0x4850f8=_0x5368('0x2c');return db[_0x5368('0x52')][_0x5368('0x53')]({'where':{'name':_0x4850f8,'userProfileId':_0x20e641[_0x5368('0x54')]},'raw':!![]})[_0x5368('0x29')](function(_0x233bf6){if(_0x233bf6&&_0x233bf6[_0x5368('0x55')]===0x0){return db[_0x5368('0x2d')]['create']({'name':_0x7d7a5[_0x5368('0x30')],'resourceId':_0x7d7a5['id'],'type':_0x233bf6[_0x5368('0x30')],'sectionId':_0x233bf6['id']},{})[_0x5368('0x29')](function(){return _0x1d9c87;});}else{return _0x1d9c87;}})[_0x5368('0x4e')](function(_0x5720c8){logger[_0x5368('0x2e')](_0x5368('0x56'),_0x5720c8);throw _0x5720c8;});}return _0x1d9c87;})[_0x5368('0x29')](respondWithResult(_0x121d8d,0xc9))[_0x5368('0x4e')](handleError(_0x121d8d,null));};exports[_0x5368('0x28')]=function(_0x44a481,_0x42544e){if(_0x44a481[_0x5368('0x50')]['id']){delete _0x44a481[_0x5368('0x50')]['id'];}return db[_0x5368('0x33')][_0x5368('0x53')]({'where':{'id':_0x44a481[_0x5368('0x4c')]['id']}})[_0x5368('0x29')](handleEntityNotFound(_0x42544e,null))[_0x5368('0x29')](saveUpdates(_0x44a481['body'],null))[_0x5368('0x29')](respondWithResult(_0x42544e,null))[_0x5368('0x4e')](handleError(_0x42544e,null));};exports[_0x5368('0x2a')]=function(_0x2971de,_0x2688a9){return db[_0x5368('0x33')]['find']({'where':{'id':_0x2971de[_0x5368('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2688a9,null))[_0x5368('0x29')](removeEntity(_0x2688a9,null))[_0x5368('0x4e')](handleError(_0x2688a9,null));}; \ No newline at end of file +var _0x6737=['error','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','update','then','destroy','get','Tags','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','options','Tag','include','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6737,0xe2));var _0x7673=function(_0x41240d,_0xf34ab1){_0x41240d=_0x41240d-0x0;var _0x516793=_0x6737[_0x41240d];return _0x516793;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7673('0x0'));var zipdir=require(_0x7673('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7673('0x2'));var moment=require(_0x7673('0x3'));var BPromise=require(_0x7673('0x4'));var Mustache=require(_0x7673('0x5'));var util=require('util');var path=require(_0x7673('0x6'));var sox=require(_0x7673('0x7'));var csv=require('to-csv');var ejs=require(_0x7673('0x8'));var fs=require('fs');var fs_extra=require(_0x7673('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7673('0xa'));var toCsv=require('to-csv');var querystring=require(_0x7673('0xb'));var Papa=require(_0x7673('0xc'));var Redis=require('ioredis');var authService=require(_0x7673('0xd'));var qs=require(_0x7673('0xe'));var as=require(_0x7673('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7673('0x10'));var utils=require('../../config/utils');var config=require(_0x7673('0x11'));var licenseUtil=require(_0x7673('0x12'));var db=require(_0x7673('0x13'))['db'];function respondWithStatusCode(_0x451c87,_0x41d6bd){_0x41d6bd=_0x41d6bd||0xcc;return function(_0x119e42){if(_0x119e42){return _0x451c87[_0x7673('0x14')](_0x41d6bd);}return _0x451c87[_0x7673('0x15')](_0x41d6bd)[_0x7673('0x16')]();};}function respondWithResult(_0x20a649,_0x5c8626){_0x5c8626=_0x5c8626||0xc8;return function(_0x26f0c4){if(_0x26f0c4){return _0x20a649[_0x7673('0x15')](_0x5c8626)[_0x7673('0x17')](_0x26f0c4);}};}function respondWithFilteredResult(_0x2c83d,_0x224cea){return function(_0x2e83c4){if(_0x2e83c4){var _0x2a2840=typeof _0x224cea['offset']==='undefined'&&typeof _0x224cea[_0x7673('0x18')]===_0x7673('0x19');var _0x50f8d9=_0x2e83c4[_0x7673('0x1a')];var _0x17699a=_0x2a2840?0x0:_0x224cea['offset'];var _0x33ff7d=_0x2a2840?_0x2e83c4[_0x7673('0x1a')]:_0x224cea[_0x7673('0x1b')]+_0x224cea['limit'];var _0x50f22d;if(_0x33ff7d>=_0x50f8d9){_0x33ff7d=_0x50f8d9;_0x50f22d=0xc8;}else{_0x50f22d=0xce;}_0x2c83d[_0x7673('0x15')](_0x50f22d);return _0x2c83d[_0x7673('0x1c')]('Content-Range',_0x17699a+'-'+_0x33ff7d+'/'+_0x50f8d9)[_0x7673('0x17')](_0x2e83c4);}return null;};}function patchUpdates(_0x29bbd9){return function(_0x2e1260){try{jsonpatch[_0x7673('0x1d')](_0x2e1260,_0x29bbd9,!![]);}catch(_0x4245bf){return BPromise[_0x7673('0x1e')](_0x4245bf);}return _0x2e1260['save']();};}function saveUpdates(_0x557161,_0xea9b37){return function(_0x21774f){if(_0x21774f){return _0x21774f[_0x7673('0x1f')](_0x557161)[_0x7673('0x20')](function(_0x16bb16){return _0x16bb16;});}return null;};}function removeEntity(_0x54f38d,_0x2009e1){return function(_0x3b2a75){if(_0x3b2a75){return _0x3b2a75[_0x7673('0x21')]()[_0x7673('0x20')](function(){var _0x132dc6=_0x3b2a75[_0x7673('0x22')]({'plain':!![]});var _0x538280=_0x7673('0x23');return db[_0x7673('0x24')][_0x7673('0x21')]({'where':{'type':_0x538280,'resourceId':_0x132dc6['id']}})[_0x7673('0x20')](function(){return _0x3b2a75;});})['then'](function(){_0x54f38d['status'](0xcc)[_0x7673('0x16')]();});}};}function handleEntityNotFound(_0x11b42b,_0x291d10){return function(_0x9d9eab){if(!_0x9d9eab){_0x11b42b[_0x7673('0x14')](0x194);}return _0x9d9eab;};}function handleError(_0x45a045,_0x442f42){_0x442f42=_0x442f42||0x1f4;return function(_0x5a59f9){logger['error'](_0x5a59f9[_0x7673('0x25')]);if(_0x5a59f9[_0x7673('0x26')]){delete _0x5a59f9[_0x7673('0x26')];}_0x45a045[_0x7673('0x15')](_0x442f42)[_0x7673('0x27')](_0x5a59f9);};}exports[_0x7673('0x28')]=function(_0x224122,_0x4f12b9){var _0x4fcacc={},_0xe7e528={},_0x36c841={'count':0x0,'rows':[]};var _0x268863=_[_0x7673('0x29')](db['Tag'][_0x7673('0x2a')],function(_0x497760){return{'name':_0x497760[_0x7673('0x2b')],'type':_0x497760[_0x7673('0x2c')][_0x7673('0x2d')]};});_0xe7e528[_0x7673('0x2e')]=_[_0x7673('0x29')](_0x268863,_0x7673('0x26'));_0xe7e528[_0x7673('0x2f')]=_[_0x7673('0x30')](_0x224122[_0x7673('0x2f')]);_0xe7e528[_0x7673('0x31')]=_[_0x7673('0x32')](_0xe7e528[_0x7673('0x2e')],_0xe7e528[_0x7673('0x2f')]);_0x4fcacc['attributes']=_[_0x7673('0x32')](_0xe7e528[_0x7673('0x2e')],qs[_0x7673('0x33')](_0x224122[_0x7673('0x2f')][_0x7673('0x33')]));_0x4fcacc[_0x7673('0x34')]=_0x4fcacc[_0x7673('0x34')]['length']?_0x4fcacc['attributes']:_0xe7e528[_0x7673('0x2e')];if(!_0x224122[_0x7673('0x2f')][_0x7673('0x35')](_0x7673('0x36'))){_0x4fcacc[_0x7673('0x18')]=qs[_0x7673('0x18')](_0x224122[_0x7673('0x2f')]['limit']);_0x4fcacc[_0x7673('0x1b')]=qs[_0x7673('0x1b')](_0x224122['query'][_0x7673('0x1b')]);}_0x4fcacc[_0x7673('0x37')]=qs[_0x7673('0x38')](_0x224122[_0x7673('0x2f')]['sort']);_0x4fcacc[_0x7673('0x39')]=qs[_0x7673('0x31')](_['pick'](_0x224122[_0x7673('0x2f')],_0xe7e528[_0x7673('0x31')]),_0x268863);if(_0x224122[_0x7673('0x2f')]['filter']){_0x4fcacc[_0x7673('0x39')]=_[_0x7673('0x3a')](_0x4fcacc[_0x7673('0x39')],{'$or':_['map'](_0x268863,function(_0x4c6106){if(_0x4c6106[_0x7673('0x2c')]!=='VIRTUAL'){var _0x4ba2b4={};_0x4ba2b4[_0x4c6106[_0x7673('0x26')]]={'$like':'%'+_0x224122[_0x7673('0x2f')]['filter']+'%'};return _0x4ba2b4;}})});}_0x4fcacc=_[_0x7673('0x3a')]({},_0x4fcacc,_0x224122[_0x7673('0x3b')]);var _0x2645a2={'where':_0x4fcacc[_0x7673('0x39')]};return db[_0x7673('0x3c')][_0x7673('0x1a')](_0x2645a2)['then'](function(_0x1edb82){_0x36c841['count']=_0x1edb82;if(_0x224122[_0x7673('0x2f')]['includeAll']){_0x4fcacc[_0x7673('0x3d')]=[{'all':!![]}];}return db[_0x7673('0x3c')]['findAll'](_0x4fcacc);})['then'](function(_0x1cac93){_0x36c841['rows']=_0x1cac93;return _0x36c841;})[_0x7673('0x20')](respondWithFilteredResult(_0x4f12b9,_0x4fcacc))[_0x7673('0x3e')](handleError(_0x4f12b9,null));};exports[_0x7673('0x3f')]=function(_0x3b6223,_0x1895df){var _0x545357={'raw':!![],'where':{'id':_0x3b6223[_0x7673('0x40')]['id']}},_0x4ea8b3={};_0x4ea8b3[_0x7673('0x2e')]=_['keys'](db[_0x7673('0x3c')][_0x7673('0x2a')]);_0x4ea8b3[_0x7673('0x2f')]=_['keys'](_0x3b6223[_0x7673('0x2f')]);_0x4ea8b3[_0x7673('0x31')]=_[_0x7673('0x32')](_0x4ea8b3[_0x7673('0x2e')],_0x4ea8b3[_0x7673('0x2f')]);_0x545357[_0x7673('0x34')]=_[_0x7673('0x32')](_0x4ea8b3[_0x7673('0x2e')],qs[_0x7673('0x33')](_0x3b6223['query'][_0x7673('0x33')]));_0x545357[_0x7673('0x34')]=_0x545357[_0x7673('0x34')][_0x7673('0x41')]?_0x545357[_0x7673('0x34')]:_0x4ea8b3[_0x7673('0x2e')];if(_0x3b6223[_0x7673('0x2f')]['includeAll']){_0x545357[_0x7673('0x3d')]=[{'all':!![]}];}_0x545357=_[_0x7673('0x3a')]({},_0x545357,_0x3b6223[_0x7673('0x3b')]);return db[_0x7673('0x3c')][_0x7673('0x42')](_0x545357)['then'](handleEntityNotFound(_0x1895df,null))[_0x7673('0x20')](respondWithResult(_0x1895df,null))[_0x7673('0x3e')](handleError(_0x1895df,null));};exports[_0x7673('0x43')]=function(_0x2397fb,_0x3f76a3){return db['Tag']['create'](_0x2397fb[_0x7673('0x44')],{})[_0x7673('0x20')](function(_0x510960){var _0x2314e7=_0x2397fb[_0x7673('0x45')][_0x7673('0x22')]({'plain':!![]});if(!_0x2314e7)throw new Error(_0x7673('0x46'));if(_0x2314e7[_0x7673('0x47')]==='user'){var _0x23789d=_0x510960[_0x7673('0x22')]({'plain':!![]});var _0x2a275b=_0x7673('0x23');return db['UserProfileSection'][_0x7673('0x42')]({'where':{'name':_0x2a275b,'userProfileId':_0x2314e7[_0x7673('0x48')]},'raw':!![]})[_0x7673('0x20')](function(_0xa93124){if(_0xa93124&&_0xa93124[_0x7673('0x49')]===0x0){return db[_0x7673('0x24')][_0x7673('0x43')]({'name':_0x23789d[_0x7673('0x26')],'resourceId':_0x23789d['id'],'type':_0xa93124[_0x7673('0x26')],'sectionId':_0xa93124['id']},{})[_0x7673('0x20')](function(){return _0x510960;});}else{return _0x510960;}})[_0x7673('0x3e')](function(_0x572119){logger[_0x7673('0x4a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x572119);throw _0x572119;});}return _0x510960;})[_0x7673('0x20')](respondWithResult(_0x3f76a3,0xc9))[_0x7673('0x3e')](handleError(_0x3f76a3,null));};exports[_0x7673('0x1f')]=function(_0x523698,_0x185ec5){if(_0x523698[_0x7673('0x44')]['id']){delete _0x523698[_0x7673('0x44')]['id'];}return db[_0x7673('0x3c')][_0x7673('0x42')]({'where':{'id':_0x523698[_0x7673('0x40')]['id']}})[_0x7673('0x20')](handleEntityNotFound(_0x185ec5,null))[_0x7673('0x20')](saveUpdates(_0x523698[_0x7673('0x44')],null))[_0x7673('0x20')](respondWithResult(_0x185ec5,null))[_0x7673('0x3e')](handleError(_0x185ec5,null));};exports[_0x7673('0x21')]=function(_0x9be9a4,_0xb3c9e9){return db['Tag'][_0x7673('0x42')]({'where':{'id':_0x9be9a4['params']['id']}})[_0x7673('0x20')](handleEntityNotFound(_0xb3c9e9,null))[_0x7673('0x20')](removeEntity(_0xb3c9e9,null))[_0x7673('0x3e')](handleError(_0xb3c9e9,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 46099e8..ad08f2e 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 _0x0a9f=['request-promise','rimraf','exports','define','Tag','tools_tags','lodash','util','api','moment','bluebird'];(function(_0xc795e0,_0x2d113e){var _0x5607cf=function(_0x13b7a0){while(--_0x13b7a0){_0xc795e0['push'](_0xc795e0['shift']());}};_0x5607cf(++_0x2d113e);}(_0x0a9f,0x19d));var _0xf0a9=function(_0x1c3281,_0x5c69a0){_0x1c3281=_0x1c3281-0x0;var _0x27588d=_0x0a9f[_0x1c3281];return _0x27588d;};'use strict';var _=require(_0xf0a9('0x0'));var util=require(_0xf0a9('0x1'));var logger=require('../../config/logger')(_0xf0a9('0x2'));var moment=require(_0xf0a9('0x3'));var BPromise=require(_0xf0a9('0x4'));var rp=require(_0xf0a9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf0a9('0x6'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0xf0a9('0x7')]=function(_0x450780,_0x16965a){return _0x450780[_0xf0a9('0x8')](_0xf0a9('0x9'),attributes,{'tableName':_0xf0a9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7d3=['rimraf','../../config/environment','exports','define','Tag','tools_tags','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2b45be,_0x18edcf){var _0x296fa5=function(_0x5223e9){while(--_0x5223e9){_0x2b45be['push'](_0x2b45be['shift']());}};_0x296fa5(++_0x18edcf);}(_0xa7d3,0x171));var _0x3a7d=function(_0x2c5e7e,_0x11e647){_0x2c5e7e=_0x2c5e7e-0x0;var _0x2cb143=_0xa7d3[_0x2c5e7e];return _0x2cb143;};'use strict';var _=require('lodash');var util=require(_0x3a7d('0x0'));var logger=require(_0x3a7d('0x1'))(_0x3a7d('0x2'));var moment=require('moment');var BPromise=require(_0x3a7d('0x3'));var rp=require(_0x3a7d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3a7d('0x5'));var config=require(_0x3a7d('0x6'));var attributes=require('./tag.attributes');module[_0x3a7d('0x7')]=function(_0x92e400,_0x10205c){return _0x92e400[_0x3a7d('0x8')](_0x3a7d('0x9'),attributes,{'tableName':_0x3a7d('0xa'),'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 947c675..be9c601 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 _0x0207=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','error','code','message','util','randomstring','ioredis'];(function(_0x205338,_0x516bf7){var _0x5ea60e=function(_0x535682){while(--_0x535682){_0x205338['push'](_0x205338['shift']());}};_0x5ea60e(++_0x516bf7);}(_0x0207,0x162));var _0x7020=function(_0x28dd1a,_0x48ecb3){_0x28dd1a=_0x28dd1a-0x0;var _0x18d911=_0x0207[_0x28dd1a];return _0x18d911;};'use strict';var _=require('lodash');var util=require(_0x7020('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7020('0x1'));var fs=require('fs');var Redis=require(_0x7020('0x2'));var db=require(_0x7020('0x3'))['db'];var utils=require(_0x7020('0x4'));var logger=require(_0x7020('0x5'))(_0x7020('0x6'));var config=require(_0x7020('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7020('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39263c,_0x3c6c11,_0x17deac){return new BPromise(function(_0x42bc79,_0x22ba3e){return client[_0x7020('0x9')](_0x39263c,_0x17deac)['then'](function(_0x5e86b5){logger[_0x7020('0xa')](_0x7020('0xb'),_0x3c6c11,_0x7020('0xc'));logger['debug'](_0x7020('0xd'),_0x3c6c11,_0x7020('0xc'),JSON['stringify'](_0x5e86b5));if(_0x5e86b5[_0x7020('0xe')]){if(_0x5e86b5[_0x7020('0xe')][_0x7020('0xf')]===0x1f4){logger['error'](_0x7020('0xb'),_0x3c6c11,_0x5e86b5[_0x7020('0xe')][_0x7020('0x10')]);return _0x22ba3e(_0x5e86b5[_0x7020('0xe')][_0x7020('0x10')]);}logger['error'](_0x7020('0xb'),_0x3c6c11,_0x5e86b5['error'][_0x7020('0x10')]);return _0x42bc79(_0x5e86b5[_0x7020('0xe')][_0x7020('0x10')]);}else{logger[_0x7020('0xa')](_0x7020('0xb'),_0x3c6c11,_0x7020('0xc'));_0x42bc79(_0x5e86b5['result'][_0x7020('0x10')]);}})['catch'](function(_0x2f4db5){logger[_0x7020('0xe')](_0x7020('0xb'),_0x3c6c11,_0x2f4db5);_0x22ba3e(_0x2f4db5);});});} \ No newline at end of file +var _0xbd50=['Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xbd50,0x196));var _0x0bd5=function(_0x235f95,_0x2bf647){_0x235f95=_0x235f95-0x0;var _0x2348cb=_0xbd50[_0x235f95];return _0x2348cb;};'use strict';var _=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var moment=require(_0x0bd5('0x2'));var BPromise=require('bluebird');var rs=require(_0x0bd5('0x3'));var fs=require('fs');var Redis=require(_0x0bd5('0x4'));var db=require(_0x0bd5('0x5'))['db'];var utils=require(_0x0bd5('0x6'));var logger=require(_0x0bd5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0bd5('0x8')][_0x0bd5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcc6cfa,_0x2c0db1,_0x1b99f3){return new BPromise(function(_0x5ebe64,_0x47e78d){return client[_0x0bd5('0xa')](_0xcc6cfa,_0x1b99f3)[_0x0bd5('0xb')](function(_0x259f4c){logger['info'](_0x0bd5('0xc'),_0x2c0db1,_0x0bd5('0xd'));logger['debug'](_0x0bd5('0xe'),_0x2c0db1,_0x0bd5('0xd'),JSON['stringify'](_0x259f4c));if(_0x259f4c[_0x0bd5('0xf')]){if(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x10')]===0x1f4){logger['error'](_0x0bd5('0xc'),_0x2c0db1,_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);return _0x47e78d(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);}logger[_0x0bd5('0xf')](_0x0bd5('0xc'),_0x2c0db1,_0x259f4c[_0x0bd5('0xf')]['message']);return _0x5ebe64(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);}else{logger['info'](_0x0bd5('0xc'),_0x2c0db1,_0x0bd5('0xd'));_0x5ebe64(_0x259f4c[_0x0bd5('0x12')][_0x0bd5('0x11')]);}})['catch'](function(_0x14f32c){logger[_0x0bd5('0xf')](_0x0bd5('0xc'),_0x2c0db1,_0x14f32c);_0x47e78d(_0x14f32c);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index dc42e49..9d68d2c 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 9a1788e..ab7a2e0 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(_0x1f7413,_0x3388c3){var _0x2d2775=function(_0x5e5b4){while(--_0x5e5b4){_0x1f7413['push'](_0x1f7413['shift']());}};_0x2d2775(++_0x3388c3);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'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 _0xb7e7=['STRING','sequelize'];(function(_0x5e4563,_0x3ff918){var _0x8d1bf5=function(_0x3bf7a9){while(--_0x3bf7a9){_0x5e4563['push'](_0x5e4563['shift']());}};_0x8d1bf5(++_0x3ff918);}(_0xb7e7,0x121));var _0x7b7e=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xb7e7[_0xc4001c];return _0x49f7bc;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 146090e..71fcc74 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 _0xcfb3=['../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./team.socket','status','end','offset','count','set','Content-Range','json','apply','reject','update','then','sendStatus','error','name','index','map','Team','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','show','includeAll','options','find','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','sequelize','Sequelize','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','destroy','UserSmsQueue','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','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','send','getQueues','params','isValidChannel','channel','ValidationError','toLowerCase','Queue','length','capitalize','addQueues','Unknown\x20channel','add','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','through','penalty','Queues','QueueId','TeamVoiceQueue','findOrCreate','Queue:save','User','findAll','interface','UserVoiceQueueRt','upsert','isNil','format','voicePause','all','findOne','spread','removeAgents','emit','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x3cb30b,_0x504b3e){var _0x2ca717=function(_0x32a3d9){while(--_0x32a3d9){_0x3cb30b['push'](_0x3cb30b['shift']());}};_0x2ca717(++_0x504b3e);}(_0xcfb3,0x87));var _0x3cfb=function(_0x1c3132,_0xfb131a){_0x1c3132=_0x1c3132-0x0;var _0x5cb330=_0xcfb3[_0x1c3132];return _0x5cb330;};'use strict';var emlformat=require(_0x3cfb('0x0'));var rimraf=require(_0x3cfb('0x1'));var zipdir=require(_0x3cfb('0x2'));var jsonpatch=require(_0x3cfb('0x3'));var rp=require(_0x3cfb('0x4'));var moment=require(_0x3cfb('0x5'));var BPromise=require(_0x3cfb('0x6'));var Mustache=require(_0x3cfb('0x7'));var util=require('util');var path=require(_0x3cfb('0x8'));var sox=require(_0x3cfb('0x9'));var csv=require(_0x3cfb('0xa'));var ejs=require(_0x3cfb('0xb'));var fs=require('fs');var fs_extra=require(_0x3cfb('0xc'));var _=require(_0x3cfb('0xd'));var squel=require(_0x3cfb('0xe'));var crypto=require(_0x3cfb('0xf'));var jsforce=require(_0x3cfb('0x10'));var deskjs=require(_0x3cfb('0x11'));var toCsv=require(_0x3cfb('0xa'));var querystring=require(_0x3cfb('0x12'));var Papa=require(_0x3cfb('0x13'));var Redis=require(_0x3cfb('0x14'));var authService=require(_0x3cfb('0x15'));var qs=require(_0x3cfb('0x16'));var as=require(_0x3cfb('0x17'));var hardwareService=require(_0x3cfb('0x18'));var logger=require('../../config/logger')(_0x3cfb('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3cfb('0x1a'));var db=require(_0x3cfb('0x1b'))['db'];config['redis']=_[_0x3cfb('0x1c')](config['redis'],{'host':_0x3cfb('0x1d'),'port':0x18eb});var socket=require(_0x3cfb('0x1e'))(new Redis(config[_0x3cfb('0x1f')]));require(_0x3cfb('0x20'))['register'](socket);function respondWithStatusCode(_0x501e8f,_0x3af7be){_0x3af7be=_0x3af7be||0xcc;return function(_0x5a5e44){if(_0x5a5e44){return _0x501e8f['sendStatus'](_0x3af7be);}return _0x501e8f[_0x3cfb('0x21')](_0x3af7be)[_0x3cfb('0x22')]();};}function respondWithResult(_0x1af06e,_0x538df6){_0x538df6=_0x538df6||0xc8;return function(_0x48b7d6){if(_0x48b7d6){return _0x1af06e[_0x3cfb('0x21')](_0x538df6)['json'](_0x48b7d6);}};}function respondWithFilteredResult(_0x3dddfe,_0x35c7ac){return function(_0x5df646){if(_0x5df646){var _0x2af858=typeof _0x35c7ac[_0x3cfb('0x23')]==='undefined'&&typeof _0x35c7ac['limit']==='undefined';var _0x5d3e27=_0x5df646[_0x3cfb('0x24')];var _0x367818=_0x2af858?0x0:_0x35c7ac[_0x3cfb('0x23')];var _0x4a40ef=_0x2af858?_0x5df646[_0x3cfb('0x24')]:_0x35c7ac[_0x3cfb('0x23')]+_0x35c7ac['limit'];var _0x11b894;if(_0x4a40ef>=_0x5d3e27){_0x4a40ef=_0x5d3e27;_0x11b894=0xc8;}else{_0x11b894=0xce;}_0x3dddfe[_0x3cfb('0x21')](_0x11b894);return _0x3dddfe[_0x3cfb('0x25')](_0x3cfb('0x26'),_0x367818+'-'+_0x4a40ef+'/'+_0x5d3e27)[_0x3cfb('0x27')](_0x5df646);}return null;};}function patchUpdates(_0x559d31){return function(_0xf39fab){try{jsonpatch[_0x3cfb('0x28')](_0xf39fab,_0x559d31,!![]);}catch(_0x3bf17b){return BPromise[_0x3cfb('0x29')](_0x3bf17b);}return _0xf39fab['save']();};}function saveUpdates(_0x4af711,_0x4d89d7){return function(_0x53f544){if(_0x53f544){return _0x53f544[_0x3cfb('0x2a')](_0x4af711)[_0x3cfb('0x2b')](function(_0x4b5196){return _0x4b5196;});}return null;};}function handleEntityNotFound(_0x5955d0,_0x2f20f7){return function(_0x3cc1b6){if(!_0x3cc1b6){_0x5955d0[_0x3cfb('0x2c')](0x194);}return _0x3cc1b6;};}function handleError(_0x521a0d,_0x1019f8){_0x1019f8=_0x1019f8||0x1f4;return function(_0xf502c8){logger[_0x3cfb('0x2d')](_0xf502c8['stack']);if(_0xf502c8[_0x3cfb('0x2e')]){delete _0xf502c8[_0x3cfb('0x2e')];}_0x521a0d['status'](_0x1019f8)['send'](_0xf502c8);};}exports[_0x3cfb('0x2f')]=function(_0x444cf9,_0x22cd56){var _0x145db0={},_0x3262a1={},_0x9bce25={'count':0x0,'rows':[]};var _0x73c50d=_[_0x3cfb('0x30')](db[_0x3cfb('0x31')][_0x3cfb('0x32')],function(_0x2049a4){return{'name':_0x2049a4[_0x3cfb('0x33')],'type':_0x2049a4[_0x3cfb('0x34')][_0x3cfb('0x35')]};});_0x3262a1['model']=_[_0x3cfb('0x30')](_0x73c50d,'name');_0x3262a1[_0x3cfb('0x36')]=_[_0x3cfb('0x37')](_0x444cf9['query']);_0x3262a1[_0x3cfb('0x38')]=_[_0x3cfb('0x39')](_0x3262a1[_0x3cfb('0x3a')],_0x3262a1[_0x3cfb('0x36')]);_0x145db0['attributes']=_['intersection'](_0x3262a1[_0x3cfb('0x3a')],qs['fields'](_0x444cf9[_0x3cfb('0x36')][_0x3cfb('0x3b')]));_0x145db0[_0x3cfb('0x3c')]=_0x145db0[_0x3cfb('0x3c')]['length']?_0x145db0['attributes']:_0x3262a1['model'];if(!_0x444cf9[_0x3cfb('0x36')][_0x3cfb('0x3d')]('nolimit')){_0x145db0[_0x3cfb('0x3e')]=qs[_0x3cfb('0x3e')](_0x444cf9['query']['limit']);_0x145db0['offset']=qs[_0x3cfb('0x23')](_0x444cf9[_0x3cfb('0x36')][_0x3cfb('0x23')]);}_0x145db0[_0x3cfb('0x3f')]=qs[_0x3cfb('0x40')](_0x444cf9[_0x3cfb('0x36')][_0x3cfb('0x40')]);_0x145db0[_0x3cfb('0x41')]=qs[_0x3cfb('0x38')](_[_0x3cfb('0x42')](_0x444cf9[_0x3cfb('0x36')],_0x3262a1[_0x3cfb('0x38')]),_0x73c50d);if(_0x444cf9[_0x3cfb('0x36')][_0x3cfb('0x43')]){_0x145db0[_0x3cfb('0x41')]=_[_0x3cfb('0x44')](_0x145db0[_0x3cfb('0x41')],{'$or':_[_0x3cfb('0x30')](_0x73c50d,function(_0x25c111){if(_0x25c111[_0x3cfb('0x34')]!==_0x3cfb('0x45')){var _0x3fd6c8={};_0x3fd6c8[_0x25c111['name']]={'$like':'%'+_0x444cf9[_0x3cfb('0x36')][_0x3cfb('0x43')]+'%'};return _0x3fd6c8;}})});}_0x145db0=_[_0x3cfb('0x44')]({},_0x145db0,_0x444cf9['options']);var _0x2900a4={'where':_0x145db0[_0x3cfb('0x41')]};return db['Team'][_0x3cfb('0x24')](_0x2900a4)[_0x3cfb('0x2b')](function(_0x11baee){_0x9bce25[_0x3cfb('0x24')]=_0x11baee;if(_0x444cf9['query']['includeAll']){_0x145db0[_0x3cfb('0x46')]=[{'all':!![]}];}return db['Team']['findAll'](_0x145db0);})[_0x3cfb('0x2b')](function(_0x125258){_0x9bce25[_0x3cfb('0x47')]=_0x125258;return _0x9bce25;})[_0x3cfb('0x2b')](respondWithFilteredResult(_0x22cd56,_0x145db0))['catch'](handleError(_0x22cd56,null));};exports[_0x3cfb('0x48')]=function(_0x146f45,_0x1002d9){var _0x57894c={'raw':![],'where':{'id':_0x146f45['params']['id']}},_0x3f7d77={};_0x3f7d77[_0x3cfb('0x3a')]=_[_0x3cfb('0x37')](db['Team'][_0x3cfb('0x32')]);_0x3f7d77[_0x3cfb('0x36')]=_[_0x3cfb('0x37')](_0x146f45['query']);_0x3f7d77[_0x3cfb('0x38')]=_['intersection'](_0x3f7d77[_0x3cfb('0x3a')],_0x3f7d77[_0x3cfb('0x36')]);_0x57894c[_0x3cfb('0x3c')]=_[_0x3cfb('0x39')](_0x3f7d77[_0x3cfb('0x3a')],qs[_0x3cfb('0x3b')](_0x146f45['query'][_0x3cfb('0x3b')]));_0x57894c[_0x3cfb('0x3c')]=_0x57894c['attributes']['length']?_0x57894c[_0x3cfb('0x3c')]:_0x3f7d77['model'];if(_0x146f45[_0x3cfb('0x36')][_0x3cfb('0x49')]){_0x57894c[_0x3cfb('0x46')]=[{'all':!![]}];}_0x57894c=_[_0x3cfb('0x44')]({},_0x57894c,_0x146f45[_0x3cfb('0x4a')]);return db[_0x3cfb('0x31')][_0x3cfb('0x4b')](_0x57894c)['then'](handleEntityNotFound(_0x1002d9,null))[_0x3cfb('0x2b')](respondWithResult(_0x1002d9,null))[_0x3cfb('0x4c')](handleError(_0x1002d9,null));};exports['create']=function(_0x384b51,_0x528f88){return db[_0x3cfb('0x31')][_0x3cfb('0x4d')](_0x384b51['body'],{})[_0x3cfb('0x2b')](function(_0x417e99){var _0x5286a8=_0x384b51['user'][_0x3cfb('0x4e')]({'plain':!![]});if(!_0x5286a8)throw new Error(_0x3cfb('0x4f'));if(_0x5286a8[_0x3cfb('0x50')]===_0x3cfb('0x51')){var _0x4806c2=_0x417e99[_0x3cfb('0x4e')]({'plain':!![]});var _0x18f7ca=_0x3cfb('0x52');return db[_0x3cfb('0x53')][_0x3cfb('0x4b')]({'where':{'name':_0x18f7ca,'userProfileId':_0x5286a8[_0x3cfb('0x54')]},'raw':!![]})[_0x3cfb('0x2b')](function(_0x41e28f){if(_0x41e28f&&_0x41e28f[_0x3cfb('0x55')]===0x0){return db[_0x3cfb('0x56')][_0x3cfb('0x4d')]({'name':_0x4806c2['name'],'resourceId':_0x4806c2['id'],'type':_0x41e28f[_0x3cfb('0x2e')],'sectionId':_0x41e28f['id']},{})[_0x3cfb('0x2b')](function(){return _0x417e99;});}else{return _0x417e99;}})['catch'](function(_0xf1134a){logger['error'](_0x3cfb('0x57'),_0xf1134a);throw _0xf1134a;});}return _0x417e99;})['then'](respondWithResult(_0x528f88,0xc9))[_0x3cfb('0x4c')](handleError(_0x528f88,null));};exports['update']=function(_0x39ace2,_0x49e0d4){if(_0x39ace2[_0x3cfb('0x58')]['id']){delete _0x39ace2['body']['id'];}return db['Team'][_0x3cfb('0x4b')]({'where':{'id':_0x39ace2['params']['id']}})[_0x3cfb('0x2b')](handleEntityNotFound(_0x49e0d4,null))[_0x3cfb('0x2b')](saveUpdates(_0x39ace2['body'],null))[_0x3cfb('0x2b')](respondWithResult(_0x49e0d4,null))[_0x3cfb('0x4c')](handleError(_0x49e0d4,null));};exports['destroy']=function(_0x5341df,_0x263f14){var _0x2355a4=_0x5341df['params']['id'];var _0xd7e25a=[];return db['sequelize']['transaction'](function(_0x4e25da){var _0x12cb7d='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x2355a4;return db[_0x3cfb('0x59')][_0x3cfb('0x36')](_0x12cb7d,{'type':db[_0x3cfb('0x5a')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x4e25da})[_0x3cfb('0x2b')](function(_0xc8b98a){_0xd7e25a=_[_0x3cfb('0x30')](_0xc8b98a,function(_0x11e7f6){return Number(_0x11e7f6[_0x3cfb('0x5b')]);});})[_0x3cfb('0x2b')](function(){var _0x579c13=_0x3cfb('0x5c')+_0x2355a4;return db[_0x3cfb('0x59')]['query'](_0x579c13,{'type':db[_0x3cfb('0x5a')][_0x3cfb('0x5d')][_0x3cfb('0x5e')],'raw':!![],'transaction':_0x4e25da});})[_0x3cfb('0x2b')](function(_0x38b3ed){var _0x3e3872=_[_0x3cfb('0x30')](_0x38b3ed,function(_0x29c919){return Number(_0x29c919[_0x3cfb('0x5f')]);});return db[_0x3cfb('0x60')]['destroy']({'where':{'UserId':{'$in':_0xd7e25a},'VoiceQueueId':{'$in':_0x3e3872}},'transaction':_0x4e25da});})[_0x3cfb('0x2b')](function(){var _0x25c2be=_0x3cfb('0x61')+_0x2355a4;return db[_0x3cfb('0x59')][_0x3cfb('0x36')](_0x25c2be,{'type':db[_0x3cfb('0x5a')][_0x3cfb('0x5d')]['SELECT'],'raw':!![],'transaction':_0x4e25da});})[_0x3cfb('0x2b')](function(_0x4abb3d){var _0x5c07de=_[_0x3cfb('0x30')](_0x4abb3d,function(_0x40ed67){return Number(_0x40ed67[_0x3cfb('0x62')]);});return db[_0x3cfb('0x63')][_0x3cfb('0x64')]({'where':{'UserId':{'$in':_0xd7e25a},'MailQueueId':{'$in':_0x5c07de}},'transaction':_0x4e25da});})['then'](function(){var _0x3b50aa='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2355a4;return db['sequelize']['query'](_0x3b50aa,{'type':db['Sequelize'][_0x3cfb('0x5d')][_0x3cfb('0x5e')],'raw':!![],'transaction':_0x4e25da});})[_0x3cfb('0x2b')](function(_0x67317e){var _0x2993af=_[_0x3cfb('0x30')](_0x67317e,function(_0x17a5bb){return Number(_0x17a5bb['SmsQueueId']);});return db[_0x3cfb('0x65')][_0x3cfb('0x64')]({'where':{'UserId':{'$in':_0xd7e25a},'SmsQueueId':{'$in':_0x2993af}},'transaction':_0x4e25da});})['then'](function(){var _0xbb4456='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2355a4;return db[_0x3cfb('0x59')]['query'](_0xbb4456,{'type':db[_0x3cfb('0x5a')]['QueryTypes'][_0x3cfb('0x5e')],'raw':!![],'transaction':_0x4e25da});})[_0x3cfb('0x2b')](function(_0x5ee90b){var _0x1fa53c=_[_0x3cfb('0x30')](_0x5ee90b,function(_0x3e9e52){return Number(_0x3e9e52[_0x3cfb('0x66')]);});return db[_0x3cfb('0x67')][_0x3cfb('0x64')]({'where':{'UserId':{'$in':_0xd7e25a},'ChatQueueId':{'$in':_0x1fa53c}},'transaction':_0x4e25da});})[_0x3cfb('0x2b')](function(){var _0x5d3521=_0x3cfb('0x68')+_0x2355a4;return db[_0x3cfb('0x59')][_0x3cfb('0x36')](_0x5d3521,{'type':db[_0x3cfb('0x5a')][_0x3cfb('0x5d')]['SELECT'],'raw':!![],'transaction':_0x4e25da});})[_0x3cfb('0x2b')](function(_0xbd1d3){var _0x172978=_[_0x3cfb('0x30')](_0xbd1d3,function(_0x130922){return Number(_0x130922['FaxQueueId']);});return db[_0x3cfb('0x69')][_0x3cfb('0x64')]({'where':{'UserId':{'$in':_0xd7e25a},'FaxQueueId':{'$in':_0x172978}},'transaction':_0x4e25da});})[_0x3cfb('0x2b')](function(){var _0x535d21=_0x3cfb('0x6a')+_0x2355a4;return db['sequelize'][_0x3cfb('0x36')](_0x535d21,{'type':db[_0x3cfb('0x5a')][_0x3cfb('0x5d')][_0x3cfb('0x5e')],'raw':!![],'transaction':_0x4e25da});})[_0x3cfb('0x2b')](function(_0x1d7980){var _0x564a58=_[_0x3cfb('0x30')](_0x1d7980,function(_0x57936b){return Number(_0x57936b[_0x3cfb('0x6b')]);});return db[_0x3cfb('0x6c')][_0x3cfb('0x64')]({'where':{'UserId':{'$in':_0xd7e25a},'OpenchannelQueueId':{'$in':_0x564a58}},'transaction':_0x4e25da});})[_0x3cfb('0x2b')](function(){var _0x29fa07=_0x3cfb('0x6d')+_0x2355a4;return db[_0x3cfb('0x59')][_0x3cfb('0x36')](_0x29fa07,{'type':db[_0x3cfb('0x5a')]['QueryTypes'][_0x3cfb('0x5e')],'raw':!![],'transaction':_0x4e25da});})[_0x3cfb('0x2b')](function(_0x926096){var _0xff9bf=_['map'](_0x926096,function(_0x4f3e22){return Number(_0x4f3e22[_0x3cfb('0x6e')]);});return db[_0x3cfb('0x6f')][_0x3cfb('0x64')]({'where':{'UserId':{'$in':_0xd7e25a},'WhatsappQueueId':{'$in':_0xff9bf}},'transaction':_0x4e25da});})[_0x3cfb('0x2b')](function(){return db[_0x3cfb('0x70')][_0x3cfb('0x4b')]({'where':{'TeamId':_0x2355a4}});})[_0x3cfb('0x2b')](function(_0x438ef8){if(_0x438ef8===null){return;}return db[_0x3cfb('0x71')]['destroy']({'where':{'UserId':{'$in':_0xd7e25a},'VoicePrefixId':_0x438ef8[_0x3cfb('0x72')]},'transaction':_0x4e25da});})['then'](function(){return db[_0x3cfb('0x31')][_0x3cfb('0x64')]({'where':{'id':_0x2355a4},'cascade':!![],'transaction':_0x4e25da});})['then'](function(_0x41e101){if(_0x41e101===0x0){_0x263f14[_0x3cfb('0x2c')](0x194);}else{return db[_0x3cfb('0x56')]['destroy']({'where':{'type':_0x3cfb('0x52'),'resourceId':_0x2355a4},'cascade':!![],'transaction':_0x4e25da})[_0x3cfb('0x2b')](function(){_0x263f14[_0x3cfb('0x21')](0xcc)['end']();});}})[_0x3cfb('0x4c')](function(_0x3c5b49){_0x263f14[_0x3cfb('0x21')](0x1f4)[_0x3cfb('0x73')](_0x3c5b49);});});};exports[_0x3cfb('0x74')]=function(_0x80c880,_0x581426,_0x56aa0f){return db[_0x3cfb('0x31')]['findOne']({'where':{'id':_0x80c880[_0x3cfb('0x75')]['id']}})['then'](handleEntityNotFound(_0x581426,null))[_0x3cfb('0x2b')](function(_0x222d10){if(!_0x80c880[_0x3cfb('0x36')]['channel']||!utils[_0x3cfb('0x76')](_0x80c880[_0x3cfb('0x36')][_0x3cfb('0x77')])){throw new db[(_0x3cfb('0x5a'))][(_0x3cfb('0x78'))]('Unknown\x20channel');}var _0x4e8d7e={};var _0x116484={};_0x116484['model']=_[_0x3cfb('0x37')](db[_['capitalize'](_0x80c880[_0x3cfb('0x36')]['channel'][_0x3cfb('0x79')]())+_0x3cfb('0x7a')][_0x3cfb('0x32')]);_0x116484[_0x3cfb('0x36')]=_[_0x3cfb('0x37')](_0x80c880[_0x3cfb('0x36')]);_0x116484[_0x3cfb('0x38')]=_[_0x3cfb('0x39')](_0x116484[_0x3cfb('0x3a')],_0x116484[_0x3cfb('0x36')]);_0x4e8d7e[_0x3cfb('0x3c')]=_[_0x3cfb('0x39')](_0x116484[_0x3cfb('0x3a')],qs[_0x3cfb('0x3b')](_0x80c880[_0x3cfb('0x36')]['fields']));_0x4e8d7e['attributes']=_0x4e8d7e['attributes'][_0x3cfb('0x7b')]?_0x4e8d7e[_0x3cfb('0x3c')]:_0x116484['model'];_0x4e8d7e[_0x3cfb('0x3e')]=qs[_0x3cfb('0x3e')](_0x80c880[_0x3cfb('0x36')][_0x3cfb('0x3e')]);_0x4e8d7e[_0x3cfb('0x23')]=qs['offset'](_0x80c880['query'][_0x3cfb('0x23')]);_0x4e8d7e[_0x3cfb('0x3f')]=qs[_0x3cfb('0x40')](_0x80c880[_0x3cfb('0x36')][_0x3cfb('0x40')]);_0x4e8d7e['where']=qs[_0x3cfb('0x38')](_[_0x3cfb('0x42')](_0x80c880[_0x3cfb('0x36')],_0x116484[_0x3cfb('0x38')]));_0x4e8d7e=_[_0x3cfb('0x44')]({},_0x4e8d7e,_0x80c880[_0x3cfb('0x4a')]);return _0x222d10[_0x3cfb('0x4e')+_[_0x3cfb('0x7c')](_0x80c880[_0x3cfb('0x36')]['channel'][_0x3cfb('0x79')]())+'Queues'](_0x4e8d7e);})[_0x3cfb('0x2b')](respondWithResult(_0x581426,null))[_0x3cfb('0x4c')](handleError(_0x581426,null));};exports[_0x3cfb('0x7d')]=function(_0x1d30e0,_0x3a3d62,_0x528187){return db['Team']['findOne']({'where':{'id':_0x1d30e0[_0x3cfb('0x75')]['id']}})[_0x3cfb('0x2b')](function(_0x93731d){if(_0x93731d){if(!_0x1d30e0['body'][_0x3cfb('0x77')]||!utils['isValidChannel'](_0x1d30e0[_0x3cfb('0x58')][_0x3cfb('0x77')])){throw new db[(_0x3cfb('0x5a'))]['ValidationError'](_0x3cfb('0x7e'));}return _0x93731d[_0x3cfb('0x7f')+_['capitalize'](_0x1d30e0[_0x3cfb('0x58')][_0x3cfb('0x77')][_0x3cfb('0x79')]())+'Queues'](_0x1d30e0[_0x3cfb('0x58')][_0x3cfb('0x80')]);}return null;})[_0x3cfb('0x2b')](handleEntityNotFound(_0x3a3d62,null))[_0x3cfb('0x2b')](respondWithStatusCode(_0x3a3d62,null))[_0x3cfb('0x4c')](handleError(_0x3a3d62,null));};exports[_0x3cfb('0x81')]=function(_0x4bbb49,_0x4dd219,_0x12ce28){return db['Team']['findOne']({'where':{'id':_0x4bbb49[_0x3cfb('0x75')]['id']}})['then'](function(_0x7de996){if(_0x7de996){if(!_0x4bbb49[_0x3cfb('0x36')][_0x3cfb('0x77')]||!utils['isValidChannel'](_0x4bbb49['query']['channel'])){throw new db[(_0x3cfb('0x5a'))][(_0x3cfb('0x78'))](_0x3cfb('0x7e'));}return _0x7de996[_0x3cfb('0x82')+_[_0x3cfb('0x7c')](_0x4bbb49[_0x3cfb('0x36')][_0x3cfb('0x77')][_0x3cfb('0x79')]())+'Queues'](_0x4bbb49['query'][_0x3cfb('0x80')]);}return null;})[_0x3cfb('0x2b')](handleEntityNotFound(_0x4dd219,null))[_0x3cfb('0x2b')](respondWithStatusCode(_0x4dd219,null))[_0x3cfb('0x4c')](handleError(_0x4dd219,null));};exports[_0x3cfb('0x83')]=function(_0x59ac31,_0x3639d7){var _0x5b0fa9=_[_0x3cfb('0x84')](_0x59ac31[_0x3cfb('0x58')][_0x3cfb('0x80')])?_0x59ac31[_0x3cfb('0x58')][_0x3cfb('0x80')]:[_0x59ac31[_0x3cfb('0x58')][_0x3cfb('0x80')]];var _0x216e2b=_0x59ac31['params']['id'];return db['Team'][_0x3cfb('0x4b')]({'where':{'id':_0x216e2b}})[_0x3cfb('0x2b')](handleEntityNotFound(_0x3639d7,null))[_0x3cfb('0x2b')](function(_0x544616){if(_0x544616){var _0xfe3f61=[_0x3cfb('0x85'),_0x3cfb('0x86'),_0x3cfb('0x87'),_0x3cfb('0x88'),_0x3cfb('0x89'),_0x3cfb('0x8a'),_0x3cfb('0x8b')];return db[_0x3cfb('0x59')]['transaction'](function(_0x43b0ad){var _0x431ba0=_['map'](_0xfe3f61,function(_0xb42048){var _0x5b57ff={'attributes':['id','name']};if(_0xb42048===_0x3cfb('0x85')){_0x5b57ff[_0x3cfb('0x8c')]={'attributes':[_0x3cfb('0x8d')]};}return _0x544616[_0x3cfb('0x4e')+_0xb42048+_0x3cfb('0x8e')](_0x5b57ff)[_0x3cfb('0x2b')](function(_0x4e8bc0){var _0x13cec1=_['map'](_0x4e8bc0,function(_0x52d2e0){var _0x1ab460=_[_0x3cfb('0x30')](_0x5b0fa9,function(_0x33ea1a){var _0x52eba3={'where':{'UserId':_0x33ea1a,[_0xb42048+_0x3cfb('0x8f')]:_0x52d2e0['id']},'transaction':_0x43b0ad};if(_0xb42048===_0x3cfb('0x85')){_0x52eba3[_0x3cfb('0x1c')]={'penalty':_0x52d2e0[_0x3cfb('0x90')][_0x3cfb('0x8d')]};}return db['User'+_0xb42048+_0x3cfb('0x7a')][_0x3cfb('0x91')](_0x52eba3)['then'](function(){socket['emit'](_0x3cfb('0x51')+_0xb42048+_0x3cfb('0x92'),{'UserId':_0x33ea1a,[_0xb42048+_0x3cfb('0x8f')]:_0x52d2e0['id']});if(_0xb42048!=='Voice'){return;}return db[_0x3cfb('0x93')][_0x3cfb('0x94')]({'where':{'id':_0x5b0fa9,'online':0x1},'attributes':['id','name','online','voicePause',_0x3cfb('0x95')],'raw':!![]})[_0x3cfb('0x2b')](function(_0x5c7823){var _0x28d375=_['map'](_0x5c7823,function(_0x2de9ce){return db[_0x3cfb('0x96')][_0x3cfb('0x97')]({'membername':_0x2de9ce[_0x3cfb('0x2e')],'UserId':_0x2de9ce['id'],'queue_name':_0x52d2e0['name'],'VoiceQueueId':_0x52d2e0['id'],'interface':_[_0x3cfb('0x98')](_0x2de9ce[_0x3cfb('0x95')])?util[_0x3cfb('0x99')]('SIP/%s',_0x2de9ce[_0x3cfb('0x2e')]):_0x2de9ce['interface'],'paused':_0x2de9ce[_0x3cfb('0x9a')]||![],'penalty':_0x52d2e0['TeamVoiceQueue'][_0x3cfb('0x8d')]},{'transaction':_0x43b0ad});});return Promise[_0x3cfb('0x9b')](_0x28d375);});});});return Promise[_0x3cfb('0x9b')](_0x1ab460);});return Promise[_0x3cfb('0x9b')](_0x13cec1);})[_0x3cfb('0x2b')](function(){return db['TeamVoicePrefix'][_0x3cfb('0x9c')]({'where':{'teamId':_0x216e2b}})[_0x3cfb('0x2b')](function(_0x195be3){if(_0x195be3){var _0x5e767d=_['map'](_0x5b0fa9,function(_0x18110b){db[_0x3cfb('0x71')]['upsert']({'UserId':_0x18110b,'VoicePrefixId':_0x195be3[_0x3cfb('0x72')]});});return Promise[_0x3cfb('0x9b')](_0x5e767d);}});});});return Promise[_0x3cfb('0x9b')](_0x431ba0)[_0x3cfb('0x2b')](function(){return _0x544616[_0x3cfb('0x83')](_0x5b0fa9,{'transaction':_0x43b0ad})[_0x3cfb('0x9d')](function(_0x2c9d44){return _0x2c9d44;});});});}})[_0x3cfb('0x2b')](respondWithResult(_0x3639d7,null))[_0x3cfb('0x4c')](handleError(_0x3639d7,null));};exports[_0x3cfb('0x9e')]=function(_0x4036da,_0x252fab){var _0x37c2da=_[_0x3cfb('0x84')](_0x4036da[_0x3cfb('0x36')][_0x3cfb('0x80')])?_0x4036da['query'][_0x3cfb('0x80')]:[_0x4036da[_0x3cfb('0x36')]['ids']];var _0x46653c=_0x4036da['params']['id'];return db[_0x3cfb('0x31')][_0x3cfb('0x4b')]({'where':{'id':_0x46653c}})[_0x3cfb('0x2b')](handleEntityNotFound(_0x252fab,null))[_0x3cfb('0x2b')](function(_0x18a5ba){if(_0x18a5ba){var _0x272be8=[_0x3cfb('0x85'),_0x3cfb('0x86'),_0x3cfb('0x87'),_0x3cfb('0x88'),_0x3cfb('0x89'),_0x3cfb('0x8a'),_0x3cfb('0x8b')];return db[_0x3cfb('0x59')]['transaction'](function(_0x26dc8e){var _0x2f5775=_[_0x3cfb('0x30')](_0x272be8,function(_0x5e8720){var _0x183bf2={'attributes':['id',_0x3cfb('0x2e')]};return _0x18a5ba[_0x3cfb('0x4e')+_0x5e8720+_0x3cfb('0x8e')](_0x183bf2)[_0x3cfb('0x2b')](function(_0x45c21f){var _0x2b01fe=_['map'](_0x45c21f,function(_0x387f3e){return _0x387f3e[_0x3cfb('0x9e')](_0x37c2da,{'transaction':_0x26dc8e})[_0x3cfb('0x2b')](function(){var _0x4ea9bd=_[_0x3cfb('0x30')](_0x37c2da,function(_0x53fc7d){socket[_0x3cfb('0x9f')](_0x3cfb('0x51')+_0x5e8720+'Queue:remove',{'UserId':Number(_0x53fc7d),[_0x5e8720+'QueueId']:_0x387f3e['id']});if(_0x5e8720!==_0x3cfb('0x85')){return;}return db[_0x3cfb('0x96')][_0x3cfb('0x64')]({'where':{'VoiceQueueId':_0x387f3e['id'],'UserId':_0x53fc7d},'transaction':_0x26dc8e});});return Promise['all'](_0x4ea9bd);});});return Promise[_0x3cfb('0x9b')](_0x2b01fe);});});return Promise[_0x3cfb('0x9b')](_0x2f5775)[_0x3cfb('0x2b')](function(){return _0x18a5ba[_0x3cfb('0x9e')](_0x37c2da,{'transaction':_0x26dc8e});})[_0x3cfb('0x2b')](function(){return db['TeamVoicePrefix'][_0x3cfb('0x9c')]({'where':{'teamId':_0x46653c}})[_0x3cfb('0x2b')](function(_0xc53049){if(_0xc53049){var _0x524336=_[_0x3cfb('0x30')](_0x37c2da,function(_0x480ad8){db[_0x3cfb('0x71')][_0x3cfb('0x64')]({'where':{'UserId':_0x480ad8,'VoicePrefixId':_0xc53049[_0x3cfb('0x72')]}});});return Promise[_0x3cfb('0x9b')](_0x524336);}});});});}})[_0x3cfb('0x2b')](respondWithStatusCode(_0x252fab,null))[_0x3cfb('0x4c')](handleError(_0x252fab,null));};exports[_0x3cfb('0xa0')]=function(_0x51b4e3,_0x206925,_0x5c020b){var _0x2b7579={};var _0x2c0bbc={};var _0x484b62;var _0x3fc4d4;return db[_0x3cfb('0x31')][_0x3cfb('0x9c')]({'where':{'id':_0x51b4e3['params']['id']}})['then'](handleEntityNotFound(_0x206925,null))['then'](function(_0x42f97f){if(_0x42f97f){_0x484b62=_0x42f97f;_0x2c0bbc['model']=_['keys'](db[_0x3cfb('0x93')][_0x3cfb('0x32')]);_0x2c0bbc['query']=_[_0x3cfb('0x37')](_0x51b4e3[_0x3cfb('0x36')]);_0x2c0bbc[_0x3cfb('0x38')]=_[_0x3cfb('0x39')](_0x2c0bbc[_0x3cfb('0x3a')],_0x2c0bbc[_0x3cfb('0x36')]);_0x2b7579[_0x3cfb('0x3c')]=_[_0x3cfb('0x39')](_0x2c0bbc[_0x3cfb('0x3a')],qs[_0x3cfb('0x3b')](_0x51b4e3['query']['fields']));_0x2b7579[_0x3cfb('0x3c')]=_0x2b7579[_0x3cfb('0x3c')]['length']?_0x2b7579[_0x3cfb('0x3c')]:_0x2c0bbc[_0x3cfb('0x3a')];_0x2b7579[_0x3cfb('0x3f')]=qs[_0x3cfb('0x40')](_0x51b4e3['query']['sort']);_0x2b7579[_0x3cfb('0x41')]=qs['filters'](_[_0x3cfb('0x42')](_0x51b4e3['query'],_0x2c0bbc[_0x3cfb('0x38')]));if(_0x51b4e3[_0x3cfb('0x36')][_0x3cfb('0x43')]){_0x2b7579[_0x3cfb('0x41')]=_[_0x3cfb('0x44')](_0x2b7579['where'],{'$or':_[_0x3cfb('0x30')](_0x2b7579[_0x3cfb('0x3c')],function(_0x1e5a79){var _0xbb237a={};_0xbb237a[_0x1e5a79]={'$like':'%'+_0x51b4e3['query'][_0x3cfb('0x43')]+'%'};return _0xbb237a;})});}_0x2b7579=_[_0x3cfb('0x44')]({},_0x2b7579,_0x51b4e3['options']);return _0x484b62[_0x3cfb('0xa0')](_0x2b7579);}})['then'](function(_0x3d763a){if(_0x3d763a){_0x3fc4d4=_0x3d763a['length'];if(!_0x51b4e3[_0x3cfb('0x36')]['hasOwnProperty']('nolimit')){_0x2b7579['limit']=qs['limit'](_0x51b4e3[_0x3cfb('0x36')][_0x3cfb('0x3e')]);_0x2b7579[_0x3cfb('0x23')]=qs['offset'](_0x51b4e3[_0x3cfb('0x36')]['offset']);}return _0x484b62[_0x3cfb('0xa0')](_0x2b7579);}})['then'](function(_0x1e90b3){if(_0x1e90b3){return _0x1e90b3?{'count':_0x3fc4d4,'rows':_0x1e90b3}:null;}})[_0x3cfb('0x2b')](respondWithResult(_0x206925,null))[_0x3cfb('0x4c')](handleError(_0x206925,null));}; \ No newline at end of file +var _0xd745=['nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','rawAttributes','find','create','body','user','get','role','Teams','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','VoiceQueueId','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','UserVoicePrefix','getQueues','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','pick','findOne','add','Queues','ids','removeQueues','remove','addAgents','isArray','Chat','Sms','Openchannel','Whatsapp','through','QueueId','Voice','defaults','TeamVoiceQueue','penalty','findOrCreate','Queue:save','User','findAll','online','voicePause','interface','format','all','upsert','VoicePrefixId','spread','removeAgents','Mail','Queue:remove','UserVoiceQueueRt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','Team','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x109a85,_0x1423db){var _0x3b29ac=function(_0x282b07){while(--_0x282b07){_0x109a85['push'](_0x109a85['shift']());}};_0x3b29ac(++_0x1423db);}(_0xd745,0x1a3));var _0x5d74=function(_0x40feef,_0x40036a){_0x40feef=_0x40feef-0x0;var _0xb67a05=_0xd745[_0x40feef];return _0xb67a05;};'use strict';var emlformat=require(_0x5d74('0x0'));var rimraf=require(_0x5d74('0x1'));var zipdir=require(_0x5d74('0x2'));var jsonpatch=require(_0x5d74('0x3'));var rp=require(_0x5d74('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5d74('0x5'));var util=require(_0x5d74('0x6'));var path=require('path');var sox=require(_0x5d74('0x7'));var csv=require('to-csv');var ejs=require(_0x5d74('0x8'));var fs=require('fs');var fs_extra=require(_0x5d74('0x9'));var _=require('lodash');var squel=require(_0x5d74('0xa'));var crypto=require(_0x5d74('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5d74('0xc'));var toCsv=require(_0x5d74('0xd'));var querystring=require(_0x5d74('0xe'));var Papa=require(_0x5d74('0xf'));var Redis=require(_0x5d74('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5d74('0x11'));var as=require(_0x5d74('0x12'));var hardwareService=require(_0x5d74('0x13'));var logger=require(_0x5d74('0x14'))(_0x5d74('0x15'));var utils=require(_0x5d74('0x16'));var config=require(_0x5d74('0x17'));var licenseUtil=require(_0x5d74('0x18'));var db=require(_0x5d74('0x19'))['db'];config['redis']=_['defaults'](config[_0x5d74('0x1a')],{'host':_0x5d74('0x1b'),'port':0x18eb});var socket=require(_0x5d74('0x1c'))(new Redis(config[_0x5d74('0x1a')]));require(_0x5d74('0x1d'))[_0x5d74('0x1e')](socket);function respondWithStatusCode(_0x19b6e8,_0x44eb88){_0x44eb88=_0x44eb88||0xcc;return function(_0xb3e0f6){if(_0xb3e0f6){return _0x19b6e8[_0x5d74('0x1f')](_0x44eb88);}return _0x19b6e8[_0x5d74('0x20')](_0x44eb88)[_0x5d74('0x21')]();};}function respondWithResult(_0x2c2fd2,_0x230ff6){_0x230ff6=_0x230ff6||0xc8;return function(_0x170445){if(_0x170445){return _0x2c2fd2['status'](_0x230ff6)[_0x5d74('0x22')](_0x170445);}};}function respondWithFilteredResult(_0x565f95,_0x1e5333){return function(_0x2c7368){if(_0x2c7368){var _0x3f357e=typeof _0x1e5333['offset']===_0x5d74('0x23')&&typeof _0x1e5333[_0x5d74('0x24')]===_0x5d74('0x23');var _0xa0155f=_0x2c7368[_0x5d74('0x25')];var _0x79a54d=_0x3f357e?0x0:_0x1e5333[_0x5d74('0x26')];var _0xe8b469=_0x3f357e?_0x2c7368[_0x5d74('0x25')]:_0x1e5333[_0x5d74('0x26')]+_0x1e5333['limit'];var _0x2e191e;if(_0xe8b469>=_0xa0155f){_0xe8b469=_0xa0155f;_0x2e191e=0xc8;}else{_0x2e191e=0xce;}_0x565f95['status'](_0x2e191e);return _0x565f95[_0x5d74('0x27')](_0x5d74('0x28'),_0x79a54d+'-'+_0xe8b469+'/'+_0xa0155f)[_0x5d74('0x22')](_0x2c7368);}return null;};}function patchUpdates(_0x303952){return function(_0x578e99){try{jsonpatch[_0x5d74('0x29')](_0x578e99,_0x303952,!![]);}catch(_0x41cc5c){return BPromise[_0x5d74('0x2a')](_0x41cc5c);}return _0x578e99[_0x5d74('0x2b')]();};}function saveUpdates(_0x2e5870,_0x5f36de){return function(_0x7ef8ff){if(_0x7ef8ff){return _0x7ef8ff[_0x5d74('0x2c')](_0x2e5870)[_0x5d74('0x2d')](function(_0x20d2da){return _0x20d2da;});}return null;};}function handleEntityNotFound(_0x558bbb,_0x3321dd){return function(_0x3a9cea){if(!_0x3a9cea){_0x558bbb[_0x5d74('0x1f')](0x194);}return _0x3a9cea;};}function handleError(_0xa58a0d,_0x36a2c3){_0x36a2c3=_0x36a2c3||0x1f4;return function(_0x71ce14){logger[_0x5d74('0x2e')](_0x71ce14[_0x5d74('0x2f')]);if(_0x71ce14[_0x5d74('0x30')]){delete _0x71ce14[_0x5d74('0x30')];}_0xa58a0d[_0x5d74('0x20')](_0x36a2c3)[_0x5d74('0x31')](_0x71ce14);};}exports[_0x5d74('0x32')]=function(_0x3caa77,_0x3423c8){var _0xf54a0b={},_0x595d29={},_0x1ce22b={'count':0x0,'rows':[]};var _0x4139e3=_[_0x5d74('0x33')](db[_0x5d74('0x34')]['rawAttributes'],function(_0x94f4ac){return{'name':_0x94f4ac[_0x5d74('0x35')],'type':_0x94f4ac[_0x5d74('0x36')][_0x5d74('0x37')]};});_0x595d29[_0x5d74('0x38')]=_[_0x5d74('0x33')](_0x4139e3,_0x5d74('0x30'));_0x595d29[_0x5d74('0x39')]=_[_0x5d74('0x3a')](_0x3caa77[_0x5d74('0x39')]);_0x595d29['filters']=_[_0x5d74('0x3b')](_0x595d29[_0x5d74('0x38')],_0x595d29[_0x5d74('0x39')]);_0xf54a0b[_0x5d74('0x3c')]=_['intersection'](_0x595d29[_0x5d74('0x38')],qs[_0x5d74('0x3d')](_0x3caa77['query'][_0x5d74('0x3d')]));_0xf54a0b[_0x5d74('0x3c')]=_0xf54a0b[_0x5d74('0x3c')][_0x5d74('0x3e')]?_0xf54a0b[_0x5d74('0x3c')]:_0x595d29[_0x5d74('0x38')];if(!_0x3caa77[_0x5d74('0x39')][_0x5d74('0x3f')](_0x5d74('0x40'))){_0xf54a0b[_0x5d74('0x24')]=qs[_0x5d74('0x24')](_0x3caa77['query'][_0x5d74('0x24')]);_0xf54a0b['offset']=qs[_0x5d74('0x26')](_0x3caa77[_0x5d74('0x39')][_0x5d74('0x26')]);}_0xf54a0b[_0x5d74('0x41')]=qs[_0x5d74('0x42')](_0x3caa77[_0x5d74('0x39')][_0x5d74('0x42')]);_0xf54a0b[_0x5d74('0x43')]=qs[_0x5d74('0x44')](_['pick'](_0x3caa77[_0x5d74('0x39')],_0x595d29[_0x5d74('0x44')]),_0x4139e3);if(_0x3caa77[_0x5d74('0x39')][_0x5d74('0x45')]){_0xf54a0b[_0x5d74('0x43')]=_[_0x5d74('0x46')](_0xf54a0b[_0x5d74('0x43')],{'$or':_[_0x5d74('0x33')](_0x4139e3,function(_0x5606f6){if(_0x5606f6['type']!==_0x5d74('0x47')){var _0xe8625f={};_0xe8625f[_0x5606f6[_0x5d74('0x30')]]={'$like':'%'+_0x3caa77[_0x5d74('0x39')]['filter']+'%'};return _0xe8625f;}})});}_0xf54a0b=_[_0x5d74('0x46')]({},_0xf54a0b,_0x3caa77[_0x5d74('0x48')]);var _0x110cc4={'where':_0xf54a0b[_0x5d74('0x43')]};return db[_0x5d74('0x34')][_0x5d74('0x25')](_0x110cc4)[_0x5d74('0x2d')](function(_0x482098){_0x1ce22b[_0x5d74('0x25')]=_0x482098;if(_0x3caa77[_0x5d74('0x39')][_0x5d74('0x49')]){_0xf54a0b['include']=[{'all':!![]}];}return db[_0x5d74('0x34')]['findAll'](_0xf54a0b);})[_0x5d74('0x2d')](function(_0x48a59e){_0x1ce22b[_0x5d74('0x4a')]=_0x48a59e;return _0x1ce22b;})['then'](respondWithFilteredResult(_0x3423c8,_0xf54a0b))[_0x5d74('0x4b')](handleError(_0x3423c8,null));};exports[_0x5d74('0x4c')]=function(_0xca80e0,_0x5e6933){var _0x40adde={'raw':![],'where':{'id':_0xca80e0[_0x5d74('0x4d')]['id']}},_0x286f98={};_0x286f98[_0x5d74('0x38')]=_[_0x5d74('0x3a')](db[_0x5d74('0x34')][_0x5d74('0x4e')]);_0x286f98[_0x5d74('0x39')]=_[_0x5d74('0x3a')](_0xca80e0['query']);_0x286f98[_0x5d74('0x44')]=_[_0x5d74('0x3b')](_0x286f98[_0x5d74('0x38')],_0x286f98[_0x5d74('0x39')]);_0x40adde[_0x5d74('0x3c')]=_['intersection'](_0x286f98[_0x5d74('0x38')],qs[_0x5d74('0x3d')](_0xca80e0[_0x5d74('0x39')][_0x5d74('0x3d')]));_0x40adde[_0x5d74('0x3c')]=_0x40adde[_0x5d74('0x3c')][_0x5d74('0x3e')]?_0x40adde[_0x5d74('0x3c')]:_0x286f98['model'];if(_0xca80e0[_0x5d74('0x39')][_0x5d74('0x49')]){_0x40adde['include']=[{'all':!![]}];}_0x40adde=_[_0x5d74('0x46')]({},_0x40adde,_0xca80e0[_0x5d74('0x48')]);return db[_0x5d74('0x34')][_0x5d74('0x4f')](_0x40adde)[_0x5d74('0x2d')](handleEntityNotFound(_0x5e6933,null))[_0x5d74('0x2d')](respondWithResult(_0x5e6933,null))[_0x5d74('0x4b')](handleError(_0x5e6933,null));};exports[_0x5d74('0x50')]=function(_0x324434,_0xe3bb43){return db[_0x5d74('0x34')]['create'](_0x324434[_0x5d74('0x51')],{})[_0x5d74('0x2d')](function(_0x3737cc){var _0x4d1e5e=_0x324434[_0x5d74('0x52')][_0x5d74('0x53')]({'plain':!![]});if(!_0x4d1e5e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d1e5e[_0x5d74('0x54')]===_0x5d74('0x52')){var _0x2daa39=_0x3737cc[_0x5d74('0x53')]({'plain':!![]});var _0x2d205a=_0x5d74('0x55');return db[_0x5d74('0x56')]['find']({'where':{'name':_0x2d205a,'userProfileId':_0x4d1e5e['userProfileId']},'raw':!![]})[_0x5d74('0x2d')](function(_0x1d42b2){if(_0x1d42b2&&_0x1d42b2[_0x5d74('0x57')]===0x0){return db[_0x5d74('0x58')][_0x5d74('0x50')]({'name':_0x2daa39[_0x5d74('0x30')],'resourceId':_0x2daa39['id'],'type':_0x1d42b2[_0x5d74('0x30')],'sectionId':_0x1d42b2['id']},{})['then'](function(){return _0x3737cc;});}else{return _0x3737cc;}})[_0x5d74('0x4b')](function(_0x4429c9){logger[_0x5d74('0x2e')](_0x5d74('0x59'),_0x4429c9);throw _0x4429c9;});}return _0x3737cc;})[_0x5d74('0x2d')](respondWithResult(_0xe3bb43,0xc9))[_0x5d74('0x4b')](handleError(_0xe3bb43,null));};exports[_0x5d74('0x2c')]=function(_0x1546cf,_0x280b9e){if(_0x1546cf[_0x5d74('0x51')]['id']){delete _0x1546cf['body']['id'];}return db[_0x5d74('0x34')][_0x5d74('0x4f')]({'where':{'id':_0x1546cf[_0x5d74('0x4d')]['id']}})[_0x5d74('0x2d')](handleEntityNotFound(_0x280b9e,null))[_0x5d74('0x2d')](saveUpdates(_0x1546cf[_0x5d74('0x51')],null))[_0x5d74('0x2d')](respondWithResult(_0x280b9e,null))[_0x5d74('0x4b')](handleError(_0x280b9e,null));};exports['destroy']=function(_0x1d9b88,_0x310151){var _0x8a7f72=_0x1d9b88[_0x5d74('0x4d')]['id'];var _0x131d1a=[];return db['sequelize'][_0x5d74('0x5a')](function(_0x4f6087){var _0x399a3c=_0x5d74('0x5b')+_0x8a7f72;return db[_0x5d74('0x5c')][_0x5d74('0x39')](_0x399a3c,{'type':db[_0x5d74('0x5d')]['QueryTypes'][_0x5d74('0x5e')],'raw':!![],'transaction':_0x4f6087})['then'](function(_0x598de1){_0x131d1a=_['map'](_0x598de1,function(_0x12662b){return Number(_0x12662b[_0x5d74('0x5f')]);});})[_0x5d74('0x2d')](function(){var _0x5602d3=_0x5d74('0x60')+_0x8a7f72;return db[_0x5d74('0x5c')][_0x5d74('0x39')](_0x5602d3,{'type':db['Sequelize'][_0x5d74('0x61')][_0x5d74('0x5e')],'raw':!![],'transaction':_0x4f6087});})[_0x5d74('0x2d')](function(_0x174b58){var _0x7a227e=_[_0x5d74('0x33')](_0x174b58,function(_0x5cef2e){return Number(_0x5cef2e[_0x5d74('0x62')]);});return db[_0x5d74('0x63')][_0x5d74('0x64')]({'where':{'UserId':{'$in':_0x131d1a},'VoiceQueueId':{'$in':_0x7a227e}},'transaction':_0x4f6087});})[_0x5d74('0x2d')](function(){var _0x443a85=_0x5d74('0x65')+_0x8a7f72;return db['sequelize']['query'](_0x443a85,{'type':db[_0x5d74('0x5d')][_0x5d74('0x61')]['SELECT'],'raw':!![],'transaction':_0x4f6087});})[_0x5d74('0x2d')](function(_0x55377f){var _0x7ec1d1=_[_0x5d74('0x33')](_0x55377f,function(_0x47c27f){return Number(_0x47c27f[_0x5d74('0x66')]);});return db['UserMailQueue'][_0x5d74('0x64')]({'where':{'UserId':{'$in':_0x131d1a},'MailQueueId':{'$in':_0x7ec1d1}},'transaction':_0x4f6087});})[_0x5d74('0x2d')](function(){var _0x2966ff=_0x5d74('0x67')+_0x8a7f72;return db[_0x5d74('0x5c')][_0x5d74('0x39')](_0x2966ff,{'type':db[_0x5d74('0x5d')][_0x5d74('0x61')][_0x5d74('0x5e')],'raw':!![],'transaction':_0x4f6087});})[_0x5d74('0x2d')](function(_0x1633f7){var _0x511886=_[_0x5d74('0x33')](_0x1633f7,function(_0x21b2b8){return Number(_0x21b2b8[_0x5d74('0x68')]);});return db[_0x5d74('0x69')]['destroy']({'where':{'UserId':{'$in':_0x131d1a},'SmsQueueId':{'$in':_0x511886}},'transaction':_0x4f6087});})[_0x5d74('0x2d')](function(){var _0x2ca294=_0x5d74('0x6a')+_0x8a7f72;return db[_0x5d74('0x5c')]['query'](_0x2ca294,{'type':db[_0x5d74('0x5d')][_0x5d74('0x61')][_0x5d74('0x5e')],'raw':!![],'transaction':_0x4f6087});})[_0x5d74('0x2d')](function(_0x37b8e5){var _0x2ed33b=_[_0x5d74('0x33')](_0x37b8e5,function(_0x29b8b5){return Number(_0x29b8b5[_0x5d74('0x6b')]);});return db[_0x5d74('0x6c')]['destroy']({'where':{'UserId':{'$in':_0x131d1a},'ChatQueueId':{'$in':_0x2ed33b}},'transaction':_0x4f6087});})[_0x5d74('0x2d')](function(){var _0x17bee0=_0x5d74('0x6d')+_0x8a7f72;return db[_0x5d74('0x5c')][_0x5d74('0x39')](_0x17bee0,{'type':db[_0x5d74('0x5d')][_0x5d74('0x61')][_0x5d74('0x5e')],'raw':!![],'transaction':_0x4f6087});})['then'](function(_0x5abaaf){var _0x1ac700=_[_0x5d74('0x33')](_0x5abaaf,function(_0x13a56e){return Number(_0x13a56e[_0x5d74('0x6e')]);});return db[_0x5d74('0x6f')][_0x5d74('0x64')]({'where':{'UserId':{'$in':_0x131d1a},'FaxQueueId':{'$in':_0x1ac700}},'transaction':_0x4f6087});})[_0x5d74('0x2d')](function(){var _0x3cf97d='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x8a7f72;return db[_0x5d74('0x5c')][_0x5d74('0x39')](_0x3cf97d,{'type':db[_0x5d74('0x5d')][_0x5d74('0x61')][_0x5d74('0x5e')],'raw':!![],'transaction':_0x4f6087});})['then'](function(_0x4e3258){var _0x42eaee=_[_0x5d74('0x33')](_0x4e3258,function(_0x4a01dc){return Number(_0x4a01dc[_0x5d74('0x70')]);});return db[_0x5d74('0x71')]['destroy']({'where':{'UserId':{'$in':_0x131d1a},'OpenchannelQueueId':{'$in':_0x42eaee}},'transaction':_0x4f6087});})['then'](function(){var _0x2b50f9=_0x5d74('0x72')+_0x8a7f72;return db[_0x5d74('0x5c')]['query'](_0x2b50f9,{'type':db[_0x5d74('0x5d')][_0x5d74('0x61')][_0x5d74('0x5e')],'raw':!![],'transaction':_0x4f6087});})[_0x5d74('0x2d')](function(_0x12f2bc){var _0x871557=_[_0x5d74('0x33')](_0x12f2bc,function(_0x19b5da){return Number(_0x19b5da[_0x5d74('0x73')]);});return db[_0x5d74('0x74')]['destroy']({'where':{'UserId':{'$in':_0x131d1a},'WhatsappQueueId':{'$in':_0x871557}},'transaction':_0x4f6087});})['then'](function(){return db['TeamVoicePrefix'][_0x5d74('0x4f')]({'where':{'TeamId':_0x8a7f72}});})[_0x5d74('0x2d')](function(_0x2ac18d){if(_0x2ac18d===null){return;}return db[_0x5d74('0x75')][_0x5d74('0x64')]({'where':{'UserId':{'$in':_0x131d1a},'VoicePrefixId':_0x2ac18d['VoicePrefixId']},'transaction':_0x4f6087});})[_0x5d74('0x2d')](function(){return db[_0x5d74('0x34')][_0x5d74('0x64')]({'where':{'id':_0x8a7f72},'cascade':!![],'transaction':_0x4f6087});})[_0x5d74('0x2d')](function(_0x1b9380){if(_0x1b9380===0x0){_0x310151[_0x5d74('0x1f')](0x194);}else{return db[_0x5d74('0x58')][_0x5d74('0x64')]({'where':{'type':_0x5d74('0x55'),'resourceId':_0x8a7f72},'cascade':!![],'transaction':_0x4f6087})['then'](function(){_0x310151['status'](0xcc)[_0x5d74('0x21')]();});}})['catch'](function(_0x29780f){_0x310151[_0x5d74('0x20')](0x1f4)['send'](_0x29780f);});});};exports[_0x5d74('0x76')]=function(_0x479d36,_0x196095,_0x5355cf){return db[_0x5d74('0x34')]['findOne']({'where':{'id':_0x479d36[_0x5d74('0x4d')]['id']}})['then'](handleEntityNotFound(_0x196095,null))['then'](function(_0x25a901){if(!_0x479d36[_0x5d74('0x39')][_0x5d74('0x77')]||!utils[_0x5d74('0x78')](_0x479d36['query']['channel'])){throw new db['Sequelize'][(_0x5d74('0x79'))](_0x5d74('0x7a'));}var _0xf5d05d={};var _0x5dffd3={};_0x5dffd3[_0x5d74('0x38')]=_[_0x5d74('0x3a')](db[_[_0x5d74('0x7b')](_0x479d36['query'][_0x5d74('0x77')][_0x5d74('0x7c')]())+_0x5d74('0x7d')][_0x5d74('0x4e')]);_0x5dffd3[_0x5d74('0x39')]=_[_0x5d74('0x3a')](_0x479d36[_0x5d74('0x39')]);_0x5dffd3[_0x5d74('0x44')]=_[_0x5d74('0x3b')](_0x5dffd3[_0x5d74('0x38')],_0x5dffd3[_0x5d74('0x39')]);_0xf5d05d[_0x5d74('0x3c')]=_[_0x5d74('0x3b')](_0x5dffd3[_0x5d74('0x38')],qs[_0x5d74('0x3d')](_0x479d36['query'][_0x5d74('0x3d')]));_0xf5d05d['attributes']=_0xf5d05d[_0x5d74('0x3c')][_0x5d74('0x3e')]?_0xf5d05d[_0x5d74('0x3c')]:_0x5dffd3[_0x5d74('0x38')];_0xf5d05d[_0x5d74('0x24')]=qs[_0x5d74('0x24')](_0x479d36[_0x5d74('0x39')]['limit']);_0xf5d05d['offset']=qs['offset'](_0x479d36[_0x5d74('0x39')][_0x5d74('0x26')]);_0xf5d05d[_0x5d74('0x41')]=qs[_0x5d74('0x42')](_0x479d36[_0x5d74('0x39')][_0x5d74('0x42')]);_0xf5d05d['where']=qs[_0x5d74('0x44')](_[_0x5d74('0x7e')](_0x479d36[_0x5d74('0x39')],_0x5dffd3[_0x5d74('0x44')]));_0xf5d05d=_[_0x5d74('0x46')]({},_0xf5d05d,_0x479d36[_0x5d74('0x48')]);return _0x25a901[_0x5d74('0x53')+_[_0x5d74('0x7b')](_0x479d36[_0x5d74('0x39')]['channel'][_0x5d74('0x7c')]())+'Queues'](_0xf5d05d);})[_0x5d74('0x2d')](respondWithResult(_0x196095,null))[_0x5d74('0x4b')](handleError(_0x196095,null));};exports['addQueues']=function(_0x3b0519,_0x3f2735,_0x5f4a67){return db[_0x5d74('0x34')][_0x5d74('0x7f')]({'where':{'id':_0x3b0519[_0x5d74('0x4d')]['id']}})[_0x5d74('0x2d')](function(_0x5c0110){if(_0x5c0110){if(!_0x3b0519['body']['channel']||!utils[_0x5d74('0x78')](_0x3b0519['body'][_0x5d74('0x77')])){throw new db[(_0x5d74('0x5d'))][(_0x5d74('0x79'))](_0x5d74('0x7a'));}return _0x5c0110[_0x5d74('0x80')+_[_0x5d74('0x7b')](_0x3b0519[_0x5d74('0x51')]['channel'][_0x5d74('0x7c')]())+_0x5d74('0x81')](_0x3b0519[_0x5d74('0x51')][_0x5d74('0x82')]);}return null;})[_0x5d74('0x2d')](handleEntityNotFound(_0x3f2735,null))[_0x5d74('0x2d')](respondWithStatusCode(_0x3f2735,null))[_0x5d74('0x4b')](handleError(_0x3f2735,null));};exports[_0x5d74('0x83')]=function(_0x1fe461,_0x2441fd,_0x3c403a){return db['Team'][_0x5d74('0x7f')]({'where':{'id':_0x1fe461[_0x5d74('0x4d')]['id']}})[_0x5d74('0x2d')](function(_0x1e1946){if(_0x1e1946){if(!_0x1fe461[_0x5d74('0x39')][_0x5d74('0x77')]||!utils[_0x5d74('0x78')](_0x1fe461['query'][_0x5d74('0x77')])){throw new db[(_0x5d74('0x5d'))]['ValidationError'](_0x5d74('0x7a'));}return _0x1e1946[_0x5d74('0x84')+_[_0x5d74('0x7b')](_0x1fe461[_0x5d74('0x39')][_0x5d74('0x77')][_0x5d74('0x7c')]())+_0x5d74('0x81')](_0x1fe461[_0x5d74('0x39')]['ids']);}return null;})[_0x5d74('0x2d')](handleEntityNotFound(_0x2441fd,null))['then'](respondWithStatusCode(_0x2441fd,null))['catch'](handleError(_0x2441fd,null));};exports[_0x5d74('0x85')]=function(_0x14a4c1,_0x25325d){var _0x325b59=_[_0x5d74('0x86')](_0x14a4c1[_0x5d74('0x51')][_0x5d74('0x82')])?_0x14a4c1['body'][_0x5d74('0x82')]:[_0x14a4c1[_0x5d74('0x51')]['ids']];var _0x5ec90f=_0x14a4c1[_0x5d74('0x4d')]['id'];return db[_0x5d74('0x34')][_0x5d74('0x4f')]({'where':{'id':_0x5ec90f}})[_0x5d74('0x2d')](handleEntityNotFound(_0x25325d,null))[_0x5d74('0x2d')](function(_0x78882b){if(_0x78882b){var _0x251189=['Voice',_0x5d74('0x87'),'Mail',_0x5d74('0x88'),'Fax',_0x5d74('0x89'),_0x5d74('0x8a')];return db[_0x5d74('0x5c')][_0x5d74('0x5a')](function(_0x436607){var _0x1c854d=_[_0x5d74('0x33')](_0x251189,function(_0x5e3ea0){var _0x3d0ad5={'attributes':['id',_0x5d74('0x30')]};if(_0x5e3ea0==='Voice'){_0x3d0ad5[_0x5d74('0x8b')]={'attributes':['penalty']};}return _0x78882b[_0x5d74('0x53')+_0x5e3ea0+_0x5d74('0x81')](_0x3d0ad5)['then'](function(_0x30a22d){var _0x21d31f=_[_0x5d74('0x33')](_0x30a22d,function(_0x35bda0){var _0x418362=_[_0x5d74('0x33')](_0x325b59,function(_0x10f4cf){var _0x31cb96={'where':{'UserId':_0x10f4cf,[_0x5e3ea0+_0x5d74('0x8c')]:_0x35bda0['id']},'transaction':_0x436607};if(_0x5e3ea0===_0x5d74('0x8d')){_0x31cb96[_0x5d74('0x8e')]={'penalty':_0x35bda0[_0x5d74('0x8f')][_0x5d74('0x90')]};}return db['User'+_0x5e3ea0+_0x5d74('0x7d')][_0x5d74('0x91')](_0x31cb96)[_0x5d74('0x2d')](function(){socket['emit'](_0x5d74('0x52')+_0x5e3ea0+_0x5d74('0x92'),{'UserId':_0x10f4cf,[_0x5e3ea0+_0x5d74('0x8c')]:_0x35bda0['id']});if(_0x5e3ea0!=='Voice'){return;}return db[_0x5d74('0x93')][_0x5d74('0x94')]({'where':{'id':_0x325b59,'online':0x1},'attributes':['id','name',_0x5d74('0x95'),_0x5d74('0x96'),_0x5d74('0x97')],'raw':!![]})[_0x5d74('0x2d')](function(_0x3cc0b5){var _0xdcd1b2=_[_0x5d74('0x33')](_0x3cc0b5,function(_0x369393){return db['UserVoiceQueueRt']['upsert']({'membername':_0x369393['name'],'UserId':_0x369393['id'],'queue_name':_0x35bda0[_0x5d74('0x30')],'VoiceQueueId':_0x35bda0['id'],'interface':_['isNil'](_0x369393[_0x5d74('0x97')])?util[_0x5d74('0x98')]('SIP/%s',_0x369393[_0x5d74('0x30')]):_0x369393[_0x5d74('0x97')],'paused':_0x369393[_0x5d74('0x96')]||![],'penalty':_0x35bda0[_0x5d74('0x8f')][_0x5d74('0x90')]},{'transaction':_0x436607});});return Promise['all'](_0xdcd1b2);});});});return Promise[_0x5d74('0x99')](_0x418362);});return Promise[_0x5d74('0x99')](_0x21d31f);})[_0x5d74('0x2d')](function(){return db['TeamVoicePrefix'][_0x5d74('0x7f')]({'where':{'teamId':_0x5ec90f}})[_0x5d74('0x2d')](function(_0x1e0909){if(_0x1e0909){var _0x27e144=_[_0x5d74('0x33')](_0x325b59,function(_0x5a973f){db[_0x5d74('0x75')][_0x5d74('0x9a')]({'UserId':_0x5a973f,'VoicePrefixId':_0x1e0909[_0x5d74('0x9b')]});});return Promise[_0x5d74('0x99')](_0x27e144);}});});});return Promise[_0x5d74('0x99')](_0x1c854d)[_0x5d74('0x2d')](function(){return _0x78882b[_0x5d74('0x85')](_0x325b59,{'transaction':_0x436607})[_0x5d74('0x9c')](function(_0x2303a3){return _0x2303a3;});});});}})[_0x5d74('0x2d')](respondWithResult(_0x25325d,null))[_0x5d74('0x4b')](handleError(_0x25325d,null));};exports[_0x5d74('0x9d')]=function(_0x3d3c08,_0x323604){var _0x1c9374=_[_0x5d74('0x86')](_0x3d3c08[_0x5d74('0x39')][_0x5d74('0x82')])?_0x3d3c08[_0x5d74('0x39')][_0x5d74('0x82')]:[_0x3d3c08['query'][_0x5d74('0x82')]];var _0x887ad0=_0x3d3c08[_0x5d74('0x4d')]['id'];return db[_0x5d74('0x34')][_0x5d74('0x4f')]({'where':{'id':_0x887ad0}})[_0x5d74('0x2d')](handleEntityNotFound(_0x323604,null))[_0x5d74('0x2d')](function(_0xe6582c){if(_0xe6582c){var _0x573c43=[_0x5d74('0x8d'),'Chat',_0x5d74('0x9e'),'Sms','Fax',_0x5d74('0x89'),_0x5d74('0x8a')];return db[_0x5d74('0x5c')][_0x5d74('0x5a')](function(_0x225d02){var _0x250d94=_[_0x5d74('0x33')](_0x573c43,function(_0x389623){var _0x21fda3={'attributes':['id','name']};return _0xe6582c[_0x5d74('0x53')+_0x389623+_0x5d74('0x81')](_0x21fda3)[_0x5d74('0x2d')](function(_0x35306d){var _0x27fa9c=_[_0x5d74('0x33')](_0x35306d,function(_0x2e7208){return _0x2e7208[_0x5d74('0x9d')](_0x1c9374,{'transaction':_0x225d02})[_0x5d74('0x2d')](function(){var _0x39853f=_[_0x5d74('0x33')](_0x1c9374,function(_0x3b2a7a){socket['emit'](_0x5d74('0x52')+_0x389623+_0x5d74('0x9f'),{'UserId':Number(_0x3b2a7a),[_0x389623+_0x5d74('0x8c')]:_0x2e7208['id']});if(_0x389623!==_0x5d74('0x8d')){return;}return db[_0x5d74('0xa0')]['destroy']({'where':{'VoiceQueueId':_0x2e7208['id'],'UserId':_0x3b2a7a},'transaction':_0x225d02});});return Promise['all'](_0x39853f);});});return Promise[_0x5d74('0x99')](_0x27fa9c);});});return Promise[_0x5d74('0x99')](_0x250d94)['then'](function(){return _0xe6582c[_0x5d74('0x9d')](_0x1c9374,{'transaction':_0x225d02});})[_0x5d74('0x2d')](function(){return db['TeamVoicePrefix'][_0x5d74('0x7f')]({'where':{'teamId':_0x887ad0}})[_0x5d74('0x2d')](function(_0x3245e0){if(_0x3245e0){var _0xe2a89a=_[_0x5d74('0x33')](_0x1c9374,function(_0x3eb007){db['UserVoicePrefix'][_0x5d74('0x64')]({'where':{'UserId':_0x3eb007,'VoicePrefixId':_0x3245e0[_0x5d74('0x9b')]}});});return Promise[_0x5d74('0x99')](_0xe2a89a);}});});});}})[_0x5d74('0x2d')](respondWithStatusCode(_0x323604,null))[_0x5d74('0x4b')](handleError(_0x323604,null));};exports['getAgents']=function(_0x5ac67d,_0x9b1a4d,_0x3ce30e){var _0xb3a0e6={};var _0xe051a={};var _0x1a58f7;var _0x2c847b;return db['Team'][_0x5d74('0x7f')]({'where':{'id':_0x5ac67d['params']['id']}})['then'](handleEntityNotFound(_0x9b1a4d,null))['then'](function(_0x5c8023){if(_0x5c8023){_0x1a58f7=_0x5c8023;_0xe051a[_0x5d74('0x38')]=_[_0x5d74('0x3a')](db[_0x5d74('0x93')][_0x5d74('0x4e')]);_0xe051a[_0x5d74('0x39')]=_[_0x5d74('0x3a')](_0x5ac67d[_0x5d74('0x39')]);_0xe051a[_0x5d74('0x44')]=_['intersection'](_0xe051a['model'],_0xe051a[_0x5d74('0x39')]);_0xb3a0e6[_0x5d74('0x3c')]=_[_0x5d74('0x3b')](_0xe051a['model'],qs[_0x5d74('0x3d')](_0x5ac67d[_0x5d74('0x39')]['fields']));_0xb3a0e6['attributes']=_0xb3a0e6[_0x5d74('0x3c')]['length']?_0xb3a0e6['attributes']:_0xe051a['model'];_0xb3a0e6['order']=qs['sort'](_0x5ac67d['query'][_0x5d74('0x42')]);_0xb3a0e6['where']=qs[_0x5d74('0x44')](_[_0x5d74('0x7e')](_0x5ac67d[_0x5d74('0x39')],_0xe051a[_0x5d74('0x44')]));if(_0x5ac67d[_0x5d74('0x39')]['filter']){_0xb3a0e6[_0x5d74('0x43')]=_[_0x5d74('0x46')](_0xb3a0e6[_0x5d74('0x43')],{'$or':_[_0x5d74('0x33')](_0xb3a0e6[_0x5d74('0x3c')],function(_0x2486ef){var _0x268d80={};_0x268d80[_0x2486ef]={'$like':'%'+_0x5ac67d['query'][_0x5d74('0x45')]+'%'};return _0x268d80;})});}_0xb3a0e6=_[_0x5d74('0x46')]({},_0xb3a0e6,_0x5ac67d[_0x5d74('0x48')]);return _0x1a58f7['getAgents'](_0xb3a0e6);}})['then'](function(_0x1bb033){if(_0x1bb033){_0x2c847b=_0x1bb033[_0x5d74('0x3e')];if(!_0x5ac67d[_0x5d74('0x39')][_0x5d74('0x3f')]('nolimit')){_0xb3a0e6[_0x5d74('0x24')]=qs['limit'](_0x5ac67d['query'][_0x5d74('0x24')]);_0xb3a0e6[_0x5d74('0x26')]=qs[_0x5d74('0x26')](_0x5ac67d[_0x5d74('0x39')][_0x5d74('0x26')]);}return _0x1a58f7['getAgents'](_0xb3a0e6);}})[_0x5d74('0x2d')](function(_0x2cee12){if(_0x2cee12){return _0x2cee12?{'count':_0x2c847b,'rows':_0x2cee12}:null;}})[_0x5d74('0x2d')](respondWithResult(_0x9b1a4d,null))[_0x5d74('0x4b')](handleError(_0x9b1a4d,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index be6ecf2..7b1243f 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 _0x272b=['hasOwnProperty','hook','exports','events','Team','setMaxListeners','save','update','remove','emit'];(function(_0x32cf51,_0x2ff147){var _0x8b9a94=function(_0x30f8e0){while(--_0x30f8e0){_0x32cf51['push'](_0x32cf51['shift']());}};_0x8b9a94(++_0x2ff147);}(_0x272b,0x161));var _0xb272=function(_0x11ea64,_0x59f7a2){_0x11ea64=_0x11ea64-0x0;var _0x30590a=_0x272b[_0x11ea64];return _0x30590a;};'use strict';var EventEmitter=require(_0xb272('0x0'));var Team=require('../../mysqldb')['db'][_0xb272('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xb272('0x2')](0x0);var events={'afterCreate':_0xb272('0x3'),'afterUpdate':_0xb272('0x4'),'afterDestroy':_0xb272('0x5')};function emitEvent(_0x31ae52){return function(_0x59bc4d,_0x4b39eb,_0x356dd1){TeamEvents[_0xb272('0x6')](_0x31ae52+':'+_0x59bc4d['id'],_0x59bc4d);TeamEvents['emit'](_0x31ae52,_0x59bc4d);_0x356dd1(null);};}for(var e in events){if(events[_0xb272('0x7')](e)){var event=events[e];Team[_0xb272('0x8')](e,emitEvent(event));}}module[_0xb272('0x9')]=TeamEvents; \ No newline at end of file +var _0xca2b=['exports','events','../../mysqldb','Team','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0xe315f6,_0x54dcf8){var _0xa23159=function(_0x7fe772){while(--_0x7fe772){_0xe315f6['push'](_0xe315f6['shift']());}};_0xa23159(++_0x54dcf8);}(_0xca2b,0xa6));var _0xbca2=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xca2b[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require(_0xbca2('0x0'));var Team=require(_0xbca2('0x1'))['db'][_0xbca2('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xbca2('0x3')](0x0);var events={'afterCreate':_0xbca2('0x4'),'afterUpdate':_0xbca2('0x5'),'afterDestroy':_0xbca2('0x6')};function emitEvent(_0x65a247){return function(_0x4161f5,_0x10d8cc,_0x232ee4){TeamEvents['emit'](_0x65a247+':'+_0x4161f5['id'],_0x4161f5);TeamEvents[_0xbca2('0x7')](_0x65a247,_0x4161f5);_0x232ee4(null);};}for(var e in events){if(events[_0xbca2('0x8')](e)){var event=events[e];Team[_0xbca2('0x9')](e,emitEvent(event));}}module[_0xbca2('0xa')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 2080f6a..37f6a45 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 _0x4828=['teams','Chat','Fax','Mail','Voice','Whatsapp','resolve','all','lodash','then','map','setDataValue','channel','define'];(function(_0x4af8c2,_0x571991){var _0x13537d=function(_0x271c75){while(--_0x271c75){_0x4af8c2['push'](_0x4af8c2['shift']());}};_0x13537d(++_0x571991);}(_0x4828,0x112));var _0x8482=function(_0x50f94e,_0x452ebe){_0x50f94e=_0x50f94e-0x0;var _0x46973e=_0x4828[_0x50f94e];return _0x46973e;};'use strict';var _=require(_0x8482('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x6f20bf,_0x5bf107){var _0x66f763='get'+_0x5bf107+'Queues';return _0x6f20bf[_0x66f763]()[_0x8482('0x1')](function(_0xfe458){return _[_0x8482('0x2')](_0xfe458,function(_0x58d2f4){_0x58d2f4[_0x8482('0x3')](_0x8482('0x4'),_0x5bf107);return _0x58d2f4;});})['catch'](function(_0x274ea6){throw _0x274ea6;});}module['exports']=function(_0x3f4034){return _0x3f4034[_0x8482('0x5')]('Team',attributes,{'tableName':_0x8482('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x5e8ecb=this;var _0x2b7f68=[_0x8482('0x7'),_0x8482('0x8'),_0x8482('0x9'),'Openchannel','Sms',_0x8482('0xa'),_0x8482('0xb')];return Promise[_0x8482('0xc')]()[_0x8482('0x1')](function(){var _0x1e98c8=_[_0x8482('0x2')](_0x2b7f68,function(_0x500642){return getQueuesByChannel(_0x5e8ecb,_0x500642);});return Promise[_0x8482('0xd')](_0x1e98c8);})['catch'](function(_0x57e5c1){throw _0x57e5c1;});}}});}; \ No newline at end of file +var _0xc9e5=['then','all','lodash','./team.attributes','Queues','map','setDataValue','channel','catch','exports','define','Team','teams','Chat','Fax','Openchannel','Sms','Voice','resolve'];(function(_0x2db660,_0x491baf){var _0x57f6b6=function(_0x2964fa){while(--_0x2964fa){_0x2db660['push'](_0x2db660['shift']());}};_0x57f6b6(++_0x491baf);}(_0xc9e5,0x74));var _0x5c9e=function(_0x3ce948,_0x5bd01e){_0x3ce948=_0x3ce948-0x0;var _0x696346=_0xc9e5[_0x3ce948];return _0x696346;};'use strict';var _=require(_0x5c9e('0x0'));var attributes=require(_0x5c9e('0x1'));function getQueuesByChannel(_0x4c567b,_0x2e7312){var _0x560b17='get'+_0x2e7312+_0x5c9e('0x2');return _0x4c567b[_0x560b17]()['then'](function(_0x3782ff){return _[_0x5c9e('0x3')](_0x3782ff,function(_0x370105){_0x370105[_0x5c9e('0x4')](_0x5c9e('0x5'),_0x2e7312);return _0x370105;});})[_0x5c9e('0x6')](function(_0x5823f9){throw _0x5823f9;});}module[_0x5c9e('0x7')]=function(_0x2c70ab){return _0x2c70ab[_0x5c9e('0x8')](_0x5c9e('0x9'),attributes,{'tableName':_0x5c9e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x40bc79=this;var _0x545691=[_0x5c9e('0xb'),_0x5c9e('0xc'),'Mail',_0x5c9e('0xd'),_0x5c9e('0xe'),_0x5c9e('0xf'),'Whatsapp'];return Promise[_0x5c9e('0x10')]()[_0x5c9e('0x11')](function(){var _0x173bc7=_[_0x5c9e('0x3')](_0x545691,function(_0x3507a4){return getQueuesByChannel(_0x40bc79,_0x3507a4);});return Promise[_0x5c9e('0x12')](_0x173bc7);})[_0x5c9e('0x6')](function(_0x4de411){throw _0x4de411;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 2899726..041dd93 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 _0x747c=['client','redis','socket.io-emitter','./team.socket','request','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x2fbea3,_0x55209f){var _0x1b279e=function(_0x22399e){while(--_0x22399e){_0x2fbea3['push'](_0x2fbea3['shift']());}};_0x1b279e(++_0x55209f);}(_0x747c,0x10b));var _0xc747=function(_0x1b6e11,_0x182d00){_0x1b6e11=_0x1b6e11-0x0;var _0x594ac6=_0x747c[_0x1b6e11];return _0x594ac6;};'use strict';var _=require(_0xc747('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc747('0x1'));var db=require(_0xc747('0x2'))['db'];var utils=require(_0xc747('0x3'));var logger=require(_0xc747('0x4'))('rpc');var config=require(_0xc747('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xc747('0x6')]['http']({'port':0x232a});config[_0xc747('0x7')]=_['defaults'](config[_0xc747('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xc747('0x8'))(new Redis(config[_0xc747('0x7')]));require(_0xc747('0x9'))['register'](socket);function respondWithRpcPromise(_0x2abae6,_0x450d0b,_0x392093){return new BPromise(function(_0x83b072,_0x4c06ee){return client[_0xc747('0xa')](_0x2abae6,_0x392093)[_0xc747('0xb')](function(_0x4311b5){logger[_0xc747('0xc')](_0xc747('0xd'),_0x450d0b,_0xc747('0xe'));logger['debug'](_0xc747('0xf'),_0x450d0b,_0xc747('0xe'),JSON[_0xc747('0x10')](_0x4311b5));if(_0x4311b5[_0xc747('0x11')]){if(_0x4311b5[_0xc747('0x11')][_0xc747('0x12')]===0x1f4){logger[_0xc747('0x11')]('Team,\x20%s,\x20%s',_0x450d0b,_0x4311b5['error'][_0xc747('0x13')]);return _0x4c06ee(_0x4311b5[_0xc747('0x11')][_0xc747('0x13')]);}logger[_0xc747('0x11')]('Team,\x20%s,\x20%s',_0x450d0b,_0x4311b5[_0xc747('0x11')][_0xc747('0x13')]);return _0x83b072(_0x4311b5[_0xc747('0x11')][_0xc747('0x13')]);}else{logger[_0xc747('0xc')](_0xc747('0xd'),_0x450d0b,'request\x20sent');_0x83b072(_0x4311b5[_0xc747('0x14')][_0xc747('0x13')]);}})['catch'](function(_0x36756f){logger[_0xc747('0x11')](_0xc747('0xd'),_0x450d0b,_0x36756f);_0x4c06ee(_0x36756f);});});} \ No newline at end of file +var _0x7827=['../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','Team,\x20%s,\x20%s','message','request\x20sent','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x256af2,_0x88f7be){var _0xe23860=function(_0x9634c){while(--_0x9634c){_0x256af2['push'](_0x256af2['shift']());}};_0xe23860(++_0x88f7be);}(_0x7827,0x164));var _0x7782=function(_0x22cb10,_0x20db4f){_0x22cb10=_0x22cb10-0x0;var _0x38a6f8=_0x7827[_0x22cb10];return _0x38a6f8;};'use strict';var _=require('lodash');var util=require(_0x7782('0x0'));var moment=require(_0x7782('0x1'));var BPromise=require(_0x7782('0x2'));var rs=require(_0x7782('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7782('0x4'))['db'];var utils=require(_0x7782('0x5'));var logger=require(_0x7782('0x6'))(_0x7782('0x7'));var config=require(_0x7782('0x8'));var jayson=require(_0x7782('0x9'));var client=jayson[_0x7782('0xa')]['http']({'port':0x232a});config[_0x7782('0xb')]=_[_0x7782('0xc')](config[_0x7782('0xb')],{'host':_0x7782('0xd'),'port':0x18eb});var socket=require(_0x7782('0xe'))(new Redis(config['redis']));require(_0x7782('0xf'))[_0x7782('0x10')](socket);function respondWithRpcPromise(_0x4e3626,_0x4b01eb,_0x566e34){return new BPromise(function(_0x52f18c,_0x43110){return client[_0x7782('0x11')](_0x4e3626,_0x566e34)[_0x7782('0x12')](function(_0x4ecdbc){logger[_0x7782('0x13')]('Team,\x20%s,\x20%s',_0x4b01eb,'request\x20sent');logger['debug'](_0x7782('0x14'),_0x4b01eb,'request\x20sent',JSON[_0x7782('0x15')](_0x4ecdbc));if(_0x4ecdbc['error']){if(_0x4ecdbc[_0x7782('0x16')][_0x7782('0x17')]===0x1f4){logger['error'](_0x7782('0x18'),_0x4b01eb,_0x4ecdbc[_0x7782('0x16')]['message']);return _0x43110(_0x4ecdbc[_0x7782('0x16')]['message']);}logger[_0x7782('0x16')](_0x7782('0x18'),_0x4b01eb,_0x4ecdbc[_0x7782('0x16')][_0x7782('0x19')]);return _0x52f18c(_0x4ecdbc[_0x7782('0x16')][_0x7782('0x19')]);}else{logger[_0x7782('0x13')](_0x7782('0x18'),_0x4b01eb,_0x7782('0x1a'));_0x52f18c(_0x4ecdbc['result'][_0x7782('0x19')]);}})[_0x7782('0x1b')](function(_0x59713f){logger[_0x7782('0x16')](_0x7782('0x18'),_0x4b01eb,_0x59713f);_0x43110(_0x59713f);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index d20b3d7..d8047a6 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 _0xfc4c=['remove','removeListener','length','team:','./team.events','save'];(function(_0x4706a6,_0x5a1c63){var _0x1bb705=function(_0x484ebb){while(--_0x484ebb){_0x4706a6['push'](_0x4706a6['shift']());}};_0x1bb705(++_0x5a1c63);}(_0xfc4c,0xca));var _0xcfc4=function(_0x5dae7a,_0xe5dbf3){_0x5dae7a=_0x5dae7a-0x0;var _0x348e11=_0xfc4c[_0x5dae7a];return _0x348e11;};'use strict';var TeamEvents=require(_0xcfc4('0x0'));var events=[_0xcfc4('0x1'),_0xcfc4('0x2'),'update'];function createListener(_0x29323d,_0xb8f67b){return function(_0x3a0bd9){_0xb8f67b['emit'](_0x29323d,_0x3a0bd9);};}function removeListener(_0x57bf8a,_0x436d9b){return function(){TeamEvents[_0xcfc4('0x3')](_0x57bf8a,_0x436d9b);};}exports['register']=function(_0x4a4db3){for(var _0x30b6d4=0x0,_0x53486d=events[_0xcfc4('0x4')];_0x30b6d4<_0x53486d;_0x30b6d4++){var _0x4578f4=events[_0x30b6d4];var _0x520566=createListener(_0xcfc4('0x5')+_0x4578f4,_0x4a4db3);TeamEvents['on'](_0x4578f4,_0x520566);}}; \ No newline at end of file +var _0x87ef=['remove','update','emit','removeListener','register','length','team:','./team.events'];(function(_0x11b9b2,_0x29feed){var _0x30674e=function(_0x710ff3){while(--_0x710ff3){_0x11b9b2['push'](_0x11b9b2['shift']());}};_0x30674e(++_0x29feed);}(_0x87ef,0x13f));var _0xf87e=function(_0x19f8ee,_0x3e08c2){_0x19f8ee=_0x19f8ee-0x0;var _0x3b68f2=_0x87ef[_0x19f8ee];return _0x3b68f2;};'use strict';var TeamEvents=require(_0xf87e('0x0'));var events=['save',_0xf87e('0x1'),_0xf87e('0x2')];function createListener(_0x26ab17,_0x447549){return function(_0x59878a){_0x447549[_0xf87e('0x3')](_0x26ab17,_0x59878a);};}function removeListener(_0xef0a07,_0x3dd3b8){return function(){TeamEvents[_0xf87e('0x4')](_0xef0a07,_0x3dd3b8);};}exports[_0xf87e('0x5')]=function(_0x5883d2){for(var _0x36b9ca=0x0,_0x1f5c60=events[_0xf87e('0x6')];_0x36b9ca<_0x1f5c60;_0x36b9ca++){var _0x3187ba=events[_0x36b9ca];var _0x10f39b=createListener(_0xf87e('0x7')+_0x3187ba,_0x5883d2);TeamEvents['on'](_0x3187ba,_0x10f39b);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 3642682..1e7bd18 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 _0x3fb7=['INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3fb7,0x187));var _0x73fb=function(_0x238ebc,_0x1119cc){_0x238ebc=_0x238ebc-0x0;var _0x55ecba=_0x3fb7[_0x238ebc];return _0x55ecba;};'use strict';var Sequelize=require(_0x73fb('0x0'));module[_0x73fb('0x1')]={'TeamId':{'type':Sequelize[_0x73fb('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x73fb('0x2')]}}; \ No newline at end of file +var _0xe14d=['exports','INTEGER','sequelize'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xe14d,0x1ee));var _0xde14=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xe14d[_0xa1e3e3];return _0xc980e9;};'use strict';var Sequelize=require(_0xde14('0x0'));module[_0xde14('0x1')]={'TeamId':{'type':Sequelize[_0xde14('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xde14('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index b19091e..c6db938 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 _0x1339=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','TeamVoicePrefix','team_has_voice_prefixes','../../config/logger','api'];(function(_0x974280,_0x43d935){var _0x2bcbb3=function(_0x11c7fa){while(--_0x11c7fa){_0x974280['push'](_0x974280['shift']());}};_0x2bcbb3(++_0x43d935);}(_0x1339,0x1ed));var _0x9133=function(_0x499404,_0x378956){_0x499404=_0x499404-0x0;var _0x1ffc2f=_0x1339[_0x499404];return _0x1ffc2f;};'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('./teamVoicePrefix.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 _0x6584=['util','../../config/logger','api','bluebird','request-promise','path','./teamVoicePrefix.attributes','exports','define','team_has_voice_prefixes','lodash'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6584,0x175));var _0x4658=function(_0x56740a,_0x568894){_0x56740a=_0x56740a-0x0;var _0x257144=_0x6584[_0x56740a];return _0x257144;};'use strict';var _=require(_0x4658('0x0'));var util=require(_0x4658('0x1'));var logger=require(_0x4658('0x2'))(_0x4658('0x3'));var moment=require('moment');var BPromise=require(_0x4658('0x4'));var rp=require(_0x4658('0x5'));var fs=require('fs');var path=require(_0x4658('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4658('0x7'));module[_0x4658('0x8')]=function(_0x253182,_0x63273f){return _0x253182[_0x4658('0x9')]('TeamVoicePrefix',attributes,{'tableName':_0x4658('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 30c2720..5caa63c 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x185d4c,_0x541480){var _0x413709=function(_0x828720){while(--_0x828720){_0x185d4c['push'](_0x185d4c['shift']());}};_0x413709(++_0x541480);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x57f95a,_0xb3598b){var _0x1eab3c=function(_0x33d204){while(--_0x33d204){_0x57f95a['push'](_0x57f95a['shift']());}};_0x1eab3c(++_0xb3598b);}(_0xe706,0xa3));var _0x6e70=function(_0x52dbcb,_0x344f7e){_0x52dbcb=_0x52dbcb-0x0;var _0x10bfe4=_0xe706[_0x52dbcb];return _0x10bfe4;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 40c48be..467dc2f 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 _0x6a8e=['exports'];(function(_0x343ec2,_0x4f4049){var _0x2af9eb=function(_0x426634){while(--_0x426634){_0x343ec2['push'](_0x343ec2['shift']());}};_0x2af9eb(++_0x4f4049);}(_0x6a8e,0xc4));var _0xe6a8=function(_0x396883,_0x5851ff){_0x396883=_0x396883-0x0;var _0x3b64d4=_0x6a8e[_0x396883];return _0x3b64d4;};'use strict';var Sequelize=require('sequelize');module[_0xe6a8('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xffaa=['exports'];(function(_0x445c59,_0x1e78c0){var _0x10a609=function(_0x424834){while(--_0x424834){_0x445c59['push'](_0x445c59['shift']());}};_0x10a609(++_0x1e78c0);}(_0xffaa,0x129));var _0xaffa=function(_0x145c57,_0x5bce3a){_0x145c57=_0x145c57-0x0;var _0x4933a1=_0xffaa[_0x145c57];return _0x4933a1;};'use strict';var Sequelize=require('sequelize');module[_0xaffa('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'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 002eeb3..03e2553 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 _0xe13e=['team_has_voice_queues','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue'];(function(_0x3fb980,_0x23e2da){var _0x2779cf=function(_0xee953c){while(--_0xee953c){_0x3fb980['push'](_0x3fb980['shift']());}};_0x2779cf(++_0x23e2da);}(_0xe13e,0xde));var _0xee13=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe13e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xee13('0x0'))(_0xee13('0x1'));var moment=require(_0xee13('0x2'));var BPromise=require(_0xee13('0x3'));var rp=require(_0xee13('0x4'));var fs=require('fs');var path=require(_0xee13('0x5'));var rimraf=require(_0xee13('0x6'));var config=require(_0xee13('0x7'));var attributes=require(_0xee13('0x8'));module[_0xee13('0x9')]=function(_0x43cfb0,_0x48e7b0){return _0x43cfb0[_0xee13('0xa')](_0xee13('0xb'),attributes,{'tableName':_0xee13('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe107=['define','TeamVoiceQueue','team_has_voice_queues','lodash','../../config/logger','api','moment','request-promise','../../config/environment','./teamVoiceQueue.attributes','exports'];(function(_0x445101,_0x2414bf){var _0x3c3d04=function(_0x249067){while(--_0x249067){_0x445101['push'](_0x445101['shift']());}};_0x3c3d04(++_0x2414bf);}(_0xe107,0xb3));var _0x7e10=function(_0xb61896,_0x55036b){_0xb61896=_0xb61896-0x0;var _0x171b63=_0xe107[_0xb61896];return _0x171b63;};'use strict';var _=require(_0x7e10('0x0'));var util=require('util');var logger=require(_0x7e10('0x1'))(_0x7e10('0x2'));var moment=require(_0x7e10('0x3'));var BPromise=require('bluebird');var rp=require(_0x7e10('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7e10('0x5'));var attributes=require(_0x7e10('0x6'));module[_0x7e10('0x7')]=function(_0x5be19f,_0x5f1edf){return _0x5be19f[_0x7e10('0x8')](_0x7e10('0x9'),attributes,{'tableName':_0x7e10('0xa'),'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 3b54c2a..ff8fe19 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 _0x7c5d=['debug','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s'];(function(_0x423540,_0xa699c){var _0x58c29f=function(_0x43a178){while(--_0x43a178){_0x423540['push'](_0x423540['shift']());}};_0x58c29f(++_0xa699c);}(_0x7c5d,0x1aa));var _0xd7c5=function(_0x9071f5,_0x3230d4){_0x9071f5=_0x9071f5-0x0;var _0x1d389d=_0x7c5d[_0x9071f5];return _0x1d389d;};'use strict';var _=require(_0xd7c5('0x0'));var util=require('util');var moment=require(_0xd7c5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd7c5('0x2'));var db=require(_0xd7c5('0x3'))['db'];var utils=require(_0xd7c5('0x4'));var logger=require(_0xd7c5('0x5'))(_0xd7c5('0x6'));var config=require('../../config/environment');var jayson=require(_0xd7c5('0x7'));var client=jayson[_0xd7c5('0x8')][_0xd7c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f1518,_0x523443,_0x1edac4){return new BPromise(function(_0x4362b8,_0x14ae74){return client[_0xd7c5('0xa')](_0x1f1518,_0x1edac4)[_0xd7c5('0xb')](function(_0x15ab5f){logger[_0xd7c5('0xc')](_0xd7c5('0xd'),_0x523443,'request\x20sent');logger[_0xd7c5('0xe')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x523443,_0xd7c5('0xf'),JSON[_0xd7c5('0x10')](_0x15ab5f));if(_0x15ab5f[_0xd7c5('0x11')]){if(_0x15ab5f[_0xd7c5('0x11')][_0xd7c5('0x12')]===0x1f4){logger[_0xd7c5('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x523443,_0x15ab5f[_0xd7c5('0x11')][_0xd7c5('0x13')]);return _0x14ae74(_0x15ab5f[_0xd7c5('0x11')][_0xd7c5('0x13')]);}logger['error'](_0xd7c5('0xd'),_0x523443,_0x15ab5f[_0xd7c5('0x11')]['message']);return _0x4362b8(_0x15ab5f[_0xd7c5('0x11')]['message']);}else{logger[_0xd7c5('0xc')](_0xd7c5('0xd'),_0x523443,_0xd7c5('0xf'));_0x4362b8(_0x15ab5f[_0xd7c5('0x14')][_0xd7c5('0x13')]);}})[_0xd7c5('0x15')](function(_0x299b67){logger[_0xd7c5('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x523443,_0x299b67);_0x14ae74(_0x299b67);});});} \ No newline at end of file +var _0xbb53=['http','then','info','request\x20sent','stringify','error','message','TeamVoiceQueue,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0xbb53,0x121));var _0x3bb5=function(_0x329ae3,_0x4af2b7){_0x329ae3=_0x329ae3-0x0;var _0x596eee=_0xbb53[_0x329ae3];return _0x596eee;};'use strict';var _=require(_0x3bb5('0x0'));var util=require(_0x3bb5('0x1'));var moment=require(_0x3bb5('0x2'));var BPromise=require(_0x3bb5('0x3'));var rs=require(_0x3bb5('0x4'));var fs=require('fs');var Redis=require(_0x3bb5('0x5'));var db=require(_0x3bb5('0x6'))['db'];var utils=require(_0x3bb5('0x7'));var logger=require(_0x3bb5('0x8'))(_0x3bb5('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3bb5('0xa')][_0x3bb5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28aa7d,_0x157e04,_0x22f92f){return new BPromise(function(_0x480f9c,_0x5a4ae3){return client['request'](_0x28aa7d,_0x22f92f)[_0x3bb5('0xc')](function(_0x2e0cfa){logger[_0x3bb5('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x157e04,_0x3bb5('0xe'));logger['debug']('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x157e04,_0x3bb5('0xe'),JSON[_0x3bb5('0xf')](_0x2e0cfa));if(_0x2e0cfa['error']){if(_0x2e0cfa[_0x3bb5('0x10')]['code']===0x1f4){logger[_0x3bb5('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x157e04,_0x2e0cfa['error'][_0x3bb5('0x11')]);return _0x5a4ae3(_0x2e0cfa[_0x3bb5('0x10')][_0x3bb5('0x11')]);}logger['error'](_0x3bb5('0x12'),_0x157e04,_0x2e0cfa[_0x3bb5('0x10')]['message']);return _0x480f9c(_0x2e0cfa[_0x3bb5('0x10')][_0x3bb5('0x11')]);}else{logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x157e04,'request\x20sent');_0x480f9c(_0x2e0cfa[_0x3bb5('0x13')][_0x3bb5('0x11')]);}})['catch'](function(_0x25d774){logger[_0x3bb5('0x10')](_0x3bb5('0x12'),_0x157e04,_0x25d774);_0x5a4ae3(_0x25d774);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 5524375..a03b3fe 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 _0x0137=['index','isAuthenticated','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get'];(function(_0x1a899a,_0x559faf){var _0x38e5e4=function(_0x4be0e0){while(--_0x4be0e0){_0x1a899a['push'](_0x1a899a['shift']());}};_0x38e5e4(++_0x559faf);}(_0x0137,0x1d8));var _0x7013=function(_0x5253c3,_0x3e4a0a){_0x5253c3=_0x5253c3-0x0;var _0x3c3917=_0x0137[_0x5253c3];return _0x3c3917;};'use strict';var multer=require(_0x7013('0x0'));var util=require(_0x7013('0x1'));var path=require(_0x7013('0x2'));var timeout=require(_0x7013('0x3'));var express=require(_0x7013('0x4'));var router=express['Router']();var fs_extra=require(_0x7013('0x5'));var auth=require(_0x7013('0x6'));var interaction=require(_0x7013('0x7'));var config=require(_0x7013('0x8'));var controller=require(_0x7013('0x9'));router[_0x7013('0xa')]('/',auth['isAuthenticated'](),controller[_0x7013('0xb')]);router[_0x7013('0xa')]('/:id',auth[_0x7013('0xc')](),controller[_0x7013('0xd')]);router[_0x7013('0xe')]('/',auth['isAuthenticated'](),controller[_0x7013('0xf')]);router[_0x7013('0x10')](_0x7013('0x11'),auth[_0x7013('0xc')](),controller['update']);router[_0x7013('0x12')](_0x7013('0x11'),auth[_0x7013('0xc')](),controller[_0x7013('0x13')]);module[_0x7013('0x14')]=router; \ No newline at end of file +var _0x5458=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x40d83,_0x1d2c94){var _0x38c64c=function(_0x2ce9c1){while(--_0x2ce9c1){_0x40d83['push'](_0x40d83['shift']());}};_0x38c64c(++_0x1d2c94);}(_0x5458,0x1c7));var _0x8545=function(_0x58528c,_0x132caf){_0x58528c=_0x58528c-0x0;var _0x350d0e=_0x5458[_0x58528c];return _0x350d0e;};'use strict';var multer=require(_0x8545('0x0'));var util=require(_0x8545('0x1'));var path=require(_0x8545('0x2'));var timeout=require('connect-timeout');var express=require(_0x8545('0x3'));var router=express[_0x8545('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8545('0x5'));var interaction=require(_0x8545('0x6'));var config=require(_0x8545('0x7'));var controller=require('./template.controller');router[_0x8545('0x8')]('/',auth[_0x8545('0x9')](),controller[_0x8545('0xa')]);router[_0x8545('0x8')]('/:id',auth[_0x8545('0x9')](),controller['show']);router[_0x8545('0xb')]('/',auth[_0x8545('0x9')](),controller[_0x8545('0xc')]);router[_0x8545('0xd')](_0x8545('0xe'),auth[_0x8545('0x9')](),controller[_0x8545('0xf')]);router[_0x8545('0x10')]('/:id',auth[_0x8545('0x9')](),controller[_0x8545('0x11')]);module[_0x8545('0x12')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 8c36c26..2f740c3 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 _0xeec6=['TEXT','sequelize','STRING'];(function(_0x36def7,_0x401864){var _0x57bc33=function(_0x4eefd0){while(--_0x4eefd0){_0x36def7['push'](_0x36def7['shift']());}};_0x57bc33(++_0x401864);}(_0xeec6,0xe5));var _0x6eec=function(_0x1ab758,_0x3dbede){_0x1ab758=_0x1ab758-0x0;var _0x5788a0=_0xeec6[_0x1ab758];return _0x5788a0;};'use strict';var Sequelize=require(_0x6eec('0x0'));module['exports']={'name':{'type':Sequelize[_0x6eec('0x1')]},'description':{'type':Sequelize[_0x6eec('0x1')]},'html':{'type':Sequelize[_0x6eec('0x2')]}}; \ No newline at end of file +var _0xe117=['STRING','TEXT','sequelize','exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xe117,0x12e));var _0x7e11=function(_0x2a9adc,_0x325136){_0x2a9adc=_0x2a9adc-0x0;var _0x3b51a7=_0xe117[_0x2a9adc];return _0x3b51a7;};'use strict';var Sequelize=require(_0x7e11('0x0'));module[_0x7e11('0x1')]={'name':{'type':Sequelize[_0x7e11('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x7e11('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 6e54010..80bf28b 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 _0x8398=['then','UserProfileResource','destroy','error','stack','name','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','show','length','options','find','create','body','get','role','user','Templates','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save'];(function(_0x2ccd5e,_0x3deb44){var _0x1a758e=function(_0x535991){while(--_0x535991){_0x2ccd5e['push'](_0x2ccd5e['shift']());}};_0x1a758e(++_0x3deb44);}(_0x8398,0x178));var _0x8839=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x8398[_0x263a74];return _0x2aa86c;};'use strict';var emlformat=require(_0x8839('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8839('0x1'));var jsonpatch=require(_0x8839('0x2'));var rp=require(_0x8839('0x3'));var moment=require(_0x8839('0x4'));var BPromise=require(_0x8839('0x5'));var Mustache=require(_0x8839('0x6'));var util=require(_0x8839('0x7'));var path=require(_0x8839('0x8'));var sox=require(_0x8839('0x9'));var csv=require(_0x8839('0xa'));var ejs=require(_0x8839('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8839('0xc'));var squel=require(_0x8839('0xd'));var crypto=require(_0x8839('0xe'));var jsforce=require(_0x8839('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8839('0xa'));var querystring=require(_0x8839('0x10'));var Papa=require(_0x8839('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8839('0x12'))(_0x8839('0x13'));var utils=require(_0x8839('0x14'));var config=require(_0x8839('0x15'));var licenseUtil=require(_0x8839('0x16'));var db=require(_0x8839('0x17'))['db'];function respondWithStatusCode(_0x3b3209,_0x267836){_0x267836=_0x267836||0xcc;return function(_0x2f2245){if(_0x2f2245){return _0x3b3209[_0x8839('0x18')](_0x267836);}return _0x3b3209[_0x8839('0x19')](_0x267836)[_0x8839('0x1a')]();};}function respondWithResult(_0x5872d1,_0x15be1){_0x15be1=_0x15be1||0xc8;return function(_0x2e0c30){if(_0x2e0c30){return _0x5872d1[_0x8839('0x19')](_0x15be1)[_0x8839('0x1b')](_0x2e0c30);}};}function respondWithFilteredResult(_0x229690,_0x14133c){return function(_0x30eb79){if(_0x30eb79){var _0x2dbf5e=typeof _0x14133c[_0x8839('0x1c')]==='undefined'&&typeof _0x14133c[_0x8839('0x1d')]==='undefined';var _0x1e52e9=_0x30eb79['count'];var _0x320238=_0x2dbf5e?0x0:_0x14133c[_0x8839('0x1c')];var _0x4dc31d=_0x2dbf5e?_0x30eb79['count']:_0x14133c[_0x8839('0x1c')]+_0x14133c[_0x8839('0x1d')];var _0xf0b979;if(_0x4dc31d>=_0x1e52e9){_0x4dc31d=_0x1e52e9;_0xf0b979=0xc8;}else{_0xf0b979=0xce;}_0x229690['status'](_0xf0b979);return _0x229690[_0x8839('0x1e')](_0x8839('0x1f'),_0x320238+'-'+_0x4dc31d+'/'+_0x1e52e9)[_0x8839('0x1b')](_0x30eb79);}return null;};}function patchUpdates(_0x118df8){return function(_0x20ae16){try{jsonpatch['apply'](_0x20ae16,_0x118df8,!![]);}catch(_0x45f751){return BPromise[_0x8839('0x20')](_0x45f751);}return _0x20ae16[_0x8839('0x21')]();};}function saveUpdates(_0x1a71ed,_0x845eff){return function(_0x1b09f0){if(_0x1b09f0){return _0x1b09f0['update'](_0x1a71ed)[_0x8839('0x22')](function(_0x199999){return _0x199999;});}return null;};}function removeEntity(_0xa19a11,_0x2227ac){return function(_0x4649bd){if(_0x4649bd){return _0x4649bd['destroy']()['then'](function(){var _0x2fa781=_0x4649bd['get']({'plain':!![]});var _0x584711='Templates';return db[_0x8839('0x23')][_0x8839('0x24')]({'where':{'type':_0x584711,'resourceId':_0x2fa781['id']}})[_0x8839('0x22')](function(){return _0x4649bd;});})['then'](function(){_0xa19a11[_0x8839('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ecc73,_0x4ce588){return function(_0x5ca181){if(!_0x5ca181){_0x1ecc73[_0x8839('0x18')](0x194);}return _0x5ca181;};}function handleError(_0x3e776e,_0x25ad9f){_0x25ad9f=_0x25ad9f||0x1f4;return function(_0x115018){logger[_0x8839('0x25')](_0x115018[_0x8839('0x26')]);if(_0x115018['name']){delete _0x115018[_0x8839('0x27')];}_0x3e776e[_0x8839('0x19')](_0x25ad9f)['send'](_0x115018);};}exports['index']=function(_0x546e5c,_0x202bc2){var _0x4792ee={},_0x171ed8={},_0x33f838={'count':0x0,'rows':[]};var _0x3505f4=_[_0x8839('0x28')](db[_0x8839('0x29')][_0x8839('0x2a')],function(_0x3ef275){return{'name':_0x3ef275[_0x8839('0x2b')],'type':_0x3ef275[_0x8839('0x2c')][_0x8839('0x2d')]};});_0x171ed8[_0x8839('0x2e')]=_['map'](_0x3505f4,_0x8839('0x27'));_0x171ed8[_0x8839('0x2f')]=_[_0x8839('0x30')](_0x546e5c[_0x8839('0x2f')]);_0x171ed8[_0x8839('0x31')]=_[_0x8839('0x32')](_0x171ed8[_0x8839('0x2e')],_0x171ed8['query']);_0x4792ee[_0x8839('0x33')]=_[_0x8839('0x32')](_0x171ed8[_0x8839('0x2e')],qs[_0x8839('0x34')](_0x546e5c[_0x8839('0x2f')][_0x8839('0x34')]));_0x4792ee[_0x8839('0x33')]=_0x4792ee[_0x8839('0x33')]['length']?_0x4792ee[_0x8839('0x33')]:_0x171ed8[_0x8839('0x2e')];if(!_0x546e5c[_0x8839('0x2f')][_0x8839('0x35')](_0x8839('0x36'))){_0x4792ee['limit']=qs[_0x8839('0x1d')](_0x546e5c[_0x8839('0x2f')]['limit']);_0x4792ee[_0x8839('0x1c')]=qs[_0x8839('0x1c')](_0x546e5c[_0x8839('0x2f')]['offset']);}_0x4792ee[_0x8839('0x37')]=qs[_0x8839('0x38')](_0x546e5c[_0x8839('0x2f')]['sort']);_0x4792ee[_0x8839('0x39')]=qs[_0x8839('0x31')](_[_0x8839('0x3a')](_0x546e5c[_0x8839('0x2f')],_0x171ed8[_0x8839('0x31')]),_0x3505f4);if(_0x546e5c['query'][_0x8839('0x3b')]){_0x4792ee[_0x8839('0x39')]=_[_0x8839('0x3c')](_0x4792ee[_0x8839('0x39')],{'$or':_[_0x8839('0x28')](_0x3505f4,function(_0x3984b4){if(_0x3984b4[_0x8839('0x2c')]!==_0x8839('0x3d')){var _0x246df9={};_0x246df9[_0x3984b4[_0x8839('0x27')]]={'$like':'%'+_0x546e5c['query'][_0x8839('0x3b')]+'%'};return _0x246df9;}})});}_0x4792ee=_[_0x8839('0x3c')]({},_0x4792ee,_0x546e5c['options']);var _0x119a87={'where':_0x4792ee[_0x8839('0x39')]};return db[_0x8839('0x29')][_0x8839('0x3e')](_0x119a87)['then'](function(_0x46b1ac){_0x33f838['count']=_0x46b1ac;if(_0x546e5c[_0x8839('0x2f')][_0x8839('0x3f')]){_0x4792ee[_0x8839('0x40')]=[{'all':!![]}];}return db[_0x8839('0x29')][_0x8839('0x41')](_0x4792ee);})[_0x8839('0x22')](function(_0x1bc448){_0x33f838['rows']=_0x1bc448;return _0x33f838;})[_0x8839('0x22')](respondWithFilteredResult(_0x202bc2,_0x4792ee))['catch'](handleError(_0x202bc2,null));};exports[_0x8839('0x42')]=function(_0x1f6333,_0x296264){var _0xd0b384={'raw':!![],'where':{'id':_0x1f6333['params']['id']}},_0x16afd3={};_0x16afd3[_0x8839('0x2e')]=_[_0x8839('0x30')](db[_0x8839('0x29')][_0x8839('0x2a')]);_0x16afd3['query']=_[_0x8839('0x30')](_0x1f6333[_0x8839('0x2f')]);_0x16afd3['filters']=_[_0x8839('0x32')](_0x16afd3[_0x8839('0x2e')],_0x16afd3['query']);_0xd0b384[_0x8839('0x33')]=_[_0x8839('0x32')](_0x16afd3[_0x8839('0x2e')],qs['fields'](_0x1f6333[_0x8839('0x2f')][_0x8839('0x34')]));_0xd0b384[_0x8839('0x33')]=_0xd0b384[_0x8839('0x33')][_0x8839('0x43')]?_0xd0b384[_0x8839('0x33')]:_0x16afd3['model'];if(_0x1f6333[_0x8839('0x2f')]['includeAll']){_0xd0b384[_0x8839('0x40')]=[{'all':!![]}];}_0xd0b384=_[_0x8839('0x3c')]({},_0xd0b384,_0x1f6333[_0x8839('0x44')]);return db['Template'][_0x8839('0x45')](_0xd0b384)['then'](handleEntityNotFound(_0x296264,null))[_0x8839('0x22')](respondWithResult(_0x296264,null))['catch'](handleError(_0x296264,null));};exports[_0x8839('0x46')]=function(_0x5bf8ce,_0x23f0cc){return db[_0x8839('0x29')]['create'](_0x5bf8ce[_0x8839('0x47')],{})['then'](function(_0x32b371){var _0x4bd5a0=_0x5bf8ce['user'][_0x8839('0x48')]({'plain':!![]});if(!_0x4bd5a0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4bd5a0[_0x8839('0x49')]===_0x8839('0x4a')){var _0x5b1b59=_0x32b371[_0x8839('0x48')]({'plain':!![]});var _0x58c9a5=_0x8839('0x4b');return db['UserProfileSection'][_0x8839('0x45')]({'where':{'name':_0x58c9a5,'userProfileId':_0x4bd5a0[_0x8839('0x4c')]},'raw':!![]})[_0x8839('0x22')](function(_0x313ae6){if(_0x313ae6&&_0x313ae6[_0x8839('0x4d')]===0x0){return db[_0x8839('0x23')][_0x8839('0x46')]({'name':_0x5b1b59[_0x8839('0x27')],'resourceId':_0x5b1b59['id'],'type':_0x313ae6[_0x8839('0x27')],'sectionId':_0x313ae6['id']},{})[_0x8839('0x22')](function(){return _0x32b371;});}else{return _0x32b371;}})[_0x8839('0x4e')](function(_0x10f005){logger[_0x8839('0x25')](_0x8839('0x4f'),_0x10f005);throw _0x10f005;});}return _0x32b371;})['then'](respondWithResult(_0x23f0cc,0xc9))[_0x8839('0x4e')](handleError(_0x23f0cc,null));};exports[_0x8839('0x50')]=function(_0x150aa7,_0x3ac511){if(_0x150aa7[_0x8839('0x47')]['id']){delete _0x150aa7[_0x8839('0x47')]['id'];}return db['Template'][_0x8839('0x45')]({'where':{'id':_0x150aa7[_0x8839('0x51')]['id']}})[_0x8839('0x22')](handleEntityNotFound(_0x3ac511,null))[_0x8839('0x22')](saveUpdates(_0x150aa7['body'],null))[_0x8839('0x22')](respondWithResult(_0x3ac511,null))[_0x8839('0x4e')](handleError(_0x3ac511,null));};exports[_0x8839('0x24')]=function(_0x5573d2,_0x4250b8){return db['Template'][_0x8839('0x45')]({'where':{'id':_0x5573d2[_0x8839('0x51')]['id']}})[_0x8839('0x22')](handleEntityNotFound(_0x4250b8,null))[_0x8839('0x22')](removeEntity(_0x4250b8,null))[_0x8839('0x4e')](handleError(_0x4250b8,null));}; \ No newline at end of file +var _0x27e2=['error','name','index','Template','rawAttributes','fieldName','type','key','model','map','filters','intersection','query','fields','attributes','length','nolimit','sort','pick','filter','merge','where','VIRTUAL','include','findAll','rows','catch','keys','includeAll','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','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','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','Templates','UserProfileResource'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x27e2,0xce));var _0x227e=function(_0x58fe46,_0x4dc69a){_0x58fe46=_0x58fe46-0x0;var _0x5b36c2=_0x27e2[_0x58fe46];return _0x5b36c2;};'use strict';var emlformat=require(_0x227e('0x0'));var rimraf=require(_0x227e('0x1'));var zipdir=require(_0x227e('0x2'));var jsonpatch=require(_0x227e('0x3'));var rp=require(_0x227e('0x4'));var moment=require(_0x227e('0x5'));var BPromise=require(_0x227e('0x6'));var Mustache=require(_0x227e('0x7'));var util=require(_0x227e('0x8'));var path=require('path');var sox=require(_0x227e('0x9'));var csv=require('to-csv');var ejs=require(_0x227e('0xa'));var fs=require('fs');var fs_extra=require(_0x227e('0xb'));var _=require('lodash');var squel=require(_0x227e('0xc'));var crypto=require(_0x227e('0xd'));var jsforce=require(_0x227e('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x227e('0xf'));var Redis=require(_0x227e('0x10'));var authService=require(_0x227e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x227e('0x12'));var hardwareService=require(_0x227e('0x13'));var logger=require(_0x227e('0x14'))(_0x227e('0x15'));var utils=require(_0x227e('0x16'));var config=require(_0x227e('0x17'));var licenseUtil=require(_0x227e('0x18'));var db=require(_0x227e('0x19'))['db'];function respondWithStatusCode(_0x481508,_0x1278c7){_0x1278c7=_0x1278c7||0xcc;return function(_0x27b0aa){if(_0x27b0aa){return _0x481508[_0x227e('0x1a')](_0x1278c7);}return _0x481508[_0x227e('0x1b')](_0x1278c7)[_0x227e('0x1c')]();};}function respondWithResult(_0x3cbbc1,_0x332b83){_0x332b83=_0x332b83||0xc8;return function(_0x27f00e){if(_0x27f00e){return _0x3cbbc1[_0x227e('0x1b')](_0x332b83)[_0x227e('0x1d')](_0x27f00e);}};}function respondWithFilteredResult(_0x324ca0,_0x3ee43c){return function(_0x7ecd54){if(_0x7ecd54){var _0x3077f3=typeof _0x3ee43c[_0x227e('0x1e')]==='undefined'&&typeof _0x3ee43c[_0x227e('0x1f')]===_0x227e('0x20');var _0x11634b=_0x7ecd54[_0x227e('0x21')];var _0x312bd8=_0x3077f3?0x0:_0x3ee43c['offset'];var _0x259f17=_0x3077f3?_0x7ecd54['count']:_0x3ee43c[_0x227e('0x1e')]+_0x3ee43c[_0x227e('0x1f')];var _0x2c72b1;if(_0x259f17>=_0x11634b){_0x259f17=_0x11634b;_0x2c72b1=0xc8;}else{_0x2c72b1=0xce;}_0x324ca0['status'](_0x2c72b1);return _0x324ca0[_0x227e('0x22')](_0x227e('0x23'),_0x312bd8+'-'+_0x259f17+'/'+_0x11634b)[_0x227e('0x1d')](_0x7ecd54);}return null;};}function patchUpdates(_0x2383f8){return function(_0x4b0b37){try{jsonpatch['apply'](_0x4b0b37,_0x2383f8,!![]);}catch(_0x5a19f5){return BPromise[_0x227e('0x24')](_0x5a19f5);}return _0x4b0b37[_0x227e('0x25')]();};}function saveUpdates(_0x8dafe,_0x2af75a){return function(_0x71e2ab){if(_0x71e2ab){return _0x71e2ab[_0x227e('0x26')](_0x8dafe)[_0x227e('0x27')](function(_0x29c2b1){return _0x29c2b1;});}return null;};}function removeEntity(_0x4d5481,_0x5f1419){return function(_0x205aee){if(_0x205aee){return _0x205aee[_0x227e('0x28')]()['then'](function(){var _0x2b1931=_0x205aee['get']({'plain':!![]});var _0x476e54=_0x227e('0x29');return db[_0x227e('0x2a')][_0x227e('0x28')]({'where':{'type':_0x476e54,'resourceId':_0x2b1931['id']}})[_0x227e('0x27')](function(){return _0x205aee;});})[_0x227e('0x27')](function(){_0x4d5481[_0x227e('0x1b')](0xcc)[_0x227e('0x1c')]();});}};}function handleEntityNotFound(_0x17733d,_0x2fcc3e){return function(_0x2ea6e5){if(!_0x2ea6e5){_0x17733d['sendStatus'](0x194);}return _0x2ea6e5;};}function handleError(_0x9c7cbc,_0x27272f){_0x27272f=_0x27272f||0x1f4;return function(_0x4a91be){logger[_0x227e('0x2b')](_0x4a91be['stack']);if(_0x4a91be[_0x227e('0x2c')]){delete _0x4a91be[_0x227e('0x2c')];}_0x9c7cbc[_0x227e('0x1b')](_0x27272f)['send'](_0x4a91be);};}exports[_0x227e('0x2d')]=function(_0x28a511,_0x4a945b){var _0x403e05={},_0x47e9ab={},_0x5f0a67={'count':0x0,'rows':[]};var _0x562cd1=_['map'](db[_0x227e('0x2e')][_0x227e('0x2f')],function(_0x5b9a9f){return{'name':_0x5b9a9f[_0x227e('0x30')],'type':_0x5b9a9f[_0x227e('0x31')][_0x227e('0x32')]};});_0x47e9ab[_0x227e('0x33')]=_[_0x227e('0x34')](_0x562cd1,_0x227e('0x2c'));_0x47e9ab['query']=_['keys'](_0x28a511['query']);_0x47e9ab[_0x227e('0x35')]=_[_0x227e('0x36')](_0x47e9ab['model'],_0x47e9ab[_0x227e('0x37')]);_0x403e05['attributes']=_[_0x227e('0x36')](_0x47e9ab['model'],qs[_0x227e('0x38')](_0x28a511['query'][_0x227e('0x38')]));_0x403e05[_0x227e('0x39')]=_0x403e05[_0x227e('0x39')][_0x227e('0x3a')]?_0x403e05['attributes']:_0x47e9ab[_0x227e('0x33')];if(!_0x28a511[_0x227e('0x37')]['hasOwnProperty'](_0x227e('0x3b'))){_0x403e05[_0x227e('0x1f')]=qs[_0x227e('0x1f')](_0x28a511['query']['limit']);_0x403e05[_0x227e('0x1e')]=qs[_0x227e('0x1e')](_0x28a511[_0x227e('0x37')][_0x227e('0x1e')]);}_0x403e05['order']=qs[_0x227e('0x3c')](_0x28a511['query'][_0x227e('0x3c')]);_0x403e05['where']=qs['filters'](_[_0x227e('0x3d')](_0x28a511[_0x227e('0x37')],_0x47e9ab['filters']),_0x562cd1);if(_0x28a511[_0x227e('0x37')][_0x227e('0x3e')]){_0x403e05['where']=_[_0x227e('0x3f')](_0x403e05[_0x227e('0x40')],{'$or':_['map'](_0x562cd1,function(_0xb88bba){if(_0xb88bba[_0x227e('0x31')]!==_0x227e('0x41')){var _0x1d5a59={};_0x1d5a59[_0xb88bba[_0x227e('0x2c')]]={'$like':'%'+_0x28a511[_0x227e('0x37')][_0x227e('0x3e')]+'%'};return _0x1d5a59;}})});}_0x403e05=_[_0x227e('0x3f')]({},_0x403e05,_0x28a511['options']);var _0x4ccab5={'where':_0x403e05[_0x227e('0x40')]};return db[_0x227e('0x2e')][_0x227e('0x21')](_0x4ccab5)[_0x227e('0x27')](function(_0x4c5f87){_0x5f0a67[_0x227e('0x21')]=_0x4c5f87;if(_0x28a511[_0x227e('0x37')]['includeAll']){_0x403e05[_0x227e('0x42')]=[{'all':!![]}];}return db['Template'][_0x227e('0x43')](_0x403e05);})['then'](function(_0x2d018b){_0x5f0a67[_0x227e('0x44')]=_0x2d018b;return _0x5f0a67;})['then'](respondWithFilteredResult(_0x4a945b,_0x403e05))[_0x227e('0x45')](handleError(_0x4a945b,null));};exports['show']=function(_0x5c6614,_0x4f392d){var _0x6e9537={'raw':!![],'where':{'id':_0x5c6614['params']['id']}},_0x4bed10={};_0x4bed10[_0x227e('0x33')]=_[_0x227e('0x46')](db[_0x227e('0x2e')][_0x227e('0x2f')]);_0x4bed10[_0x227e('0x37')]=_['keys'](_0x5c6614['query']);_0x4bed10[_0x227e('0x35')]=_['intersection'](_0x4bed10[_0x227e('0x33')],_0x4bed10[_0x227e('0x37')]);_0x6e9537[_0x227e('0x39')]=_[_0x227e('0x36')](_0x4bed10[_0x227e('0x33')],qs[_0x227e('0x38')](_0x5c6614['query'][_0x227e('0x38')]));_0x6e9537['attributes']=_0x6e9537['attributes'][_0x227e('0x3a')]?_0x6e9537['attributes']:_0x4bed10[_0x227e('0x33')];if(_0x5c6614['query'][_0x227e('0x47')]){_0x6e9537[_0x227e('0x42')]=[{'all':!![]}];}_0x6e9537=_[_0x227e('0x3f')]({},_0x6e9537,_0x5c6614[_0x227e('0x48')]);return db[_0x227e('0x2e')][_0x227e('0x49')](_0x6e9537)[_0x227e('0x27')](handleEntityNotFound(_0x4f392d,null))[_0x227e('0x27')](respondWithResult(_0x4f392d,null))['catch'](handleError(_0x4f392d,null));};exports[_0x227e('0x4a')]=function(_0x25fcb0,_0x42a898){return db[_0x227e('0x2e')][_0x227e('0x4a')](_0x25fcb0[_0x227e('0x4b')],{})[_0x227e('0x27')](function(_0x464f8d){var _0x1b1000=_0x25fcb0[_0x227e('0x4c')][_0x227e('0x4d')]({'plain':!![]});if(!_0x1b1000)throw new Error(_0x227e('0x4e'));if(_0x1b1000[_0x227e('0x4f')]===_0x227e('0x4c')){var _0x6b9dbd=_0x464f8d[_0x227e('0x4d')]({'plain':!![]});var _0x2e26b7='Templates';return db[_0x227e('0x50')][_0x227e('0x49')]({'where':{'name':_0x2e26b7,'userProfileId':_0x1b1000[_0x227e('0x51')]},'raw':!![]})[_0x227e('0x27')](function(_0x2c17f2){if(_0x2c17f2&&_0x2c17f2['autoAssociation']===0x0){return db[_0x227e('0x2a')][_0x227e('0x4a')]({'name':_0x6b9dbd[_0x227e('0x2c')],'resourceId':_0x6b9dbd['id'],'type':_0x2c17f2[_0x227e('0x2c')],'sectionId':_0x2c17f2['id']},{})[_0x227e('0x27')](function(){return _0x464f8d;});}else{return _0x464f8d;}})[_0x227e('0x45')](function(_0x565581){logger[_0x227e('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x565581);throw _0x565581;});}return _0x464f8d;})[_0x227e('0x27')](respondWithResult(_0x42a898,0xc9))[_0x227e('0x45')](handleError(_0x42a898,null));};exports[_0x227e('0x26')]=function(_0x5066ef,_0x1dd65){if(_0x5066ef['body']['id']){delete _0x5066ef['body']['id'];}return db[_0x227e('0x2e')]['find']({'where':{'id':_0x5066ef['params']['id']}})['then'](handleEntityNotFound(_0x1dd65,null))[_0x227e('0x27')](saveUpdates(_0x5066ef['body'],null))[_0x227e('0x27')](respondWithResult(_0x1dd65,null))[_0x227e('0x45')](handleError(_0x1dd65,null));};exports[_0x227e('0x28')]=function(_0x303d51,_0x8a971){return db[_0x227e('0x2e')]['find']({'where':{'id':_0x303d51[_0x227e('0x52')]['id']}})['then'](handleEntityNotFound(_0x8a971,null))[_0x227e('0x27')](removeEntity(_0x8a971,null))['catch'](handleError(_0x8a971,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 7334ecf..98dbcf0 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 _0x2a0c=['bluebird','request-promise','path','rimraf','./template.attributes','define','tools_templates','lodash','util','../../config/logger','api','moment'];(function(_0x48c69d,_0x2c45a0){var _0x552fec=function(_0x2b00e6){while(--_0x2b00e6){_0x48c69d['push'](_0x48c69d['shift']());}};_0x552fec(++_0x2c45a0);}(_0x2a0c,0x13f));var _0xc2a0=function(_0x1bdf2a,_0x4eeef3){_0x1bdf2a=_0x1bdf2a-0x0;var _0x40981b=_0x2a0c[_0x1bdf2a];return _0x40981b;};'use strict';var _=require(_0xc2a0('0x0'));var util=require(_0xc2a0('0x1'));var logger=require(_0xc2a0('0x2'))(_0xc2a0('0x3'));var moment=require(_0xc2a0('0x4'));var BPromise=require(_0xc2a0('0x5'));var rp=require(_0xc2a0('0x6'));var fs=require('fs');var path=require(_0xc2a0('0x7'));var rimraf=require(_0xc2a0('0x8'));var config=require('../../config/environment');var attributes=require(_0xc2a0('0x9'));module['exports']=function(_0x4d7d33,_0xe56712){return _0x4d7d33[_0xc2a0('0xa')]('Template',attributes,{'tableName':_0xc2a0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f51=['../../config/logger','moment','bluebird','../../config/environment','./template.attributes','exports','define','tools_templates','lodash','util'];(function(_0x5acf25,_0x5db3cb){var _0x380561=function(_0x5e383b){while(--_0x5e383b){_0x5acf25['push'](_0x5acf25['shift']());}};_0x380561(++_0x5db3cb);}(_0x5f51,0x1a2));var _0x15f5=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5f51[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x15f5('0x0'));var util=require(_0x15f5('0x1'));var logger=require(_0x15f5('0x2'))('api');var moment=require(_0x15f5('0x3'));var BPromise=require(_0x15f5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x15f5('0x5'));var attributes=require(_0x15f5('0x6'));module[_0x15f5('0x7')]=function(_0xfe3271,_0x328576){return _0xfe3271[_0x15f5('0x8')]('Template',attributes,{'tableName':_0x15f5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 83c93e5..39977b1 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 _0x51bd=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','Template,\x20%s,\x20%s','message','result','catch','GetTemplate','Template','findAll','options','raw','attributes','include','map','model','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x51bd,0x122));var _0xd51b=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x51bd[_0x27af45];return _0x18df21;};'use strict';var _=require('lodash');var util=require(_0xd51b('0x0'));var moment=require('moment');var BPromise=require(_0xd51b('0x1'));var rs=require(_0xd51b('0x2'));var fs=require('fs');var Redis=require(_0xd51b('0x3'));var db=require(_0xd51b('0x4'))['db'];var utils=require(_0xd51b('0x5'));var logger=require('../../config/logger')(_0xd51b('0x6'));var config=require(_0xd51b('0x7'));var jayson=require(_0xd51b('0x8'));var client=jayson[_0xd51b('0x9')][_0xd51b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36b316,_0x4a231a,_0x2e6217){return new BPromise(function(_0x220c22,_0x119b4d){return client[_0xd51b('0xb')](_0x36b316,_0x2e6217)[_0xd51b('0xc')](function(_0x182a43){logger[_0xd51b('0xd')]('Template,\x20%s,\x20%s',_0x4a231a,_0xd51b('0xe'));logger[_0xd51b('0xf')](_0xd51b('0x10'),_0x4a231a,_0xd51b('0xe'),JSON[_0xd51b('0x11')](_0x182a43));if(_0x182a43[_0xd51b('0x12')]){if(_0x182a43[_0xd51b('0x12')][_0xd51b('0x13')]===0x1f4){logger[_0xd51b('0x12')](_0xd51b('0x14'),_0x4a231a,_0x182a43[_0xd51b('0x12')][_0xd51b('0x15')]);return _0x119b4d(_0x182a43[_0xd51b('0x12')][_0xd51b('0x15')]);}logger[_0xd51b('0x12')]('Template,\x20%s,\x20%s',_0x4a231a,_0x182a43['error'][_0xd51b('0x15')]);return _0x220c22(_0x182a43[_0xd51b('0x12')][_0xd51b('0x15')]);}else{logger[_0xd51b('0xd')]('Template,\x20%s,\x20%s',_0x4a231a,_0xd51b('0xe'));_0x220c22(_0x182a43[_0xd51b('0x16')][_0xd51b('0x15')]);}})[_0xd51b('0x17')](function(_0x60c44c){logger[_0xd51b('0x12')](_0xd51b('0x14'),_0x4a231a,_0x60c44c);_0x119b4d(_0x60c44c);});});}exports[_0xd51b('0x18')]=function(_0x364026){var _0x517f4d=this;return new Promise(function(_0x522d51,_0x219059){return db[_0xd51b('0x19')][_0xd51b('0x1a')]({'raw':_0x364026['options']?_0x364026[_0xd51b('0x1b')][_0xd51b('0x1c')]===undefined?!![]:![]:!![],'where':_0x364026[_0xd51b('0x1b')]?_0x364026[_0xd51b('0x1b')]['where']||null:null,'attributes':_0x364026['options']?_0x364026[_0xd51b('0x1b')][_0xd51b('0x1d')]||null:null,'limit':_0x364026[_0xd51b('0x1b')]?_0x364026['options']['limit']||null:null,'include':_0x364026[_0xd51b('0x1b')]?_0x364026[_0xd51b('0x1b')][_0xd51b('0x1e')]?_[_0xd51b('0x1f')](_0x364026[_0xd51b('0x1b')]['include'],function(_0x1a98da){return{'model':db[_0x1a98da[_0xd51b('0x20')]],'as':_0x1a98da['as'],'attributes':_0x1a98da['attributes'],'include':_0x1a98da[_0xd51b('0x1e')]?_[_0xd51b('0x1f')](_0x1a98da[_0xd51b('0x1e')],function(_0x2fdc3c){return{'model':db[_0x2fdc3c[_0xd51b('0x20')]],'as':_0x2fdc3c['as'],'attributes':_0x2fdc3c[_0xd51b('0x1d')],'include':_0x2fdc3c[_0xd51b('0x1e')]?_['map'](_0x2fdc3c[_0xd51b('0x1e')],function(_0x25f613){return{'model':db[_0x25f613['model']],'as':_0x25f613['as'],'attributes':_0x25f613['attributes']};}):[]};}):[]};}):[]:[]})[_0xd51b('0xc')](function(_0x51d89e){logger[_0xd51b('0xd')](_0xd51b('0x18'),_0x364026);logger[_0xd51b('0xf')]('GetTemplate',_0x364026,JSON[_0xd51b('0x11')](_0x51d89e));_0x522d51(_0x51d89e);})[_0xd51b('0x17')](function(_0x310a79){logger[_0xd51b('0x12')]('GetTemplate',_0x310a79[_0xd51b('0x15')],_0x364026);_0x219059(_0x517f4d[_0xd51b('0x12')](0x1f4,_0x310a79[_0xd51b('0x15')]));});});}; \ No newline at end of file +var _0xa0ea=['client','http','then','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','code','error','message','Template,\x20%s,\x20%s','result','catch','GetTemplate','Template','findAll','options','attributes','include','map','model','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x27d6af,_0x178946){var _0x13bb86=function(_0x5c7a62){while(--_0x5c7a62){_0x27d6af['push'](_0x27d6af['shift']());}};_0x13bb86(++_0x178946);}(_0xa0ea,0x1b9));var _0xaa0e=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0xa0ea[_0x1fafa5];return _0xcf08c9;};'use strict';var _=require(_0xaa0e('0x0'));var util=require(_0xaa0e('0x1'));var moment=require(_0xaa0e('0x2'));var BPromise=require('bluebird');var rs=require(_0xaa0e('0x3'));var fs=require('fs');var Redis=require(_0xaa0e('0x4'));var db=require(_0xaa0e('0x5'))['db'];var utils=require(_0xaa0e('0x6'));var logger=require('../../config/logger')(_0xaa0e('0x7'));var config=require(_0xaa0e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaa0e('0x9')][_0xaa0e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b1c4c,_0x2722f1,_0x55141a){return new BPromise(function(_0x1cd13a,_0x3258b8){return client['request'](_0x3b1c4c,_0x55141a)[_0xaa0e('0xb')](function(_0x358d6b){logger['info']('Template,\x20%s,\x20%s',_0x2722f1,_0xaa0e('0xc'));logger[_0xaa0e('0xd')](_0xaa0e('0xe'),_0x2722f1,_0xaa0e('0xc'),JSON['stringify'](_0x358d6b));if(_0x358d6b['error']){if(_0x358d6b['error'][_0xaa0e('0xf')]===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x2722f1,_0x358d6b[_0xaa0e('0x10')]['message']);return _0x3258b8(_0x358d6b[_0xaa0e('0x10')][_0xaa0e('0x11')]);}logger[_0xaa0e('0x10')](_0xaa0e('0x12'),_0x2722f1,_0x358d6b[_0xaa0e('0x10')][_0xaa0e('0x11')]);return _0x1cd13a(_0x358d6b[_0xaa0e('0x10')][_0xaa0e('0x11')]);}else{logger['info'](_0xaa0e('0x12'),_0x2722f1,_0xaa0e('0xc'));_0x1cd13a(_0x358d6b[_0xaa0e('0x13')]['message']);}})[_0xaa0e('0x14')](function(_0xfc152d){logger[_0xaa0e('0x10')]('Template,\x20%s,\x20%s',_0x2722f1,_0xfc152d);_0x3258b8(_0xfc152d);});});}exports[_0xaa0e('0x15')]=function(_0x336164){var _0x23841f=this;return new Promise(function(_0x5df304,_0x1e2eed){return db[_0xaa0e('0x16')][_0xaa0e('0x17')]({'raw':_0x336164['options']?_0x336164[_0xaa0e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x336164[_0xaa0e('0x18')]?_0x336164[_0xaa0e('0x18')]['where']||null:null,'attributes':_0x336164[_0xaa0e('0x18')]?_0x336164['options'][_0xaa0e('0x19')]||null:null,'limit':_0x336164[_0xaa0e('0x18')]?_0x336164[_0xaa0e('0x18')]['limit']||null:null,'include':_0x336164['options']?_0x336164[_0xaa0e('0x18')][_0xaa0e('0x1a')]?_['map'](_0x336164['options'][_0xaa0e('0x1a')],function(_0x123cf0){return{'model':db[_0x123cf0['model']],'as':_0x123cf0['as'],'attributes':_0x123cf0[_0xaa0e('0x19')],'include':_0x123cf0[_0xaa0e('0x1a')]?_[_0xaa0e('0x1b')](_0x123cf0[_0xaa0e('0x1a')],function(_0x682992){return{'model':db[_0x682992[_0xaa0e('0x1c')]],'as':_0x682992['as'],'attributes':_0x682992['attributes'],'include':_0x682992[_0xaa0e('0x1a')]?_[_0xaa0e('0x1b')](_0x682992[_0xaa0e('0x1a')],function(_0x3d798e){return{'model':db[_0x3d798e[_0xaa0e('0x1c')]],'as':_0x3d798e['as'],'attributes':_0x3d798e[_0xaa0e('0x19')]};}):[]};}):[]};}):[]:[]})[_0xaa0e('0xb')](function(_0x59a8f5){logger['info']('GetTemplate',_0x336164);logger[_0xaa0e('0xd')]('GetTemplate',_0x336164,JSON[_0xaa0e('0x1d')](_0x59a8f5));_0x5df304(_0x59a8f5);})[_0xaa0e('0x14')](function(_0x1eefae){logger[_0xaa0e('0x10')](_0xaa0e('0x15'),_0x1eefae[_0xaa0e('0x11')],_0x336164);_0x1e2eed(_0x23841f[_0xaa0e('0x10')](0x1f4,_0x1eefae[_0xaa0e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 9c4e0ab..7cc7ecd 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 _0x3ee0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','/:id/all_conditions','addAction','put','update','destroy','multer','util'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x3ee0,0x196));var _0x03ee=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3ee0[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x03ee('0x0'));var util=require(_0x03ee('0x1'));var path=require('path');var timeout=require(_0x03ee('0x2'));var express=require(_0x03ee('0x3'));var router=express[_0x03ee('0x4')]();var fs_extra=require(_0x03ee('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x03ee('0x6'));var config=require(_0x03ee('0x7'));var controller=require('./trigger.controller');router[_0x03ee('0x8')]('/',auth[_0x03ee('0x9')](),controller[_0x03ee('0xa')]);router[_0x03ee('0x8')](_0x03ee('0xb'),auth[_0x03ee('0x9')](),controller[_0x03ee('0xc')]);router['get']('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x03ee('0xd')]);router['get'](_0x03ee('0xe'),auth[_0x03ee('0x9')](),controller[_0x03ee('0xf')]);router[_0x03ee('0x8')](_0x03ee('0x10'),auth['isAuthenticated'](),controller[_0x03ee('0x11')]);router[_0x03ee('0x12')]('/',auth[_0x03ee('0x9')](),controller['create']);router[_0x03ee('0x12')](_0x03ee('0x13'),auth[_0x03ee('0x9')](),controller['addAllCondition']);router[_0x03ee('0x12')](_0x03ee('0xe'),auth[_0x03ee('0x9')](),controller['addAnyCondition']);router[_0x03ee('0x12')](_0x03ee('0x10'),auth[_0x03ee('0x9')](),controller[_0x03ee('0x14')]);router[_0x03ee('0x15')](_0x03ee('0xb'),auth[_0x03ee('0x9')](),controller[_0x03ee('0x16')]);router['delete']('/:id',auth[_0x03ee('0x9')](),controller[_0x03ee('0x17')]);module['exports']=router; \ No newline at end of file +var _0xe19a=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./trigger.controller','get','isAuthenticated','index','/:id','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','create','post','addAllCondition','addAction','put','update','delete','destroy','exports','multer','path'];(function(_0x21ecc8,_0x2bdead){var _0x510c1d=function(_0x3b6862){while(--_0x3b6862){_0x21ecc8['push'](_0x21ecc8['shift']());}};_0x510c1d(++_0x2bdead);}(_0xe19a,0xd6));var _0xae19=function(_0x2ada12,_0x582fdb){_0x2ada12=_0x2ada12-0x0;var _0x14763c=_0xe19a[_0x2ada12];return _0x14763c;};'use strict';var multer=require(_0xae19('0x0'));var util=require('util');var path=require(_0xae19('0x1'));var timeout=require(_0xae19('0x2'));var express=require(_0xae19('0x3'));var router=express[_0xae19('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xae19('0x5'));var interaction=require(_0xae19('0x6'));var config=require('../../config/environment');var controller=require(_0xae19('0x7'));router[_0xae19('0x8')]('/',auth[_0xae19('0x9')](),controller[_0xae19('0xa')]);router['get'](_0xae19('0xb'),auth[_0xae19('0x9')](),controller['show']);router['get'](_0xae19('0xc'),auth[_0xae19('0x9')](),controller[_0xae19('0xd')]);router['get'](_0xae19('0xe'),auth['isAuthenticated'](),controller[_0xae19('0xf')]);router[_0xae19('0x8')](_0xae19('0x10'),auth[_0xae19('0x9')](),controller[_0xae19('0x11')]);router['post']('/',auth[_0xae19('0x9')](),controller[_0xae19('0x12')]);router[_0xae19('0x13')](_0xae19('0xc'),auth[_0xae19('0x9')](),controller[_0xae19('0x14')]);router['post']('/:id/any_conditions',auth['isAuthenticated'](),controller['addAnyCondition']);router[_0xae19('0x13')](_0xae19('0x10'),auth['isAuthenticated'](),controller[_0xae19('0x15')]);router[_0xae19('0x16')](_0xae19('0xb'),auth[_0xae19('0x9')](),controller[_0xae19('0x17')]);router[_0xae19('0x18')]('/:id',auth[_0xae19('0x9')](),controller[_0xae19('0x19')]);module[_0xae19('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index f505c03..5521f25 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 _0xa8a5=['sequelize','exports','STRING','BOOLEAN'];(function(_0x54c192,_0x458ab4){var _0x566735=function(_0x5018b9){while(--_0x5018b9){_0x54c192['push'](_0x54c192['shift']());}};_0x566735(++_0x458ab4);}(_0xa8a5,0xfc));var _0x5a8a=function(_0x50f392,_0x1d8441){_0x50f392=_0x50f392-0x0;var _0x5926f2=_0xa8a5[_0x50f392];return _0x5926f2;};'use strict';var Sequelize=require(_0x5a8a('0x0'));module[_0x5a8a('0x1')]={'name':{'type':Sequelize[_0x5a8a('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5a8a('0x2')]},'status':{'type':Sequelize[_0x5a8a('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x1c8d=['BOOLEAN','exports','STRING'];(function(_0x18d574,_0x201a43){var _0x300a1c=function(_0x2cb6b8){while(--_0x2cb6b8){_0x18d574['push'](_0x18d574['shift']());}};_0x300a1c(++_0x201a43);}(_0x1c8d,0x196));var _0xd1c8=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x1c8d[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0xd1c8('0x0')]={'name':{'type':Sequelize[_0xd1c8('0x1')]},'channel':{'type':Sequelize[_0xd1c8('0x1')]},'description':{'type':Sequelize[_0xd1c8('0x1')]},'status':{'type':Sequelize[_0xd1c8('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index ffd26a2..c6230a8 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 _0xf915=['Triggers','UserProfileResource','error','name','index','map','Trigger','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','role','UserProfileSection','userProfileId','addAllCondition','Condition','addAnyCondition','findOne','length','order','getAllConditions','getAnyConditions','rawAttributes','nolimit','addAction','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy'];(function(_0x35db12,_0x3ac128){var _0x3b0856=function(_0x6f200){while(--_0x6f200){_0x35db12['push'](_0x35db12['shift']());}};_0x3b0856(++_0x3ac128);}(_0xf915,0x140));var _0x5f91=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xf915[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require(_0x5f91('0x0'));var rimraf=require(_0x5f91('0x1'));var zipdir=require(_0x5f91('0x2'));var jsonpatch=require(_0x5f91('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5f91('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5f91('0x5'));var sox=require(_0x5f91('0x6'));var csv=require('to-csv');var ejs=require(_0x5f91('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5f91('0x8'));var squel=require(_0x5f91('0x9'));var crypto=require('crypto');var jsforce=require(_0x5f91('0xa'));var deskjs=require(_0x5f91('0xb'));var toCsv=require(_0x5f91('0xc'));var querystring=require(_0x5f91('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5f91('0xe'));var qs=require(_0x5f91('0xf'));var as=require(_0x5f91('0x10'));var hardwareService=require(_0x5f91('0x11'));var logger=require(_0x5f91('0x12'))('api');var utils=require(_0x5f91('0x13'));var config=require(_0x5f91('0x14'));var licenseUtil=require(_0x5f91('0x15'));var db=require(_0x5f91('0x16'))['db'];function respondWithStatusCode(_0x395798,_0x3474b3){_0x3474b3=_0x3474b3||0xcc;return function(_0x16c87d){if(_0x16c87d){return _0x395798[_0x5f91('0x17')](_0x3474b3);}return _0x395798[_0x5f91('0x18')](_0x3474b3)[_0x5f91('0x19')]();};}function respondWithResult(_0x1831f8,_0x55e221){_0x55e221=_0x55e221||0xc8;return function(_0x3186fe){if(_0x3186fe){return _0x1831f8['status'](_0x55e221)['json'](_0x3186fe);}};}function respondWithFilteredResult(_0x328bf7,_0x18583e){return function(_0x3254cc){if(_0x3254cc){var _0xc6e164=typeof _0x18583e[_0x5f91('0x1a')]==='undefined'&&typeof _0x18583e[_0x5f91('0x1b')]==='undefined';var _0x34db71=_0x3254cc[_0x5f91('0x1c')];var _0x2bf029=_0xc6e164?0x0:_0x18583e[_0x5f91('0x1a')];var _0x1d981b=_0xc6e164?_0x3254cc[_0x5f91('0x1c')]:_0x18583e[_0x5f91('0x1a')]+_0x18583e[_0x5f91('0x1b')];var _0x1cb71f;if(_0x1d981b>=_0x34db71){_0x1d981b=_0x34db71;_0x1cb71f=0xc8;}else{_0x1cb71f=0xce;}_0x328bf7[_0x5f91('0x18')](_0x1cb71f);return _0x328bf7[_0x5f91('0x1d')](_0x5f91('0x1e'),_0x2bf029+'-'+_0x1d981b+'/'+_0x34db71)['json'](_0x3254cc);}return null;};}function patchUpdates(_0x916797){return function(_0x47cf9b){try{jsonpatch[_0x5f91('0x1f')](_0x47cf9b,_0x916797,!![]);}catch(_0x589f97){return BPromise[_0x5f91('0x20')](_0x589f97);}return _0x47cf9b['save']();};}function saveUpdates(_0x19a30f,_0x3127a1){return function(_0x53db3f){if(_0x53db3f){return _0x53db3f[_0x5f91('0x21')](_0x19a30f)[_0x5f91('0x22')](function(_0x2d3354){return _0x2d3354;});}return null;};}function removeEntity(_0x2caba6,_0x3f3760){return function(_0x5dbaa7){if(_0x5dbaa7){return _0x5dbaa7[_0x5f91('0x23')]()[_0x5f91('0x22')](function(){var _0x1beff9=_0x5dbaa7['get']({'plain':!![]});var _0x3f118d=_0x5f91('0x24');return db[_0x5f91('0x25')][_0x5f91('0x23')]({'where':{'type':_0x3f118d,'resourceId':_0x1beff9['id']}})[_0x5f91('0x22')](function(){return _0x5dbaa7;});})[_0x5f91('0x22')](function(){_0x2caba6['status'](0xcc)[_0x5f91('0x19')]();});}};}function handleEntityNotFound(_0x2b6290,_0x511702){return function(_0x3b5b2d){if(!_0x3b5b2d){_0x2b6290['sendStatus'](0x194);}return _0x3b5b2d;};}function handleError(_0x211d73,_0x11ffc7){_0x11ffc7=_0x11ffc7||0x1f4;return function(_0xf3eb48){logger[_0x5f91('0x26')](_0xf3eb48['stack']);if(_0xf3eb48[_0x5f91('0x27')]){delete _0xf3eb48[_0x5f91('0x27')];}_0x211d73['status'](_0x11ffc7)['send'](_0xf3eb48);};}exports[_0x5f91('0x28')]=function(_0x2d8873,_0x2d1aa7){var _0x4589e1={},_0x436a4b={},_0x1cc4c5={'count':0x0,'rows':[]};var _0x37f0fa=_[_0x5f91('0x29')](db[_0x5f91('0x2a')]['rawAttributes'],function(_0x1c4caa){return{'name':_0x1c4caa[_0x5f91('0x2b')],'type':_0x1c4caa[_0x5f91('0x2c')][_0x5f91('0x2d')]};});_0x436a4b[_0x5f91('0x2e')]=_[_0x5f91('0x29')](_0x37f0fa,_0x5f91('0x27'));_0x436a4b[_0x5f91('0x2f')]=_[_0x5f91('0x30')](_0x2d8873[_0x5f91('0x2f')]);_0x436a4b['filters']=_[_0x5f91('0x31')](_0x436a4b[_0x5f91('0x2e')],_0x436a4b[_0x5f91('0x2f')]);_0x4589e1[_0x5f91('0x32')]=_['intersection'](_0x436a4b[_0x5f91('0x2e')],qs[_0x5f91('0x33')](_0x2d8873['query'][_0x5f91('0x33')]));_0x4589e1[_0x5f91('0x32')]=_0x4589e1[_0x5f91('0x32')]['length']?_0x4589e1[_0x5f91('0x32')]:_0x436a4b['model'];if(!_0x2d8873[_0x5f91('0x2f')][_0x5f91('0x34')]('nolimit')){_0x4589e1[_0x5f91('0x1b')]=qs[_0x5f91('0x1b')](_0x2d8873[_0x5f91('0x2f')][_0x5f91('0x1b')]);_0x4589e1['offset']=qs[_0x5f91('0x1a')](_0x2d8873[_0x5f91('0x2f')][_0x5f91('0x1a')]);}_0x4589e1['order']=qs[_0x5f91('0x35')](_0x2d8873['query'][_0x5f91('0x35')]);_0x4589e1[_0x5f91('0x36')]=qs[_0x5f91('0x37')](_[_0x5f91('0x38')](_0x2d8873['query'],_0x436a4b[_0x5f91('0x37')]),_0x37f0fa);if(_0x2d8873[_0x5f91('0x2f')]['filter']){_0x4589e1[_0x5f91('0x36')]=_[_0x5f91('0x39')](_0x4589e1[_0x5f91('0x36')],{'$or':_[_0x5f91('0x29')](_0x37f0fa,function(_0x27cdbb){if(_0x27cdbb[_0x5f91('0x2c')]!==_0x5f91('0x3a')){var _0x3a29a5={};_0x3a29a5[_0x27cdbb[_0x5f91('0x27')]]={'$like':'%'+_0x2d8873[_0x5f91('0x2f')][_0x5f91('0x3b')]+'%'};return _0x3a29a5;}})});}_0x4589e1=_[_0x5f91('0x39')]({},_0x4589e1,_0x2d8873[_0x5f91('0x3c')]);var _0x12c4b3={'where':_0x4589e1[_0x5f91('0x36')]};return db['Trigger'][_0x5f91('0x1c')](_0x12c4b3)[_0x5f91('0x22')](function(_0x396c2b){_0x1cc4c5[_0x5f91('0x1c')]=_0x396c2b;if(_0x2d8873[_0x5f91('0x2f')][_0x5f91('0x3d')]){_0x4589e1[_0x5f91('0x3e')]=[{'all':!![]}];}return db[_0x5f91('0x2a')][_0x5f91('0x3f')](_0x4589e1);})[_0x5f91('0x22')](function(_0x19613e){_0x1cc4c5[_0x5f91('0x40')]=_0x19613e;return _0x1cc4c5;})[_0x5f91('0x22')](respondWithFilteredResult(_0x2d1aa7,_0x4589e1))[_0x5f91('0x41')](handleError(_0x2d1aa7,null));};exports[_0x5f91('0x42')]=function(_0x18aa5d,_0x313e01){var _0x510362={'raw':![],'where':{'id':_0x18aa5d[_0x5f91('0x43')]['id']}},_0x1c27a2={};_0x1c27a2[_0x5f91('0x2e')]=_[_0x5f91('0x30')](db[_0x5f91('0x2a')]['rawAttributes']);_0x1c27a2[_0x5f91('0x2f')]=_[_0x5f91('0x30')](_0x18aa5d[_0x5f91('0x2f')]);_0x1c27a2['filters']=_[_0x5f91('0x31')](_0x1c27a2['model'],_0x1c27a2[_0x5f91('0x2f')]);_0x510362[_0x5f91('0x32')]=_[_0x5f91('0x31')](_0x1c27a2['model'],qs[_0x5f91('0x33')](_0x18aa5d['query'][_0x5f91('0x33')]));_0x510362[_0x5f91('0x32')]=_0x510362[_0x5f91('0x32')]['length']?_0x510362['attributes']:_0x1c27a2[_0x5f91('0x2e')];if(_0x18aa5d['query'][_0x5f91('0x3d')]){_0x510362[_0x5f91('0x3e')]=[{'all':!![]}];}_0x510362=_[_0x5f91('0x39')]({},_0x510362,_0x18aa5d[_0x5f91('0x3c')]);return db[_0x5f91('0x2a')][_0x5f91('0x44')](_0x510362)[_0x5f91('0x22')](handleEntityNotFound(_0x313e01,null))[_0x5f91('0x22')](respondWithResult(_0x313e01,null))[_0x5f91('0x41')](handleError(_0x313e01,null));};exports[_0x5f91('0x45')]=function(_0x353e11,_0xd36f70){return db[_0x5f91('0x2a')][_0x5f91('0x45')](_0x353e11[_0x5f91('0x46')],{})[_0x5f91('0x22')](function(_0x17717d){var _0x40a777=_0x353e11[_0x5f91('0x47')][_0x5f91('0x48')]({'plain':!![]});if(!_0x40a777)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40a777[_0x5f91('0x49')]==='user'){var _0x481a9e=_0x17717d[_0x5f91('0x48')]({'plain':!![]});var _0x10084d=_0x5f91('0x24');return db[_0x5f91('0x4a')][_0x5f91('0x44')]({'where':{'name':_0x10084d,'userProfileId':_0x40a777[_0x5f91('0x4b')]},'raw':!![]})[_0x5f91('0x22')](function(_0x16fafc){if(_0x16fafc&&_0x16fafc['autoAssociation']===0x0){return db[_0x5f91('0x25')]['create']({'name':_0x481a9e[_0x5f91('0x27')],'resourceId':_0x481a9e['id'],'type':_0x16fafc[_0x5f91('0x27')],'sectionId':_0x16fafc['id']},{})[_0x5f91('0x22')](function(){return _0x17717d;});}else{return _0x17717d;}})[_0x5f91('0x41')](function(_0x2decfc){logger[_0x5f91('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2decfc);throw _0x2decfc;});}return _0x17717d;})[_0x5f91('0x22')](respondWithResult(_0xd36f70,0xc9))[_0x5f91('0x41')](handleError(_0xd36f70,null));};exports[_0x5f91('0x21')]=function(_0x24f4d5,_0x48ef15){if(_0x24f4d5[_0x5f91('0x46')]['id']){delete _0x24f4d5[_0x5f91('0x46')]['id'];}return db['Trigger'][_0x5f91('0x44')]({'where':{'id':_0x24f4d5[_0x5f91('0x43')]['id']}})[_0x5f91('0x22')](handleEntityNotFound(_0x48ef15,null))[_0x5f91('0x22')](saveUpdates(_0x24f4d5[_0x5f91('0x46')],null))['then'](respondWithResult(_0x48ef15,null))[_0x5f91('0x41')](handleError(_0x48ef15,null));};exports[_0x5f91('0x23')]=function(_0x469e16,_0x372a12){return db[_0x5f91('0x2a')][_0x5f91('0x44')]({'where':{'id':_0x469e16['params']['id']}})[_0x5f91('0x22')](handleEntityNotFound(_0x372a12,null))[_0x5f91('0x22')](removeEntity(_0x372a12,null))[_0x5f91('0x41')](handleError(_0x372a12,null));};exports[_0x5f91('0x4c')]=function(_0xfe2a6d,_0x5e1b10,_0x3694ea){if(_0xfe2a6d['body']['id']){delete _0xfe2a6d[_0x5f91('0x46')]['id'];}return db[_0x5f91('0x2a')][_0x5f91('0x44')]({'where':{'id':_0xfe2a6d[_0x5f91('0x43')]['id']}})[_0x5f91('0x22')](handleEntityNotFound(_0x5e1b10,null))[_0x5f91('0x22')](function(_0x11be30){if(_0x11be30){_0xfe2a6d[_0x5f91('0x46')]['TriggerAllId']=_0x11be30['id'];return db[_0x5f91('0x4d')][_0x5f91('0x45')](_0xfe2a6d[_0x5f91('0x46')]);}})[_0x5f91('0x22')](respondWithResult(_0x5e1b10,null))[_0x5f91('0x41')](handleError(_0x5e1b10,null));};exports[_0x5f91('0x4e')]=function(_0x475ca8,_0x3df1cc,_0x378df9){if(_0x475ca8['body']['id']){delete _0x475ca8[_0x5f91('0x46')]['id'];}return db[_0x5f91('0x2a')][_0x5f91('0x44')]({'where':{'id':_0x475ca8['params']['id']}})[_0x5f91('0x22')](handleEntityNotFound(_0x3df1cc,null))[_0x5f91('0x22')](function(_0x170113){if(_0x170113){_0x475ca8['body']['TriggerAnyId']=_0x170113['id'];return db[_0x5f91('0x4d')][_0x5f91('0x45')](_0x475ca8[_0x5f91('0x46')]);}})[_0x5f91('0x22')](respondWithResult(_0x3df1cc,null))[_0x5f91('0x41')](handleError(_0x3df1cc,null));};exports['getAllConditions']=function(_0x1dee0a,_0x2c96d1,_0x332762){var _0x1cb02d={};var _0x1bed69={};var _0x474b5f;var _0x539ac9;return db[_0x5f91('0x2a')][_0x5f91('0x4f')]({'where':{'id':_0x1dee0a[_0x5f91('0x43')]['id']}})[_0x5f91('0x22')](handleEntityNotFound(_0x2c96d1,null))[_0x5f91('0x22')](function(_0x395515){if(_0x395515){_0x474b5f=_0x395515;_0x1bed69[_0x5f91('0x2e')]=_[_0x5f91('0x30')](db[_0x5f91('0x4d')]['rawAttributes']);_0x1bed69[_0x5f91('0x2f')]=_[_0x5f91('0x30')](_0x1dee0a[_0x5f91('0x2f')]);_0x1bed69['filters']=_[_0x5f91('0x31')](_0x1bed69['model'],_0x1bed69[_0x5f91('0x2f')]);_0x1cb02d[_0x5f91('0x32')]=_[_0x5f91('0x31')](_0x1bed69[_0x5f91('0x2e')],qs[_0x5f91('0x33')](_0x1dee0a[_0x5f91('0x2f')]['fields']));_0x1cb02d['attributes']=_0x1cb02d[_0x5f91('0x32')][_0x5f91('0x50')]?_0x1cb02d[_0x5f91('0x32')]:_0x1bed69[_0x5f91('0x2e')];_0x1cb02d[_0x5f91('0x51')]=qs[_0x5f91('0x35')](_0x1dee0a[_0x5f91('0x2f')][_0x5f91('0x35')]);_0x1cb02d['where']=qs[_0x5f91('0x37')](_[_0x5f91('0x38')](_0x1dee0a[_0x5f91('0x2f')],_0x1bed69[_0x5f91('0x37')]));if(_0x1dee0a[_0x5f91('0x2f')][_0x5f91('0x3b')]){_0x1cb02d[_0x5f91('0x36')]=_['merge'](_0x1cb02d[_0x5f91('0x36')],{'$or':_['map'](_0x1cb02d[_0x5f91('0x32')],function(_0x926d43){var _0x33fac9={};_0x33fac9[_0x926d43]={'$like':'%'+_0x1dee0a[_0x5f91('0x2f')][_0x5f91('0x3b')]+'%'};return _0x33fac9;})});}_0x1cb02d=_[_0x5f91('0x39')]({},_0x1cb02d,_0x1dee0a['options']);return _0x474b5f[_0x5f91('0x52')](_0x1cb02d);}})[_0x5f91('0x22')](function(_0x5e6fb7){if(_0x5e6fb7){_0x539ac9=_0x5e6fb7['length'];if(!_0x1dee0a[_0x5f91('0x2f')][_0x5f91('0x34')]('nolimit')){_0x1cb02d[_0x5f91('0x1b')]=qs[_0x5f91('0x1b')](_0x1dee0a[_0x5f91('0x2f')]['limit']);_0x1cb02d[_0x5f91('0x1a')]=qs[_0x5f91('0x1a')](_0x1dee0a[_0x5f91('0x2f')][_0x5f91('0x1a')]);}return _0x474b5f[_0x5f91('0x52')](_0x1cb02d);}})[_0x5f91('0x22')](function(_0x1f657a){if(_0x1f657a){return _0x1f657a?{'count':_0x539ac9,'rows':_0x1f657a}:null;}})[_0x5f91('0x22')](respondWithResult(_0x2c96d1,null))['catch'](handleError(_0x2c96d1,null));};exports[_0x5f91('0x53')]=function(_0x19452a,_0x7f5224,_0x312e1a){var _0x29c08e={};var _0x4920ea={};var _0x113f21;var _0x5126a3;return db[_0x5f91('0x2a')]['findOne']({'where':{'id':_0x19452a[_0x5f91('0x43')]['id']}})[_0x5f91('0x22')](handleEntityNotFound(_0x7f5224,null))['then'](function(_0x44a941){if(_0x44a941){_0x113f21=_0x44a941;_0x4920ea['model']=_[_0x5f91('0x30')](db[_0x5f91('0x4d')][_0x5f91('0x54')]);_0x4920ea[_0x5f91('0x2f')]=_[_0x5f91('0x30')](_0x19452a[_0x5f91('0x2f')]);_0x4920ea['filters']=_[_0x5f91('0x31')](_0x4920ea[_0x5f91('0x2e')],_0x4920ea[_0x5f91('0x2f')]);_0x29c08e[_0x5f91('0x32')]=_[_0x5f91('0x31')](_0x4920ea[_0x5f91('0x2e')],qs['fields'](_0x19452a[_0x5f91('0x2f')][_0x5f91('0x33')]));_0x29c08e['attributes']=_0x29c08e[_0x5f91('0x32')][_0x5f91('0x50')]?_0x29c08e[_0x5f91('0x32')]:_0x4920ea[_0x5f91('0x2e')];_0x29c08e['order']=qs[_0x5f91('0x35')](_0x19452a[_0x5f91('0x2f')][_0x5f91('0x35')]);_0x29c08e[_0x5f91('0x36')]=qs[_0x5f91('0x37')](_[_0x5f91('0x38')](_0x19452a[_0x5f91('0x2f')],_0x4920ea[_0x5f91('0x37')]));if(_0x19452a['query'][_0x5f91('0x3b')]){_0x29c08e[_0x5f91('0x36')]=_[_0x5f91('0x39')](_0x29c08e[_0x5f91('0x36')],{'$or':_[_0x5f91('0x29')](_0x29c08e['attributes'],function(_0x1b2aea){var _0x2eb2ff={};_0x2eb2ff[_0x1b2aea]={'$like':'%'+_0x19452a[_0x5f91('0x2f')][_0x5f91('0x3b')]+'%'};return _0x2eb2ff;})});}_0x29c08e=_[_0x5f91('0x39')]({},_0x29c08e,_0x19452a[_0x5f91('0x3c')]);return _0x113f21[_0x5f91('0x53')](_0x29c08e);}})['then'](function(_0xdb7a79){if(_0xdb7a79){_0x5126a3=_0xdb7a79['length'];if(!_0x19452a[_0x5f91('0x2f')]['hasOwnProperty'](_0x5f91('0x55'))){_0x29c08e[_0x5f91('0x1b')]=qs[_0x5f91('0x1b')](_0x19452a[_0x5f91('0x2f')][_0x5f91('0x1b')]);_0x29c08e[_0x5f91('0x1a')]=qs[_0x5f91('0x1a')](_0x19452a['query']['offset']);}return _0x113f21[_0x5f91('0x53')](_0x29c08e);}})[_0x5f91('0x22')](function(_0x4a54ca){if(_0x4a54ca){return _0x4a54ca?{'count':_0x5126a3,'rows':_0x4a54ca}:null;}})[_0x5f91('0x22')](respondWithResult(_0x7f5224,null))['catch'](handleError(_0x7f5224,null));};exports[_0x5f91('0x56')]=function(_0x4bf374,_0x291bab,_0x1748ef){if(_0x4bf374[_0x5f91('0x46')]['id']){delete _0x4bf374['body']['id'];}return db[_0x5f91('0x2a')][_0x5f91('0x44')]({'where':{'id':_0x4bf374[_0x5f91('0x43')]['id']}})['then'](handleEntityNotFound(_0x291bab,null))['then'](function(_0x2adbdf){if(_0x2adbdf){_0x4bf374['body']['TriggerId']=_0x2adbdf['id'];return db[_0x5f91('0x57')][_0x5f91('0x45')](_0x4bf374['body']);}})[_0x5f91('0x22')](respondWithResult(_0x291bab,null))['catch'](handleError(_0x291bab,null));};exports['getActions']=function(_0x5c5492,_0x2aee7e,_0x2edea0){var _0x4e484a={};var _0xc97824={};var _0x58244e;var _0x3b6fae;return db[_0x5f91('0x2a')]['findOne']({'where':{'id':_0x5c5492[_0x5f91('0x43')]['id']}})[_0x5f91('0x22')](handleEntityNotFound(_0x2aee7e,null))['then'](function(_0x551a2c){if(_0x551a2c){_0x58244e=_0x551a2c;_0xc97824[_0x5f91('0x2e')]=_[_0x5f91('0x30')](db[_0x5f91('0x57')][_0x5f91('0x54')]);_0xc97824[_0x5f91('0x2f')]=_[_0x5f91('0x30')](_0x5c5492[_0x5f91('0x2f')]);_0xc97824[_0x5f91('0x37')]=_[_0x5f91('0x31')](_0xc97824[_0x5f91('0x2e')],_0xc97824['query']);_0x4e484a[_0x5f91('0x32')]=_[_0x5f91('0x31')](_0xc97824[_0x5f91('0x2e')],qs['fields'](_0x5c5492[_0x5f91('0x2f')]['fields']));_0x4e484a[_0x5f91('0x32')]=_0x4e484a[_0x5f91('0x32')][_0x5f91('0x50')]?_0x4e484a[_0x5f91('0x32')]:_0xc97824['model'];_0x4e484a[_0x5f91('0x51')]=qs['sort'](_0x5c5492[_0x5f91('0x2f')]['sort']);_0x4e484a['where']=qs[_0x5f91('0x37')](_[_0x5f91('0x38')](_0x5c5492['query'],_0xc97824[_0x5f91('0x37')]));if(_0x5c5492['query'][_0x5f91('0x3b')]){_0x4e484a['where']=_[_0x5f91('0x39')](_0x4e484a[_0x5f91('0x36')],{'$or':_[_0x5f91('0x29')](_0x4e484a['attributes'],function(_0x5b1ef4){var _0x2ab5e3={};_0x2ab5e3[_0x5b1ef4]={'$like':'%'+_0x5c5492[_0x5f91('0x2f')][_0x5f91('0x3b')]+'%'};return _0x2ab5e3;})});}_0x4e484a=_[_0x5f91('0x39')]({},_0x4e484a,_0x5c5492[_0x5f91('0x3c')]);return _0x58244e[_0x5f91('0x58')](_0x4e484a);}})['then'](function(_0x3a8ecc){if(_0x3a8ecc){_0x3b6fae=_0x3a8ecc[_0x5f91('0x50')];if(!_0x5c5492[_0x5f91('0x2f')][_0x5f91('0x34')](_0x5f91('0x55'))){_0x4e484a[_0x5f91('0x1b')]=qs['limit'](_0x5c5492['query']['limit']);_0x4e484a[_0x5f91('0x1a')]=qs['offset'](_0x5c5492[_0x5f91('0x2f')][_0x5f91('0x1a')]);}return _0x58244e[_0x5f91('0x58')](_0x4e484a);}})[_0x5f91('0x22')](function(_0x5120fe){if(_0x5120fe){return _0x5120fe?{'count':_0x3b6fae,'rows':_0x5120fe}:null;}})[_0x5f91('0x22')](respondWithResult(_0x2aee7e,null))[_0x5f91('0x41')](handleError(_0x2aee7e,null));}; \ No newline at end of file +var _0xd309=['findOne','order','options','nolimit','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','moment','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','update','then','destroy','get','Triggers','UserProfileResource','stack','name','send','index','Trigger','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions'];(function(_0x2af3a6,_0x4ebac4){var _0x3cbc74=function(_0x15db04){while(--_0x15db04){_0x2af3a6['push'](_0x2af3a6['shift']());}};_0x3cbc74(++_0x4ebac4);}(_0xd309,0x1da));var _0x9d30=function(_0x38ae5e,_0x10456f){_0x38ae5e=_0x38ae5e-0x0;var _0x442da2=_0xd309[_0x38ae5e];return _0x442da2;};'use strict';var emlformat=require(_0x9d30('0x0'));var rimraf=require(_0x9d30('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9d30('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9d30('0x3'));var util=require('util');var path=require('path');var sox=require(_0x9d30('0x4'));var csv=require('to-csv');var ejs=require(_0x9d30('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d30('0x6'));var squel=require(_0x9d30('0x7'));var crypto=require(_0x9d30('0x8'));var jsforce=require(_0x9d30('0x9'));var deskjs=require(_0x9d30('0xa'));var toCsv=require('to-csv');var querystring=require(_0x9d30('0xb'));var Papa=require(_0x9d30('0xc'));var Redis=require(_0x9d30('0xd'));var authService=require(_0x9d30('0xe'));var qs=require(_0x9d30('0xf'));var as=require(_0x9d30('0x10'));var hardwareService=require(_0x9d30('0x11'));var logger=require(_0x9d30('0x12'))(_0x9d30('0x13'));var utils=require(_0x9d30('0x14'));var config=require(_0x9d30('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d30('0x16'))['db'];function respondWithStatusCode(_0x332c58,_0x22e7e8){_0x22e7e8=_0x22e7e8||0xcc;return function(_0x2b54c8){if(_0x2b54c8){return _0x332c58[_0x9d30('0x17')](_0x22e7e8);}return _0x332c58[_0x9d30('0x18')](_0x22e7e8)[_0x9d30('0x19')]();};}function respondWithResult(_0x17cbe2,_0x2715d8){_0x2715d8=_0x2715d8||0xc8;return function(_0x2c7eb8){if(_0x2c7eb8){return _0x17cbe2[_0x9d30('0x18')](_0x2715d8)[_0x9d30('0x1a')](_0x2c7eb8);}};}function respondWithFilteredResult(_0x344036,_0x1fbed3){return function(_0x4853ec){if(_0x4853ec){var _0x2a0514=typeof _0x1fbed3[_0x9d30('0x1b')]===_0x9d30('0x1c')&&typeof _0x1fbed3['limit']==='undefined';var _0x393bfa=_0x4853ec['count'];var _0x4de1a0=_0x2a0514?0x0:_0x1fbed3['offset'];var _0x1037d7=_0x2a0514?_0x4853ec[_0x9d30('0x1d')]:_0x1fbed3[_0x9d30('0x1b')]+_0x1fbed3[_0x9d30('0x1e')];var _0x2ee378;if(_0x1037d7>=_0x393bfa){_0x1037d7=_0x393bfa;_0x2ee378=0xc8;}else{_0x2ee378=0xce;}_0x344036[_0x9d30('0x18')](_0x2ee378);return _0x344036['set'](_0x9d30('0x1f'),_0x4de1a0+'-'+_0x1037d7+'/'+_0x393bfa)['json'](_0x4853ec);}return null;};}function patchUpdates(_0xcc11){return function(_0x59f0fe){try{jsonpatch['apply'](_0x59f0fe,_0xcc11,!![]);}catch(_0x33d22d){return BPromise[_0x9d30('0x20')](_0x33d22d);}return _0x59f0fe['save']();};}function saveUpdates(_0x239f36,_0x19f2cd){return function(_0x695d33){if(_0x695d33){return _0x695d33[_0x9d30('0x21')](_0x239f36)[_0x9d30('0x22')](function(_0x2f503c){return _0x2f503c;});}return null;};}function removeEntity(_0x155dad,_0x5e110a){return function(_0x2f8f15){if(_0x2f8f15){return _0x2f8f15[_0x9d30('0x23')]()[_0x9d30('0x22')](function(){var _0x5191b7=_0x2f8f15[_0x9d30('0x24')]({'plain':!![]});var _0xe5ff14=_0x9d30('0x25');return db[_0x9d30('0x26')][_0x9d30('0x23')]({'where':{'type':_0xe5ff14,'resourceId':_0x5191b7['id']}})[_0x9d30('0x22')](function(){return _0x2f8f15;});})['then'](function(){_0x155dad[_0x9d30('0x18')](0xcc)[_0x9d30('0x19')]();});}};}function handleEntityNotFound(_0xbf3592,_0x258bd6){return function(_0x3b670a){if(!_0x3b670a){_0xbf3592['sendStatus'](0x194);}return _0x3b670a;};}function handleError(_0x2f2349,_0x1b1dcc){_0x1b1dcc=_0x1b1dcc||0x1f4;return function(_0x176ce7){logger['error'](_0x176ce7[_0x9d30('0x27')]);if(_0x176ce7['name']){delete _0x176ce7[_0x9d30('0x28')];}_0x2f2349['status'](_0x1b1dcc)[_0x9d30('0x29')](_0x176ce7);};}exports[_0x9d30('0x2a')]=function(_0x19ffe1,_0x384bf1){var _0x3a9468={},_0x83eae0={},_0x4880af={'count':0x0,'rows':[]};var _0x4e059b=_['map'](db[_0x9d30('0x2b')]['rawAttributes'],function(_0x29071a){return{'name':_0x29071a['fieldName'],'type':_0x29071a[_0x9d30('0x2c')][_0x9d30('0x2d')]};});_0x83eae0['model']=_[_0x9d30('0x2e')](_0x4e059b,_0x9d30('0x28'));_0x83eae0[_0x9d30('0x2f')]=_[_0x9d30('0x30')](_0x19ffe1['query']);_0x83eae0[_0x9d30('0x31')]=_[_0x9d30('0x32')](_0x83eae0[_0x9d30('0x33')],_0x83eae0[_0x9d30('0x2f')]);_0x3a9468[_0x9d30('0x34')]=_[_0x9d30('0x32')](_0x83eae0['model'],qs[_0x9d30('0x35')](_0x19ffe1['query'][_0x9d30('0x35')]));_0x3a9468[_0x9d30('0x34')]=_0x3a9468['attributes'][_0x9d30('0x36')]?_0x3a9468['attributes']:_0x83eae0['model'];if(!_0x19ffe1[_0x9d30('0x2f')][_0x9d30('0x37')]('nolimit')){_0x3a9468[_0x9d30('0x1e')]=qs[_0x9d30('0x1e')](_0x19ffe1[_0x9d30('0x2f')][_0x9d30('0x1e')]);_0x3a9468[_0x9d30('0x1b')]=qs[_0x9d30('0x1b')](_0x19ffe1['query'][_0x9d30('0x1b')]);}_0x3a9468['order']=qs[_0x9d30('0x38')](_0x19ffe1['query'][_0x9d30('0x38')]);_0x3a9468['where']=qs[_0x9d30('0x31')](_[_0x9d30('0x39')](_0x19ffe1[_0x9d30('0x2f')],_0x83eae0[_0x9d30('0x31')]),_0x4e059b);if(_0x19ffe1[_0x9d30('0x2f')][_0x9d30('0x3a')]){_0x3a9468[_0x9d30('0x3b')]=_[_0x9d30('0x3c')](_0x3a9468[_0x9d30('0x3b')],{'$or':_[_0x9d30('0x2e')](_0x4e059b,function(_0x3ef64f){if(_0x3ef64f[_0x9d30('0x2c')]!==_0x9d30('0x3d')){var _0xf4d9be={};_0xf4d9be[_0x3ef64f[_0x9d30('0x28')]]={'$like':'%'+_0x19ffe1[_0x9d30('0x2f')]['filter']+'%'};return _0xf4d9be;}})});}_0x3a9468=_[_0x9d30('0x3c')]({},_0x3a9468,_0x19ffe1['options']);var _0x5d7822={'where':_0x3a9468[_0x9d30('0x3b')]};return db[_0x9d30('0x2b')][_0x9d30('0x1d')](_0x5d7822)[_0x9d30('0x22')](function(_0x99634f){_0x4880af['count']=_0x99634f;if(_0x19ffe1[_0x9d30('0x2f')][_0x9d30('0x3e')]){_0x3a9468[_0x9d30('0x3f')]=[{'all':!![]}];}return db[_0x9d30('0x2b')][_0x9d30('0x40')](_0x3a9468);})[_0x9d30('0x22')](function(_0x2c71f3){_0x4880af[_0x9d30('0x41')]=_0x2c71f3;return _0x4880af;})[_0x9d30('0x22')](respondWithFilteredResult(_0x384bf1,_0x3a9468))[_0x9d30('0x42')](handleError(_0x384bf1,null));};exports[_0x9d30('0x43')]=function(_0x37b698,_0x76def9){var _0x1002db={'raw':![],'where':{'id':_0x37b698[_0x9d30('0x44')]['id']}},_0x4dbfb1={};_0x4dbfb1[_0x9d30('0x33')]=_['keys'](db[_0x9d30('0x2b')][_0x9d30('0x45')]);_0x4dbfb1['query']=_[_0x9d30('0x30')](_0x37b698[_0x9d30('0x2f')]);_0x4dbfb1[_0x9d30('0x31')]=_[_0x9d30('0x32')](_0x4dbfb1[_0x9d30('0x33')],_0x4dbfb1[_0x9d30('0x2f')]);_0x1002db[_0x9d30('0x34')]=_[_0x9d30('0x32')](_0x4dbfb1[_0x9d30('0x33')],qs[_0x9d30('0x35')](_0x37b698[_0x9d30('0x2f')][_0x9d30('0x35')]));_0x1002db['attributes']=_0x1002db[_0x9d30('0x34')][_0x9d30('0x36')]?_0x1002db[_0x9d30('0x34')]:_0x4dbfb1[_0x9d30('0x33')];if(_0x37b698[_0x9d30('0x2f')][_0x9d30('0x3e')]){_0x1002db['include']=[{'all':!![]}];}_0x1002db=_[_0x9d30('0x3c')]({},_0x1002db,_0x37b698['options']);return db[_0x9d30('0x2b')][_0x9d30('0x46')](_0x1002db)[_0x9d30('0x22')](handleEntityNotFound(_0x76def9,null))[_0x9d30('0x22')](respondWithResult(_0x76def9,null))[_0x9d30('0x42')](handleError(_0x76def9,null));};exports[_0x9d30('0x47')]=function(_0x2e266c,_0x43f4b5){return db['Trigger'][_0x9d30('0x47')](_0x2e266c[_0x9d30('0x48')],{})[_0x9d30('0x22')](function(_0x275cea){var _0x3f76df=_0x2e266c[_0x9d30('0x49')][_0x9d30('0x24')]({'plain':!![]});if(!_0x3f76df)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f76df[_0x9d30('0x4a')]===_0x9d30('0x49')){var _0xe24c6b=_0x275cea[_0x9d30('0x24')]({'plain':!![]});var _0x2e0500=_0x9d30('0x25');return db[_0x9d30('0x4b')][_0x9d30('0x46')]({'where':{'name':_0x2e0500,'userProfileId':_0x3f76df[_0x9d30('0x4c')]},'raw':!![]})[_0x9d30('0x22')](function(_0x2833d3){if(_0x2833d3&&_0x2833d3['autoAssociation']===0x0){return db[_0x9d30('0x26')][_0x9d30('0x47')]({'name':_0xe24c6b['name'],'resourceId':_0xe24c6b['id'],'type':_0x2833d3[_0x9d30('0x28')],'sectionId':_0x2833d3['id']},{})[_0x9d30('0x22')](function(){return _0x275cea;});}else{return _0x275cea;}})[_0x9d30('0x42')](function(_0x4be5a0){logger[_0x9d30('0x4d')](_0x9d30('0x4e'),_0x4be5a0);throw _0x4be5a0;});}return _0x275cea;})[_0x9d30('0x22')](respondWithResult(_0x43f4b5,0xc9))[_0x9d30('0x42')](handleError(_0x43f4b5,null));};exports[_0x9d30('0x21')]=function(_0x49bb5a,_0x187187){if(_0x49bb5a['body']['id']){delete _0x49bb5a[_0x9d30('0x48')]['id'];}return db['Trigger'][_0x9d30('0x46')]({'where':{'id':_0x49bb5a[_0x9d30('0x44')]['id']}})[_0x9d30('0x22')](handleEntityNotFound(_0x187187,null))[_0x9d30('0x22')](saveUpdates(_0x49bb5a[_0x9d30('0x48')],null))[_0x9d30('0x22')](respondWithResult(_0x187187,null))[_0x9d30('0x42')](handleError(_0x187187,null));};exports[_0x9d30('0x23')]=function(_0x43cc74,_0x56ebf1){return db[_0x9d30('0x2b')][_0x9d30('0x46')]({'where':{'id':_0x43cc74['params']['id']}})[_0x9d30('0x22')](handleEntityNotFound(_0x56ebf1,null))[_0x9d30('0x22')](removeEntity(_0x56ebf1,null))[_0x9d30('0x42')](handleError(_0x56ebf1,null));};exports['addAllCondition']=function(_0x3a083f,_0x2bf72f,_0x4b9a94){if(_0x3a083f['body']['id']){delete _0x3a083f[_0x9d30('0x48')]['id'];}return db[_0x9d30('0x2b')][_0x9d30('0x46')]({'where':{'id':_0x3a083f[_0x9d30('0x44')]['id']}})['then'](handleEntityNotFound(_0x2bf72f,null))['then'](function(_0x19cd84){if(_0x19cd84){_0x3a083f['body'][_0x9d30('0x4f')]=_0x19cd84['id'];return db['Condition'][_0x9d30('0x47')](_0x3a083f[_0x9d30('0x48')]);}})[_0x9d30('0x22')](respondWithResult(_0x2bf72f,null))[_0x9d30('0x42')](handleError(_0x2bf72f,null));};exports[_0x9d30('0x50')]=function(_0x48c4b3,_0x1f3b77,_0x215350){if(_0x48c4b3[_0x9d30('0x48')]['id']){delete _0x48c4b3[_0x9d30('0x48')]['id'];}return db[_0x9d30('0x2b')][_0x9d30('0x46')]({'where':{'id':_0x48c4b3['params']['id']}})[_0x9d30('0x22')](handleEntityNotFound(_0x1f3b77,null))[_0x9d30('0x22')](function(_0x12f361){if(_0x12f361){_0x48c4b3['body'][_0x9d30('0x51')]=_0x12f361['id'];return db[_0x9d30('0x52')]['create'](_0x48c4b3['body']);}})['then'](respondWithResult(_0x1f3b77,null))['catch'](handleError(_0x1f3b77,null));};exports[_0x9d30('0x53')]=function(_0x1d6510,_0xe1678,_0x5d478c){var _0x3cd9ec={};var _0x28c711={};var _0x83513e;var _0x1b2a51;return db['Trigger'][_0x9d30('0x54')]({'where':{'id':_0x1d6510['params']['id']}})['then'](handleEntityNotFound(_0xe1678,null))[_0x9d30('0x22')](function(_0x16dbf7){if(_0x16dbf7){_0x83513e=_0x16dbf7;_0x28c711[_0x9d30('0x33')]=_['keys'](db[_0x9d30('0x52')][_0x9d30('0x45')]);_0x28c711[_0x9d30('0x2f')]=_[_0x9d30('0x30')](_0x1d6510[_0x9d30('0x2f')]);_0x28c711['filters']=_[_0x9d30('0x32')](_0x28c711['model'],_0x28c711['query']);_0x3cd9ec['attributes']=_['intersection'](_0x28c711[_0x9d30('0x33')],qs['fields'](_0x1d6510[_0x9d30('0x2f')]['fields']));_0x3cd9ec[_0x9d30('0x34')]=_0x3cd9ec[_0x9d30('0x34')][_0x9d30('0x36')]?_0x3cd9ec[_0x9d30('0x34')]:_0x28c711['model'];_0x3cd9ec[_0x9d30('0x55')]=qs[_0x9d30('0x38')](_0x1d6510[_0x9d30('0x2f')][_0x9d30('0x38')]);_0x3cd9ec[_0x9d30('0x3b')]=qs[_0x9d30('0x31')](_[_0x9d30('0x39')](_0x1d6510['query'],_0x28c711[_0x9d30('0x31')]));if(_0x1d6510[_0x9d30('0x2f')][_0x9d30('0x3a')]){_0x3cd9ec['where']=_[_0x9d30('0x3c')](_0x3cd9ec[_0x9d30('0x3b')],{'$or':_[_0x9d30('0x2e')](_0x3cd9ec[_0x9d30('0x34')],function(_0x49ca58){var _0x1c8eac={};_0x1c8eac[_0x49ca58]={'$like':'%'+_0x1d6510['query'][_0x9d30('0x3a')]+'%'};return _0x1c8eac;})});}_0x3cd9ec=_[_0x9d30('0x3c')]({},_0x3cd9ec,_0x1d6510[_0x9d30('0x56')]);return _0x83513e['getAllConditions'](_0x3cd9ec);}})[_0x9d30('0x22')](function(_0x51a0d9){if(_0x51a0d9){_0x1b2a51=_0x51a0d9['length'];if(!_0x1d6510[_0x9d30('0x2f')]['hasOwnProperty'](_0x9d30('0x57'))){_0x3cd9ec['limit']=qs[_0x9d30('0x1e')](_0x1d6510['query'][_0x9d30('0x1e')]);_0x3cd9ec[_0x9d30('0x1b')]=qs[_0x9d30('0x1b')](_0x1d6510['query'][_0x9d30('0x1b')]);}return _0x83513e[_0x9d30('0x53')](_0x3cd9ec);}})[_0x9d30('0x22')](function(_0x39d3e2){if(_0x39d3e2){return _0x39d3e2?{'count':_0x1b2a51,'rows':_0x39d3e2}:null;}})[_0x9d30('0x22')](respondWithResult(_0xe1678,null))[_0x9d30('0x42')](handleError(_0xe1678,null));};exports['getAnyConditions']=function(_0x561758,_0x4a0004,_0x6ed3c5){var _0x39157c={};var _0x5c76e8={};var _0x2aa721;var _0x2ebc3f;return db[_0x9d30('0x2b')][_0x9d30('0x54')]({'where':{'id':_0x561758[_0x9d30('0x44')]['id']}})[_0x9d30('0x22')](handleEntityNotFound(_0x4a0004,null))[_0x9d30('0x22')](function(_0x218ec9){if(_0x218ec9){_0x2aa721=_0x218ec9;_0x5c76e8[_0x9d30('0x33')]=_[_0x9d30('0x30')](db['Condition'][_0x9d30('0x45')]);_0x5c76e8['query']=_[_0x9d30('0x30')](_0x561758[_0x9d30('0x2f')]);_0x5c76e8['filters']=_['intersection'](_0x5c76e8[_0x9d30('0x33')],_0x5c76e8[_0x9d30('0x2f')]);_0x39157c[_0x9d30('0x34')]=_[_0x9d30('0x32')](_0x5c76e8[_0x9d30('0x33')],qs[_0x9d30('0x35')](_0x561758[_0x9d30('0x2f')][_0x9d30('0x35')]));_0x39157c[_0x9d30('0x34')]=_0x39157c[_0x9d30('0x34')]['length']?_0x39157c[_0x9d30('0x34')]:_0x5c76e8['model'];_0x39157c[_0x9d30('0x55')]=qs[_0x9d30('0x38')](_0x561758[_0x9d30('0x2f')][_0x9d30('0x38')]);_0x39157c[_0x9d30('0x3b')]=qs[_0x9d30('0x31')](_['pick'](_0x561758[_0x9d30('0x2f')],_0x5c76e8[_0x9d30('0x31')]));if(_0x561758[_0x9d30('0x2f')][_0x9d30('0x3a')]){_0x39157c[_0x9d30('0x3b')]=_['merge'](_0x39157c[_0x9d30('0x3b')],{'$or':_[_0x9d30('0x2e')](_0x39157c[_0x9d30('0x34')],function(_0x511ce6){var _0xe2d495={};_0xe2d495[_0x511ce6]={'$like':'%'+_0x561758[_0x9d30('0x2f')][_0x9d30('0x3a')]+'%'};return _0xe2d495;})});}_0x39157c=_[_0x9d30('0x3c')]({},_0x39157c,_0x561758[_0x9d30('0x56')]);return _0x2aa721['getAnyConditions'](_0x39157c);}})['then'](function(_0x2dc96f){if(_0x2dc96f){_0x2ebc3f=_0x2dc96f[_0x9d30('0x36')];if(!_0x561758[_0x9d30('0x2f')]['hasOwnProperty']('nolimit')){_0x39157c['limit']=qs[_0x9d30('0x1e')](_0x561758[_0x9d30('0x2f')][_0x9d30('0x1e')]);_0x39157c['offset']=qs[_0x9d30('0x1b')](_0x561758[_0x9d30('0x2f')][_0x9d30('0x1b')]);}return _0x2aa721[_0x9d30('0x58')](_0x39157c);}})['then'](function(_0x4d2630){if(_0x4d2630){return _0x4d2630?{'count':_0x2ebc3f,'rows':_0x4d2630}:null;}})[_0x9d30('0x22')](respondWithResult(_0x4a0004,null))['catch'](handleError(_0x4a0004,null));};exports[_0x9d30('0x59')]=function(_0x4385e7,_0x401d56,_0x445b73){if(_0x4385e7['body']['id']){delete _0x4385e7[_0x9d30('0x48')]['id'];}return db[_0x9d30('0x2b')]['find']({'where':{'id':_0x4385e7[_0x9d30('0x44')]['id']}})[_0x9d30('0x22')](handleEntityNotFound(_0x401d56,null))[_0x9d30('0x22')](function(_0x1c1409){if(_0x1c1409){_0x4385e7['body'][_0x9d30('0x5a')]=_0x1c1409['id'];return db[_0x9d30('0x5b')][_0x9d30('0x47')](_0x4385e7[_0x9d30('0x48')]);}})['then'](respondWithResult(_0x401d56,null))[_0x9d30('0x42')](handleError(_0x401d56,null));};exports[_0x9d30('0x5c')]=function(_0x11d7b8,_0x1e4ea1,_0x352fdb){var _0x5e5bc1={};var _0xb358ca={};var _0x359252;var _0x2497cc;return db['Trigger'][_0x9d30('0x54')]({'where':{'id':_0x11d7b8[_0x9d30('0x44')]['id']}})[_0x9d30('0x22')](handleEntityNotFound(_0x1e4ea1,null))[_0x9d30('0x22')](function(_0x5e0835){if(_0x5e0835){_0x359252=_0x5e0835;_0xb358ca[_0x9d30('0x33')]=_[_0x9d30('0x30')](db['Action'][_0x9d30('0x45')]);_0xb358ca[_0x9d30('0x2f')]=_[_0x9d30('0x30')](_0x11d7b8['query']);_0xb358ca[_0x9d30('0x31')]=_['intersection'](_0xb358ca[_0x9d30('0x33')],_0xb358ca[_0x9d30('0x2f')]);_0x5e5bc1[_0x9d30('0x34')]=_['intersection'](_0xb358ca[_0x9d30('0x33')],qs[_0x9d30('0x35')](_0x11d7b8[_0x9d30('0x2f')]['fields']));_0x5e5bc1[_0x9d30('0x34')]=_0x5e5bc1[_0x9d30('0x34')][_0x9d30('0x36')]?_0x5e5bc1[_0x9d30('0x34')]:_0xb358ca[_0x9d30('0x33')];_0x5e5bc1[_0x9d30('0x55')]=qs['sort'](_0x11d7b8[_0x9d30('0x2f')][_0x9d30('0x38')]);_0x5e5bc1[_0x9d30('0x3b')]=qs['filters'](_['pick'](_0x11d7b8[_0x9d30('0x2f')],_0xb358ca[_0x9d30('0x31')]));if(_0x11d7b8[_0x9d30('0x2f')][_0x9d30('0x3a')]){_0x5e5bc1[_0x9d30('0x3b')]=_[_0x9d30('0x3c')](_0x5e5bc1['where'],{'$or':_[_0x9d30('0x2e')](_0x5e5bc1['attributes'],function(_0x51c5a2){var _0x4cffff={};_0x4cffff[_0x51c5a2]={'$like':'%'+_0x11d7b8[_0x9d30('0x2f')]['filter']+'%'};return _0x4cffff;})});}_0x5e5bc1=_[_0x9d30('0x3c')]({},_0x5e5bc1,_0x11d7b8[_0x9d30('0x56')]);return _0x359252['getActions'](_0x5e5bc1);}})['then'](function(_0x2d5beb){if(_0x2d5beb){_0x2497cc=_0x2d5beb[_0x9d30('0x36')];if(!_0x11d7b8[_0x9d30('0x2f')]['hasOwnProperty']('nolimit')){_0x5e5bc1[_0x9d30('0x1e')]=qs['limit'](_0x11d7b8[_0x9d30('0x2f')][_0x9d30('0x1e')]);_0x5e5bc1['offset']=qs[_0x9d30('0x1b')](_0x11d7b8[_0x9d30('0x2f')][_0x9d30('0x1b')]);}return _0x359252[_0x9d30('0x5c')](_0x5e5bc1);}})['then'](function(_0x3695e6){if(_0x3695e6){return _0x3695e6?{'count':_0x2497cc,'rows':_0x3695e6}:null;}})[_0x9d30('0x22')](respondWithResult(_0x1e4ea1,null))[_0x9d30('0x42')](handleError(_0x1e4ea1,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 9ff58a5..d2f7daa 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 _0x2494=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','./trigger.attributes','define','tools_triggers'];(function(_0x549d41,_0x526355){var _0x44b860=function(_0x5c64e8){while(--_0x5c64e8){_0x549d41['push'](_0x549d41['shift']());}};_0x44b860(++_0x526355);}(_0x2494,0x82));var _0x4249=function(_0x55c116,_0x15d999){_0x55c116=_0x55c116-0x0;var _0x4ceb93=_0x2494[_0x55c116];return _0x4ceb93;};'use strict';var _=require(_0x4249('0x0'));var util=require('util');var logger=require(_0x4249('0x1'))(_0x4249('0x2'));var moment=require(_0x4249('0x3'));var BPromise=require(_0x4249('0x4'));var rp=require(_0x4249('0x5'));var fs=require('fs');var path=require(_0x4249('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4249('0x7'));module['exports']=function(_0x3c2d8d,_0x1d4ca8){return _0x3c2d8d[_0x4249('0x8')]('Trigger',attributes,{'tableName':_0x4249('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4350=['../../config/environment','./trigger.attributes','exports','tools_triggers','lodash','util','api','bluebird','request-promise','rimraf'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4350,0x1d0));var _0x0435=function(_0x127f1e,_0x102361){_0x127f1e=_0x127f1e-0x0;var _0x24a001=_0x4350[_0x127f1e];return _0x24a001;};'use strict';var _=require(_0x0435('0x0'));var util=require(_0x0435('0x1'));var logger=require('../../config/logger')(_0x0435('0x2'));var moment=require('moment');var BPromise=require(_0x0435('0x3'));var rp=require(_0x0435('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0435('0x5'));var config=require(_0x0435('0x6'));var attributes=require(_0x0435('0x7'));module[_0x0435('0x8')]=function(_0x58a62d,_0x580eeb){return _0x58a62d['define']('Trigger',attributes,{'tableName':_0x0435('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 58b2b06..adf1674 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 _0xec9f=['ShowTrigger','find','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','Trigger,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetTrigger','Trigger','options','raw','where','limit','include','map','model','attributes','then','debug'];(function(_0x5ae1a2,_0x3601ba){var _0x9ac42f=function(_0x16abe8){while(--_0x16abe8){_0x5ae1a2['push'](_0x5ae1a2['shift']());}};_0x9ac42f(++_0x3601ba);}(_0xec9f,0xf8));var _0xfec9=function(_0x55a007,_0x4a51b9){_0x55a007=_0x55a007-0x0;var _0x3a1867=_0xec9f[_0x55a007];return _0x3a1867;};'use strict';var _=require(_0xfec9('0x0'));var util=require(_0xfec9('0x1'));var moment=require(_0xfec9('0x2'));var BPromise=require(_0xfec9('0x3'));var rs=require(_0xfec9('0x4'));var fs=require('fs');var Redis=require(_0xfec9('0x5'));var db=require(_0xfec9('0x6'))['db'];var utils=require(_0xfec9('0x7'));var logger=require(_0xfec9('0x8'))(_0xfec9('0x9'));var config=require(_0xfec9('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xfec9('0xb')][_0xfec9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x47edd2,_0x401c38,_0x5734fa){return new BPromise(function(_0xfe9bf1,_0x4f85d7){return client['request'](_0x47edd2,_0x5734fa)['then'](function(_0x2b8fd){logger[_0xfec9('0xd')](_0xfec9('0xe'),_0x401c38,_0xfec9('0xf'));logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x401c38,_0xfec9('0xf'),JSON['stringify'](_0x2b8fd));if(_0x2b8fd[_0xfec9('0x10')]){if(_0x2b8fd[_0xfec9('0x10')]['code']===0x1f4){logger[_0xfec9('0x10')]('Trigger,\x20%s,\x20%s',_0x401c38,_0x2b8fd[_0xfec9('0x10')][_0xfec9('0x11')]);return _0x4f85d7(_0x2b8fd[_0xfec9('0x10')][_0xfec9('0x11')]);}logger[_0xfec9('0x10')](_0xfec9('0xe'),_0x401c38,_0x2b8fd[_0xfec9('0x10')][_0xfec9('0x11')]);return _0xfe9bf1(_0x2b8fd['error'][_0xfec9('0x11')]);}else{logger[_0xfec9('0xd')](_0xfec9('0xe'),_0x401c38,_0xfec9('0xf'));_0xfe9bf1(_0x2b8fd[_0xfec9('0x12')]['message']);}})[_0xfec9('0x13')](function(_0x329a3b){logger[_0xfec9('0x10')](_0xfec9('0xe'),_0x401c38,_0x329a3b);_0x4f85d7(_0x329a3b);});});}exports[_0xfec9('0x14')]=function(_0x4f2d9f){var _0x363e74=this;return new Promise(function(_0x50a960,_0x1e88bb){return db[_0xfec9('0x15')]['findAll']({'raw':_0x4f2d9f['options']?_0x4f2d9f[_0xfec9('0x16')][_0xfec9('0x17')]===undefined?!![]:![]:!![],'where':_0x4f2d9f['options']?_0x4f2d9f[_0xfec9('0x16')][_0xfec9('0x18')]||null:null,'attributes':_0x4f2d9f[_0xfec9('0x16')]?_0x4f2d9f[_0xfec9('0x16')]['attributes']||null:null,'limit':_0x4f2d9f[_0xfec9('0x16')]?_0x4f2d9f[_0xfec9('0x16')][_0xfec9('0x19')]||null:null,'include':_0x4f2d9f['options']?_0x4f2d9f[_0xfec9('0x16')][_0xfec9('0x1a')]?_[_0xfec9('0x1b')](_0x4f2d9f[_0xfec9('0x16')][_0xfec9('0x1a')],function(_0x309b7c){return{'model':db[_0x309b7c[_0xfec9('0x1c')]],'as':_0x309b7c['as'],'attributes':_0x309b7c[_0xfec9('0x1d')],'include':_0x309b7c[_0xfec9('0x1a')]?_[_0xfec9('0x1b')](_0x309b7c[_0xfec9('0x1a')],function(_0x5a7529){return{'model':db[_0x5a7529[_0xfec9('0x1c')]],'as':_0x5a7529['as'],'attributes':_0x5a7529['attributes'],'include':_0x5a7529[_0xfec9('0x1a')]?_['map'](_0x5a7529[_0xfec9('0x1a')],function(_0x3b7375){return{'model':db[_0x3b7375[_0xfec9('0x1c')]],'as':_0x3b7375['as'],'attributes':_0x3b7375['attributes']};}):[]};}):[]};}):[]:[]})[_0xfec9('0x1e')](function(_0xb209a9){logger[_0xfec9('0xd')](_0xfec9('0x14'),_0x4f2d9f);logger[_0xfec9('0x1f')](_0xfec9('0x14'),_0x4f2d9f,JSON['stringify'](_0xb209a9));_0x50a960(_0xb209a9);})[_0xfec9('0x13')](function(_0x3a224c){logger['error']('GetTrigger',_0x3a224c[_0xfec9('0x11')],_0x4f2d9f);_0x1e88bb(_0x363e74[_0xfec9('0x10')](0x1f4,_0x3a224c['message']));});});};exports[_0xfec9('0x20')]=function(_0x49d7a7){var _0x47172b=this;return new Promise(function(_0x54cb77,_0x44c030){return db[_0xfec9('0x15')][_0xfec9('0x21')]({'raw':_0x49d7a7[_0xfec9('0x16')]?_0x49d7a7[_0xfec9('0x16')][_0xfec9('0x17')]===undefined?!![]:![]:!![],'where':_0x49d7a7['options']?_0x49d7a7[_0xfec9('0x16')][_0xfec9('0x18')]||null:null,'attributes':_0x49d7a7[_0xfec9('0x16')]?_0x49d7a7[_0xfec9('0x16')][_0xfec9('0x1d')]||null:null,'include':_0x49d7a7[_0xfec9('0x16')]?_0x49d7a7[_0xfec9('0x16')][_0xfec9('0x1a')]?_['map'](_0x49d7a7[_0xfec9('0x16')][_0xfec9('0x1a')],function(_0x1611b6){return{'model':db[_0x1611b6[_0xfec9('0x1c')]],'as':_0x1611b6['as'],'attributes':_0x1611b6[_0xfec9('0x1d')],'include':_0x1611b6[_0xfec9('0x1a')]?_[_0xfec9('0x1b')](_0x1611b6[_0xfec9('0x1a')],function(_0x48db95){return{'model':db[_0x48db95[_0xfec9('0x1c')]],'as':_0x48db95['as'],'attributes':_0x48db95[_0xfec9('0x1d')],'include':_0x48db95[_0xfec9('0x1a')]?_[_0xfec9('0x1b')](_0x48db95[_0xfec9('0x1a')],function(_0x1fcc8f){return{'model':db[_0x1fcc8f['model']],'as':_0x1fcc8f['as'],'attributes':_0x1fcc8f[_0xfec9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfec9('0x1e')](function(_0x36183d){logger[_0xfec9('0xd')](_0xfec9('0x20'),_0x49d7a7);logger[_0xfec9('0x1f')](_0xfec9('0x20'),_0x49d7a7,JSON[_0xfec9('0x22')](_0x36183d));_0x54cb77(_0x36183d);})[_0xfec9('0x13')](function(_0x5623f6){logger['error'](_0xfec9('0x20'),_0x5623f6[_0xfec9('0x11')],_0x49d7a7);_0x44c030(_0x47172b['error'](0x1f4,_0x5623f6[_0xfec9('0x11')]));});});}; \ No newline at end of file +var _0x5583=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','Trigger','options','raw','where','attributes','limit','map','include','model','stringify','find','ShowTrigger','moment','bluebird','randomstring','ioredis'];(function(_0x1fc36f,_0x464552){var _0x2856b4=function(_0x2487f3){while(--_0x2487f3){_0x1fc36f['push'](_0x1fc36f['shift']());}};_0x2856b4(++_0x464552);}(_0x5583,0x164));var _0x3558=function(_0x3a7e01,_0x51204c){_0x3a7e01=_0x3a7e01-0x0;var _0x5b8398=_0x5583[_0x3a7e01];return _0x5b8398;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3558('0x0'));var BPromise=require(_0x3558('0x1'));var rs=require(_0x3558('0x2'));var fs=require('fs');var Redis=require(_0x3558('0x3'));var db=require(_0x3558('0x4'))['db'];var utils=require(_0x3558('0x5'));var logger=require(_0x3558('0x6'))(_0x3558('0x7'));var config=require(_0x3558('0x8'));var jayson=require(_0x3558('0x9'));var client=jayson['client'][_0x3558('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x425898,_0x19fc7a,_0x46070e){return new BPromise(function(_0x5ac1c7,_0x3c7b8f){return client[_0x3558('0xb')](_0x425898,_0x46070e)[_0x3558('0xc')](function(_0x5889f7){logger[_0x3558('0xd')]('Trigger,\x20%s,\x20%s',_0x19fc7a,_0x3558('0xe'));logger[_0x3558('0xf')](_0x3558('0x10'),_0x19fc7a,_0x3558('0xe'),JSON['stringify'](_0x5889f7));if(_0x5889f7['error']){if(_0x5889f7[_0x3558('0x11')][_0x3558('0x12')]===0x1f4){logger[_0x3558('0x11')](_0x3558('0x13'),_0x19fc7a,_0x5889f7[_0x3558('0x11')]['message']);return _0x3c7b8f(_0x5889f7['error'][_0x3558('0x14')]);}logger[_0x3558('0x11')](_0x3558('0x13'),_0x19fc7a,_0x5889f7[_0x3558('0x11')][_0x3558('0x14')]);return _0x5ac1c7(_0x5889f7[_0x3558('0x11')]['message']);}else{logger['info'](_0x3558('0x13'),_0x19fc7a,_0x3558('0xe'));_0x5ac1c7(_0x5889f7[_0x3558('0x15')][_0x3558('0x14')]);}})[_0x3558('0x16')](function(_0x5b0192){logger['error'](_0x3558('0x13'),_0x19fc7a,_0x5b0192);_0x3c7b8f(_0x5b0192);});});}exports[_0x3558('0x17')]=function(_0x2153da){var _0x59819f=this;return new Promise(function(_0x5209d5,_0x29f35a){return db[_0x3558('0x18')]['findAll']({'raw':_0x2153da[_0x3558('0x19')]?_0x2153da[_0x3558('0x19')][_0x3558('0x1a')]===undefined?!![]:![]:!![],'where':_0x2153da[_0x3558('0x19')]?_0x2153da[_0x3558('0x19')][_0x3558('0x1b')]||null:null,'attributes':_0x2153da[_0x3558('0x19')]?_0x2153da['options'][_0x3558('0x1c')]||null:null,'limit':_0x2153da[_0x3558('0x19')]?_0x2153da[_0x3558('0x19')][_0x3558('0x1d')]||null:null,'include':_0x2153da['options']?_0x2153da['options']['include']?_[_0x3558('0x1e')](_0x2153da[_0x3558('0x19')][_0x3558('0x1f')],function(_0x3a11f5){return{'model':db[_0x3a11f5[_0x3558('0x20')]],'as':_0x3a11f5['as'],'attributes':_0x3a11f5[_0x3558('0x1c')],'include':_0x3a11f5['include']?_[_0x3558('0x1e')](_0x3a11f5[_0x3558('0x1f')],function(_0x3ac1e0){return{'model':db[_0x3ac1e0[_0x3558('0x20')]],'as':_0x3ac1e0['as'],'attributes':_0x3ac1e0['attributes'],'include':_0x3ac1e0[_0x3558('0x1f')]?_[_0x3558('0x1e')](_0x3ac1e0[_0x3558('0x1f')],function(_0x3fa70e){return{'model':db[_0x3fa70e[_0x3558('0x20')]],'as':_0x3fa70e['as'],'attributes':_0x3fa70e[_0x3558('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3558('0xc')](function(_0x367d06){logger['info']('GetTrigger',_0x2153da);logger[_0x3558('0xf')]('GetTrigger',_0x2153da,JSON[_0x3558('0x21')](_0x367d06));_0x5209d5(_0x367d06);})[_0x3558('0x16')](function(_0x275bae){logger['error'](_0x3558('0x17'),_0x275bae[_0x3558('0x14')],_0x2153da);_0x29f35a(_0x59819f['error'](0x1f4,_0x275bae['message']));});});};exports['ShowTrigger']=function(_0x375698){var _0x391fb8=this;return new Promise(function(_0x46b0bd,_0x427384){return db[_0x3558('0x18')][_0x3558('0x22')]({'raw':_0x375698['options']?_0x375698[_0x3558('0x19')][_0x3558('0x1a')]===undefined?!![]:![]:!![],'where':_0x375698[_0x3558('0x19')]?_0x375698[_0x3558('0x19')]['where']||null:null,'attributes':_0x375698['options']?_0x375698['options']['attributes']||null:null,'include':_0x375698[_0x3558('0x19')]?_0x375698[_0x3558('0x19')]['include']?_[_0x3558('0x1e')](_0x375698[_0x3558('0x19')][_0x3558('0x1f')],function(_0x4dab76){return{'model':db[_0x4dab76[_0x3558('0x20')]],'as':_0x4dab76['as'],'attributes':_0x4dab76['attributes'],'include':_0x4dab76[_0x3558('0x1f')]?_[_0x3558('0x1e')](_0x4dab76[_0x3558('0x1f')],function(_0x3da0c1){return{'model':db[_0x3da0c1['model']],'as':_0x3da0c1['as'],'attributes':_0x3da0c1[_0x3558('0x1c')],'include':_0x3da0c1[_0x3558('0x1f')]?_[_0x3558('0x1e')](_0x3da0c1[_0x3558('0x1f')],function(_0x3d64f6){return{'model':db[_0x3d64f6['model']],'as':_0x3d64f6['as'],'attributes':_0x3d64f6[_0x3558('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3558('0xc')](function(_0x35edb1){logger[_0x3558('0xd')](_0x3558('0x23'),_0x375698);logger['debug'](_0x3558('0x23'),_0x375698,JSON[_0x3558('0x21')](_0x35edb1));_0x46b0bd(_0x35edb1);})[_0x3558('0x16')](function(_0x26f024){logger[_0x3558('0x11')](_0x3558('0x23'),_0x26f024[_0x3558('0x14')],_0x375698);_0x427384(_0x391fb8[_0x3558('0x11')](0x1f4,_0x26f024[_0x3558('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 524d60a..650a6d0 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 _0x21ab=['index','get','post','/:id/clone','clone','create','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./trunk.controller','isAuthenticated'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x21ab,0x14d));var _0xb21a=function(_0x2fa411,_0x1f755a){_0x2fa411=_0x2fa411-0x0;var _0x465756=_0x21ab[_0x2fa411];return _0x465756;};'use strict';var multer=require(_0xb21a('0x0'));var util=require(_0xb21a('0x1'));var path=require('path');var timeout=require(_0xb21a('0x2'));var express=require(_0xb21a('0x3'));var router=express[_0xb21a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb21a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb21a('0x6'));var controller=require(_0xb21a('0x7'));router['get']('/',auth[_0xb21a('0x8')](),controller[_0xb21a('0x9')]);router[_0xb21a('0xa')]('/:id',auth[_0xb21a('0x8')](),controller['show']);router[_0xb21a('0xb')](_0xb21a('0xc'),auth['isAuthenticated'](),controller[_0xb21a('0xd')]);router[_0xb21a('0xb')]('/',auth[_0xb21a('0x8')](),controller[_0xb21a('0xe')]);router['put'](_0xb21a('0xf'),auth['isAuthenticated'](),controller[_0xb21a('0x10')]);router[_0xb21a('0x11')](_0xb21a('0xf'),auth[_0xb21a('0x8')](),controller[_0xb21a('0x12')]);module['exports']=router; \ No newline at end of file +var _0xeb10=['index','post','clone','create','put','/:id','update','delete','destroy','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated'];(function(_0x499108,_0x30b78e){var _0x288713=function(_0x5e0cbb){while(--_0x5e0cbb){_0x499108['push'](_0x499108['shift']());}};_0x288713(++_0x30b78e);}(_0xeb10,0x1dd));var _0x0eb1=function(_0x3bfe99,_0x3b9b4c){_0x3bfe99=_0x3bfe99-0x0;var _0xeb466f=_0xeb10[_0x3bfe99];return _0xeb466f;};'use strict';var multer=require(_0x0eb1('0x0'));var util=require('util');var path=require(_0x0eb1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0eb1('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0eb1('0x3'));var interaction=require(_0x0eb1('0x4'));var config=require(_0x0eb1('0x5'));var controller=require(_0x0eb1('0x6'));router[_0x0eb1('0x7')]('/',auth[_0x0eb1('0x8')](),controller[_0x0eb1('0x9')]);router[_0x0eb1('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0eb1('0xa')]('/:id/clone',auth[_0x0eb1('0x8')](),controller[_0x0eb1('0xb')]);router[_0x0eb1('0xa')]('/',auth['isAuthenticated'](),controller[_0x0eb1('0xc')]);router[_0x0eb1('0xd')](_0x0eb1('0xe'),auth[_0x0eb1('0x8')](),controller[_0x0eb1('0xf')]);router[_0x0eb1('0x10')](_0x0eb1('0xe'),auth[_0x0eb1('0x8')](),controller[_0x0eb1('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index c8ccaf8..497ac35 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 _0xd8c3=['STRING','name','ENUM','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','nonat','update','outgoing','yes','force_rport,comedia','setDataValue','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','INTEGER','accept','originate','uas','certificate','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xd8c3,0x193));var _0x3d8c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xd8c3[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x3d8c('0x0'));module[_0x3d8c('0x1')]={'name':{'type':Sequelize[_0x3d8c('0x2')],'allowNull':![],'unique':_0x3d8c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3d8c('0x4')](_0x3d8c('0x5'),'user','peer'),'allowNull':![],'defaultValue':_0x3d8c('0x5')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3d8c('0x6')},'callingpres':{'type':Sequelize[_0x3d8c('0x4')](_0x3d8c('0x7'),_0x3d8c('0x8'),_0x3d8c('0x9'),'ALLOWED','PROHIB_NOT_SCREENED',_0x3d8c('0xa'),'PROHIB_FAILED_SCREEN',_0x3d8c('0xb'))},'deny':{'type':Sequelize[_0x3d8c('0x2')]},'permit':{'type':Sequelize[_0x3d8c('0x2')]},'secret':{'type':Sequelize[_0x3d8c('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x2cc908){this['setDataValue'](_0x3d8c('0xc'),_0x2cc908?_0x2cc908[_0x3d8c('0xd')](','):null);},'get':function(){return this[_0x3d8c('0xe')]('transport')?this[_0x3d8c('0xe')](_0x3d8c('0xc'))['split'](','):null;},'comment':_0x3d8c('0xf')},'dtmfmode':{'type':Sequelize['ENUM'](_0x3d8c('0x10'),'info',_0x3d8c('0x11'),_0x3d8c('0x12'),_0x3d8c('0x13')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x3d8c('0x4')]('yes','no',_0x3d8c('0x14'),_0x3d8c('0x15'),_0x3d8c('0x16')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x3d8c('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3d8c('0x2')]},'directmediadeny':{'type':Sequelize[_0x3d8c('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x3d8c('0x18'),'set':function(_0x3c49cd){this[_0x3d8c('0x19')](_0x3d8c('0x1a'),_0x3c49cd?_0x3c49cd[_0x3d8c('0xd')](','):null);},'get':function(){return this[_0x3d8c('0xe')](_0x3d8c('0x1a'))?this[_0x3d8c('0xe')](_0x3d8c('0x1a'))[_0x3d8c('0x1b')](','):null;},'comment':_0x3d8c('0x1c')},'callgroup':{'type':Sequelize[_0x3d8c('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x3d8c('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x3d8c('0x2')]},'language':{'type':Sequelize[_0x3d8c('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3d8c('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x3d8c('0x1d')},'allow':{'type':Sequelize[_0x3d8c('0x2')],'allowNull':![],'defaultValue':_0x3d8c('0x1e'),'set':function(_0x2ab3d9){this['setDataValue'](_0x3d8c('0x1f'),_0x2ab3d9?_0x2ab3d9[_0x3d8c('0xd')](';'):_0x3d8c('0x1e'));},'get':function(){return this[_0x3d8c('0xe')](_0x3d8c('0x1f'))?this['getDataValue'](_0x3d8c('0x1f'))[_0x3d8c('0x1b')](';'):null;},'comment':_0x3d8c('0x20')},'autoframing':{'type':Sequelize[_0x3d8c('0x4')](_0x3d8c('0x17'),'no')},'insecure':{'type':Sequelize[_0x3d8c('0x2')],'defaultValue':'port,invite','set':function(_0x4a938e){this['setDataValue'](_0x3d8c('0x21'),_0x4a938e?_0x4a938e['join'](','):null);},'get':function(){return this[_0x3d8c('0xe')](_0x3d8c('0x21'))?this[_0x3d8c('0xe')](_0x3d8c('0x21'))['split'](','):null;},'comment':_0x3d8c('0x22')},'trustrpid':{'type':Sequelize[_0x3d8c('0x4')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3d8c('0x4')](_0x3d8c('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3d8c('0x4')](_0x3d8c('0x17'),'no','never')},'promiscredir':{'type':Sequelize[_0x3d8c('0x4')](_0x3d8c('0x17'),'no')},'useclientcode':{'type':Sequelize[_0x3d8c('0x4')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x3d8c('0x2')]},'callerid':{'type':Sequelize[_0x3d8c('0x2')],'defaultValue':_0x3d8c('0x23')},'amaflags':{'type':Sequelize[_0x3d8c('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0x3d8c('0x17'),'no'),'defaultValue':_0x3d8c('0x17')},'busylevel':{'type':Sequelize[_0x3d8c('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x3d8c('0x4')]('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no')},'allowtransfer':{'type':Sequelize[_0x3d8c('0x4')](_0x3d8c('0x17'),'no')},'ignoresdpversion':{'type':Sequelize[_0x3d8c('0x4')](_0x3d8c('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0x3d8c('0x2')]},'template':{'type':Sequelize[_0x3d8c('0x2')]},'videosupport':{'type':Sequelize[_0x3d8c('0x4')](_0x3d8c('0x17'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x3d8c('0x4')](_0x3d8c('0x17'),'no')},'mailbox':{'type':Sequelize[_0x3d8c('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0x3d8c('0x25'),'refuse',_0x3d8c('0x26'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x3d8c('0x4')]('uac',_0x3d8c('0x27')),'defaultValue':_0x3d8c('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0x3d8c('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x3d8c('0x2')]},'fromuser':{'type':Sequelize[_0x3d8c('0x2')]},'port':{'type':Sequelize[_0x3d8c('0x24')](0x5)},'qualify':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x3d8c('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x3d8c('0x2')]},'defaultuser':{'type':Sequelize[_0x3d8c('0x2')]},'rtptimeout':{'type':Sequelize[_0x3d8c('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x3d8c('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0x3d8c('0x4')](_0x3d8c('0x17'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3d8c('0x2')]},'callbackextension':{'type':Sequelize[_0x3d8c('0x2')]},'timert1':{'type':Sequelize[_0x3d8c('0x24')](0xb)},'timerb':{'type':Sequelize[_0x3d8c('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x3d8c('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x3d8c('0x2')]},'contactdeny':{'type':Sequelize[_0x3d8c('0x2')]},'contactacl':{'type':Sequelize[_0x3d8c('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x3d8c('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x3d8c('0x24')](0xb)},'encryption':{'type':Sequelize[_0x3d8c('0x4')](_0x3d8c('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3d8c('0x4')](_0x3d8c('0x17'),'no')},'force_avp':{'type':Sequelize[_0x3d8c('0x4')](_0x3d8c('0x17'),'no')},'icesupport':{'type':Sequelize[_0x3d8c('0x4')](_0x3d8c('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0x3d8c('0x4')](_0x3d8c('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0x3d8c('0x4')](_0x3d8c('0x17'),'no','fingerprint',_0x3d8c('0x28'))},'dtlsrekey':{'type':Sequelize[_0x3d8c('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x3d8c('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x3d8c('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x3d8c('0x4')]('active','passive',_0x3d8c('0x29')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3d8c('0x2')]},'usereqphone':{'type':Sequelize[_0x3d8c('0x4')](_0x3d8c('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3d8c('0x2')]},'recordofffeature':{'type':Sequelize[_0x3d8c('0x2')]},'call_limit':{'type':Sequelize[_0x3d8c('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x3d8c('0x4')](_0x3d8c('0x17'),'no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x3d8c('0x2')]},'mohsuggest':{'type':Sequelize[_0x3d8c('0x2')]},'parkinglot':{'type':Sequelize[_0x3d8c('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0x3d8c('0x2a')},'canreinvite':{'type':Sequelize[_0x3d8c('0x4')](_0x3d8c('0x17'),'no',_0x3d8c('0x14'),_0x3d8c('0x15'),_0x3d8c('0x2b')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x3d8c('0x2')]},'otherFields':{'type':Sequelize[_0x3d8c('0x2')]},'active':{'type':Sequelize[_0x3d8c('0x2c')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x3d8c('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0xd79c=['accept','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','exports','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','STRING','udp','setDataValue','transport','join','getDataValue','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER','always'];(function(_0x3120f4,_0x513570){var _0x4a1d63=function(_0x75825f){while(--_0x75825f){_0x3120f4['push'](_0x3120f4['shift']());}};_0x4a1d63(++_0x513570);}(_0xd79c,0x14a));var _0xcd79=function(_0x10f1ab,_0x453815){_0x10f1ab=_0x10f1ab-0x0;var _0x421001=_0xd79c[_0x10f1ab];return _0x421001;};'use strict';var Sequelize=require('sequelize');module[_0xcd79('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xcd79('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xcd79('0x2')](_0xcd79('0x3'),_0xcd79('0x4'),_0xcd79('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcd79('0x6')},'callingpres':{'type':Sequelize[_0xcd79('0x2')]('ALLOWED_NOT_SCREENED',_0xcd79('0x7'),_0xcd79('0x8'),_0xcd79('0x9'),_0xcd79('0xa'),'PROHIB_PASSED_SCREEN',_0xcd79('0xb'),_0xcd79('0xc'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0xcd79('0xd')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xcd79('0xd')]},'remotesecret':{'type':Sequelize[_0xcd79('0xd')]},'transport':{'type':Sequelize[_0xcd79('0xd')],'defaultValue':_0xcd79('0xe'),'set':function(_0x197794){this[_0xcd79('0xf')](_0xcd79('0x10'),_0x197794?_0x197794[_0xcd79('0x11')](','):null);},'get':function(){return this['getDataValue'](_0xcd79('0x10'))?this[_0xcd79('0x12')](_0xcd79('0x10'))[_0xcd79('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xcd79('0x2')](_0xcd79('0x14'),_0xcd79('0x15'),_0xcd79('0x16'),_0xcd79('0x17'),_0xcd79('0x18')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0xcd79('0x19'),'no',_0xcd79('0x1a'),_0xcd79('0x1b'),_0xcd79('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xcd79('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xcd79('0xd')]},'nat':{'type':Sequelize[_0xcd79('0xd')],'defaultValue':_0xcd79('0x1d'),'set':function(_0x1d9f32){this[_0xcd79('0xf')](_0xcd79('0x1e'),_0x1d9f32?_0x1d9f32[_0xcd79('0x11')](','):null);},'get':function(){return this['getDataValue'](_0xcd79('0x1e'))?this[_0xcd79('0x12')](_0xcd79('0x1e'))[_0xcd79('0x13')](','):null;},'comment':_0xcd79('0x1f')},'callgroup':{'type':Sequelize[_0xcd79('0xd')]},'namedcallgroup':{'type':Sequelize[_0xcd79('0xd')]},'pickupgroup':{'type':Sequelize[_0xcd79('0xd')]},'namedpickupgroup':{'type':Sequelize[_0xcd79('0xd')]},'language':{'type':Sequelize[_0xcd79('0xd')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xcd79('0xd')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xcd79('0xd')],'defaultValue':_0xcd79('0x20')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcd79('0x21'),'set':function(_0x313dfa){this[_0xcd79('0xf')](_0xcd79('0x22'),_0x313dfa?_0x313dfa['join'](';'):_0xcd79('0x21'));},'get':function(){return this['getDataValue'](_0xcd79('0x22'))?this['getDataValue'](_0xcd79('0x22'))['split'](';'):null;},'comment':_0xcd79('0x23')},'autoframing':{'type':Sequelize[_0xcd79('0x2')](_0xcd79('0x19'),'no')},'insecure':{'type':Sequelize[_0xcd79('0xd')],'defaultValue':_0xcd79('0x24'),'set':function(_0xaa8b56){this[_0xcd79('0xf')](_0xcd79('0x25'),_0xaa8b56?_0xaa8b56[_0xcd79('0x11')](','):null);},'get':function(){return this[_0xcd79('0x12')](_0xcd79('0x25'))?this['getDataValue'](_0xcd79('0x25'))[_0xcd79('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xcd79('0x2')](_0xcd79('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xcd79('0x2')]('yes','no',_0xcd79('0x26'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0xcd79('0x2')](_0xcd79('0x19'),'no')},'accountcode':{'type':Sequelize[_0xcd79('0x27')](0xb)},'setvar':{'type':Sequelize[_0xcd79('0xd')]},'callerid':{'type':Sequelize[_0xcd79('0xd')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xcd79('0xd')]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xcd79('0x2')](_0xcd79('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0xcd79('0x2')](_0xcd79('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0xcd79('0x2')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xcd79('0x2')](_0xcd79('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0xcd79('0xd')]},'template':{'type':Sequelize[_0xcd79('0xd')]},'videosupport':{'type':Sequelize[_0xcd79('0x2')]('yes','no',_0xcd79('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xcd79('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xcd79('0x19'),'no')},'mailbox':{'type':Sequelize[_0xcd79('0xd')]},'session_timers':{'type':Sequelize[_0xcd79('0x2')](_0xcd79('0x29'),'refuse','originate')},'session_expires':{'type':Sequelize[_0xcd79('0x27')](0xb)},'session_minse':{'type':Sequelize[_0xcd79('0x27')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xcd79('0x2a'),'uas'),'defaultValue':_0xcd79('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0xcd79('0xd')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0xcd79('0xd')]},'fromuser':{'type':Sequelize[_0xcd79('0xd')]},'port':{'type':Sequelize[_0xcd79('0x27')](0x5)},'qualify':{'type':Sequelize[_0xcd79('0x2')](_0xcd79('0x19'),'no'),'defaultValue':_0xcd79('0x19')},'keepalive':{'type':Sequelize[_0xcd79('0x27')](0xb)},'defaultip':{'type':Sequelize[_0xcd79('0xd')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xcd79('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xcd79('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xcd79('0x27')](0xb)},'sendrpid':{'type':Sequelize[_0xcd79('0x2')]('yes','no',_0xcd79('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xcd79('0xd')]},'callbackextension':{'type':Sequelize[_0xcd79('0xd')]},'timert1':{'type':Sequelize[_0xcd79('0x27')](0xb)},'timerb':{'type':Sequelize[_0xcd79('0x27')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xcd79('0xd')]},'contactacl':{'type':Sequelize[_0xcd79('0xd')]},'unsolicited_mailbox':{'type':Sequelize[_0xcd79('0xd')]},'use_q850_reason':{'type':Sequelize[_0xcd79('0xd')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xcd79('0x2')](_0xcd79('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xcd79('0x2')](_0xcd79('0x19'),'no')},'force_avp':{'type':Sequelize[_0xcd79('0x2')]('yes','no')},'icesupport':{'type':Sequelize['ENUM'](_0xcd79('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0xcd79('0x2')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xcd79('0x2')](_0xcd79('0x19'),'no',_0xcd79('0x2d'),_0xcd79('0x2e'))},'dtlsrekey':{'type':Sequelize[_0xcd79('0x27')](0xb)},'dtlscertfile':{'type':Sequelize[_0xcd79('0xd')]},'dtlsprivatekey':{'type':Sequelize[_0xcd79('0xd')]},'dtlscipher':{'type':Sequelize[_0xcd79('0xd')]},'dtlscafile':{'type':Sequelize[_0xcd79('0xd')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xcd79('0x2')](_0xcd79('0x2f'),_0xcd79('0x30'),_0xcd79('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xcd79('0xd')]},'usereqphone':{'type':Sequelize['ENUM'](_0xcd79('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xcd79('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xcd79('0x2')](_0xcd79('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0xcd79('0x2')](_0xcd79('0x19'),'no')},'vmexten':{'type':Sequelize[_0xcd79('0xd')]},'mohinterpret':{'type':Sequelize[_0xcd79('0xd')]},'mohsuggest':{'type':Sequelize[_0xcd79('0xd')]},'parkinglot':{'type':Sequelize[_0xcd79('0xd')]},'description':{'type':Sequelize[_0xcd79('0xd')]},'host':{'type':Sequelize[_0xcd79('0xd')],'defaultValue':_0xcd79('0x32')},'canreinvite':{'type':Sequelize[_0xcd79('0x2')](_0xcd79('0x19'),'no',_0xcd79('0x1a'),_0xcd79('0x1b'),_0xcd79('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xcd79('0xd')]},'active':{'type':Sequelize[_0xcd79('0x34')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index e1b1bde..26af446 100644 --- a/server/api/trunk/trunk.controller.js +++ b/server/api/trunk/trunk.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x24ca=['lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','get','Trunks','UserProfileResource','destroy','then','end','name','send','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','rawAttributes','keys','find','clone','length','omit','createdAt','updatedAt','create','user','role','userProfileId','autoAssociation','body','join','root','server/files/templates/trunk.ejs','readFileSync','server/files/templates/registry.ejs','utf8','writeFileSync','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_trunks.conf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x1008da,_0x1bdec0){var _0x4ed756=function(_0x4ac079){while(--_0x4ac079){_0x1008da['push'](_0x1008da['shift']());}};_0x4ed756(++_0x1bdec0);}(_0x24ca,0x1bc));var _0xa24c=function(_0x22868f,_0x450f48){_0x22868f=_0x22868f-0x0;var _0x97bc75=_0x24ca[_0x22868f];return _0x97bc75;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];var jayson=require(_0xa24c('0x1b'));var client=jayson[_0xa24c('0x1c')][_0xa24c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5a9486,_0x3ad0bf,_0x3c23fc,_0x26ff28){return new BPromise(function(_0x2fcd8b,_0x1cb08e){var _0x2d185c=_0x26ff28||client;return _0x2d185c[_0xa24c('0x1e')](_0x5a9486,_0x3c23fc)['then'](function(_0x47a063){logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,'request\x20sent');logger['debug'](_0xa24c('0x21'),_0x3ad0bf,_0xa24c('0x22'),JSON['stringify'](_0x47a063));if(_0x47a063[_0xa24c('0x23')]){if(_0x47a063['error'][_0xa24c('0x24')]===0x1f4){logger[_0xa24c('0x23')](_0xa24c('0x20'),_0x3ad0bf,_0x47a063[_0xa24c('0x23')]['message']);return _0x1cb08e(_0x47a063[_0xa24c('0x23')][_0xa24c('0x25')]);}logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x47a063['error']['message']);return _0x2fcd8b(_0x47a063['error'][_0xa24c('0x25')]);}else{logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,_0xa24c('0x22'));_0x2fcd8b(_0x47a063['result'][_0xa24c('0x25')]);}})['catch'](function(_0x224bca){logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x224bca);_0x1cb08e(_0x224bca);});});}function respondWithStatusCode(_0x346ee8,_0x363d52){_0x363d52=_0x363d52||0xcc;return function(_0x43a0c0){if(_0x43a0c0){return _0x346ee8[_0xa24c('0x26')](_0x363d52);}return _0x346ee8[_0xa24c('0x27')](_0x363d52)['end']();};}function respondWithResult(_0xec9167,_0x5cc9cb){_0x5cc9cb=_0x5cc9cb||0xc8;return function(_0x2365f9){if(_0x2365f9){return _0xec9167[_0xa24c('0x27')](_0x5cc9cb)[_0xa24c('0x28')](_0x2365f9);}};}function respondWithFilteredResult(_0x51dc3f,_0x1beb55){return function(_0x31c4d9){if(_0x31c4d9){var _0x14fd5a=typeof _0x1beb55[_0xa24c('0x29')]===_0xa24c('0x2a')&&typeof _0x1beb55[_0xa24c('0x2b')]===_0xa24c('0x2a');var _0x5b23f4=_0x31c4d9[_0xa24c('0x2c')];var _0x28675f=_0x14fd5a?0x0:_0x1beb55[_0xa24c('0x29')];var _0x12dbdc=_0x14fd5a?_0x31c4d9['count']:_0x1beb55[_0xa24c('0x29')]+_0x1beb55[_0xa24c('0x2b')];var _0x97c08;if(_0x12dbdc>=_0x5b23f4){_0x12dbdc=_0x5b23f4;_0x97c08=0xc8;}else{_0x97c08=0xce;}_0x51dc3f['status'](_0x97c08);return _0x51dc3f[_0xa24c('0x2d')](_0xa24c('0x2e'),_0x28675f+'-'+_0x12dbdc+'/'+_0x5b23f4)[_0xa24c('0x28')](_0x31c4d9);}return null;};}function patchUpdates(_0x4ae35c){return function(_0x245fb2){try{jsonpatch['apply'](_0x245fb2,_0x4ae35c,!![]);}catch(_0x1102ab){return BPromise[_0xa24c('0x2f')](_0x1102ab);}return _0x245fb2[_0xa24c('0x30')]();};}function saveUpdates(_0x5d025a,_0x1f52f8){return function(_0x53f90){if(_0x53f90){return _0x53f90[_0xa24c('0x31')](_0x5d025a)['then'](function(_0x1c1ed3){return _0x1c1ed3;});}return null;};}function removeEntity(_0x57c340,_0xa20091){return function(_0x42ba21){if(_0x42ba21){return _0x42ba21['destroy']()['then'](function(){var _0x20a276=_0x42ba21[_0xa24c('0x32')]({'plain':!![]});var _0x182e86=_0xa24c('0x33');return db[_0xa24c('0x34')][_0xa24c('0x35')]({'where':{'type':_0x182e86,'resourceId':_0x20a276['id']}})[_0xa24c('0x36')](function(){return _0x42ba21;});})['then'](function(){_0x57c340[_0xa24c('0x27')](0xcc)[_0xa24c('0x37')]();});}};}function handleEntityNotFound(_0x12825d,_0xbd24c0){return function(_0xc6337b){if(!_0xc6337b){_0x12825d[_0xa24c('0x26')](0x194);}return _0xc6337b;};}function handleError(_0x86902f,_0x81d471){_0x81d471=_0x81d471||0x1f4;return function(_0x1ea166){logger[_0xa24c('0x23')](_0x1ea166['stack']);if(_0x1ea166[_0xa24c('0x38')]){delete _0x1ea166[_0xa24c('0x38')];}_0x86902f[_0xa24c('0x27')](_0x81d471)[_0xa24c('0x39')](_0x1ea166);};}exports['index']=function(_0x56a485,_0x19a65f){var _0x56ef4d={},_0xb690b5={},_0x13f272={'count':0x0,'rows':[]};var _0x22a316=_[_0xa24c('0x3a')](db[_0xa24c('0x3b')]['rawAttributes'],function(_0x532875){return{'name':_0x532875[_0xa24c('0x3c')],'type':_0x532875[_0xa24c('0x3d')][_0xa24c('0x3e')]};});_0xb690b5[_0xa24c('0x3f')]=_[_0xa24c('0x3a')](_0x22a316,_0xa24c('0x38'));_0xb690b5['query']=_['keys'](_0x56a485[_0xa24c('0x40')]);_0xb690b5[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],_0xb690b5[_0xa24c('0x40')]);_0x56ef4d['attributes']=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],qs['fields'](_0x56a485['query'][_0xa24c('0x43')]));_0x56ef4d[_0xa24c('0x44')]=_0x56ef4d[_0xa24c('0x44')]['length']?_0x56ef4d['attributes']:_0xb690b5[_0xa24c('0x3f')];if(!_0x56a485[_0xa24c('0x40')][_0xa24c('0x45')](_0xa24c('0x46'))){_0x56ef4d[_0xa24c('0x2b')]=qs[_0xa24c('0x2b')](_0x56a485[_0xa24c('0x40')][_0xa24c('0x2b')]);_0x56ef4d['offset']=qs['offset'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x29')]);}_0x56ef4d[_0xa24c('0x47')]=qs['sort'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x48')]);_0x56ef4d[_0xa24c('0x49')]=qs[_0xa24c('0x41')](_[_0xa24c('0x4a')](_0x56a485[_0xa24c('0x40')],_0xb690b5[_0xa24c('0x41')]),_0x22a316);if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]){_0x56ef4d[_0xa24c('0x49')]=_['merge'](_0x56ef4d[_0xa24c('0x49')],{'$or':_[_0xa24c('0x3a')](_0x22a316,function(_0x39a6cd){if(_0x39a6cd['type']!==_0xa24c('0x4c')){var _0x247d2c={};_0x247d2c[_0x39a6cd[_0xa24c('0x38')]]={'$like':'%'+_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]+'%'};return _0x247d2c;}})});}_0x56ef4d=_[_0xa24c('0x4d')]({},_0x56ef4d,_0x56a485[_0xa24c('0x4e')]);var _0x46f725={'where':_0x56ef4d[_0xa24c('0x49')]};return db[_0xa24c('0x3b')][_0xa24c('0x2c')](_0x46f725)['then'](function(_0x29a84d){_0x13f272[_0xa24c('0x2c')]=_0x29a84d;if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x56ef4d[_0xa24c('0x50')]=[{'all':!![]}];}return db[_0xa24c('0x3b')][_0xa24c('0x51')](_0x56ef4d);})[_0xa24c('0x36')](function(_0x184179){_0x13f272['rows']=_0x184179;return _0x13f272;})['then'](respondWithFilteredResult(_0x19a65f,_0x56ef4d))[_0xa24c('0x52')](handleError(_0x19a65f,null));};exports['show']=function(_0xc078ef,_0x1f436c){var _0x4ec677={'raw':![],'where':{'id':_0xc078ef[_0xa24c('0x53')]['id']}},_0x24b3df={};_0x24b3df[_0xa24c('0x3f')]=_['keys'](db['Trunk'][_0xa24c('0x54')]);_0x24b3df['query']=_[_0xa24c('0x55')](_0xc078ef[_0xa24c('0x40')]);_0x24b3df[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],_0x24b3df[_0xa24c('0x40')]);_0x4ec677[_0xa24c('0x44')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0xc078ef['query'][_0xa24c('0x43')]));_0x4ec677[_0xa24c('0x44')]=_0x4ec677[_0xa24c('0x44')]['length']?_0x4ec677['attributes']:_0x24b3df['model'];if(_0xc078ef[_0xa24c('0x40')]['includeAll']){_0x4ec677[_0xa24c('0x50')]=[{'all':!![]}];}_0x4ec677=_[_0xa24c('0x4d')]({},_0x4ec677,_0xc078ef['options']);return db[_0xa24c('0x3b')][_0xa24c('0x56')](_0x4ec677)[_0xa24c('0x36')](handleEntityNotFound(_0x1f436c,null))[_0xa24c('0x36')](respondWithResult(_0x1f436c,null))[_0xa24c('0x52')](handleError(_0x1f436c,null));};exports[_0xa24c('0x57')]=function(_0x3816f7,_0xbeab78){var _0x518c2a={'where':{'id':_0x3816f7['params']['id']}},_0x172645={};_0x172645['model']=_['keys'](db['Trunk']['rawAttributes']);_0x518c2a[_0xa24c('0x44')]=_['intersection'](_0x172645[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0x3816f7[_0xa24c('0x40')][_0xa24c('0x43')]));_0x518c2a[_0xa24c('0x44')]=_0x518c2a[_0xa24c('0x44')][_0xa24c('0x58')]?_0x518c2a[_0xa24c('0x44')]:_0x172645[_0xa24c('0x3f')];if(_0x3816f7[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x518c2a[_0xa24c('0x50')]=[{'all':!![]}];}_0x518c2a=_[_0xa24c('0x4d')]({},_0x518c2a,_0x3816f7[_0xa24c('0x4e')]);return db[_0xa24c('0x3b')]['find'](_0x518c2a)[_0xa24c('0x36')](handleEntityNotFound(_0xbeab78,null))[_0xa24c('0x36')](function(_0x5264a7){if(_0x5264a7){var _0x1e08bb=_0x5264a7[_0xa24c('0x32')]({'plain':!![]});_0x1e08bb=qs[_0xa24c('0x59')](_0x1e08bb,['id',_0xa24c('0x5a'),'updatedAt']);_0x3816f7['body']=_[_0xa24c('0x59')](_0x3816f7['body'],['id','createdAt',_0xa24c('0x5b')]);return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_[_0xa24c('0x4d')](_0x1e08bb,_0x3816f7['body']),{'include':_0x3816f7['query'][_0xa24c('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x52a895){var _0xfcc193=_0x3816f7[_0xa24c('0x5d')][_0xa24c('0x32')]({'plain':!![]});if(!_0xfcc193)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfcc193[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5c3285=_0x52a895[_0xa24c('0x32')]({'plain':!![]});var _0x3f306d=_0xa24c('0x33');return db['UserProfileSection'][_0xa24c('0x56')]({'where':{'name':_0x3f306d,'userProfileId':_0xfcc193[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x7aab6e){if(_0x7aab6e&&_0x7aab6e[_0xa24c('0x60')]===0x0){return db['UserProfileResource'][_0xa24c('0x5c')]({'name':_0x5c3285[_0xa24c('0x38')],'resourceId':_0x5c3285['id'],'type':_0x7aab6e[_0xa24c('0x38')],'sectionId':_0x7aab6e['id']},{})[_0xa24c('0x36')](function(){return _0x52a895;});}else{return _0x52a895;}})[_0xa24c('0x52')](function(_0x2ca3fa){logger[_0xa24c('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ca3fa);throw _0x2ca3fa;});}return _0x52a895;});}})[_0xa24c('0x36')](respondWithResult(_0xbeab78,0xc9))[_0xa24c('0x52')](handleError(_0xbeab78,null));};exports['create']=function(_0xb1048a,_0x3e455b,_0x14da5e){var _0xb460b4;return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_0xb1048a[_0xa24c('0x61')],{'raw':!![]})[_0xa24c('0x36')](function(_0x38cc30){_0xb460b4=_0x38cc30;return db[_0xa24c('0x3b')]['findAll']({'raw':!![]});})[_0xa24c('0x36')](function(_0x3a4abd){var _0x3b894f=fs['readFileSync'](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x64')),'utf8');var _0x3ac3a0=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4f9b56=ejs['render'](_0x3b894f,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4f9b56);if(_0xb460b4[_0xa24c('0x69')]){var _0x1879ae=ejs[_0xa24c('0x6a')](_0x3ac3a0,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')](_0xa24c('0x6b'),_0x1879ae);}})['then'](function(){return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x5c'),{'module':_0xa24c('0x6d')});})[_0xa24c('0x36')](function(){var _0x987aca=_0xb1048a[_0xa24c('0x5d')]['get']({'plain':!![]});if(!_0x987aca)throw new Error(_0xa24c('0x6e'));if(_0x987aca[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5b9ad7=_0xb460b4['get']({'plain':!![]});return db[_0xa24c('0x6f')]['find']({'where':{'name':_0xa24c('0x33'),'userProfileId':_0x987aca[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x180da2){if(_0x180da2&&_0x180da2['autoAssociation']===0x0){return db[_0xa24c('0x34')][_0xa24c('0x5c')]({'name':_0x5b9ad7['name'],'resourceId':_0x5b9ad7['id'],'type':_0x180da2[_0xa24c('0x38')],'sectionId':_0x180da2['id']},{})[_0xa24c('0x36')](function(){return _0xb460b4;});}else{return _0xb460b4;}})[_0xa24c('0x52')](function(_0x3e0c08){logger[_0xa24c('0x23')](_0xa24c('0x70'),_0x3e0c08);throw _0x3e0c08;});}return _0xb460b4;})[_0xa24c('0x36')](respondWithResult(_0x3e455b,0xc9))[_0xa24c('0x52')](handleError(_0x3e455b,null));};exports['update']=function(_0x12508e,_0x3c2726,_0x2cae90){var _0x28c3ff;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x12508e[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3c2726,null))[_0xa24c('0x36')](saveUpdates(_0x12508e[_0xa24c('0x61')],null))[_0xa24c('0x36')](function(_0x5b0127){if(_0x5b0127){_0x28c3ff=_0x5b0127;return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});}})['then'](function(_0x141ccf){if(_0x141ccf){var _0x3f212f=fs[_0xa24c('0x65')](path['join'](config['root'],_0xa24c('0x64')),_0xa24c('0x67'));var _0x53928f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x336898=ejs['render'](_0x3f212f,{'trunks':_0x141ccf||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x336898);var _0x263dab=ejs['render'](_0x53928f,{'trunks':_0x141ccf||[]});fs['writeFileSync'](_0xa24c('0x6b'),_0x263dab);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x31'),{'module':_0xa24c('0x6d')});}return null;})[_0xa24c('0x36')](function(_0x45b2fe){if(_0x45b2fe){return _0x28c3ff;}})[_0xa24c('0x36')](respondWithResult(_0x3c2726,null))[_0xa24c('0x52')](handleError(_0x3c2726,null));};exports[_0xa24c('0x35')]=function(_0x4ee10d,_0x3897ca,_0xa077c8){var _0x16e1db;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x4ee10d[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3897ca,null))[_0xa24c('0x36')](removeEntity(_0x3897ca,null))[_0xa24c('0x36')](function(){return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});})[_0xa24c('0x36')](function(_0x4ecbe9){var _0x1fe0f3=fs[_0xa24c('0x65')](path['join'](config[_0xa24c('0x63')],_0xa24c('0x64')),_0xa24c('0x67'));var _0x4af78f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config['root'],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4c108f=ejs['render'](_0x1fe0f3,{'trunks':_0x4ecbe9});var _0x124d52=ejs[_0xa24c('0x6a')](_0x4af78f,{'trunks':_0x4ecbe9});fs[_0xa24c('0x68')](_0xa24c('0x71'),_0x4c108f);fs['writeFileSync'](_0xa24c('0x6b'),_0x124d52);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x35'),{'module':'chan_sip.so'});})['catch'](handleError(_0x3897ca,null));}; \ No newline at end of file +var _0xb821=['model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Trunk','includeAll','findAll','intersection','length','include','find','params','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','server/files/templates/trunk.ejs','utf8','join','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','UserProfileSection','root','rimraf','zip-dir','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','Trunk,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Trunks','name','send','index','rawAttributes','fieldName','key'];(function(_0x127446,_0x748577){var _0x1efa67=function(_0x2aff5a){while(--_0x2aff5a){_0x127446['push'](_0x127446['shift']());}};_0x1efa67(++_0x748577);}(_0xb821,0xa7));var _0x1b82=function(_0xc1b19e,_0xcc9e08){_0xc1b19e=_0xc1b19e-0x0;var _0x142117=_0xb821[_0xc1b19e];return _0x142117;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b82('0x0'));var zipdir=require(_0x1b82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b82('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b82('0x3'));var path=require(_0x1b82('0x4'));var sox=require(_0x1b82('0x5'));var csv=require(_0x1b82('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b82('0x7'));var _=require(_0x1b82('0x8'));var squel=require(_0x1b82('0x9'));var crypto=require(_0x1b82('0xa'));var jsforce=require(_0x1b82('0xb'));var deskjs=require(_0x1b82('0xc'));var toCsv=require(_0x1b82('0x6'));var querystring=require(_0x1b82('0xd'));var Papa=require(_0x1b82('0xe'));var Redis=require('ioredis');var authService=require(_0x1b82('0xf'));var qs=require(_0x1b82('0x10'));var as=require(_0x1b82('0x11'));var hardwareService=require(_0x1b82('0x12'));var logger=require(_0x1b82('0x13'))(_0x1b82('0x14'));var utils=require(_0x1b82('0x15'));var config=require(_0x1b82('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b82('0x17'))['db'];var jayson=require(_0x1b82('0x18'));var client=jayson[_0x1b82('0x19')][_0x1b82('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x50aed7,_0x1a6285,_0x5767aa,_0x54915f){return new BPromise(function(_0x1e553a,_0x4bf75b){var _0x1cffd1=_0x54915f||client;return _0x1cffd1[_0x1b82('0x1b')](_0x50aed7,_0x5767aa)['then'](function(_0x46c2cf){logger['info']('Trunk,\x20%s,\x20%s',_0x1a6285,_0x1b82('0x1c'));logger['debug'](_0x1b82('0x1d'),_0x1a6285,_0x1b82('0x1c'),JSON[_0x1b82('0x1e')](_0x46c2cf));if(_0x46c2cf['error']){if(_0x46c2cf['error'][_0x1b82('0x1f')]===0x1f4){logger['error'](_0x1b82('0x20'),_0x1a6285,_0x46c2cf[_0x1b82('0x21')][_0x1b82('0x22')]);return _0x4bf75b(_0x46c2cf['error'][_0x1b82('0x22')]);}logger[_0x1b82('0x21')](_0x1b82('0x20'),_0x1a6285,_0x46c2cf[_0x1b82('0x21')][_0x1b82('0x22')]);return _0x1e553a(_0x46c2cf['error'][_0x1b82('0x22')]);}else{logger[_0x1b82('0x23')](_0x1b82('0x20'),_0x1a6285,_0x1b82('0x1c'));_0x1e553a(_0x46c2cf[_0x1b82('0x24')][_0x1b82('0x22')]);}})[_0x1b82('0x25')](function(_0x486e92){logger[_0x1b82('0x21')](_0x1b82('0x20'),_0x1a6285,_0x486e92);_0x4bf75b(_0x486e92);});});}function respondWithStatusCode(_0x5b8d09,_0x561d78){_0x561d78=_0x561d78||0xcc;return function(_0x225b81){if(_0x225b81){return _0x5b8d09[_0x1b82('0x26')](_0x561d78);}return _0x5b8d09['status'](_0x561d78)[_0x1b82('0x27')]();};}function respondWithResult(_0x4db690,_0x5cd458){_0x5cd458=_0x5cd458||0xc8;return function(_0x5f556b){if(_0x5f556b){return _0x4db690[_0x1b82('0x28')](_0x5cd458)[_0x1b82('0x29')](_0x5f556b);}};}function respondWithFilteredResult(_0xfd00d1,_0x257b79){return function(_0x548a3b){if(_0x548a3b){var _0x222483=typeof _0x257b79[_0x1b82('0x2a')]===_0x1b82('0x2b')&&typeof _0x257b79[_0x1b82('0x2c')]===_0x1b82('0x2b');var _0x1b8b6f=_0x548a3b[_0x1b82('0x2d')];var _0x21ea34=_0x222483?0x0:_0x257b79[_0x1b82('0x2a')];var _0x1f9c6b=_0x222483?_0x548a3b[_0x1b82('0x2d')]:_0x257b79[_0x1b82('0x2a')]+_0x257b79[_0x1b82('0x2c')];var _0x5ea890;if(_0x1f9c6b>=_0x1b8b6f){_0x1f9c6b=_0x1b8b6f;_0x5ea890=0xc8;}else{_0x5ea890=0xce;}_0xfd00d1[_0x1b82('0x28')](_0x5ea890);return _0xfd00d1[_0x1b82('0x2e')](_0x1b82('0x2f'),_0x21ea34+'-'+_0x1f9c6b+'/'+_0x1b8b6f)[_0x1b82('0x29')](_0x548a3b);}return null;};}function patchUpdates(_0x18e4ff){return function(_0x115ce7){try{jsonpatch[_0x1b82('0x30')](_0x115ce7,_0x18e4ff,!![]);}catch(_0x46575f){return BPromise[_0x1b82('0x31')](_0x46575f);}return _0x115ce7[_0x1b82('0x32')]();};}function saveUpdates(_0x501ab0,_0x225c06){return function(_0x29a31e){if(_0x29a31e){return _0x29a31e[_0x1b82('0x33')](_0x501ab0)[_0x1b82('0x34')](function(_0x5b7b18){return _0x5b7b18;});}return null;};}function removeEntity(_0x474218,_0xbf65a){return function(_0x544bd5){if(_0x544bd5){return _0x544bd5[_0x1b82('0x35')]()[_0x1b82('0x34')](function(){var _0x365c3c=_0x544bd5['get']({'plain':!![]});var _0x5efb8e=_0x1b82('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x5efb8e,'resourceId':_0x365c3c['id']}})[_0x1b82('0x34')](function(){return _0x544bd5;});})[_0x1b82('0x34')](function(){_0x474218[_0x1b82('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42a64e,_0x366db3){return function(_0xea774a){if(!_0xea774a){_0x42a64e[_0x1b82('0x26')](0x194);}return _0xea774a;};}function handleError(_0x4dd64a,_0x42c1c4){_0x42c1c4=_0x42c1c4||0x1f4;return function(_0x1cd7de){logger[_0x1b82('0x21')](_0x1cd7de['stack']);if(_0x1cd7de['name']){delete _0x1cd7de[_0x1b82('0x37')];}_0x4dd64a['status'](_0x42c1c4)[_0x1b82('0x38')](_0x1cd7de);};}exports[_0x1b82('0x39')]=function(_0x286b4b,_0x348880){var _0x1255db={},_0x3ab35c={},_0x39fe4a={'count':0x0,'rows':[]};var _0x1368df=_['map'](db['Trunk'][_0x1b82('0x3a')],function(_0x5f4baf){return{'name':_0x5f4baf[_0x1b82('0x3b')],'type':_0x5f4baf['type'][_0x1b82('0x3c')]};});_0x3ab35c[_0x1b82('0x3d')]=_[_0x1b82('0x3e')](_0x1368df,_0x1b82('0x37'));_0x3ab35c[_0x1b82('0x3f')]=_[_0x1b82('0x40')](_0x286b4b['query']);_0x3ab35c[_0x1b82('0x41')]=_['intersection'](_0x3ab35c[_0x1b82('0x3d')],_0x3ab35c['query']);_0x1255db[_0x1b82('0x42')]=_['intersection'](_0x3ab35c['model'],qs[_0x1b82('0x43')](_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x1255db[_0x1b82('0x42')]=_0x1255db[_0x1b82('0x42')]['length']?_0x1255db[_0x1b82('0x42')]:_0x3ab35c['model'];if(!_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x44')](_0x1b82('0x45'))){_0x1255db[_0x1b82('0x2c')]=qs[_0x1b82('0x2c')](_0x286b4b['query'][_0x1b82('0x2c')]);_0x1255db['offset']=qs[_0x1b82('0x2a')](_0x286b4b[_0x1b82('0x3f')]['offset']);}_0x1255db[_0x1b82('0x46')]=qs[_0x1b82('0x47')](_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x47')]);_0x1255db[_0x1b82('0x48')]=qs[_0x1b82('0x41')](_[_0x1b82('0x49')](_0x286b4b['query'],_0x3ab35c[_0x1b82('0x41')]),_0x1368df);if(_0x286b4b['query'][_0x1b82('0x4a')]){_0x1255db[_0x1b82('0x48')]=_[_0x1b82('0x4b')](_0x1255db[_0x1b82('0x48')],{'$or':_[_0x1b82('0x3e')](_0x1368df,function(_0x1d24d6){if(_0x1d24d6[_0x1b82('0x4c')]!==_0x1b82('0x4d')){var _0x192ce3={};_0x192ce3[_0x1d24d6[_0x1b82('0x37')]]={'$like':'%'+_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x4a')]+'%'};return _0x192ce3;}})});}_0x1255db=_[_0x1b82('0x4b')]({},_0x1255db,_0x286b4b[_0x1b82('0x4e')]);var _0x4fb92f={'where':_0x1255db['where']};return db[_0x1b82('0x4f')]['count'](_0x4fb92f)[_0x1b82('0x34')](function(_0x3df0af){_0x39fe4a[_0x1b82('0x2d')]=_0x3df0af;if(_0x286b4b['query'][_0x1b82('0x50')]){_0x1255db['include']=[{'all':!![]}];}return db['Trunk'][_0x1b82('0x51')](_0x1255db);})[_0x1b82('0x34')](function(_0x242324){_0x39fe4a['rows']=_0x242324;return _0x39fe4a;})[_0x1b82('0x34')](respondWithFilteredResult(_0x348880,_0x1255db))[_0x1b82('0x25')](handleError(_0x348880,null));};exports['show']=function(_0x5ca898,_0x106282){var _0x2e676a={'raw':![],'where':{'id':_0x5ca898['params']['id']}},_0x2dc53e={};_0x2dc53e[_0x1b82('0x3d')]=_[_0x1b82('0x40')](db[_0x1b82('0x4f')][_0x1b82('0x3a')]);_0x2dc53e[_0x1b82('0x3f')]=_[_0x1b82('0x40')](_0x5ca898['query']);_0x2dc53e[_0x1b82('0x41')]=_['intersection'](_0x2dc53e[_0x1b82('0x3d')],_0x2dc53e[_0x1b82('0x3f')]);_0x2e676a['attributes']=_[_0x1b82('0x52')](_0x2dc53e['model'],qs[_0x1b82('0x43')](_0x5ca898[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x2e676a[_0x1b82('0x42')]=_0x2e676a[_0x1b82('0x42')][_0x1b82('0x53')]?_0x2e676a['attributes']:_0x2dc53e['model'];if(_0x5ca898[_0x1b82('0x3f')][_0x1b82('0x50')]){_0x2e676a[_0x1b82('0x54')]=[{'all':!![]}];}_0x2e676a=_[_0x1b82('0x4b')]({},_0x2e676a,_0x5ca898[_0x1b82('0x4e')]);return db[_0x1b82('0x4f')][_0x1b82('0x55')](_0x2e676a)[_0x1b82('0x34')](handleEntityNotFound(_0x106282,null))['then'](respondWithResult(_0x106282,null))['catch'](handleError(_0x106282,null));};exports['clone']=function(_0x2658b5,_0x2a95d2){var _0x207f1c={'where':{'id':_0x2658b5[_0x1b82('0x56')]['id']}},_0x27ad80={};_0x27ad80[_0x1b82('0x3d')]=_[_0x1b82('0x40')](db['Trunk'][_0x1b82('0x3a')]);_0x207f1c[_0x1b82('0x42')]=_[_0x1b82('0x52')](_0x27ad80[_0x1b82('0x3d')],qs[_0x1b82('0x43')](_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x207f1c[_0x1b82('0x42')]=_0x207f1c['attributes'][_0x1b82('0x53')]?_0x207f1c[_0x1b82('0x42')]:_0x27ad80[_0x1b82('0x3d')];if(_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x50')]){_0x207f1c['include']=[{'all':!![]}];}_0x207f1c=_['merge']({},_0x207f1c,_0x2658b5[_0x1b82('0x4e')]);return db[_0x1b82('0x4f')][_0x1b82('0x55')](_0x207f1c)[_0x1b82('0x34')](handleEntityNotFound(_0x2a95d2,null))['then'](function(_0x170905){if(_0x170905){var _0x352603=_0x170905[_0x1b82('0x57')]({'plain':!![]});_0x352603=qs[_0x1b82('0x58')](_0x352603,['id',_0x1b82('0x59'),_0x1b82('0x5a')]);_0x2658b5[_0x1b82('0x5b')]=_[_0x1b82('0x58')](_0x2658b5[_0x1b82('0x5b')],['id',_0x1b82('0x59'),'updatedAt']);return db[_0x1b82('0x4f')][_0x1b82('0x5c')](_['merge'](_0x352603,_0x2658b5[_0x1b82('0x5b')]),{'include':_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x50')]?[{'all':!![]}]:undefined})[_0x1b82('0x34')](function(_0x4b26c4){var _0x30f13a=_0x2658b5[_0x1b82('0x5d')][_0x1b82('0x57')]({'plain':!![]});if(!_0x30f13a)throw new Error(_0x1b82('0x5e'));if(_0x30f13a[_0x1b82('0x5f')]===_0x1b82('0x5d')){var _0x4e8fa2=_0x4b26c4[_0x1b82('0x57')]({'plain':!![]});var _0x5267c3=_0x1b82('0x36');return db['UserProfileSection'][_0x1b82('0x55')]({'where':{'name':_0x5267c3,'userProfileId':_0x30f13a[_0x1b82('0x60')]},'raw':!![]})[_0x1b82('0x34')](function(_0x2db0fe){if(_0x2db0fe&&_0x2db0fe[_0x1b82('0x61')]===0x0){return db[_0x1b82('0x62')][_0x1b82('0x5c')]({'name':_0x4e8fa2['name'],'resourceId':_0x4e8fa2['id'],'type':_0x2db0fe[_0x1b82('0x37')],'sectionId':_0x2db0fe['id']},{})[_0x1b82('0x34')](function(){return _0x4b26c4;});}else{return _0x4b26c4;}})[_0x1b82('0x25')](function(_0x2de10c){logger[_0x1b82('0x21')](_0x1b82('0x63'),_0x2de10c);throw _0x2de10c;});}return _0x4b26c4;});}})[_0x1b82('0x34')](respondWithResult(_0x2a95d2,0xc9))[_0x1b82('0x25')](handleError(_0x2a95d2,null));};exports[_0x1b82('0x5c')]=function(_0x3f7690,_0x1873de,_0xe31cbc){var _0x1ef92c;return db['Trunk'][_0x1b82('0x5c')](_0x3f7690[_0x1b82('0x5b')],{'raw':!![]})[_0x1b82('0x34')](function(_0x4a229e){_0x1ef92c=_0x4a229e;return db[_0x1b82('0x4f')][_0x1b82('0x51')]({'raw':!![]});})['then'](function(_0x3bf106){var _0x5cc386=fs[_0x1b82('0x64')](path['join'](config['root'],_0x1b82('0x65')),_0x1b82('0x66'));var _0x3b4088=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config['root'],_0x1b82('0x68')),'utf8');var _0x143689=ejs[_0x1b82('0x69')](_0x5cc386,{'trunks':_0x3bf106||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6b'),_0x143689);if(_0x1ef92c[_0x1b82('0x6c')]){var _0x29c42e=ejs[_0x1b82('0x69')](_0x3b4088,{'trunks':_0x3bf106||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6d'),_0x29c42e);}})[_0x1b82('0x34')](function(){return respondWithRpcPromise(_0x1b82('0x6e'),'create',{'module':_0x1b82('0x6f')});})['then'](function(){var _0x4c2e52=_0x3f7690[_0x1b82('0x5d')][_0x1b82('0x57')]({'plain':!![]});if(!_0x4c2e52)throw new Error(_0x1b82('0x5e'));if(_0x4c2e52[_0x1b82('0x5f')]===_0x1b82('0x5d')){var _0x1dd3a1=_0x1ef92c[_0x1b82('0x57')]({'plain':!![]});return db[_0x1b82('0x70')][_0x1b82('0x55')]({'where':{'name':_0x1b82('0x36'),'userProfileId':_0x4c2e52['userProfileId']},'raw':!![]})[_0x1b82('0x34')](function(_0x4d496b){if(_0x4d496b&&_0x4d496b[_0x1b82('0x61')]===0x0){return db['UserProfileResource'][_0x1b82('0x5c')]({'name':_0x1dd3a1[_0x1b82('0x37')],'resourceId':_0x1dd3a1['id'],'type':_0x4d496b[_0x1b82('0x37')],'sectionId':_0x4d496b['id']},{})[_0x1b82('0x34')](function(){return _0x1ef92c;});}else{return _0x1ef92c;}})[_0x1b82('0x25')](function(_0x49a202){logger[_0x1b82('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a202);throw _0x49a202;});}return _0x1ef92c;})['then'](respondWithResult(_0x1873de,0xc9))[_0x1b82('0x25')](handleError(_0x1873de,null));};exports[_0x1b82('0x33')]=function(_0x1a4826,_0x4d986c,_0x2e9191){var _0x52f16e;return db[_0x1b82('0x4f')]['find']({'where':{'id':_0x1a4826[_0x1b82('0x56')]['id']}})[_0x1b82('0x34')](handleEntityNotFound(_0x4d986c,null))[_0x1b82('0x34')](saveUpdates(_0x1a4826[_0x1b82('0x5b')],null))['then'](function(_0x46cae4){if(_0x46cae4){_0x52f16e=_0x46cae4;return db['Trunk'][_0x1b82('0x51')]({'raw':!![]});}})[_0x1b82('0x34')](function(_0x1095fb){if(_0x1095fb){var _0x185fce=fs[_0x1b82('0x64')](path['join'](config[_0x1b82('0x71')],'server/files/templates/trunk.ejs'),_0x1b82('0x66'));var _0x5ce247=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config[_0x1b82('0x71')],'server/files/templates/registry.ejs'),_0x1b82('0x66'));var _0x31a56e=ejs[_0x1b82('0x69')](_0x185fce,{'trunks':_0x1095fb||[]});fs['writeFileSync'](_0x1b82('0x6b'),_0x31a56e);var _0x396272=ejs[_0x1b82('0x69')](_0x5ce247,{'trunks':_0x1095fb||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6d'),_0x396272);return respondWithRpcPromise('Reload',_0x1b82('0x33'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x2759ac){if(_0x2759ac){return _0x52f16e;}})['then'](respondWithResult(_0x4d986c,null))[_0x1b82('0x25')](handleError(_0x4d986c,null));};exports[_0x1b82('0x35')]=function(_0x5f349f,_0x3e17b0,_0x391207){var _0x553ac5;return db['Trunk']['find']({'where':{'id':_0x5f349f['params']['id']}})[_0x1b82('0x34')](handleEntityNotFound(_0x3e17b0,null))[_0x1b82('0x34')](removeEntity(_0x3e17b0,null))[_0x1b82('0x34')](function(){return db['Trunk'][_0x1b82('0x51')]({'raw':!![]});})['then'](function(_0x7d95b6){var _0x372c3b=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config['root'],_0x1b82('0x65')),_0x1b82('0x66'));var _0x14510c=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config[_0x1b82('0x71')],_0x1b82('0x68')),'utf8');var _0x58e180=ejs[_0x1b82('0x69')](_0x372c3b,{'trunks':_0x7d95b6});var _0x531d3f=ejs['render'](_0x14510c,{'trunks':_0x7d95b6});fs[_0x1b82('0x6a')](_0x1b82('0x6b'),_0x58e180);fs[_0x1b82('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x531d3f);return respondWithRpcPromise(_0x1b82('0x6e'),'destroy',{'module':_0x1b82('0x6f')});})[_0x1b82('0x25')](handleError(_0x3e17b0,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index addaf98..5af997d 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 _0xbac9=['bluebird','request-promise','rimraf','../../config/environment','exports','define','Trunk','util','moment'];(function(_0x456f71,_0x621c51){var _0x70f0f7=function(_0x2b24c2){while(--_0x2b24c2){_0x456f71['push'](_0x456f71['shift']());}};_0x70f0f7(++_0x621c51);}(_0xbac9,0xf1));var _0x9bac=function(_0x93bdde,_0x26ca52){_0x93bdde=_0x93bdde-0x0;var _0x19fb76=_0xbac9[_0x93bdde];return _0x19fb76;};'use strict';var _=require('lodash');var util=require(_0x9bac('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x9bac('0x1'));var BPromise=require(_0x9bac('0x2'));var rp=require(_0x9bac('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9bac('0x4'));var config=require(_0x9bac('0x5'));var attributes=require('./trunk.attributes');module[_0x9bac('0x6')]=function(_0x322344,_0x34b56f){return _0x322344[_0x9bac('0x7')](_0x9bac('0x8'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5925=['./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x4711d0,_0x50cfa3){var _0x3b5283=function(_0x2d811a){while(--_0x2d811a){_0x4711d0['push'](_0x4711d0['shift']());}};_0x3b5283(++_0x50cfa3);}(_0x5925,0x1f3));var _0x5592=function(_0x3db0ba,_0x2be65c){_0x3db0ba=_0x3db0ba-0x0;var _0x2d8e9a=_0x5925[_0x3db0ba];return _0x2d8e9a;};'use strict';var _=require(_0x5592('0x0'));var util=require(_0x5592('0x1'));var logger=require(_0x5592('0x2'))('api');var moment=require(_0x5592('0x3'));var BPromise=require(_0x5592('0x4'));var rp=require(_0x5592('0x5'));var fs=require('fs');var path=require(_0x5592('0x6'));var rimraf=require(_0x5592('0x7'));var config=require('../../config/environment');var attributes=require(_0x5592('0x8'));module[_0x5592('0x9')]=function(_0x52611b,_0x266303){return _0x52611b[_0x5592('0xa')](_0x5592('0xb'),attributes,{'tableName':_0x5592('0xc'),'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 54a555a..957a6c8 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 _0xc393=['jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTrunk','Trunk','options','where','attributes','include','map','model','debug','ShowTrunk','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc393,0x177));var _0x3c39=function(_0x14686a,_0x540f0d){_0x14686a=_0x14686a-0x0;var _0xeafc86=_0xc393[_0x14686a];return _0xeafc86;};'use strict';var _=require(_0x3c39('0x0'));var util=require(_0x3c39('0x1'));var moment=require(_0x3c39('0x2'));var BPromise=require(_0x3c39('0x3'));var rs=require(_0x3c39('0x4'));var fs=require('fs');var Redis=require(_0x3c39('0x5'));var db=require(_0x3c39('0x6'))['db'];var utils=require(_0x3c39('0x7'));var logger=require(_0x3c39('0x8'))(_0x3c39('0x9'));var config=require('../../config/environment');var jayson=require(_0x3c39('0xa'));var client=jayson[_0x3c39('0xb')][_0x3c39('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x16dc74,_0x21a287,_0x4a7c07){return new BPromise(function(_0x292b18,_0xdd12e5){return client['request'](_0x16dc74,_0x4a7c07)[_0x3c39('0xd')](function(_0x1826af){logger[_0x3c39('0xe')](_0x3c39('0xf'),_0x21a287,_0x3c39('0x10'));logger['debug'](_0x3c39('0x11'),_0x21a287,_0x3c39('0x10'),JSON[_0x3c39('0x12')](_0x1826af));if(_0x1826af[_0x3c39('0x13')]){if(_0x1826af['error'][_0x3c39('0x14')]===0x1f4){logger[_0x3c39('0x13')](_0x3c39('0xf'),_0x21a287,_0x1826af['error'][_0x3c39('0x15')]);return _0xdd12e5(_0x1826af['error'][_0x3c39('0x15')]);}logger[_0x3c39('0x13')](_0x3c39('0xf'),_0x21a287,_0x1826af[_0x3c39('0x13')][_0x3c39('0x15')]);return _0x292b18(_0x1826af[_0x3c39('0x13')][_0x3c39('0x15')]);}else{logger[_0x3c39('0xe')](_0x3c39('0xf'),_0x21a287,_0x3c39('0x10'));_0x292b18(_0x1826af['result'][_0x3c39('0x15')]);}})[_0x3c39('0x16')](function(_0x839dd2){logger[_0x3c39('0x13')](_0x3c39('0xf'),_0x21a287,_0x839dd2);_0xdd12e5(_0x839dd2);});});}exports[_0x3c39('0x17')]=function(_0x3d4bd0){var _0xae8961=this;return new Promise(function(_0x4b6d81,_0x4fbd8c){return db[_0x3c39('0x18')]['findAll']({'raw':_0x3d4bd0[_0x3c39('0x19')]?_0x3d4bd0['options']['raw']===undefined?!![]:![]:!![],'where':_0x3d4bd0[_0x3c39('0x19')]?_0x3d4bd0[_0x3c39('0x19')][_0x3c39('0x1a')]||null:null,'attributes':_0x3d4bd0[_0x3c39('0x19')]?_0x3d4bd0[_0x3c39('0x19')][_0x3c39('0x1b')]||null:null,'limit':_0x3d4bd0[_0x3c39('0x19')]?_0x3d4bd0[_0x3c39('0x19')]['limit']||null:null,'include':_0x3d4bd0[_0x3c39('0x19')]?_0x3d4bd0['options'][_0x3c39('0x1c')]?_[_0x3c39('0x1d')](_0x3d4bd0[_0x3c39('0x19')][_0x3c39('0x1c')],function(_0x2485fe){return{'model':db[_0x2485fe[_0x3c39('0x1e')]],'as':_0x2485fe['as'],'attributes':_0x2485fe[_0x3c39('0x1b')],'include':_0x2485fe[_0x3c39('0x1c')]?_[_0x3c39('0x1d')](_0x2485fe[_0x3c39('0x1c')],function(_0x11f419){return{'model':db[_0x11f419['model']],'as':_0x11f419['as'],'attributes':_0x11f419[_0x3c39('0x1b')],'include':_0x11f419[_0x3c39('0x1c')]?_['map'](_0x11f419[_0x3c39('0x1c')],function(_0x3fc5aa){return{'model':db[_0x3fc5aa[_0x3c39('0x1e')]],'as':_0x3fc5aa['as'],'attributes':_0x3fc5aa[_0x3c39('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3c39('0xd')](function(_0x595ade){logger[_0x3c39('0xe')](_0x3c39('0x17'),_0x3d4bd0);logger[_0x3c39('0x1f')]('GetTrunk',_0x3d4bd0,JSON[_0x3c39('0x12')](_0x595ade));_0x4b6d81(_0x595ade);})[_0x3c39('0x16')](function(_0xc348eb){logger[_0x3c39('0x13')]('GetTrunk',_0xc348eb[_0x3c39('0x15')],_0x3d4bd0);_0x4fbd8c(_0xae8961[_0x3c39('0x13')](0x1f4,_0xc348eb[_0x3c39('0x15')]));});});};exports[_0x3c39('0x20')]=function(_0x4789c8){var _0x4cc1a8=this;return new Promise(function(_0x469228,_0x3cad10){return db[_0x3c39('0x18')][_0x3c39('0x21')]({'raw':_0x4789c8[_0x3c39('0x19')]?_0x4789c8['options'][_0x3c39('0x22')]===undefined?!![]:![]:!![],'where':_0x4789c8[_0x3c39('0x19')]?_0x4789c8[_0x3c39('0x19')][_0x3c39('0x1a')]||null:null,'attributes':_0x4789c8[_0x3c39('0x19')]?_0x4789c8[_0x3c39('0x19')][_0x3c39('0x1b')]||null:null,'include':_0x4789c8['options']?_0x4789c8[_0x3c39('0x19')][_0x3c39('0x1c')]?_[_0x3c39('0x1d')](_0x4789c8['options']['include'],function(_0x149b94){return{'model':db[_0x149b94['model']],'as':_0x149b94['as'],'attributes':_0x149b94[_0x3c39('0x1b')],'include':_0x149b94[_0x3c39('0x1c')]?_[_0x3c39('0x1d')](_0x149b94['include'],function(_0x3c6821){return{'model':db[_0x3c6821[_0x3c39('0x1e')]],'as':_0x3c6821['as'],'attributes':_0x3c6821[_0x3c39('0x1b')],'include':_0x3c6821[_0x3c39('0x1c')]?_[_0x3c39('0x1d')](_0x3c6821[_0x3c39('0x1c')],function(_0x46402a){return{'model':db[_0x46402a[_0x3c39('0x1e')]],'as':_0x46402a['as'],'attributes':_0x46402a[_0x3c39('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3c39('0xd')](function(_0x2e3eee){logger[_0x3c39('0xe')](_0x3c39('0x20'),_0x4789c8);logger[_0x3c39('0x1f')](_0x3c39('0x20'),_0x4789c8,JSON[_0x3c39('0x12')](_0x2e3eee));_0x469228(_0x2e3eee);})['catch'](function(_0x316b0f){logger[_0x3c39('0x13')](_0x3c39('0x20'),_0x316b0f[_0x3c39('0x15')],_0x4789c8);_0x3cad10(_0x4cc1a8[_0x3c39('0x13')](0x1f4,_0x316b0f[_0x3c39('0x15')]));});});}; \ No newline at end of file +var _0xf159=['attributes','limit','include','map','model','find','ShowTrunk','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrunk','Trunk','findAll','options','raw'];(function(_0x4df1f5,_0x39c6d2){var _0x56585b=function(_0x287b6e){while(--_0x287b6e){_0x4df1f5['push'](_0x4df1f5['shift']());}};_0x56585b(++_0x39c6d2);}(_0xf159,0x151));var _0x9f15=function(_0x485b4c,_0x73b954){_0x485b4c=_0x485b4c-0x0;var _0x404524=_0xf159[_0x485b4c];return _0x404524;};'use strict';var _=require('lodash');var util=require(_0x9f15('0x0'));var moment=require(_0x9f15('0x1'));var BPromise=require(_0x9f15('0x2'));var rs=require(_0x9f15('0x3'));var fs=require('fs');var Redis=require(_0x9f15('0x4'));var db=require(_0x9f15('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9f15('0x6'));var jayson=require(_0x9f15('0x7'));var client=jayson[_0x9f15('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23b838,_0x1bbbfa,_0x3f6051){return new BPromise(function(_0xe40550,_0x515e59){return client['request'](_0x23b838,_0x3f6051)[_0x9f15('0x9')](function(_0x1e3489){logger[_0x9f15('0xa')](_0x9f15('0xb'),_0x1bbbfa,_0x9f15('0xc'));logger[_0x9f15('0xd')](_0x9f15('0xe'),_0x1bbbfa,_0x9f15('0xc'),JSON[_0x9f15('0xf')](_0x1e3489));if(_0x1e3489[_0x9f15('0x10')]){if(_0x1e3489['error'][_0x9f15('0x11')]===0x1f4){logger[_0x9f15('0x10')](_0x9f15('0xb'),_0x1bbbfa,_0x1e3489[_0x9f15('0x10')][_0x9f15('0x12')]);return _0x515e59(_0x1e3489[_0x9f15('0x10')][_0x9f15('0x12')]);}logger['error'](_0x9f15('0xb'),_0x1bbbfa,_0x1e3489[_0x9f15('0x10')][_0x9f15('0x12')]);return _0xe40550(_0x1e3489[_0x9f15('0x10')][_0x9f15('0x12')]);}else{logger['info'](_0x9f15('0xb'),_0x1bbbfa,_0x9f15('0xc'));_0xe40550(_0x1e3489[_0x9f15('0x13')][_0x9f15('0x12')]);}})[_0x9f15('0x14')](function(_0x2ecf6a){logger[_0x9f15('0x10')]('Trunk,\x20%s,\x20%s',_0x1bbbfa,_0x2ecf6a);_0x515e59(_0x2ecf6a);});});}exports[_0x9f15('0x15')]=function(_0x57fa6d){var _0x4ccd10=this;return new Promise(function(_0x498435,_0x7d18fc){return db[_0x9f15('0x16')][_0x9f15('0x17')]({'raw':_0x57fa6d[_0x9f15('0x18')]?_0x57fa6d[_0x9f15('0x18')][_0x9f15('0x19')]===undefined?!![]:![]:!![],'where':_0x57fa6d[_0x9f15('0x18')]?_0x57fa6d[_0x9f15('0x18')]['where']||null:null,'attributes':_0x57fa6d[_0x9f15('0x18')]?_0x57fa6d[_0x9f15('0x18')][_0x9f15('0x1a')]||null:null,'limit':_0x57fa6d['options']?_0x57fa6d['options'][_0x9f15('0x1b')]||null:null,'include':_0x57fa6d[_0x9f15('0x18')]?_0x57fa6d[_0x9f15('0x18')][_0x9f15('0x1c')]?_[_0x9f15('0x1d')](_0x57fa6d[_0x9f15('0x18')]['include'],function(_0x3564db){return{'model':db[_0x3564db[_0x9f15('0x1e')]],'as':_0x3564db['as'],'attributes':_0x3564db[_0x9f15('0x1a')],'include':_0x3564db[_0x9f15('0x1c')]?_[_0x9f15('0x1d')](_0x3564db[_0x9f15('0x1c')],function(_0x4e9064){return{'model':db[_0x4e9064[_0x9f15('0x1e')]],'as':_0x4e9064['as'],'attributes':_0x4e9064[_0x9f15('0x1a')],'include':_0x4e9064['include']?_[_0x9f15('0x1d')](_0x4e9064['include'],function(_0x286506){return{'model':db[_0x286506[_0x9f15('0x1e')]],'as':_0x286506['as'],'attributes':_0x286506['attributes']};}):[]};}):[]};}):[]:[]})[_0x9f15('0x9')](function(_0x4931a0){logger['info'](_0x9f15('0x15'),_0x57fa6d);logger[_0x9f15('0xd')](_0x9f15('0x15'),_0x57fa6d,JSON[_0x9f15('0xf')](_0x4931a0));_0x498435(_0x4931a0);})[_0x9f15('0x14')](function(_0x78db76){logger[_0x9f15('0x10')](_0x9f15('0x15'),_0x78db76[_0x9f15('0x12')],_0x57fa6d);_0x7d18fc(_0x4ccd10[_0x9f15('0x10')](0x1f4,_0x78db76['message']));});});};exports['ShowTrunk']=function(_0xfe9f1b){var _0x2d4a72=this;return new Promise(function(_0xa36b12,_0x2d5950){return db['Trunk'][_0x9f15('0x1f')]({'raw':_0xfe9f1b[_0x9f15('0x18')]?_0xfe9f1b[_0x9f15('0x18')][_0x9f15('0x19')]===undefined?!![]:![]:!![],'where':_0xfe9f1b[_0x9f15('0x18')]?_0xfe9f1b[_0x9f15('0x18')]['where']||null:null,'attributes':_0xfe9f1b[_0x9f15('0x18')]?_0xfe9f1b[_0x9f15('0x18')][_0x9f15('0x1a')]||null:null,'include':_0xfe9f1b['options']?_0xfe9f1b['options'][_0x9f15('0x1c')]?_['map'](_0xfe9f1b[_0x9f15('0x18')][_0x9f15('0x1c')],function(_0x2c9662){return{'model':db[_0x2c9662[_0x9f15('0x1e')]],'as':_0x2c9662['as'],'attributes':_0x2c9662['attributes'],'include':_0x2c9662[_0x9f15('0x1c')]?_[_0x9f15('0x1d')](_0x2c9662[_0x9f15('0x1c')],function(_0x49800c){return{'model':db[_0x49800c['model']],'as':_0x49800c['as'],'attributes':_0x49800c[_0x9f15('0x1a')],'include':_0x49800c['include']?_[_0x9f15('0x1d')](_0x49800c[_0x9f15('0x1c')],function(_0xbe3b4f){return{'model':db[_0xbe3b4f['model']],'as':_0xbe3b4f['as'],'attributes':_0xbe3b4f[_0x9f15('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9f15('0x9')](function(_0x2cf784){logger[_0x9f15('0xa')](_0x9f15('0x20'),_0xfe9f1b);logger[_0x9f15('0xd')](_0x9f15('0x20'),_0xfe9f1b,JSON[_0x9f15('0xf')](_0x2cf784));_0xa36b12(_0x2cf784);})[_0x9f15('0x14')](function(_0x40a04d){logger[_0x9f15('0x10')]('ShowTrunk',_0x40a04d[_0x9f15('0x12')],_0xfe9f1b);_0x2d5950(_0x2d4a72['error'](0x1f4,_0x40a04d[_0x9f15('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index e0dbeb9..2b56337 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 _0x64e4=['./user-setting.controller','put','/:id','isAuthenticated','update','exports','express','Router'];(function(_0x2dfe33,_0x40a45e){var _0x22e088=function(_0x662e3e){while(--_0x662e3e){_0x2dfe33['push'](_0x2dfe33['shift']());}};_0x22e088(++_0x40a45e);}(_0x64e4,0x186));var _0x464e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x64e4[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x464e('0x0'));var router=express[_0x464e('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x464e('0x2'));router[_0x464e('0x3')](_0x464e('0x4'),auth[_0x464e('0x5')](),controller[_0x464e('0x6')]);module[_0x464e('0x7')]=router; \ No newline at end of file +var _0x7656=['../../components/auth/service','./user-setting.controller','/:id','isAuthenticated','update','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7656,0xef));var _0x6765=function(_0x1a11aa,_0x2aa566){_0x1a11aa=_0x1a11aa-0x0;var _0x3a0120=_0x7656[_0x1a11aa];return _0x3a0120;};'use strict';var express=require('express');var router=express[_0x6765('0x0')]();var auth=require(_0x6765('0x1'));var controller=require(_0x6765('0x2'));router['put'](_0x6765('0x3'),auth[_0x6765('0x4')](),controller[_0x6765('0x5')]);module['exports']=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 58e313e..75163a6 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 _0x6d0f=['ENUM','BOOLEAN','DATE','UserId','sequelize','error','warning','info','debug','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6d0f,0x18a));var _0xf6d0=function(_0x10e3af,_0x39bd50){_0x10e3af=_0x10e3af-0x0;var _0xe7b59a=_0x6d0f[_0x10e3af];return _0xe7b59a;};'use strict';var Sequelize=require(_0xf6d0('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xf6d0('0x1'),_0xf6d0('0x2'),_0xf6d0('0x3'),_0xf6d0('0x4')];module[_0xf6d0('0x5')]={'clientSideLoggingLevel':{'type':Sequelize[_0xf6d0('0x6')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xf6d0('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xf6d0('0x7')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xf6d0('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0xf6d0('0x9')}}; \ No newline at end of file +var _0x540b=['debug','exports','ENUM','BOOLEAN','DATE','INTEGER','UserId','error','warning','info'];(function(_0x1d174c,_0xd71a94){var _0x193cbf=function(_0x140302){while(--_0x140302){_0x1d174c['push'](_0x1d174c['shift']());}};_0x193cbf(++_0xd71a94);}(_0x540b,0xbb));var _0xb540=function(_0xc46d5d,_0x8b40d8){_0xc46d5d=_0xc46d5d-0x0;var _0x5cd21c=_0x540b[_0xc46d5d];return _0x5cd21c;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0xb540('0x0'),_0xb540('0x1'),_0xb540('0x2'),_0xb540('0x3')];module[_0xb540('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xb540('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xb540('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xb540('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xb540('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xb540('0x8')],'unique':_0xb540('0x9')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index a1e5f28..40ec3fa 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 _0xf842=['socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','json','update','then','sendStatus','error','stack','name','send','user','params','Invalid\x20user\x20setting\x20id','UserSetting','catch','lodash','ioredis','../../config/logger','api','../../mysqldb'];(function(_0xb0de07,_0x3ca2a0){var _0x4633d8=function(_0x2368e0){while(--_0x2368e0){_0xb0de07['push'](_0xb0de07['shift']());}};_0x4633d8(++_0x3ca2a0);}(_0xf842,0x172));var _0x2f84=function(_0xf2628e,_0x521bf7){_0xf2628e=_0xf2628e-0x0;var _0x13863a=_0xf842[_0xf2628e];return _0x13863a;};'use strict';var _=require(_0x2f84('0x0'));var Redis=require(_0x2f84('0x1'));var logger=require(_0x2f84('0x2'))(_0x2f84('0x3'));var config=require('../../config/environment');var db=require(_0x2f84('0x4'))['db'];var socket=require(_0x2f84('0x5'))(new Redis(config[_0x2f84('0x6')]));require(_0x2f84('0x7'))[_0x2f84('0x8')](socket);config['redis']=_[_0x2f84('0x9')](config[_0x2f84('0x6')],{'host':_0x2f84('0xa'),'port':0x18eb});function respondWithResult(_0x55bc67,_0x29019a){_0x29019a=_0x29019a||0xc8;return function(_0x29a2db){if(_0x29a2db){return _0x55bc67[_0x2f84('0xb')](_0x29019a)[_0x2f84('0xc')](_0x29a2db);}};}function saveUpdates(_0x186888){return function(_0x146693){if(_0x146693){return _0x146693[_0x2f84('0xd')](_0x186888)[_0x2f84('0xe')](function(_0x2d789f){return _0x2d789f;});}return null;};}function handleEntityNotFound(_0x171cca){return function(_0x4edf3b){if(!_0x4edf3b){_0x171cca[_0x2f84('0xf')](0x194);}return _0x4edf3b;};}function handleError(_0x555dd2,_0x1f8cb1){_0x1f8cb1=_0x1f8cb1||0x1f4;return function(_0x14b1e2){logger[_0x2f84('0x10')](_0x14b1e2[_0x2f84('0x11')]);if(_0x14b1e2[_0x2f84('0x12')]){delete _0x14b1e2[_0x2f84('0x12')];}_0x555dd2[_0x2f84('0xb')](_0x1f8cb1)[_0x2f84('0x13')](_0x14b1e2);};}exports[_0x2f84('0xd')]=function(_0x20e0d0,_0x1143fa){if(_0x20e0d0[_0x2f84('0x14')]['role']!=='admin')throw new Error('Unauthorized');if(isNaN(Number(_0x20e0d0[_0x2f84('0x15')]['id'])))throw new Error(_0x2f84('0x16'));return db[_0x2f84('0x17')]['find']({'where':{'id':_0x20e0d0[_0x2f84('0x15')]['id']}})[_0x2f84('0xe')](handleEntityNotFound(_0x1143fa,null))[_0x2f84('0xe')](saveUpdates(_0x20e0d0['body'],null))[_0x2f84('0xe')](respondWithResult(_0x1143fa,null))[_0x2f84('0x18')](handleError(_0x1143fa,null));}; \ No newline at end of file +var _0x8ce3=['then','body','catch','lodash','ioredis','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','localhost','status','update','sendStatus','error','stack','name','send','admin','Unauthorized','params','UserSetting'];(function(_0x14850c,_0x4ebcdf){var _0x5610a3=function(_0x25b86a){while(--_0x25b86a){_0x14850c['push'](_0x14850c['shift']());}};_0x5610a3(++_0x4ebcdf);}(_0x8ce3,0xc3));var _0x38ce=function(_0x55f6d7,_0x5bd984){_0x55f6d7=_0x55f6d7-0x0;var _0x2153cc=_0x8ce3[_0x55f6d7];return _0x2153cc;};'use strict';var _=require(_0x38ce('0x0'));var Redis=require(_0x38ce('0x1'));var logger=require('../../config/logger')(_0x38ce('0x2'));var config=require(_0x38ce('0x3'));var db=require(_0x38ce('0x4'))['db'];var socket=require(_0x38ce('0x5'))(new Redis(config[_0x38ce('0x6')]));require(_0x38ce('0x7'))[_0x38ce('0x8')](socket);config[_0x38ce('0x6')]=_['defaults'](config[_0x38ce('0x6')],{'host':_0x38ce('0x9'),'port':0x18eb});function respondWithResult(_0x58074c,_0x262b13){_0x262b13=_0x262b13||0xc8;return function(_0xbe7332){if(_0xbe7332){return _0x58074c[_0x38ce('0xa')](_0x262b13)['json'](_0xbe7332);}};}function saveUpdates(_0x3c66e5){return function(_0x4f0d59){if(_0x4f0d59){return _0x4f0d59[_0x38ce('0xb')](_0x3c66e5)['then'](function(_0x133bd5){return _0x133bd5;});}return null;};}function handleEntityNotFound(_0x31c2e1){return function(_0xa9931b){if(!_0xa9931b){_0x31c2e1[_0x38ce('0xc')](0x194);}return _0xa9931b;};}function handleError(_0x564332,_0x3603fa){_0x3603fa=_0x3603fa||0x1f4;return function(_0x2a9045){logger[_0x38ce('0xd')](_0x2a9045[_0x38ce('0xe')]);if(_0x2a9045[_0x38ce('0xf')]){delete _0x2a9045[_0x38ce('0xf')];}_0x564332[_0x38ce('0xa')](_0x3603fa)[_0x38ce('0x10')](_0x2a9045);};}exports[_0x38ce('0xb')]=function(_0x2e661b,_0x2cf066){if(_0x2e661b['user']['role']!==_0x38ce('0x11'))throw new Error(_0x38ce('0x12'));if(isNaN(Number(_0x2e661b[_0x38ce('0x13')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x38ce('0x14')]['find']({'where':{'id':_0x2e661b[_0x38ce('0x13')]['id']}})[_0x38ce('0x15')](handleEntityNotFound(_0x2cf066,null))['then'](saveUpdates(_0x2e661b[_0x38ce('0x16')],null))[_0x38ce('0x15')](respondWithResult(_0x2cf066,null))[_0x38ce('0x17')](handleError(_0x2cf066,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 07da6c0..36c4123 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 _0xb34c=['../../mysqldb','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0xb34c,0x1ea));var _0xcb34=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb34c[_0x3947c9];return _0x2e7871;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0xcb34('0x0'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xcb34('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcb34('0x2'),'afterDestroy':'remove'};function emitEvent(_0x22d788){return function(_0x3c1fe2,_0x190741,_0x4442b5){UserSettingEvents[_0xcb34('0x3')](_0x22d788+':'+_0x3c1fe2['id'],_0x3c1fe2);UserSettingEvents[_0xcb34('0x3')](_0x22d788,_0x3c1fe2);_0x4442b5(null);};}for(var e in events){if(events[_0xcb34('0x4')](e)){var event=events[e];UserSetting[_0xcb34('0x5')](e,emitEvent(event));}}module[_0xcb34('0x6')]=UserSettingEvents; \ No newline at end of file +var _0x203a=['events','../../mysqldb','setMaxListeners','save','remove','emit','hook','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x203a,0xe0));var _0xa203=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x203a[_0x4565bf];return _0x5610ba;};'use strict';var EventEmitter=require(_0xa203('0x0'));var UserSetting=require(_0xa203('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xa203('0x2')](0x0);var events={'afterCreate':_0xa203('0x3'),'afterUpdate':'update','afterDestroy':_0xa203('0x4')};function emitEvent(_0x157a5c){return function(_0x1f37ad,_0xddf5c7,_0x100385){UserSettingEvents[_0xa203('0x5')](_0x157a5c+':'+_0x1f37ad['id'],_0x1f37ad);UserSettingEvents[_0xa203('0x5')](_0x157a5c,_0x1f37ad);_0x100385(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0xa203('0x6')](e,emitEvent(event));}}module[_0xa203('0x7')]=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 6db486a..5e482d7 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 _0x0abf=['clientSideLoggingEnabledSince','./user-setting.attributes','define'];(function(_0x44e344,_0x3ae6e4){var _0x32b41f=function(_0x3a38e4){while(--_0x3a38e4){_0x44e344['push'](_0x44e344['shift']());}};_0x32b41f(++_0x3ae6e4);}(_0x0abf,0xe8));var _0xf0ab=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x0abf[_0x5b644e];return _0x49c6bf;};'use strict';var attributes=require(_0xf0ab('0x0'));module['exports']=function(_0x4698fb){return _0x4698fb[_0xf0ab('0x1')]('UserSetting',attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x313b14){if(!_0x313b14['clientSideLoggingEnabled'])_0x313b14[_0xf0ab('0x2')]=null;else if(_0x313b14[_0xf0ab('0x2')]===null)_0x313b14[_0xf0ab('0x2')]=new Date();}}});}; \ No newline at end of file +var _0xcf14=['clientSideLoggingEnabledSince','./user-setting.attributes','define','user_settings','clientSideLoggingEnabled'];(function(_0x23ffe8,_0x3ed23e){var _0xceb462=function(_0x5a72e4){while(--_0x5a72e4){_0x23ffe8['push'](_0x23ffe8['shift']());}};_0xceb462(++_0x3ed23e);}(_0xcf14,0xa1));var _0x4cf1=function(_0x12fcb5,_0x1d9b56){_0x12fcb5=_0x12fcb5-0x0;var _0x23300b=_0xcf14[_0x12fcb5];return _0x23300b;};'use strict';var attributes=require(_0x4cf1('0x0'));module['exports']=function(_0x2a09ab){return _0x2a09ab[_0x4cf1('0x1')]('UserSetting',attributes,{'tableName':_0x4cf1('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x15f9b9){if(!_0x15f9b9[_0x4cf1('0x3')])_0x15f9b9[_0x4cf1('0x4')]=null;else if(_0x15f9b9['clientSideLoggingEnabledSince']===null)_0x15f9b9[_0x4cf1('0x4')]=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 ec46afc..9482ea6 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 _0xea69=['update','emit','user-setting:update','user-setting:update:user-','UserId','register','user-setting:','./user-setting.events','remove'];(function(_0x2077c2,_0x275ab5){var _0x312f9f=function(_0x331435){while(--_0x331435){_0x2077c2['push'](_0x2077c2['shift']());}};_0x312f9f(++_0x275ab5);}(_0xea69,0x97));var _0x9ea6=function(_0x4b5d3b,_0x4a2701){_0x4b5d3b=_0x4b5d3b-0x0;var _0x2e037f=_0xea69[_0x4b5d3b];return _0x2e037f;};'use strict';var UserSettingEvents=require(_0x9ea6('0x0'));var events=['save',_0x9ea6('0x1'),_0x9ea6('0x2')];function createListener(_0x6341ce,_0x6a0527){return function(_0x35ab6c){_0x6a0527[_0x9ea6('0x3')](_0x6341ce,_0x35ab6c);if(_0x6341ce===_0x9ea6('0x4')){_0x6a0527['emit'](_0x9ea6('0x5')+_0x35ab6c[_0x9ea6('0x6')],_0x35ab6c);}};}exports[_0x9ea6('0x7')]=function(_0x10cae9){for(var _0xf7e9b=0x0,_0x1b158e=events['length'];_0xf7e9b<_0x1b158e;_0xf7e9b++){var _0x41aa9f=events[_0xf7e9b];var _0xebaa4a=createListener(_0x9ea6('0x8')+_0x41aa9f,_0x10cae9);UserSettingEvents['on'](_0x41aa9f,_0xebaa4a);}}; \ No newline at end of file +var _0x281d=['emit','user-setting:update:user-','UserId','register','user-setting:','./user-setting.events','save','update'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x281d,0x195));var _0xd281=function(_0x210772,_0x4660ad){_0x210772=_0x210772-0x0;var _0x332e71=_0x281d[_0x210772];return _0x332e71;};'use strict';var UserSettingEvents=require(_0xd281('0x0'));var events=[_0xd281('0x1'),'remove',_0xd281('0x2')];function createListener(_0x2cf0e0,_0x32ac29){return function(_0x426a21){_0x32ac29[_0xd281('0x3')](_0x2cf0e0,_0x426a21);if(_0x2cf0e0==='user-setting:update'){_0x32ac29['emit'](_0xd281('0x4')+_0x426a21[_0xd281('0x5')],_0x426a21);}};}exports[_0xd281('0x6')]=function(_0x37984b){for(var _0x519785=0x0,_0x3134f0=events['length'];_0x519785<_0x3134f0;_0x519785++){var _0xe901ac=events[_0x519785];var _0x27662a=createListener(_0xd281('0x7')+_0xe901ac,_0x37984b);UserSettingEvents['on'](_0xe901ac,_0x27662a);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 849b308..648528c 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 _0x7d13=['removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/whoami','whoami','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','getQueues','getVoiceQueuesRt','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/agents','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','addContacts','/create_many','/:id/queues','diskStorage','join','root','%s-%s','now','single','/:id/login','login','/:id/logout','/:id/pause','pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','put','update','/:id/password','delete','removeTeams','/:id','removeChatInteractions','removeFaxInteractions','/:id/sms_interactions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','/:id/fax_accounts','removeFaxAccounts','removeOpenchannelAccounts'];(function(_0x48f270,_0x2ba6e9){var _0x4bdf06=function(_0x4279fe){while(--_0x4279fe){_0x48f270['push'](_0x48f270['shift']());}};_0x4bdf06(++_0x2ba6e9);}(_0x7d13,0x6c));var _0x37d1=function(_0x1d9934,_0x15c292){_0x1d9934=_0x1d9934-0x0;var _0x3f8856=_0x7d13[_0x1d9934];return _0x3f8856;};'use strict';var multer=require('multer');var util=require(_0x37d1('0x0'));var path=require('path');var timeout=require(_0x37d1('0x1'));var express=require('express');var router=express[_0x37d1('0x2')]();var fs_extra=require(_0x37d1('0x3'));var auth=require(_0x37d1('0x4'));var interaction=require(_0x37d1('0x5'));var config=require(_0x37d1('0x6'));var controller=require('./user.controller');router[_0x37d1('0x7')]('/',auth[_0x37d1('0x8')](),controller[_0x37d1('0x9')]);router[_0x37d1('0x7')]('/describe',auth[_0x37d1('0x8')](),controller[_0x37d1('0xa')]);router[_0x37d1('0x7')](_0x37d1('0xb'),auth[_0x37d1('0x8')](),controller[_0x37d1('0xc')]);router[_0x37d1('0x7')]('/presence',auth['isAuthenticated'](),controller[_0x37d1('0xd')]);router[_0x37d1('0x7')]('/:id',auth[_0x37d1('0x8')](),controller[_0x37d1('0xe')]);router[_0x37d1('0x7')](_0x37d1('0xf'),controller[_0x37d1('0x10')]);router[_0x37d1('0x7')](_0x37d1('0x11'),auth[_0x37d1('0x8')](),controller['getOpenTabs']);router[_0x37d1('0x7')](_0x37d1('0x12'),auth['isAuthenticated'](),controller[_0x37d1('0x13')]);router[_0x37d1('0x7')]('/:id/queues',auth[_0x37d1('0x8')](),controller[_0x37d1('0x14')]);router['get']('/:id/queues_rt',auth[_0x37d1('0x8')](),controller[_0x37d1('0x15')]);router[_0x37d1('0x7')]('/:id/groups',auth[_0x37d1('0x8')](),controller[_0x37d1('0x16')]);router[_0x37d1('0x7')]('/:id/recordings',auth[_0x37d1('0x8')](),controller[_0x37d1('0x17')]);router['get'](_0x37d1('0x18'),auth[_0x37d1('0x8')](),controller[_0x37d1('0x19')]);router[_0x37d1('0x7')](_0x37d1('0x1a'),auth[_0x37d1('0x8')](),controller[_0x37d1('0x1b')]);router[_0x37d1('0x7')]('/:id/openchannel/interactions',auth[_0x37d1('0x8')](),controller[_0x37d1('0x1c')]);router[_0x37d1('0x7')](_0x37d1('0x1d'),auth['isAuthenticated'](),controller['getMailInteractions']);router[_0x37d1('0x7')](_0x37d1('0x1e'),auth[_0x37d1('0x8')](),controller[_0x37d1('0x1f')]);router[_0x37d1('0x7')](_0x37d1('0x20'),auth[_0x37d1('0x8')](),controller[_0x37d1('0x21')]);router[_0x37d1('0x7')](_0x37d1('0x22'),auth[_0x37d1('0x8')](),controller['getWhatsappInteractions']);router[_0x37d1('0x7')](_0x37d1('0x23'),auth[_0x37d1('0x8')](),controller[_0x37d1('0x24')]);router[_0x37d1('0x7')]('/:id/lists',auth[_0x37d1('0x8')](),controller['getLists']);router[_0x37d1('0x7')](_0x37d1('0x25'),auth[_0x37d1('0x8')](),controller['getAgents']);router[_0x37d1('0x7')]('/:id/prefixes',auth[_0x37d1('0x8')](),controller[_0x37d1('0x26')]);router[_0x37d1('0x7')]('/:id/fax_accounts',auth[_0x37d1('0x8')](),controller[_0x37d1('0x27')]);router[_0x37d1('0x7')](_0x37d1('0x28'),auth[_0x37d1('0x8')](),controller[_0x37d1('0x29')]);router[_0x37d1('0x7')]('/:id/openchannel_accounts',auth[_0x37d1('0x8')](),controller[_0x37d1('0x2a')]);router[_0x37d1('0x7')](_0x37d1('0x2b'),auth[_0x37d1('0x8')](),controller['getSmsAccounts']);router[_0x37d1('0x7')](_0x37d1('0x2c'),auth[_0x37d1('0x8')](),controller[_0x37d1('0x2d')]);router[_0x37d1('0x7')]('/:id/whatsapp_accounts',auth[_0x37d1('0x8')](),controller[_0x37d1('0x2e')]);router[_0x37d1('0x7')](_0x37d1('0x2f'),auth[_0x37d1('0x8')](),controller[_0x37d1('0x30')]);router[_0x37d1('0x7')]('/:id/api_key',auth['isAuthenticated'](),controller[_0x37d1('0x31')]);router[_0x37d1('0x32')](_0x37d1('0x12'),auth[_0x37d1('0x8')](),controller[_0x37d1('0x33')]);router[_0x37d1('0x32')]('/',auth['isAuthenticated'](),controller['create']);router[_0x37d1('0x32')](_0x37d1('0x34'),auth[_0x37d1('0x8')](),controller['bulkCreate']);router[_0x37d1('0x32')](_0x37d1('0x35'),auth[_0x37d1('0x8')](),controller['addQueues']);var upload=multer({'storage':multer[_0x37d1('0x36')]({'destination':function(_0x22fad4,_0x4c11d5,_0x3fb0b4){_0x3fb0b4(null,path[_0x37d1('0x37')](config[_0x37d1('0x38')],'server/files/images/'));},'filename':function(_0x34f822,_0x46bc3e,_0xd8f52e){_0xd8f52e(null,util['format'](_0x37d1('0x39'),Date[_0x37d1('0x3a')](),_0x46bc3e['originalname']));}})});router[_0x37d1('0x32')]('/:id/avatar',upload[_0x37d1('0x3b')]('file'),controller['addAvatar']);router[_0x37d1('0x32')](_0x37d1('0x3c'),auth[_0x37d1('0x8')](),controller[_0x37d1('0x3d')]);router[_0x37d1('0x32')](_0x37d1('0x3e'),auth['isAuthenticated'](),controller['logout']);router[_0x37d1('0x32')](_0x37d1('0x3f'),auth[_0x37d1('0x8')](),controller[_0x37d1('0x40')]);router['post'](_0x37d1('0x41'),auth[_0x37d1('0x8')](),controller['unpause']);router['post']('/:id/teams',auth[_0x37d1('0x8')](),controller[_0x37d1('0x42')]);router[_0x37d1('0x32')](_0x37d1('0x43'),auth[_0x37d1('0x8')](),controller[_0x37d1('0x44')]);router['post'](_0x37d1('0x45'),auth[_0x37d1('0x8')](),controller[_0x37d1('0x46')]);router[_0x37d1('0x32')](_0x37d1('0x47'),auth[_0x37d1('0x8')](),controller[_0x37d1('0x48')]);router[_0x37d1('0x32')]('/:id/sms_interactions',auth[_0x37d1('0x8')](),controller[_0x37d1('0x49')]);router[_0x37d1('0x32')](_0x37d1('0x4a'),auth['isAuthenticated'](),controller[_0x37d1('0x4b')]);router['post']('/:id/whatsapp_interactions',auth[_0x37d1('0x8')](),controller[_0x37d1('0x4c')]);router['post']('/:id/fax_accounts',auth[_0x37d1('0x8')](),controller[_0x37d1('0x4d')]);router['post'](_0x37d1('0x28'),auth[_0x37d1('0x8')](),controller[_0x37d1('0x4e')]);router[_0x37d1('0x32')](_0x37d1('0x4f'),auth[_0x37d1('0x8')](),controller[_0x37d1('0x50')]);router[_0x37d1('0x32')](_0x37d1('0x2b'),auth[_0x37d1('0x8')](),controller[_0x37d1('0x51')]);router[_0x37d1('0x32')](_0x37d1('0x2c'),auth['isAuthenticated'](),controller['addChatWebsites']);router[_0x37d1('0x32')](_0x37d1('0x52'),auth[_0x37d1('0x8')](),controller[_0x37d1('0x53')]);router[_0x37d1('0x32')]('/:id/api_key',auth['isAuthenticated'](),controller[_0x37d1('0x54')]);router[_0x37d1('0x55')]('/:id',auth[_0x37d1('0x8')](),controller[_0x37d1('0x56')]);router[_0x37d1('0x55')](_0x37d1('0x57'),auth[_0x37d1('0x8')](),controller['changePassword']);router[_0x37d1('0x58')](_0x37d1('0x35'),auth['isAuthenticated'](),controller['removeQueues']);router['delete'](_0x37d1('0x23'),auth[_0x37d1('0x8')](),controller[_0x37d1('0x59')]);router['delete'](_0x37d1('0x5a'),auth[_0x37d1('0x8')](),controller['destroy']);router['delete']('/:id/chat_interactions',auth[_0x37d1('0x8')](),controller[_0x37d1('0x5b')]);router[_0x37d1('0x58')](_0x37d1('0x45'),auth[_0x37d1('0x8')](),controller['removeMailInteractions']);router[_0x37d1('0x58')](_0x37d1('0x47'),auth[_0x37d1('0x8')](),controller[_0x37d1('0x5c')]);router['delete'](_0x37d1('0x5d'),auth[_0x37d1('0x8')](),controller['removeSmsInteractions']);router[_0x37d1('0x58')](_0x37d1('0x4a'),auth[_0x37d1('0x8')](),controller[_0x37d1('0x5e')]);router[_0x37d1('0x58')](_0x37d1('0x5f'),auth[_0x37d1('0x8')](),controller[_0x37d1('0x60')]);router[_0x37d1('0x58')](_0x37d1('0x61'),auth[_0x37d1('0x8')](),controller[_0x37d1('0x62')]);router['delete'](_0x37d1('0x28'),auth['isAuthenticated'](),controller['removeMailAccounts']);router[_0x37d1('0x58')](_0x37d1('0x4f'),auth[_0x37d1('0x8')](),controller[_0x37d1('0x63')]);router['delete'](_0x37d1('0x2b'),auth['isAuthenticated'](),controller[_0x37d1('0x64')]);router[_0x37d1('0x58')](_0x37d1('0x2c'),auth[_0x37d1('0x8')](),controller[_0x37d1('0x65')]);router[_0x37d1('0x58')](_0x37d1('0x52'),auth['isAuthenticated'](),controller[_0x37d1('0x66')]);router[_0x37d1('0x58')]('/:id/api_key',auth[_0x37d1('0x8')](),controller[_0x37d1('0x67')]);module['exports']=router; \ No newline at end of file +var _0x3495=['root','originalname','single','file','addAvatar','login','logout','/:id/pause','pause','/:id/unpause','/:id/teams','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','createApiKey','put','/:id/password','changePassword','/:id/queues','removeQueues','delete','removeTeams','destroy','removeChatInteractions','/:id/fax_interactions','removeSmsInteractions','/:id/openchannel_interactions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','get','index','/describe','describe','/whoami','isAuthenticated','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','getQueues','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getScheduledCalls','/:id/api_key','getApiKey','addContacts','post','create','/create_many','addQueues'];(function(_0x359bbe,_0x5b7fcc){var _0x1b3353=function(_0x34b41c){while(--_0x34b41c){_0x359bbe['push'](_0x359bbe['shift']());}};_0x1b3353(++_0x5b7fcc);}(_0x3495,0x1de));var _0x5349=function(_0x414b23,_0x316ca3){_0x414b23=_0x414b23-0x0;var _0xa0a59d=_0x3495[_0x414b23];return _0xa0a59d;};'use strict';var multer=require(_0x5349('0x0'));var util=require(_0x5349('0x1'));var path=require(_0x5349('0x2'));var timeout=require(_0x5349('0x3'));var express=require(_0x5349('0x4'));var router=express[_0x5349('0x5')]();var fs_extra=require(_0x5349('0x6'));var auth=require(_0x5349('0x7'));var interaction=require(_0x5349('0x8'));var config=require('../../config/environment');var controller=require(_0x5349('0x9'));router[_0x5349('0xa')]('/',auth['isAuthenticated'](),controller[_0x5349('0xb')]);router['get'](_0x5349('0xc'),auth['isAuthenticated'](),controller[_0x5349('0xd')]);router['get'](_0x5349('0xe'),auth[_0x5349('0xf')](),controller[_0x5349('0x10')]);router[_0x5349('0xa')](_0x5349('0x11'),auth[_0x5349('0xf')](),controller[_0x5349('0x12')]);router['get'](_0x5349('0x13'),auth['isAuthenticated'](),controller[_0x5349('0x14')]);router[_0x5349('0xa')](_0x5349('0x15'),controller[_0x5349('0x16')]);router[_0x5349('0xa')](_0x5349('0x17'),auth[_0x5349('0xf')](),controller[_0x5349('0x18')]);router[_0x5349('0xa')](_0x5349('0x19'),auth['isAuthenticated'](),controller[_0x5349('0x1a')]);router[_0x5349('0xa')]('/:id/queues',auth[_0x5349('0xf')](),controller[_0x5349('0x1b')]);router[_0x5349('0xa')]('/:id/queues_rt',auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0x5349('0xa')]('/:id/groups',auth[_0x5349('0xf')](),controller['getGroups']);router[_0x5349('0xa')](_0x5349('0x1c'),auth[_0x5349('0xf')](),controller[_0x5349('0x1d')]);router['get'](_0x5349('0x1e'),auth[_0x5349('0xf')](),controller[_0x5349('0x1f')]);router[_0x5349('0xa')]('/:id/chat/interactions',auth[_0x5349('0xf')](),controller[_0x5349('0x20')]);router['get']('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0x5349('0x21')]);router['get'](_0x5349('0x22'),auth[_0x5349('0xf')](),controller[_0x5349('0x23')]);router[_0x5349('0xa')](_0x5349('0x24'),auth[_0x5349('0xf')](),controller[_0x5349('0x25')]);router[_0x5349('0xa')](_0x5349('0x26'),auth[_0x5349('0xf')](),controller[_0x5349('0x27')]);router[_0x5349('0xa')]('/:id/whatsapp/interactions',auth[_0x5349('0xf')](),controller[_0x5349('0x28')]);router[_0x5349('0xa')]('/:id/teams',auth[_0x5349('0xf')](),controller['getTeams']);router[_0x5349('0xa')](_0x5349('0x29'),auth[_0x5349('0xf')](),controller['getLists']);router[_0x5349('0xa')](_0x5349('0x2a'),auth[_0x5349('0xf')](),controller[_0x5349('0x2b')]);router[_0x5349('0xa')](_0x5349('0x2c'),auth[_0x5349('0xf')](),controller[_0x5349('0x2d')]);router[_0x5349('0xa')]('/:id/fax_accounts',auth[_0x5349('0xf')](),controller[_0x5349('0x2e')]);router['get'](_0x5349('0x2f'),auth['isAuthenticated'](),controller[_0x5349('0x30')]);router[_0x5349('0xa')](_0x5349('0x31'),auth[_0x5349('0xf')](),controller[_0x5349('0x32')]);router[_0x5349('0xa')]('/:id/sms_accounts',auth[_0x5349('0xf')](),controller[_0x5349('0x33')]);router[_0x5349('0xa')](_0x5349('0x34'),auth['isAuthenticated'](),controller['getChatWebsites']);router[_0x5349('0xa')](_0x5349('0x35'),auth[_0x5349('0xf')](),controller['getWhatsappAccounts']);router[_0x5349('0xa')]('/:id/scheduled_calls',auth[_0x5349('0xf')](),controller[_0x5349('0x36')]);router[_0x5349('0xa')](_0x5349('0x37'),auth[_0x5349('0xf')](),controller[_0x5349('0x38')]);router['post']('/:id/contacts',auth[_0x5349('0xf')](),controller[_0x5349('0x39')]);router[_0x5349('0x3a')]('/',auth[_0x5349('0xf')](),controller[_0x5349('0x3b')]);router[_0x5349('0x3a')](_0x5349('0x3c'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0x5349('0x3a')]('/:id/queues',auth['isAuthenticated'](),controller[_0x5349('0x3d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x18f881,_0xa58d2a,_0xa42dc5){_0xa42dc5(null,path['join'](config[_0x5349('0x3e')],'server/files/images/'));},'filename':function(_0x3c9a9d,_0x46a6da,_0x2ca7af){_0x2ca7af(null,util['format']('%s-%s',Date['now'](),_0x46a6da[_0x5349('0x3f')]));}})});router[_0x5349('0x3a')](_0x5349('0x15'),upload[_0x5349('0x40')](_0x5349('0x41')),controller[_0x5349('0x42')]);router['post']('/:id/login',auth[_0x5349('0xf')](),controller[_0x5349('0x43')]);router[_0x5349('0x3a')]('/:id/logout',auth[_0x5349('0xf')](),controller[_0x5349('0x44')]);router[_0x5349('0x3a')](_0x5349('0x45'),auth['isAuthenticated'](),controller[_0x5349('0x46')]);router['post'](_0x5349('0x47'),auth[_0x5349('0xf')](),controller['unpause']);router[_0x5349('0x3a')](_0x5349('0x48'),auth[_0x5349('0xf')](),controller[_0x5349('0x49')]);router[_0x5349('0x3a')](_0x5349('0x4a'),auth[_0x5349('0xf')](),controller['addChatInteractions']);router['post'](_0x5349('0x4b'),auth[_0x5349('0xf')](),controller[_0x5349('0x4c')]);router[_0x5349('0x3a')]('/:id/fax_interactions',auth[_0x5349('0xf')](),controller['addFaxInteractions']);router['post'](_0x5349('0x4d'),auth[_0x5349('0xf')](),controller[_0x5349('0x4e')]);router[_0x5349('0x3a')]('/:id/openchannel_interactions',auth[_0x5349('0xf')](),controller[_0x5349('0x4f')]);router[_0x5349('0x3a')](_0x5349('0x50'),auth[_0x5349('0xf')](),controller[_0x5349('0x51')]);router[_0x5349('0x3a')](_0x5349('0x52'),auth[_0x5349('0xf')](),controller[_0x5349('0x53')]);router[_0x5349('0x3a')](_0x5349('0x2f'),auth[_0x5349('0xf')](),controller[_0x5349('0x54')]);router['post']('/:id/openchannel_accounts',auth[_0x5349('0xf')](),controller[_0x5349('0x55')]);router[_0x5349('0x3a')](_0x5349('0x56'),auth[_0x5349('0xf')](),controller[_0x5349('0x57')]);router['post'](_0x5349('0x34'),auth[_0x5349('0xf')](),controller[_0x5349('0x58')]);router[_0x5349('0x3a')](_0x5349('0x35'),auth[_0x5349('0xf')](),controller['addWhatsappAccounts']);router[_0x5349('0x3a')]('/:id/api_key',auth[_0x5349('0xf')](),controller[_0x5349('0x59')]);router[_0x5349('0x5a')](_0x5349('0x13'),auth[_0x5349('0xf')](),controller['update']);router[_0x5349('0x5a')](_0x5349('0x5b'),auth[_0x5349('0xf')](),controller[_0x5349('0x5c')]);router['delete'](_0x5349('0x5d'),auth[_0x5349('0xf')](),controller[_0x5349('0x5e')]);router[_0x5349('0x5f')](_0x5349('0x48'),auth[_0x5349('0xf')](),controller[_0x5349('0x60')]);router[_0x5349('0x5f')](_0x5349('0x13'),auth[_0x5349('0xf')](),controller[_0x5349('0x61')]);router[_0x5349('0x5f')](_0x5349('0x4a'),auth[_0x5349('0xf')](),controller[_0x5349('0x62')]);router[_0x5349('0x5f')](_0x5349('0x4b'),auth[_0x5349('0xf')](),controller['removeMailInteractions']);router[_0x5349('0x5f')](_0x5349('0x63'),auth['isAuthenticated'](),controller['removeFaxInteractions']);router[_0x5349('0x5f')](_0x5349('0x4d'),auth[_0x5349('0xf')](),controller[_0x5349('0x64')]);router[_0x5349('0x5f')](_0x5349('0x65'),auth[_0x5349('0xf')](),controller['removeOpenchannelInteractions']);router[_0x5349('0x5f')](_0x5349('0x50'),auth[_0x5349('0xf')](),controller['removeWhatsappInteractions']);router['delete'](_0x5349('0x52'),auth[_0x5349('0xf')](),controller[_0x5349('0x66')]);router[_0x5349('0x5f')](_0x5349('0x2f'),auth[_0x5349('0xf')](),controller[_0x5349('0x67')]);router[_0x5349('0x5f')]('/:id/openchannel_accounts',auth[_0x5349('0xf')](),controller['removeOpenchannelAccounts']);router[_0x5349('0x5f')](_0x5349('0x56'),auth[_0x5349('0xf')](),controller[_0x5349('0x68')]);router['delete']('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x5349('0x69')]);router['delete'](_0x5349('0x35'),auth[_0x5349('0xf')](),controller[_0x5349('0x6a')]);router[_0x5349('0x5f')](_0x5349('0x37'),auth[_0x5349('0xf')](),controller['removeApiKey']);module[_0x5349('0x6b')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 89acfdd..4b21c81 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 _0x008c=['all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','refuse','originate','uac','uas','fingerprint','certificate','active','actpass','update,nonat','TEXT','get','isArray','encryption','avpf','force_avp','icesupport','dtlsenable','dtlssetup','dtlsprivatekey','wss','dtlsverify','dtlscertfile','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','UNSIGNED','sequelize','moment','util','lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','getDataValue','internal','toLowerCase','ENUM','admin','user','agent','telephone','INTEGER','accountcode','\x22%s\x22\x20<%s>','BOOLEAN','DATE','dynamic','friend','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','join','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'];(function(_0x2bef41,_0x5122e3){var _0x582177=function(_0x533c94){while(--_0x533c94){_0x2bef41['push'](_0x2bef41['shift']());}};_0x582177(++_0x5122e3);}(_0x008c,0x188));var _0xc008=function(_0x5eb868,_0x3edfb0){_0x5eb868=_0x5eb868-0x0;var _0x278458=_0x008c[_0x5eb868];return _0x278458;};'use strict';var Sequelize=require(_0xc008('0x0'));var moment=require(_0xc008('0x1'));var util=require(_0xc008('0x2'));var _=require(_0xc008('0x3'));module[_0xc008('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc008('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x47063f){this[_0xc008('0x6')](_0xc008('0x5'),_0x47063f);this[_0xc008('0x6')](_0xc008('0x7'),_0x47063f);},'comment':_0xc008('0x8')},'fullname':{'type':Sequelize[_0xc008('0x9')],'allowNull':![],'set':function(_0x9c8cb2){this['setDataValue'](_0xc008('0xa'),_0x9c8cb2);this['setDataValue'](_0xc008('0xb'),util['format']('\x22%s\x22\x20<%s>',_0x9c8cb2,this[_0xc008('0xc')](_0xc008('0xd'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x1eacfa){if(_0x1eacfa){this[_0xc008('0x6')]('email',_0x1eacfa[_0xc008('0xe')]());}}},'role':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x10'),_0xc008('0x11'),_0xc008('0x12'),_0xc008('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0xc008('0x9')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x25e13f){this[_0xc008('0x6')](_0xc008('0xd'),_0x25e13f);this[_0xc008('0x6')](_0xc008('0x15'),_0x25e13f);this['setDataValue']('callerid',util['format'](_0xc008('0x16'),this[_0xc008('0xc')](_0xc008('0xa')),_0x25e13f));}},'salt':{'type':Sequelize[_0xc008('0x9')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xc008('0x9')]},'city':{'type':Sequelize[_0xc008('0x9')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0xc008('0x18')]},'chatCapacity':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xc008('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![],'defaultValue':_0xc008('0x19')},'ipaddr':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'port':{'type':Sequelize[_0xc008('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x1a'),_0xc008('0x11'),'peer'),'allowNull':!![],'defaultValue':_0xc008('0x1a')},'context':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![],'defaultValue':_0xc008('0x1b')},'callingpres':{'type':Sequelize[_0xc008('0xf')]('ALLOWED_NOT_SCREENED',_0xc008('0x1c'),_0xc008('0x1d'),'ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0xc008('0x1e'),_0xc008('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'permit':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'secret':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'transport':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![],'defaultValue':_0xc008('0x20'),'set':function(_0x2b862d){this[_0xc008('0x6')](_0xc008('0x21'),_0x2b862d?_0x2b862d['join'](','):null);},'get':function(){return this[_0xc008('0xc')](_0xc008('0x21'))?this['getDataValue'](_0xc008('0x21'))[_0xc008('0x22')](','):null;},'comment':_0xc008('0x23')},'dtmfmode':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x24'),_0xc008('0x25'),_0xc008('0x26'),_0xc008('0x27'),_0xc008('0x28')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no',_0xc008('0x2a'),_0xc008('0x2b'),_0xc008('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'nat':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x399b64){this[_0xc008('0x6')]('nat',_0x399b64?_0x399b64[_0xc008('0x2d')](','):null);},'get':function(){return this[_0xc008('0xc')](_0xc008('0x2e'))?this['getDataValue']('nat')['split'](','):null;},'comment':_0xc008('0x2f')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xc008('0x9')]},'pickupgroup':{'type':Sequelize[_0xc008('0x9')]},'namedpickupgroup':{'type':Sequelize[_0xc008('0x9')]},'language':{'type':Sequelize[_0xc008('0x9')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xc008('0x9')]},'disallow':{'type':Sequelize[_0xc008('0x9')],'allowNull':![],'defaultValue':_0xc008('0x30')},'allow':{'type':Sequelize[_0xc008('0x9')],'allowNull':![],'defaultValue':_0xc008('0x31'),'set':function(_0x387dfd){this[_0xc008('0x6')](_0xc008('0x32'),_0x387dfd?_0x387dfd[_0xc008('0x2d')](';'):_0xc008('0x31'));},'get':function(){return this['getDataValue'](_0xc008('0x32'))?this[_0xc008('0xc')](_0xc008('0x32'))[_0xc008('0x22')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![],'set':function(_0x36e7ae){this[_0xc008('0x6')]('insecure',_0x36e7ae?_0x36e7ae[_0xc008('0x2d')](','):null);},'get':function(){return this[_0xc008('0xc')](_0xc008('0x33'))?this[_0xc008('0xc')](_0xc008('0x33'))['split'](','):null;},'comment':_0xc008('0x34')},'trustrpid':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc008('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no',_0xc008('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xc008('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xc008('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xc008('0xf')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'template':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no',_0xc008('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept',_0xc008('0x37'),_0xc008('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x39'),_0xc008('0x3a')),'allowNull':!![],'defaultValue':_0xc008('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xc008('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xc008('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xc008('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no',_0xc008('0x3b'),_0xc008('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x3d'),'passive',_0xc008('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xc008('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xc008('0xf')]('yes','no',_0xc008('0x2a'),'update',_0xc008('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xc008('0x9')]},'resetPasswordExpires':{'type':Sequelize[_0xc008('0x18')]},'passwordResetAt':{'type':Sequelize[_0xc008('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xc008('0x40')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x375e71){this['setDataValue']('showWebBar',_0x375e71);var _0x37ce5e=this[_0xc008('0x41')]({'plain':!![]});switch(_0x375e71){case 0x0:case 0x1:var _0x56e755=_0x37ce5e[_0xc008('0x21')]?_[_0xc008('0x42')](_0x37ce5e[_0xc008('0x21')])?_0x37ce5e[_0xc008('0x21')][_0xc008('0x2d')]():_0x37ce5e[_0xc008('0x21')]:_0xc008('0x20');if(_0x56e755==='wss'){_0x56e755=_0xc008('0x20');}this[_0xc008('0x6')](_0xc008('0x21'),_0x56e755);this[_0xc008('0x6')](_0xc008('0x43'),'no');this[_0xc008('0x6')](_0xc008('0x44'),null);this[_0xc008('0x6')](_0xc008('0x45'),null);this[_0xc008('0x6')](_0xc008('0x46'),null);this[_0xc008('0x6')](_0xc008('0x47'),null);this[_0xc008('0x6')]('dtlsverify',null);this[_0xc008('0x6')](_0xc008('0x48'),null);this[_0xc008('0x6')]('dtlscertfile',null);this[_0xc008('0x6')](_0xc008('0x49'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this[_0xc008('0x6')](_0xc008('0x21'),_0xc008('0x4a'));this[_0xc008('0x6')](_0xc008('0x43'),_0xc008('0x29'));this[_0xc008('0x6')](_0xc008('0x44'),_0xc008('0x29'));this[_0xc008('0x6')](_0xc008('0x45'),'yes');this[_0xc008('0x6')](_0xc008('0x46'),_0xc008('0x29'));this[_0xc008('0x6')]('dtlsenable',_0xc008('0x29'));this['setDataValue'](_0xc008('0x4b'),'no');this[_0xc008('0x6')](_0xc008('0x48'),'actpass');this[_0xc008('0x6')](_0xc008('0x4c'),_0x37ce5e[_0xc008('0x4c')]||'/etc/pki/tls/certs/motion.crt');this[_0xc008('0x6')]('dtlsprivatekey',_0x37ce5e[_0xc008('0x49')]||_0xc008('0x4d'));this[_0xc008('0x6')](_0xc008('0x4e'),_0xc008('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x3c30db){this[_0xc008('0x6')]('permissions',_0x3c30db?_0x3c30db[_0xc008('0x2d')](','):[]);},'get':function(){return this['getDataValue'](_0xc008('0x4f'))?_['map'](this[_0xc008('0xc')]('permissions')[_0xc008('0x22')](','),function(_0x103d75){return parseInt(_0x103d75,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xc008('0x9')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xc008('0x9')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xc008('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xc008('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xc008('0x9')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xc008('0xf')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xc008('0x50')],'get':function(){return this[_0xc008('0xc')](_0xc008('0x51'))?this[_0xc008('0xc')](_0xc008('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xc008('0x9')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![],'set':function(_0x3b2669){if(typeof _0x3b2669===_0xc008('0x52')){var _0x2edb8e=_0x3b2669==='1'?!![]:_0x3b2669==='0'?![]:_0x3b2669===_0xc008('0x53')?!![]:_0x3b2669===_0xc008('0x54')?![]:![];this[_0xc008('0x6')](_0xc008('0x55'),_0x2edb8e);}else{this['setDataValue']('screenrecording',_0x3b2669);}}},'blocked':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![],'set':function(_0x3104cd){this[_0xc008('0x6')]('blocked',_0x3104cd);if(_0x3104cd===!![]){this[_0xc008('0x6')](_0xc008('0x56'),moment());this['setDataValue']('loginAttempts',0x0);}else{this['setDataValue'](_0xc008('0x56'),null);}}},'blockedAt':{'type':Sequelize[_0xc008('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xc008('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xc008('0x14')](0x5)[_0xc008('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xc008('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xc008('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xc008('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x9c44=['get','udp','encryption','avpf','force_avp','icesupport','dtlscertfile','dtlsprivatekey','wss','dtlsenable','dtlsverify','dtlssetup','actpass','/etc/pki/tls/certs/motion.crt','rtcp_mux','permissions','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','util','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','admin','user','telephone','local','INTEGER','internal','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','accept','refuse','originate','uac','uas','fingerprint','certificate','active','update,nonat','TEXT'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x49c4('0x0'));var _=require(_0x49c4('0x1'));module[_0x49c4('0x2')]={'name':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2ad237){this['setDataValue']('name',_0x2ad237);this[_0x49c4('0x5')]('defaultuser',_0x2ad237);},'comment':_0x49c4('0x6')},'fullname':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'set':function(_0x69bc41){this[_0x49c4('0x5')](_0x49c4('0x7'),_0x69bc41);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),_0x69bc41,this[_0x49c4('0xb')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0xc'),'validate':{'isEmail':!![]},'set':function(_0x58cad7){if(_0x58cad7){this[_0x49c4('0x5')](_0x49c4('0xc'),_0x58cad7['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x49c4('0xd'),_0x49c4('0xe'),'agent',_0x49c4('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0x10')},'internal':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':![],'unique':_0x49c4('0x12'),'set':function(_0x2decee){this[_0x49c4('0x5')](_0x49c4('0x12'),_0x2decee);this[_0x49c4('0x5')](_0x49c4('0x13'),_0x2decee);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),this[_0x49c4('0xb')](_0x49c4('0x7')),_0x2decee));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x49c4('0x3')]},'mobile':{'type':Sequelize[_0x49c4('0x3')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x49c4('0x3')]},'city':{'type':Sequelize[_0x49c4('0x3')]},'country':{'type':Sequelize[_0x49c4('0x3')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x49c4('0x14')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':_0x49c4('0x16')},'lastPauseAt':{'type':Sequelize[_0x49c4('0x14')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x17')},'ipaddr':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x19'),'user',_0x49c4('0x1a')),'allowNull':!![],'defaultValue':_0x49c4('0x19')},'context':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x1b')},'callingpres':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x1c'),_0x49c4('0x1d'),_0x49c4('0x1e'),_0x49c4('0x1f'),_0x49c4('0x20'),_0x49c4('0x21'),'PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x38ad77){this[_0x49c4('0x5')](_0x49c4('0x22'),_0x38ad77?_0x38ad77[_0x49c4('0x23')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x49c4('0xb')](_0x49c4('0x22'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x25')},'dtmfmode':{'type':Sequelize[_0x49c4('0x18')]('rfc2833',_0x49c4('0x26'),_0x49c4('0x27'),_0x49c4('0x28'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x49c4('0x2d'),'set':function(_0x5b96df){this[_0x49c4('0x5')](_0x49c4('0x2e'),_0x5b96df?_0x5b96df[_0x49c4('0x23')](','):null);},'get':function(){return this[_0x49c4('0xb')]('nat')?this[_0x49c4('0xb')](_0x49c4('0x2e'))[_0x49c4('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedcallgroup':{'type':Sequelize[_0x49c4('0x3')]},'pickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'language':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x49c4('0x3')]},'disallow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x2f')},'allow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x30'),'set':function(_0x1e506a){this['setDataValue'](_0x49c4('0x31'),_0x1e506a?_0x1e506a[_0x49c4('0x23')](';'):_0x49c4('0x30'));},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x31'))?this[_0x49c4('0xb')](_0x49c4('0x31'))[_0x49c4('0x24')](';'):null;},'comment':_0x49c4('0x32')},'autoframing':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'set':function(_0x326142){this['setDataValue'](_0x49c4('0x33'),_0x326142?_0x326142['join'](','):null);},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x33'))?this[_0x49c4('0xb')](_0x49c4('0x33'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x34')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x35')},'amaflags':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x36'),_0x49c4('0x37'),_0x49c4('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x39'),'uas'),'allowNull':!![],'defaultValue':_0x49c4('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x3b'),_0x49c4('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x3d'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x49c4('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x49c4('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x49c4('0x3f')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x10dec7){this[_0x49c4('0x5')]('showWebBar',_0x10dec7);var _0x39c455=this[_0x49c4('0x40')]({'plain':!![]});switch(_0x10dec7){case 0x0:case 0x1:var _0x4f50bf=_0x39c455['transport']?_['isArray'](_0x39c455['transport'])?_0x39c455[_0x49c4('0x22')]['join']():_0x39c455[_0x49c4('0x22')]:_0x49c4('0x41');if(_0x4f50bf==='wss'){_0x4f50bf=_0x49c4('0x41');}this[_0x49c4('0x5')]('transport',_0x4f50bf);this[_0x49c4('0x5')](_0x49c4('0x42'),'no');this[_0x49c4('0x5')](_0x49c4('0x43'),null);this['setDataValue'](_0x49c4('0x44'),null);this[_0x49c4('0x5')](_0x49c4('0x45'),null);this[_0x49c4('0x5')]('dtlsenable',null);this[_0x49c4('0x5')]('dtlsverify',null);this['setDataValue']('dtlssetup',null);this['setDataValue'](_0x49c4('0x46'),null);this[_0x49c4('0x5')](_0x49c4('0x47'),null);this[_0x49c4('0x5')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x49c4('0x22'),_0x49c4('0x48'));this[_0x49c4('0x5')](_0x49c4('0x42'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x43'),_0x49c4('0x29'));this['setDataValue'](_0x49c4('0x44'),'yes');this[_0x49c4('0x5')](_0x49c4('0x45'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x49'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x4a'),'no');this[_0x49c4('0x5')](_0x49c4('0x4b'),_0x49c4('0x4c'));this[_0x49c4('0x5')](_0x49c4('0x46'),_0x39c455[_0x49c4('0x46')]||_0x49c4('0x4d'));this[_0x49c4('0x5')](_0x49c4('0x47'),_0x39c455[_0x49c4('0x47')]||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0x49c4('0x4e'),_0x49c4('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x1a15f3){this[_0x49c4('0x5')](_0x49c4('0x4f'),_0x1a15f3?_0x1a15f3[_0x49c4('0x23')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_['map'](this[_0x49c4('0xb')](_0x49c4('0x4f'))[_0x49c4('0x24')](','),function(_0x2f4289){return parseInt(_0x2f4289,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x50'))?this[_0x49c4('0xb')](_0x49c4('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x27b77d){if(typeof _0x27b77d===_0x49c4('0x51')){var _0x34870e=_0x27b77d==='1'?!![]:_0x27b77d==='0'?![]:_0x27b77d==='true'?!![]:_0x27b77d===_0x49c4('0x52')?![]:![];this[_0x49c4('0x5')](_0x49c4('0x53'),_0x34870e);}else{this[_0x49c4('0x5')](_0x49c4('0x53'),_0x27b77d);}}},'blocked':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x38b291){this[_0x49c4('0x5')](_0x49c4('0x54'),_0x38b291);if(_0x38b291===!![]){this[_0x49c4('0x5')]('blockedAt',moment());this[_0x49c4('0x5')](_0x49c4('0x55'),0x0);}else{this['setDataValue'](_0x49c4('0x56'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x49c4('0x11')](0x5)[_0x49c4('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 607fa6f..cf6dcac 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 _0xd1a7=['removeFaxInteractions','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','CmHopper','$and','$or','$gte','$lt','$lte','$eq','$between','$like','$iLike','$notILike','$overlap','$contains','$contained','$any','firstName','lastName','Contact','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','userSetting','getUserSetting','getPresence','teams','queues','isEmpty','inbound','flatten','lower','col','toString','desc','asc','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','offline','unknown','ringing','voiceStatus','busy','slice','charAt','toUpperCase','SELECT','select','ui.','InteractionId','field','ui.createdAt','user_has_','ui.UserId\x20=\x20?','OpenTabs','util','path','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','register','defaults','redis','localhost','http','request','then','info','User,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','end','status','json','undefined','count','offset','limit','Content-Range','update','role','agent','emit','userNotification:recalc:','destroy','get','admin','user','Telephones','telephone','filter','ignore','value','includes','find','name','UserProfileResource','sendStatus','send','index','User','rawAttributes','type','key','salt','includeAll','include','query','true','attributes','push','findAll','rows','length','chat','dataValues','mail','openchannel','catch','show','params','model','keys','password','filters','intersection','fields','UserSetting','merge','options','openTabs','whatsapp','all','body','describe','addContacts','ids','internal','Setting','securePassword','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','from','mailbox','VoiceMail','fullname','email','permissions','101','103','113','110','105','106','108','109','100','114','115','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','create','UserProfileSection','Agents','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','map','compact','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','updatePasswordsHistory','online','voicePause','interface','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','Queue:save','voice','VoiceQueue','format','SIP/%s','UserVoiceQueueRt','upsert','channel','isValidChannel','remove','Queue:remove','addAvatar','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','userpic','download','existsSync','server/files/images/','getOpenTabs','sms','fax','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','WhatsappOpenTabs','WHATSAPP','concat','getContacts','CmContact','order','where','hasOwnProperty','CmList','List','Tag','tag','getQueues','Queue','sort','pick','Unknown\x20role','getVoiceQueuesRt','nolimit','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','phone','loginInPause','LOCAL/%s@from-sip/n','intrf','user:forcelogout','x-forwarded-for','connection','socket','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','bulkCreate','LOGININPAUSE','isMiddleware','resolve','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','openchannelPause','smsPause','whatsappPause','pauseType','User\x20with\x20id\x20%s\x20not\x20found','getTeams','Team','addTeams','transaction','getAssociatedQueues','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','isArray','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeTeams','getLists','getAgents','getVoiceQueues','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','omit','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save'];(function(_0x1ba03b,_0x31f6a2){var _0x1af7b5=function(_0x45cd13){while(--_0x45cd13){_0x1ba03b['push'](_0x1ba03b['shift']());}};_0x1af7b5(++_0x31f6a2);}(_0xd1a7,0x1e8));var _0x7d1a=function(_0x242f07,_0x10a3e8){_0x242f07=_0x242f07-0x0;var _0xb47e3f=_0xd1a7[_0x242f07];return _0xb47e3f;};'use strict';var moment=require('moment');var util=require(_0x7d1a('0x0'));var path=require(_0x7d1a('0x1'));var fs=require('fs');var _=require(_0x7d1a('0x2'));var squel=require(_0x7d1a('0x3'));var jayson=require('jayson/promise');var Redis=require(_0x7d1a('0x4'));var authService=require(_0x7d1a('0x5'));var qs=require(_0x7d1a('0x6'));var logger=require(_0x7d1a('0x7'))(_0x7d1a('0x8'));var utils=require(_0x7d1a('0x9'));var config=require(_0x7d1a('0xa'));var licenseUtil=require(_0x7d1a('0xb'));var APIBadRequestError=require(_0x7d1a('0xc'))[_0x7d1a('0xd')];var APINotFoundError=require(_0x7d1a('0xc'))[_0x7d1a('0xe')];var APIHandleError=require(_0x7d1a('0xc'))[_0x7d1a('0xf')];var db=require(_0x7d1a('0x10'))['db'];var socket=require(_0x7d1a('0x11'))(new Redis(config['redis']));require('./user.socket')[_0x7d1a('0x12')](socket);config['redis']=_[_0x7d1a('0x13')](config[_0x7d1a('0x14')],{'host':_0x7d1a('0x15'),'port':0x18eb});var amiClient=jayson['client'][_0x7d1a('0x16')]({'port':0x232a});var values;function respondWithRpcPromise(_0xf5f7e3,_0x365937,_0x48261a,_0x45ab0f){return new Promise(function(_0x3637ed,_0xa8585f){var _0x1bba1=_0x45ab0f||amiClient;return _0x1bba1[_0x7d1a('0x17')](_0xf5f7e3,_0x48261a)[_0x7d1a('0x18')](function(_0x21b190){logger[_0x7d1a('0x19')](_0x7d1a('0x1a'),_0x365937,'request\x20sent');logger['debug']('User,\x20%s,\x20%s,\x20%s',_0x365937,'request\x20sent',JSON[_0x7d1a('0x1b')](_0x21b190));if(_0x21b190[_0x7d1a('0x1c')]){if(_0x21b190['error'][_0x7d1a('0x1d')]===0x1f4){logger[_0x7d1a('0x1c')](_0x7d1a('0x1a'),_0x365937,_0x21b190[_0x7d1a('0x1c')][_0x7d1a('0x1e')]);return _0xa8585f(_0x21b190[_0x7d1a('0x1c')][_0x7d1a('0x1e')]);}logger['error'](_0x7d1a('0x1a'),_0x365937,_0x21b190[_0x7d1a('0x1c')][_0x7d1a('0x1e')]);return _0x3637ed(_0x21b190[_0x7d1a('0x1c')]['message']);}else{logger['info']('User,\x20%s,\x20%s',_0x365937,_0x7d1a('0x1f'));_0x3637ed(_0x21b190['result'][_0x7d1a('0x1e')]);}})['catch'](function(_0x4b1cd7){logger[_0x7d1a('0x1c')](_0x7d1a('0x1a'),_0x365937,_0x4b1cd7);_0xa8585f(_0x4b1cd7);});});}function respondWithStatusCode(_0x1b8103,_0x459195){_0x459195=_0x459195||0xcc;return function(_0x30fe88){if(_0x30fe88){return _0x1b8103['sendStatus'](_0x459195);}return _0x1b8103['status'](_0x459195)[_0x7d1a('0x20')]();};}function respondWithResult(_0x3c997a,_0x566fd4){_0x566fd4=_0x566fd4||0xc8;return function(_0x311ee6){if(_0x311ee6){return _0x3c997a[_0x7d1a('0x21')](_0x566fd4)[_0x7d1a('0x22')](_0x311ee6);}};}function respondWithFilteredResult(_0x37ac95,_0x27bf6a){return function(_0x19a299){if(_0x19a299){var _0x461e6b=typeof _0x27bf6a['offset']==='undefined'&&typeof _0x27bf6a['limit']===_0x7d1a('0x23');var _0x410407=_0x19a299[_0x7d1a('0x24')];var _0x513579=_0x461e6b?0x0:_0x27bf6a[_0x7d1a('0x25')];var _0x50d5ac=_0x461e6b?_0x19a299[_0x7d1a('0x24')]:_0x27bf6a['offset']+_0x27bf6a[_0x7d1a('0x26')];var _0x5ee077;if(_0x50d5ac>=_0x410407){_0x50d5ac=_0x410407;_0x5ee077=0xc8;}else{_0x5ee077=0xce;}_0x37ac95[_0x7d1a('0x21')](_0x5ee077);return _0x37ac95['set'](_0x7d1a('0x27'),_0x513579+'-'+_0x50d5ac+'/'+_0x410407)['json'](_0x19a299);}return null;};}function saveUpdates(_0x55bb04){return function(_0x16d6e4){if(_0x16d6e4){return _0x16d6e4[_0x7d1a('0x28')](_0x55bb04)[_0x7d1a('0x18')](function(_0x42d47c){if(_0x42d47c[_0x7d1a('0x29')]===_0x7d1a('0x2a')){socket[_0x7d1a('0x2b')](_0x7d1a('0x2c')+_0x42d47c['id'],_0x42d47c);}return _0x42d47c;});}return null;};}function removeEntity(_0x348b18){return function(_0x579194){if(_0x579194){return _0x579194[_0x7d1a('0x2d')]()[_0x7d1a('0x18')](function(){var _0x5c72eb=_0x579194[_0x7d1a('0x2e')]({'plain':!![]});if(_0x5c72eb[_0x7d1a('0x29')]===_0x7d1a('0x2f'))return;var _0x2c5640=[{'name':'Users','value':_0x7d1a('0x30'),'ignore':!![]},{'name':'Agents','value':_0x7d1a('0x2a'),'ignore':![]},{'name':_0x7d1a('0x31'),'value':_0x7d1a('0x32'),'ignore':![]}];var _0x48b9c9=_(_0x2c5640)[_0x7d1a('0x33')](_0x7d1a('0x34'))['map'](_0x7d1a('0x35'))[_0x7d1a('0x35')]();if(_[_0x7d1a('0x36')](_0x48b9c9,_0x5c72eb[_0x7d1a('0x29')])){return;}var _0x4036de=_[_0x7d1a('0x37')](_0x2c5640,[_0x7d1a('0x35'),_0x5c72eb[_0x7d1a('0x29')]])[_0x7d1a('0x38')];return db[_0x7d1a('0x39')][_0x7d1a('0x2d')]({'where':{'type':_0x4036de,'resourceId':_0x5c72eb['id']}})[_0x7d1a('0x18')](function(){return _0x579194;});})[_0x7d1a('0x18')](function(){_0x348b18['status'](0xcc)[_0x7d1a('0x20')]();});}};}function handleEntityNotFound(_0x4bb7b9){return function(_0x1bb66c){if(!_0x1bb66c){_0x4bb7b9[_0x7d1a('0x3a')](0x194);}return _0x1bb66c;};}function handleError(_0x52e2be,_0x4f0e4e){_0x4f0e4e=_0x4f0e4e||0x1f4;return function(_0x5784ab){logger['error'](_0x5784ab['stack']);if(_0x5784ab[_0x7d1a('0x38')]){delete _0x5784ab[_0x7d1a('0x38')];}_0x52e2be[_0x7d1a('0x21')](_0x4f0e4e)[_0x7d1a('0x3b')](_0x5784ab);};}exports[_0x7d1a('0x3c')]=function(_0x138691,_0x1527b0){var _0x54813d={},_0x581343={'count':0x0,'rows':[]};var _0x39e2b1=_(db[_0x7d1a('0x3d')][_0x7d1a('0x3e')])['map'](function(_0x2aa315){return{'name':_0x2aa315['fieldName'],'type':_0x2aa315[_0x7d1a('0x3f')][_0x7d1a('0x40')]};})[_0x7d1a('0x33')](function(_0x106aae){return!_['includes'](['password',_0x7d1a('0x41')],_0x106aae[_0x7d1a('0x38')]);})[_0x7d1a('0x35')]();_0x54813d=qs['getOptions'](_0x39e2b1,_0x138691);var _0x2c016f={'where':_0x54813d['where']};return db[_0x7d1a('0x3d')]['count'](_0x2c016f)[_0x7d1a('0x18')](function(_0x5e9698){_0x581343[_0x7d1a('0x24')]=_0x5e9698;if(_0x138691['query'][_0x7d1a('0x42')]){_0x54813d[_0x7d1a('0x43')]=[{'all':!![]}];}if(_0x138691[_0x7d1a('0x44')]['userSetting']===_0x7d1a('0x45')){_0x54813d[_0x7d1a('0x43')]=[{'model':db['UserSetting'],'as':'userSetting'}];}if(!_[_0x7d1a('0x36')](_0x54813d[_0x7d1a('0x46')],'id')){_0x54813d[_0x7d1a('0x46')][_0x7d1a('0x47')]('id');}return db[_0x7d1a('0x3d')][_0x7d1a('0x48')](_0x54813d);})[_0x7d1a('0x18')](function(_0x5b37a0){_0x581343[_0x7d1a('0x49')]=_0x5b37a0;if(_0x138691[_0x7d1a('0x44')]['openTabs']===_0x7d1a('0x45')){var _0x345544=[];for(var _0x391209=0x0;_0x391209<_0x581343[_0x7d1a('0x49')][_0x7d1a('0x4a')];_0x391209++){_0x345544['push'](get_open_tabs(_0x7d1a('0x4b'),_0x581343[_0x7d1a('0x49')][_0x391209][_0x7d1a('0x4c')]));_0x345544[_0x7d1a('0x47')](get_open_tabs('sms',_0x581343[_0x7d1a('0x49')][_0x391209][_0x7d1a('0x4c')]));_0x345544[_0x7d1a('0x47')](get_open_tabs('fax',_0x581343[_0x7d1a('0x49')][_0x391209]['dataValues']));_0x345544[_0x7d1a('0x47')](get_open_tabs(_0x7d1a('0x4d'),_0x581343[_0x7d1a('0x49')][_0x391209]['dataValues']));_0x345544[_0x7d1a('0x47')](get_open_tabs(_0x7d1a('0x4e'),_0x581343[_0x7d1a('0x49')][_0x391209][_0x7d1a('0x4c')]));_0x345544['push'](get_open_tabs('whatsapp',_0x581343[_0x7d1a('0x49')][_0x391209]['dataValues']));}return Promise['all'](_0x345544)[_0x7d1a('0x18')](function(){return _0x581343;});}else{return _0x581343;}})['then'](respondWithFilteredResult(_0x1527b0,_0x54813d))[_0x7d1a('0x4f')](handleError(_0x1527b0,null));};exports[_0x7d1a('0x50')]=function(_0x48bae9,_0x1ea095){var _0x25f5c7={'raw':![],'where':{'id':_0x48bae9[_0x7d1a('0x51')]['id']}},_0x433c66={};_0x433c66[_0x7d1a('0x52')]=_['differenceBy'](_[_0x7d1a('0x53')](db['User'][_0x7d1a('0x3e')]),[_0x7d1a('0x54'),'salt']);_0x433c66[_0x7d1a('0x44')]=_[_0x7d1a('0x53')](_0x48bae9[_0x7d1a('0x44')]);_0x433c66[_0x7d1a('0x55')]=_[_0x7d1a('0x56')](_0x433c66[_0x7d1a('0x52')],_0x433c66[_0x7d1a('0x44')]);_0x25f5c7['attributes']=_['intersection'](_0x433c66[_0x7d1a('0x52')],qs['fields'](_0x48bae9['query'][_0x7d1a('0x57')]));_0x25f5c7['attributes']=_0x25f5c7[_0x7d1a('0x46')][_0x7d1a('0x4a')]?_0x25f5c7[_0x7d1a('0x46')]:_0x433c66[_0x7d1a('0x52')];if(_0x48bae9[_0x7d1a('0x44')]['includeAll']){_0x25f5c7[_0x7d1a('0x43')]=[{'all':!![]}];}if(_0x48bae9['query']['userSetting']===_0x7d1a('0x45')){_0x25f5c7[_0x7d1a('0x43')]=[{'model':db[_0x7d1a('0x58')],'as':'userSetting'}];}_0x25f5c7=_[_0x7d1a('0x59')]({},_0x25f5c7,_0x48bae9[_0x7d1a('0x5a')]);if(!_['includes'](_0x25f5c7[_0x7d1a('0x46')],'id')){_0x25f5c7[_0x7d1a('0x46')][_0x7d1a('0x47')]('id');}return db['User'][_0x7d1a('0x37')](_0x25f5c7)[_0x7d1a('0x18')](handleEntityNotFound(_0x1ea095,null))[_0x7d1a('0x18')](function(_0x50ace5){var _0x4323c5=[];values=_0x50ace5;if(_0x48bae9[_0x7d1a('0x44')][_0x7d1a('0x5b')]==='true'){_0x4323c5['push'](get_open_tabs(_0x7d1a('0x4b'),_0x50ace5['dataValues']));_0x4323c5[_0x7d1a('0x47')](get_open_tabs('sms',_0x50ace5[_0x7d1a('0x4c')]));_0x4323c5['push'](get_open_tabs('openchannel',_0x50ace5[_0x7d1a('0x4c')]));_0x4323c5[_0x7d1a('0x47')](get_open_tabs(_0x7d1a('0x5c'),_0x50ace5[_0x7d1a('0x4c')]));_0x4323c5['push'](get_open_tabs('fax',_0x50ace5['dataValues']));_0x4323c5['push'](get_open_tabs('mail',_0x50ace5[_0x7d1a('0x4c')]));return Promise[_0x7d1a('0x5d')](_0x4323c5);}else{return values;}})[_0x7d1a('0x18')](function(){return values;})['then'](respondWithResult(_0x1ea095,null))['catch'](handleError(_0x1ea095,null));};exports[_0x7d1a('0x28')]=function(_0xbe0590,_0x567322){if(_0xbe0590['body']['id']){delete _0xbe0590[_0x7d1a('0x5e')]['id'];}delete _0xbe0590[_0x7d1a('0x5e')]['role'];return db[_0x7d1a('0x3d')][_0x7d1a('0x37')]({'where':{'id':_0xbe0590['params']['id']}})['then'](handleEntityNotFound(_0x567322,null))['then'](saveUpdates(_0xbe0590[_0x7d1a('0x5e')],null))[_0x7d1a('0x18')](respondWithResult(_0x567322,null))[_0x7d1a('0x4f')](handleError(_0x567322,null));};exports['describe']=function(_0x26347f,_0x80908c){return db[_0x7d1a('0x3d')][_0x7d1a('0x5f')]()[_0x7d1a('0x18')](respondWithResult(_0x80908c,null))[_0x7d1a('0x4f')](handleError(_0x80908c,null));};exports[_0x7d1a('0x60')]=function(_0x6280d9,_0x54196a){return db[_0x7d1a('0x3d')][_0x7d1a('0x37')]({'where':{'id':_0x6280d9[_0x7d1a('0x51')]['id']}})[_0x7d1a('0x18')](handleEntityNotFound(_0x54196a,null))['then'](function(_0x3595d0){if(_0x3595d0){return _0x3595d0[_0x7d1a('0x60')](_0x6280d9[_0x7d1a('0x5e')][_0x7d1a('0x61')],_['omit'](_0x6280d9[_0x7d1a('0x5e')],[_0x7d1a('0x61'),'id'])||{});}})[_0x7d1a('0x18')](respondWithResult(_0x54196a,null))['catch'](handleError(_0x54196a,null));};function validateUser(_0x2613a2){return new Promise(function(_0x4f58a8,_0x206dfa){if(_0x2613a2[_0x7d1a('0x62')])return _0x4f58a8(_0x2613a2);return db[_0x7d1a('0x63')]['findById'](0x1)[_0x7d1a('0x18')](function(_0x174738){if(_0x174738[_0x7d1a('0x64')])authService['validatePasswordPattern'](_0x2613a2[_0x7d1a('0x54')]);db['User'][_0x7d1a('0x65')](_0x7d1a('0x62'))[_0x7d1a('0x18')](function(_0x375ff3){if(_[_0x7d1a('0x66')](_0x375ff3)){_0x2613a2[_0x7d1a('0x62')]=_0x174738[_0x7d1a('0x67')]||0x1;return;}if(_['isNil'](_0x174738[_0x7d1a('0x67')])||_0x174738[_0x7d1a('0x67')]===_0x375ff3){_0x2613a2[_0x7d1a('0x62')]=_0x375ff3+0x1;return;}if(_0x174738[_0x7d1a('0x67')]>_0x375ff3){_0x2613a2[_0x7d1a('0x62')]=_0x174738[_0x7d1a('0x67')];return;}return db[_0x7d1a('0x68')][_0x7d1a('0x44')](_0x7d1a('0x69'),{'type':db['sequelize'][_0x7d1a('0x6a')]['SELECT']})[_0x7d1a('0x18')](function(_0x255514){if(_0x255514&&_0x255514[_0x7d1a('0x4a')]){for(var _0x3b6318=0x0,_0x2e6b2f=_0x255514['length'];_0x3b6318<_0x2e6b2f&&_[_0x7d1a('0x66')](_0x2613a2[_0x7d1a('0x62')]);_0x3b6318++){if(_0x174738[_0x7d1a('0x67')]<=_0x255514[_0x3b6318][_0x7d1a('0x6b')]){_0x2613a2[_0x7d1a('0x62')]=_0x255514[_0x3b6318]['from'];}else if(_0x174738[_0x7d1a('0x67')]>_0x255514[_0x3b6318][_0x7d1a('0x6b')]&&_0x174738[_0x7d1a('0x67')]<=_0x255514[_0x3b6318]['to']){_0x2613a2[_0x7d1a('0x62')]=_0x174738['min_internal'];}}}if(_[_0x7d1a('0x66')](_0x2613a2[_0x7d1a('0x62')])){_0x2613a2[_0x7d1a('0x62')]=_0x375ff3+0x1;}return _0x4f58a8(_0x2613a2);});});})[_0x7d1a('0x4f')](function(_0x98f975){_0x206dfa(_0x98f975);});});}function updateUser(_0x45a399){return new Promise(function(_0x45f4da,_0x28e711){try{if(_0x45a399['voicemail']){_0x45a399[_0x7d1a('0x6c')]=_0x45a399[_0x7d1a('0x62')];_0x45a399[_0x7d1a('0x6d')]={'mailbox':_0x45a399['internal'],'password':_0x45a399[_0x7d1a('0x54')],'fullname':_0x45a399[_0x7d1a('0x6e')],'email':_0x45a399[_0x7d1a('0x6f')]};}if(_0x45a399[_0x7d1a('0x29')]===_0x7d1a('0x2a')){if(!_0x45a399[_0x7d1a('0x70')])_0x45a399['permissions']=[_0x7d1a('0x71'),'102',_0x7d1a('0x72'),_0x7d1a('0x73'),_0x7d1a('0x74'),'104',_0x7d1a('0x75'),_0x7d1a('0x76'),'107',_0x7d1a('0x77'),_0x7d1a('0x78'),_0x7d1a('0x79'),'111',_0x7d1a('0x7a'),_0x7d1a('0x7b')];}_0x45f4da(_0x45a399);}catch(_0x24db3f){_0x28e711(_0x24db3f);}});}exports['create']=function(_0x311b4e,_0x513b54){if(_0x311b4e['user'][_0x7d1a('0x29')]==='agent')throw new Error(_0x7d1a('0x7c'));if(_0x311b4e[_0x7d1a('0x5e')][_0x7d1a('0x29')]==='user'&&_0x311b4e[_0x7d1a('0x30')][_0x7d1a('0x29')]!=='admin'){throw new Error(_0x7d1a('0x7d'));}if(_0x311b4e['body'][_0x7d1a('0x29')]===_0x7d1a('0x2f')&&_0x311b4e[_0x7d1a('0x30')]['role']!==_0x7d1a('0x2f')){throw new Error(_0x7d1a('0x7e'));}return licenseUtil[_0x7d1a('0x7f')]([_0x311b4e[_0x7d1a('0x5e')]])[_0x7d1a('0x18')](function(){return validateUser(_0x311b4e['body']);})['then'](function(_0x186ac2){return updateUser(_0x186ac2)[_0x7d1a('0x18')](function(_0x11f7e9){if(_0x11f7e9[_0x7d1a('0x29')]===_0x7d1a('0x2f')){_0x11f7e9[_0x7d1a('0x80')]=_0x311b4e['user'][_0x7d1a('0x80')];delete _0x11f7e9[_0x7d1a('0x81')];}return _0x11f7e9;});})['then'](function(_0x546796){return db[_0x7d1a('0x3d')][_0x7d1a('0x82')](_0x546796,{'include':[{'model':db[_0x7d1a('0x6d')],'as':_0x7d1a('0x6d')}]});})[_0x7d1a('0x18')](function(_0x5970b2){if(_0x311b4e[_0x7d1a('0x5e')][_0x7d1a('0x29')]==='user')return _0x5970b2;if(_0x311b4e['user'][_0x7d1a('0x29')]!==_0x7d1a('0x30'))return _0x5970b2;return db[_0x7d1a('0x83')][_0x7d1a('0x37')]({'where':{'name':_0x5970b2[_0x7d1a('0x29')]===_0x7d1a('0x2a')?_0x7d1a('0x84'):_0x7d1a('0x31'),'userProfileId':_0x311b4e['user'][_0x7d1a('0x81')]},'raw':!![]})[_0x7d1a('0x18')](function(_0x53bbc2){if(!_0x53bbc2||_0x53bbc2[_0x7d1a('0x85')]!=0x0)return _0x5970b2;return db[_0x7d1a('0x39')][_0x7d1a('0x82')]({'name':_0x5970b2[_0x7d1a('0x38')],'resourceId':_0x5970b2['id'],'type':_0x53bbc2['name'],'sectionId':_0x53bbc2['id']},{})[_0x7d1a('0x18')](function(){return _0x5970b2;});})[_0x7d1a('0x4f')](function(_0x501309){logger[_0x7d1a('0x1c')](_0x7d1a('0x86'),_0x501309);throw _0x501309;});})[_0x7d1a('0x18')](respondWithResult(_0x513b54,0xc9))['catch'](handleError(_0x513b54,null));};exports['bulkCreate']=function(_0x177f94,_0x4ee72f){var _0x5c96b9=_0x177f94['body'];var _0x58e5fd=[];if(_0x177f94[_0x7d1a('0x30')][_0x7d1a('0x29')]===_0x7d1a('0x2a'))throw new Error('Unauthorized');if(_[_0x7d1a('0x87')](_0x5c96b9,[_0x7d1a('0x29'),_0x7d1a('0x30')])&&_0x177f94['user'][_0x7d1a('0x29')]!==_0x7d1a('0x2f')){throw new Error(_0x7d1a('0x7d'));}if(_[_0x7d1a('0x87')](_0x5c96b9,[_0x7d1a('0x29'),_0x7d1a('0x2f')])&&_0x177f94[_0x7d1a('0x30')]['role']!==_0x7d1a('0x2f')){throw new Error(_0x7d1a('0x88'));}return licenseUtil['checkUserLimits'](_0x5c96b9)[_0x7d1a('0x18')](function(){return validateUser(_0x5c96b9[0x0]);})['then'](function(){for(var _0x25b1fa=0x1;_0x25b1fa<_0x5c96b9[_0x7d1a('0x4a')];_0x25b1fa++){var _0x478e47=_0x5c96b9[_0x25b1fa-0x1][_0x7d1a('0x62')];if(!_0x5c96b9[_0x25b1fa][_0x7d1a('0x62')])_0x5c96b9[_0x25b1fa]['internal']=_0x478e47+0x1;_0x58e5fd[_0x7d1a('0x47')](validateUser(_0x5c96b9[_0x25b1fa]));}return Promise[_0x7d1a('0x5d')](_0x58e5fd);})[_0x7d1a('0x18')](function(){_0x58e5fd=[];for(var _0x22f98f=0x0;_0x22f98f<_0x5c96b9[_0x7d1a('0x4a')];_0x22f98f++){_0x58e5fd[_0x7d1a('0x47')](updateUser(_0x5c96b9[_0x22f98f]));}return Promise[_0x7d1a('0x5d')](_0x58e5fd);})[_0x7d1a('0x18')](function(){_0x58e5fd=_0x5c96b9[_0x7d1a('0x89')](function(_0x22677e){return db['User']['create'](_0x22677e,{'include':[{'model':db['VoiceMail'],'as':_0x7d1a('0x6d')}]})[_0x7d1a('0x18')](function(_0x497bcd){_0x22677e['id']=_0x497bcd['id'];return _0x22677e;});});return Promise[_0x7d1a('0x5d')](_0x58e5fd);})[_0x7d1a('0x18')](function(_0x48e03d){if(_0x177f94[_0x7d1a('0x5e')][_0x7d1a('0x29')]===_0x7d1a('0x30'))return _0x48e03d;if(_0x177f94['user']['role']!==_0x7d1a('0x30'))return _0x48e03d;var _0x83555f=_[_0x7d1a('0x87')](_0x48e03d,function(_0x55570b){return _0x55570b['role']===_0x7d1a('0x2a')||_0x55570b[_0x7d1a('0x29')]===_0x7d1a('0x32');});if(!_0x83555f)return _0x48e03d;return db[_0x7d1a('0x83')]['findAll']({'where':{'name':{'$or':[_0x7d1a('0x84'),_0x7d1a('0x31')]},'userProfileId':_0x177f94[_0x7d1a('0x30')][_0x7d1a('0x81')]},'raw':!![]})[_0x7d1a('0x18')](function(_0x485bc4){if(_['isEmpty'](_0x485bc4)||!_['some'](_0x485bc4,['autoAssociation',0x0]))return _0x48e03d;_0x58e5fd=[];var _0x4c60b5=_(_0x485bc4)['map'](function(_0x3b3bc3){if(_0x3b3bc3[_0x7d1a('0x85')]===0x1)return;return _0x3b3bc3[_0x7d1a('0x38')]===_0x7d1a('0x84')?_0x7d1a('0x2a'):_0x7d1a('0x32');})[_0x7d1a('0x8a')]()[_0x7d1a('0x35')]();for(var _0x143138=0x0;_0x143138<_0x48e03d['length'];_0x143138++){if(!_[_0x7d1a('0x36')](_0x4c60b5,_0x48e03d[_0x143138][_0x7d1a('0x29')]))return;var _0x113615=_0x48e03d[_0x143138][_0x7d1a('0x29')]==='agent'?_0x7d1a('0x84'):_0x7d1a('0x31');_0x58e5fd[_0x7d1a('0x47')](db[_0x7d1a('0x39')][_0x7d1a('0x82')]({'name':_0x48e03d[_0x143138][_0x7d1a('0x38')],'resourceId':_0x48e03d[_0x143138]['id'],'type':_0x113615,'sectionId':_[_0x7d1a('0x37')](_0x485bc4,['name',_0x113615])['id']},{}));}return Promise['all'](_0x58e5fd);});})[_0x7d1a('0x18')](respondWithResult(_0x4ee72f,0xc9))[_0x7d1a('0x4f')](handleError(_0x4ee72f,null));};exports[_0x7d1a('0x8b')]=function(_0x12d338,_0x4d6f85){if(_0x12d338[_0x7d1a('0x5e')]['id']){delete _0x12d338[_0x7d1a('0x5e')]['id'];}return db[_0x7d1a('0x3d')]['find']({'where':{'id':_0x12d338[_0x7d1a('0x51')]['id']}})[_0x7d1a('0x18')](function(_0x1eae54){if(!_0x1eae54)return null;if(_0x1eae54['id']===_0x12d338[_0x7d1a('0x30')]['id']){if(!_0x12d338[_0x7d1a('0x5e')][_0x7d1a('0x8c')]||!_0x12d338[_0x7d1a('0x5e')][_0x7d1a('0x8d')]){throw new db[(_0x7d1a('0x8e'))][(_0x7d1a('0x8f'))](_0x7d1a('0x90'));}if(!_0x1eae54[_0x7d1a('0x91')](_0x12d338[_0x7d1a('0x5e')]['oldPassword'])){throw new db['Sequelize'][(_0x7d1a('0x8f'))]('Wrong\x20credentials');}if(_0x12d338[_0x7d1a('0x5e')]['oldPassword']===_0x12d338[_0x7d1a('0x5e')][_0x7d1a('0x8d')]){throw new db[(_0x7d1a('0x8e'))][(_0x7d1a('0x8f'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x12d338[_0x7d1a('0x30')][_0x7d1a('0x29')]==='admin'){if(!_0x12d338[_0x7d1a('0x5e')][_0x7d1a('0x8d')]){throw new db[(_0x7d1a('0x8e'))]['ValidationError'](_0x7d1a('0x92'));}}else if(_0x12d338[_0x7d1a('0x30')][_0x7d1a('0x29')]===_0x7d1a('0x30')){if(!_0x12d338['body']['newPassword']){throw new db[(_0x7d1a('0x8e'))]['ValidationError'](_0x7d1a('0x92'));}if(_0x1eae54[_0x7d1a('0x29')]!==_0x7d1a('0x2a')){throw new db[(_0x7d1a('0x8e'))]['ValidationError']('Unauthorized');}}else{throw new db[(_0x7d1a('0x8e'))][(_0x7d1a('0x8f'))](_0x7d1a('0x7c'));}return _0x1eae54;})['then'](handleEntityNotFound(_0x4d6f85,null))[_0x7d1a('0x18')](function(_0x10de04){return db[_0x7d1a('0x63')][_0x7d1a('0x93')]({'attributes':['id',_0x7d1a('0x64'),_0x7d1a('0x94'),_0x7d1a('0x95')]})[_0x7d1a('0x18')](function(_0x32cdae){if(_0x32cdae[_0x7d1a('0x64')])authService[_0x7d1a('0x96')](_0x12d338[_0x7d1a('0x5e')]['newPassword']);if(!_0x32cdae[_0x7d1a('0x94')]||!_0x10de04[_0x7d1a('0x97')])return _0x10de04;authService[_0x7d1a('0x98')](_0x12d338[_0x7d1a('0x5e')][_0x7d1a('0x8d')],_0x10de04[_0x7d1a('0x97')],_0x32cdae[_0x7d1a('0x95')]);return _0x10de04;})['then'](saveUpdates({'password':_0x12d338['body']['newPassword'],'passwordResetAt':_0x12d338[_0x7d1a('0x30')]['id']==_0x12d338['params']['id']?moment():null,'previousPasswords':authService[_0x7d1a('0x99')](_0x12d338['body'][_0x7d1a('0x8d')],_0x10de04[_0x7d1a('0x97')])},null));})[_0x7d1a('0x18')](respondWithResult(_0x4d6f85,null))[_0x7d1a('0x4f')](handleError(_0x4d6f85,null));};exports['addQueues']=function(_0xc78207,_0x1953b5){var _0x23f8be=_0xc78207[_0x7d1a('0x5e')]['channel'];return db['User'][_0x7d1a('0x37')]({'where':{'id':_0xc78207[_0x7d1a('0x51')]['id']},'attributes':['id',_0x7d1a('0x38'),_0x7d1a('0x29'),_0x7d1a('0x9a'),'loginInPause',_0x7d1a('0x9b'),_0x7d1a('0x9c')]})['then'](handleEntityNotFound(_0x1953b5,null))[_0x7d1a('0x18')](function(_0x8665ac){if(_0x8665ac){if(!utils['isValidChannel'](_0x23f8be)){throw new db['Sequelize'][(_0x7d1a('0x8f'))](_0x7d1a('0x9d'));}return _0x8665ac[_0x7d1a('0x9e')+_[_0x7d1a('0x9f')](_0x23f8be[_0x7d1a('0xa0')]())+_0x7d1a('0xa1')](_0xc78207[_0x7d1a('0x5e')][_0x7d1a('0x61')],{'penalty':_0xc78207[_0x7d1a('0x5e')][_0x7d1a('0xa2')]||0x0})[_0x7d1a('0xa3')](function(_0x1d9e10){for(var _0x572e06=0x0;_0x572e06<_0xc78207[_0x7d1a('0x5e')]['ids'][_0x7d1a('0x4a')];_0x572e06+=0x1){var _0x4e1106={'UserId':Number(_0xc78207['params']['id'])};_0x4e1106[_[_0x7d1a('0x9f')](_0x23f8be[_0x7d1a('0xa0')]())+_0x7d1a('0xa4')]=Number(_0xc78207['body']['ids'][_0x572e06]);socket[_0x7d1a('0x2b')]('user'+_[_0x7d1a('0x9f')](_0x23f8be[_0x7d1a('0xa0')]())+_0x7d1a('0xa5'),_0x4e1106);}return _0x1d9e10;})[_0x7d1a('0x18')](function(){if(_0x23f8be===_0x7d1a('0xa6')){return db[_0x7d1a('0xa7')][_0x7d1a('0x48')]({'where':{'id':_0xc78207[_0x7d1a('0x5e')]['ids']||[]},'raw':!![],'attributes':['id',_0x7d1a('0x38')]});}})['then'](function(_0x1b5e8c){var _0x2a1bdc=_0x8665ac[_0x7d1a('0x2e')]({'plain':!![]});var _0x3e08ef=[];if(_0x23f8be==='voice'&&_0x2a1bdc[_0x7d1a('0x29')]===_0x7d1a('0x2a')&&_0x2a1bdc[_0x7d1a('0x9a')]){for(let _0x32e739=0x0;_0x32e739<_0x1b5e8c[_0x7d1a('0x4a')];_0x32e739+=0x1){_0x3e08ef['push']({'membername':_0x2a1bdc[_0x7d1a('0x38')],'UserId':_0x2a1bdc['id'],'queue_name':_0x1b5e8c[_0x32e739]['name'],'VoiceQueueId':_0x1b5e8c[_0x32e739]['id'],'interface':_[_0x7d1a('0x66')](_0x2a1bdc[_0x7d1a('0x9c')])?util[_0x7d1a('0xa8')](_0x7d1a('0xa9'),_0x2a1bdc[_0x7d1a('0x38')]):_0x2a1bdc[_0x7d1a('0x9c')],'paused':_0x2a1bdc[_0x7d1a('0x9b')]||![],'penalty':_0xc78207[_0x7d1a('0x5e')][_0x7d1a('0xa2')]||0x0});}return Promise[_0x7d1a('0x5d')](_0x3e08ef[_0x7d1a('0x89')](function(_0x557d6d){return db[_0x7d1a('0xaa')][_0x7d1a('0xab')](_0x557d6d);}));}return _0x8665ac;});}})[_0x7d1a('0x18')](respondWithStatusCode(_0x1953b5,null))[_0x7d1a('0x4f')](handleError(_0x1953b5,null));};exports['removeQueues']=function(_0xef27d,_0x2e1300){var _0x1c136e,_0x463994;return db[_0x7d1a('0x3d')][_0x7d1a('0x37')]({'where':{'id':_0xef27d[_0x7d1a('0x51')]['id']},'attributes':['id','name',_0x7d1a('0x29')]})[_0x7d1a('0x18')](handleEntityNotFound(_0x2e1300,null))[_0x7d1a('0x18')](function(_0x4fc83a){if(_0x4fc83a){_0x1c136e=_0x4fc83a;if(!_0xef27d['query'][_0x7d1a('0xac')]||!utils[_0x7d1a('0xad')](_0xef27d[_0x7d1a('0x44')][_0x7d1a('0xac')])){throw new db[(_0x7d1a('0x8e'))][(_0x7d1a('0x8f'))](_0x7d1a('0x9d'));}return _0x4fc83a[_0x7d1a('0xae')+_[_0x7d1a('0x9f')](_0xef27d[_0x7d1a('0x44')][_0x7d1a('0xac')][_0x7d1a('0xa0')]())+_0x7d1a('0xa1')](_0xef27d[_0x7d1a('0x44')][_0x7d1a('0x61')]);}})[_0x7d1a('0x18')](function(_0x4c518f){if(_['isArray'](_0xef27d[_0x7d1a('0x44')][_0x7d1a('0x61')])){for(var _0x36d15b=0x0;_0x36d15b<_0xef27d['query']['ids'][_0x7d1a('0x4a')];_0x36d15b+=0x1){_0x463994={'UserId':Number(_0xef27d[_0x7d1a('0x51')]['id'])};_0x463994[_['capitalize'](_0xef27d[_0x7d1a('0x44')][_0x7d1a('0xac')][_0x7d1a('0xa0')]())+_0x7d1a('0xa4')]=Number(_0xef27d[_0x7d1a('0x44')][_0x7d1a('0x61')][_0x36d15b]);socket[_0x7d1a('0x2b')](_0x7d1a('0x30')+_['capitalize'](_0xef27d[_0x7d1a('0x44')][_0x7d1a('0xac')][_0x7d1a('0xa0')]())+'Queue:remove',_0x463994);}}else{_0x463994={'UserId':Number(_0xef27d['params']['id'])};_0x463994[_['capitalize'](_0xef27d[_0x7d1a('0x44')][_0x7d1a('0xac')][_0x7d1a('0xa0')]())+'QueueId']=Number(_0xef27d[_0x7d1a('0x44')][_0x7d1a('0x61')]);socket['emit'](_0x7d1a('0x30')+_[_0x7d1a('0x9f')](_0xef27d[_0x7d1a('0x44')][_0x7d1a('0xac')][_0x7d1a('0xa0')]())+_0x7d1a('0xaf'),_0x463994);}return _0x4c518f;})['then'](function(){if(_0xef27d[_0x7d1a('0x44')]['channel']===_0x7d1a('0xa6')){return db[_0x7d1a('0xaa')][_0x7d1a('0x2d')]({'where':{'UserId':_0xef27d[_0x7d1a('0x51')]['id'],'VoiceQueueId':_0xef27d['query'][_0x7d1a('0x61')]},'individualHooks':!![]})['then'](function(){return _0x1c136e;});}return _0x1c136e;})[_0x7d1a('0x18')](respondWithStatusCode(_0x2e1300,null))[_0x7d1a('0x4f')](handleError(_0x2e1300,null));};exports[_0x7d1a('0xb0')]=function(_0x4ba2de,_0x3ad1d8){_0x4ba2de[_0x7d1a('0x5e')]['userpic']=_0x4ba2de[_0x7d1a('0xb1')][_0x7d1a('0xb2')];return db[_0x7d1a('0x3d')][_0x7d1a('0x37')]({'where':{'id':_0x4ba2de[_0x7d1a('0x51')]['id']}})[_0x7d1a('0x18')](handleEntityNotFound(_0x3ad1d8,null))[_0x7d1a('0x18')](saveUpdates(_0x4ba2de['body'],null))[_0x7d1a('0x18')](respondWithResult(_0x3ad1d8,null))[_0x7d1a('0x4f')](handleError(_0x3ad1d8,null));};exports[_0x7d1a('0xb3')]=function(_0x31b862,_0x47818a){var _0x2ae201=path[_0x7d1a('0xb4')](config[_0x7d1a('0xb5')],_0x7d1a('0xb6'));return db['User'][_0x7d1a('0x37')]({'where':{'id':_0x31b862[_0x7d1a('0x51')]['id']},'attributes':['id',_0x7d1a('0xb7')],'raw':!![]})[_0x7d1a('0x18')](handleEntityNotFound(_0x47818a,null))['then'](function(_0x359fd1){if(_0x359fd1){if(_[_0x7d1a('0x66')](_0x359fd1[_0x7d1a('0xb7')])){return _0x47818a[_0x7d1a('0xb8')](_0x2ae201);}else{if(!fs[_0x7d1a('0xb9')](path[_0x7d1a('0xb4')](config['root'],_0x7d1a('0xba'),_0x359fd1['userpic']))){return _0x47818a[_0x7d1a('0xb8')](_0x2ae201);}return _0x47818a['download'](path[_0x7d1a('0xb4')](config[_0x7d1a('0xb5')],'server/files/images/',_0x359fd1[_0x7d1a('0xb7')]));}}})[_0x7d1a('0x4f')](handleError(_0x47818a,null));};exports[_0x7d1a('0xbb')]=function(_0x5dd68b,_0x349ef8){return db[_0x7d1a('0x3d')][_0x7d1a('0x37')]({'where':{'id':_0x5dd68b[_0x7d1a('0x51')]['id']},'attributes':['id']})[_0x7d1a('0x18')](handleEntityNotFound(_0x349ef8,null))[_0x7d1a('0x18')](function(_0x52b8cd){var _0x259a60=[];values=_0x52b8cd[_0x7d1a('0x4c')];_0x259a60[_0x7d1a('0x47')](get_open_tabs(_0x7d1a('0x4b'),_0x52b8cd[_0x7d1a('0x4c')]));_0x259a60[_0x7d1a('0x47')](get_open_tabs(_0x7d1a('0xbc'),_0x52b8cd[_0x7d1a('0x4c')]));_0x259a60[_0x7d1a('0x47')](get_open_tabs(_0x7d1a('0x4e'),_0x52b8cd['dataValues']));_0x259a60[_0x7d1a('0x47')](get_open_tabs('whatsapp',_0x52b8cd[_0x7d1a('0x4c')]));_0x259a60[_0x7d1a('0x47')](get_open_tabs(_0x7d1a('0xbd'),_0x52b8cd[_0x7d1a('0x4c')]));_0x259a60[_0x7d1a('0x47')](get_open_tabs(_0x7d1a('0x4d'),_0x52b8cd['dataValues']));return Promise[_0x7d1a('0x5d')](_0x259a60);})[_0x7d1a('0x18')](function(_0x3a7233){if(_0x3a7233){var _0x310aa2=_[_0x7d1a('0x89')](values[_0x7d1a('0xbe')],function(_0x1c6d2f){return{'channel':_0x7d1a('0xbf'),'id':_0x1c6d2f['id'],'createdAt':_0x1c6d2f[_0x7d1a('0xc0')]};});var _0x518a3e=_['map'](values[_0x7d1a('0xc1')],function(_0x154a9c){return{'channel':_0x7d1a('0xc2'),'id':_0x154a9c['id'],'createdAt':_0x154a9c[_0x7d1a('0xc0')]};});var _0x5cdbf2=_[_0x7d1a('0x89')](values[_0x7d1a('0xc3')],function(_0x464877){return{'channel':_0x7d1a('0xc4'),'id':_0x464877['id'],'createdAt':_0x464877[_0x7d1a('0xc0')]};});var _0x58d495=_[_0x7d1a('0x89')](values[_0x7d1a('0xc5')],function(_0x46f926){return{'channel':_0x7d1a('0xc6'),'id':_0x46f926['id'],'createdAt':_0x46f926[_0x7d1a('0xc0')]};});var _0x12e91b=_[_0x7d1a('0x89')](values[_0x7d1a('0xc7')],function(_0x3a73c0){return{'channel':'SMS','id':_0x3a73c0['id'],'createdAt':_0x3a73c0[_0x7d1a('0xc0')]};});var _0x98dc7e=_[_0x7d1a('0x89')](values[_0x7d1a('0xc8')],function(_0x9ff132){return{'channel':_0x7d1a('0xc9'),'id':_0x9ff132['id'],'createdAt':_0x9ff132[_0x7d1a('0xc0')]};});var _0x3afd8c=_[_0x7d1a('0xca')](_0x310aa2,_0x518a3e,_0x5cdbf2,_0x58d495,_0x12e91b,_0x98dc7e);var _0x2cd103={'count':_0x3afd8c['length'],'rows':_0x3afd8c};return _0x2cd103;}else return null;})['then'](respondWithResult(_0x349ef8,null))[_0x7d1a('0x4f')](handleError(_0x349ef8,null));};exports[_0x7d1a('0xcb')]=function(_0x5928c9,_0x203ddc){var _0x55d15d={};var _0x5b7a59={};var _0x2d6908;var _0x1db407;return db[_0x7d1a('0x3d')][_0x7d1a('0x93')]({'where':{'id':_0x5928c9[_0x7d1a('0x51')]['id']}})[_0x7d1a('0x18')](handleEntityNotFound(_0x203ddc,null))[_0x7d1a('0x18')](function(_0xc96404){if(_0xc96404){_0x2d6908=_0xc96404;_0x5b7a59[_0x7d1a('0x52')]=_[_0x7d1a('0x53')](db[_0x7d1a('0xcc')][_0x7d1a('0x3e')]);_0x5b7a59['query']=_[_0x7d1a('0x53')](_0x5928c9[_0x7d1a('0x44')]);_0x5b7a59['filters']=_[_0x7d1a('0x56')](_0x5b7a59[_0x7d1a('0x52')],_0x5b7a59[_0x7d1a('0x44')]);_0x55d15d[_0x7d1a('0x46')]=_['intersection'](_0x5b7a59['model'],qs[_0x7d1a('0x57')](_0x5928c9[_0x7d1a('0x44')][_0x7d1a('0x57')]));_0x55d15d[_0x7d1a('0x46')]=_0x55d15d['attributes'][_0x7d1a('0x4a')]?_0x55d15d[_0x7d1a('0x46')]:_0x5b7a59[_0x7d1a('0x52')];_0x55d15d[_0x7d1a('0xcd')]=qs['sort'](_0x5928c9['query']['sort']);_0x55d15d[_0x7d1a('0xce')]=qs[_0x7d1a('0x55')](_['pick'](_0x5928c9[_0x7d1a('0x44')],_0x5b7a59[_0x7d1a('0x55')]));if(_0x5928c9[_0x7d1a('0x44')][_0x7d1a('0x33')]){_0x55d15d['where']=_[_0x7d1a('0x59')](_0x55d15d[_0x7d1a('0xce')],{'$or':_['map'](_0x55d15d[_0x7d1a('0x46')],function(_0x3c64c0){var _0x7974a2={};_0x7974a2[_0x3c64c0]={'$like':'%'+_0x5928c9[_0x7d1a('0x44')][_0x7d1a('0x33')]+'%'};return _0x7974a2;})});}_0x55d15d=_[_0x7d1a('0x59')]({},_0x55d15d,_0x5928c9[_0x7d1a('0x5a')]);return _0x2d6908[_0x7d1a('0xcb')](_0x55d15d);}})[_0x7d1a('0x18')](function(_0x18ee76){if(_0x18ee76){_0x1db407=_0x18ee76[_0x7d1a('0x4a')];if(_0x5928c9[_0x7d1a('0x44')][_0x7d1a('0xcf')](_0x7d1a('0x42'))){_0x55d15d[_0x7d1a('0x43')]=[{'model':db[_0x7d1a('0xd0')],'as':_0x7d1a('0xd1'),'required':![]},{'model':db[_0x7d1a('0xd2')],'as':'Tags','attributes':['id',_0x7d1a('0x38'),'color'],'where':_0x5928c9['query'][_0x7d1a('0xd3')]?{'id':_0x5928c9[_0x7d1a('0x44')][_0x7d1a('0xd3')]}:undefined,'required':_0x5928c9[_0x7d1a('0x44')][_0x7d1a('0xd3')]?!![]:![]}];}if(!_0x5928c9[_0x7d1a('0x44')]['hasOwnProperty']('nolimit')){_0x55d15d[_0x7d1a('0x26')]=qs[_0x7d1a('0x26')](_0x5928c9[_0x7d1a('0x44')][_0x7d1a('0x26')]);_0x55d15d[_0x7d1a('0x25')]=qs['offset'](_0x5928c9['query']['offset']);}return _0x2d6908[_0x7d1a('0xcb')](_0x55d15d);}})[_0x7d1a('0x18')](function(_0x10ff30){if(_0x10ff30){return _0x10ff30?{'count':_0x1db407,'rows':_0x10ff30}:null;}})['then'](respondWithResult(_0x203ddc,null))['catch'](handleError(_0x203ddc,null));};exports[_0x7d1a('0xd4')]=function(_0x8c0f3b,_0x480657){var _0x264b7a;var _0x5a9ad1={};var _0x3c7f0d;return db[_0x7d1a('0x3d')][_0x7d1a('0x93')]({'where':{'id':_0x8c0f3b[_0x7d1a('0x51')]['id']},'attributes':['id',_0x7d1a('0x38'),_0x7d1a('0x29')]})[_0x7d1a('0x18')](handleEntityNotFound(_0x480657,null))[_0x7d1a('0x18')](function(_0x3a9551){if(!utils[_0x7d1a('0xad')](_0x8c0f3b[_0x7d1a('0x44')][_0x7d1a('0xac')])){throw new db['Sequelize'][(_0x7d1a('0x8f'))]('Unknown\x20channel');}_0x264b7a=_0x3a9551;var _0x3ff86a={};_0x3ff86a[_0x7d1a('0x52')]=_[_0x7d1a('0x53')](db[_['capitalize'](_0x8c0f3b[_0x7d1a('0x44')][_0x7d1a('0xac')])+_0x7d1a('0xd5')][_0x7d1a('0x3e')]);_0x3ff86a[_0x7d1a('0x44')]=_[_0x7d1a('0x53')](_0x8c0f3b[_0x7d1a('0x44')]);_0x3ff86a[_0x7d1a('0x55')]=_[_0x7d1a('0x56')](_0x3ff86a[_0x7d1a('0x52')],_0x3ff86a['query']);_0x5a9ad1[_0x7d1a('0x46')]=_[_0x7d1a('0x56')](_0x3ff86a[_0x7d1a('0x52')],qs['fields'](_0x8c0f3b[_0x7d1a('0x44')]['fields']));_0x5a9ad1[_0x7d1a('0x46')]=_0x5a9ad1[_0x7d1a('0x46')][_0x7d1a('0x4a')]?_0x5a9ad1[_0x7d1a('0x46')]:_0x3ff86a[_0x7d1a('0x52')];_0x5a9ad1['order']=qs[_0x7d1a('0xd6')](_0x8c0f3b[_0x7d1a('0x44')][_0x7d1a('0xd6')]);_0x5a9ad1['where']=qs[_0x7d1a('0x55')](_[_0x7d1a('0xd7')](_0x8c0f3b[_0x7d1a('0x44')],_0x3ff86a[_0x7d1a('0x55')]));if(_0x8c0f3b[_0x7d1a('0x44')][_0x7d1a('0x33')]){_0x5a9ad1[_0x7d1a('0xce')]=_[_0x7d1a('0x59')](_0x5a9ad1[_0x7d1a('0xce')],{'$or':_['map'](_0x5a9ad1[_0x7d1a('0x46')],function(_0x26d0e4){var _0x2a0ead={};_0x2a0ead[_0x26d0e4]={'$like':'%'+_0x8c0f3b['query']['filter']+'%'};return _0x2a0ead;})});}_0x5a9ad1=_[_0x7d1a('0x59')]({},_0x5a9ad1,_0x8c0f3b['options']);switch(_0x264b7a['role']){case'admin':return db[_['capitalize'](_0x8c0f3b[_0x7d1a('0x44')]['channel'])+_0x7d1a('0xd5')][_0x7d1a('0x48')](_0x5a9ad1);case'user':case'agent':return _0x264b7a[_0x7d1a('0x2e')+_[_0x7d1a('0x9f')](_0x8c0f3b['query'][_0x7d1a('0xac')])+'Queues'](_0x5a9ad1);default:throw new db['Sequelize'][(_0x7d1a('0x8f'))](_0x7d1a('0xd8'));}})[_0x7d1a('0x18')](function(_0x104d16){_0x3c7f0d=_0x104d16[_0x7d1a('0x4a')];if(!_0x8c0f3b[_0x7d1a('0x44')][_0x7d1a('0xcf')]('nolimit')){_0x5a9ad1[_0x7d1a('0x26')]=qs[_0x7d1a('0x26')](_0x8c0f3b[_0x7d1a('0x44')][_0x7d1a('0x26')]);_0x5a9ad1[_0x7d1a('0x25')]=qs['offset'](_0x8c0f3b[_0x7d1a('0x44')]['offset']);}switch(_0x264b7a[_0x7d1a('0x29')]){case _0x7d1a('0x2f'):return db[_['capitalize'](_0x8c0f3b[_0x7d1a('0x44')][_0x7d1a('0xac')])+_0x7d1a('0xd5')][_0x7d1a('0x48')](_0x5a9ad1);case'user':case _0x7d1a('0x2a'):return _0x264b7a[_0x7d1a('0x2e')+_[_0x7d1a('0x9f')](_0x8c0f3b[_0x7d1a('0x44')][_0x7d1a('0xac')])+_0x7d1a('0xa1')](_0x5a9ad1);}})['then'](function(_0xb9894){return{'count':_0x3c7f0d,'rows':_0xb9894};})['then'](respondWithResult(_0x480657,null))['catch'](handleError(_0x480657,null));};exports[_0x7d1a('0xd9')]=function(_0x1b2474,_0x14180d){var _0x5d0da9={};var _0x368965={};var _0x8819cc;var _0x5994af;return db[_0x7d1a('0x3d')][_0x7d1a('0x93')]({'where':{'id':_0x1b2474[_0x7d1a('0x51')]['id']}})[_0x7d1a('0x18')](handleEntityNotFound(_0x14180d,null))['then'](function(_0x3717cc){if(_0x3717cc){_0x8819cc=_0x3717cc;_0x368965[_0x7d1a('0x52')]=_[_0x7d1a('0x53')](db['UserVoiceQueueRt'][_0x7d1a('0x3e')]);_0x368965[_0x7d1a('0x44')]=_[_0x7d1a('0x53')](_0x1b2474[_0x7d1a('0x44')]);_0x368965['filters']=_[_0x7d1a('0x56')](_0x368965[_0x7d1a('0x52')],_0x368965[_0x7d1a('0x44')]);_0x5d0da9[_0x7d1a('0x46')]=_['intersection'](_0x368965['model'],qs['fields'](_0x1b2474[_0x7d1a('0x44')][_0x7d1a('0x57')]));_0x5d0da9['attributes']=_0x5d0da9[_0x7d1a('0x46')][_0x7d1a('0x4a')]?_0x5d0da9['attributes']:_0x368965[_0x7d1a('0x52')];_0x5d0da9[_0x7d1a('0xcd')]=qs[_0x7d1a('0xd6')](_0x1b2474[_0x7d1a('0x44')][_0x7d1a('0xd6')]);_0x5d0da9[_0x7d1a('0xce')]=qs['filters'](_[_0x7d1a('0xd7')](_0x1b2474[_0x7d1a('0x44')],_0x368965[_0x7d1a('0x55')]));if(_0x1b2474[_0x7d1a('0x44')]['filter']){_0x5d0da9[_0x7d1a('0xce')]=_[_0x7d1a('0x59')](_0x5d0da9[_0x7d1a('0xce')],{'$or':_[_0x7d1a('0x89')](_0x5d0da9['attributes'],function(_0xdd5289){var _0x179fb6={};_0x179fb6[_0xdd5289]={'$like':'%'+_0x1b2474[_0x7d1a('0x44')][_0x7d1a('0x33')]+'%'};return _0x179fb6;})});}_0x5d0da9=_['merge']({},_0x5d0da9,_0x1b2474['options']);return _0x8819cc['getVoiceQueuesRt'](_0x5d0da9);}})[_0x7d1a('0x18')](function(_0x254a77){if(_0x254a77){_0x5994af=_0x254a77['length'];if(!_0x1b2474[_0x7d1a('0x44')][_0x7d1a('0xcf')](_0x7d1a('0xda'))){_0x5d0da9[_0x7d1a('0x26')]=qs[_0x7d1a('0x26')](_0x1b2474[_0x7d1a('0x44')]['limit']);_0x5d0da9['offset']=qs[_0x7d1a('0x25')](_0x1b2474[_0x7d1a('0x44')]['offset']);}return _0x8819cc[_0x7d1a('0xd9')](_0x5d0da9);}})[_0x7d1a('0x18')](function(_0x2d6e87){if(_0x2d6e87){return _0x2d6e87?{'count':_0x5994af,'rows':_0x2d6e87}:null;}})[_0x7d1a('0x18')](respondWithResult(_0x14180d,null))[_0x7d1a('0x4f')](handleError(_0x14180d,null));};exports[_0x7d1a('0xdb')]=function(_0x1affc6,_0x37ce00){var _0x476932={};var _0x194706={};var _0x22c47f;var _0xb6a0a;return db[_0x7d1a('0x3d')]['findOne']({'where':{'id':_0x1affc6[_0x7d1a('0x51')]['id']}})[_0x7d1a('0x18')](handleEntityNotFound(_0x37ce00,null))[_0x7d1a('0x18')](function(_0x51d7e2){if(_0x51d7e2){_0x22c47f=_0x51d7e2;_0x194706[_0x7d1a('0x52')]=_[_0x7d1a('0x53')](db[_0x7d1a('0xdc')][_0x7d1a('0x3e')]);_0x194706[_0x7d1a('0x44')]=_[_0x7d1a('0x53')](_0x1affc6[_0x7d1a('0x44')]);_0x194706[_0x7d1a('0x55')]=_['intersection'](_0x194706[_0x7d1a('0x52')],_0x194706[_0x7d1a('0x44')]);_0x476932['attributes']=_['intersection'](_0x194706[_0x7d1a('0x52')],qs[_0x7d1a('0x57')](_0x1affc6[_0x7d1a('0x44')][_0x7d1a('0x57')]));_0x476932[_0x7d1a('0x46')]=_0x476932[_0x7d1a('0x46')][_0x7d1a('0x4a')]?_0x476932[_0x7d1a('0x46')]:_0x194706['model'];_0x476932[_0x7d1a('0xcd')]=qs[_0x7d1a('0xd6')](_0x1affc6[_0x7d1a('0x44')][_0x7d1a('0xd6')]);_0x476932[_0x7d1a('0xce')]=qs[_0x7d1a('0x55')](_[_0x7d1a('0xd7')](_0x1affc6['query'],_0x194706[_0x7d1a('0x55')]));if(_0x1affc6[_0x7d1a('0x44')][_0x7d1a('0x33')]){_0x476932[_0x7d1a('0xce')]=_[_0x7d1a('0x59')](_0x476932['where'],{'$or':_[_0x7d1a('0x89')](_0x476932[_0x7d1a('0x46')],function(_0x325c28){var _0x42508e={};_0x42508e[_0x325c28]={'$like':'%'+_0x1affc6['query'][_0x7d1a('0x33')]+'%'};return _0x42508e;})});}_0x476932=_[_0x7d1a('0x59')]({},_0x476932,_0x1affc6['options']);return _0x22c47f[_0x7d1a('0xdb')](_0x476932);}})[_0x7d1a('0x18')](function(_0x2acf83){if(_0x2acf83){_0xb6a0a=_0x2acf83[_0x7d1a('0x4a')];if(!_0x1affc6[_0x7d1a('0x44')][_0x7d1a('0xcf')](_0x7d1a('0xda'))){_0x476932[_0x7d1a('0x26')]=qs[_0x7d1a('0x26')](_0x1affc6[_0x7d1a('0x44')][_0x7d1a('0x26')]);_0x476932[_0x7d1a('0x25')]=qs['offset'](_0x1affc6[_0x7d1a('0x44')][_0x7d1a('0x25')]);}return _0x22c47f[_0x7d1a('0xdb')](_0x476932);}})[_0x7d1a('0x18')](function(_0x1d160f){if(_0x1d160f){return _0x1d160f?{'count':_0xb6a0a,'rows':_0x1d160f}:null;}})['then'](respondWithResult(_0x37ce00,null))['catch'](handleError(_0x37ce00,null));};exports[_0x7d1a('0xdd')]=function(_0x2951dd,_0x27d0e9){var _0x5de256={'raw':!![],'where':{}};var _0x20fa8b={};var _0x31535a={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x2951dd['params']['id']}})[_0x7d1a('0x18')](handleEntityNotFound(_0x27d0e9,null))[_0x7d1a('0x18')](function(_0x35875c){if(_0x35875c){_0x20fa8b[_0x7d1a('0x52')]=_[_0x7d1a('0x53')](db[_0x7d1a('0xde')][_0x7d1a('0x3e')]);_0x20fa8b[_0x7d1a('0x44')]=_[_0x7d1a('0x53')](_0x2951dd[_0x7d1a('0x44')]);_0x20fa8b[_0x7d1a('0x55')]=_[_0x7d1a('0x56')](_0x20fa8b[_0x7d1a('0x52')],_0x20fa8b[_0x7d1a('0x44')]);_0x5de256[_0x7d1a('0x46')]=_['intersection'](_0x20fa8b['model'],qs[_0x7d1a('0x57')](_0x2951dd[_0x7d1a('0x44')][_0x7d1a('0x57')]));_0x5de256[_0x7d1a('0x46')]=_0x5de256[_0x7d1a('0x46')][_0x7d1a('0x4a')]?_0x5de256[_0x7d1a('0x46')]:_0x20fa8b[_0x7d1a('0x52')];if(!_0x2951dd['query'][_0x7d1a('0xcf')](_0x7d1a('0xda'))){_0x5de256['limit']=qs['limit'](_0x2951dd[_0x7d1a('0x44')][_0x7d1a('0x26')]);_0x5de256[_0x7d1a('0x25')]=qs[_0x7d1a('0x25')](_0x2951dd[_0x7d1a('0x44')][_0x7d1a('0x25')]);}_0x5de256[_0x7d1a('0xcd')]=qs[_0x7d1a('0xd6')](_0x2951dd[_0x7d1a('0x44')][_0x7d1a('0xd6')]);_0x5de256[_0x7d1a('0xce')]=qs[_0x7d1a('0x55')](_[_0x7d1a('0xd7')](_0x2951dd[_0x7d1a('0x44')],_0x20fa8b[_0x7d1a('0x55')]));_0x5de256['where'][_0x7d1a('0xdf')]=_0x35875c['id'];if(_0x2951dd[_0x7d1a('0x44')][_0x7d1a('0x33')]){_0x5de256[_0x7d1a('0xce')]=_['merge'](_0x5de256[_0x7d1a('0xce')],{'$or':_[_0x7d1a('0x89')](_0x5de256[_0x7d1a('0x46')],function(_0x30c7b8){var _0x4be791={};_0x4be791[_0x30c7b8]={'$like':'%'+_0x2951dd[_0x7d1a('0x44')]['filter']+'%'};return _0x4be791;})});}_0x5de256=_[_0x7d1a('0x59')]({},_0x5de256,_0x2951dd[_0x7d1a('0x5a')]);return db['VoiceRecording'][_0x7d1a('0x24')]({'where':_0x5de256[_0x7d1a('0xce')]})[_0x7d1a('0x18')](function(_0x5471b2){_0x31535a['count']=_0x5471b2;if(_0x2951dd['query']['includeAll']){_0x5de256[_0x7d1a('0x43')]=[{'all':!![]}];}return db['VoiceRecording'][_0x7d1a('0x48')](_0x5de256);})[_0x7d1a('0x18')](function(_0x4b6398){_0x31535a[_0x7d1a('0x49')]=_0x4b6398;return _0x31535a;});}})[_0x7d1a('0x18')](respondWithFilteredResult(_0x27d0e9,_0x5de256))['catch'](handleError(_0x27d0e9,null));};exports[_0x7d1a('0xe0')]=function(_0x552644,_0x1489dd){var _0x62f87b={'raw':!![],'where':{}};var _0x4d19d9={};var _0x1e48dd={'count':0x0,'rows':[]};return db[_0x7d1a('0x3d')][_0x7d1a('0x93')]({'where':{'id':_0x552644[_0x7d1a('0x51')]['id']}})[_0x7d1a('0x18')](handleEntityNotFound(_0x1489dd,null))[_0x7d1a('0x18')](function(_0x232522){if(_0x232522){_0x4d19d9['model']=_[_0x7d1a('0x53')](db[_0x7d1a('0xe1')][_0x7d1a('0x3e')]);_0x4d19d9[_0x7d1a('0x44')]=_['keys'](_0x552644['query']);_0x4d19d9['filters']=_[_0x7d1a('0x56')](_0x4d19d9['model'],_0x4d19d9[_0x7d1a('0x44')]);_0x62f87b[_0x7d1a('0x46')]=_[_0x7d1a('0x56')](_0x4d19d9[_0x7d1a('0x52')],qs[_0x7d1a('0x57')](_0x552644[_0x7d1a('0x44')]['fields']));_0x62f87b[_0x7d1a('0x46')]=_0x62f87b['attributes'][_0x7d1a('0x4a')]?_0x62f87b['attributes']:_0x4d19d9[_0x7d1a('0x52')];if(!_0x552644['query']['hasOwnProperty'](_0x7d1a('0xda'))){_0x62f87b[_0x7d1a('0x26')]=qs[_0x7d1a('0x26')](_0x552644['query'][_0x7d1a('0x26')]);_0x62f87b[_0x7d1a('0x25')]=qs[_0x7d1a('0x25')](_0x552644[_0x7d1a('0x44')][_0x7d1a('0x25')]);}_0x62f87b[_0x7d1a('0xcd')]=qs[_0x7d1a('0xd6')](_0x552644['query'][_0x7d1a('0xd6')]);_0x62f87b['where']=qs['filters'](_[_0x7d1a('0xd7')](_0x552644['query'],_0x4d19d9['filters']));_0x62f87b[_0x7d1a('0xce')][_0x7d1a('0xdf')]=_0x232522['id'];if(_0x552644['query'][_0x7d1a('0x33')]){_0x62f87b[_0x7d1a('0xce')]=_['merge'](_0x62f87b[_0x7d1a('0xce')],{'$or':_[_0x7d1a('0x89')](_0x62f87b[_0x7d1a('0x46')],function(_0x37505c){var _0x183748={};_0x183748[_0x37505c]={'$like':'%'+_0x552644[_0x7d1a('0x44')][_0x7d1a('0x33')]+'%'};return _0x183748;})});}_0x62f87b=_['merge']({},_0x62f87b,_0x552644[_0x7d1a('0x5a')]);return db[_0x7d1a('0xe1')][_0x7d1a('0x24')]({'where':_0x62f87b[_0x7d1a('0xce')]})['then'](function(_0x2ea199){_0x1e48dd[_0x7d1a('0x24')]=_0x2ea199;if(_0x552644[_0x7d1a('0x44')][_0x7d1a('0x42')]){_0x62f87b['include']=[{'all':!![]}];}return db[_0x7d1a('0xe1')]['findAll'](_0x62f87b);})[_0x7d1a('0x18')](function(_0x49cadb){_0x1e48dd['rows']=_0x49cadb;return _0x1e48dd;});}})[_0x7d1a('0x18')](respondWithFilteredResult(_0x1489dd,_0x62f87b))[_0x7d1a('0x4f')](handleError(_0x1489dd,null));};exports['getChatInteractions']=function(_0x45b713,_0x4e0058){var _0x590852={};var _0x55f207={};var _0x4ba7e7;var _0x1aa3fc;return db['User'][_0x7d1a('0x93')]({'where':{'id':_0x45b713['params']['id']}})[_0x7d1a('0x18')](handleEntityNotFound(_0x4e0058,null))[_0x7d1a('0x18')](function(_0xae4037){if(_0xae4037){_0x4ba7e7=_0xae4037;_0x55f207[_0x7d1a('0x52')]=_['keys'](db[_0x7d1a('0xe2')][_0x7d1a('0x3e')]);_0x55f207['query']=_['keys'](_0x45b713[_0x7d1a('0x44')]);_0x55f207[_0x7d1a('0x55')]=_[_0x7d1a('0x56')](_0x55f207[_0x7d1a('0x52')],_0x55f207[_0x7d1a('0x44')]);_0x590852[_0x7d1a('0x46')]=_[_0x7d1a('0x56')](_0x55f207[_0x7d1a('0x52')],qs[_0x7d1a('0x57')](_0x45b713[_0x7d1a('0x44')][_0x7d1a('0x57')]));_0x590852[_0x7d1a('0x46')]=_0x590852[_0x7d1a('0x46')][_0x7d1a('0x4a')]?_0x590852[_0x7d1a('0x46')]:_0x55f207[_0x7d1a('0x52')];_0x590852['order']=qs[_0x7d1a('0xd6')](_0x45b713['query'][_0x7d1a('0xd6')]);_0x590852[_0x7d1a('0xce')]=qs['filters'](_[_0x7d1a('0xd7')](_0x45b713[_0x7d1a('0x44')],_0x55f207[_0x7d1a('0x55')]));if(_0x45b713[_0x7d1a('0x44')][_0x7d1a('0x33')]){_0x590852['where']=_[_0x7d1a('0x59')](_0x590852['where'],{'$or':_[_0x7d1a('0x89')](_0x590852[_0x7d1a('0x46')],function(_0x2c8930){var _0x586063={};_0x586063[_0x2c8930]={'$like':'%'+_0x45b713[_0x7d1a('0x44')][_0x7d1a('0x33')]+'%'};return _0x586063;})});}_0x590852=_['merge']({},_0x590852,_0x45b713['options']);return _0x4ba7e7['getChatInteractions'](_0x590852);}})[_0x7d1a('0x18')](function(_0x506c45){if(_0x506c45){_0x1aa3fc=_0x506c45[_0x7d1a('0x4a')];if(!_0x45b713[_0x7d1a('0x44')][_0x7d1a('0xcf')](_0x7d1a('0xda'))){_0x590852['limit']=qs['limit'](_0x45b713[_0x7d1a('0x44')][_0x7d1a('0x26')]);_0x590852[_0x7d1a('0x25')]=qs[_0x7d1a('0x25')](_0x45b713[_0x7d1a('0x44')][_0x7d1a('0x25')]);}return _0x4ba7e7[_0x7d1a('0xe3')](_0x590852);}})[_0x7d1a('0x18')](function(_0x42d1ca){if(_0x42d1ca){return _0x42d1ca?{'count':_0x1aa3fc,'rows':_0x42d1ca}:null;}})[_0x7d1a('0x18')](respondWithResult(_0x4e0058,null))['catch'](handleError(_0x4e0058,null));};exports['getOpenchannelInteractions']=function(_0x2d5863,_0x34d307){var _0x50edda={};var _0x47e0e7={};var _0x31534b;var _0xb2f41d;return db[_0x7d1a('0x3d')][_0x7d1a('0x93')]({'where':{'id':_0x2d5863[_0x7d1a('0x51')]['id']}})['then'](handleEntityNotFound(_0x34d307,null))[_0x7d1a('0x18')](function(_0xbc9ff0){if(_0xbc9ff0){_0x31534b=_0xbc9ff0;_0x47e0e7['model']=_[_0x7d1a('0x53')](db['OpenchannelInteraction']['rawAttributes']);_0x47e0e7['query']=_['keys'](_0x2d5863[_0x7d1a('0x44')]);_0x47e0e7[_0x7d1a('0x55')]=_['intersection'](_0x47e0e7[_0x7d1a('0x52')],_0x47e0e7[_0x7d1a('0x44')]);_0x50edda[_0x7d1a('0x46')]=_[_0x7d1a('0x56')](_0x47e0e7[_0x7d1a('0x52')],qs['fields'](_0x2d5863[_0x7d1a('0x44')][_0x7d1a('0x57')]));_0x50edda[_0x7d1a('0x46')]=_0x50edda[_0x7d1a('0x46')][_0x7d1a('0x4a')]?_0x50edda[_0x7d1a('0x46')]:_0x47e0e7['model'];_0x50edda[_0x7d1a('0xcd')]=qs[_0x7d1a('0xd6')](_0x2d5863[_0x7d1a('0x44')][_0x7d1a('0xd6')]);_0x50edda[_0x7d1a('0xce')]=qs[_0x7d1a('0x55')](_[_0x7d1a('0xd7')](_0x2d5863[_0x7d1a('0x44')],_0x47e0e7[_0x7d1a('0x55')]));if(_0x2d5863[_0x7d1a('0x44')]['filter']){_0x50edda[_0x7d1a('0xce')]=_[_0x7d1a('0x59')](_0x50edda[_0x7d1a('0xce')],{'$or':_[_0x7d1a('0x89')](_0x50edda[_0x7d1a('0x46')],function(_0x39e82c){var _0x3f5ba1={};_0x3f5ba1[_0x39e82c]={'$like':'%'+_0x2d5863[_0x7d1a('0x44')][_0x7d1a('0x33')]+'%'};return _0x3f5ba1;})});}_0x50edda=_[_0x7d1a('0x59')]({},_0x50edda,_0x2d5863[_0x7d1a('0x5a')]);return _0x31534b[_0x7d1a('0xe4')](_0x50edda);}})[_0x7d1a('0x18')](function(_0x3103d8){if(_0x3103d8){_0xb2f41d=_0x3103d8[_0x7d1a('0x4a')];if(!_0x2d5863[_0x7d1a('0x44')][_0x7d1a('0xcf')]('nolimit')){_0x50edda[_0x7d1a('0x26')]=qs['limit'](_0x2d5863[_0x7d1a('0x44')][_0x7d1a('0x26')]);_0x50edda[_0x7d1a('0x25')]=qs['offset'](_0x2d5863[_0x7d1a('0x44')][_0x7d1a('0x25')]);}return _0x31534b[_0x7d1a('0xe4')](_0x50edda);}})[_0x7d1a('0x18')](function(_0x569c2a){if(_0x569c2a){return _0x569c2a?{'count':_0xb2f41d,'rows':_0x569c2a}:null;}})[_0x7d1a('0x18')](respondWithResult(_0x34d307,null))[_0x7d1a('0x4f')](handleError(_0x34d307,null));};exports[_0x7d1a('0xe5')]=function(_0x4917b1,_0x345335){var _0x16f6fe={'raw':!![],'where':{}};var _0x3adf03={};var _0x1b61fe={'count':0x0,'rows':[]};return db[_0x7d1a('0x3d')][_0x7d1a('0x93')]({'where':{'id':_0x4917b1[_0x7d1a('0x51')]['id']}})[_0x7d1a('0x18')](handleEntityNotFound(_0x345335,null))[_0x7d1a('0x18')](function(_0x154b6b){if(_0x154b6b){_0x3adf03[_0x7d1a('0x52')]=_[_0x7d1a('0x53')](db[_0x7d1a('0xe6')][_0x7d1a('0x3e')]);_0x3adf03[_0x7d1a('0x44')]=_[_0x7d1a('0x53')](_0x4917b1[_0x7d1a('0x44')]);_0x3adf03[_0x7d1a('0x55')]=_[_0x7d1a('0x56')](_0x3adf03['model'],_0x3adf03[_0x7d1a('0x44')]);_0x16f6fe[_0x7d1a('0x46')]=_[_0x7d1a('0x56')](_0x3adf03['model'],qs['fields'](_0x4917b1[_0x7d1a('0x44')][_0x7d1a('0x57')]));_0x16f6fe[_0x7d1a('0x46')]=_0x16f6fe[_0x7d1a('0x46')]['length']?_0x16f6fe['attributes']:_0x3adf03[_0x7d1a('0x52')];if(!_0x4917b1['query'][_0x7d1a('0xcf')](_0x7d1a('0xda'))){_0x16f6fe['limit']=qs['limit'](_0x4917b1[_0x7d1a('0x44')]['limit']);_0x16f6fe[_0x7d1a('0x25')]=qs[_0x7d1a('0x25')](_0x4917b1[_0x7d1a('0x44')][_0x7d1a('0x25')]);}_0x16f6fe[_0x7d1a('0xcd')]=qs[_0x7d1a('0xd6')](_0x4917b1[_0x7d1a('0x44')][_0x7d1a('0xd6')]);_0x16f6fe[_0x7d1a('0xce')]=qs['filters'](_['pick'](_0x4917b1[_0x7d1a('0x44')],_0x3adf03['filters']));_0x16f6fe[_0x7d1a('0xce')][_0x7d1a('0xdf')]=_0x154b6b['id'];if(_0x4917b1[_0x7d1a('0x44')]['filter']){_0x16f6fe['where']=_[_0x7d1a('0x59')](_0x16f6fe[_0x7d1a('0xce')],{'$or':_[_0x7d1a('0x89')](_0x16f6fe[_0x7d1a('0x46')],function(_0xdf87e0){var _0x5972d6={};_0x5972d6[_0xdf87e0]={'$like':'%'+_0x4917b1['query'][_0x7d1a('0x33')]+'%'};return _0x5972d6;})});}_0x16f6fe=_[_0x7d1a('0x59')]({},_0x16f6fe,_0x4917b1[_0x7d1a('0x5a')]);return db['MailInteraction'][_0x7d1a('0x24')]({'where':_0x16f6fe[_0x7d1a('0xce')]})['then'](function(_0x10430e){_0x1b61fe[_0x7d1a('0x24')]=_0x10430e;if(_0x4917b1[_0x7d1a('0x44')][_0x7d1a('0x42')]){_0x16f6fe['include']=[{'all':!![]}];}return db[_0x7d1a('0xe6')][_0x7d1a('0x48')](_0x16f6fe);})['then'](function(_0x202a33){_0x1b61fe[_0x7d1a('0x49')]=_0x202a33;return _0x1b61fe;});}})[_0x7d1a('0x18')](respondWithFilteredResult(_0x345335,_0x16f6fe))['catch'](handleError(_0x345335,null));};exports[_0x7d1a('0xe7')]=function(_0x33d083,_0x176eca){var _0x24a676={};var _0x193a36={};var _0x331888;var _0x10d1c3;return db[_0x7d1a('0x3d')]['findOne']({'where':{'id':_0x33d083[_0x7d1a('0x51')]['id']}})[_0x7d1a('0x18')](handleEntityNotFound(_0x176eca,null))[_0x7d1a('0x18')](function(_0x36c601){if(_0x36c601){_0x331888=_0x36c601;_0x193a36[_0x7d1a('0x52')]=_[_0x7d1a('0x53')](db['SmsInteraction'][_0x7d1a('0x3e')]);_0x193a36['query']=_['keys'](_0x33d083[_0x7d1a('0x44')]);_0x193a36[_0x7d1a('0x55')]=_['intersection'](_0x193a36[_0x7d1a('0x52')],_0x193a36[_0x7d1a('0x44')]);_0x24a676[_0x7d1a('0x46')]=_['intersection'](_0x193a36['model'],qs[_0x7d1a('0x57')](_0x33d083['query'][_0x7d1a('0x57')]));_0x24a676[_0x7d1a('0x46')]=_0x24a676[_0x7d1a('0x46')][_0x7d1a('0x4a')]?_0x24a676[_0x7d1a('0x46')]:_0x193a36['model'];_0x24a676[_0x7d1a('0xcd')]=qs[_0x7d1a('0xd6')](_0x33d083[_0x7d1a('0x44')]['sort']);_0x24a676[_0x7d1a('0xce')]=qs[_0x7d1a('0x55')](_[_0x7d1a('0xd7')](_0x33d083['query'],_0x193a36[_0x7d1a('0x55')]));if(_0x33d083[_0x7d1a('0x44')][_0x7d1a('0x33')]){_0x24a676[_0x7d1a('0xce')]=_[_0x7d1a('0x59')](_0x24a676[_0x7d1a('0xce')],{'$or':_[_0x7d1a('0x89')](_0x24a676['attributes'],function(_0x501e30){var _0xbd670b={};_0xbd670b[_0x501e30]={'$like':'%'+_0x33d083[_0x7d1a('0x44')][_0x7d1a('0x33')]+'%'};return _0xbd670b;})});}_0x24a676=_[_0x7d1a('0x59')]({},_0x24a676,_0x33d083['options']);return _0x331888[_0x7d1a('0xe7')](_0x24a676);}})[_0x7d1a('0x18')](function(_0x59b448){if(_0x59b448){_0x10d1c3=_0x59b448[_0x7d1a('0x4a')];if(!_0x33d083[_0x7d1a('0x44')][_0x7d1a('0xcf')](_0x7d1a('0xda'))){_0x24a676[_0x7d1a('0x26')]=qs[_0x7d1a('0x26')](_0x33d083[_0x7d1a('0x44')][_0x7d1a('0x26')]);_0x24a676[_0x7d1a('0x25')]=qs[_0x7d1a('0x25')](_0x33d083['query'][_0x7d1a('0x25')]);}return _0x331888[_0x7d1a('0xe7')](_0x24a676);}})[_0x7d1a('0x18')](function(_0x519724){if(_0x519724){return _0x519724?{'count':_0x10d1c3,'rows':_0x519724}:null;}})[_0x7d1a('0x18')](respondWithResult(_0x176eca,null))[_0x7d1a('0x4f')](handleError(_0x176eca,null));};exports[_0x7d1a('0xe8')]=function(_0x1bf3bb,_0x233fbf){var _0x5ee888={};var _0x51b9dd={};var _0x486776;var _0x4a2908;return db[_0x7d1a('0x3d')][_0x7d1a('0x93')]({'where':{'id':_0x1bf3bb[_0x7d1a('0x51')]['id']}})['then'](handleEntityNotFound(_0x233fbf,null))[_0x7d1a('0x18')](function(_0x1fc2dc){if(_0x1fc2dc){_0x486776=_0x1fc2dc;_0x51b9dd[_0x7d1a('0x52')]=_[_0x7d1a('0x53')](db[_0x7d1a('0xe9')][_0x7d1a('0x3e')]);_0x51b9dd[_0x7d1a('0x44')]=_[_0x7d1a('0x53')](_0x1bf3bb[_0x7d1a('0x44')]);_0x51b9dd[_0x7d1a('0x55')]=_[_0x7d1a('0x56')](_0x51b9dd[_0x7d1a('0x52')],_0x51b9dd[_0x7d1a('0x44')]);_0x5ee888[_0x7d1a('0x46')]=_[_0x7d1a('0x56')](_0x51b9dd[_0x7d1a('0x52')],qs[_0x7d1a('0x57')](_0x1bf3bb[_0x7d1a('0x44')][_0x7d1a('0x57')]));_0x5ee888[_0x7d1a('0x46')]=_0x5ee888['attributes']['length']?_0x5ee888[_0x7d1a('0x46')]:_0x51b9dd['model'];_0x5ee888[_0x7d1a('0xcd')]=qs[_0x7d1a('0xd6')](_0x1bf3bb[_0x7d1a('0x44')][_0x7d1a('0xd6')]);_0x5ee888[_0x7d1a('0xce')]=qs[_0x7d1a('0x55')](_['pick'](_0x1bf3bb[_0x7d1a('0x44')],_0x51b9dd[_0x7d1a('0x55')]));if(_0x1bf3bb[_0x7d1a('0x44')][_0x7d1a('0x33')]){_0x5ee888[_0x7d1a('0xce')]=_[_0x7d1a('0x59')](_0x5ee888[_0x7d1a('0xce')],{'$or':_[_0x7d1a('0x89')](_0x5ee888[_0x7d1a('0x46')],function(_0x3db0d5){var _0xb1496f={};_0xb1496f[_0x3db0d5]={'$like':'%'+_0x1bf3bb[_0x7d1a('0x44')][_0x7d1a('0x33')]+'%'};return _0xb1496f;})});}_0x5ee888=_[_0x7d1a('0x59')]({},_0x5ee888,_0x1bf3bb[_0x7d1a('0x5a')]);return _0x486776[_0x7d1a('0xe8')](_0x5ee888);}})[_0x7d1a('0x18')](function(_0x1acf14){if(_0x1acf14){_0x4a2908=_0x1acf14[_0x7d1a('0x4a')];if(!_0x1bf3bb[_0x7d1a('0x44')][_0x7d1a('0xcf')]('nolimit')){_0x5ee888[_0x7d1a('0x26')]=qs[_0x7d1a('0x26')](_0x1bf3bb[_0x7d1a('0x44')][_0x7d1a('0x26')]);_0x5ee888[_0x7d1a('0x25')]=qs[_0x7d1a('0x25')](_0x1bf3bb[_0x7d1a('0x44')][_0x7d1a('0x25')]);}return _0x486776[_0x7d1a('0xe8')](_0x5ee888);}})[_0x7d1a('0x18')](function(_0x14e0b3){if(_0x14e0b3){return _0x14e0b3?{'count':_0x4a2908,'rows':_0x14e0b3}:null;}})[_0x7d1a('0x18')](respondWithResult(_0x233fbf,null))[_0x7d1a('0x4f')](handleError(_0x233fbf,null));};exports[_0x7d1a('0xea')]=function(_0x587372,_0x3cb731){var _0x28f6a8={};var _0x347065={};var _0x38b92b;var _0x191aaf;return db[_0x7d1a('0x3d')]['findOne']({'where':{'id':_0x587372[_0x7d1a('0x51')]['id']}})[_0x7d1a('0x18')](handleEntityNotFound(_0x3cb731,null))['then'](function(_0x2fdb5e){if(_0x2fdb5e){_0x38b92b=_0x2fdb5e;_0x347065[_0x7d1a('0x52')]=_['keys'](db[_0x7d1a('0xeb')][_0x7d1a('0x3e')]);_0x347065[_0x7d1a('0x44')]=_[_0x7d1a('0x53')](_0x587372[_0x7d1a('0x44')]);_0x347065[_0x7d1a('0x55')]=_[_0x7d1a('0x56')](_0x347065[_0x7d1a('0x52')],_0x347065[_0x7d1a('0x44')]);_0x28f6a8[_0x7d1a('0x46')]=_[_0x7d1a('0x56')](_0x347065['model'],qs[_0x7d1a('0x57')](_0x587372[_0x7d1a('0x44')][_0x7d1a('0x57')]));_0x28f6a8[_0x7d1a('0x46')]=_0x28f6a8[_0x7d1a('0x46')][_0x7d1a('0x4a')]?_0x28f6a8[_0x7d1a('0x46')]:_0x347065[_0x7d1a('0x52')];_0x28f6a8['order']=qs[_0x7d1a('0xd6')](_0x587372[_0x7d1a('0x44')]['sort']);_0x28f6a8[_0x7d1a('0xce')]=qs[_0x7d1a('0x55')](_['pick'](_0x587372['query'],_0x347065['filters']));if(_0x587372[_0x7d1a('0x44')]['filter']){_0x28f6a8[_0x7d1a('0xce')]=_[_0x7d1a('0x59')](_0x28f6a8[_0x7d1a('0xce')],{'$or':_[_0x7d1a('0x89')](_0x28f6a8[_0x7d1a('0x46')],function(_0x2b3a70){var _0x3771dd={};_0x3771dd[_0x2b3a70]={'$like':'%'+_0x587372[_0x7d1a('0x44')][_0x7d1a('0x33')]+'%'};return _0x3771dd;})});}_0x28f6a8=_[_0x7d1a('0x59')]({},_0x28f6a8,_0x587372['options']);return _0x38b92b['getWhatsappInteractions'](_0x28f6a8);}})[_0x7d1a('0x18')](function(_0x512aa1){if(_0x512aa1){_0x191aaf=_0x512aa1['length'];if(!_0x587372[_0x7d1a('0x44')][_0x7d1a('0xcf')](_0x7d1a('0xda'))){_0x28f6a8[_0x7d1a('0x26')]=qs[_0x7d1a('0x26')](_0x587372[_0x7d1a('0x44')][_0x7d1a('0x26')]);_0x28f6a8[_0x7d1a('0x25')]=qs[_0x7d1a('0x25')](_0x587372[_0x7d1a('0x44')][_0x7d1a('0x25')]);}return _0x38b92b[_0x7d1a('0xea')](_0x28f6a8);}})[_0x7d1a('0x18')](function(_0x2629e9){if(_0x2629e9){return _0x2629e9?{'count':_0x191aaf,'rows':_0x2629e9}:null;}})[_0x7d1a('0x18')](respondWithResult(_0x3cb731,null))[_0x7d1a('0x4f')](handleError(_0x3cb731,null));};exports['login']=function(_0xcbab9f,_0x4da70b,_0x5468ce){var _0x4a68a2;var _0x4989cc;var _0x53e50d;var _0x5555a0=!_[_0x7d1a('0x66')](_0xcbab9f['params']['id'])?_0xcbab9f['params']['id']:!_[_0x7d1a('0x66')](_0xcbab9f['user']['id'])?_0xcbab9f[_0x7d1a('0x30')]['id']:null;return db['User'][_0x7d1a('0x37')]({'where':{'id':_0x5555a0,'role':{'$or':[_0x7d1a('0x2f'),'user',_0x7d1a('0x2a')]}},'attributes':['id',_0x7d1a('0x38'),_0x7d1a('0xec'),'mobile','role','internal',_0x7d1a('0xed')]})[_0x7d1a('0x18')](function(_0x4f52d5){if(_0x4f52d5){if(_0x4f52d5[_0x7d1a('0x29')]==='agent'){_0x4a68a2=_0x4f52d5;if(_0xcbab9f[_0x7d1a('0x5e')][_0x7d1a('0x9c')]){_0x53e50d=util['format'](_0x7d1a('0xee'),_0x4a68a2[_0xcbab9f[_0x7d1a('0x5e')]['interface']]);}else if(_0xcbab9f[_0x7d1a('0x5e')][_0x7d1a('0xef')]){_0x53e50d=util['format'](_0x7d1a('0xa9'),_0xcbab9f[_0x7d1a('0x5e')][_0x7d1a('0xef')]);}else{_0x53e50d=util['format'](_0x7d1a('0xa9'),_0x4a68a2['name']);}socket['to'](util['format']('user:%s',_0x4a68a2[_0x7d1a('0x38')]))[_0x7d1a('0x2b')](_0x7d1a('0xf0'),{'user':{'id':_0x4a68a2['id'],'name':_0x4a68a2['name']},'ip':_0xcbab9f['headers'][_0x7d1a('0xf1')]||_0xcbab9f[_0x7d1a('0xf2')]['remoteAddress']||_0xcbab9f[_0x7d1a('0xf3')]['remoteAddress']||_0xcbab9f[_0x7d1a('0xf2')][_0x7d1a('0xf3')][_0x7d1a('0xf4')]});return db['UserVoiceQueueRt'][_0x7d1a('0x2d')]({'where':{'membername':_0x4a68a2[_0x7d1a('0x38')]},'individualHooks':!![]});}}else{throw new db[(_0x7d1a('0x8e'))][(_0x7d1a('0x8f'))](_0x7d1a('0xf5'));}})[_0x7d1a('0x18')](function(){if(_0x4a68a2){return _0x4a68a2['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x1423c8){if(_0x4a68a2){if(_0x1423c8){_0x4989cc=_0x1423c8;if(_0x4989cc[_0x7d1a('0x4a')]){var _0x466923=_0x4989cc[_0x7d1a('0x89')](function(_0x4a1b16){var _0xa4c368={'membername':_0x4a68a2['name'],'UserId':_0x4a68a2['id'],'queue_name':_0x4a1b16['name'],'VoiceQueueId':_0x4a1b16['id'],'interface':_0x53e50d,'paused':_0x4a68a2[_0x7d1a('0xed')]||![],'penalty':_0x4a1b16[_0x7d1a('0xf6')]||0x0};return db[_0x7d1a('0xaa')]['upsert'](_0xa4c368);});return Promise[_0x7d1a('0x5d')](_0x466923);}}}})['then'](function(){if(_0x4a68a2){return db[_0x7d1a('0xf7')][_0x7d1a('0x48')]({'where':{'membername':_0x4a68a2[_0x7d1a('0x38')],'exitAt':null}});}})[_0x7d1a('0x18')](function(_0x549360){if(_0x4a68a2){var _0x3ff508=[];_0x549360[_0x7d1a('0xf8')](function(_0x244216){_0x3ff508[_0x7d1a('0x47')](_0x244216['update']({'exitAt':moment()[_0x7d1a('0xa8')](_0x7d1a('0xf9'))}));});return Promise[_0x7d1a('0x5d')](_0x3ff508);}})[_0x7d1a('0x18')](function(){if(_0x4a68a2){var _0x3eedf8=[];var _0x1cca07=[];var _0xc794a5=utils[_0x7d1a('0xfa')]();var _0x13fc2f={'membername':_0x4a68a2['name'],'interface':_0x53e50d,'enterAt':moment()[_0x7d1a('0xa8')](_0x7d1a('0xf9')),'role':_0x4a68a2[_0x7d1a('0x29')],'internal':_0x4a68a2['internal']};_0xc794a5[_0x7d1a('0xf8')](function(_0x57dadd){_0x3eedf8[_0x7d1a('0x47')](_[_0x7d1a('0x59')]({'channel':_0x57dadd,'type':_0x7d1a('0xfb'),'data1':_0xcbab9f[_0x7d1a('0x5e')][_0x7d1a('0xfc')],'data2':_0x53e50d},_0x13fc2f));if(_0x4a68a2[_0x7d1a('0xed')]){_0x1cca07['push'](_[_0x7d1a('0x59')]({'channel':_0x57dadd,'type':_0x7d1a('0xfd'),'data1':'LOGININPAUSE'},_0x13fc2f));}});return db[_0x7d1a('0xf7')][_0x7d1a('0xfe')](_0x3eedf8[_0x7d1a('0xca')](_0x1cca07),{'individualHooks':!![]});}})[_0x7d1a('0x18')](function(){if(_0x4a68a2){return _0x4a68a2[_0x7d1a('0x28')]({'online':!![],'lastLoginAt':moment()[_0x7d1a('0xa8')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x4a68a2[_0x7d1a('0xed')]||![],'mailPause':_0x4a68a2[_0x7d1a('0xed')]||![],'chatPause':_0x4a68a2[_0x7d1a('0xed')]||![],'faxPause':_0x4a68a2[_0x7d1a('0xed')]||![],'smsPause':_0x4a68a2[_0x7d1a('0xed')]||![],'openchannelPause':_0x4a68a2[_0x7d1a('0xed')]||![],'whatsappPause':_0x4a68a2[_0x7d1a('0xed')]||![],'pauseType':_0x4a68a2[_0x7d1a('0xed')]?_0x7d1a('0xff'):null,'interface':_0x53e50d,'lastPauseAt':moment()[_0x7d1a('0xa8')](_0x7d1a('0xf9'))});}})[_0x7d1a('0x18')](function(_0x169514){if(_0xcbab9f[_0x7d1a('0x100')]){return _0x5468ce();}else{return Promise[_0x7d1a('0x101')](_0x169514)['then'](respondWithResult(_0x4da70b,null));}})[_0x7d1a('0x4f')](handleError(_0x4da70b,null));};exports['logout']=function(_0x5ee23c,_0x54c713){var _0x2d440f;return db[_0x7d1a('0x3d')][_0x7d1a('0x37')]({'where':{'id':_0x5ee23c['params']['id'],'role':_0x7d1a('0x2a')},'attributes':['id',_0x7d1a('0x38'),_0x7d1a('0x29')]})[_0x7d1a('0x18')](handleEntityNotFound(_0x54c713,null))[_0x7d1a('0x18')](function(_0xc4bf4c){if(_0xc4bf4c){_0x2d440f=_0xc4bf4c;return db[_0x7d1a('0xaa')][_0x7d1a('0x2d')]({'where':{'membername':_0x2d440f['name']},'individualHooks':!![]});}})[_0x7d1a('0x18')](function(){return db[_0x7d1a('0xf7')]['findAll']({'where':{'membername':_0x2d440f[_0x7d1a('0x38')],'exitAt':null}});})['then'](function(_0x570af3){var _0x3a2f26=[];_0x570af3[_0x7d1a('0xf8')](function(_0x56a750){_0x3a2f26['push'](_0x56a750[_0x7d1a('0x28')]({'exitAt':moment()[_0x7d1a('0xa8')](_0x7d1a('0xf9'))}));});return Promise[_0x7d1a('0x5d')](_0x3a2f26);})[_0x7d1a('0x18')](function(){return _0x2d440f['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x54c713,null))[_0x7d1a('0x4f')](handleError(_0x54c713,null));};exports[_0x7d1a('0x102')]=function(_0x320ea8,_0x103584){var _0x20989d;return db[_0x7d1a('0xaa')][_0x7d1a('0x28')]({'paused':0x1},{'where':{'UserId':_0x320ea8[_0x7d1a('0x51')]['id']},'individualHooks':!![]})[_0x7d1a('0x18')](function(){return db[_0x7d1a('0x3d')]['find']({'where':{'id':_0x320ea8[_0x7d1a('0x51')]['id'],'role':_0x7d1a('0x2a')},'attributes':['id',_0x7d1a('0x38'),_0x7d1a('0x29'),_0x7d1a('0x62'),_0x7d1a('0x9c'),_0x7d1a('0x9a')]});})[_0x7d1a('0x18')](handleEntityNotFound(_0x103584,null))[_0x7d1a('0x18')](function(_0x40023e){if(_0x40023e){_0x20989d=_0x40023e;return respondWithRpcPromise('QueuePause',_0x7d1a('0x102'),{'id':_0x20989d['id'],'name':_0x20989d[_0x7d1a('0x38')],'pause':!![]});}})[_0x7d1a('0x18')](function(){if(_0x20989d){return db[_0x7d1a('0xf7')]['findAll']({'where':{'membername':_0x20989d[_0x7d1a('0x38')],'type':_0x7d1a('0xfd'),'exitAt':null}});}})[_0x7d1a('0x18')](function(_0xb4d53){if(_0xb4d53[_0x7d1a('0x4a')]){var _0x1290bb=moment()['format'](_0x7d1a('0xf9'));for(var _0x15c49f=0x0,_0x12ed28=_0xb4d53[_0x7d1a('0x4a')];_0x15c49f<_0x12ed28;_0x15c49f++){_0xb4d53[_0x15c49f][_0x7d1a('0x103')]({'exitAt':_0x1290bb});}}})['then'](function(){var _0x45bfae=[];var _0xf29e46=utils[_0x7d1a('0xfa')]();_0xf29e46[_0x7d1a('0xf8')](function(_0x122898){_0x45bfae[_0x7d1a('0x47')]({'channel':_0x122898,'membername':_0x20989d[_0x7d1a('0x38')],'interface':_[_0x7d1a('0x66')](_0x20989d['interface'])?util[_0x7d1a('0xa8')]('SIP/%s',_0x20989d['name']):_0x20989d[_0x7d1a('0x9c')],'type':'PAUSE','enterAt':moment()[_0x7d1a('0xa8')](_0x7d1a('0xf9')),'data1':_0x320ea8[_0x7d1a('0x5e')][_0x7d1a('0x3f')]||_0x7d1a('0x104'),'role':_0x20989d['role'],'internal':_0x20989d[_0x7d1a('0x62')]});});return db['MemberReport'][_0x7d1a('0xfe')](_0x45bfae,{'individualHooks':!![]});})['then'](function(){return _0x20989d[_0x7d1a('0x28')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x320ea8[_0x7d1a('0x5e')][_0x7d1a('0x3f')]||_0x7d1a('0x104'),'lastPauseAt':moment()[_0x7d1a('0xa8')](_0x7d1a('0xf9'))});})[_0x7d1a('0x18')](respondWithResult(_0x103584,null))[_0x7d1a('0x4f')](handleError(_0x103584,null));};exports[_0x7d1a('0x105')]=function(_0x50d4cf,_0x1149e6){if(_0x50d4cf[_0x7d1a('0x5e')][_0x7d1a('0xac')]&&!utils['isValidChannel'](_0x50d4cf[_0x7d1a('0x5e')][_0x7d1a('0xac')])){throw new APIBadRequestError(util[_0x7d1a('0xa8')](_0x7d1a('0x106'),_0x50d4cf['body']['channel']));}return db[_0x7d1a('0x3d')][_0x7d1a('0x37')]({'where':{'id':_0x50d4cf[_0x7d1a('0x51')]['id']},'attributes':['id',_0x7d1a('0x38'),'role',_0x7d1a('0x62'),_0x7d1a('0x9c'),_0x7d1a('0x9a'),_0x7d1a('0x9b'),_0x7d1a('0x107'),_0x7d1a('0x108'),'faxPause',_0x7d1a('0x109'),_0x7d1a('0x10a'),_0x7d1a('0x10b'),_0x7d1a('0x10c'),'lastPauseAt']})['then'](function(_0x1617c8){if(!_0x1617c8){throw new APINotFoundError(util[_0x7d1a('0xa8')](_0x7d1a('0x10d'),_0x50d4cf[_0x7d1a('0x51')]['id']));}return _0x1617c8[_0x7d1a('0x105')](_0x50d4cf[_0x7d1a('0x5e')]['channel']);})[_0x7d1a('0x18')](respondWithResult(_0x1149e6,null))[_0x7d1a('0x4f')](APIHandleError(_0x1149e6));};exports[_0x7d1a('0x10e')]=function(_0x13a2ea,_0x1b3629){var _0x12f0a4={};var _0x19ee0c={};var _0x3a9b70;var _0x1f1c44;return db[_0x7d1a('0x3d')][_0x7d1a('0x93')]({'where':{'id':_0x13a2ea[_0x7d1a('0x51')]['id']}})[_0x7d1a('0x18')](handleEntityNotFound(_0x1b3629,null))[_0x7d1a('0x18')](function(_0x5d8fe8){if(_0x5d8fe8){_0x3a9b70=_0x5d8fe8;_0x19ee0c[_0x7d1a('0x52')]=_[_0x7d1a('0x53')](db[_0x7d1a('0x10f')][_0x7d1a('0x3e')]);_0x19ee0c[_0x7d1a('0x44')]=_[_0x7d1a('0x53')](_0x13a2ea[_0x7d1a('0x44')]);_0x19ee0c[_0x7d1a('0x55')]=_[_0x7d1a('0x56')](_0x19ee0c[_0x7d1a('0x52')],_0x19ee0c[_0x7d1a('0x44')]);_0x12f0a4[_0x7d1a('0x46')]=_[_0x7d1a('0x56')](_0x19ee0c['model'],qs[_0x7d1a('0x57')](_0x13a2ea[_0x7d1a('0x44')]['fields']));_0x12f0a4['attributes']=_0x12f0a4['attributes'][_0x7d1a('0x4a')]?_0x12f0a4[_0x7d1a('0x46')]:_0x19ee0c[_0x7d1a('0x52')];_0x12f0a4[_0x7d1a('0xcd')]=qs[_0x7d1a('0xd6')](_0x13a2ea['query'][_0x7d1a('0xd6')]);_0x12f0a4[_0x7d1a('0xce')]=qs[_0x7d1a('0x55')](_[_0x7d1a('0xd7')](_0x13a2ea['query'],_0x19ee0c[_0x7d1a('0x55')]));if(_0x13a2ea['query']['filter']){_0x12f0a4['where']=_[_0x7d1a('0x59')](_0x12f0a4['where'],{'$or':_['map'](_0x12f0a4[_0x7d1a('0x46')],function(_0x23971f){var _0x4de10f={};_0x4de10f[_0x23971f]={'$like':'%'+_0x13a2ea['query'][_0x7d1a('0x33')]+'%'};return _0x4de10f;})});}_0x12f0a4=_[_0x7d1a('0x59')]({},_0x12f0a4,_0x13a2ea['options']);return _0x3a9b70[_0x7d1a('0x10e')](_0x12f0a4);}})[_0x7d1a('0x18')](function(_0x19c4be){if(_0x19c4be){_0x1f1c44=_0x19c4be[_0x7d1a('0x4a')];if(!_0x13a2ea['query'][_0x7d1a('0xcf')](_0x7d1a('0xda'))){_0x12f0a4[_0x7d1a('0x26')]=qs[_0x7d1a('0x26')](_0x13a2ea[_0x7d1a('0x44')][_0x7d1a('0x26')]);_0x12f0a4[_0x7d1a('0x25')]=qs['offset'](_0x13a2ea['query'][_0x7d1a('0x25')]);}return _0x3a9b70['getTeams'](_0x12f0a4);}})[_0x7d1a('0x18')](function(_0x5b3b78){if(_0x5b3b78){return _0x5b3b78?{'count':_0x1f1c44,'rows':_0x5b3b78}:null;}})[_0x7d1a('0x18')](respondWithResult(_0x1b3629,null))['catch'](handleError(_0x1b3629,null));};exports[_0x7d1a('0x110')]=function(_0x52bca0,_0x3c83bb){var _0x21aad5=_0x52bca0[_0x7d1a('0x51')]['id'];var _0x1f48e9=_0x52bca0['body']?_0x52bca0[_0x7d1a('0x5e')][_0x7d1a('0x61')]:null;var _0x5550f2=[];return Promise[_0x7d1a('0x101')]()[_0x7d1a('0x18')](function(){if(!_0x1f48e9)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x7d1a('0x18')](function(){return db[_0x7d1a('0x3d')][_0x7d1a('0x93')]({'where':{'id':_0x21aad5}});})['then'](function(_0x5e204a){if(!_0x5e204a)throw new APINotFoundError(util[_0x7d1a('0xa8')]('User\x20with\x20id\x20%s\x20not\x20found',_0x52bca0[_0x7d1a('0x51')]['id']));return db[_0x7d1a('0x68')][_0x7d1a('0x111')](function(_0xdf7718){return _0x5e204a['addTeams'](_0x1f48e9,{'transaction':_0xdf7718})[_0x7d1a('0x18')](function(){return db[_0x7d1a('0x10f')]['findAll']({'where':{'id':{'$in':_0x1f48e9}}});})[_0x7d1a('0x18')](function(_0x4cf1e2){var _0x445e5b=_[_0x7d1a('0x89')](_0x4cf1e2,function(_0x201617){return _0x201617[_0x7d1a('0x112')]();});return Promise[_0x7d1a('0x5d')](_0x445e5b);})[_0x7d1a('0x18')](function(_0x9a2d30){_0x5550f2=_[_0x7d1a('0x113')](_0x9a2d30);var _0x3ad9da=_[_0x7d1a('0x89')](_0x5550f2,function(_0x5143c4){return _0x5143c4[_0x7d1a('0x114')](_0x5e204a['id'],{'transaction':_0xdf7718});});return Promise['all'](_0x3ad9da);})['then'](function(){if(!_0x5e204a[_0x7d1a('0x9a')])return;var _0x44cc4c=_[_0x7d1a('0x33')](_0x5550f2,function(_0x15953b){return _0x15953b[_0x7d1a('0x115')](_0x7d1a('0xac'))===_0x7d1a('0x116');});var _0x43bd1b=_[_0x7d1a('0x89')](_0x44cc4c,function(_0x37f94a){return db['UserVoiceQueueRt'][_0x7d1a('0xab')]({'membername':_0x5e204a[_0x7d1a('0x38')],'UserId':_0x5e204a['id'],'queue_name':_0x37f94a[_0x7d1a('0x38')],'VoiceQueueId':_0x37f94a['id'],'interface':_['isNil'](_0x5e204a['interface'])?util[_0x7d1a('0xa8')](_0x7d1a('0xa9'),_0x5e204a[_0x7d1a('0x38')]):_0x5e204a[_0x7d1a('0x9c')],'paused':_0x5e204a[_0x7d1a('0x9b')]||![],'penalty':_0x5e204a['penalty']},{'transaction':_0xdf7718});});return Promise[_0x7d1a('0x5d')](_0x43bd1b);})['then'](function(){return db[_0x7d1a('0x117')][_0x7d1a('0x48')]({'where':{'teamId':{'$in':_0x1f48e9}}});})['then'](function(_0x5b1f6b){var _0x631a12=_[_0x7d1a('0x89')](_0x5b1f6b,function(_0x1810ce){return db[_0x7d1a('0x118')][_0x7d1a('0x82')]({'UserId':_0x5e204a['id'],'VoicePrefixId':_0x1810ce[_0x7d1a('0x119')]},{'transaction':_0xdf7718});});return Promise[_0x7d1a('0x5d')](_0x631a12);});});})['then'](function(){for(var _0x2b9cdc=0x0;_0x2b9cdc<_0x5550f2[_0x7d1a('0x4a')];_0x2b9cdc++){var _0x32d43f=_0x5550f2[_0x2b9cdc]['getDataValue'](_0x7d1a('0xac'));var _0x4739f1=_0x32d43f+_0x7d1a('0xa4');socket[_0x7d1a('0x2b')](_0x7d1a('0x30')+_0x32d43f+'Queue:save',{'UserId':_0x21aad5,['queueField']:_0x5550f2[_0x2b9cdc]['id']});}})[_0x7d1a('0x18')](respondWithStatusCode(_0x3c83bb,null))[_0x7d1a('0x4f')](APIHandleError(_0x3c83bb));};exports['removeTeams']=function(_0x2b28ae,_0x390fbe){var _0x309ec4=_0x2b28ae[_0x7d1a('0x51')]['id'];var _0x172cba=null;if(_0x2b28ae[_0x7d1a('0x44')][_0x7d1a('0x61')]){_0x172cba=_[_0x7d1a('0x11a')](_0x2b28ae[_0x7d1a('0x44')]['ids'])?_0x2b28ae['query'][_0x7d1a('0x61')]:[_0x2b28ae[_0x7d1a('0x44')][_0x7d1a('0x61')]];}var _0x24ac3f=[];return Promise[_0x7d1a('0x101')]()[_0x7d1a('0x18')](function(){if(!_0x172cba)throw new APIBadRequestError(_0x7d1a('0x11b'));})[_0x7d1a('0x18')](function(){return db[_0x7d1a('0x3d')][_0x7d1a('0x93')]({'where':{'id':_0x309ec4}});})[_0x7d1a('0x18')](function(_0x2b60fb){if(!_0x2b60fb)throw new APINotFoundError(util[_0x7d1a('0xa8')]('User\x20with\x20id\x20%s\x20not\x20found',_0x2b28ae[_0x7d1a('0x51')]['id']));return db[_0x7d1a('0x68')][_0x7d1a('0x111')](function(_0x3975e7){return _0x2b60fb[_0x7d1a('0x11c')](_0x172cba,{'transaction':_0x3975e7})[_0x7d1a('0x18')](function(){return db[_0x7d1a('0x10f')][_0x7d1a('0x48')]({'where':{'id':{'$in':_0x172cba}}});})[_0x7d1a('0x18')](function(_0x4fe5f2){var _0x11e356=_['map'](_0x4fe5f2,function(_0xe8fbd5){return _0xe8fbd5[_0x7d1a('0x112')]();});return Promise[_0x7d1a('0x5d')](_0x11e356);})[_0x7d1a('0x18')](function(_0x352c73){_0x24ac3f=_['flattenDeep'](_0x352c73);var _0x52be2e=_[_0x7d1a('0x89')](_0x24ac3f,function(_0x2e43fa){return _0x2e43fa['removeAgent'](_0x2b60fb['id'],{'transaction':_0x3975e7});});return Promise['all'](_0x52be2e);})[_0x7d1a('0x18')](function(){if(!_0x2b60fb[_0x7d1a('0x9a')])return;var _0x20d3d6=_[_0x7d1a('0x33')](_0x24ac3f,function(_0x34ae7d){return _0x34ae7d[_0x7d1a('0x115')](_0x7d1a('0xac'))===_0x7d1a('0x116');});var _0x4ad8c4=_[_0x7d1a('0x89')](_0x20d3d6,function(_0x5d1c1a){return db[_0x7d1a('0xaa')][_0x7d1a('0x2d')]({'where':{'VoiceQueueId':_0x5d1c1a['id'],'UserId':_0x2b60fb['id']},'transaction':_0x3975e7});});return Promise[_0x7d1a('0x5d')](_0x4ad8c4);})['then'](function(){return db['TeamVoicePrefix'][_0x7d1a('0x48')]({'where':{'teamId':{'$in':_0x172cba}}});})[_0x7d1a('0x18')](function(_0xcac3a2){var _0x227813=_[_0x7d1a('0x89')](_0xcac3a2,function(_0x34580d){return db['UserVoicePrefix'][_0x7d1a('0x2d')]({'where':{'UserId':_0x2b60fb['id'],'VoicePrefixId':_0x34580d[_0x7d1a('0x119')]}},{'transaction':_0x3975e7});});return Promise[_0x7d1a('0x5d')](_0x227813);});});})[_0x7d1a('0x18')](function(){for(var _0x35b5cf=0x0;_0x35b5cf<_0x24ac3f[_0x7d1a('0x4a')];_0x35b5cf++){var _0x1d7753=_0x24ac3f[_0x35b5cf]['getDataValue'](_0x7d1a('0xac'));var _0x5e5f70=_0x1d7753+'QueueId';socket[_0x7d1a('0x2b')](_0x7d1a('0x30')+_0x1d7753+_0x7d1a('0xaf'),{'UserId':_0x309ec4,['queueField']:_0x24ac3f[_0x35b5cf]['id']});}})[_0x7d1a('0x18')](respondWithStatusCode(_0x390fbe,null))['catch'](APIHandleError(_0x390fbe));};exports[_0x7d1a('0x11d')]=function(_0x189b6c,_0x5b61c2){var _0x2feaca={};var _0x275f6b={};var _0x499a16;var _0xb2c34b;return db[_0x7d1a('0x3d')][_0x7d1a('0x93')]({'where':{'id':_0x189b6c[_0x7d1a('0x51')]['id']}})[_0x7d1a('0x18')](handleEntityNotFound(_0x5b61c2,null))[_0x7d1a('0x18')](function(_0x25e329){if(_0x25e329){_0x499a16=_0x25e329;_0x275f6b[_0x7d1a('0x52')]=_[_0x7d1a('0x53')](db[_0x7d1a('0xd0')][_0x7d1a('0x3e')]);_0x275f6b[_0x7d1a('0x44')]=_[_0x7d1a('0x53')](_0x189b6c[_0x7d1a('0x44')]);_0x275f6b['filters']=_[_0x7d1a('0x56')](_0x275f6b['model'],_0x275f6b[_0x7d1a('0x44')]);_0x2feaca[_0x7d1a('0x46')]=_[_0x7d1a('0x56')](_0x275f6b['model'],qs[_0x7d1a('0x57')](_0x189b6c[_0x7d1a('0x44')]['fields']));_0x2feaca[_0x7d1a('0x46')]=_0x2feaca[_0x7d1a('0x46')][_0x7d1a('0x4a')]?_0x2feaca[_0x7d1a('0x46')]:_0x275f6b[_0x7d1a('0x52')];_0x2feaca[_0x7d1a('0xcd')]=qs[_0x7d1a('0xd6')](_0x189b6c[_0x7d1a('0x44')][_0x7d1a('0xd6')]);_0x2feaca[_0x7d1a('0xce')]=qs[_0x7d1a('0x55')](_[_0x7d1a('0xd7')](_0x189b6c[_0x7d1a('0x44')],_0x275f6b[_0x7d1a('0x55')]));if(_0x189b6c[_0x7d1a('0x44')]['filter']){_0x2feaca['where']=_[_0x7d1a('0x59')](_0x2feaca[_0x7d1a('0xce')],{'$or':_[_0x7d1a('0x89')](_0x2feaca['attributes'],function(_0x27ae2d){var _0x303ceb={};_0x303ceb[_0x27ae2d]={'$like':'%'+_0x189b6c[_0x7d1a('0x44')][_0x7d1a('0x33')]+'%'};return _0x303ceb;})});}_0x2feaca=_[_0x7d1a('0x59')]({},_0x2feaca,_0x189b6c[_0x7d1a('0x5a')]);return _0x499a16['getLists'](_0x2feaca);}})[_0x7d1a('0x18')](function(_0x13bf04){if(_0x13bf04){_0xb2c34b=_0x13bf04['length'];if(!_0x189b6c[_0x7d1a('0x44')][_0x7d1a('0xcf')]('nolimit')){_0x2feaca[_0x7d1a('0x26')]=qs['limit'](_0x189b6c[_0x7d1a('0x44')]['limit']);_0x2feaca[_0x7d1a('0x25')]=qs[_0x7d1a('0x25')](_0x189b6c['query'][_0x7d1a('0x25')]);}return _0x499a16['getLists'](_0x2feaca);}})[_0x7d1a('0x18')](function(_0xc6e11e){if(_0xc6e11e){return _0xc6e11e?{'count':_0xb2c34b,'rows':_0xc6e11e}:null;}})['then'](respondWithResult(_0x5b61c2,null))['catch'](handleError(_0x5b61c2,null));};exports[_0x7d1a('0x11e')]=function(_0x43457a,_0x3c6df5){var _0x476bdc={};var _0x4d2429={};var _0x5023ba;return db['User'][_0x7d1a('0x93')]({'where':{'id':_0x43457a[_0x7d1a('0x51')]['id']}})[_0x7d1a('0x18')](handleEntityNotFound(_0x3c6df5,null))[_0x7d1a('0x18')](function(_0x334f64){if(_0x334f64){_0x5023ba=_0x334f64;_0x4d2429[_0x7d1a('0x52')]=_[_0x7d1a('0x53')](db['User'][_0x7d1a('0x3e')]);_0x4d2429[_0x7d1a('0x44')]=_[_0x7d1a('0x53')](_0x43457a[_0x7d1a('0x44')]);_0x4d2429['filters']=_[_0x7d1a('0x56')](_0x4d2429[_0x7d1a('0x52')],_0x4d2429[_0x7d1a('0x44')]);_0x476bdc[_0x7d1a('0x46')]=_[_0x7d1a('0x56')](_0x4d2429['model'],qs['fields'](_0x43457a[_0x7d1a('0x44')][_0x7d1a('0x57')]));_0x476bdc[_0x7d1a('0x46')]=_0x476bdc[_0x7d1a('0x46')][_0x7d1a('0x4a')]?_0x476bdc['attributes']:_0x4d2429[_0x7d1a('0x52')];_0x476bdc[_0x7d1a('0xcd')]=qs[_0x7d1a('0xd6')](_0x43457a[_0x7d1a('0x44')][_0x7d1a('0xd6')]);_0x476bdc[_0x7d1a('0xce')]=qs['filters'](_[_0x7d1a('0xd7')](_0x43457a[_0x7d1a('0x44')],_0x4d2429[_0x7d1a('0x55')]));if(_0x43457a['query'][_0x7d1a('0x33')]){_0x476bdc['where']=_[_0x7d1a('0x59')](_0x476bdc['where'],{'$or':_[_0x7d1a('0x89')](_0x476bdc[_0x7d1a('0x46')],function(_0x55a0d3){var _0x1411fb={};_0x1411fb[_0x55a0d3]={'$like':'%'+_0x43457a['query']['filter']+'%'};return _0x1411fb;})});}_0x476bdc[_0x7d1a('0x52')]=db[_0x7d1a('0x3d')];_0x476bdc['as']=_0x7d1a('0x84');_0x476bdc=_[_0x7d1a('0x59')]({},_0x476bdc,_0x43457a[_0x7d1a('0x5a')]);return _0x5023ba[_0x7d1a('0x11f')]({'include':[_0x476bdc]});}})[_0x7d1a('0x18')](function(_0x327d80){if(_0x327d80){var _0x147998={},_0x10de36=[];for(var _0x5172c2=0x0;_0x5172c2<_0x327d80[_0x7d1a('0x4a')];_0x5172c2+=0x1){for(var _0x49f49c=0x0,_0x4d6cc6;_0x49f49c<_0x327d80[_0x5172c2][_0x7d1a('0x84')][_0x7d1a('0x4a')];_0x49f49c+=0x1){_0x4d6cc6=_0x327d80[_0x5172c2][_0x7d1a('0x84')][_0x49f49c]['get']({'plain':!![]});_0x147998[_0x4d6cc6['id']]=_0x4d6cc6;}}_0x147998=_['values'](_0x147998);for(var _0x448424=qs['offset'](_0x43457a[_0x7d1a('0x44')][_0x7d1a('0x25')]);_0x448424<_0x147998['length']&&_0x10de36['length']=_0x3dd44d){_0x53f394=_0x3dd44d;_0xd14164=0xc8;}else{_0xd14164=0xce;}_0x40a394[_0xb205('0x1e')](_0xd14164);return _0x40a394[_0xb205('0x25')](_0xb205('0x26'),_0x27a4aa+'-'+_0x53f394+'/'+_0x3dd44d)[_0xb205('0x20')](_0xc0226e);}return null;};}function saveUpdates(_0x5bac6a){return function(_0x46986c){if(_0x46986c){return _0x46986c[_0xb205('0x27')](_0x5bac6a)[_0xb205('0x28')](function(_0x1b2d65){if(_0x1b2d65[_0xb205('0x29')]==='agent'){socket[_0xb205('0x2a')](_0xb205('0x2b')+_0x1b2d65['id'],_0x1b2d65);}return _0x1b2d65;});}return null;};}function removeEntity(_0x23f5a7){return function(_0xafcb8b){if(_0xafcb8b){return _0xafcb8b['destroy']()[_0xb205('0x28')](function(){var _0x5881d3=_0xafcb8b[_0xb205('0x2c')]({'plain':!![]});if(_0x5881d3[_0xb205('0x29')]===_0xb205('0x2d'))return;var _0x4dd7c0=[{'name':'Users','value':'user','ignore':!![]},{'name':'Agents','value':_0xb205('0x2e'),'ignore':![]},{'name':'Telephones','value':'telephone','ignore':![]}];var _0x38f41e=_(_0x4dd7c0)[_0xb205('0x2f')](_0xb205('0x30'))['map'](_0xb205('0x31'))[_0xb205('0x31')]();if(_[_0xb205('0x32')](_0x38f41e,_0x5881d3[_0xb205('0x29')])){return;}var _0x5afa0b=_[_0xb205('0x33')](_0x4dd7c0,[_0xb205('0x31'),_0x5881d3[_0xb205('0x29')]])[_0xb205('0x34')];return db[_0xb205('0x35')][_0xb205('0x36')]({'where':{'type':_0x5afa0b,'resourceId':_0x5881d3['id']}})['then'](function(){return _0xafcb8b;});})[_0xb205('0x28')](function(){_0x23f5a7[_0xb205('0x1e')](0xcc)[_0xb205('0x1f')]();});}};}function handleEntityNotFound(_0xe93298){return function(_0x36a5d8){if(!_0x36a5d8){_0xe93298[_0xb205('0x1d')](0x194);}return _0x36a5d8;};}function handleError(_0x469b74,_0x4d1172){_0x4d1172=_0x4d1172||0x1f4;return function(_0x5e2e9f){logger[_0xb205('0x18')](_0x5e2e9f[_0xb205('0x37')]);if(_0x5e2e9f[_0xb205('0x34')]){delete _0x5e2e9f[_0xb205('0x34')];}_0x469b74[_0xb205('0x1e')](_0x4d1172)[_0xb205('0x38')](_0x5e2e9f);};}exports[_0xb205('0x39')]=function(_0x324c39,_0x1d041b){var _0x27d4e8={},_0xe64f3f={'count':0x0,'rows':[]};var _0x2b9b6e=_(db[_0xb205('0x3a')][_0xb205('0x3b')])['map'](function(_0x15771e){return{'name':_0x15771e[_0xb205('0x3c')],'type':_0x15771e['type'][_0xb205('0x3d')]};})[_0xb205('0x2f')](function(_0x39edfb){return!_[_0xb205('0x32')]([_0xb205('0x3e'),'salt'],_0x39edfb[_0xb205('0x34')]);})['value']();_0x27d4e8=qs[_0xb205('0x3f')](_0x2b9b6e,_0x324c39);var _0xc04b5f={'where':_0x27d4e8[_0xb205('0x40')]};return db[_0xb205('0x3a')][_0xb205('0x24')](_0xc04b5f)[_0xb205('0x28')](function(_0x2c4f9c){_0xe64f3f['count']=_0x2c4f9c;if(_0x324c39[_0xb205('0x41')][_0xb205('0x42')]){_0x27d4e8[_0xb205('0x43')]=[{'all':!![]}];}if(_0x324c39[_0xb205('0x41')][_0xb205('0x44')]==='true'){_0x27d4e8['include']=[{'model':db[_0xb205('0x45')],'as':_0xb205('0x44')}];}if(!_[_0xb205('0x32')](_0x27d4e8['attributes'],'id')){_0x27d4e8['attributes'][_0xb205('0x46')]('id');}return db[_0xb205('0x3a')][_0xb205('0x47')](_0x27d4e8);})[_0xb205('0x28')](function(_0x18f7ec){_0xe64f3f[_0xb205('0x48')]=_0x18f7ec;if(_0x324c39[_0xb205('0x41')]['openTabs']===_0xb205('0x49')){var _0x67bd66=[];for(var _0x14ace8=0x0;_0x14ace8<_0xe64f3f[_0xb205('0x48')]['length'];_0x14ace8++){_0x67bd66[_0xb205('0x46')](get_open_tabs('chat',_0xe64f3f[_0xb205('0x48')][_0x14ace8][_0xb205('0x4a')]));_0x67bd66['push'](get_open_tabs(_0xb205('0x4b'),_0xe64f3f[_0xb205('0x48')][_0x14ace8]['dataValues']));_0x67bd66[_0xb205('0x46')](get_open_tabs(_0xb205('0x4c'),_0xe64f3f['rows'][_0x14ace8][_0xb205('0x4a')]));_0x67bd66[_0xb205('0x46')](get_open_tabs('mail',_0xe64f3f[_0xb205('0x48')][_0x14ace8][_0xb205('0x4a')]));_0x67bd66['push'](get_open_tabs(_0xb205('0x4d'),_0xe64f3f['rows'][_0x14ace8][_0xb205('0x4a')]));_0x67bd66[_0xb205('0x46')](get_open_tabs(_0xb205('0x4e'),_0xe64f3f[_0xb205('0x48')][_0x14ace8][_0xb205('0x4a')]));}return Promise[_0xb205('0x4f')](_0x67bd66)[_0xb205('0x28')](function(){return _0xe64f3f;});}else{return _0xe64f3f;}})[_0xb205('0x28')](respondWithFilteredResult(_0x1d041b,_0x27d4e8))['catch'](handleError(_0x1d041b,null));};exports[_0xb205('0x50')]=function(_0x1530fd,_0x11a1df){var _0x3e8c74={'raw':![],'where':{'id':_0x1530fd[_0xb205('0x51')]['id']}},_0x55f3bb={};_0x55f3bb[_0xb205('0x52')]=_['differenceBy'](_['keys'](db[_0xb205('0x3a')][_0xb205('0x3b')]),['password',_0xb205('0x53')]);_0x55f3bb[_0xb205('0x41')]=_[_0xb205('0x54')](_0x1530fd[_0xb205('0x41')]);_0x55f3bb[_0xb205('0x55')]=_[_0xb205('0x56')](_0x55f3bb[_0xb205('0x52')],_0x55f3bb['query']);_0x3e8c74[_0xb205('0x57')]=_[_0xb205('0x56')](_0x55f3bb[_0xb205('0x52')],qs[_0xb205('0x58')](_0x1530fd['query']['fields']));_0x3e8c74[_0xb205('0x57')]=_0x3e8c74[_0xb205('0x57')][_0xb205('0x59')]?_0x3e8c74[_0xb205('0x57')]:_0x55f3bb[_0xb205('0x52')];if(_0x1530fd[_0xb205('0x41')][_0xb205('0x42')]){_0x3e8c74['include']=[{'all':!![]}];}if(_0x1530fd[_0xb205('0x41')][_0xb205('0x44')]===_0xb205('0x49')){_0x3e8c74['include']=[{'model':db['UserSetting'],'as':_0xb205('0x44')}];}_0x3e8c74=_['merge']({},_0x3e8c74,_0x1530fd['options']);if(!_[_0xb205('0x32')](_0x3e8c74[_0xb205('0x57')],'id')){_0x3e8c74[_0xb205('0x57')][_0xb205('0x46')]('id');}return db[_0xb205('0x3a')][_0xb205('0x33')](_0x3e8c74)[_0xb205('0x28')](handleEntityNotFound(_0x11a1df,null))[_0xb205('0x28')](function(_0xf5adf1){var _0x185e36=[];values=_0xf5adf1;if(_0x1530fd[_0xb205('0x41')][_0xb205('0x5a')]==='true'){_0x185e36[_0xb205('0x46')](get_open_tabs(_0xb205('0x5b'),_0xf5adf1[_0xb205('0x4a')]));_0x185e36[_0xb205('0x46')](get_open_tabs(_0xb205('0x4b'),_0xf5adf1['dataValues']));_0x185e36[_0xb205('0x46')](get_open_tabs('openchannel',_0xf5adf1['dataValues']));_0x185e36['push'](get_open_tabs('whatsapp',_0xf5adf1[_0xb205('0x4a')]));_0x185e36[_0xb205('0x46')](get_open_tabs(_0xb205('0x4c'),_0xf5adf1[_0xb205('0x4a')]));_0x185e36[_0xb205('0x46')](get_open_tabs(_0xb205('0x5c'),_0xf5adf1[_0xb205('0x4a')]));return Promise[_0xb205('0x4f')](_0x185e36);}else{return values;}})[_0xb205('0x28')](function(){return values;})['then'](respondWithResult(_0x11a1df,null))[_0xb205('0x1c')](handleError(_0x11a1df,null));};exports[_0xb205('0x27')]=function(_0x614452,_0x4d5db6){if(_0x614452[_0xb205('0x5d')]['id']){delete _0x614452[_0xb205('0x5d')]['id'];}delete _0x614452['body'][_0xb205('0x29')];return db[_0xb205('0x3a')][_0xb205('0x33')]({'where':{'id':_0x614452[_0xb205('0x51')]['id']}})[_0xb205('0x28')](handleEntityNotFound(_0x4d5db6,null))[_0xb205('0x28')](saveUpdates(_0x614452[_0xb205('0x5d')],null))[_0xb205('0x28')](respondWithResult(_0x4d5db6,null))[_0xb205('0x1c')](handleError(_0x4d5db6,null));};exports['describe']=function(_0x4c288b,_0x4052a6){return db[_0xb205('0x3a')][_0xb205('0x5e')]()[_0xb205('0x28')](respondWithResult(_0x4052a6,null))['catch'](handleError(_0x4052a6,null));};exports[_0xb205('0x5f')]=function(_0x33d9ef,_0x948b58){return db['User'][_0xb205('0x33')]({'where':{'id':_0x33d9ef[_0xb205('0x51')]['id']}})[_0xb205('0x28')](handleEntityNotFound(_0x948b58,null))[_0xb205('0x28')](function(_0x4a1a21){if(_0x4a1a21){return _0x4a1a21[_0xb205('0x5f')](_0x33d9ef['body'][_0xb205('0x60')],_['omit'](_0x33d9ef['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x948b58,null))[_0xb205('0x1c')](handleError(_0x948b58,null));};function validateUser(_0x1a0a93){return new Promise(function(_0xe9c57b,_0x1cc63d){if(_0x1a0a93[_0xb205('0x61')])return _0xe9c57b(_0x1a0a93);return db[_0xb205('0x62')]['findById'](0x1)[_0xb205('0x28')](function(_0x380ffa){if(_0x380ffa[_0xb205('0x63')])authService[_0xb205('0x64')](_0x1a0a93[_0xb205('0x3e')]);db[_0xb205('0x3a')][_0xb205('0x65')](_0xb205('0x61'))[_0xb205('0x28')](function(_0x1c9bf3){if(_[_0xb205('0x66')](_0x1c9bf3)){_0x1a0a93[_0xb205('0x61')]=_0x380ffa['min_internal']||0x1;return;}if(_['isNil'](_0x380ffa['min_internal'])||_0x380ffa['min_internal']===_0x1c9bf3){_0x1a0a93[_0xb205('0x61')]=_0x1c9bf3+0x1;return;}if(_0x380ffa[_0xb205('0x67')]>_0x1c9bf3){_0x1a0a93['internal']=_0x380ffa['min_internal'];return;}return db['sequelize'][_0xb205('0x41')]('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[_0xb205('0x68')]['QueryTypes'][_0xb205('0x69')]})[_0xb205('0x28')](function(_0x5be301){if(_0x5be301&&_0x5be301['length']){for(var _0x383fc0=0x0,_0x58e8b7=_0x5be301[_0xb205('0x59')];_0x383fc0<_0x58e8b7&&_[_0xb205('0x66')](_0x1a0a93['internal']);_0x383fc0++){if(_0x380ffa[_0xb205('0x67')]<=_0x5be301[_0x383fc0]['from']){_0x1a0a93['internal']=_0x5be301[_0x383fc0]['from'];}else if(_0x380ffa['min_internal']>_0x5be301[_0x383fc0][_0xb205('0x6a')]&&_0x380ffa[_0xb205('0x67')]<=_0x5be301[_0x383fc0]['to']){_0x1a0a93['internal']=_0x380ffa['min_internal'];}}}if(_[_0xb205('0x66')](_0x1a0a93['internal'])){_0x1a0a93[_0xb205('0x61')]=_0x1c9bf3+0x1;}return _0xe9c57b(_0x1a0a93);});});})['catch'](function(_0x3fca63){_0x1cc63d(_0x3fca63);});});}function updateUser(_0x1c3b5d){return new Promise(function(_0x3fe003,_0x37cb8a){try{if(_0x1c3b5d[_0xb205('0x6b')]){_0x1c3b5d[_0xb205('0x6c')]=_0x1c3b5d[_0xb205('0x61')];_0x1c3b5d[_0xb205('0x6d')]={'mailbox':_0x1c3b5d[_0xb205('0x61')],'password':_0x1c3b5d['password'],'fullname':_0x1c3b5d[_0xb205('0x6e')],'email':_0x1c3b5d[_0xb205('0x6f')]};}if(_0x1c3b5d[_0xb205('0x29')]===_0xb205('0x2e')){if(!_0x1c3b5d[_0xb205('0x70')])_0x1c3b5d['permissions']=[_0xb205('0x71'),_0xb205('0x72'),_0xb205('0x73'),'113','110',_0xb205('0x74'),_0xb205('0x75'),'106',_0xb205('0x76'),'108',_0xb205('0x77'),_0xb205('0x78'),_0xb205('0x79'),_0xb205('0x7a'),'115'];}_0x3fe003(_0x1c3b5d);}catch(_0x5e8be4){_0x37cb8a(_0x5e8be4);}});}exports[_0xb205('0x7b')]=function(_0x734cf4,_0x4ec886){if(_0x734cf4[_0xb205('0x7c')]['role']===_0xb205('0x2e'))throw new Error('Unauthorized');if(_0x734cf4[_0xb205('0x5d')]['role']===_0xb205('0x7c')&&_0x734cf4[_0xb205('0x7c')][_0xb205('0x29')]!==_0xb205('0x2d')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x734cf4[_0xb205('0x5d')]['role']===_0xb205('0x2d')&&_0x734cf4[_0xb205('0x7c')][_0xb205('0x29')]!==_0xb205('0x2d')){throw new Error(_0xb205('0x7d'));}return licenseUtil[_0xb205('0x7e')]([_0x734cf4[_0xb205('0x5d')]])[_0xb205('0x28')](function(){return validateUser(_0x734cf4['body']);})[_0xb205('0x28')](function(_0x5ad5be){return updateUser(_0x5ad5be)['then'](function(_0x39f43){if(_0x39f43[_0xb205('0x29')]===_0xb205('0x2d')){_0x39f43[_0xb205('0x7f')]=_0x734cf4['user'][_0xb205('0x7f')];delete _0x39f43[_0xb205('0x80')];}return _0x39f43;});})[_0xb205('0x28')](function(_0x2fe320){return db['User'][_0xb205('0x7b')](_0x2fe320,{'include':[{'model':db[_0xb205('0x6d')],'as':_0xb205('0x6d')}]});})[_0xb205('0x28')](function(_0x142456){if(_0x734cf4[_0xb205('0x5d')][_0xb205('0x29')]===_0xb205('0x7c'))return _0x142456;if(_0x734cf4[_0xb205('0x7c')][_0xb205('0x29')]!==_0xb205('0x7c'))return _0x142456;return db['UserProfileSection'][_0xb205('0x33')]({'where':{'name':_0x142456[_0xb205('0x29')]===_0xb205('0x2e')?'Agents':_0xb205('0x81'),'userProfileId':_0x734cf4['user'][_0xb205('0x80')]},'raw':!![]})[_0xb205('0x28')](function(_0x531615){if(!_0x531615||_0x531615['autoAssociation']!=0x0)return _0x142456;return db[_0xb205('0x35')][_0xb205('0x7b')]({'name':_0x142456[_0xb205('0x34')],'resourceId':_0x142456['id'],'type':_0x531615['name'],'sectionId':_0x531615['id']},{})[_0xb205('0x28')](function(){return _0x142456;});})[_0xb205('0x1c')](function(_0x3dec69){logger[_0xb205('0x18')](_0xb205('0x82'),_0x3dec69);throw _0x3dec69;});})[_0xb205('0x28')](respondWithResult(_0x4ec886,0xc9))['catch'](handleError(_0x4ec886,null));};exports[_0xb205('0x83')]=function(_0x439cb2,_0x2e40f6){var _0x1c59e7=_0x439cb2[_0xb205('0x5d')];var _0x48d771=[];if(_0x439cb2['user'][_0xb205('0x29')]===_0xb205('0x2e'))throw new Error(_0xb205('0x84'));if(_['some'](_0x1c59e7,['role',_0xb205('0x7c')])&&_0x439cb2[_0xb205('0x7c')][_0xb205('0x29')]!==_0xb205('0x2d')){throw new Error(_0xb205('0x85'));}if(_['some'](_0x1c59e7,[_0xb205('0x29'),_0xb205('0x2d')])&&_0x439cb2[_0xb205('0x7c')][_0xb205('0x29')]!=='admin'){throw new Error(_0xb205('0x86'));}return licenseUtil[_0xb205('0x7e')](_0x1c59e7)[_0xb205('0x28')](function(){return validateUser(_0x1c59e7[0x0]);})[_0xb205('0x28')](function(){for(var _0x4a1e3d=0x1;_0x4a1e3d<_0x1c59e7[_0xb205('0x59')];_0x4a1e3d++){var _0x4d5de2=_0x1c59e7[_0x4a1e3d-0x1][_0xb205('0x61')];if(!_0x1c59e7[_0x4a1e3d][_0xb205('0x61')])_0x1c59e7[_0x4a1e3d][_0xb205('0x61')]=_0x4d5de2+0x1;_0x48d771[_0xb205('0x46')](validateUser(_0x1c59e7[_0x4a1e3d]));}return Promise['all'](_0x48d771);})['then'](function(){_0x48d771=[];for(var _0x24bda0=0x0;_0x24bda0<_0x1c59e7[_0xb205('0x59')];_0x24bda0++){_0x48d771[_0xb205('0x46')](updateUser(_0x1c59e7[_0x24bda0]));}return Promise[_0xb205('0x4f')](_0x48d771);})['then'](function(){_0x48d771=_0x1c59e7[_0xb205('0x87')](function(_0x443e43){return db[_0xb205('0x3a')][_0xb205('0x7b')](_0x443e43,{'include':[{'model':db[_0xb205('0x6d')],'as':_0xb205('0x6d')}]})[_0xb205('0x28')](function(_0x40af1c){_0x443e43['id']=_0x40af1c['id'];return _0x443e43;});});return Promise['all'](_0x48d771);})[_0xb205('0x28')](function(_0x3b2534){if(_0x439cb2[_0xb205('0x5d')][_0xb205('0x29')]===_0xb205('0x7c'))return _0x3b2534;if(_0x439cb2[_0xb205('0x7c')][_0xb205('0x29')]!==_0xb205('0x7c'))return _0x3b2534;var _0x3a854d=_[_0xb205('0x88')](_0x3b2534,function(_0x58c608){return _0x58c608[_0xb205('0x29')]===_0xb205('0x2e')||_0x58c608[_0xb205('0x29')]===_0xb205('0x89');});if(!_0x3a854d)return _0x3b2534;return db['UserProfileSection'][_0xb205('0x47')]({'where':{'name':{'$or':[_0xb205('0x8a'),'Telephones']},'userProfileId':_0x439cb2['user']['userProfileId']},'raw':!![]})[_0xb205('0x28')](function(_0x564b6e){if(_['isEmpty'](_0x564b6e)||!_[_0xb205('0x88')](_0x564b6e,[_0xb205('0x8b'),0x0]))return _0x3b2534;_0x48d771=[];var _0x440cd7=_(_0x564b6e)[_0xb205('0x87')](function(_0x5edaf2){if(_0x5edaf2[_0xb205('0x8b')]===0x1)return;return _0x5edaf2[_0xb205('0x34')]==='Agents'?_0xb205('0x2e'):'telephone';})[_0xb205('0x8c')]()[_0xb205('0x31')]();for(var _0x342550=0x0;_0x342550<_0x3b2534['length'];_0x342550++){if(!_['includes'](_0x440cd7,_0x3b2534[_0x342550][_0xb205('0x29')]))return;var _0xda4c78=_0x3b2534[_0x342550]['role']==='agent'?_0xb205('0x8a'):_0xb205('0x81');_0x48d771[_0xb205('0x46')](db[_0xb205('0x35')][_0xb205('0x7b')]({'name':_0x3b2534[_0x342550]['name'],'resourceId':_0x3b2534[_0x342550]['id'],'type':_0xda4c78,'sectionId':_[_0xb205('0x33')](_0x564b6e,['name',_0xda4c78])['id']},{}));}return Promise['all'](_0x48d771);});})[_0xb205('0x28')](respondWithResult(_0x2e40f6,0xc9))[_0xb205('0x1c')](handleError(_0x2e40f6,null));};exports[_0xb205('0x8d')]=function(_0x2881ff,_0x429807){if(_0x2881ff[_0xb205('0x5d')]['id']){delete _0x2881ff[_0xb205('0x5d')]['id'];}return db[_0xb205('0x3a')][_0xb205('0x33')]({'where':{'id':_0x2881ff[_0xb205('0x51')]['id']}})['then'](function(_0x4fb0f6){if(!_0x4fb0f6)return null;if(_0x4fb0f6['id']===_0x2881ff['user']['id']){if(!_0x2881ff[_0xb205('0x5d')][_0xb205('0x8e')]||!_0x2881ff[_0xb205('0x5d')]['newPassword']){throw new db['Sequelize'][(_0xb205('0x8f'))](_0xb205('0x90'));}if(!_0x4fb0f6[_0xb205('0x91')](_0x2881ff[_0xb205('0x5d')][_0xb205('0x8e')])){throw new db[(_0xb205('0x92'))][(_0xb205('0x8f'))](_0xb205('0x93'));}if(_0x2881ff['body'][_0xb205('0x8e')]===_0x2881ff['body'][_0xb205('0x94')]){throw new db['Sequelize'][(_0xb205('0x8f'))](_0xb205('0x95'));}}else if(_0x2881ff[_0xb205('0x7c')][_0xb205('0x29')]===_0xb205('0x2d')){if(!_0x2881ff[_0xb205('0x5d')][_0xb205('0x94')]){throw new db[(_0xb205('0x92'))][(_0xb205('0x8f'))](_0xb205('0x96'));}}else if(_0x2881ff['user'][_0xb205('0x29')]==='user'){if(!_0x2881ff['body'][_0xb205('0x94')]){throw new db[(_0xb205('0x92'))]['ValidationError'](_0xb205('0x96'));}if(_0x4fb0f6['role']!=='agent'){throw new db[(_0xb205('0x92'))][(_0xb205('0x8f'))](_0xb205('0x84'));}}else{throw new db[(_0xb205('0x92'))][(_0xb205('0x8f'))]('Unauthorized');}return _0x4fb0f6;})['then'](handleEntityNotFound(_0x429807,null))['then'](function(_0x4d00a3){return db[_0xb205('0x62')][_0xb205('0x97')]({'attributes':['id','securePassword',_0xb205('0x98'),_0xb205('0x99')]})['then'](function(_0x15c44e){if(_0x15c44e[_0xb205('0x63')])authService[_0xb205('0x64')](_0x2881ff[_0xb205('0x5d')]['newPassword']);if(!_0x15c44e[_0xb205('0x98')]||!_0x4d00a3[_0xb205('0x9a')])return _0x4d00a3;authService[_0xb205('0x9b')](_0x2881ff[_0xb205('0x5d')][_0xb205('0x94')],_0x4d00a3[_0xb205('0x9a')],_0x15c44e[_0xb205('0x99')]);return _0x4d00a3;})['then'](saveUpdates({'password':_0x2881ff[_0xb205('0x5d')]['newPassword'],'passwordResetAt':_0x2881ff[_0xb205('0x7c')]['id']==_0x2881ff['params']['id']?moment():null,'previousPasswords':authService[_0xb205('0x9c')](_0x2881ff[_0xb205('0x5d')]['newPassword'],_0x4d00a3[_0xb205('0x9a')])},null));})[_0xb205('0x28')](respondWithResult(_0x429807,null))[_0xb205('0x1c')](handleError(_0x429807,null));};exports[_0xb205('0x9d')]=function(_0x101333,_0x1f931b){var _0x36bce9=_0x101333[_0xb205('0x5d')][_0xb205('0x9e')];return db[_0xb205('0x3a')][_0xb205('0x33')]({'where':{'id':_0x101333[_0xb205('0x51')]['id']},'attributes':['id',_0xb205('0x34'),_0xb205('0x29'),_0xb205('0x9f'),_0xb205('0xa0'),_0xb205('0xa1'),_0xb205('0xa2')]})['then'](handleEntityNotFound(_0x1f931b,null))[_0xb205('0x28')](function(_0x7562ae){if(_0x7562ae){if(!utils[_0xb205('0xa3')](_0x36bce9)){throw new db[(_0xb205('0x92'))][(_0xb205('0x8f'))]('Unknown\x20channel');}return _0x7562ae[_0xb205('0xa4')+_[_0xb205('0xa5')](_0x36bce9[_0xb205('0xa6')]())+'Queues'](_0x101333[_0xb205('0x5d')][_0xb205('0x60')],{'penalty':_0x101333[_0xb205('0x5d')][_0xb205('0xa7')]||0x0})[_0xb205('0xa8')](function(_0x4440f6){for(var _0x19e714=0x0;_0x19e714<_0x101333[_0xb205('0x5d')][_0xb205('0x60')][_0xb205('0x59')];_0x19e714+=0x1){var _0x174087={'UserId':Number(_0x101333[_0xb205('0x51')]['id'])};_0x174087[_[_0xb205('0xa5')](_0x36bce9['toLowerCase']())+'QueueId']=Number(_0x101333['body'][_0xb205('0x60')][_0x19e714]);socket['emit'](_0xb205('0x7c')+_[_0xb205('0xa5')](_0x36bce9[_0xb205('0xa6')]())+_0xb205('0xa9'),_0x174087);}return _0x4440f6;})[_0xb205('0x28')](function(){if(_0x36bce9===_0xb205('0xaa')){return db[_0xb205('0xab')][_0xb205('0x47')]({'where':{'id':_0x101333[_0xb205('0x5d')][_0xb205('0x60')]||[]},'raw':!![],'attributes':['id',_0xb205('0x34')]});}})[_0xb205('0x28')](function(_0x4ebfe8){var _0x702ab8=_0x7562ae[_0xb205('0x2c')]({'plain':!![]});var _0x36142f=[];if(_0x36bce9==='voice'&&_0x702ab8[_0xb205('0x29')]==='agent'&&_0x702ab8[_0xb205('0x9f')]){for(let _0x4948cf=0x0;_0x4948cf<_0x4ebfe8['length'];_0x4948cf+=0x1){_0x36142f['push']({'membername':_0x702ab8[_0xb205('0x34')],'UserId':_0x702ab8['id'],'queue_name':_0x4ebfe8[_0x4948cf]['name'],'VoiceQueueId':_0x4ebfe8[_0x4948cf]['id'],'interface':_[_0xb205('0x66')](_0x702ab8[_0xb205('0xa2')])?util[_0xb205('0xac')](_0xb205('0xad'),_0x702ab8[_0xb205('0x34')]):_0x702ab8['interface'],'paused':_0x702ab8['voicePause']||![],'penalty':_0x101333['body']['penalty']||0x0});}return Promise[_0xb205('0x4f')](_0x36142f[_0xb205('0x87')](function(_0x31b34e){return db[_0xb205('0xae')][_0xb205('0xaf')](_0x31b34e);}));}return _0x7562ae;});}})[_0xb205('0x28')](respondWithStatusCode(_0x1f931b,null))[_0xb205('0x1c')](handleError(_0x1f931b,null));};exports['removeQueues']=function(_0x23931e,_0x54ebc2){var _0x23ae69,_0x6d6b14;return db['User'][_0xb205('0x33')]({'where':{'id':_0x23931e[_0xb205('0x51')]['id']},'attributes':['id',_0xb205('0x34'),_0xb205('0x29')]})[_0xb205('0x28')](handleEntityNotFound(_0x54ebc2,null))[_0xb205('0x28')](function(_0x4490ce){if(_0x4490ce){_0x23ae69=_0x4490ce;if(!_0x23931e['query'][_0xb205('0x9e')]||!utils[_0xb205('0xa3')](_0x23931e['query']['channel'])){throw new db[(_0xb205('0x92'))]['ValidationError'](_0xb205('0xb0'));}return _0x4490ce['remove'+_[_0xb205('0xa5')](_0x23931e['query'][_0xb205('0x9e')][_0xb205('0xa6')]())+_0xb205('0xb1')](_0x23931e[_0xb205('0x41')][_0xb205('0x60')]);}})[_0xb205('0x28')](function(_0x308c4b){if(_[_0xb205('0xb2')](_0x23931e[_0xb205('0x41')]['ids'])){for(var _0x59004b=0x0;_0x59004b<_0x23931e['query'][_0xb205('0x60')][_0xb205('0x59')];_0x59004b+=0x1){_0x6d6b14={'UserId':Number(_0x23931e[_0xb205('0x51')]['id'])};_0x6d6b14[_['capitalize'](_0x23931e['query'][_0xb205('0x9e')][_0xb205('0xa6')]())+_0xb205('0xb3')]=Number(_0x23931e['query'][_0xb205('0x60')][_0x59004b]);socket[_0xb205('0x2a')](_0xb205('0x7c')+_[_0xb205('0xa5')](_0x23931e[_0xb205('0x41')]['channel'][_0xb205('0xa6')]())+_0xb205('0xb4'),_0x6d6b14);}}else{_0x6d6b14={'UserId':Number(_0x23931e[_0xb205('0x51')]['id'])};_0x6d6b14[_[_0xb205('0xa5')](_0x23931e[_0xb205('0x41')][_0xb205('0x9e')][_0xb205('0xa6')]())+_0xb205('0xb3')]=Number(_0x23931e[_0xb205('0x41')][_0xb205('0x60')]);socket[_0xb205('0x2a')](_0xb205('0x7c')+_['capitalize'](_0x23931e[_0xb205('0x41')][_0xb205('0x9e')][_0xb205('0xa6')]())+'Queue:remove',_0x6d6b14);}return _0x308c4b;})[_0xb205('0x28')](function(){if(_0x23931e['query']['channel']==='voice'){return db[_0xb205('0xae')]['destroy']({'where':{'UserId':_0x23931e[_0xb205('0x51')]['id'],'VoiceQueueId':_0x23931e['query'][_0xb205('0x60')]},'individualHooks':!![]})[_0xb205('0x28')](function(){return _0x23ae69;});}return _0x23ae69;})[_0xb205('0x28')](respondWithStatusCode(_0x54ebc2,null))[_0xb205('0x1c')](handleError(_0x54ebc2,null));};exports[_0xb205('0xb5')]=function(_0x57f0b5,_0x13d720){_0x57f0b5[_0xb205('0x5d')][_0xb205('0xb6')]=_0x57f0b5[_0xb205('0xb7')][_0xb205('0xb8')];return db[_0xb205('0x3a')][_0xb205('0x33')]({'where':{'id':_0x57f0b5[_0xb205('0x51')]['id']}})[_0xb205('0x28')](handleEntityNotFound(_0x13d720,null))[_0xb205('0x28')](saveUpdates(_0x57f0b5[_0xb205('0x5d')],null))[_0xb205('0x28')](respondWithResult(_0x13d720,null))[_0xb205('0x1c')](handleError(_0x13d720,null));};exports[_0xb205('0xb9')]=function(_0x24b05f,_0x21c485){var _0x3b06b3=path['join'](config[_0xb205('0xba')],_0xb205('0xbb'));return db['User'][_0xb205('0x33')]({'where':{'id':_0x24b05f['params']['id']},'attributes':['id',_0xb205('0xb6')],'raw':!![]})[_0xb205('0x28')](handleEntityNotFound(_0x21c485,null))[_0xb205('0x28')](function(_0x4229a9){if(_0x4229a9){if(_[_0xb205('0x66')](_0x4229a9['userpic'])){return _0x21c485[_0xb205('0xbc')](_0x3b06b3);}else{if(!fs['existsSync'](path['join'](config[_0xb205('0xba')],_0xb205('0xbd'),_0x4229a9['userpic']))){return _0x21c485[_0xb205('0xbc')](_0x3b06b3);}return _0x21c485[_0xb205('0xbc')](path[_0xb205('0xbe')](config[_0xb205('0xba')],_0xb205('0xbd'),_0x4229a9[_0xb205('0xb6')]));}}})[_0xb205('0x1c')](handleError(_0x21c485,null));};exports[_0xb205('0xbf')]=function(_0x4e678a,_0xd58f4d){return db[_0xb205('0x3a')][_0xb205('0x33')]({'where':{'id':_0x4e678a[_0xb205('0x51')]['id']},'attributes':['id']})[_0xb205('0x28')](handleEntityNotFound(_0xd58f4d,null))['then'](function(_0x13cb6e){var _0x21f04d=[];values=_0x13cb6e[_0xb205('0x4a')];_0x21f04d[_0xb205('0x46')](get_open_tabs(_0xb205('0x5b'),_0x13cb6e[_0xb205('0x4a')]));_0x21f04d[_0xb205('0x46')](get_open_tabs(_0xb205('0x4b'),_0x13cb6e[_0xb205('0x4a')]));_0x21f04d['push'](get_open_tabs(_0xb205('0x4d'),_0x13cb6e['dataValues']));_0x21f04d[_0xb205('0x46')](get_open_tabs(_0xb205('0x4e'),_0x13cb6e['dataValues']));_0x21f04d[_0xb205('0x46')](get_open_tabs(_0xb205('0x4c'),_0x13cb6e[_0xb205('0x4a')]));_0x21f04d[_0xb205('0x46')](get_open_tabs(_0xb205('0x5c'),_0x13cb6e[_0xb205('0x4a')]));return Promise['all'](_0x21f04d);})[_0xb205('0x28')](function(_0x43dd24){if(_0x43dd24){var _0x4f82b4=_['map'](values[_0xb205('0xc0')],function(_0x176cfe){return{'channel':_0xb205('0xc1'),'id':_0x176cfe['id'],'createdAt':_0x176cfe[_0xb205('0xc2')]};});var _0x1c6ca9=_[_0xb205('0x87')](values[_0xb205('0xc3')],function(_0xcec013){return{'channel':_0xb205('0xc4'),'id':_0xcec013['id'],'createdAt':_0xcec013['createdAt']};});var _0x436deb=_[_0xb205('0x87')](values[_0xb205('0xc5')],function(_0x164f52){return{'channel':'OPENCHANNEL','id':_0x164f52['id'],'createdAt':_0x164f52[_0xb205('0xc2')]};});var _0x259d09=_['map'](values[_0xb205('0xc6')],function(_0x28f356){return{'channel':'MAIL','id':_0x28f356['id'],'createdAt':_0x28f356[_0xb205('0xc2')]};});var _0x472369=_[_0xb205('0x87')](values[_0xb205('0xc7')],function(_0x198e40){return{'channel':_0xb205('0xc8'),'id':_0x198e40['id'],'createdAt':_0x198e40[_0xb205('0xc2')]};});var _0x17830c=_[_0xb205('0x87')](values[_0xb205('0xc9')],function(_0x4afae2){return{'channel':_0xb205('0xca'),'id':_0x4afae2['id'],'createdAt':_0x4afae2['createdAt']};});var _0x1c2700=_[_0xb205('0xcb')](_0x4f82b4,_0x1c6ca9,_0x436deb,_0x259d09,_0x472369,_0x17830c);var _0xef4cc2={'count':_0x1c2700[_0xb205('0x59')],'rows':_0x1c2700};return _0xef4cc2;}else return null;})['then'](respondWithResult(_0xd58f4d,null))[_0xb205('0x1c')](handleError(_0xd58f4d,null));};exports[_0xb205('0xcc')]=function(_0x3cf52f,_0xbd522e){var _0x46df9d={};var _0x5bb61d={};var _0x2efece;var _0x444fcb;return db[_0xb205('0x3a')][_0xb205('0x97')]({'where':{'id':_0x3cf52f[_0xb205('0x51')]['id']}})[_0xb205('0x28')](handleEntityNotFound(_0xbd522e,null))[_0xb205('0x28')](function(_0x2678e0){if(_0x2678e0){_0x2efece=_0x2678e0;_0x5bb61d[_0xb205('0x52')]=_['keys'](db[_0xb205('0xcd')][_0xb205('0x3b')]);_0x5bb61d[_0xb205('0x41')]=_['keys'](_0x3cf52f[_0xb205('0x41')]);_0x5bb61d[_0xb205('0x55')]=_[_0xb205('0x56')](_0x5bb61d[_0xb205('0x52')],_0x5bb61d[_0xb205('0x41')]);_0x46df9d[_0xb205('0x57')]=_[_0xb205('0x56')](_0x5bb61d[_0xb205('0x52')],qs[_0xb205('0x58')](_0x3cf52f['query'][_0xb205('0x58')]));_0x46df9d[_0xb205('0x57')]=_0x46df9d[_0xb205('0x57')][_0xb205('0x59')]?_0x46df9d[_0xb205('0x57')]:_0x5bb61d['model'];_0x46df9d[_0xb205('0xce')]=qs['sort'](_0x3cf52f['query'][_0xb205('0xcf')]);_0x46df9d[_0xb205('0x40')]=qs[_0xb205('0x55')](_[_0xb205('0xd0')](_0x3cf52f[_0xb205('0x41')],_0x5bb61d['filters']));if(_0x3cf52f[_0xb205('0x41')]['filter']){_0x46df9d[_0xb205('0x40')]=_[_0xb205('0xd1')](_0x46df9d['where'],{'$or':_['map'](_0x46df9d[_0xb205('0x57')],function(_0x710872){var _0x2a2742={};_0x2a2742[_0x710872]={'$like':'%'+_0x3cf52f[_0xb205('0x41')][_0xb205('0x2f')]+'%'};return _0x2a2742;})});}_0x46df9d=_[_0xb205('0xd1')]({},_0x46df9d,_0x3cf52f[_0xb205('0xd2')]);return _0x2efece[_0xb205('0xcc')](_0x46df9d);}})['then'](function(_0x319590){if(_0x319590){_0x444fcb=_0x319590[_0xb205('0x59')];if(_0x3cf52f[_0xb205('0x41')][_0xb205('0xd3')](_0xb205('0x42'))){_0x46df9d[_0xb205('0x43')]=[{'model':db[_0xb205('0xd4')],'as':'List','required':![]},{'model':db['Tag'],'as':_0xb205('0xd5'),'attributes':['id','name',_0xb205('0xd6')],'where':_0x3cf52f[_0xb205('0x41')][_0xb205('0xd7')]?{'id':_0x3cf52f[_0xb205('0x41')][_0xb205('0xd7')]}:undefined,'required':_0x3cf52f[_0xb205('0x41')]['tag']?!![]:![]}];}if(!_0x3cf52f[_0xb205('0x41')]['hasOwnProperty']('nolimit')){_0x46df9d[_0xb205('0x23')]=qs[_0xb205('0x23')](_0x3cf52f['query'][_0xb205('0x23')]);_0x46df9d['offset']=qs['offset'](_0x3cf52f[_0xb205('0x41')][_0xb205('0x21')]);}return _0x2efece[_0xb205('0xcc')](_0x46df9d);}})[_0xb205('0x28')](function(_0x308466){if(_0x308466){return _0x308466?{'count':_0x444fcb,'rows':_0x308466}:null;}})['then'](respondWithResult(_0xbd522e,null))['catch'](handleError(_0xbd522e,null));};exports[_0xb205('0xd8')]=function(_0x524bd7,_0x160986){var _0x14fc9a;var _0x339b1a={};var _0x283af7;return db['User'][_0xb205('0x97')]({'where':{'id':_0x524bd7['params']['id']},'attributes':['id',_0xb205('0x34'),_0xb205('0x29')]})[_0xb205('0x28')](handleEntityNotFound(_0x160986,null))['then'](function(_0x54ca00){if(!utils[_0xb205('0xa3')](_0x524bd7[_0xb205('0x41')][_0xb205('0x9e')])){throw new db[(_0xb205('0x92'))][(_0xb205('0x8f'))](_0xb205('0xb0'));}_0x14fc9a=_0x54ca00;var _0x4be3a7={};_0x4be3a7[_0xb205('0x52')]=_[_0xb205('0x54')](db[_['capitalize'](_0x524bd7[_0xb205('0x41')][_0xb205('0x9e')])+_0xb205('0xd9')][_0xb205('0x3b')]);_0x4be3a7[_0xb205('0x41')]=_[_0xb205('0x54')](_0x524bd7['query']);_0x4be3a7[_0xb205('0x55')]=_[_0xb205('0x56')](_0x4be3a7[_0xb205('0x52')],_0x4be3a7['query']);_0x339b1a[_0xb205('0x57')]=_[_0xb205('0x56')](_0x4be3a7[_0xb205('0x52')],qs[_0xb205('0x58')](_0x524bd7['query'][_0xb205('0x58')]));_0x339b1a['attributes']=_0x339b1a[_0xb205('0x57')][_0xb205('0x59')]?_0x339b1a[_0xb205('0x57')]:_0x4be3a7['model'];_0x339b1a[_0xb205('0xce')]=qs[_0xb205('0xcf')](_0x524bd7[_0xb205('0x41')][_0xb205('0xcf')]);_0x339b1a[_0xb205('0x40')]=qs[_0xb205('0x55')](_[_0xb205('0xd0')](_0x524bd7[_0xb205('0x41')],_0x4be3a7[_0xb205('0x55')]));if(_0x524bd7['query'][_0xb205('0x2f')]){_0x339b1a[_0xb205('0x40')]=_[_0xb205('0xd1')](_0x339b1a[_0xb205('0x40')],{'$or':_[_0xb205('0x87')](_0x339b1a[_0xb205('0x57')],function(_0x5117c7){var _0x580a2d={};_0x580a2d[_0x5117c7]={'$like':'%'+_0x524bd7[_0xb205('0x41')][_0xb205('0x2f')]+'%'};return _0x580a2d;})});}_0x339b1a=_[_0xb205('0xd1')]({},_0x339b1a,_0x524bd7['options']);switch(_0x14fc9a[_0xb205('0x29')]){case _0xb205('0x2d'):return db[_[_0xb205('0xa5')](_0x524bd7['query'][_0xb205('0x9e')])+_0xb205('0xd9')]['findAll'](_0x339b1a);case _0xb205('0x7c'):case _0xb205('0x2e'):return _0x14fc9a[_0xb205('0x2c')+_[_0xb205('0xa5')](_0x524bd7['query'][_0xb205('0x9e')])+_0xb205('0xb1')](_0x339b1a);default:throw new db[(_0xb205('0x92'))]['ValidationError'](_0xb205('0xda'));}})['then'](function(_0x4e0b1b){_0x283af7=_0x4e0b1b['length'];if(!_0x524bd7[_0xb205('0x41')][_0xb205('0xd3')](_0xb205('0xdb'))){_0x339b1a[_0xb205('0x23')]=qs[_0xb205('0x23')](_0x524bd7[_0xb205('0x41')]['limit']);_0x339b1a[_0xb205('0x21')]=qs[_0xb205('0x21')](_0x524bd7['query'][_0xb205('0x21')]);}switch(_0x14fc9a[_0xb205('0x29')]){case _0xb205('0x2d'):return db[_['capitalize'](_0x524bd7[_0xb205('0x41')][_0xb205('0x9e')])+'Queue']['findAll'](_0x339b1a);case _0xb205('0x7c'):case _0xb205('0x2e'):return _0x14fc9a['get'+_[_0xb205('0xa5')](_0x524bd7[_0xb205('0x41')][_0xb205('0x9e')])+_0xb205('0xb1')](_0x339b1a);}})['then'](function(_0x1566c9){return{'count':_0x283af7,'rows':_0x1566c9};})[_0xb205('0x28')](respondWithResult(_0x160986,null))[_0xb205('0x1c')](handleError(_0x160986,null));};exports[_0xb205('0xdc')]=function(_0x4719fe,_0x5b3ee2){var _0x473c7c={};var _0x1bb5d8={};var _0x1116ba;var _0x317388;return db[_0xb205('0x3a')][_0xb205('0x97')]({'where':{'id':_0x4719fe[_0xb205('0x51')]['id']}})[_0xb205('0x28')](handleEntityNotFound(_0x5b3ee2,null))[_0xb205('0x28')](function(_0xe1c849){if(_0xe1c849){_0x1116ba=_0xe1c849;_0x1bb5d8[_0xb205('0x52')]=_['keys'](db[_0xb205('0xae')][_0xb205('0x3b')]);_0x1bb5d8[_0xb205('0x41')]=_[_0xb205('0x54')](_0x4719fe['query']);_0x1bb5d8[_0xb205('0x55')]=_[_0xb205('0x56')](_0x1bb5d8[_0xb205('0x52')],_0x1bb5d8[_0xb205('0x41')]);_0x473c7c[_0xb205('0x57')]=_['intersection'](_0x1bb5d8[_0xb205('0x52')],qs[_0xb205('0x58')](_0x4719fe[_0xb205('0x41')][_0xb205('0x58')]));_0x473c7c[_0xb205('0x57')]=_0x473c7c['attributes'][_0xb205('0x59')]?_0x473c7c[_0xb205('0x57')]:_0x1bb5d8['model'];_0x473c7c['order']=qs['sort'](_0x4719fe[_0xb205('0x41')][_0xb205('0xcf')]);_0x473c7c[_0xb205('0x40')]=qs[_0xb205('0x55')](_[_0xb205('0xd0')](_0x4719fe[_0xb205('0x41')],_0x1bb5d8[_0xb205('0x55')]));if(_0x4719fe['query']['filter']){_0x473c7c['where']=_['merge'](_0x473c7c['where'],{'$or':_[_0xb205('0x87')](_0x473c7c['attributes'],function(_0x3e874c){var _0x3e9e14={};_0x3e9e14[_0x3e874c]={'$like':'%'+_0x4719fe[_0xb205('0x41')][_0xb205('0x2f')]+'%'};return _0x3e9e14;})});}_0x473c7c=_[_0xb205('0xd1')]({},_0x473c7c,_0x4719fe[_0xb205('0xd2')]);return _0x1116ba[_0xb205('0xdc')](_0x473c7c);}})[_0xb205('0x28')](function(_0x51ffb0){if(_0x51ffb0){_0x317388=_0x51ffb0[_0xb205('0x59')];if(!_0x4719fe[_0xb205('0x41')]['hasOwnProperty'](_0xb205('0xdb'))){_0x473c7c[_0xb205('0x23')]=qs[_0xb205('0x23')](_0x4719fe[_0xb205('0x41')][_0xb205('0x23')]);_0x473c7c['offset']=qs[_0xb205('0x21')](_0x4719fe[_0xb205('0x41')][_0xb205('0x21')]);}return _0x1116ba['getVoiceQueuesRt'](_0x473c7c);}})['then'](function(_0x2dbfd5){if(_0x2dbfd5){return _0x2dbfd5?{'count':_0x317388,'rows':_0x2dbfd5}:null;}})[_0xb205('0x28')](respondWithResult(_0x5b3ee2,null))['catch'](handleError(_0x5b3ee2,null));};exports['getGroups']=function(_0x36ca15,_0x3bcf01){var _0x5dd9d0={};var _0x5b3a59={};var _0x4a3bf1;var _0x26e1e8;return db[_0xb205('0x3a')]['findOne']({'where':{'id':_0x36ca15['params']['id']}})['then'](handleEntityNotFound(_0x3bcf01,null))['then'](function(_0x105933){if(_0x105933){_0x4a3bf1=_0x105933;_0x5b3a59[_0xb205('0x52')]=_['keys'](db[_0xb205('0xdd')][_0xb205('0x3b')]);_0x5b3a59[_0xb205('0x41')]=_[_0xb205('0x54')](_0x36ca15[_0xb205('0x41')]);_0x5b3a59[_0xb205('0x55')]=_[_0xb205('0x56')](_0x5b3a59[_0xb205('0x52')],_0x5b3a59[_0xb205('0x41')]);_0x5dd9d0[_0xb205('0x57')]=_[_0xb205('0x56')](_0x5b3a59['model'],qs[_0xb205('0x58')](_0x36ca15['query'][_0xb205('0x58')]));_0x5dd9d0[_0xb205('0x57')]=_0x5dd9d0[_0xb205('0x57')][_0xb205('0x59')]?_0x5dd9d0['attributes']:_0x5b3a59[_0xb205('0x52')];_0x5dd9d0[_0xb205('0xce')]=qs['sort'](_0x36ca15[_0xb205('0x41')][_0xb205('0xcf')]);_0x5dd9d0[_0xb205('0x40')]=qs['filters'](_['pick'](_0x36ca15[_0xb205('0x41')],_0x5b3a59[_0xb205('0x55')]));if(_0x36ca15['query'][_0xb205('0x2f')]){_0x5dd9d0[_0xb205('0x40')]=_['merge'](_0x5dd9d0['where'],{'$or':_[_0xb205('0x87')](_0x5dd9d0[_0xb205('0x57')],function(_0x4c7850){var _0x50c5b1={};_0x50c5b1[_0x4c7850]={'$like':'%'+_0x36ca15[_0xb205('0x41')][_0xb205('0x2f')]+'%'};return _0x50c5b1;})});}_0x5dd9d0=_[_0xb205('0xd1')]({},_0x5dd9d0,_0x36ca15[_0xb205('0xd2')]);return _0x4a3bf1[_0xb205('0xde')](_0x5dd9d0);}})[_0xb205('0x28')](function(_0x4c8c68){if(_0x4c8c68){_0x26e1e8=_0x4c8c68['length'];if(!_0x36ca15[_0xb205('0x41')][_0xb205('0xd3')](_0xb205('0xdb'))){_0x5dd9d0[_0xb205('0x23')]=qs[_0xb205('0x23')](_0x36ca15[_0xb205('0x41')][_0xb205('0x23')]);_0x5dd9d0[_0xb205('0x21')]=qs['offset'](_0x36ca15[_0xb205('0x41')]['offset']);}return _0x4a3bf1['getGroups'](_0x5dd9d0);}})[_0xb205('0x28')](function(_0x122058){if(_0x122058){return _0x122058?{'count':_0x26e1e8,'rows':_0x122058}:null;}})[_0xb205('0x28')](respondWithResult(_0x3bcf01,null))[_0xb205('0x1c')](handleError(_0x3bcf01,null));};exports[_0xb205('0xdf')]=function(_0x5e490b,_0x1894d9){var _0x35de30={'raw':!![],'where':{}};var _0x326a2c={};var _0x9156f4={'count':0x0,'rows':[]};return db['User'][_0xb205('0x97')]({'where':{'id':_0x5e490b[_0xb205('0x51')]['id']}})['then'](handleEntityNotFound(_0x1894d9,null))['then'](function(_0x50ddb5){if(_0x50ddb5){_0x326a2c[_0xb205('0x52')]=_[_0xb205('0x54')](db['VoiceRecording'][_0xb205('0x3b')]);_0x326a2c[_0xb205('0x41')]=_[_0xb205('0x54')](_0x5e490b['query']);_0x326a2c[_0xb205('0x55')]=_[_0xb205('0x56')](_0x326a2c[_0xb205('0x52')],_0x326a2c[_0xb205('0x41')]);_0x35de30['attributes']=_[_0xb205('0x56')](_0x326a2c[_0xb205('0x52')],qs['fields'](_0x5e490b['query']['fields']));_0x35de30['attributes']=_0x35de30[_0xb205('0x57')][_0xb205('0x59')]?_0x35de30[_0xb205('0x57')]:_0x326a2c[_0xb205('0x52')];if(!_0x5e490b[_0xb205('0x41')][_0xb205('0xd3')](_0xb205('0xdb'))){_0x35de30[_0xb205('0x23')]=qs[_0xb205('0x23')](_0x5e490b[_0xb205('0x41')][_0xb205('0x23')]);_0x35de30[_0xb205('0x21')]=qs[_0xb205('0x21')](_0x5e490b['query'][_0xb205('0x21')]);}_0x35de30[_0xb205('0xce')]=qs[_0xb205('0xcf')](_0x5e490b[_0xb205('0x41')][_0xb205('0xcf')]);_0x35de30[_0xb205('0x40')]=qs[_0xb205('0x55')](_[_0xb205('0xd0')](_0x5e490b[_0xb205('0x41')],_0x326a2c[_0xb205('0x55')]));_0x35de30[_0xb205('0x40')][_0xb205('0xe0')]=_0x50ddb5['id'];if(_0x5e490b[_0xb205('0x41')]['filter']){_0x35de30[_0xb205('0x40')]=_[_0xb205('0xd1')](_0x35de30[_0xb205('0x40')],{'$or':_['map'](_0x35de30['attributes'],function(_0x567d5a){var _0x4d6808={};_0x4d6808[_0x567d5a]={'$like':'%'+_0x5e490b['query']['filter']+'%'};return _0x4d6808;})});}_0x35de30=_[_0xb205('0xd1')]({},_0x35de30,_0x5e490b[_0xb205('0xd2')]);return db[_0xb205('0xe1')]['count']({'where':_0x35de30['where']})[_0xb205('0x28')](function(_0x413ed5){_0x9156f4[_0xb205('0x24')]=_0x413ed5;if(_0x5e490b['query'][_0xb205('0x42')]){_0x35de30['include']=[{'all':!![]}];}return db[_0xb205('0xe1')][_0xb205('0x47')](_0x35de30);})[_0xb205('0x28')](function(_0x372947){_0x9156f4[_0xb205('0x48')]=_0x372947;return _0x9156f4;});}})['then'](respondWithFilteredResult(_0x1894d9,_0x35de30))[_0xb205('0x1c')](handleError(_0x1894d9,null));};exports[_0xb205('0xe2')]=function(_0x7b5ed,_0x4743af){var _0x46a8bd={'raw':!![],'where':{}};var _0x290ed4={};var _0x5c7bce={'count':0x0,'rows':[]};return db['User'][_0xb205('0x97')]({'where':{'id':_0x7b5ed['params']['id']}})['then'](handleEntityNotFound(_0x4743af,null))[_0xb205('0x28')](function(_0x212349){if(_0x212349){_0x290ed4['model']=_[_0xb205('0x54')](db[_0xb205('0xe3')][_0xb205('0x3b')]);_0x290ed4[_0xb205('0x41')]=_[_0xb205('0x54')](_0x7b5ed['query']);_0x290ed4[_0xb205('0x55')]=_[_0xb205('0x56')](_0x290ed4[_0xb205('0x52')],_0x290ed4[_0xb205('0x41')]);_0x46a8bd[_0xb205('0x57')]=_[_0xb205('0x56')](_0x290ed4['model'],qs[_0xb205('0x58')](_0x7b5ed[_0xb205('0x41')][_0xb205('0x58')]));_0x46a8bd[_0xb205('0x57')]=_0x46a8bd[_0xb205('0x57')][_0xb205('0x59')]?_0x46a8bd['attributes']:_0x290ed4[_0xb205('0x52')];if(!_0x7b5ed[_0xb205('0x41')][_0xb205('0xd3')](_0xb205('0xdb'))){_0x46a8bd[_0xb205('0x23')]=qs[_0xb205('0x23')](_0x7b5ed['query'][_0xb205('0x23')]);_0x46a8bd[_0xb205('0x21')]=qs['offset'](_0x7b5ed[_0xb205('0x41')][_0xb205('0x21')]);}_0x46a8bd[_0xb205('0xce')]=qs[_0xb205('0xcf')](_0x7b5ed[_0xb205('0x41')]['sort']);_0x46a8bd[_0xb205('0x40')]=qs[_0xb205('0x55')](_[_0xb205('0xd0')](_0x7b5ed['query'],_0x290ed4['filters']));_0x46a8bd[_0xb205('0x40')]['UserId']=_0x212349['id'];if(_0x7b5ed[_0xb205('0x41')]['filter']){_0x46a8bd[_0xb205('0x40')]=_['merge'](_0x46a8bd[_0xb205('0x40')],{'$or':_[_0xb205('0x87')](_0x46a8bd[_0xb205('0x57')],function(_0x16dff7){var _0x2cea94={};_0x2cea94[_0x16dff7]={'$like':'%'+_0x7b5ed['query'][_0xb205('0x2f')]+'%'};return _0x2cea94;})});}_0x46a8bd=_[_0xb205('0xd1')]({},_0x46a8bd,_0x7b5ed[_0xb205('0xd2')]);return db[_0xb205('0xe3')][_0xb205('0x24')]({'where':_0x46a8bd['where']})[_0xb205('0x28')](function(_0x34febd){_0x5c7bce[_0xb205('0x24')]=_0x34febd;if(_0x7b5ed[_0xb205('0x41')]['includeAll']){_0x46a8bd[_0xb205('0x43')]=[{'all':!![]}];}return db[_0xb205('0xe3')][_0xb205('0x47')](_0x46a8bd);})[_0xb205('0x28')](function(_0x5bb28f){_0x5c7bce['rows']=_0x5bb28f;return _0x5c7bce;});}})['then'](respondWithFilteredResult(_0x4743af,_0x46a8bd))[_0xb205('0x1c')](handleError(_0x4743af,null));};exports[_0xb205('0xe4')]=function(_0x21f681,_0x472526){var _0xdb2b96={};var _0x227e72={};var _0xe730f2;var _0x589728;return db[_0xb205('0x3a')][_0xb205('0x97')]({'where':{'id':_0x21f681[_0xb205('0x51')]['id']}})['then'](handleEntityNotFound(_0x472526,null))[_0xb205('0x28')](function(_0x207f70){if(_0x207f70){_0xe730f2=_0x207f70;_0x227e72['model']=_[_0xb205('0x54')](db[_0xb205('0xe5')][_0xb205('0x3b')]);_0x227e72[_0xb205('0x41')]=_[_0xb205('0x54')](_0x21f681[_0xb205('0x41')]);_0x227e72[_0xb205('0x55')]=_[_0xb205('0x56')](_0x227e72['model'],_0x227e72[_0xb205('0x41')]);_0xdb2b96['attributes']=_[_0xb205('0x56')](_0x227e72[_0xb205('0x52')],qs[_0xb205('0x58')](_0x21f681['query']['fields']));_0xdb2b96[_0xb205('0x57')]=_0xdb2b96[_0xb205('0x57')][_0xb205('0x59')]?_0xdb2b96[_0xb205('0x57')]:_0x227e72['model'];_0xdb2b96[_0xb205('0xce')]=qs['sort'](_0x21f681[_0xb205('0x41')][_0xb205('0xcf')]);_0xdb2b96[_0xb205('0x40')]=qs[_0xb205('0x55')](_[_0xb205('0xd0')](_0x21f681[_0xb205('0x41')],_0x227e72['filters']));if(_0x21f681[_0xb205('0x41')][_0xb205('0x2f')]){_0xdb2b96[_0xb205('0x40')]=_[_0xb205('0xd1')](_0xdb2b96[_0xb205('0x40')],{'$or':_[_0xb205('0x87')](_0xdb2b96[_0xb205('0x57')],function(_0x58305d){var _0x58f92b={};_0x58f92b[_0x58305d]={'$like':'%'+_0x21f681['query']['filter']+'%'};return _0x58f92b;})});}_0xdb2b96=_[_0xb205('0xd1')]({},_0xdb2b96,_0x21f681[_0xb205('0xd2')]);return _0xe730f2[_0xb205('0xe4')](_0xdb2b96);}})[_0xb205('0x28')](function(_0xc7fb79){if(_0xc7fb79){_0x589728=_0xc7fb79[_0xb205('0x59')];if(!_0x21f681[_0xb205('0x41')]['hasOwnProperty']('nolimit')){_0xdb2b96['limit']=qs[_0xb205('0x23')](_0x21f681[_0xb205('0x41')][_0xb205('0x23')]);_0xdb2b96[_0xb205('0x21')]=qs['offset'](_0x21f681[_0xb205('0x41')][_0xb205('0x21')]);}return _0xe730f2[_0xb205('0xe4')](_0xdb2b96);}})[_0xb205('0x28')](function(_0xaf56a9){if(_0xaf56a9){return _0xaf56a9?{'count':_0x589728,'rows':_0xaf56a9}:null;}})[_0xb205('0x28')](respondWithResult(_0x472526,null))[_0xb205('0x1c')](handleError(_0x472526,null));};exports[_0xb205('0xe6')]=function(_0x1ceaf1,_0x190f4b){var _0x33061b={};var _0x1b2111={};var _0x531e23;var _0x2236a8;return db['User'][_0xb205('0x97')]({'where':{'id':_0x1ceaf1['params']['id']}})[_0xb205('0x28')](handleEntityNotFound(_0x190f4b,null))[_0xb205('0x28')](function(_0x48097c){if(_0x48097c){_0x531e23=_0x48097c;_0x1b2111['model']=_['keys'](db[_0xb205('0xe7')][_0xb205('0x3b')]);_0x1b2111[_0xb205('0x41')]=_['keys'](_0x1ceaf1[_0xb205('0x41')]);_0x1b2111[_0xb205('0x55')]=_[_0xb205('0x56')](_0x1b2111[_0xb205('0x52')],_0x1b2111[_0xb205('0x41')]);_0x33061b[_0xb205('0x57')]=_[_0xb205('0x56')](_0x1b2111['model'],qs[_0xb205('0x58')](_0x1ceaf1[_0xb205('0x41')][_0xb205('0x58')]));_0x33061b[_0xb205('0x57')]=_0x33061b['attributes'][_0xb205('0x59')]?_0x33061b['attributes']:_0x1b2111[_0xb205('0x52')];_0x33061b[_0xb205('0xce')]=qs[_0xb205('0xcf')](_0x1ceaf1[_0xb205('0x41')]['sort']);_0x33061b['where']=qs['filters'](_[_0xb205('0xd0')](_0x1ceaf1[_0xb205('0x41')],_0x1b2111[_0xb205('0x55')]));if(_0x1ceaf1[_0xb205('0x41')][_0xb205('0x2f')]){_0x33061b[_0xb205('0x40')]=_['merge'](_0x33061b[_0xb205('0x40')],{'$or':_[_0xb205('0x87')](_0x33061b[_0xb205('0x57')],function(_0x32f63){var _0x1db221={};_0x1db221[_0x32f63]={'$like':'%'+_0x1ceaf1[_0xb205('0x41')][_0xb205('0x2f')]+'%'};return _0x1db221;})});}_0x33061b=_['merge']({},_0x33061b,_0x1ceaf1[_0xb205('0xd2')]);return _0x531e23[_0xb205('0xe6')](_0x33061b);}})[_0xb205('0x28')](function(_0x27e260){if(_0x27e260){_0x2236a8=_0x27e260['length'];if(!_0x1ceaf1[_0xb205('0x41')]['hasOwnProperty'](_0xb205('0xdb'))){_0x33061b[_0xb205('0x23')]=qs[_0xb205('0x23')](_0x1ceaf1[_0xb205('0x41')][_0xb205('0x23')]);_0x33061b['offset']=qs[_0xb205('0x21')](_0x1ceaf1[_0xb205('0x41')][_0xb205('0x21')]);}return _0x531e23[_0xb205('0xe6')](_0x33061b);}})['then'](function(_0x19dbe7){if(_0x19dbe7){return _0x19dbe7?{'count':_0x2236a8,'rows':_0x19dbe7}:null;}})[_0xb205('0x28')](respondWithResult(_0x190f4b,null))['catch'](handleError(_0x190f4b,null));};exports['getMailInteractions']=function(_0x2b264e,_0x2320ad){var _0x270b83={'raw':!![],'where':{}};var _0x473b0c={};var _0x286985={'count':0x0,'rows':[]};return db['User'][_0xb205('0x97')]({'where':{'id':_0x2b264e[_0xb205('0x51')]['id']}})['then'](handleEntityNotFound(_0x2320ad,null))['then'](function(_0x1805ac){if(_0x1805ac){_0x473b0c[_0xb205('0x52')]=_[_0xb205('0x54')](db['MailInteraction'][_0xb205('0x3b')]);_0x473b0c[_0xb205('0x41')]=_[_0xb205('0x54')](_0x2b264e['query']);_0x473b0c[_0xb205('0x55')]=_[_0xb205('0x56')](_0x473b0c[_0xb205('0x52')],_0x473b0c[_0xb205('0x41')]);_0x270b83['attributes']=_[_0xb205('0x56')](_0x473b0c['model'],qs[_0xb205('0x58')](_0x2b264e[_0xb205('0x41')][_0xb205('0x58')]));_0x270b83[_0xb205('0x57')]=_0x270b83[_0xb205('0x57')][_0xb205('0x59')]?_0x270b83['attributes']:_0x473b0c[_0xb205('0x52')];if(!_0x2b264e['query'][_0xb205('0xd3')]('nolimit')){_0x270b83[_0xb205('0x23')]=qs[_0xb205('0x23')](_0x2b264e[_0xb205('0x41')][_0xb205('0x23')]);_0x270b83[_0xb205('0x21')]=qs['offset'](_0x2b264e[_0xb205('0x41')]['offset']);}_0x270b83[_0xb205('0xce')]=qs['sort'](_0x2b264e[_0xb205('0x41')][_0xb205('0xcf')]);_0x270b83['where']=qs[_0xb205('0x55')](_[_0xb205('0xd0')](_0x2b264e['query'],_0x473b0c[_0xb205('0x55')]));_0x270b83[_0xb205('0x40')]['UserId']=_0x1805ac['id'];if(_0x2b264e[_0xb205('0x41')][_0xb205('0x2f')]){_0x270b83['where']=_[_0xb205('0xd1')](_0x270b83['where'],{'$or':_['map'](_0x270b83[_0xb205('0x57')],function(_0xfd30fa){var _0x7a50b7={};_0x7a50b7[_0xfd30fa]={'$like':'%'+_0x2b264e[_0xb205('0x41')][_0xb205('0x2f')]+'%'};return _0x7a50b7;})});}_0x270b83=_[_0xb205('0xd1')]({},_0x270b83,_0x2b264e[_0xb205('0xd2')]);return db[_0xb205('0xe8')]['count']({'where':_0x270b83[_0xb205('0x40')]})[_0xb205('0x28')](function(_0x12bad5){_0x286985[_0xb205('0x24')]=_0x12bad5;if(_0x2b264e[_0xb205('0x41')][_0xb205('0x42')]){_0x270b83['include']=[{'all':!![]}];}return db[_0xb205('0xe8')][_0xb205('0x47')](_0x270b83);})[_0xb205('0x28')](function(_0x5cffa4){_0x286985[_0xb205('0x48')]=_0x5cffa4;return _0x286985;});}})[_0xb205('0x28')](respondWithFilteredResult(_0x2320ad,_0x270b83))[_0xb205('0x1c')](handleError(_0x2320ad,null));};exports[_0xb205('0xe9')]=function(_0x5a4feb,_0x4c792b){var _0x39dc47={};var _0xc57f49={};var _0x10b42e;var _0x1876b6;return db['User'][_0xb205('0x97')]({'where':{'id':_0x5a4feb['params']['id']}})[_0xb205('0x28')](handleEntityNotFound(_0x4c792b,null))[_0xb205('0x28')](function(_0x1e67cf){if(_0x1e67cf){_0x10b42e=_0x1e67cf;_0xc57f49[_0xb205('0x52')]=_[_0xb205('0x54')](db['SmsInteraction']['rawAttributes']);_0xc57f49[_0xb205('0x41')]=_[_0xb205('0x54')](_0x5a4feb[_0xb205('0x41')]);_0xc57f49[_0xb205('0x55')]=_[_0xb205('0x56')](_0xc57f49[_0xb205('0x52')],_0xc57f49[_0xb205('0x41')]);_0x39dc47['attributes']=_['intersection'](_0xc57f49['model'],qs['fields'](_0x5a4feb['query']['fields']));_0x39dc47['attributes']=_0x39dc47[_0xb205('0x57')][_0xb205('0x59')]?_0x39dc47['attributes']:_0xc57f49[_0xb205('0x52')];_0x39dc47[_0xb205('0xce')]=qs[_0xb205('0xcf')](_0x5a4feb[_0xb205('0x41')][_0xb205('0xcf')]);_0x39dc47[_0xb205('0x40')]=qs[_0xb205('0x55')](_[_0xb205('0xd0')](_0x5a4feb[_0xb205('0x41')],_0xc57f49[_0xb205('0x55')]));if(_0x5a4feb[_0xb205('0x41')][_0xb205('0x2f')]){_0x39dc47[_0xb205('0x40')]=_[_0xb205('0xd1')](_0x39dc47[_0xb205('0x40')],{'$or':_[_0xb205('0x87')](_0x39dc47[_0xb205('0x57')],function(_0x2c92d7){var _0x27d6df={};_0x27d6df[_0x2c92d7]={'$like':'%'+_0x5a4feb[_0xb205('0x41')][_0xb205('0x2f')]+'%'};return _0x27d6df;})});}_0x39dc47=_[_0xb205('0xd1')]({},_0x39dc47,_0x5a4feb[_0xb205('0xd2')]);return _0x10b42e['getSmsInteractions'](_0x39dc47);}})[_0xb205('0x28')](function(_0x1dfdcf){if(_0x1dfdcf){_0x1876b6=_0x1dfdcf[_0xb205('0x59')];if(!_0x5a4feb[_0xb205('0x41')]['hasOwnProperty'](_0xb205('0xdb'))){_0x39dc47['limit']=qs[_0xb205('0x23')](_0x5a4feb[_0xb205('0x41')][_0xb205('0x23')]);_0x39dc47[_0xb205('0x21')]=qs['offset'](_0x5a4feb[_0xb205('0x41')][_0xb205('0x21')]);}return _0x10b42e['getSmsInteractions'](_0x39dc47);}})[_0xb205('0x28')](function(_0x57d11d){if(_0x57d11d){return _0x57d11d?{'count':_0x1876b6,'rows':_0x57d11d}:null;}})[_0xb205('0x28')](respondWithResult(_0x4c792b,null))[_0xb205('0x1c')](handleError(_0x4c792b,null));};exports[_0xb205('0xea')]=function(_0x5897c3,_0x3cd2bb){var _0x12c487={};var _0xd3eb9b={};var _0x392b95;var _0x1e64b0;return db[_0xb205('0x3a')][_0xb205('0x97')]({'where':{'id':_0x5897c3['params']['id']}})[_0xb205('0x28')](handleEntityNotFound(_0x3cd2bb,null))[_0xb205('0x28')](function(_0x2bb4c4){if(_0x2bb4c4){_0x392b95=_0x2bb4c4;_0xd3eb9b[_0xb205('0x52')]=_[_0xb205('0x54')](db['FaxInteraction']['rawAttributes']);_0xd3eb9b['query']=_[_0xb205('0x54')](_0x5897c3['query']);_0xd3eb9b[_0xb205('0x55')]=_['intersection'](_0xd3eb9b[_0xb205('0x52')],_0xd3eb9b[_0xb205('0x41')]);_0x12c487[_0xb205('0x57')]=_['intersection'](_0xd3eb9b[_0xb205('0x52')],qs[_0xb205('0x58')](_0x5897c3[_0xb205('0x41')][_0xb205('0x58')]));_0x12c487[_0xb205('0x57')]=_0x12c487[_0xb205('0x57')][_0xb205('0x59')]?_0x12c487['attributes']:_0xd3eb9b['model'];_0x12c487[_0xb205('0xce')]=qs[_0xb205('0xcf')](_0x5897c3['query'][_0xb205('0xcf')]);_0x12c487[_0xb205('0x40')]=qs[_0xb205('0x55')](_[_0xb205('0xd0')](_0x5897c3[_0xb205('0x41')],_0xd3eb9b[_0xb205('0x55')]));if(_0x5897c3[_0xb205('0x41')][_0xb205('0x2f')]){_0x12c487[_0xb205('0x40')]=_[_0xb205('0xd1')](_0x12c487[_0xb205('0x40')],{'$or':_[_0xb205('0x87')](_0x12c487['attributes'],function(_0xd09998){var _0x60a94f={};_0x60a94f[_0xd09998]={'$like':'%'+_0x5897c3[_0xb205('0x41')][_0xb205('0x2f')]+'%'};return _0x60a94f;})});}_0x12c487=_['merge']({},_0x12c487,_0x5897c3[_0xb205('0xd2')]);return _0x392b95[_0xb205('0xea')](_0x12c487);}})['then'](function(_0x5d8e23){if(_0x5d8e23){_0x1e64b0=_0x5d8e23[_0xb205('0x59')];if(!_0x5897c3[_0xb205('0x41')][_0xb205('0xd3')](_0xb205('0xdb'))){_0x12c487['limit']=qs[_0xb205('0x23')](_0x5897c3['query'][_0xb205('0x23')]);_0x12c487[_0xb205('0x21')]=qs[_0xb205('0x21')](_0x5897c3[_0xb205('0x41')][_0xb205('0x21')]);}return _0x392b95[_0xb205('0xea')](_0x12c487);}})[_0xb205('0x28')](function(_0x13714f){if(_0x13714f){return _0x13714f?{'count':_0x1e64b0,'rows':_0x13714f}:null;}})['then'](respondWithResult(_0x3cd2bb,null))[_0xb205('0x1c')](handleError(_0x3cd2bb,null));};exports[_0xb205('0xeb')]=function(_0x55beb1,_0x526db1){var _0x5a06fe={};var _0x4404d1={};var _0xae5e5d;var _0x41a23d;return db['User'][_0xb205('0x97')]({'where':{'id':_0x55beb1[_0xb205('0x51')]['id']}})[_0xb205('0x28')](handleEntityNotFound(_0x526db1,null))[_0xb205('0x28')](function(_0xcbd9c1){if(_0xcbd9c1){_0xae5e5d=_0xcbd9c1;_0x4404d1['model']=_[_0xb205('0x54')](db[_0xb205('0xec')][_0xb205('0x3b')]);_0x4404d1['query']=_[_0xb205('0x54')](_0x55beb1[_0xb205('0x41')]);_0x4404d1[_0xb205('0x55')]=_[_0xb205('0x56')](_0x4404d1[_0xb205('0x52')],_0x4404d1[_0xb205('0x41')]);_0x5a06fe[_0xb205('0x57')]=_[_0xb205('0x56')](_0x4404d1[_0xb205('0x52')],qs[_0xb205('0x58')](_0x55beb1[_0xb205('0x41')][_0xb205('0x58')]));_0x5a06fe['attributes']=_0x5a06fe[_0xb205('0x57')][_0xb205('0x59')]?_0x5a06fe[_0xb205('0x57')]:_0x4404d1[_0xb205('0x52')];_0x5a06fe[_0xb205('0xce')]=qs[_0xb205('0xcf')](_0x55beb1[_0xb205('0x41')][_0xb205('0xcf')]);_0x5a06fe[_0xb205('0x40')]=qs['filters'](_[_0xb205('0xd0')](_0x55beb1[_0xb205('0x41')],_0x4404d1[_0xb205('0x55')]));if(_0x55beb1['query']['filter']){_0x5a06fe['where']=_['merge'](_0x5a06fe[_0xb205('0x40')],{'$or':_[_0xb205('0x87')](_0x5a06fe[_0xb205('0x57')],function(_0x25fd2f){var _0x45524c={};_0x45524c[_0x25fd2f]={'$like':'%'+_0x55beb1[_0xb205('0x41')][_0xb205('0x2f')]+'%'};return _0x45524c;})});}_0x5a06fe=_[_0xb205('0xd1')]({},_0x5a06fe,_0x55beb1[_0xb205('0xd2')]);return _0xae5e5d[_0xb205('0xeb')](_0x5a06fe);}})['then'](function(_0x219c9a){if(_0x219c9a){_0x41a23d=_0x219c9a['length'];if(!_0x55beb1[_0xb205('0x41')][_0xb205('0xd3')](_0xb205('0xdb'))){_0x5a06fe['limit']=qs[_0xb205('0x23')](_0x55beb1['query']['limit']);_0x5a06fe[_0xb205('0x21')]=qs[_0xb205('0x21')](_0x55beb1[_0xb205('0x41')]['offset']);}return _0xae5e5d[_0xb205('0xeb')](_0x5a06fe);}})['then'](function(_0x1e5c61){if(_0x1e5c61){return _0x1e5c61?{'count':_0x41a23d,'rows':_0x1e5c61}:null;}})['then'](respondWithResult(_0x526db1,null))[_0xb205('0x1c')](handleError(_0x526db1,null));};exports[_0xb205('0xed')]=function(_0x5cc3a6,_0x1f3988,_0x33f7e9){var _0x1bb6b7;var _0x1afb0a;var _0x5cdb32;var _0x258a41=!_['isNil'](_0x5cc3a6['params']['id'])?_0x5cc3a6[_0xb205('0x51')]['id']:!_[_0xb205('0x66')](_0x5cc3a6[_0xb205('0x7c')]['id'])?_0x5cc3a6[_0xb205('0x7c')]['id']:null;return db[_0xb205('0x3a')]['find']({'where':{'id':_0x258a41,'role':{'$or':[_0xb205('0x2d'),_0xb205('0x7c'),_0xb205('0x2e')]}},'attributes':['id','name',_0xb205('0xee'),'mobile',_0xb205('0x29'),_0xb205('0x61'),_0xb205('0xa0')]})[_0xb205('0x28')](function(_0x78c854){if(_0x78c854){if(_0x78c854[_0xb205('0x29')]===_0xb205('0x2e')){_0x1bb6b7=_0x78c854;if(_0x5cc3a6[_0xb205('0x5d')]['interface']){_0x5cdb32=util[_0xb205('0xac')]('LOCAL/%s@from-sip/n',_0x1bb6b7[_0x5cc3a6['body']['interface']]);}else if(_0x5cc3a6[_0xb205('0x5d')]['intrf']){_0x5cdb32=util[_0xb205('0xac')]('SIP/%s',_0x5cc3a6[_0xb205('0x5d')][_0xb205('0xef')]);}else{_0x5cdb32=util[_0xb205('0xac')](_0xb205('0xad'),_0x1bb6b7[_0xb205('0x34')]);}socket['to'](util['format'](_0xb205('0xf0'),_0x1bb6b7['name']))[_0xb205('0x2a')]('user:forcelogout',{'user':{'id':_0x1bb6b7['id'],'name':_0x1bb6b7[_0xb205('0x34')]},'ip':_0x5cc3a6[_0xb205('0xf1')][_0xb205('0xf2')]||_0x5cc3a6['connection'][_0xb205('0xf3')]||_0x5cc3a6[_0xb205('0xf4')]['remoteAddress']||_0x5cc3a6[_0xb205('0xf5')][_0xb205('0xf4')][_0xb205('0xf3')]});return db[_0xb205('0xae')][_0xb205('0x36')]({'where':{'membername':_0x1bb6b7[_0xb205('0x34')]},'individualHooks':!![]});}}else{throw new db[(_0xb205('0x92'))][(_0xb205('0x8f'))](_0xb205('0xf6'));}})[_0xb205('0x28')](function(){if(_0x1bb6b7){return _0x1bb6b7[_0xb205('0xf7')]({'raw':!![]});}})[_0xb205('0x28')](function(_0x2c5518){if(_0x1bb6b7){if(_0x2c5518){_0x1afb0a=_0x2c5518;if(_0x1afb0a[_0xb205('0x59')]){var _0x13835b=_0x1afb0a['map'](function(_0x1a8420){var _0x3cfe54={'membername':_0x1bb6b7['name'],'UserId':_0x1bb6b7['id'],'queue_name':_0x1a8420[_0xb205('0x34')],'VoiceQueueId':_0x1a8420['id'],'interface':_0x5cdb32,'paused':_0x1bb6b7[_0xb205('0xa0')]||![],'penalty':_0x1a8420['UserVoiceQueue.penalty']||0x0};return db['UserVoiceQueueRt'][_0xb205('0xaf')](_0x3cfe54);});return Promise[_0xb205('0x4f')](_0x13835b);}}}})[_0xb205('0x28')](function(){if(_0x1bb6b7){return db[_0xb205('0xf8')]['findAll']({'where':{'membername':_0x1bb6b7[_0xb205('0x34')],'exitAt':null}});}})['then'](function(_0x1bcf24){if(_0x1bb6b7){var _0x163ed3=[];_0x1bcf24[_0xb205('0xf9')](function(_0x4c8205){_0x163ed3[_0xb205('0x46')](_0x4c8205[_0xb205('0x27')]({'exitAt':moment()['format'](_0xb205('0xfa'))}));});return Promise[_0xb205('0x4f')](_0x163ed3);}})['then'](function(){if(_0x1bb6b7){var _0x4b375e=[];var _0x1838be=[];var _0x26be14=utils[_0xb205('0xfb')]();var _0x4e33f8={'membername':_0x1bb6b7[_0xb205('0x34')],'interface':_0x5cdb32,'enterAt':moment()[_0xb205('0xac')](_0xb205('0xfa')),'role':_0x1bb6b7[_0xb205('0x29')],'internal':_0x1bb6b7[_0xb205('0x61')]};_0x26be14[_0xb205('0xf9')](function(_0xa84365){_0x4b375e[_0xb205('0x46')](_['merge']({'channel':_0xa84365,'type':_0xb205('0xfc'),'data1':_0x5cc3a6[_0xb205('0x5d')]['device'],'data2':_0x5cdb32},_0x4e33f8));if(_0x1bb6b7['loginInPause']){_0x1838be[_0xb205('0x46')](_[_0xb205('0xd1')]({'channel':_0xa84365,'type':_0xb205('0xfd'),'data1':'LOGININPAUSE'},_0x4e33f8));}});return db[_0xb205('0xf8')][_0xb205('0x83')](_0x4b375e[_0xb205('0xcb')](_0x1838be),{'individualHooks':!![]});}})[_0xb205('0x28')](function(){if(_0x1bb6b7){return _0x1bb6b7[_0xb205('0x27')]({'online':!![],'lastLoginAt':moment()[_0xb205('0xac')](_0xb205('0xfa')),'voicePause':_0x1bb6b7[_0xb205('0xa0')]||![],'mailPause':_0x1bb6b7[_0xb205('0xa0')]||![],'chatPause':_0x1bb6b7[_0xb205('0xa0')]||![],'faxPause':_0x1bb6b7[_0xb205('0xa0')]||![],'smsPause':_0x1bb6b7['loginInPause']||![],'openchannelPause':_0x1bb6b7[_0xb205('0xa0')]||![],'whatsappPause':_0x1bb6b7['loginInPause']||![],'pauseType':_0x1bb6b7['loginInPause']?_0xb205('0xfe'):null,'interface':_0x5cdb32,'lastPauseAt':moment()[_0xb205('0xac')](_0xb205('0xfa'))});}})[_0xb205('0x28')](function(_0x45231f){if(_0x5cc3a6[_0xb205('0xff')]){return _0x33f7e9();}else{return Promise['resolve'](_0x45231f)[_0xb205('0x28')](respondWithResult(_0x1f3988,null));}})['catch'](handleError(_0x1f3988,null));};exports[_0xb205('0x100')]=function(_0x2f3d65,_0x3761e4){var _0x58353c;return db['User'][_0xb205('0x33')]({'where':{'id':_0x2f3d65[_0xb205('0x51')]['id'],'role':_0xb205('0x2e')},'attributes':['id',_0xb205('0x34'),_0xb205('0x29')]})[_0xb205('0x28')](handleEntityNotFound(_0x3761e4,null))[_0xb205('0x28')](function(_0x138ab5){if(_0x138ab5){_0x58353c=_0x138ab5;return db[_0xb205('0xae')][_0xb205('0x36')]({'where':{'membername':_0x58353c[_0xb205('0x34')]},'individualHooks':!![]});}})['then'](function(){return db[_0xb205('0xf8')][_0xb205('0x47')]({'where':{'membername':_0x58353c['name'],'exitAt':null}});})[_0xb205('0x28')](function(_0x511807){var _0x36430d=[];_0x511807[_0xb205('0xf9')](function(_0xfb504){_0x36430d[_0xb205('0x46')](_0xfb504['update']({'exitAt':moment()[_0xb205('0xac')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xb205('0x4f')](_0x36430d);})[_0xb205('0x28')](function(){return _0x58353c[_0xb205('0x27')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x3761e4,null))[_0xb205('0x1c')](handleError(_0x3761e4,null));};exports[_0xb205('0x101')]=function(_0x31448d,_0x3b2122){var _0x3d558d;return db[_0xb205('0xae')][_0xb205('0x27')]({'paused':0x1},{'where':{'UserId':_0x31448d[_0xb205('0x51')]['id']},'individualHooks':!![]})['then'](function(){return db['User'][_0xb205('0x33')]({'where':{'id':_0x31448d['params']['id'],'role':_0xb205('0x2e')},'attributes':['id','name',_0xb205('0x29'),_0xb205('0x61'),_0xb205('0xa2'),_0xb205('0x9f')]});})[_0xb205('0x28')](handleEntityNotFound(_0x3b2122,null))[_0xb205('0x28')](function(_0x452b4e){if(_0x452b4e){_0x3d558d=_0x452b4e;return respondWithRpcPromise('QueuePause',_0xb205('0x101'),{'id':_0x3d558d['id'],'name':_0x3d558d[_0xb205('0x34')],'pause':!![]});}})[_0xb205('0x28')](function(){if(_0x3d558d){return db[_0xb205('0xf8')][_0xb205('0x47')]({'where':{'membername':_0x3d558d[_0xb205('0x34')],'type':_0xb205('0xfd'),'exitAt':null}});}})[_0xb205('0x28')](function(_0x4cf1bd){if(_0x4cf1bd[_0xb205('0x59')]){var _0x18dae4=moment()[_0xb205('0xac')](_0xb205('0xfa'));for(var _0x4690b7=0x0,_0x3b5051=_0x4cf1bd[_0xb205('0x59')];_0x4690b7<_0x3b5051;_0x4690b7++){_0x4cf1bd[_0x4690b7][_0xb205('0x102')]({'exitAt':_0x18dae4});}}})['then'](function(){var _0x344609=[];var _0x26cb76=utils[_0xb205('0xfb')]();_0x26cb76[_0xb205('0xf9')](function(_0x5e0340){_0x344609[_0xb205('0x46')]({'channel':_0x5e0340,'membername':_0x3d558d[_0xb205('0x34')],'interface':_[_0xb205('0x66')](_0x3d558d[_0xb205('0xa2')])?util[_0xb205('0xac')](_0xb205('0xad'),_0x3d558d[_0xb205('0x34')]):_0x3d558d['interface'],'type':_0xb205('0xfd'),'enterAt':moment()[_0xb205('0xac')](_0xb205('0xfa')),'data1':_0x31448d[_0xb205('0x5d')]['type']||_0xb205('0x103'),'role':_0x3d558d[_0xb205('0x29')],'internal':_0x3d558d[_0xb205('0x61')]});});return db[_0xb205('0xf8')][_0xb205('0x83')](_0x344609,{'individualHooks':!![]});})[_0xb205('0x28')](function(){return _0x3d558d['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x31448d['body']['type']||_0xb205('0x103'),'lastPauseAt':moment()[_0xb205('0xac')]('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x3b2122,null))['catch'](handleError(_0x3b2122,null));};exports[_0xb205('0x104')]=function(_0x35cc34,_0x44a89b){if(_0x35cc34[_0xb205('0x5d')][_0xb205('0x9e')]&&!utils['isValidChannel'](_0x35cc34['body'][_0xb205('0x9e')])){throw new APIBadRequestError(util[_0xb205('0xac')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x35cc34[_0xb205('0x5d')][_0xb205('0x9e')]));}return db[_0xb205('0x3a')][_0xb205('0x33')]({'where':{'id':_0x35cc34[_0xb205('0x51')]['id']},'attributes':['id','name',_0xb205('0x29'),'internal',_0xb205('0xa2'),'online',_0xb205('0xa1'),'mailPause',_0xb205('0x105'),_0xb205('0x106'),_0xb205('0x107'),_0xb205('0x108'),_0xb205('0x109'),'pauseType',_0xb205('0x10a')]})[_0xb205('0x28')](function(_0x27dbc5){if(!_0x27dbc5){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x35cc34[_0xb205('0x51')]['id']));}return _0x27dbc5[_0xb205('0x104')](_0x35cc34[_0xb205('0x5d')]['channel']);})[_0xb205('0x28')](respondWithResult(_0x44a89b,null))['catch'](APIHandleError(_0x44a89b));};exports['getTeams']=function(_0x26cf42,_0x1884e4){var _0x5e5ff2={};var _0x3799f4={};var _0x138349;var _0x5ce843;return db[_0xb205('0x3a')][_0xb205('0x97')]({'where':{'id':_0x26cf42[_0xb205('0x51')]['id']}})[_0xb205('0x28')](handleEntityNotFound(_0x1884e4,null))[_0xb205('0x28')](function(_0x4feb0b){if(_0x4feb0b){_0x138349=_0x4feb0b;_0x3799f4[_0xb205('0x52')]=_[_0xb205('0x54')](db[_0xb205('0x10b')][_0xb205('0x3b')]);_0x3799f4['query']=_['keys'](_0x26cf42[_0xb205('0x41')]);_0x3799f4[_0xb205('0x55')]=_[_0xb205('0x56')](_0x3799f4[_0xb205('0x52')],_0x3799f4[_0xb205('0x41')]);_0x5e5ff2[_0xb205('0x57')]=_['intersection'](_0x3799f4[_0xb205('0x52')],qs[_0xb205('0x58')](_0x26cf42['query'][_0xb205('0x58')]));_0x5e5ff2['attributes']=_0x5e5ff2['attributes']['length']?_0x5e5ff2[_0xb205('0x57')]:_0x3799f4[_0xb205('0x52')];_0x5e5ff2[_0xb205('0xce')]=qs[_0xb205('0xcf')](_0x26cf42[_0xb205('0x41')][_0xb205('0xcf')]);_0x5e5ff2['where']=qs[_0xb205('0x55')](_[_0xb205('0xd0')](_0x26cf42['query'],_0x3799f4[_0xb205('0x55')]));if(_0x26cf42['query'][_0xb205('0x2f')]){_0x5e5ff2['where']=_[_0xb205('0xd1')](_0x5e5ff2[_0xb205('0x40')],{'$or':_['map'](_0x5e5ff2[_0xb205('0x57')],function(_0x2bef6c){var _0x1ffba4={};_0x1ffba4[_0x2bef6c]={'$like':'%'+_0x26cf42[_0xb205('0x41')]['filter']+'%'};return _0x1ffba4;})});}_0x5e5ff2=_[_0xb205('0xd1')]({},_0x5e5ff2,_0x26cf42[_0xb205('0xd2')]);return _0x138349[_0xb205('0x10c')](_0x5e5ff2);}})['then'](function(_0x3ce8cf){if(_0x3ce8cf){_0x5ce843=_0x3ce8cf[_0xb205('0x59')];if(!_0x26cf42[_0xb205('0x41')][_0xb205('0xd3')](_0xb205('0xdb'))){_0x5e5ff2[_0xb205('0x23')]=qs[_0xb205('0x23')](_0x26cf42['query']['limit']);_0x5e5ff2[_0xb205('0x21')]=qs['offset'](_0x26cf42[_0xb205('0x41')]['offset']);}return _0x138349[_0xb205('0x10c')](_0x5e5ff2);}})[_0xb205('0x28')](function(_0x34fa5c){if(_0x34fa5c){return _0x34fa5c?{'count':_0x5ce843,'rows':_0x34fa5c}:null;}})['then'](respondWithResult(_0x1884e4,null))[_0xb205('0x1c')](handleError(_0x1884e4,null));};exports[_0xb205('0x10d')]=function(_0xded393,_0x51dbe6){var _0x19923d=_0xded393['params']['id'];var _0x82a564=_0xded393['body']?_0xded393['body'][_0xb205('0x60')]:null;var _0xe2dc58=[];return Promise[_0xb205('0x10e')]()[_0xb205('0x28')](function(){if(!_0x82a564)throw new APIBadRequestError(_0xb205('0x10f'));})[_0xb205('0x28')](function(){return db['User'][_0xb205('0x97')]({'where':{'id':_0x19923d}});})['then'](function(_0x40477b){if(!_0x40477b)throw new APINotFoundError(util['format'](_0xb205('0x110'),_0xded393['params']['id']));return db[_0xb205('0x68')][_0xb205('0x111')](function(_0x4e5dd6){return _0x40477b[_0xb205('0x10d')](_0x82a564,{'transaction':_0x4e5dd6})[_0xb205('0x28')](function(){return db[_0xb205('0x10b')][_0xb205('0x47')]({'where':{'id':{'$in':_0x82a564}}});})[_0xb205('0x28')](function(_0xbffc7c){var _0x3294ba=_[_0xb205('0x87')](_0xbffc7c,function(_0x2b3776){return _0x2b3776['getAssociatedQueues']();});return Promise['all'](_0x3294ba);})[_0xb205('0x28')](function(_0x397d47){_0xe2dc58=_[_0xb205('0x112')](_0x397d47);var _0x35f1cc=_['map'](_0xe2dc58,function(_0x51f0f7){return _0x51f0f7[_0xb205('0x113')](_0x40477b['id'],{'transaction':_0x4e5dd6});});return Promise[_0xb205('0x4f')](_0x35f1cc);})[_0xb205('0x28')](function(){if(!_0x40477b[_0xb205('0x9f')])return;var _0x3a50f1=_[_0xb205('0x2f')](_0xe2dc58,function(_0x4909f0){return _0x4909f0['getDataValue'](_0xb205('0x9e'))===_0xb205('0x114');});var _0x179878=_[_0xb205('0x87')](_0x3a50f1,function(_0x5631c1){return db[_0xb205('0xae')][_0xb205('0xaf')]({'membername':_0x40477b[_0xb205('0x34')],'UserId':_0x40477b['id'],'queue_name':_0x5631c1[_0xb205('0x34')],'VoiceQueueId':_0x5631c1['id'],'interface':_['isNil'](_0x40477b[_0xb205('0xa2')])?util[_0xb205('0xac')](_0xb205('0xad'),_0x40477b['name']):_0x40477b['interface'],'paused':_0x40477b[_0xb205('0xa1')]||![],'penalty':_0x40477b[_0xb205('0xa7')]},{'transaction':_0x4e5dd6});});return Promise['all'](_0x179878);})[_0xb205('0x28')](function(){return db[_0xb205('0x115')][_0xb205('0x47')]({'where':{'teamId':{'$in':_0x82a564}}});})[_0xb205('0x28')](function(_0x38b8e9){var _0x475c58=_['map'](_0x38b8e9,function(_0x20d87c){return db['UserVoicePrefix'][_0xb205('0x7b')]({'UserId':_0x40477b['id'],'VoicePrefixId':_0x20d87c[_0xb205('0x116')]},{'transaction':_0x4e5dd6});});return Promise[_0xb205('0x4f')](_0x475c58);});});})[_0xb205('0x28')](function(){for(var _0x4cc2a9=0x0;_0x4cc2a9<_0xe2dc58[_0xb205('0x59')];_0x4cc2a9++){var _0x1bbea5=_0xe2dc58[_0x4cc2a9][_0xb205('0x117')](_0xb205('0x9e'));var _0x2b2df0=_0x1bbea5+'QueueId';socket[_0xb205('0x2a')](_0xb205('0x7c')+_0x1bbea5+_0xb205('0xa9'),{'UserId':_0x19923d,['queueField']:_0xe2dc58[_0x4cc2a9]['id']});}})[_0xb205('0x28')](respondWithStatusCode(_0x51dbe6,null))['catch'](APIHandleError(_0x51dbe6));};exports[_0xb205('0x118')]=function(_0x470d2b,_0x2fa7f3){var _0x183fa6=_0x470d2b['params']['id'];var _0x28942f=null;if(_0x470d2b[_0xb205('0x41')][_0xb205('0x60')]){_0x28942f=_[_0xb205('0xb2')](_0x470d2b[_0xb205('0x41')][_0xb205('0x60')])?_0x470d2b[_0xb205('0x41')][_0xb205('0x60')]:[_0x470d2b[_0xb205('0x41')][_0xb205('0x60')]];}var _0x2c579d=[];return Promise[_0xb205('0x10e')]()[_0xb205('0x28')](function(){if(!_0x28942f)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xb205('0x28')](function(){return db[_0xb205('0x3a')][_0xb205('0x97')]({'where':{'id':_0x183fa6}});})[_0xb205('0x28')](function(_0x54311d){if(!_0x54311d)throw new APINotFoundError(util['format'](_0xb205('0x110'),_0x470d2b[_0xb205('0x51')]['id']));return db['sequelize'][_0xb205('0x111')](function(_0x33f053){return _0x54311d[_0xb205('0x118')](_0x28942f,{'transaction':_0x33f053})[_0xb205('0x28')](function(){return db[_0xb205('0x10b')][_0xb205('0x47')]({'where':{'id':{'$in':_0x28942f}}});})[_0xb205('0x28')](function(_0x38ddc0){var _0x357a90=_[_0xb205('0x87')](_0x38ddc0,function(_0x2fc4dc){return _0x2fc4dc[_0xb205('0x119')]();});return Promise[_0xb205('0x4f')](_0x357a90);})['then'](function(_0x336322){_0x2c579d=_[_0xb205('0x112')](_0x336322);var _0x156ac8=_[_0xb205('0x87')](_0x2c579d,function(_0x110e5c){return _0x110e5c[_0xb205('0x11a')](_0x54311d['id'],{'transaction':_0x33f053});});return Promise[_0xb205('0x4f')](_0x156ac8);})[_0xb205('0x28')](function(){if(!_0x54311d[_0xb205('0x9f')])return;var _0x4292b0=_['filter'](_0x2c579d,function(_0x2a24b5){return _0x2a24b5[_0xb205('0x117')](_0xb205('0x9e'))===_0xb205('0x114');});var _0x4166ab=_[_0xb205('0x87')](_0x4292b0,function(_0x26eac4){return db[_0xb205('0xae')][_0xb205('0x36')]({'where':{'VoiceQueueId':_0x26eac4['id'],'UserId':_0x54311d['id']},'transaction':_0x33f053});});return Promise[_0xb205('0x4f')](_0x4166ab);})[_0xb205('0x28')](function(){return db[_0xb205('0x115')][_0xb205('0x47')]({'where':{'teamId':{'$in':_0x28942f}}});})[_0xb205('0x28')](function(_0x378cc8){var _0x14481c=_[_0xb205('0x87')](_0x378cc8,function(_0x3083f9){return db[_0xb205('0x11b')][_0xb205('0x36')]({'where':{'UserId':_0x54311d['id'],'VoicePrefixId':_0x3083f9[_0xb205('0x116')]}},{'transaction':_0x33f053});});return Promise[_0xb205('0x4f')](_0x14481c);});});})['then'](function(){for(var _0x245d1e=0x0;_0x245d1e<_0x2c579d['length'];_0x245d1e++){var _0x20f7f1=_0x2c579d[_0x245d1e][_0xb205('0x117')](_0xb205('0x9e'));var _0x397a04=_0x20f7f1+_0xb205('0xb3');socket[_0xb205('0x2a')]('user'+_0x20f7f1+'Queue:remove',{'UserId':_0x183fa6,['queueField']:_0x2c579d[_0x245d1e]['id']});}})[_0xb205('0x28')](respondWithStatusCode(_0x2fa7f3,null))[_0xb205('0x1c')](APIHandleError(_0x2fa7f3));};exports[_0xb205('0x11c')]=function(_0x3fd044,_0x103983){var _0xfb03e0={};var _0x3c7cd8={};var _0x1ed03a;var _0x40c6c1;return db[_0xb205('0x3a')]['findOne']({'where':{'id':_0x3fd044[_0xb205('0x51')]['id']}})[_0xb205('0x28')](handleEntityNotFound(_0x103983,null))['then'](function(_0x4c25c3){if(_0x4c25c3){_0x1ed03a=_0x4c25c3;_0x3c7cd8[_0xb205('0x52')]=_[_0xb205('0x54')](db[_0xb205('0xd4')][_0xb205('0x3b')]);_0x3c7cd8['query']=_['keys'](_0x3fd044[_0xb205('0x41')]);_0x3c7cd8['filters']=_[_0xb205('0x56')](_0x3c7cd8['model'],_0x3c7cd8[_0xb205('0x41')]);_0xfb03e0[_0xb205('0x57')]=_['intersection'](_0x3c7cd8[_0xb205('0x52')],qs[_0xb205('0x58')](_0x3fd044[_0xb205('0x41')]['fields']));_0xfb03e0['attributes']=_0xfb03e0[_0xb205('0x57')][_0xb205('0x59')]?_0xfb03e0[_0xb205('0x57')]:_0x3c7cd8[_0xb205('0x52')];_0xfb03e0[_0xb205('0xce')]=qs[_0xb205('0xcf')](_0x3fd044[_0xb205('0x41')][_0xb205('0xcf')]);_0xfb03e0[_0xb205('0x40')]=qs[_0xb205('0x55')](_[_0xb205('0xd0')](_0x3fd044['query'],_0x3c7cd8[_0xb205('0x55')]));if(_0x3fd044[_0xb205('0x41')][_0xb205('0x2f')]){_0xfb03e0[_0xb205('0x40')]=_[_0xb205('0xd1')](_0xfb03e0['where'],{'$or':_[_0xb205('0x87')](_0xfb03e0[_0xb205('0x57')],function(_0x3f9e0d){var _0x1d1e93={};_0x1d1e93[_0x3f9e0d]={'$like':'%'+_0x3fd044[_0xb205('0x41')][_0xb205('0x2f')]+'%'};return _0x1d1e93;})});}_0xfb03e0=_[_0xb205('0xd1')]({},_0xfb03e0,_0x3fd044[_0xb205('0xd2')]);return _0x1ed03a[_0xb205('0x11c')](_0xfb03e0);}})[_0xb205('0x28')](function(_0xf1aa49){if(_0xf1aa49){_0x40c6c1=_0xf1aa49[_0xb205('0x59')];if(!_0x3fd044[_0xb205('0x41')][_0xb205('0xd3')](_0xb205('0xdb'))){_0xfb03e0[_0xb205('0x23')]=qs[_0xb205('0x23')](_0x3fd044['query'][_0xb205('0x23')]);_0xfb03e0[_0xb205('0x21')]=qs[_0xb205('0x21')](_0x3fd044[_0xb205('0x41')][_0xb205('0x21')]);}return _0x1ed03a[_0xb205('0x11c')](_0xfb03e0);}})[_0xb205('0x28')](function(_0x5b3823){if(_0x5b3823){return _0x5b3823?{'count':_0x40c6c1,'rows':_0x5b3823}:null;}})[_0xb205('0x28')](respondWithResult(_0x103983,null))['catch'](handleError(_0x103983,null));};exports['getAgents']=function(_0x582639,_0x4ca311){var _0x431370={};var _0x119eb5={};var _0x3516dd;return db[_0xb205('0x3a')][_0xb205('0x97')]({'where':{'id':_0x582639[_0xb205('0x51')]['id']}})[_0xb205('0x28')](handleEntityNotFound(_0x4ca311,null))['then'](function(_0x4e60a1){if(_0x4e60a1){_0x3516dd=_0x4e60a1;_0x119eb5['model']=_[_0xb205('0x54')](db[_0xb205('0x3a')]['rawAttributes']);_0x119eb5[_0xb205('0x41')]=_[_0xb205('0x54')](_0x582639['query']);_0x119eb5['filters']=_[_0xb205('0x56')](_0x119eb5['model'],_0x119eb5[_0xb205('0x41')]);_0x431370['attributes']=_[_0xb205('0x56')](_0x119eb5[_0xb205('0x52')],qs[_0xb205('0x58')](_0x582639[_0xb205('0x41')][_0xb205('0x58')]));_0x431370[_0xb205('0x57')]=_0x431370['attributes'][_0xb205('0x59')]?_0x431370[_0xb205('0x57')]:_0x119eb5['model'];_0x431370[_0xb205('0xce')]=qs[_0xb205('0xcf')](_0x582639['query'][_0xb205('0xcf')]);_0x431370[_0xb205('0x40')]=qs[_0xb205('0x55')](_[_0xb205('0xd0')](_0x582639['query'],_0x119eb5[_0xb205('0x55')]));if(_0x582639[_0xb205('0x41')][_0xb205('0x2f')]){_0x431370[_0xb205('0x40')]=_[_0xb205('0xd1')](_0x431370[_0xb205('0x40')],{'$or':_[_0xb205('0x87')](_0x431370[_0xb205('0x57')],function(_0x4d8025){var _0x5629c1={};_0x5629c1[_0x4d8025]={'$like':'%'+_0x582639['query'][_0xb205('0x2f')]+'%'};return _0x5629c1;})});}_0x431370['model']=db[_0xb205('0x3a')];_0x431370['as']=_0xb205('0x8a');_0x431370=_[_0xb205('0xd1')]({},_0x431370,_0x582639[_0xb205('0xd2')]);return _0x3516dd[_0xb205('0xf7')]({'include':[_0x431370]});}})[_0xb205('0x28')](function(_0x40fa86){if(_0x40fa86){var _0xe10563={},_0x419366=[];for(var _0x36ce0f=0x0;_0x36ce0f<_0x40fa86[_0xb205('0x59')];_0x36ce0f+=0x1){for(var _0x3cdc5e=0x0,_0x23b8fc;_0x3cdc5e<_0x40fa86[_0x36ce0f][_0xb205('0x8a')][_0xb205('0x59')];_0x3cdc5e+=0x1){_0x23b8fc=_0x40fa86[_0x36ce0f]['Agents'][_0x3cdc5e]['get']({'plain':!![]});_0xe10563[_0x23b8fc['id']]=_0x23b8fc;}}_0xe10563=_['values'](_0xe10563);for(var _0x4391a3=qs[_0xb205('0x21')](_0x582639[_0xb205('0x41')][_0xb205('0x21')]);_0x4391a3<_0xe10563[_0xb205('0x59')]&&_0x419366[_0xb205('0x59')]=_0xc260c0['agents']){throw new Error(_0xe912('0x4d'));}})['then'](function(){if(_0x4ae0f5){return db[_0xe912('0x27')]['destroy']({'where':{'membername':_0x4ae0f5[_0xe912('0x1f')]},'individualHooks':!![]});}})['then'](function(){if(_0x4ae0f5){return _0x4ae0f5[_0xe912('0x4e')]({'raw':!![]});}})['then'](function(_0x55dc46){if(_0x4ae0f5){if(_0x55dc46){var _0x5a164f=[];_0x13bf40=_0x55dc46;if(_0x13bf40['length']){for(var _0x55d65e=0x0;_0x55d65e<_0x13bf40[_0xe912('0x2c')];_0x55d65e++){_0x5a164f[_0xe912('0x30')](db['UserVoiceQueueRt']['upsert']({'membername':_0x4ae0f5[_0xe912('0x1f')],'UserId':_0x4ae0f5['id'],'queue_name':_0x13bf40[_0x55d65e][_0xe912('0x1f')],'VoiceQueueId':_0x13bf40[_0x55d65e]['id'],'interface':_0x1c2706,'paused':_0x4ae0f5[_0xe912('0x49')]||![],'penalty':_0x13bf40[_0x55d65e][_0xe912('0x4f')]||0x0}));}return BPromise['all'](_0x5a164f);}}}})['then'](function(){if(_0x4ae0f5){return db[_0xe912('0x29')][_0xe912('0x2a')]({'where':{'membername':_0x4ae0f5[_0xe912('0x1f')],'exitAt':null}});}})[_0xe912('0x23')](function(_0x89a0){if(_0x4ae0f5){if(_0x89a0&&_0x89a0[_0xe912('0x2c')]){var _0x170e06=[];_0x89a0[_0xe912('0x44')](function(_0x5e957b){_0x170e06[_0xe912('0x30')](_0x5e957b['update']({'exitAt':moment()[_0xe912('0x24')](_0xe912('0x2d'))}));});return BPromise[_0xe912('0x45')](_0x170e06);}}})[_0xe912('0x23')](function(){if(_0x4ae0f5){var _0x3e1e3b=[];var _0x53358a=[];var _0xb8339d=utils[_0xe912('0x2f')]();var _0x142e0e={'membername':_0x4ae0f5['name'],'interface':_0x1c2706,'enterAt':moment()[_0xe912('0x24')](_0xe912('0x2d')),'role':_0x4ae0f5['role'],'internal':_0x4ae0f5[_0xe912('0x21')]};_0xb8339d['forEach'](function(_0x2a9401){_0x3e1e3b[_0xe912('0x30')](_[_0xe912('0x50')]({'channel':_0x2a9401,'type':_0xe912('0x51'),'data1':_0xe912('0x52'),'data2':_0x1c2706},_0x142e0e));if(_0x4ae0f5['loginInPause']){_0x53358a['push'](_[_0xe912('0x50')]({'channel':_0x2a9401,'type':_0xe912('0x2b'),'data1':'LOGININPAUSE'},_0x142e0e));}});return db['MemberReport'][_0xe912('0x36')](_0x3e1e3b[_0xe912('0x53')](_0x53358a),{'individualHooks':!![]});}})['then'](function(){if(_0x4ae0f5){return _0x4ae0f5[_0xe912('0x28')]({'online':!![],'lastLoginAt':moment()[_0xe912('0x24')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x4ae0f5[_0xe912('0x49')]||![],'mailPause':_0x4ae0f5[_0xe912('0x49')]||![],'chatPause':_0x4ae0f5[_0xe912('0x49')]||![],'faxPause':_0x4ae0f5['loginInPause']||![],'smsPause':_0x4ae0f5['loginInPause']||![],'openchannelPause':_0x4ae0f5[_0xe912('0x49')]||![],'pauseType':_0x4ae0f5['loginInPause']?_0xe912('0x54'):null,'lastPauseAt':moment()[_0xe912('0x24')](_0xe912('0x2d')),'interface':_0x1c2706});}})[_0xe912('0x23')](function(_0x24b9b9){_0xf92d54(_0x24b9b9);})['catch'](function(_0x105412){_0x515a32(_0x5e7b92[_0xe912('0x17')](0x1f4,_0x105412[_0xe912('0x18')]));});});}; \ No newline at end of file +var _0x248f=['type','DEFAULT\x20PAUSE','uniqueid','update','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','voicePause','mailPause','chatPause','faxPause','openchannelPause','pauseType','User\x20with\x20id\x20%s\x20not\x20found','params','LogoutUser','findOne','destroy','forEach','all','LoginUser','phone','loginInPause','count','agent','../../config/license/util','agents','getVoiceQueues','upsert','UserVoiceQueue.penalty','LOGIN','callysquare','bulkCreate','concat','LOGININPAUSE','lodash','util','moment','../../mysqldb','../../config/utils','../../config/environment','redis','defaults','localhost','register','GetUser','User','findAll','options','where','attributes','limit','include','map','model','debug','stringify','catch','message','error','ShowUser','find','raw','then','info','PauseUser','name','role','internal','interface','UserVoiceQueueRt','MemberReport','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','push','format','SIP/%s','body'];(function(_0x222619,_0x589023){var _0x5d76f8=function(_0x227a90){while(--_0x227a90){_0x222619['push'](_0x222619['shift']());}};_0x5d76f8(++_0x589023);}(_0x248f,0x11a));var _0xf248=function(_0x29df9a,_0x42aff3){_0x29df9a=_0x29df9a-0x0;var _0x3a8e96=_0x248f[_0x29df9a];return _0x3a8e96;};'use strict';var _=require(_0xf248('0x0'));var util=require(_0xf248('0x1'));var moment=require(_0xf248('0x2'));var BPromise=require('bluebird');var Redis=require('ioredis');var db=require(_0xf248('0x3'))['db'];var utils=require(_0xf248('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xf248('0x5'));config[_0xf248('0x6')]=_[_0xf248('0x7')](config[_0xf248('0x6')],{'host':_0xf248('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./user.socket')[_0xf248('0x9')](socket);exports[_0xf248('0xa')]=function(_0xa03b03){var _0x4861c0=this;return new Promise(function(_0x35f743,_0x5343bf){return db[_0xf248('0xb')][_0xf248('0xc')]({'raw':_0xa03b03['options']?_0xa03b03[_0xf248('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0xa03b03['options']?_0xa03b03[_0xf248('0xd')][_0xf248('0xe')]||null:null,'attributes':_0xa03b03[_0xf248('0xd')]?_0xa03b03[_0xf248('0xd')][_0xf248('0xf')]||null:null,'limit':_0xa03b03['options']?_0xa03b03[_0xf248('0xd')][_0xf248('0x10')]||null:null,'include':_0xa03b03[_0xf248('0xd')]?_0xa03b03[_0xf248('0xd')][_0xf248('0x11')]?_[_0xf248('0x12')](_0xa03b03[_0xf248('0xd')][_0xf248('0x11')],function(_0x32e15f){return{'model':db[_0x32e15f[_0xf248('0x13')]],'as':_0x32e15f['as'],'attributes':_0x32e15f['attributes'],'include':_0x32e15f[_0xf248('0x11')]?_[_0xf248('0x12')](_0x32e15f[_0xf248('0x11')],function(_0x2f7459){return{'model':db[_0x2f7459[_0xf248('0x13')]],'as':_0x2f7459['as'],'attributes':_0x2f7459[_0xf248('0xf')],'include':_0x2f7459[_0xf248('0x11')]?_[_0xf248('0x12')](_0x2f7459['include'],function(_0x3d506c){return{'model':db[_0x3d506c[_0xf248('0x13')]],'as':_0x3d506c['as'],'attributes':_0x3d506c[_0xf248('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9a91fa){logger['info'](_0xf248('0xa'),_0xa03b03);logger[_0xf248('0x14')](_0xf248('0xa'),_0xa03b03,JSON[_0xf248('0x15')](_0x9a91fa));_0x35f743(_0x9a91fa);})[_0xf248('0x16')](function(_0x424af2){logger['error'](_0xf248('0xa'),_0x424af2[_0xf248('0x17')],_0xa03b03);_0x5343bf(_0x4861c0[_0xf248('0x18')](0x1f4,_0x424af2[_0xf248('0x17')]));});});};exports[_0xf248('0x19')]=function(_0x3cf574){var _0x19b1d5=this;return new Promise(function(_0x5a69ab,_0x3691b4){return db['User'][_0xf248('0x1a')]({'raw':_0x3cf574['options']?_0x3cf574[_0xf248('0xd')][_0xf248('0x1b')]===undefined?!![]:![]:!![],'where':_0x3cf574[_0xf248('0xd')]?_0x3cf574['options'][_0xf248('0xe')]||null:null,'attributes':_0x3cf574[_0xf248('0xd')]?_0x3cf574[_0xf248('0xd')]['attributes']||null:null,'include':_0x3cf574[_0xf248('0xd')]?_0x3cf574[_0xf248('0xd')]['include']?_[_0xf248('0x12')](_0x3cf574[_0xf248('0xd')]['include'],function(_0x5aabfc){return{'model':db[_0x5aabfc[_0xf248('0x13')]],'as':_0x5aabfc['as'],'attributes':_0x5aabfc[_0xf248('0xf')],'include':_0x5aabfc[_0xf248('0x11')]?_['map'](_0x5aabfc[_0xf248('0x11')],function(_0x139154){return{'model':db[_0x139154[_0xf248('0x13')]],'as':_0x139154['as'],'attributes':_0x139154[_0xf248('0xf')],'include':_0x139154[_0xf248('0x11')]?_[_0xf248('0x12')](_0x139154[_0xf248('0x11')],function(_0x57713d){return{'model':db[_0x57713d[_0xf248('0x13')]],'as':_0x57713d['as'],'attributes':_0x57713d[_0xf248('0xf')]};}):[]};}):[]};}):[]:[]})[_0xf248('0x1c')](function(_0x4acb67){logger[_0xf248('0x1d')](_0xf248('0x19'),_0x3cf574);logger[_0xf248('0x14')]('ShowUser',_0x3cf574,JSON[_0xf248('0x15')](_0x4acb67));_0x5a69ab(_0x4acb67);})[_0xf248('0x16')](function(_0x4355f6){logger[_0xf248('0x18')](_0xf248('0x19'),_0x4355f6[_0xf248('0x17')],_0x3cf574);_0x3691b4(_0x19b1d5[_0xf248('0x18')](0x1f4,_0x4355f6[_0xf248('0x17')]));});});};exports[_0xf248('0x1e')]=function(_0x520157){var _0x2ab696;return db[_0xf248('0xb')][_0xf248('0x1a')]({'where':_0x520157['options']['where']||{},'attributes':['id',_0xf248('0x1f'),_0xf248('0x20'),_0xf248('0x21'),_0xf248('0x22')]})[_0xf248('0x1c')](function(_0x90b7a0){if(!_0x90b7a0){throw new Error(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x520157['params']['id']));}_0x2ab696=_0x90b7a0;return db[_0xf248('0x23')]['update']({'paused':0x1},{'where':{'UserId':_0x2ab696['id']},'individualHooks':!![]});})[_0xf248('0x1c')](function(){return db[_0xf248('0x24')][_0xf248('0xc')]({'where':{'membername':_0x2ab696[_0xf248('0x1f')],'type':_0xf248('0x25'),'exitAt':null}});})[_0xf248('0x1c')](function(_0x32f03c){if(_0x32f03c&&_0x32f03c[_0xf248('0x26')]){var _0x34b741=moment()['format'](_0xf248('0x27'));for(var _0x5e2862=0x0,_0x1ea3c4=_0x32f03c['length'];_0x5e2862<_0x1ea3c4;_0x5e2862++){_0x32f03c[_0x5e2862][_0xf248('0x28')]({'exitAt':_0x34b741});}}})[_0xf248('0x1c')](function(){var _0x4d4768=[];var _0x952779=utils[_0xf248('0x29')]();_0x952779['forEach'](function(_0x28cc1a){_0x4d4768[_0xf248('0x2a')]({'channel':_0x28cc1a,'membername':_0x2ab696[_0xf248('0x1f')],'interface':_['isNil'](_0x2ab696[_0xf248('0x22')])?util[_0xf248('0x2b')](_0xf248('0x2c'),_0x2ab696[_0xf248('0x1f')]):_0x2ab696['interface'],'type':_0xf248('0x25'),'enterAt':moment()[_0xf248('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x520157[_0xf248('0x2d')][_0xf248('0x2e')]||_0xf248('0x2f'),'role':_0x2ab696[_0xf248('0x20')],'internal':_0x2ab696[_0xf248('0x21')],'uniqueid':_0x520157[_0xf248('0x2d')][_0xf248('0x30')]||null});});return db[_0xf248('0x24')]['bulkCreate'](_0x4d4768,{'individualHooks':!![]});})['then'](function(){return _0x2ab696[_0xf248('0x31')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x520157[_0xf248('0x2d')][_0xf248('0x2e')]||_0xf248('0x2f'),'lastPauseAt':moment()[_0xf248('0x2b')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xf248('0x16')](function(_0x29036c){throw _0x29036c;});};exports['UnpauseUser']=function(_0x18edfd){return Promise[_0xf248('0x32')]()['then'](function(){if(_0x18edfd[_0xf248('0x2d')][_0xf248('0x33')]&&!utils[_0xf248('0x34')](_0x18edfd[_0xf248('0x2d')][_0xf248('0x33')])){throw new Error(util[_0xf248('0x2b')](_0xf248('0x35'),_0x18edfd['body'][_0xf248('0x33')]));}return db[_0xf248('0xb')]['findOne']({'where':_0x18edfd[_0xf248('0xd')]['where']||{},'attributes':['id',_0xf248('0x1f'),'role',_0xf248('0x21'),'interface','online',_0xf248('0x36'),_0xf248('0x37'),_0xf248('0x38'),_0xf248('0x39'),_0xf248('0x3a'),'smsPause','whatsappPause',_0xf248('0x3b'),'lastPauseAt']});})['then'](function(_0x5d839c){if(!_0x5d839c){throw new Error(util[_0xf248('0x2b')](_0xf248('0x3c'),_0x18edfd[_0xf248('0x3d')]['id']));}return _0x5d839c['unpause'](_0x18edfd['body']['channel'],'system');})[_0xf248('0x16')](function(_0x20d709){throw _0x20d709;});};exports[_0xf248('0x3e')]=function(_0x405df5){var _0x16f47e=this;return new Promise(function(_0x387646,_0x5208ea){var _0x5c5da6;return db[_0xf248('0xb')][_0xf248('0x3f')]({'where':_0x405df5['options'][_0xf248('0xe')]||{},'attributes':['id',_0xf248('0x1f')]})[_0xf248('0x1c')](function(_0x593d6e){if(_0x593d6e){_0x5c5da6=_0x593d6e;return db['UserVoiceQueueRt'][_0xf248('0x40')]({'where':{'membername':_0x5c5da6[_0xf248('0x1f')]},'individualHooks':!![]});}})[_0xf248('0x1c')](function(){if(_0x5c5da6){return db[_0xf248('0x24')][_0xf248('0xc')]({'where':{'membername':_0x5c5da6[_0xf248('0x1f')],'exitAt':null}});}})[_0xf248('0x1c')](function(_0x53efb4){if(_0x5c5da6){if(_0x53efb4&&_0x53efb4[_0xf248('0x26')]){var _0x2e51fe=[];_0x53efb4[_0xf248('0x41')](function(_0x39c4fc){_0x2e51fe[_0xf248('0x2a')](_0x39c4fc[_0xf248('0x31')]({'exitAt':moment()['format'](_0xf248('0x27'))}));});return BPromise[_0xf248('0x42')](_0x2e51fe);}}})[_0xf248('0x1c')](function(){if(_0x5c5da6){return _0x5c5da6['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x26b2ec){_0x387646(_0x26b2ec);})['catch'](function(_0x4d3a41){_0x5208ea(_0x16f47e[_0xf248('0x18')](0x1f4,_0x4d3a41[_0xf248('0x17')]));});});};exports[_0xf248('0x43')]=function(_0x27060d){var _0x3483a9=this;return new Promise(function(_0x5e51fd,_0x2fe928){var _0x1df594;var _0x22ac5c;var _0xa58cef;var _0x37fbfd;return db['User'][_0xf248('0x3f')]({'where':_0x27060d[_0xf248('0xd')][_0xf248('0xe')]||{},'attributes':['id',_0xf248('0x1f'),_0xf248('0x20'),'mobile',_0xf248('0x44'),_0xf248('0x21'),_0xf248('0x45'),'interface']})[_0xf248('0x1c')](function(_0x1b25b9){if(_0x1b25b9){_0x1df594=_0x1b25b9;_0x37fbfd=_0x27060d[_0xf248('0x2d')][_0xf248('0x22')]?_0x27060d[_0xf248('0x2d')]['interface']:util[_0xf248('0x2b')](_0xf248('0x2c'),_0x1df594['name']);return db[_0xf248('0xb')][_0xf248('0x46')]({'where':{'role':_0xf248('0x47'),'online':!![],'id':{'$ne':_0x1df594['id']}}});}})['then'](function(_0x1d4d9c){if(_0x1d4d9c){_0xa58cef=_0x1d4d9c;return require(_0xf248('0x48'))['getLicense']();}})[_0xf248('0x1c')](function(_0x459254){if(_0x459254&&_0x459254['agents']&&_0xa58cef>=_0x459254[_0xf248('0x49')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0xf248('0x1c')](function(){if(_0x1df594){return db[_0xf248('0x23')][_0xf248('0x40')]({'where':{'membername':_0x1df594['name']},'individualHooks':!![]});}})[_0xf248('0x1c')](function(){if(_0x1df594){return _0x1df594[_0xf248('0x4a')]({'raw':!![]});}})[_0xf248('0x1c')](function(_0x4d1a67){if(_0x1df594){if(_0x4d1a67){var _0x4d11a9=[];_0x22ac5c=_0x4d1a67;if(_0x22ac5c[_0xf248('0x26')]){for(var _0x4f9956=0x0;_0x4f9956<_0x22ac5c[_0xf248('0x26')];_0x4f9956++){_0x4d11a9[_0xf248('0x2a')](db[_0xf248('0x23')][_0xf248('0x4b')]({'membername':_0x1df594['name'],'UserId':_0x1df594['id'],'queue_name':_0x22ac5c[_0x4f9956][_0xf248('0x1f')],'VoiceQueueId':_0x22ac5c[_0x4f9956]['id'],'interface':_0x37fbfd,'paused':_0x1df594[_0xf248('0x45')]||![],'penalty':_0x22ac5c[_0x4f9956][_0xf248('0x4c')]||0x0}));}return BPromise['all'](_0x4d11a9);}}}})[_0xf248('0x1c')](function(){if(_0x1df594){return db[_0xf248('0x24')][_0xf248('0xc')]({'where':{'membername':_0x1df594['name'],'exitAt':null}});}})[_0xf248('0x1c')](function(_0x415481){if(_0x1df594){if(_0x415481&&_0x415481[_0xf248('0x26')]){var _0x1353f8=[];_0x415481[_0xf248('0x41')](function(_0x27a10b){_0x1353f8[_0xf248('0x2a')](_0x27a10b[_0xf248('0x31')]({'exitAt':moment()[_0xf248('0x2b')](_0xf248('0x27'))}));});return BPromise[_0xf248('0x42')](_0x1353f8);}}})[_0xf248('0x1c')](function(){if(_0x1df594){var _0x3ff31f=[];var _0x14106e=[];var _0x5941cd=utils['getChannels']();var _0x247dfb={'membername':_0x1df594[_0xf248('0x1f')],'interface':_0x37fbfd,'enterAt':moment()[_0xf248('0x2b')](_0xf248('0x27')),'role':_0x1df594['role'],'internal':_0x1df594[_0xf248('0x21')]};_0x5941cd[_0xf248('0x41')](function(_0x27e26){_0x3ff31f[_0xf248('0x2a')](_['merge']({'channel':_0x27e26,'type':_0xf248('0x4d'),'data1':_0xf248('0x4e'),'data2':_0x37fbfd},_0x247dfb));if(_0x1df594[_0xf248('0x45')]){_0x14106e[_0xf248('0x2a')](_['merge']({'channel':_0x27e26,'type':'PAUSE','data1':'LOGININPAUSE'},_0x247dfb));}});return db[_0xf248('0x24')][_0xf248('0x4f')](_0x3ff31f[_0xf248('0x50')](_0x14106e),{'individualHooks':!![]});}})[_0xf248('0x1c')](function(){if(_0x1df594){return _0x1df594[_0xf248('0x31')]({'online':!![],'lastLoginAt':moment()['format'](_0xf248('0x27')),'voicePause':_0x1df594[_0xf248('0x45')]||![],'mailPause':_0x1df594[_0xf248('0x45')]||![],'chatPause':_0x1df594[_0xf248('0x45')]||![],'faxPause':_0x1df594[_0xf248('0x45')]||![],'smsPause':_0x1df594[_0xf248('0x45')]||![],'openchannelPause':_0x1df594[_0xf248('0x45')]||![],'pauseType':_0x1df594[_0xf248('0x45')]?_0xf248('0x51'):null,'lastPauseAt':moment()['format'](_0xf248('0x27')),'interface':_0x37fbfd});}})[_0xf248('0x1c')](function(_0xd82ff7){_0x5e51fd(_0xd82ff7);})[_0xf248('0x16')](function(_0x4eedd2){_0x2fe928(_0x3483a9[_0xf248('0x18')](0x1f4,_0x4eedd2['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index ecaec4e..7d747c2 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 _0xa816=['user:','./user.events','remove','emit','removeListener','register'];(function(_0x5c332e,_0x29f6bb){var _0x4aa64b=function(_0x368dae){while(--_0x368dae){_0x5c332e['push'](_0x5c332e['shift']());}};_0x4aa64b(++_0x29f6bb);}(_0xa816,0x1f3));var _0x6a81=function(_0x507ac5,_0x33aaee){_0x507ac5=_0x507ac5-0x0;var _0x12c1bc=_0xa816[_0x507ac5];return _0x12c1bc;};'use strict';var UserEvents=require(_0x6a81('0x0'));var events=['save',_0x6a81('0x1'),'update'];function createListener(_0x3d5360,_0x4b1ad1){return function(_0x5a0517){_0x4b1ad1[_0x6a81('0x2')](_0x3d5360,_0x5a0517);};}function removeListener(_0x890d58,_0x12df87){return function(){UserEvents[_0x6a81('0x3')](_0x890d58,_0x12df87);};}exports[_0x6a81('0x4')]=function(_0x40d6c0){for(var _0x37ceb3=0x0,_0x54f2d0=events['length'];_0x37ceb3<_0x54f2d0;_0x37ceb3++){var _0x3a63a2=events[_0x37ceb3];var _0x4fd344=createListener(_0x6a81('0x5')+_0x3a63a2,_0x40d6c0);UserEvents['on'](_0x3a63a2,_0x4fd344);}}; \ No newline at end of file +var _0xebac=['save','remove','update','removeListener','register','length','user:','./user.events'];(function(_0x1f7830,_0x10e047){var _0x36cb9b=function(_0x3b4378){while(--_0x3b4378){_0x1f7830['push'](_0x1f7830['shift']());}};_0x36cb9b(++_0x10e047);}(_0xebac,0x177));var _0xceba=function(_0x25c454,_0x190f0d){_0x25c454=_0x25c454-0x0;var _0x955617=_0xebac[_0x25c454];return _0x955617;};'use strict';var UserEvents=require(_0xceba('0x0'));var events=[_0xceba('0x1'),_0xceba('0x2'),_0xceba('0x3')];function createListener(_0x2ff898,_0x305377){return function(_0x2fe86c){_0x305377['emit'](_0x2ff898,_0x2fe86c);};}function removeListener(_0x2a1904,_0x2f6b16){return function(){UserEvents[_0xceba('0x4')](_0x2a1904,_0x2f6b16);};}exports[_0xceba('0x5')]=function(_0x29a860){for(var _0x1ed17b=0x0,_0x420bd0=events[_0xceba('0x6')];_0x1ed17b<_0x420bd0;_0x1ed17b++){var _0x18023b=events[_0x1ed17b];var _0x56003c=createListener(_0xceba('0x7')+_0x18023b,_0x29a860);UserEvents['on'](_0x18023b,_0x56003c);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 524b060..2767946 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xc84c3d,_0x191cc9){var _0x220bf5=function(_0x426945){while(--_0x426945){_0xc84c3d['push'](_0xc84c3d['shift']());}};_0x220bf5(++_0x191cc9);}(_0xe706,0xa3));var _0x6e70=function(_0x500785,_0x15e5ff){_0x500785=_0x500785-0x0;var _0x1f8bcc=_0xe706[_0x500785];return _0x1f8bcc;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x416f4e,_0x46a4b1){var _0x230028=function(_0x5a17ea){while(--_0x5a17ea){_0x416f4e['push'](_0x416f4e['shift']());}};_0x230028(++_0x46a4b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 4504383..dbe3b1b 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 _0x16eb=['exports','sequelize'];(function(_0x2eed64,_0x40e262){var _0x3b75d0=function(_0x260664){while(--_0x260664){_0x2eed64['push'](_0x2eed64['shift']());}};_0x3b75d0(++_0x40e262);}(_0x16eb,0x73));var _0xb16e=function(_0x46c913,_0x1a4181){_0x46c913=_0x46c913-0x0;var _0x41c6f6=_0x16eb[_0x46c913];return _0x41c6f6;};'use strict';var Sequelize=require(_0xb16e('0x0'));module[_0xb16e('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6bc1=['exports','INTEGER','sequelize'];(function(_0x282ee0,_0x427511){var _0x41a513=function(_0x470f6c){while(--_0x470f6c){_0x282ee0['push'](_0x282ee0['shift']());}};_0x41a513(++_0x427511);}(_0x6bc1,0x12b));var _0x16bc=function(_0x4464be,_0x1ded1c){_0x4464be=_0x4464be-0x0;var _0x51c2d6=_0x6bc1[_0x4464be];return _0x51c2d6;};'use strict';var Sequelize=require(_0x16bc('0x0'));module[_0x16bc('0x1')]={'penalty':{'type':Sequelize[_0x16bc('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 10db7cd..cbb4e81 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 _0xbdf8=['path','exports','UserChatQueue','user_has_chat_queues','util','../../config/logger','moment'];(function(_0x4c7d5d,_0x385713){var _0x3f476d=function(_0x3fa87f){while(--_0x3fa87f){_0x4c7d5d['push'](_0x4c7d5d['shift']());}};_0x3f476d(++_0x385713);}(_0xbdf8,0x1a8));var _0x8bdf=function(_0x53d2fe,_0x226c7e){_0x53d2fe=_0x53d2fe-0x0;var _0x1610a8=_0xbdf8[_0x53d2fe];return _0x1610a8;};'use strict';var _=require('lodash');var util=require(_0x8bdf('0x0'));var logger=require(_0x8bdf('0x1'))('api');var moment=require(_0x8bdf('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8bdf('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userChatQueue.attributes');module[_0x8bdf('0x4')]=function(_0x4b8975,_0x47fd9c){return _0x4b8975['define'](_0x8bdf('0x5'),attributes,{'tableName':_0x8bdf('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x961b=['bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','user_has_chat_queues'];(function(_0x280604,_0x528d29){var _0x1f659b=function(_0x3f6ae2){while(--_0x3f6ae2){_0x280604['push'](_0x280604['shift']());}};_0x1f659b(++_0x528d29);}(_0x961b,0x9a));var _0xb961=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x961b[_0x2f3848];return _0x102668;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xb961('0x0'));var rp=require(_0xb961('0x1'));var fs=require('fs');var path=require(_0xb961('0x2'));var rimraf=require(_0xb961('0x3'));var config=require(_0xb961('0x4'));var attributes=require(_0xb961('0x5'));module['exports']=function(_0x8481c7,_0x5235c7){return _0x8481c7['define']('UserChatQueue',attributes,{'tableName':_0xb961('0x6'),'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 c4d9d53..5d7d2ea 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 _0x75d3=['then','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x2cda83,_0x2d38b9){var _0x3539d5=function(_0x2387df){while(--_0x2387df){_0x2cda83['push'](_0x2cda83['shift']());}};_0x3539d5(++_0x2d38b9);}(_0x75d3,0x173));var _0x375d=function(_0xe1e649,_0x1fee1a){_0xe1e649=_0xe1e649-0x0;var _0x4188f3=_0x75d3[_0xe1e649];return _0x4188f3;};'use strict';var _=require(_0x375d('0x0'));var util=require('util');var moment=require(_0x375d('0x1'));var BPromise=require(_0x375d('0x2'));var rs=require(_0x375d('0x3'));var fs=require('fs');var Redis=require(_0x375d('0x4'));var db=require(_0x375d('0x5'))['db'];var utils=require(_0x375d('0x6'));var logger=require(_0x375d('0x7'))(_0x375d('0x8'));var config=require('../../config/environment');var jayson=require(_0x375d('0x9'));var client=jayson[_0x375d('0xa')][_0x375d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e2f7f,_0x433191,_0x495dea){return new BPromise(function(_0x378417,_0x2d7bf0){return client[_0x375d('0xc')](_0x5e2f7f,_0x495dea)[_0x375d('0xd')](function(_0x1dc2e2){logger[_0x375d('0xe')](_0x375d('0xf'),_0x433191,'request\x20sent');logger[_0x375d('0x10')](_0x375d('0x11'),_0x433191,_0x375d('0x12'),JSON[_0x375d('0x13')](_0x1dc2e2));if(_0x1dc2e2[_0x375d('0x14')]){if(_0x1dc2e2['error'][_0x375d('0x15')]===0x1f4){logger[_0x375d('0x14')](_0x375d('0xf'),_0x433191,_0x1dc2e2[_0x375d('0x14')][_0x375d('0x16')]);return _0x2d7bf0(_0x1dc2e2[_0x375d('0x14')][_0x375d('0x16')]);}logger[_0x375d('0x14')](_0x375d('0xf'),_0x433191,_0x1dc2e2[_0x375d('0x14')][_0x375d('0x16')]);return _0x378417(_0x1dc2e2[_0x375d('0x14')][_0x375d('0x16')]);}else{logger[_0x375d('0xe')](_0x375d('0xf'),_0x433191,'request\x20sent');_0x378417(_0x1dc2e2[_0x375d('0x17')][_0x375d('0x16')]);}})['catch'](function(_0x5178b9){logger[_0x375d('0x14')](_0x375d('0xf'),_0x433191,_0x5178b9);_0x2d7bf0(_0x5178b9);});});} \ No newline at end of file +var _0xf7df=['request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','UserChatQueue,\x20%s,\x20%s'];(function(_0x46fb48,_0x3b6c59){var _0x1e3f78=function(_0x61c01c){while(--_0x61c01c){_0x46fb48['push'](_0x46fb48['shift']());}};_0x1e3f78(++_0x3b6c59);}(_0xf7df,0x157));var _0xff7d=function(_0x1cb1d0,_0x176142){_0x1cb1d0=_0x1cb1d0-0x0;var _0x58b217=_0xf7df[_0x1cb1d0];return _0x58b217;};'use strict';var _=require('lodash');var util=require(_0xff7d('0x0'));var moment=require(_0xff7d('0x1'));var BPromise=require(_0xff7d('0x2'));var rs=require(_0xff7d('0x3'));var fs=require('fs');var Redis=require(_0xff7d('0x4'));var db=require(_0xff7d('0x5'))['db'];var utils=require(_0xff7d('0x6'));var logger=require(_0xff7d('0x7'))(_0xff7d('0x8'));var config=require(_0xff7d('0x9'));var jayson=require(_0xff7d('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1e5afc,_0x21f4ef,_0x1e4bba){return new BPromise(function(_0x138090,_0x1c8404){return client[_0xff7d('0xb')](_0x1e5afc,_0x1e4bba)['then'](function(_0xb836c9){logger[_0xff7d('0xc')](_0xff7d('0xd'),_0x21f4ef,_0xff7d('0xe'));logger[_0xff7d('0xf')](_0xff7d('0x10'),_0x21f4ef,'request\x20sent',JSON[_0xff7d('0x11')](_0xb836c9));if(_0xb836c9[_0xff7d('0x12')]){if(_0xb836c9[_0xff7d('0x12')]['code']===0x1f4){logger[_0xff7d('0x12')](_0xff7d('0xd'),_0x21f4ef,_0xb836c9['error'][_0xff7d('0x13')]);return _0x1c8404(_0xb836c9[_0xff7d('0x12')]['message']);}logger['error']('UserChatQueue,\x20%s,\x20%s',_0x21f4ef,_0xb836c9[_0xff7d('0x12')][_0xff7d('0x13')]);return _0x138090(_0xb836c9[_0xff7d('0x12')][_0xff7d('0x13')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x21f4ef,_0xff7d('0xe'));_0x138090(_0xb836c9['result'][_0xff7d('0x13')]);}})[_0xff7d('0x14')](function(_0x41fa3f){logger['error'](_0xff7d('0xd'),_0x21f4ef,_0x41fa3f);_0x1c8404(_0x41fa3f);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 5d87806..2091080 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(_0x25b18e,_0x30f87f){var _0x5712be=function(_0xb79ff4){while(--_0xb79ff4){_0x25b18e['push'](_0x25b18e['shift']());}};_0x5712be(++_0x30f87f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x246aa2,_0x25ff04){var _0x33d695=function(_0x3ca1fd){while(--_0x3ca1fd){_0x246aa2['push'](_0x246aa2['shift']());}};_0x33d695(++_0x25ff04);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 440446a..8b596ce 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 _0x0ac0=['exports','INTEGER','STRING','sequelize'];(function(_0x1593ff,_0x36d2ae){var _0x3ca047=function(_0x1439af){while(--_0x1439af){_0x1593ff['push'](_0x1593ff['shift']());}};_0x3ca047(++_0x36d2ae);}(_0x0ac0,0x1c7));var _0x00ac=function(_0xe1a3a5,_0xd3e341){_0xe1a3a5=_0xe1a3a5-0x0;var _0x362646=_0x0ac0[_0xe1a3a5];return _0x362646;};'use strict';var Sequelize=require(_0x00ac('0x0'));module[_0x00ac('0x1')]={'penalty':{'type':Sequelize[_0x00ac('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x00ac('0x3')]}}; \ No newline at end of file +var _0x2d58=['exports','INTEGER','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d58,0x1ce));var _0x82d5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2d58[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x82d5('0x0')]={'penalty':{'type':Sequelize[_0x82d5('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x82d5('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 027b69d..ae0b87d 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 _0xafcf=['util','path','rimraf','../../config/environment','UserFaxQueue','user_has_fax_queues','lodash'];(function(_0x2d54ea,_0x220b01){var _0x5e8e57=function(_0x183b74){while(--_0x183b74){_0x2d54ea['push'](_0x2d54ea['shift']());}};_0x5e8e57(++_0x220b01);}(_0xafcf,0xd8));var _0xfafc=function(_0x34022f,_0x21134c){_0x34022f=_0x34022f-0x0;var _0x1bebdf=_0xafcf[_0x34022f];return _0x1bebdf;};'use strict';var _=require(_0xfafc('0x0'));var util=require(_0xfafc('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfafc('0x2'));var rimraf=require(_0xfafc('0x3'));var config=require(_0xfafc('0x4'));var attributes=require('./userFaxQueue.attributes');module['exports']=function(_0x271846,_0x3b8379){return _0x271846['define'](_0xfafc('0x5'),attributes,{'tableName':_0xfafc('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9221=['../../config/environment','UserFaxQueue','user_has_fax_queues','lodash','api','request-promise','path'];(function(_0x17fc3d,_0x2d35d5){var _0x4e83e8=function(_0x532cd2){while(--_0x532cd2){_0x17fc3d['push'](_0x17fc3d['shift']());}};_0x4e83e8(++_0x2d35d5);}(_0x9221,0x88));var _0x1922=function(_0x307cec,_0x1cf922){_0x307cec=_0x307cec-0x0;var _0x285c73=_0x9221[_0x307cec];return _0x285c73;};'use strict';var _=require(_0x1922('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1922('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1922('0x2'));var fs=require('fs');var path=require(_0x1922('0x3'));var rimraf=require('rimraf');var config=require(_0x1922('0x4'));var attributes=require('./userFaxQueue.attributes');module['exports']=function(_0x2e24f0,_0x25b672){return _0x2e24f0['define'](_0x1922('0x5'),attributes,{'tableName':_0x1922('0x6'),'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 7251f48..ba36a86 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 _0x2cc8=['request\x20sent','debug','stringify','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','UserFaxQueue,\x20%s,\x20%s'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x2cc8,0x99));var _0x82cc=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x2cc8[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0x82cc('0x0'));var util=require(_0x82cc('0x1'));var moment=require('moment');var BPromise=require(_0x82cc('0x2'));var rs=require(_0x82cc('0x3'));var fs=require('fs');var Redis=require(_0x82cc('0x4'));var db=require(_0x82cc('0x5'))['db'];var utils=require(_0x82cc('0x6'));var logger=require(_0x82cc('0x7'))(_0x82cc('0x8'));var config=require(_0x82cc('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x82cc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45050e,_0x299874,_0x15d53c){return new BPromise(function(_0xe9bc8,_0x244629){return client[_0x82cc('0xb')](_0x45050e,_0x15d53c)[_0x82cc('0xc')](function(_0x33231e){logger[_0x82cc('0xd')](_0x82cc('0xe'),_0x299874,_0x82cc('0xf'));logger[_0x82cc('0x10')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x299874,_0x82cc('0xf'),JSON[_0x82cc('0x11')](_0x33231e));if(_0x33231e['error']){if(_0x33231e[_0x82cc('0x12')]['code']===0x1f4){logger[_0x82cc('0x12')](_0x82cc('0xe'),_0x299874,_0x33231e['error']['message']);return _0x244629(_0x33231e[_0x82cc('0x12')][_0x82cc('0x13')]);}logger[_0x82cc('0x12')](_0x82cc('0xe'),_0x299874,_0x33231e[_0x82cc('0x12')][_0x82cc('0x13')]);return _0xe9bc8(_0x33231e['error'][_0x82cc('0x13')]);}else{logger[_0x82cc('0xd')](_0x82cc('0xe'),_0x299874,'request\x20sent');_0xe9bc8(_0x33231e['result'][_0x82cc('0x13')]);}})[_0x82cc('0x14')](function(_0x4ea303){logger[_0x82cc('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x299874,_0x4ea303);_0x244629(_0x4ea303);});});} \ No newline at end of file +var _0xba57=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x33c2af,_0x163198){var _0x13c04a=function(_0x4de68e){while(--_0x4de68e){_0x33c2af['push'](_0x33c2af['shift']());}};_0x13c04a(++_0x163198);}(_0xba57,0xf6));var _0x7ba5=function(_0xcee4e9,_0x17956b){_0xcee4e9=_0xcee4e9-0x0;var _0x4a04b3=_0xba57[_0xcee4e9];return _0x4a04b3;};'use strict';var _=require(_0x7ba5('0x0'));var util=require(_0x7ba5('0x1'));var moment=require('moment');var BPromise=require(_0x7ba5('0x2'));var rs=require(_0x7ba5('0x3'));var fs=require('fs');var Redis=require(_0x7ba5('0x4'));var db=require(_0x7ba5('0x5'))['db'];var utils=require(_0x7ba5('0x6'));var logger=require(_0x7ba5('0x7'))(_0x7ba5('0x8'));var config=require(_0x7ba5('0x9'));var jayson=require(_0x7ba5('0xa'));var client=jayson[_0x7ba5('0xb')][_0x7ba5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39a1cd,_0x2ad152,_0x44b33e){return new BPromise(function(_0x5acdbc,_0x33ffa8){return client[_0x7ba5('0xd')](_0x39a1cd,_0x44b33e)['then'](function(_0x159e10){logger[_0x7ba5('0xe')](_0x7ba5('0xf'),_0x2ad152,_0x7ba5('0x10'));logger[_0x7ba5('0x11')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x2ad152,_0x7ba5('0x10'),JSON['stringify'](_0x159e10));if(_0x159e10['error']){if(_0x159e10['error']['code']===0x1f4){logger['error'](_0x7ba5('0xf'),_0x2ad152,_0x159e10[_0x7ba5('0x12')][_0x7ba5('0x13')]);return _0x33ffa8(_0x159e10['error'][_0x7ba5('0x13')]);}logger[_0x7ba5('0x12')](_0x7ba5('0xf'),_0x2ad152,_0x159e10[_0x7ba5('0x12')][_0x7ba5('0x13')]);return _0x5acdbc(_0x159e10[_0x7ba5('0x12')][_0x7ba5('0x13')]);}else{logger[_0x7ba5('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x2ad152,_0x7ba5('0x10'));_0x5acdbc(_0x159e10['result']['message']);}})[_0x7ba5('0x14')](function(_0x11426a){logger[_0x7ba5('0x12')](_0x7ba5('0xf'),_0x2ad152,_0x11426a);_0x33ffa8(_0x11426a);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index c6c6208..0c9a2a7 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x266691,_0x1656a4){var _0x213d71=function(_0x494c5d){while(--_0x494c5d){_0x266691['push'](_0x266691['shift']());}};_0x213d71(++_0x1656a4);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x38f92c,_0x51019c){var _0x28c9d5=function(_0x514d76){while(--_0x514d76){_0x38f92c['push'](_0x38f92c['shift']());}};_0x28c9d5(++_0x51019c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 7599201..ee0d0fe 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 _0x3a57=['INTEGER'];(function(_0x54fe4e,_0x153ebc){var _0x21ceae=function(_0x2d907b){while(--_0x2d907b){_0x54fe4e['push'](_0x54fe4e['shift']());}};_0x21ceae(++_0x153ebc);}(_0x3a57,0xaf));var _0x73a5=function(_0x3aafb3,_0x551aa0){_0x3aafb3=_0x3aafb3-0x0;var _0x2999d7=_0x3a57[_0x3aafb3];return _0x2999d7;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x73a5('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc2ad=['sequelize','exports','INTEGER'];(function(_0x401676,_0x3f1436){var _0x4f13fe=function(_0xd2f197){while(--_0xd2f197){_0x401676['push'](_0x401676['shift']());}};_0x4f13fe(++_0x3f1436);}(_0xc2ad,0x1a7));var _0xdc2a=function(_0x359737,_0xe7f6c4){_0x359737=_0x359737-0x0;var _0x5aad9f=_0xc2ad[_0x359737];return _0x5aad9f;};'use strict';var Sequelize=require(_0xdc2a('0x0'));module[_0xdc2a('0x1')]={'penalty':{'type':Sequelize[_0xdc2a('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 f008ad7..0054b7a 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 _0x3214=['user_has_mail_queues','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./userMailQueue.attributes','define','UserMailQueue'];(function(_0x5cbd45,_0x585d90){var _0x365b5d=function(_0x53eafc){while(--_0x53eafc){_0x5cbd45['push'](_0x5cbd45['shift']());}};_0x365b5d(++_0x585d90);}(_0x3214,0xbc));var _0x4321=function(_0x3e42b9,_0x35971e){_0x3e42b9=_0x3e42b9-0x0;var _0x3fa173=_0x3214[_0x3e42b9];return _0x3fa173;};'use strict';var _=require('lodash');var util=require(_0x4321('0x0'));var logger=require(_0x4321('0x1'))(_0x4321('0x2'));var moment=require(_0x4321('0x3'));var BPromise=require(_0x4321('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4321('0x5'));var rimraf=require('rimraf');var config=require(_0x4321('0x6'));var attributes=require(_0x4321('0x7'));module['exports']=function(_0x13a426,_0x2647a1){return _0x13a426[_0x4321('0x8')](_0x4321('0x9'),attributes,{'tableName':_0x4321('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf240=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash','util','../../config/logger','api'];(function(_0x452f5b,_0x5389d1){var _0x33e5e2=function(_0x34b282){while(--_0x34b282){_0x452f5b['push'](_0x452f5b['shift']());}};_0x33e5e2(++_0x5389d1);}(_0xf240,0x14c));var _0x0f24=function(_0x38a6f3,_0x54f77a){_0x38a6f3=_0x38a6f3-0x0;var _0x508b77=_0xf240[_0x38a6f3];return _0x508b77;};'use strict';var _=require(_0x0f24('0x0'));var util=require(_0x0f24('0x1'));var logger=require(_0x0f24('0x2'))(_0x0f24('0x3'));var moment=require(_0x0f24('0x4'));var BPromise=require(_0x0f24('0x5'));var rp=require(_0x0f24('0x6'));var fs=require('fs');var path=require(_0x0f24('0x7'));var rimraf=require(_0x0f24('0x8'));var config=require(_0x0f24('0x9'));var attributes=require(_0x0f24('0xa'));module[_0x0f24('0xb')]=function(_0x25c609,_0x57a664){return _0x25c609[_0x0f24('0xc')]('UserMailQueue',attributes,{'tableName':_0x0f24('0xd'),'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 ce37284..9a68b32 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x56f2f1,_0xa7d5d2){var _0xe1b548=function(_0x11c57f){while(--_0x11c57f){_0x56f2f1['push'](_0x56f2f1['shift']());}};_0xe1b548(++_0xa7d5d2);}(_0xe14b,0x93));var _0xbe14=function(_0x29749a,_0x1d2e64){_0x29749a=_0x29749a-0x0;var _0x2a6fc0=_0xe14b[_0x29749a];return _0x2a6fc0;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file +var _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','UserMailQueue,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x479382,_0x1aa193){var _0x3e0a14=function(_0x11a0af){while(--_0x11a0af){_0x479382['push'](_0x479382['shift']());}};_0x3e0a14(++_0x1aa193);}(_0x3e74,0x175));var _0x43e7=function(_0x206177,_0x28390e){_0x206177=_0x206177-0x0;var _0x18e494=_0x3e74[_0x206177];return _0x18e494;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 2d60f6d..58df671 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 _0x5820=['multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports'];(function(_0x2f2ed5,_0x81d50e){var _0x3b21f5=function(_0x338e04){while(--_0x338e04){_0x2f2ed5['push'](_0x2f2ed5['shift']());}};_0x3b21f5(++_0x81d50e);}(_0x5820,0xf7));var _0x0582=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5820[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0582('0x0'));var util=require(_0x0582('0x1'));var path=require('path');var timeout=require(_0x0582('0x2'));var express=require('express');var router=express[_0x0582('0x3')]();var fs_extra=require(_0x0582('0x4'));var auth=require(_0x0582('0x5'));var interaction=require(_0x0582('0x6'));var config=require(_0x0582('0x7'));var controller=require(_0x0582('0x8'));router[_0x0582('0x9')]('/',auth[_0x0582('0xa')](),controller[_0x0582('0xb')]);module[_0x0582('0xc')]=router; \ No newline at end of file +var _0x63ad=['../../config/environment','./userNotification.controller','isAuthenticated','sendUserNotification','exports','util','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x1931e5,_0x652323){var _0x1f88fc=function(_0x391e86){while(--_0x391e86){_0x1931e5['push'](_0x1931e5['shift']());}};_0x1f88fc(++_0x652323);}(_0x63ad,0xf5));var _0xd63a=function(_0x19f597,_0x53111a){_0x19f597=_0x19f597-0x0;var _0x580869=_0x63ad[_0x19f597];return _0x580869;};'use strict';var multer=require('multer');var util=require(_0xd63a('0x0'));var path=require(_0xd63a('0x1'));var timeout=require('connect-timeout');var express=require(_0xd63a('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd63a('0x3'));var interaction=require(_0xd63a('0x4'));var config=require(_0xd63a('0x5'));var controller=require(_0xd63a('0x6'));router['post']('/',auth[_0xd63a('0x7')](),controller[_0xd63a('0x8')]);module[_0xd63a('0x9')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 7e0f0da..36f25ab 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 _0x2050=['sequelize','STRING','TEXT','BOOLEAN'];(function(_0x4402a3,_0x5a6322){var _0x4a7096=function(_0x2933fe){while(--_0x2933fe){_0x4402a3['push'](_0x4402a3['shift']());}};_0x4a7096(++_0x5a6322);}(_0x2050,0x7c));var _0x0205=function(_0x554eb0,_0x123e96){_0x554eb0=_0x554eb0-0x0;var _0x24e109=_0x2050[_0x554eb0];return _0x24e109;};'use strict';var Sequelize=require(_0x0205('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x0205('0x1')]},'recipientsId':{'type':Sequelize[_0x0205('0x2')]},'recipientsDescription':{'type':Sequelize[_0x0205('0x1')]},'beep':{'type':Sequelize[_0x0205('0x3')]}}; \ No newline at end of file +var _0x8eaf=['TEXT','STRING','sequelize','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8eaf,0x1b2));var _0xf8ea=function(_0x29ccfc,_0x311422){_0x29ccfc=_0x29ccfc-0x0;var _0x4f919b=_0x8eaf[_0x29ccfc];return _0x4f919b;};'use strict';var Sequelize=require(_0xf8ea('0x0'));module[_0xf8ea('0x1')]={'body':{'type':Sequelize[_0xf8ea('0x2')]},'senderName':{'type':Sequelize[_0xf8ea('0x3')]},'recipientsId':{'type':Sequelize[_0xf8ea('0x2')]},'recipientsDescription':{'type':Sequelize[_0xf8ea('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 60bd7ab..9fd07c4 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 _0x69c0=['UserNotification','create','recipient','emit','userNotification:send','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','catch','User','ids','replace','queue','Queue','push','all','flatten','getAgents','map','eml-format','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','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','../../config/license/util','redis','socket.io-emitter','./userNotification.socket','register','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','destroy','then','sendStatus','error','stack','name','send','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','recipients','parse','body','chatqueue','faxqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','sequelize'];(function(_0x421777,_0x5a7b59){var _0x1de9bb=function(_0x3df54c){while(--_0x3df54c){_0x421777['push'](_0x421777['shift']());}};_0x1de9bb(++_0x5a7b59);}(_0x69c0,0xd3));var _0x069c=function(_0x10d52b,_0xc6a4f1){_0x10d52b=_0x10d52b-0x0;var _0x2bf44a=_0x69c0[_0x10d52b];return _0x2bf44a;};'use strict';var emlformat=require(_0x069c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x069c('0x1'));var moment=require(_0x069c('0x2'));var BPromise=require(_0x069c('0x3'));var Mustache=require(_0x069c('0x4'));var util=require(_0x069c('0x5'));var path=require(_0x069c('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x069c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x069c('0x8'));var squel=require('squel');var crypto=require(_0x069c('0x9'));var jsforce=require(_0x069c('0xa'));var deskjs=require(_0x069c('0xb'));var toCsv=require(_0x069c('0xc'));var querystring=require('querystring');var Papa=require(_0x069c('0xd'));var Redis=require(_0x069c('0xe'));var authService=require(_0x069c('0xf'));var qs=require(_0x069c('0x10'));var as=require(_0x069c('0x11'));var hardwareService=require(_0x069c('0x12'));var logger=require('../../config/logger')(_0x069c('0x13'));var utils=require(_0x069c('0x14'));var config=require(_0x069c('0x15'));var licenseUtil=require(_0x069c('0x16'));var db=require('../../mysqldb')['db'];config[_0x069c('0x17')]=_['defaults'](config[_0x069c('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x069c('0x18'))(new Redis(config[_0x069c('0x17')]));require(_0x069c('0x19'))[_0x069c('0x1a')](socket);function respondWithStatusCode(_0x58c695,_0x4a835f){_0x4a835f=_0x4a835f||0xcc;return function(_0x1b10d1){if(_0x1b10d1){return _0x58c695['sendStatus'](_0x4a835f);}return _0x58c695[_0x069c('0x1b')](_0x4a835f)[_0x069c('0x1c')]();};}function respondWithResult(_0x317492,_0x468c68){_0x468c68=_0x468c68||0xc8;return function(_0x55be38){if(_0x55be38){return _0x317492['status'](_0x468c68)[_0x069c('0x1d')](_0x55be38);}};}function respondWithFilteredResult(_0x3836c3,_0x2e36a8){return function(_0x445fbc){if(_0x445fbc){var _0x23f995=typeof _0x2e36a8['offset']===_0x069c('0x1e')&&typeof _0x2e36a8['limit']===_0x069c('0x1e');var _0x570af6=_0x445fbc[_0x069c('0x1f')];var _0x458141=_0x23f995?0x0:_0x2e36a8[_0x069c('0x20')];var _0x44035c=_0x23f995?_0x445fbc[_0x069c('0x1f')]:_0x2e36a8[_0x069c('0x20')]+_0x2e36a8[_0x069c('0x21')];var _0x30164f;if(_0x44035c>=_0x570af6){_0x44035c=_0x570af6;_0x30164f=0xc8;}else{_0x30164f=0xce;}_0x3836c3[_0x069c('0x1b')](_0x30164f);return _0x3836c3[_0x069c('0x22')](_0x069c('0x23'),_0x458141+'-'+_0x44035c+'/'+_0x570af6)[_0x069c('0x1d')](_0x445fbc);}return null;};}function patchUpdates(_0x453432){return function(_0x4211dc){try{jsonpatch[_0x069c('0x24')](_0x4211dc,_0x453432,!![]);}catch(_0x4fcadf){return BPromise['reject'](_0x4fcadf);}return _0x4211dc[_0x069c('0x25')]();};}function saveUpdates(_0x3f8a99,_0x2b3330){return function(_0x312eb5){if(_0x312eb5){return _0x312eb5['update'](_0x3f8a99)['then'](function(_0x4bf13c){return _0x4bf13c;});}return null;};}function removeEntity(_0x4acab0,_0x300c64){return function(_0x55e55d){if(_0x55e55d){return _0x55e55d[_0x069c('0x26')]()[_0x069c('0x27')](function(){_0x4acab0[_0x069c('0x1b')](0xcc)[_0x069c('0x1c')]();});}};}function handleEntityNotFound(_0x565f1d,_0x1cf885){return function(_0x5d07f1){if(!_0x5d07f1){_0x565f1d[_0x069c('0x28')](0x194);}return _0x5d07f1;};}function handleError(_0x562d43,_0xeb2515){_0xeb2515=_0xeb2515||0x1f4;return function(_0x431d40){logger[_0x069c('0x29')](_0x431d40[_0x069c('0x2a')]);if(_0x431d40[_0x069c('0x2b')]){delete _0x431d40[_0x069c('0x2b')];}_0x562d43[_0x069c('0x1b')](_0xeb2515)[_0x069c('0x2c')](_0x431d40);};}exports['sendUserNotification']=function(_0x9ab925,_0x4d3f0c,_0x2f143a){if(!_0x9ab925['body'][_0x069c('0x2d')](_0x069c('0x2e'))&&!_0x9ab925['body'][_0x069c('0x2d')](_0x069c('0x2f'))){throw new db[(_0x069c('0x30'))][(_0x069c('0x31'))](_0x069c('0x32'));}else{if(_0x9ab925['body']['hasOwnProperty']('TemplateId')&&!_0x9ab925['body'][_0x069c('0x2d')](_0x069c('0x33'))){throw new db[(_0x069c('0x30'))][(_0x069c('0x31'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x9ab925['body']['hasOwnProperty'](_0x069c('0x34'))){throw new db[(_0x069c('0x30'))][(_0x069c('0x31'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x5bd962=JSON[_0x069c('0x35')](_0x9ab925[_0x069c('0x36')][_0x069c('0x34')]);}catch(_0x583bc4){logger[_0x069c('0x29')](_0x583bc4);throw new db[(_0x069c('0x30'))][(_0x069c('0x31'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x144457=[_0x069c('0x37'),_0x069c('0x38'),'mailqueue',_0x069c('0x39'),'smsqueue',_0x069c('0x3a'),_0x069c('0x3b'),_0x069c('0x3c'),_0x069c('0x3d')];if(_[_0x069c('0x3e')](_0x5bd962,function(_0x464299){return!_[_0x069c('0x3f')](_0x144457,_0x464299[_0x069c('0x40')][_0x069c('0x41')]());})){throw new db[(_0x069c('0x30'))][(_0x069c('0x31'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x4f8e99={};_0x4f8e99['senderName']=_0x9ab925['body']['hasOwnProperty'](_0x069c('0x42'))?_0x9ab925['body'][_0x069c('0x42')]:_0x9ab925[_0x069c('0x3d')][_0x069c('0x43')];_0x4f8e99[_0x069c('0x44')]=_['isEmpty'](_0x9ab925[_0x069c('0x36')][_0x069c('0x44')])?null:_0x9ab925[_0x069c('0x36')][_0x069c('0x44')];_0x4f8e99[_0x069c('0x45')]=_0x9ab925[_0x069c('0x36')][_0x069c('0x45')]||![];_0x4f8e99[_0x069c('0x46')]=_0x9ab925[_0x069c('0x3d')]['id'];return getContent(_0x9ab925[_0x069c('0x36')])['then'](function(_0xc9b56d){_0x4f8e99['body']=_0xc9b56d;return getRecipients(_0x5bd962);})[_0x069c('0x27')](function(_0x5818dc){_0x4f8e99[_0x069c('0x47')]=_[_0x069c('0x48')](_0x5818dc)['join'](',');return db[_0x069c('0x49')]['transaction'](function(_0x24c6eb){return db[_0x069c('0x4a')][_0x069c('0x4b')](_0x4f8e99,{'raw':!![],'transaction':_0x24c6eb})[_0x069c('0x27')](function(_0x379e6d){var _0x3f6ac9={'sender':_0x4f8e99[_0x069c('0x42')],'description':_0x4f8e99[_0x069c('0x44')],'content':_0x4f8e99[_0x069c('0x36')],'beep':_0x4f8e99[_0x069c('0x45')]};_0x5818dc['forEach'](function(_0x28f13b){_0x3f6ac9[_0x069c('0x4c')]=_0x28f13b;socket[_0x069c('0x4d')](_0x069c('0x4e'),_0x3f6ac9);});return _0x379e6d;});});})[_0x069c('0x27')](respondWithResult(_0x4d3f0c,0xc9))['catch'](handleError(_0x4d3f0c,null));};function getContent(_0x22a386){return new BPromise(function(_0xc93183,_0x588a8c){if(_0x22a386[_0x069c('0x2e')]){_0xc93183(_0x22a386['text']);return;}return db[_0x069c('0x4f')][_0x069c('0x50')]({'attributes':['html'],'where':{'id':_0x22a386[_0x069c('0x2f')]},'raw':!![]})['then'](function(_0x23a0a7){if(!_0x23a0a7)throw new db['Sequelize'][(_0x069c('0x31'))](_0x069c('0x51'));var _0x4eb13=Mustache[_0x069c('0x52')](_0x23a0a7[_0x069c('0x53')],_0x22a386[_0x069c('0x33')]);_0xc93183(_0x4eb13);})[_0x069c('0x54')](function(_0xb460c3){_0x588a8c(_0xb460c3);});});}function getRecipients(_0x103c34){return new BPromise(function(_0x40dd1c,_0x276129){var _0x1206bd=[];var _0x464070=[];_0x103c34['forEach'](function(_0x553f6b){var _0x4857a5=_['startCase'](_0x553f6b['model']['toLowerCase']());if(_0x4857a5===_0x069c('0x55')){_0x1206bd=_['union'](_0x1206bd,_0x553f6b[_0x069c('0x56')]);}else{if(_[_0x069c('0x3f')](_0x4857a5,'queue'))_0x4857a5=_0x4857a5[_0x069c('0x57')](_0x069c('0x58'),_0x069c('0x59'));_0x553f6b[_0x069c('0x56')]['forEach'](function(_0x960591){_0x464070[_0x069c('0x5a')](getAgents(_0x4857a5,_0x960591));});}});return BPromise[_0x069c('0x5b')](_0x464070)[_0x069c('0x27')](function(_0x3c4361){_0x1206bd=_['union'](_0x1206bd,_[_0x069c('0x5c')](_0x3c4361));_0x40dd1c(_0x1206bd);})[_0x069c('0x54')](function(_0x2ee4ec){_0x276129(_0x2ee4ec);});});}function getAgents(_0x4b2105,_0x5ebf3c){return new BPromise(function(_0x3a77c2,_0x469879){return db[_0x4b2105]['findOne']({'where':{'id':_0x5ebf3c}})[_0x069c('0x27')](function(_0x131f79){return _0x131f79[_0x069c('0x5d')]({'attributes':['id'],'raw':!![]})[_0x069c('0x27')](function(_0x5bbb5e){var _0xf12564=_[_0x069c('0x5e')](_0x5bbb5e,'id');_0x3a77c2(_0xf12564);});})[_0x069c('0x54')](function(_0x31df14){_0x469879(_0x31df14);});});} \ No newline at end of file +var _0x7d4b=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sequelize','create','recipient','emit','userNotification:send','catch','Template','findOne','html','render','forEach','User','union','ids','includes','queue','replace','Queue','push','all','getAgents','map','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x59c683,_0x209444){var _0x47251b=function(_0x4db046){while(--_0x4db046){_0x59c683['push'](_0x59c683['shift']());}};_0x47251b(++_0x209444);}(_0x7d4b,0x120));var _0xb7d4=function(_0x25b8cc,_0xe667ec){_0x25b8cc=_0x25b8cc-0x0;var _0x94a85e=_0x7d4b[_0x25b8cc];return _0x94a85e;};'use strict';var emlformat=require(_0xb7d4('0x0'));var rimraf=require(_0xb7d4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb7d4('0x2'));var rp=require(_0xb7d4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb7d4('0x4'));var util=require(_0xb7d4('0x5'));var path=require(_0xb7d4('0x6'));var sox=require(_0xb7d4('0x7'));var csv=require('to-csv');var ejs=require(_0xb7d4('0x8'));var fs=require('fs');var fs_extra=require(_0xb7d4('0x9'));var _=require(_0xb7d4('0xa'));var squel=require(_0xb7d4('0xb'));var crypto=require(_0xb7d4('0xc'));var jsforce=require(_0xb7d4('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb7d4('0xe'));var Papa=require('papaparse');var Redis=require(_0xb7d4('0xf'));var authService=require(_0xb7d4('0x10'));var qs=require(_0xb7d4('0x11'));var as=require(_0xb7d4('0x12'));var hardwareService=require(_0xb7d4('0x13'));var logger=require(_0xb7d4('0x14'))(_0xb7d4('0x15'));var utils=require(_0xb7d4('0x16'));var config=require(_0xb7d4('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb7d4('0x18'))['db'];config[_0xb7d4('0x19')]=_['defaults'](config['redis'],{'host':_0xb7d4('0x1a'),'port':0x18eb});var socket=require(_0xb7d4('0x1b'))(new Redis(config[_0xb7d4('0x19')]));require(_0xb7d4('0x1c'))[_0xb7d4('0x1d')](socket);function respondWithStatusCode(_0xe10546,_0x5efb51){_0x5efb51=_0x5efb51||0xcc;return function(_0x3e6d90){if(_0x3e6d90){return _0xe10546[_0xb7d4('0x1e')](_0x5efb51);}return _0xe10546[_0xb7d4('0x1f')](_0x5efb51)[_0xb7d4('0x20')]();};}function respondWithResult(_0x4b14e8,_0x28267c){_0x28267c=_0x28267c||0xc8;return function(_0x30557a){if(_0x30557a){return _0x4b14e8[_0xb7d4('0x1f')](_0x28267c)[_0xb7d4('0x21')](_0x30557a);}};}function respondWithFilteredResult(_0x26dc3c,_0x805fe3){return function(_0x29f4e6){if(_0x29f4e6){var _0x189d84=typeof _0x805fe3[_0xb7d4('0x22')]===_0xb7d4('0x23')&&typeof _0x805fe3[_0xb7d4('0x24')]===_0xb7d4('0x23');var _0x30d092=_0x29f4e6['count'];var _0x5d4dd0=_0x189d84?0x0:_0x805fe3[_0xb7d4('0x22')];var _0x5b5cc5=_0x189d84?_0x29f4e6[_0xb7d4('0x25')]:_0x805fe3[_0xb7d4('0x22')]+_0x805fe3[_0xb7d4('0x24')];var _0x413d48;if(_0x5b5cc5>=_0x30d092){_0x5b5cc5=_0x30d092;_0x413d48=0xc8;}else{_0x413d48=0xce;}_0x26dc3c['status'](_0x413d48);return _0x26dc3c[_0xb7d4('0x26')]('Content-Range',_0x5d4dd0+'-'+_0x5b5cc5+'/'+_0x30d092)[_0xb7d4('0x21')](_0x29f4e6);}return null;};}function patchUpdates(_0x46ce1a){return function(_0x3ed018){try{jsonpatch['apply'](_0x3ed018,_0x46ce1a,!![]);}catch(_0xe97a11){return BPromise[_0xb7d4('0x27')](_0xe97a11);}return _0x3ed018[_0xb7d4('0x28')]();};}function saveUpdates(_0x4d163c,_0x1a21fb){return function(_0x40737e){if(_0x40737e){return _0x40737e[_0xb7d4('0x29')](_0x4d163c)['then'](function(_0x5dd864){return _0x5dd864;});}return null;};}function removeEntity(_0x4d2d8a,_0x25b5af){return function(_0x51578a){if(_0x51578a){return _0x51578a[_0xb7d4('0x2a')]()[_0xb7d4('0x2b')](function(){_0x4d2d8a['status'](0xcc)[_0xb7d4('0x20')]();});}};}function handleEntityNotFound(_0x1a5505,_0x1a8082){return function(_0x1ca33e){if(!_0x1ca33e){_0x1a5505[_0xb7d4('0x1e')](0x194);}return _0x1ca33e;};}function handleError(_0x402b69,_0x5c6862){_0x5c6862=_0x5c6862||0x1f4;return function(_0x2d6360){logger[_0xb7d4('0x2c')](_0x2d6360[_0xb7d4('0x2d')]);if(_0x2d6360[_0xb7d4('0x2e')]){delete _0x2d6360['name'];}_0x402b69[_0xb7d4('0x1f')](_0x5c6862)[_0xb7d4('0x2f')](_0x2d6360);};}exports[_0xb7d4('0x30')]=function(_0x3f0bd0,_0x16a4b8,_0xdf8c5c){if(!_0x3f0bd0[_0xb7d4('0x31')][_0xb7d4('0x32')](_0xb7d4('0x33'))&&!_0x3f0bd0[_0xb7d4('0x31')][_0xb7d4('0x32')]('TemplateId')){throw new db['Sequelize'][(_0xb7d4('0x34'))](_0xb7d4('0x35'));}else{if(_0x3f0bd0[_0xb7d4('0x31')]['hasOwnProperty'](_0xb7d4('0x36'))&&!_0x3f0bd0[_0xb7d4('0x31')][_0xb7d4('0x32')](_0xb7d4('0x37'))){throw new db[(_0xb7d4('0x38'))][(_0xb7d4('0x34'))](_0xb7d4('0x39'));}if(!_0x3f0bd0[_0xb7d4('0x31')]['hasOwnProperty'](_0xb7d4('0x3a'))){throw new db[(_0xb7d4('0x38'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x5805b7=JSON[_0xb7d4('0x3b')](_0x3f0bd0[_0xb7d4('0x31')][_0xb7d4('0x3a')]);}catch(_0x419676){logger[_0xb7d4('0x2c')](_0x419676);throw new db[(_0xb7d4('0x38'))][(_0xb7d4('0x34'))](_0xb7d4('0x3c'));}var _0x245202=['chatqueue',_0xb7d4('0x3d'),_0xb7d4('0x3e'),_0xb7d4('0x3f'),_0xb7d4('0x40'),_0xb7d4('0x41'),_0xb7d4('0x42'),_0xb7d4('0x43'),_0xb7d4('0x44')];if(_[_0xb7d4('0x45')](_0x5805b7,function(_0x13db91){return!_['includes'](_0x245202,_0x13db91[_0xb7d4('0x46')][_0xb7d4('0x47')]());})){throw new db['Sequelize'][(_0xb7d4('0x34'))](_0xb7d4('0x48'));}}}var _0x4f2781={};_0x4f2781[_0xb7d4('0x49')]=_0x3f0bd0['body'][_0xb7d4('0x32')](_0xb7d4('0x49'))?_0x3f0bd0[_0xb7d4('0x31')]['senderName']:_0x3f0bd0['user'][_0xb7d4('0x4a')];_0x4f2781[_0xb7d4('0x4b')]=_[_0xb7d4('0x4c')](_0x3f0bd0[_0xb7d4('0x31')][_0xb7d4('0x4b')])?null:_0x3f0bd0[_0xb7d4('0x31')][_0xb7d4('0x4b')];_0x4f2781[_0xb7d4('0x4d')]=_0x3f0bd0[_0xb7d4('0x31')][_0xb7d4('0x4d')]||![];_0x4f2781[_0xb7d4('0x4e')]=_0x3f0bd0[_0xb7d4('0x44')]['id'];return getContent(_0x3f0bd0['body'])[_0xb7d4('0x2b')](function(_0x550df8){_0x4f2781[_0xb7d4('0x31')]=_0x550df8;return getRecipients(_0x5805b7);})['then'](function(_0x1c5a86){_0x4f2781[_0xb7d4('0x4f')]=_['sortBy'](_0x1c5a86)['join'](',');return db[_0xb7d4('0x50')]['transaction'](function(_0x445238){return db['UserNotification'][_0xb7d4('0x51')](_0x4f2781,{'raw':!![],'transaction':_0x445238})[_0xb7d4('0x2b')](function(_0x2af160){var _0x1503df={'sender':_0x4f2781[_0xb7d4('0x49')],'description':_0x4f2781[_0xb7d4('0x4b')],'content':_0x4f2781[_0xb7d4('0x31')],'beep':_0x4f2781[_0xb7d4('0x4d')]};_0x1c5a86['forEach'](function(_0x233d33){_0x1503df[_0xb7d4('0x52')]=_0x233d33;socket[_0xb7d4('0x53')](_0xb7d4('0x54'),_0x1503df);});return _0x2af160;});});})[_0xb7d4('0x2b')](respondWithResult(_0x16a4b8,0xc9))[_0xb7d4('0x55')](handleError(_0x16a4b8,null));};function getContent(_0x28642b){return new BPromise(function(_0x1628c6,_0x56e0fa){if(_0x28642b['text']){_0x1628c6(_0x28642b[_0xb7d4('0x33')]);return;}return db[_0xb7d4('0x56')][_0xb7d4('0x57')]({'attributes':[_0xb7d4('0x58')],'where':{'id':_0x28642b[_0xb7d4('0x36')]},'raw':!![]})['then'](function(_0x46c119){if(!_0x46c119)throw new db[(_0xb7d4('0x38'))][(_0xb7d4('0x34'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x35ad97=Mustache[_0xb7d4('0x59')](_0x46c119[_0xb7d4('0x58')],_0x28642b[_0xb7d4('0x37')]);_0x1628c6(_0x35ad97);})[_0xb7d4('0x55')](function(_0x222baf){_0x56e0fa(_0x222baf);});});}function getRecipients(_0x394487){return new BPromise(function(_0x559e30,_0x72d99a){var _0x93a5f1=[];var _0x1fe67a=[];_0x394487[_0xb7d4('0x5a')](function(_0x524913){var _0x18cc31=_['startCase'](_0x524913[_0xb7d4('0x46')][_0xb7d4('0x47')]());if(_0x18cc31===_0xb7d4('0x5b')){_0x93a5f1=_[_0xb7d4('0x5c')](_0x93a5f1,_0x524913[_0xb7d4('0x5d')]);}else{if(_[_0xb7d4('0x5e')](_0x18cc31,_0xb7d4('0x5f')))_0x18cc31=_0x18cc31[_0xb7d4('0x60')]('queue',_0xb7d4('0x61'));_0x524913[_0xb7d4('0x5d')][_0xb7d4('0x5a')](function(_0x59dbca){_0x1fe67a[_0xb7d4('0x62')](getAgents(_0x18cc31,_0x59dbca));});}});return BPromise[_0xb7d4('0x63')](_0x1fe67a)[_0xb7d4('0x2b')](function(_0x34c490){_0x93a5f1=_[_0xb7d4('0x5c')](_0x93a5f1,_['flatten'](_0x34c490));_0x559e30(_0x93a5f1);})[_0xb7d4('0x55')](function(_0x4dd1fc){_0x72d99a(_0x4dd1fc);});});}function getAgents(_0x51969f,_0x575bfc){return new BPromise(function(_0x50f126,_0x346963){return db[_0x51969f][_0xb7d4('0x57')]({'where':{'id':_0x575bfc}})[_0xb7d4('0x2b')](function(_0x44f051){return _0x44f051[_0xb7d4('0x64')]({'attributes':['id'],'raw':!![]})['then'](function(_0x34e608){var _0xd71c8b=_[_0xb7d4('0x65')](_0x34e608,'id');_0x50f126(_0xd71c8b);});})[_0xb7d4('0x55')](function(_0x219598){_0x346963(_0x219598);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index df81da1..6cdbae8 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 _0xcc8b=['exports','events','UserNotification','setMaxListeners','update','emit','hook'];(function(_0x16e605,_0xf3d60b){var _0x3e64cd=function(_0x4ee310){while(--_0x4ee310){_0x16e605['push'](_0x16e605['shift']());}};_0x3e64cd(++_0xf3d60b);}(_0xcc8b,0x1f2));var _0xbcc8=function(_0x653b47,_0x52af9c){_0x653b47=_0x653b47-0x0;var _0x1f9e32=_0xcc8b[_0x653b47];return _0x1f9e32;};'use strict';var EventEmitter=require(_0xbcc8('0x0'));var UserNotification=require('../../mysqldb')['db'][_0xbcc8('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xbcc8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbcc8('0x3'),'afterDestroy':'remove'};function emitEvent(_0x173a5b){return function(_0x32f913,_0x18cf6c,_0x1741e8){UserNotificationEvents[_0xbcc8('0x4')](_0x173a5b+':'+_0x32f913['id'],_0x32f913);UserNotificationEvents['emit'](_0x173a5b,_0x32f913);_0x1741e8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xbcc8('0x5')](e,emitEvent(event));}}module[_0xbcc8('0x6')]=UserNotificationEvents; \ No newline at end of file +var _0xcf38=['save','update','remove','emit','hasOwnProperty','events','UserNotification','setMaxListeners'];(function(_0x1ca37a,_0x4bcaf3){var _0x32407b=function(_0x3cb2f4){while(--_0x3cb2f4){_0x1ca37a['push'](_0x1ca37a['shift']());}};_0x32407b(++_0x4bcaf3);}(_0xcf38,0x145));var _0x8cf3=function(_0x258c0c,_0x36b1b0){_0x258c0c=_0x258c0c-0x0;var _0x37162b=_0xcf38[_0x258c0c];return _0x37162b;};'use strict';var EventEmitter=require(_0x8cf3('0x0'));var UserNotification=require('../../mysqldb')['db'][_0x8cf3('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x8cf3('0x2')](0x0);var events={'afterCreate':_0x8cf3('0x3'),'afterUpdate':_0x8cf3('0x4'),'afterDestroy':_0x8cf3('0x5')};function emitEvent(_0x482915){return function(_0x5458d5,_0x130fa1,_0x3df6f1){UserNotificationEvents[_0x8cf3('0x6')](_0x482915+':'+_0x5458d5['id'],_0x5458d5);UserNotificationEvents[_0x8cf3('0x6')](_0x482915,_0x5458d5);_0x3df6f1(null);};}for(var e in events){if(events[_0x8cf3('0x7')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 07a3105..1a629c7 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 _0x675e=['api','moment','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','define','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x675e,0x18a));var _0xe675=function(_0x208d75,_0x92d742){_0x208d75=_0x208d75-0x0;var _0x382d27=_0x675e[_0x208d75];return _0x382d27;};'use strict';var _=require('lodash');var util=require(_0xe675('0x0'));var logger=require(_0xe675('0x1'))(_0xe675('0x2'));var moment=require(_0xe675('0x3'));var BPromise=require('bluebird');var rp=require(_0xe675('0x4'));var fs=require('fs');var path=require(_0xe675('0x5'));var rimraf=require(_0xe675('0x6'));var config=require(_0xe675('0x7'));var attributes=require(_0xe675('0x8'));module['exports']=function(_0x2c69f0,_0x1152e3){return _0x2c69f0[_0xe675('0x9')]('UserNotification',attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe675('0xa'),'collate':_0xe675('0xb')});}; \ No newline at end of file +var _0x8645=['exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./userNotification.attributes'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x8645,0xca));var _0x5864=function(_0x3ace35,_0x11dfa8){_0x3ace35=_0x3ace35-0x0;var _0x1af13d=_0x8645[_0x3ace35];return _0x1af13d;};'use strict';var _=require(_0x5864('0x0'));var util=require('util');var logger=require(_0x5864('0x1'))('api');var moment=require(_0x5864('0x2'));var BPromise=require(_0x5864('0x3'));var rp=require(_0x5864('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5864('0x5'));var config=require(_0x5864('0x6'));var attributes=require(_0x5864('0x7'));module[_0x5864('0x8')]=function(_0x620e96,_0x16a1cb){return _0x620e96[_0x5864('0x9')](_0x5864('0xa'),attributes,{'tableName':_0x5864('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5864('0xc'),'collate':_0x5864('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index ae5649e..25a6f65 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 _0x6ecd=['UserNotification,\x20%s,\x20%s,\x20%s','stringify','code','error','message','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1d88e5,_0x169a73){var _0x3e0722=function(_0x48b214){while(--_0x48b214){_0x1d88e5['push'](_0x1d88e5['shift']());}};_0x3e0722(++_0x169a73);}(_0x6ecd,0xec));var _0xd6ec=function(_0xec9516,_0x866a8e){_0xec9516=_0xec9516-0x0;var _0x4fee75=_0x6ecd[_0xec9516];return _0x4fee75;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd6ec('0x0'));var BPromise=require(_0xd6ec('0x1'));var rs=require(_0xd6ec('0x2'));var fs=require('fs');var Redis=require(_0xd6ec('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd6ec('0x4'));var logger=require(_0xd6ec('0x5'))(_0xd6ec('0x6'));var config=require(_0xd6ec('0x7'));var jayson=require(_0xd6ec('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xd6ec('0x9')]=_[_0xd6ec('0xa')](config[_0xd6ec('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd6ec('0x9')]));require('./userNotification.socket')['register'](socket);function respondWithRpcPromise(_0x4254aa,_0x134752,_0x43c6ea){return new BPromise(function(_0x243ce0,_0x17c844){return client[_0xd6ec('0xb')](_0x4254aa,_0x43c6ea)['then'](function(_0x28ab57){logger[_0xd6ec('0xc')](_0xd6ec('0xd'),_0x134752,_0xd6ec('0xe'));logger[_0xd6ec('0xf')](_0xd6ec('0x10'),_0x134752,_0xd6ec('0xe'),JSON[_0xd6ec('0x11')](_0x28ab57));if(_0x28ab57['error']){if(_0x28ab57['error'][_0xd6ec('0x12')]===0x1f4){logger[_0xd6ec('0x13')](_0xd6ec('0xd'),_0x134752,_0x28ab57['error'][_0xd6ec('0x14')]);return _0x17c844(_0x28ab57[_0xd6ec('0x13')][_0xd6ec('0x14')]);}logger[_0xd6ec('0x13')](_0xd6ec('0xd'),_0x134752,_0x28ab57[_0xd6ec('0x13')][_0xd6ec('0x14')]);return _0x243ce0(_0x28ab57[_0xd6ec('0x13')][_0xd6ec('0x14')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x134752,'request\x20sent');_0x243ce0(_0x28ab57['result']['message']);}})['catch'](function(_0x4183cd){logger[_0xd6ec('0x13')]('UserNotification,\x20%s,\x20%s',_0x134752,_0x4183cd);_0x17c844(_0x4183cd);});});} \ No newline at end of file +var _0x0dcc=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','request','then','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','UserNotification,\x20%s,\x20%s','message','info','result'];(function(_0x48da37,_0x2e3acd){var _0x382954=function(_0x191e2c){while(--_0x191e2c){_0x48da37['push'](_0x48da37['shift']());}};_0x382954(++_0x2e3acd);}(_0x0dcc,0x1a9));var _0xc0dc=function(_0x396cc2,_0x24c934){_0x396cc2=_0x396cc2-0x0;var _0x273cb6=_0x0dcc[_0x396cc2];return _0x273cb6;};'use strict';var _=require(_0xc0dc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc0dc('0x1'));var rs=require(_0xc0dc('0x2'));var fs=require('fs');var Redis=require(_0xc0dc('0x3'));var db=require(_0xc0dc('0x4'))['db'];var utils=require(_0xc0dc('0x5'));var logger=require(_0xc0dc('0x6'))('rpc');var config=require(_0xc0dc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc0dc('0x8')][_0xc0dc('0x9')]({'port':0x232a});config[_0xc0dc('0xa')]=_[_0xc0dc('0xb')](config[_0xc0dc('0xa')],{'host':_0xc0dc('0xc'),'port':0x18eb});var socket=require(_0xc0dc('0xd'))(new Redis(config[_0xc0dc('0xa')]));require(_0xc0dc('0xe'))['register'](socket);function respondWithRpcPromise(_0x36d432,_0x39561b,_0x2d3a38){return new BPromise(function(_0x59aabb,_0x5cf8f3){return client[_0xc0dc('0xf')](_0x36d432,_0x2d3a38)[_0xc0dc('0x10')](function(_0x3420c2){logger['info']('UserNotification,\x20%s,\x20%s',_0x39561b,_0xc0dc('0x11'));logger[_0xc0dc('0x12')](_0xc0dc('0x13'),_0x39561b,_0xc0dc('0x11'),JSON['stringify'](_0x3420c2));if(_0x3420c2[_0xc0dc('0x14')]){if(_0x3420c2[_0xc0dc('0x14')]['code']===0x1f4){logger[_0xc0dc('0x14')](_0xc0dc('0x15'),_0x39561b,_0x3420c2['error'][_0xc0dc('0x16')]);return _0x5cf8f3(_0x3420c2[_0xc0dc('0x14')][_0xc0dc('0x16')]);}logger[_0xc0dc('0x14')](_0xc0dc('0x15'),_0x39561b,_0x3420c2['error'][_0xc0dc('0x16')]);return _0x59aabb(_0x3420c2[_0xc0dc('0x14')][_0xc0dc('0x16')]);}else{logger[_0xc0dc('0x17')]('UserNotification,\x20%s,\x20%s',_0x39561b,_0xc0dc('0x11'));_0x59aabb(_0x3420c2[_0xc0dc('0x18')][_0xc0dc('0x16')]);}})['catch'](function(_0x155bd5){logger[_0xc0dc('0x14')](_0xc0dc('0x15'),_0x39561b,_0x155bd5);_0x5cf8f3(_0x155bd5);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 594a1c2..de8ee77 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 _0x67b3=['update','emit','removeListener','register','userNotification:','./userNotification.events','save'];(function(_0xd44b84,_0x1caf09){var _0x5c71fc=function(_0x1d50d0){while(--_0x1d50d0){_0xd44b84['push'](_0xd44b84['shift']());}};_0x5c71fc(++_0x1caf09);}(_0x67b3,0xde));var _0x367b=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x67b3[_0x485b5a];return _0xd2b34d;};'use strict';var UserNotificationEvents=require(_0x367b('0x0'));var events=[_0x367b('0x1'),'remove',_0x367b('0x2')];function createListener(_0x5045e2,_0x4839d6){return function(_0x3ef09d){_0x4839d6[_0x367b('0x3')](_0x5045e2,_0x3ef09d);};}function removeListener(_0x699f0a,_0x18d9d6){return function(){UserNotificationEvents[_0x367b('0x4')](_0x699f0a,_0x18d9d6);};}exports[_0x367b('0x5')]=function(_0x479cd5){for(var _0x23366b=0x0,_0x5d8d33=events['length'];_0x23366b<_0x5d8d33;_0x23366b++){var _0x46f359=events[_0x23366b];var _0x31f99b=createListener(_0x367b('0x6')+_0x46f359,_0x479cd5);UserNotificationEvents['on'](_0x46f359,_0x31f99b);}}; \ No newline at end of file +var _0x6b74=['emit','length','./userNotification.events','remove','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6b74,0x70));var _0x46b7=function(_0x4d8dc3,_0x585fd1){_0x4d8dc3=_0x4d8dc3-0x0;var _0x9b03d9=_0x6b74[_0x4d8dc3];return _0x9b03d9;};'use strict';var UserNotificationEvents=require(_0x46b7('0x0'));var events=['save',_0x46b7('0x1'),_0x46b7('0x2')];function createListener(_0x555f3a,_0x475d1c){return function(_0x73b8fa){_0x475d1c[_0x46b7('0x3')](_0x555f3a,_0x73b8fa);};}function removeListener(_0x4f4a79,_0x466829){return function(){UserNotificationEvents['removeListener'](_0x4f4a79,_0x466829);};}exports['register']=function(_0x3a9741){for(var _0x495f3a=0x0,_0x4377ab=events[_0x46b7('0x4')];_0x495f3a<_0x4377ab;_0x495f3a++){var _0x4e416c=events[_0x495f3a];var _0x720009=createListener('userNotification:'+_0x4e416c,_0x3a9741);UserNotificationEvents['on'](_0x4e416c,_0x720009);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index a0025a7..c48b767 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(_0x12d100,_0x516db1){var _0x114e3b=function(_0x2f92e8){while(--_0x2f92e8){_0x12d100['push'](_0x12d100['shift']());}};_0x114e3b(++_0x516db1);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4d82ea,_0x4d459f){_0x4d82ea=_0x4d82ea-0x0;var _0x257f4a=_0xcb91[_0x4d82ea];return _0x257f4a;};'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(_0x29400a,_0x24ffaf){var _0x50cb49=function(_0x576cea){while(--_0x576cea){_0x29400a['push'](_0x29400a['shift']());}};_0x50cb49(++_0x24ffaf);}(_0xe706,0xa3));var _0x6e70=function(_0x49c68e,_0x1c1673){_0x49c68e=_0x49c68e-0x0;var _0x33032b=_0xe706[_0x49c68e];return _0x33032b;};'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 e15f72b..9cbd053 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 _0xe1ce=['exports','INTEGER','sequelize'];(function(_0x41ea32,_0x14162e){var _0x137ae9=function(_0x3f8784){while(--_0x3f8784){_0x41ea32['push'](_0x41ea32['shift']());}};_0x137ae9(++_0x14162e);}(_0xe1ce,0x15e));var _0xee1c=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0xe1ce[_0x47a349];return _0x18ab75;};'use strict';var Sequelize=require(_0xee1c('0x0'));module[_0xee1c('0x1')]={'penalty':{'type':Sequelize[_0xee1c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd2e5=['exports','INTEGER'];(function(_0x54b141,_0x270c14){var _0x2122c1=function(_0x4d492d){while(--_0x4d492d){_0x54b141['push'](_0x54b141['shift']());}};_0x2122c1(++_0x270c14);}(_0xd2e5,0x1cc));var _0x5d2e=function(_0x1d0b80,_0x41fc24){_0x1d0b80=_0x1d0b80-0x0;var _0x35d642=_0xd2e5[_0x1d0b80];return _0x35d642;};'use strict';var Sequelize=require('sequelize');module[_0x5d2e('0x0')]={'penalty':{'type':Sequelize[_0x5d2e('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 f1a8202..cec4de4 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 _0x8634=['./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment'];(function(_0x199bc4,_0x338105){var _0x136ffb=function(_0x3e7ced){while(--_0x3e7ced){_0x199bc4['push'](_0x199bc4['shift']());}};_0x136ffb(++_0x338105);}(_0x8634,0x143));var _0x4863=function(_0x7148a3,_0x1c6652){_0x7148a3=_0x7148a3-0x0;var _0x52f31d=_0x8634[_0x7148a3];return _0x52f31d;};'use strict';var _=require(_0x4863('0x0'));var util=require(_0x4863('0x1'));var logger=require(_0x4863('0x2'))(_0x4863('0x3'));var moment=require('moment');var BPromise=require(_0x4863('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4863('0x5'));var config=require(_0x4863('0x6'));var attributes=require(_0x4863('0x7'));module[_0x4863('0x8')]=function(_0x365393,_0x494572){return _0x365393['define'](_0x4863('0x9'),attributes,{'tableName':_0x4863('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a8e=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x0a8e,0xc3));var _0xe0a8=function(_0x3459dd,_0x424712){_0x3459dd=_0x3459dd-0x0;var _0x20797e=_0x0a8e[_0x3459dd];return _0x20797e;};'use strict';var _=require(_0xe0a8('0x0'));var util=require(_0xe0a8('0x1'));var logger=require('../../config/logger')(_0xe0a8('0x2'));var moment=require(_0xe0a8('0x3'));var BPromise=require(_0xe0a8('0x4'));var rp=require(_0xe0a8('0x5'));var fs=require('fs');var path=require(_0xe0a8('0x6'));var rimraf=require(_0xe0a8('0x7'));var config=require(_0xe0a8('0x8'));var attributes=require(_0xe0a8('0x9'));module['exports']=function(_0x3cc188,_0x3b5352){return _0x3cc188[_0xe0a8('0xa')](_0xe0a8('0xb'),attributes,{'tableName':_0xe0a8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 54ab8ba..1d757cb 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 _0x3379=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','util'];(function(_0x4f16a2,_0x2acb39){var _0x4e625e=function(_0x1c8daf){while(--_0x1c8daf){_0x4f16a2['push'](_0x4f16a2['shift']());}};_0x4e625e(++_0x2acb39);}(_0x3379,0xfb));var _0x9337=function(_0x39a40e,_0x369e5c){_0x39a40e=_0x39a40e-0x0;var _0x5cf7e5=_0x3379[_0x39a40e];return _0x5cf7e5;};'use strict';var _=require(_0x9337('0x0'));var util=require(_0x9337('0x1'));var moment=require(_0x9337('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9337('0x3'));var db=require(_0x9337('0x4'))['db'];var utils=require(_0x9337('0x5'));var logger=require(_0x9337('0x6'))(_0x9337('0x7'));var config=require(_0x9337('0x8'));var jayson=require(_0x9337('0x9'));var client=jayson[_0x9337('0xa')][_0x9337('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1571e3,_0x2903d3,_0x2338ed){return new BPromise(function(_0x275a0a,_0x599225){return client[_0x9337('0xc')](_0x1571e3,_0x2338ed)[_0x9337('0xd')](function(_0xcefe65){logger[_0x9337('0xe')](_0x9337('0xf'),_0x2903d3,'request\x20sent');logger[_0x9337('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x2903d3,_0x9337('0x11'),JSON[_0x9337('0x12')](_0xcefe65));if(_0xcefe65[_0x9337('0x13')]){if(_0xcefe65[_0x9337('0x13')][_0x9337('0x14')]===0x1f4){logger['error'](_0x9337('0xf'),_0x2903d3,_0xcefe65[_0x9337('0x13')][_0x9337('0x15')]);return _0x599225(_0xcefe65[_0x9337('0x13')]['message']);}logger[_0x9337('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2903d3,_0xcefe65[_0x9337('0x13')][_0x9337('0x15')]);return _0x275a0a(_0xcefe65['error']['message']);}else{logger['info'](_0x9337('0xf'),_0x2903d3,_0x9337('0x11'));_0x275a0a(_0xcefe65[_0x9337('0x16')]['message']);}})['catch'](function(_0x4d83f4){logger[_0x9337('0x13')](_0x9337('0xf'),_0x2903d3,_0x4d83f4);_0x599225(_0x4d83f4);});});} \ No newline at end of file +var _0x2cab=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x2cab,0xf9));var _0xb2ca=function(_0x5e6053,_0x207b6f){_0x5e6053=_0x5e6053-0x0;var _0x3f423d=_0x2cab[_0x5e6053];return _0x3f423d;};'use strict';var _=require(_0xb2ca('0x0'));var util=require(_0xb2ca('0x1'));var moment=require(_0xb2ca('0x2'));var BPromise=require(_0xb2ca('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb2ca('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb2ca('0x5'));var logger=require(_0xb2ca('0x6'))(_0xb2ca('0x7'));var config=require(_0xb2ca('0x8'));var jayson=require(_0xb2ca('0x9'));var client=jayson[_0xb2ca('0xa')][_0xb2ca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x588ca3,_0x812040,_0x4e66bd){return new BPromise(function(_0x39e692,_0x2d85ed){return client['request'](_0x588ca3,_0x4e66bd)[_0xb2ca('0xc')](function(_0xf07c55){logger[_0xb2ca('0xd')](_0xb2ca('0xe'),_0x812040,_0xb2ca('0xf'));logger['debug'](_0xb2ca('0x10'),_0x812040,'request\x20sent',JSON[_0xb2ca('0x11')](_0xf07c55));if(_0xf07c55[_0xb2ca('0x12')]){if(_0xf07c55[_0xb2ca('0x12')][_0xb2ca('0x13')]===0x1f4){logger[_0xb2ca('0x12')](_0xb2ca('0xe'),_0x812040,_0xf07c55[_0xb2ca('0x12')][_0xb2ca('0x14')]);return _0x2d85ed(_0xf07c55[_0xb2ca('0x12')][_0xb2ca('0x14')]);}logger['error'](_0xb2ca('0xe'),_0x812040,_0xf07c55[_0xb2ca('0x12')]['message']);return _0x39e692(_0xf07c55['error'][_0xb2ca('0x14')]);}else{logger[_0xb2ca('0xd')](_0xb2ca('0xe'),_0x812040,'request\x20sent');_0x39e692(_0xf07c55[_0xb2ca('0x15')][_0xb2ca('0x14')]);}})[_0xb2ca('0x16')](function(_0x5aa4be){logger[_0xb2ca('0x12')](_0xb2ca('0xe'),_0x812040,_0x5aa4be);_0x2d85ed(_0x5aa4be);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 98621af..058902f 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 _0xf097=['getResources','post','create','/:id/clone','clone','/:id/sections','addSections','addResources','update','delete','destroy','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./userProfile.controller','get','isAuthenticated','index','describe','/:id','show','getSections','/:id/resources'];(function(_0x3b45e8,_0x628af6){var _0x370099=function(_0x80765f){while(--_0x80765f){_0x3b45e8['push'](_0x3b45e8['shift']());}};_0x370099(++_0x628af6);}(_0xf097,0x1b2));var _0x7f09=function(_0x3e8d4d,_0x850052){_0x3e8d4d=_0x3e8d4d-0x0;var _0x3255ff=_0xf097[_0x3e8d4d];return _0x3255ff;};'use strict';var multer=require(_0x7f09('0x0'));var util=require(_0x7f09('0x1'));var path=require(_0x7f09('0x2'));var timeout=require(_0x7f09('0x3'));var express=require(_0x7f09('0x4'));var router=express[_0x7f09('0x5')]();var fs_extra=require(_0x7f09('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7f09('0x7'));router[_0x7f09('0x8')]('/',auth[_0x7f09('0x9')](),controller[_0x7f09('0xa')]);router[_0x7f09('0x8')]('/describe',auth[_0x7f09('0x9')](),controller[_0x7f09('0xb')]);router['get'](_0x7f09('0xc'),auth[_0x7f09('0x9')](),controller[_0x7f09('0xd')]);router[_0x7f09('0x8')]('/:id/sections',auth[_0x7f09('0x9')](),controller[_0x7f09('0xe')]);router[_0x7f09('0x8')](_0x7f09('0xf'),auth[_0x7f09('0x9')](),controller[_0x7f09('0x10')]);router[_0x7f09('0x11')]('/',auth[_0x7f09('0x9')](),controller[_0x7f09('0x12')]);router[_0x7f09('0x11')](_0x7f09('0x13'),auth[_0x7f09('0x9')](),controller[_0x7f09('0x14')]);router[_0x7f09('0x11')](_0x7f09('0x15'),auth['isAuthenticated'](),controller[_0x7f09('0x16')]);router['post'](_0x7f09('0xf'),auth['isAuthenticated'](),controller[_0x7f09('0x17')]);router['put'](_0x7f09('0xc'),auth[_0x7f09('0x9')](),controller[_0x7f09('0x18')]);router[_0x7f09('0x19')]('/:id',auth[_0x7f09('0x9')](),controller[_0x7f09('0x1a')]);router[_0x7f09('0x19')](_0x7f09('0x15'),auth[_0x7f09('0x9')](),controller[_0x7f09('0x1b')]);router[_0x7f09('0x19')](_0x7f09('0xf'),auth[_0x7f09('0x9')](),controller[_0x7f09('0x1c')]);module[_0x7f09('0x1d')]=router; \ No newline at end of file +var _0x4261=['addSections','addResources','update','removeSections','delete','removeResources','exports','multer','util','path','../../components/auth/service','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getSections','/:id/resources','getResources','post','create','clone','/:id/sections'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x4261,0x1c1));var _0x1426=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x4261[_0x3054be];return _0x3df150;};'use strict';var multer=require(_0x1426('0x0'));var util=require(_0x1426('0x1'));var path=require(_0x1426('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1426('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1426('0x4'));router[_0x1426('0x5')]('/',auth[_0x1426('0x6')](),controller[_0x1426('0x7')]);router[_0x1426('0x5')](_0x1426('0x8'),auth[_0x1426('0x6')](),controller[_0x1426('0x9')]);router[_0x1426('0x5')](_0x1426('0xa'),auth[_0x1426('0x6')](),controller[_0x1426('0xb')]);router[_0x1426('0x5')]('/:id/sections',auth[_0x1426('0x6')](),controller[_0x1426('0xc')]);router[_0x1426('0x5')](_0x1426('0xd'),auth[_0x1426('0x6')](),controller[_0x1426('0xe')]);router[_0x1426('0xf')]('/',auth[_0x1426('0x6')](),controller[_0x1426('0x10')]);router[_0x1426('0xf')]('/:id/clone',auth[_0x1426('0x6')](),controller[_0x1426('0x11')]);router['post'](_0x1426('0x12'),auth[_0x1426('0x6')](),controller[_0x1426('0x13')]);router['post'](_0x1426('0xd'),auth[_0x1426('0x6')](),controller[_0x1426('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1426('0x15')]);router['delete'](_0x1426('0xa'),auth[_0x1426('0x6')](),controller['destroy']);router['delete'](_0x1426('0x12'),auth['isAuthenticated'](),controller[_0x1426('0x16')]);router[_0x1426('0x17')](_0x1426('0xd'),auth[_0x1426('0x6')](),controller[_0x1426('0x18')]);module[_0x1426('0x19')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index ea1ec71..7eb3395 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 _0x0955=['BOOLEAN','name','STRING','setDataValue','crudPermissions','join','getDataValue'];(function(_0x508c49,_0x5a79b0){var _0xaf8a22=function(_0x371f9c){while(--_0x371f9c){_0x508c49['push'](_0x508c49['shift']());}};_0xaf8a22(++_0x5a79b0);}(_0x0955,0x112));var _0x5095=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x0955[_0x2112d4];return _0x434972;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5095('0x0')},'crudPermissions':{'type':Sequelize[_0x5095('0x1')],'set':function(_0x20036e){this[_0x5095('0x2')](_0x5095('0x3'),_0x20036e?_0x20036e[_0x5095('0x4')](''):[]);},'get':function(){return this[_0x5095('0x5')](_0x5095('0x3'))?this[_0x5095('0x5')](_0x5095('0x3'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x5095('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x5095('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x5095('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x5095('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x5095('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x5095('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x5095('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x5095('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0xdffc=['join','getDataValue','BOOLEAN','STRING','name'];(function(_0x384c01,_0x1e0dc5){var _0x300793=function(_0x32bb86){while(--_0x32bb86){_0x384c01['push'](_0x384c01['shift']());}};_0x300793(++_0x1e0dc5);}(_0xdffc,0x175));var _0xcdff=function(_0x56c3b0,_0x176571){_0x56c3b0=_0x56c3b0-0x0;var _0x36b299=_0xdffc[_0x56c3b0];return _0x36b299;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xcdff('0x0')],'allowNull':![],'unique':_0xcdff('0x1')},'crudPermissions':{'type':Sequelize[_0xcdff('0x0')],'set':function(_0x3584db){this['setDataValue']('crudPermissions',_0x3584db?_0x3584db[_0xcdff('0x2')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0xcdff('0x3')]('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xcdff('0x0')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xcdff('0x4')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xcdff('0x4')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xcdff('0x4')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xcdff('0x4')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xcdff('0x4')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xcdff('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 02ff890..5bd24eb 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 _0x9923=['offset','undefined','limit','count','set','apply','reject','save','then','sendStatus','error','stack','name','send','index','map','UserProfile','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','params','include','find','create','clone','includeAll','get','omit','createdAt','body','updatedAt','sequelize','transaction','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','update','describe','addSections','destroy','push','removeSections','ids','getSections','enabled','isEmpty','subsections','includes','findOne','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','status','end','json'];(function(_0x46e523,_0xe6fccb){var _0x5da0ee=function(_0x396682){while(--_0x396682){_0x46e523['push'](_0x46e523['shift']());}};_0x5da0ee(++_0xe6fccb);}(_0x9923,0x13e));var _0x3992=function(_0x3a852a,_0xf3f1d3){_0x3a852a=_0x3a852a-0x0;var _0x48c902=_0x9923[_0x3a852a];return _0x48c902;};'use strict';var emlformat=require(_0x3992('0x0'));var rimraf=require(_0x3992('0x1'));var zipdir=require(_0x3992('0x2'));var jsonpatch=require(_0x3992('0x3'));var rp=require(_0x3992('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x3992('0x5'));var sox=require(_0x3992('0x6'));var csv=require(_0x3992('0x7'));var ejs=require(_0x3992('0x8'));var fs=require('fs');var fs_extra=require(_0x3992('0x9'));var _=require(_0x3992('0xa'));var squel=require('squel');var crypto=require(_0x3992('0xb'));var jsforce=require(_0x3992('0xc'));var deskjs=require(_0x3992('0xd'));var toCsv=require(_0x3992('0x7'));var querystring=require(_0x3992('0xe'));var Papa=require(_0x3992('0xf'));var Redis=require(_0x3992('0x10'));var authService=require(_0x3992('0x11'));var qs=require(_0x3992('0x12'));var as=require(_0x3992('0x13'));var hardwareService=require(_0x3992('0x14'));var logger=require(_0x3992('0x15'))(_0x3992('0x16'));var utils=require(_0x3992('0x17'));var config=require(_0x3992('0x18'));var licenseUtil=require(_0x3992('0x19'));var db=require(_0x3992('0x1a'))['db'];config[_0x3992('0x1b')]=_['defaults'](config[_0x3992('0x1b')],{'host':_0x3992('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userProfile.socket')[_0x3992('0x1d')](socket);function respondWithStatusCode(_0x5b19ea,_0x581b31){_0x581b31=_0x581b31||0xcc;return function(_0x4d894c){if(_0x4d894c){return _0x5b19ea['sendStatus'](_0x581b31);}return _0x5b19ea[_0x3992('0x1e')](_0x581b31)[_0x3992('0x1f')]();};}function respondWithResult(_0x55bb40,_0x375f9d){_0x375f9d=_0x375f9d||0xc8;return function(_0xbed54a){if(_0xbed54a){return _0x55bb40[_0x3992('0x1e')](_0x375f9d)[_0x3992('0x20')](_0xbed54a);}};}function respondWithFilteredResult(_0x599816,_0x17a349){return function(_0x187f73){if(_0x187f73){var _0x2783c5=typeof _0x17a349[_0x3992('0x21')]===_0x3992('0x22')&&typeof _0x17a349[_0x3992('0x23')]===_0x3992('0x22');var _0x12f7b5=_0x187f73[_0x3992('0x24')];var _0x7f6f80=_0x2783c5?0x0:_0x17a349[_0x3992('0x21')];var _0x14a7ee=_0x2783c5?_0x187f73[_0x3992('0x24')]:_0x17a349['offset']+_0x17a349['limit'];var _0x197d58;if(_0x14a7ee>=_0x12f7b5){_0x14a7ee=_0x12f7b5;_0x197d58=0xc8;}else{_0x197d58=0xce;}_0x599816['status'](_0x197d58);return _0x599816[_0x3992('0x25')]('Content-Range',_0x7f6f80+'-'+_0x14a7ee+'/'+_0x12f7b5)['json'](_0x187f73);}return null;};}function patchUpdates(_0x540851){return function(_0x2381b1){try{jsonpatch[_0x3992('0x26')](_0x2381b1,_0x540851,!![]);}catch(_0x53f9d4){return BPromise[_0x3992('0x27')](_0x53f9d4);}return _0x2381b1[_0x3992('0x28')]();};}function saveUpdates(_0x1a24fa,_0x32e76d){return function(_0x33a77c){if(_0x33a77c){return _0x33a77c['update'](_0x1a24fa)[_0x3992('0x29')](function(_0x25ac10){return _0x25ac10;});}return null;};}function removeEntity(_0x345f7a,_0x17218b){return function(_0x4794df){if(_0x4794df){return _0x4794df['destroy']()[_0x3992('0x29')](function(){_0x345f7a[_0x3992('0x1e')](0xcc)[_0x3992('0x1f')]();});}};}function handleEntityNotFound(_0x4a651a,_0x5c1c9a){return function(_0x443d5c){if(!_0x443d5c){_0x4a651a[_0x3992('0x2a')](0x194);}return _0x443d5c;};}function handleError(_0x968296,_0x2ede4a){_0x2ede4a=_0x2ede4a||0x1f4;return function(_0x4ed948){logger[_0x3992('0x2b')](_0x4ed948[_0x3992('0x2c')]);if(_0x4ed948[_0x3992('0x2d')]){delete _0x4ed948[_0x3992('0x2d')];}_0x968296[_0x3992('0x1e')](_0x2ede4a)[_0x3992('0x2e')](_0x4ed948);};}exports[_0x3992('0x2f')]=function(_0x1862e1,_0x287744){var _0x42fa46={},_0x3667d8={},_0xed94df={'count':0x0,'rows':[]};var _0x2e61ea=_[_0x3992('0x30')](db[_0x3992('0x31')][_0x3992('0x32')],function(_0x4d14f1){return{'name':_0x4d14f1['fieldName'],'type':_0x4d14f1[_0x3992('0x33')][_0x3992('0x34')]};});_0x3667d8['model']=_[_0x3992('0x30')](_0x2e61ea,_0x3992('0x2d'));_0x3667d8['query']=_[_0x3992('0x35')](_0x1862e1[_0x3992('0x36')]);_0x3667d8[_0x3992('0x37')]=_[_0x3992('0x38')](_0x3667d8[_0x3992('0x39')],_0x3667d8[_0x3992('0x36')]);_0x42fa46[_0x3992('0x3a')]=_[_0x3992('0x38')](_0x3667d8['model'],qs[_0x3992('0x3b')](_0x1862e1[_0x3992('0x36')][_0x3992('0x3b')]));_0x42fa46['attributes']=_0x42fa46[_0x3992('0x3a')][_0x3992('0x3c')]?_0x42fa46[_0x3992('0x3a')]:_0x3667d8[_0x3992('0x39')];if(!_0x1862e1[_0x3992('0x36')][_0x3992('0x3d')](_0x3992('0x3e'))){_0x42fa46[_0x3992('0x23')]=qs[_0x3992('0x23')](_0x1862e1[_0x3992('0x36')]['limit']);_0x42fa46[_0x3992('0x21')]=qs[_0x3992('0x21')](_0x1862e1[_0x3992('0x36')][_0x3992('0x21')]);}_0x42fa46[_0x3992('0x3f')]=qs[_0x3992('0x40')](_0x1862e1[_0x3992('0x36')]['sort']);_0x42fa46[_0x3992('0x41')]=qs[_0x3992('0x37')](_[_0x3992('0x42')](_0x1862e1[_0x3992('0x36')],_0x3667d8[_0x3992('0x37')]),_0x2e61ea);if(_0x1862e1[_0x3992('0x36')][_0x3992('0x43')]){_0x42fa46[_0x3992('0x41')]=_[_0x3992('0x44')](_0x42fa46['where'],{'$or':_[_0x3992('0x30')](_0x2e61ea,function(_0x3a776f){if(_0x3a776f[_0x3992('0x33')]!==_0x3992('0x45')){var _0x109aa9={};_0x109aa9[_0x3a776f[_0x3992('0x2d')]]={'$like':'%'+_0x1862e1[_0x3992('0x36')][_0x3992('0x43')]+'%'};return _0x109aa9;}})});}_0x42fa46=_['merge']({},_0x42fa46,_0x1862e1[_0x3992('0x46')]);var _0x1efce4={'where':_0x42fa46[_0x3992('0x41')]};return db['UserProfile'][_0x3992('0x24')](_0x1efce4)[_0x3992('0x29')](function(_0x5595be){_0xed94df['count']=_0x5595be;if(_0x1862e1[_0x3992('0x36')]['includeAll']){_0x42fa46['include']=[{'all':!![]}];}return db['UserProfile'][_0x3992('0x47')](_0x42fa46);})[_0x3992('0x29')](function(_0x3f2b15){_0xed94df[_0x3992('0x48')]=_0x3f2b15;return _0xed94df;})['then'](respondWithFilteredResult(_0x287744,_0x42fa46))[_0x3992('0x49')](handleError(_0x287744,null));};exports['show']=function(_0x402bc5,_0x2155e3){var _0x5b9e3a={'raw':![],'where':{'id':_0x402bc5[_0x3992('0x4a')]['id']}},_0x115f31={};_0x115f31['model']=_[_0x3992('0x35')](db[_0x3992('0x31')][_0x3992('0x32')]);_0x115f31['query']=_[_0x3992('0x35')](_0x402bc5[_0x3992('0x36')]);_0x115f31[_0x3992('0x37')]=_[_0x3992('0x38')](_0x115f31[_0x3992('0x39')],_0x115f31[_0x3992('0x36')]);_0x5b9e3a[_0x3992('0x3a')]=_[_0x3992('0x38')](_0x115f31[_0x3992('0x39')],qs[_0x3992('0x3b')](_0x402bc5[_0x3992('0x36')][_0x3992('0x3b')]));_0x5b9e3a['attributes']=_0x5b9e3a[_0x3992('0x3a')][_0x3992('0x3c')]?_0x5b9e3a[_0x3992('0x3a')]:_0x115f31[_0x3992('0x39')];if(_0x402bc5[_0x3992('0x36')]['includeAll']){_0x5b9e3a[_0x3992('0x4b')]=[{'all':!![]}];}_0x5b9e3a=_[_0x3992('0x44')]({},_0x5b9e3a,_0x402bc5['options']);return db[_0x3992('0x31')][_0x3992('0x4c')](_0x5b9e3a)[_0x3992('0x29')](handleEntityNotFound(_0x2155e3,null))[_0x3992('0x29')](respondWithResult(_0x2155e3,null))[_0x3992('0x49')](handleError(_0x2155e3,null));};exports[_0x3992('0x4d')]=function(_0x5e786d,_0x298fbe){return db[_0x3992('0x31')][_0x3992('0x4d')](_0x5e786d['body'],{})['then'](respondWithResult(_0x298fbe,0xc9))['catch'](handleError(_0x298fbe,null));};exports[_0x3992('0x4e')]=function(_0x1a51f,_0x2c48e0){var _0x2d8e25={'where':{'id':_0x1a51f['params']['id']}},_0x4b435c={};_0x4b435c[_0x3992('0x39')]=_[_0x3992('0x35')](db['UserProfile'][_0x3992('0x32')]);_0x2d8e25[_0x3992('0x3a')]=_[_0x3992('0x38')](_0x4b435c[_0x3992('0x39')],qs[_0x3992('0x3b')](_0x1a51f[_0x3992('0x36')][_0x3992('0x3b')]));_0x2d8e25[_0x3992('0x3a')]=_0x2d8e25[_0x3992('0x3a')][_0x3992('0x3c')]?_0x2d8e25[_0x3992('0x3a')]:_0x4b435c[_0x3992('0x39')];if(_0x1a51f[_0x3992('0x36')][_0x3992('0x4f')]){_0x2d8e25[_0x3992('0x4b')]=[{'all':!![]}];}_0x2d8e25=_['merge']({},_0x2d8e25,_0x1a51f[_0x3992('0x46')]);return db[_0x3992('0x31')][_0x3992('0x4c')](_0x2d8e25)[_0x3992('0x29')](handleEntityNotFound(_0x2c48e0,null))['then'](function(_0x1d9a96){if(_0x1d9a96){var _0x6c2ff5=_0x1d9a96[_0x3992('0x50')]({'plain':!![]});_0x6c2ff5=qs[_0x3992('0x51')](_0x6c2ff5,['id',_0x3992('0x52'),'updatedAt','crudPermissions']);_0x1a51f[_0x3992('0x53')]=_[_0x3992('0x51')](_0x1a51f[_0x3992('0x53')],['id','createdAt',_0x3992('0x54')]);return db[_0x3992('0x55')][_0x3992('0x56')](function(_0x267492){return db[_0x3992('0x31')]['create'](_[_0x3992('0x44')](_0x6c2ff5,_0x1a51f[_0x3992('0x53')]),{'include':_0x1a51f['query'][_0x3992('0x4f')]?[{'all':!![]}]:undefined,'transaction':_0x267492})['then'](function(_0x335b72){var _0x345a0c=_0x335b72['get']({'plain':!![]});return db['UserProfileSection'][_0x3992('0x47')]({'where':{'userProfileId':_0x1a51f[_0x3992('0x4a')]['id']},'raw':!![]})[_0x3992('0x29')](function(_0x2a39ae){if(_0x2a39ae){return BPromise[_0x3992('0x57')](_0x2a39ae,function(_0x3bf8ca){return new BPromise(function(_0x44fc69,_0x4de29b){if(_0x3bf8ca[_0x3992('0x58')]===null||_0x3bf8ca[_0x3992('0x58')]===0x1)_0x44fc69(null);return db[_0x3992('0x59')][_0x3992('0x47')]({'where':{'sectionId':_0x3bf8ca['id']},'raw':!![]})[_0x3992('0x29')](function(_0x549ab3){var _0x412c5b=_['map'](_0x549ab3,function(_0x16763b){return qs['omit'](_0x16763b,['id',_0x3992('0x52'),'updatedAt',_0x3992('0x5a')]);});_0x44fc69(_0x412c5b);})['catch'](function(_0x49d94b){_0x4de29b(_0x49d94b);});})[_0x3992('0x29')](function(_0x59baac){var _0x5772e7=qs[_0x3992('0x51')](_0x3bf8ca,['id',_0x3992('0x52'),_0x3992('0x54')]);_0x5772e7[_0x3992('0x5b')]=_0x345a0c['id'];if(_0x59baac)_0x5772e7[_0x3992('0x5c')]=_0x59baac;return _0x5772e7;})['then'](function(_0x4e0f7f){return db[_0x3992('0x5d')][_0x3992('0x4d')](_0x4e0f7f,{'include':[{'model':db[_0x3992('0x59')],'as':_0x3992('0x5c')}],'raw':!![],'transaction':_0x267492});});})[_0x3992('0x29')](function(){return _0x345a0c;});}});});});}})['then'](respondWithResult(_0x2c48e0,0xc9))[_0x3992('0x49')](handleError(_0x2c48e0,null));};exports[_0x3992('0x5e')]=function(_0x3077a0,_0x1e92b0){if(_0x3077a0[_0x3992('0x53')]['id']){delete _0x3077a0[_0x3992('0x53')]['id'];}return db[_0x3992('0x31')]['find']({'where':{'id':_0x3077a0['params']['id']}})[_0x3992('0x29')](handleEntityNotFound(_0x1e92b0,null))['then'](saveUpdates(_0x3077a0['body'],null))[_0x3992('0x29')](respondWithResult(_0x1e92b0,null))[_0x3992('0x49')](handleError(_0x1e92b0,null));};exports['destroy']=function(_0x4ca380,_0x48c2c8){return db[_0x3992('0x31')][_0x3992('0x4c')]({'where':{'id':_0x4ca380[_0x3992('0x4a')]['id']}})[_0x3992('0x29')](handleEntityNotFound(_0x48c2c8,null))[_0x3992('0x29')](removeEntity(_0x48c2c8,null))[_0x3992('0x49')](handleError(_0x48c2c8,null));};exports[_0x3992('0x5f')]=function(_0xf5130c,_0x396d03){return db[_0x3992('0x31')][_0x3992('0x5f')]()['then'](respondWithResult(_0x396d03,null))[_0x3992('0x49')](handleError(_0x396d03,null));};exports[_0x3992('0x60')]=function(_0x57dc42,_0x3523ef){var _0xc9c99=_0x57dc42[_0x3992('0x53')];return db[_0x3992('0x31')][_0x3992('0x4c')]({'where':{'id':_0x57dc42[_0x3992('0x4a')]['id']}})[_0x3992('0x29')](handleEntityNotFound(_0x3523ef,null))[_0x3992('0x29')](function(_0x257806){if(_0x257806){return db[_0x3992('0x55')][_0x3992('0x56')](function(_0x34a5af){return db[_0x3992('0x5d')][_0x3992('0x61')]({'where':{'userProfileId':_0x57dc42[_0x3992('0x4a')]['id'],'sectionId':_['map'](_0xc9c99,function(_0x51659f){return _0x51659f[_0x3992('0x5a')];})},'transaction':_0x34a5af})[_0x3992('0x29')](function(){var _0x501710=_['map'](_0xc9c99,function(_0x2a28b1){_0x2a28b1[_0x3992('0x5b')]=_0x57dc42[_0x3992('0x4a')]['id'];return _0x2a28b1;});var _0x4caf8d=[];return BPromise[_0x3992('0x57')](_0x501710,function(_0x6848e5){return db[_0x3992('0x5d')][_0x3992('0x4d')](_0x6848e5,{'include':[{'model':db[_0x3992('0x59')],'as':_0x3992('0x5c')}],'raw':!![],'transaction':_0x34a5af})[_0x3992('0x29')](function(_0x5bda58){_0x4caf8d[_0x3992('0x62')](_0x5bda58['get']({'plain':!![]}));});})['then'](function(){return _0x4caf8d;});});});}})['then'](function(_0x240c93){return _0x240c93;})[_0x3992('0x29')](respondWithResult(_0x3523ef,null))['catch'](handleError(_0x3523ef,null));};exports[_0x3992('0x63')]=function(_0x2083c9,_0x59c195){var _0x42bb7a;return db[_0x3992('0x31')][_0x3992('0x4c')]({'where':{'id':_0x2083c9['params']['id']},'attributes':['id',_0x3992('0x2d')]})['then'](handleEntityNotFound(_0x59c195,null))[_0x3992('0x29')](function(_0x5602c4){if(_0x5602c4){_0x42bb7a=_0x5602c4;return db[_0x3992('0x5d')][_0x3992('0x61')]({'where':{'userProfileId':_0x2083c9[_0x3992('0x4a')]['id'],'sectionId':_0x2083c9[_0x3992('0x36')][_0x3992('0x64')]}});}})['then'](function(){return _0x42bb7a;})[_0x3992('0x29')](respondWithStatusCode(_0x59c195,null))[_0x3992('0x49')](handleError(_0x59c195,null));};exports[_0x3992('0x65')]=function(_0x44a728,_0x26b584){var _0x56ec3b=[];var _0x392324=[];return db['UserProfileSection'][_0x3992('0x47')]({'where':{'userProfileId':_0x44a728[_0x3992('0x4a')]['id']},'raw':!![]})[_0x3992('0x29')](function(_0x469f8c){_0x56ec3b=_[_0x3992('0x43')](_0x469f8c,function(_0xd2b78f){return _0xd2b78f[_0x3992('0x66')]===0x1||_['includes']([0x3eb,0x709],_0xd2b78f['sectionId']);});if(!_[_0x3992('0x67')](_0x56ec3b)){return _[_0x3992('0x30')](_0x56ec3b,function(_0x19ba65){return _0x19ba65['sectionId'];});}else{return;}})['then'](function(_0x1e5660){if(_0x1e5660)_0x392324=_0x1e5660;if(_['includes'](_0x392324,0x64)){var _0x3cdd8f=_['find'](_0x56ec3b,{'sectionId':0x64});return hasDefaultDashboard(_0x3cdd8f)[_0x3992('0x29')](function(_0x44fdb8){return _['map'](_0x56ec3b,function(_0x29bad0){if(_0x29bad0[_0x3992('0x5a')]===0x64){_0x29bad0[_0x3992('0x68')]=_0x44fdb8;}return _0x29bad0;});});}else{return;}})[_0x3992('0x29')](function(_0x57b353){if(_0x57b353)_0x56ec3b=_0x57b353;if(_[_0x3992('0x69')](_0x392324,0x3eb)){var _0x66a9=_[_0x3992('0x4c')](_0x56ec3b,{'sectionId':0x3eb});return getCustomDashboards(_0x66a9)['then'](function(_0x1fe6c9){return _[_0x3992('0x30')](_0x56ec3b,function(_0x523fea){if(_0x66a9['enabled']){if(_0x523fea[_0x3992('0x5a')]===0x3eb){_0x523fea[_0x3992('0x68')]=_0x1fe6c9;}}else{if(_0x523fea[_0x3992('0x5a')]===0x64){if(!_0x523fea[_0x3992('0x68')]){_0x523fea[_0x3992('0x68')]=[];}_0x523fea[_0x3992('0x68')]=_0x523fea['subsections']['concat'](_0x1fe6c9);}}return _0x523fea;});});}else{return;}})[_0x3992('0x29')](function(_0x4fca50){if(_0x4fca50)_0x56ec3b=_0x4fca50;if(_[_0x3992('0x69')](_0x392324,0x709)){var _0x7a6b25=_['find'](_0x56ec3b,{'sectionId':0x709});return getPlugins(_0x7a6b25)[_0x3992('0x29')](function(_0x3950dd){if(_0x7a6b25[_0x3992('0x66')]){return _[_0x3992('0x30')](_0x56ec3b,function(_0x2d7a21){if(_0x2d7a21[_0x3992('0x5a')]===0x709){_0x2d7a21[_0x3992('0x68')]=_0x3950dd;}return _0x2d7a21;});}else{var _0x47a03a={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3950dd};var _0x49e802=_[_0x3992('0x30')](_0x56ec3b);_0x49e802[_0x3992('0x62')](_0x47a03a);return _0x49e802;}});}else{return;}})['then'](function(_0x3ac15a){if(_0x3ac15a)_0x56ec3b=_0x3ac15a;return _[_0x3992('0x43')](_0x56ec3b,['enabled',0x1]);})[_0x3992('0x29')](respondWithResult(_0x26b584,null))[_0x3992('0x49')](handleError(_0x26b584,null));};function hasDefaultDashboard(_0x2d3201){var _0x441f4d=[0x65];return new BPromise(function(_0x382f6e,_0x442393){try{if(_0x2d3201[_0x3992('0x58')]){_0x382f6e(_0x441f4d);}else{return db[_0x3992('0x59')][_0x3992('0x6a')]({'where':{'sectionId':_0x2d3201['id']},'raw':!![]})[_0x3992('0x29')](function(_0x3cd2b3){_0x3cd2b3?_0x382f6e(_0x441f4d):_0x382f6e();});}}catch(_0x40b125){_0x442393(_0x40b125);}});}function getCustomDashboards(_0x32584d){var _0x5e540b=[];return new BPromise(function(_0x14e216,_0xbf6942){try{if(_0x32584d[_0x3992('0x58')]){return db[_0x3992('0x6b')][_0x3992('0x47')]({'raw':!![]})[_0x3992('0x29')](function(_0x332e0d){_0x332e0d[_0x3992('0x6c')](function(_0x5ee9ec){_0x5e540b[_0x3992('0x62')](_0x5ee9ec['id']+0x1869f);});_0x14e216(_0x5e540b);});}else{return db[_0x3992('0x59')]['findAll']({'where':{'sectionId':_0x32584d['id']},'raw':!![]})['then'](function(_0x1a8259){_0x1a8259[_0x3992('0x6c')](function(_0x41b831){_0x5e540b[_0x3992('0x62')](_0x41b831[_0x3992('0x6d')]+0x1869f);});_0x14e216(_0x5e540b);});}}catch(_0x567d4f){_0xbf6942(_0x567d4f);}});}function getPlugins(_0x30fed9){var _0x309711=[];return new BPromise(function(_0x48a6ca,_0x1ed13c){try{if(_0x30fed9[_0x3992('0x58')]){return db[_0x3992('0x6e')][_0x3992('0x47')]({'raw':!![]})[_0x3992('0x29')](function(_0x32ffb7){_0x32ffb7[_0x3992('0x6c')](function(_0x2def5c){_0x309711[_0x3992('0x62')](_0x2def5c['id']+0x15b38);});_0x48a6ca(_0x309711);});}else{return db['UserProfileResource'][_0x3992('0x47')]({'where':{'sectionId':_0x30fed9['id']},'raw':!![]})[_0x3992('0x29')](function(_0x57cb09){_0x57cb09[_0x3992('0x6c')](function(_0x2e5e9a){_0x309711[_0x3992('0x62')](_0x2e5e9a[_0x3992('0x6d')]+0x15b38);});_0x48a6ca(_0x309711);});}}catch(_0x319ec1){_0x1ed13c(_0x319ec1);}});}exports['addResources']=function(_0x2c355d,_0x382745){return db[_0x3992('0x31')][_0x3992('0x4c')]({'where':{'id':_0x2c355d['params']['id']}})[_0x3992('0x29')](handleEntityNotFound(_0x382745,null))['then'](function(_0x5f2278){if(_0x5f2278){return db[_0x3992('0x55')][_0x3992('0x56')](function(_0x46d733){return db[_0x3992('0x5d')][_0x3992('0x47')]({'where':{'userProfileId':_0x2c355d['params']['id']},'attributes':['id'],'raw':!![]})[_0x3992('0x29')](function(_0x4b1280){if(_0x4b1280){return db[_0x3992('0x5d')][_0x3992('0x61')]({'where':{'userProfileId':_0x2c355d['params']['id'],'id':_[_0x3992('0x30')](_0x4b1280,function(_0x5f0b89){return _0x5f0b89['id'];})},'transaction':_0x46d733});}})[_0x3992('0x29')](function(_0x222085){var _0x517270=_[_0x3992('0x30')](_0x2c355d['body'],function(_0x136da2){_0x136da2[_0x3992('0x5b')]=_0x2c355d['params']['id'];return _0x136da2;});return db[_0x3992('0x5d')][_0x3992('0x6f')](_0x517270,{'raw':!![],'transaction':_0x46d733});})[_0x3992('0x29')](function(_0x5d5077){var _0x425137=_['filter'](_[_0x3992('0x30')](_0x5d5077,function(_0x20a83c){return _0x20a83c['get']({'plain':!![]});}),{'includeAll':![]});if(_0x425137){return db[_0x3992('0x5d')][_0x3992('0x47')]({'where':{'userProfileId':_0x2c355d[_0x3992('0x4a')]['id'],'sectionId':_[_0x3992('0x30')](_0x425137,function(_0xd8f83b){return _0xd8f83b[_0x3992('0x5a')];})},'attributes':['id',_0x3992('0x5a')],'raw':!![]})[_0x3992('0x29')](function(_0x5f075b){var _0x260012=_[_0x3992('0x30')](_0x2c355d['body'],function(_0x36456f){_0x36456f[_0x3992('0x5b')]=_0x2c355d[_0x3992('0x4a')]['id'];return _0x36456f;});return db[_0x3992('0x59')][_0x3992('0x6f')](_0x260012,{'raw':!![],'transaction':_0x46d733});});}})['catch'](handleError(_0x382745,null));});}})[_0x3992('0x29')](function(_0x6270d1){var _0x5c268e=_[_0x3992('0x30')](_0x6270d1,function(_0x354344){return _0x354344['get']({'plain':!![]});});})[_0x3992('0x29')](respondWithResult(_0x382745,null))[_0x3992('0x49')](handleError(_0x382745,null));};exports[_0x3992('0x70')]=function(_0x1284be,_0x18ab8f,_0x2c261a){return db['UserProfile'][_0x3992('0x4c')]({'where':{'id':_0x1284be[_0x3992('0x4a')]['id']}})['then'](handleEntityNotFound(_0x18ab8f,null))[_0x3992('0x29')](function(_0xb67e8b){if(_0xb67e8b){return _0xb67e8b[_0x3992('0x70')](_0x1284be[_0x3992('0x36')][_0x3992('0x64')]);}})[_0x3992('0x29')](respondWithStatusCode(_0x18ab8f,null))[_0x3992('0x49')](handleError(_0x18ab8f,null));};exports[_0x3992('0x71')]=function(_0x23f1cc,_0x5eb52f){var _0x510a5c={};if(!_0x23f1cc['query'][_0x3992('0x72')])throw new Error(_0x3992('0x73'));if(!_0x23f1cc['query']['hasOwnProperty'](_0x3992('0x3e'))){_0x510a5c['limit']=qs[_0x3992('0x23')](_0x23f1cc[_0x3992('0x36')][_0x3992('0x23')]);_0x510a5c[_0x3992('0x21')]=qs[_0x3992('0x21')](_0x23f1cc[_0x3992('0x36')][_0x3992('0x21')]);}return db[_0x3992('0x31')]['find']({'where':{'id':_0x23f1cc[_0x3992('0x4a')]['id']}})[_0x3992('0x29')](function(_0x417a89){if(!_0x417a89)throw new Error(_0x3992('0x74')+_0x23f1cc[_0x3992('0x4a')]['id']);return db[_0x3992('0x31')][_0x3992('0x71')](_0x23f1cc);})[_0x3992('0x29')](respondWithFilteredResult(_0x5eb52f,_0x510a5c))[_0x3992('0x49')](handleError(_0x5eb52f,null));}; \ No newline at end of file +var _0xbe4b=['removeSections','ids','enabled','includes','isEmpty','subsections','push','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','error','stack','name','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','merge','filter','options','UserProfile','includeAll','include','rows','catch','show','params','rawAttributes','find','clone','length','get','createdAt','body','omit','sequelize','transaction','findAll','autoAssociation','UserProfileResource','updatedAt','userProfileId','create','update','describe','UserProfileSection','sectionId','each','Resources'];(function(_0x557404,_0x54150f){var _0x3752ac=function(_0x3d126f){while(--_0x3d126f){_0x557404['push'](_0x557404['shift']());}};_0x3752ac(++_0x54150f);}(_0xbe4b,0xe2));var _0xbbe4=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xbe4b[_0x1928c9];return _0x51b5fb;};'use strict';var emlformat=require(_0xbbe4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbbe4('0x1'));var jsonpatch=require(_0xbbe4('0x2'));var rp=require(_0xbbe4('0x3'));var moment=require('moment');var BPromise=require(_0xbbe4('0x4'));var Mustache=require('mustache');var util=require(_0xbbe4('0x5'));var path=require('path');var sox=require(_0xbbe4('0x6'));var csv=require(_0xbbe4('0x7'));var ejs=require(_0xbbe4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbbe4('0x9'));var squel=require('squel');var crypto=require(_0xbbe4('0xa'));var jsforce=require(_0xbbe4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xbbe4('0x7'));var querystring=require(_0xbbe4('0xc'));var Papa=require('papaparse');var Redis=require(_0xbbe4('0xd'));var authService=require(_0xbbe4('0xe'));var qs=require(_0xbbe4('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbbe4('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xbbe4('0x11'));var config=require(_0xbbe4('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xbbe4('0x13'))['db'];config[_0xbbe4('0x14')]=_['defaults'](config[_0xbbe4('0x14')],{'host':_0xbbe4('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbbe4('0x14')]));require(_0xbbe4('0x16'))[_0xbbe4('0x17')](socket);function respondWithStatusCode(_0x64b580,_0x321681){_0x321681=_0x321681||0xcc;return function(_0x2cc49a){if(_0x2cc49a){return _0x64b580[_0xbbe4('0x18')](_0x321681);}return _0x64b580[_0xbbe4('0x19')](_0x321681)[_0xbbe4('0x1a')]();};}function respondWithResult(_0x50f8a8,_0x232f0b){_0x232f0b=_0x232f0b||0xc8;return function(_0x257eb9){if(_0x257eb9){return _0x50f8a8['status'](_0x232f0b)[_0xbbe4('0x1b')](_0x257eb9);}};}function respondWithFilteredResult(_0x373aeb,_0xbdd6de){return function(_0x317f59){if(_0x317f59){var _0x1a30cb=typeof _0xbdd6de[_0xbbe4('0x1c')]===_0xbbe4('0x1d')&&typeof _0xbdd6de[_0xbbe4('0x1e')]==='undefined';var _0x17dcd6=_0x317f59[_0xbbe4('0x1f')];var _0x3d679e=_0x1a30cb?0x0:_0xbdd6de[_0xbbe4('0x1c')];var _0x14b803=_0x1a30cb?_0x317f59[_0xbbe4('0x1f')]:_0xbdd6de['offset']+_0xbdd6de[_0xbbe4('0x1e')];var _0x15730a;if(_0x14b803>=_0x17dcd6){_0x14b803=_0x17dcd6;_0x15730a=0xc8;}else{_0x15730a=0xce;}_0x373aeb[_0xbbe4('0x19')](_0x15730a);return _0x373aeb[_0xbbe4('0x20')](_0xbbe4('0x21'),_0x3d679e+'-'+_0x14b803+'/'+_0x17dcd6)[_0xbbe4('0x1b')](_0x317f59);}return null;};}function patchUpdates(_0x48913c){return function(_0x15c7c6){try{jsonpatch['apply'](_0x15c7c6,_0x48913c,!![]);}catch(_0x5a8010){return BPromise['reject'](_0x5a8010);}return _0x15c7c6['save']();};}function saveUpdates(_0x187380,_0x257236){return function(_0x1a0743){if(_0x1a0743){return _0x1a0743['update'](_0x187380)[_0xbbe4('0x22')](function(_0x1e8ad1){return _0x1e8ad1;});}return null;};}function removeEntity(_0x324765,_0x48b7e9){return function(_0x498f07){if(_0x498f07){return _0x498f07[_0xbbe4('0x23')]()[_0xbbe4('0x22')](function(){_0x324765[_0xbbe4('0x19')](0xcc)[_0xbbe4('0x1a')]();});}};}function handleEntityNotFound(_0x554da5,_0xed0af0){return function(_0x4bbd94){if(!_0x4bbd94){_0x554da5[_0xbbe4('0x18')](0x194);}return _0x4bbd94;};}function handleError(_0x1b089c,_0x441ac5){_0x441ac5=_0x441ac5||0x1f4;return function(_0x16f595){logger[_0xbbe4('0x24')](_0x16f595[_0xbbe4('0x25')]);if(_0x16f595['name']){delete _0x16f595[_0xbbe4('0x26')];}_0x1b089c[_0xbbe4('0x19')](_0x441ac5)['send'](_0x16f595);};}exports[_0xbbe4('0x27')]=function(_0x167d05,_0x25aec7){var _0x296569={},_0xed7425={},_0x195029={'count':0x0,'rows':[]};var _0x168348=_[_0xbbe4('0x28')](db['UserProfile']['rawAttributes'],function(_0x20df55){return{'name':_0x20df55[_0xbbe4('0x29')],'type':_0x20df55[_0xbbe4('0x2a')]['key']};});_0xed7425[_0xbbe4('0x2b')]=_[_0xbbe4('0x28')](_0x168348,_0xbbe4('0x26'));_0xed7425[_0xbbe4('0x2c')]=_[_0xbbe4('0x2d')](_0x167d05[_0xbbe4('0x2c')]);_0xed7425[_0xbbe4('0x2e')]=_[_0xbbe4('0x2f')](_0xed7425['model'],_0xed7425[_0xbbe4('0x2c')]);_0x296569[_0xbbe4('0x30')]=_['intersection'](_0xed7425[_0xbbe4('0x2b')],qs[_0xbbe4('0x31')](_0x167d05[_0xbbe4('0x2c')][_0xbbe4('0x31')]));_0x296569[_0xbbe4('0x30')]=_0x296569[_0xbbe4('0x30')]['length']?_0x296569[_0xbbe4('0x30')]:_0xed7425['model'];if(!_0x167d05[_0xbbe4('0x2c')][_0xbbe4('0x32')]('nolimit')){_0x296569[_0xbbe4('0x1e')]=qs[_0xbbe4('0x1e')](_0x167d05[_0xbbe4('0x2c')]['limit']);_0x296569[_0xbbe4('0x1c')]=qs['offset'](_0x167d05['query'][_0xbbe4('0x1c')]);}_0x296569[_0xbbe4('0x33')]=qs[_0xbbe4('0x34')](_0x167d05[_0xbbe4('0x2c')]['sort']);_0x296569[_0xbbe4('0x35')]=qs[_0xbbe4('0x2e')](_['pick'](_0x167d05['query'],_0xed7425['filters']),_0x168348);if(_0x167d05[_0xbbe4('0x2c')]['filter']){_0x296569[_0xbbe4('0x35')]=_[_0xbbe4('0x36')](_0x296569[_0xbbe4('0x35')],{'$or':_[_0xbbe4('0x28')](_0x168348,function(_0x13aa77){if(_0x13aa77[_0xbbe4('0x2a')]!=='VIRTUAL'){var _0x552711={};_0x552711[_0x13aa77[_0xbbe4('0x26')]]={'$like':'%'+_0x167d05[_0xbbe4('0x2c')][_0xbbe4('0x37')]+'%'};return _0x552711;}})});}_0x296569=_[_0xbbe4('0x36')]({},_0x296569,_0x167d05[_0xbbe4('0x38')]);var _0x35f16f={'where':_0x296569[_0xbbe4('0x35')]};return db[_0xbbe4('0x39')][_0xbbe4('0x1f')](_0x35f16f)[_0xbbe4('0x22')](function(_0x244343){_0x195029[_0xbbe4('0x1f')]=_0x244343;if(_0x167d05[_0xbbe4('0x2c')][_0xbbe4('0x3a')]){_0x296569[_0xbbe4('0x3b')]=[{'all':!![]}];}return db[_0xbbe4('0x39')]['findAll'](_0x296569);})[_0xbbe4('0x22')](function(_0x8250b2){_0x195029[_0xbbe4('0x3c')]=_0x8250b2;return _0x195029;})[_0xbbe4('0x22')](respondWithFilteredResult(_0x25aec7,_0x296569))[_0xbbe4('0x3d')](handleError(_0x25aec7,null));};exports[_0xbbe4('0x3e')]=function(_0x24aae5,_0x36b7c1){var _0x4b0eb4={'raw':![],'where':{'id':_0x24aae5[_0xbbe4('0x3f')]['id']}},_0x1dfcbd={};_0x1dfcbd[_0xbbe4('0x2b')]=_[_0xbbe4('0x2d')](db[_0xbbe4('0x39')][_0xbbe4('0x40')]);_0x1dfcbd[_0xbbe4('0x2c')]=_[_0xbbe4('0x2d')](_0x24aae5[_0xbbe4('0x2c')]);_0x1dfcbd['filters']=_[_0xbbe4('0x2f')](_0x1dfcbd['model'],_0x1dfcbd[_0xbbe4('0x2c')]);_0x4b0eb4['attributes']=_[_0xbbe4('0x2f')](_0x1dfcbd['model'],qs[_0xbbe4('0x31')](_0x24aae5[_0xbbe4('0x2c')]['fields']));_0x4b0eb4[_0xbbe4('0x30')]=_0x4b0eb4[_0xbbe4('0x30')]['length']?_0x4b0eb4[_0xbbe4('0x30')]:_0x1dfcbd[_0xbbe4('0x2b')];if(_0x24aae5[_0xbbe4('0x2c')][_0xbbe4('0x3a')]){_0x4b0eb4['include']=[{'all':!![]}];}_0x4b0eb4=_['merge']({},_0x4b0eb4,_0x24aae5['options']);return db[_0xbbe4('0x39')][_0xbbe4('0x41')](_0x4b0eb4)[_0xbbe4('0x22')](handleEntityNotFound(_0x36b7c1,null))[_0xbbe4('0x22')](respondWithResult(_0x36b7c1,null))['catch'](handleError(_0x36b7c1,null));};exports['create']=function(_0x59ab6d,_0x5d77e3){return db[_0xbbe4('0x39')]['create'](_0x59ab6d['body'],{})[_0xbbe4('0x22')](respondWithResult(_0x5d77e3,0xc9))[_0xbbe4('0x3d')](handleError(_0x5d77e3,null));};exports[_0xbbe4('0x42')]=function(_0x6eaadd,_0x34cf56){var _0x185a7e={'where':{'id':_0x6eaadd['params']['id']}},_0x3ed902={};_0x3ed902['model']=_[_0xbbe4('0x2d')](db['UserProfile'][_0xbbe4('0x40')]);_0x185a7e[_0xbbe4('0x30')]=_[_0xbbe4('0x2f')](_0x3ed902[_0xbbe4('0x2b')],qs[_0xbbe4('0x31')](_0x6eaadd[_0xbbe4('0x2c')]['fields']));_0x185a7e[_0xbbe4('0x30')]=_0x185a7e[_0xbbe4('0x30')][_0xbbe4('0x43')]?_0x185a7e['attributes']:_0x3ed902[_0xbbe4('0x2b')];if(_0x6eaadd[_0xbbe4('0x2c')][_0xbbe4('0x3a')]){_0x185a7e['include']=[{'all':!![]}];}_0x185a7e=_['merge']({},_0x185a7e,_0x6eaadd[_0xbbe4('0x38')]);return db[_0xbbe4('0x39')][_0xbbe4('0x41')](_0x185a7e)[_0xbbe4('0x22')](handleEntityNotFound(_0x34cf56,null))['then'](function(_0x14c7d4){if(_0x14c7d4){var _0x1d3b28=_0x14c7d4[_0xbbe4('0x44')]({'plain':!![]});_0x1d3b28=qs['omit'](_0x1d3b28,['id',_0xbbe4('0x45'),'updatedAt','crudPermissions']);_0x6eaadd[_0xbbe4('0x46')]=_[_0xbbe4('0x47')](_0x6eaadd[_0xbbe4('0x46')],['id',_0xbbe4('0x45'),'updatedAt']);return db[_0xbbe4('0x48')][_0xbbe4('0x49')](function(_0x2ca69f){return db['UserProfile']['create'](_[_0xbbe4('0x36')](_0x1d3b28,_0x6eaadd[_0xbbe4('0x46')]),{'include':_0x6eaadd[_0xbbe4('0x2c')][_0xbbe4('0x3a')]?[{'all':!![]}]:undefined,'transaction':_0x2ca69f})[_0xbbe4('0x22')](function(_0x138987){var _0x1eac75=_0x138987[_0xbbe4('0x44')]({'plain':!![]});return db['UserProfileSection'][_0xbbe4('0x4a')]({'where':{'userProfileId':_0x6eaadd[_0xbbe4('0x3f')]['id']},'raw':!![]})[_0xbbe4('0x22')](function(_0x35d470){if(_0x35d470){return BPromise['each'](_0x35d470,function(_0x2d54a1){return new BPromise(function(_0x37685d,_0x209370){if(_0x2d54a1['autoAssociation']===null||_0x2d54a1[_0xbbe4('0x4b')]===0x1)_0x37685d(null);return db[_0xbbe4('0x4c')]['findAll']({'where':{'sectionId':_0x2d54a1['id']},'raw':!![]})[_0xbbe4('0x22')](function(_0x2b10ec){var _0x154af8=_['map'](_0x2b10ec,function(_0x16921a){return qs['omit'](_0x16921a,['id',_0xbbe4('0x45'),'updatedAt','sectionId']);});_0x37685d(_0x154af8);})['catch'](function(_0xc3aad4){_0x209370(_0xc3aad4);});})[_0xbbe4('0x22')](function(_0x4627c4){var _0x2bdfc2=qs['omit'](_0x2d54a1,['id',_0xbbe4('0x45'),_0xbbe4('0x4d')]);_0x2bdfc2[_0xbbe4('0x4e')]=_0x1eac75['id'];if(_0x4627c4)_0x2bdfc2['Resources']=_0x4627c4;return _0x2bdfc2;})[_0xbbe4('0x22')](function(_0x46e54f){return db['UserProfileSection'][_0xbbe4('0x4f')](_0x46e54f,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x2ca69f});});})[_0xbbe4('0x22')](function(){return _0x1eac75;});}});});});}})[_0xbbe4('0x22')](respondWithResult(_0x34cf56,0xc9))[_0xbbe4('0x3d')](handleError(_0x34cf56,null));};exports[_0xbbe4('0x50')]=function(_0x537df1,_0x208b46){if(_0x537df1['body']['id']){delete _0x537df1['body']['id'];}return db[_0xbbe4('0x39')][_0xbbe4('0x41')]({'where':{'id':_0x537df1[_0xbbe4('0x3f')]['id']}})[_0xbbe4('0x22')](handleEntityNotFound(_0x208b46,null))[_0xbbe4('0x22')](saveUpdates(_0x537df1[_0xbbe4('0x46')],null))[_0xbbe4('0x22')](respondWithResult(_0x208b46,null))[_0xbbe4('0x3d')](handleError(_0x208b46,null));};exports[_0xbbe4('0x23')]=function(_0x2d48bd,_0x12d520){return db[_0xbbe4('0x39')]['find']({'where':{'id':_0x2d48bd[_0xbbe4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x12d520,null))[_0xbbe4('0x22')](removeEntity(_0x12d520,null))[_0xbbe4('0x3d')](handleError(_0x12d520,null));};exports[_0xbbe4('0x51')]=function(_0xd8df30,_0x4f1f1b){return db[_0xbbe4('0x39')][_0xbbe4('0x51')]()[_0xbbe4('0x22')](respondWithResult(_0x4f1f1b,null))['catch'](handleError(_0x4f1f1b,null));};exports['addSections']=function(_0x5d74a7,_0x44dc11){var _0x14e668=_0x5d74a7['body'];return db[_0xbbe4('0x39')][_0xbbe4('0x41')]({'where':{'id':_0x5d74a7['params']['id']}})[_0xbbe4('0x22')](handleEntityNotFound(_0x44dc11,null))[_0xbbe4('0x22')](function(_0x548594){if(_0x548594){return db[_0xbbe4('0x48')][_0xbbe4('0x49')](function(_0x3c9f31){return db[_0xbbe4('0x52')]['destroy']({'where':{'userProfileId':_0x5d74a7['params']['id'],'sectionId':_[_0xbbe4('0x28')](_0x14e668,function(_0x3d37fe){return _0x3d37fe[_0xbbe4('0x53')];})},'transaction':_0x3c9f31})[_0xbbe4('0x22')](function(){var _0x9820a=_[_0xbbe4('0x28')](_0x14e668,function(_0x39b472){_0x39b472['userProfileId']=_0x5d74a7[_0xbbe4('0x3f')]['id'];return _0x39b472;});var _0x140816=[];return BPromise[_0xbbe4('0x54')](_0x9820a,function(_0x3b9bf7){return db[_0xbbe4('0x52')][_0xbbe4('0x4f')](_0x3b9bf7,{'include':[{'model':db[_0xbbe4('0x4c')],'as':_0xbbe4('0x55')}],'raw':!![],'transaction':_0x3c9f31})['then'](function(_0xe07f82){_0x140816['push'](_0xe07f82[_0xbbe4('0x44')]({'plain':!![]}));});})[_0xbbe4('0x22')](function(){return _0x140816;});});});}})[_0xbbe4('0x22')](function(_0x5eeb4c){return _0x5eeb4c;})[_0xbbe4('0x22')](respondWithResult(_0x44dc11,null))[_0xbbe4('0x3d')](handleError(_0x44dc11,null));};exports[_0xbbe4('0x56')]=function(_0x231636,_0x1ce626){var _0x5aa497;return db['UserProfile'][_0xbbe4('0x41')]({'where':{'id':_0x231636[_0xbbe4('0x3f')]['id']},'attributes':['id',_0xbbe4('0x26')]})[_0xbbe4('0x22')](handleEntityNotFound(_0x1ce626,null))[_0xbbe4('0x22')](function(_0x3c4523){if(_0x3c4523){_0x5aa497=_0x3c4523;return db[_0xbbe4('0x52')][_0xbbe4('0x23')]({'where':{'userProfileId':_0x231636[_0xbbe4('0x3f')]['id'],'sectionId':_0x231636[_0xbbe4('0x2c')][_0xbbe4('0x57')]}});}})['then'](function(){return _0x5aa497;})[_0xbbe4('0x22')](respondWithStatusCode(_0x1ce626,null))[_0xbbe4('0x3d')](handleError(_0x1ce626,null));};exports['getSections']=function(_0x48baa4,_0x3f036c){var _0xdb2f42=[];var _0x3cc0f1=[];return db[_0xbbe4('0x52')][_0xbbe4('0x4a')]({'where':{'userProfileId':_0x48baa4['params']['id']},'raw':!![]})[_0xbbe4('0x22')](function(_0x4d8898){_0xdb2f42=_['filter'](_0x4d8898,function(_0x28398f){return _0x28398f[_0xbbe4('0x58')]===0x1||_[_0xbbe4('0x59')]([0x3eb,0x709],_0x28398f[_0xbbe4('0x53')]);});if(!_[_0xbbe4('0x5a')](_0xdb2f42)){return _[_0xbbe4('0x28')](_0xdb2f42,function(_0x331dd0){return _0x331dd0[_0xbbe4('0x53')];});}else{return;}})['then'](function(_0x1602fd){if(_0x1602fd)_0x3cc0f1=_0x1602fd;if(_[_0xbbe4('0x59')](_0x3cc0f1,0x64)){var _0x2f4435=_['find'](_0xdb2f42,{'sectionId':0x64});return hasDefaultDashboard(_0x2f4435)[_0xbbe4('0x22')](function(_0x5a1440){return _[_0xbbe4('0x28')](_0xdb2f42,function(_0x4d6572){if(_0x4d6572['sectionId']===0x64){_0x4d6572[_0xbbe4('0x5b')]=_0x5a1440;}return _0x4d6572;});});}else{return;}})[_0xbbe4('0x22')](function(_0x5360d1){if(_0x5360d1)_0xdb2f42=_0x5360d1;if(_[_0xbbe4('0x59')](_0x3cc0f1,0x3eb)){var _0x15f2d9=_[_0xbbe4('0x41')](_0xdb2f42,{'sectionId':0x3eb});return getCustomDashboards(_0x15f2d9)[_0xbbe4('0x22')](function(_0x3f7108){return _[_0xbbe4('0x28')](_0xdb2f42,function(_0x4aba3b){if(_0x15f2d9[_0xbbe4('0x58')]){if(_0x4aba3b['sectionId']===0x3eb){_0x4aba3b['subsections']=_0x3f7108;}}else{if(_0x4aba3b[_0xbbe4('0x53')]===0x64){if(!_0x4aba3b[_0xbbe4('0x5b')]){_0x4aba3b[_0xbbe4('0x5b')]=[];}_0x4aba3b[_0xbbe4('0x5b')]=_0x4aba3b[_0xbbe4('0x5b')]['concat'](_0x3f7108);}}return _0x4aba3b;});});}else{return;}})[_0xbbe4('0x22')](function(_0x3501c8){if(_0x3501c8)_0xdb2f42=_0x3501c8;if(_['includes'](_0x3cc0f1,0x709)){var _0x4758b4=_[_0xbbe4('0x41')](_0xdb2f42,{'sectionId':0x709});return getPlugins(_0x4758b4)[_0xbbe4('0x22')](function(_0x1755b5){if(_0x4758b4[_0xbbe4('0x58')]){return _[_0xbbe4('0x28')](_0xdb2f42,function(_0x53f8c6){if(_0x53f8c6[_0xbbe4('0x53')]===0x709){_0x53f8c6[_0xbbe4('0x5b')]=_0x1755b5;}return _0x53f8c6;});}else{var _0x30893e={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1755b5};var _0x3b53ed=_['map'](_0xdb2f42);_0x3b53ed[_0xbbe4('0x5c')](_0x30893e);return _0x3b53ed;}});}else{return;}})[_0xbbe4('0x22')](function(_0xea656c){if(_0xea656c)_0xdb2f42=_0xea656c;return _[_0xbbe4('0x37')](_0xdb2f42,['enabled',0x1]);})['then'](respondWithResult(_0x3f036c,null))[_0xbbe4('0x3d')](handleError(_0x3f036c,null));};function hasDefaultDashboard(_0x78832f){var _0x9993d2=[0x65];return new BPromise(function(_0x4fba84,_0x24eb32){try{if(_0x78832f[_0xbbe4('0x4b')]){_0x4fba84(_0x9993d2);}else{return db[_0xbbe4('0x4c')]['findOne']({'where':{'sectionId':_0x78832f['id']},'raw':!![]})[_0xbbe4('0x22')](function(_0x42e6bc){_0x42e6bc?_0x4fba84(_0x9993d2):_0x4fba84();});}}catch(_0xd5ddb2){_0x24eb32(_0xd5ddb2);}});}function getCustomDashboards(_0x5bd266){var _0x325417=[];return new BPromise(function(_0x9a8e22,_0x18a3f9){try{if(_0x5bd266[_0xbbe4('0x4b')]){return db[_0xbbe4('0x5d')][_0xbbe4('0x4a')]({'raw':!![]})[_0xbbe4('0x22')](function(_0x12cb88){_0x12cb88[_0xbbe4('0x5e')](function(_0xc87a1d){_0x325417[_0xbbe4('0x5c')](_0xc87a1d['id']+0x1869f);});_0x9a8e22(_0x325417);});}else{return db[_0xbbe4('0x4c')][_0xbbe4('0x4a')]({'where':{'sectionId':_0x5bd266['id']},'raw':!![]})[_0xbbe4('0x22')](function(_0x3f24b1){_0x3f24b1[_0xbbe4('0x5e')](function(_0x284cb8){_0x325417[_0xbbe4('0x5c')](_0x284cb8['resourceId']+0x1869f);});_0x9a8e22(_0x325417);});}}catch(_0x233a82){_0x18a3f9(_0x233a82);}});}function getPlugins(_0x339784){var _0x2d0ddc=[];return new BPromise(function(_0xe2c1fc,_0x11610b){try{if(_0x339784[_0xbbe4('0x4b')]){return db[_0xbbe4('0x5f')][_0xbbe4('0x4a')]({'raw':!![]})['then'](function(_0x1eb48d){_0x1eb48d[_0xbbe4('0x5e')](function(_0x31f406){_0x2d0ddc[_0xbbe4('0x5c')](_0x31f406['id']+0x15b38);});_0xe2c1fc(_0x2d0ddc);});}else{return db['UserProfileResource'][_0xbbe4('0x4a')]({'where':{'sectionId':_0x339784['id']},'raw':!![]})['then'](function(_0x43b7df){_0x43b7df[_0xbbe4('0x5e')](function(_0x43be71){_0x2d0ddc['push'](_0x43be71[_0xbbe4('0x60')]+0x15b38);});_0xe2c1fc(_0x2d0ddc);});}}catch(_0x38d748){_0x11610b(_0x38d748);}});}exports[_0xbbe4('0x61')]=function(_0x1dee12,_0x5e84d3){return db[_0xbbe4('0x39')]['find']({'where':{'id':_0x1dee12[_0xbbe4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5e84d3,null))[_0xbbe4('0x22')](function(_0x173205){if(_0x173205){return db[_0xbbe4('0x48')]['transaction'](function(_0x4e8afb){return db[_0xbbe4('0x52')][_0xbbe4('0x4a')]({'where':{'userProfileId':_0x1dee12[_0xbbe4('0x3f')]['id']},'attributes':['id'],'raw':!![]})[_0xbbe4('0x22')](function(_0x352d80){if(_0x352d80){return db[_0xbbe4('0x52')]['destroy']({'where':{'userProfileId':_0x1dee12['params']['id'],'id':_[_0xbbe4('0x28')](_0x352d80,function(_0x16567d){return _0x16567d['id'];})},'transaction':_0x4e8afb});}})[_0xbbe4('0x22')](function(_0x34ae08){var _0x552bc6=_[_0xbbe4('0x28')](_0x1dee12[_0xbbe4('0x46')],function(_0x392948){_0x392948[_0xbbe4('0x4e')]=_0x1dee12['params']['id'];return _0x392948;});return db[_0xbbe4('0x52')]['bulkCreate'](_0x552bc6,{'raw':!![],'transaction':_0x4e8afb});})[_0xbbe4('0x22')](function(_0x395800){var _0x427f77=_['filter'](_[_0xbbe4('0x28')](_0x395800,function(_0x3dd8b6){return _0x3dd8b6[_0xbbe4('0x44')]({'plain':!![]});}),{'includeAll':![]});if(_0x427f77){return db[_0xbbe4('0x52')][_0xbbe4('0x4a')]({'where':{'userProfileId':_0x1dee12[_0xbbe4('0x3f')]['id'],'sectionId':_[_0xbbe4('0x28')](_0x427f77,function(_0x7e279c){return _0x7e279c[_0xbbe4('0x53')];})},'attributes':['id',_0xbbe4('0x53')],'raw':!![]})[_0xbbe4('0x22')](function(_0x28e135){var _0x5c2686=_[_0xbbe4('0x28')](_0x1dee12['body'],function(_0x18232d){_0x18232d[_0xbbe4('0x4e')]=_0x1dee12[_0xbbe4('0x3f')]['id'];return _0x18232d;});return db['UserProfileResource'][_0xbbe4('0x62')](_0x5c2686,{'raw':!![],'transaction':_0x4e8afb});});}})[_0xbbe4('0x3d')](handleError(_0x5e84d3,null));});}})[_0xbbe4('0x22')](function(_0xac6a43){var _0x1b4651=_[_0xbbe4('0x28')](_0xac6a43,function(_0x4c33ee){return _0x4c33ee[_0xbbe4('0x44')]({'plain':!![]});});})[_0xbbe4('0x22')](respondWithResult(_0x5e84d3,null))[_0xbbe4('0x3d')](handleError(_0x5e84d3,null));};exports[_0xbbe4('0x63')]=function(_0x481a3d,_0x138bfd,_0x196226){return db[_0xbbe4('0x39')][_0xbbe4('0x41')]({'where':{'id':_0x481a3d['params']['id']}})[_0xbbe4('0x22')](handleEntityNotFound(_0x138bfd,null))[_0xbbe4('0x22')](function(_0x42adf8){if(_0x42adf8){return _0x42adf8['removeResources'](_0x481a3d[_0xbbe4('0x2c')][_0xbbe4('0x57')]);}})[_0xbbe4('0x22')](respondWithStatusCode(_0x138bfd,null))[_0xbbe4('0x3d')](handleError(_0x138bfd,null));};exports[_0xbbe4('0x64')]=function(_0x6d609f,_0xcd41e8){var _0x13661d={};if(!_0x6d609f[_0xbbe4('0x2c')][_0xbbe4('0x65')])throw new Error(_0xbbe4('0x66'));if(!_0x6d609f[_0xbbe4('0x2c')][_0xbbe4('0x32')]('nolimit')){_0x13661d[_0xbbe4('0x1e')]=qs[_0xbbe4('0x1e')](_0x6d609f[_0xbbe4('0x2c')][_0xbbe4('0x1e')]);_0x13661d['offset']=qs[_0xbbe4('0x1c')](_0x6d609f[_0xbbe4('0x2c')][_0xbbe4('0x1c')]);}return db['UserProfile'][_0xbbe4('0x41')]({'where':{'id':_0x6d609f['params']['id']}})[_0xbbe4('0x22')](function(_0x2ee788){if(!_0x2ee788)throw new Error(_0xbbe4('0x67')+_0x6d609f[_0xbbe4('0x3f')]['id']);return db[_0xbbe4('0x39')][_0xbbe4('0x64')](_0x6d609f);})['then'](respondWithFilteredResult(_0xcd41e8,_0x13661d))[_0xbbe4('0x3d')](handleError(_0xcd41e8,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index ebb04aa..b759da0 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 _0x68fd=['exports','events','UserProfile','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x547add,_0x387042){var _0x2ed1f3=function(_0x3bbb4d){while(--_0x3bbb4d){_0x547add['push'](_0x547add['shift']());}};_0x2ed1f3(++_0x387042);}(_0x68fd,0x1e9));var _0xd68f=function(_0x226291,_0x45dff0){_0x226291=_0x226291-0x0;var _0x2ae02e=_0x68fd[_0x226291];return _0x2ae02e;};'use strict';var EventEmitter=require(_0xd68f('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xd68f('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xd68f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd68f('0x3'),'afterDestroy':_0xd68f('0x4')};function emitEvent(_0x96d959){return function(_0x3e5e78,_0x37c481,_0x9814cb){UserProfileEvents[_0xd68f('0x5')](_0x96d959+':'+_0x3e5e78['id'],_0x3e5e78);UserProfileEvents[_0xd68f('0x5')](_0x96d959,_0x3e5e78);_0x9814cb(null);};}for(var e in events){if(events[_0xd68f('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xd68f('0x7')]=UserProfileEvents; \ No newline at end of file +var _0xeda7=['../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xeda7,0x196));var _0x7eda=function(_0x12ca5f,_0x223d98){_0x12ca5f=_0x12ca5f-0x0;var _0xfc3ae9=_0xeda7[_0x12ca5f];return _0xfc3ae9;};'use strict';var EventEmitter=require(_0x7eda('0x0'));var UserProfile=require(_0x7eda('0x1'))['db'][_0x7eda('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x7eda('0x3')](0x0);var events={'afterCreate':_0x7eda('0x4'),'afterUpdate':_0x7eda('0x5'),'afterDestroy':_0x7eda('0x6')};function emitEvent(_0x2b1d21){return function(_0x324a25,_0x36a9f1,_0x15856b){UserProfileEvents[_0x7eda('0x7')](_0x2b1d21+':'+_0x324a25['id'],_0x324a25);UserProfileEvents[_0x7eda('0x7')](_0x2b1d21,_0x324a25);_0x15856b(null);};}for(var e in events){if(events[_0x7eda('0x8')](e)){var event=events[e];UserProfile[_0x7eda('0x9')](e,emitEvent(event));}}module[_0x7eda('0xa')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 65a8e9d..8416b09 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 _0xd035=['Tag','triggers','Trigger','trunks','Trunk','Variable','plugins','Plugin','extractedreports','reportId','metrics','AnalyticMetric','charAt','slice','Sequelize','QueryTypes','SELECT','select','ui.','ui.createdAt','from','user_has_','_interactions','where','sequelize','query','toString','OpenTabs','define','user_profiles','raw','section','mergeResources','isEmpty','length','push','UserProfileSection','find','all','ignore','union','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','AnalyticExtractedReport','foreignKey','merge','options','forEach','reportType','default','DefaultReports','custom','CustomReports','count','customSorting','extraQueryConditions','includeAll','include','Tags','color','tag','ThroughTags','rows','openTabs','true','chat','dataValues','sms','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','associatedResources','catch','model','map','name','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','ListId','lists','CmList','companies','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','Agents','User','role','agent','Telephones','membername','telephone','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','queuecampaigns','VoiceQueues','users','agents','telephones','Users','admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','Dashboard','Pause','scheduler','sounds','Sound','tags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd035,0x115));var _0x5d03=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0xd035[_0x2283dc];return _0x16db90;};'use strict';var _=require(_0x5d03('0x0'));var attributes=require(_0x5d03('0x1'));var qs=require('../../components/parsers/qs');var squel=require(_0x5d03('0x2'));module[_0x5d03('0x3')]=function(_0x1fa396){var _0x2815c0=_0x1fa396[_0x5d03('0x4')];function _0x26a1cc(_0x4de0fe,_0x69dea){return new Promise(function(_0x3344e9,_0x26fd6c){if(!_0x69dea)return _0x3344e9(null);var _0x4a901b=_0x69dea[_0x5d03('0x5')]?{[_0x69dea[_0x5d03('0x5')][_0x5d03('0x6')]]:_0x69dea[_0x5d03('0x5')][_0x5d03('0x7')]}:undefined;return _0x2815c0[_0x4de0fe][_0x5d03('0x8')]({'where':_0x4a901b,'raw':!![]})[_0x5d03('0x9')](function(_0x462dad){_0x69dea[_0x5d03('0xa')]=_['map'](_0x462dad,'id');_0x3344e9(_0x69dea);})[_0x5d03('0xb')](function(_0x2c9d6c){_0x26fd6c(_0x2c9d6c);});});}function _0x473bbd(_0x386333,_0x2d20ec){return new Promise(function(_0x268417,_0x1cafad){var _0x4d3cf2=_0x386333[_0x5d03('0x5')]?{[_0x386333[_0x5d03('0x5')][_0x5d03('0x6')]]:_0x386333['filter']['value']}:undefined;return _0x2815c0[_0x386333[_0x5d03('0xc')]][_0x5d03('0x8')]({'where':_0x4d3cf2,'raw':!![]})[_0x5d03('0x9')](function(_0x2c4a86){_0x2d20ec['associatedResources']=_[_0x5d03('0xd')](_0x2c4a86,function(_0x1361a1){return _0x1361a1[_0x5d03('0xe')];});_0x268417(_0x2d20ec);})[_0x5d03('0xb')](function(_0x2e098f){_0x1cafad(_0x2e098f);});});}function _0x3eb724(_0x14f86e,_0x5c3e3b,_0x58124f){if(!_0x5c3e3b)return Promise['resolve'](null);return new Promise(function(_0x2b35a1,_0x2e025c){return _0x2815c0['UserProfileResource'][_0x5d03('0x8')]({'where':{'sectionId':_0x5c3e3b['id']},'raw':!![]})['then'](function(_0x496492){if(_0x14f86e[_0x5d03('0x6')]&&_0x14f86e[_0x5d03('0x6')]!=='id'){_0x5c3e3b[_0x5d03('0xa')]=_['map'](_0x496492,function(_0x161eff){return _0x161eff[_0x14f86e[_0x5d03('0x6')]];});}else{if(_0x58124f==='AnalyticExtractedReport'){_0x5c3e3b[_0x5d03('0xa')]=_[_0x5d03('0xd')](_0x496492,function(_0x232129){return{'id':_0x232129[_0x5d03('0xf')],'type':_0x232129[_0x5d03('0x10')]};});}else{_0x5c3e3b[_0x5d03('0xa')]=_[_0x5d03('0xd')](_0x496492,function(_0x4bc9f5){return _0x4bc9f5['resourceId'];});}}_0x2b35a1(_0x5c3e3b);})[_0x5d03('0xb')](function(_0x1c7be1){_0x2e025c(_0x1c7be1);});});}function _0x9c73a1(_0x5137a3,_0x2fab9a){var _0x416f63={'parentSections':[]};switch(_0x5137a3[_0x5d03('0x11')]()){case _0x5d03('0x12'):_0x416f63[_0x5d03('0x13')]=_0x5d03('0x14');break;case _0x5d03('0x15'):_0x416f63[_0x5d03('0x13')]=_0x5d03('0x16');break;case _0x5d03('0x17'):_0x416f63[_0x5d03('0x13')]='SquareRecording';_0x416f63[_0x5d03('0x18')]=[{'name':_0x5d03('0x19'),'field':_0x5d03('0xe'),'foreignKey':_0x5d03('0x1a')}];break;case _0x5d03('0x1b'):_0x416f63[_0x5d03('0x13')]=_0x5d03('0x1c');break;case _0x5d03('0x1d'):_0x416f63[_0x5d03('0x13')]=_0x5d03('0x1e');_0x416f63[_0x5d03('0x18')]=[{'name':'Lists','field':'id','foreignKey':_0x5d03('0x1f')}];break;case _0x5d03('0x20'):_0x416f63[_0x5d03('0x13')]=_0x5d03('0x21');break;case _0x5d03('0x22'):_0x416f63[_0x5d03('0x13')]='CmCompany';break;case _0x5d03('0x23'):_0x416f63[_0x5d03('0x13')]=_0x5d03('0x24');break;case _0x5d03('0x25'):_0x416f63['childModel']=_0x5d03('0x26');break;case _0x5d03('0x27'):_0x416f63[_0x5d03('0x13')]=_0x5d03('0x28');break;case _0x5d03('0x29'):_0x416f63['childModel']=_0x5d03('0x2a');break;case'faxaccounts':_0x416f63[_0x5d03('0x13')]=_0x5d03('0x2b');break;case _0x5d03('0x2c'):case _0x5d03('0x2d'):case _0x5d03('0x2e'):_0x416f63[_0x5d03('0x13')]=_0x5d03('0x2f');break;case _0x5d03('0x30'):_0x416f63[_0x5d03('0x13')]=_0x5d03('0x31');break;case _0x5d03('0x32'):_0x416f63[_0x5d03('0x13')]=_0x5d03('0x33');break;case _0x5d03('0x34'):_0x416f63[_0x5d03('0x13')]='VoiceRecording';_0x416f63['parentSections']=[{'name':_0x5d03('0x35'),'field':_0x5d03('0xe'),'foreignKey':'membername','model':_0x5d03('0x36'),'filter':{'field':_0x5d03('0x37'),'value':[_0x5d03('0x38')]}},{'name':_0x5d03('0x39'),'field':_0x5d03('0xe'),'foreignKey':_0x5d03('0x3a'),'model':_0x5d03('0x36'),'filter':{'field':_0x5d03('0x37'),'value':[_0x5d03('0x3b')]}},{'name':'VoiceQueues','field':'name','foreignKey':_0x5d03('0x3c'),'model':_0x5d03('0x3d'),'filter':{'field':_0x5d03('0x10'),'value':[_0x5d03('0x3e')]}},{'name':_0x5d03('0x3f'),'field':'name','foreignKey':_0x5d03('0x3c'),'model':'VoiceQueue','filter':{'field':_0x5d03('0x10'),'value':[_0x5d03('0x40')]}}];break;case'musiconholds':_0x416f63[_0x5d03('0x13')]=_0x5d03('0x41');break;case _0x5d03('0x42'):_0x416f63[_0x5d03('0x13')]=_0x5d03('0x43');break;case _0x5d03('0x44'):_0x416f63['childModel']=_0x5d03('0x45');break;case _0x5d03('0x46'):_0x416f63[_0x5d03('0x13')]=_0x5d03('0x47');break;case _0x5d03('0x48'):_0x416f63[_0x5d03('0x13')]=_0x5d03('0x49');break;case _0x5d03('0x4a'):_0x416f63[_0x5d03('0x13')]=_0x5d03('0x4b');break;case _0x5d03('0x4c'):_0x416f63[_0x5d03('0x13')]=_0x5d03('0x4d');break;case _0x5d03('0x4e'):_0x416f63[_0x5d03('0x13')]='OpenchannelQueue';break;case'openchannelaccounts':_0x416f63[_0x5d03('0x13')]='OpenchannelAccount';break;case _0x5d03('0x4f'):_0x416f63[_0x5d03('0x13')]='SmsQueue';break;case _0x5d03('0x50'):_0x416f63[_0x5d03('0x13')]=_0x5d03('0x51');break;case _0x5d03('0x52'):_0x416f63[_0x5d03('0x13')]=_0x5d03('0x53');break;case _0x5d03('0x54'):_0x416f63['childModel']=_0x5d03('0x55');break;case'teams':_0x416f63[_0x5d03('0x13')]=_0x5d03('0x56');break;case'voicequeues':case _0x5d03('0x57'):_0x416f63[_0x5d03('0x13')]=_0x5d03('0x3d');if(_0x2fab9a){_0x416f63['parentSections']=[{'name':_0x5d03('0x58')},{'name':_0x5d03('0x3f')}];}break;case _0x5d03('0x59'):case _0x5d03('0x5a'):case _0x5d03('0x5b'):_0x416f63[_0x5d03('0x13')]=_0x5d03('0x36');if(_0x2fab9a){_0x416f63['parentSections']=[{'name':_0x5d03('0x5c'),'filter':{'field':'role','value':[_0x5d03('0x5d'),'user']},'ignore':!![]},{'name':_0x5d03('0x35')},{'name':_0x5d03('0x39')}];}break;case _0x5d03('0x5e'):_0x416f63[_0x5d03('0x13')]=_0x5d03('0x5f');break;case _0x5d03('0x60'):_0x416f63[_0x5d03('0x13')]=_0x5d03('0x61');break;case _0x5d03('0x62'):_0x416f63[_0x5d03('0x13')]='FreshdeskAccount';break;case _0x5d03('0x63'):_0x416f63['childModel']=_0x5d03('0x64');break;case'deskaccounts':_0x416f63['childModel']=_0x5d03('0x65');break;case _0x5d03('0x66'):_0x416f63[_0x5d03('0x13')]='ZohoAccount';break;case'vtigeraccounts':_0x416f63[_0x5d03('0x13')]=_0x5d03('0x36');break;case _0x5d03('0x67'):_0x416f63[_0x5d03('0x13')]=_0x5d03('0x68');break;case'dispositions':_0x416f63[_0x5d03('0x13')]=_0x5d03('0x69');break;case _0x5d03('0x6a'):_0x416f63[_0x5d03('0x13')]=_0x5d03('0x6b');break;case'intervals':_0x416f63[_0x5d03('0x13')]='Interval';break;case'pauses':_0x416f63[_0x5d03('0x13')]=_0x5d03('0x6c');break;case _0x5d03('0x6d'):_0x416f63[_0x5d03('0x13')]='Schedule';break;case _0x5d03('0x6e'):_0x416f63[_0x5d03('0x13')]=_0x5d03('0x6f');break;case _0x5d03('0x70'):_0x416f63[_0x5d03('0x13')]=_0x5d03('0x71');break;case'templates':_0x416f63['childModel']='Template';break;case _0x5d03('0x72'):_0x416f63[_0x5d03('0x13')]=_0x5d03('0x73');break;case _0x5d03('0x74'):_0x416f63[_0x5d03('0x13')]=_0x5d03('0x75');break;case'variables':_0x416f63['childModel']=_0x5d03('0x76');break;case _0x5d03('0x77'):_0x416f63[_0x5d03('0x13')]=_0x5d03('0x78');break;case _0x5d03('0x79'):_0x416f63['childModel']='AnalyticExtractedReport';_0x416f63[_0x5d03('0x18')]=[{'name':'Reports','field':'id','foreignKey':_0x5d03('0x7a')}];break;case _0x5d03('0x7b'):_0x416f63[_0x5d03('0x13')]=_0x5d03('0x7c');break;}return _0x416f63;}function _0x2d8b44(_0x341e36,_0x1fd469){var _0x591338=_0x341e36[_0x5d03('0x7d')](0x0)['toUpperCase']()+_0x341e36[_0x5d03('0x7e')](0x1);var _0x290823={'type':_0x2815c0[_0x5d03('0x7f')][_0x5d03('0x80')][_0x5d03('0x81')],'raw':!![]};return new Promise(function(_0x134cfe,_0x5d2baa){var _0xe99c6f=squel[_0x5d03('0x82')]()[_0x5d03('0x6')](_0x5d03('0x83')+_0x591338+'InteractionId','id')['field'](_0x5d03('0x84'))[_0x5d03('0x85')](_0x5d03('0x86')+_0x341e36+_0x5d03('0x87'),'ui')[_0x5d03('0x88')]('ui.UserId\x20=\x20?',_0x1fd469['id']);return _0x2815c0[_0x5d03('0x89')][_0x5d03('0x8a')](_0xe99c6f[_0x5d03('0x8b')](),_0x290823)['then'](function(_0x4c3dd5){_0x1fd469[_0x591338+_0x5d03('0x8c')]=_0x4c3dd5;_0x134cfe(_0x4c3dd5);})[_0x5d03('0xb')](function(_0x138105){_0x5d2baa(_0x138105);});});}return _0x1fa396[_0x5d03('0x8d')]('UserProfile',attributes,{'tableName':_0x5d03('0x8e'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2f3d04){var _0x1e6443={'raw':_0x2f3d04[_0x5d03('0x8a')][_0x5d03('0x8f')],'where':{}};var _0x564626={};var _0x1cc037={'count':0x0,'rows':[]};var _0x4b617b=_0x2f3d04['query'][_0x5d03('0x90')];var _0x8cafff=_0x2f3d04['query'][_0x5d03('0x91')]||![];var _0x150716=_0x9c73a1(_0x4b617b,_0x8cafff);if(!_0x150716['childModel'])throw new Error('Invalid\x20section\x20\x27'+_0x4b617b+'\x27');var _0x2cb690=[{'name':_0x4b617b}];if(!_[_0x5d03('0x92')](_0x150716[_0x5d03('0x18')]))_0x2cb690=_0x150716[_0x5d03('0x18')];var _0x5deffd=[];for(var _0x35901c=0x0;_0x35901c<_0x2cb690[_0x5d03('0x93')];_0x35901c++){_0x5deffd[_0x5d03('0x94')](_0x2815c0[_0x5d03('0x95')][_0x5d03('0x96')]({'where':{'userProfileId':_0x2f3d04['params']['id'],'name':_0x2cb690[_0x35901c]['name']},'raw':!![]}));}return Promise[_0x5d03('0x97')](_0x5deffd)[_0x5d03('0x9')](function(_0x1421aa){var _0x16d8c8=_[_0x5d03('0x5')](_0x1421aa,function(_0xc021cb){return _0xc021cb?_0xc021cb:undefined;});var _0x588ee7=_[_0x5d03('0x5')](_0x2cb690,[_0x5d03('0x98'),!![]]);var _0x23915c=_[_0x5d03('0x92')](_0x16d8c8)&&_[_0x5d03('0x92')](_0x588ee7)?null:_[_0x5d03('0x99')](_0x588ee7,_0x16d8c8);if(!_0x23915c)return null;var _0xc83973=[];for(var _0x50e60b=0x0;_0x50e60b<_0x23915c[_0x5d03('0x93')];_0x50e60b++){var _0x6f1554=_[_0x5d03('0x96')](_0x2cb690,function(_0x301bb4){return _0x23915c[_0x50e60b]?_0x301bb4['name']===_0x23915c[_0x50e60b][_0x5d03('0xe')]:null;});if(_0x6f1554){if(_0x23915c[_0x50e60b][_0x5d03('0x98')]){_0xc83973[_0x5d03('0x94')](_0x26a1cc(_0x150716[_0x5d03('0x13')],_0x23915c[_0x50e60b]));}else{if(!_0x23915c[_0x50e60b][_0x5d03('0x9a')]){_0xc83973[_0x5d03('0x94')](_0x3eb724(_0x6f1554,_0x23915c[_0x50e60b],_0x150716[_0x5d03('0x13')]));}else{if(_0x6f1554['model']){_0xc83973['push'](_0x473bbd(_0x6f1554,_0x23915c[_0x50e60b]));}}}}}return Promise[_0x5d03('0x97')](_0xc83973);})[_0x5d03('0x9')](function(_0x1f2780){var _0x3266f4=_0x1f2780;var _0x379778=null;if(_0x3266f4){_0x379778=_0x3266f4[_0x5d03('0x93')]===0x1?_0x3266f4[0x0]:null;}if(!_0x379778&&!_0x3266f4)return _0x1cc037;var _0x1fee4c=_0x2815c0[_0x150716[_0x5d03('0x13')]][_0x5d03('0x9b')];_0x564626[_0x5d03('0xc')]=_[_0x5d03('0x9c')](_0x1fee4c);_0x564626['query']=_[_0x5d03('0x9c')](_0x2f3d04['query']);_0x564626[_0x5d03('0x9d')]=_[_0x5d03('0x9e')](_0x564626[_0x5d03('0xc')],_0x564626[_0x5d03('0x8a')]);_0x1e6443[_0x5d03('0x9f')]=_[_0x5d03('0x9e')](_0x564626[_0x5d03('0xc')],qs['fields'](_0x2f3d04[_0x5d03('0x8a')][_0x5d03('0xa0')]));_0x1e6443[_0x5d03('0x9f')]=_0x1e6443['attributes'][_0x5d03('0x93')]?_0x1e6443[_0x5d03('0x9f')]:_0x564626[_0x5d03('0xc')];if(!_0x2f3d04[_0x5d03('0x8a')][_0x5d03('0xa1')](_0x5d03('0xa2'))){_0x1e6443[_0x5d03('0xa3')]=qs[_0x5d03('0xa3')](_0x2f3d04[_0x5d03('0x8a')][_0x5d03('0xa3')]);_0x1e6443[_0x5d03('0xa4')]=qs['offset'](_0x2f3d04[_0x5d03('0x8a')][_0x5d03('0xa4')]);}_0x1e6443[_0x5d03('0xa5')]=qs[_0x5d03('0xa6')](_0x2f3d04[_0x5d03('0x8a')][_0x5d03('0xa6')]);_0x1e6443['where']=qs[_0x5d03('0x9d')](_[_0x5d03('0xa7')](_0x2f3d04['query'],_0x564626[_0x5d03('0x9d')]));if(_0x2f3d04[_0x5d03('0x8a')][_0x5d03('0x5')]){_0x1e6443[_0x5d03('0x88')]=_['merge'](_0x1e6443[_0x5d03('0x88')],{'$or':_[_0x5d03('0xd')](_0x1fee4c,function(_0x579b9d){if(_0x579b9d[_0x5d03('0x10')]['key']!=='VIRTUAL'){var _0x54f647={};_0x54f647[_0x579b9d[_0x5d03('0x6')]]={'$like':'%'+_0x2f3d04[_0x5d03('0x8a')][_0x5d03('0x5')]+'%'};return _0x54f647;}})});}var _0x6d98c2=[];var _0x34a679=null;var _0x49b547={};if(_0x379778){_0x34a679=_[_0x5d03('0x96')](_0x2cb690,[_0x5d03('0xe'),_0x379778['name']]);if(_0x34a679['field']){_0x49b547={};if(_0x150716[_0x5d03('0x13')]===_0x5d03('0xa8')){_0x49b547[_0x34a679[_0x5d03('0xa9')]]=_[_0x5d03('0xd')](_0x379778[_0x5d03('0xa')],'id');}else{_0x49b547[_0x34a679[_0x5d03('0xa9')]]=_0x379778[_0x5d03('0xa')];}_0x6d98c2[_0x5d03('0x94')](_0x49b547);}else{_0x1e6443[_0x5d03('0x88')]['id']=_0x379778[_0x5d03('0xa')];}}else{for(var _0x47934c=0x0;_0x47934c<_0x3266f4['length'];_0x47934c++){_0x34a679=_[_0x5d03('0x96')](_0x2cb690,[_0x5d03('0xe'),_0x3266f4[_0x47934c][_0x5d03('0xe')]]);if(_0x34a679['field']){_0x49b547={};_0x49b547[_0x34a679['foreignKey']]=_0x3266f4[_0x47934c][_0x5d03('0xa')];_0x6d98c2[_0x5d03('0x94')](_0x49b547);}else{if(!_0x1e6443[_0x5d03('0x88')]['id'])_0x1e6443[_0x5d03('0x88')]['id']=[];_0x3266f4[_0x47934c][_0x5d03('0xa')]['forEach'](function(_0x1c1c43){_0x1e6443[_0x5d03('0x88')]['id'][_0x5d03('0x94')](_0x1c1c43);});}}}if(!_['isEmpty'](_0x6d98c2)){_0x1e6443[_0x5d03('0x88')]=_[_0x5d03('0xaa')](_0x1e6443[_0x5d03('0x88')],{'$and':{'$or':_0x6d98c2}});}_0x1e6443=_[_0x5d03('0xaa')]({},_0x1e6443,_0x2f3d04[_0x5d03('0xab')]);if(_0x379778&&!_0x379778['autoAssociation']&&_0x150716[_0x5d03('0x13')]===_0x5d03('0xa8')){if(_0x2f3d04[_0x5d03('0x8a')]['includeAll']){_0x1e6443['include']=[{'all':!![]}];}return _0x2815c0[_0x150716[_0x5d03('0x13')]][_0x5d03('0x8')](_0x1e6443)[_0x5d03('0x9')](function(_0x365743){var _0x2c7a4e=[];_0x365743[_0x5d03('0xac')](function(_0x1cce4a){var _0x234ba0;switch(_0x1cce4a[_0x5d03('0xad')]){case _0x5d03('0xae'):_0x234ba0=_[_0x5d03('0x96')](_0x379778[_0x5d03('0xa')],function(_0xcb7179){return _0xcb7179['id']===_0x1cce4a[_0x5d03('0x7a')]&&_0xcb7179[_0x5d03('0x10')]===_0x5d03('0xaf');});break;case _0x5d03('0xb0'):_0x234ba0=_[_0x5d03('0x96')](_0x379778['associatedResources'],function(_0x583eb3){return _0x583eb3['id']===_0x1cce4a[_0x5d03('0x7a')]&&_0x583eb3[_0x5d03('0x10')]===_0x5d03('0xb1');});break;}if(_0x234ba0)_0x2c7a4e[_0x5d03('0x94')](_0x1cce4a);});_0x1cc037[_0x5d03('0xb2')]=_0x2c7a4e['length'];_0x1cc037['rows']=_0x2c7a4e;return _0x1cc037;});}else{if(!_[_0x5d03('0x92')](_0x2f3d04[_0x5d03('0x8a')]['ids'])){_0x1e6443['where']['id']=_0x1e6443[_0x5d03('0x88')]['id']?_[_0x5d03('0x9e')](_0x1e6443[_0x5d03('0x88')]['id'],_0x2f3d04['query']['ids']):_0x2f3d04['query']['ids'];if(_0x2f3d04['query'][_0x5d03('0xb3')]){_0x1e6443[_0x5d03('0xa5')]=_0x2f3d04['query'][_0x5d03('0xb3')];}}if(_0x2f3d04[_0x5d03('0x8a')][_0x5d03('0xb4')]){_0x1e6443['where']=_[_0x5d03('0xaa')](_0x1e6443[_0x5d03('0x88')],{'$and':_0x2f3d04[_0x5d03('0x8a')][_0x5d03('0xb4')]});}return _0x2815c0[_0x150716[_0x5d03('0x13')]][_0x5d03('0xb2')]({'where':_0x1e6443[_0x5d03('0x88')]})['then'](function(_0x5ba49c){_0x1cc037[_0x5d03('0xb2')]=_0x5ba49c;if(_0x2f3d04[_0x5d03('0x8a')][_0x5d03('0xb5')]){if(_0x150716[_0x5d03('0x13')]===_0x5d03('0x1e')){_0x1e6443[_0x5d03('0xb6')]=[{'model':_0x2815c0[_0x5d03('0x71')],'as':_0x5d03('0xb7'),'attributes':['id',_0x5d03('0xe'),_0x5d03('0xb8')],'required':_0x2f3d04[_0x5d03('0x8a')][_0x5d03('0xb9')]?!![]:![]},{'model':_0x2815c0[_0x5d03('0x71')],'as':_0x5d03('0xba'),'attributes':['id',_0x5d03('0xe'),_0x5d03('0xb8')],'through':_0x2f3d04[_0x5d03('0x8a')][_0x5d03('0xb9')]?{'attributes':[],'where':{'TagId':_0x2f3d04['query'][_0x5d03('0xb9')]||undefined}}:{},'required':_0x2f3d04[_0x5d03('0x8a')]['tag']?!![]:![]}];}else{_0x1e6443['include']=[{'all':!![]}];}}return _0x2815c0[_0x150716[_0x5d03('0x13')]]['findAll'](_0x1e6443);})[_0x5d03('0x9')](function(_0x1afb9f){_0x1cc037[_0x5d03('0xbb')]=_0x1afb9f;if(_0x4b617b===_0x5d03('0x35')&&_0x2f3d04[_0x5d03('0x8a')][_0x5d03('0xbc')]===_0x5d03('0xbd')){var _0xe974ba=[];for(var _0x2d2d22=0x0;_0x2d2d22<_0x1cc037[_0x5d03('0xbb')][_0x5d03('0x93')];_0x2d2d22++){_0xe974ba['push'](_0x2d8b44(_0x5d03('0xbe'),_0x1cc037[_0x5d03('0xbb')][_0x2d2d22][_0x5d03('0xbf')]));_0xe974ba[_0x5d03('0x94')](_0x2d8b44(_0x5d03('0xc0'),_0x1cc037['rows'][_0x2d2d22][_0x5d03('0xbf')]));_0xe974ba[_0x5d03('0x94')](_0x2d8b44('fax',_0x1cc037[_0x5d03('0xbb')][_0x2d2d22][_0x5d03('0xbf')]));_0xe974ba['push'](_0x2d8b44('mail',_0x1cc037[_0x5d03('0xbb')][_0x2d2d22][_0x5d03('0xbf')]));_0xe974ba[_0x5d03('0x94')](_0x2d8b44(_0x5d03('0xc1'),_0x1cc037[_0x5d03('0xbb')][_0x2d2d22][_0x5d03('0xbf')]));_0xe974ba[_0x5d03('0x94')](_0x2d8b44(_0x5d03('0xc2'),_0x1cc037[_0x5d03('0xbb')][_0x2d2d22][_0x5d03('0xbf')]));}return Promise[_0x5d03('0x97')](_0xe974ba)[_0x5d03('0x9')](function(){return _0x1cc037;});}return _0x1cc037;});}});}}});}; \ No newline at end of file +var _0xc9cc=['sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','dispositions','Disposition','Dashboard','Interval','Pause','scheduler','Schedule','sounds','Sound','tags','Template','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','mergeResources','Invalid\x20section\x20\x27','length','UserProfileSection','find','params','ignore','isEmpty','autoAssociation','push','all','rawAttributes','keys','filters','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','key','VIRTUAL','foreignKey','forEach','merge','options','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','Tag','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','squel','filter','value','findAll','then','associatedResources','map','field','model','name','catch','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projects','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','Agents','membername','agent','Telephones','User','role','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','whatsappqueues','WhatsappQueue','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xc9cc,0x130));var _0xcc9c=function(_0x1ab1bf,_0x144262){_0x1ab1bf=_0x1ab1bf-0x0;var _0x2a00a5=_0xc9cc[_0x1ab1bf];return _0x2a00a5;};'use strict';var _=require(_0xcc9c('0x0'));var attributes=require('./userProfile.attributes');var qs=require('../../components/parsers/qs');var squel=require(_0xcc9c('0x1'));module['exports']=function(_0x16904f){var _0x175f9f=_0x16904f['models'];function _0x159963(_0x456e2f,_0x1d6e41){return new Promise(function(_0x50a8b0,_0x2e09be){if(!_0x1d6e41)return _0x50a8b0(null);var _0x2a0e31=_0x1d6e41[_0xcc9c('0x2')]?{[_0x1d6e41[_0xcc9c('0x2')]['field']]:_0x1d6e41[_0xcc9c('0x2')][_0xcc9c('0x3')]}:undefined;return _0x175f9f[_0x456e2f][_0xcc9c('0x4')]({'where':_0x2a0e31,'raw':!![]})[_0xcc9c('0x5')](function(_0x3abc8a){_0x1d6e41[_0xcc9c('0x6')]=_[_0xcc9c('0x7')](_0x3abc8a,'id');_0x50a8b0(_0x1d6e41);})['catch'](function(_0x2e04e6){_0x2e09be(_0x2e04e6);});});}function _0x5bc10f(_0xf980ce,_0x3478e2){return new Promise(function(_0x48ee60,_0xd9e786){var _0x1ecf68=_0xf980ce['filter']?{[_0xf980ce[_0xcc9c('0x2')][_0xcc9c('0x8')]]:_0xf980ce[_0xcc9c('0x2')][_0xcc9c('0x3')]}:undefined;return _0x175f9f[_0xf980ce[_0xcc9c('0x9')]][_0xcc9c('0x4')]({'where':_0x1ecf68,'raw':!![]})[_0xcc9c('0x5')](function(_0x46dde2){_0x3478e2[_0xcc9c('0x6')]=_[_0xcc9c('0x7')](_0x46dde2,function(_0x1b95e6){return _0x1b95e6[_0xcc9c('0xa')];});_0x48ee60(_0x3478e2);})[_0xcc9c('0xb')](function(_0xf2df02){_0xd9e786(_0xf2df02);});});}function _0x55b2d1(_0x38f3e1,_0x2b4024,_0x2a78e4){if(!_0x2b4024)return Promise[_0xcc9c('0xc')](null);return new Promise(function(_0x45ae0e,_0x3792f2){return _0x175f9f[_0xcc9c('0xd')][_0xcc9c('0x4')]({'where':{'sectionId':_0x2b4024['id']},'raw':!![]})[_0xcc9c('0x5')](function(_0xbcdab){if(_0x38f3e1[_0xcc9c('0x8')]&&_0x38f3e1[_0xcc9c('0x8')]!=='id'){_0x2b4024['associatedResources']=_[_0xcc9c('0x7')](_0xbcdab,function(_0xc5ffde){return _0xc5ffde[_0x38f3e1[_0xcc9c('0x8')]];});}else{if(_0x2a78e4===_0xcc9c('0xe')){_0x2b4024[_0xcc9c('0x6')]=_[_0xcc9c('0x7')](_0xbcdab,function(_0x354b82){return{'id':_0x354b82[_0xcc9c('0xf')],'type':_0x354b82[_0xcc9c('0x10')]};});}else{_0x2b4024[_0xcc9c('0x6')]=_['map'](_0xbcdab,function(_0x448a8c){return _0x448a8c[_0xcc9c('0xf')];});}}_0x45ae0e(_0x2b4024);})['catch'](function(_0x3e4c11){_0x3792f2(_0x3e4c11);});});}function _0x23a78a(_0x128ed8,_0x33ed11){var _0x281837={'parentSections':[]};switch(_0x128ed8[_0xcc9c('0x11')]()){case'squareprojects':_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x13');break;case _0xcc9c('0x14'):_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x15');break;case _0xcc9c('0x16'):_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x17');_0x281837[_0xcc9c('0x18')]=[{'name':_0xcc9c('0x19'),'field':_0xcc9c('0xa'),'foreignKey':'projectName'}];break;case _0xcc9c('0x1a'):_0x281837[_0xcc9c('0x12')]='JscriptyProject';break;case'contacts':_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x1b');_0x281837[_0xcc9c('0x18')]=[{'name':_0xcc9c('0x1c'),'field':'id','foreignKey':_0xcc9c('0x1d')}];break;case _0xcc9c('0x1e'):_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x1f');break;case _0xcc9c('0x20'):_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x21');break;case _0xcc9c('0x22'):_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x23');break;case _0xcc9c('0x24'):_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x25');break;case'chatwebsites':_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x26');break;case _0xcc9c('0x27'):_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x28');break;case'faxaccounts':_0x281837['childModel']=_0xcc9c('0x29');break;case _0xcc9c('0x2a'):case _0xcc9c('0x2b'):case _0xcc9c('0x2c'):_0x281837['childModel']='VoiceExtension';break;case _0xcc9c('0x2d'):_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x2e');break;case _0xcc9c('0x2f'):_0x281837['childModel']=_0xcc9c('0x30');break;case _0xcc9c('0x31'):_0x281837['childModel']='VoiceRecording';_0x281837[_0xcc9c('0x18')]=[{'name':_0xcc9c('0x32'),'field':_0xcc9c('0xa'),'foreignKey':_0xcc9c('0x33'),'model':'User','filter':{'field':'role','value':[_0xcc9c('0x34')]}},{'name':_0xcc9c('0x35'),'field':_0xcc9c('0xa'),'foreignKey':_0xcc9c('0x33'),'model':_0xcc9c('0x36'),'filter':{'field':_0xcc9c('0x37'),'value':[_0xcc9c('0x38')]}},{'name':_0xcc9c('0x39'),'field':_0xcc9c('0xa'),'foreignKey':'queue','model':_0xcc9c('0x3a'),'filter':{'field':_0xcc9c('0x10'),'value':[_0xcc9c('0x3b')]}},{'name':_0xcc9c('0x3c'),'field':_0xcc9c('0xa'),'foreignKey':_0xcc9c('0x3d'),'model':_0xcc9c('0x3a'),'filter':{'field':_0xcc9c('0x10'),'value':[_0xcc9c('0x3e')]}}];break;case _0xcc9c('0x3f'):_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x40');break;case'chanspies':_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x41');break;case _0xcc9c('0x42'):_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x43');break;case _0xcc9c('0x44'):_0x281837['childModel']=_0xcc9c('0x45');break;case'mailqueues':_0x281837[_0xcc9c('0x12')]='MailQueue';break;case _0xcc9c('0x46'):_0x281837[_0xcc9c('0x12')]='MailAccount';break;case _0xcc9c('0x47'):_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x48');break;case _0xcc9c('0x49'):_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x4a');break;case _0xcc9c('0x4b'):_0x281837['childModel']='OpenchannelAccount';break;case _0xcc9c('0x4c'):_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x4d');break;case'smsaccounts':_0x281837[_0xcc9c('0x12')]='SmsAccount';break;case _0xcc9c('0x4e'):_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x4f');break;case'whatsappaccounts':_0x281837[_0xcc9c('0x12')]='WhatsappAccount';break;case _0xcc9c('0x50'):_0x281837['childModel']=_0xcc9c('0x51');break;case _0xcc9c('0x52'):case _0xcc9c('0x53'):_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x3a');if(_0x33ed11){_0x281837[_0xcc9c('0x18')]=[{'name':'VoiceQueues'},{'name':_0xcc9c('0x3c')}];}break;case _0xcc9c('0x54'):case _0xcc9c('0x55'):case _0xcc9c('0x56'):_0x281837['childModel']='User';if(_0x33ed11){_0x281837['parentSections']=[{'name':_0xcc9c('0x57'),'filter':{'field':_0xcc9c('0x37'),'value':[_0xcc9c('0x58'),_0xcc9c('0x59')]},'ignore':!![]},{'name':'Agents'},{'name':_0xcc9c('0x35')}];}break;case _0xcc9c('0x5a'):_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x5b');break;case _0xcc9c('0x5c'):_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x5d');break;case _0xcc9c('0x5e'):_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x5f');break;case _0xcc9c('0x60'):_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x61');break;case _0xcc9c('0x62'):_0x281837['childModel']=_0xcc9c('0x63');break;case _0xcc9c('0x64'):_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x65');break;case _0xcc9c('0x66'):_0x281837['childModel']=_0xcc9c('0x36');break;case'cannedanswers':_0x281837[_0xcc9c('0x12')]='CannedAnswer';break;case _0xcc9c('0x67'):_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x68');break;case'customdashboards':_0x281837['childModel']=_0xcc9c('0x69');break;case'intervals':_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x6a');break;case'pauses':_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x6b');break;case _0xcc9c('0x6c'):_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x6d');break;case _0xcc9c('0x6e'):_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x6f');break;case _0xcc9c('0x70'):_0x281837[_0xcc9c('0x12')]='Tag';break;case'templates':_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x71');break;case'triggers':_0x281837[_0xcc9c('0x12')]='Trigger';break;case _0xcc9c('0x72'):_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x73');break;case _0xcc9c('0x74'):_0x281837[_0xcc9c('0x12')]=_0xcc9c('0x75');break;case _0xcc9c('0x76'):_0x281837['childModel']=_0xcc9c('0x77');break;case _0xcc9c('0x78'):_0x281837[_0xcc9c('0x12')]=_0xcc9c('0xe');_0x281837[_0xcc9c('0x18')]=[{'name':_0xcc9c('0x79'),'field':'id','foreignKey':_0xcc9c('0x7a')}];break;case _0xcc9c('0x7b'):_0x281837[_0xcc9c('0x12')]='AnalyticMetric';break;}return _0x281837;}function _0x415fc6(_0x358857,_0x2bc8ff){var _0x10579e=_0x358857[_0xcc9c('0x7c')](0x0)[_0xcc9c('0x7d')]()+_0x358857[_0xcc9c('0x7e')](0x1);var _0x5dfde9={'type':_0x175f9f[_0xcc9c('0x7f')][_0xcc9c('0x80')][_0xcc9c('0x81')],'raw':!![]};return new Promise(function(_0x5ce505,_0x287ac4){var _0x53cab3=squel['select']()[_0xcc9c('0x8')](_0xcc9c('0x82')+_0x10579e+_0xcc9c('0x83'),'id')[_0xcc9c('0x8')](_0xcc9c('0x84'))[_0xcc9c('0x85')]('user_has_'+_0x358857+_0xcc9c('0x86'),'ui')[_0xcc9c('0x87')](_0xcc9c('0x88'),_0x2bc8ff['id']);return _0x175f9f[_0xcc9c('0x89')][_0xcc9c('0x8a')](_0x53cab3[_0xcc9c('0x8b')](),_0x5dfde9)[_0xcc9c('0x5')](function(_0x14d590){_0x2bc8ff[_0x10579e+_0xcc9c('0x8c')]=_0x14d590;_0x5ce505(_0x14d590);})[_0xcc9c('0xb')](function(_0x25c4a0){_0x287ac4(_0x25c4a0);});});}return _0x16904f[_0xcc9c('0x8d')](_0xcc9c('0x8e'),attributes,{'tableName':_0xcc9c('0x8f'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x56aff1){var _0x19614c={'raw':_0x56aff1[_0xcc9c('0x8a')][_0xcc9c('0x90')],'where':{}};var _0x139079={};var _0x48b63b={'count':0x0,'rows':[]};var _0x2adbfb=_0x56aff1[_0xcc9c('0x8a')]['section'];var _0x186d6e=_0x56aff1[_0xcc9c('0x8a')][_0xcc9c('0x91')]||![];var _0x2762d6=_0x23a78a(_0x2adbfb,_0x186d6e);if(!_0x2762d6['childModel'])throw new Error(_0xcc9c('0x92')+_0x2adbfb+'\x27');var _0x4ea591=[{'name':_0x2adbfb}];if(!_['isEmpty'](_0x2762d6['parentSections']))_0x4ea591=_0x2762d6[_0xcc9c('0x18')];var _0xda50c1=[];for(var _0x11ceff=0x0;_0x11ceff<_0x4ea591[_0xcc9c('0x93')];_0x11ceff++){_0xda50c1['push'](_0x175f9f[_0xcc9c('0x94')][_0xcc9c('0x95')]({'where':{'userProfileId':_0x56aff1[_0xcc9c('0x96')]['id'],'name':_0x4ea591[_0x11ceff][_0xcc9c('0xa')]},'raw':!![]}));}return Promise['all'](_0xda50c1)[_0xcc9c('0x5')](function(_0xbc9bd8){var _0x570cb1=_['filter'](_0xbc9bd8,function(_0x4db0ef){return _0x4db0ef?_0x4db0ef:undefined;});var _0x41942c=_[_0xcc9c('0x2')](_0x4ea591,[_0xcc9c('0x97'),!![]]);var _0xcf5137=_['isEmpty'](_0x570cb1)&&_[_0xcc9c('0x98')](_0x41942c)?null:_['union'](_0x41942c,_0x570cb1);if(!_0xcf5137)return null;var _0x417164=[];for(var _0x211f4e=0x0;_0x211f4e<_0xcf5137[_0xcc9c('0x93')];_0x211f4e++){var _0x23083b=_[_0xcc9c('0x95')](_0x4ea591,function(_0x56ce9d){return _0xcf5137[_0x211f4e]?_0x56ce9d['name']===_0xcf5137[_0x211f4e][_0xcc9c('0xa')]:null;});if(_0x23083b){if(_0xcf5137[_0x211f4e]['ignore']){_0x417164['push'](_0x159963(_0x2762d6[_0xcc9c('0x12')],_0xcf5137[_0x211f4e]));}else{if(!_0xcf5137[_0x211f4e][_0xcc9c('0x99')]){_0x417164[_0xcc9c('0x9a')](_0x55b2d1(_0x23083b,_0xcf5137[_0x211f4e],_0x2762d6[_0xcc9c('0x12')]));}else{if(_0x23083b[_0xcc9c('0x9')]){_0x417164[_0xcc9c('0x9a')](_0x5bc10f(_0x23083b,_0xcf5137[_0x211f4e]));}}}}}return Promise[_0xcc9c('0x9b')](_0x417164);})[_0xcc9c('0x5')](function(_0x12b8cb){var _0x2f4070=_0x12b8cb;var _0x335984=null;if(_0x2f4070){_0x335984=_0x2f4070[_0xcc9c('0x93')]===0x1?_0x2f4070[0x0]:null;}if(!_0x335984&&!_0x2f4070)return _0x48b63b;var _0x31138f=_0x175f9f[_0x2762d6[_0xcc9c('0x12')]][_0xcc9c('0x9c')];_0x139079[_0xcc9c('0x9')]=_[_0xcc9c('0x9d')](_0x31138f);_0x139079[_0xcc9c('0x8a')]=_[_0xcc9c('0x9d')](_0x56aff1[_0xcc9c('0x8a')]);_0x139079[_0xcc9c('0x9e')]=_['intersection'](_0x139079[_0xcc9c('0x9')],_0x139079[_0xcc9c('0x8a')]);_0x19614c[_0xcc9c('0x9f')]=_['intersection'](_0x139079[_0xcc9c('0x9')],qs[_0xcc9c('0xa0')](_0x56aff1[_0xcc9c('0x8a')][_0xcc9c('0xa0')]));_0x19614c[_0xcc9c('0x9f')]=_0x19614c['attributes'][_0xcc9c('0x93')]?_0x19614c[_0xcc9c('0x9f')]:_0x139079[_0xcc9c('0x9')];if(!_0x56aff1['query'][_0xcc9c('0xa1')](_0xcc9c('0xa2'))){_0x19614c[_0xcc9c('0xa3')]=qs[_0xcc9c('0xa3')](_0x56aff1['query'][_0xcc9c('0xa3')]);_0x19614c['offset']=qs[_0xcc9c('0xa4')](_0x56aff1[_0xcc9c('0x8a')]['offset']);}_0x19614c[_0xcc9c('0xa5')]=qs['sort'](_0x56aff1[_0xcc9c('0x8a')][_0xcc9c('0xa6')]);_0x19614c['where']=qs[_0xcc9c('0x9e')](_[_0xcc9c('0xa7')](_0x56aff1[_0xcc9c('0x8a')],_0x139079[_0xcc9c('0x9e')]));if(_0x56aff1[_0xcc9c('0x8a')]['filter']){_0x19614c[_0xcc9c('0x87')]=_['merge'](_0x19614c[_0xcc9c('0x87')],{'$or':_[_0xcc9c('0x7')](_0x31138f,function(_0x5c4e07){if(_0x5c4e07[_0xcc9c('0x10')][_0xcc9c('0xa8')]!==_0xcc9c('0xa9')){var _0x1bcd09={};_0x1bcd09[_0x5c4e07['field']]={'$like':'%'+_0x56aff1['query'][_0xcc9c('0x2')]+'%'};return _0x1bcd09;}})});}var _0x4861ab=[];var _0x2d7588=null;var _0x29f04b={};if(_0x335984){_0x2d7588=_[_0xcc9c('0x95')](_0x4ea591,[_0xcc9c('0xa'),_0x335984['name']]);if(_0x2d7588[_0xcc9c('0x8')]){_0x29f04b={};if(_0x2762d6['childModel']==='AnalyticExtractedReport'){_0x29f04b[_0x2d7588['foreignKey']]=_[_0xcc9c('0x7')](_0x335984[_0xcc9c('0x6')],'id');}else{_0x29f04b[_0x2d7588[_0xcc9c('0xaa')]]=_0x335984[_0xcc9c('0x6')];}_0x4861ab[_0xcc9c('0x9a')](_0x29f04b);}else{_0x19614c[_0xcc9c('0x87')]['id']=_0x335984['associatedResources'];}}else{for(var _0x199d98=0x0;_0x199d98<_0x2f4070[_0xcc9c('0x93')];_0x199d98++){_0x2d7588=_[_0xcc9c('0x95')](_0x4ea591,[_0xcc9c('0xa'),_0x2f4070[_0x199d98]['name']]);if(_0x2d7588[_0xcc9c('0x8')]){_0x29f04b={};_0x29f04b[_0x2d7588[_0xcc9c('0xaa')]]=_0x2f4070[_0x199d98][_0xcc9c('0x6')];_0x4861ab[_0xcc9c('0x9a')](_0x29f04b);}else{if(!_0x19614c[_0xcc9c('0x87')]['id'])_0x19614c[_0xcc9c('0x87')]['id']=[];_0x2f4070[_0x199d98][_0xcc9c('0x6')][_0xcc9c('0xab')](function(_0x40f722){_0x19614c[_0xcc9c('0x87')]['id']['push'](_0x40f722);});}}}if(!_['isEmpty'](_0x4861ab)){_0x19614c[_0xcc9c('0x87')]=_[_0xcc9c('0xac')](_0x19614c['where'],{'$and':{'$or':_0x4861ab}});}_0x19614c=_[_0xcc9c('0xac')]({},_0x19614c,_0x56aff1[_0xcc9c('0xad')]);if(_0x335984&&!_0x335984['autoAssociation']&&_0x2762d6['childModel']==='AnalyticExtractedReport'){if(_0x56aff1[_0xcc9c('0x8a')][_0xcc9c('0xae')]){_0x19614c[_0xcc9c('0xaf')]=[{'all':!![]}];}return _0x175f9f[_0x2762d6['childModel']][_0xcc9c('0x4')](_0x19614c)[_0xcc9c('0x5')](function(_0x11c028){var _0x4905a0=[];_0x11c028[_0xcc9c('0xab')](function(_0x34698e){var _0x41860a;switch(_0x34698e[_0xcc9c('0xb0')]){case _0xcc9c('0xb1'):_0x41860a=_[_0xcc9c('0x95')](_0x335984['associatedResources'],function(_0x192f8f){return _0x192f8f['id']===_0x34698e['reportId']&&_0x192f8f[_0xcc9c('0x10')]===_0xcc9c('0xb2');});break;case _0xcc9c('0xb3'):_0x41860a=_[_0xcc9c('0x95')](_0x335984[_0xcc9c('0x6')],function(_0x29020b){return _0x29020b['id']===_0x34698e[_0xcc9c('0x7a')]&&_0x29020b['type']===_0xcc9c('0xb4');});break;}if(_0x41860a)_0x4905a0[_0xcc9c('0x9a')](_0x34698e);});_0x48b63b[_0xcc9c('0xb5')]=_0x4905a0[_0xcc9c('0x93')];_0x48b63b[_0xcc9c('0xb6')]=_0x4905a0;return _0x48b63b;});}else{if(!_[_0xcc9c('0x98')](_0x56aff1[_0xcc9c('0x8a')][_0xcc9c('0xb7')])){_0x19614c['where']['id']=_0x19614c[_0xcc9c('0x87')]['id']?_['intersection'](_0x19614c[_0xcc9c('0x87')]['id'],_0x56aff1[_0xcc9c('0x8a')]['ids']):_0x56aff1[_0xcc9c('0x8a')][_0xcc9c('0xb7')];if(_0x56aff1[_0xcc9c('0x8a')][_0xcc9c('0xb8')]){_0x19614c['order']=_0x56aff1[_0xcc9c('0x8a')][_0xcc9c('0xb8')];}}if(_0x56aff1[_0xcc9c('0x8a')][_0xcc9c('0xb9')]){_0x19614c[_0xcc9c('0x87')]=_[_0xcc9c('0xac')](_0x19614c[_0xcc9c('0x87')],{'$and':_0x56aff1[_0xcc9c('0x8a')][_0xcc9c('0xb9')]});}return _0x175f9f[_0x2762d6['childModel']][_0xcc9c('0xb5')]({'where':_0x19614c[_0xcc9c('0x87')]})[_0xcc9c('0x5')](function(_0x3af2a5){_0x48b63b[_0xcc9c('0xb5')]=_0x3af2a5;if(_0x56aff1[_0xcc9c('0x8a')][_0xcc9c('0xae')]){if(_0x2762d6[_0xcc9c('0x12')]==='CmContact'){_0x19614c[_0xcc9c('0xaf')]=[{'model':_0x175f9f[_0xcc9c('0xba')],'as':_0xcc9c('0xbb'),'attributes':['id','name',_0xcc9c('0xbc')],'required':_0x56aff1[_0xcc9c('0x8a')][_0xcc9c('0xbd')]?!![]:![]},{'model':_0x175f9f[_0xcc9c('0xba')],'as':_0xcc9c('0xbe'),'attributes':['id',_0xcc9c('0xa'),_0xcc9c('0xbc')],'through':_0x56aff1[_0xcc9c('0x8a')][_0xcc9c('0xbd')]?{'attributes':[],'where':{'TagId':_0x56aff1[_0xcc9c('0x8a')][_0xcc9c('0xbd')]||undefined}}:{},'required':_0x56aff1['query'][_0xcc9c('0xbd')]?!![]:![]}];}else{_0x19614c[_0xcc9c('0xaf')]=[{'all':!![]}];}}return _0x175f9f[_0x2762d6['childModel']][_0xcc9c('0x4')](_0x19614c);})['then'](function(_0xfd2a25){_0x48b63b['rows']=_0xfd2a25;if(_0x2adbfb===_0xcc9c('0x32')&&_0x56aff1[_0xcc9c('0x8a')][_0xcc9c('0xbf')]===_0xcc9c('0xc0')){var _0x170d32=[];for(var _0x46b9e9=0x0;_0x46b9e9<_0x48b63b[_0xcc9c('0xb6')]['length'];_0x46b9e9++){_0x170d32['push'](_0x415fc6(_0xcc9c('0xc1'),_0x48b63b[_0xcc9c('0xb6')][_0x46b9e9][_0xcc9c('0xc2')]));_0x170d32['push'](_0x415fc6(_0xcc9c('0xc3'),_0x48b63b['rows'][_0x46b9e9]['dataValues']));_0x170d32[_0xcc9c('0x9a')](_0x415fc6(_0xcc9c('0xc4'),_0x48b63b[_0xcc9c('0xb6')][_0x46b9e9]['dataValues']));_0x170d32[_0xcc9c('0x9a')](_0x415fc6(_0xcc9c('0xc5'),_0x48b63b[_0xcc9c('0xb6')][_0x46b9e9][_0xcc9c('0xc2')]));_0x170d32[_0xcc9c('0x9a')](_0x415fc6(_0xcc9c('0xc6'),_0x48b63b[_0xcc9c('0xb6')][_0x46b9e9][_0xcc9c('0xc2')]));_0x170d32[_0xcc9c('0x9a')](_0x415fc6(_0xcc9c('0xc7'),_0x48b63b[_0xcc9c('0xb6')][_0x46b9e9][_0xcc9c('0xc2')]));}return Promise['all'](_0x170d32)[_0xcc9c('0x5')](function(){return _0x48b63b;});}return _0x48b63b;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index d6a974b..eee2f54 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 _0xf567=['http','redis','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x22cb34,_0x116622){var _0x592d3c=function(_0x5f19a4){while(--_0x5f19a4){_0x22cb34['push'](_0x22cb34['shift']());}};_0x592d3c(++_0x116622);}(_0xf567,0x118));var _0x7f56=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xf567[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x7f56('0x0'));var util=require(_0x7f56('0x1'));var moment=require(_0x7f56('0x2'));var BPromise=require('bluebird');var rs=require(_0x7f56('0x3'));var fs=require('fs');var Redis=require(_0x7f56('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f56('0x5'));var logger=require(_0x7f56('0x6'))(_0x7f56('0x7'));var config=require(_0x7f56('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7f56('0x9')][_0x7f56('0xa')]({'port':0x232a});config[_0x7f56('0xb')]=_['defaults'](config[_0x7f56('0xb')],{'host':_0x7f56('0xc'),'port':0x18eb});var socket=require(_0x7f56('0xd'))(new Redis(config[_0x7f56('0xb')]));require(_0x7f56('0xe'))[_0x7f56('0xf')](socket);function respondWithRpcPromise(_0xc757aa,_0x502a2b,_0xe41219){return new BPromise(function(_0xe00be5,_0x138bd2){return client[_0x7f56('0x10')](_0xc757aa,_0xe41219)[_0x7f56('0x11')](function(_0x2a10d9){logger[_0x7f56('0x12')](_0x7f56('0x13'),_0x502a2b,_0x7f56('0x14'));logger[_0x7f56('0x15')](_0x7f56('0x16'),_0x502a2b,_0x7f56('0x14'),JSON[_0x7f56('0x17')](_0x2a10d9));if(_0x2a10d9[_0x7f56('0x18')]){if(_0x2a10d9['error'][_0x7f56('0x19')]===0x1f4){logger[_0x7f56('0x18')](_0x7f56('0x13'),_0x502a2b,_0x2a10d9['error'][_0x7f56('0x1a')]);return _0x138bd2(_0x2a10d9[_0x7f56('0x18')]['message']);}logger[_0x7f56('0x18')](_0x7f56('0x13'),_0x502a2b,_0x2a10d9['error']['message']);return _0xe00be5(_0x2a10d9[_0x7f56('0x18')]['message']);}else{logger[_0x7f56('0x12')](_0x7f56('0x13'),_0x502a2b,'request\x20sent');_0xe00be5(_0x2a10d9[_0x7f56('0x1b')][_0x7f56('0x1a')]);}})[_0x7f56('0x1c')](function(_0x4aae03){logger[_0x7f56('0x18')](_0x7f56('0x13'),_0x502a2b,_0x4aae03);_0x138bd2(_0x4aae03);});});} \ No newline at end of file +var _0x9b09=['./userProfile.socket','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','error','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x9b09,0x1ad));var _0x99b0=function(_0x466410,_0x4069d9){_0x466410=_0x466410-0x0;var _0x3d758e=_0x9b09[_0x466410];return _0x3d758e;};'use strict';var _=require(_0x99b0('0x0'));var util=require(_0x99b0('0x1'));var moment=require('moment');var BPromise=require(_0x99b0('0x2'));var rs=require(_0x99b0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x99b0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x99b0('0x5'))('rpc');var config=require(_0x99b0('0x6'));var jayson=require(_0x99b0('0x7'));var client=jayson['client'][_0x99b0('0x8')]({'port':0x232a});config[_0x99b0('0x9')]=_['defaults'](config[_0x99b0('0x9')],{'host':_0x99b0('0xa'),'port':0x18eb});var socket=require(_0x99b0('0xb'))(new Redis(config[_0x99b0('0x9')]));require(_0x99b0('0xc'))['register'](socket);function respondWithRpcPromise(_0x16bb51,_0x3ff7df,_0x23f567){return new BPromise(function(_0x443f52,_0xff8662){return client['request'](_0x16bb51,_0x23f567)[_0x99b0('0xd')](function(_0x263d8e){logger[_0x99b0('0xe')](_0x99b0('0xf'),_0x3ff7df,_0x99b0('0x10'));logger[_0x99b0('0x11')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x3ff7df,_0x99b0('0x10'),JSON['stringify'](_0x263d8e));if(_0x263d8e[_0x99b0('0x12')]){if(_0x263d8e[_0x99b0('0x12')]['code']===0x1f4){logger['error'](_0x99b0('0xf'),_0x3ff7df,_0x263d8e[_0x99b0('0x12')][_0x99b0('0x13')]);return _0xff8662(_0x263d8e['error']['message']);}logger['error'](_0x99b0('0xf'),_0x3ff7df,_0x263d8e[_0x99b0('0x12')]['message']);return _0x443f52(_0x263d8e[_0x99b0('0x12')][_0x99b0('0x13')]);}else{logger[_0x99b0('0xe')](_0x99b0('0xf'),_0x3ff7df,_0x99b0('0x10'));_0x443f52(_0x263d8e[_0x99b0('0x14')][_0x99b0('0x13')]);}})['catch'](function(_0x1a2521){logger[_0x99b0('0x12')](_0x99b0('0xf'),_0x3ff7df,_0x1a2521);_0xff8662(_0x1a2521);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 4a96052..6a638d7 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 _0x1371=['userProfile:','./userProfile.events','save','remove','update','emit','removeListener','register'];(function(_0x26c66b,_0x1e8054){var _0x2d09cd=function(_0x2e271f){while(--_0x2e271f){_0x26c66b['push'](_0x26c66b['shift']());}};_0x2d09cd(++_0x1e8054);}(_0x1371,0x1c9));var _0x1137=function(_0x5b36f6,_0x17ff83){_0x5b36f6=_0x5b36f6-0x0;var _0x333c95=_0x1371[_0x5b36f6];return _0x333c95;};'use strict';var UserProfileEvents=require(_0x1137('0x0'));var events=[_0x1137('0x1'),_0x1137('0x2'),_0x1137('0x3')];function createListener(_0x5505b3,_0x48d471){return function(_0x37329f){_0x48d471[_0x1137('0x4')](_0x5505b3,_0x37329f);};}function removeListener(_0x2cb078,_0x1ce67b){return function(){UserProfileEvents[_0x1137('0x5')](_0x2cb078,_0x1ce67b);};}exports[_0x1137('0x6')]=function(_0x59e911){for(var _0x2ed449=0x0,_0x12879a=events['length'];_0x2ed449<_0x12879a;_0x2ed449++){var _0x176525=events[_0x2ed449];var _0x3b29d8=createListener(_0x1137('0x7')+_0x176525,_0x59e911);UserProfileEvents['on'](_0x176525,_0x3b29d8);}}; \ No newline at end of file +var _0x1401=['./userProfile.events','save','update','emit','removeListener','register','userProfile:'];(function(_0x4d8b77,_0x1fa118){var _0x3c5723=function(_0x48bdc0){while(--_0x48bdc0){_0x4d8b77['push'](_0x4d8b77['shift']());}};_0x3c5723(++_0x1fa118);}(_0x1401,0xc4));var _0x1140=function(_0x4970ba,_0x401fdf){_0x4970ba=_0x4970ba-0x0;var _0x50a32b=_0x1401[_0x4970ba];return _0x50a32b;};'use strict';var UserProfileEvents=require(_0x1140('0x0'));var events=[_0x1140('0x1'),'remove',_0x1140('0x2')];function createListener(_0x2d037f,_0x242ff6){return function(_0x1f1d67){_0x242ff6[_0x1140('0x3')](_0x2d037f,_0x1f1d67);};}function removeListener(_0x54cc6f,_0x542c29){return function(){UserProfileEvents[_0x1140('0x4')](_0x54cc6f,_0x542c29);};}exports[_0x1140('0x5')]=function(_0x26071e){for(var _0xdf0708=0x0,_0x299b4f=events['length'];_0xdf0708<_0x299b4f;_0xdf0708++){var _0x5b0ba5=events[_0xdf0708];var _0x2bc8f4=createListener(_0x1140('0x6')+_0x5b0ba5,_0x26071e);UserProfileEvents['on'](_0x5b0ba5,_0x2bc8f4);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index c15bffe..9884e47 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 _0xa64a=['put','/:id','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','./userProfileResource.controller','get','isAuthenticated','index','/describe','show','create'];(function(_0x45eb8c,_0x281634){var _0x4dedc8=function(_0x43f82a){while(--_0x43f82a){_0x45eb8c['push'](_0x45eb8c['shift']());}};_0x4dedc8(++_0x281634);}(_0xa64a,0x1d0));var _0xaa64=function(_0x495ef8,_0x1d55fb){_0x495ef8=_0x495ef8-0x0;var _0x7ce43b=_0xa64a[_0x495ef8];return _0x7ce43b;};'use strict';var multer=require('multer');var util=require(_0xaa64('0x0'));var path=require(_0xaa64('0x1'));var timeout=require(_0xaa64('0x2'));var express=require(_0xaa64('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xaa64('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xaa64('0x5'));router[_0xaa64('0x6')]('/',auth[_0xaa64('0x7')](),controller[_0xaa64('0x8')]);router['get'](_0xaa64('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xaa64('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xaa64('0xa')]);router['post']('/',auth[_0xaa64('0x7')](),controller[_0xaa64('0xb')]);router[_0xaa64('0xc')](_0xaa64('0xd'),auth[_0xaa64('0x7')](),controller['update']);router[_0xaa64('0xe')](_0xaa64('0xd'),auth['isAuthenticated'](),controller[_0xaa64('0xf')]);module[_0xaa64('0x10')]=router; \ No newline at end of file +var _0xb29b=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','/describe','describe','/:id','show','post','isAuthenticated','create','put','delete','exports','util'];(function(_0xe31165,_0x23cebf){var _0x3cd681=function(_0x5cfe54){while(--_0x5cfe54){_0xe31165['push'](_0xe31165['shift']());}};_0x3cd681(++_0x23cebf);}(_0xb29b,0x9f));var _0xbb29=function(_0x20e7e2,_0x1cf1ab){_0x20e7e2=_0x20e7e2-0x0;var _0x32fa33=_0xb29b[_0x20e7e2];return _0x32fa33;};'use strict';var multer=require('multer');var util=require(_0xbb29('0x0'));var path=require(_0xbb29('0x1'));var timeout=require(_0xbb29('0x2'));var express=require(_0xbb29('0x3'));var router=express[_0xbb29('0x4')]();var fs_extra=require(_0xbb29('0x5'));var auth=require(_0xbb29('0x6'));var interaction=require(_0xbb29('0x7'));var config=require('../../config/environment');var controller=require(_0xbb29('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xbb29('0x9')](_0xbb29('0xa'),auth['isAuthenticated'](),controller[_0xbb29('0xb')]);router['get'](_0xbb29('0xc'),auth['isAuthenticated'](),controller[_0xbb29('0xd')]);router[_0xbb29('0xe')]('/',auth[_0xbb29('0xf')](),controller[_0xbb29('0x10')]);router[_0xbb29('0x11')](_0xbb29('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xbb29('0x12')](_0xbb29('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xbb29('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 59c30df..e86b92c 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 _0x1b1e=['STRING','INTEGER','sequelize','exports'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x1b1e,0xb2));var _0xe1b1=function(_0xb00710,_0x4d7d03){_0xb00710=_0xb00710-0x0;var _0x3980c0=_0x1b1e[_0xb00710];return _0x3980c0;};'use strict';var Sequelize=require(_0xe1b1('0x0'));module[_0xe1b1('0x1')]={'name':{'type':Sequelize[_0xe1b1('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xe1b1('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xe1b1('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x655b=['STRING','sequelize'];(function(_0x478904,_0x5b3c5c){var _0x415cf2=function(_0x520a48){while(--_0x520a48){_0x478904['push'](_0x478904['shift']());}};_0x415cf2(++_0x5b3c5c);}(_0x655b,0xa1));var _0xb655=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x655b[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require(_0xb655('0x0'));module['exports']={'name':{'type':Sequelize[_0xb655('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xb655('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index af5cbc4..5f1fae0 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 _0x2ef3=['name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','UserProfileResource','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack'];(function(_0x3732dd,_0x2e914){var _0x347d53=function(_0x408b35){while(--_0x408b35){_0x3732dd['push'](_0x3732dd['shift']());}};_0x347d53(++_0x2e914);}(_0x2ef3,0xba));var _0x32ef=function(_0x2e63a9,_0x361d0b){_0x2e63a9=_0x2e63a9-0x0;var _0x3136bf=_0x2ef3[_0x2e63a9];return _0x3136bf;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['UserProfileResource'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['UserProfileResource'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['UserProfileResource']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,null));};exports['describe']=function(_0x179c2f,_0x259c32){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]()[_0x32ef('0x3e')](respondWithResult(_0x259c32,null))[_0x32ef('0x42')](handleError(_0x259c32,null));}; \ No newline at end of file +var _0x430c=['status','end','json','limit','undefined','offset','count','set','Content-Range','then','destroy','error','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','update','find','describe','eml-format','fast-json-patch','request-promise','moment','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus'];(function(_0x1b964a,_0x40fdc2){var _0x2559fa=function(_0x1afe3e){while(--_0x1afe3e){_0x1b964a['push'](_0x1b964a['shift']());}};_0x2559fa(++_0x40fdc2);}(_0x430c,0x1a1));var _0xc430=function(_0x2b55b5,_0x78505e){_0x2b55b5=_0x2b55b5-0x0;var _0x103d28=_0x430c[_0x2b55b5];return _0x103d28;};'use strict';var emlformat=require(_0xc430('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc430('0x1'));var rp=require(_0xc430('0x2'));var moment=require(_0xc430('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc430('0x4'));var csv=require(_0xc430('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc430('0x6'));var _=require('lodash');var squel=require(_0xc430('0x7'));var crypto=require(_0xc430('0x8'));var jsforce=require(_0xc430('0x9'));var deskjs=require(_0xc430('0xa'));var toCsv=require(_0xc430('0x5'));var querystring=require(_0xc430('0xb'));var Papa=require(_0xc430('0xc'));var Redis=require(_0xc430('0xd'));var authService=require(_0xc430('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc430('0xf'));var hardwareService=require(_0xc430('0x10'));var logger=require('../../config/logger')(_0xc430('0x11'));var utils=require('../../config/utils');var config=require(_0xc430('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc430('0x13'))['db'];function respondWithStatusCode(_0x8aa2e6,_0xc5f92){_0xc5f92=_0xc5f92||0xcc;return function(_0x1fb8ce){if(_0x1fb8ce){return _0x8aa2e6[_0xc430('0x14')](_0xc5f92);}return _0x8aa2e6[_0xc430('0x15')](_0xc5f92)[_0xc430('0x16')]();};}function respondWithResult(_0x54d851,_0x4e9134){_0x4e9134=_0x4e9134||0xc8;return function(_0x3f359c){if(_0x3f359c){return _0x54d851[_0xc430('0x15')](_0x4e9134)[_0xc430('0x17')](_0x3f359c);}};}function respondWithFilteredResult(_0x2ef538,_0x31d3b7){return function(_0x55cc6c){if(_0x55cc6c){var _0x111598=typeof _0x31d3b7['offset']==='undefined'&&typeof _0x31d3b7[_0xc430('0x18')]===_0xc430('0x19');var _0x2327c5=_0x55cc6c['count'];var _0x5d3acc=_0x111598?0x0:_0x31d3b7[_0xc430('0x1a')];var _0x4c1937=_0x111598?_0x55cc6c[_0xc430('0x1b')]:_0x31d3b7['offset']+_0x31d3b7['limit'];var _0x2f3203;if(_0x4c1937>=_0x2327c5){_0x4c1937=_0x2327c5;_0x2f3203=0xc8;}else{_0x2f3203=0xce;}_0x2ef538['status'](_0x2f3203);return _0x2ef538[_0xc430('0x1c')](_0xc430('0x1d'),_0x5d3acc+'-'+_0x4c1937+'/'+_0x2327c5)[_0xc430('0x17')](_0x55cc6c);}return null;};}function patchUpdates(_0x1f90bb){return function(_0x2a1ea1){try{jsonpatch['apply'](_0x2a1ea1,_0x1f90bb,!![]);}catch(_0x388a2f){return BPromise['reject'](_0x388a2f);}return _0x2a1ea1['save']();};}function saveUpdates(_0x3b7c3d,_0x2ea352){return function(_0x3c7afa){if(_0x3c7afa){return _0x3c7afa['update'](_0x3b7c3d)[_0xc430('0x1e')](function(_0x57d26e){return _0x57d26e;});}return null;};}function removeEntity(_0x23425d,_0x22ebfb){return function(_0x4efecd){if(_0x4efecd){return _0x4efecd[_0xc430('0x1f')]()[_0xc430('0x1e')](function(){_0x23425d['status'](0xcc)[_0xc430('0x16')]();});}};}function handleEntityNotFound(_0x59c498,_0x3aa85e){return function(_0x4b5280){if(!_0x4b5280){_0x59c498[_0xc430('0x14')](0x194);}return _0x4b5280;};}function handleError(_0x21e28a,_0x50110b){_0x50110b=_0x50110b||0x1f4;return function(_0x33433f){logger[_0xc430('0x20')](_0x33433f[_0xc430('0x21')]);if(_0x33433f[_0xc430('0x22')]){delete _0x33433f[_0xc430('0x22')];}_0x21e28a['status'](_0x50110b)[_0xc430('0x23')](_0x33433f);};}exports[_0xc430('0x24')]=function(_0x1c1da9,_0x1591e3){var _0x542cba={},_0x1f8086={},_0x4cf56c={'count':0x0,'rows':[]};var _0x1d65ee=_['map'](db[_0xc430('0x25')][_0xc430('0x26')],function(_0xfc8767){return{'name':_0xfc8767[_0xc430('0x27')],'type':_0xfc8767['type'][_0xc430('0x28')]};});_0x1f8086[_0xc430('0x29')]=_[_0xc430('0x2a')](_0x1d65ee,_0xc430('0x22'));_0x1f8086['query']=_[_0xc430('0x2b')](_0x1c1da9[_0xc430('0x2c')]);_0x1f8086['filters']=_[_0xc430('0x2d')](_0x1f8086['model'],_0x1f8086['query']);_0x542cba[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x1f8086[_0xc430('0x29')],qs[_0xc430('0x2f')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x2f')]));_0x542cba[_0xc430('0x2e')]=_0x542cba[_0xc430('0x2e')]['length']?_0x542cba[_0xc430('0x2e')]:_0x1f8086['model'];if(!_0x1c1da9[_0xc430('0x2c')][_0xc430('0x30')](_0xc430('0x31'))){_0x542cba[_0xc430('0x18')]=qs['limit'](_0x1c1da9[_0xc430('0x2c')]['limit']);_0x542cba['offset']=qs[_0xc430('0x1a')](_0x1c1da9[_0xc430('0x2c')]['offset']);}_0x542cba[_0xc430('0x32')]=qs[_0xc430('0x33')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x33')]);_0x542cba[_0xc430('0x34')]=qs[_0xc430('0x35')](_[_0xc430('0x36')](_0x1c1da9[_0xc430('0x2c')],_0x1f8086[_0xc430('0x35')]),_0x1d65ee);if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x37')]){_0x542cba[_0xc430('0x34')]=_[_0xc430('0x38')](_0x542cba[_0xc430('0x34')],{'$or':_[_0xc430('0x2a')](_0x1d65ee,function(_0x537e4c){if(_0x537e4c[_0xc430('0x39')]!==_0xc430('0x3a')){var _0x24363b={};_0x24363b[_0x537e4c[_0xc430('0x22')]]={'$like':'%'+_0x1c1da9['query'][_0xc430('0x37')]+'%'};return _0x24363b;}})});}_0x542cba=_[_0xc430('0x38')]({},_0x542cba,_0x1c1da9[_0xc430('0x3b')]);var _0x45b3dc={'where':_0x542cba[_0xc430('0x34')]};return db[_0xc430('0x25')]['count'](_0x45b3dc)[_0xc430('0x1e')](function(_0x348f2f){_0x4cf56c[_0xc430('0x1b')]=_0x348f2f;if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x3c')]){_0x542cba[_0xc430('0x3d')]=[{'all':!![]}];}return db[_0xc430('0x25')][_0xc430('0x3e')](_0x542cba);})[_0xc430('0x1e')](function(_0x4174d2){_0x4cf56c[_0xc430('0x3f')]=_0x4174d2;return _0x4cf56c;})[_0xc430('0x1e')](respondWithFilteredResult(_0x1591e3,_0x542cba))[_0xc430('0x40')](handleError(_0x1591e3,null));};exports[_0xc430('0x41')]=function(_0x5a9c4b,_0x47edb0){var _0x4983e0={'raw':![],'where':{'id':_0x5a9c4b[_0xc430('0x42')]['id']}},_0x262063={};_0x262063[_0xc430('0x29')]=_[_0xc430('0x2b')](db[_0xc430('0x25')][_0xc430('0x26')]);_0x262063[_0xc430('0x2c')]=_[_0xc430('0x2b')](_0x5a9c4b[_0xc430('0x2c')]);_0x262063[_0xc430('0x35')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],_0x262063[_0xc430('0x2c')]);_0x4983e0[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],qs['fields'](_0x5a9c4b[_0xc430('0x2c')][_0xc430('0x2f')]));_0x4983e0[_0xc430('0x2e')]=_0x4983e0[_0xc430('0x2e')][_0xc430('0x43')]?_0x4983e0[_0xc430('0x2e')]:_0x262063[_0xc430('0x29')];if(_0x5a9c4b[_0xc430('0x2c')]['includeAll']){_0x4983e0[_0xc430('0x3d')]=[{'all':!![]}];}_0x4983e0=_['merge']({},_0x4983e0,_0x5a9c4b[_0xc430('0x3b')]);return db[_0xc430('0x25')]['find'](_0x4983e0)['then'](handleEntityNotFound(_0x47edb0,null))[_0xc430('0x1e')](respondWithResult(_0x47edb0,null))['catch'](handleError(_0x47edb0,null));};exports['create']=function(_0x10db27,_0x4eafae){return db[_0xc430('0x25')][_0xc430('0x44')](_0x10db27[_0xc430('0x45')],{})['then'](respondWithResult(_0x4eafae,0xc9))[_0xc430('0x40')](handleError(_0x4eafae,null));};exports[_0xc430('0x46')]=function(_0x19e563,_0x549400){if(_0x19e563[_0xc430('0x45')]['id']){delete _0x19e563[_0xc430('0x45')]['id'];}return db[_0xc430('0x25')][_0xc430('0x47')]({'where':{'id':_0x19e563[_0xc430('0x42')]['id']}})[_0xc430('0x1e')](handleEntityNotFound(_0x549400,null))[_0xc430('0x1e')](saveUpdates(_0x19e563['body'],null))[_0xc430('0x1e')](respondWithResult(_0x549400,null))[_0xc430('0x40')](handleError(_0x549400,null));};exports[_0xc430('0x1f')]=function(_0x4e9aff,_0x23cb41){return db[_0xc430('0x25')][_0xc430('0x47')]({'where':{'id':_0x4e9aff[_0xc430('0x42')]['id']}})['then'](handleEntityNotFound(_0x23cb41,null))[_0xc430('0x1e')](removeEntity(_0x23cb41,null))['catch'](handleError(_0x23cb41,null));};exports[_0xc430('0x48')]=function(_0x214954,_0x2a5143){return db[_0xc430('0x25')][_0xc430('0x48')]()[_0xc430('0x1e')](respondWithResult(_0x2a5143,null))['catch'](handleError(_0x2a5143,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 1af23f8..41169b9 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 _0x54b5=['moment','path','rimraf','../../config/environment','./userProfileResource.attributes','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','api'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x54b5,0x10e));var _0x554b=function(_0xdf6837,_0x440887){_0xdf6837=_0xdf6837-0x0;var _0x254cfa=_0x54b5[_0xdf6837];return _0x254cfa;};'use strict';var _=require(_0x554b('0x0'));var util=require(_0x554b('0x1'));var logger=require('../../config/logger')(_0x554b('0x2'));var moment=require(_0x554b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x554b('0x4'));var rimraf=require(_0x554b('0x5'));var config=require(_0x554b('0x6'));var attributes=require(_0x554b('0x7'));module['exports']=function(_0x36c13c,_0x5e163b){return _0x36c13c['define'](_0x554b('0x8'),attributes,{'tableName':_0x554b('0x9'),'paranoid':![],'indexes':[{'name':_0x554b('0xa'),'fields':[_0x554b('0xb'),_0x554b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x22ef=['exports','define','user_profile_has_resources','resourceId','sectionId','lodash','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x456430,_0x536ce6){var _0x5ecde4=function(_0x485081){while(--_0x485081){_0x456430['push'](_0x456430['shift']());}};_0x5ecde4(++_0x536ce6);}(_0x22ef,0x1f4));var _0xf22e=function(_0x50fcd7,_0x217fac){_0x50fcd7=_0x50fcd7-0x0;var _0x243c98=_0x22ef[_0x50fcd7];return _0x243c98;};'use strict';var _=require(_0xf22e('0x0'));var util=require('util');var logger=require(_0xf22e('0x1'))('api');var moment=require(_0xf22e('0x2'));var BPromise=require(_0xf22e('0x3'));var rp=require(_0xf22e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf22e('0x5'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module[_0xf22e('0x6')]=function(_0x332c18,_0x4152dd){return _0x332c18[_0xf22e('0x7')]('UserProfileResource',attributes,{'tableName':_0xf22e('0x8'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xf22e('0x9'),_0xf22e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 24fd944..6dafb21 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 _0x5e9d=['then','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x5e9d,0xb4));var _0xd5e9=function(_0x390bcb,_0x5c8f39){_0x390bcb=_0x390bcb-0x0;var _0x52e01f=_0x5e9d[_0x390bcb];return _0x52e01f;};'use strict';var _=require(_0xd5e9('0x0'));var util=require(_0xd5e9('0x1'));var moment=require(_0xd5e9('0x2'));var BPromise=require('bluebird');var rs=require(_0xd5e9('0x3'));var fs=require('fs');var Redis=require(_0xd5e9('0x4'));var db=require(_0xd5e9('0x5'))['db'];var utils=require(_0xd5e9('0x6'));var logger=require('../../config/logger')(_0xd5e9('0x7'));var config=require(_0xd5e9('0x8'));var jayson=require(_0xd5e9('0x9'));var client=jayson['client'][_0xd5e9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11b7bc,_0x19dca1,_0x3818af){return new BPromise(function(_0xd91cae,_0xd846e7){return client[_0xd5e9('0xb')](_0x11b7bc,_0x3818af)[_0xd5e9('0xc')](function(_0x5dd691){logger[_0xd5e9('0xd')](_0xd5e9('0xe'),_0x19dca1,'request\x20sent');logger[_0xd5e9('0xf')](_0xd5e9('0x10'),_0x19dca1,'request\x20sent',JSON[_0xd5e9('0x11')](_0x5dd691));if(_0x5dd691[_0xd5e9('0x12')]){if(_0x5dd691['error'][_0xd5e9('0x13')]===0x1f4){logger[_0xd5e9('0x12')](_0xd5e9('0xe'),_0x19dca1,_0x5dd691[_0xd5e9('0x12')][_0xd5e9('0x14')]);return _0xd846e7(_0x5dd691[_0xd5e9('0x12')]['message']);}logger[_0xd5e9('0x12')](_0xd5e9('0xe'),_0x19dca1,_0x5dd691[_0xd5e9('0x12')][_0xd5e9('0x14')]);return _0xd91cae(_0x5dd691[_0xd5e9('0x12')][_0xd5e9('0x14')]);}else{logger[_0xd5e9('0xd')](_0xd5e9('0xe'),_0x19dca1,_0xd5e9('0x15'));_0xd91cae(_0x5dd691[_0xd5e9('0x16')]['message']);}})[_0xd5e9('0x17')](function(_0x2a4d2a){logger[_0xd5e9('0x12')](_0xd5e9('0xe'),_0x19dca1,_0x2a4d2a);_0xd846e7(_0x2a4d2a);});});} \ No newline at end of file +var _0xecca=['ioredis','../../config/logger','rpc','jayson/promise','client','request','then','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','lodash','util','moment','bluebird','randomstring'];(function(_0x1582f7,_0x44c34c){var _0x167111=function(_0x5e255f){while(--_0x5e255f){_0x1582f7['push'](_0x1582f7['shift']());}};_0x167111(++_0x44c34c);}(_0xecca,0x19f));var _0xaecc=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xecca[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xaecc('0x0'));var util=require(_0xaecc('0x1'));var moment=require(_0xaecc('0x2'));var BPromise=require(_0xaecc('0x3'));var rs=require(_0xaecc('0x4'));var fs=require('fs');var Redis=require(_0xaecc('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaecc('0x6'))(_0xaecc('0x7'));var config=require('../../config/environment');var jayson=require(_0xaecc('0x8'));var client=jayson[_0xaecc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35d1b9,_0x1e1b31,_0x4f6da6){return new BPromise(function(_0x5ccd5d,_0x57e160){return client[_0xaecc('0xa')](_0x35d1b9,_0x4f6da6)[_0xaecc('0xb')](function(_0x598a7d){logger['info'](_0xaecc('0xc'),_0x1e1b31,'request\x20sent');logger[_0xaecc('0xd')](_0xaecc('0xe'),_0x1e1b31,_0xaecc('0xf'),JSON[_0xaecc('0x10')](_0x598a7d));if(_0x598a7d[_0xaecc('0x11')]){if(_0x598a7d[_0xaecc('0x11')][_0xaecc('0x12')]===0x1f4){logger['error'](_0xaecc('0xc'),_0x1e1b31,_0x598a7d['error'][_0xaecc('0x13')]);return _0x57e160(_0x598a7d['error'][_0xaecc('0x13')]);}logger[_0xaecc('0x11')](_0xaecc('0xc'),_0x1e1b31,_0x598a7d['error'][_0xaecc('0x13')]);return _0x5ccd5d(_0x598a7d[_0xaecc('0x11')][_0xaecc('0x13')]);}else{logger[_0xaecc('0x14')]('UserProfileResource,\x20%s,\x20%s',_0x1e1b31,_0xaecc('0xf'));_0x5ccd5d(_0x598a7d['result']['message']);}})['catch'](function(_0x2495a3){logger[_0xaecc('0x11')](_0xaecc('0xc'),_0x1e1b31,_0x2495a3);_0x57e160(_0x2495a3);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 58c242f..94bce41 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 _0x89e0=['connect-timeout','fs-extra','../../config/environment','get','index','isAuthenticated','/:id','show','create','update','delete','destroy','multer','path'];(function(_0x40e989,_0x157065){var _0x116160=function(_0x13f2f5){while(--_0x13f2f5){_0x40e989['push'](_0x40e989['shift']());}};_0x116160(++_0x157065);}(_0x89e0,0x132));var _0x089e=function(_0x156e99,_0x2bf27e){_0x156e99=_0x156e99-0x0;var _0x18870e=_0x89e0[_0x156e99];return _0x18870e;};'use strict';var multer=require(_0x089e('0x0'));var util=require('util');var path=require(_0x089e('0x1'));var timeout=require(_0x089e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x089e('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x089e('0x4'));var controller=require('./userProfileSection.controller');router[_0x089e('0x5')]('/',auth['isAuthenticated'](),controller[_0x089e('0x6')]);router[_0x089e('0x5')]('/describe',auth[_0x089e('0x7')](),controller['describe']);router[_0x089e('0x5')](_0x089e('0x8'),auth[_0x089e('0x7')](),controller[_0x089e('0x9')]);router['post']('/',auth[_0x089e('0x7')](),controller[_0x089e('0xa')]);router['put'](_0x089e('0x8'),auth[_0x089e('0x7')](),controller[_0x089e('0xb')]);router[_0x089e('0xc')]('/:id',auth[_0x089e('0x7')](),controller[_0x089e('0xd')]);module['exports']=router; \ No newline at end of file +var _0x2292=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x8feac2,_0x279327){var _0x541f98=function(_0x837a45){while(--_0x837a45){_0x8feac2['push'](_0x8feac2['shift']());}};_0x541f98(++_0x279327);}(_0x2292,0xdb));var _0x2229=function(_0x1e920c,_0x2e73de){_0x1e920c=_0x1e920c-0x0;var _0x347799=_0x2292[_0x1e920c];return _0x347799;};'use strict';var multer=require(_0x2229('0x0'));var util=require(_0x2229('0x1'));var path=require('path');var timeout=require(_0x2229('0x2'));var express=require(_0x2229('0x3'));var router=express['Router']();var fs_extra=require(_0x2229('0x4'));var auth=require(_0x2229('0x5'));var interaction=require(_0x2229('0x6'));var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0x2229('0x7')]('/',auth[_0x2229('0x8')](),controller[_0x2229('0x9')]);router[_0x2229('0x7')]('/describe',auth[_0x2229('0x8')](),controller[_0x2229('0xa')]);router[_0x2229('0x7')]('/:id',auth[_0x2229('0x8')](),controller[_0x2229('0xb')]);router[_0x2229('0xc')]('/',auth[_0x2229('0x8')](),controller[_0x2229('0xd')]);router[_0x2229('0xe')](_0x2229('0xf'),auth[_0x2229('0x8')](),controller[_0x2229('0x10')]);router[_0x2229('0x11')](_0x2229('0xf'),auth[_0x2229('0x8')](),controller[_0x2229('0x12')]);module[_0x2229('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 69542ab..d142baa 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 _0x8f59=['INTEGER','BOOLEAN','setDataValue','crudPermissions','getDataValue','sequelize','exports','STRING'];(function(_0x52bf6f,_0x3d3be7){var _0x462f45=function(_0x58a3f8){while(--_0x58a3f8){_0x52bf6f['push'](_0x52bf6f['shift']());}};_0x462f45(++_0x3d3be7);}(_0x8f59,0x11d));var _0x98f5=function(_0x257996,_0x31432b){_0x257996=_0x257996-0x0;var _0x531817=_0x8f59[_0x257996];return _0x531817;};'use strict';var Sequelize=require(_0x98f5('0x0'));module[_0x98f5('0x1')]={'name':{'type':Sequelize[_0x98f5('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x98f5('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x98f5('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x98f5('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x98f5('0x2')],'set':function(_0x320235){this[_0x98f5('0x5')](_0x98f5('0x6'),_0x320235?_0x320235['join'](''):[]);},'get':function(){return this[_0x98f5('0x7')](_0x98f5('0x6'))?this[_0x98f5('0x7')]('crudPermissions')['split'](''):[];}}}; \ No newline at end of file +var _0xd4f4=['setDataValue','crudPermissions','getDataValue','split','sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x207f8e,_0x416b9a){_0x207f8e=_0x207f8e-0x0;var _0x499e23=_0xd4f4[_0x207f8e];return _0x499e23;};'use strict';var Sequelize=require(_0x4d4f('0x0'));module[_0x4d4f('0x1')]={'name':{'type':Sequelize[_0x4d4f('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x4d4f('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4d4f('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4d4f('0x2')],'set':function(_0x25087a){this[_0x4d4f('0x5')](_0x4d4f('0x6'),_0x25087a?_0x25087a['join'](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x4d4f('0x7')](_0x4d4f('0x6'))[_0x4d4f('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index df57a5b..af849ab 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 _0xb42a=['Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','UserProfileSection','rawAttributes','fieldName','type','key','map','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','keys','intersection','includeAll','find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','limit','count'];(function(_0x4ecd38,_0x526e94){var _0x579b87=function(_0x2d64a6){while(--_0x2d64a6){_0x4ecd38['push'](_0x4ecd38['shift']());}};_0x579b87(++_0x526e94);}(_0xb42a,0xc5));var _0xab42=function(_0x239623,_0x19de29){_0x239623=_0x239623-0x0;var _0xc5b2f5=_0xb42a[_0x239623];return _0xc5b2f5;};'use strict';var emlformat=require(_0xab42('0x0'));var rimraf=require(_0xab42('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xab42('0x2'));var rp=require('request-promise');var moment=require(_0xab42('0x3'));var BPromise=require(_0xab42('0x4'));var Mustache=require(_0xab42('0x5'));var util=require(_0xab42('0x6'));var path=require(_0xab42('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xab42('0x8'));var fs=require('fs');var fs_extra=require(_0xab42('0x9'));var _=require(_0xab42('0xa'));var squel=require(_0xab42('0xb'));var crypto=require(_0xab42('0xc'));var jsforce=require(_0xab42('0xd'));var deskjs=require(_0xab42('0xe'));var toCsv=require(_0xab42('0xf'));var querystring=require(_0xab42('0x10'));var Papa=require('papaparse');var Redis=require(_0xab42('0x11'));var authService=require(_0xab42('0x12'));var qs=require(_0xab42('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab42('0x14'));var logger=require(_0xab42('0x15'))(_0xab42('0x16'));var utils=require(_0xab42('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xab42('0x18'))['db'];function respondWithStatusCode(_0x2c5485,_0x369d78){_0x369d78=_0x369d78||0xcc;return function(_0x1701f4){if(_0x1701f4){return _0x2c5485['sendStatus'](_0x369d78);}return _0x2c5485[_0xab42('0x19')](_0x369d78)['end']();};}function respondWithResult(_0x4a9395,_0x2de540){_0x2de540=_0x2de540||0xc8;return function(_0x5c8cd4){if(_0x5c8cd4){return _0x4a9395['status'](_0x2de540)[_0xab42('0x1a')](_0x5c8cd4);}};}function respondWithFilteredResult(_0xa82d47,_0x40cc49){return function(_0x3fdbb7){if(_0x3fdbb7){var _0x3fb307=typeof _0x40cc49[_0xab42('0x1b')]===_0xab42('0x1c')&&typeof _0x40cc49[_0xab42('0x1d')]==='undefined';var _0x29cb5d=_0x3fdbb7[_0xab42('0x1e')];var _0x41ca70=_0x3fb307?0x0:_0x40cc49[_0xab42('0x1b')];var _0x336644=_0x3fb307?_0x3fdbb7[_0xab42('0x1e')]:_0x40cc49[_0xab42('0x1b')]+_0x40cc49['limit'];var _0x7593da;if(_0x336644>=_0x29cb5d){_0x336644=_0x29cb5d;_0x7593da=0xc8;}else{_0x7593da=0xce;}_0xa82d47[_0xab42('0x19')](_0x7593da);return _0xa82d47['set'](_0xab42('0x1f'),_0x41ca70+'-'+_0x336644+'/'+_0x29cb5d)['json'](_0x3fdbb7);}return null;};}function patchUpdates(_0x3173a6){return function(_0x3bc1d7){try{jsonpatch[_0xab42('0x20')](_0x3bc1d7,_0x3173a6,!![]);}catch(_0x568a61){return BPromise[_0xab42('0x21')](_0x568a61);}return _0x3bc1d7[_0xab42('0x22')]();};}function saveUpdates(_0x4b26df,_0x5edeb7){return function(_0x4f4deb){if(_0x4f4deb){return _0x4f4deb[_0xab42('0x23')](_0x4b26df)[_0xab42('0x24')](function(_0x1b2692){return _0x1b2692;});}return null;};}function removeEntity(_0x10ecf2,_0x103d14){return function(_0x32bc9c){if(_0x32bc9c){return _0x32bc9c[_0xab42('0x25')]()[_0xab42('0x24')](function(){_0x10ecf2[_0xab42('0x19')](0xcc)[_0xab42('0x26')]();});}};}function handleEntityNotFound(_0x38a487,_0x1f3b9f){return function(_0x336f6a){if(!_0x336f6a){_0x38a487[_0xab42('0x27')](0x194);}return _0x336f6a;};}function handleError(_0x222da3,_0x380fc7){_0x380fc7=_0x380fc7||0x1f4;return function(_0x3f7db7){logger[_0xab42('0x28')](_0x3f7db7[_0xab42('0x29')]);if(_0x3f7db7[_0xab42('0x2a')]){delete _0x3f7db7[_0xab42('0x2a')];}_0x222da3[_0xab42('0x19')](_0x380fc7)[_0xab42('0x2b')](_0x3f7db7);};}exports[_0xab42('0x2c')]=function(_0x272ce6,_0x1543ba){var _0x4daaa2={},_0x505d78={},_0x1ea98e={'count':0x0,'rows':[]};var _0x23c10b=_['map'](db[_0xab42('0x2d')][_0xab42('0x2e')],function(_0x7b7ec){return{'name':_0x7b7ec[_0xab42('0x2f')],'type':_0x7b7ec[_0xab42('0x30')][_0xab42('0x31')]};});_0x505d78['model']=_[_0xab42('0x32')](_0x23c10b,'name');_0x505d78[_0xab42('0x33')]=_['keys'](_0x272ce6[_0xab42('0x33')]);_0x505d78[_0xab42('0x34')]=_['intersection'](_0x505d78[_0xab42('0x35')],_0x505d78[_0xab42('0x33')]);_0x4daaa2[_0xab42('0x36')]=_['intersection'](_0x505d78[_0xab42('0x35')],qs['fields'](_0x272ce6[_0xab42('0x33')][_0xab42('0x37')]));_0x4daaa2[_0xab42('0x36')]=_0x4daaa2[_0xab42('0x36')][_0xab42('0x38')]?_0x4daaa2['attributes']:_0x505d78[_0xab42('0x35')];if(!_0x272ce6['query'][_0xab42('0x39')](_0xab42('0x3a'))){_0x4daaa2[_0xab42('0x1d')]=qs[_0xab42('0x1d')](_0x272ce6[_0xab42('0x33')][_0xab42('0x1d')]);_0x4daaa2[_0xab42('0x1b')]=qs['offset'](_0x272ce6[_0xab42('0x33')][_0xab42('0x1b')]);}_0x4daaa2['order']=qs[_0xab42('0x3b')](_0x272ce6[_0xab42('0x33')][_0xab42('0x3b')]);_0x4daaa2[_0xab42('0x3c')]=qs[_0xab42('0x34')](_['pick'](_0x272ce6[_0xab42('0x33')],_0x505d78[_0xab42('0x34')]),_0x23c10b);if(_0x272ce6[_0xab42('0x33')][_0xab42('0x3d')]){_0x4daaa2[_0xab42('0x3c')]=_[_0xab42('0x3e')](_0x4daaa2['where'],{'$or':_['map'](_0x23c10b,function(_0x1fdc52){if(_0x1fdc52['type']!==_0xab42('0x3f')){var _0x3f08b8={};_0x3f08b8[_0x1fdc52['name']]={'$like':'%'+_0x272ce6['query'][_0xab42('0x3d')]+'%'};return _0x3f08b8;}})});}_0x4daaa2=_[_0xab42('0x3e')]({},_0x4daaa2,_0x272ce6[_0xab42('0x40')]);var _0x22a855={'where':_0x4daaa2[_0xab42('0x3c')]};return db[_0xab42('0x2d')][_0xab42('0x1e')](_0x22a855)[_0xab42('0x24')](function(_0x1d405f){_0x1ea98e['count']=_0x1d405f;if(_0x272ce6[_0xab42('0x33')]['includeAll']){_0x4daaa2[_0xab42('0x41')]=[{'all':!![]}];}return db[_0xab42('0x2d')][_0xab42('0x42')](_0x4daaa2);})[_0xab42('0x24')](function(_0x1b1c15){_0x1ea98e['rows']=_0x1b1c15;return _0x1ea98e;})[_0xab42('0x24')](respondWithFilteredResult(_0x1543ba,_0x4daaa2))[_0xab42('0x43')](handleError(_0x1543ba,null));};exports[_0xab42('0x44')]=function(_0x2dbaa7,_0x285a93){var _0x5c19cd={'raw':![],'where':{'id':_0x2dbaa7[_0xab42('0x45')]['id']}},_0x1fd926={};_0x1fd926[_0xab42('0x35')]=_[_0xab42('0x46')](db[_0xab42('0x2d')]['rawAttributes']);_0x1fd926['query']=_[_0xab42('0x46')](_0x2dbaa7['query']);_0x1fd926['filters']=_[_0xab42('0x47')](_0x1fd926['model'],_0x1fd926[_0xab42('0x33')]);_0x5c19cd['attributes']=_[_0xab42('0x47')](_0x1fd926[_0xab42('0x35')],qs['fields'](_0x2dbaa7[_0xab42('0x33')]['fields']));_0x5c19cd[_0xab42('0x36')]=_0x5c19cd[_0xab42('0x36')][_0xab42('0x38')]?_0x5c19cd['attributes']:_0x1fd926[_0xab42('0x35')];if(_0x2dbaa7[_0xab42('0x33')][_0xab42('0x48')]){_0x5c19cd['include']=[{'all':!![]}];}_0x5c19cd=_['merge']({},_0x5c19cd,_0x2dbaa7['options']);return db[_0xab42('0x2d')][_0xab42('0x49')](_0x5c19cd)[_0xab42('0x24')](handleEntityNotFound(_0x285a93,null))[_0xab42('0x24')](respondWithResult(_0x285a93,null))[_0xab42('0x43')](handleError(_0x285a93,null));};exports[_0xab42('0x4a')]=function(_0x2f1a0e,_0x1ee076){return db['UserProfileSection']['create'](_0x2f1a0e[_0xab42('0x4b')],{})[_0xab42('0x24')](respondWithResult(_0x1ee076,0xc9))[_0xab42('0x43')](handleError(_0x1ee076,null));};exports['update']=function(_0x3da14d,_0x1f8ebb){if(_0x3da14d[_0xab42('0x4b')]['id']){delete _0x3da14d[_0xab42('0x4b')]['id'];}return db[_0xab42('0x2d')]['find']({'where':{'id':_0x3da14d['params']['id']}})[_0xab42('0x24')](handleEntityNotFound(_0x1f8ebb,null))[_0xab42('0x24')](saveUpdates(_0x3da14d[_0xab42('0x4b')],null))[_0xab42('0x24')](respondWithResult(_0x1f8ebb,null))[_0xab42('0x43')](handleError(_0x1f8ebb,null));};exports[_0xab42('0x25')]=function(_0x4e4db5,_0x2a4927){return db[_0xab42('0x2d')][_0xab42('0x49')]({'where':{'id':_0x4e4db5['params']['id']}})[_0xab42('0x24')](handleEntityNotFound(_0x2a4927,null))[_0xab42('0x24')](removeEntity(_0x2a4927,null))[_0xab42('0x43')](handleError(_0x2a4927,null));};exports['describe']=function(_0x5f27ac,_0x1dbd46){return db[_0xab42('0x2d')]['describe']()[_0xab42('0x24')](respondWithResult(_0x1dbd46,null))[_0xab42('0x43')](handleError(_0x1dbd46,null));}; \ No newline at end of file +var _0x63a7=['path','to-csv','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','error','name','send','UserProfileSection','rawAttributes','fieldName','type','key','map','query','filters','intersection','attributes','model','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','keys','fields','include','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x5c693b,_0x19502d){var _0x4fd6f4=function(_0x433f9b){while(--_0x433f9b){_0x5c693b['push'](_0x5c693b['shift']());}};_0x4fd6f4(++_0x19502d);}(_0x63a7,0x19c));var _0x763a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x63a7[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0x763a('0x0'));var rimraf=require(_0x763a('0x1'));var zipdir=require(_0x763a('0x2'));var jsonpatch=require(_0x763a('0x3'));var rp=require(_0x763a('0x4'));var moment=require(_0x763a('0x5'));var BPromise=require(_0x763a('0x6'));var Mustache=require('mustache');var util=require(_0x763a('0x7'));var path=require(_0x763a('0x8'));var sox=require('sox');var csv=require(_0x763a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x763a('0xa'));var crypto=require('crypto');var jsforce=require(_0x763a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x763a('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x763a('0xc'));var authService=require(_0x763a('0xd'));var qs=require(_0x763a('0xe'));var as=require(_0x763a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x763a('0x10'))(_0x763a('0x11'));var utils=require(_0x763a('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x763a('0x13'));var db=require(_0x763a('0x14'))['db'];function respondWithStatusCode(_0x154747,_0x34b393){_0x34b393=_0x34b393||0xcc;return function(_0x519e6b){if(_0x519e6b){return _0x154747[_0x763a('0x15')](_0x34b393);}return _0x154747[_0x763a('0x16')](_0x34b393)[_0x763a('0x17')]();};}function respondWithResult(_0x193256,_0x31660d){_0x31660d=_0x31660d||0xc8;return function(_0x304a15){if(_0x304a15){return _0x193256[_0x763a('0x16')](_0x31660d)[_0x763a('0x18')](_0x304a15);}};}function respondWithFilteredResult(_0x271828,_0x30691c){return function(_0x154c40){if(_0x154c40){var _0x433248=typeof _0x30691c[_0x763a('0x19')]===_0x763a('0x1a')&&typeof _0x30691c[_0x763a('0x1b')]==='undefined';var _0x191e5c=_0x154c40[_0x763a('0x1c')];var _0x32bc87=_0x433248?0x0:_0x30691c[_0x763a('0x19')];var _0x38c3bb=_0x433248?_0x154c40[_0x763a('0x1c')]:_0x30691c[_0x763a('0x19')]+_0x30691c[_0x763a('0x1b')];var _0x2ff9be;if(_0x38c3bb>=_0x191e5c){_0x38c3bb=_0x191e5c;_0x2ff9be=0xc8;}else{_0x2ff9be=0xce;}_0x271828['status'](_0x2ff9be);return _0x271828[_0x763a('0x1d')]('Content-Range',_0x32bc87+'-'+_0x38c3bb+'/'+_0x191e5c)[_0x763a('0x18')](_0x154c40);}return null;};}function patchUpdates(_0x501a57){return function(_0x52dcda){try{jsonpatch['apply'](_0x52dcda,_0x501a57,!![]);}catch(_0x40f8a4){return BPromise[_0x763a('0x1e')](_0x40f8a4);}return _0x52dcda[_0x763a('0x1f')]();};}function saveUpdates(_0x2b5e06,_0x5a9fc2){return function(_0x4bc67c){if(_0x4bc67c){return _0x4bc67c[_0x763a('0x20')](_0x2b5e06)[_0x763a('0x21')](function(_0x1f192e){return _0x1f192e;});}return null;};}function removeEntity(_0x55b06d,_0x33e143){return function(_0x5a2837){if(_0x5a2837){return _0x5a2837['destroy']()[_0x763a('0x21')](function(){_0x55b06d[_0x763a('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x158be8,_0x36e3c9){return function(_0x4cfec1){if(!_0x4cfec1){_0x158be8[_0x763a('0x15')](0x194);}return _0x4cfec1;};}function handleError(_0x177027,_0x33d059){_0x33d059=_0x33d059||0x1f4;return function(_0x69d038){logger[_0x763a('0x22')](_0x69d038['stack']);if(_0x69d038['name']){delete _0x69d038[_0x763a('0x23')];}_0x177027[_0x763a('0x16')](_0x33d059)[_0x763a('0x24')](_0x69d038);};}exports['index']=function(_0x32e49f,_0x286b5c){var _0x1bb221={},_0x15f43c={},_0x2d225c={'count':0x0,'rows':[]};var _0x39a6a4=_['map'](db[_0x763a('0x25')][_0x763a('0x26')],function(_0x59b4ca){return{'name':_0x59b4ca[_0x763a('0x27')],'type':_0x59b4ca[_0x763a('0x28')][_0x763a('0x29')]};});_0x15f43c['model']=_[_0x763a('0x2a')](_0x39a6a4,_0x763a('0x23'));_0x15f43c['query']=_['keys'](_0x32e49f[_0x763a('0x2b')]);_0x15f43c[_0x763a('0x2c')]=_[_0x763a('0x2d')](_0x15f43c['model'],_0x15f43c[_0x763a('0x2b')]);_0x1bb221[_0x763a('0x2e')]=_[_0x763a('0x2d')](_0x15f43c[_0x763a('0x2f')],qs['fields'](_0x32e49f['query']['fields']));_0x1bb221[_0x763a('0x2e')]=_0x1bb221['attributes'][_0x763a('0x30')]?_0x1bb221[_0x763a('0x2e')]:_0x15f43c[_0x763a('0x2f')];if(!_0x32e49f['query']['hasOwnProperty'](_0x763a('0x31'))){_0x1bb221[_0x763a('0x1b')]=qs[_0x763a('0x1b')](_0x32e49f[_0x763a('0x2b')]['limit']);_0x1bb221[_0x763a('0x19')]=qs[_0x763a('0x19')](_0x32e49f['query']['offset']);}_0x1bb221[_0x763a('0x32')]=qs[_0x763a('0x33')](_0x32e49f['query']['sort']);_0x1bb221['where']=qs[_0x763a('0x2c')](_['pick'](_0x32e49f[_0x763a('0x2b')],_0x15f43c[_0x763a('0x2c')]),_0x39a6a4);if(_0x32e49f[_0x763a('0x2b')][_0x763a('0x34')]){_0x1bb221[_0x763a('0x35')]=_[_0x763a('0x36')](_0x1bb221['where'],{'$or':_[_0x763a('0x2a')](_0x39a6a4,function(_0xebdd89){if(_0xebdd89[_0x763a('0x28')]!==_0x763a('0x37')){var _0x4e683a={};_0x4e683a[_0xebdd89[_0x763a('0x23')]]={'$like':'%'+_0x32e49f[_0x763a('0x2b')][_0x763a('0x34')]+'%'};return _0x4e683a;}})});}_0x1bb221=_[_0x763a('0x36')]({},_0x1bb221,_0x32e49f[_0x763a('0x38')]);var _0x370b13={'where':_0x1bb221['where']};return db[_0x763a('0x25')]['count'](_0x370b13)[_0x763a('0x21')](function(_0x32e821){_0x2d225c[_0x763a('0x1c')]=_0x32e821;if(_0x32e49f['query']['includeAll']){_0x1bb221['include']=[{'all':!![]}];}return db[_0x763a('0x25')][_0x763a('0x39')](_0x1bb221);})[_0x763a('0x21')](function(_0x21c846){_0x2d225c[_0x763a('0x3a')]=_0x21c846;return _0x2d225c;})[_0x763a('0x21')](respondWithFilteredResult(_0x286b5c,_0x1bb221))[_0x763a('0x3b')](handleError(_0x286b5c,null));};exports[_0x763a('0x3c')]=function(_0x4f1159,_0x215f61){var _0x318ae6={'raw':![],'where':{'id':_0x4f1159['params']['id']}},_0x3f396b={};_0x3f396b[_0x763a('0x2f')]=_[_0x763a('0x3d')](db[_0x763a('0x25')]['rawAttributes']);_0x3f396b[_0x763a('0x2b')]=_[_0x763a('0x3d')](_0x4f1159[_0x763a('0x2b')]);_0x3f396b['filters']=_[_0x763a('0x2d')](_0x3f396b[_0x763a('0x2f')],_0x3f396b[_0x763a('0x2b')]);_0x318ae6[_0x763a('0x2e')]=_['intersection'](_0x3f396b[_0x763a('0x2f')],qs[_0x763a('0x3e')](_0x4f1159[_0x763a('0x2b')]['fields']));_0x318ae6[_0x763a('0x2e')]=_0x318ae6['attributes'][_0x763a('0x30')]?_0x318ae6[_0x763a('0x2e')]:_0x3f396b['model'];if(_0x4f1159[_0x763a('0x2b')]['includeAll']){_0x318ae6[_0x763a('0x3f')]=[{'all':!![]}];}_0x318ae6=_[_0x763a('0x36')]({},_0x318ae6,_0x4f1159[_0x763a('0x38')]);return db[_0x763a('0x25')][_0x763a('0x40')](_0x318ae6)[_0x763a('0x21')](handleEntityNotFound(_0x215f61,null))[_0x763a('0x21')](respondWithResult(_0x215f61,null))['catch'](handleError(_0x215f61,null));};exports[_0x763a('0x41')]=function(_0x13a5c9,_0x312c8c){return db['UserProfileSection'][_0x763a('0x41')](_0x13a5c9['body'],{})[_0x763a('0x21')](respondWithResult(_0x312c8c,0xc9))[_0x763a('0x3b')](handleError(_0x312c8c,null));};exports[_0x763a('0x20')]=function(_0x554873,_0x463233){if(_0x554873[_0x763a('0x42')]['id']){delete _0x554873['body']['id'];}return db[_0x763a('0x25')][_0x763a('0x40')]({'where':{'id':_0x554873[_0x763a('0x43')]['id']}})['then'](handleEntityNotFound(_0x463233,null))[_0x763a('0x21')](saveUpdates(_0x554873[_0x763a('0x42')],null))[_0x763a('0x21')](respondWithResult(_0x463233,null))['catch'](handleError(_0x463233,null));};exports[_0x763a('0x44')]=function(_0x4d39af,_0x3b303){return db[_0x763a('0x25')][_0x763a('0x40')]({'where':{'id':_0x4d39af[_0x763a('0x43')]['id']}})[_0x763a('0x21')](handleEntityNotFound(_0x3b303,null))[_0x763a('0x21')](removeEntity(_0x3b303,null))[_0x763a('0x3b')](handleError(_0x3b303,null));};exports[_0x763a('0x45')]=function(_0x1c5ca2,_0x306943){return db['UserProfileSection'][_0x763a('0x45')]()[_0x763a('0x21')](respondWithResult(_0x306943,null))[_0x763a('0x3b')](handleError(_0x306943,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index dde4f83..4fc313d 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 _0xc4d1=['exports','define','UserProfileSection','user_profile_has_sections','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x47c3b9,_0xf4e765){var _0x15d901=function(_0x506980){while(--_0x506980){_0x47c3b9['push'](_0x47c3b9['shift']());}};_0x15d901(++_0xf4e765);}(_0xc4d1,0x1b9));var _0x1c4d=function(_0x3391fe,_0x5c24d9){_0x3391fe=_0x3391fe-0x0;var _0x1ae383=_0xc4d1[_0x3391fe];return _0x1ae383;};'use strict';var _=require(_0x1c4d('0x0'));var util=require(_0x1c4d('0x1'));var logger=require(_0x1c4d('0x2'))(_0x1c4d('0x3'));var moment=require(_0x1c4d('0x4'));var BPromise=require(_0x1c4d('0x5'));var rp=require(_0x1c4d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1c4d('0x7'));var config=require(_0x1c4d('0x8'));var attributes=require('./userProfileSection.attributes');module[_0x1c4d('0x9')]=function(_0x1a457e,_0x255f82){return _0x1a457e[_0x1c4d('0xa')](_0x1c4d('0xb'),attributes,{'tableName':_0x1c4d('0xc'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x1c4d('0xd'),_0x1c4d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xff1f=['exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./userProfileSection.attributes'];(function(_0x506b51,_0x2d2b6d){var _0xca5779=function(_0x5f0fcb){while(--_0x5f0fcb){_0x506b51['push'](_0x506b51['shift']());}};_0xca5779(++_0x2d2b6d);}(_0xff1f,0x133));var _0xfff1=function(_0x12d951,_0x249808){_0x12d951=_0x12d951-0x0;var _0x44de17=_0xff1f[_0x12d951];return _0x44de17;};'use strict';var _=require('lodash');var util=require(_0xfff1('0x0'));var logger=require(_0xfff1('0x1'))(_0xfff1('0x2'));var moment=require(_0xfff1('0x3'));var BPromise=require('bluebird');var rp=require(_0xfff1('0x4'));var fs=require('fs');var path=require(_0xfff1('0x5'));var rimraf=require('rimraf');var config=require(_0xfff1('0x6'));var attributes=require(_0xfff1('0x7'));module[_0xfff1('0x8')]=function(_0x55a343,_0x1fe054){return _0x55a343[_0xfff1('0x9')](_0xfff1('0xa'),attributes,{'tableName':_0xfff1('0xb'),'paranoid':![],'indexes':[{'name':_0xfff1('0xc'),'fields':[_0xfff1('0xd'),_0xfff1('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 4e78e06..3c412db 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 _0xe80e=['then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0xe80e,0x1d8));var _0xee80=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xe80e[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xee80('0x0'));var util=require(_0xee80('0x1'));var moment=require(_0xee80('0x2'));var BPromise=require(_0xee80('0x3'));var rs=require(_0xee80('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xee80('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xee80('0x6'))('rpc');var config=require(_0xee80('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xee80('0x8')][_0xee80('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c88b5,_0x3a3865,_0x1bcac3){return new BPromise(function(_0x4c9b1f,_0x4bf00e){return client[_0xee80('0xa')](_0x5c88b5,_0x1bcac3)[_0xee80('0xb')](function(_0x2e5c7b){logger[_0xee80('0xc')](_0xee80('0xd'),_0x3a3865,_0xee80('0xe'));logger['debug'](_0xee80('0xf'),_0x3a3865,_0xee80('0xe'),JSON[_0xee80('0x10')](_0x2e5c7b));if(_0x2e5c7b[_0xee80('0x11')]){if(_0x2e5c7b['error']['code']===0x1f4){logger[_0xee80('0x11')](_0xee80('0xd'),_0x3a3865,_0x2e5c7b['error']['message']);return _0x4bf00e(_0x2e5c7b[_0xee80('0x11')][_0xee80('0x12')]);}logger[_0xee80('0x11')](_0xee80('0xd'),_0x3a3865,_0x2e5c7b['error']['message']);return _0x4c9b1f(_0x2e5c7b[_0xee80('0x11')][_0xee80('0x12')]);}else{logger[_0xee80('0xc')](_0xee80('0xd'),_0x3a3865,_0xee80('0xe'));_0x4c9b1f(_0x2e5c7b[_0xee80('0x13')]['message']);}})[_0xee80('0x14')](function(_0xec37c7){logger[_0xee80('0x11')](_0xee80('0xd'),_0x3a3865,_0xec37c7);_0x4bf00e(_0xec37c7);});});} \ No newline at end of file +var _0x444a=['message','catch','lodash','moment','../../config/utils','rpc','jayson/promise','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xae5e3c,_0x1a07bf){var _0x5c87b8=function(_0x3e8143){while(--_0x3e8143){_0xae5e3c['push'](_0xae5e3c['shift']());}};_0x5c87b8(++_0x1a07bf);}(_0x444a,0xa2));var _0xa444=function(_0xdb357c,_0x3786b6){_0xdb357c=_0xdb357c-0x0;var _0x5c8735=_0x444a[_0xdb357c];return _0x5c8735;};'use strict';var _=require(_0xa444('0x0'));var util=require('util');var moment=require(_0xa444('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa444('0x2'));var logger=require('../../config/logger')(_0xa444('0x3'));var config=require('../../config/environment');var jayson=require(_0xa444('0x4'));var client=jayson['client'][_0xa444('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x4dca8e,_0x4a5d68,_0x1b58b1){return new BPromise(function(_0x9dbb7f,_0x159357){return client[_0xa444('0x6')](_0x4dca8e,_0x1b58b1)[_0xa444('0x7')](function(_0x2c4c06){logger[_0xa444('0x8')](_0xa444('0x9'),_0x4a5d68,_0xa444('0xa'));logger['debug'](_0xa444('0xb'),_0x4a5d68,_0xa444('0xa'),JSON[_0xa444('0xc')](_0x2c4c06));if(_0x2c4c06['error']){if(_0x2c4c06['error']['code']===0x1f4){logger[_0xa444('0xd')](_0xa444('0x9'),_0x4a5d68,_0x2c4c06[_0xa444('0xd')]['message']);return _0x159357(_0x2c4c06['error'][_0xa444('0xe')]);}logger[_0xa444('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x4a5d68,_0x2c4c06[_0xa444('0xd')][_0xa444('0xe')]);return _0x9dbb7f(_0x2c4c06['error'][_0xa444('0xe')]);}else{logger['info'](_0xa444('0x9'),_0x4a5d68,_0xa444('0xa'));_0x9dbb7f(_0x2c4c06['result'][_0xa444('0xe')]);}})[_0xa444('0xf')](function(_0x5e34ea){logger[_0xa444('0xd')](_0xa444('0x9'),_0x4a5d68,_0x5e34ea);_0x159357(_0x5e34ea);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 5759ff8..b3676ed 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x17bf06,_0x53fc25){var _0x5a72c8=function(_0x9dcb06){while(--_0x9dcb06){_0x17bf06['push'](_0x17bf06['shift']());}};_0x5a72c8(++_0x53fc25);}(_0x70e0,0x17b));var _0x070e=function(_0x59f0c2,_0x8154){_0x59f0c2=_0x59f0c2-0x0;var _0x252618=_0x70e0[_0x59f0c2];return _0x252618;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4fda88,_0x1a4d19){var _0xe37511=function(_0x51f461){while(--_0x51f461){_0x4fda88['push'](_0x4fda88['shift']());}};_0xe37511(++_0x1a4d19);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 298d357..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 _0x42ee=['exports','INTEGER'];(function(_0x3c487b,_0x44c5e2){var _0x1d65f6=function(_0x135e6d){while(--_0x135e6d){_0x3c487b['push'](_0x3c487b['shift']());}};_0x1d65f6(++_0x44c5e2);}(_0x42ee,0x19a));var _0xe42e=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x42ee[_0x4792c8];return _0x35edb1;};'use strict';var Sequelize=require('sequelize');module[_0xe42e('0x0')]={'penalty':{'type':Sequelize[_0xe42e('0x1')],'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 b236608..193e21c 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 _0xe785=['util','api','moment','bluebird','request-promise','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues','lodash'];(function(_0x4d4188,_0x23e126){var _0x3f9c84=function(_0x216d1e){while(--_0x216d1e){_0x4d4188['push'](_0x4d4188['shift']());}};_0x3f9c84(++_0x23e126);}(_0xe785,0x128));var _0x5e78=function(_0x445988,_0x19a6fe){_0x445988=_0x445988-0x0;var _0x2a2fd0=_0xe785[_0x445988];return _0x2a2fd0;};'use strict';var _=require(_0x5e78('0x0'));var util=require(_0x5e78('0x1'));var logger=require('../../config/logger')(_0x5e78('0x2'));var moment=require(_0x5e78('0x3'));var BPromise=require(_0x5e78('0x4'));var rp=require(_0x5e78('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5e78('0x6'));var attributes=require(_0x5e78('0x7'));module[_0x5e78('0x8')]=function(_0x135552,_0x502114){return _0x135552['define'](_0x5e78('0x9'),attributes,{'tableName':_0x5e78('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe785=['util','api','moment','bluebird','request-promise','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues','lodash'];(function(_0x38e5cd,_0x2ebc35){var _0x141ddc=function(_0x24c21b){while(--_0x24c21b){_0x38e5cd['push'](_0x38e5cd['shift']());}};_0x141ddc(++_0x2ebc35);}(_0xe785,0x128));var _0x5e78=function(_0xb4597b,_0x1396a5){_0xb4597b=_0xb4597b-0x0;var _0x4af4e4=_0xe785[_0xb4597b];return _0x4af4e4;};'use strict';var _=require(_0x5e78('0x0'));var util=require(_0x5e78('0x1'));var logger=require('../../config/logger')(_0x5e78('0x2'));var moment=require(_0x5e78('0x3'));var BPromise=require(_0x5e78('0x4'));var rp=require(_0x5e78('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5e78('0x6'));var attributes=require(_0x5e78('0x7'));module[_0x5e78('0x8')]=function(_0x135552,_0x502114){return _0x135552['define'](_0x5e78('0x9'),attributes,{'tableName':_0x5e78('0xa'),'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 bae9f9c..47755cb 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 _0xd4ec=['UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0xc20f22,_0x49698f){var _0x1535d5=function(_0x5ce3f3){while(--_0x5ce3f3){_0xc20f22['push'](_0xc20f22['shift']());}};_0x1535d5(++_0x49698f);}(_0xd4ec,0x11c));var _0xcd4e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4ec[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcd4e('0x0'));var util=require(_0xcd4e('0x1'));var moment=require(_0xcd4e('0x2'));var BPromise=require(_0xcd4e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcd4e('0x4'));var db=require(_0xcd4e('0x5'))['db'];var utils=require(_0xcd4e('0x6'));var logger=require(_0xcd4e('0x7'))(_0xcd4e('0x8'));var config=require(_0xcd4e('0x9'));var jayson=require(_0xcd4e('0xa'));var client=jayson[_0xcd4e('0xb')][_0xcd4e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c82ee,_0x3f69cf,_0x1dee18){return new BPromise(function(_0x5ad803,_0x1c6751){return client['request'](_0x4c82ee,_0x1dee18)[_0xcd4e('0xd')](function(_0x5e6db2){logger[_0xcd4e('0xe')](_0xcd4e('0xf'),_0x3f69cf,_0xcd4e('0x10'));logger[_0xcd4e('0x11')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x3f69cf,_0xcd4e('0x10'),JSON[_0xcd4e('0x12')](_0x5e6db2));if(_0x5e6db2[_0xcd4e('0x13')]){if(_0x5e6db2[_0xcd4e('0x13')][_0xcd4e('0x14')]===0x1f4){logger[_0xcd4e('0x13')](_0xcd4e('0xf'),_0x3f69cf,_0x5e6db2[_0xcd4e('0x13')][_0xcd4e('0x15')]);return _0x1c6751(_0x5e6db2[_0xcd4e('0x13')][_0xcd4e('0x15')]);}logger[_0xcd4e('0x13')](_0xcd4e('0xf'),_0x3f69cf,_0x5e6db2[_0xcd4e('0x13')][_0xcd4e('0x15')]);return _0x5ad803(_0x5e6db2[_0xcd4e('0x13')][_0xcd4e('0x15')]);}else{logger[_0xcd4e('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x3f69cf,_0xcd4e('0x10'));_0x5ad803(_0x5e6db2[_0xcd4e('0x16')][_0xcd4e('0x15')]);}})['catch'](function(_0x3b6f1a){logger[_0xcd4e('0x13')](_0xcd4e('0xf'),_0x3f69cf,_0x3b6f1a);_0x1c6751(_0x3b6f1a);});});} \ No newline at end of file +var _0xbcc3=['../../config/environment','request','then','info','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x199243,_0x54eb7f){var _0x27b20d=function(_0x4f8601){while(--_0x4f8601){_0x199243['push'](_0x199243['shift']());}};_0x27b20d(++_0x54eb7f);}(_0xbcc3,0x1f1));var _0x3bcc=function(_0x4b1012,_0x1415eb){_0x4b1012=_0x4b1012-0x0;var _0x23d715=_0xbcc3[_0x4b1012];return _0x23d715;};'use strict';var _=require(_0x3bcc('0x0'));var util=require(_0x3bcc('0x1'));var moment=require(_0x3bcc('0x2'));var BPromise=require(_0x3bcc('0x3'));var rs=require(_0x3bcc('0x4'));var fs=require('fs');var Redis=require(_0x3bcc('0x5'));var db=require(_0x3bcc('0x6'))['db'];var utils=require(_0x3bcc('0x7'));var logger=require(_0x3bcc('0x8'))('rpc');var config=require(_0x3bcc('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c5071,_0x284fb2,_0x513537){return new BPromise(function(_0x47ac9f,_0x2e94db){return client[_0x3bcc('0xa')](_0x1c5071,_0x513537)[_0x3bcc('0xb')](function(_0x1a9871){logger[_0x3bcc('0xc')](_0x3bcc('0xd'),_0x284fb2,'request\x20sent');logger[_0x3bcc('0xe')](_0x3bcc('0xf'),_0x284fb2,_0x3bcc('0x10'),JSON['stringify'](_0x1a9871));if(_0x1a9871[_0x3bcc('0x11')]){if(_0x1a9871[_0x3bcc('0x11')][_0x3bcc('0x12')]===0x1f4){logger['error'](_0x3bcc('0xd'),_0x284fb2,_0x1a9871[_0x3bcc('0x11')][_0x3bcc('0x13')]);return _0x2e94db(_0x1a9871[_0x3bcc('0x11')][_0x3bcc('0x13')]);}logger['error'](_0x3bcc('0xd'),_0x284fb2,_0x1a9871[_0x3bcc('0x11')][_0x3bcc('0x13')]);return _0x47ac9f(_0x1a9871[_0x3bcc('0x11')][_0x3bcc('0x13')]);}else{logger[_0x3bcc('0xc')](_0x3bcc('0xd'),_0x284fb2,_0x3bcc('0x10'));_0x47ac9f(_0x1a9871[_0x3bcc('0x14')]['message']);}})[_0x3bcc('0x15')](function(_0x2359bf){logger[_0x3bcc('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x284fb2,_0x2359bf);_0x2e94db(_0x2359bf);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 580a5c3..f876b3e 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 _0x5749=['INTEGER','sequelize'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x5749,0x109));var _0x9574=function(_0x509a3d,_0x2ffd62){_0x509a3d=_0x509a3d-0x0;var _0x7956a0=_0x5749[_0x509a3d];return _0x7956a0;};'use strict';var Sequelize=require(_0x9574('0x0'));module['exports']={'UserId':{'type':Sequelize[_0x9574('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x9574('0x1')]}}; \ No newline at end of file +var _0xd54c=['sequelize','exports','INTEGER'];(function(_0x3c59ee,_0x241561){var _0x2342c2=function(_0x54013e){while(--_0x54013e){_0x3c59ee['push'](_0x3c59ee['shift']());}};_0x2342c2(++_0x241561);}(_0xd54c,0x12f));var _0xcd54=function(_0x27f05e,_0x4cbf19){_0x27f05e=_0x27f05e-0x0;var _0x55d8b4=_0xd54c[_0x27f05e];return _0x55d8b4;};'use strict';var Sequelize=require(_0xcd54('0x0'));module[_0xcd54('0x1')]={'UserId':{'type':Sequelize[_0xcd54('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xcd54('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index bb86fa5..c63b210 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(_0x391852,_0xb68420){var _0x58035a=function(_0x354a60){while(--_0x354a60){_0x391852['push'](_0x391852['shift']());}};_0x58035a(++_0xb68420);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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(_0x28ddfc,_0x4f0369){var _0x5437ba=function(_0x3c234b){while(--_0x3c234b){_0x28ddfc['push'](_0x28ddfc['shift']());}};_0x5437ba(++_0x4f0369);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 e782579..ecbbc09 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x311aad,_0x54d658){var _0x1779bd=function(_0x2520fb){while(--_0x2520fb){_0x311aad['push'](_0x311aad['shift']());}};_0x1779bd(++_0x54d658);}(_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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1be5ac,_0x2f2595){var _0x291659=function(_0x2c5cb2){while(--_0x2c5cb2){_0x1be5ac['push'](_0x1be5ac['shift']());}};_0x291659(++_0x2f2595);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 24c3f0d..3631d5f 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 _0xd2d6=['INTEGER','sequelize','exports'];(function(_0x842533,_0x312233){var _0x362b0c=function(_0x2131f1){while(--_0x2131f1){_0x842533['push'](_0x842533['shift']());}};_0x362b0c(++_0x312233);}(_0xd2d6,0xa3));var _0x6d2d=function(_0x4db079,_0x4a8d32){_0x4db079=_0x4db079-0x0;var _0x2adf36=_0xd2d6[_0x4db079];return _0x2adf36;};'use strict';var Sequelize=require(_0x6d2d('0x0'));module[_0x6d2d('0x1')]={'penalty':{'type':Sequelize[_0x6d2d('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2b0a=['INTEGER','sequelize','exports'];(function(_0x49fd66,_0x250863){var _0x82f6b=function(_0x176371){while(--_0x176371){_0x49fd66['push'](_0x49fd66['shift']());}};_0x82f6b(++_0x250863);}(_0x2b0a,0x73));var _0xa2b0=function(_0x3ad4ab,_0xa78cb7){_0x3ad4ab=_0x3ad4ab-0x0;var _0x2cdd35=_0x2b0a[_0x3ad4ab];return _0x2cdd35;};'use strict';var Sequelize=require(_0xa2b0('0x0'));module[_0xa2b0('0x1')]={'penalty':{'type':Sequelize[_0xa2b0('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 5b6bafd..6a22426 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 _0x2853=['./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x250ed4,_0x9bb8b2){var _0x2c5a32=function(_0x5ec55d){while(--_0x5ec55d){_0x250ed4['push'](_0x250ed4['shift']());}};_0x2c5a32(++_0x9bb8b2);}(_0x2853,0x11d));var _0x3285=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x2853[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x3285('0x0'));var util=require(_0x3285('0x1'));var logger=require(_0x3285('0x2'))(_0x3285('0x3'));var moment=require('moment');var BPromise=require(_0x3285('0x4'));var rp=require(_0x3285('0x5'));var fs=require('fs');var path=require(_0x3285('0x6'));var rimraf=require(_0x3285('0x7'));var config=require(_0x3285('0x8'));var attributes=require(_0x3285('0x9'));module[_0x3285('0xa')]=function(_0x13502d,_0x4b081f){return _0x13502d[_0x3285('0xb')](_0x3285('0xc'),attributes,{'tableName':_0x3285('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x42a0=['./userVoiceQueue.attributes','exports','define','UserVoiceQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x20a137,_0x4d9549){var _0x3dc414=function(_0x21179b){while(--_0x21179b){_0x20a137['push'](_0x20a137['shift']());}};_0x3dc414(++_0x4d9549);}(_0x42a0,0xf4));var _0x042a=function(_0x4ca395,_0x165399){_0x4ca395=_0x4ca395-0x0;var _0x20ca85=_0x42a0[_0x4ca395];return _0x20ca85;};'use strict';var _=require(_0x042a('0x0'));var util=require(_0x042a('0x1'));var logger=require(_0x042a('0x2'))(_0x042a('0x3'));var moment=require(_0x042a('0x4'));var BPromise=require(_0x042a('0x5'));var rp=require(_0x042a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x042a('0x7'));var attributes=require(_0x042a('0x8'));module[_0x042a('0x9')]=function(_0xbe22dc,_0x20c8e4){return _0xbe22dc[_0x042a('0xa')](_0x042a('0xb'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 918ea48..1b5d5ad 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 _0xdf2f=['message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x404cde,_0x27b51c){var _0x139882=function(_0x1f31d1){while(--_0x1f31d1){_0x404cde['push'](_0x404cde['shift']());}};_0x139882(++_0x27b51c);}(_0xdf2f,0x10a));var _0xfdf2=function(_0x1d9540,_0x9707e0){_0x1d9540=_0x1d9540-0x0;var _0x1a9562=_0xdf2f[_0x1d9540];return _0x1a9562;};'use strict';var _=require(_0xfdf2('0x0'));var util=require(_0xfdf2('0x1'));var moment=require(_0xfdf2('0x2'));var BPromise=require('bluebird');var rs=require(_0xfdf2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfdf2('0x4'))['db'];var utils=require(_0xfdf2('0x5'));var logger=require(_0xfdf2('0x6'))(_0xfdf2('0x7'));var config=require(_0xfdf2('0x8'));var jayson=require(_0xfdf2('0x9'));var client=jayson[_0xfdf2('0xa')][_0xfdf2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2df402,_0x48ed88,_0x182812){return new BPromise(function(_0x43d289,_0x1f0600){return client[_0xfdf2('0xc')](_0x2df402,_0x182812)['then'](function(_0x21cde6){logger[_0xfdf2('0xd')](_0xfdf2('0xe'),_0x48ed88,'request\x20sent');logger[_0xfdf2('0xf')](_0xfdf2('0x10'),_0x48ed88,_0xfdf2('0x11'),JSON['stringify'](_0x21cde6));if(_0x21cde6[_0xfdf2('0x12')]){if(_0x21cde6[_0xfdf2('0x12')][_0xfdf2('0x13')]===0x1f4){logger[_0xfdf2('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x48ed88,_0x21cde6[_0xfdf2('0x12')]['message']);return _0x1f0600(_0x21cde6[_0xfdf2('0x12')]['message']);}logger[_0xfdf2('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x48ed88,_0x21cde6[_0xfdf2('0x12')]['message']);return _0x43d289(_0x21cde6['error'][_0xfdf2('0x14')]);}else{logger['info'](_0xfdf2('0xe'),_0x48ed88,_0xfdf2('0x11'));_0x43d289(_0x21cde6[_0xfdf2('0x15')]['message']);}})['catch'](function(_0x133080){logger[_0xfdf2('0x12')](_0xfdf2('0xe'),_0x48ed88,_0x133080);_0x1f0600(_0x133080);});});} \ No newline at end of file +var _0xdc37=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird'];(function(_0x456032,_0x1a799d){var _0x1a53cd=function(_0x162cc8){while(--_0x162cc8){_0x456032['push'](_0x456032['shift']());}};_0x1a53cd(++_0x1a799d);}(_0xdc37,0xc3));var _0x7dc3=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xdc37[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require('lodash');var util=require(_0x7dc3('0x0'));var moment=require(_0x7dc3('0x1'));var BPromise=require(_0x7dc3('0x2'));var rs=require(_0x7dc3('0x3'));var fs=require('fs');var Redis=require(_0x7dc3('0x4'));var db=require(_0x7dc3('0x5'))['db'];var utils=require(_0x7dc3('0x6'));var logger=require(_0x7dc3('0x7'))(_0x7dc3('0x8'));var config=require(_0x7dc3('0x9'));var jayson=require(_0x7dc3('0xa'));var client=jayson[_0x7dc3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x538066,_0x3abf49,_0x55ae2a){return new BPromise(function(_0x9c0715,_0x161250){return client[_0x7dc3('0xc')](_0x538066,_0x55ae2a)[_0x7dc3('0xd')](function(_0xb07d21){logger[_0x7dc3('0xe')](_0x7dc3('0xf'),_0x3abf49,'request\x20sent');logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x3abf49,_0x7dc3('0x10'),JSON['stringify'](_0xb07d21));if(_0xb07d21[_0x7dc3('0x11')]){if(_0xb07d21[_0x7dc3('0x11')][_0x7dc3('0x12')]===0x1f4){logger[_0x7dc3('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x3abf49,_0xb07d21['error'][_0x7dc3('0x13')]);return _0x161250(_0xb07d21[_0x7dc3('0x11')][_0x7dc3('0x13')]);}logger[_0x7dc3('0x11')](_0x7dc3('0xf'),_0x3abf49,_0xb07d21['error'][_0x7dc3('0x13')]);return _0x9c0715(_0xb07d21[_0x7dc3('0x11')][_0x7dc3('0x13')]);}else{logger[_0x7dc3('0xe')](_0x7dc3('0xf'),_0x3abf49,_0x7dc3('0x10'));_0x9c0715(_0xb07d21[_0x7dc3('0x14')][_0x7dc3('0x13')]);}})[_0x7dc3('0x15')](function(_0x35ac5e){logger[_0x7dc3('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x3abf49,_0x35ac5e);_0x161250(_0x35ac5e);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index eaad1e3..39856b8 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x227b67,_0x5c4075){var _0x16f616=function(_0x46e857){while(--_0x46e857){_0x227b67['push'](_0x227b67['shift']());}};_0x16f616(++_0x5c4075);}(_0x9c44,0x178));var _0x49c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9c44[_0x465a0c];return _0x1e202e;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4375a1,_0x33f38c){var _0x58d084=function(_0xe1946e){while(--_0xe1946e){_0x4375a1['push'](_0x4375a1['shift']());}};_0x58d084(++_0x33f38c);}(_0xe706,0xa3));var _0x6e70=function(_0x3eb998,_0x4f5cee){_0x3eb998=_0x3eb998-0x0;var _0x272be1=_0xe706[_0x3eb998];return _0x272be1;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index a718cfa..0e5c8cf 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 _0x02e4=['Required\x20by\x20Asterisk','INTEGER','queue_interface','sequelize','exports','STRING'];(function(_0x537d07,_0x420ce4){var _0x11065f=function(_0x332a48){while(--_0x332a48){_0x537d07['push'](_0x537d07['shift']());}};_0x11065f(++_0x420ce4);}(_0x02e4,0xb1));var _0x402e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x02e4[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x402e('0x0'));module[_0x402e('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x402e('0x2')],'allowNull':![],'comment':_0x402e('0x3')},'UserId':{'type':Sequelize[_0x402e('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x402e('0x5'),'comment':_0x402e('0x3')},'VoiceQueueId':{'type':Sequelize[_0x402e('0x4')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x402e('0x5'),'comment':_0x402e('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x402e('0x3')},'paused':{'type':Sequelize[_0x402e('0x4')](0xb),'defaultValue':0x0,'comment':_0x402e('0x3')}}; \ No newline at end of file +var _0x6e2a=['Required\x20by\x20Asterisk','exports','STRING','INTEGER','queue_interface'];(function(_0x199e8e,_0xbad06b){var _0x587240=function(_0x31462a){while(--_0x31462a){_0x199e8e['push'](_0x199e8e['shift']());}};_0x587240(++_0xbad06b);}(_0x6e2a,0x11e));var _0xa6e2=function(_0x24fe8e,_0x3fa991){_0x24fe8e=_0x24fe8e-0x0;var _0xe063e8=_0x6e2a[_0x24fe8e];return _0xe063e8;};'use strict';var Sequelize=require('sequelize');module[_0xa6e2('0x0')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xa6e2('0x1')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xa6e2('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xa6e2('0x1')],'allowNull':![],'unique':_0xa6e2('0x3'),'comment':_0xa6e2('0x4')},'VoiceQueueId':{'type':Sequelize[_0xa6e2('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xa6e2('0x1')],'allowNull':![],'unique':_0xa6e2('0x3'),'comment':_0xa6e2('0x4')},'penalty':{'type':Sequelize[_0xa6e2('0x2')](0xb),'defaultValue':0x0,'comment':_0xa6e2('0x4')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xa6e2('0x4')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 331ec0e..25f2c6a 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 _0x85fa=['hasOwnProperty','hook','exports','events','UserVoiceQueueRt','setMaxListeners','save','emit'];(function(_0x152e06,_0x256cc3){var _0xd97283=function(_0x224794){while(--_0x224794){_0x152e06['push'](_0x152e06['shift']());}};_0xd97283(++_0x256cc3);}(_0x85fa,0xab));var _0xa85f=function(_0x43131d,_0x2db0c4){_0x43131d=_0x43131d-0x0;var _0x27918b=_0x85fa[_0x43131d];return _0x27918b;};'use strict';var EventEmitter=require(_0xa85f('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xa85f('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xa85f('0x2')](0x0);var events={'afterCreate':_0xa85f('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4f5de5){return function(_0x1e8c00,_0x2682fd,_0x2a1fa1){UserVoiceQueueRtEvents['emit'](_0x4f5de5+':'+_0x1e8c00['id'],_0x1e8c00);UserVoiceQueueRtEvents[_0xa85f('0x4')](_0x4f5de5,_0x1e8c00);_0x2a1fa1(null);};}for(var e in events){if(events[_0xa85f('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0xa85f('0x6')](e,emitEvent(event));}}module[_0xa85f('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x7106=['exports','events','UserVoiceQueueRt','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x1bd58d,_0x2b9cd9){var _0x46403e=function(_0x1dd535){while(--_0x1dd535){_0x1bd58d['push'](_0x1bd58d['shift']());}};_0x46403e(++_0x2b9cd9);}(_0x7106,0x133));var _0x6710=function(_0x39426e,_0x33f2fe){_0x39426e=_0x39426e-0x0;var _0x3b63fe=_0x7106[_0x39426e];return _0x3b63fe;};'use strict';var EventEmitter=require(_0x6710('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x6710('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x6710('0x2')](0x0);var events={'afterCreate':_0x6710('0x3'),'afterUpdate':_0x6710('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2d7884){return function(_0x4b1e46,_0x186deb,_0x59d8dd){UserVoiceQueueRtEvents[_0x6710('0x5')](_0x2d7884+':'+_0x4b1e46['id'],_0x4b1e46);UserVoiceQueueRtEvents[_0x6710('0x5')](_0x2d7884,_0x4b1e46);_0x59d8dd(null);};}for(var e in events){if(events[_0x6710('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x6710('0x7')](e,emitEvent(event));}}module[_0x6710('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index ddd44f3..d4a9667 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 _0x3e4b=['define','UserVoiceQueueRt','user_has_voice_queues_rt','../../config/logger','api','moment','path','rimraf','exports'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x3e4b,0x108));var _0xb3e4=function(_0x3d5888,_0xb25af2){_0x3d5888=_0x3d5888-0x0;var _0x3f9206=_0x3e4b[_0x3d5888];return _0x3f9206;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb3e4('0x0'))(_0xb3e4('0x1'));var moment=require(_0xb3e4('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb3e4('0x3'));var rimraf=require(_0xb3e4('0x4'));var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module[_0xb3e4('0x5')]=function(_0x106ef0,_0x54928e){return _0x106ef0[_0xb3e4('0x6')](_0xb3e4('0x7'),attributes,{'tableName':_0xb3e4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x86d3=['api','moment','request-promise','path','rimraf','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger'];(function(_0x2126ed,_0x352f5e){var _0x2f3bb4=function(_0x14fe60){while(--_0x14fe60){_0x2126ed['push'](_0x2126ed['shift']());}};_0x2f3bb4(++_0x352f5e);}(_0x86d3,0x72));var _0x386d=function(_0x5e8422,_0xb949e2){_0x5e8422=_0x5e8422-0x0;var _0x4144b8=_0x86d3[_0x5e8422];return _0x4144b8;};'use strict';var _=require(_0x386d('0x0'));var util=require(_0x386d('0x1'));var logger=require(_0x386d('0x2'))(_0x386d('0x3'));var moment=require(_0x386d('0x4'));var BPromise=require('bluebird');var rp=require(_0x386d('0x5'));var fs=require('fs');var path=require(_0x386d('0x6'));var rimraf=require(_0x386d('0x7'));var config=require('../../config/environment');var attributes=require(_0x386d('0x8'));module[_0x386d('0x9')]=function(_0x3e1356,_0x2d161d){return _0x3e1356[_0x386d('0xa')](_0x386d('0xb'),attributes,{'tableName':_0x386d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index bd8d96e..e96bcb9 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 _0x1bde=['result','catch','GetVoiceQueueRtPauses','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x4c6494,_0x3f802c){var _0x24f2e3=function(_0x5b3cbd){while(--_0x5b3cbd){_0x4c6494['push'](_0x4c6494['shift']());}};_0x24f2e3(++_0x3f802c);}(_0x1bde,0x10e));var _0xe1bd=function(_0x360ec,_0x585d47){_0x360ec=_0x360ec-0x0;var _0xf03953=_0x1bde[_0x360ec];return _0xf03953;};'use strict';var _=require(_0xe1bd('0x0'));var util=require(_0xe1bd('0x1'));var moment=require(_0xe1bd('0x2'));var BPromise=require(_0xe1bd('0x3'));var rs=require(_0xe1bd('0x4'));var fs=require('fs');var Redis=require(_0xe1bd('0x5'));var db=require(_0xe1bd('0x6'))['db'];var utils=require(_0xe1bd('0x7'));var logger=require(_0xe1bd('0x8'))('rpc');var config=require(_0xe1bd('0x9'));var jayson=require(_0xe1bd('0xa'));var client=jayson['client'][_0xe1bd('0xb')]({'port':0x232a});config[_0xe1bd('0xc')]=_[_0xe1bd('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe1bd('0xe'))(new Redis(config[_0xe1bd('0xc')]));require(_0xe1bd('0xf'))['register'](socket);function respondWithRpcPromise(_0x405edc,_0x256c19,_0x55c721){return new BPromise(function(_0x22a5e5,_0x32dedd){return client[_0xe1bd('0x10')](_0x405edc,_0x55c721)[_0xe1bd('0x11')](function(_0x32941e){logger[_0xe1bd('0x12')](_0xe1bd('0x13'),_0x256c19,_0xe1bd('0x14'));logger[_0xe1bd('0x15')](_0xe1bd('0x16'),_0x256c19,'request\x20sent',JSON[_0xe1bd('0x17')](_0x32941e));if(_0x32941e[_0xe1bd('0x18')]){if(_0x32941e['error']['code']===0x1f4){logger[_0xe1bd('0x18')](_0xe1bd('0x13'),_0x256c19,_0x32941e[_0xe1bd('0x18')][_0xe1bd('0x19')]);return _0x32dedd(_0x32941e['error'][_0xe1bd('0x19')]);}logger[_0xe1bd('0x18')](_0xe1bd('0x13'),_0x256c19,_0x32941e[_0xe1bd('0x18')]['message']);return _0x22a5e5(_0x32941e[_0xe1bd('0x18')][_0xe1bd('0x19')]);}else{logger[_0xe1bd('0x12')](_0xe1bd('0x13'),_0x256c19,_0xe1bd('0x14'));_0x22a5e5(_0x32941e[_0xe1bd('0x1a')][_0xe1bd('0x19')]);}})[_0xe1bd('0x1b')](function(_0x4c8035){logger['error'](_0xe1bd('0x13'),_0x256c19,_0x4c8035);_0x32dedd(_0x4c8035);});});}exports[_0xe1bd('0x1c')]=function(_0x41e1e4){var _0xc8b918=this;return new Promise(function(_0x20bd98,_0x520c6e){return db['UserVoiceQueueRt'][_0xe1bd('0x1d')]({'raw':_0x41e1e4[_0xe1bd('0x1e')]?_0x41e1e4['options'][_0xe1bd('0x1f')]===undefined?!![]:![]:!![],'where':_0x41e1e4[_0xe1bd('0x1e')]?_0x41e1e4[_0xe1bd('0x1e')][_0xe1bd('0x20')]||null:null,'attributes':[[db[_0xe1bd('0x21')]['fn'](_0xe1bd('0x22'),db[_0xe1bd('0x21')]['fn']('IF',db[_0xe1bd('0x21')][_0xe1bd('0x23')](_0xe1bd('0x24')))),'outboundQueuePauses']]})[_0xe1bd('0x11')](function(_0x4861a1){logger[_0xe1bd('0x12')](_0xe1bd('0x1c'),_0x41e1e4);logger[_0xe1bd('0x15')](_0xe1bd('0x1c'),_0x41e1e4,JSON['stringify'](_0x4861a1));_0x20bd98(_0x4861a1);})[_0xe1bd('0x1b')](function(_0x121482){logger[_0xe1bd('0x18')](_0xe1bd('0x1c'),_0x121482[_0xe1bd('0x19')],_0x41e1e4);_0x520c6e(_0xc8b918[_0xe1bd('0x18')](0x1f4,_0x121482[_0xe1bd('0x19')]));});});}; \ No newline at end of file +var _0x6d39=['redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','outboundQueuePauses','util','moment','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x24f071,_0x594916){var _0x227a96=function(_0x21a32c){while(--_0x21a32c){_0x24f071['push'](_0x24f071['shift']());}};_0x227a96(++_0x594916);}(_0x6d39,0x157));var _0x96d3=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x6d39[_0x3d42d8];return _0x27fc41;};'use strict';var _=require('lodash');var util=require(_0x96d3('0x0'));var moment=require(_0x96d3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x96d3('0x2'))(_0x96d3('0x3'));var config=require(_0x96d3('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x96d3('0x5')][_0x96d3('0x6')]({'port':0x232a});config[_0x96d3('0x7')]=_[_0x96d3('0x8')](config[_0x96d3('0x7')],{'host':_0x96d3('0x9'),'port':0x18eb});var socket=require(_0x96d3('0xa'))(new Redis(config[_0x96d3('0x7')]));require(_0x96d3('0xb'))[_0x96d3('0xc')](socket);function respondWithRpcPromise(_0x36dc50,_0x10004e,_0x16a039){return new BPromise(function(_0x45cd41,_0x53f3ff){return client['request'](_0x36dc50,_0x16a039)[_0x96d3('0xd')](function(_0x131ff5){logger[_0x96d3('0xe')](_0x96d3('0xf'),_0x10004e,'request\x20sent');logger[_0x96d3('0x10')](_0x96d3('0x11'),_0x10004e,_0x96d3('0x12'),JSON[_0x96d3('0x13')](_0x131ff5));if(_0x131ff5[_0x96d3('0x14')]){if(_0x131ff5['error'][_0x96d3('0x15')]===0x1f4){logger[_0x96d3('0x14')](_0x96d3('0xf'),_0x10004e,_0x131ff5['error']['message']);return _0x53f3ff(_0x131ff5[_0x96d3('0x14')][_0x96d3('0x16')]);}logger[_0x96d3('0x14')](_0x96d3('0xf'),_0x10004e,_0x131ff5[_0x96d3('0x14')]['message']);return _0x45cd41(_0x131ff5[_0x96d3('0x14')][_0x96d3('0x16')]);}else{logger[_0x96d3('0xe')](_0x96d3('0xf'),_0x10004e,_0x96d3('0x12'));_0x45cd41(_0x131ff5[_0x96d3('0x17')][_0x96d3('0x16')]);}})[_0x96d3('0x18')](function(_0x5797b1){logger[_0x96d3('0x14')](_0x96d3('0xf'),_0x10004e,_0x5797b1);_0x53f3ff(_0x5797b1);});});}exports[_0x96d3('0x19')]=function(_0x27f927){var _0x29bc56=this;return new Promise(function(_0x20257c,_0x2e14be){return db[_0x96d3('0x1a')][_0x96d3('0x1b')]({'raw':_0x27f927[_0x96d3('0x1c')]?_0x27f927[_0x96d3('0x1c')][_0x96d3('0x1d')]===undefined?!![]:![]:!![],'where':_0x27f927[_0x96d3('0x1c')]?_0x27f927[_0x96d3('0x1c')][_0x96d3('0x1e')]||null:null,'attributes':[[db[_0x96d3('0x1f')]['fn'](_0x96d3('0x20'),db[_0x96d3('0x1f')]['fn']('IF',db[_0x96d3('0x1f')][_0x96d3('0x21')]('`paused`\x20=\x201,\x201,\x20null'))),_0x96d3('0x22')]]})[_0x96d3('0xd')](function(_0xfdb9b1){logger[_0x96d3('0xe')](_0x96d3('0x19'),_0x27f927);logger[_0x96d3('0x10')](_0x96d3('0x19'),_0x27f927,JSON[_0x96d3('0x13')](_0xfdb9b1));_0x20257c(_0xfdb9b1);})[_0x96d3('0x18')](function(_0x60fa0d){logger[_0x96d3('0x14')](_0x96d3('0x19'),_0x60fa0d[_0x96d3('0x16')],_0x27f927);_0x2e14be(_0x29bc56[_0x96d3('0x14')](0x1f4,_0x60fa0d[_0x96d3('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 8f7a3e3..83a71d8 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 _0xed1f=['removeListener','register','length','./userVoiceQueueRt.events','save'];(function(_0x11bffb,_0x2c2729){var _0x390a69=function(_0x23cdda){while(--_0x23cdda){_0x11bffb['push'](_0x11bffb['shift']());}};_0x390a69(++_0x2c2729);}(_0xed1f,0x170));var _0xfed1=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xed1f[_0x40a045];return _0x1a687c;};'use strict';var UserVoiceQueueRtEvents=require(_0xfed1('0x0'));var events=[_0xfed1('0x1'),'remove','update'];function createListener(_0x2c9577,_0x5c56c8){return function(_0x36764e){_0x5c56c8['emit'](_0x2c9577,_0x36764e);};}function removeListener(_0x444ba8,_0x423af3){return function(){UserVoiceQueueRtEvents[_0xfed1('0x2')](_0x444ba8,_0x423af3);};}exports[_0xfed1('0x3')]=function(_0x465671){for(var _0x1f2391=0x0,_0x471095=events[_0xfed1('0x4')];_0x1f2391<_0x471095;_0x1f2391++){var _0x4e7fe7=events[_0x1f2391];var _0x37565a=createListener('userVoiceQueueRt:'+_0x4e7fe7,_0x465671);UserVoiceQueueRtEvents['on'](_0x4e7fe7,_0x37565a);}}; \ No newline at end of file +var _0x5419=['update','emit','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x5419,0x175));var _0x9541=function(_0x3405fc,_0x1f3f11){_0x3405fc=_0x3405fc-0x0;var _0x365525=_0x5419[_0x3405fc];return _0x365525;};'use strict';var UserVoiceQueueRtEvents=require(_0x9541('0x0'));var events=[_0x9541('0x1'),_0x9541('0x2'),_0x9541('0x3')];function createListener(_0x44e02b,_0x5b451e){return function(_0x15418a){_0x5b451e[_0x9541('0x4')](_0x44e02b,_0x15418a);};}function removeListener(_0x307a35,_0xacdcfa){return function(){UserVoiceQueueRtEvents['removeListener'](_0x307a35,_0xacdcfa);};}exports[_0x9541('0x5')]=function(_0x1f9139){for(var _0xbdabaf=0x0,_0x3c8491=events[_0x9541('0x6')];_0xbdabaf<_0x3c8491;_0xbdabaf++){var _0x22f42f=events[_0xbdabaf];var _0x306dcb=createListener(_0x9541('0x7')+_0x22f42f,_0x1f9139);UserVoiceQueueRtEvents['on'](_0x22f42f,_0x306dcb);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 929eb39..24f51fd 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x562eea,_0x1f9ea7){var _0x39caf9=function(_0x14f022){while(--_0x14f022){_0x562eea['push'](_0x562eea['shift']());}};_0x39caf9(++_0x1f9ea7);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1d9813,_0x4ca59d){var _0x561d3e=function(_0x1df9cf){while(--_0x1df9cf){_0x1d9813['push'](_0x1d9813['shift']());}};_0x561d3e(++_0x4ca59d);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index a7aca68..0e04762 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 _0xd928=['exports'];(function(_0x500211,_0x1a0367){var _0x48f4e0=function(_0x47a67e){while(--_0x47a67e){_0x500211['push'](_0x500211['shift']());}};_0x48f4e0(++_0x1a0367);}(_0xd928,0x85));var _0x8d92=function(_0x584931,_0x728803){_0x584931=_0x584931-0x0;var _0x73524f=_0xd928[_0x584931];return _0x73524f;};'use strict';var Sequelize=require('sequelize');module[_0x8d92('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x20a9=['exports','INTEGER','sequelize'];(function(_0x4982ce,_0x4b4ded){var _0x18855d=function(_0x1da668){while(--_0x1da668){_0x4982ce['push'](_0x4982ce['shift']());}};_0x18855d(++_0x4b4ded);}(_0x20a9,0x89));var _0x920a=function(_0x5bf2b3,_0xfcd364){_0x5bf2b3=_0x5bf2b3-0x0;var _0x5e8a9b=_0x20a9[_0x5bf2b3];return _0x5e8a9b;};'use strict';var Sequelize=require(_0x920a('0x0'));module[_0x920a('0x1')]={'penalty':{'type':Sequelize[_0x920a('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 54a9dc1..4d81e24 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 _0x0077=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util'];(function(_0x4f340b,_0x20bc7b){var _0x560a58=function(_0x4df030){while(--_0x4df030){_0x4f340b['push'](_0x4f340b['shift']());}};_0x560a58(++_0x20bc7b);}(_0x0077,0x166));var _0x7007=function(_0x4235ee,_0x4eea6d){_0x4235ee=_0x4235ee-0x0;var _0xaae9f2=_0x0077[_0x4235ee];return _0xaae9f2;};'use strict';var _=require(_0x7007('0x0'));var util=require(_0x7007('0x1'));var logger=require(_0x7007('0x2'))(_0x7007('0x3'));var moment=require(_0x7007('0x4'));var BPromise=require(_0x7007('0x5'));var rp=require(_0x7007('0x6'));var fs=require('fs');var path=require(_0x7007('0x7'));var rimraf=require(_0x7007('0x8'));var config=require(_0x7007('0x9'));var attributes=require(_0x7007('0xa'));module[_0x7007('0xb')]=function(_0x4c0789,_0x370a5e){return _0x4c0789[_0x7007('0xc')](_0x7007('0xd'),attributes,{'tableName':_0x7007('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5991=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','lodash'];(function(_0x5eff3e,_0x4321ee){var _0x30e799=function(_0x22b75b){while(--_0x22b75b){_0x5eff3e['push'](_0x5eff3e['shift']());}};_0x30e799(++_0x4321ee);}(_0x5991,0xe9));var _0x1599=function(_0x42c31e,_0x32b700){_0x42c31e=_0x42c31e-0x0;var _0x5bc3c9=_0x5991[_0x42c31e];return _0x5bc3c9;};'use strict';var _=require(_0x1599('0x0'));var util=require('util');var logger=require(_0x1599('0x1'))(_0x1599('0x2'));var moment=require(_0x1599('0x3'));var BPromise=require(_0x1599('0x4'));var rp=require(_0x1599('0x5'));var fs=require('fs');var path=require(_0x1599('0x6'));var rimraf=require(_0x1599('0x7'));var config=require(_0x1599('0x8'));var attributes=require(_0x1599('0x9'));module[_0x1599('0xa')]=function(_0x54ca71,_0x50ed59){return _0x54ca71[_0x1599('0xb')]('UserWhatsappQueue',attributes,{'tableName':_0x1599('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 1c8610e..ba70122 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 _0x9c88=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x9c88,0x1b5));var _0x89c8=function(_0x21d6fa,_0x5e623a){_0x21d6fa=_0x21d6fa-0x0;var _0x405b62=_0x9c88[_0x21d6fa];return _0x405b62;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x89c8('0x0'));var BPromise=require(_0x89c8('0x1'));var rs=require(_0x89c8('0x2'));var fs=require('fs');var Redis=require(_0x89c8('0x3'));var db=require(_0x89c8('0x4'))['db'];var utils=require(_0x89c8('0x5'));var logger=require('../../config/logger')(_0x89c8('0x6'));var config=require('../../config/environment');var jayson=require(_0x89c8('0x7'));var client=jayson[_0x89c8('0x8')][_0x89c8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ce4ba,_0x14ddf6,_0x4ccbde){return new BPromise(function(_0x463a19,_0x3d827c){return client[_0x89c8('0xa')](_0x3ce4ba,_0x4ccbde)[_0x89c8('0xb')](function(_0x276b71){logger[_0x89c8('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x14ddf6,_0x89c8('0xd'));logger[_0x89c8('0xe')](_0x89c8('0xf'),_0x14ddf6,_0x89c8('0xd'),JSON['stringify'](_0x276b71));if(_0x276b71[_0x89c8('0x10')]){if(_0x276b71[_0x89c8('0x10')][_0x89c8('0x11')]===0x1f4){logger[_0x89c8('0x10')](_0x89c8('0x12'),_0x14ddf6,_0x276b71[_0x89c8('0x10')][_0x89c8('0x13')]);return _0x3d827c(_0x276b71['error']['message']);}logger[_0x89c8('0x10')](_0x89c8('0x12'),_0x14ddf6,_0x276b71[_0x89c8('0x10')][_0x89c8('0x13')]);return _0x463a19(_0x276b71[_0x89c8('0x10')][_0x89c8('0x13')]);}else{logger['info'](_0x89c8('0x12'),_0x14ddf6,'request\x20sent');_0x463a19(_0x276b71[_0x89c8('0x14')][_0x89c8('0x13')]);}})[_0x89c8('0x15')](function(_0x536da6){logger[_0x89c8('0x10')](_0x89c8('0x12'),_0x14ddf6,_0x536da6);_0x3d827c(_0x536da6);});});} \ No newline at end of file +var _0x9732=['error','code','UserWhatsappQueue,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1dbf13,_0x301be1){var _0x14f57d=function(_0x33e8ad){while(--_0x33e8ad){_0x1dbf13['push'](_0x1dbf13['shift']());}};_0x14f57d(++_0x301be1);}(_0x9732,0xe7));var _0x2973=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x9732[_0x4b73a2];return _0x383c66;};'use strict';var _=require('lodash');var util=require(_0x2973('0x0'));var moment=require(_0x2973('0x1'));var BPromise=require(_0x2973('0x2'));var rs=require(_0x2973('0x3'));var fs=require('fs');var Redis=require(_0x2973('0x4'));var db=require(_0x2973('0x5'))['db'];var utils=require(_0x2973('0x6'));var logger=require(_0x2973('0x7'))(_0x2973('0x8'));var config=require(_0x2973('0x9'));var jayson=require(_0x2973('0xa'));var client=jayson[_0x2973('0xb')][_0x2973('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4a3c3a,_0xdfc8a4,_0x6c1b3b){return new BPromise(function(_0x2c35d5,_0x1d0efe){return client['request'](_0x4a3c3a,_0x6c1b3b)[_0x2973('0xd')](function(_0x55013a){logger[_0x2973('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0xdfc8a4,_0x2973('0xf'));logger[_0x2973('0x10')](_0x2973('0x11'),_0xdfc8a4,_0x2973('0xf'),JSON[_0x2973('0x12')](_0x55013a));if(_0x55013a[_0x2973('0x13')]){if(_0x55013a[_0x2973('0x13')][_0x2973('0x14')]===0x1f4){logger[_0x2973('0x13')](_0x2973('0x15'),_0xdfc8a4,_0x55013a['error'][_0x2973('0x16')]);return _0x1d0efe(_0x55013a['error'][_0x2973('0x16')]);}logger[_0x2973('0x13')](_0x2973('0x15'),_0xdfc8a4,_0x55013a[_0x2973('0x13')]['message']);return _0x2c35d5(_0x55013a[_0x2973('0x13')][_0x2973('0x16')]);}else{logger['info'](_0x2973('0x15'),_0xdfc8a4,_0x2973('0xf'));_0x2c35d5(_0x55013a[_0x2973('0x17')][_0x2973('0x16')]);}})[_0x2973('0x18')](function(_0x27d806){logger[_0x2973('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0xdfc8a4,_0x27d806);_0x1d0efe(_0x27d806);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 755bdca..e53b2d5 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 _0x8255=['multer','util','path','connect-timeout','express','Router','fs-extra','./variable.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x8255,0x176));var _0x5825=function(_0x111544,_0x1b55ef){_0x111544=_0x111544-0x0;var _0x5d8d1d=_0x8255[_0x111544];return _0x5d8d1d;};'use strict';var multer=require(_0x5825('0x0'));var util=require(_0x5825('0x1'));var path=require(_0x5825('0x2'));var timeout=require(_0x5825('0x3'));var express=require(_0x5825('0x4'));var router=express[_0x5825('0x5')]();var fs_extra=require(_0x5825('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5825('0x7'));router[_0x5825('0x8')]('/',auth[_0x5825('0x9')](),controller[_0x5825('0xa')]);router[_0x5825('0x8')](_0x5825('0xb'),auth[_0x5825('0x9')](),controller['show']);router['post']('/',auth[_0x5825('0x9')](),controller[_0x5825('0xc')]);router[_0x5825('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x5825('0xe')]);router[_0x5825('0xf')]('/:id',auth[_0x5825('0x9')](),controller[_0x5825('0x10')]);module['exports']=router; \ No newline at end of file +var _0x9aee=['create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','/:id','show','post'];(function(_0xcb7901,_0x30cb21){var _0x27918a=function(_0x3fb96f){while(--_0x3fb96f){_0xcb7901['push'](_0xcb7901['shift']());}};_0x27918a(++_0x30cb21);}(_0x9aee,0x71));var _0xe9ae=function(_0x524ef1,_0x1ad9df){_0x524ef1=_0x524ef1-0x0;var _0xed988=_0x9aee[_0x524ef1];return _0xed988;};'use strict';var multer=require(_0xe9ae('0x0'));var util=require(_0xe9ae('0x1'));var path=require(_0xe9ae('0x2'));var timeout=require(_0xe9ae('0x3'));var express=require(_0xe9ae('0x4'));var router=express[_0xe9ae('0x5')]();var fs_extra=require(_0xe9ae('0x6'));var auth=require(_0xe9ae('0x7'));var interaction=require(_0xe9ae('0x8'));var config=require('../../config/environment');var controller=require('./variable.controller');router['get']('/',auth[_0xe9ae('0x9')](),controller['index']);router['get'](_0xe9ae('0xa'),auth['isAuthenticated'](),controller[_0xe9ae('0xb')]);router[_0xe9ae('0xc')]('/',auth['isAuthenticated'](),controller[_0xe9ae('0xd')]);router[_0xe9ae('0xe')](_0xe9ae('0xa'),auth['isAuthenticated'](),controller[_0xe9ae('0xf')]);router[_0xe9ae('0x10')](_0xe9ae('0xa'),auth['isAuthenticated'](),controller[_0xe9ae('0x11')]);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 fcef0b1..456795b 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 _0x3e03=['sequelize','exports'];(function(_0x5566ff,_0xd9a33){var _0x126605=function(_0x3a1b27){while(--_0x3a1b27){_0x5566ff['push'](_0x5566ff['shift']());}};_0x126605(++_0xd9a33);}(_0x3e03,0xc2));var _0x33e0=function(_0x415260,_0x135fcb){_0x415260=_0x415260-0x0;var _0x490f21=_0x3e03[_0x415260];return _0x490f21;};'use strict';var Sequelize=require(_0x33e0('0x0'));module[_0x33e0('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5391=['sequelize','exports','STRING','name'];(function(_0x4ef04f,_0x436de4){var _0x3794f8=function(_0x658684){while(--_0x658684){_0x4ef04f['push'](_0x4ef04f['shift']());}};_0x3794f8(++_0x436de4);}(_0x5391,0x11c));var _0x1539=function(_0x5c7b7,_0x28790b){_0x5c7b7=_0x5c7b7-0x0;var _0x1d52ac=_0x5391[_0x5c7b7];return _0x1d52ac;};'use strict';var Sequelize=require(_0x1539('0x0'));module[_0x1539('0x1')]={'name':{'type':Sequelize[_0x1539('0x2')],'unique':_0x1539('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1539('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index fb65411..b4faf0f 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 _0x6e4b=['keys','length','includeAll','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','apply','save','update','then','destroy','Variables','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','order','sort','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','show','params'];(function(_0x244215,_0x3e69dd){var _0x1cb040=function(_0x2c6bc2){while(--_0x2c6bc2){_0x244215['push'](_0x244215['shift']());}};_0x1cb040(++_0x3e69dd);}(_0x6e4b,0xa5));var _0xb6e4=function(_0x507fdf,_0x129ea7){_0x507fdf=_0x507fdf-0x0;var _0x4cd090=_0x6e4b[_0x507fdf];return _0x4cd090;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb6e4('0x0'));var jsonpatch=require(_0xb6e4('0x1'));var rp=require(_0xb6e4('0x2'));var moment=require(_0xb6e4('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb6e4('0x4'));var path=require('path');var sox=require(_0xb6e4('0x5'));var csv=require(_0xb6e4('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb6e4('0x7'));var _=require(_0xb6e4('0x8'));var squel=require(_0xb6e4('0x9'));var crypto=require(_0xb6e4('0xa'));var jsforce=require(_0xb6e4('0xb'));var deskjs=require(_0xb6e4('0xc'));var toCsv=require(_0xb6e4('0x6'));var querystring=require(_0xb6e4('0xd'));var Papa=require(_0xb6e4('0xe'));var Redis=require(_0xb6e4('0xf'));var authService=require(_0xb6e4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb6e4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb6e4('0x12'))('api');var utils=require(_0xb6e4('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xb6e4('0x14'));var db=require(_0xb6e4('0x15'))['db'];function respondWithStatusCode(_0x5094f3,_0xed2471){_0xed2471=_0xed2471||0xcc;return function(_0x26f258){if(_0x26f258){return _0x5094f3[_0xb6e4('0x16')](_0xed2471);}return _0x5094f3[_0xb6e4('0x17')](_0xed2471)[_0xb6e4('0x18')]();};}function respondWithResult(_0x30533a,_0x3fc45e){_0x3fc45e=_0x3fc45e||0xc8;return function(_0x3af146){if(_0x3af146){return _0x30533a[_0xb6e4('0x17')](_0x3fc45e)[_0xb6e4('0x19')](_0x3af146);}};}function respondWithFilteredResult(_0x288779,_0x53fcf0){return function(_0x269988){if(_0x269988){var _0x4f0ba9=typeof _0x53fcf0['offset']==='undefined'&&typeof _0x53fcf0['limit']===_0xb6e4('0x1a');var _0xe42328=_0x269988[_0xb6e4('0x1b')];var _0x2aed60=_0x4f0ba9?0x0:_0x53fcf0[_0xb6e4('0x1c')];var _0x393a10=_0x4f0ba9?_0x269988[_0xb6e4('0x1b')]:_0x53fcf0[_0xb6e4('0x1c')]+_0x53fcf0[_0xb6e4('0x1d')];var _0x37c5c4;if(_0x393a10>=_0xe42328){_0x393a10=_0xe42328;_0x37c5c4=0xc8;}else{_0x37c5c4=0xce;}_0x288779[_0xb6e4('0x17')](_0x37c5c4);return _0x288779['set']('Content-Range',_0x2aed60+'-'+_0x393a10+'/'+_0xe42328)[_0xb6e4('0x19')](_0x269988);}return null;};}function patchUpdates(_0x5c7b64){return function(_0x2f1e98){try{jsonpatch[_0xb6e4('0x1e')](_0x2f1e98,_0x5c7b64,!![]);}catch(_0x174831){return BPromise['reject'](_0x174831);}return _0x2f1e98[_0xb6e4('0x1f')]();};}function saveUpdates(_0x2dc816,_0x4c04cc){return function(_0x5428e0){if(_0x5428e0){return _0x5428e0[_0xb6e4('0x20')](_0x2dc816)[_0xb6e4('0x21')](function(_0x179cdb){return _0x179cdb;});}return null;};}function removeEntity(_0x237c87,_0x3bea76){return function(_0x5a4e10){if(_0x5a4e10){return _0x5a4e10[_0xb6e4('0x22')]()[_0xb6e4('0x21')](function(){var _0x471a70=_0x5a4e10['get']({'plain':!![]});var _0x1b08d8=_0xb6e4('0x23');return db['UserProfileResource'][_0xb6e4('0x22')]({'where':{'type':_0x1b08d8,'resourceId':_0x471a70['id']}})[_0xb6e4('0x21')](function(){return _0x5a4e10;});})['then'](function(){_0x237c87['status'](0xcc)[_0xb6e4('0x18')]();});}};}function handleEntityNotFound(_0x389f25,_0x4df6a9){return function(_0x3835ef){if(!_0x3835ef){_0x389f25[_0xb6e4('0x16')](0x194);}return _0x3835ef;};}function handleError(_0x3fd1a5,_0x459fe6){_0x459fe6=_0x459fe6||0x1f4;return function(_0x4b51c2){logger[_0xb6e4('0x24')](_0x4b51c2[_0xb6e4('0x25')]);if(_0x4b51c2[_0xb6e4('0x26')]){delete _0x4b51c2['name'];}_0x3fd1a5['status'](_0x459fe6)[_0xb6e4('0x27')](_0x4b51c2);};}exports[_0xb6e4('0x28')]=function(_0x53f3cb,_0x265fac){var _0x538e21={},_0x38448b={},_0xeb755a={'count':0x0,'rows':[]};var _0x1ba62d=_[_0xb6e4('0x29')](db[_0xb6e4('0x2a')][_0xb6e4('0x2b')],function(_0x59a15a){return{'name':_0x59a15a[_0xb6e4('0x2c')],'type':_0x59a15a[_0xb6e4('0x2d')][_0xb6e4('0x2e')]};});_0x38448b[_0xb6e4('0x2f')]=_['map'](_0x1ba62d,_0xb6e4('0x26'));_0x38448b['query']=_['keys'](_0x53f3cb[_0xb6e4('0x30')]);_0x38448b[_0xb6e4('0x31')]=_[_0xb6e4('0x32')](_0x38448b[_0xb6e4('0x2f')],_0x38448b[_0xb6e4('0x30')]);_0x538e21['attributes']=_[_0xb6e4('0x32')](_0x38448b['model'],qs[_0xb6e4('0x33')](_0x53f3cb[_0xb6e4('0x30')]['fields']));_0x538e21[_0xb6e4('0x34')]=_0x538e21[_0xb6e4('0x34')]['length']?_0x538e21[_0xb6e4('0x34')]:_0x38448b[_0xb6e4('0x2f')];if(!_0x53f3cb[_0xb6e4('0x30')]['hasOwnProperty']('nolimit')){_0x538e21[_0xb6e4('0x1d')]=qs['limit'](_0x53f3cb[_0xb6e4('0x30')][_0xb6e4('0x1d')]);_0x538e21[_0xb6e4('0x1c')]=qs[_0xb6e4('0x1c')](_0x53f3cb['query'][_0xb6e4('0x1c')]);}_0x538e21[_0xb6e4('0x35')]=qs['sort'](_0x53f3cb[_0xb6e4('0x30')][_0xb6e4('0x36')]);_0x538e21['where']=qs[_0xb6e4('0x31')](_['pick'](_0x53f3cb['query'],_0x38448b[_0xb6e4('0x31')]),_0x1ba62d);if(_0x53f3cb['query'][_0xb6e4('0x37')]){_0x538e21['where']=_[_0xb6e4('0x38')](_0x538e21[_0xb6e4('0x39')],{'$or':_[_0xb6e4('0x29')](_0x1ba62d,function(_0x1594d5){if(_0x1594d5[_0xb6e4('0x2d')]!==_0xb6e4('0x3a')){var _0x411b20={};_0x411b20[_0x1594d5[_0xb6e4('0x26')]]={'$like':'%'+_0x53f3cb['query'][_0xb6e4('0x37')]+'%'};return _0x411b20;}})});}_0x538e21=_['merge']({},_0x538e21,_0x53f3cb[_0xb6e4('0x3b')]);var _0x317931={'where':_0x538e21['where']};return db['Variable']['count'](_0x317931)['then'](function(_0x2e29b8){_0xeb755a[_0xb6e4('0x1b')]=_0x2e29b8;if(_0x53f3cb['query']['includeAll']){_0x538e21[_0xb6e4('0x3c')]=[{'all':!![]}];}return db['Variable'][_0xb6e4('0x3d')](_0x538e21);})[_0xb6e4('0x21')](function(_0x24c3da){_0xeb755a[_0xb6e4('0x3e')]=_0x24c3da;return _0xeb755a;})[_0xb6e4('0x21')](respondWithFilteredResult(_0x265fac,_0x538e21))[_0xb6e4('0x3f')](handleError(_0x265fac,null));};exports[_0xb6e4('0x40')]=function(_0x430b8f,_0x244647){var _0x28d02e={'raw':!![],'where':{'id':_0x430b8f[_0xb6e4('0x41')]['id']}},_0x2052fc={};_0x2052fc[_0xb6e4('0x2f')]=_[_0xb6e4('0x42')](db[_0xb6e4('0x2a')][_0xb6e4('0x2b')]);_0x2052fc[_0xb6e4('0x30')]=_[_0xb6e4('0x42')](_0x430b8f[_0xb6e4('0x30')]);_0x2052fc[_0xb6e4('0x31')]=_[_0xb6e4('0x32')](_0x2052fc[_0xb6e4('0x2f')],_0x2052fc[_0xb6e4('0x30')]);_0x28d02e[_0xb6e4('0x34')]=_['intersection'](_0x2052fc[_0xb6e4('0x2f')],qs[_0xb6e4('0x33')](_0x430b8f[_0xb6e4('0x30')][_0xb6e4('0x33')]));_0x28d02e[_0xb6e4('0x34')]=_0x28d02e[_0xb6e4('0x34')][_0xb6e4('0x43')]?_0x28d02e[_0xb6e4('0x34')]:_0x2052fc['model'];if(_0x430b8f[_0xb6e4('0x30')][_0xb6e4('0x44')]){_0x28d02e[_0xb6e4('0x3c')]=[{'all':!![]}];}_0x28d02e=_[_0xb6e4('0x38')]({},_0x28d02e,_0x430b8f['options']);return db[_0xb6e4('0x2a')][_0xb6e4('0x45')](_0x28d02e)['then'](handleEntityNotFound(_0x244647,null))['then'](respondWithResult(_0x244647,null))[_0xb6e4('0x3f')](handleError(_0x244647,null));};exports['create']=function(_0x1c66fa,_0x1d1449){return db['Variable']['create'](_0x1c66fa[_0xb6e4('0x46')],{})['then'](function(_0x593a78){var _0x1eb743=_0x1c66fa[_0xb6e4('0x47')][_0xb6e4('0x48')]({'plain':!![]});if(!_0x1eb743)throw new Error(_0xb6e4('0x49'));if(_0x1eb743['role']==='user'){var _0x530435=_0x593a78[_0xb6e4('0x48')]({'plain':!![]});var _0x538009=_0xb6e4('0x23');return db['UserProfileSection'][_0xb6e4('0x45')]({'where':{'name':_0x538009,'userProfileId':_0x1eb743[_0xb6e4('0x4a')]},'raw':!![]})[_0xb6e4('0x21')](function(_0x4172ec){if(_0x4172ec&&_0x4172ec['autoAssociation']===0x0){return db['UserProfileResource'][_0xb6e4('0x4b')]({'name':_0x530435['name'],'resourceId':_0x530435['id'],'type':_0x4172ec[_0xb6e4('0x26')],'sectionId':_0x4172ec['id']},{})[_0xb6e4('0x21')](function(){return _0x593a78;});}else{return _0x593a78;}})['catch'](function(_0x437dba){logger['error'](_0xb6e4('0x4c'),_0x437dba);throw _0x437dba;});}return _0x593a78;})[_0xb6e4('0x21')](respondWithResult(_0x1d1449,0xc9))[_0xb6e4('0x3f')](handleError(_0x1d1449,null));};exports[_0xb6e4('0x20')]=function(_0x45037f,_0x489ddf){if(_0x45037f[_0xb6e4('0x46')]['id']){delete _0x45037f[_0xb6e4('0x46')]['id'];}return db[_0xb6e4('0x2a')][_0xb6e4('0x45')]({'where':{'id':_0x45037f[_0xb6e4('0x41')]['id']}})['then'](handleEntityNotFound(_0x489ddf,null))[_0xb6e4('0x21')](saveUpdates(_0x45037f[_0xb6e4('0x46')],null))[_0xb6e4('0x21')](respondWithResult(_0x489ddf,null))[_0xb6e4('0x3f')](handleError(_0x489ddf,null));};exports[_0xb6e4('0x22')]=function(_0x4e1c81,_0x59f606){return db['Variable'][_0xb6e4('0x45')]({'where':{'id':_0x4e1c81[_0xb6e4('0x41')]['id']}})[_0xb6e4('0x21')](handleEntityNotFound(_0x59f606,null))[_0xb6e4('0x21')](removeEntity(_0x59f606,null))[_0xb6e4('0x3f')](handleError(_0x59f606,null));}; \ No newline at end of file +var _0x0c70=['rimraf','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','end','name','send','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','options','Variable','include','findAll','catch','show','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0c70,0x13b));var _0x00c7=function(_0x560629,_0x1d093c){_0x560629=_0x560629-0x0;var _0x143d59=_0x0c70[_0x560629];return _0x143d59;};'use strict';var emlformat=require(_0x00c7('0x0'));var rimraf=require(_0x00c7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x00c7('0x2'));var rp=require(_0x00c7('0x3'));var moment=require(_0x00c7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x00c7('0x5'));var util=require('util');var path=require('path');var sox=require(_0x00c7('0x6'));var csv=require(_0x00c7('0x7'));var ejs=require(_0x00c7('0x8'));var fs=require('fs');var fs_extra=require(_0x00c7('0x9'));var _=require(_0x00c7('0xa'));var squel=require(_0x00c7('0xb'));var crypto=require(_0x00c7('0xc'));var jsforce=require(_0x00c7('0xd'));var deskjs=require(_0x00c7('0xe'));var toCsv=require(_0x00c7('0x7'));var querystring=require(_0x00c7('0xf'));var Papa=require(_0x00c7('0x10'));var Redis=require(_0x00c7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x00c7('0x12'));var as=require(_0x00c7('0x13'));var hardwareService=require(_0x00c7('0x14'));var logger=require(_0x00c7('0x15'))(_0x00c7('0x16'));var utils=require('../../config/utils');var config=require(_0x00c7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x00c7('0x18'))['db'];function respondWithStatusCode(_0x578f54,_0x382422){_0x382422=_0x382422||0xcc;return function(_0x3b4368){if(_0x3b4368){return _0x578f54[_0x00c7('0x19')](_0x382422);}return _0x578f54[_0x00c7('0x1a')](_0x382422)['end']();};}function respondWithResult(_0x9987cd,_0x23d1bd){_0x23d1bd=_0x23d1bd||0xc8;return function(_0x5f473b){if(_0x5f473b){return _0x9987cd[_0x00c7('0x1a')](_0x23d1bd)['json'](_0x5f473b);}};}function respondWithFilteredResult(_0x136c26,_0xe6a357){return function(_0x1a9bbf){if(_0x1a9bbf){var _0x3c2204=typeof _0xe6a357[_0x00c7('0x1b')]===_0x00c7('0x1c')&&typeof _0xe6a357[_0x00c7('0x1d')]==='undefined';var _0xbd6e73=_0x1a9bbf[_0x00c7('0x1e')];var _0x5091ec=_0x3c2204?0x0:_0xe6a357[_0x00c7('0x1b')];var _0x3b8c61=_0x3c2204?_0x1a9bbf[_0x00c7('0x1e')]:_0xe6a357['offset']+_0xe6a357[_0x00c7('0x1d')];var _0x4443e6;if(_0x3b8c61>=_0xbd6e73){_0x3b8c61=_0xbd6e73;_0x4443e6=0xc8;}else{_0x4443e6=0xce;}_0x136c26[_0x00c7('0x1a')](_0x4443e6);return _0x136c26[_0x00c7('0x1f')](_0x00c7('0x20'),_0x5091ec+'-'+_0x3b8c61+'/'+_0xbd6e73)[_0x00c7('0x21')](_0x1a9bbf);}return null;};}function patchUpdates(_0x54b60d){return function(_0x4e3a23){try{jsonpatch[_0x00c7('0x22')](_0x4e3a23,_0x54b60d,!![]);}catch(_0x59d704){return BPromise[_0x00c7('0x23')](_0x59d704);}return _0x4e3a23[_0x00c7('0x24')]();};}function saveUpdates(_0x48492c,_0x2bd34f){return function(_0x371b29){if(_0x371b29){return _0x371b29[_0x00c7('0x25')](_0x48492c)[_0x00c7('0x26')](function(_0x53d16b){return _0x53d16b;});}return null;};}function removeEntity(_0x4a7458,_0x3ebab5){return function(_0x5e1877){if(_0x5e1877){return _0x5e1877[_0x00c7('0x27')]()['then'](function(){var _0x7373fc=_0x5e1877[_0x00c7('0x28')]({'plain':!![]});var _0x220504='Variables';return db['UserProfileResource'][_0x00c7('0x27')]({'where':{'type':_0x220504,'resourceId':_0x7373fc['id']}})[_0x00c7('0x26')](function(){return _0x5e1877;});})[_0x00c7('0x26')](function(){_0x4a7458['status'](0xcc)[_0x00c7('0x29')]();});}};}function handleEntityNotFound(_0x38bc4b,_0x5e8cdf){return function(_0x212674){if(!_0x212674){_0x38bc4b['sendStatus'](0x194);}return _0x212674;};}function handleError(_0x3faa27,_0x4f8dcd){_0x4f8dcd=_0x4f8dcd||0x1f4;return function(_0x22f8d9){logger['error'](_0x22f8d9['stack']);if(_0x22f8d9[_0x00c7('0x2a')]){delete _0x22f8d9['name'];}_0x3faa27[_0x00c7('0x1a')](_0x4f8dcd)[_0x00c7('0x2b')](_0x22f8d9);};}exports['index']=function(_0xfd705e,_0x2f4d49){var _0x1a91ff={},_0x41a6e3={},_0x323c1c={'count':0x0,'rows':[]};var _0x2a9d04=_['map'](db['Variable'][_0x00c7('0x2c')],function(_0x10b3a4){return{'name':_0x10b3a4['fieldName'],'type':_0x10b3a4[_0x00c7('0x2d')][_0x00c7('0x2e')]};});_0x41a6e3['model']=_[_0x00c7('0x2f')](_0x2a9d04,_0x00c7('0x2a'));_0x41a6e3[_0x00c7('0x30')]=_[_0x00c7('0x31')](_0xfd705e['query']);_0x41a6e3[_0x00c7('0x32')]=_[_0x00c7('0x33')](_0x41a6e3[_0x00c7('0x34')],_0x41a6e3[_0x00c7('0x30')]);_0x1a91ff[_0x00c7('0x35')]=_[_0x00c7('0x33')](_0x41a6e3[_0x00c7('0x34')],qs[_0x00c7('0x36')](_0xfd705e[_0x00c7('0x30')][_0x00c7('0x36')]));_0x1a91ff[_0x00c7('0x35')]=_0x1a91ff[_0x00c7('0x35')][_0x00c7('0x37')]?_0x1a91ff[_0x00c7('0x35')]:_0x41a6e3['model'];if(!_0xfd705e[_0x00c7('0x30')]['hasOwnProperty'](_0x00c7('0x38'))){_0x1a91ff[_0x00c7('0x1d')]=qs['limit'](_0xfd705e['query'][_0x00c7('0x1d')]);_0x1a91ff['offset']=qs[_0x00c7('0x1b')](_0xfd705e[_0x00c7('0x30')][_0x00c7('0x1b')]);}_0x1a91ff[_0x00c7('0x39')]=qs[_0x00c7('0x3a')](_0xfd705e['query']['sort']);_0x1a91ff[_0x00c7('0x3b')]=qs[_0x00c7('0x32')](_['pick'](_0xfd705e[_0x00c7('0x30')],_0x41a6e3[_0x00c7('0x32')]),_0x2a9d04);if(_0xfd705e[_0x00c7('0x30')]['filter']){_0x1a91ff[_0x00c7('0x3b')]=_['merge'](_0x1a91ff[_0x00c7('0x3b')],{'$or':_[_0x00c7('0x2f')](_0x2a9d04,function(_0x33c3d1){if(_0x33c3d1[_0x00c7('0x2d')]!=='VIRTUAL'){var _0x3f83ce={};_0x3f83ce[_0x33c3d1[_0x00c7('0x2a')]]={'$like':'%'+_0xfd705e['query'][_0x00c7('0x3c')]+'%'};return _0x3f83ce;}})});}_0x1a91ff=_[_0x00c7('0x3d')]({},_0x1a91ff,_0xfd705e[_0x00c7('0x3e')]);var _0x227135={'where':_0x1a91ff['where']};return db[_0x00c7('0x3f')]['count'](_0x227135)['then'](function(_0x37f0b7){_0x323c1c[_0x00c7('0x1e')]=_0x37f0b7;if(_0xfd705e[_0x00c7('0x30')]['includeAll']){_0x1a91ff[_0x00c7('0x40')]=[{'all':!![]}];}return db[_0x00c7('0x3f')][_0x00c7('0x41')](_0x1a91ff);})[_0x00c7('0x26')](function(_0x320424){_0x323c1c['rows']=_0x320424;return _0x323c1c;})['then'](respondWithFilteredResult(_0x2f4d49,_0x1a91ff))[_0x00c7('0x42')](handleError(_0x2f4d49,null));};exports[_0x00c7('0x43')]=function(_0x50aeb3,_0x43fb77){var _0x3a7f11={'raw':!![],'where':{'id':_0x50aeb3['params']['id']}},_0x54edac={};_0x54edac[_0x00c7('0x34')]=_[_0x00c7('0x31')](db[_0x00c7('0x3f')][_0x00c7('0x2c')]);_0x54edac['query']=_[_0x00c7('0x31')](_0x50aeb3[_0x00c7('0x30')]);_0x54edac[_0x00c7('0x32')]=_[_0x00c7('0x33')](_0x54edac[_0x00c7('0x34')],_0x54edac[_0x00c7('0x30')]);_0x3a7f11[_0x00c7('0x35')]=_['intersection'](_0x54edac[_0x00c7('0x34')],qs[_0x00c7('0x36')](_0x50aeb3[_0x00c7('0x30')][_0x00c7('0x36')]));_0x3a7f11['attributes']=_0x3a7f11[_0x00c7('0x35')][_0x00c7('0x37')]?_0x3a7f11[_0x00c7('0x35')]:_0x54edac[_0x00c7('0x34')];if(_0x50aeb3[_0x00c7('0x30')][_0x00c7('0x44')]){_0x3a7f11['include']=[{'all':!![]}];}_0x3a7f11=_[_0x00c7('0x3d')]({},_0x3a7f11,_0x50aeb3['options']);return db[_0x00c7('0x3f')]['find'](_0x3a7f11)['then'](handleEntityNotFound(_0x43fb77,null))[_0x00c7('0x26')](respondWithResult(_0x43fb77,null))[_0x00c7('0x42')](handleError(_0x43fb77,null));};exports[_0x00c7('0x45')]=function(_0x4e616d,_0x1eae64){return db[_0x00c7('0x3f')][_0x00c7('0x45')](_0x4e616d[_0x00c7('0x46')],{})[_0x00c7('0x26')](function(_0x484c5f){var _0x1487a5=_0x4e616d['user']['get']({'plain':!![]});if(!_0x1487a5)throw new Error(_0x00c7('0x47'));if(_0x1487a5['role']===_0x00c7('0x48')){var _0x3c85ed=_0x484c5f[_0x00c7('0x28')]({'plain':!![]});var _0x458a09='Variables';return db[_0x00c7('0x49')]['find']({'where':{'name':_0x458a09,'userProfileId':_0x1487a5[_0x00c7('0x4a')]},'raw':!![]})['then'](function(_0x50ac1d){if(_0x50ac1d&&_0x50ac1d[_0x00c7('0x4b')]===0x0){return db[_0x00c7('0x4c')][_0x00c7('0x45')]({'name':_0x3c85ed[_0x00c7('0x2a')],'resourceId':_0x3c85ed['id'],'type':_0x50ac1d[_0x00c7('0x2a')],'sectionId':_0x50ac1d['id']},{})[_0x00c7('0x26')](function(){return _0x484c5f;});}else{return _0x484c5f;}})['catch'](function(_0x303a11){logger['error'](_0x00c7('0x4d'),_0x303a11);throw _0x303a11;});}return _0x484c5f;})[_0x00c7('0x26')](respondWithResult(_0x1eae64,0xc9))['catch'](handleError(_0x1eae64,null));};exports[_0x00c7('0x25')]=function(_0x37c8be,_0x52e9e0){if(_0x37c8be[_0x00c7('0x46')]['id']){delete _0x37c8be[_0x00c7('0x46')]['id'];}return db[_0x00c7('0x3f')]['find']({'where':{'id':_0x37c8be['params']['id']}})[_0x00c7('0x26')](handleEntityNotFound(_0x52e9e0,null))[_0x00c7('0x26')](saveUpdates(_0x37c8be[_0x00c7('0x46')],null))[_0x00c7('0x26')](respondWithResult(_0x52e9e0,null))['catch'](handleError(_0x52e9e0,null));};exports['destroy']=function(_0x1cc909,_0x4c9b09){return db[_0x00c7('0x3f')][_0x00c7('0x4e')]({'where':{'id':_0x1cc909['params']['id']}})[_0x00c7('0x26')](handleEntityNotFound(_0x4c9b09,null))[_0x00c7('0x26')](removeEntity(_0x4c9b09,null))[_0x00c7('0x42')](handleError(_0x4c9b09,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index c558604..c43e8c0 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 _0x6e4a=['request-promise','path','rimraf','../../config/environment','./variable.attributes','define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x6e4a,0x174));var _0xa6e4=function(_0x5712e5,_0x10a956){_0x5712e5=_0x5712e5-0x0;var _0x4c5215=_0x6e4a[_0x5712e5];return _0x4c5215;};'use strict';var _=require(_0xa6e4('0x0'));var util=require(_0xa6e4('0x1'));var logger=require(_0xa6e4('0x2'))(_0xa6e4('0x3'));var moment=require(_0xa6e4('0x4'));var BPromise=require(_0xa6e4('0x5'));var rp=require(_0xa6e4('0x6'));var fs=require('fs');var path=require(_0xa6e4('0x7'));var rimraf=require(_0xa6e4('0x8'));var config=require(_0xa6e4('0x9'));var attributes=require(_0xa6e4('0xa'));module['exports']=function(_0x229a5,_0x2ac5ad){return _0x229a5[_0xa6e4('0xb')](_0xa6e4('0xc'),attributes,{'tableName':_0xa6e4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb856=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define','Variable','tools_variables'];(function(_0x20658b,_0x1ecf9d){var _0x419da6=function(_0x17c373){while(--_0x17c373){_0x20658b['push'](_0x20658b['shift']());}};_0x419da6(++_0x1ecf9d);}(_0xb856,0xfc));var _0x6b85=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb856[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6b85('0x0'));var util=require(_0x6b85('0x1'));var logger=require(_0x6b85('0x2'))(_0x6b85('0x3'));var moment=require('moment');var BPromise=require(_0x6b85('0x4'));var rp=require(_0x6b85('0x5'));var fs=require('fs');var path=require(_0x6b85('0x6'));var rimraf=require(_0x6b85('0x7'));var config=require('../../config/environment');var attributes=require('./variable.attributes');module[_0x6b85('0x8')]=function(_0x3e132d,_0x2ec00a){return _0x3e132d[_0x6b85('0x9')](_0x6b85('0xa'),attributes,{'tableName':_0x6b85('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index c73d904..2451896 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(_0x1e1185,_0x35ca20){var _0x50615d=function(_0x25c6be){while(--_0x25c6be){_0x1e1185['push'](_0x1e1185['shift']());}};_0x50615d(++_0x35ca20);}(_0xe14b,0x93));var _0xbe14=function(_0x5ddd81,_0x37a147){_0x5ddd81=_0x5ddd81-0x0;var _0x3d3fcc=_0xe14b[_0x5ddd81];return _0x3d3fcc;};'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 _0x4b84=['catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','http','then','info','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','Variable,\x20%s,\x20%s','message','ShowVariable','Variable','find','options','raw','where','attributes','include','map','model'];(function(_0xfb3c50,_0x58e878){var _0x17eea7=function(_0x2133bc){while(--_0x2133bc){_0xfb3c50['push'](_0xfb3c50['shift']());}};_0x17eea7(++_0x58e878);}(_0x4b84,0x1cc));var _0x44b8=function(_0x5bf420,_0x2d068d){_0x5bf420=_0x5bf420-0x0;var _0x1c5255=_0x4b84[_0x5bf420];return _0x1c5255;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('Variable,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('Variable,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});}exports[_0x44b8('0x10')]=function(_0x55e258){var _0x36743e=this;return new Promise(function(_0xe3de8f,_0x5103f5){return db[_0x44b8('0x11')][_0x44b8('0x12')]({'raw':_0x55e258['options']?_0x55e258[_0x44b8('0x13')][_0x44b8('0x14')]===undefined?!![]:![]:!![],'where':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x15')]||null:null,'attributes':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x16')]||null:null,'include':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x17')]?_[_0x44b8('0x18')](_0x55e258['options'][_0x44b8('0x17')],function(_0x3a8aa4){return{'model':db[_0x3a8aa4[_0x44b8('0x19')]],'as':_0x3a8aa4['as'],'attributes':_0x3a8aa4[_0x44b8('0x16')],'include':_0x3a8aa4[_0x44b8('0x17')]?_['map'](_0x3a8aa4[_0x44b8('0x17')],function(_0x54677c){return{'model':db[_0x54677c[_0x44b8('0x19')]],'as':_0x54677c['as'],'attributes':_0x54677c[_0x44b8('0x16')],'include':_0x54677c[_0x44b8('0x17')]?_[_0x44b8('0x18')](_0x54677c[_0x44b8('0x17')],function(_0x59acbc){return{'model':db[_0x59acbc[_0x44b8('0x19')]],'as':_0x59acbc['as'],'attributes':_0x59acbc['attributes']};}):[]};}):[]};}):[]:[]})[_0x44b8('0x7')](function(_0x350482){logger['info'](_0x44b8('0x10'),_0x55e258);logger[_0x44b8('0xa')](_0x44b8('0x10'),_0x55e258,JSON['stringify'](_0x350482));_0xe3de8f(_0x350482);})[_0x44b8('0x1a')](function(_0x242342){logger['error'](_0x44b8('0x10'),_0x242342['message'],_0x55e258);_0x5103f5(_0x36743e[_0x44b8('0xd')](0x1f4,_0x242342['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index ac39b2e..8bc6ff9 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 _0x5019=['index','/fetch','isAuthenticated','canUpdate','reset','/restart','restart','/migrations','exports','express','../../components/auth/service','./version.controller','get'];(function(_0x342b66,_0xc35dc2){var _0x3c374a=function(_0x4fcac1){while(--_0x4fcac1){_0x342b66['push'](_0x342b66['shift']());}};_0x3c374a(++_0xc35dc2);}(_0x5019,0x14e));var _0x9501=function(_0x2bc756,_0x5c221e){_0x2bc756=_0x2bc756-0x0;var _0x389436=_0x5019[_0x2bc756];return _0x389436;};'use strict';var express=require(_0x9501('0x0'));var router=express['Router']();var auth=require(_0x9501('0x1'));var controller=require(_0x9501('0x2'));router[_0x9501('0x3')]('/',controller[_0x9501('0x4')]);router[_0x9501('0x3')](_0x9501('0x5'),auth[_0x9501('0x6')](),auth[_0x9501('0x7')](),controller['fetch']);router[_0x9501('0x3')]('/reset',auth[_0x9501('0x6')](),auth['canUpdate'](),controller[_0x9501('0x8')]);router['get']('/pull',auth[_0x9501('0x6')](),auth['canUpdate'](),controller['pull']);router['get'](_0x9501('0x9'),auth[_0x9501('0x6')](),controller[_0x9501('0xa')]);router[_0x9501('0x3')](_0x9501('0xb'),controller['migrations']);module[_0x9501('0xc')]=router; \ No newline at end of file +var _0x9e66=['canUpdate','reset','pull','/restart','/migrations','migrations','exports','express','./version.controller','index','get','isAuthenticated','fetch','/reset'];(function(_0x19dd7a,_0x51de21){var _0x3feb6a=function(_0x4a3c84){while(--_0x4a3c84){_0x19dd7a['push'](_0x19dd7a['shift']());}};_0x3feb6a(++_0x51de21);}(_0x9e66,0x11f));var _0x69e6=function(_0x57d475,_0x48f44c){_0x57d475=_0x57d475-0x0;var _0x5b74e1=_0x9e66[_0x57d475];return _0x5b74e1;};'use strict';var express=require(_0x69e6('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x69e6('0x1'));router['get']('/',controller[_0x69e6('0x2')]);router[_0x69e6('0x3')]('/fetch',auth[_0x69e6('0x4')](),auth['canUpdate'](),controller[_0x69e6('0x5')]);router[_0x69e6('0x3')](_0x69e6('0x6'),auth[_0x69e6('0x4')](),auth[_0x69e6('0x7')](),controller[_0x69e6('0x8')]);router[_0x69e6('0x3')]('/pull',auth[_0x69e6('0x4')](),auth[_0x69e6('0x7')](),controller[_0x69e6('0x9')]);router[_0x69e6('0x3')](_0x69e6('0xa'),auth[_0x69e6('0x4')](),controller['restart']);router[_0x69e6('0x3')](_0x69e6('0xb'),controller[_0x69e6('0xc')]);module[_0x69e6('0xd')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 5505b75..cac28cb 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 _0x94e1=['master','error','git\x20fetch','reset','--hard','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','migrations','readdirSync','join','replace','.js','push','sort','sequelize','Migration','constructor','server','Database\x20migrated\x20successfully\x20from\x20version\x20','last','catch','pkginfo','version','child_process','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','tags','2.0.0','status','json','origin'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x94e1,0x77));var _0x194e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x94e1[_0x321bb2];return _0x9c12ed;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x194e('0x0'))(module,_0x194e('0x1'));var compareVersions=require('compare-versions');var exec=require(_0x194e('0x2'))['exec'];var db=require('../../mysqldb')['db'];var config=require(_0x194e('0x3'));var pm2=require(_0x194e('0x4'));var logger=require(_0x194e('0x5'))(_0x194e('0x6'));var git=require(_0x194e('0x7'))(config[_0x194e('0x8')]);exports[_0x194e('0x9')]=function(_0xb6aedb,_0xa5b9c){var _0x305337={'current':module[_0x194e('0xa')]['version'],'phonebar':0x2};if(_0xb6aedb['query']&&_0xb6aedb[_0x194e('0xb')][_0x194e('0xc')]){return git[_0x194e('0xd')]()[_0x194e('0xe')](function(_0x3787c3,_0x1d84b7){_0x305337['latest']=(_0x3787c3?module[_0x194e('0xa')][_0x194e('0x1')]:_0x1d84b7['latest'])||_0x194e('0xf');return _0xa5b9c['status'](0xc8)['json'](_0x305337);});}else{return _0xa5b9c[_0x194e('0x10')](0xc8)[_0x194e('0x11')](_0x305337);}};exports[_0x194e('0xd')]=function(_0x40f762,_0x1f683a){return git[_0x194e('0xd')]([_0x194e('0x12'),_0x194e('0x13')],function(_0x1bc385){if(_0x1bc385){logger[_0x194e('0x14')](_0x1bc385);return _0x1f683a[_0x194e('0x10')](0x1f4)[_0x194e('0x11')](_0x1bc385);}logger['info'](_0x194e('0x15'));return _0x1f683a[_0x194e('0x10')](0xc8)[_0x194e('0x11')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x194e('0x16')]=function(_0x49b936,_0x40eae9){return git[_0x194e('0x16')]([_0x194e('0x17'),'FETCH_HEAD'],function(_0x31a619){if(_0x31a619){logger['error'](_0x31a619);return _0x40eae9[_0x194e('0x10')](0x1f4)[_0x194e('0x11')](_0x31a619);}logger[_0x194e('0x18')](_0x194e('0x19'));return _0x40eae9['status'](0xc8)[_0x194e('0x11')]({'output':_0x194e('0x1a')});});};exports[_0x194e('0x1b')]=function(_0x49eddc,_0x24bd36){exec('npm\x20install\x20--production',function(_0x28dfb7,_0x2f1d1f,_0x2575fe){logger['info'](_0x2f1d1f);logger[_0x194e('0x18')](_0x2575fe);if(_0x28dfb7){logger[_0x194e('0x14')](_0x28dfb7);return _0x24bd36[_0x194e('0x10')](0x1f4)[_0x194e('0x11')](_0x28dfb7);}return _0x24bd36[_0x194e('0x10')](0xc8)[_0x194e('0x11')]({'output':_0x2f1d1f});});};exports[_0x194e('0x1c')]=function(_0x2912eb,_0x170e49){return pm2[_0x194e('0x1c')](_0x194e('0x1d'))[_0x194e('0x1e')](function(_0x500f8b){logger[_0x194e('0x18')](_0x194e('0x1f'),_0x500f8b);return _0x170e49[_0x194e('0x10')](0xc8)[_0x194e('0x11')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0x1938be){logger['error'](_0x1938be);return _0x170e49['status'](0x1f4)[_0x194e('0x11')](_0x1938be);});};exports[_0x194e('0x20')]=function(_0x2535f9,_0x31b132){var _0x3b5bff=fs[_0x194e('0x21')](path[_0x194e('0x22')](config[_0x194e('0x8')],'server',_0x194e('0x20')));var _0x49e811=[];for(var _0x592b33=0x0;_0x592b33<_0x3b5bff['length'];_0x592b33++){var _0xcf9fb6=_0x3b5bff[_0x592b33][_0x194e('0x23')](_0x194e('0x24'),'');if(compareVersions(module[_0x194e('0xa')][_0x194e('0x1')],_0xcf9fb6)===-0x1){_0x49e811[_0x194e('0x25')](_0xcf9fb6);}}if(_0x49e811['length']){var _0x23129e=_0x49e811[_0x194e('0x26')](compareVersions);var _0x5583d8=new Umzug({'storage':_0x194e('0x27'),'storageOptions':{'model':db[_0x194e('0x28')],'modelName':_0x194e('0x28'),'columnName':'version'},'migrations':{'params':[db[_0x194e('0x27')]['getQueryInterface'](),db[_0x194e('0x27')][_0x194e('0x29')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x194e('0x22')](config[_0x194e('0x8')],_0x194e('0x2a'),'migrations'),'pattern':/\.js$/}});_0x5583d8['up']({'migrations':_['map'](_0x23129e,function(_0x5ae5a0){return _0x5ae5a0+'.js';})})[_0x194e('0x1e')](function(){return _0x31b132[_0x194e('0x10')](0xc8)[_0x194e('0x11')]({'output':_0x194e('0x2b')+module[_0x194e('0xa')][_0x194e('0x1')]+'\x20to\x20'+_[_0x194e('0x2c')](_0x23129e),'migrations':_[_0x194e('0x22')](_0x23129e)});})[_0x194e('0x2d')](function(_0x273f5f){if(_0x273f5f instanceof db['sequelize']['UniqueConstraintError']){return _0x31b132[_0x194e('0x10')](0xc8)[_0x194e('0x11')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x31b132['status'](0x1f4)['json'](_0x273f5f);}});}else{return _0x31b132[_0x194e('0x10')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x17c5=['latest','tags','2.0.0','status','json','fetch','origin','master','error','reset','--hard','info','git\x20reset\x20--hard','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','.js','push','sort','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','root','map','Database\x20migrated\x20successfully\x20from\x20version\x20','exports','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','compare-versions','child_process','exec','../../config/environment','../../config/logger','update','simple-git','index','version','query'];(function(_0x4c1965,_0x32f22b){var _0x548bff=function(_0x3804a2){while(--_0x3804a2){_0x4c1965['push'](_0x4c1965['shift']());}};_0x548bff(++_0x32f22b);}(_0x17c5,0xef));var _0x517c=function(_0x46aa6f,_0xf7b072){_0x46aa6f=_0x46aa6f-0x0;var _0x44759c=_0x17c5[_0x46aa6f];return _0x44759c;};'use strict';var Umzug=require(_0x517c('0x0'));var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0x517c('0x1'));var exec=require(_0x517c('0x2'))[_0x517c('0x3')];var db=require('../../mysqldb')['db'];var config=require(_0x517c('0x4'));var pm2=require('../../config/pm2');var logger=require(_0x517c('0x5'))(_0x517c('0x6'));var git=require(_0x517c('0x7'))(config['root']);exports[_0x517c('0x8')]=function(_0x5977ba,_0x5354fa){var _0x5ee4b0={'current':module['exports'][_0x517c('0x9')],'phonebar':0x2};if(_0x5977ba[_0x517c('0xa')]&&_0x5977ba['query'][_0x517c('0xb')]){return git['fetch']()[_0x517c('0xc')](function(_0x4ed73b,_0x401479){_0x5ee4b0[_0x517c('0xb')]=(_0x4ed73b?module['exports'][_0x517c('0x9')]:_0x401479[_0x517c('0xb')])||_0x517c('0xd');return _0x5354fa[_0x517c('0xe')](0xc8)[_0x517c('0xf')](_0x5ee4b0);});}else{return _0x5354fa[_0x517c('0xe')](0xc8)[_0x517c('0xf')](_0x5ee4b0);}};exports['fetch']=function(_0x23c090,_0x28ba62){return git[_0x517c('0x10')]([_0x517c('0x11'),_0x517c('0x12')],function(_0x401c41){if(_0x401c41){logger[_0x517c('0x13')](_0x401c41);return _0x28ba62[_0x517c('0xe')](0x1f4)[_0x517c('0xf')](_0x401c41);}logger['info']('git\x20fetch');return _0x28ba62[_0x517c('0xe')](0xc8)[_0x517c('0xf')]({'output':'git\x20fetch\x20origin\x20master'});});};exports['reset']=function(_0x6d1a94,_0x21432c){return git[_0x517c('0x14')]([_0x517c('0x15'),'FETCH_HEAD'],function(_0xdee920){if(_0xdee920){logger['error'](_0xdee920);return _0x21432c['status'](0x1f4)[_0x517c('0xf')](_0xdee920);}logger[_0x517c('0x16')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x21432c['status'](0xc8)[_0x517c('0xf')]({'output':_0x517c('0x17')});});};exports['pull']=function(_0x3b244d,_0x3de5d6){exec(_0x517c('0x18'),function(_0x497f2c,_0x19ef2d,_0x2447c1){logger[_0x517c('0x16')](_0x19ef2d);logger[_0x517c('0x16')](_0x2447c1);if(_0x497f2c){logger[_0x517c('0x13')](_0x497f2c);return _0x3de5d6[_0x517c('0xe')](0x1f4)['json'](_0x497f2c);}return _0x3de5d6[_0x517c('0xe')](0xc8)[_0x517c('0xf')]({'output':_0x19ef2d});});};exports['restart']=function(_0x35246e,_0x5a3e1c){return pm2[_0x517c('0x19')]('motion2')[_0x517c('0x1a')](function(_0x58a82d){logger[_0x517c('0x16')](_0x517c('0x1b'),_0x58a82d);return _0x5a3e1c['status'](0xc8)[_0x517c('0xf')]({'output':_0x517c('0x1c')});})[_0x517c('0x1d')](function(_0x259bca){logger[_0x517c('0x13')](_0x259bca);return _0x5a3e1c[_0x517c('0xe')](0x1f4)['json'](_0x259bca);});};exports[_0x517c('0x1e')]=function(_0x4d9530,_0x416818){var _0x391949=fs[_0x517c('0x1f')](path[_0x517c('0x20')](config['root'],_0x517c('0x21'),_0x517c('0x1e')));var _0x2676b5=[];for(var _0x12ee88=0x0;_0x12ee88<_0x391949[_0x517c('0x22')];_0x12ee88++){var _0x217af4=_0x391949[_0x12ee88]['replace'](_0x517c('0x23'),'');if(compareVersions(module['exports'][_0x517c('0x9')],_0x217af4)===-0x1){_0x2676b5[_0x517c('0x24')](_0x217af4);}}if(_0x2676b5['length']){var _0x5bca78=_0x2676b5[_0x517c('0x25')](compareVersions);var _0x1f15b7=new Umzug({'storage':_0x517c('0x26'),'storageOptions':{'model':db[_0x517c('0x27')],'modelName':_0x517c('0x27'),'columnName':_0x517c('0x9')},'migrations':{'params':[db[_0x517c('0x26')][_0x517c('0x28')](),db['sequelize']['constructor'],function(){throw new Error(_0x517c('0x29'));}],'path':path[_0x517c('0x20')](config[_0x517c('0x2a')],_0x517c('0x21'),_0x517c('0x1e')),'pattern':/\.js$/}});_0x1f15b7['up']({'migrations':_[_0x517c('0x2b')](_0x5bca78,function(_0x35ef58){return _0x35ef58+'.js';})})['then'](function(){return _0x416818[_0x517c('0xe')](0xc8)[_0x517c('0xf')]({'output':_0x517c('0x2c')+module[_0x517c('0x2d')]['version']+_0x517c('0x2e')+_[_0x517c('0x2f')](_0x5bca78),'migrations':_[_0x517c('0x20')](_0x5bca78)});})[_0x517c('0x1d')](function(_0x201aca){if(_0x201aca instanceof db[_0x517c('0x26')][_0x517c('0x30')]){return _0x416818[_0x517c('0xe')](0xc8)[_0x517c('0xf')]({'output':_0x517c('0x31')});}else{return _0x416818[_0x517c('0xe')](0x1f4)['json'](_0x201aca);}});}else{return _0x416818[_0x517c('0xe')](0xc8)['json']({'output':_0x517c('0x31')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index e26e6fc..8de0131 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 _0xeb37=['../../components/auth/service','../../config/environment','isAuthenticated','get','/describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xeb37,0x176));var _0x7eb3=function(_0x3d7a4a,_0x39d280){_0x3d7a4a=_0x3d7a4a-0x0;var _0x21e66f=_0xeb37[_0x3d7a4a];return _0x21e66f;};'use strict';var multer=require(_0x7eb3('0x0'));var util=require(_0x7eb3('0x1'));var path=require(_0x7eb3('0x2'));var timeout=require('connect-timeout');var express=require(_0x7eb3('0x3'));var router=express[_0x7eb3('0x4')]();var fs_extra=require(_0x7eb3('0x5'));var auth=require(_0x7eb3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7eb3('0x7'));var controller=require('./voiceAgentReport.controller');router['get']('/',auth[_0x7eb3('0x8')](),controller['index']);router[_0x7eb3('0x9')](_0x7eb3('0xa'),auth[_0x7eb3('0x8')](),controller['describe']);router[_0x7eb3('0x9')]('/:id',auth[_0x7eb3('0x8')](),controller[_0x7eb3('0xb')]);router[_0x7eb3('0xc')]('/',auth['isAuthenticated'](),controller[_0x7eb3('0xd')]);router[_0x7eb3('0xe')](_0x7eb3('0xf'),auth[_0x7eb3('0x8')](),controller[_0x7eb3('0x10')]);router[_0x7eb3('0x11')]('/:id',auth[_0x7eb3('0x8')](),controller[_0x7eb3('0x12')]);module[_0x7eb3('0x13')]=router; \ No newline at end of file +var _0xa1ea=['destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','delete'];(function(_0x5a0927,_0x1de958){var _0x19a3b9=function(_0x51c15f){while(--_0x51c15f){_0x5a0927['push'](_0x5a0927['shift']());}};_0x19a3b9(++_0x1de958);}(_0xa1ea,0x110));var _0xaa1e=function(_0x130dd0,_0x1f18c3){_0x130dd0=_0x130dd0-0x0;var _0x5161f4=_0xa1ea[_0x130dd0];return _0x5161f4;};'use strict';var multer=require(_0xaa1e('0x0'));var util=require(_0xaa1e('0x1'));var path=require('path');var timeout=require(_0xaa1e('0x2'));var express=require('express');var router=express[_0xaa1e('0x3')]();var fs_extra=require(_0xaa1e('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaa1e('0x5'));var controller=require(_0xaa1e('0x6'));router[_0xaa1e('0x7')]('/',auth[_0xaa1e('0x8')](),controller['index']);router['get'](_0xaa1e('0x9'),auth[_0xaa1e('0x8')](),controller[_0xaa1e('0xa')]);router['get'](_0xaa1e('0xb'),auth['isAuthenticated'](),controller[_0xaa1e('0xc')]);router[_0xaa1e('0xd')]('/',auth[_0xaa1e('0x8')](),controller[_0xaa1e('0xe')]);router['put'](_0xaa1e('0xb'),auth[_0xaa1e('0x8')](),controller['update']);router[_0xaa1e('0xf')]('/:id',auth[_0xaa1e('0x8')](),controller[_0xaa1e('0x10')]);module[_0xaa1e('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 0b5e138..918d1c7 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 _0x9c1d=['exports','STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x442013,_0x4cadc1){var _0x1730f5=function(_0x93914e){while(--_0x93914e){_0x442013['push'](_0x442013['shift']());}};_0x1730f5(++_0x4cadc1);}(_0x9c1d,0x1a9));var _0xd9c1=function(_0x19d52e,_0x5c676c){_0x19d52e=_0x19d52e-0x0;var _0x50d4f8=_0x9c1d[_0x19d52e];return _0x50d4f8;};'use strict';var Sequelize=require(_0xd9c1('0x0'));module[_0xd9c1('0x1')]={'type':{'type':Sequelize[_0xd9c1('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd9c1('0x2')]},'calleridname':{'type':Sequelize[_0xd9c1('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xd9c1('0x2')]},'membername':{'type':Sequelize[_0xd9c1('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xd9c1('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xd9c1('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xd9c1('0x3')]},'agentdumpAt':{'type':Sequelize[_0xd9c1('0x3')]},'holdtime':{'type':Sequelize[_0xd9c1('0x4')]},'agentcomplete':{'type':Sequelize[_0xd9c1('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xd9c1('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xd9c1('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd9c1('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd9c1('0x4')]},'reason':{'type':Sequelize[_0xd9c1('0x2')]},'lastevent':{'type':Sequelize[_0xd9c1('0x2')]},'channel':{'type':Sequelize[_0xd9c1('0x2')]},'channelstate':{'type':Sequelize[_0xd9c1('0x4')]},'channelstatedesc':{'type':Sequelize[_0xd9c1('0x2')]},'connectedlinenum':{'type':Sequelize[_0xd9c1('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd9c1('0x2')]},'accountcode':{'type':Sequelize[_0xd9c1('0x2')]},'context':{'type':Sequelize[_0xd9c1('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd9c1('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xd9c1('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xd9c1('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd9c1('0x2')]},'destcalleridname':{'type':Sequelize[_0xd9c1('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd9c1('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd9c1('0x2')]},'destlanguage':{'type':Sequelize[_0xd9c1('0x2')]},'destaccountcode':{'type':Sequelize[_0xd9c1('0x2')]},'destcontext':{'type':Sequelize[_0xd9c1('0x2')]},'destexten':{'type':Sequelize[_0xd9c1('0x2')]},'destpriority':{'type':Sequelize[_0xd9c1('0x2')]},'destuniqueid':{'type':Sequelize[_0xd9c1('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd9c1('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xd9c1('0x2')]},'transfer':{'type':Sequelize[_0xd9c1('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xd9c1('0x2')]},'transferuniqueid':{'type':Sequelize[_0xd9c1('0x2')]},'agententerreason':{'type':Sequelize[_0xd9c1('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xefda=['sequelize','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x38fc54,_0xf044cb){var _0x2102f0=function(_0x44dd34){while(--_0x44dd34){_0x38fc54['push'](_0x38fc54['shift']());}};_0x2102f0(++_0xf044cb);}(_0xefda,0x96));var _0xaefd=function(_0xbecf37,_0x36ddb7){_0xbecf37=_0xbecf37-0x0;var _0x3dcc05=_0xefda[_0xbecf37];return _0x3dcc05;};'use strict';var Sequelize=require(_0xaefd('0x0'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xaefd('0x1')]},'calleridnum':{'type':Sequelize[_0xaefd('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xaefd('0x1')]},'interface':{'type':Sequelize[_0xaefd('0x1')]},'membername':{'type':Sequelize[_0xaefd('0x1')]},'agentcalledAt':{'type':Sequelize[_0xaefd('0x2')]},'agentconnectAt':{'type':Sequelize[_0xaefd('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xaefd('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0xaefd('0x2')]},'holdtime':{'type':Sequelize[_0xaefd('0x3')]},'agentcomplete':{'type':Sequelize[_0xaefd('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xaefd('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xaefd('0x3')]},'agentacw':{'type':Sequelize[_0xaefd('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xaefd('0x3')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xaefd('0x3')]},'channelstatedesc':{'type':Sequelize[_0xaefd('0x1')]},'connectedlinenum':{'type':Sequelize[_0xaefd('0x1')]},'connectedlinename':{'type':Sequelize[_0xaefd('0x1')]},'language':{'type':Sequelize[_0xaefd('0x1')]},'accountcode':{'type':Sequelize[_0xaefd('0x1')]},'context':{'type':Sequelize[_0xaefd('0x1')]},'exten':{'type':Sequelize[_0xaefd('0x1')]},'priority':{'type':Sequelize[_0xaefd('0x1')]},'destchannel':{'type':Sequelize[_0xaefd('0x1')]},'destchannelstate':{'type':Sequelize[_0xaefd('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xaefd('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xaefd('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xaefd('0x1')]},'destlanguage':{'type':Sequelize[_0xaefd('0x1')]},'destaccountcode':{'type':Sequelize[_0xaefd('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xaefd('0x1')]},'destpriority':{'type':Sequelize[_0xaefd('0x1')]},'destuniqueid':{'type':Sequelize[_0xaefd('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xaefd('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xaefd('0x1')]},'transfer':{'type':Sequelize[_0xaefd('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xaefd('0x1')],'comment':_0xaefd('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xaefd('0x1')]},'agententerreason':{'type':Sequelize[_0xaefd('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 5d28f39..0b61320 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(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 71f9726..0bf397b 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 _0x9ab0=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash'];(function(_0x18dc89,_0x1020bb){var _0x467f42=function(_0xacb90c){while(--_0xacb90c){_0x18dc89['push'](_0x18dc89['shift']());}};_0x467f42(++_0x1020bb);}(_0x9ab0,0x195));var _0x09ab=function(_0x35f24f,_0x3bf4b4){_0x35f24f=_0x35f24f-0x0;var _0x44b103=_0x9ab0[_0x35f24f];return _0x44b103;};'use strict';var _=require(_0x09ab('0x0'));var util=require(_0x09ab('0x1'));var logger=require(_0x09ab('0x2'))(_0x09ab('0x3'));var moment=require(_0x09ab('0x4'));var BPromise=require(_0x09ab('0x5'));var rp=require(_0x09ab('0x6'));var fs=require('fs');var path=require(_0x09ab('0x7'));var rimraf=require(_0x09ab('0x8'));var config=require('../../config/environment');var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x3144ec,_0x387ac8){return _0x3144ec[_0x09ab('0x9')](_0x09ab('0xa'),attributes,{'tableName':_0x09ab('0xb'),'paranoid':![],'indexes':[{'fields':[_0x09ab('0xc'),_0x09ab('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0763=['path','rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x5ddedf,_0x14c256){var _0x2af0d3=function(_0x50b79d){while(--_0x50b79d){_0x5ddedf['push'](_0x5ddedf['shift']());}};_0x2af0d3(++_0x14c256);}(_0x0763,0x87));var _0x3076=function(_0x496738,_0x3f1a9f){_0x496738=_0x496738-0x0;var _0xee1381=_0x0763[_0x496738];return _0xee1381;};'use strict';var _=require(_0x3076('0x0'));var util=require('util');var logger=require(_0x3076('0x1'))(_0x3076('0x2'));var moment=require('moment');var BPromise=require(_0x3076('0x3'));var rp=require(_0x3076('0x4'));var fs=require('fs');var path=require(_0x3076('0x5'));var rimraf=require(_0x3076('0x6'));var config=require('../../config/environment');var attributes=require(_0x3076('0x7'));module[_0x3076('0x8')]=function(_0x1ce2ff,_0x1b5f4e){return _0x1ce2ff[_0x3076('0x9')](_0x3076('0xa'),attributes,{'tableName':_0x3076('0xb'),'paranoid':![],'indexes':[{'fields':[_0x3076('0xc'),_0x3076('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 1c61ca6..75c693e 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 _0x3cd2=['../../config/logger','rpc','../../config/environment','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','then','debug','UpdateVoiceAgentReport','update','where','attributes','limit','util','bluebird','randomstring','ioredis'];(function(_0x2270a5,_0x1de292){var _0x2ab31b=function(_0x37b3ad){while(--_0x37b3ad){_0x2270a5['push'](_0x2270a5['shift']());}};_0x2ab31b(++_0x1de292);}(_0x3cd2,0x188));var _0x23cd=function(_0x134227,_0x375809){_0x134227=_0x134227-0x0;var _0x42775a=_0x3cd2[_0x134227];return _0x42775a;};'use strict';var _=require('lodash');var util=require(_0x23cd('0x0'));var moment=require('moment');var BPromise=require(_0x23cd('0x1'));var rs=require(_0x23cd('0x2'));var fs=require('fs');var Redis=require(_0x23cd('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x23cd('0x4'))(_0x23cd('0x5'));var config=require(_0x23cd('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x23cd('0x7')][_0x23cd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f0a6e,_0x351e98,_0x34a0fb){return new BPromise(function(_0x588517,_0x5160e6){return client[_0x23cd('0x9')](_0x2f0a6e,_0x34a0fb)['then'](function(_0x16c378){logger[_0x23cd('0xa')](_0x23cd('0xb'),_0x351e98,_0x23cd('0xc'));logger['debug'](_0x23cd('0xd'),_0x351e98,_0x23cd('0xc'),JSON[_0x23cd('0xe')](_0x16c378));if(_0x16c378[_0x23cd('0xf')]){if(_0x16c378[_0x23cd('0xf')][_0x23cd('0x10')]===0x1f4){logger[_0x23cd('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x351e98,_0x16c378[_0x23cd('0xf')][_0x23cd('0x11')]);return _0x5160e6(_0x16c378[_0x23cd('0xf')][_0x23cd('0x11')]);}logger[_0x23cd('0xf')](_0x23cd('0xb'),_0x351e98,_0x16c378[_0x23cd('0xf')][_0x23cd('0x11')]);return _0x588517(_0x16c378['error']['message']);}else{logger[_0x23cd('0xa')](_0x23cd('0xb'),_0x351e98,_0x23cd('0xc'));_0x588517(_0x16c378[_0x23cd('0x12')][_0x23cd('0x11')]);}})[_0x23cd('0x13')](function(_0x4a4b76){logger[_0x23cd('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x351e98,_0x4a4b76);_0x5160e6(_0x4a4b76);});});}exports[_0x23cd('0x14')]=function(_0x1720c2){var _0x588c27=this;return new Promise(function(_0x58615d,_0xf93e83){return db[_0x23cd('0x15')][_0x23cd('0x16')](_0x1720c2[_0x23cd('0x17')],{'raw':_0x1720c2[_0x23cd('0x18')]?_0x1720c2[_0x23cd('0x18')][_0x23cd('0x19')]===undefined?!![]:![]:!![]})[_0x23cd('0x1a')](function(_0x213b84){logger[_0x23cd('0xa')]('CreateVoiceAgentReport',_0x1720c2);logger[_0x23cd('0x1b')](_0x23cd('0x14'),_0x1720c2,JSON[_0x23cd('0xe')](_0x213b84));_0x58615d(_0x213b84);})[_0x23cd('0x13')](function(_0x4c3bc9){logger[_0x23cd('0xf')](_0x23cd('0x14'),_0x4c3bc9[_0x23cd('0x11')],_0x1720c2);_0xf93e83(_0x588c27['error'](0x1f4,_0x4c3bc9[_0x23cd('0x11')]));});});};exports[_0x23cd('0x1c')]=function(_0x2bcd52){var _0x202a9c=this;return new Promise(function(_0x4a9430,_0x300eaa){return db['VoiceAgentReport'][_0x23cd('0x1d')](_0x2bcd52[_0x23cd('0x17')],{'raw':_0x2bcd52[_0x23cd('0x18')]?_0x2bcd52[_0x23cd('0x18')][_0x23cd('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bcd52['options']?_0x2bcd52['options'][_0x23cd('0x1e')]||null:null,'attributes':_0x2bcd52[_0x23cd('0x18')]?_0x2bcd52['options'][_0x23cd('0x1f')]||null:null,'limit':_0x2bcd52[_0x23cd('0x18')]?_0x2bcd52['options'][_0x23cd('0x20')]||null:null})[_0x23cd('0x1a')](function(_0x35c670){logger['info'](_0x23cd('0x1c'),_0x2bcd52);logger[_0x23cd('0x1b')](_0x23cd('0x1c'),_0x2bcd52,JSON[_0x23cd('0xe')](_0x35c670));_0x4a9430(_0x35c670);})[_0x23cd('0x13')](function(_0x5ea2f6){logger[_0x23cd('0xf')](_0x23cd('0x1c'),_0x5ea2f6[_0x23cd('0x11')],_0x2bcd52);_0x300eaa(_0x202a9c[_0x23cd('0xf')](0x1f4,_0x5ea2f6[_0x23cd('0x11')]));});});}; \ No newline at end of file +var _0xd859=['stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','body','where','UpdateVoiceAgentReport','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2833d2,_0x17c3d8){var _0x43fb18=function(_0x501264){while(--_0x501264){_0x2833d2['push'](_0x2833d2['shift']());}};_0x43fb18(++_0x17c3d8);}(_0xd859,0x1ce));var _0x9d85=function(_0x1b0452,_0x3c69a5){_0x1b0452=_0x1b0452-0x0;var _0x140bb1=_0xd859[_0x1b0452];return _0x140bb1;};'use strict';var _=require(_0x9d85('0x0'));var util=require(_0x9d85('0x1'));var moment=require(_0x9d85('0x2'));var BPromise=require('bluebird');var rs=require(_0x9d85('0x3'));var fs=require('fs');var Redis=require(_0x9d85('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9d85('0x5'));var logger=require(_0x9d85('0x6'))(_0x9d85('0x7'));var config=require(_0x9d85('0x8'));var jayson=require(_0x9d85('0x9'));var client=jayson[_0x9d85('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ded14,_0x1b0b08,_0xb1d2d5){return new BPromise(function(_0x316b30,_0x2c860a){return client[_0x9d85('0xb')](_0x4ded14,_0xb1d2d5)[_0x9d85('0xc')](function(_0x4cb23c){logger[_0x9d85('0xd')](_0x9d85('0xe'),_0x1b0b08,'request\x20sent');logger[_0x9d85('0xf')](_0x9d85('0x10'),_0x1b0b08,_0x9d85('0x11'),JSON[_0x9d85('0x12')](_0x4cb23c));if(_0x4cb23c[_0x9d85('0x13')]){if(_0x4cb23c[_0x9d85('0x13')][_0x9d85('0x14')]===0x1f4){logger[_0x9d85('0x13')](_0x9d85('0xe'),_0x1b0b08,_0x4cb23c[_0x9d85('0x13')][_0x9d85('0x15')]);return _0x2c860a(_0x4cb23c[_0x9d85('0x13')][_0x9d85('0x15')]);}logger[_0x9d85('0x13')](_0x9d85('0xe'),_0x1b0b08,_0x4cb23c[_0x9d85('0x13')][_0x9d85('0x15')]);return _0x316b30(_0x4cb23c[_0x9d85('0x13')][_0x9d85('0x15')]);}else{logger['info'](_0x9d85('0xe'),_0x1b0b08,_0x9d85('0x11'));_0x316b30(_0x4cb23c[_0x9d85('0x16')][_0x9d85('0x15')]);}})[_0x9d85('0x17')](function(_0x33cdca){logger[_0x9d85('0x13')](_0x9d85('0xe'),_0x1b0b08,_0x33cdca);_0x2c860a(_0x33cdca);});});}exports[_0x9d85('0x18')]=function(_0x42a988){var _0x222c3b=this;return new Promise(function(_0x47701c,_0x4315d6){return db[_0x9d85('0x19')][_0x9d85('0x1a')](_0x42a988['body'],{'raw':_0x42a988[_0x9d85('0x1b')]?_0x42a988['options'][_0x9d85('0x1c')]===undefined?!![]:![]:!![]})[_0x9d85('0xc')](function(_0x35efba){logger[_0x9d85('0xd')](_0x9d85('0x18'),_0x42a988);logger[_0x9d85('0xf')](_0x9d85('0x18'),_0x42a988,JSON[_0x9d85('0x12')](_0x35efba));_0x47701c(_0x35efba);})[_0x9d85('0x17')](function(_0x124009){logger[_0x9d85('0x13')]('CreateVoiceAgentReport',_0x124009['message'],_0x42a988);_0x4315d6(_0x222c3b['error'](0x1f4,_0x124009['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x2cbc9f){var _0x55437d=this;return new Promise(function(_0x1b6dc3,_0x56ac6f){return db[_0x9d85('0x19')]['update'](_0x2cbc9f[_0x9d85('0x1d')],{'raw':_0x2cbc9f[_0x9d85('0x1b')]?_0x2cbc9f[_0x9d85('0x1b')][_0x9d85('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2cbc9f[_0x9d85('0x1b')]?_0x2cbc9f['options'][_0x9d85('0x1e')]||null:null,'attributes':_0x2cbc9f[_0x9d85('0x1b')]?_0x2cbc9f[_0x9d85('0x1b')]['attributes']||null:null,'limit':_0x2cbc9f[_0x9d85('0x1b')]?_0x2cbc9f['options']['limit']||null:null})['then'](function(_0x5aceb6){logger[_0x9d85('0xd')](_0x9d85('0x1f'),_0x2cbc9f);logger['debug'](_0x9d85('0x1f'),_0x2cbc9f,JSON[_0x9d85('0x12')](_0x5aceb6));_0x1b6dc3(_0x5aceb6);})[_0x9d85('0x17')](function(_0x330fec){logger[_0x9d85('0x13')](_0x9d85('0x1f'),_0x330fec[_0x9d85('0x15')],_0x2cbc9f);_0x56ac6f(_0x55437d[_0x9d85('0x13')](0x1f4,_0x330fec[_0x9d85('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index c41c93d..daba1d7 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 _0xb138=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','index','/describe','describe','/:id','create','put','delete','destroy','exports','multer','util','path'];(function(_0x554e24,_0x4ef8f6){var _0x25b475=function(_0x4e7798){while(--_0x4e7798){_0x554e24['push'](_0x554e24['shift']());}};_0x25b475(++_0x4ef8f6);}(_0xb138,0x1dd));var _0x8b13=function(_0x579d58,_0x1517da){_0x579d58=_0x579d58-0x0;var _0x155d36=_0xb138[_0x579d58];return _0x155d36;};'use strict';var multer=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var path=require(_0x8b13('0x2'));var timeout=require(_0x8b13('0x3'));var express=require(_0x8b13('0x4'));var router=express[_0x8b13('0x5')]();var fs_extra=require(_0x8b13('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var controller=require(_0x8b13('0x9'));router['get']('/',auth[_0x8b13('0xa')](),controller[_0x8b13('0xb')]);router['get'](_0x8b13('0xc'),auth[_0x8b13('0xa')](),controller[_0x8b13('0xd')]);router['get'](_0x8b13('0xe'),auth[_0x8b13('0xa')](),controller['show']);router['post']('/',auth[_0x8b13('0xa')](),controller[_0x8b13('0xf')]);router[_0x8b13('0x10')](_0x8b13('0xe'),auth[_0x8b13('0xa')](),controller['update']);router[_0x8b13('0x11')](_0x8b13('0xe'),auth[_0x8b13('0xa')](),controller[_0x8b13('0x12')]);module[_0x8b13('0x13')]=router; \ No newline at end of file +var _0x5fd1=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','multer'];(function(_0x3489ae,_0x1c3961){var _0x39f9ef=function(_0x22a0e0){while(--_0x22a0e0){_0x3489ae['push'](_0x3489ae['shift']());}};_0x39f9ef(++_0x1c3961);}(_0x5fd1,0x155));var _0x15fd=function(_0x3c1246,_0x38da2a){_0x3c1246=_0x3c1246-0x0;var _0x16c27b=_0x5fd1[_0x3c1246];return _0x16c27b;};'use strict';var multer=require(_0x15fd('0x0'));var util=require('util');var path=require(_0x15fd('0x1'));var timeout=require(_0x15fd('0x2'));var express=require(_0x15fd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x15fd('0x4'));var interaction=require(_0x15fd('0x5'));var config=require(_0x15fd('0x6'));var controller=require('./voiceCallReport.controller');router[_0x15fd('0x7')]('/',auth[_0x15fd('0x8')](),controller[_0x15fd('0x9')]);router[_0x15fd('0x7')](_0x15fd('0xa'),auth['isAuthenticated'](),controller[_0x15fd('0xb')]);router[_0x15fd('0x7')](_0x15fd('0xc'),auth['isAuthenticated'](),controller[_0x15fd('0xd')]);router['post']('/',auth[_0x15fd('0x8')](),controller[_0x15fd('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x15fd('0xf')]);router[_0x15fd('0x10')](_0x15fd('0xc'),auth[_0x15fd('0x8')](),controller[_0x15fd('0x11')]);module[_0x15fd('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 5a6fa3b..51afcf3 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 _0x9f7b=['exports','STRING','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x9f7b,0x15e));var _0xb9f7=function(_0xe4bc78,_0x549371){_0xe4bc78=_0xe4bc78-0x0;var _0x11fb77=_0x9f7b[_0xe4bc78];return _0x11fb77;};'use strict';var Sequelize=require(_0xb9f7('0x0'));module[_0xb9f7('0x1')]={'uniqueid':{'type':Sequelize[_0xb9f7('0x2')]},'type':{'type':Sequelize[_0xb9f7('0x3')](_0xb9f7('0x4'),_0xb9f7('0x5'),_0xb9f7('0x6'),_0xb9f7('0x7'),_0xb9f7('0x8'),_0xb9f7('0x9'))},'tag':{'type':Sequelize[_0xb9f7('0x2')]},'accountcode':{'type':Sequelize[_0xb9f7('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xb9f7('0x2')]},'destinationcontext':{'type':Sequelize[_0xb9f7('0x2')]},'callerid':{'type':Sequelize[_0xb9f7('0x2')]},'channel':{'type':Sequelize[_0xb9f7('0x2')]},'destinationchannel':{'type':Sequelize[_0xb9f7('0x2')]},'lastapplication':{'type':Sequelize[_0xb9f7('0x2')]},'lastdata':{'type':Sequelize[_0xb9f7('0xa')]},'starttime':{'type':Sequelize[_0xb9f7('0xb')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xb9f7('0xb')]},'endtime':{'type':Sequelize[_0xb9f7('0xb')]},'duration':{'type':Sequelize[_0xb9f7('0xc')]},'billableseconds':{'type':Sequelize[_0xb9f7('0xc')]},'mohtime':{'type':Sequelize[_0xb9f7('0xc')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xb9f7('0x2')]},'amaflags':{'type':Sequelize[_0xb9f7('0x2')]},'userfield':{'type':Sequelize[_0xb9f7('0x2')]},'userDisposition':{'type':Sequelize[_0xb9f7('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xb9f7('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xb9f7('0x2')]},'routeid':{'type':Sequelize[_0xb9f7('0xc')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x46c2=['ENUM','inbound','internal','outbound','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x54e69a,_0x461b02){var _0x379c24=function(_0x259c82){while(--_0x259c82){_0x54e69a['push'](_0x54e69a['shift']());}};_0x379c24(++_0x461b02);}(_0x46c2,0x180));var _0x246c=function(_0x46f7a7,_0x3a2566){_0x46f7a7=_0x46f7a7-0x0;var _0x55f8e6=_0x46c2[_0x46f7a7];return _0x55f8e6;};'use strict';var Sequelize=require(_0x246c('0x0'));module[_0x246c('0x1')]={'uniqueid':{'type':Sequelize[_0x246c('0x2')]},'type':{'type':Sequelize[_0x246c('0x3')](_0x246c('0x4'),_0x246c('0x5'),_0x246c('0x6'),'inbound-fax','outbound-fax','dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x246c('0x2')]},'destination':{'type':Sequelize[_0x246c('0x2')]},'destinationcontext':{'type':Sequelize[_0x246c('0x2')]},'callerid':{'type':Sequelize[_0x246c('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x246c('0x2')]},'lastapplication':{'type':Sequelize[_0x246c('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x246c('0x7')]},'systemanswertime':{'type':Sequelize[_0x246c('0x7')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x246c('0x2')]},'userfield':{'type':Sequelize[_0x246c('0x2')]},'userDisposition':{'type':Sequelize[_0x246c('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x246c('0x2')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x246c('0x2')]},'routeid':{'type':Sequelize[_0x246c('0x8')]},'sipcallid':{'type':Sequelize[_0x246c('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 745ec5c..6e3c3b3 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 _0x5f66=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'attributes':['id',_0x65f6('0x23'),_0x65f6('0x3c'),_0x65f6('0x3d')],'model':db[_0x65f6('0x3e')],'as':_0x65f6('0x3e')}];}return db[_0x65f6('0x27')]['findAll'](_0x4ac04b);})[_0x65f6('0x21')](function(_0x400ed2){_0x266cfe[_0x65f6('0x3f')]=_0x400ed2;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))[_0x65f6('0x40')](handleError(_0x559330,null));};exports[_0x65f6('0x41')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x42')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x2abbed[_0x65f6('0x2c')]=_['keys'](_0xe0b72d[_0x65f6('0x2c')]);_0x2abbed[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],_0x2abbed['query']);_0x461393[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],qs['fields'](_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x2f')]));_0x461393[_0x65f6('0x30')]=_0x461393[_0x65f6('0x30')]['length']?_0x461393[_0x65f6('0x30')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x37')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x27')][_0x65f6('0x43')](_0x461393)[_0x65f6('0x21')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x21')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x40')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x44')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x27')][_0x65f6('0x44')](_0x4d30c5[_0x65f6('0x45')],{})[_0x65f6('0x21')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x40')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x20')]=function(_0x149c28,_0x41690c){return db[_0x65f6('0x27')]['find']({'where':{'id':_0x149c28[_0x65f6('0x42')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x21')](removeEntity(_0x41690c,null))['catch'](handleError(_0x41690c,null));};exports[_0x65f6('0x46')]=function(_0x42d453,_0x49ba5a){return db[_0x65f6('0x27')][_0x65f6('0x46')]()['then'](respondWithResult(_0x49ba5a,null))[_0x65f6('0x40')](handleError(_0x49ba5a,null));};exports['update']=function(_0x247be3,_0x3b241f){if(_0x247be3[_0x65f6('0x45')]['uniqueid']){delete _0x247be3[_0x65f6('0x45')][_0x65f6('0x47')];}return db['VoiceCallReport'][_0x65f6('0x43')]({'where':{'uniqueid':_0x247be3[_0x65f6('0x42')]['id'],'UserId':{'$or':[null,_0x247be3['user']['id']]}}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b241f,null))[_0x65f6('0x21')](saveUpdates(_0x247be3[_0x65f6('0x45')],null))[_0x65f6('0x21')](respondWithResult(_0x3b241f,null))[_0x65f6('0x40')](handleError(_0x3b241f,null));}; \ No newline at end of file +var _0x5f66=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'attributes':['id',_0x65f6('0x23'),_0x65f6('0x3c'),_0x65f6('0x3d')],'model':db[_0x65f6('0x3e')],'as':_0x65f6('0x3e')}];}return db[_0x65f6('0x27')]['findAll'](_0x4ac04b);})[_0x65f6('0x21')](function(_0x400ed2){_0x266cfe[_0x65f6('0x3f')]=_0x400ed2;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))[_0x65f6('0x40')](handleError(_0x559330,null));};exports[_0x65f6('0x41')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x42')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x2abbed[_0x65f6('0x2c')]=_['keys'](_0xe0b72d[_0x65f6('0x2c')]);_0x2abbed[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],_0x2abbed['query']);_0x461393[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],qs['fields'](_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x2f')]));_0x461393[_0x65f6('0x30')]=_0x461393[_0x65f6('0x30')]['length']?_0x461393[_0x65f6('0x30')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x37')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x27')][_0x65f6('0x43')](_0x461393)[_0x65f6('0x21')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x21')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x40')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x44')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x27')][_0x65f6('0x44')](_0x4d30c5[_0x65f6('0x45')],{})[_0x65f6('0x21')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x40')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x20')]=function(_0x149c28,_0x41690c){return db[_0x65f6('0x27')]['find']({'where':{'id':_0x149c28[_0x65f6('0x42')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x21')](removeEntity(_0x41690c,null))['catch'](handleError(_0x41690c,null));};exports[_0x65f6('0x46')]=function(_0x42d453,_0x49ba5a){return db[_0x65f6('0x27')][_0x65f6('0x46')]()['then'](respondWithResult(_0x49ba5a,null))[_0x65f6('0x40')](handleError(_0x49ba5a,null));};exports['update']=function(_0x247be3,_0x3b241f){if(_0x247be3[_0x65f6('0x45')]['uniqueid']){delete _0x247be3[_0x65f6('0x45')][_0x65f6('0x47')];}return db['VoiceCallReport'][_0x65f6('0x43')]({'where':{'uniqueid':_0x247be3[_0x65f6('0x42')]['id'],'UserId':{'$or':[null,_0x247be3['user']['id']]}}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b241f,null))[_0x65f6('0x21')](saveUpdates(_0x247be3[_0x65f6('0x45')],null))[_0x65f6('0x21')](respondWithResult(_0x3b241f,null))[_0x65f6('0x40')](handleError(_0x3b241f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index c8176bf..44e0605 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 _0x5a1f=['define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','request-promise','path','rimraf','exports'];(function(_0xe11825,_0x153aba){var _0x3268b9=function(_0x3be661){while(--_0x3be661){_0xe11825['push'](_0xe11825['shift']());}};_0x3268b9(++_0x153aba);}(_0x5a1f,0x19c));var _0xf5a1=function(_0x1e97c5,_0x4012d0){_0x1e97c5=_0x1e97c5-0x0;var _0x165bac=_0x5a1f[_0x1e97c5];return _0x165bac;};'use strict';var _=require(_0xf5a1('0x0'));var util=require(_0xf5a1('0x1'));var logger=require(_0xf5a1('0x2'))(_0xf5a1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf5a1('0x4'));var fs=require('fs');var path=require(_0xf5a1('0x5'));var rimraf=require(_0xf5a1('0x6'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0xf5a1('0x7')]=function(_0x23af9e,_0x2f9f73){return _0x23af9e[_0xf5a1('0x8')](_0xf5a1('0x9'),attributes,{'tableName':_0xf5a1('0xa'),'paranoid':![],'indexes':[{'fields':[_0xf5a1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x95b2=['api','moment','bluebird','request-promise','path','rimraf','./voiceCallReport.attributes','define','VoiceCallReport','lodash','util','../../config/logger'];(function(_0x43f88d,_0x54d8ce){var _0x1aae21=function(_0xa2d024){while(--_0xa2d024){_0x43f88d['push'](_0x43f88d['shift']());}};_0x1aae21(++_0x54d8ce);}(_0x95b2,0x8d));var _0x295b=function(_0x113f02,_0x17546c){_0x113f02=_0x113f02-0x0;var _0x22007c=_0x95b2[_0x113f02];return _0x22007c;};'use strict';var _=require(_0x295b('0x0'));var util=require(_0x295b('0x1'));var logger=require(_0x295b('0x2'))(_0x295b('0x3'));var moment=require(_0x295b('0x4'));var BPromise=require(_0x295b('0x5'));var rp=require(_0x295b('0x6'));var fs=require('fs');var path=require(_0x295b('0x7'));var rimraf=require(_0x295b('0x8'));var config=require('../../config/environment');var attributes=require(_0x295b('0x9'));module['exports']=function(_0x4ad15f,_0x1e2214){return _0x4ad15f[_0x295b('0xa')](_0x295b('0xb'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index e59efba..b1d7563 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 _0x3923=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','CreateVoiceCallReport','create','UpdateVoiceCallReport','update'];(function(_0x555e79,_0x9ee00e){var _0x36cb67=function(_0x207ec7){while(--_0x207ec7){_0x555e79['push'](_0x555e79['shift']());}};_0x36cb67(++_0x9ee00e);}(_0x3923,0x1e0));var _0x3392=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3923[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3392('0x0'));var util=require(_0x3392('0x1'));var moment=require(_0x3392('0x2'));var BPromise=require(_0x3392('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3392('0x4'));var db=require(_0x3392('0x5'))['db'];var utils=require(_0x3392('0x6'));var logger=require(_0x3392('0x7'))(_0x3392('0x8'));var config=require('../../config/environment');var jayson=require(_0x3392('0x9'));var client=jayson[_0x3392('0xa')][_0x3392('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25e80a,_0x50744e,_0x5d2f23){return new BPromise(function(_0x8044fb,_0x3fc57e){return client[_0x3392('0xc')](_0x25e80a,_0x5d2f23)[_0x3392('0xd')](function(_0x10c33d){logger['info'](_0x3392('0xe'),_0x50744e,_0x3392('0xf'));logger[_0x3392('0x10')](_0x3392('0x11'),_0x50744e,_0x3392('0xf'),JSON[_0x3392('0x12')](_0x10c33d));if(_0x10c33d[_0x3392('0x13')]){if(_0x10c33d['error'][_0x3392('0x14')]===0x1f4){logger['error'](_0x3392('0xe'),_0x50744e,_0x10c33d[_0x3392('0x13')][_0x3392('0x15')]);return _0x3fc57e(_0x10c33d[_0x3392('0x13')]['message']);}logger[_0x3392('0x13')](_0x3392('0xe'),_0x50744e,_0x10c33d[_0x3392('0x13')][_0x3392('0x15')]);return _0x8044fb(_0x10c33d['error']['message']);}else{logger[_0x3392('0x16')](_0x3392('0xe'),_0x50744e,_0x3392('0xf'));_0x8044fb(_0x10c33d[_0x3392('0x17')][_0x3392('0x15')]);}})[_0x3392('0x18')](function(_0xa009de){logger[_0x3392('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x50744e,_0xa009de);_0x3fc57e(_0xa009de);});});}exports[_0x3392('0x19')]=function(_0xf240a9){var _0x6286d6=this;return new Promise(function(_0x42ab7f,_0x26be5b){return db[_0x3392('0x1a')][_0x3392('0x1b')]({'raw':_0xf240a9[_0x3392('0x1c')]?_0xf240a9[_0x3392('0x1c')][_0x3392('0x1d')]===undefined?!![]:![]:!![],'where':_0xf240a9[_0x3392('0x1c')]?_0xf240a9[_0x3392('0x1c')][_0x3392('0x1e')]||null:null,'attributes':_0xf240a9['options']?_0xf240a9[_0x3392('0x1c')][_0x3392('0x1f')]||null:null,'limit':_0xf240a9[_0x3392('0x1c')]?_0xf240a9['options'][_0x3392('0x20')]||null:null,'include':_0xf240a9[_0x3392('0x1c')]?_0xf240a9[_0x3392('0x1c')][_0x3392('0x21')]?_[_0x3392('0x22')](_0xf240a9[_0x3392('0x1c')]['include'],function(_0x460a7d){return{'model':db[_0x460a7d[_0x3392('0x23')]],'as':_0x460a7d['as'],'attributes':_0x460a7d['attributes'],'include':_0x460a7d[_0x3392('0x21')]?_[_0x3392('0x22')](_0x460a7d[_0x3392('0x21')],function(_0x2a8aca){return{'model':db[_0x2a8aca['model']],'as':_0x2a8aca['as'],'attributes':_0x2a8aca[_0x3392('0x1f')],'include':_0x2a8aca[_0x3392('0x21')]?_[_0x3392('0x22')](_0x2a8aca[_0x3392('0x21')],function(_0x4543e1){return{'model':db[_0x4543e1['model']],'as':_0x4543e1['as'],'attributes':_0x4543e1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c8bbc){logger['info'](_0x3392('0x19'),_0xf240a9);logger[_0x3392('0x10')](_0x3392('0x19'),_0xf240a9,JSON[_0x3392('0x12')](_0x5c8bbc));_0x42ab7f(_0x5c8bbc);})['catch'](function(_0x1d7b30){logger[_0x3392('0x13')](_0x3392('0x19'),_0x1d7b30['message'],_0xf240a9);_0x26be5b(_0x6286d6[_0x3392('0x13')](0x1f4,_0x1d7b30[_0x3392('0x15')]));});});};exports[_0x3392('0x24')]=function(_0x1f4037){var _0x1e32a4=this;return new Promise(function(_0x574658,_0xba09cd){return db[_0x3392('0x1a')][_0x3392('0x25')](_0x1f4037['body'],{'raw':_0x1f4037[_0x3392('0x1c')]?_0x1f4037[_0x3392('0x1c')][_0x3392('0x1d')]===undefined?!![]:![]:!![]})[_0x3392('0xd')](function(_0x1f4f66){logger[_0x3392('0x16')](_0x3392('0x24'),_0x1f4037);logger['debug'](_0x3392('0x24'),_0x1f4037,JSON[_0x3392('0x12')](_0x1f4f66));_0x574658(_0x1f4f66);})['catch'](function(_0x2d9f49){logger[_0x3392('0x13')](_0x3392('0x24'),_0x2d9f49[_0x3392('0x15')],_0x1f4037);_0xba09cd(_0x1e32a4[_0x3392('0x13')](0x1f4,_0x2d9f49[_0x3392('0x15')]));});});};exports[_0x3392('0x26')]=function(_0x96421f){var _0x59aa6a=this;return new Promise(function(_0x411361,_0x11388c){return db[_0x3392('0x1a')][_0x3392('0x27')](_0x96421f['body'],{'raw':_0x96421f['options']?_0x96421f[_0x3392('0x1c')][_0x3392('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x96421f[_0x3392('0x1c')]?_0x96421f[_0x3392('0x1c')][_0x3392('0x1e')]||null:null,'attributes':_0x96421f[_0x3392('0x1c')]?_0x96421f[_0x3392('0x1c')][_0x3392('0x1f')]||null:null,'limit':_0x96421f['options']?_0x96421f[_0x3392('0x1c')]['limit']||null:null})['then'](function(_0xe07056){logger[_0x3392('0x16')](_0x3392('0x26'),_0x96421f);logger[_0x3392('0x10')]('UpdateVoiceCallReport',_0x96421f,JSON['stringify'](_0xe07056));_0x411361(_0xe07056);})[_0x3392('0x18')](function(_0x2609d0){logger[_0x3392('0x13')](_0x3392('0x26'),_0x2609d0['message'],_0x96421f);_0x11388c(_0x59aa6a['error'](0x1f4,_0x2609d0['message']));});});}; \ No newline at end of file +var _0xb9c1=['moment','bluebird','ioredis','rpc','client','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','findAll','options','raw','where','attributes','include','map','model','GetVoiceCallReport','CreateVoiceCallReport','VoiceCallReport','body','UpdateVoiceCallReport','update'];(function(_0x8eac8f,_0x4354ea){var _0x386a07=function(_0x3cfe13){while(--_0x3cfe13){_0x8eac8f['push'](_0x8eac8f['shift']());}};_0x386a07(++_0x4354ea);}(_0xb9c1,0x96));var _0x1b9c=function(_0x36c8f6,_0x467d39){_0x36c8f6=_0x36c8f6-0x0;var _0x1ba8ed=_0xb9c1[_0x36c8f6];return _0x1ba8ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1b9c('0x0'));var BPromise=require(_0x1b9c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b9c('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1b9c('0x3'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1b9c('0x4')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3fd398,_0x5c5a91,_0x196b81){return new BPromise(function(_0x3043ec,_0xb18df1){return client['request'](_0x3fd398,_0x196b81)[_0x1b9c('0x5')](function(_0x4a6e98){logger[_0x1b9c('0x6')](_0x1b9c('0x7'),_0x5c5a91,'request\x20sent');logger[_0x1b9c('0x8')](_0x1b9c('0x9'),_0x5c5a91,_0x1b9c('0xa'),JSON[_0x1b9c('0xb')](_0x4a6e98));if(_0x4a6e98[_0x1b9c('0xc')]){if(_0x4a6e98[_0x1b9c('0xc')][_0x1b9c('0xd')]===0x1f4){logger[_0x1b9c('0xc')](_0x1b9c('0x7'),_0x5c5a91,_0x4a6e98[_0x1b9c('0xc')][_0x1b9c('0xe')]);return _0xb18df1(_0x4a6e98['error'][_0x1b9c('0xe')]);}logger[_0x1b9c('0xc')](_0x1b9c('0x7'),_0x5c5a91,_0x4a6e98[_0x1b9c('0xc')][_0x1b9c('0xe')]);return _0x3043ec(_0x4a6e98[_0x1b9c('0xc')][_0x1b9c('0xe')]);}else{logger[_0x1b9c('0x6')](_0x1b9c('0x7'),_0x5c5a91,'request\x20sent');_0x3043ec(_0x4a6e98['result'][_0x1b9c('0xe')]);}})[_0x1b9c('0xf')](function(_0x2f8ca7){logger[_0x1b9c('0xc')](_0x1b9c('0x7'),_0x5c5a91,_0x2f8ca7);_0xb18df1(_0x2f8ca7);});});}exports['GetVoiceCallReport']=function(_0x23b6d9){var _0x30d915=this;return new Promise(function(_0x3a84df,_0xf63af4){return db['VoiceCallReport'][_0x1b9c('0x10')]({'raw':_0x23b6d9[_0x1b9c('0x11')]?_0x23b6d9[_0x1b9c('0x11')][_0x1b9c('0x12')]===undefined?!![]:![]:!![],'where':_0x23b6d9['options']?_0x23b6d9[_0x1b9c('0x11')][_0x1b9c('0x13')]||null:null,'attributes':_0x23b6d9[_0x1b9c('0x11')]?_0x23b6d9[_0x1b9c('0x11')][_0x1b9c('0x14')]||null:null,'limit':_0x23b6d9[_0x1b9c('0x11')]?_0x23b6d9[_0x1b9c('0x11')]['limit']||null:null,'include':_0x23b6d9['options']?_0x23b6d9[_0x1b9c('0x11')][_0x1b9c('0x15')]?_[_0x1b9c('0x16')](_0x23b6d9[_0x1b9c('0x11')][_0x1b9c('0x15')],function(_0x5049f5){return{'model':db[_0x5049f5[_0x1b9c('0x17')]],'as':_0x5049f5['as'],'attributes':_0x5049f5['attributes'],'include':_0x5049f5[_0x1b9c('0x15')]?_[_0x1b9c('0x16')](_0x5049f5['include'],function(_0x3a02ec){return{'model':db[_0x3a02ec[_0x1b9c('0x17')]],'as':_0x3a02ec['as'],'attributes':_0x3a02ec[_0x1b9c('0x14')],'include':_0x3a02ec[_0x1b9c('0x15')]?_[_0x1b9c('0x16')](_0x3a02ec[_0x1b9c('0x15')],function(_0x11553e){return{'model':db[_0x11553e[_0x1b9c('0x17')]],'as':_0x11553e['as'],'attributes':_0x11553e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x58d5b5){logger[_0x1b9c('0x6')](_0x1b9c('0x18'),_0x23b6d9);logger[_0x1b9c('0x8')](_0x1b9c('0x18'),_0x23b6d9,JSON[_0x1b9c('0xb')](_0x58d5b5));_0x3a84df(_0x58d5b5);})[_0x1b9c('0xf')](function(_0x303c5b){logger[_0x1b9c('0xc')]('GetVoiceCallReport',_0x303c5b['message'],_0x23b6d9);_0xf63af4(_0x30d915[_0x1b9c('0xc')](0x1f4,_0x303c5b['message']));});});};exports[_0x1b9c('0x19')]=function(_0x28b7e4){var _0x27d996=this;return new Promise(function(_0x6ebb44,_0x223713){return db[_0x1b9c('0x1a')]['create'](_0x28b7e4[_0x1b9c('0x1b')],{'raw':_0x28b7e4[_0x1b9c('0x11')]?_0x28b7e4['options'][_0x1b9c('0x12')]===undefined?!![]:![]:!![]})[_0x1b9c('0x5')](function(_0x53cbb8){logger['info'](_0x1b9c('0x19'),_0x28b7e4);logger[_0x1b9c('0x8')]('CreateVoiceCallReport',_0x28b7e4,JSON[_0x1b9c('0xb')](_0x53cbb8));_0x6ebb44(_0x53cbb8);})[_0x1b9c('0xf')](function(_0x55416b){logger[_0x1b9c('0xc')]('CreateVoiceCallReport',_0x55416b[_0x1b9c('0xe')],_0x28b7e4);_0x223713(_0x27d996[_0x1b9c('0xc')](0x1f4,_0x55416b[_0x1b9c('0xe')]));});});};exports[_0x1b9c('0x1c')]=function(_0x32e3b7){var _0x560a81=this;return new Promise(function(_0xf430a2,_0x42d331){return db[_0x1b9c('0x1a')][_0x1b9c('0x1d')](_0x32e3b7[_0x1b9c('0x1b')],{'raw':_0x32e3b7[_0x1b9c('0x11')]?_0x32e3b7[_0x1b9c('0x11')][_0x1b9c('0x12')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32e3b7[_0x1b9c('0x11')]?_0x32e3b7['options'][_0x1b9c('0x13')]||null:null,'attributes':_0x32e3b7[_0x1b9c('0x11')]?_0x32e3b7[_0x1b9c('0x11')][_0x1b9c('0x14')]||null:null,'limit':_0x32e3b7[_0x1b9c('0x11')]?_0x32e3b7[_0x1b9c('0x11')]['limit']||null:null})[_0x1b9c('0x5')](function(_0x483fea){logger['info'](_0x1b9c('0x1c'),_0x32e3b7);logger[_0x1b9c('0x8')](_0x1b9c('0x1c'),_0x32e3b7,JSON[_0x1b9c('0xb')](_0x483fea));_0xf430a2(_0x483fea);})['catch'](function(_0x1ca0a0){logger[_0x1b9c('0xc')](_0x1b9c('0x1c'),_0x1ca0a0[_0x1b9c('0xe')],_0x32e3b7);_0x42d331(_0x560a81[_0x1b9c('0xc')](0x1f4,_0x1ca0a0[_0x1b9c('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index ca96508..119d8b5 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 _0xd2c2=['../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x10e9cc,_0x81a27f){var _0x68de49=function(_0x16fe44){while(--_0x16fe44){_0x10e9cc['push'](_0x10e9cc['shift']());}};_0x68de49(++_0x81a27f);}(_0xd2c2,0xcb));var _0x2d2c=function(_0x5a840a,_0x33a052){_0x5a840a=_0x5a840a-0x0;var _0x167525=_0xd2c2[_0x5a840a];return _0x167525;};'use strict';var multer=require(_0x2d2c('0x0'));var util=require('util');var path=require(_0x2d2c('0x1'));var timeout=require(_0x2d2c('0x2'));var express=require(_0x2d2c('0x3'));var router=express['Router']();var fs_extra=require(_0x2d2c('0x4'));var auth=require(_0x2d2c('0x5'));var interaction=require(_0x2d2c('0x6'));var config=require(_0x2d2c('0x7'));var controller=require(_0x2d2c('0x8'));router['get']('/',auth[_0x2d2c('0x9')](),controller['index']);router['get'](_0x2d2c('0xa'),auth[_0x2d2c('0x9')](),controller[_0x2d2c('0xb')]);router[_0x2d2c('0xc')]('/',auth[_0x2d2c('0x9')](),controller[_0x2d2c('0xd')]);router[_0x2d2c('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x2d2c('0xf')]);router[_0x2d2c('0x10')](_0x2d2c('0xa'),auth[_0x2d2c('0x9')](),controller[_0x2d2c('0x11')]);module[_0x2d2c('0x12')]=router; \ No newline at end of file +var _0x5b08=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0xb34bd4,_0x1aafd2){var _0x1b99c2=function(_0x3e70ac){while(--_0x3e70ac){_0xb34bd4['push'](_0xb34bd4['shift']());}};_0x1b99c2(++_0x1aafd2);}(_0x5b08,0x13d));var _0x85b0=function(_0x2ff51e,_0x327cdf){_0x2ff51e=_0x2ff51e-0x0;var _0x603124=_0x5b08[_0x2ff51e];return _0x603124;};'use strict';var multer=require(_0x85b0('0x0'));var util=require(_0x85b0('0x1'));var path=require(_0x85b0('0x2'));var timeout=require(_0x85b0('0x3'));var express=require(_0x85b0('0x4'));var router=express[_0x85b0('0x5')]();var fs_extra=require(_0x85b0('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x85b0('0x7'));var config=require(_0x85b0('0x8'));var controller=require(_0x85b0('0x9'));router[_0x85b0('0xa')]('/',auth[_0x85b0('0xb')](),controller['index']);router[_0x85b0('0xa')]('/:id',auth[_0x85b0('0xb')](),controller[_0x85b0('0xc')]);router[_0x85b0('0xd')]('/',auth[_0x85b0('0xb')](),controller[_0x85b0('0xe')]);router['put'](_0x85b0('0xf'),auth[_0x85b0('0xb')](),controller[_0x85b0('0x10')]);router[_0x85b0('0x11')](_0x85b0('0xf'),auth[_0x85b0('0xb')](),controller[_0x85b0('0x12')]);module[_0x85b0('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 6c8983f..8e2d1f9 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 _0x3204=['sequelize','exports','STRING','options','join','getDataValue','split','BOOLEAN'];(function(_0x5e4563,_0x3ff918){var _0x8d1bf5=function(_0x3bf7a9){while(--_0x3bf7a9){_0x5e4563['push'](_0x5e4563['shift']());}};_0x8d1bf5(++_0x3ff918);}(_0x3204,0x70));var _0x4320=function(_0xd9f7e2,_0x1bf3a3){_0xd9f7e2=_0xd9f7e2-0x0;var _0x4a6b84=_0x3204[_0xd9f7e2];return _0x4a6b84;};'use strict';var Sequelize=require(_0x4320('0x0'));module[_0x4320('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x4320('0x2')],'set':function(_0x163117){this['setDataValue'](_0x4320('0x3'),_0x163117?_0x163117[_0x4320('0x4')](''):[]);},'get':function(){return this[_0x4320('0x5')](_0x4320('0x3'))?this[_0x4320('0x5')]('options')[_0x4320('0x6')](''):[];}},'auth':{'type':Sequelize[_0x4320('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x4320('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfe22=['getDataValue','split','sequelize','exports','STRING','setDataValue','join','options'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfe22,0x82));var _0x2fe2=function(_0x12b174,_0x56b7ba){_0x12b174=_0x12b174-0x0;var _0x2ec7a3=_0xfe22[_0x12b174];return _0x2ec7a3;};'use strict';var Sequelize=require(_0x2fe2('0x0'));module[_0x2fe2('0x1')]={'name':{'type':Sequelize[_0x2fe2('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x2fe2('0x2')],'set':function(_0x2aa58b){this[_0x2fe2('0x3')]('options',_0x2aa58b?_0x2aa58b[_0x2fe2('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0x2fe2('0x5'))?this[_0x2fe2('0x6')](_0x2fe2('0x5'))[_0x2fe2('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x2fe2('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 1ab93e5..789154d 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 _0x7b05=['path','sox','to-csv','fs-extra','squel','crypto','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','json','offset','undefined','limit','count','status','set','reject','save','update','then','get','ChanSpies','UserProfileResource','destroy','sendStatus','name','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','VoiceChanSpy','includeAll','include','catch','show','params','options','find','create','body','user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util'];(function(_0x5f152d,_0x4fa8ac){var _0x332df3=function(_0x3453db){while(--_0x3453db){_0x5f152d['push'](_0x5f152d['shift']());}};_0x332df3(++_0x4fa8ac);}(_0x7b05,0x91));var _0x57b0=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x7b05[_0x28947d];return _0x12d2ee;};'use strict';var emlformat=require(_0x57b0('0x0'));var rimraf=require(_0x57b0('0x1'));var zipdir=require(_0x57b0('0x2'));var jsonpatch=require(_0x57b0('0x3'));var rp=require('request-promise');var moment=require(_0x57b0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x57b0('0x5'));var util=require(_0x57b0('0x6'));var path=require(_0x57b0('0x7'));var sox=require(_0x57b0('0x8'));var csv=require(_0x57b0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x57b0('0xa'));var _=require('lodash');var squel=require(_0x57b0('0xb'));var crypto=require(_0x57b0('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x57b0('0xd'));var Redis=require(_0x57b0('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x57b0('0xf'));var logger=require(_0x57b0('0x10'))(_0x57b0('0x11'));var utils=require(_0x57b0('0x12'));var config=require(_0x57b0('0x13'));var licenseUtil=require(_0x57b0('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x363096,_0x145eae){_0x145eae=_0x145eae||0xcc;return function(_0xee8335){if(_0xee8335){return _0x363096['sendStatus'](_0x145eae);}return _0x363096['status'](_0x145eae)[_0x57b0('0x15')]();};}function respondWithResult(_0x3f95e3,_0xc9044f){_0xc9044f=_0xc9044f||0xc8;return function(_0x3b48a3){if(_0x3b48a3){return _0x3f95e3['status'](_0xc9044f)[_0x57b0('0x16')](_0x3b48a3);}};}function respondWithFilteredResult(_0x5c46a5,_0x235d4a){return function(_0xa20423){if(_0xa20423){var _0x55fd9c=typeof _0x235d4a[_0x57b0('0x17')]===_0x57b0('0x18')&&typeof _0x235d4a[_0x57b0('0x19')]===_0x57b0('0x18');var _0x3eb198=_0xa20423['count'];var _0x37bd5d=_0x55fd9c?0x0:_0x235d4a['offset'];var _0x592b2d=_0x55fd9c?_0xa20423[_0x57b0('0x1a')]:_0x235d4a[_0x57b0('0x17')]+_0x235d4a[_0x57b0('0x19')];var _0x3e14f5;if(_0x592b2d>=_0x3eb198){_0x592b2d=_0x3eb198;_0x3e14f5=0xc8;}else{_0x3e14f5=0xce;}_0x5c46a5[_0x57b0('0x1b')](_0x3e14f5);return _0x5c46a5[_0x57b0('0x1c')]('Content-Range',_0x37bd5d+'-'+_0x592b2d+'/'+_0x3eb198)[_0x57b0('0x16')](_0xa20423);}return null;};}function patchUpdates(_0x1d81ff){return function(_0x35a457){try{jsonpatch['apply'](_0x35a457,_0x1d81ff,!![]);}catch(_0x12f2f6){return BPromise[_0x57b0('0x1d')](_0x12f2f6);}return _0x35a457[_0x57b0('0x1e')]();};}function saveUpdates(_0x149056,_0x2ffc0a){return function(_0x22b11e){if(_0x22b11e){return _0x22b11e[_0x57b0('0x1f')](_0x149056)[_0x57b0('0x20')](function(_0x3497e4){return _0x3497e4;});}return null;};}function removeEntity(_0x5c60b9,_0x55b870){return function(_0x40c279){if(_0x40c279){return _0x40c279['destroy']()[_0x57b0('0x20')](function(){var _0x3ce739=_0x40c279[_0x57b0('0x21')]({'plain':!![]});var _0x38e3a0=_0x57b0('0x22');return db[_0x57b0('0x23')][_0x57b0('0x24')]({'where':{'type':_0x38e3a0,'resourceId':_0x3ce739['id']}})[_0x57b0('0x20')](function(){return _0x40c279;});})[_0x57b0('0x20')](function(){_0x5c60b9[_0x57b0('0x1b')](0xcc)[_0x57b0('0x15')]();});}};}function handleEntityNotFound(_0x43b90f,_0x196c85){return function(_0x508288){if(!_0x508288){_0x43b90f[_0x57b0('0x25')](0x194);}return _0x508288;};}function handleError(_0x114cd7,_0xf8e773){_0xf8e773=_0xf8e773||0x1f4;return function(_0x228dfe){logger['error'](_0x228dfe['stack']);if(_0x228dfe[_0x57b0('0x26')]){delete _0x228dfe[_0x57b0('0x26')];}_0x114cd7[_0x57b0('0x1b')](_0xf8e773)['send'](_0x228dfe);};}exports['index']=function(_0x9d9195,_0x577dae){var _0x12f4bf={},_0x5b6c1d={},_0x5d19a6={'count':0x0,'rows':[]};var _0x2fb4b7=_[_0x57b0('0x27')](db['VoiceChanSpy'][_0x57b0('0x28')],function(_0x32e03e){return{'name':_0x32e03e['fieldName'],'type':_0x32e03e[_0x57b0('0x29')][_0x57b0('0x2a')]};});_0x5b6c1d[_0x57b0('0x2b')]=_['map'](_0x2fb4b7,_0x57b0('0x26'));_0x5b6c1d[_0x57b0('0x2c')]=_[_0x57b0('0x2d')](_0x9d9195[_0x57b0('0x2c')]);_0x5b6c1d[_0x57b0('0x2e')]=_['intersection'](_0x5b6c1d['model'],_0x5b6c1d['query']);_0x12f4bf['attributes']=_[_0x57b0('0x2f')](_0x5b6c1d[_0x57b0('0x2b')],qs[_0x57b0('0x30')](_0x9d9195[_0x57b0('0x2c')][_0x57b0('0x30')]));_0x12f4bf['attributes']=_0x12f4bf[_0x57b0('0x31')][_0x57b0('0x32')]?_0x12f4bf[_0x57b0('0x31')]:_0x5b6c1d[_0x57b0('0x2b')];if(!_0x9d9195['query'][_0x57b0('0x33')](_0x57b0('0x34'))){_0x12f4bf['limit']=qs[_0x57b0('0x19')](_0x9d9195[_0x57b0('0x2c')]['limit']);_0x12f4bf['offset']=qs[_0x57b0('0x17')](_0x9d9195[_0x57b0('0x2c')][_0x57b0('0x17')]);}_0x12f4bf[_0x57b0('0x35')]=qs[_0x57b0('0x36')](_0x9d9195[_0x57b0('0x2c')][_0x57b0('0x36')]);_0x12f4bf[_0x57b0('0x37')]=qs[_0x57b0('0x2e')](_[_0x57b0('0x38')](_0x9d9195[_0x57b0('0x2c')],_0x5b6c1d[_0x57b0('0x2e')]),_0x2fb4b7);if(_0x9d9195['query'][_0x57b0('0x39')]){_0x12f4bf[_0x57b0('0x37')]=_[_0x57b0('0x3a')](_0x12f4bf['where'],{'$or':_['map'](_0x2fb4b7,function(_0x48bf5c){if(_0x48bf5c[_0x57b0('0x29')]!==_0x57b0('0x3b')){var _0xc3b922={};_0xc3b922[_0x48bf5c[_0x57b0('0x26')]]={'$like':'%'+_0x9d9195['query'][_0x57b0('0x39')]+'%'};return _0xc3b922;}})});}_0x12f4bf=_[_0x57b0('0x3a')]({},_0x12f4bf,_0x9d9195['options']);var _0x24afa0={'where':_0x12f4bf[_0x57b0('0x37')]};return db[_0x57b0('0x3c')][_0x57b0('0x1a')](_0x24afa0)[_0x57b0('0x20')](function(_0x5980db){_0x5d19a6[_0x57b0('0x1a')]=_0x5980db;if(_0x9d9195[_0x57b0('0x2c')][_0x57b0('0x3d')]){_0x12f4bf[_0x57b0('0x3e')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x12f4bf);})[_0x57b0('0x20')](function(_0x344bc6){_0x5d19a6['rows']=_0x344bc6;return _0x5d19a6;})[_0x57b0('0x20')](respondWithFilteredResult(_0x577dae,_0x12f4bf))[_0x57b0('0x3f')](handleError(_0x577dae,null));};exports[_0x57b0('0x40')]=function(_0x546d5d,_0x4f5ebd){var _0x3b7b4a={'raw':![],'where':{'id':_0x546d5d[_0x57b0('0x41')]['id']}},_0x3f3b1c={};_0x3f3b1c[_0x57b0('0x2b')]=_[_0x57b0('0x2d')](db['VoiceChanSpy'][_0x57b0('0x28')]);_0x3f3b1c[_0x57b0('0x2c')]=_[_0x57b0('0x2d')](_0x546d5d[_0x57b0('0x2c')]);_0x3f3b1c[_0x57b0('0x2e')]=_['intersection'](_0x3f3b1c['model'],_0x3f3b1c['query']);_0x3b7b4a['attributes']=_[_0x57b0('0x2f')](_0x3f3b1c[_0x57b0('0x2b')],qs[_0x57b0('0x30')](_0x546d5d[_0x57b0('0x2c')][_0x57b0('0x30')]));_0x3b7b4a[_0x57b0('0x31')]=_0x3b7b4a[_0x57b0('0x31')]['length']?_0x3b7b4a[_0x57b0('0x31')]:_0x3f3b1c[_0x57b0('0x2b')];if(_0x546d5d[_0x57b0('0x2c')][_0x57b0('0x3d')]){_0x3b7b4a[_0x57b0('0x3e')]=[{'all':!![]}];}_0x3b7b4a=_[_0x57b0('0x3a')]({},_0x3b7b4a,_0x546d5d[_0x57b0('0x42')]);return db['VoiceChanSpy'][_0x57b0('0x43')](_0x3b7b4a)['then'](handleEntityNotFound(_0x4f5ebd,null))[_0x57b0('0x20')](respondWithResult(_0x4f5ebd,null))['catch'](handleError(_0x4f5ebd,null));};exports[_0x57b0('0x44')]=function(_0x5cae47,_0x40dae2){return db[_0x57b0('0x3c')]['create'](_0x5cae47[_0x57b0('0x45')],{})[_0x57b0('0x20')](function(_0x1047a2){var _0x4fe484=_0x5cae47[_0x57b0('0x46')][_0x57b0('0x21')]({'plain':!![]});if(!_0x4fe484)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4fe484[_0x57b0('0x47')]===_0x57b0('0x46')){var _0x4d891b=_0x1047a2[_0x57b0('0x21')]({'plain':!![]});var _0x35ed98=_0x57b0('0x22');return db[_0x57b0('0x48')][_0x57b0('0x43')]({'where':{'name':_0x35ed98,'userProfileId':_0x4fe484['userProfileId']},'raw':!![]})['then'](function(_0x3696b5){if(_0x3696b5&&_0x3696b5[_0x57b0('0x49')]===0x0){return db[_0x57b0('0x23')]['create']({'name':_0x4d891b[_0x57b0('0x26')],'resourceId':_0x4d891b['id'],'type':_0x3696b5[_0x57b0('0x26')],'sectionId':_0x3696b5['id']},{})[_0x57b0('0x20')](function(){return _0x1047a2;});}else{return _0x1047a2;}})[_0x57b0('0x3f')](function(_0xe3c067){logger[_0x57b0('0x4a')](_0x57b0('0x4b'),_0xe3c067);throw _0xe3c067;});}return _0x1047a2;})[_0x57b0('0x20')](respondWithResult(_0x40dae2,0xc9))[_0x57b0('0x3f')](handleError(_0x40dae2,null));};exports[_0x57b0('0x1f')]=function(_0x1350a0,_0x446d19){if(_0x1350a0[_0x57b0('0x45')]['id']){delete _0x1350a0[_0x57b0('0x45')]['id'];}return db[_0x57b0('0x3c')][_0x57b0('0x43')]({'where':{'id':_0x1350a0[_0x57b0('0x41')]['id']}})[_0x57b0('0x20')](handleEntityNotFound(_0x446d19,null))['then'](saveUpdates(_0x1350a0[_0x57b0('0x45')],null))[_0x57b0('0x20')](respondWithResult(_0x446d19,null))[_0x57b0('0x3f')](handleError(_0x446d19,null));};exports['destroy']=function(_0x56bcec,_0x2670f5){return db['VoiceChanSpy']['find']({'where':{'id':_0x56bcec[_0x57b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x2670f5,null))[_0x57b0('0x20')](removeEntity(_0x2670f5,null))['catch'](handleError(_0x2670f5,null));}; \ No newline at end of file +var _0x4198=['order','sort','where','pick','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','get','ChanSpies','UserProfileResource','end','stack','name','send','map','VoiceChanSpy','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x20b2ee,_0x2f5f73){var _0xa9ec2e=function(_0x440897){while(--_0x440897){_0x20b2ee['push'](_0x20b2ee['shift']());}};_0xa9ec2e(++_0x2f5f73);}(_0x4198,0x69));var _0x8419=function(_0x364a2c,_0x5a8f50){_0x364a2c=_0x364a2c-0x0;var _0x3aa8f5=_0x4198[_0x364a2c];return _0x3aa8f5;};'use strict';var emlformat=require(_0x8419('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8419('0x1'));var jsonpatch=require(_0x8419('0x2'));var rp=require(_0x8419('0x3'));var moment=require(_0x8419('0x4'));var BPromise=require(_0x8419('0x5'));var Mustache=require(_0x8419('0x6'));var util=require(_0x8419('0x7'));var path=require(_0x8419('0x8'));var sox=require(_0x8419('0x9'));var csv=require(_0x8419('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8419('0xb'));var _=require(_0x8419('0xc'));var squel=require(_0x8419('0xd'));var crypto=require(_0x8419('0xe'));var jsforce=require(_0x8419('0xf'));var deskjs=require(_0x8419('0x10'));var toCsv=require(_0x8419('0xa'));var querystring=require(_0x8419('0x11'));var Papa=require(_0x8419('0x12'));var Redis=require(_0x8419('0x13'));var authService=require(_0x8419('0x14'));var qs=require(_0x8419('0x15'));var as=require(_0x8419('0x16'));var hardwareService=require(_0x8419('0x17'));var logger=require(_0x8419('0x18'))('api');var utils=require(_0x8419('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x8419('0x1a'));var db=require(_0x8419('0x1b'))['db'];function respondWithStatusCode(_0x14c1bd,_0x493f53){_0x493f53=_0x493f53||0xcc;return function(_0x54f5b3){if(_0x54f5b3){return _0x14c1bd[_0x8419('0x1c')](_0x493f53);}return _0x14c1bd[_0x8419('0x1d')](_0x493f53)['end']();};}function respondWithResult(_0x166586,_0x298d33){_0x298d33=_0x298d33||0xc8;return function(_0x2e4d33){if(_0x2e4d33){return _0x166586[_0x8419('0x1d')](_0x298d33)[_0x8419('0x1e')](_0x2e4d33);}};}function respondWithFilteredResult(_0x5983c1,_0x434bd4){return function(_0xab746e){if(_0xab746e){var _0x4f0ceb=typeof _0x434bd4[_0x8419('0x1f')]===_0x8419('0x20')&&typeof _0x434bd4[_0x8419('0x21')]===_0x8419('0x20');var _0x1c1fe4=_0xab746e[_0x8419('0x22')];var _0x3b8d51=_0x4f0ceb?0x0:_0x434bd4[_0x8419('0x1f')];var _0x44569a=_0x4f0ceb?_0xab746e['count']:_0x434bd4['offset']+_0x434bd4[_0x8419('0x21')];var _0x275a4c;if(_0x44569a>=_0x1c1fe4){_0x44569a=_0x1c1fe4;_0x275a4c=0xc8;}else{_0x275a4c=0xce;}_0x5983c1[_0x8419('0x1d')](_0x275a4c);return _0x5983c1[_0x8419('0x23')](_0x8419('0x24'),_0x3b8d51+'-'+_0x44569a+'/'+_0x1c1fe4)[_0x8419('0x1e')](_0xab746e);}return null;};}function patchUpdates(_0x43efb7){return function(_0x3e3beb){try{jsonpatch[_0x8419('0x25')](_0x3e3beb,_0x43efb7,!![]);}catch(_0x149537){return BPromise[_0x8419('0x26')](_0x149537);}return _0x3e3beb['save']();};}function saveUpdates(_0x24decb,_0x110f0e){return function(_0xb4fa12){if(_0xb4fa12){return _0xb4fa12[_0x8419('0x27')](_0x24decb)['then'](function(_0x38dfef){return _0x38dfef;});}return null;};}function removeEntity(_0x4cf022,_0x5d66d4){return function(_0x1cab7d){if(_0x1cab7d){return _0x1cab7d[_0x8419('0x28')]()[_0x8419('0x29')](function(){var _0x26457f=_0x1cab7d[_0x8419('0x2a')]({'plain':!![]});var _0x496b2f=_0x8419('0x2b');return db[_0x8419('0x2c')][_0x8419('0x28')]({'where':{'type':_0x496b2f,'resourceId':_0x26457f['id']}})[_0x8419('0x29')](function(){return _0x1cab7d;});})[_0x8419('0x29')](function(){_0x4cf022[_0x8419('0x1d')](0xcc)[_0x8419('0x2d')]();});}};}function handleEntityNotFound(_0x4701d4,_0x73cac6){return function(_0x30550e){if(!_0x30550e){_0x4701d4[_0x8419('0x1c')](0x194);}return _0x30550e;};}function handleError(_0x1fcbef,_0xcd7208){_0xcd7208=_0xcd7208||0x1f4;return function(_0x4a5487){logger['error'](_0x4a5487[_0x8419('0x2e')]);if(_0x4a5487[_0x8419('0x2f')]){delete _0x4a5487[_0x8419('0x2f')];}_0x1fcbef[_0x8419('0x1d')](_0xcd7208)[_0x8419('0x30')](_0x4a5487);};}exports['index']=function(_0x4b8fb5,_0x3e18c5){var _0x489835={},_0x23ec83={},_0x572a37={'count':0x0,'rows':[]};var _0x528156=_[_0x8419('0x31')](db[_0x8419('0x32')]['rawAttributes'],function(_0x445805){return{'name':_0x445805['fieldName'],'type':_0x445805['type'][_0x8419('0x33')]};});_0x23ec83[_0x8419('0x34')]=_[_0x8419('0x31')](_0x528156,'name');_0x23ec83[_0x8419('0x35')]=_[_0x8419('0x36')](_0x4b8fb5[_0x8419('0x35')]);_0x23ec83[_0x8419('0x37')]=_['intersection'](_0x23ec83[_0x8419('0x34')],_0x23ec83[_0x8419('0x35')]);_0x489835[_0x8419('0x38')]=_[_0x8419('0x39')](_0x23ec83[_0x8419('0x34')],qs[_0x8419('0x3a')](_0x4b8fb5[_0x8419('0x35')][_0x8419('0x3a')]));_0x489835[_0x8419('0x38')]=_0x489835[_0x8419('0x38')][_0x8419('0x3b')]?_0x489835[_0x8419('0x38')]:_0x23ec83['model'];if(!_0x4b8fb5['query'][_0x8419('0x3c')]('nolimit')){_0x489835['limit']=qs[_0x8419('0x21')](_0x4b8fb5[_0x8419('0x35')][_0x8419('0x21')]);_0x489835[_0x8419('0x1f')]=qs[_0x8419('0x1f')](_0x4b8fb5[_0x8419('0x35')][_0x8419('0x1f')]);}_0x489835[_0x8419('0x3d')]=qs[_0x8419('0x3e')](_0x4b8fb5[_0x8419('0x35')][_0x8419('0x3e')]);_0x489835[_0x8419('0x3f')]=qs[_0x8419('0x37')](_[_0x8419('0x40')](_0x4b8fb5['query'],_0x23ec83[_0x8419('0x37')]),_0x528156);if(_0x4b8fb5[_0x8419('0x35')]['filter']){_0x489835[_0x8419('0x3f')]=_[_0x8419('0x41')](_0x489835['where'],{'$or':_[_0x8419('0x31')](_0x528156,function(_0x47bdf8){if(_0x47bdf8[_0x8419('0x42')]!==_0x8419('0x43')){var _0x43545b={};_0x43545b[_0x47bdf8[_0x8419('0x2f')]]={'$like':'%'+_0x4b8fb5[_0x8419('0x35')]['filter']+'%'};return _0x43545b;}})});}_0x489835=_[_0x8419('0x41')]({},_0x489835,_0x4b8fb5['options']);var _0x4f5645={'where':_0x489835['where']};return db['VoiceChanSpy'][_0x8419('0x22')](_0x4f5645)[_0x8419('0x29')](function(_0x18f7ad){_0x572a37[_0x8419('0x22')]=_0x18f7ad;if(_0x4b8fb5[_0x8419('0x35')][_0x8419('0x44')]){_0x489835[_0x8419('0x45')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x8419('0x46')](_0x489835);})[_0x8419('0x29')](function(_0x1ca1b4){_0x572a37[_0x8419('0x47')]=_0x1ca1b4;return _0x572a37;})['then'](respondWithFilteredResult(_0x3e18c5,_0x489835))[_0x8419('0x48')](handleError(_0x3e18c5,null));};exports['show']=function(_0xb0e4f1,_0x1046e0){var _0x12586d={'raw':![],'where':{'id':_0xb0e4f1[_0x8419('0x49')]['id']}},_0xf35e2d={};_0xf35e2d[_0x8419('0x34')]=_[_0x8419('0x36')](db[_0x8419('0x32')][_0x8419('0x4a')]);_0xf35e2d['query']=_['keys'](_0xb0e4f1['query']);_0xf35e2d[_0x8419('0x37')]=_[_0x8419('0x39')](_0xf35e2d[_0x8419('0x34')],_0xf35e2d[_0x8419('0x35')]);_0x12586d[_0x8419('0x38')]=_[_0x8419('0x39')](_0xf35e2d[_0x8419('0x34')],qs[_0x8419('0x3a')](_0xb0e4f1[_0x8419('0x35')][_0x8419('0x3a')]));_0x12586d[_0x8419('0x38')]=_0x12586d[_0x8419('0x38')][_0x8419('0x3b')]?_0x12586d[_0x8419('0x38')]:_0xf35e2d[_0x8419('0x34')];if(_0xb0e4f1['query'][_0x8419('0x44')]){_0x12586d[_0x8419('0x45')]=[{'all':!![]}];}_0x12586d=_[_0x8419('0x41')]({},_0x12586d,_0xb0e4f1[_0x8419('0x4b')]);return db[_0x8419('0x32')][_0x8419('0x4c')](_0x12586d)['then'](handleEntityNotFound(_0x1046e0,null))[_0x8419('0x29')](respondWithResult(_0x1046e0,null))[_0x8419('0x48')](handleError(_0x1046e0,null));};exports['create']=function(_0x181581,_0x17978c){return db['VoiceChanSpy']['create'](_0x181581['body'],{})[_0x8419('0x29')](function(_0x3a2ae7){var _0x5aca62=_0x181581[_0x8419('0x4d')][_0x8419('0x2a')]({'plain':!![]});if(!_0x5aca62)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5aca62[_0x8419('0x4e')]===_0x8419('0x4d')){var _0x22db14=_0x3a2ae7[_0x8419('0x2a')]({'plain':!![]});var _0x5da0ba='ChanSpies';return db['UserProfileSection']['find']({'where':{'name':_0x5da0ba,'userProfileId':_0x5aca62[_0x8419('0x4f')]},'raw':!![]})[_0x8419('0x29')](function(_0x3624c9){if(_0x3624c9&&_0x3624c9[_0x8419('0x50')]===0x0){return db[_0x8419('0x2c')]['create']({'name':_0x22db14[_0x8419('0x2f')],'resourceId':_0x22db14['id'],'type':_0x3624c9[_0x8419('0x2f')],'sectionId':_0x3624c9['id']},{})[_0x8419('0x29')](function(){return _0x3a2ae7;});}else{return _0x3a2ae7;}})['catch'](function(_0x1e88d3){logger['error'](_0x8419('0x51'),_0x1e88d3);throw _0x1e88d3;});}return _0x3a2ae7;})[_0x8419('0x29')](respondWithResult(_0x17978c,0xc9))[_0x8419('0x48')](handleError(_0x17978c,null));};exports[_0x8419('0x27')]=function(_0x45abc5,_0x3b6765){if(_0x45abc5[_0x8419('0x52')]['id']){delete _0x45abc5[_0x8419('0x52')]['id'];}return db[_0x8419('0x32')][_0x8419('0x4c')]({'where':{'id':_0x45abc5[_0x8419('0x49')]['id']}})[_0x8419('0x29')](handleEntityNotFound(_0x3b6765,null))[_0x8419('0x29')](saveUpdates(_0x45abc5[_0x8419('0x52')],null))['then'](respondWithResult(_0x3b6765,null))[_0x8419('0x48')](handleError(_0x3b6765,null));};exports['destroy']=function(_0xc41754,_0x1f6b34){return db[_0x8419('0x32')]['find']({'where':{'id':_0xc41754['params']['id']}})[_0x8419('0x29')](handleEntityNotFound(_0x1f6b34,null))[_0x8419('0x29')](removeEntity(_0x1f6b34,null))['catch'](handleError(_0x1f6b34,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index c5a8b89..7457706 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 _0xc627=['StopMixMonitor','length','concat','internal','agent','then','exports','models','define','VoiceChanSpy','voice_chanspy','catch','VoiceExtension','destroy','bulkCreate','util','bluebird','context','from-sip','format','prefix','push','merge','Set','CDR(type)=%s','chanspy','MixMonitor','recordingFormat','auth','Authenticate','password','SIP/%s,%s','name','options','join','record'];(function(_0x7d4e7e,_0x423e0f){var _0xee35cd=function(_0x15137b){while(--_0x15137b){_0x7d4e7e['push'](_0x7d4e7e['shift']());}};_0xee35cd(++_0x423e0f);}(_0xc627,0x1e3));var _0x7c62=function(_0x50fd88,_0x4dc70d){_0x50fd88=_0x50fd88-0x0;var _0x1ab5bf=_0xc627[_0x50fd88];return _0x1ab5bf;};'use strict';var _=require('lodash');var util=require(_0x7c62('0x0'));var BPromise=require(_0x7c62('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x57bc43,_0x4da8ac,_0x91222a){var _0x4e1155=0x1;var _0x326c83=[];var _0x2ba827={'context':_0x4da8ac[_0x7c62('0x2')]||_0x7c62('0x3'),'exten':util[_0x7c62('0x4')]('%s%s',_0x57bc43[_0x7c62('0x5')],_0x91222a),'type':'system','isApp':![],'ChanSpyId':_0x57bc43['id'],'UserId':_0x4da8ac['id']};_0x326c83[_0x7c62('0x6')](_[_0x7c62('0x7')]({'app':_0x7c62('0x8'),'appdata':util['format'](_0x7c62('0x9'),_0x7c62('0xa')),'priority':_0x4e1155++},_0x2ba827));if(_0x57bc43['record']){_0x326c83[_0x7c62('0x6')](_['merge']({'app':_0x7c62('0xb'),'appdata':util[_0x7c62('0x4')]('${UNIQUEID}.%s,a',_0x57bc43[_0x7c62('0xc')]),'priority':_0x4e1155++},_0x2ba827));}if(_0x57bc43[_0x7c62('0xd')]){_0x326c83[_0x7c62('0x6')](_[_0x7c62('0x7')]({'app':_0x7c62('0xe'),'appdata':_0x57bc43[_0x7c62('0xf')],'priority':_0x4e1155++},_0x2ba827));}_0x326c83[_0x7c62('0x6')](_['merge']({'app':'ChanSpy','appdata':util[_0x7c62('0x4')](_0x7c62('0x10'),_0x4da8ac[_0x7c62('0x11')],_0x57bc43[_0x7c62('0x12')]?_0x57bc43[_0x7c62('0x12')][_0x7c62('0x13')](''):''),'priority':_0x4e1155++},_0x2ba827));if(_0x57bc43[_0x7c62('0x14')]){_0x326c83[_0x7c62('0x6')](_['merge']({'app':_0x7c62('0x15'),'priority':_0x4e1155++},_0x2ba827));}return _0x326c83;};var getChanSpyApplications=function(_0xd82466,_0x42a8a1){var _0x5e4f1d=[];for(var _0x4e715a=0x0,_0xe06765=0x1;_0x4e715a<_0x42a8a1[_0x7c62('0x16')];_0x4e715a++,_0xe06765=0x1){_0x5e4f1d=_0x5e4f1d[_0x7c62('0x17')](getUserApplications(_0xd82466,_0x42a8a1[_0x4e715a],_0x42a8a1[_0x4e715a]['internal']));if(_0x42a8a1[_0x4e715a][_0x7c62('0x18')]!=_0x42a8a1[_0x4e715a][_0x7c62('0x11')]){_0x5e4f1d=_0x5e4f1d[_0x7c62('0x17')](getUserApplications(_0xd82466,_0x42a8a1[_0x4e715a],_0x42a8a1[_0x4e715a][_0x7c62('0x11')]));}}return _0x5e4f1d;};var getChanSpyPromise=function(_0x315633,_0x1c84a1){return new BPromise(function(_0x222ee5,_0x362248){return _0x315633['User']['findAll']({'attributes':['id','name','internal'],'where':{'role':_0x7c62('0x19'),'chanspy':!![]},'raw':!![]})[_0x7c62('0x1a')](function(_0xf67603){if(_0xf67603){return _0x222ee5(getChanSpyApplications(_0x1c84a1,_0xf67603));}return _0x222ee5([]);})['catch'](function(_0xc3b941){_0x362248(_0xc3b941);});});};module[_0x7c62('0x1b')]=function(_0x2309a6,_0x4e339d){var _0x54afb5=_0x2309a6[_0x7c62('0x1c')];return _0x2309a6[_0x7c62('0x1d')](_0x7c62('0x1e'),attributes,{'tableName':_0x7c62('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3a0e0d,_0x5b7cbc,_0x586791){return getChanSpyPromise(_0x54afb5,_0x3a0e0d)[_0x7c62('0x1a')](function(_0x54d1fe){if(_0x54d1fe&&_0x54d1fe['length']){return _0x54afb5['VoiceExtension']['bulkCreate'](_0x54d1fe);}})[_0x7c62('0x1a')](function(){_0x586791();})[_0x7c62('0x20')](function(_0x323642){_0x586791(_0x323642);});},'afterUpdate':function(_0x2d5046,_0x5cb103,_0x310db){return _0x54afb5[_0x7c62('0x21')][_0x7c62('0x22')]({'where':{'ChanSpyId':_0x2d5046['id']}})[_0x7c62('0x1a')](function(){return getChanSpyPromise(_0x54afb5,_0x2d5046);})[_0x7c62('0x1a')](function(_0x55c799){if(_0x55c799&&_0x55c799[_0x7c62('0x16')]){return _0x54afb5['VoiceExtension'][_0x7c62('0x23')](_0x55c799);}})[_0x7c62('0x1a')](function(){_0x310db();})['catch'](function(_0x50843c){_0x310db(_0x50843c);});},'afterDestroy':function(_0x5aa9e0,_0xa91c5,_0x2539a7){return _0x54afb5[_0x7c62('0x21')][_0x7c62('0x22')]({'where':{'ChanSpyId':_0x5aa9e0['id']}})[_0x7c62('0x1a')](function(){_0x2539a7();})[_0x7c62('0x20')](function(_0x4b7c14){_0x2539a7(_0x4b7c14);});}}});}; \ No newline at end of file +var _0x016e=['auth','Authenticate','password','ChanSpy','name','options','join','record','length','internal','concat','then','catch','exports','define','VoiceChanSpy','VoiceExtension','bulkCreate','destroy','lodash','bluebird','./voiceChanSpy.attributes','context','from-sip','format','prefix','system','merge','Set','CDR(type)=%s','chanspy','push','MixMonitor','${UNIQUEID}.%s,a'];(function(_0x234577,_0x3b9004){var _0x28fea6=function(_0x59692d){while(--_0x59692d){_0x234577['push'](_0x234577['shift']());}};_0x28fea6(++_0x3b9004);}(_0x016e,0x167));var _0xe016=function(_0xb714a0,_0x2b97dd){_0xb714a0=_0xb714a0-0x0;var _0x15c56c=_0x016e[_0xb714a0];return _0x15c56c;};'use strict';var _=require(_0xe016('0x0'));var util=require('util');var BPromise=require(_0xe016('0x1'));var attributes=require(_0xe016('0x2'));var getUserApplications=function(_0x46cae3,_0x288696,_0xa7e6c3){var _0x28274d=0x1;var _0xd3df61=[];var _0x4dfc38={'context':_0x288696[_0xe016('0x3')]||_0xe016('0x4'),'exten':util[_0xe016('0x5')]('%s%s',_0x46cae3[_0xe016('0x6')],_0xa7e6c3),'type':_0xe016('0x7'),'isApp':![],'ChanSpyId':_0x46cae3['id'],'UserId':_0x288696['id']};_0xd3df61['push'](_[_0xe016('0x8')]({'app':_0xe016('0x9'),'appdata':util['format'](_0xe016('0xa'),_0xe016('0xb')),'priority':_0x28274d++},_0x4dfc38));if(_0x46cae3['record']){_0xd3df61[_0xe016('0xc')](_[_0xe016('0x8')]({'app':_0xe016('0xd'),'appdata':util[_0xe016('0x5')](_0xe016('0xe'),_0x46cae3['recordingFormat']),'priority':_0x28274d++},_0x4dfc38));}if(_0x46cae3[_0xe016('0xf')]){_0xd3df61['push'](_[_0xe016('0x8')]({'app':_0xe016('0x10'),'appdata':_0x46cae3[_0xe016('0x11')],'priority':_0x28274d++},_0x4dfc38));}_0xd3df61[_0xe016('0xc')](_['merge']({'app':_0xe016('0x12'),'appdata':util['format']('SIP/%s,%s',_0x288696[_0xe016('0x13')],_0x46cae3[_0xe016('0x14')]?_0x46cae3[_0xe016('0x14')][_0xe016('0x15')](''):''),'priority':_0x28274d++},_0x4dfc38));if(_0x46cae3[_0xe016('0x16')]){_0xd3df61['push'](_[_0xe016('0x8')]({'app':'StopMixMonitor','priority':_0x28274d++},_0x4dfc38));}return _0xd3df61;};var getChanSpyApplications=function(_0x1529ee,_0x1bcbb0){var _0x407f7a=[];for(var _0x566ec7=0x0,_0x2a5de0=0x1;_0x566ec7<_0x1bcbb0[_0xe016('0x17')];_0x566ec7++,_0x2a5de0=0x1){_0x407f7a=_0x407f7a['concat'](getUserApplications(_0x1529ee,_0x1bcbb0[_0x566ec7],_0x1bcbb0[_0x566ec7][_0xe016('0x18')]));if(_0x1bcbb0[_0x566ec7][_0xe016('0x18')]!=_0x1bcbb0[_0x566ec7][_0xe016('0x13')]){_0x407f7a=_0x407f7a[_0xe016('0x19')](getUserApplications(_0x1529ee,_0x1bcbb0[_0x566ec7],_0x1bcbb0[_0x566ec7][_0xe016('0x13')]));}}return _0x407f7a;};var getChanSpyPromise=function(_0xc1ac33,_0x31c0e7){return new BPromise(function(_0x3b4aab,_0x2eef32){return _0xc1ac33['User']['findAll']({'attributes':['id','name',_0xe016('0x18')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xe016('0x1a')](function(_0x3ef1bd){if(_0x3ef1bd){return _0x3b4aab(getChanSpyApplications(_0x31c0e7,_0x3ef1bd));}return _0x3b4aab([]);})[_0xe016('0x1b')](function(_0x20b47e){_0x2eef32(_0x20b47e);});});};module[_0xe016('0x1c')]=function(_0x3a9241,_0x1a175c){var _0x2b39ed=_0x3a9241['models'];return _0x3a9241[_0xe016('0x1d')](_0xe016('0x1e'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x377b9f,_0x30cb47,_0x33c7dc){return getChanSpyPromise(_0x2b39ed,_0x377b9f)[_0xe016('0x1a')](function(_0x3bacab){if(_0x3bacab&&_0x3bacab[_0xe016('0x17')]){return _0x2b39ed[_0xe016('0x1f')][_0xe016('0x20')](_0x3bacab);}})['then'](function(){_0x33c7dc();})['catch'](function(_0x3e227c){_0x33c7dc(_0x3e227c);});},'afterUpdate':function(_0xcfb870,_0x38d6b8,_0x499f32){return _0x2b39ed[_0xe016('0x1f')][_0xe016('0x21')]({'where':{'ChanSpyId':_0xcfb870['id']}})[_0xe016('0x1a')](function(){return getChanSpyPromise(_0x2b39ed,_0xcfb870);})[_0xe016('0x1a')](function(_0x4553f7){if(_0x4553f7&&_0x4553f7[_0xe016('0x17')]){return _0x2b39ed[_0xe016('0x1f')][_0xe016('0x20')](_0x4553f7);}})['then'](function(){_0x499f32();})[_0xe016('0x1b')](function(_0x4a76f7){_0x499f32(_0x4a76f7);});},'afterDestroy':function(_0x474c62,_0x3091e8,_0x3f5209){return _0x2b39ed[_0xe016('0x1f')][_0xe016('0x21')]({'where':{'ChanSpyId':_0x474c62['id']}})[_0xe016('0x1a')](function(){_0x3f5209();})[_0xe016('0x1b')](function(_0x360da6){_0x3f5209(_0x360da6);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index d9c517a..4bf8dd4 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 _0xb4e6=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4f617a,_0x2475f7){var _0x9d2059=function(_0x498fa6){while(--_0x498fa6){_0x4f617a['push'](_0x4f617a['shift']());}};_0x9d2059(++_0x2475f7);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x7c0074,_0x1ffdcf){_0x7c0074=_0x7c0074-0x0;var _0x13e95b=_0xb4e6[_0x7c0074];return _0x13e95b;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var moment=require(_0x6b4e('0x1'));var BPromise=require(_0x6b4e('0x2'));var rs=require(_0x6b4e('0x3'));var fs=require('fs');var Redis=require(_0x6b4e('0x4'));var db=require(_0x6b4e('0x5'))['db'];var utils=require(_0x6b4e('0x6'));var logger=require(_0x6b4e('0x7'))('rpc');var config=require(_0x6b4e('0x8'));var jayson=require(_0x6b4e('0x9'));var client=jayson[_0x6b4e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd3138f,_0x570346,_0x4f00be){return new BPromise(function(_0x2311d9,_0x48c870){return client['request'](_0xd3138f,_0x4f00be)[_0x6b4e('0xb')](function(_0x2bd576){logger[_0x6b4e('0xc')](_0x6b4e('0xd'),_0x570346,_0x6b4e('0xe'));logger[_0x6b4e('0xf')](_0x6b4e('0x10'),_0x570346,'request\x20sent',JSON[_0x6b4e('0x11')](_0x2bd576));if(_0x2bd576[_0x6b4e('0x12')]){if(_0x2bd576['error'][_0x6b4e('0x13')]===0x1f4){logger[_0x6b4e('0x12')](_0x6b4e('0xd'),_0x570346,_0x2bd576[_0x6b4e('0x12')][_0x6b4e('0x14')]);return _0x48c870(_0x2bd576[_0x6b4e('0x12')][_0x6b4e('0x14')]);}logger['error'](_0x6b4e('0xd'),_0x570346,_0x2bd576[_0x6b4e('0x12')]['message']);return _0x2311d9(_0x2bd576[_0x6b4e('0x12')]['message']);}else{logger[_0x6b4e('0xc')](_0x6b4e('0xd'),_0x570346,_0x6b4e('0xe'));_0x2311d9(_0x2bd576[_0x6b4e('0x15')][_0x6b4e('0x14')]);}})[_0x6b4e('0x16')](function(_0x53a934){logger['error'](_0x6b4e('0xd'),_0x570346,_0x53a934);_0x48c870(_0x53a934);});});} \ No newline at end of file +var _0xf9f7=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error'];(function(_0x47405a,_0x3d42e6){var _0x5e32bd=function(_0x3164d3){while(--_0x3164d3){_0x47405a['push'](_0x47405a['shift']());}};_0x5e32bd(++_0x3d42e6);}(_0xf9f7,0xdf));var _0x7f9f=function(_0x1c9b8e,_0x444821){_0x1c9b8e=_0x1c9b8e-0x0;var _0x35a635=_0xf9f7[_0x1c9b8e];return _0x35a635;};'use strict';var _=require(_0x7f9f('0x0'));var util=require(_0x7f9f('0x1'));var moment=require(_0x7f9f('0x2'));var BPromise=require(_0x7f9f('0x3'));var rs=require(_0x7f9f('0x4'));var fs=require('fs');var Redis=require(_0x7f9f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7f9f('0x6'))(_0x7f9f('0x7'));var config=require(_0x7f9f('0x8'));var jayson=require(_0x7f9f('0x9'));var client=jayson[_0x7f9f('0xa')][_0x7f9f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b5819,_0x37e39f,_0x3da87e){return new BPromise(function(_0x181328,_0x3e9e75){return client[_0x7f9f('0xc')](_0x5b5819,_0x3da87e)['then'](function(_0x3fda85){logger[_0x7f9f('0xd')](_0x7f9f('0xe'),_0x37e39f,_0x7f9f('0xf'));logger[_0x7f9f('0x10')](_0x7f9f('0x11'),_0x37e39f,_0x7f9f('0xf'),JSON['stringify'](_0x3fda85));if(_0x3fda85[_0x7f9f('0x12')]){if(_0x3fda85[_0x7f9f('0x12')]['code']===0x1f4){logger['error'](_0x7f9f('0xe'),_0x37e39f,_0x3fda85['error'][_0x7f9f('0x13')]);return _0x3e9e75(_0x3fda85[_0x7f9f('0x12')]['message']);}logger[_0x7f9f('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x37e39f,_0x3fda85[_0x7f9f('0x12')][_0x7f9f('0x13')]);return _0x181328(_0x3fda85[_0x7f9f('0x12')][_0x7f9f('0x13')]);}else{logger[_0x7f9f('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x37e39f,_0x7f9f('0xf'));_0x181328(_0x3fda85[_0x7f9f('0x14')]['message']);}})[_0x7f9f('0x15')](function(_0x4a36c8){logger[_0x7f9f('0x12')](_0x7f9f('0xe'),_0x37e39f,_0x4a36c8);_0x3e9e75(_0x4a36c8);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 74f61a0..fd26e80 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 _0x0b3c=['/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated'];(function(_0x2cf2ce,_0x9c970){var _0x11f24d=function(_0x455b76){while(--_0x455b76){_0x2cf2ce['push'](_0x2cf2ce['shift']());}};_0x11f24d(++_0x9c970);}(_0x0b3c,0xf8));var _0xc0b3=function(_0x4a8a55,_0x2d3009){_0x4a8a55=_0x4a8a55-0x0;var _0x1de991=_0x0b3c[_0x4a8a55];return _0x1de991;};'use strict';var multer=require(_0xc0b3('0x0'));var util=require(_0xc0b3('0x1'));var path=require(_0xc0b3('0x2'));var timeout=require(_0xc0b3('0x3'));var express=require(_0xc0b3('0x4'));var router=express['Router']();var fs_extra=require(_0xc0b3('0x5'));var auth=require(_0xc0b3('0x6'));var interaction=require(_0xc0b3('0x7'));var config=require(_0xc0b3('0x8'));var controller=require(_0xc0b3('0x9'));router[_0xc0b3('0xa')]('/',auth[_0xc0b3('0xb')](),controller['index']);router[_0xc0b3('0xa')](_0xc0b3('0xc'),auth[_0xc0b3('0xb')](),controller[_0xc0b3('0xd')]);router[_0xc0b3('0xe')]('/',auth[_0xc0b3('0xb')](),controller[_0xc0b3('0xf')]);router[_0xc0b3('0x10')](_0xc0b3('0xc'),auth[_0xc0b3('0xb')](),controller[_0xc0b3('0x11')]);router[_0xc0b3('0x12')](_0xc0b3('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xc0b3('0x13')]=router; \ No newline at end of file +var _0x2a56=['update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','put'];(function(_0x40ec5f,_0x547f5f){var _0x28d353=function(_0x492c51){while(--_0x492c51){_0x40ec5f['push'](_0x40ec5f['shift']());}};_0x28d353(++_0x547f5f);}(_0x2a56,0x94));var _0x62a5=function(_0x8a0c41,_0x266b49){_0x8a0c41=_0x8a0c41-0x0;var _0x32ede8=_0x2a56[_0x8a0c41];return _0x32ede8;};'use strict';var multer=require(_0x62a5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x62a5('0x1'));var express=require(_0x62a5('0x2'));var router=express[_0x62a5('0x3')]();var fs_extra=require(_0x62a5('0x4'));var auth=require(_0x62a5('0x5'));var interaction=require(_0x62a5('0x6'));var config=require(_0x62a5('0x7'));var controller=require('./voiceContext.controller');router[_0x62a5('0x8')]('/',auth[_0x62a5('0x9')](),controller[_0x62a5('0xa')]);router[_0x62a5('0x8')](_0x62a5('0xb'),auth[_0x62a5('0x9')](),controller['show']);router[_0x62a5('0xc')]('/',auth[_0x62a5('0x9')](),controller['create']);router[_0x62a5('0xd')](_0x62a5('0xb'),auth[_0x62a5('0x9')](),controller[_0x62a5('0xe')]);router[_0x62a5('0xf')](_0x62a5('0xb'),auth[_0x62a5('0x9')](),controller[_0x62a5('0x10')]);module[_0x62a5('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 7a56a3c..63e712d 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 _0x9ddc=['sequelize','STRING','BOOLEAN'];(function(_0x53ad58,_0x3fb489){var _0x554b03=function(_0x5769ba){while(--_0x5769ba){_0x53ad58['push'](_0x53ad58['shift']());}};_0x554b03(++_0x3fb489);}(_0x9ddc,0xae));var _0xc9dd=function(_0x55c1ef,_0x5d128d){_0x55c1ef=_0x55c1ef-0x0;var _0x1df6af=_0x9ddc[_0x55c1ef];return _0x1df6af;};'use strict';var Sequelize=require(_0xc9dd('0x0'));module['exports']={'name':{'type':Sequelize[_0xc9dd('0x1')],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xc9dd('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xabb9=['exports','name','STRING','BOOLEAN'];(function(_0x58b220,_0x2be704){var _0xfd4fc3=function(_0x230bd8){while(--_0x230bd8){_0x58b220['push'](_0x58b220['shift']());}};_0xfd4fc3(++_0x2be704);}(_0xabb9,0x118));var _0x9abb=function(_0x25cc0c,_0x16e54d){_0x25cc0c=_0x25cc0c-0x0;var _0x35dc46=_0xabb9[_0x25cc0c];return _0x35dc46;};'use strict';var Sequelize=require('sequelize');module[_0x9abb('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x9abb('0x1')},'description':{'type':Sequelize[_0x9abb('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x9abb('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 423dca9..8c53ca2 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 _0xacbb=['sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','get','UserProfileResource','destroy','stack','name','index','map','VoiceContext','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','options','includeAll','include','findAll','show','length','merge','create','body','readFileSync','join','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','role','UserProfileSection','Contexts','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','root','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','request\x20sent','debug','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','info','result','catch'];(function(_0x3e9f19,_0x46edab){var _0x33e2cc=function(_0x481429){while(--_0x481429){_0x3e9f19['push'](_0x3e9f19['shift']());}};_0x33e2cc(++_0x46edab);}(_0xacbb,0x115));var _0xbacb=function(_0x1215b5,_0x151f17){_0x1215b5=_0x1215b5-0x0;var _0x147060=_0xacbb[_0x1215b5];return _0x147060;};'use strict';var emlformat=require(_0xbacb('0x0'));var rimraf=require(_0xbacb('0x1'));var zipdir=require(_0xbacb('0x2'));var jsonpatch=require(_0xbacb('0x3'));var rp=require(_0xbacb('0x4'));var moment=require(_0xbacb('0x5'));var BPromise=require(_0xbacb('0x6'));var Mustache=require('mustache');var util=require(_0xbacb('0x7'));var path=require(_0xbacb('0x8'));var sox=require(_0xbacb('0x9'));var csv=require(_0xbacb('0xa'));var ejs=require(_0xbacb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbacb('0xc'));var squel=require(_0xbacb('0xd'));var crypto=require(_0xbacb('0xe'));var jsforce=require(_0xbacb('0xf'));var deskjs=require(_0xbacb('0x10'));var toCsv=require(_0xbacb('0xa'));var querystring=require('querystring');var Papa=require(_0xbacb('0x11'));var Redis=require(_0xbacb('0x12'));var authService=require(_0xbacb('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xbacb('0x14'));var hardwareService=require(_0xbacb('0x15'));var logger=require(_0xbacb('0x16'))('api');var utils=require(_0xbacb('0x17'));var config=require(_0xbacb('0x18'));var licenseUtil=require(_0xbacb('0x19'));var db=require(_0xbacb('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xbacb('0x1b')][_0xbacb('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1a5c96,_0x35607b,_0x4f5655,_0x233df2){return new BPromise(function(_0x4e2a95,_0x134f80){var _0x3061c8=_0x233df2||client;return _0x3061c8[_0xbacb('0x1d')](_0x1a5c96,_0x4f5655)[_0xbacb('0x1e')](function(_0x37f56b){logger['info']('VoiceContext,\x20%s,\x20%s',_0x35607b,_0xbacb('0x1f'));logger[_0xbacb('0x20')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x35607b,_0xbacb('0x1f'),JSON[_0xbacb('0x21')](_0x37f56b));if(_0x37f56b[_0xbacb('0x22')]){if(_0x37f56b[_0xbacb('0x22')][_0xbacb('0x23')]===0x1f4){logger[_0xbacb('0x22')](_0xbacb('0x24'),_0x35607b,_0x37f56b[_0xbacb('0x22')][_0xbacb('0x25')]);return _0x134f80(_0x37f56b['error'][_0xbacb('0x25')]);}logger[_0xbacb('0x22')](_0xbacb('0x24'),_0x35607b,_0x37f56b[_0xbacb('0x22')][_0xbacb('0x25')]);return _0x4e2a95(_0x37f56b[_0xbacb('0x22')][_0xbacb('0x25')]);}else{logger[_0xbacb('0x26')](_0xbacb('0x24'),_0x35607b,'request\x20sent');_0x4e2a95(_0x37f56b[_0xbacb('0x27')][_0xbacb('0x25')]);}})[_0xbacb('0x28')](function(_0x3c8207){logger['error'](_0xbacb('0x24'),_0x35607b,_0x3c8207);_0x134f80(_0x3c8207);});});}function respondWithStatusCode(_0x43d616,_0x5cc6da){_0x5cc6da=_0x5cc6da||0xcc;return function(_0x2eb7dc){if(_0x2eb7dc){return _0x43d616[_0xbacb('0x29')](_0x5cc6da);}return _0x43d616[_0xbacb('0x2a')](_0x5cc6da)[_0xbacb('0x2b')]();};}function respondWithResult(_0x127a18,_0x4ed5f5){_0x4ed5f5=_0x4ed5f5||0xc8;return function(_0x2a2e20){if(_0x2a2e20){return _0x127a18[_0xbacb('0x2a')](_0x4ed5f5)['json'](_0x2a2e20);}};}function respondWithFilteredResult(_0xa0bfe2,_0x3cff6e){return function(_0xb8164b){if(_0xb8164b){var _0x4f5d3e=typeof _0x3cff6e['offset']===_0xbacb('0x2c')&&typeof _0x3cff6e[_0xbacb('0x2d')]===_0xbacb('0x2c');var _0x8f8c3b=_0xb8164b[_0xbacb('0x2e')];var _0x5cf5da=_0x4f5d3e?0x0:_0x3cff6e[_0xbacb('0x2f')];var _0x3391df=_0x4f5d3e?_0xb8164b[_0xbacb('0x2e')]:_0x3cff6e[_0xbacb('0x2f')]+_0x3cff6e[_0xbacb('0x2d')];var _0x1cfdc5;if(_0x3391df>=_0x8f8c3b){_0x3391df=_0x8f8c3b;_0x1cfdc5=0xc8;}else{_0x1cfdc5=0xce;}_0xa0bfe2[_0xbacb('0x2a')](_0x1cfdc5);return _0xa0bfe2[_0xbacb('0x30')](_0xbacb('0x31'),_0x5cf5da+'-'+_0x3391df+'/'+_0x8f8c3b)[_0xbacb('0x32')](_0xb8164b);}return null;};}function patchUpdates(_0x166799){return function(_0x309d3b){try{jsonpatch[_0xbacb('0x33')](_0x309d3b,_0x166799,!![]);}catch(_0x4bf3df){return BPromise['reject'](_0x4bf3df);}return _0x309d3b[_0xbacb('0x34')]();};}function saveUpdates(_0x146ebd,_0x4f40da){return function(_0x33e25f){if(_0x33e25f){return _0x33e25f['update'](_0x146ebd)[_0xbacb('0x1e')](function(_0x32e730){return _0x32e730;});}return null;};}function removeEntity(_0x56ed3c,_0x1342de){return function(_0x114548){if(_0x114548){return _0x114548['destroy']()[_0xbacb('0x1e')](function(){var _0x4de49c=_0x114548[_0xbacb('0x35')]({'plain':!![]});var _0xfe2b9e='Contexts';return db[_0xbacb('0x36')][_0xbacb('0x37')]({'where':{'type':_0xfe2b9e,'resourceId':_0x4de49c['id']}})[_0xbacb('0x1e')](function(){return _0x114548;});})['then'](function(){_0x56ed3c[_0xbacb('0x2a')](0xcc)[_0xbacb('0x2b')]();});}};}function handleEntityNotFound(_0x2cf55b,_0x1df881){return function(_0xf8bad6){if(!_0xf8bad6){_0x2cf55b['sendStatus'](0x194);}return _0xf8bad6;};}function handleError(_0x3609f5,_0x4e33d2){_0x4e33d2=_0x4e33d2||0x1f4;return function(_0x5ba10f){logger['error'](_0x5ba10f[_0xbacb('0x38')]);if(_0x5ba10f[_0xbacb('0x39')]){delete _0x5ba10f['name'];}_0x3609f5[_0xbacb('0x2a')](_0x4e33d2)['send'](_0x5ba10f);};}exports[_0xbacb('0x3a')]=function(_0x250ca7,_0x1fe657){var _0x2d25ac={},_0x512e8e={},_0x5bb5e4={'count':0x0,'rows':[]};var _0x9aab97=_[_0xbacb('0x3b')](db[_0xbacb('0x3c')][_0xbacb('0x3d')],function(_0x2ac9b3){return{'name':_0x2ac9b3['fieldName'],'type':_0x2ac9b3[_0xbacb('0x3e')][_0xbacb('0x3f')]};});_0x512e8e['model']=_[_0xbacb('0x3b')](_0x9aab97,_0xbacb('0x39'));_0x512e8e[_0xbacb('0x40')]=_[_0xbacb('0x41')](_0x250ca7[_0xbacb('0x40')]);_0x512e8e[_0xbacb('0x42')]=_[_0xbacb('0x43')](_0x512e8e[_0xbacb('0x44')],_0x512e8e[_0xbacb('0x40')]);_0x2d25ac[_0xbacb('0x45')]=_[_0xbacb('0x43')](_0x512e8e[_0xbacb('0x44')],qs[_0xbacb('0x46')](_0x250ca7[_0xbacb('0x40')][_0xbacb('0x46')]));_0x2d25ac[_0xbacb('0x45')]=_0x2d25ac['attributes']['length']?_0x2d25ac[_0xbacb('0x45')]:_0x512e8e[_0xbacb('0x44')];if(!_0x250ca7['query'][_0xbacb('0x47')](_0xbacb('0x48'))){_0x2d25ac[_0xbacb('0x2d')]=qs[_0xbacb('0x2d')](_0x250ca7['query'][_0xbacb('0x2d')]);_0x2d25ac[_0xbacb('0x2f')]=qs[_0xbacb('0x2f')](_0x250ca7[_0xbacb('0x40')]['offset']);}_0x2d25ac[_0xbacb('0x49')]=qs[_0xbacb('0x4a')](_0x250ca7[_0xbacb('0x40')][_0xbacb('0x4a')]);_0x2d25ac['where']=qs['filters'](_[_0xbacb('0x4b')](_0x250ca7[_0xbacb('0x40')],_0x512e8e[_0xbacb('0x42')]),_0x9aab97);if(_0x250ca7[_0xbacb('0x40')][_0xbacb('0x4c')]){_0x2d25ac['where']=_['merge'](_0x2d25ac[_0xbacb('0x4d')],{'$or':_[_0xbacb('0x3b')](_0x9aab97,function(_0x483d1c){if(_0x483d1c[_0xbacb('0x3e')]!=='VIRTUAL'){var _0xcbb8a7={};_0xcbb8a7[_0x483d1c[_0xbacb('0x39')]]={'$like':'%'+_0x250ca7[_0xbacb('0x40')][_0xbacb('0x4c')]+'%'};return _0xcbb8a7;}})});}_0x2d25ac=_['merge']({},_0x2d25ac,_0x250ca7[_0xbacb('0x4e')]);var _0x159f7b={'where':_0x2d25ac['where']};return db[_0xbacb('0x3c')]['count'](_0x159f7b)[_0xbacb('0x1e')](function(_0x7d7e5a){_0x5bb5e4[_0xbacb('0x2e')]=_0x7d7e5a;if(_0x250ca7[_0xbacb('0x40')][_0xbacb('0x4f')]){_0x2d25ac[_0xbacb('0x50')]=[{'all':!![]}];}return db[_0xbacb('0x3c')][_0xbacb('0x51')](_0x2d25ac);})[_0xbacb('0x1e')](function(_0x20154f){_0x5bb5e4['rows']=_0x20154f;return _0x5bb5e4;})['then'](respondWithFilteredResult(_0x1fe657,_0x2d25ac))[_0xbacb('0x28')](handleError(_0x1fe657,null));};exports[_0xbacb('0x52')]=function(_0x1873a1,_0x22aa77){var _0x22fc58={'raw':![],'where':{'id':_0x1873a1['params']['id']}},_0x1126e1={};_0x1126e1[_0xbacb('0x44')]=_[_0xbacb('0x41')](db[_0xbacb('0x3c')][_0xbacb('0x3d')]);_0x1126e1['query']=_[_0xbacb('0x41')](_0x1873a1[_0xbacb('0x40')]);_0x1126e1[_0xbacb('0x42')]=_[_0xbacb('0x43')](_0x1126e1[_0xbacb('0x44')],_0x1126e1['query']);_0x22fc58[_0xbacb('0x45')]=_[_0xbacb('0x43')](_0x1126e1['model'],qs[_0xbacb('0x46')](_0x1873a1[_0xbacb('0x40')][_0xbacb('0x46')]));_0x22fc58[_0xbacb('0x45')]=_0x22fc58[_0xbacb('0x45')][_0xbacb('0x53')]?_0x22fc58[_0xbacb('0x45')]:_0x1126e1[_0xbacb('0x44')];if(_0x1873a1['query']['includeAll']){_0x22fc58['include']=[{'all':!![]}];}_0x22fc58=_[_0xbacb('0x54')]({},_0x22fc58,_0x1873a1[_0xbacb('0x4e')]);return db[_0xbacb('0x3c')]['find'](_0x22fc58)[_0xbacb('0x1e')](handleEntityNotFound(_0x22aa77,null))['then'](respondWithResult(_0x22aa77,null))[_0xbacb('0x28')](handleError(_0x22aa77,null));};exports[_0xbacb('0x55')]=function(_0x143582,_0xe66fb2,_0x282d0c){var _0x111d14;return db[_0xbacb('0x3c')][_0xbacb('0x55')](_0x143582[_0xbacb('0x56')],{'raw':!![]})[_0xbacb('0x1e')](function(_0x1a7b9d){_0x111d14=_0x1a7b9d;return db['VoiceContext'][_0xbacb('0x51')]({'raw':!![]});})[_0xbacb('0x1e')](function(_0x3d7504){var _0x9f0342=fs[_0xbacb('0x57')](path[_0xbacb('0x58')](config['root'],_0xbacb('0x59')),_0xbacb('0x5a'));var _0x5b5958=ejs[_0xbacb('0x5b')](_0x9f0342,{'contexts':_0x3d7504||[]});fs[_0xbacb('0x5c')](_0xbacb('0x5d'),_0x5b5958);})[_0xbacb('0x1e')](function(){return respondWithRpcPromise(_0xbacb('0x5e'),_0xbacb('0x55'),{'module':_0xbacb('0x5f')});})['then'](function(){var _0x3a3b40=_0x143582[_0xbacb('0x60')][_0xbacb('0x35')]({'plain':!![]});if(!_0x3a3b40)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a3b40[_0xbacb('0x61')]==='user'){var _0xbe539c=_0x111d14[_0xbacb('0x35')]({'plain':!![]});return db[_0xbacb('0x62')]['find']({'where':{'name':_0xbacb('0x63'),'userProfileId':_0x3a3b40[_0xbacb('0x64')]},'raw':!![]})[_0xbacb('0x1e')](function(_0x3934f8){if(_0x3934f8&&_0x3934f8['autoAssociation']===0x0){return db[_0xbacb('0x36')][_0xbacb('0x55')]({'name':_0xbe539c[_0xbacb('0x39')],'resourceId':_0xbe539c['id'],'type':_0x3934f8[_0xbacb('0x39')],'sectionId':_0x3934f8['id']},{})[_0xbacb('0x1e')](function(){return _0x111d14;});}else{return _0x111d14;}})['catch'](function(_0x355d43){logger['error'](_0xbacb('0x65'),_0x355d43);throw _0x355d43;});}return _0x111d14;})[_0xbacb('0x1e')](respondWithResult(_0xe66fb2,0xc9))[_0xbacb('0x28')](handleError(_0xe66fb2,null));};exports[_0xbacb('0x66')]=function(_0x9e4043,_0x4b5114,_0x11a3c1){var _0x3a92b2;return db[_0xbacb('0x3c')][_0xbacb('0x67')]({'where':{'id':_0x9e4043[_0xbacb('0x68')]['id']}})[_0xbacb('0x1e')](handleEntityNotFound(_0x4b5114,null))[_0xbacb('0x1e')](saveUpdates(_0x9e4043[_0xbacb('0x56')],null))[_0xbacb('0x1e')](function(_0x5f5d9f){if(_0x5f5d9f){_0x3a92b2=_0x5f5d9f;return db[_0xbacb('0x3c')][_0xbacb('0x51')]({'raw':!![]});}})[_0xbacb('0x1e')](function(_0x134057){var _0x54e37b=fs[_0xbacb('0x57')](path[_0xbacb('0x58')](config[_0xbacb('0x69')],_0xbacb('0x59')),_0xbacb('0x5a'));var _0x345284=ejs['render'](_0x54e37b,{'contexts':_0x134057||[]});fs[_0xbacb('0x5c')](_0xbacb('0x5d'),_0x345284);})[_0xbacb('0x1e')](function(){return respondWithRpcPromise(_0xbacb('0x5e'),'update',{'module':_0xbacb('0x5f')});})[_0xbacb('0x1e')](function(){return _0x3a92b2;})[_0xbacb('0x1e')](respondWithResult(_0x4b5114,null))[_0xbacb('0x28')](handleError(_0x4b5114,null));};exports[_0xbacb('0x37')]=function(_0x5d419c,_0x24100f,_0x28f6b2){var _0x7da1da;return db['VoiceContext'][_0xbacb('0x67')]({'where':{'id':_0x5d419c[_0xbacb('0x68')]['id']}})['then'](handleEntityNotFound(_0x24100f,null))[_0xbacb('0x1e')](removeEntity(_0x24100f,null))[_0xbacb('0x1e')](function(){return db[_0xbacb('0x3c')][_0xbacb('0x51')]({'raw':!![]});})[_0xbacb('0x1e')](function(_0x2529b7){var _0x3acac4=fs['readFileSync'](path[_0xbacb('0x58')](config[_0xbacb('0x69')],_0xbacb('0x59')),_0xbacb('0x5a'));var _0x1d5de5=ejs[_0xbacb('0x5b')](_0x3acac4,{'contexts':_0x2529b7});fs[_0xbacb('0x5c')](_0xbacb('0x5d'),_0x1d5de5);return respondWithRpcPromise(_0xbacb('0x5e'),_0xbacb('0x37'),{'module':_0xbacb('0x5f')});})[_0xbacb('0x28')](handleError(_0x24100f,null));}; \ No newline at end of file +var _0xa189=['options','includeAll','include','findAll','rows','catch','show','fields','length','body','readFileSync','join','root','server/files/templates/context.ejs','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','create','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','utf8','render','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','info','request\x20sent','debug','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','Contexts','UserProfileResource','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL'];(function(_0x560e64,_0x219b88){var _0x4002bc=function(_0x4ea91f){while(--_0x4ea91f){_0x560e64['push'](_0x560e64['shift']());}};_0x4002bc(++_0x219b88);}(_0xa189,0xf0));var _0x9a18=function(_0x281820,_0x322992){_0x281820=_0x281820-0x0;var _0x4a0100=_0xa189[_0x281820];return _0x4a0100;};'use strict';var emlformat=require(_0x9a18('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9a18('0x1'));var jsonpatch=require(_0x9a18('0x2'));var rp=require(_0x9a18('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9a18('0x4'));var util=require(_0x9a18('0x5'));var path=require(_0x9a18('0x6'));var sox=require(_0x9a18('0x7'));var csv=require(_0x9a18('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9a18('0x9'));var _=require(_0x9a18('0xa'));var squel=require('squel');var crypto=require(_0x9a18('0xb'));var jsforce=require(_0x9a18('0xc'));var deskjs=require(_0x9a18('0xd'));var toCsv=require(_0x9a18('0x8'));var querystring=require(_0x9a18('0xe'));var Papa=require('papaparse');var Redis=require(_0x9a18('0xf'));var authService=require(_0x9a18('0x10'));var qs=require(_0x9a18('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a18('0x12'))(_0x9a18('0x13'));var utils=require('../../config/utils');var config=require(_0x9a18('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9a18('0x15'))['db'];var jayson=require(_0x9a18('0x16'));var client=jayson[_0x9a18('0x17')][_0x9a18('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x28e266,_0x2aeb28,_0x4035ea,_0x5da125){return new BPromise(function(_0xff5e,_0x55b7e8){var _0x1a3208=_0x5da125||client;return _0x1a3208['request'](_0x28e266,_0x4035ea)['then'](function(_0x29399e){logger[_0x9a18('0x19')]('VoiceContext,\x20%s,\x20%s',_0x2aeb28,_0x9a18('0x1a'));logger[_0x9a18('0x1b')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x2aeb28,'request\x20sent',JSON[_0x9a18('0x1c')](_0x29399e));if(_0x29399e[_0x9a18('0x1d')]){if(_0x29399e[_0x9a18('0x1d')][_0x9a18('0x1e')]===0x1f4){logger[_0x9a18('0x1d')](_0x9a18('0x1f'),_0x2aeb28,_0x29399e[_0x9a18('0x1d')][_0x9a18('0x20')]);return _0x55b7e8(_0x29399e[_0x9a18('0x1d')][_0x9a18('0x20')]);}logger['error'](_0x9a18('0x1f'),_0x2aeb28,_0x29399e[_0x9a18('0x1d')][_0x9a18('0x20')]);return _0xff5e(_0x29399e[_0x9a18('0x1d')]['message']);}else{logger[_0x9a18('0x19')]('VoiceContext,\x20%s,\x20%s',_0x2aeb28,_0x9a18('0x1a'));_0xff5e(_0x29399e[_0x9a18('0x21')][_0x9a18('0x20')]);}})['catch'](function(_0x507e4a){logger[_0x9a18('0x1d')](_0x9a18('0x1f'),_0x2aeb28,_0x507e4a);_0x55b7e8(_0x507e4a);});});}function respondWithStatusCode(_0x1957a2,_0x11eb95){_0x11eb95=_0x11eb95||0xcc;return function(_0x15d59e){if(_0x15d59e){return _0x1957a2[_0x9a18('0x22')](_0x11eb95);}return _0x1957a2[_0x9a18('0x23')](_0x11eb95)['end']();};}function respondWithResult(_0x22f17a,_0x589201){_0x589201=_0x589201||0xc8;return function(_0x529c78){if(_0x529c78){return _0x22f17a['status'](_0x589201)['json'](_0x529c78);}};}function respondWithFilteredResult(_0x33980b,_0x3cefc7){return function(_0x5e73ba){if(_0x5e73ba){var _0x44a014=typeof _0x3cefc7[_0x9a18('0x24')]===_0x9a18('0x25')&&typeof _0x3cefc7[_0x9a18('0x26')]===_0x9a18('0x25');var _0xd18c8a=_0x5e73ba['count'];var _0x533fcb=_0x44a014?0x0:_0x3cefc7['offset'];var _0x1794e1=_0x44a014?_0x5e73ba[_0x9a18('0x27')]:_0x3cefc7[_0x9a18('0x24')]+_0x3cefc7[_0x9a18('0x26')];var _0x101cb5;if(_0x1794e1>=_0xd18c8a){_0x1794e1=_0xd18c8a;_0x101cb5=0xc8;}else{_0x101cb5=0xce;}_0x33980b[_0x9a18('0x23')](_0x101cb5);return _0x33980b[_0x9a18('0x28')](_0x9a18('0x29'),_0x533fcb+'-'+_0x1794e1+'/'+_0xd18c8a)['json'](_0x5e73ba);}return null;};}function patchUpdates(_0x49a2e9){return function(_0x2be310){try{jsonpatch[_0x9a18('0x2a')](_0x2be310,_0x49a2e9,!![]);}catch(_0xd96379){return BPromise['reject'](_0xd96379);}return _0x2be310[_0x9a18('0x2b')]();};}function saveUpdates(_0x2f12ce,_0x5e01a3){return function(_0x2d18c1){if(_0x2d18c1){return _0x2d18c1['update'](_0x2f12ce)[_0x9a18('0x2c')](function(_0x224920){return _0x224920;});}return null;};}function removeEntity(_0x3c3db6,_0x1db393){return function(_0xfc5aeb){if(_0xfc5aeb){return _0xfc5aeb[_0x9a18('0x2d')]()[_0x9a18('0x2c')](function(){var _0x30b162=_0xfc5aeb['get']({'plain':!![]});var _0x4e0c8e=_0x9a18('0x2e');return db[_0x9a18('0x2f')]['destroy']({'where':{'type':_0x4e0c8e,'resourceId':_0x30b162['id']}})[_0x9a18('0x2c')](function(){return _0xfc5aeb;});})[_0x9a18('0x2c')](function(){_0x3c3db6[_0x9a18('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31dbfc,_0x166892){return function(_0x4ba4a5){if(!_0x4ba4a5){_0x31dbfc[_0x9a18('0x22')](0x194);}return _0x4ba4a5;};}function handleError(_0x18ac1f,_0x3399d0){_0x3399d0=_0x3399d0||0x1f4;return function(_0x3c9c99){logger[_0x9a18('0x1d')](_0x3c9c99[_0x9a18('0x30')]);if(_0x3c9c99['name']){delete _0x3c9c99[_0x9a18('0x31')];}_0x18ac1f[_0x9a18('0x23')](_0x3399d0)[_0x9a18('0x32')](_0x3c9c99);};}exports[_0x9a18('0x33')]=function(_0x2d052b,_0x22c4c1){var _0xdc04be={},_0x39e9b1={},_0x49c80d={'count':0x0,'rows':[]};var _0x14a8d7=_[_0x9a18('0x34')](db[_0x9a18('0x35')][_0x9a18('0x36')],function(_0x3637b5){return{'name':_0x3637b5[_0x9a18('0x37')],'type':_0x3637b5['type'][_0x9a18('0x38')]};});_0x39e9b1[_0x9a18('0x39')]=_[_0x9a18('0x34')](_0x14a8d7,_0x9a18('0x31'));_0x39e9b1[_0x9a18('0x3a')]=_[_0x9a18('0x3b')](_0x2d052b['query']);_0x39e9b1[_0x9a18('0x3c')]=_[_0x9a18('0x3d')](_0x39e9b1[_0x9a18('0x39')],_0x39e9b1[_0x9a18('0x3a')]);_0xdc04be[_0x9a18('0x3e')]=_[_0x9a18('0x3d')](_0x39e9b1['model'],qs['fields'](_0x2d052b['query']['fields']));_0xdc04be[_0x9a18('0x3e')]=_0xdc04be['attributes']['length']?_0xdc04be[_0x9a18('0x3e')]:_0x39e9b1['model'];if(!_0x2d052b['query'][_0x9a18('0x3f')](_0x9a18('0x40'))){_0xdc04be[_0x9a18('0x26')]=qs[_0x9a18('0x26')](_0x2d052b['query'][_0x9a18('0x26')]);_0xdc04be[_0x9a18('0x24')]=qs[_0x9a18('0x24')](_0x2d052b[_0x9a18('0x3a')][_0x9a18('0x24')]);}_0xdc04be['order']=qs[_0x9a18('0x41')](_0x2d052b[_0x9a18('0x3a')][_0x9a18('0x41')]);_0xdc04be[_0x9a18('0x42')]=qs['filters'](_[_0x9a18('0x43')](_0x2d052b[_0x9a18('0x3a')],_0x39e9b1[_0x9a18('0x3c')]),_0x14a8d7);if(_0x2d052b[_0x9a18('0x3a')][_0x9a18('0x44')]){_0xdc04be[_0x9a18('0x42')]=_[_0x9a18('0x45')](_0xdc04be[_0x9a18('0x42')],{'$or':_[_0x9a18('0x34')](_0x14a8d7,function(_0x29a22b){if(_0x29a22b[_0x9a18('0x46')]!==_0x9a18('0x47')){var _0x5b2910={};_0x5b2910[_0x29a22b[_0x9a18('0x31')]]={'$like':'%'+_0x2d052b[_0x9a18('0x3a')]['filter']+'%'};return _0x5b2910;}})});}_0xdc04be=_[_0x9a18('0x45')]({},_0xdc04be,_0x2d052b[_0x9a18('0x48')]);var _0x5b9254={'where':_0xdc04be[_0x9a18('0x42')]};return db[_0x9a18('0x35')][_0x9a18('0x27')](_0x5b9254)[_0x9a18('0x2c')](function(_0x878ec8){_0x49c80d[_0x9a18('0x27')]=_0x878ec8;if(_0x2d052b['query'][_0x9a18('0x49')]){_0xdc04be[_0x9a18('0x4a')]=[{'all':!![]}];}return db[_0x9a18('0x35')][_0x9a18('0x4b')](_0xdc04be);})['then'](function(_0x23ef1b){_0x49c80d[_0x9a18('0x4c')]=_0x23ef1b;return _0x49c80d;})[_0x9a18('0x2c')](respondWithFilteredResult(_0x22c4c1,_0xdc04be))[_0x9a18('0x4d')](handleError(_0x22c4c1,null));};exports[_0x9a18('0x4e')]=function(_0x5d8230,_0x3e953e){var _0x4dd8ee={'raw':![],'where':{'id':_0x5d8230['params']['id']}},_0x44d648={};_0x44d648[_0x9a18('0x39')]=_['keys'](db[_0x9a18('0x35')]['rawAttributes']);_0x44d648[_0x9a18('0x3a')]=_[_0x9a18('0x3b')](_0x5d8230[_0x9a18('0x3a')]);_0x44d648[_0x9a18('0x3c')]=_[_0x9a18('0x3d')](_0x44d648['model'],_0x44d648[_0x9a18('0x3a')]);_0x4dd8ee['attributes']=_['intersection'](_0x44d648[_0x9a18('0x39')],qs[_0x9a18('0x4f')](_0x5d8230[_0x9a18('0x3a')][_0x9a18('0x4f')]));_0x4dd8ee['attributes']=_0x4dd8ee[_0x9a18('0x3e')][_0x9a18('0x50')]?_0x4dd8ee[_0x9a18('0x3e')]:_0x44d648[_0x9a18('0x39')];if(_0x5d8230['query'][_0x9a18('0x49')]){_0x4dd8ee[_0x9a18('0x4a')]=[{'all':!![]}];}_0x4dd8ee=_[_0x9a18('0x45')]({},_0x4dd8ee,_0x5d8230[_0x9a18('0x48')]);return db[_0x9a18('0x35')]['find'](_0x4dd8ee)[_0x9a18('0x2c')](handleEntityNotFound(_0x3e953e,null))[_0x9a18('0x2c')](respondWithResult(_0x3e953e,null))[_0x9a18('0x4d')](handleError(_0x3e953e,null));};exports['create']=function(_0x3c0702,_0x1f4909,_0x448772){var _0x360586;return db[_0x9a18('0x35')]['create'](_0x3c0702[_0x9a18('0x51')],{'raw':!![]})[_0x9a18('0x2c')](function(_0x5f1a33){_0x360586=_0x5f1a33;return db[_0x9a18('0x35')][_0x9a18('0x4b')]({'raw':!![]});})[_0x9a18('0x2c')](function(_0x4a08d4){var _0x29c74d=fs[_0x9a18('0x52')](path[_0x9a18('0x53')](config[_0x9a18('0x54')],_0x9a18('0x55')),'utf8');var _0x4b12bc=ejs['render'](_0x29c74d,{'contexts':_0x4a08d4||[]});fs[_0x9a18('0x56')](_0x9a18('0x57'),_0x4b12bc);})[_0x9a18('0x2c')](function(){return respondWithRpcPromise(_0x9a18('0x58'),_0x9a18('0x59'),{'module':_0x9a18('0x5a')});})[_0x9a18('0x2c')](function(){var _0xb4a27c=_0x3c0702[_0x9a18('0x5b')][_0x9a18('0x5c')]({'plain':!![]});if(!_0xb4a27c)throw new Error(_0x9a18('0x5d'));if(_0xb4a27c[_0x9a18('0x5e')]==='user'){var _0x12755b=_0x360586[_0x9a18('0x5c')]({'plain':!![]});return db[_0x9a18('0x5f')][_0x9a18('0x60')]({'where':{'name':_0x9a18('0x2e'),'userProfileId':_0xb4a27c[_0x9a18('0x61')]},'raw':!![]})[_0x9a18('0x2c')](function(_0x32998f){if(_0x32998f&&_0x32998f[_0x9a18('0x62')]===0x0){return db[_0x9a18('0x2f')]['create']({'name':_0x12755b[_0x9a18('0x31')],'resourceId':_0x12755b['id'],'type':_0x32998f[_0x9a18('0x31')],'sectionId':_0x32998f['id']},{})['then'](function(){return _0x360586;});}else{return _0x360586;}})[_0x9a18('0x4d')](function(_0x2f20e7){logger['error'](_0x9a18('0x63'),_0x2f20e7);throw _0x2f20e7;});}return _0x360586;})[_0x9a18('0x2c')](respondWithResult(_0x1f4909,0xc9))[_0x9a18('0x4d')](handleError(_0x1f4909,null));};exports[_0x9a18('0x64')]=function(_0x480703,_0x5a7826,_0x21db9a){var _0x54856c;return db[_0x9a18('0x35')]['find']({'where':{'id':_0x480703[_0x9a18('0x65')]['id']}})[_0x9a18('0x2c')](handleEntityNotFound(_0x5a7826,null))[_0x9a18('0x2c')](saveUpdates(_0x480703[_0x9a18('0x51')],null))['then'](function(_0x66a61){if(_0x66a61){_0x54856c=_0x66a61;return db[_0x9a18('0x35')]['findAll']({'raw':!![]});}})[_0x9a18('0x2c')](function(_0x857ce9){var _0x57d5a2=fs[_0x9a18('0x52')](path['join'](config[_0x9a18('0x54')],_0x9a18('0x55')),_0x9a18('0x66'));var _0x2ac5a2=ejs[_0x9a18('0x67')](_0x57d5a2,{'contexts':_0x857ce9||[]});fs[_0x9a18('0x56')](_0x9a18('0x57'),_0x2ac5a2);})[_0x9a18('0x2c')](function(){return respondWithRpcPromise(_0x9a18('0x58'),_0x9a18('0x64'),{'module':'chan_sip.so'});})[_0x9a18('0x2c')](function(){return _0x54856c;})['then'](respondWithResult(_0x5a7826,null))[_0x9a18('0x4d')](handleError(_0x5a7826,null));};exports['destroy']=function(_0x474000,_0x8af39f,_0x2d5e68){var _0x200420;return db['VoiceContext'][_0x9a18('0x60')]({'where':{'id':_0x474000[_0x9a18('0x65')]['id']}})['then'](handleEntityNotFound(_0x8af39f,null))[_0x9a18('0x2c')](removeEntity(_0x8af39f,null))['then'](function(){return db['VoiceContext'][_0x9a18('0x4b')]({'raw':!![]});})[_0x9a18('0x2c')](function(_0x5239f6){var _0x5c3c7d=fs[_0x9a18('0x52')](path[_0x9a18('0x53')](config[_0x9a18('0x54')],_0x9a18('0x55')),_0x9a18('0x66'));var _0x4040f8=ejs[_0x9a18('0x67')](_0x5c3c7d,{'contexts':_0x5239f6});fs[_0x9a18('0x56')](_0x9a18('0x57'),_0x4040f8);return respondWithRpcPromise(_0x9a18('0x58'),_0x9a18('0x2d'),{'module':_0x9a18('0x5a')});})['catch'](handleError(_0x8af39f,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 435ae6a..0088f1e 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 _0x11cc=['./voiceContext.attributes','exports','define','voice_contexts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4ce048,_0x27a6fd){var _0x4c6524=function(_0x3319e8){while(--_0x3319e8){_0x4ce048['push'](_0x4ce048['shift']());}};_0x4c6524(++_0x27a6fd);}(_0x11cc,0x1d8));var _0xc11c=function(_0x37d9b1,_0x358b0d){_0x37d9b1=_0x37d9b1-0x0;var _0x580044=_0x11cc[_0x37d9b1];return _0x580044;};'use strict';var _=require(_0xc11c('0x0'));var util=require('util');var logger=require(_0xc11c('0x1'))(_0xc11c('0x2'));var moment=require(_0xc11c('0x3'));var BPromise=require(_0xc11c('0x4'));var rp=require(_0xc11c('0x5'));var fs=require('fs');var path=require(_0xc11c('0x6'));var rimraf=require(_0xc11c('0x7'));var config=require(_0xc11c('0x8'));var attributes=require(_0xc11c('0x9'));module[_0xc11c('0xa')]=function(_0x154f5c,_0x24cc7e){return _0x154f5c[_0xc11c('0xb')]('VoiceContext',attributes,{'tableName':_0xc11c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9ed=['../../config/environment','./voiceContext.attributes','exports','VoiceContext','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x3af68e,_0x384315){var _0x3e6d5b=function(_0x21e40c){while(--_0x21e40c){_0x3af68e['push'](_0x3af68e['shift']());}};_0x3e6d5b(++_0x384315);}(_0xb9ed,0x1bc));var _0xdb9e=function(_0x183737,_0x4132a1){_0x183737=_0x183737-0x0;var _0x4fba8a=_0xb9ed[_0x183737];return _0x4fba8a;};'use strict';var _=require(_0xdb9e('0x0'));var util=require('util');var logger=require(_0xdb9e('0x1'))('api');var moment=require(_0xdb9e('0x2'));var BPromise=require(_0xdb9e('0x3'));var rp=require(_0xdb9e('0x4'));var fs=require('fs');var path=require(_0xdb9e('0x5'));var rimraf=require(_0xdb9e('0x6'));var config=require(_0xdb9e('0x7'));var attributes=require(_0xdb9e('0x8'));module[_0xdb9e('0x9')]=function(_0x4a4bad,_0x1ccecd){return _0x4a4bad['define'](_0xdb9e('0xa'),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 d04b3ff..e4a2d9f 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 _0xf269=['info','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VoiceContext,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x1ac2d6,_0xb74fe7){var _0x4b4bf4=function(_0x4f7486){while(--_0x4f7486){_0x1ac2d6['push'](_0x1ac2d6['shift']());}};_0x4b4bf4(++_0xb74fe7);}(_0xf269,0xd2));var _0x9f26=function(_0x32cefe,_0x1befba){_0x32cefe=_0x32cefe-0x0;var _0x283e79=_0xf269[_0x32cefe];return _0x283e79;};'use strict';var _=require('lodash');var util=require(_0x9f26('0x0'));var moment=require(_0x9f26('0x1'));var BPromise=require('bluebird');var rs=require(_0x9f26('0x2'));var fs=require('fs');var Redis=require(_0x9f26('0x3'));var db=require(_0x9f26('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9f26('0x5'))('rpc');var config=require(_0x9f26('0x6'));var jayson=require(_0x9f26('0x7'));var client=jayson[_0x9f26('0x8')][_0x9f26('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xfa0f44,_0x10b905,_0x4700a8){return new BPromise(function(_0x14a6ba,_0x5bece0){return client['request'](_0xfa0f44,_0x4700a8)['then'](function(_0x19f7b8){logger[_0x9f26('0xa')]('VoiceContext,\x20%s,\x20%s',_0x10b905,'request\x20sent');logger[_0x9f26('0xb')](_0x9f26('0xc'),_0x10b905,_0x9f26('0xd'),JSON[_0x9f26('0xe')](_0x19f7b8));if(_0x19f7b8['error']){if(_0x19f7b8['error']['code']===0x1f4){logger[_0x9f26('0xf')](_0x9f26('0x10'),_0x10b905,_0x19f7b8['error'][_0x9f26('0x11')]);return _0x5bece0(_0x19f7b8[_0x9f26('0xf')][_0x9f26('0x11')]);}logger[_0x9f26('0xf')](_0x9f26('0x10'),_0x10b905,_0x19f7b8['error'][_0x9f26('0x11')]);return _0x14a6ba(_0x19f7b8[_0x9f26('0xf')][_0x9f26('0x11')]);}else{logger['info'](_0x9f26('0x10'),_0x10b905,_0x9f26('0xd'));_0x14a6ba(_0x19f7b8[_0x9f26('0x12')][_0x9f26('0x11')]);}})[_0x9f26('0x13')](function(_0x542567){logger[_0x9f26('0xf')](_0x9f26('0x10'),_0x10b905,_0x542567);_0x5bece0(_0x542567);});});} \ No newline at end of file +var _0x7348=['info','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x18313b,_0x5c914f){var _0x2ba97d=function(_0x41143d){while(--_0x41143d){_0x18313b['push'](_0x18313b['shift']());}};_0x2ba97d(++_0x5c914f);}(_0x7348,0x16b));var _0x8734=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x7348[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0x8734('0x0'));var moment=require(_0x8734('0x1'));var BPromise=require('bluebird');var rs=require(_0x8734('0x2'));var fs=require('fs');var Redis=require(_0x8734('0x3'));var db=require(_0x8734('0x4'))['db'];var utils=require(_0x8734('0x5'));var logger=require(_0x8734('0x6'))('rpc');var config=require(_0x8734('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8734('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11505f,_0x3dbaf1,_0x409987){return new BPromise(function(_0x4b55fc,_0x282efb){return client['request'](_0x11505f,_0x409987)['then'](function(_0xb06875){logger['info'](_0x8734('0x9'),_0x3dbaf1,'request\x20sent');logger[_0x8734('0xa')](_0x8734('0xb'),_0x3dbaf1,_0x8734('0xc'),JSON[_0x8734('0xd')](_0xb06875));if(_0xb06875['error']){if(_0xb06875[_0x8734('0xe')][_0x8734('0xf')]===0x1f4){logger[_0x8734('0xe')](_0x8734('0x9'),_0x3dbaf1,_0xb06875[_0x8734('0xe')][_0x8734('0x10')]);return _0x282efb(_0xb06875[_0x8734('0xe')]['message']);}logger[_0x8734('0xe')]('VoiceContext,\x20%s,\x20%s',_0x3dbaf1,_0xb06875['error']['message']);return _0x4b55fc(_0xb06875[_0x8734('0xe')][_0x8734('0x10')]);}else{logger[_0x8734('0x11')](_0x8734('0x9'),_0x3dbaf1,_0x8734('0xc'));_0x4b55fc(_0xb06875['result'][_0x8734('0x10')]);}})[_0x8734('0x12')](function(_0x5b1663){logger[_0x8734('0xe')](_0x8734('0x9'),_0x3dbaf1,_0x5b1663);_0x282efb(_0x5b1663);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index cfdedcc..7fca789 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 _0xb78e=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','index'];(function(_0x3ffc10,_0x3929ec){var _0x995678=function(_0x4572c7){while(--_0x4572c7){_0x3ffc10['push'](_0x3ffc10['shift']());}};_0x995678(++_0x3929ec);}(_0xb78e,0xf9));var _0xeb78=function(_0x285390,_0x224549){_0x285390=_0x285390-0x0;var _0x51960a=_0xb78e[_0x285390];return _0x51960a;};'use strict';var multer=require(_0xeb78('0x0'));var util=require(_0xeb78('0x1'));var path=require(_0xeb78('0x2'));var timeout=require(_0xeb78('0x3'));var express=require(_0xeb78('0x4'));var router=express['Router']();var fs_extra=require(_0xeb78('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xeb78('0x6'));var config=require('../../config/environment');var controller=require(_0xeb78('0x7'));router[_0xeb78('0x8')]('/',auth[_0xeb78('0x9')](),controller[_0xeb78('0xa')]);router['get']('/describe',auth[_0xeb78('0x9')](),controller['describe']);router['get'](_0xeb78('0xb'),auth['isAuthenticated'](),controller[_0xeb78('0xc')]);router[_0xeb78('0xd')]('/',auth[_0xeb78('0x9')](),controller[_0xeb78('0xe')]);router[_0xeb78('0xf')](_0xeb78('0xb'),auth[_0xeb78('0x9')](),controller[_0xeb78('0x10')]);router[_0xeb78('0x11')]('/:id',auth[_0xeb78('0x9')](),controller[_0xeb78('0x12')]);module[_0xeb78('0x13')]=router; \ No newline at end of file +var _0x2c51=['update','/:id','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','isAuthenticated','index','get','describe','show','post','create'];(function(_0x2f9738,_0xa4020e){var _0x556105=function(_0x3afcca){while(--_0x3afcca){_0x2f9738['push'](_0x2f9738['shift']());}};_0x556105(++_0xa4020e);}(_0x2c51,0x1a5));var _0x12c5=function(_0x2c2db3,_0x9997f6){_0x2c2db3=_0x2c2db3-0x0;var _0x3284e8=_0x2c51[_0x2c2db3];return _0x3284e8;};'use strict';var multer=require(_0x12c5('0x0'));var util=require(_0x12c5('0x1'));var path=require(_0x12c5('0x2'));var timeout=require('connect-timeout');var express=require(_0x12c5('0x3'));var router=express[_0x12c5('0x4')]();var fs_extra=require(_0x12c5('0x5'));var auth=require(_0x12c5('0x6'));var interaction=require(_0x12c5('0x7'));var config=require('../../config/environment');var controller=require(_0x12c5('0x8'));router['get']('/',auth[_0x12c5('0x9')](),controller[_0x12c5('0xa')]);router[_0x12c5('0xb')]('/describe',auth[_0x12c5('0x9')](),controller[_0x12c5('0xc')]);router[_0x12c5('0xb')]('/:id',auth[_0x12c5('0x9')](),controller[_0x12c5('0xd')]);router[_0x12c5('0xe')]('/',auth[_0x12c5('0x9')](),controller[_0x12c5('0xf')]);router['put']('/:id',auth[_0x12c5('0x9')](),controller[_0x12c5('0x10')]);router['delete'](_0x12c5('0x11'),auth[_0x12c5('0x9')](),controller[_0x12c5('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 6dad475..db3dd1c 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 _0x9c44=['STRING','INTEGER','DATE','called,connect,complete'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'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 +var _0x008c=['INTEGER','DATE','sequelize','exports','STRING'];(function(_0x16bd94,_0x3792be){var _0x47fac4=function(_0x9ee632){while(--_0x9ee632){_0x16bd94['push'](_0x16bd94['shift']());}};_0x47fac4(++_0x3792be);}(_0x008c,0x188));var _0xc008=function(_0x5257b7,_0x4f42d6){_0x5257b7=_0x5257b7-0x0;var _0x5a8139=_0x008c[_0x5257b7];return _0x5a8139;};'use strict';var Sequelize=require(_0xc008('0x0'));module[_0xc008('0x1')]={'privilege':{'type':Sequelize[_0xc008('0x2')]},'channel':{'type':Sequelize[_0xc008('0x2')]},'channelstate':{'type':Sequelize[_0xc008('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc008('0x2')]},'calleridname':{'type':Sequelize[_0xc008('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc008('0x2')]},'connectedlinename':{'type':Sequelize[_0xc008('0x2')]},'language':{'type':Sequelize[_0xc008('0x2')]},'accountcode':{'type':Sequelize[_0xc008('0x2')]},'context':{'type':Sequelize[_0xc008('0x2')]},'exten':{'type':Sequelize[_0xc008('0x2')]},'priority':{'type':Sequelize[_0xc008('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xc008('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xc008('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xc008('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc008('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xc008('0x2')]},'destexten':{'type':Sequelize[_0xc008('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xc008('0x2')]},'destlinkedid':{'type':Sequelize[_0xc008('0x2')]},'dialstring':{'type':Sequelize[_0xc008('0x2')]},'dialstatus':{'type':Sequelize[_0xc008('0x2')]},'starttime':{'type':Sequelize[_0xc008('0x4')]},'answertime':{'type':Sequelize[_0xc008('0x4')]},'endtime':{'type':Sequelize[_0xc008('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xc008('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xc008('0x3')]},'billableseconds':{'type':Sequelize[_0xc008('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 03fade1..9f1e35b 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 _0xfc31=['then','destroy','name','send','index','map','VoiceDialReport','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','rows','catch','params','rawAttributes','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update'];(function(_0x131623,_0x4d5abb){var _0x5d03b6=function(_0x38f446){while(--_0x38f446){_0x131623['push'](_0x131623['shift']());}};_0x5d03b6(++_0x4d5abb);}(_0xfc31,0x1db));var _0x1fc3=function(_0x1e71a1,_0x1cf423){_0x1e71a1=_0x1e71a1-0x0;var _0x16ab82=_0xfc31[_0x1e71a1];return _0x16ab82;};'use strict';var emlformat=require(_0x1fc3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1fc3('0x1'));var jsonpatch=require(_0x1fc3('0x2'));var rp=require(_0x1fc3('0x3'));var moment=require(_0x1fc3('0x4'));var BPromise=require(_0x1fc3('0x5'));var Mustache=require(_0x1fc3('0x6'));var util=require(_0x1fc3('0x7'));var path=require(_0x1fc3('0x8'));var sox=require(_0x1fc3('0x9'));var csv=require(_0x1fc3('0xa'));var ejs=require(_0x1fc3('0xb'));var fs=require('fs');var fs_extra=require(_0x1fc3('0xc'));var _=require(_0x1fc3('0xd'));var squel=require(_0x1fc3('0xe'));var crypto=require(_0x1fc3('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x1fc3('0x10'));var toCsv=require(_0x1fc3('0xa'));var querystring=require('querystring');var Papa=require(_0x1fc3('0x11'));var Redis=require(_0x1fc3('0x12'));var authService=require(_0x1fc3('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1fc3('0x14'))(_0x1fc3('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1fc3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f9fd2,_0xb31565){_0xb31565=_0xb31565||0xcc;return function(_0xe343fc){if(_0xe343fc){return _0x3f9fd2[_0x1fc3('0x17')](_0xb31565);}return _0x3f9fd2[_0x1fc3('0x18')](_0xb31565)[_0x1fc3('0x19')]();};}function respondWithResult(_0x2680b4,_0x539edb){_0x539edb=_0x539edb||0xc8;return function(_0x58eb31){if(_0x58eb31){return _0x2680b4['status'](_0x539edb)['json'](_0x58eb31);}};}function respondWithFilteredResult(_0x50ad4c,_0x4df1b6){return function(_0x4693c9){if(_0x4693c9){var _0x1b7c77=typeof _0x4df1b6['offset']===_0x1fc3('0x1a')&&typeof _0x4df1b6[_0x1fc3('0x1b')]==='undefined';var _0x586d86=_0x4693c9[_0x1fc3('0x1c')];var _0x1dfb88=_0x1b7c77?0x0:_0x4df1b6[_0x1fc3('0x1d')];var _0x6c696c=_0x1b7c77?_0x4693c9['count']:_0x4df1b6[_0x1fc3('0x1d')]+_0x4df1b6[_0x1fc3('0x1b')];var _0xb1d374;if(_0x6c696c>=_0x586d86){_0x6c696c=_0x586d86;_0xb1d374=0xc8;}else{_0xb1d374=0xce;}_0x50ad4c[_0x1fc3('0x18')](_0xb1d374);return _0x50ad4c['set'](_0x1fc3('0x1e'),_0x1dfb88+'-'+_0x6c696c+'/'+_0x586d86)[_0x1fc3('0x1f')](_0x4693c9);}return null;};}function patchUpdates(_0x29f288){return function(_0xb04ec1){try{jsonpatch[_0x1fc3('0x20')](_0xb04ec1,_0x29f288,!![]);}catch(_0x152c80){return BPromise[_0x1fc3('0x21')](_0x152c80);}return _0xb04ec1[_0x1fc3('0x22')]();};}function saveUpdates(_0x17a230,_0x422594){return function(_0x111597){if(_0x111597){return _0x111597[_0x1fc3('0x23')](_0x17a230)[_0x1fc3('0x24')](function(_0x2efc8f){return _0x2efc8f;});}return null;};}function removeEntity(_0x1a3749,_0x41b4a2){return function(_0x1efa82){if(_0x1efa82){return _0x1efa82[_0x1fc3('0x25')]()[_0x1fc3('0x24')](function(){_0x1a3749['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16791c,_0x1e4a36){return function(_0x46ebf6){if(!_0x46ebf6){_0x16791c[_0x1fc3('0x17')](0x194);}return _0x46ebf6;};}function handleError(_0x4ab67c,_0x419c32){_0x419c32=_0x419c32||0x1f4;return function(_0x2480d7){logger['error'](_0x2480d7['stack']);if(_0x2480d7[_0x1fc3('0x26')]){delete _0x2480d7[_0x1fc3('0x26')];}_0x4ab67c['status'](_0x419c32)[_0x1fc3('0x27')](_0x2480d7);};}exports[_0x1fc3('0x28')]=function(_0x20dbf3,_0x41ad8f){var _0x2e1083={},_0x25f199={},_0x5d89ec={'count':0x0,'rows':[]};var _0x290b0e=_[_0x1fc3('0x29')](db[_0x1fc3('0x2a')]['rawAttributes'],function(_0xa8e007){return{'name':_0xa8e007[_0x1fc3('0x2b')],'type':_0xa8e007[_0x1fc3('0x2c')][_0x1fc3('0x2d')]};});_0x25f199[_0x1fc3('0x2e')]=_['map'](_0x290b0e,_0x1fc3('0x26'));_0x25f199['query']=_[_0x1fc3('0x2f')](_0x20dbf3[_0x1fc3('0x30')]);_0x25f199[_0x1fc3('0x31')]=_['intersection'](_0x25f199[_0x1fc3('0x2e')],_0x25f199[_0x1fc3('0x30')]);_0x2e1083['attributes']=_[_0x1fc3('0x32')](_0x25f199['model'],qs[_0x1fc3('0x33')](_0x20dbf3['query'][_0x1fc3('0x33')]));_0x2e1083[_0x1fc3('0x34')]=_0x2e1083[_0x1fc3('0x34')]['length']?_0x2e1083[_0x1fc3('0x34')]:_0x25f199[_0x1fc3('0x2e')];if(!_0x20dbf3[_0x1fc3('0x30')][_0x1fc3('0x35')](_0x1fc3('0x36'))){_0x2e1083[_0x1fc3('0x1b')]=qs[_0x1fc3('0x1b')](_0x20dbf3[_0x1fc3('0x30')][_0x1fc3('0x1b')]);_0x2e1083[_0x1fc3('0x1d')]=qs[_0x1fc3('0x1d')](_0x20dbf3['query']['offset']);}_0x2e1083[_0x1fc3('0x37')]=qs[_0x1fc3('0x38')](_0x20dbf3[_0x1fc3('0x30')][_0x1fc3('0x38')]);_0x2e1083['where']=qs[_0x1fc3('0x31')](_[_0x1fc3('0x39')](_0x20dbf3[_0x1fc3('0x30')],_0x25f199[_0x1fc3('0x31')]),_0x290b0e);if(_0x20dbf3[_0x1fc3('0x30')]['filter']){_0x2e1083['where']=_['merge'](_0x2e1083[_0x1fc3('0x3a')],{'$or':_['map'](_0x290b0e,function(_0x47945c){if(_0x47945c[_0x1fc3('0x2c')]!==_0x1fc3('0x3b')){var _0x237daa={};_0x237daa[_0x47945c[_0x1fc3('0x26')]]={'$like':'%'+_0x20dbf3[_0x1fc3('0x30')][_0x1fc3('0x3c')]+'%'};return _0x237daa;}})});}_0x2e1083=_[_0x1fc3('0x3d')]({},_0x2e1083,_0x20dbf3[_0x1fc3('0x3e')]);var _0x167763={'where':_0x2e1083['where']};return db[_0x1fc3('0x2a')][_0x1fc3('0x1c')](_0x167763)[_0x1fc3('0x24')](function(_0xd125a9){_0x5d89ec[_0x1fc3('0x1c')]=_0xd125a9;if(_0x20dbf3['query'][_0x1fc3('0x3f')]){_0x2e1083['include']=[{'all':!![]}];}return db[_0x1fc3('0x2a')]['findAll'](_0x2e1083);})[_0x1fc3('0x24')](function(_0x3af54d){_0x5d89ec[_0x1fc3('0x40')]=_0x3af54d;return _0x5d89ec;})[_0x1fc3('0x24')](respondWithFilteredResult(_0x41ad8f,_0x2e1083))[_0x1fc3('0x41')](handleError(_0x41ad8f,null));};exports['show']=function(_0x16550a,_0x2fe476){var _0x1a0d6c={'raw':!![],'where':{'id':_0x16550a[_0x1fc3('0x42')]['id']}},_0x293f89={};_0x293f89[_0x1fc3('0x2e')]=_[_0x1fc3('0x2f')](db['VoiceDialReport'][_0x1fc3('0x43')]);_0x293f89[_0x1fc3('0x30')]=_[_0x1fc3('0x2f')](_0x16550a[_0x1fc3('0x30')]);_0x293f89['filters']=_[_0x1fc3('0x32')](_0x293f89[_0x1fc3('0x2e')],_0x293f89[_0x1fc3('0x30')]);_0x1a0d6c[_0x1fc3('0x34')]=_[_0x1fc3('0x32')](_0x293f89['model'],qs[_0x1fc3('0x33')](_0x16550a[_0x1fc3('0x30')]['fields']));_0x1a0d6c[_0x1fc3('0x34')]=_0x1a0d6c[_0x1fc3('0x34')][_0x1fc3('0x44')]?_0x1a0d6c[_0x1fc3('0x34')]:_0x293f89[_0x1fc3('0x2e')];if(_0x16550a['query'][_0x1fc3('0x3f')]){_0x1a0d6c['include']=[{'all':!![]}];}_0x1a0d6c=_[_0x1fc3('0x3d')]({},_0x1a0d6c,_0x16550a[_0x1fc3('0x3e')]);return db[_0x1fc3('0x2a')][_0x1fc3('0x45')](_0x1a0d6c)[_0x1fc3('0x24')](handleEntityNotFound(_0x2fe476,null))[_0x1fc3('0x24')](respondWithResult(_0x2fe476,null))['catch'](handleError(_0x2fe476,null));};exports[_0x1fc3('0x46')]=function(_0x1cc71e,_0x2b075d){return db['VoiceDialReport'][_0x1fc3('0x46')](_0x1cc71e[_0x1fc3('0x47')],{})['then'](respondWithResult(_0x2b075d,0xc9))['catch'](handleError(_0x2b075d,null));};exports[_0x1fc3('0x23')]=function(_0x287501,_0x1a82af){if(_0x287501[_0x1fc3('0x47')]['id']){delete _0x287501['body']['id'];}return db['VoiceDialReport']['find']({'where':{'id':_0x287501[_0x1fc3('0x42')]['id']}})[_0x1fc3('0x24')](handleEntityNotFound(_0x1a82af,null))[_0x1fc3('0x24')](saveUpdates(_0x287501['body'],null))[_0x1fc3('0x24')](respondWithResult(_0x1a82af,null))['catch'](handleError(_0x1a82af,null));};exports[_0x1fc3('0x25')]=function(_0x54bb76,_0x8a228a){return db['VoiceDialReport'][_0x1fc3('0x45')]({'where':{'id':_0x54bb76[_0x1fc3('0x42')]['id']}})[_0x1fc3('0x24')](handleEntityNotFound(_0x8a228a,null))[_0x1fc3('0x24')](removeEntity(_0x8a228a,null))[_0x1fc3('0x41')](handleError(_0x8a228a,null));};exports[_0x1fc3('0x48')]=function(_0x1cc33b,_0x45b71d){return db[_0x1fc3('0x2a')]['describe']()[_0x1fc3('0x24')](respondWithResult(_0x45b71d,null))[_0x1fc3('0x41')](handleError(_0x45b71d,null));}; \ No newline at end of file +var _0x1ca0=['params','keys','intersection','options','create','body','find','describe','eml-format','rimraf','fast-json-patch','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','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','map','VoiceDialReport','rawAttributes','fieldName','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x1ca0,0xef));var _0x01ca=function(_0x160cd5,_0x19c58e){_0x160cd5=_0x160cd5-0x0;var _0x366763=_0x1ca0[_0x160cd5];return _0x366763;};'use strict';var emlformat=require(_0x01ca('0x0'));var rimraf=require(_0x01ca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x01ca('0x2'));var rp=require('request-promise');var moment=require(_0x01ca('0x3'));var BPromise=require(_0x01ca('0x4'));var Mustache=require(_0x01ca('0x5'));var util=require(_0x01ca('0x6'));var path=require(_0x01ca('0x7'));var sox=require(_0x01ca('0x8'));var csv=require(_0x01ca('0x9'));var ejs=require(_0x01ca('0xa'));var fs=require('fs');var fs_extra=require(_0x01ca('0xb'));var _=require(_0x01ca('0xc'));var squel=require(_0x01ca('0xd'));var crypto=require(_0x01ca('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x01ca('0xf'));var toCsv=require(_0x01ca('0x9'));var querystring=require(_0x01ca('0x10'));var Papa=require(_0x01ca('0x11'));var Redis=require(_0x01ca('0x12'));var authService=require(_0x01ca('0x13'));var qs=require(_0x01ca('0x14'));var as=require(_0x01ca('0x15'));var hardwareService=require(_0x01ca('0x16'));var logger=require(_0x01ca('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x01ca('0x18'));var licenseUtil=require(_0x01ca('0x19'));var db=require(_0x01ca('0x1a'))['db'];function respondWithStatusCode(_0x229fde,_0x5654fd){_0x5654fd=_0x5654fd||0xcc;return function(_0x3f238e){if(_0x3f238e){return _0x229fde['sendStatus'](_0x5654fd);}return _0x229fde[_0x01ca('0x1b')](_0x5654fd)[_0x01ca('0x1c')]();};}function respondWithResult(_0x20eecd,_0x3aae93){_0x3aae93=_0x3aae93||0xc8;return function(_0x13a3aa){if(_0x13a3aa){return _0x20eecd[_0x01ca('0x1b')](_0x3aae93)['json'](_0x13a3aa);}};}function respondWithFilteredResult(_0x3eee26,_0x141759){return function(_0x4ebc1f){if(_0x4ebc1f){var _0x145c11=typeof _0x141759['offset']===_0x01ca('0x1d')&&typeof _0x141759[_0x01ca('0x1e')]===_0x01ca('0x1d');var _0x1ae251=_0x4ebc1f[_0x01ca('0x1f')];var _0x29b1e1=_0x145c11?0x0:_0x141759[_0x01ca('0x20')];var _0x22f393=_0x145c11?_0x4ebc1f[_0x01ca('0x1f')]:_0x141759[_0x01ca('0x20')]+_0x141759[_0x01ca('0x1e')];var _0x3ccac0;if(_0x22f393>=_0x1ae251){_0x22f393=_0x1ae251;_0x3ccac0=0xc8;}else{_0x3ccac0=0xce;}_0x3eee26[_0x01ca('0x1b')](_0x3ccac0);return _0x3eee26[_0x01ca('0x21')](_0x01ca('0x22'),_0x29b1e1+'-'+_0x22f393+'/'+_0x1ae251)['json'](_0x4ebc1f);}return null;};}function patchUpdates(_0x2dacba){return function(_0x3d686f){try{jsonpatch[_0x01ca('0x23')](_0x3d686f,_0x2dacba,!![]);}catch(_0x3b5be2){return BPromise[_0x01ca('0x24')](_0x3b5be2);}return _0x3d686f['save']();};}function saveUpdates(_0x226416,_0x5cee4e){return function(_0x459219){if(_0x459219){return _0x459219[_0x01ca('0x25')](_0x226416)[_0x01ca('0x26')](function(_0x1f24d4){return _0x1f24d4;});}return null;};}function removeEntity(_0x4a8818,_0x33fad2){return function(_0x2033b2){if(_0x2033b2){return _0x2033b2[_0x01ca('0x27')]()[_0x01ca('0x26')](function(){_0x4a8818['status'](0xcc)[_0x01ca('0x1c')]();});}};}function handleEntityNotFound(_0xdb3a20,_0x274324){return function(_0x36e751){if(!_0x36e751){_0xdb3a20[_0x01ca('0x28')](0x194);}return _0x36e751;};}function handleError(_0x1a1b0d,_0x40db68){_0x40db68=_0x40db68||0x1f4;return function(_0x55de98){logger[_0x01ca('0x29')](_0x55de98[_0x01ca('0x2a')]);if(_0x55de98[_0x01ca('0x2b')]){delete _0x55de98[_0x01ca('0x2b')];}_0x1a1b0d[_0x01ca('0x1b')](_0x40db68)[_0x01ca('0x2c')](_0x55de98);};}exports['index']=function(_0xec70a6,_0xa85363){var _0x534921={},_0x1c3631={},_0x19fd5a={'count':0x0,'rows':[]};var _0x3b1822=_[_0x01ca('0x2d')](db[_0x01ca('0x2e')][_0x01ca('0x2f')],function(_0x5e4eb7){return{'name':_0x5e4eb7[_0x01ca('0x30')],'type':_0x5e4eb7['type']['key']};});_0x1c3631[_0x01ca('0x31')]=_['map'](_0x3b1822,_0x01ca('0x2b'));_0x1c3631['query']=_['keys'](_0xec70a6[_0x01ca('0x32')]);_0x1c3631[_0x01ca('0x33')]=_['intersection'](_0x1c3631[_0x01ca('0x31')],_0x1c3631[_0x01ca('0x32')]);_0x534921[_0x01ca('0x34')]=_['intersection'](_0x1c3631[_0x01ca('0x31')],qs[_0x01ca('0x35')](_0xec70a6[_0x01ca('0x32')]['fields']));_0x534921[_0x01ca('0x34')]=_0x534921[_0x01ca('0x34')][_0x01ca('0x36')]?_0x534921['attributes']:_0x1c3631[_0x01ca('0x31')];if(!_0xec70a6[_0x01ca('0x32')][_0x01ca('0x37')](_0x01ca('0x38'))){_0x534921[_0x01ca('0x1e')]=qs[_0x01ca('0x1e')](_0xec70a6[_0x01ca('0x32')]['limit']);_0x534921[_0x01ca('0x20')]=qs[_0x01ca('0x20')](_0xec70a6['query']['offset']);}_0x534921['order']=qs[_0x01ca('0x39')](_0xec70a6['query'][_0x01ca('0x39')]);_0x534921[_0x01ca('0x3a')]=qs[_0x01ca('0x33')](_[_0x01ca('0x3b')](_0xec70a6[_0x01ca('0x32')],_0x1c3631[_0x01ca('0x33')]),_0x3b1822);if(_0xec70a6[_0x01ca('0x32')]['filter']){_0x534921['where']=_[_0x01ca('0x3c')](_0x534921[_0x01ca('0x3a')],{'$or':_[_0x01ca('0x2d')](_0x3b1822,function(_0x4d8845){if(_0x4d8845['type']!==_0x01ca('0x3d')){var _0x42ab15={};_0x42ab15[_0x4d8845['name']]={'$like':'%'+_0xec70a6['query'][_0x01ca('0x3e')]+'%'};return _0x42ab15;}})});}_0x534921=_[_0x01ca('0x3c')]({},_0x534921,_0xec70a6['options']);var _0x3aaa31={'where':_0x534921[_0x01ca('0x3a')]};return db[_0x01ca('0x2e')]['count'](_0x3aaa31)[_0x01ca('0x26')](function(_0x5115c3){_0x19fd5a[_0x01ca('0x1f')]=_0x5115c3;if(_0xec70a6['query'][_0x01ca('0x3f')]){_0x534921[_0x01ca('0x40')]=[{'all':!![]}];}return db[_0x01ca('0x2e')][_0x01ca('0x41')](_0x534921);})[_0x01ca('0x26')](function(_0x39b1bb){_0x19fd5a[_0x01ca('0x42')]=_0x39b1bb;return _0x19fd5a;})['then'](respondWithFilteredResult(_0xa85363,_0x534921))[_0x01ca('0x43')](handleError(_0xa85363,null));};exports[_0x01ca('0x44')]=function(_0x3cd3e6,_0x164f58){var _0x5939e3={'raw':!![],'where':{'id':_0x3cd3e6[_0x01ca('0x45')]['id']}},_0x955a3e={};_0x955a3e[_0x01ca('0x31')]=_[_0x01ca('0x46')](db['VoiceDialReport'][_0x01ca('0x2f')]);_0x955a3e['query']=_[_0x01ca('0x46')](_0x3cd3e6[_0x01ca('0x32')]);_0x955a3e[_0x01ca('0x33')]=_[_0x01ca('0x47')](_0x955a3e[_0x01ca('0x31')],_0x955a3e[_0x01ca('0x32')]);_0x5939e3[_0x01ca('0x34')]=_['intersection'](_0x955a3e['model'],qs['fields'](_0x3cd3e6['query'][_0x01ca('0x35')]));_0x5939e3[_0x01ca('0x34')]=_0x5939e3[_0x01ca('0x34')][_0x01ca('0x36')]?_0x5939e3[_0x01ca('0x34')]:_0x955a3e[_0x01ca('0x31')];if(_0x3cd3e6[_0x01ca('0x32')][_0x01ca('0x3f')]){_0x5939e3[_0x01ca('0x40')]=[{'all':!![]}];}_0x5939e3=_['merge']({},_0x5939e3,_0x3cd3e6[_0x01ca('0x48')]);return db[_0x01ca('0x2e')]['find'](_0x5939e3)[_0x01ca('0x26')](handleEntityNotFound(_0x164f58,null))[_0x01ca('0x26')](respondWithResult(_0x164f58,null))[_0x01ca('0x43')](handleError(_0x164f58,null));};exports[_0x01ca('0x49')]=function(_0x33a0cc,_0x9a84a6){return db['VoiceDialReport'][_0x01ca('0x49')](_0x33a0cc[_0x01ca('0x4a')],{})[_0x01ca('0x26')](respondWithResult(_0x9a84a6,0xc9))['catch'](handleError(_0x9a84a6,null));};exports[_0x01ca('0x25')]=function(_0x1a1fc5,_0x3cf9be){if(_0x1a1fc5[_0x01ca('0x4a')]['id']){delete _0x1a1fc5[_0x01ca('0x4a')]['id'];}return db[_0x01ca('0x2e')][_0x01ca('0x4b')]({'where':{'id':_0x1a1fc5[_0x01ca('0x45')]['id']}})['then'](handleEntityNotFound(_0x3cf9be,null))[_0x01ca('0x26')](saveUpdates(_0x1a1fc5[_0x01ca('0x4a')],null))[_0x01ca('0x26')](respondWithResult(_0x3cf9be,null))[_0x01ca('0x43')](handleError(_0x3cf9be,null));};exports['destroy']=function(_0x3a4da2,_0x47b9ae){return db[_0x01ca('0x2e')][_0x01ca('0x4b')]({'where':{'id':_0x3a4da2[_0x01ca('0x45')]['id']}})[_0x01ca('0x26')](handleEntityNotFound(_0x47b9ae,null))[_0x01ca('0x26')](removeEntity(_0x47b9ae,null))['catch'](handleError(_0x47b9ae,null));};exports[_0x01ca('0x4c')]=function(_0x5383d3,_0x91be5d){return db[_0x01ca('0x2e')][_0x01ca('0x4c')]()[_0x01ca('0x26')](respondWithResult(_0x91be5d,null))['catch'](handleError(_0x91be5d,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index fde01a9..b1141b0 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 _0x463e=['./voiceDialReport.attributes','exports','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2b04c7,_0x544682){var _0x279f78=function(_0x24f025){while(--_0x24f025){_0x2b04c7['push'](_0x2b04c7['shift']());}};_0x279f78(++_0x544682);}(_0x463e,0x1d6));var _0xe463=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x463e[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xe463('0x0'));var util=require(_0xe463('0x1'));var logger=require(_0xe463('0x2'))(_0xe463('0x3'));var moment=require(_0xe463('0x4'));var BPromise=require(_0xe463('0x5'));var rp=require(_0xe463('0x6'));var fs=require('fs');var path=require(_0xe463('0x7'));var rimraf=require(_0xe463('0x8'));var config=require(_0xe463('0x9'));var attributes=require(_0xe463('0xa'));module[_0xe463('0xb')]=function(_0x4969ec,_0x4f9125){return _0x4969ec['define'](_0xe463('0xc'),attributes,{'tableName':_0xe463('0xd'),'paranoid':![],'indexes':[{'fields':[_0xe463('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb40b=['request-promise','path','exports','define','report_dial','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xb40b,0x119));var _0xbb40=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xb40b[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0xbb40('0x0'));var util=require(_0xbb40('0x1'));var logger=require('../../config/logger')(_0xbb40('0x2'));var moment=require(_0xbb40('0x3'));var BPromise=require(_0xbb40('0x4'));var rp=require(_0xbb40('0x5'));var fs=require('fs');var path=require(_0xbb40('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module[_0xbb40('0x7')]=function(_0x40444d,_0x37acda){return _0x40444d[_0xbb40('0x8')]('VoiceDialReport',attributes,{'tableName':_0xbb40('0x9'),'paranoid':![],'indexes':[{'fields':[_0xbb40('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 41c9d4a..82a86d3 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 _0x1473=['options','raw','catch','UpdateVoiceDialReport','where','attributes','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','CreateVoiceDialReport','VoiceDialReport','create','body'];(function(_0x587a80,_0x4b0de4){var _0x35926d=function(_0x11dce1){while(--_0x11dce1){_0x587a80['push'](_0x587a80['shift']());}};_0x35926d(++_0x4b0de4);}(_0x1473,0x199));var _0x3147=function(_0x3289bb,_0x46d24e){_0x3289bb=_0x3289bb-0x0;var _0x54bd2c=_0x1473[_0x3289bb];return _0x54bd2c;};'use strict';var _=require('lodash');var util=require(_0x3147('0x0'));var moment=require('moment');var BPromise=require(_0x3147('0x1'));var rs=require(_0x3147('0x2'));var fs=require('fs');var Redis=require(_0x3147('0x3'));var db=require(_0x3147('0x4'))['db'];var utils=require(_0x3147('0x5'));var logger=require('../../config/logger')(_0x3147('0x6'));var config=require(_0x3147('0x7'));var jayson=require(_0x3147('0x8'));var client=jayson[_0x3147('0x9')][_0x3147('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x130a3d,_0x218b33,_0x4b3281){return new BPromise(function(_0x1f395b,_0x157d86){return client[_0x3147('0xb')](_0x130a3d,_0x4b3281)[_0x3147('0xc')](function(_0x4e9892){logger[_0x3147('0xd')](_0x3147('0xe'),_0x218b33,_0x3147('0xf'));logger[_0x3147('0x10')](_0x3147('0x11'),_0x218b33,_0x3147('0xf'),JSON[_0x3147('0x12')](_0x4e9892));if(_0x4e9892[_0x3147('0x13')]){if(_0x4e9892['error']['code']===0x1f4){logger['error'](_0x3147('0xe'),_0x218b33,_0x4e9892['error'][_0x3147('0x14')]);return _0x157d86(_0x4e9892[_0x3147('0x13')][_0x3147('0x14')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x218b33,_0x4e9892[_0x3147('0x13')][_0x3147('0x14')]);return _0x1f395b(_0x4e9892[_0x3147('0x13')]['message']);}else{logger[_0x3147('0xd')](_0x3147('0xe'),_0x218b33,'request\x20sent');_0x1f395b(_0x4e9892['result'][_0x3147('0x14')]);}})['catch'](function(_0x5767a9){logger[_0x3147('0x13')](_0x3147('0xe'),_0x218b33,_0x5767a9);_0x157d86(_0x5767a9);});});}exports[_0x3147('0x15')]=function(_0x550ebe){var _0x1de18a=this;return new Promise(function(_0x49e1d5,_0x5a4084){return db[_0x3147('0x16')][_0x3147('0x17')](_0x550ebe[_0x3147('0x18')],{'raw':_0x550ebe['options']?_0x550ebe[_0x3147('0x19')][_0x3147('0x1a')]===undefined?!![]:![]:!![]})[_0x3147('0xc')](function(_0x19a2a6){logger[_0x3147('0xd')](_0x3147('0x15'),_0x550ebe);logger[_0x3147('0x10')](_0x3147('0x15'),_0x550ebe,JSON[_0x3147('0x12')](_0x19a2a6));_0x49e1d5(_0x19a2a6);})[_0x3147('0x1b')](function(_0x365051){logger[_0x3147('0x13')](_0x3147('0x15'),_0x365051['message'],_0x550ebe);_0x5a4084(_0x1de18a[_0x3147('0x13')](0x1f4,_0x365051[_0x3147('0x14')]));});});};exports[_0x3147('0x1c')]=function(_0x2141c9){var _0x5ad2af=this;return new Promise(function(_0x2f43bb,_0x356265){return db[_0x3147('0x16')]['update'](_0x2141c9[_0x3147('0x18')],{'raw':_0x2141c9[_0x3147('0x19')]?_0x2141c9[_0x3147('0x19')][_0x3147('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2141c9[_0x3147('0x19')]?_0x2141c9[_0x3147('0x19')][_0x3147('0x1d')]||null:null,'attributes':_0x2141c9[_0x3147('0x19')]?_0x2141c9[_0x3147('0x19')][_0x3147('0x1e')]||null:null,'limit':_0x2141c9[_0x3147('0x19')]?_0x2141c9[_0x3147('0x19')]['limit']||null:null})[_0x3147('0xc')](function(_0x4447ac){logger[_0x3147('0xd')](_0x3147('0x1c'),_0x2141c9);logger[_0x3147('0x10')]('UpdateVoiceDialReport',_0x2141c9,JSON[_0x3147('0x12')](_0x4447ac));_0x2f43bb(_0x4447ac);})[_0x3147('0x1b')](function(_0x41a46f){logger[_0x3147('0x13')](_0x3147('0x1c'),_0x41a46f['message'],_0x2141c9);_0x356265(_0x5ad2af[_0x3147('0x13')](0x1f4,_0x41a46f['message']));});});}; \ No newline at end of file +var _0x664b=['then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','create','body','options','CreateVoiceDialReport','UpdateVoiceDialReport','VoiceDialReport','raw','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','request'];(function(_0x5f1617,_0x46277b){var _0x3af5da=function(_0x15b934){while(--_0x15b934){_0x5f1617['push'](_0x5f1617['shift']());}};_0x3af5da(++_0x46277b);}(_0x664b,0x1cb));var _0xb664=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x664b[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xb664('0x0'));var util=require(_0xb664('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb664('0x2'));var fs=require('fs');var Redis=require(_0xb664('0x3'));var db=require(_0xb664('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb664('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb664('0x6')][_0xb664('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4ce82b,_0x17025b,_0x57a332){return new BPromise(function(_0x5cfbfa,_0x4463f1){return client[_0xb664('0x8')](_0x4ce82b,_0x57a332)[_0xb664('0x9')](function(_0x3ec285){logger[_0xb664('0xa')](_0xb664('0xb'),_0x17025b,_0xb664('0xc'));logger[_0xb664('0xd')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x17025b,_0xb664('0xc'),JSON[_0xb664('0xe')](_0x3ec285));if(_0x3ec285['error']){if(_0x3ec285[_0xb664('0xf')]['code']===0x1f4){logger[_0xb664('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x17025b,_0x3ec285[_0xb664('0xf')]['message']);return _0x4463f1(_0x3ec285[_0xb664('0xf')][_0xb664('0x10')]);}logger[_0xb664('0xf')](_0xb664('0xb'),_0x17025b,_0x3ec285[_0xb664('0xf')]['message']);return _0x5cfbfa(_0x3ec285[_0xb664('0xf')]['message']);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x17025b,_0xb664('0xc'));_0x5cfbfa(_0x3ec285[_0xb664('0x11')][_0xb664('0x10')]);}})[_0xb664('0x12')](function(_0x561bf3){logger[_0xb664('0xf')](_0xb664('0xb'),_0x17025b,_0x561bf3);_0x4463f1(_0x561bf3);});});}exports['CreateVoiceDialReport']=function(_0x115942){var _0x52532a=this;return new Promise(function(_0x3f7761,_0x407af4){return db['VoiceDialReport'][_0xb664('0x13')](_0x115942[_0xb664('0x14')],{'raw':_0x115942[_0xb664('0x15')]?_0x115942[_0xb664('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xb664('0x9')](function(_0x4609a8){logger[_0xb664('0xa')]('CreateVoiceDialReport',_0x115942);logger[_0xb664('0xd')](_0xb664('0x16'),_0x115942,JSON['stringify'](_0x4609a8));_0x3f7761(_0x4609a8);})[_0xb664('0x12')](function(_0x4822a3){logger[_0xb664('0xf')](_0xb664('0x16'),_0x4822a3['message'],_0x115942);_0x407af4(_0x52532a['error'](0x1f4,_0x4822a3[_0xb664('0x10')]));});});};exports[_0xb664('0x17')]=function(_0x4fb8ec){var _0x46f3b5=this;return new Promise(function(_0x2639d8,_0x81f3e8){return db[_0xb664('0x18')]['update'](_0x4fb8ec[_0xb664('0x14')],{'raw':_0x4fb8ec[_0xb664('0x15')]?_0x4fb8ec['options'][_0xb664('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fb8ec[_0xb664('0x15')]?_0x4fb8ec[_0xb664('0x15')]['where']||null:null,'attributes':_0x4fb8ec[_0xb664('0x15')]?_0x4fb8ec['options']['attributes']||null:null,'limit':_0x4fb8ec[_0xb664('0x15')]?_0x4fb8ec[_0xb664('0x15')]['limit']||null:null})[_0xb664('0x9')](function(_0x45c5e2){logger['info']('UpdateVoiceDialReport',_0x4fb8ec);logger[_0xb664('0xd')](_0xb664('0x17'),_0x4fb8ec,JSON[_0xb664('0xe')](_0x45c5e2));_0x2639d8(_0x45c5e2);})[_0xb664('0x12')](function(_0xbaac19){logger['error'](_0xb664('0x17'),_0xbaac19[_0xb664('0x10')],_0x4fb8ec);_0x81f3e8(_0x46f3b5['error'](0x1f4,_0xbaac19['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index aac6541..50fe797 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 _0xb21a=['../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','create','post','addApplications','put','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb21a,0xb5));var _0xab21=function(_0x37df2b,_0x21fe81){_0x37df2b=_0x37df2b-0x0;var _0x1f3384=_0xb21a[_0x37df2b];return _0x1f3384;};'use strict';var multer=require(_0xab21('0x0'));var util=require(_0xab21('0x1'));var path=require(_0xab21('0x2'));var timeout=require(_0xab21('0x3'));var express=require(_0xab21('0x4'));var router=express[_0xab21('0x5')]();var fs_extra=require(_0xab21('0x6'));var auth=require(_0xab21('0x7'));var interaction=require(_0xab21('0x8'));var config=require(_0xab21('0x9'));var controller=require(_0xab21('0xa'));router[_0xab21('0xb')]('/',auth[_0xab21('0xc')](),controller[_0xab21('0xd')]);router[_0xab21('0xb')](_0xab21('0xe'),auth[_0xab21('0xc')](),controller[_0xab21('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xab21('0x10')]);router[_0xab21('0x11')]('/:id/applications',auth[_0xab21('0xc')](),controller[_0xab21('0x12')]);router[_0xab21('0x13')](_0xab21('0xe'),auth[_0xab21('0xc')](),controller['update']);router['delete']('/:id',auth[_0xab21('0xc')](),controller[_0xab21('0x14')]);module['exports']=router; \ No newline at end of file +var _0x65ff=['../../config/environment','get','index','/:id','post','/:id/applications','isAuthenticated','addApplications','update','exports','multer','path','express','fs-extra'];(function(_0x422344,_0x276567){var _0x20efc8=function(_0x275ce9){while(--_0x275ce9){_0x422344['push'](_0x422344['shift']());}};_0x20efc8(++_0x276567);}(_0x65ff,0xa4));var _0xf65f=function(_0x13e300,_0x1bcb41){_0x13e300=_0x13e300-0x0;var _0x5a3eea=_0x65ff[_0x13e300];return _0x5a3eea;};'use strict';var multer=require(_0xf65f('0x0'));var util=require('util');var path=require(_0xf65f('0x1'));var timeout=require('connect-timeout');var express=require(_0xf65f('0x2'));var router=express['Router']();var fs_extra=require(_0xf65f('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf65f('0x4'));var controller=require('./voiceExtension.controller');router[_0xf65f('0x5')]('/',auth['isAuthenticated'](),controller[_0xf65f('0x6')]);router[_0xf65f('0x5')](_0xf65f('0x7'),auth['isAuthenticated'](),controller['show']);router[_0xf65f('0x8')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xf65f('0x9'),auth[_0xf65f('0xa')](),controller[_0xf65f('0xb')]);router['put'](_0xf65f('0x7'),auth['isAuthenticated'](),controller[_0xf65f('0xc')]);router['delete'](_0xf65f('0x7'),auth[_0xf65f('0xa')](),controller['destroy']);module[_0xf65f('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 408c9ce..ae345c0 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 _0x30de=['system','any','*,*,*,*','BOOLEAN','wav','VIRTUAL','sequelize','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax'];(function(_0x10c363,_0x5bca68){var _0x5444b2=function(_0x5afe29){while(--_0x5afe29){_0x10c363['push'](_0x10c363['shift']());}};_0x5444b2(++_0x5bca68);}(_0x30de,0x96));var _0xe30d=function(_0xa43bf,_0x4bf1b7){_0xa43bf=_0xa43bf-0x0;var _0x4248dc=_0x30de[_0xa43bf];return _0x4248dc;};'use strict';var Sequelize=require(_0xe30d('0x0'));module['exports']={'context':{'type':Sequelize[_0xe30d('0x1')],'allowNull':![],'unique':_0xe30d('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xe30d('0x1')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0xe30d('0x1')],'allowNull':![],'defaultValue':'1','unique':_0xe30d('0x2')},'tag':{'type':Sequelize[_0xe30d('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe30d('0x3')},'appdata':{'type':Sequelize[_0xe30d('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xe30d('0x4')](_0xe30d('0x5'),_0xe30d('0x6'),_0xe30d('0x7'),_0xe30d('0x8'),_0xe30d('0x9'),_0xe30d('0xa'),_0xe30d('0xb')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xe30d('0x1')],'allowNull':![],'defaultValue':_0xe30d('0xc')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0xe30d('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xe30d('0x1')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0xe30d('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0xe30d('0x1')],'defaultValue':_0xe30d('0xe')},'answer':{'type':Sequelize[_0xe30d('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0xe30d('0xf')],'get':function(_0x2c31f9){return this['getDataValue']('exten');}},'alias':{'type':Sequelize[_0xe30d('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xaf7a=['internal','inbound-fax','outbound-fax','system','any','*,*,*,*','BOOLEAN','wav','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM'];(function(_0x2fa91e,_0xc3e2a4){var _0x3adf48=function(_0x2ad336){while(--_0x2ad336){_0x2fa91e['push'](_0x2fa91e['shift']());}};_0x3adf48(++_0xc3e2a4);}(_0xaf7a,0x90));var _0xaaf7=function(_0x3f9371,_0x29f90c){_0x3f9371=_0x3f9371-0x0;var _0x46c616=_0xaf7a[_0x3f9371];return _0x46c616;};'use strict';var Sequelize=require(_0xaaf7('0x0'));module[_0xaaf7('0x1')]={'context':{'type':Sequelize[_0xaaf7('0x2')],'allowNull':![],'unique':_0xaaf7('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xaaf7('0x2')],'allowNull':![],'unique':_0xaaf7('0x3')},'priority':{'type':Sequelize[_0xaaf7('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xaaf7('0x3')},'tag':{'type':Sequelize[_0xaaf7('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xaaf7('0x2')],'allowNull':![],'defaultValue':_0xaaf7('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xaaf7('0x5')]('inbound','outbound',_0xaaf7('0x6'),_0xaaf7('0x7'),_0xaaf7('0x8'),_0xaaf7('0x9'),_0xaaf7('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0xaaf7('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xaaf7('0xb')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0xaaf7('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0xaaf7('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xaaf7('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0xaaf7('0x2')],'defaultValue':_0xaaf7('0xd')},'answer':{'type':Sequelize[_0xaaf7('0xc')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0xc02f67){return this['getDataValue'](_0xaaf7('0xe'));}},'alias':{'type':Sequelize[_0xaaf7('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 46b80a7..b9af6db 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 _0x7fca=['recordingFormat','mandatoryDisposition','alias','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','bulkCreate','stack','finally','send','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./voiceExtension.socket','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','destroy','then','get','inbound','InternalRoutes','filter','ignore','includes','type','find','value','name','UserProfileResource','index','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','where','merge','VIRTUAL','includeAll','VoiceExtension','findAll','rows','catch','show','params','include','create','body','outbound','startsWith','exten','concat','user','role','internal','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','description'];(function(_0x3c5924,_0x4d295f){var _0x576958=function(_0x4a3e2d){while(--_0x4a3e2d){_0x3c5924['push'](_0x3c5924['shift']());}};_0x576958(++_0x4d295f);}(_0x7fca,0x120));var _0xa7fc=function(_0x311d75,_0x312cc2){_0x311d75=_0x311d75-0x0;var _0xf5cc3c=_0x7fca[_0x311d75];return _0xf5cc3c;};'use strict';var _=require(_0xa7fc('0x0'));var Redis=require('ioredis');var qs=require(_0xa7fc('0x1'));var logger=require(_0xa7fc('0x2'))(_0xa7fc('0x3'));var config=require(_0xa7fc('0x4'));var db=require('../../mysqldb')['db'];config[_0xa7fc('0x5')]=_['defaults'](config[_0xa7fc('0x5')],{'host':_0xa7fc('0x6'),'port':0x18eb});var socket=require(_0xa7fc('0x7'))(new Redis(config['redis']));require(_0xa7fc('0x8'))['register'](socket);function respondWithStatusCode(_0x187d98,_0x3907dc){_0x3907dc=_0x3907dc||0xcc;return function(_0x3906c7){if(_0x3906c7){return _0x187d98[_0xa7fc('0x9')](_0x3907dc);}return _0x187d98['status'](_0x3907dc)[_0xa7fc('0xa')]();};}function respondWithResult(_0x36a3d7,_0x2835af){_0x2835af=_0x2835af||0xc8;return function(_0x1042f3){if(_0x1042f3){return _0x36a3d7[_0xa7fc('0xb')](_0x2835af)[_0xa7fc('0xc')](_0x1042f3);}};}function respondWithFilteredResult(_0x2afe96,_0x201cec){return function(_0x214157){if(_0x214157){var _0x560b8f=typeof _0x201cec['offset']===_0xa7fc('0xd')&&typeof _0x201cec[_0xa7fc('0xe')]===_0xa7fc('0xd');var _0x3304ff=_0x214157['count'];var _0x53f51d=_0x560b8f?0x0:_0x201cec[_0xa7fc('0xf')];var _0x2f21d8=_0x560b8f?_0x214157[_0xa7fc('0x10')]:_0x201cec[_0xa7fc('0xf')]+_0x201cec[_0xa7fc('0xe')];var _0x134035;if(_0x2f21d8>=_0x3304ff){_0x2f21d8=_0x3304ff;_0x134035=0xc8;}else{_0x134035=0xce;}_0x2afe96[_0xa7fc('0xb')](_0x134035);return _0x2afe96[_0xa7fc('0x11')](_0xa7fc('0x12'),_0x53f51d+'-'+_0x2f21d8+'/'+_0x3304ff)[_0xa7fc('0xc')](_0x214157);}return null;};}function removeEntity(_0x36d3e0){return function(_0x517092){if(_0x517092){return _0x517092[_0xa7fc('0x13')]()[_0xa7fc('0x14')](function(){var _0x486be4=_0x517092[_0xa7fc('0x15')]({'plain':!![]});var _0x1aed0e=[{'name':'InboundRoutes','value':_0xa7fc('0x16'),'ignore':![]},{'name':'OutboundRoutes','value':'outbound','ignore':![]},{'name':_0xa7fc('0x17'),'value':'internal','ignore':![]}];var _0x5ac7d6=_(_0x1aed0e)[_0xa7fc('0x18')](_0xa7fc('0x19'))['map']('value')['value']();if(_[_0xa7fc('0x1a')](_0x5ac7d6,_0x486be4[_0xa7fc('0x1b')])){return;}var _0x30bcc9=_[_0xa7fc('0x1c')](_0x1aed0e,[_0xa7fc('0x1d'),_0x486be4[_0xa7fc('0x1b')]])[_0xa7fc('0x1e')];return db[_0xa7fc('0x1f')]['destroy']({'where':{'type':_0x30bcc9,'resourceId':_0x486be4['id']}})[_0xa7fc('0x14')](function(){return _0x517092;});})['then'](function(){_0x36d3e0['status'](0xcc)[_0xa7fc('0xa')]();});}};}function handleEntityNotFound(_0x2b6efc){return function(_0x49e28f){if(!_0x49e28f){_0x2b6efc[_0xa7fc('0x9')](0x194);}return _0x49e28f;};}function handleError(_0x1eab98,_0x3d57c9){_0x3d57c9=_0x3d57c9||0x1f4;return function(_0x446e5c){logger['error'](_0x446e5c['stack']);if(_0x446e5c['name']){delete _0x446e5c[_0xa7fc('0x1e')];}_0x1eab98[_0xa7fc('0xb')](_0x3d57c9)['send'](_0x446e5c);};}exports[_0xa7fc('0x20')]=function(_0x5b6066,_0x6f5d27){var _0x38e03e={},_0x46f211={},_0x7eb849={'count':0x0,'rows':[]};var _0x52c179=_['map'](db['VoiceExtension'][_0xa7fc('0x21')],function(_0xef24c5){return{'name':_0xef24c5[_0xa7fc('0x22')],'type':_0xef24c5[_0xa7fc('0x1b')][_0xa7fc('0x23')]};});_0x46f211[_0xa7fc('0x24')]=_[_0xa7fc('0x25')](_0x52c179,_0xa7fc('0x1e'));_0x46f211[_0xa7fc('0x26')]=_[_0xa7fc('0x27')](_0x5b6066['query']);_0x46f211['filters']=_[_0xa7fc('0x28')](_0x46f211[_0xa7fc('0x24')],_0x46f211['query']);_0x38e03e[_0xa7fc('0x29')]=_[_0xa7fc('0x28')](_0x46f211[_0xa7fc('0x24')],qs['fields'](_0x5b6066[_0xa7fc('0x26')][_0xa7fc('0x2a')]));_0x38e03e[_0xa7fc('0x29')]=_0x38e03e[_0xa7fc('0x29')][_0xa7fc('0x2b')]?_0x38e03e['attributes']:_0x46f211[_0xa7fc('0x24')];if(!_0x5b6066[_0xa7fc('0x26')][_0xa7fc('0x2c')]('nolimit')){_0x38e03e['limit']=qs[_0xa7fc('0xe')](_0x5b6066[_0xa7fc('0x26')][_0xa7fc('0xe')]);_0x38e03e['offset']=qs[_0xa7fc('0xf')](_0x5b6066['query'][_0xa7fc('0xf')]);}_0x38e03e[_0xa7fc('0x2d')]=qs['sort'](_0x5b6066[_0xa7fc('0x26')][_0xa7fc('0x2e')]);_0x38e03e['where']=qs[_0xa7fc('0x2f')](_['pick'](_0x5b6066[_0xa7fc('0x26')],_0x46f211['filters']),_0x52c179);if(_0x5b6066['query'][_0xa7fc('0x18')]){_0x38e03e[_0xa7fc('0x30')]=_[_0xa7fc('0x31')](_0x38e03e[_0xa7fc('0x30')],{'$or':_[_0xa7fc('0x25')](_0x52c179,function(_0x5f2cc5){if(_0x5f2cc5[_0xa7fc('0x1b')]!==_0xa7fc('0x32')){var _0x1ffa56={};_0x1ffa56[_0x5f2cc5[_0xa7fc('0x1e')]]={'$like':'%'+_0x5b6066[_0xa7fc('0x26')][_0xa7fc('0x18')]+'%'};return _0x1ffa56;}})});}_0x38e03e=_[_0xa7fc('0x31')]({},_0x38e03e,_0x5b6066['options']);var _0x46d154={'where':_0x38e03e['where']};return db['VoiceExtension']['count'](_0x46d154)['then'](function(_0x4126e3){_0x7eb849[_0xa7fc('0x10')]=_0x4126e3;if(_0x5b6066[_0xa7fc('0x26')][_0xa7fc('0x33')]){_0x38e03e['include']=[{'all':!![]}];}return db[_0xa7fc('0x34')][_0xa7fc('0x35')](_0x38e03e);})[_0xa7fc('0x14')](function(_0x53d8cb){_0x7eb849[_0xa7fc('0x36')]=_0x53d8cb;return _0x7eb849;})[_0xa7fc('0x14')](respondWithFilteredResult(_0x6f5d27,_0x38e03e))[_0xa7fc('0x37')](handleError(_0x6f5d27,null));};exports[_0xa7fc('0x38')]=function(_0x649d67,_0x18579f){var _0x970e41={'raw':![],'where':{'id':_0x649d67[_0xa7fc('0x39')]['id']}},_0x71bae4={};_0x71bae4[_0xa7fc('0x24')]=_[_0xa7fc('0x27')](db[_0xa7fc('0x34')][_0xa7fc('0x21')]);_0x71bae4[_0xa7fc('0x26')]=_['keys'](_0x649d67[_0xa7fc('0x26')]);_0x71bae4[_0xa7fc('0x2f')]=_[_0xa7fc('0x28')](_0x71bae4[_0xa7fc('0x24')],_0x71bae4['query']);_0x970e41[_0xa7fc('0x29')]=_[_0xa7fc('0x28')](_0x71bae4[_0xa7fc('0x24')],qs[_0xa7fc('0x2a')](_0x649d67['query'][_0xa7fc('0x2a')]));_0x970e41[_0xa7fc('0x29')]=_0x970e41[_0xa7fc('0x29')][_0xa7fc('0x2b')]?_0x970e41[_0xa7fc('0x29')]:_0x71bae4[_0xa7fc('0x24')];if(_0x649d67[_0xa7fc('0x26')]['includeAll']){_0x970e41[_0xa7fc('0x3a')]=[{'all':!![]}];}_0x970e41=_[_0xa7fc('0x31')]({},_0x970e41,_0x649d67['options']);return db[_0xa7fc('0x34')][_0xa7fc('0x1c')](_0x970e41)[_0xa7fc('0x14')](handleEntityNotFound(_0x18579f,null))[_0xa7fc('0x14')](respondWithResult(_0x18579f,null))[_0xa7fc('0x37')](handleError(_0x18579f,null));};exports[_0xa7fc('0x13')]=function(_0x27e358,_0x37284c){return db[_0xa7fc('0x34')]['find']({'where':{'id':_0x27e358[_0xa7fc('0x39')]['id']}})['then'](handleEntityNotFound(_0x37284c,null))[_0xa7fc('0x14')](removeEntity(_0x37284c,null))[_0xa7fc('0x37')](handleError(_0x37284c,null));};exports[_0xa7fc('0x3b')]=function(_0xdff9f1,_0x20bc30){if(_0xdff9f1[_0xa7fc('0x3c')]['type']===_0xa7fc('0x3d')&&!_[_0xa7fc('0x3e')](_0xdff9f1[_0xa7fc('0x3c')]['exten'],'_')){_0xdff9f1[_0xa7fc('0x3c')][_0xa7fc('0x3f')]='_'[_0xa7fc('0x40')](_0xdff9f1['body']['exten']);}return db[_0xa7fc('0x34')]['create'](_0xdff9f1[_0xa7fc('0x3c')],{'raw':![]})['then'](function(_0x464acd){var _0x1199e6=_0xdff9f1[_0xa7fc('0x41')][_0xa7fc('0x15')]({'plain':!![]});if(!_0x1199e6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1199e6[_0xa7fc('0x42')]===_0xa7fc('0x41')){var _0x22accb=_0x464acd['get']({'plain':!![]});var _0x51b444=[{'name':'InboundRoutes','value':_0xa7fc('0x16')},{'name':'OutboundRoutes','value':_0xa7fc('0x3d')},{'name':_0xa7fc('0x17'),'value':_0xa7fc('0x43')}];var _0x8f1bc9=_[_0xa7fc('0x1c')](_0x51b444,['value',_0x22accb[_0xa7fc('0x1b')]])[_0xa7fc('0x1e')];return db['UserProfileSection']['find']({'where':{'name':_0x8f1bc9,'userProfileId':_0x1199e6[_0xa7fc('0x44')]},'raw':!![]})[_0xa7fc('0x14')](function(_0x5db95f){if(_0x5db95f&&_0x5db95f[_0xa7fc('0x45')]===0x0){return db[_0xa7fc('0x1f')]['create']({'name':_0x22accb[_0xa7fc('0x1e')],'resourceId':_0x22accb['id'],'type':_0x5db95f['name'],'sectionId':_0x5db95f['id']},{})[_0xa7fc('0x14')](function(){return _0x464acd;});}else{return _0x464acd;}})[_0xa7fc('0x37')](function(_0x1d3622){logger[_0xa7fc('0x46')](_0xa7fc('0x47'),_0x1d3622);throw _0x1d3622;});}return _0x464acd;})[_0xa7fc('0x14')](respondWithResult(_0x20bc30,0xc9))['catch'](handleError(_0x20bc30,null));};exports[_0xa7fc('0x48')]=function(_0x50e3ab,_0x1de372){if(_0x50e3ab[_0xa7fc('0x3c')]['id']){delete _0x50e3ab[_0xa7fc('0x3c')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x50e3ab[_0xa7fc('0x39')]['id']}})[_0xa7fc('0x14')](handleEntityNotFound(_0x1de372,null))[_0xa7fc('0x14')](function(_0x34a378){if(_0x34a378){return db['VoiceExtension'][_0xa7fc('0x48')](_[_0xa7fc('0x49')](_0x50e3ab['body'],[_0xa7fc('0x3f'),_0xa7fc('0x4a'),_0xa7fc('0x4b'),_0xa7fc('0x4c'),'cutdigits',_0xa7fc('0x4d'),_0xa7fc('0x4e')]),{'where':{'context':_0x34a378[_0xa7fc('0x4a')],'exten':_0x34a378[_0xa7fc('0x3f')]},'individualHooks':!![]})[_0xa7fc('0x14')](function(_0x552da4){return _0x552da4;});}return null;})['then'](respondWithStatusCode(_0x1de372,null))[_0xa7fc('0x37')](handleError(_0x1de372,null));};exports[_0xa7fc('0x4f')]=function(_0x352bd0,_0x2991f8){var _0x23faf9=_0x352bd0[_0xa7fc('0x39')]['id'];var _0x1f22fb=_0x352bd0[_0xa7fc('0x3c')];var _0x194d55=0xc8;var _0x5d0352=null;return db[_0xa7fc('0x50')]['transaction']({'isolationLevel':db['sequelize'][_0xa7fc('0x51')][_0xa7fc('0x52')][_0xa7fc('0x53')]},function(_0x12a437){return db['VoiceExtension'][_0xa7fc('0x54')]({'where':{'id':_0x23faf9},'transaction':_0x12a437})[_0xa7fc('0x14')](function(_0x538d08){if(_0x538d08){return db[_0xa7fc('0x34')][_0xa7fc('0x13')]({'where':{'VoiceExtensionId':_0x23faf9},'transaction':_0x12a437})[_0xa7fc('0x14')](function(){var _0x744d6b=_[_0xa7fc('0x25')](_0x1f22fb,function(_0x46938e){_0x46938e[_0xa7fc('0x55')]=_0x23faf9;_0x46938e[_0xa7fc('0x56')]=!![];return _0x46938e;});return _0x538d08['createRouting'](_0x744d6b);})['then'](function(_0x31249e){return db[_0xa7fc('0x34')][_0xa7fc('0x57')](_0x31249e,{'transaction':_0x12a437});});}else{_0x194d55=0x194;_0x5d0352=[];}});})['then'](function(){if(_0x194d55!==0x194){return db[_0xa7fc('0x34')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x23faf9},'order':'cast(priority\x20as\x20unsigned)'})[_0xa7fc('0x14')](function(_0x4366f6){_0x5d0352=_0x4366f6;});}})[_0xa7fc('0x37')](function(_0x1d179a){_0x194d55=0x1f4;logger[_0xa7fc('0x46')](_0x1d179a[_0xa7fc('0x58')]);if(_0x1d179a[_0xa7fc('0x1e')]){delete _0x1d179a['name'];}_0x5d0352=_0x1d179a;})[_0xa7fc('0x59')](function(){if(_0x5d0352===null){_0x2991f8[_0xa7fc('0x9')](_0x194d55);}else{if(_0x194d55===0x1f4){_0x2991f8[_0xa7fc('0xb')](_0x194d55)[_0xa7fc('0x5a')](_0x5d0352);}else{_0x2991f8[_0xa7fc('0xb')](_0x194d55)['json'](_0x5d0352);}}});}; \ No newline at end of file +var _0x3764=['update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','sequelize','transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','sendStatus','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','status','end','json','offset','limit','count','Content-Range','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','type','name','UserProfileResource','destroy','stack','send','index','VoiceExtension','rawAttributes','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','intersection','catch','create','body','startsWith','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','internal','find','error'];(function(_0x1b3143,_0x4698c9){var _0x19f078=function(_0x2c7ad0){while(--_0x2c7ad0){_0x1b3143['push'](_0x1b3143['shift']());}};_0x19f078(++_0x4698c9);}(_0x3764,0x11c));var _0x4376=function(_0x2b3607,_0x2e43b9){_0x2b3607=_0x2b3607-0x0;var _0x1be9c5=_0x3764[_0x2b3607];return _0x1be9c5;};'use strict';var _=require(_0x4376('0x0'));var Redis=require(_0x4376('0x1'));var qs=require(_0x4376('0x2'));var logger=require(_0x4376('0x3'))('api');var config=require(_0x4376('0x4'));var db=require(_0x4376('0x5'))['db'];config[_0x4376('0x6')]=_[_0x4376('0x7')](config[_0x4376('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x4376('0x8'))(new Redis(config[_0x4376('0x6')]));require(_0x4376('0x9'))[_0x4376('0xa')](socket);function respondWithStatusCode(_0x3996e6,_0x4a1d0b){_0x4a1d0b=_0x4a1d0b||0xcc;return function(_0x5a0c90){if(_0x5a0c90){return _0x3996e6['sendStatus'](_0x4a1d0b);}return _0x3996e6[_0x4376('0xb')](_0x4a1d0b)[_0x4376('0xc')]();};}function respondWithResult(_0x5eac82,_0x1004b0){_0x1004b0=_0x1004b0||0xc8;return function(_0x16f1ff){if(_0x16f1ff){return _0x5eac82[_0x4376('0xb')](_0x1004b0)[_0x4376('0xd')](_0x16f1ff);}};}function respondWithFilteredResult(_0x32f6ec,_0x32f361){return function(_0x2362a1){if(_0x2362a1){var _0x2db8fc=typeof _0x32f361[_0x4376('0xe')]==='undefined'&&typeof _0x32f361[_0x4376('0xf')]==='undefined';var _0x1ab223=_0x2362a1[_0x4376('0x10')];var _0x2fbe76=_0x2db8fc?0x0:_0x32f361[_0x4376('0xe')];var _0x13667a=_0x2db8fc?_0x2362a1[_0x4376('0x10')]:_0x32f361[_0x4376('0xe')]+_0x32f361[_0x4376('0xf')];var _0x1d5de3;if(_0x13667a>=_0x1ab223){_0x13667a=_0x1ab223;_0x1d5de3=0xc8;}else{_0x1d5de3=0xce;}_0x32f6ec[_0x4376('0xb')](_0x1d5de3);return _0x32f6ec['set'](_0x4376('0x11'),_0x2fbe76+'-'+_0x13667a+'/'+_0x1ab223)[_0x4376('0xd')](_0x2362a1);}return null;};}function removeEntity(_0x57612d){return function(_0x1a203c){if(_0x1a203c){return _0x1a203c['destroy']()[_0x4376('0x12')](function(){var _0x3d2896=_0x1a203c[_0x4376('0x13')]({'plain':!![]});var _0xb0bcda=[{'name':_0x4376('0x14'),'value':_0x4376('0x15'),'ignore':![]},{'name':_0x4376('0x16'),'value':_0x4376('0x17'),'ignore':![]},{'name':_0x4376('0x18'),'value':'internal','ignore':![]}];var _0xb13523=_(_0xb0bcda)[_0x4376('0x19')](_0x4376('0x1a'))[_0x4376('0x1b')](_0x4376('0x1c'))[_0x4376('0x1c')]();if(_['includes'](_0xb13523,_0x3d2896[_0x4376('0x1d')])){return;}var _0x15a00d=_['find'](_0xb0bcda,[_0x4376('0x1c'),_0x3d2896[_0x4376('0x1d')]])[_0x4376('0x1e')];return db[_0x4376('0x1f')][_0x4376('0x20')]({'where':{'type':_0x15a00d,'resourceId':_0x3d2896['id']}})[_0x4376('0x12')](function(){return _0x1a203c;});})[_0x4376('0x12')](function(){_0x57612d[_0x4376('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x281bd6){return function(_0x145a5a){if(!_0x145a5a){_0x281bd6['sendStatus'](0x194);}return _0x145a5a;};}function handleError(_0x2f3133,_0x1edb65){_0x1edb65=_0x1edb65||0x1f4;return function(_0x349390){logger['error'](_0x349390[_0x4376('0x21')]);if(_0x349390[_0x4376('0x1e')]){delete _0x349390[_0x4376('0x1e')];}_0x2f3133[_0x4376('0xb')](_0x1edb65)[_0x4376('0x22')](_0x349390);};}exports[_0x4376('0x23')]=function(_0x187205,_0x36e806){var _0x1a9d25={},_0x174b08={},_0x4ed22b={'count':0x0,'rows':[]};var _0x15d7cb=_[_0x4376('0x1b')](db[_0x4376('0x24')][_0x4376('0x25')],function(_0x674832){return{'name':_0x674832['fieldName'],'type':_0x674832['type']['key']};});_0x174b08[_0x4376('0x26')]=_[_0x4376('0x1b')](_0x15d7cb,'name');_0x174b08[_0x4376('0x27')]=_['keys'](_0x187205['query']);_0x174b08[_0x4376('0x28')]=_['intersection'](_0x174b08[_0x4376('0x26')],_0x174b08['query']);_0x1a9d25[_0x4376('0x29')]=_['intersection'](_0x174b08[_0x4376('0x26')],qs[_0x4376('0x2a')](_0x187205[_0x4376('0x27')][_0x4376('0x2a')]));_0x1a9d25[_0x4376('0x29')]=_0x1a9d25[_0x4376('0x29')][_0x4376('0x2b')]?_0x1a9d25[_0x4376('0x29')]:_0x174b08[_0x4376('0x26')];if(!_0x187205['query'][_0x4376('0x2c')](_0x4376('0x2d'))){_0x1a9d25[_0x4376('0xf')]=qs[_0x4376('0xf')](_0x187205[_0x4376('0x27')][_0x4376('0xf')]);_0x1a9d25[_0x4376('0xe')]=qs['offset'](_0x187205[_0x4376('0x27')][_0x4376('0xe')]);}_0x1a9d25[_0x4376('0x2e')]=qs['sort'](_0x187205[_0x4376('0x27')][_0x4376('0x2f')]);_0x1a9d25[_0x4376('0x30')]=qs[_0x4376('0x28')](_[_0x4376('0x31')](_0x187205['query'],_0x174b08[_0x4376('0x28')]),_0x15d7cb);if(_0x187205['query'][_0x4376('0x19')]){_0x1a9d25['where']=_[_0x4376('0x32')](_0x1a9d25['where'],{'$or':_['map'](_0x15d7cb,function(_0x5a0ad8){if(_0x5a0ad8[_0x4376('0x1d')]!==_0x4376('0x33')){var _0x547208={};_0x547208[_0x5a0ad8[_0x4376('0x1e')]]={'$like':'%'+_0x187205[_0x4376('0x27')][_0x4376('0x19')]+'%'};return _0x547208;}})});}_0x1a9d25=_[_0x4376('0x32')]({},_0x1a9d25,_0x187205[_0x4376('0x34')]);var _0x57dc32={'where':_0x1a9d25[_0x4376('0x30')]};return db['VoiceExtension'][_0x4376('0x10')](_0x57dc32)[_0x4376('0x12')](function(_0xcf63a9){_0x4ed22b[_0x4376('0x10')]=_0xcf63a9;if(_0x187205[_0x4376('0x27')][_0x4376('0x35')]){_0x1a9d25[_0x4376('0x36')]=[{'all':!![]}];}return db[_0x4376('0x24')][_0x4376('0x37')](_0x1a9d25);})[_0x4376('0x12')](function(_0x11cc67){_0x4ed22b[_0x4376('0x38')]=_0x11cc67;return _0x4ed22b;})['then'](respondWithFilteredResult(_0x36e806,_0x1a9d25))['catch'](handleError(_0x36e806,null));};exports['show']=function(_0x376f06,_0xab8db){var _0x8ba0d9={'raw':![],'where':{'id':_0x376f06[_0x4376('0x39')]['id']}},_0x4c1180={};_0x4c1180[_0x4376('0x26')]=_[_0x4376('0x3a')](db['VoiceExtension'][_0x4376('0x25')]);_0x4c1180[_0x4376('0x27')]=_[_0x4376('0x3a')](_0x376f06[_0x4376('0x27')]);_0x4c1180[_0x4376('0x28')]=_[_0x4376('0x3b')](_0x4c1180[_0x4376('0x26')],_0x4c1180['query']);_0x8ba0d9['attributes']=_[_0x4376('0x3b')](_0x4c1180[_0x4376('0x26')],qs[_0x4376('0x2a')](_0x376f06[_0x4376('0x27')]['fields']));_0x8ba0d9[_0x4376('0x29')]=_0x8ba0d9[_0x4376('0x29')][_0x4376('0x2b')]?_0x8ba0d9[_0x4376('0x29')]:_0x4c1180[_0x4376('0x26')];if(_0x376f06[_0x4376('0x27')][_0x4376('0x35')]){_0x8ba0d9[_0x4376('0x36')]=[{'all':!![]}];}_0x8ba0d9=_[_0x4376('0x32')]({},_0x8ba0d9,_0x376f06[_0x4376('0x34')]);return db[_0x4376('0x24')]['find'](_0x8ba0d9)['then'](handleEntityNotFound(_0xab8db,null))[_0x4376('0x12')](respondWithResult(_0xab8db,null))[_0x4376('0x3c')](handleError(_0xab8db,null));};exports[_0x4376('0x20')]=function(_0x197624,_0x453771){return db['VoiceExtension']['find']({'where':{'id':_0x197624[_0x4376('0x39')]['id']}})[_0x4376('0x12')](handleEntityNotFound(_0x453771,null))[_0x4376('0x12')](removeEntity(_0x453771,null))['catch'](handleError(_0x453771,null));};exports[_0x4376('0x3d')]=function(_0x47a8f0,_0x4e96e7){if(_0x47a8f0[_0x4376('0x3e')][_0x4376('0x1d')]===_0x4376('0x17')&&!_[_0x4376('0x3f')](_0x47a8f0[_0x4376('0x3e')][_0x4376('0x40')],'_')){_0x47a8f0['body'][_0x4376('0x40')]='_'[_0x4376('0x41')](_0x47a8f0[_0x4376('0x3e')][_0x4376('0x40')]);}return db[_0x4376('0x24')][_0x4376('0x3d')](_0x47a8f0[_0x4376('0x3e')],{'raw':![]})[_0x4376('0x12')](function(_0x54db51){var _0x144570=_0x47a8f0['user']['get']({'plain':!![]});if(!_0x144570)throw new Error(_0x4376('0x42'));if(_0x144570[_0x4376('0x43')]===_0x4376('0x44')){var _0x1875c8=_0x54db51[_0x4376('0x13')]({'plain':!![]});var _0x53f88c=[{'name':_0x4376('0x14'),'value':_0x4376('0x15')},{'name':_0x4376('0x16'),'value':_0x4376('0x17')},{'name':_0x4376('0x18'),'value':_0x4376('0x45')}];var _0x34157b=_[_0x4376('0x46')](_0x53f88c,[_0x4376('0x1c'),_0x1875c8[_0x4376('0x1d')]])[_0x4376('0x1e')];return db['UserProfileSection'][_0x4376('0x46')]({'where':{'name':_0x34157b,'userProfileId':_0x144570['userProfileId']},'raw':!![]})['then'](function(_0xbb76e5){if(_0xbb76e5&&_0xbb76e5['autoAssociation']===0x0){return db['UserProfileResource'][_0x4376('0x3d')]({'name':_0x1875c8[_0x4376('0x1e')],'resourceId':_0x1875c8['id'],'type':_0xbb76e5[_0x4376('0x1e')],'sectionId':_0xbb76e5['id']},{})[_0x4376('0x12')](function(){return _0x54db51;});}else{return _0x54db51;}})[_0x4376('0x3c')](function(_0x50bf90){logger[_0x4376('0x47')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50bf90);throw _0x50bf90;});}return _0x54db51;})[_0x4376('0x12')](respondWithResult(_0x4e96e7,0xc9))[_0x4376('0x3c')](handleError(_0x4e96e7,null));};exports[_0x4376('0x48')]=function(_0x43a6ad,_0x875edb){if(_0x43a6ad[_0x4376('0x3e')]['id']){delete _0x43a6ad[_0x4376('0x3e')]['id'];}return db[_0x4376('0x24')][_0x4376('0x46')]({'where':{'id':_0x43a6ad['params']['id']}})[_0x4376('0x12')](handleEntityNotFound(_0x875edb,null))[_0x4376('0x12')](function(_0x21f2bc){if(_0x21f2bc){return db[_0x4376('0x24')][_0x4376('0x48')](_[_0x4376('0x31')](_0x43a6ad[_0x4376('0x3e')],['exten',_0x4376('0x49'),_0x4376('0x4a'),_0x4376('0x4b'),_0x4376('0x4c'),_0x4376('0x4d'),_0x4376('0x4e')]),{'where':{'context':_0x21f2bc[_0x4376('0x49')],'exten':_0x21f2bc[_0x4376('0x40')]},'individualHooks':!![]})[_0x4376('0x12')](function(_0x293aa6){return _0x293aa6;});}return null;})[_0x4376('0x12')](respondWithStatusCode(_0x875edb,null))[_0x4376('0x3c')](handleError(_0x875edb,null));};exports['addApplications']=function(_0x45c736,_0x379fba){var _0x12f4bc=_0x45c736[_0x4376('0x39')]['id'];var _0x532350=_0x45c736[_0x4376('0x3e')];var _0x29d6d2=0xc8;var _0x20d244=null;return db[_0x4376('0x4f')][_0x4376('0x50')]({'isolationLevel':db[_0x4376('0x4f')]['Transaction'][_0x4376('0x51')]['READ_COMMITTED']},function(_0x3245bf){return db['VoiceExtension'][_0x4376('0x52')]({'where':{'id':_0x12f4bc},'transaction':_0x3245bf})[_0x4376('0x12')](function(_0xa456c5){if(_0xa456c5){return db[_0x4376('0x24')]['destroy']({'where':{'VoiceExtensionId':_0x12f4bc},'transaction':_0x3245bf})['then'](function(){var _0x5890d2=_[_0x4376('0x1b')](_0x532350,function(_0x2fe7dc){_0x2fe7dc[_0x4376('0x53')]=_0x12f4bc;_0x2fe7dc['isApp']=!![];return _0x2fe7dc;});return _0xa456c5['createRouting'](_0x5890d2);})[_0x4376('0x12')](function(_0x422600){return db[_0x4376('0x24')][_0x4376('0x54')](_0x422600,{'transaction':_0x3245bf});});}else{_0x29d6d2=0x194;_0x20d244=[];}});})[_0x4376('0x12')](function(){if(_0x29d6d2!==0x194){return db[_0x4376('0x24')][_0x4376('0x55')]({'where':{'isApp':!![],'VoiceExtensionId':_0x12f4bc},'order':_0x4376('0x56')})[_0x4376('0x12')](function(_0x5ba6e6){_0x20d244=_0x5ba6e6;});}})[_0x4376('0x3c')](function(_0x385096){_0x29d6d2=0x1f4;logger['error'](_0x385096['stack']);if(_0x385096[_0x4376('0x1e')]){delete _0x385096[_0x4376('0x1e')];}_0x20d244=_0x385096;})[_0x4376('0x57')](function(){if(_0x20d244===null){_0x379fba[_0x4376('0x58')](_0x29d6d2);}else{if(_0x29d6d2===0x1f4){_0x379fba[_0x4376('0xb')](_0x29d6d2)[_0x4376('0x22')](_0x20d244);}else{_0x379fba['status'](_0x29d6d2)[_0x4376('0xd')](_0x20d244);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 66fd959..c04d5f8 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 _0xd696=['remove','hasOwnProperty','hook','exports','events','VoiceExtension','setMaxListeners','update'];(function(_0x3e2fcf,_0x579110){var _0x497db7=function(_0x2f713d){while(--_0x2f713d){_0x3e2fcf['push'](_0x3e2fcf['shift']());}};_0x497db7(++_0x579110);}(_0xd696,0x1bc));var _0x6d69=function(_0x4583d0,_0x24551f){_0x4583d0=_0x4583d0-0x0;var _0x7b3c5a=_0xd696[_0x4583d0];return _0x7b3c5a;};'use strict';var EventEmitter=require(_0x6d69('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x6d69('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x6d69('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6d69('0x3'),'afterDestroy':_0x6d69('0x4')};function emitEvent(_0xa20570){return function(_0x39a16d,_0x23fb30,_0x386d95){VoiceExtensionEvents['emit'](_0xa20570+':'+_0x39a16d['id'],_0x39a16d);VoiceExtensionEvents['emit'](_0xa20570,_0x39a16d);_0x386d95(null);};}for(var e in events){if(events[_0x6d69('0x5')](e)){var event=events[e];VoiceExtension[_0x6d69('0x6')](e,emitEvent(event));}}module[_0x6d69('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x5fce=['../../mysqldb','VoiceExtension','save','remove','emit','exports'];(function(_0x2d9a62,_0x1ef85f){var _0x28c733=function(_0x418253){while(--_0x418253){_0x2d9a62['push'](_0x2d9a62['shift']());}};_0x28c733(++_0x1ef85f);}(_0x5fce,0xae));var _0xe5fc=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5fce[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xe5fc('0x0'))['db'][_0xe5fc('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe5fc('0x2'),'afterUpdate':'update','afterDestroy':_0xe5fc('0x3')};function emitEvent(_0x283c66){return function(_0x17e8df,_0x49158d,_0x25fb31){VoiceExtensionEvents[_0xe5fc('0x4')](_0x283c66+':'+_0x17e8df['id'],_0x17e8df);VoiceExtensionEvents[_0xe5fc('0x4')](_0x283c66,_0x17e8df);_0x25fb31(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xe5fc('0x5')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 0273ab2..8d49e40 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 _0x2409=['CDR(destination)=','cutdigits','${EXTEN:','ExecIf','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','wav','trunk','timeout','url','param','split','phone','prefix','${EXTEN}','join','options','indexOf','U(xcally-mixmonitor-context)','replace','Interval','findAll','IntervalId','then','length','*,*,*,*','intervals','interval','map','filter','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','appdata','priority','last','concat','catch','get','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','context','exten','NoOp','alias','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(routeAlias)=','No\x20alias\x20set'];(function(_0x171de5,_0x260fd1){var _0x1c2d68=function(_0x111adc){while(--_0x111adc){_0x171de5['push'](_0x171de5['shift']());}};_0x1c2d68(++_0x260fd1);}(_0x2409,0x128));var _0x9240=function(_0x8df9fd,_0x4308f4){_0x8df9fd=_0x8df9fd-0x0;var _0x572563=_0x2409[_0x8df9fd];return _0x572563;};'use strict';var _=require(_0x9240('0x0'));var attributes=require(_0x9240('0x1'));module[_0x9240('0x2')]=function(_0x238ca5){var _0x45933d=_0x238ca5[_0x9240('0x3')];function _0x4d88c7(_0x387668){var _0x6947ae=0x2;var _0x3d3683=[{'type':_0x387668[_0x9240('0x4')],'app':_0x9240('0x5'),'appdata':'CDR(type)='+_0x387668[_0x9240('0x4')],'context':_0x387668[_0x9240('0x6')],'exten':_0x387668[_0x9240('0x7')],'priority':_0x6947ae++,'VoiceExtensionId':_0x387668['id']},{'type':_0x387668['type'],'app':_0x387668['alias']?'Set':_0x9240('0x8'),'appdata':_0x387668[_0x9240('0x9')]?'CDR(routeAlias)='+_0x387668[_0x9240('0x9')]:'No\x20alias\x20set','context':_0x387668['context'],'exten':_0x387668[_0x9240('0x7')],'priority':_0x6947ae++,'VoiceExtensionId':_0x387668['id']}];if(_0x387668['type']===_0x9240('0xa')){_0x3d3683[_0x9240('0xb')]({'type':_0x9240('0xa'),'app':_0x9240('0x5'),'appdata':_0x9240('0xc')+_0x387668['id'],'context':_0x387668[_0x9240('0x6')],'exten':_0x387668['exten'],'priority':_0x6947ae++,'VoiceExtensionId':_0x387668['id']});}_0x3d3683[_0x9240('0xb')]({'type':_0x387668['type'],'app':_0x9240('0x5'),'appdata':_0x9240('0xd'),'context':_0x387668[_0x9240('0x6')],'exten':_0x387668[_0x9240('0x7')],'priority':_0x6947ae++,'VoiceExtensionId':_0x387668['id']},{'type':_0x387668[_0x9240('0x4')],'app':_0x9240('0x5'),'appdata':_0x9240('0xe'),'context':_0x387668[_0x9240('0x6')],'exten':_0x387668[_0x9240('0x7')],'priority':_0x6947ae++,'VoiceExtensionId':_0x387668['id']},{'type':_0x387668[_0x9240('0x4')],'app':_0x9240('0x5'),'appdata':_0x9240('0xf'),'context':_0x387668['context'],'exten':_0x387668[_0x9240('0x7')],'priority':_0x6947ae++,'VoiceExtensionId':_0x387668['id']});return _0x3d3683;}function _0x3fab8c(_0x56fc22){var _0x55ed28=0x2;var _0x2242c6=[{'type':_0x9240('0x10'),'app':_0x9240('0x5'),'appdata':_0x9240('0x11'),'context':_0x56fc22[_0x9240('0x6')],'exten':_0x56fc22[_0x9240('0x7')],'priority':_0x55ed28++,'VoiceExtensionId':_0x56fc22['id']},{'type':_0x9240('0x10'),'app':_0x56fc22[_0x9240('0x9')]?'Set':_0x9240('0x8'),'appdata':_0x56fc22[_0x9240('0x9')]?_0x9240('0x12')+_0x56fc22[_0x9240('0x9')]:_0x9240('0x13'),'context':_0x56fc22[_0x9240('0x6')],'exten':_0x56fc22[_0x9240('0x7')],'priority':_0x55ed28++,'VoiceExtensionId':_0x56fc22['id']},{'type':_0x9240('0x10'),'app':_0x9240('0x5'),'appdata':_0x9240('0x14')+(_0x56fc22[_0x9240('0x15')]?_0x9240('0x16')+_0x56fc22[_0x9240('0x15')]+'}':'${EXTEN}'),'context':_0x56fc22[_0x9240('0x6')],'exten':_0x56fc22['exten'],'priority':_0x55ed28++,'VoiceExtensionId':_0x56fc22['id']},{'type':'outbound','app':_0x9240('0x5'),'appdata':_0x9240('0xc')+_0x56fc22['id'],'context':_0x56fc22[_0x9240('0x6')],'exten':_0x56fc22[_0x9240('0x7')],'priority':_0x55ed28++,'VoiceExtensionId':_0x56fc22['id']},{'type':'outbound','app':_0x9240('0x17'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x55ed28+0x2)+'):Goto('+(_0x55ed28+0x1)+')','context':_0x56fc22[_0x9240('0x6')],'exten':_0x56fc22['exten'],'priority':_0x55ed28++,'VoiceExtensionId':_0x56fc22['id']},{'type':_0x9240('0x10'),'app':_0x9240('0x5'),'appdata':_0x56fc22['cutdigits']?_0x9240('0x18')+_0x56fc22[_0x9240('0x15')]+'}':_0x9240('0x19'),'context':_0x56fc22[_0x9240('0x6')],'exten':_0x56fc22[_0x9240('0x7')],'priority':_0x55ed28++,'VoiceExtensionId':_0x56fc22['id']},{'type':'outbound','app':_0x9240('0x5'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x56fc22['context'],'exten':_0x56fc22[_0x9240('0x7')],'priority':_0x55ed28++,'VoiceExtensionId':_0x56fc22['id']},{'type':'outbound','app':_0x9240('0x5'),'appdata':_0x9240('0xe'),'context':_0x56fc22['context'],'exten':_0x56fc22[_0x9240('0x7')],'priority':_0x55ed28++,'VoiceExtensionId':_0x56fc22['id']},{'type':_0x9240('0x10'),'app':_0x9240('0x5'),'appdata':_0x9240('0xf'),'context':_0x56fc22['context'],'exten':_0x56fc22['exten'],'priority':_0x55ed28++,'VoiceExtensionId':_0x56fc22['id']},{'type':_0x9240('0x10'),'app':_0x9240('0x5'),'appdata':_0x9240('0x1a')+_0x56fc22['id'],'context':_0x56fc22[_0x9240('0x6')],'exten':_0x56fc22[_0x9240('0x7')],'priority':_0x55ed28++,'VoiceExtensionId':_0x56fc22['id']}];if(_0x56fc22[_0x9240('0x1b')](_0x9240('0x1c'))&&_0x56fc22[_0x9240('0x1c')]!==_0x9240('0x1d')){_0x2242c6[_0x9240('0xb')]({'type':_0x9240('0x10'),'app':_0x9240('0x5'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x56fc22['context'],'exten':_0x56fc22[_0x9240('0x7')],'priority':_0x55ed28++,'VoiceExtensionId':_0x56fc22['id']},{'type':_0x9240('0x10'),'app':_0x9240('0x5'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x56fc22[_0x9240('0x1c')]||_0x9240('0x1e'),'context':_0x56fc22[_0x9240('0x6')],'exten':_0x56fc22['exten'],'priority':_0x55ed28++,'VoiceExtensionId':_0x56fc22['id']});}return _0x2242c6;}function _0x50c2e3(_0xa51f28,_0x3a7444){var _0x57eb15=[{'name':_0x9240('0x1f'),'param':0x0},{'name':_0x9240('0x20'),'param':0x1},{'name':'options','param':0x2},{'name':_0x9240('0x21'),'param':0x3}];var _0x3b4e5d={};var _0x25dd26=_0x3a7444['split'](',');var _0x62a7b6=[];for(var _0x895997=0x0;_0x895997<_0x57eb15['length'];_0x895997++){switch(_0x57eb15[_0x895997]['name']){case _0x9240('0x1f'):_0x3b4e5d[_0x9240('0x1f')]=_0x25dd26[_0x57eb15[_0x895997][_0x9240('0x22')]][_0x9240('0x23')]('/')[0x1];_0x3b4e5d[_0x9240('0x24')]=_0x25dd26[_0x57eb15[_0x895997][_0x9240('0x22')]][_0x9240('0x23')]('/')[0x2];_0x3b4e5d[_0x9240('0x25')]=_0x3b4e5d[_0x9240('0x24')]?_0x3b4e5d[_0x9240('0x24')][_0x9240('0x23')]('$')[0x0]:undefined;_0x3b4e5d[_0x9240('0x24')]=_0xa51f28[_0x9240('0x15')]?(_0x3b4e5d[_0x9240('0x25')]||'')+_0x9240('0x16')+_0xa51f28['cutdigits']+'}':(_0x3b4e5d[_0x9240('0x25')]||'')+_0x9240('0x26');_0x62a7b6[_0x57eb15[_0x895997][_0x9240('0x22')]]=['SIP',_0x3b4e5d[_0x9240('0x1f')],_0x3b4e5d[_0x9240('0x24')]][_0x9240('0x27')]('/');break;case _0x9240('0x28'):_0x3b4e5d['options']=_0x25dd26[_0x57eb15[_0x895997][_0x9240('0x22')]];if(_0xa51f28['recordingFormat']!==_0x9240('0x1d')){if(_0x3b4e5d[_0x9240('0x28')][_0x9240('0x29')](_0x9240('0x2a'))<0x0){_0x3b4e5d[_0x9240('0x28')]+=_0x9240('0x2a');}}else{_0x3b4e5d['options']=_0x3b4e5d[_0x9240('0x28')][_0x9240('0x2b')](_0x9240('0x2a'),'');}_0x62a7b6[_0x57eb15[_0x895997]['param']]=_0x3b4e5d['options'];break;default:_0x62a7b6[_0x57eb15[_0x895997]['param']]=_0x25dd26[_0x57eb15[_0x895997][_0x9240('0x22')]];}}return _0x62a7b6[_0x9240('0x27')](',');}function _0x29e44f(_0x1e6c55,_0x1e6791,_0x1e34ee){return new Promise(function(_0x534591,_0x541762){var _0x1c17b8=[];if(_['isEmpty'](_0x1e6791))return _0x534591(_0x1c17b8);_0x45933d[_0x9240('0x2c')][_0x9240('0x2d')]({'attributes':['id','interval',_0x9240('0x2e')],'raw':!![]})[_0x9240('0x2f')](function(_0x23e415){for(var _0x45007a=0x0,_0xbe6835=0x0;_0x45007a<_0x1e6791[_0x9240('0x30')];_0x45007a++,_0xbe6835=0x0){var _0x5d5205=_0x1e6791[_0x45007a];var _0x4f35ee=[];var _0x1aba64=[];delete _0x5d5205['id'];if(_0x5d5205['interval']!==_0x9240('0x31')){_0x5d5205[_0x9240('0x32')]=[_0x5d5205[_0x9240('0x33')]];}else{_0x5d5205[_0x9240('0x32')]=_0x5d5205['IntervalId']?_[_0x9240('0x34')](_[_0x9240('0x35')](_0x23e415,{'IntervalId':_0x5d5205[_0x9240('0x2e')]}),_0x9240('0x33')):[];}_0x5d5205['context']=_0x1e6c55[_0x9240('0x6')];_0x5d5205['exten']=_0x1e6c55[_0x9240('0x7')];if(_0x5d5205['type'])_0x5d5205['type']=_0x5d5205[_0x9240('0x4')][_0x9240('0x36')]();if(_0x1e6c55[_0x9240('0x4')]===_0x9240('0x10')){if(_0x5d5205[_0x9240('0x1b')]('tag')&&_0x5d5205['tag']&&_0x5d5205['tag']!=='--'){_0x4f35ee[_0x9240('0xb')]({'type':_0x5d5205[_0x9240('0x4')][_0x9240('0x36')](),'app':'Set','appdata':_0x9240('0x37')+_0x5d5205['tag'],'context':_0x1e6c55[_0x9240('0x6')],'exten':_0x1e6c55[_0x9240('0x7')],'priority':_0x5d5205[_0x9240('0x32')][_0x9240('0x30')]+_0x1e34ee+_0xbe6835++,'VoiceExtensionId':_0x1e6c55['id']});}_0x4f35ee['push']({'type':_0x5d5205[_0x9240('0x4')][_0x9240('0x36')](),'app':_0x9240('0x17'),'appdata':_0x9240('0x38')+(_0x5d5205[_0x9240('0x39')]?_0x9240('0x3a')+_0x5d5205['callerID']+')':_0x9240('0x3b')),'context':_0x1e6c55[_0x9240('0x6')],'exten':_0x1e6c55[_0x9240('0x7')],'priority':_0x5d5205[_0x9240('0x32')][_0x9240('0x30')]+_0x1e34ee+_0xbe6835++,'VoiceExtensionId':_0x1e6c55['id']});}else{if(_0x5d5205[_0x9240('0x1b')](_0x9240('0x3c'))){if([_0x9240('0x3d'),_0x9240('0x3e')]['includes'](_0x5d5205[_0x9240('0x3f')][_0x9240('0x36')]())&&_0x5d5205[_0x9240('0x40')]!==_0x9240('0x41')){if(_0x5d5205[_0x9240('0x3c')]){_0x4f35ee['push']({'type':_0x5d5205['type'][_0x9240('0x36')](),'app':_0x9240('0x17'),'appdata':_0x9240('0x42'),'context':_0x1e6c55[_0x9240('0x6')],'exten':_0x1e6c55[_0x9240('0x7')],'priority':_0x5d5205['intervals'][_0x9240('0x30')]+_0x1e34ee+_0xbe6835++,'VoiceExtensionId':_0x1e6c55['id']});_0x4f35ee[_0x9240('0xb')]({'type':_0x5d5205[_0x9240('0x4')][_0x9240('0x36')](),'app':_0x9240('0x5'),'appdata':_0x9240('0x43'),'context':_0x1e6c55['context'],'exten':_0x1e6c55['exten'],'priority':_0x5d5205[_0x9240('0x32')][_0x9240('0x30')]+_0x1e34ee+_0xbe6835++,'VoiceExtensionId':_0x1e6c55['id']});}else{_0x4f35ee['push']({'type':_0x5d5205[_0x9240('0x4')][_0x9240('0x36')](),'app':_0x9240('0x17'),'appdata':_0x9240('0x44'),'context':_0x1e6c55[_0x9240('0x6')],'exten':_0x1e6c55['exten'],'priority':_0x5d5205[_0x9240('0x32')][_0x9240('0x30')]+_0x1e34ee+_0xbe6835++,'VoiceExtensionId':_0x1e6c55['id']});_0x4f35ee[_0x9240('0xb')]({'type':_0x5d5205['type'][_0x9240('0x36')](),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x1e6c55[_0x9240('0x6')],'exten':_0x1e6c55['exten'],'priority':_0x5d5205[_0x9240('0x32')][_0x9240('0x30')]+_0x1e34ee+_0xbe6835++,'VoiceExtensionId':_0x1e6c55['id']});}}}}for(var _0x59f4c8=0x0;_0x59f4c8<_0x5d5205[_0x9240('0x32')]['length'];_0x59f4c8++){var _0x55d6e3=_0x1e34ee+_0x5d5205[_0x9240('0x32')][_0x9240('0x30')];var _0x4d8b35=_0x59f4c8===_0x5d5205['intervals'][_0x9240('0x30')]-0x1?_0x1e34ee+_0x4f35ee[_0x9240('0x30')]+_0x1aba64['length']+0x2:_0x1e34ee+_0x59f4c8+0x1;_0x4f35ee[_0x9240('0x45')](_0x59f4c8,0x0,{'type':_0x1e6c55[_0x9240('0x4')],'app':_0x9240('0x46'),'appdata':_0x5d5205[_0x9240('0x32')][_0x59f4c8]+'?'+_0x1e6c55[_0x9240('0x6')]+_0x9240('0x47')+_0x55d6e3+':'+_0x1e6c55[_0x9240('0x6')]+',${EXTEN},'+_0x4d8b35,'exten':_0x1e6c55[_0x9240('0x7')],'context':_0x1e6c55[_0x9240('0x6')],'priority':_0x1e34ee+_0x59f4c8,'VoiceExtensionId':_0x1e6c55['id']});}if(_0x5d5205[_0x9240('0x40')]==='outboundDial')_0x5d5205[_0x9240('0x48')]=_0x50c2e3(_0x1e6c55,_0x5d5205[_0x9240('0x48')]);_0x5d5205[_0x9240('0x49')]=_0x4f35ee[_0x9240('0x30')]?_[_0x9240('0x4a')](_0x4f35ee)['priority']+0x1:_0x1e34ee;_0x1c17b8=_[_0x9240('0x4b')](_0x1c17b8,_0x4f35ee,[_0x5d5205],_0x1aba64);_0x1e34ee=_[_0x9240('0x4a')](_0x1c17b8)['priority']+0x1;}return _0x534591(_0x1c17b8);})[_0x9240('0x4c')](function(_0x18b33c){_0x541762(_0x18b33c);});});}return _0x238ca5['define']('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x49695e){var _0x2d03d6=this[_0x9240('0x4d')]({'plain':!![]});var _0x59d6b8=_0x2d03d6[_0x9240('0x4')]===_0x9240('0x10')?_0x3fab8c(_0x2d03d6):_0x4d88c7(_0x2d03d6);return _0x29e44f(_0x2d03d6,_0x49695e,_[_0x9240('0x4a')](_0x59d6b8)[_0x9240('0x49')]+0x1)[_0x9240('0x2f')](function(_0x152e96){var _0x152cd3=_[_0x9240('0x4b')](_0x59d6b8,_0x152e96);_0x152cd3[_0x9240('0xb')]({'type':_0x2d03d6[_0x9240('0x4')],'app':_0x9240('0x4e'),'exten':_0x2d03d6[_0x9240('0x7')],'context':_0x2d03d6['context'],'priority':_[_0x9240('0x4a')](_0x152cd3)[_0x9240('0x49')]+0x1,'VoiceExtensionId':_0x2d03d6['id']});return _0x152cd3;});}}});}; \ No newline at end of file +var _0xb2ac=['timeout','options','url','split','name','trunk','param','phone','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','interval','IntervalId','*,*,*,*','map','filter','toLowerCase','tag','intervals','length','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','playback','app','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','priority','last','concat','VoiceExtension','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','NoOp','CDR(routeAlias)=','alias','No\x20alias\x20set','inbound','push','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav'];(function(_0x2dcacf,_0x1ef0f8){var _0x533652=function(_0x9fbba2){while(--_0x9fbba2){_0x2dcacf['push'](_0x2dcacf['shift']());}};_0x533652(++_0x1ef0f8);}(_0xb2ac,0x16a));var _0xcb2a=function(_0xd3ed61,_0x1baa71){_0xd3ed61=_0xd3ed61-0x0;var _0x26e634=_0xb2ac[_0xd3ed61];return _0x26e634;};'use strict';var _=require(_0xcb2a('0x0'));var attributes=require(_0xcb2a('0x1'));module[_0xcb2a('0x2')]=function(_0x18a01a){var _0xe79674=_0x18a01a[_0xcb2a('0x3')];function _0x5db7e9(_0x1dd59b){var _0x19c4aa=0x2;var _0x3fa7c3=[{'type':_0x1dd59b[_0xcb2a('0x4')],'app':_0xcb2a('0x5'),'appdata':_0xcb2a('0x6')+_0x1dd59b['type'],'context':_0x1dd59b[_0xcb2a('0x7')],'exten':_0x1dd59b[_0xcb2a('0x8')],'priority':_0x19c4aa++,'VoiceExtensionId':_0x1dd59b['id']},{'type':_0x1dd59b['type'],'app':_0x1dd59b['alias']?'Set':_0xcb2a('0x9'),'appdata':_0x1dd59b['alias']?_0xcb2a('0xa')+_0x1dd59b[_0xcb2a('0xb')]:_0xcb2a('0xc'),'context':_0x1dd59b[_0xcb2a('0x7')],'exten':_0x1dd59b[_0xcb2a('0x8')],'priority':_0x19c4aa++,'VoiceExtensionId':_0x1dd59b['id']}];if(_0x1dd59b['type']===_0xcb2a('0xd')){_0x3fa7c3[_0xcb2a('0xe')]({'type':'inbound','app':_0xcb2a('0x5'),'appdata':'CDR(routeid)='+_0x1dd59b['id'],'context':_0x1dd59b['context'],'exten':_0x1dd59b[_0xcb2a('0x8')],'priority':_0x19c4aa++,'VoiceExtensionId':_0x1dd59b['id']});}_0x3fa7c3[_0xcb2a('0xe')]({'type':_0x1dd59b[_0xcb2a('0x4')],'app':_0xcb2a('0x5'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1dd59b[_0xcb2a('0x7')],'exten':_0x1dd59b[_0xcb2a('0x8')],'priority':_0x19c4aa++,'VoiceExtensionId':_0x1dd59b['id']},{'type':_0x1dd59b['type'],'app':_0xcb2a('0x5'),'appdata':_0xcb2a('0xf'),'context':_0x1dd59b[_0xcb2a('0x7')],'exten':_0x1dd59b[_0xcb2a('0x8')],'priority':_0x19c4aa++,'VoiceExtensionId':_0x1dd59b['id']},{'type':_0x1dd59b[_0xcb2a('0x4')],'app':_0xcb2a('0x5'),'appdata':_0xcb2a('0x10'),'context':_0x1dd59b[_0xcb2a('0x7')],'exten':_0x1dd59b['exten'],'priority':_0x19c4aa++,'VoiceExtensionId':_0x1dd59b['id']});return _0x3fa7c3;}function _0x487eec(_0x2b02b3){var _0x31fe86=0x2;var _0x5279be=[{'type':'outbound','app':_0xcb2a('0x5'),'appdata':_0xcb2a('0x11'),'context':_0x2b02b3[_0xcb2a('0x7')],'exten':_0x2b02b3[_0xcb2a('0x8')],'priority':_0x31fe86++,'VoiceExtensionId':_0x2b02b3['id']},{'type':_0xcb2a('0x12'),'app':_0x2b02b3[_0xcb2a('0xb')]?_0xcb2a('0x5'):'NoOp','appdata':_0x2b02b3[_0xcb2a('0xb')]?_0xcb2a('0xa')+_0x2b02b3[_0xcb2a('0xb')]:_0xcb2a('0xc'),'context':_0x2b02b3[_0xcb2a('0x7')],'exten':_0x2b02b3[_0xcb2a('0x8')],'priority':_0x31fe86++,'VoiceExtensionId':_0x2b02b3['id']},{'type':_0xcb2a('0x12'),'app':_0xcb2a('0x5'),'appdata':'CDR(destination)='+(_0x2b02b3[_0xcb2a('0x13')]?_0xcb2a('0x14')+_0x2b02b3[_0xcb2a('0x13')]+'}':_0xcb2a('0x15')),'context':_0x2b02b3['context'],'exten':_0x2b02b3[_0xcb2a('0x8')],'priority':_0x31fe86++,'VoiceExtensionId':_0x2b02b3['id']},{'type':_0xcb2a('0x12'),'app':_0xcb2a('0x5'),'appdata':_0xcb2a('0x16')+_0x2b02b3['id'],'context':_0x2b02b3['context'],'exten':_0x2b02b3[_0xcb2a('0x8')],'priority':_0x31fe86++,'VoiceExtensionId':_0x2b02b3['id']},{'type':_0xcb2a('0x12'),'app':_0xcb2a('0x17'),'appdata':_0xcb2a('0x18')+(_0x31fe86+0x2)+'):Goto('+(_0x31fe86+0x1)+')','context':_0x2b02b3[_0xcb2a('0x7')],'exten':_0x2b02b3[_0xcb2a('0x8')],'priority':_0x31fe86++,'VoiceExtensionId':_0x2b02b3['id']},{'type':_0xcb2a('0x12'),'app':'Set','appdata':_0x2b02b3[_0xcb2a('0x13')]?_0xcb2a('0x19')+_0x2b02b3[_0xcb2a('0x13')]+'}':_0xcb2a('0x1a'),'context':_0x2b02b3[_0xcb2a('0x7')],'exten':_0x2b02b3['exten'],'priority':_0x31fe86++,'VoiceExtensionId':_0x2b02b3['id']},{'type':_0xcb2a('0x12'),'app':'Set','appdata':_0xcb2a('0x1b'),'context':_0x2b02b3[_0xcb2a('0x7')],'exten':_0x2b02b3[_0xcb2a('0x8')],'priority':_0x31fe86++,'VoiceExtensionId':_0x2b02b3['id']},{'type':_0xcb2a('0x12'),'app':_0xcb2a('0x5'),'appdata':_0xcb2a('0xf'),'context':_0x2b02b3[_0xcb2a('0x7')],'exten':_0x2b02b3['exten'],'priority':_0x31fe86++,'VoiceExtensionId':_0x2b02b3['id']},{'type':_0xcb2a('0x12'),'app':_0xcb2a('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0x2b02b3[_0xcb2a('0x7')],'exten':_0x2b02b3[_0xcb2a('0x8')],'priority':_0x31fe86++,'VoiceExtensionId':_0x2b02b3['id']},{'type':'outbound','app':'Set','appdata':'outboundrouteid='+_0x2b02b3['id'],'context':_0x2b02b3[_0xcb2a('0x7')],'exten':_0x2b02b3[_0xcb2a('0x8')],'priority':_0x31fe86++,'VoiceExtensionId':_0x2b02b3['id']}];if(_0x2b02b3[_0xcb2a('0x1c')](_0xcb2a('0x1d'))&&_0x2b02b3[_0xcb2a('0x1d')]!==_0xcb2a('0x1e')){_0x5279be[_0xcb2a('0xe')]({'type':_0xcb2a('0x12'),'app':'Set','appdata':_0xcb2a('0x1f'),'context':_0x2b02b3[_0xcb2a('0x7')],'exten':_0x2b02b3['exten'],'priority':_0x31fe86++,'VoiceExtensionId':_0x2b02b3['id']},{'type':_0xcb2a('0x12'),'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x2b02b3['recordingFormat']||_0xcb2a('0x20'),'context':_0x2b02b3[_0xcb2a('0x7')],'exten':_0x2b02b3[_0xcb2a('0x8')],'priority':_0x31fe86++,'VoiceExtensionId':_0x2b02b3['id']});}return _0x5279be;}function _0x6329c6(_0x5b744f,_0x382552){var _0x1becec=[{'name':'trunk','param':0x0},{'name':_0xcb2a('0x21'),'param':0x1},{'name':_0xcb2a('0x22'),'param':0x2},{'name':_0xcb2a('0x23'),'param':0x3}];var _0x3720a2={};var _0x162dbc=_0x382552[_0xcb2a('0x24')](',');var _0x16cdce=[];for(var _0x4ecca8=0x0;_0x4ecca8<_0x1becec['length'];_0x4ecca8++){switch(_0x1becec[_0x4ecca8][_0xcb2a('0x25')]){case _0xcb2a('0x26'):_0x3720a2[_0xcb2a('0x26')]=_0x162dbc[_0x1becec[_0x4ecca8][_0xcb2a('0x27')]][_0xcb2a('0x24')]('/')[0x1];_0x3720a2[_0xcb2a('0x28')]=_0x162dbc[_0x1becec[_0x4ecca8]['param']]['split']('/')[0x2];_0x3720a2[_0xcb2a('0x29')]=_0x3720a2['phone']?_0x3720a2[_0xcb2a('0x28')][_0xcb2a('0x24')]('$')[0x0]:undefined;_0x3720a2['phone']=_0x5b744f[_0xcb2a('0x13')]?(_0x3720a2[_0xcb2a('0x29')]||'')+'${EXTEN:'+_0x5b744f[_0xcb2a('0x13')]+'}':(_0x3720a2[_0xcb2a('0x29')]||'')+'${EXTEN}';_0x16cdce[_0x1becec[_0x4ecca8][_0xcb2a('0x27')]]=[_0xcb2a('0x2a'),_0x3720a2['trunk'],_0x3720a2[_0xcb2a('0x28')]][_0xcb2a('0x2b')]('/');break;case _0xcb2a('0x22'):_0x3720a2[_0xcb2a('0x22')]=_0x162dbc[_0x1becec[_0x4ecca8][_0xcb2a('0x27')]];if(_0x5b744f[_0xcb2a('0x1d')]!==_0xcb2a('0x1e')){if(_0x3720a2['options'][_0xcb2a('0x2c')](_0xcb2a('0x2d'))<0x0){_0x3720a2[_0xcb2a('0x22')]+=_0xcb2a('0x2d');}}else{_0x3720a2['options']=_0x3720a2[_0xcb2a('0x22')]['replace'](_0xcb2a('0x2d'),'');}_0x16cdce[_0x1becec[_0x4ecca8]['param']]=_0x3720a2[_0xcb2a('0x22')];break;default:_0x16cdce[_0x1becec[_0x4ecca8][_0xcb2a('0x27')]]=_0x162dbc[_0x1becec[_0x4ecca8][_0xcb2a('0x27')]];}}return _0x16cdce[_0xcb2a('0x2b')](',');}function _0x453c04(_0x57eabb,_0x2e593c,_0x1496af){return new Promise(function(_0x3cbbda,_0x733f1){var _0x138be9=[];if(_[_0xcb2a('0x2e')](_0x2e593c))return _0x3cbbda(_0x138be9);_0xe79674[_0xcb2a('0x2f')][_0xcb2a('0x30')]({'attributes':['id',_0xcb2a('0x31'),_0xcb2a('0x32')],'raw':!![]})['then'](function(_0x3a90b1){for(var _0x459274=0x0,_0x2cce96=0x0;_0x459274<_0x2e593c['length'];_0x459274++,_0x2cce96=0x0){var _0x2c981b=_0x2e593c[_0x459274];var _0x56b80f=[];var _0xf95b5a=[];delete _0x2c981b['id'];if(_0x2c981b['interval']!==_0xcb2a('0x33')){_0x2c981b['intervals']=[_0x2c981b[_0xcb2a('0x31')]];}else{_0x2c981b['intervals']=_0x2c981b[_0xcb2a('0x32')]?_[_0xcb2a('0x34')](_[_0xcb2a('0x35')](_0x3a90b1,{'IntervalId':_0x2c981b[_0xcb2a('0x32')]}),_0xcb2a('0x31')):[];}_0x2c981b[_0xcb2a('0x7')]=_0x57eabb['context'];_0x2c981b['exten']=_0x57eabb['exten'];if(_0x2c981b[_0xcb2a('0x4')])_0x2c981b[_0xcb2a('0x4')]=_0x2c981b[_0xcb2a('0x4')][_0xcb2a('0x36')]();if(_0x57eabb[_0xcb2a('0x4')]==='outbound'){if(_0x2c981b[_0xcb2a('0x1c')](_0xcb2a('0x37'))&&_0x2c981b[_0xcb2a('0x37')]&&_0x2c981b[_0xcb2a('0x37')]!=='--'){_0x56b80f[_0xcb2a('0xe')]({'type':_0x2c981b[_0xcb2a('0x4')][_0xcb2a('0x36')](),'app':_0xcb2a('0x5'),'appdata':'CDR(tag)='+_0x2c981b['tag'],'context':_0x57eabb['context'],'exten':_0x57eabb[_0xcb2a('0x8')],'priority':_0x2c981b[_0xcb2a('0x38')][_0xcb2a('0x39')]+_0x1496af+_0x2cce96++,'VoiceExtensionId':_0x57eabb['id']});}_0x56b80f[_0xcb2a('0xe')]({'type':_0x2c981b[_0xcb2a('0x4')][_0xcb2a('0x36')](),'app':_0xcb2a('0x17'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x2c981b['callerID']?_0xcb2a('0x3a')+_0x2c981b['callerID']+')':_0xcb2a('0x3b')),'context':_0x57eabb[_0xcb2a('0x7')],'exten':_0x57eabb[_0xcb2a('0x8')],'priority':_0x2c981b[_0xcb2a('0x38')][_0xcb2a('0x39')]+_0x1496af+_0x2cce96++,'VoiceExtensionId':_0x57eabb['id']});}else{if(_0x2c981b[_0xcb2a('0x1c')](_0xcb2a('0x3c'))){if(['queue',_0xcb2a('0x3d')]['includes'](_0x2c981b[_0xcb2a('0x3e')]['toLowerCase']())&&_0x2c981b['appType']!=='custom'){if(_0x2c981b[_0xcb2a('0x3c')]){_0x56b80f[_0xcb2a('0xe')]({'type':_0x2c981b[_0xcb2a('0x4')][_0xcb2a('0x36')](),'app':_0xcb2a('0x17'),'appdata':_0xcb2a('0x3f'),'context':_0x57eabb['context'],'exten':_0x57eabb[_0xcb2a('0x8')],'priority':_0x2c981b[_0xcb2a('0x38')]['length']+_0x1496af+_0x2cce96++,'VoiceExtensionId':_0x57eabb['id']});_0x56b80f[_0xcb2a('0xe')]({'type':_0x2c981b[_0xcb2a('0x4')]['toLowerCase'](),'app':_0xcb2a('0x5'),'appdata':_0xcb2a('0x40'),'context':_0x57eabb[_0xcb2a('0x7')],'exten':_0x57eabb[_0xcb2a('0x8')],'priority':_0x2c981b[_0xcb2a('0x38')][_0xcb2a('0x39')]+_0x1496af+_0x2cce96++,'VoiceExtensionId':_0x57eabb['id']});}else{_0x56b80f[_0xcb2a('0xe')]({'type':_0x2c981b[_0xcb2a('0x4')][_0xcb2a('0x36')](),'app':_0xcb2a('0x17'),'appdata':_0xcb2a('0x41'),'context':_0x57eabb['context'],'exten':_0x57eabb[_0xcb2a('0x8')],'priority':_0x2c981b[_0xcb2a('0x38')][_0xcb2a('0x39')]+_0x1496af+_0x2cce96++,'VoiceExtensionId':_0x57eabb['id']});_0x56b80f[_0xcb2a('0xe')]({'type':_0x2c981b['type'][_0xcb2a('0x36')](),'app':_0xcb2a('0x5'),'appdata':_0xcb2a('0x42'),'context':_0x57eabb['context'],'exten':_0x57eabb[_0xcb2a('0x8')],'priority':_0x2c981b['intervals'][_0xcb2a('0x39')]+_0x1496af+_0x2cce96++,'VoiceExtensionId':_0x57eabb['id']});}}}}for(var _0x173fef=0x0;_0x173fef<_0x2c981b[_0xcb2a('0x38')][_0xcb2a('0x39')];_0x173fef++){var _0x37a473=_0x1496af+_0x2c981b['intervals']['length'];var _0x539f53=_0x173fef===_0x2c981b[_0xcb2a('0x38')][_0xcb2a('0x39')]-0x1?_0x1496af+_0x56b80f[_0xcb2a('0x39')]+_0xf95b5a[_0xcb2a('0x39')]+0x2:_0x1496af+_0x173fef+0x1;_0x56b80f['splice'](_0x173fef,0x0,{'type':_0x57eabb[_0xcb2a('0x4')],'app':_0xcb2a('0x43'),'appdata':_0x2c981b[_0xcb2a('0x38')][_0x173fef]+'?'+_0x57eabb[_0xcb2a('0x7')]+_0xcb2a('0x44')+_0x37a473+':'+_0x57eabb[_0xcb2a('0x7')]+_0xcb2a('0x44')+_0x539f53,'exten':_0x57eabb[_0xcb2a('0x8')],'context':_0x57eabb[_0xcb2a('0x7')],'priority':_0x1496af+_0x173fef,'VoiceExtensionId':_0x57eabb['id']});}if(_0x2c981b[_0xcb2a('0x45')]===_0xcb2a('0x46'))_0x2c981b['appdata']=_0x6329c6(_0x57eabb,_0x2c981b[_0xcb2a('0x47')]);_0x2c981b[_0xcb2a('0x48')]=_0x56b80f['length']?_[_0xcb2a('0x49')](_0x56b80f)['priority']+0x1:_0x1496af;_0x138be9=_[_0xcb2a('0x4a')](_0x138be9,_0x56b80f,[_0x2c981b],_0xf95b5a);_0x1496af=_['last'](_0x138be9)[_0xcb2a('0x48')]+0x1;}return _0x3cbbda(_0x138be9);})['catch'](function(_0x1f99ef){_0x733f1(_0x1f99ef);});});}return _0x18a01a['define'](_0xcb2a('0x4b'),attributes,{'tableName':_0xcb2a('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1b9bcd){var _0x3c3fd6=this[_0xcb2a('0x4d')]({'plain':!![]});var _0x4e1916=_0x3c3fd6[_0xcb2a('0x4')]===_0xcb2a('0x12')?_0x487eec(_0x3c3fd6):_0x5db7e9(_0x3c3fd6);return _0x453c04(_0x3c3fd6,_0x1b9bcd,_[_0xcb2a('0x49')](_0x4e1916)['priority']+0x1)['then'](function(_0xcf4f99){var _0x55ed4a=_[_0xcb2a('0x4a')](_0x4e1916,_0xcf4f99);_0x55ed4a['push']({'type':_0x3c3fd6[_0xcb2a('0x4')],'app':_0xcb2a('0x4e'),'exten':_0x3c3fd6[_0xcb2a('0x8')],'context':_0x3c3fd6['context'],'priority':_['last'](_0x55ed4a)['priority']+0x1,'VoiceExtensionId':_0x3c3fd6['id']});return _0x55ed4a;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 6ce8694..cc6cf26 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 _0xc15b=['map','attributes','model','debug','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','redis','defaults','./voiceExtension.socket','request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','options','raw','where','limit','include'];(function(_0x2d3b05,_0x12fd04){var _0x46cc57=function(_0x1a77a4){while(--_0x1a77a4){_0x2d3b05['push'](_0x2d3b05['shift']());}};_0x46cc57(++_0x12fd04);}(_0xc15b,0xe4));var _0xbc15=function(_0x872b02,_0x4f4458){_0x872b02=_0x872b02-0x0;var _0x1a6b24=_0xc15b[_0x872b02];return _0x1a6b24;};'use strict';var _=require(_0xbc15('0x0'));var util=require('util');var moment=require(_0xbc15('0x1'));var BPromise=require(_0xbc15('0x2'));var rs=require(_0xbc15('0x3'));var fs=require('fs');var Redis=require(_0xbc15('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbc15('0x5'))(_0xbc15('0x6'));var config=require(_0xbc15('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xbc15('0x8')]=_[_0xbc15('0x9')](config[_0xbc15('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbc15('0xa'))['register'](socket);function respondWithRpcPromise(_0x2189d4,_0x42f0b9,_0x359eb9){return new BPromise(function(_0x551a7b,_0x413eda){return client[_0xbc15('0xb')](_0x2189d4,_0x359eb9)['then'](function(_0xc677d5){logger[_0xbc15('0xc')](_0xbc15('0xd'),_0x42f0b9,'request\x20sent');logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x42f0b9,_0xbc15('0xe'),JSON[_0xbc15('0xf')](_0xc677d5));if(_0xc677d5[_0xbc15('0x10')]){if(_0xc677d5[_0xbc15('0x10')][_0xbc15('0x11')]===0x1f4){logger[_0xbc15('0x10')](_0xbc15('0xd'),_0x42f0b9,_0xc677d5[_0xbc15('0x10')][_0xbc15('0x12')]);return _0x413eda(_0xc677d5[_0xbc15('0x10')][_0xbc15('0x12')]);}logger[_0xbc15('0x10')](_0xbc15('0xd'),_0x42f0b9,_0xc677d5[_0xbc15('0x10')]['message']);return _0x551a7b(_0xc677d5[_0xbc15('0x10')]['message']);}else{logger[_0xbc15('0xc')](_0xbc15('0xd'),_0x42f0b9,_0xbc15('0xe'));_0x551a7b(_0xc677d5[_0xbc15('0x13')][_0xbc15('0x12')]);}})[_0xbc15('0x14')](function(_0x7e7826){logger[_0xbc15('0x10')](_0xbc15('0xd'),_0x42f0b9,_0x7e7826);_0x413eda(_0x7e7826);});});}exports[_0xbc15('0x15')]=function(_0x2b5dbb){var _0x1b80e1=this;return new Promise(function(_0x58a204,_0x247ce3){return db[_0xbc15('0x16')]['findAll']({'raw':_0x2b5dbb[_0xbc15('0x17')]?_0x2b5dbb[_0xbc15('0x17')][_0xbc15('0x18')]===undefined?!![]:![]:!![],'where':_0x2b5dbb[_0xbc15('0x17')]?_0x2b5dbb[_0xbc15('0x17')][_0xbc15('0x19')]||null:null,'attributes':_0x2b5dbb[_0xbc15('0x17')]?_0x2b5dbb[_0xbc15('0x17')]['attributes']||null:null,'limit':_0x2b5dbb[_0xbc15('0x17')]?_0x2b5dbb[_0xbc15('0x17')][_0xbc15('0x1a')]||null:null,'include':_0x2b5dbb['options']?_0x2b5dbb[_0xbc15('0x17')][_0xbc15('0x1b')]?_[_0xbc15('0x1c')](_0x2b5dbb[_0xbc15('0x17')][_0xbc15('0x1b')],function(_0x2a76de){return{'model':db[_0x2a76de['model']],'as':_0x2a76de['as'],'attributes':_0x2a76de[_0xbc15('0x1d')],'include':_0x2a76de[_0xbc15('0x1b')]?_[_0xbc15('0x1c')](_0x2a76de[_0xbc15('0x1b')],function(_0x2f57d6){return{'model':db[_0x2f57d6[_0xbc15('0x1e')]],'as':_0x2f57d6['as'],'attributes':_0x2f57d6[_0xbc15('0x1d')],'include':_0x2f57d6[_0xbc15('0x1b')]?_[_0xbc15('0x1c')](_0x2f57d6[_0xbc15('0x1b')],function(_0x2497de){return{'model':db[_0x2497de[_0xbc15('0x1e')]],'as':_0x2497de['as'],'attributes':_0x2497de['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b5b0f){logger[_0xbc15('0xc')](_0xbc15('0x15'),_0x2b5dbb);logger[_0xbc15('0x1f')](_0xbc15('0x15'),_0x2b5dbb,JSON[_0xbc15('0xf')](_0x4b5b0f));_0x58a204(_0x4b5b0f);})[_0xbc15('0x14')](function(_0xa9cf30){logger['error'](_0xbc15('0x15'),_0xa9cf30[_0xbc15('0x12')],_0x2b5dbb);_0x247ce3(_0x1b80e1['error'](0x1f4,_0xa9cf30[_0xbc15('0x12')]));});});}; \ No newline at end of file +var _0x1354=['stringify','error','message','catch','GetVoiceExtension','findAll','options','raw','attributes','limit','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','register','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x183458,_0x6d0b17){var _0x482076=function(_0x21cf10){while(--_0x21cf10){_0x183458['push'](_0x183458['shift']());}};_0x482076(++_0x6d0b17);}(_0x1354,0x95));var _0x4135=function(_0x1757c8,_0x4aa781){_0x1757c8=_0x1757c8-0x0;var _0x3059f1=_0x1354[_0x1757c8];return _0x3059f1;};'use strict';var _=require(_0x4135('0x0'));var util=require(_0x4135('0x1'));var moment=require(_0x4135('0x2'));var BPromise=require(_0x4135('0x3'));var rs=require(_0x4135('0x4'));var fs=require('fs');var Redis=require(_0x4135('0x5'));var db=require(_0x4135('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4135('0x7'))(_0x4135('0x8'));var config=require(_0x4135('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4135('0xa')][_0x4135('0xb')]({'port':0x232a});config['redis']=_[_0x4135('0xc')](config[_0x4135('0xd')],{'host':_0x4135('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4135('0xd')]));require('./voiceExtension.socket')[_0x4135('0xf')](socket);function respondWithRpcPromise(_0x1d0cc6,_0x4447c8,_0x39822e){return new BPromise(function(_0x5dd78a,_0x35d576){return client['request'](_0x1d0cc6,_0x39822e)['then'](function(_0x73c55f){logger[_0x4135('0x10')](_0x4135('0x11'),_0x4447c8,'request\x20sent');logger[_0x4135('0x12')](_0x4135('0x13'),_0x4447c8,_0x4135('0x14'),JSON[_0x4135('0x15')](_0x73c55f));if(_0x73c55f[_0x4135('0x16')]){if(_0x73c55f[_0x4135('0x16')]['code']===0x1f4){logger['error'](_0x4135('0x11'),_0x4447c8,_0x73c55f[_0x4135('0x16')][_0x4135('0x17')]);return _0x35d576(_0x73c55f[_0x4135('0x16')]['message']);}logger[_0x4135('0x16')](_0x4135('0x11'),_0x4447c8,_0x73c55f['error']['message']);return _0x5dd78a(_0x73c55f[_0x4135('0x16')]['message']);}else{logger[_0x4135('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x4447c8,'request\x20sent');_0x5dd78a(_0x73c55f['result']['message']);}})[_0x4135('0x18')](function(_0x55adba){logger[_0x4135('0x16')](_0x4135('0x11'),_0x4447c8,_0x55adba);_0x35d576(_0x55adba);});});}exports[_0x4135('0x19')]=function(_0x5eddcc){var _0x3f7e85=this;return new Promise(function(_0x3dae32,_0x398294){return db['VoiceExtension'][_0x4135('0x1a')]({'raw':_0x5eddcc['options']?_0x5eddcc[_0x4135('0x1b')][_0x4135('0x1c')]===undefined?!![]:![]:!![],'where':_0x5eddcc[_0x4135('0x1b')]?_0x5eddcc[_0x4135('0x1b')]['where']||null:null,'attributes':_0x5eddcc[_0x4135('0x1b')]?_0x5eddcc[_0x4135('0x1b')][_0x4135('0x1d')]||null:null,'limit':_0x5eddcc[_0x4135('0x1b')]?_0x5eddcc[_0x4135('0x1b')][_0x4135('0x1e')]||null:null,'include':_0x5eddcc[_0x4135('0x1b')]?_0x5eddcc[_0x4135('0x1b')][_0x4135('0x1f')]?_[_0x4135('0x20')](_0x5eddcc[_0x4135('0x1b')][_0x4135('0x1f')],function(_0x212228){return{'model':db[_0x212228[_0x4135('0x21')]],'as':_0x212228['as'],'attributes':_0x212228['attributes'],'include':_0x212228[_0x4135('0x1f')]?_[_0x4135('0x20')](_0x212228[_0x4135('0x1f')],function(_0x36b9e3){return{'model':db[_0x36b9e3[_0x4135('0x21')]],'as':_0x36b9e3['as'],'attributes':_0x36b9e3[_0x4135('0x1d')],'include':_0x36b9e3['include']?_[_0x4135('0x20')](_0x36b9e3[_0x4135('0x1f')],function(_0x31b508){return{'model':db[_0x31b508[_0x4135('0x21')]],'as':_0x31b508['as'],'attributes':_0x31b508[_0x4135('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x411ee0){logger[_0x4135('0x10')]('GetVoiceExtension',_0x5eddcc);logger[_0x4135('0x12')]('GetVoiceExtension',_0x5eddcc,JSON[_0x4135('0x15')](_0x411ee0));_0x3dae32(_0x411ee0);})[_0x4135('0x18')](function(_0x25a672){logger[_0x4135('0x16')]('GetVoiceExtension',_0x25a672[_0x4135('0x17')],_0x5eddcc);_0x398294(_0x3f7e85[_0x4135('0x16')](0x1f4,_0x25a672[_0x4135('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index d0b5430..900a902 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 _0x326f=['update','emit','removeListener','register','length','./voiceExtension.events'];(function(_0x32f514,_0x108632){var _0x1aef60=function(_0x3831b8){while(--_0x3831b8){_0x32f514['push'](_0x32f514['shift']());}};_0x1aef60(++_0x108632);}(_0x326f,0xd1));var _0xf326=function(_0x11c541,_0x1f8e03){_0x11c541=_0x11c541-0x0;var _0x7bed29=_0x326f[_0x11c541];return _0x7bed29;};'use strict';var VoiceExtensionEvents=require(_0xf326('0x0'));var events=['save','remove',_0xf326('0x1')];function createListener(_0x330ddb,_0x22aabf){return function(_0x408257){_0x22aabf[_0xf326('0x2')](_0x330ddb,_0x408257);};}function removeListener(_0x120a26,_0x9445c6){return function(){VoiceExtensionEvents[_0xf326('0x3')](_0x120a26,_0x9445c6);};}exports[_0xf326('0x4')]=function(_0x3ace29){for(var _0x4c2249=0x0,_0x3c254d=events[_0xf326('0x5')];_0x4c2249<_0x3c254d;_0x4c2249++){var _0x165f95=events[_0x4c2249];var _0x1e7b8a=createListener('voiceExtension:'+_0x165f95,_0x3ace29);VoiceExtensionEvents['on'](_0x165f95,_0x1e7b8a);}}; \ No newline at end of file +var _0x7fbe=['length','voiceExtension:','remove','update','emit','removeListener','register'];(function(_0x4be27a,_0x531a65){var _0x975566=function(_0xb81179){while(--_0xb81179){_0x4be27a['push'](_0x4be27a['shift']());}};_0x975566(++_0x531a65);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x581249,_0x483f03){_0x581249=_0x581249-0x0;var _0x284bae=_0x7fbe[_0x581249];return _0x284bae;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=['save',_0xe7fb('0x0'),_0xe7fb('0x1')];function createListener(_0x294c21,_0x1703d5){return function(_0x517d3a){_0x1703d5[_0xe7fb('0x2')](_0x294c21,_0x517d3a);};}function removeListener(_0x11d2c4,_0x4524ff){return function(){VoiceExtensionEvents[_0xe7fb('0x3')](_0x11d2c4,_0x4524ff);};}exports[_0xe7fb('0x4')]=function(_0x290172){for(var _0x12d1b0=0x0,_0x24cd67=events[_0xe7fb('0x5')];_0x12d1b0<_0x24cd67;_0x12d1b0++){var _0x5ad75b=events[_0x12d1b0];var _0x213ebc=createListener(_0xe7fb('0x6')+_0x5ad75b,_0x290172);VoiceExtensionEvents['on'](_0x5ad75b,_0x213ebc);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 3d8c465..c2de13e 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 _0x4c60=['exports','multer','util','path','connect-timeout','Router','./voiceMail.controller','get','isAuthenticated','index','/:id','/:id/messages','getMessages','put','update','destroy'];(function(_0x4e24f4,_0xb0d023){var _0x14c73a=function(_0x3f6eb8){while(--_0x3f6eb8){_0x4e24f4['push'](_0x4e24f4['shift']());}};_0x14c73a(++_0xb0d023);}(_0x4c60,0xc1));var _0x04c6=function(_0xfeda91,_0x48fabe){_0xfeda91=_0xfeda91-0x0;var _0x220ab1=_0x4c60[_0xfeda91];return _0x220ab1;};'use strict';var multer=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var path=require(_0x04c6('0x2'));var timeout=require(_0x04c6('0x3'));var express=require('express');var router=express[_0x04c6('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x04c6('0x5'));router[_0x04c6('0x6')]('/',auth[_0x04c6('0x7')](),controller[_0x04c6('0x8')]);router[_0x04c6('0x6')](_0x04c6('0x9'),auth[_0x04c6('0x7')](),controller['show']);router[_0x04c6('0x6')](_0x04c6('0xa'),auth[_0x04c6('0x7')](),controller[_0x04c6('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x04c6('0xc')]('/:id',auth[_0x04c6('0x7')](),controller[_0x04c6('0xd')]);router['delete'](_0x04c6('0x9'),auth[_0x04c6('0x7')](),controller[_0x04c6('0xe')]);module[_0x04c6('0xf')]=router; \ No newline at end of file +var _0xfdbd=['get','getMessages','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','isAuthenticated','index','show'];(function(_0x45a183,_0x31546e){var _0x3ead1e=function(_0x58bb12){while(--_0x58bb12){_0x45a183['push'](_0x45a183['shift']());}};_0x3ead1e(++_0x31546e);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x33975c,_0x50d085){_0x33975c=_0x33975c-0x0;var _0x1c15ab=_0xfdbd[_0x33975c];return _0x1c15ab;};'use strict';var multer=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var path=require(_0xdfdb('0x2'));var timeout=require(_0xdfdb('0x3'));var express=require(_0xdfdb('0x4'));var router=express[_0xdfdb('0x5')]();var fs_extra=require(_0xdfdb('0x6'));var auth=require(_0xdfdb('0x7'));var interaction=require(_0xdfdb('0x8'));var config=require('../../config/environment');var controller=require(_0xdfdb('0x9'));router['get']('/',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xdfdb('0xc')]);router[_0xdfdb('0xd')]('/:id/messages',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0xe')]);router[_0xdfdb('0xf')]('/',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x10')]);router[_0xdfdb('0x11')](_0xdfdb('0x12'),auth['isAuthenticated'](),controller[_0xdfdb('0x13')]);router[_0xdfdb('0x14')]('/:id',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x15')]);module[_0xdfdb('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 e007bb4..02e3e65 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 _0x1707=['trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string'];(function(_0x46d87a,_0x5183db){var _0x115296=function(_0x880a1c){while(--_0x880a1c){_0x46d87a['push'](_0x46d87a['shift']());}};_0x115296(++_0x5183db);}(_0x1707,0x14e));var _0x7170=function(_0xe112,_0x166655){_0xe112=_0xe112-0x0;var _0x35efe9=_0x1707[_0xe112];return _0x35efe9;};'use strict';var Sequelize=require(_0x7170('0x0'));module[_0x7170('0x1')]={'customer_id':{'type':Sequelize[_0x7170('0x2')]},'context':{'type':Sequelize[_0x7170('0x2')],'defaultValue':_0x7170('0x3'),'unique':_0x7170('0x4')},'mailbox':{'type':Sequelize[_0x7170('0x2')],'defaultValue':'','allowNull':![],'unique':_0x7170('0x4')},'password':{'type':Sequelize[_0x7170('0x2')]},'fullname':{'type':Sequelize[_0x7170('0x2')]},'email':{'type':Sequelize[_0x7170('0x2')],'validate':{'isEmail':!![]},'set':function(_0x39c3b1){this[_0x7170('0x5')](_0x7170('0x6'),typeof _0x39c3b1===_0x7170('0x7')&&_0x39c3b1[_0x7170('0x8')]()?_0x39c3b1[_0x7170('0x8')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x7170('0x2')],'defaultValue':_0x7170('0x9')},'attach':{'type':Sequelize[_0x7170('0xa')]('yes','no'),'defaultValue':_0x7170('0xb'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x7170('0xb'),'no'),'defaultValue':_0x7170('0xb'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x7170('0x2')]},'review':{'type':Sequelize['ENUM'](_0x7170('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x7170('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x7170('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x7170('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x7170('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x7170('0xb'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x7170('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x7170('0xa')](_0x7170('0xb'),'no'),'defaultValue':_0x7170('0xb'),'allowNull':![]},'forcename':{'type':Sequelize[_0x7170('0xa')](_0x7170('0xb'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x7170('0xa')](_0x7170('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x7170('0xa')](_0x7170('0xb'),'no'),'defaultValue':_0x7170('0xb'),'allowNull':![]},'stamp':{'type':_0x7170('0xd')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x7170('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x7170('0xe')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x7170('0xf')],'get':function(){return this[_0x7170('0x10')](_0x7170('0x11'))+_0x7170('0x12')+this[_0x7170('0x10')]('mailbox');}}}; \ No newline at end of file +var _0x8c8e=['ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim'];(function(_0x587808,_0x4806d3){var _0x51eccd=function(_0x520ffd){while(--_0x520ffd){_0x587808['push'](_0x587808['shift']());}};_0x51eccd(++_0x4806d3);}(_0x8c8e,0x70));var _0xe8c8=function(_0x1b92a6,_0x14444b){_0x1b92a6=_0x1b92a6-0x0;var _0x24be5b=_0x8c8e[_0x1b92a6];return _0x24be5b;};'use strict';var Sequelize=require('sequelize');module[_0xe8c8('0x0')]={'customer_id':{'type':Sequelize[_0xe8c8('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0xe8c8('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xe8c8('0x1')],'defaultValue':'','allowNull':![],'unique':_0xe8c8('0x3')},'password':{'type':Sequelize[_0xe8c8('0x1')]},'fullname':{'type':Sequelize[_0xe8c8('0x1')]},'email':{'type':Sequelize[_0xe8c8('0x1')],'validate':{'isEmail':!![]},'set':function(_0x1ad1ab){this[_0xe8c8('0x4')]('email',typeof _0x1ad1ab===_0xe8c8('0x5')&&_0x1ad1ab[_0xe8c8('0x6')]()?_0x1ad1ab[_0xe8c8('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize[_0xe8c8('0x7')](_0xe8c8('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xe8c8('0x7')](_0xe8c8('0x8'),'no'),'defaultValue':_0xe8c8('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0xe8c8('0x1')]},'callback':{'type':Sequelize[_0xe8c8('0x1')]},'review':{'type':Sequelize[_0xe8c8('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xe8c8('0x7')](_0xe8c8('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xe8c8('0x7')](_0xe8c8('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xe8c8('0x7')](_0xe8c8('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xe8c8('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xe8c8('0x7')](_0xe8c8('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0xe8c8('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xe8c8('0x7')](_0xe8c8('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0xe8c8('0x7')](_0xe8c8('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xe8c8('0x7')](_0xe8c8('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xe8c8('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xe8c8('0xa')},'emailsubject':{'type':Sequelize[_0xe8c8('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0xe8c8('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xe8c8('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xe8c8('0xc')],'get':function(){return this[_0xe8c8('0xd')](_0xe8c8('0xe'))+_0xe8c8('0xf')+this[_0xe8c8('0xd')](_0xe8c8('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index d57e8d7..7baf389 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(_0x299b15,_0x4ae4f9){var _0x30da73=function(_0x5b7df1){while(--_0x5b7df1){_0x299b15['push'](_0x299b15['shift']());}};_0x30da73(++_0x4ae4f9);}(_0x69d3,0xda));var _0x369d=function(_0x46c37c,_0x46f115){_0x46c37c=_0x46c37c-0x0;var _0x169c0a=_0x69d3[_0x46c37c];return _0x169c0a;};'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 _0xa478=['UserProfileResource','destroy','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','where','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','catch','error','getMessages','findOne','VoiceMailMessage','pick','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','Voicemails'];(function(_0x4481b6,_0x434b8e){var _0xdeb660=function(_0x22e6ec){while(--_0x22e6ec){_0x4481b6['push'](_0x4481b6['shift']());}};_0xdeb660(++_0x434b8e);}(_0xa478,0x136));var _0x8a47=function(_0x6b6340,_0x6302c4){_0x6b6340=_0x6b6340-0x0;var _0x3609bf=_0xa478[_0x6b6340];return _0x3609bf;};'use strict';var emlformat=require(_0x8a47('0x0'));var rimraf=require(_0x8a47('0x1'));var zipdir=require(_0x8a47('0x2'));var jsonpatch=require(_0x8a47('0x3'));var rp=require(_0x8a47('0x4'));var moment=require(_0x8a47('0x5'));var BPromise=require(_0x8a47('0x6'));var Mustache=require(_0x8a47('0x7'));var util=require(_0x8a47('0x8'));var path=require(_0x8a47('0x9'));var sox=require(_0x8a47('0xa'));var csv=require(_0x8a47('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a47('0xc'));var _=require(_0x8a47('0xd'));var squel=require(_0x8a47('0xe'));var crypto=require(_0x8a47('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x8a47('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8a47('0x11'));var Papa=require(_0x8a47('0x12'));var Redis=require(_0x8a47('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x8a47('0x14'));var as=require(_0x8a47('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a47('0x16'))('api');var utils=require(_0x8a47('0x17'));var config=require(_0x8a47('0x18'));var licenseUtil=require(_0x8a47('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e3166,_0x59efc7){_0x59efc7=_0x59efc7||0xcc;return function(_0x36941a){if(_0x36941a){return _0x5e3166[_0x8a47('0x1a')](_0x59efc7);}return _0x5e3166['status'](_0x59efc7)[_0x8a47('0x1b')]();};}function respondWithResult(_0x28bbc5,_0x1a9a6f){_0x1a9a6f=_0x1a9a6f||0xc8;return function(_0x55985c){if(_0x55985c){return _0x28bbc5[_0x8a47('0x1c')](_0x1a9a6f)[_0x8a47('0x1d')](_0x55985c);}};}function respondWithFilteredResult(_0x2f682e,_0x1c8488){return function(_0x41bdaf){if(_0x41bdaf){var _0x18f2be=typeof _0x1c8488[_0x8a47('0x1e')]===_0x8a47('0x1f')&&typeof _0x1c8488[_0x8a47('0x20')]==='undefined';var _0x20fbf7=_0x41bdaf[_0x8a47('0x21')];var _0x3f9093=_0x18f2be?0x0:_0x1c8488['offset'];var _0x341089=_0x18f2be?_0x41bdaf['count']:_0x1c8488['offset']+_0x1c8488[_0x8a47('0x20')];var _0x2174b1;if(_0x341089>=_0x20fbf7){_0x341089=_0x20fbf7;_0x2174b1=0xc8;}else{_0x2174b1=0xce;}_0x2f682e[_0x8a47('0x1c')](_0x2174b1);return _0x2f682e[_0x8a47('0x22')](_0x8a47('0x23'),_0x3f9093+'-'+_0x341089+'/'+_0x20fbf7)[_0x8a47('0x1d')](_0x41bdaf);}return null;};}function patchUpdates(_0x44e119){return function(_0x1bbed6){try{jsonpatch[_0x8a47('0x24')](_0x1bbed6,_0x44e119,!![]);}catch(_0xc2065a){return BPromise['reject'](_0xc2065a);}return _0x1bbed6[_0x8a47('0x25')]();};}function saveUpdates(_0x5923ec,_0x289f28){return function(_0x3d7993){if(_0x3d7993){return _0x3d7993[_0x8a47('0x26')](_0x5923ec)[_0x8a47('0x27')](function(_0x5d4b6c){return _0x5d4b6c;});}return null;};}function removeEntity(_0x116b5e,_0x5ae186){return function(_0x50f6ba){if(_0x50f6ba){return _0x50f6ba['destroy']()['then'](function(){var _0xf46d2c=_0x50f6ba[_0x8a47('0x28')]({'plain':!![]});var _0x5bed3e=_0x8a47('0x29');return db[_0x8a47('0x2a')][_0x8a47('0x2b')]({'where':{'type':_0x5bed3e,'resourceId':_0xf46d2c['id']}})[_0x8a47('0x27')](function(){return _0x50f6ba;});})[_0x8a47('0x27')](function(){_0x116b5e[_0x8a47('0x1c')](0xcc)[_0x8a47('0x1b')]();});}};}function handleEntityNotFound(_0x576fb3,_0x22a52f){return function(_0x4a10c3){if(!_0x4a10c3){_0x576fb3[_0x8a47('0x1a')](0x194);}return _0x4a10c3;};}function handleError(_0x3a8685,_0x54d4b2){_0x54d4b2=_0x54d4b2||0x1f4;return function(_0x1e89b1){logger['error'](_0x1e89b1['stack']);if(_0x1e89b1[_0x8a47('0x2c')]){delete _0x1e89b1[_0x8a47('0x2c')];}_0x3a8685[_0x8a47('0x1c')](_0x54d4b2)[_0x8a47('0x2d')](_0x1e89b1);};}exports[_0x8a47('0x2e')]=function(_0x18bfd3,_0x58aa06){var _0x353576={},_0x4d78b5={},_0x549913={'count':0x0,'rows':[]};var _0x448459=_[_0x8a47('0x2f')](db[_0x8a47('0x30')][_0x8a47('0x31')],function(_0x16e024){return{'name':_0x16e024[_0x8a47('0x32')],'type':_0x16e024[_0x8a47('0x33')][_0x8a47('0x34')]};});_0x4d78b5[_0x8a47('0x35')]=_[_0x8a47('0x2f')](_0x448459,'name');_0x4d78b5[_0x8a47('0x36')]=_[_0x8a47('0x37')](_0x18bfd3[_0x8a47('0x36')]);_0x4d78b5['filters']=_[_0x8a47('0x38')](_0x4d78b5[_0x8a47('0x35')],_0x4d78b5['query']);_0x353576[_0x8a47('0x39')]=_[_0x8a47('0x38')](_0x4d78b5[_0x8a47('0x35')],qs[_0x8a47('0x3a')](_0x18bfd3['query']['fields']));_0x353576[_0x8a47('0x39')]=_0x353576[_0x8a47('0x39')][_0x8a47('0x3b')]?_0x353576[_0x8a47('0x39')]:_0x4d78b5[_0x8a47('0x35')];if(!_0x18bfd3[_0x8a47('0x36')][_0x8a47('0x3c')]('nolimit')){_0x353576['limit']=qs[_0x8a47('0x20')](_0x18bfd3[_0x8a47('0x36')][_0x8a47('0x20')]);_0x353576[_0x8a47('0x1e')]=qs[_0x8a47('0x1e')](_0x18bfd3[_0x8a47('0x36')][_0x8a47('0x1e')]);}_0x353576[_0x8a47('0x3d')]=qs[_0x8a47('0x3e')](_0x18bfd3[_0x8a47('0x36')][_0x8a47('0x3e')]);_0x353576['where']=qs[_0x8a47('0x3f')](_['pick'](_0x18bfd3['query'],_0x4d78b5['filters']),_0x448459);if(_0x18bfd3['query']['filter']){_0x353576[_0x8a47('0x40')]=_[_0x8a47('0x41')](_0x353576[_0x8a47('0x40')],{'$or':_[_0x8a47('0x2f')](_0x448459,function(_0x10c483){if(_0x10c483[_0x8a47('0x33')]!==_0x8a47('0x42')){var _0x29beee={};_0x29beee[_0x10c483['name']]={'$like':'%'+_0x18bfd3['query'][_0x8a47('0x43')]+'%'};return _0x29beee;}})});}_0x353576=_[_0x8a47('0x41')]({},_0x353576,_0x18bfd3[_0x8a47('0x44')]);var _0x19298d={'where':_0x353576['where']};return db[_0x8a47('0x30')][_0x8a47('0x21')](_0x19298d)[_0x8a47('0x27')](function(_0x369dd5){_0x549913[_0x8a47('0x21')]=_0x369dd5;if(_0x18bfd3['query'][_0x8a47('0x45')]){_0x353576[_0x8a47('0x46')]=[{'all':!![]}];}return db[_0x8a47('0x30')]['findAll'](_0x353576);})[_0x8a47('0x27')](function(_0x2c70ea){_0x549913[_0x8a47('0x47')]=_0x2c70ea;return _0x549913;})[_0x8a47('0x27')](respondWithFilteredResult(_0x58aa06,_0x353576))['catch'](handleError(_0x58aa06,null));};exports[_0x8a47('0x48')]=function(_0x2f523f,_0x2fa701){var _0x2e2520={'raw':!![],'where':{'id':_0x2f523f[_0x8a47('0x49')]['id']}},_0x22b0d6={};_0x22b0d6['model']=_['keys'](db[_0x8a47('0x30')][_0x8a47('0x31')]);_0x22b0d6[_0x8a47('0x36')]=_['keys'](_0x2f523f[_0x8a47('0x36')]);_0x22b0d6[_0x8a47('0x3f')]=_['intersection'](_0x22b0d6['model'],_0x22b0d6[_0x8a47('0x36')]);_0x2e2520['attributes']=_[_0x8a47('0x38')](_0x22b0d6[_0x8a47('0x35')],qs[_0x8a47('0x3a')](_0x2f523f[_0x8a47('0x36')][_0x8a47('0x3a')]));_0x2e2520[_0x8a47('0x39')]=_0x2e2520['attributes']['length']?_0x2e2520[_0x8a47('0x39')]:_0x22b0d6[_0x8a47('0x35')];if(_0x2f523f[_0x8a47('0x36')][_0x8a47('0x45')]){_0x2e2520[_0x8a47('0x46')]=[{'all':!![]}];}_0x2e2520=_['merge']({},_0x2e2520,_0x2f523f['options']);return db[_0x8a47('0x30')]['find'](_0x2e2520)[_0x8a47('0x27')](handleEntityNotFound(_0x2fa701,null))[_0x8a47('0x27')](respondWithResult(_0x2fa701,null))['catch'](handleError(_0x2fa701,null));};exports[_0x8a47('0x4a')]=function(_0x237ed1,_0x14e22c){return db[_0x8a47('0x30')][_0x8a47('0x4a')](_0x237ed1[_0x8a47('0x4b')],{})[_0x8a47('0x27')](function(_0x2d2455){var _0x512938=_0x237ed1[_0x8a47('0x4c')][_0x8a47('0x28')]({'plain':!![]});if(!_0x512938)throw new Error(_0x8a47('0x4d'));if(_0x512938[_0x8a47('0x4e')]==='user'){var _0x11db4e=_0x2d2455[_0x8a47('0x28')]({'plain':!![]});var _0x24e123=_0x8a47('0x29');return db[_0x8a47('0x4f')][_0x8a47('0x50')]({'where':{'name':_0x24e123,'userProfileId':_0x512938['userProfileId']},'raw':!![]})['then'](function(_0x456cfb){if(_0x456cfb&&_0x456cfb['autoAssociation']===0x0){return db[_0x8a47('0x2a')][_0x8a47('0x4a')]({'name':_0x11db4e['name'],'resourceId':_0x11db4e['id'],'type':_0x456cfb[_0x8a47('0x2c')],'sectionId':_0x456cfb['id']},{})['then'](function(){return _0x2d2455;});}else{return _0x2d2455;}})[_0x8a47('0x51')](function(_0x5c5577){logger[_0x8a47('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c5577);throw _0x5c5577;});}return _0x2d2455;})[_0x8a47('0x27')](respondWithResult(_0x14e22c,0xc9))[_0x8a47('0x51')](handleError(_0x14e22c,null));};exports[_0x8a47('0x26')]=function(_0x144ce6,_0x4590ae){if(_0x144ce6[_0x8a47('0x4b')]['id']){delete _0x144ce6[_0x8a47('0x4b')]['id'];}return db[_0x8a47('0x30')][_0x8a47('0x50')]({'where':{'id':_0x144ce6[_0x8a47('0x49')]['id']}})[_0x8a47('0x27')](handleEntityNotFound(_0x4590ae,null))['then'](saveUpdates(_0x144ce6[_0x8a47('0x4b')],null))[_0x8a47('0x27')](respondWithResult(_0x4590ae,null))['catch'](handleError(_0x4590ae,null));};exports[_0x8a47('0x2b')]=function(_0x408ce2,_0x436c27){return db[_0x8a47('0x30')][_0x8a47('0x50')]({'where':{'id':_0x408ce2[_0x8a47('0x49')]['id']}})[_0x8a47('0x27')](handleEntityNotFound(_0x436c27,null))[_0x8a47('0x27')](removeEntity(_0x436c27,null))[_0x8a47('0x51')](handleError(_0x436c27,null));};exports[_0x8a47('0x53')]=function(_0x2100cb,_0x385087,_0x5f448e){return db[_0x8a47('0x30')][_0x8a47('0x54')]({'where':{'id':_0x2100cb[_0x8a47('0x49')]['id']}})[_0x8a47('0x27')](handleEntityNotFound(_0x385087,null))[_0x8a47('0x27')](function(_0x6c2f83){var _0x134fc5;var _0x3242b7={},_0x41cc36={};_0x41cc36[_0x8a47('0x35')]=_[_0x8a47('0x37')](db[_0x8a47('0x55')][_0x8a47('0x31')]);_0x41cc36[_0x8a47('0x36')]=_[_0x8a47('0x37')](_0x2100cb[_0x8a47('0x36')]);_0x41cc36['filters']=_[_0x8a47('0x38')](_0x41cc36['model'],_0x41cc36[_0x8a47('0x36')]);_0x3242b7[_0x8a47('0x39')]=_[_0x8a47('0x38')](_0x41cc36[_0x8a47('0x35')],qs[_0x8a47('0x3a')](_0x2100cb[_0x8a47('0x36')]['fields']));_0x3242b7[_0x8a47('0x39')]=_0x3242b7[_0x8a47('0x39')][_0x8a47('0x3b')]?_0x3242b7['attributes']:_0x41cc36['model'];if(!_0x2100cb[_0x8a47('0x36')][_0x8a47('0x3c')]('nolimit')){_0x3242b7[_0x8a47('0x20')]=qs[_0x8a47('0x20')](_0x2100cb[_0x8a47('0x36')][_0x8a47('0x20')]);_0x3242b7[_0x8a47('0x1e')]=qs[_0x8a47('0x1e')](_0x2100cb[_0x8a47('0x36')][_0x8a47('0x1e')]);}_0x3242b7[_0x8a47('0x3d')]=qs[_0x8a47('0x3e')](_0x2100cb[_0x8a47('0x36')][_0x8a47('0x3e')]);_0x3242b7[_0x8a47('0x40')]=qs['filters'](_[_0x8a47('0x56')](_0x2100cb[_0x8a47('0x36')],_0x41cc36[_0x8a47('0x3f')]));if(_0x2100cb[_0x8a47('0x36')][_0x8a47('0x43')]){_0x3242b7[_0x8a47('0x40')]=_['merge'](_0x3242b7[_0x8a47('0x40')],{'$or':_['map'](_0x3242b7['attributes'],function(_0x400c4e){var _0x439172={};_0x439172[_0x400c4e]={'$like':'%'+_0x2100cb[_0x8a47('0x36')][_0x8a47('0x43')]+'%'};return _0x439172;})});}_0x3242b7[_0x8a47('0x40')]=_[_0x8a47('0x41')](_0x3242b7['where'],{'mailboxuser':_0x6c2f83['mailbox']});_0x3242b7=_[_0x8a47('0x41')]({},_0x3242b7,_0x2100cb['options']);return db[_0x8a47('0x55')][_0x8a47('0x57')](_0x3242b7)[_0x8a47('0x27')](respondWithFilteredResult(_0x385087,_0x3242b7));})[_0x8a47('0x51')](handleError(_0x385087,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index f80827b..8c5c7e5 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 _0x2e09=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash'];(function(_0x2ac4af,_0x288c53){var _0x3a36df=function(_0x271b11){while(--_0x271b11){_0x2ac4af['push'](_0x2ac4af['shift']());}};_0x3a36df(++_0x288c53);}(_0x2e09,0xed));var _0x92e0=function(_0x5b52e5,_0x578460){_0x5b52e5=_0x5b52e5-0x0;var _0x3b4f6d=_0x2e09[_0x5b52e5];return _0x3b4f6d;};'use strict';var _=require(_0x92e0('0x0'));var util=require('util');var logger=require(_0x92e0('0x1'))(_0x92e0('0x2'));var moment=require('moment');var BPromise=require(_0x92e0('0x3'));var rp=require(_0x92e0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x92e0('0x5'));var config=require(_0x92e0('0x6'));var attributes=require(_0x92e0('0x7'));module[_0x92e0('0x8')]=function(_0x465c06,_0x5d2d83){return _0x465c06['define'](_0x92e0('0x9'),attributes,{'tableName':_0x92e0('0xa'),'paranoid':![],'indexes':[{'name':_0x92e0('0xb'),'fields':[_0x92e0('0xc'),_0x92e0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6277=['../../config/environment','exports','define','VoiceMail','voice_voicemail','context','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3aee2d,_0x26d125){var _0x47700f=function(_0x46cb26){while(--_0x46cb26){_0x3aee2d['push'](_0x3aee2d['shift']());}};_0x47700f(++_0x26d125);}(_0x6277,0x92));var _0x7627=function(_0x5e524e,_0x3804ad){_0x5e524e=_0x5e524e-0x0;var _0x59b93e=_0x6277[_0x5e524e];return _0x59b93e;};'use strict';var _=require(_0x7627('0x0'));var util=require(_0x7627('0x1'));var logger=require('../../config/logger')(_0x7627('0x2'));var moment=require(_0x7627('0x3'));var BPromise=require(_0x7627('0x4'));var rp=require(_0x7627('0x5'));var fs=require('fs');var path=require(_0x7627('0x6'));var rimraf=require(_0x7627('0x7'));var config=require(_0x7627('0x8'));var attributes=require('./voiceMail.attributes');module[_0x7627('0x9')]=function(_0x227dd7,_0xa3e9d2){return _0x227dd7[_0x7627('0xa')](_0x7627('0xb'),attributes,{'tableName':_0x7627('0xc'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox',_0x7627('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index ba151d6..3380b44 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 _0x8281=['VoiceMail,\x20%s,\x20%s,\x20%s','error','VoiceMail,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug'];(function(_0x5224ba,_0x3fb4e1){var _0x459bd2=function(_0x61be43){while(--_0x61be43){_0x5224ba['push'](_0x5224ba['shift']());}};_0x459bd2(++_0x3fb4e1);}(_0x8281,0x1aa));var _0x1828=function(_0x3d751e,_0x442833){_0x3d751e=_0x3d751e-0x0;var _0x4faa3c=_0x8281[_0x3d751e];return _0x4faa3c;};'use strict';var _=require(_0x1828('0x0'));var util=require('util');var moment=require(_0x1828('0x1'));var BPromise=require(_0x1828('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1828('0x3'));var db=require(_0x1828('0x4'))['db'];var utils=require(_0x1828('0x5'));var logger=require(_0x1828('0x6'))('rpc');var config=require(_0x1828('0x7'));var jayson=require(_0x1828('0x8'));var client=jayson['client'][_0x1828('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd0afb3,_0xeece6c,_0x3ad00c){return new BPromise(function(_0x189355,_0x133296){return client[_0x1828('0xa')](_0xd0afb3,_0x3ad00c)[_0x1828('0xb')](function(_0x51f6d9){logger[_0x1828('0xc')]('VoiceMail,\x20%s,\x20%s',_0xeece6c,_0x1828('0xd'));logger[_0x1828('0xe')](_0x1828('0xf'),_0xeece6c,'request\x20sent',JSON['stringify'](_0x51f6d9));if(_0x51f6d9[_0x1828('0x10')]){if(_0x51f6d9[_0x1828('0x10')]['code']===0x1f4){logger[_0x1828('0x10')](_0x1828('0x11'),_0xeece6c,_0x51f6d9['error']['message']);return _0x133296(_0x51f6d9[_0x1828('0x10')][_0x1828('0x12')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0xeece6c,_0x51f6d9[_0x1828('0x10')][_0x1828('0x12')]);return _0x189355(_0x51f6d9[_0x1828('0x10')][_0x1828('0x12')]);}else{logger[_0x1828('0xc')](_0x1828('0x11'),_0xeece6c,_0x1828('0xd'));_0x189355(_0x51f6d9[_0x1828('0x13')][_0x1828('0x12')]);}})[_0x1828('0x14')](function(_0xc29239){logger['error'](_0x1828('0x11'),_0xeece6c,_0xc29239);_0x133296(_0xc29239);});});} \ No newline at end of file +var _0x6cfd=['VoiceMail,\x20%s,\x20%s','message','info','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','error','code'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0x6cfd,0xc1));var _0xd6cf=function(_0x32f12f,_0x80cb37){_0x32f12f=_0x32f12f-0x0;var _0x2e9164=_0x6cfd[_0x32f12f];return _0x2e9164;};'use strict';var _=require(_0xd6cf('0x0'));var util=require(_0xd6cf('0x1'));var moment=require(_0xd6cf('0x2'));var BPromise=require(_0xd6cf('0x3'));var rs=require(_0xd6cf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6cf('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd6cf('0x6'));var jayson=require(_0xd6cf('0x7'));var client=jayson[_0xd6cf('0x8')][_0xd6cf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f656e,_0x15c7a4,_0x29cdbb){return new BPromise(function(_0x3828f4,_0x3f9a6d){return client[_0xd6cf('0xa')](_0x3f656e,_0x29cdbb)[_0xd6cf('0xb')](function(_0x4d526c){logger['info']('VoiceMail,\x20%s,\x20%s',_0x15c7a4,_0xd6cf('0xc'));logger[_0xd6cf('0xd')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x15c7a4,_0xd6cf('0xc'),JSON['stringify'](_0x4d526c));if(_0x4d526c[_0xd6cf('0xe')]){if(_0x4d526c[_0xd6cf('0xe')][_0xd6cf('0xf')]===0x1f4){logger[_0xd6cf('0xe')](_0xd6cf('0x10'),_0x15c7a4,_0x4d526c[_0xd6cf('0xe')]['message']);return _0x3f9a6d(_0x4d526c[_0xd6cf('0xe')][_0xd6cf('0x11')]);}logger[_0xd6cf('0xe')]('VoiceMail,\x20%s,\x20%s',_0x15c7a4,_0x4d526c[_0xd6cf('0xe')][_0xd6cf('0x11')]);return _0x3828f4(_0x4d526c['error'][_0xd6cf('0x11')]);}else{logger[_0xd6cf('0x12')](_0xd6cf('0x10'),_0x15c7a4,_0xd6cf('0xc'));_0x3828f4(_0x4d526c['result'][_0xd6cf('0x11')]);}})['catch'](function(_0x153dd7){logger[_0xd6cf('0xe')](_0xd6cf('0x10'),_0x15c7a4,_0x153dd7);_0x3f9a6d(_0x153dd7);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 2d84e24..dc0df4b 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 _0xcbda=['destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','put','update','delete','/:id'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0xcbda,0xf4));var _0xacbd=function(_0x297345,_0x388810){_0x297345=_0x297345-0x0;var _0x405f39=_0xcbda[_0x297345];return _0x405f39;};'use strict';var multer=require(_0xacbd('0x0'));var util=require(_0xacbd('0x1'));var path=require('path');var timeout=require(_0xacbd('0x2'));var express=require(_0xacbd('0x3'));var router=express['Router']();var fs_extra=require(_0xacbd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xacbd('0x5'));var config=require(_0xacbd('0x6'));var controller=require(_0xacbd('0x7'));router[_0xacbd('0x8')]('/',auth[_0xacbd('0x9')](),controller[_0xacbd('0xa')]);router[_0xacbd('0x8')]('/:id',auth[_0xacbd('0x9')](),controller[_0xacbd('0xb')]);router[_0xacbd('0x8')](_0xacbd('0xc'),auth['isAuthenticated'](),controller[_0xacbd('0xd')]);router[_0xacbd('0xe')]('/',auth['isAuthenticated'](),controller[_0xacbd('0xf')]);router[_0xacbd('0x10')]('/:id',auth[_0xacbd('0x9')](),controller[_0xacbd('0x11')]);router[_0xacbd('0x12')](_0xacbd('0x13'),auth['isAuthenticated'](),controller[_0xacbd('0x14')]);module[_0xacbd('0x15')]=router; \ No newline at end of file +var _0x90f9=['isAuthenticated','/:id/download','download','post','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','index','/:id'];(function(_0x454614,_0x35eb8c){var _0x207cd9=function(_0x28fbb4){while(--_0x28fbb4){_0x454614['push'](_0x454614['shift']());}};_0x207cd9(++_0x35eb8c);}(_0x90f9,0x170));var _0x990f=function(_0x1ae73a,_0x4bb646){_0x1ae73a=_0x1ae73a-0x0;var _0x346f27=_0x90f9[_0x1ae73a];return _0x346f27;};'use strict';var multer=require(_0x990f('0x0'));var util=require(_0x990f('0x1'));var path=require('path');var timeout=require(_0x990f('0x2'));var express=require(_0x990f('0x3'));var router=express[_0x990f('0x4')]();var fs_extra=require(_0x990f('0x5'));var auth=require(_0x990f('0x6'));var interaction=require(_0x990f('0x7'));var config=require('../../config/environment');var controller=require(_0x990f('0x8'));router[_0x990f('0x9')]('/',auth['isAuthenticated'](),controller[_0x990f('0xa')]);router[_0x990f('0x9')](_0x990f('0xb'),auth[_0x990f('0xc')](),controller['show']);router[_0x990f('0x9')](_0x990f('0xd'),auth[_0x990f('0xc')](),controller[_0x990f('0xe')]);router[_0x990f('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x990f('0x10')](_0x990f('0xb'),auth[_0x990f('0xc')](),controller[_0x990f('0x11')]);router[_0x990f('0x12')](_0x990f('0xb'),auth[_0x990f('0xc')](),controller[_0x990f('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index ca6d8a6..6e4fc2a 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 _0x0a67=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','TIMESTAMP','literal'];(function(_0x4e2a3e,_0x4bfa0c){var _0x59ba56=function(_0x3e99ee){while(--_0x3e99ee){_0x4e2a3e['push'](_0x4e2a3e['shift']());}};_0x59ba56(++_0x4bfa0c);}(_0x0a67,0x137));var _0x70a6=function(_0x57c085,_0x53e090){_0x57c085=_0x57c085-0x0;var _0x173a98=_0x0a67[_0x57c085];return _0x173a98;};'use strict';var Sequelize=require(_0x70a6('0x0'));module[_0x70a6('0x1')]={'name':{'type':Sequelize[_0x70a6('0x2')],'get':function(_0x1d6ee8){return this[_0x70a6('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x70a6('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x70a6('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x70a6('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x70a6('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x70a6('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x70a6('0x5')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x70a6('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x70a6('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x70a6('0x6')]('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x70a6('0x5')],'defaultValue':''},'stamp':{'type':_0x70a6('0x7'),'defaultValue':Sequelize[_0x70a6('0x8')](_0x70a6('0x9'))}}; \ No newline at end of file +var _0x44f2=['exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x44f2,0x86));var _0x244f=function(_0x140357,_0x6670bd){_0x140357=_0x140357-0x0;var _0x4fdf00=_0x44f2[_0x140357];return _0x4fdf00;};'use strict';var Sequelize=require(_0x244f('0x0'));module[_0x244f('0x1')]={'name':{'type':Sequelize[_0x244f('0x2')],'get':function(_0x37cd35){return this[_0x244f('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x244f('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x244f('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x244f('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x244f('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x244f('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x244f('0x5')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x244f('0x6')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x244f('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x244f('0x5')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0x244f('0x7')](_0x244f('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 2dacb16..fd0f925 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 _0x973f=['path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','VoiceMailMessage','rawAttributes','fieldName','type','model','differenceBy','map','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','intersection','fields','create','body','params','find','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x973f,0x145));var _0xf973=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x973f[_0x1e4360];return _0x31e6b4;};'use strict';var emlformat=require(_0xf973('0x0'));var rimraf=require(_0xf973('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf973('0x2'));var rp=require(_0xf973('0x3'));var moment=require(_0xf973('0x4'));var BPromise=require(_0xf973('0x5'));var Mustache=require('mustache');var util=require(_0xf973('0x6'));var path=require(_0xf973('0x7'));var sox=require(_0xf973('0x8'));var csv=require(_0xf973('0x9'));var ejs=require(_0xf973('0xa'));var fs=require('fs');var fs_extra=require(_0xf973('0xb'));var _=require('lodash');var squel=require(_0xf973('0xc'));var crypto=require(_0xf973('0xd'));var jsforce=require(_0xf973('0xe'));var deskjs=require(_0xf973('0xf'));var toCsv=require(_0xf973('0x9'));var querystring=require(_0xf973('0x10'));var Papa=require(_0xf973('0x11'));var Redis=require(_0xf973('0x12'));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(_0xf973('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf973('0x14'));var db=require(_0xf973('0x15'))['db'];function respondWithStatusCode(_0x56a46f,_0x409953){_0x409953=_0x409953||0xcc;return function(_0x3e8139){if(_0x3e8139){return _0x56a46f[_0xf973('0x16')](_0x409953);}return _0x56a46f[_0xf973('0x17')](_0x409953)[_0xf973('0x18')]();};}function respondWithResult(_0x319281,_0x47e48a){_0x47e48a=_0x47e48a||0xc8;return function(_0x424fcb){if(_0x424fcb){return _0x319281[_0xf973('0x17')](_0x47e48a)[_0xf973('0x19')](_0x424fcb);}};}function respondWithFilteredResult(_0x53baf0,_0x115986){return function(_0x54e54d){if(_0x54e54d){var _0x224961=typeof _0x115986[_0xf973('0x1a')]==='undefined'&&typeof _0x115986[_0xf973('0x1b')]===_0xf973('0x1c');var _0x235f97=_0x54e54d[_0xf973('0x1d')];var _0x49d2c9=_0x224961?0x0:_0x115986['offset'];var _0x54220c=_0x224961?_0x54e54d['count']:_0x115986[_0xf973('0x1a')]+_0x115986[_0xf973('0x1b')];var _0x33d3f3;if(_0x54220c>=_0x235f97){_0x54220c=_0x235f97;_0x33d3f3=0xc8;}else{_0x33d3f3=0xce;}_0x53baf0[_0xf973('0x17')](_0x33d3f3);return _0x53baf0[_0xf973('0x1e')](_0xf973('0x1f'),_0x49d2c9+'-'+_0x54220c+'/'+_0x235f97)[_0xf973('0x19')](_0x54e54d);}return null;};}function patchUpdates(_0x5ad376){return function(_0x5a1515){try{jsonpatch[_0xf973('0x20')](_0x5a1515,_0x5ad376,!![]);}catch(_0x40a293){return BPromise[_0xf973('0x21')](_0x40a293);}return _0x5a1515[_0xf973('0x22')]();};}function saveUpdates(_0xc175b7,_0x52aade){return function(_0x34ee4c){if(_0x34ee4c){return _0x34ee4c[_0xf973('0x23')](_0xc175b7)[_0xf973('0x24')](function(_0xd6ee6e){return _0xd6ee6e;});}return null;};}function removeEntity(_0x38133f,_0x20589e){return function(_0x4e5052){if(_0x4e5052){return _0x4e5052[_0xf973('0x25')]()['then'](function(){_0x38133f[_0xf973('0x17')](0xcc)[_0xf973('0x18')]();});}};}function handleEntityNotFound(_0x2c9a71,_0x284ace){return function(_0xa32595){if(!_0xa32595){_0x2c9a71['sendStatus'](0x194);}return _0xa32595;};}function handleError(_0x3398c0,_0x4fb467){_0x4fb467=_0x4fb467||0x1f4;return function(_0x4ebea0){logger[_0xf973('0x26')](_0x4ebea0['stack']);if(_0x4ebea0['name']){delete _0x4ebea0[_0xf973('0x27')];}_0x3398c0[_0xf973('0x17')](_0x4fb467)[_0xf973('0x28')](_0x4ebea0);};}exports[_0xf973('0x29')]=function(_0x130510,_0x485225){var _0xb37aa3={},_0x3390c8={},_0x597511={'count':0x0,'rows':[]};var _0x316044=_['map'](db[_0xf973('0x2a')][_0xf973('0x2b')],function(_0x55ebf7){return{'name':_0x55ebf7[_0xf973('0x2c')],'type':_0x55ebf7[_0xf973('0x2d')]['key']};});_0x3390c8[_0xf973('0x2e')]=_[_0xf973('0x2f')](_[_0xf973('0x30')](_0x316044,_0xf973('0x27')),['name']);_0x3390c8[_0xf973('0x31')]=_[_0xf973('0x32')](_0x130510['query']);_0x3390c8[_0xf973('0x33')]=_['intersection'](_0x3390c8[_0xf973('0x2e')],_0x3390c8[_0xf973('0x31')]);_0xb37aa3[_0xf973('0x34')]=_['intersection'](_0x3390c8[_0xf973('0x2e')],qs['fields'](_0x130510[_0xf973('0x31')]['fields']));_0xb37aa3[_0xf973('0x34')]=_0xb37aa3['attributes'][_0xf973('0x35')]?_0xb37aa3['attributes']:_0x3390c8[_0xf973('0x2e')];if(!_0x130510[_0xf973('0x31')][_0xf973('0x36')](_0xf973('0x37'))){_0xb37aa3['limit']=qs['limit'](_0x130510[_0xf973('0x31')]['limit']);_0xb37aa3[_0xf973('0x1a')]=qs[_0xf973('0x1a')](_0x130510[_0xf973('0x31')][_0xf973('0x1a')]);}_0xb37aa3[_0xf973('0x38')]=qs[_0xf973('0x39')](_0x130510[_0xf973('0x31')][_0xf973('0x39')]);_0xb37aa3[_0xf973('0x3a')]=qs[_0xf973('0x33')](_[_0xf973('0x3b')](_0x130510[_0xf973('0x31')],_0x3390c8['filters']),_0x316044);if(_0x130510['query'][_0xf973('0x3c')]){_0xb37aa3['where']=_[_0xf973('0x3d')](_0xb37aa3[_0xf973('0x3a')],{'$or':_[_0xf973('0x30')](_0x316044,function(_0x168a2c){if(_0x168a2c[_0xf973('0x2d')]!==_0xf973('0x3e')){var _0x11c619={};_0x11c619[_0x168a2c['name']]={'$like':'%'+_0x130510[_0xf973('0x31')][_0xf973('0x3c')]+'%'};return _0x11c619;}})});}_0xb37aa3=_[_0xf973('0x3d')]({},_0xb37aa3,_0x130510[_0xf973('0x3f')]);var _0x1a8aa9={'where':_0xb37aa3[_0xf973('0x3a')]};return db[_0xf973('0x2a')][_0xf973('0x1d')](_0x1a8aa9)[_0xf973('0x24')](function(_0x56ffcd){_0x597511[_0xf973('0x1d')]=_0x56ffcd;if(_0x130510[_0xf973('0x31')][_0xf973('0x40')]){_0xb37aa3[_0xf973('0x41')]=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0xb37aa3);})['then'](function(_0x281f61){_0x597511[_0xf973('0x42')]=_0x281f61;return _0x597511;})[_0xf973('0x24')](respondWithFilteredResult(_0x485225,_0xb37aa3))[_0xf973('0x43')](handleError(_0x485225,null));};exports[_0xf973('0x44')]=function(_0x2b78e2,_0x39c8a8){var _0xda2347={'raw':!![],'where':{'id':_0x2b78e2['params']['id']}},_0x4287e9={};_0x4287e9[_0xf973('0x2e')]=_[_0xf973('0x32')](db[_0xf973('0x2a')][_0xf973('0x2b')]);_0x4287e9['query']=_[_0xf973('0x32')](_0x2b78e2[_0xf973('0x31')]);_0x4287e9['filters']=_[_0xf973('0x45')](_0x4287e9[_0xf973('0x2e')],_0x4287e9[_0xf973('0x31')]);_0xda2347[_0xf973('0x34')]=_['intersection'](_0x4287e9['model'],qs[_0xf973('0x46')](_0x2b78e2[_0xf973('0x31')]['fields']));_0xda2347[_0xf973('0x34')]=_0xda2347[_0xf973('0x34')][_0xf973('0x35')]?_0xda2347[_0xf973('0x34')]:_0x4287e9[_0xf973('0x2e')];if(_0x2b78e2[_0xf973('0x31')][_0xf973('0x40')]){_0xda2347['include']=[{'all':!![]}];}_0xda2347=_[_0xf973('0x3d')]({},_0xda2347,_0x2b78e2['options']);return db[_0xf973('0x2a')]['find'](_0xda2347)[_0xf973('0x24')](handleEntityNotFound(_0x39c8a8,null))['then'](respondWithResult(_0x39c8a8,null))[_0xf973('0x43')](handleError(_0x39c8a8,null));};exports['create']=function(_0x2bb987,_0x199a95){return db[_0xf973('0x2a')][_0xf973('0x47')](_0x2bb987[_0xf973('0x48')],{})[_0xf973('0x24')](respondWithResult(_0x199a95,0xc9))[_0xf973('0x43')](handleError(_0x199a95,null));};exports['update']=function(_0x1bb56d,_0x29ba65){if(_0x1bb56d[_0xf973('0x48')]['id']){delete _0x1bb56d[_0xf973('0x48')]['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x1bb56d[_0xf973('0x49')]['id']}})[_0xf973('0x24')](handleEntityNotFound(_0x29ba65,null))[_0xf973('0x24')](saveUpdates(_0x1bb56d[_0xf973('0x48')],null))[_0xf973('0x24')](respondWithResult(_0x29ba65,null))[_0xf973('0x43')](handleError(_0x29ba65,null));};exports['destroy']=function(_0x2fdfad,_0x1e4195){return db[_0xf973('0x2a')][_0xf973('0x4a')]({'where':{'id':_0x2fdfad[_0xf973('0x49')]['id']}})[_0xf973('0x24')](handleEntityNotFound(_0x1e4195,null))[_0xf973('0x24')](removeEntity(_0x1e4195,null))[_0xf973('0x43')](handleError(_0x1e4195,null));};exports['download']=function(_0x17b27d,_0x497109,_0x3c14c7){return db['VoiceMailMessage'][_0xf973('0x4a')]({'where':{'id':_0x17b27d[_0xf973('0x49')]['id']},'attributes':['id',_0xf973('0x4b'),_0xf973('0x4c')]})[_0xf973('0x24')](handleEntityNotFound(_0x497109,null))[_0xf973('0x24')](function(_0x1d3178){if(_0x1d3178){if(!_0x1d3178[_0xf973('0x4b')]){throw new db['Sequelize'][(_0xf973('0x4d'))](_0xf973('0x4e'));}var _0x121911={'Content-Type':_0xf973('0x4f'),'Content-Disposition':_0xf973('0x50')};if(_0x1d3178['msg_id']){_0x121911['Content-Disposition']=_0xf973('0x51')+_0x1d3178[_0xf973('0x4c')]+_0xf973('0x52');}_0x497109['set'](_0x121911);return _0x497109[_0xf973('0x28')](new Buffer(_0x1d3178[_0xf973('0x4b')]));}})[_0xf973('0x43')](handleError(_0x497109,null));}; \ No newline at end of file +var _0x060c=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','find','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','.wav\x22','rimraf','fast-json-patch','moment','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xab8668,_0x5204ac){var _0x571c10=function(_0x4ed488){while(--_0x4ed488){_0xab8668['push'](_0xab8668['shift']());}};_0x571c10(++_0x5204ac);}(_0x060c,0xf4));var _0xc060=function(_0x52015c,_0x1edced){_0x52015c=_0x52015c-0x0;var _0x354acc=_0x060c[_0x52015c];return _0x354acc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc060('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc060('0x1'));var rp=require('request-promise');var moment=require(_0xc060('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc060('0x3'));var util=require('util');var path=require('path');var sox=require(_0xc060('0x4'));var csv=require('to-csv');var ejs=require(_0xc060('0x5'));var fs=require('fs');var fs_extra=require(_0xc060('0x6'));var _=require('lodash');var squel=require(_0xc060('0x7'));var crypto=require(_0xc060('0x8'));var jsforce=require(_0xc060('0x9'));var deskjs=require(_0xc060('0xa'));var toCsv=require(_0xc060('0xb'));var querystring=require('querystring');var Papa=require(_0xc060('0xc'));var Redis=require(_0xc060('0xd'));var authService=require(_0xc060('0xe'));var qs=require(_0xc060('0xf'));var as=require(_0xc060('0x10'));var hardwareService=require(_0xc060('0x11'));var logger=require(_0xc060('0x12'))(_0xc060('0x13'));var utils=require('../../config/utils');var config=require(_0xc060('0x14'));var licenseUtil=require(_0xc060('0x15'));var db=require(_0xc060('0x16'))['db'];function respondWithStatusCode(_0x3bcacc,_0x4a8dd7){_0x4a8dd7=_0x4a8dd7||0xcc;return function(_0x3c01e8){if(_0x3c01e8){return _0x3bcacc[_0xc060('0x17')](_0x4a8dd7);}return _0x3bcacc[_0xc060('0x18')](_0x4a8dd7)['end']();};}function respondWithResult(_0x231725,_0xf7bb9a){_0xf7bb9a=_0xf7bb9a||0xc8;return function(_0x326c20){if(_0x326c20){return _0x231725[_0xc060('0x18')](_0xf7bb9a)[_0xc060('0x19')](_0x326c20);}};}function respondWithFilteredResult(_0x54c8b8,_0xa9dfed){return function(_0x27bfa6){if(_0x27bfa6){var _0x474e6a=typeof _0xa9dfed[_0xc060('0x1a')]===_0xc060('0x1b')&&typeof _0xa9dfed['limit']===_0xc060('0x1b');var _0x445dc6=_0x27bfa6[_0xc060('0x1c')];var _0x45da9c=_0x474e6a?0x0:_0xa9dfed[_0xc060('0x1a')];var _0x3f96c0=_0x474e6a?_0x27bfa6[_0xc060('0x1c')]:_0xa9dfed[_0xc060('0x1a')]+_0xa9dfed[_0xc060('0x1d')];var _0x852e21;if(_0x3f96c0>=_0x445dc6){_0x3f96c0=_0x445dc6;_0x852e21=0xc8;}else{_0x852e21=0xce;}_0x54c8b8[_0xc060('0x18')](_0x852e21);return _0x54c8b8[_0xc060('0x1e')](_0xc060('0x1f'),_0x45da9c+'-'+_0x3f96c0+'/'+_0x445dc6)['json'](_0x27bfa6);}return null;};}function patchUpdates(_0x40a90a){return function(_0x395e11){try{jsonpatch[_0xc060('0x20')](_0x395e11,_0x40a90a,!![]);}catch(_0x29926b){return BPromise[_0xc060('0x21')](_0x29926b);}return _0x395e11[_0xc060('0x22')]();};}function saveUpdates(_0x3b2281,_0x559e7d){return function(_0x4fadc1){if(_0x4fadc1){return _0x4fadc1[_0xc060('0x23')](_0x3b2281)[_0xc060('0x24')](function(_0x1ce8c0){return _0x1ce8c0;});}return null;};}function removeEntity(_0x145c30,_0x1360b0){return function(_0x3e7a5c){if(_0x3e7a5c){return _0x3e7a5c[_0xc060('0x25')]()[_0xc060('0x24')](function(){_0x145c30['status'](0xcc)[_0xc060('0x26')]();});}};}function handleEntityNotFound(_0x5d44a7,_0x58789a){return function(_0xcfdaf8){if(!_0xcfdaf8){_0x5d44a7[_0xc060('0x17')](0x194);}return _0xcfdaf8;};}function handleError(_0x239228,_0x2b1363){_0x2b1363=_0x2b1363||0x1f4;return function(_0x5b7e24){logger['error'](_0x5b7e24[_0xc060('0x27')]);if(_0x5b7e24['name']){delete _0x5b7e24[_0xc060('0x28')];}_0x239228[_0xc060('0x18')](_0x2b1363)[_0xc060('0x29')](_0x5b7e24);};}exports[_0xc060('0x2a')]=function(_0x5b522c,_0x384b79){var _0x34689b={},_0x29e442={},_0x140f54={'count':0x0,'rows':[]};var _0x3cc04a=_[_0xc060('0x2b')](db[_0xc060('0x2c')][_0xc060('0x2d')],function(_0x34791f){return{'name':_0x34791f[_0xc060('0x2e')],'type':_0x34791f['type'][_0xc060('0x2f')]};});_0x29e442[_0xc060('0x30')]=_[_0xc060('0x31')](_[_0xc060('0x2b')](_0x3cc04a,_0xc060('0x28')),[_0xc060('0x28')]);_0x29e442[_0xc060('0x32')]=_[_0xc060('0x33')](_0x5b522c[_0xc060('0x32')]);_0x29e442[_0xc060('0x34')]=_[_0xc060('0x35')](_0x29e442['model'],_0x29e442[_0xc060('0x32')]);_0x34689b[_0xc060('0x36')]=_[_0xc060('0x35')](_0x29e442[_0xc060('0x30')],qs['fields'](_0x5b522c['query'][_0xc060('0x37')]));_0x34689b['attributes']=_0x34689b[_0xc060('0x36')][_0xc060('0x38')]?_0x34689b[_0xc060('0x36')]:_0x29e442[_0xc060('0x30')];if(!_0x5b522c[_0xc060('0x32')][_0xc060('0x39')](_0xc060('0x3a'))){_0x34689b['limit']=qs[_0xc060('0x1d')](_0x5b522c['query'][_0xc060('0x1d')]);_0x34689b[_0xc060('0x1a')]=qs[_0xc060('0x1a')](_0x5b522c[_0xc060('0x32')][_0xc060('0x1a')]);}_0x34689b[_0xc060('0x3b')]=qs[_0xc060('0x3c')](_0x5b522c['query'][_0xc060('0x3c')]);_0x34689b['where']=qs['filters'](_[_0xc060('0x3d')](_0x5b522c['query'],_0x29e442[_0xc060('0x34')]),_0x3cc04a);if(_0x5b522c['query'][_0xc060('0x3e')]){_0x34689b[_0xc060('0x3f')]=_[_0xc060('0x40')](_0x34689b[_0xc060('0x3f')],{'$or':_[_0xc060('0x2b')](_0x3cc04a,function(_0x5022da){if(_0x5022da[_0xc060('0x41')]!==_0xc060('0x42')){var _0x4e1c4b={};_0x4e1c4b[_0x5022da[_0xc060('0x28')]]={'$like':'%'+_0x5b522c['query'][_0xc060('0x3e')]+'%'};return _0x4e1c4b;}})});}_0x34689b=_[_0xc060('0x40')]({},_0x34689b,_0x5b522c[_0xc060('0x43')]);var _0x3abe17={'where':_0x34689b[_0xc060('0x3f')]};return db[_0xc060('0x2c')][_0xc060('0x1c')](_0x3abe17)[_0xc060('0x24')](function(_0x253213){_0x140f54[_0xc060('0x1c')]=_0x253213;if(_0x5b522c['query'][_0xc060('0x44')]){_0x34689b[_0xc060('0x45')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0xc060('0x46')](_0x34689b);})['then'](function(_0x1c100c){_0x140f54['rows']=_0x1c100c;return _0x140f54;})[_0xc060('0x24')](respondWithFilteredResult(_0x384b79,_0x34689b))[_0xc060('0x47')](handleError(_0x384b79,null));};exports[_0xc060('0x48')]=function(_0x140a9e,_0x2c0a85){var _0x4bda30={'raw':!![],'where':{'id':_0x140a9e[_0xc060('0x49')]['id']}},_0x3a83f0={};_0x3a83f0[_0xc060('0x30')]=_[_0xc060('0x33')](db[_0xc060('0x2c')]['rawAttributes']);_0x3a83f0[_0xc060('0x32')]=_['keys'](_0x140a9e[_0xc060('0x32')]);_0x3a83f0[_0xc060('0x34')]=_[_0xc060('0x35')](_0x3a83f0['model'],_0x3a83f0[_0xc060('0x32')]);_0x4bda30[_0xc060('0x36')]=_[_0xc060('0x35')](_0x3a83f0[_0xc060('0x30')],qs['fields'](_0x140a9e['query']['fields']));_0x4bda30[_0xc060('0x36')]=_0x4bda30[_0xc060('0x36')][_0xc060('0x38')]?_0x4bda30[_0xc060('0x36')]:_0x3a83f0['model'];if(_0x140a9e['query'][_0xc060('0x44')]){_0x4bda30[_0xc060('0x45')]=[{'all':!![]}];}_0x4bda30=_['merge']({},_0x4bda30,_0x140a9e['options']);return db[_0xc060('0x2c')]['find'](_0x4bda30)['then'](handleEntityNotFound(_0x2c0a85,null))['then'](respondWithResult(_0x2c0a85,null))[_0xc060('0x47')](handleError(_0x2c0a85,null));};exports[_0xc060('0x4a')]=function(_0x2a8317,_0x506b1a){return db[_0xc060('0x2c')]['create'](_0x2a8317[_0xc060('0x4b')],{})[_0xc060('0x24')](respondWithResult(_0x506b1a,0xc9))[_0xc060('0x47')](handleError(_0x506b1a,null));};exports[_0xc060('0x23')]=function(_0x170d0a,_0x224aa4){if(_0x170d0a[_0xc060('0x4b')]['id']){delete _0x170d0a[_0xc060('0x4b')]['id'];}return db[_0xc060('0x2c')][_0xc060('0x4c')]({'where':{'id':_0x170d0a[_0xc060('0x49')]['id']}})[_0xc060('0x24')](handleEntityNotFound(_0x224aa4,null))['then'](saveUpdates(_0x170d0a[_0xc060('0x4b')],null))[_0xc060('0x24')](respondWithResult(_0x224aa4,null))[_0xc060('0x47')](handleError(_0x224aa4,null));};exports[_0xc060('0x25')]=function(_0x2b4ad5,_0x441b23){return db[_0xc060('0x2c')][_0xc060('0x4c')]({'where':{'id':_0x2b4ad5['params']['id']}})[_0xc060('0x24')](handleEntityNotFound(_0x441b23,null))[_0xc060('0x24')](removeEntity(_0x441b23,null))[_0xc060('0x47')](handleError(_0x441b23,null));};exports[_0xc060('0x4d')]=function(_0xdd12c1,_0x503429,_0x369c0e){return db[_0xc060('0x2c')][_0xc060('0x4c')]({'where':{'id':_0xdd12c1['params']['id']},'attributes':['id',_0xc060('0x4e'),_0xc060('0x4f')]})['then'](handleEntityNotFound(_0x503429,null))['then'](function(_0x4cc9a8){if(_0x4cc9a8){if(!_0x4cc9a8[_0xc060('0x4e')]){throw new db[(_0xc060('0x50'))][(_0xc060('0x51'))](_0xc060('0x52'));}var _0x4adef9={'Content-Type':_0xc060('0x53'),'Content-Disposition':_0xc060('0x54')};if(_0x4cc9a8['msg_id']){_0x4adef9[_0xc060('0x55')]='attachment;\x20filename=\x22'+_0x4cc9a8[_0xc060('0x4f')]+_0xc060('0x56');}_0x503429[_0xc060('0x1e')](_0x4adef9);return _0x503429[_0xc060('0x29')](new Buffer(_0x4cc9a8[_0xc060('0x4e')]));}})[_0xc060('0x47')](handleError(_0x503429,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 87d4556..6044dd6 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 _0x6107=['exports','dir','util','../../config/logger','api','moment','bluebird','../../config/environment','./voiceMailMessage.attributes'];(function(_0x1240ea,_0x361541){var _0x282bc=function(_0x8d9b3d){while(--_0x8d9b3d){_0x1240ea['push'](_0x1240ea['shift']());}};_0x282bc(++_0x361541);}(_0x6107,0x122));var _0x7610=function(_0x3848b,_0x15ec60){_0x3848b=_0x3848b-0x0;var _0x5903ac=_0x6107[_0x3848b];return _0x5903ac;};'use strict';var _=require('lodash');var util=require(_0x7610('0x0'));var logger=require(_0x7610('0x1'))(_0x7610('0x2'));var moment=require(_0x7610('0x3'));var BPromise=require(_0x7610('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7610('0x5'));var attributes=require(_0x7610('0x6'));module[_0x7610('0x7')]=function(_0x4a06a2,_0x448b27){return _0x4a06a2['define']('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x7610('0x8'),'fields':[_0x7610('0x8')]}],'timestamps':![]});}; \ No newline at end of file +var _0x8c30=['voice_voicemail_messages','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','VoiceMailMessage'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8c30,0x187));var _0x08c3=function(_0x51d6fb,_0x215faa){_0x51d6fb=_0x51d6fb-0x0;var _0x4233c5=_0x8c30[_0x51d6fb];return _0x4233c5;};'use strict';var _=require('lodash');var util=require(_0x08c3('0x0'));var logger=require(_0x08c3('0x1'))(_0x08c3('0x2'));var moment=require(_0x08c3('0x3'));var BPromise=require(_0x08c3('0x4'));var rp=require(_0x08c3('0x5'));var fs=require('fs');var path=require(_0x08c3('0x6'));var rimraf=require(_0x08c3('0x7'));var config=require(_0x08c3('0x8'));var attributes=require(_0x08c3('0x9'));module[_0x08c3('0xa')]=function(_0x18b56b,_0x482c5a){return _0x18b56b['define'](_0x08c3('0xb'),attributes,{'tableName':_0x08c3('0xc'),'paranoid':![],'indexes':[{'name':'dir','fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index fca5324..7c872e1 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 _0x5da9=['client','http','request','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x2c61a2,_0x40fe37){var _0x28bf7c=function(_0x4afffe){while(--_0x4afffe){_0x2c61a2['push'](_0x2c61a2['shift']());}};_0x28bf7c(++_0x40fe37);}(_0x5da9,0xfe));var _0x95da=function(_0x310d10,_0x3fe887){_0x310d10=_0x310d10-0x0;var _0x1fb8af=_0x5da9[_0x310d10];return _0x1fb8af;};'use strict';var _=require(_0x95da('0x0'));var util=require(_0x95da('0x1'));var moment=require(_0x95da('0x2'));var BPromise=require(_0x95da('0x3'));var rs=require(_0x95da('0x4'));var fs=require('fs');var Redis=require(_0x95da('0x5'));var db=require(_0x95da('0x6'))['db'];var utils=require(_0x95da('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x95da('0x8'));var jayson=require(_0x95da('0x9'));var client=jayson[_0x95da('0xa')][_0x95da('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4781b5,_0x4fc261,_0x47dfd){return new BPromise(function(_0xd67387,_0x690140){return client[_0x95da('0xc')](_0x4781b5,_0x47dfd)['then'](function(_0x3250fa){logger['info'](_0x95da('0xd'),_0x4fc261,'request\x20sent');logger[_0x95da('0xe')](_0x95da('0xf'),_0x4fc261,_0x95da('0x10'),JSON[_0x95da('0x11')](_0x3250fa));if(_0x3250fa[_0x95da('0x12')]){if(_0x3250fa[_0x95da('0x12')][_0x95da('0x13')]===0x1f4){logger[_0x95da('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x4fc261,_0x3250fa[_0x95da('0x12')][_0x95da('0x14')]);return _0x690140(_0x3250fa[_0x95da('0x12')]['message']);}logger[_0x95da('0x12')](_0x95da('0xd'),_0x4fc261,_0x3250fa[_0x95da('0x12')][_0x95da('0x14')]);return _0xd67387(_0x3250fa[_0x95da('0x12')]['message']);}else{logger['info'](_0x95da('0xd'),_0x4fc261,_0x95da('0x10'));_0xd67387(_0x3250fa['result']['message']);}})[_0x95da('0x15')](function(_0x23d5d2){logger[_0x95da('0x12')](_0x95da('0xd'),_0x4fc261,_0x23d5d2);_0x690140(_0x23d5d2);});});} \ No newline at end of file +var _0x6a9f=['catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent'];(function(_0x2c2d11,_0x4308ac){var _0x255f24=function(_0x1aa524){while(--_0x1aa524){_0x2c2d11['push'](_0x2c2d11['shift']());}};_0x255f24(++_0x4308ac);}(_0x6a9f,0x135));var _0xf6a9=function(_0x5e9691,_0x391955){_0x5e9691=_0x5e9691-0x0;var _0x48a12d=_0x6a9f[_0x5e9691];return _0x48a12d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf6a9('0x0'));var BPromise=require(_0xf6a9('0x1'));var rs=require(_0xf6a9('0x2'));var fs=require('fs');var Redis=require(_0xf6a9('0x3'));var db=require(_0xf6a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf6a9('0x5'))('rpc');var config=require(_0xf6a9('0x6'));var jayson=require(_0xf6a9('0x7'));var client=jayson[_0xf6a9('0x8')][_0xf6a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a8959,_0x2ecb10,_0x10b9e6){return new BPromise(function(_0x53f9ed,_0x5d6436){return client[_0xf6a9('0xa')](_0x5a8959,_0x10b9e6)[_0xf6a9('0xb')](function(_0x1a390f){logger['info'](_0xf6a9('0xc'),_0x2ecb10,'request\x20sent');logger[_0xf6a9('0xd')](_0xf6a9('0xe'),_0x2ecb10,'request\x20sent',JSON[_0xf6a9('0xf')](_0x1a390f));if(_0x1a390f['error']){if(_0x1a390f[_0xf6a9('0x10')][_0xf6a9('0x11')]===0x1f4){logger[_0xf6a9('0x10')](_0xf6a9('0xc'),_0x2ecb10,_0x1a390f['error'][_0xf6a9('0x12')]);return _0x5d6436(_0x1a390f['error'][_0xf6a9('0x12')]);}logger[_0xf6a9('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x2ecb10,_0x1a390f['error'][_0xf6a9('0x12')]);return _0x53f9ed(_0x1a390f[_0xf6a9('0x10')]['message']);}else{logger[_0xf6a9('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x2ecb10,_0xf6a9('0x14'));_0x53f9ed(_0x1a390f['result'][_0xf6a9('0x12')]);}})[_0xf6a9('0x15')](function(_0x5ea522){logger[_0xf6a9('0x10')](_0xf6a9('0xc'),_0x2ecb10,_0x5ea522);_0x5d6436(_0x5ea522);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index af9608b..091417f 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 _0x6fc4=['/:id/sounds','getSounds','post','create','put','delete','destroy','/:id/sounds/:id2','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id'];(function(_0x50e826,_0x984648){var _0x4fb9df=function(_0x14bea0){while(--_0x14bea0){_0x50e826['push'](_0x50e826['shift']());}};_0x4fb9df(++_0x984648);}(_0x6fc4,0x77));var _0x46fc=function(_0x4375fb,_0x22650a){_0x4375fb=_0x4375fb-0x0;var _0x445a97=_0x6fc4[_0x4375fb];return _0x445a97;};'use strict';var multer=require(_0x46fc('0x0'));var util=require(_0x46fc('0x1'));var path=require(_0x46fc('0x2'));var timeout=require(_0x46fc('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x46fc('0x4'));var auth=require(_0x46fc('0x5'));var interaction=require(_0x46fc('0x6'));var config=require(_0x46fc('0x7'));var controller=require(_0x46fc('0x8'));router[_0x46fc('0x9')]('/',auth[_0x46fc('0xa')](),controller[_0x46fc('0xb')]);router[_0x46fc('0x9')](_0x46fc('0xc'),auth[_0x46fc('0xa')](),controller['show']);router[_0x46fc('0x9')](_0x46fc('0xd'),auth[_0x46fc('0xa')](),controller[_0x46fc('0xe')]);router[_0x46fc('0xf')]('/',auth[_0x46fc('0xa')](),controller[_0x46fc('0x10')]);router[_0x46fc('0xf')](_0x46fc('0xd'),auth[_0x46fc('0xa')](),controller['addSound']);router[_0x46fc('0x11')](_0x46fc('0xc'),auth[_0x46fc('0xa')](),controller['update']);router[_0x46fc('0x12')](_0x46fc('0xc'),auth['isAuthenticated'](),controller[_0x46fc('0x13')]);router[_0x46fc('0x12')](_0x46fc('0x14'),auth[_0x46fc('0xa')](),controller['removeSound']);module[_0x46fc('0x15')]=router; \ No newline at end of file +var _0xb75d=['/:id','isAuthenticated','show','create','post','/:id/sounds','addSound','put','destroy','delete','removeSound','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index'];(function(_0x2ef5e4,_0x3b9561){var _0x1e6df9=function(_0x5659e0){while(--_0x5659e0){_0x2ef5e4['push'](_0x2ef5e4['shift']());}};_0x1e6df9(++_0x3b9561);}(_0xb75d,0x96));var _0xdb75=function(_0x225f50,_0x48a77d){_0x225f50=_0x225f50-0x0;var _0x19d003=_0xb75d[_0x225f50];return _0x19d003;};'use strict';var multer=require(_0xdb75('0x0'));var util=require('util');var path=require(_0xdb75('0x1'));var timeout=require('connect-timeout');var express=require(_0xdb75('0x2'));var router=express[_0xdb75('0x3')]();var fs_extra=require(_0xdb75('0x4'));var auth=require(_0xdb75('0x5'));var interaction=require(_0xdb75('0x6'));var config=require(_0xdb75('0x7'));var controller=require(_0xdb75('0x8'));router[_0xdb75('0x9')]('/',auth['isAuthenticated'](),controller[_0xdb75('0xa')]);router['get'](_0xdb75('0xb'),auth[_0xdb75('0xc')](),controller[_0xdb75('0xd')]);router[_0xdb75('0x9')]('/:id/sounds',auth[_0xdb75('0xc')](),controller['getSounds']);router['post']('/',auth[_0xdb75('0xc')](),controller[_0xdb75('0xe')]);router[_0xdb75('0xf')](_0xdb75('0x10'),auth['isAuthenticated'](),controller[_0xdb75('0x11')]);router[_0xdb75('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xdb75('0xc')](),controller[_0xdb75('0x13')]);router[_0xdb75('0x14')]('/:id/sounds/:id2',auth[_0xdb75('0xc')](),controller[_0xdb75('0x15')]);module[_0xdb75('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index cf7f459..d01c85e 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 _0xd81d=['mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM','files','quietmp3nb','quietmp3'];(function(_0x44e5d7,_0xf2ced2){var _0xd5d6b3=function(_0x3b0822){while(--_0x3b0822){_0x44e5d7['push'](_0x44e5d7['shift']());}};_0xd5d6b3(++_0xf2ced2);}(_0xd81d,0x10c));var _0xdd81=function(_0x32ecff,_0x465b38){_0x32ecff=_0x32ecff-0x0;var _0xdff227=_0xd81d[_0x32ecff];return _0xdff227;};'use strict';var Sequelize=require(_0xdd81('0x0'));module[_0xdd81('0x1')]={'name':{'type':Sequelize[_0xdd81('0x2')],'allowNull':![],'unique':_0xdd81('0x3')},'mode':{'type':Sequelize[_0xdd81('0x4')]('custom',_0xdd81('0x5'),'mp3nb',_0xdd81('0x6'),_0xdd81('0x7'),_0xdd81('0x8')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xdd81('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xdd81('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xdd81('0x2')],'allowNull':!![],'defaultValue':_0xdd81('0x9')},'format':{'type':Sequelize[_0xdd81('0x2')],'allowNull':!![]},'stamp':{'type':_0xdd81('0xa')},'defaultEntry':{'type':Sequelize[_0xdd81('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x163b=['files','mp3nb','quietmp3nb','mp3','alpha','TIMESTAMP','sequelize','exports','STRING','name','ENUM','custom'];(function(_0x52ff5f,_0x4c0933){var _0x2659f6=function(_0x297a41){while(--_0x297a41){_0x52ff5f['push'](_0x52ff5f['shift']());}};_0x2659f6(++_0x4c0933);}(_0x163b,0x7e));var _0xb163=function(_0x3cbc4c,_0x4d8c1e){_0x3cbc4c=_0x3cbc4c-0x0;var _0x4f849c=_0x163b[_0x3cbc4c];return _0x4f849c;};'use strict';var Sequelize=require(_0xb163('0x0'));module[_0xb163('0x1')]={'name':{'type':Sequelize[_0xb163('0x2')],'allowNull':![],'unique':_0xb163('0x3')},'mode':{'type':Sequelize[_0xb163('0x4')](_0xb163('0x5'),_0xb163('0x6'),_0xb163('0x7'),_0xb163('0x8'),'quietmp3',_0xb163('0x9')),'allowNull':!![],'defaultValue':_0xb163('0x6')},'directory':{'type':Sequelize[_0xb163('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xb163('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xb163('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xb163('0x2')],'allowNull':!![],'defaultValue':_0xb163('0xa')},'format':{'type':Sequelize[_0xb163('0x2')],'allowNull':!![]},'stamp':{'type':_0xb163('0xb')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index b4dae72..6d446f4 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 _0x8df1=['offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','end','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','VoiceMusicOnHold','includeAll','include','findAll','rows','catch','show','params','find','body','create','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','sequelize','transaction','readdirSync','forEach','unlinkSync','Sequelize','ValidationError','addSound','save_name','converted_format','%s.%s','basename','extname','format','message','removeSound','findOne','id2','getSounds','Sound','pick','hasOwnProperty','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8df1,0x1a9));var _0x18df=function(_0x28b43b,_0x21b019){_0x28b43b=_0x28b43b-0x0;var _0x3d2c01=_0x8df1[_0x28b43b];return _0x3d2c01;};'use strict';var emlformat=require(_0x18df('0x0'));var rimraf=require(_0x18df('0x1'));var zipdir=require(_0x18df('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x18df('0x3'));var BPromise=require(_0x18df('0x4'));var Mustache=require(_0x18df('0x5'));var util=require(_0x18df('0x6'));var path=require('path');var sox=require(_0x18df('0x7'));var csv=require(_0x18df('0x8'));var ejs=require(_0x18df('0x9'));var fs=require('fs');var fs_extra=require(_0x18df('0xa'));var _=require(_0x18df('0xb'));var squel=require(_0x18df('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x18df('0xd'));var toCsv=require(_0x18df('0x8'));var querystring=require(_0x18df('0xe'));var Papa=require(_0x18df('0xf'));var Redis=require(_0x18df('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x18df('0x11'));var logger=require(_0x18df('0x12'))(_0x18df('0x13'));var utils=require(_0x18df('0x14'));var config=require(_0x18df('0x15'));var licenseUtil=require(_0x18df('0x16'));var db=require(_0x18df('0x17'))['db'];function respondWithStatusCode(_0x2b0b95,_0x174870){_0x174870=_0x174870||0xcc;return function(_0x8d1ddc){if(_0x8d1ddc){return _0x2b0b95[_0x18df('0x18')](_0x174870);}return _0x2b0b95[_0x18df('0x19')](_0x174870)['end']();};}function respondWithResult(_0x748e4a,_0x4196ee){_0x4196ee=_0x4196ee||0xc8;return function(_0x1fb5b6){if(_0x1fb5b6){return _0x748e4a[_0x18df('0x19')](_0x4196ee)[_0x18df('0x1a')](_0x1fb5b6);}};}function respondWithFilteredResult(_0x3fa401,_0x432dd9){return function(_0x2b6f47){if(_0x2b6f47){var _0x1748d9=typeof _0x432dd9[_0x18df('0x1b')]==='undefined'&&typeof _0x432dd9[_0x18df('0x1c')]==='undefined';var _0x4692fe=_0x2b6f47[_0x18df('0x1d')];var _0x1e8f3f=_0x1748d9?0x0:_0x432dd9[_0x18df('0x1b')];var _0x21493b=_0x1748d9?_0x2b6f47[_0x18df('0x1d')]:_0x432dd9[_0x18df('0x1b')]+_0x432dd9[_0x18df('0x1c')];var _0x5e8629;if(_0x21493b>=_0x4692fe){_0x21493b=_0x4692fe;_0x5e8629=0xc8;}else{_0x5e8629=0xce;}_0x3fa401[_0x18df('0x19')](_0x5e8629);return _0x3fa401[_0x18df('0x1e')](_0x18df('0x1f'),_0x1e8f3f+'-'+_0x21493b+'/'+_0x4692fe)[_0x18df('0x1a')](_0x2b6f47);}return null;};}function patchUpdates(_0xdc18aa){return function(_0x4a1382){try{jsonpatch[_0x18df('0x20')](_0x4a1382,_0xdc18aa,!![]);}catch(_0x2a9be1){return BPromise[_0x18df('0x21')](_0x2a9be1);}return _0x4a1382[_0x18df('0x22')]();};}function saveUpdates(_0x34a254,_0x1d17bb){return function(_0x3b70e4){if(_0x3b70e4){return _0x3b70e4[_0x18df('0x23')](_0x34a254)[_0x18df('0x24')](function(_0x3a2424){return _0x3a2424;});}return null;};}function removeEntity(_0x3c895c,_0x3d80fe){return function(_0x55a8aa){if(_0x55a8aa){return _0x55a8aa[_0x18df('0x25')]()[_0x18df('0x24')](function(){var _0x11d0b0=_0x55a8aa[_0x18df('0x26')]({'plain':!![]});var _0x22e383=_0x18df('0x27');return db[_0x18df('0x28')][_0x18df('0x25')]({'where':{'type':_0x22e383,'resourceId':_0x11d0b0['id']}})[_0x18df('0x24')](function(){return _0x55a8aa;});})['then'](function(){_0x3c895c[_0x18df('0x19')](0xcc)[_0x18df('0x29')]();});}};}function handleEntityNotFound(_0x1b4ecf,_0x18f1d2){return function(_0x546cc6){if(!_0x546cc6){_0x1b4ecf['sendStatus'](0x194);}return _0x546cc6;};}function handleError(_0x1e97b7,_0x5b1748){_0x5b1748=_0x5b1748||0x1f4;return function(_0x2d116b){logger['error'](_0x2d116b['stack']);if(_0x2d116b[_0x18df('0x2a')]){delete _0x2d116b['name'];}_0x1e97b7[_0x18df('0x19')](_0x5b1748)[_0x18df('0x2b')](_0x2d116b);};}exports[_0x18df('0x2c')]=function(_0x345c3b,_0x206820){var _0x362b31={},_0x33a36a={},_0x271944={'count':0x0,'rows':[]};var _0x26d3cc=_[_0x18df('0x2d')](db['VoiceMusicOnHold'][_0x18df('0x2e')],function(_0x394efb){return{'name':_0x394efb[_0x18df('0x2f')],'type':_0x394efb[_0x18df('0x30')][_0x18df('0x31')]};});_0x33a36a[_0x18df('0x32')]=_[_0x18df('0x2d')](_0x26d3cc,_0x18df('0x2a'));_0x33a36a[_0x18df('0x33')]=_[_0x18df('0x34')](_0x345c3b['query']);_0x33a36a[_0x18df('0x35')]=_[_0x18df('0x36')](_0x33a36a[_0x18df('0x32')],_0x33a36a[_0x18df('0x33')]);_0x362b31[_0x18df('0x37')]=_[_0x18df('0x36')](_0x33a36a['model'],qs[_0x18df('0x38')](_0x345c3b[_0x18df('0x33')][_0x18df('0x38')]));_0x362b31[_0x18df('0x37')]=_0x362b31['attributes'][_0x18df('0x39')]?_0x362b31['attributes']:_0x33a36a[_0x18df('0x32')];if(!_0x345c3b['query']['hasOwnProperty'](_0x18df('0x3a'))){_0x362b31[_0x18df('0x1c')]=qs[_0x18df('0x1c')](_0x345c3b[_0x18df('0x33')][_0x18df('0x1c')]);_0x362b31[_0x18df('0x1b')]=qs[_0x18df('0x1b')](_0x345c3b[_0x18df('0x33')][_0x18df('0x1b')]);}_0x362b31['order']=qs[_0x18df('0x3b')](_0x345c3b[_0x18df('0x33')]['sort']);delete _0x345c3b[_0x18df('0x33')][_0x18df('0x3b')];_0x362b31[_0x18df('0x3c')]=qs[_0x18df('0x35')](_['pick'](_0x345c3b[_0x18df('0x33')],_0x33a36a[_0x18df('0x35')]),_0x26d3cc);if(_0x345c3b[_0x18df('0x33')][_0x18df('0x3d')]){_0x362b31[_0x18df('0x3c')]=_[_0x18df('0x3e')](_0x362b31[_0x18df('0x3c')],{'$or':_[_0x18df('0x2d')](_0x26d3cc,function(_0x374d56){if(_0x374d56[_0x18df('0x30')]!==_0x18df('0x3f')){var _0x4115cb={};_0x4115cb[_0x374d56[_0x18df('0x2a')]]={'$like':'%'+_0x345c3b[_0x18df('0x33')]['filter']+'%'};return _0x4115cb;}})});}_0x362b31=_[_0x18df('0x3e')]({},_0x362b31,_0x345c3b[_0x18df('0x40')]);var _0x1e03b4={'where':_0x362b31[_0x18df('0x3c')]};return db[_0x18df('0x41')][_0x18df('0x1d')](_0x1e03b4)[_0x18df('0x24')](function(_0x450e19){_0x271944[_0x18df('0x1d')]=_0x450e19;if(_0x345c3b[_0x18df('0x33')][_0x18df('0x42')]){_0x362b31[_0x18df('0x43')]=[{'all':!![]}];}return db[_0x18df('0x41')][_0x18df('0x44')](_0x362b31);})[_0x18df('0x24')](function(_0x5d7d73){_0x271944[_0x18df('0x45')]=_0x5d7d73;return _0x271944;})[_0x18df('0x24')](respondWithFilteredResult(_0x206820,_0x362b31))[_0x18df('0x46')](handleError(_0x206820,null));};exports[_0x18df('0x47')]=function(_0x89c12d,_0x507c33){var _0xec0bbd={'raw':![],'where':{'id':_0x89c12d[_0x18df('0x48')]['id']}},_0xedb0ed={};_0xedb0ed[_0x18df('0x32')]=_[_0x18df('0x34')](db[_0x18df('0x41')][_0x18df('0x2e')]);_0xedb0ed['query']=_[_0x18df('0x34')](_0x89c12d['query']);_0xedb0ed[_0x18df('0x35')]=_[_0x18df('0x36')](_0xedb0ed['model'],_0xedb0ed[_0x18df('0x33')]);_0xec0bbd[_0x18df('0x37')]=_['intersection'](_0xedb0ed[_0x18df('0x32')],qs[_0x18df('0x38')](_0x89c12d[_0x18df('0x33')]['fields']));_0xec0bbd[_0x18df('0x37')]=_0xec0bbd[_0x18df('0x37')][_0x18df('0x39')]?_0xec0bbd[_0x18df('0x37')]:_0xedb0ed[_0x18df('0x32')];if(_0x89c12d['query']['includeAll']){_0xec0bbd[_0x18df('0x43')]=[{'all':!![]}];}_0xec0bbd=_[_0x18df('0x3e')]({},_0xec0bbd,_0x89c12d[_0x18df('0x40')]);return db[_0x18df('0x41')][_0x18df('0x49')](_0xec0bbd)[_0x18df('0x24')](handleEntityNotFound(_0x507c33,null))['then'](respondWithResult(_0x507c33,null))[_0x18df('0x46')](handleError(_0x507c33,null));};exports[_0x18df('0x23')]=function(_0x8ba1fe,_0x5e204a){if(_0x8ba1fe[_0x18df('0x4a')]['id']){delete _0x8ba1fe[_0x18df('0x4a')]['id'];}return db[_0x18df('0x41')][_0x18df('0x49')]({'where':{'id':_0x8ba1fe[_0x18df('0x48')]['id']}})['then'](handleEntityNotFound(_0x5e204a,null))[_0x18df('0x24')](saveUpdates(_0x8ba1fe[_0x18df('0x4a')],null))[_0x18df('0x24')](respondWithResult(_0x5e204a,null))['catch'](handleError(_0x5e204a,null));};exports[_0x18df('0x4b')]=function(_0x21d5c4,_0x26a1e9,_0x5bf6ac){return db['sequelize']['transaction'](function(_0x4da553){if(_0x21d5c4[_0x18df('0x4a')][_0x18df('0x4c')]===_0x18df('0x4d')){_0x21d5c4[_0x18df('0x4a')][_0x18df('0x4e')]=path[_0x18df('0x4f')](config[_0x18df('0x50')],_0x18df('0x51'),_0x21d5c4[_0x18df('0x4a')]['name']);}return db['VoiceMusicOnHold'][_0x18df('0x4b')](_0x21d5c4[_0x18df('0x4a')],{'transaction':_0x4da553})['then'](function(_0x44b4d5){if(_0x21d5c4[_0x18df('0x4a')]['mode']===_0x18df('0x4d')){fs[_0x18df('0x52')](_0x44b4d5[_0x18df('0x4e')],parseInt(_0x18df('0x53'),0x8));}var _0x33dd2e=_0x21d5c4['user'][_0x18df('0x26')]({'plain':!![]});if(!_0x33dd2e)throw new Error(_0x18df('0x54'));if(_0x33dd2e[_0x18df('0x55')]===_0x18df('0x56')){var _0x1ba6a7=_0x44b4d5['get']({'plain':!![]});return db[_0x18df('0x57')][_0x18df('0x49')]({'where':{'name':_0x18df('0x27'),'userProfileId':_0x33dd2e[_0x18df('0x58')]},'raw':!![]})[_0x18df('0x24')](function(_0x515dba){if(_0x515dba&&_0x515dba[_0x18df('0x59')]===0x0){return db['UserProfileResource'][_0x18df('0x4b')]({'name':_0x1ba6a7[_0x18df('0x2a')],'resourceId':_0x1ba6a7['id'],'type':_0x515dba[_0x18df('0x2a')],'sectionId':_0x515dba['id']},{})[_0x18df('0x24')](function(){return _0x44b4d5;});}else{return _0x44b4d5;}})['catch'](function(_0x3fc704){logger[_0x18df('0x5a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3fc704);});}return _0x44b4d5;});})[_0x18df('0x24')](respondWithResult(_0x26a1e9,0xc9))[_0x18df('0x46')](handleError(_0x26a1e9,null));};exports[_0x18df('0x25')]=function(_0x413240,_0x264b44,_0x3cb0ec){var _0x3b30cb;return db[_0x18df('0x41')][_0x18df('0x49')]({'where':{'id':_0x413240[_0x18df('0x48')]['id']}})['then'](function(_0x3fab68){if(_0x3fab68){return db[_0x18df('0x5b')][_0x18df('0x5c')](function(_0x5cb3c1){return _0x3fab68['destroy']({'transaction':_0x5cb3c1,'raw':!![]})[_0x18df('0x24')](function(_0x66ade3){if(_0x66ade3[_0x18df('0x4e')]){fs[_0x18df('0x5d')](_0x66ade3[_0x18df('0x4e')])[_0x18df('0x5e')](function(_0xc3af1f){fs[_0x18df('0x5f')](path[_0x18df('0x4f')](_0x66ade3[_0x18df('0x4e')],_0xc3af1f));});fs['rmdirSync'](_0x66ade3['directory']);}return _0x66ade3;});})[_0x18df('0x46')](function(_0x5f0f43){throw new db[(_0x18df('0x60'))][(_0x18df('0x61'))](_0x5f0f43['message']);});}})['then'](handleEntityNotFound(_0x264b44,null))[_0x18df('0x24')](removeEntity(_0x264b44,null))['catch'](handleError(_0x264b44,null));};exports[_0x18df('0x62')]=function(_0x52aecb,_0x56b91e,_0x162399){return db[_0x18df('0x5b')][_0x18df('0x5c')](function(_0x4634d8){var _0x1fb04f;return db[_0x18df('0x41')][_0x18df('0x49')]({'where':{'id':_0x52aecb[_0x18df('0x48')]['id']}})[_0x18df('0x24')](function(_0x845db7){if(_0x845db7){_0x1fb04f=_0x845db7;return _0x845db7[_0x18df('0x62')](_0x52aecb[_0x18df('0x4a')]['id'],{'transaction':_0x4634d8});}})[_0x18df('0x24')](function(_0x538797){if(_0x538797){return db['Sound']['findOne']({'where':{'id':_0x52aecb[_0x18df('0x4a')]['id']},'attributes':['id','name',_0x18df('0x63'),_0x18df('0x64'),'createdAt'],'raw':!![]});}})['then'](function(_0x28e712){if(_0x28e712){var _0x4ab2e7=path[_0x18df('0x4f')](config[_0x18df('0x50')],'server/files/sounds/converted',util['format'](_0x18df('0x65'),path[_0x18df('0x66')](_0x28e712[_0x18df('0x63')],path[_0x18df('0x67')](_0x28e712[_0x18df('0x63')])),_0x28e712[_0x18df('0x64')]));var _0x5555ca=path[_0x18df('0x4f')](config[_0x18df('0x50')],_0x18df('0x51'),_0x1fb04f[_0x18df('0x2a')],util[_0x18df('0x68')](_0x18df('0x65'),_0x28e712['name'],_0x28e712[_0x18df('0x64')]));fs['symlinkSync'](_0x4ab2e7,_0x5555ca);return _0x28e712;}})['catch'](function(_0x2a960c){throw new db[(_0x18df('0x60'))][(_0x18df('0x61'))](_0x2a960c[_0x18df('0x69')]);});})[_0x18df('0x24')](handleEntityNotFound(_0x56b91e,null))['then'](respondWithResult(_0x56b91e,0xc9))[_0x18df('0x46')](handleError(_0x56b91e,null));};exports[_0x18df('0x6a')]=function(_0x1dfd66,_0x194620,_0x299c51){return db[_0x18df('0x5b')][_0x18df('0x5c')](function(_0x37730d){var _0x1792fb;return db[_0x18df('0x41')]['findOne']({'where':{'id':_0x1dfd66['params']['id']}})[_0x18df('0x24')](handleEntityNotFound(_0x194620,null))['then'](function(_0x174448){if(_0x174448){_0x1792fb=_0x174448;return _0x174448['removeSound'](_0x1dfd66[_0x18df('0x48')]['id2']);}})[_0x18df('0x24')](function(_0x5e02b0){if(_0x5e02b0){return db['Sound'][_0x18df('0x6b')]({'where':{'id':_0x1dfd66[_0x18df('0x48')][_0x18df('0x6c')]},'attributes':['id',_0x18df('0x2a'),_0x18df('0x63'),_0x18df('0x64'),'createdAt'],'raw':!![]});}})[_0x18df('0x24')](function(_0x5bcb81){if(_0x5bcb81){fs[_0x18df('0x5f')](path[_0x18df('0x4f')](_0x1792fb[_0x18df('0x4e')],util['format'](_0x18df('0x65'),_0x5bcb81[_0x18df('0x2a')],_0x5bcb81['converted_format'])));return _0x5bcb81;}})['catch'](function(_0x1a3e76){throw new db[(_0x18df('0x60'))]['ValidationError'](_0x1a3e76[_0x18df('0x69')]);});})[_0x18df('0x24')](handleEntityNotFound(_0x194620,null))[_0x18df('0x24')](respondWithStatusCode(_0x194620,0xcc))[_0x18df('0x46')](handleError(_0x194620,null));};exports[_0x18df('0x6d')]=function(_0x46b4ba,_0xf9aa47,_0x374c0b){var _0x3ae894={};var _0x5bb0c1={};var _0x2fa0a6;var _0x303f54;return db[_0x18df('0x41')][_0x18df('0x6b')]({'where':{'id':_0x46b4ba[_0x18df('0x48')]['id']}})[_0x18df('0x24')](handleEntityNotFound(_0xf9aa47,null))[_0x18df('0x24')](function(_0x88e196){if(_0x88e196){_0x2fa0a6=_0x88e196;_0x5bb0c1[_0x18df('0x32')]=_[_0x18df('0x34')](db[_0x18df('0x6e')][_0x18df('0x2e')]);_0x5bb0c1[_0x18df('0x33')]=_[_0x18df('0x34')](_0x46b4ba[_0x18df('0x33')]);_0x5bb0c1[_0x18df('0x35')]=_[_0x18df('0x36')](_0x5bb0c1[_0x18df('0x32')],_0x5bb0c1[_0x18df('0x33')]);_0x3ae894[_0x18df('0x37')]=_[_0x18df('0x36')](_0x5bb0c1['model'],qs['fields'](_0x46b4ba[_0x18df('0x33')][_0x18df('0x38')]));_0x3ae894[_0x18df('0x37')]=_0x3ae894[_0x18df('0x37')][_0x18df('0x39')]?_0x3ae894[_0x18df('0x37')]:_0x5bb0c1[_0x18df('0x32')];_0x3ae894['order']=qs[_0x18df('0x3b')](_0x46b4ba[_0x18df('0x33')]['sort']);_0x3ae894[_0x18df('0x3c')]=qs[_0x18df('0x35')](_[_0x18df('0x6f')](_0x46b4ba[_0x18df('0x33')],_0x5bb0c1[_0x18df('0x35')]));if(_0x46b4ba[_0x18df('0x33')][_0x18df('0x3d')]){_0x3ae894[_0x18df('0x3c')]=_[_0x18df('0x3e')](_0x3ae894[_0x18df('0x3c')],{'$or':_['map'](_0x3ae894[_0x18df('0x37')],function(_0x221c3a){var _0x5517f4={};_0x5517f4[_0x221c3a]={'$like':'%'+_0x46b4ba['query'][_0x18df('0x3d')]+'%'};return _0x5517f4;})});}_0x3ae894=_[_0x18df('0x3e')]({},_0x3ae894,_0x46b4ba['options']);return _0x2fa0a6[_0x18df('0x6d')](_0x3ae894);}})[_0x18df('0x24')](function(_0x15d437){if(_0x15d437){_0x303f54=_0x15d437[_0x18df('0x39')];if(!_0x46b4ba[_0x18df('0x33')][_0x18df('0x70')](_0x18df('0x3a'))){_0x3ae894[_0x18df('0x1c')]=qs['limit'](_0x46b4ba[_0x18df('0x33')][_0x18df('0x1c')]);_0x3ae894['offset']=qs[_0x18df('0x1b')](_0x46b4ba[_0x18df('0x33')]['offset']);}return _0x2fa0a6[_0x18df('0x6d')](_0x3ae894);}})['then'](function(_0x3a6518){if(_0x3a6518){return _0x3a6518?{'count':_0x303f54,'rows':_0x3a6518}:null;}})[_0x18df('0x24')](respondWithResult(_0xf9aa47,null))[_0x18df('0x46')](handleError(_0xf9aa47,null));}; \ No newline at end of file +var _0x6fcd=['rows','catch','params','length','include','find','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','removeSound','id2','getSounds','nolimit','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','VoiceMusicOnHold','includeAll','findAll'];(function(_0xcf21a8,_0x48ff89){var _0x1a2172=function(_0xed7c20){while(--_0xed7c20){_0xcf21a8['push'](_0xcf21a8['shift']());}};_0x1a2172(++_0x48ff89);}(_0x6fcd,0xa5));var _0xd6fc=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x6fcd[_0x36884e];return _0x1cc367;};'use strict';var emlformat=require(_0xd6fc('0x0'));var rimraf=require(_0xd6fc('0x1'));var zipdir=require(_0xd6fc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd6fc('0x3'));var moment=require(_0xd6fc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd6fc('0x5'));var util=require(_0xd6fc('0x6'));var path=require(_0xd6fc('0x7'));var sox=require(_0xd6fc('0x8'));var csv=require(_0xd6fc('0x9'));var ejs=require(_0xd6fc('0xa'));var fs=require('fs');var fs_extra=require(_0xd6fc('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd6fc('0xc'));var jsforce=require(_0xd6fc('0xd'));var deskjs=require(_0xd6fc('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd6fc('0xf'));var Papa=require(_0xd6fc('0x10'));var Redis=require(_0xd6fc('0x11'));var authService=require(_0xd6fc('0x12'));var qs=require(_0xd6fc('0x13'));var as=require(_0xd6fc('0x14'));var hardwareService=require(_0xd6fc('0x15'));var logger=require(_0xd6fc('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xd6fc('0x17'));var licenseUtil=require(_0xd6fc('0x18'));var db=require(_0xd6fc('0x19'))['db'];function respondWithStatusCode(_0x2fe3f5,_0x2ba609){_0x2ba609=_0x2ba609||0xcc;return function(_0x4642c9){if(_0x4642c9){return _0x2fe3f5[_0xd6fc('0x1a')](_0x2ba609);}return _0x2fe3f5[_0xd6fc('0x1b')](_0x2ba609)[_0xd6fc('0x1c')]();};}function respondWithResult(_0x5f4518,_0xa870d1){_0xa870d1=_0xa870d1||0xc8;return function(_0x2a0108){if(_0x2a0108){return _0x5f4518[_0xd6fc('0x1b')](_0xa870d1)[_0xd6fc('0x1d')](_0x2a0108);}};}function respondWithFilteredResult(_0x1d0e26,_0x15758b){return function(_0x3dc74f){if(_0x3dc74f){var _0x27175c=typeof _0x15758b['offset']===_0xd6fc('0x1e')&&typeof _0x15758b[_0xd6fc('0x1f')]==='undefined';var _0xcd1a35=_0x3dc74f['count'];var _0x559aa0=_0x27175c?0x0:_0x15758b[_0xd6fc('0x20')];var _0xef9339=_0x27175c?_0x3dc74f[_0xd6fc('0x21')]:_0x15758b['offset']+_0x15758b[_0xd6fc('0x1f')];var _0x221ff7;if(_0xef9339>=_0xcd1a35){_0xef9339=_0xcd1a35;_0x221ff7=0xc8;}else{_0x221ff7=0xce;}_0x1d0e26[_0xd6fc('0x1b')](_0x221ff7);return _0x1d0e26[_0xd6fc('0x22')](_0xd6fc('0x23'),_0x559aa0+'-'+_0xef9339+'/'+_0xcd1a35)['json'](_0x3dc74f);}return null;};}function patchUpdates(_0x1a5a07){return function(_0x42bc25){try{jsonpatch[_0xd6fc('0x24')](_0x42bc25,_0x1a5a07,!![]);}catch(_0x5e5753){return BPromise[_0xd6fc('0x25')](_0x5e5753);}return _0x42bc25[_0xd6fc('0x26')]();};}function saveUpdates(_0x4871bf,_0x3c3adf){return function(_0x33f5e5){if(_0x33f5e5){return _0x33f5e5[_0xd6fc('0x27')](_0x4871bf)[_0xd6fc('0x28')](function(_0x69ed6a){return _0x69ed6a;});}return null;};}function removeEntity(_0x2572bd,_0x54abed){return function(_0x88845b){if(_0x88845b){return _0x88845b[_0xd6fc('0x29')]()[_0xd6fc('0x28')](function(){var _0x497a57=_0x88845b[_0xd6fc('0x2a')]({'plain':!![]});var _0x1c172b=_0xd6fc('0x2b');return db[_0xd6fc('0x2c')][_0xd6fc('0x29')]({'where':{'type':_0x1c172b,'resourceId':_0x497a57['id']}})[_0xd6fc('0x28')](function(){return _0x88845b;});})[_0xd6fc('0x28')](function(){_0x2572bd[_0xd6fc('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37d717,_0x577534){return function(_0x1cddc1){if(!_0x1cddc1){_0x37d717['sendStatus'](0x194);}return _0x1cddc1;};}function handleError(_0x3beb5e,_0x39ff7d){_0x39ff7d=_0x39ff7d||0x1f4;return function(_0x4ea35b){logger[_0xd6fc('0x2d')](_0x4ea35b[_0xd6fc('0x2e')]);if(_0x4ea35b[_0xd6fc('0x2f')]){delete _0x4ea35b[_0xd6fc('0x2f')];}_0x3beb5e['status'](_0x39ff7d)[_0xd6fc('0x30')](_0x4ea35b);};}exports[_0xd6fc('0x31')]=function(_0x267f42,_0x3e3e71){var _0x174ba8={},_0x15218c={},_0x16eb9e={'count':0x0,'rows':[]};var _0x3299c3=_[_0xd6fc('0x32')](db['VoiceMusicOnHold'][_0xd6fc('0x33')],function(_0x5c38b5){return{'name':_0x5c38b5[_0xd6fc('0x34')],'type':_0x5c38b5[_0xd6fc('0x35')]['key']};});_0x15218c[_0xd6fc('0x36')]=_[_0xd6fc('0x32')](_0x3299c3,'name');_0x15218c['query']=_[_0xd6fc('0x37')](_0x267f42[_0xd6fc('0x38')]);_0x15218c[_0xd6fc('0x39')]=_[_0xd6fc('0x3a')](_0x15218c[_0xd6fc('0x36')],_0x15218c[_0xd6fc('0x38')]);_0x174ba8[_0xd6fc('0x3b')]=_[_0xd6fc('0x3a')](_0x15218c[_0xd6fc('0x36')],qs[_0xd6fc('0x3c')](_0x267f42[_0xd6fc('0x38')][_0xd6fc('0x3c')]));_0x174ba8[_0xd6fc('0x3b')]=_0x174ba8['attributes']['length']?_0x174ba8[_0xd6fc('0x3b')]:_0x15218c['model'];if(!_0x267f42[_0xd6fc('0x38')][_0xd6fc('0x3d')]('nolimit')){_0x174ba8[_0xd6fc('0x1f')]=qs['limit'](_0x267f42['query'][_0xd6fc('0x1f')]);_0x174ba8[_0xd6fc('0x20')]=qs[_0xd6fc('0x20')](_0x267f42[_0xd6fc('0x38')][_0xd6fc('0x20')]);}_0x174ba8[_0xd6fc('0x3e')]=qs[_0xd6fc('0x3f')](_0x267f42[_0xd6fc('0x38')][_0xd6fc('0x3f')]);delete _0x267f42[_0xd6fc('0x38')][_0xd6fc('0x3f')];_0x174ba8['where']=qs[_0xd6fc('0x39')](_[_0xd6fc('0x40')](_0x267f42['query'],_0x15218c[_0xd6fc('0x39')]),_0x3299c3);if(_0x267f42[_0xd6fc('0x38')][_0xd6fc('0x41')]){_0x174ba8['where']=_[_0xd6fc('0x42')](_0x174ba8[_0xd6fc('0x43')],{'$or':_['map'](_0x3299c3,function(_0x2d44d6){if(_0x2d44d6[_0xd6fc('0x35')]!==_0xd6fc('0x44')){var _0x478a2a={};_0x478a2a[_0x2d44d6[_0xd6fc('0x2f')]]={'$like':'%'+_0x267f42[_0xd6fc('0x38')][_0xd6fc('0x41')]+'%'};return _0x478a2a;}})});}_0x174ba8=_[_0xd6fc('0x42')]({},_0x174ba8,_0x267f42[_0xd6fc('0x45')]);var _0x38979c={'where':_0x174ba8['where']};return db[_0xd6fc('0x46')][_0xd6fc('0x21')](_0x38979c)[_0xd6fc('0x28')](function(_0x159699){_0x16eb9e['count']=_0x159699;if(_0x267f42['query'][_0xd6fc('0x47')]){_0x174ba8['include']=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xd6fc('0x48')](_0x174ba8);})[_0xd6fc('0x28')](function(_0x3e1ee9){_0x16eb9e[_0xd6fc('0x49')]=_0x3e1ee9;return _0x16eb9e;})[_0xd6fc('0x28')](respondWithFilteredResult(_0x3e3e71,_0x174ba8))[_0xd6fc('0x4a')](handleError(_0x3e3e71,null));};exports['show']=function(_0x553f29,_0x45607d){var _0x2570ba={'raw':![],'where':{'id':_0x553f29[_0xd6fc('0x4b')]['id']}},_0x45d737={};_0x45d737[_0xd6fc('0x36')]=_[_0xd6fc('0x37')](db[_0xd6fc('0x46')][_0xd6fc('0x33')]);_0x45d737[_0xd6fc('0x38')]=_[_0xd6fc('0x37')](_0x553f29[_0xd6fc('0x38')]);_0x45d737[_0xd6fc('0x39')]=_[_0xd6fc('0x3a')](_0x45d737[_0xd6fc('0x36')],_0x45d737['query']);_0x2570ba[_0xd6fc('0x3b')]=_[_0xd6fc('0x3a')](_0x45d737[_0xd6fc('0x36')],qs['fields'](_0x553f29['query'][_0xd6fc('0x3c')]));_0x2570ba[_0xd6fc('0x3b')]=_0x2570ba['attributes'][_0xd6fc('0x4c')]?_0x2570ba[_0xd6fc('0x3b')]:_0x45d737[_0xd6fc('0x36')];if(_0x553f29[_0xd6fc('0x38')][_0xd6fc('0x47')]){_0x2570ba[_0xd6fc('0x4d')]=[{'all':!![]}];}_0x2570ba=_[_0xd6fc('0x42')]({},_0x2570ba,_0x553f29[_0xd6fc('0x45')]);return db[_0xd6fc('0x46')][_0xd6fc('0x4e')](_0x2570ba)[_0xd6fc('0x28')](handleEntityNotFound(_0x45607d,null))['then'](respondWithResult(_0x45607d,null))['catch'](handleError(_0x45607d,null));};exports[_0xd6fc('0x27')]=function(_0x24f096,_0x462014){if(_0x24f096[_0xd6fc('0x4f')]['id']){delete _0x24f096[_0xd6fc('0x4f')]['id'];}return db[_0xd6fc('0x46')][_0xd6fc('0x4e')]({'where':{'id':_0x24f096[_0xd6fc('0x4b')]['id']}})[_0xd6fc('0x28')](handleEntityNotFound(_0x462014,null))['then'](saveUpdates(_0x24f096[_0xd6fc('0x4f')],null))[_0xd6fc('0x28')](respondWithResult(_0x462014,null))[_0xd6fc('0x4a')](handleError(_0x462014,null));};exports[_0xd6fc('0x50')]=function(_0x48b73f,_0x30f3a4,_0x202517){return db[_0xd6fc('0x51')][_0xd6fc('0x52')](function(_0x2f5796){if(_0x48b73f[_0xd6fc('0x4f')][_0xd6fc('0x53')]===_0xd6fc('0x54')){_0x48b73f[_0xd6fc('0x4f')][_0xd6fc('0x55')]=path[_0xd6fc('0x56')](config[_0xd6fc('0x57')],_0xd6fc('0x58'),_0x48b73f[_0xd6fc('0x4f')][_0xd6fc('0x2f')]);}return db[_0xd6fc('0x46')][_0xd6fc('0x50')](_0x48b73f[_0xd6fc('0x4f')],{'transaction':_0x2f5796})[_0xd6fc('0x28')](function(_0x464ee7){if(_0x48b73f[_0xd6fc('0x4f')][_0xd6fc('0x53')]===_0xd6fc('0x54')){fs[_0xd6fc('0x59')](_0x464ee7[_0xd6fc('0x55')],parseInt(_0xd6fc('0x5a'),0x8));}var _0x29d202=_0x48b73f[_0xd6fc('0x5b')][_0xd6fc('0x2a')]({'plain':!![]});if(!_0x29d202)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29d202[_0xd6fc('0x5c')]===_0xd6fc('0x5b')){var _0x6f2ec4=_0x464ee7[_0xd6fc('0x2a')]({'plain':!![]});return db[_0xd6fc('0x5d')][_0xd6fc('0x4e')]({'where':{'name':_0xd6fc('0x2b'),'userProfileId':_0x29d202[_0xd6fc('0x5e')]},'raw':!![]})[_0xd6fc('0x28')](function(_0x50a779){if(_0x50a779&&_0x50a779[_0xd6fc('0x5f')]===0x0){return db['UserProfileResource'][_0xd6fc('0x50')]({'name':_0x6f2ec4[_0xd6fc('0x2f')],'resourceId':_0x6f2ec4['id'],'type':_0x50a779['name'],'sectionId':_0x50a779['id']},{})[_0xd6fc('0x28')](function(){return _0x464ee7;});}else{return _0x464ee7;}})['catch'](function(_0xb81b93){logger['error'](_0xd6fc('0x60'),_0xb81b93);});}return _0x464ee7;});})['then'](respondWithResult(_0x30f3a4,0xc9))[_0xd6fc('0x4a')](handleError(_0x30f3a4,null));};exports['destroy']=function(_0x5614cf,_0x23d87d,_0x24ef74){var _0x510e70;return db[_0xd6fc('0x46')][_0xd6fc('0x4e')]({'where':{'id':_0x5614cf[_0xd6fc('0x4b')]['id']}})[_0xd6fc('0x28')](function(_0x337c59){if(_0x337c59){return db[_0xd6fc('0x51')][_0xd6fc('0x52')](function(_0x37a90a){return _0x337c59[_0xd6fc('0x29')]({'transaction':_0x37a90a,'raw':!![]})[_0xd6fc('0x28')](function(_0x318e0d){if(_0x318e0d[_0xd6fc('0x55')]){fs[_0xd6fc('0x61')](_0x318e0d['directory'])['forEach'](function(_0x3e1e9a){fs[_0xd6fc('0x62')](path[_0xd6fc('0x56')](_0x318e0d['directory'],_0x3e1e9a));});fs[_0xd6fc('0x63')](_0x318e0d['directory']);}return _0x318e0d;});})[_0xd6fc('0x4a')](function(_0x108d05){throw new db[(_0xd6fc('0x64'))][(_0xd6fc('0x65'))](_0x108d05[_0xd6fc('0x66')]);});}})[_0xd6fc('0x28')](handleEntityNotFound(_0x23d87d,null))['then'](removeEntity(_0x23d87d,null))[_0xd6fc('0x4a')](handleError(_0x23d87d,null));};exports[_0xd6fc('0x67')]=function(_0x4949df,_0x45752d,_0x5da0f3){return db[_0xd6fc('0x51')][_0xd6fc('0x52')](function(_0x2806f6){var _0x435cf2;return db[_0xd6fc('0x46')]['find']({'where':{'id':_0x4949df[_0xd6fc('0x4b')]['id']}})[_0xd6fc('0x28')](function(_0x5debd8){if(_0x5debd8){_0x435cf2=_0x5debd8;return _0x5debd8[_0xd6fc('0x67')](_0x4949df[_0xd6fc('0x4f')]['id'],{'transaction':_0x2806f6});}})[_0xd6fc('0x28')](function(_0x288723){if(_0x288723){return db[_0xd6fc('0x68')][_0xd6fc('0x69')]({'where':{'id':_0x4949df[_0xd6fc('0x4f')]['id']},'attributes':['id',_0xd6fc('0x2f'),_0xd6fc('0x6a'),_0xd6fc('0x6b'),_0xd6fc('0x6c')],'raw':!![]});}})[_0xd6fc('0x28')](function(_0x25a0df){if(_0x25a0df){var _0xed5b5a=path[_0xd6fc('0x56')](config[_0xd6fc('0x57')],_0xd6fc('0x6d'),util[_0xd6fc('0x6e')](_0xd6fc('0x6f'),path[_0xd6fc('0x70')](_0x25a0df[_0xd6fc('0x6a')],path[_0xd6fc('0x71')](_0x25a0df[_0xd6fc('0x6a')])),_0x25a0df[_0xd6fc('0x6b')]));var _0x2d52d6=path[_0xd6fc('0x56')](config[_0xd6fc('0x57')],_0xd6fc('0x58'),_0x435cf2['name'],util[_0xd6fc('0x6e')]('%s.%s',_0x25a0df[_0xd6fc('0x2f')],_0x25a0df[_0xd6fc('0x6b')]));fs[_0xd6fc('0x72')](_0xed5b5a,_0x2d52d6);return _0x25a0df;}})[_0xd6fc('0x4a')](function(_0x42bee4){throw new db[(_0xd6fc('0x64'))][(_0xd6fc('0x65'))](_0x42bee4[_0xd6fc('0x66')]);});})[_0xd6fc('0x28')](handleEntityNotFound(_0x45752d,null))[_0xd6fc('0x28')](respondWithResult(_0x45752d,0xc9))['catch'](handleError(_0x45752d,null));};exports[_0xd6fc('0x73')]=function(_0x3818b5,_0x50dc3e,_0x2f81ab){return db['sequelize'][_0xd6fc('0x52')](function(_0x4823b3){var _0x46e837;return db[_0xd6fc('0x46')][_0xd6fc('0x69')]({'where':{'id':_0x3818b5[_0xd6fc('0x4b')]['id']}})[_0xd6fc('0x28')](handleEntityNotFound(_0x50dc3e,null))['then'](function(_0x218ce8){if(_0x218ce8){_0x46e837=_0x218ce8;return _0x218ce8['removeSound'](_0x3818b5[_0xd6fc('0x4b')][_0xd6fc('0x74')]);}})[_0xd6fc('0x28')](function(_0x194e69){if(_0x194e69){return db['Sound'][_0xd6fc('0x69')]({'where':{'id':_0x3818b5['params'][_0xd6fc('0x74')]},'attributes':['id',_0xd6fc('0x2f'),_0xd6fc('0x6a'),_0xd6fc('0x6b'),_0xd6fc('0x6c')],'raw':!![]});}})[_0xd6fc('0x28')](function(_0x1588bc){if(_0x1588bc){fs[_0xd6fc('0x62')](path['join'](_0x46e837[_0xd6fc('0x55')],util[_0xd6fc('0x6e')]('%s.%s',_0x1588bc[_0xd6fc('0x2f')],_0x1588bc[_0xd6fc('0x6b')])));return _0x1588bc;}})[_0xd6fc('0x4a')](function(_0x3961cb){throw new db[(_0xd6fc('0x64'))][(_0xd6fc('0x65'))](_0x3961cb[_0xd6fc('0x66')]);});})[_0xd6fc('0x28')](handleEntityNotFound(_0x50dc3e,null))['then'](respondWithStatusCode(_0x50dc3e,0xcc))[_0xd6fc('0x4a')](handleError(_0x50dc3e,null));};exports[_0xd6fc('0x75')]=function(_0x36e3cf,_0x363924,_0x4171bd){var _0x2a9ab1={};var _0x478a01={};var _0x3aabeb;var _0x20de64;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x36e3cf[_0xd6fc('0x4b')]['id']}})[_0xd6fc('0x28')](handleEntityNotFound(_0x363924,null))[_0xd6fc('0x28')](function(_0x1309a1){if(_0x1309a1){_0x3aabeb=_0x1309a1;_0x478a01['model']=_[_0xd6fc('0x37')](db[_0xd6fc('0x68')][_0xd6fc('0x33')]);_0x478a01[_0xd6fc('0x38')]=_[_0xd6fc('0x37')](_0x36e3cf[_0xd6fc('0x38')]);_0x478a01['filters']=_['intersection'](_0x478a01[_0xd6fc('0x36')],_0x478a01['query']);_0x2a9ab1[_0xd6fc('0x3b')]=_[_0xd6fc('0x3a')](_0x478a01[_0xd6fc('0x36')],qs[_0xd6fc('0x3c')](_0x36e3cf[_0xd6fc('0x38')]['fields']));_0x2a9ab1[_0xd6fc('0x3b')]=_0x2a9ab1['attributes'][_0xd6fc('0x4c')]?_0x2a9ab1[_0xd6fc('0x3b')]:_0x478a01[_0xd6fc('0x36')];_0x2a9ab1['order']=qs[_0xd6fc('0x3f')](_0x36e3cf[_0xd6fc('0x38')][_0xd6fc('0x3f')]);_0x2a9ab1['where']=qs['filters'](_['pick'](_0x36e3cf[_0xd6fc('0x38')],_0x478a01[_0xd6fc('0x39')]));if(_0x36e3cf[_0xd6fc('0x38')][_0xd6fc('0x41')]){_0x2a9ab1[_0xd6fc('0x43')]=_[_0xd6fc('0x42')](_0x2a9ab1[_0xd6fc('0x43')],{'$or':_['map'](_0x2a9ab1['attributes'],function(_0x300aa8){var _0x5904fc={};_0x5904fc[_0x300aa8]={'$like':'%'+_0x36e3cf[_0xd6fc('0x38')][_0xd6fc('0x41')]+'%'};return _0x5904fc;})});}_0x2a9ab1=_['merge']({},_0x2a9ab1,_0x36e3cf[_0xd6fc('0x45')]);return _0x3aabeb[_0xd6fc('0x75')](_0x2a9ab1);}})[_0xd6fc('0x28')](function(_0xbd667a){if(_0xbd667a){_0x20de64=_0xbd667a['length'];if(!_0x36e3cf[_0xd6fc('0x38')][_0xd6fc('0x3d')](_0xd6fc('0x76'))){_0x2a9ab1['limit']=qs[_0xd6fc('0x1f')](_0x36e3cf[_0xd6fc('0x38')][_0xd6fc('0x1f')]);_0x2a9ab1['offset']=qs[_0xd6fc('0x20')](_0x36e3cf[_0xd6fc('0x38')][_0xd6fc('0x20')]);}return _0x3aabeb[_0xd6fc('0x75')](_0x2a9ab1);}})[_0xd6fc('0x28')](function(_0x3d143b){if(_0x3d143b){return _0x3d143b?{'count':_0x20de64,'rows':_0x3d143b}:null;}})['then'](respondWithResult(_0x363924,null))[_0xd6fc('0x4a')](handleError(_0x363924,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 3cc4ccd..04d38f2 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 _0x9f34=['./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3344cc,_0x584c19){var _0x5f0082=function(_0x15bcba){while(--_0x15bcba){_0x3344cc['push'](_0x3344cc['shift']());}};_0x5f0082(++_0x584c19);}(_0x9f34,0x13d));var _0x49f3=function(_0xc23f79,_0x3b670a){_0xc23f79=_0xc23f79-0x0;var _0x143502=_0x9f34[_0xc23f79];return _0x143502;};'use strict';var _=require('lodash');var util=require(_0x49f3('0x0'));var logger=require(_0x49f3('0x1'))(_0x49f3('0x2'));var moment=require(_0x49f3('0x3'));var BPromise=require(_0x49f3('0x4'));var rp=require(_0x49f3('0x5'));var fs=require('fs');var path=require(_0x49f3('0x6'));var rimraf=require('rimraf');var config=require(_0x49f3('0x7'));var attributes=require(_0x49f3('0x8'));module[_0x49f3('0x9')]=function(_0x3ace7d,_0x4e224f){return _0x3ace7d[_0x49f3('0xa')](_0x49f3('0xb'),attributes,{'tableName':_0x49f3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed2c=['voice_musiconhold','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','define','VoiceMusicOnHold'];(function(_0x880b72,_0x318124){var _0x171fe2=function(_0x294a6b){while(--_0x294a6b){_0x880b72['push'](_0x880b72['shift']());}};_0x171fe2(++_0x318124);}(_0xed2c,0x14b));var _0xced2=function(_0x2bc09e,_0x1ae747){_0x2bc09e=_0x2bc09e-0x0;var _0x3f7c75=_0xed2c[_0x2bc09e];return _0x3f7c75;};'use strict';var _=require(_0xced2('0x0'));var util=require('util');var logger=require(_0xced2('0x1'))(_0xced2('0x2'));var moment=require(_0xced2('0x3'));var BPromise=require(_0xced2('0x4'));var rp=require(_0xced2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xced2('0x6'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x7e171b,_0x54870c){return _0x7e171b[_0xced2('0x7')](_0xced2('0x8'),attributes,{'tableName':_0xced2('0x9'),'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 9bc6b41..97c4ae1 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x54805f,_0x1d10e4){var _0x12d872=function(_0x382b69){while(--_0x382b69){_0x54805f['push'](_0x54805f['shift']());}};_0x12d872(++_0x1d10e4);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x1232d5,_0x3b1bcf){var _0x48c11e=function(_0x433097){while(--_0x433097){_0x1232d5['push'](_0x1232d5['shift']());}};_0x48c11e(++_0x3b1bcf);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4d337e,_0x2f7eed){_0x4d337e=_0x4d337e-0x0;var _0x247963=_0xcb91[_0x4d337e];return _0x247963;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 9385cf6..6ae881d 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 _0x5900=['../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','getAgents','/:id/teams','post','/:id/users','addAgents','addTeams','update','destroy','delete','removeAgents','exports','util','path','express','Router','fs-extra','../../components/interaction/service'];(function(_0x51cc1b,_0xc6adf2){var _0x4718e3=function(_0x51eaaf){while(--_0x51eaaf){_0x51cc1b['push'](_0x51cc1b['shift']());}};_0x4718e3(++_0xc6adf2);}(_0x5900,0xd2));var _0x0590=function(_0x456eae,_0x4290c3){_0x456eae=_0x456eae-0x0;var _0x49f4b1=_0x5900[_0x456eae];return _0x49f4b1;};'use strict';var multer=require('multer');var util=require(_0x0590('0x0'));var path=require(_0x0590('0x1'));var timeout=require('connect-timeout');var express=require(_0x0590('0x2'));var router=express[_0x0590('0x3')]();var fs_extra=require(_0x0590('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0590('0x5'));var config=require(_0x0590('0x6'));var controller=require('./voicePrefix.controller');router[_0x0590('0x7')]('/',auth[_0x0590('0x8')](),controller['index']);router[_0x0590('0x7')](_0x0590('0x9'),auth[_0x0590('0x8')](),controller[_0x0590('0xa')]);router[_0x0590('0x7')](_0x0590('0xb'),auth[_0x0590('0x8')](),controller[_0x0590('0xc')]);router[_0x0590('0x7')]('/:id/users',auth[_0x0590('0x8')](),controller[_0x0590('0xd')]);router['get'](_0x0590('0xe'),auth[_0x0590('0x8')](),controller['getTeams']);router['post']('/',auth[_0x0590('0x8')](),controller['create']);router[_0x0590('0xf')](_0x0590('0x10'),auth[_0x0590('0x8')](),controller[_0x0590('0x11')]);router[_0x0590('0xf')]('/:id/teams',auth[_0x0590('0x8')](),controller[_0x0590('0x12')]);router['put'](_0x0590('0xb'),auth[_0x0590('0x8')](),controller[_0x0590('0x13')]);router['delete'](_0x0590('0xb'),auth['isAuthenticated'](),controller[_0x0590('0x14')]);router[_0x0590('0x15')](_0x0590('0x10'),auth[_0x0590('0x8')](),controller[_0x0590('0x16')]);router[_0x0590('0x15')](_0x0590('0xe'),auth['isAuthenticated'](),controller['removeTeams']);module[_0x0590('0x17')]=router; \ No newline at end of file +var _0x0689=['destroy','delete','removeAgents','removeTeams','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','put','update'];(function(_0x19be81,_0x15be20){var _0x32b8a5=function(_0x3c3b26){while(--_0x3c3b26){_0x19be81['push'](_0x19be81['shift']());}};_0x32b8a5(++_0x15be20);}(_0x0689,0x161));var _0x9068=function(_0xe429f8,_0xb5ddb4){_0xe429f8=_0xe429f8-0x0;var _0x439723=_0x0689[_0xe429f8];return _0x439723;};'use strict';var multer=require('multer');var util=require(_0x9068('0x0'));var path=require('path');var timeout=require(_0x9068('0x1'));var express=require(_0x9068('0x2'));var router=express[_0x9068('0x3')]();var fs_extra=require(_0x9068('0x4'));var auth=require(_0x9068('0x5'));var interaction=require(_0x9068('0x6'));var config=require(_0x9068('0x7'));var controller=require(_0x9068('0x8'));router[_0x9068('0x9')]('/',auth[_0x9068('0xa')](),controller['index']);router[_0x9068('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x9068('0xb')]);router[_0x9068('0x9')](_0x9068('0xc'),auth[_0x9068('0xa')](),controller[_0x9068('0xd')]);router[_0x9068('0x9')](_0x9068('0xe'),auth[_0x9068('0xa')](),controller[_0x9068('0xf')]);router['get'](_0x9068('0x10'),auth[_0x9068('0xa')](),controller[_0x9068('0x11')]);router[_0x9068('0x12')]('/',auth['isAuthenticated'](),controller[_0x9068('0x13')]);router[_0x9068('0x12')](_0x9068('0xe'),auth['isAuthenticated'](),controller[_0x9068('0x14')]);router[_0x9068('0x12')](_0x9068('0x10'),auth['isAuthenticated'](),controller[_0x9068('0x15')]);router[_0x9068('0x16')]('/:id',auth[_0x9068('0xa')](),controller[_0x9068('0x17')]);router['delete'](_0x9068('0xc'),auth[_0x9068('0xa')](),controller[_0x9068('0x18')]);router[_0x9068('0x19')]('/:id/users',auth[_0x9068('0xa')](),controller[_0x9068('0x1a')]);router[_0x9068('0x19')](_0x9068('0x10'),auth[_0x9068('0xa')](),controller[_0x9068('0x1b')]);module[_0x9068('0x1c')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index e9077b8..8eabfe4 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 _0xa945=['getDataValue','INTEGER','sequelize','STRING','name','system-'];(function(_0x3abff3,_0x4200ba){var _0x562ae9=function(_0x59ba9b){while(--_0x59ba9b){_0x3abff3['push'](_0x3abff3['shift']());}};_0x562ae9(++_0x4200ba);}(_0xa945,0x1a6));var _0x5a94=function(_0x249f7e,_0x2fa170){_0x249f7e=_0x249f7e-0x0;var _0x31fd45=_0xa945[_0x249f7e];return _0x31fd45;};'use strict';var Sequelize=require(_0x5a94('0x0'));module['exports']={'name':{'type':Sequelize[_0x5a94('0x1')],'allowNull':![],'unique':_0x5a94('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x1a4347){return _0x5a94('0x3')+this[_0x5a94('0x4')](_0x5a94('0x2'))+'-';}},'description':{'type':Sequelize[_0x5a94('0x1')]},'callerIdAll':{'type':Sequelize[_0x5a94('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x5a94('0x5')]}}; \ No newline at end of file +var _0xff20=['sequelize','exports','getDataValue','STRING','INTEGER'];(function(_0x9e60c8,_0x19fa26){var _0x4dbeaf=function(_0x536cd9){while(--_0x536cd9){_0x9e60c8['push'](_0x9e60c8['shift']());}};_0x4dbeaf(++_0x19fa26);}(_0xff20,0x1b8));var _0x0ff2=function(_0x58ec33,_0x4cbab5){_0x58ec33=_0x58ec33-0x0;var _0x392112=_0xff20[_0x58ec33];return _0x392112;};'use strict';var Sequelize=require(_0x0ff2('0x0'));module[_0x0ff2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x1cac45){return'system-'+this[_0x0ff2('0x2')]('name')+'-';}},'description':{'type':Sequelize[_0x0ff2('0x3')]},'callerIdAll':{'type':Sequelize[_0x0ff2('0x3')]},'VoiceExtensionId':{'type':Sequelize[_0x0ff2('0x4')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 34d79f0..40097f6 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 _0x34b7=['fieldName','type','key','model','keys','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','rows','catch','fields','includeAll','find','params','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','system','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','spread','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','findOne','User','order','getTeams','Team','addTeams','findAll','Agents','online','voicePause','interface','flatMap','TeamVoicePrefix','upsert','each','findOrCreate','forEach','removeTeams','select','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','toString','SELECT','every','TeamId','all','compact','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','get','VoicePrefixes','UserProfileResource','destroy','error','stack','name','send','index','map','VoicePrefix','rawAttributes'];(function(_0x15b4fc,_0x2bbcf6){var _0x4d0f3b=function(_0x3c5da7){while(--_0x3c5da7){_0x15b4fc['push'](_0x15b4fc['shift']());}};_0x4d0f3b(++_0x2bbcf6);}(_0x34b7,0x196));var _0x734b=function(_0x204e08,_0x36ca59){_0x204e08=_0x204e08-0x0;var _0x4dd55e=_0x34b7[_0x204e08];return _0x4dd55e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x734b('0x0'));var jsonpatch=require(_0x734b('0x1'));var rp=require(_0x734b('0x2'));var moment=require(_0x734b('0x3'));var BPromise=require(_0x734b('0x4'));var Mustache=require(_0x734b('0x5'));var util=require('util');var path=require('path');var sox=require(_0x734b('0x6'));var csv=require(_0x734b('0x7'));var ejs=require(_0x734b('0x8'));var fs=require('fs');var fs_extra=require(_0x734b('0x9'));var _=require(_0x734b('0xa'));var squel=require(_0x734b('0xb'));var crypto=require('crypto');var jsforce=require(_0x734b('0xc'));var deskjs=require(_0x734b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x734b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x734b('0xf'));var as=require(_0x734b('0x10'));var hardwareService=require(_0x734b('0x11'));var logger=require(_0x734b('0x12'))(_0x734b('0x13'));var utils=require(_0x734b('0x14'));var config=require(_0x734b('0x15'));var licenseUtil=require(_0x734b('0x16'));var db=require(_0x734b('0x17'))['db'];config[_0x734b('0x18')]=_[_0x734b('0x19')](config[_0x734b('0x18')],{'host':_0x734b('0x1a'),'port':0x18eb});var socket=require(_0x734b('0x1b'))(new Redis(config['redis']));require(_0x734b('0x1c'))[_0x734b('0x1d')](socket);function respondWithStatusCode(_0x47791c,_0xd1ab2a){_0xd1ab2a=_0xd1ab2a||0xcc;return function(_0x19f427){if(_0x19f427){return _0x47791c[_0x734b('0x1e')](_0xd1ab2a);}return _0x47791c[_0x734b('0x1f')](_0xd1ab2a)[_0x734b('0x20')]();};}function respondWithResult(_0xa6d111,_0x4b8c63){_0x4b8c63=_0x4b8c63||0xc8;return function(_0x42407a){if(_0x42407a){return _0xa6d111['status'](_0x4b8c63)[_0x734b('0x21')](_0x42407a);}};}function respondWithFilteredResult(_0x2ee290,_0xfb661a){return function(_0x5edbe9){if(_0x5edbe9){var _0x4d3b9c=typeof _0xfb661a['offset']===_0x734b('0x22')&&typeof _0xfb661a[_0x734b('0x23')]===_0x734b('0x22');var _0x41ba87=_0x5edbe9[_0x734b('0x24')];var _0xfe567d=_0x4d3b9c?0x0:_0xfb661a[_0x734b('0x25')];var _0x6572ee=_0x4d3b9c?_0x5edbe9[_0x734b('0x24')]:_0xfb661a[_0x734b('0x25')]+_0xfb661a[_0x734b('0x23')];var _0x3d0ffd;if(_0x6572ee>=_0x41ba87){_0x6572ee=_0x41ba87;_0x3d0ffd=0xc8;}else{_0x3d0ffd=0xce;}_0x2ee290[_0x734b('0x1f')](_0x3d0ffd);return _0x2ee290[_0x734b('0x26')]('Content-Range',_0xfe567d+'-'+_0x6572ee+'/'+_0x41ba87)[_0x734b('0x21')](_0x5edbe9);}return null;};}function patchUpdates(_0x7856d7){return function(_0x4f98a7){try{jsonpatch[_0x734b('0x27')](_0x4f98a7,_0x7856d7,!![]);}catch(_0x1f81de){return BPromise[_0x734b('0x28')](_0x1f81de);}return _0x4f98a7[_0x734b('0x29')]();};}function saveUpdates(_0x46d432,_0x26d118){return function(_0x26eccf){if(_0x26eccf){return _0x26eccf[_0x734b('0x2a')](_0x46d432)[_0x734b('0x2b')](function(_0x3abbe6){return _0x3abbe6;});}return null;};}function removeEntity(_0x44ffa9,_0x148abe){return function(_0x3bb651){if(_0x3bb651){return _0x3bb651['destroy']()['then'](function(){var _0x13cc5a=_0x3bb651[_0x734b('0x2c')]({'plain':!![]});var _0x47a0a9=_0x734b('0x2d');return db[_0x734b('0x2e')][_0x734b('0x2f')]({'where':{'type':_0x47a0a9,'resourceId':_0x13cc5a['id']}})[_0x734b('0x2b')](function(){return _0x3bb651;});})[_0x734b('0x2b')](function(){_0x44ffa9[_0x734b('0x1f')](0xcc)[_0x734b('0x20')]();});}};}function handleEntityNotFound(_0x5c6c5d,_0x1f3652){return function(_0x436efe){if(!_0x436efe){_0x5c6c5d[_0x734b('0x1e')](0x194);}return _0x436efe;};}function handleError(_0x241c89,_0x729431){_0x729431=_0x729431||0x1f4;return function(_0x427c36){logger[_0x734b('0x30')](_0x427c36[_0x734b('0x31')]);if(_0x427c36[_0x734b('0x32')]){delete _0x427c36[_0x734b('0x32')];}_0x241c89['status'](_0x729431)[_0x734b('0x33')](_0x427c36);};}exports[_0x734b('0x34')]=function(_0x57f792,_0xbbe037){var _0x3cfce2={},_0xf4ef21={},_0x2fe7d5={'count':0x0,'rows':[]};var _0x21cb04=_[_0x734b('0x35')](db[_0x734b('0x36')][_0x734b('0x37')],function(_0x1e53fb){return{'name':_0x1e53fb[_0x734b('0x38')],'type':_0x1e53fb[_0x734b('0x39')][_0x734b('0x3a')]};});_0xf4ef21[_0x734b('0x3b')]=_[_0x734b('0x35')](_0x21cb04,_0x734b('0x32'));_0xf4ef21['query']=_[_0x734b('0x3c')](_0x57f792['query']);_0xf4ef21[_0x734b('0x3d')]=_[_0x734b('0x3e')](_0xf4ef21[_0x734b('0x3b')],_0xf4ef21[_0x734b('0x3f')]);_0x3cfce2[_0x734b('0x40')]=_[_0x734b('0x3e')](_0xf4ef21['model'],qs['fields'](_0x57f792[_0x734b('0x3f')]['fields']));_0x3cfce2[_0x734b('0x40')]=_0x3cfce2['attributes'][_0x734b('0x41')]?_0x3cfce2['attributes']:_0xf4ef21[_0x734b('0x3b')];if(!_0x57f792['query'][_0x734b('0x42')](_0x734b('0x43'))){_0x3cfce2[_0x734b('0x23')]=qs[_0x734b('0x23')](_0x57f792[_0x734b('0x3f')][_0x734b('0x23')]);_0x3cfce2[_0x734b('0x25')]=qs['offset'](_0x57f792[_0x734b('0x3f')][_0x734b('0x25')]);}_0x3cfce2['order']=qs[_0x734b('0x44')](_0x57f792[_0x734b('0x3f')][_0x734b('0x44')]);_0x3cfce2[_0x734b('0x45')]=qs['filters'](_[_0x734b('0x46')](_0x57f792[_0x734b('0x3f')],_0xf4ef21['filters']),_0x21cb04);if(_0x57f792[_0x734b('0x3f')][_0x734b('0x47')]){_0x3cfce2['where']=_[_0x734b('0x48')](_0x3cfce2[_0x734b('0x45')],{'$or':_[_0x734b('0x35')](_0x21cb04,function(_0x300aaa){if(_0x300aaa['type']!=='VIRTUAL'){var _0x2f6cee={};_0x2f6cee[_0x300aaa['name']]={'$like':'%'+_0x57f792['query'][_0x734b('0x47')]+'%'};return _0x2f6cee;}})});}_0x3cfce2=_['merge']({},_0x3cfce2,_0x57f792[_0x734b('0x49')]);var _0x4d77f0={'where':_0x3cfce2[_0x734b('0x45')]};return db[_0x734b('0x36')][_0x734b('0x24')](_0x4d77f0)['then'](function(_0x5cf3a0){_0x2fe7d5[_0x734b('0x24')]=_0x5cf3a0;if(_0x57f792['query']['includeAll']){_0x3cfce2[_0x734b('0x4a')]=[{'all':!![]}];}return db[_0x734b('0x36')]['findAll'](_0x3cfce2);})[_0x734b('0x2b')](function(_0x513f07){_0x2fe7d5[_0x734b('0x4b')]=_0x513f07;return _0x2fe7d5;})[_0x734b('0x2b')](respondWithFilteredResult(_0xbbe037,_0x3cfce2))[_0x734b('0x4c')](handleError(_0xbbe037,null));};exports['show']=function(_0xe8b116,_0x2455b9){var _0x3bca7e={'raw':![],'where':{'id':_0xe8b116['params']['id']}},_0x439139={};_0x439139['model']=_['keys'](db[_0x734b('0x36')]['rawAttributes']);_0x439139['query']=_[_0x734b('0x3c')](_0xe8b116['query']);_0x439139[_0x734b('0x3d')]=_[_0x734b('0x3e')](_0x439139[_0x734b('0x3b')],_0x439139[_0x734b('0x3f')]);_0x3bca7e['attributes']=_[_0x734b('0x3e')](_0x439139['model'],qs[_0x734b('0x4d')](_0xe8b116[_0x734b('0x3f')][_0x734b('0x4d')]));_0x3bca7e['attributes']=_0x3bca7e[_0x734b('0x40')]['length']?_0x3bca7e[_0x734b('0x40')]:_0x439139[_0x734b('0x3b')];if(_0xe8b116['query'][_0x734b('0x4e')]){_0x3bca7e[_0x734b('0x4a')]=[{'all':!![]}];}_0x3bca7e=_[_0x734b('0x48')]({},_0x3bca7e,_0xe8b116[_0x734b('0x49')]);return db[_0x734b('0x36')]['find'](_0x3bca7e)[_0x734b('0x2b')](handleEntityNotFound(_0x2455b9,null))['then'](respondWithResult(_0x2455b9,null))[_0x734b('0x4c')](handleError(_0x2455b9,null));};exports['destroy']=function(_0xd3c688,_0xa2fd9d){return db[_0x734b('0x36')][_0x734b('0x4f')]({'where':{'id':_0xd3c688[_0x734b('0x50')]['id']}})['then'](handleEntityNotFound(_0xa2fd9d,null))['then'](removeEntity(_0xa2fd9d,null))['catch'](handleError(_0xa2fd9d,null));};exports[_0x734b('0x51')]=function(_0x1901a8,_0x541991){return db[_0x734b('0x36')][_0x734b('0x51')]()['then'](respondWithResult(_0x541991,null))[_0x734b('0x4c')](handleError(_0x541991,null));};exports[_0x734b('0x52')]=function(_0x44e6d2,_0x4d6501){var _0x2e95aa;return db[_0x734b('0x53')][_0x734b('0x54')](function(_0xe605be){return db['VoicePrefix'][_0x734b('0x52')](_0x44e6d2[_0x734b('0x55')],{'transaction':_0xe605be})[_0x734b('0x2b')](function(_0x432a96){_0x2e95aa=_0x432a96['get']({'plain':!![]});return db[_0x734b('0x56')]['find']({'where':{'id':_0x2e95aa[_0x734b('0x57')]},'raw':!![]})[_0x734b('0x2b')](function(_0x1f3594){return createVoicePrefixExtensions(_0x2e95aa,_0x1f3594,_0xe605be);});});})[_0x734b('0x2b')](function(){var _0x58d665=_0x44e6d2[_0x734b('0x58')][_0x734b('0x2c')]({'plain':!![]});if(!_0x58d665)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58d665['role']===_0x734b('0x58')){var _0x577735=_0x2e95aa;return db[_0x734b('0x59')][_0x734b('0x4f')]({'where':{'name':_0x734b('0x2d'),'userProfileId':_0x58d665['userProfileId']},'raw':!![]})[_0x734b('0x2b')](function(_0x588cd8){if(_0x588cd8&&_0x588cd8[_0x734b('0x5a')]===0x0){return db[_0x734b('0x2e')][_0x734b('0x52')]({'name':_0x577735[_0x734b('0x32')],'resourceId':_0x577735['id'],'type':_0x588cd8['name'],'sectionId':_0x588cd8['id']},{})[_0x734b('0x2b')](function(){return _0x2e95aa;});}else{return _0x2e95aa;}})['catch'](function(_0x6b198c){logger[_0x734b('0x30')](_0x734b('0x5b'),_0x6b198c);throw _0x6b198c;});}return _0x2e95aa;})['then'](respondWithResult(_0x4d6501,null))[_0x734b('0x4c')](handleError(_0x4d6501,null));};function Extension(_0x55c699,_0x2c81a1,_0x17a217,_0x3ec705){this[_0x734b('0x5c')]='from-sip';this[_0x734b('0x5d')]=_0x55c699;this['app']=_0x17a217;this[_0x734b('0x39')]=_0x734b('0x5e');this[_0x734b('0x5f')]='Voice\x20Prefix\x20Extension';this[_0x734b('0x60')]=_0x2c81a1;this[_0x734b('0x61')]=_0x3ec705;}function createVoicePrefixExtensions(_0x366379,_0x3b16bb,_0x228f85){return new BPromise(function(_0x262244,_0x164c81){var _0x506407=new Extension(formatPrefixName(_0x366379[_0x734b('0x62')]),0x1,_0x734b('0x63'),_0x734b('0x64'));_0x506407['VoicePrefixId']=_0x366379['id'];return db['VoiceExtension'][_0x734b('0x52')](_0x506407,{'transaction':_0x228f85})[_0x734b('0x2b')](function(_0x391c04){var _0x1eec8e=_0x391c04['get']({'plain':!![]});var _0x565a2e=_['map'](addVoicePrefixExtensions(_0x366379,_0x3b16bb),function(_0x1bd023){_0x1bd023[_0x734b('0x57')]=_0x1eec8e['id'];_0x1bd023[_0x734b('0x65')]=_0x366379['id'];return _0x1bd023;});return db[_0x734b('0x56')][_0x734b('0x66')](_0x565a2e,{'transaction':_0x228f85})[_0x734b('0x2b')](function(_0x113931){if(!_0x113931){return _0x164c81(_0x734b('0x67'));}else{return _0x262244(_0x113931);}})[_0x734b('0x4c')](function(_0x459788){return _0x164c81(_0x459788);});});;});};function addVoicePrefixExtensions(_0xc5a114,_0x69b605){var _0x43951a=[];var _0x467b1=formatPrefixName(_0xc5a114[_0x734b('0x62')]);_0x43951a[_0x734b('0x68')](new Extension(_0x467b1,0x2,_0x734b('0x69'),_0x734b('0x6a')+_0xc5a114[_0x734b('0x32')]));if(_0xc5a114[_0x734b('0x6b')]){_0x43951a[_0x734b('0x68')](new Extension(_0x467b1,0x3,'Set',_0x734b('0x6c')+_0xc5a114[_0x734b('0x6b')]));}else{_0x43951a[_0x734b('0x68')](new Extension(_0x467b1,0x3,_0x734b('0x63'),_0x734b('0x6d')));}_0x43951a['push'](new Extension(_0x467b1,0x4,_0x734b('0x6e'),_0x69b605[_0x734b('0x5c')]+','+_0x734b('0x6f')+(0x8+_0xc5a114[_0x734b('0x32')][_0x734b('0x41')])+'}'+','+0x1));return _0x43951a;}function formatPrefixName(_0x5d785d){var _0x594df0='_';for(var _0x479ee2=0x0;_0x479ee2<_0x5d785d['length'];_0x479ee2++){if(_0x5d785d['charAt'](_0x479ee2)=='-'){_0x594df0+=_0x5d785d['charAt'](_0x479ee2);}else{_0x594df0+='['+_0x5d785d[_0x734b('0x70')](_0x479ee2)+']';}}_0x594df0+='.';return _0x594df0;}exports[_0x734b('0x2a')]=function(_0x16c9d2,_0xb23b61,_0x496070){var _0x4f79a9=_0x16c9d2[_0x734b('0x55')];_0x4f79a9[_0x734b('0x62')]=_0x734b('0x71')+_0x4f79a9[_0x734b('0x32')]+'-';return db['sequelize'][_0x734b('0x54')](function(_0x24ab5c){return db[_0x734b('0x36')][_0x734b('0x2a')](_0x4f79a9,{'where':{'id':_0x4f79a9['id']},'transaction':_0x24ab5c})['then'](function(){return db[_0x734b('0x56')]['destroy']({'where':{'VoicePrefixId':_0x4f79a9['id']},'transaction':_0x24ab5c})[_0x734b('0x2b')](function(){return db[_0x734b('0x56')][_0x734b('0x4f')]({'where':{'id':_0x4f79a9[_0x734b('0x57')]},'raw':!![]})[_0x734b('0x2b')](function(_0x4e43c3){return createVoicePrefixExtensions(_0x4f79a9,_0x4e43c3,_0x24ab5c);});});});})[_0x734b('0x2b')](function(){return db[_0x734b('0x36')][_0x734b('0x72')](_0x4f79a9['id']);})[_0x734b('0x2b')](respondWithResult(_0xb23b61,null))[_0x734b('0x4c')](handleError(_0xb23b61,null));};exports['addAgents']=function(_0x475ecd,_0x2dcb30,_0x1316ae){return db[_0x734b('0x36')]['find']({'where':{'id':_0x475ecd[_0x734b('0x50')]['id']}})[_0x734b('0x2b')](handleEntityNotFound(_0x2dcb30,null))[_0x734b('0x2b')](function(_0x407006){if(_0x407006){return _0x407006[_0x734b('0x73')](_0x475ecd['body'][_0x734b('0x74')],_['omit'](_0x475ecd[_0x734b('0x55')],[_0x734b('0x74'),'id'])||{})[_0x734b('0x75')](function(_0x27fd22){for(var _0x4624c7=0x0;_0x4624c7<_0x475ecd[_0x734b('0x55')]['ids']['length'];_0x4624c7+=0x1){socket['emit'](_0x734b('0x76'),{'UserId':Number(_0x475ecd['body'][_0x734b('0x74')][_0x4624c7]),'VoicePrefixId':Number(_0x475ecd[_0x734b('0x50')]['id'])});}return _0x27fd22;});}})['then'](respondWithResult(_0x2dcb30,null))[_0x734b('0x4c')](handleError(_0x2dcb30,null));};exports[_0x734b('0x77')]=function(_0x17749f,_0x2a3c8d,_0x1d0bfb){return db[_0x734b('0x36')][_0x734b('0x4f')]({'where':{'id':_0x17749f[_0x734b('0x50')]['id']}})[_0x734b('0x2b')](handleEntityNotFound(_0x2a3c8d,null))[_0x734b('0x2b')](function(_0x5de89a){if(_0x5de89a){return _0x5de89a[_0x734b('0x77')](_0x17749f[_0x734b('0x3f')][_0x734b('0x74')])['then'](function(){if(_[_0x734b('0x78')](_0x17749f[_0x734b('0x3f')][_0x734b('0x74')])){for(var _0x13f1fd=0x0;_0x13f1fd<_0x17749f[_0x734b('0x3f')][_0x734b('0x74')][_0x734b('0x41')];_0x13f1fd+=0x1){socket[_0x734b('0x79')]('userVoicePrefix:remove',{'UserId':Number(_0x17749f[_0x734b('0x3f')][_0x734b('0x74')][_0x13f1fd]),'VoicePrefixId':Number(_0x17749f[_0x734b('0x50')]['id'])});}}else{socket[_0x734b('0x79')](_0x734b('0x7a'),{'UserId':Number(_0x17749f[_0x734b('0x3f')][_0x734b('0x74')]),'VoicePrefixId':Number(_0x17749f[_0x734b('0x50')]['id'])});}});}})[_0x734b('0x2b')](respondWithStatusCode(_0x2a3c8d,null))['catch'](handleError(_0x2a3c8d,null));};exports[_0x734b('0x7b')]=function(_0x13f4e8,_0x41eca7,_0x500ebf){var _0x31e1ec={};var _0x2fde66={};var _0x24fb9d;var _0x3f3511;return db[_0x734b('0x36')][_0x734b('0x7c')]({'where':{'id':_0x13f4e8['params']['id']}})[_0x734b('0x2b')](handleEntityNotFound(_0x41eca7,null))['then'](function(_0x504a7f){if(_0x504a7f){_0x24fb9d=_0x504a7f;_0x2fde66['model']=_['keys'](db[_0x734b('0x7d')][_0x734b('0x37')]);_0x2fde66[_0x734b('0x3f')]=_[_0x734b('0x3c')](_0x13f4e8['query']);_0x2fde66['filters']=_[_0x734b('0x3e')](_0x2fde66['model'],_0x2fde66[_0x734b('0x3f')]);_0x31e1ec[_0x734b('0x40')]=_['intersection'](_0x2fde66[_0x734b('0x3b')],qs['fields'](_0x13f4e8['query']['fields']));_0x31e1ec[_0x734b('0x40')]=_0x31e1ec[_0x734b('0x40')][_0x734b('0x41')]?_0x31e1ec[_0x734b('0x40')]:_0x2fde66['model'];_0x31e1ec[_0x734b('0x7e')]=qs[_0x734b('0x44')](_0x13f4e8['query'][_0x734b('0x44')]);_0x31e1ec[_0x734b('0x45')]=qs['filters'](_[_0x734b('0x46')](_0x13f4e8['query'],_0x2fde66[_0x734b('0x3d')]));if(_0x13f4e8[_0x734b('0x3f')][_0x734b('0x47')]){_0x31e1ec[_0x734b('0x45')]=_[_0x734b('0x48')](_0x31e1ec[_0x734b('0x45')],{'$or':_[_0x734b('0x35')](_0x31e1ec['attributes'],function(_0x5be5f2){var _0x57f20a={};_0x57f20a[_0x5be5f2]={'$like':'%'+_0x13f4e8[_0x734b('0x3f')][_0x734b('0x47')]+'%'};return _0x57f20a;})});}_0x31e1ec=_['merge']({},_0x31e1ec,_0x13f4e8[_0x734b('0x49')]);return _0x24fb9d[_0x734b('0x7b')](_0x31e1ec);}})[_0x734b('0x2b')](function(_0x48b0e1){if(_0x48b0e1){_0x3f3511=_0x48b0e1[_0x734b('0x41')];if(!_0x13f4e8[_0x734b('0x3f')][_0x734b('0x42')]('nolimit')){_0x31e1ec[_0x734b('0x23')]=qs[_0x734b('0x23')](_0x13f4e8[_0x734b('0x3f')]['limit']);_0x31e1ec['offset']=qs['offset'](_0x13f4e8[_0x734b('0x3f')]['offset']);}return _0x24fb9d[_0x734b('0x7b')](_0x31e1ec);}})[_0x734b('0x2b')](function(_0x2a5aa9){if(_0x2a5aa9){return _0x2a5aa9?{'count':_0x3f3511,'rows':_0x2a5aa9}:null;}})['then'](respondWithResult(_0x41eca7,null))['catch'](handleError(_0x41eca7,null));};exports[_0x734b('0x7f')]=function(_0xa9bb2a,_0x4f3a90,_0x72d3ad){var _0x548206={};var _0x4a809a={};var _0x52890d;var _0xbb8121;return db[_0x734b('0x36')][_0x734b('0x7c')]({'where':{'id':_0xa9bb2a[_0x734b('0x50')]['id']}})[_0x734b('0x2b')](handleEntityNotFound(_0x4f3a90,null))[_0x734b('0x2b')](function(_0x18cb9){if(_0x18cb9){_0x52890d=_0x18cb9;_0x4a809a['model']=_[_0x734b('0x3c')](db[_0x734b('0x80')][_0x734b('0x37')]);_0x4a809a[_0x734b('0x3f')]=_['keys'](_0xa9bb2a['query']);_0x4a809a['filters']=_[_0x734b('0x3e')](_0x4a809a[_0x734b('0x3b')],_0x4a809a[_0x734b('0x3f')]);_0x548206[_0x734b('0x40')]=_[_0x734b('0x3e')](_0x4a809a[_0x734b('0x3b')],qs[_0x734b('0x4d')](_0xa9bb2a[_0x734b('0x3f')][_0x734b('0x4d')]));_0x548206[_0x734b('0x40')]=_0x548206[_0x734b('0x40')][_0x734b('0x41')]?_0x548206[_0x734b('0x40')]:_0x4a809a['model'];_0x548206['order']=qs[_0x734b('0x44')](_0xa9bb2a[_0x734b('0x3f')][_0x734b('0x44')]);_0x548206['where']=qs[_0x734b('0x3d')](_[_0x734b('0x46')](_0xa9bb2a[_0x734b('0x3f')],_0x4a809a[_0x734b('0x3d')]));if(_0xa9bb2a[_0x734b('0x3f')][_0x734b('0x47')]){_0x548206[_0x734b('0x45')]=_[_0x734b('0x48')](_0x548206[_0x734b('0x45')],{'$or':_[_0x734b('0x35')](_0x548206[_0x734b('0x40')],function(_0x30dff6){var _0x5ac65f={};_0x5ac65f[_0x30dff6]={'$like':'%'+_0xa9bb2a[_0x734b('0x3f')]['filter']+'%'};return _0x5ac65f;})});}_0x548206=_[_0x734b('0x48')]({},_0x548206,_0xa9bb2a[_0x734b('0x49')]);return _0x52890d[_0x734b('0x7f')](_0x548206);}})[_0x734b('0x2b')](function(_0x1bedc4){if(_0x1bedc4){_0xbb8121=_0x1bedc4['length'];if(!_0xa9bb2a[_0x734b('0x3f')][_0x734b('0x42')]('nolimit')){_0x548206[_0x734b('0x23')]=qs[_0x734b('0x23')](_0xa9bb2a[_0x734b('0x3f')][_0x734b('0x23')]);_0x548206['offset']=qs['offset'](_0xa9bb2a[_0x734b('0x3f')][_0x734b('0x25')]);}return _0x52890d['getTeams'](_0x548206);}})[_0x734b('0x2b')](function(_0x19a54a){if(_0x19a54a){return _0x19a54a?{'count':_0xbb8121,'rows':_0x19a54a}:null;}})[_0x734b('0x2b')](respondWithResult(_0x4f3a90,null))[_0x734b('0x4c')](handleError(_0x4f3a90,null));};exports[_0x734b('0x81')]=function(_0x4e46a2,_0x5d0a69,_0x303257){var _0x1bac04=_0x4e46a2[_0x734b('0x55')]['ids'];var _0x200182;return db[_0x734b('0x80')][_0x734b('0x82')]({'where':{'id':_0x1bac04},'attributes':['id'],'include':[{'model':db[_0x734b('0x7d')],'as':_0x734b('0x83'),'attributes':['id',_0x734b('0x32'),_0x734b('0x84'),_0x734b('0x85'),_0x734b('0x86')],'raw':!![]}]})[_0x734b('0x2b')](function(_0x48fbb3){if(_0x48fbb3){_0x200182=_0x48fbb3;var _0x564dda=_[_0x734b('0x87')](_0x48fbb3,function(_0x26af1f){var _0x1ba633=_0x26af1f[_0x734b('0x2c')]({'plain':!![]});return _0x1ba633[_0x734b('0x83')];});return db[_0x734b('0x36')][_0x734b('0x4f')]({'where':{'id':_0x4e46a2[_0x734b('0x50')]['id']}})[_0x734b('0x2b')](function(_0xc74aeb){return db[_0x734b('0x53')]['transaction'](function(_0x288109){return _0xc74aeb[_0x734b('0x81')](_0x1bac04,{'transaction':_0x288109})['then'](function(){return BPromise['each'](_0x200182,function(_0x255fca){return db[_0x734b('0x88')][_0x734b('0x89')]({'TeamId':_0x255fca['id'],'VoicePrefixId':_0x4e46a2[_0x734b('0x50')]['id']},{'transaction':_0x288109});});})['then'](function(){return BPromise[_0x734b('0x8a')](_0x564dda,function(_0x1c9a1e){return db['UserVoicePrefix'][_0x734b('0x8b')]({'where':{'UserId':_0x1c9a1e['id'],'VoicePrefixId':_0x4e46a2[_0x734b('0x50')]['id']},'transaction':_0x288109});});})[_0x734b('0x2b')](function(){_0x564dda[_0x734b('0x8c')](function(_0x189e6d){socket[_0x734b('0x79')](_0x734b('0x76'),{'UserId':_0x189e6d['id'],'VoicePrefixId':_0xc74aeb['id']});});});});});}})[_0x734b('0x2b')](respondWithStatusCode(_0x5d0a69,null))['catch'](handleError(_0x5d0a69,null));};exports[_0x734b('0x8d')]=function(_0x31468d,_0x45a160,_0x16451a){return db[_0x734b('0x80')]['findAll']({'where':{'id':_0x31468d['query'][_0x734b('0x74')]},'attributes':['id'],'include':[{'model':db[_0x734b('0x7d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x734b('0x2b')](handleEntityNotFound(_0x45a160,null))['then'](function(_0x19cf27){var _0x1237cf=_[_0x734b('0x35')](_0x19cf27,'id');var _0x42038a=[];var _0x3e61f1=[];var _0x22e919=squel[_0x734b('0x8e')]();_0x22e919['field']('tq.TeamId')[_0x734b('0x8f')](_0x734b('0x90'),'tq')[_0x734b('0x91')]('user_has_teams','ut',_0x734b('0x92'))[_0x734b('0x45')](_0x734b('0x93'),_0x31468d['params']['id']);for(var _0x1fcc17=0x0;_0x1fcc17<_0x19cf27[_0x734b('0x41')];_0x1fcc17+=0x1){let _0x39a46e=_0x19cf27[_0x1fcc17];for(var _0x2a8f17=0x0;_0x2a8f17<_0x39a46e['Agents']['length'];_0x2a8f17+=0x1){let _0x9cfb2f=_0x39a46e[_0x734b('0x83')][_0x2a8f17];var _0x326783=_0x22e919['clone']();_0x326783[_0x734b('0x45')]('ut.UserId\x20=\x20?',_0x9cfb2f['id']);_0x3e61f1[_0x734b('0x68')](db[_0x734b('0x53')][_0x734b('0x3f')](_0x326783[_0x734b('0x94')](),{'type':db[_0x734b('0x53')]['QueryTypes'][_0x734b('0x95')]})[_0x734b('0x2b')](function(_0x5ddf23){if(_0x5ddf23['length']===0x1){return _0x9cfb2f['id'];}else{var _0x967ccc=_[_0x734b('0x96')](_['map'](_0x5ddf23,_0x734b('0x97')),function(_0x23be49){return _['includes'](_0x1237cf,_0x23be49);});if(_0x967ccc){return _0x9cfb2f['id'];}}}));}}return BPromise[_0x734b('0x98')](_0x3e61f1)['then'](function(_0x4d75bc){_0x42038a=_(_0x42038a)['union'](_0x4d75bc)[_0x734b('0x99')]()['value']();return db[_0x734b('0x36')]['find']({'where':{'id':_0x31468d[_0x734b('0x50')]['id']}})['then'](function(_0xf43253){return db[_0x734b('0x53')][_0x734b('0x54')](function(_0x483d0a){return _0xf43253[_0x734b('0x8d')](_0x31468d[_0x734b('0x3f')]['ids'],{'transaction':_0x483d0a})[_0x734b('0x2b')](function(){if(!_['isEmpty'](_0x42038a)){return _0xf43253[_0x734b('0x77')](_0x42038a,{'transaction':_0x483d0a});}})[_0x734b('0x2b')](function(){_0x42038a['forEach'](function(_0x1f00b3){socket[_0x734b('0x79')](_0x734b('0x7a'),{'UserId':_0x1f00b3,'VoicePrefixId':_0xf43253['id']});});});});});});})[_0x734b('0x2b')](respondWithStatusCode(_0x45a160,null))['catch'](handleError(_0x45a160,null));}; \ No newline at end of file +var _0xf4f4=['role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','goto','context','charAt','system-','addAgents','ids','spread','emit','userVoicePrefix:save','isArray','userVoicePrefix:remove','getAgents','User','order','findOne','Team','getTeams','addTeams','findAll','Agents','online','voicePause','interface','each','upsert','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','includes','all','union','compact','value','removeAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','get','VoicePrefixes','destroy','error','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','show','params','keys','includeAll','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x456392,_0x2446d1){var _0x42983f=function(_0x13cae6){while(--_0x13cae6){_0x456392['push'](_0x456392['shift']());}};_0x42983f(++_0x2446d1);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x5aa1e2,_0x2b5adb){_0x5aa1e2=_0x5aa1e2-0x0;var _0x399098=_0xf4f4[_0x5aa1e2];return _0x399098;};'use strict';var emlformat=require(_0x4f4f('0x0'));var rimraf=require(_0x4f4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f4f('0x2'));var rp=require(_0x4f4f('0x3'));var moment=require(_0x4f4f('0x4'));var BPromise=require(_0x4f4f('0x5'));var Mustache=require(_0x4f4f('0x6'));var util=require('util');var path=require(_0x4f4f('0x7'));var sox=require('sox');var csv=require(_0x4f4f('0x8'));var ejs=require(_0x4f4f('0x9'));var fs=require('fs');var fs_extra=require(_0x4f4f('0xa'));var _=require(_0x4f4f('0xb'));var squel=require(_0x4f4f('0xc'));var crypto=require(_0x4f4f('0xd'));var jsforce=require(_0x4f4f('0xe'));var deskjs=require(_0x4f4f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4f4f('0x10'));var Papa=require(_0x4f4f('0x11'));var Redis=require(_0x4f4f('0x12'));var authService=require(_0x4f4f('0x13'));var qs=require(_0x4f4f('0x14'));var as=require(_0x4f4f('0x15'));var hardwareService=require(_0x4f4f('0x16'));var logger=require(_0x4f4f('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x4f4f('0x18'));var licenseUtil=require(_0x4f4f('0x19'));var db=require(_0x4f4f('0x1a'))['db'];config[_0x4f4f('0x1b')]=_[_0x4f4f('0x1c')](config[_0x4f4f('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x4f4f('0x1d'))(new Redis(config['redis']));require(_0x4f4f('0x1e'))[_0x4f4f('0x1f')](socket);function respondWithStatusCode(_0x3e16e9,_0x38535d){_0x38535d=_0x38535d||0xcc;return function(_0x4c849f){if(_0x4c849f){return _0x3e16e9[_0x4f4f('0x20')](_0x38535d);}return _0x3e16e9['status'](_0x38535d)['end']();};}function respondWithResult(_0x58de77,_0x422894){_0x422894=_0x422894||0xc8;return function(_0x8d65a2){if(_0x8d65a2){return _0x58de77[_0x4f4f('0x21')](_0x422894)[_0x4f4f('0x22')](_0x8d65a2);}};}function respondWithFilteredResult(_0x2d5e5d,_0x1777eb){return function(_0x1245c4){if(_0x1245c4){var _0x60ce2=typeof _0x1777eb[_0x4f4f('0x23')]===_0x4f4f('0x24')&&typeof _0x1777eb[_0x4f4f('0x25')]===_0x4f4f('0x24');var _0x499277=_0x1245c4[_0x4f4f('0x26')];var _0x4622c2=_0x60ce2?0x0:_0x1777eb[_0x4f4f('0x23')];var _0x201c60=_0x60ce2?_0x1245c4[_0x4f4f('0x26')]:_0x1777eb[_0x4f4f('0x23')]+_0x1777eb[_0x4f4f('0x25')];var _0x3e33d5;if(_0x201c60>=_0x499277){_0x201c60=_0x499277;_0x3e33d5=0xc8;}else{_0x3e33d5=0xce;}_0x2d5e5d[_0x4f4f('0x21')](_0x3e33d5);return _0x2d5e5d[_0x4f4f('0x27')](_0x4f4f('0x28'),_0x4622c2+'-'+_0x201c60+'/'+_0x499277)[_0x4f4f('0x22')](_0x1245c4);}return null;};}function patchUpdates(_0x17984d){return function(_0xc78135){try{jsonpatch['apply'](_0xc78135,_0x17984d,!![]);}catch(_0x4f7261){return BPromise['reject'](_0x4f7261);}return _0xc78135[_0x4f4f('0x29')]();};}function saveUpdates(_0x43e661,_0x5186ac){return function(_0x3960ae){if(_0x3960ae){return _0x3960ae[_0x4f4f('0x2a')](_0x43e661)[_0x4f4f('0x2b')](function(_0x2ec92a){return _0x2ec92a;});}return null;};}function removeEntity(_0x113ff7,_0x31b30e){return function(_0xa6371b){if(_0xa6371b){return _0xa6371b['destroy']()[_0x4f4f('0x2b')](function(){var _0x237cf9=_0xa6371b[_0x4f4f('0x2c')]({'plain':!![]});var _0x15c79c=_0x4f4f('0x2d');return db['UserProfileResource'][_0x4f4f('0x2e')]({'where':{'type':_0x15c79c,'resourceId':_0x237cf9['id']}})[_0x4f4f('0x2b')](function(){return _0xa6371b;});})[_0x4f4f('0x2b')](function(){_0x113ff7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c2490,_0x73b8bb){return function(_0x5b4f6a){if(!_0x5b4f6a){_0x4c2490[_0x4f4f('0x20')](0x194);}return _0x5b4f6a;};}function handleError(_0x39c1a8,_0x2e688a){_0x2e688a=_0x2e688a||0x1f4;return function(_0x5eb7c9){logger[_0x4f4f('0x2f')](_0x5eb7c9[_0x4f4f('0x30')]);if(_0x5eb7c9['name']){delete _0x5eb7c9[_0x4f4f('0x31')];}_0x39c1a8[_0x4f4f('0x21')](_0x2e688a)[_0x4f4f('0x32')](_0x5eb7c9);};}exports['index']=function(_0x6bdf15,_0x343c75){var _0x59bdb0={},_0x5517d7={},_0x465a36={'count':0x0,'rows':[]};var _0x305bf7=_[_0x4f4f('0x33')](db[_0x4f4f('0x34')][_0x4f4f('0x35')],function(_0x8d0f53){return{'name':_0x8d0f53[_0x4f4f('0x36')],'type':_0x8d0f53[_0x4f4f('0x37')][_0x4f4f('0x38')]};});_0x5517d7[_0x4f4f('0x39')]=_['map'](_0x305bf7,'name');_0x5517d7[_0x4f4f('0x3a')]=_['keys'](_0x6bdf15[_0x4f4f('0x3a')]);_0x5517d7[_0x4f4f('0x3b')]=_[_0x4f4f('0x3c')](_0x5517d7[_0x4f4f('0x39')],_0x5517d7[_0x4f4f('0x3a')]);_0x59bdb0[_0x4f4f('0x3d')]=_[_0x4f4f('0x3c')](_0x5517d7[_0x4f4f('0x39')],qs[_0x4f4f('0x3e')](_0x6bdf15[_0x4f4f('0x3a')][_0x4f4f('0x3e')]));_0x59bdb0[_0x4f4f('0x3d')]=_0x59bdb0['attributes'][_0x4f4f('0x3f')]?_0x59bdb0[_0x4f4f('0x3d')]:_0x5517d7[_0x4f4f('0x39')];if(!_0x6bdf15[_0x4f4f('0x3a')][_0x4f4f('0x40')](_0x4f4f('0x41'))){_0x59bdb0[_0x4f4f('0x25')]=qs[_0x4f4f('0x25')](_0x6bdf15[_0x4f4f('0x3a')]['limit']);_0x59bdb0[_0x4f4f('0x23')]=qs[_0x4f4f('0x23')](_0x6bdf15[_0x4f4f('0x3a')]['offset']);}_0x59bdb0['order']=qs[_0x4f4f('0x42')](_0x6bdf15[_0x4f4f('0x3a')][_0x4f4f('0x42')]);_0x59bdb0[_0x4f4f('0x43')]=qs[_0x4f4f('0x3b')](_[_0x4f4f('0x44')](_0x6bdf15[_0x4f4f('0x3a')],_0x5517d7[_0x4f4f('0x3b')]),_0x305bf7);if(_0x6bdf15[_0x4f4f('0x3a')][_0x4f4f('0x45')]){_0x59bdb0[_0x4f4f('0x43')]=_[_0x4f4f('0x46')](_0x59bdb0['where'],{'$or':_[_0x4f4f('0x33')](_0x305bf7,function(_0x1b031e){if(_0x1b031e[_0x4f4f('0x37')]!==_0x4f4f('0x47')){var _0x18e805={};_0x18e805[_0x1b031e['name']]={'$like':'%'+_0x6bdf15['query'][_0x4f4f('0x45')]+'%'};return _0x18e805;}})});}_0x59bdb0=_[_0x4f4f('0x46')]({},_0x59bdb0,_0x6bdf15[_0x4f4f('0x48')]);var _0xa8f1a5={'where':_0x59bdb0['where']};return db[_0x4f4f('0x34')]['count'](_0xa8f1a5)[_0x4f4f('0x2b')](function(_0x5a7c94){_0x465a36['count']=_0x5a7c94;if(_0x6bdf15[_0x4f4f('0x3a')]['includeAll']){_0x59bdb0[_0x4f4f('0x49')]=[{'all':!![]}];}return db[_0x4f4f('0x34')]['findAll'](_0x59bdb0);})[_0x4f4f('0x2b')](function(_0x2d8ff6){_0x465a36['rows']=_0x2d8ff6;return _0x465a36;})[_0x4f4f('0x2b')](respondWithFilteredResult(_0x343c75,_0x59bdb0))[_0x4f4f('0x4a')](handleError(_0x343c75,null));};exports[_0x4f4f('0x4b')]=function(_0x3defd0,_0x162674){var _0x62b468={'raw':![],'where':{'id':_0x3defd0[_0x4f4f('0x4c')]['id']}},_0xb0d1b2={};_0xb0d1b2[_0x4f4f('0x39')]=_[_0x4f4f('0x4d')](db[_0x4f4f('0x34')][_0x4f4f('0x35')]);_0xb0d1b2[_0x4f4f('0x3a')]=_[_0x4f4f('0x4d')](_0x3defd0[_0x4f4f('0x3a')]);_0xb0d1b2['filters']=_[_0x4f4f('0x3c')](_0xb0d1b2['model'],_0xb0d1b2['query']);_0x62b468[_0x4f4f('0x3d')]=_[_0x4f4f('0x3c')](_0xb0d1b2['model'],qs[_0x4f4f('0x3e')](_0x3defd0[_0x4f4f('0x3a')][_0x4f4f('0x3e')]));_0x62b468[_0x4f4f('0x3d')]=_0x62b468[_0x4f4f('0x3d')]['length']?_0x62b468[_0x4f4f('0x3d')]:_0xb0d1b2[_0x4f4f('0x39')];if(_0x3defd0[_0x4f4f('0x3a')][_0x4f4f('0x4e')]){_0x62b468[_0x4f4f('0x49')]=[{'all':!![]}];}_0x62b468=_[_0x4f4f('0x46')]({},_0x62b468,_0x3defd0[_0x4f4f('0x48')]);return db[_0x4f4f('0x34')][_0x4f4f('0x4f')](_0x62b468)['then'](handleEntityNotFound(_0x162674,null))[_0x4f4f('0x2b')](respondWithResult(_0x162674,null))[_0x4f4f('0x4a')](handleError(_0x162674,null));};exports['destroy']=function(_0x5ac4df,_0x5941ac){return db[_0x4f4f('0x34')][_0x4f4f('0x4f')]({'where':{'id':_0x5ac4df[_0x4f4f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5941ac,null))[_0x4f4f('0x2b')](removeEntity(_0x5941ac,null))['catch'](handleError(_0x5941ac,null));};exports[_0x4f4f('0x50')]=function(_0x1c181e,_0x3c0d7b){return db[_0x4f4f('0x34')][_0x4f4f('0x50')]()[_0x4f4f('0x2b')](respondWithResult(_0x3c0d7b,null))[_0x4f4f('0x4a')](handleError(_0x3c0d7b,null));};exports[_0x4f4f('0x51')]=function(_0x17f6fb,_0x4dbce2){var _0x59e207;return db[_0x4f4f('0x52')][_0x4f4f('0x53')](function(_0x4c04eb){return db['VoicePrefix'][_0x4f4f('0x51')](_0x17f6fb[_0x4f4f('0x54')],{'transaction':_0x4c04eb})[_0x4f4f('0x2b')](function(_0x55a5e4){_0x59e207=_0x55a5e4['get']({'plain':!![]});return db[_0x4f4f('0x55')][_0x4f4f('0x4f')]({'where':{'id':_0x59e207[_0x4f4f('0x56')]},'raw':!![]})[_0x4f4f('0x2b')](function(_0x37cf8e){return createVoicePrefixExtensions(_0x59e207,_0x37cf8e,_0x4c04eb);});});})[_0x4f4f('0x2b')](function(){var _0xe66fc=_0x17f6fb[_0x4f4f('0x57')][_0x4f4f('0x2c')]({'plain':!![]});if(!_0xe66fc)throw new Error(_0x4f4f('0x58'));if(_0xe66fc[_0x4f4f('0x59')]==='user'){var _0x585c06=_0x59e207;return db[_0x4f4f('0x5a')][_0x4f4f('0x4f')]({'where':{'name':_0x4f4f('0x2d'),'userProfileId':_0xe66fc[_0x4f4f('0x5b')]},'raw':!![]})['then'](function(_0x1bef77){if(_0x1bef77&&_0x1bef77['autoAssociation']===0x0){return db[_0x4f4f('0x5c')][_0x4f4f('0x51')]({'name':_0x585c06[_0x4f4f('0x31')],'resourceId':_0x585c06['id'],'type':_0x1bef77['name'],'sectionId':_0x1bef77['id']},{})[_0x4f4f('0x2b')](function(){return _0x59e207;});}else{return _0x59e207;}})[_0x4f4f('0x4a')](function(_0x23e9a9){logger['error'](_0x4f4f('0x5d'),_0x23e9a9);throw _0x23e9a9;});}return _0x59e207;})[_0x4f4f('0x2b')](respondWithResult(_0x4dbce2,null))[_0x4f4f('0x4a')](handleError(_0x4dbce2,null));};function Extension(_0x58a5dd,_0x2b01da,_0x16f162,_0x3fedae){this['context']=_0x4f4f('0x5e');this['exten']=_0x58a5dd;this[_0x4f4f('0x5f')]=_0x16f162;this[_0x4f4f('0x37')]=_0x4f4f('0x60');this[_0x4f4f('0x61')]=_0x4f4f('0x62');this[_0x4f4f('0x63')]=_0x2b01da;this[_0x4f4f('0x64')]=_0x3fedae;}function createVoicePrefixExtensions(_0xb2dfda,_0x40dffa,_0x36f369){return new BPromise(function(_0x269e0d,_0x5ba1e2){var _0x4794fe=new Extension(formatPrefixName(_0xb2dfda[_0x4f4f('0x65')]),0x1,_0x4f4f('0x66'),'Voice\x20Prefix');_0x4794fe[_0x4f4f('0x67')]=_0xb2dfda['id'];return db[_0x4f4f('0x55')][_0x4f4f('0x51')](_0x4794fe,{'transaction':_0x36f369})[_0x4f4f('0x2b')](function(_0x561411){var _0x28f9e1=_0x561411[_0x4f4f('0x2c')]({'plain':!![]});var _0xc9a47a=_[_0x4f4f('0x33')](addVoicePrefixExtensions(_0xb2dfda,_0x40dffa),function(_0x157af6){_0x157af6['VoiceExtensionId']=_0x28f9e1['id'];_0x157af6[_0x4f4f('0x67')]=_0xb2dfda['id'];return _0x157af6;});return db['VoiceExtension'][_0x4f4f('0x68')](_0xc9a47a,{'transaction':_0x36f369})[_0x4f4f('0x2b')](function(_0x2da4ea){if(!_0x2da4ea){return _0x5ba1e2(_0x4f4f('0x69'));}else{return _0x269e0d(_0x2da4ea);}})[_0x4f4f('0x4a')](function(_0x23366b){return _0x5ba1e2(_0x23366b);});});;});};function addVoicePrefixExtensions(_0x4bbbf6,_0x50590c){var _0x15c86f=[];var _0x4c42fd=formatPrefixName(_0x4bbbf6[_0x4f4f('0x65')]);_0x15c86f[_0x4f4f('0x6a')](new Extension(_0x4c42fd,0x2,_0x4f4f('0x6b'),_0x4f4f('0x6c')+_0x4bbbf6[_0x4f4f('0x31')]));if(_0x4bbbf6[_0x4f4f('0x6d')]){_0x15c86f[_0x4f4f('0x6a')](new Extension(_0x4c42fd,0x3,_0x4f4f('0x6b'),_0x4f4f('0x6e')+_0x4bbbf6[_0x4f4f('0x6d')]));}else{_0x15c86f[_0x4f4f('0x6a')](new Extension(_0x4c42fd,0x3,'NoOp','No\x20callerid\x20available'));}_0x15c86f['push'](new Extension(_0x4c42fd,0x4,_0x4f4f('0x6f'),_0x50590c[_0x4f4f('0x70')]+','+'${EXTEN:'+(0x8+_0x4bbbf6[_0x4f4f('0x31')][_0x4f4f('0x3f')])+'}'+','+0x1));return _0x15c86f;}function formatPrefixName(_0x43d6c0){var _0x3007ff='_';for(var _0x12523f=0x0;_0x12523f<_0x43d6c0[_0x4f4f('0x3f')];_0x12523f++){if(_0x43d6c0['charAt'](_0x12523f)=='-'){_0x3007ff+=_0x43d6c0[_0x4f4f('0x71')](_0x12523f);}else{_0x3007ff+='['+_0x43d6c0[_0x4f4f('0x71')](_0x12523f)+']';}}_0x3007ff+='.';return _0x3007ff;}exports[_0x4f4f('0x2a')]=function(_0x24ed71,_0x33f4fd,_0x36299e){var _0x1d756b=_0x24ed71[_0x4f4f('0x54')];_0x1d756b['prefix']=_0x4f4f('0x72')+_0x1d756b[_0x4f4f('0x31')]+'-';return db[_0x4f4f('0x52')][_0x4f4f('0x53')](function(_0x5f0efc){return db[_0x4f4f('0x34')]['update'](_0x1d756b,{'where':{'id':_0x1d756b['id']},'transaction':_0x5f0efc})[_0x4f4f('0x2b')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x1d756b['id']},'transaction':_0x5f0efc})[_0x4f4f('0x2b')](function(){return db[_0x4f4f('0x55')][_0x4f4f('0x4f')]({'where':{'id':_0x1d756b[_0x4f4f('0x56')]},'raw':!![]})['then'](function(_0x90813f){return createVoicePrefixExtensions(_0x1d756b,_0x90813f,_0x5f0efc);});});});})['then'](function(){return db[_0x4f4f('0x34')]['findById'](_0x1d756b['id']);})[_0x4f4f('0x2b')](respondWithResult(_0x33f4fd,null))[_0x4f4f('0x4a')](handleError(_0x33f4fd,null));};exports[_0x4f4f('0x73')]=function(_0x577fd9,_0x41c31c,_0x4b0ab5){return db[_0x4f4f('0x34')][_0x4f4f('0x4f')]({'where':{'id':_0x577fd9[_0x4f4f('0x4c')]['id']}})[_0x4f4f('0x2b')](handleEntityNotFound(_0x41c31c,null))[_0x4f4f('0x2b')](function(_0x4511c6){if(_0x4511c6){return _0x4511c6[_0x4f4f('0x73')](_0x577fd9[_0x4f4f('0x54')][_0x4f4f('0x74')],_['omit'](_0x577fd9[_0x4f4f('0x54')],[_0x4f4f('0x74'),'id'])||{})[_0x4f4f('0x75')](function(_0x14e4f3){for(var _0x42c638=0x0;_0x42c638<_0x577fd9[_0x4f4f('0x54')]['ids'][_0x4f4f('0x3f')];_0x42c638+=0x1){socket[_0x4f4f('0x76')](_0x4f4f('0x77'),{'UserId':Number(_0x577fd9[_0x4f4f('0x54')]['ids'][_0x42c638]),'VoicePrefixId':Number(_0x577fd9[_0x4f4f('0x4c')]['id'])});}return _0x14e4f3;});}})[_0x4f4f('0x2b')](respondWithResult(_0x41c31c,null))[_0x4f4f('0x4a')](handleError(_0x41c31c,null));};exports['removeAgents']=function(_0x838d05,_0x40bab8,_0x5ae1b6){return db[_0x4f4f('0x34')][_0x4f4f('0x4f')]({'where':{'id':_0x838d05[_0x4f4f('0x4c')]['id']}})[_0x4f4f('0x2b')](handleEntityNotFound(_0x40bab8,null))[_0x4f4f('0x2b')](function(_0x25cd1c){if(_0x25cd1c){return _0x25cd1c['removeAgents'](_0x838d05[_0x4f4f('0x3a')][_0x4f4f('0x74')])[_0x4f4f('0x2b')](function(){if(_[_0x4f4f('0x78')](_0x838d05[_0x4f4f('0x3a')][_0x4f4f('0x74')])){for(var _0x5b6633=0x0;_0x5b6633<_0x838d05[_0x4f4f('0x3a')][_0x4f4f('0x74')][_0x4f4f('0x3f')];_0x5b6633+=0x1){socket['emit'](_0x4f4f('0x79'),{'UserId':Number(_0x838d05[_0x4f4f('0x3a')][_0x4f4f('0x74')][_0x5b6633]),'VoicePrefixId':Number(_0x838d05[_0x4f4f('0x4c')]['id'])});}}else{socket[_0x4f4f('0x76')]('userVoicePrefix:remove',{'UserId':Number(_0x838d05[_0x4f4f('0x3a')]['ids']),'VoicePrefixId':Number(_0x838d05['params']['id'])});}});}})[_0x4f4f('0x2b')](respondWithStatusCode(_0x40bab8,null))[_0x4f4f('0x4a')](handleError(_0x40bab8,null));};exports[_0x4f4f('0x7a')]=function(_0x33c295,_0x762acd,_0x362c6d){var _0x1d1f5f={};var _0x19e743={};var _0x167c43;var _0x50058d;return db[_0x4f4f('0x34')]['findOne']({'where':{'id':_0x33c295[_0x4f4f('0x4c')]['id']}})[_0x4f4f('0x2b')](handleEntityNotFound(_0x762acd,null))['then'](function(_0x3286b1){if(_0x3286b1){_0x167c43=_0x3286b1;_0x19e743[_0x4f4f('0x39')]=_[_0x4f4f('0x4d')](db[_0x4f4f('0x7b')][_0x4f4f('0x35')]);_0x19e743[_0x4f4f('0x3a')]=_[_0x4f4f('0x4d')](_0x33c295[_0x4f4f('0x3a')]);_0x19e743['filters']=_[_0x4f4f('0x3c')](_0x19e743[_0x4f4f('0x39')],_0x19e743[_0x4f4f('0x3a')]);_0x1d1f5f['attributes']=_[_0x4f4f('0x3c')](_0x19e743['model'],qs['fields'](_0x33c295[_0x4f4f('0x3a')][_0x4f4f('0x3e')]));_0x1d1f5f[_0x4f4f('0x3d')]=_0x1d1f5f[_0x4f4f('0x3d')]['length']?_0x1d1f5f[_0x4f4f('0x3d')]:_0x19e743['model'];_0x1d1f5f[_0x4f4f('0x7c')]=qs[_0x4f4f('0x42')](_0x33c295[_0x4f4f('0x3a')][_0x4f4f('0x42')]);_0x1d1f5f[_0x4f4f('0x43')]=qs[_0x4f4f('0x3b')](_[_0x4f4f('0x44')](_0x33c295[_0x4f4f('0x3a')],_0x19e743[_0x4f4f('0x3b')]));if(_0x33c295[_0x4f4f('0x3a')]['filter']){_0x1d1f5f['where']=_[_0x4f4f('0x46')](_0x1d1f5f[_0x4f4f('0x43')],{'$or':_[_0x4f4f('0x33')](_0x1d1f5f[_0x4f4f('0x3d')],function(_0x515d05){var _0x485129={};_0x485129[_0x515d05]={'$like':'%'+_0x33c295[_0x4f4f('0x3a')][_0x4f4f('0x45')]+'%'};return _0x485129;})});}_0x1d1f5f=_[_0x4f4f('0x46')]({},_0x1d1f5f,_0x33c295[_0x4f4f('0x48')]);return _0x167c43[_0x4f4f('0x7a')](_0x1d1f5f);}})['then'](function(_0x10fa9e){if(_0x10fa9e){_0x50058d=_0x10fa9e[_0x4f4f('0x3f')];if(!_0x33c295[_0x4f4f('0x3a')][_0x4f4f('0x40')](_0x4f4f('0x41'))){_0x1d1f5f['limit']=qs[_0x4f4f('0x25')](_0x33c295['query']['limit']);_0x1d1f5f[_0x4f4f('0x23')]=qs[_0x4f4f('0x23')](_0x33c295[_0x4f4f('0x3a')]['offset']);}return _0x167c43[_0x4f4f('0x7a')](_0x1d1f5f);}})[_0x4f4f('0x2b')](function(_0x56015c){if(_0x56015c){return _0x56015c?{'count':_0x50058d,'rows':_0x56015c}:null;}})[_0x4f4f('0x2b')](respondWithResult(_0x762acd,null))[_0x4f4f('0x4a')](handleError(_0x762acd,null));};exports['getTeams']=function(_0xaa0e50,_0x23e8bd,_0x3b5214){var _0x38ea5d={};var _0x4632c0={};var _0x6ec076;var _0x56f2c5;return db[_0x4f4f('0x34')][_0x4f4f('0x7d')]({'where':{'id':_0xaa0e50[_0x4f4f('0x4c')]['id']}})[_0x4f4f('0x2b')](handleEntityNotFound(_0x23e8bd,null))[_0x4f4f('0x2b')](function(_0x3d0e57){if(_0x3d0e57){_0x6ec076=_0x3d0e57;_0x4632c0[_0x4f4f('0x39')]=_[_0x4f4f('0x4d')](db[_0x4f4f('0x7e')][_0x4f4f('0x35')]);_0x4632c0[_0x4f4f('0x3a')]=_[_0x4f4f('0x4d')](_0xaa0e50[_0x4f4f('0x3a')]);_0x4632c0[_0x4f4f('0x3b')]=_[_0x4f4f('0x3c')](_0x4632c0['model'],_0x4632c0[_0x4f4f('0x3a')]);_0x38ea5d['attributes']=_[_0x4f4f('0x3c')](_0x4632c0[_0x4f4f('0x39')],qs[_0x4f4f('0x3e')](_0xaa0e50['query'][_0x4f4f('0x3e')]));_0x38ea5d[_0x4f4f('0x3d')]=_0x38ea5d[_0x4f4f('0x3d')][_0x4f4f('0x3f')]?_0x38ea5d[_0x4f4f('0x3d')]:_0x4632c0['model'];_0x38ea5d[_0x4f4f('0x7c')]=qs[_0x4f4f('0x42')](_0xaa0e50[_0x4f4f('0x3a')]['sort']);_0x38ea5d[_0x4f4f('0x43')]=qs[_0x4f4f('0x3b')](_[_0x4f4f('0x44')](_0xaa0e50['query'],_0x4632c0[_0x4f4f('0x3b')]));if(_0xaa0e50['query'][_0x4f4f('0x45')]){_0x38ea5d['where']=_['merge'](_0x38ea5d['where'],{'$or':_['map'](_0x38ea5d['attributes'],function(_0x446cbd){var _0x2f2cb9={};_0x2f2cb9[_0x446cbd]={'$like':'%'+_0xaa0e50['query']['filter']+'%'};return _0x2f2cb9;})});}_0x38ea5d=_[_0x4f4f('0x46')]({},_0x38ea5d,_0xaa0e50[_0x4f4f('0x48')]);return _0x6ec076[_0x4f4f('0x7f')](_0x38ea5d);}})['then'](function(_0x5ad9f6){if(_0x5ad9f6){_0x56f2c5=_0x5ad9f6['length'];if(!_0xaa0e50[_0x4f4f('0x3a')]['hasOwnProperty']('nolimit')){_0x38ea5d[_0x4f4f('0x25')]=qs['limit'](_0xaa0e50[_0x4f4f('0x3a')][_0x4f4f('0x25')]);_0x38ea5d['offset']=qs[_0x4f4f('0x23')](_0xaa0e50[_0x4f4f('0x3a')]['offset']);}return _0x6ec076[_0x4f4f('0x7f')](_0x38ea5d);}})[_0x4f4f('0x2b')](function(_0x3be76f){if(_0x3be76f){return _0x3be76f?{'count':_0x56f2c5,'rows':_0x3be76f}:null;}})[_0x4f4f('0x2b')](respondWithResult(_0x23e8bd,null))['catch'](handleError(_0x23e8bd,null));};exports[_0x4f4f('0x80')]=function(_0x349e9c,_0x2fc478,_0x3a745a){var _0x53c962=_0x349e9c[_0x4f4f('0x54')][_0x4f4f('0x74')];var _0x27b573;return db[_0x4f4f('0x7e')][_0x4f4f('0x81')]({'where':{'id':_0x53c962},'attributes':['id'],'include':[{'model':db[_0x4f4f('0x7b')],'as':_0x4f4f('0x82'),'attributes':['id',_0x4f4f('0x31'),_0x4f4f('0x83'),_0x4f4f('0x84'),_0x4f4f('0x85')],'raw':!![]}]})[_0x4f4f('0x2b')](function(_0x3f87c8){if(_0x3f87c8){_0x27b573=_0x3f87c8;var _0x22e619=_['flatMap'](_0x3f87c8,function(_0x3bfc19){var _0x150474=_0x3bfc19[_0x4f4f('0x2c')]({'plain':!![]});return _0x150474[_0x4f4f('0x82')];});return db[_0x4f4f('0x34')][_0x4f4f('0x4f')]({'where':{'id':_0x349e9c['params']['id']}})[_0x4f4f('0x2b')](function(_0x5a4d26){return db[_0x4f4f('0x52')]['transaction'](function(_0x2d1cc1){return _0x5a4d26['addTeams'](_0x53c962,{'transaction':_0x2d1cc1})[_0x4f4f('0x2b')](function(){return BPromise[_0x4f4f('0x86')](_0x27b573,function(_0x2b6319){return db['TeamVoicePrefix'][_0x4f4f('0x87')]({'TeamId':_0x2b6319['id'],'VoicePrefixId':_0x349e9c[_0x4f4f('0x4c')]['id']},{'transaction':_0x2d1cc1});});})[_0x4f4f('0x2b')](function(){return BPromise[_0x4f4f('0x86')](_0x22e619,function(_0xbe8586){return db['UserVoicePrefix'][_0x4f4f('0x88')]({'where':{'UserId':_0xbe8586['id'],'VoicePrefixId':_0x349e9c['params']['id']},'transaction':_0x2d1cc1});});})[_0x4f4f('0x2b')](function(){_0x22e619[_0x4f4f('0x89')](function(_0x4bb547){socket['emit']('userVoicePrefix:save',{'UserId':_0x4bb547['id'],'VoicePrefixId':_0x5a4d26['id']});});});});});}})[_0x4f4f('0x2b')](respondWithStatusCode(_0x2fc478,null))[_0x4f4f('0x4a')](handleError(_0x2fc478,null));};exports[_0x4f4f('0x8a')]=function(_0x4c178d,_0x2cf10a,_0x53a849){return db[_0x4f4f('0x7e')]['findAll']({'where':{'id':_0x4c178d[_0x4f4f('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4f4f('0x7b')],'as':_0x4f4f('0x82'),'attributes':['id'],'raw':!![]}]})[_0x4f4f('0x2b')](handleEntityNotFound(_0x2cf10a,null))[_0x4f4f('0x2b')](function(_0x5063a6){var _0x1ce179=_[_0x4f4f('0x33')](_0x5063a6,'id');var _0x3f2b27=[];var _0x28049b=[];var _0x13418d=squel[_0x4f4f('0x8b')]();_0x13418d[_0x4f4f('0x8c')](_0x4f4f('0x8d'))[_0x4f4f('0x8e')](_0x4f4f('0x8f'),'tq')[_0x4f4f('0x90')]('user_has_teams','ut',_0x4f4f('0x91'))[_0x4f4f('0x43')](_0x4f4f('0x92'),_0x4c178d[_0x4f4f('0x4c')]['id']);for(var _0x223179=0x0;_0x223179<_0x5063a6['length'];_0x223179+=0x1){let _0x373ead=_0x5063a6[_0x223179];for(var _0x53dfb2=0x0;_0x53dfb2<_0x373ead[_0x4f4f('0x82')][_0x4f4f('0x3f')];_0x53dfb2+=0x1){let _0x3fcb64=_0x373ead[_0x4f4f('0x82')][_0x53dfb2];var _0x57405d=_0x13418d[_0x4f4f('0x93')]();_0x57405d['where'](_0x4f4f('0x94'),_0x3fcb64['id']);_0x28049b[_0x4f4f('0x6a')](db[_0x4f4f('0x52')][_0x4f4f('0x3a')](_0x57405d[_0x4f4f('0x95')](),{'type':db[_0x4f4f('0x52')][_0x4f4f('0x96')][_0x4f4f('0x97')]})[_0x4f4f('0x2b')](function(_0x3ce86c){if(_0x3ce86c['length']===0x1){return _0x3fcb64['id'];}else{var _0xe830ee=_['every'](_[_0x4f4f('0x33')](_0x3ce86c,'TeamId'),function(_0x277c96){return _[_0x4f4f('0x98')](_0x1ce179,_0x277c96);});if(_0xe830ee){return _0x3fcb64['id'];}}}));}}return BPromise[_0x4f4f('0x99')](_0x28049b)[_0x4f4f('0x2b')](function(_0x3a0382){_0x3f2b27=_(_0x3f2b27)[_0x4f4f('0x9a')](_0x3a0382)[_0x4f4f('0x9b')]()[_0x4f4f('0x9c')]();return db['VoicePrefix'][_0x4f4f('0x4f')]({'where':{'id':_0x4c178d[_0x4f4f('0x4c')]['id']}})['then'](function(_0x379a2e){return db[_0x4f4f('0x52')][_0x4f4f('0x53')](function(_0x35e9e7){return _0x379a2e['removeTeams'](_0x4c178d[_0x4f4f('0x3a')]['ids'],{'transaction':_0x35e9e7})[_0x4f4f('0x2b')](function(){if(!_['isEmpty'](_0x3f2b27)){return _0x379a2e[_0x4f4f('0x9d')](_0x3f2b27,{'transaction':_0x35e9e7});}})['then'](function(){_0x3f2b27['forEach'](function(_0x3f2df9){socket[_0x4f4f('0x76')](_0x4f4f('0x79'),{'UserId':_0x3f2df9,'VoicePrefixId':_0x379a2e['id']});});});});});});})[_0x4f4f('0x2b')](respondWithStatusCode(_0x2cf10a,null))['catch'](handleError(_0x2cf10a,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 1659807..5f98c10 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 _0x59a2=['../../mysqldb','VoicePrefix','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0xe27810,_0x8b3e76){var _0x53dcec=function(_0x4a83c7){while(--_0x4a83c7){_0xe27810['push'](_0xe27810['shift']());}};_0x53dcec(++_0x8b3e76);}(_0x59a2,0x13f));var _0x259a=function(_0x1b5818,_0x242115){_0x1b5818=_0x1b5818-0x0;var _0x5e3876=_0x59a2[_0x1b5818];return _0x5e3876;};'use strict';var EventEmitter=require(_0x259a('0x0'));var VoicePrefix=require(_0x259a('0x1'))['db'][_0x259a('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x259a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x259a('0x4'),'afterDestroy':_0x259a('0x5')};function emitEvent(_0x4454cf){return function(_0xeabd6f,_0x28a12d,_0x500de7){VoicePrefixEvents[_0x259a('0x6')](_0x4454cf+':'+_0xeabd6f['id'],_0xeabd6f);VoicePrefixEvents[_0x259a('0x6')](_0x4454cf,_0xeabd6f);_0x500de7(null);};}for(var e in events){if(events[_0x259a('0x7')](e)){var event=events[e];VoicePrefix[_0x259a('0x8')](e,emitEvent(event));}}module[_0x259a('0x9')]=VoicePrefixEvents; \ No newline at end of file +var _0xf4ef=['exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x3b58b5,_0x5799ad){var _0x5d48e6=function(_0x486370){while(--_0x486370){_0x3b58b5['push'](_0x3b58b5['shift']());}};_0x5d48e6(++_0x5799ad);}(_0xf4ef,0x6d));var _0xff4e=function(_0x2bda14,_0x4fab1b){_0x2bda14=_0x2bda14-0x0;var _0xb5dd49=_0xf4ef[_0x2bda14];return _0xb5dd49;};'use strict';var EventEmitter=require(_0xff4e('0x0'));var VoicePrefix=require(_0xff4e('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xff4e('0x2')](0x0);var events={'afterCreate':_0xff4e('0x3'),'afterUpdate':_0xff4e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x401722){return function(_0x375191,_0x2f1eb2,_0x298008){VoicePrefixEvents[_0xff4e('0x5')](_0x401722+':'+_0x375191['id'],_0x375191);VoicePrefixEvents[_0xff4e('0x5')](_0x401722,_0x375191);_0x298008(null);};}for(var e in events){if(events[_0xff4e('0x6')](e)){var event=events[e];VoicePrefix[_0xff4e('0x7')](e,emitEvent(event));}}module[_0xff4e('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index bfc10c3..7a63324 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 _0xeee1=['voice_prefixes','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','VoicePrefix'];(function(_0x1a1caa,_0x39295f){var _0x322687=function(_0x3289f1){while(--_0x3289f1){_0x1a1caa['push'](_0x1a1caa['shift']());}};_0x322687(++_0x39295f);}(_0xeee1,0x177));var _0x1eee=function(_0x5dacfa,_0x394140){_0x5dacfa=_0x5dacfa-0x0;var _0x48dac6=_0xeee1[_0x5dacfa];return _0x48dac6;};'use strict';var _=require(_0x1eee('0x0'));var util=require('util');var logger=require(_0x1eee('0x1'))(_0x1eee('0x2'));var moment=require(_0x1eee('0x3'));var BPromise=require('bluebird');var rp=require(_0x1eee('0x4'));var fs=require('fs');var path=require(_0x1eee('0x5'));var rimraf=require(_0x1eee('0x6'));var config=require(_0x1eee('0x7'));var attributes=require('./voicePrefix.attributes');module[_0x1eee('0x8')]=function(_0x563fa1,_0x11596f){return _0x563fa1['define'](_0x1eee('0x9'),attributes,{'tableName':_0x1eee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b0a=['voice_prefixes','lodash','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x1f4ac9,_0x3b8ed3){var _0x1e29c0=function(_0x2045aa){while(--_0x2045aa){_0x1f4ac9['push'](_0x1f4ac9['shift']());}};_0x1e29c0(++_0x3b8ed3);}(_0x8b0a,0x111));var _0xa8b0=function(_0x217751,_0x5a0349){_0x217751=_0x217751-0x0;var _0x66446b=_0x8b0a[_0x217751];return _0x66446b;};'use strict';var _=require(_0xa8b0('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa8b0('0x1'));var BPromise=require(_0xa8b0('0x2'));var rp=require(_0xa8b0('0x3'));var fs=require('fs');var path=require(_0xa8b0('0x4'));var rimraf=require('rimraf');var config=require(_0xa8b0('0x5'));var attributes=require('./voicePrefix.attributes');module[_0xa8b0('0x6')]=function(_0x564ca9,_0xf266f2){return _0x564ca9['define']('VoicePrefix',attributes,{'tableName':_0xa8b0('0x7'),'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 19af409..964c041 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 _0x176c=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird'];(function(_0x3428b7,_0x597cea){var _0x8ffa4d=function(_0x4bca28){while(--_0x4bca28){_0x3428b7['push'](_0x3428b7['shift']());}};_0x8ffa4d(++_0x597cea);}(_0x176c,0x134));var _0xc176=function(_0x323c6a,_0x5309c4){_0x323c6a=_0x323c6a-0x0;var _0x19bd03=_0x176c[_0x323c6a];return _0x19bd03;};'use strict';var _=require(_0xc176('0x0'));var util=require(_0xc176('0x1'));var moment=require(_0xc176('0x2'));var BPromise=require(_0xc176('0x3'));var rs=require(_0xc176('0x4'));var fs=require('fs');var Redis=require(_0xc176('0x5'));var db=require(_0xc176('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc176('0x7'))(_0xc176('0x8'));var config=require('../../config/environment');var jayson=require(_0xc176('0x9'));var client=jayson[_0xc176('0xa')][_0xc176('0xb')]({'port':0x232a});config['redis']=_[_0xc176('0xc')](config[_0xc176('0xd')],{'host':_0xc176('0xe'),'port':0x18eb});var socket=require(_0xc176('0xf'))(new Redis(config[_0xc176('0xd')]));require('./voicePrefix.socket')[_0xc176('0x10')](socket);function respondWithRpcPromise(_0x1486c9,_0x2f95eb,_0x48186c){return new BPromise(function(_0x3e7997,_0x208607){return client[_0xc176('0x11')](_0x1486c9,_0x48186c)[_0xc176('0x12')](function(_0x420bf8){logger[_0xc176('0x13')](_0xc176('0x14'),_0x2f95eb,_0xc176('0x15'));logger['debug'](_0xc176('0x16'),_0x2f95eb,_0xc176('0x15'),JSON[_0xc176('0x17')](_0x420bf8));if(_0x420bf8[_0xc176('0x18')]){if(_0x420bf8[_0xc176('0x18')]['code']===0x1f4){logger[_0xc176('0x18')](_0xc176('0x14'),_0x2f95eb,_0x420bf8[_0xc176('0x18')]['message']);return _0x208607(_0x420bf8[_0xc176('0x18')]['message']);}logger[_0xc176('0x18')](_0xc176('0x14'),_0x2f95eb,_0x420bf8['error'][_0xc176('0x19')]);return _0x3e7997(_0x420bf8[_0xc176('0x18')][_0xc176('0x19')]);}else{logger[_0xc176('0x13')](_0xc176('0x14'),_0x2f95eb,_0xc176('0x15'));_0x3e7997(_0x420bf8['result'][_0xc176('0x19')]);}})['catch'](function(_0x20228b){logger[_0xc176('0x18')](_0xc176('0x14'),_0x2f95eb,_0x20228b);_0x208607(_0x20228b);});});} \ No newline at end of file +var _0x33ac=['code','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x33ac,0x1f2));var _0xc33a=function(_0x4bf0b4,_0x87d6a8){_0x4bf0b4=_0x4bf0b4-0x0;var _0x4159a1=_0x33ac[_0x4bf0b4];return _0x4159a1;};'use strict';var _=require('lodash');var util=require(_0xc33a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc33a('0x1'));var fs=require('fs');var Redis=require(_0xc33a('0x2'));var db=require(_0xc33a('0x3'))['db'];var utils=require(_0xc33a('0x4'));var logger=require(_0xc33a('0x5'))(_0xc33a('0x6'));var config=require(_0xc33a('0x7'));var jayson=require(_0xc33a('0x8'));var client=jayson[_0xc33a('0x9')]['http']({'port':0x232a});config['redis']=_[_0xc33a('0xa')](config[_0xc33a('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xc33a('0xc'))(new Redis(config['redis']));require(_0xc33a('0xd'))[_0xc33a('0xe')](socket);function respondWithRpcPromise(_0x288e87,_0x6ec731,_0x1abc99){return new BPromise(function(_0x36ad93,_0x2a6228){return client[_0xc33a('0xf')](_0x288e87,_0x1abc99)[_0xc33a('0x10')](function(_0x4eef76){logger['info'](_0xc33a('0x11'),_0x6ec731,'request\x20sent');logger['debug'](_0xc33a('0x12'),_0x6ec731,_0xc33a('0x13'),JSON[_0xc33a('0x14')](_0x4eef76));if(_0x4eef76[_0xc33a('0x15')]){if(_0x4eef76[_0xc33a('0x15')][_0xc33a('0x16')]===0x1f4){logger['error'](_0xc33a('0x11'),_0x6ec731,_0x4eef76[_0xc33a('0x15')][_0xc33a('0x17')]);return _0x2a6228(_0x4eef76['error'][_0xc33a('0x17')]);}logger['error'](_0xc33a('0x11'),_0x6ec731,_0x4eef76[_0xc33a('0x15')][_0xc33a('0x17')]);return _0x36ad93(_0x4eef76[_0xc33a('0x15')][_0xc33a('0x17')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x6ec731,_0xc33a('0x13'));_0x36ad93(_0x4eef76[_0xc33a('0x18')][_0xc33a('0x17')]);}})[_0xc33a('0x19')](function(_0x2f6095){logger[_0xc33a('0x15')](_0xc33a('0x11'),_0x6ec731,_0x2f6095);_0x2a6228(_0x2f6095);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 057f53d..faa3c17 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 _0x0962=['./voicePrefix.events','save','remove','update','removeListener','register','length','voicePrefix:'];(function(_0xd690a1,_0x4c9ab8){var _0x588cba=function(_0x454ec4){while(--_0x454ec4){_0xd690a1['push'](_0xd690a1['shift']());}};_0x588cba(++_0x4c9ab8);}(_0x0962,0x198));var _0x2096=function(_0x42c646,_0x283326){_0x42c646=_0x42c646-0x0;var _0x24e32a=_0x0962[_0x42c646];return _0x24e32a;};'use strict';var VoicePrefixEvents=require(_0x2096('0x0'));var events=[_0x2096('0x1'),_0x2096('0x2'),_0x2096('0x3')];function createListener(_0x57617c,_0x38bed1){return function(_0x580e85){_0x38bed1['emit'](_0x57617c,_0x580e85);};}function removeListener(_0x2fe7b1,_0x2001d9){return function(){VoicePrefixEvents[_0x2096('0x4')](_0x2fe7b1,_0x2001d9);};}exports[_0x2096('0x5')]=function(_0x1ce10d){for(var _0x462564=0x0,_0x130711=events[_0x2096('0x6')];_0x462564<_0x130711;_0x462564++){var _0x4b5f76=events[_0x462564];var _0x16799f=createListener(_0x2096('0x7')+_0x4b5f76,_0x1ce10d);VoicePrefixEvents['on'](_0x4b5f76,_0x16799f);}}; \ No newline at end of file +var _0x76bc=['emit','removeListener','register','length','voicePrefix:','./voicePrefix.events','save','remove','update'];(function(_0x22c92e,_0xe908fe){var _0x2919c8=function(_0x3f87a2){while(--_0x3f87a2){_0x22c92e['push'](_0x22c92e['shift']());}};_0x2919c8(++_0xe908fe);}(_0x76bc,0x17f));var _0xc76b=function(_0x44c935,_0x3653f0){_0x44c935=_0x44c935-0x0;var _0x465bee=_0x76bc[_0x44c935];return _0x465bee;};'use strict';var VoicePrefixEvents=require(_0xc76b('0x0'));var events=[_0xc76b('0x1'),_0xc76b('0x2'),_0xc76b('0x3')];function createListener(_0x178974,_0x5a265d){return function(_0x5ce5d4){_0x5a265d[_0xc76b('0x4')](_0x178974,_0x5ce5d4);};}function removeListener(_0x161ef3,_0x3f7b22){return function(){VoicePrefixEvents[_0xc76b('0x5')](_0x161ef3,_0x3f7b22);};}exports[_0xc76b('0x6')]=function(_0x239be6){for(var _0x25b111=0x0,_0x2cbe53=events[_0xc76b('0x7')];_0x25b111<_0x2cbe53;_0x25b111++){var _0x1cb174=events[_0x25b111];var _0x235ff3=createListener(_0xc76b('0x8')+_0x1cb174,_0x239be6);VoicePrefixEvents['on'](_0x1cb174,_0x235ff3);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 677e448..807d90d 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(_0xdb4e73,_0x30b446){var _0x4578b4=function(_0x119eb5){while(--_0x119eb5){_0xdb4e73['push'](_0xdb4e73['shift']());}};_0x4578b4(++_0x30b446);}(_0xb10b,0x12a));var _0xbb10=function(_0x5ecff9,_0x473070){_0x5ecff9=_0x5ecff9-0x0;var _0x5e1415=_0xb10b[_0x5ecff9];return _0x5e1415;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x55d576,_0x219496){var _0x25f4ef=function(_0x465439){while(--_0x465439){_0x55d576['push'](_0x55d576['shift']());}};_0x25f4ef(++_0x219496);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 647f8cb..a08a458 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 _0x2fec=['random','rrmemory','setDataValue','strategy','getDataValue','type','dialMethod','preview','booked','roundrobin','includes','INTEGER','yes','periodic_announce','split','joinempty','join','leavewhenempty','BOOLEAN','Active/Disactive\x20Campaign','progressive','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','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)','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)','always','never','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls'];(function(_0x73a3ce,_0x3152f0){var _0x3dd74e=function(_0x2ebb3d){while(--_0x2ebb3d){_0x73a3ce['push'](_0x73a3ce['shift']());}};_0x3dd74e(++_0x3152f0);}(_0x2fec,0x11b));var _0xc2fe=function(_0x41fd5a,_0xfc2fca){_0x41fd5a=_0x41fd5a-0x0;var _0xbc6e4d=_0x2fec[_0x41fd5a];return _0xbc6e4d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc2fe('0x0')],'allowNull':![],'unique':_0xc2fe('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc2fe('0x2')](_0xc2fe('0x3'),_0xc2fe('0x4')),'allowNull':![],'defaultValue':_0xc2fe('0x3')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0xc2fe('0x5')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0xc2fe('0x2')]('rr',_0xc2fe('0x6'),_0xc2fe('0x7'),_0xc2fe('0x8'),_0xc2fe('0x9'),_0xc2fe('0xa'),'linear','wrandom','rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x9d8e10){this[_0xc2fe('0xb')](_0xc2fe('0xc'),_0x9d8e10?_0x9d8e10:_0xc2fe('0xa'));},'get':function(){var _0x44e39a=this[_0xc2fe('0xd')](_0xc2fe('0xe'));var _0x3bf131=this[_0xc2fe('0xd')](_0xc2fe('0xf'));var _0x12875a=this[_0xc2fe('0xd')](_0xc2fe('0xc'));if(_0x44e39a===_0xc2fe('0x4')){if(_0x3bf131===_0xc2fe('0x10')){return null;}if(_0x3bf131===_0xc2fe('0x11')&&![_0xc2fe('0xa'),_0xc2fe('0x12')][_0xc2fe('0x13')](_0x12875a)){this['setDataValue'](_0xc2fe('0xc'),'rrmemory');}}return _0x12875a;}},'servicelevel':{'type':Sequelize[_0xc2fe('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xc2fe('0x0')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xc2fe('0x14')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xc2fe('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xc2fe('0x0')]},'weight':{'type':Sequelize[_0xc2fe('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xc2fe('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0xc2fe('0x15'),'no'),'defaultValue':_0xc2fe('0x15')},'autopause':{'type':Sequelize[_0xc2fe('0x2')]('yes','no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xc2fe('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0xc2fe('0x2')](_0xc2fe('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xc2fe('0x2')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xc2fe('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xc2fe('0x2')](_0xc2fe('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xc2fe('0x2')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xc2fe('0x2')](_0xc2fe('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xc2fe('0x2')](_0xc2fe('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xc2fe('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xc2fe('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xc2fe('0x2')](_0xc2fe('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xc2fe('0x2')](_0xc2fe('0x15'),'no'),'defaultValue':_0xc2fe('0x15')},'announce_holdtime':{'type':Sequelize[_0xc2fe('0x2')](_0xc2fe('0x15'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xc2fe('0x0')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xc2fe('0x2')](_0xc2fe('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0xc2fe('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xc2fe('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xc2fe('0x0')]},'queue_youarenext':{'type':Sequelize[_0xc2fe('0x0')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xc2fe('0x0')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xc2fe('0x0')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xc2fe('0x0')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xc2fe('0x0')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xc2fe('0x0')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xc2fe('0x0')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xc2fe('0x0')]},'queue_quantity1':{'type':Sequelize[_0xc2fe('0x0')]},'queue_quantity2':{'type':Sequelize[_0xc2fe('0x0')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x213c37){this[_0xc2fe('0xb')](_0xc2fe('0x16'),_0x213c37?_0x213c37['join'](','):[]);},'get':function(){return this[_0xc2fe('0xd')](_0xc2fe('0x16'))?this[_0xc2fe('0xd')]('periodic_announce')[_0xc2fe('0x17')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0xc2fe('0x15'),'set':function(_0x2c1e68){this['setDataValue'](_0xc2fe('0x18'),_0x2c1e68?_0x2c1e68[_0xc2fe('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0xc2fe('0x18'))?this['getDataValue'](_0xc2fe('0x18'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xc2fe('0x0')],'defaultValue':'no','set':function(_0x582d8d){this['setDataValue'](_0xc2fe('0x1a'),_0x582d8d?_0x582d8d[_0xc2fe('0x19')](','):undefined);},'get':function(){return this[_0xc2fe('0xd')](_0xc2fe('0x1a'))?this['getDataValue'](_0xc2fe('0x1a'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xc2fe('0x2')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0xc2fe('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xc2fe('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xc2fe('0x2')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xc2fe('0x0')]},'description':{'type':Sequelize[_0xc2fe('0x0')]},'acw':{'type':Sequelize[_0xc2fe('0x1b')],'defaultValue':0x0,'set':function(_0x573654){this[_0xc2fe('0xb')]('acw',_0x573654);if(_0x573654){if(this[_0xc2fe('0xd')]('wrapuptime')<0x2){this[_0xc2fe('0xb')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0xc2fe('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xc2fe('0x1b')],'defaultValue':0x0,'comment':_0xc2fe('0x1c')},'dialMethod':{'type':Sequelize['ENUM'](_0xc2fe('0x10'),_0xc2fe('0x1d'),_0xc2fe('0x1e'),_0xc2fe('0x1f'),_0xc2fe('0x11')),'defaultValue':_0xc2fe('0x1d'),'comment':_0xc2fe('0x20')},'dialLimitChannel':{'type':Sequelize[_0xc2fe('0x14')](0x4)[_0xc2fe('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xc2fe('0x22')},'dialLimitQueue':{'type':Sequelize[_0xc2fe('0x14')](0x4)[_0xc2fe('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0xc2fe('0x23')](0x2)[_0xc2fe('0x21')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xc2fe('0x24'),_0xc2fe('0x25')),'defaultValue':'dropRate','comment':_0xc2fe('0x26')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xc2fe('0x23')](0x2)[_0xc2fe('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xc2fe('0x27')},'dialPredictiveInterval':{'type':Sequelize[_0xc2fe('0x14')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xc2fe('0x28')},'dialOriginateCallerIdName':{'type':Sequelize[_0xc2fe('0x0')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc2fe('0x0')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xc2fe('0x21')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc2fe('0x29')},'dialQueueOptions':{'type':Sequelize[_0xc2fe('0x0')],'defaultValue':_0xc2fe('0x2a'),'comment':_0xc2fe('0x2b')},'dialQueueTimeout':{'type':Sequelize[_0xc2fe('0x14')](0x3)[_0xc2fe('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc2fe('0x2c')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0xc2fe('0x2d')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc2fe('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc2fe('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc2fe('0x14')](0x5)[_0xc2fe('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc2fe('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0xc2fe('0x14')](0x3)[_0xc2fe('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xc2fe('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc2fe('0x30')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc2fe('0x14')](0x3)[_0xc2fe('0x21')],'defaultValue':0x3,'comment':_0xc2fe('0x31')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc2fe('0x14')](0x5)[_0xc2fe('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc2fe('0x32')},'dialGlobalMaxRetry':{'type':Sequelize[_0xc2fe('0x14')](0x3)[_0xc2fe('0x21')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0xc2fe('0x0')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xc2fe('0x2')](_0xc2fe('0x33'),_0xc2fe('0x34'),'onlyIfOpen'),'defaultValue':_0xc2fe('0x33')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xc2fe('0x35')},'dialAMDInitialSilence':{'type':Sequelize[_0xc2fe('0x14')](0x9)[_0xc2fe('0x21')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xc2fe('0x21')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc2fe('0x36')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc2fe('0x14')](0x9)[_0xc2fe('0x21')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc2fe('0x37')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc2fe('0x14')](0x9)[_0xc2fe('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xc2fe('0x14')](0x9)[_0xc2fe('0x21')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc2fe('0x38')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xc2fe('0x21')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc2fe('0x14')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc2fe('0x14')](0x5)[_0xc2fe('0x21')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc2fe('0x39')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc2fe('0x14')](0x9)[_0xc2fe('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc2fe('0x3a')},'dialRecallMeTimeout':{'type':Sequelize[_0xc2fe('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xc2fe('0x3b')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0xc2fe('0x2')](_0xc2fe('0x3c'),_0xc2fe('0x3d')),'defaultValue':_0xc2fe('0x3c')},'dialQueueProject2':{'type':Sequelize[_0xc2fe('0x0')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xc2fe('0x1b')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc2fe('0x14')](0x3)[_0xc2fe('0x21')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc2fe('0x3e')},'dialCutDigit':{'type':Sequelize[_0xc2fe('0x14')](0x3)[_0xc2fe('0x21')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc2fe('0x3f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc2fe('0x14')](0x3)[_0xc2fe('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc2fe('0x40')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc2fe('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xc2fe('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc2fe('0x41')},'dialDropRetryFrequency':{'type':Sequelize[_0xc2fe('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc2fe('0x14')](0x3)[_0xc2fe('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc2fe('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc2fe('0x42')},'dialMachineMaxRetry':{'type':Sequelize[_0xc2fe('0x14')](0x3)[_0xc2fe('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc2fe('0x43')},'dialMachineRetryFrequency':{'type':Sequelize[_0xc2fe('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc2fe('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc2fe('0x44')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc2fe('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc2fe('0x45')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc2fe('0x14')],'allowNull':!![],'comment':_0xc2fe('0x46')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xc2fe('0x47'),'set':function(_0x4bdccb){if(!_0x4bdccb)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xc2fe('0xb')](_0xc2fe('0x48'),_0x4bdccb);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xc2fe('0x14')](0x3)[_0xc2fe('0x21')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xc2fe('0x21')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xc2fe('0x1b')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0xc2fe('0x21')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xa16f=['split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','power','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','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)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','ringall','setDataValue','strategy','getDataValue','type','preview','booked','roundrobin','includes','INTEGER','yes','once','TEXT','periodic_announce','join'];(function(_0x115f32,_0x5c23a5){var _0x5bc031=function(_0xa04ef2){while(--_0xa04ef2){_0x115f32['push'](_0x115f32['shift']());}};_0x5bc031(++_0x5c23a5);}(_0xa16f,0x16a));var _0xfa16=function(_0x52d044,_0xd9946e){_0x52d044=_0x52d044-0x0;var _0x1dff8d=_0xa16f[_0x52d044];return _0x1dff8d;};'use strict';var Sequelize=require(_0xfa16('0x0'));module[_0xfa16('0x1')]={'name':{'type':Sequelize[_0xfa16('0x2')],'allowNull':![],'unique':_0xfa16('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xfa16('0x4')](_0xfa16('0x5'),_0xfa16('0x6')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0xfa16('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize[_0xfa16('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xfa16('0x4')]('rr','ringall',_0xfa16('0x7'),_0xfa16('0x8'),_0xfa16('0x9'),_0xfa16('0xa'),_0xfa16('0xb'),_0xfa16('0xc'),'rrordered'),'allowNull':![],'defaultValue':_0xfa16('0xd'),'set':function(_0x179455){this[_0xfa16('0xe')](_0xfa16('0xf'),_0x179455?_0x179455:'rrmemory');},'get':function(){var _0x51d628=this[_0xfa16('0x10')](_0xfa16('0x11'));var _0x481f7a=this[_0xfa16('0x10')]('dialMethod');var _0x55f0ea=this[_0xfa16('0x10')](_0xfa16('0xf'));if(_0x51d628===_0xfa16('0x6')){if(_0x481f7a===_0xfa16('0x12')){return null;}if(_0x481f7a===_0xfa16('0x13')&&![_0xfa16('0xa'),_0xfa16('0x14')][_0xfa16('0x15')](_0x55f0ea)){this[_0xfa16('0xe')](_0xfa16('0xf'),_0xfa16('0xa'));}}return _0x55f0ea;}},'servicelevel':{'type':Sequelize[_0xfa16('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xfa16('0x16')](0xb)},'timeout':{'type':Sequelize[_0xfa16('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xfa16('0x2')]},'weight':{'type':Sequelize[_0xfa16('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xfa16('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xfa16('0x4')]('yes','no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0xfa16('0x4')](_0xfa16('0x17'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0xfa16('0x4')](_0xfa16('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0xfa16('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xfa16('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xfa16('0x4')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xfa16('0x4')](_0xfa16('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xfa16('0x4')](_0xfa16('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xfa16('0x4')](_0xfa16('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xfa16('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xfa16('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xfa16('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xfa16('0x4')](_0xfa16('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0xfa16('0x17'),'no'),'defaultValue':_0xfa16('0x17')},'announce_holdtime':{'type':Sequelize[_0xfa16('0x4')](_0xfa16('0x17'),'no',_0xfa16('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xfa16('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xfa16('0x4')](_0xfa16('0x17'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0xfa16('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xfa16('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xfa16('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xfa16('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xfa16('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xfa16('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xfa16('0x2')]},'queue_quantity1':{'type':Sequelize[_0xfa16('0x2')]},'queue_quantity2':{'type':Sequelize[_0xfa16('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xfa16('0x2')]},'queue_less_than':{'type':Sequelize[_0xfa16('0x2')]},'periodic_announce':{'type':Sequelize[_0xfa16('0x19')],'set':function(_0x2e8715){this[_0xfa16('0xe')](_0xfa16('0x1a'),_0x2e8715?_0x2e8715[_0xfa16('0x1b')](','):[]);},'get':function(){return this['getDataValue'](_0xfa16('0x1a'))?this[_0xfa16('0x10')](_0xfa16('0x1a'))[_0xfa16('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0xfa16('0x2')],'defaultValue':_0xfa16('0x17'),'set':function(_0x5e8e80){this[_0xfa16('0xe')](_0xfa16('0x1d'),_0x5e8e80?_0x5e8e80[_0xfa16('0x1b')](','):undefined);},'get':function(){return this[_0xfa16('0x10')]('joinempty')?this[_0xfa16('0x10')]('joinempty')[_0xfa16('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xfa16('0x2')],'defaultValue':'no','set':function(_0x402772){this[_0xfa16('0xe')](_0xfa16('0x1e'),_0x402772?_0x402772[_0xfa16('0x1b')](','):undefined);},'get':function(){return this[_0xfa16('0x10')](_0xfa16('0x1e'))?this[_0xfa16('0x10')]('leavewhenempty')[_0xfa16('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xfa16('0x4')](_0xfa16('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0xfa16('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xfa16('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xfa16('0x4')](_0xfa16('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xfa16('0x2')]},'description':{'type':Sequelize[_0xfa16('0x2')]},'acw':{'type':Sequelize[_0xfa16('0x1f')],'defaultValue':0x0,'set':function(_0x703d6f){this['setDataValue'](_0xfa16('0x20'),_0x703d6f);if(_0x703d6f){if(this['getDataValue'](_0xfa16('0x21'))<0x2){this[_0xfa16('0xe')](_0xfa16('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xfa16('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xfa16('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM'](_0xfa16('0x12'),'progressive',_0xfa16('0x22'),'predictive',_0xfa16('0x13')),'defaultValue':_0xfa16('0x23'),'comment':_0xfa16('0x24')},'dialLimitChannel':{'type':Sequelize[_0xfa16('0x16')](0x4)[_0xfa16('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xfa16('0x26')},'dialLimitQueue':{'type':Sequelize[_0xfa16('0x16')](0x4)[_0xfa16('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xfa16('0x27')},'dialPowerLevel':{'type':Sequelize[_0xfa16('0x28')](0x2)[_0xfa16('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xfa16('0x29')},'dialPredictiveOptimization':{'type':Sequelize[_0xfa16('0x4')](_0xfa16('0x2a'),_0xfa16('0x2b')),'defaultValue':_0xfa16('0x2b'),'comment':_0xfa16('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xfa16('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0xfa16('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xfa16('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xfa16('0x16')](0x3)[_0xfa16('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfa16('0x2e')},'dialQueueOptions':{'type':Sequelize[_0xfa16('0x2')],'defaultValue':_0xfa16('0x2f'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xfa16('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0xfa16('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xfa16('0x16')](0x3)[_0xfa16('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfa16('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xfa16('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xfa16('0x16')](0x3)[_0xfa16('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfa16('0x31')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xfa16('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xfa16('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfa16('0x32')},'dialGlobalMaxRetry':{'type':Sequelize[_0xfa16('0x16')](0x3)[_0xfa16('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xfa16('0x33')},'dialTimezone':{'type':Sequelize[_0xfa16('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xfa16('0x2')],'defaultValue':_0xfa16('0x34')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xfa16('0x4')](_0xfa16('0x35'),_0xfa16('0x36'),_0xfa16('0x37')),'defaultValue':_0xfa16('0x35')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xfa16('0x38')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xfa16('0x39')},'dialAMDGreeting':{'type':Sequelize[_0xfa16('0x16')](0x9)[_0xfa16('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xfa16('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xfa16('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xfa16('0x16')](0x9)[_0xfa16('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfa16('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0xfa16('0x16')](0x9)[_0xfa16('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xfa16('0x16')](0x9)[_0xfa16('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xfa16('0x16')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xfa16('0x3c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xfa16('0x16')](0x5)[_0xfa16('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xfa16('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xfa16('0x16')](0x9)[_0xfa16('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfa16('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0xfa16('0x16')](0x5)[_0xfa16('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xfa16('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0xfa16('0x1f')],'defaultValue':0x0,'comment':_0xfa16('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0xfa16('0x4')](_0xfa16('0x41'),_0xfa16('0x42')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xfa16('0x2')],'comment':_0xfa16('0x43')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xfa16('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfa16('0x44')},'dialCutDigit':{'type':Sequelize[_0xfa16('0x16')](0x3)[_0xfa16('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfa16('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xfa16('0x16')](0x3)[_0xfa16('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xfa16('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xfa16('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xfa16('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfa16('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xfa16('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfa16('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xfa16('0x16')](0x5)[_0xfa16('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfa16('0x48')},'dialMachineMaxRetry':{'type':Sequelize[_0xfa16('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xfa16('0x16')](0x5)[_0xfa16('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xfa16('0x16')](0x3)[_0xfa16('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfa16('0x49')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xfa16('0x16')](0x5)[_0xfa16('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfa16('0x4a')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfa16('0x16')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xfa16('0x1f')],'defaultValue':![],'comment':_0xfa16('0x4b'),'set':function(_0x1bcf16){if(!_0x1bcf16)this[_0xfa16('0xe')](_0xfa16('0x4c'),null);this[_0xfa16('0xe')](_0xfa16('0x4d'),_0x1bcf16);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xfa16('0x16')](0x3)[_0xfa16('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xfa16('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xfa16('0x16')](0x3)[_0xfa16('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xfa16('0x1f')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index a241598..36d18e0 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 _0x1059=['api','../../config/environment','redis','defaults','localhost','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','filter','ignore','value','includes','find','type','UserProfileResource','stack','name','send','map','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','findAll','rows','params','include','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','outbound','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','body','omit','findOne','CmHopper','pick','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','teams','Agents','online','voicePause','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','interface','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','User','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','isEmpty','removeAgents','UserVoiceQueueRt','addAgents','spread','push','isNil','isArray','userVoiceQueue:remove','getAgents','getMembers','CmList','getLists','YYYY-MM-DD\x20HH:mm:ss','addLists','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','createdAt','select','phone','scheduledAt','ContactId','CmListId','ListId','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','into','deletedAt\x20IS\x20NULL','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','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'];(function(_0x24431a,_0x52459a){var _0x454ec7=function(_0x34cd60){while(--_0x34cd60){_0x24431a['push'](_0x24431a['shift']());}};_0x454ec7(++_0x52459a);}(_0x1059,0x176));var _0x9105=function(_0x4817eb,_0x118027){_0x4817eb=_0x4817eb-0x0;var _0x138929=_0x1059[_0x4817eb];return _0x138929;};'use strict';var emlformat=require(_0x9105('0x0'));var rimraf=require(_0x9105('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9105('0x2'));var rp=require(_0x9105('0x3'));var moment=require(_0x9105('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9105('0x5'));var util=require('util');var path=require(_0x9105('0x6'));var sox=require(_0x9105('0x7'));var csv=require('to-csv');var ejs=require(_0x9105('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9105('0x9'));var squel=require(_0x9105('0xa'));var crypto=require(_0x9105('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9105('0xc'));var toCsv=require(_0x9105('0xd'));var querystring=require(_0x9105('0xe'));var Papa=require(_0x9105('0xf'));var Redis=require('ioredis');var authService=require(_0x9105('0x10'));var qs=require(_0x9105('0x11'));var as=require(_0x9105('0x12'));var hardwareService=require(_0x9105('0x13'));var logger=require('../../config/logger')(_0x9105('0x14'));var utils=require('../../config/utils');var config=require(_0x9105('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x9105('0x16')]=_[_0x9105('0x17')](config[_0x9105('0x16')],{'host':_0x9105('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9105('0x16')]));require('./voiceQueue.socket')[_0x9105('0x19')](socket);function respondWithStatusCode(_0x1aa0d0,_0x3d4790){_0x3d4790=_0x3d4790||0xcc;return function(_0x481152){if(_0x481152){return _0x1aa0d0['sendStatus'](_0x3d4790);}return _0x1aa0d0[_0x9105('0x1a')](_0x3d4790)[_0x9105('0x1b')]();};}function respondWithResult(_0x3933d5,_0x40d98){_0x40d98=_0x40d98||0xc8;return function(_0x1a01dd){if(_0x1a01dd){return _0x3933d5[_0x9105('0x1a')](_0x40d98)[_0x9105('0x1c')](_0x1a01dd);}};}function respondWithFilteredResult(_0x13d241,_0xb093b0){return function(_0x3d44d4){if(_0x3d44d4){var _0x17e769=typeof _0xb093b0[_0x9105('0x1d')]==='undefined'&&typeof _0xb093b0['limit']===_0x9105('0x1e');var _0x825941=_0x3d44d4[_0x9105('0x1f')];var _0x6eafc8=_0x17e769?0x0:_0xb093b0['offset'];var _0x395454=_0x17e769?_0x3d44d4[_0x9105('0x1f')]:_0xb093b0['offset']+_0xb093b0[_0x9105('0x20')];var _0x2810f5;if(_0x395454>=_0x825941){_0x395454=_0x825941;_0x2810f5=0xc8;}else{_0x2810f5=0xce;}_0x13d241[_0x9105('0x1a')](_0x2810f5);return _0x13d241[_0x9105('0x21')](_0x9105('0x22'),_0x6eafc8+'-'+_0x395454+'/'+_0x825941)[_0x9105('0x1c')](_0x3d44d4);}return null;};}function patchUpdates(_0x47a77e){return function(_0x318aaa){try{jsonpatch[_0x9105('0x23')](_0x318aaa,_0x47a77e,!![]);}catch(_0x2e6988){return BPromise[_0x9105('0x24')](_0x2e6988);}return _0x318aaa[_0x9105('0x25')]();};}function saveUpdates(_0x432025,_0xbbad86){return function(_0x44a3d8){if(_0x44a3d8){return _0x44a3d8[_0x9105('0x26')](_0x432025)[_0x9105('0x27')](function(_0x2d83e2){return _0x2d83e2;});}return null;};}function removeEntity(_0x59f4c3,_0x3a66f1){return function(_0x474069){if(_0x474069){return _0x474069[_0x9105('0x28')]()[_0x9105('0x27')](function(){var _0x3f660c=_0x474069[_0x9105('0x29')]({'plain':!![]});var _0x5d7db1=[{'name':_0x9105('0x2a'),'value':_0x9105('0x2b'),'ignore':![]},{'name':_0x9105('0x2c'),'value':'outbound','ignore':![]}];var _0x3ce577=_(_0x5d7db1)[_0x9105('0x2d')](_0x9105('0x2e'))['map'](_0x9105('0x2f'))[_0x9105('0x2f')]();if(_[_0x9105('0x30')](_0x3ce577,_0x3f660c['type'])){return;}var _0x4a7630=_[_0x9105('0x31')](_0x5d7db1,[_0x9105('0x2f'),_0x3f660c[_0x9105('0x32')]])['name'];return db[_0x9105('0x33')][_0x9105('0x28')]({'where':{'type':_0x4a7630,'resourceId':_0x3f660c['id']}})['then'](function(){return _0x474069;});})[_0x9105('0x27')](function(){_0x59f4c3[_0x9105('0x1a')](0xcc)[_0x9105('0x1b')]();});}};}function handleEntityNotFound(_0x4bd38c,_0x52452a){return function(_0x52ea6f){if(!_0x52ea6f){_0x4bd38c['sendStatus'](0x194);}return _0x52ea6f;};}function handleError(_0x121d54,_0x516e85){_0x516e85=_0x516e85||0x1f4;return function(_0x3a49ba){logger['error'](_0x3a49ba[_0x9105('0x34')]);if(_0x3a49ba[_0x9105('0x35')]){delete _0x3a49ba[_0x9105('0x35')];}_0x121d54[_0x9105('0x1a')](_0x516e85)[_0x9105('0x36')](_0x3a49ba);};}exports['index']=function(_0x20043a,_0xcbd370){var _0x458825={},_0x4c9b92={},_0x490e9f={'count':0x0,'rows':[]};var _0x18d0cb=_[_0x9105('0x37')](db[_0x9105('0x38')][_0x9105('0x39')],function(_0x4880c9){return{'name':_0x4880c9[_0x9105('0x3a')],'type':_0x4880c9[_0x9105('0x32')][_0x9105('0x3b')]};});_0x4c9b92[_0x9105('0x3c')]=_[_0x9105('0x37')](_0x18d0cb,_0x9105('0x35'));_0x4c9b92[_0x9105('0x3d')]=_[_0x9105('0x3e')](_0x20043a['query']);_0x4c9b92[_0x9105('0x3f')]=_[_0x9105('0x40')](_0x4c9b92[_0x9105('0x3c')],_0x4c9b92['query']);_0x458825[_0x9105('0x41')]=_[_0x9105('0x40')](_0x4c9b92[_0x9105('0x3c')],qs[_0x9105('0x42')](_0x20043a[_0x9105('0x3d')][_0x9105('0x42')]));_0x458825['attributes']=_0x458825[_0x9105('0x41')][_0x9105('0x43')]?_0x458825[_0x9105('0x41')]:_0x4c9b92[_0x9105('0x3c')];if(!_0x20043a['query'][_0x9105('0x44')](_0x9105('0x45'))){_0x458825['limit']=qs[_0x9105('0x20')](_0x20043a[_0x9105('0x3d')][_0x9105('0x20')]);_0x458825[_0x9105('0x1d')]=qs[_0x9105('0x1d')](_0x20043a[_0x9105('0x3d')][_0x9105('0x1d')]);}_0x458825[_0x9105('0x46')]=qs['sort'](_0x20043a[_0x9105('0x3d')][_0x9105('0x47')]);_0x458825[_0x9105('0x48')]=qs[_0x9105('0x3f')](_['pick'](_0x20043a['query'],_0x4c9b92['filters']),_0x18d0cb);if(_0x20043a[_0x9105('0x3d')]['filter']){_0x458825[_0x9105('0x48')]=_[_0x9105('0x49')](_0x458825[_0x9105('0x48')],{'$or':_['map'](_0x18d0cb,function(_0x3dc106){if(_0x3dc106[_0x9105('0x32')]!==_0x9105('0x4a')){var _0xb6341e={};_0xb6341e[_0x3dc106[_0x9105('0x35')]]={'$like':'%'+_0x20043a[_0x9105('0x3d')][_0x9105('0x2d')]+'%'};return _0xb6341e;}})});}_0x458825=_[_0x9105('0x49')]({},_0x458825,_0x20043a[_0x9105('0x4b')]);var _0x40fd1c={'where':_0x458825[_0x9105('0x48')]};return db[_0x9105('0x38')]['count'](_0x40fd1c)[_0x9105('0x27')](function(_0x284164){_0x490e9f[_0x9105('0x1f')]=_0x284164;if(_0x20043a[_0x9105('0x3d')][_0x9105('0x4c')]){_0x458825['include']=[{'all':!![]}];}return db['VoiceQueue'][_0x9105('0x4d')](_0x458825);})[_0x9105('0x27')](function(_0x2f467b){_0x490e9f[_0x9105('0x4e')]=_0x2f467b;return _0x490e9f;})[_0x9105('0x27')](respondWithFilteredResult(_0xcbd370,_0x458825))['catch'](handleError(_0xcbd370,null));};exports['show']=function(_0x350cd6,_0x412124){var _0xe2c41e={'raw':![],'where':{'id':_0x350cd6[_0x9105('0x4f')]['id']}},_0x453bf8={};_0x453bf8[_0x9105('0x3c')]=_[_0x9105('0x3e')](db[_0x9105('0x38')][_0x9105('0x39')]);_0x453bf8[_0x9105('0x3d')]=_[_0x9105('0x3e')](_0x350cd6[_0x9105('0x3d')]);_0x453bf8[_0x9105('0x3f')]=_['intersection'](_0x453bf8[_0x9105('0x3c')],_0x453bf8['query']);_0xe2c41e[_0x9105('0x41')]=_['intersection'](_0x453bf8[_0x9105('0x3c')],qs[_0x9105('0x42')](_0x350cd6[_0x9105('0x3d')]['fields']));_0xe2c41e[_0x9105('0x41')]=_0xe2c41e[_0x9105('0x41')]['length']?_0xe2c41e[_0x9105('0x41')]:_0x453bf8[_0x9105('0x3c')];if(_0x350cd6[_0x9105('0x3d')][_0x9105('0x4c')]){_0xe2c41e[_0x9105('0x50')]=[{'all':!![]}];}_0xe2c41e=_[_0x9105('0x49')]({},_0xe2c41e,_0x350cd6['options']);return db[_0x9105('0x38')][_0x9105('0x31')](_0xe2c41e)[_0x9105('0x27')](handleEntityNotFound(_0x412124,null))[_0x9105('0x27')](respondWithResult(_0x412124,null))[_0x9105('0x51')](handleError(_0x412124,null));};exports[_0x9105('0x52')]=function(_0x5c4e43,_0x280cce){return db[_0x9105('0x38')][_0x9105('0x52')](_0x5c4e43['body'],{})[_0x9105('0x27')](function(_0x4f61bb){var _0xe17cf2=_0x5c4e43['user'][_0x9105('0x29')]({'plain':!![]});if(!_0xe17cf2)throw new Error(_0x9105('0x53'));if(_0xe17cf2[_0x9105('0x54')]===_0x9105('0x55')){var _0x58142c=_0x4f61bb[_0x9105('0x29')]({'plain':!![]});var _0x1d40e3=[{'name':_0x9105('0x2a'),'value':'inbound'},{'name':_0x9105('0x2c'),'value':_0x9105('0x56')}];var _0x5dcb54=_[_0x9105('0x31')](_0x1d40e3,[_0x9105('0x2f'),_0x58142c[_0x9105('0x32')]])['name'];return db[_0x9105('0x57')][_0x9105('0x31')]({'where':{'name':_0x5dcb54,'userProfileId':_0xe17cf2[_0x9105('0x58')]},'raw':!![]})[_0x9105('0x27')](function(_0x41804e){if(_0x41804e&&_0x41804e[_0x9105('0x59')]===0x0){return db[_0x9105('0x33')]['create']({'name':_0x58142c[_0x9105('0x35')],'resourceId':_0x58142c['id'],'type':_0x41804e['name'],'sectionId':_0x41804e['id']},{})[_0x9105('0x27')](function(){return _0x4f61bb;});}else{return _0x4f61bb;}})[_0x9105('0x51')](function(_0xefbea7){logger[_0x9105('0x5a')](_0x9105('0x5b'),_0xefbea7);throw _0xefbea7;});}return _0x4f61bb;})[_0x9105('0x27')](respondWithResult(_0x280cce,0xc9))['catch'](handleError(_0x280cce,null));};exports[_0x9105('0x5c')]=function(_0x215e8b,_0x520ce5){var _0x424e12={'where':{'id':_0x215e8b[_0x9105('0x4f')]['id']}},_0x3e268a={};_0x3e268a[_0x9105('0x3c')]=_[_0x9105('0x3e')](db[_0x9105('0x38')][_0x9105('0x39')]);_0x424e12['attributes']=_[_0x9105('0x40')](_0x3e268a['model'],qs[_0x9105('0x42')](_0x215e8b['query'][_0x9105('0x42')]));_0x424e12[_0x9105('0x41')]=_0x424e12[_0x9105('0x41')][_0x9105('0x43')]?_0x424e12[_0x9105('0x41')]:_0x3e268a[_0x9105('0x3c')];if(_0x215e8b['query'][_0x9105('0x4c')]){_0x424e12[_0x9105('0x50')]=[{'all':!![]}];}_0x424e12=_[_0x9105('0x49')]({},_0x424e12,_0x215e8b[_0x9105('0x4b')]);return db[_0x9105('0x38')]['find'](_0x424e12)[_0x9105('0x27')](handleEntityNotFound(_0x520ce5,null))['then'](function(_0xfc3378){if(_0xfc3378){var _0x4d3b36=_0xfc3378['get']({'plain':!![]});_0x4d3b36=qs['omit'](_0x4d3b36,['id','createdAt',_0x9105('0x5d')]);_0x215e8b[_0x9105('0x5e')]=_[_0x9105('0x5f')](_0x215e8b[_0x9105('0x5e')],['id','createdAt',_0x9105('0x5d')]);return db[_0x9105('0x38')][_0x9105('0x52')](_[_0x9105('0x49')](_0x4d3b36,_0x215e8b[_0x9105('0x5e')]),{'include':_0x215e8b[_0x9105('0x3d')][_0x9105('0x4c')]?[{'all':!![]}]:undefined})[_0x9105('0x27')](function(_0x3049e7){var _0x451e1f=_0x215e8b['user'][_0x9105('0x29')]({'plain':!![]});if(!_0x451e1f)throw new Error(_0x9105('0x53'));if(_0x451e1f[_0x9105('0x54')]===_0x9105('0x55')){var _0x1a8187=_0x3049e7['get']({'plain':!![]});var _0x26fc6a=[{'name':_0x9105('0x2a'),'value':'inbound'},{'name':_0x9105('0x2c'),'value':_0x9105('0x56')}];var _0x333edd=_['find'](_0x26fc6a,[_0x9105('0x2f'),_0x1a8187[_0x9105('0x32')]])[_0x9105('0x35')];return db['UserProfileSection'][_0x9105('0x31')]({'where':{'name':_0x333edd,'userProfileId':_0x451e1f[_0x9105('0x58')]},'raw':!![]})[_0x9105('0x27')](function(_0x5ba1f3){if(_0x5ba1f3&&_0x5ba1f3['autoAssociation']===0x0){return db[_0x9105('0x33')]['create']({'name':_0x1a8187[_0x9105('0x35')],'resourceId':_0x1a8187['id'],'type':_0x5ba1f3[_0x9105('0x35')],'sectionId':_0x5ba1f3['id']},{})[_0x9105('0x27')](function(){return _0x3049e7;});}else{return _0x3049e7;}})[_0x9105('0x51')](function(_0x1d238f){logger[_0x9105('0x5a')](_0x9105('0x5b'),_0x1d238f);throw _0x1d238f;});}return _0x3049e7;});}})['then'](respondWithResult(_0x520ce5,0xc9))[_0x9105('0x51')](handleError(_0x520ce5,null));};exports[_0x9105('0x26')]=function(_0x45a9f1,_0x195161){if(_0x45a9f1[_0x9105('0x5e')]['id']){delete _0x45a9f1['body']['id'];}return db['VoiceQueue'][_0x9105('0x31')]({'where':{'id':_0x45a9f1['params']['id']}})[_0x9105('0x27')](handleEntityNotFound(_0x195161,null))[_0x9105('0x27')](saveUpdates(_0x45a9f1[_0x9105('0x5e')],null))[_0x9105('0x27')](respondWithResult(_0x195161,null))[_0x9105('0x51')](handleError(_0x195161,null));};exports[_0x9105('0x28')]=function(_0x594536,_0xfce202){return db[_0x9105('0x38')][_0x9105('0x31')]({'where':{'id':_0x594536[_0x9105('0x4f')]['id']}})[_0x9105('0x27')](handleEntityNotFound(_0xfce202,null))[_0x9105('0x27')](removeEntity(_0xfce202,null))[_0x9105('0x51')](handleError(_0xfce202,null));};exports['getHoppers']=function(_0x237e83,_0x2783c8,_0x31fe4b){var _0x8d270e={'raw':![],'where':{}};var _0x177457={};var _0x29eaaf={'count':0x0,'rows':[]};return db[_0x9105('0x38')][_0x9105('0x60')]({'where':{'id':_0x237e83['params']['id']}})[_0x9105('0x27')](handleEntityNotFound(_0x2783c8,null))[_0x9105('0x27')](function(_0xddc159){if(_0xddc159){_0x177457[_0x9105('0x3c')]=_[_0x9105('0x3e')](db[_0x9105('0x61')][_0x9105('0x39')]);_0x177457[_0x9105('0x3d')]=_[_0x9105('0x3e')](_0x237e83[_0x9105('0x3d')]);_0x177457['filters']=_[_0x9105('0x40')](_0x177457[_0x9105('0x3c')],_0x177457[_0x9105('0x3d')]);_0x8d270e[_0x9105('0x41')]=_[_0x9105('0x40')](_0x177457['model'],qs[_0x9105('0x42')](_0x237e83[_0x9105('0x3d')]['fields']));_0x8d270e[_0x9105('0x41')]=_0x8d270e['attributes'][_0x9105('0x43')]?_0x8d270e[_0x9105('0x41')]:_0x177457[_0x9105('0x3c')];if(!_0x237e83[_0x9105('0x3d')][_0x9105('0x44')](_0x9105('0x45'))){_0x8d270e[_0x9105('0x20')]=qs[_0x9105('0x20')](_0x237e83[_0x9105('0x3d')][_0x9105('0x20')]);_0x8d270e[_0x9105('0x1d')]=qs[_0x9105('0x1d')](_0x237e83[_0x9105('0x3d')][_0x9105('0x1d')]);}_0x8d270e[_0x9105('0x46')]=qs[_0x9105('0x47')](_0x237e83[_0x9105('0x3d')]['sort']);_0x8d270e[_0x9105('0x48')]=qs[_0x9105('0x3f')](_[_0x9105('0x62')](_0x237e83['query'],_0x177457[_0x9105('0x3f')]));_0x8d270e[_0x9105('0x48')][_0x9105('0x63')]=_0xddc159['id'];if(_0x237e83[_0x9105('0x3d')]['filter']){_0x8d270e[_0x9105('0x48')]=_['merge'](_0x8d270e[_0x9105('0x48')],{'$or':_['map'](_0x8d270e['attributes'],function(_0x7c16a5){var _0x303aa5={};_0x303aa5[_0x7c16a5]={'$like':'%'+_0x237e83['query']['filter']+'%'};return _0x303aa5;})});}_0x8d270e=_[_0x9105('0x49')]({},_0x8d270e,_0x237e83[_0x9105('0x4b')]);return db[_0x9105('0x61')][_0x9105('0x1f')]({'where':_0x8d270e[_0x9105('0x48')]})[_0x9105('0x27')](function(_0x46aa65){_0x29eaaf[_0x9105('0x1f')]=_0x46aa65;if(_0x237e83[_0x9105('0x3d')]['includeAll']){_0x8d270e[_0x9105('0x50')]=[{'all':!![]}];}return db['CmHopper'][_0x9105('0x4d')](_0x8d270e);})[_0x9105('0x27')](function(_0x53c90d){_0x29eaaf[_0x9105('0x4e')]=_0x53c90d;return _0x29eaaf;});}})[_0x9105('0x27')](respondWithFilteredResult(_0x2783c8,_0x8d270e))['catch'](handleError(_0x2783c8,null));};exports[_0x9105('0x64')]=function(_0x41f238,_0x2b8da9,_0x250966){var _0x21380e={'raw':!![],'where':{}};var _0x26a3d5={};var _0x153036={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x9105('0x60')]({'where':{'id':_0x41f238['params']['id']}})['then'](handleEntityNotFound(_0x2b8da9,null))[_0x9105('0x27')](function(_0x1ab234){if(_0x1ab234){_0x26a3d5[_0x9105('0x3c')]=_['keys'](db[_0x9105('0x65')][_0x9105('0x39')]);_0x26a3d5[_0x9105('0x3d')]=_['keys'](_0x41f238['query']);_0x26a3d5['filters']=_['intersection'](_0x26a3d5['model'],_0x26a3d5[_0x9105('0x3d')]);_0x21380e[_0x9105('0x41')]=_[_0x9105('0x40')](_0x26a3d5[_0x9105('0x3c')],qs[_0x9105('0x42')](_0x41f238['query'][_0x9105('0x42')]));_0x21380e[_0x9105('0x41')]=_0x21380e[_0x9105('0x41')][_0x9105('0x43')]?_0x21380e['attributes']:_0x26a3d5[_0x9105('0x3c')];if(!_0x41f238[_0x9105('0x3d')][_0x9105('0x44')](_0x9105('0x45'))){_0x21380e['limit']=qs['limit'](_0x41f238[_0x9105('0x3d')][_0x9105('0x20')]);_0x21380e['offset']=qs[_0x9105('0x1d')](_0x41f238[_0x9105('0x3d')][_0x9105('0x1d')]);}_0x21380e[_0x9105('0x46')]=qs[_0x9105('0x47')](_0x41f238[_0x9105('0x3d')][_0x9105('0x47')]);_0x21380e[_0x9105('0x48')]=qs['filters'](_['pick'](_0x41f238[_0x9105('0x3d')],_0x26a3d5[_0x9105('0x3f')]));_0x21380e['where'][_0x9105('0x63')]=_0x1ab234['id'];if(_0x41f238[_0x9105('0x3d')][_0x9105('0x2d')]){_0x21380e[_0x9105('0x48')]=_[_0x9105('0x49')](_0x21380e['where'],{'$or':_[_0x9105('0x37')](_0x21380e[_0x9105('0x41')],function(_0x35e092){var _0x307344={};_0x307344[_0x35e092]={'$like':'%'+_0x41f238[_0x9105('0x3d')][_0x9105('0x2d')]+'%'};return _0x307344;})});}_0x21380e=_[_0x9105('0x49')]({},_0x21380e,_0x41f238[_0x9105('0x4b')]);return db[_0x9105('0x65')][_0x9105('0x1f')]({'where':_0x21380e[_0x9105('0x48')]})['then'](function(_0x485973){_0x153036['count']=_0x485973;if(_0x41f238[_0x9105('0x3d')]['includeAll']){_0x21380e[_0x9105('0x50')]=[{'all':!![]}];}return db[_0x9105('0x65')][_0x9105('0x4d')](_0x21380e);})[_0x9105('0x27')](function(_0x3e5e18){_0x153036[_0x9105('0x4e')]=_0x3e5e18;return _0x153036;});}})[_0x9105('0x27')](respondWithFilteredResult(_0x2b8da9,_0x21380e))[_0x9105('0x51')](handleError(_0x2b8da9,null));};exports[_0x9105('0x66')]=function(_0x22431f,_0x3465a4,_0x49f115){var _0x3e0b90={'raw':!![],'where':{}};var _0x4ea184={};var _0x38c519={'count':0x0,'rows':[]};return db[_0x9105('0x38')]['findOne']({'where':{'id':_0x22431f[_0x9105('0x4f')]['id']}})[_0x9105('0x27')](handleEntityNotFound(_0x3465a4,null))['then'](function(_0x3bc127){if(_0x3bc127){_0x4ea184[_0x9105('0x3c')]=_[_0x9105('0x3e')](db[_0x9105('0x67')][_0x9105('0x39')]);_0x4ea184['query']=_[_0x9105('0x3e')](_0x22431f['query']);_0x4ea184[_0x9105('0x3f')]=_['intersection'](_0x4ea184['model'],_0x4ea184['query']);_0x3e0b90[_0x9105('0x41')]=_[_0x9105('0x40')](_0x4ea184[_0x9105('0x3c')],qs[_0x9105('0x42')](_0x22431f[_0x9105('0x3d')][_0x9105('0x42')]));_0x3e0b90[_0x9105('0x41')]=_0x3e0b90[_0x9105('0x41')][_0x9105('0x43')]?_0x3e0b90[_0x9105('0x41')]:_0x4ea184['model'];if(!_0x22431f[_0x9105('0x3d')]['hasOwnProperty'](_0x9105('0x45'))){_0x3e0b90[_0x9105('0x20')]=qs[_0x9105('0x20')](_0x22431f[_0x9105('0x3d')][_0x9105('0x20')]);_0x3e0b90[_0x9105('0x1d')]=qs['offset'](_0x22431f['query'][_0x9105('0x1d')]);}_0x3e0b90[_0x9105('0x46')]=qs[_0x9105('0x47')](_0x22431f['query'][_0x9105('0x47')]);_0x3e0b90[_0x9105('0x48')]=qs[_0x9105('0x3f')](_['pick'](_0x22431f[_0x9105('0x3d')],_0x4ea184[_0x9105('0x3f')]));_0x3e0b90[_0x9105('0x48')]['VoiceQueueId']=_0x3bc127['id'];if(_0x22431f[_0x9105('0x3d')]['filter']){_0x3e0b90[_0x9105('0x48')]=_[_0x9105('0x49')](_0x3e0b90[_0x9105('0x48')],{'$or':_['map'](_0x3e0b90[_0x9105('0x41')],function(_0x4fa48d){var _0x121b43={};_0x121b43[_0x4fa48d]={'$like':'%'+_0x22431f[_0x9105('0x3d')]['filter']+'%'};return _0x121b43;})});}_0x3e0b90=_[_0x9105('0x49')]({},_0x3e0b90,_0x22431f['options']);return db[_0x9105('0x67')][_0x9105('0x1f')]({'where':_0x3e0b90[_0x9105('0x48')]})['then'](function(_0x27051b){_0x38c519[_0x9105('0x1f')]=_0x27051b;if(_0x22431f[_0x9105('0x3d')]['includeAll']){_0x3e0b90[_0x9105('0x50')]=[{'all':!![]}];}return db[_0x9105('0x67')][_0x9105('0x4d')](_0x3e0b90);})[_0x9105('0x27')](function(_0x4c0c71){_0x38c519[_0x9105('0x4e')]=_0x4c0c71;return _0x38c519;});}})['then'](respondWithFilteredResult(_0x3465a4,_0x3e0b90))[_0x9105('0x51')](handleError(_0x3465a4,null));};exports[_0x9105('0x68')]=function(_0x52ff3c,_0x13f068,_0x162f7b){var _0x5f3c8f={'raw':!![],'where':{}};var _0x4b6d13={};var _0x33b1f7={'count':0x0,'rows':[]};return db[_0x9105('0x38')]['findOne']({'where':{'id':_0x52ff3c[_0x9105('0x4f')]['id']}})[_0x9105('0x27')](handleEntityNotFound(_0x13f068,null))[_0x9105('0x27')](function(_0x2caa34){if(_0x2caa34){_0x4b6d13[_0x9105('0x3c')]=_[_0x9105('0x3e')](db[_0x9105('0x69')]['rawAttributes']);_0x4b6d13['query']=_[_0x9105('0x3e')](_0x52ff3c['query']);_0x4b6d13[_0x9105('0x3f')]=_[_0x9105('0x40')](_0x4b6d13[_0x9105('0x3c')],_0x4b6d13[_0x9105('0x3d')]);_0x5f3c8f[_0x9105('0x41')]=_[_0x9105('0x40')](_0x4b6d13[_0x9105('0x3c')],qs[_0x9105('0x42')](_0x52ff3c[_0x9105('0x3d')][_0x9105('0x42')]));_0x5f3c8f['attributes']=_0x5f3c8f[_0x9105('0x41')][_0x9105('0x43')]?_0x5f3c8f['attributes']:_0x4b6d13[_0x9105('0x3c')];if(!_0x52ff3c['query']['hasOwnProperty'](_0x9105('0x45'))){_0x5f3c8f[_0x9105('0x20')]=qs[_0x9105('0x20')](_0x52ff3c['query'][_0x9105('0x20')]);_0x5f3c8f['offset']=qs[_0x9105('0x1d')](_0x52ff3c['query'][_0x9105('0x1d')]);}_0x5f3c8f[_0x9105('0x46')]=qs[_0x9105('0x47')](_0x52ff3c[_0x9105('0x3d')][_0x9105('0x47')]);_0x5f3c8f['where']=qs['filters'](_[_0x9105('0x62')](_0x52ff3c[_0x9105('0x3d')],_0x4b6d13[_0x9105('0x3f')]));_0x5f3c8f[_0x9105('0x48')][_0x9105('0x63')]=_0x2caa34['id'];if(_0x52ff3c['query']['filter']){_0x5f3c8f['where']=_[_0x9105('0x49')](_0x5f3c8f[_0x9105('0x48')],{'$or':_[_0x9105('0x37')](_0x5f3c8f[_0x9105('0x41')],function(_0x459673){var _0x4ebfe9={};_0x4ebfe9[_0x459673]={'$like':'%'+_0x52ff3c['query']['filter']+'%'};return _0x4ebfe9;})});}_0x5f3c8f=_[_0x9105('0x49')]({},_0x5f3c8f,_0x52ff3c['options']);return db[_0x9105('0x69')][_0x9105('0x1f')]({'where':_0x5f3c8f[_0x9105('0x48')]})[_0x9105('0x27')](function(_0x390cb1){_0x33b1f7[_0x9105('0x1f')]=_0x390cb1;if(_0x52ff3c['query'][_0x9105('0x4c')]){_0x5f3c8f[_0x9105('0x50')]=[{'all':!![]}];}return db[_0x9105('0x69')][_0x9105('0x4d')](_0x5f3c8f);})[_0x9105('0x27')](function(_0x5a1448){_0x33b1f7['rows']=_0x5a1448;return _0x33b1f7;});}})[_0x9105('0x27')](respondWithFilteredResult(_0x13f068,_0x5f3c8f))['catch'](handleError(_0x13f068,null));};exports['getTeams']=function(_0x12992f,_0x263337,_0x38a396){var _0x25fbf9={};var _0x24f60a={};var _0x4dd138;var _0x180470;return db[_0x9105('0x38')][_0x9105('0x60')]({'where':{'id':_0x12992f[_0x9105('0x4f')]['id']}})[_0x9105('0x27')](handleEntityNotFound(_0x263337,null))['then'](function(_0x103b8f){if(_0x103b8f){_0x4dd138=_0x103b8f;_0x24f60a['model']=_['keys'](db[_0x9105('0x6a')]['rawAttributes']);_0x24f60a[_0x9105('0x3d')]=_['keys'](_0x12992f[_0x9105('0x3d')]);_0x24f60a['filters']=_[_0x9105('0x40')](_0x24f60a['model'],_0x24f60a['query']);_0x25fbf9['attributes']=_['intersection'](_0x24f60a[_0x9105('0x3c')],qs['fields'](_0x12992f[_0x9105('0x3d')][_0x9105('0x42')]));_0x25fbf9['attributes']=_0x25fbf9[_0x9105('0x41')][_0x9105('0x43')]?_0x25fbf9[_0x9105('0x41')]:_0x24f60a['model'];_0x25fbf9[_0x9105('0x46')]=qs[_0x9105('0x47')](_0x12992f[_0x9105('0x3d')][_0x9105('0x47')]);_0x25fbf9[_0x9105('0x48')]=qs[_0x9105('0x3f')](_[_0x9105('0x62')](_0x12992f[_0x9105('0x3d')],_0x24f60a['filters']));if(_0x12992f['query'][_0x9105('0x2d')]){_0x25fbf9[_0x9105('0x48')]=_[_0x9105('0x49')](_0x25fbf9[_0x9105('0x48')],{'$or':_[_0x9105('0x37')](_0x25fbf9[_0x9105('0x41')],function(_0x27e335){var _0x517b85={};_0x517b85[_0x27e335]={'$like':'%'+_0x12992f['query']['filter']+'%'};return _0x517b85;})});}_0x25fbf9=_['merge']({},_0x25fbf9,_0x12992f[_0x9105('0x4b')]);return _0x4dd138[_0x9105('0x6b')](_0x25fbf9);}})[_0x9105('0x27')](function(_0x100dad){if(_0x100dad){_0x180470=_0x100dad['length'];if(!_0x12992f[_0x9105('0x3d')]['hasOwnProperty'](_0x9105('0x45'))){_0x25fbf9[_0x9105('0x20')]=qs[_0x9105('0x20')](_0x12992f[_0x9105('0x3d')][_0x9105('0x20')]);_0x25fbf9['offset']=qs[_0x9105('0x1d')](_0x12992f[_0x9105('0x3d')][_0x9105('0x1d')]);}return _0x4dd138[_0x9105('0x6b')](_0x25fbf9);}})[_0x9105('0x27')](function(_0x2862f5){if(_0x2862f5){return _0x2862f5?{'count':_0x180470,'rows':_0x2862f5}:null;}})['then'](respondWithResult(_0x263337,null))['catch'](handleError(_0x263337,null));};exports[_0x9105('0x6c')]=function(_0x1a7f8d,_0x53afda,_0x1a4fd6){var _0x4e71fd=_0x1a7f8d[_0x9105('0x5e')][_0x9105('0x6d')];var _0x217c17=_[_0x9105('0x37')](_0x4e71fd,'id');return db[_0x9105('0x6a')]['findAll']({'where':{'id':_0x217c17},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9105('0x6e'),'attributes':['id',_0x9105('0x35'),_0x9105('0x6f'),_0x9105('0x70'),'interface'],'raw':!![]}]})[_0x9105('0x27')](function(_0x5d41e2){if(_0x5d41e2){var _0x5064d5=_['flatMap'](_0x5d41e2,function(_0x5cff60){var _0x4d1317=_0x5cff60[_0x9105('0x29')]({'plain':!![]});_0x4d1317[_0x9105('0x6e')][_0x9105('0x71')](function(_0x354c7a){_0x354c7a[_0x9105('0x72')]=_[_0x9105('0x31')](_0x4e71fd,{'id':_0x4d1317['id']})[_0x9105('0x72')];});return _0x4d1317[_0x9105('0x6e')];});return db[_0x9105('0x38')]['find']({'where':{'id':_0x1a7f8d['params']['id']}})[_0x9105('0x27')](function(_0x33383e){return db[_0x9105('0x73')][_0x9105('0x74')](function(_0x4a572f){return _0x33383e[_0x9105('0x6c')](_0x217c17,{'transaction':_0x4a572f})[_0x9105('0x27')](function(){return BPromise[_0x9105('0x75')](_0x4e71fd,function(_0x2a6c1e){return db[_0x9105('0x76')][_0x9105('0x77')]({'TeamId':_0x2a6c1e['id'],'VoiceQueueId':_0x1a7f8d[_0x9105('0x4f')]['id'],'penalty':_0x2a6c1e[_0x9105('0x72')]},{'transaction':_0x4a572f});});})[_0x9105('0x27')](function(){return BPromise[_0x9105('0x75')](_0x5064d5,function(_0x217329){return db[_0x9105('0x78')][_0x9105('0x79')]({'where':{'UserId':_0x217329['id'],'VoiceQueueId':_0x1a7f8d['params']['id']},'defaults':{'penalty':_0x217329[_0x9105('0x72')]},'transaction':_0x4a572f});});})[_0x9105('0x27')](function(){return BPromise['each'](_['filter'](_0x5064d5,{'online':!![]}),function(_0x1a80be){return db['UserVoiceQueueRt'][_0x9105('0x77')]({'membername':_0x1a80be[_0x9105('0x35')],'UserId':_0x1a80be['id'],'queue_name':_0x33383e[_0x9105('0x35')],'VoiceQueueId':_0x33383e['id'],'interface':_['isNil'](_0x1a80be[_0x9105('0x7a')])?util[_0x9105('0x7b')](_0x9105('0x7c'),_0x1a80be[_0x9105('0x35')]):_0x1a80be[_0x9105('0x7a')],'paused':_0x1a80be['voicePause']||![],'penalty':_0x1a80be[_0x9105('0x72')]},{'transaction':_0x4a572f});});})[_0x9105('0x27')](function(){_0x5064d5[_0x9105('0x71')](function(_0x3192d5){socket[_0x9105('0x7d')](_0x9105('0x7e'),{'UserId':_0x3192d5['id'],'VoiceQueueId':_0x33383e['id']});});});});});}})['then'](respondWithStatusCode(_0x53afda,null))[_0x9105('0x51')](handleError(_0x53afda,null));};exports[_0x9105('0x7f')]=function(_0x184937,_0x5291d4,_0x293260){return db[_0x9105('0x6a')][_0x9105('0x4d')]({'where':{'id':_0x184937['query'][_0x9105('0x80')]},'attributes':['id'],'include':[{'model':db[_0x9105('0x81')],'as':_0x9105('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x9105('0x27')](handleEntityNotFound(_0x5291d4,null))['then'](function(_0x2258a4){var _0x502490=_[_0x9105('0x37')](_0x2258a4,'id');var _0x4726d8=[];var _0x424df7=[];var _0x4b91a2=squel['select']();_0x4b91a2[_0x9105('0x82')](_0x9105('0x83'))[_0x9105('0x84')]('team_has_voice_queues','tq')[_0x9105('0x85')]('user_has_teams','ut',_0x9105('0x86'))[_0x9105('0x48')](_0x9105('0x87'),_0x184937[_0x9105('0x4f')]['id']);for(var _0x534c54=0x0;_0x534c54<_0x2258a4[_0x9105('0x43')];_0x534c54+=0x1){let _0x11559c=_0x2258a4[_0x534c54];for(var _0x2cbfee=0x0;_0x2cbfee<_0x11559c[_0x9105('0x6e')][_0x9105('0x43')];_0x2cbfee+=0x1){let _0x2bd972=_0x11559c['Agents'][_0x2cbfee];var _0x90f08a=_0x4b91a2[_0x9105('0x5c')]();_0x90f08a[_0x9105('0x48')](_0x9105('0x88'),_0x2bd972['id']);_0x424df7['push'](db[_0x9105('0x73')][_0x9105('0x3d')](_0x90f08a[_0x9105('0x89')](),{'type':db[_0x9105('0x73')][_0x9105('0x8a')][_0x9105('0x8b')]})['then'](function(_0x1933d3){if(_0x1933d3[_0x9105('0x43')]===0x1){return _0x2bd972['id'];}else{var _0x4ffc7e=_[_0x9105('0x8c')](_[_0x9105('0x37')](_0x1933d3,_0x9105('0x8d')),function(_0x4d684a){return _[_0x9105('0x30')](_0x502490,_0x4d684a);});if(_0x4ffc7e){return _0x2bd972['id'];}}}));}}return BPromise[_0x9105('0x8e')](_0x424df7)[_0x9105('0x27')](function(_0x47e5c4){_0x4726d8=_(_0x4726d8)[_0x9105('0x8f')](_0x47e5c4)[_0x9105('0x90')]()['value']();return db[_0x9105('0x38')][_0x9105('0x31')]({'where':{'id':_0x184937['params']['id']}})[_0x9105('0x27')](function(_0x2f3a35){return db[_0x9105('0x73')][_0x9105('0x74')](function(_0x183cfd){return _0x2f3a35[_0x9105('0x7f')](_0x184937[_0x9105('0x3d')]['ids'],{'transaction':_0x183cfd})[_0x9105('0x27')](function(){if(!_[_0x9105('0x91')](_0x4726d8)){return _0x2f3a35[_0x9105('0x92')](_0x4726d8,{'transaction':_0x183cfd})['then'](function(){return db[_0x9105('0x93')][_0x9105('0x28')]({'where':{'VoiceQueueId':_0x184937[_0x9105('0x4f')]['id'],'UserId':_0x4726d8},'transaction':_0x183cfd});});}})[_0x9105('0x27')](function(){_0x4726d8[_0x9105('0x71')](function(_0x443a13){socket[_0x9105('0x7d')]('userVoiceQueue:remove',{'UserId':_0x443a13,'VoiceQueueId':_0x2f3a35['id']});});});});});});})[_0x9105('0x27')](respondWithStatusCode(_0x5291d4,null))[_0x9105('0x51')](handleError(_0x5291d4,null));};exports[_0x9105('0x94')]=function(_0x1f3cf6,_0x46cd2c,_0x29545f){var _0x367640,_0xac62ef;return db[_0x9105('0x38')][_0x9105('0x31')]({'where':{'id':_0x1f3cf6['params']['id']}})[_0x9105('0x27')](handleEntityNotFound(_0x46cd2c,null))[_0x9105('0x27')](function(_0xe26b3e){if(_0xe26b3e){_0xac62ef=_0xe26b3e;return _0xe26b3e[_0x9105('0x94')](_0x1f3cf6[_0x9105('0x5e')][_0x9105('0x80')],_[_0x9105('0x5f')](_0x1f3cf6['body'],[_0x9105('0x80'),'id'])||{})[_0x9105('0x95')](function(_0x692674){for(var _0x5bfc14=0x0;_0x5bfc14<_0x1f3cf6['body'][_0x9105('0x80')]['length'];_0x5bfc14+=0x1){socket[_0x9105('0x7d')](_0x9105('0x7e'),{'UserId':Number(_0x1f3cf6['body']['ids'][_0x5bfc14]),'VoiceQueueId':Number(_0x1f3cf6[_0x9105('0x4f')]['id'])});}return _0x692674;});}})['then'](function(_0x55642f){_0x367640=_0x55642f||[];if(_0xac62ef){return db[_0x9105('0x81')]['findAll']({'where':{'id':_0x1f3cf6[_0x9105('0x5e')]['ids']},'attributes':['id',_0x9105('0x35'),_0x9105('0x6f'),_0x9105('0x70'),_0x9105('0x7a')],'raw':!![]});}})[_0x9105('0x27')](function(_0x4ea349){if(!_[_0x9105('0x91')](_0x4ea349)){var _0x285ae4=[];for(var _0x1c2d16=0x0;_0x1c2d16<_0x4ea349[_0x9105('0x43')];_0x1c2d16++){if(_0x4ea349[_0x1c2d16][_0x9105('0x6f')]){_0x285ae4[_0x9105('0x96')](db['UserVoiceQueueRt']['upsert']({'membername':_0x4ea349[_0x1c2d16][_0x9105('0x35')],'UserId':_0x4ea349[_0x1c2d16]['id'],'queue_name':_0xac62ef[_0x9105('0x35')],'VoiceQueueId':_0xac62ef['id'],'interface':_[_0x9105('0x97')](_0x4ea349[_0x1c2d16][_0x9105('0x7a')])?util[_0x9105('0x7b')](_0x9105('0x7c'),_0x4ea349[_0x1c2d16][_0x9105('0x35')]):_0x4ea349[_0x1c2d16][_0x9105('0x7a')],'paused':_0x4ea349[_0x1c2d16][_0x9105('0x70')]||![],'penalty':_0x1f3cf6[_0x9105('0x5e')]['penalty']||0x0}));}}return BPromise[_0x9105('0x8e')](_0x285ae4);}})[_0x9105('0x27')](function(){return _0x367640;})[_0x9105('0x27')](respondWithResult(_0x46cd2c,null))[_0x9105('0x51')](handleError(_0x46cd2c,null));};exports[_0x9105('0x92')]=function(_0x810f97,_0x274eb8,_0x38d743){return db[_0x9105('0x38')][_0x9105('0x31')]({'where':{'id':_0x810f97[_0x9105('0x4f')]['id']}})['then'](handleEntityNotFound(_0x274eb8,null))['then'](function(_0x1097c7){if(_0x1097c7){return _0x1097c7[_0x9105('0x92')](_0x810f97['query'][_0x9105('0x80')])['then'](function(){if(_[_0x9105('0x98')](_0x810f97[_0x9105('0x3d')][_0x9105('0x80')])){for(var _0x35bd8d=0x0;_0x35bd8d<_0x810f97[_0x9105('0x3d')][_0x9105('0x80')][_0x9105('0x43')];_0x35bd8d+=0x1){socket[_0x9105('0x7d')](_0x9105('0x99'),{'UserId':Number(_0x810f97[_0x9105('0x3d')]['ids'][_0x35bd8d]),'VoiceQueueId':Number(_0x810f97[_0x9105('0x4f')]['id'])});}}else{socket[_0x9105('0x7d')](_0x9105('0x99'),{'UserId':Number(_0x810f97['query']['ids']),'VoiceQueueId':Number(_0x810f97[_0x9105('0x4f')]['id'])});}});}})['then'](function(_0x5078cb){return db[_0x9105('0x93')]['destroy']({'where':{'VoiceQueueId':_0x810f97['params']['id'],'UserId':_0x810f97[_0x9105('0x3d')]['ids']}})[_0x9105('0x27')](function(){return _0x5078cb;});})[_0x9105('0x27')](respondWithStatusCode(_0x274eb8,null))['catch'](handleError(_0x274eb8,null));};exports[_0x9105('0x9a')]=function(_0x2f3253,_0x29051c,_0xf7d537){var _0x508fa1={};var _0x186d92={};var _0x40d363;var _0x4fd875;return db['VoiceQueue']['findOne']({'where':{'id':_0x2f3253[_0x9105('0x4f')]['id']}})['then'](handleEntityNotFound(_0x29051c,null))[_0x9105('0x27')](function(_0x5352a1){if(_0x5352a1){_0x40d363=_0x5352a1;_0x186d92[_0x9105('0x3c')]=_['keys'](db['User'][_0x9105('0x39')]);_0x186d92[_0x9105('0x3d')]=_[_0x9105('0x3e')](_0x2f3253[_0x9105('0x3d')]);_0x186d92[_0x9105('0x3f')]=_[_0x9105('0x40')](_0x186d92[_0x9105('0x3c')],_0x186d92[_0x9105('0x3d')]);_0x508fa1[_0x9105('0x41')]=_['intersection'](_0x186d92[_0x9105('0x3c')],qs[_0x9105('0x42')](_0x2f3253['query'][_0x9105('0x42')]));_0x508fa1['attributes']=_0x508fa1[_0x9105('0x41')]['length']?_0x508fa1['attributes']:_0x186d92[_0x9105('0x3c')];_0x508fa1[_0x9105('0x46')]=qs[_0x9105('0x47')](_0x2f3253['query'][_0x9105('0x47')]);_0x508fa1[_0x9105('0x48')]=qs[_0x9105('0x3f')](_[_0x9105('0x62')](_0x2f3253[_0x9105('0x3d')],_0x186d92['filters']));if(_0x2f3253[_0x9105('0x3d')][_0x9105('0x2d')]){_0x508fa1['where']=_[_0x9105('0x49')](_0x508fa1[_0x9105('0x48')],{'$or':_[_0x9105('0x37')](_0x508fa1[_0x9105('0x41')],function(_0x25b910){var _0x8d00e8={};_0x8d00e8[_0x25b910]={'$like':'%'+_0x2f3253[_0x9105('0x3d')][_0x9105('0x2d')]+'%'};return _0x8d00e8;})});}_0x508fa1=_[_0x9105('0x49')]({},_0x508fa1,_0x2f3253[_0x9105('0x4b')]);return _0x40d363['getAgents'](_0x508fa1);}})[_0x9105('0x27')](function(_0x5cbb57){if(_0x5cbb57){_0x4fd875=_0x5cbb57[_0x9105('0x43')];if(!_0x2f3253[_0x9105('0x3d')][_0x9105('0x44')](_0x9105('0x45'))){_0x508fa1['limit']=qs[_0x9105('0x20')](_0x2f3253[_0x9105('0x3d')][_0x9105('0x20')]);_0x508fa1[_0x9105('0x1d')]=qs['offset'](_0x2f3253[_0x9105('0x3d')][_0x9105('0x1d')]);}return _0x40d363[_0x9105('0x9a')](_0x508fa1);}})[_0x9105('0x27')](function(_0x504411){if(_0x504411){return _0x504411?{'count':_0x4fd875,'rows':_0x504411}:null;}})[_0x9105('0x27')](respondWithResult(_0x29051c,null))[_0x9105('0x51')](handleError(_0x29051c,null));};exports[_0x9105('0x9b')]=function(_0x3b41b1,_0x26bf03,_0x306292){var _0x134234={};var _0x5319c5={};var _0x5d9dea;var _0xc1964f;return db[_0x9105('0x38')][_0x9105('0x60')]({'where':{'id':_0x3b41b1[_0x9105('0x4f')]['id']}})[_0x9105('0x27')](handleEntityNotFound(_0x26bf03,null))[_0x9105('0x27')](function(_0x25d45c){if(_0x25d45c){_0x5d9dea=_0x25d45c;_0x5319c5[_0x9105('0x3c')]=_[_0x9105('0x3e')](db[_0x9105('0x93')][_0x9105('0x39')]);_0x5319c5['query']=_[_0x9105('0x3e')](_0x3b41b1[_0x9105('0x3d')]);_0x5319c5[_0x9105('0x3f')]=_['intersection'](_0x5319c5[_0x9105('0x3c')],_0x5319c5['query']);_0x134234[_0x9105('0x41')]=_['intersection'](_0x5319c5[_0x9105('0x3c')],qs['fields'](_0x3b41b1[_0x9105('0x3d')][_0x9105('0x42')]));_0x134234[_0x9105('0x41')]=_0x134234['attributes'][_0x9105('0x43')]?_0x134234[_0x9105('0x41')]:_0x5319c5['model'];_0x134234[_0x9105('0x46')]=qs['sort'](_0x3b41b1[_0x9105('0x3d')]['sort']);_0x134234[_0x9105('0x48')]=qs[_0x9105('0x3f')](_['pick'](_0x3b41b1[_0x9105('0x3d')],_0x5319c5[_0x9105('0x3f')]));if(_0x3b41b1[_0x9105('0x3d')]['filter']){_0x134234[_0x9105('0x48')]=_[_0x9105('0x49')](_0x134234[_0x9105('0x48')],{'$or':_[_0x9105('0x37')](_0x134234[_0x9105('0x41')],function(_0x42956e){var _0x3e5c58={};_0x3e5c58[_0x42956e]={'$like':'%'+_0x3b41b1[_0x9105('0x3d')]['filter']+'%'};return _0x3e5c58;})});}_0x134234=_[_0x9105('0x49')]({},_0x134234,_0x3b41b1['options']);return _0x5d9dea[_0x9105('0x9b')](_0x134234);}})[_0x9105('0x27')](function(_0x193756){if(_0x193756){_0xc1964f=_0x193756[_0x9105('0x43')];if(!_0x3b41b1[_0x9105('0x3d')][_0x9105('0x44')]('nolimit')){_0x134234[_0x9105('0x20')]=qs[_0x9105('0x20')](_0x3b41b1[_0x9105('0x3d')][_0x9105('0x20')]);_0x134234[_0x9105('0x1d')]=qs[_0x9105('0x1d')](_0x3b41b1['query'][_0x9105('0x1d')]);}return _0x5d9dea['getMembers'](_0x134234);}})[_0x9105('0x27')](function(_0x577fba){return _0x577fba?{'count':_0xc1964f,'rows':_0x577fba}:null;})[_0x9105('0x27')](respondWithResult(_0x26bf03,null))['catch'](handleError(_0x26bf03,null));};exports['getLists']=function(_0x108aa2,_0xd45c3e,_0x110fd8){var _0x3533e8={};var _0x61b3a2={};var _0x2d2942;var _0x28a51c;return db['VoiceQueue']['findOne']({'where':{'id':_0x108aa2[_0x9105('0x4f')]['id']}})[_0x9105('0x27')](handleEntityNotFound(_0xd45c3e,null))[_0x9105('0x27')](function(_0x546289){if(_0x546289){_0x2d2942=_0x546289;_0x61b3a2['model']=_[_0x9105('0x3e')](db[_0x9105('0x9c')]['rawAttributes']);_0x61b3a2[_0x9105('0x3d')]=_['keys'](_0x108aa2[_0x9105('0x3d')]);_0x61b3a2['filters']=_[_0x9105('0x40')](_0x61b3a2[_0x9105('0x3c')],_0x61b3a2[_0x9105('0x3d')]);_0x3533e8[_0x9105('0x41')]=_[_0x9105('0x40')](_0x61b3a2['model'],qs[_0x9105('0x42')](_0x108aa2[_0x9105('0x3d')][_0x9105('0x42')]));_0x3533e8[_0x9105('0x41')]=_0x3533e8['attributes'][_0x9105('0x43')]?_0x3533e8[_0x9105('0x41')]:_0x61b3a2[_0x9105('0x3c')];_0x3533e8[_0x9105('0x46')]=qs[_0x9105('0x47')](_0x108aa2[_0x9105('0x3d')][_0x9105('0x47')]);_0x3533e8[_0x9105('0x48')]=qs[_0x9105('0x3f')](_['pick'](_0x108aa2[_0x9105('0x3d')],_0x61b3a2[_0x9105('0x3f')]));if(_0x108aa2[_0x9105('0x3d')]['filter']){_0x3533e8[_0x9105('0x48')]=_['merge'](_0x3533e8[_0x9105('0x48')],{'$or':_[_0x9105('0x37')](_0x3533e8[_0x9105('0x41')],function(_0xaf3fab){var _0x51aa79={};_0x51aa79[_0xaf3fab]={'$like':'%'+_0x108aa2[_0x9105('0x3d')][_0x9105('0x2d')]+'%'};return _0x51aa79;})});}_0x3533e8=_[_0x9105('0x49')]({},_0x3533e8,_0x108aa2[_0x9105('0x4b')]);return _0x2d2942['getLists'](_0x3533e8);}})[_0x9105('0x27')](function(_0xb9233c){if(_0xb9233c){_0x28a51c=_0xb9233c[_0x9105('0x43')];if(!_0x108aa2[_0x9105('0x3d')][_0x9105('0x44')](_0x9105('0x45'))){_0x3533e8['limit']=qs[_0x9105('0x20')](_0x108aa2[_0x9105('0x3d')][_0x9105('0x20')]);_0x3533e8[_0x9105('0x1d')]=qs['offset'](_0x108aa2[_0x9105('0x3d')][_0x9105('0x1d')]);}return _0x2d2942[_0x9105('0x9d')](_0x3533e8);}})[_0x9105('0x27')](function(_0x21129f){if(_0x21129f){return _0x21129f?{'count':_0x28a51c,'rows':_0x21129f}:null;}})[_0x9105('0x27')](respondWithResult(_0xd45c3e,null))[_0x9105('0x51')](handleError(_0xd45c3e,null));};exports['addLists']=function(_0x2c0bc6,_0x29f6f6,_0x160331){var _0x324232=moment()[_0x9105('0x7b')](_0x9105('0x9e'));var _0x1ada72,_0x49eecb;return db['VoiceQueue'][_0x9105('0x31')]({'where':{'id':_0x2c0bc6[_0x9105('0x4f')]['id']}})[_0x9105('0x27')](handleEntityNotFound(_0x29f6f6,null))[_0x9105('0x27')](function(_0x210212){if(_0x210212){_0x49eecb=_0x210212;return _0x210212[_0x9105('0x9f')](_0x2c0bc6[_0x9105('0x5e')][_0x9105('0x80')],_['omit'](_0x2c0bc6[_0x9105('0x5e')],[_0x9105('0x80'),'id'])||{});}return null;})[_0x9105('0x95')](function(_0x36f404){var _0x3d08cd;_0x1ada72=_0x36f404||[];var _0x1abca6=[];if(_0x36f404){for(var _0x4ee4b8=0x0;_0x4ee4b8<_0x36f404['length'];_0x4ee4b8+=0x1){var _0x29d928=_0x36f404[_0x4ee4b8][_0x9105('0x29')]({'plain':!![]});_0x49eecb[_0x9105('0xa0')]=_0x2c0bc6[_0x9105('0x5e')][_0x9105('0xa0')]?_0x2c0bc6[_0x9105('0x5e')][_0x9105('0xa0')]:_0x49eecb[_0x9105('0xa0')];switch(_0x49eecb[_0x9105('0xa0')]){case _0x9105('0xa1'):_0x3d08cd=squel[_0x9105('0xa2')]()['into'](_0x9105('0xa3'))[_0x9105('0xa4')](['phone','scheduledAt','ContactId','ListId',_0x9105('0x63'),_0x9105('0xa5'),_0x9105('0x5d')],squel[_0x9105('0xa6')]()['field'](_0x9105('0xa7'),_0x9105('0xa7'))[_0x9105('0x82')]('\x27'+_0x324232+'\x27',_0x9105('0xa8'))[_0x9105('0x82')]('id',_0x9105('0xa9'))[_0x9105('0x82')](_0x29d928[_0x9105('0xaa')][_0x9105('0x89')](),_0x9105('0xab'))['field'](_0x2c0bc6[_0x9105('0x4f')]['id'][_0x9105('0x89')](),'VoiceQueueId')[_0x9105('0x82')]('\x27'+_0x324232+'\x27',_0x9105('0xa5'))[_0x9105('0x82')]('\x27'+_0x324232+'\x27',_0x9105('0x5d'))[_0x9105('0x84')](_0x9105('0xac'))[_0x9105('0x48')]('deletedAt\x20IS\x20NULL')[_0x9105('0x48')](_0x9105('0xad'),_0x29d928[_0x9105('0xaa')][_0x9105('0x89')]())[_0x9105('0x48')](_0x9105('0xae'))['where'](_0x9105('0xaf'),squel['select']()[_0x9105('0x82')](_0x9105('0xb0'))['from'](_0x9105('0xb1'))[_0x9105('0x48')](_0x9105('0x87'),_0x2c0bc6[_0x9105('0x4f')]['id'][_0x9105('0x89')]()))[_0x9105('0x48')](_0x9105('0xaf'),squel['select']()['field']('COALESCE(phone,\x27\x27)')['from'](_0x9105('0xa3'))[_0x9105('0x48')](_0x9105('0x87'),_0x2c0bc6[_0x9105('0x4f')]['id'][_0x9105('0x89')]())))[_0x9105('0x89')]();break;case _0x9105('0xb2'):_0x3d08cd=squel[_0x9105('0xa2')]()[_0x9105('0xb3')]('cm_hopper')['fromQuery'](['phone',_0x9105('0xa8'),_0x9105('0xa9'),'ListId',_0x9105('0x63'),_0x9105('0xa5'),'updatedAt'],squel['select']()[_0x9105('0x82')](_0x9105('0xa7'),_0x9105('0xa7'))[_0x9105('0x82')]('\x27'+_0x324232+'\x27',_0x9105('0xa8'))[_0x9105('0x82')]('id',_0x9105('0xa9'))['field'](_0x29d928[_0x9105('0xaa')][_0x9105('0x89')](),'ListId')[_0x9105('0x82')](_0x2c0bc6['params']['id'][_0x9105('0x89')](),_0x9105('0x63'))['field']('\x27'+_0x324232+'\x27','createdAt')[_0x9105('0x82')]('\x27'+_0x324232+'\x27',_0x9105('0x5d'))[_0x9105('0x84')](_0x9105('0xac'))['where'](_0x9105('0xb4'))['where'](_0x9105('0xad'),_0x29d928['CmListId'][_0x9105('0x89')]())[_0x9105('0x48')](_0x9105('0xae'))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x9105('0x82')](_0x9105('0xb5'))['from']('cm_hopper')[_0x9105('0x48')](_0x9105('0x87'),_0x2c0bc6[_0x9105('0x4f')]['id'][_0x9105('0x89')]())))[_0x9105('0x89')]();break;default:_0x3d08cd=squel[_0x9105('0xa2')]()['into'](_0x9105('0xa3'))[_0x9105('0xa4')]([_0x9105('0xa7'),_0x9105('0xa8'),_0x9105('0xa9'),'ListId',_0x9105('0x63'),_0x9105('0xa5'),_0x9105('0x5d')],squel[_0x9105('0xa6')]()[_0x9105('0x82')](_0x9105('0xa7'),_0x9105('0xa7'))[_0x9105('0x82')]('\x27'+_0x324232+'\x27',_0x9105('0xa8'))[_0x9105('0x82')]('id',_0x9105('0xa9'))[_0x9105('0x82')](_0x29d928[_0x9105('0xaa')][_0x9105('0x89')](),_0x9105('0xab'))[_0x9105('0x82')](_0x2c0bc6[_0x9105('0x4f')]['id'][_0x9105('0x89')](),_0x9105('0x63'))[_0x9105('0x82')]('\x27'+_0x324232+'\x27',_0x9105('0xa5'))['field']('\x27'+_0x324232+'\x27',_0x9105('0x5d'))[_0x9105('0x84')](_0x9105('0xac'))[_0x9105('0x48')](_0x9105('0xb4'))[_0x9105('0x48')](_0x9105('0xad'),_0x29d928['CmListId'][_0x9105('0x89')]())[_0x9105('0x48')](_0x9105('0xae')))['toString']();}_0x1abca6['push'](db['sequelize']['query'](_0x3d08cd));}return BPromise['all'](_0x1abca6);}})[_0x9105('0x27')](function(){var _0x4f8b35=[];var _0x5e81fe=squel[_0x9105('0xa2')]()[_0x9105('0xb3')](_0x9105('0xb6'))['fromQuery'](['CmHopperId',_0x9105('0xa7'),_0x9105('0xb7'),_0x9105('0xa5'),_0x9105('0x5d')],squel['select']()[_0x9105('0x82')](_0x9105('0xb8'))[_0x9105('0x82')](_0x9105('0xb9'))[_0x9105('0x82')](_0x9105('0xba'))['field']('\x27'+_0x324232+'\x27',_0x9105('0xa5'))[_0x9105('0x82')]('\x27'+_0x324232+'\x27',_0x9105('0x5d'))[_0x9105('0x84')](_0x9105('0xbb'),'ci')[_0x9105('0x85')](_0x9105('0xa3'),'h',_0x9105('0xbc'))[_0x9105('0x48')](_0x9105('0xbd'),_0x324232)['where'](_0x9105('0xbe'),'PHONE'))['toString']();_0x4f8b35['push'](db[_0x9105('0x73')][_0x9105('0x3d')](_0x5e81fe));return BPromise[_0x9105('0x8e')](_0x4f8b35);})[_0x9105('0x27')](function(){return _0x1ada72;})[_0x9105('0x27')](respondWithResult(_0x29f6f6,null))[_0x9105('0x51')](handleError(_0x29f6f6,null));};exports['removeLists']=function(_0x1cf40f,_0x410c66,_0x179c75){return db['VoiceQueue'][_0x9105('0x31')]({'where':{'id':_0x1cf40f[_0x9105('0x4f')]['id']}})['then'](handleEntityNotFound(_0x410c66,null))['then'](function(_0xe1d895){if(_0xe1d895){return _0xe1d895[_0x9105('0xbf')](_0x1cf40f['query'][_0x9105('0x80')]);}})[_0x9105('0x27')](function(_0x40511a){if(_0x40511a){return db['CmHopper'][_0x9105('0x28')]({'where':{'ListId':_0x1cf40f[_0x9105('0x3d')][_0x9105('0x80')],'VoiceQueueId':_0x1cf40f['params']['id']}})[_0x9105('0x27')](function(){return _0x40511a;});}})[_0x9105('0x27')](respondWithStatusCode(_0x410c66,null))[_0x9105('0x51')](handleError(_0x410c66,null));};exports[_0x9105('0xc0')]=function(_0x5bd3bb,_0x4fe6cb,_0x5cc5ec){var _0x1f66d0={};var _0x21bc37={};var _0x3e9cee;var _0x169711;return db[_0x9105('0x38')]['findOne']({'where':{'id':_0x5bd3bb[_0x9105('0x4f')]['id']}})[_0x9105('0x27')](handleEntityNotFound(_0x4fe6cb,null))[_0x9105('0x27')](function(_0x15cf2b){if(_0x15cf2b){_0x3e9cee=_0x15cf2b;_0x21bc37[_0x9105('0x3c')]=_[_0x9105('0x3e')](db['CmList'][_0x9105('0x39')]);_0x21bc37[_0x9105('0x3d')]=_[_0x9105('0x3e')](_0x5bd3bb['query']);_0x21bc37[_0x9105('0x3f')]=_[_0x9105('0x40')](_0x21bc37[_0x9105('0x3c')],_0x21bc37[_0x9105('0x3d')]);_0x1f66d0['attributes']=_['intersection'](_0x21bc37[_0x9105('0x3c')],qs[_0x9105('0x42')](_0x5bd3bb[_0x9105('0x3d')]['fields']));_0x1f66d0[_0x9105('0x41')]=_0x1f66d0['attributes'][_0x9105('0x43')]?_0x1f66d0['attributes']:_0x21bc37['model'];_0x1f66d0[_0x9105('0x46')]=qs[_0x9105('0x47')](_0x5bd3bb[_0x9105('0x3d')]['sort']);_0x1f66d0[_0x9105('0x48')]=qs[_0x9105('0x3f')](_[_0x9105('0x62')](_0x5bd3bb[_0x9105('0x3d')],_0x21bc37[_0x9105('0x3f')]));if(_0x5bd3bb[_0x9105('0x3d')][_0x9105('0x2d')]){_0x1f66d0['where']=_[_0x9105('0x49')](_0x1f66d0['where'],{'$or':_['map'](_0x1f66d0[_0x9105('0x41')],function(_0x54856){var _0x210812={};_0x210812[_0x54856]={'$like':'%'+_0x5bd3bb[_0x9105('0x3d')][_0x9105('0x2d')]+'%'};return _0x210812;})});}_0x1f66d0=_[_0x9105('0x49')]({},_0x1f66d0,_0x5bd3bb[_0x9105('0x4b')]);return _0x3e9cee[_0x9105('0xc0')](_0x1f66d0);}})[_0x9105('0x27')](function(_0xa00f1){if(_0xa00f1){_0x169711=_0xa00f1[_0x9105('0x43')];if(!_0x5bd3bb['query'][_0x9105('0x44')](_0x9105('0x45'))){_0x1f66d0[_0x9105('0x20')]=qs[_0x9105('0x20')](_0x5bd3bb[_0x9105('0x3d')][_0x9105('0x20')]);_0x1f66d0[_0x9105('0x1d')]=qs[_0x9105('0x1d')](_0x5bd3bb[_0x9105('0x3d')][_0x9105('0x1d')]);}return _0x3e9cee[_0x9105('0xc0')](_0x1f66d0);}})['then'](function(_0x4e9ce7){if(_0x4e9ce7){return _0x4e9ce7?{'count':_0x169711,'rows':_0x4e9ce7}:null;}})[_0x9105('0x27')](respondWithResult(_0x4fe6cb,null))[_0x9105('0x51')](handleError(_0x4fe6cb,null));};exports[_0x9105('0xc1')]=function(_0x1dcda9,_0x1b6cd8,_0x370771){var _0x247fba,_0x51c514;return db[_0x9105('0x38')][_0x9105('0x31')]({'where':{'id':_0x1dcda9[_0x9105('0x4f')]['id']}})[_0x9105('0x27')](handleEntityNotFound(_0x1b6cd8,null))[_0x9105('0x27')](function(_0x251b23){if(_0x251b23){_0x51c514=_0x251b23;return _0x251b23[_0x9105('0xc1')](_0x1dcda9['body'][_0x9105('0x80')],_[_0x9105('0x5f')](_0x1dcda9[_0x9105('0x5e')],[_0x9105('0x80'),'id'])||{});}return null;})['spread'](function(_0x392a90){var _0x546664;_0x247fba=_0x392a90||[];var _0x338f60=[];if(_0x392a90){for(var _0x1d9021=0x0;_0x1d9021<_0x392a90['length'];_0x1d9021+=0x1){var _0x1cd665=_0x392a90[_0x1d9021][_0x9105('0x29')]({'plain':!![]});_0x546664=squel[_0x9105('0xa2')]()[_0x9105('0xb3')](_0x9105('0xc2'))[_0x9105('0xa4')]([_0x9105('0xa7'),_0x9105('0xa9'),_0x9105('0xab'),_0x9105('0x63'),'createdAt',_0x9105('0x5d')],squel['select']()[_0x9105('0x82')](_0x9105('0xa7'),'phone')['field']('id',_0x9105('0xa9'))[_0x9105('0x82')](_0x1cd665['CmListId'][_0x9105('0x89')](),_0x9105('0xab'))[_0x9105('0x82')](_0x1dcda9[_0x9105('0x4f')]['id'][_0x9105('0x89')](),_0x9105('0x63'))[_0x9105('0x82')]('NOW()','createdAt')[_0x9105('0x82')](_0x9105('0xc3'),'updatedAt')[_0x9105('0x84')](_0x9105('0xac'))[_0x9105('0x48')](_0x9105('0xb4'))[_0x9105('0x48')](_0x9105('0xad'),_0x1cd665[_0x9105('0xaa')][_0x9105('0x89')]())[_0x9105('0x48')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x338f60[_0x9105('0x96')](db['sequelize'][_0x9105('0x3d')](_0x546664));}return BPromise[_0x9105('0x8e')](_0x338f60);}})[_0x9105('0x27')](function(){return _0x247fba;})[_0x9105('0x27')](respondWithResult(_0x1b6cd8,null))[_0x9105('0x51')](handleError(_0x1b6cd8,null));};exports[_0x9105('0xc4')]=function(_0x355baa,_0x3c9f67,_0x4e20b6){return db['VoiceQueue'][_0x9105('0x31')]({'where':{'id':_0x355baa[_0x9105('0x4f')]['id']}})[_0x9105('0x27')](handleEntityNotFound(_0x3c9f67,null))[_0x9105('0x27')](function(_0x1045c3){if(_0x1045c3){return _0x1045c3['removeBlackLists'](_0x355baa[_0x9105('0x3d')][_0x9105('0x80')]);}})[_0x9105('0x27')](function(_0x108042){if(_0x108042){return db[_0x9105('0x69')][_0x9105('0x28')]({'where':{'ListId':_0x355baa[_0x9105('0x3d')][_0x9105('0x80')],'VoiceQueueId':_0x355baa['params']['id']}})[_0x9105('0x27')](function(){return _0x108042;});}})['then'](respondWithStatusCode(_0x3c9f67,null))['catch'](handleError(_0x3c9f67,null));}; \ No newline at end of file +var _0x22ed=['phone','scheduledAt','ContactId','ListId','toString','cm_contacts','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','deletedAt\x20IS\x20NULL','COALESCE(phone,\x27\x27)','CmListId','phone\x20IS\x20NOT\x20NULL','all','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','map','value','find','type','name','UserProfileResource','stack','send','index','VoiceQueue','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','userProfileId','getHoppers','findOne','nolimit','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','User','online','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','format','SIP/%s','voicePause','emit','ids','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','every','union','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isNil','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x22ed,0x1a9));var _0xd22e=function(_0x1587d1,_0x4ac855){_0x1587d1=_0x1587d1-0x0;var _0x376394=_0x22ed[_0x1587d1];return _0x376394;};'use strict';var emlformat=require(_0xd22e('0x0'));var rimraf=require(_0xd22e('0x1'));var zipdir=require(_0xd22e('0x2'));var jsonpatch=require(_0xd22e('0x3'));var rp=require(_0xd22e('0x4'));var moment=require(_0xd22e('0x5'));var BPromise=require(_0xd22e('0x6'));var Mustache=require(_0xd22e('0x7'));var util=require(_0xd22e('0x8'));var path=require(_0xd22e('0x9'));var sox=require(_0xd22e('0xa'));var csv=require(_0xd22e('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd22e('0xc'));var _=require(_0xd22e('0xd'));var squel=require('squel');var crypto=require(_0xd22e('0xe'));var jsforce=require(_0xd22e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd22e('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd22e('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd22e('0x11'));var logger=require(_0xd22e('0x12'))(_0xd22e('0x13'));var utils=require(_0xd22e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd22e('0x15'));var db=require(_0xd22e('0x16'))['db'];config[_0xd22e('0x17')]=_[_0xd22e('0x18')](config[_0xd22e('0x17')],{'host':_0xd22e('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd22e('0x17')]));require(_0xd22e('0x1a'))[_0xd22e('0x1b')](socket);function respondWithStatusCode(_0x5b6d95,_0x3b06e2){_0x3b06e2=_0x3b06e2||0xcc;return function(_0x5c454e){if(_0x5c454e){return _0x5b6d95[_0xd22e('0x1c')](_0x3b06e2);}return _0x5b6d95[_0xd22e('0x1d')](_0x3b06e2)[_0xd22e('0x1e')]();};}function respondWithResult(_0xe4ad1b,_0x724e3){_0x724e3=_0x724e3||0xc8;return function(_0x441ed7){if(_0x441ed7){return _0xe4ad1b[_0xd22e('0x1d')](_0x724e3)[_0xd22e('0x1f')](_0x441ed7);}};}function respondWithFilteredResult(_0x57f44f,_0x106570){return function(_0x288345){if(_0x288345){var _0x2ee456=typeof _0x106570[_0xd22e('0x20')]===_0xd22e('0x21')&&typeof _0x106570[_0xd22e('0x22')]==='undefined';var _0x21019b=_0x288345['count'];var _0x3a840c=_0x2ee456?0x0:_0x106570['offset'];var _0x5898d1=_0x2ee456?_0x288345[_0xd22e('0x23')]:_0x106570['offset']+_0x106570['limit'];var _0x340084;if(_0x5898d1>=_0x21019b){_0x5898d1=_0x21019b;_0x340084=0xc8;}else{_0x340084=0xce;}_0x57f44f[_0xd22e('0x1d')](_0x340084);return _0x57f44f[_0xd22e('0x24')](_0xd22e('0x25'),_0x3a840c+'-'+_0x5898d1+'/'+_0x21019b)['json'](_0x288345);}return null;};}function patchUpdates(_0x5762ca){return function(_0x3e5897){try{jsonpatch[_0xd22e('0x26')](_0x3e5897,_0x5762ca,!![]);}catch(_0x584c1e){return BPromise[_0xd22e('0x27')](_0x584c1e);}return _0x3e5897[_0xd22e('0x28')]();};}function saveUpdates(_0x3a5c74,_0xfbb4d1){return function(_0x552418){if(_0x552418){return _0x552418[_0xd22e('0x29')](_0x3a5c74)[_0xd22e('0x2a')](function(_0x11ec41){return _0x11ec41;});}return null;};}function removeEntity(_0x5ba269,_0xddb0d1){return function(_0x3e5e38){if(_0x3e5e38){return _0x3e5e38[_0xd22e('0x2b')]()['then'](function(){var _0xc57b5b=_0x3e5e38[_0xd22e('0x2c')]({'plain':!![]});var _0x6f382=[{'name':_0xd22e('0x2d'),'value':_0xd22e('0x2e'),'ignore':![]},{'name':_0xd22e('0x2f'),'value':_0xd22e('0x30'),'ignore':![]}];var _0x4b9424=_(_0x6f382)['filter'](_0xd22e('0x31'))[_0xd22e('0x32')](_0xd22e('0x33'))[_0xd22e('0x33')]();if(_['includes'](_0x4b9424,_0xc57b5b['type'])){return;}var _0x14c636=_[_0xd22e('0x34')](_0x6f382,[_0xd22e('0x33'),_0xc57b5b[_0xd22e('0x35')]])[_0xd22e('0x36')];return db[_0xd22e('0x37')]['destroy']({'where':{'type':_0x14c636,'resourceId':_0xc57b5b['id']}})[_0xd22e('0x2a')](function(){return _0x3e5e38;});})['then'](function(){_0x5ba269['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xffff71,_0xa1058e){return function(_0x3c87fd){if(!_0x3c87fd){_0xffff71[_0xd22e('0x1c')](0x194);}return _0x3c87fd;};}function handleError(_0x471a0d,_0xb3c897){_0xb3c897=_0xb3c897||0x1f4;return function(_0x5ec02f){logger['error'](_0x5ec02f[_0xd22e('0x38')]);if(_0x5ec02f[_0xd22e('0x36')]){delete _0x5ec02f[_0xd22e('0x36')];}_0x471a0d[_0xd22e('0x1d')](_0xb3c897)[_0xd22e('0x39')](_0x5ec02f);};}exports[_0xd22e('0x3a')]=function(_0xba0d6f,_0x258ede){var _0x588927={},_0x1b95e={},_0x5de5d7={'count':0x0,'rows':[]};var _0x24c07a=_[_0xd22e('0x32')](db[_0xd22e('0x3b')][_0xd22e('0x3c')],function(_0x13b49b){return{'name':_0x13b49b[_0xd22e('0x3d')],'type':_0x13b49b[_0xd22e('0x35')]['key']};});_0x1b95e['model']=_[_0xd22e('0x32')](_0x24c07a,_0xd22e('0x36'));_0x1b95e[_0xd22e('0x3e')]=_[_0xd22e('0x3f')](_0xba0d6f[_0xd22e('0x3e')]);_0x1b95e[_0xd22e('0x40')]=_[_0xd22e('0x41')](_0x1b95e[_0xd22e('0x42')],_0x1b95e[_0xd22e('0x3e')]);_0x588927[_0xd22e('0x43')]=_[_0xd22e('0x41')](_0x1b95e[_0xd22e('0x42')],qs[_0xd22e('0x44')](_0xba0d6f[_0xd22e('0x3e')][_0xd22e('0x44')]));_0x588927[_0xd22e('0x43')]=_0x588927[_0xd22e('0x43')][_0xd22e('0x45')]?_0x588927[_0xd22e('0x43')]:_0x1b95e['model'];if(!_0xba0d6f[_0xd22e('0x3e')][_0xd22e('0x46')]('nolimit')){_0x588927[_0xd22e('0x22')]=qs[_0xd22e('0x22')](_0xba0d6f[_0xd22e('0x3e')]['limit']);_0x588927[_0xd22e('0x20')]=qs[_0xd22e('0x20')](_0xba0d6f[_0xd22e('0x3e')][_0xd22e('0x20')]);}_0x588927[_0xd22e('0x47')]=qs[_0xd22e('0x48')](_0xba0d6f[_0xd22e('0x3e')][_0xd22e('0x48')]);_0x588927['where']=qs[_0xd22e('0x40')](_[_0xd22e('0x49')](_0xba0d6f[_0xd22e('0x3e')],_0x1b95e[_0xd22e('0x40')]),_0x24c07a);if(_0xba0d6f[_0xd22e('0x3e')][_0xd22e('0x4a')]){_0x588927[_0xd22e('0x4b')]=_[_0xd22e('0x4c')](_0x588927[_0xd22e('0x4b')],{'$or':_[_0xd22e('0x32')](_0x24c07a,function(_0x2f83c7){if(_0x2f83c7[_0xd22e('0x35')]!==_0xd22e('0x4d')){var _0x1f9ee8={};_0x1f9ee8[_0x2f83c7[_0xd22e('0x36')]]={'$like':'%'+_0xba0d6f[_0xd22e('0x3e')][_0xd22e('0x4a')]+'%'};return _0x1f9ee8;}})});}_0x588927=_[_0xd22e('0x4c')]({},_0x588927,_0xba0d6f[_0xd22e('0x4e')]);var _0x40f279={'where':_0x588927[_0xd22e('0x4b')]};return db[_0xd22e('0x3b')][_0xd22e('0x23')](_0x40f279)['then'](function(_0x4efd42){_0x5de5d7[_0xd22e('0x23')]=_0x4efd42;if(_0xba0d6f[_0xd22e('0x3e')][_0xd22e('0x4f')]){_0x588927[_0xd22e('0x50')]=[{'all':!![]}];}return db['VoiceQueue'][_0xd22e('0x51')](_0x588927);})[_0xd22e('0x2a')](function(_0x30afbd){_0x5de5d7[_0xd22e('0x52')]=_0x30afbd;return _0x5de5d7;})[_0xd22e('0x2a')](respondWithFilteredResult(_0x258ede,_0x588927))[_0xd22e('0x53')](handleError(_0x258ede,null));};exports['show']=function(_0x44ac94,_0x1ad2c2){var _0x191f67={'raw':![],'where':{'id':_0x44ac94[_0xd22e('0x54')]['id']}},_0x400af2={};_0x400af2[_0xd22e('0x42')]=_[_0xd22e('0x3f')](db['VoiceQueue'][_0xd22e('0x3c')]);_0x400af2['query']=_[_0xd22e('0x3f')](_0x44ac94[_0xd22e('0x3e')]);_0x400af2[_0xd22e('0x40')]=_[_0xd22e('0x41')](_0x400af2['model'],_0x400af2[_0xd22e('0x3e')]);_0x191f67['attributes']=_[_0xd22e('0x41')](_0x400af2['model'],qs['fields'](_0x44ac94[_0xd22e('0x3e')][_0xd22e('0x44')]));_0x191f67[_0xd22e('0x43')]=_0x191f67[_0xd22e('0x43')]['length']?_0x191f67[_0xd22e('0x43')]:_0x400af2[_0xd22e('0x42')];if(_0x44ac94[_0xd22e('0x3e')][_0xd22e('0x4f')]){_0x191f67['include']=[{'all':!![]}];}_0x191f67=_[_0xd22e('0x4c')]({},_0x191f67,_0x44ac94[_0xd22e('0x4e')]);return db[_0xd22e('0x3b')][_0xd22e('0x34')](_0x191f67)[_0xd22e('0x2a')](handleEntityNotFound(_0x1ad2c2,null))[_0xd22e('0x2a')](respondWithResult(_0x1ad2c2,null))[_0xd22e('0x53')](handleError(_0x1ad2c2,null));};exports[_0xd22e('0x55')]=function(_0x104da1,_0x3f9928){return db[_0xd22e('0x3b')][_0xd22e('0x55')](_0x104da1[_0xd22e('0x56')],{})[_0xd22e('0x2a')](function(_0x8cd6fc){var _0x4f2a20=_0x104da1[_0xd22e('0x57')][_0xd22e('0x2c')]({'plain':!![]});if(!_0x4f2a20)throw new Error(_0xd22e('0x58'));if(_0x4f2a20['role']===_0xd22e('0x57')){var _0x542c6e=_0x8cd6fc[_0xd22e('0x2c')]({'plain':!![]});var _0x5785ae=[{'name':_0xd22e('0x2d'),'value':'inbound'},{'name':_0xd22e('0x2f'),'value':_0xd22e('0x30')}];var _0x5d8538=_['find'](_0x5785ae,[_0xd22e('0x33'),_0x542c6e[_0xd22e('0x35')]])['name'];return db[_0xd22e('0x59')][_0xd22e('0x34')]({'where':{'name':_0x5d8538,'userProfileId':_0x4f2a20['userProfileId']},'raw':!![]})[_0xd22e('0x2a')](function(_0x5ea57a){if(_0x5ea57a&&_0x5ea57a[_0xd22e('0x5a')]===0x0){return db[_0xd22e('0x37')][_0xd22e('0x55')]({'name':_0x542c6e[_0xd22e('0x36')],'resourceId':_0x542c6e['id'],'type':_0x5ea57a[_0xd22e('0x36')],'sectionId':_0x5ea57a['id']},{})[_0xd22e('0x2a')](function(){return _0x8cd6fc;});}else{return _0x8cd6fc;}})['catch'](function(_0x805c83){logger[_0xd22e('0x5b')](_0xd22e('0x5c'),_0x805c83);throw _0x805c83;});}return _0x8cd6fc;})[_0xd22e('0x2a')](respondWithResult(_0x3f9928,0xc9))[_0xd22e('0x53')](handleError(_0x3f9928,null));};exports[_0xd22e('0x5d')]=function(_0x3af4e7,_0x347aa3){var _0x4b4e0b={'where':{'id':_0x3af4e7[_0xd22e('0x54')]['id']}},_0x5e6a84={};_0x5e6a84[_0xd22e('0x42')]=_['keys'](db[_0xd22e('0x3b')][_0xd22e('0x3c')]);_0x4b4e0b[_0xd22e('0x43')]=_['intersection'](_0x5e6a84[_0xd22e('0x42')],qs['fields'](_0x3af4e7[_0xd22e('0x3e')][_0xd22e('0x44')]));_0x4b4e0b[_0xd22e('0x43')]=_0x4b4e0b['attributes'][_0xd22e('0x45')]?_0x4b4e0b[_0xd22e('0x43')]:_0x5e6a84['model'];if(_0x3af4e7['query'][_0xd22e('0x4f')]){_0x4b4e0b[_0xd22e('0x50')]=[{'all':!![]}];}_0x4b4e0b=_[_0xd22e('0x4c')]({},_0x4b4e0b,_0x3af4e7[_0xd22e('0x4e')]);return db['VoiceQueue'][_0xd22e('0x34')](_0x4b4e0b)[_0xd22e('0x2a')](handleEntityNotFound(_0x347aa3,null))[_0xd22e('0x2a')](function(_0x25e744){if(_0x25e744){var _0x3dea35=_0x25e744['get']({'plain':!![]});_0x3dea35=qs[_0xd22e('0x5e')](_0x3dea35,['id',_0xd22e('0x5f'),_0xd22e('0x60')]);_0x3af4e7[_0xd22e('0x56')]=_[_0xd22e('0x5e')](_0x3af4e7['body'],['id',_0xd22e('0x5f'),_0xd22e('0x60')]);return db[_0xd22e('0x3b')]['create'](_[_0xd22e('0x4c')](_0x3dea35,_0x3af4e7[_0xd22e('0x56')]),{'include':_0x3af4e7[_0xd22e('0x3e')][_0xd22e('0x4f')]?[{'all':!![]}]:undefined})[_0xd22e('0x2a')](function(_0x4bc7d9){var _0x234f60=_0x3af4e7[_0xd22e('0x57')][_0xd22e('0x2c')]({'plain':!![]});if(!_0x234f60)throw new Error(_0xd22e('0x58'));if(_0x234f60[_0xd22e('0x61')]===_0xd22e('0x57')){var _0x6635c5=_0x4bc7d9['get']({'plain':!![]});var _0x451d8f=[{'name':_0xd22e('0x2d'),'value':'inbound'},{'name':'QueueCampaigns','value':'outbound'}];var _0x15739b=_[_0xd22e('0x34')](_0x451d8f,[_0xd22e('0x33'),_0x6635c5['type']])[_0xd22e('0x36')];return db[_0xd22e('0x59')][_0xd22e('0x34')]({'where':{'name':_0x15739b,'userProfileId':_0x234f60[_0xd22e('0x62')]},'raw':!![]})['then'](function(_0x1752df){if(_0x1752df&&_0x1752df['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x6635c5[_0xd22e('0x36')],'resourceId':_0x6635c5['id'],'type':_0x1752df[_0xd22e('0x36')],'sectionId':_0x1752df['id']},{})[_0xd22e('0x2a')](function(){return _0x4bc7d9;});}else{return _0x4bc7d9;}})[_0xd22e('0x53')](function(_0x35a0ca){logger[_0xd22e('0x5b')](_0xd22e('0x5c'),_0x35a0ca);throw _0x35a0ca;});}return _0x4bc7d9;});}})[_0xd22e('0x2a')](respondWithResult(_0x347aa3,0xc9))[_0xd22e('0x53')](handleError(_0x347aa3,null));};exports[_0xd22e('0x29')]=function(_0x2e4a6b,_0x24d70d){if(_0x2e4a6b['body']['id']){delete _0x2e4a6b[_0xd22e('0x56')]['id'];}return db['VoiceQueue'][_0xd22e('0x34')]({'where':{'id':_0x2e4a6b[_0xd22e('0x54')]['id']}})[_0xd22e('0x2a')](handleEntityNotFound(_0x24d70d,null))[_0xd22e('0x2a')](saveUpdates(_0x2e4a6b[_0xd22e('0x56')],null))[_0xd22e('0x2a')](respondWithResult(_0x24d70d,null))[_0xd22e('0x53')](handleError(_0x24d70d,null));};exports['destroy']=function(_0x44392e,_0x5a8462){return db[_0xd22e('0x3b')][_0xd22e('0x34')]({'where':{'id':_0x44392e[_0xd22e('0x54')]['id']}})[_0xd22e('0x2a')](handleEntityNotFound(_0x5a8462,null))[_0xd22e('0x2a')](removeEntity(_0x5a8462,null))['catch'](handleError(_0x5a8462,null));};exports[_0xd22e('0x63')]=function(_0x2f10c2,_0x48bf6e,_0x3d9850){var _0x2a3ca6={'raw':![],'where':{}};var _0x416af2={};var _0x3d0a26={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xd22e('0x64')]({'where':{'id':_0x2f10c2[_0xd22e('0x54')]['id']}})[_0xd22e('0x2a')](handleEntityNotFound(_0x48bf6e,null))[_0xd22e('0x2a')](function(_0xdf0e18){if(_0xdf0e18){_0x416af2[_0xd22e('0x42')]=_[_0xd22e('0x3f')](db['CmHopper'][_0xd22e('0x3c')]);_0x416af2['query']=_[_0xd22e('0x3f')](_0x2f10c2['query']);_0x416af2['filters']=_[_0xd22e('0x41')](_0x416af2[_0xd22e('0x42')],_0x416af2[_0xd22e('0x3e')]);_0x2a3ca6['attributes']=_[_0xd22e('0x41')](_0x416af2['model'],qs['fields'](_0x2f10c2[_0xd22e('0x3e')][_0xd22e('0x44')]));_0x2a3ca6[_0xd22e('0x43')]=_0x2a3ca6['attributes'][_0xd22e('0x45')]?_0x2a3ca6[_0xd22e('0x43')]:_0x416af2[_0xd22e('0x42')];if(!_0x2f10c2[_0xd22e('0x3e')][_0xd22e('0x46')](_0xd22e('0x65'))){_0x2a3ca6['limit']=qs['limit'](_0x2f10c2[_0xd22e('0x3e')][_0xd22e('0x22')]);_0x2a3ca6['offset']=qs['offset'](_0x2f10c2[_0xd22e('0x3e')][_0xd22e('0x20')]);}_0x2a3ca6[_0xd22e('0x47')]=qs[_0xd22e('0x48')](_0x2f10c2[_0xd22e('0x3e')][_0xd22e('0x48')]);_0x2a3ca6[_0xd22e('0x4b')]=qs[_0xd22e('0x40')](_[_0xd22e('0x49')](_0x2f10c2['query'],_0x416af2['filters']));_0x2a3ca6['where'][_0xd22e('0x66')]=_0xdf0e18['id'];if(_0x2f10c2[_0xd22e('0x3e')][_0xd22e('0x4a')]){_0x2a3ca6[_0xd22e('0x4b')]=_[_0xd22e('0x4c')](_0x2a3ca6['where'],{'$or':_[_0xd22e('0x32')](_0x2a3ca6[_0xd22e('0x43')],function(_0xa14088){var _0x16c606={};_0x16c606[_0xa14088]={'$like':'%'+_0x2f10c2['query']['filter']+'%'};return _0x16c606;})});}_0x2a3ca6=_[_0xd22e('0x4c')]({},_0x2a3ca6,_0x2f10c2['options']);return db[_0xd22e('0x67')]['count']({'where':_0x2a3ca6[_0xd22e('0x4b')]})[_0xd22e('0x2a')](function(_0x126746){_0x3d0a26[_0xd22e('0x23')]=_0x126746;if(_0x2f10c2[_0xd22e('0x3e')][_0xd22e('0x4f')]){_0x2a3ca6[_0xd22e('0x50')]=[{'all':!![]}];}return db[_0xd22e('0x67')][_0xd22e('0x51')](_0x2a3ca6);})['then'](function(_0xdc72e0){_0x3d0a26[_0xd22e('0x52')]=_0xdc72e0;return _0x3d0a26;});}})[_0xd22e('0x2a')](respondWithFilteredResult(_0x48bf6e,_0x2a3ca6))[_0xd22e('0x53')](handleError(_0x48bf6e,null));};exports[_0xd22e('0x68')]=function(_0x27cea1,_0xc819d7,_0x76c688){var _0xfbaa0c={'raw':!![],'where':{}};var _0x1cf1ae={};var _0x6510f1={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x27cea1['params']['id']}})['then'](handleEntityNotFound(_0xc819d7,null))[_0xd22e('0x2a')](function(_0xfa331){if(_0xfa331){_0x1cf1ae[_0xd22e('0x42')]=_[_0xd22e('0x3f')](db['CmHopperHistory'][_0xd22e('0x3c')]);_0x1cf1ae[_0xd22e('0x3e')]=_[_0xd22e('0x3f')](_0x27cea1[_0xd22e('0x3e')]);_0x1cf1ae[_0xd22e('0x40')]=_['intersection'](_0x1cf1ae[_0xd22e('0x42')],_0x1cf1ae[_0xd22e('0x3e')]);_0xfbaa0c[_0xd22e('0x43')]=_[_0xd22e('0x41')](_0x1cf1ae[_0xd22e('0x42')],qs[_0xd22e('0x44')](_0x27cea1['query'][_0xd22e('0x44')]));_0xfbaa0c[_0xd22e('0x43')]=_0xfbaa0c[_0xd22e('0x43')]['length']?_0xfbaa0c[_0xd22e('0x43')]:_0x1cf1ae[_0xd22e('0x42')];if(!_0x27cea1[_0xd22e('0x3e')]['hasOwnProperty']('nolimit')){_0xfbaa0c[_0xd22e('0x22')]=qs[_0xd22e('0x22')](_0x27cea1[_0xd22e('0x3e')][_0xd22e('0x22')]);_0xfbaa0c[_0xd22e('0x20')]=qs['offset'](_0x27cea1[_0xd22e('0x3e')]['offset']);}_0xfbaa0c['order']=qs[_0xd22e('0x48')](_0x27cea1[_0xd22e('0x3e')][_0xd22e('0x48')]);_0xfbaa0c[_0xd22e('0x4b')]=qs[_0xd22e('0x40')](_[_0xd22e('0x49')](_0x27cea1[_0xd22e('0x3e')],_0x1cf1ae[_0xd22e('0x40')]));_0xfbaa0c['where'][_0xd22e('0x66')]=_0xfa331['id'];if(_0x27cea1[_0xd22e('0x3e')][_0xd22e('0x4a')]){_0xfbaa0c[_0xd22e('0x4b')]=_[_0xd22e('0x4c')](_0xfbaa0c[_0xd22e('0x4b')],{'$or':_[_0xd22e('0x32')](_0xfbaa0c[_0xd22e('0x43')],function(_0xd2690b){var _0x1c498a={};_0x1c498a[_0xd2690b]={'$like':'%'+_0x27cea1[_0xd22e('0x3e')]['filter']+'%'};return _0x1c498a;})});}_0xfbaa0c=_[_0xd22e('0x4c')]({},_0xfbaa0c,_0x27cea1[_0xd22e('0x4e')]);return db[_0xd22e('0x69')]['count']({'where':_0xfbaa0c['where']})[_0xd22e('0x2a')](function(_0x19d10d){_0x6510f1[_0xd22e('0x23')]=_0x19d10d;if(_0x27cea1['query'][_0xd22e('0x4f')]){_0xfbaa0c[_0xd22e('0x50')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0xfbaa0c);})[_0xd22e('0x2a')](function(_0x36976d){_0x6510f1[_0xd22e('0x52')]=_0x36976d;return _0x6510f1;});}})['then'](respondWithFilteredResult(_0xc819d7,_0xfbaa0c))[_0xd22e('0x53')](handleError(_0xc819d7,null));};exports[_0xd22e('0x6a')]=function(_0x2214de,_0x40d512,_0x235edd){var _0x4ee234={'raw':!![],'where':{}};var _0x45d79a={};var _0x48c728={'count':0x0,'rows':[]};return db[_0xd22e('0x3b')][_0xd22e('0x64')]({'where':{'id':_0x2214de['params']['id']}})[_0xd22e('0x2a')](handleEntityNotFound(_0x40d512,null))[_0xd22e('0x2a')](function(_0xb9a6c1){if(_0xb9a6c1){_0x45d79a[_0xd22e('0x42')]=_[_0xd22e('0x3f')](db[_0xd22e('0x6b')][_0xd22e('0x3c')]);_0x45d79a[_0xd22e('0x3e')]=_[_0xd22e('0x3f')](_0x2214de['query']);_0x45d79a[_0xd22e('0x40')]=_[_0xd22e('0x41')](_0x45d79a[_0xd22e('0x42')],_0x45d79a[_0xd22e('0x3e')]);_0x4ee234[_0xd22e('0x43')]=_[_0xd22e('0x41')](_0x45d79a[_0xd22e('0x42')],qs[_0xd22e('0x44')](_0x2214de[_0xd22e('0x3e')][_0xd22e('0x44')]));_0x4ee234[_0xd22e('0x43')]=_0x4ee234[_0xd22e('0x43')][_0xd22e('0x45')]?_0x4ee234[_0xd22e('0x43')]:_0x45d79a['model'];if(!_0x2214de[_0xd22e('0x3e')][_0xd22e('0x46')]('nolimit')){_0x4ee234[_0xd22e('0x22')]=qs[_0xd22e('0x22')](_0x2214de['query']['limit']);_0x4ee234[_0xd22e('0x20')]=qs['offset'](_0x2214de[_0xd22e('0x3e')]['offset']);}_0x4ee234[_0xd22e('0x47')]=qs[_0xd22e('0x48')](_0x2214de[_0xd22e('0x3e')][_0xd22e('0x48')]);_0x4ee234[_0xd22e('0x4b')]=qs[_0xd22e('0x40')](_[_0xd22e('0x49')](_0x2214de[_0xd22e('0x3e')],_0x45d79a[_0xd22e('0x40')]));_0x4ee234[_0xd22e('0x4b')]['VoiceQueueId']=_0xb9a6c1['id'];if(_0x2214de[_0xd22e('0x3e')][_0xd22e('0x4a')]){_0x4ee234['where']=_[_0xd22e('0x4c')](_0x4ee234[_0xd22e('0x4b')],{'$or':_['map'](_0x4ee234[_0xd22e('0x43')],function(_0x43c2a5){var _0x28a95b={};_0x28a95b[_0x43c2a5]={'$like':'%'+_0x2214de[_0xd22e('0x3e')]['filter']+'%'};return _0x28a95b;})});}_0x4ee234=_[_0xd22e('0x4c')]({},_0x4ee234,_0x2214de[_0xd22e('0x4e')]);return db[_0xd22e('0x6b')][_0xd22e('0x23')]({'where':_0x4ee234['where']})[_0xd22e('0x2a')](function(_0x266d14){_0x48c728['count']=_0x266d14;if(_0x2214de[_0xd22e('0x3e')][_0xd22e('0x4f')]){_0x4ee234[_0xd22e('0x50')]=[{'all':!![]}];}return db[_0xd22e('0x6b')][_0xd22e('0x51')](_0x4ee234);})[_0xd22e('0x2a')](function(_0x249b1c){_0x48c728[_0xd22e('0x52')]=_0x249b1c;return _0x48c728;});}})[_0xd22e('0x2a')](respondWithFilteredResult(_0x40d512,_0x4ee234))[_0xd22e('0x53')](handleError(_0x40d512,null));};exports[_0xd22e('0x6c')]=function(_0x3d113e,_0x34bb0f,_0x3e891c){var _0x24ac9e={'raw':!![],'where':{}};var _0x2ee78e={};var _0x16bb98={'count':0x0,'rows':[]};return db[_0xd22e('0x3b')][_0xd22e('0x64')]({'where':{'id':_0x3d113e[_0xd22e('0x54')]['id']}})['then'](handleEntityNotFound(_0x34bb0f,null))[_0xd22e('0x2a')](function(_0x52108c){if(_0x52108c){_0x2ee78e['model']=_['keys'](db[_0xd22e('0x6d')]['rawAttributes']);_0x2ee78e[_0xd22e('0x3e')]=_[_0xd22e('0x3f')](_0x3d113e[_0xd22e('0x3e')]);_0x2ee78e[_0xd22e('0x40')]=_[_0xd22e('0x41')](_0x2ee78e[_0xd22e('0x42')],_0x2ee78e[_0xd22e('0x3e')]);_0x24ac9e[_0xd22e('0x43')]=_['intersection'](_0x2ee78e[_0xd22e('0x42')],qs[_0xd22e('0x44')](_0x3d113e['query'][_0xd22e('0x44')]));_0x24ac9e['attributes']=_0x24ac9e[_0xd22e('0x43')][_0xd22e('0x45')]?_0x24ac9e[_0xd22e('0x43')]:_0x2ee78e['model'];if(!_0x3d113e['query']['hasOwnProperty']('nolimit')){_0x24ac9e[_0xd22e('0x22')]=qs[_0xd22e('0x22')](_0x3d113e[_0xd22e('0x3e')][_0xd22e('0x22')]);_0x24ac9e[_0xd22e('0x20')]=qs[_0xd22e('0x20')](_0x3d113e[_0xd22e('0x3e')][_0xd22e('0x20')]);}_0x24ac9e[_0xd22e('0x47')]=qs['sort'](_0x3d113e[_0xd22e('0x3e')]['sort']);_0x24ac9e[_0xd22e('0x4b')]=qs['filters'](_['pick'](_0x3d113e[_0xd22e('0x3e')],_0x2ee78e[_0xd22e('0x40')]));_0x24ac9e[_0xd22e('0x4b')]['VoiceQueueId']=_0x52108c['id'];if(_0x3d113e[_0xd22e('0x3e')][_0xd22e('0x4a')]){_0x24ac9e[_0xd22e('0x4b')]=_[_0xd22e('0x4c')](_0x24ac9e[_0xd22e('0x4b')],{'$or':_['map'](_0x24ac9e[_0xd22e('0x43')],function(_0x4bfda1){var _0x2ff689={};_0x2ff689[_0x4bfda1]={'$like':'%'+_0x3d113e[_0xd22e('0x3e')]['filter']+'%'};return _0x2ff689;})});}_0x24ac9e=_[_0xd22e('0x4c')]({},_0x24ac9e,_0x3d113e[_0xd22e('0x4e')]);return db['CmHopperBlack'][_0xd22e('0x23')]({'where':_0x24ac9e[_0xd22e('0x4b')]})['then'](function(_0x3e235c){_0x16bb98[_0xd22e('0x23')]=_0x3e235c;if(_0x3d113e[_0xd22e('0x3e')][_0xd22e('0x4f')]){_0x24ac9e['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0xd22e('0x51')](_0x24ac9e);})[_0xd22e('0x2a')](function(_0x12c3e1){_0x16bb98['rows']=_0x12c3e1;return _0x16bb98;});}})[_0xd22e('0x2a')](respondWithFilteredResult(_0x34bb0f,_0x24ac9e))[_0xd22e('0x53')](handleError(_0x34bb0f,null));};exports[_0xd22e('0x6e')]=function(_0x11e0b6,_0x49f6b1,_0x428a95){var _0x29260a={};var _0x3b9000={};var _0x350179;var _0x2a4bb8;return db[_0xd22e('0x3b')][_0xd22e('0x64')]({'where':{'id':_0x11e0b6['params']['id']}})[_0xd22e('0x2a')](handleEntityNotFound(_0x49f6b1,null))[_0xd22e('0x2a')](function(_0x16d31e){if(_0x16d31e){_0x350179=_0x16d31e;_0x3b9000[_0xd22e('0x42')]=_[_0xd22e('0x3f')](db['Team'][_0xd22e('0x3c')]);_0x3b9000[_0xd22e('0x3e')]=_[_0xd22e('0x3f')](_0x11e0b6[_0xd22e('0x3e')]);_0x3b9000[_0xd22e('0x40')]=_[_0xd22e('0x41')](_0x3b9000['model'],_0x3b9000['query']);_0x29260a[_0xd22e('0x43')]=_[_0xd22e('0x41')](_0x3b9000[_0xd22e('0x42')],qs['fields'](_0x11e0b6['query']['fields']));_0x29260a[_0xd22e('0x43')]=_0x29260a[_0xd22e('0x43')][_0xd22e('0x45')]?_0x29260a['attributes']:_0x3b9000[_0xd22e('0x42')];_0x29260a[_0xd22e('0x47')]=qs[_0xd22e('0x48')](_0x11e0b6['query'][_0xd22e('0x48')]);_0x29260a[_0xd22e('0x4b')]=qs[_0xd22e('0x40')](_['pick'](_0x11e0b6['query'],_0x3b9000[_0xd22e('0x40')]));if(_0x11e0b6[_0xd22e('0x3e')][_0xd22e('0x4a')]){_0x29260a[_0xd22e('0x4b')]=_[_0xd22e('0x4c')](_0x29260a[_0xd22e('0x4b')],{'$or':_[_0xd22e('0x32')](_0x29260a[_0xd22e('0x43')],function(_0x2df449){var _0x46a2a8={};_0x46a2a8[_0x2df449]={'$like':'%'+_0x11e0b6[_0xd22e('0x3e')][_0xd22e('0x4a')]+'%'};return _0x46a2a8;})});}_0x29260a=_[_0xd22e('0x4c')]({},_0x29260a,_0x11e0b6[_0xd22e('0x4e')]);return _0x350179[_0xd22e('0x6e')](_0x29260a);}})[_0xd22e('0x2a')](function(_0x36b599){if(_0x36b599){_0x2a4bb8=_0x36b599[_0xd22e('0x45')];if(!_0x11e0b6[_0xd22e('0x3e')][_0xd22e('0x46')](_0xd22e('0x65'))){_0x29260a[_0xd22e('0x22')]=qs[_0xd22e('0x22')](_0x11e0b6[_0xd22e('0x3e')][_0xd22e('0x22')]);_0x29260a[_0xd22e('0x20')]=qs[_0xd22e('0x20')](_0x11e0b6['query'][_0xd22e('0x20')]);}return _0x350179[_0xd22e('0x6e')](_0x29260a);}})['then'](function(_0x5814c3){if(_0x5814c3){return _0x5814c3?{'count':_0x2a4bb8,'rows':_0x5814c3}:null;}})[_0xd22e('0x2a')](respondWithResult(_0x49f6b1,null))[_0xd22e('0x53')](handleError(_0x49f6b1,null));};exports[_0xd22e('0x6f')]=function(_0x47e0a0,_0x532128,_0x4876a6){var _0x297b5e=_0x47e0a0[_0xd22e('0x56')]['teams'];var _0x18fd5e=_['map'](_0x297b5e,'id');return db['Team'][_0xd22e('0x51')]({'where':{'id':_0x18fd5e},'attributes':['id'],'include':[{'model':db[_0xd22e('0x70')],'as':'Agents','attributes':['id',_0xd22e('0x36'),_0xd22e('0x71'),'voicePause',_0xd22e('0x72')],'raw':!![]}]})[_0xd22e('0x2a')](function(_0x453ca6){if(_0x453ca6){var _0x40bdcf=_[_0xd22e('0x73')](_0x453ca6,function(_0xeeafe5){var _0x57a528=_0xeeafe5['get']({'plain':!![]});_0x57a528[_0xd22e('0x74')][_0xd22e('0x75')](function(_0xfb6913){_0xfb6913[_0xd22e('0x76')]=_[_0xd22e('0x34')](_0x297b5e,{'id':_0x57a528['id']})[_0xd22e('0x76')];});return _0x57a528[_0xd22e('0x74')];});return db[_0xd22e('0x3b')][_0xd22e('0x34')]({'where':{'id':_0x47e0a0[_0xd22e('0x54')]['id']}})[_0xd22e('0x2a')](function(_0x25ae47){return db[_0xd22e('0x77')][_0xd22e('0x78')](function(_0x3be8ec){return _0x25ae47[_0xd22e('0x6f')](_0x18fd5e,{'transaction':_0x3be8ec})[_0xd22e('0x2a')](function(){return BPromise[_0xd22e('0x79')](_0x297b5e,function(_0x17d6fb){return db[_0xd22e('0x7a')][_0xd22e('0x7b')]({'TeamId':_0x17d6fb['id'],'VoiceQueueId':_0x47e0a0[_0xd22e('0x54')]['id'],'penalty':_0x17d6fb['penalty']},{'transaction':_0x3be8ec});});})[_0xd22e('0x2a')](function(){return BPromise['each'](_0x40bdcf,function(_0x2feed6){return db[_0xd22e('0x7c')][_0xd22e('0x7d')]({'where':{'UserId':_0x2feed6['id'],'VoiceQueueId':_0x47e0a0['params']['id']},'defaults':{'penalty':_0x2feed6[_0xd22e('0x76')]},'transaction':_0x3be8ec});});})[_0xd22e('0x2a')](function(){return BPromise[_0xd22e('0x79')](_[_0xd22e('0x4a')](_0x40bdcf,{'online':!![]}),function(_0x482c9b){return db[_0xd22e('0x7e')]['upsert']({'membername':_0x482c9b['name'],'UserId':_0x482c9b['id'],'queue_name':_0x25ae47['name'],'VoiceQueueId':_0x25ae47['id'],'interface':_['isNil'](_0x482c9b['interface'])?util[_0xd22e('0x7f')](_0xd22e('0x80'),_0x482c9b[_0xd22e('0x36')]):_0x482c9b[_0xd22e('0x72')],'paused':_0x482c9b[_0xd22e('0x81')]||![],'penalty':_0x482c9b['penalty']},{'transaction':_0x3be8ec});});})[_0xd22e('0x2a')](function(){_0x40bdcf[_0xd22e('0x75')](function(_0x49f2d7){socket[_0xd22e('0x82')]('userVoiceQueue:save',{'UserId':_0x49f2d7['id'],'VoiceQueueId':_0x25ae47['id']});});});});});}})[_0xd22e('0x2a')](respondWithStatusCode(_0x532128,null))[_0xd22e('0x53')](handleError(_0x532128,null));};exports['removeTeams']=function(_0xf89c2b,_0x1b236b,_0x4aaa31){return db['Team']['findAll']({'where':{'id':_0xf89c2b[_0xd22e('0x3e')][_0xd22e('0x83')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd22e('0x74'),'attributes':['id'],'raw':!![]}]})[_0xd22e('0x2a')](handleEntityNotFound(_0x1b236b,null))[_0xd22e('0x2a')](function(_0x54b984){var _0xad0ff7=_['map'](_0x54b984,'id');var _0x3dd2ab=[];var _0x30dd04=[];var _0x128f42=squel[_0xd22e('0x84')]();_0x128f42[_0xd22e('0x85')](_0xd22e('0x86'))[_0xd22e('0x87')](_0xd22e('0x88'),'tq')[_0xd22e('0x89')](_0xd22e('0x8a'),'ut',_0xd22e('0x8b'))[_0xd22e('0x4b')](_0xd22e('0x8c'),_0xf89c2b[_0xd22e('0x54')]['id']);for(var _0xbfc64f=0x0;_0xbfc64f<_0x54b984['length'];_0xbfc64f+=0x1){let _0x4f58a7=_0x54b984[_0xbfc64f];for(var _0x511ced=0x0;_0x511ced<_0x4f58a7[_0xd22e('0x74')][_0xd22e('0x45')];_0x511ced+=0x1){let _0x42fa29=_0x4f58a7[_0xd22e('0x74')][_0x511ced];var _0x5f4054=_0x128f42[_0xd22e('0x5d')]();_0x5f4054[_0xd22e('0x4b')](_0xd22e('0x8d'),_0x42fa29['id']);_0x30dd04[_0xd22e('0x8e')](db[_0xd22e('0x77')][_0xd22e('0x3e')](_0x5f4054['toString'](),{'type':db[_0xd22e('0x77')][_0xd22e('0x8f')]['SELECT']})[_0xd22e('0x2a')](function(_0x330cf3){if(_0x330cf3['length']===0x1){return _0x42fa29['id'];}else{var _0x5d227c=_[_0xd22e('0x90')](_[_0xd22e('0x32')](_0x330cf3,'TeamId'),function(_0xdfb982){return _['includes'](_0xad0ff7,_0xdfb982);});if(_0x5d227c){return _0x42fa29['id'];}}}));}}return BPromise['all'](_0x30dd04)[_0xd22e('0x2a')](function(_0x25bd75){_0x3dd2ab=_(_0x3dd2ab)[_0xd22e('0x91')](_0x25bd75)['compact']()[_0xd22e('0x33')]();return db['VoiceQueue']['find']({'where':{'id':_0xf89c2b[_0xd22e('0x54')]['id']}})[_0xd22e('0x2a')](function(_0x894ed8){return db[_0xd22e('0x77')][_0xd22e('0x78')](function(_0xdfe7e4){return _0x894ed8[_0xd22e('0x92')](_0xf89c2b[_0xd22e('0x3e')][_0xd22e('0x83')],{'transaction':_0xdfe7e4})['then'](function(){if(!_[_0xd22e('0x93')](_0x3dd2ab)){return _0x894ed8[_0xd22e('0x94')](_0x3dd2ab,{'transaction':_0xdfe7e4})['then'](function(){return db[_0xd22e('0x7e')]['destroy']({'where':{'VoiceQueueId':_0xf89c2b[_0xd22e('0x54')]['id'],'UserId':_0x3dd2ab},'transaction':_0xdfe7e4});});}})['then'](function(){_0x3dd2ab[_0xd22e('0x75')](function(_0x966161){socket['emit'](_0xd22e('0x95'),{'UserId':_0x966161,'VoiceQueueId':_0x894ed8['id']});});});});});});})[_0xd22e('0x2a')](respondWithStatusCode(_0x1b236b,null))[_0xd22e('0x53')](handleError(_0x1b236b,null));};exports[_0xd22e('0x96')]=function(_0x55f24e,_0x5c2966,_0x10999c){var _0x25ab9f,_0x4fcc96;return db['VoiceQueue'][_0xd22e('0x34')]({'where':{'id':_0x55f24e[_0xd22e('0x54')]['id']}})[_0xd22e('0x2a')](handleEntityNotFound(_0x5c2966,null))[_0xd22e('0x2a')](function(_0x5d80dd){if(_0x5d80dd){_0x4fcc96=_0x5d80dd;return _0x5d80dd[_0xd22e('0x96')](_0x55f24e[_0xd22e('0x56')]['ids'],_[_0xd22e('0x5e')](_0x55f24e[_0xd22e('0x56')],[_0xd22e('0x83'),'id'])||{})[_0xd22e('0x97')](function(_0x5cb95e){for(var _0x10bb10=0x0;_0x10bb10<_0x55f24e['body'][_0xd22e('0x83')][_0xd22e('0x45')];_0x10bb10+=0x1){socket[_0xd22e('0x82')]('userVoiceQueue:save',{'UserId':Number(_0x55f24e[_0xd22e('0x56')][_0xd22e('0x83')][_0x10bb10]),'VoiceQueueId':Number(_0x55f24e[_0xd22e('0x54')]['id'])});}return _0x5cb95e;});}})[_0xd22e('0x2a')](function(_0x15ecdf){_0x25ab9f=_0x15ecdf||[];if(_0x4fcc96){return db[_0xd22e('0x70')][_0xd22e('0x51')]({'where':{'id':_0x55f24e[_0xd22e('0x56')]['ids']},'attributes':['id',_0xd22e('0x36'),_0xd22e('0x71'),_0xd22e('0x81'),'interface'],'raw':!![]});}})[_0xd22e('0x2a')](function(_0x37021c){if(!_[_0xd22e('0x93')](_0x37021c)){var _0x80f112=[];for(var _0x1104cd=0x0;_0x1104cd<_0x37021c[_0xd22e('0x45')];_0x1104cd++){if(_0x37021c[_0x1104cd][_0xd22e('0x71')]){_0x80f112[_0xd22e('0x8e')](db['UserVoiceQueueRt'][_0xd22e('0x7b')]({'membername':_0x37021c[_0x1104cd][_0xd22e('0x36')],'UserId':_0x37021c[_0x1104cd]['id'],'queue_name':_0x4fcc96['name'],'VoiceQueueId':_0x4fcc96['id'],'interface':_[_0xd22e('0x98')](_0x37021c[_0x1104cd][_0xd22e('0x72')])?util['format'](_0xd22e('0x80'),_0x37021c[_0x1104cd][_0xd22e('0x36')]):_0x37021c[_0x1104cd][_0xd22e('0x72')],'paused':_0x37021c[_0x1104cd][_0xd22e('0x81')]||![],'penalty':_0x55f24e[_0xd22e('0x56')][_0xd22e('0x76')]||0x0}));}}return BPromise['all'](_0x80f112);}})[_0xd22e('0x2a')](function(){return _0x25ab9f;})[_0xd22e('0x2a')](respondWithResult(_0x5c2966,null))[_0xd22e('0x53')](handleError(_0x5c2966,null));};exports[_0xd22e('0x94')]=function(_0x246434,_0x57ef01,_0xda258d){return db[_0xd22e('0x3b')][_0xd22e('0x34')]({'where':{'id':_0x246434[_0xd22e('0x54')]['id']}})[_0xd22e('0x2a')](handleEntityNotFound(_0x57ef01,null))['then'](function(_0x264bcd){if(_0x264bcd){return _0x264bcd[_0xd22e('0x94')](_0x246434[_0xd22e('0x3e')][_0xd22e('0x83')])[_0xd22e('0x2a')](function(){if(_[_0xd22e('0x99')](_0x246434[_0xd22e('0x3e')][_0xd22e('0x83')])){for(var _0x2c3d99=0x0;_0x2c3d99<_0x246434[_0xd22e('0x3e')][_0xd22e('0x83')][_0xd22e('0x45')];_0x2c3d99+=0x1){socket['emit'](_0xd22e('0x95'),{'UserId':Number(_0x246434['query'][_0xd22e('0x83')][_0x2c3d99]),'VoiceQueueId':Number(_0x246434['params']['id'])});}}else{socket[_0xd22e('0x82')](_0xd22e('0x95'),{'UserId':Number(_0x246434[_0xd22e('0x3e')][_0xd22e('0x83')]),'VoiceQueueId':Number(_0x246434[_0xd22e('0x54')]['id'])});}});}})[_0xd22e('0x2a')](function(_0x1adbe6){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x246434[_0xd22e('0x54')]['id'],'UserId':_0x246434['query']['ids']}})[_0xd22e('0x2a')](function(){return _0x1adbe6;});})[_0xd22e('0x2a')](respondWithStatusCode(_0x57ef01,null))[_0xd22e('0x53')](handleError(_0x57ef01,null));};exports[_0xd22e('0x9a')]=function(_0x2b1bd2,_0x32fad8,_0x100d74){var _0x330b02={};var _0x4c032d={};var _0x21eec7;var _0x29adf4;return db[_0xd22e('0x3b')][_0xd22e('0x64')]({'where':{'id':_0x2b1bd2[_0xd22e('0x54')]['id']}})[_0xd22e('0x2a')](handleEntityNotFound(_0x32fad8,null))[_0xd22e('0x2a')](function(_0x29ce33){if(_0x29ce33){_0x21eec7=_0x29ce33;_0x4c032d[_0xd22e('0x42')]=_[_0xd22e('0x3f')](db['User'][_0xd22e('0x3c')]);_0x4c032d[_0xd22e('0x3e')]=_['keys'](_0x2b1bd2[_0xd22e('0x3e')]);_0x4c032d['filters']=_[_0xd22e('0x41')](_0x4c032d['model'],_0x4c032d[_0xd22e('0x3e')]);_0x330b02[_0xd22e('0x43')]=_[_0xd22e('0x41')](_0x4c032d[_0xd22e('0x42')],qs[_0xd22e('0x44')](_0x2b1bd2[_0xd22e('0x3e')][_0xd22e('0x44')]));_0x330b02['attributes']=_0x330b02[_0xd22e('0x43')][_0xd22e('0x45')]?_0x330b02[_0xd22e('0x43')]:_0x4c032d[_0xd22e('0x42')];_0x330b02[_0xd22e('0x47')]=qs['sort'](_0x2b1bd2[_0xd22e('0x3e')][_0xd22e('0x48')]);_0x330b02['where']=qs[_0xd22e('0x40')](_[_0xd22e('0x49')](_0x2b1bd2[_0xd22e('0x3e')],_0x4c032d[_0xd22e('0x40')]));if(_0x2b1bd2[_0xd22e('0x3e')][_0xd22e('0x4a')]){_0x330b02[_0xd22e('0x4b')]=_[_0xd22e('0x4c')](_0x330b02[_0xd22e('0x4b')],{'$or':_[_0xd22e('0x32')](_0x330b02[_0xd22e('0x43')],function(_0x19f492){var _0x4ca537={};_0x4ca537[_0x19f492]={'$like':'%'+_0x2b1bd2[_0xd22e('0x3e')][_0xd22e('0x4a')]+'%'};return _0x4ca537;})});}_0x330b02=_[_0xd22e('0x4c')]({},_0x330b02,_0x2b1bd2[_0xd22e('0x4e')]);return _0x21eec7[_0xd22e('0x9a')](_0x330b02);}})[_0xd22e('0x2a')](function(_0x2e7e2d){if(_0x2e7e2d){_0x29adf4=_0x2e7e2d['length'];if(!_0x2b1bd2['query']['hasOwnProperty'](_0xd22e('0x65'))){_0x330b02['limit']=qs[_0xd22e('0x22')](_0x2b1bd2[_0xd22e('0x3e')][_0xd22e('0x22')]);_0x330b02[_0xd22e('0x20')]=qs[_0xd22e('0x20')](_0x2b1bd2['query']['offset']);}return _0x21eec7[_0xd22e('0x9a')](_0x330b02);}})[_0xd22e('0x2a')](function(_0xd32cf8){if(_0xd32cf8){return _0xd32cf8?{'count':_0x29adf4,'rows':_0xd32cf8}:null;}})[_0xd22e('0x2a')](respondWithResult(_0x32fad8,null))['catch'](handleError(_0x32fad8,null));};exports[_0xd22e('0x9b')]=function(_0x36e848,_0x5700de,_0x149514){var _0x3b7b8b={};var _0x577748={};var _0x1d8a12;var _0x5c6ab4;return db['VoiceQueue'][_0xd22e('0x64')]({'where':{'id':_0x36e848[_0xd22e('0x54')]['id']}})['then'](handleEntityNotFound(_0x5700de,null))[_0xd22e('0x2a')](function(_0x20c502){if(_0x20c502){_0x1d8a12=_0x20c502;_0x577748[_0xd22e('0x42')]=_['keys'](db[_0xd22e('0x7e')][_0xd22e('0x3c')]);_0x577748['query']=_[_0xd22e('0x3f')](_0x36e848['query']);_0x577748[_0xd22e('0x40')]=_[_0xd22e('0x41')](_0x577748['model'],_0x577748[_0xd22e('0x3e')]);_0x3b7b8b['attributes']=_[_0xd22e('0x41')](_0x577748['model'],qs['fields'](_0x36e848[_0xd22e('0x3e')][_0xd22e('0x44')]));_0x3b7b8b['attributes']=_0x3b7b8b[_0xd22e('0x43')][_0xd22e('0x45')]?_0x3b7b8b[_0xd22e('0x43')]:_0x577748[_0xd22e('0x42')];_0x3b7b8b[_0xd22e('0x47')]=qs[_0xd22e('0x48')](_0x36e848['query'][_0xd22e('0x48')]);_0x3b7b8b[_0xd22e('0x4b')]=qs[_0xd22e('0x40')](_[_0xd22e('0x49')](_0x36e848[_0xd22e('0x3e')],_0x577748[_0xd22e('0x40')]));if(_0x36e848[_0xd22e('0x3e')]['filter']){_0x3b7b8b[_0xd22e('0x4b')]=_[_0xd22e('0x4c')](_0x3b7b8b[_0xd22e('0x4b')],{'$or':_[_0xd22e('0x32')](_0x3b7b8b['attributes'],function(_0x2475af){var _0x2faf46={};_0x2faf46[_0x2475af]={'$like':'%'+_0x36e848[_0xd22e('0x3e')]['filter']+'%'};return _0x2faf46;})});}_0x3b7b8b=_['merge']({},_0x3b7b8b,_0x36e848['options']);return _0x1d8a12[_0xd22e('0x9b')](_0x3b7b8b);}})['then'](function(_0x2ea285){if(_0x2ea285){_0x5c6ab4=_0x2ea285[_0xd22e('0x45')];if(!_0x36e848[_0xd22e('0x3e')][_0xd22e('0x46')](_0xd22e('0x65'))){_0x3b7b8b['limit']=qs[_0xd22e('0x22')](_0x36e848['query'][_0xd22e('0x22')]);_0x3b7b8b[_0xd22e('0x20')]=qs[_0xd22e('0x20')](_0x36e848['query'][_0xd22e('0x20')]);}return _0x1d8a12[_0xd22e('0x9b')](_0x3b7b8b);}})['then'](function(_0x5f5220){return _0x5f5220?{'count':_0x5c6ab4,'rows':_0x5f5220}:null;})['then'](respondWithResult(_0x5700de,null))[_0xd22e('0x53')](handleError(_0x5700de,null));};exports[_0xd22e('0x9c')]=function(_0x5197ff,_0x1cca8c,_0x185f33){var _0x453c4a={};var _0x3b7854={};var _0x58d9f5;var _0x49745f;return db[_0xd22e('0x3b')][_0xd22e('0x64')]({'where':{'id':_0x5197ff[_0xd22e('0x54')]['id']}})[_0xd22e('0x2a')](handleEntityNotFound(_0x1cca8c,null))[_0xd22e('0x2a')](function(_0x269e6f){if(_0x269e6f){_0x58d9f5=_0x269e6f;_0x3b7854[_0xd22e('0x42')]=_[_0xd22e('0x3f')](db[_0xd22e('0x9d')][_0xd22e('0x3c')]);_0x3b7854['query']=_['keys'](_0x5197ff[_0xd22e('0x3e')]);_0x3b7854['filters']=_[_0xd22e('0x41')](_0x3b7854[_0xd22e('0x42')],_0x3b7854[_0xd22e('0x3e')]);_0x453c4a[_0xd22e('0x43')]=_[_0xd22e('0x41')](_0x3b7854[_0xd22e('0x42')],qs[_0xd22e('0x44')](_0x5197ff[_0xd22e('0x3e')][_0xd22e('0x44')]));_0x453c4a[_0xd22e('0x43')]=_0x453c4a[_0xd22e('0x43')]['length']?_0x453c4a[_0xd22e('0x43')]:_0x3b7854[_0xd22e('0x42')];_0x453c4a[_0xd22e('0x47')]=qs['sort'](_0x5197ff[_0xd22e('0x3e')]['sort']);_0x453c4a[_0xd22e('0x4b')]=qs[_0xd22e('0x40')](_[_0xd22e('0x49')](_0x5197ff[_0xd22e('0x3e')],_0x3b7854[_0xd22e('0x40')]));if(_0x5197ff[_0xd22e('0x3e')][_0xd22e('0x4a')]){_0x453c4a[_0xd22e('0x4b')]=_[_0xd22e('0x4c')](_0x453c4a[_0xd22e('0x4b')],{'$or':_[_0xd22e('0x32')](_0x453c4a[_0xd22e('0x43')],function(_0x55e82d){var _0x99b626={};_0x99b626[_0x55e82d]={'$like':'%'+_0x5197ff[_0xd22e('0x3e')][_0xd22e('0x4a')]+'%'};return _0x99b626;})});}_0x453c4a=_[_0xd22e('0x4c')]({},_0x453c4a,_0x5197ff[_0xd22e('0x4e')]);return _0x58d9f5['getLists'](_0x453c4a);}})[_0xd22e('0x2a')](function(_0x47daf5){if(_0x47daf5){_0x49745f=_0x47daf5[_0xd22e('0x45')];if(!_0x5197ff[_0xd22e('0x3e')][_0xd22e('0x46')](_0xd22e('0x65'))){_0x453c4a['limit']=qs[_0xd22e('0x22')](_0x5197ff[_0xd22e('0x3e')][_0xd22e('0x22')]);_0x453c4a[_0xd22e('0x20')]=qs[_0xd22e('0x20')](_0x5197ff['query'][_0xd22e('0x20')]);}return _0x58d9f5['getLists'](_0x453c4a);}})[_0xd22e('0x2a')](function(_0x4bc939){if(_0x4bc939){return _0x4bc939?{'count':_0x49745f,'rows':_0x4bc939}:null;}})[_0xd22e('0x2a')](respondWithResult(_0x1cca8c,null))['catch'](handleError(_0x1cca8c,null));};exports[_0xd22e('0x9e')]=function(_0x16b9fa,_0x1d621c,_0x1cac5b){var _0x3539cc=moment()[_0xd22e('0x7f')](_0xd22e('0x9f'));var _0x531b52,_0x452ab9;return db[_0xd22e('0x3b')][_0xd22e('0x34')]({'where':{'id':_0x16b9fa[_0xd22e('0x54')]['id']}})['then'](handleEntityNotFound(_0x1d621c,null))['then'](function(_0x397587){if(_0x397587){_0x452ab9=_0x397587;return _0x397587['addLists'](_0x16b9fa[_0xd22e('0x56')][_0xd22e('0x83')],_[_0xd22e('0x5e')](_0x16b9fa['body'],[_0xd22e('0x83'),'id'])||{});}return null;})[_0xd22e('0x97')](function(_0x3398bc){var _0x542d18;_0x531b52=_0x3398bc||[];var _0x50c1f9=[];if(_0x3398bc){for(var _0x3b30cd=0x0;_0x3b30cd<_0x3398bc[_0xd22e('0x45')];_0x3b30cd+=0x1){var _0x2ac5c4=_0x3398bc[_0x3b30cd][_0xd22e('0x2c')]({'plain':!![]});_0x452ab9[_0xd22e('0xa0')]=_0x16b9fa[_0xd22e('0x56')]['dialCheckDuplicateType']?_0x16b9fa[_0xd22e('0x56')]['dialCheckDuplicateType']:_0x452ab9[_0xd22e('0xa0')];switch(_0x452ab9[_0xd22e('0xa0')]){case _0xd22e('0xa1'):_0x542d18=squel[_0xd22e('0xa2')]()[_0xd22e('0xa3')](_0xd22e('0xa4'))[_0xd22e('0xa5')]([_0xd22e('0xa6'),_0xd22e('0xa7'),_0xd22e('0xa8'),_0xd22e('0xa9'),_0xd22e('0x66'),'createdAt',_0xd22e('0x60')],squel[_0xd22e('0x84')]()[_0xd22e('0x85')]('phone',_0xd22e('0xa6'))[_0xd22e('0x85')]('\x27'+_0x3539cc+'\x27','scheduledAt')[_0xd22e('0x85')]('id',_0xd22e('0xa8'))[_0xd22e('0x85')](_0x2ac5c4['CmListId'][_0xd22e('0xaa')](),'ListId')[_0xd22e('0x85')](_0x16b9fa[_0xd22e('0x54')]['id'][_0xd22e('0xaa')](),'VoiceQueueId')[_0xd22e('0x85')]('\x27'+_0x3539cc+'\x27',_0xd22e('0x5f'))['field']('\x27'+_0x3539cc+'\x27',_0xd22e('0x60'))['from'](_0xd22e('0xab'))[_0xd22e('0x4b')]('deletedAt\x20IS\x20NULL')['where'](_0xd22e('0xac'),_0x2ac5c4['CmListId']['toString']())[_0xd22e('0x4b')]('phone\x20IS\x20NOT\x20NULL')[_0xd22e('0x4b')](_0xd22e('0xad'),squel['select']()[_0xd22e('0x85')](_0xd22e('0xae'))[_0xd22e('0x87')](_0xd22e('0xaf'))[_0xd22e('0x4b')]('VoiceQueueId\x20=\x20?',_0x16b9fa['params']['id'][_0xd22e('0xaa')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xd22e('0x84')]()[_0xd22e('0x85')]('COALESCE(phone,\x27\x27)')[_0xd22e('0x87')]('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0x16b9fa[_0xd22e('0x54')]['id'][_0xd22e('0xaa')]())))[_0xd22e('0xaa')]();break;case _0xd22e('0xb0'):_0x542d18=squel[_0xd22e('0xa2')]()['into'](_0xd22e('0xa4'))[_0xd22e('0xa5')](['phone','scheduledAt',_0xd22e('0xa8'),_0xd22e('0xa9'),_0xd22e('0x66'),_0xd22e('0x5f'),'updatedAt'],squel['select']()[_0xd22e('0x85')](_0xd22e('0xa6'),'phone')['field']('\x27'+_0x3539cc+'\x27',_0xd22e('0xa7'))[_0xd22e('0x85')]('id',_0xd22e('0xa8'))[_0xd22e('0x85')](_0x2ac5c4['CmListId'][_0xd22e('0xaa')](),_0xd22e('0xa9'))[_0xd22e('0x85')](_0x16b9fa[_0xd22e('0x54')]['id'][_0xd22e('0xaa')](),'VoiceQueueId')[_0xd22e('0x85')]('\x27'+_0x3539cc+'\x27',_0xd22e('0x5f'))[_0xd22e('0x85')]('\x27'+_0x3539cc+'\x27',_0xd22e('0x60'))[_0xd22e('0x87')](_0xd22e('0xab'))[_0xd22e('0x4b')](_0xd22e('0xb1'))[_0xd22e('0x4b')]('ListId\x20=\x20?',_0x2ac5c4['CmListId'][_0xd22e('0xaa')]())[_0xd22e('0x4b')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xd22e('0xad'),squel[_0xd22e('0x84')]()[_0xd22e('0x85')](_0xd22e('0xb2'))[_0xd22e('0x87')](_0xd22e('0xa4'))[_0xd22e('0x4b')]('VoiceQueueId\x20=\x20?',_0x16b9fa[_0xd22e('0x54')]['id'][_0xd22e('0xaa')]())))[_0xd22e('0xaa')]();break;default:_0x542d18=squel['insert']()[_0xd22e('0xa3')](_0xd22e('0xa4'))[_0xd22e('0xa5')](['phone',_0xd22e('0xa7'),'ContactId',_0xd22e('0xa9'),_0xd22e('0x66'),_0xd22e('0x5f'),_0xd22e('0x60')],squel[_0xd22e('0x84')]()[_0xd22e('0x85')]('phone',_0xd22e('0xa6'))[_0xd22e('0x85')]('\x27'+_0x3539cc+'\x27',_0xd22e('0xa7'))[_0xd22e('0x85')]('id',_0xd22e('0xa8'))[_0xd22e('0x85')](_0x2ac5c4['CmListId'][_0xd22e('0xaa')](),'ListId')['field'](_0x16b9fa[_0xd22e('0x54')]['id'][_0xd22e('0xaa')](),_0xd22e('0x66'))[_0xd22e('0x85')]('\x27'+_0x3539cc+'\x27','createdAt')[_0xd22e('0x85')]('\x27'+_0x3539cc+'\x27','updatedAt')[_0xd22e('0x87')](_0xd22e('0xab'))[_0xd22e('0x4b')](_0xd22e('0xb1'))[_0xd22e('0x4b')](_0xd22e('0xac'),_0x2ac5c4[_0xd22e('0xb3')][_0xd22e('0xaa')]())[_0xd22e('0x4b')](_0xd22e('0xb4')))['toString']();}_0x50c1f9[_0xd22e('0x8e')](db[_0xd22e('0x77')][_0xd22e('0x3e')](_0x542d18));}return BPromise[_0xd22e('0xb5')](_0x50c1f9);}})[_0xd22e('0x2a')](function(){var _0x2d361e=[];var _0x2bedd5=squel['insert']()['into']('cm_hopper_additional_phones')[_0xd22e('0xa5')](['CmHopperId','phone',_0xd22e('0xb6'),_0xd22e('0x5f'),'updatedAt'],squel[_0xd22e('0x84')]()[_0xd22e('0x85')](_0xd22e('0xb7'))[_0xd22e('0x85')](_0xd22e('0xb8'))[_0xd22e('0x85')](_0xd22e('0xb9'))[_0xd22e('0x85')]('\x27'+_0x3539cc+'\x27','createdAt')['field']('\x27'+_0x3539cc+'\x27',_0xd22e('0x60'))[_0xd22e('0x87')](_0xd22e('0xba'),'ci')['join'](_0xd22e('0xa4'),'h',_0xd22e('0xbb'))[_0xd22e('0x4b')](_0xd22e('0xbc'),_0x3539cc)['where'](_0xd22e('0xbd'),_0xd22e('0xbe')))[_0xd22e('0xaa')]();_0x2d361e['push'](db[_0xd22e('0x77')][_0xd22e('0x3e')](_0x2bedd5));return BPromise[_0xd22e('0xb5')](_0x2d361e);})[_0xd22e('0x2a')](function(){return _0x531b52;})[_0xd22e('0x2a')](respondWithResult(_0x1d621c,null))[_0xd22e('0x53')](handleError(_0x1d621c,null));};exports[_0xd22e('0xbf')]=function(_0x2f687e,_0x100ed4,_0x1daab8){return db[_0xd22e('0x3b')][_0xd22e('0x34')]({'where':{'id':_0x2f687e[_0xd22e('0x54')]['id']}})[_0xd22e('0x2a')](handleEntityNotFound(_0x100ed4,null))[_0xd22e('0x2a')](function(_0x920446){if(_0x920446){return _0x920446['removeLists'](_0x2f687e[_0xd22e('0x3e')][_0xd22e('0x83')]);}})[_0xd22e('0x2a')](function(_0x586588){if(_0x586588){return db[_0xd22e('0x67')][_0xd22e('0x2b')]({'where':{'ListId':_0x2f687e[_0xd22e('0x3e')][_0xd22e('0x83')],'VoiceQueueId':_0x2f687e[_0xd22e('0x54')]['id']}})[_0xd22e('0x2a')](function(){return _0x586588;});}})[_0xd22e('0x2a')](respondWithStatusCode(_0x100ed4,null))[_0xd22e('0x53')](handleError(_0x100ed4,null));};exports[_0xd22e('0xc0')]=function(_0x4a7ee8,_0x1671bb,_0x4a7994){var _0x491775={};var _0x4d48d1={};var _0x509b66;var _0x13dd4d;return db[_0xd22e('0x3b')][_0xd22e('0x64')]({'where':{'id':_0x4a7ee8[_0xd22e('0x54')]['id']}})[_0xd22e('0x2a')](handleEntityNotFound(_0x1671bb,null))[_0xd22e('0x2a')](function(_0x46956){if(_0x46956){_0x509b66=_0x46956;_0x4d48d1[_0xd22e('0x42')]=_[_0xd22e('0x3f')](db[_0xd22e('0x9d')][_0xd22e('0x3c')]);_0x4d48d1[_0xd22e('0x3e')]=_[_0xd22e('0x3f')](_0x4a7ee8[_0xd22e('0x3e')]);_0x4d48d1[_0xd22e('0x40')]=_[_0xd22e('0x41')](_0x4d48d1[_0xd22e('0x42')],_0x4d48d1['query']);_0x491775[_0xd22e('0x43')]=_[_0xd22e('0x41')](_0x4d48d1['model'],qs[_0xd22e('0x44')](_0x4a7ee8[_0xd22e('0x3e')][_0xd22e('0x44')]));_0x491775[_0xd22e('0x43')]=_0x491775[_0xd22e('0x43')][_0xd22e('0x45')]?_0x491775[_0xd22e('0x43')]:_0x4d48d1['model'];_0x491775[_0xd22e('0x47')]=qs[_0xd22e('0x48')](_0x4a7ee8[_0xd22e('0x3e')][_0xd22e('0x48')]);_0x491775['where']=qs['filters'](_[_0xd22e('0x49')](_0x4a7ee8[_0xd22e('0x3e')],_0x4d48d1[_0xd22e('0x40')]));if(_0x4a7ee8[_0xd22e('0x3e')][_0xd22e('0x4a')]){_0x491775[_0xd22e('0x4b')]=_[_0xd22e('0x4c')](_0x491775['where'],{'$or':_[_0xd22e('0x32')](_0x491775['attributes'],function(_0x39e2b0){var _0x101083={};_0x101083[_0x39e2b0]={'$like':'%'+_0x4a7ee8['query'][_0xd22e('0x4a')]+'%'};return _0x101083;})});}_0x491775=_[_0xd22e('0x4c')]({},_0x491775,_0x4a7ee8[_0xd22e('0x4e')]);return _0x509b66[_0xd22e('0xc0')](_0x491775);}})['then'](function(_0x4705a8){if(_0x4705a8){_0x13dd4d=_0x4705a8[_0xd22e('0x45')];if(!_0x4a7ee8[_0xd22e('0x3e')][_0xd22e('0x46')](_0xd22e('0x65'))){_0x491775['limit']=qs['limit'](_0x4a7ee8[_0xd22e('0x3e')][_0xd22e('0x22')]);_0x491775[_0xd22e('0x20')]=qs[_0xd22e('0x20')](_0x4a7ee8[_0xd22e('0x3e')][_0xd22e('0x20')]);}return _0x509b66[_0xd22e('0xc0')](_0x491775);}})[_0xd22e('0x2a')](function(_0x46ad8d){if(_0x46ad8d){return _0x46ad8d?{'count':_0x13dd4d,'rows':_0x46ad8d}:null;}})['then'](respondWithResult(_0x1671bb,null))['catch'](handleError(_0x1671bb,null));};exports[_0xd22e('0xc1')]=function(_0x28a475,_0x1ad86d,_0x3e25df){var _0x42fd85,_0x40af2d;return db[_0xd22e('0x3b')][_0xd22e('0x34')]({'where':{'id':_0x28a475[_0xd22e('0x54')]['id']}})['then'](handleEntityNotFound(_0x1ad86d,null))[_0xd22e('0x2a')](function(_0x5ba842){if(_0x5ba842){_0x40af2d=_0x5ba842;return _0x5ba842[_0xd22e('0xc1')](_0x28a475[_0xd22e('0x56')][_0xd22e('0x83')],_[_0xd22e('0x5e')](_0x28a475['body'],[_0xd22e('0x83'),'id'])||{});}return null;})[_0xd22e('0x97')](function(_0x3f7581){var _0x4e1ece;_0x42fd85=_0x3f7581||[];var _0x3b6f48=[];if(_0x3f7581){for(var _0x5a0fd0=0x0;_0x5a0fd0<_0x3f7581[_0xd22e('0x45')];_0x5a0fd0+=0x1){var _0x25fcd7=_0x3f7581[_0x5a0fd0][_0xd22e('0x2c')]({'plain':!![]});_0x4e1ece=squel[_0xd22e('0xa2')]()[_0xd22e('0xa3')](_0xd22e('0xc2'))[_0xd22e('0xa5')]([_0xd22e('0xa6'),_0xd22e('0xa8'),'ListId',_0xd22e('0x66'),_0xd22e('0x5f'),_0xd22e('0x60')],squel[_0xd22e('0x84')]()['field'](_0xd22e('0xa6'),'phone')[_0xd22e('0x85')]('id',_0xd22e('0xa8'))[_0xd22e('0x85')](_0x25fcd7['CmListId'][_0xd22e('0xaa')](),_0xd22e('0xa9'))[_0xd22e('0x85')](_0x28a475[_0xd22e('0x54')]['id'][_0xd22e('0xaa')](),_0xd22e('0x66'))['field'](_0xd22e('0xc3'),_0xd22e('0x5f'))['field']('NOW()',_0xd22e('0x60'))[_0xd22e('0x87')]('cm_contacts')[_0xd22e('0x4b')](_0xd22e('0xb1'))[_0xd22e('0x4b')](_0xd22e('0xac'),_0x25fcd7['CmListId'][_0xd22e('0xaa')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0xd22e('0xaa')]();_0x3b6f48[_0xd22e('0x8e')](db[_0xd22e('0x77')]['query'](_0x4e1ece));}return BPromise[_0xd22e('0xb5')](_0x3b6f48);}})[_0xd22e('0x2a')](function(){return _0x42fd85;})[_0xd22e('0x2a')](respondWithResult(_0x1ad86d,null))['catch'](handleError(_0x1ad86d,null));};exports[_0xd22e('0xc4')]=function(_0x33ec20,_0x275721,_0x3f5bb1){return db['VoiceQueue'][_0xd22e('0x34')]({'where':{'id':_0x33ec20[_0xd22e('0x54')]['id']}})[_0xd22e('0x2a')](handleEntityNotFound(_0x275721,null))[_0xd22e('0x2a')](function(_0x502542){if(_0x502542){return _0x502542[_0xd22e('0xc4')](_0x33ec20[_0xd22e('0x3e')][_0xd22e('0x83')]);}})[_0xd22e('0x2a')](function(_0x57cb37){if(_0x57cb37){return db[_0xd22e('0x6d')][_0xd22e('0x2b')]({'where':{'ListId':_0x33ec20[_0xd22e('0x3e')]['ids'],'VoiceQueueId':_0x33ec20['params']['id']}})[_0xd22e('0x2a')](function(){return _0x57cb37;});}})[_0xd22e('0x2a')](respondWithStatusCode(_0x275721,null))[_0xd22e('0x53')](handleError(_0x275721,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 12c38e5..07ecabf 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 _0x1025=['remove','emit','hook','exports','events','../../mysqldb'];(function(_0x4fbff3,_0x484761){var _0x68b35a=function(_0x58c052){while(--_0x58c052){_0x4fbff3['push'](_0x4fbff3['shift']());}};_0x68b35a(++_0x484761);}(_0x1025,0x142));var _0x5102=function(_0x3a23b4,_0x49d839){_0x3a23b4=_0x3a23b4-0x0;var _0x302bca=_0x1025[_0x3a23b4];return _0x302bca;};'use strict';var EventEmitter=require(_0x5102('0x0'));var VoiceQueue=require(_0x5102('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5102('0x2')};function emitEvent(_0x223093){return function(_0x5aba01,_0x1aa5f7,_0x387956){VoiceQueueEvents[_0x5102('0x3')](_0x223093+':'+_0x5aba01['id'],_0x5aba01);VoiceQueueEvents[_0x5102('0x3')](_0x223093,_0x5aba01);_0x387956(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x5102('0x4')](e,emitEvent(event));}}module[_0x5102('0x5')]=VoiceQueueEvents; \ No newline at end of file +var _0x9bcf=['VoiceQueue','emit','exports','events','../../mysqldb'];(function(_0x4c0b67,_0x5f38b0){var _0x130d72=function(_0x13e601){while(--_0x13e601){_0x4c0b67['push'](_0x4c0b67['shift']());}};_0x130d72(++_0x5f38b0);}(_0x9bcf,0xfd));var _0xf9bc=function(_0x4858ed,_0x5b293f){_0x4858ed=_0x4858ed-0x0;var _0x30b87e=_0x9bcf[_0x4858ed];return _0x30b87e;};'use strict';var EventEmitter=require(_0xf9bc('0x0'));var VoiceQueue=require(_0xf9bc('0x1'))['db'][_0xf9bc('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x282e05){return function(_0x290647,_0x52a7b1,_0x3e8534){VoiceQueueEvents[_0xf9bc('0x3')](_0x282e05+':'+_0x290647['id'],_0x290647);VoiceQueueEvents['emit'](_0x282e05,_0x290647);_0x3e8534(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xf9bc('0x4')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 8845a70..a792cbf 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(_0x3cc4c8,_0x114636){var _0xdc0123=function(_0x1c3078){while(--_0x1c3078){_0x3cc4c8['push'](_0x3cc4c8['shift']());}};_0xdc0123(++_0x114636);}(_0x008c,0x188));var _0xc008=function(_0x3008b1,_0x2a89f){_0x3008b1=_0x3008b1-0x0;var _0x1922d9=_0x008c[_0x3008b1];return _0x1922d9;};'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 _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x42fc51,_0x1033a2){var _0x1513b4=function(_0x52b4d3){while(--_0x52b4d3){_0x42fc51['push'](_0x42fc51['shift']());}};_0x1513b4(++_0x1033a2);}(_0x9c44,0x178));var _0x49c4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9c44[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index d782209..63893a6 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 _0xdfed=['VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','attributes','limit','map','include','model','ShowVoiceQueue','where','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','request','then','info'];(function(_0x5eb250,_0x10e901){var _0xdab1b2=function(_0x5131fe){while(--_0x5131fe){_0x5eb250['push'](_0x5eb250['shift']());}};_0xdab1b2(++_0x10e901);}(_0xdfed,0x155));var _0xddfe=function(_0x39d711,_0xe11eb7){_0x39d711=_0x39d711-0x0;var _0xee1d0c=_0xdfed[_0x39d711];return _0xee1d0c;};'use strict';var _=require(_0xddfe('0x0'));var util=require(_0xddfe('0x1'));var moment=require(_0xddfe('0x2'));var BPromise=require(_0xddfe('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xddfe('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xddfe('0x5'));var logger=require(_0xddfe('0x6'))(_0xddfe('0x7'));var config=require(_0xddfe('0x8'));var jayson=require(_0xddfe('0x9'));var client=jayson['client'][_0xddfe('0xa')]({'port':0x232a});config['redis']=_[_0xddfe('0xb')](config[_0xddfe('0xc')],{'host':_0xddfe('0xd'),'port':0x18eb});var socket=require(_0xddfe('0xe'))(new Redis(config[_0xddfe('0xc')]));require(_0xddfe('0xf'))['register'](socket);function respondWithRpcPromise(_0x35be61,_0x5531d7,_0x40fe39){return new BPromise(function(_0x30cb75,_0x56a254){return client[_0xddfe('0x10')](_0x35be61,_0x40fe39)[_0xddfe('0x11')](function(_0x4c4b78){logger[_0xddfe('0x12')](_0xddfe('0x13'),_0x5531d7,'request\x20sent');logger[_0xddfe('0x14')](_0xddfe('0x15'),_0x5531d7,_0xddfe('0x16'),JSON[_0xddfe('0x17')](_0x4c4b78));if(_0x4c4b78[_0xddfe('0x18')]){if(_0x4c4b78[_0xddfe('0x18')]['code']===0x1f4){logger[_0xddfe('0x18')](_0xddfe('0x13'),_0x5531d7,_0x4c4b78['error'][_0xddfe('0x19')]);return _0x56a254(_0x4c4b78[_0xddfe('0x18')][_0xddfe('0x19')]);}logger['error'](_0xddfe('0x13'),_0x5531d7,_0x4c4b78['error'][_0xddfe('0x19')]);return _0x30cb75(_0x4c4b78[_0xddfe('0x18')]['message']);}else{logger[_0xddfe('0x12')](_0xddfe('0x13'),_0x5531d7,_0xddfe('0x16'));_0x30cb75(_0x4c4b78[_0xddfe('0x1a')][_0xddfe('0x19')]);}})[_0xddfe('0x1b')](function(_0x5dd6dd){logger[_0xddfe('0x18')](_0xddfe('0x13'),_0x5531d7,_0x5dd6dd);_0x56a254(_0x5dd6dd);});});}exports[_0xddfe('0x1c')]=function(_0x28cd10){var _0x11b2c0=this;return new Promise(function(_0xe78125,_0x114a6b){return db[_0xddfe('0x1d')][_0xddfe('0x1e')]({'raw':_0x28cd10['options']?_0x28cd10[_0xddfe('0x1f')][_0xddfe('0x20')]===undefined?!![]:![]:!![],'where':_0x28cd10[_0xddfe('0x1f')]?_0x28cd10[_0xddfe('0x1f')]['where']||null:null,'attributes':_0x28cd10[_0xddfe('0x1f')]?_0x28cd10[_0xddfe('0x1f')][_0xddfe('0x21')]||null:null,'limit':_0x28cd10[_0xddfe('0x1f')]?_0x28cd10[_0xddfe('0x1f')][_0xddfe('0x22')]||null:null,'include':_0x28cd10[_0xddfe('0x1f')]?_0x28cd10[_0xddfe('0x1f')]['include']?_[_0xddfe('0x23')](_0x28cd10['options'][_0xddfe('0x24')],function(_0x227053){return{'model':db[_0x227053[_0xddfe('0x25')]],'as':_0x227053['as'],'attributes':_0x227053[_0xddfe('0x21')],'include':_0x227053['include']?_[_0xddfe('0x23')](_0x227053[_0xddfe('0x24')],function(_0x3c01cf){return{'model':db[_0x3c01cf['model']],'as':_0x3c01cf['as'],'attributes':_0x3c01cf[_0xddfe('0x21')],'include':_0x3c01cf[_0xddfe('0x24')]?_[_0xddfe('0x23')](_0x3c01cf[_0xddfe('0x24')],function(_0x376b84){return{'model':db[_0x376b84[_0xddfe('0x25')]],'as':_0x376b84['as'],'attributes':_0x376b84[_0xddfe('0x21')]};}):[]};}):[]};}):[]:[]})[_0xddfe('0x11')](function(_0x52bcab){logger[_0xddfe('0x12')]('GetVoiceQueue',_0x28cd10);logger[_0xddfe('0x14')](_0xddfe('0x1c'),_0x28cd10,JSON[_0xddfe('0x17')](_0x52bcab));_0xe78125(_0x52bcab);})['catch'](function(_0x804be4){logger[_0xddfe('0x18')](_0xddfe('0x1c'),_0x804be4[_0xddfe('0x19')],_0x28cd10);_0x114a6b(_0x11b2c0[_0xddfe('0x18')](0x1f4,_0x804be4[_0xddfe('0x19')]));});});};exports[_0xddfe('0x26')]=function(_0x48cb72){var _0x1b98e4=this;return new Promise(function(_0x22972c,_0xf167b1){return db[_0xddfe('0x1d')]['find']({'raw':_0x48cb72['options']?_0x48cb72['options'][_0xddfe('0x20')]===undefined?!![]:![]:!![],'where':_0x48cb72['options']?_0x48cb72[_0xddfe('0x1f')][_0xddfe('0x27')]||null:null,'attributes':_0x48cb72[_0xddfe('0x1f')]?_0x48cb72[_0xddfe('0x1f')][_0xddfe('0x21')]||null:null,'include':_0x48cb72[_0xddfe('0x1f')]?_0x48cb72[_0xddfe('0x1f')]['include']?_[_0xddfe('0x23')](_0x48cb72[_0xddfe('0x1f')][_0xddfe('0x24')],function(_0x4a2263){return{'model':db[_0x4a2263[_0xddfe('0x25')]],'as':_0x4a2263['as'],'attributes':_0x4a2263[_0xddfe('0x21')],'include':_0x4a2263['include']?_[_0xddfe('0x23')](_0x4a2263[_0xddfe('0x24')],function(_0x3010ae){return{'model':db[_0x3010ae[_0xddfe('0x25')]],'as':_0x3010ae['as'],'attributes':_0x3010ae['attributes'],'include':_0x3010ae['include']?_['map'](_0x3010ae[_0xddfe('0x24')],function(_0x1cf661){return{'model':db[_0x1cf661[_0xddfe('0x25')]],'as':_0x1cf661['as'],'attributes':_0x1cf661[_0xddfe('0x21')]};}):[]};}):[]};}):[]:[]})[_0xddfe('0x11')](function(_0x41ebae){logger['info'](_0xddfe('0x26'),_0x48cb72);logger[_0xddfe('0x14')](_0xddfe('0x26'),_0x48cb72,JSON[_0xddfe('0x17')](_0x41ebae));_0x22972c(_0x41ebae);})[_0xddfe('0x1b')](function(_0x41cb60){logger[_0xddfe('0x18')]('ShowVoiceQueue',_0x41cb60['message'],_0x48cb72);_0xf167b1(_0x1b98e4[_0xddfe('0x18')](0x1f4,_0x41cb60[_0xddfe('0x19')]));});});}; \ No newline at end of file +var _0xb136=['map','model','attributes','stringify','ShowVoiceQueue','find','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','request\x20sent','debug','error','code','VoiceQueue,\x20%s,\x20%s','message','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','include'];(function(_0x2e2292,_0x1891b8){var _0x4f77ab=function(_0x3e5cb6){while(--_0x3e5cb6){_0x2e2292['push'](_0x2e2292['shift']());}};_0x4f77ab(++_0x1891b8);}(_0xb136,0x78));var _0x6b13=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xb136[_0x29d915];return _0x160f86;};'use strict';var _=require(_0x6b13('0x0'));var util=require('util');var moment=require(_0x6b13('0x1'));var BPromise=require(_0x6b13('0x2'));var rs=require(_0x6b13('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b13('0x4'))['db'];var utils=require(_0x6b13('0x5'));var logger=require(_0x6b13('0x6'))('rpc');var config=require(_0x6b13('0x7'));var jayson=require(_0x6b13('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x6b13('0x9')]=_[_0x6b13('0xa')](config[_0x6b13('0x9')],{'host':_0x6b13('0xb'),'port':0x18eb});var socket=require(_0x6b13('0xc'))(new Redis(config[_0x6b13('0x9')]));require(_0x6b13('0xd'))[_0x6b13('0xe')](socket);function respondWithRpcPromise(_0x29a75c,_0x834484,_0x4d3f03){return new BPromise(function(_0x2ba717,_0x2943e4){return client[_0x6b13('0xf')](_0x29a75c,_0x4d3f03)[_0x6b13('0x10')](function(_0x4a4bc3){logger[_0x6b13('0x11')]('VoiceQueue,\x20%s,\x20%s',_0x834484,_0x6b13('0x12'));logger[_0x6b13('0x13')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x834484,_0x6b13('0x12'),JSON['stringify'](_0x4a4bc3));if(_0x4a4bc3[_0x6b13('0x14')]){if(_0x4a4bc3[_0x6b13('0x14')][_0x6b13('0x15')]===0x1f4){logger[_0x6b13('0x14')](_0x6b13('0x16'),_0x834484,_0x4a4bc3[_0x6b13('0x14')][_0x6b13('0x17')]);return _0x2943e4(_0x4a4bc3[_0x6b13('0x14')][_0x6b13('0x17')]);}logger[_0x6b13('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x834484,_0x4a4bc3['error'][_0x6b13('0x17')]);return _0x2ba717(_0x4a4bc3[_0x6b13('0x14')][_0x6b13('0x17')]);}else{logger[_0x6b13('0x11')](_0x6b13('0x16'),_0x834484,'request\x20sent');_0x2ba717(_0x4a4bc3['result'][_0x6b13('0x17')]);}})[_0x6b13('0x18')](function(_0x562012){logger[_0x6b13('0x14')](_0x6b13('0x16'),_0x834484,_0x562012);_0x2943e4(_0x562012);});});}exports[_0x6b13('0x19')]=function(_0x191dd3){var _0x5c6cff=this;return new Promise(function(_0x62d7bb,_0x50cbe5){return db[_0x6b13('0x1a')][_0x6b13('0x1b')]({'raw':_0x191dd3[_0x6b13('0x1c')]?_0x191dd3['options'][_0x6b13('0x1d')]===undefined?!![]:![]:!![],'where':_0x191dd3['options']?_0x191dd3[_0x6b13('0x1c')][_0x6b13('0x1e')]||null:null,'attributes':_0x191dd3[_0x6b13('0x1c')]?_0x191dd3[_0x6b13('0x1c')]['attributes']||null:null,'limit':_0x191dd3[_0x6b13('0x1c')]?_0x191dd3[_0x6b13('0x1c')]['limit']||null:null,'include':_0x191dd3[_0x6b13('0x1c')]?_0x191dd3[_0x6b13('0x1c')][_0x6b13('0x1f')]?_[_0x6b13('0x20')](_0x191dd3['options'][_0x6b13('0x1f')],function(_0x155b76){return{'model':db[_0x155b76[_0x6b13('0x21')]],'as':_0x155b76['as'],'attributes':_0x155b76[_0x6b13('0x22')],'include':_0x155b76[_0x6b13('0x1f')]?_['map'](_0x155b76[_0x6b13('0x1f')],function(_0x638968){return{'model':db[_0x638968['model']],'as':_0x638968['as'],'attributes':_0x638968['attributes'],'include':_0x638968[_0x6b13('0x1f')]?_[_0x6b13('0x20')](_0x638968[_0x6b13('0x1f')],function(_0x5d8f63){return{'model':db[_0x5d8f63[_0x6b13('0x21')]],'as':_0x5d8f63['as'],'attributes':_0x5d8f63[_0x6b13('0x22')]};}):[]};}):[]};}):[]:[]})[_0x6b13('0x10')](function(_0x1d53d7){logger['info'](_0x6b13('0x19'),_0x191dd3);logger[_0x6b13('0x13')](_0x6b13('0x19'),_0x191dd3,JSON[_0x6b13('0x23')](_0x1d53d7));_0x62d7bb(_0x1d53d7);})[_0x6b13('0x18')](function(_0x285ee){logger[_0x6b13('0x14')](_0x6b13('0x19'),_0x285ee[_0x6b13('0x17')],_0x191dd3);_0x50cbe5(_0x5c6cff[_0x6b13('0x14')](0x1f4,_0x285ee[_0x6b13('0x17')]));});});};exports[_0x6b13('0x24')]=function(_0x5c039d){var _0xaf686=this;return new Promise(function(_0x178dfc,_0x48b54f){return db[_0x6b13('0x1a')][_0x6b13('0x25')]({'raw':_0x5c039d[_0x6b13('0x1c')]?_0x5c039d[_0x6b13('0x1c')][_0x6b13('0x1d')]===undefined?!![]:![]:!![],'where':_0x5c039d[_0x6b13('0x1c')]?_0x5c039d['options']['where']||null:null,'attributes':_0x5c039d['options']?_0x5c039d[_0x6b13('0x1c')][_0x6b13('0x22')]||null:null,'include':_0x5c039d[_0x6b13('0x1c')]?_0x5c039d['options'][_0x6b13('0x1f')]?_[_0x6b13('0x20')](_0x5c039d[_0x6b13('0x1c')][_0x6b13('0x1f')],function(_0x47bed2){return{'model':db[_0x47bed2['model']],'as':_0x47bed2['as'],'attributes':_0x47bed2['attributes'],'include':_0x47bed2[_0x6b13('0x1f')]?_[_0x6b13('0x20')](_0x47bed2[_0x6b13('0x1f')],function(_0xdba042){return{'model':db[_0xdba042[_0x6b13('0x21')]],'as':_0xdba042['as'],'attributes':_0xdba042[_0x6b13('0x22')],'include':_0xdba042[_0x6b13('0x1f')]?_[_0x6b13('0x20')](_0xdba042[_0x6b13('0x1f')],function(_0xdbeebf){return{'model':db[_0xdbeebf[_0x6b13('0x21')]],'as':_0xdbeebf['as'],'attributes':_0xdbeebf[_0x6b13('0x22')]};}):[]};}):[]};}):[]:[]})[_0x6b13('0x10')](function(_0x24b87a){logger[_0x6b13('0x11')](_0x6b13('0x24'),_0x5c039d);logger[_0x6b13('0x13')](_0x6b13('0x24'),_0x5c039d,JSON[_0x6b13('0x23')](_0x24b87a));_0x178dfc(_0x24b87a);})[_0x6b13('0x18')](function(_0xaa5a35){logger[_0x6b13('0x14')](_0x6b13('0x24'),_0xaa5a35[_0x6b13('0x17')],_0x5c039d);_0x48b54f(_0xaf686[_0x6b13('0x14')](0x1f4,_0xaa5a35[_0x6b13('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 3d3c23e..2472c74 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 _0x8075=['voiceQueue:','./voiceQueue.events','update','emit','removeListener','register','length'];(function(_0x557dc4,_0x2c86c6){var _0x51e824=function(_0x2a13f9){while(--_0x2a13f9){_0x557dc4['push'](_0x557dc4['shift']());}};_0x51e824(++_0x2c86c6);}(_0x8075,0x120));var _0x5807=function(_0xdeaa59,_0x397809){_0xdeaa59=_0xdeaa59-0x0;var _0x21b7ae=_0x8075[_0xdeaa59];return _0x21b7ae;};'use strict';var VoiceQueueEvents=require(_0x5807('0x0'));var events=['save','remove',_0x5807('0x1')];function createListener(_0x555b79,_0x17ceb5){return function(_0x5a8c43){_0x17ceb5[_0x5807('0x2')](_0x555b79,_0x5a8c43);};}function removeListener(_0x9c8446,_0x1e29f0){return function(){VoiceQueueEvents[_0x5807('0x3')](_0x9c8446,_0x1e29f0);};}exports[_0x5807('0x4')]=function(_0xfc5b6c){for(var _0x505112=0x0,_0x1adc08=events[_0x5807('0x5')];_0x505112<_0x1adc08;_0x505112++){var _0x15a206=events[_0x505112];var _0x484073=createListener(_0x5807('0x6')+_0x15a206,_0xfc5b6c);VoiceQueueEvents['on'](_0x15a206,_0x484073);}}; \ No newline at end of file +var _0x7415=['length','voiceQueue:','remove','update','emit','register'];(function(_0xbcc968,_0x538620){var _0x5a0926=function(_0x152fc3){while(--_0x152fc3){_0xbcc968['push'](_0xbcc968['shift']());}};_0x5a0926(++_0x538620);}(_0x7415,0xe0));var _0x5741=function(_0x1b28d2,_0x4e57ef){_0x1b28d2=_0x1b28d2-0x0;var _0x52e669=_0x7415[_0x1b28d2];return _0x52e669;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=['save',_0x5741('0x0'),_0x5741('0x1')];function createListener(_0x1811dc,_0x405217){return function(_0x330fc6){_0x405217[_0x5741('0x2')](_0x1811dc,_0x330fc6);};}function removeListener(_0x1f9ee6,_0x438cc1){return function(){VoiceQueueEvents['removeListener'](_0x1f9ee6,_0x438cc1);};}exports[_0x5741('0x3')]=function(_0x28ffb5){for(var _0x21cab6=0x0,_0x3f8da8=events[_0x5741('0x4')];_0x21cab6<_0x3f8da8;_0x21cab6++){var _0x24cbbf=events[_0x21cab6];var _0x1f6f0d=createListener(_0x5741('0x5')+_0x24cbbf,_0x28ffb5);VoiceQueueEvents['on'](_0x24cbbf,_0x1f6f0d);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 495df8c..9add017 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 _0x07aa=['put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','getVoiceQueuesReport','show','create'];(function(_0x394571,_0x48d0d0){var _0x3b0f9b=function(_0x380683){while(--_0x380683){_0x394571['push'](_0x394571['shift']());}};_0x3b0f9b(++_0x48d0d0);}(_0x07aa,0x1ba));var _0xa07a=function(_0x462bf7,_0x4855bc){_0x462bf7=_0x462bf7-0x0;var _0x553571=_0x07aa[_0x462bf7];return _0x553571;};'use strict';var multer=require(_0xa07a('0x0'));var util=require(_0xa07a('0x1'));var path=require(_0xa07a('0x2'));var timeout=require(_0xa07a('0x3'));var express=require(_0xa07a('0x4'));var router=express[_0xa07a('0x5')]();var fs_extra=require(_0xa07a('0x6'));var auth=require(_0xa07a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa07a('0x8'));var controller=require(_0xa07a('0x9'));router[_0xa07a('0xa')]('/',auth[_0xa07a('0xb')](),controller[_0xa07a('0xc')]);router['get']('/describe',auth[_0xa07a('0xb')](),controller[_0xa07a('0xd')]);router[_0xa07a('0xa')](_0xa07a('0xe'),auth['isAuthenticated'](),controller[_0xa07a('0xf')]);router[_0xa07a('0xa')]('/:id',auth[_0xa07a('0xb')](),controller[_0xa07a('0x10')]);router['post']('/',auth[_0xa07a('0xb')](),controller[_0xa07a('0x11')]);router[_0xa07a('0x12')](_0xa07a('0x13'),auth[_0xa07a('0xb')](),controller[_0xa07a('0x14')]);router[_0xa07a('0x15')](_0xa07a('0x13'),auth[_0xa07a('0xb')](),controller['destroy']);module[_0xa07a('0x16')]=router; \ No newline at end of file +var _0xe978=['./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','update','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0xdbfe3,_0x4ebddd){var _0x3454b0=function(_0x5a2487){while(--_0x5a2487){_0xdbfe3['push'](_0xdbfe3['shift']());}};_0x3454b0(++_0x4ebddd);}(_0xe978,0x15e));var _0x8e97=function(_0x4bf214,_0x55d9aa){_0x4bf214=_0x4bf214-0x0;var _0x18c314=_0xe978[_0x4bf214];return _0x18c314;};'use strict';var multer=require(_0x8e97('0x0'));var util=require(_0x8e97('0x1'));var path=require('path');var timeout=require(_0x8e97('0x2'));var express=require(_0x8e97('0x3'));var router=express['Router']();var fs_extra=require(_0x8e97('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8e97('0x5'));var config=require(_0x8e97('0x6'));var controller=require(_0x8e97('0x7'));router[_0x8e97('0x8')]('/',auth[_0x8e97('0x9')](),controller[_0x8e97('0xa')]);router[_0x8e97('0x8')]('/describe',auth[_0x8e97('0x9')](),controller[_0x8e97('0xb')]);router[_0x8e97('0x8')](_0x8e97('0xc'),auth[_0x8e97('0x9')](),controller[_0x8e97('0xd')]);router['get'](_0x8e97('0xe'),auth[_0x8e97('0x9')](),controller[_0x8e97('0xf')]);router[_0x8e97('0x10')]('/',auth['isAuthenticated'](),controller[_0x8e97('0x11')]);router[_0x8e97('0x12')](_0x8e97('0xe'),auth[_0x8e97('0x9')](),controller[_0x8e97('0x13')]);router['delete']('/:id',auth[_0x8e97('0x9')](),controller['destroy']);module[_0x8e97('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 9371793..1ef97fb 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 _0x16b7=['BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','INTEGER','sequelize','moment','exports','STRING','DATE','getDataValue','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime'];(function(_0x6e1239,_0x3562ac){var _0x418150=function(_0x279f06){while(--_0x279f06){_0x6e1239['push'](_0x6e1239['shift']());}};_0x418150(++_0x3562ac);}(_0x16b7,0xd5));var _0x716b=function(_0x4ecba2,_0x387f1a){_0x4ecba2=_0x4ecba2-0x0;var _0x44ecac=_0x16b7[_0x4ecba2];return _0x44ecac;};'use strict';var Sequelize=require(_0x716b('0x0'));var moment=require(_0x716b('0x1'));module[_0x716b('0x2')]={'type':{'type':Sequelize[_0x716b('0x3')]},'uniqueid':{'type':Sequelize[_0x716b('0x3')]},'calleridnum':{'type':Sequelize[_0x716b('0x3')]},'calleridname':{'type':Sequelize[_0x716b('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x716b('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x17e12a){var _0x470d92=moment(_0x17e12a);var _0x27ad07=moment(this[_0x716b('0x5')]('queuecallerjoinAt'))['format'](_0x716b('0x6'));var _0x497fb0=_0x470d92[_0x716b('0x7')](_0x27ad07,_0x716b('0x8'));this['setDataValue']('queuecallerleaveAt',_0x17e12a);this[_0x716b('0x9')](_0x716b('0xa'),_0x497fb0||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x716b('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x716b('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x716b('0x3')],'comment':_0x716b('0xc')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x716b('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x716b('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x716b('0x3')]},'holdtime':{'type':Sequelize[_0x716b('0xd')]},'mohtime':{'type':Sequelize[_0x716b('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x716b('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x716b('0x3')]},'transfer':{'type':Sequelize[_0x716b('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x716b('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x716b('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x716b('0x3')]},'secondDisposition':{'type':Sequelize[_0x716b('0x3')]},'thirdDisposition':{'type':Sequelize[_0x716b('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x716b('0xd')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcd6e=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x314a8c,_0x1c2e8d){var _0x1d4607=function(_0x3df20c){while(--_0x3df20c){_0x314a8c['push'](_0x314a8c['shift']());}};_0x1d4607(++_0x1c2e8d);}(_0xcd6e,0xfd));var _0xecd6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd6e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xecd6('0x0'));var moment=require(_0xecd6('0x1'));module[_0xecd6('0x2')]={'type':{'type':Sequelize[_0xecd6('0x3')]},'uniqueid':{'type':Sequelize[_0xecd6('0x3')]},'calleridnum':{'type':Sequelize[_0xecd6('0x3')]},'calleridname':{'type':Sequelize[_0xecd6('0x3')]},'queue':{'type':Sequelize[_0xecd6('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xecd6('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xecd6('0x4')],'set':function(_0xef82d0){var _0x5b1e93=moment(_0xef82d0);var _0x25ba8d=moment(this[_0xecd6('0x5')](_0xecd6('0x6')))[_0xecd6('0x7')](_0xecd6('0x8'));var _0x48ca7a=_0x5b1e93[_0xecd6('0x9')](_0x25ba8d,_0xecd6('0xa'));this['setDataValue'](_0xecd6('0xb'),_0xef82d0);this[_0xecd6('0xc')](_0xecd6('0xd'),_0x48ca7a||null);}},'position':{'type':Sequelize[_0xecd6('0xe')]},'count':{'type':Sequelize[_0xecd6('0xe')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xecd6('0xf')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xecd6('0x4')]},'queuecallerexit':{'type':Sequelize[_0xecd6('0xf')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xecd6('0x10')},'originalposition':{'type':Sequelize[_0xecd6('0xe')]},'channel':{'type':Sequelize[_0xecd6('0x3')]},'connectedlinenum':{'type':Sequelize[_0xecd6('0x3')]},'connectedlinename':{'type':Sequelize[_0xecd6('0x3')]},'accountcode':{'type':Sequelize[_0xecd6('0x3')]},'context':{'type':Sequelize[_0xecd6('0x3')]},'exten':{'type':Sequelize[_0xecd6('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0xecd6('0xe')]},'mohtime':{'type':Sequelize[_0xecd6('0xe')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xecd6('0xf')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xecd6('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xecd6('0x11')},'transferexten':{'type':Sequelize[_0xecd6('0x3')]},'transferuniqueid':{'type':Sequelize[_0xecd6('0x3')]},'disposition':{'type':Sequelize[_0xecd6('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xecd6('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xecd6('0xe')],'defaultValue':0x0},'note':{'type':Sequelize[_0xecd6('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index a6c88e8..e8b5866 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 _0xa371=['update','then','end','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','describe','getVoiceQueuesReport','nolimit','pick','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save'];(function(_0x54ab73,_0x24627a){var _0x3e9ce1=function(_0x11bbb3){while(--_0x11bbb3){_0x54ab73['push'](_0x54ab73['shift']());}};_0x3e9ce1(++_0x24627a);}(_0xa371,0x81));var _0x1a37=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xa371[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0x1a37('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1a37('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1a37('0x2'));var moment=require('moment');var BPromise=require(_0x1a37('0x3'));var Mustache=require(_0x1a37('0x4'));var util=require(_0x1a37('0x5'));var path=require(_0x1a37('0x6'));var sox=require(_0x1a37('0x7'));var csv=require(_0x1a37('0x8'));var ejs=require(_0x1a37('0x9'));var fs=require('fs');var fs_extra=require(_0x1a37('0xa'));var _=require('lodash');var squel=require(_0x1a37('0xb'));var crypto=require('crypto');var jsforce=require(_0x1a37('0xc'));var deskjs=require(_0x1a37('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1a37('0xe'));var Papa=require(_0x1a37('0xf'));var Redis=require(_0x1a37('0x10'));var authService=require(_0x1a37('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1a37('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1a37('0x13'))(_0x1a37('0x14'));var utils=require(_0x1a37('0x15'));var config=require(_0x1a37('0x16'));var licenseUtil=require(_0x1a37('0x17'));var db=require(_0x1a37('0x18'))['db'];config[_0x1a37('0x19')]=_[_0x1a37('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1a37('0x1b'))(new Redis(config[_0x1a37('0x19')]));require(_0x1a37('0x1c'))[_0x1a37('0x1d')](socket);function respondWithStatusCode(_0x1d8e8f,_0x180582){_0x180582=_0x180582||0xcc;return function(_0x263258){if(_0x263258){return _0x1d8e8f[_0x1a37('0x1e')](_0x180582);}return _0x1d8e8f[_0x1a37('0x1f')](_0x180582)['end']();};}function respondWithResult(_0x34806d,_0x541cb3){_0x541cb3=_0x541cb3||0xc8;return function(_0x11030e){if(_0x11030e){return _0x34806d['status'](_0x541cb3)[_0x1a37('0x20')](_0x11030e);}};}function respondWithFilteredResult(_0x22f79e,_0x4923c8){return function(_0x3535c0){if(_0x3535c0){var _0x1f2ff0=typeof _0x4923c8['offset']===_0x1a37('0x21')&&typeof _0x4923c8[_0x1a37('0x22')]===_0x1a37('0x21');var _0x1b7424=_0x3535c0[_0x1a37('0x23')];var _0x401ee4=_0x1f2ff0?0x0:_0x4923c8[_0x1a37('0x24')];var _0x4bf287=_0x1f2ff0?_0x3535c0['count']:_0x4923c8['offset']+_0x4923c8[_0x1a37('0x22')];var _0x5c36d7;if(_0x4bf287>=_0x1b7424){_0x4bf287=_0x1b7424;_0x5c36d7=0xc8;}else{_0x5c36d7=0xce;}_0x22f79e[_0x1a37('0x1f')](_0x5c36d7);return _0x22f79e['set'](_0x1a37('0x25'),_0x401ee4+'-'+_0x4bf287+'/'+_0x1b7424)[_0x1a37('0x20')](_0x3535c0);}return null;};}function patchUpdates(_0x391377){return function(_0x40c1e1){try{jsonpatch[_0x1a37('0x26')](_0x40c1e1,_0x391377,!![]);}catch(_0x35b1bb){return BPromise[_0x1a37('0x27')](_0x35b1bb);}return _0x40c1e1[_0x1a37('0x28')]();};}function saveUpdates(_0x197eef,_0x588a39){return function(_0x2572fd){if(_0x2572fd){return _0x2572fd[_0x1a37('0x29')](_0x197eef)[_0x1a37('0x2a')](function(_0x32e9dd){return _0x32e9dd;});}return null;};}function removeEntity(_0x352216,_0x4d1423){return function(_0x36e3c1){if(_0x36e3c1){return _0x36e3c1['destroy']()[_0x1a37('0x2a')](function(){_0x352216[_0x1a37('0x1f')](0xcc)[_0x1a37('0x2b')]();});}};}function handleEntityNotFound(_0x437b15,_0x1c27e9){return function(_0x438e35){if(!_0x438e35){_0x437b15['sendStatus'](0x194);}return _0x438e35;};}function handleError(_0xe14755,_0x1fb650){_0x1fb650=_0x1fb650||0x1f4;return function(_0x1fe77d){logger['error'](_0x1fe77d[_0x1a37('0x2c')]);if(_0x1fe77d[_0x1a37('0x2d')]){delete _0x1fe77d[_0x1a37('0x2d')];}_0xe14755[_0x1a37('0x1f')](_0x1fb650)[_0x1a37('0x2e')](_0x1fe77d);};}exports[_0x1a37('0x2f')]=function(_0x169029,_0x305a9f){var _0x9016b6={},_0x9de9d7={},_0x289779={'count':0x0,'rows':[]};var _0x11baa9=_[_0x1a37('0x30')](db[_0x1a37('0x31')][_0x1a37('0x32')],function(_0x1cef2c){return{'name':_0x1cef2c[_0x1a37('0x33')],'type':_0x1cef2c[_0x1a37('0x34')][_0x1a37('0x35')]};});_0x9de9d7[_0x1a37('0x36')]=_[_0x1a37('0x30')](_0x11baa9,'name');_0x9de9d7[_0x1a37('0x37')]=_[_0x1a37('0x38')](_0x169029[_0x1a37('0x37')]);_0x9de9d7[_0x1a37('0x39')]=_[_0x1a37('0x3a')](_0x9de9d7[_0x1a37('0x36')],_0x9de9d7['query']);_0x9016b6['attributes']=_['intersection'](_0x9de9d7['model'],qs[_0x1a37('0x3b')](_0x169029['query']['fields']));_0x9016b6[_0x1a37('0x3c')]=_0x9016b6[_0x1a37('0x3c')][_0x1a37('0x3d')]?_0x9016b6[_0x1a37('0x3c')]:_0x9de9d7[_0x1a37('0x36')];if(!_0x169029['query'][_0x1a37('0x3e')]('nolimit')){_0x9016b6[_0x1a37('0x22')]=qs[_0x1a37('0x22')](_0x169029[_0x1a37('0x37')][_0x1a37('0x22')]);_0x9016b6[_0x1a37('0x24')]=qs[_0x1a37('0x24')](_0x169029[_0x1a37('0x37')][_0x1a37('0x24')]);}_0x9016b6[_0x1a37('0x3f')]=qs[_0x1a37('0x40')](_0x169029[_0x1a37('0x37')][_0x1a37('0x40')]);_0x9016b6[_0x1a37('0x41')]=qs[_0x1a37('0x39')](_['pick'](_0x169029[_0x1a37('0x37')],_0x9de9d7[_0x1a37('0x39')]),_0x11baa9);if(_0x169029['query'][_0x1a37('0x42')]){_0x9016b6[_0x1a37('0x41')]=_['merge'](_0x9016b6[_0x1a37('0x41')],{'$or':_[_0x1a37('0x30')](_0x11baa9,function(_0x42cc1c){if(_0x42cc1c['type']!==_0x1a37('0x43')){var _0x69187e={};_0x69187e[_0x42cc1c[_0x1a37('0x2d')]]={'$like':'%'+_0x169029[_0x1a37('0x37')]['filter']+'%'};return _0x69187e;}})});}_0x9016b6=_[_0x1a37('0x44')]({},_0x9016b6,_0x169029[_0x1a37('0x45')]);var _0x377a3e={'where':_0x9016b6[_0x1a37('0x41')]};return db['VoiceQueueReport'][_0x1a37('0x23')](_0x377a3e)[_0x1a37('0x2a')](function(_0x48fcd9){_0x289779[_0x1a37('0x23')]=_0x48fcd9;if(_0x169029[_0x1a37('0x37')][_0x1a37('0x46')]){_0x9016b6['include']=[{'all':!![]}];}return db[_0x1a37('0x31')][_0x1a37('0x47')](_0x9016b6);})[_0x1a37('0x2a')](function(_0x329630){_0x289779[_0x1a37('0x48')]=_0x329630;return _0x289779;})[_0x1a37('0x2a')](respondWithFilteredResult(_0x305a9f,_0x9016b6))[_0x1a37('0x49')](handleError(_0x305a9f,null));};exports[_0x1a37('0x4a')]=function(_0x354d0b,_0xae2f4){var _0x476b7a={'raw':![],'where':{'id':_0x354d0b[_0x1a37('0x4b')]['id']}},_0x1e722d={};_0x1e722d['model']=_[_0x1a37('0x38')](db[_0x1a37('0x31')][_0x1a37('0x32')]);_0x1e722d[_0x1a37('0x37')]=_[_0x1a37('0x38')](_0x354d0b[_0x1a37('0x37')]);_0x1e722d[_0x1a37('0x39')]=_['intersection'](_0x1e722d[_0x1a37('0x36')],_0x1e722d['query']);_0x476b7a[_0x1a37('0x3c')]=_['intersection'](_0x1e722d['model'],qs[_0x1a37('0x3b')](_0x354d0b[_0x1a37('0x37')]['fields']));_0x476b7a[_0x1a37('0x3c')]=_0x476b7a[_0x1a37('0x3c')][_0x1a37('0x3d')]?_0x476b7a['attributes']:_0x1e722d[_0x1a37('0x36')];if(_0x354d0b[_0x1a37('0x37')][_0x1a37('0x46')]){_0x476b7a[_0x1a37('0x4c')]=[{'all':!![]}];}_0x476b7a=_[_0x1a37('0x44')]({},_0x476b7a,_0x354d0b[_0x1a37('0x45')]);return db['VoiceQueueReport'][_0x1a37('0x4d')](_0x476b7a)['then'](handleEntityNotFound(_0xae2f4,null))[_0x1a37('0x2a')](respondWithResult(_0xae2f4,null))[_0x1a37('0x49')](handleError(_0xae2f4,null));};exports[_0x1a37('0x4e')]=function(_0x32b9d9,_0x14ad1f){return db[_0x1a37('0x31')][_0x1a37('0x4e')](_0x32b9d9['body'],{})['then'](respondWithResult(_0x14ad1f,0xc9))[_0x1a37('0x49')](handleError(_0x14ad1f,null));};exports['update']=function(_0x383ba1,_0x31d06b){if(_0x383ba1[_0x1a37('0x4f')]['id']){delete _0x383ba1[_0x1a37('0x4f')]['id'];}return db[_0x1a37('0x31')][_0x1a37('0x4d')]({'where':{'id':_0x383ba1[_0x1a37('0x4b')]['id']}})[_0x1a37('0x2a')](handleEntityNotFound(_0x31d06b,null))['then'](saveUpdates(_0x383ba1[_0x1a37('0x4f')],null))['then'](respondWithResult(_0x31d06b,null))['catch'](handleError(_0x31d06b,null));};exports[_0x1a37('0x50')]=function(_0x909545,_0x1f82aa){return db[_0x1a37('0x31')][_0x1a37('0x4d')]({'where':{'id':_0x909545[_0x1a37('0x4b')]['id']}})[_0x1a37('0x2a')](handleEntityNotFound(_0x1f82aa,null))[_0x1a37('0x2a')](removeEntity(_0x1f82aa,null))['catch'](handleError(_0x1f82aa,null));};exports[_0x1a37('0x51')]=function(_0x2d8555,_0x2866c2){return db[_0x1a37('0x31')]['describe']()[_0x1a37('0x2a')](respondWithResult(_0x2866c2,null))[_0x1a37('0x49')](handleError(_0x2866c2,null));};exports[_0x1a37('0x52')]=function(_0x3ea234,_0x2feca7){var _0x4953bd={},_0x3379d9={},_0x5c0853={'count':0x0,'rows':[]};_0x3379d9['model']=_['keys'](db[_0x1a37('0x31')][_0x1a37('0x32')]);_0x3379d9['query']=_[_0x1a37('0x38')](_0x3ea234['query']);_0x3379d9['filters']=_['intersection'](_0x3379d9['model'],_0x3379d9[_0x1a37('0x37')]);_0x4953bd[_0x1a37('0x3c')]=_[_0x1a37('0x3a')](_0x3379d9['model'],qs['fields'](_0x3ea234[_0x1a37('0x37')][_0x1a37('0x3b')]));_0x4953bd[_0x1a37('0x3c')]=_0x4953bd[_0x1a37('0x3c')][_0x1a37('0x3d')]?_0x4953bd[_0x1a37('0x3c')]:_0x3379d9[_0x1a37('0x36')];if(!_0x3ea234[_0x1a37('0x37')]['hasOwnProperty'](_0x1a37('0x53'))){_0x4953bd[_0x1a37('0x22')]=qs[_0x1a37('0x22')](_0x3ea234['query']['limit']);_0x4953bd[_0x1a37('0x24')]=qs['offset'](_0x3ea234['query']['offset']);}_0x4953bd[_0x1a37('0x3f')]=qs[_0x1a37('0x40')](_0x3ea234['query']['sort']);_0x4953bd[_0x1a37('0x41')]=qs['filters'](_[_0x1a37('0x54')](_0x3ea234[_0x1a37('0x37')],_0x3379d9[_0x1a37('0x39')]));if(_0x3ea234[_0x1a37('0x37')][_0x1a37('0x42')]){_0x4953bd['where']=_['merge'](_0x4953bd[_0x1a37('0x41')],{'$or':_[_0x1a37('0x30')](_0x4953bd[_0x1a37('0x3c')],function(_0x576b97){var _0x412444={};_0x412444[_0x576b97]={'$like':'%'+_0x3ea234[_0x1a37('0x37')][_0x1a37('0x42')]+'%'};return _0x412444;})});}_0x4953bd=_[_0x1a37('0x44')]({},_0x4953bd,_0x3ea234[_0x1a37('0x45')]);var _0x4eb8ec={'where':_0x4953bd[_0x1a37('0x41')]};return db[_0x1a37('0x31')][_0x1a37('0x23')](_0x4eb8ec)[_0x1a37('0x2a')](function(_0x1224cc){_0x5c0853['count']=_0x1224cc;if(_0x3ea234[_0x1a37('0x37')][_0x1a37('0x46')]){_0x4953bd[_0x1a37('0x4c')]=[{'all':!![]}];}return db[_0x1a37('0x31')][_0x1a37('0x47')](_0x4953bd);})['then'](function(_0x192a99){_0x5c0853[_0x1a37('0x48')]=_0x192a99;return _0x5c0853;})[_0x1a37('0x2a')](respondWithFilteredResult(_0x2feca7,_0x4953bd,_0x1a37('0x52')))[_0x1a37('0x49')](handleError(_0x2feca7,null,_0x1a37('0x52')));}; \ No newline at end of file +var _0x59e9=['lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','stack','index','map','VoiceQueueReport','fieldName','type','model','name','query','keys','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','fields','length','include','catch','create','body','describe','getVoiceQueuesReport','rawAttributes','eml-format','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra'];(function(_0x28118a,_0x2f8aee){var _0x116c91=function(_0x1dbc9d){while(--_0x1dbc9d){_0x28118a['push'](_0x28118a['shift']());}};_0x116c91(++_0x2f8aee);}(_0x59e9,0x130));var _0x959e=function(_0x39d213,_0x194536){_0x39d213=_0x39d213-0x0;var _0x45ec9b=_0x59e9[_0x39d213];return _0x45ec9b;};'use strict';var emlformat=require(_0x959e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x959e('0x1'));var moment=require('moment');var BPromise=require(_0x959e('0x2'));var Mustache=require(_0x959e('0x3'));var util=require(_0x959e('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x959e('0x5'));var ejs=require(_0x959e('0x6'));var fs=require('fs');var fs_extra=require(_0x959e('0x7'));var _=require(_0x959e('0x8'));var squel=require(_0x959e('0x9'));var crypto=require('crypto');var jsforce=require(_0x959e('0xa'));var deskjs=require(_0x959e('0xb'));var toCsv=require(_0x959e('0x5'));var querystring=require('querystring');var Papa=require(_0x959e('0xc'));var Redis=require(_0x959e('0xd'));var authService=require(_0x959e('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x959e('0xf'));var hardwareService=require(_0x959e('0x10'));var logger=require('../../config/logger')(_0x959e('0x11'));var utils=require(_0x959e('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x959e('0x13'));var db=require(_0x959e('0x14'))['db'];config[_0x959e('0x15')]=_[_0x959e('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x959e('0x17'))(new Redis(config[_0x959e('0x15')]));require(_0x959e('0x18'))[_0x959e('0x19')](socket);function respondWithStatusCode(_0x51f3c8,_0xab836f){_0xab836f=_0xab836f||0xcc;return function(_0x40494b){if(_0x40494b){return _0x51f3c8[_0x959e('0x1a')](_0xab836f);}return _0x51f3c8[_0x959e('0x1b')](_0xab836f)[_0x959e('0x1c')]();};}function respondWithResult(_0x2fc7f3,_0x5b04d0){_0x5b04d0=_0x5b04d0||0xc8;return function(_0x40f525){if(_0x40f525){return _0x2fc7f3['status'](_0x5b04d0)['json'](_0x40f525);}};}function respondWithFilteredResult(_0x5a03f8,_0x2405e8){return function(_0x3f0ab9){if(_0x3f0ab9){var _0x27b164=typeof _0x2405e8[_0x959e('0x1d')]===_0x959e('0x1e')&&typeof _0x2405e8[_0x959e('0x1f')]===_0x959e('0x1e');var _0x1e5d35=_0x3f0ab9[_0x959e('0x20')];var _0x4d9cfb=_0x27b164?0x0:_0x2405e8['offset'];var _0x1c65ca=_0x27b164?_0x3f0ab9['count']:_0x2405e8[_0x959e('0x1d')]+_0x2405e8['limit'];var _0x3fa95a;if(_0x1c65ca>=_0x1e5d35){_0x1c65ca=_0x1e5d35;_0x3fa95a=0xc8;}else{_0x3fa95a=0xce;}_0x5a03f8[_0x959e('0x1b')](_0x3fa95a);return _0x5a03f8[_0x959e('0x21')](_0x959e('0x22'),_0x4d9cfb+'-'+_0x1c65ca+'/'+_0x1e5d35)[_0x959e('0x23')](_0x3f0ab9);}return null;};}function patchUpdates(_0x41b6e5){return function(_0x5a7ecd){try{jsonpatch[_0x959e('0x24')](_0x5a7ecd,_0x41b6e5,!![]);}catch(_0x4e3730){return BPromise[_0x959e('0x25')](_0x4e3730);}return _0x5a7ecd[_0x959e('0x26')]();};}function saveUpdates(_0x53fa6d,_0x2fd7b8){return function(_0x3199a3){if(_0x3199a3){return _0x3199a3[_0x959e('0x27')](_0x53fa6d)['then'](function(_0x36260b){return _0x36260b;});}return null;};}function removeEntity(_0x507103,_0x3f7eaa){return function(_0x56c5e2){if(_0x56c5e2){return _0x56c5e2[_0x959e('0x28')]()[_0x959e('0x29')](function(){_0x507103[_0x959e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b7b2e,_0x4ed1d2){return function(_0x5d0360){if(!_0x5d0360){_0x1b7b2e[_0x959e('0x1a')](0x194);}return _0x5d0360;};}function handleError(_0x53ecec,_0x52ff33){_0x52ff33=_0x52ff33||0x1f4;return function(_0x3c97bc){logger['error'](_0x3c97bc[_0x959e('0x2a')]);if(_0x3c97bc['name']){delete _0x3c97bc['name'];}_0x53ecec[_0x959e('0x1b')](_0x52ff33)['send'](_0x3c97bc);};}exports[_0x959e('0x2b')]=function(_0x144777,_0x4a8153){var _0x3bd3d4={},_0x914766={},_0x135dc5={'count':0x0,'rows':[]};var _0x57a5a7=_[_0x959e('0x2c')](db[_0x959e('0x2d')]['rawAttributes'],function(_0x4eeb4c){return{'name':_0x4eeb4c[_0x959e('0x2e')],'type':_0x4eeb4c[_0x959e('0x2f')]['key']};});_0x914766[_0x959e('0x30')]=_[_0x959e('0x2c')](_0x57a5a7,_0x959e('0x31'));_0x914766[_0x959e('0x32')]=_[_0x959e('0x33')](_0x144777[_0x959e('0x32')]);_0x914766['filters']=_[_0x959e('0x34')](_0x914766[_0x959e('0x30')],_0x914766['query']);_0x3bd3d4[_0x959e('0x35')]=_[_0x959e('0x34')](_0x914766[_0x959e('0x30')],qs['fields'](_0x144777[_0x959e('0x32')]['fields']));_0x3bd3d4[_0x959e('0x35')]=_0x3bd3d4['attributes']['length']?_0x3bd3d4[_0x959e('0x35')]:_0x914766['model'];if(!_0x144777[_0x959e('0x32')][_0x959e('0x36')](_0x959e('0x37'))){_0x3bd3d4[_0x959e('0x1f')]=qs[_0x959e('0x1f')](_0x144777[_0x959e('0x32')][_0x959e('0x1f')]);_0x3bd3d4[_0x959e('0x1d')]=qs[_0x959e('0x1d')](_0x144777[_0x959e('0x32')][_0x959e('0x1d')]);}_0x3bd3d4[_0x959e('0x38')]=qs[_0x959e('0x39')](_0x144777[_0x959e('0x32')][_0x959e('0x39')]);_0x3bd3d4[_0x959e('0x3a')]=qs[_0x959e('0x3b')](_['pick'](_0x144777[_0x959e('0x32')],_0x914766[_0x959e('0x3b')]),_0x57a5a7);if(_0x144777[_0x959e('0x32')][_0x959e('0x3c')]){_0x3bd3d4[_0x959e('0x3a')]=_[_0x959e('0x3d')](_0x3bd3d4[_0x959e('0x3a')],{'$or':_['map'](_0x57a5a7,function(_0x50a4d7){if(_0x50a4d7[_0x959e('0x2f')]!==_0x959e('0x3e')){var _0x14f033={};_0x14f033[_0x50a4d7[_0x959e('0x31')]]={'$like':'%'+_0x144777['query'][_0x959e('0x3c')]+'%'};return _0x14f033;}})});}_0x3bd3d4=_[_0x959e('0x3d')]({},_0x3bd3d4,_0x144777[_0x959e('0x3f')]);var _0x42a048={'where':_0x3bd3d4['where']};return db[_0x959e('0x2d')]['count'](_0x42a048)[_0x959e('0x29')](function(_0x12ed63){_0x135dc5[_0x959e('0x20')]=_0x12ed63;if(_0x144777['query'][_0x959e('0x40')]){_0x3bd3d4['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0x959e('0x41')](_0x3bd3d4);})[_0x959e('0x29')](function(_0x624d77){_0x135dc5[_0x959e('0x42')]=_0x624d77;return _0x135dc5;})[_0x959e('0x29')](respondWithFilteredResult(_0x4a8153,_0x3bd3d4))['catch'](handleError(_0x4a8153,null));};exports[_0x959e('0x43')]=function(_0x14b609,_0x41ec3f){var _0x403126={'raw':![],'where':{'id':_0x14b609[_0x959e('0x44')]['id']}},_0x12fbec={};_0x12fbec[_0x959e('0x30')]=_[_0x959e('0x33')](db[_0x959e('0x2d')]['rawAttributes']);_0x12fbec[_0x959e('0x32')]=_[_0x959e('0x33')](_0x14b609[_0x959e('0x32')]);_0x12fbec[_0x959e('0x3b')]=_['intersection'](_0x12fbec[_0x959e('0x30')],_0x12fbec[_0x959e('0x32')]);_0x403126[_0x959e('0x35')]=_[_0x959e('0x34')](_0x12fbec[_0x959e('0x30')],qs[_0x959e('0x45')](_0x14b609['query'][_0x959e('0x45')]));_0x403126[_0x959e('0x35')]=_0x403126[_0x959e('0x35')][_0x959e('0x46')]?_0x403126[_0x959e('0x35')]:_0x12fbec[_0x959e('0x30')];if(_0x14b609[_0x959e('0x32')][_0x959e('0x40')]){_0x403126[_0x959e('0x47')]=[{'all':!![]}];}_0x403126=_[_0x959e('0x3d')]({},_0x403126,_0x14b609[_0x959e('0x3f')]);return db['VoiceQueueReport']['find'](_0x403126)[_0x959e('0x29')](handleEntityNotFound(_0x41ec3f,null))[_0x959e('0x29')](respondWithResult(_0x41ec3f,null))[_0x959e('0x48')](handleError(_0x41ec3f,null));};exports[_0x959e('0x49')]=function(_0x478d4d,_0x1d42ea){return db['VoiceQueueReport']['create'](_0x478d4d['body'],{})[_0x959e('0x29')](respondWithResult(_0x1d42ea,0xc9))[_0x959e('0x48')](handleError(_0x1d42ea,null));};exports[_0x959e('0x27')]=function(_0x3b9102,_0x5d5e69){if(_0x3b9102[_0x959e('0x4a')]['id']){delete _0x3b9102[_0x959e('0x4a')]['id'];}return db[_0x959e('0x2d')]['find']({'where':{'id':_0x3b9102[_0x959e('0x44')]['id']}})[_0x959e('0x29')](handleEntityNotFound(_0x5d5e69,null))[_0x959e('0x29')](saveUpdates(_0x3b9102[_0x959e('0x4a')],null))[_0x959e('0x29')](respondWithResult(_0x5d5e69,null))[_0x959e('0x48')](handleError(_0x5d5e69,null));};exports['destroy']=function(_0x3d7699,_0x4960f7){return db[_0x959e('0x2d')]['find']({'where':{'id':_0x3d7699[_0x959e('0x44')]['id']}})[_0x959e('0x29')](handleEntityNotFound(_0x4960f7,null))[_0x959e('0x29')](removeEntity(_0x4960f7,null))[_0x959e('0x48')](handleError(_0x4960f7,null));};exports[_0x959e('0x4b')]=function(_0xbe1edc,_0x58c459){return db[_0x959e('0x2d')]['describe']()['then'](respondWithResult(_0x58c459,null))['catch'](handleError(_0x58c459,null));};exports[_0x959e('0x4c')]=function(_0x3c5c6d,_0x1b0577){var _0x538abf={},_0x2e0479={},_0x3022f4={'count':0x0,'rows':[]};_0x2e0479[_0x959e('0x30')]=_[_0x959e('0x33')](db[_0x959e('0x2d')][_0x959e('0x4d')]);_0x2e0479[_0x959e('0x32')]=_['keys'](_0x3c5c6d[_0x959e('0x32')]);_0x2e0479[_0x959e('0x3b')]=_['intersection'](_0x2e0479[_0x959e('0x30')],_0x2e0479[_0x959e('0x32')]);_0x538abf[_0x959e('0x35')]=_[_0x959e('0x34')](_0x2e0479[_0x959e('0x30')],qs[_0x959e('0x45')](_0x3c5c6d[_0x959e('0x32')]['fields']));_0x538abf[_0x959e('0x35')]=_0x538abf[_0x959e('0x35')][_0x959e('0x46')]?_0x538abf[_0x959e('0x35')]:_0x2e0479['model'];if(!_0x3c5c6d['query'][_0x959e('0x36')](_0x959e('0x37'))){_0x538abf['limit']=qs[_0x959e('0x1f')](_0x3c5c6d['query'][_0x959e('0x1f')]);_0x538abf[_0x959e('0x1d')]=qs[_0x959e('0x1d')](_0x3c5c6d['query'][_0x959e('0x1d')]);}_0x538abf['order']=qs[_0x959e('0x39')](_0x3c5c6d[_0x959e('0x32')][_0x959e('0x39')]);_0x538abf[_0x959e('0x3a')]=qs[_0x959e('0x3b')](_['pick'](_0x3c5c6d['query'],_0x2e0479[_0x959e('0x3b')]));if(_0x3c5c6d[_0x959e('0x32')][_0x959e('0x3c')]){_0x538abf[_0x959e('0x3a')]=_[_0x959e('0x3d')](_0x538abf['where'],{'$or':_[_0x959e('0x2c')](_0x538abf[_0x959e('0x35')],function(_0x33ae7f){var _0x542ebb={};_0x542ebb[_0x33ae7f]={'$like':'%'+_0x3c5c6d[_0x959e('0x32')][_0x959e('0x3c')]+'%'};return _0x542ebb;})});}_0x538abf=_['merge']({},_0x538abf,_0x3c5c6d[_0x959e('0x3f')]);var _0x3b4591={'where':_0x538abf[_0x959e('0x3a')]};return db[_0x959e('0x2d')][_0x959e('0x20')](_0x3b4591)[_0x959e('0x29')](function(_0x243df6){_0x3022f4[_0x959e('0x20')]=_0x243df6;if(_0x3c5c6d[_0x959e('0x32')]['includeAll']){_0x538abf[_0x959e('0x47')]=[{'all':!![]}];}return db[_0x959e('0x2d')][_0x959e('0x41')](_0x538abf);})['then'](function(_0x43ce0b){_0x3022f4['rows']=_0x43ce0b;return _0x3022f4;})[_0x959e('0x29')](respondWithFilteredResult(_0x1b0577,_0x538abf,_0x959e('0x4c')))[_0x959e('0x48')](handleError(_0x1b0577,null,_0x959e('0x4c')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index d6ae267..a651b4b 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 _0x2b96=['save','update','emit','hasOwnProperty','hook','VoiceQueueReport'];(function(_0x3e7b5a,_0x4c06fe){var _0x4880aa=function(_0x2410ac){while(--_0x2410ac){_0x3e7b5a['push'](_0x3e7b5a['shift']());}};_0x4880aa(++_0x4c06fe);}(_0x2b96,0x10d));var _0x62b9=function(_0x406c6b,_0x5128f1){_0x406c6b=_0x406c6b-0x0;var _0x2ba7b4=_0x2b96[_0x406c6b];return _0x2ba7b4;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db'][_0x62b9('0x0')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x62b9('0x1'),'afterUpdate':_0x62b9('0x2'),'afterDestroy':'remove'};function emitEvent(_0x5397ec){return function(_0x3e92f1,_0x152be4,_0x3ddc68){VoiceQueueReportEvents[_0x62b9('0x3')](_0x5397ec+':'+_0x3e92f1['id'],_0x3e92f1);VoiceQueueReportEvents[_0x62b9('0x3')](_0x5397ec,_0x3e92f1);_0x3ddc68(null);};}for(var e in events){if(events[_0x62b9('0x4')](e)){var event=events[e];VoiceQueueReport[_0x62b9('0x5')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x8e92=['exports','../../mysqldb','VoiceQueueReport','update','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8e92,0x158));var _0x28e9=function(_0x89026a,_0x50068a){_0x89026a=_0x89026a-0x0;var _0x52c4dd=_0x8e92[_0x89026a];return _0x52c4dd;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x28e9('0x0'))['db'][_0x28e9('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x28e9('0x2'),'afterDestroy':_0x28e9('0x3')};function emitEvent(_0x30df14){return function(_0x45c1fd,_0x55a804,_0x386ac5){VoiceQueueReportEvents[_0x28e9('0x4')](_0x30df14+':'+_0x45c1fd['id'],_0x45c1fd);VoiceQueueReportEvents[_0x28e9('0x4')](_0x30df14,_0x45c1fd);_0x386ac5(null);};}for(var e in events){if(events[_0x28e9('0x5')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x28e9('0x6')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index ed1349b..9317ea8 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 _0x5eda=['uniqueid','calleridnum','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport','report_queue'];(function(_0x449235,_0x567736){var _0x2446ad=function(_0x36d60c){while(--_0x36d60c){_0x449235['push'](_0x449235['shift']());}};_0x2446ad(++_0x567736);}(_0x5eda,0x197));var _0xa5ed=function(_0xd51501,_0x249b6a){_0xd51501=_0xd51501-0x0;var _0x418237=_0x5eda[_0xd51501];return _0x418237;};'use strict';var _=require('lodash');var util=require(_0xa5ed('0x0'));var logger=require(_0xa5ed('0x1'))(_0xa5ed('0x2'));var moment=require(_0xa5ed('0x3'));var BPromise=require(_0xa5ed('0x4'));var rp=require(_0xa5ed('0x5'));var fs=require('fs');var path=require(_0xa5ed('0x6'));var rimraf=require(_0xa5ed('0x7'));var config=require(_0xa5ed('0x8'));var attributes=require(_0xa5ed('0x9'));module[_0xa5ed('0xa')]=function(_0x97672a,_0x1375f9){return _0x97672a['define'](_0xa5ed('0xb'),attributes,{'tableName':_0xa5ed('0xc'),'paranoid':![],'indexes':[{'fields':[_0xa5ed('0xd')]},{'fields':[_0xa5ed('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x092d=['request-promise','path','rimraf','../../config/environment','exports','define','VoiceQueueReport','calleridnum','lodash','../../config/logger','api','moment'];(function(_0x40b099,_0x3ed7da){var _0x40e1f3=function(_0x1cff63){while(--_0x1cff63){_0x40b099['push'](_0x40b099['shift']());}};_0x40e1f3(++_0x3ed7da);}(_0x092d,0x68));var _0xd092=function(_0x59a294,_0x17dde5){_0x59a294=_0x59a294-0x0;var _0x175f9b=_0x092d[_0x59a294];return _0x175f9b;};'use strict';var _=require(_0xd092('0x0'));var util=require('util');var logger=require(_0xd092('0x1'))(_0xd092('0x2'));var moment=require(_0xd092('0x3'));var BPromise=require('bluebird');var rp=require(_0xd092('0x4'));var fs=require('fs');var path=require(_0xd092('0x5'));var rimraf=require(_0xd092('0x6'));var config=require(_0xd092('0x7'));var attributes=require('./voiceQueueReport.attributes');module[_0xd092('0x8')]=function(_0x3a34e8,_0x54123a){return _0x3a34e8[_0xd092('0x9')](_0xd092('0xa'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xd092('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 80c32f6..4a2391a 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 _0x56b1=['CreateVoiceQueueReport','body','then','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','./voiceQueueReport.socket','register','request','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceQueueReport,\x20%s,\x20%s','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','limit','include','map','model','attributes'];(function(_0x718728,_0x3f0352){var _0x137abb=function(_0x2d27bf){while(--_0x2d27bf){_0x718728['push'](_0x718728['shift']());}};_0x137abb(++_0x3f0352);}(_0x56b1,0x19e));var _0x156b=function(_0x3adfc3,_0x3d0486){_0x3adfc3=_0x3adfc3-0x0;var _0x30d7ca=_0x56b1[_0x3adfc3];return _0x30d7ca;};'use strict';var _=require(_0x156b('0x0'));var util=require(_0x156b('0x1'));var moment=require(_0x156b('0x2'));var BPromise=require(_0x156b('0x3'));var rs=require(_0x156b('0x4'));var fs=require('fs');var Redis=require(_0x156b('0x5'));var db=require(_0x156b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x156b('0x7'))('rpc');var config=require(_0x156b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x156b('0x9')][_0x156b('0xa')]({'port':0x232a});config[_0x156b('0xb')]=_[_0x156b('0xc')](config['redis'],{'host':_0x156b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x156b('0xe'))[_0x156b('0xf')](socket);function respondWithRpcPromise(_0x3f14d5,_0x57d2bf,_0xbe6e1c){return new BPromise(function(_0x2593a8,_0x489a1e){return client[_0x156b('0x10')](_0x3f14d5,_0xbe6e1c)['then'](function(_0x58aaac){logger[_0x156b('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x57d2bf,_0x156b('0x12'));logger[_0x156b('0x13')](_0x156b('0x14'),_0x57d2bf,'request\x20sent',JSON[_0x156b('0x15')](_0x58aaac));if(_0x58aaac[_0x156b('0x16')]){if(_0x58aaac[_0x156b('0x16')]['code']===0x1f4){logger[_0x156b('0x16')](_0x156b('0x17'),_0x57d2bf,_0x58aaac[_0x156b('0x16')][_0x156b('0x18')]);return _0x489a1e(_0x58aaac[_0x156b('0x16')][_0x156b('0x18')]);}logger['error'](_0x156b('0x17'),_0x57d2bf,_0x58aaac['error'][_0x156b('0x18')]);return _0x2593a8(_0x58aaac[_0x156b('0x16')][_0x156b('0x18')]);}else{logger[_0x156b('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x57d2bf,'request\x20sent');_0x2593a8(_0x58aaac[_0x156b('0x19')][_0x156b('0x18')]);}})[_0x156b('0x1a')](function(_0x2a9123){logger[_0x156b('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x57d2bf,_0x2a9123);_0x489a1e(_0x2a9123);});});}exports[_0x156b('0x1b')]=function(_0x2827b9){var _0x55cef5=this;return new Promise(function(_0x4da1c8,_0x902588){return db[_0x156b('0x1c')]['findAll']({'raw':_0x2827b9[_0x156b('0x1d')]?_0x2827b9[_0x156b('0x1d')][_0x156b('0x1e')]===undefined?!![]:![]:!![],'where':_0x2827b9[_0x156b('0x1d')]?_0x2827b9[_0x156b('0x1d')][_0x156b('0x1f')]||null:null,'attributes':_0x2827b9[_0x156b('0x1d')]?_0x2827b9[_0x156b('0x1d')]['attributes']||null:null,'limit':_0x2827b9[_0x156b('0x1d')]?_0x2827b9['options'][_0x156b('0x20')]||null:null,'include':_0x2827b9[_0x156b('0x1d')]?_0x2827b9[_0x156b('0x1d')][_0x156b('0x21')]?_[_0x156b('0x22')](_0x2827b9[_0x156b('0x1d')][_0x156b('0x21')],function(_0x70f63b){return{'model':db[_0x70f63b[_0x156b('0x23')]],'as':_0x70f63b['as'],'attributes':_0x70f63b[_0x156b('0x24')],'include':_0x70f63b[_0x156b('0x21')]?_['map'](_0x70f63b[_0x156b('0x21')],function(_0x3e6935){return{'model':db[_0x3e6935[_0x156b('0x23')]],'as':_0x3e6935['as'],'attributes':_0x3e6935[_0x156b('0x24')],'include':_0x3e6935[_0x156b('0x21')]?_[_0x156b('0x22')](_0x3e6935[_0x156b('0x21')],function(_0x48ff2f){return{'model':db[_0x48ff2f[_0x156b('0x23')]],'as':_0x48ff2f['as'],'attributes':_0x48ff2f[_0x156b('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x53c9c2){logger['info'](_0x156b('0x1b'),_0x2827b9);logger[_0x156b('0x13')]('GetVoiceQueueReport',_0x2827b9,JSON['stringify'](_0x53c9c2));_0x4da1c8(_0x53c9c2);})['catch'](function(_0x55b949){logger[_0x156b('0x16')]('GetVoiceQueueReport',_0x55b949[_0x156b('0x18')],_0x2827b9);_0x902588(_0x55cef5[_0x156b('0x16')](0x1f4,_0x55b949[_0x156b('0x18')]));});});};exports[_0x156b('0x25')]=function(_0x5927a1){var _0x30bcdf=this;return new Promise(function(_0x32f5b2,_0x32947c){return db[_0x156b('0x1c')]['create'](_0x5927a1[_0x156b('0x26')],{'raw':_0x5927a1['options']?_0x5927a1[_0x156b('0x1d')][_0x156b('0x1e')]===undefined?!![]:![]:!![]})[_0x156b('0x27')](function(_0x4f3f33){logger[_0x156b('0x11')](_0x156b('0x25'),_0x5927a1);logger[_0x156b('0x13')](_0x156b('0x25'),_0x5927a1,JSON[_0x156b('0x15')](_0x4f3f33));_0x32f5b2(_0x4f3f33);})[_0x156b('0x1a')](function(_0x12d73c){logger[_0x156b('0x16')]('CreateVoiceQueueReport',_0x12d73c[_0x156b('0x18')],_0x5927a1);_0x32947c(_0x30bcdf['error'](0x1f4,_0x12d73c['message']));});});};exports[_0x156b('0x28')]=function(_0x48453d){var _0x9fede5=this;return new Promise(function(_0x5b7218,_0x55fd8e){return db['VoiceQueueReport']['update'](_0x48453d[_0x156b('0x26')],{'raw':_0x48453d['options']?_0x48453d[_0x156b('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48453d['options']?_0x48453d['options'][_0x156b('0x1f')]||null:null,'attributes':_0x48453d[_0x156b('0x1d')]?_0x48453d[_0x156b('0x1d')][_0x156b('0x24')]||null:null,'limit':_0x48453d['options']?_0x48453d['options']['limit']||null:null})[_0x156b('0x27')](function(_0x5c4479){logger['info'](_0x156b('0x28'),_0x48453d);logger[_0x156b('0x13')](_0x156b('0x28'),_0x48453d,JSON[_0x156b('0x15')](_0x5c4479));_0x5b7218(_0x5c4479);})['catch'](function(_0x53fe44){logger[_0x156b('0x16')](_0x156b('0x28'),_0x53fe44[_0x156b('0x18')],_0x48453d);_0x55fd8e(_0x9fede5['error'](0x1f4,_0x53fe44[_0x156b('0x18')]));});});}; \ No newline at end of file +var _0x9827=['body','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','GetVoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','debug','VoiceQueueReport','create','CreateVoiceQueueReport','stringify','UpdateVoiceQueueReport'];(function(_0x7d0a8f,_0x4d3786){var _0x330d7a=function(_0x5ee3bb){while(--_0x5ee3bb){_0x7d0a8f['push'](_0x7d0a8f['shift']());}};_0x330d7a(++_0x4d3786);}(_0x9827,0x7c));var _0x7982=function(_0x55bd12,_0x3ccb52){_0x55bd12=_0x55bd12-0x0;var _0x1941dd=_0x9827[_0x55bd12];return _0x1941dd;};'use strict';var _=require('lodash');var util=require(_0x7982('0x0'));var moment=require('moment');var BPromise=require(_0x7982('0x1'));var rs=require(_0x7982('0x2'));var fs=require('fs');var Redis=require(_0x7982('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7982('0x4'))(_0x7982('0x5'));var config=require(_0x7982('0x6'));var jayson=require(_0x7982('0x7'));var client=jayson['client'][_0x7982('0x8')]({'port':0x232a});config[_0x7982('0x9')]=_[_0x7982('0xa')](config[_0x7982('0x9')],{'host':_0x7982('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7982('0x9')]));require('./voiceQueueReport.socket')[_0x7982('0xc')](socket);function respondWithRpcPromise(_0x120e27,_0xf68b69,_0x16d4a8){return new BPromise(function(_0x45a935,_0x363e71){return client[_0x7982('0xd')](_0x120e27,_0x16d4a8)[_0x7982('0xe')](function(_0x5a275f){logger[_0x7982('0xf')](_0x7982('0x10'),_0xf68b69,_0x7982('0x11'));logger['debug'](_0x7982('0x12'),_0xf68b69,_0x7982('0x11'),JSON['stringify'](_0x5a275f));if(_0x5a275f['error']){if(_0x5a275f['error'][_0x7982('0x13')]===0x1f4){logger[_0x7982('0x14')](_0x7982('0x10'),_0xf68b69,_0x5a275f[_0x7982('0x14')][_0x7982('0x15')]);return _0x363e71(_0x5a275f[_0x7982('0x14')][_0x7982('0x15')]);}logger[_0x7982('0x14')](_0x7982('0x10'),_0xf68b69,_0x5a275f[_0x7982('0x14')][_0x7982('0x15')]);return _0x45a935(_0x5a275f[_0x7982('0x14')][_0x7982('0x15')]);}else{logger[_0x7982('0xf')]('VoiceQueueReport,\x20%s,\x20%s',_0xf68b69,_0x7982('0x11'));_0x45a935(_0x5a275f[_0x7982('0x16')]['message']);}})[_0x7982('0x17')](function(_0x411c7d){logger[_0x7982('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0xf68b69,_0x411c7d);_0x363e71(_0x411c7d);});});}exports[_0x7982('0x18')]=function(_0x2bc93c){var _0x4cb088=this;return new Promise(function(_0x1717b5,_0x365953){return db['VoiceQueueReport'][_0x7982('0x19')]({'raw':_0x2bc93c[_0x7982('0x1a')]?_0x2bc93c[_0x7982('0x1a')][_0x7982('0x1b')]===undefined?!![]:![]:!![],'where':_0x2bc93c[_0x7982('0x1a')]?_0x2bc93c[_0x7982('0x1a')][_0x7982('0x1c')]||null:null,'attributes':_0x2bc93c[_0x7982('0x1a')]?_0x2bc93c[_0x7982('0x1a')][_0x7982('0x1d')]||null:null,'limit':_0x2bc93c[_0x7982('0x1a')]?_0x2bc93c[_0x7982('0x1a')][_0x7982('0x1e')]||null:null,'include':_0x2bc93c['options']?_0x2bc93c['options'][_0x7982('0x1f')]?_[_0x7982('0x20')](_0x2bc93c[_0x7982('0x1a')][_0x7982('0x1f')],function(_0x1b4078){return{'model':db[_0x1b4078[_0x7982('0x21')]],'as':_0x1b4078['as'],'attributes':_0x1b4078[_0x7982('0x1d')],'include':_0x1b4078['include']?_[_0x7982('0x20')](_0x1b4078[_0x7982('0x1f')],function(_0xb056d9){return{'model':db[_0xb056d9['model']],'as':_0xb056d9['as'],'attributes':_0xb056d9[_0x7982('0x1d')],'include':_0xb056d9[_0x7982('0x1f')]?_[_0x7982('0x20')](_0xb056d9[_0x7982('0x1f')],function(_0xd38725){return{'model':db[_0xd38725[_0x7982('0x21')]],'as':_0xd38725['as'],'attributes':_0xd38725[_0x7982('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7982('0xe')](function(_0x5c159a){logger['info'](_0x7982('0x18'),_0x2bc93c);logger[_0x7982('0x22')](_0x7982('0x18'),_0x2bc93c,JSON['stringify'](_0x5c159a));_0x1717b5(_0x5c159a);})[_0x7982('0x17')](function(_0x1664a6){logger['error'](_0x7982('0x18'),_0x1664a6['message'],_0x2bc93c);_0x365953(_0x4cb088['error'](0x1f4,_0x1664a6['message']));});});};exports['CreateVoiceQueueReport']=function(_0x2b0540){var _0x2cf55f=this;return new Promise(function(_0x5524d0,_0x1a5272){return db[_0x7982('0x23')][_0x7982('0x24')](_0x2b0540['body'],{'raw':_0x2b0540[_0x7982('0x1a')]?_0x2b0540[_0x7982('0x1a')][_0x7982('0x1b')]===undefined?!![]:![]:!![]})[_0x7982('0xe')](function(_0x20db14){logger[_0x7982('0xf')]('CreateVoiceQueueReport',_0x2b0540);logger[_0x7982('0x22')](_0x7982('0x25'),_0x2b0540,JSON[_0x7982('0x26')](_0x20db14));_0x5524d0(_0x20db14);})['catch'](function(_0x56e689){logger[_0x7982('0x14')](_0x7982('0x25'),_0x56e689[_0x7982('0x15')],_0x2b0540);_0x1a5272(_0x2cf55f[_0x7982('0x14')](0x1f4,_0x56e689[_0x7982('0x15')]));});});};exports[_0x7982('0x27')]=function(_0x2b854d){var _0x572bd4=this;return new Promise(function(_0x2a8a76,_0xd53136){return db[_0x7982('0x23')]['update'](_0x2b854d[_0x7982('0x28')],{'raw':_0x2b854d['options']?_0x2b854d[_0x7982('0x1a')][_0x7982('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b854d[_0x7982('0x1a')]?_0x2b854d[_0x7982('0x1a')]['where']||null:null,'attributes':_0x2b854d[_0x7982('0x1a')]?_0x2b854d[_0x7982('0x1a')]['attributes']||null:null,'limit':_0x2b854d[_0x7982('0x1a')]?_0x2b854d['options']['limit']||null:null})['then'](function(_0x4e62de){logger[_0x7982('0xf')]('UpdateVoiceQueueReport',_0x2b854d);logger[_0x7982('0x22')](_0x7982('0x27'),_0x2b854d,JSON[_0x7982('0x26')](_0x4e62de));_0x2a8a76(_0x4e62de);})[_0x7982('0x17')](function(_0x521bd0){logger[_0x7982('0x14')](_0x7982('0x27'),_0x521bd0['message'],_0x2b854d);_0xd53136(_0x572bd4['error'](0x1f4,_0x521bd0['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 308b9d2..dc9c954 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 _0xf569=['update','emit','removeListener','length','voiceQueueReport:','save','remove'];(function(_0x2e4563,_0x2153a8){var _0x24b17d=function(_0x42f73a){while(--_0x42f73a){_0x2e4563['push'](_0x2e4563['shift']());}};_0x24b17d(++_0x2153a8);}(_0xf569,0xd0));var _0x9f56=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xf569[_0x4a747d];return _0x3a5b5c;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x9f56('0x0'),_0x9f56('0x1'),_0x9f56('0x2')];function createListener(_0x9c192,_0x45b196){return function(_0x4466ac){_0x45b196[_0x9f56('0x3')](_0x9c192,_0x4466ac);};}function removeListener(_0x6d506b,_0x5bc3e8){return function(){VoiceQueueReportEvents[_0x9f56('0x4')](_0x6d506b,_0x5bc3e8);};}exports['register']=function(_0x467a46){for(var _0x3488f2=0x0,_0x5c5e5f=events[_0x9f56('0x5')];_0x3488f2<_0x5c5e5f;_0x3488f2++){var _0x73c3b4=events[_0x3488f2];var _0x5980f2=createListener(_0x9f56('0x6')+_0x73c3b4,_0x467a46);VoiceQueueReportEvents['on'](_0x73c3b4,_0x5980f2);}}; \ No newline at end of file +var _0x5977=['./voiceQueueReport.events','save','remove','emit','register'];(function(_0x4de1b1,_0x18c64c){var _0x639f27=function(_0x635e03){while(--_0x635e03){_0x4de1b1['push'](_0x4de1b1['shift']());}};_0x639f27(++_0x18c64c);}(_0x5977,0xeb));var _0x7597=function(_0x21af16,_0x4c808d){_0x21af16=_0x21af16-0x0;var _0xfc84c1=_0x5977[_0x21af16];return _0xfc84c1;};'use strict';var VoiceQueueReportEvents=require(_0x7597('0x0'));var events=[_0x7597('0x1'),_0x7597('0x2'),'update'];function createListener(_0x6fda49,_0x274023){return function(_0x4be061){_0x274023[_0x7597('0x3')](_0x6fda49,_0x4be061);};}function removeListener(_0x495070,_0x9bf757){return function(){VoiceQueueReportEvents['removeListener'](_0x495070,_0x9bf757);};}exports[_0x7597('0x4')]=function(_0x3875e1){for(var _0x5302c6=0x0,_0x4caa87=events['length'];_0x5302c6<_0x4caa87;_0x5302c6++){var _0x437fcc=events[_0x5302c6];var _0x1ae294=createListener('voiceQueueReport:'+_0x437fcc,_0x3875e1);VoiceQueueReportEvents['on'](_0x437fcc,_0x1ae294);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 9d7de22..e2ba557 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 _0x3297=['exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','put','destroy'];(function(_0x2db8b6,_0x16c932){var _0x62c621=function(_0xea468a){while(--_0xea468a){_0x2db8b6['push'](_0x2db8b6['shift']());}};_0x62c621(++_0x16c932);}(_0x3297,0x19f));var _0x7329=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x3297[_0x29b609];return _0x54c952;};'use strict';var multer=require(_0x7329('0x0'));var util=require(_0x7329('0x1'));var path=require(_0x7329('0x2'));var timeout=require('connect-timeout');var express=require(_0x7329('0x3'));var router=express[_0x7329('0x4')]();var fs_extra=require(_0x7329('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7329('0x6'));var config=require(_0x7329('0x7'));var controller=require(_0x7329('0x8'));router[_0x7329('0x9')]('/',auth[_0x7329('0xa')](),controller[_0x7329('0xb')]);router[_0x7329('0x9')](_0x7329('0xc'),auth[_0x7329('0xa')](),controller[_0x7329('0xd')]);router[_0x7329('0xe')]('/',auth[_0x7329('0xa')](),controller['create']);router[_0x7329('0xf')]('/:id',auth[_0x7329('0xa')](),controller['update']);router['delete'](_0x7329('0xc'),auth['isAuthenticated'](),controller[_0x7329('0x10')]);module[_0x7329('0x11')]=router; \ No newline at end of file +var _0xdb95=['put','update','delete','/:id','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','get','show','post','create'];(function(_0x3cdb4b,_0x13bebe){var _0x2b4fde=function(_0x52a772){while(--_0x52a772){_0x3cdb4b['push'](_0x3cdb4b['shift']());}};_0x2b4fde(++_0x13bebe);}(_0xdb95,0x1d1));var _0x5db9=function(_0x56d16b,_0x7922cb){_0x56d16b=_0x56d16b-0x0;var _0x1225c7=_0xdb95[_0x56d16b];return _0x1225c7;};'use strict';var multer=require('multer');var util=require(_0x5db9('0x0'));var path=require(_0x5db9('0x1'));var timeout=require(_0x5db9('0x2'));var express=require(_0x5db9('0x3'));var router=express[_0x5db9('0x4')]();var fs_extra=require(_0x5db9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5db9('0x6'));var config=require(_0x5db9('0x7'));var controller=require(_0x5db9('0x8'));router['get']('/',auth[_0x5db9('0x9')](),controller[_0x5db9('0xa')]);router[_0x5db9('0xb')]('/:id',auth[_0x5db9('0x9')](),controller[_0x5db9('0xc')]);router[_0x5db9('0xd')]('/',auth[_0x5db9('0x9')](),controller[_0x5db9('0xe')]);router[_0x5db9('0xf')]('/:id',auth[_0x5db9('0x9')](),controller[_0x5db9('0x10')]);router[_0x5db9('0x11')](_0x5db9('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x5db9('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 1432c09..a826444 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 _0x7f69=['moment','exports','STRING','DATE','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x7f69,0x83));var _0x97f6=function(_0x3203a1,_0x46c498){_0x3203a1=_0x3203a1-0x0;var _0x24215e=_0x7f69[_0x3203a1];return _0x24215e;};'use strict';var Sequelize=require(_0x97f6('0x0'));var moment=require(_0x97f6('0x1'));module[_0x97f6('0x2')]={'time':{'type':Sequelize[_0x97f6('0x3')]},'callid':{'type':Sequelize[_0x97f6('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x97f6('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x97f6('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x97f6('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x97f6('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x97f6('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x97f6('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x97f6('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x97f6('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x97f6('0x4')],'allowNull':![],'defaultValue':Sequelize['literal'](_0x97f6('0x5'))}}; \ No newline at end of file +var _0x0b1b=['moment','exports','STRING','DATE','literal'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0b1b,0x1e5));var _0xb0b1=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0x0b1b[_0x580647];return _0x5f0792;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb0b1('0x0'));module[_0xb0b1('0x1')]={'time':{'type':Sequelize[_0xb0b1('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xb0b1('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xb0b1('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xb0b1('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xb0b1('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xb0b1('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xb0b1('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xb0b1('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xb0b1('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xb0b1('0x4')]('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 a470652..ebce8a8 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 _0xeaaf=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','stack','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','intersection','create','body','destroy','find','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash'];(function(_0x4830ea,_0x147ef1){var _0x5d986b=function(_0x1a4f84){while(--_0x1a4f84){_0x4830ea['push'](_0x4830ea['shift']());}};_0x5d986b(++_0x147ef1);}(_0xeaaf,0x162));var _0xfeaa=function(_0x44e3d3,_0x43a65b){_0x44e3d3=_0x44e3d3-0x0;var _0x573cde=_0xeaaf[_0x44e3d3];return _0x573cde;};'use strict';var emlformat=require(_0xfeaa('0x0'));var rimraf=require(_0xfeaa('0x1'));var zipdir=require(_0xfeaa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfeaa('0x3'));var moment=require('moment');var BPromise=require(_0xfeaa('0x4'));var Mustache=require(_0xfeaa('0x5'));var util=require('util');var path=require(_0xfeaa('0x6'));var sox=require('sox');var csv=require(_0xfeaa('0x7'));var ejs=require(_0xfeaa('0x8'));var fs=require('fs');var fs_extra=require(_0xfeaa('0x9'));var _=require(_0xfeaa('0xa'));var squel=require(_0xfeaa('0xb'));var crypto=require(_0xfeaa('0xc'));var jsforce=require(_0xfeaa('0xd'));var deskjs=require(_0xfeaa('0xe'));var toCsv=require(_0xfeaa('0x7'));var querystring=require(_0xfeaa('0xf'));var Papa=require(_0xfeaa('0x10'));var Redis=require(_0xfeaa('0x11'));var authService=require(_0xfeaa('0x12'));var qs=require(_0xfeaa('0x13'));var as=require(_0xfeaa('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfeaa('0x15'))('api');var utils=require(_0xfeaa('0x16'));var config=require(_0xfeaa('0x17'));var licenseUtil=require(_0xfeaa('0x18'));var db=require(_0xfeaa('0x19'))['db'];function respondWithStatusCode(_0x354f18,_0xc2b464){_0xc2b464=_0xc2b464||0xcc;return function(_0x210b59){if(_0x210b59){return _0x354f18[_0xfeaa('0x1a')](_0xc2b464);}return _0x354f18[_0xfeaa('0x1b')](_0xc2b464)[_0xfeaa('0x1c')]();};}function respondWithResult(_0xa2863a,_0x367951){_0x367951=_0x367951||0xc8;return function(_0x40ce24){if(_0x40ce24){return _0xa2863a['status'](_0x367951)[_0xfeaa('0x1d')](_0x40ce24);}};}function respondWithFilteredResult(_0x201c37,_0x37294e){return function(_0x458552){if(_0x458552){var _0x3faddd=typeof _0x37294e[_0xfeaa('0x1e')]===_0xfeaa('0x1f')&&typeof _0x37294e[_0xfeaa('0x20')]==='undefined';var _0xa817=_0x458552[_0xfeaa('0x21')];var _0x2212e9=_0x3faddd?0x0:_0x37294e[_0xfeaa('0x1e')];var _0x1b3dd7=_0x3faddd?_0x458552[_0xfeaa('0x21')]:_0x37294e[_0xfeaa('0x1e')]+_0x37294e['limit'];var _0x15c713;if(_0x1b3dd7>=_0xa817){_0x1b3dd7=_0xa817;_0x15c713=0xc8;}else{_0x15c713=0xce;}_0x201c37['status'](_0x15c713);return _0x201c37[_0xfeaa('0x22')]('Content-Range',_0x2212e9+'-'+_0x1b3dd7+'/'+_0xa817)[_0xfeaa('0x1d')](_0x458552);}return null;};}function patchUpdates(_0x39f20a){return function(_0x3c9c3b){try{jsonpatch['apply'](_0x3c9c3b,_0x39f20a,!![]);}catch(_0x373284){return BPromise[_0xfeaa('0x23')](_0x373284);}return _0x3c9c3b['save']();};}function saveUpdates(_0x3d3c9d,_0x5a4e59){return function(_0x5f39c2){if(_0x5f39c2){return _0x5f39c2[_0xfeaa('0x24')](_0x3d3c9d)[_0xfeaa('0x25')](function(_0x1a9d4d){return _0x1a9d4d;});}return null;};}function removeEntity(_0x49e47c,_0x1c7912){return function(_0x7ed06e){if(_0x7ed06e){return _0x7ed06e['destroy']()[_0xfeaa('0x25')](function(){_0x49e47c['status'](0xcc)[_0xfeaa('0x1c')]();});}};}function handleEntityNotFound(_0x2827cf,_0x5b33a5){return function(_0x5ef9f3){if(!_0x5ef9f3){_0x2827cf[_0xfeaa('0x1a')](0x194);}return _0x5ef9f3;};}function handleError(_0x308a81,_0x38d012){_0x38d012=_0x38d012||0x1f4;return function(_0x175251){logger['error'](_0x175251[_0xfeaa('0x26')]);if(_0x175251['name']){delete _0x175251[_0xfeaa('0x27')];}_0x308a81[_0xfeaa('0x1b')](_0x38d012)[_0xfeaa('0x28')](_0x175251);};}exports['index']=function(_0x28bdc3,_0x248abc){var _0x54c850={},_0x289687={},_0x9e74a1={'count':0x0,'rows':[]};var _0x18864d=_[_0xfeaa('0x29')](db[_0xfeaa('0x2a')][_0xfeaa('0x2b')],function(_0x2b6307){return{'name':_0x2b6307[_0xfeaa('0x2c')],'type':_0x2b6307[_0xfeaa('0x2d')][_0xfeaa('0x2e')]};});_0x289687[_0xfeaa('0x2f')]=_['map'](_0x18864d,_0xfeaa('0x27'));_0x289687[_0xfeaa('0x30')]=_[_0xfeaa('0x31')](_0x28bdc3[_0xfeaa('0x30')]);_0x289687[_0xfeaa('0x32')]=_['intersection'](_0x289687[_0xfeaa('0x2f')],_0x289687['query']);_0x54c850[_0xfeaa('0x33')]=_['intersection'](_0x289687[_0xfeaa('0x2f')],qs['fields'](_0x28bdc3[_0xfeaa('0x30')][_0xfeaa('0x34')]));_0x54c850[_0xfeaa('0x33')]=_0x54c850[_0xfeaa('0x33')][_0xfeaa('0x35')]?_0x54c850['attributes']:_0x289687[_0xfeaa('0x2f')];if(!_0x28bdc3[_0xfeaa('0x30')][_0xfeaa('0x36')](_0xfeaa('0x37'))){_0x54c850[_0xfeaa('0x20')]=qs[_0xfeaa('0x20')](_0x28bdc3[_0xfeaa('0x30')][_0xfeaa('0x20')]);_0x54c850[_0xfeaa('0x1e')]=qs[_0xfeaa('0x1e')](_0x28bdc3[_0xfeaa('0x30')]['offset']);}_0x54c850[_0xfeaa('0x38')]=qs[_0xfeaa('0x39')](_0x28bdc3[_0xfeaa('0x30')][_0xfeaa('0x39')]);_0x54c850[_0xfeaa('0x3a')]=qs[_0xfeaa('0x32')](_['pick'](_0x28bdc3['query'],_0x289687[_0xfeaa('0x32')]),_0x18864d);if(_0x28bdc3[_0xfeaa('0x30')][_0xfeaa('0x3b')]){_0x54c850[_0xfeaa('0x3a')]=_[_0xfeaa('0x3c')](_0x54c850[_0xfeaa('0x3a')],{'$or':_['map'](_0x18864d,function(_0x31d284){if(_0x31d284[_0xfeaa('0x2d')]!==_0xfeaa('0x3d')){var _0x177948={};_0x177948[_0x31d284[_0xfeaa('0x27')]]={'$like':'%'+_0x28bdc3[_0xfeaa('0x30')][_0xfeaa('0x3b')]+'%'};return _0x177948;}})});}_0x54c850=_[_0xfeaa('0x3c')]({},_0x54c850,_0x28bdc3['options']);var _0x14d83f={'where':_0x54c850[_0xfeaa('0x3a')]};return db[_0xfeaa('0x2a')][_0xfeaa('0x21')](_0x14d83f)[_0xfeaa('0x25')](function(_0x54ad7f){_0x9e74a1[_0xfeaa('0x21')]=_0x54ad7f;if(_0x28bdc3[_0xfeaa('0x30')][_0xfeaa('0x3e')]){_0x54c850[_0xfeaa('0x3f')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xfeaa('0x40')](_0x54c850);})['then'](function(_0x5d3ffd){_0x9e74a1['rows']=_0x5d3ffd;return _0x9e74a1;})[_0xfeaa('0x25')](respondWithFilteredResult(_0x248abc,_0x54c850))[_0xfeaa('0x41')](handleError(_0x248abc,null));};exports[_0xfeaa('0x42')]=function(_0xdd0515,_0x41dce8){var _0x4f76c0={'raw':!![],'where':{'id':_0xdd0515[_0xfeaa('0x43')]['id']}},_0x2cca2b={};_0x2cca2b[_0xfeaa('0x2f')]=_[_0xfeaa('0x31')](db[_0xfeaa('0x2a')][_0xfeaa('0x2b')]);_0x2cca2b[_0xfeaa('0x30')]=_[_0xfeaa('0x31')](_0xdd0515['query']);_0x2cca2b[_0xfeaa('0x32')]=_[_0xfeaa('0x44')](_0x2cca2b[_0xfeaa('0x2f')],_0x2cca2b[_0xfeaa('0x30')]);_0x4f76c0[_0xfeaa('0x33')]=_[_0xfeaa('0x44')](_0x2cca2b['model'],qs[_0xfeaa('0x34')](_0xdd0515[_0xfeaa('0x30')][_0xfeaa('0x34')]));_0x4f76c0[_0xfeaa('0x33')]=_0x4f76c0['attributes'][_0xfeaa('0x35')]?_0x4f76c0[_0xfeaa('0x33')]:_0x2cca2b[_0xfeaa('0x2f')];if(_0xdd0515[_0xfeaa('0x30')][_0xfeaa('0x3e')]){_0x4f76c0[_0xfeaa('0x3f')]=[{'all':!![]}];}_0x4f76c0=_[_0xfeaa('0x3c')]({},_0x4f76c0,_0xdd0515['options']);return db[_0xfeaa('0x2a')]['find'](_0x4f76c0)[_0xfeaa('0x25')](handleEntityNotFound(_0x41dce8,null))['then'](respondWithResult(_0x41dce8,null))[_0xfeaa('0x41')](handleError(_0x41dce8,null));};exports[_0xfeaa('0x45')]=function(_0x4adb49,_0x254a1f){return db[_0xfeaa('0x2a')][_0xfeaa('0x45')](_0x4adb49[_0xfeaa('0x46')],{})[_0xfeaa('0x25')](respondWithResult(_0x254a1f,0xc9))[_0xfeaa('0x41')](handleError(_0x254a1f,null));};exports[_0xfeaa('0x24')]=function(_0x1e47a0,_0x29ce35){if(_0x1e47a0[_0xfeaa('0x46')]['id']){delete _0x1e47a0[_0xfeaa('0x46')]['id'];}return db[_0xfeaa('0x2a')]['find']({'where':{'id':_0x1e47a0[_0xfeaa('0x43')]['id']}})[_0xfeaa('0x25')](handleEntityNotFound(_0x29ce35,null))[_0xfeaa('0x25')](saveUpdates(_0x1e47a0[_0xfeaa('0x46')],null))[_0xfeaa('0x25')](respondWithResult(_0x29ce35,null))[_0xfeaa('0x41')](handleError(_0x29ce35,null));};exports[_0xfeaa('0x47')]=function(_0x5a3fb1,_0x473571){return db['VoiceQueuesLog'][_0xfeaa('0x48')]({'where':{'id':_0x5a3fb1['params']['id']}})[_0xfeaa('0x25')](handleEntityNotFound(_0x473571,null))['then'](removeEntity(_0x473571,null))[_0xfeaa('0x41')](handleError(_0x473571,null));}; \ No newline at end of file +var _0x8a95=['jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','destroy','then','error','name','send','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','VoiceQueuesLog','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','rimraf','zip-dir','fast-json-patch','util','sox','ejs','lodash','squel','crypto'];(function(_0x5b3950,_0x4e5556){var _0x41e436=function(_0x139e30){while(--_0x139e30){_0x5b3950['push'](_0x5b3950['shift']());}};_0x41e436(++_0x4e5556);}(_0x8a95,0x83));var _0x58a9=function(_0x465be6,_0x2668de){_0x465be6=_0x465be6-0x0;var _0x45f7b1=_0x8a95[_0x465be6];return _0x45f7b1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x58a9('0x0'));var zipdir=require(_0x58a9('0x1'));var jsonpatch=require(_0x58a9('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x58a9('0x3'));var path=require('path');var sox=require(_0x58a9('0x4'));var csv=require('to-csv');var ejs=require(_0x58a9('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x58a9('0x6'));var squel=require(_0x58a9('0x7'));var crypto=require(_0x58a9('0x8'));var jsforce=require(_0x58a9('0x9'));var deskjs=require(_0x58a9('0xa'));var toCsv=require(_0x58a9('0xb'));var querystring=require(_0x58a9('0xc'));var Papa=require(_0x58a9('0xd'));var Redis=require('ioredis');var authService=require(_0x58a9('0xe'));var qs=require(_0x58a9('0xf'));var as=require(_0x58a9('0x10'));var hardwareService=require(_0x58a9('0x11'));var logger=require('../../config/logger')(_0x58a9('0x12'));var utils=require(_0x58a9('0x13'));var config=require(_0x58a9('0x14'));var licenseUtil=require(_0x58a9('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c5062,_0x4bdd96){_0x4bdd96=_0x4bdd96||0xcc;return function(_0x468f6f){if(_0x468f6f){return _0x3c5062[_0x58a9('0x16')](_0x4bdd96);}return _0x3c5062[_0x58a9('0x17')](_0x4bdd96)[_0x58a9('0x18')]();};}function respondWithResult(_0x5c4463,_0xefabb7){_0xefabb7=_0xefabb7||0xc8;return function(_0x27cdd0){if(_0x27cdd0){return _0x5c4463[_0x58a9('0x17')](_0xefabb7)[_0x58a9('0x19')](_0x27cdd0);}};}function respondWithFilteredResult(_0x4595dd,_0x5b0c36){return function(_0x3efd50){if(_0x3efd50){var _0x5bbaf1=typeof _0x5b0c36[_0x58a9('0x1a')]===_0x58a9('0x1b')&&typeof _0x5b0c36['limit']===_0x58a9('0x1b');var _0x54d4c6=_0x3efd50[_0x58a9('0x1c')];var _0x2c7c96=_0x5bbaf1?0x0:_0x5b0c36[_0x58a9('0x1a')];var _0x503863=_0x5bbaf1?_0x3efd50[_0x58a9('0x1c')]:_0x5b0c36['offset']+_0x5b0c36[_0x58a9('0x1d')];var _0x50d2e6;if(_0x503863>=_0x54d4c6){_0x503863=_0x54d4c6;_0x50d2e6=0xc8;}else{_0x50d2e6=0xce;}_0x4595dd['status'](_0x50d2e6);return _0x4595dd['set'](_0x58a9('0x1e'),_0x2c7c96+'-'+_0x503863+'/'+_0x54d4c6)['json'](_0x3efd50);}return null;};}function patchUpdates(_0x49be5a){return function(_0x41a387){try{jsonpatch['apply'](_0x41a387,_0x49be5a,!![]);}catch(_0x126f7d){return BPromise[_0x58a9('0x1f')](_0x126f7d);}return _0x41a387[_0x58a9('0x20')]();};}function saveUpdates(_0x500269,_0x592891){return function(_0x425b03){if(_0x425b03){return _0x425b03['update'](_0x500269)['then'](function(_0x2ba359){return _0x2ba359;});}return null;};}function removeEntity(_0x4649ef,_0x570790){return function(_0x51c319){if(_0x51c319){return _0x51c319[_0x58a9('0x21')]()[_0x58a9('0x22')](function(){_0x4649ef[_0x58a9('0x17')](0xcc)[_0x58a9('0x18')]();});}};}function handleEntityNotFound(_0x54c332,_0x1bbeff){return function(_0x58194a){if(!_0x58194a){_0x54c332[_0x58a9('0x16')](0x194);}return _0x58194a;};}function handleError(_0x3bd43e,_0xb993fa){_0xb993fa=_0xb993fa||0x1f4;return function(_0x5c5fae){logger[_0x58a9('0x23')](_0x5c5fae['stack']);if(_0x5c5fae[_0x58a9('0x24')]){delete _0x5c5fae['name'];}_0x3bd43e[_0x58a9('0x17')](_0xb993fa)[_0x58a9('0x25')](_0x5c5fae);};}exports['index']=function(_0x52646a,_0x38e04c){var _0x4b23ce={},_0x70af97={},_0x2cf0da={'count':0x0,'rows':[]};var _0x2e3bf4=_['map'](db['VoiceQueuesLog']['rawAttributes'],function(_0x57d8b0){return{'name':_0x57d8b0[_0x58a9('0x26')],'type':_0x57d8b0[_0x58a9('0x27')][_0x58a9('0x28')]};});_0x70af97[_0x58a9('0x29')]=_[_0x58a9('0x2a')](_0x2e3bf4,_0x58a9('0x24'));_0x70af97['query']=_['keys'](_0x52646a[_0x58a9('0x2b')]);_0x70af97[_0x58a9('0x2c')]=_[_0x58a9('0x2d')](_0x70af97[_0x58a9('0x29')],_0x70af97['query']);_0x4b23ce[_0x58a9('0x2e')]=_['intersection'](_0x70af97['model'],qs[_0x58a9('0x2f')](_0x52646a[_0x58a9('0x2b')][_0x58a9('0x2f')]));_0x4b23ce[_0x58a9('0x2e')]=_0x4b23ce['attributes'][_0x58a9('0x30')]?_0x4b23ce[_0x58a9('0x2e')]:_0x70af97['model'];if(!_0x52646a[_0x58a9('0x2b')][_0x58a9('0x31')](_0x58a9('0x32'))){_0x4b23ce['limit']=qs[_0x58a9('0x1d')](_0x52646a['query'][_0x58a9('0x1d')]);_0x4b23ce[_0x58a9('0x1a')]=qs[_0x58a9('0x1a')](_0x52646a[_0x58a9('0x2b')][_0x58a9('0x1a')]);}_0x4b23ce[_0x58a9('0x33')]=qs[_0x58a9('0x34')](_0x52646a[_0x58a9('0x2b')][_0x58a9('0x34')]);_0x4b23ce[_0x58a9('0x35')]=qs['filters'](_['pick'](_0x52646a['query'],_0x70af97['filters']),_0x2e3bf4);if(_0x52646a[_0x58a9('0x2b')][_0x58a9('0x36')]){_0x4b23ce[_0x58a9('0x35')]=_[_0x58a9('0x37')](_0x4b23ce[_0x58a9('0x35')],{'$or':_[_0x58a9('0x2a')](_0x2e3bf4,function(_0x20581b){if(_0x20581b['type']!=='VIRTUAL'){var _0x22371a={};_0x22371a[_0x20581b[_0x58a9('0x24')]]={'$like':'%'+_0x52646a[_0x58a9('0x2b')][_0x58a9('0x36')]+'%'};return _0x22371a;}})});}_0x4b23ce=_[_0x58a9('0x37')]({},_0x4b23ce,_0x52646a[_0x58a9('0x38')]);var _0x2b0467={'where':_0x4b23ce['where']};return db[_0x58a9('0x39')][_0x58a9('0x1c')](_0x2b0467)[_0x58a9('0x22')](function(_0x100313){_0x2cf0da['count']=_0x100313;if(_0x52646a[_0x58a9('0x2b')][_0x58a9('0x3a')]){_0x4b23ce[_0x58a9('0x3b')]=[{'all':!![]}];}return db[_0x58a9('0x39')][_0x58a9('0x3c')](_0x4b23ce);})[_0x58a9('0x22')](function(_0x39fcac){_0x2cf0da[_0x58a9('0x3d')]=_0x39fcac;return _0x2cf0da;})[_0x58a9('0x22')](respondWithFilteredResult(_0x38e04c,_0x4b23ce))[_0x58a9('0x3e')](handleError(_0x38e04c,null));};exports[_0x58a9('0x3f')]=function(_0x540aef,_0x3d7e87){var _0x2f0b2c={'raw':!![],'where':{'id':_0x540aef[_0x58a9('0x40')]['id']}},_0x159ed1={};_0x159ed1['model']=_[_0x58a9('0x41')](db['VoiceQueuesLog']['rawAttributes']);_0x159ed1['query']=_[_0x58a9('0x41')](_0x540aef[_0x58a9('0x2b')]);_0x159ed1[_0x58a9('0x2c')]=_[_0x58a9('0x2d')](_0x159ed1['model'],_0x159ed1[_0x58a9('0x2b')]);_0x2f0b2c[_0x58a9('0x2e')]=_[_0x58a9('0x2d')](_0x159ed1[_0x58a9('0x29')],qs[_0x58a9('0x2f')](_0x540aef[_0x58a9('0x2b')][_0x58a9('0x2f')]));_0x2f0b2c[_0x58a9('0x2e')]=_0x2f0b2c[_0x58a9('0x2e')][_0x58a9('0x30')]?_0x2f0b2c['attributes']:_0x159ed1['model'];if(_0x540aef[_0x58a9('0x2b')]['includeAll']){_0x2f0b2c[_0x58a9('0x3b')]=[{'all':!![]}];}_0x2f0b2c=_[_0x58a9('0x37')]({},_0x2f0b2c,_0x540aef[_0x58a9('0x38')]);return db[_0x58a9('0x39')][_0x58a9('0x42')](_0x2f0b2c)[_0x58a9('0x22')](handleEntityNotFound(_0x3d7e87,null))['then'](respondWithResult(_0x3d7e87,null))['catch'](handleError(_0x3d7e87,null));};exports[_0x58a9('0x43')]=function(_0x15f072,_0x1cf0f2){return db[_0x58a9('0x39')][_0x58a9('0x43')](_0x15f072[_0x58a9('0x44')],{})[_0x58a9('0x22')](respondWithResult(_0x1cf0f2,0xc9))[_0x58a9('0x3e')](handleError(_0x1cf0f2,null));};exports[_0x58a9('0x45')]=function(_0x551002,_0x5e702f){if(_0x551002[_0x58a9('0x44')]['id']){delete _0x551002[_0x58a9('0x44')]['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0x551002[_0x58a9('0x40')]['id']}})[_0x58a9('0x22')](handleEntityNotFound(_0x5e702f,null))['then'](saveUpdates(_0x551002['body'],null))[_0x58a9('0x22')](respondWithResult(_0x5e702f,null))[_0x58a9('0x3e')](handleError(_0x5e702f,null));};exports[_0x58a9('0x21')]=function(_0x37ffe6,_0x825a1e){return db[_0x58a9('0x39')][_0x58a9('0x42')]({'where':{'id':_0x37ffe6[_0x58a9('0x40')]['id']}})[_0x58a9('0x22')](handleEntityNotFound(_0x825a1e,null))[_0x58a9('0x22')](removeEntity(_0x825a1e,null))[_0x58a9('0x3e')](handleError(_0x825a1e,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index d2f5928..1bfa6b0 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 _0x0e12=['request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','VoiceQueuesLog','event_dtm','dtm','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x49472d,_0x313e0c){var _0x89dd1=function(_0x5a0afe){while(--_0x5a0afe){_0x49472d['push'](_0x49472d['shift']());}};_0x89dd1(++_0x313e0c);}(_0x0e12,0x180));var _0x20e1=function(_0x18afca,_0x4219d9){_0x18afca=_0x18afca-0x0;var _0x11603f=_0x0e12[_0x18afca];return _0x11603f;};'use strict';var _=require(_0x20e1('0x0'));var util=require(_0x20e1('0x1'));var logger=require(_0x20e1('0x2'))(_0x20e1('0x3'));var moment=require(_0x20e1('0x4'));var BPromise=require(_0x20e1('0x5'));var rp=require(_0x20e1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x20e1('0x7'));var config=require(_0x20e1('0x8'));var attributes=require(_0x20e1('0x9'));module['exports']=function(_0x2cf10e,_0xc71f92){return _0x2cf10e['define'](_0x20e1('0xa'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x20e1('0xb'),'fields':['event',_0x20e1('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9ff0=['api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event_dtm','dtm','lodash','util','../../config/logger'];(function(_0x156a0d,_0x3946ce){var _0x98a9ba=function(_0x46c1b2){while(--_0x46c1b2){_0x156a0d['push'](_0x156a0d['shift']());}};_0x98a9ba(++_0x3946ce);}(_0x9ff0,0x174));var _0x09ff=function(_0x42d806,_0x55b8cc){_0x42d806=_0x42d806-0x0;var _0x3d3a5f=_0x9ff0[_0x42d806];return _0x3d3a5f;};'use strict';var _=require(_0x09ff('0x0'));var util=require(_0x09ff('0x1'));var logger=require(_0x09ff('0x2'))(_0x09ff('0x3'));var moment=require('moment');var BPromise=require(_0x09ff('0x4'));var rp=require(_0x09ff('0x5'));var fs=require('fs');var path=require(_0x09ff('0x6'));var rimraf=require(_0x09ff('0x7'));var config=require(_0x09ff('0x8'));var attributes=require(_0x09ff('0x9'));module['exports']=function(_0x5b4132,_0x2f62d9){return _0x5b4132[_0x09ff('0xa')](_0x09ff('0xb'),attributes,{'tableName':_0x09ff('0xc'),'paranoid':![],'indexes':[{'name':_0x09ff('0xd'),'fields':['event',_0x09ff('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index f2fa41b..4254e52 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 _0x4dbf=['rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x5b386e,_0x443b48){var _0x1370bc=function(_0xcc18aa){while(--_0xcc18aa){_0x5b386e['push'](_0x5b386e['shift']());}};_0x1370bc(++_0x443b48);}(_0x4dbf,0xe8));var _0xf4db=function(_0x296923,_0x4adaed){_0x296923=_0x296923-0x0;var _0x29af70=_0x4dbf[_0x296923];return _0x29af70;};'use strict';var _=require(_0xf4db('0x0'));var util=require(_0xf4db('0x1'));var moment=require(_0xf4db('0x2'));var BPromise=require(_0xf4db('0x3'));var rs=require(_0xf4db('0x4'));var fs=require('fs');var Redis=require(_0xf4db('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf4db('0x6'));var logger=require(_0xf4db('0x7'))(_0xf4db('0x8'));var config=require(_0xf4db('0x9'));var jayson=require(_0xf4db('0xa'));var client=jayson[_0xf4db('0xb')][_0xf4db('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xca904a,_0x1bbf25,_0x2ca179){return new BPromise(function(_0x315981,_0xa03d4d){return client[_0xf4db('0xd')](_0xca904a,_0x2ca179)[_0xf4db('0xe')](function(_0x2b5f98){logger['info'](_0xf4db('0xf'),_0x1bbf25,_0xf4db('0x10'));logger[_0xf4db('0x11')](_0xf4db('0x12'),_0x1bbf25,_0xf4db('0x10'),JSON['stringify'](_0x2b5f98));if(_0x2b5f98[_0xf4db('0x13')]){if(_0x2b5f98['error'][_0xf4db('0x14')]===0x1f4){logger['error'](_0xf4db('0xf'),_0x1bbf25,_0x2b5f98[_0xf4db('0x13')][_0xf4db('0x15')]);return _0xa03d4d(_0x2b5f98[_0xf4db('0x13')][_0xf4db('0x15')]);}logger['error'](_0xf4db('0xf'),_0x1bbf25,_0x2b5f98['error']['message']);return _0x315981(_0x2b5f98['error'][_0xf4db('0x15')]);}else{logger[_0xf4db('0x16')](_0xf4db('0xf'),_0x1bbf25,'request\x20sent');_0x315981(_0x2b5f98['result']['message']);}})[_0xf4db('0x17')](function(_0x409246){logger[_0xf4db('0x13')](_0xf4db('0xf'),_0x1bbf25,_0x409246);_0xa03d4d(_0x409246);});});} \ No newline at end of file +var _0xf2a4=['message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xf2a4,0xfe));var _0x4f2a=function(_0x5a3671,_0x5587ee){_0x5a3671=_0x5a3671-0x0;var _0x2c5c87=_0xf2a4[_0x5a3671];return _0x2c5c87;};'use strict';var _=require(_0x4f2a('0x0'));var util=require(_0x4f2a('0x1'));var moment=require('moment');var BPromise=require(_0x4f2a('0x2'));var rs=require(_0x4f2a('0x3'));var fs=require('fs');var Redis=require(_0x4f2a('0x4'));var db=require(_0x4f2a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f2a('0x6'))(_0x4f2a('0x7'));var config=require('../../config/environment');var jayson=require(_0x4f2a('0x8'));var client=jayson[_0x4f2a('0x9')][_0x4f2a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e6757,_0x511463,_0x4bd1a7){return new BPromise(function(_0x465bfb,_0x2e3bd2){return client[_0x4f2a('0xb')](_0x3e6757,_0x4bd1a7)['then'](function(_0x3ab9f0){logger[_0x4f2a('0xc')](_0x4f2a('0xd'),_0x511463,_0x4f2a('0xe'));logger[_0x4f2a('0xf')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x511463,_0x4f2a('0xe'),JSON[_0x4f2a('0x10')](_0x3ab9f0));if(_0x3ab9f0[_0x4f2a('0x11')]){if(_0x3ab9f0[_0x4f2a('0x11')][_0x4f2a('0x12')]===0x1f4){logger[_0x4f2a('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x511463,_0x3ab9f0[_0x4f2a('0x11')][_0x4f2a('0x13')]);return _0x2e3bd2(_0x3ab9f0[_0x4f2a('0x11')]['message']);}logger[_0x4f2a('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x511463,_0x3ab9f0['error'][_0x4f2a('0x13')]);return _0x465bfb(_0x3ab9f0[_0x4f2a('0x11')][_0x4f2a('0x13')]);}else{logger[_0x4f2a('0xc')](_0x4f2a('0xd'),_0x511463,_0x4f2a('0xe'));_0x465bfb(_0x3ab9f0[_0x4f2a('0x14')][_0x4f2a('0x13')]);}})['catch'](function(_0x18980b){logger[_0x4f2a('0x11')](_0x4f2a('0xd'),_0x511463,_0x18980b);_0x2e3bd2(_0x18980b);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 0c12f67..f9c9fe1 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 _0xd5ff=['/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','/:id','destroy','exports','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/download','download'];(function(_0x5a187b,_0x1f64fe){var _0x14d601=function(_0x45fd29){while(--_0x45fd29){_0x5a187b['push'](_0x5a187b['shift']());}};_0x14d601(++_0x1f64fe);}(_0xd5ff,0xc1));var _0xfd5f=function(_0x37d802,_0x32d7e5){_0x37d802=_0x37d802-0x0;var _0x10e9f0=_0xd5ff[_0x37d802];return _0x10e9f0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfd5f('0x0'));var timeout=require(_0xfd5f('0x1'));var express=require(_0xfd5f('0x2'));var router=express['Router']();var fs_extra=require(_0xfd5f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xfd5f('0x4'));var config=require(_0xfd5f('0x5'));var controller=require('./voiceRecording.controller');router[_0xfd5f('0x6')]('/',auth[_0xfd5f('0x7')](),controller[_0xfd5f('0x8')]);router[_0xfd5f('0x6')](_0xfd5f('0x9'),auth[_0xfd5f('0x7')](),controller[_0xfd5f('0xa')]);router[_0xfd5f('0x6')]('/:id',auth[_0xfd5f('0x7')](),controller[_0xfd5f('0xb')]);router[_0xfd5f('0x6')](_0xfd5f('0xc'),auth[_0xfd5f('0x7')](),controller[_0xfd5f('0xd')]);router['get']('/:id/downloads',controller['downloads']);router[_0xfd5f('0x6')](_0xfd5f('0xe'),auth[_0xfd5f('0x7')](),controller[_0xfd5f('0xf')]);router[_0xfd5f('0x10')]('/',auth['isAuthenticated'](),controller[_0xfd5f('0x11')]);router[_0xfd5f('0x10')](_0xfd5f('0xe'),auth[_0xfd5f('0x7')](),controller[_0xfd5f('0x12')]);router[_0xfd5f('0x13')](_0xfd5f('0x14'),auth[_0xfd5f('0x7')](),controller['update']);router['delete'](_0xfd5f('0x14'),auth[_0xfd5f('0x7')](),controller[_0xfd5f('0x15')]);module[_0xfd5f('0x16')]=router; \ No newline at end of file +var _0x370e=['show','isAuthenticated','/:id/downloads','/:id/transcribe','downloadTranscribe','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id'];(function(_0x2aca66,_0x2cf8d6){var _0x569919=function(_0x26bb24){while(--_0x26bb24){_0x2aca66['push'](_0x2aca66['shift']());}};_0x569919(++_0x2cf8d6);}(_0x370e,0x1cd));var _0xe370=function(_0xa1ceeb,_0x24577){_0xa1ceeb=_0xa1ceeb-0x0;var _0x209288=_0x370e[_0xa1ceeb];return _0x209288;};'use strict';var multer=require('multer');var util=require(_0xe370('0x0'));var path=require(_0xe370('0x1'));var timeout=require(_0xe370('0x2'));var express=require(_0xe370('0x3'));var router=express[_0xe370('0x4')]();var fs_extra=require(_0xe370('0x5'));var auth=require(_0xe370('0x6'));var interaction=require(_0xe370('0x7'));var config=require(_0xe370('0x8'));var controller=require('./voiceRecording.controller');router[_0xe370('0x9')]('/',auth['isAuthenticated'](),controller[_0xe370('0xa')]);router[_0xe370('0x9')](_0xe370('0xb'),auth['isAuthenticated'](),controller[_0xe370('0xc')]);router['get'](_0xe370('0xd'),auth['isAuthenticated'](),controller[_0xe370('0xe')]);router[_0xe370('0x9')]('/:id/download',auth[_0xe370('0xf')](),controller['download']);router[_0xe370('0x9')](_0xe370('0x10'),controller['downloads']);router[_0xe370('0x9')](_0xe370('0x11'),auth[_0xe370('0xf')](),controller[_0xe370('0x12')]);router[_0xe370('0x13')]('/',auth[_0xe370('0xf')](),controller['create']);router[_0xe370('0x13')]('/:id/transcribe',auth[_0xe370('0xf')](),controller['runTranscribe']);router[_0xe370('0x14')](_0xe370('0xd'),auth[_0xe370('0xf')](),controller[_0xe370('0x15')]);router[_0xe370('0x16')]('/:id',auth[_0xe370('0xf')](),controller[_0xe370('0x17')]);module[_0xe370('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index df54bcf..c489822 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(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 4fb1795..0bc7aff 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 _0xc58b=['transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','recording','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','language','sentiment','sentimentAccountId','sentimentRegion','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','runSentiment','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','VoiceRecording','rawAttributes','type','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','create','body','describe','uniqueid','find','value','%s.cypher','existsSync','decryptFile','ValidationError','download','extname','unlink','message','VoiceRecording\x20not\x20found','send','Not\x20found','downloads','../../components/encryptor','sequelize','col','$and','push','format','secrets','Sequelize','filename','destroy','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName'];(function(_0x42b8f5,_0x4b9730){var _0x31ca50=function(_0x2060a){while(--_0x2060a){_0x42b8f5['push'](_0x42b8f5['shift']());}};_0x31ca50(++_0x4b9730);}(_0xc58b,0x1eb));var _0xbc58=function(_0x5c4185,_0x3026c5){_0x5c4185=_0x5c4185-0x0;var _0x592c7b=_0xc58b[_0x5c4185];return _0x592c7b;};'use strict';var emlformat=require(_0xbc58('0x0'));var rimraf=require(_0xbc58('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbc58('0x2'));var rp=require(_0xbc58('0x3'));var moment=require('moment');var BPromise=require(_0xbc58('0x4'));var Mustache=require('mustache');var util=require(_0xbc58('0x5'));var path=require(_0xbc58('0x6'));var sox=require(_0xbc58('0x7'));var csv=require(_0xbc58('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbc58('0x9'));var _=require('lodash');var squel=require(_0xbc58('0xa'));var crypto=require(_0xbc58('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbc58('0xc'));var Papa=require(_0xbc58('0xd'));var AWS=require('aws-sdk');var uuidv4=require(_0xbc58('0xe'));var Redis=require(_0xbc58('0xf'));var authService=require(_0xbc58('0x10'));var qs=require(_0xbc58('0x11'));var as=require(_0xbc58('0x12'));var hardwareService=require(_0xbc58('0x13'));var logger=require('../../config/logger')(_0xbc58('0x14'));var utils=require('../../config/utils');var config=require(_0xbc58('0x15'));var licenseUtil=require(_0xbc58('0x16'));var db=require(_0xbc58('0x17'))['db'];function respondWithStatusCode(_0x27428b,_0xbe4d68){_0xbe4d68=_0xbe4d68||0xcc;return function(_0x4fef43){if(_0x4fef43){return _0x27428b[_0xbc58('0x18')](_0xbe4d68);}return _0x27428b['status'](_0xbe4d68)[_0xbc58('0x19')]();};}function respondWithResult(_0x35b66e,_0x254967){_0x254967=_0x254967||0xc8;return function(_0x2027c8){if(_0x2027c8){return _0x35b66e[_0xbc58('0x1a')](_0x254967)[_0xbc58('0x1b')](_0x2027c8);}};}function respondWithFilteredResult(_0x171514,_0xaa9f8a){return function(_0x240d66){if(_0x240d66){var _0x362076=typeof _0xaa9f8a[_0xbc58('0x1c')]===_0xbc58('0x1d')&&typeof _0xaa9f8a['limit']==='undefined';var _0x273288=_0x240d66['count'];var _0x45ce24=_0x362076?0x0:_0xaa9f8a[_0xbc58('0x1c')];var _0x17483b=_0x362076?_0x240d66['count']:_0xaa9f8a[_0xbc58('0x1c')]+_0xaa9f8a[_0xbc58('0x1e')];var _0x4a3dc0;if(_0x17483b>=_0x273288){_0x17483b=_0x273288;_0x4a3dc0=0xc8;}else{_0x4a3dc0=0xce;}_0x171514[_0xbc58('0x1a')](_0x4a3dc0);return _0x171514['set'](_0xbc58('0x1f'),_0x45ce24+'-'+_0x17483b+'/'+_0x273288)[_0xbc58('0x1b')](_0x240d66);}return null;};}function patchUpdates(_0x4fe138){return function(_0x177f93){try{jsonpatch[_0xbc58('0x20')](_0x177f93,_0x4fe138,!![]);}catch(_0x4dd6b7){return BPromise[_0xbc58('0x21')](_0x4dd6b7);}return _0x177f93[_0xbc58('0x22')]();};}function saveUpdates(_0x57746d,_0x2c2b26){return function(_0x2cc073){if(_0x2cc073){return _0x2cc073[_0xbc58('0x23')](_0x57746d)[_0xbc58('0x24')](function(_0x3665ed){return _0x3665ed;});}return null;};}function removeEntity(_0x5f543c,_0x3c572c){return function(_0x3b8c14){if(_0x3b8c14){return _0x3b8c14['destroy']()[_0xbc58('0x24')](function(){_0x5f543c[_0xbc58('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b3f0e,_0x1aadb8){return function(_0x4185c0){if(!_0x4185c0){_0x2b3f0e[_0xbc58('0x18')](0x194);}return _0x4185c0;};}function handleError(_0x3a60f8,_0x20b8d0){_0x20b8d0=_0x20b8d0||0x1f4;return function(_0x618d10){logger[_0xbc58('0x25')](_0x618d10[_0xbc58('0x26')]);if(_0x618d10['name']){delete _0x618d10[_0xbc58('0x27')];}_0x3a60f8['status'](_0x20b8d0)['send'](_0x618d10);};}exports[_0xbc58('0x28')]=function(_0x11a055,_0x5546fa){var _0x440ea7={},_0x4252ad={},_0xf85a72={'count':0x0,'rows':[]};var _0x2e7884=_[_0xbc58('0x29')](db[_0xbc58('0x2a')][_0xbc58('0x2b')],function(_0xa58bde){return{'name':_0xa58bde['fieldName'],'type':_0xa58bde[_0xbc58('0x2c')]['key']};});_0x4252ad[_0xbc58('0x2d')]=_[_0xbc58('0x2e')](_[_0xbc58('0x29')](_0x2e7884,'name'),['format']);_0x4252ad[_0xbc58('0x2f')]=_[_0xbc58('0x30')](_0x11a055['query']);_0x4252ad[_0xbc58('0x31')]=_[_0xbc58('0x32')](_0x4252ad['model'],_0x4252ad['query']);_0x440ea7[_0xbc58('0x33')]=_[_0xbc58('0x32')](_0x4252ad[_0xbc58('0x2d')],qs[_0xbc58('0x34')](_0x11a055['query'][_0xbc58('0x34')]));_0x440ea7[_0xbc58('0x33')]=_0x440ea7[_0xbc58('0x33')][_0xbc58('0x35')]?_0x440ea7['attributes']:_0x4252ad['model'];if(!_0x11a055[_0xbc58('0x2f')][_0xbc58('0x36')](_0xbc58('0x37'))){_0x440ea7[_0xbc58('0x1e')]=qs[_0xbc58('0x1e')](_0x11a055['query'][_0xbc58('0x1e')]);_0x440ea7[_0xbc58('0x1c')]=qs[_0xbc58('0x1c')](_0x11a055['query']['offset']);}_0x440ea7[_0xbc58('0x38')]=qs[_0xbc58('0x39')](_0x11a055['query'][_0xbc58('0x39')]);_0x440ea7[_0xbc58('0x3a')]=qs[_0xbc58('0x31')](_[_0xbc58('0x3b')](_0x11a055[_0xbc58('0x2f')],_0x4252ad[_0xbc58('0x31')]),_0x2e7884);if(_0x11a055[_0xbc58('0x2f')][_0xbc58('0x3c')]){_0x440ea7[_0xbc58('0x3a')]=_[_0xbc58('0x3d')](_0x440ea7[_0xbc58('0x3a')],{'$or':_[_0xbc58('0x29')](_0x2e7884,function(_0x5cc323){if(_0x5cc323['type']!==_0xbc58('0x3e')){var _0x545dc4={};_0x545dc4[_0x5cc323['name']]={'$like':'%'+_0x11a055[_0xbc58('0x2f')]['filter']+'%'};return _0x545dc4;}})});}_0x440ea7=_[_0xbc58('0x3d')]({},_0x440ea7,_0x11a055[_0xbc58('0x3f')]);var _0x589dc6={'where':_0x440ea7[_0xbc58('0x3a')]};return db[_0xbc58('0x2a')][_0xbc58('0x40')](_0x589dc6)[_0xbc58('0x24')](function(_0x158794){_0xf85a72[_0xbc58('0x40')]=_0x158794;if(_0x11a055[_0xbc58('0x2f')][_0xbc58('0x41')]){_0x440ea7[_0xbc58('0x42')]=[{'all':!![]}];}return db[_0xbc58('0x2a')]['findAll'](_0x440ea7);})[_0xbc58('0x24')](function(_0x59d325){_0xf85a72[_0xbc58('0x43')]=_0x59d325;return _0xf85a72;})['then'](respondWithFilteredResult(_0x5546fa,_0x440ea7))[_0xbc58('0x44')](handleError(_0x5546fa,null));};exports[_0xbc58('0x45')]=function(_0x13ca73,_0x5d5e63){var _0x12971e={'raw':![],'where':{'id':_0x13ca73[_0xbc58('0x46')]['id']}},_0x318f58={};_0x318f58[_0xbc58('0x2d')]=_[_0xbc58('0x30')](db[_0xbc58('0x2a')][_0xbc58('0x2b')]);_0x318f58['query']=_[_0xbc58('0x30')](_0x13ca73[_0xbc58('0x2f')]);_0x318f58['filters']=_['intersection'](_0x318f58['model'],_0x318f58[_0xbc58('0x2f')]);_0x12971e[_0xbc58('0x33')]=_[_0xbc58('0x32')](_0x318f58[_0xbc58('0x2d')],qs[_0xbc58('0x34')](_0x13ca73[_0xbc58('0x2f')][_0xbc58('0x34')]));_0x12971e['attributes']=_0x12971e[_0xbc58('0x33')]['length']?_0x12971e[_0xbc58('0x33')]:_0x318f58[_0xbc58('0x2d')];if(_0x13ca73[_0xbc58('0x2f')][_0xbc58('0x41')]){_0x12971e[_0xbc58('0x42')]=[{'all':!![]}];}_0x12971e=_[_0xbc58('0x3d')]({},_0x12971e,_0x13ca73[_0xbc58('0x3f')]);return db['VoiceRecording']['find'](_0x12971e)['then'](handleEntityNotFound(_0x5d5e63,null))['then'](respondWithResult(_0x5d5e63,null))[_0xbc58('0x44')](handleError(_0x5d5e63,null));};exports[_0xbc58('0x47')]=function(_0x102498,_0x53787f){return db[_0xbc58('0x2a')][_0xbc58('0x47')](_0x102498[_0xbc58('0x48')],{})[_0xbc58('0x24')](respondWithResult(_0x53787f,0xc9))[_0xbc58('0x44')](handleError(_0x53787f,null));};exports[_0xbc58('0x23')]=function(_0x22c538,_0x4bb9d3){if(_0x22c538[_0xbc58('0x48')]['id']){delete _0x22c538[_0xbc58('0x48')]['id'];}return db['VoiceRecording']['find']({'where':{'id':_0x22c538['params']['id']}})[_0xbc58('0x24')](handleEntityNotFound(_0x4bb9d3,null))['then'](saveUpdates(_0x22c538[_0xbc58('0x48')],null))[_0xbc58('0x24')](respondWithResult(_0x4bb9d3,null))[_0xbc58('0x44')](handleError(_0x4bb9d3,null));};exports[_0xbc58('0x49')]=function(_0x12270f,_0x356187){return db['VoiceRecording']['describe']()[_0xbc58('0x24')](respondWithResult(_0x356187,null))[_0xbc58('0x44')](handleError(_0x356187,null));};exports['download']=function(_0x80a326,_0x579cf3,_0x8ca013){var _0xf27e40=require('../../components/encryptor');var _0x38373c=![];var _0x1553fa={};if(_0x80a326[_0xbc58('0x2f')][_0xbc58('0x2c')]&&_0x80a326[_0xbc58('0x2f')][_0xbc58('0x2c')]===_0xbc58('0x4a')){_0x1553fa[_0xbc58('0x4a')]=_0x80a326[_0xbc58('0x46')]['id'];}else{_0x1553fa['id']=_0x80a326[_0xbc58('0x46')]['id'];}return db[_0xbc58('0x2a')][_0xbc58('0x4b')]({'where':_0x1553fa,'attributes':['id',_0xbc58('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x579cf3,null))[_0xbc58('0x24')](function(_0x10ca93){if(_0x10ca93){var _0x1c4410=_0x10ca93[_0xbc58('0x4c')];var _0x4b547c=util['format'](_0xbc58('0x4d'),_0x1c4410);if(fs[_0xbc58('0x4e')](_0x4b547c)){_0x38373c=!![];return _0xf27e40[_0xbc58('0x4f')](_0x4b547c,_0x1c4410,config['secrets']['recording'])[_0xbc58('0x24')](function(){return _0x10ca93;});}return _0x10ca93;}})['then'](function(_0x108ff2){if(_0x108ff2){var _0x5c36c6=_0x108ff2[_0xbc58('0x4c')];if(!fs[_0xbc58('0x4e')](_0x5c36c6)){throw new db['Sequelize'][(_0xbc58('0x50'))]('VoiceRecording\x20not\x20found');}if(_0x108ff2['filename']){return _0x579cf3[_0xbc58('0x51')](_0x5c36c6,_0x108ff2['filename']+path[_0xbc58('0x52')](_0x5c36c6),function(){if(_0x38373c){fs[_0xbc58('0x53')](_0x5c36c6);}});}else{return _0x579cf3[_0xbc58('0x51')](_0x5c36c6,function(_0x184362){if(_0x38373c){fs[_0xbc58('0x53')](_0x5c36c6);}});}}})['catch'](function(_0x140a40){if(_0x140a40[_0xbc58('0x54')]===_0xbc58('0x55')){_0x579cf3[_0xbc58('0x1a')](0x194)[_0xbc58('0x56')](_0xbc58('0x57'));}else{return handleError(_0x579cf3,null);}});};exports[_0xbc58('0x58')]=function(_0x1ec448,_0x4e5548,_0x42b02f){var _0x3e5243=require(_0xbc58('0x59'));var _0x1bf477=![];var _0x37d5cd={'$and':[db[_0xbc58('0x5a')][_0xbc58('0x3a')](db[_0xbc58('0x5a')]['fn']('MD5',db['sequelize'][_0xbc58('0x5b')](_0xbc58('0x4a'))),_0x1ec448[_0xbc58('0x2f')]['token'])]};if(_0x1ec448['query'][_0xbc58('0x2c')]&&_0x1ec448[_0xbc58('0x2f')][_0xbc58('0x2c')]===_0xbc58('0x4a')){_0x37d5cd[_0xbc58('0x5c')][_0xbc58('0x5d')]({'uniqueid':_0x1ec448[_0xbc58('0x46')]['id']});}else{_0x37d5cd[_0xbc58('0x5c')][_0xbc58('0x5d')]({'id':_0x1ec448[_0xbc58('0x46')]['id']});}return db[_0xbc58('0x2a')][_0xbc58('0x4b')]({'where':_0x37d5cd,'attributes':['id',_0xbc58('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x4e5548,null))[_0xbc58('0x24')](function(_0x46373f){if(_0x46373f){var _0x3b3931=util[_0xbc58('0x5e')](_0xbc58('0x4d'),_0x46373f['value']);if(fs[_0xbc58('0x4e')](_0x3b3931)){_0x1bf477=!![];return _0x3e5243['decryptFile'](_0x3b3931,_0x46373f[_0xbc58('0x4c')],config[_0xbc58('0x5f')]['recording'])[_0xbc58('0x24')](function(){return _0x46373f;});}return _0x46373f;}})['then'](function(_0x1ce0cd){if(_0x1ce0cd){if(!fs[_0xbc58('0x4e')](_0x1ce0cd[_0xbc58('0x4c')])){throw new db[(_0xbc58('0x60'))][(_0xbc58('0x50'))](_0xbc58('0x55'));}if(_0x1ce0cd[_0xbc58('0x61')]){return _0x4e5548[_0xbc58('0x51')](_0x1ce0cd[_0xbc58('0x4c')],_0x1ce0cd[_0xbc58('0x61')]+path['extname'](_0x1ce0cd[_0xbc58('0x4c')]),function(){if(_0x1bf477){fs['unlink'](_0x1ce0cd['value']);}});}else{return _0x4e5548['download'](_0x1ce0cd[_0xbc58('0x4c')],function(_0x359d0c){if(_0x1bf477){fs['unlink'](_0x1ce0cd[_0xbc58('0x4c')]);}});}}})[_0xbc58('0x44')](handleError(_0x4e5548,null));};exports[_0xbc58('0x62')]=function(_0x5372b4,_0x593590){return db[_0xbc58('0x2a')][_0xbc58('0x4b')]({'where':{'id':_0x5372b4['params']['id']}})[_0xbc58('0x24')](function(_0x3cf3de){if(_[_0xbc58('0x63')](_0x3cf3de)){throw new ReferenceError(_0xbc58('0x64'));}return _0x3cf3de;})[_0xbc58('0x24')](function(_0x2fba0b){var _0x37701a=_0x2fba0b[_0xbc58('0x4c')];logger['info'](_0xbc58('0x65'),_0x37701a);if(!_[_0xbc58('0x63')](_0x2fba0b[_0xbc58('0x4c')])&&fs[_0xbc58('0x4e')](_0x37701a)){logger[_0xbc58('0x66')](_0xbc58('0x67')+_0x37701a+_0xbc58('0x68'));fs[_0xbc58('0x69')](_0x37701a);}_0x37701a=_0x37701a+_0xbc58('0x6a');if(!_[_0xbc58('0x63')](_0x2fba0b[_0xbc58('0x4c')])&&fs[_0xbc58('0x4e')](_0x37701a)){logger[_0xbc58('0x66')](_0xbc58('0x67')+_0x37701a+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x37701a);}return _0x2fba0b;})[_0xbc58('0x24')](function(_0x4b7d25){if(!_0x4b7d25)throw new InternalError();return _0x4b7d25[_0xbc58('0x62')]();})[_0xbc58('0x24')](function(){_0x593590[_0xbc58('0x1a')](0xcc)[_0xbc58('0x19')]();})[_0xbc58('0x44')](handleError(_0x593590,null));};function getBucketslist(_0x2a25d3,_0x4635db,_0x46f4ba){return new Promise(function(_0x1d7b4e,_0x4d6a7f){var _0xd89bc7=new AWS['S3']({'accessKeyId':_0x4635db,'secretAccessKey':_0x2a25d3,'region':_0x46f4ba});_0xd89bc7[_0xbc58('0x6b')]({},function(_0x3a9c3d,_0x16e79f){if(_0x3a9c3d){return _0x4d6a7f(_0x3a9c3d);}else{return _0x1d7b4e(_0x16e79f);}});});}function createBucket(_0x4ff966,_0x2a017e,_0x4796b1,_0x3d90fe){return new Promise(function(_0x5ea2af,_0x351a1f){var _0x137a4a=new AWS['S3']({'accessKeyId':_0x2a017e,'secretAccessKey':_0x4ff966,'region':_0x4796b1});_0x137a4a[_0xbc58('0x6c')]({'Bucket':_0x3d90fe},function(_0x2aa29e,_0xe8009d){if(_0x2aa29e){return _0x351a1f(_0x2aa29e);}else{return _0x5ea2af(_0xe8009d);}});});}function uploadFile(_0x391c6f,_0x26da2c,_0x1d96e8,_0x18c5e4,_0x1e494b,_0xc1c16a){return new Promise(function(_0x23452b,_0x4286b3){var _0xc3951f=new AWS['S3']({'accessKeyId':_0x26da2c,'secretAccessKey':_0x391c6f,'region':_0x1d96e8});_0xc3951f[_0xbc58('0x6d')]({'Bucket':_0x18c5e4,'Key':_0x1e494b,'Body':_0xc1c16a},function(_0x36faf9,_0x12d2a5){if(_0x36faf9){return _0x4286b3(_0x36faf9);}else{return _0x23452b(_0x12d2a5);}});});}function startTranscribe(_0x45aa06,_0x372ac1,_0x1bd379,_0x165217,_0x3cff63,_0x592811){return new Promise(function(_0x19b064,_0x21c31e){var _0x37740c=new AWS[(_0xbc58('0x6e'))]({'accessKeyId':_0x372ac1,'secretAccessKey':_0x45aa06,'region':_0x1bd379});_0x37740c[_0xbc58('0x6f')]({'TranscriptionJobName':_0x165217,'LanguageCode':_0x3cff63,'Media':{'MediaFileUri':_0x592811}},function(_0x1217a7,_0x39ae6d){if(_0x1217a7){return _0x21c31e(_0x1217a7);}else{return _0x19b064(_0x39ae6d);}});});}function transcribe(_0x588d2c,_0x583543,_0x40ebd3,_0x3e67eb,_0x35447f,_0x2947db,_0x35e719){return new Promise(function(_0x3837b6,_0x3befb3){var _0x4d555c={};logger[_0xbc58('0x66')](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x588d2c,_0x35447f));return uploadFile(_0x583543,_0x40ebd3,_0x3e67eb,_0x35447f,path[_0xbc58('0x70')](_0x2947db),fs['readFileSync'](_0x2947db))[_0xbc58('0x24')](function(_0x1e0298){logger[_0xbc58('0x66')](util[_0xbc58('0x5e')](_0xbc58('0x71'),_0x588d2c,_0x35447f,_0x1e0298[_0xbc58('0x72')]));_0x4d555c[_0xbc58('0x73')]=_0x1e0298['Bucket'];_0x4d555c[_0xbc58('0x74')]=_0x1e0298[_0xbc58('0x72')];logger[_0xbc58('0x66')](util[_0xbc58('0x5e')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x588d2c));return startTranscribe(_0x583543,_0x40ebd3,_0x3e67eb,uuidv4(),_0x35e719,_0x1e0298[_0xbc58('0x72')]);})[_0xbc58('0x24')](function(_0x4b54d8){logger[_0xbc58('0x66')](util['format'](_0xbc58('0x75'),_0x588d2c,_0x4b54d8[_0xbc58('0x76')][_0xbc58('0x77')]));_0x4d555c[_0xbc58('0x78')]=_0x4b54d8['TranscriptionJob'][_0xbc58('0x77')];_0x4d555c[_0xbc58('0x79')]=_0x4b54d8[_0xbc58('0x76')][_0xbc58('0x7a')];return _0x3837b6(_0x4d555c);})['catch'](function(_0x4fa209){return _0x3befb3(_0x4fa209);});});}exports[_0xbc58('0x7b')]=function(_0x4ab472,_0x305330,_0x1ca9aa){var _0x349488;var _0x77f1ca;var _0x335c6e;var _0x190eeb=require(_0xbc58('0x59'));return db['VoiceRecording'][_0xbc58('0x7c')]({'where':{'id':_0x4ab472[_0xbc58('0x46')]['id']}})[_0xbc58('0x24')](function(_0xf0995a){if(_0xf0995a){var _0x1e4199=util[_0xbc58('0x5e')](_0xbc58('0x4d'),_0xf0995a[_0xbc58('0x4c')]);if(fs[_0xbc58('0x4e')](_0x1e4199)){cypher=!![];return _0x190eeb[_0xbc58('0x4f')](_0x1e4199,_0xf0995a[_0xbc58('0x4c')],config[_0xbc58('0x5f')][_0xbc58('0x7d')])['then'](function(){return _0xf0995a;});}return _0xf0995a;}})[_0xbc58('0x24')](function(_0x570d13){if(!_0x570d13){throw new db['Sequelize'][(_0xbc58('0x50'))](_0xbc58('0x7e'));}_0x77f1ca=_0x570d13;return db[_0xbc58('0x7f')][_0xbc58('0x7c')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x305330,null))['then'](function(_0x50b2e7){if(_0x50b2e7){_0x349488=_0x50b2e7;if(!_0x349488[_0xbc58('0x80')]||!_0x349488[_0xbc58('0x81')]||!_0x349488['transcribeRegion']||!_0x349488[_0xbc58('0x82')]||!_0x349488[_0xbc58('0x73')]){throw new db['Sequelize'][(_0xbc58('0x50'))]('Transcribe\x20not\x20configured');}if(_0x4ab472[_0xbc58('0x48')]['runSentiment']&&(!_0x349488[_0xbc58('0x83')]||!_0x349488[_0xbc58('0x84')]||!_0x349488[_0xbc58('0x85')]||!_0x349488[_0xbc58('0x82')]||!_0x349488[_0xbc58('0x73')])){throw new db[(_0xbc58('0x60'))][(_0xbc58('0x50'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xbc58('0x86')]['findOne']({'where':{'id':_0x349488[_0xbc58('0x81')]}});}})[_0xbc58('0x24')](function(_0x209a65){if(!_0x209a65){throw new db[(_0xbc58('0x60'))][(_0xbc58('0x50'))](_0xbc58('0x87'));}if(!_0x209a65[_0xbc58('0x88')]||!_0x209a65[_0xbc58('0x89')]){throw new db[(_0xbc58('0x60'))]['ValidationError'](_0xbc58('0x8a'));}_0x335c6e=_0x209a65;return getBucketslist(_0x335c6e[_0xbc58('0x88')],_0x335c6e[_0xbc58('0x89')],_0x349488[_0xbc58('0x8b')]);})[_0xbc58('0x24')](function(_0x3cdda1){if(_0x3cdda1&&_0x3cdda1[_0xbc58('0x8c')]){var _0x2a1c9f=_[_0xbc58('0x4b')](_0x3cdda1[_0xbc58('0x8c')],function(_0x52da73){return _0x52da73['Name']===_0x349488[_0xbc58('0x73')];});if(!_0x2a1c9f){logger['info'](util[_0xbc58('0x5e')](_0xbc58('0x8d'),_0x4ab472['params']['id'],_0x349488[_0xbc58('0x73')]));return createBucket(_0x335c6e[_0xbc58('0x88')],_0x335c6e['data2'],_0x349488[_0xbc58('0x8b')],_0x349488['bucket']);}logger['info'](util[_0xbc58('0x5e')](_0xbc58('0x8e'),_0x4ab472[_0xbc58('0x46')]['id'],_0x349488[_0xbc58('0x73')]));return;}})[_0xbc58('0x24')](function(_0x5a62b8){if(_0x77f1ca[_0xbc58('0x79')]===_0xbc58('0x8f')){return transcribe(_0x4ab472['params']['id'],_0x335c6e[_0xbc58('0x88')],_0x335c6e[_0xbc58('0x89')],_0x349488['transcribeRegion'],_0x349488[_0xbc58('0x73')],_0x77f1ca[_0xbc58('0x4c')],_0x349488['language']);}else{logger[_0xbc58('0x66')](util[_0xbc58('0x5e')](_0xbc58('0x90'),_0x4ab472[_0xbc58('0x46')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xbc58('0x24')](function(_0x2905b1){if(_0x2905b1){_0x2905b1[_0xbc58('0x91')]=_0x4ab472['body'][_0xbc58('0x92')];return _0x77f1ca[_0xbc58('0x93')](_0x2905b1);}})[_0xbc58('0x24')](respondWithResult(_0x305330,null))[_0xbc58('0x44')](handleError(_0x305330,null));};function writeFile(_0x30c332,_0x4bb0ec){return new Promise(function(_0x114811,_0x35e1f9){fs[_0xbc58('0x94')](_0x4bb0ec,_0x30c332,function(_0x19313f,_0x439dcf){if(_0x19313f){return _0x35e1f9(_0x19313f);}else{return _0x114811(_0x439dcf);}});});}exports['downloadTranscribe']=function(_0x4f8cd7,_0x52a2aa,_0xa2174b){return db[_0xbc58('0x2a')][_0xbc58('0x7c')]({'where':{'id':_0x4f8cd7[_0xbc58('0x46')]['id']}})[_0xbc58('0x24')](handleEntityNotFound(_0x52a2aa))['then'](function(_0x2a856e){if(_0x2a856e&&_0x2a856e[_0xbc58('0x95')]){var _0x32a372=_0x2a856e[_0xbc58('0x95')];var _0x7e82fa=config[_0xbc58('0x96')]+_0xbc58('0x97')+_0x2a856e['id']+'.txt';if(fs[_0xbc58('0x4e')](_0x7e82fa)){return _0x7e82fa;}return writeFile(_0x32a372,_0x7e82fa)[_0xbc58('0x24')](function(){return _0x7e82fa;});}else{throw new db[(_0xbc58('0x60'))][(_0xbc58('0x50'))](_0xbc58('0x98'));}})[_0xbc58('0x24')](function(_0x28e4ec){return _0x52a2aa[_0xbc58('0x51')](_0x28e4ec);})['catch'](handleError(_0x52a2aa));}; \ No newline at end of file +var _0x095e=['Voice\x20Recording\x20not\x20found','transcribeAccountId','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','data2','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','VoiceRecording','rawAttributes','type','key','model','differenceBy','map','format','keys','intersection','query','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','params','length','options','find','create','body','describe','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','download','extname','unlink','message','downloads','sequelize','MD5','col','token','$and','push','filename','isNil','Entity\x20not\x20found','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','listBuckets','createBucket','upload','startTranscriptionJob','[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','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','findOne'];(function(_0x5e4fba,_0x498d8e){var _0x5d26b4=function(_0x2b0743){while(--_0x2b0743){_0x5e4fba['push'](_0x5e4fba['shift']());}};_0x5d26b4(++_0x498d8e);}(_0x095e,0x1e6));var _0xe095=function(_0x41594b,_0x5eb350){_0x41594b=_0x41594b-0x0;var _0x46ac05=_0x095e[_0x41594b];return _0x46ac05;};'use strict';var emlformat=require(_0xe095('0x0'));var rimraf=require(_0xe095('0x1'));var zipdir=require(_0xe095('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe095('0x3'));var moment=require(_0xe095('0x4'));var BPromise=require(_0xe095('0x5'));var Mustache=require(_0xe095('0x6'));var util=require(_0xe095('0x7'));var path=require(_0xe095('0x8'));var sox=require(_0xe095('0x9'));var csv=require(_0xe095('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe095('0xb'));var _=require('lodash');var squel=require(_0xe095('0xc'));var crypto=require(_0xe095('0xd'));var jsforce=require(_0xe095('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe095('0xa'));var querystring=require(_0xe095('0xf'));var Papa=require(_0xe095('0x10'));var AWS=require('aws-sdk');var uuidv4=require(_0xe095('0x11'));var Redis=require('ioredis');var authService=require(_0xe095('0x12'));var qs=require(_0xe095('0x13'));var as=require(_0xe095('0x14'));var hardwareService=require(_0xe095('0x15'));var logger=require('../../config/logger')(_0xe095('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe095('0x17'));var db=require(_0xe095('0x18'))['db'];function respondWithStatusCode(_0x32fdbd,_0x591a72){_0x591a72=_0x591a72||0xcc;return function(_0x1e8741){if(_0x1e8741){return _0x32fdbd['sendStatus'](_0x591a72);}return _0x32fdbd[_0xe095('0x19')](_0x591a72)[_0xe095('0x1a')]();};}function respondWithResult(_0x4a3dea,_0x268523){_0x268523=_0x268523||0xc8;return function(_0x3eccbb){if(_0x3eccbb){return _0x4a3dea['status'](_0x268523)[_0xe095('0x1b')](_0x3eccbb);}};}function respondWithFilteredResult(_0x5c63f0,_0x9190a){return function(_0x37f063){if(_0x37f063){var _0x23b4f8=typeof _0x9190a['offset']===_0xe095('0x1c')&&typeof _0x9190a[_0xe095('0x1d')]==='undefined';var _0x58f93f=_0x37f063[_0xe095('0x1e')];var _0x4c604b=_0x23b4f8?0x0:_0x9190a[_0xe095('0x1f')];var _0x266d7c=_0x23b4f8?_0x37f063[_0xe095('0x1e')]:_0x9190a[_0xe095('0x1f')]+_0x9190a[_0xe095('0x1d')];var _0x44a588;if(_0x266d7c>=_0x58f93f){_0x266d7c=_0x58f93f;_0x44a588=0xc8;}else{_0x44a588=0xce;}_0x5c63f0[_0xe095('0x19')](_0x44a588);return _0x5c63f0['set'](_0xe095('0x20'),_0x4c604b+'-'+_0x266d7c+'/'+_0x58f93f)[_0xe095('0x1b')](_0x37f063);}return null;};}function patchUpdates(_0x1c6301){return function(_0x327256){try{jsonpatch[_0xe095('0x21')](_0x327256,_0x1c6301,!![]);}catch(_0x322c94){return BPromise['reject'](_0x322c94);}return _0x327256[_0xe095('0x22')]();};}function saveUpdates(_0x47f4ef,_0x542572){return function(_0x34a2a5){if(_0x34a2a5){return _0x34a2a5[_0xe095('0x23')](_0x47f4ef)[_0xe095('0x24')](function(_0x43d588){return _0x43d588;});}return null;};}function removeEntity(_0x4dcf7d,_0x882919){return function(_0x3e7050){if(_0x3e7050){return _0x3e7050[_0xe095('0x25')]()[_0xe095('0x24')](function(){_0x4dcf7d['status'](0xcc)[_0xe095('0x1a')]();});}};}function handleEntityNotFound(_0x13606c,_0x339a55){return function(_0x13349e){if(!_0x13349e){_0x13606c['sendStatus'](0x194);}return _0x13349e;};}function handleError(_0x19e802,_0x441f58){_0x441f58=_0x441f58||0x1f4;return function(_0x4cd882){logger[_0xe095('0x26')](_0x4cd882[_0xe095('0x27')]);if(_0x4cd882[_0xe095('0x28')]){delete _0x4cd882['name'];}_0x19e802[_0xe095('0x19')](_0x441f58)[_0xe095('0x29')](_0x4cd882);};}exports[_0xe095('0x2a')]=function(_0x545491,_0x3f9c2f){var _0x2c9148={},_0x58c29c={},_0x13e3da={'count':0x0,'rows':[]};var _0x420003=_['map'](db[_0xe095('0x2b')][_0xe095('0x2c')],function(_0x1946a8){return{'name':_0x1946a8['fieldName'],'type':_0x1946a8[_0xe095('0x2d')][_0xe095('0x2e')]};});_0x58c29c[_0xe095('0x2f')]=_[_0xe095('0x30')](_[_0xe095('0x31')](_0x420003,_0xe095('0x28')),[_0xe095('0x32')]);_0x58c29c['query']=_[_0xe095('0x33')](_0x545491['query']);_0x58c29c['filters']=_[_0xe095('0x34')](_0x58c29c[_0xe095('0x2f')],_0x58c29c[_0xe095('0x35')]);_0x2c9148[_0xe095('0x36')]=_[_0xe095('0x34')](_0x58c29c[_0xe095('0x2f')],qs[_0xe095('0x37')](_0x545491[_0xe095('0x35')][_0xe095('0x37')]));_0x2c9148['attributes']=_0x2c9148['attributes']['length']?_0x2c9148[_0xe095('0x36')]:_0x58c29c[_0xe095('0x2f')];if(!_0x545491['query'][_0xe095('0x38')]('nolimit')){_0x2c9148[_0xe095('0x1d')]=qs['limit'](_0x545491['query'][_0xe095('0x1d')]);_0x2c9148[_0xe095('0x1f')]=qs['offset'](_0x545491[_0xe095('0x35')][_0xe095('0x1f')]);}_0x2c9148[_0xe095('0x39')]=qs[_0xe095('0x3a')](_0x545491[_0xe095('0x35')]['sort']);_0x2c9148[_0xe095('0x3b')]=qs[_0xe095('0x3c')](_[_0xe095('0x3d')](_0x545491['query'],_0x58c29c['filters']),_0x420003);if(_0x545491['query']['filter']){_0x2c9148['where']=_[_0xe095('0x3e')](_0x2c9148[_0xe095('0x3b')],{'$or':_[_0xe095('0x31')](_0x420003,function(_0x395cbb){if(_0x395cbb[_0xe095('0x2d')]!==_0xe095('0x3f')){var _0x3f4410={};_0x3f4410[_0x395cbb[_0xe095('0x28')]]={'$like':'%'+_0x545491['query'][_0xe095('0x40')]+'%'};return _0x3f4410;}})});}_0x2c9148=_['merge']({},_0x2c9148,_0x545491['options']);var _0x464e87={'where':_0x2c9148[_0xe095('0x3b')]};return db[_0xe095('0x2b')][_0xe095('0x1e')](_0x464e87)[_0xe095('0x24')](function(_0x32ac02){_0x13e3da[_0xe095('0x1e')]=_0x32ac02;if(_0x545491['query'][_0xe095('0x41')]){_0x2c9148[_0xe095('0x42')]=[{'all':!![]}];}return db[_0xe095('0x2b')][_0xe095('0x43')](_0x2c9148);})['then'](function(_0x424af1){_0x13e3da[_0xe095('0x44')]=_0x424af1;return _0x13e3da;})[_0xe095('0x24')](respondWithFilteredResult(_0x3f9c2f,_0x2c9148))[_0xe095('0x45')](handleError(_0x3f9c2f,null));};exports['show']=function(_0x587ecb,_0x19c181){var _0x270962={'raw':![],'where':{'id':_0x587ecb[_0xe095('0x46')]['id']}},_0x296032={};_0x296032['model']=_[_0xe095('0x33')](db['VoiceRecording'][_0xe095('0x2c')]);_0x296032[_0xe095('0x35')]=_[_0xe095('0x33')](_0x587ecb[_0xe095('0x35')]);_0x296032['filters']=_[_0xe095('0x34')](_0x296032[_0xe095('0x2f')],_0x296032[_0xe095('0x35')]);_0x270962[_0xe095('0x36')]=_[_0xe095('0x34')](_0x296032['model'],qs['fields'](_0x587ecb[_0xe095('0x35')][_0xe095('0x37')]));_0x270962[_0xe095('0x36')]=_0x270962['attributes'][_0xe095('0x47')]?_0x270962['attributes']:_0x296032[_0xe095('0x2f')];if(_0x587ecb[_0xe095('0x35')][_0xe095('0x41')]){_0x270962[_0xe095('0x42')]=[{'all':!![]}];}_0x270962=_[_0xe095('0x3e')]({},_0x270962,_0x587ecb[_0xe095('0x48')]);return db[_0xe095('0x2b')][_0xe095('0x49')](_0x270962)['then'](handleEntityNotFound(_0x19c181,null))['then'](respondWithResult(_0x19c181,null))[_0xe095('0x45')](handleError(_0x19c181,null));};exports[_0xe095('0x4a')]=function(_0x3eba7a,_0x2d6530){return db[_0xe095('0x2b')][_0xe095('0x4a')](_0x3eba7a[_0xe095('0x4b')],{})['then'](respondWithResult(_0x2d6530,0xc9))['catch'](handleError(_0x2d6530,null));};exports[_0xe095('0x23')]=function(_0x42d92f,_0x3becba){if(_0x42d92f[_0xe095('0x4b')]['id']){delete _0x42d92f[_0xe095('0x4b')]['id'];}return db['VoiceRecording']['find']({'where':{'id':_0x42d92f[_0xe095('0x46')]['id']}})['then'](handleEntityNotFound(_0x3becba,null))['then'](saveUpdates(_0x42d92f['body'],null))[_0xe095('0x24')](respondWithResult(_0x3becba,null))[_0xe095('0x45')](handleError(_0x3becba,null));};exports[_0xe095('0x4c')]=function(_0x2f3ee5,_0x13477c){return db[_0xe095('0x2b')][_0xe095('0x4c')]()[_0xe095('0x24')](respondWithResult(_0x13477c,null))['catch'](handleError(_0x13477c,null));};exports['download']=function(_0x50e58a,_0x59593b,_0x4fc926){var _0x284c93=require(_0xe095('0x4d'));var _0x4f57e1=![];var _0x159a05={};if(_0x50e58a[_0xe095('0x35')][_0xe095('0x2d')]&&_0x50e58a[_0xe095('0x35')][_0xe095('0x2d')]===_0xe095('0x4e')){_0x159a05[_0xe095('0x4e')]=_0x50e58a[_0xe095('0x46')]['id'];}else{_0x159a05['id']=_0x50e58a[_0xe095('0x46')]['id'];}return db[_0xe095('0x2b')][_0xe095('0x49')]({'where':_0x159a05,'attributes':['id',_0xe095('0x4f')],'raw':!![]})[_0xe095('0x24')](handleEntityNotFound(_0x59593b,null))['then'](function(_0x3304ce){if(_0x3304ce){var _0x2bf702=_0x3304ce[_0xe095('0x4f')];var _0x3d0e03=util[_0xe095('0x32')](_0xe095('0x50'),_0x2bf702);if(fs[_0xe095('0x51')](_0x3d0e03)){_0x4f57e1=!![];return _0x284c93[_0xe095('0x52')](_0x3d0e03,_0x2bf702,config[_0xe095('0x53')][_0xe095('0x54')])[_0xe095('0x24')](function(){return _0x3304ce;});}return _0x3304ce;}})['then'](function(_0x347d49){if(_0x347d49){var _0x1b4631=_0x347d49['value'];if(!fs['existsSync'](_0x1b4631)){throw new db[(_0xe095('0x55'))][(_0xe095('0x56'))](_0xe095('0x57'));}if(_0x347d49['filename']){return _0x59593b[_0xe095('0x58')](_0x1b4631,_0x347d49['filename']+path[_0xe095('0x59')](_0x1b4631),function(){if(_0x4f57e1){fs['unlink'](_0x1b4631);}});}else{return _0x59593b[_0xe095('0x58')](_0x1b4631,function(_0x12e9cc){if(_0x4f57e1){fs[_0xe095('0x5a')](_0x1b4631);}});}}})['catch'](function(_0x2d391d){if(_0x2d391d[_0xe095('0x5b')]===_0xe095('0x57')){_0x59593b[_0xe095('0x19')](0x194)[_0xe095('0x29')]('Not\x20found');}else{return handleError(_0x59593b,null);}});};exports[_0xe095('0x5c')]=function(_0x37a0f4,_0x34593d,_0x4afe3a){var _0x5834b4=require(_0xe095('0x4d'));var _0x237857=![];var _0x3b9279={'$and':[db[_0xe095('0x5d')][_0xe095('0x3b')](db[_0xe095('0x5d')]['fn'](_0xe095('0x5e'),db['sequelize'][_0xe095('0x5f')](_0xe095('0x4e'))),_0x37a0f4['query'][_0xe095('0x60')])]};if(_0x37a0f4[_0xe095('0x35')][_0xe095('0x2d')]&&_0x37a0f4['query']['type']===_0xe095('0x4e')){_0x3b9279[_0xe095('0x61')][_0xe095('0x62')]({'uniqueid':_0x37a0f4[_0xe095('0x46')]['id']});}else{_0x3b9279['$and'][_0xe095('0x62')]({'id':_0x37a0f4[_0xe095('0x46')]['id']});}return db[_0xe095('0x2b')][_0xe095('0x49')]({'where':_0x3b9279,'attributes':['id','value'],'raw':!![]})[_0xe095('0x24')](handleEntityNotFound(_0x34593d,null))[_0xe095('0x24')](function(_0x1f3b87){if(_0x1f3b87){var _0x24c616=util[_0xe095('0x32')]('%s.cypher',_0x1f3b87[_0xe095('0x4f')]);if(fs[_0xe095('0x51')](_0x24c616)){_0x237857=!![];return _0x5834b4['decryptFile'](_0x24c616,_0x1f3b87[_0xe095('0x4f')],config[_0xe095('0x53')]['recording'])[_0xe095('0x24')](function(){return _0x1f3b87;});}return _0x1f3b87;}})[_0xe095('0x24')](function(_0x369469){if(_0x369469){if(!fs['existsSync'](_0x369469[_0xe095('0x4f')])){throw new db[(_0xe095('0x55'))][(_0xe095('0x56'))](_0xe095('0x57'));}if(_0x369469[_0xe095('0x63')]){return _0x34593d[_0xe095('0x58')](_0x369469['value'],_0x369469[_0xe095('0x63')]+path[_0xe095('0x59')](_0x369469[_0xe095('0x4f')]),function(){if(_0x237857){fs[_0xe095('0x5a')](_0x369469[_0xe095('0x4f')]);}});}else{return _0x34593d[_0xe095('0x58')](_0x369469[_0xe095('0x4f')],function(_0x23df3c){if(_0x237857){fs['unlink'](_0x369469[_0xe095('0x4f')]);}});}}})[_0xe095('0x45')](handleError(_0x34593d,null));};exports[_0xe095('0x25')]=function(_0x1e1d98,_0x31904b){return db[_0xe095('0x2b')][_0xe095('0x49')]({'where':{'id':_0x1e1d98['params']['id']}})[_0xe095('0x24')](function(_0x200ea6){if(_[_0xe095('0x64')](_0x200ea6)){throw new ReferenceError(_0xe095('0x65'));}return _0x200ea6;})[_0xe095('0x24')](function(_0xef6a61){var _0xaf2612=_0xef6a61[_0xe095('0x4f')];logger[_0xe095('0x66')]('cancellazione\x20fisica\x20documento\x20%s',_0xaf2612);if(!_[_0xe095('0x64')](_0xef6a61[_0xe095('0x4f')])&&fs['existsSync'](_0xaf2612)){logger['info']('File:\x20\x22'+_0xaf2612+_0xe095('0x67'));fs[_0xe095('0x68')](_0xaf2612);}_0xaf2612=_0xaf2612+_0xe095('0x69');if(!_[_0xe095('0x64')](_0xef6a61[_0xe095('0x4f')])&&fs['existsSync'](_0xaf2612)){logger[_0xe095('0x66')](_0xe095('0x6a')+_0xaf2612+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe095('0x68')](_0xaf2612);}return _0xef6a61;})[_0xe095('0x24')](function(_0x3adb2a){if(!_0x3adb2a)throw new InternalError();return _0x3adb2a[_0xe095('0x25')]();})[_0xe095('0x24')](function(){_0x31904b[_0xe095('0x19')](0xcc)[_0xe095('0x1a')]();})['catch'](handleError(_0x31904b,null));};function getBucketslist(_0x28dcbe,_0x2de452,_0x5f0cd4){return new Promise(function(_0x44f70d,_0x124c6a){var _0x1b4d9b=new AWS['S3']({'accessKeyId':_0x2de452,'secretAccessKey':_0x28dcbe,'region':_0x5f0cd4});_0x1b4d9b[_0xe095('0x6b')]({},function(_0x581173,_0x506c6a){if(_0x581173){return _0x124c6a(_0x581173);}else{return _0x44f70d(_0x506c6a);}});});}function createBucket(_0x3c7ecd,_0x2366a8,_0x12a9c7,_0x4faaa4){return new Promise(function(_0x7e80c,_0x5ecfa0){var _0x342cee=new AWS['S3']({'accessKeyId':_0x2366a8,'secretAccessKey':_0x3c7ecd,'region':_0x12a9c7});_0x342cee[_0xe095('0x6c')]({'Bucket':_0x4faaa4},function(_0x41d6d2,_0x93a25d){if(_0x41d6d2){return _0x5ecfa0(_0x41d6d2);}else{return _0x7e80c(_0x93a25d);}});});}function uploadFile(_0xa13c20,_0x220416,_0x17b4bf,_0x219510,_0x196de5,_0x2a2368){return new Promise(function(_0x2e3af9,_0x52bd18){var _0x203909=new AWS['S3']({'accessKeyId':_0x220416,'secretAccessKey':_0xa13c20,'region':_0x17b4bf});_0x203909[_0xe095('0x6d')]({'Bucket':_0x219510,'Key':_0x196de5,'Body':_0x2a2368},function(_0x34e091,_0x688d5d){if(_0x34e091){return _0x52bd18(_0x34e091);}else{return _0x2e3af9(_0x688d5d);}});});}function startTranscribe(_0x35adb1,_0x295060,_0x5aa5f7,_0x502327,_0x1e9457,_0x3679d5){return new Promise(function(_0x3154aa,_0x28c925){var _0xb576a0=new AWS['TranscribeService']({'accessKeyId':_0x295060,'secretAccessKey':_0x35adb1,'region':_0x5aa5f7});_0xb576a0[_0xe095('0x6e')]({'TranscriptionJobName':_0x502327,'LanguageCode':_0x1e9457,'Media':{'MediaFileUri':_0x3679d5}},function(_0x259109,_0x33aceb){if(_0x259109){return _0x28c925(_0x259109);}else{return _0x3154aa(_0x33aceb);}});});}function transcribe(_0x23378f,_0x538037,_0x192531,_0x17d2b7,_0x5c8a0c,_0x2cfbb5,_0xf16855){return new Promise(function(_0x13f70f,_0x4673c1){var _0x5190c3={};logger[_0xe095('0x66')](util['format'](_0xe095('0x6f'),_0x23378f,_0x5c8a0c));return uploadFile(_0x538037,_0x192531,_0x17d2b7,_0x5c8a0c,path[_0xe095('0x70')](_0x2cfbb5),fs[_0xe095('0x71')](_0x2cfbb5))[_0xe095('0x24')](function(_0x5d7385){logger[_0xe095('0x66')](util[_0xe095('0x32')](_0xe095('0x72'),_0x23378f,_0x5c8a0c,_0x5d7385[_0xe095('0x73')]));_0x5190c3[_0xe095('0x74')]=_0x5d7385[_0xe095('0x75')];_0x5190c3[_0xe095('0x76')]=_0x5d7385[_0xe095('0x73')];logger[_0xe095('0x66')](util[_0xe095('0x32')](_0xe095('0x77'),_0x23378f));return startTranscribe(_0x538037,_0x192531,_0x17d2b7,uuidv4(),_0xf16855,_0x5d7385[_0xe095('0x73')]);})['then'](function(_0x2d67c5){logger[_0xe095('0x66')](util[_0xe095('0x32')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x23378f,_0x2d67c5[_0xe095('0x78')][_0xe095('0x79')]));_0x5190c3[_0xe095('0x7a')]=_0x2d67c5['TranscriptionJob']['TranscriptionJobName'];_0x5190c3[_0xe095('0x7b')]=_0x2d67c5['TranscriptionJob'][_0xe095('0x7c')];return _0x13f70f(_0x5190c3);})[_0xe095('0x45')](function(_0x5c7c2a){return _0x4673c1(_0x5c7c2a);});});}exports['runTranscribe']=function(_0x543f04,_0x194909,_0x31b90e){var _0x743189;var _0x53cfca;var _0x5dfe08;var _0x3d87ad=require(_0xe095('0x4d'));return db['VoiceRecording'][_0xe095('0x7d')]({'where':{'id':_0x543f04[_0xe095('0x46')]['id']}})[_0xe095('0x24')](function(_0x31a625){if(_0x31a625){var _0x11390d=util[_0xe095('0x32')](_0xe095('0x50'),_0x31a625['value']);if(fs[_0xe095('0x51')](_0x11390d)){cypher=!![];return _0x3d87ad[_0xe095('0x52')](_0x11390d,_0x31a625['value'],config[_0xe095('0x53')][_0xe095('0x54')])[_0xe095('0x24')](function(){return _0x31a625;});}return _0x31a625;}})['then'](function(_0x12f176){if(!_0x12f176){throw new db[(_0xe095('0x55'))][(_0xe095('0x56'))](_0xe095('0x7e'));}_0x53cfca=_0x12f176;return db['Setting'][_0xe095('0x7d')]({'where':{'id':0x1}});})[_0xe095('0x24')](handleEntityNotFound(_0x194909,null))['then'](function(_0x57e213){if(_0x57e213){_0x743189=_0x57e213;if(!_0x743189['transcribe']||!_0x743189[_0xe095('0x7f')]||!_0x743189['transcribeRegion']||!_0x743189[_0xe095('0x80')]||!_0x743189[_0xe095('0x74')]){throw new db['Sequelize'][(_0xe095('0x56'))](_0xe095('0x81'));}if(_0x543f04[_0xe095('0x4b')][_0xe095('0x82')]&&(!_0x743189[_0xe095('0x83')]||!_0x743189['sentimentAccountId']||!_0x743189[_0xe095('0x84')]||!_0x743189['language']||!_0x743189[_0xe095('0x74')])){throw new db[(_0xe095('0x55'))]['ValidationError'](_0xe095('0x85'));}return db[_0xe095('0x86')]['findOne']({'where':{'id':_0x743189[_0xe095('0x7f')]}});}})[_0xe095('0x24')](function(_0x2be3c9){if(!_0x2be3c9){throw new db[(_0xe095('0x55'))][(_0xe095('0x56'))](_0xe095('0x87'));}if(!_0x2be3c9[_0xe095('0x88')]||!_0x2be3c9['data2']){throw new db[(_0xe095('0x55'))][(_0xe095('0x56'))](_0xe095('0x89'));}_0x5dfe08=_0x2be3c9;return getBucketslist(_0x5dfe08[_0xe095('0x88')],_0x5dfe08['data2'],_0x743189[_0xe095('0x8a')]);})[_0xe095('0x24')](function(_0x238ea3){if(_0x238ea3&&_0x238ea3[_0xe095('0x8b')]){var _0x375d53=_[_0xe095('0x49')](_0x238ea3[_0xe095('0x8b')],function(_0x32024f){return _0x32024f[_0xe095('0x8c')]===_0x743189['bucket'];});if(!_0x375d53){logger[_0xe095('0x66')](util['format'](_0xe095('0x8d'),_0x543f04['params']['id'],_0x743189['bucket']));return createBucket(_0x5dfe08[_0xe095('0x88')],_0x5dfe08['data2'],_0x743189[_0xe095('0x8a')],_0x743189[_0xe095('0x74')]);}logger['info'](util[_0xe095('0x32')](_0xe095('0x8e'),_0x543f04[_0xe095('0x46')]['id'],_0x743189['bucket']));return;}})[_0xe095('0x24')](function(_0x3666fe){if(_0x53cfca[_0xe095('0x7b')]===_0xe095('0x8f')){return transcribe(_0x543f04['params']['id'],_0x5dfe08[_0xe095('0x88')],_0x5dfe08[_0xe095('0x90')],_0x743189['transcribeRegion'],_0x743189['bucket'],_0x53cfca[_0xe095('0x4f')],_0x743189[_0xe095('0x80')]);}else{logger[_0xe095('0x66')](util[_0xe095('0x32')](_0xe095('0x91'),_0x543f04['params']['id']));return{'transcribeStatus':_0xe095('0x92')};}})[_0xe095('0x24')](function(_0x500e91){if(_0x500e91){_0x500e91[_0xe095('0x93')]=_0x543f04[_0xe095('0x4b')][_0xe095('0x82')];return _0x53cfca[_0xe095('0x94')](_0x500e91);}})[_0xe095('0x24')](respondWithResult(_0x194909,null))[_0xe095('0x45')](handleError(_0x194909,null));};function writeFile(_0x228eb2,_0xff29f8){return new Promise(function(_0x2724ed,_0x196e9f){fs[_0xe095('0x95')](_0xff29f8,_0x228eb2,function(_0x3f1ea7,_0x452b85){if(_0x3f1ea7){return _0x196e9f(_0x3f1ea7);}else{return _0x2724ed(_0x452b85);}});});}exports['downloadTranscribe']=function(_0x3e78e9,_0x350ccb,_0x2803ed){return db[_0xe095('0x2b')][_0xe095('0x7d')]({'where':{'id':_0x3e78e9[_0xe095('0x46')]['id']}})[_0xe095('0x24')](handleEntityNotFound(_0x350ccb))[_0xe095('0x24')](function(_0xa24235){if(_0xa24235&&_0xa24235[_0xe095('0x96')]){var _0x317c13=_0xa24235['fileText'];var _0x180f8b=config['root']+_0xe095('0x97')+_0xa24235['id']+_0xe095('0x98');if(fs['existsSync'](_0x180f8b)){return _0x180f8b;}return writeFile(_0x317c13,_0x180f8b)['then'](function(){return _0x180f8b;});}else{throw new db[(_0xe095('0x55'))][(_0xe095('0x56'))]('Transcript\x20not\x20available');}})[_0xe095('0x24')](function(_0x138b7b){return _0x350ccb[_0xe095('0x58')](_0x138b7b);})[_0xe095('0x45')](handleError(_0x350ccb));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index adbe9b7..7424a99 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 _0x2fda=['./voiceRecording.attributes','define','VoiceRecording','voice_recordings','uniqueid'];(function(_0x3d5a82,_0x162257){var _0x498a53=function(_0x10a1ba){while(--_0x10a1ba){_0x3d5a82['push'](_0x3d5a82['shift']());}};_0x498a53(++_0x162257);}(_0x2fda,0x186));var _0xa2fd=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x2fda[_0x29b609];return _0x54c952;};'use strict';var attributes=require(_0xa2fd('0x0'));module['exports']=function(_0x5bfb50,_0x2a1c31){return _0x5bfb50[_0xa2fd('0x1')](_0xa2fd('0x2'),attributes,{'tableName':_0xa2fd('0x3'),'paranoid':![],'indexes':[{'name':_0xa2fd('0x4'),'fields':['uniqueid']},{'name':'transcribeStatus','fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf323=['uniqueid','transcribeStatus','VoiceRecording','voice_recordings'];(function(_0x2859f2,_0x1e3102){var _0x4974cd=function(_0x13ec65){while(--_0x13ec65){_0x2859f2['push'](_0x2859f2['shift']());}};_0x4974cd(++_0x1e3102);}(_0xf323,0x1c6));var _0x3f32=function(_0x3918d4,_0x2faa75){_0x3918d4=_0x3918d4-0x0;var _0x59f74e=_0xf323[_0x3918d4];return _0x59f74e;};'use strict';var attributes=require('./voiceRecording.attributes');module['exports']=function(_0x248da8,_0x11ce0a){return _0x248da8['define'](_0x3f32('0x0'),attributes,{'tableName':_0x3f32('0x1'),'paranoid':![],'indexes':[{'name':_0x3f32('0x2'),'fields':[_0x3f32('0x2')]},{'name':_0x3f32('0x3'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index d95e103..d8b69b4 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 _0x25e7=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','callRecordingEncryption','existsSync','format','%s.cypher','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','stringify','CreateVoiceRecording','lodash','util','moment'];(function(_0x2d91c6,_0x10ae0e){var _0x3a8d19=function(_0x27a3ce){while(--_0x27a3ce){_0x2d91c6['push'](_0x2d91c6['shift']());}};_0x3a8d19(++_0x10ae0e);}(_0x25e7,0x1d6));var _0x725e=function(_0x3509d8,_0x5074b5){_0x3509d8=_0x3509d8-0x0;var _0x4dcedb=_0x25e7[_0x3509d8];return _0x4dcedb;};'use strict';var _=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var moment=require(_0x725e('0x2'));var BPromise=require(_0x725e('0x3'));var rs=require(_0x725e('0x4'));var fs=require('fs');var Redis=require(_0x725e('0x5'));var db=require(_0x725e('0x6'))['db'];var utils=require(_0x725e('0x7'));var logger=require(_0x725e('0x8'))(_0x725e('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x725e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x481316,_0x111a50,_0x192c27){return new BPromise(function(_0x216b33,_0x67de0c){return client[_0x725e('0xb')](_0x481316,_0x192c27)[_0x725e('0xc')](function(_0x39858a){logger[_0x725e('0xd')](_0x725e('0xe'),_0x111a50,_0x725e('0xf'));logger[_0x725e('0x10')](_0x725e('0x11'),_0x111a50,'request\x20sent',JSON['stringify'](_0x39858a));if(_0x39858a[_0x725e('0x12')]){if(_0x39858a[_0x725e('0x12')]['code']===0x1f4){logger['error'](_0x725e('0xe'),_0x111a50,_0x39858a[_0x725e('0x12')]['message']);return _0x67de0c(_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);}logger[_0x725e('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x111a50,_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);return _0x216b33(_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);}else{logger[_0x725e('0xd')](_0x725e('0xe'),_0x111a50,'request\x20sent');_0x216b33(_0x39858a[_0x725e('0x14')][_0x725e('0x13')]);}})[_0x725e('0x15')](function(_0x54ac0f){logger[_0x725e('0x12')](_0x725e('0xe'),_0x111a50,_0x54ac0f);_0x67de0c(_0x54ac0f);});});}exports[_0x725e('0x16')]=function(_0x397e33){var _0x268438=this;return new Promise(function(_0x2811e7,_0x528e7d){return db[_0x725e('0x17')][_0x725e('0x18')](_0x397e33[_0x725e('0x19')],{'raw':_0x397e33[_0x725e('0x1a')]?_0x397e33[_0x725e('0x1a')][_0x725e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x397e33['options']?_0x397e33[_0x725e('0x1a')][_0x725e('0x1c')]||null:null,'attributes':_0x397e33[_0x725e('0x1a')]?_0x397e33[_0x725e('0x1a')][_0x725e('0x1d')]||null:null,'limit':_0x397e33[_0x725e('0x1a')]?_0x397e33[_0x725e('0x1a')][_0x725e('0x1e')]||null:null})[_0x725e('0xc')](function(_0x5c33c1){logger[_0x725e('0xd')](_0x725e('0x16'),_0x397e33);logger[_0x725e('0x10')](_0x725e('0x16'),_0x397e33,JSON['stringify'](_0x5c33c1));_0x2811e7(_0x5c33c1);})[_0x725e('0x15')](function(_0x5268c8){logger['error']('UpdateVoiceRecording',_0x5268c8[_0x725e('0x13')],_0x397e33);_0x528e7d(_0x268438[_0x725e('0x12')](0x1f4,_0x5268c8[_0x725e('0x13')]));});});};exports['CreateVoiceRecording']=function(_0xab6cfd){var _0x8a138f=this;return new Promise(function(_0x5a5bef,_0x14e9e0){var _0x339a58=require('../../components/encryptor');var _0x378ace;return db['Setting']['findOne']({'attributes':['id',_0x725e('0x1f')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x3b42bd){_0x378ace=_0x3b42bd;return db['VoiceRecording']['create'](_0xab6cfd[_0x725e('0x19')]);})[_0x725e('0xc')](function(_0x33fe34){if(_0x378ace['callRecordingEncryption']&&fs[_0x725e('0x20')](_0x33fe34['value'])){var _0x85d29c=util[_0x725e('0x21')](_0x725e('0x22'),_0x33fe34[_0x725e('0x23')]);return _0x339a58[_0x725e('0x24')](_0x33fe34[_0x725e('0x23')],_0x85d29c,config[_0x725e('0x25')][_0x725e('0x26')])[_0x725e('0xc')](function(){fs[_0x725e('0x27')](_0x33fe34[_0x725e('0x23')]);logger['info'](_0x725e('0x28'));return _0x33fe34;});}return _0x33fe34;})[_0x725e('0xc')](function(_0x5d3258){logger[_0x725e('0xd')]('CreateVoiceRecording',_0xab6cfd);logger[_0x725e('0x10')]('CreateVoiceRecording',_0xab6cfd,JSON[_0x725e('0x29')](_0x5d3258));_0x5a5bef(_0x5d3258);})[_0x725e('0x15')](function(_0x1f2898){logger[_0x725e('0x12')](_0x725e('0x2a'),_0x1f2898[_0x725e('0x13')],_0xab6cfd);_0x14e9e0(_0x8a138f['error'](0x1f4,_0x1f2898['message']));});});}; \ No newline at end of file +var _0x5430=['info','request\x20sent','debug','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','result','UpdateVoiceRecording','VoiceRecording','options','raw','limit','catch','CreateVoiceRecording','../../components/encryptor','findOne','callRecordingEncryption','create','body','existsSync','format','%s.cypher','value','encryptFile','secrets','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x5e667a,_0x167797){var _0x1492ad=function(_0x16c782){while(--_0x16c782){_0x5e667a['push'](_0x5e667a['shift']());}};_0x1492ad(++_0x167797);}(_0x5430,0x10c));var _0x0543=function(_0x5c3b92,_0x55745b){_0x5c3b92=_0x5c3b92-0x0;var _0x57233b=_0x5430[_0x5c3b92];return _0x57233b;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var moment=require(_0x0543('0x2'));var BPromise=require(_0x0543('0x3'));var rs=require(_0x0543('0x4'));var fs=require('fs');var Redis=require(_0x0543('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0543('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0543('0x7'));var client=jayson[_0x0543('0x8')][_0x0543('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x319568,_0x46bca7,_0x5ac352){return new BPromise(function(_0x372974,_0x7b8280){return client[_0x0543('0xa')](_0x319568,_0x5ac352)[_0x0543('0xb')](function(_0x2fb723){logger[_0x0543('0xc')]('VoiceRecording,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'));logger[_0x0543('0xe')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'),JSON[_0x0543('0xf')](_0x2fb723));if(_0x2fb723[_0x0543('0x10')]){if(_0x2fb723[_0x0543('0x10')][_0x0543('0x11')]===0x1f4){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x7b8280(_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);}logger[_0x0543('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x372974(_0x2fb723['error']['message']);}else{logger[_0x0543('0xc')](_0x0543('0x12'),_0x46bca7,_0x0543('0xd'));_0x372974(_0x2fb723[_0x0543('0x14')][_0x0543('0x13')]);}})['catch'](function(_0xe69a3d){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0xe69a3d);_0x7b8280(_0xe69a3d);});});}exports[_0x0543('0x15')]=function(_0x20b396){var _0x285080=this;return new Promise(function(_0x577cf0,_0x5eb03e){return db[_0x0543('0x16')]['update'](_0x20b396['body'],{'raw':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')][_0x0543('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20b396['options']?_0x20b396[_0x0543('0x17')]['where']||null:null,'attributes':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')]['attributes']||null:null,'limit':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')][_0x0543('0x19')]||null:null})[_0x0543('0xb')](function(_0x37347e){logger[_0x0543('0xc')]('UpdateVoiceRecording',_0x20b396);logger['debug']('UpdateVoiceRecording',_0x20b396,JSON[_0x0543('0xf')](_0x37347e));_0x577cf0(_0x37347e);})[_0x0543('0x1a')](function(_0x15ebeb){logger[_0x0543('0x10')](_0x0543('0x15'),_0x15ebeb[_0x0543('0x13')],_0x20b396);_0x5eb03e(_0x285080[_0x0543('0x10')](0x1f4,_0x15ebeb[_0x0543('0x13')]));});});};exports[_0x0543('0x1b')]=function(_0xf1eccf){var _0x40a261=this;return new Promise(function(_0x21fc63,_0x547a88){var _0x25e6f1=require(_0x0543('0x1c'));var _0x30ad9e;return db['Setting'][_0x0543('0x1d')]({'attributes':['id',_0x0543('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0543('0xb')](function(_0x10b881){_0x30ad9e=_0x10b881;return db['VoiceRecording'][_0x0543('0x1f')](_0xf1eccf[_0x0543('0x20')]);})['then'](function(_0x576084){if(_0x30ad9e[_0x0543('0x1e')]&&fs[_0x0543('0x21')](_0x576084['value'])){var _0x3b879b=util[_0x0543('0x22')](_0x0543('0x23'),_0x576084[_0x0543('0x24')]);return _0x25e6f1[_0x0543('0x25')](_0x576084[_0x0543('0x24')],_0x3b879b,config[_0x0543('0x26')]['recording'])[_0x0543('0xb')](function(){fs['unlink'](_0x576084[_0x0543('0x24')]);logger[_0x0543('0xc')](_0x0543('0x27'));return _0x576084;});}return _0x576084;})[_0x0543('0xb')](function(_0x28307f){logger['info'](_0x0543('0x1b'),_0xf1eccf);logger['debug'](_0x0543('0x1b'),_0xf1eccf,JSON[_0x0543('0xf')](_0x28307f));_0x21fc63(_0x28307f);})[_0x0543('0x1a')](function(_0x327027){logger['error'](_0x0543('0x1b'),_0x327027['message'],_0xf1eccf);_0x547a88(_0x40a261[_0x0543('0x10')](0x1f4,_0x327027[_0x0543('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 74ab5e2..158df79 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 _0x5f20=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','destroy','exports','util','path','express','fs-extra','../../components/auth/service'];(function(_0x1d57f0,_0x45191a){var _0x2c2b60=function(_0x29bcdc){while(--_0x29bcdc){_0x1d57f0['push'](_0x1d57f0['shift']());}};_0x2c2b60(++_0x45191a);}(_0x5f20,0x93));var _0x05f2=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x5f20[_0x3c8e9a];return _0x2d4c57;};'use strict';var multer=require('multer');var util=require(_0x05f2('0x0'));var path=require(_0x05f2('0x1'));var timeout=require('connect-timeout');var express=require(_0x05f2('0x2'));var router=express['Router']();var fs_extra=require(_0x05f2('0x3'));var auth=require(_0x05f2('0x4'));var interaction=require(_0x05f2('0x5'));var config=require(_0x05f2('0x6'));var controller=require('./voiceTransferReport.controller');router[_0x05f2('0x7')]('/',auth[_0x05f2('0x8')](),controller[_0x05f2('0x9')]);router['get']('/describe',auth[_0x05f2('0x8')](),controller[_0x05f2('0xa')]);router['get'](_0x05f2('0xb'),auth[_0x05f2('0x8')](),controller[_0x05f2('0xc')]);router[_0x05f2('0xd')]('/',auth[_0x05f2('0x8')](),controller[_0x05f2('0xe')]);router[_0x05f2('0xf')]('/:id',auth[_0x05f2('0x8')](),controller[_0x05f2('0x10')]);router['delete'](_0x05f2('0xb'),auth['isAuthenticated'](),controller[_0x05f2('0x11')]);module[_0x05f2('0x12')]=router; \ No newline at end of file +var _0x3de7=['isAuthenticated','index','/describe','describe','post','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get'];(function(_0x15adad,_0x5afad5){var _0x16165c=function(_0x19caeb){while(--_0x19caeb){_0x15adad['push'](_0x15adad['shift']());}};_0x16165c(++_0x5afad5);}(_0x3de7,0xb5));var _0x73de=function(_0x4b3d88,_0x49a095){_0x4b3d88=_0x4b3d88-0x0;var _0x11dbf5=_0x3de7[_0x4b3d88];return _0x11dbf5;};'use strict';var multer=require('multer');var util=require(_0x73de('0x0'));var path=require('path');var timeout=require(_0x73de('0x1'));var express=require(_0x73de('0x2'));var router=express[_0x73de('0x3')]();var fs_extra=require(_0x73de('0x4'));var auth=require(_0x73de('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x73de('0x6'));var controller=require(_0x73de('0x7'));router[_0x73de('0x8')]('/',auth[_0x73de('0x9')](),controller[_0x73de('0xa')]);router[_0x73de('0x8')](_0x73de('0xb'),auth['isAuthenticated'](),controller[_0x73de('0xc')]);router[_0x73de('0x8')]('/:id',auth[_0x73de('0x9')](),controller['show']);router[_0x73de('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x73de('0xe')]('/:id',auth[_0x73de('0x9')](),controller[_0x73de('0xf')]);router[_0x73de('0x10')]('/:id',auth[_0x73de('0x9')](),controller[_0x73de('0x11')]);module[_0x73de('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 3256b2c..4fcd39f 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 _0x9e32=['attended','STRING','Yes','moment','exports','ENUM'];(function(_0x30b473,_0x5754b9){var _0x11b65e=function(_0x40bb99){while(--_0x40bb99){_0x30b473['push'](_0x30b473['shift']());}};_0x11b65e(++_0x5754b9);}(_0x9e32,0xb7));var _0x29e3=function(_0x73a84b,_0x23d3bb){_0x73a84b=_0x73a84b-0x0;var _0x9e2a66=_0x9e32[_0x73a84b];return _0x9e2a66;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x29e3('0x0'));module[_0x29e3('0x1')]={'type':{'type':Sequelize[_0x29e3('0x2')]('blind',_0x29e3('0x3'))},'result':{'type':Sequelize[_0x29e3('0x4')]},'transfererchannel':{'type':Sequelize[_0x29e3('0x4')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x29e3('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x29e3('0x4')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x29e3('0x4')]},'transfererexten':{'type':Sequelize[_0x29e3('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x29e3('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x29e3('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x29e3('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x29e3('0x4')]},'transfereeexten':{'type':Sequelize[_0x29e3('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x29e3('0x2')](_0x29e3('0x5'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x29e3('0x4')]}}; \ No newline at end of file +var _0xa603=['blind','STRING','ENUM','Yes','sequelize','moment'];(function(_0x26dc85,_0x125f6c){var _0x1b7ff7=function(_0x1f1d05){while(--_0x1f1d05){_0x26dc85['push'](_0x26dc85['shift']());}};_0x1b7ff7(++_0x125f6c);}(_0xa603,0x112));var _0x3a60=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xa603[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x3a60('0x0'));var moment=require(_0x3a60('0x1'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x3a60('0x2'),'attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x3a60('0x3')]},'transferercalleridnum':{'type':Sequelize[_0x3a60('0x3')]},'transferercalleridname':{'type':Sequelize[_0x3a60('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0x3a60('0x3')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x3a60('0x3')]},'transferercontext':{'type':Sequelize[_0x3a60('0x3')]},'transfererexten':{'type':Sequelize[_0x3a60('0x3')]},'transfererlinkedid':{'type':Sequelize[_0x3a60('0x3')]},'transfereechannel':{'type':Sequelize[_0x3a60('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0x3a60('0x3')]},'transfereecalleridname':{'type':Sequelize[_0x3a60('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x3a60('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0x3a60('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0x3a60('0x3')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x3a60('0x3')]},'transfereelinkedid':{'type':Sequelize[_0x3a60('0x3')]},'isexternal':{'type':Sequelize[_0x3a60('0x4')](_0x3a60('0x5'),'No')},'context':{'type':Sequelize[_0x3a60('0x3')]},'extension':{'type':Sequelize[_0x3a60('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 42b6108..886fffa 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 _0xae84=['to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','offset','count','Content-Range','apply','save','update','then','destroy','end','error','name','send','map','VoiceTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xae84,0x8b));var _0x4ae8=function(_0xe0fc06,_0x4c3b76){_0xe0fc06=_0xe0fc06-0x0;var _0x5a0ed9=_0xae84[_0xe0fc06];return _0x5a0ed9;};'use strict';var emlformat=require(_0x4ae8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4ae8('0x1'));var jsonpatch=require(_0x4ae8('0x2'));var rp=require(_0x4ae8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4ae8('0x4'));var util=require(_0x4ae8('0x5'));var path=require(_0x4ae8('0x6'));var sox=require('sox');var csv=require(_0x4ae8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4ae8('0x8'));var _=require(_0x4ae8('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4ae8('0xa'));var deskjs=require(_0x4ae8('0xb'));var toCsv=require(_0x4ae8('0x7'));var querystring=require(_0x4ae8('0xc'));var Papa=require('papaparse');var Redis=require(_0x4ae8('0xd'));var authService=require(_0x4ae8('0xe'));var qs=require(_0x4ae8('0xf'));var as=require(_0x4ae8('0x10'));var hardwareService=require(_0x4ae8('0x11'));var logger=require(_0x4ae8('0x12'))(_0x4ae8('0x13'));var utils=require('../../config/utils');var config=require(_0x4ae8('0x14'));var licenseUtil=require(_0x4ae8('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x197b25,_0x4c8d3a){_0x4c8d3a=_0x4c8d3a||0xcc;return function(_0x39024e){if(_0x39024e){return _0x197b25[_0x4ae8('0x16')](_0x4c8d3a);}return _0x197b25['status'](_0x4c8d3a)['end']();};}function respondWithResult(_0x3f166d,_0xbd3f78){_0xbd3f78=_0xbd3f78||0xc8;return function(_0x43acfa){if(_0x43acfa){return _0x3f166d[_0x4ae8('0x17')](_0xbd3f78)[_0x4ae8('0x18')](_0x43acfa);}};}function respondWithFilteredResult(_0x2681a5,_0x4371f6){return function(_0x5314ef){if(_0x5314ef){var _0x3599fd=typeof _0x4371f6['offset']===_0x4ae8('0x19')&&typeof _0x4371f6[_0x4ae8('0x1a')]==='undefined';var _0x590042=_0x5314ef['count'];var _0x2358ad=_0x3599fd?0x0:_0x4371f6[_0x4ae8('0x1b')];var _0x188adb=_0x3599fd?_0x5314ef[_0x4ae8('0x1c')]:_0x4371f6[_0x4ae8('0x1b')]+_0x4371f6['limit'];var _0x57b7fd;if(_0x188adb>=_0x590042){_0x188adb=_0x590042;_0x57b7fd=0xc8;}else{_0x57b7fd=0xce;}_0x2681a5[_0x4ae8('0x17')](_0x57b7fd);return _0x2681a5['set'](_0x4ae8('0x1d'),_0x2358ad+'-'+_0x188adb+'/'+_0x590042)['json'](_0x5314ef);}return null;};}function patchUpdates(_0x1cb0b9){return function(_0x40b971){try{jsonpatch[_0x4ae8('0x1e')](_0x40b971,_0x1cb0b9,!![]);}catch(_0x336999){return BPromise['reject'](_0x336999);}return _0x40b971[_0x4ae8('0x1f')]();};}function saveUpdates(_0x2ac5e6,_0x4cc79b){return function(_0x172547){if(_0x172547){return _0x172547[_0x4ae8('0x20')](_0x2ac5e6)[_0x4ae8('0x21')](function(_0x4ccdaf){return _0x4ccdaf;});}return null;};}function removeEntity(_0x1db2e2,_0x447510){return function(_0x430f6f){if(_0x430f6f){return _0x430f6f[_0x4ae8('0x22')]()[_0x4ae8('0x21')](function(){_0x1db2e2['status'](0xcc)[_0x4ae8('0x23')]();});}};}function handleEntityNotFound(_0x35ec7c,_0x1e0220){return function(_0x2a1ecd){if(!_0x2a1ecd){_0x35ec7c[_0x4ae8('0x16')](0x194);}return _0x2a1ecd;};}function handleError(_0xaa4ed4,_0x406e1d){_0x406e1d=_0x406e1d||0x1f4;return function(_0x468cf7){logger[_0x4ae8('0x24')](_0x468cf7['stack']);if(_0x468cf7[_0x4ae8('0x25')]){delete _0x468cf7[_0x4ae8('0x25')];}_0xaa4ed4[_0x4ae8('0x17')](_0x406e1d)[_0x4ae8('0x26')](_0x468cf7);};}exports['index']=function(_0x4ba059,_0x17712a){var _0x594879={},_0x4e89eb={},_0x3fe15d={'count':0x0,'rows':[]};var _0xb6b1c6=_[_0x4ae8('0x27')](db[_0x4ae8('0x28')][_0x4ae8('0x29')],function(_0x332300){return{'name':_0x332300[_0x4ae8('0x2a')],'type':_0x332300[_0x4ae8('0x2b')]['key']};});_0x4e89eb[_0x4ae8('0x2c')]=_[_0x4ae8('0x27')](_0xb6b1c6,_0x4ae8('0x25'));_0x4e89eb[_0x4ae8('0x2d')]=_[_0x4ae8('0x2e')](_0x4ba059[_0x4ae8('0x2d')]);_0x4e89eb[_0x4ae8('0x2f')]=_[_0x4ae8('0x30')](_0x4e89eb['model'],_0x4e89eb[_0x4ae8('0x2d')]);_0x594879[_0x4ae8('0x31')]=_[_0x4ae8('0x30')](_0x4e89eb['model'],qs['fields'](_0x4ba059[_0x4ae8('0x2d')][_0x4ae8('0x32')]));_0x594879['attributes']=_0x594879[_0x4ae8('0x31')][_0x4ae8('0x33')]?_0x594879[_0x4ae8('0x31')]:_0x4e89eb[_0x4ae8('0x2c')];if(!_0x4ba059[_0x4ae8('0x2d')][_0x4ae8('0x34')](_0x4ae8('0x35'))){_0x594879[_0x4ae8('0x1a')]=qs[_0x4ae8('0x1a')](_0x4ba059[_0x4ae8('0x2d')][_0x4ae8('0x1a')]);_0x594879[_0x4ae8('0x1b')]=qs[_0x4ae8('0x1b')](_0x4ba059['query'][_0x4ae8('0x1b')]);}_0x594879[_0x4ae8('0x36')]=qs[_0x4ae8('0x37')](_0x4ba059['query']['sort']);_0x594879[_0x4ae8('0x38')]=qs[_0x4ae8('0x2f')](_[_0x4ae8('0x39')](_0x4ba059[_0x4ae8('0x2d')],_0x4e89eb['filters']),_0xb6b1c6);if(_0x4ba059[_0x4ae8('0x2d')][_0x4ae8('0x3a')]){_0x594879[_0x4ae8('0x38')]=_[_0x4ae8('0x3b')](_0x594879[_0x4ae8('0x38')],{'$or':_['map'](_0xb6b1c6,function(_0x271e53){if(_0x271e53[_0x4ae8('0x2b')]!==_0x4ae8('0x3c')){var _0x4a0db7={};_0x4a0db7[_0x271e53['name']]={'$like':'%'+_0x4ba059[_0x4ae8('0x2d')][_0x4ae8('0x3a')]+'%'};return _0x4a0db7;}})});}_0x594879=_[_0x4ae8('0x3b')]({},_0x594879,_0x4ba059[_0x4ae8('0x3d')]);var _0xa205fe={'where':_0x594879[_0x4ae8('0x38')]};return db[_0x4ae8('0x28')][_0x4ae8('0x1c')](_0xa205fe)[_0x4ae8('0x21')](function(_0x4125d4){_0x3fe15d[_0x4ae8('0x1c')]=_0x4125d4;if(_0x4ba059[_0x4ae8('0x2d')][_0x4ae8('0x3e')]){_0x594879[_0x4ae8('0x3f')]=[{'all':!![]}];}return db[_0x4ae8('0x28')][_0x4ae8('0x40')](_0x594879);})[_0x4ae8('0x21')](function(_0x3665d9){_0x3fe15d[_0x4ae8('0x41')]=_0x3665d9;return _0x3fe15d;})[_0x4ae8('0x21')](respondWithFilteredResult(_0x17712a,_0x594879))[_0x4ae8('0x42')](handleError(_0x17712a,null));};exports[_0x4ae8('0x43')]=function(_0xf8ac0e,_0x38050e){var _0x5b788e={'raw':!![],'where':{'id':_0xf8ac0e[_0x4ae8('0x44')]['id']}},_0x5dff3a={};_0x5dff3a[_0x4ae8('0x2c')]=_[_0x4ae8('0x2e')](db[_0x4ae8('0x28')][_0x4ae8('0x29')]);_0x5dff3a[_0x4ae8('0x2d')]=_[_0x4ae8('0x2e')](_0xf8ac0e[_0x4ae8('0x2d')]);_0x5dff3a['filters']=_['intersection'](_0x5dff3a['model'],_0x5dff3a[_0x4ae8('0x2d')]);_0x5b788e['attributes']=_[_0x4ae8('0x30')](_0x5dff3a[_0x4ae8('0x2c')],qs[_0x4ae8('0x32')](_0xf8ac0e[_0x4ae8('0x2d')]['fields']));_0x5b788e[_0x4ae8('0x31')]=_0x5b788e[_0x4ae8('0x31')][_0x4ae8('0x33')]?_0x5b788e['attributes']:_0x5dff3a[_0x4ae8('0x2c')];if(_0xf8ac0e[_0x4ae8('0x2d')]['includeAll']){_0x5b788e[_0x4ae8('0x3f')]=[{'all':!![]}];}_0x5b788e=_[_0x4ae8('0x3b')]({},_0x5b788e,_0xf8ac0e[_0x4ae8('0x3d')]);return db[_0x4ae8('0x28')][_0x4ae8('0x45')](_0x5b788e)[_0x4ae8('0x21')](handleEntityNotFound(_0x38050e,null))[_0x4ae8('0x21')](respondWithResult(_0x38050e,null))[_0x4ae8('0x42')](handleError(_0x38050e,null));};exports['create']=function(_0x14e722,_0x3719ae){return db[_0x4ae8('0x28')][_0x4ae8('0x46')](_0x14e722['body'],{})[_0x4ae8('0x21')](respondWithResult(_0x3719ae,0xc9))[_0x4ae8('0x42')](handleError(_0x3719ae,null));};exports[_0x4ae8('0x20')]=function(_0x29cd60,_0x2254a2){if(_0x29cd60[_0x4ae8('0x47')]['id']){delete _0x29cd60['body']['id'];}return db[_0x4ae8('0x28')][_0x4ae8('0x45')]({'where':{'id':_0x29cd60[_0x4ae8('0x44')]['id']}})[_0x4ae8('0x21')](handleEntityNotFound(_0x2254a2,null))[_0x4ae8('0x21')](saveUpdates(_0x29cd60[_0x4ae8('0x47')],null))[_0x4ae8('0x21')](respondWithResult(_0x2254a2,null))['catch'](handleError(_0x2254a2,null));};exports[_0x4ae8('0x22')]=function(_0x44617f,_0x5030da){return db['VoiceTransferReport']['find']({'where':{'id':_0x44617f[_0x4ae8('0x44')]['id']}})[_0x4ae8('0x21')](handleEntityNotFound(_0x5030da,null))['then'](removeEntity(_0x5030da,null))[_0x4ae8('0x42')](handleError(_0x5030da,null));};exports[_0x4ae8('0x48')]=function(_0x176bd7,_0x457c04){return db[_0x4ae8('0x28')]['describe']()['then'](respondWithResult(_0x457c04,null))['catch'](handleError(_0x457c04,null));}; \ No newline at end of file +var _0xf4c8=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','order','sort','filter','where','merge','options','includeAll','include','VoiceTransferReport','findAll','catch','show','params','length','find','create','body','describe','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','desk.js'];(function(_0x4f7d66,_0x57829a){var _0x3569f1=function(_0x24f609){while(--_0x24f609){_0x4f7d66['push'](_0x4f7d66['shift']());}};_0x3569f1(++_0x57829a);}(_0xf4c8,0x149));var _0x8f4c=function(_0x4ec05f,_0x1d7fd3){_0x4ec05f=_0x4ec05f-0x0;var _0x29c86d=_0xf4c8[_0x4ec05f];return _0x29c86d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8f4c('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8f4c('0x1'));var BPromise=require(_0x8f4c('0x2'));var Mustache=require(_0x8f4c('0x3'));var util=require('util');var path=require(_0x8f4c('0x4'));var sox=require(_0x8f4c('0x5'));var csv=require(_0x8f4c('0x6'));var ejs=require(_0x8f4c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8f4c('0x8'));var crypto=require(_0x8f4c('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8f4c('0xa'));var toCsv=require(_0x8f4c('0x6'));var querystring=require(_0x8f4c('0xb'));var Papa=require(_0x8f4c('0xc'));var Redis=require(_0x8f4c('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x8f4c('0xe'));var as=require(_0x8f4c('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8f4c('0x10'))(_0x8f4c('0x11'));var utils=require(_0x8f4c('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x207dc6,_0x2ec3ca){_0x2ec3ca=_0x2ec3ca||0xcc;return function(_0x502a85){if(_0x502a85){return _0x207dc6[_0x8f4c('0x13')](_0x2ec3ca);}return _0x207dc6[_0x8f4c('0x14')](_0x2ec3ca)[_0x8f4c('0x15')]();};}function respondWithResult(_0x3f22ce,_0x22514e){_0x22514e=_0x22514e||0xc8;return function(_0x59397d){if(_0x59397d){return _0x3f22ce['status'](_0x22514e)[_0x8f4c('0x16')](_0x59397d);}};}function respondWithFilteredResult(_0x8050de,_0x5938dd){return function(_0x26b69a){if(_0x26b69a){var _0x5780a0=typeof _0x5938dd[_0x8f4c('0x17')]===_0x8f4c('0x18')&&typeof _0x5938dd[_0x8f4c('0x19')]===_0x8f4c('0x18');var _0x3babcb=_0x26b69a['count'];var _0x4db7d7=_0x5780a0?0x0:_0x5938dd[_0x8f4c('0x17')];var _0x424bb5=_0x5780a0?_0x26b69a[_0x8f4c('0x1a')]:_0x5938dd[_0x8f4c('0x17')]+_0x5938dd['limit'];var _0x1e1bce;if(_0x424bb5>=_0x3babcb){_0x424bb5=_0x3babcb;_0x1e1bce=0xc8;}else{_0x1e1bce=0xce;}_0x8050de[_0x8f4c('0x14')](_0x1e1bce);return _0x8050de[_0x8f4c('0x1b')](_0x8f4c('0x1c'),_0x4db7d7+'-'+_0x424bb5+'/'+_0x3babcb)['json'](_0x26b69a);}return null;};}function patchUpdates(_0x35f6d4){return function(_0x1268a0){try{jsonpatch[_0x8f4c('0x1d')](_0x1268a0,_0x35f6d4,!![]);}catch(_0x5f56cd){return BPromise[_0x8f4c('0x1e')](_0x5f56cd);}return _0x1268a0[_0x8f4c('0x1f')]();};}function saveUpdates(_0x3262fc,_0x5029a5){return function(_0x5f59c1){if(_0x5f59c1){return _0x5f59c1[_0x8f4c('0x20')](_0x3262fc)[_0x8f4c('0x21')](function(_0xc4d51e){return _0xc4d51e;});}return null;};}function removeEntity(_0x2e0dd6,_0x37c840){return function(_0x3fcfe8){if(_0x3fcfe8){return _0x3fcfe8[_0x8f4c('0x22')]()[_0x8f4c('0x21')](function(){_0x2e0dd6[_0x8f4c('0x14')](0xcc)[_0x8f4c('0x15')]();});}};}function handleEntityNotFound(_0x59b8fe,_0x51f7cc){return function(_0x38166f){if(!_0x38166f){_0x59b8fe[_0x8f4c('0x13')](0x194);}return _0x38166f;};}function handleError(_0x311432,_0x1a2b1c){_0x1a2b1c=_0x1a2b1c||0x1f4;return function(_0x119d9a){logger[_0x8f4c('0x23')](_0x119d9a['stack']);if(_0x119d9a['name']){delete _0x119d9a[_0x8f4c('0x24')];}_0x311432['status'](_0x1a2b1c)['send'](_0x119d9a);};}exports[_0x8f4c('0x25')]=function(_0x3fa3fc,_0x16cfbc){var _0x3b41dd={},_0xbaabef={},_0x1b384b={'count':0x0,'rows':[]};var _0x3421be=_[_0x8f4c('0x26')](db['VoiceTransferReport'][_0x8f4c('0x27')],function(_0x20033b){return{'name':_0x20033b[_0x8f4c('0x28')],'type':_0x20033b[_0x8f4c('0x29')][_0x8f4c('0x2a')]};});_0xbaabef[_0x8f4c('0x2b')]=_[_0x8f4c('0x26')](_0x3421be,'name');_0xbaabef[_0x8f4c('0x2c')]=_[_0x8f4c('0x2d')](_0x3fa3fc[_0x8f4c('0x2c')]);_0xbaabef[_0x8f4c('0x2e')]=_['intersection'](_0xbaabef['model'],_0xbaabef[_0x8f4c('0x2c')]);_0x3b41dd[_0x8f4c('0x2f')]=_[_0x8f4c('0x30')](_0xbaabef['model'],qs['fields'](_0x3fa3fc[_0x8f4c('0x2c')][_0x8f4c('0x31')]));_0x3b41dd[_0x8f4c('0x2f')]=_0x3b41dd[_0x8f4c('0x2f')]['length']?_0x3b41dd[_0x8f4c('0x2f')]:_0xbaabef[_0x8f4c('0x2b')];if(!_0x3fa3fc[_0x8f4c('0x2c')]['hasOwnProperty']('nolimit')){_0x3b41dd[_0x8f4c('0x19')]=qs['limit'](_0x3fa3fc[_0x8f4c('0x2c')][_0x8f4c('0x19')]);_0x3b41dd[_0x8f4c('0x17')]=qs[_0x8f4c('0x17')](_0x3fa3fc[_0x8f4c('0x2c')][_0x8f4c('0x17')]);}_0x3b41dd[_0x8f4c('0x32')]=qs[_0x8f4c('0x33')](_0x3fa3fc['query'][_0x8f4c('0x33')]);_0x3b41dd['where']=qs[_0x8f4c('0x2e')](_['pick'](_0x3fa3fc[_0x8f4c('0x2c')],_0xbaabef[_0x8f4c('0x2e')]),_0x3421be);if(_0x3fa3fc[_0x8f4c('0x2c')][_0x8f4c('0x34')]){_0x3b41dd['where']=_['merge'](_0x3b41dd[_0x8f4c('0x35')],{'$or':_['map'](_0x3421be,function(_0x4dfa78){if(_0x4dfa78['type']!=='VIRTUAL'){var _0x23b4d1={};_0x23b4d1[_0x4dfa78[_0x8f4c('0x24')]]={'$like':'%'+_0x3fa3fc[_0x8f4c('0x2c')][_0x8f4c('0x34')]+'%'};return _0x23b4d1;}})});}_0x3b41dd=_[_0x8f4c('0x36')]({},_0x3b41dd,_0x3fa3fc[_0x8f4c('0x37')]);var _0x9228c1={'where':_0x3b41dd[_0x8f4c('0x35')]};return db['VoiceTransferReport'][_0x8f4c('0x1a')](_0x9228c1)[_0x8f4c('0x21')](function(_0x4733f4){_0x1b384b[_0x8f4c('0x1a')]=_0x4733f4;if(_0x3fa3fc[_0x8f4c('0x2c')][_0x8f4c('0x38')]){_0x3b41dd[_0x8f4c('0x39')]=[{'all':!![]}];}return db[_0x8f4c('0x3a')][_0x8f4c('0x3b')](_0x3b41dd);})[_0x8f4c('0x21')](function(_0x4d0a32){_0x1b384b['rows']=_0x4d0a32;return _0x1b384b;})['then'](respondWithFilteredResult(_0x16cfbc,_0x3b41dd))[_0x8f4c('0x3c')](handleError(_0x16cfbc,null));};exports[_0x8f4c('0x3d')]=function(_0x20656d,_0x278885){var _0x3a50cc={'raw':!![],'where':{'id':_0x20656d[_0x8f4c('0x3e')]['id']}},_0x282911={};_0x282911['model']=_['keys'](db[_0x8f4c('0x3a')][_0x8f4c('0x27')]);_0x282911['query']=_[_0x8f4c('0x2d')](_0x20656d[_0x8f4c('0x2c')]);_0x282911[_0x8f4c('0x2e')]=_['intersection'](_0x282911['model'],_0x282911[_0x8f4c('0x2c')]);_0x3a50cc[_0x8f4c('0x2f')]=_[_0x8f4c('0x30')](_0x282911[_0x8f4c('0x2b')],qs[_0x8f4c('0x31')](_0x20656d['query']['fields']));_0x3a50cc[_0x8f4c('0x2f')]=_0x3a50cc[_0x8f4c('0x2f')][_0x8f4c('0x3f')]?_0x3a50cc[_0x8f4c('0x2f')]:_0x282911[_0x8f4c('0x2b')];if(_0x20656d[_0x8f4c('0x2c')][_0x8f4c('0x38')]){_0x3a50cc[_0x8f4c('0x39')]=[{'all':!![]}];}_0x3a50cc=_['merge']({},_0x3a50cc,_0x20656d[_0x8f4c('0x37')]);return db[_0x8f4c('0x3a')][_0x8f4c('0x40')](_0x3a50cc)[_0x8f4c('0x21')](handleEntityNotFound(_0x278885,null))[_0x8f4c('0x21')](respondWithResult(_0x278885,null))[_0x8f4c('0x3c')](handleError(_0x278885,null));};exports['create']=function(_0x4a58bb,_0x338d22){return db['VoiceTransferReport'][_0x8f4c('0x41')](_0x4a58bb[_0x8f4c('0x42')],{})['then'](respondWithResult(_0x338d22,0xc9))[_0x8f4c('0x3c')](handleError(_0x338d22,null));};exports['update']=function(_0x2f09fd,_0x6565ca){if(_0x2f09fd['body']['id']){delete _0x2f09fd['body']['id'];}return db[_0x8f4c('0x3a')][_0x8f4c('0x40')]({'where':{'id':_0x2f09fd[_0x8f4c('0x3e')]['id']}})['then'](handleEntityNotFound(_0x6565ca,null))['then'](saveUpdates(_0x2f09fd[_0x8f4c('0x42')],null))[_0x8f4c('0x21')](respondWithResult(_0x6565ca,null))[_0x8f4c('0x3c')](handleError(_0x6565ca,null));};exports[_0x8f4c('0x22')]=function(_0x3a883a,_0x18c572){return db[_0x8f4c('0x3a')][_0x8f4c('0x40')]({'where':{'id':_0x3a883a[_0x8f4c('0x3e')]['id']}})[_0x8f4c('0x21')](handleEntityNotFound(_0x18c572,null))[_0x8f4c('0x21')](removeEntity(_0x18c572,null))[_0x8f4c('0x3c')](handleError(_0x18c572,null));};exports[_0x8f4c('0x43')]=function(_0x4fd551,_0x2bbff6){return db[_0x8f4c('0x3a')][_0x8f4c('0x43')]()[_0x8f4c('0x21')](respondWithResult(_0x2bbff6,null))[_0x8f4c('0x3c')](handleError(_0x2bbff6,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 579c0c3..ab7e204 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 _0xa8f8=['request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5951e8,_0x42b9a7){var _0x20a1f5=function(_0x2bc968){while(--_0x2bc968){_0x5951e8['push'](_0x5951e8['shift']());}};_0x20a1f5(++_0x42b9a7);}(_0xa8f8,0x10b));var _0x8a8f=function(_0x53f608,_0x256def){_0x53f608=_0x53f608-0x0;var _0x495b7d=_0xa8f8[_0x53f608];return _0x495b7d;};'use strict';var _=require(_0x8a8f('0x0'));var util=require(_0x8a8f('0x1'));var logger=require(_0x8a8f('0x2'))(_0x8a8f('0x3'));var moment=require(_0x8a8f('0x4'));var BPromise=require(_0x8a8f('0x5'));var rp=require(_0x8a8f('0x6'));var fs=require('fs');var path=require(_0x8a8f('0x7'));var rimraf=require(_0x8a8f('0x8'));var config=require(_0x8a8f('0x9'));var attributes=require(_0x8a8f('0xa'));module[_0x8a8f('0xb')]=function(_0x374a2d,_0x4d5d8d){return _0x374a2d['define']('VoiceTransferReport',attributes,{'tableName':_0x8a8f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6300=['api','moment','bluebird','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','../../config/logger'];(function(_0x4c5c1e,_0xebb9a0){var _0x1877f7=function(_0x3adb4e){while(--_0x3adb4e){_0x4c5c1e['push'](_0x4c5c1e['shift']());}};_0x1877f7(++_0xebb9a0);}(_0x6300,0x1ec));var _0x0630=function(_0x50cde4,_0x50b225){_0x50cde4=_0x50cde4-0x0;var _0x3eca5f=_0x6300[_0x50cde4];return _0x3eca5f;};'use strict';var _=require(_0x0630('0x0'));var util=require('util');var logger=require(_0x0630('0x1'))(_0x0630('0x2'));var moment=require(_0x0630('0x3'));var BPromise=require(_0x0630('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0630('0x5'));var rimraf=require(_0x0630('0x6'));var config=require(_0x0630('0x7'));var attributes=require(_0x0630('0x8'));module[_0x0630('0x9')]=function(_0x1485aa,_0x170682){return _0x1485aa[_0x0630('0xa')](_0x0630('0xb'),attributes,{'tableName':_0x0630('0xc'),'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 1526c78..4e882fe 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 _0x3bf5=['jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error','code','message','VoiceTransferReport,\x20%s,\x20%s','info','result','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x320835,_0x3f9dda){var _0x1f7e58=function(_0x55a6ae){while(--_0x55a6ae){_0x320835['push'](_0x320835['shift']());}};_0x1f7e58(++_0x3f9dda);}(_0x3bf5,0x19b));var _0x53bf=function(_0x3b2369,_0x4c68b9){_0x3b2369=_0x3b2369-0x0;var _0x5a1367=_0x3bf5[_0x3b2369];return _0x5a1367;};'use strict';var _=require(_0x53bf('0x0'));var util=require(_0x53bf('0x1'));var moment=require('moment');var BPromise=require(_0x53bf('0x2'));var rs=require(_0x53bf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x53bf('0x4'))['db'];var utils=require(_0x53bf('0x5'));var logger=require(_0x53bf('0x6'))(_0x53bf('0x7'));var config=require(_0x53bf('0x8'));var jayson=require(_0x53bf('0x9'));var client=jayson[_0x53bf('0xa')][_0x53bf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x699fae,_0x2921de,_0x2c9e47){return new BPromise(function(_0x5e3f50,_0x23db33){return client[_0x53bf('0xc')](_0x699fae,_0x2c9e47)[_0x53bf('0xd')](function(_0x4c2d06){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x2921de,'request\x20sent');logger[_0x53bf('0xe')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x2921de,_0x53bf('0xf'),JSON[_0x53bf('0x10')](_0x4c2d06));if(_0x4c2d06['error']){if(_0x4c2d06[_0x53bf('0x11')][_0x53bf('0x12')]===0x1f4){logger[_0x53bf('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x2921de,_0x4c2d06[_0x53bf('0x11')][_0x53bf('0x13')]);return _0x23db33(_0x4c2d06[_0x53bf('0x11')][_0x53bf('0x13')]);}logger['error'](_0x53bf('0x14'),_0x2921de,_0x4c2d06[_0x53bf('0x11')]['message']);return _0x5e3f50(_0x4c2d06[_0x53bf('0x11')][_0x53bf('0x13')]);}else{logger[_0x53bf('0x15')](_0x53bf('0x14'),_0x2921de,_0x53bf('0xf'));_0x5e3f50(_0x4c2d06[_0x53bf('0x16')][_0x53bf('0x13')]);}})['catch'](function(_0x58c0f5){logger['error'](_0x53bf('0x14'),_0x2921de,_0x58c0f5);_0x23db33(_0x58c0f5);});});}exports[_0x53bf('0x17')]=function(_0x1b899b){var _0x2e8268=this;return new Promise(function(_0x2eddb4,_0x2750e2){return db[_0x53bf('0x18')][_0x53bf('0x19')](_0x1b899b[_0x53bf('0x1a')],{'raw':_0x1b899b[_0x53bf('0x1b')]?_0x1b899b['options'][_0x53bf('0x1c')]===undefined?!![]:![]:!![]})[_0x53bf('0xd')](function(_0x5bf5a){logger['info'](_0x53bf('0x17'),_0x1b899b);logger[_0x53bf('0xe')]('CreateVoiceTransferReport',_0x1b899b,JSON[_0x53bf('0x10')](_0x5bf5a));_0x2eddb4(_0x5bf5a);})[_0x53bf('0x1d')](function(_0x187620){logger[_0x53bf('0x11')](_0x53bf('0x17'),_0x187620[_0x53bf('0x13')],_0x1b899b);_0x2750e2(_0x2e8268[_0x53bf('0x11')](0x1f4,_0x187620[_0x53bf('0x13')]));});});}; \ No newline at end of file +var _0xf6fe=['error','message','result','catch','CreateVoiceTransferReport','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1115af,_0x5165a3){var _0xd421dd=function(_0x7e1b74){while(--_0x7e1b74){_0x1115af['push'](_0x1115af['shift']());}};_0xd421dd(++_0x5165a3);}(_0xf6fe,0x95));var _0xef6f=function(_0x4e4e98,_0x25bed0){_0x4e4e98=_0x4e4e98-0x0;var _0x4fc67c=_0xf6fe[_0x4e4e98];return _0x4fc67c;};'use strict';var _=require(_0xef6f('0x0'));var util=require(_0xef6f('0x1'));var moment=require('moment');var BPromise=require(_0xef6f('0x2'));var rs=require(_0xef6f('0x3'));var fs=require('fs');var Redis=require(_0xef6f('0x4'));var db=require(_0xef6f('0x5'))['db'];var utils=require(_0xef6f('0x6'));var logger=require(_0xef6f('0x7'))(_0xef6f('0x8'));var config=require(_0xef6f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xef6f('0xa')][_0xef6f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5df85e,_0x292512,_0x3c7cd8){return new BPromise(function(_0x4978f5,_0x44561f){return client['request'](_0x5df85e,_0x3c7cd8)[_0xef6f('0xc')](function(_0x3eb1ef){logger[_0xef6f('0xd')](_0xef6f('0xe'),_0x292512,_0xef6f('0xf'));logger[_0xef6f('0x10')](_0xef6f('0x11'),_0x292512,_0xef6f('0xf'),JSON[_0xef6f('0x12')](_0x3eb1ef));if(_0x3eb1ef[_0xef6f('0x13')]){if(_0x3eb1ef[_0xef6f('0x13')]['code']===0x1f4){logger[_0xef6f('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x292512,_0x3eb1ef[_0xef6f('0x13')][_0xef6f('0x14')]);return _0x44561f(_0x3eb1ef['error']['message']);}logger[_0xef6f('0x13')](_0xef6f('0xe'),_0x292512,_0x3eb1ef[_0xef6f('0x13')][_0xef6f('0x14')]);return _0x4978f5(_0x3eb1ef[_0xef6f('0x13')][_0xef6f('0x14')]);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x292512,_0xef6f('0xf'));_0x4978f5(_0x3eb1ef[_0xef6f('0x15')]['message']);}})[_0xef6f('0x16')](function(_0x4d9f68){logger[_0xef6f('0x13')](_0xef6f('0xe'),_0x292512,_0x4d9f68);_0x44561f(_0x4d9f68);});});}exports[_0xef6f('0x17')]=function(_0x2b5fe4){var _0x166ba6=this;return new Promise(function(_0x35986c,_0x250e07){return db['VoiceTransferReport'][_0xef6f('0x18')](_0x2b5fe4[_0xef6f('0x19')],{'raw':_0x2b5fe4['options']?_0x2b5fe4[_0xef6f('0x1a')][_0xef6f('0x1b')]===undefined?!![]:![]:!![]})[_0xef6f('0xc')](function(_0x319d28){logger[_0xef6f('0xd')](_0xef6f('0x17'),_0x2b5fe4);logger['debug'](_0xef6f('0x17'),_0x2b5fe4,JSON[_0xef6f('0x12')](_0x319d28));_0x35986c(_0x319d28);})['catch'](function(_0x1b3e14){logger[_0xef6f('0x13')]('CreateVoiceTransferReport',_0x1b3e14[_0xef6f('0x14')],_0x2b5fe4);_0x250e07(_0x166ba6[_0xef6f('0x13')](0x1f4,_0x1b3e14[_0xef6f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 20b5c2a..bf459c4 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 _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(_0x34b821,_0x504e55){var _0x5e00a0=function(_0x242892){while(--_0x242892){_0x34b821['push'](_0x34b821['shift']());}};_0x5e00a0(++_0x504e55);}(_0x34e8,0x12c));var _0x834e=function(_0x4f9fff,_0x36d5ee){_0x4f9fff=_0x4f9fff-0x0;var _0x1e5a45=_0x34e8[_0x4f9fff];return _0x1e5a45;};'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 +var _0xbec5=['exports','express','Router','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','/hangup','hangup','/answer','answer','/hold','/unhold','unhold','/calls','calls','/transfer','transfer'];(function(_0x361656,_0x2e61da){var _0x3f6f73=function(_0x4fc159){while(--_0x4fc159){_0x361656['push'](_0x361656['shift']());}};_0x3f6f73(++_0x2e61da);}(_0xbec5,0xe5));var _0x5bec=function(_0x309d93,_0x157662){_0x309d93=_0x309d93-0x0;var _0x2dd61d=_0xbec5[_0x309d93];return _0x2dd61d;};'use strict';var express=require(_0x5bec('0x0'));var router=express[_0x5bec('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x5bec('0x2'));router[_0x5bec('0x3')](_0x5bec('0x4'),auth[_0x5bec('0x5')](),auth[_0x5bec('0x6')](),controller['originate']);router[_0x5bec('0x3')](_0x5bec('0x7'),auth[_0x5bec('0x5')](),auth['isWebrtcLicence'](),controller[_0x5bec('0x8')]);router[_0x5bec('0x3')](_0x5bec('0x9'),auth[_0x5bec('0x5')](),auth[_0x5bec('0x6')](),controller[_0x5bec('0xa')]);router[_0x5bec('0x3')](_0x5bec('0xb'),auth['isAuthenticated'](),auth[_0x5bec('0x6')](),controller['hold']);router[_0x5bec('0x3')](_0x5bec('0xc'),auth[_0x5bec('0x5')](),auth['isWebrtcLicence'](),controller[_0x5bec('0xd')]);router[_0x5bec('0x3')](_0x5bec('0xe'),auth['isAuthenticated'](),auth[_0x5bec('0x6')](),controller[_0x5bec('0xf')]);router['post'](_0x5bec('0x10'),auth[_0x5bec('0x5')](),auth[_0x5bec('0x6')](),controller[_0x5bec('0x11')]);module[_0x5bec('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 31c2640..2bc9a23 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 _0x34e8=['path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','defaults','localhost','socket.io-emitter','redis','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','handleError:','error','stack','name','status','send','request','then','message','result','catch','User','agent','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','json','userId','callNumber','callerId','entityFound:','format','hangup','hangup\x20fired:','user:%s','hangup\x20executed!','answer\x20fired:','webbar:answer','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','calls','calls\x20fired:','all','conference','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!'];(function(_0xdcd1e6,_0x155292){var _0x3af9fd=function(_0x27dc29){while(--_0x27dc29){_0xdcd1e6['push'](_0xdcd1e6['shift']());}};_0x3af9fd(++_0x155292);}(_0x34e8,0x12c));var _0x834e=function(_0x4f50b6,_0x26b997){_0x4f50b6=_0x4f50b6-0x0;var _0x23424c=_0x34e8[_0x4f50b6];return _0x23424c;};'use strict';var path=require(_0x834e('0x0'));var fs=require('fs');var _=require(_0x834e('0x1'));var db=require(_0x834e('0x2'))['db'];var config=require(_0x834e('0x3'));var util=require('util');var BPromise=require(_0x834e('0x4'));var jayson=require(_0x834e('0x5'));var amiClient=jayson[_0x834e('0x6')][_0x834e('0x7')]({'port':0x232a});var logger=require(_0x834e('0x8'))(_0x834e('0x9'));var Redis=require(_0x834e('0xa'));config['redis']=_[_0x834e('0xb')](config['redis'],{'host':_0x834e('0xc'),'port':0x18eb});var io=require(_0x834e('0xd'))(new Redis(config[_0x834e('0xe')]));var Schema=require(_0x834e('0xf'));var originateValidation=new Schema({'userId':{'type':_0x834e('0x10'),'required':[!![],_0x834e('0x11')]},'callNumber':{'type':_0x834e('0x12'),'required':[!![],_0x834e('0x13')]},'callerId':{'type':_0x834e('0x12')},'callbackUrl':{'type':_0x834e('0x12')}});var hangupValidation=new Schema({'userId':{'type':_0x834e('0x10'),'required':[!![],_0x834e('0x11')]},'sessionId':{'type':_0x834e('0x12'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x834e('0x10'),'required':[!![],_0x834e('0x11')]},'sessionId':{'type':_0x834e('0x12'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x834e('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x834e('0x12'),'required':[!![],_0x834e('0x14')]},'transferNumber':{'type':'string','required':[!![],_0x834e('0x15')]}});var holdValidation=new Schema({'userId':{'type':_0x834e('0x10'),'required':[!![],_0x834e('0x11')]},'sessionId':{'type':_0x834e('0x12'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x834e('0x11')]},'sessionId':{'type':_0x834e('0x12'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x834e('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x834e('0x11')]}});function emit(_0x36d443,_0x478afe,_0x43ac41){logger[_0x834e('0x16')](_0x36d443,_0x478afe,JSON[_0x834e('0x17')](_0x43ac41));io['to'](_0x36d443)['emit'](_0x478afe,_0x43ac41);}function handleError(_0x283e56){return function(_0x211e9a){console[_0x834e('0x18')](_0x834e('0x19'),_0x211e9a,_0x211e9a instanceof RangeError);logger[_0x834e('0x1a')](_0x211e9a[_0x834e('0x1b')]);if(_0x211e9a instanceof RangeError){if(_0x211e9a[_0x834e('0x1c')]){delete _0x211e9a['name'];}_0x283e56[_0x834e('0x1d')](0x194)[_0x834e('0x1e')](_0x211e9a);}else{if(_0x211e9a[_0x834e('0x1c')]){delete _0x211e9a[_0x834e('0x1c')];}_0x283e56['status'](0x1f4)[_0x834e('0x1e')](_0x211e9a);}};}function checkError(){return function(_0x62f8f1){if(!_0x62f8f1){throw new RangeError('NotFound');}return _0x62f8f1;};}function respondWithRpcPromise(_0x1b4bdf,_0x28d687){return new BPromise(function(_0x8d406e,_0x5c55ca){var _0x4e3f48=amiClient;return _0x4e3f48[_0x834e('0x1f')](_0x1b4bdf,_0x28d687)[_0x834e('0x20')](function(_0x589dde){if(_0x589dde[_0x834e('0x1a')]){if(_0x589dde[_0x834e('0x1a')]['code']===0x1f4){return _0x5c55ca(_0x589dde[_0x834e('0x1a')][_0x834e('0x21')]);}return _0x8d406e(_0x589dde[_0x834e('0x1a')]['message']);}else{_0x8d406e(_0x589dde[_0x834e('0x22')]);}})[_0x834e('0x23')](function(_0x5e1cc5){_0x5c55ca(_0x5e1cc5);});});}function getAgent(_0x5bef62){return db[_0x834e('0x24')]['findOne']({'where':{'id':_0x5bef62,'role':_0x834e('0x25')}})[_0x834e('0x20')](checkError());}function getAgentCheckSession(_0x3db026,_0x2cc2eb){return new BPromise(function(_0x3cd928,_0x130cc5){var _0x491919=respondWithRpcPromise('VoiceChannels');var _0x4dc64a=getAgent(_0x3db026);Promise['all']([_0x491919,_0x4dc64a])[_0x834e('0x20')](function(_0x567cea){var _0x106d6a=_0x567cea[0x0];var _0x5dacc1=_0x567cea[0x1];var _0xb5bc06=_[_0x834e('0x26')](_0x106d6a[_0x834e('0x27')],function(_0x1e026a){return _0x1e026a[_0x834e('0x28')]==_0x5dacc1['id']&&_0x1e026a[_0x834e('0x29')]==_0x2cc2eb;});if(_0xb5bc06[_0x834e('0x2a')]==0x1){_0x3cd928(_0x5dacc1);}else{_0x130cc5(new RangeError(_0x834e('0x2b')+_0x2cc2eb+_0x834e('0x2c')));}});});}exports['originate']=function(_0xef9ec2,_0x5cad11){logger[_0x834e('0x16')](_0x834e('0x2d'),_0xef9ec2[_0x834e('0x2e')]);var _0x2b3418=originateValidation[_0x834e('0xf')](_0xef9ec2[_0x834e('0x2e')]);if(_0x2b3418[_0x834e('0x2a')]>0x0){return _0x5cad11[_0x834e('0x1d')](0x190)[_0x834e('0x2f')](_0x2b3418);}var _0x12b2bc=_0xef9ec2['body'][_0x834e('0x30')];var _0x2f408a=_0xef9ec2[_0x834e('0x2e')][_0x834e('0x31')];var _0x595cc0=_0xef9ec2[_0x834e('0x2e')][_0x834e('0x32')];var _0x4b12f5=_0xef9ec2['body']['callbackUrl'];return getAgent(_0x12b2bc)[_0x834e('0x20')](function(_0x41bf4d){logger[_0x834e('0x16')](_0x834e('0x33'),_0x41bf4d[_0x834e('0x1c')]);emit(util[_0x834e('0x34')]('user:%s',_0x41bf4d[_0x834e('0x1c')]),'webbar:originate',{'callNumber':_0x2f408a,'callerId':_0x595cc0,'callbackUrl':_0x4b12f5});return _0x5cad11[_0x834e('0x1d')](0xc8)[_0x834e('0x2f')]({'error':![],'message':'originate\x20executed!'});})[_0x834e('0x23')](handleError(_0x5cad11));};exports[_0x834e('0x35')]=function(_0x491c28,_0x481f70){logger[_0x834e('0x16')](_0x834e('0x36'),_0x491c28[_0x834e('0x2e')]);var _0x130c23=hangupValidation[_0x834e('0xf')](_0x491c28['body']);if(_0x130c23[_0x834e('0x2a')]>0x0){return _0x481f70['status'](0x190)['json'](_0x130c23);}var _0x1b2edf=_0x491c28['body'][_0x834e('0x30')];var _0x1ba66d=_0x491c28[_0x834e('0x2e')][_0x834e('0x29')];return getAgent(_0x1b2edf)[_0x834e('0x20')](function(_0x574ea8){logger[_0x834e('0x16')](_0x834e('0x33'),_0x574ea8[_0x834e('0x1c')]);emit(util['format'](_0x834e('0x37'),_0x574ea8[_0x834e('0x1c')]),'webbar:hangup',{'sessionId':_0x1ba66d});return _0x481f70[_0x834e('0x1d')](0xc8)['json']({'error':![],'message':_0x834e('0x38')});})[_0x834e('0x23')](handleError(_0x481f70));};exports['answer']=function(_0x4a6942,_0x22ea21){logger[_0x834e('0x16')](_0x834e('0x39'),_0x4a6942[_0x834e('0x2e')]);var _0x8ad264=answerValidation[_0x834e('0xf')](_0x4a6942[_0x834e('0x2e')]);if(_0x8ad264['length']>0x0){return _0x22ea21[_0x834e('0x1d')](0x190)['json'](_0x8ad264);}var _0x321efa=_0x4a6942['body'][_0x834e('0x30')];var _0x5a5807=_0x4a6942[_0x834e('0x2e')][_0x834e('0x29')];return getAgent(_0x321efa)['then'](function(_0x39e7b9){logger[_0x834e('0x16')](_0x834e('0x33'),_0x39e7b9[_0x834e('0x1c')]);emit(util[_0x834e('0x34')](_0x834e('0x37'),_0x39e7b9[_0x834e('0x1c')]),_0x834e('0x3a'),{'sessionId':_0x5a5807});return _0x22ea21[_0x834e('0x1d')](0xc8)[_0x834e('0x2f')]({'error':![],'message':'answer\x20executed!'});})[_0x834e('0x23')](handleError(_0x22ea21));};exports[_0x834e('0x3b')]=function(_0x47a8a9,_0x112306){logger[_0x834e('0x16')](_0x834e('0x3c'),_0x47a8a9[_0x834e('0x2e')]);var _0x19b5ef=holdValidation[_0x834e('0xf')](_0x47a8a9['body']);if(_0x19b5ef['length']>0x0){return _0x112306[_0x834e('0x1d')](0x190)[_0x834e('0x2f')](_0x19b5ef);}var _0x30568e=_0x47a8a9[_0x834e('0x2e')][_0x834e('0x30')];var _0xd1d83b=_0x47a8a9[_0x834e('0x2e')][_0x834e('0x29')];return getAgent(_0x30568e)[_0x834e('0x20')](function(_0x390c45){logger[_0x834e('0x16')](_0x834e('0x33'),_0x390c45[_0x834e('0x1c')]);emit(util[_0x834e('0x34')](_0x834e('0x37'),_0x390c45[_0x834e('0x1c')]),_0x834e('0x3d'),{'sessionId':_0xd1d83b});return _0x112306[_0x834e('0x1d')](0xc8)[_0x834e('0x2f')]({'error':![],'message':_0x834e('0x3e')});})['catch'](handleError(_0x112306));};exports[_0x834e('0x3f')]=function(_0x1f08b9,_0x4e73e0){logger[_0x834e('0x16')](_0x834e('0x40'),_0x1f08b9['body']);var _0x3dcca3=unholdValidation[_0x834e('0xf')](_0x1f08b9[_0x834e('0x2e')]);if(_0x3dcca3[_0x834e('0x2a')]>0x0){return _0x4e73e0[_0x834e('0x1d')](0x190)[_0x834e('0x2f')](_0x3dcca3);}var _0x4549ba=_0x1f08b9['body'][_0x834e('0x30')];var _0x8bc6c6=_0x1f08b9[_0x834e('0x2e')][_0x834e('0x29')];return getAgent(_0x4549ba)[_0x834e('0x20')](function(_0x396bbe){logger[_0x834e('0x16')](_0x834e('0x33'),_0x396bbe['name']);emit(util[_0x834e('0x34')]('user:%s',_0x396bbe[_0x834e('0x1c')]),'webbar:unhold',{'sessionId':_0x8bc6c6});return _0x4e73e0[_0x834e('0x1d')](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0x834e('0x23')](handleError(_0x4e73e0));};exports[_0x834e('0x41')]=function(_0x5291ae,_0x5be43d){logger[_0x834e('0x16')](_0x834e('0x42'),_0x5be43d[_0x834e('0x2e')]);var _0x387365=callsValidation[_0x834e('0xf')](_0x5291ae[_0x834e('0x2e')]);if(_0x387365[_0x834e('0x2a')]>0x0){return _0x5be43d[_0x834e('0x1d')](0x190)['json'](_0x387365);}var _0x142334=_0x5291ae[_0x834e('0x2e')]['userId'];var _0x281342=respondWithRpcPromise('VoiceChannels');var _0x3e58ef=getAgent(_0x142334);return Promise[_0x834e('0x43')]([_0x281342,_0x3e58ef])['then'](function(_0x41ef86){var _0x37ee0e=_0x41ef86[0x0];var _0x2de29a=_0x41ef86[0x1];var _0x25f720=_['filter'](_0x37ee0e[_0x834e('0x27')],function(_0x438f75){return _0x438f75[_0x834e('0x28')]==_0x2de29a['id'];});return _0x5be43d['status'](0xc8)[_0x834e('0x2f')]({'count':_0x25f720[_0x834e('0x2a')],'rows':_0x25f720});})[_0x834e('0x23')](handleError(_0x5be43d));};exports[_0x834e('0x44')]=function(_0x3183c5,_0x125f37){logger[_0x834e('0x16')](_0x834e('0x45'),_0x3183c5[_0x834e('0x2e')]);var _0xfcccd8=conferenceValidation[_0x834e('0xf')](_0x3183c5[_0x834e('0x2e')]);if(_0xfcccd8[_0x834e('0x2a')]>0x0){return _0x125f37[_0x834e('0x1d')](0x190)[_0x834e('0x2f')](_0xfcccd8);}var _0x17b8e3=_0x3183c5[_0x834e('0x2e')][_0x834e('0x30')];return getAgent(_0x17b8e3)[_0x834e('0x20')](function(_0x3e3467){logger[_0x834e('0x16')](_0x834e('0x33'),_0x3e3467['name']);emit(util[_0x834e('0x34')](_0x834e('0x37'),_0x3e3467[_0x834e('0x1c')]),_0x834e('0x46'));return _0x125f37['status'](0xc8)[_0x834e('0x2f')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x125f37));};exports[_0x834e('0x47')]=function(_0x2b1ec7,_0x1644dd){logger[_0x834e('0x16')](_0x834e('0x48'),_0x2b1ec7[_0x834e('0x2e')]);var _0xbb926d=transferValidation[_0x834e('0xf')](_0x2b1ec7['body']);if(_0xbb926d[_0x834e('0x2a')]>0x0){return _0x1644dd['status'](0x190)[_0x834e('0x2f')](_0xbb926d);}var _0xd35dda=_0x2b1ec7['body']['userId'];var _0x4a4def=_0x2b1ec7[_0x834e('0x2e')][_0x834e('0x29')];var _0x2cca07=_0x2b1ec7[_0x834e('0x2e')]['transferNumber'];return getAgent(_0xd35dda)[_0x834e('0x20')](function(_0x15018f){logger[_0x834e('0x16')](_0x834e('0x33'),_0x15018f[_0x834e('0x1c')]);emit(util[_0x834e('0x34')](_0x834e('0x37'),_0x15018f[_0x834e('0x1c')]),_0x834e('0x49'),{'sessionId':_0x4a4def,'transferNumber':_0x2cca07});return _0x1644dd[_0x834e('0x1d')](0xc8)['json']({'error':![],'message':_0x834e('0x4a')});})[_0x834e('0x23')](handleError(_0x1644dd));}; \ No newline at end of file +var _0xc874=['filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callerId','callbackUrl','info','format','webbar:originate','originate\x20executed!','hangup','validate','webbar:hangup','hangup\x20executed!','answer','entityFound:','user:%s','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','../../mysqldb','../../config/environment','jayson/promise','client','http','webbarapi','ioredis','defaults','redis','localhost','socket.io-emitter','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','stringify','emit','log','error','stack','name','send','status','NotFound','request','then','code','message','result','catch','User','findOne','VoiceChannels'];(function(_0x4ecbf5,_0x47ed8d){var _0x464607=function(_0x549e95){while(--_0x549e95){_0x4ecbf5['push'](_0x4ecbf5['shift']());}};_0x464607(++_0x47ed8d);}(_0xc874,0x154));var _0x4c87=function(_0x27e811,_0x20137c){_0x27e811=_0x27e811-0x0;var _0x1627fa=_0xc874[_0x27e811];return _0x1627fa;};'use strict';var path=require(_0x4c87('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x4c87('0x1'))['db'];var config=require(_0x4c87('0x2'));var util=require('util');var BPromise=require('bluebird');var jayson=require(_0x4c87('0x3'));var amiClient=jayson[_0x4c87('0x4')][_0x4c87('0x5')]({'port':0x232a});var logger=require('../../config/logger')(_0x4c87('0x6'));var Redis=require(_0x4c87('0x7'));config['redis']=_[_0x4c87('0x8')](config[_0x4c87('0x9')],{'host':_0x4c87('0xa'),'port':0x18eb});var io=require(_0x4c87('0xb'))(new Redis(config[_0x4c87('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x4c87('0xc'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x4c87('0xd'),'required':[!![],_0x4c87('0xe')]},'callerId':{'type':_0x4c87('0xd')},'callbackUrl':{'type':_0x4c87('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x4c87('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x4c87('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x4c87('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x4c87('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x4c87('0xc'),'required':[!![],_0x4c87('0xf')]},'sessionId':{'type':_0x4c87('0xd'),'required':[!![],_0x4c87('0x10')]},'transferNumber':{'type':'string','required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x4c87('0xf')]},'sessionId':{'type':_0x4c87('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x4c87('0xc'),'required':[!![],_0x4c87('0xf')]},'sessionId':{'type':_0x4c87('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x4c87('0xc'),'required':[!![],_0x4c87('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x4c87('0xc'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x27abb9,_0x3c32cc,_0x585705){logger['info'](_0x27abb9,_0x3c32cc,JSON[_0x4c87('0x11')](_0x585705));io['to'](_0x27abb9)[_0x4c87('0x12')](_0x3c32cc,_0x585705);}function handleError(_0x2b55fa){return function(_0x547d92){console[_0x4c87('0x13')]('handleError:',_0x547d92,_0x547d92 instanceof RangeError);logger[_0x4c87('0x14')](_0x547d92[_0x4c87('0x15')]);if(_0x547d92 instanceof RangeError){if(_0x547d92[_0x4c87('0x16')]){delete _0x547d92[_0x4c87('0x16')];}_0x2b55fa['status'](0x194)[_0x4c87('0x17')](_0x547d92);}else{if(_0x547d92[_0x4c87('0x16')]){delete _0x547d92[_0x4c87('0x16')];}_0x2b55fa[_0x4c87('0x18')](0x1f4)[_0x4c87('0x17')](_0x547d92);}};}function checkError(){return function(_0x22fac7){if(!_0x22fac7){throw new RangeError(_0x4c87('0x19'));}return _0x22fac7;};}function respondWithRpcPromise(_0x9da0d6,_0x50289b){return new BPromise(function(_0x353ac9,_0x33aafd){var _0x5cc15d=amiClient;return _0x5cc15d[_0x4c87('0x1a')](_0x9da0d6,_0x50289b)[_0x4c87('0x1b')](function(_0x5a9496){if(_0x5a9496[_0x4c87('0x14')]){if(_0x5a9496[_0x4c87('0x14')][_0x4c87('0x1c')]===0x1f4){return _0x33aafd(_0x5a9496[_0x4c87('0x14')]['message']);}return _0x353ac9(_0x5a9496[_0x4c87('0x14')][_0x4c87('0x1d')]);}else{_0x353ac9(_0x5a9496[_0x4c87('0x1e')]);}})[_0x4c87('0x1f')](function(_0x637dbc){_0x33aafd(_0x637dbc);});});}function getAgent(_0x3eb09e){return db[_0x4c87('0x20')][_0x4c87('0x21')]({'where':{'id':_0x3eb09e,'role':'agent'}})[_0x4c87('0x1b')](checkError());}function getAgentCheckSession(_0x47ef54,_0x27f13d){return new BPromise(function(_0x381af7,_0x3a9520){var _0x1f246e=respondWithRpcPromise(_0x4c87('0x22'));var _0x583371=getAgent(_0x47ef54);Promise['all']([_0x1f246e,_0x583371])[_0x4c87('0x1b')](function(_0x23483e){var _0x2e3549=_0x23483e[0x0];var _0x106121=_0x23483e[0x1];var _0xa7eb3=_[_0x4c87('0x23')](_0x2e3549[_0x4c87('0x24')],function(_0x10aea2){return _0x10aea2[_0x4c87('0x25')]==_0x106121['id']&&_0x10aea2[_0x4c87('0x26')]==_0x27f13d;});if(_0xa7eb3[_0x4c87('0x27')]==0x1){_0x381af7(_0x106121);}else{_0x3a9520(new RangeError(_0x4c87('0x28')+_0x27f13d+_0x4c87('0x29')));}});});}exports[_0x4c87('0x2a')]=function(_0x3a1aaf,_0x185590){logger['info'](_0x4c87('0x2b'),_0x3a1aaf['body']);var _0x110b84=originateValidation['validate'](_0x3a1aaf[_0x4c87('0x2c')]);if(_0x110b84[_0x4c87('0x27')]>0x0){return _0x185590[_0x4c87('0x18')](0x190)[_0x4c87('0x2d')](_0x110b84);}var _0x58eb98=_0x3a1aaf[_0x4c87('0x2c')][_0x4c87('0x2e')];var _0x2f307a=_0x3a1aaf[_0x4c87('0x2c')]['callNumber'];var _0x2060f8=_0x3a1aaf[_0x4c87('0x2c')][_0x4c87('0x2f')];var _0x30fdba=_0x3a1aaf['body'][_0x4c87('0x30')];return getAgent(_0x58eb98)[_0x4c87('0x1b')](function(_0x5fb196){logger[_0x4c87('0x31')]('entityFound:',_0x5fb196['name']);emit(util[_0x4c87('0x32')]('user:%s',_0x5fb196[_0x4c87('0x16')]),_0x4c87('0x33'),{'callNumber':_0x2f307a,'callerId':_0x2060f8,'callbackUrl':_0x30fdba});return _0x185590[_0x4c87('0x18')](0xc8)[_0x4c87('0x2d')]({'error':![],'message':_0x4c87('0x34')});})['catch'](handleError(_0x185590));};exports[_0x4c87('0x35')]=function(_0x11a632,_0xcc73b5){logger['info']('hangup\x20fired:',_0x11a632[_0x4c87('0x2c')]);var _0x2da03f=hangupValidation[_0x4c87('0x36')](_0x11a632['body']);if(_0x2da03f[_0x4c87('0x27')]>0x0){return _0xcc73b5['status'](0x190)['json'](_0x2da03f);}var _0x5bbd35=_0x11a632[_0x4c87('0x2c')][_0x4c87('0x2e')];var _0x2de50d=_0x11a632['body'][_0x4c87('0x26')];return getAgent(_0x5bbd35)[_0x4c87('0x1b')](function(_0x5de7b1){logger[_0x4c87('0x31')]('entityFound:',_0x5de7b1['name']);emit(util[_0x4c87('0x32')]('user:%s',_0x5de7b1[_0x4c87('0x16')]),_0x4c87('0x37'),{'sessionId':_0x2de50d});return _0xcc73b5['status'](0xc8)[_0x4c87('0x2d')]({'error':![],'message':_0x4c87('0x38')});})['catch'](handleError(_0xcc73b5));};exports[_0x4c87('0x39')]=function(_0x5a70b7,_0x521944){logger[_0x4c87('0x31')]('answer\x20fired:',_0x5a70b7['body']);var _0x35c74b=answerValidation[_0x4c87('0x36')](_0x5a70b7['body']);if(_0x35c74b[_0x4c87('0x27')]>0x0){return _0x521944[_0x4c87('0x18')](0x190)[_0x4c87('0x2d')](_0x35c74b);}var _0x45b950=_0x5a70b7['body'][_0x4c87('0x2e')];var _0x448208=_0x5a70b7[_0x4c87('0x2c')][_0x4c87('0x26')];return getAgent(_0x45b950)['then'](function(_0x33716e){logger[_0x4c87('0x31')](_0x4c87('0x3a'),_0x33716e['name']);emit(util[_0x4c87('0x32')](_0x4c87('0x3b'),_0x33716e[_0x4c87('0x16')]),_0x4c87('0x3c'),{'sessionId':_0x448208});return _0x521944['status'](0xc8)[_0x4c87('0x2d')]({'error':![],'message':_0x4c87('0x3d')});})[_0x4c87('0x1f')](handleError(_0x521944));};exports['hold']=function(_0x507686,_0x41cfe9){logger[_0x4c87('0x31')](_0x4c87('0x3e'),_0x507686[_0x4c87('0x2c')]);var _0x52bac1=holdValidation['validate'](_0x507686[_0x4c87('0x2c')]);if(_0x52bac1[_0x4c87('0x27')]>0x0){return _0x41cfe9[_0x4c87('0x18')](0x190)[_0x4c87('0x2d')](_0x52bac1);}var _0x2c7eef=_0x507686[_0x4c87('0x2c')][_0x4c87('0x2e')];var _0x290761=_0x507686[_0x4c87('0x2c')][_0x4c87('0x26')];return getAgent(_0x2c7eef)['then'](function(_0x20f4f2){logger[_0x4c87('0x31')](_0x4c87('0x3a'),_0x20f4f2[_0x4c87('0x16')]);emit(util['format'](_0x4c87('0x3b'),_0x20f4f2[_0x4c87('0x16')]),_0x4c87('0x3f'),{'sessionId':_0x290761});return _0x41cfe9['status'](0xc8)[_0x4c87('0x2d')]({'error':![],'message':_0x4c87('0x40')});})[_0x4c87('0x1f')](handleError(_0x41cfe9));};exports['unhold']=function(_0x31f23a,_0x1b5843){logger[_0x4c87('0x31')]('unhold\x20fired:',_0x31f23a['body']);var _0x578b39=unholdValidation['validate'](_0x31f23a['body']);if(_0x578b39[_0x4c87('0x27')]>0x0){return _0x1b5843[_0x4c87('0x18')](0x190)['json'](_0x578b39);}var _0x59545c=_0x31f23a[_0x4c87('0x2c')][_0x4c87('0x2e')];var _0x205419=_0x31f23a[_0x4c87('0x2c')][_0x4c87('0x26')];return getAgent(_0x59545c)[_0x4c87('0x1b')](function(_0x64642a){logger[_0x4c87('0x31')]('entityFound:',_0x64642a['name']);emit(util[_0x4c87('0x32')](_0x4c87('0x3b'),_0x64642a[_0x4c87('0x16')]),_0x4c87('0x41'),{'sessionId':_0x205419});return _0x1b5843[_0x4c87('0x18')](0xc8)[_0x4c87('0x2d')]({'error':![],'message':_0x4c87('0x42')});})[_0x4c87('0x1f')](handleError(_0x1b5843));};exports[_0x4c87('0x43')]=function(_0x2a4bf1,_0x4aa6e3){logger['info'](_0x4c87('0x44'),_0x4aa6e3['body']);var _0x3fae0d=callsValidation[_0x4c87('0x36')](_0x2a4bf1[_0x4c87('0x2c')]);if(_0x3fae0d['length']>0x0){return _0x4aa6e3[_0x4c87('0x18')](0x190)[_0x4c87('0x2d')](_0x3fae0d);}var _0x3d407a=_0x2a4bf1[_0x4c87('0x2c')][_0x4c87('0x2e')];var _0x67c32d=respondWithRpcPromise(_0x4c87('0x22'));var _0x4e552a=getAgent(_0x3d407a);return Promise['all']([_0x67c32d,_0x4e552a])[_0x4c87('0x1b')](function(_0x2fb4a){var _0x253e8b=_0x2fb4a[0x0];var _0x197c0d=_0x2fb4a[0x1];var _0x16be71=_[_0x4c87('0x23')](_0x253e8b[_0x4c87('0x24')],function(_0x1f7b9b){return _0x1f7b9b[_0x4c87('0x25')]==_0x197c0d['id'];});return _0x4aa6e3[_0x4c87('0x18')](0xc8)[_0x4c87('0x2d')]({'count':_0x16be71[_0x4c87('0x27')],'rows':_0x16be71});})[_0x4c87('0x1f')](handleError(_0x4aa6e3));};exports['conference']=function(_0x37b319,_0x24c52a){logger[_0x4c87('0x31')](_0x4c87('0x45'),_0x37b319[_0x4c87('0x2c')]);var _0x1d71e5=conferenceValidation[_0x4c87('0x36')](_0x37b319['body']);if(_0x1d71e5['length']>0x0){return _0x24c52a[_0x4c87('0x18')](0x190)['json'](_0x1d71e5);}var _0x53e6ba=_0x37b319['body'][_0x4c87('0x2e')];return getAgent(_0x53e6ba)[_0x4c87('0x1b')](function(_0x20c0b6){logger[_0x4c87('0x31')](_0x4c87('0x3a'),_0x20c0b6['name']);emit(util['format'](_0x4c87('0x3b'),_0x20c0b6['name']),'webbar:conference');return _0x24c52a['status'](0xc8)[_0x4c87('0x2d')]({'error':![],'message':_0x4c87('0x46')});})[_0x4c87('0x1f')](handleError(_0x24c52a));};exports[_0x4c87('0x47')]=function(_0x44a2c7,_0x4ed555){logger['info'](_0x4c87('0x48'),_0x44a2c7[_0x4c87('0x2c')]);var _0xdf24be=transferValidation[_0x4c87('0x36')](_0x44a2c7['body']);if(_0xdf24be['length']>0x0){return _0x4ed555[_0x4c87('0x18')](0x190)['json'](_0xdf24be);}var _0x30773f=_0x44a2c7[_0x4c87('0x2c')]['userId'];var _0x10b898=_0x44a2c7['body'][_0x4c87('0x26')];var _0x38dfad=_0x44a2c7[_0x4c87('0x2c')][_0x4c87('0x49')];return getAgent(_0x30773f)['then'](function(_0x44a493){logger[_0x4c87('0x31')](_0x4c87('0x3a'),_0x44a493[_0x4c87('0x16')]);emit(util[_0x4c87('0x32')](_0x4c87('0x3b'),_0x44a493['name']),'webbar:transfer',{'sessionId':_0x10b898,'transferNumber':_0x38dfad});return _0x4ed555[_0x4c87('0x18')](0xc8)[_0x4c87('0x2d')]({'error':![],'message':_0x4c87('0x4a')});})['catch'](handleError(_0x4ed555));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index c277c9e..41732a0 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 _0xda2d=['/:id','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','util','path','connect-timeout','express','Router','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addApplications','/:id/notify','notify','/:id/send','send','put','delete'];(function(_0x313754,_0x147f5e){var _0x5a3f2a=function(_0x28267e){while(--_0x28267e){_0x313754['push'](_0x313754['shift']());}};_0x5a3f2a(++_0x147f5e);}(_0xda2d,0x102));var _0xdda2=function(_0xd4589a,_0x4d1c63){_0xd4589a=_0xd4589a-0x0;var _0xa2b8ee=_0xda2d[_0xd4589a];return _0xa2b8ee;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0x7')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xc')]);router['get'](_0xdda2('0xd'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xe')]);router[_0xdda2('0x7')](_0xdda2('0xf'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x10')]);router[_0xdda2('0x7')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xdda2('0x7')](_0xdda2('0x11'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x12')]);router[_0xdda2('0x13')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x14')]);router['post'](_0xdda2('0xd'),auth['isAuthenticated'](),controller[_0xdda2('0x15')]);router[_0xdda2('0x13')](_0xdda2('0xf'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x16')]);router['post']('/:id/users',auth[_0xdda2('0x8')](),controller['addAgents']);router[_0xdda2('0x13')](_0xdda2('0x11'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x17')]);router[_0xdda2('0x13')](_0xdda2('0x18'),controller[_0xdda2('0x19')]);router[_0xdda2('0x13')](_0xdda2('0x1a'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x1b')]);router[_0xdda2('0x1c')]('/:id',auth[_0xdda2('0x8')](),controller['update']);router[_0xdda2('0x1d')](_0xdda2('0x1e'),auth[_0xdda2('0x8')](),controller['destroy']);router[_0xdda2('0x1d')]('/:id/dispositions',auth[_0xdda2('0x8')](),controller[_0xdda2('0x1f')]);router['delete'](_0xdda2('0xf'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x20')]);router[_0xdda2('0x1d')](_0xdda2('0x21'),auth['isAuthenticated'](),controller[_0xdda2('0x22')]);module[_0xdda2('0x23')]=router; \ No newline at end of file +var _0xb016=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getApplications','addAnswer','post','addAgents','/:id/applications','addApplications','/:id/notify','notify','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','express','fs-extra','../../components/auth/service'];(function(_0x150951,_0x2bad7b){var _0x30b506=function(_0x51fec4){while(--_0x51fec4){_0x150951['push'](_0x150951['shift']());}};_0x30b506(++_0x2bad7b);}(_0xb016,0x159));var _0x6b01=function(_0x32bcaf,_0xccc961){_0x32bcaf=_0x32bcaf-0x0;var _0x25867f=_0xb016[_0x32bcaf];return _0x25867f;};'use strict';var multer=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6b01('0x2'));var router=express['Router']();var fs_extra=require(_0x6b01('0x3'));var auth=require(_0x6b01('0x4'));var interaction=require(_0x6b01('0x5'));var config=require(_0x6b01('0x6'));var controller=require('./whatsappAccount.controller');router[_0x6b01('0x7')]('/',auth[_0x6b01('0x8')](),controller[_0x6b01('0x9')]);router['get']('/describe',auth[_0x6b01('0x8')](),controller[_0x6b01('0xa')]);router['get']('/:id',auth[_0x6b01('0x8')](),controller[_0x6b01('0xb')]);router[_0x6b01('0x7')](_0x6b01('0xc'),auth[_0x6b01('0x8')](),controller['getDispositions']);router['get'](_0x6b01('0xd'),auth[_0x6b01('0x8')](),controller[_0x6b01('0xe')]);router['get'](_0x6b01('0xf'),auth['isAuthenticated'](),controller['getAgents']);router[_0x6b01('0x7')]('/:id/applications',auth[_0x6b01('0x8')](),controller[_0x6b01('0x10')]);router['post']('/',auth[_0x6b01('0x8')](),controller['create']);router['post']('/:id/dispositions',auth[_0x6b01('0x8')](),controller['addDisposition']);router['post'](_0x6b01('0xd'),auth[_0x6b01('0x8')](),controller[_0x6b01('0x11')]);router[_0x6b01('0x12')](_0x6b01('0xf'),auth[_0x6b01('0x8')](),controller[_0x6b01('0x13')]);router[_0x6b01('0x12')](_0x6b01('0x14'),auth[_0x6b01('0x8')](),controller[_0x6b01('0x15')]);router['post'](_0x6b01('0x16'),controller[_0x6b01('0x17')]);router[_0x6b01('0x12')](_0x6b01('0x18'),auth[_0x6b01('0x8')](),controller[_0x6b01('0x19')]);router[_0x6b01('0x1a')](_0x6b01('0x1b'),auth['isAuthenticated'](),controller[_0x6b01('0x1c')]);router[_0x6b01('0x1d')](_0x6b01('0x1b'),auth[_0x6b01('0x8')](),controller[_0x6b01('0x1e')]);router[_0x6b01('0x1d')](_0x6b01('0xc'),auth['isAuthenticated'](),controller[_0x6b01('0x1f')]);router[_0x6b01('0x1d')](_0x6b01('0xd'),auth['isAuthenticated'](),controller[_0x6b01('0x20')]);router[_0x6b01('0x1d')](_0x6b01('0xf'),auth[_0x6b01('0x8')](),controller[_0x6b01('0x21')]);module[_0x6b01('0x22')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 509d3f7..1a71a56 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 _0x43b2=['BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','STRING','name','generate','ENUM','twilio','INTEGER'];(function(_0x4e9ebf,_0x349fc1){var _0x9f7e65=function(_0x2a1ea4){while(--_0x2a1ea4){_0x4e9ebf['push'](_0x4e9ebf['shift']());}};_0x9f7e65(++_0x349fc1);}(_0x43b2,0x1a6));var _0x243b=function(_0x55ceb7,_0x9c967){_0x55ceb7=_0x55ceb7-0x0;var _0x383ee8=_0x43b2[_0x55ceb7];return _0x383ee8;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x243b('0x0'));module['exports']={'name':{'type':Sequelize[_0x243b('0x1')],'unique':_0x243b('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x243b('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x243b('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x243b('0x1')],'defaultValue':function(){return rs[_0x243b('0x3')]();}},'phone':{'type':Sequelize[_0x243b('0x1')]},'type':{'type':Sequelize[_0x243b('0x4')](_0x243b('0x5'),'sinch')},'accountSid':{'type':Sequelize[_0x243b('0x1')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x243b('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x243b('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x243b('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x243b('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x243b('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x243b('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x243b('0x6')],'comment':_0x243b('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x243b('0x7')],'defaultValue':![],'comment':_0x243b('0x9'),'set':function(_0x3faf73){if(!_0x3faf73){this[_0x243b('0xa')](_0x243b('0xb'),null);}this[_0x243b('0xa')](_0x243b('0xc'),_0x3faf73);}},'description':{'type':Sequelize[_0x243b('0x1')]}}; \ No newline at end of file +var _0x25ed=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x2e8e20,_0x24dd51){var _0xb0dccd=function(_0x50ec62){while(--_0x50ec62){_0x2e8e20['push'](_0x2e8e20['shift']());}};_0xb0dccd(++_0x24dd51);}(_0x25ed,0x10e));var _0xd25e=function(_0x3c3770,_0x17a17b){_0x3c3770=_0x3c3770-0x0;var _0x57121a=_0x25ed[_0x3c3770];return _0x57121a;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xd25e('0x0'));module[_0xd25e('0x1')]={'name':{'type':Sequelize[_0xd25e('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xd25e('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xd25e('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xd25e('0x3')]();}},'phone':{'type':Sequelize[_0xd25e('0x2')]},'type':{'type':Sequelize[_0xd25e('0x4')](_0xd25e('0x5'),'sinch')},'accountSid':{'type':Sequelize[_0xd25e('0x2')]},'baseUrl':{'type':Sequelize[_0xd25e('0x2')]},'authToken':{'type':Sequelize[_0xd25e('0x2')]},'notificationTemplate':{'type':Sequelize[_0xd25e('0x6')],'defaultValue':function(){return _0xd25e('0x7');}},'notificationSound':{'type':Sequelize[_0xd25e('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xd25e('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd25e('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd25e('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd25e('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd25e('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd25e('0x9')],'comment':_0xd25e('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xd25e('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x490080){if(!_0x490080){this[_0xd25e('0xb')](_0xd25e('0xc'),null);}this['setDataValue'](_0xd25e('0xd'),_0x490080);}},'description':{'type':Sequelize[_0xd25e('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index a86dcc5..5a5150f 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 _0x0b00=['WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','List','DESC','out','spread','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','http','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','WhatsappAccount,\x20%s,\x20%s','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','WhatsappAccounts','UserProfileResource','destroy','end','sendStatus','name','send','Pause','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','getDispositions','WhatsappAccountId','ids','addAnswer','CannedAnswer','getAnswers','addAgents','omit','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','findOne','User','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','stack','getApplications','notify','Applications','account','sinch','statuses','timestamp','message_id','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','notifications','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','list','Contacts','contact','WhatsappInteraction','interaction','applications','push','close','*,*,*,*','created','WhatsappMessage','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','entity\x20found'];(function(_0x2ab885,_0xe6b420){var _0x16e9f4=function(_0x219076){while(--_0x219076){_0x2ab885['push'](_0x2ab885['shift']());}};_0x16e9f4(++_0xe6b420);}(_0x0b00,0xcf));var _0x00b0=function(_0x3aa10c,_0x38c286){_0x3aa10c=_0x3aa10c-0x0;var _0x4da769=_0x0b00[_0x3aa10c];return _0x4da769;};'use strict';var emlformat=require(_0x00b0('0x0'));var rimraf=require(_0x00b0('0x1'));var zipdir=require(_0x00b0('0x2'));var jsonpatch=require(_0x00b0('0x3'));var rp=require(_0x00b0('0x4'));var moment=require('moment');var BPromise=require(_0x00b0('0x5'));var Mustache=require(_0x00b0('0x6'));var util=require(_0x00b0('0x7'));var path=require('path');var sox=require(_0x00b0('0x8'));var csv=require(_0x00b0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x00b0('0xa'));var _=require(_0x00b0('0xb'));var squel=require(_0x00b0('0xc'));var crypto=require(_0x00b0('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x00b0('0x9'));var querystring=require('querystring');var Papa=require(_0x00b0('0xe'));var Redis=require(_0x00b0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x00b0('0x10'));var as=require(_0x00b0('0x11'));var hardwareService=require(_0x00b0('0x12'));var logger=require('../../config/logger')(_0x00b0('0x13'));var utils=require(_0x00b0('0x14'));var config=require(_0x00b0('0x15'));var licenseUtil=require(_0x00b0('0x16'));var db=require(_0x00b0('0x17'))['db'];config[_0x00b0('0x18')]=_[_0x00b0('0x19')](config[_0x00b0('0x18')],{'host':_0x00b0('0x1a'),'port':0x18eb});var socket=require(_0x00b0('0x1b'))(new Redis(config[_0x00b0('0x18')]));require(_0x00b0('0x1c'))['register'](socket);var jayson=require(_0x00b0('0x1d'));var client=jayson[_0x00b0('0x1e')][_0x00b0('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x799490,_0x4c35b0,_0x3fbed9,_0x407656){return new BPromise(function(_0x47b1cf,_0xe4c63b){var _0x408671=_0x407656||client;return _0x408671[_0x00b0('0x20')](_0x799490,_0x3fbed9)[_0x00b0('0x21')](function(_0x386c84){logger[_0x00b0('0x22')]('WhatsappAccount,\x20%s,\x20%s',_0x4c35b0,_0x00b0('0x23'));logger[_0x00b0('0x24')](_0x00b0('0x25'),_0x4c35b0,_0x00b0('0x23'),JSON[_0x00b0('0x26')](_0x386c84));if(_0x386c84[_0x00b0('0x27')]){if(_0x386c84[_0x00b0('0x27')][_0x00b0('0x28')]===0x1f4){logger[_0x00b0('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x4c35b0,_0x386c84['error'][_0x00b0('0x29')]);return _0xe4c63b(_0x386c84[_0x00b0('0x27')]['message']);}logger[_0x00b0('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x4c35b0,_0x386c84['error'][_0x00b0('0x29')]);return _0x47b1cf(_0x386c84[_0x00b0('0x27')][_0x00b0('0x29')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x4c35b0,_0x00b0('0x23'));_0x47b1cf(_0x386c84[_0x00b0('0x2a')]['message']);}})['catch'](function(_0x57a17a){logger['error'](_0x00b0('0x2b'),_0x4c35b0,_0x57a17a);_0xe4c63b(_0x57a17a);});});}function respondWithStatusCode(_0x47f213,_0x30e6d7){_0x30e6d7=_0x30e6d7||0xcc;return function(_0x19ca86){if(_0x19ca86){return _0x47f213['sendStatus'](_0x30e6d7);}return _0x47f213[_0x00b0('0x2c')](_0x30e6d7)['end']();};}function respondWithResult(_0x1c842b,_0x24f99d){_0x24f99d=_0x24f99d||0xc8;return function(_0x336fe0){if(_0x336fe0){return _0x1c842b[_0x00b0('0x2c')](_0x24f99d)['json'](_0x336fe0);}};}function respondWithFilteredResult(_0x1f9f5c,_0x3a88d5){return function(_0x4c48e1){if(_0x4c48e1){var _0xe9e92d=typeof _0x3a88d5[_0x00b0('0x2d')]===_0x00b0('0x2e')&&typeof _0x3a88d5['limit']==='undefined';var _0x170abe=_0x4c48e1['count'];var _0x738a03=_0xe9e92d?0x0:_0x3a88d5['offset'];var _0x24f7e5=_0xe9e92d?_0x4c48e1[_0x00b0('0x2f')]:_0x3a88d5[_0x00b0('0x2d')]+_0x3a88d5[_0x00b0('0x30')];var _0x9a8f51;if(_0x24f7e5>=_0x170abe){_0x24f7e5=_0x170abe;_0x9a8f51=0xc8;}else{_0x9a8f51=0xce;}_0x1f9f5c[_0x00b0('0x2c')](_0x9a8f51);return _0x1f9f5c[_0x00b0('0x31')](_0x00b0('0x32'),_0x738a03+'-'+_0x24f7e5+'/'+_0x170abe)[_0x00b0('0x33')](_0x4c48e1);}return null;};}function patchUpdates(_0x3d0055){return function(_0xe0cc5d){try{jsonpatch[_0x00b0('0x34')](_0xe0cc5d,_0x3d0055,!![]);}catch(_0x150d38){return BPromise[_0x00b0('0x35')](_0x150d38);}return _0xe0cc5d[_0x00b0('0x36')]();};}function saveUpdates(_0x2a072a,_0x32b710){return function(_0x288123){if(_0x288123){return _0x288123[_0x00b0('0x37')](_0x2a072a)[_0x00b0('0x21')](function(_0x260ab9){return _0x260ab9;});}return null;};}function removeEntity(_0x4287b7,_0x32469e){return function(_0x4f1433){if(_0x4f1433){return _0x4f1433['destroy']()[_0x00b0('0x21')](function(){var _0x2cb537=_0x4f1433['get']({'plain':!![]});var _0x105e87=_0x00b0('0x38');return db[_0x00b0('0x39')][_0x00b0('0x3a')]({'where':{'type':_0x105e87,'resourceId':_0x2cb537['id']}})['then'](function(){return _0x4f1433;});})['then'](function(){_0x4287b7[_0x00b0('0x2c')](0xcc)[_0x00b0('0x3b')]();});}};}function handleEntityNotFound(_0x216fc4,_0x1ac05d){return function(_0x32c6ae){if(!_0x32c6ae){_0x216fc4[_0x00b0('0x3c')](0x194);}return _0x32c6ae;};}function handleError(_0x362803,_0xfc40bf){_0xfc40bf=_0xfc40bf||0x1f4;return function(_0x23da73){logger['error'](_0x23da73['stack']);if(_0x23da73[_0x00b0('0x3d')]){delete _0x23da73[_0x00b0('0x3d')];}_0x362803[_0x00b0('0x2c')](_0xfc40bf)[_0x00b0('0x3e')](_0x23da73);};}exports['index']=function(_0x1fce07,_0x5211f5){var _0x4eff18={'include':[{'model':db[_0x00b0('0x3f')],'as':_0x00b0('0x40')}]},_0x2eb405={},_0x58373a={'count':0x0,'rows':[]};var _0x269caa=_[_0x00b0('0x41')](db[_0x00b0('0x42')]['rawAttributes'],function(_0x5eb90a){return{'name':_0x5eb90a[_0x00b0('0x43')],'type':_0x5eb90a[_0x00b0('0x44')][_0x00b0('0x45')]};});_0x2eb405[_0x00b0('0x46')]=_[_0x00b0('0x41')](_0x269caa,_0x00b0('0x3d'));_0x2eb405[_0x00b0('0x47')]=_[_0x00b0('0x48')](_0x1fce07['query']);_0x2eb405['filters']=_[_0x00b0('0x49')](_0x2eb405['model'],_0x2eb405[_0x00b0('0x47')]);_0x4eff18[_0x00b0('0x4a')]=_[_0x00b0('0x49')](_0x2eb405[_0x00b0('0x46')],qs[_0x00b0('0x4b')](_0x1fce07[_0x00b0('0x47')][_0x00b0('0x4b')]));_0x4eff18[_0x00b0('0x4a')]=_0x4eff18[_0x00b0('0x4a')][_0x00b0('0x4c')]?_0x4eff18[_0x00b0('0x4a')]:_0x2eb405[_0x00b0('0x46')];if(!_0x1fce07[_0x00b0('0x47')][_0x00b0('0x4d')](_0x00b0('0x4e'))){_0x4eff18[_0x00b0('0x30')]=qs[_0x00b0('0x30')](_0x1fce07[_0x00b0('0x47')][_0x00b0('0x30')]);_0x4eff18[_0x00b0('0x2d')]=qs[_0x00b0('0x2d')](_0x1fce07['query']['offset']);}_0x4eff18[_0x00b0('0x4f')]=qs[_0x00b0('0x50')](_0x1fce07[_0x00b0('0x47')][_0x00b0('0x50')]);_0x4eff18[_0x00b0('0x51')]=qs[_0x00b0('0x52')](_[_0x00b0('0x53')](_0x1fce07[_0x00b0('0x47')],_0x2eb405[_0x00b0('0x52')]),_0x269caa);if(_0x1fce07['query'][_0x00b0('0x54')]){_0x4eff18['where']=_[_0x00b0('0x55')](_0x4eff18[_0x00b0('0x51')],{'$or':_[_0x00b0('0x41')](_0x269caa,function(_0x43c5c5){if(_0x43c5c5[_0x00b0('0x44')]!==_0x00b0('0x56')){var _0x58d746={};_0x58d746[_0x43c5c5[_0x00b0('0x3d')]]={'$like':'%'+_0x1fce07[_0x00b0('0x47')][_0x00b0('0x54')]+'%'};return _0x58d746;}})});}_0x4eff18=_[_0x00b0('0x55')]({},_0x4eff18,_0x1fce07[_0x00b0('0x57')]);var _0x2b9385={'where':_0x4eff18[_0x00b0('0x51')]};return db[_0x00b0('0x42')][_0x00b0('0x2f')](_0x2b9385)['then'](function(_0x4278a6){_0x58373a[_0x00b0('0x2f')]=_0x4278a6;if(_0x1fce07[_0x00b0('0x47')][_0x00b0('0x58')]){_0x4eff18[_0x00b0('0x59')]=[{'all':!![]}];}return db[_0x00b0('0x42')][_0x00b0('0x5a')](_0x4eff18);})[_0x00b0('0x21')](function(_0x504eeb){_0x58373a[_0x00b0('0x5b')]=_0x504eeb;return _0x58373a;})['then'](respondWithFilteredResult(_0x5211f5,_0x4eff18))['catch'](handleError(_0x5211f5,null));};exports[_0x00b0('0x5c')]=function(_0x58eb5f,_0x3b4e2c){var _0x466829={'raw':![],'where':{'id':_0x58eb5f[_0x00b0('0x5d')]['id']},'include':[{'model':db[_0x00b0('0x3f')],'as':_0x00b0('0x40')}]},_0x4be686={};_0x4be686[_0x00b0('0x46')]=_['keys'](db[_0x00b0('0x42')][_0x00b0('0x5e')]);_0x4be686['query']=_['keys'](_0x58eb5f[_0x00b0('0x47')]);_0x4be686[_0x00b0('0x52')]=_['intersection'](_0x4be686[_0x00b0('0x46')],_0x4be686[_0x00b0('0x47')]);_0x466829[_0x00b0('0x4a')]=_[_0x00b0('0x49')](_0x4be686[_0x00b0('0x46')],qs[_0x00b0('0x4b')](_0x58eb5f[_0x00b0('0x47')]['fields']));_0x466829[_0x00b0('0x4a')]=_0x466829[_0x00b0('0x4a')][_0x00b0('0x4c')]?_0x466829[_0x00b0('0x4a')]:_0x4be686['model'];if(_0x58eb5f['query'][_0x00b0('0x58')]){_0x466829[_0x00b0('0x59')]=[{'all':!![]}];}_0x466829=_[_0x00b0('0x55')]({},_0x466829,_0x58eb5f['options']);return db[_0x00b0('0x42')][_0x00b0('0x5f')](_0x466829)[_0x00b0('0x21')](handleEntityNotFound(_0x3b4e2c,null))[_0x00b0('0x21')](respondWithResult(_0x3b4e2c,null))['catch'](handleError(_0x3b4e2c,null));};exports[_0x00b0('0x60')]=function(_0x5ea73c,_0x928609){return db[_0x00b0('0x42')][_0x00b0('0x60')](_0x5ea73c[_0x00b0('0x61')],{})[_0x00b0('0x21')](function(_0x3dfab2){var _0x43e7e2=_0x5ea73c[_0x00b0('0x62')][_0x00b0('0x63')]({'plain':!![]});if(!_0x43e7e2)throw new Error(_0x00b0('0x64'));if(_0x43e7e2['role']===_0x00b0('0x62')){var _0x22bcb7=_0x3dfab2[_0x00b0('0x63')]({'plain':!![]});var _0x5ad8b3=_0x00b0('0x38');return db[_0x00b0('0x65')][_0x00b0('0x5f')]({'where':{'name':_0x5ad8b3,'userProfileId':_0x43e7e2[_0x00b0('0x66')]},'raw':!![]})['then'](function(_0x3603f3){if(_0x3603f3&&_0x3603f3[_0x00b0('0x67')]===0x0){return db[_0x00b0('0x39')][_0x00b0('0x60')]({'name':_0x22bcb7['name'],'resourceId':_0x22bcb7['id'],'type':_0x3603f3['name'],'sectionId':_0x3603f3['id']},{})['then'](function(){return _0x3dfab2;});}else{return _0x3dfab2;}})[_0x00b0('0x68')](function(_0x53a541){logger[_0x00b0('0x27')](_0x00b0('0x69'),_0x53a541);throw _0x53a541;});}return _0x3dfab2;})[_0x00b0('0x21')](respondWithResult(_0x928609,0xc9))[_0x00b0('0x68')](handleError(_0x928609,null));};exports[_0x00b0('0x37')]=function(_0x1e92c1,_0x317c14){if(_0x1e92c1[_0x00b0('0x61')]['id']){delete _0x1e92c1[_0x00b0('0x61')]['id'];}return db[_0x00b0('0x42')][_0x00b0('0x5f')]({'where':{'id':_0x1e92c1['params']['id']},'include':[{'model':db[_0x00b0('0x3f')],'as':'mandatoryDispositionPause'}]})[_0x00b0('0x21')](handleEntityNotFound(_0x317c14,null))[_0x00b0('0x21')](saveUpdates(_0x1e92c1['body'],null))[_0x00b0('0x21')](respondWithResult(_0x317c14,null))[_0x00b0('0x68')](handleError(_0x317c14,null));};exports[_0x00b0('0x3a')]=function(_0x4c9221,_0x3c3068){return db[_0x00b0('0x42')][_0x00b0('0x5f')]({'where':{'id':_0x4c9221[_0x00b0('0x5d')]['id']}})[_0x00b0('0x21')](handleEntityNotFound(_0x3c3068,null))[_0x00b0('0x21')](removeEntity(_0x3c3068,null))[_0x00b0('0x68')](handleError(_0x3c3068,null));};exports[_0x00b0('0x6a')]=function(_0xd6de80,_0x1d9f48){return db['WhatsappAccount'][_0x00b0('0x6a')]()[_0x00b0('0x21')](respondWithResult(_0x1d9f48,null))[_0x00b0('0x68')](handleError(_0x1d9f48,null));};exports[_0x00b0('0x6b')]=function(_0x5b6033,_0x4e5832,_0x29edf){if(_0x5b6033[_0x00b0('0x61')]['id']){delete _0x5b6033['body']['id'];}return db[_0x00b0('0x42')]['find']({'where':{'id':_0x5b6033[_0x00b0('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4e5832,null))[_0x00b0('0x21')](function(_0x58f673){if(_0x58f673){_0x5b6033[_0x00b0('0x61')]['WhatsappAccountId']=_0x58f673['id'];return db['Disposition']['create'](_0x5b6033[_0x00b0('0x61')]);}})['then'](respondWithResult(_0x4e5832,null))[_0x00b0('0x68')](handleError(_0x4e5832,null));};exports[_0x00b0('0x6c')]=function(_0x4ab650,_0x58231b,_0x3949e1){var _0x24aa54={'raw':![],'where':{}};var _0x25f4d4={};var _0x16fa11={'count':0x0,'rows':[]};return db[_0x00b0('0x42')]['findOne']({'where':{'id':_0x4ab650['params']['id']}})[_0x00b0('0x21')](handleEntityNotFound(_0x58231b,null))[_0x00b0('0x21')](function(_0x4cb022){if(_0x4cb022){_0x25f4d4['model']=_[_0x00b0('0x48')](db['Disposition']['rawAttributes']);_0x25f4d4[_0x00b0('0x47')]=_['keys'](_0x4ab650['query']);_0x25f4d4['filters']=_[_0x00b0('0x49')](_0x25f4d4[_0x00b0('0x46')],_0x25f4d4[_0x00b0('0x47')]);_0x24aa54[_0x00b0('0x4a')]=_[_0x00b0('0x49')](_0x25f4d4[_0x00b0('0x46')],qs[_0x00b0('0x4b')](_0x4ab650[_0x00b0('0x47')][_0x00b0('0x4b')]));_0x24aa54[_0x00b0('0x4a')]=_0x24aa54[_0x00b0('0x4a')][_0x00b0('0x4c')]?_0x24aa54[_0x00b0('0x4a')]:_0x25f4d4['model'];if(!_0x4ab650[_0x00b0('0x47')][_0x00b0('0x4d')]('nolimit')){_0x24aa54['limit']=qs[_0x00b0('0x30')](_0x4ab650[_0x00b0('0x47')]['limit']);_0x24aa54[_0x00b0('0x2d')]=qs[_0x00b0('0x2d')](_0x4ab650[_0x00b0('0x47')][_0x00b0('0x2d')]);}_0x24aa54[_0x00b0('0x4f')]=qs['sort'](_0x4ab650[_0x00b0('0x47')][_0x00b0('0x50')]);_0x24aa54[_0x00b0('0x51')]=qs[_0x00b0('0x52')](_[_0x00b0('0x53')](_0x4ab650[_0x00b0('0x47')],_0x25f4d4[_0x00b0('0x52')]));_0x24aa54[_0x00b0('0x51')][_0x00b0('0x6d')]=_0x4cb022['id'];if(_0x4ab650['query'][_0x00b0('0x54')]){_0x24aa54[_0x00b0('0x51')]=_['merge'](_0x24aa54[_0x00b0('0x51')],{'$or':_[_0x00b0('0x41')](_0x24aa54[_0x00b0('0x4a')],function(_0x466a47){var _0x21edfa={};_0x21edfa[_0x466a47]={'$like':'%'+_0x4ab650['query'][_0x00b0('0x54')]+'%'};return _0x21edfa;})});}_0x24aa54=_[_0x00b0('0x55')]({},_0x24aa54,_0x4ab650[_0x00b0('0x57')]);return db['Disposition'][_0x00b0('0x2f')]({'where':_0x24aa54[_0x00b0('0x51')]})['then'](function(_0x431931){_0x16fa11[_0x00b0('0x2f')]=_0x431931;if(_0x4ab650[_0x00b0('0x47')][_0x00b0('0x58')]){_0x24aa54['include']=[{'all':!![]}];}return db['Disposition'][_0x00b0('0x5a')](_0x24aa54);})[_0x00b0('0x21')](function(_0x175bc7){_0x16fa11[_0x00b0('0x5b')]=_0x175bc7;return _0x16fa11;});}})[_0x00b0('0x21')](respondWithFilteredResult(_0x58231b,_0x24aa54))['catch'](handleError(_0x58231b,null));};exports['removeDispositions']=function(_0xe277f3,_0x18e1e1,_0x1551f3){return db['WhatsappAccount'][_0x00b0('0x5f')]({'where':{'id':_0xe277f3[_0x00b0('0x5d')]['id']}})[_0x00b0('0x21')](handleEntityNotFound(_0x18e1e1,null))[_0x00b0('0x21')](function(_0x882bda){if(_0x882bda){return _0x882bda['removeDispositions'](_0xe277f3[_0x00b0('0x47')][_0x00b0('0x6e')]);}})[_0x00b0('0x21')](respondWithStatusCode(_0x18e1e1,null))['catch'](handleError(_0x18e1e1,null));};exports[_0x00b0('0x6f')]=function(_0x514ed3,_0x5e7258,_0x350407){if(_0x514ed3[_0x00b0('0x61')]['id']){delete _0x514ed3[_0x00b0('0x61')]['id'];}return db[_0x00b0('0x42')]['find']({'where':{'id':_0x514ed3['params']['id']}})[_0x00b0('0x21')](handleEntityNotFound(_0x5e7258,null))[_0x00b0('0x21')](function(_0x3665b0){if(_0x3665b0){_0x514ed3[_0x00b0('0x61')][_0x00b0('0x6d')]=_0x3665b0['id'];return db[_0x00b0('0x70')][_0x00b0('0x60')](_0x514ed3[_0x00b0('0x61')]);}})['then'](respondWithResult(_0x5e7258,null))[_0x00b0('0x68')](handleError(_0x5e7258,null));};exports[_0x00b0('0x71')]=function(_0x111863,_0x292187,_0x4844aa){var _0x4555ef={'raw':![],'where':{}};var _0x142ccd={};var _0x4b1b92={'count':0x0,'rows':[]};return db[_0x00b0('0x42')]['findOne']({'where':{'id':_0x111863[_0x00b0('0x5d')]['id']}})['then'](handleEntityNotFound(_0x292187,null))[_0x00b0('0x21')](function(_0x2b8361){if(_0x2b8361){_0x142ccd[_0x00b0('0x46')]=_['keys'](db['CannedAnswer'][_0x00b0('0x5e')]);_0x142ccd['query']=_['keys'](_0x111863[_0x00b0('0x47')]);_0x142ccd[_0x00b0('0x52')]=_[_0x00b0('0x49')](_0x142ccd['model'],_0x142ccd[_0x00b0('0x47')]);_0x4555ef['attributes']=_[_0x00b0('0x49')](_0x142ccd['model'],qs[_0x00b0('0x4b')](_0x111863[_0x00b0('0x47')][_0x00b0('0x4b')]));_0x4555ef[_0x00b0('0x4a')]=_0x4555ef[_0x00b0('0x4a')][_0x00b0('0x4c')]?_0x4555ef[_0x00b0('0x4a')]:_0x142ccd[_0x00b0('0x46')];if(!_0x111863[_0x00b0('0x47')][_0x00b0('0x4d')](_0x00b0('0x4e'))){_0x4555ef['limit']=qs[_0x00b0('0x30')](_0x111863['query'][_0x00b0('0x30')]);_0x4555ef[_0x00b0('0x2d')]=qs[_0x00b0('0x2d')](_0x111863['query'][_0x00b0('0x2d')]);}_0x4555ef[_0x00b0('0x4f')]=qs['sort'](_0x111863[_0x00b0('0x47')]['sort']);_0x4555ef[_0x00b0('0x51')]=qs['filters'](_['pick'](_0x111863[_0x00b0('0x47')],_0x142ccd[_0x00b0('0x52')]));_0x4555ef['where']['WhatsappAccountId']=_0x2b8361['id'];if(_0x111863[_0x00b0('0x47')]['filter']){_0x4555ef['where']=_[_0x00b0('0x55')](_0x4555ef[_0x00b0('0x51')],{'$or':_[_0x00b0('0x41')](_0x4555ef[_0x00b0('0x4a')],function(_0x4938c7){var _0x518eda={};_0x518eda[_0x4938c7]={'$like':'%'+_0x111863['query'][_0x00b0('0x54')]+'%'};return _0x518eda;})});}_0x4555ef=_['merge']({},_0x4555ef,_0x111863[_0x00b0('0x57')]);return db[_0x00b0('0x70')][_0x00b0('0x2f')]({'where':_0x4555ef['where']})[_0x00b0('0x21')](function(_0x478418){_0x4b1b92[_0x00b0('0x2f')]=_0x478418;if(_0x111863['query'][_0x00b0('0x58')]){_0x4555ef['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x00b0('0x5a')](_0x4555ef);})['then'](function(_0x12d415){_0x4b1b92[_0x00b0('0x5b')]=_0x12d415;return _0x4b1b92;});}})['then'](respondWithFilteredResult(_0x292187,_0x4555ef))['catch'](handleError(_0x292187,null));};exports['removeAnswers']=function(_0x55123d,_0x280c90,_0x567bd5){return db['WhatsappAccount'][_0x00b0('0x5f')]({'where':{'id':_0x55123d[_0x00b0('0x5d')]['id']}})[_0x00b0('0x21')](handleEntityNotFound(_0x280c90,null))[_0x00b0('0x21')](function(_0x313a34){if(_0x313a34){return _0x313a34['removeAnswers'](_0x55123d[_0x00b0('0x47')]['ids']);}})[_0x00b0('0x21')](respondWithStatusCode(_0x280c90,null))[_0x00b0('0x68')](handleError(_0x280c90,null));};exports[_0x00b0('0x72')]=function(_0x3fba88,_0x260316,_0x3d5454){return db['WhatsappAccount'][_0x00b0('0x5f')]({'where':{'id':_0x3fba88[_0x00b0('0x5d')]['id']}})['then'](handleEntityNotFound(_0x260316,null))[_0x00b0('0x21')](function(_0x2d24e9){if(_0x2d24e9){return _0x2d24e9[_0x00b0('0x72')](_0x3fba88[_0x00b0('0x61')][_0x00b0('0x6e')],_[_0x00b0('0x73')](_0x3fba88['body'],[_0x00b0('0x6e'),'id'])||{})['spread'](function(_0x20634c){for(var _0x53c14c=0x0;_0x53c14c<_0x3fba88[_0x00b0('0x61')][_0x00b0('0x6e')][_0x00b0('0x4c')];_0x53c14c+=0x1){socket['emit'](_0x00b0('0x74'),{'UserId':Number(_0x3fba88[_0x00b0('0x61')]['ids'][_0x53c14c]),'WhatsappAccountId':Number(_0x3fba88[_0x00b0('0x5d')]['id'])});}return _0x20634c;});}})[_0x00b0('0x21')](respondWithResult(_0x260316,null))[_0x00b0('0x68')](handleError(_0x260316,null));};exports[_0x00b0('0x75')]=function(_0x33e9ae,_0x459940,_0x20df57){return db[_0x00b0('0x42')][_0x00b0('0x5f')]({'where':{'id':_0x33e9ae[_0x00b0('0x5d')]['id']}})['then'](handleEntityNotFound(_0x459940,null))[_0x00b0('0x21')](function(_0x13764a){if(_0x13764a){return _0x13764a[_0x00b0('0x75')](_0x33e9ae['query'][_0x00b0('0x6e')])[_0x00b0('0x21')](function(){if(_[_0x00b0('0x76')](_0x33e9ae[_0x00b0('0x47')]['ids'])){for(var _0x112b2a=0x0;_0x112b2a<_0x33e9ae['query']['ids'][_0x00b0('0x4c')];_0x112b2a+=0x1){socket[_0x00b0('0x77')]('userWhatsappAccount:remove',{'UserId':Number(_0x33e9ae[_0x00b0('0x47')][_0x00b0('0x6e')][_0x112b2a]),'WhatsappAccountId':Number(_0x33e9ae['params']['id'])});}}else{socket['emit'](_0x00b0('0x78'),{'UserId':Number(_0x33e9ae['query'][_0x00b0('0x6e')]),'WhatsappAccountId':Number(_0x33e9ae[_0x00b0('0x5d')]['id'])});}});}})[_0x00b0('0x21')](respondWithStatusCode(_0x459940,null))['catch'](handleError(_0x459940,null));};exports[_0x00b0('0x79')]=function(_0x4edb90,_0x4182da,_0x5ea1aa){var _0x1d7536={};var _0x5cdca8={};var _0x344317;var _0x22713d;return db[_0x00b0('0x42')][_0x00b0('0x7a')]({'where':{'id':_0x4edb90[_0x00b0('0x5d')]['id']}})[_0x00b0('0x21')](handleEntityNotFound(_0x4182da,null))[_0x00b0('0x21')](function(_0xe6b0d7){if(_0xe6b0d7){_0x344317=_0xe6b0d7;_0x5cdca8[_0x00b0('0x46')]=_[_0x00b0('0x48')](db[_0x00b0('0x7b')][_0x00b0('0x5e')]);_0x5cdca8[_0x00b0('0x47')]=_[_0x00b0('0x48')](_0x4edb90[_0x00b0('0x47')]);_0x5cdca8[_0x00b0('0x52')]=_[_0x00b0('0x49')](_0x5cdca8[_0x00b0('0x46')],_0x5cdca8[_0x00b0('0x47')]);_0x1d7536[_0x00b0('0x4a')]=_[_0x00b0('0x49')](_0x5cdca8['model'],qs[_0x00b0('0x4b')](_0x4edb90['query']['fields']));_0x1d7536[_0x00b0('0x4a')]=_0x1d7536[_0x00b0('0x4a')][_0x00b0('0x4c')]?_0x1d7536['attributes']:_0x5cdca8[_0x00b0('0x46')];_0x1d7536['order']=qs[_0x00b0('0x50')](_0x4edb90[_0x00b0('0x47')][_0x00b0('0x50')]);_0x1d7536[_0x00b0('0x51')]=qs[_0x00b0('0x52')](_[_0x00b0('0x53')](_0x4edb90[_0x00b0('0x47')],_0x5cdca8[_0x00b0('0x52')]));if(_0x4edb90[_0x00b0('0x47')][_0x00b0('0x54')]){_0x1d7536['where']=_[_0x00b0('0x55')](_0x1d7536['where'],{'$or':_[_0x00b0('0x41')](_0x1d7536['attributes'],function(_0x517990){var _0x55620b={};_0x55620b[_0x517990]={'$like':'%'+_0x4edb90['query'][_0x00b0('0x54')]+'%'};return _0x55620b;})});}_0x1d7536=_[_0x00b0('0x55')]({},_0x1d7536,_0x4edb90['options']);return _0x344317[_0x00b0('0x79')](_0x1d7536);}})['then'](function(_0x2d8583){if(_0x2d8583){_0x22713d=_0x2d8583[_0x00b0('0x4c')];if(!_0x4edb90[_0x00b0('0x47')]['hasOwnProperty'](_0x00b0('0x4e'))){_0x1d7536[_0x00b0('0x30')]=qs[_0x00b0('0x30')](_0x4edb90[_0x00b0('0x47')][_0x00b0('0x30')]);_0x1d7536[_0x00b0('0x2d')]=qs[_0x00b0('0x2d')](_0x4edb90[_0x00b0('0x47')][_0x00b0('0x2d')]);}return _0x344317[_0x00b0('0x79')](_0x1d7536);}})[_0x00b0('0x21')](function(_0x1cbeca){if(_0x1cbeca){return _0x1cbeca?{'count':_0x22713d,'rows':_0x1cbeca}:null;}})[_0x00b0('0x21')](respondWithResult(_0x4182da,null))[_0x00b0('0x68')](handleError(_0x4182da,null));};exports['addApplications']=function(_0x101942,_0x460e38){var _0x1d67ce=_0x101942['params']['id'];var _0x10fe72=_0x101942[_0x00b0('0x61')];var _0x518d7d=0xc8;var _0x5dae2=null;return db[_0x00b0('0x7c')][_0x00b0('0x7d')]({'isolationLevel':db[_0x00b0('0x7c')][_0x00b0('0x7e')][_0x00b0('0x7f')][_0x00b0('0x80')]},function(_0x4c5560){return db['WhatsappAccount']['findOne']({'where':{'id':_0x1d67ce},'transaction':_0x4c5560})[_0x00b0('0x21')](function(_0x287f2d){if(_0x287f2d){return db['WhatsappApplication'][_0x00b0('0x3a')]({'where':{'WhatsappAccountId':_0x1d67ce},'transaction':_0x4c5560})[_0x00b0('0x21')](function(){var _0x34f4d2=_[_0x00b0('0x41')](_0x10fe72,function(_0x39db80){_0x39db80[_0x00b0('0x6d')]=_0x1d67ce;return _0x39db80;});return db[_0x00b0('0x81')]['bulkCreate'](_0x34f4d2,{'transaction':_0x4c5560});});}else{_0x518d7d=0x194;_0x5dae2=[];}});})['then'](function(){if(_0x518d7d!==0x194){return db['WhatsappApplication'][_0x00b0('0x82')]({'where':{'WhatsappAccountId':_0x1d67ce},'order':_0x00b0('0x83')})[_0x00b0('0x21')](function(_0x22a4bc){_0x5dae2=_0x22a4bc;});}})[_0x00b0('0x68')](function(_0xfe8447){_0x518d7d=0x1f4;logger[_0x00b0('0x27')](_0xfe8447[_0x00b0('0x84')]);if(_0xfe8447[_0x00b0('0x3d')]){delete _0xfe8447['name'];}_0x5dae2=_0xfe8447;})['finally'](function(){if(_0x5dae2===null){_0x460e38[_0x00b0('0x3c')](_0x518d7d);}else{if(_0x518d7d===0x1f4){_0x460e38[_0x00b0('0x2c')](_0x518d7d)['send'](_0x5dae2);}else{_0x460e38['status'](_0x518d7d)[_0x00b0('0x33')](_0x5dae2);}}});};exports[_0x00b0('0x85')]=function(_0x2826bf,_0x3822a6,_0x4e6cad){var _0x17020e={};var _0x430568={};var _0x1a944f;var _0x13a1bd;return db['WhatsappAccount'][_0x00b0('0x7a')]({'where':{'id':_0x2826bf[_0x00b0('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3822a6,null))['then'](function(_0xca8788){if(_0xca8788){_0x1a944f=_0xca8788;_0x430568[_0x00b0('0x46')]=_['keys'](db[_0x00b0('0x81')][_0x00b0('0x5e')]);_0x430568[_0x00b0('0x47')]=_[_0x00b0('0x48')](_0x2826bf[_0x00b0('0x47')]);_0x430568[_0x00b0('0x52')]=_[_0x00b0('0x49')](_0x430568[_0x00b0('0x46')],_0x430568[_0x00b0('0x47')]);_0x17020e[_0x00b0('0x4a')]=_[_0x00b0('0x49')](_0x430568['model'],qs[_0x00b0('0x4b')](_0x2826bf[_0x00b0('0x47')][_0x00b0('0x4b')]));_0x17020e[_0x00b0('0x4a')]=_0x17020e[_0x00b0('0x4a')][_0x00b0('0x4c')]?_0x17020e[_0x00b0('0x4a')]:_0x430568[_0x00b0('0x46')];_0x17020e[_0x00b0('0x4f')]=qs[_0x00b0('0x50')](_0x2826bf['query'][_0x00b0('0x50')]);_0x17020e[_0x00b0('0x51')]=qs[_0x00b0('0x52')](_[_0x00b0('0x53')](_0x2826bf['query'],_0x430568[_0x00b0('0x52')]));if(_0x2826bf['query'][_0x00b0('0x54')]){_0x17020e['where']=_[_0x00b0('0x55')](_0x17020e[_0x00b0('0x51')],{'$or':_[_0x00b0('0x41')](_0x17020e[_0x00b0('0x4a')],function(_0x33f18a){var _0x552676={};_0x552676[_0x33f18a]={'$like':'%'+_0x2826bf[_0x00b0('0x47')][_0x00b0('0x54')]+'%'};return _0x552676;})});}_0x17020e=_[_0x00b0('0x55')]({},_0x17020e,_0x2826bf['options']);return _0x1a944f[_0x00b0('0x85')](_0x17020e);}})[_0x00b0('0x21')](function(_0x15a8b1){if(_0x15a8b1){_0x13a1bd=_0x15a8b1[_0x00b0('0x4c')];if(!_0x2826bf[_0x00b0('0x47')][_0x00b0('0x4d')](_0x00b0('0x4e'))){_0x17020e[_0x00b0('0x30')]=qs[_0x00b0('0x30')](_0x2826bf[_0x00b0('0x47')][_0x00b0('0x30')]);_0x17020e['offset']=qs[_0x00b0('0x2d')](_0x2826bf[_0x00b0('0x47')][_0x00b0('0x2d')]);}return _0x1a944f[_0x00b0('0x85')](_0x17020e);}})[_0x00b0('0x21')](function(_0x5d14b1){if(_0x5d14b1){return _0x5d14b1?{'count':_0x13a1bd,'rows':_0x5d14b1}:null;}})[_0x00b0('0x21')](respondWithResult(_0x3822a6,null))[_0x00b0('0x68')](handleError(_0x3822a6,null));};exports[_0x00b0('0x86')]=function(_0x4f6b43,_0xc8ab5d,_0x54eff2){var _0x24ef67={'channel':'whatsapp'};var _0x1320e4=[];var _0x349a63=[];var _0x52f4db={};return db[_0x00b0('0x42')]['find']({'where':{'id':_0x4f6b43[_0x00b0('0x5d')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x00b0('0x87')}]})[_0x00b0('0x21')](handleEntityNotFound(_0xc8ab5d,null))[_0x00b0('0x21')](function(_0x3fb9c5){_0x24ef67['account']=_0x3fb9c5;if(_0x24ef67[_0x00b0('0x88')]&&_0x24ef67[_0x00b0('0x88')][_0x00b0('0x44')]===_0x00b0('0x89')&&_0x4f6b43[_0x00b0('0x61')][_0x00b0('0x8a')]){if(_0x4f6b43[_0x00b0('0x61')][_0x00b0('0x8a')]['length']===0x0)return;if(_0x4f6b43[_0x00b0('0x61')][_0x00b0('0x8a')][0x0]['state']!=='read')return;return db['WhatsappMessage'][_0x00b0('0x37')]({'read':!![],'readAt':_0x4f6b43['body'][_0x00b0('0x8a')][0x0][_0x00b0('0x8b')]},{'where':{'messageId':_0x4f6b43[_0x00b0('0x61')][_0x00b0('0x8a')][0x0][_0x00b0('0x8c')]},'individualHooks':!![]})['then'](function(_0x401e65){return _0xc8ab5d[_0x00b0('0x2c')](0xc8)['json'](_0x401e65);});}_0x24ef67['applications']=_[_0x00b0('0x8d')](_0x3fb9c5[_0x00b0('0x87')],[_0x00b0('0x83')],[_0x00b0('0x8e')]);if(_0x24ef67[_0x00b0('0x88')]['Applications']){delete _0x24ef67['account']['Applications'];}return db[_0x00b0('0x8f')][_0x00b0('0x6a')]()[_0x00b0('0x21')](function(_0xa20f7e){if(!_0xa20f7e){throw new db[(_0x00b0('0x90'))][(_0x00b0('0x91'))](_0x00b0('0x92'));}_0x1320e4=_[_0x00b0('0x93')](_[_0x00b0('0x48')](_0xa20f7e),[_0x00b0('0x94'),_0x00b0('0x95')]);_0x349a63=_['difference'](_['keys'](_0xa20f7e),['createdAt',_0x00b0('0x95'),_0x00b0('0x96'),_0x00b0('0x97')]);_0x24ef67[_0x00b0('0x61')]={'mapKey':_0x00b0('0x98')};if(_0x24ef67[_0x00b0('0x88')]&&_0x24ef67[_0x00b0('0x88')]['type']===_0x00b0('0x99')){_0x24ef67['body'][_0x00b0('0x9a')]=_0x4f6b43[_0x00b0('0x61')][_0x00b0('0x9b')][_0x00b0('0x9c')](_0x00b0('0x9d'),'');_0x24ef67['body'][_0x00b0('0x61')]=_0x4f6b43[_0x00b0('0x61')][_0x00b0('0x9e')];_0x24ef67['body'][_0x00b0('0x9f')]=_0x4f6b43[_0x00b0('0x61')]['MessageSid'];}if(_0x24ef67[_0x00b0('0x88')]&&_0x24ef67[_0x00b0('0x88')][_0x00b0('0x44')]==='sinch'){_0x24ef67[_0x00b0('0x61')][_0x00b0('0x9a')]=_0x4f6b43['body'][_0x00b0('0xa0')][0x0]['from'];_0x24ef67['body']['body']=_0x4f6b43[_0x00b0('0x61')]['notifications'][0x0][_0x00b0('0x29')][_0x00b0('0x61')];_0x24ef67[_0x00b0('0x61')]['messageId']=_0x4f6b43['body'][_0x00b0('0xa0')][0x0]['message_id'];}if(_0x24ef67[_0x00b0('0x61')]['id']){delete _0x24ef67['body']['id'];}if(_['isNil'](_0x24ef67[_0x00b0('0x61')][_0x00b0('0x9a')])){throw new db[(_0x00b0('0x90'))][(_0x00b0('0x91'))](_0x00b0('0xa1'));}if(_['isNil'](_0x24ef67['body'][_0x00b0('0x61')])||_0x24ef67[_0x00b0('0x61')]['body']===''){throw new db['Sequelize'][(_0x00b0('0x91'))](_0x00b0('0xa2'));}if(_[_0x00b0('0xa3')](_0x24ef67['body']['mapKey'])){throw new db[(_0x00b0('0x90'))][(_0x00b0('0x91'))](_0x00b0('0xa4')+_0x349a63);}if(!_[_0x00b0('0xa5')](_0x349a63,_0x24ef67[_0x00b0('0x61')][_0x00b0('0xa6')])){throw new db[(_0x00b0('0x90'))][(_0x00b0('0x91'))](_0x00b0('0xa7')+_0x349a63);}_0x52f4db[_0x24ef67[_0x00b0('0x61')][_0x00b0('0xa6')]]=_0x24ef67[_0x00b0('0x61')][_0x00b0('0x9a')];return db[_0x00b0('0xa8')][_0x00b0('0x5f')]({'where':{'id':_0x24ef67[_0x00b0('0x88')][_0x00b0('0x97')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x52f4db,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0x00b0('0x21')](handleEntityNotFound(_0xc8ab5d,null))[_0x00b0('0x21')](function(_0x21b112){if(_0x21b112){_0x24ef67[_0x00b0('0xa9')]=_[_0x00b0('0x73')](_0x21b112,[_0x00b0('0xaa')]);if(_0x21b112[_0x00b0('0xaa')]['length']){return _0x21b112[_0x00b0('0xaa')][0x0];}var _0x2d6c02=_[_0x00b0('0x19')](_0x24ef67[_0x00b0('0x61')],{'firstName':_0x24ef67[_0x00b0('0x61')][_0x00b0('0x9a')],'ListId':_0x21b112['id']});_0x2d6c02[_0x24ef67[_0x00b0('0x61')]['mapKey']]=_0x24ef67[_0x00b0('0x61')][_0x00b0('0x9a')];return db['CmContact'][_0x00b0('0x60')](_0x2d6c02,{'fields':_0x1320e4,'raw':!![]});}})[_0x00b0('0x21')](handleEntityNotFound(_0xc8ab5d,null))[_0x00b0('0x21')](function(_0x330517){if(_0x330517){_0x24ef67[_0x00b0('0xab')]=_0x330517;var _0x2b4530={'ContactId':_0x330517['id'],'phone':_0x24ef67[_0x00b0('0x61')][_0x00b0('0x9a')],'WhatsappAccountId':_0x4f6b43[_0x00b0('0x5d')]['id']};var _0x59a801={'ContactId':_0x330517['id'],'WhatsappAccountId':_0x4f6b43[_0x00b0('0x5d')]['id'],'closed':![]};return db[_0x00b0('0xac')][_0x00b0('0x5f')]({'where':_0x59a801})[_0x00b0('0x21')](function(_0x5b1181){if(_0x5b1181){return[_0x5b1181,![]];}return db[_0x00b0('0xac')][_0x00b0('0x60')](_0x2b4530)[_0x00b0('0x21')](function(_0x41fe52){return[_0x41fe52,!![]];});});}})['spread'](function(_0x519097,_0x5c6366){_0x24ef67[_0x00b0('0xad')]=_0x519097[_0x00b0('0x63')]({'plain':!![]});_0x24ef67['interaction']['created']=![];if(_0x5c6366){if(_0x24ef67['account']['autoclose']){_0x24ef67[_0x00b0('0xae')][_0x00b0('0xaf')]({'id':0x0,'priority':_0x24ef67['applications'][_0x00b0('0x4c')]+0x1,'app':_0x00b0('0xb0'),'appdata':'unmanaged','interval':_0x00b0('0xb1')});}_0x24ef67[_0x00b0('0xad')][_0x00b0('0xb2')]=!![];}return db[_0x00b0('0xb3')][_0x00b0('0x60')]({'phone':_0x24ef67[_0x00b0('0x61')][_0x00b0('0x9a')],'messageId':_0x24ef67[_0x00b0('0x61')][_0x00b0('0x9f')],'body':_0x24ef67[_0x00b0('0x61')][_0x00b0('0x61')],'WhatsappAccountId':_0x4f6b43[_0x00b0('0x5d')]['id'],'WhatsappInteractionId':_0x519097['id'],'direction':'in','ContactId':_0x519097[_0x00b0('0xb4')],'AttachmentId':_0x24ef67['body'][_0x00b0('0xb5')]});})[_0x00b0('0x21')](function(_0x3a52b8){_0x24ef67[_0x00b0('0x29')]=_0x3a52b8;if(_0x24ef67[_0x00b0('0xad')][_0x00b0('0xb6')]){return db[_0x00b0('0x7b')][_0x00b0('0x5f')]({'attributes':['id',_0x00b0('0x3d')],'where':{'id':_0x24ef67[_0x00b0('0xad')]['UserId']}})[_0x00b0('0x21')](function(_0x327b68){if(_0x327b68){_0x24ef67[_0x00b0('0xae')]['unshift']({'id':0x0,'priority':0x0,'app':_0x00b0('0xb7'),'appdata':_0x327b68[_0x00b0('0x3d')]+','+(_0x24ef67['account'][_0x00b0('0xb8')]||0xa),'interval':_0x00b0('0xb1')});}return respondWithRpcPromise('Start',_0x00b0('0xb9'),_0x24ef67);});}return respondWithRpcPromise(_0x00b0('0xba'),_0x00b0('0xb9'),_0x24ef67);})[_0x00b0('0x21')](function(_0x53110e){if(_0x53110e){var _0x2b972a=0xc8;var _0xb7e30=_0x00b0('0xbb');logger[_0x00b0('0x22')](_0x00b0('0x25'),_0xb7e30,_0x2b972a,_0x00b0('0xbc'));logger[_0x00b0('0x24')](_0x00b0('0xbd'),_0xb7e30,_0x2b972a,'entity\x20found',JSON[_0x00b0('0x26')](_0x53110e));if(_0x24ef67[_0x00b0('0x88')][_0x00b0('0x44')]===_0x00b0('0x99')){return _0xc8ab5d['status'](_0x2b972a)[_0x00b0('0x31')]('Content-Type',_0x00b0('0xbe'))[_0x00b0('0x3e')](_0x00b0('0xbf'));}else{return _0xc8ab5d[_0x00b0('0x2c')](_0x2b972a)['json'](_0x53110e);}}});})[_0x00b0('0x68')](handleError(_0xc8ab5d,null));};exports[_0x00b0('0x3e')]=function(_0x55a10c,_0x1eeebe,_0x2b84cd){var _0x260915,_0x310477,_0x1f73df;if(_[_0x00b0('0xa3')](_0x55a10c['body'][_0x00b0('0x61')])||_0x55a10c[_0x00b0('0x61')][_0x00b0('0x61')]===''){throw new db[(_0x00b0('0x90'))]['ValidationError'](_0x00b0('0xa2'));}if(_['isNil'](_0x55a10c[_0x00b0('0x61')]['to'])){throw new db[(_0x00b0('0x90'))][(_0x00b0('0x91'))]('to\x20is\x20mandatory');}_0x260915=_0x55a10c[_0x00b0('0x61')]['to'];return db[_0x00b0('0x42')]['find']({'where':{'id':_0x55a10c[_0x00b0('0x5d')]['id']},'include':[{'model':db[_0x00b0('0xa8')],'as':_0x00b0('0xc0'),'include':[{'model':db[_0x00b0('0x8f')],'as':_0x00b0('0xaa'),'where':{'mobile':_0x260915},'limit':0x1,'order':[[_0x00b0('0x95'),_0x00b0('0xc1')]]}]}]})[_0x00b0('0x21')](handleEntityNotFound(_0x1eeebe,null))[_0x00b0('0x21')](function(_0x22f8ad){if(_0x22f8ad&&_0x22f8ad[_0x00b0('0xc0')]){_0x310477=_0x22f8ad['get']({'plain':!![]});if(_0x310477['List']&&_0x310477[_0x00b0('0xc0')]['Contacts']['length']){return _0x310477[_0x00b0('0xc0')][_0x00b0('0xaa')][0x0];}return db['CmContact'][_0x00b0('0x60')](_[_0x00b0('0x19')](_0x55a10c[_0x00b0('0x61')],{'firstName':_0x260915,'mobile':_0x260915,'phone':_0x260915,'ListId':_0x310477[_0x00b0('0x97')]}));}})[_0x00b0('0x21')](handleEntityNotFound(_0x1eeebe,null))['then'](function(_0x60afb4){if(_0x60afb4){_0x1f73df=_0x60afb4;return db[_0x00b0('0xac')][_0x00b0('0x5f')]({'where':{'ContactId':_0x1f73df['id'],'closed':![],'WhatsappAccountId':_0x310477['id']}})[_0x00b0('0x21')](function(_0x5e4467){if(_0x5e4467){return[_0x5e4467,![]];}return db[_0x00b0('0xac')][_0x00b0('0x60')]({'UserId':_0x55a10c[_0x00b0('0x62')]['id'],'ContactId':_0x1f73df['id'],'WhatsappAccountId':_0x310477['id'],'phone':_0x260915,'firstMsgDirection':_0x00b0('0xc2'),'Messages':[_[_0x00b0('0x55')](_0x55a10c[_0x00b0('0x61')],{'read':![],'body':_0x55a10c['body']['body'],'phone':_0x260915,'WhatsappAccountId':_0x310477['id'],'UserId':_0x55a10c['user']['id'],'ContactId':_0x1f73df['id']})]},{'include':[{'model':db[_0x00b0('0xb3')],'as':'Messages'}]})[_0x00b0('0x21')](function(_0x1b3cbe){return[_0x1b3cbe,!![]];});});}})[_0x00b0('0xc3')](function(_0x1fcb94,_0x58743a){if(_0x58743a){return _0x1fcb94;}return db[_0x00b0('0xb3')][_0x00b0('0x60')](_['merge'](_0x55a10c[_0x00b0('0x61')],{'read':![],'body':_0x55a10c[_0x00b0('0x61')]['body'],'phone':_0x260915,'WhatsappAccountId':_0x310477['id'],'WhatsappInteractionId':_0x1fcb94['id'],'UserId':_0x55a10c[_0x00b0('0x62')]['id'],'ContactId':_0x1f73df['id']}))[_0x00b0('0x21')](function(_0x2d1553){_0x1fcb94['dataValues']['Messages']=[];_0x1fcb94['dataValues'][_0x00b0('0xc4')][_0x00b0('0xaf')](_0x2d1553[_0x00b0('0xc5')]);return _0x1fcb94;});})[_0x00b0('0x21')](respondWithResult(_0x1eeebe,null))[_0x00b0('0x68')](handleError(_0x1eeebe,null));}; \ No newline at end of file +var _0x6c95=['user','get','role','WhatsappAccounts','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','pick','map','removeDispositions','ids','CannedAnswer','getAnswers','findAll','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','priority','finally','send','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','WhatsappMessage','timestamp','message_id','applications','orderBy','CmContact','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','ListId','mobile','twilio','from','From','replace','whatsapp:','messageId','MessageSid','notifications','isNil','ValidationError','from\x20is\x20mandatory','mapKey','CmList','Contacts','DESC','list','WhatsappInteraction','interaction','created','autoclose','push','*,*,*,*','ContactId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','List','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','index','Pause','mandatoryDispositionPause','rawAttributes','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','WhatsappAccount','includeAll','include','rows','show','params','create','body'];(function(_0x5dca1c,_0x4d4281){var _0x5ce01c=function(_0x100860){while(--_0x100860){_0x5dca1c['push'](_0x5dca1c['shift']());}};_0x5ce01c(++_0x4d4281);}(_0x6c95,0x123));var _0x56c9=function(_0x18338b,_0x357f0c){_0x18338b=_0x18338b-0x0;var _0x4cb958=_0x6c95[_0x18338b];return _0x4cb958;};'use strict';var emlformat=require(_0x56c9('0x0'));var rimraf=require(_0x56c9('0x1'));var zipdir=require(_0x56c9('0x2'));var jsonpatch=require(_0x56c9('0x3'));var rp=require('request-promise');var moment=require(_0x56c9('0x4'));var BPromise=require(_0x56c9('0x5'));var Mustache=require(_0x56c9('0x6'));var util=require('util');var path=require(_0x56c9('0x7'));var sox=require(_0x56c9('0x8'));var csv=require('to-csv');var ejs=require(_0x56c9('0x9'));var fs=require('fs');var fs_extra=require(_0x56c9('0xa'));var _=require(_0x56c9('0xb'));var squel=require(_0x56c9('0xc'));var crypto=require(_0x56c9('0xd'));var jsforce=require(_0x56c9('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x56c9('0xf'));var Redis=require(_0x56c9('0x10'));var authService=require(_0x56c9('0x11'));var qs=require(_0x56c9('0x12'));var as=require(_0x56c9('0x13'));var hardwareService=require(_0x56c9('0x14'));var logger=require('../../config/logger')(_0x56c9('0x15'));var utils=require(_0x56c9('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x56c9('0x17'));var db=require(_0x56c9('0x18'))['db'];config[_0x56c9('0x19')]=_[_0x56c9('0x1a')](config['redis'],{'host':_0x56c9('0x1b'),'port':0x18eb});var socket=require(_0x56c9('0x1c'))(new Redis(config[_0x56c9('0x19')]));require('./whatsappAccount.socket')[_0x56c9('0x1d')](socket);var jayson=require(_0x56c9('0x1e'));var client=jayson[_0x56c9('0x1f')][_0x56c9('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x2b5ff1,_0x1fedb5,_0x34902d,_0x52f778){return new BPromise(function(_0x2426e6,_0x4d298a){var _0x27c2f0=_0x52f778||client;return _0x27c2f0[_0x56c9('0x21')](_0x2b5ff1,_0x34902d)['then'](function(_0x3f83d4){logger[_0x56c9('0x22')](_0x56c9('0x23'),_0x1fedb5,_0x56c9('0x24'));logger[_0x56c9('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1fedb5,_0x56c9('0x24'),JSON['stringify'](_0x3f83d4));if(_0x3f83d4['error']){if(_0x3f83d4[_0x56c9('0x26')][_0x56c9('0x27')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x1fedb5,_0x3f83d4[_0x56c9('0x26')][_0x56c9('0x28')]);return _0x4d298a(_0x3f83d4[_0x56c9('0x26')]['message']);}logger[_0x56c9('0x26')](_0x56c9('0x23'),_0x1fedb5,_0x3f83d4['error'][_0x56c9('0x28')]);return _0x2426e6(_0x3f83d4[_0x56c9('0x26')]['message']);}else{logger[_0x56c9('0x22')](_0x56c9('0x23'),_0x1fedb5,'request\x20sent');_0x2426e6(_0x3f83d4[_0x56c9('0x29')]['message']);}})[_0x56c9('0x2a')](function(_0x4a6685){logger[_0x56c9('0x26')](_0x56c9('0x23'),_0x1fedb5,_0x4a6685);_0x4d298a(_0x4a6685);});});}function respondWithStatusCode(_0x2f7cfb,_0x166b8e){_0x166b8e=_0x166b8e||0xcc;return function(_0x2da703){if(_0x2da703){return _0x2f7cfb['sendStatus'](_0x166b8e);}return _0x2f7cfb['status'](_0x166b8e)[_0x56c9('0x2b')]();};}function respondWithResult(_0x3fce87,_0xe62384){_0xe62384=_0xe62384||0xc8;return function(_0x682678){if(_0x682678){return _0x3fce87[_0x56c9('0x2c')](_0xe62384)[_0x56c9('0x2d')](_0x682678);}};}function respondWithFilteredResult(_0x3738bb,_0x367d8d){return function(_0x45618e){if(_0x45618e){var _0x5323ae=typeof _0x367d8d[_0x56c9('0x2e')]===_0x56c9('0x2f')&&typeof _0x367d8d['limit']===_0x56c9('0x2f');var _0x30d79e=_0x45618e[_0x56c9('0x30')];var _0x20eaa6=_0x5323ae?0x0:_0x367d8d[_0x56c9('0x2e')];var _0x26b760=_0x5323ae?_0x45618e[_0x56c9('0x30')]:_0x367d8d[_0x56c9('0x2e')]+_0x367d8d[_0x56c9('0x31')];var _0x3a749a;if(_0x26b760>=_0x30d79e){_0x26b760=_0x30d79e;_0x3a749a=0xc8;}else{_0x3a749a=0xce;}_0x3738bb[_0x56c9('0x2c')](_0x3a749a);return _0x3738bb[_0x56c9('0x32')](_0x56c9('0x33'),_0x20eaa6+'-'+_0x26b760+'/'+_0x30d79e)[_0x56c9('0x2d')](_0x45618e);}return null;};}function patchUpdates(_0x28eee2){return function(_0x48fef7){try{jsonpatch['apply'](_0x48fef7,_0x28eee2,!![]);}catch(_0xacaf32){return BPromise[_0x56c9('0x34')](_0xacaf32);}return _0x48fef7[_0x56c9('0x35')]();};}function saveUpdates(_0x5b4d0c,_0x2384e1){return function(_0x184692){if(_0x184692){return _0x184692[_0x56c9('0x36')](_0x5b4d0c)[_0x56c9('0x37')](function(_0x35ad68){return _0x35ad68;});}return null;};}function removeEntity(_0x4143ec,_0x2b4e6d){return function(_0x258c45){if(_0x258c45){return _0x258c45['destroy']()[_0x56c9('0x37')](function(){var _0x402af1=_0x258c45['get']({'plain':!![]});var _0x5ea5cb='WhatsappAccounts';return db['UserProfileResource'][_0x56c9('0x38')]({'where':{'type':_0x5ea5cb,'resourceId':_0x402af1['id']}})['then'](function(){return _0x258c45;});})[_0x56c9('0x37')](function(){_0x4143ec[_0x56c9('0x2c')](0xcc)[_0x56c9('0x2b')]();});}};}function handleEntityNotFound(_0x39945c,_0x53e981){return function(_0x234050){if(!_0x234050){_0x39945c['sendStatus'](0x194);}return _0x234050;};}function handleError(_0x3fdf1d,_0x5ee59f){_0x5ee59f=_0x5ee59f||0x1f4;return function(_0x402c57){logger['error'](_0x402c57[_0x56c9('0x39')]);if(_0x402c57[_0x56c9('0x3a')]){delete _0x402c57[_0x56c9('0x3a')];}_0x3fdf1d[_0x56c9('0x2c')](_0x5ee59f)['send'](_0x402c57);};}exports[_0x56c9('0x3b')]=function(_0x5ad464,_0x481f23){var _0x4f631d={'include':[{'model':db[_0x56c9('0x3c')],'as':_0x56c9('0x3d')}]},_0x325d55={},_0x46be5d={'count':0x0,'rows':[]};var _0x295d43=_['map'](db['WhatsappAccount'][_0x56c9('0x3e')],function(_0x11fe55){return{'name':_0x11fe55['fieldName'],'type':_0x11fe55[_0x56c9('0x3f')][_0x56c9('0x40')]};});_0x325d55[_0x56c9('0x41')]=_['map'](_0x295d43,_0x56c9('0x3a'));_0x325d55[_0x56c9('0x42')]=_[_0x56c9('0x43')](_0x5ad464[_0x56c9('0x42')]);_0x325d55[_0x56c9('0x44')]=_[_0x56c9('0x45')](_0x325d55['model'],_0x325d55[_0x56c9('0x42')]);_0x4f631d['attributes']=_[_0x56c9('0x45')](_0x325d55[_0x56c9('0x41')],qs[_0x56c9('0x46')](_0x5ad464['query']['fields']));_0x4f631d['attributes']=_0x4f631d['attributes'][_0x56c9('0x47')]?_0x4f631d[_0x56c9('0x48')]:_0x325d55['model'];if(!_0x5ad464[_0x56c9('0x42')][_0x56c9('0x49')](_0x56c9('0x4a'))){_0x4f631d['limit']=qs[_0x56c9('0x31')](_0x5ad464[_0x56c9('0x42')][_0x56c9('0x31')]);_0x4f631d['offset']=qs[_0x56c9('0x2e')](_0x5ad464[_0x56c9('0x42')][_0x56c9('0x2e')]);}_0x4f631d[_0x56c9('0x4b')]=qs[_0x56c9('0x4c')](_0x5ad464['query']['sort']);_0x4f631d[_0x56c9('0x4d')]=qs[_0x56c9('0x44')](_['pick'](_0x5ad464[_0x56c9('0x42')],_0x325d55[_0x56c9('0x44')]),_0x295d43);if(_0x5ad464[_0x56c9('0x42')]['filter']){_0x4f631d[_0x56c9('0x4d')]=_[_0x56c9('0x4e')](_0x4f631d[_0x56c9('0x4d')],{'$or':_['map'](_0x295d43,function(_0x14eed9){if(_0x14eed9[_0x56c9('0x3f')]!=='VIRTUAL'){var _0x5c6b4a={};_0x5c6b4a[_0x14eed9[_0x56c9('0x3a')]]={'$like':'%'+_0x5ad464[_0x56c9('0x42')][_0x56c9('0x4f')]+'%'};return _0x5c6b4a;}})});}_0x4f631d=_[_0x56c9('0x4e')]({},_0x4f631d,_0x5ad464[_0x56c9('0x50')]);var _0x3ef2d2={'where':_0x4f631d[_0x56c9('0x4d')]};return db[_0x56c9('0x51')][_0x56c9('0x30')](_0x3ef2d2)[_0x56c9('0x37')](function(_0x57ac02){_0x46be5d[_0x56c9('0x30')]=_0x57ac02;if(_0x5ad464[_0x56c9('0x42')][_0x56c9('0x52')]){_0x4f631d[_0x56c9('0x53')]=[{'all':!![]}];}return db[_0x56c9('0x51')]['findAll'](_0x4f631d);})['then'](function(_0x2792f4){_0x46be5d[_0x56c9('0x54')]=_0x2792f4;return _0x46be5d;})[_0x56c9('0x37')](respondWithFilteredResult(_0x481f23,_0x4f631d))['catch'](handleError(_0x481f23,null));};exports[_0x56c9('0x55')]=function(_0x28c344,_0x2545bb){var _0x41a1cd={'raw':![],'where':{'id':_0x28c344[_0x56c9('0x56')]['id']},'include':[{'model':db[_0x56c9('0x3c')],'as':_0x56c9('0x3d')}]},_0x133628={};_0x133628[_0x56c9('0x41')]=_['keys'](db[_0x56c9('0x51')][_0x56c9('0x3e')]);_0x133628[_0x56c9('0x42')]=_[_0x56c9('0x43')](_0x28c344[_0x56c9('0x42')]);_0x133628[_0x56c9('0x44')]=_[_0x56c9('0x45')](_0x133628[_0x56c9('0x41')],_0x133628[_0x56c9('0x42')]);_0x41a1cd[_0x56c9('0x48')]=_[_0x56c9('0x45')](_0x133628[_0x56c9('0x41')],qs[_0x56c9('0x46')](_0x28c344['query'][_0x56c9('0x46')]));_0x41a1cd[_0x56c9('0x48')]=_0x41a1cd['attributes'][_0x56c9('0x47')]?_0x41a1cd[_0x56c9('0x48')]:_0x133628[_0x56c9('0x41')];if(_0x28c344[_0x56c9('0x42')][_0x56c9('0x52')]){_0x41a1cd[_0x56c9('0x53')]=[{'all':!![]}];}_0x41a1cd=_[_0x56c9('0x4e')]({},_0x41a1cd,_0x28c344[_0x56c9('0x50')]);return db[_0x56c9('0x51')]['find'](_0x41a1cd)[_0x56c9('0x37')](handleEntityNotFound(_0x2545bb,null))[_0x56c9('0x37')](respondWithResult(_0x2545bb,null))[_0x56c9('0x2a')](handleError(_0x2545bb,null));};exports[_0x56c9('0x57')]=function(_0x1e5b04,_0x108967){return db['WhatsappAccount'][_0x56c9('0x57')](_0x1e5b04[_0x56c9('0x58')],{})[_0x56c9('0x37')](function(_0x249886){var _0x495017=_0x1e5b04[_0x56c9('0x59')][_0x56c9('0x5a')]({'plain':!![]});if(!_0x495017)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x495017[_0x56c9('0x5b')]===_0x56c9('0x59')){var _0x3c3b58=_0x249886[_0x56c9('0x5a')]({'plain':!![]});var _0x50df73=_0x56c9('0x5c');return db[_0x56c9('0x5d')][_0x56c9('0x5e')]({'where':{'name':_0x50df73,'userProfileId':_0x495017['userProfileId']},'raw':!![]})[_0x56c9('0x37')](function(_0x4ab99c){if(_0x4ab99c&&_0x4ab99c[_0x56c9('0x5f')]===0x0){return db[_0x56c9('0x60')][_0x56c9('0x57')]({'name':_0x3c3b58['name'],'resourceId':_0x3c3b58['id'],'type':_0x4ab99c[_0x56c9('0x3a')],'sectionId':_0x4ab99c['id']},{})[_0x56c9('0x37')](function(){return _0x249886;});}else{return _0x249886;}})[_0x56c9('0x2a')](function(_0x3af444){logger[_0x56c9('0x26')](_0x56c9('0x61'),_0x3af444);throw _0x3af444;});}return _0x249886;})[_0x56c9('0x37')](respondWithResult(_0x108967,0xc9))[_0x56c9('0x2a')](handleError(_0x108967,null));};exports[_0x56c9('0x36')]=function(_0x590d20,_0x27208f){if(_0x590d20[_0x56c9('0x58')]['id']){delete _0x590d20[_0x56c9('0x58')]['id'];}return db[_0x56c9('0x51')][_0x56c9('0x5e')]({'where':{'id':_0x590d20[_0x56c9('0x56')]['id']},'include':[{'model':db[_0x56c9('0x3c')],'as':_0x56c9('0x3d')}]})['then'](handleEntityNotFound(_0x27208f,null))['then'](saveUpdates(_0x590d20['body'],null))['then'](respondWithResult(_0x27208f,null))[_0x56c9('0x2a')](handleError(_0x27208f,null));};exports[_0x56c9('0x38')]=function(_0x35de94,_0x1fd5dd){return db[_0x56c9('0x51')][_0x56c9('0x5e')]({'where':{'id':_0x35de94[_0x56c9('0x56')]['id']}})[_0x56c9('0x37')](handleEntityNotFound(_0x1fd5dd,null))[_0x56c9('0x37')](removeEntity(_0x1fd5dd,null))[_0x56c9('0x2a')](handleError(_0x1fd5dd,null));};exports[_0x56c9('0x62')]=function(_0x3fee68,_0x3ef45e){return db['WhatsappAccount']['describe']()['then'](respondWithResult(_0x3ef45e,null))[_0x56c9('0x2a')](handleError(_0x3ef45e,null));};exports[_0x56c9('0x63')]=function(_0xbee9d9,_0x3a06a9,_0x43e688){if(_0xbee9d9[_0x56c9('0x58')]['id']){delete _0xbee9d9[_0x56c9('0x58')]['id'];}return db['WhatsappAccount'][_0x56c9('0x5e')]({'where':{'id':_0xbee9d9[_0x56c9('0x56')]['id']}})[_0x56c9('0x37')](handleEntityNotFound(_0x3a06a9,null))['then'](function(_0x2ca792){if(_0x2ca792){_0xbee9d9['body'][_0x56c9('0x64')]=_0x2ca792['id'];return db[_0x56c9('0x65')]['create'](_0xbee9d9[_0x56c9('0x58')]);}})[_0x56c9('0x37')](respondWithResult(_0x3a06a9,null))['catch'](handleError(_0x3a06a9,null));};exports[_0x56c9('0x66')]=function(_0x5befff,_0x370373,_0x5522b1){var _0xd7144c={'raw':![],'where':{}};var _0x273fea={};var _0x4faa33={'count':0x0,'rows':[]};return db[_0x56c9('0x51')][_0x56c9('0x67')]({'where':{'id':_0x5befff[_0x56c9('0x56')]['id']}})[_0x56c9('0x37')](handleEntityNotFound(_0x370373,null))[_0x56c9('0x37')](function(_0x5dd3c8){if(_0x5dd3c8){_0x273fea['model']=_[_0x56c9('0x43')](db[_0x56c9('0x65')][_0x56c9('0x3e')]);_0x273fea[_0x56c9('0x42')]=_[_0x56c9('0x43')](_0x5befff[_0x56c9('0x42')]);_0x273fea['filters']=_['intersection'](_0x273fea['model'],_0x273fea['query']);_0xd7144c[_0x56c9('0x48')]=_[_0x56c9('0x45')](_0x273fea['model'],qs[_0x56c9('0x46')](_0x5befff[_0x56c9('0x42')][_0x56c9('0x46')]));_0xd7144c[_0x56c9('0x48')]=_0xd7144c[_0x56c9('0x48')][_0x56c9('0x47')]?_0xd7144c[_0x56c9('0x48')]:_0x273fea[_0x56c9('0x41')];if(!_0x5befff[_0x56c9('0x42')][_0x56c9('0x49')](_0x56c9('0x4a'))){_0xd7144c[_0x56c9('0x31')]=qs[_0x56c9('0x31')](_0x5befff[_0x56c9('0x42')]['limit']);_0xd7144c[_0x56c9('0x2e')]=qs[_0x56c9('0x2e')](_0x5befff[_0x56c9('0x42')][_0x56c9('0x2e')]);}_0xd7144c[_0x56c9('0x4b')]=qs[_0x56c9('0x4c')](_0x5befff['query']['sort']);_0xd7144c[_0x56c9('0x4d')]=qs[_0x56c9('0x44')](_[_0x56c9('0x68')](_0x5befff[_0x56c9('0x42')],_0x273fea[_0x56c9('0x44')]));_0xd7144c[_0x56c9('0x4d')]['WhatsappAccountId']=_0x5dd3c8['id'];if(_0x5befff['query']['filter']){_0xd7144c['where']=_[_0x56c9('0x4e')](_0xd7144c[_0x56c9('0x4d')],{'$or':_[_0x56c9('0x69')](_0xd7144c[_0x56c9('0x48')],function(_0x46b990){var _0x2f13af={};_0x2f13af[_0x46b990]={'$like':'%'+_0x5befff['query'][_0x56c9('0x4f')]+'%'};return _0x2f13af;})});}_0xd7144c=_[_0x56c9('0x4e')]({},_0xd7144c,_0x5befff[_0x56c9('0x50')]);return db[_0x56c9('0x65')]['count']({'where':_0xd7144c[_0x56c9('0x4d')]})[_0x56c9('0x37')](function(_0x185988){_0x4faa33['count']=_0x185988;if(_0x5befff['query'][_0x56c9('0x52')]){_0xd7144c[_0x56c9('0x53')]=[{'all':!![]}];}return db[_0x56c9('0x65')]['findAll'](_0xd7144c);})[_0x56c9('0x37')](function(_0x521a11){_0x4faa33[_0x56c9('0x54')]=_0x521a11;return _0x4faa33;});}})['then'](respondWithFilteredResult(_0x370373,_0xd7144c))[_0x56c9('0x2a')](handleError(_0x370373,null));};exports[_0x56c9('0x6a')]=function(_0x186057,_0x123d9b,_0x9a186a){return db[_0x56c9('0x51')][_0x56c9('0x5e')]({'where':{'id':_0x186057[_0x56c9('0x56')]['id']}})['then'](handleEntityNotFound(_0x123d9b,null))[_0x56c9('0x37')](function(_0x4c6626){if(_0x4c6626){return _0x4c6626[_0x56c9('0x6a')](_0x186057[_0x56c9('0x42')][_0x56c9('0x6b')]);}})[_0x56c9('0x37')](respondWithStatusCode(_0x123d9b,null))['catch'](handleError(_0x123d9b,null));};exports['addAnswer']=function(_0x44b438,_0x279db0,_0x51b51a){if(_0x44b438['body']['id']){delete _0x44b438['body']['id'];}return db[_0x56c9('0x51')][_0x56c9('0x5e')]({'where':{'id':_0x44b438[_0x56c9('0x56')]['id']}})[_0x56c9('0x37')](handleEntityNotFound(_0x279db0,null))['then'](function(_0x213598){if(_0x213598){_0x44b438[_0x56c9('0x58')][_0x56c9('0x64')]=_0x213598['id'];return db[_0x56c9('0x6c')]['create'](_0x44b438['body']);}})[_0x56c9('0x37')](respondWithResult(_0x279db0,null))[_0x56c9('0x2a')](handleError(_0x279db0,null));};exports[_0x56c9('0x6d')]=function(_0xa2cb6e,_0x139514,_0x552be8){var _0xbea7f6={'raw':![],'where':{}};var _0x4bef41={};var _0x13c215={'count':0x0,'rows':[]};return db[_0x56c9('0x51')]['findOne']({'where':{'id':_0xa2cb6e[_0x56c9('0x56')]['id']}})['then'](handleEntityNotFound(_0x139514,null))[_0x56c9('0x37')](function(_0x39375f){if(_0x39375f){_0x4bef41[_0x56c9('0x41')]=_[_0x56c9('0x43')](db[_0x56c9('0x6c')][_0x56c9('0x3e')]);_0x4bef41[_0x56c9('0x42')]=_[_0x56c9('0x43')](_0xa2cb6e['query']);_0x4bef41[_0x56c9('0x44')]=_['intersection'](_0x4bef41[_0x56c9('0x41')],_0x4bef41[_0x56c9('0x42')]);_0xbea7f6[_0x56c9('0x48')]=_[_0x56c9('0x45')](_0x4bef41[_0x56c9('0x41')],qs[_0x56c9('0x46')](_0xa2cb6e[_0x56c9('0x42')]['fields']));_0xbea7f6[_0x56c9('0x48')]=_0xbea7f6[_0x56c9('0x48')][_0x56c9('0x47')]?_0xbea7f6[_0x56c9('0x48')]:_0x4bef41[_0x56c9('0x41')];if(!_0xa2cb6e['query']['hasOwnProperty'](_0x56c9('0x4a'))){_0xbea7f6['limit']=qs[_0x56c9('0x31')](_0xa2cb6e['query']['limit']);_0xbea7f6[_0x56c9('0x2e')]=qs['offset'](_0xa2cb6e[_0x56c9('0x42')]['offset']);}_0xbea7f6[_0x56c9('0x4b')]=qs['sort'](_0xa2cb6e[_0x56c9('0x42')][_0x56c9('0x4c')]);_0xbea7f6[_0x56c9('0x4d')]=qs[_0x56c9('0x44')](_['pick'](_0xa2cb6e[_0x56c9('0x42')],_0x4bef41[_0x56c9('0x44')]));_0xbea7f6[_0x56c9('0x4d')]['WhatsappAccountId']=_0x39375f['id'];if(_0xa2cb6e['query'][_0x56c9('0x4f')]){_0xbea7f6[_0x56c9('0x4d')]=_[_0x56c9('0x4e')](_0xbea7f6['where'],{'$or':_[_0x56c9('0x69')](_0xbea7f6[_0x56c9('0x48')],function(_0x57e89c){var _0x13ab0c={};_0x13ab0c[_0x57e89c]={'$like':'%'+_0xa2cb6e[_0x56c9('0x42')][_0x56c9('0x4f')]+'%'};return _0x13ab0c;})});}_0xbea7f6=_[_0x56c9('0x4e')]({},_0xbea7f6,_0xa2cb6e['options']);return db[_0x56c9('0x6c')][_0x56c9('0x30')]({'where':_0xbea7f6[_0x56c9('0x4d')]})[_0x56c9('0x37')](function(_0x3cbf59){_0x13c215[_0x56c9('0x30')]=_0x3cbf59;if(_0xa2cb6e[_0x56c9('0x42')][_0x56c9('0x52')]){_0xbea7f6[_0x56c9('0x53')]=[{'all':!![]}];}return db['CannedAnswer'][_0x56c9('0x6e')](_0xbea7f6);})[_0x56c9('0x37')](function(_0x3bd0c8){_0x13c215[_0x56c9('0x54')]=_0x3bd0c8;return _0x13c215;});}})[_0x56c9('0x37')](respondWithFilteredResult(_0x139514,_0xbea7f6))[_0x56c9('0x2a')](handleError(_0x139514,null));};exports[_0x56c9('0x6f')]=function(_0x215f31,_0x580078,_0x1a4703){return db[_0x56c9('0x51')][_0x56c9('0x5e')]({'where':{'id':_0x215f31[_0x56c9('0x56')]['id']}})[_0x56c9('0x37')](handleEntityNotFound(_0x580078,null))[_0x56c9('0x37')](function(_0x552edc){if(_0x552edc){return _0x552edc['removeAnswers'](_0x215f31[_0x56c9('0x42')][_0x56c9('0x6b')]);}})[_0x56c9('0x37')](respondWithStatusCode(_0x580078,null))['catch'](handleError(_0x580078,null));};exports[_0x56c9('0x70')]=function(_0x4f4f3f,_0x31ba1f,_0x22eba1){return db[_0x56c9('0x51')][_0x56c9('0x5e')]({'where':{'id':_0x4f4f3f['params']['id']}})[_0x56c9('0x37')](handleEntityNotFound(_0x31ba1f,null))[_0x56c9('0x37')](function(_0x38cdda){if(_0x38cdda){return _0x38cdda[_0x56c9('0x70')](_0x4f4f3f[_0x56c9('0x58')]['ids'],_[_0x56c9('0x71')](_0x4f4f3f[_0x56c9('0x58')],[_0x56c9('0x6b'),'id'])||{})[_0x56c9('0x72')](function(_0x443712){for(var _0x371885=0x0;_0x371885<_0x4f4f3f[_0x56c9('0x58')][_0x56c9('0x6b')]['length'];_0x371885+=0x1){socket[_0x56c9('0x73')](_0x56c9('0x74'),{'UserId':Number(_0x4f4f3f[_0x56c9('0x58')]['ids'][_0x371885]),'WhatsappAccountId':Number(_0x4f4f3f['params']['id'])});}return _0x443712;});}})[_0x56c9('0x37')](respondWithResult(_0x31ba1f,null))[_0x56c9('0x2a')](handleError(_0x31ba1f,null));};exports[_0x56c9('0x75')]=function(_0x2a383a,_0x9f318b,_0x13d813){return db[_0x56c9('0x51')][_0x56c9('0x5e')]({'where':{'id':_0x2a383a[_0x56c9('0x56')]['id']}})[_0x56c9('0x37')](handleEntityNotFound(_0x9f318b,null))[_0x56c9('0x37')](function(_0xdab23b){if(_0xdab23b){return _0xdab23b[_0x56c9('0x75')](_0x2a383a[_0x56c9('0x42')][_0x56c9('0x6b')])[_0x56c9('0x37')](function(){if(_[_0x56c9('0x76')](_0x2a383a[_0x56c9('0x42')][_0x56c9('0x6b')])){for(var _0x195a30=0x0;_0x195a30<_0x2a383a[_0x56c9('0x42')][_0x56c9('0x6b')]['length'];_0x195a30+=0x1){socket[_0x56c9('0x73')](_0x56c9('0x77'),{'UserId':Number(_0x2a383a['query'][_0x56c9('0x6b')][_0x195a30]),'WhatsappAccountId':Number(_0x2a383a[_0x56c9('0x56')]['id'])});}}else{socket[_0x56c9('0x73')](_0x56c9('0x77'),{'UserId':Number(_0x2a383a[_0x56c9('0x42')]['ids']),'WhatsappAccountId':Number(_0x2a383a[_0x56c9('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x9f318b,null))['catch'](handleError(_0x9f318b,null));};exports[_0x56c9('0x78')]=function(_0x428951,_0x11733a,_0x5f2b18){var _0x3906fc={};var _0x4b5980={};var _0x3f9516;var _0x2c1262;return db[_0x56c9('0x51')]['findOne']({'where':{'id':_0x428951['params']['id']}})[_0x56c9('0x37')](handleEntityNotFound(_0x11733a,null))['then'](function(_0x3c362d){if(_0x3c362d){_0x3f9516=_0x3c362d;_0x4b5980[_0x56c9('0x41')]=_[_0x56c9('0x43')](db[_0x56c9('0x79')][_0x56c9('0x3e')]);_0x4b5980['query']=_['keys'](_0x428951[_0x56c9('0x42')]);_0x4b5980[_0x56c9('0x44')]=_[_0x56c9('0x45')](_0x4b5980[_0x56c9('0x41')],_0x4b5980[_0x56c9('0x42')]);_0x3906fc['attributes']=_['intersection'](_0x4b5980[_0x56c9('0x41')],qs[_0x56c9('0x46')](_0x428951[_0x56c9('0x42')]['fields']));_0x3906fc[_0x56c9('0x48')]=_0x3906fc['attributes'][_0x56c9('0x47')]?_0x3906fc[_0x56c9('0x48')]:_0x4b5980[_0x56c9('0x41')];_0x3906fc[_0x56c9('0x4b')]=qs['sort'](_0x428951[_0x56c9('0x42')][_0x56c9('0x4c')]);_0x3906fc['where']=qs['filters'](_[_0x56c9('0x68')](_0x428951[_0x56c9('0x42')],_0x4b5980[_0x56c9('0x44')]));if(_0x428951['query']['filter']){_0x3906fc[_0x56c9('0x4d')]=_['merge'](_0x3906fc['where'],{'$or':_['map'](_0x3906fc[_0x56c9('0x48')],function(_0xc289d1){var _0xe06725={};_0xe06725[_0xc289d1]={'$like':'%'+_0x428951[_0x56c9('0x42')]['filter']+'%'};return _0xe06725;})});}_0x3906fc=_[_0x56c9('0x4e')]({},_0x3906fc,_0x428951[_0x56c9('0x50')]);return _0x3f9516['getAgents'](_0x3906fc);}})['then'](function(_0x4e203f){if(_0x4e203f){_0x2c1262=_0x4e203f[_0x56c9('0x47')];if(!_0x428951[_0x56c9('0x42')][_0x56c9('0x49')]('nolimit')){_0x3906fc[_0x56c9('0x31')]=qs[_0x56c9('0x31')](_0x428951[_0x56c9('0x42')][_0x56c9('0x31')]);_0x3906fc[_0x56c9('0x2e')]=qs[_0x56c9('0x2e')](_0x428951['query'][_0x56c9('0x2e')]);}return _0x3f9516[_0x56c9('0x78')](_0x3906fc);}})[_0x56c9('0x37')](function(_0xe24c7d){if(_0xe24c7d){return _0xe24c7d?{'count':_0x2c1262,'rows':_0xe24c7d}:null;}})[_0x56c9('0x37')](respondWithResult(_0x11733a,null))[_0x56c9('0x2a')](handleError(_0x11733a,null));};exports[_0x56c9('0x7a')]=function(_0x16bbb3,_0x294013){var _0x35fdf3=_0x16bbb3[_0x56c9('0x56')]['id'];var _0x374ec5=_0x16bbb3['body'];var _0x679bf3=0xc8;var _0x42dc09=null;return db[_0x56c9('0x7b')][_0x56c9('0x7c')]({'isolationLevel':db['sequelize']['Transaction'][_0x56c9('0x7d')][_0x56c9('0x7e')]},function(_0xc73984){return db['WhatsappAccount'][_0x56c9('0x67')]({'where':{'id':_0x35fdf3},'transaction':_0xc73984})['then'](function(_0x533b0a){if(_0x533b0a){return db['WhatsappApplication'][_0x56c9('0x38')]({'where':{'WhatsappAccountId':_0x35fdf3},'transaction':_0xc73984})[_0x56c9('0x37')](function(){var _0x152c9d=_['map'](_0x374ec5,function(_0x20b969){_0x20b969[_0x56c9('0x64')]=_0x35fdf3;return _0x20b969;});return db[_0x56c9('0x7f')]['bulkCreate'](_0x152c9d,{'transaction':_0xc73984});});}else{_0x679bf3=0x194;_0x42dc09=[];}});})['then'](function(){if(_0x679bf3!==0x194){return db[_0x56c9('0x7f')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x35fdf3},'order':_0x56c9('0x80')})[_0x56c9('0x37')](function(_0x2218df){_0x42dc09=_0x2218df;});}})[_0x56c9('0x2a')](function(_0x30b479){_0x679bf3=0x1f4;logger[_0x56c9('0x26')](_0x30b479[_0x56c9('0x39')]);if(_0x30b479['name']){delete _0x30b479['name'];}_0x42dc09=_0x30b479;})[_0x56c9('0x81')](function(){if(_0x42dc09===null){_0x294013['sendStatus'](_0x679bf3);}else{if(_0x679bf3===0x1f4){_0x294013[_0x56c9('0x2c')](_0x679bf3)[_0x56c9('0x82')](_0x42dc09);}else{_0x294013[_0x56c9('0x2c')](_0x679bf3)[_0x56c9('0x2d')](_0x42dc09);}}});};exports[_0x56c9('0x83')]=function(_0x2d77b1,_0x8e28f7,_0xdf4ab9){var _0x5e4c07={};var _0x38bbf4={};var _0x33ff4d;var _0x2246bc;return db[_0x56c9('0x51')][_0x56c9('0x67')]({'where':{'id':_0x2d77b1['params']['id']}})[_0x56c9('0x37')](handleEntityNotFound(_0x8e28f7,null))['then'](function(_0x1698a8){if(_0x1698a8){_0x33ff4d=_0x1698a8;_0x38bbf4[_0x56c9('0x41')]=_[_0x56c9('0x43')](db['WhatsappApplication']['rawAttributes']);_0x38bbf4[_0x56c9('0x42')]=_['keys'](_0x2d77b1[_0x56c9('0x42')]);_0x38bbf4['filters']=_[_0x56c9('0x45')](_0x38bbf4[_0x56c9('0x41')],_0x38bbf4[_0x56c9('0x42')]);_0x5e4c07[_0x56c9('0x48')]=_[_0x56c9('0x45')](_0x38bbf4['model'],qs['fields'](_0x2d77b1[_0x56c9('0x42')][_0x56c9('0x46')]));_0x5e4c07[_0x56c9('0x48')]=_0x5e4c07[_0x56c9('0x48')]['length']?_0x5e4c07[_0x56c9('0x48')]:_0x38bbf4[_0x56c9('0x41')];_0x5e4c07[_0x56c9('0x4b')]=qs[_0x56c9('0x4c')](_0x2d77b1[_0x56c9('0x42')][_0x56c9('0x4c')]);_0x5e4c07[_0x56c9('0x4d')]=qs['filters'](_[_0x56c9('0x68')](_0x2d77b1[_0x56c9('0x42')],_0x38bbf4[_0x56c9('0x44')]));if(_0x2d77b1[_0x56c9('0x42')][_0x56c9('0x4f')]){_0x5e4c07[_0x56c9('0x4d')]=_[_0x56c9('0x4e')](_0x5e4c07[_0x56c9('0x4d')],{'$or':_['map'](_0x5e4c07[_0x56c9('0x48')],function(_0x583cf5){var _0x25d7df={};_0x25d7df[_0x583cf5]={'$like':'%'+_0x2d77b1[_0x56c9('0x42')][_0x56c9('0x4f')]+'%'};return _0x25d7df;})});}_0x5e4c07=_[_0x56c9('0x4e')]({},_0x5e4c07,_0x2d77b1['options']);return _0x33ff4d[_0x56c9('0x83')](_0x5e4c07);}})[_0x56c9('0x37')](function(_0x3e8ed9){if(_0x3e8ed9){_0x2246bc=_0x3e8ed9[_0x56c9('0x47')];if(!_0x2d77b1['query'][_0x56c9('0x49')](_0x56c9('0x4a'))){_0x5e4c07[_0x56c9('0x31')]=qs[_0x56c9('0x31')](_0x2d77b1[_0x56c9('0x42')][_0x56c9('0x31')]);_0x5e4c07[_0x56c9('0x2e')]=qs[_0x56c9('0x2e')](_0x2d77b1[_0x56c9('0x42')]['offset']);}return _0x33ff4d[_0x56c9('0x83')](_0x5e4c07);}})[_0x56c9('0x37')](function(_0x584cc7){if(_0x584cc7){return _0x584cc7?{'count':_0x2246bc,'rows':_0x584cc7}:null;}})[_0x56c9('0x37')](respondWithResult(_0x8e28f7,null))[_0x56c9('0x2a')](handleError(_0x8e28f7,null));};exports[_0x56c9('0x84')]=function(_0x372e08,_0x1a5eba,_0x32fcae){var _0x1e3635={'channel':_0x56c9('0x85')};var _0x43be79=[];var _0x46b76f=[];var _0x21b5d9={};return db[_0x56c9('0x51')][_0x56c9('0x5e')]({'where':{'id':_0x372e08[_0x56c9('0x56')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x56c9('0x86')}]})['then'](handleEntityNotFound(_0x1a5eba,null))[_0x56c9('0x37')](function(_0x2a53d6){_0x1e3635[_0x56c9('0x87')]=_0x2a53d6;if(_0x1e3635['account']&&_0x1e3635[_0x56c9('0x87')][_0x56c9('0x3f')]===_0x56c9('0x88')&&_0x372e08[_0x56c9('0x58')][_0x56c9('0x89')]){if(_0x372e08[_0x56c9('0x58')]['statuses'][_0x56c9('0x47')]===0x0)return;if(_0x372e08['body'][_0x56c9('0x89')][0x0][_0x56c9('0x8a')]!=='read')return;return db[_0x56c9('0x8b')][_0x56c9('0x36')]({'read':!![],'readAt':_0x372e08[_0x56c9('0x58')][_0x56c9('0x89')][0x0][_0x56c9('0x8c')]},{'where':{'messageId':_0x372e08[_0x56c9('0x58')][_0x56c9('0x89')][0x0][_0x56c9('0x8d')]},'individualHooks':!![]})[_0x56c9('0x37')](function(_0x5c1c56){return _0x1a5eba['status'](0xc8)[_0x56c9('0x2d')](_0x5c1c56);});}_0x1e3635[_0x56c9('0x8e')]=_[_0x56c9('0x8f')](_0x2a53d6[_0x56c9('0x86')],[_0x56c9('0x80')],['asc']);if(_0x1e3635[_0x56c9('0x87')]['Applications']){delete _0x1e3635[_0x56c9('0x87')][_0x56c9('0x86')];}return db[_0x56c9('0x90')][_0x56c9('0x62')]()[_0x56c9('0x37')](function(_0x4e950e){if(!_0x4e950e){throw new db[(_0x56c9('0x91'))]['ValidationError'](_0x56c9('0x92'));}_0x43be79=_[_0x56c9('0x93')](_[_0x56c9('0x43')](_0x4e950e),['createdAt',_0x56c9('0x94')]);_0x46b76f=_[_0x56c9('0x93')](_[_0x56c9('0x43')](_0x4e950e),[_0x56c9('0x95'),'updatedAt','CompanyId',_0x56c9('0x96')]);_0x1e3635[_0x56c9('0x58')]={'mapKey':_0x56c9('0x97')};if(_0x1e3635['account']&&_0x1e3635[_0x56c9('0x87')][_0x56c9('0x3f')]===_0x56c9('0x98')){_0x1e3635[_0x56c9('0x58')][_0x56c9('0x99')]=_0x372e08[_0x56c9('0x58')][_0x56c9('0x9a')][_0x56c9('0x9b')](_0x56c9('0x9c'),'');_0x1e3635[_0x56c9('0x58')][_0x56c9('0x58')]=_0x372e08[_0x56c9('0x58')]['Body'];_0x1e3635['body'][_0x56c9('0x9d')]=_0x372e08['body'][_0x56c9('0x9e')];}if(_0x1e3635['account']&&_0x1e3635['account'][_0x56c9('0x3f')]===_0x56c9('0x88')){_0x1e3635[_0x56c9('0x58')][_0x56c9('0x99')]=_0x372e08['body'][_0x56c9('0x9f')][0x0]['from'];_0x1e3635['body'][_0x56c9('0x58')]=_0x372e08['body']['notifications'][0x0][_0x56c9('0x28')][_0x56c9('0x58')];_0x1e3635['body'][_0x56c9('0x9d')]=_0x372e08['body'][_0x56c9('0x9f')][0x0][_0x56c9('0x8d')];}if(_0x1e3635[_0x56c9('0x58')]['id']){delete _0x1e3635['body']['id'];}if(_[_0x56c9('0xa0')](_0x1e3635['body'][_0x56c9('0x99')])){throw new db[(_0x56c9('0x91'))][(_0x56c9('0xa1'))](_0x56c9('0xa2'));}if(_[_0x56c9('0xa0')](_0x1e3635['body'][_0x56c9('0x58')])||_0x1e3635[_0x56c9('0x58')][_0x56c9('0x58')]===''){throw new db[(_0x56c9('0x91'))][(_0x56c9('0xa1'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x56c9('0xa0')](_0x1e3635['body']['mapKey'])){throw new db[(_0x56c9('0x91'))][(_0x56c9('0xa1'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x46b76f);}if(!_['includes'](_0x46b76f,_0x1e3635['body'][_0x56c9('0xa3')])){throw new db['Sequelize'][(_0x56c9('0xa1'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x46b76f);}_0x21b5d9[_0x1e3635[_0x56c9('0x58')][_0x56c9('0xa3')]]=_0x1e3635[_0x56c9('0x58')][_0x56c9('0x99')];return db[_0x56c9('0xa4')]['find']({'where':{'id':_0x1e3635[_0x56c9('0x87')][_0x56c9('0x96')]},'include':[{'model':db[_0x56c9('0x90')],'as':_0x56c9('0xa5'),'where':_0x21b5d9,'limit':0x1,'order':[[_0x56c9('0x94'),_0x56c9('0xa6')]]}]});})[_0x56c9('0x37')](handleEntityNotFound(_0x1a5eba,null))['then'](function(_0x4f9db8){if(_0x4f9db8){_0x1e3635[_0x56c9('0xa7')]=_[_0x56c9('0x71')](_0x4f9db8,[_0x56c9('0xa5')]);if(_0x4f9db8[_0x56c9('0xa5')][_0x56c9('0x47')]){return _0x4f9db8[_0x56c9('0xa5')][0x0];}var _0x2c441e=_[_0x56c9('0x1a')](_0x1e3635[_0x56c9('0x58')],{'firstName':_0x1e3635[_0x56c9('0x58')][_0x56c9('0x99')],'ListId':_0x4f9db8['id']});_0x2c441e[_0x1e3635[_0x56c9('0x58')]['mapKey']]=_0x1e3635[_0x56c9('0x58')][_0x56c9('0x99')];return db[_0x56c9('0x90')][_0x56c9('0x57')](_0x2c441e,{'fields':_0x43be79,'raw':!![]});}})[_0x56c9('0x37')](handleEntityNotFound(_0x1a5eba,null))[_0x56c9('0x37')](function(_0x13514a){if(_0x13514a){_0x1e3635['contact']=_0x13514a;var _0x53e3a6={'ContactId':_0x13514a['id'],'phone':_0x1e3635[_0x56c9('0x58')][_0x56c9('0x99')],'WhatsappAccountId':_0x372e08[_0x56c9('0x56')]['id']};var _0x31ef05={'ContactId':_0x13514a['id'],'WhatsappAccountId':_0x372e08[_0x56c9('0x56')]['id'],'closed':![]};return db[_0x56c9('0xa8')][_0x56c9('0x5e')]({'where':_0x31ef05})['then'](function(_0x465b62){if(_0x465b62){return[_0x465b62,![]];}return db['WhatsappInteraction'][_0x56c9('0x57')](_0x53e3a6)['then'](function(_0x1df4e7){return[_0x1df4e7,!![]];});});}})[_0x56c9('0x72')](function(_0x180c2d,_0x3371d7){_0x1e3635[_0x56c9('0xa9')]=_0x180c2d['get']({'plain':!![]});_0x1e3635[_0x56c9('0xa9')][_0x56c9('0xaa')]=![];if(_0x3371d7){if(_0x1e3635[_0x56c9('0x87')][_0x56c9('0xab')]){_0x1e3635[_0x56c9('0x8e')][_0x56c9('0xac')]({'id':0x0,'priority':_0x1e3635['applications'][_0x56c9('0x47')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x56c9('0xad')});}_0x1e3635[_0x56c9('0xa9')][_0x56c9('0xaa')]=!![];}return db[_0x56c9('0x8b')]['create']({'phone':_0x1e3635['body'][_0x56c9('0x99')],'messageId':_0x1e3635[_0x56c9('0x58')][_0x56c9('0x9d')],'body':_0x1e3635[_0x56c9('0x58')]['body'],'WhatsappAccountId':_0x372e08['params']['id'],'WhatsappInteractionId':_0x180c2d['id'],'direction':'in','ContactId':_0x180c2d[_0x56c9('0xae')],'AttachmentId':_0x1e3635[_0x56c9('0x58')]['AttachmentId']});})[_0x56c9('0x37')](function(_0x3e970f){_0x1e3635[_0x56c9('0x28')]=_0x3e970f;if(_0x1e3635[_0x56c9('0xa9')]['UserId']){return db[_0x56c9('0x79')]['find']({'attributes':['id',_0x56c9('0x3a')],'where':{'id':_0x1e3635[_0x56c9('0xa9')][_0x56c9('0xaf')]}})[_0x56c9('0x37')](function(_0x54a3d4){if(_0x54a3d4){_0x1e3635[_0x56c9('0x8e')][_0x56c9('0xb0')]({'id':0x0,'priority':0x0,'app':_0x56c9('0xb1'),'appdata':_0x54a3d4[_0x56c9('0x3a')]+','+(_0x1e3635[_0x56c9('0x87')][_0x56c9('0xb2')]||0xa),'interval':_0x56c9('0xad')});}return respondWithRpcPromise(_0x56c9('0xb3'),_0x56c9('0xb4'),_0x1e3635);});}return respondWithRpcPromise('Start',_0x56c9('0xb4'),_0x1e3635);})[_0x56c9('0x37')](function(_0x2df111){if(_0x2df111){var _0x256a9f=0xc8;var _0x4040a1=_0x56c9('0xb5');logger[_0x56c9('0x22')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4040a1,_0x256a9f,_0x56c9('0xb6'));logger[_0x56c9('0x25')](_0x56c9('0xb7'),_0x4040a1,_0x256a9f,_0x56c9('0xb6'),JSON[_0x56c9('0xb8')](_0x2df111));if(_0x1e3635[_0x56c9('0x87')][_0x56c9('0x3f')]===_0x56c9('0x98')){return _0x1a5eba[_0x56c9('0x2c')](_0x256a9f)[_0x56c9('0x32')]('Content-Type',_0x56c9('0xb9'))[_0x56c9('0x82')](_0x56c9('0xba'));}else{return _0x1a5eba[_0x56c9('0x2c')](_0x256a9f)[_0x56c9('0x2d')](_0x2df111);}}});})[_0x56c9('0x2a')](handleError(_0x1a5eba,null));};exports['send']=function(_0x177fda,_0x1d7a8f,_0x547b89){var _0x3754fb,_0x5bf1d5,_0x5f4b3e;if(_[_0x56c9('0xa0')](_0x177fda[_0x56c9('0x58')]['body'])||_0x177fda['body'][_0x56c9('0x58')]===''){throw new db[(_0x56c9('0x91'))][(_0x56c9('0xa1'))](_0x56c9('0xbb'));}if(_[_0x56c9('0xa0')](_0x177fda[_0x56c9('0x58')]['to'])){throw new db[(_0x56c9('0x91'))]['ValidationError']('to\x20is\x20mandatory');}_0x3754fb=_0x177fda[_0x56c9('0x58')]['to'];return db[_0x56c9('0x51')]['find']({'where':{'id':_0x177fda[_0x56c9('0x56')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x3754fb},'limit':0x1,'order':[[_0x56c9('0x94'),_0x56c9('0xa6')]]}]}]})['then'](handleEntityNotFound(_0x1d7a8f,null))['then'](function(_0x6a0542){if(_0x6a0542&&_0x6a0542[_0x56c9('0xbc')]){_0x5bf1d5=_0x6a0542[_0x56c9('0x5a')]({'plain':!![]});if(_0x5bf1d5[_0x56c9('0xbc')]&&_0x5bf1d5['List'][_0x56c9('0xa5')][_0x56c9('0x47')]){return _0x5bf1d5['List'][_0x56c9('0xa5')][0x0];}return db[_0x56c9('0x90')][_0x56c9('0x57')](_['defaults'](_0x177fda[_0x56c9('0x58')],{'firstName':_0x3754fb,'mobile':_0x3754fb,'phone':_0x3754fb,'ListId':_0x5bf1d5[_0x56c9('0x96')]}));}})[_0x56c9('0x37')](handleEntityNotFound(_0x1d7a8f,null))[_0x56c9('0x37')](function(_0x22dff9){if(_0x22dff9){_0x5f4b3e=_0x22dff9;return db['WhatsappInteraction'][_0x56c9('0x5e')]({'where':{'ContactId':_0x5f4b3e['id'],'closed':![],'WhatsappAccountId':_0x5bf1d5['id']}})[_0x56c9('0x37')](function(_0x709360){if(_0x709360){return[_0x709360,![]];}return db['WhatsappInteraction'][_0x56c9('0x57')]({'UserId':_0x177fda['user']['id'],'ContactId':_0x5f4b3e['id'],'WhatsappAccountId':_0x5bf1d5['id'],'phone':_0x3754fb,'firstMsgDirection':'out','Messages':[_[_0x56c9('0x4e')](_0x177fda[_0x56c9('0x58')],{'read':![],'body':_0x177fda[_0x56c9('0x58')][_0x56c9('0x58')],'phone':_0x3754fb,'WhatsappAccountId':_0x5bf1d5['id'],'UserId':_0x177fda[_0x56c9('0x59')]['id'],'ContactId':_0x5f4b3e['id']})]},{'include':[{'model':db[_0x56c9('0x8b')],'as':'Messages'}]})[_0x56c9('0x37')](function(_0xc1bcb4){return[_0xc1bcb4,!![]];});});}})[_0x56c9('0x72')](function(_0x2796fd,_0x4e0ad5){if(_0x4e0ad5){return _0x2796fd;}return db[_0x56c9('0x8b')][_0x56c9('0x57')](_[_0x56c9('0x4e')](_0x177fda[_0x56c9('0x58')],{'read':![],'body':_0x177fda[_0x56c9('0x58')][_0x56c9('0x58')],'phone':_0x3754fb,'WhatsappAccountId':_0x5bf1d5['id'],'WhatsappInteractionId':_0x2796fd['id'],'UserId':_0x177fda[_0x56c9('0x59')]['id'],'ContactId':_0x5f4b3e['id']}))[_0x56c9('0x37')](function(_0x5a63af){_0x2796fd['dataValues']['Messages']=[];_0x2796fd[_0x56c9('0xbd')]['Messages'][_0x56c9('0xac')](_0x5a63af[_0x56c9('0xbd')]);return _0x2796fd;});})[_0x56c9('0x37')](respondWithResult(_0x1d7a8f,null))['catch'](handleError(_0x1d7a8f,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 242b512..0038de1 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 _0x5b73=['../../mysqldb','WhatsappAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3bea89,_0x450dea){var _0x30c612=function(_0x2ff672){while(--_0x2ff672){_0x3bea89['push'](_0x3bea89['shift']());}};_0x30c612(++_0x450dea);}(_0x5b73,0x120));var _0x35b7=function(_0x50e593,_0x3ae998){_0x50e593=_0x50e593-0x0;var _0x3821d0=_0x5b73[_0x50e593];return _0x3821d0;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x35b7('0x0'))['db'][_0x35b7('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x35b7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x35b7('0x3'),'afterDestroy':_0x35b7('0x4')};function emitEvent(_0xeb23cd){return function(_0x5b1063,_0x1f046a,_0x1a21d4){WhatsappAccountEvents[_0x35b7('0x5')](_0xeb23cd+':'+_0x5b1063['id'],_0x5b1063);WhatsappAccountEvents['emit'](_0xeb23cd,_0x5b1063);_0x1a21d4(null);};}for(var e in events){if(events[_0x35b7('0x6')](e)){var event=events[e];WhatsappAccount[_0x35b7('0x7')](e,emitEvent(event));}}module[_0x35b7('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x2809=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','update','remove'];(function(_0x12939d,_0x24971d){var _0x38f9ab=function(_0x23a8d5){while(--_0x23a8d5){_0x12939d['push'](_0x12939d['shift']());}};_0x38f9ab(++_0x24971d);}(_0x2809,0x190));var _0x9280=function(_0x3a8db5,_0x31cff7){_0x3a8db5=_0x3a8db5-0x0;var _0x2c03cd=_0x2809[_0x3a8db5];return _0x2c03cd;};'use strict';var EventEmitter=require(_0x9280('0x0'));var WhatsappAccount=require(_0x9280('0x1'))['db'][_0x9280('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9280('0x3'),'afterDestroy':_0x9280('0x4')};function emitEvent(_0x301638){return function(_0xd5674a,_0x26727b,_0x163b81){WhatsappAccountEvents[_0x9280('0x5')](_0x301638+':'+_0xd5674a['id'],_0xd5674a);WhatsappAccountEvents[_0x9280('0x5')](_0x301638,_0xd5674a);_0x163b81(null);};}for(var e in events){if(events[_0x9280('0x6')](e)){var event=events[e];WhatsappAccount[_0x9280('0x7')](e,emitEvent(event));}}module[_0x9280('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 17fe95b..99f1eda 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 _0x6872=['lodash','api','moment','bluebird','request-promise','rimraf','exports','define','WhatsappAccount','whatsapp_accounts'];(function(_0x42f34c,_0x190ed2){var _0xf9fb24=function(_0x2f5f2b){while(--_0x2f5f2b){_0x42f34c['push'](_0x42f34c['shift']());}};_0xf9fb24(++_0x190ed2);}(_0x6872,0x6e));var _0x2687=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0x6872[_0x176329];return _0x31997c;};'use strict';var _=require(_0x2687('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2687('0x1'));var moment=require(_0x2687('0x2'));var BPromise=require(_0x2687('0x3'));var rp=require(_0x2687('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2687('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappAccount.attributes');module[_0x2687('0x6')]=function(_0x335d26,_0x32f833){return _0x335d26[_0x2687('0x7')](_0x2687('0x8'),attributes,{'tableName':_0x2687('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa323=['../../config/logger','api','path','rimraf','../../config/environment','./whatsappAccount.attributes','lodash','util'];(function(_0x17abfb,_0x20c3e3){var _0x34c17b=function(_0x372816){while(--_0x372816){_0x17abfb['push'](_0x17abfb['shift']());}};_0x34c17b(++_0x20c3e3);}(_0xa323,0x166));var _0x3a32=function(_0x409682,_0x370090){_0x409682=_0x409682-0x0;var _0x1ee901=_0xa323[_0x409682];return _0x1ee901;};'use strict';var _=require(_0x3a32('0x0'));var util=require(_0x3a32('0x1'));var logger=require(_0x3a32('0x2'))(_0x3a32('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3a32('0x4'));var rimraf=require(_0x3a32('0x5'));var config=require(_0x3a32('0x6'));var attributes=require(_0x3a32('0x7'));module['exports']=function(_0x535ea5,_0x2161a3){return _0x535ea5['define']('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','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 fa3ae53..a84fc0a 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 _0x9feb=['../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','request','then','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappAccount,\x20%s,\x20%s','ShowWhatsappAccount','WhatsappAccount','find','options','raw','attributes','include','map','model','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x53711b,_0x4be77a){var _0x29f455=function(_0x562f16){while(--_0x562f16){_0x53711b['push'](_0x53711b['shift']());}};_0x29f455(++_0x4be77a);}(_0x9feb,0x1c0));var _0xb9fe=function(_0x3dd567,_0x276ca9){_0x3dd567=_0x3dd567-0x0;var _0x415024=_0x9feb[_0x3dd567];return _0x415024;};'use strict';var _=require(_0xb9fe('0x0'));var util=require(_0xb9fe('0x1'));var moment=require(_0xb9fe('0x2'));var BPromise=require(_0xb9fe('0x3'));var rs=require(_0xb9fe('0x4'));var fs=require('fs');var Redis=require(_0xb9fe('0x5'));var db=require(_0xb9fe('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb9fe('0x7'))(_0xb9fe('0x8'));var config=require(_0xb9fe('0x9'));var jayson=require(_0xb9fe('0xa'));var client=jayson['client'][_0xb9fe('0xb')]({'port':0x232a});config[_0xb9fe('0xc')]=_[_0xb9fe('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb9fe('0xe'))(new Redis(config[_0xb9fe('0xc')]));require('./whatsappAccount.socket')[_0xb9fe('0xf')](socket);function respondWithRpcPromise(_0x545b9b,_0x35b640,_0x5822b6){return new BPromise(function(_0x24ea90,_0x1dd843){return client[_0xb9fe('0x10')](_0x545b9b,_0x5822b6)[_0xb9fe('0x11')](function(_0x3649d1){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x35b640,_0xb9fe('0x12'));logger['debug'](_0xb9fe('0x13'),_0x35b640,_0xb9fe('0x12'),JSON[_0xb9fe('0x14')](_0x3649d1));if(_0x3649d1[_0xb9fe('0x15')]){if(_0x3649d1[_0xb9fe('0x15')][_0xb9fe('0x16')]===0x1f4){logger[_0xb9fe('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x35b640,_0x3649d1['error'][_0xb9fe('0x17')]);return _0x1dd843(_0x3649d1[_0xb9fe('0x15')][_0xb9fe('0x17')]);}logger[_0xb9fe('0x15')](_0xb9fe('0x18'),_0x35b640,_0x3649d1['error'][_0xb9fe('0x17')]);return _0x24ea90(_0x3649d1[_0xb9fe('0x15')][_0xb9fe('0x17')]);}else{logger['info'](_0xb9fe('0x18'),_0x35b640,_0xb9fe('0x12'));_0x24ea90(_0x3649d1['result']['message']);}})['catch'](function(_0x1fa7d0){logger[_0xb9fe('0x15')](_0xb9fe('0x18'),_0x35b640,_0x1fa7d0);_0x1dd843(_0x1fa7d0);});});}exports[_0xb9fe('0x19')]=function(_0x13e68a){var _0x50e91b=this;return new Promise(function(_0x32c3f8,_0x416f13){return db[_0xb9fe('0x1a')][_0xb9fe('0x1b')]({'raw':_0x13e68a[_0xb9fe('0x1c')]?_0x13e68a[_0xb9fe('0x1c')][_0xb9fe('0x1d')]===undefined?!![]:![]:!![],'where':_0x13e68a['options']?_0x13e68a['options']['where']||null:null,'attributes':_0x13e68a[_0xb9fe('0x1c')]?_0x13e68a[_0xb9fe('0x1c')][_0xb9fe('0x1e')]||null:null,'include':_0x13e68a['options']?_0x13e68a['options'][_0xb9fe('0x1f')]?_[_0xb9fe('0x20')](_0x13e68a[_0xb9fe('0x1c')][_0xb9fe('0x1f')],function(_0xd4310c){return{'model':db[_0xd4310c[_0xb9fe('0x21')]],'as':_0xd4310c['as'],'attributes':_0xd4310c[_0xb9fe('0x1e')],'include':_0xd4310c[_0xb9fe('0x1f')]?_['map'](_0xd4310c[_0xb9fe('0x1f')],function(_0x31ad43){return{'model':db[_0x31ad43[_0xb9fe('0x21')]],'as':_0x31ad43['as'],'attributes':_0x31ad43['attributes'],'include':_0x31ad43[_0xb9fe('0x1f')]?_[_0xb9fe('0x20')](_0x31ad43['include'],function(_0x5c9cf4){return{'model':db[_0x5c9cf4[_0xb9fe('0x21')]],'as':_0x5c9cf4['as'],'attributes':_0x5c9cf4[_0xb9fe('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb9fe('0x11')](function(_0x499d59){logger[_0xb9fe('0x22')]('ShowWhatsappAccount',_0x13e68a);logger['debug'](_0xb9fe('0x19'),_0x13e68a,JSON[_0xb9fe('0x14')](_0x499d59));_0x32c3f8(_0x499d59);})['catch'](function(_0x49ed4c){logger['error'](_0xb9fe('0x19'),_0x49ed4c[_0xb9fe('0x17')],_0x13e68a);_0x416f13(_0x50e91b['error'](0x1f4,_0x49ed4c[_0xb9fe('0x17')]));});});}; \ No newline at end of file +var _0x207a=['include','model','map','then','ShowWhatsappAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','result','catch','WhatsappAccount','find','options','raw','where','attributes'];(function(_0xf7500e,_0xd988da){var _0x423895=function(_0xe45280){while(--_0xe45280){_0xf7500e['push'](_0xf7500e['shift']());}};_0x423895(++_0xd988da);}(_0x207a,0x12d));var _0xa207=function(_0xa72f73,_0x8058d1){_0xa72f73=_0xa72f73-0x0;var _0x190264=_0x207a[_0xa72f73];return _0x190264;};'use strict';var _=require(_0xa207('0x0'));var util=require('util');var moment=require(_0xa207('0x1'));var BPromise=require(_0xa207('0x2'));var rs=require(_0xa207('0x3'));var fs=require('fs');var Redis=require(_0xa207('0x4'));var db=require(_0xa207('0x5'))['db'];var utils=require(_0xa207('0x6'));var logger=require(_0xa207('0x7'))(_0xa207('0x8'));var config=require('../../config/environment');var jayson=require(_0xa207('0x9'));var client=jayson[_0xa207('0xa')]['http']({'port':0x232a});config[_0xa207('0xb')]=_[_0xa207('0xc')](config[_0xa207('0xb')],{'host':_0xa207('0xd'),'port':0x18eb});var socket=require(_0xa207('0xe'))(new Redis(config[_0xa207('0xb')]));require('./whatsappAccount.socket')[_0xa207('0xf')](socket);function respondWithRpcPromise(_0x59f194,_0x3dad8b,_0x368284){return new BPromise(function(_0x2b83f0,_0xe5494d){return client['request'](_0x59f194,_0x368284)['then'](function(_0x33db19){logger[_0xa207('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x3dad8b,_0xa207('0x11'));logger[_0xa207('0x12')](_0xa207('0x13'),_0x3dad8b,_0xa207('0x11'),JSON[_0xa207('0x14')](_0x33db19));if(_0x33db19[_0xa207('0x15')]){if(_0x33db19[_0xa207('0x15')]['code']===0x1f4){logger[_0xa207('0x15')](_0xa207('0x16'),_0x3dad8b,_0x33db19[_0xa207('0x15')]['message']);return _0xe5494d(_0x33db19[_0xa207('0x15')]['message']);}logger[_0xa207('0x15')](_0xa207('0x16'),_0x3dad8b,_0x33db19[_0xa207('0x15')]['message']);return _0x2b83f0(_0x33db19[_0xa207('0x15')][_0xa207('0x17')]);}else{logger[_0xa207('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x3dad8b,_0xa207('0x11'));_0x2b83f0(_0x33db19[_0xa207('0x18')][_0xa207('0x17')]);}})[_0xa207('0x19')](function(_0x4b8a94){logger[_0xa207('0x15')](_0xa207('0x16'),_0x3dad8b,_0x4b8a94);_0xe5494d(_0x4b8a94);});});}exports['ShowWhatsappAccount']=function(_0x51b4a6){var _0xa1fc6c=this;return new Promise(function(_0x489b8d,_0x20efa5){return db[_0xa207('0x1a')][_0xa207('0x1b')]({'raw':_0x51b4a6['options']?_0x51b4a6[_0xa207('0x1c')][_0xa207('0x1d')]===undefined?!![]:![]:!![],'where':_0x51b4a6[_0xa207('0x1c')]?_0x51b4a6[_0xa207('0x1c')][_0xa207('0x1e')]||null:null,'attributes':_0x51b4a6[_0xa207('0x1c')]?_0x51b4a6['options'][_0xa207('0x1f')]||null:null,'include':_0x51b4a6['options']?_0x51b4a6['options'][_0xa207('0x20')]?_['map'](_0x51b4a6['options'][_0xa207('0x20')],function(_0x2351d5){return{'model':db[_0x2351d5[_0xa207('0x21')]],'as':_0x2351d5['as'],'attributes':_0x2351d5[_0xa207('0x1f')],'include':_0x2351d5[_0xa207('0x20')]?_[_0xa207('0x22')](_0x2351d5[_0xa207('0x20')],function(_0x18cdb6){return{'model':db[_0x18cdb6['model']],'as':_0x18cdb6['as'],'attributes':_0x18cdb6[_0xa207('0x1f')],'include':_0x18cdb6[_0xa207('0x20')]?_[_0xa207('0x22')](_0x18cdb6[_0xa207('0x20')],function(_0x5b4107){return{'model':db[_0x5b4107[_0xa207('0x21')]],'as':_0x5b4107['as'],'attributes':_0x5b4107[_0xa207('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa207('0x23')](function(_0x5cb68b){logger[_0xa207('0x10')]('ShowWhatsappAccount',_0x51b4a6);logger[_0xa207('0x12')](_0xa207('0x24'),_0x51b4a6,JSON['stringify'](_0x5cb68b));_0x489b8d(_0x5cb68b);})[_0xa207('0x19')](function(_0x32205e){logger['error'](_0xa207('0x24'),_0x32205e['message'],_0x51b4a6);_0x20efa5(_0xa1fc6c[_0xa207('0x15')](0x1f4,_0x32205e['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index d6d2c8b..2cde175 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 _0x1001=['update','emit','removeListener','length','./whatsappAccount.events','save','remove'];(function(_0x5c0887,_0x403b13){var _0x5ca591=function(_0x38aadb){while(--_0x38aadb){_0x5c0887['push'](_0x5c0887['shift']());}};_0x5ca591(++_0x403b13);}(_0x1001,0xe4));var _0x1100=function(_0x37b6ae,_0x4972a6){_0x37b6ae=_0x37b6ae-0x0;var _0x137b4e=_0x1001[_0x37b6ae];return _0x137b4e;};'use strict';var WhatsappAccountEvents=require(_0x1100('0x0'));var events=[_0x1100('0x1'),_0x1100('0x2'),_0x1100('0x3')];function createListener(_0x17a56e,_0x1c5108){return function(_0x47e13f){_0x1c5108[_0x1100('0x4')](_0x17a56e,_0x47e13f);};}function removeListener(_0x298966,_0x552c15){return function(){WhatsappAccountEvents[_0x1100('0x5')](_0x298966,_0x552c15);};}exports['register']=function(_0x750b74){for(var _0x257579=0x0,_0x551108=events[_0x1100('0x6')];_0x257579<_0x551108;_0x257579++){var _0x56893e=events[_0x257579];var _0x30401d=createListener('whatsappAccount:'+_0x56893e,_0x750b74);WhatsappAccountEvents['on'](_0x56893e,_0x30401d);}}; \ No newline at end of file +var _0x8a37=['save','remove','update','emit','removeListener','register','length','./whatsappAccount.events'];(function(_0x1221fc,_0x129596){var _0x5210a7=function(_0x4e7d68){while(--_0x4e7d68){_0x1221fc['push'](_0x1221fc['shift']());}};_0x5210a7(++_0x129596);}(_0x8a37,0x77));var _0x78a3=function(_0x94ff4f,_0x4e7570){_0x94ff4f=_0x94ff4f-0x0;var _0x412c53=_0x8a37[_0x94ff4f];return _0x412c53;};'use strict';var WhatsappAccountEvents=require(_0x78a3('0x0'));var events=[_0x78a3('0x1'),_0x78a3('0x2'),_0x78a3('0x3')];function createListener(_0x5d9e86,_0x1cdd26){return function(_0x4b3ac4){_0x1cdd26[_0x78a3('0x4')](_0x5d9e86,_0x4b3ac4);};}function removeListener(_0x5578d6,_0x377e13){return function(){WhatsappAccountEvents[_0x78a3('0x5')](_0x5578d6,_0x377e13);};}exports[_0x78a3('0x6')]=function(_0x5f3053){for(var _0x5943f9=0x0,_0x5606b1=events[_0x78a3('0x7')];_0x5943f9<_0x5606b1;_0x5943f9++){var _0x556d25=events[_0x5943f9];var _0x46112b=createListener('whatsappAccount:'+_0x556d25,_0x5f3053);WhatsappAccountEvents['on'](_0x556d25,_0x46112b);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 5864906..8cb4973 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 _0xd953=['isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','get'];(function(_0xd22241,_0x3a9d8b){var _0x1fc020=function(_0x5ed440){while(--_0x5ed440){_0xd22241['push'](_0xd22241['shift']());}};_0x1fc020(++_0x3a9d8b);}(_0xd953,0xe7));var _0x3d95=function(_0x5ac8a0,_0x46420b){_0x5ac8a0=_0x5ac8a0-0x0;var _0x1401fd=_0xd953[_0x5ac8a0];return _0x1401fd;};'use strict';var multer=require('multer');var util=require(_0x3d95('0x0'));var path=require(_0x3d95('0x1'));var timeout=require(_0x3d95('0x2'));var express=require(_0x3d95('0x3'));var router=express[_0x3d95('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3d95('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router[_0x3d95('0x6')]('/',auth[_0x3d95('0x7')](),controller['index']);router['get'](_0x3d95('0x8'),auth['isAuthenticated'](),controller[_0x3d95('0x9')]);router[_0x3d95('0xa')]('/',auth['isAuthenticated'](),controller[_0x3d95('0xb')]);router[_0x3d95('0xc')](_0x3d95('0x8'),auth[_0x3d95('0x7')](),controller[_0x3d95('0xd')]);router[_0x3d95('0xe')](_0x3d95('0x8'),auth[_0x3d95('0x7')](),controller[_0x3d95('0xf')]);module[_0x3d95('0x10')]=router; \ No newline at end of file +var _0xf88f=['multer','util','path','express','../../components/auth/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','index','get','show','create','put','update','destroy','exports'];(function(_0x53c4e1,_0x4234b1){var _0x3f8a97=function(_0x5ce6d9){while(--_0x5ce6d9){_0x53c4e1['push'](_0x53c4e1['shift']());}};_0x3f8a97(++_0x4234b1);}(_0xf88f,0x1e0));var _0xff88=function(_0x4496df,_0x20ed1f){_0x4496df=_0x4496df-0x0;var _0x9dc301=_0xf88f[_0x4496df];return _0x9dc301;};'use strict';var multer=require(_0xff88('0x0'));var util=require(_0xff88('0x1'));var path=require(_0xff88('0x2'));var timeout=require('connect-timeout');var express=require(_0xff88('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xff88('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xff88('0x5'));var controller=require(_0xff88('0x6'));router['get']('/',auth[_0xff88('0x7')](),controller[_0xff88('0x8')]);router[_0xff88('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xff88('0xa')]);router['post']('/',auth[_0xff88('0x7')](),controller[_0xff88('0xb')]);router[_0xff88('0xc')]('/:id',auth[_0xff88('0x7')](),controller[_0xff88('0xd')]);router['delete']('/:id',auth[_0xff88('0x7')](),controller[_0xff88('0xe')]);module[_0xff88('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 5db110c..469958a 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 _0x3542=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x581249,_0x483f03){var _0x284bae=function(_0x2faadd){while(--_0x2faadd){_0x581249['push'](_0x581249['shift']());}};_0x284bae(++_0x483f03);}(_0x3542,0xc3));var _0x2354=function(_0x53afe9,_0x2c9f40){_0x53afe9=_0x53afe9-0x0;var _0x396396=_0x3542[_0x53afe9];return _0x396396;};'use strict';var Sequelize=require(_0x2354('0x0'));module[_0x2354('0x1')]={'priority':{'type':Sequelize[_0x2354('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2354('0x3')],'allowNull':![],'defaultValue':_0x2354('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x2354('0x3')]},'interval':{'type':Sequelize[_0x2354('0x3')],'defaultValue':_0x2354('0x5')}}; \ No newline at end of file +var _0x25b7=['TEXT','STRING','*,*,*,*','sequelize','INTEGER'];(function(_0x5bfe28,_0x62610){var _0x23dd48=function(_0x5e195a){while(--_0x5e195a){_0x5bfe28['push'](_0x5bfe28['shift']());}};_0x23dd48(++_0x62610);}(_0x25b7,0x1d4));var _0x725b=function(_0xe6aa70,_0x12ebbe){_0xe6aa70=_0xe6aa70-0x0;var _0x55167c=_0x25b7[_0xe6aa70];return _0x55167c;};'use strict';var Sequelize=require(_0x725b('0x0'));module['exports']={'priority':{'type':Sequelize[_0x725b('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x725b('0x2')]()},'description':{'type':Sequelize[_0x725b('0x3')]},'interval':{'type':Sequelize[_0x725b('0x3')],'defaultValue':_0x725b('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index dc0128a..0a2904d 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 _0xd386=['../../config/logger','api','../../config/utils','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','then','end','error','name','send','index','WhatsappApplication','fieldName','model','map','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','rawAttributes','filters','intersection','find','create','body','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xaf660a,_0x31e141){var _0x9626e2=function(_0x31c7a3){while(--_0x31c7a3){_0xaf660a['push'](_0xaf660a['shift']());}};_0x9626e2(++_0x31e141);}(_0xd386,0x10c));var _0x6d38=function(_0x253673,_0x3287fb){_0x253673=_0x253673-0x0;var _0x259903=_0xd386[_0x253673];return _0x259903;};'use strict';var emlformat=require(_0x6d38('0x0'));var rimraf=require(_0x6d38('0x1'));var zipdir=require(_0x6d38('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6d38('0x3'));var moment=require(_0x6d38('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6d38('0x5'));var util=require(_0x6d38('0x6'));var path=require(_0x6d38('0x7'));var sox=require(_0x6d38('0x8'));var csv=require('to-csv');var ejs=require(_0x6d38('0x9'));var fs=require('fs');var fs_extra=require(_0x6d38('0xa'));var _=require(_0x6d38('0xb'));var squel=require(_0x6d38('0xc'));var crypto=require(_0x6d38('0xd'));var jsforce=require(_0x6d38('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6d38('0xf'));var querystring=require('querystring');var Papa=require(_0x6d38('0x10'));var Redis=require('ioredis');var authService=require(_0x6d38('0x11'));var qs=require(_0x6d38('0x12'));var as=require(_0x6d38('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6d38('0x14'))(_0x6d38('0x15'));var utils=require(_0x6d38('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bde60,_0x2d904c){_0x2d904c=_0x2d904c||0xcc;return function(_0x1f75fa){if(_0x1f75fa){return _0x1bde60[_0x6d38('0x17')](_0x2d904c);}return _0x1bde60[_0x6d38('0x18')](_0x2d904c)['end']();};}function respondWithResult(_0xa01398,_0x499239){_0x499239=_0x499239||0xc8;return function(_0x8a13ed){if(_0x8a13ed){return _0xa01398[_0x6d38('0x18')](_0x499239)[_0x6d38('0x19')](_0x8a13ed);}};}function respondWithFilteredResult(_0x22a822,_0x30a7f5){return function(_0x49c7ac){if(_0x49c7ac){var _0x585db3=typeof _0x30a7f5['offset']===_0x6d38('0x1a')&&typeof _0x30a7f5[_0x6d38('0x1b')]===_0x6d38('0x1a');var _0xdc66e8=_0x49c7ac[_0x6d38('0x1c')];var _0x11298c=_0x585db3?0x0:_0x30a7f5['offset'];var _0x278829=_0x585db3?_0x49c7ac[_0x6d38('0x1c')]:_0x30a7f5[_0x6d38('0x1d')]+_0x30a7f5[_0x6d38('0x1b')];var _0x29a768;if(_0x278829>=_0xdc66e8){_0x278829=_0xdc66e8;_0x29a768=0xc8;}else{_0x29a768=0xce;}_0x22a822[_0x6d38('0x18')](_0x29a768);return _0x22a822[_0x6d38('0x1e')](_0x6d38('0x1f'),_0x11298c+'-'+_0x278829+'/'+_0xdc66e8)['json'](_0x49c7ac);}return null;};}function patchUpdates(_0x3da186){return function(_0x24680b){try{jsonpatch['apply'](_0x24680b,_0x3da186,!![]);}catch(_0x4b68a4){return BPromise[_0x6d38('0x20')](_0x4b68a4);}return _0x24680b[_0x6d38('0x21')]();};}function saveUpdates(_0x45708c,_0x153cae){return function(_0x593d66){if(_0x593d66){return _0x593d66[_0x6d38('0x22')](_0x45708c)['then'](function(_0x44ad2d){return _0x44ad2d;});}return null;};}function removeEntity(_0x52f608,_0x473895){return function(_0x509860){if(_0x509860){return _0x509860[_0x6d38('0x23')]()[_0x6d38('0x24')](function(){_0x52f608[_0x6d38('0x18')](0xcc)[_0x6d38('0x25')]();});}};}function handleEntityNotFound(_0x3c777a,_0x4fc364){return function(_0x5dfb0c){if(!_0x5dfb0c){_0x3c777a[_0x6d38('0x17')](0x194);}return _0x5dfb0c;};}function handleError(_0x7f5c61,_0x552e59){_0x552e59=_0x552e59||0x1f4;return function(_0x4f2769){logger[_0x6d38('0x26')](_0x4f2769['stack']);if(_0x4f2769['name']){delete _0x4f2769[_0x6d38('0x27')];}_0x7f5c61[_0x6d38('0x18')](_0x552e59)[_0x6d38('0x28')](_0x4f2769);};}exports[_0x6d38('0x29')]=function(_0x2b73af,_0x19a674){var _0x513f13={},_0x3e62cf={},_0x572648={'count':0x0,'rows':[]};var _0x19ab6e=_['map'](db[_0x6d38('0x2a')]['rawAttributes'],function(_0x2eddcc){return{'name':_0x2eddcc[_0x6d38('0x2b')],'type':_0x2eddcc['type']['key']};});_0x3e62cf[_0x6d38('0x2c')]=_[_0x6d38('0x2d')](_0x19ab6e,_0x6d38('0x27'));_0x3e62cf[_0x6d38('0x2e')]=_[_0x6d38('0x2f')](_0x2b73af[_0x6d38('0x2e')]);_0x3e62cf['filters']=_['intersection'](_0x3e62cf[_0x6d38('0x2c')],_0x3e62cf['query']);_0x513f13[_0x6d38('0x30')]=_['intersection'](_0x3e62cf[_0x6d38('0x2c')],qs[_0x6d38('0x31')](_0x2b73af[_0x6d38('0x2e')]['fields']));_0x513f13[_0x6d38('0x30')]=_0x513f13[_0x6d38('0x30')][_0x6d38('0x32')]?_0x513f13[_0x6d38('0x30')]:_0x3e62cf[_0x6d38('0x2c')];if(!_0x2b73af[_0x6d38('0x2e')][_0x6d38('0x33')](_0x6d38('0x34'))){_0x513f13[_0x6d38('0x1b')]=qs['limit'](_0x2b73af[_0x6d38('0x2e')][_0x6d38('0x1b')]);_0x513f13[_0x6d38('0x1d')]=qs['offset'](_0x2b73af['query'][_0x6d38('0x1d')]);}_0x513f13['order']=qs[_0x6d38('0x35')](_0x2b73af[_0x6d38('0x2e')][_0x6d38('0x35')]);_0x513f13[_0x6d38('0x36')]=qs['filters'](_[_0x6d38('0x37')](_0x2b73af['query'],_0x3e62cf['filters']),_0x19ab6e);if(_0x2b73af[_0x6d38('0x2e')][_0x6d38('0x38')]){_0x513f13['where']=_['merge'](_0x513f13[_0x6d38('0x36')],{'$or':_[_0x6d38('0x2d')](_0x19ab6e,function(_0x58b5bc){if(_0x58b5bc['type']!==_0x6d38('0x39')){var _0x4491c4={};_0x4491c4[_0x58b5bc['name']]={'$like':'%'+_0x2b73af['query'][_0x6d38('0x38')]+'%'};return _0x4491c4;}})});}_0x513f13=_[_0x6d38('0x3a')]({},_0x513f13,_0x2b73af[_0x6d38('0x3b')]);var _0x2a17a5={'where':_0x513f13[_0x6d38('0x36')]};return db[_0x6d38('0x2a')][_0x6d38('0x1c')](_0x2a17a5)['then'](function(_0x1f4732){_0x572648[_0x6d38('0x1c')]=_0x1f4732;if(_0x2b73af['query'][_0x6d38('0x3c')]){_0x513f13[_0x6d38('0x3d')]=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x513f13);})['then'](function(_0x5c789d){_0x572648[_0x6d38('0x3e')]=_0x5c789d;return _0x572648;})[_0x6d38('0x24')](respondWithFilteredResult(_0x19a674,_0x513f13))['catch'](handleError(_0x19a674,null));};exports[_0x6d38('0x3f')]=function(_0x16da57,_0x4ea04c){var _0x49f278={'raw':!![],'where':{'id':_0x16da57[_0x6d38('0x40')]['id']}},_0x26203c={};_0x26203c[_0x6d38('0x2c')]=_[_0x6d38('0x2f')](db['WhatsappApplication'][_0x6d38('0x41')]);_0x26203c[_0x6d38('0x2e')]=_[_0x6d38('0x2f')](_0x16da57[_0x6d38('0x2e')]);_0x26203c[_0x6d38('0x42')]=_[_0x6d38('0x43')](_0x26203c[_0x6d38('0x2c')],_0x26203c[_0x6d38('0x2e')]);_0x49f278[_0x6d38('0x30')]=_[_0x6d38('0x43')](_0x26203c['model'],qs[_0x6d38('0x31')](_0x16da57[_0x6d38('0x2e')][_0x6d38('0x31')]));_0x49f278[_0x6d38('0x30')]=_0x49f278['attributes'][_0x6d38('0x32')]?_0x49f278[_0x6d38('0x30')]:_0x26203c[_0x6d38('0x2c')];if(_0x16da57[_0x6d38('0x2e')][_0x6d38('0x3c')]){_0x49f278[_0x6d38('0x3d')]=[{'all':!![]}];}_0x49f278=_[_0x6d38('0x3a')]({},_0x49f278,_0x16da57[_0x6d38('0x3b')]);return db[_0x6d38('0x2a')][_0x6d38('0x44')](_0x49f278)[_0x6d38('0x24')](handleEntityNotFound(_0x4ea04c,null))['then'](respondWithResult(_0x4ea04c,null))['catch'](handleError(_0x4ea04c,null));};exports[_0x6d38('0x45')]=function(_0x5de7c4,_0x50f0c7){return db['WhatsappApplication'][_0x6d38('0x45')](_0x5de7c4[_0x6d38('0x46')],{})[_0x6d38('0x24')](respondWithResult(_0x50f0c7,0xc9))['catch'](handleError(_0x50f0c7,null));};exports[_0x6d38('0x22')]=function(_0x30bfc0,_0x492024){if(_0x30bfc0['body']['id']){delete _0x30bfc0[_0x6d38('0x46')]['id'];}return db['WhatsappApplication'][_0x6d38('0x44')]({'where':{'id':_0x30bfc0['params']['id']}})[_0x6d38('0x24')](handleEntityNotFound(_0x492024,null))[_0x6d38('0x24')](saveUpdates(_0x30bfc0[_0x6d38('0x46')],null))['then'](respondWithResult(_0x492024,null))[_0x6d38('0x47')](handleError(_0x492024,null));};exports[_0x6d38('0x23')]=function(_0x5ecb1c,_0x5389f6){return db[_0x6d38('0x2a')][_0x6d38('0x44')]({'where':{'id':_0x5ecb1c[_0x6d38('0x40')]['id']}})[_0x6d38('0x24')](handleEntityNotFound(_0x5389f6,null))[_0x6d38('0x24')](removeEntity(_0x5389f6,null))[_0x6d38('0x47')](handleError(_0x5389f6,null));}; \ No newline at end of file +var _0x9541=['attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','show','params','length','include','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x2e06a1,_0x4a88b2){var _0x56f56e=function(_0x21e756){while(--_0x21e756){_0x2e06a1['push'](_0x2e06a1['shift']());}};_0x56f56e(++_0x4a88b2);}(_0x9541,0xb3));var _0x1954=function(_0x3a1ee7,_0x56c902){_0x3a1ee7=_0x3a1ee7-0x0;var _0x2e75e2=_0x9541[_0x3a1ee7];return _0x2e75e2;};'use strict';var emlformat=require(_0x1954('0x0'));var rimraf=require(_0x1954('0x1'));var zipdir=require(_0x1954('0x2'));var jsonpatch=require(_0x1954('0x3'));var rp=require(_0x1954('0x4'));var moment=require(_0x1954('0x5'));var BPromise=require(_0x1954('0x6'));var Mustache=require(_0x1954('0x7'));var util=require('util');var path=require('path');var sox=require(_0x1954('0x8'));var csv=require(_0x1954('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1954('0xa'));var _=require(_0x1954('0xb'));var squel=require(_0x1954('0xc'));var crypto=require(_0x1954('0xd'));var jsforce=require(_0x1954('0xe'));var deskjs=require(_0x1954('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1954('0x10'));var Papa=require(_0x1954('0x11'));var Redis=require(_0x1954('0x12'));var authService=require(_0x1954('0x13'));var qs=require(_0x1954('0x14'));var as=require(_0x1954('0x15'));var hardwareService=require(_0x1954('0x16'));var logger=require(_0x1954('0x17'))('api');var utils=require(_0x1954('0x18'));var config=require(_0x1954('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x1954('0x1a'))['db'];function respondWithStatusCode(_0x5e8400,_0x289155){_0x289155=_0x289155||0xcc;return function(_0x4dc96b){if(_0x4dc96b){return _0x5e8400['sendStatus'](_0x289155);}return _0x5e8400['status'](_0x289155)[_0x1954('0x1b')]();};}function respondWithResult(_0x1b33cb,_0x96906a){_0x96906a=_0x96906a||0xc8;return function(_0x520dc7){if(_0x520dc7){return _0x1b33cb[_0x1954('0x1c')](_0x96906a)['json'](_0x520dc7);}};}function respondWithFilteredResult(_0x5daee1,_0xaeb0e3){return function(_0xf43d28){if(_0xf43d28){var _0x36565c=typeof _0xaeb0e3[_0x1954('0x1d')]===_0x1954('0x1e')&&typeof _0xaeb0e3[_0x1954('0x1f')]===_0x1954('0x1e');var _0x46b400=_0xf43d28[_0x1954('0x20')];var _0xb9c2cd=_0x36565c?0x0:_0xaeb0e3[_0x1954('0x1d')];var _0x3da757=_0x36565c?_0xf43d28[_0x1954('0x20')]:_0xaeb0e3[_0x1954('0x1d')]+_0xaeb0e3[_0x1954('0x1f')];var _0x4503d7;if(_0x3da757>=_0x46b400){_0x3da757=_0x46b400;_0x4503d7=0xc8;}else{_0x4503d7=0xce;}_0x5daee1[_0x1954('0x1c')](_0x4503d7);return _0x5daee1[_0x1954('0x21')](_0x1954('0x22'),_0xb9c2cd+'-'+_0x3da757+'/'+_0x46b400)[_0x1954('0x23')](_0xf43d28);}return null;};}function patchUpdates(_0x5e20b8){return function(_0x2105d5){try{jsonpatch[_0x1954('0x24')](_0x2105d5,_0x5e20b8,!![]);}catch(_0x3a84c0){return BPromise[_0x1954('0x25')](_0x3a84c0);}return _0x2105d5[_0x1954('0x26')]();};}function saveUpdates(_0x5e549f,_0x61107d){return function(_0x15dd0b){if(_0x15dd0b){return _0x15dd0b[_0x1954('0x27')](_0x5e549f)[_0x1954('0x28')](function(_0x6d8a2){return _0x6d8a2;});}return null;};}function removeEntity(_0x5a7256,_0x4d1b25){return function(_0x18a883){if(_0x18a883){return _0x18a883[_0x1954('0x29')]()[_0x1954('0x28')](function(){_0x5a7256[_0x1954('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21f395,_0x26484f){return function(_0x27dc66){if(!_0x27dc66){_0x21f395[_0x1954('0x2a')](0x194);}return _0x27dc66;};}function handleError(_0x3f06de,_0x1bfa18){_0x1bfa18=_0x1bfa18||0x1f4;return function(_0x46fdc1){logger['error'](_0x46fdc1[_0x1954('0x2b')]);if(_0x46fdc1[_0x1954('0x2c')]){delete _0x46fdc1['name'];}_0x3f06de[_0x1954('0x1c')](_0x1bfa18)[_0x1954('0x2d')](_0x46fdc1);};}exports[_0x1954('0x2e')]=function(_0x3a488b,_0x1d8f32){var _0x251386={},_0x41b143={},_0x41c850={'count':0x0,'rows':[]};var _0xde7055=_[_0x1954('0x2f')](db[_0x1954('0x30')][_0x1954('0x31')],function(_0x40da25){return{'name':_0x40da25[_0x1954('0x32')],'type':_0x40da25[_0x1954('0x33')][_0x1954('0x34')]};});_0x41b143[_0x1954('0x35')]=_[_0x1954('0x2f')](_0xde7055,_0x1954('0x2c'));_0x41b143[_0x1954('0x36')]=_[_0x1954('0x37')](_0x3a488b[_0x1954('0x36')]);_0x41b143[_0x1954('0x38')]=_[_0x1954('0x39')](_0x41b143['model'],_0x41b143['query']);_0x251386[_0x1954('0x3a')]=_['intersection'](_0x41b143[_0x1954('0x35')],qs[_0x1954('0x3b')](_0x3a488b['query'][_0x1954('0x3b')]));_0x251386[_0x1954('0x3a')]=_0x251386['attributes']['length']?_0x251386[_0x1954('0x3a')]:_0x41b143[_0x1954('0x35')];if(!_0x3a488b[_0x1954('0x36')][_0x1954('0x3c')](_0x1954('0x3d'))){_0x251386[_0x1954('0x1f')]=qs[_0x1954('0x1f')](_0x3a488b['query']['limit']);_0x251386[_0x1954('0x1d')]=qs[_0x1954('0x1d')](_0x3a488b[_0x1954('0x36')][_0x1954('0x1d')]);}_0x251386[_0x1954('0x3e')]=qs[_0x1954('0x3f')](_0x3a488b['query'][_0x1954('0x3f')]);_0x251386[_0x1954('0x40')]=qs['filters'](_[_0x1954('0x41')](_0x3a488b[_0x1954('0x36')],_0x41b143['filters']),_0xde7055);if(_0x3a488b['query'][_0x1954('0x42')]){_0x251386[_0x1954('0x40')]=_['merge'](_0x251386[_0x1954('0x40')],{'$or':_[_0x1954('0x2f')](_0xde7055,function(_0x13725c){if(_0x13725c[_0x1954('0x33')]!=='VIRTUAL'){var _0x339b28={};_0x339b28[_0x13725c['name']]={'$like':'%'+_0x3a488b[_0x1954('0x36')][_0x1954('0x42')]+'%'};return _0x339b28;}})});}_0x251386=_[_0x1954('0x43')]({},_0x251386,_0x3a488b['options']);var _0x1c2f3={'where':_0x251386[_0x1954('0x40')]};return db[_0x1954('0x30')][_0x1954('0x20')](_0x1c2f3)[_0x1954('0x28')](function(_0x517492){_0x41c850[_0x1954('0x20')]=_0x517492;if(_0x3a488b['query'][_0x1954('0x44')]){_0x251386['include']=[{'all':!![]}];}return db[_0x1954('0x30')][_0x1954('0x45')](_0x251386);})[_0x1954('0x28')](function(_0x4334f9){_0x41c850['rows']=_0x4334f9;return _0x41c850;})[_0x1954('0x28')](respondWithFilteredResult(_0x1d8f32,_0x251386))['catch'](handleError(_0x1d8f32,null));};exports[_0x1954('0x46')]=function(_0x1435d6,_0x59c4cb){var _0x1dede8={'raw':!![],'where':{'id':_0x1435d6[_0x1954('0x47')]['id']}},_0x45f70e={};_0x45f70e[_0x1954('0x35')]=_[_0x1954('0x37')](db[_0x1954('0x30')][_0x1954('0x31')]);_0x45f70e[_0x1954('0x36')]=_[_0x1954('0x37')](_0x1435d6['query']);_0x45f70e['filters']=_['intersection'](_0x45f70e[_0x1954('0x35')],_0x45f70e['query']);_0x1dede8[_0x1954('0x3a')]=_[_0x1954('0x39')](_0x45f70e[_0x1954('0x35')],qs[_0x1954('0x3b')](_0x1435d6[_0x1954('0x36')][_0x1954('0x3b')]));_0x1dede8[_0x1954('0x3a')]=_0x1dede8[_0x1954('0x3a')][_0x1954('0x48')]?_0x1dede8['attributes']:_0x45f70e['model'];if(_0x1435d6[_0x1954('0x36')]['includeAll']){_0x1dede8[_0x1954('0x49')]=[{'all':!![]}];}_0x1dede8=_['merge']({},_0x1dede8,_0x1435d6[_0x1954('0x4a')]);return db[_0x1954('0x30')][_0x1954('0x4b')](_0x1dede8)[_0x1954('0x28')](handleEntityNotFound(_0x59c4cb,null))[_0x1954('0x28')](respondWithResult(_0x59c4cb,null))[_0x1954('0x4c')](handleError(_0x59c4cb,null));};exports[_0x1954('0x4d')]=function(_0x15ff45,_0x15295e){return db[_0x1954('0x30')]['create'](_0x15ff45[_0x1954('0x4e')],{})[_0x1954('0x28')](respondWithResult(_0x15295e,0xc9))[_0x1954('0x4c')](handleError(_0x15295e,null));};exports[_0x1954('0x27')]=function(_0x510b62,_0x1cd2dd){if(_0x510b62[_0x1954('0x4e')]['id']){delete _0x510b62['body']['id'];}return db[_0x1954('0x30')]['find']({'where':{'id':_0x510b62[_0x1954('0x47')]['id']}})[_0x1954('0x28')](handleEntityNotFound(_0x1cd2dd,null))[_0x1954('0x28')](saveUpdates(_0x510b62[_0x1954('0x4e')],null))[_0x1954('0x28')](respondWithResult(_0x1cd2dd,null))[_0x1954('0x4c')](handleError(_0x1cd2dd,null));};exports[_0x1954('0x29')]=function(_0x49003e,_0x1b4557){return db['WhatsappApplication'][_0x1954('0x4b')]({'where':{'id':_0x49003e[_0x1954('0x47')]['id']}})[_0x1954('0x28')](handleEntityNotFound(_0x1b4557,null))['then'](removeEntity(_0x1b4557,null))[_0x1954('0x4c')](handleError(_0x1b4557,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index c40ca43..ab7f04d 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 _0xe132=['whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','WhatsappApplication'];(function(_0x1f9952,_0x50aceb){var _0x50f523=function(_0x7050dd){while(--_0x7050dd){_0x1f9952['push'](_0x1f9952['shift']());}};_0x50f523(++_0x50aceb);}(_0xe132,0x162));var _0x2e13=function(_0x4ff1ec,_0x18cac2){_0x4ff1ec=_0x4ff1ec-0x0;var _0xe872a8=_0xe132[_0x4ff1ec];return _0xe872a8;};'use strict';var _=require(_0x2e13('0x0'));var util=require('util');var logger=require(_0x2e13('0x1'))(_0x2e13('0x2'));var moment=require(_0x2e13('0x3'));var BPromise=require(_0x2e13('0x4'));var rp=require(_0x2e13('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e13('0x6'));var config=require(_0x2e13('0x7'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x260dc1,_0x2f9d00){return _0x260dc1[_0x2e13('0x8')](_0x2e13('0x9'),attributes,{'tableName':_0x2e13('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2e13('0xb'),'collate':_0x2e13('0xc')});}; \ No newline at end of file +var _0xa41a=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','whatsapp_applications','utf8mb4','lodash'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0xa41a,0x6b));var _0xaa41=function(_0x25a13c,_0x47ec9a){_0x25a13c=_0x25a13c-0x0;var _0x34ceb9=_0xa41a[_0x25a13c];return _0x34ceb9;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var logger=require('../../config/logger')(_0xaa41('0x2'));var moment=require(_0xaa41('0x3'));var BPromise=require(_0xaa41('0x4'));var rp=require(_0xaa41('0x5'));var fs=require('fs');var path=require(_0xaa41('0x6'));var rimraf=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var attributes=require(_0xaa41('0x9'));module['exports']=function(_0x2122a0,_0x1ec9d4){return _0x2122a0['define']('WhatsappApplication',attributes,{'tableName':_0xaa41('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xaa41('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 22cab25..32d6366 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 _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','catch','util'];(function(_0x154a85,_0xecc08f){var _0x848d62=function(_0x5b73b8){while(--_0x5b73b8){_0x154a85['push'](_0x154a85['shift']());}};_0x848d62(++_0xecc08f);}(_0xedd9,0xfc));var _0x9edd=function(_0x47618c,_0x1e977d){_0x47618c=_0x47618c-0x0;var _0x3fcce0=_0xedd9[_0x47618c];return _0x3fcce0;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file +var _0x70e0=['code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1b278d,_0x334ef2){var _0x594195=function(_0x455e9d){while(--_0x455e9d){_0x1b278d['push'](_0x1b278d['shift']());}};_0x594195(++_0x334ef2);}(_0x70e0,0x17b));var _0x070e=function(_0x27ca8d,_0x2b34ed){_0x27ca8d=_0x27ca8d-0x0;var _0x20b795=_0x70e0[_0x27ca8d];return _0x20b795;};'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')]('WhatsappApplication,\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')]('WhatsappApplication,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('WhatsappApplication,\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/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 65923d8..f94637c 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 _0xcf98=['tracked','whatsapp','whatsappinteraction:addtags','put','/:id','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','/:id/tags','removeTags','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post'];(function(_0x38e5c5,_0x2d2b27){var _0xc6c71a=function(_0x1820ff){while(--_0x1820ff){_0x38e5c5['push'](_0x38e5c5['shift']());}};_0xc6c71a(++_0x2d2b27);}(_0xcf98,0x8d));var _0x8cf9=function(_0x414cdd,_0xa02a57){_0x414cdd=_0x414cdd-0x0;var _0x319759=_0xcf98[_0x414cdd];return _0x319759;};'use strict';var multer=require('multer');var util=require(_0x8cf9('0x0'));var path=require(_0x8cf9('0x1'));var timeout=require(_0x8cf9('0x2'));var express=require(_0x8cf9('0x3'));var router=express[_0x8cf9('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8cf9('0x5'));var config=require(_0x8cf9('0x6'));var controller=require(_0x8cf9('0x7'));router[_0x8cf9('0x8')]('/',auth[_0x8cf9('0x9')](),controller[_0x8cf9('0xa')]);router[_0x8cf9('0x8')](_0x8cf9('0xb'),auth[_0x8cf9('0x9')](),controller[_0x8cf9('0xc')]);router[_0x8cf9('0x8')]('/:id',auth[_0x8cf9('0x9')](),controller[_0x8cf9('0xd')]);router['get'](_0x8cf9('0xe'),auth['isAuthenticated'](),controller[_0x8cf9('0xf')]);router[_0x8cf9('0x8')](_0x8cf9('0x10'),auth[_0x8cf9('0x9')](),controller[_0x8cf9('0x11')]);router[_0x8cf9('0x12')]('/',auth[_0x8cf9('0x9')](),controller['create']);router[_0x8cf9('0x12')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0x8cf9('0x12')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x8cf9('0x13')](_0x8cf9('0x14'),_0x8cf9('0x15')),controller['addTags']);router[_0x8cf9('0x16')](_0x8cf9('0x17'),auth['isAuthenticated'](),interaction[_0x8cf9('0x13')](_0x8cf9('0x14'),_0x8cf9('0x18')),controller[_0x8cf9('0x19')]);router[_0x8cf9('0x1a')](_0x8cf9('0x17'),auth[_0x8cf9('0x9')](),interaction[_0x8cf9('0x13')](_0x8cf9('0x14'),_0x8cf9('0x1b')),controller[_0x8cf9('0x1c')]);router[_0x8cf9('0x1a')](_0x8cf9('0x1d'),auth[_0x8cf9('0x9')](),controller[_0x8cf9('0x1e')]);module[_0x8cf9('0x1f')]=router; \ No newline at end of file +var _0x0618=['update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','download','create','post','addMessage','tracked','whatsapp','whatsappinteraction:addtags','addTags','whatsappinteraction:update'];(function(_0x158a58,_0x28e8e7){var _0x4935d9=function(_0x1e698c){while(--_0x1e698c){_0x158a58['push'](_0x158a58['shift']());}};_0x4935d9(++_0x28e8e7);}(_0x0618,0x1c6));var _0x8061=function(_0x2e8e0f,_0x5101c8){_0x2e8e0f=_0x2e8e0f-0x0;var _0x7286c6=_0x0618[_0x2e8e0f];return _0x7286c6;};'use strict';var multer=require(_0x8061('0x0'));var util=require(_0x8061('0x1'));var path=require('path');var timeout=require(_0x8061('0x2'));var express=require(_0x8061('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8061('0x4'));var interaction=require(_0x8061('0x5'));var config=require(_0x8061('0x6'));var controller=require(_0x8061('0x7'));router[_0x8061('0x8')]('/',auth[_0x8061('0x9')](),controller[_0x8061('0xa')]);router[_0x8061('0x8')](_0x8061('0xb'),auth[_0x8061('0x9')](),controller[_0x8061('0xc')]);router['get'](_0x8061('0xd'),auth['isAuthenticated'](),controller[_0x8061('0xe')]);router[_0x8061('0x8')](_0x8061('0xf'),auth[_0x8061('0x9')](),controller[_0x8061('0x10')]);router['get']('/:id/download',auth[_0x8061('0x9')](),controller[_0x8061('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8061('0x12')]);router[_0x8061('0x13')](_0x8061('0xf'),auth[_0x8061('0x9')](),controller[_0x8061('0x14')]);router[_0x8061('0x13')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x8061('0x15')](_0x8061('0x16'),_0x8061('0x17')),controller[_0x8061('0x18')]);router['put']('/:id',auth[_0x8061('0x9')](),interaction[_0x8061('0x15')](_0x8061('0x16'),_0x8061('0x19')),controller[_0x8061('0x1a')]);router[_0x8061('0x1b')](_0x8061('0xd'),auth[_0x8061('0x9')](),interaction[_0x8061('0x15')](_0x8061('0x16'),_0x8061('0x1c')),controller[_0x8061('0x1d')]);router[_0x8061('0x1b')]('/:id/tags',auth['isAuthenticated'](),controller[_0x8061('0x1e')]);module[_0x8061('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index fbfca76..4d22a9b 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 _0x71ab=['STRING','DATE','ENUM','out','moment','BOOLEAN'];(function(_0xd09ce5,_0x386206){var _0x290757=function(_0x1524b2){while(--_0x1524b2){_0xd09ce5['push'](_0xd09ce5['shift']());}};_0x290757(++_0x386206);}(_0x71ab,0x64));var _0xb71a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x71ab[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb71a('0x0'));module['exports']={'closed':{'type':Sequelize[_0xb71a('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xb71a('0x2')]},'secondDisposition':{'type':Sequelize[_0xb71a('0x2')]},'thirdDisposition':{'type':Sequelize[_0xb71a('0x2')]},'note':{'type':Sequelize[_0xb71a('0x2')]},'phone':{'type':Sequelize[_0xb71a('0x2')]},'read1stAt':{'type':Sequelize[_0xb71a('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xb71a('0x4')]('in',_0xb71a('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb71a('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xb71a('0x4')]('in',_0xb71a('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb71a('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xb073=['out','moment','BOOLEAN','DATE','STRING','ENUM'];(function(_0x3ed8ce,_0x568ba3){var _0x2188f7=function(_0x3981f4){while(--_0x3981f4){_0x3ed8ce['push'](_0x3ed8ce['shift']());}};_0x2188f7(++_0x568ba3);}(_0xb073,0x187));var _0x3b07=function(_0x4aa7d6,_0xb8ae3){_0x4aa7d6=_0x4aa7d6-0x0;var _0xa0c063=_0xb073[_0x4aa7d6];return _0xa0c063;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3b07('0x0'));module['exports']={'closed':{'type':Sequelize[_0x3b07('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3b07('0x2')]},'disposition':{'type':Sequelize[_0x3b07('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x3b07('0x3')]},'note':{'type':Sequelize[_0x3b07('0x3')]},'phone':{'type':Sequelize[_0x3b07('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x3b07('0x4')]('in',_0x3b07('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3b07('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x3b07('0x4')]('in',_0x3b07('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x3b07('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index feaa35d..a566469 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 _0x19a8=['Tag','color','whatsappInteractionTags:save','removeTags','download','join','root','server','files','attachments','transcript-%d-%s.zip','push','User','CmContact','Contact','lastName','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','Owner','fullname','mkdirSync','Whatsapp','Account','YYYY-MM-DD\x20HH:mm:ss','closed','toString','disposition','map','basename','existsSync','pipe','out','firstName','value','renderFile','views','transcript-','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','util','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','undefined','limit','count','offset','json','then','destroy','error','stack','name','send','index','rawAttributes','key','getOptions','findAll','whatsapp','user','catch','show','WhatsappInteraction','query','keys','intersection','attributes','model','fields','length','includeAll','merge','find','create','body','update','params','describe','WhatsappMessage','addMessage','omit','ids','findOne','filters','hasOwnProperty','order','sort','pick','filter','where','$gte','split','format','options','include','addTags','setTags','spread'];(function(_0x3ca779,_0x292da8){var _0x534657=function(_0x37e600){while(--_0x37e600){_0x3ca779['push'](_0x3ca779['shift']());}};_0x534657(++_0x292da8);}(_0x19a8,0x120));var _0x819a=function(_0x59dea5,_0x41f195){_0x59dea5=_0x59dea5-0x0;var _0x56a51b=_0x19a8[_0x59dea5];return _0x56a51b;};'use strict';var rimraf=require(_0x819a('0x0'));var zipdir=require(_0x819a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x819a('0x2'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x819a('0x3'));var Redis=require(_0x819a('0x4'));var interaction=require(_0x819a('0x5'));var qs=require('../../components/parsers/qs');var pdf=require(_0x819a('0x6'));var logger=require(_0x819a('0x7'))(_0x819a('0x8'));var config=require(_0x819a('0x9'));var db=require(_0x819a('0xa'))['db'];config[_0x819a('0xb')]=_[_0x819a('0xc')](config[_0x819a('0xb')],{'host':_0x819a('0xd'),'port':0x18eb});var socket=require(_0x819a('0xe'))(new Redis(config[_0x819a('0xb')]));require(_0x819a('0xf'))[_0x819a('0x10')](socket);function respondWithStatusCode(_0x48e68f,_0x2412d3){_0x2412d3=_0x2412d3||0xcc;return function(_0x148e94){if(_0x148e94){return _0x48e68f[_0x819a('0x11')](_0x2412d3);}return _0x48e68f[_0x819a('0x12')](_0x2412d3)['end']();};}function respondWithResult(_0x59b92e,_0x51a392){_0x51a392=_0x51a392||0xc8;return function(_0x167e9c){if(_0x167e9c){return _0x59b92e[_0x819a('0x12')](_0x51a392)['json'](_0x167e9c);}};}function respondWithFilteredResult(_0x3e7588,_0xb9b60d){return function(_0xd5f641){if(_0xd5f641){var _0x484d1a=typeof _0xb9b60d['offset']===_0x819a('0x13')&&typeof _0xb9b60d[_0x819a('0x14')]===_0x819a('0x13');var _0x111f5f=_0xd5f641[_0x819a('0x15')];var _0x359781=_0x484d1a?0x0:_0xb9b60d[_0x819a('0x16')];var _0x51bedd=_0x484d1a?_0xd5f641[_0x819a('0x15')]:_0xb9b60d[_0x819a('0x16')]+_0xb9b60d[_0x819a('0x14')];var _0x222e65;if(_0x51bedd>=_0x111f5f){_0x51bedd=_0x111f5f;_0x222e65=0xc8;}else{_0x222e65=0xce;}_0x3e7588[_0x819a('0x12')](_0x222e65);return _0x3e7588['set']('Content-Range',_0x359781+'-'+_0x51bedd+'/'+_0x111f5f)[_0x819a('0x17')](_0xd5f641);}return null;};}function saveUpdates(_0x519d61){return function(_0x5375f9){if(_0x5375f9){return _0x5375f9['update'](_0x519d61)[_0x819a('0x18')](function(_0x256d6a){return _0x256d6a;});}return null;};}function removeEntity(_0x29191d){return function(_0x3ee55f){if(_0x3ee55f){return _0x3ee55f[_0x819a('0x19')]()['then'](function(){_0x29191d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x558eee){return function(_0x3858a2){if(!_0x3858a2){_0x558eee[_0x819a('0x11')](0x194);}return _0x3858a2;};}function handleError(_0x520439,_0x1142cf){_0x1142cf=_0x1142cf||0x1f4;return function(_0x4251cc){logger[_0x819a('0x1a')](_0x4251cc[_0x819a('0x1b')]);if(_0x4251cc['name']){delete _0x4251cc[_0x819a('0x1c')];}_0x520439[_0x819a('0x12')](_0x1142cf)[_0x819a('0x1d')](_0x4251cc);};}exports[_0x819a('0x1e')]=function(_0x4205bb,_0x48395c){var _0x3e3525={};var _0x5e9be4=_['map'](db['WhatsappInteraction'][_0x819a('0x1f')],function(_0x4a7466){return{'name':_0x4a7466['fieldName'],'type':_0x4a7466['type'][_0x819a('0x20')]};});_0x3e3525=qs[_0x819a('0x21')](_0x5e9be4,_0x4205bb);return interaction[_0x819a('0x22')](_0x819a('0x23'),_0x4205bb['query'],_0x4205bb[_0x819a('0x24')],_0x3e3525,_0x5e9be4)[_0x819a('0x18')](respondWithFilteredResult(_0x48395c,_0x3e3525))[_0x819a('0x25')](handleError(_0x48395c,null));};exports[_0x819a('0x26')]=function(_0x160590,_0x47a6c2){var _0x10ee56={'raw':![],'where':{'id':_0x160590['params']['id']}},_0x408bbf={};_0x408bbf['model']=_['keys'](db[_0x819a('0x27')][_0x819a('0x1f')]);_0x408bbf[_0x819a('0x28')]=_[_0x819a('0x29')](_0x160590[_0x819a('0x28')]);_0x408bbf['filters']=_[_0x819a('0x2a')](_0x408bbf['model'],_0x408bbf['query']);_0x10ee56[_0x819a('0x2b')]=_[_0x819a('0x2a')](_0x408bbf[_0x819a('0x2c')],qs[_0x819a('0x2d')](_0x160590[_0x819a('0x28')][_0x819a('0x2d')]));_0x10ee56[_0x819a('0x2b')]=_0x10ee56[_0x819a('0x2b')][_0x819a('0x2e')]?_0x10ee56['attributes']:_0x408bbf[_0x819a('0x2c')];if(_0x160590[_0x819a('0x28')][_0x819a('0x2f')]){_0x10ee56['include']=[{'all':!![]}];}_0x10ee56=_[_0x819a('0x30')]({},_0x10ee56,_0x160590['options']);return db['WhatsappInteraction'][_0x819a('0x31')](_0x10ee56)['then'](handleEntityNotFound(_0x47a6c2,null))[_0x819a('0x18')](respondWithResult(_0x47a6c2,null))[_0x819a('0x25')](handleError(_0x47a6c2,null));};exports[_0x819a('0x32')]=function(_0x2e3a7f,_0xba2a10){return db['WhatsappInteraction'][_0x819a('0x32')](_0x2e3a7f[_0x819a('0x33')],{})[_0x819a('0x18')](respondWithResult(_0xba2a10,0xc9))[_0x819a('0x25')](handleError(_0xba2a10,null));};exports[_0x819a('0x34')]=function(_0x380f2e,_0x3fbe1d){if(_0x380f2e[_0x819a('0x33')]['id']){delete _0x380f2e[_0x819a('0x33')]['id'];}return db['WhatsappInteraction'][_0x819a('0x31')]({'where':{'id':_0x380f2e[_0x819a('0x35')]['id']}})['then'](handleEntityNotFound(_0x3fbe1d,null))[_0x819a('0x18')](saveUpdates(_0x380f2e[_0x819a('0x33')],null))[_0x819a('0x18')](respondWithResult(_0x3fbe1d,null))[_0x819a('0x25')](handleError(_0x3fbe1d,null));};exports[_0x819a('0x19')]=function(_0x21455b,_0x24e224){return db[_0x819a('0x27')][_0x819a('0x31')]({'where':{'id':_0x21455b[_0x819a('0x35')]['id']}})[_0x819a('0x18')](handleEntityNotFound(_0x24e224,null))[_0x819a('0x18')](removeEntity(_0x24e224,null))['catch'](handleError(_0x24e224,null));};exports[_0x819a('0x36')]=function(_0x596ab1,_0xc30234){return db[_0x819a('0x27')][_0x819a('0x36')]()[_0x819a('0x18')](respondWithResult(_0xc30234,null))[_0x819a('0x25')](handleError(_0xc30234,null));};exports['addMessage']=function(_0x1e7b22,_0x2b810d){return db[_0x819a('0x37')][_0x819a('0x31')]({'where':{'id':_0x1e7b22[_0x819a('0x35')]['id']}})[_0x819a('0x18')](handleEntityNotFound(_0x2b810d,null))[_0x819a('0x18')](function(_0x41609a){if(_0x41609a){return _0x41609a[_0x819a('0x38')](_0x1e7b22[_0x819a('0x33')]['ids'],_[_0x819a('0x39')](_0x1e7b22[_0x819a('0x33')],[_0x819a('0x3a'),'id'])||{});}})[_0x819a('0x18')](respondWithResult(_0x2b810d,null))[_0x819a('0x25')](handleError(_0x2b810d,null));};exports['getMessages']=function(_0x4d0901,_0x4bf195){var _0xfe1c5b={'raw':![],'where':{}};var _0x42e689={};var _0x3e5cef={'count':0x0,'rows':[]};return db[_0x819a('0x27')][_0x819a('0x3b')]({'where':{'id':_0x4d0901[_0x819a('0x35')]['id']}})[_0x819a('0x18')](handleEntityNotFound(_0x4bf195,null))[_0x819a('0x18')](function(_0x3d6006){if(_0x3d6006){_0x42e689['model']=_['keys'](db[_0x819a('0x37')]['rawAttributes']);_0x42e689[_0x819a('0x28')]=_['keys'](_0x4d0901[_0x819a('0x28')]);_0x42e689[_0x819a('0x3c')]=_['intersection'](_0x42e689['model'],_0x42e689[_0x819a('0x28')]);_0xfe1c5b['attributes']=_[_0x819a('0x2a')](_0x42e689[_0x819a('0x2c')],qs[_0x819a('0x2d')](_0x4d0901[_0x819a('0x28')][_0x819a('0x2d')]));_0xfe1c5b[_0x819a('0x2b')]=_0xfe1c5b[_0x819a('0x2b')][_0x819a('0x2e')]?_0xfe1c5b[_0x819a('0x2b')]:_0x42e689[_0x819a('0x2c')];if(!_0x4d0901[_0x819a('0x28')][_0x819a('0x3d')]('nolimit')){_0xfe1c5b['limit']=qs[_0x819a('0x14')](_0x4d0901[_0x819a('0x28')][_0x819a('0x14')]);_0xfe1c5b[_0x819a('0x16')]=qs[_0x819a('0x16')](_0x4d0901[_0x819a('0x28')][_0x819a('0x16')]);}_0xfe1c5b[_0x819a('0x3e')]=qs['sort'](_0x4d0901[_0x819a('0x28')][_0x819a('0x3f')]);_0xfe1c5b['where']=qs[_0x819a('0x3c')](_[_0x819a('0x40')](_0x4d0901['query'],_0x42e689[_0x819a('0x3c')]));_0xfe1c5b['where']['WhatsappInteractionId']=_0x3d6006['id'];if(_0x4d0901[_0x819a('0x28')][_0x819a('0x41')]){_0xfe1c5b[_0x819a('0x42')]=_[_0x819a('0x30')](_0xfe1c5b[_0x819a('0x42')],{'$or':_['map'](_0xfe1c5b[_0x819a('0x2b')],function(_0x5ed054){var _0x564fd3={};_0x564fd3[_0x5ed054]={'$like':'%'+_0x4d0901[_0x819a('0x28')][_0x819a('0x41')]+'%'};return _0x564fd3;})});}if(_0x4d0901[_0x819a('0x28')][_0x819a('0x43')]){var _0x194a21=_0x4d0901[_0x819a('0x28')][_0x819a('0x43')][_0x819a('0x44')](',');var _0x86dd8c={};_0x86dd8c[_0x194a21[0x0]]={'$gte':moment(_0x194a21[0x1])[_0x819a('0x45')]('YYYY-MM-DD\x20HH:mm:ss')};_0xfe1c5b[_0x819a('0x42')]=_[_0x819a('0x30')](_0xfe1c5b[_0x819a('0x42')],_0x86dd8c);}_0xfe1c5b=_[_0x819a('0x30')]({},_0xfe1c5b,_0x4d0901[_0x819a('0x46')]);return db[_0x819a('0x37')][_0x819a('0x15')]({'where':_0xfe1c5b[_0x819a('0x42')]})[_0x819a('0x18')](function(_0x44e971){_0x3e5cef[_0x819a('0x15')]=_0x44e971;if(_0x4d0901['query'][_0x819a('0x2f')]){_0xfe1c5b[_0x819a('0x47')]=[{'all':!![]}];}return db[_0x819a('0x37')][_0x819a('0x22')](_0xfe1c5b);})[_0x819a('0x18')](function(_0x58783e){_0x3e5cef['rows']=_0x58783e;return _0x3e5cef;});}})['then'](respondWithFilteredResult(_0x4bf195,_0xfe1c5b))[_0x819a('0x25')](handleError(_0x4bf195,null));};exports[_0x819a('0x48')]=function(_0x4e12b7,_0x56f775){return db[_0x819a('0x27')][_0x819a('0x31')]({'where':{'id':_0x4e12b7[_0x819a('0x35')]['id']}})['then'](handleEntityNotFound(_0x56f775,null))[_0x819a('0x18')](function(_0x220a4a){if(_0x220a4a){return _0x220a4a[_0x819a('0x49')](_0x4e12b7[_0x819a('0x33')][_0x819a('0x3a')],_[_0x819a('0x39')](_0x4e12b7[_0x819a('0x33')],[_0x819a('0x3a'),'id'])||{})[_0x819a('0x4a')](function(){return db[_0x819a('0x4b')][_0x819a('0x22')]({'attributes':['id','name',_0x819a('0x4c')],'where':{'id':_0x4e12b7['body']['ids']}});})[_0x819a('0x18')](function(_0x49f273){socket['emit'](_0x819a('0x4d'),{'id':Number(_0x4e12b7['params']['id']),'tags':_0x49f273||[]});return{'id':Number(_0x4e12b7['params']['id']),'tags':_0x49f273||[]};});}})['then'](respondWithResult(_0x56f775,null))[_0x819a('0x25')](handleError(_0x56f775,null));};exports[_0x819a('0x4e')]=function(_0x17aa86,_0x1a5745){return db[_0x819a('0x27')][_0x819a('0x31')]({'where':{'id':_0x17aa86[_0x819a('0x35')]['id']}})[_0x819a('0x18')](handleEntityNotFound(_0x1a5745,null))[_0x819a('0x18')](function(_0x20c290){if(_0x20c290){return _0x20c290['removeTags'](_0x17aa86[_0x819a('0x28')][_0x819a('0x3a')]);}})[_0x819a('0x18')](respondWithStatusCode(_0x1a5745,null))[_0x819a('0x25')](handleError(_0x1a5745,null));};exports[_0x819a('0x4f')]=function(_0x154a4f,_0x3b3755){var _0x3cdc87=moment()['unix']()['toString']();var _0x5223c2=path[_0x819a('0x50')](config[_0x819a('0x51')],_0x819a('0x52'),'files','tmp');var _0x41801f=path[_0x819a('0x50')](config[_0x819a('0x51')],_0x819a('0x52'),_0x819a('0x53'),_0x819a('0x54'));var _0x385aa6=path[_0x819a('0x50')](_0x5223c2,_0x3cdc87);var _0xa40e2f=util[_0x819a('0x45')](_0x819a('0x55'),_0x154a4f[_0x819a('0x35')]['id'],_0x3cdc87);var _0x4b373a=path[_0x819a('0x50')](_0x5223c2,_0xa40e2f);var _0x8f9098=[];_0x8f9098[_0x819a('0x56')]({'model':db[_0x819a('0x57')],'as':_0x819a('0x57'),'attributes':['id','fullname'],'raw':!![]});_0x8f9098[_0x819a('0x56')]({'model':db[_0x819a('0x58')],'as':_0x819a('0x59'),'attributes':['id','firstName',_0x819a('0x5a')],'raw':!![]});if(_0x154a4f[_0x819a('0x28')][_0x819a('0x54')]){_0x8f9098[_0x819a('0x56')]({'model':db['Attachment'],'as':_0x819a('0x5b'),'raw':!![]});}var _0x110a96=[{'model':db[_0x819a('0x37')],'as':_0x819a('0x5c'),'attributes':['id',_0x819a('0x33'),_0x819a('0x5d'),_0x819a('0x5e'),_0x819a('0x5f'),_0x819a('0x60')],'include':_0x8f9098}];_0x110a96[_0x819a('0x56')]({'model':db[_0x819a('0x61')],'as':'Account','attributes':['id',_0x819a('0x1c')]});_0x110a96[_0x819a('0x56')]({'model':db[_0x819a('0x57')],'as':_0x819a('0x62'),'attributes':['id',_0x819a('0x63')]});return db['WhatsappInteraction'][_0x819a('0x31')]({'where':{'id':_0x154a4f['params']['id']},'include':_0x110a96})[_0x819a('0x18')](handleEntityNotFound(_0x3b3755,null))[_0x819a('0x18')](function(_0x30d72e){if(_0x30d72e){var _0x1c370a=_0x30d72e['get']({'plain':!![]});fs[_0x819a('0x64')](_0x385aa6);var _0x3b7785={'channel':_0x819a('0x65'),'account':_0x1c370a[_0x819a('0x66')]['name'],'agent':_0x1c370a[_0x819a('0x62')]?_0x1c370a[_0x819a('0x62')][_0x819a('0x63')]:'N.A.','createdAt':moment(_0x1c370a['createdAt'])['format'](_0x819a('0x67'))['toString'](),'closedAt':_0x1c370a[_0x819a('0x68')]?moment(_0x1c370a['closedAt'])[_0x819a('0x45')]('YYYY-MM-DD\x20HH:mm:ss')[_0x819a('0x69')]():'','disposition':_0x1c370a[_0x819a('0x6a')],'messages':_(_0x1c370a[_0x819a('0x5c')])['filter']({'secret':![]})[_0x819a('0x6b')](function(_0x32954b){if(_0x32954b[_0x819a('0x5b')]){var _0x423469=path['join'](_0x41801f,_0x32954b[_0x819a('0x5b')][_0x819a('0x6c')]);if(fs[_0x819a('0x6d')](_0x423469)){fs['createReadStream'](_0x423469)[_0x819a('0x6e')](fs['createWriteStream'](path[_0x819a('0x50')](_0x385aa6,_0x32954b[_0x819a('0x5b')]['basename'])));}}return{'date':moment(_0x32954b['createdAt'])[_0x819a('0x45')](_0x819a('0x67'))['toString'](),'sender':_0x32954b['direction']===_0x819a('0x6f')?_0x32954b[_0x819a('0x57')]?_0x32954b['User'][_0x819a('0x63')]:'System':_0x32954b[_0x819a('0x59')][_0x819a('0x70')]+(_0x32954b[_0x819a('0x59')]['lastName']?'\x20'+_0x32954b['Contact'][_0x819a('0x5a')]:''),'body':_0x32954b['Attachment']?_0x32954b[_0x819a('0x5b')][_0x819a('0x6c')]:_0x32954b[_0x819a('0x33')],'direction':_0x32954b[_0x819a('0x5e')]===_0x819a('0x6f')?'A':'C','secret':_0x32954b[_0x819a('0x5f')],'read':_0x32954b[_0x819a('0x60')],'attachment':_0x32954b[_0x819a('0x5b')]};})[_0x819a('0x71')]()};return ejs[_0x819a('0x72')](path[_0x819a('0x50')](config[_0x819a('0x51')],_0x819a('0x52'),_0x819a('0x73'),'downloadInteraction.ejs'),{'interaction':_0x3b7785})[_0x819a('0x18')](function(_0x30f09e){var _0x4f4458=path[_0x819a('0x50')](_0x385aa6,_0x819a('0x74')+_0x1c370a['id']+'-'+_0x3cdc87+'.pdf');var _0x2bbef4={'path':_0x4f4458,'channel':'Whatsapp','interactionId':_0x1c370a['id']};return pdf[_0x819a('0x75')](_0x30f09e,_0x2bbef4);})[_0x819a('0x18')](function(){return new BPromise(function(_0x56b14a,_0x4a6e51){zipdir(_0x385aa6,{'saveTo':_0x4b373a},function(_0x261ac7,_0x13b1ff){if(_0x261ac7)return _0x4a6e51(_0x261ac7);return _0x56b14a(_0x13b1ff);});})[_0x819a('0x18')](function(){return new BPromise(function(_0x13017f,_0x1eba13){rimraf(_0x385aa6,function(_0x434047){if(_0x434047)_0x1eba13(_0x434047);return _0x13017f();});});})[_0x819a('0x18')](function(){return _0x3b3755[_0x819a('0x4f')](_0x4b373a,_0xa40e2f,function(_0x3de428){if(_0x3de428){console[_0x819a('0x76')](_0x819a('0x77'),_0x3de428);}else{fs[_0x819a('0x78')](_0x4b373a);}});});});}else{return _0x3b3755['sendStatus'](0xc8);}})[_0x819a('0x25')](handleError(_0x3b3755,null));}; \ No newline at end of file +var _0x6d9a=['api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','update','then','destroy','error','stack','name','index','rawAttributes','fieldName','type','getOptions','findAll','whatsapp','query','user','catch','params','model','keys','WhatsappInteraction','intersection','attributes','fields','includeAll','include','options','create','body','find','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','filters','length','nolimit','order','sort','where','WhatsappInteractionId','filter','merge','map','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','Tag','color','emit','whatsappInteractionTags:save','removeTags','unix','toString','join','root','files','server','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','createdAt','secret','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','closed','closedAt','disposition','Messages','basename','createReadStream','pipe','createWriteStream','direction','System','out','read','value','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','unlinkSync','rimraf','zip-dir','moment','bluebird','path','ejs','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger'];(function(_0x23f8ed,_0xb646df){var _0x519ff7=function(_0x4e45fa){while(--_0x4e45fa){_0x23f8ed['push'](_0x23f8ed['shift']());}};_0x519ff7(++_0xb646df);}(_0x6d9a,0x179));var _0xa6d9=function(_0x3d0bd6,_0x4b5cc9){_0x3d0bd6=_0x3d0bd6-0x0;var _0x5ce57c=_0x6d9a[_0x3d0bd6];return _0x5ce57c;};'use strict';var rimraf=require(_0xa6d9('0x0'));var zipdir=require(_0xa6d9('0x1'));var moment=require(_0xa6d9('0x2'));var BPromise=require(_0xa6d9('0x3'));var util=require('util');var path=require(_0xa6d9('0x4'));var ejs=require(_0xa6d9('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0xa6d9('0x6'));var qs=require(_0xa6d9('0x7'));var pdf=require(_0xa6d9('0x8'));var logger=require(_0xa6d9('0x9'))(_0xa6d9('0xa'));var config=require(_0xa6d9('0xb'));var db=require(_0xa6d9('0xc'))['db'];config[_0xa6d9('0xd')]=_[_0xa6d9('0xe')](config[_0xa6d9('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xa6d9('0xf'))(new Redis(config['redis']));require(_0xa6d9('0x10'))[_0xa6d9('0x11')](socket);function respondWithStatusCode(_0x5f1037,_0x1a2eed){_0x1a2eed=_0x1a2eed||0xcc;return function(_0x583f40){if(_0x583f40){return _0x5f1037[_0xa6d9('0x12')](_0x1a2eed);}return _0x5f1037[_0xa6d9('0x13')](_0x1a2eed)[_0xa6d9('0x14')]();};}function respondWithResult(_0x501f69,_0x5a59b6){_0x5a59b6=_0x5a59b6||0xc8;return function(_0x3412c1){if(_0x3412c1){return _0x501f69[_0xa6d9('0x13')](_0x5a59b6)[_0xa6d9('0x15')](_0x3412c1);}};}function respondWithFilteredResult(_0x3fee43,_0x52e4bb){return function(_0x30e97b){if(_0x30e97b){var _0x5719a7=typeof _0x52e4bb[_0xa6d9('0x16')]==='undefined'&&typeof _0x52e4bb[_0xa6d9('0x17')]==='undefined';var _0x1740e2=_0x30e97b[_0xa6d9('0x18')];var _0xa24ec8=_0x5719a7?0x0:_0x52e4bb[_0xa6d9('0x16')];var _0x37f7b2=_0x5719a7?_0x30e97b[_0xa6d9('0x18')]:_0x52e4bb[_0xa6d9('0x16')]+_0x52e4bb[_0xa6d9('0x17')];var _0x40e156;if(_0x37f7b2>=_0x1740e2){_0x37f7b2=_0x1740e2;_0x40e156=0xc8;}else{_0x40e156=0xce;}_0x3fee43[_0xa6d9('0x13')](_0x40e156);return _0x3fee43[_0xa6d9('0x19')](_0xa6d9('0x1a'),_0xa24ec8+'-'+_0x37f7b2+'/'+_0x1740e2)[_0xa6d9('0x15')](_0x30e97b);}return null;};}function saveUpdates(_0x566143){return function(_0xa9ec0){if(_0xa9ec0){return _0xa9ec0[_0xa6d9('0x1b')](_0x566143)[_0xa6d9('0x1c')](function(_0x1d7c5e){return _0x1d7c5e;});}return null;};}function removeEntity(_0x562dbe){return function(_0x26f974){if(_0x26f974){return _0x26f974[_0xa6d9('0x1d')]()['then'](function(){_0x562dbe[_0xa6d9('0x13')](0xcc)[_0xa6d9('0x14')]();});}};}function handleEntityNotFound(_0x2b2c50){return function(_0x344515){if(!_0x344515){_0x2b2c50['sendStatus'](0x194);}return _0x344515;};}function handleError(_0x422432,_0x2db67b){_0x2db67b=_0x2db67b||0x1f4;return function(_0x3ec444){logger[_0xa6d9('0x1e')](_0x3ec444[_0xa6d9('0x1f')]);if(_0x3ec444[_0xa6d9('0x20')]){delete _0x3ec444[_0xa6d9('0x20')];}_0x422432[_0xa6d9('0x13')](_0x2db67b)['send'](_0x3ec444);};}exports[_0xa6d9('0x21')]=function(_0x399dc1,_0x40584d){var _0x1709c9={};var _0x4210e2=_['map'](db['WhatsappInteraction'][_0xa6d9('0x22')],function(_0xda7494){return{'name':_0xda7494[_0xa6d9('0x23')],'type':_0xda7494[_0xa6d9('0x24')]['key']};});_0x1709c9=qs[_0xa6d9('0x25')](_0x4210e2,_0x399dc1);return interaction[_0xa6d9('0x26')](_0xa6d9('0x27'),_0x399dc1[_0xa6d9('0x28')],_0x399dc1[_0xa6d9('0x29')],_0x1709c9,_0x4210e2)[_0xa6d9('0x1c')](respondWithFilteredResult(_0x40584d,_0x1709c9))[_0xa6d9('0x2a')](handleError(_0x40584d,null));};exports['show']=function(_0x116ea6,_0x2cb952){var _0x3e6ed0={'raw':![],'where':{'id':_0x116ea6[_0xa6d9('0x2b')]['id']}},_0x41469a={};_0x41469a[_0xa6d9('0x2c')]=_[_0xa6d9('0x2d')](db[_0xa6d9('0x2e')][_0xa6d9('0x22')]);_0x41469a[_0xa6d9('0x28')]=_[_0xa6d9('0x2d')](_0x116ea6['query']);_0x41469a['filters']=_[_0xa6d9('0x2f')](_0x41469a[_0xa6d9('0x2c')],_0x41469a[_0xa6d9('0x28')]);_0x3e6ed0[_0xa6d9('0x30')]=_[_0xa6d9('0x2f')](_0x41469a[_0xa6d9('0x2c')],qs[_0xa6d9('0x31')](_0x116ea6['query'][_0xa6d9('0x31')]));_0x3e6ed0['attributes']=_0x3e6ed0[_0xa6d9('0x30')]['length']?_0x3e6ed0[_0xa6d9('0x30')]:_0x41469a[_0xa6d9('0x2c')];if(_0x116ea6[_0xa6d9('0x28')][_0xa6d9('0x32')]){_0x3e6ed0[_0xa6d9('0x33')]=[{'all':!![]}];}_0x3e6ed0=_['merge']({},_0x3e6ed0,_0x116ea6[_0xa6d9('0x34')]);return db[_0xa6d9('0x2e')]['find'](_0x3e6ed0)[_0xa6d9('0x1c')](handleEntityNotFound(_0x2cb952,null))[_0xa6d9('0x1c')](respondWithResult(_0x2cb952,null))['catch'](handleError(_0x2cb952,null));};exports[_0xa6d9('0x35')]=function(_0x2827d4,_0x2e35de){return db[_0xa6d9('0x2e')][_0xa6d9('0x35')](_0x2827d4[_0xa6d9('0x36')],{})[_0xa6d9('0x1c')](respondWithResult(_0x2e35de,0xc9))[_0xa6d9('0x2a')](handleError(_0x2e35de,null));};exports[_0xa6d9('0x1b')]=function(_0x18109f,_0x2a1b4e){if(_0x18109f[_0xa6d9('0x36')]['id']){delete _0x18109f[_0xa6d9('0x36')]['id'];}return db[_0xa6d9('0x2e')]['find']({'where':{'id':_0x18109f[_0xa6d9('0x2b')]['id']}})['then'](handleEntityNotFound(_0x2a1b4e,null))['then'](saveUpdates(_0x18109f[_0xa6d9('0x36')],null))[_0xa6d9('0x1c')](respondWithResult(_0x2a1b4e,null))[_0xa6d9('0x2a')](handleError(_0x2a1b4e,null));};exports['destroy']=function(_0x317ffe,_0x44c4a6){return db[_0xa6d9('0x2e')][_0xa6d9('0x37')]({'where':{'id':_0x317ffe[_0xa6d9('0x2b')]['id']}})[_0xa6d9('0x1c')](handleEntityNotFound(_0x44c4a6,null))['then'](removeEntity(_0x44c4a6,null))['catch'](handleError(_0x44c4a6,null));};exports['describe']=function(_0x4bb62a,_0x443a79){return db['WhatsappInteraction'][_0xa6d9('0x38')]()[_0xa6d9('0x1c')](respondWithResult(_0x443a79,null))[_0xa6d9('0x2a')](handleError(_0x443a79,null));};exports[_0xa6d9('0x39')]=function(_0x3f34d9,_0x5191b1){return db[_0xa6d9('0x3a')][_0xa6d9('0x37')]({'where':{'id':_0x3f34d9[_0xa6d9('0x2b')]['id']}})[_0xa6d9('0x1c')](handleEntityNotFound(_0x5191b1,null))[_0xa6d9('0x1c')](function(_0x566784){if(_0x566784){return _0x566784['addMessage'](_0x3f34d9[_0xa6d9('0x36')][_0xa6d9('0x3b')],_['omit'](_0x3f34d9[_0xa6d9('0x36')],[_0xa6d9('0x3b'),'id'])||{});}})[_0xa6d9('0x1c')](respondWithResult(_0x5191b1,null))[_0xa6d9('0x2a')](handleError(_0x5191b1,null));};exports[_0xa6d9('0x3c')]=function(_0x16cc2b,_0x475e91){var _0x50b8e4={'raw':![],'where':{}};var _0x54ccd3={};var _0xffbf58={'count':0x0,'rows':[]};return db[_0xa6d9('0x2e')][_0xa6d9('0x3d')]({'where':{'id':_0x16cc2b[_0xa6d9('0x2b')]['id']}})[_0xa6d9('0x1c')](handleEntityNotFound(_0x475e91,null))[_0xa6d9('0x1c')](function(_0x57dffe){if(_0x57dffe){_0x54ccd3[_0xa6d9('0x2c')]=_[_0xa6d9('0x2d')](db['WhatsappMessage'][_0xa6d9('0x22')]);_0x54ccd3[_0xa6d9('0x28')]=_['keys'](_0x16cc2b['query']);_0x54ccd3[_0xa6d9('0x3e')]=_['intersection'](_0x54ccd3[_0xa6d9('0x2c')],_0x54ccd3[_0xa6d9('0x28')]);_0x50b8e4[_0xa6d9('0x30')]=_['intersection'](_0x54ccd3[_0xa6d9('0x2c')],qs['fields'](_0x16cc2b[_0xa6d9('0x28')]['fields']));_0x50b8e4['attributes']=_0x50b8e4[_0xa6d9('0x30')][_0xa6d9('0x3f')]?_0x50b8e4['attributes']:_0x54ccd3[_0xa6d9('0x2c')];if(!_0x16cc2b[_0xa6d9('0x28')]['hasOwnProperty'](_0xa6d9('0x40'))){_0x50b8e4[_0xa6d9('0x17')]=qs[_0xa6d9('0x17')](_0x16cc2b[_0xa6d9('0x28')][_0xa6d9('0x17')]);_0x50b8e4[_0xa6d9('0x16')]=qs[_0xa6d9('0x16')](_0x16cc2b[_0xa6d9('0x28')]['offset']);}_0x50b8e4[_0xa6d9('0x41')]=qs[_0xa6d9('0x42')](_0x16cc2b['query'][_0xa6d9('0x42')]);_0x50b8e4[_0xa6d9('0x43')]=qs[_0xa6d9('0x3e')](_['pick'](_0x16cc2b['query'],_0x54ccd3['filters']));_0x50b8e4['where'][_0xa6d9('0x44')]=_0x57dffe['id'];if(_0x16cc2b[_0xa6d9('0x28')][_0xa6d9('0x45')]){_0x50b8e4['where']=_[_0xa6d9('0x46')](_0x50b8e4[_0xa6d9('0x43')],{'$or':_[_0xa6d9('0x47')](_0x50b8e4[_0xa6d9('0x30')],function(_0x48b1c1){var _0x500ec1={};_0x500ec1[_0x48b1c1]={'$like':'%'+_0x16cc2b[_0xa6d9('0x28')][_0xa6d9('0x45')]+'%'};return _0x500ec1;})});}if(_0x16cc2b[_0xa6d9('0x28')][_0xa6d9('0x48')]){var _0x26a7bb=_0x16cc2b[_0xa6d9('0x28')][_0xa6d9('0x48')]['split'](',');var _0x2ca8a2={};_0x2ca8a2[_0x26a7bb[0x0]]={'$gte':moment(_0x26a7bb[0x1])[_0xa6d9('0x49')](_0xa6d9('0x4a'))};_0x50b8e4[_0xa6d9('0x43')]=_[_0xa6d9('0x46')](_0x50b8e4['where'],_0x2ca8a2);}_0x50b8e4=_[_0xa6d9('0x46')]({},_0x50b8e4,_0x16cc2b['options']);return db['WhatsappMessage'][_0xa6d9('0x18')]({'where':_0x50b8e4[_0xa6d9('0x43')]})[_0xa6d9('0x1c')](function(_0x4b3e46){_0xffbf58[_0xa6d9('0x18')]=_0x4b3e46;if(_0x16cc2b[_0xa6d9('0x28')][_0xa6d9('0x32')]){_0x50b8e4['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xa6d9('0x26')](_0x50b8e4);})[_0xa6d9('0x1c')](function(_0x2baa2d){_0xffbf58[_0xa6d9('0x4b')]=_0x2baa2d;return _0xffbf58;});}})[_0xa6d9('0x1c')](respondWithFilteredResult(_0x475e91,_0x50b8e4))['catch'](handleError(_0x475e91,null));};exports[_0xa6d9('0x4c')]=function(_0xb8b49f,_0x549211){return db[_0xa6d9('0x2e')]['find']({'where':{'id':_0xb8b49f['params']['id']}})[_0xa6d9('0x1c')](handleEntityNotFound(_0x549211,null))[_0xa6d9('0x1c')](function(_0x108db1){if(_0x108db1){return _0x108db1[_0xa6d9('0x4d')](_0xb8b49f['body']['ids'],_[_0xa6d9('0x4e')](_0xb8b49f[_0xa6d9('0x36')],[_0xa6d9('0x3b'),'id'])||{})['spread'](function(){return db[_0xa6d9('0x4f')]['findAll']({'attributes':['id',_0xa6d9('0x20'),_0xa6d9('0x50')],'where':{'id':_0xb8b49f[_0xa6d9('0x36')][_0xa6d9('0x3b')]}});})[_0xa6d9('0x1c')](function(_0x20e552){socket[_0xa6d9('0x51')](_0xa6d9('0x52'),{'id':Number(_0xb8b49f[_0xa6d9('0x2b')]['id']),'tags':_0x20e552||[]});return{'id':Number(_0xb8b49f[_0xa6d9('0x2b')]['id']),'tags':_0x20e552||[]};});}})[_0xa6d9('0x1c')](respondWithResult(_0x549211,null))[_0xa6d9('0x2a')](handleError(_0x549211,null));};exports[_0xa6d9('0x53')]=function(_0x170bf6,_0x488e31){return db['WhatsappInteraction'][_0xa6d9('0x37')]({'where':{'id':_0x170bf6['params']['id']}})[_0xa6d9('0x1c')](handleEntityNotFound(_0x488e31,null))[_0xa6d9('0x1c')](function(_0x26a126){if(_0x26a126){return _0x26a126[_0xa6d9('0x53')](_0x170bf6['query'][_0xa6d9('0x3b')]);}})[_0xa6d9('0x1c')](respondWithStatusCode(_0x488e31,null))[_0xa6d9('0x2a')](handleError(_0x488e31,null));};exports['download']=function(_0x5d1ff7,_0x50c09f){var _0x373f3f=moment()[_0xa6d9('0x54')]()[_0xa6d9('0x55')]();var _0x319412=path[_0xa6d9('0x56')](config[_0xa6d9('0x57')],'server',_0xa6d9('0x58'),'tmp');var _0x684ae3=path[_0xa6d9('0x56')](config[_0xa6d9('0x57')],_0xa6d9('0x59'),_0xa6d9('0x58'),_0xa6d9('0x5a'));var _0x56a828=path[_0xa6d9('0x56')](_0x319412,_0x373f3f);var _0x25fa8b=util[_0xa6d9('0x49')](_0xa6d9('0x5b'),_0x5d1ff7['params']['id'],_0x373f3f);var _0x4bace9=path[_0xa6d9('0x56')](_0x319412,_0x25fa8b);var _0x5c8770=[];_0x5c8770[_0xa6d9('0x5c')]({'model':db['User'],'as':_0xa6d9('0x5d'),'attributes':['id',_0xa6d9('0x5e')],'raw':!![]});_0x5c8770['push']({'model':db[_0xa6d9('0x5f')],'as':_0xa6d9('0x60'),'attributes':['id',_0xa6d9('0x61'),_0xa6d9('0x62')],'raw':!![]});if(_0x5d1ff7[_0xa6d9('0x28')][_0xa6d9('0x5a')]){_0x5c8770[_0xa6d9('0x5c')]({'model':db[_0xa6d9('0x63')],'as':'Attachment','raw':!![]});}var _0x142d1c=[{'model':db[_0xa6d9('0x3a')],'as':'Messages','attributes':['id','body',_0xa6d9('0x64'),'direction',_0xa6d9('0x65'),'read'],'include':_0x5c8770}];_0x142d1c[_0xa6d9('0x5c')]({'model':db[_0xa6d9('0x66')],'as':_0xa6d9('0x67'),'attributes':['id',_0xa6d9('0x20')]});_0x142d1c[_0xa6d9('0x5c')]({'model':db[_0xa6d9('0x5d')],'as':_0xa6d9('0x68'),'attributes':['id','fullname']});return db['WhatsappInteraction'][_0xa6d9('0x37')]({'where':{'id':_0x5d1ff7[_0xa6d9('0x2b')]['id']},'include':_0x142d1c})[_0xa6d9('0x1c')](handleEntityNotFound(_0x50c09f,null))[_0xa6d9('0x1c')](function(_0x4d5e40){if(_0x4d5e40){var _0x14472d=_0x4d5e40[_0xa6d9('0x69')]({'plain':!![]});fs[_0xa6d9('0x6a')](_0x56a828);var _0x1a082f={'channel':_0xa6d9('0x6b'),'account':_0x14472d[_0xa6d9('0x67')][_0xa6d9('0x20')],'agent':_0x14472d[_0xa6d9('0x68')]?_0x14472d[_0xa6d9('0x68')]['fullname']:'N.A.','createdAt':moment(_0x14472d[_0xa6d9('0x64')])[_0xa6d9('0x49')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa6d9('0x55')](),'closedAt':_0x14472d[_0xa6d9('0x6c')]?moment(_0x14472d[_0xa6d9('0x6d')])[_0xa6d9('0x49')](_0xa6d9('0x4a'))[_0xa6d9('0x55')]():'','disposition':_0x14472d[_0xa6d9('0x6e')],'messages':_(_0x14472d[_0xa6d9('0x6f')])[_0xa6d9('0x45')]({'secret':![]})[_0xa6d9('0x47')](function(_0x455e3f){if(_0x455e3f[_0xa6d9('0x63')]){var _0x1d6bf3=path[_0xa6d9('0x56')](_0x684ae3,_0x455e3f['Attachment'][_0xa6d9('0x70')]);if(fs['existsSync'](_0x1d6bf3)){fs[_0xa6d9('0x71')](_0x1d6bf3)[_0xa6d9('0x72')](fs[_0xa6d9('0x73')](path[_0xa6d9('0x56')](_0x56a828,_0x455e3f[_0xa6d9('0x63')][_0xa6d9('0x70')])));}}return{'date':moment(_0x455e3f['createdAt'])[_0xa6d9('0x49')](_0xa6d9('0x4a'))[_0xa6d9('0x55')](),'sender':_0x455e3f[_0xa6d9('0x74')]==='out'?_0x455e3f[_0xa6d9('0x5d')]?_0x455e3f['User'][_0xa6d9('0x5e')]:_0xa6d9('0x75'):_0x455e3f[_0xa6d9('0x60')][_0xa6d9('0x61')]+(_0x455e3f[_0xa6d9('0x60')]['lastName']?'\x20'+_0x455e3f[_0xa6d9('0x60')][_0xa6d9('0x62')]:''),'body':_0x455e3f[_0xa6d9('0x63')]?_0x455e3f['Attachment'][_0xa6d9('0x70')]:_0x455e3f[_0xa6d9('0x36')],'direction':_0x455e3f[_0xa6d9('0x74')]===_0xa6d9('0x76')?'A':'C','secret':_0x455e3f[_0xa6d9('0x65')],'read':_0x455e3f[_0xa6d9('0x77')],'attachment':_0x455e3f[_0xa6d9('0x63')]};})[_0xa6d9('0x78')]()};return ejs['renderFile'](path[_0xa6d9('0x56')](config[_0xa6d9('0x57')],'server',_0xa6d9('0x79'),_0xa6d9('0x7a')),{'interaction':_0x1a082f})[_0xa6d9('0x1c')](function(_0x17122b){var _0x2c2bd8=path['join'](_0x56a828,_0xa6d9('0x7b')+_0x14472d['id']+'-'+_0x373f3f+_0xa6d9('0x7c'));var _0x221e0a={'path':_0x2c2bd8,'channel':'Whatsapp','interactionId':_0x14472d['id']};return pdf[_0xa6d9('0x7d')](_0x17122b,_0x221e0a);})[_0xa6d9('0x1c')](function(){return new BPromise(function(_0x9e2cc0,_0x19a859){zipdir(_0x56a828,{'saveTo':_0x4bace9},function(_0x2d5795,_0x44fdcf){if(_0x2d5795)return _0x19a859(_0x2d5795);return _0x9e2cc0(_0x44fdcf);});})[_0xa6d9('0x1c')](function(){return new BPromise(function(_0x52ccff,_0x3fa5f8){rimraf(_0x56a828,function(_0x4c3137){if(_0x4c3137)_0x3fa5f8(_0x4c3137);return _0x52ccff();});});})[_0xa6d9('0x1c')](function(){return _0x50c09f[_0xa6d9('0x7e')](_0x4bace9,_0x25fa8b,function(_0x102841){if(_0x102841){console[_0xa6d9('0x7f')]('err',_0x102841);}else{fs[_0xa6d9('0x80')](_0x4bace9);}});});});}else{return _0x50c09f[_0xa6d9('0x12')](0xc8);}})['catch'](handleError(_0x50c09f,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index bd7e48c..dd88475 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 _0x97f5=['update','remove','getUsers','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','setMaxListeners','save'];(function(_0x5b589,_0x2b654a){var _0x372e46=function(_0x11da95){while(--_0x11da95){_0x5b589['push'](_0x5b589['shift']());}};_0x372e46(++_0x2b654a);}(_0x97f5,0x72));var _0x597f=function(_0x49692a,_0x3fed4a){_0x49692a=_0x49692a-0x0;var _0x166a18=_0x97f5[_0x49692a];return _0x166a18;};'use strict';var EventEmitter=require(_0x597f('0x0'));var WhatsappInteraction=require(_0x597f('0x1'))['db'][_0x597f('0x2')];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x597f('0x3')](0x0);var events={'afterCreate':_0x597f('0x4'),'afterUpdate':_0x597f('0x5'),'afterDestroy':_0x597f('0x6')};function emitEvent(_0x3e3c7e){return function(_0x3bca61,_0x38560e,_0x1abf16){_0x3bca61[_0x597f('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x22b5d0){_0x3bca61[_0x597f('0x8')](_0x597f('0x9'),_0x22b5d0[_0x597f('0xa')](function(_0x189e0d){return{'id':_0x189e0d['id']};}));return WhatsappMessage[_0x597f('0xb')]({'where':{'WhatsappInteractionId':_0x3bca61['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x31c4bc){_0x3bca61[_0x597f('0x8')](_0x597f('0xc'),_0x31c4bc['length']);WhatsappInteractionEvents['emit'](_0x3e3c7e+':'+_0x3bca61['id'],_0x3bca61);WhatsappInteractionEvents[_0x597f('0xd')](_0x3e3c7e,_0x3bca61);_0x1abf16(null);})['catch'](_0x1abf16(null));};}for(var e in events){if(events[_0x597f('0xe')](e)){var event=events[e];WhatsappInteraction[_0x597f('0xf')](e,emitEvent(event));}}module[_0x597f('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x0434=['catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','update','remove','then','map','findAll','setDataValue','unreadMessages','length','emit'];(function(_0x402af3,_0x4261c2){var _0x3de580=function(_0x1c5d92){while(--_0x1c5d92){_0x402af3['push'](_0x402af3['shift']());}};_0x3de580(++_0x4261c2);}(_0x0434,0x1ad));var _0x4043=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0x0434[_0x580647];return _0x5f0792;};'use strict';var EventEmitter=require(_0x4043('0x0'));var WhatsappInteraction=require(_0x4043('0x1'))['db'][_0x4043('0x2')];var WhatsappMessage=require(_0x4043('0x1'))['db'][_0x4043('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4043('0x4'),'afterDestroy':_0x4043('0x5')};function emitEvent(_0x3e475f){return function(_0x2e1aec,_0x424a16,_0x1dba57){_0x2e1aec['getUsers']({'attributes':['id'],'raw':!![]})[_0x4043('0x6')](function(_0x1ed6c4){_0x2e1aec['setDataValue']('Users',_0x1ed6c4[_0x4043('0x7')](function(_0x2b959b){return{'id':_0x2b959b['id']};}));return WhatsappMessage[_0x4043('0x8')]({'where':{'WhatsappInteractionId':_0x2e1aec['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4043('0x6')](function(_0x30f083){_0x2e1aec[_0x4043('0x9')](_0x4043('0xa'),_0x30f083[_0x4043('0xb')]);WhatsappInteractionEvents['emit'](_0x3e475f+':'+_0x2e1aec['id'],_0x2e1aec);WhatsappInteractionEvents[_0x4043('0xc')](_0x3e475f,_0x2e1aec);_0x1dba57(null);})[_0x4043('0xd')](_0x1dba57(null));};}for(var e in events){if(events[_0x4043('0xe')](e)){var event=events[e];WhatsappInteraction[_0x4043('0xf')](e,emitEvent(event));}}module[_0x4043('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index d26d9f9..317695e 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 _0x9243=['closed','closedAt','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','changed'];(function(_0x229f5e,_0x433f0f){var _0x2d62ff=function(_0xe4d381){while(--_0xe4d381){_0x229f5e['push'](_0x229f5e['shift']());}};_0x2d62ff(++_0x433f0f);}(_0x9243,0x89));var _0x3924=function(_0x531cb8,_0x8ef36f){_0x531cb8=_0x531cb8-0x0;var _0x5cf297=_0x9243[_0x531cb8];return _0x5cf297;};'use strict';var _=require(_0x3924('0x0'));var util=require(_0x3924('0x1'));var logger=require(_0x3924('0x2'))(_0x3924('0x3'));var moment=require('moment');var BPromise=require(_0x3924('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3924('0x5'));var rimraf=require(_0x3924('0x6'));var config=require(_0x3924('0x7'));var attributes=require(_0x3924('0x8'));module[_0x3924('0x9')]=function(_0x4ad4e8,_0x725fc9){return _0x4ad4e8['define'](_0x3924('0xa'),attributes,{'tableName':_0x3924('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x22576d,_0x24bd4b,_0x5eee30){if(_0x22576d[_0x3924('0xc')](_0x3924('0xd'))){_0x22576d[_0x3924('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x5eee30(null,_0x22576d);}}});}; \ No newline at end of file +var _0xeccf=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','WhatsappInteraction','whatsapp_interactions','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x4df469,_0x5cb3b0){var _0x443f7a=function(_0x15002d){while(--_0x15002d){_0x4df469['push'](_0x4df469['shift']());}};_0x443f7a(++_0x5cb3b0);}(_0xeccf,0x10c));var _0xfecc=function(_0x45fbe3,_0x415346){_0x45fbe3=_0x45fbe3-0x0;var _0x33f029=_0xeccf[_0x45fbe3];return _0x33f029;};'use strict';var _=require(_0xfecc('0x0'));var util=require(_0xfecc('0x1'));var logger=require(_0xfecc('0x2'))(_0xfecc('0x3'));var moment=require(_0xfecc('0x4'));var BPromise=require(_0xfecc('0x5'));var rp=require(_0xfecc('0x6'));var fs=require('fs');var path=require(_0xfecc('0x7'));var rimraf=require(_0xfecc('0x8'));var config=require(_0xfecc('0x9'));var attributes=require('./whatsappInteraction.attributes');module[_0xfecc('0xa')]=function(_0x26ef5b,_0x28275d){return _0x26ef5b['define'](_0xfecc('0xb'),attributes,{'tableName':_0xfecc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xe53bbf,_0x40d411,_0x354b10){if(_0xe53bbf['changed'](_0xfecc('0xd'))){_0xe53bbf[_0xfecc('0xe')]=moment()['format'](_0xfecc('0xf'));}_0x354b10(null,_0xe53bbf);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 3b63307..3e095c9 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 _0x2f59=['AddTagsToWhatsappInteraction','find','ids','omit','spread','AddTags','lodash','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','then','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','where','attributes','limit'];(function(_0x278fa6,_0x59feac){var _0x262a91=function(_0x594e8d){while(--_0x594e8d){_0x278fa6['push'](_0x278fa6['shift']());}};_0x262a91(++_0x59feac);}(_0x2f59,0x1a8));var _0x92f5=function(_0x36fce5,_0x1d352a){_0x36fce5=_0x36fce5-0x0;var _0x247a82=_0x2f59[_0x36fce5];return _0x247a82;};'use strict';var _=require(_0x92f5('0x0'));var util=require('util');var moment=require(_0x92f5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x92f5('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x92f5('0x3'));var logger=require(_0x92f5('0x4'))('rpc');var config=require(_0x92f5('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x92f5('0x6')][_0x92f5('0x7')]({'port':0x232a});config[_0x92f5('0x8')]=_[_0x92f5('0x9')](config[_0x92f5('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x92f5('0xa'))(new Redis(config[_0x92f5('0x8')]));require(_0x92f5('0xb'))[_0x92f5('0xc')](socket);function respondWithRpcPromise(_0x5a1dd1,_0x123d09,_0x7210a8){return new BPromise(function(_0x34482a,_0x380847){return client['request'](_0x5a1dd1,_0x7210a8)[_0x92f5('0xd')](function(_0x575490){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x123d09,_0x92f5('0xe'));logger[_0x92f5('0xf')](_0x92f5('0x10'),_0x123d09,_0x92f5('0xe'),JSON[_0x92f5('0x11')](_0x575490));if(_0x575490[_0x92f5('0x12')]){if(_0x575490[_0x92f5('0x12')][_0x92f5('0x13')]===0x1f4){logger[_0x92f5('0x12')](_0x92f5('0x14'),_0x123d09,_0x575490[_0x92f5('0x12')][_0x92f5('0x15')]);return _0x380847(_0x575490[_0x92f5('0x12')][_0x92f5('0x15')]);}logger[_0x92f5('0x12')](_0x92f5('0x14'),_0x123d09,_0x575490[_0x92f5('0x12')][_0x92f5('0x15')]);return _0x34482a(_0x575490[_0x92f5('0x12')]['message']);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x123d09,_0x92f5('0xe'));_0x34482a(_0x575490[_0x92f5('0x16')][_0x92f5('0x15')]);}})[_0x92f5('0x17')](function(_0xbc2ccf){logger[_0x92f5('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x123d09,_0xbc2ccf);_0x380847(_0xbc2ccf);});});}exports[_0x92f5('0x18')]=function(_0x7666ff){var _0x99c341=this;return new Promise(function(_0x598712,_0x18797f){return db[_0x92f5('0x19')][_0x92f5('0x1a')](_0x7666ff[_0x92f5('0x1b')],{'raw':_0x7666ff[_0x92f5('0x1c')]?_0x7666ff[_0x92f5('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7666ff[_0x92f5('0x1c')]?_0x7666ff['options'][_0x92f5('0x1d')]||null:null,'attributes':_0x7666ff[_0x92f5('0x1c')]?_0x7666ff[_0x92f5('0x1c')][_0x92f5('0x1e')]||null:null,'limit':_0x7666ff['options']?_0x7666ff['options'][_0x92f5('0x1f')]||null:null})[_0x92f5('0xd')](function(_0x2102ac){logger['info'](_0x92f5('0x18'),_0x7666ff);logger[_0x92f5('0xf')](_0x92f5('0x18'),_0x7666ff,JSON['stringify'](_0x2102ac));_0x598712(_0x2102ac);})['catch'](function(_0x12d5d0){logger[_0x92f5('0x12')](_0x92f5('0x18'),_0x12d5d0[_0x92f5('0x15')],_0x7666ff);_0x18797f(_0x99c341[_0x92f5('0x12')](0x1f4,_0x12d5d0['message']));});});};exports[_0x92f5('0x20')]=function(_0x1055ba){return new Promise(function(_0xbe6085,_0x5456e3){return db['WhatsappInteraction'][_0x92f5('0x21')]({'where':_0x1055ba[_0x92f5('0x1c')]?_0x1055ba[_0x92f5('0x1c')]['where']||null:null})['then'](function(_0x289284){if(_0x289284){return _0x289284['addTags'](_0x1055ba[_0x92f5('0x1b')][_0x92f5('0x22')],_[_0x92f5('0x23')](_0x1055ba[_0x92f5('0x1b')],[_0x92f5('0x22'),'id'])||{});}})[_0x92f5('0x24')](function(_0x5c66fe){logger['info'](_0x92f5('0x25'),_0x1055ba);logger['debug']('AddTags',_0x1055ba,JSON[_0x92f5('0x11')](_0x5c66fe));_0xbe6085(_0x5c66fe);})[_0x92f5('0x17')](function(_0x43d9a5){logger[_0x92f5('0x12')](_0x92f5('0x25'),_0x43d9a5[_0x92f5('0x15')],_0x1055ba);_0x5456e3(_this['error'](0x1f4,_0x43d9a5[_0x92f5('0x15')]));});});}; \ No newline at end of file +var _0x649f=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','where','limit','find','body','omit','ids','spread','AddTags'];(function(_0x2c38af,_0x4035b2){var _0x37ca12=function(_0xcd3831){while(--_0xcd3831){_0x2c38af['push'](_0x2c38af['shift']());}};_0x37ca12(++_0x4035b2);}(_0x649f,0x183));var _0xf649=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x649f[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xf649('0x0'));var util=require(_0xf649('0x1'));var moment=require(_0xf649('0x2'));var BPromise=require('bluebird');var rs=require(_0xf649('0x3'));var fs=require('fs');var Redis=require(_0xf649('0x4'));var db=require(_0xf649('0x5'))['db'];var utils=require(_0xf649('0x6'));var logger=require(_0xf649('0x7'))(_0xf649('0x8'));var config=require(_0xf649('0x9'));var jayson=require(_0xf649('0xa'));var client=jayson[_0xf649('0xb')][_0xf649('0xc')]({'port':0x232a});config[_0xf649('0xd')]=_[_0xf649('0xe')](config[_0xf649('0xd')],{'host':_0xf649('0xf'),'port':0x18eb});var socket=require(_0xf649('0x10'))(new Redis(config[_0xf649('0xd')]));require(_0xf649('0x11'))['register'](socket);function respondWithRpcPromise(_0x445408,_0x22bf31,_0x4122d6){return new BPromise(function(_0x3d8aa1,_0x2cf991){return client[_0xf649('0x12')](_0x445408,_0x4122d6)[_0xf649('0x13')](function(_0x12deba){logger[_0xf649('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x22bf31,_0xf649('0x15'));logger[_0xf649('0x16')](_0xf649('0x17'),_0x22bf31,_0xf649('0x15'),JSON[_0xf649('0x18')](_0x12deba));if(_0x12deba[_0xf649('0x19')]){if(_0x12deba[_0xf649('0x19')][_0xf649('0x1a')]===0x1f4){logger[_0xf649('0x19')](_0xf649('0x1b'),_0x22bf31,_0x12deba['error'][_0xf649('0x1c')]);return _0x2cf991(_0x12deba['error'][_0xf649('0x1c')]);}logger[_0xf649('0x19')](_0xf649('0x1b'),_0x22bf31,_0x12deba['error'][_0xf649('0x1c')]);return _0x3d8aa1(_0x12deba[_0xf649('0x19')][_0xf649('0x1c')]);}else{logger[_0xf649('0x14')](_0xf649('0x1b'),_0x22bf31,_0xf649('0x15'));_0x3d8aa1(_0x12deba['result'][_0xf649('0x1c')]);}})[_0xf649('0x1d')](function(_0x787068){logger[_0xf649('0x19')](_0xf649('0x1b'),_0x22bf31,_0x787068);_0x2cf991(_0x787068);});});}exports[_0xf649('0x1e')]=function(_0x1dd346){var _0x3565c8=this;return new Promise(function(_0x393b25,_0x49e560){return db[_0xf649('0x1f')][_0xf649('0x20')](_0x1dd346['body'],{'raw':_0x1dd346[_0xf649('0x21')]?_0x1dd346['options'][_0xf649('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1dd346[_0xf649('0x21')]?_0x1dd346['options'][_0xf649('0x23')]||null:null,'attributes':_0x1dd346[_0xf649('0x21')]?_0x1dd346[_0xf649('0x21')]['attributes']||null:null,'limit':_0x1dd346[_0xf649('0x21')]?_0x1dd346[_0xf649('0x21')][_0xf649('0x24')]||null:null})[_0xf649('0x13')](function(_0x5f7a29){logger[_0xf649('0x14')](_0xf649('0x1e'),_0x1dd346);logger[_0xf649('0x16')](_0xf649('0x1e'),_0x1dd346,JSON[_0xf649('0x18')](_0x5f7a29));_0x393b25(_0x5f7a29);})[_0xf649('0x1d')](function(_0x513d75){logger[_0xf649('0x19')](_0xf649('0x1e'),_0x513d75[_0xf649('0x1c')],_0x1dd346);_0x49e560(_0x3565c8[_0xf649('0x19')](0x1f4,_0x513d75[_0xf649('0x1c')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x3f5812){return new Promise(function(_0x446946,_0x40b197){return db['WhatsappInteraction'][_0xf649('0x25')]({'where':_0x3f5812[_0xf649('0x21')]?_0x3f5812[_0xf649('0x21')]['where']||null:null})[_0xf649('0x13')](function(_0x555c41){if(_0x555c41){return _0x555c41['addTags'](_0x3f5812[_0xf649('0x26')]['ids'],_[_0xf649('0x27')](_0x3f5812['body'],[_0xf649('0x28'),'id'])||{});}})[_0xf649('0x29')](function(_0x2524eb){logger[_0xf649('0x14')]('AddTags',_0x3f5812);logger[_0xf649('0x16')](_0xf649('0x2a'),_0x3f5812,JSON[_0xf649('0x18')](_0x2524eb));_0x446946(_0x2524eb);})['catch'](function(_0x34c144){logger['error'](_0xf649('0x2a'),_0x34c144[_0xf649('0x1c')],_0x3f5812);_0x40b197(_this[_0xf649('0x19')](0x1f4,_0x34c144[_0xf649('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index ba74141..7896d31 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 _0x3456=['remove','update','emit','register','length','whatsappInteraction:','save'];(function(_0x5b9252,_0x4bc2f8){var _0x1a4284=function(_0x36e4c7){while(--_0x36e4c7){_0x5b9252['push'](_0x5b9252['shift']());}};_0x1a4284(++_0x4bc2f8);}(_0x3456,0x8b));var _0x6345=function(_0x18776a,_0x4fecab){_0x18776a=_0x18776a-0x0;var _0x484e4a=_0x3456[_0x18776a];return _0x484e4a;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x6345('0x0'),_0x6345('0x1'),_0x6345('0x2')];function createListener(_0x4934c3,_0x5f4d8b){return function(_0x50a098){_0x5f4d8b[_0x6345('0x3')](_0x4934c3,_0x50a098);};}function removeListener(_0x3c4a10,_0x4388aa){return function(){WhatsappInteractionEvents['removeListener'](_0x3c4a10,_0x4388aa);};}exports[_0x6345('0x4')]=function(_0x11c3d2){for(var _0x1657ae=0x0,_0xd4d4b=events[_0x6345('0x5')];_0x1657ae<_0xd4d4b;_0x1657ae++){var _0x532bb5=events[_0x1657ae];var _0xa091c4=createListener(_0x6345('0x6')+_0x532bb5,_0x11c3d2);WhatsappInteractionEvents['on'](_0x532bb5,_0xa091c4);}}; \ No newline at end of file +var _0xc5eb=['save','remove','update','emit','length','whatsappInteraction:','./whatsappInteraction.events'];(function(_0xb24fad,_0xd58756){var _0x173226=function(_0x33b4d6){while(--_0x33b4d6){_0xb24fad['push'](_0xb24fad['shift']());}};_0x173226(++_0xd58756);}(_0xc5eb,0x68));var _0xbc5e=function(_0x28bcf4,_0x436697){_0x28bcf4=_0x28bcf4-0x0;var _0x315039=_0xc5eb[_0x28bcf4];return _0x315039;};'use strict';var WhatsappInteractionEvents=require(_0xbc5e('0x0'));var events=[_0xbc5e('0x1'),_0xbc5e('0x2'),_0xbc5e('0x3')];function createListener(_0x5de5c9,_0x3690b7){return function(_0x1b77bc){_0x3690b7[_0xbc5e('0x4')](_0x5de5c9,_0x1b77bc);};}function removeListener(_0x4bde2e,_0x1bc53c){return function(){WhatsappInteractionEvents['removeListener'](_0x4bde2e,_0x1bc53c);};}exports['register']=function(_0x4ecc78){for(var _0x5ec38c=0x0,_0x381ee4=events[_0xbc5e('0x5')];_0x5ec38c<_0x381ee4;_0x5ec38c++){var _0x6612e7=events[_0x5ec38c];var _0x1cad19=createListener(_0xbc5e('0x6')+_0x6612e7,_0x4ecc78);WhatsappInteractionEvents['on'](_0x6612e7,_0x1cad19);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 02ef45d..cc11627 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 _0x1c1f=['../../components/interaction/service','get','isAuthenticated','/describe','show','post','tracked','whatsappmessage:create','/:id/status','status','put','/:id','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x4cfbf1,_0x1e0712){var _0x52fd27=function(_0xc3ec4c){while(--_0xc3ec4c){_0x4cfbf1['push'](_0x4cfbf1['shift']());}};_0x52fd27(++_0x1e0712);}(_0x1c1f,0x158));var _0xf1c1=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x1c1f[_0x556bb1];return _0x45455f;};'use strict';var multer=require('multer');var util=require(_0xf1c1('0x0'));var path=require(_0xf1c1('0x1'));var timeout=require(_0xf1c1('0x2'));var express=require('express');var router=express[_0xf1c1('0x3')]();var fs_extra=require(_0xf1c1('0x4'));var auth=require(_0xf1c1('0x5'));var interaction=require(_0xf1c1('0x6'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router[_0xf1c1('0x7')]('/',auth[_0xf1c1('0x8')](),controller['index']);router[_0xf1c1('0x7')](_0xf1c1('0x9'),auth[_0xf1c1('0x8')](),controller['describe']);router[_0xf1c1('0x7')]('/:id',auth[_0xf1c1('0x8')](),controller[_0xf1c1('0xa')]);router[_0xf1c1('0xb')]('/',auth['isAuthenticated'](),interaction[_0xf1c1('0xc')]('whatsapp',_0xf1c1('0xd')),controller['create']);router[_0xf1c1('0xb')](_0xf1c1('0xe'),controller[_0xf1c1('0xf')]);router[_0xf1c1('0x10')](_0xf1c1('0x11'),auth[_0xf1c1('0x8')](),controller[_0xf1c1('0x12')]);router[_0xf1c1('0x10')](_0xf1c1('0x13'),auth[_0xf1c1('0x8')](),controller['accept']);router[_0xf1c1('0x10')](_0xf1c1('0x14'),auth[_0xf1c1('0x8')](),controller[_0xf1c1('0x15')]);router[_0xf1c1('0x16')](_0xf1c1('0x11'),auth[_0xf1c1('0x8')](),controller[_0xf1c1('0x17')]);module[_0xf1c1('0x18')]=router; \ No newline at end of file +var _0x845a=['../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/describe','show','post','tracked','whatsapp','create','/:id/status','put','/:id','update','/:id/accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1cfe2b,_0x2a2a33){var _0xe2f8d3=function(_0x4fce13){while(--_0x4fce13){_0x1cfe2b['push'](_0x1cfe2b['shift']());}};_0xe2f8d3(++_0x2a2a33);}(_0x845a,0x80));var _0xa845=function(_0x384f36,_0x459e48){_0x384f36=_0x384f36-0x0;var _0xe523=_0x845a[_0x384f36];return _0xe523;};'use strict';var multer=require(_0xa845('0x0'));var util=require(_0xa845('0x1'));var path=require(_0xa845('0x2'));var timeout=require(_0xa845('0x3'));var express=require(_0xa845('0x4'));var router=express[_0xa845('0x5')]();var fs_extra=require(_0xa845('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa845('0x7'));var config=require(_0xa845('0x8'));var controller=require(_0xa845('0x9'));router[_0xa845('0xa')]('/',auth[_0xa845('0xb')](),controller['index']);router[_0xa845('0xa')](_0xa845('0xc'),auth[_0xa845('0xb')](),controller['describe']);router['get']('/:id',auth[_0xa845('0xb')](),controller[_0xa845('0xd')]);router[_0xa845('0xe')]('/',auth['isAuthenticated'](),interaction[_0xa845('0xf')](_0xa845('0x10'),'whatsappmessage:create'),controller[_0xa845('0x11')]);router[_0xa845('0xe')](_0xa845('0x12'),controller['status']);router[_0xa845('0x13')](_0xa845('0x14'),auth[_0xa845('0xb')](),controller[_0xa845('0x15')]);router[_0xa845('0x13')](_0xa845('0x16'),auth['isAuthenticated'](),controller['accept']);router[_0xa845('0x13')](_0xa845('0x17'),auth[_0xa845('0xb')](),controller['reject']);router[_0xa845('0x18')](_0xa845('0x14'),auth['isAuthenticated'](),controller[_0xa845('0x19')]);module[_0xa845('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index ef5044f..cb5a806 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 _0x6d2a=['TEXT','BOOLEAN','out','STRING','sequelize','exports'];(function(_0x3db2a9,_0x910583){var _0x482252=function(_0x1b3b35){while(--_0x1b3b35){_0x3db2a9['push'](_0x3db2a9['shift']());}};_0x482252(++_0x910583);}(_0x6d2a,0x12a));var _0xa6d2=function(_0x4e1119,_0x32dc78){_0x4e1119=_0x4e1119-0x0;var _0x35f53d=_0x6d2a[_0x4e1119];return _0x35f53d;};'use strict';var Sequelize=require(_0xa6d2('0x0'));module[_0xa6d2('0x1')]={'body':{'type':Sequelize[_0xa6d2('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa6d2('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa6d2('0x4')),'defaultValue':_0xa6d2('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xa6d2('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xa6d2('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa6d2('0x5')]},'providerResponse':{'type':Sequelize[_0xa6d2('0x2')]}}; \ No newline at end of file +var _0x21f2=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x4f453b,_0x2321d2){var _0x2178d2=function(_0x5b5fb8){while(--_0x5b5fb8){_0x4f453b['push'](_0x4f453b['shift']());}};_0x2178d2(++_0x2321d2);}(_0x21f2,0x158));var _0x221f=function(_0x3ca957,_0x470a67){_0x3ca957=_0x3ca957-0x0;var _0x2bdbdb=_0x21f2[_0x3ca957];return _0x2bdbdb;};'use strict';var Sequelize=require('sequelize');module[_0x221f('0x0')]={'body':{'type':Sequelize[_0x221f('0x1')](_0x221f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x221f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x221f('0x4')]('in',_0x221f('0x5')),'defaultValue':_0x221f('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x221f('0x6')](0xbe)},'phone':{'type':Sequelize[_0x221f('0x6')]},'readAt':{'type':Sequelize[_0x221f('0x7')]},'secret':{'type':Sequelize[_0x221f('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x221f('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index c53b04b..8663dec 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 _0x1a0e=['attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','params','rawAttributes','options','find','create','body','destroy','describe','whatsapp-interactions','accept','read','UserId','user','agent','format','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','contact','email','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','whatsapp','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SELECT','User','fullname','internal','rejectmessage','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','catch','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','stack','name','send','index','map','WhatsappMessage','type','query','keys','filters','model'];(function(_0x368b9e,_0x2ae528){var _0x8dc3ea=function(_0x4b2edc){while(--_0x4b2edc){_0x368b9e['push'](_0x368b9e['shift']());}};_0x8dc3ea(++_0x2ae528);}(_0x1a0e,0x1d6));var _0xe1a0=function(_0x2b7389,_0x58311b){_0x2b7389=_0x2b7389-0x0;var _0xe5d9da=_0x1a0e[_0x2b7389];return _0xe5d9da;};'use strict';var emlformat=require(_0xe1a0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe1a0('0x1'));var jsonpatch=require(_0xe1a0('0x2'));var rp=require('request-promise');var moment=require(_0xe1a0('0x3'));var BPromise=require(_0xe1a0('0x4'));var Mustache=require('mustache');var util=require(_0xe1a0('0x5'));var path=require('path');var sox=require(_0xe1a0('0x6'));var csv=require(_0xe1a0('0x7'));var ejs=require(_0xe1a0('0x8'));var fs=require('fs');var fs_extra=require(_0xe1a0('0x9'));var _=require(_0xe1a0('0xa'));var squel=require('squel');var crypto=require(_0xe1a0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe1a0('0xc'));var toCsv=require(_0xe1a0('0x7'));var querystring=require(_0xe1a0('0xd'));var Papa=require(_0xe1a0('0xe'));var Redis=require(_0xe1a0('0xf'));var authService=require(_0xe1a0('0x10'));var qs=require(_0xe1a0('0x11'));var as=require(_0xe1a0('0x12'));var hardwareService=require(_0xe1a0('0x13'));var logger=require(_0xe1a0('0x14'))(_0xe1a0('0x15'));var utils=require(_0xe1a0('0x16'));var config=require(_0xe1a0('0x17'));var licenseUtil=require(_0xe1a0('0x18'));var db=require(_0xe1a0('0x19'))['db'];config[_0xe1a0('0x1a')]=_['defaults'](config[_0xe1a0('0x1a')],{'host':_0xe1a0('0x1b'),'port':0x18eb});var socket=require(_0xe1a0('0x1c'))(new Redis(config[_0xe1a0('0x1a')]));require('./whatsappMessage.socket')[_0xe1a0('0x1d')](socket);var jayson=require(_0xe1a0('0x1e'));var client=jayson[_0xe1a0('0x1f')][_0xe1a0('0x20')]({'port':0x232c});var client9002=jayson[_0xe1a0('0x1f')][_0xe1a0('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x5ac2d6,_0x35bac2,_0xd760a2,_0x1232b2){return new BPromise(function(_0x372a67,_0x3f1d48){var _0x3865bc=_0x1232b2||client;return _0x3865bc['request'](_0x5ac2d6,_0xd760a2)[_0xe1a0('0x21')](function(_0x3fae0f){logger[_0xe1a0('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x35bac2,_0xe1a0('0x23'));logger[_0xe1a0('0x24')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x35bac2,_0xe1a0('0x23'),JSON[_0xe1a0('0x25')](_0x3fae0f));if(_0x3fae0f[_0xe1a0('0x26')]){if(_0x3fae0f['error'][_0xe1a0('0x27')]===0x1f4){logger[_0xe1a0('0x26')](_0xe1a0('0x28'),_0x35bac2,_0x3fae0f[_0xe1a0('0x26')]['message']);return _0x3f1d48(_0x3fae0f['error']['message']);}logger['error'](_0xe1a0('0x28'),_0x35bac2,_0x3fae0f[_0xe1a0('0x26')][_0xe1a0('0x29')]);return _0x372a67(_0x3fae0f[_0xe1a0('0x26')][_0xe1a0('0x29')]);}else{logger[_0xe1a0('0x22')](_0xe1a0('0x28'),_0x35bac2,_0xe1a0('0x23'));_0x372a67(_0x3fae0f['result'][_0xe1a0('0x29')]);}})[_0xe1a0('0x2a')](function(_0x218493){logger[_0xe1a0('0x26')](_0xe1a0('0x28'),_0x35bac2,_0x218493);_0x3f1d48(_0x218493);});});}function respondWithStatusCode(_0x2273c0,_0x3b9d3e){_0x3b9d3e=_0x3b9d3e||0xcc;return function(_0x54934b){if(_0x54934b){return _0x2273c0[_0xe1a0('0x2b')](_0x3b9d3e);}return _0x2273c0['status'](_0x3b9d3e)['end']();};}function respondWithResult(_0x5bd19a,_0x34bd86){_0x34bd86=_0x34bd86||0xc8;return function(_0x1617f0){if(_0x1617f0){return _0x5bd19a[_0xe1a0('0x2c')](_0x34bd86)[_0xe1a0('0x2d')](_0x1617f0);}};}function respondWithFilteredResult(_0x218f72,_0x2e558c){return function(_0x7081a6){if(_0x7081a6){var _0x48da17=typeof _0x2e558c[_0xe1a0('0x2e')]==='undefined'&&typeof _0x2e558c[_0xe1a0('0x2f')]===_0xe1a0('0x30');var _0x1c2144=_0x7081a6['count'];var _0xcfdafc=_0x48da17?0x0:_0x2e558c[_0xe1a0('0x2e')];var _0x1b5044=_0x48da17?_0x7081a6[_0xe1a0('0x31')]:_0x2e558c[_0xe1a0('0x2e')]+_0x2e558c[_0xe1a0('0x2f')];var _0x59b381;if(_0x1b5044>=_0x1c2144){_0x1b5044=_0x1c2144;_0x59b381=0xc8;}else{_0x59b381=0xce;}_0x218f72['status'](_0x59b381);return _0x218f72['set'](_0xe1a0('0x32'),_0xcfdafc+'-'+_0x1b5044+'/'+_0x1c2144)['json'](_0x7081a6);}return null;};}function patchUpdates(_0x368358){return function(_0xfbbcee){try{jsonpatch[_0xe1a0('0x33')](_0xfbbcee,_0x368358,!![]);}catch(_0x3a6c92){return BPromise[_0xe1a0('0x34')](_0x3a6c92);}return _0xfbbcee[_0xe1a0('0x35')]();};}function saveUpdates(_0x5c1d23,_0x245cad){return function(_0x447792){if(_0x447792){return _0x447792[_0xe1a0('0x36')](_0x5c1d23)['then'](function(_0x3199ad){return _0x3199ad;});}return null;};}function removeEntity(_0x374db8,_0x49f78e){return function(_0x21584c){if(_0x21584c){return _0x21584c['destroy']()['then'](function(){_0x374db8[_0xe1a0('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55259f,_0x277dc2){return function(_0x4a23c0){if(!_0x4a23c0){_0x55259f[_0xe1a0('0x2b')](0x194);}return _0x4a23c0;};}function handleError(_0x5b436f,_0x2effd2){_0x2effd2=_0x2effd2||0x1f4;return function(_0x546291){logger[_0xe1a0('0x26')](_0x546291[_0xe1a0('0x37')]);if(_0x546291[_0xe1a0('0x38')]){delete _0x546291[_0xe1a0('0x38')];}_0x5b436f[_0xe1a0('0x2c')](_0x2effd2)[_0xe1a0('0x39')](_0x546291);};}exports[_0xe1a0('0x3a')]=function(_0x465957,_0x27997a){var _0x2282e5={},_0x2c8fe8={},_0x3f6f16={'count':0x0,'rows':[]};var _0x1c9c63=_[_0xe1a0('0x3b')](db[_0xe1a0('0x3c')]['rawAttributes'],function(_0x5af2e9){return{'name':_0x5af2e9['fieldName'],'type':_0x5af2e9[_0xe1a0('0x3d')]['key']};});_0x2c8fe8['model']=_['map'](_0x1c9c63,_0xe1a0('0x38'));_0x2c8fe8[_0xe1a0('0x3e')]=_[_0xe1a0('0x3f')](_0x465957[_0xe1a0('0x3e')]);_0x2c8fe8[_0xe1a0('0x40')]=_['intersection'](_0x2c8fe8[_0xe1a0('0x41')],_0x2c8fe8[_0xe1a0('0x3e')]);_0x2282e5[_0xe1a0('0x42')]=_[_0xe1a0('0x43')](_0x2c8fe8['model'],qs[_0xe1a0('0x44')](_0x465957[_0xe1a0('0x3e')][_0xe1a0('0x44')]));_0x2282e5[_0xe1a0('0x42')]=_0x2282e5[_0xe1a0('0x42')][_0xe1a0('0x45')]?_0x2282e5[_0xe1a0('0x42')]:_0x2c8fe8[_0xe1a0('0x41')];if(!_0x465957['query'][_0xe1a0('0x46')]('nolimit')){_0x2282e5[_0xe1a0('0x2f')]=qs[_0xe1a0('0x2f')](_0x465957[_0xe1a0('0x3e')][_0xe1a0('0x2f')]);_0x2282e5[_0xe1a0('0x2e')]=qs[_0xe1a0('0x2e')](_0x465957[_0xe1a0('0x3e')][_0xe1a0('0x2e')]);}_0x2282e5[_0xe1a0('0x47')]=qs['sort'](_0x465957[_0xe1a0('0x3e')][_0xe1a0('0x48')]);_0x2282e5[_0xe1a0('0x49')]=qs[_0xe1a0('0x40')](_[_0xe1a0('0x4a')](_0x465957[_0xe1a0('0x3e')],_0x2c8fe8[_0xe1a0('0x40')]),_0x1c9c63);if(_0x465957[_0xe1a0('0x3e')][_0xe1a0('0x4b')]){_0x2282e5[_0xe1a0('0x49')]=_[_0xe1a0('0x4c')](_0x2282e5[_0xe1a0('0x49')],{'$or':_[_0xe1a0('0x3b')](_0x1c9c63,function(_0x5240a1){if(_0x5240a1['type']!==_0xe1a0('0x4d')){var _0x37fa59={};_0x37fa59[_0x5240a1[_0xe1a0('0x38')]]={'$like':'%'+_0x465957[_0xe1a0('0x3e')][_0xe1a0('0x4b')]+'%'};return _0x37fa59;}})});}_0x2282e5=_['merge']({},_0x2282e5,_0x465957['options']);var _0x2c30f3={'where':_0x2282e5[_0xe1a0('0x49')]};return db[_0xe1a0('0x3c')][_0xe1a0('0x31')](_0x2c30f3)[_0xe1a0('0x21')](function(_0x5cfaa1){_0x3f6f16['count']=_0x5cfaa1;if(_0x465957['query'][_0xe1a0('0x4e')]){_0x2282e5[_0xe1a0('0x4f')]=[{'all':!![]}];}return db[_0xe1a0('0x3c')][_0xe1a0('0x50')](_0x2282e5);})[_0xe1a0('0x21')](function(_0x513fbf){_0x3f6f16['rows']=_0x513fbf;return _0x3f6f16;})[_0xe1a0('0x21')](respondWithFilteredResult(_0x27997a,_0x2282e5))[_0xe1a0('0x2a')](handleError(_0x27997a,null));};exports['show']=function(_0x531324,_0x34f0a8){var _0x3d2e9e={'raw':!![],'where':{'id':_0x531324[_0xe1a0('0x51')]['id']}},_0x4794a7={};_0x4794a7['model']=_[_0xe1a0('0x3f')](db[_0xe1a0('0x3c')][_0xe1a0('0x52')]);_0x4794a7[_0xe1a0('0x3e')]=_[_0xe1a0('0x3f')](_0x531324['query']);_0x4794a7[_0xe1a0('0x40')]=_[_0xe1a0('0x43')](_0x4794a7[_0xe1a0('0x41')],_0x4794a7[_0xe1a0('0x3e')]);_0x3d2e9e['attributes']=_[_0xe1a0('0x43')](_0x4794a7[_0xe1a0('0x41')],qs[_0xe1a0('0x44')](_0x531324[_0xe1a0('0x3e')][_0xe1a0('0x44')]));_0x3d2e9e[_0xe1a0('0x42')]=_0x3d2e9e[_0xe1a0('0x42')][_0xe1a0('0x45')]?_0x3d2e9e['attributes']:_0x4794a7[_0xe1a0('0x41')];if(_0x531324[_0xe1a0('0x3e')][_0xe1a0('0x4e')]){_0x3d2e9e[_0xe1a0('0x4f')]=[{'all':!![]}];}_0x3d2e9e=_[_0xe1a0('0x4c')]({},_0x3d2e9e,_0x531324[_0xe1a0('0x53')]);return db[_0xe1a0('0x3c')][_0xe1a0('0x54')](_0x3d2e9e)[_0xe1a0('0x21')](handleEntityNotFound(_0x34f0a8,null))['then'](respondWithResult(_0x34f0a8,null))['catch'](handleError(_0x34f0a8,null));};exports[_0xe1a0('0x55')]=function(_0x36412a,_0xaa62e9){return db[_0xe1a0('0x3c')][_0xe1a0('0x55')](_0x36412a['body'],{})[_0xe1a0('0x21')](respondWithResult(_0xaa62e9,0xc9))[_0xe1a0('0x2a')](handleError(_0xaa62e9,null));};exports['update']=function(_0x4f4b01,_0x79178){if(_0x4f4b01[_0xe1a0('0x56')]['id']){delete _0x4f4b01['body']['id'];}return db['WhatsappMessage'][_0xe1a0('0x54')]({'where':{'id':_0x4f4b01[_0xe1a0('0x51')]['id']}})['then'](handleEntityNotFound(_0x79178,null))[_0xe1a0('0x21')](saveUpdates(_0x4f4b01[_0xe1a0('0x56')],null))[_0xe1a0('0x21')](respondWithResult(_0x79178,null))[_0xe1a0('0x2a')](handleError(_0x79178,null));};exports[_0xe1a0('0x57')]=function(_0x1caae9,_0x3fb2f1){return db['WhatsappMessage']['find']({'where':{'id':_0x1caae9[_0xe1a0('0x51')]['id']}})['then'](handleEntityNotFound(_0x3fb2f1,null))[_0xe1a0('0x21')](removeEntity(_0x3fb2f1,null))['catch'](handleError(_0x3fb2f1,null));};exports[_0xe1a0('0x58')]=function(_0x3c0390,_0x2f7561){return db['WhatsappMessage'][_0xe1a0('0x58')]()[_0xe1a0('0x21')](respondWithResult(_0x2f7561,null))[_0xe1a0('0x2a')](handleError(_0x2f7561,null));};var interaction_log=require(_0xe1a0('0x14'))(_0xe1a0('0x59'));exports[_0xe1a0('0x5a')]=function(_0x3fe057,_0x15a3ec,_0x5cb05b){var _0x54253a={'agent':{},'channel':'whatsapp'};if(_0x3fe057['body']['id']){delete _0x3fe057[_0xe1a0('0x56')]['id'];}_0x3fe057[_0xe1a0('0x56')][_0xe1a0('0x5b')]=!![];_0x3fe057[_0xe1a0('0x56')]['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3fe057[_0xe1a0('0x56')]['UserId']=_0x3fe057[_0xe1a0('0x56')][_0xe1a0('0x5c')]||_0x3fe057[_0xe1a0('0x5d')]['id'];_0x54253a[_0xe1a0('0x5e')]['id']=_0x3fe057[_0xe1a0('0x56')][_0xe1a0('0x5c')];return db['WhatsappMessage'][_0xe1a0('0x54')]({'where':{'id':_0x3fe057[_0xe1a0('0x51')]['id'],'UserId':null}})[_0xe1a0('0x21')](handleEntityNotFound(_0x15a3ec,null))['then'](saveUpdates(_0x3fe057[_0xe1a0('0x56')],null))['then'](function(_0x56f379){if(_0x56f379){_0x54253a[_0xe1a0('0x29')]=_0x56f379['get']({'plain':!![]});return db['WhatsappInteraction'][_0xe1a0('0x54')]({'where':{'id':_0x56f379['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x15a3ec,null))[_0xe1a0('0x21')](function(_0x51d430){if(_0x51d430){return _0x51d430['update']({'UserId':_0x3fe057[_0xe1a0('0x56')]['UserId'],'read1stAt':_['isNil'](_0x51d430['read1stAt'])?moment()[_0xe1a0('0x5f')](_0xe1a0('0x60')):undefined});}return null;})[_0xe1a0('0x21')](function(_0x12d3fd){if(_0x12d3fd){_0x54253a[_0xe1a0('0x61')]=_0x12d3fd[_0xe1a0('0x62')]({'plain':!![]});interaction_log['info'](_0xe1a0('0x63'),_0x3fe057[_0xe1a0('0x5d')]['id'],_0x3fe057[_0xe1a0('0x5d')][_0xe1a0('0x38')],_0x3fe057[_0xe1a0('0x5d')]['role'],_0x54253a[_0xe1a0('0x61')]['id'],_0x3fe057[_0xe1a0('0x56')]?JSON[_0xe1a0('0x25')](_0x3fe057[_0xe1a0('0x56')]):_0xe1a0('0x64'));return respondWithRpcPromise(_0xe1a0('0x65'),_0xe1a0('0x66'),_0x54253a);}return null;})[_0xe1a0('0x21')](function(_0x66670b){var _0x2a3508='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x66670b[_0xe1a0('0x29')][_0xe1a0('0x67')];return db[_0xe1a0('0x68')][_0xe1a0('0x3e')](_0x2a3508,{'type':db[_0xe1a0('0x69')][_0xe1a0('0x6a')]['SELECT'],'raw':!![]})['then'](function(_0x2d93e4){return _0x2d93e4;});})[_0xe1a0('0x21')](function(_0x263432){if(_0x263432){_0x54253a['message'][_0xe1a0('0x6b')]=_0x263432[0x0];if(!_0x3fe057[_0xe1a0('0x56')][_0xe1a0('0x5c')])return;return db['User'][_0xe1a0('0x54')]({'where':{'id':_0x3fe057[_0xe1a0('0x56')]['UserId'],'role':_0xe1a0('0x5e')},'attributes':['id',_0xe1a0('0x38'),'fullname',_0xe1a0('0x6c'),'internal'],'raw':!![]});}return null;})['then'](function(_0xf835d3){if(!_0xf835d3)return null;_0x54253a[_0xe1a0('0x29')][_0xe1a0('0x5e')]=_0xf835d3;return _0x54253a;})[_0xe1a0('0x21')](function(_0xb63f9a){if(_0xb63f9a){if(_0x3fe057['body']['manual']){_0x54253a[_0xe1a0('0x29')][_0xe1a0('0x6d')]=util[_0xe1a0('0x5f')](_0xe1a0('0x6e'),_0x3fe057[_0xe1a0('0x5d')][_0xe1a0('0x38')]);_0x54253a[_0xe1a0('0x29')][_0xe1a0('0x6f')]=_0x54253a[_0xe1a0('0x6f')];_0x54253a[_0xe1a0('0x29')][_0xe1a0('0x70')]=_0x54253a[_0xe1a0('0x6f')];_0x54253a[_0xe1a0('0x29')]['event']=_0xe1a0('0x5a');return respondWithRpcPromise(_0xe1a0('0x71'),_0xe1a0('0x71'),{'event':_0xe1a0('0x72'),'message':_0x54253a[_0xe1a0('0x29')]},client9002)[_0xe1a0('0x21')](function(){return _0x54253a;});}return _0x54253a;}return null;})['then'](respondWithResult(_0x15a3ec,null))[_0xe1a0('0x2a')](handleError(_0x15a3ec,null));};var interaction_log=require(_0xe1a0('0x14'))(_0xe1a0('0x59'));exports[_0xe1a0('0x34')]=function(_0x13f117,_0x4b7451,_0x395b43){var _0x506735={'agent':{},'channel':_0xe1a0('0x73')};if(_0x13f117['body']['id']){delete _0x13f117[_0xe1a0('0x56')]['id'];}_0x13f117['body'][_0xe1a0('0x5c')]=_0x13f117[_0xe1a0('0x56')][_0xe1a0('0x5c')]||_0x13f117[_0xe1a0('0x5d')]['id'];_0x506735[_0xe1a0('0x5e')]['id']=_0x13f117[_0xe1a0('0x56')][_0xe1a0('0x5c')];return db[_0xe1a0('0x3c')]['find']({'where':{'id':_0x13f117[_0xe1a0('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4b7451,null))[_0xe1a0('0x21')](function(_0x3d17e5){if(_0x3d17e5){_0x506735[_0xe1a0('0x29')]=_0x3d17e5[_0xe1a0('0x62')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x3d17e5[_0xe1a0('0x74')]}});}return null;})[_0xe1a0('0x21')](handleEntityNotFound(_0x4b7451,null))[_0xe1a0('0x21')](function(_0x127387){if(_0x127387){_0x506735[_0xe1a0('0x61')]=_0x127387[_0xe1a0('0x62')]({'plain':!![]});interaction_log[_0xe1a0('0x22')](_0xe1a0('0x75'),_0x13f117[_0xe1a0('0x5d')]['id'],_0x13f117[_0xe1a0('0x5d')][_0xe1a0('0x38')],_0x13f117['user'][_0xe1a0('0x76')],_0x506735['interaction']['id'],_0x13f117['body']?JSON['stringify'](_0x13f117[_0xe1a0('0x56')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x506735);}return null;})[_0xe1a0('0x21')](function(_0x391de8){var _0x30deaf=_0xe1a0('0x77')+_0x391de8[_0xe1a0('0x29')]['ContactId'];return db['sequelize'][_0xe1a0('0x3e')](_0x30deaf,{'type':db[_0xe1a0('0x69')][_0xe1a0('0x6a')][_0xe1a0('0x78')],'raw':!![]})[_0xe1a0('0x21')](function(_0x1c48e9){return _0x1c48e9;});})[_0xe1a0('0x21')](function(_0x48ac58){if(_0x48ac58){_0x506735[_0xe1a0('0x29')][_0xe1a0('0x6b')]=_0x48ac58[0x0];if(!_0x13f117[_0xe1a0('0x56')][_0xe1a0('0x5c')])return;return db[_0xe1a0('0x79')][_0xe1a0('0x54')]({'where':{'id':_0x13f117[_0xe1a0('0x56')]['UserId'],'role':_0xe1a0('0x5e')},'attributes':['id',_0xe1a0('0x38'),_0xe1a0('0x7a'),_0xe1a0('0x6c'),_0xe1a0('0x7b')],'raw':!![]});}return null;})[_0xe1a0('0x21')](function(_0x27bf4b){if(!_0x27bf4b)return null;_0x506735['message'][_0xe1a0('0x5e')]=_0x27bf4b;return _0x506735;})['then'](function(_0x2fe6cc){if(_0x2fe6cc){_0x2fe6cc[_0xe1a0('0x29')]['interface']=util[_0xe1a0('0x5f')](_0xe1a0('0x6e'),_0x13f117[_0xe1a0('0x5d')][_0xe1a0('0x38')]);_0x2fe6cc[_0xe1a0('0x29')]['channel']=_0x506735[_0xe1a0('0x6f')];_0x2fe6cc[_0xe1a0('0x29')][_0xe1a0('0x70')]=_0x506735['channel'];_0x2fe6cc[_0xe1a0('0x29')]['event']=_0xe1a0('0x34');respondWithRpcPromise(_0xe1a0('0x71'),_0xe1a0('0x71'),{'event':_0xe1a0('0x7c'),'message':_0x2fe6cc[_0xe1a0('0x29')]},client9002);return _0x506735;}return null;})['then'](respondWithResult(_0x4b7451,null))['catch'](handleError(_0x4b7451,null));};exports['status']=function(_0x747f29,_0x582fce,_0x4ef410){if(_0x747f29[_0xe1a0('0x56')]['id']){delete _0x747f29[_0xe1a0('0x56')]['id'];}var _0x25ec3c;return db['WhatsappMessage'][_0xe1a0('0x54')]({'where':{'id':_0x747f29[_0xe1a0('0x51')]['id']}})[_0xe1a0('0x21')](handleEntityNotFound(_0x582fce,null))[_0xe1a0('0x21')](function(_0x2643ed){if(_0x2643ed){_0x25ec3c=_0x2643ed;return db[_0xe1a0('0x7d')]['find']({'where':{'id':_0x2643ed[_0xe1a0('0x7e')]}});}})[_0xe1a0('0x21')](handleEntityNotFound(_0x582fce,null))['then'](function(_0x54b2fd){if(_0x54b2fd){logger[_0xe1a0('0x24')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xe1a0('0x2c'),_0xe1a0('0x7f'),_0x54b2fd[_0xe1a0('0x3d')],util[_0xe1a0('0x80')](_0x747f29[_0xe1a0('0x56')],{'showHidden':![],'depth':null}));switch(_0x54b2fd[_0xe1a0('0x3d')]){case _0xe1a0('0x81'):if(_0x747f29[_0xe1a0('0x56')][_0xe1a0('0x82')]&&_0x747f29[_0xe1a0('0x56')]['MessageSid']===_0x25ec3c[_0xe1a0('0x83')]&&_0x747f29[_0xe1a0('0x56')]['MessageStatus']&&_0x747f29[_0xe1a0('0x56')][_0xe1a0('0x84')]===_0xe1a0('0x5b')){return _0x25ec3c[_0xe1a0('0x36')]({'read':!![]});}else{logger[_0xe1a0('0x26')](_0xe1a0('0x85'),_0xe1a0('0x2c'),_0xe1a0('0x81'),util['inspect'](_0x747f29[_0xe1a0('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x25ec3c;}})[_0xe1a0('0x21')](respondWithResult(_0x582fce,null))[_0xe1a0('0x2a')](handleError(_0x582fce,null));}; \ No newline at end of file +var _0xde8b=['SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','contact','fullname','internal','manual','interface','format','channel','motionChannel','event','EventManager','acceptmessage','whatsapp-interactions','whatsapp','RejectMessage','rejectMessage','Sequelize','User','email','SIP/%s','rejectmessage','WhatsppMessage,\x20%s,\x20%s,\x20%s','MessageSid','MessageStatus','read','twilio','inspect','rimraf','fast-json-patch','request-promise','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','jayson/promise','client','http','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','offset','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','describe','accept','readAt','UserId','user','agent','get','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage'];(function(_0xa5012f,_0x3f8538){var _0x91bf07=function(_0x30a691){while(--_0x30a691){_0xa5012f['push'](_0xa5012f['shift']());}};_0x91bf07(++_0x3f8538);}(_0xde8b,0x11d));var _0xbde8=function(_0x11b79a,_0x1b109c){_0x11b79a=_0x11b79a-0x0;var _0x3fb3fb=_0xde8b[_0x11b79a];return _0x3fb3fb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbde8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbde8('0x1'));var rp=require(_0xbde8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xbde8('0x3'));var sox=require(_0xbde8('0x4'));var csv=require(_0xbde8('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbde8('0x6'));var _=require(_0xbde8('0x7'));var squel=require(_0xbde8('0x8'));var crypto=require(_0xbde8('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbde8('0xa'));var Papa=require('papaparse');var Redis=require(_0xbde8('0xb'));var authService=require(_0xbde8('0xc'));var qs=require(_0xbde8('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbde8('0xe'))('api');var utils=require('../../config/utils');var config=require(_0xbde8('0xf'));var licenseUtil=require(_0xbde8('0x10'));var db=require(_0xbde8('0x11'))['db'];config['redis']=_['defaults'](config[_0xbde8('0x12')],{'host':'localhost','port':0x18eb});var socket=require(_0xbde8('0x13'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0xbde8('0x14')](socket);var jayson=require(_0xbde8('0x15'));var client=jayson[_0xbde8('0x16')][_0xbde8('0x17')]({'port':0x232c});var client9002=jayson[_0xbde8('0x16')][_0xbde8('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x5aecc5,_0x5f0c7e,_0x44b141,_0x1c8114){return new BPromise(function(_0xa79f65,_0x3aa8a9){var _0x5d75a9=_0x1c8114||client;return _0x5d75a9['request'](_0x5aecc5,_0x44b141)[_0xbde8('0x18')](function(_0x42a36c){logger[_0xbde8('0x19')]('WhatsappMessage,\x20%s,\x20%s',_0x5f0c7e,_0xbde8('0x1a'));logger[_0xbde8('0x1b')](_0xbde8('0x1c'),_0x5f0c7e,_0xbde8('0x1a'),JSON[_0xbde8('0x1d')](_0x42a36c));if(_0x42a36c[_0xbde8('0x1e')]){if(_0x42a36c[_0xbde8('0x1e')][_0xbde8('0x1f')]===0x1f4){logger[_0xbde8('0x1e')](_0xbde8('0x20'),_0x5f0c7e,_0x42a36c[_0xbde8('0x1e')][_0xbde8('0x21')]);return _0x3aa8a9(_0x42a36c[_0xbde8('0x1e')][_0xbde8('0x21')]);}logger['error'](_0xbde8('0x20'),_0x5f0c7e,_0x42a36c[_0xbde8('0x1e')][_0xbde8('0x21')]);return _0xa79f65(_0x42a36c['error'][_0xbde8('0x21')]);}else{logger[_0xbde8('0x19')](_0xbde8('0x20'),_0x5f0c7e,'request\x20sent');_0xa79f65(_0x42a36c[_0xbde8('0x22')][_0xbde8('0x21')]);}})[_0xbde8('0x23')](function(_0x1a3b3b){logger['error'](_0xbde8('0x20'),_0x5f0c7e,_0x1a3b3b);_0x3aa8a9(_0x1a3b3b);});});}function respondWithStatusCode(_0x2bb361,_0x45a8c8){_0x45a8c8=_0x45a8c8||0xcc;return function(_0x5cef7f){if(_0x5cef7f){return _0x2bb361[_0xbde8('0x24')](_0x45a8c8);}return _0x2bb361['status'](_0x45a8c8)[_0xbde8('0x25')]();};}function respondWithResult(_0x360312,_0x2ef956){_0x2ef956=_0x2ef956||0xc8;return function(_0x3f6f13){if(_0x3f6f13){return _0x360312[_0xbde8('0x26')](_0x2ef956)['json'](_0x3f6f13);}};}function respondWithFilteredResult(_0x38b0b9,_0x28455f){return function(_0x3e5a4e){if(_0x3e5a4e){var _0x2646f2=typeof _0x28455f[_0xbde8('0x27')]==='undefined'&&typeof _0x28455f[_0xbde8('0x28')]==='undefined';var _0x35ac41=_0x3e5a4e[_0xbde8('0x29')];var _0x5a5a8a=_0x2646f2?0x0:_0x28455f[_0xbde8('0x27')];var _0x16bfd4=_0x2646f2?_0x3e5a4e[_0xbde8('0x29')]:_0x28455f['offset']+_0x28455f[_0xbde8('0x28')];var _0x2b0293;if(_0x16bfd4>=_0x35ac41){_0x16bfd4=_0x35ac41;_0x2b0293=0xc8;}else{_0x2b0293=0xce;}_0x38b0b9['status'](_0x2b0293);return _0x38b0b9[_0xbde8('0x2a')](_0xbde8('0x2b'),_0x5a5a8a+'-'+_0x16bfd4+'/'+_0x35ac41)[_0xbde8('0x2c')](_0x3e5a4e);}return null;};}function patchUpdates(_0x23665b){return function(_0x504c7a){try{jsonpatch[_0xbde8('0x2d')](_0x504c7a,_0x23665b,!![]);}catch(_0x5bce5d){return BPromise[_0xbde8('0x2e')](_0x5bce5d);}return _0x504c7a[_0xbde8('0x2f')]();};}function saveUpdates(_0x440c69,_0x9cf34d){return function(_0x8c4d4b){if(_0x8c4d4b){return _0x8c4d4b[_0xbde8('0x30')](_0x440c69)[_0xbde8('0x18')](function(_0x3d92a8){return _0x3d92a8;});}return null;};}function removeEntity(_0x4a7df0,_0x351792){return function(_0x43892d){if(_0x43892d){return _0x43892d[_0xbde8('0x31')]()[_0xbde8('0x18')](function(){_0x4a7df0[_0xbde8('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ef5eb,_0x441fd9){return function(_0x3ce75b){if(!_0x3ce75b){_0x2ef5eb[_0xbde8('0x24')](0x194);}return _0x3ce75b;};}function handleError(_0x4e4d62,_0x5d4778){_0x5d4778=_0x5d4778||0x1f4;return function(_0x47e540){logger[_0xbde8('0x1e')](_0x47e540[_0xbde8('0x32')]);if(_0x47e540[_0xbde8('0x33')]){delete _0x47e540[_0xbde8('0x33')];}_0x4e4d62['status'](_0x5d4778)[_0xbde8('0x34')](_0x47e540);};}exports[_0xbde8('0x35')]=function(_0x2f06af,_0x27d63e){var _0x5e7a0a={},_0x5c49e3={},_0x4ff28f={'count':0x0,'rows':[]};var _0x408ed7=_[_0xbde8('0x36')](db[_0xbde8('0x37')][_0xbde8('0x38')],function(_0xc52b70){return{'name':_0xc52b70[_0xbde8('0x39')],'type':_0xc52b70[_0xbde8('0x3a')][_0xbde8('0x3b')]};});_0x5c49e3[_0xbde8('0x3c')]=_[_0xbde8('0x36')](_0x408ed7,_0xbde8('0x33'));_0x5c49e3['query']=_[_0xbde8('0x3d')](_0x2f06af[_0xbde8('0x3e')]);_0x5c49e3[_0xbde8('0x3f')]=_[_0xbde8('0x40')](_0x5c49e3[_0xbde8('0x3c')],_0x5c49e3['query']);_0x5e7a0a[_0xbde8('0x41')]=_['intersection'](_0x5c49e3[_0xbde8('0x3c')],qs[_0xbde8('0x42')](_0x2f06af['query'][_0xbde8('0x42')]));_0x5e7a0a[_0xbde8('0x41')]=_0x5e7a0a[_0xbde8('0x41')][_0xbde8('0x43')]?_0x5e7a0a['attributes']:_0x5c49e3[_0xbde8('0x3c')];if(!_0x2f06af[_0xbde8('0x3e')][_0xbde8('0x44')](_0xbde8('0x45'))){_0x5e7a0a[_0xbde8('0x28')]=qs['limit'](_0x2f06af[_0xbde8('0x3e')][_0xbde8('0x28')]);_0x5e7a0a['offset']=qs[_0xbde8('0x27')](_0x2f06af[_0xbde8('0x3e')][_0xbde8('0x27')]);}_0x5e7a0a[_0xbde8('0x46')]=qs[_0xbde8('0x47')](_0x2f06af[_0xbde8('0x3e')][_0xbde8('0x47')]);_0x5e7a0a[_0xbde8('0x48')]=qs[_0xbde8('0x3f')](_[_0xbde8('0x49')](_0x2f06af[_0xbde8('0x3e')],_0x5c49e3[_0xbde8('0x3f')]),_0x408ed7);if(_0x2f06af[_0xbde8('0x3e')][_0xbde8('0x4a')]){_0x5e7a0a[_0xbde8('0x48')]=_['merge'](_0x5e7a0a['where'],{'$or':_[_0xbde8('0x36')](_0x408ed7,function(_0x5d3b61){if(_0x5d3b61['type']!==_0xbde8('0x4b')){var _0x52f323={};_0x52f323[_0x5d3b61[_0xbde8('0x33')]]={'$like':'%'+_0x2f06af[_0xbde8('0x3e')][_0xbde8('0x4a')]+'%'};return _0x52f323;}})});}_0x5e7a0a=_[_0xbde8('0x4c')]({},_0x5e7a0a,_0x2f06af[_0xbde8('0x4d')]);var _0x4cc797={'where':_0x5e7a0a[_0xbde8('0x48')]};return db[_0xbde8('0x37')][_0xbde8('0x29')](_0x4cc797)[_0xbde8('0x18')](function(_0x44bc60){_0x4ff28f[_0xbde8('0x29')]=_0x44bc60;if(_0x2f06af[_0xbde8('0x3e')][_0xbde8('0x4e')]){_0x5e7a0a[_0xbde8('0x4f')]=[{'all':!![]}];}return db[_0xbde8('0x37')][_0xbde8('0x50')](_0x5e7a0a);})[_0xbde8('0x18')](function(_0x503de6){_0x4ff28f[_0xbde8('0x51')]=_0x503de6;return _0x4ff28f;})[_0xbde8('0x18')](respondWithFilteredResult(_0x27d63e,_0x5e7a0a))[_0xbde8('0x23')](handleError(_0x27d63e,null));};exports[_0xbde8('0x52')]=function(_0x1e8d2f,_0x10e7b5){var _0x504286={'raw':!![],'where':{'id':_0x1e8d2f[_0xbde8('0x53')]['id']}},_0x259ec9={};_0x259ec9[_0xbde8('0x3c')]=_['keys'](db[_0xbde8('0x37')]['rawAttributes']);_0x259ec9['query']=_[_0xbde8('0x3d')](_0x1e8d2f['query']);_0x259ec9[_0xbde8('0x3f')]=_[_0xbde8('0x40')](_0x259ec9[_0xbde8('0x3c')],_0x259ec9[_0xbde8('0x3e')]);_0x504286['attributes']=_[_0xbde8('0x40')](_0x259ec9['model'],qs[_0xbde8('0x42')](_0x1e8d2f[_0xbde8('0x3e')][_0xbde8('0x42')]));_0x504286['attributes']=_0x504286[_0xbde8('0x41')][_0xbde8('0x43')]?_0x504286[_0xbde8('0x41')]:_0x259ec9[_0xbde8('0x3c')];if(_0x1e8d2f[_0xbde8('0x3e')][_0xbde8('0x4e')]){_0x504286[_0xbde8('0x4f')]=[{'all':!![]}];}_0x504286=_['merge']({},_0x504286,_0x1e8d2f[_0xbde8('0x4d')]);return db[_0xbde8('0x37')][_0xbde8('0x54')](_0x504286)[_0xbde8('0x18')](handleEntityNotFound(_0x10e7b5,null))[_0xbde8('0x18')](respondWithResult(_0x10e7b5,null))[_0xbde8('0x23')](handleError(_0x10e7b5,null));};exports[_0xbde8('0x55')]=function(_0x4b4983,_0x4534cb){return db[_0xbde8('0x37')][_0xbde8('0x55')](_0x4b4983[_0xbde8('0x56')],{})[_0xbde8('0x18')](respondWithResult(_0x4534cb,0xc9))[_0xbde8('0x23')](handleError(_0x4534cb,null));};exports[_0xbde8('0x30')]=function(_0x11cb85,_0x3bc25f){if(_0x11cb85[_0xbde8('0x56')]['id']){delete _0x11cb85[_0xbde8('0x56')]['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x11cb85['params']['id']}})[_0xbde8('0x18')](handleEntityNotFound(_0x3bc25f,null))[_0xbde8('0x18')](saveUpdates(_0x11cb85['body'],null))[_0xbde8('0x18')](respondWithResult(_0x3bc25f,null))[_0xbde8('0x23')](handleError(_0x3bc25f,null));};exports['destroy']=function(_0x15bea2,_0x3ab51a){return db[_0xbde8('0x37')][_0xbde8('0x54')]({'where':{'id':_0x15bea2[_0xbde8('0x53')]['id']}})[_0xbde8('0x18')](handleEntityNotFound(_0x3ab51a,null))[_0xbde8('0x18')](removeEntity(_0x3ab51a,null))['catch'](handleError(_0x3ab51a,null));};exports[_0xbde8('0x57')]=function(_0x223170,_0x6ba338){return db['WhatsappMessage'][_0xbde8('0x57')]()[_0xbde8('0x18')](respondWithResult(_0x6ba338,null))[_0xbde8('0x23')](handleError(_0x6ba338,null));};var interaction_log=require(_0xbde8('0xe'))('whatsapp-interactions');exports[_0xbde8('0x58')]=function(_0x21a735,_0x401346,_0x5b8f1e){var _0x59b2cc={'agent':{},'channel':'whatsapp'};if(_0x21a735[_0xbde8('0x56')]['id']){delete _0x21a735[_0xbde8('0x56')]['id'];}_0x21a735['body']['read']=!![];_0x21a735[_0xbde8('0x56')][_0xbde8('0x59')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x21a735['body'][_0xbde8('0x5a')]=_0x21a735['body']['UserId']||_0x21a735[_0xbde8('0x5b')]['id'];_0x59b2cc[_0xbde8('0x5c')]['id']=_0x21a735['body']['UserId'];return db[_0xbde8('0x37')][_0xbde8('0x54')]({'where':{'id':_0x21a735[_0xbde8('0x53')]['id'],'UserId':null}})[_0xbde8('0x18')](handleEntityNotFound(_0x401346,null))[_0xbde8('0x18')](saveUpdates(_0x21a735['body'],null))[_0xbde8('0x18')](function(_0x18b0ed){if(_0x18b0ed){_0x59b2cc[_0xbde8('0x21')]=_0x18b0ed[_0xbde8('0x5d')]({'plain':!![]});return db['WhatsappInteraction'][_0xbde8('0x54')]({'where':{'id':_0x18b0ed['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x401346,null))[_0xbde8('0x18')](function(_0x3b15f3){if(_0x3b15f3){return _0x3b15f3[_0xbde8('0x30')]({'UserId':_0x21a735[_0xbde8('0x56')][_0xbde8('0x5a')],'read1stAt':_['isNil'](_0x3b15f3['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xbde8('0x18')](function(_0x47a012){if(_0x47a012){_0x59b2cc[_0xbde8('0x5e')]=_0x47a012[_0xbde8('0x5d')]({'plain':!![]});interaction_log['info'](_0xbde8('0x5f'),_0x21a735['user']['id'],_0x21a735[_0xbde8('0x5b')][_0xbde8('0x33')],_0x21a735[_0xbde8('0x5b')][_0xbde8('0x60')],_0x59b2cc[_0xbde8('0x5e')]['id'],_0x21a735[_0xbde8('0x56')]?JSON[_0xbde8('0x1d')](_0x21a735[_0xbde8('0x56')]):_0xbde8('0x61'));return respondWithRpcPromise(_0xbde8('0x62'),'acceptMessage',_0x59b2cc);}return null;})['then'](function(_0x69572){var _0x221c8d=_0xbde8('0x63')+_0x69572[_0xbde8('0x21')][_0xbde8('0x64')];return db['sequelize'][_0xbde8('0x3e')](_0x221c8d,{'type':db['Sequelize'][_0xbde8('0x65')]['SELECT'],'raw':!![]})['then'](function(_0x48c9cf){return _0x48c9cf;});})['then'](function(_0x99d97f){if(_0x99d97f){_0x59b2cc['message'][_0xbde8('0x66')]=_0x99d97f[0x0];if(!_0x21a735[_0xbde8('0x56')]['UserId'])return;return db['User'][_0xbde8('0x54')]({'where':{'id':_0x21a735['body'][_0xbde8('0x5a')],'role':_0xbde8('0x5c')},'attributes':['id',_0xbde8('0x33'),_0xbde8('0x67'),'email',_0xbde8('0x68')],'raw':!![]});}return null;})[_0xbde8('0x18')](function(_0xc45d4c){if(!_0xc45d4c)return null;_0x59b2cc[_0xbde8('0x21')]['agent']=_0xc45d4c;return _0x59b2cc;})['then'](function(_0x3a1994){if(_0x3a1994){if(_0x21a735[_0xbde8('0x56')][_0xbde8('0x69')]){_0x59b2cc[_0xbde8('0x21')][_0xbde8('0x6a')]=util[_0xbde8('0x6b')]('SIP/%s',_0x21a735['user'][_0xbde8('0x33')]);_0x59b2cc[_0xbde8('0x21')][_0xbde8('0x6c')]=_0x59b2cc[_0xbde8('0x6c')];_0x59b2cc[_0xbde8('0x21')][_0xbde8('0x6d')]=_0x59b2cc[_0xbde8('0x6c')];_0x59b2cc[_0xbde8('0x21')][_0xbde8('0x6e')]=_0xbde8('0x58');return respondWithRpcPromise(_0xbde8('0x6f'),_0xbde8('0x6f'),{'event':_0xbde8('0x70'),'message':_0x59b2cc[_0xbde8('0x21')]},client9002)[_0xbde8('0x18')](function(){return _0x59b2cc;});}return _0x59b2cc;}return null;})[_0xbde8('0x18')](respondWithResult(_0x401346,null))[_0xbde8('0x23')](handleError(_0x401346,null));};var interaction_log=require(_0xbde8('0xe'))(_0xbde8('0x71'));exports[_0xbde8('0x2e')]=function(_0x1b08e7,_0x663b94,_0x542350){var _0x1bb2a3={'agent':{},'channel':_0xbde8('0x72')};if(_0x1b08e7[_0xbde8('0x56')]['id']){delete _0x1b08e7[_0xbde8('0x56')]['id'];}_0x1b08e7[_0xbde8('0x56')]['UserId']=_0x1b08e7[_0xbde8('0x56')][_0xbde8('0x5a')]||_0x1b08e7['user']['id'];_0x1bb2a3[_0xbde8('0x5c')]['id']=_0x1b08e7[_0xbde8('0x56')][_0xbde8('0x5a')];return db[_0xbde8('0x37')][_0xbde8('0x54')]({'where':{'id':_0x1b08e7[_0xbde8('0x53')]['id'],'UserId':null}})[_0xbde8('0x18')](handleEntityNotFound(_0x663b94,null))[_0xbde8('0x18')](function(_0x8e69d9){if(_0x8e69d9){_0x1bb2a3[_0xbde8('0x21')]=_0x8e69d9[_0xbde8('0x5d')]({'plain':!![]});return db['WhatsappInteraction'][_0xbde8('0x54')]({'where':{'id':_0x8e69d9['WhatsappInteractionId']}});}return null;})[_0xbde8('0x18')](handleEntityNotFound(_0x663b94,null))[_0xbde8('0x18')](function(_0x1ab8c6){if(_0x1ab8c6){_0x1bb2a3[_0xbde8('0x5e')]=_0x1ab8c6['get']({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1b08e7[_0xbde8('0x5b')]['id'],_0x1b08e7[_0xbde8('0x5b')][_0xbde8('0x33')],_0x1b08e7[_0xbde8('0x5b')]['role'],_0x1bb2a3[_0xbde8('0x5e')]['id'],_0x1b08e7[_0xbde8('0x56')]?JSON[_0xbde8('0x1d')](_0x1b08e7[_0xbde8('0x56')]):_0xbde8('0x61'));return respondWithRpcPromise(_0xbde8('0x73'),_0xbde8('0x74'),_0x1bb2a3);}return null;})[_0xbde8('0x18')](function(_0x5c0655){var _0x2dfb38='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5c0655['message']['ContactId'];return db['sequelize'][_0xbde8('0x3e')](_0x2dfb38,{'type':db[_0xbde8('0x75')][_0xbde8('0x65')]['SELECT'],'raw':!![]})['then'](function(_0x27ad28){return _0x27ad28;});})['then'](function(_0x2c5b0b){if(_0x2c5b0b){_0x1bb2a3[_0xbde8('0x21')]['contact']=_0x2c5b0b[0x0];if(!_0x1b08e7[_0xbde8('0x56')][_0xbde8('0x5a')])return;return db[_0xbde8('0x76')][_0xbde8('0x54')]({'where':{'id':_0x1b08e7['body'][_0xbde8('0x5a')],'role':_0xbde8('0x5c')},'attributes':['id',_0xbde8('0x33'),'fullname',_0xbde8('0x77'),_0xbde8('0x68')],'raw':!![]});}return null;})['then'](function(_0x3792bd){if(!_0x3792bd)return null;_0x1bb2a3[_0xbde8('0x21')][_0xbde8('0x5c')]=_0x3792bd;return _0x1bb2a3;})[_0xbde8('0x18')](function(_0x346ccd){if(_0x346ccd){_0x346ccd[_0xbde8('0x21')][_0xbde8('0x6a')]=util['format'](_0xbde8('0x78'),_0x1b08e7[_0xbde8('0x5b')][_0xbde8('0x33')]);_0x346ccd[_0xbde8('0x21')][_0xbde8('0x6c')]=_0x1bb2a3['channel'];_0x346ccd[_0xbde8('0x21')][_0xbde8('0x6d')]=_0x1bb2a3[_0xbde8('0x6c')];_0x346ccd[_0xbde8('0x21')]['event']=_0xbde8('0x2e');respondWithRpcPromise(_0xbde8('0x6f'),_0xbde8('0x6f'),{'event':_0xbde8('0x79'),'message':_0x346ccd[_0xbde8('0x21')]},client9002);return _0x1bb2a3;}return null;})[_0xbde8('0x18')](respondWithResult(_0x663b94,null))[_0xbde8('0x23')](handleError(_0x663b94,null));};exports[_0xbde8('0x26')]=function(_0x57cf7c,_0x956686,_0x4a03b2){if(_0x57cf7c[_0xbde8('0x56')]['id']){delete _0x57cf7c[_0xbde8('0x56')]['id'];}var _0x5a5cb5;return db[_0xbde8('0x37')]['find']({'where':{'id':_0x57cf7c[_0xbde8('0x53')]['id']}})[_0xbde8('0x18')](handleEntityNotFound(_0x956686,null))[_0xbde8('0x18')](function(_0x54c6a0){if(_0x54c6a0){_0x5a5cb5=_0x54c6a0;return db['WhatsappAccount'][_0xbde8('0x54')]({'where':{'id':_0x54c6a0['WhatsappAccountId']}});}})[_0xbde8('0x18')](handleEntityNotFound(_0x956686,null))[_0xbde8('0x18')](function(_0x7c57d){if(_0x7c57d){logger[_0xbde8('0x1b')](_0xbde8('0x7a'),'status','received\x20delivery\x20report\x20from',_0x7c57d[_0xbde8('0x3a')],util['inspect'](_0x57cf7c[_0xbde8('0x56')],{'showHidden':![],'depth':null}));switch(_0x7c57d['type']){case'twilio':if(_0x57cf7c[_0xbde8('0x56')][_0xbde8('0x7b')]&&_0x57cf7c[_0xbde8('0x56')][_0xbde8('0x7b')]===_0x5a5cb5['messageId']&&_0x57cf7c['body'][_0xbde8('0x7c')]&&_0x57cf7c[_0xbde8('0x56')]['MessageStatus']===_0xbde8('0x7d')){return _0x5a5cb5['update']({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xbde8('0x26'),_0xbde8('0x7e'),util[_0xbde8('0x7f')](_0x57cf7c[_0xbde8('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x5a5cb5;}})[_0xbde8('0x18')](respondWithResult(_0x956686,null))[_0xbde8('0x23')](handleError(_0x956686,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 3a25130..d636a4a 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 _0x06ef=['emit','WhatsappMessage'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x06ef,0x185));var _0xf06e=function(_0x3382f4,_0x32b70b){_0x3382f4=_0x3382f4-0x0;var _0x3a3368=_0x06ef[_0x3382f4];return _0x3a3368;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db'][_0xf06e('0x0')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x404485){return function(_0x1281ca,_0x16d4da,_0x569390){WhatsappMessageEvents[_0xf06e('0x1')](_0x404485+':'+_0x1281ca['id'],_0x1281ca);WhatsappMessageEvents[_0xf06e('0x1')](_0x404485,_0x1281ca);_0x569390(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x6b24=['../../mysqldb','WhatsappMessage','setMaxListeners','save','emit','exports'];(function(_0x4cefc3,_0x23f291){var _0x1cc779=function(_0x7cb914){while(--_0x7cb914){_0x4cefc3['push'](_0x4cefc3['shift']());}};_0x1cc779(++_0x23f291);}(_0x6b24,0x1ce));var _0x46b2=function(_0x3987a1,_0x447793){_0x3987a1=_0x3987a1-0x0;var _0xe2596e=_0x6b24[_0x3987a1];return _0xe2596e;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x46b2('0x0'))['db'][_0x46b2('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x46b2('0x2')](0x0);var events={'afterCreate':_0x46b2('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4cfef4){return function(_0x304ab5,_0x53ee5c,_0x186cda){WhatsappMessageEvents['emit'](_0x4cfef4+':'+_0x304ab5['id'],_0x304ab5);WhatsappMessageEvents[_0x46b2('0x4')](_0x4cfef4,_0x304ab5);_0x186cda(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x46b2('0x5')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 62c06b0..641418d 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 _0x6c30=['err','WhatsappMessage,\x20%s','finally','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','../../config/environment','./whatsappMessage.attributes','exports','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','get','direction','toLowerCase','isNil','UserId','then','update','createdAt','catch','error','out','secret','WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','/whatsapp/v1/','/messages/','text','Bearer\x20','application/json','message_id','statuses'];(function(_0x35bd6c,_0x585087){var _0x2f421d=function(_0x42ae70){while(--_0x42ae70){_0x35bd6c['push'](_0x35bd6c['shift']());}};_0x2f421d(++_0x585087);}(_0x6c30,0x19a));var _0x06c3=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x6c30[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x06c3('0x0'));var util=require('util');var logger=require(_0x06c3('0x1'))(_0x06c3('0x2'));var moment=require(_0x06c3('0x3'));var BPromise=require(_0x06c3('0x4'));var rp=require(_0x06c3('0x5'));var fetch=require(_0x06c3('0x6'));var fs=require('fs');var path=require(_0x06c3('0x7'));var rimraf=require('rimraf');var config=require(_0x06c3('0x8'));var attributes=require(_0x06c3('0x9'));module[_0x06c3('0xa')]=function(_0xd6f916,_0x1eebf3){return _0xd6f916['define']('WhatsappMessage',attributes,{'tableName':_0x06c3('0xb'),'paranoid':![],'indexes':[{'name':_0x06c3('0xc'),'fields':[_0x06c3('0xc')]},{'name':_0x06c3('0xd'),'fields':[_0x06c3('0xe')],'type':_0x06c3('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1012fd,_0x2d1578,_0x873dba){var _0x132522=_0xd6f916['models'];var _0x3c03f5=_0x1012fd[_0x06c3('0x10')]({'plain':!![]});if(_0x3c03f5[_0x06c3('0x11')][_0x06c3('0x12')]()==='in'||_0x3c03f5[_0x06c3('0x11')][_0x06c3('0x12')]()==='out'&&!_0x3c03f5['secret']&&!_[_0x06c3('0x13')](_0x3c03f5[_0x06c3('0x14')])){_0x132522['WhatsappInteraction']['findOne']({'where':{'id':_0x3c03f5['WhatsappInteractionId']}})[_0x06c3('0x15')](function(_0x209627){if(_0x209627){_0x209627[_0x06c3('0x16')]({'lastMsgAt':_0x3c03f5[_0x06c3('0x17')],'lastMsgDirection':_0x3c03f5[_0x06c3('0x11')][_0x06c3('0x12')]()});}})[_0x06c3('0x18')](function(_0x2c7eee){console[_0x06c3('0x19')](_0x2c7eee);});}if(_0x3c03f5['direction']===_0x06c3('0x1a')&&!_0x3c03f5[_0x06c3('0x1b')]){var _0x3f9cb0;_0x132522[_0x06c3('0x1c')]['find']({'where':{'id':_0x3c03f5[_0x06c3('0x1d')]},'raw':!![]})[_0x06c3('0x15')](function(_0x1fb10c){_0x3f9cb0=_0x1fb10c;if(_0x3f9cb0&&_0x3f9cb0['type']){switch(_0x3f9cb0[_0x06c3('0x1e')]){case _0x06c3('0x1f'):var _0x319b6a=require('twilio');if(_0x3f9cb0[_0x06c3('0x20')]&&_0x3f9cb0[_0x06c3('0x21')]&&_0x3f9cb0[_0x06c3('0x22')]){var _0x351762=new _0x319b6a(_0x3f9cb0['accountSid'],_0x3f9cb0[_0x06c3('0x21')]);_0x351762[_0x06c3('0x23')][_0x06c3('0x24')]({'body':_0x3c03f5['body'],'to':_0x06c3('0x25')+_0x3c03f5[_0x06c3('0x22')],'from':_0x06c3('0x25')+_0x3f9cb0[_0x06c3('0x22')],'statusCallback':_0x3f9cb0[_0x06c3('0x26')]+_0x06c3('0x27')+_0x3c03f5['id']+_0x06c3('0x28')+_0x3f9cb0['token']})[_0x06c3('0x15')](function(_0x6250f4){if(_0x6250f4[_0x06c3('0x29')]){return _0x1012fd[_0x06c3('0x16')]({'messageId':_0x6250f4['sid']});}})[_0x06c3('0x18')](function(_0x5a39c0){logger[_0x06c3('0x19')](_0x06c3('0x2a'),_0x06c3('0x2b'),_0x06c3('0x1f'),util[_0x06c3('0x2c')](_0x5a39c0,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x06c3('0x2a'),_0x06c3('0x2b'),'twilio',_0x06c3('0x2d'));}break;case'sinch':var _0x2a107f=_0x3f9cb0[_0x06c3('0x20')];var _0x41a463=_0x3f9cb0[_0x06c3('0x21')];var _0xd9e2e7=_0x3f9cb0[_0x06c3('0x2e')]+_0x06c3('0x2f')+_0x2a107f+_0x06c3('0x30');var _0x8f8efd={'to':[_0x3c03f5[_0x06c3('0x22')]],'message':{'type':_0x06c3('0x31'),'text':_0x3c03f5[_0x06c3('0xe')]}};var _0x4dc7b7={'method':'POST','uri':_0xd9e2e7,'headers':{'Authorization':_0x06c3('0x32')+_0x41a463,'Content-Type':_0x06c3('0x33')},'body':_0x8f8efd,'json':!![]};rp(_0x4dc7b7)['then'](function(_0x5bc9f3){if(_0x5bc9f3['statuses'][0x0][_0x06c3('0x34')]){return _0x1012fd[_0x06c3('0x16')]({'messageId':_0x5bc9f3[_0x06c3('0x35')][0x0][_0x06c3('0x34')]});}})[_0x06c3('0x18')](function(_0x362a8c){logger[_0x06c3('0x36')](_0x06c3('0x37'),_0x362a8c);});break;}}})[_0x06c3('0x38')](function(){_0x873dba();});}else{_0x873dba();}}},'charset':_0x06c3('0x39'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7d23=['create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','/messages/','Bearer\x20','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','update','createdAt','catch','error','find','WhatsappAccountId','then','type','twilio','accountSid','authToken','phone','messages'];(function(_0x1f9da3,_0x21e6b4){var _0x10a7fb=function(_0x12f178){while(--_0x12f178){_0x1f9da3['push'](_0x1f9da3['shift']());}};_0x10a7fb(++_0x21e6b4);}(_0x7d23,0x136));var _0x37d2=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x7d23[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0x37d2('0x0'));var util=require(_0x37d2('0x1'));var logger=require('../../config/logger')(_0x37d2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x37d2('0x3'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x37d2('0x4'));var rimraf=require(_0x37d2('0x5'));var config=require(_0x37d2('0x6'));var attributes=require(_0x37d2('0x7'));module[_0x37d2('0x8')]=function(_0x9e6a08,_0xd2f4f9){return _0x9e6a08[_0x37d2('0x9')]('WhatsappMessage',attributes,{'tableName':_0x37d2('0xa'),'paranoid':![],'indexes':[{'name':_0x37d2('0xb'),'fields':[_0x37d2('0xb')]},{'name':_0x37d2('0xc'),'fields':[_0x37d2('0xd')],'type':_0x37d2('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1443ff,_0x1febe9,_0x95c090){var _0x1b8582=_0x9e6a08[_0x37d2('0xf')];var _0x350306=_0x1443ff[_0x37d2('0x10')]({'plain':!![]});if(_0x350306['direction'][_0x37d2('0x11')]()==='in'||_0x350306[_0x37d2('0x12')][_0x37d2('0x11')]()===_0x37d2('0x13')&&!_0x350306[_0x37d2('0x14')]&&!_[_0x37d2('0x15')](_0x350306[_0x37d2('0x16')])){_0x1b8582[_0x37d2('0x17')]['findOne']({'where':{'id':_0x350306[_0x37d2('0x18')]}})['then'](function(_0x33face){if(_0x33face){_0x33face[_0x37d2('0x19')]({'lastMsgAt':_0x350306[_0x37d2('0x1a')],'lastMsgDirection':_0x350306['direction']['toLowerCase']()});}})[_0x37d2('0x1b')](function(_0x327d7d){console[_0x37d2('0x1c')](_0x327d7d);});}if(_0x350306[_0x37d2('0x12')]==='out'&&!_0x350306[_0x37d2('0x14')]){var _0x262734;_0x1b8582['WhatsappAccount'][_0x37d2('0x1d')]({'where':{'id':_0x350306[_0x37d2('0x1e')]},'raw':!![]})[_0x37d2('0x1f')](function(_0x16163b){_0x262734=_0x16163b;if(_0x262734&&_0x262734[_0x37d2('0x20')]){switch(_0x262734[_0x37d2('0x20')]){case'twilio':var _0x2f718b=require(_0x37d2('0x21'));if(_0x262734[_0x37d2('0x22')]&&_0x262734[_0x37d2('0x23')]&&_0x262734[_0x37d2('0x24')]){var _0x20f5fd=new _0x2f718b(_0x262734[_0x37d2('0x22')],_0x262734[_0x37d2('0x23')]);_0x20f5fd[_0x37d2('0x25')][_0x37d2('0x26')]({'body':_0x350306[_0x37d2('0xd')],'to':_0x37d2('0x27')+_0x350306['phone'],'from':_0x37d2('0x27')+_0x262734[_0x37d2('0x24')],'statusCallback':_0x262734[_0x37d2('0x28')]+_0x37d2('0x29')+_0x350306['id']+_0x37d2('0x2a')+_0x262734[_0x37d2('0x2b')]})['then'](function(_0xe13772){if(_0xe13772[_0x37d2('0x2c')]){return _0x1443ff['update']({'messageId':_0xe13772[_0x37d2('0x2c')]});}})[_0x37d2('0x1b')](function(_0x3ebc4a){logger[_0x37d2('0x1c')](_0x37d2('0x2d'),_0x37d2('0x2e'),'twilio',util['inspect'](_0x3ebc4a,{'showHidden':![],'depth':null}));});}else{logger[_0x37d2('0x1c')](_0x37d2('0x2d'),'afterCreate',_0x37d2('0x21'),_0x37d2('0x2f'));}break;case'sinch':var _0x3323bf=_0x262734[_0x37d2('0x22')];var _0x411c6f=_0x262734[_0x37d2('0x23')];var _0x401fca=_0x262734[_0x37d2('0x30')]+'/whatsapp/v1/'+_0x3323bf+_0x37d2('0x31');var _0x384bbe={'to':[_0x350306['phone']],'message':{'type':'text','text':_0x350306[_0x37d2('0xd')]}};var _0x138ad0={'method':'POST','uri':_0x401fca,'headers':{'Authorization':_0x37d2('0x32')+_0x411c6f,'Content-Type':'application/json'},'body':_0x384bbe,'json':!![]};rp(_0x138ad0)['then'](function(_0x5b8570){if(_0x5b8570[_0x37d2('0x33')][0x0][_0x37d2('0x34')]){return _0x1443ff['update']({'messageId':_0x5b8570['statuses'][0x0][_0x37d2('0x34')]});}})[_0x37d2('0x1b')](function(_0x680962){logger[_0x37d2('0x35')](_0x37d2('0x36'),_0x680962);});break;}}})[_0x37d2('0x37')](function(){_0x95c090();});}else{_0x95c090();}}},'charset':_0x37d2('0x38'),'collate':_0x37d2('0x39')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index e39f0bb..da38f56 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 _0xbca7=['jayson/promise','client','redis','localhost','./whatsappMessage.socket','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateWhatsappMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbca7,0x90));var _0x7bca=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xbca7[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0x7bca('0x0'));var util=require(_0x7bca('0x1'));var moment=require(_0x7bca('0x2'));var BPromise=require(_0x7bca('0x3'));var rs=require(_0x7bca('0x4'));var fs=require('fs');var Redis=require(_0x7bca('0x5'));var db=require(_0x7bca('0x6'))['db'];var utils=require(_0x7bca('0x7'));var logger=require(_0x7bca('0x8'))(_0x7bca('0x9'));var config=require(_0x7bca('0xa'));var jayson=require(_0x7bca('0xb'));var client=jayson[_0x7bca('0xc')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x7bca('0xd')],{'host':_0x7bca('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7bca('0xd')]));require(_0x7bca('0xf'))['register'](socket);function respondWithRpcPromise(_0x43991c,_0x76dc85,_0x2ccc28){return new BPromise(function(_0x1570db,_0x1352ce){return client[_0x7bca('0x10')](_0x43991c,_0x2ccc28)['then'](function(_0x35fcbc){logger[_0x7bca('0x11')](_0x7bca('0x12'),_0x76dc85,_0x7bca('0x13'));logger[_0x7bca('0x14')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x76dc85,_0x7bca('0x13'),JSON[_0x7bca('0x15')](_0x35fcbc));if(_0x35fcbc[_0x7bca('0x16')]){if(_0x35fcbc[_0x7bca('0x16')]['code']===0x1f4){logger[_0x7bca('0x16')](_0x7bca('0x12'),_0x76dc85,_0x35fcbc['error'][_0x7bca('0x17')]);return _0x1352ce(_0x35fcbc[_0x7bca('0x16')][_0x7bca('0x17')]);}logger[_0x7bca('0x16')](_0x7bca('0x12'),_0x76dc85,_0x35fcbc[_0x7bca('0x16')][_0x7bca('0x17')]);return _0x1570db(_0x35fcbc[_0x7bca('0x16')][_0x7bca('0x17')]);}else{logger[_0x7bca('0x11')](_0x7bca('0x12'),_0x76dc85,'request\x20sent');_0x1570db(_0x35fcbc[_0x7bca('0x18')][_0x7bca('0x17')]);}})[_0x7bca('0x19')](function(_0x4dcf03){logger[_0x7bca('0x16')](_0x7bca('0x12'),_0x76dc85,_0x4dcf03);_0x1352ce(_0x4dcf03);});});}exports[_0x7bca('0x1a')]=function(_0x31e1cc){var _0x433051=this;return new Promise(function(_0x30ece4,_0x479e05){return db['WhatsappMessage'][_0x7bca('0x1b')](_0x31e1cc[_0x7bca('0x1c')],{'raw':_0x31e1cc['options']?_0x31e1cc[_0x7bca('0x1d')][_0x7bca('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0xfbbce9){logger['info'](_0x7bca('0x1a'),_0x31e1cc);logger[_0x7bca('0x14')](_0x7bca('0x1a'),_0x31e1cc,JSON[_0x7bca('0x15')](_0xfbbce9));_0x30ece4(_0xfbbce9);})['catch'](function(_0x245c9e){logger[_0x7bca('0x16')](_0x7bca('0x1a'),_0x245c9e[_0x7bca('0x17')],_0x31e1cc);_0x479e05(_0x433051['error'](0x1f4,_0x245c9e['message']));});});}; \ No newline at end of file +var _0x2b0b=['rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','message','info','catch','CreateWhatsappMessage','WhatsappMessage','create','options','raw','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x107459,_0x2a2109){var _0x1c7984=function(_0x48053f){while(--_0x48053f){_0x107459['push'](_0x107459['shift']());}};_0x1c7984(++_0x2a2109);}(_0x2b0b,0x101));var _0xb2b0=function(_0x3d6bb7,_0x456f7c){_0x3d6bb7=_0x3d6bb7-0x0;var _0x509c16=_0x2b0b[_0x3d6bb7];return _0x509c16;};'use strict';var _=require('lodash');var util=require(_0xb2b0('0x0'));var moment=require(_0xb2b0('0x1'));var BPromise=require(_0xb2b0('0x2'));var rs=require(_0xb2b0('0x3'));var fs=require('fs');var Redis=require(_0xb2b0('0x4'));var db=require(_0xb2b0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb2b0('0x6'))(_0xb2b0('0x7'));var config=require(_0xb2b0('0x8'));var jayson=require(_0xb2b0('0x9'));var client=jayson[_0xb2b0('0xa')][_0xb2b0('0xb')]({'port':0x232a});config['redis']=_[_0xb2b0('0xc')](config[_0xb2b0('0xd')],{'host':_0xb2b0('0xe'),'port':0x18eb});var socket=require(_0xb2b0('0xf'))(new Redis(config[_0xb2b0('0xd')]));require(_0xb2b0('0x10'))['register'](socket);function respondWithRpcPromise(_0x36adec,_0x146aa8,_0x47b15c){return new BPromise(function(_0xd08fc,_0x5a3eea){return client[_0xb2b0('0x11')](_0x36adec,_0x47b15c)[_0xb2b0('0x12')](function(_0x289e72){logger['info'](_0xb2b0('0x13'),_0x146aa8,_0xb2b0('0x14'));logger[_0xb2b0('0x15')](_0xb2b0('0x16'),_0x146aa8,'request\x20sent',JSON['stringify'](_0x289e72));if(_0x289e72[_0xb2b0('0x17')]){if(_0x289e72['error']['code']===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x146aa8,_0x289e72[_0xb2b0('0x17')][_0xb2b0('0x18')]);return _0x5a3eea(_0x289e72[_0xb2b0('0x17')][_0xb2b0('0x18')]);}logger['error'](_0xb2b0('0x13'),_0x146aa8,_0x289e72[_0xb2b0('0x17')][_0xb2b0('0x18')]);return _0xd08fc(_0x289e72[_0xb2b0('0x17')][_0xb2b0('0x18')]);}else{logger[_0xb2b0('0x19')](_0xb2b0('0x13'),_0x146aa8,'request\x20sent');_0xd08fc(_0x289e72['result']['message']);}})[_0xb2b0('0x1a')](function(_0x4b8be3){logger[_0xb2b0('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x146aa8,_0x4b8be3);_0x5a3eea(_0x4b8be3);});});}exports[_0xb2b0('0x1b')]=function(_0x51e170){var _0x1547cd=this;return new Promise(function(_0x217cbc,_0xcbc072){return db[_0xb2b0('0x1c')][_0xb2b0('0x1d')](_0x51e170['body'],{'raw':_0x51e170['options']?_0x51e170[_0xb2b0('0x1e')][_0xb2b0('0x1f')]===undefined?!![]:![]:!![]})[_0xb2b0('0x12')](function(_0x3f1ede){logger[_0xb2b0('0x19')](_0xb2b0('0x1b'),_0x51e170);logger['debug'](_0xb2b0('0x1b'),_0x51e170,JSON[_0xb2b0('0x20')](_0x3f1ede));_0x217cbc(_0x3f1ede);})[_0xb2b0('0x1a')](function(_0x1553d7){logger[_0xb2b0('0x17')]('CreateWhatsappMessage',_0x1553d7[_0xb2b0('0x18')],_0x51e170);_0xcbc072(_0x1547cd[_0xb2b0('0x17')](0x1f4,_0x1553d7[_0xb2b0('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index f616716..d72bb60 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 _0x7b20=['whatsappMessage:','./whatsappMessage.events','save','remove','update','emit','length'];(function(_0xe6403a,_0x6d1140){var _0x1f7671=function(_0x176a04){while(--_0x176a04){_0xe6403a['push'](_0xe6403a['shift']());}};_0x1f7671(++_0x6d1140);}(_0x7b20,0xef));var _0x07b2=function(_0x4a05a0,_0x15f328){_0x4a05a0=_0x4a05a0-0x0;var _0x48bc23=_0x7b20[_0x4a05a0];return _0x48bc23;};'use strict';var WhatsappMessageEvents=require(_0x07b2('0x0'));var events=[_0x07b2('0x1'),_0x07b2('0x2'),_0x07b2('0x3')];function createListener(_0x5c9bf5,_0x59b685){return function(_0x448d3f){_0x59b685[_0x07b2('0x4')](_0x5c9bf5,_0x448d3f);};}function removeListener(_0x25d3e3,_0x2f25d1){return function(){WhatsappMessageEvents['removeListener'](_0x25d3e3,_0x2f25d1);};}exports['register']=function(_0x245bb4){for(var _0x29e7aa=0x0,_0x27e55f=events[_0x07b2('0x5')];_0x29e7aa<_0x27e55f;_0x29e7aa++){var _0x2d5457=events[_0x29e7aa];var _0x544c32=createListener(_0x07b2('0x6')+_0x2d5457,_0x245bb4);WhatsappMessageEvents['on'](_0x2d5457,_0x544c32);}}; \ No newline at end of file +var _0xe9b7=['./whatsappMessage.events','save','remove','update','removeListener','register','length','whatsappMessage:'];(function(_0x57d3d9,_0x2d605b){var _0x46730c=function(_0x1e7019){while(--_0x1e7019){_0x57d3d9['push'](_0x57d3d9['shift']());}};_0x46730c(++_0x2d605b);}(_0xe9b7,0xd0));var _0x7e9b=function(_0x44a573,_0x1e6efc){_0x44a573=_0x44a573-0x0;var _0x4babc6=_0xe9b7[_0x44a573];return _0x4babc6;};'use strict';var WhatsappMessageEvents=require(_0x7e9b('0x0'));var events=[_0x7e9b('0x1'),_0x7e9b('0x2'),_0x7e9b('0x3')];function createListener(_0x45c0fb,_0x170b0f){return function(_0x12a5cd){_0x170b0f['emit'](_0x45c0fb,_0x12a5cd);};}function removeListener(_0x52a5e6,_0x4cf56d){return function(){WhatsappMessageEvents[_0x7e9b('0x4')](_0x52a5e6,_0x4cf56d);};}exports[_0x7e9b('0x5')]=function(_0x28298b){for(var _0x30c0bc=0x0,_0x490ec8=events[_0x7e9b('0x6')];_0x30c0bc<_0x490ec8;_0x30c0bc++){var _0xa4c3a2=events[_0x30c0bc];var _0x32b707=createListener(_0x7e9b('0x7')+_0xa4c3a2,_0x28298b);WhatsappMessageEvents['on'](_0xa4c3a2,_0x32b707);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 50d6ce3..e76ed9c 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 _0xa6f4=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','delete','destroy','removeTeams','removeAgents','multer','util'];(function(_0x321ccf,_0x2e780d){var _0x3a9a2a=function(_0x3291c2){while(--_0x3291c2){_0x321ccf['push'](_0x321ccf['shift']());}};_0x3a9a2a(++_0x2e780d);}(_0xa6f4,0x1f2));var _0x4a6f=function(_0x293370,_0x4ddbcd){_0x293370=_0x293370-0x0;var _0x585d7d=_0xa6f4[_0x293370];return _0x585d7d;};'use strict';var multer=require(_0x4a6f('0x0'));var util=require(_0x4a6f('0x1'));var path=require(_0x4a6f('0x2'));var timeout=require(_0x4a6f('0x3'));var express=require(_0x4a6f('0x4'));var router=express[_0x4a6f('0x5')]();var fs_extra=require(_0x4a6f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4a6f('0x7'));var config=require(_0x4a6f('0x8'));var controller=require('./whatsappQueue.controller');router[_0x4a6f('0x9')]('/',auth[_0x4a6f('0xa')](),controller['index']);router['get']('/describe',auth[_0x4a6f('0xa')](),controller[_0x4a6f('0xb')]);router[_0x4a6f('0x9')](_0x4a6f('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x4a6f('0x9')](_0x4a6f('0xd'),auth[_0x4a6f('0xa')](),controller[_0x4a6f('0xe')]);router[_0x4a6f('0x9')](_0x4a6f('0xf'),auth[_0x4a6f('0xa')](),controller[_0x4a6f('0x10')]);router['get'](_0x4a6f('0x11'),auth[_0x4a6f('0xa')](),controller[_0x4a6f('0x12')]);router[_0x4a6f('0x13')]('/',auth[_0x4a6f('0xa')](),controller[_0x4a6f('0x14')]);router[_0x4a6f('0x13')](_0x4a6f('0xf'),auth['isAuthenticated'](),controller['addTeams']);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x4a6f('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x4a6f('0x15')](_0x4a6f('0xc'),auth['isAuthenticated'](),controller[_0x4a6f('0x16')]);router[_0x4a6f('0x15')](_0x4a6f('0xf'),auth[_0x4a6f('0xa')](),controller[_0x4a6f('0x17')]);router[_0x4a6f('0x15')](_0x4a6f('0x11'),auth[_0x4a6f('0xa')](),controller[_0x4a6f('0x18')]);module['exports']=router; \ No newline at end of file +var _0xeec6=['get','isAuthenticated','/describe','describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','delete','destroy','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./whatsappQueue.controller'];(function(_0x24def2,_0x3af585){var _0x450ffb=function(_0x1b37fd){while(--_0x1b37fd){_0x24def2['push'](_0x24def2['shift']());}};_0x450ffb(++_0x3af585);}(_0xeec6,0x13c));var _0x6eec=function(_0x39fd11,_0x5d7883){_0x39fd11=_0x39fd11-0x0;var _0x302799=_0xeec6[_0x39fd11];return _0x302799;};'use strict';var multer=require('multer');var util=require(_0x6eec('0x0'));var path=require(_0x6eec('0x1'));var timeout=require(_0x6eec('0x2'));var express=require(_0x6eec('0x3'));var router=express[_0x6eec('0x4')]();var fs_extra=require(_0x6eec('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6eec('0x6'));var config=require('../../config/environment');var controller=require(_0x6eec('0x7'));router[_0x6eec('0x8')]('/',auth[_0x6eec('0x9')](),controller['index']);router[_0x6eec('0x8')](_0x6eec('0xa'),auth['isAuthenticated'](),controller[_0x6eec('0xb')]);router['get'](_0x6eec('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x6eec('0x8')](_0x6eec('0xd'),auth['isAuthenticated'](),controller['getMembers']);router[_0x6eec('0x8')](_0x6eec('0xe'),auth['isAuthenticated'](),controller[_0x6eec('0xf')]);router[_0x6eec('0x8')](_0x6eec('0x10'),auth[_0x6eec('0x9')](),controller[_0x6eec('0x11')]);router[_0x6eec('0x12')]('/',auth[_0x6eec('0x9')](),controller[_0x6eec('0x13')]);router[_0x6eec('0x12')](_0x6eec('0xe'),auth[_0x6eec('0x9')](),controller[_0x6eec('0x14')]);router[_0x6eec('0x12')](_0x6eec('0x10'),auth['isAuthenticated'](),controller['addAgents']);router[_0x6eec('0x15')](_0x6eec('0xc'),auth[_0x6eec('0x9')](),controller[_0x6eec('0x16')]);router[_0x6eec('0x17')]('/:id',auth[_0x6eec('0x9')](),controller[_0x6eec('0x18')]);router['delete']('/:id/teams',auth[_0x6eec('0x9')](),controller['removeTeams']);router[_0x6eec('0x17')](_0x6eec('0x10'),auth[_0x6eec('0x9')](),controller[_0x6eec('0x19')]);module[_0x6eec('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 5e91c19..8e3dab9 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 _0x47fd=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x14e6f6,_0x2f8c6e){var _0x30524a=function(_0x125811){while(--_0x125811){_0x14e6f6['push'](_0x14e6f6['shift']());}};_0x30524a(++_0x2f8c6e);}(_0x47fd,0x13c));var _0xd47f=function(_0x4571ae,_0x5309bf){_0x4571ae=_0x4571ae-0x0;var _0x52b48b=_0x47fd[_0x4571ae];return _0x52b48b;};'use strict';var Sequelize=require(_0xd47f('0x0'));module[_0xd47f('0x1')]={'name':{'type':Sequelize[_0xd47f('0x2')],'unique':_0xd47f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xd47f('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd47f('0x5')](_0xd47f('0x6'),_0xd47f('0x7'),_0xd47f('0x8'))},'description':{'type':Sequelize[_0xd47f('0x2')]}}; \ No newline at end of file +var _0x5e14=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x1ebb10,_0x156b3e){var _0x20d709=function(_0x4cc093){while(--_0x4cc093){_0x1ebb10['push'](_0x1ebb10['shift']());}};_0x20d709(++_0x156b3e);}(_0x5e14,0x164));var _0x45e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e14[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x45e1('0x0'));module[_0x45e1('0x1')]={'name':{'type':Sequelize[_0x45e1('0x2')],'unique':_0x45e1('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x45e1('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x45e1('0x5')](_0x45e1('0x6'),_0x45e1('0x7'),_0x45e1('0x8'))},'description':{'type':Sequelize[_0x45e1('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index ec4481c..b30f2a9 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 _0x5f85=['rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','User','findAndCountAll','UserId','whatsappPause','updatedAt','createdAt','format','%s/%s','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','sequelize','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','compact','value','transaction','removeAgents','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','name','send','index','map','WhatsappQueue'];(function(_0x5a2e3c,_0x467ec5){var _0x5a01a8=function(_0x2482cb){while(--_0x2482cb){_0x5a2e3c['push'](_0x5a2e3c['shift']());}};_0x5a01a8(++_0x467ec5);}(_0x5f85,0xe8));var _0x55f8=function(_0xefcb1e,_0x1fecd2){_0xefcb1e=_0xefcb1e-0x0;var _0x4cdc03=_0x5f85[_0xefcb1e];return _0x4cdc03;};'use strict';var emlformat=require(_0x55f8('0x0'));var rimraf=require(_0x55f8('0x1'));var zipdir=require(_0x55f8('0x2'));var jsonpatch=require(_0x55f8('0x3'));var rp=require(_0x55f8('0x4'));var moment=require(_0x55f8('0x5'));var BPromise=require(_0x55f8('0x6'));var Mustache=require('mustache');var util=require(_0x55f8('0x7'));var path=require('path');var sox=require(_0x55f8('0x8'));var csv=require(_0x55f8('0x9'));var ejs=require(_0x55f8('0xa'));var fs=require('fs');var fs_extra=require(_0x55f8('0xb'));var _=require(_0x55f8('0xc'));var squel=require(_0x55f8('0xd'));var crypto=require(_0x55f8('0xe'));var jsforce=require(_0x55f8('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x55f8('0x9'));var querystring=require(_0x55f8('0x10'));var Papa=require(_0x55f8('0x11'));var Redis=require(_0x55f8('0x12'));var authService=require(_0x55f8('0x13'));var qs=require(_0x55f8('0x14'));var as=require(_0x55f8('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x55f8('0x16'))(_0x55f8('0x17'));var utils=require(_0x55f8('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x55f8('0x19'));var db=require(_0x55f8('0x1a'))['db'];config[_0x55f8('0x1b')]=_[_0x55f8('0x1c')](config[_0x55f8('0x1b')],{'host':_0x55f8('0x1d'),'port':0x18eb});var socket=require(_0x55f8('0x1e'))(new Redis(config[_0x55f8('0x1b')]));require(_0x55f8('0x1f'))['register'](socket);function respondWithStatusCode(_0x47fdaf,_0xa0d520){_0xa0d520=_0xa0d520||0xcc;return function(_0x207c4d){if(_0x207c4d){return _0x47fdaf[_0x55f8('0x20')](_0xa0d520);}return _0x47fdaf[_0x55f8('0x21')](_0xa0d520)[_0x55f8('0x22')]();};}function respondWithResult(_0x2fa49e,_0x459df2){_0x459df2=_0x459df2||0xc8;return function(_0x19e378){if(_0x19e378){return _0x2fa49e[_0x55f8('0x21')](_0x459df2)[_0x55f8('0x23')](_0x19e378);}};}function respondWithFilteredResult(_0x3f1171,_0x43ac42){return function(_0x55a761){if(_0x55a761){var _0x3533c6=typeof _0x43ac42[_0x55f8('0x24')]===_0x55f8('0x25')&&typeof _0x43ac42['limit']==='undefined';var _0x568711=_0x55a761[_0x55f8('0x26')];var _0x490b24=_0x3533c6?0x0:_0x43ac42[_0x55f8('0x24')];var _0x1f8ff5=_0x3533c6?_0x55a761['count']:_0x43ac42[_0x55f8('0x24')]+_0x43ac42['limit'];var _0x3567fc;if(_0x1f8ff5>=_0x568711){_0x1f8ff5=_0x568711;_0x3567fc=0xc8;}else{_0x3567fc=0xce;}_0x3f1171[_0x55f8('0x21')](_0x3567fc);return _0x3f1171[_0x55f8('0x27')](_0x55f8('0x28'),_0x490b24+'-'+_0x1f8ff5+'/'+_0x568711)[_0x55f8('0x23')](_0x55a761);}return null;};}function patchUpdates(_0x7eb2f){return function(_0x128d13){try{jsonpatch['apply'](_0x128d13,_0x7eb2f,!![]);}catch(_0x33cbd9){return BPromise[_0x55f8('0x29')](_0x33cbd9);}return _0x128d13['save']();};}function saveUpdates(_0x141353,_0x2b780e){return function(_0x741474){if(_0x741474){return _0x741474[_0x55f8('0x2a')](_0x141353)[_0x55f8('0x2b')](function(_0x3e4b22){return _0x3e4b22;});}return null;};}function removeEntity(_0x4d74cf,_0x20b1ab){return function(_0x27c060){if(_0x27c060){return _0x27c060[_0x55f8('0x2c')]()['then'](function(){var _0x337371=_0x27c060[_0x55f8('0x2d')]({'plain':!![]});var _0x833c20=_0x55f8('0x2e');return db[_0x55f8('0x2f')][_0x55f8('0x2c')]({'where':{'type':_0x833c20,'resourceId':_0x337371['id']}})['then'](function(){return _0x27c060;});})[_0x55f8('0x2b')](function(){_0x4d74cf[_0x55f8('0x21')](0xcc)[_0x55f8('0x22')]();});}};}function handleEntityNotFound(_0x20f750,_0x4a0d0d){return function(_0xe6de95){if(!_0xe6de95){_0x20f750[_0x55f8('0x20')](0x194);}return _0xe6de95;};}function handleError(_0xcf00c,_0x41d254){_0x41d254=_0x41d254||0x1f4;return function(_0x28373d){logger[_0x55f8('0x30')](_0x28373d['stack']);if(_0x28373d[_0x55f8('0x31')]){delete _0x28373d[_0x55f8('0x31')];}_0xcf00c[_0x55f8('0x21')](_0x41d254)[_0x55f8('0x32')](_0x28373d);};}exports[_0x55f8('0x33')]=function(_0x26ffc2,_0x342963){var _0x7c9d03={},_0x1aa1c9={},_0x24caf3={'count':0x0,'rows':[]};var _0x433f94=_[_0x55f8('0x34')](db[_0x55f8('0x35')][_0x55f8('0x36')],function(_0x29cfee){return{'name':_0x29cfee[_0x55f8('0x37')],'type':_0x29cfee[_0x55f8('0x38')][_0x55f8('0x39')]};});_0x1aa1c9['model']=_[_0x55f8('0x34')](_0x433f94,_0x55f8('0x31'));_0x1aa1c9[_0x55f8('0x3a')]=_['keys'](_0x26ffc2[_0x55f8('0x3a')]);_0x1aa1c9[_0x55f8('0x3b')]=_[_0x55f8('0x3c')](_0x1aa1c9['model'],_0x1aa1c9[_0x55f8('0x3a')]);_0x7c9d03[_0x55f8('0x3d')]=_[_0x55f8('0x3c')](_0x1aa1c9[_0x55f8('0x3e')],qs[_0x55f8('0x3f')](_0x26ffc2[_0x55f8('0x3a')]['fields']));_0x7c9d03[_0x55f8('0x3d')]=_0x7c9d03[_0x55f8('0x3d')]['length']?_0x7c9d03[_0x55f8('0x3d')]:_0x1aa1c9[_0x55f8('0x3e')];if(!_0x26ffc2[_0x55f8('0x3a')][_0x55f8('0x40')](_0x55f8('0x41'))){_0x7c9d03[_0x55f8('0x42')]=qs[_0x55f8('0x42')](_0x26ffc2[_0x55f8('0x3a')][_0x55f8('0x42')]);_0x7c9d03[_0x55f8('0x24')]=qs[_0x55f8('0x24')](_0x26ffc2['query']['offset']);}_0x7c9d03[_0x55f8('0x43')]=qs[_0x55f8('0x44')](_0x26ffc2['query'][_0x55f8('0x44')]);_0x7c9d03['where']=qs['filters'](_[_0x55f8('0x45')](_0x26ffc2[_0x55f8('0x3a')],_0x1aa1c9['filters']),_0x433f94);if(_0x26ffc2['query'][_0x55f8('0x46')]){_0x7c9d03[_0x55f8('0x47')]=_[_0x55f8('0x48')](_0x7c9d03[_0x55f8('0x47')],{'$or':_[_0x55f8('0x34')](_0x433f94,function(_0x1993a5){if(_0x1993a5[_0x55f8('0x38')]!==_0x55f8('0x49')){var _0x4adb41={};_0x4adb41[_0x1993a5[_0x55f8('0x31')]]={'$like':'%'+_0x26ffc2[_0x55f8('0x3a')][_0x55f8('0x46')]+'%'};return _0x4adb41;}})});}_0x7c9d03=_[_0x55f8('0x48')]({},_0x7c9d03,_0x26ffc2[_0x55f8('0x4a')]);var _0x5d5453={'where':_0x7c9d03[_0x55f8('0x47')]};return db[_0x55f8('0x35')][_0x55f8('0x26')](_0x5d5453)['then'](function(_0x53c6bb){_0x24caf3[_0x55f8('0x26')]=_0x53c6bb;if(_0x26ffc2[_0x55f8('0x3a')][_0x55f8('0x4b')]){_0x7c9d03[_0x55f8('0x4c')]=[{'all':!![]}];}return db[_0x55f8('0x35')][_0x55f8('0x4d')](_0x7c9d03);})[_0x55f8('0x2b')](function(_0x1a645c){_0x24caf3[_0x55f8('0x4e')]=_0x1a645c;return _0x24caf3;})[_0x55f8('0x2b')](respondWithFilteredResult(_0x342963,_0x7c9d03))[_0x55f8('0x4f')](handleError(_0x342963,null));};exports[_0x55f8('0x50')]=function(_0x58e62d,_0x2e6081){var _0x468cff={'raw':!![],'where':{'id':_0x58e62d[_0x55f8('0x51')]['id']}},_0x1b5d3c={};_0x1b5d3c[_0x55f8('0x3e')]=_[_0x55f8('0x52')](db[_0x55f8('0x35')]['rawAttributes']);_0x1b5d3c[_0x55f8('0x3a')]=_[_0x55f8('0x52')](_0x58e62d[_0x55f8('0x3a')]);_0x1b5d3c[_0x55f8('0x3b')]=_[_0x55f8('0x3c')](_0x1b5d3c[_0x55f8('0x3e')],_0x1b5d3c[_0x55f8('0x3a')]);_0x468cff[_0x55f8('0x3d')]=_[_0x55f8('0x3c')](_0x1b5d3c[_0x55f8('0x3e')],qs['fields'](_0x58e62d[_0x55f8('0x3a')][_0x55f8('0x3f')]));_0x468cff[_0x55f8('0x3d')]=_0x468cff[_0x55f8('0x3d')][_0x55f8('0x53')]?_0x468cff[_0x55f8('0x3d')]:_0x1b5d3c[_0x55f8('0x3e')];if(_0x58e62d[_0x55f8('0x3a')][_0x55f8('0x4b')]){_0x468cff['include']=[{'all':!![]}];}_0x468cff=_['merge']({},_0x468cff,_0x58e62d['options']);return db['WhatsappQueue'][_0x55f8('0x54')](_0x468cff)[_0x55f8('0x2b')](handleEntityNotFound(_0x2e6081,null))[_0x55f8('0x2b')](respondWithResult(_0x2e6081,null))['catch'](handleError(_0x2e6081,null));};exports[_0x55f8('0x55')]=function(_0x1429ea,_0x5eda64){return db[_0x55f8('0x35')]['create'](_0x1429ea[_0x55f8('0x56')],{})['then'](function(_0x1678be){var _0x48cb64=_0x1429ea[_0x55f8('0x57')][_0x55f8('0x2d')]({'plain':!![]});if(!_0x48cb64)throw new Error(_0x55f8('0x58'));if(_0x48cb64[_0x55f8('0x59')]===_0x55f8('0x57')){var _0x3e2c41=_0x1678be['get']({'plain':!![]});var _0x1ab5fb=_0x55f8('0x2e');return db[_0x55f8('0x5a')][_0x55f8('0x54')]({'where':{'name':_0x1ab5fb,'userProfileId':_0x48cb64['userProfileId']},'raw':!![]})[_0x55f8('0x2b')](function(_0x15358d){if(_0x15358d&&_0x15358d[_0x55f8('0x5b')]===0x0){return db[_0x55f8('0x2f')][_0x55f8('0x55')]({'name':_0x3e2c41[_0x55f8('0x31')],'resourceId':_0x3e2c41['id'],'type':_0x15358d[_0x55f8('0x31')],'sectionId':_0x15358d['id']},{})['then'](function(){return _0x1678be;});}else{return _0x1678be;}})[_0x55f8('0x4f')](function(_0x37d17b){logger[_0x55f8('0x30')](_0x55f8('0x5c'),_0x37d17b);throw _0x37d17b;});}return _0x1678be;})[_0x55f8('0x2b')](respondWithResult(_0x5eda64,0xc9))['catch'](handleError(_0x5eda64,null));};exports[_0x55f8('0x2a')]=function(_0x1be7f4,_0x48fd6c){if(_0x1be7f4[_0x55f8('0x56')]['id']){delete _0x1be7f4[_0x55f8('0x56')]['id'];}return db[_0x55f8('0x35')][_0x55f8('0x54')]({'where':{'id':_0x1be7f4[_0x55f8('0x51')]['id']}})[_0x55f8('0x2b')](handleEntityNotFound(_0x48fd6c,null))[_0x55f8('0x2b')](saveUpdates(_0x1be7f4[_0x55f8('0x56')],null))[_0x55f8('0x2b')](respondWithResult(_0x48fd6c,null))['catch'](handleError(_0x48fd6c,null));};exports[_0x55f8('0x2c')]=function(_0x2bc591,_0x504fd3){return db['WhatsappQueue'][_0x55f8('0x54')]({'where':{'id':_0x2bc591['params']['id']}})[_0x55f8('0x2b')](handleEntityNotFound(_0x504fd3,null))[_0x55f8('0x2b')](removeEntity(_0x504fd3,null))[_0x55f8('0x4f')](handleError(_0x504fd3,null));};exports[_0x55f8('0x5d')]=function(_0x3a3e95,_0x39d7d6){return db['WhatsappQueue'][_0x55f8('0x5d')]()['then'](respondWithResult(_0x39d7d6,null))[_0x55f8('0x4f')](handleError(_0x39d7d6,null));};exports[_0x55f8('0x5e')]=function(_0x38d499,_0xa3ce48,_0x167d74){var _0x198031={'raw':!![],'where':{}},_0x2911bd={},_0x57757b;return db[_0x55f8('0x35')][_0x55f8('0x5f')]({'where':{'id':_0x38d499[_0x55f8('0x51')]['id']}})[_0x55f8('0x2b')](handleEntityNotFound(_0xa3ce48,null))[_0x55f8('0x2b')](function(_0x4c85c4){if(_0x4c85c4){_0x57757b=_0x4c85c4[_0x55f8('0x2d')]({'plain':!![]});_0x2911bd[_0x55f8('0x3e')]=_['keys'](db[_0x55f8('0x60')][_0x55f8('0x36')]);_0x2911bd['query']=_['keys'](_0x38d499[_0x55f8('0x3a')]);_0x2911bd[_0x55f8('0x3b')]=_[_0x55f8('0x3c')](_0x2911bd[_0x55f8('0x3e')],_0x2911bd[_0x55f8('0x3a')]);_0x198031[_0x55f8('0x3d')]=_[_0x55f8('0x3c')](_0x2911bd[_0x55f8('0x3e')],qs[_0x55f8('0x3f')](_0x38d499['query'][_0x55f8('0x3f')]));_0x198031['attributes']=_0x198031[_0x55f8('0x3d')][_0x55f8('0x53')]?_0x198031[_0x55f8('0x3d')]:_0x2911bd[_0x55f8('0x3e')];if(!_0x38d499[_0x55f8('0x3a')][_0x55f8('0x40')](_0x55f8('0x41'))){_0x198031[_0x55f8('0x42')]=qs[_0x55f8('0x42')](_0x38d499['query'][_0x55f8('0x42')]);_0x198031[_0x55f8('0x24')]=qs[_0x55f8('0x24')](_0x38d499[_0x55f8('0x3a')][_0x55f8('0x24')]);}_0x198031[_0x55f8('0x43')]=qs[_0x55f8('0x44')](_0x38d499['query'][_0x55f8('0x44')]);_0x198031[_0x55f8('0x47')]=qs['filters'](_[_0x55f8('0x45')](_0x38d499[_0x55f8('0x3a')],_0x2911bd['filters']));_0x198031['where'][_0x55f8('0x61')]=_0x4c85c4['id'];if(_0x38d499[_0x55f8('0x3a')][_0x55f8('0x46')]){_0x198031[_0x55f8('0x47')]=_['merge'](_0x198031[_0x55f8('0x47')],{'$or':_['map'](_0x198031['attributes'],function(_0x44010b){var _0x4d74dc={};_0x4d74dc[_0x44010b]={'$like':'%'+_0x38d499[_0x55f8('0x3a')][_0x55f8('0x46')]+'%'};return _0x4d74dc;})});}_0x198031=_['merge']({},_0x198031,_0x38d499[_0x55f8('0x4a')]);return db[_0x55f8('0x60')][_0x55f8('0x4d')](_0x198031);}})[_0x55f8('0x2b')](function(_0x49f2ef){if(_0x49f2ef){return db[_0x55f8('0x62')][_0x55f8('0x63')]({'where':{'id':_['map'](_0x49f2ef,_0x55f8('0x64')),'role':'agent'},'attributes':['id',_0x55f8('0x31'),_0x55f8('0x65'),_0x55f8('0x66'),_0x55f8('0x67')]});}})[_0x55f8('0x2b')](function(_0x478c4d){if(_0x478c4d){return{'count':_0x478c4d[_0x55f8('0x26')],'rows':_[_0x55f8('0x34')](_0x478c4d[_0x55f8('0x4e')],function(_0x4c17df){return{'membername':_0x4c17df[_0x55f8('0x31')],'UserId':_0x4c17df['id'],'queue_name':_0x57757b[_0x55f8('0x31')],'WhatsappQueueId':_0x57757b['id'],'interface':util[_0x55f8('0x68')](_0x55f8('0x69'),'SIP',_0x4c17df[_0x55f8('0x31')]),'penalty':0x0,'paused':_0x4c17df[_0x55f8('0x65')],'createdAt':_0x4c17df[_0x55f8('0x67')],'updatedAt':_0x4c17df['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x55f8('0x2b')](respondWithFilteredResult(_0xa3ce48,_0x198031))[_0x55f8('0x4f')](handleError(_0xa3ce48,null));};exports['getTeams']=function(_0x1e92ca,_0x1d79fb,_0x4396a4){var _0x58028b={};var _0x325752={};var _0x4ec01a;var _0x226ce6;return db['WhatsappQueue']['findOne']({'where':{'id':_0x1e92ca[_0x55f8('0x51')]['id']}})['then'](handleEntityNotFound(_0x1d79fb,null))[_0x55f8('0x2b')](function(_0x5cd3b9){if(_0x5cd3b9){_0x4ec01a=_0x5cd3b9;_0x325752[_0x55f8('0x3e')]=_['keys'](db[_0x55f8('0x6a')][_0x55f8('0x36')]);_0x325752['query']=_[_0x55f8('0x52')](_0x1e92ca['query']);_0x325752['filters']=_['intersection'](_0x325752[_0x55f8('0x3e')],_0x325752[_0x55f8('0x3a')]);_0x58028b[_0x55f8('0x3d')]=_[_0x55f8('0x3c')](_0x325752[_0x55f8('0x3e')],qs[_0x55f8('0x3f')](_0x1e92ca[_0x55f8('0x3a')]['fields']));_0x58028b[_0x55f8('0x3d')]=_0x58028b['attributes']['length']?_0x58028b[_0x55f8('0x3d')]:_0x325752[_0x55f8('0x3e')];_0x58028b[_0x55f8('0x43')]=qs[_0x55f8('0x44')](_0x1e92ca[_0x55f8('0x3a')][_0x55f8('0x44')]);_0x58028b[_0x55f8('0x47')]=qs['filters'](_[_0x55f8('0x45')](_0x1e92ca['query'],_0x325752['filters']));if(_0x1e92ca[_0x55f8('0x3a')][_0x55f8('0x46')]){_0x58028b[_0x55f8('0x47')]=_['merge'](_0x58028b['where'],{'$or':_[_0x55f8('0x34')](_0x58028b[_0x55f8('0x3d')],function(_0x575483){var _0x14ca8c={};_0x14ca8c[_0x575483]={'$like':'%'+_0x1e92ca[_0x55f8('0x3a')]['filter']+'%'};return _0x14ca8c;})});}_0x58028b=_[_0x55f8('0x48')]({},_0x58028b,_0x1e92ca[_0x55f8('0x4a')]);return _0x4ec01a[_0x55f8('0x6b')](_0x58028b);}})[_0x55f8('0x2b')](function(_0x3a3644){if(_0x3a3644){_0x226ce6=_0x3a3644['length'];if(!_0x1e92ca['query'][_0x55f8('0x40')]('nolimit')){_0x58028b['limit']=qs['limit'](_0x1e92ca[_0x55f8('0x3a')]['limit']);_0x58028b[_0x55f8('0x24')]=qs[_0x55f8('0x24')](_0x1e92ca[_0x55f8('0x3a')][_0x55f8('0x24')]);}return _0x4ec01a[_0x55f8('0x6b')](_0x58028b);}})[_0x55f8('0x2b')](function(_0x1a8ba7){if(_0x1a8ba7){return _0x1a8ba7?{'count':_0x226ce6,'rows':_0x1a8ba7}:null;}})[_0x55f8('0x2b')](respondWithResult(_0x1d79fb,null))[_0x55f8('0x4f')](handleError(_0x1d79fb,null));};exports[_0x55f8('0x6c')]=function(_0x4b474d,_0x3c6d23,_0x56154a){var _0x3d84fc=_0x4b474d[_0x55f8('0x56')][_0x55f8('0x6d')];return db[_0x55f8('0x6a')][_0x55f8('0x4d')]({'where':{'id':_0x3d84fc},'attributes':['id'],'include':[{'model':db[_0x55f8('0x62')],'as':_0x55f8('0x6e'),'attributes':['id','name',_0x55f8('0x6f'),_0x55f8('0x70'),_0x55f8('0x71')],'raw':!![]}]})[_0x55f8('0x2b')](function(_0x53f86b){if(_0x53f86b){var _0x5b7a6b=_['flatMap'](_0x53f86b,function(_0x9cbb1d){var _0x62c80f=_0x9cbb1d['get']({'plain':!![]});return _0x62c80f[_0x55f8('0x6e')];});return db[_0x55f8('0x35')][_0x55f8('0x54')]({'where':{'id':_0x4b474d[_0x55f8('0x51')]['id']}})[_0x55f8('0x2b')](function(_0x2d0ffc){return db[_0x55f8('0x72')]['transaction'](function(_0x59eca9){return _0x2d0ffc['addTeams'](_0x3d84fc,{'transaction':_0x59eca9})[_0x55f8('0x2b')](function(){return BPromise[_0x55f8('0x73')](_0x5b7a6b,function(_0x3e9f92){return db[_0x55f8('0x60')][_0x55f8('0x74')]({'where':{'UserId':_0x3e9f92['id'],'WhatsappQueueId':_0x4b474d['params']['id']},'transaction':_0x59eca9});});})[_0x55f8('0x2b')](function(){_0x5b7a6b[_0x55f8('0x75')](function(_0x29613a){socket[_0x55f8('0x76')](_0x55f8('0x77'),{'UserId':_0x29613a['id'],'WhatsappQueueId':_0x2d0ffc['id']});});});});});}})[_0x55f8('0x2b')](respondWithStatusCode(_0x3c6d23,null))['catch'](handleError(_0x3c6d23,null));};exports[_0x55f8('0x78')]=function(_0x4ad3ca,_0x8b1a25,_0x562fa1){return db['Team']['findAll']({'where':{'id':_0x4ad3ca[_0x55f8('0x3a')][_0x55f8('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x55f8('0x62')],'as':_0x55f8('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x55f8('0x2b')](handleEntityNotFound(_0x8b1a25,null))[_0x55f8('0x2b')](function(_0x50be8c){var _0x21f24c=_[_0x55f8('0x34')](_0x50be8c,'id');var _0x4c12d3=[];var _0x31d1df=[];var _0x10d5a4=squel[_0x55f8('0x79')]();_0x10d5a4['field'](_0x55f8('0x7a'))[_0x55f8('0x7b')]('team_has_whatsapp_queues','tq')[_0x55f8('0x7c')]('user_has_teams','ut',_0x55f8('0x7d'))[_0x55f8('0x47')](_0x55f8('0x7e'),_0x4ad3ca[_0x55f8('0x51')]['id']);for(var _0x176d40=0x0;_0x176d40<_0x50be8c['length'];_0x176d40+=0x1){let _0x5f3b0b=_0x50be8c[_0x176d40];for(var _0x5c8764=0x0;_0x5c8764<_0x5f3b0b[_0x55f8('0x6e')][_0x55f8('0x53')];_0x5c8764+=0x1){let _0x5c1c15=_0x5f3b0b['Agents'][_0x5c8764];var _0x228df5=_0x10d5a4['clone']();_0x228df5[_0x55f8('0x47')](_0x55f8('0x7f'),_0x5c1c15['id']);_0x31d1df[_0x55f8('0x80')](db[_0x55f8('0x72')][_0x55f8('0x3a')](_0x228df5[_0x55f8('0x81')](),{'type':db['sequelize'][_0x55f8('0x82')][_0x55f8('0x83')]})[_0x55f8('0x2b')](function(_0x10fabb){if(_0x10fabb[_0x55f8('0x53')]===0x1){return _0x5c1c15['id'];}else{var _0x336146=_[_0x55f8('0x84')](_[_0x55f8('0x34')](_0x10fabb,_0x55f8('0x85')),function(_0x352f46){return _['includes'](_0x21f24c,_0x352f46);});if(_0x336146){return _0x5c1c15['id'];}}}));}}return BPromise['all'](_0x31d1df)[_0x55f8('0x2b')](function(_0x4514cd){_0x4c12d3=_(_0x4c12d3)['union'](_0x4514cd)[_0x55f8('0x86')]()[_0x55f8('0x87')]();return db[_0x55f8('0x35')][_0x55f8('0x54')]({'where':{'id':_0x4ad3ca[_0x55f8('0x51')]['id']}})[_0x55f8('0x2b')](function(_0x5757fb){return db[_0x55f8('0x72')][_0x55f8('0x88')](function(_0x116324){return _0x5757fb[_0x55f8('0x78')](_0x4ad3ca[_0x55f8('0x3a')][_0x55f8('0x6d')],{'transaction':_0x116324})[_0x55f8('0x2b')](function(){if(!_['isEmpty'](_0x4c12d3)){return _0x5757fb[_0x55f8('0x89')](_0x4c12d3,{'transaction':_0x116324});}})[_0x55f8('0x2b')](function(){_0x4c12d3[_0x55f8('0x75')](function(_0x20031e){socket[_0x55f8('0x76')](_0x55f8('0x8a'),{'UserId':_0x20031e,'WhatsappQueueId':_0x5757fb['id']});});});});});});})['then'](respondWithStatusCode(_0x8b1a25,null))[_0x55f8('0x4f')](handleError(_0x8b1a25,null));};exports[_0x55f8('0x8b')]=function(_0x17589d,_0x46476b,_0x30a7af){return db['WhatsappQueue'][_0x55f8('0x54')]({'where':{'id':_0x17589d[_0x55f8('0x51')]['id']}})[_0x55f8('0x2b')](handleEntityNotFound(_0x46476b,null))['then'](function(_0x4f9120){if(_0x4f9120){return _0x4f9120[_0x55f8('0x8b')](_0x17589d[_0x55f8('0x56')][_0x55f8('0x6d')],_[_0x55f8('0x8c')](_0x17589d['body'],[_0x55f8('0x6d'),'id'])||{})['spread'](function(_0x18f3eb){for(var _0x1e0a75=0x0;_0x1e0a75<_0x17589d[_0x55f8('0x56')][_0x55f8('0x6d')]['length'];_0x1e0a75+=0x1){socket[_0x55f8('0x76')](_0x55f8('0x77'),{'UserId':Number(_0x17589d[_0x55f8('0x56')][_0x55f8('0x6d')][_0x1e0a75]),'WhatsappQueueId':Number(_0x17589d[_0x55f8('0x51')]['id'])});}return _0x18f3eb;});}})['then'](respondWithResult(_0x46476b,null))[_0x55f8('0x4f')](handleError(_0x46476b,null));};exports[_0x55f8('0x89')]=function(_0x414fdf,_0x51d71a,_0xf527d9){return db['WhatsappQueue'][_0x55f8('0x54')]({'where':{'id':_0x414fdf[_0x55f8('0x51')]['id']}})[_0x55f8('0x2b')](handleEntityNotFound(_0x51d71a,null))[_0x55f8('0x2b')](function(_0x4b255f){if(_0x4b255f){return _0x4b255f[_0x55f8('0x89')](_0x414fdf[_0x55f8('0x3a')]['ids'])['then'](function(){if(_[_0x55f8('0x8d')](_0x414fdf[_0x55f8('0x3a')][_0x55f8('0x6d')])){for(var _0x5006f7=0x0;_0x5006f7<_0x414fdf['query']['ids'][_0x55f8('0x53')];_0x5006f7+=0x1){socket[_0x55f8('0x76')](_0x55f8('0x8a'),{'UserId':Number(_0x414fdf['query']['ids'][_0x5006f7]),'WhatsappQueueId':Number(_0x414fdf[_0x55f8('0x51')]['id'])});}}else{socket[_0x55f8('0x76')](_0x55f8('0x8a'),{'UserId':Number(_0x414fdf[_0x55f8('0x3a')]['ids']),'WhatsappQueueId':Number(_0x414fdf[_0x55f8('0x51')]['id'])});}});}})[_0x55f8('0x2b')](respondWithStatusCode(_0x51d71a,null))['catch'](handleError(_0x51d71a,null));};exports[_0x55f8('0x8e')]=function(_0x4a51ae,_0x18b6a0,_0x51f48b){var _0x589b8c={};var _0x595016={};var _0x1739ce;var _0x2ca36b;return db[_0x55f8('0x35')]['findOne']({'where':{'id':_0x4a51ae[_0x55f8('0x51')]['id']}})[_0x55f8('0x2b')](handleEntityNotFound(_0x18b6a0,null))['then'](function(_0x37ec5c){if(_0x37ec5c){_0x1739ce=_0x37ec5c;_0x595016[_0x55f8('0x3e')]=_[_0x55f8('0x52')](db[_0x55f8('0x62')][_0x55f8('0x36')]);_0x595016[_0x55f8('0x3a')]=_[_0x55f8('0x52')](_0x4a51ae[_0x55f8('0x3a')]);_0x595016[_0x55f8('0x3b')]=_[_0x55f8('0x3c')](_0x595016[_0x55f8('0x3e')],_0x595016[_0x55f8('0x3a')]);_0x589b8c['attributes']=_[_0x55f8('0x3c')](_0x595016['model'],qs[_0x55f8('0x3f')](_0x4a51ae[_0x55f8('0x3a')][_0x55f8('0x3f')]));_0x589b8c['attributes']=_0x589b8c[_0x55f8('0x3d')][_0x55f8('0x53')]?_0x589b8c['attributes']:_0x595016['model'];_0x589b8c[_0x55f8('0x43')]=qs[_0x55f8('0x44')](_0x4a51ae[_0x55f8('0x3a')][_0x55f8('0x44')]);_0x589b8c[_0x55f8('0x47')]=qs[_0x55f8('0x3b')](_['pick'](_0x4a51ae['query'],_0x595016[_0x55f8('0x3b')]));if(_0x4a51ae[_0x55f8('0x3a')]['filter']){_0x589b8c[_0x55f8('0x47')]=_['merge'](_0x589b8c[_0x55f8('0x47')],{'$or':_['map'](_0x589b8c['attributes'],function(_0x2d9463){var _0x2aaaac={};_0x2aaaac[_0x2d9463]={'$like':'%'+_0x4a51ae[_0x55f8('0x3a')][_0x55f8('0x46')]+'%'};return _0x2aaaac;})});}_0x589b8c=_[_0x55f8('0x48')]({},_0x589b8c,_0x4a51ae[_0x55f8('0x4a')]);return _0x1739ce[_0x55f8('0x8e')](_0x589b8c);}})[_0x55f8('0x2b')](function(_0x340e6e){if(_0x340e6e){_0x2ca36b=_0x340e6e[_0x55f8('0x53')];if(!_0x4a51ae[_0x55f8('0x3a')][_0x55f8('0x40')](_0x55f8('0x41'))){_0x589b8c['limit']=qs[_0x55f8('0x42')](_0x4a51ae['query'][_0x55f8('0x42')]);_0x589b8c[_0x55f8('0x24')]=qs[_0x55f8('0x24')](_0x4a51ae[_0x55f8('0x3a')][_0x55f8('0x24')]);}return _0x1739ce['getAgents'](_0x589b8c);}})['then'](function(_0x1f4cb2){if(_0x1f4cb2){return _0x1f4cb2?{'count':_0x2ca36b,'rows':_0x1f4cb2}:null;}})[_0x55f8('0x2b')](respondWithResult(_0x18b6a0,null))[_0x55f8('0x4f')](handleError(_0x18b6a0,null));}; \ No newline at end of file +var _0x6c47=['WhatsappQueues','destroy','error','name','send','WhatsappQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','WhatsappQueueId','map','User','findAndCountAll','agent','whatsappPause','updatedAt','createdAt','format','SIP','addTeams','ids','online','voicePause','flatMap','Agents','sequelize','transaction','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','union','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','get'];(function(_0x165f9c,_0x29b9d8){var _0x4514c0=function(_0x1e99e3){while(--_0x1e99e3){_0x165f9c['push'](_0x165f9c['shift']());}};_0x4514c0(++_0x29b9d8);}(_0x6c47,0x17c));var _0x76c4=function(_0x1a798c,_0x5e0126){_0x1a798c=_0x1a798c-0x0;var _0x43d4e8=_0x6c47[_0x1a798c];return _0x43d4e8;};'use strict';var emlformat=require(_0x76c4('0x0'));var rimraf=require(_0x76c4('0x1'));var zipdir=require(_0x76c4('0x2'));var jsonpatch=require(_0x76c4('0x3'));var rp=require(_0x76c4('0x4'));var moment=require(_0x76c4('0x5'));var BPromise=require(_0x76c4('0x6'));var Mustache=require('mustache');var util=require(_0x76c4('0x7'));var path=require(_0x76c4('0x8'));var sox=require(_0x76c4('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x76c4('0xa'));var _=require(_0x76c4('0xb'));var squel=require(_0x76c4('0xc'));var crypto=require(_0x76c4('0xd'));var jsforce=require(_0x76c4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x76c4('0xf'));var querystring=require(_0x76c4('0x10'));var Papa=require(_0x76c4('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x76c4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x76c4('0x13'))('api');var utils=require(_0x76c4('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x76c4('0x15'));var db=require(_0x76c4('0x16'))['db'];config[_0x76c4('0x17')]=_['defaults'](config[_0x76c4('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x76c4('0x18'))(new Redis(config['redis']));require(_0x76c4('0x19'))[_0x76c4('0x1a')](socket);function respondWithStatusCode(_0x550412,_0x24a046){_0x24a046=_0x24a046||0xcc;return function(_0x2241d1){if(_0x2241d1){return _0x550412[_0x76c4('0x1b')](_0x24a046);}return _0x550412[_0x76c4('0x1c')](_0x24a046)[_0x76c4('0x1d')]();};}function respondWithResult(_0x142e46,_0x2a600e){_0x2a600e=_0x2a600e||0xc8;return function(_0x83192d){if(_0x83192d){return _0x142e46[_0x76c4('0x1c')](_0x2a600e)[_0x76c4('0x1e')](_0x83192d);}};}function respondWithFilteredResult(_0x36a79a,_0x58274a){return function(_0x14b73b){if(_0x14b73b){var _0x4513a9=typeof _0x58274a[_0x76c4('0x1f')]===_0x76c4('0x20')&&typeof _0x58274a[_0x76c4('0x21')]===_0x76c4('0x20');var _0xcdb931=_0x14b73b[_0x76c4('0x22')];var _0x1049bc=_0x4513a9?0x0:_0x58274a['offset'];var _0x233d3a=_0x4513a9?_0x14b73b[_0x76c4('0x22')]:_0x58274a['offset']+_0x58274a['limit'];var _0x197098;if(_0x233d3a>=_0xcdb931){_0x233d3a=_0xcdb931;_0x197098=0xc8;}else{_0x197098=0xce;}_0x36a79a[_0x76c4('0x1c')](_0x197098);return _0x36a79a[_0x76c4('0x23')](_0x76c4('0x24'),_0x1049bc+'-'+_0x233d3a+'/'+_0xcdb931)[_0x76c4('0x1e')](_0x14b73b);}return null;};}function patchUpdates(_0x213a7b){return function(_0x3f9b8d){try{jsonpatch['apply'](_0x3f9b8d,_0x213a7b,!![]);}catch(_0x56f1f0){return BPromise['reject'](_0x56f1f0);}return _0x3f9b8d[_0x76c4('0x25')]();};}function saveUpdates(_0x3bdc41,_0x3cfaba){return function(_0x433f9d){if(_0x433f9d){return _0x433f9d['update'](_0x3bdc41)[_0x76c4('0x26')](function(_0x330dc8){return _0x330dc8;});}return null;};}function removeEntity(_0x5ae3a1,_0x5ee78b){return function(_0x11323c){if(_0x11323c){return _0x11323c['destroy']()[_0x76c4('0x26')](function(){var _0x216a3a=_0x11323c[_0x76c4('0x27')]({'plain':!![]});var _0x32deb5=_0x76c4('0x28');return db['UserProfileResource'][_0x76c4('0x29')]({'where':{'type':_0x32deb5,'resourceId':_0x216a3a['id']}})[_0x76c4('0x26')](function(){return _0x11323c;});})[_0x76c4('0x26')](function(){_0x5ae3a1[_0x76c4('0x1c')](0xcc)[_0x76c4('0x1d')]();});}};}function handleEntityNotFound(_0x511482,_0x2374d1){return function(_0x3288d9){if(!_0x3288d9){_0x511482[_0x76c4('0x1b')](0x194);}return _0x3288d9;};}function handleError(_0x3a7e91,_0x3abe01){_0x3abe01=_0x3abe01||0x1f4;return function(_0xe50316){logger[_0x76c4('0x2a')](_0xe50316['stack']);if(_0xe50316['name']){delete _0xe50316[_0x76c4('0x2b')];}_0x3a7e91[_0x76c4('0x1c')](_0x3abe01)[_0x76c4('0x2c')](_0xe50316);};}exports['index']=function(_0x1a5365,_0x2c73d3){var _0x2c64d6={},_0x215045={},_0x20ae97={'count':0x0,'rows':[]};var _0x4df15f=_['map'](db[_0x76c4('0x2d')][_0x76c4('0x2e')],function(_0x391bd6){return{'name':_0x391bd6[_0x76c4('0x2f')],'type':_0x391bd6[_0x76c4('0x30')][_0x76c4('0x31')]};});_0x215045[_0x76c4('0x32')]=_['map'](_0x4df15f,_0x76c4('0x2b'));_0x215045['query']=_[_0x76c4('0x33')](_0x1a5365[_0x76c4('0x34')]);_0x215045[_0x76c4('0x35')]=_['intersection'](_0x215045[_0x76c4('0x32')],_0x215045['query']);_0x2c64d6[_0x76c4('0x36')]=_[_0x76c4('0x37')](_0x215045[_0x76c4('0x32')],qs['fields'](_0x1a5365['query'][_0x76c4('0x38')]));_0x2c64d6[_0x76c4('0x36')]=_0x2c64d6['attributes'][_0x76c4('0x39')]?_0x2c64d6[_0x76c4('0x36')]:_0x215045['model'];if(!_0x1a5365['query']['hasOwnProperty'](_0x76c4('0x3a'))){_0x2c64d6['limit']=qs[_0x76c4('0x21')](_0x1a5365[_0x76c4('0x34')][_0x76c4('0x21')]);_0x2c64d6[_0x76c4('0x1f')]=qs['offset'](_0x1a5365[_0x76c4('0x34')][_0x76c4('0x1f')]);}_0x2c64d6[_0x76c4('0x3b')]=qs[_0x76c4('0x3c')](_0x1a5365[_0x76c4('0x34')]['sort']);_0x2c64d6[_0x76c4('0x3d')]=qs['filters'](_[_0x76c4('0x3e')](_0x1a5365[_0x76c4('0x34')],_0x215045[_0x76c4('0x35')]),_0x4df15f);if(_0x1a5365[_0x76c4('0x34')]['filter']){_0x2c64d6[_0x76c4('0x3d')]=_[_0x76c4('0x3f')](_0x2c64d6[_0x76c4('0x3d')],{'$or':_['map'](_0x4df15f,function(_0x300ae6){if(_0x300ae6[_0x76c4('0x30')]!==_0x76c4('0x40')){var _0x122fce={};_0x122fce[_0x300ae6[_0x76c4('0x2b')]]={'$like':'%'+_0x1a5365['query'][_0x76c4('0x41')]+'%'};return _0x122fce;}})});}_0x2c64d6=_[_0x76c4('0x3f')]({},_0x2c64d6,_0x1a5365[_0x76c4('0x42')]);var _0xca04ee={'where':_0x2c64d6[_0x76c4('0x3d')]};return db[_0x76c4('0x2d')]['count'](_0xca04ee)[_0x76c4('0x26')](function(_0x4119d2){_0x20ae97[_0x76c4('0x22')]=_0x4119d2;if(_0x1a5365[_0x76c4('0x34')][_0x76c4('0x43')]){_0x2c64d6[_0x76c4('0x44')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x76c4('0x45')](_0x2c64d6);})[_0x76c4('0x26')](function(_0x454f5c){_0x20ae97[_0x76c4('0x46')]=_0x454f5c;return _0x20ae97;})[_0x76c4('0x26')](respondWithFilteredResult(_0x2c73d3,_0x2c64d6))[_0x76c4('0x47')](handleError(_0x2c73d3,null));};exports[_0x76c4('0x48')]=function(_0x4eaafb,_0x59f146){var _0x4c5a3a={'raw':!![],'where':{'id':_0x4eaafb[_0x76c4('0x49')]['id']}},_0x2a962a={};_0x2a962a['model']=_[_0x76c4('0x33')](db[_0x76c4('0x2d')][_0x76c4('0x2e')]);_0x2a962a[_0x76c4('0x34')]=_[_0x76c4('0x33')](_0x4eaafb['query']);_0x2a962a['filters']=_['intersection'](_0x2a962a[_0x76c4('0x32')],_0x2a962a[_0x76c4('0x34')]);_0x4c5a3a['attributes']=_['intersection'](_0x2a962a[_0x76c4('0x32')],qs[_0x76c4('0x38')](_0x4eaafb[_0x76c4('0x34')][_0x76c4('0x38')]));_0x4c5a3a[_0x76c4('0x36')]=_0x4c5a3a['attributes'][_0x76c4('0x39')]?_0x4c5a3a[_0x76c4('0x36')]:_0x2a962a['model'];if(_0x4eaafb['query']['includeAll']){_0x4c5a3a[_0x76c4('0x44')]=[{'all':!![]}];}_0x4c5a3a=_[_0x76c4('0x3f')]({},_0x4c5a3a,_0x4eaafb['options']);return db['WhatsappQueue'][_0x76c4('0x4a')](_0x4c5a3a)[_0x76c4('0x26')](handleEntityNotFound(_0x59f146,null))[_0x76c4('0x26')](respondWithResult(_0x59f146,null))[_0x76c4('0x47')](handleError(_0x59f146,null));};exports[_0x76c4('0x4b')]=function(_0xc7375a,_0x42027a){return db[_0x76c4('0x2d')][_0x76c4('0x4b')](_0xc7375a['body'],{})[_0x76c4('0x26')](function(_0x293fa3){var _0x13166f=_0xc7375a[_0x76c4('0x4c')][_0x76c4('0x27')]({'plain':!![]});if(!_0x13166f)throw new Error(_0x76c4('0x4d'));if(_0x13166f[_0x76c4('0x4e')]===_0x76c4('0x4c')){var _0xf0e310=_0x293fa3[_0x76c4('0x27')]({'plain':!![]});var _0x2774f5=_0x76c4('0x28');return db[_0x76c4('0x4f')][_0x76c4('0x4a')]({'where':{'name':_0x2774f5,'userProfileId':_0x13166f[_0x76c4('0x50')]},'raw':!![]})[_0x76c4('0x26')](function(_0x1d11df){if(_0x1d11df&&_0x1d11df[_0x76c4('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0xf0e310[_0x76c4('0x2b')],'resourceId':_0xf0e310['id'],'type':_0x1d11df[_0x76c4('0x2b')],'sectionId':_0x1d11df['id']},{})[_0x76c4('0x26')](function(){return _0x293fa3;});}else{return _0x293fa3;}})[_0x76c4('0x47')](function(_0x260c55){logger[_0x76c4('0x2a')](_0x76c4('0x52'),_0x260c55);throw _0x260c55;});}return _0x293fa3;})[_0x76c4('0x26')](respondWithResult(_0x42027a,0xc9))[_0x76c4('0x47')](handleError(_0x42027a,null));};exports[_0x76c4('0x53')]=function(_0x16983b,_0x1a2b96){if(_0x16983b[_0x76c4('0x54')]['id']){delete _0x16983b[_0x76c4('0x54')]['id'];}return db[_0x76c4('0x2d')]['find']({'where':{'id':_0x16983b['params']['id']}})[_0x76c4('0x26')](handleEntityNotFound(_0x1a2b96,null))[_0x76c4('0x26')](saveUpdates(_0x16983b['body'],null))[_0x76c4('0x26')](respondWithResult(_0x1a2b96,null))['catch'](handleError(_0x1a2b96,null));};exports[_0x76c4('0x29')]=function(_0x2ec884,_0x243581){return db[_0x76c4('0x2d')][_0x76c4('0x4a')]({'where':{'id':_0x2ec884[_0x76c4('0x49')]['id']}})['then'](handleEntityNotFound(_0x243581,null))['then'](removeEntity(_0x243581,null))[_0x76c4('0x47')](handleError(_0x243581,null));};exports[_0x76c4('0x55')]=function(_0x524b00,_0xbd526d){return db[_0x76c4('0x2d')][_0x76c4('0x55')]()[_0x76c4('0x26')](respondWithResult(_0xbd526d,null))[_0x76c4('0x47')](handleError(_0xbd526d,null));};exports[_0x76c4('0x56')]=function(_0x383969,_0x412b7f,_0x1d26c1){var _0x2a788b={'raw':!![],'where':{}},_0xb68444={},_0x3e17f7;return db[_0x76c4('0x2d')][_0x76c4('0x57')]({'where':{'id':_0x383969[_0x76c4('0x49')]['id']}})[_0x76c4('0x26')](handleEntityNotFound(_0x412b7f,null))[_0x76c4('0x26')](function(_0x187f81){if(_0x187f81){_0x3e17f7=_0x187f81[_0x76c4('0x27')]({'plain':!![]});_0xb68444[_0x76c4('0x32')]=_['keys'](db[_0x76c4('0x58')][_0x76c4('0x2e')]);_0xb68444['query']=_[_0x76c4('0x33')](_0x383969[_0x76c4('0x34')]);_0xb68444['filters']=_[_0x76c4('0x37')](_0xb68444['model'],_0xb68444[_0x76c4('0x34')]);_0x2a788b['attributes']=_[_0x76c4('0x37')](_0xb68444[_0x76c4('0x32')],qs[_0x76c4('0x38')](_0x383969[_0x76c4('0x34')][_0x76c4('0x38')]));_0x2a788b[_0x76c4('0x36')]=_0x2a788b[_0x76c4('0x36')][_0x76c4('0x39')]?_0x2a788b[_0x76c4('0x36')]:_0xb68444['model'];if(!_0x383969[_0x76c4('0x34')][_0x76c4('0x59')]('nolimit')){_0x2a788b[_0x76c4('0x21')]=qs[_0x76c4('0x21')](_0x383969[_0x76c4('0x34')]['limit']);_0x2a788b['offset']=qs[_0x76c4('0x1f')](_0x383969[_0x76c4('0x34')][_0x76c4('0x1f')]);}_0x2a788b['order']=qs['sort'](_0x383969['query'][_0x76c4('0x3c')]);_0x2a788b['where']=qs['filters'](_[_0x76c4('0x3e')](_0x383969[_0x76c4('0x34')],_0xb68444['filters']));_0x2a788b[_0x76c4('0x3d')][_0x76c4('0x5a')]=_0x187f81['id'];if(_0x383969[_0x76c4('0x34')][_0x76c4('0x41')]){_0x2a788b['where']=_[_0x76c4('0x3f')](_0x2a788b[_0x76c4('0x3d')],{'$or':_[_0x76c4('0x5b')](_0x2a788b['attributes'],function(_0x54c8cd){var _0x9d6ebe={};_0x9d6ebe[_0x54c8cd]={'$like':'%'+_0x383969[_0x76c4('0x34')][_0x76c4('0x41')]+'%'};return _0x9d6ebe;})});}_0x2a788b=_[_0x76c4('0x3f')]({},_0x2a788b,_0x383969[_0x76c4('0x42')]);return db['UserWhatsappQueue']['findAll'](_0x2a788b);}})[_0x76c4('0x26')](function(_0x374549){if(_0x374549){return db[_0x76c4('0x5c')][_0x76c4('0x5d')]({'where':{'id':_[_0x76c4('0x5b')](_0x374549,'UserId'),'role':_0x76c4('0x5e')},'attributes':['id',_0x76c4('0x2b'),_0x76c4('0x5f'),_0x76c4('0x60'),_0x76c4('0x61')]});}})[_0x76c4('0x26')](function(_0x1c70a5){if(_0x1c70a5){return{'count':_0x1c70a5['count'],'rows':_['map'](_0x1c70a5[_0x76c4('0x46')],function(_0x27550e){return{'membername':_0x27550e[_0x76c4('0x2b')],'UserId':_0x27550e['id'],'queue_name':_0x3e17f7[_0x76c4('0x2b')],'WhatsappQueueId':_0x3e17f7['id'],'interface':util[_0x76c4('0x62')]('%s/%s',_0x76c4('0x63'),_0x27550e[_0x76c4('0x2b')]),'penalty':0x0,'paused':_0x27550e[_0x76c4('0x5f')],'createdAt':_0x27550e[_0x76c4('0x61')],'updatedAt':_0x27550e['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x76c4('0x26')](respondWithFilteredResult(_0x412b7f,_0x2a788b))[_0x76c4('0x47')](handleError(_0x412b7f,null));};exports['getTeams']=function(_0x1946b2,_0x442aa0,_0x232cdc){var _0x20efdd={};var _0x15a6cb={};var _0x5bc6af;var _0x35a804;return db['WhatsappQueue'][_0x76c4('0x57')]({'where':{'id':_0x1946b2[_0x76c4('0x49')]['id']}})['then'](handleEntityNotFound(_0x442aa0,null))['then'](function(_0x2ceb67){if(_0x2ceb67){_0x5bc6af=_0x2ceb67;_0x15a6cb[_0x76c4('0x32')]=_['keys'](db['Team']['rawAttributes']);_0x15a6cb[_0x76c4('0x34')]=_[_0x76c4('0x33')](_0x1946b2['query']);_0x15a6cb[_0x76c4('0x35')]=_[_0x76c4('0x37')](_0x15a6cb[_0x76c4('0x32')],_0x15a6cb[_0x76c4('0x34')]);_0x20efdd['attributes']=_['intersection'](_0x15a6cb[_0x76c4('0x32')],qs[_0x76c4('0x38')](_0x1946b2['query'][_0x76c4('0x38')]));_0x20efdd[_0x76c4('0x36')]=_0x20efdd[_0x76c4('0x36')]['length']?_0x20efdd['attributes']:_0x15a6cb[_0x76c4('0x32')];_0x20efdd[_0x76c4('0x3b')]=qs[_0x76c4('0x3c')](_0x1946b2[_0x76c4('0x34')][_0x76c4('0x3c')]);_0x20efdd[_0x76c4('0x3d')]=qs[_0x76c4('0x35')](_[_0x76c4('0x3e')](_0x1946b2[_0x76c4('0x34')],_0x15a6cb['filters']));if(_0x1946b2[_0x76c4('0x34')][_0x76c4('0x41')]){_0x20efdd[_0x76c4('0x3d')]=_[_0x76c4('0x3f')](_0x20efdd[_0x76c4('0x3d')],{'$or':_['map'](_0x20efdd[_0x76c4('0x36')],function(_0x287c02){var _0xf93b26={};_0xf93b26[_0x287c02]={'$like':'%'+_0x1946b2['query'][_0x76c4('0x41')]+'%'};return _0xf93b26;})});}_0x20efdd=_[_0x76c4('0x3f')]({},_0x20efdd,_0x1946b2[_0x76c4('0x42')]);return _0x5bc6af['getTeams'](_0x20efdd);}})[_0x76c4('0x26')](function(_0x4e65b4){if(_0x4e65b4){_0x35a804=_0x4e65b4['length'];if(!_0x1946b2[_0x76c4('0x34')][_0x76c4('0x59')](_0x76c4('0x3a'))){_0x20efdd[_0x76c4('0x21')]=qs['limit'](_0x1946b2['query'][_0x76c4('0x21')]);_0x20efdd[_0x76c4('0x1f')]=qs[_0x76c4('0x1f')](_0x1946b2[_0x76c4('0x34')][_0x76c4('0x1f')]);}return _0x5bc6af['getTeams'](_0x20efdd);}})['then'](function(_0x5b6a7c){if(_0x5b6a7c){return _0x5b6a7c?{'count':_0x35a804,'rows':_0x5b6a7c}:null;}})[_0x76c4('0x26')](respondWithResult(_0x442aa0,null))[_0x76c4('0x47')](handleError(_0x442aa0,null));};exports[_0x76c4('0x64')]=function(_0x3d7054,_0xce32ca,_0x40fda0){var _0x41edf3=_0x3d7054['body'][_0x76c4('0x65')];return db['Team'][_0x76c4('0x45')]({'where':{'id':_0x41edf3},'attributes':['id'],'include':[{'model':db[_0x76c4('0x5c')],'as':'Agents','attributes':['id',_0x76c4('0x2b'),_0x76c4('0x66'),_0x76c4('0x67'),'interface'],'raw':!![]}]})[_0x76c4('0x26')](function(_0x42eca6){if(_0x42eca6){var _0x133f42=_[_0x76c4('0x68')](_0x42eca6,function(_0x2db555){var _0x4e2323=_0x2db555[_0x76c4('0x27')]({'plain':!![]});return _0x4e2323[_0x76c4('0x69')];});return db[_0x76c4('0x2d')][_0x76c4('0x4a')]({'where':{'id':_0x3d7054[_0x76c4('0x49')]['id']}})['then'](function(_0xda8d4b){return db[_0x76c4('0x6a')][_0x76c4('0x6b')](function(_0x12f5a1){return _0xda8d4b['addTeams'](_0x41edf3,{'transaction':_0x12f5a1})[_0x76c4('0x26')](function(){return BPromise[_0x76c4('0x6c')](_0x133f42,function(_0x48e7de){return db[_0x76c4('0x58')][_0x76c4('0x6d')]({'where':{'UserId':_0x48e7de['id'],'WhatsappQueueId':_0x3d7054[_0x76c4('0x49')]['id']},'transaction':_0x12f5a1});});})[_0x76c4('0x26')](function(){_0x133f42['forEach'](function(_0x181564){socket[_0x76c4('0x6e')](_0x76c4('0x6f'),{'UserId':_0x181564['id'],'WhatsappQueueId':_0xda8d4b['id']});});});});});}})['then'](respondWithStatusCode(_0xce32ca,null))[_0x76c4('0x47')](handleError(_0xce32ca,null));};exports[_0x76c4('0x70')]=function(_0x26a490,_0x556822,_0x9ef70a){return db['Team'][_0x76c4('0x45')]({'where':{'id':_0x26a490['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x76c4('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x556822,null))[_0x76c4('0x26')](function(_0x492ee6){var _0x26f7a4=_[_0x76c4('0x5b')](_0x492ee6,'id');var _0x1c505b=[];var _0x375f09=[];var _0x3de810=squel[_0x76c4('0x71')]();_0x3de810[_0x76c4('0x72')](_0x76c4('0x73'))[_0x76c4('0x74')](_0x76c4('0x75'),'tq')[_0x76c4('0x76')](_0x76c4('0x77'),'ut',_0x76c4('0x78'))[_0x76c4('0x3d')](_0x76c4('0x79'),_0x26a490[_0x76c4('0x49')]['id']);for(var _0x221cf1=0x0;_0x221cf1<_0x492ee6[_0x76c4('0x39')];_0x221cf1+=0x1){let _0x240aaf=_0x492ee6[_0x221cf1];for(var _0x30fad7=0x0;_0x30fad7<_0x240aaf[_0x76c4('0x69')][_0x76c4('0x39')];_0x30fad7+=0x1){let _0x322183=_0x240aaf['Agents'][_0x30fad7];var _0x4beddc=_0x3de810[_0x76c4('0x7a')]();_0x4beddc[_0x76c4('0x3d')](_0x76c4('0x7b'),_0x322183['id']);_0x375f09['push'](db[_0x76c4('0x6a')][_0x76c4('0x34')](_0x4beddc[_0x76c4('0x7c')](),{'type':db[_0x76c4('0x6a')][_0x76c4('0x7d')][_0x76c4('0x7e')]})[_0x76c4('0x26')](function(_0x4fb1a5){if(_0x4fb1a5[_0x76c4('0x39')]===0x1){return _0x322183['id'];}else{var _0x1fe44b=_['every'](_[_0x76c4('0x5b')](_0x4fb1a5,_0x76c4('0x7f')),function(_0x3f600c){return _[_0x76c4('0x80')](_0x26f7a4,_0x3f600c);});if(_0x1fe44b){return _0x322183['id'];}}}));}}return BPromise[_0x76c4('0x81')](_0x375f09)[_0x76c4('0x26')](function(_0x57edd7){_0x1c505b=_(_0x1c505b)[_0x76c4('0x82')](_0x57edd7)['compact']()[_0x76c4('0x83')]();return db['WhatsappQueue'][_0x76c4('0x4a')]({'where':{'id':_0x26a490[_0x76c4('0x49')]['id']}})[_0x76c4('0x26')](function(_0x268693){return db[_0x76c4('0x6a')][_0x76c4('0x6b')](function(_0x317733){return _0x268693[_0x76c4('0x70')](_0x26a490[_0x76c4('0x34')]['ids'],{'transaction':_0x317733})[_0x76c4('0x26')](function(){if(!_[_0x76c4('0x84')](_0x1c505b)){return _0x268693[_0x76c4('0x85')](_0x1c505b,{'transaction':_0x317733});}})[_0x76c4('0x26')](function(){_0x1c505b['forEach'](function(_0x10596a){socket['emit'](_0x76c4('0x86'),{'UserId':_0x10596a,'WhatsappQueueId':_0x268693['id']});});});});});});})[_0x76c4('0x26')](respondWithStatusCode(_0x556822,null))[_0x76c4('0x47')](handleError(_0x556822,null));};exports[_0x76c4('0x87')]=function(_0x2b8925,_0x6290ec,_0x594dfe){return db[_0x76c4('0x2d')][_0x76c4('0x4a')]({'where':{'id':_0x2b8925['params']['id']}})[_0x76c4('0x26')](handleEntityNotFound(_0x6290ec,null))[_0x76c4('0x26')](function(_0x494077){if(_0x494077){return _0x494077[_0x76c4('0x87')](_0x2b8925['body']['ids'],_[_0x76c4('0x88')](_0x2b8925[_0x76c4('0x54')],['ids','id'])||{})[_0x76c4('0x89')](function(_0x4c7ee6){for(var _0x1c804d=0x0;_0x1c804d<_0x2b8925[_0x76c4('0x54')][_0x76c4('0x65')][_0x76c4('0x39')];_0x1c804d+=0x1){socket[_0x76c4('0x6e')]('userWhatsappQueue:save',{'UserId':Number(_0x2b8925['body'][_0x76c4('0x65')][_0x1c804d]),'WhatsappQueueId':Number(_0x2b8925['params']['id'])});}return _0x4c7ee6;});}})[_0x76c4('0x26')](respondWithResult(_0x6290ec,null))[_0x76c4('0x47')](handleError(_0x6290ec,null));};exports['removeAgents']=function(_0x1f8862,_0x409645,_0x244ff7){return db[_0x76c4('0x2d')][_0x76c4('0x4a')]({'where':{'id':_0x1f8862['params']['id']}})['then'](handleEntityNotFound(_0x409645,null))[_0x76c4('0x26')](function(_0x3a375a){if(_0x3a375a){return _0x3a375a[_0x76c4('0x85')](_0x1f8862[_0x76c4('0x34')][_0x76c4('0x65')])[_0x76c4('0x26')](function(){if(_[_0x76c4('0x8a')](_0x1f8862[_0x76c4('0x34')][_0x76c4('0x65')])){for(var _0x1d8f25=0x0;_0x1d8f25<_0x1f8862['query'][_0x76c4('0x65')][_0x76c4('0x39')];_0x1d8f25+=0x1){socket[_0x76c4('0x6e')](_0x76c4('0x86'),{'UserId':Number(_0x1f8862[_0x76c4('0x34')][_0x76c4('0x65')][_0x1d8f25]),'WhatsappQueueId':Number(_0x1f8862[_0x76c4('0x49')]['id'])});}}else{socket[_0x76c4('0x6e')](_0x76c4('0x86'),{'UserId':Number(_0x1f8862[_0x76c4('0x34')][_0x76c4('0x65')]),'WhatsappQueueId':Number(_0x1f8862[_0x76c4('0x49')]['id'])});}});}})[_0x76c4('0x26')](respondWithStatusCode(_0x409645,null))[_0x76c4('0x47')](handleError(_0x409645,null));};exports[_0x76c4('0x8b')]=function(_0x3c0a58,_0x36aa6a,_0x288d5f){var _0x418b26={};var _0x78aa12={};var _0xbcfac1;var _0xc3e593;return db[_0x76c4('0x2d')][_0x76c4('0x57')]({'where':{'id':_0x3c0a58[_0x76c4('0x49')]['id']}})[_0x76c4('0x26')](handleEntityNotFound(_0x36aa6a,null))[_0x76c4('0x26')](function(_0x407fe2){if(_0x407fe2){_0xbcfac1=_0x407fe2;_0x78aa12[_0x76c4('0x32')]=_[_0x76c4('0x33')](db[_0x76c4('0x5c')]['rawAttributes']);_0x78aa12[_0x76c4('0x34')]=_[_0x76c4('0x33')](_0x3c0a58['query']);_0x78aa12['filters']=_['intersection'](_0x78aa12[_0x76c4('0x32')],_0x78aa12[_0x76c4('0x34')]);_0x418b26['attributes']=_['intersection'](_0x78aa12[_0x76c4('0x32')],qs[_0x76c4('0x38')](_0x3c0a58['query'][_0x76c4('0x38')]));_0x418b26[_0x76c4('0x36')]=_0x418b26[_0x76c4('0x36')][_0x76c4('0x39')]?_0x418b26[_0x76c4('0x36')]:_0x78aa12['model'];_0x418b26['order']=qs[_0x76c4('0x3c')](_0x3c0a58[_0x76c4('0x34')][_0x76c4('0x3c')]);_0x418b26[_0x76c4('0x3d')]=qs['filters'](_['pick'](_0x3c0a58[_0x76c4('0x34')],_0x78aa12['filters']));if(_0x3c0a58['query'][_0x76c4('0x41')]){_0x418b26[_0x76c4('0x3d')]=_['merge'](_0x418b26[_0x76c4('0x3d')],{'$or':_[_0x76c4('0x5b')](_0x418b26[_0x76c4('0x36')],function(_0x5ee0b5){var _0x4cb8c8={};_0x4cb8c8[_0x5ee0b5]={'$like':'%'+_0x3c0a58['query'][_0x76c4('0x41')]+'%'};return _0x4cb8c8;})});}_0x418b26=_[_0x76c4('0x3f')]({},_0x418b26,_0x3c0a58['options']);return _0xbcfac1['getAgents'](_0x418b26);}})[_0x76c4('0x26')](function(_0x4d8b73){if(_0x4d8b73){_0xc3e593=_0x4d8b73[_0x76c4('0x39')];if(!_0x3c0a58[_0x76c4('0x34')][_0x76c4('0x59')](_0x76c4('0x3a'))){_0x418b26['limit']=qs[_0x76c4('0x21')](_0x3c0a58[_0x76c4('0x34')][_0x76c4('0x21')]);_0x418b26[_0x76c4('0x1f')]=qs[_0x76c4('0x1f')](_0x3c0a58[_0x76c4('0x34')][_0x76c4('0x1f')]);}return _0xbcfac1[_0x76c4('0x8b')](_0x418b26);}})[_0x76c4('0x26')](function(_0x5ce977){if(_0x5ce977){return _0x5ce977?{'count':_0xc3e593,'rows':_0x5ce977}:null;}})[_0x76c4('0x26')](respondWithResult(_0x36aa6a,null))[_0x76c4('0x47')](handleError(_0x36aa6a,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index c7a244a..ff26061 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 _0x3c08=['exports','../../mysqldb','WhatsappQueue','setMaxListeners','update','emit','hook'];(function(_0x384f5c,_0x3b4715){var _0x40d2e9=function(_0x38052b){while(--_0x38052b){_0x384f5c['push'](_0x384f5c['shift']());}};_0x40d2e9(++_0x3b4715);}(_0x3c08,0x1e4));var _0x83c0=function(_0x2c24b3,_0x2c5a94){_0x2c24b3=_0x2c24b3-0x0;var _0x4f59c8=_0x3c08[_0x2c24b3];return _0x4f59c8;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x83c0('0x0'))['db'][_0x83c0('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x83c0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x83c0('0x3'),'afterDestroy':'remove'};function emitEvent(_0x437e24){return function(_0x48480e,_0x2fa100,_0x3809f1){WhatsappQueueEvents[_0x83c0('0x4')](_0x437e24+':'+_0x48480e['id'],_0x48480e);WhatsappQueueEvents[_0x83c0('0x4')](_0x437e24,_0x48480e);_0x3809f1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x83c0('0x5')](e,emitEvent(event));}}module[_0x83c0('0x6')]=WhatsappQueueEvents; \ No newline at end of file +var _0x42a0=['WhatsappQueue','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x38d19d,_0x43f41b){var _0x5c6ebc=function(_0x1587cc){while(--_0x1587cc){_0x38d19d['push'](_0x38d19d['shift']());}};_0x5c6ebc(++_0x43f41b);}(_0x42a0,0x127));var _0x042a=function(_0x3974a1,_0x28926c){_0x3974a1=_0x3974a1-0x0;var _0x9436cf=_0x42a0[_0x3974a1];return _0x9436cf;};'use strict';var EventEmitter=require(_0x042a('0x0'));var WhatsappQueue=require(_0x042a('0x1'))['db'][_0x042a('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x042a('0x3'),'afterUpdate':_0x042a('0x4'),'afterDestroy':_0x042a('0x5')};function emitEvent(_0x50b30b){return function(_0x4423c8,_0x5e4f76,_0x1947d3){WhatsappQueueEvents[_0x042a('0x6')](_0x50b30b+':'+_0x4423c8['id'],_0x4423c8);WhatsappQueueEvents['emit'](_0x50b30b,_0x4423c8);_0x1947d3(null);};}for(var e in events){if(events[_0x042a('0x7')](e)){var event=events[e];WhatsappQueue[_0x042a('0x8')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index e478479..bb6f9ef 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 _0xe9a3=['../../config/environment','define','WhatsappQueue','whatsapp_queues','util','../../config/logger','bluebird'];(function(_0x1df4bf,_0x28ba68){var _0x3a1ee1=function(_0x3cd344){while(--_0x3cd344){_0x1df4bf['push'](_0x1df4bf['shift']());}};_0x3a1ee1(++_0x28ba68);}(_0xe9a3,0xac));var _0x3e9a=function(_0x56478b,_0x193f1d){_0x56478b=_0x56478b-0x0;var _0x2e70b7=_0xe9a3[_0x56478b];return _0x2e70b7;};'use strict';var _=require('lodash');var util=require(_0x3e9a('0x0'));var logger=require(_0x3e9a('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3e9a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3e9a('0x3'));var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x27cb46,_0xe24460){return _0x27cb46[_0x3e9a('0x4')](_0x3e9a('0x5'),attributes,{'tableName':_0x3e9a('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd89a=['moment','bluebird','request-promise','../../config/environment','./whatsappQueue.attributes','whatsapp_queues','lodash','util','../../config/logger'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd89a,0xf9));var _0xad89=function(_0x26299e,_0x394ad1){_0x26299e=_0x26299e-0x0;var _0x6c4f4a=_0xd89a[_0x26299e];return _0x6c4f4a;};'use strict';var _=require(_0xad89('0x0'));var util=require(_0xad89('0x1'));var logger=require(_0xad89('0x2'))('api');var moment=require(_0xad89('0x3'));var BPromise=require(_0xad89('0x4'));var rp=require(_0xad89('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xad89('0x6'));var attributes=require(_0xad89('0x7'));module['exports']=function(_0x2b2e1f,_0x1828cd){return _0x2b2e1f['define']('WhatsappQueue',attributes,{'tableName':_0xad89('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 91104b9..73a93c3 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 _0x79f7=['redis','defaults','localhost','./whatsappQueue.socket','register','request','then','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','catch','GetWhatsappQueue','WhatsappQueue','options','raw','where','attributes','limit','include','model','map','ShowWhatsappQueue','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x29c696,_0x243038){var _0x2a2ad4=function(_0xf1425e){while(--_0xf1425e){_0x29c696['push'](_0x29c696['shift']());}};_0x2a2ad4(++_0x243038);}(_0x79f7,0x72));var _0x779f=function(_0x55414e,_0x2f5b7b){_0x55414e=_0x55414e-0x0;var _0x5197e3=_0x79f7[_0x55414e];return _0x5197e3;};'use strict';var _=require('lodash');var util=require(_0x779f('0x0'));var moment=require('moment');var BPromise=require(_0x779f('0x1'));var rs=require(_0x779f('0x2'));var fs=require('fs');var Redis=require(_0x779f('0x3'));var db=require(_0x779f('0x4'))['db'];var utils=require(_0x779f('0x5'));var logger=require(_0x779f('0x6'))(_0x779f('0x7'));var config=require(_0x779f('0x8'));var jayson=require(_0x779f('0x9'));var client=jayson[_0x779f('0xa')][_0x779f('0xb')]({'port':0x232a});config[_0x779f('0xc')]=_[_0x779f('0xd')](config[_0x779f('0xc')],{'host':_0x779f('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x779f('0xc')]));require(_0x779f('0xf'))[_0x779f('0x10')](socket);function respondWithRpcPromise(_0x438e53,_0x4bb996,_0x2e4d88){return new BPromise(function(_0x35423d,_0x30f212){return client[_0x779f('0x11')](_0x438e53,_0x2e4d88)[_0x779f('0x12')](function(_0x9408c7){logger[_0x779f('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x4bb996,_0x779f('0x14'));logger[_0x779f('0x15')](_0x779f('0x16'),_0x4bb996,'request\x20sent',JSON[_0x779f('0x17')](_0x9408c7));if(_0x9408c7[_0x779f('0x18')]){if(_0x9408c7[_0x779f('0x18')][_0x779f('0x19')]===0x1f4){logger[_0x779f('0x18')](_0x779f('0x1a'),_0x4bb996,_0x9408c7[_0x779f('0x18')]['message']);return _0x30f212(_0x9408c7['error'][_0x779f('0x1b')]);}logger[_0x779f('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x4bb996,_0x9408c7[_0x779f('0x18')][_0x779f('0x1b')]);return _0x35423d(_0x9408c7[_0x779f('0x18')]['message']);}else{logger[_0x779f('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x4bb996,_0x779f('0x14'));_0x35423d(_0x9408c7[_0x779f('0x1c')]['message']);}})[_0x779f('0x1d')](function(_0x53674b){logger[_0x779f('0x18')](_0x779f('0x1a'),_0x4bb996,_0x53674b);_0x30f212(_0x53674b);});});}exports[_0x779f('0x1e')]=function(_0x1ae42f){var _0x2ba525=this;return new Promise(function(_0x42a9a4,_0x1f0f57){return db[_0x779f('0x1f')]['findAll']({'raw':_0x1ae42f[_0x779f('0x20')]?_0x1ae42f[_0x779f('0x20')][_0x779f('0x21')]===undefined?!![]:![]:!![],'where':_0x1ae42f[_0x779f('0x20')]?_0x1ae42f[_0x779f('0x20')][_0x779f('0x22')]||null:null,'attributes':_0x1ae42f['options']?_0x1ae42f['options'][_0x779f('0x23')]||null:null,'limit':_0x1ae42f[_0x779f('0x20')]?_0x1ae42f[_0x779f('0x20')][_0x779f('0x24')]||null:null,'include':_0x1ae42f[_0x779f('0x20')]?_0x1ae42f[_0x779f('0x20')][_0x779f('0x25')]?_['map'](_0x1ae42f[_0x779f('0x20')][_0x779f('0x25')],function(_0x351cde){return{'model':db[_0x351cde[_0x779f('0x26')]],'as':_0x351cde['as'],'attributes':_0x351cde[_0x779f('0x23')],'include':_0x351cde[_0x779f('0x25')]?_[_0x779f('0x27')](_0x351cde[_0x779f('0x25')],function(_0x515a8f){return{'model':db[_0x515a8f[_0x779f('0x26')]],'as':_0x515a8f['as'],'attributes':_0x515a8f[_0x779f('0x23')],'include':_0x515a8f[_0x779f('0x25')]?_[_0x779f('0x27')](_0x515a8f['include'],function(_0x5defaf){return{'model':db[_0x5defaf[_0x779f('0x26')]],'as':_0x5defaf['as'],'attributes':_0x5defaf[_0x779f('0x23')]};}):[]};}):[]};}):[]:[]})[_0x779f('0x12')](function(_0x438a71){logger[_0x779f('0x13')](_0x779f('0x1e'),_0x1ae42f);logger[_0x779f('0x15')](_0x779f('0x1e'),_0x1ae42f,JSON[_0x779f('0x17')](_0x438a71));_0x42a9a4(_0x438a71);})[_0x779f('0x1d')](function(_0x2ef69f){logger[_0x779f('0x18')](_0x779f('0x1e'),_0x2ef69f['message'],_0x1ae42f);_0x1f0f57(_0x2ba525[_0x779f('0x18')](0x1f4,_0x2ef69f['message']));});});};exports[_0x779f('0x28')]=function(_0x360b9e){var _0x3ffb38=this;return new Promise(function(_0x1503ee,_0x331144){return db['WhatsappQueue'][_0x779f('0x29')]({'raw':_0x360b9e[_0x779f('0x20')]?_0x360b9e[_0x779f('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x360b9e[_0x779f('0x20')]?_0x360b9e[_0x779f('0x20')][_0x779f('0x22')]||null:null,'attributes':_0x360b9e['options']?_0x360b9e[_0x779f('0x20')][_0x779f('0x23')]||null:null,'include':_0x360b9e['options']?_0x360b9e[_0x779f('0x20')][_0x779f('0x25')]?_[_0x779f('0x27')](_0x360b9e[_0x779f('0x20')][_0x779f('0x25')],function(_0x3e9bad){return{'model':db[_0x3e9bad[_0x779f('0x26')]],'as':_0x3e9bad['as'],'attributes':_0x3e9bad[_0x779f('0x23')],'include':_0x3e9bad[_0x779f('0x25')]?_[_0x779f('0x27')](_0x3e9bad[_0x779f('0x25')],function(_0x2c6245){return{'model':db[_0x2c6245[_0x779f('0x26')]],'as':_0x2c6245['as'],'attributes':_0x2c6245[_0x779f('0x23')],'include':_0x2c6245[_0x779f('0x25')]?_[_0x779f('0x27')](_0x2c6245[_0x779f('0x25')],function(_0x30d25f){return{'model':db[_0x30d25f[_0x779f('0x26')]],'as':_0x30d25f['as'],'attributes':_0x30d25f['attributes']};}):[]};}):[]};}):[]:[]})[_0x779f('0x12')](function(_0x1d4884){logger['info']('ShowWhatsappQueue',_0x360b9e);logger[_0x779f('0x15')](_0x779f('0x28'),_0x360b9e,JSON[_0x779f('0x17')](_0x1d4884));_0x1503ee(_0x1d4884);})[_0x779f('0x1d')](function(_0x569a0c){logger[_0x779f('0x18')](_0x779f('0x28'),_0x569a0c[_0x779f('0x1b')],_0x360b9e);_0x331144(_0x3ffb38[_0x779f('0x18')](0x1f4,_0x569a0c[_0x779f('0x1b')]));});});}; \ No newline at end of file +var _0x9713=['GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','limit','include','map','model','attributes','stringify','ShowWhatsappQueue','find','lodash','util','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','WhatsappQueue,\x20%s,\x20%s','catch'];(function(_0x19875a,_0x202791){var _0x9ce766=function(_0x299238){while(--_0x299238){_0x19875a['push'](_0x19875a['shift']());}};_0x9ce766(++_0x202791);}(_0x9713,0x1c6));var _0x3971=function(_0x37545e,_0x296fb6){_0x37545e=_0x37545e-0x0;var _0x4fe239=_0x9713[_0x37545e];return _0x4fe239;};'use strict';var _=require(_0x3971('0x0'));var util=require(_0x3971('0x1'));var moment=require(_0x3971('0x2'));var BPromise=require('bluebird');var rs=require(_0x3971('0x3'));var fs=require('fs');var Redis=require(_0x3971('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3971('0x5'))('rpc');var config=require(_0x3971('0x6'));var jayson=require(_0x3971('0x7'));var client=jayson[_0x3971('0x8')][_0x3971('0x9')]({'port':0x232a});config[_0x3971('0xa')]=_['defaults'](config[_0x3971('0xa')],{'host':_0x3971('0xb'),'port':0x18eb});var socket=require(_0x3971('0xc'))(new Redis(config[_0x3971('0xa')]));require(_0x3971('0xd'))[_0x3971('0xe')](socket);function respondWithRpcPromise(_0x3219ab,_0x4f4a47,_0x2f62e2){return new BPromise(function(_0x4c2c99,_0x19a55f){return client[_0x3971('0xf')](_0x3219ab,_0x2f62e2)[_0x3971('0x10')](function(_0x2f7c7d){logger[_0x3971('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x4f4a47,_0x3971('0x12'));logger[_0x3971('0x13')](_0x3971('0x14'),_0x4f4a47,'request\x20sent',JSON['stringify'](_0x2f7c7d));if(_0x2f7c7d[_0x3971('0x15')]){if(_0x2f7c7d[_0x3971('0x15')][_0x3971('0x16')]===0x1f4){logger[_0x3971('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x4f4a47,_0x2f7c7d['error'][_0x3971('0x17')]);return _0x19a55f(_0x2f7c7d[_0x3971('0x15')][_0x3971('0x17')]);}logger[_0x3971('0x15')](_0x3971('0x18'),_0x4f4a47,_0x2f7c7d[_0x3971('0x15')][_0x3971('0x17')]);return _0x4c2c99(_0x2f7c7d[_0x3971('0x15')][_0x3971('0x17')]);}else{logger[_0x3971('0x11')](_0x3971('0x18'),_0x4f4a47,_0x3971('0x12'));_0x4c2c99(_0x2f7c7d['result']['message']);}})[_0x3971('0x19')](function(_0x56beaa){logger[_0x3971('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x4f4a47,_0x56beaa);_0x19a55f(_0x56beaa);});});}exports[_0x3971('0x1a')]=function(_0x3dbae7){var _0x347a71=this;return new Promise(function(_0x295600,_0x28723e){return db[_0x3971('0x1b')][_0x3971('0x1c')]({'raw':_0x3dbae7[_0x3971('0x1d')]?_0x3dbae7[_0x3971('0x1d')][_0x3971('0x1e')]===undefined?!![]:![]:!![],'where':_0x3dbae7[_0x3971('0x1d')]?_0x3dbae7[_0x3971('0x1d')][_0x3971('0x1f')]||null:null,'attributes':_0x3dbae7['options']?_0x3dbae7[_0x3971('0x1d')]['attributes']||null:null,'limit':_0x3dbae7['options']?_0x3dbae7[_0x3971('0x1d')][_0x3971('0x20')]||null:null,'include':_0x3dbae7[_0x3971('0x1d')]?_0x3dbae7[_0x3971('0x1d')][_0x3971('0x21')]?_[_0x3971('0x22')](_0x3dbae7['options'][_0x3971('0x21')],function(_0x49403c){return{'model':db[_0x49403c[_0x3971('0x23')]],'as':_0x49403c['as'],'attributes':_0x49403c['attributes'],'include':_0x49403c[_0x3971('0x21')]?_[_0x3971('0x22')](_0x49403c[_0x3971('0x21')],function(_0xc5a107){return{'model':db[_0xc5a107[_0x3971('0x23')]],'as':_0xc5a107['as'],'attributes':_0xc5a107['attributes'],'include':_0xc5a107[_0x3971('0x21')]?_['map'](_0xc5a107[_0x3971('0x21')],function(_0x41cab2){return{'model':db[_0x41cab2[_0x3971('0x23')]],'as':_0x41cab2['as'],'attributes':_0x41cab2[_0x3971('0x24')]};}):[]};}):[]};}):[]:[]})[_0x3971('0x10')](function(_0x2a4797){logger[_0x3971('0x11')](_0x3971('0x1a'),_0x3dbae7);logger[_0x3971('0x13')](_0x3971('0x1a'),_0x3dbae7,JSON[_0x3971('0x25')](_0x2a4797));_0x295600(_0x2a4797);})[_0x3971('0x19')](function(_0x3e521a){logger[_0x3971('0x15')]('GetWhatsappQueue',_0x3e521a[_0x3971('0x17')],_0x3dbae7);_0x28723e(_0x347a71[_0x3971('0x15')](0x1f4,_0x3e521a[_0x3971('0x17')]));});});};exports[_0x3971('0x26')]=function(_0x599b10){var _0x2e33df=this;return new Promise(function(_0x228249,_0x401d84){return db['WhatsappQueue'][_0x3971('0x27')]({'raw':_0x599b10[_0x3971('0x1d')]?_0x599b10[_0x3971('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x599b10[_0x3971('0x1d')]?_0x599b10['options'][_0x3971('0x1f')]||null:null,'attributes':_0x599b10['options']?_0x599b10['options'][_0x3971('0x24')]||null:null,'include':_0x599b10[_0x3971('0x1d')]?_0x599b10['options'][_0x3971('0x21')]?_[_0x3971('0x22')](_0x599b10['options'][_0x3971('0x21')],function(_0x190d81){return{'model':db[_0x190d81[_0x3971('0x23')]],'as':_0x190d81['as'],'attributes':_0x190d81[_0x3971('0x24')],'include':_0x190d81[_0x3971('0x21')]?_['map'](_0x190d81[_0x3971('0x21')],function(_0x54590e){return{'model':db[_0x54590e['model']],'as':_0x54590e['as'],'attributes':_0x54590e['attributes'],'include':_0x54590e['include']?_[_0x3971('0x22')](_0x54590e['include'],function(_0x252146){return{'model':db[_0x252146[_0x3971('0x23')]],'as':_0x252146['as'],'attributes':_0x252146[_0x3971('0x24')]};}):[]};}):[]};}):[]:[]})[_0x3971('0x10')](function(_0x394a37){logger[_0x3971('0x11')](_0x3971('0x26'),_0x599b10);logger['debug'](_0x3971('0x26'),_0x599b10,JSON[_0x3971('0x25')](_0x394a37));_0x228249(_0x394a37);})[_0x3971('0x19')](function(_0xc2d566){logger[_0x3971('0x15')](_0x3971('0x26'),_0xc2d566[_0x3971('0x17')],_0x599b10);_0x401d84(_0x2e33df[_0x3971('0x15')](0x1f4,_0xc2d566[_0x3971('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 803fa08..95e21db 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 _0xcd61=['whatsappQueue:','./whatsappQueue.events','save','remove','update','emit','length'];(function(_0x1ed388,_0x4c1474){var _0x356c7f=function(_0x19b7e1){while(--_0x19b7e1){_0x1ed388['push'](_0x1ed388['shift']());}};_0x356c7f(++_0x4c1474);}(_0xcd61,0x1ba));var _0x1cd6=function(_0x36e3fc,_0x419cf1){_0x36e3fc=_0x36e3fc-0x0;var _0xa429da=_0xcd61[_0x36e3fc];return _0xa429da;};'use strict';var WhatsappQueueEvents=require(_0x1cd6('0x0'));var events=[_0x1cd6('0x1'),_0x1cd6('0x2'),_0x1cd6('0x3')];function createListener(_0x21e343,_0x4226a5){return function(_0x4c0a18){_0x4226a5[_0x1cd6('0x4')](_0x21e343,_0x4c0a18);};}function removeListener(_0x4c274d,_0x91a0ba){return function(){WhatsappQueueEvents['removeListener'](_0x4c274d,_0x91a0ba);};}exports['register']=function(_0x505f41){for(var _0x32a9d8=0x0,_0x38ec19=events[_0x1cd6('0x5')];_0x32a9d8<_0x38ec19;_0x32a9d8++){var _0x40a986=events[_0x32a9d8];var _0x102dff=createListener(_0x1cd6('0x6')+_0x40a986,_0x505f41);WhatsappQueueEvents['on'](_0x40a986,_0x102dff);}}; \ No newline at end of file +var _0x462f=['length','whatsappQueue:','remove','update','emit','removeListener','register'];(function(_0x41a887,_0x86c36f){var _0x4b434b=function(_0x297c8f){while(--_0x297c8f){_0x41a887['push'](_0x41a887['shift']());}};_0x4b434b(++_0x86c36f);}(_0x462f,0x10c));var _0xf462=function(_0x3a7634,_0x2db384){_0x3a7634=_0x3a7634-0x0;var _0x23bbe9=_0x462f[_0x3a7634];return _0x23bbe9;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=['save',_0xf462('0x0'),_0xf462('0x1')];function createListener(_0x3e256f,_0x300217){return function(_0x1f4741){_0x300217[_0xf462('0x2')](_0x3e256f,_0x1f4741);};}function removeListener(_0x4a6069,_0x5e3dd8){return function(){WhatsappQueueEvents[_0xf462('0x3')](_0x4a6069,_0x5e3dd8);};}exports[_0xf462('0x4')]=function(_0x508923){for(var _0xf4b77d=0x0,_0x341af0=events[_0xf462('0x5')];_0xf4b77d<_0x341af0;_0xf4b77d++){var _0xfa2ff=events[_0xf4b77d];var _0x56df40=createListener(_0xf462('0x6')+_0xfa2ff,_0x508923);WhatsappQueueEvents['on'](_0xfa2ff,_0x56df40);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 40ab015..8625bd3 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 _0x2f18=['describe','/:id','isAuthenticated','show','post','update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','./whatsappQueueReport.controller','get','index','/describe'];(function(_0x218739,_0x3ea56e){var _0x4bffd6=function(_0x2210bf){while(--_0x2210bf){_0x218739['push'](_0x218739['shift']());}};_0x4bffd6(++_0x3ea56e);}(_0x2f18,0xe0));var _0x82f1=function(_0x1f6ee8,_0x2a2662){_0x1f6ee8=_0x1f6ee8-0x0;var _0x4dcc0d=_0x2f18[_0x1f6ee8];return _0x4dcc0d;};'use strict';var multer=require(_0x82f1('0x0'));var util=require(_0x82f1('0x1'));var path=require('path');var timeout=require(_0x82f1('0x2'));var express=require(_0x82f1('0x3'));var router=express['Router']();var fs_extra=require(_0x82f1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x82f1('0x5'));var config=require('../../config/environment');var controller=require(_0x82f1('0x6'));router[_0x82f1('0x7')]('/',auth['isAuthenticated'](),controller[_0x82f1('0x8')]);router['get'](_0x82f1('0x9'),auth['isAuthenticated'](),controller[_0x82f1('0xa')]);router[_0x82f1('0x7')](_0x82f1('0xb'),auth[_0x82f1('0xc')](),controller[_0x82f1('0xd')]);router[_0x82f1('0xe')]('/',auth[_0x82f1('0xc')](),controller['create']);router['put'](_0x82f1('0xb'),auth[_0x82f1('0xc')](),controller[_0x82f1('0xf')]);router['delete'](_0x82f1('0xb'),auth[_0x82f1('0xc')](),controller[_0x82f1('0x10')]);module[_0x82f1('0x11')]=router; \ No newline at end of file +var _0x8346=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8346,0x1b7));var _0x6834=function(_0x229250,_0x42737b){_0x229250=_0x229250-0x0;var _0x4d31b6=_0x8346[_0x229250];return _0x4d31b6;};'use strict';var multer=require(_0x6834('0x0'));var util=require(_0x6834('0x1'));var path=require('path');var timeout=require(_0x6834('0x2'));var express=require(_0x6834('0x3'));var router=express[_0x6834('0x4')]();var fs_extra=require(_0x6834('0x5'));var auth=require(_0x6834('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6834('0x7'));var controller=require(_0x6834('0x8'));router[_0x6834('0x9')]('/',auth[_0x6834('0xa')](),controller['index']);router[_0x6834('0x9')](_0x6834('0xb'),auth['isAuthenticated'](),controller[_0x6834('0xc')]);router['get'](_0x6834('0xd'),auth[_0x6834('0xa')](),controller[_0x6834('0xe')]);router['post']('/',auth[_0x6834('0xa')](),controller[_0x6834('0xf')]);router[_0x6834('0x10')](_0x6834('0xd'),auth['isAuthenticated'](),controller[_0x6834('0x11')]);router[_0x6834('0x12')](_0x6834('0xd'),auth[_0x6834('0xa')](),controller[_0x6834('0x13')]);module[_0x6834('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 6d4dd61..89d2c6d 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(_0x5185a3,_0xb988f1){var _0x479429=function(_0x4080ef){while(--_0x4080ef){_0x5185a3['push'](_0x5185a3['shift']());}};_0x479429(++_0xb988f1);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x22c84b,_0x2cad20){var _0x36ec7c=function(_0x2caba2){while(--_0x2caba2){_0x22c84b['push'](_0x22c84b['shift']());}};_0x36ec7c(++_0x2cad20);}(_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 b8bd0ea..dccbd5b 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 _0x3f8c=['end','json','offset','limit','count','Content-Range','reject','save','update','then','error','stack','name','send','index','WhatsappQueueReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','create','body','find','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x54203e,_0x1db8db){var _0xe307cf=function(_0x933016){while(--_0x933016){_0x54203e['push'](_0x54203e['shift']());}};_0xe307cf(++_0x1db8db);}(_0x3f8c,0x104));var _0xc3f8=function(_0x4c02fd,_0x152531){_0x4c02fd=_0x4c02fd-0x0;var _0x3fbcff=_0x3f8c[_0x4c02fd];return _0x3fbcff;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc3f8('0x0'));var jsonpatch=require(_0xc3f8('0x1'));var rp=require(_0xc3f8('0x2'));var moment=require(_0xc3f8('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc3f8('0x4'));var ejs=require(_0xc3f8('0x5'));var fs=require('fs');var fs_extra=require(_0xc3f8('0x6'));var _=require(_0xc3f8('0x7'));var squel=require(_0xc3f8('0x8'));var crypto=require(_0xc3f8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc3f8('0xa'));var toCsv=require(_0xc3f8('0x4'));var querystring=require(_0xc3f8('0xb'));var Papa=require(_0xc3f8('0xc'));var Redis=require(_0xc3f8('0xd'));var authService=require(_0xc3f8('0xe'));var qs=require(_0xc3f8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3f8('0x10'));var logger=require(_0xc3f8('0x11'))(_0xc3f8('0x12'));var utils=require(_0xc3f8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc3f8('0x14'));var db=require(_0xc3f8('0x15'))['db'];function respondWithStatusCode(_0x256e3d,_0x155c80){_0x155c80=_0x155c80||0xcc;return function(_0x511763){if(_0x511763){return _0x256e3d[_0xc3f8('0x16')](_0x155c80);}return _0x256e3d[_0xc3f8('0x17')](_0x155c80)[_0xc3f8('0x18')]();};}function respondWithResult(_0x44632a,_0x6155e9){_0x6155e9=_0x6155e9||0xc8;return function(_0x47754c){if(_0x47754c){return _0x44632a[_0xc3f8('0x17')](_0x6155e9)[_0xc3f8('0x19')](_0x47754c);}};}function respondWithFilteredResult(_0x12b141,_0x2fd8e8){return function(_0x3cb28a){if(_0x3cb28a){var _0x2a9f64=typeof _0x2fd8e8[_0xc3f8('0x1a')]==='undefined'&&typeof _0x2fd8e8[_0xc3f8('0x1b')]==='undefined';var _0x51807b=_0x3cb28a[_0xc3f8('0x1c')];var _0x2e7c0f=_0x2a9f64?0x0:_0x2fd8e8[_0xc3f8('0x1a')];var _0xb4ab67=_0x2a9f64?_0x3cb28a['count']:_0x2fd8e8[_0xc3f8('0x1a')]+_0x2fd8e8[_0xc3f8('0x1b')];var _0x5df6f9;if(_0xb4ab67>=_0x51807b){_0xb4ab67=_0x51807b;_0x5df6f9=0xc8;}else{_0x5df6f9=0xce;}_0x12b141[_0xc3f8('0x17')](_0x5df6f9);return _0x12b141['set'](_0xc3f8('0x1d'),_0x2e7c0f+'-'+_0xb4ab67+'/'+_0x51807b)[_0xc3f8('0x19')](_0x3cb28a);}return null;};}function patchUpdates(_0x3b2e98){return function(_0x53ada5){try{jsonpatch['apply'](_0x53ada5,_0x3b2e98,!![]);}catch(_0x113cd2){return BPromise[_0xc3f8('0x1e')](_0x113cd2);}return _0x53ada5[_0xc3f8('0x1f')]();};}function saveUpdates(_0x25a4c7,_0x6522e9){return function(_0x251bf7){if(_0x251bf7){return _0x251bf7[_0xc3f8('0x20')](_0x25a4c7)[_0xc3f8('0x21')](function(_0x49aeea){return _0x49aeea;});}return null;};}function removeEntity(_0x571f92,_0x4b83f0){return function(_0x2559a4){if(_0x2559a4){return _0x2559a4['destroy']()[_0xc3f8('0x21')](function(){_0x571f92[_0xc3f8('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4569c2,_0x327b2d){return function(_0x2d237e){if(!_0x2d237e){_0x4569c2[_0xc3f8('0x16')](0x194);}return _0x2d237e;};}function handleError(_0x25088f,_0x9d43b4){_0x9d43b4=_0x9d43b4||0x1f4;return function(_0xf1d460){logger[_0xc3f8('0x22')](_0xf1d460[_0xc3f8('0x23')]);if(_0xf1d460[_0xc3f8('0x24')]){delete _0xf1d460[_0xc3f8('0x24')];}_0x25088f[_0xc3f8('0x17')](_0x9d43b4)[_0xc3f8('0x25')](_0xf1d460);};}exports[_0xc3f8('0x26')]=function(_0x59e4dd,_0x58b303){var _0x2909f8={},_0x218029={},_0x5bf6e2={'count':0x0,'rows':[]};var _0x151bba=_['map'](db[_0xc3f8('0x27')][_0xc3f8('0x28')],function(_0x47ab53){return{'name':_0x47ab53['fieldName'],'type':_0x47ab53[_0xc3f8('0x29')][_0xc3f8('0x2a')]};});_0x218029[_0xc3f8('0x2b')]=_[_0xc3f8('0x2c')](_0x151bba,_0xc3f8('0x24'));_0x218029[_0xc3f8('0x2d')]=_[_0xc3f8('0x2e')](_0x59e4dd[_0xc3f8('0x2d')]);_0x218029[_0xc3f8('0x2f')]=_[_0xc3f8('0x30')](_0x218029['model'],_0x218029[_0xc3f8('0x2d')]);_0x2909f8[_0xc3f8('0x31')]=_[_0xc3f8('0x30')](_0x218029[_0xc3f8('0x2b')],qs[_0xc3f8('0x32')](_0x59e4dd['query']['fields']));_0x2909f8[_0xc3f8('0x31')]=_0x2909f8[_0xc3f8('0x31')][_0xc3f8('0x33')]?_0x2909f8[_0xc3f8('0x31')]:_0x218029[_0xc3f8('0x2b')];if(!_0x59e4dd['query'][_0xc3f8('0x34')](_0xc3f8('0x35'))){_0x2909f8[_0xc3f8('0x1b')]=qs['limit'](_0x59e4dd[_0xc3f8('0x2d')][_0xc3f8('0x1b')]);_0x2909f8[_0xc3f8('0x1a')]=qs['offset'](_0x59e4dd[_0xc3f8('0x2d')][_0xc3f8('0x1a')]);}_0x2909f8['order']=qs[_0xc3f8('0x36')](_0x59e4dd[_0xc3f8('0x2d')][_0xc3f8('0x36')]);_0x2909f8[_0xc3f8('0x37')]=qs[_0xc3f8('0x2f')](_[_0xc3f8('0x38')](_0x59e4dd['query'],_0x218029[_0xc3f8('0x2f')]),_0x151bba);if(_0x59e4dd[_0xc3f8('0x2d')][_0xc3f8('0x39')]){_0x2909f8[_0xc3f8('0x37')]=_[_0xc3f8('0x3a')](_0x2909f8['where'],{'$or':_[_0xc3f8('0x2c')](_0x151bba,function(_0x4451a2){if(_0x4451a2[_0xc3f8('0x29')]!=='VIRTUAL'){var _0x316643={};_0x316643[_0x4451a2[_0xc3f8('0x24')]]={'$like':'%'+_0x59e4dd[_0xc3f8('0x2d')][_0xc3f8('0x39')]+'%'};return _0x316643;}})});}_0x2909f8=_['merge']({},_0x2909f8,_0x59e4dd[_0xc3f8('0x3b')]);var _0x45d416={'where':_0x2909f8[_0xc3f8('0x37')]};return db[_0xc3f8('0x27')]['count'](_0x45d416)[_0xc3f8('0x21')](function(_0x5db44d){_0x5bf6e2['count']=_0x5db44d;if(_0x59e4dd[_0xc3f8('0x2d')][_0xc3f8('0x3c')]){_0x2909f8[_0xc3f8('0x3d')]=[{'all':!![]}];}return db[_0xc3f8('0x27')]['findAll'](_0x2909f8);})['then'](function(_0x361a85){_0x5bf6e2[_0xc3f8('0x3e')]=_0x361a85;return _0x5bf6e2;})[_0xc3f8('0x21')](respondWithFilteredResult(_0x58b303,_0x2909f8))[_0xc3f8('0x3f')](handleError(_0x58b303,null));};exports[_0xc3f8('0x40')]=function(_0x465547,_0x3113b4){var _0x45e6ea={'raw':!![],'where':{'id':_0x465547[_0xc3f8('0x41')]['id']}},_0x13d8dc={};_0x13d8dc[_0xc3f8('0x2b')]=_['keys'](db[_0xc3f8('0x27')][_0xc3f8('0x28')]);_0x13d8dc['query']=_[_0xc3f8('0x2e')](_0x465547[_0xc3f8('0x2d')]);_0x13d8dc['filters']=_[_0xc3f8('0x30')](_0x13d8dc[_0xc3f8('0x2b')],_0x13d8dc[_0xc3f8('0x2d')]);_0x45e6ea[_0xc3f8('0x31')]=_[_0xc3f8('0x30')](_0x13d8dc[_0xc3f8('0x2b')],qs[_0xc3f8('0x32')](_0x465547[_0xc3f8('0x2d')][_0xc3f8('0x32')]));_0x45e6ea[_0xc3f8('0x31')]=_0x45e6ea[_0xc3f8('0x31')]['length']?_0x45e6ea[_0xc3f8('0x31')]:_0x13d8dc[_0xc3f8('0x2b')];if(_0x465547['query'][_0xc3f8('0x3c')]){_0x45e6ea[_0xc3f8('0x3d')]=[{'all':!![]}];}_0x45e6ea=_[_0xc3f8('0x3a')]({},_0x45e6ea,_0x465547[_0xc3f8('0x3b')]);return db['WhatsappQueueReport']['find'](_0x45e6ea)[_0xc3f8('0x21')](handleEntityNotFound(_0x3113b4,null))[_0xc3f8('0x21')](respondWithResult(_0x3113b4,null))[_0xc3f8('0x3f')](handleError(_0x3113b4,null));};exports['create']=function(_0x1b5777,_0x3a665e){return db[_0xc3f8('0x27')][_0xc3f8('0x42')](_0x1b5777[_0xc3f8('0x43')],{})['then'](respondWithResult(_0x3a665e,0xc9))[_0xc3f8('0x3f')](handleError(_0x3a665e,null));};exports[_0xc3f8('0x20')]=function(_0x5961ab,_0x1becae){if(_0x5961ab[_0xc3f8('0x43')]['id']){delete _0x5961ab[_0xc3f8('0x43')]['id'];}return db[_0xc3f8('0x27')][_0xc3f8('0x44')]({'where':{'id':_0x5961ab[_0xc3f8('0x41')]['id']}})[_0xc3f8('0x21')](handleEntityNotFound(_0x1becae,null))['then'](saveUpdates(_0x5961ab[_0xc3f8('0x43')],null))[_0xc3f8('0x21')](respondWithResult(_0x1becae,null))['catch'](handleError(_0x1becae,null));};exports[_0xc3f8('0x45')]=function(_0x2e9f93,_0x2448bf){return db[_0xc3f8('0x27')][_0xc3f8('0x44')]({'where':{'id':_0x2e9f93[_0xc3f8('0x41')]['id']}})[_0xc3f8('0x21')](handleEntityNotFound(_0x2448bf,null))['then'](removeEntity(_0x2448bf,null))[_0xc3f8('0x3f')](handleError(_0x2448bf,null));};exports[_0xc3f8('0x46')]=function(_0x425fee,_0x267c95){return db[_0xc3f8('0x27')][_0xc3f8('0x46')]()[_0xc3f8('0x21')](respondWithResult(_0x267c95,null))[_0xc3f8('0x3f')](handleError(_0x267c95,null));}; \ No newline at end of file +var _0x1399=['rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','params','keys','find','catch','body','destroy','describe','eml-format'];(function(_0x47b7b2,_0x11acff){var _0x2dc3ca=function(_0x1a7dee){while(--_0x1a7dee){_0x47b7b2['push'](_0x47b7b2['shift']());}};_0x2dc3ca(++_0x11acff);}(_0x1399,0x16c));var _0x9139=function(_0x204e8f,_0x551d92){_0x204e8f=_0x204e8f-0x0;var _0x75770=_0x1399[_0x204e8f];return _0x75770;};'use strict';var emlformat=require(_0x9139('0x0'));var rimraf=require(_0x9139('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9139('0x2'));var rp=require('request-promise');var moment=require(_0x9139('0x3'));var BPromise=require(_0x9139('0x4'));var Mustache=require(_0x9139('0x5'));var util=require(_0x9139('0x6'));var path=require(_0x9139('0x7'));var sox=require(_0x9139('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9139('0x9'));var _=require(_0x9139('0xa'));var squel=require(_0x9139('0xb'));var crypto=require('crypto');var jsforce=require(_0x9139('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9139('0xd'));var Papa=require(_0x9139('0xe'));var Redis=require('ioredis');var authService=require(_0x9139('0xf'));var qs=require(_0x9139('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9139('0x11'))(_0x9139('0x12'));var utils=require(_0x9139('0x13'));var config=require(_0x9139('0x14'));var licenseUtil=require(_0x9139('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52b32d,_0x511ec9){_0x511ec9=_0x511ec9||0xcc;return function(_0x417637){if(_0x417637){return _0x52b32d['sendStatus'](_0x511ec9);}return _0x52b32d[_0x9139('0x16')](_0x511ec9)[_0x9139('0x17')]();};}function respondWithResult(_0x375ada,_0x262009){_0x262009=_0x262009||0xc8;return function(_0x5936d2){if(_0x5936d2){return _0x375ada[_0x9139('0x16')](_0x262009)['json'](_0x5936d2);}};}function respondWithFilteredResult(_0x58307f,_0x52c57b){return function(_0x159e50){if(_0x159e50){var _0x3e2bad=typeof _0x52c57b[_0x9139('0x18')]===_0x9139('0x19')&&typeof _0x52c57b[_0x9139('0x1a')]===_0x9139('0x19');var _0x4bd957=_0x159e50['count'];var _0x13cab8=_0x3e2bad?0x0:_0x52c57b[_0x9139('0x18')];var _0x5e0a59=_0x3e2bad?_0x159e50['count']:_0x52c57b[_0x9139('0x18')]+_0x52c57b[_0x9139('0x1a')];var _0x56add4;if(_0x5e0a59>=_0x4bd957){_0x5e0a59=_0x4bd957;_0x56add4=0xc8;}else{_0x56add4=0xce;}_0x58307f[_0x9139('0x16')](_0x56add4);return _0x58307f[_0x9139('0x1b')](_0x9139('0x1c'),_0x13cab8+'-'+_0x5e0a59+'/'+_0x4bd957)[_0x9139('0x1d')](_0x159e50);}return null;};}function patchUpdates(_0xd2eb33){return function(_0x6f901b){try{jsonpatch[_0x9139('0x1e')](_0x6f901b,_0xd2eb33,!![]);}catch(_0x45fa16){return BPromise[_0x9139('0x1f')](_0x45fa16);}return _0x6f901b[_0x9139('0x20')]();};}function saveUpdates(_0x1bac18,_0x269f8a){return function(_0x5a3e2e){if(_0x5a3e2e){return _0x5a3e2e[_0x9139('0x21')](_0x1bac18)[_0x9139('0x22')](function(_0x31635a){return _0x31635a;});}return null;};}function removeEntity(_0x1aee3b,_0x934732){return function(_0x1a7350){if(_0x1a7350){return _0x1a7350['destroy']()[_0x9139('0x22')](function(){_0x1aee3b[_0x9139('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ed4da,_0x2ee4bb){return function(_0x10bfa0){if(!_0x10bfa0){_0x3ed4da['sendStatus'](0x194);}return _0x10bfa0;};}function handleError(_0x4118dc,_0xffd487){_0xffd487=_0xffd487||0x1f4;return function(_0x49d01e){logger[_0x9139('0x23')](_0x49d01e[_0x9139('0x24')]);if(_0x49d01e[_0x9139('0x25')]){delete _0x49d01e['name'];}_0x4118dc[_0x9139('0x16')](_0xffd487)[_0x9139('0x26')](_0x49d01e);};}exports[_0x9139('0x27')]=function(_0x22994c,_0x215194){var _0x16dfb4={},_0xfe6854={},_0x573a05={'count':0x0,'rows':[]};var _0x55cc6a=_[_0x9139('0x28')](db[_0x9139('0x29')][_0x9139('0x2a')],function(_0x4c1693){return{'name':_0x4c1693['fieldName'],'type':_0x4c1693[_0x9139('0x2b')][_0x9139('0x2c')]};});_0xfe6854[_0x9139('0x2d')]=_[_0x9139('0x28')](_0x55cc6a,_0x9139('0x25'));_0xfe6854['query']=_['keys'](_0x22994c[_0x9139('0x2e')]);_0xfe6854['filters']=_['intersection'](_0xfe6854[_0x9139('0x2d')],_0xfe6854[_0x9139('0x2e')]);_0x16dfb4['attributes']=_[_0x9139('0x2f')](_0xfe6854[_0x9139('0x2d')],qs['fields'](_0x22994c[_0x9139('0x2e')][_0x9139('0x30')]));_0x16dfb4[_0x9139('0x31')]=_0x16dfb4[_0x9139('0x31')][_0x9139('0x32')]?_0x16dfb4[_0x9139('0x31')]:_0xfe6854[_0x9139('0x2d')];if(!_0x22994c[_0x9139('0x2e')][_0x9139('0x33')](_0x9139('0x34'))){_0x16dfb4[_0x9139('0x1a')]=qs['limit'](_0x22994c[_0x9139('0x2e')][_0x9139('0x1a')]);_0x16dfb4['offset']=qs[_0x9139('0x18')](_0x22994c[_0x9139('0x2e')][_0x9139('0x18')]);}_0x16dfb4['order']=qs[_0x9139('0x35')](_0x22994c[_0x9139('0x2e')][_0x9139('0x35')]);_0x16dfb4[_0x9139('0x36')]=qs[_0x9139('0x37')](_[_0x9139('0x38')](_0x22994c[_0x9139('0x2e')],_0xfe6854[_0x9139('0x37')]),_0x55cc6a);if(_0x22994c[_0x9139('0x2e')][_0x9139('0x39')]){_0x16dfb4['where']=_[_0x9139('0x3a')](_0x16dfb4[_0x9139('0x36')],{'$or':_[_0x9139('0x28')](_0x55cc6a,function(_0x2cebb9){if(_0x2cebb9[_0x9139('0x2b')]!==_0x9139('0x3b')){var _0x1ea313={};_0x1ea313[_0x2cebb9['name']]={'$like':'%'+_0x22994c[_0x9139('0x2e')]['filter']+'%'};return _0x1ea313;}})});}_0x16dfb4=_[_0x9139('0x3a')]({},_0x16dfb4,_0x22994c[_0x9139('0x3c')]);var _0x3fb4db={'where':_0x16dfb4['where']};return db[_0x9139('0x29')][_0x9139('0x3d')](_0x3fb4db)[_0x9139('0x22')](function(_0x236513){_0x573a05[_0x9139('0x3d')]=_0x236513;if(_0x22994c[_0x9139('0x2e')][_0x9139('0x3e')]){_0x16dfb4[_0x9139('0x3f')]=[{'all':!![]}];}return db[_0x9139('0x29')][_0x9139('0x40')](_0x16dfb4);})['then'](function(_0xf14393){_0x573a05[_0x9139('0x41')]=_0xf14393;return _0x573a05;})[_0x9139('0x22')](respondWithFilteredResult(_0x215194,_0x16dfb4))['catch'](handleError(_0x215194,null));};exports['show']=function(_0x4d9670,_0x465f49){var _0x12ba4b={'raw':!![],'where':{'id':_0x4d9670[_0x9139('0x42')]['id']}},_0x3611b4={};_0x3611b4[_0x9139('0x2d')]=_['keys'](db[_0x9139('0x29')][_0x9139('0x2a')]);_0x3611b4[_0x9139('0x2e')]=_[_0x9139('0x43')](_0x4d9670[_0x9139('0x2e')]);_0x3611b4['filters']=_[_0x9139('0x2f')](_0x3611b4[_0x9139('0x2d')],_0x3611b4[_0x9139('0x2e')]);_0x12ba4b[_0x9139('0x31')]=_['intersection'](_0x3611b4['model'],qs[_0x9139('0x30')](_0x4d9670[_0x9139('0x2e')]['fields']));_0x12ba4b['attributes']=_0x12ba4b[_0x9139('0x31')][_0x9139('0x32')]?_0x12ba4b['attributes']:_0x3611b4[_0x9139('0x2d')];if(_0x4d9670[_0x9139('0x2e')]['includeAll']){_0x12ba4b[_0x9139('0x3f')]=[{'all':!![]}];}_0x12ba4b=_['merge']({},_0x12ba4b,_0x4d9670['options']);return db[_0x9139('0x29')][_0x9139('0x44')](_0x12ba4b)[_0x9139('0x22')](handleEntityNotFound(_0x465f49,null))[_0x9139('0x22')](respondWithResult(_0x465f49,null))[_0x9139('0x45')](handleError(_0x465f49,null));};exports['create']=function(_0x3e126c,_0xc55b16){return db[_0x9139('0x29')]['create'](_0x3e126c[_0x9139('0x46')],{})[_0x9139('0x22')](respondWithResult(_0xc55b16,0xc9))[_0x9139('0x45')](handleError(_0xc55b16,null));};exports[_0x9139('0x21')]=function(_0x215793,_0x31395f){if(_0x215793[_0x9139('0x46')]['id']){delete _0x215793[_0x9139('0x46')]['id'];}return db[_0x9139('0x29')][_0x9139('0x44')]({'where':{'id':_0x215793[_0x9139('0x42')]['id']}})['then'](handleEntityNotFound(_0x31395f,null))[_0x9139('0x22')](saveUpdates(_0x215793[_0x9139('0x46')],null))[_0x9139('0x22')](respondWithResult(_0x31395f,null))['catch'](handleError(_0x31395f,null));};exports[_0x9139('0x47')]=function(_0x46f77a,_0x557c93){return db[_0x9139('0x29')][_0x9139('0x44')]({'where':{'id':_0x46f77a[_0x9139('0x42')]['id']}})['then'](handleEntityNotFound(_0x557c93,null))[_0x9139('0x22')](removeEntity(_0x557c93,null))[_0x9139('0x45')](handleError(_0x557c93,null));};exports[_0x9139('0x48')]=function(_0x23669b,_0x51ecf6){return db[_0x9139('0x29')][_0x9139('0x48')]()[_0x9139('0x22')](respondWithResult(_0x51ecf6,null))['catch'](handleError(_0x51ecf6,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 63ac9f7..f272312 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 _0x4781=['uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define'];(function(_0x3f823d,_0x3896b0){var _0x5bbef9=function(_0x3b11dd){while(--_0x3b11dd){_0x3f823d['push'](_0x3f823d['shift']());}};_0x5bbef9(++_0x3896b0);}(_0x4781,0x76));var _0x1478=function(_0x272e07,_0x575bd2){_0x272e07=_0x272e07-0x0;var _0x4b19de=_0x4781[_0x272e07];return _0x4b19de;};'use strict';var _=require(_0x1478('0x0'));var util=require('util');var logger=require(_0x1478('0x1'))(_0x1478('0x2'));var moment=require(_0x1478('0x3'));var BPromise=require(_0x1478('0x4'));var rp=require(_0x1478('0x5'));var fs=require('fs');var path=require(_0x1478('0x6'));var rimraf=require(_0x1478('0x7'));var config=require(_0x1478('0x8'));var attributes=require(_0x1478('0x9'));module[_0x1478('0xa')]=function(_0x11da3c,_0x25f42b){return _0x11da3c[_0x1478('0xb')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x1478('0xc'),'fields':[_0x1478('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x44c9=['path','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','../../config/logger','api','moment','bluebird'];(function(_0x19e3c2,_0x177a95){var _0x2bb88f=function(_0x165f84){while(--_0x165f84){_0x19e3c2['push'](_0x19e3c2['shift']());}};_0x2bb88f(++_0x177a95);}(_0x44c9,0x18e));var _0x944c=function(_0x5df3ab,_0x4a0a7e){_0x5df3ab=_0x5df3ab-0x0;var _0x42cce5=_0x44c9[_0x5df3ab];return _0x42cce5;};'use strict';var _=require('lodash');var util=require(_0x944c('0x0'));var logger=require(_0x944c('0x1'))(_0x944c('0x2'));var moment=require(_0x944c('0x3'));var BPromise=require(_0x944c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x944c('0x5'));var rimraf=require('rimraf');var config=require(_0x944c('0x6'));var attributes=require(_0x944c('0x7'));module[_0x944c('0x8')]=function(_0x277c7e,_0x50f656){return _0x277c7e[_0x944c('0x9')](_0x944c('0xa'),attributes,{'tableName':_0x944c('0xb'),'paranoid':![],'indexes':[{'name':_0x944c('0xc'),'fields':[_0x944c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 25162b7..636ae1e 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 _0xd206=['../../config/utils','../../config/environment','jayson/promise','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','UpdateWhatsappQueueReport','body','raw','where','attributes','lodash','randomstring','ioredis'];(function(_0x567e9e,_0x53a545){var _0xf8e116=function(_0x1f7352){while(--_0x1f7352){_0x567e9e['push'](_0x567e9e['shift']());}};_0xf8e116(++_0x53a545);}(_0xd206,0x89));var _0x6d20=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0xd206[_0x2080a3];return _0x8d7d17;};'use strict';var _=require(_0x6d20('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6d20('0x1'));var fs=require('fs');var Redis=require(_0x6d20('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d20('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x6d20('0x4'));var jayson=require(_0x6d20('0x5'));var client=jayson['client'][_0x6d20('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1c50e2,_0x43bf60,_0x1969a1){return new BPromise(function(_0x331f24,_0x9ecd59){return client[_0x6d20('0x7')](_0x1c50e2,_0x1969a1)[_0x6d20('0x8')](function(_0x3c8d42){logger[_0x6d20('0x9')](_0x6d20('0xa'),_0x43bf60,_0x6d20('0xb'));logger[_0x6d20('0xc')](_0x6d20('0xd'),_0x43bf60,'request\x20sent',JSON[_0x6d20('0xe')](_0x3c8d42));if(_0x3c8d42['error']){if(_0x3c8d42[_0x6d20('0xf')]['code']===0x1f4){logger[_0x6d20('0xf')](_0x6d20('0xa'),_0x43bf60,_0x3c8d42[_0x6d20('0xf')][_0x6d20('0x10')]);return _0x9ecd59(_0x3c8d42[_0x6d20('0xf')][_0x6d20('0x10')]);}logger['error'](_0x6d20('0xa'),_0x43bf60,_0x3c8d42[_0x6d20('0xf')][_0x6d20('0x10')]);return _0x331f24(_0x3c8d42['error'][_0x6d20('0x10')]);}else{logger['info'](_0x6d20('0xa'),_0x43bf60,_0x6d20('0xb'));_0x331f24(_0x3c8d42[_0x6d20('0x11')][_0x6d20('0x10')]);}})[_0x6d20('0x12')](function(_0x2acb7b){logger[_0x6d20('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0x43bf60,_0x2acb7b);_0x9ecd59(_0x2acb7b);});});}exports[_0x6d20('0x13')]=function(_0x4e83a1){var _0x48f2dc=this;return new Promise(function(_0x3dc1cc,_0x2a3fde){return db[_0x6d20('0x14')][_0x6d20('0x15')](_0x4e83a1['body'],{'raw':_0x4e83a1['options']?_0x4e83a1[_0x6d20('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x6d20('0x8')](function(_0x45cb18){logger[_0x6d20('0x9')](_0x6d20('0x13'),_0x4e83a1);logger[_0x6d20('0xc')](_0x6d20('0x13'),_0x4e83a1,JSON[_0x6d20('0xe')](_0x45cb18));_0x3dc1cc(_0x45cb18);})['catch'](function(_0x5164a1){logger[_0x6d20('0xf')](_0x6d20('0x13'),_0x5164a1[_0x6d20('0x10')],_0x4e83a1);_0x2a3fde(_0x48f2dc[_0x6d20('0xf')](0x1f4,_0x5164a1['message']));});});};exports[_0x6d20('0x17')]=function(_0x103aa7){var _0x24041c=this;return new Promise(function(_0x85c93f,_0x36ac35){return db[_0x6d20('0x14')]['update'](_0x103aa7[_0x6d20('0x18')],{'raw':_0x103aa7[_0x6d20('0x16')]?_0x103aa7[_0x6d20('0x16')][_0x6d20('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x103aa7[_0x6d20('0x16')]?_0x103aa7['options'][_0x6d20('0x1a')]||null:null,'attributes':_0x103aa7[_0x6d20('0x16')]?_0x103aa7[_0x6d20('0x16')][_0x6d20('0x1b')]||null:null,'limit':_0x103aa7[_0x6d20('0x16')]?_0x103aa7['options']['limit']||null:null})[_0x6d20('0x8')](function(_0x3588b7){logger['info'](_0x6d20('0x17'),_0x103aa7);logger[_0x6d20('0xc')](_0x6d20('0x17'),_0x103aa7,JSON[_0x6d20('0xe')](_0x3588b7));_0x85c93f(_0x3588b7);})[_0x6d20('0x12')](function(_0x53fa7f){logger[_0x6d20('0xf')](_0x6d20('0x17'),_0x53fa7f[_0x6d20('0x10')],_0x103aa7);_0x36ac35(_0x24041c[_0x6d20('0xf')](0x1f4,_0x53fa7f[_0x6d20('0x10')]));});});}; \ No newline at end of file +var _0xdb90=['options','raw','catch','update','where','limit','then','UpdateWhatsappQueueReport','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','CreateWhatsappQueueReport','WhatsappQueueReport','body'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xdb90,0xf8));var _0x0db9=function(_0x4233a2,_0x478e28){_0x4233a2=_0x4233a2-0x0;var _0x1c420e=_0xdb90[_0x4233a2];return _0x1c420e;};'use strict';var _=require(_0x0db9('0x0'));var util=require(_0x0db9('0x1'));var moment=require('moment');var BPromise=require(_0x0db9('0x2'));var rs=require(_0x0db9('0x3'));var fs=require('fs');var Redis=require(_0x0db9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0db9('0x5'))('rpc');var config=require(_0x0db9('0x6'));var jayson=require(_0x0db9('0x7'));var client=jayson[_0x0db9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x301aed,_0x3ed6f3,_0x429d6b){return new BPromise(function(_0x1386ed,_0x4f973d){return client[_0x0db9('0x9')](_0x301aed,_0x429d6b)['then'](function(_0x15ea70){logger['info'](_0x0db9('0xa'),_0x3ed6f3,_0x0db9('0xb'));logger[_0x0db9('0xc')](_0x0db9('0xd'),_0x3ed6f3,_0x0db9('0xb'),JSON[_0x0db9('0xe')](_0x15ea70));if(_0x15ea70[_0x0db9('0xf')]){if(_0x15ea70[_0x0db9('0xf')]['code']===0x1f4){logger['error'](_0x0db9('0xa'),_0x3ed6f3,_0x15ea70[_0x0db9('0xf')]['message']);return _0x4f973d(_0x15ea70[_0x0db9('0xf')][_0x0db9('0x10')]);}logger[_0x0db9('0xf')](_0x0db9('0xa'),_0x3ed6f3,_0x15ea70[_0x0db9('0xf')][_0x0db9('0x10')]);return _0x1386ed(_0x15ea70[_0x0db9('0xf')]['message']);}else{logger[_0x0db9('0x11')](_0x0db9('0xa'),_0x3ed6f3,_0x0db9('0xb'));_0x1386ed(_0x15ea70[_0x0db9('0x12')]['message']);}})['catch'](function(_0x458c0b){logger[_0x0db9('0xf')](_0x0db9('0xa'),_0x3ed6f3,_0x458c0b);_0x4f973d(_0x458c0b);});});}exports[_0x0db9('0x13')]=function(_0x3b2e75){var _0x4ad919=this;return new Promise(function(_0x5e5ef8,_0x525527){return db[_0x0db9('0x14')]['create'](_0x3b2e75[_0x0db9('0x15')],{'raw':_0x3b2e75[_0x0db9('0x16')]?_0x3b2e75[_0x0db9('0x16')][_0x0db9('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x32c3b5){logger[_0x0db9('0x11')](_0x0db9('0x13'),_0x3b2e75);logger[_0x0db9('0xc')](_0x0db9('0x13'),_0x3b2e75,JSON[_0x0db9('0xe')](_0x32c3b5));_0x5e5ef8(_0x32c3b5);})[_0x0db9('0x18')](function(_0x27797e){logger[_0x0db9('0xf')](_0x0db9('0x13'),_0x27797e[_0x0db9('0x10')],_0x3b2e75);_0x525527(_0x4ad919[_0x0db9('0xf')](0x1f4,_0x27797e[_0x0db9('0x10')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x2f35a6){var _0x152453=this;return new Promise(function(_0x2287c6,_0x63680e){return db[_0x0db9('0x14')][_0x0db9('0x19')](_0x2f35a6[_0x0db9('0x15')],{'raw':_0x2f35a6[_0x0db9('0x16')]?_0x2f35a6[_0x0db9('0x16')][_0x0db9('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f35a6['options']?_0x2f35a6[_0x0db9('0x16')][_0x0db9('0x1a')]||null:null,'attributes':_0x2f35a6['options']?_0x2f35a6[_0x0db9('0x16')]['attributes']||null:null,'limit':_0x2f35a6[_0x0db9('0x16')]?_0x2f35a6[_0x0db9('0x16')][_0x0db9('0x1b')]||null:null})[_0x0db9('0x1c')](function(_0x47b783){logger[_0x0db9('0x11')](_0x0db9('0x1d'),_0x2f35a6);logger[_0x0db9('0xc')](_0x0db9('0x1d'),_0x2f35a6,JSON[_0x0db9('0xe')](_0x47b783));_0x2287c6(_0x47b783);})['catch'](function(_0x4eb1b9){logger[_0x0db9('0xf')](_0x0db9('0x1d'),_0x4eb1b9[_0x0db9('0x10')],_0x2f35a6);_0x63680e(_0x152453[_0x0db9('0xf')](0x1f4,_0x4eb1b9[_0x0db9('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 76c4ce0..b26adbc 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 _0xd5e0=['isAuthenticated','index','get','post','create','put','update','delete','/:id','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller'];(function(_0x514f19,_0x5d9b97){var _0x3706e1=function(_0x2ed7a3){while(--_0x2ed7a3){_0x514f19['push'](_0x514f19['shift']());}};_0x3706e1(++_0x5d9b97);}(_0xd5e0,0x196));var _0x0d5e=function(_0x42e4a0,_0x683fdf){_0x42e4a0=_0x42e4a0-0x0;var _0x34ddb0=_0xd5e0[_0x42e4a0];return _0x34ddb0;};'use strict';var multer=require(_0x0d5e('0x0'));var util=require(_0x0d5e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0d5e('0x2'));var router=express[_0x0d5e('0x3')]();var fs_extra=require(_0x0d5e('0x4'));var auth=require(_0x0d5e('0x5'));var interaction=require(_0x0d5e('0x6'));var config=require('../../config/environment');var controller=require(_0x0d5e('0x7'));router['get']('/',auth[_0x0d5e('0x8')](),controller[_0x0d5e('0x9')]);router[_0x0d5e('0xa')]('/describe',auth[_0x0d5e('0x8')](),controller['describe']);router['get']('/:id',auth[_0x0d5e('0x8')](),controller['show']);router[_0x0d5e('0xb')]('/',auth[_0x0d5e('0x8')](),controller[_0x0d5e('0xc')]);router[_0x0d5e('0xd')]('/:id',auth[_0x0d5e('0x8')](),controller[_0x0d5e('0xe')]);router[_0x0d5e('0xf')](_0x0d5e('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x0d5e('0x11')]=router; \ No newline at end of file +var _0xe921=['delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','./whatsappTransferReport.controller','get','isAuthenticated','/describe','describe','show','put','/:id','update'];(function(_0x3e47e4,_0x5aadf6){var _0x18011d=function(_0x137eab){while(--_0x137eab){_0x3e47e4['push'](_0x3e47e4['shift']());}};_0x18011d(++_0x5aadf6);}(_0xe921,0xdb));var _0x1e92=function(_0x1951bd,_0x41a2fd){_0x1951bd=_0x1951bd-0x0;var _0x58f1b3=_0xe921[_0x1951bd];return _0x58f1b3;};'use strict';var multer=require(_0x1e92('0x0'));var util=require(_0x1e92('0x1'));var path=require(_0x1e92('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1e92('0x3')]();var fs_extra=require(_0x1e92('0x4'));var auth=require(_0x1e92('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1e92('0x6'));router[_0x1e92('0x7')]('/',auth[_0x1e92('0x8')](),controller['index']);router[_0x1e92('0x7')](_0x1e92('0x9'),auth['isAuthenticated'](),controller[_0x1e92('0xa')]);router['get']('/:id',auth[_0x1e92('0x8')](),controller[_0x1e92('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x1e92('0xc')](_0x1e92('0xd'),auth[_0x1e92('0x8')](),controller[_0x1e92('0xe')]);router[_0x1e92('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x1e92('0x10')]);module[_0x1e92('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 654ce2c..170cac8 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 _0x9672=['ENUM','account','agent','queue','sequelize','exports'];(function(_0x82232,_0x4e9ec5){var _0x34cf23=function(_0x2ad71b){while(--_0x2ad71b){_0x82232['push'](_0x82232['shift']());}};_0x34cf23(++_0x4e9ec5);}(_0x9672,0xee));var _0x2967=function(_0x2f1542,_0xd12798){_0x2f1542=_0x2f1542-0x0;var _0x20d0d9=_0x9672[_0x2f1542];return _0x20d0d9;};'use strict';var Sequelize=require(_0x2967('0x0'));module[_0x2967('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2967('0x2')](_0x2967('0x3'),_0x2967('0x4'),_0x2967('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x0447=['exports','STRING','ENUM','account','queue','DATE','sequelize'];(function(_0x4e93a9,_0x413f30){var _0x43013c=function(_0x3a0cf3){while(--_0x3a0cf3){_0x4e93a9['push'](_0x4e93a9['shift']());}};_0x43013c(++_0x413f30);}(_0x0447,0x8b));var _0x7044=function(_0xf2f5de,_0x10038b){_0xf2f5de=_0xf2f5de-0x0;var _0x1be255=_0x0447[_0xf2f5de];return _0x1be255;};'use strict';var Sequelize=require(_0x7044('0x0'));module[_0x7044('0x1')]={'uniqueid':{'type':Sequelize[_0x7044('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7044('0x3')](_0x7044('0x4'),'agent',_0x7044('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x7044('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index dd734f7..ffcee2f 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 _0xb36f=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','error','stack','name','index','map','WhatsappTransferReport','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x2ccc71,_0x1c458a){var _0x20fa15=function(_0x320e61){while(--_0x320e61){_0x2ccc71['push'](_0x2ccc71['shift']());}};_0x20fa15(++_0x1c458a);}(_0xb36f,0x1d6));var _0xfb36=function(_0x437f52,_0x43b332){_0x437f52=_0x437f52-0x0;var _0x2a4634=_0xb36f[_0x437f52];return _0x2a4634;};'use strict';var emlformat=require(_0xfb36('0x0'));var rimraf=require(_0xfb36('0x1'));var zipdir=require(_0xfb36('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfb36('0x3'));var BPromise=require(_0xfb36('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfb36('0x5'));var sox=require(_0xfb36('0x6'));var csv=require('to-csv');var ejs=require(_0xfb36('0x7'));var fs=require('fs');var fs_extra=require(_0xfb36('0x8'));var _=require(_0xfb36('0x9'));var squel=require(_0xfb36('0xa'));var crypto=require('crypto');var jsforce=require(_0xfb36('0xb'));var deskjs=require(_0xfb36('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfb36('0xd'));var authService=require(_0xfb36('0xe'));var qs=require(_0xfb36('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb36('0x10'));var logger=require('../../config/logger')(_0xfb36('0x11'));var utils=require(_0xfb36('0x12'));var config=require(_0xfb36('0x13'));var licenseUtil=require(_0xfb36('0x14'));var db=require(_0xfb36('0x15'))['db'];function respondWithStatusCode(_0x241bf6,_0x4ff9b3){_0x4ff9b3=_0x4ff9b3||0xcc;return function(_0x46e0ad){if(_0x46e0ad){return _0x241bf6[_0xfb36('0x16')](_0x4ff9b3);}return _0x241bf6[_0xfb36('0x17')](_0x4ff9b3)[_0xfb36('0x18')]();};}function respondWithResult(_0x2b8cad,_0x53260c){_0x53260c=_0x53260c||0xc8;return function(_0x3c4149){if(_0x3c4149){return _0x2b8cad[_0xfb36('0x17')](_0x53260c)[_0xfb36('0x19')](_0x3c4149);}};}function respondWithFilteredResult(_0x5ca6a3,_0x1aa5ae){return function(_0x4b8474){if(_0x4b8474){var _0x23082f=typeof _0x1aa5ae['offset']===_0xfb36('0x1a')&&typeof _0x1aa5ae[_0xfb36('0x1b')]===_0xfb36('0x1a');var _0x5f3e31=_0x4b8474[_0xfb36('0x1c')];var _0x58ca4f=_0x23082f?0x0:_0x1aa5ae[_0xfb36('0x1d')];var _0x4b7d65=_0x23082f?_0x4b8474['count']:_0x1aa5ae[_0xfb36('0x1d')]+_0x1aa5ae[_0xfb36('0x1b')];var _0x43efe5;if(_0x4b7d65>=_0x5f3e31){_0x4b7d65=_0x5f3e31;_0x43efe5=0xc8;}else{_0x43efe5=0xce;}_0x5ca6a3['status'](_0x43efe5);return _0x5ca6a3[_0xfb36('0x1e')](_0xfb36('0x1f'),_0x58ca4f+'-'+_0x4b7d65+'/'+_0x5f3e31)[_0xfb36('0x19')](_0x4b8474);}return null;};}function patchUpdates(_0x324536){return function(_0x11f54f){try{jsonpatch['apply'](_0x11f54f,_0x324536,!![]);}catch(_0xcb10da){return BPromise['reject'](_0xcb10da);}return _0x11f54f['save']();};}function saveUpdates(_0x3903a7,_0x27c742){return function(_0x3496a0){if(_0x3496a0){return _0x3496a0[_0xfb36('0x20')](_0x3903a7)[_0xfb36('0x21')](function(_0x477c13){return _0x477c13;});}return null;};}function removeEntity(_0x177458,_0x1a28ef){return function(_0x306d37){if(_0x306d37){return _0x306d37[_0xfb36('0x22')]()[_0xfb36('0x21')](function(){_0x177458[_0xfb36('0x17')](0xcc)[_0xfb36('0x18')]();});}};}function handleEntityNotFound(_0x47c315,_0x484287){return function(_0x39a366){if(!_0x39a366){_0x47c315['sendStatus'](0x194);}return _0x39a366;};}function handleError(_0x4965f6,_0x310874){_0x310874=_0x310874||0x1f4;return function(_0x5645ab){logger[_0xfb36('0x23')](_0x5645ab[_0xfb36('0x24')]);if(_0x5645ab[_0xfb36('0x25')]){delete _0x5645ab[_0xfb36('0x25')];}_0x4965f6[_0xfb36('0x17')](_0x310874)['send'](_0x5645ab);};}exports[_0xfb36('0x26')]=function(_0x4a57b6,_0x20133a){var _0x2fb12b={},_0x2649d4={},_0x10ce23={'count':0x0,'rows':[]};var _0x53bc6b=_[_0xfb36('0x27')](db[_0xfb36('0x28')][_0xfb36('0x29')],function(_0x16e59b){return{'name':_0x16e59b[_0xfb36('0x2a')],'type':_0x16e59b['type']['key']};});_0x2649d4[_0xfb36('0x2b')]=_['map'](_0x53bc6b,'name');_0x2649d4['query']=_[_0xfb36('0x2c')](_0x4a57b6[_0xfb36('0x2d')]);_0x2649d4[_0xfb36('0x2e')]=_[_0xfb36('0x2f')](_0x2649d4[_0xfb36('0x2b')],_0x2649d4[_0xfb36('0x2d')]);_0x2fb12b[_0xfb36('0x30')]=_[_0xfb36('0x2f')](_0x2649d4['model'],qs[_0xfb36('0x31')](_0x4a57b6[_0xfb36('0x2d')][_0xfb36('0x31')]));_0x2fb12b[_0xfb36('0x30')]=_0x2fb12b['attributes'][_0xfb36('0x32')]?_0x2fb12b[_0xfb36('0x30')]:_0x2649d4['model'];if(!_0x4a57b6[_0xfb36('0x2d')][_0xfb36('0x33')]('nolimit')){_0x2fb12b[_0xfb36('0x1b')]=qs[_0xfb36('0x1b')](_0x4a57b6[_0xfb36('0x2d')][_0xfb36('0x1b')]);_0x2fb12b[_0xfb36('0x1d')]=qs[_0xfb36('0x1d')](_0x4a57b6['query']['offset']);}_0x2fb12b['order']=qs[_0xfb36('0x34')](_0x4a57b6[_0xfb36('0x2d')][_0xfb36('0x34')]);_0x2fb12b[_0xfb36('0x35')]=qs[_0xfb36('0x2e')](_[_0xfb36('0x36')](_0x4a57b6[_0xfb36('0x2d')],_0x2649d4[_0xfb36('0x2e')]),_0x53bc6b);if(_0x4a57b6['query'][_0xfb36('0x37')]){_0x2fb12b[_0xfb36('0x35')]=_[_0xfb36('0x38')](_0x2fb12b['where'],{'$or':_[_0xfb36('0x27')](_0x53bc6b,function(_0x4c8ebe){if(_0x4c8ebe[_0xfb36('0x39')]!==_0xfb36('0x3a')){var _0x2c7e92={};_0x2c7e92[_0x4c8ebe[_0xfb36('0x25')]]={'$like':'%'+_0x4a57b6['query'][_0xfb36('0x37')]+'%'};return _0x2c7e92;}})});}_0x2fb12b=_[_0xfb36('0x38')]({},_0x2fb12b,_0x4a57b6[_0xfb36('0x3b')]);var _0x1c3e40={'where':_0x2fb12b[_0xfb36('0x35')]};return db[_0xfb36('0x28')][_0xfb36('0x1c')](_0x1c3e40)[_0xfb36('0x21')](function(_0x6a52fe){_0x10ce23[_0xfb36('0x1c')]=_0x6a52fe;if(_0x4a57b6[_0xfb36('0x2d')][_0xfb36('0x3c')]){_0x2fb12b[_0xfb36('0x3d')]=[{'all':!![]}];}return db[_0xfb36('0x28')][_0xfb36('0x3e')](_0x2fb12b);})[_0xfb36('0x21')](function(_0x2a57e1){_0x10ce23[_0xfb36('0x3f')]=_0x2a57e1;return _0x10ce23;})['then'](respondWithFilteredResult(_0x20133a,_0x2fb12b))['catch'](handleError(_0x20133a,null));};exports['show']=function(_0x421506,_0xf0f21a){var _0x1f245e={'raw':!![],'where':{'id':_0x421506[_0xfb36('0x40')]['id']}},_0x585c3d={};_0x585c3d['model']=_[_0xfb36('0x2c')](db[_0xfb36('0x28')][_0xfb36('0x29')]);_0x585c3d[_0xfb36('0x2d')]=_[_0xfb36('0x2c')](_0x421506[_0xfb36('0x2d')]);_0x585c3d['filters']=_['intersection'](_0x585c3d[_0xfb36('0x2b')],_0x585c3d[_0xfb36('0x2d')]);_0x1f245e[_0xfb36('0x30')]=_[_0xfb36('0x2f')](_0x585c3d['model'],qs[_0xfb36('0x31')](_0x421506[_0xfb36('0x2d')]['fields']));_0x1f245e[_0xfb36('0x30')]=_0x1f245e[_0xfb36('0x30')][_0xfb36('0x32')]?_0x1f245e[_0xfb36('0x30')]:_0x585c3d[_0xfb36('0x2b')];if(_0x421506[_0xfb36('0x2d')][_0xfb36('0x3c')]){_0x1f245e[_0xfb36('0x3d')]=[{'all':!![]}];}_0x1f245e=_[_0xfb36('0x38')]({},_0x1f245e,_0x421506['options']);return db[_0xfb36('0x28')][_0xfb36('0x41')](_0x1f245e)['then'](handleEntityNotFound(_0xf0f21a,null))['then'](respondWithResult(_0xf0f21a,null))[_0xfb36('0x42')](handleError(_0xf0f21a,null));};exports[_0xfb36('0x43')]=function(_0x46e708,_0x597fa7){return db[_0xfb36('0x28')][_0xfb36('0x43')](_0x46e708[_0xfb36('0x44')],{})[_0xfb36('0x21')](respondWithResult(_0x597fa7,0xc9))[_0xfb36('0x42')](handleError(_0x597fa7,null));};exports[_0xfb36('0x20')]=function(_0x13419e,_0x1927f0){if(_0x13419e[_0xfb36('0x44')]['id']){delete _0x13419e[_0xfb36('0x44')]['id'];}return db[_0xfb36('0x28')]['find']({'where':{'id':_0x13419e['params']['id']}})['then'](handleEntityNotFound(_0x1927f0,null))[_0xfb36('0x21')](saveUpdates(_0x13419e[_0xfb36('0x44')],null))[_0xfb36('0x21')](respondWithResult(_0x1927f0,null))[_0xfb36('0x42')](handleError(_0x1927f0,null));};exports[_0xfb36('0x22')]=function(_0x18ebf8,_0x4bd5e6){return db['WhatsappTransferReport']['find']({'where':{'id':_0x18ebf8['params']['id']}})['then'](handleEntityNotFound(_0x4bd5e6,null))[_0xfb36('0x21')](removeEntity(_0x4bd5e6,null))['catch'](handleError(_0x4bd5e6,null));};exports[_0xfb36('0x45')]=function(_0x56fb87,_0x732377){return db[_0xfb36('0x28')][_0xfb36('0x45')]()[_0xfb36('0x21')](respondWithResult(_0x732377,null))[_0xfb36('0x42')](handleError(_0x732377,null));}; \ No newline at end of file +var _0xef0f=['json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','WhatsappTransferReport','key','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','create','body','catch','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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','offset','undefined','limit','count','Content-Range'];(function(_0x26adf3,_0x35756a){var _0x298df9=function(_0x5d0843){while(--_0x5d0843){_0x26adf3['push'](_0x26adf3['shift']());}};_0x298df9(++_0x35756a);}(_0xef0f,0x168));var _0xfef0=function(_0x46de0c,_0x5b4038){_0x46de0c=_0x46de0c-0x0;var _0x562f1b=_0xef0f[_0x46de0c];return _0x562f1b;};'use strict';var emlformat=require(_0xfef0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfef0('0x1'));var jsonpatch=require(_0xfef0('0x2'));var rp=require(_0xfef0('0x3'));var moment=require('moment');var BPromise=require(_0xfef0('0x4'));var Mustache=require(_0xfef0('0x5'));var util=require(_0xfef0('0x6'));var path=require('path');var sox=require(_0xfef0('0x7'));var csv=require(_0xfef0('0x8'));var ejs=require(_0xfef0('0x9'));var fs=require('fs');var fs_extra=require(_0xfef0('0xa'));var _=require(_0xfef0('0xb'));var squel=require(_0xfef0('0xc'));var crypto=require('crypto');var jsforce=require(_0xfef0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfef0('0x8'));var querystring=require(_0xfef0('0xe'));var Papa=require(_0xfef0('0xf'));var Redis=require(_0xfef0('0x10'));var authService=require(_0xfef0('0x11'));var qs=require(_0xfef0('0x12'));var as=require(_0xfef0('0x13'));var hardwareService=require(_0xfef0('0x14'));var logger=require(_0xfef0('0x15'))(_0xfef0('0x16'));var utils=require(_0xfef0('0x17'));var config=require(_0xfef0('0x18'));var licenseUtil=require(_0xfef0('0x19'));var db=require(_0xfef0('0x1a'))['db'];function respondWithStatusCode(_0x546c7a,_0x3135ab){_0x3135ab=_0x3135ab||0xcc;return function(_0x2f4e23){if(_0x2f4e23){return _0x546c7a[_0xfef0('0x1b')](_0x3135ab);}return _0x546c7a[_0xfef0('0x1c')](_0x3135ab)[_0xfef0('0x1d')]();};}function respondWithResult(_0x45599a,_0xa9f040){_0xa9f040=_0xa9f040||0xc8;return function(_0x573ae7){if(_0x573ae7){return _0x45599a[_0xfef0('0x1c')](_0xa9f040)['json'](_0x573ae7);}};}function respondWithFilteredResult(_0x4b5bcf,_0x5acdd0){return function(_0x118b8d){if(_0x118b8d){var _0x284b6d=typeof _0x5acdd0[_0xfef0('0x1e')]===_0xfef0('0x1f')&&typeof _0x5acdd0[_0xfef0('0x20')]===_0xfef0('0x1f');var _0x155833=_0x118b8d[_0xfef0('0x21')];var _0x581459=_0x284b6d?0x0:_0x5acdd0[_0xfef0('0x1e')];var _0x1642cd=_0x284b6d?_0x118b8d[_0xfef0('0x21')]:_0x5acdd0[_0xfef0('0x1e')]+_0x5acdd0[_0xfef0('0x20')];var _0x55912f;if(_0x1642cd>=_0x155833){_0x1642cd=_0x155833;_0x55912f=0xc8;}else{_0x55912f=0xce;}_0x4b5bcf[_0xfef0('0x1c')](_0x55912f);return _0x4b5bcf['set'](_0xfef0('0x22'),_0x581459+'-'+_0x1642cd+'/'+_0x155833)[_0xfef0('0x23')](_0x118b8d);}return null;};}function patchUpdates(_0x28dee1){return function(_0x48408a){try{jsonpatch[_0xfef0('0x24')](_0x48408a,_0x28dee1,!![]);}catch(_0x4c304d){return BPromise[_0xfef0('0x25')](_0x4c304d);}return _0x48408a[_0xfef0('0x26')]();};}function saveUpdates(_0x52b93b,_0x4897af){return function(_0x4b8b22){if(_0x4b8b22){return _0x4b8b22[_0xfef0('0x27')](_0x52b93b)['then'](function(_0x1f9970){return _0x1f9970;});}return null;};}function removeEntity(_0x46b34a,_0x1a8d66){return function(_0x4483f2){if(_0x4483f2){return _0x4483f2[_0xfef0('0x28')]()[_0xfef0('0x29')](function(){_0x46b34a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x316e20,_0x1ffaa4){return function(_0x924f6e){if(!_0x924f6e){_0x316e20[_0xfef0('0x1b')](0x194);}return _0x924f6e;};}function handleError(_0xab231c,_0xf60f2){_0xf60f2=_0xf60f2||0x1f4;return function(_0x5df04f){logger[_0xfef0('0x2a')](_0x5df04f[_0xfef0('0x2b')]);if(_0x5df04f['name']){delete _0x5df04f[_0xfef0('0x2c')];}_0xab231c[_0xfef0('0x1c')](_0xf60f2)[_0xfef0('0x2d')](_0x5df04f);};}exports[_0xfef0('0x2e')]=function(_0x37921f,_0x1ac4a3){var _0x3e3c4c={},_0x3e026a={},_0x26cb9a={'count':0x0,'rows':[]};var _0x213a91=_[_0xfef0('0x2f')](db[_0xfef0('0x30')]['rawAttributes'],function(_0x445625){return{'name':_0x445625['fieldName'],'type':_0x445625['type'][_0xfef0('0x31')]};});_0x3e026a[_0xfef0('0x32')]=_['map'](_0x213a91,'name');_0x3e026a['query']=_['keys'](_0x37921f['query']);_0x3e026a[_0xfef0('0x33')]=_[_0xfef0('0x34')](_0x3e026a[_0xfef0('0x32')],_0x3e026a['query']);_0x3e3c4c['attributes']=_['intersection'](_0x3e026a[_0xfef0('0x32')],qs['fields'](_0x37921f[_0xfef0('0x35')][_0xfef0('0x36')]));_0x3e3c4c[_0xfef0('0x37')]=_0x3e3c4c['attributes'][_0xfef0('0x38')]?_0x3e3c4c['attributes']:_0x3e026a[_0xfef0('0x32')];if(!_0x37921f[_0xfef0('0x35')][_0xfef0('0x39')](_0xfef0('0x3a'))){_0x3e3c4c[_0xfef0('0x20')]=qs[_0xfef0('0x20')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x20')]);_0x3e3c4c['offset']=qs[_0xfef0('0x1e')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x1e')]);}_0x3e3c4c[_0xfef0('0x3b')]=qs[_0xfef0('0x3c')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x3c')]);_0x3e3c4c[_0xfef0('0x3d')]=qs[_0xfef0('0x33')](_[_0xfef0('0x3e')](_0x37921f[_0xfef0('0x35')],_0x3e026a[_0xfef0('0x33')]),_0x213a91);if(_0x37921f[_0xfef0('0x35')]['filter']){_0x3e3c4c[_0xfef0('0x3d')]=_['merge'](_0x3e3c4c[_0xfef0('0x3d')],{'$or':_[_0xfef0('0x2f')](_0x213a91,function(_0x1ddce6){if(_0x1ddce6['type']!==_0xfef0('0x3f')){var _0x29469e={};_0x29469e[_0x1ddce6[_0xfef0('0x2c')]]={'$like':'%'+_0x37921f['query'][_0xfef0('0x40')]+'%'};return _0x29469e;}})});}_0x3e3c4c=_[_0xfef0('0x41')]({},_0x3e3c4c,_0x37921f[_0xfef0('0x42')]);var _0x5577f4={'where':_0x3e3c4c[_0xfef0('0x3d')]};return db['WhatsappTransferReport']['count'](_0x5577f4)[_0xfef0('0x29')](function(_0x547a5d){_0x26cb9a['count']=_0x547a5d;if(_0x37921f[_0xfef0('0x35')][_0xfef0('0x43')]){_0x3e3c4c[_0xfef0('0x44')]=[{'all':!![]}];}return db[_0xfef0('0x30')][_0xfef0('0x45')](_0x3e3c4c);})[_0xfef0('0x29')](function(_0x4dd8f8){_0x26cb9a[_0xfef0('0x46')]=_0x4dd8f8;return _0x26cb9a;})[_0xfef0('0x29')](respondWithFilteredResult(_0x1ac4a3,_0x3e3c4c))['catch'](handleError(_0x1ac4a3,null));};exports['show']=function(_0x1d554e,_0x5dc824){var _0x1fc518={'raw':!![],'where':{'id':_0x1d554e[_0xfef0('0x47')]['id']}},_0x22c940={};_0x22c940[_0xfef0('0x32')]=_[_0xfef0('0x48')](db[_0xfef0('0x30')][_0xfef0('0x49')]);_0x22c940[_0xfef0('0x35')]=_['keys'](_0x1d554e[_0xfef0('0x35')]);_0x22c940['filters']=_['intersection'](_0x22c940[_0xfef0('0x32')],_0x22c940[_0xfef0('0x35')]);_0x1fc518['attributes']=_[_0xfef0('0x34')](_0x22c940['model'],qs[_0xfef0('0x36')](_0x1d554e[_0xfef0('0x35')][_0xfef0('0x36')]));_0x1fc518[_0xfef0('0x37')]=_0x1fc518['attributes'][_0xfef0('0x38')]?_0x1fc518[_0xfef0('0x37')]:_0x22c940['model'];if(_0x1d554e['query'][_0xfef0('0x43')]){_0x1fc518['include']=[{'all':!![]}];}_0x1fc518=_[_0xfef0('0x41')]({},_0x1fc518,_0x1d554e[_0xfef0('0x42')]);return db[_0xfef0('0x30')][_0xfef0('0x4a')](_0x1fc518)[_0xfef0('0x29')](handleEntityNotFound(_0x5dc824,null))[_0xfef0('0x29')](respondWithResult(_0x5dc824,null))['catch'](handleError(_0x5dc824,null));};exports[_0xfef0('0x4b')]=function(_0x559a28,_0x5a417e){return db[_0xfef0('0x30')][_0xfef0('0x4b')](_0x559a28[_0xfef0('0x4c')],{})['then'](respondWithResult(_0x5a417e,0xc9))[_0xfef0('0x4d')](handleError(_0x5a417e,null));};exports['update']=function(_0x5dd26b,_0x51f207){if(_0x5dd26b[_0xfef0('0x4c')]['id']){delete _0x5dd26b[_0xfef0('0x4c')]['id'];}return db[_0xfef0('0x30')][_0xfef0('0x4a')]({'where':{'id':_0x5dd26b[_0xfef0('0x47')]['id']}})[_0xfef0('0x29')](handleEntityNotFound(_0x51f207,null))[_0xfef0('0x29')](saveUpdates(_0x5dd26b[_0xfef0('0x4c')],null))[_0xfef0('0x29')](respondWithResult(_0x51f207,null))['catch'](handleError(_0x51f207,null));};exports['destroy']=function(_0x2bebec,_0x18e5ba){return db[_0xfef0('0x30')][_0xfef0('0x4a')]({'where':{'id':_0x2bebec[_0xfef0('0x47')]['id']}})[_0xfef0('0x29')](handleEntityNotFound(_0x18e5ba,null))[_0xfef0('0x29')](removeEntity(_0x18e5ba,null))[_0xfef0('0x4d')](handleError(_0x18e5ba,null));};exports['describe']=function(_0x2466e7,_0x19e449){return db[_0xfef0('0x30')][_0xfef0('0x4e')]()[_0xfef0('0x29')](respondWithResult(_0x19e449,null))['catch'](handleError(_0x19e449,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index ec82bb6..6b1ded5 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 _0xc7b8=['lodash','../../config/logger','moment','bluebird','path','../../config/environment','exports','define','report_whatsapp_transfer','uniqueid'];(function(_0x221a9f,_0x170a47){var _0x1258cd=function(_0x1bf76b){while(--_0x1bf76b){_0x221a9f['push'](_0x221a9f['shift']());}};_0x1258cd(++_0x170a47);}(_0xc7b8,0xaa));var _0x8c7b=function(_0x7b2908,_0x520e18){_0x7b2908=_0x7b2908-0x0;var _0x3dd6cf=_0xc7b8[_0x7b2908];return _0x3dd6cf;};'use strict';var _=require(_0x8c7b('0x0'));var util=require('util');var logger=require(_0x8c7b('0x1'))('api');var moment=require(_0x8c7b('0x2'));var BPromise=require(_0x8c7b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c7b('0x4'));var rimraf=require('rimraf');var config=require(_0x8c7b('0x5'));var attributes=require('./whatsappTransferReport.attributes');module[_0x8c7b('0x6')]=function(_0x54a646,_0x4a7b8c){return _0x54a646[_0x8c7b('0x7')]('WhatsappTransferReport',attributes,{'tableName':_0x8c7b('0x8'),'paranoid':![],'indexes':[{'name':_0x8c7b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x009a=['bluebird','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','lodash','util','../../config/logger','api','moment'];(function(_0x117f87,_0x4a1be5){var _0x3b46ad=function(_0x36e7e0){while(--_0x36e7e0){_0x117f87['push'](_0x117f87['shift']());}};_0x3b46ad(++_0x4a1be5);}(_0x009a,0x109));var _0xa009=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x009a[_0x2aa0e7];return _0x1472c0;};'use strict';var _=require(_0xa009('0x0'));var util=require(_0xa009('0x1'));var logger=require(_0xa009('0x2'))(_0xa009('0x3'));var moment=require(_0xa009('0x4'));var BPromise=require(_0xa009('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa009('0x6'));var attributes=require(_0xa009('0x7'));module['exports']=function(_0x241dcd,_0x94ae50){return _0x241dcd[_0xa009('0x8')](_0xa009('0x9'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index ccd7237..aa7d7d2 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 _0xa728=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','info','request\x20sent','stringify','error','WhatsappTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x46915a,_0x299524){var _0xf2c8cb=function(_0x121f68){while(--_0x121f68){_0x46915a['push'](_0x46915a['shift']());}};_0xf2c8cb(++_0x299524);}(_0xa728,0x142));var _0x8a72=function(_0x61962c,_0x2d8143){_0x61962c=_0x61962c-0x0;var _0x5b990e=_0xa728[_0x61962c];return _0x5b990e;};'use strict';var _=require(_0x8a72('0x0'));var util=require(_0x8a72('0x1'));var moment=require(_0x8a72('0x2'));var BPromise=require(_0x8a72('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a72('0x4'));var db=require(_0x8a72('0x5'))['db'];var utils=require(_0x8a72('0x6'));var logger=require('../../config/logger')(_0x8a72('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8a72('0x8')][_0x8a72('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31c009,_0xe92d9a,_0xbfbdc3){return new BPromise(function(_0x4ba81d,_0x391e10){return client['request'](_0x31c009,_0xbfbdc3)['then'](function(_0x22b388){logger[_0x8a72('0xa')]('WhatsappTransferReport,\x20%s,\x20%s',_0xe92d9a,_0x8a72('0xb'));logger['debug']('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0xe92d9a,_0x8a72('0xb'),JSON[_0x8a72('0xc')](_0x22b388));if(_0x22b388['error']){if(_0x22b388[_0x8a72('0xd')]['code']===0x1f4){logger['error'](_0x8a72('0xe'),_0xe92d9a,_0x22b388[_0x8a72('0xd')][_0x8a72('0xf')]);return _0x391e10(_0x22b388['error']['message']);}logger[_0x8a72('0xd')](_0x8a72('0xe'),_0xe92d9a,_0x22b388[_0x8a72('0xd')][_0x8a72('0xf')]);return _0x4ba81d(_0x22b388[_0x8a72('0xd')][_0x8a72('0xf')]);}else{logger['info'](_0x8a72('0xe'),_0xe92d9a,_0x8a72('0xb'));_0x4ba81d(_0x22b388[_0x8a72('0x10')][_0x8a72('0xf')]);}})[_0x8a72('0x11')](function(_0x7c111e){logger[_0x8a72('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0xe92d9a,_0x7c111e);_0x391e10(_0x7c111e);});});} \ No newline at end of file +var _0xa107=['../../config/logger','rpc','jayson/promise','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa107,0x7d));var _0x7a10=function(_0x256979,_0x507d07){_0x256979=_0x256979-0x0;var _0x4b59a5=_0xa107[_0x256979];return _0x4b59a5;};'use strict';var _=require(_0x7a10('0x0'));var util=require('util');var moment=require(_0x7a10('0x1'));var BPromise=require(_0x7a10('0x2'));var rs=require(_0x7a10('0x3'));var fs=require('fs');var Redis=require(_0x7a10('0x4'));var db=require(_0x7a10('0x5'))['db'];var utils=require(_0x7a10('0x6'));var logger=require(_0x7a10('0x7'))(_0x7a10('0x8'));var config=require('../../config/environment');var jayson=require(_0x7a10('0x9'));var client=jayson['client'][_0x7a10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x470b85,_0x201e91,_0x186563){return new BPromise(function(_0x39f4e9,_0x21129d){return client[_0x7a10('0xb')](_0x470b85,_0x186563)[_0x7a10('0xc')](function(_0x1c5377){logger[_0x7a10('0xd')](_0x7a10('0xe'),_0x201e91,_0x7a10('0xf'));logger['debug'](_0x7a10('0x10'),_0x201e91,_0x7a10('0xf'),JSON[_0x7a10('0x11')](_0x1c5377));if(_0x1c5377[_0x7a10('0x12')]){if(_0x1c5377[_0x7a10('0x12')][_0x7a10('0x13')]===0x1f4){logger['error'](_0x7a10('0xe'),_0x201e91,_0x1c5377[_0x7a10('0x12')][_0x7a10('0x14')]);return _0x21129d(_0x1c5377['error']['message']);}logger[_0x7a10('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x201e91,_0x1c5377[_0x7a10('0x12')]['message']);return _0x39f4e9(_0x1c5377[_0x7a10('0x12')]['message']);}else{logger[_0x7a10('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x201e91,_0x7a10('0xf'));_0x39f4e9(_0x1c5377['result']['message']);}})[_0x7a10('0x15')](function(_0x3677f8){logger[_0x7a10('0x12')](_0x7a10('0xe'),_0x201e91,_0x3677f8);_0x21129d(_0x3677f8);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 75c93a2..b024bc8 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaf1b=['length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','Online\x20apps:','filter','name','Offline\x20apps:','status','online','join','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','then','default','listen','info','start','exitCode','number'];(function(_0x4d05dd,_0x258cdd){var _0x1c5226=function(_0x1a857c){while(--_0x1a857c){_0x4d05dd['push'](_0x4d05dd['shift']());}};_0x1c5226(++_0x258cdd);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x666903,_0x33a89f){_0x666903=_0x666903-0x0;var _0x4d0ca6=_0xaf1b[_0x666903];return _0x4d0ca6;};'use strict';var _=require(_0xbaf1('0x0'));var db=require(_0xbaf1('0x1'))['db'];var seedDb=require(_0xbaf1('0x2'));var checkLicense=require(_0xbaf1('0x3'));var rpc=require(_0xbaf1('0x4'));var config=require(_0xbaf1('0x5'));var logger=require(_0xbaf1('0x6'))(_0xbaf1('0x7'));var pm2=require(_0xbaf1('0x8'));var pm2Config=require(_0xbaf1('0x9'));var schedule=require(_0xbaf1('0xa'));var chat=require(_0xbaf1('0xb'));var whatsapp=require(_0xbaf1('0xc'));var transcribe=require(_0xbaf1('0xd'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0xbaf1('0xe')]['sync']()[_0xbaf1('0xf')](function(){if(config['seedDB']){return seedDb[_0xbaf1('0x10')]();}})[_0xbaf1('0xf')](function(){return checkLicense[_0xbaf1('0x10')]();})['then'](function(){return rpc[_0xbaf1('0x11')]();})[_0xbaf1('0xf')](function(_0x56e04e){logger[_0xbaf1('0x12')](_0x56e04e);return chat['start']();})[_0xbaf1('0xf')](function(){return whatsapp[_0xbaf1('0x13')]();})[_0xbaf1('0xf')](function(){return schedule[_0xbaf1('0x13')]();})[_0xbaf1('0xf')](function(){return transcribe[_0xbaf1('0x13')]();})['then'](function(){return provider['start']();})[_0xbaf1('0xf')](function(_0x1a10d6){logger[_0xbaf1('0x12')](_0x1a10d6);return pm2[_0xbaf1('0x13')](pm2Config);})[_0xbaf1('0xf')](function(_0x1097d6){var _0x177599=_0x1097d6['filter'](function(_0x32981b){return typeof _0x32981b[_0xbaf1('0x14')]===_0xbaf1('0x15')&&_0x32981b[_0xbaf1('0x14')]>=0x0;});if(_0x177599[_0xbaf1('0x16')]>0x0){throw new Error(_0x177599[_0xbaf1('0x16')]+_0xbaf1('0x17')+_[_0xbaf1('0x18')](_0x177599,function(_0x58d217){return'\x22'+_0x58d217[_0xbaf1('0x19')]['name']+'\x22';}));}logger[_0xbaf1('0x12')](_0xbaf1('0x1a'),_[_0xbaf1('0x18')](_[_0xbaf1('0x1b')](_0x1097d6,{'status':'online'}),_0xbaf1('0x1c'))['join']());logger[_0xbaf1('0x12')](_0xbaf1('0x1d'),_['map'](_[_0xbaf1('0x1b')](_0x1097d6,function(_0x33c524){return _0x33c524[_0xbaf1('0x1e')]!==_0xbaf1('0x1f');}),_0xbaf1('0x1c'))[_0xbaf1('0x20')]()||'None');console['log'](_0xbaf1('0x21'));})[_0xbaf1('0x22')](function(_0x254178){console['log'](_0xbaf1('0x23'),_0x254178);logger[_0xbaf1('0x24')](_0xbaf1('0x25'),_0x254178);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x04e7=['number','length','\x20processes\x20failed\x20at\x20startup:\x20','pm2_env','name','Online\x20apps:','filter','map','join','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','info','start','exitCode'];(function(_0xed9fea,_0x5ed774){var _0x198f12=function(_0xfb85f6){while(--_0xfb85f6){_0xed9fea['push'](_0xed9fea['shift']());}};_0x198f12(++_0x5ed774);}(_0x04e7,0x121));var _0x704e=function(_0x59ee41,_0xaf7db8){_0x59ee41=_0x59ee41-0x0;var _0x3ecd3e=_0x04e7[_0x59ee41];return _0x3ecd3e;};'use strict';var _=require(_0x704e('0x0'));var db=require(_0x704e('0x1'))['db'];var seedDb=require(_0x704e('0x2'));var checkLicense=require(_0x704e('0x3'));var rpc=require(_0x704e('0x4'));var config=require(_0x704e('0x5'));var logger=require(_0x704e('0x6'))(_0x704e('0x7'));var pm2=require(_0x704e('0x8'));var pm2Config=require(_0x704e('0x9'));var schedule=require(_0x704e('0xa'));var chat=require(_0x704e('0xb'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x704e('0xc'));var provider=require(_0x704e('0xd'));function main(){return db[_0x704e('0xe')][_0x704e('0xf')]()[_0x704e('0x10')](function(){if(config[_0x704e('0x11')]){return seedDb[_0x704e('0x12')]();}})[_0x704e('0x10')](function(){return checkLicense[_0x704e('0x12')]();})[_0x704e('0x10')](function(){return rpc[_0x704e('0x13')]();})[_0x704e('0x10')](function(_0x48dc9b){logger[_0x704e('0x14')](_0x48dc9b);return chat[_0x704e('0x15')]();})[_0x704e('0x10')](function(){return whatsapp[_0x704e('0x15')]();})[_0x704e('0x10')](function(){return schedule[_0x704e('0x15')]();})[_0x704e('0x10')](function(){return transcribe['start']();})['then'](function(){return provider[_0x704e('0x15')]();})[_0x704e('0x10')](function(_0x12a46c){logger[_0x704e('0x14')](_0x12a46c);return pm2[_0x704e('0x15')](pm2Config);})[_0x704e('0x10')](function(_0x2abf61){var _0x33a743=_0x2abf61['filter'](function(_0xed4c87){return typeof _0xed4c87[_0x704e('0x16')]===_0x704e('0x17')&&_0xed4c87['exitCode']>=0x0;});if(_0x33a743[_0x704e('0x18')]>0x0){throw new Error(_0x33a743[_0x704e('0x18')]+_0x704e('0x19')+_['map'](_0x33a743,function(_0x1b347a){return'\x22'+_0x1b347a[_0x704e('0x1a')][_0x704e('0x1b')]+'\x22';}));}logger[_0x704e('0x14')](_0x704e('0x1c'),_['map'](_[_0x704e('0x1d')](_0x2abf61,{'status':'online'}),_0x704e('0x1b'))['join']());logger['info']('Offline\x20apps:',_[_0x704e('0x1e')](_[_0x704e('0x1d')](_0x2abf61,function(_0xb6e2c8){return _0xb6e2c8['status']!=='online';}),_0x704e('0x1b'))[_0x704e('0x1f')]()||_0x704e('0x20'));console[_0x704e('0x21')](_0x704e('0x22'));})[_0x704e('0x23')](function(_0x30a391){console[_0x704e('0x21')](_0x704e('0x24'),_0x30a391);logger[_0x704e('0x25')](_0x704e('0x26'),_0x30a391);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 7641a7d..e4610d5 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 _0x55ca=['It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','splice','unshift','encryptString','join','promisify','payload','options','session','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','role','fullname','internal','email','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','allowmessenger','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswer','isChatInteractionAuthorized','isAuthenticated','use','user','closed','then','status','disposition','unmanaged','json','Unmanaged.','Forbidden.','headers','authorization','startsWith','User','find','name','authenticate','pass','Wrong\x20credentials.','catch','query','apikey','getUuid','Setting','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','blockDuration','add','Invalid\x20API\x20access\x20key','Unknown\x20authorization\x20format','User\x20not\x20found.','canUpdate','update','isWebrtcLicence','getLicense','webrtc','Forbidden','isMiddleware','signToken'];(function(_0x5f3581,_0x321b00){var _0x4a5e0f=function(_0x30bfa5){while(--_0x30bfa5){_0x5f3581['push'](_0x5f3581['shift']());}};_0x4a5e0f(++_0x321b00);}(_0x55ca,0x126));var _0xa55c=function(_0x8a654b,_0x4be2f9){_0x8a654b=_0x8a654b-0x0;var _0x94bfbb=_0x55ca[_0x8a654b];return _0x94bfbb;};'use strict';var db=require(_0xa55c('0x0'))['db'];var config=require(_0xa55c('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0xa55c('0x2'));var jwt=require(_0xa55c('0x3'));var expressJwt=require('express-jwt');var compose=require(_0xa55c('0x4'));var basicAuth=require(_0xa55c('0x5'));var crypto=require(_0xa55c('0x6'));var BPromise=require(_0xa55c('0x7'));var util=require(_0xa55c('0x8'));var moment=require(_0xa55c('0x9'));var validateJwt=expressJwt({'secret':config[_0xa55c('0xa')]['session']});var userAttributes=['id',_0xa55c('0xb'),_0xa55c('0xc'),'name',_0xa55c('0xd'),_0xa55c('0xe'),'userpic','permissions',_0xa55c('0xf'),_0xa55c('0x10'),_0xa55c('0x11'),_0xa55c('0x12'),_0xa55c('0x13'),_0xa55c('0x14'),_0xa55c('0x15'),_0xa55c('0x16'),_0xa55c('0x17'),_0xa55c('0x18'),'lastPauseAt','crudPermissions',_0xa55c('0x19'),'passwordResetAt','alias','phoneBarAutoAnswer',_0xa55c('0x1a'),_0xa55c('0x1b'),_0xa55c('0x1c'),_0xa55c('0x1d'),_0xa55c('0x1e'),_0xa55c('0x1f'),'phoneBarPrefixRequired',_0xa55c('0x20'),_0xa55c('0x21'),_0xa55c('0x22'),_0xa55c('0x23'),_0xa55c('0x24'),_0xa55c('0x25'),_0xa55c('0x26'),_0xa55c('0x27'),_0xa55c('0x28'),'downloadOmnichannelInteractions',_0xa55c('0x29'),_0xa55c('0x2a'),_0xa55c('0x2b'),_0xa55c('0x2c'),_0xa55c('0x2d'),_0xa55c('0x2e'),'emailAutoanswerDelay','smsAutoanswer',_0xa55c('0x2f'),_0xa55c('0x30'),_0xa55c('0x31'),'faxAutoanswer',_0xa55c('0x32'),_0xa55c('0x33'),'whatsappAutoanswerDelay'];exports[_0xa55c('0x34')]=function(){return this[_0xa55c('0x35')](!![])[_0xa55c('0x36')](function(_0x1965f1,_0x234372,_0x49ed04){if(_0x1965f1[_0xa55c('0x37')]){_0x49ed04();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x1965f1['params']['id']},'attributes':['id',_0xa55c('0x38'),'disposition'],'raw':!![]})[_0xa55c('0x39')](function(_0x190757){if(_0x190757&&_0x190757[_0xa55c('0x38')]){return _0x234372[_0xa55c('0x3a')](_0x190757[_0xa55c('0x3b')]===_0xa55c('0x3c')?0x195:0x193)[_0xa55c('0x3d')]({'message':_0x190757[_0xa55c('0x3b')]===_0xa55c('0x3c')?_0xa55c('0x3e'):_0xa55c('0x3f')});}else{_0x49ed04();}})['catch'](function(_0x430d55){_0x49ed04(_0x430d55);});}});};exports[_0xa55c('0x35')]=function isAuthenticated(_0x1c9f6b){return compose()[_0xa55c('0x36')](function(_0x5d940d,_0x1377b0,_0x22f6b6){var _0x1b8388;if(_0x5d940d[_0xa55c('0x40')][_0xa55c('0x41')]){if(_[_0xa55c('0x42')](_0x5d940d['headers'][_0xa55c('0x41')],'Basic')){var _0x35c9c2=basicAuth(_0x5d940d);db[_0xa55c('0x43')][_0xa55c('0x44')]({'where':{'name':_0x35c9c2[_0xa55c('0x45')]}})['then'](function(_0x3d28fb){if(!_0x3d28fb||!_0x3d28fb[_0xa55c('0x46')](_0x35c9c2[_0xa55c('0x47')])){return _0x1377b0[_0xa55c('0x3a')](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x48')});}_0x5d940d[_0xa55c('0x37')]={'id':_0x3d28fb['id']};_0x22f6b6();})[_0xa55c('0x49')](function(_0x2808e9){_0x22f6b6(_0x2808e9);});}else if(_[_0xa55c('0x42')](_0x5d940d[_0xa55c('0x40')]['authorization'],'Bearer')){validateJwt(_0x5d940d,_0x1377b0,_0x22f6b6);}else{if(_0x1c9f6b){_0x22f6b6();}else{return _0x1377b0[_0xa55c('0x3a')](0x193)[_0xa55c('0x3d')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x5d940d[_0xa55c('0x4a')][_0xa55c('0x4b')]){try{var _0x2e9623={'audience':hardwareConf[_0xa55c('0x4c')](),'issuer':hardwareConf[_0xa55c('0x4c')]()};verifyJwt(_0x5d940d[_0xa55c('0x4a')][_0xa55c('0x4b')],_0x2e9623)[_0xa55c('0x39')](function(_0x3959e3){return db['User']['find']({'where':{'id':_0x3959e3['sub']}})[_0xa55c('0x39')](function(_0x18e00e){_0x1b8388=_0x18e00e;return db[_0xa55c('0x4d')]['findOne']({'where':{'id':0x1},'attributes':[_0xa55c('0x4e'),'blockDuration'],'raw':!![]});})[_0xa55c('0x39')](function(_0x4ad813){if(!_0x1b8388||!_[_0xa55c('0x4f')](_0x1b8388[_0xa55c('0x50')],_0x3959e3[_0xa55c('0x51')])){return _0x1377b0['status'](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x52')});}if(_0x1b8388['disabled']){return _0x1377b0[_0xa55c('0x3a')](0x191)[_0xa55c('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x1b8388['blocked']){if(_0x4ad813[_0xa55c('0x53')]>0x0){if(moment(_0x1b8388['blockedAt'])[_0xa55c('0x54')](_0x4ad813[_0xa55c('0x53')],'minutes')>moment()){return _0x1377b0['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x1377b0[_0xa55c('0x3a')](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x55')});}}_0x5d940d[_0xa55c('0x37')]={'id':_0x1b8388['id']};_0x22f6b6();});})[_0xa55c('0x49')](function(){return _0x1377b0['status'](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x55')});});}catch(_0x77d623){_0x22f6b6(_0x77d623);}}else if(_0x1c9f6b){_0x22f6b6();}else{return _0x1377b0[_0xa55c('0x3a')](0x193)[_0xa55c('0x3d')]({'message':_0xa55c('0x56')});}})['use'](function(_0x386e34,_0x5ee63d,_0x57a972){if(_0x386e34[_0xa55c('0x37')]){db[_0xa55c('0x43')]['find']({'where':{'id':_0x386e34[_0xa55c('0x37')]['id']},'attributes':userAttributes})['then'](function(_0x5f25f7){if(!_0x5f25f7){return _0x5ee63d[_0xa55c('0x3a')](0x194)[_0xa55c('0x3d')]({'message':_0xa55c('0x57')});}_0x386e34['user']=_0x5f25f7;_0x57a972();})[_0xa55c('0x49')](function(_0xd5a006){_0x57a972(_0xd5a006);});}else if(_0x1c9f6b){_0x57a972();}else{return _0x5ee63d['status'](0x194)[_0xa55c('0x3d')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xa55c('0x58')]=function canUpdate(){return compose()[_0xa55c('0x36')](function(_0x5be43f,_0x66d1de,_0x1dae70){return licenseUtil['getLicense']()[_0xa55c('0x39')](function(_0x187e09){if(_0x187e09[_0xa55c('0x59')]){_0x1dae70();}else{return _0x66d1de['status'](0x193)[_0xa55c('0x3d')]({'message':'Forbidden'});}})[_0xa55c('0x49')](function(_0x3a8af4){_0x1dae70(_0x3a8af4);});});};exports[_0xa55c('0x5a')]=function isWebrtcLicence(){return compose()['use'](function(_0x41eab1,_0x106adb,_0x592429){return licenseUtil[_0xa55c('0x5b')]()[_0xa55c('0x39')](function(_0x5d5cf6){if(_0x5d5cf6[_0xa55c('0x5c')]){_0x592429();}else{return _0x106adb[_0xa55c('0x3a')](0x193)['json']({'message':_0xa55c('0x5d')});}})[_0xa55c('0x49')](function(_0x219a68){_0x592429(_0x219a68);});});};exports[_0xa55c('0x5e')]=function(_0x564cb3,_0x143989,_0x58a7ea){_0x564cb3[_0xa55c('0x5e')]=!![];return _0x58a7ea();};exports[_0xa55c('0x5f')]=function signToken(_0x194a79){return signJwt(_0x194a79);};exports['setTokenCookie']=function(_0x39bd3d,_0x250b00){if(!_0x39bd3d['user']){return _0x250b00[_0xa55c('0x3a')](0x194)[_0xa55c('0x3d')]({'message':_0xa55c('0x60')});}var _0xcd78c5={'payload':{'id':_0x39bd3d[_0xa55c('0x37')]['id'],'role':_0x39bd3d[_0xa55c('0x37')][_0xa55c('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0xcd78c5)[_0xa55c('0x39')](function(_0x3c147b){_0x250b00[_0xa55c('0x61')]('motion.token',_0x3c147b);_0x250b00[_0xa55c('0x62')](_0xa55c('0x63'));})[_0xa55c('0x49')](function(_0x4f73b6){return _0x250b00[_0xa55c('0x3a')](0x1f4)[_0xa55c('0x64')](_0x4f73b6);});};exports['retrieveApiKey']=function(_0x21b760){if(_['isNil'](_0x21b760[_0xa55c('0x50')])||_[_0xa55c('0x65')](_0x21b760[_0xa55c('0x66')])){return null;}else{return createJwt(_0x21b760);}};exports[_0xa55c('0x67')]=function(_0x2ecf79){_0x2ecf79['apiKeyNonce']=generateNonce();_0x2ecf79[_0xa55c('0x66')]=generateIssuedAt();return createJwt(_0x2ecf79);};exports[_0xa55c('0x68')]=function(_0x4b85cc,_0x3929a6){var _0x2291e0=_0x4b85cc[_0xa55c('0x4a')][_0xa55c('0x4b')];if(_0x2291e0){var _0x50176b={'nonce':_0x3929a6['apiKeyNonce'],'iat':_0x3929a6[_0xa55c('0x66')],'audience':hardwareConf[_0xa55c('0x4c')](),'issuer':hardwareConf[_0xa55c('0x4c')]()};return verifyJwt(_0x2291e0,_0x50176b)[_0xa55c('0x39')](function(){return generateApiKey(_0x3929a6);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xa55c('0x69')]=function(_0x5ce463){var _0x2742e4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2742e4[_0xa55c('0x6a')](_0x5ce463))throw new db[(_0xa55c('0x6b'))][(_0xa55c('0x6c'))](_0xa55c('0x6d'));return;};exports['validatePasswordHistory']=function(_0x1cb73b,_0x54f776,_0x23f67f){var _0x157afe=encryptor[_0xa55c('0x6e')](_0x54f776)[_0xa55c('0x6f')](',');for(var _0x19aaf5=0x0;_0x19aaf5<_0x23f67f;_0x19aaf5++){if(!_0x157afe[_0x19aaf5])break;if(_0x1cb73b[_0xa55c('0x70')]()===_0x157afe[_0x19aaf5][_0xa55c('0x70')]()){var _0x53e2be=util[_0xa55c('0x71')](_0xa55c('0x72'),_0x23f67f);if(_0x23f67f===0x1){_0x53e2be=_0xa55c('0x73');}throw new db[(_0xa55c('0x6b'))][(_0xa55c('0x6c'))](_0x53e2be);}}return;};exports['updatePasswordsHistory']=function(_0xa72718,_0x3cd40d){var _0x28bac4=_0x3cd40d?encryptor[_0xa55c('0x6e')](_0x3cd40d)[_0xa55c('0x6f')](','):[];if(_0x28bac4['length']===0x5){_0x28bac4[_0xa55c('0x74')](-0x1,0x1);}_0x28bac4[_0xa55c('0x75')](_0xa72718);return encryptor[_0xa55c('0x76')](_0x28bac4[_0xa55c('0x77')](','));};function signJwt(_0x3ba56d){var _0x480dfc=BPromise[_0xa55c('0x78')](jwt['sign'],{'context':jwt});var _0x2e482a=_0x3ba56d['secret']||config[_0xa55c('0xa')]['session'];return new BPromise(function(_0x34edc5,_0x1333da){_0x480dfc(_0x3ba56d[_0xa55c('0x79')],_0x2e482a,_0x3ba56d[_0xa55c('0x7a')])[_0xa55c('0x39')](function(_0x3a5a52){_0x34edc5(_0x3a5a52);})[_0xa55c('0x49')](function(_0x2f2226){_0x1333da(_0x2f2226);});});}function verifyJwt(_0x14b515,_0x1acf50,_0x51c736){var _0x150a07=BPromise[_0xa55c('0x78')](jwt['verify'],{'context':jwt});var _0x18b928=_0x51c736||config[_0xa55c('0xa')][_0xa55c('0x7b')];return new BPromise(function(_0x9fe234,_0x1b8b06){_0x150a07(_0x14b515,_0x18b928,_0x1acf50)[_0xa55c('0x39')](function(_0x3cef1f){_0x9fe234(_0x3cef1f);})[_0xa55c('0x49')](function(_0x47de0a){_0x1b8b06(_0x47de0a);});});}function generateNonce(){return crypto[_0xa55c('0x7c')](0x10)[_0xa55c('0x7d')](_0xa55c('0x7e'));}function generateIssuedAt(){return Math[_0xa55c('0x7f')](Date[_0xa55c('0x80')]()/0x3e8)[_0xa55c('0x7d')]();}function createJwt(_0x2f1237){var _0x4249c1={'payload':{'iat':_0x2f1237[_0xa55c('0x66')],'nonce':_0x2f1237['apiKeyNonce']},'options':{'algorithm':_0xa55c('0x81'),'subject':_0x2f1237['id'][_0xa55c('0x7d')](),'issuer':hardwareConf[_0xa55c('0x4c')](),'audience':hardwareConf[_0xa55c('0x4c')]()}};return signJwt(_0x4249c1)[_0xa55c('0x39')](function(_0x10e711){return{'iat':_0x2f1237[_0xa55c('0x66')],'nonce':_0x2f1237[_0xa55c('0x50')],'token':_0x10e711};});} \ No newline at end of file +var _0x00bb=['lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarRemoteControl','interface','userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','isChatInteractionAuthorized','use','user','findOne','params','disposition','then','closed','unmanaged','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','authorization','Basic','User','find','pass','status','Wrong\x20credentials.','Bearer','json','Unknown\x20authorization\x20format','query','getUuid','apikey','sub','Setting','allowedLoginAttempts','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','webrtc','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','send','isNil','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','unshift','encryptString','join','promisify','sign','secret','options','verify','toString','hex','floor','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','jsonwebtoken','express-jwt','basic-auth','crypto','secrets','session','role','fullname','name','internal','permissions','md5secret','voicePause','chatPause','mailPause','smsPause'];(function(_0x447a24,_0x49ecbc){var _0x320dbf=function(_0xca00b){while(--_0xca00b){_0x447a24['push'](_0x447a24['shift']());}};_0x320dbf(++_0x49ecbc);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x00bb[_0x4baae2];return _0x1a2285;};'use strict';var db=require(_0xb00b('0x0'))['db'];var config=require(_0xb00b('0x1'));var hardwareConf=require(_0xb00b('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xb00b('0x3'));var _=require('lodash');var jwt=require(_0xb00b('0x4'));var expressJwt=require(_0xb00b('0x5'));var compose=require('composable-middleware');var basicAuth=require(_0xb00b('0x6'));var crypto=require(_0xb00b('0x7'));var BPromise=require('bluebird');var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xb00b('0x8')][_0xb00b('0x9')]});var userAttributes=['id',_0xb00b('0xa'),_0xb00b('0xb'),_0xb00b('0xc'),_0xb00b('0xd'),'email','userpic',_0xb00b('0xe'),_0xb00b('0xf'),_0xb00b('0x10'),_0xb00b('0x11'),_0xb00b('0x12'),'faxPause',_0xb00b('0x13'),'openchannelPause','pauseType','showWebBar',_0xb00b('0x14'),_0xb00b('0x15'),_0xb00b('0x16'),_0xb00b('0x17'),_0xb00b('0x18'),_0xb00b('0x19'),'phoneBarAutoAnswer',_0xb00b('0x1a'),_0xb00b('0x1b'),'phoneBarEnableRecording',_0xb00b('0x1c'),_0xb00b('0x1d'),'phoneBarExpires','phoneBarPrefixRequired',_0xb00b('0x1e'),'phoneBarRemoteControlPort','hotdesk',_0xb00b('0x1f'),_0xb00b('0x20'),_0xb00b('0x21'),_0xb00b('0x22'),'wssPort',_0xb00b('0x23'),'downloadOmnichannelInteractions',_0xb00b('0x24'),'ignorePauseForPreviewCalls',_0xb00b('0x25'),'chatAutoanswer',_0xb00b('0x26'),_0xb00b('0x27'),'emailAutoanswerDelay','smsAutoanswer',_0xb00b('0x28'),'openchannelAutoanswer',_0xb00b('0x29'),_0xb00b('0x2a'),_0xb00b('0x2b'),_0xb00b('0x2c'),'whatsappAutoanswerDelay'];exports[_0xb00b('0x2d')]=function(){return this['isAuthenticated'](!![])[_0xb00b('0x2e')](function(_0x121ec7,_0x51b841,_0x231293){if(_0x121ec7[_0xb00b('0x2f')]){_0x231293();}else{return db['ChatInteraction'][_0xb00b('0x30')]({'where':{'id':_0x121ec7[_0xb00b('0x31')]['id']},'attributes':['id','closed',_0xb00b('0x32')],'raw':!![]})[_0xb00b('0x33')](function(_0x3c9500){if(_0x3c9500&&_0x3c9500[_0xb00b('0x34')]){return _0x51b841['status'](_0x3c9500['disposition']===_0xb00b('0x35')?0x195:0x193)['json']({'message':_0x3c9500['disposition']==='unmanaged'?_0xb00b('0x36'):_0xb00b('0x37')});}else{_0x231293();}})[_0xb00b('0x38')](function(_0x3825af){_0x231293(_0x3825af);});}});};exports[_0xb00b('0x39')]=function isAuthenticated(_0x197379){return compose()[_0xb00b('0x2e')](function(_0x4a8d2b,_0x22c22d,_0x503c9c){var _0x450129;if(_0x4a8d2b[_0xb00b('0x3a')][_0xb00b('0x3b')]){if(_['startsWith'](_0x4a8d2b[_0xb00b('0x3a')][_0xb00b('0x3b')],_0xb00b('0x3c'))){var _0x183233=basicAuth(_0x4a8d2b);db[_0xb00b('0x3d')][_0xb00b('0x3e')]({'where':{'name':_0x183233[_0xb00b('0xc')]}})[_0xb00b('0x33')](function(_0x149c1a){if(!_0x149c1a||!_0x149c1a['authenticate'](_0x183233[_0xb00b('0x3f')])){return _0x22c22d[_0xb00b('0x40')](0x191)['json']({'message':_0xb00b('0x41')});}_0x4a8d2b[_0xb00b('0x2f')]={'id':_0x149c1a['id']};_0x503c9c();})['catch'](function(_0x456241){_0x503c9c(_0x456241);});}else if(_['startsWith'](_0x4a8d2b[_0xb00b('0x3a')][_0xb00b('0x3b')],_0xb00b('0x42'))){validateJwt(_0x4a8d2b,_0x22c22d,_0x503c9c);}else{if(_0x197379){_0x503c9c();}else{return _0x22c22d[_0xb00b('0x40')](0x193)[_0xb00b('0x43')]({'message':_0xb00b('0x44')});}}}else if(_0x4a8d2b[_0xb00b('0x45')]['apikey']){try{var _0x57e8f9={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xb00b('0x46')]()};verifyJwt(_0x4a8d2b[_0xb00b('0x45')][_0xb00b('0x47')],_0x57e8f9)[_0xb00b('0x33')](function(_0x5cfa60){return db[_0xb00b('0x3d')][_0xb00b('0x3e')]({'where':{'id':_0x5cfa60[_0xb00b('0x48')]}})[_0xb00b('0x33')](function(_0x261c80){_0x450129=_0x261c80;return db[_0xb00b('0x49')][_0xb00b('0x30')]({'where':{'id':0x1},'attributes':[_0xb00b('0x4a'),'blockDuration'],'raw':!![]});})['then'](function(_0x2ea41d){if(!_0x450129||!_['isEqual'](_0x450129[_0xb00b('0x4b')],_0x5cfa60[_0xb00b('0x4c')])){return _0x22c22d[_0xb00b('0x40')](0x191)[_0xb00b('0x43')]({'message':_0xb00b('0x4d')});}if(_0x450129[_0xb00b('0x4e')]){return _0x22c22d[_0xb00b('0x40')](0x191)['json']({'message':_0xb00b('0x4f')});}if(_0x450129[_0xb00b('0x50')]){if(_0x2ea41d[_0xb00b('0x51')]>0x0){if(moment(_0x450129[_0xb00b('0x52')])[_0xb00b('0x53')](_0x2ea41d[_0xb00b('0x51')],'minutes')>moment()){return _0x22c22d[_0xb00b('0x40')](0x191)[_0xb00b('0x43')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x22c22d[_0xb00b('0x40')](0x191)[_0xb00b('0x43')]({'message':_0xb00b('0x4f')});}}_0x4a8d2b[_0xb00b('0x2f')]={'id':_0x450129['id']};_0x503c9c();});})[_0xb00b('0x38')](function(){return _0x22c22d['status'](0x191)[_0xb00b('0x43')]({'message':_0xb00b('0x4f')});});}catch(_0xb76ede){_0x503c9c(_0xb76ede);}}else if(_0x197379){_0x503c9c();}else{return _0x22c22d[_0xb00b('0x40')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})[_0xb00b('0x2e')](function(_0xf6ae0c,_0x10a348,_0x152437){if(_0xf6ae0c[_0xb00b('0x2f')]){db[_0xb00b('0x3d')][_0xb00b('0x3e')]({'where':{'id':_0xf6ae0c['user']['id']},'attributes':userAttributes})[_0xb00b('0x33')](function(_0x3b72c4){if(!_0x3b72c4){return _0x10a348[_0xb00b('0x40')](0x194)[_0xb00b('0x43')]({'message':_0xb00b('0x54')});}_0xf6ae0c[_0xb00b('0x2f')]=_0x3b72c4;_0x152437();})[_0xb00b('0x38')](function(_0x974a29){_0x152437(_0x974a29);});}else if(_0x197379){_0x152437();}else{return _0x10a348[_0xb00b('0x40')](0x194)[_0xb00b('0x43')]({'message':_0xb00b('0x55')});}});};exports[_0xb00b('0x56')]=function canUpdate(){return compose()['use'](function(_0x3da23c,_0x35a0ba,_0xd07fb8){return licenseUtil[_0xb00b('0x57')]()[_0xb00b('0x33')](function(_0x2d9174){if(_0x2d9174[_0xb00b('0x58')]){_0xd07fb8();}else{return _0x35a0ba[_0xb00b('0x40')](0x193)[_0xb00b('0x43')]({'message':_0xb00b('0x59')});}})[_0xb00b('0x38')](function(_0x3b3031){_0xd07fb8(_0x3b3031);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()['use'](function(_0x47c6c0,_0x3f8f60,_0x23d858){return licenseUtil['getLicense']()[_0xb00b('0x33')](function(_0x3c0fa){if(_0x3c0fa[_0xb00b('0x5a')]){_0x23d858();}else{return _0x3f8f60[_0xb00b('0x40')](0x193)['json']({'message':'Forbidden'});}})[_0xb00b('0x38')](function(_0x40c2fd){_0x23d858(_0x40c2fd);});});};exports['isMiddleware']=function(_0x514c5b,_0x154759,_0x3a205d){_0x514c5b['isMiddleware']=!![];return _0x3a205d();};exports[_0xb00b('0x5b')]=function signToken(_0x47a814){return signJwt(_0x47a814);};exports['setTokenCookie']=function(_0x4bcc9e,_0x465d90){if(!_0x4bcc9e['user']){return _0x465d90[_0xb00b('0x40')](0x194)[_0xb00b('0x43')]({'message':_0xb00b('0x5c')});}var _0xe724a5={'payload':{'id':_0x4bcc9e[_0xb00b('0x2f')]['id'],'role':_0x4bcc9e[_0xb00b('0x2f')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0xe724a5)['then'](function(_0x1d2a0d){_0x465d90[_0xb00b('0x5d')]('motion.token',_0x1d2a0d);_0x465d90[_0xb00b('0x5e')](_0xb00b('0x5f'));})['catch'](function(_0x15dcbf){return _0x465d90[_0xb00b('0x40')](0x1f4)[_0xb00b('0x60')](_0x15dcbf);});};exports['retrieveApiKey']=function(_0x501cbe){if(_[_0xb00b('0x61')](_0x501cbe[_0xb00b('0x4b')])||_[_0xb00b('0x61')](_0x501cbe[_0xb00b('0x62')])){return null;}else{return createJwt(_0x501cbe);}};exports['generateApiKey']=function(_0x380acb){_0x380acb[_0xb00b('0x4b')]=generateNonce();_0x380acb['apiKeyIat']=generateIssuedAt();return createJwt(_0x380acb);};exports['regenerateApiKey']=function(_0x160965,_0x524b05){var _0x1ab196=_0x160965[_0xb00b('0x45')][_0xb00b('0x47')];if(_0x1ab196){var _0x222459={'nonce':_0x524b05[_0xb00b('0x4b')],'iat':_0x524b05[_0xb00b('0x62')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xb00b('0x46')]()};return verifyJwt(_0x1ab196,_0x222459)['then'](function(){return generateApiKey(_0x524b05);});}else{throw{'message':_0xb00b('0x63')};}};exports[_0xb00b('0x64')]=function(_0x4129ba){var _0x5ac79e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x5ac79e[_0xb00b('0x65')](_0x4129ba))throw new db[(_0xb00b('0x66'))][(_0xb00b('0x67'))]('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[_0xb00b('0x68')]=function(_0x309ae6,_0x219b74,_0x385029){var _0x131848=encryptor[_0xb00b('0x69')](_0x219b74)[_0xb00b('0x6a')](',');for(var _0x3a0b90=0x0;_0x3a0b90<_0x385029;_0x3a0b90++){if(!_0x131848[_0x3a0b90])break;if(_0x309ae6['toLowerCase']()===_0x131848[_0x3a0b90][_0xb00b('0x6b')]()){var _0x2cbe80=util[_0xb00b('0x6c')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x385029);if(_0x385029===0x1){_0x2cbe80=_0xb00b('0x6d');}throw new db[(_0xb00b('0x66'))][(_0xb00b('0x67'))](_0x2cbe80);}}return;};exports[_0xb00b('0x6e')]=function(_0x1ad387,_0x4bfe0b){var _0xfd4ecc=_0x4bfe0b?encryptor[_0xb00b('0x69')](_0x4bfe0b)[_0xb00b('0x6a')](','):[];if(_0xfd4ecc[_0xb00b('0x6f')]===0x5){_0xfd4ecc['splice'](-0x1,0x1);}_0xfd4ecc[_0xb00b('0x70')](_0x1ad387);return encryptor[_0xb00b('0x71')](_0xfd4ecc[_0xb00b('0x72')](','));};function signJwt(_0x2d73bb){var _0x161216=BPromise[_0xb00b('0x73')](jwt[_0xb00b('0x74')],{'context':jwt});var _0x542223=_0x2d73bb[_0xb00b('0x75')]||config['secrets'][_0xb00b('0x9')];return new BPromise(function(_0x4c2186,_0x3b3272){_0x161216(_0x2d73bb['payload'],_0x542223,_0x2d73bb[_0xb00b('0x76')])['then'](function(_0x3dffaf){_0x4c2186(_0x3dffaf);})[_0xb00b('0x38')](function(_0x3bae02){_0x3b3272(_0x3bae02);});});}function verifyJwt(_0x4d1cec,_0x51fbe2,_0x4f7a59){var _0x21a53d=BPromise[_0xb00b('0x73')](jwt[_0xb00b('0x77')],{'context':jwt});var _0x49246b=_0x4f7a59||config[_0xb00b('0x8')][_0xb00b('0x9')];return new BPromise(function(_0xca87d4,_0x2ddba4){_0x21a53d(_0x4d1cec,_0x49246b,_0x51fbe2)[_0xb00b('0x33')](function(_0x485033){_0xca87d4(_0x485033);})[_0xb00b('0x38')](function(_0x27b13b){_0x2ddba4(_0x27b13b);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xb00b('0x78')](_0xb00b('0x79'));}function generateIssuedAt(){return Math[_0xb00b('0x7a')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x359669){var _0x188da7={'payload':{'iat':_0x359669[_0xb00b('0x62')],'nonce':_0x359669['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x359669['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xb00b('0x46')]()}};return signJwt(_0x188da7)['then'](function(_0x2434a0){return{'iat':_0x359669[_0xb00b('0x62')],'nonce':_0x359669['apiKeyNonce'],'token':_0x2434a0};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 01625c2..5ca1fb9 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['skip','ids','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts','rows','catch','CmContact','describe','keys','startsWith','slice','length','cf_','type','map','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','parseAdvancedSearchFilter','search','parseQueryParameters','where','default','fields','filter','clause','tags','user'];(function(_0x17e472,_0x59989f){var _0x6808d5=function(_0xdc061c){while(--_0xdc061c){_0x17e472['push'](_0x17e472['shift']());}};_0x6808d5(++_0x59989f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var sqlUtils=require(_0x0baf('0x0'));var db=require(_0x0baf('0x1'))['db'];exports[_0x0baf('0x2')]=function(_0x263f79,_0x1688bc,_0x4d2e72,_0x5a3e42){var _0x232cc7={'count':0x0,'rows':[]};var _0x1c383e=sqlUtils[_0x0baf('0x3')](_0x1688bc,_0x263f79);if(_0x1c383e){return Promise[_0x0baf('0x4')](_0x232cc7);}var _0xe4c3c4=sqlUtils[_0x0baf('0x5')]();var _0x1a10b1={};var _0x2dcaac=![];var _0x1d0a0d=![];return Promise['resolve']()[_0x0baf('0x6')](function(){if(_0x263f79['search']){return sqlUtils[_0x0baf('0x7')](_0x263f79[_0x0baf('0x8')],_0x5a3e42);}else{return sqlUtils[_0x0baf('0x9')](_0x263f79,_0x5a3e42);}})[_0x0baf('0x6')](function(_0x7f54d4){_0xe4c3c4[_0x0baf('0xa')](_0x7f54d4[_0x0baf('0xb')]);_0xe4c3c4[_0x0baf('0xa')](_0x7f54d4[_0x0baf('0xc')]);_0xe4c3c4[_0x0baf('0xa')](_0x7f54d4[_0x0baf('0xd')]);_0xe4c3c4['where'](_0x7f54d4['user'][_0x0baf('0xe')]);_0x1a10b1=_0x7f54d4[_0x0baf('0xf')];_0x1d0a0d=_0x7f54d4[_0x0baf('0x10')][_0x0baf('0x11')];return sqlUtils['checkListsRestrictions'](_0x1688bc,_0x263f79,_0x1d0a0d);})[_0x0baf('0x6')](function(_0x49e44b){_0xe4c3c4[_0x0baf('0xa')](_0x49e44b);var _0x1f50c3=_0x263f79[_0x0baf('0x8')]?_0x1a10b1[_0x0baf('0x12')]:_0x263f79[_0x0baf('0x13')];_0x2dcaac=_0x1f50c3?!![]:![];return sqlUtils[_0x0baf('0x14')](_0xe4c3c4,_0x1f50c3);})['then'](function(_0x4cd79d){_0x232cc7[_0x0baf('0x15')]=_0x4cd79d;if(_0x232cc7[_0x0baf('0x15')]===0x0){return;}return sqlUtils[_0x0baf('0x16')](_0xe4c3c4,_0x263f79[_0x0baf('0xc')],_0x4d2e72,_0x2dcaac,_0x1a10b1[_0x0baf('0xe')],_0x1d0a0d);})[_0x0baf('0x6')](function(_0x53c338){if(!_0x53c338){return[];}return sqlUtils[_0x0baf('0x17')](_0x53c338,_0x263f79,_0x4d2e72);})[_0x0baf('0x6')](function(_0x1ef0e5){_0x232cc7[_0x0baf('0x18')]=_0x1ef0e5;return _0x232cc7;})[_0x0baf('0x19')](function(_0x42b7f2){throw _0x42b7f2;});};exports['describe']=function(){var _0x5cff5d={};var _0x1410ec=[];return db[_0x0baf('0x1a')][_0x0baf('0x1b')]()[_0x0baf('0x6')](function(_0x1fa92b){_0x5cff5d=_0x1fa92b;var _0x3e3e20=Object[_0x0baf('0x1c')](_0x5cff5d)[_0x0baf('0xd')](function(_0x2c42e2){return _[_0x0baf('0x1d')](_0x2c42e2,'cf_')?_0x2c42e2:undefined;});var _0x334bd6=_0x3e3e20['map'](function(_0xf6c158){return db['CmCustomField']['findOne']({'where':{'id':_0xf6c158[_0x0baf('0x1e')](0x3)},'raw':!![]});});return Promise['all'](_0x334bd6);})['then'](function(_0x47c4b){for(var _0x27b59c=0x0;_0x27b59c<_0x47c4b[_0x0baf('0x1f')];_0x27b59c++){if(_0x47c4b[_0x27b59c]){var _0x19d9fd=_0x0baf('0x20')+_0x47c4b[_0x27b59c]['id'];_0x5cff5d[_0x19d9fd]['fieldType']=_0x47c4b[_0x27b59c][_0x0baf('0x21')];}}_0x1410ec=_[_0x0baf('0x22')](Object[_0x0baf('0x1c')](_0x5cff5d),function(_0x366e71){return{'name':_0x366e71,'type':_0x5cff5d[_0x366e71][_0x0baf('0x21')]};});return _0x1410ec;})[_0x0baf('0x19')](function(_0x453525){throw _0x453525;});}; \ No newline at end of file +var _0x2032=['map','findOne','slice','all','length','fieldType','type','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','where','user','ids','tag','countFilteredContacts','count','buildContactsQuery','clause','getFilteredContacts','rows','describe','CmContact','filter','startsWith','cf_'];(function(_0x134796,_0xd3c92e){var _0x27c216=function(_0x5c0dcb){while(--_0x5c0dcb){_0x134796['push'](_0x134796['shift']());}};_0x27c216(++_0xd3c92e);}(_0x2032,0xd9));var _0x2203=function(_0x5b0c38,_0x286c22){_0x5b0c38=_0x5b0c38-0x0;var _0x24b085=_0x2032[_0x5b0c38];return _0x24b085;};'use strict';var _=require('lodash');var sqlUtils=require(_0x2203('0x0'));var db=require(_0x2203('0x1'))['db'];exports[_0x2203('0x2')]=function(_0x4c28da,_0x486390,_0x228a29,_0x4b4c7f){var _0x46c49a={'count':0x0,'rows':[]};var _0x880dcd=sqlUtils[_0x2203('0x3')](_0x486390,_0x4c28da);if(_0x880dcd){return Promise[_0x2203('0x4')](_0x46c49a);}var _0x3f7ba1=sqlUtils[_0x2203('0x5')]();var _0x2e0f63={};var _0x2676aa=![];var _0x18c4d6=![];return Promise[_0x2203('0x4')]()[_0x2203('0x6')](function(){if(_0x4c28da['search']){return sqlUtils['parseAdvancedSearchFilter'](_0x4c28da[_0x2203('0x7')],_0x4b4c7f);}else{return sqlUtils['parseQueryParameters'](_0x4c28da,_0x4b4c7f);}})[_0x2203('0x6')](function(_0x2972f3){_0x3f7ba1[_0x2203('0x8')](_0x2972f3['default']);_0x3f7ba1[_0x2203('0x8')](_0x2972f3['fields']);_0x3f7ba1[_0x2203('0x8')](_0x2972f3['filter']);_0x3f7ba1[_0x2203('0x8')](_0x2972f3[_0x2203('0x9')]['clause']);_0x2e0f63=_0x2972f3['tags'];_0x18c4d6=_0x2972f3['user']['skip'];return sqlUtils['checkListsRestrictions'](_0x486390,_0x4c28da,_0x18c4d6);})[_0x2203('0x6')](function(_0x538b30){_0x3f7ba1['where'](_0x538b30);var _0x21a3af=_0x4c28da[_0x2203('0x7')]?_0x2e0f63[_0x2203('0xa')]:_0x4c28da[_0x2203('0xb')];_0x2676aa=_0x21a3af?!![]:![];return sqlUtils[_0x2203('0xc')](_0x3f7ba1,_0x21a3af);})[_0x2203('0x6')](function(_0x2c36e6){_0x46c49a[_0x2203('0xd')]=_0x2c36e6;if(_0x46c49a[_0x2203('0xd')]===0x0){return;}return sqlUtils[_0x2203('0xe')](_0x3f7ba1,_0x4c28da['fields'],_0x228a29,_0x2676aa,_0x2e0f63[_0x2203('0xf')],_0x18c4d6);})[_0x2203('0x6')](function(_0x4893ff){if(!_0x4893ff){return[];}return sqlUtils[_0x2203('0x10')](_0x4893ff,_0x4c28da,_0x228a29);})[_0x2203('0x6')](function(_0x4aeb9f){_0x46c49a[_0x2203('0x11')]=_0x4aeb9f;return _0x46c49a;})['catch'](function(_0x2904ba){throw _0x2904ba;});};exports[_0x2203('0x12')]=function(){var _0x3c8c34={};var _0x3b4034=[];return db[_0x2203('0x13')][_0x2203('0x12')]()['then'](function(_0x13d3f7){_0x3c8c34=_0x13d3f7;var _0x50822b=Object['keys'](_0x3c8c34)[_0x2203('0x14')](function(_0x496d82){return _[_0x2203('0x15')](_0x496d82,_0x2203('0x16'))?_0x496d82:undefined;});var _0x5d4c4e=_0x50822b[_0x2203('0x17')](function(_0x5e29cd){return db['CmCustomField'][_0x2203('0x18')]({'where':{'id':_0x5e29cd[_0x2203('0x19')](0x3)},'raw':!![]});});return Promise[_0x2203('0x1a')](_0x5d4c4e);})[_0x2203('0x6')](function(_0x1244f4){for(var _0x3114ef=0x0;_0x3114ef<_0x1244f4[_0x2203('0x1b')];_0x3114ef++){if(_0x1244f4[_0x3114ef]){var _0x250349='cf_'+_0x1244f4[_0x3114ef]['id'];_0x3c8c34[_0x250349][_0x2203('0x1c')]=_0x1244f4[_0x3114ef][_0x2203('0x1d')];}}_0x3b4034=_[_0x2203('0x17')](Object['keys'](_0x3c8c34),function(_0xb2071b){return{'name':_0xb2071b,'type':_0x3c8c34[_0xb2071b][_0x2203('0x1d')]};});return _0x3b4034;})['catch'](function(_0xd6e109){throw _0xd6e109;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index d43c21d..3cb09b4 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 _0xb629=['c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','parseSearch','name','dateOfBirth','castTo','DATE','buildExpression','start','value','end','Tag','map','tags','clause','ids','user','and','skip','compact','Contact','concat','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','group','c.id','limit','offset','order','DESC','findAll','color','keyBy','QueryTypes','CmContact','query','toString','Tags','clone','COUNT(*)','t.id\x20IN\x20?','sequelize','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../../mysqldb','role','agent','search','ListId','autocomplete','select','from','where','c.deletedAt\x20IS\x20NULL','left_join','cm_user_has_contacts','ct.CmContactId\x20=\x20','.id','tools_tags','t.id\x20=\x20ct.TagId','subqry','lastName','phone','fax','email','updatedAt','deletedAt','TagIds','includes','push','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','getFullTextValue','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail'];(function(_0x3d0535,_0x253d07){var _0x5cb0e8=function(_0x24c7ba){while(--_0x24c7ba){_0x3d0535['push'](_0x3d0535['shift']());}};_0x5cb0e8(++_0x253d07);}(_0xb629,0x91));var _0x9b62=function(_0x350516,_0x139c24){_0x350516=_0x350516-0x0;var _0x5be443=_0xb629[_0x350516];return _0x5be443;};'use strict';var _=require(_0x9b62('0x0'));var squel=require(_0x9b62('0x1'));var as=require(_0x9b62('0x2'));var qs=require(_0x9b62('0x3'));var utils=require('../interaction/utils');var db=require(_0x9b62('0x4'))['db'];function skipContactsQuery(_0x43c0f8,_0x5bfc48){var _0x47e0ea=![];if(_0x43c0f8[_0x9b62('0x5')]===_0x9b62('0x6')&&!_0x5bfc48[_0x9b62('0x7')]&&!_0x5bfc48[_0x9b62('0x8')]&&_0x5bfc48[_0x9b62('0x9')]!=='true'){_0x47e0ea=!![];}return _0x47e0ea;}function getContactsSubquery(){return squel[_0x9b62('0xa')]()[_0x9b62('0xb')]('cm_contacts','c')[_0x9b62('0xc')](_0x9b62('0xd'));}function applyJoinClauses(_0x82b6cc,_0xdf7661){var _0x512e7e=_0xdf7661?'c':'subqry';_0x82b6cc[_0x9b62('0xe')](_0x9b62('0xf'),'uc','uc.CmContactId\x20=\x20'+_0x512e7e+'.id')[_0x9b62('0xe')]('cm_contact_has_tags','ct',_0x9b62('0x10')+_0x512e7e+_0x9b62('0x11'))[_0x9b62('0xe')](_0x9b62('0x12'),'t',_0x9b62('0x13'));return _0x82b6cc;}function addFieldsToQuery(_0x464523,_0x543b7a,_0x5671d6,_0x1562a2,_0x2adbbd){var _0x16e493=_0x2adbbd?'c':_0x9b62('0x14');if(!_0x543b7a){_0x543b7a=['id','firstName',_0x9b62('0x15'),_0x9b62('0x16'),'mobile',_0x9b62('0x17'),_0x9b62('0x18'),_0x9b62('0x8'),'CompanyId','createdAt',_0x9b62('0x19'),_0x9b62('0x1a'),_0x9b62('0x1b')];}else if(!_0x543b7a[_0x9b62('0x1c')]('id')){_0x543b7a[_0x9b62('0x1d')]('id');}var _0x1004a8=_0x5671d6&&_0x2adbbd||!_0x5671d6&&!_0x2adbbd;if(_0x1562a2){_0x1004a8=_0x1562a2&&_0x2adbbd||!_0x1562a2&&!_0x2adbbd;}_0x543b7a['forEach'](function(_0x1278a9){if(_0x1278a9===_0x9b62('0x1b')){if(_0x1004a8){_0x464523['field'](_0x9b62('0x1e'),_0x1278a9);}else if(_0x5671d6||_0x1562a2){_0x464523[_0x9b62('0x1f')](_0x16e493+'.'+_0x1278a9);}}else{_0x464523['field'](_0x16e493+'.'+_0x1278a9);}});return _0x464523;}function getSqlClauses(){var _0x19891f={'default':squel[_0x9b62('0x20')](),'fields':squel['expr'](),'filter':squel[_0x9b62('0x20')](),'tags':{'clause':squel[_0x9b62('0x20')](),'ids':null},'user':{'clause':squel[_0x9b62('0x20')](),'skip':![]}};return _0x19891f;}function parseTagParameter(_0x2fa1f8){var _0x4b2500=squel['expr']();if(_0x2fa1f8){var _0x2bd4f0=utils[_0x9b62('0x21')](_0x2fa1f8);_0x2bd4f0[_0x9b62('0x22')](function(_0xe6fe15){_0x4b2500['or'](_0x9b62('0x23'),'%,'+_0xe6fe15+',%');});}return _0x4b2500;}function parseSearchFilter(_0x40e5c4){var _0x6fa3a6=squel[_0x9b62('0x20')]();if(_0x40e5c4){var _0x431ba1=_0x40e5c4[_0x9b62('0x24')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x431ba1[_0x9b62('0x25')]('\x20')[_0x9b62('0x26')]>0x1){_0x6fa3a6['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x9b62('0x27')](_0x431ba1),null);}else{if(qs[_0x9b62('0x28')](_0x431ba1)){_0x6fa3a6['or']('c.id\x20LIKE\x20?',_0x431ba1+'%');_0x6fa3a6['or'](_0x9b62('0x29'),_0x431ba1+'%');_0x6fa3a6['or'](_0x9b62('0x2a'),_0x431ba1+'%');_0x6fa3a6['or'](_0x9b62('0x2b'),_0x431ba1+'%');}else if(qs[_0x9b62('0x2c')](_0x431ba1)){_0x6fa3a6['or'](_0x9b62('0x2d'),_0x431ba1+'%');}else{_0x6fa3a6['or'](_0x9b62('0x2e'),'%'+_0x431ba1+'%');_0x6fa3a6['or']('c.lastName\x20LIKE\x20?','%'+_0x431ba1+'%');_0x6fa3a6['or'](_0x9b62('0x2d'),'%'+_0x431ba1+'%');}}}return _0x6fa3a6;}function parseAdvancedSearchFilter(_0x4bfd3c,_0x306e03){var _0x15b0a5=getSqlClauses();var _0x3df86c=as[_0x9b62('0x2f')](_0x4bfd3c);var _0x1fac70=_0x3df86c['sqlOperator'];for(var _0x68236c=0x0;_0x68236c<_0x3df86c['conditions'][_0x9b62('0x26')];_0x68236c++){var _0x38395d=_0x3df86c['conditions'][_0x68236c];var _0x35fbf9='c';var _0x14aceb=_['find'](_0x306e03,[_0x9b62('0x30'),_0x38395d['field']]);if(_0x14aceb){if(_0x38395d[_0x9b62('0x1f')]===_0x9b62('0x31')||_0x14aceb['fieldType']==='datetime'){_0x38395d[_0x9b62('0x32')]=_0x9b62('0x33');}var _0x22ecab=as[_0x9b62('0x34')](_0x35fbf9,_0x14aceb['type'],_0x38395d);_0x15b0a5['default'][_0x1fac70](_0x22ecab['text'],_0x22ecab['value'][_0x9b62('0x35')],_0x22ecab[_0x9b62('0x36')][_0x9b62('0x37')]);}else{if(_0x38395d[_0x9b62('0x1f')]===_0x9b62('0x38')){var _0x57a5e1=_0x38395d[_0x9b62('0x36')]['split'](',')[_0x9b62('0x39')](function(_0x27841c){return Number(_0x27841c);});var _0x50929e=parseTagParameter(_0x57a5e1);_0x15b0a5[_0x9b62('0x3a')][_0x9b62('0x3b')]['and'](_0x50929e);_0x15b0a5[_0x9b62('0x3a')][_0x9b62('0x3c')]=_0x57a5e1;}else if(_0x38395d[_0x9b62('0x1f')]==='User'){_0x15b0a5[_0x9b62('0x3d')][_0x9b62('0x3b')][_0x9b62('0x3e')]('uc.UserId\x20=\x20?',_0x38395d[_0x9b62('0x36')]);_0x15b0a5['user'][_0x9b62('0x3f')]=!![];}}}return _0x15b0a5;}function parseModelFields(_0x4f3a1b,_0x5b16bf){var _0xeee4b9=squel[_0x9b62('0x20')]();var _0x3af8a3=_(_0x4f3a1b)['keys']()[_0x9b62('0x39')](function(_0x1c98da){return _['some'](_0x5b16bf,[_0x9b62('0x30'),_0x1c98da])?_0x1c98da:undefined;})[_0x9b62('0x40')]()['value']();if(_0x4f3a1b[_0x9b62('0x41')]){_0x3af8a3[_0x9b62('0x1d')]('Contact');}if(_0x3af8a3[_0x9b62('0x26')]>0x0){_0x3af8a3['forEach'](function(_0x598dba){if(_0x598dba==='ListId'){_0xeee4b9[_0x9b62('0x3e')]('c.ListId\x20IN\x20?',[][_0x9b62('0x42')](_0x4f3a1b[_0x598dba]));}else if(_0x598dba===_0x9b62('0x41')){var _0x3c1d78='%'+_0x4f3a1b[_0x598dba]+'%';_0xeee4b9['and'](_0x9b62('0x43'),_0x3c1d78);}else{_0xeee4b9[_0x9b62('0x3e')]('c.'+_0x598dba+_0x9b62('0x44'),_0x4f3a1b[_0x598dba]);}});}return _0xeee4b9;}function parseQueryParameters(_0x4f675a,_0x2554d5){var _0x36f2cc=getSqlClauses();return Promise[_0x9b62('0x45')]()[_0x9b62('0x46')](function(){return parseModelFields(_0x4f675a,_0x2554d5);})[_0x9b62('0x46')](function(_0x1faffb){_0x36f2cc[_0x9b62('0x47')]['and'](_0x1faffb);return parseTagParameter(_0x4f675a[_0x9b62('0x48')]);})['then'](function(_0x163b8f){_0x36f2cc[_0x9b62('0x3a')][_0x9b62('0x3b')][_0x9b62('0x3e')](_0x163b8f);return parseSearchFilter(_0x4f675a[_0x9b62('0x49')]);})[_0x9b62('0x46')](function(_0x180810){_0x36f2cc[_0x9b62('0x49')]=_0x180810;return _0x36f2cc;});}function checkListsRestrictions(_0x22e180,_0x3b1c4f,_0x3088b6){var _0x2b73c0=squel[_0x9b62('0x20')]();return Promise[_0x9b62('0x45')]()['then'](function(){if(_0x3b1c4f['search']&&_0x22e180[_0x9b62('0x5')]===_0x9b62('0x6')&&!_0x3088b6){return _0x22e180[_0x9b62('0x4a')]({'attributes':['id'],'raw':!![]});}})[_0x9b62('0x46')](function(_0x25e0c1){if(_0x25e0c1){if(_0x25e0c1[_0x9b62('0x26')]===0x0){_0x2b73c0[_0x9b62('0x3e')](_0x9b62('0x4b'));}else{_0x2b73c0[_0x9b62('0x3e')]('c.ListId\x20IN\x20?',_[_0x9b62('0x39')](_0x25e0c1,'id'));}}})[_0x9b62('0x46')](function(){return _0x2b73c0;});}function buildContactsQuery(_0x3e05ac,_0x155171,_0x5156fe,_0x44adde,_0x17e556,_0x467e85){if(_0x155171){_0x155171=_0x5156fe['attributes'];}_0x3e05ac=addFieldsToQuery(_0x3e05ac,_0x155171,_0x44adde,_0x467e85,!![]);var _0x22ac44=squel['select']();_0x22ac44=addFieldsToQuery(_0x22ac44,_0x155171,_0x44adde,_0x467e85,![]);if(_0x44adde||_0x467e85){_0x3e05ac=applyJoinClauses(_0x3e05ac,!![]);_0x3e05ac[_0x9b62('0x4c')](_0x9b62('0x4d'));if(_0x5156fe[_0x9b62('0x4e')]){_0x22ac44[_0x9b62('0x4e')](_0x5156fe[_0x9b62('0x4e')]);}if(_0x5156fe[_0x9b62('0x4f')]){_0x22ac44['offset'](_0x5156fe[_0x9b62('0x4f')]);}}else{_0x22ac44=applyJoinClauses(_0x22ac44,![]);_0x22ac44[_0x9b62('0x4c')]('subqry.id');if(_0x5156fe[_0x9b62('0x4e')]){_0x3e05ac['limit'](_0x5156fe[_0x9b62('0x4e')]);}if(_0x5156fe['offset']){_0x3e05ac['offset'](_0x5156fe['offset']);}}_0x22ac44['having'](_0x17e556);if(_0x5156fe[_0x9b62('0x50')]){_0x5156fe['order'][_0x9b62('0x22')](function(_0x27b555){_0x3e05ac[_0x9b62('0x50')]('c.'+_0x27b555[0x0],_0x27b555[0x1]===_0x9b62('0x51')?![]:!![]);_0x22ac44['order']('subqry.'+_0x27b555[0x0],_0x27b555[0x1]===_0x9b62('0x51')?![]:!![]);});}_0x22ac44[_0x9b62('0xb')](_0x3e05ac,'subqry');return _0x22ac44;}function getFilteredContacts(_0x1aefcc){var _0x93acc3=[];return db[_0x9b62('0x38')][_0x9b62('0x52')]({'attributes':['id',_0x9b62('0x30'),_0x9b62('0x53')],'raw':!![]})[_0x9b62('0x46')](function(_0x2e86aa){_0x93acc3=_[_0x9b62('0x54')](_0x2e86aa,'id');var _0x1fe053={'type':db['Sequelize'][_0x9b62('0x55')]['SELECT'],'model':db[_0x9b62('0x56')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x9b62('0x57')](_0x1aefcc[_0x9b62('0x58')](),_0x1fe053);})[_0x9b62('0x46')](function(_0x25d5be){_0x25d5be[_0x9b62('0x22')](function(_0x560f6a){if(_0x560f6a[_0x9b62('0x1b')]){_0x560f6a[_0x9b62('0x59')]=[];_0x560f6a[_0x9b62('0x1b')][_0x9b62('0x25')](',')[_0x9b62('0x22')](function(_0x4ad19f){_0x560f6a[_0x9b62('0x59')]['push'](_0x93acc3[_0x4ad19f]);});}delete _0x560f6a[_0x9b62('0x1b')];});return _0x25d5be;});}function countFilteredContacts(_0x164682,_0x36e988){var _0x2975af=_0x164682[_0x9b62('0x5a')]();_0x2975af[_0x9b62('0x1f')](_0x9b62('0x5b'));_0x2975af=applyJoinClauses(_0x2975af,!![]);_0x164682[_0x9b62('0x4c')](_0x9b62('0x4d'));var _0x6e4984=utils[_0x9b62('0x21')](_0x36e988);if(!_['isEmpty'](_0x6e4984)){_0x2975af[_0x9b62('0xc')](_0x9b62('0x5c'),_0x6e4984);}var _0x5b0918={'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};return db[_0x9b62('0x5d')][_0x9b62('0x57')](_0x2975af[_0x9b62('0x58')](),_0x5b0918)[_0x9b62('0x46')](function(_0x151d89){return _0x151d89[0x0][_0x9b62('0x5b')];});}module[_0x9b62('0x5e')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x9af9=['../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','ListId','autocomplete','true','select','from','cm_contacts','subqry','left_join','uc.CmContactId\x20=\x20','.id','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','fax','CompanyId','updatedAt','deletedAt','includes','push','TagIds','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','forEach','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','dateOfBirth','datetime','castTo','buildExpression','type','text','start','value','end','Tag','map','tags','clause','and','ids','user','uc.UserId\x20=\x20?','keys','name','compact','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','search','getLists','c.ListId\x20IS\x20NULL','group','limit','offset','subqry.id','order','DESC','findAll','color','keyBy','QueryTypes','SELECT','CmContact','sequelize','Tags','c.id','t.id\x20IN\x20?','Sequelize','query','toString','COUNT(*)','exports','lodash','squel'];(function(_0x3c456b,_0x12251b){var _0x4c7e1a=function(_0x3d74bc){while(--_0x3d74bc){_0x3c456b['push'](_0x3c456b['shift']());}};_0x4c7e1a(++_0x12251b);}(_0x9af9,0x19e));var _0x99af=function(_0x1a7231,_0x4f45f0){_0x1a7231=_0x1a7231-0x0;var _0x350f58=_0x9af9[_0x1a7231];return _0x350f58;};'use strict';var _=require(_0x99af('0x0'));var squel=require(_0x99af('0x1'));var as=require(_0x99af('0x2'));var qs=require(_0x99af('0x3'));var utils=require(_0x99af('0x4'));var db=require(_0x99af('0x5'))['db'];function skipContactsQuery(_0x148b51,_0x5e0e73){var _0x1e7aa=![];if(_0x148b51[_0x99af('0x6')]===_0x99af('0x7')&&!_0x5e0e73['search']&&!_0x5e0e73[_0x99af('0x8')]&&_0x5e0e73[_0x99af('0x9')]!==_0x99af('0xa')){_0x1e7aa=!![];}return _0x1e7aa;}function getContactsSubquery(){return squel[_0x99af('0xb')]()[_0x99af('0xc')](_0x99af('0xd'),'c')['where']('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x29bccf,_0x3f55f4){var _0x27ac8f=_0x3f55f4?'c':_0x99af('0xe');_0x29bccf[_0x99af('0xf')]('cm_user_has_contacts','uc',_0x99af('0x10')+_0x27ac8f+_0x99af('0x11'))[_0x99af('0xf')]('cm_contact_has_tags','ct',_0x99af('0x12')+_0x27ac8f+_0x99af('0x11'))[_0x99af('0xf')](_0x99af('0x13'),'t',_0x99af('0x14'));return _0x29bccf;}function addFieldsToQuery(_0x81d1da,_0x5dd44b,_0x37ef16,_0xa2693c,_0x17dd04){var _0x449965=_0x17dd04?'c':_0x99af('0xe');if(!_0x5dd44b){_0x5dd44b=['id',_0x99af('0x15'),_0x99af('0x16'),_0x99af('0x17'),_0x99af('0x18'),_0x99af('0x19'),'email',_0x99af('0x8'),_0x99af('0x1a'),'createdAt',_0x99af('0x1b'),_0x99af('0x1c'),'TagIds'];}else if(!_0x5dd44b[_0x99af('0x1d')]('id')){_0x5dd44b[_0x99af('0x1e')]('id');}var _0xfff4b5=_0x37ef16&&_0x17dd04||!_0x37ef16&&!_0x17dd04;if(_0xa2693c){_0xfff4b5=_0xa2693c&&_0x17dd04||!_0xa2693c&&!_0x17dd04;}_0x5dd44b['forEach'](function(_0x785d48){if(_0x785d48===_0x99af('0x1f')){if(_0xfff4b5){_0x81d1da[_0x99af('0x20')](_0x99af('0x21'),_0x785d48);}else if(_0x37ef16||_0xa2693c){_0x81d1da[_0x99af('0x20')](_0x449965+'.'+_0x785d48);}}else{_0x81d1da[_0x99af('0x20')](_0x449965+'.'+_0x785d48);}});return _0x81d1da;}function getSqlClauses(){var _0x3d65b2={'default':squel[_0x99af('0x22')](),'fields':squel[_0x99af('0x22')](),'filter':squel[_0x99af('0x22')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0x99af('0x22')](),'skip':![]}};return _0x3d65b2;}function parseTagParameter(_0x3974d7){var _0x15dd15=squel[_0x99af('0x22')]();if(_0x3974d7){var _0x3b9235=utils['getSelectedTags'](_0x3974d7);_0x3b9235[_0x99af('0x23')](function(_0xd9a25a){_0x15dd15['or'](_0x99af('0x24'),'%,'+_0xd9a25a+',%');});}return _0x15dd15;}function parseSearchFilter(_0x195022){var _0x1b581=squel[_0x99af('0x22')]();if(_0x195022){var _0x3aa05f=_0x195022[_0x99af('0x25')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x3aa05f[_0x99af('0x26')]('\x20')[_0x99af('0x27')]>0x1){_0x1b581['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x99af('0x28')](_0x3aa05f),null);}else{if(qs['isNumeric'](_0x3aa05f)){_0x1b581['or'](_0x99af('0x29'),_0x3aa05f+'%');_0x1b581['or'](_0x99af('0x2a'),_0x3aa05f+'%');_0x1b581['or'](_0x99af('0x2b'),_0x3aa05f+'%');_0x1b581['or'](_0x99af('0x2c'),_0x3aa05f+'%');}else if(qs['isEmail'](_0x3aa05f)){_0x1b581['or']('c.email\x20LIKE\x20?',_0x3aa05f+'%');}else{_0x1b581['or'](_0x99af('0x2d'),'%'+_0x3aa05f+'%');_0x1b581['or'](_0x99af('0x2e'),'%'+_0x3aa05f+'%');_0x1b581['or']('c.email\x20LIKE\x20?','%'+_0x3aa05f+'%');}}}return _0x1b581;}function parseAdvancedSearchFilter(_0x501928,_0x50ed11){var _0x51b373=getSqlClauses();var _0x5f09c6=as[_0x99af('0x2f')](_0x501928);var _0x32c330=_0x5f09c6[_0x99af('0x30')];for(var _0x2fa00a=0x0;_0x2fa00a<_0x5f09c6[_0x99af('0x31')][_0x99af('0x27')];_0x2fa00a++){var _0x16245d=_0x5f09c6[_0x99af('0x31')][_0x2fa00a];var _0x1a0d9f='c';var _0x2e86de=_['find'](_0x50ed11,['name',_0x16245d[_0x99af('0x20')]]);if(_0x2e86de){if(_0x16245d[_0x99af('0x20')]===_0x99af('0x32')||_0x2e86de['fieldType']===_0x99af('0x33')){_0x16245d[_0x99af('0x34')]='DATE';}var _0x3936cf=as[_0x99af('0x35')](_0x1a0d9f,_0x2e86de[_0x99af('0x36')],_0x16245d);_0x51b373['default'][_0x32c330](_0x3936cf[_0x99af('0x37')],_0x3936cf['value'][_0x99af('0x38')],_0x3936cf[_0x99af('0x39')][_0x99af('0x3a')]);}else{if(_0x16245d[_0x99af('0x20')]===_0x99af('0x3b')){var _0x1188d0=_0x16245d['value'][_0x99af('0x26')](',')[_0x99af('0x3c')](function(_0xea0056){return Number(_0xea0056);});var _0x5d6ec6=parseTagParameter(_0x1188d0);_0x51b373[_0x99af('0x3d')][_0x99af('0x3e')][_0x99af('0x3f')](_0x5d6ec6);_0x51b373[_0x99af('0x3d')][_0x99af('0x40')]=_0x1188d0;}else if(_0x16245d[_0x99af('0x20')]==='User'){_0x51b373[_0x99af('0x41')]['clause']['and'](_0x99af('0x42'),_0x16245d['value']);_0x51b373[_0x99af('0x41')]['skip']=!![];}}}return _0x51b373;}function parseModelFields(_0xa5181e,_0x168010){var _0xba2832=squel['expr']();var _0x492e72=_(_0xa5181e)[_0x99af('0x43')]()[_0x99af('0x3c')](function(_0x3ee6bb){return _['some'](_0x168010,[_0x99af('0x44'),_0x3ee6bb])?_0x3ee6bb:undefined;})[_0x99af('0x45')]()[_0x99af('0x39')]();if(_0xa5181e['Contact']){_0x492e72[_0x99af('0x1e')](_0x99af('0x46'));}if(_0x492e72['length']>0x0){_0x492e72['forEach'](function(_0x283895){if(_0x283895===_0x99af('0x8')){_0xba2832['and'](_0x99af('0x47'),[][_0x99af('0x48')](_0xa5181e[_0x283895]));}else if(_0x283895==='Contact'){var _0x19accf='%'+_0xa5181e[_0x283895]+'%';_0xba2832['and'](_0x99af('0x49'),_0x19accf);}else{_0xba2832['and']('c.'+_0x283895+_0x99af('0x4a'),_0xa5181e[_0x283895]);}});}return _0xba2832;}function parseQueryParameters(_0x14de30,_0x1d2e1e){var _0x2f6166=getSqlClauses();return Promise[_0x99af('0x4b')]()[_0x99af('0x4c')](function(){return parseModelFields(_0x14de30,_0x1d2e1e);})[_0x99af('0x4c')](function(_0x37ace9){_0x2f6166[_0x99af('0x4d')]['and'](_0x37ace9);return parseTagParameter(_0x14de30[_0x99af('0x4e')]);})[_0x99af('0x4c')](function(_0x15497c){_0x2f6166['tags'][_0x99af('0x3e')][_0x99af('0x3f')](_0x15497c);return parseSearchFilter(_0x14de30[_0x99af('0x4f')]);})[_0x99af('0x4c')](function(_0x581c9f){_0x2f6166[_0x99af('0x4f')]=_0x581c9f;return _0x2f6166;});}function checkListsRestrictions(_0x288117,_0x57efd1,_0xe9fc18){var _0x4e2b4a=squel[_0x99af('0x22')]();return Promise[_0x99af('0x4b')]()[_0x99af('0x4c')](function(){if(_0x57efd1[_0x99af('0x50')]&&_0x288117[_0x99af('0x6')]==='agent'&&!_0xe9fc18){return _0x288117[_0x99af('0x51')]({'attributes':['id'],'raw':!![]});}})[_0x99af('0x4c')](function(_0x4acc6e){if(_0x4acc6e){if(_0x4acc6e[_0x99af('0x27')]===0x0){_0x4e2b4a[_0x99af('0x3f')](_0x99af('0x52'));}else{_0x4e2b4a[_0x99af('0x3f')](_0x99af('0x47'),_[_0x99af('0x3c')](_0x4acc6e,'id'));}}})[_0x99af('0x4c')](function(){return _0x4e2b4a;});}function buildContactsQuery(_0x42870f,_0x26ea74,_0x5b2d3f,_0x31a9bb,_0x3c78a9,_0x8b3e73){if(_0x26ea74){_0x26ea74=_0x5b2d3f['attributes'];}_0x42870f=addFieldsToQuery(_0x42870f,_0x26ea74,_0x31a9bb,_0x8b3e73,!![]);var _0x21c36c=squel[_0x99af('0xb')]();_0x21c36c=addFieldsToQuery(_0x21c36c,_0x26ea74,_0x31a9bb,_0x8b3e73,![]);if(_0x31a9bb||_0x8b3e73){_0x42870f=applyJoinClauses(_0x42870f,!![]);_0x42870f[_0x99af('0x53')]('c.id');if(_0x5b2d3f[_0x99af('0x54')]){_0x21c36c[_0x99af('0x54')](_0x5b2d3f[_0x99af('0x54')]);}if(_0x5b2d3f[_0x99af('0x55')]){_0x21c36c[_0x99af('0x55')](_0x5b2d3f['offset']);}}else{_0x21c36c=applyJoinClauses(_0x21c36c,![]);_0x21c36c[_0x99af('0x53')](_0x99af('0x56'));if(_0x5b2d3f['limit']){_0x42870f[_0x99af('0x54')](_0x5b2d3f['limit']);}if(_0x5b2d3f[_0x99af('0x55')]){_0x42870f[_0x99af('0x55')](_0x5b2d3f[_0x99af('0x55')]);}}_0x21c36c['having'](_0x3c78a9);if(_0x5b2d3f[_0x99af('0x57')]){_0x5b2d3f[_0x99af('0x57')][_0x99af('0x23')](function(_0x62e8c3){_0x42870f[_0x99af('0x57')]('c.'+_0x62e8c3[0x0],_0x62e8c3[0x1]===_0x99af('0x58')?![]:!![]);_0x21c36c[_0x99af('0x57')]('subqry.'+_0x62e8c3[0x0],_0x62e8c3[0x1]==='DESC'?![]:!![]);});}_0x21c36c[_0x99af('0xc')](_0x42870f,_0x99af('0xe'));return _0x21c36c;}function getFilteredContacts(_0xed69ba){var _0x1bf41a=[];return db['Tag'][_0x99af('0x59')]({'attributes':['id',_0x99af('0x44'),_0x99af('0x5a')],'raw':!![]})[_0x99af('0x4c')](function(_0x249d14){_0x1bf41a=_[_0x99af('0x5b')](_0x249d14,'id');var _0x175602={'type':db['Sequelize'][_0x99af('0x5c')][_0x99af('0x5d')],'model':db[_0x99af('0x5e')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x99af('0x5f')]['query'](_0xed69ba['toString'](),_0x175602);})[_0x99af('0x4c')](function(_0x2cb8ad){_0x2cb8ad['forEach'](function(_0x1a3895){if(_0x1a3895[_0x99af('0x1f')]){_0x1a3895[_0x99af('0x60')]=[];_0x1a3895[_0x99af('0x1f')]['split'](',')[_0x99af('0x23')](function(_0x10f958){_0x1a3895[_0x99af('0x60')]['push'](_0x1bf41a[_0x10f958]);});}delete _0x1a3895[_0x99af('0x1f')];});return _0x2cb8ad;});}function countFilteredContacts(_0x2f2c4,_0x2cd3a5){var _0x3de914=_0x2f2c4['clone']();_0x3de914[_0x99af('0x20')]('COUNT(*)');_0x3de914=applyJoinClauses(_0x3de914,!![]);_0x2f2c4[_0x99af('0x53')](_0x99af('0x61'));var _0x341203=utils['getSelectedTags'](_0x2cd3a5);if(!_['isEmpty'](_0x341203)){_0x3de914['where'](_0x99af('0x62'),_0x341203);}var _0x3f2882={'type':db[_0x99af('0x63')]['QueryTypes'][_0x99af('0x5d')],'raw':!![]};return db[_0x99af('0x5f')][_0x99af('0x64')](_0x3de914[_0x99af('0x65')](),_0x3f2882)[_0x99af('0x4c')](function(_0x43b990){return _0x43b990[0x0][_0x99af('0x66')];});}module[_0x99af('0x67')]={'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 0af6702..5d2bac5 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 _0x5428=['crypto','bluebird','../../config/environment','app','secrets','session','aes-256-ctr','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','hasOwnProperty','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','final','close','unlink','createDecipher','encryptString','secret','utf8','base64'];(function(_0x2ca330,_0x899f75){var _0x119f7b=function(_0x505dde){while(--_0x505dde){_0x2ca330['push'](_0x2ca330['shift']());}};_0x119f7b(++_0x899f75);}(_0x5428,0x117));var _0x8542=function(_0x23eb5b,_0x3d898c){_0x23eb5b=_0x23eb5b-0x0;var _0x38b7e6=_0x5428[_0x23eb5b];return _0x38b7e6;};'use strict';var crypto=require(_0x8542('0x0'));var fs=require('fs');var BPromise=require(_0x8542('0x1'));var _=require('lodash');var config=require(_0x8542('0x2'));var logger=require('../../config/logger')(_0x8542('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x8542('0x4')][_0x8542('0x5')],'algorithm':_0x8542('0x6')};const fileOptions={'algorithm':'aes192'};if(config[_0x8542('0x7')]&&config[_0x8542('0x7')][_0x8542('0x8')]){var isSupported=isAlgorithmSupported(config[_0x8542('0x7')][_0x8542('0x8')]);if(isSupported){fileOptions[_0x8542('0x8')]=config[_0x8542('0x7')][_0x8542('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x8542('0x9')](',\x20');logger[_0x8542('0xa')](config[_0x8542('0x7')][_0x8542('0x8')],_0x8542('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x35c9a8){return AES_SUPPORTED_RX[_0x8542('0xc')](_0x35c9a8);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x8542('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0xe3fc3d){return getSupportedCiphers()['indexOf'](_0xe3fc3d)>-0x1;}function combineOptions(_0x2cde41){var _0x190e9c={};for(var _0x43ec83 in fileOptions){if(fileOptions[_0x8542('0xe')](_0x43ec83)){_0x190e9c[_0x43ec83]=fileOptions[_0x43ec83];}}if(_0x2cde41){for(var _0xd80968 in _0x2cde41){if(_0x2cde41['hasOwnProperty'](_0xd80968)){_0x190e9c[_0xd80968]=_0x2cde41[_0xd80968];}}}return _0x190e9c;}exports['encryptFile']=function(_0x1dca1e,_0x1de9d8,_0x5eb387,_0x214d70){return new BPromise(function(_0xacd20d,_0x5d35da){_0x214d70=combineOptions(_0x214d70);var _0x53aa5f=new Buffer(_0x5eb387);var _0x125dbd=fs[_0x8542('0xf')](_0x1dca1e);var _0x54d504=fs[_0x8542('0x10')](_0x1de9d8);var _0x334316=crypto[_0x8542('0x11')](_0x214d70['algorithm'],_0x53aa5f);_0x125dbd['on'](_0x8542('0x12'),function(_0xc53104){var _0x30954f=new Buffer(_0x334316[_0x8542('0x13')](_0xc53104),_0x8542('0x14'));_0x54d504[_0x8542('0x15')](_0x30954f);});_0x125dbd['on'](_0x8542('0x16'),function(){try{var _0x4889a5=new Buffer(_0x334316[_0x8542('0x17')](_0x8542('0x14')),_0x8542('0x14'));_0x54d504[_0x8542('0x15')](_0x4889a5);_0x54d504['end']();_0x54d504['on'](_0x8542('0x18'),function(){return _0xacd20d(_0x1de9d8);});}catch(_0x340e1a){fs[_0x8542('0x19')](_0x1de9d8);return _0x5d35da(_0x340e1a);}});});};exports['decryptFile']=function(_0x44e6dc,_0x229ab1,_0x17097b,_0x3b238d){return new BPromise(function(_0x4ce938,_0x93d540){_0x3b238d=combineOptions(_0x3b238d);var _0x5423e7=new Buffer(_0x17097b);var _0x259f35=fs[_0x8542('0xf')](_0x44e6dc);var _0x5b3b9b=fs[_0x8542('0x10')](_0x229ab1);var _0x37d9e0=crypto[_0x8542('0x1a')](_0x3b238d['algorithm'],_0x5423e7);_0x259f35['on'](_0x8542('0x12'),function(_0x162420){var _0x218305=new Buffer(_0x37d9e0[_0x8542('0x13')](_0x162420),_0x8542('0x14'));_0x5b3b9b[_0x8542('0x15')](_0x218305);});_0x259f35['on']('end',function(){try{var _0x26c596=new Buffer(_0x37d9e0[_0x8542('0x17')]('binary'),_0x8542('0x14'));_0x5b3b9b[_0x8542('0x15')](_0x26c596);_0x5b3b9b['end']();_0x5b3b9b['on'](_0x8542('0x18'),function(){return _0x4ce938(_0x229ab1);});}catch(_0x493fed){fs['unlink'](_0x229ab1);return _0x93d540(_0x493fed);}});});};exports[_0x8542('0x1b')]=function(_0x3951f3,_0x1c8999,_0x28c07e){var _0x4a22f1=_0x28c07e||stringOptions[_0x8542('0x8')];var _0x2f7e0d=_0x1c8999||stringOptions[_0x8542('0x1c')];var _0x490041=crypto[_0x8542('0x11')](_0x4a22f1,_0x2f7e0d);var _0x134cf3=_0x490041[_0x8542('0x13')](_0x3951f3,_0x8542('0x1d'),_0x8542('0x1e'));_0x134cf3+=_0x490041[_0x8542('0x17')]('base64');return _0x134cf3;};exports['decryptString']=function(_0x3c2ee2,_0x2ca04a,_0x229997){var _0x4345b6=_0x229997||stringOptions[_0x8542('0x8')];var _0x13aff4=_0x2ca04a||stringOptions[_0x8542('0x1c')];var _0x690618=crypto[_0x8542('0x1a')](_0x4345b6,_0x13aff4);var _0x5399ef=_0x690618['update'](_0x3c2ee2,'base64','utf8');_0x5399ef+=_0x690618[_0x8542('0x17')](_0x8542('0x1d'));return _0x5399ef;}; \ No newline at end of file +var _0x8d6f=['utf8','decryptString','base64','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','filter','indexOf','hasOwnProperty','createReadStream','createWriteStream','createCipher','update','write','end','binary','close','unlink','createDecipher','data','final','encryptString','secret'];(function(_0x72052f,_0x503f17){var _0x3c1e6b=function(_0x3401){while(--_0x3401){_0x72052f['push'](_0x72052f['shift']());}};_0x3c1e6b(++_0x503f17);}(_0x8d6f,0xdc));var _0xf8d6=function(_0x24c4a5,_0x141351){_0x24c4a5=_0x24c4a5-0x0;var _0x2a28d1=_0x8d6f[_0x24c4a5];return _0x2a28d1;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var _=require('lodash');var config=require(_0xf8d6('0x0'));var logger=require(_0xf8d6('0x1'))(_0xf8d6('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xf8d6('0x3')][_0xf8d6('0x4')],'algorithm':_0xf8d6('0x5')};const fileOptions={'algorithm':'aes192'};if(config[_0xf8d6('0x6')]&&config[_0xf8d6('0x6')][_0xf8d6('0x7')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0xf8d6('0x7')]);if(isSupported){fileOptions['algorithm']=config[_0xf8d6('0x6')][_0xf8d6('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xf8d6('0x8')](',\x20');logger[_0xf8d6('0x9')](config[_0xf8d6('0x6')]['algorithm'],_0xf8d6('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x392a15){return AES_SUPPORTED_RX['test'](_0x392a15);}function getSupportedCiphers(){return crypto['getCiphers']()[_0xf8d6('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x3eee74){return getSupportedCiphers()[_0xf8d6('0xc')](_0x3eee74)>-0x1;}function combineOptions(_0x2e5523){var _0x33c043={};for(var _0x56ea5a in fileOptions){if(fileOptions['hasOwnProperty'](_0x56ea5a)){_0x33c043[_0x56ea5a]=fileOptions[_0x56ea5a];}}if(_0x2e5523){for(var _0x300636 in _0x2e5523){if(_0x2e5523[_0xf8d6('0xd')](_0x300636)){_0x33c043[_0x300636]=_0x2e5523[_0x300636];}}}return _0x33c043;}exports['encryptFile']=function(_0x2d09a6,_0x1f0c16,_0x4b110e,_0x5c9aac){return new BPromise(function(_0x2394d8,_0x3419c3){_0x5c9aac=combineOptions(_0x5c9aac);var _0x438dfd=new Buffer(_0x4b110e);var _0x2a17e3=fs[_0xf8d6('0xe')](_0x2d09a6);var _0x4461cf=fs[_0xf8d6('0xf')](_0x1f0c16);var _0x4e0203=crypto[_0xf8d6('0x10')](_0x5c9aac['algorithm'],_0x438dfd);_0x2a17e3['on']('data',function(_0x1a7160){var _0x437a8c=new Buffer(_0x4e0203[_0xf8d6('0x11')](_0x1a7160),'binary');_0x4461cf[_0xf8d6('0x12')](_0x437a8c);});_0x2a17e3['on'](_0xf8d6('0x13'),function(){try{var _0x554b17=new Buffer(_0x4e0203['final'](_0xf8d6('0x14')),_0xf8d6('0x14'));_0x4461cf[_0xf8d6('0x12')](_0x554b17);_0x4461cf[_0xf8d6('0x13')]();_0x4461cf['on'](_0xf8d6('0x15'),function(){return _0x2394d8(_0x1f0c16);});}catch(_0x629e41){fs[_0xf8d6('0x16')](_0x1f0c16);return _0x3419c3(_0x629e41);}});});};exports['decryptFile']=function(_0x506359,_0x59ccc9,_0x5387d5,_0x2c69d4){return new BPromise(function(_0x5deaad,_0x124edf){_0x2c69d4=combineOptions(_0x2c69d4);var _0x3020d9=new Buffer(_0x5387d5);var _0x332b12=fs[_0xf8d6('0xe')](_0x506359);var _0x552ae1=fs[_0xf8d6('0xf')](_0x59ccc9);var _0x3f15b8=crypto[_0xf8d6('0x17')](_0x2c69d4[_0xf8d6('0x7')],_0x3020d9);_0x332b12['on'](_0xf8d6('0x18'),function(_0x1ce10b){var _0x169af6=new Buffer(_0x3f15b8[_0xf8d6('0x11')](_0x1ce10b),'binary');_0x552ae1[_0xf8d6('0x12')](_0x169af6);});_0x332b12['on'](_0xf8d6('0x13'),function(){try{var _0x4c4d40=new Buffer(_0x3f15b8[_0xf8d6('0x19')]('binary'),_0xf8d6('0x14'));_0x552ae1[_0xf8d6('0x12')](_0x4c4d40);_0x552ae1[_0xf8d6('0x13')]();_0x552ae1['on'](_0xf8d6('0x15'),function(){return _0x5deaad(_0x59ccc9);});}catch(_0x5aabc0){fs[_0xf8d6('0x16')](_0x59ccc9);return _0x124edf(_0x5aabc0);}});});};exports[_0xf8d6('0x1a')]=function(_0x473f29,_0x1e9dfd,_0x46fb0d){var _0xd1e171=_0x46fb0d||stringOptions[_0xf8d6('0x7')];var _0x59f4cb=_0x1e9dfd||stringOptions[_0xf8d6('0x1b')];var _0x5c0df8=crypto[_0xf8d6('0x10')](_0xd1e171,_0x59f4cb);var _0x2b823a=_0x5c0df8[_0xf8d6('0x11')](_0x473f29,_0xf8d6('0x1c'),'base64');_0x2b823a+=_0x5c0df8[_0xf8d6('0x19')]('base64');return _0x2b823a;};exports[_0xf8d6('0x1d')]=function(_0x5a0dbe,_0x557c1e,_0x4deb9c){var _0x1ace64=_0x4deb9c||stringOptions[_0xf8d6('0x7')];var _0x9271e2=_0x557c1e||stringOptions[_0xf8d6('0x1b')];var _0x9a89ce=crypto[_0xf8d6('0x17')](_0x1ace64,_0x9271e2);var _0x210212=_0x9a89ce[_0xf8d6('0x11')](_0x5a0dbe,_0xf8d6('0x1e'),_0xf8d6('0x1c'));_0x210212+=_0x9a89ce[_0xf8d6('0x19')](_0xf8d6('0x1c'));return _0x210212;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 6b1ccc1..e216789 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 _0x2153=['zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','inspect','finally','exit','util','path','lodash','to-csv','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip'];(function(_0x34c8eb,_0x5263fd){var _0x510d4e=function(_0x3d0491){while(--_0x3d0491){_0x34c8eb['push'](_0x34c8eb['shift']());}};_0x510d4e(++_0x5263fd);}(_0x2153,0x134));var _0x3215=function(_0x3f6128,_0xcc0aef){_0x3f6128=_0x3f6128-0x0;var _0x2ecb13=_0x2153[_0x3f6128];return _0x2ecb13;};'use strict';var util=require(_0x3215('0x0'));var path=require(_0x3215('0x1'));var _=require(_0x3215('0x2'));var csv=require(_0x3215('0x3'));var fs=require('fs');var BPromise=require(_0x3215('0x4'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x3215('0x5'))[_0x3215('0x6')];var logger=require(_0x3215('0x7'))(_0x3215('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x3215('0x9')][0x3];var PATH=process[_0x3215('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x24e714,_0x5c5244){var _0x589ffb={'status':_0x24e714};var _0x48b7b1={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5c5244){_0x589ffb['savename']=_0x5c5244;}return db[_0x3215('0xa')][_0x3215('0xb')](_0x589ffb,_0x48b7b1);}function main(){var _0x2f8741=0x1388;var _0x54e43b;logger[_0x3215('0xc')](util[_0x3215('0xd')](_0x3215('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x3215('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3215('0x10'),_0x3215('0x11')]})[_0x3215('0x12')](function(_0x314054){if(_0x314054){_0x54e43b=_0x314054;_0x2f8741=_0x54e43b['splitSizeCsv']||0x1388;}})[_0x3215('0x12')](function(){return dbH[_0x3215('0x13')][_0x3215('0x14')](util['format'](_0x3215('0x15'),QUERY),{'type':dbH[_0x3215('0x13')][_0x3215('0x16')][_0x3215('0x17')]});})[_0x3215('0x12')](function(_0x4d1739){if(!_0x4d1739[0x0][_0x3215('0x18')]){return analyticExtractedReport('Empty');}var _0x467be9=[];var _0x27cdfe=0x0;if(_0x54e43b[_0x3215('0x10')]){if(_0x4d1739&&_0x4d1739[_0x3215('0x19')]){var _0x967fed=_[_0x3215('0x1a')](_0x4d1739[0x0]['num']/_0x2f8741);var _0x2e3b71=Number[_0x3215('0x1b')](_0x4d1739[0x0][_0x3215('0x18')]/_0x2f8741)?_0x4d1739[0x0][_0x3215('0x18')]%_0x2f8741:0x0;_0x967fed[_0x3215('0x1c')](function(_0x1e9e16){if(_0x1e9e16>0x0){_0x27cdfe+=_0x2f8741;}_0x467be9[_0x3215('0x1d')](dbH[_0x3215('0x13')]['query'](util[_0x3215('0xd')](_0x3215('0x1e'),QUERY,_0x2f8741,_0x27cdfe),{'type':dbH['sequelize'][_0x3215('0x16')][_0x3215('0x17')]}));});if(_0x2e3b71>0x0){_0x27cdfe+=_0x2f8741;_0x467be9[_0x3215('0x1d')](dbH['sequelize'][_0x3215('0x14')](util['format'](_0x3215('0x1e'),QUERY,_0x2e3b71,_0x27cdfe),{'type':dbH['sequelize'][_0x3215('0x16')][_0x3215('0x17')]}));}}}else{_0x467be9[_0x3215('0x1d')](dbH['sequelize'][_0x3215('0x14')](QUERY,{'type':dbH[_0x3215('0x13')][_0x3215('0x16')]['SELECT']}));}var _0x6ed77c=path['dirname'](PATH);var _0x3925c9=path[_0x3215('0x1f')](PATH,_0x3215('0x20'));var _0x347f04=_0x54e43b[_0x3215('0x10')]&&_0x467be9[_0x3215('0x19')]>0x1;var _0x414f9d=[];if(!fs[_0x3215('0x21')](path[_0x3215('0x22')](_0x6ed77c,_0x3925c9))&&_0x347f04){fs[_0x3215('0x23')](path[_0x3215('0x22')](_0x6ed77c,_0x3925c9));}return BPromise[_0x3215('0x24')](_0x467be9,function(_0x3862bc){_0x414f9d['push'](_0x3862bc);})[_0x3215('0x12')](function(){for(var _0x11afa1=0x0;_0x11afa1<_0x414f9d[_0x3215('0x19')];_0x11afa1+=0x1){var _0x3748fd;var _0x2146e1=_0x414f9d[_0x11afa1];if(_0x347f04){_0x3748fd=path['join'](_0x6ed77c,_0x3925c9,util['format'](_0x3215('0x25'),_0x3925c9,_0x11afa1,_0x3215('0x26')));}else{_0x3748fd=path[_0x3215('0x22')](_0x6ed77c,util[_0x3215('0xd')](_0x3215('0x27'),_0x3925c9,_0x3215('0x26')));}fs[_0x3215('0x28')](_0x3748fd,csv(_0x2146e1));}})['then'](function(){if(_0x347f04){return new Promise(function(_0x17732){zipdir(path[_0x3215('0x22')](_0x6ed77c,_0x3925c9),{'saveTo':path['join'](_0x6ed77c,util[_0x3215('0xd')]('%s.%s',_0x3925c9,_0x3215('0x29')))},function(_0x47b293,_0x27126c){rimraf(path[_0x3215('0x22')](_0x6ed77c,_0x3925c9),function(){});_0x17732(_0x3215('0x2a'));});});}})[_0x3215('0x12')](function(){logger['info'](util[_0x3215('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x3215('0x2b'),_0x347f04?util[_0x3215('0xd')]('%s.%s',_0x3925c9,_0x347f04?_0x3215('0x29'):_0x3215('0x26')):null);});})[_0x3215('0x2c')](function(_0xb212ce){logger[_0x3215('0xc')](util['format'](_0x3215('0x2d'),EXTRACTED_REPORT_ID,_0x3215('0x2e')),util[_0x3215('0x2f')](_0xb212ce,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x3215('0x30')](function(){process[_0x3215('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x3146=['info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','then','splitSizeCsv','sequelize','query','QueryTypes','SELECT','num','Empty','length','range','isInteger','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip\x20finished','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','lodash','to-csv','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','argv','savename','update'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x3146,0x82));var _0x6314=function(_0x1495fb,_0x17452d){_0x1495fb=_0x1495fb-0x0;var _0x4b4432=_0x3146[_0x1495fb];return _0x4b4432;};'use strict';var util=require('util');var path=require(_0x6314('0x0'));var _=require(_0x6314('0x1'));var csv=require(_0x6314('0x2'));var fs=require('fs');var BPromise=require(_0x6314('0x3'));var zipdir=require(_0x6314('0x4'));var rimraf=require('rimraf');var db=require(_0x6314('0x5'))['db'];var dbH=require('../../mysqldb')[_0x6314('0x6')];var logger=require(_0x6314('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x6314('0x8')][0x2]);var QUERY=process[_0x6314('0x8')][0x3];var PATH=process[_0x6314('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x598b5d,_0x266be8){var _0x1d4860={'status':_0x598b5d};var _0x168bf8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x266be8){_0x1d4860[_0x6314('0x9')]=_0x266be8;}return db['AnalyticExtractedReport'][_0x6314('0xa')](_0x1d4860,_0x168bf8);}function main(){var _0x4f6647=0x1388;var _0x5de303;logger[_0x6314('0xb')](util[_0x6314('0xc')](_0x6314('0xd'),EXTRACTED_REPORT_ID,_0x6314('0xe')));return db['Setting'][_0x6314('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6314('0x10'),'splitSizeCsv']})[_0x6314('0x11')](function(_0xa94399){if(_0xa94399){_0x5de303=_0xa94399;_0x4f6647=_0x5de303[_0x6314('0x12')]||0x1388;}})[_0x6314('0x11')](function(){return dbH[_0x6314('0x13')][_0x6314('0x14')](util[_0x6314('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x6314('0x15')][_0x6314('0x16')]});})[_0x6314('0x11')](function(_0x133d09){if(!_0x133d09[0x0][_0x6314('0x17')]){return analyticExtractedReport(_0x6314('0x18'));}var _0x1eefb5=[];var _0xa700d1=0x0;if(_0x5de303[_0x6314('0x10')]){if(_0x133d09&&_0x133d09[_0x6314('0x19')]){var _0x47c19b=_[_0x6314('0x1a')](_0x133d09[0x0][_0x6314('0x17')]/_0x4f6647);var _0x25bb8a=Number[_0x6314('0x1b')](_0x133d09[0x0][_0x6314('0x17')]/_0x4f6647)?_0x133d09[0x0][_0x6314('0x17')]%_0x4f6647:0x0;_0x47c19b['forEach'](function(_0x431510){if(_0x431510>0x0){_0xa700d1+=_0x4f6647;}_0x1eefb5['push'](dbH[_0x6314('0x13')][_0x6314('0x14')](util[_0x6314('0xc')](_0x6314('0x1c'),QUERY,_0x4f6647,_0xa700d1),{'type':dbH[_0x6314('0x13')][_0x6314('0x15')][_0x6314('0x16')]}));});if(_0x25bb8a>0x0){_0xa700d1+=_0x4f6647;_0x1eefb5[_0x6314('0x1d')](dbH[_0x6314('0x13')][_0x6314('0x14')](util[_0x6314('0xc')](_0x6314('0x1c'),QUERY,_0x25bb8a,_0xa700d1),{'type':dbH[_0x6314('0x13')]['QueryTypes']['SELECT']}));}}}else{_0x1eefb5['push'](dbH[_0x6314('0x13')]['query'](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x6314('0x16')]}));}var _0xa3a1c4=path[_0x6314('0x1e')](PATH);var _0x2138c7=path['basename'](PATH,_0x6314('0x1f'));var _0x40888e=_0x5de303['split']&&_0x1eefb5[_0x6314('0x19')]>0x1;var _0x431d32=[];if(!fs[_0x6314('0x20')](path[_0x6314('0x21')](_0xa3a1c4,_0x2138c7))&&_0x40888e){fs[_0x6314('0x22')](path['join'](_0xa3a1c4,_0x2138c7));}return BPromise[_0x6314('0x23')](_0x1eefb5,function(_0x3d15f7){_0x431d32[_0x6314('0x1d')](_0x3d15f7);})['then'](function(){for(var _0x333d01=0x0;_0x333d01<_0x431d32['length'];_0x333d01+=0x1){var _0x50c2e7;var _0x1b6d2f=_0x431d32[_0x333d01];if(_0x40888e){_0x50c2e7=path[_0x6314('0x21')](_0xa3a1c4,_0x2138c7,util['format'](_0x6314('0x24'),_0x2138c7,_0x333d01,_0x6314('0x25')));}else{_0x50c2e7=path[_0x6314('0x21')](_0xa3a1c4,util[_0x6314('0xc')](_0x6314('0x26'),_0x2138c7,_0x6314('0x25')));}fs[_0x6314('0x27')](_0x50c2e7,csv(_0x1b6d2f));}})['then'](function(){if(_0x40888e){return new Promise(function(_0x36652f){zipdir(path[_0x6314('0x21')](_0xa3a1c4,_0x2138c7),{'saveTo':path[_0x6314('0x21')](_0xa3a1c4,util['format'](_0x6314('0x26'),_0x2138c7,'zip'))},function(_0x188801,_0x1a2675){rimraf(path[_0x6314('0x21')](_0xa3a1c4,_0x2138c7),function(){});_0x36652f(_0x6314('0x28'));});});}})[_0x6314('0x11')](function(){logger[_0x6314('0xb')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x6314('0xe')));return analyticExtractedReport(_0x6314('0x29'),_0x40888e?util['format'](_0x6314('0x26'),_0x2138c7,_0x40888e?'zip':_0x6314('0x25')):null);});})['catch'](function(_0x1814d6){logger[_0x6314('0xb')](util[_0x6314('0xc')](_0x6314('0x2a'),EXTRACTED_REPORT_ID,_0x6314('0xe')),util[_0x6314('0x2b')](_0x1814d6,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6314('0x2c'));})[_0x6314('0x2d')](function(){process[_0x6314('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index a13af6e..2d854a6 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 _0x5d58=['/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','error','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','pick','fill','length','auto','body','push','concat','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','pageBreak','before','margin','landscape','toString','\x20/\x20','footer','black','num','Empty','Setting','split','splitSizePdf','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','each','createPdfKitDocument','%s.%s','pdf','all','then','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','catch','inspect','Failed','finally'];(function(_0x1c2a84,_0x44d2fc){var _0x47dee8=function(_0x3fc187){while(--_0x3fc187){_0x1c2a84['push'](_0x1c2a84['shift']());}};_0x47dee8(++_0x44d2fc);}(_0x5d58,0x10a));var _0x85d5=function(_0x1294d4,_0x1d1074){_0x1294d4=_0x1294d4-0x0;var _0x4aa51d=_0x5d58[_0x1294d4];return _0x4aa51d;};'use strict';var _=require(_0x85d5('0x0'));var fs=require('fs');var util=require(_0x85d5('0x1'));var path=require(_0x85d5('0x2'));var moment=require(_0x85d5('0x3'));var htmlToPdfmake=require(_0x85d5('0x4'));var PdfPrinter=require(_0x85d5('0x5'));var zipdir=require(_0x85d5('0x6'));var rimraf=require(_0x85d5('0x7'));var JSDOM=require(_0x85d5('0x8'))[_0x85d5('0x9')];var window=new JSDOM('')[_0x85d5('0xa')];var BPromise=require(_0x85d5('0xb'));var db=require('../../mysqldb')['db'];var dbH=require(_0x85d5('0xc'))['dbH'];var logger=require(_0x85d5('0xd'))(_0x85d5('0xe'));var EXTRACTED_REPORT_ID=Number(process[_0x85d5('0xf')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x85d5('0xf')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x85d5('0x10');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x29a5d6,_0x2fcc23){var _0x4e84f3={'status':_0x29a5d6};var _0x126a5e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2fcc23){_0x4e84f3[_0x85d5('0x11')]=_0x2fcc23;}return db[_0x85d5('0x12')]['update'](_0x4e84f3,_0x126a5e);}function getHeaders(_0x2fee37){return _[_0x85d5('0x13')](_0x2fee37,function(_0x2a839f){return{'text':_0x2a839f,'style':_0x85d5('0x14')};});}function getRows(_0x36777d,_0x53a9b2){return _[_0x85d5('0x13')](_0x53a9b2,function(_0x2bb4b9){return _(_0x2bb4b9)[_0x85d5('0x15')](_0x36777d)[_0x85d5('0x13')](function(_0x501d48){return _0x501d48?_['toString'](_0x501d48):'';})['value']();});}function createTable(_0x2eb586,_0xa4cff2){var _0x2d75c0={'widths':_[_0x85d5('0x16')](Array(_0x2eb586[_0x85d5('0x17')]),0x91),'heights':function(_0x453935){return _0x453935===0x0?_0x85d5('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1515e8=getHeaders(_0x2eb586);_0x2d75c0[_0x85d5('0x19')][_0x85d5('0x1a')](_0x1515e8);var _0x42a71d=getRows(_0x2eb586,_0xa4cff2);_0x2d75c0[_0x85d5('0x19')]=_0x2d75c0['body'][_0x85d5('0x1b')](_0x42a71d);return _0x2d75c0;}function createTables(_0x3a695a){var _0x1b3118=[];var _0x269682=_['chunk'](Object[_0x85d5('0x1c')](_0x3a695a[0x0]),0x5);_0x269682[_0x85d5('0x1d')](function(_0x5c8e2f){_0x1b3118[_0x85d5('0x1a')](createTable(_0x5c8e2f,_0x3a695a));});return _0x1b3118;}function getPDFDocDefinition(_0x441c77){var _0x5a38b1=util[_0x85d5('0x1e')](_0x85d5('0x1f'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x85d5('0x20')])[_0x85d5('0x1e')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x85d5('0x1e')](FORMAT));var _0x37493b=[];for(var _0x1805fb=0x0;_0x1805fb<_0x441c77[_0x85d5('0x17')];_0x1805fb++){var _0x5d6234=[];if(_0x1805fb===0x0){_0x5d6234[_0x85d5('0x1a')]({'text':_0x5a38b1,'style':'header'});}var _0x2c3a5d={'table':_0x441c77[_0x1805fb]};if(_0x1805fb>0x0){_0x2c3a5d[_0x85d5('0x21')]=_0x85d5('0x22');_0x2c3a5d[_0x85d5('0x23')]=[0x0,0x46,0x0,0x0];}_0x5d6234[_0x85d5('0x1a')](_0x2c3a5d);_0x37493b['push'](_0x5d6234);}return{'pageSize':'A4','pageOrientation':_0x85d5('0x24'),'content':_0x37493b,'footer':function(_0x34e666,_0x5b78a0){return{'text':_0x34e666[_0x85d5('0x25')]()+_0x85d5('0x26')+_0x5b78a0,'style':_0x85d5('0x27')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x85d5('0x28')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4cceed){var _0xb0028b=0x1388;var _0xf98084;if(!_0x4cceed[0x0][_0x85d5('0x29')]){return analyticExtractedReport(_0x85d5('0x2a'));}return db[_0x85d5('0x2b')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x85d5('0x2c'),_0x85d5('0x2d')]})['then'](function(_0xb9946f){if(_0xb9946f){_0xf98084=_0xb9946f;_0xb0028b=_0xf98084[_0x85d5('0x2d')]||0x3e8;}})['then'](function(){var _0x3a5685=[];var _0x5ed0a8=0x0;if(_0xf98084[_0x85d5('0x2c')]){if(_0x4cceed&&_0x4cceed[_0x85d5('0x17')]){var _0x4cab34=_['range'](_0x4cceed[0x0]['num']/_0xb0028b);var _0x7c60d1=Number[_0x85d5('0x2e')](_0x4cceed[0x0]['num']/_0xb0028b)?_0x4cceed[0x0][_0x85d5('0x29')]%_0xb0028b:0x0;_0x4cab34[_0x85d5('0x1d')](function(_0x27df95){if(_0x27df95>0x0){_0x5ed0a8+=_0xb0028b;}_0x3a5685[_0x85d5('0x1a')](dbH[_0x85d5('0x2f')][_0x85d5('0x30')](util['format'](_0x85d5('0x31'),QUERY,_0xb0028b,_0x5ed0a8),{'type':dbH[_0x85d5('0x2f')][_0x85d5('0x32')][_0x85d5('0x33')]}));});if(_0x7c60d1>0x0){_0x5ed0a8+=_0xb0028b;_0x3a5685[_0x85d5('0x1a')](dbH['sequelize'][_0x85d5('0x30')](util['format'](_0x85d5('0x31'),QUERY,_0x7c60d1,_0x5ed0a8),{'type':dbH[_0x85d5('0x2f')][_0x85d5('0x32')][_0x85d5('0x33')]}));}}}else{_0x3a5685['push'](dbH[_0x85d5('0x2f')][_0x85d5('0x30')](QUERY,{'type':dbH[_0x85d5('0x2f')][_0x85d5('0x32')][_0x85d5('0x33')]}));}var _0x436980=path[_0x85d5('0x34')](PATH);var _0x49d285=path[_0x85d5('0x35')](PATH,_0x85d5('0x36'));var _0xedb56e=_0xf98084[_0x85d5('0x2c')]&&_0x3a5685[_0x85d5('0x17')]>0x1;var _0x908b2e=[];if(!fs[_0x85d5('0x37')](path[_0x85d5('0x38')](_0x436980,_0x49d285))&&_0xedb56e){fs['mkdirSync'](path['join'](_0x436980,_0x49d285));}return BPromise[_0x85d5('0x39')](_0x3a5685,function(_0xe99e69){_0x908b2e[_0x85d5('0x1a')](_0xe99e69);})['then'](function(){var _0x23fc95=[];for(var _0x11da90=0x0;_0x11da90<_0x908b2e['length'];_0x11da90+=0x1){var _0x5f4e6b=_0x908b2e[_0x11da90];var _0x166a3e=createTables(_['flatten'](_0x5f4e6b));var _0xbb1686;var _0xd14080=getPDFDocDefinition(_0x166a3e);var _0x269022=getPDFPrinter();var _0x41c24d=_0x269022[_0x85d5('0x3a')](_0xd14080);if(_0xedb56e){_0xbb1686=path[_0x85d5('0x38')](_0x436980,_0x49d285,util[_0x85d5('0x1e')]('%s%d.%s',_0x49d285,_0x11da90,'pdf'));}else{_0xbb1686=path[_0x85d5('0x38')](_0x436980,util['format'](_0x85d5('0x3b'),_0x49d285,_0x85d5('0x3c')));}_0x23fc95[_0x85d5('0x1a')](writePDFDocument(_0x41c24d,_0xbb1686));}return Promise[_0x85d5('0x3d')](_0x23fc95);})[_0x85d5('0x3e')](function(){if(_0xedb56e){return new Promise(function(_0x1cb792){zipdir(path[_0x85d5('0x38')](_0x436980,_0x49d285),{'saveTo':path['join'](_0x436980,util[_0x85d5('0x1e')](_0x85d5('0x3b'),_0x49d285,_0x85d5('0x3f')))},function(){rimraf(path['join'](_0x436980,_0x49d285),function(){});_0x1cb792('zip\x20finished');});});}})[_0x85d5('0x3e')](function(){if(!_0xedb56e)return;rimraf(path['join'](_0x436980,_0x49d285),function(){});})[_0x85d5('0x3e')](function(){logger[_0x85d5('0x40')](util['format'](_0x85d5('0x41'),EXTRACTED_REPORT_ID,_0x85d5('0x42')));return analyticExtractedReport(_0x85d5('0x43'),_0xedb56e?util[_0x85d5('0x1e')](_0x85d5('0x3b'),_0x49d285,_0xedb56e?_0x85d5('0x3f'):_0x85d5('0x3c')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util['format'](_0x85d5('0x44'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x85d5('0x12')][_0x85d5('0x45')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0xb7022){EXTRACTED_REPORT=_0xb7022;return dbH[_0x85d5('0x2f')][_0x85d5('0x30')](util[_0x85d5('0x1e')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x85d5('0x2f')]['QueryTypes'][_0x85d5('0x33')]});})[_0x85d5('0x3e')](extractReport)[_0x85d5('0x46')](function(_0x1a5d93){logger[_0x85d5('0x40')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x85d5('0x42')),util[_0x85d5('0x47')](_0x1a5d93,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x85d5('0x48'));})[_0x85d5('0x49')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3f41dd=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x85d5('0x4a'),'bolditalics':__dirname+_0x85d5('0x4b')}});return _0x3f41dd;}function getPDFDocDefinitionFromHTML(_0x5629e3,_0x35fbb6){var _0x1ffca1=util['format']('%s\x20#%d',_0x35fbb6['channel'],_0x35fbb6[_0x85d5('0x4c')]);var _0x29710d=moment()['format'](_0x85d5('0x4d'))[_0x85d5('0x25')]();var _0x16df0a=htmlToPdfmake(_0x5629e3,{'window':window,'tableAutoSize':!![]});return{'content':[_0x16df0a],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x85d5('0x4e'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x85d5('0x4e'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x85d5('0x4e')}},'header':function(){return[{'text':_0x85d5('0x4f'),'style':'header'}];},'footer':function(_0x2f17d3,_0x30d586){return[{'text':util['format'](_0x85d5('0x50'),_0x1ffca1,_0x2f17d3,_0x30d586,_0x29710d),'style':_0x85d5('0x27')}];}};}function writePDFDocument(_0x2ca7b9,_0x27cc8f){return new Promise(function(_0x1fd53d,_0x4b4827){var _0x40699b=_0x2ca7b9['pipe'](fs[_0x85d5('0x51')](_0x27cc8f));_0x40699b['on'](_0x85d5('0x52'),function(){_0x1fd53d(_0x85d5('0x52'));});_0x40699b['on'](_0x85d5('0x53'),function(_0x557dc1){_0x4b4827(_0x557dc1);});_0x2ca7b9['end']();});}exports[_0x85d5('0x54')]=function(_0x5df5fe,_0x8978d2){var _0x1076da=getPDFPrinter();var _0x577e87=getPDFDocDefinitionFromHTML(_0x5df5fe,_0x8978d2);var _0x3dc697=_0x1076da['createPdfKitDocument'](_0x577e87);return writePDFDocument(_0x3dc697,_0x8978d2[_0x85d5('0x2')])[_0x85d5('0x46')](function(_0x4582a0){throw _0x4582a0;});}; \ No newline at end of file +var _0xdabc=['pdf','%s.%s','all','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','finish','error','createPdfFromHTML','lodash','html-to-pdfmake','pdfmake/src/printer','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','toString','fill','length','push','body','concat','chunk','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','format','header','pageBreak','before','margin','landscape','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','range','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','sequelize','basename','join','mkdirSync','each','createPdfKitDocument','%s%d.%s'];(function(_0x3a43a0,_0x3e09a9){var _0x46fa96=function(_0x4479ce){while(--_0x4479ce){_0x3a43a0['push'](_0x3a43a0['shift']());}};_0x46fa96(++_0x3e09a9);}(_0xdabc,0x1e5));var _0xcdab=function(_0x246227,_0x12bfcb){_0x246227=_0x246227-0x0;var _0x37bd4a=_0xdabc[_0x246227];return _0x37bd4a;};'use strict';var _=require(_0xcdab('0x0'));var fs=require('fs');var util=require('util');var path=require('path');var moment=require('moment');var htmlToPdfmake=require(_0xcdab('0x1'));var PdfPrinter=require(_0xcdab('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0xcdab('0x3'));var JSDOM=require(_0xcdab('0x4'))[_0xcdab('0x5')];var window=new JSDOM('')[_0xcdab('0x6')];var BPromise=require(_0xcdab('0x7'));var db=require(_0xcdab('0x8'))['db'];var dbH=require(_0xcdab('0x8'))[_0xcdab('0x9')];var logger=require(_0xcdab('0xa'))(_0xcdab('0xb'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xcdab('0xc')][0x4];var NAME=process[_0xcdab('0xc')][0x5];var FORMAT=_0xcdab('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x490e7d,_0x3aeecc){var _0x2b2020={'status':_0x490e7d};var _0x524d4e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3aeecc){_0x2b2020[_0xcdab('0xe')]=_0x3aeecc;}return db[_0xcdab('0xf')][_0xcdab('0x10')](_0x2b2020,_0x524d4e);}function getHeaders(_0x11ec16){return _[_0xcdab('0x11')](_0x11ec16,function(_0x1600c4){return{'text':_0x1600c4,'style':_0xcdab('0x12')};});}function getRows(_0x1487c9,_0x1038ce){return _[_0xcdab('0x11')](_0x1038ce,function(_0x57be14){return _(_0x57be14)['pick'](_0x1487c9)[_0xcdab('0x11')](function(_0x58c791){return _0x58c791?_[_0xcdab('0x13')](_0x58c791):'';})['value']();});}function createTable(_0x1d013e,_0xd59a1d){var _0x4ba944={'widths':_[_0xcdab('0x14')](Array(_0x1d013e[_0xcdab('0x15')]),0x91),'heights':function(_0x25d404){return _0x25d404===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x20f34e=getHeaders(_0x1d013e);_0x4ba944['body'][_0xcdab('0x16')](_0x20f34e);var _0x4586ba=getRows(_0x1d013e,_0xd59a1d);_0x4ba944['body']=_0x4ba944[_0xcdab('0x17')][_0xcdab('0x18')](_0x4586ba);return _0x4ba944;}function createTables(_0x55da0d){var _0x55ea07=[];var _0x18dc7e=_[_0xcdab('0x19')](Object[_0xcdab('0x1a')](_0x55da0d[0x0]),0x5);_0x18dc7e[_0xcdab('0x1b')](function(_0xd33233){_0x55ea07[_0xcdab('0x16')](createTable(_0xd33233,_0x55da0d));});return _0x55ea07;}function getPDFDocDefinition(_0x1403c5){var _0x19844b=util['format'](_0xcdab('0x1c'),NAME,EXTRACTED_REPORT[_0xcdab('0x1d')],moment(EXTRACTED_REPORT[_0xcdab('0x1e')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0xcdab('0x1f')])[_0xcdab('0x20')](FORMAT));var _0x2f64de=[];for(var _0x398935=0x0;_0x398935<_0x1403c5[_0xcdab('0x15')];_0x398935++){var _0x2288e5=[];if(_0x398935===0x0){_0x2288e5['push']({'text':_0x19844b,'style':_0xcdab('0x21')});}var _0x632a37={'table':_0x1403c5[_0x398935]};if(_0x398935>0x0){_0x632a37[_0xcdab('0x22')]=_0xcdab('0x23');_0x632a37[_0xcdab('0x24')]=[0x0,0x46,0x0,0x0];}_0x2288e5[_0xcdab('0x16')](_0x632a37);_0x2f64de['push'](_0x2288e5);}return{'pageSize':'A4','pageOrientation':_0xcdab('0x25'),'content':_0x2f64de,'footer':function(_0x203c54,_0x1b2314){return{'text':_0x203c54[_0xcdab('0x13')]()+'\x20/\x20'+_0x1b2314,'style':'footer'};},'defaultStyle':{'font':_0xcdab('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xcdab('0x27')},'footer':{'alignment':_0xcdab('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x46e247){var _0x80b3c3=0x1388;var _0x1c6813;if(!_0x46e247[0x0][_0xcdab('0x29')]){return analyticExtractedReport(_0xcdab('0x2a'));}return db[_0xcdab('0x2b')][_0xcdab('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xcdab('0x2d'),_0xcdab('0x2e')]})[_0xcdab('0x2f')](function(_0x14a7df){if(_0x14a7df){_0x1c6813=_0x14a7df;_0x80b3c3=_0x1c6813[_0xcdab('0x2e')]||0x3e8;}})[_0xcdab('0x2f')](function(){var _0x225a07=[];var _0x2afccd=0x0;if(_0x1c6813['split']){if(_0x46e247&&_0x46e247[_0xcdab('0x15')]){var _0x18143b=_[_0xcdab('0x30')](_0x46e247[0x0]['num']/_0x80b3c3);var _0x2ad119=Number[_0xcdab('0x31')](_0x46e247[0x0][_0xcdab('0x29')]/_0x80b3c3)?_0x46e247[0x0]['num']%_0x80b3c3:0x0;_0x18143b[_0xcdab('0x1b')](function(_0x26319a){if(_0x26319a>0x0){_0x2afccd+=_0x80b3c3;}_0x225a07[_0xcdab('0x16')](dbH['sequelize'][_0xcdab('0x32')](util[_0xcdab('0x20')](_0xcdab('0x33'),QUERY,_0x80b3c3,_0x2afccd),{'type':dbH['sequelize'][_0xcdab('0x34')][_0xcdab('0x35')]}));});if(_0x2ad119>0x0){_0x2afccd+=_0x80b3c3;_0x225a07[_0xcdab('0x16')](dbH['sequelize'][_0xcdab('0x32')](util[_0xcdab('0x20')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2ad119,_0x2afccd),{'type':dbH[_0xcdab('0x36')][_0xcdab('0x34')][_0xcdab('0x35')]}));}}}else{_0x225a07[_0xcdab('0x16')](dbH[_0xcdab('0x36')]['query'](QUERY,{'type':dbH[_0xcdab('0x36')][_0xcdab('0x34')][_0xcdab('0x35')]}));}var _0x14e7c6=path['dirname'](PATH);var _0x372a99=path[_0xcdab('0x37')](PATH,'.pdf');var _0x32d7db=_0x1c6813['split']&&_0x225a07[_0xcdab('0x15')]>0x1;var _0x5a7ad3=[];if(!fs['existsSync'](path[_0xcdab('0x38')](_0x14e7c6,_0x372a99))&&_0x32d7db){fs[_0xcdab('0x39')](path['join'](_0x14e7c6,_0x372a99));}return BPromise[_0xcdab('0x3a')](_0x225a07,function(_0x458c6c){_0x5a7ad3[_0xcdab('0x16')](_0x458c6c);})['then'](function(){var _0x57c239=[];for(var _0x3af153=0x0;_0x3af153<_0x5a7ad3[_0xcdab('0x15')];_0x3af153+=0x1){var _0x52ce61=_0x5a7ad3[_0x3af153];var _0x25092b=createTables(_['flatten'](_0x52ce61));var _0xf3bfc2;var _0x58cdbd=getPDFDocDefinition(_0x25092b);var _0xcc7d53=getPDFPrinter();var _0x38bf3=_0xcc7d53[_0xcdab('0x3b')](_0x58cdbd);if(_0x32d7db){_0xf3bfc2=path[_0xcdab('0x38')](_0x14e7c6,_0x372a99,util[_0xcdab('0x20')](_0xcdab('0x3c'),_0x372a99,_0x3af153,_0xcdab('0x3d')));}else{_0xf3bfc2=path[_0xcdab('0x38')](_0x14e7c6,util['format'](_0xcdab('0x3e'),_0x372a99,_0xcdab('0x3d')));}_0x57c239[_0xcdab('0x16')](writePDFDocument(_0x38bf3,_0xf3bfc2));}return Promise[_0xcdab('0x3f')](_0x57c239);})[_0xcdab('0x2f')](function(){if(_0x32d7db){return new Promise(function(_0x14a5ed){zipdir(path['join'](_0x14e7c6,_0x372a99),{'saveTo':path['join'](_0x14e7c6,util[_0xcdab('0x20')](_0xcdab('0x3e'),_0x372a99,'zip'))},function(){rimraf(path['join'](_0x14e7c6,_0x372a99),function(){});_0x14a5ed(_0xcdab('0x40'));});});}})[_0xcdab('0x2f')](function(){if(!_0x32d7db)return;rimraf(path['join'](_0x14e7c6,_0x372a99),function(){});})[_0xcdab('0x2f')](function(){logger[_0xcdab('0x41')](util['format'](_0xcdab('0x42'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0xcdab('0x43'),_0x32d7db?util[_0xcdab('0x20')](_0xcdab('0x3e'),_0x372a99,_0x32d7db?_0xcdab('0x44'):_0xcdab('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xcdab('0x41')](util[_0xcdab('0x20')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xcdab('0x45')));return db[_0xcdab('0xf')][_0xcdab('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xcdab('0x2f')](function(_0x1ae99e){EXTRACTED_REPORT=_0x1ae99e;return dbH[_0xcdab('0x36')][_0xcdab('0x32')](util[_0xcdab('0x20')](_0xcdab('0x47'),QUERY),{'type':dbH[_0xcdab('0x36')][_0xcdab('0x34')][_0xcdab('0x35')]});})[_0xcdab('0x2f')](extractReport)[_0xcdab('0x48')](function(_0x9c38cb){logger[_0xcdab('0x41')](util[_0xcdab('0x20')](_0xcdab('0x49'),EXTRACTED_REPORT_ID,_0xcdab('0x45')),util[_0xcdab('0x4a')](_0x9c38cb,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xcdab('0x4b'));})[_0xcdab('0x4c')](function(){process[_0xcdab('0x4d')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x4b0f4b=new PdfPrinter({'Arial':{'normal':__dirname+_0xcdab('0x4e'),'bold':__dirname+_0xcdab('0x4f'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x4b0f4b;}function getPDFDocDefinitionFromHTML(_0x78fe07,_0x4600b5){var _0x1762d7=util['format'](_0xcdab('0x50'),_0x4600b5[_0xcdab('0x51')],_0x4600b5[_0xcdab('0x52')]);var _0x2bcdd4=moment()[_0xcdab('0x20')](_0xcdab('0x53'))[_0xcdab('0x13')]();var _0x257a9f=htmlToPdfmake(_0x78fe07,{'window':window,'tableAutoSize':!![]});return{'content':[_0x257a9f],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xcdab('0x54'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xcdab('0x54')}},'header':function(){return[{'text':_0xcdab('0x55'),'style':'header'}];},'footer':function(_0x3ee110,_0x15e28e){return[{'text':util['format'](_0xcdab('0x56'),_0x1762d7,_0x3ee110,_0x15e28e,_0x2bcdd4),'style':_0xcdab('0x57')}];}};}function writePDFDocument(_0x1bf64d,_0x116e18){return new Promise(function(_0x493c20,_0x2be501){var _0x300b7c=_0x1bf64d['pipe'](fs['createWriteStream'](_0x116e18));_0x300b7c['on']('finish',function(){_0x493c20(_0xcdab('0x58'));});_0x300b7c['on'](_0xcdab('0x59'),function(_0x20c39c){_0x2be501(_0x20c39c);});_0x1bf64d['end']();});}exports[_0xcdab('0x5a')]=function(_0x417de0,_0x1610f3){var _0x498845=getPDFPrinter();var _0x1ceb0e=getPDFDocDefinitionFromHTML(_0x417de0,_0x1610f3);var _0x444a84=_0x498845[_0xcdab('0x3b')](_0x1ceb0e);return writePDFDocument(_0x444a84,_0x1610f3['path'])[_0xcdab('0x48')](function(_0x46e2c6){throw _0x46e2c6;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 761ea32..206a7f9 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 _0xe172=['xlsx','%s.%s','writeFileSync','binary','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','inspect','finally','util','path','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','range','num','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','existsSync','mkdirSync','join'];(function(_0x4fe5aa,_0x444285){var _0x3fab12=function(_0x59661d){while(--_0x59661d){_0x4fe5aa['push'](_0x4fe5aa['shift']());}};_0x3fab12(++_0x444285);}(_0xe172,0x1bb));var _0x2e17=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xe172[_0x68c979];return _0x4f0001;};'use strict';var util=require(_0x2e17('0x0'));var path=require(_0x2e17('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x2e17('0x2'));var BPromise=require(_0x2e17('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x2e17('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0x2e17('0x5'))[_0x2e17('0x6')];var logger=require(_0x2e17('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x2e17('0x8')][0x3];var PATH=process[_0x2e17('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x318c78,_0x413574){var _0x3dd042={'status':_0x318c78};var _0x1e047c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x413574){_0x3dd042[_0x2e17('0x9')]=_0x413574;}return db[_0x2e17('0xa')][_0x2e17('0xb')](_0x3dd042,_0x1e047c);}function main(){var _0x93905f=0x1388;var _0x329967;logger[_0x2e17('0xc')](util['format'](_0x2e17('0xd'),EXTRACTED_REPORT_ID,_0x2e17('0xe')));return db['Setting'][_0x2e17('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2e17('0x10'),_0x2e17('0x11')]})['then'](function(_0x392b41){if(_0x392b41){_0x329967=_0x392b41;_0x93905f=_0x329967[_0x2e17('0x11')]||0x1388;}})[_0x2e17('0x12')](function(){return dbH[_0x2e17('0x13')][_0x2e17('0x14')](util[_0x2e17('0x15')](_0x2e17('0x16'),QUERY),{'type':dbH[_0x2e17('0x13')][_0x2e17('0x17')][_0x2e17('0x18')]});})[_0x2e17('0x12')](function(_0x362317){if(!_0x362317[0x0]['num']){return analyticExtractedReport(_0x2e17('0x19'));}var _0x5685f5=[];var _0x4950f4=0x0;if(_0x329967[_0x2e17('0x10')]){if(_0x362317&&_0x362317[_0x2e17('0x1a')]){var _0x34fd3b=_[_0x2e17('0x1b')](_0x362317[0x0][_0x2e17('0x1c')]/_0x93905f);var _0x532f89=Number[_0x2e17('0x1d')](_0x362317[0x0][_0x2e17('0x1c')]/_0x93905f)?_0x362317[0x0][_0x2e17('0x1c')]%_0x93905f:0x0;_0x34fd3b['forEach'](function(_0x3f3f93){if(_0x3f3f93>0x0){_0x4950f4+=_0x93905f;}_0x5685f5[_0x2e17('0x1e')](dbH[_0x2e17('0x13')]['query'](util[_0x2e17('0x15')](_0x2e17('0x1f'),QUERY,_0x93905f,_0x4950f4),{'type':dbH[_0x2e17('0x13')][_0x2e17('0x17')][_0x2e17('0x18')]}));});if(_0x532f89>0x0){_0x4950f4+=_0x93905f;_0x5685f5[_0x2e17('0x1e')](dbH[_0x2e17('0x13')][_0x2e17('0x14')](util[_0x2e17('0x15')](_0x2e17('0x1f'),QUERY,_0x532f89,_0x4950f4),{'type':dbH[_0x2e17('0x13')]['QueryTypes'][_0x2e17('0x18')]}));}}}else{_0x5685f5['push'](dbH[_0x2e17('0x13')][_0x2e17('0x14')](QUERY,{'type':dbH[_0x2e17('0x13')]['QueryTypes']['SELECT']}));}var _0x128ead=path[_0x2e17('0x20')](PATH);var _0x1f0cd5=path[_0x2e17('0x21')](PATH,'.xlsx');var _0x5aba0e=_0x329967[_0x2e17('0x10')]&&_0x5685f5[_0x2e17('0x1a')]>0x1;var _0x716df8=[];if(!fs[_0x2e17('0x22')](path['join'](_0x128ead,_0x1f0cd5))&&_0x5aba0e){fs[_0x2e17('0x23')](path[_0x2e17('0x24')](_0x128ead,_0x1f0cd5));}return BPromise['each'](_0x5685f5,function(_0x4d3223){_0x716df8[_0x2e17('0x1e')](_0x4d3223);})[_0x2e17('0x12')](function(){for(var _0x4e1f47=0x0;_0x4e1f47<_0x716df8[_0x2e17('0x1a')];_0x4e1f47+=0x1){var _0x209c00;var _0x503f34=_0x716df8[_0x4e1f47];if(_0x5aba0e){_0x209c00=path[_0x2e17('0x24')](_0x128ead,_0x1f0cd5,util[_0x2e17('0x15')]('%s%d.%s',_0x1f0cd5,_0x4e1f47,_0x2e17('0x25')));}else{_0x209c00=path['join'](_0x128ead,util[_0x2e17('0x15')](_0x2e17('0x26'),_0x1f0cd5,_0x2e17('0x25')));}fs[_0x2e17('0x27')](_0x209c00,json2xls(_0x503f34),_0x2e17('0x28'));}})['then'](function(){if(_0x5aba0e){return new Promise(function(_0x345ba6){zipdir(path[_0x2e17('0x24')](_0x128ead,_0x1f0cd5),{'saveTo':path[_0x2e17('0x24')](_0x128ead,util[_0x2e17('0x15')]('%s.%s',_0x1f0cd5,'zip'))},function(_0x237b24,_0x1b0e94){rimraf(path[_0x2e17('0x24')](_0x128ead,_0x1f0cd5),function(){});_0x345ba6(_0x2e17('0x29'));});});}})['then'](function(){logger[_0x2e17('0xc')](util[_0x2e17('0x15')](_0x2e17('0x2a'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x2e17('0x2b'),_0x5aba0e?util['format'](_0x2e17('0x26'),_0x1f0cd5,_0x5aba0e?_0x2e17('0x2c'):_0x2e17('0x25')):null);});})[_0x2e17('0x2d')](function(_0x2a7bad){logger[_0x2e17('0xc')](util[_0x2e17('0x15')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x2e17('0xe')),util[_0x2e17('0x2e')](_0x2a7bad,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x2e17('0x2f')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x10df=['forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','existsSync','join','each','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','XLSX','inspect','Failed','finally','exit','util','path','json2xls','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeXlsx','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','isInteger'];(function(_0x1034ca,_0x14ecd6){var _0x1a023a=function(_0x2cfa65){while(--_0x2cfa65){_0x1034ca['push'](_0x1034ca['shift']());}};_0x1a023a(++_0x14ecd6);}(_0x10df,0x1ae));var _0xf10d=function(_0x15beeb,_0x32bd4f){_0x15beeb=_0x15beeb-0x0;var _0x5b681a=_0x10df[_0x15beeb];return _0x5b681a;};'use strict';var util=require(_0xf10d('0x0'));var path=require(_0xf10d('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0xf10d('0x2'));var BPromise=require('bluebird');var zipdir=require(_0xf10d('0x3'));var rimraf=require(_0xf10d('0x4'));var db=require(_0xf10d('0x5'))['db'];var dbH=require(_0xf10d('0x5'))['dbH'];var logger=require(_0xf10d('0x6'))(_0xf10d('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xf10d('0x8')][0x2]);var QUERY=process[_0xf10d('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xb289f0,_0x288077){var _0x5d5de5={'status':_0xb289f0};var _0x34040a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x288077){_0x5d5de5['savename']=_0x288077;}return db[_0xf10d('0x9')][_0xf10d('0xa')](_0x5d5de5,_0x34040a);}function main(){var _0x4f3184=0x1388;var _0x367714;logger[_0xf10d('0xb')](util['format'](_0xf10d('0xc'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0xf10d('0xd')][_0xf10d('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf10d('0xf'),_0xf10d('0x10')]})[_0xf10d('0x11')](function(_0x316670){if(_0x316670){_0x367714=_0x316670;_0x4f3184=_0x367714['splitSizeXlsx']||0x1388;}})[_0xf10d('0x11')](function(){return dbH[_0xf10d('0x12')][_0xf10d('0x13')](util[_0xf10d('0x14')](_0xf10d('0x15'),QUERY),{'type':dbH[_0xf10d('0x12')][_0xf10d('0x16')][_0xf10d('0x17')]});})[_0xf10d('0x11')](function(_0x3d985a){if(!_0x3d985a[0x0][_0xf10d('0x18')]){return analyticExtractedReport(_0xf10d('0x19'));}var _0x5c60fc=[];var _0x5c2190=0x0;if(_0x367714['split']){if(_0x3d985a&&_0x3d985a[_0xf10d('0x1a')]){var _0x37084a=_[_0xf10d('0x1b')](_0x3d985a[0x0][_0xf10d('0x18')]/_0x4f3184);var _0x5ed1f3=Number[_0xf10d('0x1c')](_0x3d985a[0x0][_0xf10d('0x18')]/_0x4f3184)?_0x3d985a[0x0][_0xf10d('0x18')]%_0x4f3184:0x0;_0x37084a[_0xf10d('0x1d')](function(_0x275dfe){if(_0x275dfe>0x0){_0x5c2190+=_0x4f3184;}_0x5c60fc['push'](dbH[_0xf10d('0x12')][_0xf10d('0x13')](util[_0xf10d('0x14')](_0xf10d('0x1e'),QUERY,_0x4f3184,_0x5c2190),{'type':dbH[_0xf10d('0x12')][_0xf10d('0x16')]['SELECT']}));});if(_0x5ed1f3>0x0){_0x5c2190+=_0x4f3184;_0x5c60fc[_0xf10d('0x1f')](dbH['sequelize'][_0xf10d('0x13')](util[_0xf10d('0x14')](_0xf10d('0x1e'),QUERY,_0x5ed1f3,_0x5c2190),{'type':dbH[_0xf10d('0x12')][_0xf10d('0x16')]['SELECT']}));}}}else{_0x5c60fc['push'](dbH[_0xf10d('0x12')][_0xf10d('0x13')](QUERY,{'type':dbH[_0xf10d('0x12')][_0xf10d('0x16')]['SELECT']}));}var _0x45959c=path[_0xf10d('0x20')](PATH);var _0x406a72=path[_0xf10d('0x21')](PATH,'.xlsx');var _0x3106f4=_0x367714[_0xf10d('0xf')]&&_0x5c60fc['length']>0x1;var _0x1c37f3=[];if(!fs[_0xf10d('0x22')](path[_0xf10d('0x23')](_0x45959c,_0x406a72))&&_0x3106f4){fs['mkdirSync'](path[_0xf10d('0x23')](_0x45959c,_0x406a72));}return BPromise[_0xf10d('0x24')](_0x5c60fc,function(_0x2edf5e){_0x1c37f3['push'](_0x2edf5e);})[_0xf10d('0x11')](function(){for(var _0x5a7030=0x0;_0x5a7030<_0x1c37f3[_0xf10d('0x1a')];_0x5a7030+=0x1){var _0xbac7ac;var _0x2c5a1f=_0x1c37f3[_0x5a7030];if(_0x3106f4){_0xbac7ac=path[_0xf10d('0x23')](_0x45959c,_0x406a72,util[_0xf10d('0x14')](_0xf10d('0x25'),_0x406a72,_0x5a7030,'xlsx'));}else{_0xbac7ac=path[_0xf10d('0x23')](_0x45959c,util[_0xf10d('0x14')]('%s.%s',_0x406a72,_0xf10d('0x26')));}fs[_0xf10d('0x27')](_0xbac7ac,json2xls(_0x2c5a1f),_0xf10d('0x28'));}})[_0xf10d('0x11')](function(){if(_0x3106f4){return new Promise(function(_0x1409a2){zipdir(path['join'](_0x45959c,_0x406a72),{'saveTo':path[_0xf10d('0x23')](_0x45959c,util[_0xf10d('0x14')](_0xf10d('0x29'),_0x406a72,_0xf10d('0x2a')))},function(_0xc8c3c0,_0x12352a){rimraf(path['join'](_0x45959c,_0x406a72),function(){});_0x1409a2(_0xf10d('0x2b'));});});}})[_0xf10d('0x11')](function(){logger[_0xf10d('0xb')](util[_0xf10d('0x14')](_0xf10d('0x2c'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xf10d('0x2d'),_0x3106f4?util[_0xf10d('0x14')](_0xf10d('0x29'),_0x406a72,_0x3106f4?_0xf10d('0x2a'):_0xf10d('0x26')):null);});})['catch'](function(_0x2cce1f){logger[_0xf10d('0xb')](util[_0xf10d('0x14')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xf10d('0x2e')),util[_0xf10d('0x2f')](_0x2cce1f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf10d('0x30'));})[_0xf10d('0x31')](function(){process[_0xf10d('0x32')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 648fa5f..8d14aca 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 _0xe36c=['cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','*,*,*,*','IntervalId','map','intervals','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','sortBy','error','lodash','util','models','Interval','findAll','then','VoiceExtension','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','type','format','context','VoiceExtensionId','inbound','Set','CDR(destination)='];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe36c,0x13e));var _0xce36=function(_0x474ff5,_0x5241ce){_0x474ff5=_0x474ff5-0x0;var _0x53ba23=_0xe36c[_0x474ff5];return _0x53ba23;};'use strict';var _=require(_0xce36('0x0'));var util=require(_0xce36('0x1'));function rewrite(_0x11ccea,_0x82e59e){var _0x19a249=this;return _0x11ccea[_0xce36('0x2')][_0xce36('0x3')][_0xce36('0x4')]({'raw':!![]})[_0xce36('0x5')](function(_0x3d72c3){_0x19a249['intervals']=_0x3d72c3;return _0x11ccea[_0xce36('0x2')][_0xce36('0x6')]['findAll']({'where':{'IntervalId':_0x82e59e['IntervalId']},'raw':!![]});})[_0xce36('0x5')](function(_0x425764){return _0x11ccea[_0xce36('0x2')][_0xce36('0x6')][_0xce36('0x4')]({'where':{'exten':{'$in':_[_0xce36('0x7')](_['map'](_0x425764,_0xce36('0x8')))}},'order':[{'raw':_0xce36('0x9')}],'raw':!![]});})[_0xce36('0x5')](function(_0x5947ad){var _0x2e6986=_[_0xce36('0xa')](_0x5947ad,{'priority':'1'});var _0x4f716a=_[_0xce36('0xa')](_0x5947ad,{'isApp':0x1});var _0x909d68=_[_0xce36('0xb')](_0x4f716a,_0xce36('0x8'));var _0x4b403c=[_0xce36('0xc'),_0xce36('0xd')];var _0x433d79=[];var _0x23c021=[];for(var _0x4da026 in _0x909d68){if(_0x909d68[_0xce36('0xe')](_0x4da026)){_0x19a249[_0xce36('0xf')]=0x2;_0x19a249[_0xce36('0x10')]=[];_0x19a249[_0xce36('0x11')]=_[_0xce36('0x12')](_0x2e6986,{'exten':_0x909d68[_0x4da026][0x0][_0xce36('0x8')]});_0x19a249[_0xce36('0x10')][_0xce36('0x13')]({'type':_0x909d68[_0x4da026][0x0][_0xce36('0x14')],'app':'Set','appdata':util[_0xce36('0x15')]('CDR(type)=%s',_0x909d68[_0x4da026][0x0][_0xce36('0x14')]),'context':_0x909d68[_0x4da026][0x0][_0xce36('0x16')],'exten':_0x909d68[_0x4da026][0x0][_0xce36('0x8')],'priority':_0x19a249['priority']++,'VoiceExtensionId':_0x909d68[_0x4da026][0x0][_0xce36('0x17')]});if(_0x909d68[_0x4da026][0x0][_0xce36('0x14')]===_0xce36('0x18')){_0x19a249[_0xce36('0x10')][_0xce36('0x13')]({'type':_0x909d68[_0x4da026][0x0][_0xce36('0x14')],'app':_0xce36('0x19'),'appdata':'CDR(routeid)='+_0x909d68[_0x4da026][0x0][_0xce36('0x17')],'context':_0x909d68[_0x4da026][0x0][_0xce36('0x16')],'exten':_0x909d68[_0x4da026][0x0]['exten'],'priority':_0x19a249[_0xce36('0xf')]++,'VoiceExtensionId':_0x909d68[_0x4da026][0x0][_0xce36('0x17')]});}else if(_0x909d68[_0x4da026][0x0]['type']==='outbound'){if(_0x19a249[_0xce36('0x11')]){_0x19a249[_0xce36('0x10')][_0xce36('0x13')]({'type':_0x909d68[_0x4da026][0x0][_0xce36('0x14')],'app':'Set','appdata':_0xce36('0x1a')+(_0x19a249[_0xce36('0x11')][_0xce36('0x1b')]?_0xce36('0x1c')+_0x19a249[_0xce36('0x11')]['cutdigits']+'}':_0xce36('0x1d')),'context':_0x909d68[_0x4da026][0x0][_0xce36('0x16')],'exten':_0x909d68[_0x4da026][0x0][_0xce36('0x8')],'priority':_0x19a249[_0xce36('0xf')]++,'VoiceExtensionId':_0x909d68[_0x4da026][0x0][_0xce36('0x17')]});}_0x19a249[_0xce36('0x10')][_0xce36('0x13')]({'type':_0x909d68[_0x4da026][0x0][_0xce36('0x14')],'app':'Set','appdata':'CDR(routeid)='+_0x909d68[_0x4da026][0x0][_0xce36('0x17')],'context':_0x909d68[_0x4da026][0x0][_0xce36('0x16')],'exten':_0x909d68[_0x4da026][0x0]['exten'],'priority':_0x19a249[_0xce36('0xf')]++,'VoiceExtensionId':_0x909d68[_0x4da026][0x0][_0xce36('0x17')]});var _0x52e373=_0x19a249[_0xce36('0xf')]++;_0x19a249[_0xce36('0x10')][_0xce36('0x13')]({'type':_0x909d68[_0x4da026][0x0][_0xce36('0x14')],'app':_0xce36('0x1e'),'appdata':_0xce36('0x1f')+(_0x52e373+0x2)+'):Goto('+(_0x52e373+0x1)+')','context':_0x909d68[_0x4da026][0x0][_0xce36('0x16')],'exten':_0x909d68[_0x4da026][0x0]['exten'],'priority':_0x52e373,'VoiceExtensionId':_0x909d68[_0x4da026][0x0]['VoiceExtensionId']});if(_0x19a249['extension']){_0x19a249[_0xce36('0x10')][_0xce36('0x13')]({'type':_0x909d68[_0x4da026][0x0][_0xce36('0x14')],'app':_0xce36('0x19'),'appdata':_0x19a249[_0xce36('0x11')][_0xce36('0x1b')]?_0xce36('0x20')+_0x19a249[_0xce36('0x11')]['cutdigits']+'}':_0xce36('0x21'),'context':_0x909d68[_0x4da026][0x0]['context'],'exten':_0x909d68[_0x4da026][0x0][_0xce36('0x8')],'priority':_0x19a249['priority']++,'VoiceExtensionId':_0x909d68[_0x4da026][0x0][_0xce36('0x17')]});}_0x19a249[_0xce36('0x10')][_0xce36('0x13')]({'type':_0x909d68[_0x4da026][0x0][_0xce36('0x14')],'app':_0xce36('0x19'),'appdata':_0xce36('0x22')+_0x909d68[_0x4da026][0x0][_0xce36('0x17')],'context':_0x909d68[_0x4da026][0x0][_0xce36('0x16')],'exten':_0x909d68[_0x4da026][0x0][_0xce36('0x8')],'priority':_0x19a249[_0xce36('0xf')]++,'VoiceExtensionId':_0x909d68[_0x4da026][0x0]['VoiceExtensionId']});if(_0x19a249['extension']&&_0x19a249[_0xce36('0x11')][_0xce36('0xe')](_0xce36('0x23'))&&_0x19a249[_0xce36('0x11')][_0xce36('0x23')]!==_0xce36('0x24')){_0x19a249['extensions'][_0xce36('0x13')]({'type':_0x909d68[_0x4da026][0x0]['type'],'app':_0xce36('0x19'),'appdata':_0xce36('0x25'),'context':_0x909d68[_0x4da026][0x0][_0xce36('0x16')],'exten':_0x909d68[_0x4da026][0x0][_0xce36('0x8')],'priority':_0x19a249[_0xce36('0xf')]++,'VoiceExtensionId':_0x909d68[_0x4da026][0x0][_0xce36('0x17')]});_0x19a249[_0xce36('0x10')][_0xce36('0x13')]({'type':_0x909d68[_0x4da026][0x0][_0xce36('0x14')],'app':_0xce36('0x19'),'appdata':_0xce36('0x26')+_0x19a249[_0xce36('0x11')]['recordingFormat']||'wav','context':_0x909d68[_0x4da026][0x0][_0xce36('0x16')],'exten':_0x909d68[_0x4da026][0x0]['exten'],'priority':_0x19a249[_0xce36('0xf')]++,'VoiceExtensionId':_0x909d68[_0x4da026][0x0][_0xce36('0x17')]});}}_0x19a249['extensions']['push']({'type':_0x909d68[_0x4da026][0x0][_0xce36('0x14')],'app':_0xce36('0x19'),'appdata':_0xce36('0x27'),'context':_0x909d68[_0x4da026][0x0][_0xce36('0x16')],'exten':_0x909d68[_0x4da026][0x0][_0xce36('0x8')],'priority':_0x19a249['priority']++,'VoiceExtensionId':_0x909d68[_0x4da026][0x0]['VoiceExtensionId']});_0x19a249[_0xce36('0x10')][_0xce36('0x13')]({'type':_0x909d68[_0x4da026][0x0][_0xce36('0x14')],'app':_0xce36('0x19'),'appdata':_0xce36('0x28'),'context':_0x909d68[_0x4da026][0x0]['context'],'exten':_0x909d68[_0x4da026][0x0][_0xce36('0x8')],'priority':_0x19a249['priority']++,'VoiceExtensionId':_0x909d68[_0x4da026][0x0][_0xce36('0x17')]});_0x19a249[_0xce36('0x10')][_0xce36('0x13')]({'type':_0x909d68[_0x4da026][0x0][_0xce36('0x14')],'app':'Set','appdata':_0xce36('0x29'),'context':_0x909d68[_0x4da026][0x0][_0xce36('0x16')],'exten':_0x909d68[_0x4da026][0x0][_0xce36('0x8')],'priority':_0x19a249[_0xce36('0xf')]++,'VoiceExtensionId':_0x909d68[_0x4da026][0x0][_0xce36('0x17')]});for(var _0x278798=0x0,_0x2a2f59=0x0;_0x278798<_0x909d68[_0x4da026][_0xce36('0x2a')];_0x278798+=0x1,_0x2a2f59=0x0){var _0x2aafcb=_0x909d68[_0x4da026][_0x278798];if(_0x2aafcb['type']){_0x2aafcb[_0xce36('0x14')]=_0x2aafcb[_0xce36('0x14')][_0xce36('0x2b')]();}var _0x35bcc6=[];var _0x4aa54e=[];delete _0x2aafcb['id'];delete _0x2aafcb[_0xce36('0x2c')];delete _0x2aafcb['updatedAt'];var _0x1e36c6=_0x2aafcb[_0xce36('0x2d')]!==_0xce36('0x2e')?[_0x2aafcb[_0xce36('0x2d')]]:_0x2aafcb[_0xce36('0x2f')]?_[_0xce36('0x30')](_['filter'](_0x19a249[_0xce36('0x31')],{'IntervalId':_0x2aafcb[_0xce36('0x2f')]}),_0xce36('0x2d')):[];if(_0x2aafcb[_0xce36('0xe')]('tag')){if(_0x2aafcb['tag']&&_0x2aafcb[_0xce36('0x32')]!=='--'){_0x35bcc6[_0xce36('0x13')]({'type':_0x2aafcb[_0xce36('0x14')],'app':'Set','appdata':_0xce36('0x33')+_0x2aafcb[_0xce36('0x32')],'context':_0x2aafcb['context'],'exten':_0x2aafcb[_0xce36('0x8')],'priority':_0x1e36c6[_0xce36('0x2a')]+_0x19a249[_0xce36('0xf')]+_0x2a2f59++,'VoiceExtensionId':_0x2aafcb[_0xce36('0x17')]});}}if(_0x2aafcb[_0xce36('0x14')]==='outbound'&&_0x2aafcb['hasOwnProperty'](_0xce36('0x34'))){if(_0x2aafcb['callerID']){_0x35bcc6[_0xce36('0x13')]({'type':_0x2aafcb[_0xce36('0x14')],'app':_0xce36('0x1e'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x2aafcb[_0xce36('0x34')]+')','context':_0x2aafcb['context'],'exten':_0x2aafcb[_0xce36('0x8')],'priority':_0x1e36c6[_0xce36('0x2a')]+_0x19a249['priority']+_0x2a2f59++,'VoiceExtensionId':_0x2aafcb[_0xce36('0x17')]});}else{_0x35bcc6[_0xce36('0x13')]({'type':_0x2aafcb[_0xce36('0x14')],'app':_0xce36('0x1e'),'appdata':_0xce36('0x35'),'context':_0x2aafcb['context'],'exten':_0x2aafcb[_0xce36('0x8')],'priority':_0x1e36c6[_0xce36('0x2a')]+_0x19a249[_0xce36('0xf')]+_0x2a2f59++,'VoiceExtensionId':_0x2aafcb[_0xce36('0x17')]});}}if(_0x2aafcb[_0xce36('0xe')](_0xce36('0x36'))){if(_0x4b403c['indexOf'](_0x2aafcb['app'][_0xce36('0x2b')]())>=0x0&&_0x2aafcb[_0xce36('0x37')]!==_0xce36('0x38')){if(_0x2aafcb[_0xce36('0x36')]){_0x35bcc6[_0xce36('0x13')]({'type':_0x2aafcb['type'],'app':_0xce36('0x1e'),'appdata':_0xce36('0x39'),'context':_0x2aafcb[_0xce36('0x16')],'exten':_0x2aafcb['exten'],'priority':_0x1e36c6[_0xce36('0x2a')]+_0x19a249[_0xce36('0xf')]+_0x2a2f59++,'VoiceExtensionId':_0x2aafcb[_0xce36('0x17')]});_0x35bcc6[_0xce36('0x13')]({'type':_0x2aafcb[_0xce36('0x14')],'app':_0xce36('0x19'),'appdata':_0xce36('0x3a'),'context':_0x2aafcb[_0xce36('0x16')],'exten':_0x2aafcb[_0xce36('0x8')],'priority':_0x1e36c6['length']+_0x19a249['priority']+_0x2a2f59++,'VoiceExtensionId':_0x2aafcb[_0xce36('0x17')]});}else{_0x35bcc6[_0xce36('0x13')]({'type':_0x2aafcb['type'],'app':'ExecIf','appdata':_0xce36('0x3b'),'context':_0x2aafcb[_0xce36('0x16')],'exten':_0x2aafcb[_0xce36('0x8')],'priority':_0x1e36c6[_0xce36('0x2a')]+_0x19a249['priority']+_0x2a2f59++,'VoiceExtensionId':_0x2aafcb[_0xce36('0x17')]});_0x35bcc6[_0xce36('0x13')]({'type':_0x2aafcb[_0xce36('0x14')],'app':_0xce36('0x19'),'appdata':_0xce36('0x3c'),'context':_0x2aafcb[_0xce36('0x16')],'exten':_0x2aafcb[_0xce36('0x8')],'priority':_0x1e36c6[_0xce36('0x2a')]+_0x19a249['priority']+_0x2a2f59++,'VoiceExtensionId':_0x2aafcb['VoiceExtensionId']});}}}for(var _0x1cfa84=0x0;_0x1cfa84<_0x1e36c6['length'];_0x1cfa84+=0x1){var _0x199223=_0x19a249[_0xce36('0xf')]+_0x1e36c6[_0xce36('0x2a')];var _0x590838=_0x1cfa84===_0x1e36c6[_0xce36('0x2a')]-0x1?_0x19a249['priority']+_0x35bcc6[_0xce36('0x2a')]+_0x4aa54e[_0xce36('0x2a')]+0x2:_0x19a249[_0xce36('0xf')]+_0x1cfa84+0x1;_0x35bcc6['splice'](_0x1cfa84,0x0,{'type':_0x2aafcb[_0xce36('0x14')],'app':_0xce36('0x3d'),'appdata':_0x1e36c6[_0x1cfa84]+'?'+_0x2aafcb[_0xce36('0x16')]+_0xce36('0x3e')+_0x199223+':'+_0x2aafcb['context']+_0xce36('0x3e')+_0x590838,'exten':_0x2aafcb[_0xce36('0x8')],'context':_0x2aafcb[_0xce36('0x16')],'priority':_0x19a249[_0xce36('0xf')]+_0x1cfa84,'VoiceExtensionId':_0x909d68[_0x4da026][0x0][_0xce36('0x17')]});}_0x2aafcb['priority']=_0x35bcc6['length']?_[_0xce36('0x3f')](_0x35bcc6)[_0xce36('0xf')]+0x1:_0x19a249[_0xce36('0xf')];_0x19a249[_0xce36('0xf')]=(_0x4aa54e['length']?_[_0xce36('0x3f')](_0x4aa54e)[_0xce36('0xf')]:_0x2aafcb[_0xce36('0xf')])+0x1;_0x19a249[_0xce36('0x10')]=_[_0xce36('0x40')](_0x19a249[_0xce36('0x10')],_0x35bcc6,[_0x2aafcb],_0x4aa54e);}_0x19a249[_0xce36('0x10')]['push']({'type':_0x909d68[_0x4da026][0x0][_0xce36('0x14')],'app':'Hangup','exten':_0x909d68[_0x4da026][0x0][_0xce36('0x8')],'context':_0x909d68[_0x4da026][0x0][_0xce36('0x16')],'priority':_0x19a249['priority'],'VoiceExtensionId':_0x909d68[_0x4da026][0x0][_0xce36('0x17')]});_0x433d79[_0xce36('0x13')](_0x909d68[_0x4da026][0x0][_0xce36('0x17')]);_0x23c021=_[_0xce36('0x40')](_0x23c021,_0x19a249[_0xce36('0x10')]);}}return _0x11ccea[_0xce36('0x41')](function(_0x5c6ccd){return _0x11ccea[_0xce36('0x2')][_0xce36('0x6')][_0xce36('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x433d79}},'transaction':_0x5c6ccd})[_0xce36('0x5')](function(_0x7235d1){return _0x11ccea[_0xce36('0x2')][_0xce36('0x6')]['bulkCreate'](_[_0xce36('0x43')](_0x23c021,_0xce36('0xf')),{'transaction':_0x5c6ccd});});});})['catch'](function(_0x171161){console[_0xce36('0x44')](_0x171161);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x3640=['indexOf','app','toLowerCase','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','last','concat','transaction','models','destroy','bulkCreate','error','lodash','util','then','intervals','VoiceExtension','findAll','IntervalId','CAST(priority\x20AS\x20UNSIGNED)','exten','playback','hasOwnProperty','priority','extensions','extension','find','push','type','format','CDR(type)=%s','VoiceExtensionId','Set','CDR(routeid)=','context','outbound','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','updatedAt','interval','*,*,*,*','map','filter','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','length','answer'];(function(_0xa9eaa0,_0x4ba2b4){var _0x30897a=function(_0x2caa01){while(--_0x2caa01){_0xa9eaa0['push'](_0xa9eaa0['shift']());}};_0x30897a(++_0x4ba2b4);}(_0x3640,0x1d7));var _0x0364=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x3640[_0x43d11d];return _0x38cd08;};'use strict';var _=require(_0x0364('0x0'));var util=require(_0x0364('0x1'));function rewrite(_0x23480f,_0x568013){var _0x53f40e=this;return _0x23480f['models']['Interval']['findAll']({'raw':!![]})[_0x0364('0x2')](function(_0x16dbd5){_0x53f40e[_0x0364('0x3')]=_0x16dbd5;return _0x23480f['models'][_0x0364('0x4')][_0x0364('0x5')]({'where':{'IntervalId':_0x568013[_0x0364('0x6')]},'raw':!![]});})[_0x0364('0x2')](function(_0x15d2a5){return _0x23480f['models'][_0x0364('0x4')]['findAll']({'where':{'exten':{'$in':_['uniq'](_['map'](_0x15d2a5,'exten'))}},'order':[{'raw':_0x0364('0x7')}],'raw':!![]});})[_0x0364('0x2')](function(_0x112445){var _0x4aed44=_['filter'](_0x112445,{'priority':'1'});var _0x4ed3f3=_['filter'](_0x112445,{'isApp':0x1});var _0x1909a5=_['groupBy'](_0x4ed3f3,_0x0364('0x8'));var _0x2fafb2=['queue',_0x0364('0x9')];var _0x198e19=[];var _0x48bd1e=[];for(var _0x1cde8f in _0x1909a5){if(_0x1909a5[_0x0364('0xa')](_0x1cde8f)){_0x53f40e[_0x0364('0xb')]=0x2;_0x53f40e[_0x0364('0xc')]=[];_0x53f40e[_0x0364('0xd')]=_[_0x0364('0xe')](_0x4aed44,{'exten':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x8')]});_0x53f40e[_0x0364('0xc')][_0x0364('0xf')]({'type':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x10')],'app':'Set','appdata':util[_0x0364('0x11')](_0x0364('0x12'),_0x1909a5[_0x1cde8f][0x0][_0x0364('0x10')]),'context':_0x1909a5[_0x1cde8f][0x0]['context'],'exten':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x8')],'priority':_0x53f40e[_0x0364('0xb')]++,'VoiceExtensionId':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x13')]});if(_0x1909a5[_0x1cde8f][0x0]['type']==='inbound'){_0x53f40e[_0x0364('0xc')]['push']({'type':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x10')],'app':_0x0364('0x14'),'appdata':_0x0364('0x15')+_0x1909a5[_0x1cde8f][0x0][_0x0364('0x13')],'context':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x16')],'exten':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x8')],'priority':_0x53f40e[_0x0364('0xb')]++,'VoiceExtensionId':_0x1909a5[_0x1cde8f][0x0]['VoiceExtensionId']});}else if(_0x1909a5[_0x1cde8f][0x0][_0x0364('0x10')]===_0x0364('0x17')){if(_0x53f40e[_0x0364('0xd')]){_0x53f40e['extensions'][_0x0364('0xf')]({'type':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x10')],'app':_0x0364('0x14'),'appdata':'CDR(destination)='+(_0x53f40e['extension'][_0x0364('0x18')]?_0x0364('0x19')+_0x53f40e['extension'][_0x0364('0x18')]+'}':_0x0364('0x1a')),'context':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x16')],'exten':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x8')],'priority':_0x53f40e[_0x0364('0xb')]++,'VoiceExtensionId':_0x1909a5[_0x1cde8f][0x0]['VoiceExtensionId']});}_0x53f40e['extensions']['push']({'type':_0x1909a5[_0x1cde8f][0x0]['type'],'app':_0x0364('0x14'),'appdata':'CDR(routeid)='+_0x1909a5[_0x1cde8f][0x0][_0x0364('0x13')],'context':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x16')],'exten':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x8')],'priority':_0x53f40e[_0x0364('0xb')]++,'VoiceExtensionId':_0x1909a5[_0x1cde8f][0x0]['VoiceExtensionId']});var _0x3ab25e=_0x53f40e[_0x0364('0xb')]++;_0x53f40e['extensions'][_0x0364('0xf')]({'type':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x10')],'app':_0x0364('0x1b'),'appdata':_0x0364('0x1c')+(_0x3ab25e+0x2)+_0x0364('0x1d')+(_0x3ab25e+0x1)+')','context':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x16')],'exten':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x8')],'priority':_0x3ab25e,'VoiceExtensionId':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x13')]});if(_0x53f40e['extension']){_0x53f40e['extensions'][_0x0364('0xf')]({'type':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x10')],'app':_0x0364('0x14'),'appdata':_0x53f40e['extension'][_0x0364('0x18')]?'CDR(prefix)=${EXTEN:0:'+_0x53f40e[_0x0364('0xd')][_0x0364('0x18')]+'}':_0x0364('0x1e'),'context':_0x1909a5[_0x1cde8f][0x0]['context'],'exten':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x8')],'priority':_0x53f40e['priority']++,'VoiceExtensionId':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x13')]});}_0x53f40e[_0x0364('0xc')]['push']({'type':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x10')],'app':'Set','appdata':_0x0364('0x1f')+_0x1909a5[_0x1cde8f][0x0][_0x0364('0x13')],'context':_0x1909a5[_0x1cde8f][0x0]['context'],'exten':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x8')],'priority':_0x53f40e[_0x0364('0xb')]++,'VoiceExtensionId':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x13')]});if(_0x53f40e[_0x0364('0xd')]&&_0x53f40e[_0x0364('0xd')][_0x0364('0xa')](_0x0364('0x20'))&&_0x53f40e[_0x0364('0xd')]['recordingFormat']!==_0x0364('0x21')){_0x53f40e[_0x0364('0xc')][_0x0364('0xf')]({'type':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x10')],'app':_0x0364('0x14'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x16')],'exten':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x8')],'priority':_0x53f40e[_0x0364('0xb')]++,'VoiceExtensionId':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x13')]});_0x53f40e[_0x0364('0xc')][_0x0364('0xf')]({'type':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x10')],'app':_0x0364('0x14'),'appdata':_0x0364('0x22')+_0x53f40e[_0x0364('0xd')][_0x0364('0x20')]||_0x0364('0x23'),'context':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x16')],'exten':_0x1909a5[_0x1cde8f][0x0]['exten'],'priority':_0x53f40e[_0x0364('0xb')]++,'VoiceExtensionId':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x13')]});}}_0x53f40e[_0x0364('0xc')]['push']({'type':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x10')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x16')],'exten':_0x1909a5[_0x1cde8f][0x0]['exten'],'priority':_0x53f40e[_0x0364('0xb')]++,'VoiceExtensionId':_0x1909a5[_0x1cde8f][0x0]['VoiceExtensionId']});_0x53f40e[_0x0364('0xc')][_0x0364('0xf')]({'type':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x10')],'app':_0x0364('0x14'),'appdata':_0x0364('0x24'),'context':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x16')],'exten':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x8')],'priority':_0x53f40e['priority']++,'VoiceExtensionId':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x13')]});_0x53f40e[_0x0364('0xc')][_0x0364('0xf')]({'type':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x10')],'app':_0x0364('0x14'),'appdata':_0x0364('0x25'),'context':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x16')],'exten':_0x1909a5[_0x1cde8f][0x0]['exten'],'priority':_0x53f40e[_0x0364('0xb')]++,'VoiceExtensionId':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x13')]});for(var _0x2bad73=0x0,_0x4caf1c=0x0;_0x2bad73<_0x1909a5[_0x1cde8f]['length'];_0x2bad73+=0x1,_0x4caf1c=0x0){var _0x2bc6c2=_0x1909a5[_0x1cde8f][_0x2bad73];if(_0x2bc6c2[_0x0364('0x10')]){_0x2bc6c2[_0x0364('0x10')]=_0x2bc6c2[_0x0364('0x10')]['toLowerCase']();}var _0x550549=[];var _0xdc3e60=[];delete _0x2bc6c2['id'];delete _0x2bc6c2['createdAt'];delete _0x2bc6c2[_0x0364('0x26')];var _0x23d3ad=_0x2bc6c2[_0x0364('0x27')]!==_0x0364('0x28')?[_0x2bc6c2[_0x0364('0x27')]]:_0x2bc6c2[_0x0364('0x6')]?_[_0x0364('0x29')](_[_0x0364('0x2a')](_0x53f40e[_0x0364('0x3')],{'IntervalId':_0x2bc6c2['IntervalId']}),_0x0364('0x27')):[];if(_0x2bc6c2[_0x0364('0xa')](_0x0364('0x2b'))){if(_0x2bc6c2[_0x0364('0x2b')]&&_0x2bc6c2['tag']!=='--'){_0x550549[_0x0364('0xf')]({'type':_0x2bc6c2[_0x0364('0x10')],'app':'Set','appdata':_0x0364('0x2c')+_0x2bc6c2[_0x0364('0x2b')],'context':_0x2bc6c2[_0x0364('0x16')],'exten':_0x2bc6c2[_0x0364('0x8')],'priority':_0x23d3ad['length']+_0x53f40e['priority']+_0x4caf1c++,'VoiceExtensionId':_0x2bc6c2[_0x0364('0x13')]});}}if(_0x2bc6c2[_0x0364('0x10')]===_0x0364('0x17')&&_0x2bc6c2[_0x0364('0xa')]('callerID')){if(_0x2bc6c2[_0x0364('0x2d')]){_0x550549['push']({'type':_0x2bc6c2[_0x0364('0x10')],'app':_0x0364('0x1b'),'appdata':_0x0364('0x2e')+_0x2bc6c2[_0x0364('0x2d')]+')','context':_0x2bc6c2[_0x0364('0x16')],'exten':_0x2bc6c2[_0x0364('0x8')],'priority':_0x23d3ad['length']+_0x53f40e[_0x0364('0xb')]+_0x4caf1c++,'VoiceExtensionId':_0x2bc6c2[_0x0364('0x13')]});}else{_0x550549[_0x0364('0xf')]({'type':_0x2bc6c2['type'],'app':_0x0364('0x1b'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x2bc6c2['context'],'exten':_0x2bc6c2[_0x0364('0x8')],'priority':_0x23d3ad[_0x0364('0x2f')]+_0x53f40e['priority']+_0x4caf1c++,'VoiceExtensionId':_0x2bc6c2[_0x0364('0x13')]});}}if(_0x2bc6c2[_0x0364('0xa')](_0x0364('0x30'))){if(_0x2fafb2[_0x0364('0x31')](_0x2bc6c2[_0x0364('0x32')][_0x0364('0x33')]())>=0x0&&_0x2bc6c2[_0x0364('0x34')]!=='custom'){if(_0x2bc6c2[_0x0364('0x30')]){_0x550549[_0x0364('0xf')]({'type':_0x2bc6c2[_0x0364('0x10')],'app':'ExecIf','appdata':_0x0364('0x35'),'context':_0x2bc6c2[_0x0364('0x16')],'exten':_0x2bc6c2['exten'],'priority':_0x23d3ad[_0x0364('0x2f')]+_0x53f40e[_0x0364('0xb')]+_0x4caf1c++,'VoiceExtensionId':_0x2bc6c2['VoiceExtensionId']});_0x550549[_0x0364('0xf')]({'type':_0x2bc6c2[_0x0364('0x10')],'app':_0x0364('0x14'),'appdata':_0x0364('0x36'),'context':_0x2bc6c2['context'],'exten':_0x2bc6c2['exten'],'priority':_0x23d3ad[_0x0364('0x2f')]+_0x53f40e[_0x0364('0xb')]+_0x4caf1c++,'VoiceExtensionId':_0x2bc6c2[_0x0364('0x13')]});}else{_0x550549['push']({'type':_0x2bc6c2[_0x0364('0x10')],'app':'ExecIf','appdata':_0x0364('0x37'),'context':_0x2bc6c2[_0x0364('0x16')],'exten':_0x2bc6c2[_0x0364('0x8')],'priority':_0x23d3ad[_0x0364('0x2f')]+_0x53f40e[_0x0364('0xb')]+_0x4caf1c++,'VoiceExtensionId':_0x2bc6c2[_0x0364('0x13')]});_0x550549[_0x0364('0xf')]({'type':_0x2bc6c2[_0x0364('0x10')],'app':_0x0364('0x14'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x2bc6c2[_0x0364('0x16')],'exten':_0x2bc6c2[_0x0364('0x8')],'priority':_0x23d3ad[_0x0364('0x2f')]+_0x53f40e[_0x0364('0xb')]+_0x4caf1c++,'VoiceExtensionId':_0x2bc6c2[_0x0364('0x13')]});}}}for(var _0x17c58e=0x0;_0x17c58e<_0x23d3ad['length'];_0x17c58e+=0x1){var _0x6449c9=_0x53f40e['priority']+_0x23d3ad[_0x0364('0x2f')];var _0x2cd631=_0x17c58e===_0x23d3ad[_0x0364('0x2f')]-0x1?_0x53f40e[_0x0364('0xb')]+_0x550549[_0x0364('0x2f')]+_0xdc3e60[_0x0364('0x2f')]+0x2:_0x53f40e[_0x0364('0xb')]+_0x17c58e+0x1;_0x550549[_0x0364('0x38')](_0x17c58e,0x0,{'type':_0x2bc6c2[_0x0364('0x10')],'app':'GotoIfTime','appdata':_0x23d3ad[_0x17c58e]+'?'+_0x2bc6c2[_0x0364('0x16')]+_0x0364('0x39')+_0x6449c9+':'+_0x2bc6c2[_0x0364('0x16')]+_0x0364('0x39')+_0x2cd631,'exten':_0x2bc6c2['exten'],'context':_0x2bc6c2['context'],'priority':_0x53f40e[_0x0364('0xb')]+_0x17c58e,'VoiceExtensionId':_0x1909a5[_0x1cde8f][0x0]['VoiceExtensionId']});}_0x2bc6c2[_0x0364('0xb')]=_0x550549['length']?_[_0x0364('0x3a')](_0x550549)[_0x0364('0xb')]+0x1:_0x53f40e[_0x0364('0xb')];_0x53f40e[_0x0364('0xb')]=(_0xdc3e60[_0x0364('0x2f')]?_['last'](_0xdc3e60)[_0x0364('0xb')]:_0x2bc6c2[_0x0364('0xb')])+0x1;_0x53f40e['extensions']=_[_0x0364('0x3b')](_0x53f40e[_0x0364('0xc')],_0x550549,[_0x2bc6c2],_0xdc3e60);}_0x53f40e[_0x0364('0xc')][_0x0364('0xf')]({'type':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x10')],'app':'Hangup','exten':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x8')],'context':_0x1909a5[_0x1cde8f][0x0][_0x0364('0x16')],'priority':_0x53f40e[_0x0364('0xb')],'VoiceExtensionId':_0x1909a5[_0x1cde8f][0x0]['VoiceExtensionId']});_0x198e19[_0x0364('0xf')](_0x1909a5[_0x1cde8f][0x0][_0x0364('0x13')]);_0x48bd1e=_[_0x0364('0x3b')](_0x48bd1e,_0x53f40e[_0x0364('0xc')]);}}return _0x23480f[_0x0364('0x3c')](function(_0x419a29){return _0x23480f[_0x0364('0x3d')][_0x0364('0x4')][_0x0364('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x198e19}},'transaction':_0x419a29})[_0x0364('0x2')](function(_0x49bae5){return _0x23480f[_0x0364('0x3d')][_0x0364('0x4')][_0x0364('0x3f')](_['sortBy'](_0x48bd1e,_0x0364('0xb')),{'transaction':_0x419a29});});});})['catch'](function(_0x5cb519){console[_0x0364('0x40')](_0x5cb519);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 5f52e3c..13d1a03 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 _0x21cc=['birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','create','keys','push','catch','cmContact','inspect','into','cm_hopper','fromQuery','phone','scheduledAt','field','NOW()','ContactId','toString','createdAt','updatedAt','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','\x20=\x20?','str','calleridnum','cm_hopper_final','insert','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','then','get','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','Campaign','Lists','CampaignId','BlackLists','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','CmContact','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','stringify','bluebird','util','lodash','squel','../../../mysqldb','../../../config/environment','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','data','firstName\x20not\x20specified!','phone\x20not\x20specified!'];(function(_0x4ba5f1,_0x16b3b0){var _0x4e22b0=function(_0x130c39){while(--_0x130c39){_0x4ba5f1['push'](_0x4ba5f1['shift']());}};_0x4e22b0(++_0x16b3b0);}(_0x21cc,0xbe));var _0xc21c=function(_0x4b69c5,_0x28f0bd){_0x4b69c5=_0x4b69c5-0x0;var _0x54aa0c=_0x21cc[_0x4b69c5];return _0x54aa0c;};'use strict';var BPromise=require(_0xc21c('0x0'));var util=require(_0xc21c('0x1'));var _=require(_0xc21c('0x2'));var fs=require('fs');var squel=require(_0xc21c('0x3'));var Papa=require('papaparse');var Redis=require('ioredis');var db=require(_0xc21c('0x4'))['db'];var config=require(_0xc21c('0x5'));var logger=require('../../../config/logger')(_0xc21c('0x6'));config[_0xc21c('0x7')]=_[_0xc21c('0x8')](config[_0xc21c('0x7')],{'host':_0xc21c('0x9'),'port':0x18eb});var socket=require(_0xc21c('0xa'))(new Redis(config[_0xc21c('0x7')]));require(_0xc21c('0xb'))[_0xc21c('0xc')](socket);try{if(!process[_0xc21c('0xd')][0x2]||process[_0xc21c('0xd')][0x2]===_0xc21c('0xe')||process[_0xc21c('0xd')][0x2]===_0xc21c('0xf')){throw new Error(_0xc21c('0x10'));}var FILEPATH=process[_0xc21c('0xd')][0x2];if(!process[_0xc21c('0xd')][0x3]||process['argv'][0x3]==='undefined'||process[_0xc21c('0xd')][0x3]===_0xc21c('0xf')||!process[_0xc21c('0xd')][0x4]||process[_0xc21c('0xd')][0x4]===_0xc21c('0xe')||process['argv'][0x4]===_0xc21c('0xf')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0xc21c('0x11')](process[_0xc21c('0xd')][0x3][_0xc21c('0x12')](','),process[_0xc21c('0xd')][0x4][_0xc21c('0x12')](','));if(!process[_0xc21c('0xd')][0x5]||process[_0xc21c('0xd')][0x5]===_0xc21c('0xe')||process[_0xc21c('0xd')][0x5]==='null'){throw new Error(_0xc21c('0x13'));}var LISTID=process[_0xc21c('0xd')][0x5];var COMPANYID=process['argv'][0x6]&&process['argv'][0x6]!==_0xc21c('0xe')&&process[_0xc21c('0xd')][0x6]!==_0xc21c('0xf')?process[_0xc21c('0xd')][0x6]:null;var DUPLICATES=process[_0xc21c('0xd')][0x7]&&process[_0xc21c('0xd')][0x7]!=='undefined'&&process[_0xc21c('0xd')][0x7]!=='null'?process[_0xc21c('0xd')][0x7]:null;if(!process[_0xc21c('0xd')][0x8]||process['argv'][0x8]===_0xc21c('0xe')||process['argv'][0x8]==='null'){throw new Error(_0xc21c('0x14'));}var SOCKET_TIMESTAMP=process[_0xc21c('0xd')][0x8];}catch(_0x5f23f5){logger[_0xc21c('0x15')](_0x5f23f5);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(_0x22720a,_0x5f3755,_0x3ab360,_0x505e6c){var _0x2cd249={'message':_0x5f3755};_0x2cd249[_0x22720a]=!![];if(_0x3ab360){_0x2cd249[_0xc21c('0x16')]=_0x3ab360;}if(_0x505e6c){_0x2cd249[_0xc21c('0x17')]=_0x505e6c;}return _0x2cd249;}function isEmail(_0x4f013d){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))*$/[_0xc21c('0x18')](_0x4f013d);}function checkRow(_0x5cb61a,_0x345afa,_0xbb0d96){return new BPromise(function(_0x23cb94,_0x2d6e54){if(_['isNil'](_0x5cb61a)){return _0x2d6e54(handleCheckRowError(_0xc21c('0x15'),_0xc21c('0x19'),null,_0xbb0d96));}if(_0x5cb61a[_0xc21c('0x1a')]&&_0x5cb61a[_0xc21c('0x1a')][_0xc21c('0x1b')]){var _0x264fb4=_[_0xc21c('0x1c')](_0x5cb61a['errors'],_0xc21c('0x1d'))[_0xc21c('0x1e')](';');return _0x2d6e54(handleCheckRowError(_0xc21c('0x15'),_0x264fb4,null,_0xbb0d96));}var _0x8cee49={};for(var _0x3e322c in FIELDS){if(FIELDS['hasOwnProperty'](_0x3e322c)&&FIELDS[_0x3e322c]){_0x8cee49[_0x3e322c]=_0x5cb61a[_0xc21c('0x1f')][0x0][FIELDS[_0x3e322c]]||_0x5cb61a[_0xc21c('0x1f')][0x0]['\ufeff'+FIELDS[_0x3e322c]];}}if(!_0x8cee49['firstName']){return _0x2d6e54(handleCheckRowError(_0xc21c('0x15'),_0xc21c('0x20'),null,_0xbb0d96));}if(!_0x8cee49['phone']){return _0x2d6e54(handleCheckRowError(_0xc21c('0x15'),_0xc21c('0x21'),null,_0xbb0d96));}if(_0x8cee49[_0xc21c('0x22')]){var _0x3ad3f6=moment(_0x8cee49[_0xc21c('0x22')],_0xc21c('0x23'));if(!_0x3ad3f6[_0xc21c('0x24')]()){return _0x2d6e54(handleCheckRowError(_0xc21c('0x15'),_0xc21c('0x25'),null,_0xbb0d96));}}if(_0x8cee49[_0xc21c('0x26')]){if(!isEmail(_0x8cee49[_0xc21c('0x26')])){return _0x2d6e54(handleCheckRowError('error',_0xc21c('0x27'),null,_0xbb0d96));}}_0x8cee49[_0xc21c('0x28')]=LISTID;_0x8cee49[_0xc21c('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xc21c('0x1b')]&&_0x345afa){var _0x4b765a={};for(var _0x4b1cc4=0x0,_0x10b44d=DUPLICATES[_0xc21c('0x1b')];_0x4b1cc4<_0x10b44d;_0x4b1cc4+=0x1){_0x4b765a[DUPLICATES[_0x4b1cc4]]=_0x8cee49[DUPLICATES[_0x4b1cc4]];}var _0x22dd07=_[_0xc21c('0x2a')](_0x345afa,_0x4b765a);if(_0x22dd07){return _0x2d6e54(handleCheckRowError(_0xc21c('0x2b'),_0xc21c('0x2c'),_0x22dd07,_0xbb0d96));}}return db['CmContact'][_0xc21c('0x2d')](_0x8cee49,{'raw':!![],'hooks':![],'fields':_[_0xc21c('0x2e')](_0x8cee49)})['then'](function(_0x175441){if(DUPLICATES&&DUPLICATES['length']&&_0x345afa){_0x345afa[_0xc21c('0x2f')](_['pick'](_0x8cee49,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x175441['id'];return _0x23cb94();})[_0xc21c('0x30')](function(_0x312129){return _0x2d6e54(handleCheckRowError(_0xc21c('0x15'),'Error\x20while\x20creating\x20contact:\x20'+(_0x312129[_0xc21c('0x1d')]||JSON['stringify'](_0x312129)),null,_0xbb0d96));});});}function checkHopper(){function _0x385106(){return function(_0x38e937){logger[_0xc21c('0x15')](_0xc21c('0x31'),'checkHopper',util[_0xc21c('0x32')](_0x38e937,{'showHidden':![],'depth':null}));};}var _0x17374a=function(_0x174522,_0x3a17dc){var _0xca1f46=squel['insert']()[_0xc21c('0x33')](_0xc21c('0x34'))[_0xc21c('0x35')]([_0xc21c('0x36'),_0xc21c('0x37'),'ContactId',_0xc21c('0x28'),_0x3a17dc,'createdAt','updatedAt'],squel['select']()[_0xc21c('0x38')](_0xc21c('0x36'),_0xc21c('0x36'))[_0xc21c('0x38')](_0xc21c('0x39'),_0xc21c('0x37'))[_0xc21c('0x38')]('id',_0xc21c('0x3a'))[_0xc21c('0x38')](LISTID[_0xc21c('0x3b')](),_0xc21c('0x28'))[_0xc21c('0x38')](_0x174522['id'][_0xc21c('0x3b')](),_0x3a17dc)['field'](_0xc21c('0x39'),_0xc21c('0x3c'))[_0xc21c('0x38')](_0xc21c('0x39'),_0xc21c('0x3d'))[_0xc21c('0x3e')](_0xc21c('0x3f'))['where'](_0xc21c('0x40'))['where'](_0xc21c('0x41'),LISTID[_0xc21c('0x3b')]())[_0xc21c('0x42')](_0xc21c('0x43'))[_0xc21c('0x42')](_0xc21c('0x44'),squel[_0xc21c('0x45')]()[_0xc21c('0x38')](_0xc21c('0x36'))[_0xc21c('0x3e')]('cm_hopper')[_0xc21c('0x42')](_0x3a17dc+_0xc21c('0x46'),_0x174522['id'][_0xc21c('0x3b')]())))[_0xc21c('0x3b')]();return _0xca1f46;};var _0x100d16=function(_0x1932ed,_0x28c0f8){var _0x4508d9=squel['insert']()[_0xc21c('0x33')](_0xc21c('0x34'))[_0xc21c('0x35')]([_0xc21c('0x36'),'scheduledAt',_0xc21c('0x3a'),_0xc21c('0x28'),_0x28c0f8,'createdAt',_0xc21c('0x3d')],squel[_0xc21c('0x45')]()[_0xc21c('0x38')]('phone',_0xc21c('0x36'))[_0xc21c('0x38')](_0xc21c('0x39'),_0xc21c('0x37'))['field']('id',_0xc21c('0x3a'))[_0xc21c('0x38')](LISTID[_0xc21c('0x3b')](),_0xc21c('0x28'))['field'](_0x1932ed['id'][_0xc21c('0x3b')](),_0x28c0f8)['field'](_0xc21c('0x39'),_0xc21c('0x3c'))['field']('NOW()',_0xc21c('0x3d'))[_0xc21c('0x3e')](_0xc21c('0x3f'))['where'](_0xc21c('0x40'))['where'](_0xc21c('0x41'),LISTID['toString']())[_0xc21c('0x42')]('id\x20IN\x20?',squel[_0xc21c('0x47')](hopperContacts))[_0xc21c('0x42')](_0xc21c('0x43'))[_0xc21c('0x42')](_0xc21c('0x44'),squel[_0xc21c('0x45')]()[_0xc21c('0x38')](_0xc21c('0x48'))[_0xc21c('0x3e')](_0xc21c('0x49'))[_0xc21c('0x42')](_0x28c0f8+_0xc21c('0x46'),_0x1932ed['id']['toString']()))[_0xc21c('0x42')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc21c('0x45')]()[_0xc21c('0x38')](_0xc21c('0x36'))['from'](_0xc21c('0x34'))['where'](_0x28c0f8+_0xc21c('0x46'),_0x1932ed['id'][_0xc21c('0x3b')]())))[_0xc21c('0x3b')]();return _0x4508d9;};function _0x3a723c(_0x33d553,_0x38d530){var _0x1983e1=squel[_0xc21c('0x4a')]()[_0xc21c('0x33')](_0xc21c('0x34'))[_0xc21c('0x35')]([_0xc21c('0x36'),_0xc21c('0x37'),_0xc21c('0x3a'),_0xc21c('0x28'),_0x38d530,_0xc21c('0x3c'),_0xc21c('0x3d')],squel[_0xc21c('0x45')]()[_0xc21c('0x38')](_0xc21c('0x36'),_0xc21c('0x36'))[_0xc21c('0x38')]('NOW()',_0xc21c('0x37'))[_0xc21c('0x38')]('id','ContactId')[_0xc21c('0x38')](LISTID['toString'](),'ListId')['field'](_0x33d553['id'][_0xc21c('0x3b')](),_0x38d530)[_0xc21c('0x38')](_0xc21c('0x39'),_0xc21c('0x3c'))['field'](_0xc21c('0x39'),_0xc21c('0x3d'))[_0xc21c('0x3e')]('cm_contacts')[_0xc21c('0x42')](_0xc21c('0x40'))[_0xc21c('0x42')]('ListId\x20=\x20?',LISTID[_0xc21c('0x3b')]())[_0xc21c('0x42')](_0xc21c('0x4b'),squel[_0xc21c('0x47')](hopperContacts))['where'](_0xc21c('0x43')))[_0xc21c('0x3b')]();return _0x1983e1;}function _0x222f63(_0x9ac4f0,_0x27e8bf){var _0x2666ea=squel['insert']()[_0xc21c('0x33')](_0xc21c('0x4c'))[_0xc21c('0x35')](['phone',_0xc21c('0x3a'),_0xc21c('0x28'),_0x27e8bf,_0xc21c('0x3c'),_0xc21c('0x3d')],squel[_0xc21c('0x45')]()[_0xc21c('0x38')](_0xc21c('0x36'),_0xc21c('0x36'))[_0xc21c('0x38')]('id',_0xc21c('0x3a'))['field'](LISTID[_0xc21c('0x3b')](),_0xc21c('0x28'))[_0xc21c('0x38')](_0x9ac4f0['id']['toString'](),_0x27e8bf)[_0xc21c('0x38')](_0xc21c('0x39'),_0xc21c('0x3c'))[_0xc21c('0x38')](_0xc21c('0x39'),'updatedAt')[_0xc21c('0x3e')](_0xc21c('0x3f'))['where']('deletedAt\x20IS\x20NULL')[_0xc21c('0x42')](_0xc21c('0x41'),LISTID[_0xc21c('0x3b')]())[_0xc21c('0x42')]('id\x20IN\x20?',squel[_0xc21c('0x47')](hopperContacts))[_0xc21c('0x42')]('phone\x20IS\x20NOT\x20NULL'))[_0xc21c('0x3b')]();return _0x2666ea;}return db[_0xc21c('0x4d')][_0xc21c('0x4e')]({'where':{'type':_0xc21c('0x4f')},'attributes':['id',_0xc21c('0x50')],'include':[{'model':db[_0xc21c('0x51')],'as':'Lists','where':{'id':LISTID}}]})[_0xc21c('0x52')](function(_0x165ca0){var _0xedcbd5=[];if(_0x165ca0){var _0x1a4a52;for(var _0x376ce9=0x0,_0x57d1ee;_0x376ce9<_0x165ca0[_0xc21c('0x1b')];_0x376ce9+=0x1){_0x57d1ee=_0x165ca0[_0x376ce9][_0xc21c('0x53')]({'plain':!![]});switch(_0x57d1ee['dialCheckDuplicateType']){case _0xc21c('0x54'):_0xedcbd5[_0xc21c('0x2f')](db[_0xc21c('0x55')][_0xc21c('0x56')](_0x100d16(_0x57d1ee,_0xc21c('0x57')))[_0xc21c('0x52')](function(){})[_0xc21c('0x30')](_0x385106()));break;case _0xc21c('0x58'):_0xedcbd5[_0xc21c('0x2f')](db['sequelize'][_0xc21c('0x56')](_0x17374a(_0x57d1ee,'VoiceQueueId'))[_0xc21c('0x52')](function(){})['catch'](_0x385106()));break;default:_0xedcbd5[_0xc21c('0x2f')](db[_0xc21c('0x55')][_0xc21c('0x56')](_0x3a723c(_0x57d1ee,_0xc21c('0x57')))[_0xc21c('0x52')](function(){})[_0xc21c('0x30')](_0x385106()));}}}return _0xedcbd5;})[_0xc21c('0x59')]()[_0xc21c('0x52')](function(){return db[_0xc21c('0x4d')][_0xc21c('0x4e')]({'where':{'type':_0xc21c('0x4f')},'attributes':['id'],'include':[{'model':db[_0xc21c('0x51')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xc21c('0x52')](function(_0x349905){var _0x44a4c9=[];if(_0x349905){var _0x25f8f0;for(var _0x3afc93=0x0,_0x446668;_0x3afc93<_0x349905[_0xc21c('0x1b')];_0x3afc93+=0x1){_0x446668=_0x349905[_0x3afc93]['get']({'plain':!![]});_0x44a4c9[_0xc21c('0x2f')](db[_0xc21c('0x55')][_0xc21c('0x56')](_0x222f63(_0x446668,_0xc21c('0x57')))['then'](function(){})[_0xc21c('0x30')](_0x385106()));}}return _0x44a4c9;})['all']();})[_0xc21c('0x52')](function(){return db[_0xc21c('0x5a')][_0xc21c('0x4e')]({'attributes':['id',_0xc21c('0x50')],'include':[{'model':db[_0xc21c('0x51')],'as':_0xc21c('0x5b'),'where':{'id':LISTID}}]})[_0xc21c('0x52')](function(_0x406674){var _0x5897d7=[];if(_0x406674){for(var _0x395a68=0x0,_0x384a44;_0x395a68<_0x406674[_0xc21c('0x1b')];_0x395a68+=0x1){_0x384a44=_0x406674[_0x395a68][_0xc21c('0x53')]({'plain':!![]});switch(_0x384a44['dialCheckDuplicateType']){case'always':_0x5897d7['push'](db[_0xc21c('0x55')][_0xc21c('0x56')](_0x100d16(_0x384a44,_0xc21c('0x5c')))['then'](function(){})['catch'](_0x385106()));break;case _0xc21c('0x58'):_0x5897d7['push'](db['sequelize']['query'](_0x17374a(_0x384a44,_0xc21c('0x5c')))[_0xc21c('0x52')](function(){})[_0xc21c('0x30')](_0x385106()));break;default:_0x5897d7['push'](db[_0xc21c('0x55')][_0xc21c('0x56')](_0x3a723c(_0x384a44,'CampaignId'))['then'](function(){})[_0xc21c('0x30')](_0x385106()));}}}return _0x5897d7;})[_0xc21c('0x59')]();})[_0xc21c('0x52')](function(){return db[_0xc21c('0x5a')][_0xc21c('0x4e')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xc21c('0x5d'),'where':{'id':LISTID}}]})[_0xc21c('0x52')](function(_0x414c24){var _0x1a2285=[];if(_0x414c24){for(var _0x34f968=0x0,_0xf55d28;_0x34f968<_0x414c24[_0xc21c('0x1b')];_0x34f968+=0x1){_0xf55d28=_0x414c24[_0x34f968][_0xc21c('0x53')]({'plain':!![]});_0x1a2285['push'](db[_0xc21c('0x55')]['query'](_0x222f63(_0xf55d28,_0xc21c('0x5c')))[_0xc21c('0x52')](function(){})[_0xc21c('0x30')](_0x385106()));}}return _0x1a2285;})[_0xc21c('0x59')]();})[_0xc21c('0x30')](function(_0x2c09b3){logger[_0xc21c('0x15')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x2c09b3[_0xc21c('0x1d')]);});}var processPromises=function(_0x50a5cd){return BPromise[_0xc21c('0x59')](promises)[_0xc21c('0x52')](function(_0x1d0ebc){})[_0xc21c('0x30')](function(_0x5c47d7){logger[_0xc21c('0x15')](_0xc21c('0x5e'),JSON['stringify'](_0x5c47d7));})[_0xc21c('0x5f')](function(){socket[_0xc21c('0x60')](_0xc21c('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x50a5cd){return _0x50a5cd[_0xc21c('0x62')]();}});};var endCsv=function(){return BPromise['resolve']()[_0xc21c('0x52')](function(){if(hopperContacts){return checkHopper();}})[_0xc21c('0x52')](function(){socket['emit'](_0xc21c('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x510aac){logger[_0xc21c('0x15')](_0xc21c('0x63'),JSON['stringify'](_0x510aac));}finally{process[_0xc21c('0x64')](0x0);}});};process['on'](_0xc21c('0x65'),function(){logger[_0xc21c('0x66')](_0xc21c('0x67'));endCsv();});function main(){return BPromise[_0xc21c('0x68')]()[_0xc21c('0x52')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xc21c('0x69')][_0xc21c('0x4e')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xc21c('0x52')](function(_0xe2316b){var _0x1ba2b7=fs[_0xc21c('0x6a')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xc21c('0x6b')](_0x1ba2b7,{'header':!![],'skipEmptyLines':!![],'step':function(_0x32af9c,_0x32f4b8){total+=0x1;var _0x5da067=total;promises[_0xc21c('0x2f')](checkRow(_0x32af9c,_0xe2316b,_0x5da067)['then'](function(){success+=0x1;})[_0xc21c('0x30')](function(_0x2eaa55){if(_0x2eaa55[_0xc21c('0x15')]){errors+=0x1;delete _0x2eaa55['error'];}else if(_0x2eaa55[_0xc21c('0x2b')]){duplicates+=0x1;delete _0x2eaa55[_0xc21c('0x2b')];}rows[_0xc21c('0x2f')](_0x2eaa55);}));if(total%0xc8===0x0){_0x32f4b8[_0xc21c('0x6c')]();return processPromises(_0x32f4b8);}},'complete':function(){return processPromises()[_0xc21c('0x52')](function(){logger[_0xc21c('0x66')](_0xc21c('0x6d'));endCsv();});},'error':function(_0x527b16,_0x1551ab){logger[_0xc21c('0x66')](_0xc21c('0x6e'),JSON['stringify'](_0x527b16));endCsv();}});})[_0xc21c('0x30')](function(_0x4ff632){logger[_0xc21c('0x15')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xc21c('0x6f')](_0x4ff632));});}main(); \ No newline at end of file +var _0xdd8b=['updatedAt','field','phone','toString','NOW()','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','from','cm_hopper','into','fromQuery','str','calleridnum','\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','cm_hopper_black','VoiceQueue','outbound','dialCheckDuplicateType','Lists','get','sequelize','query','catch','VoiceQueueId','all','findAll','CmList','Campaign','always','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resolve','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','parse','duplicate','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','data','firstName','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','CmContact','then','push','pick','message','stringify','cmContact','checkHopper','inspect','insert','scheduledAt','ContactId','createdAt'];(function(_0x514f00,_0x130b31){var _0x1d2624=function(_0x2c3376){while(--_0x2c3376){_0x514f00['push'](_0x514f00['shift']());}};_0x1d2624(++_0x130b31);}(_0xdd8b,0x1e0));var _0xbdd8=function(_0xea35d1,_0x302471){_0xea35d1=_0xea35d1-0x0;var _0x1d7a7c=_0xdd8b[_0xea35d1];return _0x1d7a7c;};'use strict';var BPromise=require(_0xbdd8('0x0'));var util=require(_0xbdd8('0x1'));var _=require(_0xbdd8('0x2'));var fs=require('fs');var squel=require(_0xbdd8('0x3'));var Papa=require(_0xbdd8('0x4'));var Redis=require('ioredis');var db=require(_0xbdd8('0x5'))['db'];var config=require(_0xbdd8('0x6'));var logger=require(_0xbdd8('0x7'))(_0xbdd8('0x8'));config[_0xbdd8('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbdd8('0xa'))(new Redis(config[_0xbdd8('0x9')]));require(_0xbdd8('0xb'))[_0xbdd8('0xc')](socket);try{if(!process[_0xbdd8('0xd')][0x2]||process[_0xbdd8('0xd')][0x2]===_0xbdd8('0xe')||process[_0xbdd8('0xd')][0x2]===_0xbdd8('0xf')){throw new Error(_0xbdd8('0x10'));}var FILEPATH=process[_0xbdd8('0xd')][0x2];if(!process[_0xbdd8('0xd')][0x3]||process[_0xbdd8('0xd')][0x3]===_0xbdd8('0xe')||process[_0xbdd8('0xd')][0x3]===_0xbdd8('0xf')||!process['argv'][0x4]||process[_0xbdd8('0xd')][0x4]===_0xbdd8('0xe')||process[_0xbdd8('0xd')][0x4]===_0xbdd8('0xf')){throw new Error(_0xbdd8('0x11'));}var FIELDS=_[_0xbdd8('0x12')](process[_0xbdd8('0xd')][0x3][_0xbdd8('0x13')](','),process[_0xbdd8('0xd')][0x4][_0xbdd8('0x13')](','));if(!process[_0xbdd8('0xd')][0x5]||process['argv'][0x5]===_0xbdd8('0xe')||process[_0xbdd8('0xd')][0x5]===_0xbdd8('0xf')){throw new Error(_0xbdd8('0x14'));}var LISTID=process[_0xbdd8('0xd')][0x5];var COMPANYID=process[_0xbdd8('0xd')][0x6]&&process['argv'][0x6]!==_0xbdd8('0xe')&&process[_0xbdd8('0xd')][0x6]!==_0xbdd8('0xf')?process[_0xbdd8('0xd')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process['argv'][0x7]!==_0xbdd8('0xe')&&process[_0xbdd8('0xd')][0x7]!==_0xbdd8('0xf')?process['argv'][0x7]:null;if(!process[_0xbdd8('0xd')][0x8]||process['argv'][0x8]===_0xbdd8('0xe')||process[_0xbdd8('0xd')][0x8]===_0xbdd8('0xf')){throw new Error(_0xbdd8('0x15'));}var SOCKET_TIMESTAMP=process[_0xbdd8('0xd')][0x8];}catch(_0x18a7ca){logger[_0xbdd8('0x16')](_0x18a7ca);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(_0x4ddc2d,_0x38f77e,_0x29bd50,_0x42ffae){var _0x106ec0={'message':_0x38f77e};_0x106ec0[_0x4ddc2d]=!![];if(_0x29bd50){_0x106ec0[_0xbdd8('0x17')]=_0x29bd50;}if(_0x42ffae){_0x106ec0['index']=_0x42ffae;}return _0x106ec0;}function isEmail(_0x124b92){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))*$/[_0xbdd8('0x18')](_0x124b92);}function checkRow(_0x948828,_0x57d717,_0x507e83){return new BPromise(function(_0x43a5fa,_0x46f4f6){if(_[_0xbdd8('0x19')](_0x948828)){return _0x46f4f6(handleCheckRowError('error',_0xbdd8('0x1a'),null,_0x507e83));}if(_0x948828[_0xbdd8('0x1b')]&&_0x948828[_0xbdd8('0x1b')][_0xbdd8('0x1c')]){var _0x102c24=_[_0xbdd8('0x1d')](_0x948828[_0xbdd8('0x1b')],'message')[_0xbdd8('0x1e')](';');return _0x46f4f6(handleCheckRowError(_0xbdd8('0x16'),_0x102c24,null,_0x507e83));}var _0xdf50fb={};for(var _0x1803bb in FIELDS){if(FIELDS['hasOwnProperty'](_0x1803bb)&&FIELDS[_0x1803bb]){_0xdf50fb[_0x1803bb]=_0x948828[_0xbdd8('0x1f')][0x0][FIELDS[_0x1803bb]]||_0x948828[_0xbdd8('0x1f')][0x0]['\ufeff'+FIELDS[_0x1803bb]];}}if(!_0xdf50fb[_0xbdd8('0x20')]){return _0x46f4f6(handleCheckRowError(_0xbdd8('0x16'),'firstName\x20not\x20specified!',null,_0x507e83));}if(!_0xdf50fb['phone']){return _0x46f4f6(handleCheckRowError(_0xbdd8('0x16'),'phone\x20not\x20specified!',null,_0x507e83));}if(_0xdf50fb['birthDate']){var _0x4c3b80=moment(_0xdf50fb[_0xbdd8('0x21')],_0xbdd8('0x22'));if(!_0x4c3b80['isValid']()){return _0x46f4f6(handleCheckRowError(_0xbdd8('0x16'),_0xbdd8('0x23'),null,_0x507e83));}}if(_0xdf50fb['email']){if(!isEmail(_0xdf50fb[_0xbdd8('0x24')])){return _0x46f4f6(handleCheckRowError(_0xbdd8('0x16'),_0xbdd8('0x25'),null,_0x507e83));}}_0xdf50fb[_0xbdd8('0x26')]=LISTID;_0xdf50fb[_0xbdd8('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x57d717){var _0x349a01={};for(var _0x9bd03=0x0,_0x117e1d=DUPLICATES['length'];_0x9bd03<_0x117e1d;_0x9bd03+=0x1){_0x349a01[DUPLICATES[_0x9bd03]]=_0xdf50fb[DUPLICATES[_0x9bd03]];}var _0x40ac43=_[_0xbdd8('0x28')](_0x57d717,_0x349a01);if(_0x40ac43){return _0x46f4f6(handleCheckRowError('duplicate',_0xbdd8('0x29'),_0x40ac43,_0x507e83));}}return db[_0xbdd8('0x2a')]['create'](_0xdf50fb,{'raw':!![],'hooks':![],'fields':_['keys'](_0xdf50fb)})[_0xbdd8('0x2b')](function(_0x3e513b){if(DUPLICATES&&DUPLICATES[_0xbdd8('0x1c')]&&_0x57d717){_0x57d717[_0xbdd8('0x2c')](_[_0xbdd8('0x2d')](_0xdf50fb,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3e513b['id'];return _0x43a5fa();})['catch'](function(_0x23003e){return _0x46f4f6(handleCheckRowError(_0xbdd8('0x16'),'Error\x20while\x20creating\x20contact:\x20'+(_0x23003e[_0xbdd8('0x2e')]||JSON[_0xbdd8('0x2f')](_0x23003e)),null,_0x507e83));});});}function checkHopper(){function _0x568a23(){return function(_0x3d4e50){logger[_0xbdd8('0x16')](_0xbdd8('0x30'),_0xbdd8('0x31'),util[_0xbdd8('0x32')](_0x3d4e50,{'showHidden':![],'depth':null}));};}var _0x47fd7e=function(_0x7b2361,_0x5e657a){var _0x4e0c29=squel[_0xbdd8('0x33')]()['into']('cm_hopper')['fromQuery'](['phone',_0xbdd8('0x34'),_0xbdd8('0x35'),_0xbdd8('0x26'),_0x5e657a,_0xbdd8('0x36'),_0xbdd8('0x37')],squel['select']()[_0xbdd8('0x38')](_0xbdd8('0x39'),_0xbdd8('0x39'))[_0xbdd8('0x38')]('NOW()','scheduledAt')[_0xbdd8('0x38')]('id',_0xbdd8('0x35'))['field'](LISTID[_0xbdd8('0x3a')](),_0xbdd8('0x26'))['field'](_0x7b2361['id'][_0xbdd8('0x3a')](),_0x5e657a)[_0xbdd8('0x38')](_0xbdd8('0x3b'),_0xbdd8('0x36'))[_0xbdd8('0x38')]('NOW()',_0xbdd8('0x37'))['from'](_0xbdd8('0x3c'))[_0xbdd8('0x3d')]('deletedAt\x20IS\x20NULL')[_0xbdd8('0x3d')](_0xbdd8('0x3e'),LISTID[_0xbdd8('0x3a')]())[_0xbdd8('0x3d')](_0xbdd8('0x3f'))[_0xbdd8('0x3d')](_0xbdd8('0x40'),squel[_0xbdd8('0x41')]()['field'](_0xbdd8('0x39'))[_0xbdd8('0x42')](_0xbdd8('0x43'))[_0xbdd8('0x3d')](_0x5e657a+'\x20=\x20?',_0x7b2361['id']['toString']())))[_0xbdd8('0x3a')]();return _0x4e0c29;};var _0x3671ce=function(_0x155782,_0x5b6520){var _0x240123=squel[_0xbdd8('0x33')]()[_0xbdd8('0x44')](_0xbdd8('0x43'))[_0xbdd8('0x45')]([_0xbdd8('0x39'),'scheduledAt',_0xbdd8('0x35'),'ListId',_0x5b6520,_0xbdd8('0x36'),_0xbdd8('0x37')],squel[_0xbdd8('0x41')]()[_0xbdd8('0x38')](_0xbdd8('0x39'),'phone')[_0xbdd8('0x38')](_0xbdd8('0x3b'),'scheduledAt')['field']('id',_0xbdd8('0x35'))[_0xbdd8('0x38')](LISTID[_0xbdd8('0x3a')](),_0xbdd8('0x26'))[_0xbdd8('0x38')](_0x155782['id'][_0xbdd8('0x3a')](),_0x5b6520)[_0xbdd8('0x38')](_0xbdd8('0x3b'),_0xbdd8('0x36'))[_0xbdd8('0x38')](_0xbdd8('0x3b'),_0xbdd8('0x37'))[_0xbdd8('0x42')](_0xbdd8('0x3c'))[_0xbdd8('0x3d')]('deletedAt\x20IS\x20NULL')[_0xbdd8('0x3d')]('ListId\x20=\x20?',LISTID[_0xbdd8('0x3a')]())[_0xbdd8('0x3d')]('id\x20IN\x20?',squel[_0xbdd8('0x46')](hopperContacts))[_0xbdd8('0x3d')]('phone\x20IS\x20NOT\x20NULL')[_0xbdd8('0x3d')](_0xbdd8('0x40'),squel['select']()['field'](_0xbdd8('0x47'))['from']('cm_hopper_final')[_0xbdd8('0x3d')](_0x5b6520+_0xbdd8('0x48'),_0x155782['id'][_0xbdd8('0x3a')]()))[_0xbdd8('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xbdd8('0x39'))['from'](_0xbdd8('0x43'))['where'](_0x5b6520+_0xbdd8('0x48'),_0x155782['id']['toString']())))[_0xbdd8('0x3a')]();return _0x240123;};function _0x30d37d(_0x2453ce,_0x2b5bf3){var _0x27eaec=squel[_0xbdd8('0x33')]()[_0xbdd8('0x44')](_0xbdd8('0x43'))[_0xbdd8('0x45')](['phone','scheduledAt','ContactId',_0xbdd8('0x26'),_0x2b5bf3,_0xbdd8('0x36'),'updatedAt'],squel['select']()['field']('phone',_0xbdd8('0x39'))[_0xbdd8('0x38')](_0xbdd8('0x3b'),'scheduledAt')[_0xbdd8('0x38')]('id',_0xbdd8('0x35'))[_0xbdd8('0x38')](LISTID[_0xbdd8('0x3a')](),_0xbdd8('0x26'))[_0xbdd8('0x38')](_0x2453ce['id'][_0xbdd8('0x3a')](),_0x2b5bf3)[_0xbdd8('0x38')](_0xbdd8('0x3b'),_0xbdd8('0x36'))[_0xbdd8('0x38')](_0xbdd8('0x3b'),'updatedAt')['from'](_0xbdd8('0x3c'))['where'](_0xbdd8('0x49'))[_0xbdd8('0x3d')]('ListId\x20=\x20?',LISTID['toString']())['where'](_0xbdd8('0x4a'),squel[_0xbdd8('0x46')](hopperContacts))[_0xbdd8('0x3d')](_0xbdd8('0x3f')))[_0xbdd8('0x3a')]();return _0x27eaec;}function _0x5a2c7f(_0x58c92b,_0x30cb80){var _0x2db39c=squel[_0xbdd8('0x33')]()[_0xbdd8('0x44')](_0xbdd8('0x4b'))[_0xbdd8('0x45')](['phone',_0xbdd8('0x35'),'ListId',_0x30cb80,'createdAt',_0xbdd8('0x37')],squel[_0xbdd8('0x41')]()[_0xbdd8('0x38')]('phone',_0xbdd8('0x39'))[_0xbdd8('0x38')]('id',_0xbdd8('0x35'))[_0xbdd8('0x38')](LISTID[_0xbdd8('0x3a')](),_0xbdd8('0x26'))[_0xbdd8('0x38')](_0x58c92b['id']['toString'](),_0x30cb80)[_0xbdd8('0x38')](_0xbdd8('0x3b'),_0xbdd8('0x36'))[_0xbdd8('0x38')]('NOW()','updatedAt')[_0xbdd8('0x42')](_0xbdd8('0x3c'))[_0xbdd8('0x3d')](_0xbdd8('0x49'))[_0xbdd8('0x3d')](_0xbdd8('0x3e'),LISTID[_0xbdd8('0x3a')]())[_0xbdd8('0x3d')](_0xbdd8('0x4a'),squel[_0xbdd8('0x46')](hopperContacts))[_0xbdd8('0x3d')](_0xbdd8('0x3f')))[_0xbdd8('0x3a')]();return _0x2db39c;}return db[_0xbdd8('0x4c')]['findAll']({'where':{'type':_0xbdd8('0x4d')},'attributes':['id',_0xbdd8('0x4e')],'include':[{'model':db['CmList'],'as':_0xbdd8('0x4f'),'where':{'id':LISTID}}]})[_0xbdd8('0x2b')](function(_0x5375c0){var _0x94a23d=[];if(_0x5375c0){var _0x55c9a4;for(var _0x4ee987=0x0,_0x353558;_0x4ee987<_0x5375c0[_0xbdd8('0x1c')];_0x4ee987+=0x1){_0x353558=_0x5375c0[_0x4ee987][_0xbdd8('0x50')]({'plain':!![]});switch(_0x353558[_0xbdd8('0x4e')]){case'always':_0x94a23d[_0xbdd8('0x2c')](db[_0xbdd8('0x51')][_0xbdd8('0x52')](_0x3671ce(_0x353558,'VoiceQueueId'))[_0xbdd8('0x2b')](function(){})[_0xbdd8('0x53')](_0x568a23()));break;case'onlyIfOpen':_0x94a23d[_0xbdd8('0x2c')](db[_0xbdd8('0x51')]['query'](_0x47fd7e(_0x353558,_0xbdd8('0x54')))[_0xbdd8('0x2b')](function(){})[_0xbdd8('0x53')](_0x568a23()));break;default:_0x94a23d[_0xbdd8('0x2c')](db['sequelize']['query'](_0x30d37d(_0x353558,_0xbdd8('0x54')))[_0xbdd8('0x2b')](function(){})[_0xbdd8('0x53')](_0x568a23()));}}}return _0x94a23d;})[_0xbdd8('0x55')]()[_0xbdd8('0x2b')](function(){return db['VoiceQueue'][_0xbdd8('0x56')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xbdd8('0x57')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xbdd8('0x2b')](function(_0x3888be){var _0x1b1651=[];if(_0x3888be){var _0x2276fe;for(var _0x1cd369=0x0,_0x43ed6e;_0x1cd369<_0x3888be[_0xbdd8('0x1c')];_0x1cd369+=0x1){_0x43ed6e=_0x3888be[_0x1cd369][_0xbdd8('0x50')]({'plain':!![]});_0x1b1651[_0xbdd8('0x2c')](db[_0xbdd8('0x51')][_0xbdd8('0x52')](_0x5a2c7f(_0x43ed6e,'VoiceQueueId'))[_0xbdd8('0x2b')](function(){})[_0xbdd8('0x53')](_0x568a23()));}}return _0x1b1651;})[_0xbdd8('0x55')]();})['then'](function(){return db[_0xbdd8('0x58')]['findAll']({'attributes':['id',_0xbdd8('0x4e')],'include':[{'model':db[_0xbdd8('0x57')],'as':_0xbdd8('0x4f'),'where':{'id':LISTID}}]})[_0xbdd8('0x2b')](function(_0x540e79){var _0xe6ea6b=[];if(_0x540e79){for(var _0x312066=0x0,_0x1071fc;_0x312066<_0x540e79[_0xbdd8('0x1c')];_0x312066+=0x1){_0x1071fc=_0x540e79[_0x312066][_0xbdd8('0x50')]({'plain':!![]});switch(_0x1071fc['dialCheckDuplicateType']){case _0xbdd8('0x59'):_0xe6ea6b[_0xbdd8('0x2c')](db['sequelize'][_0xbdd8('0x52')](_0x3671ce(_0x1071fc,_0xbdd8('0x5a')))[_0xbdd8('0x2b')](function(){})[_0xbdd8('0x53')](_0x568a23()));break;case _0xbdd8('0x5b'):_0xe6ea6b['push'](db[_0xbdd8('0x51')]['query'](_0x47fd7e(_0x1071fc,_0xbdd8('0x5a')))['then'](function(){})[_0xbdd8('0x53')](_0x568a23()));break;default:_0xe6ea6b[_0xbdd8('0x2c')](db['sequelize']['query'](_0x30d37d(_0x1071fc,'CampaignId'))[_0xbdd8('0x2b')](function(){})[_0xbdd8('0x53')](_0x568a23()));}}}return _0xe6ea6b;})['all']();})[_0xbdd8('0x2b')](function(){return db['Campaign'][_0xbdd8('0x56')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x381881){var _0x2e8fbf=[];if(_0x381881){for(var _0x3f17ac=0x0,_0x4365d7;_0x3f17ac<_0x381881[_0xbdd8('0x1c')];_0x3f17ac+=0x1){_0x4365d7=_0x381881[_0x3f17ac][_0xbdd8('0x50')]({'plain':!![]});_0x2e8fbf[_0xbdd8('0x2c')](db['sequelize'][_0xbdd8('0x52')](_0x5a2c7f(_0x4365d7,_0xbdd8('0x5a')))[_0xbdd8('0x2b')](function(){})[_0xbdd8('0x53')](_0x568a23()));}}return _0x2e8fbf;})[_0xbdd8('0x55')]();})[_0xbdd8('0x53')](function(_0x2dbbe4){logger[_0xbdd8('0x16')](_0xbdd8('0x5c'),'generalCheckHopper',_0x2dbbe4[_0xbdd8('0x2e')]);});}var processPromises=function(_0x3415c6){return BPromise[_0xbdd8('0x55')](promises)[_0xbdd8('0x2b')](function(_0x190cb5){})[_0xbdd8('0x53')](function(_0x57f72c){logger[_0xbdd8('0x16')](_0xbdd8('0x5d'),JSON[_0xbdd8('0x2f')](_0x57f72c));})['finally'](function(){socket[_0xbdd8('0x5e')](_0xbdd8('0x5f')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x3415c6){return _0x3415c6['resume']();}});};var endCsv=function(){return BPromise[_0xbdd8('0x60')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xbdd8('0x2b')](function(){socket[_0xbdd8('0x5e')](_0xbdd8('0x5f')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0xb98ef6){logger[_0xbdd8('0x16')](_0xbdd8('0x61'),JSON[_0xbdd8('0x2f')](_0xb98ef6));}finally{process[_0xbdd8('0x62')](0x0);}});};process['on'](_0xbdd8('0x63'),function(){logger[_0xbdd8('0x64')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xbdd8('0x60')]()[_0xbdd8('0x2b')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xbdd8('0x13')](',');return db[_0xbdd8('0x2a')][_0xbdd8('0x56')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xbdd8('0x2b')](function(_0x385b5e){var _0x30f29f=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xbdd8('0x65')](_0x30f29f,{'header':!![],'skipEmptyLines':!![],'step':function(_0x53cce6,_0x16d910){total+=0x1;var _0x557eda=total;promises[_0xbdd8('0x2c')](checkRow(_0x53cce6,_0x385b5e,_0x557eda)['then'](function(){success+=0x1;})[_0xbdd8('0x53')](function(_0x1845d8){if(_0x1845d8[_0xbdd8('0x16')]){errors+=0x1;delete _0x1845d8['error'];}else if(_0x1845d8[_0xbdd8('0x66')]){duplicates+=0x1;delete _0x1845d8[_0xbdd8('0x66')];}rows[_0xbdd8('0x2c')](_0x1845d8);}));if(total%0xc8===0x0){_0x16d910[_0xbdd8('0x67')]();return processPromises(_0x16d910);}},'complete':function(){return processPromises()[_0xbdd8('0x2b')](function(){logger['info'](_0xbdd8('0x68'));endCsv();});},'error':function(_0x1dec8d,_0x486555){logger['info'](_0xbdd8('0x69'),JSON['stringify'](_0x1dec8d));endCsv();}});})[_0xbdd8('0x53')](function(_0x50bed6){logger[_0xbdd8('0x16')](_0xbdd8('0x6a'),JSON[_0xbdd8('0x2f')](_0x50bed6));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 2344451..d3f249c 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 _0x35e5=['complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','CmContact','findAll','AdditionalPhones','then','length','push','all','split','isNil','filter','CmContactHasItem','update','updated','PHONE','cm_contacts.scheduledat','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.phone','cm_contacts.ListId','createdAt','.CmListId','cm_contacts.createdAt\x20=\x20?','field','cm_hopper_black','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','\x22always\x22','cm_contacts.id','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','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','info','error','exit','errors','code','message','sequelize','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','query','voice_queues.id','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','set','offset','dialTimezone','stringify','send','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','includes','header','ContactItemType','name','_description','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','replace','isValid','isNaN','isNumber','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','firstName','\x20not\x20specified','itemTypeId','description','SystemRow','emit','contact:import:','abort','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','orderBy','voice_queues_has_cm_lists','VoiceQueueId','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink'];(function(_0x4624dc,_0x2d47e2){var _0x230719=function(_0x32cbba){while(--_0x32cbba){_0x4624dc['push'](_0x4624dc['shift']());}};_0x230719(++_0x2d47e2);}(_0x35e5,0xc4));var _0x535e=function(_0x7d8149,_0x494283){_0x7d8149=_0x7d8149-0x0;var _0x6a8e5e=_0x35e5[_0x7d8149];return _0x6a8e5e;};'use strict';var fs=require('fs');var path=require(_0x535e('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require(_0x535e('0x1'));var BPromise=require(_0x535e('0x2'));var moment=require(_0x535e('0x3'));var squel=require(_0x535e('0x4'));var Redis=require(_0x535e('0x5'));var db=require(_0x535e('0x6'))['db'];var config=require(_0x535e('0x7'));var shared=require(_0x535e('0x8'));var logger=require(_0x535e('0x9'))(_0x535e('0xa'));config[_0x535e('0xb')]=_[_0x535e('0xc')](config[_0x535e('0xb')],{'host':_0x535e('0xd'),'port':0x18eb});var socket=require(_0x535e('0xe'))(new Redis(config[_0x535e('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x535e('0xf')](_0x535e('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x535e('0x10'));function isEmail(_0x125d38){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))*$/[_0x535e('0x11')](_0x125d38);}function selectNotIn(_0x2f6dae,_0x12970e,_0x568930,_0x4d25e4,_0x427b92){return squel[_0x535e('0x12')]()['field'](_0x535e('0x13'))[_0x535e('0x14')](_0x4d25e4)['join'](_0x12970e,null,_0x12970e+_0x535e('0x15')+_0x4d25e4+'.'+_0x568930)[_0x535e('0x16')](_0x4d25e4+'.'+_0x568930+_0x535e('0x17')+_0x2f6dae+'.'+_0x568930)['where'](_0x12970e+_0x535e('0x18')+_0x427b92[_0x535e('0x19')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x25afaf,_0x385bba){promisesAdditionalPhones=[];return db[_0x535e('0x1a')][_0x535e('0x1b')]({'raw':!![],'attributes':['id',_0x535e('0x1c')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x535e('0x1d')](function(_0x5addaf){if(_0x5addaf!==null){var _0x4d8073=[];for(var _0x106c20=0x0;_0x106c20<_0x5addaf[_0x535e('0x1e')];_0x106c20++){var _0x22c5fd=_0x5addaf[_0x106c20];_0x4d8073[_0x535e('0x1f')](insertAdditionalPhones(_0x22c5fd));}}Promise[_0x535e('0x20')](_0x4d8073)[_0x535e('0x1d')](function(){_0x25afaf({'val':0x1});});});});}function insertAdditionalPhones(_0x1969cf){return new Promise(function(_0x5ce841,_0x3eed3e){var _0x39d46e=_0x1969cf['AdditionalPhones'];var _0x318d51=_0x39d46e[_0x535e('0x21')](';');var _0x44c663=[];orderBy=0x0;for(var _0x44554d=0x0;_0x44554d<_0x318d51[_0x535e('0x1e')];_0x44554d++){_0x44c663[_0x535e('0x1f')](splitAdditionalPhone(_0x1969cf['id'],_0x318d51[_0x44554d]));}Promise[_0x535e('0x20')](_0x44c663)[_0x535e('0x1d')](function(){_0x5ce841({'val':_0x318d51['length']});});});}function splitAdditionalPhone(_0xd6133,_0x3b70c5){return new Promise(function(_0x5ae559,_0x517070){var _0x27d787=_0x3b70c5['split'](':');var _0x11b7b8=_0x27d787[0x0];var _0x59358f=_0x27d787[0x1];if(!_[_0x535e('0x22')](_0x59358f)){var _0x5a16c8=_0x59358f['split']('|');var _0x957799=[];for(var _0xb16a07=0x0;_0xb16a07<_0x5a16c8[_0x535e('0x1e')];_0xb16a07++){if(_0x5a16c8[_0xb16a07]!==''){var _0x3c27da=_[_0x535e('0x23')](promisesAdditionalPhones,{'contactId':_0xd6133,'phone':_0x5a16c8[_0xb16a07]});if(_0x3c27da[_0x535e('0x1e')]==0x0){orderBy++;promisesAdditionalPhones[_0x535e('0x1f')]({'contactId':_0xd6133,'contactTypeId':_0x11b7b8,'phone':_0x5a16c8[_0xb16a07],'orderBy':orderBy});}}}_0x5ae559({'ok':0x1});}else _0x5ae559({'res':0x0});});}function createAdditionalPhone(_0x4fa84a,_0x5a5231,_0x34116c,_0x357765){var _0x4e3b19='';var _0xf18b9b='';var _0x38f70b=_0x34116c[_0x535e('0x21')]('§');_0x4e3b19=_0x38f70b[0x0];if(_0x38f70b[_0x535e('0x1e')]==0x2)_0xf18b9b=_0x38f70b[0x1];return new Promise(function(_0x50e5eb,_0x3ba58c){return db[_0x535e('0x24')]['findOne']({'where':{'CmContactId':_0x4fa84a,'item':_0x4e3b19}})[_0x535e('0x1d')](function(_0x5d093a){if(_0x5d093a){return db['CmContactHasItem'][_0x535e('0x25')]({'ItemTypeId':_0x5a5231,'description':_0xf18b9b,'OrderBy':_0x357765},{'where':{'CmContactId':_0x4fa84a,'item':_0x4e3b19}})[_0x535e('0x1d')](function(_0x20258b){_0x50e5eb({'res':_0x535e('0x26')});});}else{return db[_0x535e('0x24')]['create']({'CmContactId':_0x4fa84a,'item':_0x4e3b19,'description':_0xf18b9b,'ItemTypeId':_0x5a5231,'OrderBy':_0x357765,'ItemClass':_0x535e('0x27')})[_0x535e('0x1d')](function(_0x42e343){_0x50e5eb({'res':'inserted'});});}});});}function insertCmHopper(_0x513dcb,_0x41cd67,_0x4b5b00,_0x116109,_0x2e8fa8){var _0x3c1e12=['cm_contacts.phone',_0x535e('0x28'),'cm_contacts.id','cm_contacts.ListId',_0x41cd67+'.'+_0x116109,_0x535e('0x29'),_0x535e('0x2a'),_0x535e('0x2b'),_0x535e('0x2c'),'\x22'+_0x2e8fa8+'\x22'];return squel[_0x535e('0x2d')]()[_0x535e('0x2e')](_0x535e('0x2f'))[_0x535e('0x30')]([_0x535e('0x13'),_0x535e('0x31'),_0x535e('0x32'),_0x535e('0x33'),_0x116109,'createdAt',_0x535e('0x34'),_0x535e('0x35'),_0x535e('0x36'),_0x535e('0x37')],squel['select']()[_0x535e('0x38')](_0x3c1e12)['from'](_0x41cd67)['join'](_0x535e('0x39'),null,_0x535e('0x3a')+_0x41cd67+'.CmListId')[_0x535e('0x19')](_0x4b5b00,null,_0x4b5b00+_0x535e('0x15')+_0x41cd67+'.'+_0x116109)[_0x535e('0x16')](_0x41cd67+_0x535e('0x3b'),_0x513dcb)[_0x535e('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x535e('0x16')](_0x535e('0x3c'),selectNotIn(_0x41cd67,_0x4b5b00,_0x116109,_0x535e('0x2f'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0x535e('0x16')](_0x535e('0x3c'),selectNotIn(_0x41cd67,_0x4b5b00,_0x116109,_0x535e('0x2f'),['\x22always\x22'])))[_0x535e('0x3d')]();}function insertCmHopperBlack(_0x3c6ac2,_0x48dd36,_0x3d5bae,_0x4964b6){var _0x3753bd=[_0x535e('0x3e'),'cm_contacts.id',_0x535e('0x3f'),_0x48dd36+'.'+_0x4964b6,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x535e('0x2d')]()[_0x535e('0x2e')]('cm_hopper_black')[_0x535e('0x30')](['phone',_0x535e('0x32'),'ListId',_0x4964b6,_0x535e('0x40'),_0x535e('0x34')],squel['select']()[_0x535e('0x38')](_0x3753bd)[_0x535e('0x14')](_0x48dd36)[_0x535e('0x19')]('cm_contacts',null,_0x535e('0x3a')+_0x48dd36+_0x535e('0x41'))[_0x535e('0x19')](_0x3d5bae,null,_0x3d5bae+_0x535e('0x15')+_0x48dd36+'.'+_0x4964b6)[_0x535e('0x16')](_0x48dd36+_0x535e('0x3b'),_0x3c6ac2)[_0x535e('0x16')](_0x535e('0x42'),NOW)[_0x535e('0x16')](_0x535e('0x3c'),squel[_0x535e('0x12')]()[_0x535e('0x43')](_0x535e('0x13'))[_0x535e('0x14')](_0x535e('0x44'))[_0x535e('0x16')](_0x535e('0x45'),_0x3c6ac2)[_0x535e('0x16')](_0x4964b6+_0x535e('0x17')+_0x48dd36+'.'+_0x4964b6)))[_0x535e('0x3d')]();}function insertTzCmHopper(_0x1433f8,_0x3e4b45,_0x302042,_0x32bdde,_0x196481,_0x816213){var _0x47a563=[_0x535e('0x3e'),_0x535e('0x46')+_0x816213+_0x535e('0x47'),'cm_contacts.id','cm_contacts.ListId',_0x3e4b45+'.'+_0x32bdde,_0x535e('0x29'),_0x535e('0x2a'),_0x535e('0x2b'),'cm_contacts.UserId','\x22'+_0x196481+'\x22'];var _0x5b2467=squel[_0x535e('0x2d')]()[_0x535e('0x2e')](_0x535e('0x2f'))[_0x535e('0x30')]([_0x535e('0x13'),'scheduledat',_0x535e('0x32'),_0x535e('0x33'),_0x32bdde,'createdAt',_0x535e('0x34'),_0x535e('0x35'),_0x535e('0x36'),_0x535e('0x37')],squel[_0x535e('0x12')]()[_0x535e('0x38')](_0x47a563)[_0x535e('0x14')](_0x3e4b45)[_0x535e('0x19')](_0x535e('0x39'),null,_0x535e('0x3a')+_0x3e4b45+_0x535e('0x41'))[_0x535e('0x19')](_0x302042,null,_0x302042+_0x535e('0x15')+_0x3e4b45+'.'+_0x32bdde)[_0x535e('0x19')](_0x816213,null,_0x816213+_0x535e('0x15')+_0x3e4b45+'.'+_0x32bdde)[_0x535e('0x16')](_0x3e4b45+'.CmListId\x20=\x20?',_0x1433f8)[_0x535e('0x16')](_0x535e('0x42'),NOW)['where'](_0x535e('0x3c'),selectNotIn(_0x3e4b45,_0x302042,_0x32bdde,_0x535e('0x2f'),[_0x535e('0x48'),'\x22onlyIfOpen\x22']))['where'](_0x535e('0x3c'),selectNotIn(_0x3e4b45,_0x302042,_0x32bdde,_0x535e('0x2f'),['\x22always\x22'])))[_0x535e('0x3d')]();return _0x5b2467;}function insertTzCmHopperBlack(_0x54450d,_0x3c9f14,_0x1c795d,_0x592999){var _0x1803ea=[_0x535e('0x3e'),_0x535e('0x49'),_0x535e('0x3f'),_0x3c9f14+'.'+_0x592999,_0x535e('0x29'),_0x535e('0x2a')];return squel[_0x535e('0x2d')]()[_0x535e('0x2e')](_0x535e('0x44'))[_0x535e('0x30')]([_0x535e('0x13'),'ContactId','ListId',_0x592999,_0x535e('0x40'),_0x535e('0x34')],squel[_0x535e('0x12')]()[_0x535e('0x38')](_0x1803ea)[_0x535e('0x14')](_0x3c9f14)['join'](_0x535e('0x39'),null,'cm_contacts.ListId\x20=\x20'+_0x3c9f14+_0x535e('0x41'))[_0x535e('0x19')](_0x1c795d,null,_0x1c795d+'.id\x20=\x20'+_0x3c9f14+'.'+_0x592999)['where'](_0x3c9f14+_0x535e('0x3b'),_0x54450d)[_0x535e('0x16')](_0x535e('0x42'),NOW)[_0x535e('0x16')](_0x535e('0x3c'),squel['select']()[_0x535e('0x43')](_0x535e('0x13'))[_0x535e('0x14')]('cm_hopper_black')[_0x535e('0x16')](_0x535e('0x45'),_0x54450d)[_0x535e('0x16')](_0x592999+_0x535e('0x17')+_0x3c9f14+'.'+_0x592999)))['toString']();}function insertCmHopperAdditionalPhones(_0x28007b){var _0x45ecb2=[_0x535e('0x4a'),_0x535e('0x4b'),_0x535e('0x4c'),_0x535e('0x4d'),_0x535e('0x4e')];return squel[_0x535e('0x2d')]()[_0x535e('0x2e')](_0x535e('0x4f'))[_0x535e('0x30')]([_0x535e('0x50'),'phone',_0x535e('0x51'),_0x535e('0x40'),_0x535e('0x34')],squel[_0x535e('0x12')]()['fields'](_0x45ecb2)['from'](_0x535e('0x2f'))[_0x535e('0x19')](_0x535e('0x39'),null,_0x535e('0x52'))[_0x535e('0x19')](_0x535e('0x53'),null,_0x535e('0x54'))['where']('cm_hopper.ListId\x20=\x20?',_0x28007b)[_0x535e('0x16')](_0x535e('0x42'),NOW))[_0x535e('0x3d')]();}function insertCmContact(_0x5cf6cc,_0x298700,_0x27d7bc,_0x1cc6d4){var _0x3891de=_[_0x535e('0x55')](_[_0x535e('0x56')](_0x1cc6d4),[_0x535e('0x33'),_0x535e('0x57'),_0x535e('0x40'),_0x535e('0x34')]);return squel['insert']()[_0x535e('0x2e')](_0x535e('0x39'))[_0x535e('0x30')](_0x3891de,squel[_0x535e('0x12')]()[_0x535e('0x38')](_0x3891de)['from'](_0x298700)['where']('('+_0x27d7bc['join'](',')+_0x535e('0x58'),squel[_0x535e('0x12')]()[_0x535e('0x38')](_0x27d7bc)[_0x535e('0x14')](_0x535e('0x39'))['where'](_0x535e('0x45'),_0x5cf6cc)[_0x535e('0x16')](_0x535e('0x59')))[_0x535e('0x16')](_0x535e('0x5a'),squel['select']()[_0x535e('0x43')](_0x535e('0x5b'),'min_id')[_0x535e('0x14')](_0x298700)['group'](_0x27d7bc['join'](','))))[_0x535e('0x3d')]();}function handleStop(){logger[_0x535e('0x5c')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x23b5ac){logger[_0x535e('0x5d')](_0x23b5ac['message']);process[_0x535e('0x5e')](0x1);}function handleError(_0x326630,_0x5b9752){stats[_0x535e('0x5f')][_0x535e('0x1f')]({'name':_0x5b9752[_0x535e('0x60')],'message':_0x5b9752[_0x535e('0x61')],'row':_0x326630});}function handleQuery(_0x641590){logger['info'](_0x641590);return db[_0x535e('0x62')]['query'](_0x641590)[_0x535e('0x63')](function(_0x18f976){results[_0x535e('0x1f')](_0x18f976);})[_0x535e('0x64')](function(_0x225732){logger[_0x535e('0x5d')](_0x225732[_0x535e('0x61')]);});}function updateTzCampaigns(_0x58fef0){return new Promise(function(_0xb56f00,_0x53d377){var _0x2197ae=squel[_0x535e('0x12')]()[_0x535e('0x38')]([_0x535e('0x65'),_0x535e('0x66')])[_0x535e('0x14')](_0x535e('0x67'))['join']('campaigns_has_cm_lists',null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0x535e('0x16')]('campaigns_has_cm_lists.CmListId='+_0x58fef0);db['sequelize'][_0x535e('0x68')](_0x2197ae['toString']())[_0x535e('0x63')](function(_0x3b22bb){var _0x43757e=[];for(var _0x351878=0x0;_0x351878<_0x3b22bb[_0x535e('0x1e')];_0x351878++){_0x43757e[_0x535e('0x1f')](getTimezoneData(_0x3b22bb[_0x351878],tmp_campaigns));}BPromise[_0x535e('0x20')](_0x43757e)[_0x535e('0x1d')](function(){_0xb56f00({'val':0x1});});})['catch'](function(_0x393715){logger[_0x535e('0x5d')](_0x393715[_0x535e('0x61')]);_0xb56f00({'val':0x0});});});}function updateTzVoiceQueues(_0x39a743){return new Promise(function(_0x1fcb68,_0x1884b5){var _0x27e44a=squel[_0x535e('0x12')]()['fields']([_0x535e('0x69'),'voice_queues.dialTimezone'])[_0x535e('0x14')](_0x535e('0x6a'))[_0x535e('0x19')]('voice_queues_has_cm_lists',null,_0x535e('0x6b'))[_0x535e('0x16')](_0x535e('0x6c')+_0x39a743);db['sequelize']['query'](_0x27e44a['toString']())[_0x535e('0x63')](function(_0x5f0c76){var _0x22e881=[];for(var _0x43c095=0x0;_0x43c095<_0x5f0c76[_0x535e('0x1e')];_0x43c095++){_0x22e881[_0x535e('0x1f')](getTimezoneData(_0x5f0c76[_0x43c095],tmp_voice_queues));}BPromise[_0x535e('0x20')](_0x22e881)[_0x535e('0x1d')](function(){_0x1fcb68({'val':0x1});});})[_0x535e('0x64')](function(_0x2ce68c){logger[_0x535e('0x5d')](_0x2ce68c['message']);_0x1fcb68({'val':0x0});});});}function getTimezoneData(_0x3b3e0c,_0x442b0f){return new Promise(function(_0x55c404,_0x5089bd){var _0x6094c4=shared[_0x535e('0x6d')];var _0x31f5d3=_0x6094c4[_0x3b3e0c['dialTimezone']];if(_['isNil'](_0x31f5d3)){_0x55c404({'ret':0x1});}else{var _0x181d83=_0x31f5d3['utcOffset'];var _0x26175f=squel[_0x535e('0x2d')]()[_0x535e('0x2e')](_0x442b0f)[_0x535e('0x6e')]('id',_0x3b3e0c['id'])[_0x535e('0x6e')](_0x535e('0x6f'),_0x181d83)[_0x535e('0x6e')](_0x535e('0x70'),_0x3b3e0c['dialTimezone'])[_0x535e('0x3d')]();return db[_0x535e('0x62')][_0x535e('0x68')](_0x26175f)['spread'](function(_0x84ca84){_0x55c404({'ret':0x1});})[_0x535e('0x64')](function(_0x53ea68){logger[_0x535e('0x5d')](_0x53ea68[_0x535e('0x61')]);_0x5089bd({'ret':0x1});});}});}function handleTZQuery(_0x568fa1){logger[_0x535e('0x5c')](_0x568fa1);return db[_0x535e('0x62')][_0x535e('0x68')](_0x568fa1)[_0x535e('0x63')](function(_0x47cca6){})[_0x535e('0x64')](function(_0x541187){logger[_0x535e('0x5d')](_0x541187[_0x535e('0x61')]);});}function main(_0x37ec9b,_0x5b8b94,_0x220880,_0x59e875){logger[_0x535e('0x5c')]('main',_0x37ec9b,JSON[_0x535e('0x71')](_0x5b8b94));process[_0x535e('0x72')](_0x535e('0x73'));var _0x416390=_0x5b8b94[_0x535e('0x74')];var _0x38b4e2=_[_0x535e('0x75')](_0x416390);var _0x372e88=_0x5b8b94[_0x535e('0x76')];var _0x205750=path[_0x535e('0x19')](config[_0x535e('0x77')],_0x535e('0x78'),_0x372e88+_0x535e('0x79'));hasTZ=_[_0x535e('0x56')](_0x416390)[_0x535e('0x7a')](_0x535e('0x70'));var _0x3854d1=_[_0x535e('0x56')](_0x416390)[_0x535e('0x19')]();logger[_0x535e('0x5c')](_0x535e('0x7b'),_0x3854d1);db[_0x535e('0x7c')][_0x535e('0x1b')]({'raw':!![],'attributes':['id','name']})[_0x535e('0x1d')](function(_0x557b49){for(var _0x2677af=0x0;_0x2677af<_0x557b49[_0x535e('0x1e')];_0x2677af++){if(_0x557b49[_0x2677af][_0x535e('0x7d')]in _0x416390){contactItemTypes[_0x535e('0x1f')](_0x557b49[_0x2677af]);delete _0x38b4e2[_0x557b49[_0x2677af]['name']];hasAdditionalPhones=!![];}for(var _0x14733a in _0x416390){if(_0x557b49[_0x2677af][_0x535e('0x7d')]+_0x535e('0x7e')===_0x14733a){phoneDescriptions['push']({'itemTypeId':_0x557b49[_0x2677af]['id'],'description':_0x14733a});delete _0x38b4e2[_0x14733a];}}}if(hasAdditionalPhones)_0x38b4e2[_0x535e('0x1c')]='';var _0x42758c=_[_0x535e('0x56')](_0x38b4e2)[_0x535e('0x19')]();logger[_0x535e('0x5c')](_0x535e('0x7b'),_0x42758c);fs[_0x535e('0x7f')](_0x205750,_0x42758c+'\x0a');Papa[_0x535e('0x80')](fs[_0x535e('0x81')](_0x37ec9b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5f5ae4,_0x152472){try{for(var _0xb00fb9=0x0,_0x2def65=[];_0xb00fb9<_0x5f5ae4[_0x535e('0x82')][_0x535e('0x1e')];_0xb00fb9++){stats[_0x535e('0x83')]+=0x1;if(_0x5f5ae4[_0x535e('0x5f')][_0xb00fb9]){handleError(_0x5f5ae4['data'][_0xb00fb9],_0x5f5ae4['errors'][_0xb00fb9]);}else{var _0x1a83aa=[];var _0x2cb3ad=[];var _0x47cc70={};for(var _0xfcd047 in _0x416390){let _0x3f5a69=contactItemTypes[_0x535e('0x84')](_0xea6362=>_0xea6362[_0x535e('0x7d')]===_0xfcd047);let _0xa59f6f=contactItemTypes[_0x535e('0x84')](_0x1f9c4b=>_0x1f9c4b[_0x535e('0x7d')]+_0x535e('0x7e')===_0xfcd047);if(_[_0x535e('0x22')](_0x3f5a69)&&_[_0x535e('0x22')](_0xa59f6f)){if(_0x416390[_0x535e('0x85')](_0xfcd047)){if(_0x5f5ae4['data'][_0xb00fb9][_0x416390[_0xfcd047]]){var _0x2dd360=_[_0x535e('0x86')](_0x5f5ae4['data'][_0xb00fb9][_0x416390[_0xfcd047]][_0x535e('0x87')](/"/g,'\x27'));switch(_0xfcd047){case _0x535e('0x31'):var _0x327c28=moment(_0x2dd360,_0x535e('0x10'),!![]);if(_0x327c28[_0x535e('0x88')]()){_0x2def65[_0x535e('0x1f')]('\x22'+_0x2dd360+'\x22');}else{_0x1a83aa['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x535e('0x35'):var _0x288171=parseInt(_0x2dd360);_0x2dd360=_[_0x535e('0x89')](_0x288171)||_0x288171<0x0||_0x288171>0x4?_0x59e875?0x3:0x2:_0x288171;_0x2def65[_0x535e('0x1f')]('\x22'+_0x2dd360+'\x22');break;case _0x535e('0x36'):var _0x364def=parseInt(_0x2dd360);if(_[_0x535e('0x8a')](_0x364def)&&_[_0x535e('0x7a')](_0x220880,_0x364def)){_0x2def65[_0x535e('0x1f')]('\x22'+_0x364def+'\x22');}else{_0x1a83aa[_0x535e('0x1f')]('agent\x20not\x20exists');}break;case _0x535e('0x8b'):if(isEmail(_0x2dd360)){_0x2def65[_0x535e('0x1f')]('\x22'+_0x2dd360+'\x22');}else{_0x1a83aa[_0x535e('0x1f')](_0x535e('0x8c'));}break;case _0x535e('0x8d'):var _0x180519=moment(_0x2dd360,_0x535e('0x8e'),!![]);if(_0x180519[_0x535e('0x88')]()){_0x2def65[_0x535e('0x1f')]('\x22'+_0x2dd360+'\x22');}else{_0x1a83aa[_0x535e('0x1f')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0x535e('0x70'):var _0x3e0c00=shared[_0x535e('0x6d')];var _0x1a05b1=_0x3e0c00[_0x2dd360];if(!_[_0x535e('0x22')](_0x1a05b1)){var _0x116967=_0x1a05b1['utcOffset'];_0x2def65[_0x535e('0x1f')]('\x22'+_0x2dd360+'\x22');_0x2def65['push']('\x22'+_0x116967+'\x22');}break;default:_0x2def65[_0x535e('0x1f')]('\x22'+_0x2dd360+'\x22');}}else{switch(_0xfcd047){case _0x535e('0x8f'):case _0x535e('0x13'):_0x1a83aa['push'](_0xfcd047+_0x535e('0x90'));break;default:_0x2def65[_0x535e('0x1f')]('\x22\x22');}}}}else{var _0x55c0db='';if(!_[_0x535e('0x22')](_0x3f5a69)){if(!_0x47cc70[_0x535e('0x85')](_0x3f5a69['id'])){if(!_[_0x535e('0x22')](_0x5f5ae4[_0x535e('0x82')][_0xb00fb9][_0x416390[_0xfcd047]])){var _0x2dd360=_['trim'](_0x5f5ae4[_0x535e('0x82')][_0xb00fb9][_0x416390[_0xfcd047]][_0x535e('0x87')](/"/g,'\x27'));var _0x180e5c=phoneDescriptions[_0x535e('0x84')](_0x4e3504=>_0x4e3504[_0x535e('0x91')]===_0x3f5a69['id']);if(!_[_0x535e('0x22')](_0x180e5c)){var _0x51cf84=_[_0x535e('0x86')](_0x5f5ae4[_0x535e('0x82')][_0xb00fb9][_0x416390[_0x180e5c[_0x535e('0x92')]]][_0x535e('0x87')](/"/g,'\x27'));if(!_[_0x535e('0x22')](_0x51cf84))_0x2dd360=_0x2dd360+'§'+_0x51cf84;}if(_0x55c0db=='')_0x55c0db=_0x2dd360;else _0x55c0db+='|'+_0x2dd360;}_0x2cb3ad[_0x535e('0x1f')](_0x3f5a69['id']+':'+_0x55c0db);_0x47cc70[_0x3f5a69['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2def65[_0x535e('0x1f')]('\x22'+_0x2cb3ad[_0x535e('0x19')](';')+'\x22');}if(_0x1a83aa[_0x535e('0x1e')]){handleError(_0x5f5ae4[_0x535e('0x82')][_0xb00fb9],{'code':_0x535e('0x93'),'message':_0x1a83aa[_0x535e('0x19')]()});}else{fs['appendFileSync'](_0x205750,_0x2def65[_0x535e('0x19')]()+'\x0a');}_0x2def65=[];}if(!(stats[_0x535e('0x83')]%0xc8)){socket[_0x535e('0x94')](_0x535e('0x95')+_0x372e88,stats);stats[_0x535e('0x5f')]=[];}}if(stopped){logger[_0x535e('0x5c')]('Abort\x20parser');_0x152472[_0x535e('0x96')]();}}catch(_0x50bd80){handleError(_0x5f5ae4[_0x535e('0x82')][_0xb00fb9],{'code':'SystemError','message':_0x50bd80['message']});logger['error'](_0x535e('0x97'),_0x50bd80[_0x535e('0x61')]);}},'complete':function(){try{var _0x51fcf0=[];var _0x1ce887=[];var _0x2004b8='cm_contacts';if(_0x5b8b94[_0x535e('0x98')]&&_0x5b8b94[_0x535e('0x98')][_0x535e('0x1e')]){_0x2004b8='cm_contacts_'+_0x372e88;_0x51fcf0[_0x535e('0x1f')](_0x535e('0x99')+_0x2004b8+_0x535e('0x9a'));}tmp_campaigns=_0x535e('0x9b')+_0x372e88;tmp_voice_queues=_0x535e('0x9c')+_0x372e88;_0x1ce887['push'](_0x535e('0x99')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x1ce887[_0x535e('0x1f')](_0x535e('0x99')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x535e('0x9d')](_0x1ce887,handleTZQuery)[_0x535e('0x1d')](function(_0x21f8a3){updateTzCampaigns(_0x5b8b94[_0x535e('0x33')])[_0x535e('0x1d')](function(_0x493ca7){updateTzVoiceQueues(_0x5b8b94['ListId'])[_0x535e('0x1d')](function(_0x122c4b){if(hasTZ)_0x42758c=_0x42758c['replace']('dialTimezone',_0x535e('0x9e'));var _0x32bd76=util[_0x535e('0xf')](_0x535e('0x9f'),_0x205750,_0x2004b8,_0x42758c,_0x5b8b94[_0x535e('0x33')],_0x5b8b94[_0x535e('0x57')]||null,NOW,NOW);if(_['isNil'](_0x416390[_0x535e('0x31')])){_0x32bd76+=_0x535e('0xa0');}_0x51fcf0[_0x535e('0x1f')](_0x32bd76);if(_0x5b8b94['duplicates']&&_0x5b8b94[_0x535e('0x98')][_0x535e('0x1e')]){_0x51fcf0[_0x535e('0x1f')](insertCmContact(_0x5b8b94[_0x535e('0x33')],_0x2004b8,_0x5b8b94[_0x535e('0x98')],_0x416390));_0x51fcf0[_0x535e('0x1f')](_0x535e('0xa1')+_0x2004b8+';');}BPromise[_0x535e('0x9d')](_0x51fcf0,handleQuery)[_0x535e('0x1d')](function(_0x37a4a4){BPromise[_0x535e('0x20')]([handleAdditionalPhones()])['then'](function(){_0x51fcf0=[];for(var _0xf1a174=0x0;_0xf1a174\x20\x20','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','path','lodash','papaparse','util','bluebird','moment','squel','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','findAll','AdditionalPhones','then','length','push','all','split','filter','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','phone','scheduledat','ListId','createdAt','updatedAt','recallme','fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','cm_contacts.ListId\x20=\x20','ListId\x20=\x20?','toString','.offset-cm_contacts.utcOffset\x20minute)'];(function(_0x369f24,_0x5d08ee){var _0x5c0683=function(_0x23b802){while(--_0x23b802){_0x369f24['push'](_0x369f24['shift']());}};_0x5c0683(++_0x5d08ee);}(_0x9256,0x128));var _0x6925=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9256[_0x321bb2];return _0x9c12ed;};'use strict';var fs=require('fs');var path=require(_0x6925('0x0'));var _=require(_0x6925('0x1'));var Papa=require(_0x6925('0x2'));var util=require(_0x6925('0x3'));var BPromise=require(_0x6925('0x4'));var moment=require(_0x6925('0x5'));var squel=require(_0x6925('0x6'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0x6925('0x7'));var shared=require('../../../config/environment/shared');var logger=require(_0x6925('0x8'))(_0x6925('0x9'));config[_0x6925('0xa')]=_[_0x6925('0xb')](config[_0x6925('0xa')],{'host':_0x6925('0xc'),'port':0x18eb});var socket=require(_0x6925('0xd'))(new Redis(config[_0x6925('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x6925('0xe')](_0x6925('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x6925('0xe')](_0x6925('0xf'));function isEmail(_0x21ec73){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))*$/[_0x6925('0x10')](_0x21ec73);}function selectNotIn(_0x2097a8,_0x24d17e,_0x48a0f7,_0x1ef249,_0x107f4d){return squel[_0x6925('0x11')]()[_0x6925('0x12')]('phone')[_0x6925('0x13')](_0x1ef249)[_0x6925('0x14')](_0x24d17e,null,_0x24d17e+_0x6925('0x15')+_0x1ef249+'.'+_0x48a0f7)[_0x6925('0x16')](_0x1ef249+'.'+_0x48a0f7+_0x6925('0x17')+_0x2097a8+'.'+_0x48a0f7)[_0x6925('0x16')](_0x24d17e+_0x6925('0x18')+_0x107f4d[_0x6925('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1917b4,_0x158256){promisesAdditionalPhones=[];return db['CmContact'][_0x6925('0x19')]({'raw':!![],'attributes':['id',_0x6925('0x1a')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x6925('0x1b')](function(_0x2053fb){if(_0x2053fb!==null){var _0x3a1246=[];for(var _0x47fb3b=0x0;_0x47fb3b<_0x2053fb[_0x6925('0x1c')];_0x47fb3b++){var _0x46d3cd=_0x2053fb[_0x47fb3b];_0x3a1246[_0x6925('0x1d')](insertAdditionalPhones(_0x46d3cd));}}Promise['all'](_0x3a1246)[_0x6925('0x1b')](function(){_0x1917b4({'val':0x1});});});});}function insertAdditionalPhones(_0x2dea97){return new Promise(function(_0x243663,_0x2f0620){var _0x2845c5=_0x2dea97[_0x6925('0x1a')];var _0x19109b=_0x2845c5['split'](';');var _0x2d58ec=[];orderBy=0x0;for(var _0x3a0c49=0x0;_0x3a0c49<_0x19109b[_0x6925('0x1c')];_0x3a0c49++){_0x2d58ec['push'](splitAdditionalPhone(_0x2dea97['id'],_0x19109b[_0x3a0c49]));}Promise[_0x6925('0x1e')](_0x2d58ec)[_0x6925('0x1b')](function(){_0x243663({'val':_0x19109b[_0x6925('0x1c')]});});});}function splitAdditionalPhone(_0x25c49b,_0xdc7d8){return new Promise(function(_0x3d26d3,_0x2c3c5e){var _0x284b2b=_0xdc7d8[_0x6925('0x1f')](':');var _0xe90668=_0x284b2b[0x0];var _0x51f379=_0x284b2b[0x1];if(!_['isNil'](_0x51f379)){var _0x25a4c7=_0x51f379[_0x6925('0x1f')]('|');var _0x28399c=[];for(var _0x548d62=0x0;_0x548d62<_0x25a4c7[_0x6925('0x1c')];_0x548d62++){if(_0x25a4c7[_0x548d62]!==''){var _0x1178e1=_[_0x6925('0x20')](promisesAdditionalPhones,{'contactId':_0x25c49b,'phone':_0x25a4c7[_0x548d62]});if(_0x1178e1['length']==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x25c49b,'contactTypeId':_0xe90668,'phone':_0x25a4c7[_0x548d62],'orderBy':orderBy});}}}_0x3d26d3({'ok':0x1});}else _0x3d26d3({'res':0x0});});}function createAdditionalPhone(_0x5cccdc,_0x336512,_0x348ee6,_0xa169ac){var _0x19376a='';var _0x575575='';var _0x4ed3b0=_0x348ee6['split']('§');_0x19376a=_0x4ed3b0[0x0];if(_0x4ed3b0[_0x6925('0x1c')]==0x2)_0x575575=_0x4ed3b0[0x1];return new Promise(function(_0x3388f3,_0x1187f8){return db[_0x6925('0x21')]['findOne']({'where':{'CmContactId':_0x5cccdc,'item':_0x19376a}})[_0x6925('0x1b')](function(_0x326900){if(_0x326900){return db[_0x6925('0x21')][_0x6925('0x22')]({'ItemTypeId':_0x336512,'description':_0x575575,'OrderBy':_0xa169ac},{'where':{'CmContactId':_0x5cccdc,'item':_0x19376a}})[_0x6925('0x1b')](function(_0x4933be){_0x3388f3({'res':_0x6925('0x23')});});}else{return db[_0x6925('0x21')][_0x6925('0x24')]({'CmContactId':_0x5cccdc,'item':_0x19376a,'description':_0x575575,'ItemTypeId':_0x336512,'OrderBy':_0xa169ac,'ItemClass':'PHONE'})[_0x6925('0x1b')](function(_0x145e33){_0x3388f3({'res':'inserted'});});}});});}function insertCmHopper(_0xc36d7c,_0x22a067,_0x5c6bd1,_0x24831b,_0x751313){var _0x45b7f1=[_0x6925('0x25'),_0x6925('0x26'),_0x6925('0x27'),_0x6925('0x28'),_0x22a067+'.'+_0x24831b,_0x6925('0x29'),_0x6925('0x2a'),_0x6925('0x2b'),_0x6925('0x2c'),'\x22'+_0x751313+'\x22'];return squel[_0x6925('0x2d')]()[_0x6925('0x2e')](_0x6925('0x2f'))[_0x6925('0x30')]([_0x6925('0x31'),_0x6925('0x32'),'ContactId',_0x6925('0x33'),_0x24831b,_0x6925('0x34'),_0x6925('0x35'),'priority','UserId',_0x6925('0x36')],squel[_0x6925('0x11')]()[_0x6925('0x37')](_0x45b7f1)[_0x6925('0x13')](_0x22a067)['join'](_0x6925('0x38'),null,'cm_contacts.ListId\x20=\x20'+_0x22a067+_0x6925('0x39'))[_0x6925('0x14')](_0x5c6bd1,null,_0x5c6bd1+_0x6925('0x15')+_0x22a067+'.'+_0x24831b)[_0x6925('0x16')](_0x22a067+_0x6925('0x3a'),_0xc36d7c)[_0x6925('0x16')](_0x6925('0x3b'),NOW)[_0x6925('0x16')](_0x6925('0x3c'),selectNotIn(_0x22a067,_0x5c6bd1,_0x24831b,'cm_hopper',['\x22always\x22','\x22onlyIfOpen\x22']))[_0x6925('0x16')](_0x6925('0x3c'),selectNotIn(_0x22a067,_0x5c6bd1,_0x24831b,_0x6925('0x2f'),[_0x6925('0x3d')])))['toString']();}function insertCmHopperBlack(_0x287d6f,_0x3aa4fd,_0x1040f6,_0x258c32){var _0x5c743c=[_0x6925('0x25'),_0x6925('0x27'),'cm_contacts.ListId',_0x3aa4fd+'.'+_0x258c32,_0x6925('0x29'),_0x6925('0x2a')];return squel[_0x6925('0x2d')]()[_0x6925('0x2e')]('cm_hopper_black')[_0x6925('0x30')](['phone','ContactId',_0x6925('0x33'),_0x258c32,_0x6925('0x34'),_0x6925('0x35')],squel[_0x6925('0x11')]()['fields'](_0x5c743c)[_0x6925('0x13')](_0x3aa4fd)[_0x6925('0x14')](_0x6925('0x38'),null,_0x6925('0x3e')+_0x3aa4fd+_0x6925('0x39'))[_0x6925('0x14')](_0x1040f6,null,_0x1040f6+_0x6925('0x15')+_0x3aa4fd+'.'+_0x258c32)[_0x6925('0x16')](_0x3aa4fd+_0x6925('0x3a'),_0x287d6f)['where'](_0x6925('0x3b'),NOW)[_0x6925('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x6925('0x11')]()[_0x6925('0x12')](_0x6925('0x31'))[_0x6925('0x13')]('cm_hopper_black')['where'](_0x6925('0x3f'),_0x287d6f)[_0x6925('0x16')](_0x258c32+'\x20=\x20'+_0x3aa4fd+'.'+_0x258c32)))[_0x6925('0x40')]();}function insertTzCmHopper(_0x47a656,_0x238362,_0x448556,_0x47b49f,_0x4ccf26,_0x4ff6db){var _0x4155b1=[_0x6925('0x25'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x4ff6db+_0x6925('0x41'),_0x6925('0x27'),_0x6925('0x28'),_0x238362+'.'+_0x47b49f,_0x6925('0x29'),_0x6925('0x2a'),_0x6925('0x2b'),'cm_contacts.UserId','\x22'+_0x4ccf26+'\x22'];var _0x1b90c8=squel[_0x6925('0x2d')]()[_0x6925('0x2e')](_0x6925('0x2f'))['fromQuery'](['phone',_0x6925('0x32'),_0x6925('0x42'),_0x6925('0x33'),_0x47b49f,_0x6925('0x34'),_0x6925('0x35'),'priority',_0x6925('0x43'),_0x6925('0x36')],squel['select']()[_0x6925('0x37')](_0x4155b1)[_0x6925('0x13')](_0x238362)['join']('cm_contacts',null,_0x6925('0x3e')+_0x238362+_0x6925('0x39'))[_0x6925('0x14')](_0x448556,null,_0x448556+'.id\x20=\x20'+_0x238362+'.'+_0x47b49f)[_0x6925('0x14')](_0x4ff6db,null,_0x4ff6db+'.id\x20=\x20'+_0x238362+'.'+_0x47b49f)[_0x6925('0x16')](_0x238362+_0x6925('0x3a'),_0x47a656)[_0x6925('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x238362,_0x448556,_0x47b49f,_0x6925('0x2f'),['\x22always\x22',_0x6925('0x44')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x238362,_0x448556,_0x47b49f,_0x6925('0x2f'),[_0x6925('0x3d')])))['toString']();return _0x1b90c8;}function insertTzCmHopperBlack(_0x345fdd,_0x453e30,_0x313f44,_0x284803){var _0x1dc57c=['cm_contacts.phone','cm_contacts.id',_0x6925('0x28'),_0x453e30+'.'+_0x284803,_0x6925('0x29'),_0x6925('0x2a')];return squel[_0x6925('0x2d')]()['into'](_0x6925('0x45'))[_0x6925('0x30')]([_0x6925('0x31'),'ContactId',_0x6925('0x33'),_0x284803,_0x6925('0x34'),'updatedAt'],squel[_0x6925('0x11')]()[_0x6925('0x37')](_0x1dc57c)[_0x6925('0x13')](_0x453e30)[_0x6925('0x14')]('cm_contacts',null,_0x6925('0x3e')+_0x453e30+_0x6925('0x39'))[_0x6925('0x14')](_0x313f44,null,_0x313f44+'.id\x20=\x20'+_0x453e30+'.'+_0x284803)[_0x6925('0x16')](_0x453e30+_0x6925('0x3a'),_0x345fdd)[_0x6925('0x16')](_0x6925('0x3b'),NOW)[_0x6925('0x16')](_0x6925('0x3c'),squel[_0x6925('0x11')]()[_0x6925('0x12')](_0x6925('0x31'))[_0x6925('0x13')](_0x6925('0x45'))[_0x6925('0x16')](_0x6925('0x3f'),_0x345fdd)['where'](_0x284803+_0x6925('0x17')+_0x453e30+'.'+_0x284803)))['toString']();}function insertCmHopperAdditionalPhones(_0x265ac2){var _0x43f40f=['cm_hopper.id',_0x6925('0x46'),_0x6925('0x47'),_0x6925('0x48'),_0x6925('0x49')];return squel[_0x6925('0x2d')]()[_0x6925('0x2e')](_0x6925('0x4a'))[_0x6925('0x30')]([_0x6925('0x4b'),'phone','OrderBy',_0x6925('0x34'),_0x6925('0x35')],squel['select']()[_0x6925('0x37')](_0x43f40f)[_0x6925('0x13')](_0x6925('0x2f'))['join'](_0x6925('0x38'),null,_0x6925('0x4c'))[_0x6925('0x14')](_0x6925('0x4d'),null,_0x6925('0x4e'))['where'](_0x6925('0x4f'),_0x265ac2)[_0x6925('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x6925('0x40')]();}function insertCmContact(_0x2f44af,_0x399b18,_0x1e1ab9,_0x57950d){var _0x2cd309=_['concat'](_[_0x6925('0x50')](_0x57950d),['ListId',_0x6925('0x51'),_0x6925('0x34'),_0x6925('0x35')]);return squel[_0x6925('0x2d')]()[_0x6925('0x2e')](_0x6925('0x38'))['fromQuery'](_0x2cd309,squel[_0x6925('0x11')]()[_0x6925('0x37')](_0x2cd309)[_0x6925('0x13')](_0x399b18)[_0x6925('0x16')]('('+_0x1e1ab9[_0x6925('0x14')](',')+_0x6925('0x52'),squel[_0x6925('0x11')]()[_0x6925('0x37')](_0x1e1ab9)[_0x6925('0x13')]('cm_contacts')[_0x6925('0x16')](_0x6925('0x3f'),_0x2f44af)[_0x6925('0x16')](_0x6925('0x53')))[_0x6925('0x16')](_0x6925('0x54'),squel['select']()[_0x6925('0x12')](_0x6925('0x55'),_0x6925('0x56'))['from'](_0x399b18)[_0x6925('0x57')](_0x1e1ab9['join'](','))))[_0x6925('0x40')]();}function handleStop(){logger[_0x6925('0x58')](_0x6925('0x59'));stopped=!![];}function handleUncaughtException(_0x454ded){logger['error'](_0x454ded['message']);process[_0x6925('0x5a')](0x1);}function handleError(_0xbf5d3a,_0x51848d){stats[_0x6925('0x5b')][_0x6925('0x1d')]({'name':_0x51848d[_0x6925('0x5c')],'message':_0x51848d[_0x6925('0x5d')],'row':_0xbf5d3a});}function handleQuery(_0x183363){logger[_0x6925('0x58')](_0x183363);return db[_0x6925('0x5e')][_0x6925('0x5f')](_0x183363)[_0x6925('0x60')](function(_0x4ce92a){results[_0x6925('0x1d')](_0x4ce92a);})[_0x6925('0x61')](function(_0x346b50){logger[_0x6925('0x62')](_0x346b50[_0x6925('0x5d')]);});}function updateTzCampaigns(_0x3bc309){return new Promise(function(_0x37aaef,_0x507ffc){var _0x5e4a56=squel['select']()[_0x6925('0x37')](['campaigns.id',_0x6925('0x63')])[_0x6925('0x13')]('campaigns')['join'](_0x6925('0x64'),null,_0x6925('0x65'))[_0x6925('0x16')](_0x6925('0x66')+_0x3bc309);db[_0x6925('0x5e')]['query'](_0x5e4a56[_0x6925('0x40')]())[_0x6925('0x60')](function(_0x56c80d){var _0x30a518=[];for(var _0x45795b=0x0;_0x45795b<_0x56c80d[_0x6925('0x1c')];_0x45795b++){_0x30a518[_0x6925('0x1d')](getTimezoneData(_0x56c80d[_0x45795b],tmp_campaigns));}BPromise['all'](_0x30a518)[_0x6925('0x1b')](function(){_0x37aaef({'val':0x1});});})[_0x6925('0x61')](function(_0xa1d6d7){logger[_0x6925('0x62')](_0xa1d6d7[_0x6925('0x5d')]);_0x37aaef({'val':0x0});});});}function updateTzVoiceQueues(_0x5b6a0d){return new Promise(function(_0xf8778e,_0x510332){var _0x39f44a=squel[_0x6925('0x11')]()['fields'](['voice_queues.id',_0x6925('0x67')])[_0x6925('0x13')](_0x6925('0x68'))['join'](_0x6925('0x69'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0x6925('0x16')]('voice_queues_has_cm_lists.CmListId='+_0x5b6a0d);db[_0x6925('0x5e')]['query'](_0x39f44a[_0x6925('0x40')]())['spread'](function(_0x28bbb1){var _0x27aaaf=[];for(var _0x5e6612=0x0;_0x5e6612<_0x28bbb1[_0x6925('0x1c')];_0x5e6612++){_0x27aaaf[_0x6925('0x1d')](getTimezoneData(_0x28bbb1[_0x5e6612],tmp_voice_queues));}BPromise[_0x6925('0x1e')](_0x27aaaf)['then'](function(){_0xf8778e({'val':0x1});});})[_0x6925('0x61')](function(_0x588ccc){logger[_0x6925('0x62')](_0x588ccc[_0x6925('0x5d')]);_0xf8778e({'val':0x0});});});}function getTimezoneData(_0x1e33da,_0x47dee0){return new Promise(function(_0x13b2a3,_0x564a42){var _0x126f23=shared[_0x6925('0x6a')];var _0x52cf88=_0x126f23[_0x1e33da[_0x6925('0x6b')]];if(_['isNil'](_0x52cf88)){_0x13b2a3({'ret':0x1});}else{var _0x1905e1=_0x52cf88['utcOffset'];var _0x20e0e5=squel['insert']()[_0x6925('0x2e')](_0x47dee0)['set']('id',_0x1e33da['id'])[_0x6925('0x6c')](_0x6925('0x6d'),_0x1905e1)['set']('dialTimezone',_0x1e33da['dialTimezone'])[_0x6925('0x40')]();return db[_0x6925('0x5e')][_0x6925('0x5f')](_0x20e0e5)[_0x6925('0x60')](function(_0x43523c){_0x13b2a3({'ret':0x1});})['catch'](function(_0x236a22){logger[_0x6925('0x62')](_0x236a22[_0x6925('0x5d')]);_0x564a42({'ret':0x1});});}});}function handleTZQuery(_0x23b1a6){logger[_0x6925('0x58')](_0x23b1a6);return db[_0x6925('0x5e')][_0x6925('0x5f')](_0x23b1a6)[_0x6925('0x60')](function(_0x1b703f){})['catch'](function(_0x4251cb){logger[_0x6925('0x62')](_0x4251cb[_0x6925('0x5d')]);});}function main(_0x135dd8,_0x5d9f0d,_0x454dfc,_0x15787e){logger['info'](_0x6925('0x6e'),_0x135dd8,JSON['stringify'](_0x5d9f0d));process[_0x6925('0x6f')](_0x6925('0x70'));var _0x535a16=_0x5d9f0d['binding'];var _0x5ce5ac=_[_0x6925('0x71')](_0x535a16);var _0x110f77=_0x5d9f0d[_0x6925('0x72')];var _0x42adfb=path[_0x6925('0x14')](config[_0x6925('0x73')],_0x6925('0x74'),_0x110f77+_0x6925('0x75'));hasTZ=_[_0x6925('0x50')](_0x535a16)[_0x6925('0x76')]('dialTimezone');var _0x40ac3f=_['keys'](_0x535a16)['join']();logger[_0x6925('0x58')](_0x6925('0x77'),_0x40ac3f);db[_0x6925('0x78')][_0x6925('0x19')]({'raw':!![],'attributes':['id','name']})[_0x6925('0x1b')](function(_0x2d5a75){for(var _0x2ad284=0x0;_0x2ad284<_0x2d5a75['length'];_0x2ad284++){if(_0x2d5a75[_0x2ad284][_0x6925('0x79')]in _0x535a16){contactItemTypes[_0x6925('0x1d')](_0x2d5a75[_0x2ad284]);delete _0x5ce5ac[_0x2d5a75[_0x2ad284][_0x6925('0x79')]];hasAdditionalPhones=!![];}for(var _0x184fba in _0x535a16){if(_0x2d5a75[_0x2ad284][_0x6925('0x79')]+_0x6925('0x7a')===_0x184fba){phoneDescriptions['push']({'itemTypeId':_0x2d5a75[_0x2ad284]['id'],'description':_0x184fba});delete _0x5ce5ac[_0x184fba];}}}if(hasAdditionalPhones)_0x5ce5ac[_0x6925('0x1a')]='';var _0x16111d=_['keys'](_0x5ce5ac)['join']();logger[_0x6925('0x58')](_0x6925('0x77'),_0x16111d);fs['writeFileSync'](_0x42adfb,_0x16111d+'\x0a');Papa[_0x6925('0x7b')](fs['createReadStream'](_0x135dd8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5495eb,_0x31d526){try{for(var _0x554001=0x0,_0x5a37c8=[];_0x554001<_0x5495eb[_0x6925('0x7c')]['length'];_0x554001++){stats[_0x6925('0x7d')]+=0x1;if(_0x5495eb['errors'][_0x554001]){handleError(_0x5495eb[_0x6925('0x7c')][_0x554001],_0x5495eb[_0x6925('0x5b')][_0x554001]);}else{var _0xdd2938=[];var _0x1464f6=[];var _0x31c48e={};for(var _0x3273de in _0x535a16){let _0x16ec15=contactItemTypes[_0x6925('0x7e')](_0x13a6f5=>_0x13a6f5[_0x6925('0x79')]===_0x3273de);let _0x34e368=contactItemTypes['find'](_0x481d4d=>_0x481d4d['name']+'_description'===_0x3273de);if(_[_0x6925('0x7f')](_0x16ec15)&&_[_0x6925('0x7f')](_0x34e368)){if(_0x535a16[_0x6925('0x80')](_0x3273de)){if(_0x5495eb[_0x6925('0x7c')][_0x554001][_0x535a16[_0x3273de]]){var _0x292ba8=_[_0x6925('0x81')](_0x5495eb[_0x6925('0x7c')][_0x554001][_0x535a16[_0x3273de]][_0x6925('0x82')](/"/g,'\x27'));switch(_0x3273de){case'scheduledat':var _0x1b2e25=moment(_0x292ba8,_0x6925('0xf'),!![]);if(_0x1b2e25[_0x6925('0x83')]()){_0x5a37c8[_0x6925('0x1d')]('\x22'+_0x292ba8+'\x22');}else{_0xdd2938[_0x6925('0x1d')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x4d886f=parseInt(_0x292ba8);_0x292ba8=_[_0x6925('0x84')](_0x4d886f)||_0x4d886f<0x0||_0x4d886f>0x4?_0x15787e?0x3:0x2:_0x4d886f;_0x5a37c8[_0x6925('0x1d')]('\x22'+_0x292ba8+'\x22');break;case _0x6925('0x43'):var _0x30c639=parseInt(_0x292ba8);if(_[_0x6925('0x85')](_0x30c639)&&_[_0x6925('0x76')](_0x454dfc,_0x30c639)){_0x5a37c8[_0x6925('0x1d')]('\x22'+_0x30c639+'\x22');}else{_0xdd2938[_0x6925('0x1d')](_0x6925('0x86'));}break;case _0x6925('0x87'):if(isEmail(_0x292ba8)){_0x5a37c8[_0x6925('0x1d')]('\x22'+_0x292ba8+'\x22');}else{_0xdd2938[_0x6925('0x1d')](_0x6925('0x88'));}break;case _0x6925('0x89'):var _0x4ae477=moment(_0x292ba8,_0x6925('0x8a'),!![]);if(_0x4ae477[_0x6925('0x83')]()){_0x5a37c8[_0x6925('0x1d')]('\x22'+_0x292ba8+'\x22');}else{_0xdd2938[_0x6925('0x1d')](_0x6925('0x8b'));}break;case _0x6925('0x6b'):var _0x58f0d5=shared[_0x6925('0x6a')];var _0x5bfa2=_0x58f0d5[_0x292ba8];if(!_[_0x6925('0x7f')](_0x5bfa2)){var _0x5091a6=_0x5bfa2[_0x6925('0x8c')];_0x5a37c8['push']('\x22'+_0x292ba8+'\x22');_0x5a37c8[_0x6925('0x1d')]('\x22'+_0x5091a6+'\x22');}break;default:_0x5a37c8[_0x6925('0x1d')]('\x22'+_0x292ba8+'\x22');}}else{switch(_0x3273de){case _0x6925('0x8d'):case _0x6925('0x31'):_0xdd2938[_0x6925('0x1d')](_0x3273de+_0x6925('0x8e'));break;default:_0x5a37c8[_0x6925('0x1d')]('\x22\x22');}}}}else{var _0x2f0e28='';if(!_[_0x6925('0x7f')](_0x16ec15)){if(!_0x31c48e[_0x6925('0x80')](_0x16ec15['id'])){if(!_['isNil'](_0x5495eb[_0x6925('0x7c')][_0x554001][_0x535a16[_0x3273de]])){var _0x292ba8=_['trim'](_0x5495eb[_0x6925('0x7c')][_0x554001][_0x535a16[_0x3273de]]['replace'](/"/g,'\x27'));var _0x298501=phoneDescriptions[_0x6925('0x7e')](_0x18ecf2=>_0x18ecf2['itemTypeId']===_0x16ec15['id']);if(!_['isNil'](_0x298501)){var _0x338261=_[_0x6925('0x81')](_0x5495eb[_0x6925('0x7c')][_0x554001][_0x535a16[_0x298501[_0x6925('0x8f')]]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x338261))_0x292ba8=_0x292ba8+'§'+_0x338261;}if(_0x2f0e28=='')_0x2f0e28=_0x292ba8;else _0x2f0e28+='|'+_0x292ba8;}_0x1464f6[_0x6925('0x1d')](_0x16ec15['id']+':'+_0x2f0e28);_0x31c48e[_0x16ec15['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5a37c8[_0x6925('0x1d')]('\x22'+_0x1464f6[_0x6925('0x14')](';')+'\x22');}if(_0xdd2938[_0x6925('0x1c')]){handleError(_0x5495eb['data'][_0x554001],{'code':_0x6925('0x90'),'message':_0xdd2938[_0x6925('0x14')]()});}else{fs[_0x6925('0x91')](_0x42adfb,_0x5a37c8[_0x6925('0x14')]()+'\x0a');}_0x5a37c8=[];}if(!(stats[_0x6925('0x7d')]%0xc8)){socket[_0x6925('0x92')](_0x6925('0x93')+_0x110f77,stats);stats[_0x6925('0x5b')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x31d526['abort']();}}catch(_0x1a71ff){handleError(_0x5495eb[_0x6925('0x7c')][_0x554001],{'code':'SystemError','message':_0x1a71ff[_0x6925('0x5d')]});logger[_0x6925('0x62')](_0x6925('0x94'),_0x1a71ff['message']);}},'complete':function(){try{var _0x2a4f6e=[];var _0x14ac1f=[];var _0x3abcdd=_0x6925('0x38');if(_0x5d9f0d[_0x6925('0x95')]&&_0x5d9f0d[_0x6925('0x95')][_0x6925('0x1c')]){_0x3abcdd=_0x6925('0x96')+_0x110f77;_0x2a4f6e[_0x6925('0x1d')]('CREATE\x20TABLE\x20'+_0x3abcdd+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x6925('0x97')+_0x110f77;tmp_voice_queues=_0x6925('0x98')+_0x110f77;_0x14ac1f[_0x6925('0x1d')](_0x6925('0x99')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x14ac1f[_0x6925('0x1d')](_0x6925('0x99')+tmp_voice_queues+_0x6925('0x9a'));BPromise[_0x6925('0x9b')](_0x14ac1f,handleTZQuery)[_0x6925('0x1b')](function(_0x2216e5){updateTzCampaigns(_0x5d9f0d[_0x6925('0x33')])[_0x6925('0x1b')](function(_0x47a753){updateTzVoiceQueues(_0x5d9f0d[_0x6925('0x33')])[_0x6925('0x1b')](function(_0x49cafd){if(hasTZ)_0x16111d=_0x16111d['replace']('dialTimezone','dialTimezone,utcOffset');var _0x3eda38=util[_0x6925('0xe')]('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',_0x42adfb,_0x3abcdd,_0x16111d,_0x5d9f0d[_0x6925('0x33')],_0x5d9f0d[_0x6925('0x51')]||null,NOW,NOW);if(_['isNil'](_0x535a16['scheduledat'])){_0x3eda38+=_0x6925('0x9c');}_0x2a4f6e[_0x6925('0x1d')](_0x3eda38);if(_0x5d9f0d['duplicates']&&_0x5d9f0d[_0x6925('0x95')]['length']){_0x2a4f6e[_0x6925('0x1d')](insertCmContact(_0x5d9f0d['ListId'],_0x3abcdd,_0x5d9f0d[_0x6925('0x95')],_0x535a16));_0x2a4f6e[_0x6925('0x1d')](_0x6925('0x9d')+_0x3abcdd+';');}BPromise['each'](_0x2a4f6e,handleQuery)['then'](function(_0x3bea8f){BPromise[_0x6925('0x1e')]([handleAdditionalPhones()])[_0x6925('0x1b')](function(){_0x2a4f6e=[];for(var _0x1f8fb4=0x0;_0x1f8fb4\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_'];(function(_0x38ea3f,_0x10f0ee){var _0x5297e1=function(_0x3f3069){while(--_0x3f3069){_0x38ea3f['push'](_0x38ea3f['shift']());}};_0x5297e1(++_0x10f0ee);}(_0xc54c,0x1c2));var _0xcc54=function(_0x587ba2,_0x42eb40){_0x587ba2=_0x587ba2-0x0;var _0x50ec73=_0xc54c[_0x587ba2];return _0x50ec73;};'use strict';var fs=require('fs');var path=require(_0xcc54('0x0'));var _=require('lodash');var Papa=require(_0xcc54('0x1'));var util=require('util');var BPromise=require(_0xcc54('0x2'));var moment=require('moment');var squel=require(_0xcc54('0x3'));var Redis=require(_0xcc54('0x4'));var db=require(_0xcc54('0x5'))['db'];var config=require(_0xcc54('0x6'));var logger=require('../../../config/logger')(_0xcc54('0x7'));config[_0xcc54('0x8')]=_[_0xcc54('0x9')](config['redis'],{'host':_0xcc54('0xa'),'port':0x18eb});var socket=require(_0xcc54('0xb'))(new Redis(config[_0xcc54('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xcc54('0xc')](_0xcc54('0xd'));var tempTableName=_0xcc54('0xe')+moment()['format'](_0xcc54('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x1f87ce){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))*$/[_0xcc54('0x10')](_0x1f87ce);}function selectNotIn(_0x1973af,_0x589e88,_0xc26530,_0x39a5d3,_0x127f2d){return squel['select']()[_0xcc54('0x11')](_0xcc54('0x12'))[_0xcc54('0x13')](_0x39a5d3)[_0xcc54('0x14')](_0x589e88,null,_0x589e88+_0xcc54('0x15')+_0x39a5d3+'.'+_0xc26530)['where'](_0x39a5d3+'.'+_0xc26530+_0xcc54('0x16')+_0x1973af+'.'+_0xc26530)[_0xcc54('0x17')](_0x589e88+_0xcc54('0x18')+_0x127f2d['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x57c26f,_0x3d380e){promisesAdditionalPhones=[];promisesContact=[];return db[_0xcc54('0x19')][_0xcc54('0x1a')](_0xcc54('0x1b')+tempTableName)[_0xcc54('0x1c')](function(_0x26feb8){if(_0x26feb8!==null){var _0x56e015=[];for(var _0x8f0098=0x0;_0x8f0098<_0x26feb8[_0xcc54('0x1d')];_0x8f0098++){var _0x537388=_0x26feb8[_0x8f0098];if(!_[_0xcc54('0x1e')](_0x537388['phone'])){if(!_[_0xcc54('0x1e')](_0x537388[_0xcc54('0x1f')]))_0x56e015[_0xcc54('0x20')](insertAdditionalPhones(_0x537388));promisesContact[_0xcc54('0x20')]({'contact':_0x537388});}}}Promise[_0xcc54('0x21')](_0x56e015)[_0xcc54('0x22')](function(){_0x57c26f({'val':0x1});});})['catch'](function(_0x5d6675){logger[_0xcc54('0x23')](_0x5d6675[_0xcc54('0x24')]);});});}function insertAdditionalPhones(_0xc6ac9e){return new Promise(function(_0x3b9df1,_0x4ed9f4){var _0x287310=_0xc6ac9e[_0xcc54('0x1f')];if(_[_0xcc54('0x1e')](_0x287310))_0x4ed9f4({'val':0x0});else{var _0x360b8a=_0x287310[_0xcc54('0x25')](';');var _0x108e63=[];orderBy=0x0;for(var _0x5b2c94=0x0;_0x5b2c94<_0x360b8a[_0xcc54('0x1d')];_0x5b2c94++){_0x108e63[_0xcc54('0x20')](splitAdditionalPhone(_0xc6ac9e['id'],_0x360b8a[_0x5b2c94]));}Promise[_0xcc54('0x21')](_0x108e63)[_0xcc54('0x22')](function(){_0x3b9df1({'val':_0x360b8a[_0xcc54('0x1d')]});});}});}function splitAdditionalPhone(_0x13be64,_0x3e5787){return new Promise(function(_0x43f9e3,_0x3ec10f){var _0x4ee369=_0x3e5787[_0xcc54('0x25')](':');var _0x1811e5=_0x4ee369[0x0];var _0x2a7270=_0x4ee369[0x1];if(_0x2a7270!==''){var _0xf2d040=_0x2a7270[_0xcc54('0x25')]('|');var _0x45fa24=[];for(var _0xffe9d2=0x0;_0xffe9d2<_0xf2d040[_0xcc54('0x1d')];_0xffe9d2++){if(_0xf2d040[_0xffe9d2]!==''){var _0x435591=_['filter'](promisesAdditionalPhones,{'contactId':_0x13be64,'phone':_0xf2d040[_0xffe9d2]});if(_0x435591[_0xcc54('0x1d')]==0x0){orderBy++;promisesAdditionalPhones[_0xcc54('0x20')]({'contactId':_0x13be64,'contactTypeId':_0x1811e5,'phone':_0xf2d040[_0xffe9d2],'orderBy':orderBy});}}}_0x43f9e3({'ok':0x1});}else _0x43f9e3({'res':0x0});});}function createAdditionalPhone(_0x12c6fe,_0x1e389a,_0x3757a2,_0x3ad280){var _0x11fb81='';var _0x361af6='';var _0xec6ccd=_0x3757a2[_0xcc54('0x25')]('§');_0x11fb81=_0xec6ccd[0x0];if(_0xec6ccd['length']==0x2)_0x361af6=_0xec6ccd[0x1];return new Promise(function(_0x5b67f7,_0x202971){return db['CmContactHasItem'][_0xcc54('0x26')]({'where':{'CmContactId':_0x12c6fe,'item':_0x11fb81}})['then'](function(_0x5e19e3){if(_0x5e19e3){return db[_0xcc54('0x27')][_0xcc54('0x28')]({'ItemTypeId':_0x1e389a,'description':_0x361af6,'OrderBy':_0x3ad280},{'where':{'CmContactId':_0x12c6fe,'item':_0x11fb81}})[_0xcc54('0x22')](function(_0x2207e5){_0x5b67f7({'res':_0xcc54('0x29')});});}else{return db[_0xcc54('0x27')][_0xcc54('0x2a')]({'CmContactId':_0x12c6fe,'item':_0x11fb81,'ItemTypeId':_0x1e389a,'description':_0x361af6,'OrderBy':_0x3ad280,'ItemClass':_0xcc54('0x2b')})[_0xcc54('0x22')](function(_0x2e5d1a){_0x5b67f7({'res':_0xcc54('0x2c')});});}});});}function updateContact(_0x1fd37b){return new Promise(function(_0x17a0e5,_0x4c5234){var _0x287506=_0x1fd37b['id'];delete _0x1fd37b['id'];return db['CmContact'][_0xcc54('0x28')](_0x1fd37b,{'where':{'id':_0x287506}})[_0xcc54('0x22')](function(_0x543f32){updatedRows+=0x1;return db[_0xcc54('0x2d')][_0xcc54('0x28')]({'phone':_0x1fd37b[_0xcc54('0x12')]},{'where':{'ContactId':_0x287506}})[_0xcc54('0x22')](function(_0x31c7cc){_0x17a0e5({'ret':'OK'});});});});}function insertCmHopper(_0x2e9de9,_0x1f9c7c,_0x964a,_0x58380a,_0x23dd55){var _0x47c3e=[_0xcc54('0x2e'),'cm_contacts.scheduledat',_0xcc54('0x2f'),_0xcc54('0x30'),_0x1f9c7c+'.'+_0x58380a,_0xcc54('0x31'),_0xcc54('0x32'),_0xcc54('0x33'),_0xcc54('0x34'),'\x22'+_0x23dd55+'\x22'];return squel[_0xcc54('0x35')]()[_0xcc54('0x36')]('cm_hopper')['fromQuery'](['phone',_0xcc54('0x37'),_0xcc54('0x38'),_0xcc54('0x39'),_0x58380a,'createdAt','updatedAt','priority',_0xcc54('0x3a'),_0xcc54('0x3b')],squel[_0xcc54('0x3c')]()[_0xcc54('0x3d')](_0x47c3e)[_0xcc54('0x13')](_0x1f9c7c)[_0xcc54('0x14')](_0xcc54('0x3e'),null,_0xcc54('0x3f')+_0x1f9c7c+_0xcc54('0x40'))[_0xcc54('0x14')](_0x964a,null,_0x964a+'.id\x20=\x20'+_0x1f9c7c+'.'+_0x58380a)['where'](_0x1f9c7c+_0xcc54('0x41'),_0x2e9de9)[_0xcc54('0x17')](_0xcc54('0x42'),NOW)[_0xcc54('0x17')](_0xcc54('0x43'),selectNotIn(_0x1f9c7c,_0x964a,_0x58380a,_0xcc54('0x44'),[_0xcc54('0x45'),_0xcc54('0x46')]))[_0xcc54('0x17')](_0xcc54('0x43'),selectNotIn(_0x1f9c7c,_0x964a,_0x58380a,_0xcc54('0x44'),[_0xcc54('0x45')])))[_0xcc54('0x47')]();}function insertCmHopperBlack(_0x31715a,_0x5d38d8,_0x588af3,_0x50f595){var _0x38d502=[_0xcc54('0x2e'),_0xcc54('0x2f'),'cm_contacts.ListId',_0x5d38d8+'.'+_0x50f595,_0xcc54('0x31'),_0xcc54('0x32')];return squel[_0xcc54('0x35')]()[_0xcc54('0x36')](_0xcc54('0x48'))[_0xcc54('0x49')](['phone',_0xcc54('0x38'),_0xcc54('0x39'),_0x50f595,_0xcc54('0x4a'),'updatedAt'],squel[_0xcc54('0x3c')]()[_0xcc54('0x3d')](_0x38d502)[_0xcc54('0x13')](_0x5d38d8)['join']('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x5d38d8+_0xcc54('0x40'))[_0xcc54('0x14')](_0x588af3,null,_0x588af3+_0xcc54('0x15')+_0x5d38d8+'.'+_0x50f595)[_0xcc54('0x17')](_0x5d38d8+'.CmListId\x20=\x20?',_0x31715a)[_0xcc54('0x17')](_0xcc54('0x42'),NOW)[_0xcc54('0x17')](_0xcc54('0x43'),squel[_0xcc54('0x3c')]()[_0xcc54('0x11')](_0xcc54('0x12'))[_0xcc54('0x13')](_0xcc54('0x48'))[_0xcc54('0x17')]('ListId\x20=\x20?',_0x31715a)['where'](_0x50f595+_0xcc54('0x4b'),_0x5d38d8+'.'+_0x50f595)))[_0xcc54('0x47')]();}function insertCmHopperAdditionalPhones(_0x2affae){var _0x3ea5a9=[_0xcc54('0x4c'),_0xcc54('0x4d'),'cm_contact_has_items.OrderBy',_0xcc54('0x4e'),'cm_contact_has_items.updatedAt'];return squel['insert']()[_0xcc54('0x36')]('cm_hopper_additional_phones')[_0xcc54('0x49')](['CmHopperId',_0xcc54('0x12'),'OrderBy','createdAt',_0xcc54('0x4f')],squel[_0xcc54('0x3c')]()[_0xcc54('0x3d')](_0x3ea5a9)[_0xcc54('0x13')](_0xcc54('0x44'))[_0xcc54('0x14')](_0xcc54('0x3e'),null,_0xcc54('0x50'))[_0xcc54('0x14')](_0xcc54('0x51'),null,_0xcc54('0x52'))[_0xcc54('0x17')]('cm_hopper.ListId\x20=\x20?',_0x2affae)[_0xcc54('0x17')](_0xcc54('0x42'),NOW))['toString']();}function insertCmContact(_0x1ebd09,_0x39759f,_0x465917,_0x1ca75d){var _0x54e71c=_['concat'](_['keys'](_0x1ca75d),[_0xcc54('0x39'),_0xcc54('0x53'),_0xcc54('0x4a'),_0xcc54('0x4f')]);return squel[_0xcc54('0x35')]()['into'](_0xcc54('0x3e'))['fromQuery'](_0x54e71c,squel[_0xcc54('0x3c')]()['fields'](_0x54e71c)[_0xcc54('0x13')](_0x39759f)['where']('('+_0x465917[_0xcc54('0x14')](',')+_0xcc54('0x54'),squel[_0xcc54('0x3c')]()[_0xcc54('0x3d')](_0x465917)[_0xcc54('0x13')](_0xcc54('0x3e'))[_0xcc54('0x17')](_0xcc54('0x55'),_0x1ebd09))[_0xcc54('0x17')]('id\x20IN\x20?',squel[_0xcc54('0x3c')]()[_0xcc54('0x11')]('MIN(id)','min_id')[_0xcc54('0x13')](_0x39759f)[_0xcc54('0x56')](_0x465917['join'](','))))[_0xcc54('0x47')]();}function handleStop(){logger[_0xcc54('0x57')](_0xcc54('0x58'));stopped=!![];}function handleUncaughtException(_0x1f8d44){logger['error'](_0x1f8d44['message']);process[_0xcc54('0x59')](0x1);}function handleError(_0x5d5eaa,_0x26f00a){stats[_0xcc54('0x5a')][_0xcc54('0x20')]({'name':_0x26f00a[_0xcc54('0x5b')],'message':_0x26f00a[_0xcc54('0x24')],'row':_0x5d5eaa});}function handleQuery(_0x1c1c2f){logger[_0xcc54('0x57')](_0x1c1c2f);return db[_0xcc54('0x19')][_0xcc54('0x1a')](_0x1c1c2f)['spread'](function(_0x3349b1){results[_0xcc54('0x20')](_0x3349b1);})[_0xcc54('0x5c')](function(_0x2c523e){logger['error'](_0x2c523e[_0xcc54('0x24')]);});}function main(_0x2c55f1,_0x4496b8,_0x48be00,_0x212ca9){logger[_0xcc54('0x57')](_0xcc54('0x5d'),_0x2c55f1,JSON[_0xcc54('0x5e')](_0x4496b8));process['send']('start');var _0x4c3d52=_0x4496b8[_0xcc54('0x5f')];var _0x1907b4=_[_0xcc54('0x60')](_0x4c3d52);var _0x344cd5=_0x4496b8[_0xcc54('0x61')];var _0xde29ea=path[_0xcc54('0x14')](config['root'],_0xcc54('0x62'),_0x344cd5+'.csv');logger['info'](_0xcc54('0x63'),_0x4496b8);db['ContactItemType'][_0xcc54('0x64')]({'raw':!![],'attributes':['id',_0xcc54('0x65')]})[_0xcc54('0x22')](function(_0x3c4436){for(var _0x4d7c6c=0x0;_0x4d7c6c<_0x3c4436[_0xcc54('0x1d')];_0x4d7c6c++){if(_0x3c4436[_0x4d7c6c][_0xcc54('0x65')]in _0x4c3d52){contactItemTypes['push'](_0x3c4436[_0x4d7c6c]);delete _0x1907b4[_0x3c4436[_0x4d7c6c][_0xcc54('0x65')]];hasAdditionalPhones=!![];}for(var _0x18b7cc in _0x4c3d52){if(_0x3c4436[_0x4d7c6c][_0xcc54('0x65')]+_0xcc54('0x66')===_0x18b7cc){phoneDescriptions[_0xcc54('0x20')]({'itemTypeId':_0x3c4436[_0x4d7c6c]['id'],'description':_0x18b7cc});delete _0x1907b4[_0x18b7cc];}}}if(hasAdditionalPhones)_0x1907b4['AdditionalPhones']='';var _0x87b7c1=_[_0xcc54('0x67')](_0x1907b4)[_0xcc54('0x14')]();logger[_0xcc54('0x57')]('header',_0x87b7c1);fs[_0xcc54('0x68')](_0xde29ea,_0x87b7c1+'\x0a');Papa[_0xcc54('0x69')](fs[_0xcc54('0x6a')](_0x2c55f1),{'header':!![],'skipEmptyLines':!![],'step':function(_0x75a516,_0x33b729){try{for(var _0x3d7ec8=0x0,_0x27e1bf=[];_0x3d7ec8<_0x75a516['data']['length'];_0x3d7ec8++){stats[_0xcc54('0x6b')]+=0x1;if(_0x75a516[_0xcc54('0x5a')][_0x3d7ec8]){handleError(_0x75a516['data'][_0x3d7ec8],_0x75a516[_0xcc54('0x5a')][_0x3d7ec8]);}else{var _0xddef2c=[];var _0x22eb82=[];var _0x3a9d22={};for(var _0x2936e0 in _0x4c3d52){let _0x155cca=contactItemTypes[_0xcc54('0x6c')](_0x54f3d5=>_0x54f3d5[_0xcc54('0x65')]===_0x2936e0);let _0xf96aa4=contactItemTypes['find'](_0x2a18cc=>_0x2a18cc[_0xcc54('0x65')]+_0xcc54('0x66')===_0x2936e0);if(_[_0xcc54('0x1e')](_0x155cca)&&_[_0xcc54('0x1e')](_0xf96aa4)){if(_0x4c3d52[_0xcc54('0x6d')](_0x2936e0)){if(_0x75a516[_0xcc54('0x6e')][_0x3d7ec8][_0x4c3d52[_0x2936e0]]){var _0x1e34ef=_[_0xcc54('0x6f')](_0x75a516[_0xcc54('0x6e')][_0x3d7ec8][_0x4c3d52[_0x2936e0]][_0xcc54('0x70')](/"/g,'\x27'));switch(_0x2936e0){case'scheduledat':var _0x7dcad9=moment(_0x1e34ef,_0xcc54('0xd'),!![]);if(_0x7dcad9[_0xcc54('0x71')]()){_0x27e1bf['push']('\x22'+_0x1e34ef+'\x22');}else{_0xddef2c[_0xcc54('0x20')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xcc54('0x72'):var _0x57ae11=parseInt(_0x1e34ef);_0x1e34ef=_[_0xcc54('0x73')](_0x57ae11)||_0x57ae11<0x0||_0x57ae11>0x4?_0x212ca9?0x3:0x2:_0x57ae11;_0x27e1bf['push']('\x22'+_0x1e34ef+'\x22');break;case'UserId':var _0x5a5cad=parseInt(_0x1e34ef);if(_[_0xcc54('0x74')](_0x5a5cad)&&_[_0xcc54('0x75')](_0x48be00,_0x5a5cad)){_0x27e1bf[_0xcc54('0x20')]('\x22'+_0x5a5cad+'\x22');}else{_0xddef2c[_0xcc54('0x20')]('agent\x20not\x20exists');}break;case _0xcc54('0x76'):if(isEmail(_0x1e34ef)){_0x27e1bf[_0xcc54('0x20')]('\x22'+_0x1e34ef+'\x22');}else{_0xddef2c[_0xcc54('0x20')](_0xcc54('0x77'));}break;case _0xcc54('0x78'):var _0x292346=moment(_0x1e34ef,_0xcc54('0x79'),!![]);if(_0x292346[_0xcc54('0x71')]()){_0x27e1bf['push']('\x22'+_0x1e34ef+'\x22');}else{_0xddef2c[_0xcc54('0x20')](_0xcc54('0x7a'));}break;default:_0x27e1bf[_0xcc54('0x20')]('\x22'+_0x1e34ef+'\x22');}}else{switch(_0x2936e0){case _0xcc54('0x7b'):case _0xcc54('0x12'):_0xddef2c[_0xcc54('0x20')](_0x2936e0+_0xcc54('0x7c'));break;default:_0x27e1bf['push']('\x22\x22');}}}}else{var _0xa800db='';if(!_[_0xcc54('0x1e')](_0x155cca)){if(!_0x3a9d22[_0xcc54('0x6d')](_0x155cca['id'])){for(var _0xd0f8de=0x0;_0xd0f8de<_0x4c3d52[_0x2936e0][_0xcc54('0x1d')];_0xd0f8de++){var _0x1e34ef=_[_0xcc54('0x6f')](_0x75a516[_0xcc54('0x6e')][_0x3d7ec8][_0x4c3d52[_0x2936e0][_0xd0f8de]][_0xcc54('0x70')](/"/g,'\x27'));var _0x2bec35=phoneDescriptions[_0xcc54('0x6c')](_0x166aa0=>_0x166aa0[_0xcc54('0x7d')]===_0x155cca['id']);if(!_[_0xcc54('0x1e')](_0x2bec35)){var _0xe7570e=_[_0xcc54('0x6f')](_0x75a516[_0xcc54('0x6e')][_0x3d7ec8][_0x4c3d52[_0x2bec35['description']][0x0]][_0xcc54('0x70')](/"/g,'\x27'));if(!_[_0xcc54('0x1e')](_0xe7570e))_0x1e34ef=_0x1e34ef+'§'+_0xe7570e;}if(_0xa800db=='')_0xa800db=_0x1e34ef;else _0xa800db+='|'+_0x1e34ef;}_0x22eb82[_0xcc54('0x20')](_0x155cca['id']+':'+_0xa800db);_0x3a9d22[_0x155cca['id']]=0x1;}}}}if(hasAdditionalPhones){_0x27e1bf[_0xcc54('0x20')]('\x22'+_0x22eb82['join'](';')+'\x22');}if(_0xddef2c[_0xcc54('0x1d')]){handleError(_0x75a516[_0xcc54('0x6e')][_0x3d7ec8],{'code':_0xcc54('0x7e'),'message':_0xddef2c[_0xcc54('0x14')]()});}else{fs[_0xcc54('0x7f')](_0xde29ea,_0x27e1bf[_0xcc54('0x14')]()+'\x0a');}_0x27e1bf=[];}if(!(stats[_0xcc54('0x6b')]%0xc8)){socket[_0xcc54('0x80')]('contact:import:'+_0x344cd5,stats);stats[_0xcc54('0x5a')]=[];}}if(stopped){logger[_0xcc54('0x57')]('Abort\x20parser');_0x33b729[_0xcc54('0x81')]();}}catch(_0x4187ff){handleError(_0x75a516[_0xcc54('0x6e')][_0x3d7ec8],{'code':_0xcc54('0x82'),'message':_0x4187ff[_0xcc54('0x24')]});logger['error']('step',_0x4187ff[_0xcc54('0x24')]);}},'complete':function(){try{var _0x43de85=[];var _0x45551b=tempTableName;_0x43de85[_0xcc54('0x20')](_0xcc54('0x83')+_0x45551b+_0xcc54('0x84'));logger[_0xcc54('0x57')](_0xcc54('0x85'),contactItemTypes[_0xcc54('0x1d')]);var _0x3fe6c1=util[_0xcc54('0xc')](_0xcc54('0x86'),_0xde29ea,_0x45551b,_0x87b7c1,_0x4496b8['ListId'],_0x4496b8[_0xcc54('0x53')]||null,NOW,NOW);if(_['isNil'](_0x4c3d52[_0xcc54('0x37')])){_0x3fe6c1+=',\x20scheduledAt\x20=\x20NOW()';}_0x43de85[_0xcc54('0x20')](_0x3fe6c1);BPromise['each'](_0x43de85,handleQuery)[_0xcc54('0x22')](function(_0x106ab8){BPromise[_0xcc54('0x21')]([handleAdditionalPhones()])[_0xcc54('0x22')](function(){_0x43de85=[];for(var _0x56455=0x0;_0x56455\x20\x20','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/logger','defaults','socket.io-emitter','redis','format','YYYY-MM-DD\x20HH:mm:ss','YYYYMMDDHHmmss','test','select','phone','from','join','.id\x20=\x20','where','\x20=\x20','sequelize','query','spread','length','AdditionalPhones','push','all','then','catch','error','isNil','split','filter','CmContactHasItem','findOne','updated','create','PHONE','inserted','CmContact','update','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','fromQuery','scheduledat','ContactId','ListId','updatedAt','UserId','recallme','fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_hopper','toString','cm_hopper_black','createdAt','field','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?'];(function(_0xa42ad0,_0x8308d3){var _0x53a21b=function(_0x114197){while(--_0x114197){_0xa42ad0['push'](_0xa42ad0['shift']());}};_0x53a21b(++_0x8308d3);}(_0xc022,0x173));var _0x2c02=function(_0x19e89d,_0x4793ce){_0x19e89d=_0x19e89d-0x0;var _0x48aeed=_0xc022[_0x19e89d];return _0x48aeed;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x2c02('0x0'));var Papa=require(_0x2c02('0x1'));var util=require(_0x2c02('0x2'));var BPromise=require(_0x2c02('0x3'));var moment=require(_0x2c02('0x4'));var squel=require(_0x2c02('0x5'));var Redis=require('ioredis');var db=require(_0x2c02('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0x2c02('0x7'))('import');config['redis']=_[_0x2c02('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2c02('0x9'))(new Redis(config[_0x2c02('0xa')]));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()[_0x2c02('0xb')](_0x2c02('0xc'));var tempTableName='cm_contacts_temp_'+moment()[_0x2c02('0xb')](_0x2c02('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0xd522c7){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))*$/[_0x2c02('0xe')](_0xd522c7);}function selectNotIn(_0x514f6a,_0x8394a9,_0x47b4f8,_0x4b72ea,_0x27e727){return squel[_0x2c02('0xf')]()['field'](_0x2c02('0x10'))[_0x2c02('0x11')](_0x4b72ea)[_0x2c02('0x12')](_0x8394a9,null,_0x8394a9+_0x2c02('0x13')+_0x4b72ea+'.'+_0x47b4f8)[_0x2c02('0x14')](_0x4b72ea+'.'+_0x47b4f8+_0x2c02('0x15')+_0x514f6a+'.'+_0x47b4f8)[_0x2c02('0x14')](_0x8394a9+'.dialCheckDuplicateType\x20IN\x20('+_0x27e727[_0x2c02('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x29f647,_0x26c1fa){promisesAdditionalPhones=[];promisesContact=[];return db[_0x2c02('0x16')][_0x2c02('0x17')]('select\x20*\x20from\x20'+tempTableName)[_0x2c02('0x18')](function(_0x15d347){if(_0x15d347!==null){var _0x770f2e=[];for(var _0x2cd047=0x0;_0x2cd047<_0x15d347[_0x2c02('0x19')];_0x2cd047++){var _0x3ea64d=_0x15d347[_0x2cd047];if(!_['isNil'](_0x3ea64d[_0x2c02('0x10')])){if(!_['isNil'](_0x3ea64d[_0x2c02('0x1a')]))_0x770f2e[_0x2c02('0x1b')](insertAdditionalPhones(_0x3ea64d));promisesContact['push']({'contact':_0x3ea64d});}}}Promise[_0x2c02('0x1c')](_0x770f2e)[_0x2c02('0x1d')](function(){_0x29f647({'val':0x1});});})[_0x2c02('0x1e')](function(_0x168aae){logger[_0x2c02('0x1f')](_0x168aae['message']);});});}function insertAdditionalPhones(_0x1466de){return new Promise(function(_0x4bbb40,_0x220138){var _0x6a7159=_0x1466de[_0x2c02('0x1a')];if(_[_0x2c02('0x20')](_0x6a7159))_0x220138({'val':0x0});else{var _0x19ceaf=_0x6a7159['split'](';');var _0x29ea3b=[];orderBy=0x0;for(var _0x3adf3e=0x0;_0x3adf3e<_0x19ceaf[_0x2c02('0x19')];_0x3adf3e++){_0x29ea3b[_0x2c02('0x1b')](splitAdditionalPhone(_0x1466de['id'],_0x19ceaf[_0x3adf3e]));}Promise['all'](_0x29ea3b)['then'](function(){_0x4bbb40({'val':_0x19ceaf['length']});});}});}function splitAdditionalPhone(_0x506131,_0x5c75e8){return new Promise(function(_0x3c0a11,_0x552719){var _0x38e5ab=_0x5c75e8[_0x2c02('0x21')](':');var _0x432f42=_0x38e5ab[0x0];var _0x2b14b2=_0x38e5ab[0x1];if(_0x2b14b2!==''){var _0x223176=_0x2b14b2['split']('|');var _0x2c15a2=[];for(var _0x5ada48=0x0;_0x5ada48<_0x223176[_0x2c02('0x19')];_0x5ada48++){if(_0x223176[_0x5ada48]!==''){var _0x32d20b=_[_0x2c02('0x22')](promisesAdditionalPhones,{'contactId':_0x506131,'phone':_0x223176[_0x5ada48]});if(_0x32d20b['length']==0x0){orderBy++;promisesAdditionalPhones[_0x2c02('0x1b')]({'contactId':_0x506131,'contactTypeId':_0x432f42,'phone':_0x223176[_0x5ada48],'orderBy':orderBy});}}}_0x3c0a11({'ok':0x1});}else _0x3c0a11({'res':0x0});});}function createAdditionalPhone(_0x55158f,_0x1077fc,_0x4876df,_0x2d72fc){var _0x273884='';var _0x54b8c9='';var _0x26cc30=_0x4876df[_0x2c02('0x21')]('§');_0x273884=_0x26cc30[0x0];if(_0x26cc30[_0x2c02('0x19')]==0x2)_0x54b8c9=_0x26cc30[0x1];return new Promise(function(_0x45d2da,_0x19a237){return db[_0x2c02('0x23')][_0x2c02('0x24')]({'where':{'CmContactId':_0x55158f,'item':_0x273884}})[_0x2c02('0x1d')](function(_0x297754){if(_0x297754){return db[_0x2c02('0x23')]['update']({'ItemTypeId':_0x1077fc,'description':_0x54b8c9,'OrderBy':_0x2d72fc},{'where':{'CmContactId':_0x55158f,'item':_0x273884}})[_0x2c02('0x1d')](function(_0x514acb){_0x45d2da({'res':_0x2c02('0x25')});});}else{return db[_0x2c02('0x23')][_0x2c02('0x26')]({'CmContactId':_0x55158f,'item':_0x273884,'ItemTypeId':_0x1077fc,'description':_0x54b8c9,'OrderBy':_0x2d72fc,'ItemClass':_0x2c02('0x27')})[_0x2c02('0x1d')](function(_0x357d5f){_0x45d2da({'res':_0x2c02('0x28')});});}});});}function updateContact(_0x5624ea){return new Promise(function(_0x492334,_0x447408){var _0x1d699e=_0x5624ea['id'];delete _0x5624ea['id'];return db[_0x2c02('0x29')][_0x2c02('0x2a')](_0x5624ea,{'where':{'id':_0x1d699e}})[_0x2c02('0x1d')](function(_0x2d2335){updatedRows+=0x1;return db['CmHopper'][_0x2c02('0x2a')]({'phone':_0x5624ea['phone']},{'where':{'ContactId':_0x1d699e}})[_0x2c02('0x1d')](function(_0x1cb3f2){_0x492334({'ret':'OK'});});});});}function insertCmHopper(_0x4defa0,_0x80665d,_0x17153e,_0x52345f,_0x3f4779){var _0x5d1a07=[_0x2c02('0x2b'),_0x2c02('0x2c'),_0x2c02('0x2d'),_0x2c02('0x2e'),_0x80665d+'.'+_0x52345f,_0x2c02('0x2f'),_0x2c02('0x30'),_0x2c02('0x31'),'cm_contacts.UserId','\x22'+_0x3f4779+'\x22'];return squel[_0x2c02('0x32')]()[_0x2c02('0x33')]('cm_hopper')[_0x2c02('0x34')](['phone',_0x2c02('0x35'),_0x2c02('0x36'),_0x2c02('0x37'),_0x52345f,'createdAt',_0x2c02('0x38'),'priority',_0x2c02('0x39'),_0x2c02('0x3a')],squel['select']()[_0x2c02('0x3b')](_0x5d1a07)[_0x2c02('0x11')](_0x80665d)[_0x2c02('0x12')](_0x2c02('0x3c'),null,'cm_contacts.ListId\x20=\x20'+_0x80665d+_0x2c02('0x3d'))[_0x2c02('0x12')](_0x17153e,null,_0x17153e+_0x2c02('0x13')+_0x80665d+'.'+_0x52345f)[_0x2c02('0x14')](_0x80665d+_0x2c02('0x3e'),_0x4defa0)['where'](_0x2c02('0x3f'),NOW)[_0x2c02('0x14')](_0x2c02('0x40'),selectNotIn(_0x80665d,_0x17153e,_0x52345f,'cm_hopper',[_0x2c02('0x41'),_0x2c02('0x42')]))[_0x2c02('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x80665d,_0x17153e,_0x52345f,_0x2c02('0x43'),[_0x2c02('0x41')])))[_0x2c02('0x44')]();}function insertCmHopperBlack(_0x2ff69d,_0x10ed59,_0xff095c,_0x4289df){var _0x212e87=['cm_contacts.phone','cm_contacts.id','cm_contacts.ListId',_0x10ed59+'.'+_0x4289df,'cm_contacts.createdAt',_0x2c02('0x30')];return squel[_0x2c02('0x32')]()[_0x2c02('0x33')](_0x2c02('0x45'))['fromQuery']([_0x2c02('0x10'),_0x2c02('0x36'),'ListId',_0x4289df,_0x2c02('0x46'),_0x2c02('0x38')],squel[_0x2c02('0xf')]()[_0x2c02('0x3b')](_0x212e87)['from'](_0x10ed59)[_0x2c02('0x12')](_0x2c02('0x3c'),null,'cm_contacts.ListId\x20=\x20'+_0x10ed59+_0x2c02('0x3d'))[_0x2c02('0x12')](_0xff095c,null,_0xff095c+'.id\x20=\x20'+_0x10ed59+'.'+_0x4289df)[_0x2c02('0x14')](_0x10ed59+'.CmListId\x20=\x20?',_0x2ff69d)[_0x2c02('0x14')](_0x2c02('0x3f'),NOW)[_0x2c02('0x14')](_0x2c02('0x40'),squel[_0x2c02('0xf')]()[_0x2c02('0x47')](_0x2c02('0x10'))['from']('cm_hopper_black')[_0x2c02('0x14')](_0x2c02('0x48'),_0x2ff69d)[_0x2c02('0x14')](_0x4289df+_0x2c02('0x49'),_0x10ed59+'.'+_0x4289df)))['toString']();}function insertCmHopperAdditionalPhones(_0x161a10){var _0x4b2c0a=[_0x2c02('0x4a'),'cm_contact_has_items.item',_0x2c02('0x4b'),_0x2c02('0x4c'),'cm_contact_has_items.updatedAt'];return squel[_0x2c02('0x32')]()['into'](_0x2c02('0x4d'))[_0x2c02('0x34')]([_0x2c02('0x4e'),_0x2c02('0x10'),_0x2c02('0x4f'),_0x2c02('0x46'),_0x2c02('0x38')],squel[_0x2c02('0xf')]()[_0x2c02('0x3b')](_0x4b2c0a)['from'](_0x2c02('0x43'))['join'](_0x2c02('0x3c'),null,_0x2c02('0x50'))[_0x2c02('0x12')]('cm_contact_has_items',null,_0x2c02('0x51'))[_0x2c02('0x14')](_0x2c02('0x52'),_0x161a10)[_0x2c02('0x14')](_0x2c02('0x3f'),NOW))['toString']();}function insertCmContact(_0x201abc,_0x825df,_0x395d00,_0x2ffccc){var _0x5d862d=_[_0x2c02('0x53')](_[_0x2c02('0x54')](_0x2ffccc),[_0x2c02('0x37'),_0x2c02('0x55'),_0x2c02('0x46'),_0x2c02('0x38')]);return squel['insert']()[_0x2c02('0x33')](_0x2c02('0x3c'))['fromQuery'](_0x5d862d,squel[_0x2c02('0xf')]()[_0x2c02('0x3b')](_0x5d862d)['from'](_0x825df)[_0x2c02('0x14')]('('+_0x395d00[_0x2c02('0x12')](',')+_0x2c02('0x56'),squel['select']()[_0x2c02('0x3b')](_0x395d00)[_0x2c02('0x11')]('cm_contacts')[_0x2c02('0x14')](_0x2c02('0x48'),_0x201abc))[_0x2c02('0x14')](_0x2c02('0x57'),squel[_0x2c02('0xf')]()[_0x2c02('0x47')]('MIN(id)',_0x2c02('0x58'))[_0x2c02('0x11')](_0x825df)['group'](_0x395d00[_0x2c02('0x12')](','))))[_0x2c02('0x44')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x35a6bf){logger[_0x2c02('0x1f')](_0x35a6bf['message']);process[_0x2c02('0x59')](0x1);}function handleError(_0x5c60e8,_0x3c68d8){stats[_0x2c02('0x5a')][_0x2c02('0x1b')]({'name':_0x3c68d8['code'],'message':_0x3c68d8[_0x2c02('0x5b')],'row':_0x5c60e8});}function handleQuery(_0x44fcae){logger[_0x2c02('0x5c')](_0x44fcae);return db[_0x2c02('0x16')][_0x2c02('0x17')](_0x44fcae)[_0x2c02('0x18')](function(_0x3f613b){results['push'](_0x3f613b);})[_0x2c02('0x1e')](function(_0xfb87c5){logger[_0x2c02('0x1f')](_0xfb87c5['message']);});}function main(_0x13ab80,_0x2b58d5,_0x2bcd66,_0x16f17f){logger[_0x2c02('0x5c')](_0x2c02('0x5d'),_0x13ab80,JSON['stringify'](_0x2b58d5));process[_0x2c02('0x5e')](_0x2c02('0x5f'));var _0x38af9f=_0x2b58d5[_0x2c02('0x60')];var _0x311e35=_[_0x2c02('0x61')](_0x38af9f);var _0x5e97ab=_0x2b58d5[_0x2c02('0x62')];var _0xa1d914=path[_0x2c02('0x12')](config[_0x2c02('0x63')],'server/files/tmp',_0x5e97ab+_0x2c02('0x64'));logger[_0x2c02('0x5c')](_0x2c02('0x65'),_0x2b58d5);db[_0x2c02('0x66')]['findAll']({'raw':!![],'attributes':['id','name']})[_0x2c02('0x1d')](function(_0x2ecd13){for(var _0x51a410=0x0;_0x51a410<_0x2ecd13[_0x2c02('0x19')];_0x51a410++){if(_0x2ecd13[_0x51a410][_0x2c02('0x67')]in _0x38af9f){contactItemTypes[_0x2c02('0x1b')](_0x2ecd13[_0x51a410]);delete _0x311e35[_0x2ecd13[_0x51a410][_0x2c02('0x67')]];hasAdditionalPhones=!![];}for(var _0x2daf06 in _0x38af9f){if(_0x2ecd13[_0x51a410][_0x2c02('0x67')]+_0x2c02('0x68')===_0x2daf06){phoneDescriptions['push']({'itemTypeId':_0x2ecd13[_0x51a410]['id'],'description':_0x2daf06});delete _0x311e35[_0x2daf06];}}}if(hasAdditionalPhones)_0x311e35[_0x2c02('0x1a')]='';var _0x43ca49=_[_0x2c02('0x54')](_0x311e35)[_0x2c02('0x12')]();logger[_0x2c02('0x5c')]('header',_0x43ca49);fs[_0x2c02('0x69')](_0xa1d914,_0x43ca49+'\x0a');Papa[_0x2c02('0x6a')](fs[_0x2c02('0x6b')](_0x13ab80),{'header':!![],'skipEmptyLines':!![],'step':function(_0x378e07,_0x25fe37){try{for(var _0x12d4cb=0x0,_0x4b660a=[];_0x12d4cb<_0x378e07['data'][_0x2c02('0x19')];_0x12d4cb++){stats[_0x2c02('0x6c')]+=0x1;if(_0x378e07['errors'][_0x12d4cb]){handleError(_0x378e07[_0x2c02('0x6d')][_0x12d4cb],_0x378e07[_0x2c02('0x5a')][_0x12d4cb]);}else{var _0x118e1e=[];var _0x85e915=[];var _0x58f44f={};for(var _0x3e0153 in _0x38af9f){let _0x1b730a=contactItemTypes['find'](_0x2a2e6c=>_0x2a2e6c[_0x2c02('0x67')]===_0x3e0153);let _0x2fa8c0=contactItemTypes[_0x2c02('0x6e')](_0x4471aa=>_0x4471aa[_0x2c02('0x67')]+_0x2c02('0x68')===_0x3e0153);if(_[_0x2c02('0x20')](_0x1b730a)&&_['isNil'](_0x2fa8c0)){if(_0x38af9f[_0x2c02('0x6f')](_0x3e0153)){if(_0x378e07[_0x2c02('0x6d')][_0x12d4cb][_0x38af9f[_0x3e0153]]){var _0x183836=_['trim'](_0x378e07['data'][_0x12d4cb][_0x38af9f[_0x3e0153]][_0x2c02('0x70')](/"/g,'\x27'));switch(_0x3e0153){case _0x2c02('0x35'):var _0x4888c5=moment(_0x183836,_0x2c02('0xc'),!![]);if(_0x4888c5[_0x2c02('0x71')]()){_0x4b660a[_0x2c02('0x1b')]('\x22'+_0x183836+'\x22');}else{_0x118e1e[_0x2c02('0x1b')](_0x2c02('0x72'));}break;case _0x2c02('0x73'):var _0x2897ea=parseInt(_0x183836);_0x183836=_[_0x2c02('0x74')](_0x2897ea)||_0x2897ea<0x0||_0x2897ea>0x4?_0x16f17f?0x3:0x2:_0x2897ea;_0x4b660a[_0x2c02('0x1b')]('\x22'+_0x183836+'\x22');break;case'UserId':var _0x44d10a=parseInt(_0x183836);if(_['isNumber'](_0x44d10a)&&_[_0x2c02('0x75')](_0x2bcd66,_0x44d10a)){_0x4b660a[_0x2c02('0x1b')]('\x22'+_0x44d10a+'\x22');}else{_0x118e1e[_0x2c02('0x1b')](_0x2c02('0x76'));}break;case _0x2c02('0x77'):if(isEmail(_0x183836)){_0x4b660a[_0x2c02('0x1b')]('\x22'+_0x183836+'\x22');}else{_0x118e1e['push'](_0x2c02('0x78'));}break;case'dateOfBirth':var _0x392fa8=moment(_0x183836,_0x2c02('0x79'),!![]);if(_0x392fa8[_0x2c02('0x71')]()){_0x4b660a['push']('\x22'+_0x183836+'\x22');}else{_0x118e1e[_0x2c02('0x1b')](_0x2c02('0x7a'));}break;default:_0x4b660a[_0x2c02('0x1b')]('\x22'+_0x183836+'\x22');}}else{switch(_0x3e0153){case'firstName':case _0x2c02('0x10'):_0x118e1e['push'](_0x3e0153+_0x2c02('0x7b'));break;default:_0x4b660a['push']('\x22\x22');}}}}else{var _0x4d05a3='';if(!_[_0x2c02('0x20')](_0x1b730a)){if(!_0x58f44f[_0x2c02('0x6f')](_0x1b730a['id'])){for(var _0x395740=0x0;_0x395740<_0x38af9f[_0x3e0153][_0x2c02('0x19')];_0x395740++){var _0x183836=_[_0x2c02('0x7c')](_0x378e07[_0x2c02('0x6d')][_0x12d4cb][_0x38af9f[_0x3e0153][_0x395740]]['replace'](/"/g,'\x27'));var _0xecdeb1=phoneDescriptions[_0x2c02('0x6e')](_0x18ee20=>_0x18ee20[_0x2c02('0x7d')]===_0x1b730a['id']);if(!_['isNil'](_0xecdeb1)){var _0x43c7a9=_['trim'](_0x378e07['data'][_0x12d4cb][_0x38af9f[_0xecdeb1[_0x2c02('0x7e')]][0x0]][_0x2c02('0x70')](/"/g,'\x27'));if(!_['isNil'](_0x43c7a9))_0x183836=_0x183836+'§'+_0x43c7a9;}if(_0x4d05a3=='')_0x4d05a3=_0x183836;else _0x4d05a3+='|'+_0x183836;}_0x85e915['push'](_0x1b730a['id']+':'+_0x4d05a3);_0x58f44f[_0x1b730a['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4b660a['push']('\x22'+_0x85e915[_0x2c02('0x12')](';')+'\x22');}if(_0x118e1e[_0x2c02('0x19')]){handleError(_0x378e07[_0x2c02('0x6d')][_0x12d4cb],{'code':'SystemRow','message':_0x118e1e[_0x2c02('0x12')]()});}else{fs[_0x2c02('0x7f')](_0xa1d914,_0x4b660a[_0x2c02('0x12')]()+'\x0a');}_0x4b660a=[];}if(!(stats[_0x2c02('0x6c')]%0xc8)){socket[_0x2c02('0x80')]('contact:import:'+_0x5e97ab,stats);stats[_0x2c02('0x5a')]=[];}}if(stopped){logger[_0x2c02('0x5c')]('Abort\x20parser');_0x25fe37[_0x2c02('0x81')]();}}catch(_0x2e860b){handleError(_0x378e07[_0x2c02('0x6d')][_0x12d4cb],{'code':_0x2c02('0x82'),'message':_0x2e860b[_0x2c02('0x5b')]});logger[_0x2c02('0x1f')](_0x2c02('0x83'),_0x2e860b[_0x2c02('0x5b')]);}},'complete':function(){try{var _0x4846e6=[];var _0x1d6d74=tempTableName;_0x4846e6['push'](_0x2c02('0x84')+_0x1d6d74+_0x2c02('0x85'));logger[_0x2c02('0x5c')](_0x2c02('0x86'),contactItemTypes['length']);var _0x20485a=util[_0x2c02('0xb')](_0x2c02('0x87'),_0xa1d914,_0x1d6d74,_0x43ca49,_0x2b58d5[_0x2c02('0x37')],_0x2b58d5[_0x2c02('0x55')]||null,NOW,NOW);if(_['isNil'](_0x38af9f['scheduledat'])){_0x20485a+=_0x2c02('0x88');}_0x4846e6[_0x2c02('0x1b')](_0x20485a);BPromise[_0x2c02('0x89')](_0x4846e6,handleQuery)['then'](function(_0x1a1ed1){BPromise['all']([handleAdditionalPhones()])[_0x2c02('0x1d')](function(){_0x4846e6=[];for(var _0x264501=0x0;_0x264501\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.subject','i.secondDisposition','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','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','enableEmailPreview','all','COUNT(*)','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','getSelectedTags','t.id\x20IN\x20?','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','color','tools_tags','getInteractionFK','_interactions','ui.','from','left_join','users','u.id\x20=\x20ui.UserId','length','map','getInteractionsTables','interactions','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','fax','openchannel','i.from\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','mail','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','parseSearch','sqlOperator','conditions','buildExpression','type','default','text','value','read','and','Contact','operator','$substring','contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','name','ContactId','start','Tag','split','tags','clause','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','end','body','plainBody','keys','compact','forEach','\x20IN\x20?','concat','parse','$gte'];(function(_0x46a671,_0x758e9a){var _0x526d75=function(_0xde3640){while(--_0xde3640){_0x46a671['push'](_0x46a671['shift']());}};_0x526d75(++_0x758e9a);}(_0xa8a8,0xec));var _0x8a8a=function(_0x48d856,_0x44657e){_0x48d856=_0x48d856-0x0;var _0x4504d2=_0xa8a8[_0x48d856];return _0x4504d2;};'use strict';var _=require(_0x8a8a('0x0'));var squel=require(_0x8a8a('0x1'));var as=require(_0x8a8a('0x2'));var qs=require(_0x8a8a('0x3'));var updateInteraction=require('./update-interaction')[_0x8a8a('0x4')];var utils=require(_0x8a8a('0x5'));var db=require(_0x8a8a('0x6'))['db'];function skipInteractionsQuery(_0x3ed1de,_0x45515d,_0x1cecd4){var _0x3184a3=![];var _0x12db82=utils[_0x8a8a('0x7')](_0x3ed1de);if(_0x45515d[_0x8a8a('0x8')]===_0x8a8a('0x9')&&!_0x1cecd4[_0x8a8a('0xa')]&&!_0x1cecd4[_0x12db82]){_0x3184a3=!![];}return _0x3184a3;}function getTagsQuery(){return squel[_0x8a8a('0xb')]()[_0x8a8a('0xc')]('id')[_0x8a8a('0xc')]('name')['field'](_0x8a8a('0xd'))['from'](_0x8a8a('0xe'));}function getUsersQuery(_0x3d3a00,_0x532621){var _0x118380=utils[_0x8a8a('0xf')](_0x3d3a00);var _0xb13fca='user_has_'+_0x3d3a00+_0x8a8a('0x10');var _0x42fab7=squel[_0x8a8a('0xb')]()[_0x8a8a('0xc')]('u.id')[_0x8a8a('0xc')]('u.fullname')[_0x8a8a('0xc')](_0x8a8a('0x11')+_0x118380)[_0x8a8a('0x12')](_0xb13fca,'ui')[_0x8a8a('0x13')](_0x8a8a('0x14'),'u',_0x8a8a('0x15'));if(_0x532621[_0x8a8a('0x16')]>0x0){_0x42fab7['where'](_0x8a8a('0x11')+_0x118380+'\x20IN\x20?',_[_0x8a8a('0x17')](_0x532621,'id'));}return _0x42fab7;}function getInteractionsQuery(_0x3046ae){var _0x46a4f4=utils[_0x8a8a('0x18')](_0x3046ae);var _0x42e8b6=utils['getAccountFK'](_0x3046ae);var _0x9d55f9=utils[_0x8a8a('0xf')](_0x3046ae);return squel[_0x8a8a('0xb')]()[_0x8a8a('0x12')](_0x46a4f4[_0x8a8a('0x19')],'i')[_0x8a8a('0x13')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o','o.id\x20=\x20i.UserId')[_0x8a8a('0x13')](_0x46a4f4[_0x8a8a('0x1a')],'a',_0x8a8a('0x1b')+_0x42e8b6)[_0x8a8a('0x13')](_0x46a4f4[_0x8a8a('0x1c')],'me',_0x8a8a('0x1d')+_0x9d55f9+_0x8a8a('0x1e'))[_0x8a8a('0x13')](_0x46a4f4[_0x8a8a('0x1f')],'it',_0x8a8a('0x20')+_0x9d55f9+_0x8a8a('0x1e'))[_0x8a8a('0x13')](_0x8a8a('0xe'),'t',_0x8a8a('0x21'));}function getSqlClauses(){var _0x442c00={'body':squel['expr'](),'contact':squel[_0x8a8a('0x22')](),'default':squel[_0x8a8a('0x22')](),'fields':squel[_0x8a8a('0x22')](),'filter':squel[_0x8a8a('0x22')](),'read':squel[_0x8a8a('0x22')](),'tags':{'clause':squel[_0x8a8a('0x22')](),'ids':null},'user':squel[_0x8a8a('0x22')]()};return _0x442c00;}function parseTagParameter(_0x5f4dcc){var _0x31d21a=squel[_0x8a8a('0x22')]();if(_0x5f4dcc){var _0x2e217a=utils['getSelectedTags'](_0x5f4dcc);_0x2e217a['forEach'](function(_0x2dafcd){_0x31d21a['or'](_0x8a8a('0x23'),'%,'+_0x2dafcd+',%');});}return _0x31d21a;}function parseReadParameter(_0x5c70bd){var _0x4d8760='';if(_0x5c70bd){_0x4d8760='unreadMessages\x20{OPERATOR}\x200';if(_0x5c70bd==='1'){_0x4d8760=_0x4d8760[_0x8a8a('0x24')]('{OPERATOR}','=');}else{_0x4d8760=_0x4d8760[_0x8a8a('0x24')](_0x8a8a('0x25'),'>');}}return _0x4d8760;}function parseSearchFilter(_0x49ea81,_0x36c7f8){var _0x2c8f27=squel[_0x8a8a('0x22')]();if(_0x36c7f8){var _0x8df0cb=_0x36c7f8[_0x8a8a('0x24')]('\x5c','\x5c\x5c')[_0x8a8a('0x24')](/'/g,'\x27\x27');if(qs[_0x8a8a('0x26')](_0x8df0cb)){_0x2c8f27['or'](_0x8a8a('0x27'),_0x8df0cb+'%');if(['sms','whatsapp']['includes'](_0x49ea81)){_0x2c8f27['or'](_0x8a8a('0x28'),_0x8df0cb+'%');}else if(_0x49ea81===_0x8a8a('0x29')){_0x2c8f27['or']('i.fax\x20LIKE\x20?',_0x8df0cb+'%');}else if(_0x49ea81===_0x8a8a('0x2a')){_0x2c8f27['or'](_0x8a8a('0x2b'),_0x8df0cb+'%');}}else if(_0x49ea81==='mail'&&qs[_0x8a8a('0x2c')](_0x8df0cb)){_0x2c8f27['or'](_0x8a8a('0x2d'),_0x8df0cb+'%');}else{if(_0x49ea81===_0x8a8a('0x2e')){_0x2c8f27['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x8df0cb))['or'](_0x8a8a('0x2f'),qs['getFullTextValue'](_0x8df0cb));}else{if(_0x49ea81!==_0x8a8a('0x29')){_0x2c8f27['or'](_0x8a8a('0x30'),qs[_0x8a8a('0x31')](_0x8df0cb));}_0x2c8f27['or'](_0x8a8a('0x32'),_0x8df0cb+'%');}}}return _0x2c8f27;}function parseAdvancedSearchFilter(_0x3c69b4,_0x997136){var _0x37ce45=getSqlClauses();var _0x389ad1=as[_0x8a8a('0x33')](_0x3c69b4);var _0xf7d4d7=_0x389ad1[_0x8a8a('0x34')];for(var _0x45ddb4=0x0;_0x45ddb4<_0x389ad1[_0x8a8a('0x35')][_0x8a8a('0x16')];_0x45ddb4++){var _0x19c21c=_0x389ad1[_0x8a8a('0x35')][_0x45ddb4];var _0x8e3017='i';var _0x29d187=_['find'](_0x997136,['name',_0x19c21c['field']]);if(_0x29d187){var _0x34db33=as[_0x8a8a('0x36')](_0x8e3017,_0x29d187[_0x8a8a('0x37')],_0x19c21c);_0x37ce45[_0x8a8a('0x38')][_0xf7d4d7](_0x34db33[_0x8a8a('0x39')],_0x34db33['value']['start'],_0x34db33[_0x8a8a('0x3a')]['end']);}else{switch(_0x19c21c[_0x8a8a('0xc')]){case'unreadMessages':var _0x52811b=parseReadParameter(_0x19c21c[_0x8a8a('0x3a')]);_0x37ce45[_0x8a8a('0x3b')][_0x8a8a('0x3c')](_0x52811b);break;case _0x8a8a('0x3d'):if(_0x19c21c[_0x8a8a('0x3e')]===_0x8a8a('0x3f')){if(_0x19c21c[_0x8a8a('0x3a')]['split']('\x20')[_0x8a8a('0x16')]>0x1){_0x37ce45[_0x8a8a('0x40')][_0xf7d4d7](_0x8a8a('0x41'),qs['getFullTextValue'](_0x19c21c[_0x8a8a('0x3a')]),null);}else{var _0x323f89='%'+_0x19c21c[_0x8a8a('0x3a')]+'%';_0x37ce45['contact'][_0xf7d4d7](_0x8a8a('0x42'),_0x323f89,_0x323f89,_0x323f89);}}else{_0x29d187=_[_0x8a8a('0x43')](_0x997136,[_0x8a8a('0x44'),_0x8a8a('0x45')]);_0x19c21c[_0x8a8a('0xc')]=_0x8a8a('0x45');_0x34db33=as['buildExpression'](_0x8e3017,_0x29d187['type'],_0x19c21c);_0x37ce45[_0x8a8a('0x40')][_0xf7d4d7](_0x34db33['text'],_0x34db33[_0x8a8a('0x3a')][_0x8a8a('0x46')],_0x34db33['value']['end']);}break;case _0x8a8a('0x47'):var _0x1ea8f7=_0x19c21c[_0x8a8a('0x3a')][_0x8a8a('0x48')](',')['map'](function(_0x103223){return Number(_0x103223);});var _0x4de773=parseTagParameter(_0x1ea8f7);_0x37ce45[_0x8a8a('0x49')][_0x8a8a('0x4a')]['and'](_0x4de773);_0x37ce45[_0x8a8a('0x49')][_0x8a8a('0x4b')]=_0x1ea8f7;break;case _0x8a8a('0x4c'):if(_0x19c21c['operator']===_0x8a8a('0x3f')){_0x37ce45[_0x8a8a('0x4d')][_0xf7d4d7](_0x8a8a('0x4e'),'%'+_0x19c21c['value']+'%',null);}else{_0x29d187=_['find'](_0x997136,[_0x8a8a('0x44'),_0x8a8a('0x4f')]);_0x19c21c[_0x8a8a('0xc')]='UserId';_0x34db33=as[_0x8a8a('0x36')](_0x8e3017,_0x29d187[_0x8a8a('0x37')],_0x19c21c);_0x37ce45[_0x8a8a('0x4d')][_0xf7d4d7](_0x34db33[_0x8a8a('0x39')],_0x34db33[_0x8a8a('0x3a')][_0x8a8a('0x46')],_0x34db33[_0x8a8a('0x3a')][_0x8a8a('0x50')]);}break;case _0x8a8a('0x51'):case _0x8a8a('0x52'):_0x34db33=as[_0x8a8a('0x36')]('me',null,_0x19c21c);_0x37ce45['body'][_0xf7d4d7](_0x34db33[_0x8a8a('0x39')],_0x34db33[_0x8a8a('0x3a')][_0x8a8a('0x46')],_0x34db33[_0x8a8a('0x3a')][_0x8a8a('0x50')]);break;}}}return _0x37ce45;}function parseModelFields(_0x2e22b0,_0x565a49,_0x1dceca){var _0x396ffd=utils[_0x8a8a('0x7')](_0x2e22b0);var _0x2c71f3=squel['expr']();var _0x1faad3=_(_0x565a49)[_0x8a8a('0x53')]()[_0x8a8a('0x17')](function(_0x5220c0){return _['some'](_0x1dceca,[_0x8a8a('0x44'),_0x5220c0])?_0x5220c0:undefined;})[_0x8a8a('0x54')]()[_0x8a8a('0x3a')]();if(_0x1faad3[_0x8a8a('0x16')]>0x0){_0x1faad3[_0x8a8a('0x55')](function(_0x20efe1){if(_0x20efe1===_0x396ffd){_0x2c71f3[_0x8a8a('0x3c')]('i.'+_0x396ffd+_0x8a8a('0x56'),[][_0x8a8a('0x57')](_0x565a49[_0x20efe1]));}else if(_0x20efe1==='createdAt'){var _0x4c1f1a=JSON[_0x8a8a('0x58')](_0x565a49[_0x20efe1])[_0x8a8a('0x59')];var _0x56e170=JSON['parse'](_0x565a49[_0x20efe1])[_0x8a8a('0x5a')];_0x2c71f3['and'](_0x8a8a('0x5b'),_0x4c1f1a,_0x56e170);}else{if(_0x565a49[_0x20efe1]==='null'){_0x2c71f3[_0x8a8a('0x3c')]('i.'+_0x20efe1+_0x8a8a('0x5c'));}else{_0x2c71f3[_0x8a8a('0x3c')]('i.'+_0x20efe1+_0x8a8a('0x5d'),_0x565a49[_0x20efe1]);}}});}return _0x2c71f3;}function parseQueryParameters(_0x330654,_0x14066f,_0x2b718b){var _0x7bab17=getSqlClauses();return Promise[_0x8a8a('0x5e')]()[_0x8a8a('0x5f')](function(){return parseModelFields(_0x330654,_0x14066f,_0x2b718b);})['then'](function(_0x329bfb){_0x7bab17[_0x8a8a('0x60')][_0x8a8a('0x3c')](_0x329bfb);return parseReadParameter(_0x14066f[_0x8a8a('0x3b')]);})[_0x8a8a('0x5f')](function(_0x517446){_0x7bab17[_0x8a8a('0x3b')][_0x8a8a('0x3c')](_0x517446);return parseTagParameter(_0x14066f['tag']);})['then'](function(_0x408657){_0x7bab17[_0x8a8a('0x49')][_0x8a8a('0x4a')][_0x8a8a('0x3c')](_0x408657);return parseSearchFilter(_0x330654,_0x14066f[_0x8a8a('0x61')]);})[_0x8a8a('0x5f')](function(_0x5ed59c){_0x7bab17['filter']=_0x5ed59c;return _0x7bab17;});}function checkAccountsRestrictions(_0x495371,_0x414aa4,_0x54d848){var _0x3984dd=utils[_0x8a8a('0x7')](_0x495371);var _0x4e1ca8=_0x8a8a('0x62')+_[_0x8a8a('0x63')](_0x495371)+(_0x495371===_0x8a8a('0x64')?_0x8a8a('0x65'):'Accounts');var _0x12e040=squel['expr']();return Promise[_0x8a8a('0x5e')]()[_0x8a8a('0x5f')](function(){if(_0x54d848['search']&&_0x414aa4[_0x8a8a('0x8')]===_0x8a8a('0x9')){return _0x414aa4[_0x4e1ca8]({'attributes':['id'],'raw':!![]});}})[_0x8a8a('0x5f')](function(_0x183015){if(_0x183015){if(_0x183015['length']===0x0){_0x12e040[_0x8a8a('0x3c')]('i.'+_0x3984dd+_0x8a8a('0x5c'));}else{_0x12e040[_0x8a8a('0x3c')]('i.'+_0x3984dd+'\x20IN\x20?',_['map'](_0x183015,'id'));}}else if(!_0x54d848[_0x3984dd]){_0x12e040[_0x8a8a('0x3c')]('i.'+_0x3984dd+'\x20IS\x20NOT\x20NULL');}})['then'](function(){return _0x12e040;});}function getClosedOrderClause(_0x52137d,_0x395564){var _0x7d79a4='';var _0x5bdbd3=[_0x8a8a('0x66'),'i.secondDisposition','i.disposition'];if(_0x52137d===_0x8a8a('0x2e')){_0x5bdbd3[_0x8a8a('0x67')]('i.substatus');}if(_0x395564[_0x8a8a('0x68')]==='0'&&_0x52137d===_0x8a8a('0x2e')){_0x7d79a4=_0x8a8a('0x69');}else{if(_0x395564[_0x8a8a('0x68')]==='1'){_0x5bdbd3[_0x8a8a('0x6a')]();}_0x7d79a4=_0x8a8a('0x6b')+_0x5bdbd3['join'](',\x20')+')';}return _0x7d79a4;}function getFilteredInteractions(_0x3ca3d6,_0x402b5f,_0x587ea8,_0x2ce579){var _0x2fcfd8=utils[_0x8a8a('0xf')](_0x3ca3d6);var _0x190c45=_[_0x8a8a('0x63')](_0x3ca3d6)+_0x8a8a('0x6c');var _0x81c1dd=[];var _0x34a079=getTagsQuery();var _0x331979={'type':db[_0x8a8a('0x6d')]['QueryTypes'][_0x8a8a('0x6e')],'raw':!![]};var _0x2f7537=[];var _0x521883=[];return db[_0x8a8a('0x6f')][_0x8a8a('0x70')](_0x34a079[_0x8a8a('0x71')](),_0x331979)[_0x8a8a('0x5f')](function(_0x3e0af2){_0x81c1dd=_['keyBy'](_0x3e0af2,'id');_0x331979=_[_0x8a8a('0x72')](_0x331979,{'model':db[_0x190c45],'mapToModel':!![],'nest':!![]});if(_0x587ea8[_0x8a8a('0x60')]){_0x2ce579[_0x8a8a('0x73')][_0x8a8a('0x55')](function(_0x3fc483){_0x402b5f[_0x8a8a('0xc')]('i.'+_0x3fc483);});}else{_0x402b5f[_0x8a8a('0xc')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x8a8a('0x74'));_0x402b5f[_0x8a8a('0xc')](_0x8a8a('0x75'),'Account.key');_0x402b5f[_0x8a8a('0xc')]('a.mandatoryDisposition',_0x8a8a('0x76'));if(_0x3ca3d6===_0x8a8a('0x2e')){_0x402b5f['field'](_0x8a8a('0x77'),_0x8a8a('0x78'));_0x402b5f[_0x8a8a('0xc')](_0x8a8a('0x79'),_0x8a8a('0x7a'));_0x402b5f[_0x8a8a('0xc')](_0x8a8a('0x7b'));_0x402b5f[_0x8a8a('0xc')](_0x8a8a('0x7c'));_0x402b5f[_0x8a8a('0xc')](_0x8a8a('0x7d'));_0x402b5f[_0x8a8a('0xc')](_0x8a8a('0x7e'));_0x402b5f[_0x8a8a('0xc')](_0x8a8a('0x7f'));_0x402b5f[_0x8a8a('0xc')](_0x8a8a('0x80'));_0x402b5f[_0x8a8a('0xc')]('i.lastMsgAt');_0x402b5f[_0x8a8a('0xc')]('i.lastMsgDirection');_0x402b5f[_0x8a8a('0xc')](_0x8a8a('0x81'));_0x402b5f[_0x8a8a('0xc')]('i.disposition');_0x402b5f['field'](_0x8a8a('0x82'));_0x402b5f[_0x8a8a('0xc')](_0x8a8a('0x66'));_0x402b5f['field']('i.substatus');_0x402b5f[_0x8a8a('0xc')](_0x8a8a('0x83'));_0x402b5f[_0x8a8a('0xc')](_0x8a8a('0x84'));_0x402b5f[_0x8a8a('0xc')](_0x8a8a('0x85'));_0x402b5f[_0x8a8a('0xc')](_0x8a8a('0x86'));}else if(_0x3ca3d6==='openchannel'){_0x402b5f[_0x8a8a('0xc')](_0x8a8a('0x87'),'contactName');}else{_0x402b5f[_0x8a8a('0xc')](_0x8a8a('0x88'),_0x8a8a('0x7a'));}if(_0x3ca3d6!==_0x8a8a('0x2e')){_0x402b5f[_0x8a8a('0xc')](_0x8a8a('0x89'));}_0x402b5f['field'](_0x8a8a('0x8a'),_0x8a8a('0x8b'));_0x402b5f[_0x8a8a('0xc')](_0x8a8a('0x8c'),_0x8a8a('0x8d'));_0x402b5f['field'](_0x8a8a('0x8e'),_0x8a8a('0x8f'));_0x402b5f[_0x8a8a('0xc')](_0x8a8a('0x90'),_0x8a8a('0x91'));_0x402b5f[_0x8a8a('0xc')](_0x8a8a('0x92'),_0x8a8a('0x93'));_0x402b5f[_0x8a8a('0xc')](_0x8a8a('0x94'),'Contact.fax');_0x402b5f[_0x8a8a('0xc')](_0x8a8a('0x95'),_0x8a8a('0x96'));_0x402b5f[_0x8a8a('0xc')](_0x8a8a('0x97'),'Owner.internal');_0x402b5f['field'](_0x8a8a('0x98'),_0x8a8a('0x99'));}if(_0x2ce579[_0x8a8a('0x9a')]){_0x402b5f['limit'](_0x2ce579[_0x8a8a('0x9a')]);}if(_0x2ce579[_0x8a8a('0x9b')]){_0x402b5f[_0x8a8a('0x9b')](_0x2ce579[_0x8a8a('0x9b')]);}return db['sequelize'][_0x8a8a('0x70')](_0x402b5f[_0x8a8a('0x71')](),_0x331979);})[_0x8a8a('0x5f')](function(_0x5cee89){_0x2f7537=_0x5cee89;var _0x5a3003=getUsersQuery(_0x3ca3d6,_0x2f7537);return db['sequelize'][_0x8a8a('0x70')](_0x5a3003['toString'](),_0x331979);})[_0x8a8a('0x5f')](function(_0x5a3682){_0x521883=_['groupBy'](_0x5a3682,_0x2fcfd8);if(_0x3ca3d6===_0x8a8a('0x2e')){return db['Setting']['findOne']({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0x8a8a('0x5f')](function(_0x49aa1b){var _0x58a6ff=_0x49aa1b?_0x49aa1b[_0x8a8a('0x9c')]:undefined;var _0x482fa4=_0x2f7537[_0x8a8a('0x17')](function(_0x5dcc61){return updateInteraction(_0x5dcc61,_0x81c1dd,_0x521883,_0x58a6ff);});return Promise[_0x8a8a('0x9d')](_0x482fa4);});}function countFilteredInteractions(_0x27c4ba,_0x353f0d){var _0x238565=_0x27c4ba['clone']();_0x238565[_0x8a8a('0xc')](_0x8a8a('0x9e'));_0x238565['field'](_0x8a8a('0x9f'),_0x8a8a('0x74'));var _0x913e4c=utils[_0x8a8a('0xa0')](_0x353f0d);if(!_['isEmpty'](_0x913e4c)){_0x238565['where'](_0x8a8a('0xa1'),_0x913e4c);}var _0x1ee082={'type':db[_0x8a8a('0x6d')]['QueryTypes'][_0x8a8a('0x6e')],'raw':!![]};return db[_0x8a8a('0x6f')][_0x8a8a('0x70')](_0x238565['toString'](),_0x1ee082);}module[_0x8a8a('0xa2')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x180f=['tags','clause','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','keys','compact','concat','createdAt','parse','$gte','null','resolve','then','tag','filter','get','capitalize','Websites','Accounts','agent','\x20IS\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','closed','i.substatus','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','SELECT','sequelize','toString','keyBy','merge','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','i.id','i.createdAt','i.updatedAt','i.closed','i.lastMsgAt','i.subject','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','contactName','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','Setting','findOne','enableEmailPreview','all','isEmpty','t.id\x20IN\x20?','query','exports','lodash','squel','../parsers/qs','./update-interaction','./utils','../../mysqldb','getAccountFK','search','select','field','name','color','from','tools_tags','getInteractionFK','user_has_','_interactions','u.id','ui.','left_join','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.','me.','it.','\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','openchannel','i.from\x20LIKE\x20?','isEmail','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','buildExpression','type','default','start','end','unreadMessages','value','read','and','Contact','operator','$substring','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','split'];(function(_0x4f4c2a,_0x5f5a28){var _0xd15be6=function(_0x1bc725){while(--_0x1bc725){_0x4f4c2a['push'](_0x4f4c2a['shift']());}};_0xd15be6(++_0x5f5a28);}(_0x180f,0xf3));var _0xf180=function(_0x458363,_0x1675db){_0x458363=_0x458363-0x0;var _0x4d0290=_0x180f[_0x458363];return _0x4d0290;};'use strict';var _=require(_0xf180('0x0'));var squel=require(_0xf180('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0xf180('0x2'));var updateInteraction=require(_0xf180('0x3'))['updateInteraction'];var utils=require(_0xf180('0x4'));var db=require(_0xf180('0x5'))['db'];function skipInteractionsQuery(_0x472213,_0x39895a,_0x10b776){var _0x5f269f=![];var _0x2ef675=utils[_0xf180('0x6')](_0x472213);if(_0x39895a['role']==='agent'&&!_0x10b776[_0xf180('0x7')]&&!_0x10b776[_0x2ef675]){_0x5f269f=!![];}return _0x5f269f;}function getTagsQuery(){return squel[_0xf180('0x8')]()[_0xf180('0x9')]('id')[_0xf180('0x9')](_0xf180('0xa'))[_0xf180('0x9')](_0xf180('0xb'))[_0xf180('0xc')](_0xf180('0xd'));}function getUsersQuery(_0x5a242b,_0x43d390){var _0x460472=utils[_0xf180('0xe')](_0x5a242b);var _0x18bde3=_0xf180('0xf')+_0x5a242b+_0xf180('0x10');var _0x422e7e=squel[_0xf180('0x8')]()[_0xf180('0x9')](_0xf180('0x11'))[_0xf180('0x9')]('u.fullname')[_0xf180('0x9')](_0xf180('0x12')+_0x460472)[_0xf180('0xc')](_0x18bde3,'ui')[_0xf180('0x13')]('users','u',_0xf180('0x14'));if(_0x43d390[_0xf180('0x15')]>0x0){_0x422e7e[_0xf180('0x16')]('ui.'+_0x460472+_0xf180('0x17'),_[_0xf180('0x18')](_0x43d390,'id'));}return _0x422e7e;}function getInteractionsQuery(_0x496e65){var _0x115b86=utils[_0xf180('0x19')](_0x496e65);var _0x492c22=utils[_0xf180('0x6')](_0x496e65);var _0x14ddc6=utils[_0xf180('0xe')](_0x496e65);return squel[_0xf180('0x8')]()[_0xf180('0xc')](_0x115b86[_0xf180('0x1a')],'i')[_0xf180('0x13')](_0xf180('0x1b'),'c',_0xf180('0x1c'))[_0xf180('0x13')](_0xf180('0x1d'),'o',_0xf180('0x1e'))[_0xf180('0x13')](_0x115b86['accounts'],'a',_0xf180('0x1f')+_0x492c22)[_0xf180('0x13')](_0x115b86['messages'],'me',_0xf180('0x20')+_0x14ddc6+'\x20=\x20i.id')[_0xf180('0x13')](_0x115b86['interactionsTags'],'it',_0xf180('0x21')+_0x14ddc6+_0xf180('0x22'))['left_join']('tools_tags','t',_0xf180('0x23'));}function getSqlClauses(){var _0x932e29={'body':squel['expr'](),'contact':squel[_0xf180('0x24')](),'default':squel[_0xf180('0x24')](),'fields':squel[_0xf180('0x24')](),'filter':squel[_0xf180('0x24')](),'read':squel[_0xf180('0x24')](),'tags':{'clause':squel[_0xf180('0x24')](),'ids':null},'user':squel[_0xf180('0x24')]()};return _0x932e29;}function parseTagParameter(_0x806b84){var _0x3d20bc=squel[_0xf180('0x24')]();if(_0x806b84){var _0x4ff4f9=utils[_0xf180('0x25')](_0x806b84);_0x4ff4f9[_0xf180('0x26')](function(_0x151b90){_0x3d20bc['or'](_0xf180('0x27'),'%,'+_0x151b90+',%');});}return _0x3d20bc;}function parseReadParameter(_0x37379c){var _0x2aeee4='';if(_0x37379c){_0x2aeee4=_0xf180('0x28');if(_0x37379c==='1'){_0x2aeee4=_0x2aeee4[_0xf180('0x29')](_0xf180('0x2a'),'=');}else{_0x2aeee4=_0x2aeee4[_0xf180('0x29')]('{OPERATOR}','>');}}return _0x2aeee4;}function parseSearchFilter(_0x323482,_0xe9a66b){var _0x3dc187=squel[_0xf180('0x24')]();if(_0xe9a66b){var _0x466895=_0xe9a66b[_0xf180('0x29')]('\x5c','\x5c\x5c')[_0xf180('0x29')](/'/g,'\x27\x27');if(qs[_0xf180('0x2b')](_0x466895)){_0x3dc187['or'](_0xf180('0x2c'),_0x466895+'%');if([_0xf180('0x2d'),_0xf180('0x2e')][_0xf180('0x2f')](_0x323482)){_0x3dc187['or'](_0xf180('0x30'),_0x466895+'%');}else if(_0x323482===_0xf180('0x31')){_0x3dc187['or']('i.fax\x20LIKE\x20?',_0x466895+'%');}else if(_0x323482===_0xf180('0x32')){_0x3dc187['or'](_0xf180('0x33'),_0x466895+'%');}}else if(_0x323482==='mail'&&qs[_0xf180('0x34')](_0x466895)){_0x3dc187['or']('c.email\x20LIKE\x20?',_0x466895+'%');}else{if(_0x323482===_0xf180('0x35')){_0x3dc187['or'](_0xf180('0x36'),qs[_0xf180('0x37')](_0x466895))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xf180('0x37')](_0x466895));}else{if(_0x323482!==_0xf180('0x31')){_0x3dc187['or'](_0xf180('0x38'),qs[_0xf180('0x37')](_0x466895));}_0x3dc187['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x466895+'%');}}}return _0x3dc187;}function parseAdvancedSearchFilter(_0xc5ec8a,_0x217813){var _0x438d2c=getSqlClauses();var _0x2e8830=as[_0xf180('0x39')](_0xc5ec8a);var _0xc73271=_0x2e8830[_0xf180('0x3a')];for(var _0x1eb817=0x0;_0x1eb817<_0x2e8830[_0xf180('0x3b')][_0xf180('0x15')];_0x1eb817++){var _0x50d5c5=_0x2e8830[_0xf180('0x3b')][_0x1eb817];var _0x4ac1b1='i';var _0x553587=_[_0xf180('0x3c')](_0x217813,['name',_0x50d5c5['field']]);if(_0x553587){var _0x3f8313=as[_0xf180('0x3d')](_0x4ac1b1,_0x553587[_0xf180('0x3e')],_0x50d5c5);_0x438d2c[_0xf180('0x3f')][_0xc73271](_0x3f8313['text'],_0x3f8313['value'][_0xf180('0x40')],_0x3f8313['value'][_0xf180('0x41')]);}else{switch(_0x50d5c5['field']){case _0xf180('0x42'):var _0x2c2a1f=parseReadParameter(_0x50d5c5[_0xf180('0x43')]);_0x438d2c[_0xf180('0x44')][_0xf180('0x45')](_0x2c2a1f);break;case _0xf180('0x46'):if(_0x50d5c5[_0xf180('0x47')]===_0xf180('0x48')){if(_0x50d5c5[_0xf180('0x43')]['split']('\x20')[_0xf180('0x15')]>0x1){_0x438d2c[_0xf180('0x49')][_0xc73271]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xf180('0x37')](_0x50d5c5[_0xf180('0x43')]),null);}else{var _0x38ba6d='%'+_0x50d5c5[_0xf180('0x43')]+'%';_0x438d2c['contact'][_0xc73271](_0xf180('0x4a'),_0x38ba6d,_0x38ba6d,_0x38ba6d);}}else{_0x553587=_['find'](_0x217813,[_0xf180('0xa'),_0xf180('0x4b')]);_0x50d5c5[_0xf180('0x9')]=_0xf180('0x4b');_0x3f8313=as['buildExpression'](_0x4ac1b1,_0x553587['type'],_0x50d5c5);_0x438d2c[_0xf180('0x49')][_0xc73271](_0x3f8313[_0xf180('0x4c')],_0x3f8313[_0xf180('0x43')][_0xf180('0x40')],_0x3f8313[_0xf180('0x43')][_0xf180('0x41')]);}break;case _0xf180('0x4d'):var _0x2cf9c1=_0x50d5c5[_0xf180('0x43')][_0xf180('0x4e')](',')['map'](function(_0x1c4821){return Number(_0x1c4821);});var _0x5311c6=parseTagParameter(_0x2cf9c1);_0x438d2c[_0xf180('0x4f')][_0xf180('0x50')][_0xf180('0x45')](_0x5311c6);_0x438d2c['tags'][_0xf180('0x51')]=_0x2cf9c1;break;case _0xf180('0x52'):if(_0x50d5c5['operator']===_0xf180('0x48')){_0x438d2c[_0xf180('0x53')][_0xc73271](_0xf180('0x54'),'%'+_0x50d5c5[_0xf180('0x43')]+'%',null);}else{_0x553587=_[_0xf180('0x3c')](_0x217813,[_0xf180('0xa'),_0xf180('0x55')]);_0x50d5c5[_0xf180('0x9')]=_0xf180('0x55');_0x3f8313=as[_0xf180('0x3d')](_0x4ac1b1,_0x553587[_0xf180('0x3e')],_0x50d5c5);_0x438d2c[_0xf180('0x53')][_0xc73271](_0x3f8313[_0xf180('0x4c')],_0x3f8313[_0xf180('0x43')][_0xf180('0x40')],_0x3f8313[_0xf180('0x43')][_0xf180('0x41')]);}break;case _0xf180('0x56'):case _0xf180('0x57'):_0x3f8313=as[_0xf180('0x3d')]('me',null,_0x50d5c5);_0x438d2c['body'][_0xc73271](_0x3f8313['text'],_0x3f8313[_0xf180('0x43')][_0xf180('0x40')],_0x3f8313[_0xf180('0x43')][_0xf180('0x41')]);break;}}}return _0x438d2c;}function parseModelFields(_0x1915b4,_0x30e469,_0x1acc63){var _0x177c6d=utils[_0xf180('0x6')](_0x1915b4);var _0x441e90=squel[_0xf180('0x24')]();var _0x16bc09=_(_0x30e469)[_0xf180('0x58')]()[_0xf180('0x18')](function(_0x42c9dd){return _['some'](_0x1acc63,[_0xf180('0xa'),_0x42c9dd])?_0x42c9dd:undefined;})[_0xf180('0x59')]()['value']();if(_0x16bc09[_0xf180('0x15')]>0x0){_0x16bc09[_0xf180('0x26')](function(_0x4379af){if(_0x4379af===_0x177c6d){_0x441e90[_0xf180('0x45')]('i.'+_0x177c6d+_0xf180('0x17'),[][_0xf180('0x5a')](_0x30e469[_0x4379af]));}else if(_0x4379af===_0xf180('0x5b')){var _0x639114=JSON[_0xf180('0x5c')](_0x30e469[_0x4379af])[_0xf180('0x5d')];var _0x1e2be5=JSON[_0xf180('0x5c')](_0x30e469[_0x4379af])['$lte'];_0x441e90[_0xf180('0x45')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x639114,_0x1e2be5);}else{if(_0x30e469[_0x4379af]===_0xf180('0x5e')){_0x441e90['and']('i.'+_0x4379af+'\x20IS\x20NULL');}else{_0x441e90['and']('i.'+_0x4379af+'\x20=\x20?',_0x30e469[_0x4379af]);}}});}return _0x441e90;}function parseQueryParameters(_0x225c82,_0x3e0e1a,_0x579d14){var _0x242c69=getSqlClauses();return Promise[_0xf180('0x5f')]()['then'](function(){return parseModelFields(_0x225c82,_0x3e0e1a,_0x579d14);})[_0xf180('0x60')](function(_0x5b4f70){_0x242c69['fields']['and'](_0x5b4f70);return parseReadParameter(_0x3e0e1a[_0xf180('0x44')]);})[_0xf180('0x60')](function(_0x26a748){_0x242c69['read'][_0xf180('0x45')](_0x26a748);return parseTagParameter(_0x3e0e1a[_0xf180('0x61')]);})[_0xf180('0x60')](function(_0x44f63){_0x242c69[_0xf180('0x4f')]['clause'][_0xf180('0x45')](_0x44f63);return parseSearchFilter(_0x225c82,_0x3e0e1a[_0xf180('0x62')]);})['then'](function(_0x2f4899){_0x242c69[_0xf180('0x62')]=_0x2f4899;return _0x242c69;});}function checkAccountsRestrictions(_0x2d3ce7,_0xfaaa96,_0x20077a){var _0x516365=utils[_0xf180('0x6')](_0x2d3ce7);var _0x3edc18=_0xf180('0x63')+_[_0xf180('0x64')](_0x2d3ce7)+(_0x2d3ce7==='chat'?_0xf180('0x65'):_0xf180('0x66'));var _0x35897=squel[_0xf180('0x24')]();return Promise[_0xf180('0x5f')]()['then'](function(){if(_0x20077a[_0xf180('0x7')]&&_0xfaaa96['role']===_0xf180('0x67')){return _0xfaaa96[_0x3edc18]({'attributes':['id'],'raw':!![]});}})[_0xf180('0x60')](function(_0x496b94){if(_0x496b94){if(_0x496b94['length']===0x0){_0x35897['and']('i.'+_0x516365+_0xf180('0x68'));}else{_0x35897[_0xf180('0x45')]('i.'+_0x516365+_0xf180('0x17'),_[_0xf180('0x18')](_0x496b94,'id'));}}else if(!_0x20077a[_0x516365]){_0x35897[_0xf180('0x45')]('i.'+_0x516365+'\x20IS\x20NOT\x20NULL');}})['then'](function(){return _0x35897;});}function getClosedOrderClause(_0x343e3f,_0x4e8f46){var _0x348984='';var _0xdb28d=[_0xf180('0x69'),_0xf180('0x6a'),_0xf180('0x6b')];if(_0x343e3f===_0xf180('0x35')){_0xdb28d[_0xf180('0x6c')]('i.substatus');}if(_0x4e8f46[_0xf180('0x6d')]==='0'&&_0x343e3f===_0xf180('0x35')){_0x348984=_0xf180('0x6e');}else{if(_0x4e8f46['closed']==='1'){_0xdb28d[_0xf180('0x6f')]();}_0x348984=_0xf180('0x70')+_0xdb28d[_0xf180('0x71')](',\x20')+')';}return _0x348984;}function getFilteredInteractions(_0x5874aa,_0x31fc7e,_0x4269e2,_0x41fde4){var _0x321136=utils[_0xf180('0xe')](_0x5874aa);var _0x523d14=_[_0xf180('0x64')](_0x5874aa)+_0xf180('0x72');var _0x2ff5d1=[];var _0x5841b0=getTagsQuery();var _0x1ff9a1={'type':db[_0xf180('0x73')]['QueryTypes'][_0xf180('0x74')],'raw':!![]};var _0x4bd8b6=[];var _0x4157be=[];return db[_0xf180('0x75')]['query'](_0x5841b0[_0xf180('0x76')](),_0x1ff9a1)[_0xf180('0x60')](function(_0x2ac72b){_0x2ff5d1=_[_0xf180('0x77')](_0x2ac72b,'id');_0x1ff9a1=_[_0xf180('0x78')](_0x1ff9a1,{'model':db[_0x523d14],'mapToModel':!![],'nest':!![]});if(_0x4269e2[_0xf180('0x79')]){_0x41fde4['attributes']['forEach'](function(_0xfa796a){_0x31fc7e[_0xf180('0x9')]('i.'+_0xfa796a);});}else{_0x31fc7e[_0xf180('0x9')](_0xf180('0x7a'),_0xf180('0x42'));_0x31fc7e[_0xf180('0x9')]('a.key',_0xf180('0x7b'));_0x31fc7e[_0xf180('0x9')]('a.mandatoryDisposition','Account.mandatoryDisposition');if(_0x5874aa===_0xf180('0x35')){_0x31fc7e['field']('a.email','Account.email');_0x31fc7e[_0xf180('0x9')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x31fc7e[_0xf180('0x9')](_0xf180('0x7c'));_0x31fc7e['field'](_0xf180('0x7d'));_0x31fc7e[_0xf180('0x9')](_0xf180('0x7e'));_0x31fc7e['field'](_0xf180('0x7f'));_0x31fc7e[_0xf180('0x9')]('i.closedAt');_0x31fc7e[_0xf180('0x9')]('i.attach');_0x31fc7e[_0xf180('0x9')](_0xf180('0x80'));_0x31fc7e['field']('i.lastMsgDirection');_0x31fc7e[_0xf180('0x9')](_0xf180('0x81'));_0x31fc7e[_0xf180('0x9')](_0xf180('0x6b'));_0x31fc7e[_0xf180('0x9')]('i.secondDisposition');_0x31fc7e['field'](_0xf180('0x69'));_0x31fc7e[_0xf180('0x9')](_0xf180('0x6e'));_0x31fc7e['field']('i.to');_0x31fc7e[_0xf180('0x9')]('i.ContactId');_0x31fc7e[_0xf180('0x9')](_0xf180('0x82'));_0x31fc7e[_0xf180('0x9')](_0xf180('0x83'));}else if(_0x5874aa==='openchannel'){_0x31fc7e[_0xf180('0x9')](_0xf180('0x84'),_0xf180('0x85'));}else{_0x31fc7e[_0xf180('0x9')](_0xf180('0x86'),_0xf180('0x85'));}if(_0x5874aa!=='mail'){_0x31fc7e[_0xf180('0x9')](_0xf180('0x87'));}_0x31fc7e[_0xf180('0x9')](_0xf180('0x88'),_0xf180('0x89'));_0x31fc7e[_0xf180('0x9')](_0xf180('0x8a'),_0xf180('0x8b'));_0x31fc7e[_0xf180('0x9')](_0xf180('0x8c'),'Contact.email');_0x31fc7e[_0xf180('0x9')](_0xf180('0x8d'),_0xf180('0x8e'));_0x31fc7e[_0xf180('0x9')]('c.mobile','Contact.mobile');_0x31fc7e[_0xf180('0x9')](_0xf180('0x8f'),_0xf180('0x90'));_0x31fc7e['field'](_0xf180('0x91'),_0xf180('0x92'));_0x31fc7e[_0xf180('0x9')](_0xf180('0x93'),_0xf180('0x94'));_0x31fc7e[_0xf180('0x9')](_0xf180('0x95'),_0xf180('0x96'));}if(_0x41fde4[_0xf180('0x97')]){_0x31fc7e[_0xf180('0x97')](_0x41fde4[_0xf180('0x97')]);}if(_0x41fde4[_0xf180('0x98')]){_0x31fc7e[_0xf180('0x98')](_0x41fde4[_0xf180('0x98')]);}return db[_0xf180('0x75')]['query'](_0x31fc7e[_0xf180('0x76')](),_0x1ff9a1);})[_0xf180('0x60')](function(_0x5f811){_0x4bd8b6=_0x5f811;var _0x504850=getUsersQuery(_0x5874aa,_0x4bd8b6);return db[_0xf180('0x75')]['query'](_0x504850[_0xf180('0x76')](),_0x1ff9a1);})['then'](function(_0x3116c0){_0x4157be=_['groupBy'](_0x3116c0,_0x321136);if(_0x5874aa===_0xf180('0x35')){return db[_0xf180('0x99')][_0xf180('0x9a')]({'attributes':[_0xf180('0x9b')],'raw':!![]});}})[_0xf180('0x60')](function(_0x19db8a){var _0x43c975=_0x19db8a?_0x19db8a[_0xf180('0x9b')]:undefined;var _0xb7f21=_0x4bd8b6[_0xf180('0x18')](function(_0x27f527){return updateInteraction(_0x27f527,_0x2ff5d1,_0x4157be,_0x43c975);});return Promise[_0xf180('0x9c')](_0xb7f21);});}function countFilteredInteractions(_0xd67b4d,_0x2e64ff){var _0x2ee13e=_0xd67b4d['clone']();_0x2ee13e[_0xf180('0x9')]('COUNT(*)');_0x2ee13e[_0xf180('0x9')](_0xf180('0x7a'),_0xf180('0x42'));var _0x34230b=utils[_0xf180('0x25')](_0x2e64ff);if(!_[_0xf180('0x9d')](_0x34230b)){_0x2ee13e[_0xf180('0x16')](_0xf180('0x9e'),_0x34230b);}var _0x280201={'type':db[_0xf180('0x73')]['QueryTypes'][_0xf180('0x74')],'raw':!![]};return db[_0xf180('0x75')][_0xf180('0x9f')](_0x2ee13e[_0xf180('0x76')](),_0x280201);}module[_0xf180('0xa0')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 76cf811..b8ad85e 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 _0xba32=['total','closed','disposition','UserId','plainBody','then','lastMsgText','trimStart','updateInteraction','Users','TagIds','catch','lodash','../../mysqldb','map','fullname','split','push','waiting','talking','answered','unmanaged','abandoned'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xba32,0xf2));var _0x2ba3=function(_0x60369b,_0x525315){_0x60369b=_0x60369b-0x0;var _0x3c9e8e=_0xba32[_0x60369b];return _0x3c9e8e;};'use strict';var _=require(_0x2ba3('0x0'));var db=require(_0x2ba3('0x1'))['db'];function getInteractionUsers(_0x125c32,_0x20df53){return new Promise(function(_0xcb7deb,_0x5c5ba9){try{var _0x2236d8=[];if(_0x20df53[_0x125c32]){_0x2236d8=_0x20df53[_0x125c32][_0x2ba3('0x2')](function(_0x1eb054){return{'id':_0x1eb054['id'],'fullname':_0x1eb054[_0x2ba3('0x3')]};});}return _0xcb7deb(_0x2236d8);}catch(_0x992726){_0x5c5ba9(_0x992726);}});}function getInteractionTags(_0xe351b3,_0x5798a5){var _0xf963cb=[];if(_0xe351b3){_0xe351b3[_0x2ba3('0x4')](',')['forEach'](function(_0x1e3952){_0xf963cb[_0x2ba3('0x5')](_0x5798a5[_0x1e3952]);});}return _0xf963cb;}function updateWaitingCounter(_0x1cbe88){if(_0x1cbe88[_0x2ba3('0x6')]){_0x1cbe88['waiting']-=0x1;}}function updateInteractionCounters(_0x12473a){_0x12473a[_0x2ba3('0x6')]=0x0;_0x12473a[_0x2ba3('0x7')]=0x0;_0x12473a[_0x2ba3('0x8')]=0x0;_0x12473a[_0x2ba3('0x9')]=0x0;_0x12473a[_0x2ba3('0xa')]=0x0;_0x12473a[_0x2ba3('0xb')]=0x0;if(_0x12473a[_0x2ba3('0xc')]){if(_0x12473a[_0x2ba3('0xd')]===_0x2ba3('0xa')){_0x12473a[_0x2ba3('0xa')]+=0x1;updateWaitingCounter(_0x12473a);}if(_0x12473a['UserId']){_0x12473a[_0x2ba3('0x8')]+=0x1;if(_0x12473a[_0x2ba3('0x7')]){_0x12473a['talking']-=0x1;}}else{if(_0x12473a[_0x2ba3('0xd')]){_0x12473a[_0x2ba3('0x9')]+=0x1;updateWaitingCounter(_0x12473a);}}}else{if(!_0x12473a['UserId']){_0x12473a[_0x2ba3('0x6')]+=0x1;}if(_0x12473a[_0x2ba3('0xe')]){_0x12473a[_0x2ba3('0x7')]+=0x1;updateWaitingCounter(_0x12473a);}}_0x12473a[_0x2ba3('0xb')]+=0x1;return _0x12473a;}function getLastMessageText(_0x2479cd){return db['MailMessage']['findOne']({'where':{'$and':[{'MailInteractionId':_0x2479cd['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x2ba3('0xf')],'order':'-id','raw':!![]})[_0x2ba3('0x10')](function(_0x2c9a0f){if(_0x2c9a0f&&_0x2c9a0f[_0x2ba3('0xf')]){_0x2479cd[_0x2ba3('0x11')]=_[_0x2ba3('0x12')](_0x2c9a0f['plainBody']);}return _0x2479cd;})['catch'](function(_0x4fbe77){throw _0x4fbe77;});}exports[_0x2ba3('0x13')]=function(_0x211712,_0x1a9083,_0x3276f7,_0x2ce042){return new Promise(function(_0x3c6756,_0x3f14b6){return getInteractionUsers(_0x211712['id'],_0x3276f7)[_0x2ba3('0x10')](function(_0x72b97b){_0x211712[_0x2ba3('0x14')]=_0x72b97b;return getInteractionTags(_0x211712[_0x2ba3('0x15')],_0x1a9083);})[_0x2ba3('0x10')](function(_0x3459d8){_0x211712['Tags']=_0x3459d8;delete _0x211712[_0x2ba3('0x15')];return updateInteractionCounters(_0x211712);})[_0x2ba3('0x10')](function(_0x4b7b78){if(_0x2ce042){return getLastMessageText(_0x4b7b78);}else{return _0x4b7b78;}})['then'](function(_0x58c3c7){_0x3c6756(_0x58c3c7);})[_0x2ba3('0x16')](function(_0x52e3aa){_0x3f14b6(_0x52e3aa);});});}; \ No newline at end of file +var _0x2919=['then','lastMsgText','trimStart','catch','updateInteraction','TagIds','Tags','lodash','../../mysqldb','map','forEach','push','waiting','talking','answered','abandoned','total','closed','UserId','disposition','unmanaged','MailMessage','findOne','plainBody','-id'];(function(_0x41b7ff,_0x21ac9a){var _0x32f9d2=function(_0x644458){while(--_0x644458){_0x41b7ff['push'](_0x41b7ff['shift']());}};_0x32f9d2(++_0x21ac9a);}(_0x2919,0x1c9));var _0x9291=function(_0x4f98d6,_0xa85414){_0x4f98d6=_0x4f98d6-0x0;var _0x296059=_0x2919[_0x4f98d6];return _0x296059;};'use strict';var _=require(_0x9291('0x0'));var db=require(_0x9291('0x1'))['db'];function getInteractionUsers(_0x2e8196,_0x3558d9){return new Promise(function(_0xd8c4b6,_0x2dc065){try{var _0x560e35=[];if(_0x3558d9[_0x2e8196]){_0x560e35=_0x3558d9[_0x2e8196][_0x9291('0x2')](function(_0x2da8bc){return{'id':_0x2da8bc['id'],'fullname':_0x2da8bc['fullname']};});}return _0xd8c4b6(_0x560e35);}catch(_0x50edc6){_0x2dc065(_0x50edc6);}});}function getInteractionTags(_0x50efaa,_0x4e56d1){var _0x29e54f=[];if(_0x50efaa){_0x50efaa['split'](',')[_0x9291('0x3')](function(_0x2f2321){_0x29e54f[_0x9291('0x4')](_0x4e56d1[_0x2f2321]);});}return _0x29e54f;}function updateWaitingCounter(_0x464c3d){if(_0x464c3d[_0x9291('0x5')]){_0x464c3d[_0x9291('0x5')]-=0x1;}}function updateInteractionCounters(_0x3d52c4){_0x3d52c4['waiting']=0x0;_0x3d52c4[_0x9291('0x6')]=0x0;_0x3d52c4[_0x9291('0x7')]=0x0;_0x3d52c4['unmanaged']=0x0;_0x3d52c4[_0x9291('0x8')]=0x0;_0x3d52c4[_0x9291('0x9')]=0x0;if(_0x3d52c4[_0x9291('0xa')]){if(_0x3d52c4['disposition']===_0x9291('0x8')){_0x3d52c4[_0x9291('0x8')]+=0x1;updateWaitingCounter(_0x3d52c4);}if(_0x3d52c4[_0x9291('0xb')]){_0x3d52c4['answered']+=0x1;if(_0x3d52c4[_0x9291('0x6')]){_0x3d52c4[_0x9291('0x6')]-=0x1;}}else{if(_0x3d52c4[_0x9291('0xc')]){_0x3d52c4[_0x9291('0xd')]+=0x1;updateWaitingCounter(_0x3d52c4);}}}else{if(!_0x3d52c4[_0x9291('0xb')]){_0x3d52c4['waiting']+=0x1;}if(_0x3d52c4[_0x9291('0xb')]){_0x3d52c4[_0x9291('0x6')]+=0x1;updateWaitingCounter(_0x3d52c4);}}_0x3d52c4[_0x9291('0x9')]+=0x1;return _0x3d52c4;}function getLastMessageText(_0x4993a0){return db[_0x9291('0xe')][_0x9291('0xf')]({'where':{'$and':[{'MailInteractionId':_0x4993a0['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x9291('0x10')],'order':_0x9291('0x11'),'raw':!![]})[_0x9291('0x12')](function(_0x37961a){if(_0x37961a&&_0x37961a['plainBody']){_0x4993a0[_0x9291('0x13')]=_[_0x9291('0x14')](_0x37961a[_0x9291('0x10')]);}return _0x4993a0;})[_0x9291('0x15')](function(_0x17ad93){throw _0x17ad93;});}exports[_0x9291('0x16')]=function(_0x3abe07,_0x27842f,_0xb61226,_0x2413a1){return new Promise(function(_0x46154d,_0x2e51d9){return getInteractionUsers(_0x3abe07['id'],_0xb61226)[_0x9291('0x12')](function(_0x33ae6b){_0x3abe07['Users']=_0x33ae6b;return getInteractionTags(_0x3abe07[_0x9291('0x17')],_0x27842f);})[_0x9291('0x12')](function(_0x2e63a7){_0x3abe07[_0x9291('0x18')]=_0x2e63a7;delete _0x3abe07[_0x9291('0x17')];return updateInteractionCounters(_0x3abe07);})[_0x9291('0x12')](function(_0x535001){if(_0x2413a1){return getLastMessageText(_0x535001);}else{return _0x535001;}})[_0x9291('0x12')](function(_0x489a1c){_0x46154d(_0x489a1c);})[_0x9291('0x15')](function(_0x39f667){_0x2e51d9(_0x39f667);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 36bfe50..923bfcc 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 _0x551a=['exports','lodash','../../config/logger','mail-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','stringify','null','Interaction','findOne','then','update','catch'];(function(_0xbb5122,_0x4e11c9){var _0x55c6dc=function(_0x4c30a2){while(--_0x4c30a2){_0xbb5122['push'](_0xbb5122['shift']());}};_0x55c6dc(++_0x4e11c9);}(_0x551a,0x16d));var _0xa551=function(_0x2d0134,_0x26661f){_0x2d0134=_0x2d0134-0x0;var _0xfd11d0=_0x551a[_0x2d0134];return _0xfd11d0;};'use strict';var _=require(_0xa551('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0xa551('0x1'))('openchannel-interactions'),'mail':require('../../config/logger')(_0xa551('0x2')),'fax':require(_0xa551('0x1'))('fax-interactions'),'sms':require('../../config/logger')('sms-interactions'),'chat':require(_0xa551('0x1'))('chat-interactions'),'whatsapp':require(_0xa551('0x1'))(_0xa551('0x3'))};function getAccountFK(_0xfb57ec){return _[_0xa551('0x4')](_0xfb57ec)+(_0xfb57ec===_0xa551('0x5')?_0xa551('0x6'):_0xa551('0x7'))+'Id';}function getInteractionFK(_0x1c215f){return _['capitalize'](_0x1c215f)+_0xa551('0x8');}function getInteractionId(_0x4acc8e,_0x5580c7,_0x2f4d11){if(_0x4acc8e&&_0x4acc8e[_[_0xa551('0x9')](_0x2f4d11)+_0xa551('0x8')]){return _0x4acc8e[_[_0xa551('0x9')](_0x2f4d11)+'InteractionId'];}else if(_0x4acc8e&&_0x4acc8e['id']){return _0x4acc8e['id'];}else if(_0x5580c7&&_0x5580c7['id']){return _0x5580c7['id'];}else{return'unknown';}}function getInteractionsTables(_0x175b3c){return{'accounts':_0x175b3c+'_'+(_0x175b3c===_0xa551('0x5')?_0xa551('0xa'):_0xa551('0xb')),'interactions':_0x175b3c+_0xa551('0xc'),'interactionsTags':_0x175b3c+_0xa551('0xd'),'messages':_0x175b3c+_0xa551('0xe'),'userInteractions':_0xa551('0xf')+_0x175b3c+_0xa551('0xc')};}function getSelectedTags(_0x4b8056){var _0x37513b=[];if(_0x4b8056){_0x37513b=Array['isArray'](_0x4b8056)?_0x4b8056:[_0x4b8056];}return _0x37513b;}function log(_0x2e55e1,_0x832ed4,_0x5b2b69,_0x3dcbd7,_0x154172,_0x1088e8){loggers[_0x154172['toLowerCase']()][_0x2e55e1](_0xa551('0x10'),_0x1088e8[_0xa551('0x11')](),_0x832ed4?_0x832ed4['id']:null,_0x832ed4?_0x832ed4['name']:null,_0x832ed4?_0x832ed4['role']:null,getInteractionId(_0x5b2b69,_0x3dcbd7,_0x154172),_0x5b2b69?JSON[_0xa551('0x12')](_0x5b2b69):_0xa551('0x13'));}function updateUser(_0x4da717,_0x25151a,_0x42d5c1,_0x261615,_0x47a8e5){db[_[_0xa551('0x9')](_0x261615)+_0xa551('0x14')][_0xa551('0x15')]({'where':{'id':getInteractionId(_0x25151a,_0x42d5c1,_0x261615)}})[_0xa551('0x16')](function(_0x2c651c){if(_0x2c651c){return _0x2c651c[_0xa551('0x17')]({'UserId':_0x4da717?_0x4da717['id']:null});}})['then'](function(_0x313660){if(_0x313660){log('info',_0x4da717,_0x25151a,_0x42d5c1,_0x261615,_0x47a8e5);}})[_0xa551('0x18')](function(){log('error',_0x4da717,_0x25151a,_0x42d5c1,_0x261615,_0x47a8e5);});}module[_0xa551('0x19')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x877d=['exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Account','upperFirst','InteractionId','unknown','websites','accounts','_interactions','_interaction_has_tags','_messages','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','findOne','then','info','catch','error'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x877d,0x194));var _0xd877=function(_0x13256a,_0x44d0a2){_0x13256a=_0x13256a-0x0;var _0x59ad3b=_0x877d[_0x13256a];return _0x59ad3b;};'use strict';var _=require(_0xd877('0x0'));var db=require(_0xd877('0x1'))['db'];var loggers={'openchannel':require(_0xd877('0x2'))(_0xd877('0x3')),'mail':require('../../config/logger')('mail-interactions'),'fax':require(_0xd877('0x2'))('fax-interactions'),'sms':require(_0xd877('0x2'))(_0xd877('0x4')),'chat':require('../../config/logger')(_0xd877('0x5')),'whatsapp':require('../../config/logger')(_0xd877('0x6'))};function getAccountFK(_0x43f213){return _[_0xd877('0x7')](_0x43f213)+(_0x43f213===_0xd877('0x8')?'Website':_0xd877('0x9'))+'Id';}function getInteractionFK(_0x29e3b8){return _[_0xd877('0x7')](_0x29e3b8)+'InteractionId';}function getInteractionId(_0x341d7f,_0x5d85b6,_0x2a72f7){if(_0x341d7f&&_0x341d7f[_[_0xd877('0xa')](_0x2a72f7)+_0xd877('0xb')]){return _0x341d7f[_[_0xd877('0xa')](_0x2a72f7)+_0xd877('0xb')];}else if(_0x341d7f&&_0x341d7f['id']){return _0x341d7f['id'];}else if(_0x5d85b6&&_0x5d85b6['id']){return _0x5d85b6['id'];}else{return _0xd877('0xc');}}function getInteractionsTables(_0x4608c6){return{'accounts':_0x4608c6+'_'+(_0x4608c6===_0xd877('0x8')?_0xd877('0xd'):_0xd877('0xe')),'interactions':_0x4608c6+_0xd877('0xf'),'interactionsTags':_0x4608c6+_0xd877('0x10'),'messages':_0x4608c6+_0xd877('0x11'),'userInteractions':'user_has_'+_0x4608c6+_0xd877('0xf')};}function getSelectedTags(_0x541109){var _0x5c104b=[];if(_0x541109){_0x5c104b=Array['isArray'](_0x541109)?_0x541109:[_0x541109];}return _0x5c104b;}function log(_0x26fe6e,_0x2f7347,_0x1f80d5,_0x35805d,_0x49b815,_0x3e44db){loggers[_0x49b815[_0xd877('0x12')]()][_0x26fe6e](_0xd877('0x13'),_0x3e44db[_0xd877('0x14')](),_0x2f7347?_0x2f7347['id']:null,_0x2f7347?_0x2f7347[_0xd877('0x15')]:null,_0x2f7347?_0x2f7347[_0xd877('0x16')]:null,getInteractionId(_0x1f80d5,_0x35805d,_0x49b815),_0x1f80d5?JSON[_0xd877('0x17')](_0x1f80d5):_0xd877('0x18'));}function updateUser(_0x1e51fa,_0x40bb95,_0x2372d1,_0x3208ac,_0x174f5c){db[_['upperFirst'](_0x3208ac)+'Interaction'][_0xd877('0x19')]({'where':{'id':getInteractionId(_0x40bb95,_0x2372d1,_0x3208ac)}})[_0xd877('0x1a')](function(_0x2e4aa0){if(_0x2e4aa0){return _0x2e4aa0['update']({'UserId':_0x1e51fa?_0x1e51fa['id']:null});}})[_0xd877('0x1a')](function(_0x56c3d2){if(_0x56c3d2){log(_0xd877('0x1b'),_0x1e51fa,_0x40bb95,_0x2372d1,_0x3208ac,_0x174f5c);}})[_0xd877('0x1c')](function(){log(_0xd877('0x1d'),_0x1e51fa,_0x40bb95,_0x2372d1,_0x3208ac,_0x174f5c);});}module[_0xd877('0x1e')]={'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 d57345c..c73eb64 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 _0xf93c=['use','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','format','update','base64','utf8','final','parse'];(function(_0x12f023,_0x65d0fc){var _0xc152c2=function(_0x3b33ab){while(--_0x3b33ab){_0x12f023['push'](_0x12f023['shift']());}};_0xc152c2(++_0x65d0fc);}(_0xf93c,0x150));var _0xcf93=function(_0x494bb4,_0x25ccaa){_0x494bb4=_0x494bb4-0x0;var _0x58adbf=_0xf93c[_0x494bb4];return _0x58adbf;};'use strict';var crypto=require(_0xcf93('0x0'));var util=require(_0xcf93('0x1'));var compose=require(_0xcf93('0x2'));var db=require(_0xcf93('0x3'))['db'];var config=require(_0xcf93('0x4'));function getValueFromLicense(_0x96dde2,_0x2487bf){if(_0x96dde2&&_0x2487bf){if(_0x2487bf[_0xcf93('0x5')]&&_0x2487bf[_0xcf93('0x6')]){var _0x194817=_0x2487bf['data1'];var _0x20ffca=_0x2487bf[_0xcf93('0x6')];var _0x1fb265=_0x194817[_0xcf93('0x7')]('-')[0x4];var _0x541b5c=_0x194817['split']('-')[0x0];var _0x5673de=crypto[_0xcf93('0x8')]('aes-256-ctr',util[_0xcf93('0x9')]('%s:%s:%s',_0x1fb265,_0x194817,_0x541b5c));var _0xea9883=_0x5673de[_0xcf93('0xa')](_0x20ffca,_0xcf93('0xb'),_0xcf93('0xc'));_0xea9883+=_0x5673de[_0xcf93('0xd')](_0xcf93('0xc'));var _0x377237=JSON[_0xcf93('0xe')](_0xea9883);return _0x377237['hasOwnProperty'](_0x96dde2)?_0x377237[_0x96dde2]:null;}}return null;}function isLimit(_0x446ff5,_0x14aa31,_0x5174ec,_0x2ce2c4){var _0x1301d7=_0x14aa31;return compose()[_0xcf93('0xf')](function(_0x24385d,_0x30200d,_0x5ba721){return db['License'][_0xcf93('0x10')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x20f208){var _0x2579fa=getValueFromLicense(_0x446ff5,_0x20f208);return _0x2579fa?_0x2579fa:_0x1301d7;})[_0xcf93('0x11')](function(_0x2485ac){_0x1301d7=_0x2485ac;return _0x5174ec[_0xcf93('0x12')](_0x2ce2c4);})[_0xcf93('0x11')](function(_0x4e670b){if(_0x4e670b>=_0x1301d7){return _0x30200d[_0xcf93('0x13')](0x193)[_0xcf93('0x14')]({'message':util[_0xcf93('0x9')](_0xcf93('0x15'),_0x446ff5)});}_0x5ba721();})[_0xcf93('0x16')](function(_0x186353){_0x5ba721(_0x186353);});});}function isUserLimit(){return isLimit(_0xcf93('0x17'),0x1,db[_0xcf93('0x18')],{'where':{'$or':[{'role':_0xcf93('0x19')},{'role':_0xcf93('0x1a')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0x36d2=['parse','hasOwnProperty','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','util','../../mysqldb','../../config/environment','data1','split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8'];(function(_0x4a46b4,_0x4096fb){var _0x235c65=function(_0x5d3013){while(--_0x5d3013){_0x4a46b4['push'](_0x4a46b4['shift']());}};_0x235c65(++_0x4096fb);}(_0x36d2,0x1b7));var _0x236d=function(_0x4e93a9,_0x413f30){_0x4e93a9=_0x4e93a9-0x0;var _0x43013c=_0x36d2[_0x4e93a9];return _0x43013c;};'use strict';var crypto=require('crypto');var util=require(_0x236d('0x0'));var compose=require('composable-middleware');var db=require(_0x236d('0x1'))['db'];var config=require(_0x236d('0x2'));function getValueFromLicense(_0x4fd313,_0x277692){if(_0x4fd313&&_0x277692){if(_0x277692[_0x236d('0x3')]&&_0x277692['license']){var _0x36bf36=_0x277692[_0x236d('0x3')];var _0x3114e1=_0x277692['license'];var _0x3905a1=_0x36bf36[_0x236d('0x4')]('-')[0x4];var _0x1984a4=_0x36bf36['split']('-')[0x0];var _0x5da199=crypto['createDecipher'](_0x236d('0x5'),util[_0x236d('0x6')](_0x236d('0x7'),_0x3905a1,_0x36bf36,_0x1984a4));var _0xb28b1a=_0x5da199[_0x236d('0x8')](_0x3114e1,_0x236d('0x9'),_0x236d('0xa'));_0xb28b1a+=_0x5da199['final']('utf8');var _0x39632d=JSON[_0x236d('0xb')](_0xb28b1a);return _0x39632d[_0x236d('0xc')](_0x4fd313)?_0x39632d[_0x4fd313]:null;}}return null;}function isLimit(_0x12db60,_0x1af29d,_0x86a465,_0x3e9972){var _0x52deaa=_0x1af29d;return compose()['use'](function(_0x161856,_0x36978b,_0xc53a8e){return db['License'][_0x236d('0xd')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0xf8feb9){var _0x307961=getValueFromLicense(_0x12db60,_0xf8feb9);return _0x307961?_0x307961:_0x52deaa;})[_0x236d('0xe')](function(_0x362f1d){_0x52deaa=_0x362f1d;return _0x86a465[_0x236d('0xf')](_0x3e9972);})[_0x236d('0xe')](function(_0x44a0e2){if(_0x44a0e2>=_0x52deaa){return _0x36978b[_0x236d('0x10')](0x193)[_0x236d('0x11')]({'message':util[_0x236d('0x6')](_0x236d('0x12'),_0x12db60)});}_0xc53a8e();})[_0x236d('0x13')](function(_0xd57094){_0xc53a8e(_0xd57094);});});}function isUserLimit(){return isLimit(_0x236d('0x14'),0x1,db[_0x236d('0x15')],{'where':{'$or':[{'role':_0x236d('0x16')},{'role':_0x236d('0x17')}]}});}exports[_0x236d('0x18')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 45aefe6..0a514a6 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 _0x4e96=['DATE','utcOffset','seconds','moment','startsWith','[$or]','and','replace','split','length','slice','forEach','filter','map','conditions','buildExpression','operator','$eq','$between','value','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','includes','$notIn','\x20OR\x20','$in','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$startsWith','$endsWith','shift'];(function(_0x2d4421,_0x15a84f){var _0x2d3b01=function(_0xb9e94c){while(--_0xb9e94c){_0x2d4421['push'](_0x2d4421['shift']());}};_0x2d3b01(++_0x15a84f);}(_0x4e96,0x168));var _0x64e9=function(_0x2080c3,_0x7ea4e2){_0x2080c3=_0x2080c3-0x0;var _0x3cf5a2=_0x4e96[_0x2080c3];return _0x3cf5a2;};'use strict';var _=require('lodash');var moment=require(_0x64e9('0x0'));exports['parseSearch']=function(_0x45c0da){var _0x8b4a3f={'conditions':[]};_0x8b4a3f['sqlOperator']=_[_0x64e9('0x1')](_0x45c0da,_0x64e9('0x2'))?'or':_0x64e9('0x3');var _0x1f9f4e=_0x45c0da[_0x64e9('0x4')]('[$and]','')[_0x64e9('0x4')](_0x64e9('0x2'),'')[_0x64e9('0x5')]('||');for(var _0x235eca=0x0;_0x235eca<_0x1f9f4e[_0x64e9('0x6')];_0x235eca++){var _0x115fa3=_0x1f9f4e[_0x235eca][_0x64e9('0x5')](':=');var _0x474b96=_0x115fa3[0x0];var _0x2b283c=_0x115fa3[_0x64e9('0x7')](0x1);_0x2b283c[_0x64e9('0x8')](function(_0x55bda9){var _0x1898f0=_0x55bda9[_0x64e9('0x5')]('[')['shift']();var _0x5eaf8d=_0x55bda9['match'](/\[(.*?)\]/g);_0x5eaf8d['forEach'](function(_0x59e0a2){var _0x32d618=_0x59e0a2[_0x64e9('0x5')]('[')[_0x64e9('0x9')](function(_0x155ac4){return _0x155ac4['indexOf'](']')>-0x1;})[_0x64e9('0xa')](function(_0x18797a){return _0x18797a[_0x64e9('0x5')](']')[0x0];})[0x0];_0x8b4a3f[_0x64e9('0xb')]['push']({'field':_0x474b96,'operator':_0x1898f0,'value':_0x32d618});});});}return _0x8b4a3f;};exports[_0x64e9('0xc')]=function(_0x77b92e,_0x530d92,_0x1e81f8){var _0x53eda1={};if(_0x530d92==='DATE'){if(_0x1e81f8[_0x64e9('0xd')]===_0x64e9('0xe')){_0x1e81f8[_0x64e9('0xd')]=_0x64e9('0xf');_0x1e81f8[_0x64e9('0x10')]+=','+_0x1e81f8[_0x64e9('0x10')];}else if(_['includes']([_0x64e9('0x11'),_0x64e9('0x12')],_0x1e81f8[_0x64e9('0xd')])){_0x1e81f8[_0x64e9('0x10')]=moment(_0x1e81f8[_0x64e9('0x10')])[_0x64e9('0x13')](0x1,_0x64e9('0x14'))[_0x64e9('0x15')](_0x64e9('0x16'));}}if(_0x1e81f8[_0x64e9('0x17')]){_0x530d92=_0x1e81f8[_0x64e9('0x17')];_0x53eda1[_0x64e9('0x18')]=_0x64e9('0x19')+_0x77b92e+'.'+_0x1e81f8[_0x64e9('0x1a')]+_0x64e9('0x1b')+_0x1e81f8[_0x64e9('0x17')]+')\x20'+parseOperator(_0x1e81f8[_0x64e9('0xd')]);}else{_0x53eda1[_0x64e9('0x18')]=_0x77b92e+'.'+_0x1e81f8['field']+'\x20'+parseOperator(_0x1e81f8[_0x64e9('0xd')]);}if(_[_0x64e9('0x1c')](['$ne',_0x64e9('0x1d')],_0x1e81f8[_0x64e9('0xd')]))_0x53eda1[_0x64e9('0x18')]='('+_0x53eda1[_0x64e9('0x18')]+_0x64e9('0x1e')+_0x77b92e+'.'+_0x1e81f8[_0x64e9('0x1a')]+'\x20IS\x20NULL)';_0x53eda1['value']=parseValue(_0x530d92,_0x1e81f8[_0x64e9('0xd')],_0x1e81f8[_0x64e9('0x10')]);return _0x53eda1;};function parseOperator(_0x13a503){var _0x564f6a;switch(_0x13a503){case _0x64e9('0x1f'):_0x564f6a='IN\x20?';break;case _0x64e9('0x1d'):_0x564f6a=_0x64e9('0x20');break;case'$eq':_0x564f6a=_0x64e9('0x21');break;case _0x64e9('0x22'):_0x564f6a=_0x64e9('0x23');break;case _0x64e9('0x24'):case'$startsWith':case'$endsWith':_0x564f6a=_0x64e9('0x25');break;case _0x64e9('0x26'):_0x564f6a=_0x64e9('0x27');break;case _0x64e9('0x11'):_0x564f6a=_0x64e9('0x28');break;case _0x64e9('0x12'):_0x564f6a=_0x64e9('0x29');break;case'$gte':_0x564f6a=_0x64e9('0x2a');break;case _0x64e9('0xf'):_0x564f6a=_0x64e9('0x2b');break;}return _0x564f6a;}function parseValue(_0x291801,_0xfd59f4,_0x25eb3e){var _0x43f3f0={'start':undefined,'end':undefined};switch(_0xfd59f4){case _0x64e9('0x1f'):case _0x64e9('0x1d'):_0x43f3f0[_0x64e9('0x2c')]=_0x25eb3e[_0x64e9('0x5')](',');break;case _0x64e9('0x24'):_0x43f3f0[_0x64e9('0x2c')]='%'+_0x25eb3e+'%';break;case _0x64e9('0x2d'):_0x43f3f0[_0x64e9('0x2c')]=_0x25eb3e+'%';break;case _0x64e9('0x2e'):_0x43f3f0[_0x64e9('0x2c')]='%'+_0x25eb3e;break;case'$between':var _0x1f20e5=_0x25eb3e[_0x64e9('0x5')](',');var _0x25eb3e=_0x1f20e5[_0x64e9('0x2f')]();var _0x3f82d5=_0x1f20e5['pop']();if(_0x291801===_0x64e9('0x30')){_0x25eb3e=moment(_0x25eb3e)[_0x64e9('0x31')](0x0,!![])['format']();_0x3f82d5=moment(_0x3f82d5)[_0x64e9('0x31')](0x0,!![])[_0x64e9('0x13')](0x17,'hours')[_0x64e9('0x13')](0x3b,'minutes')['add'](0x3b,_0x64e9('0x32'))['format']();}_0x43f3f0={'start':_0x25eb3e,'end':_0x3f82d5};break;default:_0x43f3f0[_0x64e9('0x2c')]=_0x25eb3e;break;}return _0x43f3f0;} \ No newline at end of file +var _0x4fa4=['text','CAST(','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','$endsWith','shift','pop','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','[$or]','replace','[$and]','split','slice','forEach','filter','indexOf','map','conditions','push','buildExpression','operator','$between','value','$gt','add','days','format','YYYY-MM-DD','castTo'];(function(_0x35b7d4,_0x5a5c43){var _0x4e8cee=function(_0x66859c){while(--_0x66859c){_0x35b7d4['push'](_0x35b7d4['shift']());}};_0x4e8cee(++_0x5a5c43);}(_0x4fa4,0x125));var _0x44fa=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x4fa4[_0x1b2ff7];return _0x31656a;};'use strict';var _=require(_0x44fa('0x0'));var moment=require(_0x44fa('0x1'));exports[_0x44fa('0x2')]=function(_0x4a6946){var _0x29e272={'conditions':[]};_0x29e272[_0x44fa('0x3')]=_['startsWith'](_0x4a6946,_0x44fa('0x4'))?'or':'and';var _0x4b96a2=_0x4a6946[_0x44fa('0x5')](_0x44fa('0x6'),'')[_0x44fa('0x5')](_0x44fa('0x4'),'')[_0x44fa('0x7')]('||');for(var _0x4de585=0x0;_0x4de585<_0x4b96a2['length'];_0x4de585++){var _0x5208d7=_0x4b96a2[_0x4de585][_0x44fa('0x7')](':=');var _0x4682ff=_0x5208d7[0x0];var _0x4ddcbe=_0x5208d7[_0x44fa('0x8')](0x1);_0x4ddcbe[_0x44fa('0x9')](function(_0x210927){var _0x3f2aa0=_0x210927['split']('[')['shift']();var _0x33799e=_0x210927['match'](/\[(.*?)\]/g);_0x33799e[_0x44fa('0x9')](function(_0x5e18b0){var _0x14849b=_0x5e18b0[_0x44fa('0x7')]('[')[_0x44fa('0xa')](function(_0x5838fa){return _0x5838fa[_0x44fa('0xb')](']')>-0x1;})[_0x44fa('0xc')](function(_0x5166c2){return _0x5166c2[_0x44fa('0x7')](']')[0x0];})[0x0];_0x29e272[_0x44fa('0xd')][_0x44fa('0xe')]({'field':_0x4682ff,'operator':_0x3f2aa0,'value':_0x14849b});});});}return _0x29e272;};exports[_0x44fa('0xf')]=function(_0x1cdd97,_0xae77b5,_0xbd1d77){var _0x419770={};if(_0xae77b5==='DATE'){if(_0xbd1d77[_0x44fa('0x10')]==='$eq'){_0xbd1d77['operator']=_0x44fa('0x11');_0xbd1d77['value']+=','+_0xbd1d77[_0x44fa('0x12')];}else if(_['includes']([_0x44fa('0x13'),'$lte'],_0xbd1d77[_0x44fa('0x10')])){_0xbd1d77[_0x44fa('0x12')]=moment(_0xbd1d77[_0x44fa('0x12')])[_0x44fa('0x14')](0x1,_0x44fa('0x15'))[_0x44fa('0x16')](_0x44fa('0x17'));}}if(_0xbd1d77['castTo']){_0xae77b5=_0xbd1d77[_0x44fa('0x18')];_0x419770[_0x44fa('0x19')]=_0x44fa('0x1a')+_0x1cdd97+'.'+_0xbd1d77[_0x44fa('0x1b')]+'\x20AS\x20'+_0xbd1d77[_0x44fa('0x18')]+')\x20'+parseOperator(_0xbd1d77['operator']);}else{_0x419770[_0x44fa('0x19')]=_0x1cdd97+'.'+_0xbd1d77[_0x44fa('0x1b')]+'\x20'+parseOperator(_0xbd1d77[_0x44fa('0x10')]);}if(_['includes']([_0x44fa('0x1c'),_0x44fa('0x1d')],_0xbd1d77[_0x44fa('0x10')]))_0x419770[_0x44fa('0x19')]='('+_0x419770[_0x44fa('0x19')]+_0x44fa('0x1e')+_0x1cdd97+'.'+_0xbd1d77[_0x44fa('0x1b')]+_0x44fa('0x1f');_0x419770[_0x44fa('0x12')]=parseValue(_0xae77b5,_0xbd1d77['operator'],_0xbd1d77['value']);return _0x419770;};function parseOperator(_0x27c0fb){var _0x44df3b;switch(_0x27c0fb){case'$in':_0x44df3b=_0x44fa('0x20');break;case'$notIn':_0x44df3b=_0x44fa('0x21');break;case _0x44fa('0x22'):_0x44df3b=_0x44fa('0x23');break;case _0x44fa('0x1c'):_0x44df3b='<>\x20?';break;case _0x44fa('0x24'):case _0x44fa('0x25'):case'$endsWith':_0x44df3b=_0x44fa('0x26');break;case _0x44fa('0x27'):_0x44df3b=_0x44fa('0x28');break;case'$gt':_0x44df3b='>\x20?';break;case'$lte':_0x44df3b=_0x44fa('0x29');break;case'$gte':_0x44df3b=_0x44fa('0x2a');break;case _0x44fa('0x11'):_0x44df3b=_0x44fa('0x2b');break;}return _0x44df3b;}function parseValue(_0x521af1,_0x188634,_0x18d6fe){var _0xc5175b={'start':undefined,'end':undefined};switch(_0x188634){case _0x44fa('0x2c'):case _0x44fa('0x1d'):_0xc5175b[_0x44fa('0x2d')]=_0x18d6fe['split'](',');break;case _0x44fa('0x24'):_0xc5175b[_0x44fa('0x2d')]='%'+_0x18d6fe+'%';break;case _0x44fa('0x25'):_0xc5175b[_0x44fa('0x2d')]=_0x18d6fe+'%';break;case _0x44fa('0x2e'):_0xc5175b[_0x44fa('0x2d')]='%'+_0x18d6fe;break;case'$between':var _0x3d003d=_0x18d6fe[_0x44fa('0x7')](',');var _0x18d6fe=_0x3d003d[_0x44fa('0x2f')]();var _0xfa5b0e=_0x3d003d[_0x44fa('0x30')]();if(_0x521af1==='DATE'){_0x18d6fe=moment(_0x18d6fe)[_0x44fa('0x31')](0x0,!![])[_0x44fa('0x16')]();_0xfa5b0e=moment(_0xfa5b0e)[_0x44fa('0x31')](0x0,!![])[_0x44fa('0x14')](0x17,_0x44fa('0x32'))[_0x44fa('0x14')](0x3b,_0x44fa('0x33'))[_0x44fa('0x14')](0x3b,_0x44fa('0x34'))[_0x44fa('0x16')]();}_0xc5175b={'start':_0x18d6fe,'end':_0xfa5b0e};break;default:_0xc5175b[_0x44fa('0x2d')]=_0x18d6fe;break;}return _0xc5175b;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 944e4b5..535f8b3 100644 --- a/server/components/parsers/qs.js +++ b/server/components/parsers/qs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x24ca=['format','YYYY-MM-DD','utc','$lte','subtract','isArray','limit','offset','sort','indexOf','priority','cast','col','unsigned','DESC','ASC','omit','length','isObject','isString','unset','isNumeric','match','isEmail','push','getOptions','query','$id','model','map','name','filters','intersection','attributes','fields','hasOwnProperty','order','where','filter','columns','merge','type','VIRTUAL','lower','options','lodash','moment','parse','keys','includes','split','isEmpty','forOwn','find','DATE','isPlainObject','$gte'];(function(_0x1fb704,_0x3e5abb){var _0x194048=function(_0x278eaf){while(--_0x278eaf){_0x1fb704['push'](_0x1fb704['shift']());}};_0x194048(++_0x3e5abb);}(_0x24ca,0x1bc));var _0xa24c=function(_0x2d91c6,_0x10ae0e){_0x2d91c6=_0x2d91c6-0x0;var _0x3a8d19=_0x24ca[_0x2d91c6];return _0x3a8d19;};'use strict';var _=require(_0xa24c('0x0'));var sequelize=require('sequelize');var moment=require(_0xa24c('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4ebab4){var _0x4defb1=['ne'];try{var _0x5876d6=JSON[_0xa24c('0x2')](_0x4ebab4);var _0x8a54a0=Object[_0xa24c('0x3')](_0x5876d6)[0x0];return _0x4defb1[_0xa24c('0x4')](_0x8a54a0);}catch(_0xe76a30){return![];}}function getOperatorValue(_0x15a5cd){var _0xf0511=JSON[_0xa24c('0x2')](_0x15a5cd);var _0x2dd348=Object[_0xa24c('0x3')](_0xf0511)[0x0];var _0x9a5013=_0xf0511[_0x2dd348];return{['$'+_0x2dd348]:_0x9a5013};}exports['fields']=function(_0x42d89c){var _0x3a5727=null;if(_0x42d89c){_0x3a5727=_0x42d89c[_0xa24c('0x5')](',');}return _0x3a5727;};exports['filters']=function(_0x399f32,_0x325c6d){var _0x288f76={};if(!_[_0xa24c('0x6')](_0x399f32)){_[_0xa24c('0x7')](_0x399f32,function(_0x43aa5a,_0x1a71a8){try{if(_0x325c6d){var _0xc82af0=_[_0xa24c('0x8')](_0x325c6d,{'name':_0x1a71a8})||{};if(hasSequelizeOperator(_0x43aa5a)){_0x288f76[_0x1a71a8]=getOperatorValue(_0x43aa5a);}else if(_0xc82af0['type']===_0xa24c('0x9')&&_[_0xa24c('0xa')](_0x43aa5a)){var _0xcee4fe=JSON[_0xa24c('0x2')](_0x43aa5a);var _0x5a9486={'$gte':moment(moment(_0xcee4fe[_0xa24c('0xb')])[_0xa24c('0xc')](_0xa24c('0xd')))[_0xa24c('0xe')]()[_0xa24c('0xc')](),'$lte':moment(moment(_0xcee4fe[_0xa24c('0xf')])[_0xa24c('0xc')]('YYYY-MM-DD'))['utc']()[_0xa24c('0x10')](0x1,'s')[_0xa24c('0xc')]()};_0x288f76[_0x1a71a8]=_0x5a9486;}else if(_0xc82af0['name']==='uniqueid'){_0x288f76[_0x1a71a8]=_0x43aa5a;}else{_0x288f76[_0x1a71a8]=_[_0xa24c('0x11')](_0x43aa5a)?_0x43aa5a:JSON[_0xa24c('0x2')](_0x43aa5a);}}else{_0x288f76[_0x1a71a8]=_['isArray'](_0x43aa5a)?_0x43aa5a:JSON[_0xa24c('0x2')](_0x43aa5a);}}catch(_0x5de3e6){_0x288f76[_0x1a71a8]=_0x43aa5a[_0xa24c('0x5')](',');}});}return _0x288f76;};exports[_0xa24c('0x12')]=function(_0x1fcd4b){_0x1fcd4b=parseInt(_0x1fcd4b,0xa);if(!_0x1fcd4b||_0x1fcd4b<0x0){_0x1fcd4b=LIMIT_VALUE;}return _0x1fcd4b;};exports[_0xa24c('0x13')]=function(_0x4ff97c){_0x4ff97c=parseInt(_0x4ff97c,0xa);if(!_0x4ff97c||_0x4ff97c<0x0){_0x4ff97c=0x0;}return _0x4ff97c;};exports[_0xa24c('0x14')]=function(_0x18b7e0){var _0x773f70,_0x4d4bab=null;if(_0x18b7e0){_0x773f70=_0x18b7e0['split'](',');_0x4d4bab=_['map'](_0x773f70,function(_0x4cd77e){if(_0x4cd77e[_0xa24c('0x15')]('-')===0x0){return[_0x4cd77e===_0xa24c('0x16')?sequelize[_0xa24c('0x17')](sequelize[_0xa24c('0x18')]('priority'),_0xa24c('0x19')):_0x4cd77e['substr'](0x1),_0xa24c('0x1a')];}else{return[_0x4cd77e===_0xa24c('0x16')?sequelize['cast'](sequelize[_0xa24c('0x18')](_0xa24c('0x16')),_0xa24c('0x19')):_0x4cd77e,_0xa24c('0x1b')];}});}return _0x4d4bab;};exports[_0xa24c('0x1c')]=function(_0x47e0eb,_0xec9167){if(_['isEmpty'](_0x47e0eb)){return _0x47e0eb;}if(_[_0xa24c('0x11')](_0x47e0eb)){for(var _0x3951ae=0x0;_0x3951ae<_0x47e0eb[_0xa24c('0x1d')];_0x3951ae+=0x1){_0x47e0eb[_0x3951ae]=this['omit'](_0x47e0eb[_0x3951ae],_0xec9167);}return _0x47e0eb;}if(!_[_0xa24c('0x1e')](_0x47e0eb)){return _0x47e0eb;}if(_[_0xa24c('0x1f')](_0xec9167)){_0xec9167=[_0xec9167];}if(!_[_0xa24c('0x11')](_0xec9167)){return _0x47e0eb;}for(var _0x314121=0x0;_0x314121<_0xec9167[_0xa24c('0x1d')];_0x314121+=0x1){_[_0xa24c('0x20')](_0x47e0eb,_0xec9167[_0x314121]);}for(var _0x39609a in _0x47e0eb){if(_0x47e0eb['hasOwnProperty'](_0x39609a)){_0x47e0eb[_0x39609a]=this[_0xa24c('0x1c')](_0x47e0eb[_0x39609a],_0xec9167);}}return _0x47e0eb;};exports[_0xa24c('0x21')]=function(_0x152120){return _0x152120[_0xa24c('0x22')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0xa24c('0x23')]=function(_0xc96ce7){return _0xc96ce7[_0xa24c('0x22')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x15eaaf){var _0x3dcb1b=[];_0x15eaaf[_0xa24c('0x5')](/[ ,]+/)['forEach'](function(_0x245fb2){_0x245fb2=_0x245fb2['replace'](/([^:]")"+/g,'$1');_0x245fb2='+'+_0x245fb2+'*';var _0x1102ab=/[ `!@#$%^&*()_\-?~]/;if(_0x245fb2[_0xa24c('0x22')](_0x1102ab))_0x245fb2='\x22'+_0x245fb2+'\x22';_0x3dcb1b[_0xa24c('0x24')](_0x245fb2);});return _0x3dcb1b['join']('\x20');};exports[_0xa24c('0x25')]=function(_0x53f90,_0x1d0379,_0x52572f){var _0x1c1ed3={},_0x57c340={};if(_0x1d0379[_0xa24c('0x26')][_0xa24c('0x27')]){_0x1d0379['query']['id']=_0x1d0379['query'][_0xa24c('0x27')];delete _0x1d0379[_0xa24c('0x26')][_0xa24c('0x27')];}_0x1c1ed3[_0xa24c('0x28')]=_[_0xa24c('0x29')](_0x53f90,_0xa24c('0x2a'));_0x1c1ed3[_0xa24c('0x26')]=_['keys'](_0x1d0379[_0xa24c('0x26')]);_0x1c1ed3[_0xa24c('0x2b')]=_[_0xa24c('0x2c')](_0x1c1ed3[_0xa24c('0x28')],_0x1c1ed3[_0xa24c('0x26')]);_0x57c340[_0xa24c('0x2d')]=_[_0xa24c('0x2c')](_0x1c1ed3[_0xa24c('0x28')],this[_0xa24c('0x2e')](_0x1d0379[_0xa24c('0x26')]['fields']));_0x57c340[_0xa24c('0x2d')]=_0x57c340[_0xa24c('0x2d')][_0xa24c('0x1d')]?_0x57c340[_0xa24c('0x2d')]:_0x1c1ed3['model'];if(!_0x1d0379['query'][_0xa24c('0x2f')]('nolimit')){_0x57c340[_0xa24c('0x12')]=this[_0xa24c('0x12')](_0x1d0379[_0xa24c('0x26')][_0xa24c('0x12')]);_0x57c340[_0xa24c('0x13')]=this['offset'](_0x1d0379['query'][_0xa24c('0x13')]);}_0x57c340[_0xa24c('0x30')]=this[_0xa24c('0x14')](_0x1d0379[_0xa24c('0x26')][_0xa24c('0x14')]);_0x57c340[_0xa24c('0x31')]=this['filters'](_['pick'](_0x1d0379[_0xa24c('0x26')],_0x1c1ed3[_0xa24c('0x2b')]),_0x53f90);if(_0x1d0379[_0xa24c('0x26')][_0xa24c('0x32')]){var _0x43beff=_0x53f90;var _0x4c5b7e=_0x1d0379[_0xa24c('0x26')][_0xa24c('0x32')];if(typeof _0x4c5b7e==='object'){_0x43beff=_['filter'](_0x53f90,function(_0xba7407){return _[_0xa24c('0x4')](_0x4c5b7e[_0xa24c('0x33')],_0xba7407['name']);});_0x4c5b7e=_0x4c5b7e['value'];}_0x57c340[_0xa24c('0x31')]=_[_0xa24c('0x34')](_0x57c340[_0xa24c('0x31')],{'$or':_[_0xa24c('0x29')](_0x43beff,function(_0x3f640e){if(_0x3f640e[_0xa24c('0x35')]!==_0xa24c('0x36')){if(_0x52572f){return sequelize[_0xa24c('0x31')](sequelize['fn']('lower',sequelize['col'](_0x3f640e[_0xa24c('0x2a')])),{'$like':sequelize['fn'](_0xa24c('0x37'),'%'+_0x1d0379[_0xa24c('0x26')]['filter']+'%')});}else{var _0x472c1e={};_0x472c1e[_0x3f640e[_0xa24c('0x2a')]]={'$like':'%'+_0x1d0379[_0xa24c('0x26')][_0xa24c('0x32')]+'%'};return _0x472c1e;}}})});}_0x57c340=_[_0xa24c('0x34')]({},_0x57c340,_0x1d0379[_0xa24c('0x38')]);return _0x57c340;}; \ No newline at end of file +var _0xbd51=['fields','split','isEmpty','forOwn','type','DATE','isPlainObject','parse','$gte','utc','format','$lte','subtract','name','uniqueid','isArray','offset','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','length','isObject','isString','unset','hasOwnProperty','omit','isNumeric','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','match','push','getOptions','query','$id','filters','intersection','attributes','model','limit','where','pick','filter','object','columns','value','merge','VIRTUAL','lower','options','lodash','moment','keys'];(function(_0x4c21b9,_0xa04ef6){var _0x3904d2=function(_0x55b468){while(--_0x55b468){_0x4c21b9['push'](_0x4c21b9['shift']());}};_0x3904d2(++_0xa04ef6);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x27d148,_0x1ad9cb){_0x27d148=_0x27d148-0x0;var _0xe1e647=_0xbd51[_0x27d148];return _0xe1e647;};'use strict';var _=require(_0x1bd5('0x0'));var sequelize=require('sequelize');var moment=require(_0x1bd5('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1c04fa){var _0x3b9f71=['ne'];try{var _0x1a9dcc=JSON['parse'](_0x1c04fa);var _0x4d1bba=Object['keys'](_0x1a9dcc)[0x0];return _0x3b9f71['includes'](_0x4d1bba);}catch(_0x3bce00){return![];}}function getOperatorValue(_0x362b24){var _0x43e6b6=JSON['parse'](_0x362b24);var _0x29abea=Object[_0x1bd5('0x2')](_0x43e6b6)[0x0];var _0x19077c=_0x43e6b6[_0x29abea];return{['$'+_0x29abea]:_0x19077c};}exports[_0x1bd5('0x3')]=function(_0xd8418f){var _0x4a7f90=null;if(_0xd8418f){_0x4a7f90=_0xd8418f[_0x1bd5('0x4')](',');}return _0x4a7f90;};exports['filters']=function(_0x2bd975,_0x28df8e){var _0x3b868a={};if(!_[_0x1bd5('0x5')](_0x2bd975)){_[_0x1bd5('0x6')](_0x2bd975,function(_0x3e3d06,_0x4c9f06){try{if(_0x28df8e){var _0x456ef8=_['find'](_0x28df8e,{'name':_0x4c9f06})||{};if(hasSequelizeOperator(_0x3e3d06)){_0x3b868a[_0x4c9f06]=getOperatorValue(_0x3e3d06);}else if(_0x456ef8[_0x1bd5('0x7')]===_0x1bd5('0x8')&&_[_0x1bd5('0x9')](_0x3e3d06)){var _0x14606b=JSON[_0x1bd5('0xa')](_0x3e3d06);var _0x81f02c={'$gte':moment(moment(_0x14606b[_0x1bd5('0xb')])['format']('YYYY-MM-DD'))[_0x1bd5('0xc')]()[_0x1bd5('0xd')](),'$lte':moment(moment(_0x14606b[_0x1bd5('0xe')])[_0x1bd5('0xd')]('YYYY-MM-DD'))['utc']()[_0x1bd5('0xf')](0x1,'s')[_0x1bd5('0xd')]()};_0x3b868a[_0x4c9f06]=_0x81f02c;}else if(_0x456ef8[_0x1bd5('0x10')]===_0x1bd5('0x11')){_0x3b868a[_0x4c9f06]=_0x3e3d06;}else{_0x3b868a[_0x4c9f06]=_[_0x1bd5('0x12')](_0x3e3d06)?_0x3e3d06:JSON[_0x1bd5('0xa')](_0x3e3d06);}}else{_0x3b868a[_0x4c9f06]=_[_0x1bd5('0x12')](_0x3e3d06)?_0x3e3d06:JSON[_0x1bd5('0xa')](_0x3e3d06);}}catch(_0x4670b5){_0x3b868a[_0x4c9f06]=_0x3e3d06['split'](',');}});}return _0x3b868a;};exports['limit']=function(_0x2fe1a1){_0x2fe1a1=parseInt(_0x2fe1a1,0xa);if(!_0x2fe1a1||_0x2fe1a1<0x0){_0x2fe1a1=LIMIT_VALUE;}return _0x2fe1a1;};exports[_0x1bd5('0x13')]=function(_0x476bd1){_0x476bd1=parseInt(_0x476bd1,0xa);if(!_0x476bd1||_0x476bd1<0x0){_0x476bd1=0x0;}return _0x476bd1;};exports[_0x1bd5('0x14')]=function(_0x459649){var _0x2ff39a,_0x3fbb39=null;if(_0x459649){_0x2ff39a=_0x459649[_0x1bd5('0x4')](',');_0x3fbb39=_[_0x1bd5('0x15')](_0x2ff39a,function(_0xb1ac1e){if(_0xb1ac1e[_0x1bd5('0x16')]('-')===0x0){return[_0xb1ac1e===_0x1bd5('0x17')?sequelize[_0x1bd5('0x18')](sequelize[_0x1bd5('0x19')](_0x1bd5('0x17')),_0x1bd5('0x1a')):_0xb1ac1e[_0x1bd5('0x1b')](0x1),_0x1bd5('0x1c')];}else{return[_0xb1ac1e==='priority'?sequelize[_0x1bd5('0x18')](sequelize['col'](_0x1bd5('0x17')),_0x1bd5('0x1a')):_0xb1ac1e,_0x1bd5('0x1d')];}});}return _0x3fbb39;};exports['omit']=function(_0x3f4156,_0x4fa37c){if(_[_0x1bd5('0x5')](_0x3f4156)){return _0x3f4156;}if(_[_0x1bd5('0x12')](_0x3f4156)){for(var _0x3dba4f=0x0;_0x3dba4f<_0x3f4156[_0x1bd5('0x1e')];_0x3dba4f+=0x1){_0x3f4156[_0x3dba4f]=this['omit'](_0x3f4156[_0x3dba4f],_0x4fa37c);}return _0x3f4156;}if(!_[_0x1bd5('0x1f')](_0x3f4156)){return _0x3f4156;}if(_[_0x1bd5('0x20')](_0x4fa37c)){_0x4fa37c=[_0x4fa37c];}if(!_[_0x1bd5('0x12')](_0x4fa37c)){return _0x3f4156;}for(var _0x3b1090=0x0;_0x3b1090<_0x4fa37c['length'];_0x3b1090+=0x1){_[_0x1bd5('0x21')](_0x3f4156,_0x4fa37c[_0x3b1090]);}for(var _0x24d4d9 in _0x3f4156){if(_0x3f4156[_0x1bd5('0x22')](_0x24d4d9)){_0x3f4156[_0x24d4d9]=this[_0x1bd5('0x23')](_0x3f4156[_0x24d4d9],_0x4fa37c);}}return _0x3f4156;};exports[_0x1bd5('0x24')]=function(_0xc73670){return _0xc73670['match'](RegExp(_0x1bd5('0x25')))?!![]:![];};exports[_0x1bd5('0x26')]=function(_0x8d53ba){return _0x8d53ba['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x1bd5('0x27')]=function(_0x32748e){var _0x345181=[];_0x32748e[_0x1bd5('0x4')](/[ ,]+/)[_0x1bd5('0x28')](function(_0x1d612b){_0x1d612b=_0x1d612b['replace'](/([^:]")"+/g,'$1');_0x1d612b='+'+_0x1d612b+'*';var _0x49ea1e=/[ `!@#$%^&*()_\-?~]/;if(_0x1d612b[_0x1bd5('0x29')](_0x49ea1e))_0x1d612b='\x22'+_0x1d612b+'\x22';_0x345181[_0x1bd5('0x2a')](_0x1d612b);});return _0x345181['join']('\x20');};exports[_0x1bd5('0x2b')]=function(_0x198b88,_0x1efa8c,_0x24dc20){var _0x558452={},_0x5d69bd={};if(_0x1efa8c[_0x1bd5('0x2c')][_0x1bd5('0x2d')]){_0x1efa8c[_0x1bd5('0x2c')]['id']=_0x1efa8c[_0x1bd5('0x2c')][_0x1bd5('0x2d')];delete _0x1efa8c[_0x1bd5('0x2c')][_0x1bd5('0x2d')];}_0x558452['model']=_[_0x1bd5('0x15')](_0x198b88,_0x1bd5('0x10'));_0x558452[_0x1bd5('0x2c')]=_[_0x1bd5('0x2')](_0x1efa8c[_0x1bd5('0x2c')]);_0x558452[_0x1bd5('0x2e')]=_[_0x1bd5('0x2f')](_0x558452['model'],_0x558452[_0x1bd5('0x2c')]);_0x5d69bd[_0x1bd5('0x30')]=_[_0x1bd5('0x2f')](_0x558452[_0x1bd5('0x31')],this[_0x1bd5('0x3')](_0x1efa8c[_0x1bd5('0x2c')][_0x1bd5('0x3')]));_0x5d69bd['attributes']=_0x5d69bd['attributes'][_0x1bd5('0x1e')]?_0x5d69bd[_0x1bd5('0x30')]:_0x558452[_0x1bd5('0x31')];if(!_0x1efa8c['query'][_0x1bd5('0x22')]('nolimit')){_0x5d69bd[_0x1bd5('0x32')]=this[_0x1bd5('0x32')](_0x1efa8c[_0x1bd5('0x2c')][_0x1bd5('0x32')]);_0x5d69bd[_0x1bd5('0x13')]=this[_0x1bd5('0x13')](_0x1efa8c[_0x1bd5('0x2c')][_0x1bd5('0x13')]);}_0x5d69bd['order']=this[_0x1bd5('0x14')](_0x1efa8c[_0x1bd5('0x2c')]['sort']);_0x5d69bd[_0x1bd5('0x33')]=this[_0x1bd5('0x2e')](_[_0x1bd5('0x34')](_0x1efa8c['query'],_0x558452[_0x1bd5('0x2e')]),_0x198b88);if(_0x1efa8c[_0x1bd5('0x2c')][_0x1bd5('0x35')]){var _0x4074f1=_0x198b88;var _0x4e8ff7=_0x1efa8c[_0x1bd5('0x2c')][_0x1bd5('0x35')];if(typeof _0x4e8ff7===_0x1bd5('0x36')){_0x4074f1=_[_0x1bd5('0x35')](_0x198b88,function(_0x4de69a){return _['includes'](_0x4e8ff7[_0x1bd5('0x37')],_0x4de69a[_0x1bd5('0x10')]);});_0x4e8ff7=_0x4e8ff7[_0x1bd5('0x38')];}_0x5d69bd['where']=_[_0x1bd5('0x39')](_0x5d69bd[_0x1bd5('0x33')],{'$or':_['map'](_0x4074f1,function(_0x1eacac){if(_0x1eacac['type']!==_0x1bd5('0x3a')){if(_0x24dc20){return sequelize[_0x1bd5('0x33')](sequelize['fn']('lower',sequelize[_0x1bd5('0x19')](_0x1eacac[_0x1bd5('0x10')])),{'$like':sequelize['fn'](_0x1bd5('0x3b'),'%'+_0x1efa8c[_0x1bd5('0x2c')][_0x1bd5('0x35')]+'%')});}else{var _0x25b35a={};_0x25b35a[_0x1eacac[_0x1bd5('0x10')]]={'$like':'%'+_0x1efa8c[_0x1bd5('0x2c')][_0x1bd5('0x35')]+'%'};return _0x25b35a;}}})});}_0x5d69bd=_[_0x1bd5('0x39')]({},_0x5d69bd,_0x1efa8c[_0x1bd5('0x3c')]);return _0x5d69bd;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index d9ba25c..bd3e4aa 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 _0x010b=['then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','error','merge','catch','getRealtimeAgents','pause','*pause','busy','getAgentStatus','isArray','Queue','map','findOne','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','findAll','name','fullname','chatPause','faxPause','openchannelPause','find','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','ASC','getUpdatedSortOptions','internal','substring','indexOf','validateSortParameter','sort','globalStatus','pauseType','toLowerCase','sortAgentsByStatus','online','lastLoginAt','lastPauseAt','address','chatCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','faxStatus','openchannelStatusTime','smsStatusTime','whatsappStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','pick','filterAgentAttributes','lodash','jayson/promise','../../mysqldb','client','http','mailPause','smsPause','voicePause','whatsappPause','every','filter','length','idle','unknown','ringing','isNil','voiceStatus','chatStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents'];(function(_0x3a118f,_0xb04e94){var _0x4247a1=function(_0x3e16b9){while(--_0x3e16b9){_0x3a118f['push'](_0x3a118f['shift']());}};_0x4247a1(++_0xb04e94);}(_0x010b,0xac));var _0xb010=function(_0x47b6da,_0x5848a4){_0x47b6da=_0x47b6da-0x0;var _0x4a239b=_0x010b[_0x47b6da];return _0x4a239b;};'use strict';var _=require(_0xb010('0x0'));var jayson=require(_0xb010('0x1'));var db=require(_0xb010('0x2'))['db'];var amiClient=jayson[_0xb010('0x3')]['http']({'port':0x232a});var routingClient=jayson[_0xb010('0x3')][_0xb010('0x4')]({'port':0x232c});function isAgentPaused(_0x4a8720,_0x495a89){var _0x3a3721=[_0x4a8720['chatPause'],_0x4a8720['faxPause'],_0x4a8720[_0xb010('0x5')],_0x4a8720['openchannelPause'],_0x4a8720[_0xb010('0x6')],_0x4a8720[_0xb010('0x7')],_0x4a8720[_0xb010('0x8')]];if(!_0x495a89)return _[_0xb010('0x9')](_0x3a3721);var _0x5804f4=_[_0xb010('0xa')](_0x3a3721);return _0x5804f4[_0xb010('0xb')]>0x0&&_0x5804f4[_0xb010('0xb')]<_0x3a3721[_0xb010('0xb')]?!![]:![];}function isIdle(_0x310ab2){return _0x310ab2===_0xb010('0xc')||_0x310ab2===_0xb010('0xd')||_0x310ab2==='unavailable'||_0x310ab2===_0xb010('0xe')||_[_0xb010('0xf')](_0x310ab2);}function isAgentIdle(_0x421fec){if(_0x421fec[_0xb010('0x10')]!==_0xb010('0xc')&&_0x421fec[_0xb010('0x7')]){_0x421fec['voiceStatus']='pause';return![];}return _[_0xb010('0x9')]([_0x421fec[_0xb010('0x11')],_0x421fec['faxStatus'],_0x421fec[_0xb010('0x12')],_0x421fec[_0xb010('0x13')],_0x421fec[_0xb010('0x14')],_0x421fec[_0xb010('0x10')],_0x421fec[_0xb010('0x15')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xb010('0x16')](_0xb010('0x17'),{})[_0xb010('0x18')](function(_0x232770){if(_0x232770['error']){throw new Error(_0xb010('0x19'));}var _0xe272e1=_0x232770[_0xb010('0x1a')];return routingClient[_0xb010('0x16')](_0xb010('0x17'),{})['then'](function(_0x27d814){if(_0x27d814[_0xb010('0x1b')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x16ab3e=_0x27d814[_0xb010('0x1a')];return _[_0xb010('0x1c')]({},_0xe272e1,_0x16ab3e);});})[_0xb010('0x1d')](function(_0x5d0b56){throw _0x5d0b56;});}exports[_0xb010('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x317ed8){var _0x359eaf=_0xb010('0xd');if(isAgentPaused(_0x317ed8))_0x359eaf=_0xb010('0x1f');else if(isAgentPaused(_0x317ed8,!![]))_0x359eaf=_0xb010('0x20');else if(isAgentIdle(_0x317ed8))_0x359eaf=_0xb010('0xc');else _0x359eaf=_0xb010('0x21');return _0x359eaf;}exports[_0xb010('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0x278be5,_0x31e3a4){var _0x477a07=_[_0xb010('0x23')](_0x278be5)?_0x278be5:[_0x278be5];var _0x6a089f=_['startCase'](_0x31e3a4)+_0xb010('0x24');var _0x279cbd=_[_0xb010('0x25')](_0x477a07,function(_0xbc1f63){return db[_0x6a089f][_0xb010('0x26')]({'where':{'id':_0xbc1f63}})[_0xb010('0x18')](function(_0x5987a9){if(!_0x5987a9)return[];return _0x5987a9[_0xb010('0x27')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xb010('0x28')](_0x279cbd)[_0xb010('0x18')](function(_0x4f9a72){var _0x1f2ddc=_(_0x4f9a72)[_0xb010('0x29')]()['map']('id')[_0xb010('0x2a')]()[_0xb010('0x2b')]();return _0x1f2ddc;});}exports[_0xb010('0x2c')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x422e24,_0x73dcc,_0x2dfc9f){try{if(_0x73dcc[_0xb010('0xb')]>0x0){_0x422e24=_0x422e24[_0xb010('0xa')](function(_0x2fb085){return _0x73dcc[_0xb010('0x2d')](_0x2fb085['id']);});}var _0x3a50e6=_0x422e24[_0xb010('0xa')](function(_0x39405a){var _0x28b69f='busy';if(isAgentIdle(_0x39405a)){_0x28b69f=_0xb010('0xc');}return _0x28b69f===_0x2dfc9f;});return _[_0xb010('0x25')](_0x3a50e6,'id');}catch(_0x901ea6){throw _0x901ea6;}}exports[_0xb010('0x2e')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x5ee61d,_0x54b139,_0x44ccc4){return Promise[_0xb010('0x2f')]()[_0xb010('0x18')](function(){if(_0x54b139[_0xb010('0xb')]>0x0){_0x5ee61d=_0x5ee61d['filter'](function(_0x2300f2){return _0x54b139[_0xb010('0x2d')](_0x2300f2['id']);});}return _0x5ee61d;})[_0xb010('0x18')](function(){return db[_0xb010('0x30')][_0xb010('0x31')]({'attributes':['id',_0xb010('0x32'),_0xb010('0x33'),_0xb010('0x34'),_0xb010('0x35'),_0xb010('0x5'),_0xb010('0x36'),_0xb010('0x6'),_0xb010('0x7'),_0xb010('0x8'),'pauseType'],'where':{'id':{'$in':_['map'](_0x5ee61d,'id')}},'raw':!![]});})['then'](function(_0x1fc279){return _0x1fc279['map'](function(_0x240f53){var _0x145955=_[_0xb010('0x37')](_0x5ee61d,['id',_0x240f53['id']]);var _0x2227a6=filterAgentAttributes(_0x145955);_[_0xb010('0x1c')](_0x240f53,_0x2227a6);_0x240f53['globalStatus']=getAgentStatus(_0x240f53);return _0x240f53;});})[_0xb010('0x18')](function(_0x2e7ae6){var _0x5239a0=sortAgentsByStatus(_0x2e7ae6,_0x44ccc4);return _['map'](_0x5239a0,'id');})[_0xb010('0x1d')](function(_0x4f396c){throw _0x4f396c;});}exports[_0xb010('0x38')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x5bbb8e){var _0x14ab37={'fields':[],'order':null};var _0x1f15c3=_0x5bbb8e[_0xb010('0x39')](',');_0x14ab37[_0xb010('0x3a')]=_[_0xb010('0xa')](_0x1f15c3,function(_0x3a38d1){if(!_0x3a38d1['includes']('globalStatus')){return!![];}_0x14ab37[_0xb010('0x3b')]=_[_0xb010('0x3c')](_0x3a38d1,'-')?_0xb010('0x3d'):_0xb010('0x3e');return![];});return _0x14ab37;}exports[_0xb010('0x3f')]=getUpdatedSortOptions;function validateSortParameter(_0x364a6a){if(_0x364a6a['includes'](_0xb010('0x33'))&&!_0x364a6a[_0xb010('0x2d')](_0xb010('0x40'))){var _0x4e55ae=_0x364a6a[_0xb010('0x41')](0x0,_0x364a6a[_0xb010('0x42')](_0xb010('0x33')));_0x364a6a+=','+_0x4e55ae+'internal';}return _0x364a6a;}exports[_0xb010('0x43')]=validateSortParameter;function sortAgentsByStatus(_0x10c59f,_0x3ed803){var _0x2789e4=_0x10c59f[_0xb010('0x44')](function(_0x50f071,_0x4301de){if(_0x50f071[_0xb010('0x45')]===_0x4301de[_0xb010('0x45')]){if(_0x50f071['globalStatus']===_0xb010('0x1f')){if(_0x3ed803===_0xb010('0x3d')){return(_0x50f071['pauseType']||'')<(_0x4301de[_0xb010('0x46')]||'')||_0x50f071['fullname'][_0xb010('0x47')]()>_0x4301de[_0xb010('0x33')]['toLowerCase']()?0x1:-0x1;}else{return(_0x50f071[_0xb010('0x46')]||'')<(_0x4301de[_0xb010('0x46')]||'')||_0x50f071[_0xb010('0x33')][_0xb010('0x47')]()>_0x4301de[_0xb010('0x33')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x3ed803===_0xb010('0x3d')){return _0x50f071[_0xb010('0x33')][_0xb010('0x47')]()<_0x4301de[_0xb010('0x33')][_0xb010('0x47')]()?0x1:-0x1;}else{return _0x50f071[_0xb010('0x33')][_0xb010('0x47')]()<_0x4301de[_0xb010('0x33')][_0xb010('0x47')]()?-0x1:0x1;}}}else{if(_0x3ed803===_0xb010('0x3d')){return _0x50f071[_0xb010('0x45')]<_0x4301de[_0xb010('0x45')]?0x1:-0x1;}else{return _0x50f071[_0xb010('0x45')]<_0x4301de[_0xb010('0x45')]?-0x1:0x1;}}});return _0x2789e4;}exports[_0xb010('0x48')]=sortAgentsByStatus;function filterAgentAttributes(_0x3487b0){var _0x3b1d98=['userpic',_0xb010('0x49'),_0xb010('0x4a'),_0xb010('0x4b'),_0xb010('0x46'),_0xb010('0x4b'),'internal',_0xb010('0x4c'),_0xb010('0x34'),'openchannelPause',_0xb010('0x5'),_0xb010('0x6'),_0xb010('0x8'),_0xb010('0x35'),_0xb010('0x7'),_0xb010('0x4d'),'openchannelCapacity','mailCapacity','smsCapacity',_0xb010('0x4e'),_0xb010('0x4f'),_0xb010('0x50'),_0xb010('0x51'),_0xb010('0x52'),_0xb010('0x53'),_0xb010('0x54'),_0xb010('0x55'),_0xb010('0x11'),_0xb010('0x13'),'mailStatus',_0xb010('0x14'),_0xb010('0x15'),_0xb010('0x56'),'voiceStatus','chatStatusTime',_0xb010('0x57'),'mailStatusTime',_0xb010('0x58'),_0xb010('0x59'),'faxStatusTime','voiceStatusTime',_0xb010('0x5a'),_0xb010('0x5b'),_0xb010('0x5c'),_0xb010('0x5d'),_0xb010('0x5e'),_0xb010('0x5f')];var _0x4abd6d=['chatPause',_0xb010('0x36'),_0xb010('0x5'),_0xb010('0x6'),'whatsappPause',_0xb010('0x35'),_0xb010('0x7'),_0xb010('0x49')];var _0x3f81b5=_(_0x3487b0)['omit'](_0x4abd6d)[_0xb010('0x60')](_0x3b1d98)[_0xb010('0x2b')]();return _0x3f81b5;}exports[_0xb010('0x61')]=filterAgentAttributes; \ No newline at end of file +var _0xf439=['mailStatus','openchannelStatus','smsStatus','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','busy','getAgentStatus','isArray','Queue','map','findOne','getAgents','all','value','getAgentIdsByQueues','resolve','includes','findAll','name','mailPause','smsPause','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','DESC','getUpdatedSortOptions','fullname','internal','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','online','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','omit','pick','filterAgentAttributes','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','openchannelPause','voicePause','whatsappPause','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','pause','every','chatStatus','faxStatus'];(function(_0x294e1e,_0x3ee80c){var _0x19e1f9=function(_0x58a6bd){while(--_0x58a6bd){_0x294e1e['push'](_0x294e1e['shift']());}};_0x19e1f9(++_0x3ee80c);}(_0xf439,0x16b));var _0x9f43=function(_0x5eb04f,_0x45057a){_0x5eb04f=_0x5eb04f-0x0;var _0xfd675b=_0xf439[_0x5eb04f];return _0xfd675b;};'use strict';var _=require('lodash');var jayson=require(_0x9f43('0x0'));var db=require(_0x9f43('0x1'))['db'];var amiClient=jayson[_0x9f43('0x2')]['http']({'port':0x232a});var routingClient=jayson['client'][_0x9f43('0x3')]({'port':0x232c});function isAgentPaused(_0x2076fd,_0xe0aedd){var _0x33fa15=[_0x2076fd[_0x9f43('0x4')],_0x2076fd[_0x9f43('0x5')],_0x2076fd['mailPause'],_0x2076fd[_0x9f43('0x6')],_0x2076fd['smsPause'],_0x2076fd[_0x9f43('0x7')],_0x2076fd[_0x9f43('0x8')]];if(!_0xe0aedd)return _['every'](_0x33fa15);var _0x4a04ad=_[_0x9f43('0x9')](_0x33fa15);return _0x4a04ad[_0x9f43('0xa')]>0x0&&_0x4a04ad['length']<_0x33fa15[_0x9f43('0xa')]?!![]:![];}function isIdle(_0x3b0cde){return _0x3b0cde===_0x9f43('0xb')||_0x3b0cde===_0x9f43('0xc')||_0x3b0cde===_0x9f43('0xd')||_0x3b0cde===_0x9f43('0xe')||_[_0x9f43('0xf')](_0x3b0cde);}function isAgentIdle(_0x5d18c2){if(_0x5d18c2['voiceStatus']!=='idle'&&_0x5d18c2['voicePause']){_0x5d18c2[_0x9f43('0x10')]=_0x9f43('0x11');return![];}return _[_0x9f43('0x12')]([_0x5d18c2[_0x9f43('0x13')],_0x5d18c2[_0x9f43('0x14')],_0x5d18c2[_0x9f43('0x15')],_0x5d18c2[_0x9f43('0x16')],_0x5d18c2[_0x9f43('0x17')],_0x5d18c2[_0x9f43('0x10')],_0x5d18c2['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0x9f43('0x18'),{})[_0x9f43('0x19')](function(_0x3b3e4b){if(_0x3b3e4b[_0x9f43('0x1a')]){throw new Error(_0x9f43('0x1b'));}var _0x224779=_0x3b3e4b[_0x9f43('0x1c')];return routingClient[_0x9f43('0x1d')](_0x9f43('0x18'),{})[_0x9f43('0x19')](function(_0x41d200){if(_0x41d200['error']){throw new Error(_0x9f43('0x1e'));}var _0x55a4d7=_0x41d200[_0x9f43('0x1c')];return _[_0x9f43('0x1f')]({},_0x224779,_0x55a4d7);});})[_0x9f43('0x20')](function(_0x278d41){throw _0x278d41;});}exports[_0x9f43('0x21')]=getRealtimeAgents;function getAgentStatus(_0x1ca062){var _0x488e6d=_0x9f43('0xc');if(isAgentPaused(_0x1ca062))_0x488e6d=_0x9f43('0x11');else if(isAgentPaused(_0x1ca062,!![]))_0x488e6d='*pause';else if(isAgentIdle(_0x1ca062))_0x488e6d=_0x9f43('0xb');else _0x488e6d=_0x9f43('0x22');return _0x488e6d;}exports[_0x9f43('0x23')]=getAgentStatus;function getAgentIdsByQueues(_0x15f79e,_0x2e3a63){var _0x3d6627=_[_0x9f43('0x24')](_0x15f79e)?_0x15f79e:[_0x15f79e];var _0x14a336=_['startCase'](_0x2e3a63)+_0x9f43('0x25');var _0x4abb5d=_[_0x9f43('0x26')](_0x3d6627,function(_0x279f49){return db[_0x14a336][_0x9f43('0x27')]({'where':{'id':_0x279f49}})[_0x9f43('0x19')](function(_0x46f7b8){if(!_0x46f7b8)return[];return _0x46f7b8[_0x9f43('0x28')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x9f43('0x29')](_0x4abb5d)[_0x9f43('0x19')](function(_0x24f492){var _0x9001db=_(_0x24f492)['flatten']()[_0x9f43('0x26')]('id')['uniq']()[_0x9f43('0x2a')]();return _0x9001db;});}exports[_0x9f43('0x2b')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x123328,_0x2224bd,_0xa22d73){try{if(_0x2224bd['length']>0x0){_0x123328=_0x123328[_0x9f43('0x9')](function(_0x10ee7d){return _0x2224bd['includes'](_0x10ee7d['id']);});}var _0x3f784b=_0x123328['filter'](function(_0x47861e){var _0x62252=_0x9f43('0x22');if(isAgentIdle(_0x47861e)){_0x62252='idle';}return _0x62252===_0xa22d73;});return _[_0x9f43('0x26')](_0x3f784b,'id');}catch(_0x15d700){throw _0x15d700;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x169146,_0x458299,_0x4c2ba4){return Promise[_0x9f43('0x2c')]()[_0x9f43('0x19')](function(){if(_0x458299['length']>0x0){_0x169146=_0x169146[_0x9f43('0x9')](function(_0x1e42a3){return _0x458299[_0x9f43('0x2d')](_0x1e42a3['id']);});}return _0x169146;})[_0x9f43('0x19')](function(){return db['User'][_0x9f43('0x2e')]({'attributes':['id',_0x9f43('0x2f'),'fullname',_0x9f43('0x4'),_0x9f43('0x5'),_0x9f43('0x30'),_0x9f43('0x6'),_0x9f43('0x31'),_0x9f43('0x7'),'whatsappPause',_0x9f43('0x32')],'where':{'id':{'$in':_[_0x9f43('0x26')](_0x169146,'id')}},'raw':!![]});})[_0x9f43('0x19')](function(_0x1813eb){return _0x1813eb[_0x9f43('0x26')](function(_0x303019){var _0x311443=_[_0x9f43('0x33')](_0x169146,['id',_0x303019['id']]);var _0x166ec0=filterAgentAttributes(_0x311443);_[_0x9f43('0x1f')](_0x303019,_0x166ec0);_0x303019[_0x9f43('0x34')]=getAgentStatus(_0x303019);return _0x303019;});})[_0x9f43('0x19')](function(_0x30a5c8){var _0x58312f=sortAgentsByStatus(_0x30a5c8,_0x4c2ba4);return _[_0x9f43('0x26')](_0x58312f,'id');})[_0x9f43('0x20')](function(_0x8dd379){throw _0x8dd379;});}exports[_0x9f43('0x35')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x1a909e){var _0x266f84={'fields':[],'order':null};var _0x360d11=_0x1a909e[_0x9f43('0x36')](',');_0x266f84[_0x9f43('0x37')]=_['filter'](_0x360d11,function(_0x389e17){if(!_0x389e17[_0x9f43('0x2d')](_0x9f43('0x34'))){return!![];}_0x266f84[_0x9f43('0x38')]=_['startsWith'](_0x389e17,'-')?_0x9f43('0x39'):'ASC';return![];});return _0x266f84;}exports[_0x9f43('0x3a')]=getUpdatedSortOptions;function validateSortParameter(_0xba31c2){if(_0xba31c2['includes'](_0x9f43('0x3b'))&&!_0xba31c2[_0x9f43('0x2d')]('internal')){var _0x35c58a=_0xba31c2['substring'](0x0,_0xba31c2['indexOf'](_0x9f43('0x3b')));_0xba31c2+=','+_0x35c58a+_0x9f43('0x3c');}return _0xba31c2;}exports[_0x9f43('0x3d')]=validateSortParameter;function sortAgentsByStatus(_0x1d697f,_0x4f775f){var _0x580abd=_0x1d697f[_0x9f43('0x3e')](function(_0x197574,_0x4634a1){if(_0x197574[_0x9f43('0x34')]===_0x4634a1[_0x9f43('0x34')]){if(_0x197574[_0x9f43('0x34')]==='pause'){if(_0x4f775f===_0x9f43('0x39')){return(_0x197574['pauseType']||'')<(_0x4634a1[_0x9f43('0x32')]||'')||_0x197574[_0x9f43('0x3b')][_0x9f43('0x3f')]()>_0x4634a1[_0x9f43('0x3b')]['toLowerCase']()?0x1:-0x1;}else{return(_0x197574[_0x9f43('0x32')]||'')<(_0x4634a1['pauseType']||'')||_0x197574[_0x9f43('0x3b')][_0x9f43('0x3f')]()>_0x4634a1['fullname']['toLowerCase']()?-0x1:0x1;}}else{if(_0x4f775f===_0x9f43('0x39')){return _0x197574[_0x9f43('0x3b')][_0x9f43('0x3f')]()<_0x4634a1[_0x9f43('0x3b')][_0x9f43('0x3f')]()?0x1:-0x1;}else{return _0x197574['fullname']['toLowerCase']()<_0x4634a1[_0x9f43('0x3b')][_0x9f43('0x3f')]()?-0x1:0x1;}}}else{if(_0x4f775f==='DESC'){return _0x197574['globalStatus']<_0x4634a1[_0x9f43('0x34')]?0x1:-0x1;}else{return _0x197574[_0x9f43('0x34')]<_0x4634a1[_0x9f43('0x34')]?-0x1:0x1;}}});return _0x580abd;}exports[_0x9f43('0x40')]=sortAgentsByStatus;function filterAgentAttributes(_0x389daa){var _0x44bd00=['userpic',_0x9f43('0x41'),_0x9f43('0x42'),_0x9f43('0x43'),_0x9f43('0x32'),_0x9f43('0x43'),_0x9f43('0x3c'),_0x9f43('0x44'),_0x9f43('0x4'),_0x9f43('0x6'),_0x9f43('0x30'),'smsPause',_0x9f43('0x8'),_0x9f43('0x5'),_0x9f43('0x7'),_0x9f43('0x45'),_0x9f43('0x46'),_0x9f43('0x47'),_0x9f43('0x48'),_0x9f43('0x49'),_0x9f43('0x4a'),_0x9f43('0x4b'),_0x9f43('0x4c'),_0x9f43('0x4d'),_0x9f43('0x4e'),'whatsappCurrentCapacity',_0x9f43('0x4f'),_0x9f43('0x13'),'openchannelStatus','mailStatus',_0x9f43('0x17'),_0x9f43('0x50'),_0x9f43('0x14'),_0x9f43('0x10'),_0x9f43('0x51'),_0x9f43('0x52'),_0x9f43('0x53'),_0x9f43('0x54'),_0x9f43('0x55'),_0x9f43('0x56'),_0x9f43('0x57'),_0x9f43('0x58'),_0x9f43('0x59'),_0x9f43('0x5a'),_0x9f43('0x5b'),_0x9f43('0x5c'),'routealias'];var _0x140333=[_0x9f43('0x4'),'openchannelPause',_0x9f43('0x30'),_0x9f43('0x31'),_0x9f43('0x8'),_0x9f43('0x5'),_0x9f43('0x7'),_0x9f43('0x41')];var _0x138e04=_(_0x389daa)[_0x9f43('0x5d')](_0x140333)[_0x9f43('0x5e')](_0x44bd00)[_0x9f43('0x2a')]();return _0x138e04;}exports[_0x9f43('0x5f')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 76e5523..45416a7 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 _0x9488=['available','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','talking','unknown','pTalking','message','statusMessage','dialActive','dialMethod','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','voice','request','startCase','Queues','then','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','getRealtimeQueues','inbound','concat','outbound','map','get','find','merge','pick','initializeQueues','jayson/promise','util','client','http'];(function(_0x217fcd,_0x32ed22){var _0x4bc114=function(_0x331b3e){while(--_0x331b3e){_0x217fcd['push'](_0x217fcd['shift']());}};_0x4bc114(++_0x32ed22);}(_0x9488,0xc0));var _0x8948=function(_0x5ea611,_0x51dc9f){_0x5ea611=_0x5ea611-0x0;var _0x5a8ed6=_0x9488[_0x5ea611];return _0x5a8ed6;};'use strict';var _=require('lodash');var jayson=require(_0x8948('0x0'));var util=require(_0x8948('0x1'));var amiClient=jayson[_0x8948('0x2')][_0x8948('0x3')]({'port':0x232a});var routingClient=jayson[_0x8948('0x2')][_0x8948('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x8948('0x4'),_0x8948('0x5'),_0x8948('0x6'),_0x8948('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x8948('0x8'),_0x8948('0x9'),_0x8948('0xa'),_0x8948('0xb'),_0x8948('0xc'),'onHold','ringing','ringInUse',_0x8948('0xd'),'unavailable',_0x8948('0xe')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x8948('0xf'),'originated',_0x8948('0x10'),_0x8948('0x11'),_0x8948('0x12'),_0x8948('0x13'),_0x8948('0x14'),'startPredictive',_0x8948('0x15'),_0x8948('0x16'),_0x8948('0x17'),_0x8948('0x18'),_0x8948('0x19'),_0x8948('0x1a'),_0x8948('0x1b'),_0x8948('0x1c'),_0x8948('0x1d'),_0x8948('0x1e'),'predictiveIntervalAnsweredCalls',_0x8948('0x1f'),'predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x346cb1,_0x43400f){var _0x31beb8=_0x43400f===_0x8948('0x20')?amiClient:routingClient;return _0x31beb8[_0x8948('0x21')](_[_0x8948('0x22')](_0x43400f)+_0x8948('0x23'),_0x346cb1)[_0x8948('0x24')](function(_0x386463){if(_0x386463[_0x8948('0x25')])throw new Error(util['format'](_0x8948('0x26'),_0x43400f));return _0x386463['result'];})['catch'](function(_0x1d7b93){throw _0x1d7b93;});}exports[_0x8948('0x27')]=getRealtimeQueues;function initializeQueues(_0x1f4852,_0x9d78f5,_0x5a6b4f,_0x702c80){var _0x3e3b3f=DEFAULT_QUEUE_ATTRIBUTES;if(_0x5a6b4f==='voice'){if(_0x702c80===_0x8948('0x28')){_0x3e3b3f=_0x3e3b3f[_0x8948('0x29')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x702c80===_0x8948('0x2a')){_0x3e3b3f=_0x3e3b3f['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x1f4852[_0x8948('0x2b')](function(_0x4fda69){var _0x142286=_0x4fda69[_0x8948('0x2c')]({'plain':!![]});_0x142286[_0x8948('0x6')]=0x0;_0x142286[_0x8948('0xb')]=0x0;_0x142286[_0x8948('0x5')]=0x0;_0x142286['available']=0x0;_0x142286['waiting']=0x0;if(_0x5a6b4f===_0x8948('0x20')){_0x142286[_0x8948('0xd')]=0x0;_0x142286[_0x8948('0x8')]=0x0;if(_0x702c80===_0x8948('0x2a')){_0x142286['pTalking']=0x0;_0x142286['originated']=0x0;}}var _0x553066=_[_0x8948('0x2d')](_0x9d78f5,['id',_0x142286['id']]);if(_0x553066){_[_0x8948('0x2e')](_0x142286,_[_0x8948('0x2f')](_0x553066,_0x3e3b3f));}return _0x142286;});}exports[_0x8948('0x30')]=initializeQueues; \ No newline at end of file +var _0x6407=['voice','request','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','inbound','concat','get','outbound','find','merge','initializeQueues','util','client','http','available','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','onHold','ringing','ringInUse','talking','unavailable','unknown','pTalking','originated','statusMessage','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime'];(function(_0x33cc7d,_0x5a1414){var _0x511eab=function(_0x4acdaa){while(--_0x4acdaa){_0x33cc7d['push'](_0x33cc7d['shift']());}};_0x511eab(++_0x5a1414);}(_0x6407,0x76));var _0x7640=function(_0xe7ba9,_0x2ff262){_0xe7ba9=_0xe7ba9-0x0;var _0x34e6bd=_0x6407[_0xe7ba9];return _0x34e6bd;};'use strict';var _=require('lodash');var jayson=require('jayson/promise');var util=require(_0x7640('0x0'));var amiClient=jayson[_0x7640('0x1')][_0x7640('0x2')]({'port':0x232a});var routingClient=jayson[_0x7640('0x1')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x7640('0x3'),_0x7640('0x4'),_0x7640('0x5'),_0x7640('0x6')];var VOICE_QUEUE_ATTRIBUTES=[_0x7640('0x7'),_0x7640('0x8'),_0x7640('0x9'),_0x7640('0xa'),'notInUse',_0x7640('0xb'),_0x7640('0xc'),_0x7640('0xd'),_0x7640('0xe'),_0x7640('0xf'),_0x7640('0x10')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x7640('0x11'),_0x7640('0x12'),'message',_0x7640('0x13'),_0x7640('0x14'),_0x7640('0x15'),_0x7640('0x16'),_0x7640('0x17'),_0x7640('0x18'),_0x7640('0x19'),_0x7640('0x1a'),_0x7640('0x1b'),_0x7640('0x1c'),'dialPredictiveInterval',_0x7640('0x1d'),_0x7640('0x1e'),_0x7640('0x1f'),'predictiveIntervalTotalCalls',_0x7640('0x20'),_0x7640('0x21'),'predictiveIntervalDroppedCallsCallersExit',_0x7640('0x22'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x3ce082,_0x2d8140){var _0x279c40=_0x2d8140===_0x7640('0x23')?amiClient:routingClient;return _0x279c40[_0x7640('0x24')](_['startCase'](_0x2d8140)+_0x7640('0x25'),_0x3ce082)[_0x7640('0x26')](function(_0x430df7){if(_0x430df7[_0x7640('0x27')])throw new Error(util[_0x7640('0x28')](_0x7640('0x29'),_0x2d8140));return _0x430df7[_0x7640('0x2a')];})[_0x7640('0x2b')](function(_0xac4afb){throw _0xac4afb;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0xe70b46,_0x29a528,_0x527ecc,_0x4680d3){var _0x1a8257=DEFAULT_QUEUE_ATTRIBUTES;if(_0x527ecc===_0x7640('0x23')){if(_0x4680d3===_0x7640('0x2c')){_0x1a8257=_0x1a8257[_0x7640('0x2d')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x4680d3==='outbound'){_0x1a8257=_0x1a8257[_0x7640('0x2d')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0xe70b46['map'](function(_0x1af7aa){var _0x3ba058=_0x1af7aa[_0x7640('0x2e')]({'plain':!![]});_0x3ba058[_0x7640('0x5')]=0x0;_0x3ba058[_0x7640('0xa')]=0x0;_0x3ba058[_0x7640('0x4')]=0x0;_0x3ba058[_0x7640('0x3')]=0x0;_0x3ba058[_0x7640('0x6')]=0x0;if(_0x527ecc===_0x7640('0x23')){_0x3ba058['talking']=0x0;_0x3ba058[_0x7640('0x7')]=0x0;if(_0x4680d3===_0x7640('0x2f')){_0x3ba058[_0x7640('0x11')]=0x0;_0x3ba058[_0x7640('0x12')]=0x0;}}var _0x44087a=_[_0x7640('0x30')](_0x29a528,['id',_0x3ba058['id']]);if(_0x44087a){_[_0x7640('0x31')](_0x3ba058,_['pick'](_0x44087a,_0x1a8257));}return _0x3ba058;});}exports[_0x7640('0x32')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 1a598d7..2c31df2 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(_0x8ae98b,_0x155f88){var _0xc30bd4=function(_0x5ca462){while(--_0x5ca462){_0x8ae98b['push'](_0x8ae98b['shift']());}};_0xc30bd4(++_0x155f88);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +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(_0x3e186f,_0x2eb7be){var _0x3595bf=function(_0x5cb578){while(--_0x5cb578){_0x3e186f['push'](_0x3e186f['shift']());}};_0x3595bf(++_0x2eb7be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 d186d72..c7065dc 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 _0xb7be=['../environment','networkInterfaces','keys','length','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','cpus','map','model','join','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','ipAddress','substring','crypto','bimedia-machine-uuid','child_process'];(function(_0x357b6e,_0x12d5b8){var _0x41016f=function(_0x5e8c43){while(--_0x5e8c43){_0x357b6e['push'](_0x357b6e['shift']());}};_0x41016f(++_0x12d5b8);}(_0xb7be,0xf9));var _0xeb7b=function(_0x22ca59,_0x33db1f){_0x22ca59=_0x22ca59-0x0;var _0x4c875d=_0xb7be[_0x22ca59];return _0x4c875d;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xeb7b('0x0'));var machine=require(_0xeb7b('0x1'));var exec=require(_0xeb7b('0x2'))['execSync'];var config=require(_0xeb7b('0x3'));function getInterfaces(){var _0x162376=[];var _0x5d247f=os[_0xeb7b('0x4')]();var _0x5504dd=_['orderBy'](_[_0xeb7b('0x5')](_0x5d247f));for(var _0x4d8e06=0x0;_0x4d8e06<_0x5504dd[_0xeb7b('0x6')];_0x4d8e06++){var _0x36e6f7=_0x5d247f[_0x5504dd[_0x4d8e06]]['filter'](function(_0x17b704){return _0x17b704['family']===_0xeb7b('0x7')&&_0x17b704[_0xeb7b('0x8')]===![];});_0x162376=_0x162376[_0xeb7b('0x9')](_0x36e6f7);}return _0x162376;}function getFirstInterface(){var _0x2c5617=_[_0xeb7b('0xa')](getInterfaces());return{'macAddress':_0x2c5617&&_0x2c5617[_0xeb7b('0xb')]?_0x2c5617['mac']:_0xeb7b('0xc'),'ipAddress':_0x2c5617&&_0x2c5617['address']?_0x2c5617[_0xeb7b('0xd')]:_0xeb7b('0xe')};}exports[_0xeb7b('0xf')]=getFirstInterface;function getCPUhash(){var _0x42b450=_[_0xeb7b('0x10')](os[_0xeb7b('0x11')]()[_0xeb7b('0x12')](function(_0xf4cc01){return _0xf4cc01[_0xeb7b('0x13')];}))[_0xeb7b('0x14')](':');return crypto[_0xeb7b('0x15')](_0xeb7b('0x16'))[_0xeb7b('0x17')](_0x42b450)[_0xeb7b('0x18')](_0xeb7b('0x19'));}exports[_0xeb7b('0x1a')]=function(){var _0x1595f6=os[_0xeb7b('0x1b')]();var _0x5876e1=/[0-9a-f-]{36}/;if(config[_0xeb7b('0x1c')]&&_0x5876e1[_0xeb7b('0x1d')](config[_0xeb7b('0x1c')])){return config[_0xeb7b('0x1c')];}else if(_0x1595f6===_0xeb7b('0x1e')){return exec(_0xeb7b('0x1f'),{'encoding':_0xeb7b('0x20')})[_0xeb7b('0x21')]('\x0d\x0a','');}else{var _0x44e06d=getFirstInterface();var _0x212070=getCPUhash();var _0x5cc8f7=_0x212070+'|'+os['hostname']()+'|'+_0x44e06d['macAddress']+'|'+_0x44e06d[_0xeb7b('0x22')];var _0x459b8a=crypto[_0xeb7b('0x15')](_0xeb7b('0x16'))[_0xeb7b('0x17')](_0x5cc8f7)[_0xeb7b('0x18')](_0xeb7b('0x19'));return _0x459b8a[_0xeb7b('0x23')](0x0,0x8)+'-'+_0x459b8a[_0xeb7b('0x23')](0x8,0xc)+'-'+_0x459b8a['substring'](0xc,0x10)+'-'+_0x459b8a[_0xeb7b('0x23')](0x10,0x14)+'-'+_0x459b8a[_0xeb7b('0x23')](0x14);}}; \ No newline at end of file +var _0x0b2f=['IPv4','internal','concat','head','mac','127.0.0.1','getFirstInterface','cpus','map','join','md5','update','getUuid','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','ipAddress','digest','hex','substring','lodash','crypto','bimedia-machine-uuid','child_process','../environment','orderBy','keys','filter','family'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x0b2f,0x197));var _0xf0b2=function(_0x5c4d4d,_0x180b6a){_0x5c4d4d=_0x5c4d4d-0x0;var _0x457a38=_0x0b2f[_0x5c4d4d];return _0x457a38;};'use strict';var _=require(_0xf0b2('0x0'));var os=require('os');var crypto=require(_0xf0b2('0x1'));var machine=require(_0xf0b2('0x2'));var exec=require(_0xf0b2('0x3'))['execSync'];var config=require(_0xf0b2('0x4'));function getInterfaces(){var _0x151799=[];var _0x419e1f=os['networkInterfaces']();var _0x371596=_[_0xf0b2('0x5')](_[_0xf0b2('0x6')](_0x419e1f));for(var _0x15e233=0x0;_0x15e233<_0x371596['length'];_0x15e233++){var _0xd2aa35=_0x419e1f[_0x371596[_0x15e233]][_0xf0b2('0x7')](function(_0x3488a7){return _0x3488a7[_0xf0b2('0x8')]===_0xf0b2('0x9')&&_0x3488a7[_0xf0b2('0xa')]===![];});_0x151799=_0x151799[_0xf0b2('0xb')](_0xd2aa35);}return _0x151799;}function getFirstInterface(){var _0x3e81aa=_[_0xf0b2('0xc')](getInterfaces());return{'macAddress':_0x3e81aa&&_0x3e81aa[_0xf0b2('0xd')]?_0x3e81aa[_0xf0b2('0xd')]:'00:00:00:00:00:00','ipAddress':_0x3e81aa&&_0x3e81aa['address']?_0x3e81aa['address']:_0xf0b2('0xe')};}exports[_0xf0b2('0xf')]=getFirstInterface;function getCPUhash(){var _0x45f05b=_['orderBy'](os[_0xf0b2('0x10')]()[_0xf0b2('0x11')](function(_0x2f585a){return _0x2f585a['model'];}))[_0xf0b2('0x12')](':');return crypto['createHash'](_0xf0b2('0x13'))[_0xf0b2('0x14')](_0x45f05b)['digest']('hex');}exports[_0xf0b2('0x15')]=function(){var _0xe1ef39=os[_0xf0b2('0x16')]();var _0x6bc1e1=/[0-9a-f-]{36}/;if(config[_0xf0b2('0x17')]&&_0x6bc1e1['test'](config[_0xf0b2('0x17')])){return config[_0xf0b2('0x17')];}else if(_0xe1ef39===_0xf0b2('0x18')){return exec(_0xf0b2('0x19'),{'encoding':_0xf0b2('0x1a')})[_0xf0b2('0x1b')]('\x0d\x0a','');}else{var _0x2bdea4=getFirstInterface();var _0x3dd0f3=getCPUhash();var _0x14ac40=_0x3dd0f3+'|'+os['hostname']()+'|'+_0x2bdea4['macAddress']+'|'+_0x2bdea4[_0xf0b2('0x1c')];var _0x578c64=crypto['createHash'](_0xf0b2('0x13'))['update'](_0x14ac40)[_0xf0b2('0x1d')](_0xf0b2('0x1e'));return _0x578c64['substring'](0x0,0x8)+'-'+_0x578c64[_0xf0b2('0x1f')](0x8,0xc)+'-'+_0x578c64[_0xf0b2('0x1f')](0xc,0x10)+'-'+_0x578c64[_0xf0b2('0x1f')](0x10,0x14)+'-'+_0x578c64['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 6b6d685..ccfcdfb 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 _0x9b44=['get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','update','encryptString','YYYY-MM-DD\x20HH:mm','decryptString','days','DEMO\x20START\x20AT\x20%s','catch','error','message','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','format','%s/api/servers/%s/check?version=%s','exports','then'];(function(_0x15e8f5,_0x9d644c){var _0x434d83=function(_0x160045){while(--_0x160045){_0x15e8f5['push'](_0x15e8f5['shift']());}};_0x434d83(++_0x9d644c);}(_0x9b44,0x13f));var _0x49b4=function(_0x1943d9,_0x245bb8){_0x1943d9=_0x1943d9-0x0;var _0x4b4f3f=_0x9b44[_0x1943d9];return _0x4b4f3f;};'use strict';var util=require(_0x49b4('0x0'));var moment=require(_0x49b4('0x1'));var rp=require('request-promise');var BPromise=require(_0x49b4('0x2'));var pkginfo=require(_0x49b4('0x3'))(module,_0x49b4('0x4'));var db=require(_0x49b4('0x5'))['db'];var encryptor=require(_0x49b4('0x6'));var hardware=require(_0x49b4('0x7'));var logger=require(_0x49b4('0x8'))(_0x49b4('0x9'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x111756){return new BPromise(function(_0x41ddf4,_0x1598d2){var _0x17547f=util[_0x49b4('0xa')](_0x49b4('0xb'),HOST,_0x111756,module[_0x49b4('0xc')][_0x49b4('0x4')]);if(oldToken){_0x17547f=util[_0x49b4('0xa')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x111756,module[_0x49b4('0xc')]['version'],oldToken);}var _0x4f5fe8={'uri':_0x17547f,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x4f5fe8)[_0x49b4('0xd')](function(_0x440cff){_0x41ddf4(_0x440cff);})['catch'](function(_0x7d952d){_0x1598d2(_0x7d952d);});});}function manageLicense(_0x2e2438,_0x1ef16a){var _0x51d489=_0x1ef16a[_0x49b4('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x51d489[_0x49b4('0xf')]!==_0x2e2438&&!_0x51d489[_0x49b4('0x10')]){oldToken=_0x51d489[_0x49b4('0xf')];}httpRequest(_0x2e2438)[_0x49b4('0xd')](function(_0x4b18c7){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4b18c7[_0x49b4('0x11')]){isOldTokenSent=![];if(!_0x51d489[_0x49b4('0x9')]&&_0x51d489[_0x49b4('0x9')]!=_0x4b18c7[_0x49b4('0x9')]||_0x51d489[_0x49b4('0x9')]&&_0x51d489[_0x49b4('0x10')]){logger[_0x49b4('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x51d489[_0x49b4('0x9')]&&!_0x51d489[_0x49b4('0x10')]&&_0x51d489[_0x49b4('0x9')]!=_0x4b18c7[_0x49b4('0x9')]){logger[_0x49b4('0x12')](_0x49b4('0x13'));}if(_0x51d489[_0x49b4('0x9')]&&!_0x51d489[_0x49b4('0x10')]&&_0x51d489[_0x49b4('0x9')]==_0x4b18c7['license']){return _0x1ef16a;}return _0x1ef16a['update']({'data1':_0x2e2438,'data2':null,'license':_0x4b18c7[_0x49b4('0x9')]});}else{if(_0x4b18c7[_0x49b4('0x9')]||_0x51d489[_0x49b4('0x9')]){if(!_0x51d489[_0x49b4('0x10')]){if(_0x51d489['data1']==_0x2e2438){GRAY_PERIOD_REASON=_0x49b4('0x14');logger['info'](_0x49b4('0x15'));}else{GRAY_PERIOD_REASON=_0x49b4('0x16');logger[_0x49b4('0x12')](_0x49b4('0x17'),_0x51d489['data1'],_0x2e2438);}logger[_0x49b4('0x12')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x49b4('0xa')]('YYYY-MM-DD\x20HH:mm'));return _0x1ef16a[_0x49b4('0x18')]({'data2':encryptor[_0x49b4('0x19')](moment()['format'](_0x49b4('0x1a')))});}else{if(moment()['diff'](encryptor[_0x49b4('0x1b')](_0x51d489[_0x49b4('0x10')]),_0x49b4('0x1c'))>DAYS){logger[_0x49b4('0x12')](_0x49b4('0x1d'),moment()[_0x49b4('0xa')](_0x49b4('0x1a')));isOldTokenSent=![];return _0x1ef16a[_0x49b4('0x18')]({'data1':_0x2e2438,'data2':null,'license':null});}}}else{if(_0x51d489[_0x49b4('0xf')]!=_0x2e2438){logger[_0x49b4('0x12')](_0x49b4('0x17'),_0x51d489[_0x49b4('0xf')],_0x2e2438);return _0x1ef16a[_0x49b4('0x18')]({'data1':_0x2e2438,'data2':null,'license':null});}}}return _0x1ef16a;})[_0x49b4('0xd')](function(_0x55c843){_0x1ef16a=_0x55c843;})[_0x49b4('0x1e')](function(_0x3661a6){logger[_0x49b4('0x1f')](_0x3661a6[_0x49b4('0x20')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x49b4('0x21')](),_0x1ef16a);},TIME);});}function defaultLicense(){var _0x2241d8=hardware['getUuid']();if(_0x2241d8){return db[_0x49b4('0x22')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x2241d8}})[_0x49b4('0x23')](function(_0x447f09,_0x21970c){logger[_0x49b4('0x12')](_0x49b4('0x24'),_0x2241d8);manageLicense(_0x2241d8,_0x447f09);})[_0x49b4('0x1e')](function(_0x3ff784){logger['error'](_0x3ff784[_0x49b4('0x20')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x298f=['update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','request-promise','pkginfo','../../mysqldb','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','version','exports','GET','catch','get','data1','data2','then','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x298f,0x65));var _0xf298=function(_0x2575c9,_0x59410d){_0x2575c9=_0x2575c9-0x0;var _0x42c20c=_0x298f[_0x2575c9];return _0x42c20c;};'use strict';var util=require(_0xf298('0x0'));var moment=require('moment');var rp=require(_0xf298('0x1'));var BPromise=require('bluebird');var pkginfo=require(_0xf298('0x2'))(module,'version');var db=require(_0xf298('0x3'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xf298('0x4'));var logger=require(_0xf298('0x5'))(_0xf298('0x6'));var HOST=_0xf298('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x352c2e){return new BPromise(function(_0x3c0f80,_0xe6d2aa){var _0x454a28=util[_0xf298('0x8')](_0xf298('0x9'),HOST,_0x352c2e,module['exports'][_0xf298('0xa')]);if(oldToken){_0x454a28=util[_0xf298('0x8')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x352c2e,module[_0xf298('0xb')][_0xf298('0xa')],oldToken);}var _0x1177a9={'uri':_0x454a28,'method':_0xf298('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x1177a9)['then'](function(_0x2afc2a){_0x3c0f80(_0x2afc2a);})[_0xf298('0xd')](function(_0xf04d1b){_0xe6d2aa(_0xf04d1b);});});}function manageLicense(_0xfb75a0,_0x555f00){var _0x26d2a3=_0x555f00[_0xf298('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x26d2a3[_0xf298('0xf')]!==_0xfb75a0&&!_0x26d2a3[_0xf298('0x10')]){oldToken=_0x26d2a3[_0xf298('0xf')];}httpRequest(_0xfb75a0)[_0xf298('0x11')](function(_0x5faa32){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5faa32[_0xf298('0x12')]){isOldTokenSent=![];if(!_0x26d2a3[_0xf298('0x6')]&&_0x26d2a3[_0xf298('0x6')]!=_0x5faa32[_0xf298('0x6')]||_0x26d2a3[_0xf298('0x6')]&&_0x26d2a3['data2']){logger[_0xf298('0x13')](_0xf298('0x14'));}if(_0x26d2a3[_0xf298('0x6')]&&!_0x26d2a3[_0xf298('0x10')]&&_0x26d2a3['license']!=_0x5faa32[_0xf298('0x6')]){logger[_0xf298('0x13')](_0xf298('0x15'));}if(_0x26d2a3[_0xf298('0x6')]&&!_0x26d2a3[_0xf298('0x10')]&&_0x26d2a3[_0xf298('0x6')]==_0x5faa32[_0xf298('0x6')]){return _0x555f00;}return _0x555f00[_0xf298('0x16')]({'data1':_0xfb75a0,'data2':null,'license':_0x5faa32['license']});}else{if(_0x5faa32['license']||_0x26d2a3[_0xf298('0x6')]){if(!_0x26d2a3[_0xf298('0x10')]){if(_0x26d2a3['data1']==_0xfb75a0){GRAY_PERIOD_REASON='Disabled';logger['info'](_0xf298('0x17'));}else{GRAY_PERIOD_REASON='Changed';logger[_0xf298('0x13')](_0xf298('0x18'),_0x26d2a3[_0xf298('0xf')],_0xfb75a0);}logger[_0xf298('0x13')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xf298('0x19')](),moment()[_0xf298('0x8')]('YYYY-MM-DD\x20HH:mm'));return _0x555f00[_0xf298('0x16')]({'data2':encryptor[_0xf298('0x1a')](moment()[_0xf298('0x8')](_0xf298('0x1b')))});}else{if(moment()[_0xf298('0x1c')](encryptor[_0xf298('0x1d')](_0x26d2a3[_0xf298('0x10')]),_0xf298('0x1e'))>DAYS){logger[_0xf298('0x13')](_0xf298('0x1f'),moment()['format']('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x555f00['update']({'data1':_0xfb75a0,'data2':null,'license':null});}}}else{if(_0x26d2a3[_0xf298('0xf')]!=_0xfb75a0){logger[_0xf298('0x13')](_0xf298('0x18'),_0x26d2a3[_0xf298('0xf')],_0xfb75a0);return _0x555f00[_0xf298('0x16')]({'data1':_0xfb75a0,'data2':null,'license':null});}}}return _0x555f00;})[_0xf298('0x11')](function(_0x105dad){_0x555f00=_0x105dad;})[_0xf298('0xd')](function(_0x36c85a){logger[_0xf298('0x20')](_0x36c85a[_0xf298('0x21')]);})[_0xf298('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0xf298('0x23')](),_0x555f00);},TIME);});}function defaultLicense(){var _0xbe86cd=hardware[_0xf298('0x23')]();if(_0xbe86cd){return db[_0xf298('0x24')][_0xf298('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0xbe86cd}})[_0xf298('0x26')](function(_0x102a61,_0xce1718){logger[_0xf298('0x13')](_0xf298('0x27'),_0xbe86cd);manageLicense(_0xbe86cd,_0x102a61);})[_0xf298('0xd')](function(_0x180c92){logger['error'](_0x180c92[_0xf298('0x21')]);});}}exports[_0xf298('0x28')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 23e0d18..0a75b27 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 _0x51b3=['License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','find','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add','days','format','grayReason','changed','message','User','role','sequelize','col','count','user','users','telephones','forEach','pick','countBy','telephone'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x51b3,0x1b3));var _0x351b=function(_0xc93543,_0x13c745){_0xc93543=_0xc93543-0x0;var _0x4ad884=_0x51b3[_0xc93543];return _0x4ad884;};'use strict';var util=require(_0x351b('0x0'));var _=require('lodash');var moment=require(_0x351b('0x1'));var BPromise=require(_0x351b('0x2'));var hardware=require(_0x351b('0x3'));var encryptor=require(_0x351b('0x4'));var db=require(_0x351b('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x351b('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x351b('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x351b('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x351b('0x8'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0xa29329){return new BPromise(function(_0x1446ff,_0x22d002){return db[_0x351b('0x9')][_0x351b('0xa')](_['defaults'](_0xa29329,{'raw':!![],'where':{'id':0x1}}))[_0x351b('0xb')](function(_0xc32faf){return checkLicense(_0xc32faf,null);})['then'](function(_0x62fc29){_0x1446ff(_0x62fc29);return;})[_0x351b('0xc')](function(_0x4aa8ce){_0x22d002(_0x4aa8ce);});});}function checkLicense(_0x31d3c7,_0x5bcaae){if(!_0x31d3c7){demoLicense[_0x351b('0xd')]=_0x31d3c7[_0x351b('0xe')];return demoLicense;}try{var _0x3e2d3d=_0x5bcaae||_0x31d3c7[_0x351b('0xf')];if(_[_0x351b('0x10')](_0x3e2d3d)){throw new Error(_0x351b('0x11'));}var _0x2f04d5=_0x31d3c7['data1'];var _0x4b8194=_0x31d3c7[_0x351b('0x12')];var _0x5122f7=_0x2f04d5[_0x351b('0x13')]('-')[0x4];var _0x1d402a=_0x2f04d5[_0x351b('0x13')]('-')[0x0];var _0x2ed3ca=encryptor[_0x351b('0x14')](_0x3e2d3d,util['format'](_0x351b('0x15'),_0x5122f7,_0x2f04d5,_0x1d402a));var _0x168c2f=JSON[_0x351b('0x16')](_0x2ed3ca);_0x168c2f[_0x351b('0x17')]=![];_0x168c2f[_0x351b('0xd')]=_0x2f04d5;_0x168c2f[_0x351b('0x18')]=hardware['getUuid']();if(_0x4b8194){var _0xd17e8e=encryptor[_0x351b('0x14')](_0x4b8194);_0x168c2f[_0x351b('0x19')]=_0xd17e8e;_0x168c2f[_0x351b('0x1a')]=moment(_0xd17e8e)[_0x351b('0x1b')](0x7,_0x351b('0x1c'))[_0x351b('0x1d')]();_0x168c2f[_0x351b('0x1e')]=_0x168c2f[_0x351b('0xd')]!=_0x168c2f[_0x351b('0x18')]?_0x351b('0x1f'):'disabled';}return _0x168c2f;}catch(_0x5750c1){breakingLicense['uuid']=_0x31d3c7[_0x351b('0xe')];breakingLicense[_0x351b('0x20')]=_0x5750c1[_0x351b('0x20')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x28933f,_0x43bf16){getLicense()['then'](function(_0x43b09c){return db[_0x351b('0x21')]['findAll']({'attributes':[_0x351b('0x22'),[db['sequelize']['fn']('COUNT',db[_0x351b('0x23')][_0x351b('0x24')](_0x351b('0x22'))),_0x351b('0x25')]],'group':_0x351b('0x22'),'where':{'role':{'$or':['admin',_0x351b('0x26'),'telephone']}},'raw':!![]})[_0x351b('0xb')](function(_0x260f60){var _0x40c1e3={'user':_0x43b09c[_0x351b('0x27')]||0x0,'telephone':_0x43b09c[_0x351b('0x28')]||0x0};_0x260f60[_0x351b('0x29')](function(_0x120bd2){var _0x3e9a00=_0x120bd2[_0x351b('0x22')]==='admin'?'user':_0x120bd2[_0x351b('0x22')];_0x40c1e3[_0x3e9a00]-=_0x120bd2['count'];if(_0x40c1e3[_0x3e9a00]<0x0)_0x40c1e3[_0x3e9a00]=0x0;});_0x28933f(_0x40c1e3);return;});})[_0x351b('0xc')](function(_0x1d7e52){_0x43bf16(_0x1d7e52);});});}function checkUserLimits(_0x3f05ff){return new BPromise(function(_0x3afebe,_0x2f040b){getLimits()['then'](function(_0x371d52){var _0x2b8a40=_[_0x351b('0x2a')](_[_0x351b('0x2b')](_0x3f05ff,_0x351b('0x22')),['admin','user',_0x351b('0x2c')]);var _0x1611ea=(_0x2b8a40['admin']||0x0)+(_0x2b8a40[_0x351b('0x26')]||0x0);var _0x443617=_0x2b8a40[_0x351b('0x2c')]||0x0;if(_0x1611ea>_0x371d52['user'])return _0x2f040b(_0x351b('0x2d'));if(_0x443617>_0x371d52[_0x351b('0x2c')])return _0x2f040b(_0x351b('0x2e'));return _0x3afebe();})['catch'](function(_0x2b13fa){_0x2f040b(_0x2b13fa);});});}module[_0x351b('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x755b=['License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','machineUuid','deadline','add','days','grayReason','changed','disabled','data1','message','User','findAll','role','sequelize','COUNT','col','count','admin','user','telephone','users','telephones','forEach','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','defaults','then','uuid','license','isEmpty'];(function(_0x2bc678,_0x39864e){var _0x4db407=function(_0x208a8f){while(--_0x208a8f){_0x2bc678['push'](_0x2bc678['shift']());}};_0x4db407(++_0x39864e);}(_0x755b,0x89));var _0xb755=function(_0x1adc9f,_0x4f767f){_0x1adc9f=_0x1adc9f-0x0;var _0x4a790f=_0x755b[_0x1adc9f];return _0x4a790f;};'use strict';var util=require(_0xb755('0x0'));var _=require(_0xb755('0x1'));var moment=require(_0xb755('0x2'));var BPromise=require(_0xb755('0x3'));var hardware=require(_0xb755('0x4'));var encryptor=require(_0xb755('0x5'));var db=require(_0xb755('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb755('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0xb755('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb755('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xb755('0x9'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x232bc0){return new BPromise(function(_0xbc04b6,_0x525587){return db[_0xb755('0xa')]['find'](_[_0xb755('0xb')](_0x232bc0,{'raw':!![],'where':{'id':0x1}}))[_0xb755('0xc')](function(_0x249b00){return checkLicense(_0x249b00,null);})['then'](function(_0x245968){_0xbc04b6(_0x245968);return;})['catch'](function(_0x5ff10f){_0x525587(_0x5ff10f);});});}function checkLicense(_0x4dfd45,_0x40596d){if(!_0x4dfd45){demoLicense[_0xb755('0xd')]=_0x4dfd45['data1'];return demoLicense;}try{var _0x39d7fb=_0x40596d||_0x4dfd45[_0xb755('0xe')];if(_[_0xb755('0xf')](_0x39d7fb)){throw new Error(_0xb755('0x10'));}var _0x396521=_0x4dfd45['data1'];var _0x4f8c1e=_0x4dfd45[_0xb755('0x11')];var _0x1fbc8d=_0x396521[_0xb755('0x12')]('-')[0x4];var _0xa6f43a=_0x396521[_0xb755('0x12')]('-')[0x0];var _0x28e7fd=encryptor[_0xb755('0x13')](_0x39d7fb,util[_0xb755('0x14')](_0xb755('0x15'),_0x1fbc8d,_0x396521,_0xa6f43a));var _0x3a23e6=JSON[_0xb755('0x16')](_0x28e7fd);_0x3a23e6['demo']=![];_0x3a23e6[_0xb755('0xd')]=_0x396521;_0x3a23e6[_0xb755('0x17')]=hardware[_0xb755('0x8')]();if(_0x4f8c1e){var _0x3751d8=encryptor[_0xb755('0x13')](_0x4f8c1e);_0x3a23e6['gray']=_0x3751d8;_0x3a23e6[_0xb755('0x18')]=moment(_0x3751d8)[_0xb755('0x19')](0x7,_0xb755('0x1a'))[_0xb755('0x14')]();_0x3a23e6[_0xb755('0x1b')]=_0x3a23e6[_0xb755('0xd')]!=_0x3a23e6['machineUuid']?_0xb755('0x1c'):_0xb755('0x1d');}return _0x3a23e6;}catch(_0x23ed19){breakingLicense['uuid']=_0x4dfd45[_0xb755('0x1e')];breakingLicense[_0xb755('0x1f')]=_0x23ed19[_0xb755('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x573b8b,_0x17d4a6){getLicense()[_0xb755('0xc')](function(_0x188d47){return db[_0xb755('0x20')][_0xb755('0x21')]({'attributes':[_0xb755('0x22'),[db[_0xb755('0x23')]['fn'](_0xb755('0x24'),db[_0xb755('0x23')][_0xb755('0x25')](_0xb755('0x22'))),_0xb755('0x26')]],'group':_0xb755('0x22'),'where':{'role':{'$or':[_0xb755('0x27'),_0xb755('0x28'),_0xb755('0x29')]}},'raw':!![]})[_0xb755('0xc')](function(_0x48f7dd){var _0x339c94={'user':_0x188d47[_0xb755('0x2a')]||0x0,'telephone':_0x188d47[_0xb755('0x2b')]||0x0};_0x48f7dd[_0xb755('0x2c')](function(_0x1f678f){var _0x29b267=_0x1f678f[_0xb755('0x22')]===_0xb755('0x27')?_0xb755('0x28'):_0x1f678f[_0xb755('0x22')];_0x339c94[_0x29b267]-=_0x1f678f[_0xb755('0x26')];if(_0x339c94[_0x29b267]<0x0)_0x339c94[_0x29b267]=0x0;});_0x573b8b(_0x339c94);return;});})[_0xb755('0x2d')](function(_0x1d2d40){_0x17d4a6(_0x1d2d40);});});}function checkUserLimits(_0x1da194){return new BPromise(function(_0x17058c,_0x255c76){getLimits()[_0xb755('0xc')](function(_0x586eb8){var _0x55140c=_[_0xb755('0x2e')](_[_0xb755('0x2f')](_0x1da194,_0xb755('0x22')),[_0xb755('0x27'),'user',_0xb755('0x29')]);var _0x157ebc=(_0x55140c[_0xb755('0x27')]||0x0)+(_0x55140c[_0xb755('0x28')]||0x0);var _0x122c03=_0x55140c[_0xb755('0x29')]||0x0;if(_0x157ebc>_0x586eb8[_0xb755('0x28')])return _0x255c76(_0xb755('0x30'));if(_0x122c03>_0x586eb8['telephone'])return _0x255c76(_0xb755('0x31'));return _0x17058c();})[_0xb755('0x2d')](function(_0x14edf3){_0x255c76(_0x14edf3);});});}module[_0xb755('0x32')]={'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 c6e789b..7a61902 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 _0x8e3f=['secret','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x3df935,_0x3fc970){var _0x5d45b0=function(_0xf75f24){while(--_0xf75f24){_0x3df935['push'](_0x3df935['shift']());}};_0x5d45b0(++_0x3fc970);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8e3f[_0x4565bf];return _0x5610ba;};'use strict';module[_0xf8e3('0x0')]={'DOMAIN':_0xf8e3('0x1'),'SESSION_SECRET':_0xf8e3('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xf8e3('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x7916=['myappanuglar-secret','app-id','exports'];(function(_0x499210,_0x325b29){var _0x2e153d=function(_0x951263){while(--_0x951263){_0x499210['push'](_0x499210['shift']());}};_0x2e153d(++_0x325b29);}(_0x7916,0x128));var _0x6791=function(_0x5b41f1,_0x1a72d0){_0x5b41f1=_0x5b41f1-0x0;var _0x14cb16=_0x7916[_0x5b41f1];return _0x14cb16;};'use strict';module[_0x6791('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x6791('0x1'),'GOOGLE_ID':_0x6791('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 128e690..ccc069a 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fd7=['fileLogger','../utils/loggers'];(function(_0x5c2311,_0x24ae77){var _0x2f0ab2=function(_0x4769aa){while(--_0x4769aa){_0x5c2311['push'](_0x5c2311['shift']());}};_0x2f0ab2(++_0x24ae77);}(_0x4fd7,0x137));var _0x74fd=function(_0x44ce39,_0x124837){_0x44ce39=_0x44ce39-0x0;var _0x319326=_0x4fd7[_0x44ce39];return _0x319326;};'use strict';var fileLogger=require(_0x74fd('0x0'))[_0x74fd('0x1')];module['exports']=fileLogger; \ No newline at end of file +var _0x6699=['../utils/loggers','exports'];(function(_0x5a7993,_0x192450){var _0x5d89b6=function(_0x2b4125){while(--_0x2b4125){_0x5a7993['push'](_0x5a7993['shift']());}};_0x5d89b6(++_0x192450);}(_0x6699,0x126));var _0x9669=function(_0x25f056,_0x5e5739){_0x25f056=_0x25f056-0x0;var _0x2fb713=_0x6699[_0x25f056];return _0x2fb713;};'use strict';var fileLogger=require(_0x9669('0x0'))['fileLogger'];module[_0x9669('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 863f8f9..ea10e43 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 _0x0768=['../../services/email/index.js','routing','xdr','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','../../services/ami/index.js','agi','email'];(function(_0x572a28,_0x2d65a7){var _0x733c1=function(_0x357071){while(--_0x357071){_0x572a28['push'](_0x572a28['shift']());}};_0x733c1(++_0x2d65a7);}(_0x0768,0x1d9));var _0x8076=function(_0x164868,_0x48d9bb){_0x164868=_0x164868-0x0;var _0xd2d9a6=_0x0768[_0x164868];return _0xd2d9a6;};'use strict';var path=require(_0x8076('0x0'));var os=require('os');var config={'apps':[{'name':_0x8076('0x1'),'script':path[_0x8076('0x2')](__dirname,_0x8076('0x3'))},{'name':'ami','script':path[_0x8076('0x2')](__dirname,_0x8076('0x4'))},{'name':_0x8076('0x5'),'script':path[_0x8076('0x2')](__dirname,'../../services/agi/index.js')},{'name':_0x8076('0x6'),'script':path[_0x8076('0x2')](__dirname,_0x8076('0x7'))},{'name':_0x8076('0x8'),'script':path[_0x8076('0x2')](__dirname,'../../services/routing/index.js')},{'name':_0x8076('0x9'),'script':path[_0x8076('0x2')](__dirname,_0x8076('0xa'))}]};module[_0x8076('0xb')]=config; \ No newline at end of file +var _0x334b=['../../services/xdr/index.js','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','../../services/email/index.js','routing','../../services/routing/index.js','xdr'];(function(_0x41cdde,_0x4bd78c){var _0x2dec1e=function(_0xc4e978){while(--_0xc4e978){_0x41cdde['push'](_0x41cdde['shift']());}};_0x2dec1e(++_0x4bd78c);}(_0x334b,0xd2));var _0xb334=function(_0x30129d,_0x230171){_0x30129d=_0x30129d-0x0;var _0x496742=_0x334b[_0x30129d];return _0x496742;};'use strict';var path=require(_0xb334('0x0'));var os=require('os');var config={'apps':[{'name':_0xb334('0x1'),'script':path[_0xb334('0x2')](__dirname,_0xb334('0x3'))},{'name':_0xb334('0x4'),'script':path['join'](__dirname,_0xb334('0x5'))},{'name':'agi','script':path['join'](__dirname,'../../services/agi/index.js')},{'name':'email','script':path['join'](__dirname,_0xb334('0x6'))},{'name':_0xb334('0x7'),'script':path[_0xb334('0x2')](__dirname,_0xb334('0x8'))},{'name':_0xb334('0x9'),'script':path[_0xb334('0x2')](__dirname,_0xb334('0xa'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 26dee62..8ecf47e 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 _0x8a1a=['stop','disconnect','restart','list','describe','delete','dump','saved','pm2','connect','connected','then','start'];(function(_0x4c7e4a,_0x2ad13f){var _0x30046e=function(_0x153c89){while(--_0x153c89){_0x4c7e4a['push'](_0x4c7e4a['shift']());}};_0x30046e(++_0x2ad13f);}(_0x8a1a,0x1b5));var _0xa8a1=function(_0x585133,_0x2412a1){_0x585133=_0x585133-0x0;var _0x18254a=_0x8a1a[_0x585133];return _0x18254a;};'use strict';var pm2=require(_0xa8a1('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x462bdb,_0x3be6e8){return pm2[_0xa8a1('0x1')](function(_0x192dd9){if(_0x192dd9){return _0x3be6e8(_0x192dd9);}return _0x462bdb(_0xa8a1('0x2'));});});};exports['start']=function(_0x1e45a3){return connect()[_0xa8a1('0x3')](function(){return new BPromise(function(_0x5d17ae,_0x5d0e6f){return pm2[_0xa8a1('0x4')](_0x1e45a3,function(_0x1d54cd,_0x5a9c06){if(_0x1d54cd){return _0x5d0e6f(_0x1d54cd);}pm2['disconnect']();return _0x5d17ae(_0x5a9c06);});});});};exports[_0xa8a1('0x5')]=function(_0x157e7a){return connect()['then'](function(){return new BPromise(function(_0xc8aa82,_0x5dccb5){return pm2['stop'](_0x157e7a,function(_0x14c070,_0x513a08){if(_0x14c070){return _0x5dccb5(_0x14c070);}pm2[_0xa8a1('0x6')]();return _0xc8aa82(_0x513a08);});});});};exports[_0xa8a1('0x7')]=function(_0xa286cc){return connect()[_0xa8a1('0x3')](function(){return new BPromise(function(_0x2a6b2f,_0x1115dc){return pm2[_0xa8a1('0x7')](_0xa286cc,function(_0x442567,_0x5aac96){if(_0x442567){return _0x1115dc(_0x442567);}pm2[_0xa8a1('0x6')]();return _0x2a6b2f(_0x5aac96);});});});};exports[_0xa8a1('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x54c7d8,_0x5f20cf){return pm2[_0xa8a1('0x8')](function(_0x281eca,_0x3c8ae9){if(_0x281eca){return _0x5f20cf(_0x281eca);}pm2[_0xa8a1('0x6')]();return _0x54c7d8(_0x3c8ae9);});});});};exports[_0xa8a1('0x9')]=function(_0x11a9fe){return connect()['then'](function(){return new BPromise(function(_0x3da8fa,_0x17215e){return pm2['describe'](_0x11a9fe,function(_0xa6dfd5,_0x545d1f){if(_0xa6dfd5){return _0x17215e(_0xa6dfd5);}pm2[_0xa8a1('0x6')]();return _0x3da8fa(_0x545d1f);});});});};exports[_0xa8a1('0xa')]=function(_0x2eb9a1){return connect()[_0xa8a1('0x3')](function(){return new BPromise(function(_0x42db2a,_0x1c0dfa){return pm2[_0xa8a1('0xa')](_0x2eb9a1,function(_0x32693d,_0x324ea7){if(_0x32693d){return _0x1c0dfa(_0x32693d);}pm2[_0xa8a1('0x6')]();return _0x42db2a(_0x324ea7);});});});};exports[_0xa8a1('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x2764e7,_0x1482ac){return pm2[_0xa8a1('0xb')](function(_0x20c944){if(_0x20c944){return _0x1482ac(_0x20c944);}return _0x2764e7(_0xa8a1('0xc'));});});});}; \ No newline at end of file +var _0x524b=['saved','pm2','./config','connect','connected','then','start','stop','disconnect','restart','list','describe','delete','dump'];(function(_0x2eb049,_0x271a0f){var _0xcccee3=function(_0x526539){while(--_0x526539){_0x2eb049['push'](_0x2eb049['shift']());}};_0xcccee3(++_0x271a0f);}(_0x524b,0x15f));var _0xb524=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x524b[_0x565ed7];return _0x183ad7;};'use strict';var pm2=require(_0xb524('0x0'));var BPromise=require('bluebird');var config=require(_0xb524('0x1'));function connect(){return new BPromise(function(_0x4aad5f,_0x14f220){return pm2[_0xb524('0x2')](function(_0x1c2e84){if(_0x1c2e84){return _0x14f220(_0x1c2e84);}return _0x4aad5f(_0xb524('0x3'));});});};exports['start']=function(_0x16c281){return connect()[_0xb524('0x4')](function(){return new BPromise(function(_0x3db566,_0x1e8400){return pm2[_0xb524('0x5')](_0x16c281,function(_0x54d989,_0x39e421){if(_0x54d989){return _0x1e8400(_0x54d989);}pm2['disconnect']();return _0x3db566(_0x39e421);});});});};exports[_0xb524('0x6')]=function(_0x9d7274){return connect()[_0xb524('0x4')](function(){return new BPromise(function(_0x3e18e6,_0x46fb26){return pm2[_0xb524('0x6')](_0x9d7274,function(_0x421f83,_0x1fbee1){if(_0x421f83){return _0x46fb26(_0x421f83);}pm2[_0xb524('0x7')]();return _0x3e18e6(_0x1fbee1);});});});};exports[_0xb524('0x8')]=function(_0x300974){return connect()[_0xb524('0x4')](function(){return new BPromise(function(_0x1ade19,_0x263a83){return pm2[_0xb524('0x8')](_0x300974,function(_0x4cc820,_0x2ed359){if(_0x4cc820){return _0x263a83(_0x4cc820);}pm2[_0xb524('0x7')]();return _0x1ade19(_0x2ed359);});});});};exports[_0xb524('0x9')]=function(){return connect()[_0xb524('0x4')](function(){return new BPromise(function(_0x253ec6,_0xb98a22){return pm2[_0xb524('0x9')](function(_0x568f79,_0x4dc996){if(_0x568f79){return _0xb98a22(_0x568f79);}pm2['disconnect']();return _0x253ec6(_0x4dc996);});});});};exports['describe']=function(_0x3a1564){return connect()[_0xb524('0x4')](function(){return new BPromise(function(_0x7859a7,_0x39cf3a){return pm2[_0xb524('0xa')](_0x3a1564,function(_0x32014b,_0x2075bc){if(_0x32014b){return _0x39cf3a(_0x32014b);}pm2['disconnect']();return _0x7859a7(_0x2075bc);});});});};exports['delete']=function(_0x2a3706){return connect()[_0xb524('0x4')](function(){return new BPromise(function(_0x702244,_0x26f87f){return pm2[_0xb524('0xb')](_0x2a3706,function(_0x3eea09,_0x182089){if(_0x3eea09){return _0x26f87f(_0x3eea09);}pm2['disconnect']();return _0x702244(_0x182089);});});});};exports[_0xb524('0xc')]=function(){return connect()[_0xb524('0x4')](function(){return new BPromise(function(_0x118d9f,_0x5221e5){return pm2[_0xb524('0xc')](function(_0x2eefdd){if(_0x2eefdd){return _0x5221e5(_0x2eefdd);}return _0x118d9f(_0xb524('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 86b81cb..b68baec 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 _0x0299=['moment','ioredis','schedule','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','lastMsgAt','subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash'];(function(_0x65f140,_0x45cbc7){var _0x18fbda=function(_0x26fb39){while(--_0x26fb39){_0x65f140['push'](_0x65f140['shift']());}};_0x18fbda(++_0x45cbc7);}(_0x0299,0x73));var _0x9029=function(_0x55e13b,_0x39f6c7){_0x55e13b=_0x55e13b-0x0;var _0x2d9cd1=_0x0299[_0x55e13b];return _0x2d9cd1;};'use strict';var _=require(_0x9029('0x0'));var moment=require(_0x9029('0x1'));var Redis=require(_0x9029('0x2'));var util=require('util');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0x9029('0x3'));config[_0x9029('0x4')]=_['defaults'](config[_0x9029('0x4')],{'host':_0x9029('0x5'),'port':0x18eb});var io=require(_0x9029('0x6'))(new Redis(config[_0x9029('0x4')]));function closeInteractions(){var _0xe21bf2=0x0;var _0x41b322=[];return db[_0x9029('0x7')][_0x9029('0x8')]({'raw':!![],'attributes':['id',_0x9029('0x9')],'where':{'id':0x1}})[_0x9029('0xa')](function(_0x254652){_0xe21bf2=_0x254652[_0x9029('0x9')];if(_0xe21bf2){return db[_0x9029('0xb')]['findAll']({'raw':!![],'attributes':['id',_0x9029('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x9029('0xd')](_0x254652[_0x9029('0x9')],_0x9029('0xe'))}}});}else{return[];}})['then'](function(_0x4a4bc1){if(_0x4a4bc1&&_0x4a4bc1[_0x9029('0xf')]){_0x41b322=_['map'](_0x4a4bc1||[],'id');logger[_0x9029('0x10')](_0x9029('0x11'),_0x41b322[_0x9029('0x12')]());return db[_0x9029('0xb')]['update']({'closeReason':'system','disposition':_0x9029('0x13'),'closed':!![],'closedAt':moment()[_0x9029('0x14')](_0x9029('0x15'))},{'where':{'id':_0x41b322}});}})[_0x9029('0xa')](function(){if(_0x41b322&&_0x41b322[_0x9029('0xf')]){logger[_0x9029('0x10')](_0x9029('0x16'),_0x41b322[_0x9029('0x12')]());for(var _0x2ba463=0x0;_0x2ba463<_0x41b322[_0x9029('0xf')];_0x2ba463++){io[_0x9029('0x17')](_0x9029('0x18'),{'id':_0x41b322[_0x2ba463],'closed':!![]});}}})['catch'](function(_0x167d37){logger[_0x9029('0x19')](_0x9029('0x1a'),_0x167d37?util[_0x9029('0x1b')](_0x167d37,{'showHidden':![],'depth':null}):'');});}exports[_0x9029('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x9107=['localhost','socket.io-emitter','Setting','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','minutes','then','length','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','inspect','start','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis'];(function(_0x2e13ff,_0x531c44){var _0x50a531=function(_0x1cf936){while(--_0x1cf936){_0x2e13ff['push'](_0x2e13ff['shift']());}};_0x50a531(++_0x531c44);}(_0x9107,0x14d));var _0x7910=function(_0x378d4e,_0x53d3e7){_0x378d4e=_0x378d4e-0x0;var _0x48748b=_0x9107[_0x378d4e];return _0x48748b;};'use strict';var _=require(_0x7910('0x0'));var moment=require('moment');var Redis=require(_0x7910('0x1'));var util=require(_0x7910('0x2'));var config=require(_0x7910('0x3'));var db=require(_0x7910('0x4'))['db'];var logger=require(_0x7910('0x5'))(_0x7910('0x6'));config[_0x7910('0x7')]=_['defaults'](config[_0x7910('0x7')],{'host':_0x7910('0x8'),'port':0x18eb});var io=require(_0x7910('0x9'))(new Redis(config[_0x7910('0x7')]));function closeInteractions(){var _0x170b0e=0x0;var _0x3cdf26=[];return db[_0x7910('0xa')][_0x7910('0xb')]({'raw':!![],'attributes':['id',_0x7910('0xc')],'where':{'id':0x1}})['then'](function(_0x194e9c){_0x170b0e=_0x194e9c['chatTimeout'];if(_0x170b0e){return db[_0x7910('0xd')][_0x7910('0xe')]({'raw':!![],'attributes':['id',_0x7910('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x194e9c['chatTimeout'],_0x7910('0x10'))}}});}else{return[];}})[_0x7910('0x11')](function(_0x5beff1){if(_0x5beff1&&_0x5beff1[_0x7910('0x12')]){_0x3cdf26=_[_0x7910('0x13')](_0x5beff1||[],'id');logger['info'](_0x7910('0x14'),_0x3cdf26[_0x7910('0x15')]());return db[_0x7910('0xd')][_0x7910('0x16')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x7910('0x17'))},{'where':{'id':_0x3cdf26}});}})['then'](function(){if(_0x3cdf26&&_0x3cdf26['length']){logger['info'](_0x7910('0x18'),_0x3cdf26[_0x7910('0x15')]());for(var _0x531de2=0x0;_0x531de2<_0x3cdf26[_0x7910('0x12')];_0x531de2++){io[_0x7910('0x19')](_0x7910('0x1a'),{'id':_0x3cdf26[_0x531de2],'closed':!![]});}}})[_0x7910('0x1b')](function(_0x35e18d){logger[_0x7910('0x1c')]('[CHAT]\x20Error\x20closing\x20interactions',_0x35e18d?util[_0x7910('0x1d')](_0x35e18d,{'showHidden':![],'depth':null}):'');});}exports[_0x7910('0x1e')]=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 8d6976d..2b7f51d 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 _0xb1f9=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0xb1f9,0x177));var _0x9b1f=function(_0x145088,_0x56b565){_0x145088=_0x145088-0x0;var _0xe98efa=_0xb1f9[_0x145088];return _0xe98efa;};'use strict';function start(){var _0x1631bf=require(_0x9b1f('0x0'));return _0x1631bf[_0x9b1f('0x1')]();}module[_0x9b1f('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xec32=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x2fc66f,_0x3fa2f6){var _0x4c6ff6=function(_0xc26679){while(--_0xc26679){_0x2fc66f['push'](_0x2fc66f['shift']());}};_0x4c6ff6(++_0x3fa2f6);}(_0xec32,0x17c));var _0x2ec3=function(_0x360106,_0x464019){_0x360106=_0x360106-0x0;var _0x18a624=_0xec32[_0x360106];return _0x18a624;};'use strict';function start(){var _0x4561cd=require(_0x2ec3('0x0'));return _0x4561cd[_0x2ec3('0x1')]();}module[_0x2ec3('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 7dc361f..30b8bce 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 _0x570d=['jobs','map','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','cron','active','startAt','endAt','start','add\x20cron','update','update\x20cron','stop\x20cron','run','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','format','\x22%s\x22\x20<%s>','name','Smtp','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','subtractNumber','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','findAll','CloudProvider','keys'];(function(_0x2247db,_0x2065c0){var _0x1c1e19=function(_0x454a55){while(--_0x454a55){_0x2247db['push'](_0x2247db['shift']());}};_0x1c1e19(++_0x2065c0);}(_0x570d,0x1bc));var _0xd570=function(_0x127e64,_0x45ce7a){_0x127e64=_0x127e64-0x0;var _0x43a2e8=_0x570d[_0x127e64];return _0x43a2e8;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xd570('0x0'));var _=require(_0xd570('0x1'));var moment=require(_0xd570('0x2'));var CronJobManager=require(_0xd570('0x3'));var jayson=require(_0xd570('0x4'));var BPromise=require(_0xd570('0x5'));var logger=require(_0xd570('0x6'))('schedule');var db=require(_0xd570('0x7'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client']['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x40f16e,_0x15854f){return function(){logger[_0xd570('0x8')](_0xd570('0x9'),_0x40f16e[_0xd570('0xa')]);var _0x1d60dd=!![];var _0x5141fc=_0x40f16e[_0xd570('0xb')]['getSmtpOptions']();var _0x51d449={'account':_0x5141fc,'message':{'from':util[_0xd570('0xc')](_0xd570('0xd'),_0x40f16e['MailAccount'][_0xd570('0xe')],_0x40f16e[_0xd570('0xb')]['email']||_0x40f16e[_0xd570('0xb')][_0xd570('0xf')]['user']),'to':_0x40f16e[_0xd570('0xa')],'cc':_0x40f16e['cc'],'bcc':_0x40f16e[_0xd570('0x10')],'subject':util[_0xd570('0xc')](_0xd570('0x11'),_0x15854f[_0xd570('0xe')],_0x40f16e['subtractNumber'],_0x40f16e[_0xd570('0x12')])}};var _0x5ac3cc=path[_0xd570('0x13')](__dirname,_0xd570('0x14'));var _0x51ddf8=_0x15854f[_0xd570('0x15')];var _0x23bb98=util[_0xd570('0xc')](_0xd570('0x16'),path[_0xd570('0x17')](_0x15854f[_0xd570('0x15')],path[_0xd570('0x18')](_0x15854f[_0xd570('0x15')])),'zip');var _0x231ee2=path[_0xd570('0x13')](_0x5ac3cc,_0x51ddf8);var _0x2cb2cd=path[_0xd570('0x13')](_0x5ac3cc,_0x23bb98);if(fs[_0xd570('0x19')](_0x231ee2)){_0x15854f[_0xd570('0x1a')]=_0xd570('0x1b');_0x51d449[_0xd570('0x1c')][_0xd570('0x1d')]=[{'filename':_0x51ddf8,'path':_0x231ee2}];_0x51d449['message'][_0xd570('0x1e')]=util[_0xd570('0xc')](_0xd570('0x1f'),JSON[_0xd570('0x20')](_0x15854f,null,0x2));}else if(fs['existsSync'](_0x2cb2cd)){_0x15854f[_0xd570('0x1a')]=_0xd570('0x1b');_0x51d449[_0xd570('0x1c')][_0xd570('0x1d')]=[{'filename':_0x23bb98,'path':_0x2cb2cd}];}else{_0x51d449[_0xd570('0x1c')]['text']=_0xd570('0x21');if(!_0x40f16e[_0xd570('0x22')]){_0x1d60dd=![];logger[_0xd570('0x8')](_0xd570('0x23'));}}if(_0x1d60dd){return client[_0xd570('0x24')](_0xd570('0x25'),_0x51d449)[_0xd570('0x26')](function(_0x22170a){if(_0x22170a[_0xd570('0x27')]){return logger[_0xd570('0x27')](_0xd570('0x28'),JSON[_0xd570('0x20')](_0x22170a));}return logger[_0xd570('0x8')](_0xd570('0x29'));})['catch'](function(_0x1c39c9){return logger[_0xd570('0x27')]('error\x20mail',JSON[_0xd570('0x20')](_0x1c39c9));});}};}function handleError(){return function(_0x3686ad){return logger['error'](JSON[_0xd570('0x20')](_0x3686ad));};}function handleResult(_0x58df14){return function(_0x201186){logger[_0xd570('0x8')](_0xd570('0x2a'),JSON[_0xd570('0x20')](_0x201186));if(_0x58df14['MailAccount']&&_0x58df14[_0xd570('0xb')]['Smtp']&&!_[_0xd570('0x2b')](_0x58df14[_0xd570('0xa')])){setTimeout(handleSendEmail(_0x58df14,_0x201186),0x3c*0x3e8);}};}function handleJob(_0x2f206d){return function(){try{if(_[_0xd570('0x2b')](_0x2f206d['subtractNumber'])){return logger[_0xd570('0x8')](_0xd570('0x2c'));}if(_[_0xd570('0x2b')](_0x2f206d[_0xd570('0x12')])){return logger[_0xd570('0x8')](_0xd570('0x2d'));}var _0x2068ad={'startDate':moment()[_0xd570('0x2e')](_0x2f206d[_0xd570('0x2f')],_0x2f206d[_0xd570('0x12')])[_0xd570('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xd570('0xc')](_0xd570('0x30')),'type':_0xd570('0x31'),'output':_0x2f206d[_0xd570('0x32')],'name':_0x2f206d[_0xd570('0xe')]};if(!_[_0xd570('0x2b')](_0x2f206d['DefaultReportId'])){logger['info'](_0xd570('0x33'),_0x2f206d[_0xd570('0x34')]);return analyticDefaultReportController[_0xd570('0x35')]({'id':_0x2f206d['DefaultReportId']},_0x2068ad)[_0xd570('0x26')](handleResult(_0x2f206d))[_0xd570('0x36')](handleError());}if(!_[_0xd570('0x2b')](_0x2f206d[_0xd570('0x37')])){logger['info'](_0xd570('0x38'),_0x2f206d[_0xd570('0x37')]);return analyticCustomReportController[_0xd570('0x35')]({'id':_0x2f206d[_0xd570('0x37')]},_0x2068ad)[_0xd570('0x26')](handleResult(_0x2f206d))[_0xd570('0x36')](handleError());}}catch(_0x4c3580){logger[_0xd570('0x27')](JSON[_0xd570('0x20')](_0x4c3580));}return logger['info']('no\x20report\x20id');};}function getJobs(_0x3a8d09){var _0xdf7ca1={};if(_0x3a8d09){_0xdf7ca1['id']=_0x3a8d09;}return db['Schedule'][_0xd570('0x39')]({'where':_0xdf7ca1,'include':[{'model':db[_0xd570('0xb')],'attributes':['id',_0xd570('0xe'),_0xd570('0xa')],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0xd570('0x3a')],'as':_0xd570('0x3a')}]}]}]})[_0xd570('0x26')](function(_0x240312){var _0x2c64e6=_[_0xd570('0x3b')](manager[_0xd570('0x3c')]);var _0x356ecc=_[_0xd570('0x3d')](_0x240312,function(_0x435994){return _0x435994['id'][_0xd570('0x3e')]();});var _0x179289=_[_0xd570('0x3f')](_0x240312,function(_0x4a86f4){return _0x4a86f4['id'][_0xd570('0x3e')]();});var _0x6c3854=_0x3a8d09?_0x356ecc:_[_0xd570('0x40')](_0x356ecc,_0x2c64e6);var _0x4797c0=_[_0xd570('0x41')](_0x356ecc,_0x2c64e6);var _0x44ccaf=_['difference'](_0x2c64e6,_0x356ecc);var _0x57ea54;var _0x3bc350;for(_0x57ea54=0x0;_0x57ea54<_0x44ccaf[_0xd570('0x42')]&&!_0x3a8d09;_0x57ea54+=0x1){_0x3bc350=_0x44ccaf[_0x57ea54][_0xd570('0x3e')]();if(manager[_0xd570('0x43')](_0x3bc350)){manager[_0xd570('0x44')](_0x3bc350);manager[_0xd570('0x45')](_0x3bc350);logger[_0xd570('0x8')](_0xd570('0x46'),_0x3bc350);}}logger[_0xd570('0x8')](_0xd570('0x47'),JSON['stringify'](_0x6c3854));for(_0x57ea54=0x0;_0x57ea54<_0x6c3854[_0xd570('0x42')];_0x57ea54+=0x1){_0x3bc350=_0x6c3854[_0x57ea54][_0xd570('0x3e')]();logger[_0xd570('0x8')](_0xd570('0x48'),_0x3bc350);if(_0x3a8d09){logger[_0xd570('0x8')](_0xd570('0x49'),_0x3a8d09);logger[_0xd570('0x8')](JSON[_0xd570('0x20')](_0x179289[_0x3bc350]));BPromise['resolve']()['then'](handleJob(_0x179289[_0x3bc350]));logger[_0xd570('0x8')]('run\x20job',_0x179289[_0x3bc350][_0xd570('0xe')],_0x179289[_0x3bc350][_0xd570('0x4a')]);}else if(_0x179289[_0x3bc350][_0xd570('0x4a')]&&_0x179289[_0x3bc350][_0xd570('0x4b')]&&moment()['isBetween'](_0x179289[_0x3bc350][_0xd570('0x4c')],_0x179289[_0x3bc350][_0xd570('0x4d')])){manager['add'](_0x3bc350,_0x179289[_0x3bc350]['cron'],handleJob(_0x179289[_0x3bc350]));manager[_0xd570('0x4e')](_0x3bc350);logger[_0xd570('0x8')](_0xd570('0x4f'),_0x179289[_0x3bc350][_0xd570('0xe')],_0x179289[_0x3bc350][_0xd570('0x4a')]);}else if(manager[_0xd570('0x43')](_0x3bc350)){manager[_0xd570('0x44')](_0x3bc350);manager[_0xd570('0x45')](_0x3bc350);logger[_0xd570('0x8')]('stop\x20cron',_0x179289[_0x3bc350][_0xd570('0xe')],_0x179289[_0x3bc350][_0xd570('0x4a')]);}}for(_0x57ea54=0x0,_0x3bc350;_0x57ea54<_0x4797c0['length']&&!_0x3a8d09;_0x57ea54+=0x1){_0x3bc350=_0x4797c0[_0x57ea54][_0xd570('0x3e')]();if(manager['exists'](_0x3bc350)){if(_0x179289[_0x3bc350][_0xd570('0x4a')]&&_0x179289[_0x3bc350][_0xd570('0x4b')]&&moment()['isBetween'](_0x179289[_0x3bc350][_0xd570('0x4c')],_0x179289[_0x3bc350]['endAt'])){manager[_0xd570('0x50')](_0x3bc350,_0x179289[_0x3bc350][_0xd570('0x4a')],handleJob(_0x179289[_0x3bc350]));logger[_0xd570('0x8')](_0xd570('0x51'),_0x179289[_0x3bc350][_0xd570('0xe')],_0x179289[_0x3bc350][_0xd570('0x4a')]);}else{manager[_0xd570('0x44')](_0x3bc350);manager[_0xd570('0x45')](_0x3bc350);logger['info'](_0xd570('0x52'),_0x179289[_0x3bc350][_0xd570('0xe')],_0x179289[_0x3bc350][_0xd570('0x4a')]);}}}})['catch'](function(_0x4fbbe6){logger[_0xd570('0x27')](JSON[_0xd570('0x20')](_0x4fbbe6));});}exports[_0xd570('0x53')]=function(_0x19e27a){return getJobs(_0x19e27a);};exports[_0xd570('0x4e')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x1600=['runReport','CustomReportId','no\x20report\x20id','Schedule','CloudProvider','keys','jobs','map','keyBy','toString','difference','length','exists','deleteJob','delete\x20cron','my\x20id','resolve','run\x20job','cron','startAt','add','start','stop','stop\x20cron','active','isBetween','endAt','update\x20cron','run','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','email','getSmtpOptions','format','\x22%s\x22\x20<%s>','MailAccount','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','savename','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s'];(function(_0x4df3da,_0x5154e4){var _0x375b11=function(_0x32be02){while(--_0x32be02){_0x4df3da['push'](_0x4df3da['shift']());}};_0x375b11(++_0x5154e4);}(_0x1600,0x16d));var _0x0160=function(_0x5f20ca,_0x3f60a8){_0x5f20ca=_0x5f20ca-0x0;var _0x5a39de=_0x1600[_0x5f20ca];return _0x5a39de;};'use strict';var fs=require('fs');var util=require(_0x0160('0x0'));var path=require(_0x0160('0x1'));var _=require(_0x0160('0x2'));var moment=require(_0x0160('0x3'));var CronJobManager=require(_0x0160('0x4'));var jayson=require(_0x0160('0x5'));var BPromise=require(_0x0160('0x6'));var logger=require(_0x0160('0x7'))(_0x0160('0x8'));var db=require(_0x0160('0x9'))['db'];var analyticCustomReportController=require(_0x0160('0xa'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x0160('0xb')][_0x0160('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x167ac2,_0x339f77){return function(){logger[_0x0160('0xd')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x167ac2[_0x0160('0xe')]);var _0x23ad61=!![];var _0x446b48=_0x167ac2['MailAccount'][_0x0160('0xf')]();var _0x2d9ca4={'account':_0x446b48,'message':{'from':util[_0x0160('0x10')](_0x0160('0x11'),_0x167ac2[_0x0160('0x12')][_0x0160('0x13')],_0x167ac2[_0x0160('0x12')][_0x0160('0xe')]||_0x167ac2['MailAccount'][_0x0160('0x14')][_0x0160('0x15')]),'to':_0x167ac2[_0x0160('0xe')],'cc':_0x167ac2['cc'],'bcc':_0x167ac2[_0x0160('0x16')],'subject':util[_0x0160('0x10')](_0x0160('0x17'),_0x339f77['name'],_0x167ac2[_0x0160('0x18')],_0x167ac2['subtractUnit'])}};var _0x263d0a=path[_0x0160('0x19')](__dirname,_0x0160('0x1a'));var _0x25a409=_0x339f77[_0x0160('0x1b')];var _0x3ca79d=util[_0x0160('0x10')]('%s.%s',path['basename'](_0x339f77[_0x0160('0x1b')],path['extname'](_0x339f77[_0x0160('0x1b')])),'zip');var _0x5e01a5=path['join'](_0x263d0a,_0x25a409);var _0x484b6e=path['join'](_0x263d0a,_0x3ca79d);if(fs[_0x0160('0x1c')](_0x5e01a5)){_0x339f77[_0x0160('0x1d')]=_0x0160('0x1e');_0x2d9ca4[_0x0160('0x1f')][_0x0160('0x20')]=[{'filename':_0x25a409,'path':_0x5e01a5}];_0x2d9ca4[_0x0160('0x1f')][_0x0160('0x21')]=util[_0x0160('0x10')](_0x0160('0x22'),JSON[_0x0160('0x23')](_0x339f77,null,0x2));}else if(fs[_0x0160('0x1c')](_0x484b6e)){_0x339f77['status']=_0x0160('0x1e');_0x2d9ca4[_0x0160('0x1f')]['attachments']=[{'filename':_0x3ca79d,'path':_0x484b6e}];}else{_0x2d9ca4[_0x0160('0x1f')][_0x0160('0x21')]=_0x0160('0x24');if(!_0x167ac2[_0x0160('0x25')]){_0x23ad61=![];logger[_0x0160('0xd')](_0x0160('0x26'));}}if(_0x23ad61){return client[_0x0160('0x27')]('SendMail',_0x2d9ca4)[_0x0160('0x28')](function(_0x3a2a54){if(_0x3a2a54[_0x0160('0x29')]){return logger[_0x0160('0x29')](_0x0160('0x2a'),JSON[_0x0160('0x23')](_0x3a2a54));}return logger[_0x0160('0xd')](_0x0160('0x2b'));})[_0x0160('0x2c')](function(_0x333735){return logger[_0x0160('0x29')]('error\x20mail',JSON[_0x0160('0x23')](_0x333735));});}};}function handleError(){return function(_0x1173de){return logger[_0x0160('0x29')](JSON[_0x0160('0x23')](_0x1173de));};}function handleResult(_0x29be3d){return function(_0x884f14){logger['info'](_0x0160('0x2d'),JSON[_0x0160('0x23')](_0x884f14));if(_0x29be3d[_0x0160('0x12')]&&_0x29be3d['MailAccount'][_0x0160('0x14')]&&!_['isNil'](_0x29be3d[_0x0160('0xe')])){setTimeout(handleSendEmail(_0x29be3d,_0x884f14),0x3c*0x3e8);}};}function handleJob(_0x5ddc84){return function(){try{if(_[_0x0160('0x2e')](_0x5ddc84[_0x0160('0x18')])){return logger['info'](_0x0160('0x2f'));}if(_[_0x0160('0x2e')](_0x5ddc84[_0x0160('0x30')])){return logger[_0x0160('0xd')](_0x0160('0x31'));}var _0x128065={'startDate':moment()[_0x0160('0x32')](_0x5ddc84['subtractNumber'],_0x5ddc84[_0x0160('0x30')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x0160('0x10')](_0x0160('0x33')),'type':'scheduled','output':_0x5ddc84[_0x0160('0x34')],'name':_0x5ddc84['name']};if(!_[_0x0160('0x2e')](_0x5ddc84[_0x0160('0x35')])){logger[_0x0160('0xd')](_0x0160('0x36'),_0x5ddc84[_0x0160('0x35')]);return analyticDefaultReportController[_0x0160('0x37')]({'id':_0x5ddc84[_0x0160('0x35')]},_0x128065)[_0x0160('0x28')](handleResult(_0x5ddc84))[_0x0160('0x2c')](handleError());}if(!_[_0x0160('0x2e')](_0x5ddc84[_0x0160('0x38')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x5ddc84[_0x0160('0x38')]);return analyticCustomReportController['runReport']({'id':_0x5ddc84[_0x0160('0x38')]},_0x128065)[_0x0160('0x28')](handleResult(_0x5ddc84))['catch'](handleError());}}catch(_0x355c50){logger[_0x0160('0x29')](JSON[_0x0160('0x23')](_0x355c50));}return logger[_0x0160('0xd')](_0x0160('0x39'));};}function getJobs(_0x5db6e3){var _0x3dfeb7={};if(_0x5db6e3){_0x3dfeb7['id']=_0x5db6e3;}return db[_0x0160('0x3a')]['findAll']({'where':_0x3dfeb7,'include':[{'model':db[_0x0160('0x12')],'attributes':['id',_0x0160('0x13'),_0x0160('0xe')],'include':[{'model':db['MailServerOut'],'as':_0x0160('0x14'),'include':[{'model':db[_0x0160('0x3b')],'as':_0x0160('0x3b')}]}]}]})[_0x0160('0x28')](function(_0x51c58a){var _0x3359bd=_[_0x0160('0x3c')](manager[_0x0160('0x3d')]);var _0x1753fc=_[_0x0160('0x3e')](_0x51c58a,function(_0x50445){return _0x50445['id']['toString']();});var _0x4325de=_[_0x0160('0x3f')](_0x51c58a,function(_0x2c9ad2){return _0x2c9ad2['id'][_0x0160('0x40')]();});var _0x160385=_0x5db6e3?_0x1753fc:_[_0x0160('0x41')](_0x1753fc,_0x3359bd);var _0xd7c39=_['intersection'](_0x1753fc,_0x3359bd);var _0x10d373=_[_0x0160('0x41')](_0x3359bd,_0x1753fc);var _0x4df0b1;var _0x439595;for(_0x4df0b1=0x0;_0x4df0b1<_0x10d373[_0x0160('0x42')]&&!_0x5db6e3;_0x4df0b1+=0x1){_0x439595=_0x10d373[_0x4df0b1][_0x0160('0x40')]();if(manager[_0x0160('0x43')](_0x439595)){manager['stop'](_0x439595);manager[_0x0160('0x44')](_0x439595);logger['info'](_0x0160('0x45'),_0x439595);}}logger['info']('toRun',JSON[_0x0160('0x23')](_0x160385));for(_0x4df0b1=0x0;_0x4df0b1<_0x160385[_0x0160('0x42')];_0x4df0b1+=0x1){_0x439595=_0x160385[_0x4df0b1][_0x0160('0x40')]();logger[_0x0160('0xd')]('index',_0x439595);if(_0x5db6e3){logger[_0x0160('0xd')](_0x0160('0x46'),_0x5db6e3);logger[_0x0160('0xd')](JSON[_0x0160('0x23')](_0x4325de[_0x439595]));BPromise[_0x0160('0x47')]()[_0x0160('0x28')](handleJob(_0x4325de[_0x439595]));logger[_0x0160('0xd')](_0x0160('0x48'),_0x4325de[_0x439595]['name'],_0x4325de[_0x439595][_0x0160('0x49')]);}else if(_0x4325de[_0x439595][_0x0160('0x49')]&&_0x4325de[_0x439595]['active']&&moment()['isBetween'](_0x4325de[_0x439595][_0x0160('0x4a')],_0x4325de[_0x439595]['endAt'])){manager[_0x0160('0x4b')](_0x439595,_0x4325de[_0x439595][_0x0160('0x49')],handleJob(_0x4325de[_0x439595]));manager[_0x0160('0x4c')](_0x439595);logger[_0x0160('0xd')]('add\x20cron',_0x4325de[_0x439595][_0x0160('0x13')],_0x4325de[_0x439595]['cron']);}else if(manager[_0x0160('0x43')](_0x439595)){manager[_0x0160('0x4d')](_0x439595);manager['deleteJob'](_0x439595);logger[_0x0160('0xd')](_0x0160('0x4e'),_0x4325de[_0x439595]['name'],_0x4325de[_0x439595]['cron']);}}for(_0x4df0b1=0x0,_0x439595;_0x4df0b1<_0xd7c39[_0x0160('0x42')]&&!_0x5db6e3;_0x4df0b1+=0x1){_0x439595=_0xd7c39[_0x4df0b1][_0x0160('0x40')]();if(manager[_0x0160('0x43')](_0x439595)){if(_0x4325de[_0x439595][_0x0160('0x49')]&&_0x4325de[_0x439595][_0x0160('0x4f')]&&moment()[_0x0160('0x50')](_0x4325de[_0x439595]['startAt'],_0x4325de[_0x439595][_0x0160('0x51')])){manager['update'](_0x439595,_0x4325de[_0x439595]['cron'],handleJob(_0x4325de[_0x439595]));logger[_0x0160('0xd')](_0x0160('0x52'),_0x4325de[_0x439595]['name'],_0x4325de[_0x439595]['cron']);}else{manager[_0x0160('0x4d')](_0x439595);manager['deleteJob'](_0x439595);logger[_0x0160('0xd')](_0x0160('0x4e'),_0x4325de[_0x439595][_0x0160('0x13')],_0x4325de[_0x439595]['cron']);}}}})[_0x0160('0x2c')](function(_0x54fa80){logger['error'](JSON[_0x0160('0x23')](_0x54fa80));});}exports[_0x0160('0x53')]=function(_0x146617){return getJobs(_0x146617);};exports[_0x0160('0x4c')]=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 a140b40..1578d5c 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 _0x05e3=['detectSentiment','substring','info','format','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','[RECORDING:%d]\x20Get\x20transcript','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','Transcript\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Negative','COMPLETED','catch','name','error','inspect','VoiceRecording','findAll','IN_PROGRESS','Settings\x20not\x20available','transcribe','transcribeAccountId','push','SequelizeValidationError','start','lodash','aws-sdk','request-promise','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend'];(function(_0x190385,_0x238c8e){var _0x58275c=function(_0x316fd9){while(--_0x316fd9){_0x190385['push'](_0x190385['shift']());}};_0x58275c(++_0x238c8e);}(_0x05e3,0x86));var _0x305e=function(_0x2f5aaa,_0x1aa542){_0x2f5aaa=_0x2f5aaa-0x0;var _0x23b9b6=_0x05e3[_0x2f5aaa];return _0x23b9b6;};var _=require(_0x305e('0x0'));var AWS=require(_0x305e('0x1'));var rp=require(_0x305e('0x2'));var util=require('util');var BPromise=require('bluebird');var db=require(_0x305e('0x3'))['db'];var logger=require(_0x305e('0x4'))('transcribe');function getTranscriptionJob(_0x409b14,_0x112f54,_0x47b973,_0xd743b8){return new Promise(function(_0x404744,_0xfadd27){var _0x143428=new AWS[(_0x305e('0x5'))]({'accessKeyId':_0x112f54,'secretAccessKey':_0x409b14,'region':_0x47b973});_0x143428[_0x305e('0x6')]({'TranscriptionJobName':_0xd743b8},function(_0x86ade0,_0x952a5e){if(_0x86ade0){return _0xfadd27(_0x86ade0);}else{return _0x404744(_0x952a5e);}});});}function sentiment(_0x5e5b91,_0x2fd0bd,_0x4a66fd,_0x2579f6,_0x768a4a){return new Promise(function(_0x557e21,_0x38ead1){var _0x2d92d5=new AWS[(_0x305e('0x7'))]({'accessKeyId':_0x2fd0bd,'secretAccessKey':_0x5e5b91,'region':_0x4a66fd});_0x2d92d5[_0x305e('0x8')]({'Text':_0x2579f6,'LanguageCode':_0x768a4a[_0x305e('0x9')](0x0,0x2)},function(_0x1ae997,_0x67c8f5){if(_0x1ae997){return _0x38ead1(_0x1ae997);}else{return _0x557e21(_0x67c8f5);}});});}function checkTranscribeJob(_0x18f6ca,_0x350b,_0x301068){var _0x3535b9;return new BPromise(function(_0x233bc5,_0x57e8d5){logger[_0x305e('0xa')](util[_0x305e('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x18f6ca['id'],_0x18f6ca[_0x305e('0xc')]));return getTranscriptionJob(_0x301068[_0x305e('0xd')],_0x301068[_0x305e('0xe')],_0x350b[_0x305e('0xf')],_0x18f6ca[_0x305e('0xc')])[_0x305e('0x10')](function(_0x475ef4){logger['info'](util[_0x305e('0xb')](_0x305e('0x11'),_0x18f6ca['id'],_0x18f6ca['transcribeName'],_0x475ef4[_0x305e('0x12')][_0x305e('0x13')]));if(!_0x18f6ca[_0x305e('0x14')]){switch(_0x475ef4[_0x305e('0x12')][_0x305e('0x13')]){case'COMPLETED':var _0x55f0fb={'transcribeStatus':_0x475ef4['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x475ef4['TranscriptionJob']['Transcript']['TranscriptFileUri']};logger[_0x305e('0xa')](util[_0x305e('0xb')](_0x305e('0x15'),_0x18f6ca['id']));return rp({'uri':_0x475ef4[_0x305e('0x12')][_0x305e('0x16')][_0x305e('0x17')],'json':!![]})['then'](function(_0x472d2b){logger['info'](util[_0x305e('0xb')](_0x305e('0x18'),_0x18f6ca['id']));if(_0x472d2b&&_0x472d2b['results']&&_0x472d2b[_0x305e('0x19')][_0x305e('0x1a')]&&_0x472d2b[_0x305e('0x19')][_0x305e('0x1a')][_0x305e('0x1b')]){_0x55f0fb[_0x305e('0x14')]='';for(var _0x30cea3=0x0;_0x30cea3<_0x472d2b[_0x305e('0x19')][_0x305e('0x1a')]['length'];_0x30cea3++){_0x55f0fb['fileText']+=_0x472d2b[_0x305e('0x19')][_0x305e('0x1a')][_0x30cea3][_0x305e('0x1c')]+'';}}return _0x18f6ca[_0x305e('0x1d')](_0x55f0fb);})[_0x305e('0x10')](function(){logger['info'](util['format'](_0x305e('0x1e'),_0x18f6ca['id']));if(!_0x18f6ca[_0x305e('0x1f')]){throw new db[(_0x305e('0x20'))][(_0x305e('0x21'))](_0x305e('0x22'));}if(!_0x350b['sentiment']||!_0x350b['sentimentAccountId']||!_0x350b[_0x305e('0x23')]||!_0x350b[_0x305e('0x24')]||!_0x350b[_0x305e('0x25')]){throw new db[(_0x305e('0x20'))]['ValidationError'](_0x305e('0x26'));}if(!_0x55f0fb[_0x305e('0x14')]){throw new Error('Transcript\x20not\x20available');}if(_0x350b[_0x305e('0x27')]===_0x301068['id']){return _0x301068;}else{return db[_0x305e('0x28')][_0x305e('0x29')]({'where':{'id':_settings[_0x305e('0x27')]}});}})[_0x305e('0x10')](function(_0x517ccb){if(!_0x517ccb){throw new db['Sequelize'][(_0x305e('0x21'))](_0x305e('0x2a'));}if(!_0x517ccb['data1']||!_0x517ccb['data2']){throw new db[(_0x305e('0x20'))][(_0x305e('0x21'))](_0x305e('0x2b'));}_0x3535b9=_0x517ccb;logger['info'](util[_0x305e('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x18f6ca['id']));return sentiment(_0x3535b9[_0x305e('0xd')],_0x3535b9[_0x305e('0xe')],_0x350b[_0x305e('0x23')],_0x55f0fb[_0x305e('0x14')],_0x350b[_0x305e('0x24')]);})[_0x305e('0x10')](function(_0x3c4409){logger['info'](util[_0x305e('0xb')](_0x305e('0x2c'),_0x18f6ca['id']));return _0x18f6ca[_0x305e('0x1d')]({'sentiment':_0x3c4409[_0x305e('0x2d')],'sPositive':_0x3c4409[_0x305e('0x2e')]['Positive'],'sNegative':_0x3c4409[_0x305e('0x2e')]['Negative'],'sMixed':_0x3c4409[_0x305e('0x2e')][_0x305e('0x2f')],'sNeutral':_0x3c4409[_0x305e('0x2e')][_0x305e('0x30')]});})[_0x305e('0x10')](function(){logger[_0x305e('0xa')](util[_0x305e('0xb')](_0x305e('0x1e'),_0x18f6ca['id']));_0x233bc5();});case _0x305e('0x31'):return _0x18f6ca[_0x305e('0x1d')]({'transcribeStatus':_0x305e('0x31'),'failureReason':_0x475ef4['TranscriptionJob'][_0x305e('0x32')]})[_0x305e('0x10')](function(){logger[_0x305e('0xa')](util[_0x305e('0xb')](_0x305e('0x1e'),_0x18f6ca['id']));_0x233bc5();});default:logger[_0x305e('0xa')](util[_0x305e('0xb')](_0x305e('0x33'),_0x18f6ca['id']));break;}}else{return BPromise[_0x305e('0x34')]()[_0x305e('0x10')](function(){if(!_0x18f6ca[_0x305e('0x1f')]){throw new db[(_0x305e('0x20'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x350b[_0x305e('0x35')]||!_0x350b['sentimentAccountId']||!_0x350b[_0x305e('0x23')]||!_0x350b[_0x305e('0x24')]||!_0x350b[_0x305e('0x25')]){throw new db[(_0x305e('0x20'))]['ValidationError'](_0x305e('0x26'));}if(!_0x18f6ca[_0x305e('0x14')]){throw new Error(_0x305e('0x36'));}if(_0x350b[_0x305e('0x27')]===_0x301068['id']){return _0x301068;}else{return db[_0x305e('0x28')]['findOne']({'where':{'id':_settings[_0x305e('0x27')]}});}})[_0x305e('0x10')](function(_0x5eab2e){if(!_0x5eab2e){throw new db['Sequelize'][(_0x305e('0x21'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5eab2e['data1']||!_0x5eab2e[_0x305e('0xe')]){throw new db[(_0x305e('0x20'))]['ValidationError'](_0x305e('0x2b'));}_0x3535b9=_0x5eab2e;logger[_0x305e('0xa')](util[_0x305e('0xb')](_0x305e('0x37'),_0x18f6ca['id']));return sentiment(_0x3535b9[_0x305e('0xd')],_0x3535b9[_0x305e('0xe')],_0x350b[_0x305e('0x23')],_0x18f6ca[_0x305e('0x14')],_0x350b[_0x305e('0x24')]);})[_0x305e('0x10')](function(_0x3d7f14){logger[_0x305e('0xa')](util[_0x305e('0xb')](_0x305e('0x2c'),_0x18f6ca['id']));return _0x18f6ca[_0x305e('0x1d')]({'sentiment':_0x3d7f14['Sentiment'],'sPositive':_0x3d7f14[_0x305e('0x2e')]['Positive'],'sNegative':_0x3d7f14[_0x305e('0x2e')][_0x305e('0x38')],'sMixed':_0x3d7f14[_0x305e('0x2e')][_0x305e('0x2f')],'sNeutral':_0x3d7f14[_0x305e('0x2e')][_0x305e('0x30')],'transcribeStatus':_0x305e('0x39')});})[_0x305e('0x10')](function(){logger[_0x305e('0xa')](util[_0x305e('0xb')](_0x305e('0x1e'),_0x18f6ca['id']));_0x233bc5();});}})[_0x305e('0x3a')](function(_0x37b089){if(_0x37b089){if(!_0x37b089[_0x305e('0x3b')]||_0x37b089[_0x305e('0x3b')]!=='SequelizeValidationError'){logger[_0x305e('0x3c')](util[_0x305e('0xb')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x18f6ca['id']),util[_0x305e('0x3d')](_0x37b089,{'showHidden':![],'depth':null}));}}_0x233bc5();});});}function checkTranscribe(){var _0x102d8e;var _0x2c0c1d;var _0x3abf32;return db[_0x305e('0x3e')][_0x305e('0x3f')]({'where':{'transcribeStatus':_0x305e('0x40')}})[_0x305e('0x10')](function(_0x168bdb){if(!_0x168bdb||!_0x168bdb[_0x305e('0x1b')]){throw new db['Sequelize'][(_0x305e('0x21'))]('No\x20transcribe\x20job\x20to\x20check');}_0x102d8e=_0x168bdb;return db['Setting'][_0x305e('0x29')]({'where':{'id':0x1}});})['then'](function(_0x5e7c80){if(!_0x5e7c80){throw new db['Sequelize']['ValidationError'](_0x305e('0x41'));}_0x2c0c1d=_0x5e7c80;if(!_0x2c0c1d[_0x305e('0x42')]||!_0x2c0c1d[_0x305e('0x43')]||!_0x2c0c1d[_0x305e('0xf')]||!_0x2c0c1d['language']||!_0x2c0c1d[_0x305e('0x25')]){throw new db[(_0x305e('0x20'))][(_0x305e('0x21'))]('Transcribe\x20not\x20configured');}return db[_0x305e('0x28')][_0x305e('0x29')]({'where':{'id':_0x2c0c1d['transcribeAccountId']}});})['then'](function(_0x54e28a){if(!_0x54e28a){throw new db[(_0x305e('0x20'))][(_0x305e('0x21'))](_0x305e('0x2a'));}if(!_0x54e28a['data1']||!_0x54e28a[_0x305e('0xe')]){throw new db[(_0x305e('0x20'))][(_0x305e('0x21'))](_0x305e('0x2b'));}_0x3abf32=_0x54e28a;var _0x39455b=[];_0x102d8e['forEach'](function(_0x377010){_0x39455b[_0x305e('0x44')](checkTranscribeJob(_0x377010,_0x2c0c1d,_0x3abf32));});return BPromise['all'](_0x39455b);})['catch'](function(_0xc4af8a){if(_0xc4af8a){if(!_0xc4af8a[_0x305e('0x3b')]||_0xc4af8a[_0x305e('0x3b')]!==_0x305e('0x45')){logger['error'](util['inspect'](_0xc4af8a,{'showHidden':![],'depth':null}));}}});}exports[_0x305e('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x21f8=['TranscriptFileUri','Transcript','results','transcripts','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','then','Cloud\x20Provider\x20not\x20available','Sequelize','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','CloudProvider','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribeAccountId','bucket','push','all','catch','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED'];(function(_0x5963ad,_0x3d3e77){var _0x452a72=function(_0x1f256e){while(--_0x1f256e){_0x5963ad['push'](_0x5963ad['shift']());}};_0x452a72(++_0x3d3e77);}(_0x21f8,0x71));var _0x821f=function(_0x516927,_0xb4aad0){_0x516927=_0x516927-0x0;var _0x30749b=_0x21f8[_0x516927];return _0x30749b;};var _=require(_0x821f('0x0'));var AWS=require(_0x821f('0x1'));var rp=require(_0x821f('0x2'));var util=require(_0x821f('0x3'));var BPromise=require(_0x821f('0x4'));var db=require(_0x821f('0x5'))['db'];var logger=require(_0x821f('0x6'))('transcribe');function getTranscriptionJob(_0x4d5a2d,_0x5ca60a,_0x9d3273,_0xf5dd93){return new Promise(function(_0x3052d6,_0x2a1421){var _0x3cd13a=new AWS[(_0x821f('0x7'))]({'accessKeyId':_0x5ca60a,'secretAccessKey':_0x4d5a2d,'region':_0x9d3273});_0x3cd13a[_0x821f('0x8')]({'TranscriptionJobName':_0xf5dd93},function(_0xfcb0a,_0x4e260d){if(_0xfcb0a){return _0x2a1421(_0xfcb0a);}else{return _0x3052d6(_0x4e260d);}});});}function sentiment(_0x4dcd67,_0x284c6a,_0x15b547,_0x81e2f4,_0x53ce42){return new Promise(function(_0x387056,_0x44e3f3){var _0x101ae7=new AWS[(_0x821f('0x9'))]({'accessKeyId':_0x284c6a,'secretAccessKey':_0x4dcd67,'region':_0x15b547});_0x101ae7[_0x821f('0xa')]({'Text':_0x81e2f4,'LanguageCode':_0x53ce42[_0x821f('0xb')](0x0,0x2)},function(_0x6bea4c,_0xec9f7e){if(_0x6bea4c){return _0x44e3f3(_0x6bea4c);}else{return _0x387056(_0xec9f7e);}});});}function checkTranscribeJob(_0x3eedc4,_0x2aeb4e,_0x4ba2e2){var _0x4f9752;return new BPromise(function(_0x22e1d5,_0x225854){logger[_0x821f('0xc')](util[_0x821f('0xd')](_0x821f('0xe'),_0x3eedc4['id'],_0x3eedc4[_0x821f('0xf')]));return getTranscriptionJob(_0x4ba2e2[_0x821f('0x10')],_0x4ba2e2[_0x821f('0x11')],_0x2aeb4e[_0x821f('0x12')],_0x3eedc4[_0x821f('0xf')])['then'](function(_0x3419ab){logger['info'](util[_0x821f('0xd')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x3eedc4['id'],_0x3eedc4[_0x821f('0xf')],_0x3419ab[_0x821f('0x13')][_0x821f('0x14')]));if(!_0x3eedc4[_0x821f('0x15')]){switch(_0x3419ab['TranscriptionJob'][_0x821f('0x14')]){case _0x821f('0x16'):var _0x499483={'transcribeStatus':_0x3419ab[_0x821f('0x13')]['TranscriptionJobStatus'],'fileUri':_0x3419ab[_0x821f('0x13')]['Transcript'][_0x821f('0x17')]};logger[_0x821f('0xc')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x3eedc4['id']));return rp({'uri':_0x3419ab[_0x821f('0x13')][_0x821f('0x18')][_0x821f('0x17')],'json':!![]})['then'](function(_0x3092d8){logger[_0x821f('0xc')](util[_0x821f('0xd')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x3eedc4['id']));if(_0x3092d8&&_0x3092d8[_0x821f('0x19')]&&_0x3092d8[_0x821f('0x19')]['transcripts']&&_0x3092d8['results']['transcripts']['length']){_0x499483[_0x821f('0x15')]='';for(var _0x4af347=0x0;_0x4af347<_0x3092d8['results'][_0x821f('0x1a')]['length'];_0x4af347++){_0x499483['fileText']+=_0x3092d8[_0x821f('0x19')][_0x821f('0x1a')][_0x4af347][_0x821f('0x1b')]+'';}}return _0x3eedc4[_0x821f('0x1c')](_0x499483);})['then'](function(){logger[_0x821f('0xc')](util[_0x821f('0xd')](_0x821f('0x1d'),_0x3eedc4['id']));if(!_0x3eedc4[_0x821f('0x1e')]){throw new db['Sequelize'][(_0x821f('0x1f'))](_0x821f('0x20'));}if(!_0x2aeb4e[_0x821f('0x21')]||!_0x2aeb4e[_0x821f('0x22')]||!_0x2aeb4e['sentimentRegion']||!_0x2aeb4e[_0x821f('0x23')]||!_0x2aeb4e['bucket']){throw new db['Sequelize'][(_0x821f('0x1f'))](_0x821f('0x24'));}if(!_0x499483[_0x821f('0x15')]){throw new Error(_0x821f('0x25'));}if(_0x2aeb4e[_0x821f('0x22')]===_0x4ba2e2['id']){return _0x4ba2e2;}else{return db['CloudProvider'][_0x821f('0x26')]({'where':{'id':_settings[_0x821f('0x22')]}});}})[_0x821f('0x27')](function(_0x12a47a){if(!_0x12a47a){throw new db['Sequelize'][(_0x821f('0x1f'))](_0x821f('0x28'));}if(!_0x12a47a[_0x821f('0x10')]||!_0x12a47a[_0x821f('0x11')]){throw new db[(_0x821f('0x29'))][(_0x821f('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x4f9752=_0x12a47a;logger[_0x821f('0xc')](util['format'](_0x821f('0x2a'),_0x3eedc4['id']));return sentiment(_0x4f9752[_0x821f('0x10')],_0x4f9752['data2'],_0x2aeb4e['sentimentRegion'],_0x499483[_0x821f('0x15')],_0x2aeb4e[_0x821f('0x23')]);})[_0x821f('0x27')](function(_0x302611){logger[_0x821f('0xc')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x3eedc4['id']));return _0x3eedc4[_0x821f('0x1c')]({'sentiment':_0x302611[_0x821f('0x2b')],'sPositive':_0x302611[_0x821f('0x2c')]['Positive'],'sNegative':_0x302611[_0x821f('0x2c')][_0x821f('0x2d')],'sMixed':_0x302611[_0x821f('0x2c')][_0x821f('0x2e')],'sNeutral':_0x302611[_0x821f('0x2c')][_0x821f('0x2f')]});})[_0x821f('0x27')](function(){logger['info'](util['format'](_0x821f('0x1d'),_0x3eedc4['id']));_0x22e1d5();});case _0x821f('0x30'):return _0x3eedc4[_0x821f('0x1c')]({'transcribeStatus':_0x821f('0x30'),'failureReason':_0x3419ab[_0x821f('0x13')]['FailureReason']})['then'](function(){logger[_0x821f('0xc')](util[_0x821f('0xd')](_0x821f('0x1d'),_0x3eedc4['id']));_0x22e1d5();});default:logger['info'](util[_0x821f('0xd')](_0x821f('0x31'),_0x3eedc4['id']));break;}}else{return BPromise[_0x821f('0x32')]()['then'](function(){if(!_0x3eedc4[_0x821f('0x1e')]){throw new db[(_0x821f('0x29'))][(_0x821f('0x1f'))](_0x821f('0x20'));}if(!_0x2aeb4e[_0x821f('0x21')]||!_0x2aeb4e[_0x821f('0x22')]||!_0x2aeb4e['sentimentRegion']||!_0x2aeb4e[_0x821f('0x23')]||!_0x2aeb4e['bucket']){throw new db[(_0x821f('0x29'))][(_0x821f('0x1f'))](_0x821f('0x24'));}if(!_0x3eedc4[_0x821f('0x15')]){throw new Error(_0x821f('0x25'));}if(_0x2aeb4e[_0x821f('0x22')]===_0x4ba2e2['id']){return _0x4ba2e2;}else{return db[_0x821f('0x33')][_0x821f('0x26')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x821f('0x27')](function(_0x603245){if(!_0x603245){throw new db[(_0x821f('0x29'))][(_0x821f('0x1f'))](_0x821f('0x28'));}if(!_0x603245['data1']||!_0x603245[_0x821f('0x11')]){throw new db[(_0x821f('0x29'))][(_0x821f('0x1f'))](_0x821f('0x34'));}_0x4f9752=_0x603245;logger[_0x821f('0xc')](util[_0x821f('0xd')](_0x821f('0x2a'),_0x3eedc4['id']));return sentiment(_0x4f9752[_0x821f('0x10')],_0x4f9752[_0x821f('0x11')],_0x2aeb4e['sentimentRegion'],_0x3eedc4[_0x821f('0x15')],_0x2aeb4e['language']);})[_0x821f('0x27')](function(_0x495fe6){logger[_0x821f('0xc')](util['format'](_0x821f('0x35'),_0x3eedc4['id']));return _0x3eedc4[_0x821f('0x1c')]({'sentiment':_0x495fe6['Sentiment'],'sPositive':_0x495fe6[_0x821f('0x2c')]['Positive'],'sNegative':_0x495fe6[_0x821f('0x2c')][_0x821f('0x2d')],'sMixed':_0x495fe6['SentimentScore'][_0x821f('0x2e')],'sNeutral':_0x495fe6[_0x821f('0x2c')]['Neutral'],'transcribeStatus':_0x821f('0x16')});})['then'](function(){logger[_0x821f('0xc')](util[_0x821f('0xd')](_0x821f('0x1d'),_0x3eedc4['id']));_0x22e1d5();});}})['catch'](function(_0x21f55c){if(_0x21f55c){if(!_0x21f55c[_0x821f('0x36')]||_0x21f55c['name']!==_0x821f('0x37')){logger['error'](util[_0x821f('0xd')](_0x821f('0x38'),_0x3eedc4['id']),util[_0x821f('0x39')](_0x21f55c,{'showHidden':![],'depth':null}));}}_0x22e1d5();});});}function checkTranscribe(){var _0x1fbec4;var _0x1b7eaf;var _0x541a2e;return db[_0x821f('0x3a')][_0x821f('0x3b')]({'where':{'transcribeStatus':_0x821f('0x3c')}})[_0x821f('0x27')](function(_0x58cb21){if(!_0x58cb21||!_0x58cb21['length']){throw new db[(_0x821f('0x29'))]['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0x1fbec4=_0x58cb21;return db[_0x821f('0x3d')][_0x821f('0x26')]({'where':{'id':0x1}});})[_0x821f('0x27')](function(_0x37715d){if(!_0x37715d){throw new db[(_0x821f('0x29'))]['ValidationError'](_0x821f('0x3e'));}_0x1b7eaf=_0x37715d;if(!_0x1b7eaf['transcribe']||!_0x1b7eaf[_0x821f('0x3f')]||!_0x1b7eaf['transcribeRegion']||!_0x1b7eaf[_0x821f('0x23')]||!_0x1b7eaf[_0x821f('0x40')]){throw new db[(_0x821f('0x29'))]['ValidationError']('Transcribe\x20not\x20configured');}return db[_0x821f('0x33')][_0x821f('0x26')]({'where':{'id':_0x1b7eaf[_0x821f('0x3f')]}});})['then'](function(_0x386093){if(!_0x386093){throw new db[(_0x821f('0x29'))][(_0x821f('0x1f'))](_0x821f('0x28'));}if(!_0x386093[_0x821f('0x10')]||!_0x386093['data2']){throw new db[(_0x821f('0x29'))][(_0x821f('0x1f'))](_0x821f('0x34'));}_0x541a2e=_0x386093;var _0x35dbb5=[];_0x1fbec4['forEach'](function(_0x149919){_0x35dbb5[_0x821f('0x41')](checkTranscribeJob(_0x149919,_0x1b7eaf,_0x541a2e));});return BPromise[_0x821f('0x42')](_0x35dbb5);})[_0x821f('0x43')](function(_0x10e9ef){if(_0x10e9ef){if(!_0x10e9ef['name']||_0x10e9ef[_0x821f('0x36')]!=='SequelizeValidationError'){logger['error'](util['inspect'](_0x10e9ef,{'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 0e56f0b..e1ad871 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 _0x6eb2=['findAll','subtract','then','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','update','system','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','catch','error','inspect','start','lodash','ioredis','../../mysqldb','../logger','schedule','redis','defaults','localhost','WhatsappInteraction'];(function(_0x4bfcbe,_0x4630f5){var _0x5b65e6=function(_0x5dcfc8){while(--_0x5dcfc8){_0x4bfcbe['push'](_0x4bfcbe['shift']());}};_0x5b65e6(++_0x4630f5);}(_0x6eb2,0x10a));var _0x26eb=function(_0x5d3f51,_0x3025b6){_0x5d3f51=_0x5d3f51-0x0;var _0x24bcdb=_0x6eb2[_0x5d3f51];return _0x24bcdb;};'use strict';var _=require(_0x26eb('0x0'));var moment=require('moment');var Redis=require(_0x26eb('0x1'));var util=require('util');var config=require('../../config/environment');var db=require(_0x26eb('0x2'))['db'];var logger=require(_0x26eb('0x3'))(_0x26eb('0x4'));config[_0x26eb('0x5')]=_[_0x26eb('0x6')](config[_0x26eb('0x5')],{'host':_0x26eb('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x26eb('0x5')]));function closeInteractions(){var _0x352ab5=[];return db[_0x26eb('0x8')][_0x26eb('0x9')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x26eb('0xa')](0x18,'hours')}}})[_0x26eb('0xb')](function(_0x2e7c53){if(_0x2e7c53&&_0x2e7c53['length']){_0x352ab5=_[_0x26eb('0xc')](_0x2e7c53||[],'id');logger[_0x26eb('0xd')](_0x26eb('0xe'),_0x352ab5['join']());return db[_0x26eb('0x8')][_0x26eb('0xf')]({'closeReason':_0x26eb('0x10'),'disposition':'timeout','closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x352ab5}});}})[_0x26eb('0xb')](function(){if(_0x352ab5&&_0x352ab5[_0x26eb('0x11')]){logger[_0x26eb('0xd')](_0x26eb('0x12'),_0x352ab5[_0x26eb('0x13')]());for(var _0x427897=0x0;_0x427897<_0x352ab5[_0x26eb('0x11')];_0x427897++){io[_0x26eb('0x14')]('whatsappInteraction:update',{'id':_0x352ab5[_0x427897],'closed':!![]});}}})[_0x26eb('0x15')](function(_0x2047fe){logger[_0x26eb('0x16')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x2047fe?util[_0x26eb('0x17')](_0x2047fe,{'showHidden':![],'depth':null}):'');});}exports[_0x26eb('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x1af9=['moment','ioredis','util','../logger','schedule','redis','defaults','localhost','lastMsgAt','subtract','hours','then','info','WhatsappInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','whatsappInteraction:update','catch','error','inspect','start','lodash'];(function(_0x6bf16d,_0x7c0cd1){var _0x32a608=function(_0x2222da){while(--_0x2222da){_0x6bf16d['push'](_0x6bf16d['shift']());}};_0x32a608(++_0x7c0cd1);}(_0x1af9,0x15b));var _0x91af=function(_0x1f5baa,_0x27a70b){_0x1f5baa=_0x1f5baa-0x0;var _0x6cc174=_0x1af9[_0x1f5baa];return _0x6cc174;};'use strict';var _=require(_0x91af('0x0'));var moment=require(_0x91af('0x1'));var Redis=require(_0x91af('0x2'));var util=require(_0x91af('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0x91af('0x4'))(_0x91af('0x5'));config[_0x91af('0x6')]=_[_0x91af('0x7')](config[_0x91af('0x6')],{'host':_0x91af('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x91af('0x6')]));function closeInteractions(){var _0x4710ff=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id',_0x91af('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x91af('0xa')](0x18,_0x91af('0xb'))}}})[_0x91af('0xc')](function(_0x37ad49){if(_0x37ad49&&_0x37ad49['length']){_0x4710ff=_['map'](_0x37ad49||[],'id');logger[_0x91af('0xd')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x4710ff['join']());return db[_0x91af('0xe')][_0x91af('0xf')]({'closeReason':_0x91af('0x10'),'disposition':_0x91af('0x11'),'closed':!![],'closedAt':moment()[_0x91af('0x12')](_0x91af('0x13'))},{'where':{'id':_0x4710ff}});}})[_0x91af('0xc')](function(){if(_0x4710ff&&_0x4710ff[_0x91af('0x14')]){logger[_0x91af('0xd')](_0x91af('0x15'),_0x4710ff[_0x91af('0x16')]());for(var _0x1050ca=0x0;_0x1050ca<_0x4710ff['length'];_0x1050ca++){io[_0x91af('0x17')](_0x91af('0x18'),{'id':_0x4710ff[_0x1050ca],'closed':!![]});}}})[_0x91af('0x19')](function(_0x25e2ac){logger[_0x91af('0x1a')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x25e2ac?util[_0x91af('0x1b')](_0x25e2ac,{'showHidden':![],'depth':null}):'');});}exports[_0x91af('0x1c')]=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 36f4277..fb8616b 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70fb=['log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','catch','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate'];(function(_0x7017e7,_0x243d54){var _0x12331a=function(_0x466138){while(--_0x466138){_0x7017e7['push'](_0x7017e7['shift']());}};_0x12331a(++_0x243d54);}(_0x70fb,0x138));var _0xb70f=function(_0x28ac84,_0x2a75fa){_0x28ac84=_0x28ac84-0x0;var _0x10c42a=_0x70fb[_0x28ac84];return _0x10c42a;};'use strict';var util=require('util');var db=require(_0xb70f('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xb70f('0x1')]({'id':i,'firstName':_0xb70f('0x2')+i,'lastName':_0xb70f('0x3')+i,'phone':0xf879fb460+i,'email':_0xb70f('0x4')+i+_0xb70f('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xb70f('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xb70f('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xb70f('0x6')](),'updatedAt':Date[_0xb70f('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xb70f('0x2')+i,'lastName':_0xb70f('0x3')+i,'phone':0xf879fb460+i,'email':_0xb70f('0x4')+i+_0xb70f('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xb70f('0x1')]({'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[_0xb70f('0x6')]()});}db[_0xb70f('0x7')][_0xb70f('0x8')]({'where':{}})[_0xb70f('0x9')](function(){return db['CmContact'][_0xb70f('0xa')](contacts);})[_0xb70f('0x9')](function(){console[_0xb70f('0xb')](_0xb70f('0xc'),_0xb70f('0xd'));return db[_0xb70f('0xe')]['destroy']({'where':{}});})[_0xb70f('0x9')](function(){return db['CmHopper']['bulkCreate'](hopper);})[_0xb70f('0x9')](function(){console[_0xb70f('0xb')](_0xb70f('0xc'),_0xb70f('0xf'));return db['CmContact'][_0xb70f('0xa')](contacts2);})[_0xb70f('0x9')](function(){console[_0xb70f('0xb')](_0xb70f('0xc'),_0xb70f('0x10'));return db['CmHopper'][_0xb70f('0xa')](hopper2);})[_0xb70f('0x9')](function(){console['log'](_0xb70f('0xc'),_0xb70f('0x11'));})[_0xb70f('0x12')](function(_0xec9a64){console[_0xb70f('0xb')](_0xec9a64);}); \ No newline at end of file +var _0x63a1=['catch','util','../mysqldb','push','Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','CmContact','destroy','bulkCreate','then','log','finished\x20populating','contacts1','CmHopper','hopper1'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x63a1,0x169));var _0x163a=function(_0x17dffc,_0x5e8ee1){_0x17dffc=_0x17dffc-0x0;var _0x4612b6=_0x63a1[_0x17dffc];return _0x4612b6;};'use strict';var util=require(_0x163a('0x0'));var db=require(_0x163a('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x163a('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x163a('0x3')+i,'phone':0xf879fb460+i,'email':_0x163a('0x4')+i+_0x163a('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x163a('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x163a('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x163a('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x163a('0x2')]({'id':i,'firstName':_0x163a('0x7')+i,'lastName':_0x163a('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x163a('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x163a('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x163a('0x6')](),'updatedAt':Date[_0x163a('0x6')]()});}db[_0x163a('0x8')][_0x163a('0x9')]({'where':{}})['then'](function(){return db['CmContact'][_0x163a('0xa')](contacts);})[_0x163a('0xb')](function(){console[_0x163a('0xc')](_0x163a('0xd'),_0x163a('0xe'));return db[_0x163a('0xf')]['destroy']({'where':{}});})[_0x163a('0xb')](function(){return db[_0x163a('0xf')][_0x163a('0xa')](hopper);})['then'](function(){console['log'](_0x163a('0xd'),_0x163a('0x10'));return db[_0x163a('0x8')][_0x163a('0xa')](contacts2);})[_0x163a('0xb')](function(){console[_0x163a('0xc')](_0x163a('0xd'),'contacts2');return db['CmHopper'][_0x163a('0xa')](hopper2);})[_0x163a('0xb')](function(){console['log'](_0x163a('0xd'),'hopper2');})[_0x163a('0x11')](function(_0x4f3a25){console['log'](_0x4f3a25);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 6ba240a..5334b28 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4e9e=['yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','format','%s%s','agent','%s%s@xcally.com','password','friend','all'];(function(_0x21ef6a,_0x3a6814){var _0x22beb2=function(_0x4d2ccc){while(--_0x4d2ccc){_0x21ef6a['push'](_0x21ef6a['shift']());}};_0x22beb2(++_0x3a6814);}(_0x4e9e,0xf3));var _0xe4e9=function(_0x18d38c,_0xc5c2d3){_0x18d38c=_0x18d38c-0x0;var _0x474ba7=_0x4e9e[_0x18d38c];return _0x474ba7;};'use strict';var util=require(_0xe4e9('0x0'));var db=require(_0xe4e9('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xe4e9('0x2')](_0xe4e9('0x3'),_0xe4e9('0x4'),i),'fullname':util[_0xe4e9('0x2')]('%s%s','agent',i),'email':util[_0xe4e9('0x2')](_0xe4e9('0x5'),'agent',i),'role':_0xe4e9('0x4'),'password':_0xe4e9('0x6'),'internal':0xfa0+i,'type':_0xe4e9('0x7'),'transport':['udp','ws','wss'],'disallow':[_0xe4e9('0x8')],'allow':['ulaw'],'defaultuser':util[_0xe4e9('0x2')]('%s%s','agent',i),'encryption':_0xe4e9('0x9'),'avpf':_0xe4e9('0x9'),'force_avp':_0xe4e9('0x9'),'icesupport':_0xe4e9('0x9'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xe4e9('0xa'),'dtlssetup':_0xe4e9('0xb'),'callerid':util['format'](_0xe4e9('0xc'),util[_0xe4e9('0x2')](_0xe4e9('0x3'),_0xe4e9('0x4'),i),0xfa0+i)});}db['User'][_0xe4e9('0xd')](users)[_0xe4e9('0xe')](function(){console[_0xe4e9('0xf')](_0xe4e9('0x10'));})[_0xe4e9('0x11')](function(_0x114b81){console['log'](_0x114b81);}); \ No newline at end of file +var _0xac18=['bulkCreate','log','catch','util','../mysqldb','format','%s%s','agent','password','friend','udp','wss','all','yes','/etc/pki/tls/certs/motion.crt','User'];(function(_0x5a7513,_0xa2742f){var _0x41af54=function(_0x447ee0){while(--_0x447ee0){_0x5a7513['push'](_0x5a7513['shift']());}};_0x41af54(++_0xa2742f);}(_0xac18,0x173));var _0x8ac1=function(_0x19951d,_0x3a542c){_0x19951d=_0x19951d-0x0;var _0x1843ce=_0xac18[_0x19951d];return _0x1843ce;};'use strict';var util=require(_0x8ac1('0x0'));var db=require(_0x8ac1('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x8ac1('0x2')](_0x8ac1('0x3'),_0x8ac1('0x4'),i),'fullname':util[_0x8ac1('0x2')](_0x8ac1('0x3'),_0x8ac1('0x4'),i),'email':util[_0x8ac1('0x2')]('%s%s@xcally.com',_0x8ac1('0x4'),i),'role':_0x8ac1('0x4'),'password':_0x8ac1('0x5'),'internal':0xfa0+i,'type':_0x8ac1('0x6'),'transport':[_0x8ac1('0x7'),'ws',_0x8ac1('0x8')],'disallow':[_0x8ac1('0x9')],'allow':['ulaw'],'defaultuser':util[_0x8ac1('0x2')]('%s%s',_0x8ac1('0x4'),i),'encryption':_0x8ac1('0xa'),'avpf':_0x8ac1('0xa'),'force_avp':_0x8ac1('0xa'),'icesupport':'yes','dtlsenable':_0x8ac1('0xa'),'dtlsverify':'no','dtlscertfile':_0x8ac1('0xb'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0x8ac1('0x2')]('\x22%s\x22\x20<%s>',util[_0x8ac1('0x2')](_0x8ac1('0x3'),'agent',i),0xfa0+i)});}db[_0x8ac1('0xc')][_0x8ac1('0xd')](users)['then'](function(){console[_0x8ac1('0xe')]('add\x20user');})[_0x8ac1('0xf')](function(_0x1e71e1){console['log'](_0x1e71e1);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index cecdd1c..18e7fbf 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6455=['ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','user','userProfileId','SmsQueues','OpenchannelQueues','WhatsappQueue','Campaign','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getWhatsappQueues','all','length','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','default','connection','setMaxListeners','request','remoteAddress','remotePort','SocketIO\x20','address','disconnect','CONNECTED','lodash','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','resourceId','map','where','type','ivr','format','query','find','ChatInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','voice:inbound','voice:outbound','hasOwnProperty','include','push'];(function(_0x1bd277,_0x193668){var _0x54f6fa=function(_0x1f221f){while(--_0x1f221f){_0x1bd277['push'](_0x1bd277['shift']());}};_0x54f6fa(++_0x193668);}(_0x6455,0x97));var _0x5645=function(_0xfa6a33,_0x51977a){_0xfa6a33=_0xfa6a33-0x0;var _0x56a231=_0x6455[_0xfa6a33];return _0x56a231;};'use strict';var _=require(_0x5645('0x0'));var util=require('util');var BPromise=require(_0x5645('0x1'));var db=require(_0x5645('0x2'))['db'];var config=require(_0x5645('0x3'));var queryQueues={'attributes':['id',_0x5645('0x4')],'include':[{'as':_0x5645('0x5'),'model':db[_0x5645('0x6')],'attributes':['id','name',_0x5645('0x7')],'raw':!![],'where':{'role':_0x5645('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x5645('0x4')],'where':{'role':_0x5645('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x5645('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x5645('0x4')],'where':{'role':_0x5645('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x5645('0x4'),'type'],'where':{'type':'ivr'}};function getAssociatedResources(_0x20efde,_0x37c03a,_0x38c07a){return db[_0x5645('0xa')][_0x5645('0xb')]({'where':{'name':_0x20efde,'userProfileId':_0x37c03a},'raw':!![]})[_0x5645('0xc')](function(_0x587c61){if(_0x587c61){if(_0x587c61[_0x5645('0xd')]){switch(_0x20efde){case _0x5645('0xe'):case _0x5645('0xf'):case _0x5645('0x10'):case'SmsQueues':case _0x5645('0x11'):case'OpenchannelQueues':case _0x5645('0x12'):return db[_0x38c07a][_0x5645('0x13')](queryQueues);case _0x5645('0x14'):return db[_0x38c07a][_0x5645('0x13')](queryTelephones);case _0x5645('0x15'):return db[_0x38c07a][_0x5645('0x13')](queryTrunks);case _0x5645('0x16'):return db[_0x38c07a][_0x5645('0x13')](queryCampaigns);}}else{return db['UserProfileResource'][_0x5645('0x13')]({'attributes':[_0x5645('0x17')],'where':{'sectionId':_0x587c61['id']},'raw':!![]})[_0x5645('0xc')](function(_0x4cbd46){if(_0x4cbd46){var _0x4b3be6={'where':{'id':_[_0x5645('0x18')](_0x4cbd46,_0x5645('0x17'))},'raw':!![]};switch(_0x38c07a){case'User':_0x4b3be6[_0x5645('0x19')][_0x5645('0x7')]=_0x5645('0x9');break;case'Campaign':_0x4b3be6[_0x5645('0x19')][_0x5645('0x1a')]=_0x5645('0x1b');break;}return db[_0x38c07a][_0x5645('0x13')](_0x4b3be6);}else{return[];}});}}else{return[];}})['then'](function(_0x1853a7){return _0x1853a7;});}function joinOrLeaveQueues(_0x52ac46,_0x557ad2,_0x7c39d7,_0x1e2cba){_0x52ac46[_0x557ad2](util[_0x5645('0x1c')]('%s:queue:%s',_0x7c39d7,_0x1e2cba[_0x5645('0x4')]));if(_0x1e2cba['Agents']){for(var _0x2b8cc8=0x0;_0x2b8cc8<_0x1e2cba['Agents']['length'];_0x2b8cc8+=0x1){_0x52ac46[_0x557ad2](util[_0x5645('0x1c')]('user:%s',_0x1e2cba[_0x5645('0x5')][_0x2b8cc8][_0x5645('0x4')]));}}}function joinOrLeave(_0x502c2e,_0x18680f,_0x116bfc){var _0xe83ed7;if(_0x502c2e['handshake'][_0x5645('0x1d')]['id']){db[_0x5645('0x6')][_0x5645('0x1e')]({'attributes':['id',_0x5645('0x4'),'role','userProfileId'],'where':{'id':_0x502c2e['handshake']['query']['id']},'include':[{'model':db[_0x5645('0x1f')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x5645('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0x5645('0x21')],'as':_0x5645('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x5645('0x23')],'as':_0x5645('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x5645('0x25')],'as':_0x5645('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x5645('0x27')],'as':_0x5645('0x28'),'attributes':['id'],'raw':!![]}]})[_0x5645('0xc')](function(_0x1c0aa2){if(_0x1c0aa2){_0xe83ed7=_0x1c0aa2;_0x502c2e[_0x18680f](util[_0x5645('0x1c')](_0x5645('0x29'),_0x1c0aa2[_0x5645('0x4')]));var _0x52ba45=[];switch(_0x1c0aa2[_0x5645('0x7')]){case'admin':_0x502c2e[_0x18680f](_0x5645('0x2a'));_0x502c2e[_0x18680f](_0x5645('0x2b'));if(queryQueues[_0x5645('0x2c')](_0x5645('0x2d'))){delete queryQueues[_0x5645('0x2d')];}_0x52ba45[_0x5645('0x2e')](db['VoiceQueue']['findAll'](queryQueues));_0x52ba45[_0x5645('0x2e')](db[_0x5645('0x2f')][_0x5645('0x13')](queryQueues));_0x52ba45[_0x5645('0x2e')](db[_0x5645('0x30')][_0x5645('0x13')](queryQueues));_0x52ba45[_0x5645('0x2e')](db[_0x5645('0x31')][_0x5645('0x13')](queryQueues));_0x52ba45[_0x5645('0x2e')](db[_0x5645('0x32')]['findAll'](queryQueues));_0x52ba45['push'](db[_0x5645('0x33')]['findAll'](queryQueues));_0x52ba45[_0x5645('0x2e')](db['WhatsappQueue'][_0x5645('0x13')](queryQueues));_0x52ba45['push'](db[_0x5645('0x6')][_0x5645('0x13')](queryTelephones));_0x52ba45[_0x5645('0x2e')](db[_0x5645('0x34')][_0x5645('0x13')](queryTrunks));_0x52ba45[_0x5645('0x2e')](db['Campaign'][_0x5645('0x13')](queryCampaigns));_0x52ba45[_0x5645('0x2e')](db[_0x5645('0x6')][_0x5645('0x13')](queryAgents));break;case _0x5645('0x35'):_0x502c2e[_0x18680f](_0x5645('0x2a'));_0x502c2e[_0x18680f](_0x5645('0x2b'));_0x52ba45[_0x5645('0x2e')](getAssociatedResources('VoiceQueues',_0x1c0aa2[_0x5645('0x36')],'VoiceQueue'));_0x52ba45[_0x5645('0x2e')](getAssociatedResources(_0x5645('0xf'),_0x1c0aa2[_0x5645('0x36')],_0x5645('0x2f')));_0x52ba45[_0x5645('0x2e')](getAssociatedResources('FaxQueues',_0x1c0aa2[_0x5645('0x36')],_0x5645('0x30')));_0x52ba45[_0x5645('0x2e')](getAssociatedResources(_0x5645('0x37'),_0x1c0aa2[_0x5645('0x36')],_0x5645('0x31')));_0x52ba45[_0x5645('0x2e')](getAssociatedResources(_0x5645('0x11'),_0x1c0aa2[_0x5645('0x36')],_0x5645('0x32')));_0x52ba45[_0x5645('0x2e')](getAssociatedResources(_0x5645('0x38'),_0x1c0aa2[_0x5645('0x36')],_0x5645('0x33')));_0x52ba45[_0x5645('0x2e')](getAssociatedResources(_0x5645('0x12'),_0x1c0aa2['userProfileId'],_0x5645('0x39')));_0x52ba45[_0x5645('0x2e')](getAssociatedResources('Telephones',_0x1c0aa2[_0x5645('0x36')],_0x5645('0x6')));_0x52ba45['push'](getAssociatedResources(_0x5645('0x15'),_0x1c0aa2[_0x5645('0x36')],_0x5645('0x34')));_0x52ba45[_0x5645('0x2e')](getAssociatedResources(_0x5645('0x16'),_0x1c0aa2[_0x5645('0x36')],_0x5645('0x3a')));_0x52ba45['push'](db['User'][_0x5645('0x13')](queryAgents));break;case _0x5645('0x8'):_0x502c2e[_0x18680f](_0x5645('0x2a'));_0x502c2e[_0x18680f](_0x5645('0x2b'));_0x52ba45[_0x5645('0x2e')](_0x1c0aa2[_0x5645('0x3b')]({'attributes':['id',_0x5645('0x4')]}));_0x52ba45[_0x5645('0x2e')](_0x1c0aa2[_0x5645('0x3c')]({'attributes':['id',_0x5645('0x4')]}));_0x52ba45[_0x5645('0x2e')](_0x1c0aa2[_0x5645('0x3d')]({'attributes':['id',_0x5645('0x4')]}));_0x52ba45[_0x5645('0x2e')](_0x1c0aa2[_0x5645('0x3e')]({'attributes':['id',_0x5645('0x4')]}));_0x52ba45[_0x5645('0x2e')](_0x1c0aa2['getMailQueues']({'attributes':['id','name']}));_0x52ba45['push'](_0x1c0aa2['getOpenchannelQueues']({'attributes':['id',_0x5645('0x4')]}));_0x52ba45[_0x5645('0x2e')](_0x1c0aa2[_0x5645('0x3f')]({'attributes':['id',_0x5645('0x4')]}));break;}return BPromise[_0x5645('0x40')](_0x52ba45);}})['then'](function(_0x43eaa9){if(_0x43eaa9&&_0x43eaa9[_0x5645('0x41')]){for(var _0x41b607=0x0;_0x41b607<_0x43eaa9[_0x5645('0x41')];_0x41b607+=0x1){for(var _0x30a685=0x0;_0x30a685<_0x43eaa9[_0x41b607]['length'];_0x30a685+=0x1){switch(_0x41b607){case 0x0:joinOrLeaveQueues(_0x502c2e,_0x18680f,_0x5645('0x42'),_0x43eaa9[_0x41b607][_0x30a685]);break;case 0x1:joinOrLeaveQueues(_0x502c2e,_0x18680f,_0x5645('0x43'),_0x43eaa9[_0x41b607][_0x30a685]);break;case 0x2:joinOrLeaveQueues(_0x502c2e,_0x18680f,_0x5645('0x44'),_0x43eaa9[_0x41b607][_0x30a685]);break;case 0x3:joinOrLeaveQueues(_0x502c2e,_0x18680f,_0x5645('0x45'),_0x43eaa9[_0x41b607][_0x30a685]);break;case 0x4:joinOrLeaveQueues(_0x502c2e,_0x18680f,_0x5645('0x46'),_0x43eaa9[_0x41b607][_0x30a685]);break;case 0x5:joinOrLeaveQueues(_0x502c2e,_0x18680f,_0x5645('0x47'),_0x43eaa9[_0x41b607][_0x30a685]);break;case 0x6:joinOrLeaveQueues(_0x502c2e,_0x18680f,_0x5645('0x48'),_0x43eaa9[_0x41b607][_0x30a685]);break;case 0x7:if(_0xe83ed7[_0x5645('0x7')]!=='agent')_0x502c2e[_0x18680f](util['format'](_0x5645('0x49'),_0x43eaa9[_0x41b607][_0x30a685][_0x5645('0x4')]));break;case 0x8:if(_0xe83ed7['role']!=='agent')_0x502c2e[_0x18680f](util[_0x5645('0x1c')]('trunk:%s',_0x43eaa9[_0x41b607][_0x30a685][_0x5645('0x4')]));break;case 0x9:if(_0xe83ed7[_0x5645('0x7')]!==_0x5645('0x8'))_0x502c2e[_0x18680f](util[_0x5645('0x1c')](_0x5645('0x4a'),_0x43eaa9[_0x41b607][_0x30a685]['type'],_0x43eaa9[_0x41b607][_0x30a685][_0x5645('0x4')]));break;case 0xa:_0x502c2e[_0x18680f](util['format']('user:%s',_0x43eaa9[_0x41b607][_0x30a685][_0x5645('0x4')]));break;}}}}})[_0x5645('0xc')](function(){if(_0x18680f===_0x5645('0x4b')){var _0x46637f=_[_0x5645('0x18')](_0xe83ed7[_0x5645('0x4c')],'id');return _0xe83ed7[_0x5645('0x4d')](_0x46637f)[_0x5645('0xc')](function(){for(var _0x13bee1=0x0;_0x13bee1<_0x46637f[_0x5645('0x41')];_0x13bee1+=0x1){_0x116bfc[_0x5645('0x4e')](_0x5645('0x4f'),{'ChatInteractionId':Number(_0x46637f[_0x13bee1]),'UserId':Number(_0xe83ed7['id'])});}});}})['then'](function(){if(_0x18680f==='leave'){var _0x30932d=_[_0x5645('0x18')](_0xe83ed7[_0x5645('0x20')],'id');return _0xe83ed7[_0x5645('0x50')](_0x30932d)[_0x5645('0xc')](function(){for(var _0x4cfe24=0x0;_0x4cfe24<_0x30932d[_0x5645('0x41')];_0x4cfe24+=0x1){_0x116bfc[_0x5645('0x4e')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x30932d[_0x4cfe24]),'UserId':Number(_0xe83ed7['id'])});}});}})[_0x5645('0xc')](function(){if(_0x18680f===_0x5645('0x4b')){var _0x2eea4c=_[_0x5645('0x18')](_0xe83ed7[_0x5645('0x22')],'id');return _0xe83ed7['removeFaxInteractions'](_0x2eea4c)[_0x5645('0xc')](function(){for(var _0xd1f0b=0x0;_0xd1f0b<_0x2eea4c[_0x5645('0x41')];_0xd1f0b+=0x1){_0x116bfc[_0x5645('0x4e')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x2eea4c[_0xd1f0b]),'UserId':Number(_0xe83ed7['id'])});}});}})[_0x5645('0xc')](function(){if(_0x18680f===_0x5645('0x4b')){var _0xd971f5=_[_0x5645('0x18')](_0xe83ed7[_0x5645('0x24')],'id');return _0xe83ed7[_0x5645('0x51')](_0xd971f5)[_0x5645('0xc')](function(){for(var _0x3b4f94=0x0;_0x3b4f94<_0xd971f5[_0x5645('0x41')];_0x3b4f94+=0x1){_0x116bfc['emit'](_0x5645('0x52'),{'SmsInteractionId':Number(_0xd971f5[_0x3b4f94]),'UserId':Number(_0xe83ed7['id'])});}});}})[_0x5645('0xc')](function(){if(_0x18680f==='leave'){var _0x5d90a6=_[_0x5645('0x18')](_0xe83ed7['OpenchannelInteractions'],'id');return _0xe83ed7[_0x5645('0x53')](_0x5d90a6)[_0x5645('0xc')](function(){for(var _0x26431d=0x0;_0x26431d<_0x5d90a6[_0x5645('0x41')];_0x26431d+=0x1){_0x116bfc[_0x5645('0x4e')](_0x5645('0x54'),{'OpenchannelInteractionId':Number(_0x5d90a6[_0x26431d]),'UserId':Number(_0xe83ed7['id'])});}});}})[_0x5645('0xc')](function(){if(_0x18680f==='leave'){var _0x2a7a9a=_[_0x5645('0x18')](_0xe83ed7[_0x5645('0x28')],'id');return _0xe83ed7[_0x5645('0x55')](_0x2a7a9a)[_0x5645('0xc')](function(){for(var _0x302248=0x0;_0x302248<_0x2a7a9a[_0x5645('0x41')];_0x302248+=0x1){_0x116bfc[_0x5645('0x4e')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x2a7a9a[_0x302248]),'UserId':Number(_0xe83ed7['id'])});}});}})[_0x5645('0x56')](function(_0x7e719a){_0x502c2e[_0x5645('0x57')](_0x7e719a);});}}function onDisconnect(_0x2e3899,_0x5e7f9e){joinOrLeave(_0x2e3899,_0x5645('0x4b'),_0x5e7f9e);}function onConnect(_0x31661a){joinOrLeave(_0x31661a,_0x5645('0x58'));}exports[_0x5645('0x59')]=function(_0x4545f8){_0x4545f8['on'](_0x5645('0x5a'),function(_0x83ec55){_0x83ec55[_0x5645('0x5b')](0x0);_0x83ec55['address']=_0x83ec55[_0x5645('0x5c')][_0x5645('0x5a')][_0x5645('0x5d')]+':'+_0x83ec55[_0x5645('0x5c')][_0x5645('0x5a')][_0x5645('0x5e')];_0x83ec55['connectedAt']=new Date();_0x83ec55[_0x5645('0x57')]=function(_0xd12828){console[_0x5645('0x57')](_0x5645('0x5f')+_0x83ec55['nsp']['name']+'['+_0x83ec55[_0x5645('0x60')]+']',_0xd12828);};_0x83ec55['on'](_0x5645('0x61'),function(){onDisconnect(_0x83ec55,_0x4545f8);_0x83ec55[_0x5645('0x57')]('DISCONNECTED');});onConnect(_0x83ec55);_0x83ec55[_0x5645('0x57')](_0x5645('0x62'));});}; \ No newline at end of file +var _0xed83=['find','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','MailQueue','OpenchannelQueue','VoiceQueue','FaxQueue','SmsQueue','WhatsappQueue','Telephones','Trunks','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','all','chat','fax','sms','mail','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','ChatInteractions','removeChatInteractions','emit','removeMailInteractions','user_has_mail_interactions:remove','leave','user_has_fax_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','join','default','connection','setMaxListeners','request','remotePort','connectedAt','log','SocketIO\x20','address','disconnect','DISCONNECTED','util','bluebird','../mysqldb','./environment','name','Agents','User','role','telephone','agent','type','ivr','findOne','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','UserProfileResource','resourceId','then','map','Campaign','where','%s:queue:%s','length','format','user:%s','handshake','query'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xed83,0x160));var _0x3ed8=function(_0x4c14e1,_0x164882){_0x4c14e1=_0x4c14e1-0x0;var _0x4accda=_0xed83[_0x4c14e1];return _0x4accda;};'use strict';var _=require('lodash');var util=require(_0x3ed8('0x0'));var BPromise=require(_0x3ed8('0x1'));var db=require(_0x3ed8('0x2'))['db'];var config=require(_0x3ed8('0x3'));var queryQueues={'attributes':['id',_0x3ed8('0x4')],'include':[{'as':_0x3ed8('0x5'),'model':db[_0x3ed8('0x6')],'attributes':['id',_0x3ed8('0x4'),_0x3ed8('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x3ed8('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x3ed8('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x3ed8('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x3ed8('0x4'),_0x3ed8('0xa')],'where':{'type':_0x3ed8('0xb')}};function getAssociatedResources(_0x4a7f85,_0x5093ca,_0x3939a9){return db['UserProfileSection'][_0x3ed8('0xc')]({'where':{'name':_0x4a7f85,'userProfileId':_0x5093ca},'raw':!![]})['then'](function(_0x23605a){if(_0x23605a){if(_0x23605a['autoAssociation']){switch(_0x4a7f85){case _0x3ed8('0xd'):case _0x3ed8('0xe'):case _0x3ed8('0xf'):case'SmsQueues':case _0x3ed8('0x10'):case _0x3ed8('0x11'):case _0x3ed8('0x12'):return db[_0x3939a9][_0x3ed8('0x13')](queryQueues);case'Telephones':return db[_0x3939a9][_0x3ed8('0x13')](queryTelephones);case'Trunks':return db[_0x3939a9][_0x3ed8('0x13')](queryTrunks);case'IvrCampaigns':return db[_0x3939a9]['findAll'](queryCampaigns);}}else{return db[_0x3ed8('0x14')][_0x3ed8('0x13')]({'attributes':[_0x3ed8('0x15')],'where':{'sectionId':_0x23605a['id']},'raw':!![]})[_0x3ed8('0x16')](function(_0x405344){if(_0x405344){var _0x211045={'where':{'id':_[_0x3ed8('0x17')](_0x405344,_0x3ed8('0x15'))},'raw':!![]};switch(_0x3939a9){case _0x3ed8('0x6'):_0x211045['where'][_0x3ed8('0x7')]=_0x3ed8('0x8');break;case _0x3ed8('0x18'):_0x211045[_0x3ed8('0x19')][_0x3ed8('0xa')]=_0x3ed8('0xb');break;}return db[_0x3939a9][_0x3ed8('0x13')](_0x211045);}else{return[];}});}}else{return[];}})[_0x3ed8('0x16')](function(_0xe546c8){return _0xe546c8;});}function joinOrLeaveQueues(_0x4f9ef5,_0x3208db,_0x2fe3e3,_0x2a106c){_0x4f9ef5[_0x3208db](util['format'](_0x3ed8('0x1a'),_0x2fe3e3,_0x2a106c[_0x3ed8('0x4')]));if(_0x2a106c['Agents']){for(var _0x172807=0x0;_0x172807<_0x2a106c[_0x3ed8('0x5')][_0x3ed8('0x1b')];_0x172807+=0x1){_0x4f9ef5[_0x3208db](util[_0x3ed8('0x1c')](_0x3ed8('0x1d'),_0x2a106c['Agents'][_0x172807][_0x3ed8('0x4')]));}}}function joinOrLeave(_0x191fb5,_0x3c0bf2,_0x5e3262){var _0x4f7bbd;if(_0x191fb5[_0x3ed8('0x1e')][_0x3ed8('0x1f')]['id']){db['User'][_0x3ed8('0x20')]({'attributes':['id','name',_0x3ed8('0x7'),_0x3ed8('0x21')],'where':{'id':_0x191fb5['handshake']['query']['id']},'include':[{'model':db[_0x3ed8('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x3ed8('0x23')],'as':_0x3ed8('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x3ed8('0x25')],'as':_0x3ed8('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x3ed8('0x27')],'as':_0x3ed8('0x28'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x3ed8('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x3ed8('0x2a')],'as':_0x3ed8('0x2b'),'attributes':['id'],'raw':!![]}]})[_0x3ed8('0x16')](function(_0x56bb68){if(_0x56bb68){_0x4f7bbd=_0x56bb68;_0x191fb5[_0x3c0bf2](util[_0x3ed8('0x1c')]('user:%s',_0x56bb68['name']));var _0x1a47b1=[];switch(_0x56bb68[_0x3ed8('0x7')]){case _0x3ed8('0x2c'):_0x191fb5[_0x3c0bf2](_0x3ed8('0x2d'));_0x191fb5[_0x3c0bf2](_0x3ed8('0x2e'));if(queryQueues[_0x3ed8('0x2f')](_0x3ed8('0x30'))){delete queryQueues[_0x3ed8('0x30')];}_0x1a47b1['push'](db['VoiceQueue'][_0x3ed8('0x13')](queryQueues));_0x1a47b1[_0x3ed8('0x31')](db[_0x3ed8('0x32')]['findAll'](queryQueues));_0x1a47b1[_0x3ed8('0x31')](db['FaxQueue'][_0x3ed8('0x13')](queryQueues));_0x1a47b1[_0x3ed8('0x31')](db['SmsQueue'][_0x3ed8('0x13')](queryQueues));_0x1a47b1['push'](db[_0x3ed8('0x33')][_0x3ed8('0x13')](queryQueues));_0x1a47b1[_0x3ed8('0x31')](db[_0x3ed8('0x34')][_0x3ed8('0x13')](queryQueues));_0x1a47b1['push'](db['WhatsappQueue'][_0x3ed8('0x13')](queryQueues));_0x1a47b1['push'](db['User']['findAll'](queryTelephones));_0x1a47b1[_0x3ed8('0x31')](db['Trunk']['findAll'](queryTrunks));_0x1a47b1['push'](db[_0x3ed8('0x18')][_0x3ed8('0x13')](queryCampaigns));_0x1a47b1[_0x3ed8('0x31')](db[_0x3ed8('0x6')]['findAll'](queryAgents));break;case'user':_0x191fb5[_0x3c0bf2](_0x3ed8('0x2d'));_0x191fb5[_0x3c0bf2](_0x3ed8('0x2e'));_0x1a47b1['push'](getAssociatedResources('VoiceQueues',_0x56bb68[_0x3ed8('0x21')],_0x3ed8('0x35')));_0x1a47b1[_0x3ed8('0x31')](getAssociatedResources(_0x3ed8('0xe'),_0x56bb68[_0x3ed8('0x21')],_0x3ed8('0x32')));_0x1a47b1[_0x3ed8('0x31')](getAssociatedResources(_0x3ed8('0xf'),_0x56bb68[_0x3ed8('0x21')],_0x3ed8('0x36')));_0x1a47b1[_0x3ed8('0x31')](getAssociatedResources('SmsQueues',_0x56bb68['userProfileId'],_0x3ed8('0x37')));_0x1a47b1[_0x3ed8('0x31')](getAssociatedResources('MailQueues',_0x56bb68[_0x3ed8('0x21')],_0x3ed8('0x33')));_0x1a47b1[_0x3ed8('0x31')](getAssociatedResources('OpenchannelQueues',_0x56bb68['userProfileId'],_0x3ed8('0x34')));_0x1a47b1[_0x3ed8('0x31')](getAssociatedResources('WhatsappQueues',_0x56bb68[_0x3ed8('0x21')],_0x3ed8('0x38')));_0x1a47b1[_0x3ed8('0x31')](getAssociatedResources(_0x3ed8('0x39'),_0x56bb68['userProfileId'],'User'));_0x1a47b1['push'](getAssociatedResources(_0x3ed8('0x3a'),_0x56bb68[_0x3ed8('0x21')],'Trunk'));_0x1a47b1[_0x3ed8('0x31')](getAssociatedResources('IvrCampaigns',_0x56bb68[_0x3ed8('0x21')],_0x3ed8('0x18')));_0x1a47b1['push'](db[_0x3ed8('0x6')]['findAll'](queryAgents));break;case'agent':_0x191fb5[_0x3c0bf2](_0x3ed8('0x2d'));_0x191fb5[_0x3c0bf2]('voice:outbound');_0x1a47b1['push'](_0x56bb68[_0x3ed8('0x3b')]({'attributes':['id',_0x3ed8('0x4')]}));_0x1a47b1[_0x3ed8('0x31')](_0x56bb68[_0x3ed8('0x3c')]({'attributes':['id','name']}));_0x1a47b1['push'](_0x56bb68[_0x3ed8('0x3d')]({'attributes':['id',_0x3ed8('0x4')]}));_0x1a47b1[_0x3ed8('0x31')](_0x56bb68[_0x3ed8('0x3e')]({'attributes':['id',_0x3ed8('0x4')]}));_0x1a47b1['push'](_0x56bb68['getMailQueues']({'attributes':['id',_0x3ed8('0x4')]}));_0x1a47b1[_0x3ed8('0x31')](_0x56bb68[_0x3ed8('0x3f')]({'attributes':['id','name']}));_0x1a47b1['push'](_0x56bb68['getWhatsappQueues']({'attributes':['id',_0x3ed8('0x4')]}));break;}return BPromise[_0x3ed8('0x40')](_0x1a47b1);}})['then'](function(_0x4c9654){if(_0x4c9654&&_0x4c9654[_0x3ed8('0x1b')]){for(var _0x329429=0x0;_0x329429<_0x4c9654['length'];_0x329429+=0x1){for(var _0x53af6f=0x0;_0x53af6f<_0x4c9654[_0x329429][_0x3ed8('0x1b')];_0x53af6f+=0x1){switch(_0x329429){case 0x0:joinOrLeaveQueues(_0x191fb5,_0x3c0bf2,'voice',_0x4c9654[_0x329429][_0x53af6f]);break;case 0x1:joinOrLeaveQueues(_0x191fb5,_0x3c0bf2,_0x3ed8('0x41'),_0x4c9654[_0x329429][_0x53af6f]);break;case 0x2:joinOrLeaveQueues(_0x191fb5,_0x3c0bf2,_0x3ed8('0x42'),_0x4c9654[_0x329429][_0x53af6f]);break;case 0x3:joinOrLeaveQueues(_0x191fb5,_0x3c0bf2,_0x3ed8('0x43'),_0x4c9654[_0x329429][_0x53af6f]);break;case 0x4:joinOrLeaveQueues(_0x191fb5,_0x3c0bf2,_0x3ed8('0x44'),_0x4c9654[_0x329429][_0x53af6f]);break;case 0x5:joinOrLeaveQueues(_0x191fb5,_0x3c0bf2,_0x3ed8('0x45'),_0x4c9654[_0x329429][_0x53af6f]);break;case 0x6:joinOrLeaveQueues(_0x191fb5,_0x3c0bf2,'whatsapp',_0x4c9654[_0x329429][_0x53af6f]);break;case 0x7:if(_0x4f7bbd[_0x3ed8('0x7')]!==_0x3ed8('0x9'))_0x191fb5[_0x3c0bf2](util['format'](_0x3ed8('0x46'),_0x4c9654[_0x329429][_0x53af6f][_0x3ed8('0x4')]));break;case 0x8:if(_0x4f7bbd[_0x3ed8('0x7')]!==_0x3ed8('0x9'))_0x191fb5[_0x3c0bf2](util['format'](_0x3ed8('0x47'),_0x4c9654[_0x329429][_0x53af6f][_0x3ed8('0x4')]));break;case 0x9:if(_0x4f7bbd[_0x3ed8('0x7')]!==_0x3ed8('0x9'))_0x191fb5[_0x3c0bf2](util[_0x3ed8('0x1c')](_0x3ed8('0x48'),_0x4c9654[_0x329429][_0x53af6f][_0x3ed8('0xa')],_0x4c9654[_0x329429][_0x53af6f][_0x3ed8('0x4')]));break;case 0xa:_0x191fb5[_0x3c0bf2](util['format'](_0x3ed8('0x1d'),_0x4c9654[_0x329429][_0x53af6f]['name']));break;}}}}})[_0x3ed8('0x16')](function(){if(_0x3c0bf2==='leave'){var _0x459d5e=_[_0x3ed8('0x17')](_0x4f7bbd[_0x3ed8('0x49')],'id');return _0x4f7bbd[_0x3ed8('0x4a')](_0x459d5e)[_0x3ed8('0x16')](function(){for(var _0x281989=0x0;_0x281989<_0x459d5e[_0x3ed8('0x1b')];_0x281989+=0x1){_0x5e3262[_0x3ed8('0x4b')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x459d5e[_0x281989]),'UserId':Number(_0x4f7bbd['id'])});}});}})['then'](function(){if(_0x3c0bf2==='leave'){var _0x188bac=_[_0x3ed8('0x17')](_0x4f7bbd[_0x3ed8('0x24')],'id');return _0x4f7bbd[_0x3ed8('0x4c')](_0x188bac)['then'](function(){for(var _0x22ed86=0x0;_0x22ed86<_0x188bac[_0x3ed8('0x1b')];_0x22ed86+=0x1){_0x5e3262[_0x3ed8('0x4b')](_0x3ed8('0x4d'),{'MailInteractionId':Number(_0x188bac[_0x22ed86]),'UserId':Number(_0x4f7bbd['id'])});}});}})[_0x3ed8('0x16')](function(){if(_0x3c0bf2===_0x3ed8('0x4e')){var _0x2e162b=_['map'](_0x4f7bbd[_0x3ed8('0x26')],'id');return _0x4f7bbd['removeFaxInteractions'](_0x2e162b)[_0x3ed8('0x16')](function(){for(var _0x5d7ed8=0x0;_0x5d7ed8<_0x2e162b[_0x3ed8('0x1b')];_0x5d7ed8+=0x1){_0x5e3262[_0x3ed8('0x4b')](_0x3ed8('0x4f'),{'FaxInteractionId':Number(_0x2e162b[_0x5d7ed8]),'UserId':Number(_0x4f7bbd['id'])});}});}})[_0x3ed8('0x16')](function(){if(_0x3c0bf2==='leave'){var _0x144642=_[_0x3ed8('0x17')](_0x4f7bbd[_0x3ed8('0x28')],'id');return _0x4f7bbd['removeSmsInteractions'](_0x144642)[_0x3ed8('0x16')](function(){for(var _0x43ccf0=0x0;_0x43ccf0<_0x144642[_0x3ed8('0x1b')];_0x43ccf0+=0x1){_0x5e3262[_0x3ed8('0x4b')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x144642[_0x43ccf0]),'UserId':Number(_0x4f7bbd['id'])});}});}})[_0x3ed8('0x16')](function(){if(_0x3c0bf2===_0x3ed8('0x4e')){var _0xce24ec=_['map'](_0x4f7bbd[_0x3ed8('0x29')],'id');return _0x4f7bbd[_0x3ed8('0x50')](_0xce24ec)[_0x3ed8('0x16')](function(){for(var _0x5721c4=0x0;_0x5721c4<_0xce24ec[_0x3ed8('0x1b')];_0x5721c4+=0x1){_0x5e3262['emit'](_0x3ed8('0x51'),{'OpenchannelInteractionId':Number(_0xce24ec[_0x5721c4]),'UserId':Number(_0x4f7bbd['id'])});}});}})[_0x3ed8('0x16')](function(){if(_0x3c0bf2===_0x3ed8('0x4e')){var _0x58ac4f=_['map'](_0x4f7bbd['WhatsappInteractions'],'id');return _0x4f7bbd[_0x3ed8('0x52')](_0x58ac4f)['then'](function(){for(var _0x5eecc2=0x0;_0x5eecc2<_0x58ac4f['length'];_0x5eecc2+=0x1){_0x5e3262['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x58ac4f[_0x5eecc2]),'UserId':Number(_0x4f7bbd['id'])});}});}})[_0x3ed8('0x53')](function(_0x44f87){_0x191fb5['log'](_0x44f87);});}}function onDisconnect(_0x4305d4,_0x295ba5){joinOrLeave(_0x4305d4,_0x3ed8('0x4e'),_0x295ba5);}function onConnect(_0x161259){joinOrLeave(_0x161259,_0x3ed8('0x54'));}exports[_0x3ed8('0x55')]=function(_0x3debd3){_0x3debd3['on'](_0x3ed8('0x56'),function(_0x50ce57){_0x50ce57[_0x3ed8('0x57')](0x0);_0x50ce57['address']=_0x50ce57[_0x3ed8('0x58')][_0x3ed8('0x56')]['remoteAddress']+':'+_0x50ce57[_0x3ed8('0x58')]['connection'][_0x3ed8('0x59')];_0x50ce57[_0x3ed8('0x5a')]=new Date();_0x50ce57[_0x3ed8('0x5b')]=function(_0x5534da){console['log'](_0x3ed8('0x5c')+_0x50ce57['nsp'][_0x3ed8('0x4')]+'['+_0x50ce57[_0x3ed8('0x5d')]+']',_0x5534da);};_0x50ce57['on'](_0x3ed8('0x5e'),function(){onDisconnect(_0x50ce57,_0x3debd3);_0x50ce57[_0x3ed8('0x5b')](_0x3ed8('0x5f'));});onConnect(_0x50ce57);_0x50ce57[_0x3ed8('0x5b')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index ef2fa5a..ce96d38 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 _0xf03e=['UserId','undefined','SIP/%s','name','outgoingmessage','catch','AfterCreateMessage','event','offlineMessage','opened','Sequelize','QueryTypes','interface','agent','AfterCreate','changed','closed','substatus','format','AfterUpdate','User','find','fullname','email','internal','default','length','model','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','afterUpdate','closedinteraction','ChatMessage','afterCreate','newmessage','ChatOfflineMessage','Sms','SmsInteraction','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','newinteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','Trigger,\x20%s','EventManager','error','code','get','channel','motionChannel','direction','resolve','then','ContactId','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','SELECT','contact'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0xf03e,0xbc));var _0xef03=function(_0x67737d,_0x36a70e){_0x67737d=_0x67737d-0x0;var _0x235d1e=_0xf03e[_0x67737d];return _0x235d1e;};'use strict';var util=require(_0xef03('0x0'));var db=require(_0xef03('0x1'))['db'];var jayson=require(_0xef03('0x2'));var logger=require(_0xef03('0x3'))(_0xef03('0x4'));var client=jayson[_0xef03('0x5')][_0xef03('0x6')]({'port':0x232a});var triggers=[{'channel':_0xef03('0x7'),'model':_0xef03('0x8'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0xef03('0x7'),'model':_0xef03('0x8'),'event':_0xef03('0x9'),'condition':_0xef03('0xa'),'callback':afterUpdate},{'channel':_0xef03('0x7'),'model':_0xef03('0xb'),'event':_0xef03('0xc'),'condition':_0xef03('0xd'),'callback':afterCreateMessage},{'channel':_0xef03('0x7'),'model':_0xef03('0xe'),'event':'afterCreate','condition':_0xef03('0xd'),'callback':afterCreateOfflineMessage},{'channel':_0xef03('0xf'),'model':_0xef03('0x10'),'event':_0xef03('0xc'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xef03('0xf'),'model':'SmsInteraction','event':_0xef03('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xef03('0xf'),'model':'SmsMessage','event':_0xef03('0xc'),'condition':_0xef03('0xd'),'callback':afterCreateMessage},{'channel':_0xef03('0x11'),'model':_0xef03('0x12'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':'Whatsapp','model':_0xef03('0x12'),'event':_0xef03('0x9'),'condition':_0xef03('0xa'),'callback':afterUpdate},{'channel':_0xef03('0x11'),'model':_0xef03('0x13'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0xef03('0x14'),'model':_0xef03('0x15'),'event':_0xef03('0xc'),'condition':_0xef03('0x16'),'callback':afterCreate},{'channel':_0xef03('0x14'),'model':'FaxInteraction','event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0xef03('0x14'),'model':_0xef03('0x17'),'event':_0xef03('0xc'),'condition':_0xef03('0xd'),'callback':afterCreateMessage},{'channel':_0xef03('0x18'),'model':_0xef03('0x19'),'event':_0xef03('0xc'),'condition':_0xef03('0x16'),'callback':afterCreate},{'channel':_0xef03('0x18'),'model':_0xef03('0x19'),'event':_0xef03('0x9'),'condition':_0xef03('0xa'),'callback':afterUpdate},{'channel':_0xef03('0x18'),'model':_0xef03('0x1a'),'event':_0xef03('0xc'),'condition':_0xef03('0xd'),'callback':afterCreateMessage},{'channel':_0xef03('0x1b'),'model':_0xef03('0x1c'),'event':_0xef03('0xc'),'condition':_0xef03('0x16'),'callback':afterCreate},{'channel':_0xef03('0x1b'),'model':'OpenchannelInteraction','event':_0xef03('0x9'),'condition':_0xef03('0xa'),'callback':afterUpdate},{'channel':'Openchannel','model':_0xef03('0x1d'),'event':'afterCreate','condition':_0xef03('0xd'),'callback':afterCreateMessage}];function request(_0x1c6459){return client['request']('EventManager',_0x1c6459)['then'](function(_0x1745cb){logger['info'](_0xef03('0x1e'),_0xef03('0x1f'),_0x1745cb);if(_0x1745cb[_0xef03('0x20')]){if(_0x1745cb[_0xef03('0x20')][_0xef03('0x21')]===0x1f4){logger[_0xef03('0x20')](_0xef03('0x1e'),_0xef03('0x1f'),_0x1745cb['error']);}}})['catch'](function(_0x3bc9b){logger[_0xef03('0x20')](_0xef03('0x1e'),_0xef03('0x1f'),_0x3bc9b);});}function afterCreateMessage(_0x3450b1){return function(_0x1d45e5){_0x1d45e5=_0x1d45e5[_0xef03('0x22')]({'plain':!![]});_0x1d45e5[_0xef03('0x23')]=_0x3450b1;_0x1d45e5[_0xef03('0x24')]=_0x3450b1;_0x1d45e5['event']=_0x1d45e5[_0xef03('0x25')];Promise[_0xef03('0x26')]()[_0xef03('0x27')](function(){if(typeof _0x1d45e5[_0xef03('0x28')]==='undefined')return null;var _0x1f307c=_0xef03('0x29')+_0x1d45e5['ContactId'];return db[_0xef03('0x2a')][_0xef03('0x2b')](_0x1f307c,{'type':db['Sequelize']['QueryTypes'][_0xef03('0x2c')],'raw':!![]});})[_0xef03('0x27')](function(_0x273411){if(_0x273411){_0x1d45e5[_0xef03('0x2d')]=_0x273411[0x0];}if(typeof _0x1d45e5[_0xef03('0x2e')]===_0xef03('0x2f'))return;return getAgent(_0x1d45e5[_0xef03('0x2e')]);})[_0xef03('0x27')](function(_0xfabcb0){if(_0xfabcb0){_0x1d45e5['interface']=util['format'](_0xef03('0x30'),_0xfabcb0[_0xef03('0x31')]);_0x1d45e5['agent']=_0xfabcb0;_0x1d45e5[_0xef03('0x23')]=_0x3450b1;return request({'event':'incomingmessage','message':_0x1d45e5});}else{return request({'event':_0xef03('0x32'),'message':_0x1d45e5});}})[_0xef03('0x33')](function(_0x2ae39d){logger['error'](_0xef03('0x1e'),_0xef03('0x34'),_0x2ae39d);});};}function afterCreateOfflineMessage(_0x38f6eb){return function(_0x14f6e0){_0x14f6e0=_0x14f6e0['get']({'plain':!![]});_0x14f6e0[_0xef03('0x23')]=_0x38f6eb;_0x14f6e0[_0xef03('0x24')]=_0x38f6eb;_0x14f6e0[_0xef03('0x35')]=_0xef03('0x36');return request({'event':_0x14f6e0[_0xef03('0x35')],'message':_0x14f6e0});};}function afterCreate(_0x836331,_0x38ab33){return function(_0x548378){_0x548378=_0x548378['get']({'plain':!![]});_0x548378[_0xef03('0x23')]=_0x836331;_0x548378[_0xef03('0x24')]=_0x836331;_0x548378[_0xef03('0x35')]=_0xef03('0x37');Promise[_0xef03('0x26')]()['then'](function(){var _0x35581d=_0xef03('0x29')+_0x548378[_0xef03('0x28')];return db[_0xef03('0x2a')][_0xef03('0x2b')](_0x35581d,{'type':db[_0xef03('0x38')][_0xef03('0x39')][_0xef03('0x2c')],'raw':!![]});})[_0xef03('0x27')](function(_0x5aad36){if(_0x5aad36){_0x548378['contact']=_0x5aad36[0x0];}if(typeof _0x548378['UserId']===_0xef03('0x2f'))return;return getAgent(_0x548378[_0xef03('0x2e')]);})[_0xef03('0x27')](function(_0x1eedb8){if(_0x1eedb8){_0x548378[_0xef03('0x3a')]=util['format']('SIP/%s',_0x1eedb8[_0xef03('0x31')]);_0x548378[_0xef03('0x3b')]=_0x1eedb8;}return request({'event':_0x38ab33,'message':_0x548378});})[_0xef03('0x33')](function(_0x4b30a9){logger['error'](_0xef03('0x1e'),_0xef03('0x3c'),_0x4b30a9);});};}function afterUpdate(_0x5a8978){return function(_0x1d40e2){var _0x5a0325=_0x1d40e2[_0xef03('0x3d')](_0xef03('0x3e'))&&_0x1d40e2[_0xef03('0x3e')];var _0x246a5a=_0x1d40e2[_0xef03('0x3d')]('substatus');if(_0x5a0325||_0x246a5a){var _0x1341f2=_0x5a0325?_0xef03('0xa'):_0xef03('0x3f');var _0x5284fc=_0x1d40e2[_0xef03('0x22')]({'plain':!![]});_0x5284fc[_0xef03('0x23')]=_0x5a8978;_0x5284fc[_0xef03('0x24')]=_0x5a8978;_0x5284fc[_0xef03('0x35')]=_0x5a0325?'closed':_0xef03('0x3f');var _0x12df2b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5284fc['ContactId'];return db[_0xef03('0x2a')][_0xef03('0x2b')](_0x12df2b,{'type':db['Sequelize']['QueryTypes'][_0xef03('0x2c')],'raw':!![]})['then'](function(_0x45ced0){if(_0x45ced0){_0x5284fc[_0xef03('0x2d')]=_0x45ced0[0x0];}if(typeof _0x5284fc['UserId']===_0xef03('0x2f'))return;return getAgent(_0x5284fc[_0xef03('0x2e')]);})[_0xef03('0x27')](function(_0x5ad320){if(_0x5ad320){_0x5284fc[_0xef03('0x3a')]=util[_0xef03('0x40')](_0xef03('0x30'),_0x5ad320[_0xef03('0x31')]);_0x5284fc['agent']=_0x5ad320;}return request({'event':_0x1341f2,'message':_0x5284fc});})['catch'](function(_0x3ba7ca){logger[_0xef03('0x20')](_0xef03('0x1e'),_0xef03('0x41'),_0x3ba7ca);});}};}function getAgent(_0x1dfd56){return db[_0xef03('0x42')][_0xef03('0x43')]({'where':{'id':_0x1dfd56},'attributes':['id',_0xef03('0x31'),_0xef03('0x44'),_0xef03('0x45'),_0xef03('0x46')],'raw':!![]})['then'](function(_0x1017db){return _0x1017db;});}exports[_0xef03('0x47')]=function(){for(var _0x3d614e=0x0;_0x3d614e=_0x2cdd95[_0x2ea5('0x15')]){throw Error(_0x2ea5('0x16'));}_0x11a997(_0x443289);})[_0x2ea5('0x17')](function(_0x32ae7d){_0x238d14(_0x32ae7d);});});}; \ No newline at end of file +var _0x9dc1=['includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User','count','then','agents','catch','lodash','bluebird','../mysqldb','voice','chat','sms','whatsapp','getChannels','isValidChannel','toLowerCase'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9dc1,0x80));var _0x19dc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9dc1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x19dc('0x0'));var BPromise=require(_0x19dc('0x1'));var db=require(_0x19dc('0x2'))['db'];var util=require('./license/util');var channels=[_0x19dc('0x3'),'mail',_0x19dc('0x4'),'fax',_0x19dc('0x5'),_0x19dc('0x6'),'openchannel'];exports[_0x19dc('0x7')]=function(){return channels;};exports[_0x19dc('0x8')]=function(_0x2cfe87){_0x2cfe87=_0x2cfe87[_0x19dc('0x9')]();return _[_0x19dc('0xa')](channels,_0x2cfe87);};exports[_0x19dc('0xb')]=function(_0x251ec4,_0x40db94,_0x566da0,_0x1926cb){var _0x2e9044={'loginAttempts':_0x40db94,'blocked':_0x566da0};if(!_[_0x19dc('0xc')](_0x1926cb)){_0x2e9044[_0x19dc('0xd')]=_0x1926cb;}return _0x251ec4[_0x19dc('0xe')](_0x2e9044);};exports[_0x19dc('0xf')]=function(_0x333438){return new BPromise(function(_0x58fc2e,_0x1ab90f){var _0x40ec47=0x0;if(_0x333438[_0x19dc('0x10')]!==_0x19dc('0x11')){_0x58fc2e(_0x333438);}db[_0x19dc('0x12')][_0x19dc('0x13')]({'where':{'role':_0x19dc('0x11'),'online':!![],'id':{'$ne':_0x333438['id']}}})[_0x19dc('0x14')](function(_0x107625){_0x40ec47=_0x107625;return util[_0x19dc('0xf')]();})[_0x19dc('0x14')](function(_0x453df0){if(_0x453df0&&_0x453df0[_0x19dc('0x15')]&&_0x40ec47>=_0x453df0[_0x19dc('0x15')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x58fc2e(_0x333438);})[_0x19dc('0x16')](function(_0x297ace){_0x1ab90f(_0x297ace);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 865980a..afa17da 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdb7=['Error','Bad\x20Request','Entity\x20not\x20found','inherits','Forbidden','OutOfInterval','Not\x20Found','status','util','../config/logger','api','message','Internal\x20Server\x20Error','name'];(function(_0x11c5cf,_0x2994e6){var _0x21932c=function(_0x31d78d){while(--_0x31d78d){_0x11c5cf['push'](_0x11c5cf['shift']());}};_0x21932c(++_0x2994e6);}(_0xbdb7,0x12e));var _0x7bdb=function(_0xd3bc07,_0x3a11a5){_0xd3bc07=_0xd3bc07-0x0;var _0x10aa85=_0xbdb7[_0xd3bc07];return _0x10aa85;};'use strict';var util=require(_0x7bdb('0x0'));var logger=require(_0x7bdb('0x1'))(_0x7bdb('0x2'));var APIError=function(_0x2a2c1c,_0x23c326){this[_0x7bdb('0x3')]=_0x2a2c1c||_0x7bdb('0x4');this[_0x7bdb('0x5')]=_0x23c326||_0x7bdb('0x6');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x28542c){this['message']=_0x28542c||'Bad\x20Request';this[_0x7bdb('0x5')]=_0x7bdb('0x7');util['inherits'](APIBadRequestError,APIError);};var APINotFoundError=function(_0x513cba){this[_0x7bdb('0x3')]=_0x513cba||_0x7bdb('0x8');this['name']='Not\x20Found';util[_0x7bdb('0x9')](APINotFoundError,APIError);};function getStatusCode(_0x1a6b61){switch(_0x1a6b61){case _0x7bdb('0x7'):return 0x190;case _0x7bdb('0xa'),_0x7bdb('0xb'):return 0x193;case _0x7bdb('0xc'):return 0x194;default:return 0x1f4;}}function handleError(_0x297724){return function(_0x258cc6){logger['error'](_0x258cc6['stack']);var _0x52b9b9=getStatusCode(_0x258cc6[_0x7bdb('0x5')]);if(_0x258cc6[_0x7bdb('0x5')])delete _0x258cc6['name'];return _0x297724[_0x7bdb('0xd')](_0x52b9b9)['send'](_0x258cc6);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0x9bde=['exports','../config/logger','message','Internal\x20Server\x20Error','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','OutOfInterval','error','stack','send'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x9bde,0xe1));var _0xe9bd=function(_0x502d4c,_0x27bcd2){_0x502d4c=_0x502d4c-0x0;var _0x2460ab=_0x9bde[_0x502d4c];return _0x2460ab;};'use strict';var util=require('util');var logger=require(_0xe9bd('0x0'))('api');var APIError=function(_0xc79e0b,_0x4c63ca){this[_0xe9bd('0x1')]=_0xc79e0b||_0xe9bd('0x2');this[_0xe9bd('0x3')]=_0x4c63ca||_0xe9bd('0x4');util[_0xe9bd('0x5')](APIError,Error);};var APIBadRequestError=function(_0x1a4d14){this[_0xe9bd('0x1')]=_0x1a4d14||'Bad\x20Request';this[_0xe9bd('0x3')]=_0xe9bd('0x6');util[_0xe9bd('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0xa66ae2){this[_0xe9bd('0x1')]=_0xa66ae2||_0xe9bd('0x7');this[_0xe9bd('0x3')]=_0xe9bd('0x8');util[_0xe9bd('0x5')](APINotFoundError,APIError);};function getStatusCode(_0x45c7ba){switch(_0x45c7ba){case'Bad\x20Request':return 0x190;case'Forbidden',_0xe9bd('0x9'):return 0x193;case _0xe9bd('0x8'):return 0x194;default:return 0x1f4;}}function handleError(_0x2601ac){return function(_0x581ab9){logger[_0xe9bd('0xa')](_0x581ab9[_0xe9bd('0xb')]);var _0x3339f9=getStatusCode(_0x581ab9[_0xe9bd('0x3')]);if(_0x581ab9['name'])delete _0x581ab9[_0xe9bd('0x3')];return _0x2601ac['status'](_0x3339f9)[_0xe9bd('0xc')](_0x581ab9);};}module[_0xe9bd('0xd')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 44ab503..fb7aebc 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x91bb=['status','render','json','send','exports','404'];(function(_0x5ad3d3,_0x2d400c){var _0x4344e7=function(_0x557356){while(--_0x557356){_0x5ad3d3['push'](_0x5ad3d3['shift']());}};_0x4344e7(++_0x2d400c);}(_0x91bb,0xfa));var _0xb91b=function(_0x312835,_0xff273e){_0x312835=_0x312835-0x0;var _0x1da8b9=_0x91bb[_0x312835];return _0x1da8b9;};'use strict';module[_0xb91b('0x0')][0x194]=function pageNotFound(_0x4da211,_0x31078f){var _0x895f22=_0xb91b('0x1');var _0x2b61f6=0x194;var _0x16f672={'status':_0x2b61f6};_0x31078f[_0xb91b('0x2')](_0x16f672['status']);_0x31078f[_0xb91b('0x3')](_0x895f22,{},function(_0x5484f2,_0x28fb06){if(_0x5484f2){return _0x31078f[_0xb91b('0x2')](_0x16f672[_0xb91b('0x2')])[_0xb91b('0x4')](_0x16f672);}_0x31078f[_0xb91b('0x5')](_0x28fb06);});}; \ No newline at end of file +var _0xbcc3=['json','send','exports','404','status','render'];(function(_0x31673a,_0x2f2e67){var _0x1b1387=function(_0x439143){while(--_0x439143){_0x31673a['push'](_0x31673a['shift']());}};_0x1b1387(++_0x2f2e67);}(_0xbcc3,0x86));var _0x3bcc=function(_0x426267,_0x422e6e){_0x426267=_0x426267-0x0;var _0x59e163=_0xbcc3[_0x426267];return _0x59e163;};'use strict';module[_0x3bcc('0x0')][0x194]=function pageNotFound(_0x2373a7,_0x1add42){var _0x546ab7=_0x3bcc('0x1');var _0x3bea7a=0x194;var _0x5f4c6b={'status':_0x3bea7a};_0x1add42[_0x3bcc('0x2')](_0x5f4c6b[_0x3bcc('0x2')]);_0x1add42[_0x3bcc('0x3')](_0x546ab7,{},function(_0x15dc7a,_0x120e57){if(_0x15dc7a){return _0x1add42[_0x3bcc('0x2')](_0x5f4c6b[_0x3bcc('0x2')])[_0x3bcc('0x4')](_0x5f4c6b);}_0x1add42[_0x3bcc('0x5')](_0x120e57);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 782b74f..029e517 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x43ed=['../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','CannedAnswer','Disposition','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','Schedule','../api/sound/sound.model','Tag','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','cascade','UserId','userSetting','hasMany','Recordings','VoiceQueuesRt','VoiceExtension','HopperHistory','OpenchannelInteractions','SmsInteractions','FaxInteraction','MailInteractions','WhatsappInteractions','UserNotification','SenderId','userProfileId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','ChatInteractions','user_has_chat_interactions','FaxInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueue','VoiceQueues','VoicePrefixes','ChatQueues','UserFaxQueue','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueue','WhatsappQueues','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','ChanSpyId','Applications','Sound','Sounds','moh_has_sounds','Hoppers','HopperFinals','VoiceQueueId','CmHopperHistory','HopperHistories','JscriptySessionReport','JscriptySessions','belongsTo','Trunk','TrunkId','TrunkBackup','TrunkBackupId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceCallReport','VoiceQueueReport','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','MailServerOut','restrict','Smtp','Answers','MailApplication','List','ListId','TemplateId','team_has_mail_queues','MailInteractionId','Owner','Tags','mail_interaction_has_tags','ThroughTags','Users','user_has_mail_interactions','Interaction','Account','ChatWebsiteId','ChatOfflineMessageId','TagId','Dashboard','Items','Dispositions','FaxAccountId','Interactions','Exntensions','FaxMessage','FaxInteractionId','fax_interaction_has_tags','user_has_fax_interactions','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','IntervalId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatGroupId','CompanyId','CmContactHasItem','Phones','CmContactId','CmHopperId','OwnerId','CampaignId','All','AutomationAllId','Actions','AutomationId','ParentId','Intervals','FaxApplications','SmsApplications','DefaultReportId','AnalyticCustomReport','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','AnalyticMetric','MetricId','Configurations','AccountId','Subjects','SubjectId','DescriptionId','FieldId','Subject','Field','VariableId','Description','DeskAccount','DeskField','DeskConfiguration','int_desk_configuration_has_tags','ZohoConfiguration','Descriptions','FreshdeskAccount','Dynamics365Configuration','Dynamics365Field','FreshsalesAccount','FromId','ToId','SessionId','ProjectId','MailQueues','FaxQueues','team_has_whatsapp_queues','VoicePrefix','HopperBlacks','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','FromAccount','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsAccountId','CustomFields','Queues','Extensions','UserVoicePrefix','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','user','Imap','../config/environment','sequelize','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','name','database','username','password','options','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxQueue','FaxQueueReport'];(function(_0x32017c,_0x3991d4){var _0xca9140=function(_0xdd4bb){while(--_0xdd4bb){_0x32017c['push'](_0x32017c['shift']());}};_0xca9140(++_0x3991d4);}(_0x43ed,0x1b3));var _0xd43e=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x43ed[_0x4d8ed9];return _0x1e2140;};'use strict';var config=require(_0xd43e('0x0'));var Sequelize=require(_0xd43e('0x1'));var _=require('lodash');var jstz=require('jstz');var timezone=jstz[_0xd43e('0x2')]();config[_0xd43e('0x1')]=_[_0xd43e('0x3')](config[_0xd43e('0x1')],{'database':_0xd43e('0x4'),'username':_0xd43e('0x5'),'password':_0xd43e('0x6'),'options':{'host':_0xd43e('0x7'),'port':0xcea,'dialect':_0xd43e('0x8'),'dialectOptions':{'charset':_0xd43e('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xd43e('0xa'),'collate':_0xd43e('0xb')}}});config[_0xd43e('0xc')]=_['defaultsDeep'](config['sequelizeHistory'],{'database':_0xd43e('0x4'),'username':_0xd43e('0x5'),'password':_0xd43e('0x6'),'options':{'host':_0xd43e('0x7'),'port':0xcea,'dialect':_0xd43e('0x8'),'dialectOptions':{'charset':_0xd43e('0x9')},'logging':![],'timezone':timezone[_0xd43e('0xd')](),'define':{'charset':_0xd43e('0xa'),'collate':_0xd43e('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xd43e('0x1')][_0xd43e('0xe')],config[_0xd43e('0x1')][_0xd43e('0xf')],config[_0xd43e('0x1')][_0xd43e('0x10')],config['sequelize'][_0xd43e('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xd43e('0xc')][_0xd43e('0xe')],config[_0xd43e('0xc')]['username'],config[_0xd43e('0xc')]['password'],config[_0xd43e('0xc')][_0xd43e('0x11')])};db[_0xd43e('0x12')]=db[_0xd43e('0x1')][_0xd43e('0x13')]('../api/user/user.model');db[_0xd43e('0x14')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x15'));db[_0xd43e('0x16')]=db[_0xd43e('0x1')][_0xd43e('0x13')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db['sequelize'][_0xd43e('0x13')](_0xd43e('0x17'));db[_0xd43e('0x18')]=db['sequelize'][_0xd43e('0x13')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db['VoiceQueue']=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x19'));db[_0xd43e('0x1a')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x1b'));db[_0xd43e('0x1c')]=db[_0xd43e('0x1')]['import'](_0xd43e('0x1d'));db[_0xd43e('0x1e')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x1f'));db[_0xd43e('0x20')]=db[_0xd43e('0x1')][_0xd43e('0x13')]('../api/voiceMailMessage/voiceMailMessage.model');db['VoiceCallReport']=db[_0xd43e('0x1')][_0xd43e('0x13')]('../api/voiceCallReport/voiceCallReport.model');db[_0xd43e('0x21')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x22'));db[_0xd43e('0x23')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x24'));db['VoiceQueueReport']=db[_0xd43e('0x1')][_0xd43e('0x13')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0xd43e('0x25')]=db['sequelize'][_0xd43e('0x13')](_0xd43e('0x26'));db['Trunk']=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x27'));db['VoiceTransferReport']=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x28'));db[_0xd43e('0x29')]=db[_0xd43e('0x1')][_0xd43e('0x13')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xd43e('0x2a')]=db['sequelize'][_0xd43e('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0xd43e('0x2b')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x2c'));db[_0xd43e('0x2d')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x2e'));db['UserFaxQueue']=db['sequelize'][_0xd43e('0x13')]('../api/userFaxQueue/userFaxQueue.model');db[_0xd43e('0x2f')]=db[_0xd43e('0x1')]['import'](_0xd43e('0x30'));db[_0xd43e('0x31')]=db[_0xd43e('0x1')][_0xd43e('0x13')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xd43e('0x32')]=db['sequelize'][_0xd43e('0x13')](_0xd43e('0x33'));db[_0xd43e('0x34')]=db['sequelize'][_0xd43e('0x13')](_0xd43e('0x35'));db['MailServerOut']=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x36'));db[_0xd43e('0x37')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x38'));db[_0xd43e('0x39')]=db[_0xd43e('0x1')][_0xd43e('0x13')]('../api/mailQueue/mailQueue.model');db[_0xd43e('0x3a')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x3b'));db[_0xd43e('0x3c')]=db[_0xd43e('0x1')][_0xd43e('0x13')]('../api/mailInteraction/mailInteraction.model');db[_0xd43e('0x3d')]=db[_0xd43e('0x1')][_0xd43e('0x13')]('../api/mailMessage/mailMessage.model');db['MailApplication']=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x3e'));db[_0xd43e('0x3f')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x40'));db['Dashboard']=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x41'));db[_0xd43e('0x42')]=db['sequelize'][_0xd43e('0x13')]('../api/dashboardItem/dashboardItem.model');db[_0xd43e('0x43')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x44'));db[_0xd43e('0x45')]=db['sequelize'][_0xd43e('0x13')](_0xd43e('0x46'));db['FaxInteraction']=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x47'));db['FaxMessage']=db[_0xd43e('0x1')][_0xd43e('0x13')]('../api/faxMessage/faxMessage.model');db[_0xd43e('0x48')]=db['sequelize'][_0xd43e('0x13')]('../api/faxQueue/faxQueue.model');db[_0xd43e('0x49')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x4a'));db[_0xd43e('0x4b')]=db[_0xd43e('0x1')]['import']('../api/smsAccount/smsAccount.model');db[_0xd43e('0x4c')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x4d'));db[_0xd43e('0x4e')]=db[_0xd43e('0x1')][_0xd43e('0x13')]('../api/smsInteraction/smsInteraction.model');db[_0xd43e('0x4f')]=db[_0xd43e('0x1')][_0xd43e('0x13')]('../api/smsMessage/smsMessage.model');db[_0xd43e('0x50')]=db['sequelize'][_0xd43e('0x13')](_0xd43e('0x51'));db[_0xd43e('0x52')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x53'));db[_0xd43e('0x54')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x55'));db[_0xd43e('0x56')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x57'));db[_0xd43e('0x58')]=db[_0xd43e('0x1')]['import'](_0xd43e('0x59'));db['OpenchannelQueue']=db['sequelize'][_0xd43e('0x13')](_0xd43e('0x5a'));db[_0xd43e('0x5b')]=db['sequelize'][_0xd43e('0x13')](_0xd43e('0x5c'));db[_0xd43e('0x5d')]=db[_0xd43e('0x1')][_0xd43e('0x13')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xd43e('0x5e')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x5f'));db[_0xd43e('0x60')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x61'));db[_0xd43e('0x62')]=db['sequelize'][_0xd43e('0x13')](_0xd43e('0x63'));db[_0xd43e('0x64')]=db['sequelize'][_0xd43e('0x13')](_0xd43e('0x65'));db[_0xd43e('0x66')]=db['sequelize'][_0xd43e('0x13')](_0xd43e('0x67'));db[_0xd43e('0x68')]=db['sequelize']['import'](_0xd43e('0x69'));db['ChatProactiveAction']=db['sequelize'][_0xd43e('0x13')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0xd43e('0x6a')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x6b'));db['CmContact']=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x6c'));db[_0xd43e('0x6d')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x6e'));db[_0xd43e('0x6f')]=db['sequelize']['import'](_0xd43e('0x70'));db[_0xd43e('0x71')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x72'));db['CmHopperHistory']=db[_0xd43e('0x1')][_0xd43e('0x13')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0xd43e('0x73')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x74'));db[_0xd43e('0x75')]=db['sequelize'][_0xd43e('0x13')](_0xd43e('0x76'));db[_0xd43e('0x77')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x78'));db[_0xd43e('0x79')]=db[_0xd43e('0x1')][_0xd43e('0x13')]('../api/automation/automation.model');db[_0xd43e('0x7a')]=db[_0xd43e('0x1')][_0xd43e('0x13')]('../api/cannedAnswer/cannedAnswer.model');db[_0xd43e('0x7b')]=db[_0xd43e('0x1')]['import']('../api/disposition/disposition.model');db[_0xd43e('0x7c')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x7d'));db[_0xd43e('0x7e')]=db['sequelize'][_0xd43e('0x13')](_0xd43e('0x7f'));db[_0xd43e('0x80')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x81'));db[_0xd43e('0x82')]=db['sequelize'][_0xd43e('0x13')]('../api/cdr/cdr.model');db[_0xd43e('0x83')]=db[_0xd43e('0x1')][_0xd43e('0x13')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0xd43e('0x84')]=db['sequelize'][_0xd43e('0x13')]('../api/schedule/schedule.model');db['Sound']=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x85'));db[_0xd43e('0x86')]=db[_0xd43e('0x1')][_0xd43e('0x13')]('../api/tag/tag.model');db[_0xd43e('0x87')]=db['sequelize'][_0xd43e('0x13')](_0xd43e('0x88'));db['CmContactHasItem']=db[_0xd43e('0x1')]['import'](_0xd43e('0x89'));db[_0xd43e('0x8a')]=db[_0xd43e('0x1')][_0xd43e('0x13')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0xd43e('0x8b')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x8c'));db[_0xd43e('0x8d')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x8e'));db[_0xd43e('0x8f')]=db[_0xd43e('0x1')]['import'](_0xd43e('0x90'));db[_0xd43e('0x91')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x92'));db[_0xd43e('0x93')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x94'));db['AnalyticCustomReport']=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x95'));db[_0xd43e('0x96')]=db[_0xd43e('0x1')][_0xd43e('0x13')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0xd43e('0x97')]=db[_0xd43e('0x1')][_0xd43e('0x13')]('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x98'));db['AnalyticFieldReport']=db[_0xd43e('0x1')]['import'](_0xd43e('0x99'));db[_0xd43e('0x9a')]=db['sequelize'][_0xd43e('0x13')](_0xd43e('0x9b'));db[_0xd43e('0x9c')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x9d'));db[_0xd43e('0x9e')]=db['sequelize'][_0xd43e('0x13')](_0xd43e('0x9f'));db[_0xd43e('0xa0')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0xa1'));db[_0xd43e('0xa2')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0xa3'));db[_0xd43e('0xa4')]=db['sequelize'][_0xd43e('0x13')](_0xd43e('0xa5'));db[_0xd43e('0xa6')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0xa7'));db['DeskAccount']=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0xa8'));db['DeskConfiguration']=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0xa9'));db['DeskField']=db['sequelize'][_0xd43e('0x13')](_0xd43e('0xaa'));db[_0xd43e('0xab')]=db[_0xd43e('0x1')][_0xd43e('0x13')]('../api/intZohoAccount/intZohoAccount.model');db['ZohoConfiguration']=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0xac'));db[_0xd43e('0xad')]=db[_0xd43e('0x1')]['import']('../api/intZohoField/intZohoField.model');db[_0xd43e('0xae')]=db['sequelize'][_0xd43e('0x13')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0xd43e('0xaf')]=db[_0xd43e('0x1')][_0xd43e('0x13')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xd43e('0xb0')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0xb1'));db['FreshdeskAccount']=db['sequelize'][_0xd43e('0x13')](_0xd43e('0xb2'));db[_0xd43e('0xb3')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0xb4'));db[_0xd43e('0xb5')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0xb6'));db[_0xd43e('0xb7')]=db['sequelize'][_0xd43e('0x13')](_0xd43e('0xb8'));db[_0xd43e('0xb9')]=db[_0xd43e('0x1')]['import'](_0xd43e('0xba'));db[_0xd43e('0xbb')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0xbc'));db['ServicenowAccount']=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0xbd'));db[_0xd43e('0xbe')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0xbf'));db[_0xd43e('0xc0')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0xc1'));db[_0xd43e('0xc2')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0xc3'));db['Dynamics365Configuration']=db['sequelize'][_0xd43e('0x13')](_0xd43e('0xc4'));db['Dynamics365Field']=db[_0xd43e('0x1')]['import'](_0xd43e('0xc5'));db['FreshsalesAccount']=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0xc6'));db[_0xd43e('0xc7')]=db[_0xd43e('0x1')][_0xd43e('0x13')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0xd43e('0xc8')]=db['sequelize']['import'](_0xd43e('0xc9'));db['Integration']=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x92'));db[_0xd43e('0xca')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0xcb'));db[_0xd43e('0xcc')]=db['sequelize'][_0xd43e('0x13')](_0xd43e('0xcd'));db[_0xd43e('0xce')]=db[_0xd43e('0x1')][_0xd43e('0x13')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0xd43e('0xcf')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0xd0'));db[_0xd43e('0xd1')]=db[_0xd43e('0x1')]['import']('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db['sequelize']['import'](_0xd43e('0xd2'));db[_0xd43e('0xd3')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0xd4'));db['SquareReport']=db['sequelize']['import'](_0xd43e('0xd5'));db['SquareDetailsReport']=db[_0xd43e('0x1')][_0xd43e('0x13')]('../api/squareReportDetail/squareReportDetail.model');db[_0xd43e('0xd6')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0xd7'));db[_0xd43e('0xd8')]=db[_0xd43e('0x1')]['import'](_0xd43e('0xd9'));db['SquareOdbc']=db['sequelize'][_0xd43e('0x13')](_0xd43e('0xda'));db[_0xd43e('0xdb')]=db['sequelize'][_0xd43e('0x13')](_0xd43e('0xdc'));db['SquareRecording']=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0xdd'));db['SquareMessage']=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0xde'));db[_0xd43e('0xdf')]=db[_0xd43e('0x1')][_0xd43e('0x13')]('../api/team/team.model');db[_0xd43e('0xe0')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0xe1'));db[_0xd43e('0xe2')]=db[_0xd43e('0x1')]['import'](_0xd43e('0xe3'));db['Migration']=db[_0xd43e('0x1')]['import'](_0xd43e('0xe4'));db[_0xd43e('0xe5')]=db[_0xd43e('0x1')][_0xd43e('0x13')]('../api/attachment/attachment.model');db[_0xd43e('0xe6')]=db['sequelize'][_0xd43e('0x13')](_0xd43e('0xe7'));db[_0xd43e('0xe8')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0xe9'));db[_0xd43e('0xea')]=db[_0xd43e('0x1')]['import']('../api/chatTransferReport/chatTransferReport.model');db[_0xd43e('0xeb')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0xec'));db['OpenchannelTransferReport']=db[_0xd43e('0x1')]['import']('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0xd43e('0xed')]=db['sequelize'][_0xd43e('0x13')](_0xd43e('0xee'));db[_0xd43e('0xef')]=db['sequelize'][_0xd43e('0x13')](_0xd43e('0xf0'));db['VoicePrefix']=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0xf1'));db[_0xd43e('0xf2')]=db['sequelize'][_0xd43e('0x13')]('../api/userProfile/userProfile.model');db[_0xd43e('0xf3')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0xf4'));db['UserProfileResource']=db[_0xd43e('0x1')]['import'](_0xd43e('0xf5'));db['UserNotification']=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0xf6'));db[_0xd43e('0xf7')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0xf8'));db[_0xd43e('0xf9')]=db[_0xd43e('0x1')]['import'](_0xd43e('0xfa'));db[_0xd43e('0xfb')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0xfc'));db[_0xd43e('0xfd')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0xfe'));db[_0xd43e('0xff')]=db['sequelize'][_0xd43e('0x13')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xd43e('0x100')]=db['sequelize']['import'](_0xd43e('0x101'));db['WhatsappQueue']=db['sequelize'][_0xd43e('0x13')](_0xd43e('0x102'));db[_0xd43e('0x103')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x104'));db[_0xd43e('0x105')]=db['sequelize'][_0xd43e('0x13')](_0xd43e('0x106'));db[_0xd43e('0x107')]=db[_0xd43e('0x1')][_0xd43e('0x13')](_0xd43e('0x108'));db['UserVoicePrefix']=db[_0xd43e('0x1')][_0xd43e('0x13')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0xd43e('0x109')]=db['sequelize'][_0xd43e('0x13')](_0xd43e('0x10a'));db[_0xd43e('0x12')][_0xd43e('0x10b')](db[_0xd43e('0x1e')],{'as':_0xd43e('0x1e'),'onDelete':_0xd43e('0x10c'),'foreignKey':_0xd43e('0x10d')});db[_0xd43e('0x12')]['hasOne'](db[_0xd43e('0x109')],{'as':_0xd43e('0x10e'),'onDelete':_0xd43e('0x10c'),'foreignKey':_0xd43e('0x10d')});db[_0xd43e('0x12')][_0xd43e('0x10f')](db[_0xd43e('0x1a')],{'as':_0xd43e('0x110'),'foreignKey':_0xd43e('0x10d')});db[_0xd43e('0x12')][_0xd43e('0x10f')](db[_0xd43e('0x29')],{'as':_0xd43e('0x111'),'foreignKey':'UserId'});db[_0xd43e('0x12')]['hasMany'](db[_0xd43e('0x112')],{'as':'Extensions','onDelete':_0xd43e('0x10c'),'hooks':!![]});db[_0xd43e('0x12')][_0xd43e('0x10f')](db[_0xd43e('0x71')],{'as':'HopperFinals','foreignKey':'UserId'});db[_0xd43e('0x12')][_0xd43e('0x10f')](db['CmHopperHistory'],{'as':_0xd43e('0x113'),'foreignKey':'UserId'});db['User'][_0xd43e('0x10f')](db['ReportAgentPreview'],{'as':_0xd43e('0x73'),'foreignKey':'UserId'});db[_0xd43e('0x12')][_0xd43e('0x10f')](db['OpenchannelInteraction'],{'as':_0xd43e('0x114'),'foreignKey':_0xd43e('0x10d')});db[_0xd43e('0x12')][_0xd43e('0x10f')](db[_0xd43e('0x60')],{'as':'ChatInteractions','foreignKey':_0xd43e('0x10d')});db['User']['hasMany'](db['SmsInteraction'],{'as':_0xd43e('0x115'),'foreignKey':_0xd43e('0x10d')});db['User'][_0xd43e('0x10f')](db[_0xd43e('0x116')],{'as':'FaxInteractions','foreignKey':'UserId'});db[_0xd43e('0x12')]['hasMany'](db[_0xd43e('0x3c')],{'as':_0xd43e('0x117'),'foreignKey':_0xd43e('0x10d')});db[_0xd43e('0x12')][_0xd43e('0x10f')](db[_0xd43e('0xfb')],{'as':_0xd43e('0x118'),'foreignKey':_0xd43e('0x10d')});db[_0xd43e('0x12')][_0xd43e('0x10f')](db[_0xd43e('0x119')],{'as':'UserNotifications','foreignKey':_0xd43e('0x11a')});db['User']['belongsTo'](db[_0xd43e('0xf2')],{'as':_0xd43e('0xf2'),'foreignKey':_0xd43e('0x11b')});db[_0xd43e('0x12')][_0xd43e('0x11c')](db[_0xd43e('0x68')],{'as':_0xd43e('0x11d'),'through':_0xd43e('0x11e')});db[_0xd43e('0x12')][_0xd43e('0x11c')](db[_0xd43e('0x11f')],{'as':_0xd43e('0x120'),'through':_0xd43e('0x121')});db['User'][_0xd43e('0x11c')](db[_0xd43e('0xef')],{'as':_0xd43e('0x122'),'through':_0xd43e('0x123')});db[_0xd43e('0x12')][_0xd43e('0x11c')](db['Team'],{'through':_0xd43e('0x124')});db[_0xd43e('0x12')][_0xd43e('0x11c')](db[_0xd43e('0x3c')],{'as':_0xd43e('0x117'),'through':'user_has_mail_interactions'});db[_0xd43e('0x12')][_0xd43e('0x11c')](db[_0xd43e('0x60')],{'as':_0xd43e('0x125'),'through':_0xd43e('0x126')});db[_0xd43e('0x12')]['belongsToMany'](db[_0xd43e('0x116')],{'as':_0xd43e('0x127'),'through':'user_has_fax_interactions'});db[_0xd43e('0x12')][_0xd43e('0x11c')](db[_0xd43e('0x4e')],{'as':'SmsInteractions','through':_0xd43e('0x128')});db[_0xd43e('0x12')]['belongsToMany'](db['OpenchannelInteraction'],{'as':_0xd43e('0x114'),'through':_0xd43e('0x129')});db[_0xd43e('0x12')]['belongsToMany'](db[_0xd43e('0xfb')],{'as':_0xd43e('0x118'),'through':_0xd43e('0x12a')});db[_0xd43e('0x12')]['belongsToMany'](db[_0xd43e('0x12b')],{'as':_0xd43e('0x12c'),'through':_0xd43e('0x2a'),'required':![]});db[_0xd43e('0x12')][_0xd43e('0x11c')](db['VoicePrefix'],{'as':_0xd43e('0x12d'),'through':'UserVoicePrefix','required':![]});db[_0xd43e('0x12')]['belongsToMany'](db[_0xd43e('0x39')],{'as':'MailQueues','through':_0xd43e('0x2d'),'required':![]});db[_0xd43e('0x12')][_0xd43e('0x11c')](db[_0xd43e('0x66')],{'as':_0xd43e('0x12e'),'through':_0xd43e('0x2b'),'required':![],'hooks':!![]});db[_0xd43e('0x12')][_0xd43e('0x11c')](db['FaxQueue'],{'as':'FaxQueues','through':_0xd43e('0x12f'),'required':![]});db[_0xd43e('0x12')][_0xd43e('0x11c')](db[_0xd43e('0x50')],{'as':_0xd43e('0x130'),'through':_0xd43e('0x2f'),'required':![]});db[_0xd43e('0x12')][_0xd43e('0x11c')](db[_0xd43e('0x131')],{'as':_0xd43e('0x132'),'through':_0xd43e('0x31'),'required':![]});db[_0xd43e('0x12')][_0xd43e('0x11c')](db[_0xd43e('0x133')],{'as':_0xd43e('0x134'),'through':_0xd43e('0x32'),'required':![]});db[_0xd43e('0x12')]['belongsToMany'](db[_0xd43e('0xef')],{'through':_0xd43e('0x123')});db[_0xd43e('0x12')][_0xd43e('0x11c')](db[_0xd43e('0x5b')],{'as':_0xd43e('0x135'),'through':_0xd43e('0x136')});db[_0xd43e('0x12')][_0xd43e('0x11c')](db[_0xd43e('0x43')],{'as':'FaxAccounts','through':_0xd43e('0x137')});db[_0xd43e('0x12')][_0xd43e('0x11c')](db['MailAccount'],{'as':_0xd43e('0x138'),'through':_0xd43e('0x139')});db[_0xd43e('0x12')][_0xd43e('0x11c')](db['OpenchannelAccount'],{'as':_0xd43e('0x13a'),'through':_0xd43e('0x13b')});db[_0xd43e('0x12')][_0xd43e('0x11c')](db['SmsAccount'],{'as':'SmsAccounts','through':_0xd43e('0x13c')});db[_0xd43e('0x12')][_0xd43e('0x11c')](db['WhatsappAccount'],{'as':_0xd43e('0x13d'),'through':'user_has_whatsapp_accounts'});db[_0xd43e('0x14')]['hasMany'](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':_0xd43e('0x13e')});db[_0xd43e('0x16')][_0xd43e('0x10f')](db['VoiceExtension'],{'onDelete':_0xd43e('0x10c')});db[_0xd43e('0x112')]['hasMany'](db[_0xd43e('0x112')],{'as':_0xd43e('0x13f'),'onDelete':_0xd43e('0x10c')});db[_0xd43e('0x18')][_0xd43e('0x11c')](db[_0xd43e('0x140')],{'as':_0xd43e('0x141'),'through':_0xd43e('0x142')});db[_0xd43e('0x12b')][_0xd43e('0x10f')](db[_0xd43e('0x29')],{'as':'Members','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xd43e('0x10f')](db[_0xd43e('0x6d')],{'as':_0xd43e('0x143'),'foreignKey':'VoiceQueueId'});db[_0xd43e('0x12b')][_0xd43e('0x10f')](db[_0xd43e('0x71')],{'as':_0xd43e('0x144'),'foreignKey':_0xd43e('0x145')});db[_0xd43e('0x12b')][_0xd43e('0x10f')](db[_0xd43e('0x146')],{'as':_0xd43e('0x147'),'foreignKey':_0xd43e('0x145')});db[_0xd43e('0x12b')][_0xd43e('0x10f')](db[_0xd43e('0x73')],{'as':_0xd43e('0x73'),'foreignKey':_0xd43e('0x145')});db['VoiceQueue']['hasMany'](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0xd43e('0x145')});db[_0xd43e('0x12b')]['hasMany'](db[_0xd43e('0x148')],{'as':_0xd43e('0x149'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xd43e('0x14a')](db[_0xd43e('0x14b')],{'as':_0xd43e('0x14b'),'foreignKey':_0xd43e('0x14c')});db[_0xd43e('0x12b')][_0xd43e('0x14a')](db[_0xd43e('0x14b')],{'as':_0xd43e('0x14d'),'foreignKey':_0xd43e('0x14e')});db['VoiceQueue'][_0xd43e('0x14a')](db[_0xd43e('0x7e')],{'as':_0xd43e('0x7e'),'foreignKey':'IntervalId'});db[_0xd43e('0x12b')][_0xd43e('0x14a')](db['Pause'],{'as':_0xd43e('0x14f'),'foreignKey':_0xd43e('0x150')});db[_0xd43e('0x12b')]['belongsToMany'](db[_0xd43e('0xef')],{'as':'Lists','through':_0xd43e('0x151')});db[_0xd43e('0x12b')][_0xd43e('0x11c')](db[_0xd43e('0x12')],{'as':_0xd43e('0x152'),'through':'UserVoiceQueue'});db[_0xd43e('0x12b')][_0xd43e('0x11c')](db[_0xd43e('0xdf')],{'as':_0xd43e('0x153'),'through':_0xd43e('0x105')});db[_0xd43e('0x12b')][_0xd43e('0x11c')](db[_0xd43e('0xef')],{'as':_0xd43e('0x154'),'through':_0xd43e('0x155')});db[_0xd43e('0x1a')][_0xd43e('0x14a')](db[_0xd43e('0x12')],{'as':'User','foreignKey':_0xd43e('0x10d')});db[_0xd43e('0x1c')][_0xd43e('0x14a')](db[_0xd43e('0x12')],{'as':_0xd43e('0x12'),'foreignKey':_0xd43e('0x10d')});db[_0xd43e('0x1e')]['hasMany'](db[_0xd43e('0x20')],{'as':_0xd43e('0x156'),'onDelete':_0xd43e('0x10c'),'foreignKey':_0xd43e('0x157'),'sourceKey':_0xd43e('0x158')});db[_0xd43e('0x20')][_0xd43e('0x14a')](db[_0xd43e('0x1e')],{'foreignKey':_0xd43e('0x157'),'targetKey':'mailbox'});db[_0xd43e('0x159')][_0xd43e('0x10f')](db[_0xd43e('0x15a')],{'as':_0xd43e('0x15b'),'foreignKey':_0xd43e('0x15c'),'constraints':![]});db[_0xd43e('0x159')][_0xd43e('0x10f')](db[_0xd43e('0x23')],{'as':_0xd43e('0x15d'),'foreignKey':_0xd43e('0x15c'),'constraints':![]});db[_0xd43e('0x159')][_0xd43e('0x14a')](db['User'],{'as':_0xd43e('0x12'),'foreignKey':_0xd43e('0x10d')});db[_0xd43e('0x159')]['belongsTo'](db['CmContact'],{'as':_0xd43e('0x15e'),'foreignKey':_0xd43e('0x15f')});db[_0xd43e('0x34')][_0xd43e('0x14a')](db['MailAccount'],{'as':_0xd43e('0x37'),'foreignKey':_0xd43e('0x160')});db[_0xd43e('0x34')][_0xd43e('0x14a')](db[_0xd43e('0x103')],{'as':_0xd43e('0x103'),'foreignKey':_0xd43e('0x161'),'onDelete':'restrict'});db[_0xd43e('0x162')][_0xd43e('0x14a')](db[_0xd43e('0x37')],{'as':_0xd43e('0x37'),'foreignKey':_0xd43e('0x160')});db[_0xd43e('0x162')]['belongsTo'](db[_0xd43e('0x103')],{'as':_0xd43e('0x103'),'foreignKey':_0xd43e('0x161'),'onDelete':_0xd43e('0x163')});db[_0xd43e('0x37')]['hasOne'](db['MailServerIn'],{'as':'Imap','onDelete':_0xd43e('0x10c')});db['MailAccount'][_0xd43e('0x10b')](db[_0xd43e('0x162')],{'as':_0xd43e('0x164'),'onDelete':_0xd43e('0x10c')});db[_0xd43e('0x37')][_0xd43e('0x10f')](db[_0xd43e('0x7b')],{'as':'Dispositions','foreignKey':_0xd43e('0x160'),'onDelete':_0xd43e('0x10c')});db['MailAccount'][_0xd43e('0x10f')](db[_0xd43e('0x7a')],{'as':_0xd43e('0x165'),'foreignKey':'MailAccountId'});db[_0xd43e('0x37')]['hasMany'](db[_0xd43e('0x3d')],{'as':_0xd43e('0x156'),'foreignKey':_0xd43e('0x160')});db['MailAccount']['hasMany'](db[_0xd43e('0x3c')],{'as':'Interactions'});db['MailAccount'][_0xd43e('0x10f')](db[_0xd43e('0x166')],{'as':_0xd43e('0x13f')});db[_0xd43e('0x37')][_0xd43e('0x14a')](db[_0xd43e('0xef')],{'as':_0xd43e('0x167'),'foreignKey':_0xd43e('0x168')});db[_0xd43e('0x37')][_0xd43e('0x14a')](db[_0xd43e('0x8b')],{'as':_0xd43e('0x8b'),'foreignKey':_0xd43e('0x169')});db[_0xd43e('0x37')][_0xd43e('0x14a')](db[_0xd43e('0x80')],{'as':_0xd43e('0x14f'),'foreignKey':_0xd43e('0x150')});db['MailAccount'][_0xd43e('0x11c')](db[_0xd43e('0x12')],{'as':_0xd43e('0x152'),'through':_0xd43e('0x139')});db['MailQueue'][_0xd43e('0x11c')](db[_0xd43e('0x12')],{'as':_0xd43e('0x152'),'through':_0xd43e('0x2d')});db[_0xd43e('0x39')]['belongsToMany'](db[_0xd43e('0xdf')],{'through':_0xd43e('0x16a'),'as':_0xd43e('0x153')});db[_0xd43e('0x3c')][_0xd43e('0x10f')](db[_0xd43e('0x3d')],{'as':_0xd43e('0x156'),'onDelete':_0xd43e('0x10c'),'foreignKey':_0xd43e('0x16b')});db[_0xd43e('0x3c')][_0xd43e('0x14a')](db[_0xd43e('0x37')],{'as':'Account','foreignKey':_0xd43e('0x160')});db['MailInteraction']['belongsTo'](db[_0xd43e('0x11f')],{'as':_0xd43e('0x15e'),'foreignKey':_0xd43e('0x15f')});db[_0xd43e('0x3c')][_0xd43e('0x14a')](db['User'],{'as':_0xd43e('0x16c'),'foreignKey':_0xd43e('0x10d')});db[_0xd43e('0x3c')][_0xd43e('0x11c')](db[_0xd43e('0x86')],{'through':'mail_interaction_has_tags','as':_0xd43e('0x16d')});db[_0xd43e('0x3c')][_0xd43e('0x11c')](db[_0xd43e('0x86')],{'through':_0xd43e('0x16e'),'as':_0xd43e('0x16f')});db[_0xd43e('0x3c')][_0xd43e('0x11c')](db[_0xd43e('0x12')],{'as':_0xd43e('0x170'),'through':_0xd43e('0x171'),'foreignKey':_0xd43e('0x16b')});db['MailMessage'][_0xd43e('0x10f')](db[_0xd43e('0xe5')],{'as':'Attachments','onDelete':_0xd43e('0x10c')});db[_0xd43e('0x3d')][_0xd43e('0x14a')](db[_0xd43e('0x12')],{'as':_0xd43e('0x12')});db['MailMessage']['belongsTo'](db['CmContact'],{'onDelete':_0xd43e('0x10c'),'as':_0xd43e('0x15e')});db[_0xd43e('0x3d')][_0xd43e('0x14a')](db[_0xd43e('0x3c')],{'as':_0xd43e('0x172'),'foreignKey':_0xd43e('0x16b')});db[_0xd43e('0x3d')]['belongsTo'](db[_0xd43e('0x37')],{'as':_0xd43e('0x173'),'foreignKey':_0xd43e('0x160')});db[_0xd43e('0x3d')][_0xd43e('0x14a')](db[_0xd43e('0x5b')],{'as':_0xd43e('0x5b'),'foreignKey':_0xd43e('0x174')});db[_0xd43e('0x3d')][_0xd43e('0x14a')](db[_0xd43e('0x64')],{'as':_0xd43e('0x64'),'foreignKey':_0xd43e('0x175')});db[_0xd43e('0x166')][_0xd43e('0x14a')](db[_0xd43e('0x12')],{'onDelete':'restrict'});db['MailApplication'][_0xd43e('0x14a')](db[_0xd43e('0x39')],{'onDelete':_0xd43e('0x163')});db[_0xd43e('0x166')][_0xd43e('0x14a')](db['MailAccount'],{'onDelete':_0xd43e('0x163')});db['MailApplication'][_0xd43e('0x14a')](db[_0xd43e('0x7e')],{'onDelete':_0xd43e('0x163'),'foreignKey':'IntervalId'});db['MailApplication']['belongsTo'](db[_0xd43e('0x86')],{'onDelete':_0xd43e('0x163'),'foreignKey':_0xd43e('0x176')});db[_0xd43e('0x3f')][_0xd43e('0x14a')](db['MailAccount'],{});db[_0xd43e('0x3f')][_0xd43e('0x14a')](db[_0xd43e('0xef')],{'as':_0xd43e('0x167'),'foreignKey':'ListId'});db[_0xd43e('0x3f')][_0xd43e('0x14a')](db['CmContact'],{'as':_0xd43e('0x15e'),'foreignKey':_0xd43e('0x15f')});db[_0xd43e('0x3f')]['belongsTo'](db[_0xd43e('0x3c')],{});db[_0xd43e('0x3f')][_0xd43e('0x14a')](db['MailMessage'],{});db[_0xd43e('0x3f')][_0xd43e('0x14a')](db[_0xd43e('0x12')],{});db[_0xd43e('0x3f')]['belongsTo'](db[_0xd43e('0x39')],{});db[_0xd43e('0x177')][_0xd43e('0x10f')](db[_0xd43e('0x42')],{'as':_0xd43e('0x178'),'onDelete':'cascade'});db[_0xd43e('0x43')][_0xd43e('0x10f')](db['Disposition'],{'as':_0xd43e('0x179'),'foreignKey':_0xd43e('0x17a'),'onDelete':'cascade'});db[_0xd43e('0x43')]['hasMany'](db[_0xd43e('0x7a')],{'as':_0xd43e('0x165'),'foreignKey':'FaxAccountId'});db[_0xd43e('0x43')][_0xd43e('0x10f')](db[_0xd43e('0x116')],{'as':_0xd43e('0x17b')});db[_0xd43e('0x43')][_0xd43e('0x10f')](db[_0xd43e('0x45')],{'as':_0xd43e('0x13f')});db['FaxAccount'][_0xd43e('0x10f')](db[_0xd43e('0x112')],{'as':_0xd43e('0x17c'),'onDelete':'cascade'});db[_0xd43e('0x43')][_0xd43e('0x10f')](db[_0xd43e('0x17d')],{'as':_0xd43e('0x156')});db[_0xd43e('0x43')][_0xd43e('0x14a')](db[_0xd43e('0x14b')],{'as':_0xd43e('0x14b')});db[_0xd43e('0x43')][_0xd43e('0x14a')](db[_0xd43e('0xef')],{'as':_0xd43e('0x167'),'foreignKey':_0xd43e('0x168')});db[_0xd43e('0x43')][_0xd43e('0x14a')](db['Pause'],{'as':_0xd43e('0x14f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xd43e('0x43')][_0xd43e('0x11c')](db[_0xd43e('0x12')],{'as':_0xd43e('0x152'),'through':'user_has_fax_accounts'});db[_0xd43e('0x45')][_0xd43e('0x14a')](db[_0xd43e('0x12')],{'onDelete':_0xd43e('0x163')});db['FaxApplication'][_0xd43e('0x14a')](db[_0xd43e('0x48')],{'onDelete':_0xd43e('0x163')});db[_0xd43e('0x45')]['belongsTo'](db[_0xd43e('0x43')],{'onDelete':_0xd43e('0x163')});db[_0xd43e('0x45')][_0xd43e('0x14a')](db['Tag'],{'onDelete':_0xd43e('0x163'),'foreignKey':'TagId'});db[_0xd43e('0x116')][_0xd43e('0x10f')](db['FaxMessage'],{'as':'Messages','onDelete':_0xd43e('0x10c'),'foreignKey':_0xd43e('0x17e')});db[_0xd43e('0x116')][_0xd43e('0x14a')](db[_0xd43e('0x43')],{'as':_0xd43e('0x173'),'foreignKey':'FaxAccountId'});db[_0xd43e('0x116')][_0xd43e('0x14a')](db[_0xd43e('0x11f')],{'as':_0xd43e('0x15e'),'foreignKey':_0xd43e('0x15f')});db['FaxInteraction']['belongsTo'](db[_0xd43e('0x12')],{'as':_0xd43e('0x16c'),'foreignKey':'UserId'});db[_0xd43e('0x116')]['belongsToMany'](db[_0xd43e('0x86')],{'through':'fax_interaction_has_tags','as':_0xd43e('0x16d')});db[_0xd43e('0x116')][_0xd43e('0x11c')](db[_0xd43e('0x86')],{'through':_0xd43e('0x17f'),'as':_0xd43e('0x16f')});db['FaxInteraction']['belongsToMany'](db[_0xd43e('0x12')],{'as':_0xd43e('0x170'),'through':_0xd43e('0x180'),'foreignKey':_0xd43e('0x17e')});db['FaxMessage']['belongsTo'](db[_0xd43e('0x12')],{'onDelete':_0xd43e('0x10c'),'as':_0xd43e('0x12')});db[_0xd43e('0x17d')][_0xd43e('0x14a')](db['FaxInteraction'],{'as':_0xd43e('0x172'),'foreignKey':'FaxInteractionId'});db[_0xd43e('0x17d')][_0xd43e('0x14a')](db['CmContact'],{'onDelete':_0xd43e('0x10c'),'as':_0xd43e('0x15e')});db[_0xd43e('0x17d')]['belongsTo'](db[_0xd43e('0xe5')],{'as':_0xd43e('0xe5'),'foreignKey':_0xd43e('0x181')});db['FaxMessage']['belongsTo'](db[_0xd43e('0x43')],{'as':_0xd43e('0x173'),'foreignKey':_0xd43e('0x17a')});db['FaxQueue'][_0xd43e('0x11c')](db[_0xd43e('0x12')],{'as':_0xd43e('0x152'),'through':_0xd43e('0x12f')});db[_0xd43e('0x48')][_0xd43e('0x11c')](db[_0xd43e('0xdf')],{'through':_0xd43e('0x182'),'as':'Teams'});db[_0xd43e('0x49')][_0xd43e('0x14a')](db[_0xd43e('0x43')],{});db[_0xd43e('0x49')][_0xd43e('0x14a')](db[_0xd43e('0xef')],{'as':_0xd43e('0x167'),'foreignKey':_0xd43e('0x168')});db[_0xd43e('0x49')][_0xd43e('0x14a')](db[_0xd43e('0x11f')],{'as':_0xd43e('0x15e'),'foreignKey':_0xd43e('0x15f')});db[_0xd43e('0x49')]['belongsTo'](db[_0xd43e('0x116')],{});db['FaxQueueReport']['belongsTo'](db[_0xd43e('0x17d')],{});db['FaxQueueReport'][_0xd43e('0x14a')](db['User'],{});db['FaxQueueReport']['belongsTo'](db[_0xd43e('0x48')],{});db['SmsAccount'][_0xd43e('0x10f')](db[_0xd43e('0x7b')],{'as':'Dispositions','foreignKey':'SmsAccountId','onDelete':_0xd43e('0x10c')});db[_0xd43e('0x4b')][_0xd43e('0x10f')](db[_0xd43e('0x7a')],{'as':_0xd43e('0x165'),'foreignKey':_0xd43e('0x183')});db[_0xd43e('0x4b')]['hasMany'](db[_0xd43e('0x4f')],{'as':_0xd43e('0x156'),'foreignKey':_0xd43e('0x183')});db['SmsAccount'][_0xd43e('0x10f')](db[_0xd43e('0x4e')],{'as':_0xd43e('0x17b')});db[_0xd43e('0x4b')][_0xd43e('0x10f')](db['SmsApplication'],{'as':_0xd43e('0x13f')});db['SmsAccount'][_0xd43e('0x14a')](db[_0xd43e('0xef')],{'as':'List','foreignKey':_0xd43e('0x168')});db[_0xd43e('0x4b')][_0xd43e('0x14a')](db[_0xd43e('0x80')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xd43e('0x4b')][_0xd43e('0x11c')](db[_0xd43e('0x12')],{'as':'Agents','through':_0xd43e('0x13c')});db[_0xd43e('0x4c')]['belongsTo'](db['User'],{'onDelete':'restrict'});db[_0xd43e('0x4c')][_0xd43e('0x14a')](db['SmsQueue'],{'onDelete':_0xd43e('0x163')});db[_0xd43e('0x4c')][_0xd43e('0x14a')](db[_0xd43e('0x4b')],{'onDelete':'restrict'});db['SmsApplication'][_0xd43e('0x14a')](db[_0xd43e('0x7e')],{'onDelete':_0xd43e('0x163'),'foreignKey':'IntervalId'});db['SmsApplication'][_0xd43e('0x14a')](db['Tag'],{'onDelete':_0xd43e('0x163'),'foreignKey':_0xd43e('0x176')});db[_0xd43e('0x4e')][_0xd43e('0x10f')](db[_0xd43e('0x4f')],{'as':'Messages','onDelete':_0xd43e('0x10c'),'foreignKey':_0xd43e('0x184')});db[_0xd43e('0x4e')][_0xd43e('0x14a')](db[_0xd43e('0x4b')],{'as':_0xd43e('0x173'),'foreignKey':'SmsAccountId'});db[_0xd43e('0x4e')][_0xd43e('0x14a')](db['CmContact'],{'as':_0xd43e('0x15e'),'foreignKey':_0xd43e('0x15f')});db[_0xd43e('0x4e')][_0xd43e('0x14a')](db[_0xd43e('0x12')],{'as':'Owner','foreignKey':'UserId'});db['SmsInteraction'][_0xd43e('0x11c')](db[_0xd43e('0x86')],{'through':_0xd43e('0x185'),'as':_0xd43e('0x16d')});db[_0xd43e('0x4e')][_0xd43e('0x11c')](db[_0xd43e('0x86')],{'through':_0xd43e('0x185'),'as':_0xd43e('0x16f')});db[_0xd43e('0x4e')]['belongsToMany'](db[_0xd43e('0x12')],{'as':_0xd43e('0x170'),'through':_0xd43e('0x128'),'foreignKey':'SmsInteractionId'});db[_0xd43e('0x4f')]['belongsTo'](db[_0xd43e('0x12')],{'as':_0xd43e('0x12')});db['SmsMessage'][_0xd43e('0x14a')](db[_0xd43e('0x11f')],{'onDelete':_0xd43e('0x10c'),'as':'Contact'});db[_0xd43e('0x4f')][_0xd43e('0x14a')](db['SmsInteraction'],{'onDelete':_0xd43e('0x10c'),'as':_0xd43e('0x172'),'foreignKey':_0xd43e('0x184')});db[_0xd43e('0x4f')]['belongsTo'](db[_0xd43e('0x4b')],{'as':_0xd43e('0x173'),'foreignKey':_0xd43e('0x183')});db['SmsQueue'][_0xd43e('0x11c')](db[_0xd43e('0x12')],{'as':_0xd43e('0x152'),'through':_0xd43e('0x2f'),'foreignKey':'SmsQueueId'});db['SmsQueue']['belongsToMany'](db[_0xd43e('0xdf')],{'through':_0xd43e('0x186'),'as':'Teams'});db[_0xd43e('0x52')][_0xd43e('0x10f')](db[_0xd43e('0x7b')],{'as':'Dispositions','foreignKey':_0xd43e('0x187'),'onDelete':'cascade'});db[_0xd43e('0x52')][_0xd43e('0x10f')](db[_0xd43e('0x7a')],{'as':'Answers','foreignKey':_0xd43e('0x187')});db[_0xd43e('0x52')][_0xd43e('0x10f')](db[_0xd43e('0x56')],{'as':'Interactions','foreignKey':_0xd43e('0x187')});db[_0xd43e('0x52')]['hasMany'](db[_0xd43e('0x58')],{'as':'Messages','foreignKey':_0xd43e('0x187')});db['OpenchannelAccount']['hasMany'](db[_0xd43e('0x54')],{'as':_0xd43e('0x13f'),'foreignKey':_0xd43e('0x187')});db[_0xd43e('0x52')][_0xd43e('0x14a')](db[_0xd43e('0xef')],{'as':'List','foreignKey':_0xd43e('0x168')});db['OpenchannelAccount'][_0xd43e('0x14a')](db[_0xd43e('0x80')],{'as':_0xd43e('0x14f'),'foreignKey':_0xd43e('0x150')});db[_0xd43e('0x52')]['belongsToMany'](db['User'],{'as':_0xd43e('0x152'),'through':_0xd43e('0x13b')});db[_0xd43e('0x54')][_0xd43e('0x14a')](db[_0xd43e('0x12')],{'onDelete':_0xd43e('0x163')});db[_0xd43e('0x54')][_0xd43e('0x14a')](db[_0xd43e('0x131')],{'onDelete':_0xd43e('0x163'),'foreignKey':_0xd43e('0x188')});db[_0xd43e('0x54')]['belongsTo'](db[_0xd43e('0x52')],{'onDelete':_0xd43e('0x163'),'foreignKey':_0xd43e('0x187')});db[_0xd43e('0x54')][_0xd43e('0x14a')](db[_0xd43e('0x7e')],{'onDelete':_0xd43e('0x163'),'foreignKey':_0xd43e('0x189')});db['OpenchannelApplication'][_0xd43e('0x14a')](db[_0xd43e('0x86')],{'onDelete':_0xd43e('0x163'),'foreignKey':_0xd43e('0x176')});db[_0xd43e('0x56')][_0xd43e('0x10f')](db[_0xd43e('0x58')],{'as':_0xd43e('0x156'),'onDelete':_0xd43e('0x10c'),'foreignKey':_0xd43e('0x18a')});db[_0xd43e('0x56')]['belongsTo'](db[_0xd43e('0x52')],{'as':'Account','foreignKey':_0xd43e('0x187')});db[_0xd43e('0x56')][_0xd43e('0x14a')](db[_0xd43e('0x11f')],{'as':_0xd43e('0x15e'),'foreignKey':_0xd43e('0x15f')});db['OpenchannelInteraction'][_0xd43e('0x14a')](db[_0xd43e('0x12')],{'as':_0xd43e('0x16c'),'foreignKey':'UserId'});db[_0xd43e('0x56')]['belongsToMany'](db[_0xd43e('0x86')],{'through':_0xd43e('0x18b'),'as':_0xd43e('0x16d')});db[_0xd43e('0x56')]['belongsToMany'](db['Tag'],{'through':_0xd43e('0x18b'),'as':_0xd43e('0x16f')});db[_0xd43e('0x56')][_0xd43e('0x11c')](db['User'],{'as':_0xd43e('0x170'),'through':_0xd43e('0x129'),'foreignKey':'OpenchannelInteractionId'});db[_0xd43e('0x58')][_0xd43e('0x14a')](db[_0xd43e('0x12')],{'onDelete':_0xd43e('0x10c'),'as':_0xd43e('0x12')});db['OpenchannelMessage'][_0xd43e('0x14a')](db['CmContact'],{'onDelete':_0xd43e('0x10c'),'as':_0xd43e('0x15e')});db['OpenchannelMessage'][_0xd43e('0x14a')](db[_0xd43e('0x56')],{'onDelete':'cascade','as':_0xd43e('0x172'),'foreignKey':_0xd43e('0x18a')});db[_0xd43e('0x58')][_0xd43e('0x14a')](db[_0xd43e('0xe5')],{'as':_0xd43e('0xe5'),'foreignKey':_0xd43e('0x181')});db[_0xd43e('0x58')][_0xd43e('0x14a')](db[_0xd43e('0x52')],{'as':_0xd43e('0x173'),'foreignKey':_0xd43e('0x187')});db[_0xd43e('0x131')][_0xd43e('0x11c')](db[_0xd43e('0x12')],{'as':_0xd43e('0x152'),'through':_0xd43e('0x31'),'foreignKey':_0xd43e('0x188')});db[_0xd43e('0x131')][_0xd43e('0x11c')](db['Team'],{'through':_0xd43e('0x18c'),'as':'Teams'});db[_0xd43e('0x5b')]['hasMany'](db[_0xd43e('0x7b')],{'as':_0xd43e('0x179'),'foreignKey':_0xd43e('0x174'),'onDelete':_0xd43e('0x10c')});db[_0xd43e('0x5b')][_0xd43e('0x10f')](db['CannedAnswer'],{'as':_0xd43e('0x165'),'foreignKey':'ChatWebsiteId'});db[_0xd43e('0x5b')][_0xd43e('0x10f')](db[_0xd43e('0x18d')],{'as':_0xd43e('0x18e')});db[_0xd43e('0x5b')][_0xd43e('0x10f')](db['ChatInteraction'],{'as':_0xd43e('0x17b')});db['ChatWebsite'][_0xd43e('0x10f')](db['ChatApplication'],{'as':_0xd43e('0x13f')});db[_0xd43e('0x5b')][_0xd43e('0x10f')](db[_0xd43e('0x62')],{'as':_0xd43e('0x156')});db['ChatWebsite'][_0xd43e('0x14a')](db['CmList'],{'as':_0xd43e('0x167'),'foreignKey':'ListId'});db[_0xd43e('0x5b')]['belongsTo'](db[_0xd43e('0x7e')],{'as':_0xd43e('0x7e'),'foreignKey':_0xd43e('0x189')});db[_0xd43e('0x5b')]['belongsTo'](db[_0xd43e('0x37')],{'as':'MailAccount','foreignKey':_0xd43e('0x160')});db[_0xd43e('0x5b')][_0xd43e('0x14a')](db[_0xd43e('0x80')],{'as':_0xd43e('0x14f'),'foreignKey':_0xd43e('0x150')});db[_0xd43e('0x5b')][_0xd43e('0x11c')](db[_0xd43e('0x12')],{'as':_0xd43e('0x152'),'through':_0xd43e('0x136')});db[_0xd43e('0x5d')][_0xd43e('0x14a')](db[_0xd43e('0x52')],{});db['OpenchannelQueueReport'][_0xd43e('0x14a')](db[_0xd43e('0xef')],{'as':_0xd43e('0x167'),'foreignKey':_0xd43e('0x168')});db['OpenchannelQueueReport'][_0xd43e('0x14a')](db['CmContact'],{'as':_0xd43e('0x15e'),'foreignKey':_0xd43e('0x15f')});db[_0xd43e('0x5d')]['belongsTo'](db[_0xd43e('0x56')],{});db[_0xd43e('0x5d')][_0xd43e('0x14a')](db['OpenchannelMessage'],{});db[_0xd43e('0x5d')][_0xd43e('0x14a')](db[_0xd43e('0x12')],{});db[_0xd43e('0x5d')][_0xd43e('0x14a')](db[_0xd43e('0x131')],{});db[_0xd43e('0x5e')][_0xd43e('0x14a')](db[_0xd43e('0x12')],{'as':_0xd43e('0x18f'),'foreignKey':_0xd43e('0x10d'),'onDelete':'restrict'});db[_0xd43e('0x5e')][_0xd43e('0x14a')](db[_0xd43e('0x66')],{'as':_0xd43e('0x190'),'foreignKey':_0xd43e('0x191'),'onDelete':_0xd43e('0x163')});db[_0xd43e('0x5e')][_0xd43e('0x14a')](db[_0xd43e('0x5b')],{'as':_0xd43e('0x192'),'foreignKey':_0xd43e('0x174'),'onDelete':_0xd43e('0x163')});db[_0xd43e('0x5e')][_0xd43e('0x14a')](db[_0xd43e('0x86')],{'onDelete':_0xd43e('0x163'),'foreignKey':_0xd43e('0x176')});db['ChatInteraction'][_0xd43e('0x10f')](db[_0xd43e('0x62')],{'as':'Messages','onDelete':_0xd43e('0x10c'),'foreignKey':_0xd43e('0x193')});db[_0xd43e('0x60')][_0xd43e('0x14a')](db['ChatWebsite'],{'as':_0xd43e('0x173'),'foreignKey':'ChatWebsiteId'});db[_0xd43e('0x60')][_0xd43e('0x14a')](db[_0xd43e('0x11f')],{'as':_0xd43e('0x15e'),'foreignKey':_0xd43e('0x15f')});db[_0xd43e('0x60')][_0xd43e('0x14a')](db[_0xd43e('0x12')],{'as':_0xd43e('0x16c'),'foreignKey':'UserId'});db['ChatInteraction'][_0xd43e('0x11c')](db['Tag'],{'through':_0xd43e('0x194'),'as':_0xd43e('0x16d')});db[_0xd43e('0x60')][_0xd43e('0x11c')](db[_0xd43e('0x86')],{'through':'chat_interaction_has_tags','as':_0xd43e('0x16f')});db[_0xd43e('0x60')][_0xd43e('0x11c')](db[_0xd43e('0x12')],{'as':'Users','through':_0xd43e('0x126'),'foreignKey':_0xd43e('0x193')});db[_0xd43e('0x62')][_0xd43e('0x14a')](db[_0xd43e('0x12')],{'onDelete':_0xd43e('0x10c'),'as':'User'});db['ChatMessage']['belongsTo'](db[_0xd43e('0x11f')],{'onDelete':'cascade','as':'Contact','foreignKey':_0xd43e('0x15f')});db[_0xd43e('0x62')][_0xd43e('0x14a')](db[_0xd43e('0x60')],{'onDelete':_0xd43e('0x10c'),'as':'Interaction','foreignKey':'ChatInteractionId'});db[_0xd43e('0x62')][_0xd43e('0x14a')](db[_0xd43e('0xe5')],{'as':_0xd43e('0xe5'),'foreignKey':'AttachmentId'});db[_0xd43e('0x62')][_0xd43e('0x14a')](db[_0xd43e('0x5b')],{'as':'Account','foreignKey':_0xd43e('0x174')});db['ChatOfflineMessage'][_0xd43e('0x10f')](db[_0xd43e('0xe5')],{'as':'Attachments','foreignKey':_0xd43e('0x175'),'onDelete':'cascade','hooks':!![]});db[_0xd43e('0x64')]['belongsTo'](db[_0xd43e('0x11f')],{'onDelete':_0xd43e('0x10c'),'as':_0xd43e('0x15e'),'foreignKey':'ContactId'});db[_0xd43e('0x64')][_0xd43e('0x14a')](db[_0xd43e('0x5b')],{'as':_0xd43e('0x173'),'foreignKey':'ChatWebsiteId'});db['ChatQueue'][_0xd43e('0x11c')](db[_0xd43e('0x12')],{'as':_0xd43e('0x152'),'through':_0xd43e('0x2b'),'hooks':!![]});db[_0xd43e('0x66')][_0xd43e('0x11c')](db['Team'],{'through':'team_has_chat_queues','as':_0xd43e('0x153')});db['ChatGroup'][_0xd43e('0x10f')](db[_0xd43e('0xce')],{'as':_0xd43e('0x156'),'foreignKey':_0xd43e('0x195'),'onDelete':'cascade'});db[_0xd43e('0x68')][_0xd43e('0x11c')](db[_0xd43e('0x12')],{'as':'Members','through':'chat_group_has_users'});db[_0xd43e('0x18d')][_0xd43e('0x14a')](db[_0xd43e('0x5b')],{'as':_0xd43e('0x192'),'foreignKey':_0xd43e('0x174')});db[_0xd43e('0x6a')][_0xd43e('0x10f')](db[_0xd43e('0x11f')],{'as':'Contacts','foreignKey':_0xd43e('0x196')});db[_0xd43e('0x11f')]['hasMany'](db[_0xd43e('0x197')],{'as':_0xd43e('0x198'),'foreignKey':_0xd43e('0x199')});db[_0xd43e('0x11f')][_0xd43e('0x10f')](db[_0xd43e('0x6d')],{'as':_0xd43e('0x143'),'foreignKey':_0xd43e('0x15f')});db[_0xd43e('0x11f')][_0xd43e('0x10f')](db[_0xd43e('0x71')],{'as':_0xd43e('0x144'),'foreignKey':'ContactId'});db[_0xd43e('0x11f')][_0xd43e('0x10f')](db[_0xd43e('0x146')],{'as':'HopperHistories','foreignKey':_0xd43e('0x15f')});db[_0xd43e('0x11f')][_0xd43e('0x10f')](db[_0xd43e('0x73')],{'as':'ReportAgentPreview','foreignKey':'ContactId'});db[_0xd43e('0x11f')][_0xd43e('0x10f')](db[_0xd43e('0x148')],{'as':_0xd43e('0x149'),'foreignKey':_0xd43e('0x15f')});db[_0xd43e('0x11f')][_0xd43e('0x10f')](db[_0xd43e('0x56')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0xd43e('0x163')});db[_0xd43e('0x11f')]['hasMany'](db[_0xd43e('0x60')],{'as':'ChatInteractions','foreignKey':_0xd43e('0x15f'),'onDelete':'restrict'});db['CmContact'][_0xd43e('0x10f')](db[_0xd43e('0x4e')],{'as':_0xd43e('0x115'),'foreignKey':_0xd43e('0x15f'),'onDelete':_0xd43e('0x163')});db[_0xd43e('0x11f')]['hasMany'](db['FaxInteraction'],{'as':_0xd43e('0x127'),'foreignKey':'ContactId','onDelete':_0xd43e('0x163')});db[_0xd43e('0x11f')]['hasMany'](db[_0xd43e('0x3c')],{'as':_0xd43e('0x117'),'foreignKey':'ContactId','onDelete':_0xd43e('0x163')});db[_0xd43e('0x11f')]['belongsTo'](db[_0xd43e('0x6a')],{'as':'Company','foreignKey':_0xd43e('0x196')});db[_0xd43e('0x11f')][_0xd43e('0x14a')](db['CmList'],{'as':_0xd43e('0x167'),'foreignKey':_0xd43e('0x168'),'onDelete':_0xd43e('0x10c')});db['CmContact'][_0xd43e('0x11c')](db[_0xd43e('0x12')],{'as':_0xd43e('0x170'),'through':'cm_user_has_contacts'});db[_0xd43e('0x11f')]['belongsToMany'](db[_0xd43e('0x86')],{'as':_0xd43e('0x16d'),'through':'cm_contact_has_tags'});db['CmContact'][_0xd43e('0x11c')](db['Tag'],{'through':'cm_contact_has_tags','as':_0xd43e('0x16f')});db[_0xd43e('0x6d')][_0xd43e('0x10f')](db['CmHopperAdditionalPhone'],{'as':'AdditionalPhones','foreignKey':_0xd43e('0x19a')});db['CmHopper'][_0xd43e('0x14a')](db['CmContact'],{'as':_0xd43e('0x15e'),'foreignKey':_0xd43e('0x15f'),'onDelete':_0xd43e('0x10c')});db[_0xd43e('0x6d')][_0xd43e('0x14a')](db[_0xd43e('0xef')],{'as':_0xd43e('0x167'),'foreignKey':'ListId','onDelete':_0xd43e('0x10c')});db[_0xd43e('0x6d')][_0xd43e('0x14a')](db['User'],{'as':_0xd43e('0x18f'),'foreignKey':_0xd43e('0x10d')});db['CmHopper']['belongsTo'](db[_0xd43e('0x12b')],{'as':_0xd43e('0x190'),'foreignKey':_0xd43e('0x145'),'onDelete':_0xd43e('0x10c')});db[_0xd43e('0x6d')][_0xd43e('0x14a')](db[_0xd43e('0xe2')],{'as':_0xd43e('0xe2'),'foreignKey':'CampaignId','onDelete':_0xd43e('0x10c')});db[_0xd43e('0x6d')][_0xd43e('0x14a')](db[_0xd43e('0x12')],{'as':_0xd43e('0x16c'),'foreignKey':_0xd43e('0x19b')});db[_0xd43e('0x6f')][_0xd43e('0x14a')](db[_0xd43e('0x11f')],{'as':_0xd43e('0x15e'),'foreignKey':_0xd43e('0x15f'),'onDelete':_0xd43e('0x10c')});db[_0xd43e('0x6f')]['belongsTo'](db['CmList'],{'as':_0xd43e('0x167'),'foreignKey':_0xd43e('0x168'),'onDelete':_0xd43e('0x10c')});db[_0xd43e('0x6f')][_0xd43e('0x14a')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0xd43e('0x145'),'onDelete':_0xd43e('0x10c')});db['CmHopperBlack'][_0xd43e('0x14a')](db[_0xd43e('0xe2')],{'as':'Campaign','foreignKey':_0xd43e('0x19c'),'onDelete':_0xd43e('0x10c')});db[_0xd43e('0x79')]['hasMany'](db[_0xd43e('0x7c')],{'as':{'plural':_0xd43e('0x19d'),'singular':'OneAll'},'foreignKey':_0xd43e('0x19e'),'onDelete':_0xd43e('0x10c'),'hooks':!![]});db[_0xd43e('0x79')][_0xd43e('0x10f')](db[_0xd43e('0x7c')],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':'cascade','hooks':!![]});db['Automation'][_0xd43e('0x10f')](db[_0xd43e('0x77')],{'as':_0xd43e('0x19f'),'foreignKey':_0xd43e('0x1a0'),'onDelete':'cascade','hooks':!![]});db[_0xd43e('0x7b')][_0xd43e('0x10f')](db[_0xd43e('0x7b')],{'as':'Dispositions','foreignKey':_0xd43e('0x1a1'),'onDelete':'cascade'});db[_0xd43e('0x7e')]['hasMany'](db['Interval'],{'as':_0xd43e('0x1a2'),'foreignKey':_0xd43e('0x189'),'onDelete':_0xd43e('0x10c'),'hooks':!![],'required':![]});db[_0xd43e('0x7e')][_0xd43e('0x10f')](db[_0xd43e('0x112')],{'as':'Extensions','foreignKey':_0xd43e('0x189'),'onDelete':_0xd43e('0x163')});db['Interval'][_0xd43e('0x10f')](db[_0xd43e('0x166')],{'as':'MailApplications','foreignKey':_0xd43e('0x189')});db[_0xd43e('0x7e')][_0xd43e('0x10f')](db['ChatApplication'],{'as':'ChatApplications','foreignKey':_0xd43e('0x189')});db[_0xd43e('0x7e')][_0xd43e('0x10f')](db['FaxApplication'],{'as':_0xd43e('0x1a3'),'foreignKey':'IntervalId'});db[_0xd43e('0x7e')]['hasMany'](db['SmsApplication'],{'as':_0xd43e('0x1a4'),'foreignKey':_0xd43e('0x189')});db[_0xd43e('0x84')][_0xd43e('0x14a')](db[_0xd43e('0x37')],{});db[_0xd43e('0x84')][_0xd43e('0x14a')](db[_0xd43e('0x96')],{'foreignKey':_0xd43e('0x1a5')});db[_0xd43e('0x84')][_0xd43e('0x14a')](db[_0xd43e('0x1a6')],{'foreignKey':_0xd43e('0x1a7')});db[_0xd43e('0x140')]['belongsToMany'](db[_0xd43e('0x18')],{'as':_0xd43e('0x1a8'),'through':_0xd43e('0x142'),'onDelete':_0xd43e('0x163')});db[_0xd43e('0x86')][_0xd43e('0x11c')](db[_0xd43e('0x11f')],{'through':'cm_contact_has_tags'});db['Tag'][_0xd43e('0x11c')](db[_0xd43e('0x60')],{'through':_0xd43e('0x194')});db[_0xd43e('0x86')][_0xd43e('0x11c')](db[_0xd43e('0x3c')],{'through':'mail_interaction_has_tags'});db[_0xd43e('0x86')][_0xd43e('0x11c')](db[_0xd43e('0x4e')],{'through':_0xd43e('0x185')});db[_0xd43e('0x86')][_0xd43e('0x11c')](db[_0xd43e('0x116')],{'through':_0xd43e('0x17f')});db[_0xd43e('0x86')]['belongsToMany'](db[_0xd43e('0x56')],{'through':_0xd43e('0x18b')});db[_0xd43e('0x86')][_0xd43e('0x11c')](db[_0xd43e('0xfb')],{'through':_0xd43e('0x1a9')});db[_0xd43e('0x197')][_0xd43e('0x14a')](db[_0xd43e('0x87')],{'as':_0xd43e('0x1aa'),'foreignKey':_0xd43e('0x1ab')});db[_0xd43e('0x8a')][_0xd43e('0x14a')](db[_0xd43e('0x6d')],{'as':_0xd43e('0x1ac'),'foreignKey':'CmHopperId'});db['CmContactHasItem'][_0xd43e('0x14a')](db[_0xd43e('0x11f')],{'as':_0xd43e('0x15e'),'foreignKey':'CmContactId'});db[_0xd43e('0x8d')][_0xd43e('0x10f')](db[_0xd43e('0x7c')],{'as':{'plural':_0xd43e('0x1ad'),'singular':_0xd43e('0x1ae')},'foreignKey':_0xd43e('0x1af'),'onDelete':_0xd43e('0x10c'),'hooks':!![]});db['Trigger'][_0xd43e('0x10f')](db[_0xd43e('0x7c')],{'as':{'plural':_0xd43e('0x1b0'),'singular':_0xd43e('0x1b1')},'foreignKey':_0xd43e('0x1b2'),'onDelete':'cascade','hooks':!![]});db[_0xd43e('0x8d')][_0xd43e('0x10f')](db[_0xd43e('0x77')],{'as':_0xd43e('0x19f'),'foreignKey':_0xd43e('0x1b3'),'onDelete':_0xd43e('0x10c'),'hooks':!![]});db[_0xd43e('0x1a6')][_0xd43e('0x10f')](db[_0xd43e('0x1b4')],{'as':_0xd43e('0x1b5'),'onDelete':_0xd43e('0x10c'),'foreignKey':_0xd43e('0x1a7'),'hooks':!![]});db['AnalyticDefaultReport'][_0xd43e('0x10f')](db[_0xd43e('0x1b4')],{'as':_0xd43e('0x1b5'),'onDelete':_0xd43e('0x10c'),'foreignKey':_0xd43e('0x1a5')});db[_0xd43e('0x1b6')][_0xd43e('0x10f')](db['AnalyticFieldReport'],{'as':_0xd43e('0x1b5'),'onDelete':_0xd43e('0x10c'),'foreignKey':_0xd43e('0x1b7')});db['AnalyticFieldReport'][_0xd43e('0x14a')](db[_0xd43e('0x1b6')],{'foreignKey':_0xd43e('0x1b7')});db[_0xd43e('0x9c')][_0xd43e('0x10f')](db[_0xd43e('0x9e')],{'as':_0xd43e('0x1b8'),'onDelete':_0xd43e('0x10c'),'foreignKey':_0xd43e('0x1b9')});db['SalesforceConfiguration'][_0xd43e('0x10f')](db['SalesforceField'],{'as':_0xd43e('0x1ba'),'onDelete':_0xd43e('0x10c'),'foreignKey':_0xd43e('0x1bb')});db['SalesforceConfiguration'][_0xd43e('0x10f')](db[_0xd43e('0xa0')],{'as':'Descriptions','onDelete':_0xd43e('0x10c'),'foreignKey':_0xd43e('0x1bc')});db[_0xd43e('0x9e')][_0xd43e('0x10f')](db[_0xd43e('0xa0')],{'as':_0xd43e('0x1b5'),'onDelete':_0xd43e('0x10c'),'foreignKey':_0xd43e('0x1bd')});db['SalesforceConfiguration'][_0xd43e('0x14a')](db['SalesforceAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0xd43e('0xa0')][_0xd43e('0x10f')](db[_0xd43e('0xa0')],{'as':_0xd43e('0x1be'),'foreignKey':_0xd43e('0x1bb')});db[_0xd43e('0xa0')]['hasMany'](db['SalesforceField'],{'as':'Description','foreignKey':_0xd43e('0x1bc')});db[_0xd43e('0xa0')]['hasMany'](db[_0xd43e('0xa0')],{'as':_0xd43e('0x1bf'),'foreignKey':_0xd43e('0x1bd')});db[_0xd43e('0xa0')]['belongsTo'](db['Variable'],{'as':_0xd43e('0x8f'),'foreignKey':_0xd43e('0x1c0')});db['SugarcrmAccount'][_0xd43e('0x10f')](db[_0xd43e('0xa4')],{'as':_0xd43e('0x1b8'),'onDelete':_0xd43e('0x10c'),'foreignKey':_0xd43e('0x1b9')});db[_0xd43e('0xa4')]['hasMany'](db['SugarcrmField'],{'as':'Subjects','onDelete':_0xd43e('0x10c'),'foreignKey':_0xd43e('0x1bb')});db[_0xd43e('0xa4')][_0xd43e('0x10f')](db['SugarcrmField'],{'as':'Descriptions','onDelete':_0xd43e('0x10c'),'foreignKey':_0xd43e('0x1bc')});db[_0xd43e('0xa4')][_0xd43e('0x10f')](db[_0xd43e('0xa6')],{'as':_0xd43e('0x1b5'),'onDelete':_0xd43e('0x10c'),'foreignKey':'FieldId'});db['SugarcrmConfiguration'][_0xd43e('0x14a')](db[_0xd43e('0xa2')],{'as':'Account','foreignKey':_0xd43e('0x1b9')});db['SugarcrmField'][_0xd43e('0x10f')](db['SugarcrmField'],{'as':_0xd43e('0x1be'),'foreignKey':_0xd43e('0x1bb')});db['SugarcrmField'][_0xd43e('0x10f')](db[_0xd43e('0xa6')],{'as':_0xd43e('0x1c1'),'foreignKey':_0xd43e('0x1bc')});db[_0xd43e('0xa6')][_0xd43e('0x10f')](db[_0xd43e('0xa6')],{'as':'Field','foreignKey':_0xd43e('0x1bd')});db[_0xd43e('0xa6')][_0xd43e('0x14a')](db[_0xd43e('0x8f')],{'as':'Variable','foreignKey':_0xd43e('0x1c0')});db[_0xd43e('0x1c2')][_0xd43e('0x10f')](db['DeskConfiguration'],{'as':_0xd43e('0x1b8'),'onDelete':_0xd43e('0x10c'),'foreignKey':_0xd43e('0x1b9')});db['DeskConfiguration']['hasMany'](db[_0xd43e('0x1c3')],{'as':_0xd43e('0x1ba'),'onDelete':_0xd43e('0x10c'),'foreignKey':'SubjectId'});db[_0xd43e('0x1c4')]['hasMany'](db['DeskField'],{'as':'Descriptions','onDelete':_0xd43e('0x10c'),'foreignKey':'DescriptionId'});db[_0xd43e('0x1c4')][_0xd43e('0x10f')](db[_0xd43e('0x1c3')],{'as':_0xd43e('0x1b5'),'onDelete':'cascade','foreignKey':_0xd43e('0x1bd')});db[_0xd43e('0x1c4')][_0xd43e('0x14a')](db[_0xd43e('0x1c2')],{'as':_0xd43e('0x173'),'foreignKey':'AccountId'});db[_0xd43e('0x1c4')][_0xd43e('0x11c')](db[_0xd43e('0x86')],{'through':_0xd43e('0x1c5')});db['DeskField']['hasMany'](db['DeskField'],{'as':'Subject','foreignKey':'SubjectId'});db['DeskField']['hasMany'](db[_0xd43e('0x1c3')],{'as':_0xd43e('0x1c1'),'foreignKey':_0xd43e('0x1bc')});db[_0xd43e('0x1c3')][_0xd43e('0x10f')](db['DeskField'],{'as':_0xd43e('0x1bf'),'foreignKey':_0xd43e('0x1bd')});db[_0xd43e('0x1c3')]['belongsTo'](db[_0xd43e('0x8f')],{'as':'Variable','foreignKey':_0xd43e('0x1c0')});db[_0xd43e('0xab')][_0xd43e('0x10f')](db[_0xd43e('0x1c6')],{'as':_0xd43e('0x1b8'),'onDelete':_0xd43e('0x10c'),'foreignKey':_0xd43e('0x1b9')});db[_0xd43e('0x1c6')]['hasMany'](db[_0xd43e('0xad')],{'as':_0xd43e('0x1ba'),'onDelete':'cascade','foreignKey':'SubjectId'});db['ZohoConfiguration'][_0xd43e('0x10f')](db[_0xd43e('0xad')],{'as':_0xd43e('0x1c7'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xd43e('0x1c6')]['hasMany'](db[_0xd43e('0xad')],{'as':_0xd43e('0x1b5'),'onDelete':_0xd43e('0x10c'),'foreignKey':_0xd43e('0x1bd')});db[_0xd43e('0x1c6')][_0xd43e('0x14a')](db['ZohoAccount'],{'as':_0xd43e('0x173'),'foreignKey':_0xd43e('0x1b9')});db[_0xd43e('0xad')][_0xd43e('0x10f')](db['ZohoField'],{'as':_0xd43e('0x1be'),'foreignKey':_0xd43e('0x1bb')});db[_0xd43e('0xad')][_0xd43e('0x10f')](db[_0xd43e('0xad')],{'as':'Description','foreignKey':_0xd43e('0x1bc')});db[_0xd43e('0xad')][_0xd43e('0x10f')](db['ZohoField'],{'as':_0xd43e('0x1bf'),'foreignKey':_0xd43e('0x1bd')});db[_0xd43e('0xad')][_0xd43e('0x14a')](db['Variable'],{'as':_0xd43e('0x8f'),'foreignKey':_0xd43e('0x1c0')});db[_0xd43e('0xae')][_0xd43e('0x10f')](db[_0xd43e('0xaf')],{'as':_0xd43e('0x1b8'),'onDelete':'cascade','foreignKey':_0xd43e('0x1b9')});db[_0xd43e('0xaf')][_0xd43e('0x10f')](db[_0xd43e('0xb0')],{'as':'Subjects','foreignKey':_0xd43e('0x1bb')});db['ZendeskConfiguration'][_0xd43e('0x10f')](db[_0xd43e('0xb0')],{'as':_0xd43e('0x1c7'),'foreignKey':'DescriptionId'});db[_0xd43e('0xaf')]['hasMany'](db['ZendeskField'],{'as':_0xd43e('0x1b5'),'foreignKey':_0xd43e('0x1bd')});db[_0xd43e('0xaf')][_0xd43e('0x14a')](db[_0xd43e('0xae')],{'as':'Account','foreignKey':_0xd43e('0x1b9')});db[_0xd43e('0xaf')][_0xd43e('0x11c')](db[_0xd43e('0x86')],{'through':'int_zendesk_configuration_has_tags'});db[_0xd43e('0xb0')][_0xd43e('0x10f')](db['ZendeskField'],{'as':_0xd43e('0x1be'),'foreignKey':_0xd43e('0x1bb')});db[_0xd43e('0xb0')][_0xd43e('0x10f')](db[_0xd43e('0xb0')],{'as':_0xd43e('0x1c1'),'foreignKey':_0xd43e('0x1bc')});db[_0xd43e('0xb0')][_0xd43e('0x10f')](db[_0xd43e('0xb0')],{'as':'Field','foreignKey':_0xd43e('0x1bd')});db['ZendeskField'][_0xd43e('0x14a')](db[_0xd43e('0x8f')],{'as':_0xd43e('0x8f'),'foreignKey':_0xd43e('0x1c0')});db[_0xd43e('0x1c8')][_0xd43e('0x10f')](db[_0xd43e('0xb3')],{'as':_0xd43e('0x1b8'),'onDelete':'cascade','foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0xd43e('0x10f')](db[_0xd43e('0xb5')],{'as':'Subjects','onDelete':_0xd43e('0x10c'),'foreignKey':_0xd43e('0x1bb')});db['FreshdeskConfiguration'][_0xd43e('0x10f')](db[_0xd43e('0xb5')],{'as':'Descriptions','onDelete':_0xd43e('0x10c'),'foreignKey':'DescriptionId'});db['FreshdeskConfiguration'][_0xd43e('0x10f')](db[_0xd43e('0xb5')],{'as':_0xd43e('0x1b5'),'onDelete':_0xd43e('0x10c'),'foreignKey':_0xd43e('0x1bd')});db[_0xd43e('0xb3')][_0xd43e('0x14a')](db[_0xd43e('0x1c8')],{'as':_0xd43e('0x173'),'foreignKey':_0xd43e('0x1b9')});db['FreshdeskConfiguration'][_0xd43e('0x11c')](db[_0xd43e('0x86')],{'through':'int_freshdesk_configuration_has_tags'});db[_0xd43e('0xb5')][_0xd43e('0x10f')](db[_0xd43e('0xb5')],{'as':_0xd43e('0x1be'),'foreignKey':_0xd43e('0x1bb')});db[_0xd43e('0xb5')]['hasMany'](db[_0xd43e('0xb5')],{'as':_0xd43e('0x1c1'),'foreignKey':_0xd43e('0x1bc')});db[_0xd43e('0xb5')][_0xd43e('0x10f')](db['FreshdeskField'],{'as':_0xd43e('0x1bf'),'foreignKey':_0xd43e('0x1bd')});db['FreshdeskField'][_0xd43e('0x14a')](db[_0xd43e('0x8f')],{'as':_0xd43e('0x8f'),'foreignKey':_0xd43e('0x1c0')});db[_0xd43e('0xb7')]['hasMany'](db['VtigerConfiguration'],{'as':'Configurations','onDelete':_0xd43e('0x10c'),'foreignKey':_0xd43e('0x1b9')});db['VtigerConfiguration'][_0xd43e('0x10f')](db['VtigerField'],{'as':_0xd43e('0x1ba'),'foreignKey':_0xd43e('0x1bb')});db['VtigerConfiguration']['hasMany'](db[_0xd43e('0xbb')],{'as':_0xd43e('0x1c7'),'foreignKey':_0xd43e('0x1bc')});db[_0xd43e('0xb9')][_0xd43e('0x10f')](db[_0xd43e('0xbb')],{'as':_0xd43e('0x1b5'),'foreignKey':'FieldId'});db[_0xd43e('0xb9')][_0xd43e('0x14a')](db['VtigerAccount'],{'as':'Account','foreignKey':_0xd43e('0x1b9')});db[_0xd43e('0xbb')]['hasMany'](db['VtigerField'],{'as':'Subject','foreignKey':_0xd43e('0x1bb')});db[_0xd43e('0xbb')][_0xd43e('0x10f')](db[_0xd43e('0xbb')],{'as':_0xd43e('0x1c1'),'foreignKey':'DescriptionId'});db[_0xd43e('0xbb')]['hasMany'](db['VtigerField'],{'as':_0xd43e('0x1bf'),'foreignKey':_0xd43e('0x1bd')});db['VtigerField'][_0xd43e('0x14a')](db[_0xd43e('0x8f')],{'as':'Variable','foreignKey':_0xd43e('0x1c0')});db['ServicenowAccount'][_0xd43e('0x10f')](db[_0xd43e('0xbe')],{'as':_0xd43e('0x1b8'),'onDelete':_0xd43e('0x10c'),'foreignKey':'AccountId'});db['ServicenowConfiguration'][_0xd43e('0x10f')](db[_0xd43e('0xc0')],{'as':_0xd43e('0x1ba'),'foreignKey':_0xd43e('0x1bb')});db[_0xd43e('0xbe')][_0xd43e('0x10f')](db[_0xd43e('0xc0')],{'as':'Descriptions','foreignKey':_0xd43e('0x1bc')});db[_0xd43e('0xbe')]['hasMany'](db['ServicenowField'],{'as':_0xd43e('0x1b5'),'foreignKey':'FieldId'});db['ServicenowConfiguration'][_0xd43e('0x14a')](db['ServicenowAccount'],{'as':_0xd43e('0x173'),'foreignKey':_0xd43e('0x1b9')});db[_0xd43e('0xc0')][_0xd43e('0x10f')](db[_0xd43e('0xc0')],{'as':_0xd43e('0x1be'),'foreignKey':_0xd43e('0x1bb')});db['ServicenowField'][_0xd43e('0x10f')](db[_0xd43e('0xc0')],{'as':_0xd43e('0x1c1'),'foreignKey':_0xd43e('0x1bc')});db['ServicenowField'][_0xd43e('0x10f')](db[_0xd43e('0xc0')],{'as':'Field','foreignKey':_0xd43e('0x1bd')});db[_0xd43e('0xc0')]['belongsTo'](db[_0xd43e('0x8f')],{'as':_0xd43e('0x8f'),'foreignKey':_0xd43e('0x1c0')});db['Dynamics365Account'][_0xd43e('0x10f')](db[_0xd43e('0x1c9')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db['Dynamics365Account'][_0xd43e('0x14a')](db['CloudProvider'],{'as':_0xd43e('0x103'),'foreignKey':_0xd43e('0x161')});db[_0xd43e('0x1c9')][_0xd43e('0x10f')](db[_0xd43e('0x1ca')],{'as':'Subjects','onDelete':_0xd43e('0x10c'),'foreignKey':_0xd43e('0x1bb')});db['Dynamics365Configuration'][_0xd43e('0x10f')](db['Dynamics365Field'],{'as':_0xd43e('0x1c7'),'onDelete':_0xd43e('0x10c'),'foreignKey':_0xd43e('0x1bc')});db[_0xd43e('0x1c9')][_0xd43e('0x10f')](db['Dynamics365Field'],{'as':_0xd43e('0x1b5'),'onDelete':'cascade','foreignKey':'FieldId'});db['Dynamics365Configuration'][_0xd43e('0x14a')](db[_0xd43e('0xc2')],{'as':'Account','foreignKey':_0xd43e('0x1b9')});db[_0xd43e('0x1ca')][_0xd43e('0x10f')](db[_0xd43e('0x1ca')],{'as':'Subject','foreignKey':_0xd43e('0x1bb')});db[_0xd43e('0x1ca')][_0xd43e('0x10f')](db[_0xd43e('0x1ca')],{'as':_0xd43e('0x1c1'),'foreignKey':_0xd43e('0x1bc')});db[_0xd43e('0x1ca')]['hasMany'](db[_0xd43e('0x1ca')],{'as':_0xd43e('0x1bf'),'foreignKey':_0xd43e('0x1bd')});db[_0xd43e('0x1ca')]['belongsTo'](db[_0xd43e('0x8f')],{'as':_0xd43e('0x8f'),'foreignKey':_0xd43e('0x1c0')});db[_0xd43e('0x1cb')][_0xd43e('0x10f')](db[_0xd43e('0xc7')],{'as':_0xd43e('0x1b8'),'onDelete':_0xd43e('0x10c'),'foreignKey':_0xd43e('0x1b9')});db['FreshsalesConfiguration']['hasMany'](db['FreshsalesField'],{'as':_0xd43e('0x1ba'),'foreignKey':_0xd43e('0x1bb')});db['FreshsalesConfiguration']['hasMany'](db[_0xd43e('0xc8')],{'as':_0xd43e('0x1c7'),'foreignKey':_0xd43e('0x1bc')});db['FreshsalesConfiguration'][_0xd43e('0x10f')](db[_0xd43e('0xc8')],{'as':'Fields','foreignKey':_0xd43e('0x1bd')});db['FreshsalesConfiguration']['belongsTo'](db[_0xd43e('0x1cb')],{'as':_0xd43e('0x173'),'foreignKey':_0xd43e('0x1b9')});db['FreshsalesField'][_0xd43e('0x10f')](db['FreshsalesField'],{'as':_0xd43e('0x1be'),'foreignKey':_0xd43e('0x1bb')});db[_0xd43e('0xc8')][_0xd43e('0x10f')](db[_0xd43e('0xc8')],{'as':'Description','foreignKey':_0xd43e('0x1bc')});db['FreshsalesField'][_0xd43e('0x10f')](db['FreshsalesField'],{'as':_0xd43e('0x1bf'),'foreignKey':_0xd43e('0x1bd')});db[_0xd43e('0xc8')][_0xd43e('0x14a')](db[_0xd43e('0x8f')],{'as':_0xd43e('0x8f'),'foreignKey':_0xd43e('0x1c0')});db[_0xd43e('0xcc')][_0xd43e('0x14a')](db[_0xd43e('0x5b')],{});db[_0xd43e('0xcc')]['belongsTo'](db[_0xd43e('0xef')],{'as':'List','foreignKey':_0xd43e('0x168')});db['ChatQueueReport'][_0xd43e('0x14a')](db[_0xd43e('0x11f')],{'as':_0xd43e('0x15e'),'foreignKey':_0xd43e('0x15f')});db[_0xd43e('0xcc')][_0xd43e('0x14a')](db[_0xd43e('0x60')],{});db[_0xd43e('0xcc')][_0xd43e('0x14a')](db[_0xd43e('0x62')],{});db['ChatQueueReport'][_0xd43e('0x14a')](db['User'],{});db[_0xd43e('0xcc')][_0xd43e('0x14a')](db[_0xd43e('0x66')],{});db[_0xd43e('0xce')][_0xd43e('0x14a')](db['User'],{'onDelete':_0xd43e('0x10c'),'foreignKey':_0xd43e('0x1cc')});db[_0xd43e('0xce')][_0xd43e('0x14a')](db[_0xd43e('0x12')],{'onDelete':_0xd43e('0x10c'),'foreignKey':_0xd43e('0x1cd')});db[_0xd43e('0x148')][_0xd43e('0x10f')](db[_0xd43e('0xd1')],{'foreignKey':_0xd43e('0x1ce'),'onDelete':_0xd43e('0x10c')});db[_0xd43e('0x148')][_0xd43e('0x10f')](db[_0xd43e('0xcf')],{'foreignKey':_0xd43e('0x1ce'),'onDelete':'cascade'});db['SmsQueueReport'][_0xd43e('0x14a')](db[_0xd43e('0x4b')],{});db[_0xd43e('0xd3')]['belongsTo'](db[_0xd43e('0xef')],{'as':'List','foreignKey':_0xd43e('0x168')});db['SmsQueueReport'][_0xd43e('0x14a')](db[_0xd43e('0x11f')],{'as':_0xd43e('0x15e'),'foreignKey':_0xd43e('0x15f')});db['SmsQueueReport'][_0xd43e('0x14a')](db['SmsInteraction'],{});db[_0xd43e('0xd3')][_0xd43e('0x14a')](db[_0xd43e('0x4f')],{});db[_0xd43e('0xd3')]['belongsTo'](db[_0xd43e('0x12')],{});db[_0xd43e('0xd3')]['belongsTo'](db[_0xd43e('0x50')],{});db[_0xd43e('0xd6')][_0xd43e('0x10f')](db[_0xd43e('0x148')],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0xd43e('0x10f')](db[_0xd43e('0xd1')],{'foreignKey':'ProjectId'});db[_0xd43e('0xd6')][_0xd43e('0x10f')](db[_0xd43e('0xcf')],{'foreignKey':_0xd43e('0x1cf')});db[_0xd43e('0xdf')][_0xd43e('0x11c')](db['User'],{'as':'Agents','through':'user_has_teams'});db[_0xd43e('0xdf')][_0xd43e('0x11c')](db['VoiceQueue'],{'through':_0xd43e('0x105'),'as':'VoiceQueues'});db['Team']['belongsToMany'](db[_0xd43e('0x39')],{'through':_0xd43e('0x16a'),'as':_0xd43e('0x1d0')});db[_0xd43e('0xdf')]['belongsToMany'](db[_0xd43e('0x66')],{'through':'team_has_chat_queues','as':'ChatQueues'});db[_0xd43e('0xdf')][_0xd43e('0x11c')](db['FaxQueue'],{'through':'team_has_fax_queues','as':_0xd43e('0x1d1')});db['Team'][_0xd43e('0x11c')](db[_0xd43e('0x50')],{'through':'team_has_sms_queues','as':_0xd43e('0x130')});db[_0xd43e('0xdf')][_0xd43e('0x11c')](db[_0xd43e('0x131')],{'through':_0xd43e('0x18c'),'as':_0xd43e('0x132')});db['Team']['belongsToMany'](db['WhatsappQueue'],{'through':_0xd43e('0x1d2'),'as':_0xd43e('0x134')});db[_0xd43e('0xdf')][_0xd43e('0x11c')](db[_0xd43e('0x1d3')],{'through':_0xd43e('0x107'),'as':'VoicePrefixes'});db[_0xd43e('0xe2')][_0xd43e('0x10f')](db[_0xd43e('0x6d')],{'as':_0xd43e('0x143'),'foreignKey':_0xd43e('0x19c')});db[_0xd43e('0xe2')][_0xd43e('0x10f')](db[_0xd43e('0x71')],{'as':'HopperFinals','foreignKey':'CampaignId'});db[_0xd43e('0xe2')][_0xd43e('0x10f')](db[_0xd43e('0x146')],{'as':_0xd43e('0x147'),'foreignKey':'CampaignId'});db[_0xd43e('0xe2')]['hasMany'](db[_0xd43e('0x6f')],{'as':_0xd43e('0x1d4'),'foreignKey':'CampaignId'});db[_0xd43e('0xe2')][_0xd43e('0x14a')](db[_0xd43e('0x14b')],{'as':'Trunk','foreignKey':_0xd43e('0x14c')});db['Campaign'][_0xd43e('0x14a')](db[_0xd43e('0x14b')],{'as':_0xd43e('0x14d'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0xd43e('0x14a')](db[_0xd43e('0x7e')],{'as':_0xd43e('0x7e'),'foreignKey':_0xd43e('0x189')});db[_0xd43e('0xe2')]['belongsTo'](db[_0xd43e('0xdb')],{'as':'SquareProject','foreignKey':_0xd43e('0x1d5')});db[_0xd43e('0xe2')][_0xd43e('0x11c')](db[_0xd43e('0xef')],{'as':_0xd43e('0x122'),'through':'campaigns_has_cm_lists'});db[_0xd43e('0xe2')][_0xd43e('0x11c')](db[_0xd43e('0xef')],{'as':_0xd43e('0x154'),'through':_0xd43e('0x1d6')});db[_0xd43e('0xe5')][_0xd43e('0x14a')](db[_0xd43e('0x64')],{'as':_0xd43e('0x64'),'foreignKey':_0xd43e('0x175')});db[_0xd43e('0xe8')][_0xd43e('0x14a')](db[_0xd43e('0x3d')],{});db[_0xd43e('0xe8')][_0xd43e('0x14a')](db[_0xd43e('0x3c')],{});db[_0xd43e('0xe8')][_0xd43e('0x14a')](db[_0xd43e('0x37')],{'foreignKey':_0xd43e('0x1d7'),'as':'FromAccount'});db['MailTransferReport'][_0xd43e('0x14a')](db[_0xd43e('0x12')],{'foreignKey':_0xd43e('0x1d8'),'as':_0xd43e('0x1d9')});db[_0xd43e('0xe8')][_0xd43e('0x14a')](db[_0xd43e('0x12')],{'foreignKey':'ToUserId','as':_0xd43e('0x1da')});db[_0xd43e('0xe8')]['belongsTo'](db[_0xd43e('0x39')],{'foreignKey':_0xd43e('0x1db'),'as':_0xd43e('0x1dc')});db[_0xd43e('0xe8')][_0xd43e('0x14a')](db[_0xd43e('0x37')],{'foreignKey':_0xd43e('0x1dd'),'as':_0xd43e('0x1de')});db[_0xd43e('0xea')][_0xd43e('0x14a')](db[_0xd43e('0x62')],{});db[_0xd43e('0xea')]['belongsTo'](db[_0xd43e('0x60')],{});db[_0xd43e('0xea')][_0xd43e('0x14a')](db[_0xd43e('0x5b')],{'foreignKey':_0xd43e('0x1df'),'as':'FromAccount'});db[_0xd43e('0xea')][_0xd43e('0x14a')](db['User'],{'foreignKey':'FromUserId','as':_0xd43e('0x1d9')});db[_0xd43e('0xea')][_0xd43e('0x14a')](db[_0xd43e('0x12')],{'foreignKey':_0xd43e('0x1e0'),'as':'ToAgent'});db['ChatTransferReport'][_0xd43e('0x14a')](db['ChatQueue'],{'foreignKey':_0xd43e('0x1e1'),'as':_0xd43e('0x1dc')});db[_0xd43e('0xea')][_0xd43e('0x14a')](db[_0xd43e('0x5b')],{'foreignKey':_0xd43e('0x1e2'),'as':'ToAccount'});db[_0xd43e('0xeb')][_0xd43e('0x14a')](db[_0xd43e('0x17d')],{});db[_0xd43e('0xeb')][_0xd43e('0x14a')](db[_0xd43e('0x116')],{});db[_0xd43e('0xeb')]['belongsTo'](db[_0xd43e('0x43')],{'foreignKey':_0xd43e('0x1e3'),'as':_0xd43e('0x1e4')});db[_0xd43e('0xeb')][_0xd43e('0x14a')](db[_0xd43e('0x12')],{'foreignKey':'FromUserId','as':_0xd43e('0x1d9')});db[_0xd43e('0xeb')][_0xd43e('0x14a')](db[_0xd43e('0x12')],{'foreignKey':_0xd43e('0x1e0'),'as':'ToAgent'});db[_0xd43e('0xeb')]['belongsTo'](db[_0xd43e('0x48')],{'foreignKey':_0xd43e('0x1e5'),'as':'ToQueue'});db['FaxTransferReport'][_0xd43e('0x14a')](db[_0xd43e('0x43')],{'foreignKey':_0xd43e('0x1e6'),'as':_0xd43e('0x1de')});db[_0xd43e('0x1e7')][_0xd43e('0x14a')](db['OpenchannelMessage'],{});db['OpenchannelTransferReport'][_0xd43e('0x14a')](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0xd43e('0x14a')](db['OpenchannelAccount'],{'foreignKey':_0xd43e('0x1e8'),'as':'FromAccount'});db[_0xd43e('0x1e7')]['belongsTo'](db[_0xd43e('0x12')],{'foreignKey':_0xd43e('0x1d8'),'as':_0xd43e('0x1d9')});db[_0xd43e('0x1e7')][_0xd43e('0x14a')](db[_0xd43e('0x12')],{'foreignKey':'ToUserId','as':'ToAgent'});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelQueue'],{'foreignKey':_0xd43e('0x1e9'),'as':_0xd43e('0x1dc')});db[_0xd43e('0x1e7')][_0xd43e('0x14a')](db[_0xd43e('0x52')],{'foreignKey':_0xd43e('0x1ea'),'as':'ToAccount'});db[_0xd43e('0xed')][_0xd43e('0x14a')](db[_0xd43e('0x4f')],{});db[_0xd43e('0xed')]['belongsTo'](db[_0xd43e('0x4e')],{});db[_0xd43e('0xed')]['belongsTo'](db[_0xd43e('0x4b')],{'foreignKey':_0xd43e('0x1eb'),'as':_0xd43e('0x1e4')});db['SmsTransferReport'][_0xd43e('0x14a')](db[_0xd43e('0x12')],{'foreignKey':_0xd43e('0x1d8'),'as':'FromAgent'});db['SmsTransferReport']['belongsTo'](db[_0xd43e('0x12')],{'foreignKey':'ToUserId','as':'ToAgent'});db['SmsTransferReport'][_0xd43e('0x14a')](db[_0xd43e('0x50')],{'foreignKey':'ToSmsQueueId','as':_0xd43e('0x1dc')});db[_0xd43e('0xed')][_0xd43e('0x14a')](db['SmsAccount'],{'foreignKey':_0xd43e('0x1ec'),'as':_0xd43e('0x1de')});db[_0xd43e('0xef')][_0xd43e('0x10f')](db[_0xd43e('0x7b')],{'as':_0xd43e('0x179'),'foreignKey':_0xd43e('0x168'),'onDelete':_0xd43e('0x10c')});db['CmList'][_0xd43e('0x10f')](db[_0xd43e('0x75')],{'as':_0xd43e('0x1ed'),'foreignKey':'ListId'});db[_0xd43e('0xef')][_0xd43e('0x10f')](db['CmContact'],{'as':_0xd43e('0x120'),'onDelete':_0xd43e('0x10c'),'foreignKey':_0xd43e('0x168')});db[_0xd43e('0xef')][_0xd43e('0x10f')](db[_0xd43e('0x71')],{'as':'HopperFinals','foreignKey':_0xd43e('0x168')});db[_0xd43e('0xef')]['hasMany'](db['CmHopperHistory'],{'as':_0xd43e('0x113'),'foreignKey':_0xd43e('0x168')});db[_0xd43e('0xef')][_0xd43e('0x10f')](db[_0xd43e('0x73')],{'as':'ReportAgentPreview','foreignKey':'ListId'});db[_0xd43e('0xef')][_0xd43e('0x11c')](db[_0xd43e('0x12b')],{'as':_0xd43e('0x1ee'),'through':_0xd43e('0x151')});db[_0xd43e('0xef')]['belongsToMany'](db[_0xd43e('0x12')],{'as':_0xd43e('0x152'),'through':_0xd43e('0x123')});db[_0xd43e('0x1d3')][_0xd43e('0x10f')](db[_0xd43e('0x112')],{'as':_0xd43e('0x1ef'),'onDelete':'cascade'});db['VoicePrefix'][_0xd43e('0x11c')](db[_0xd43e('0x12')],{'as':_0xd43e('0x152'),'through':_0xd43e('0x1f0')});db[_0xd43e('0x1d3')][_0xd43e('0x11c')](db[_0xd43e('0xdf')],{'through':_0xd43e('0x107'),'as':_0xd43e('0x153')});db[_0xd43e('0xf2')][_0xd43e('0x10f')](db[_0xd43e('0x12')],{'as':'Users','foreignKey':_0xd43e('0x11b')});db[_0xd43e('0xf2')][_0xd43e('0x10f')](db[_0xd43e('0xf3')],{'as':_0xd43e('0x1f1'),'foreignKey':_0xd43e('0x11b'),'onDelete':_0xd43e('0x10c')});db[_0xd43e('0xf3')]['hasMany'](db[_0xd43e('0x1f2')],{'as':_0xd43e('0x1f3'),'foreignKey':_0xd43e('0x1f4'),'onDelete':_0xd43e('0x10c')});db[_0xd43e('0xf7')][_0xd43e('0x10f')](db[_0xd43e('0x7b')],{'as':_0xd43e('0x179'),'foreignKey':_0xd43e('0x1f5'),'onDelete':_0xd43e('0x10c')});db[_0xd43e('0xf7')][_0xd43e('0x10f')](db[_0xd43e('0x7a')],{'as':_0xd43e('0x165'),'foreignKey':'WhatsappAccountId'});db[_0xd43e('0xf7')]['hasMany'](db[_0xd43e('0xfd')],{'as':_0xd43e('0x156'),'foreignKey':_0xd43e('0x1f5')});db[_0xd43e('0xf7')][_0xd43e('0x10f')](db['WhatsappInteraction'],{'as':_0xd43e('0x17b')});db[_0xd43e('0xf7')]['hasMany'](db[_0xd43e('0xf9')],{'as':_0xd43e('0x13f')});db[_0xd43e('0xf7')][_0xd43e('0x14a')](db[_0xd43e('0xef')],{'as':_0xd43e('0x167'),'foreignKey':'ListId'});db[_0xd43e('0xf7')][_0xd43e('0x14a')](db[_0xd43e('0x80')],{'as':_0xd43e('0x14f'),'foreignKey':'mandatoryDispositionPauseId'});db['WhatsappAccount'][_0xd43e('0x11c')](db['User'],{'as':_0xd43e('0x152'),'through':_0xd43e('0x1f6')});db[_0xd43e('0xf9')][_0xd43e('0x14a')](db[_0xd43e('0x12')],{'onDelete':'restrict'});db[_0xd43e('0xf9')][_0xd43e('0x14a')](db['WhatsappQueue'],{'onDelete':_0xd43e('0x163')});db[_0xd43e('0xf9')][_0xd43e('0x14a')](db[_0xd43e('0xf7')],{'onDelete':_0xd43e('0x163')});db[_0xd43e('0xf9')]['belongsTo'](db[_0xd43e('0x7e')],{'onDelete':_0xd43e('0x163'),'foreignKey':_0xd43e('0x189')});db[_0xd43e('0xf9')][_0xd43e('0x14a')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xd43e('0x176')});db[_0xd43e('0xfb')][_0xd43e('0x10f')](db[_0xd43e('0xfd')],{'as':'Messages','onDelete':_0xd43e('0x10c'),'foreignKey':_0xd43e('0x1f7')});db[_0xd43e('0xfb')][_0xd43e('0x14a')](db['WhatsappAccount'],{'as':_0xd43e('0x173'),'foreignKey':_0xd43e('0x1f5')});db[_0xd43e('0xfb')][_0xd43e('0x14a')](db[_0xd43e('0x11f')],{'as':_0xd43e('0x15e'),'foreignKey':_0xd43e('0x15f')});db[_0xd43e('0xfb')][_0xd43e('0x14a')](db[_0xd43e('0x12')],{'as':_0xd43e('0x16c'),'foreignKey':_0xd43e('0x10d')});db[_0xd43e('0xfb')]['belongsToMany'](db[_0xd43e('0x86')],{'through':'whatsapp_interaction_has_tags','as':_0xd43e('0x16d')});db[_0xd43e('0xfb')]['belongsToMany'](db['Tag'],{'through':_0xd43e('0x1a9'),'as':_0xd43e('0x16f')});db[_0xd43e('0xfb')]['belongsToMany'](db['User'],{'as':'Users','through':'user_has_whatsapp_interactions','foreignKey':'WhatsappInteractionId'});db[_0xd43e('0xfd')][_0xd43e('0x14a')](db['User'],{'as':_0xd43e('0x12')});db['WhatsappMessage'][_0xd43e('0x14a')](db[_0xd43e('0x11f')],{'onDelete':'cascade','as':_0xd43e('0x15e')});db['WhatsappMessage'][_0xd43e('0x14a')](db[_0xd43e('0xfb')],{'onDelete':_0xd43e('0x10c'),'as':_0xd43e('0x172'),'foreignKey':_0xd43e('0x1f7')});db[_0xd43e('0xfd')]['belongsTo'](db[_0xd43e('0xf7')],{'as':_0xd43e('0x173'),'foreignKey':_0xd43e('0x1f5')});db['WhatsappQueueReport'][_0xd43e('0x14a')](db['WhatsappAccount'],{});db['WhatsappQueueReport'][_0xd43e('0x14a')](db[_0xd43e('0xef')],{'as':_0xd43e('0x167'),'foreignKey':'ListId'});db[_0xd43e('0xff')][_0xd43e('0x14a')](db[_0xd43e('0x11f')],{'as':'Contact','foreignKey':_0xd43e('0x15f')});db[_0xd43e('0xff')][_0xd43e('0x14a')](db[_0xd43e('0xfb')],{});db[_0xd43e('0xff')]['belongsTo'](db[_0xd43e('0x133')],{});db[_0xd43e('0xff')]['belongsTo'](db[_0xd43e('0xfd')],{});db[_0xd43e('0xff')][_0xd43e('0x14a')](db[_0xd43e('0x12')],{});db[_0xd43e('0x100')]['belongsTo'](db[_0xd43e('0xfd')],{});db[_0xd43e('0x100')]['belongsTo'](db['WhatsappInteraction'],{});db[_0xd43e('0x100')][_0xd43e('0x14a')](db[_0xd43e('0xf7')],{'foreignKey':_0xd43e('0x1f8'),'as':_0xd43e('0x1e4')});db['WhatsappTransferReport'][_0xd43e('0x14a')](db[_0xd43e('0xf7')],{'foreignKey':_0xd43e('0x1f9'),'as':_0xd43e('0x1de')});db[_0xd43e('0x100')][_0xd43e('0x14a')](db[_0xd43e('0x133')],{'foreignKey':'ToQueueId','as':_0xd43e('0x1dc')});db['WhatsappTransferReport'][_0xd43e('0x14a')](db['User'],{'foreignKey':_0xd43e('0x1d8'),'as':_0xd43e('0x1d9')});db['WhatsappTransferReport'][_0xd43e('0x14a')](db['User'],{'foreignKey':_0xd43e('0x1e0'),'as':_0xd43e('0x1da')});db['WhatsappQueue']['belongsToMany'](db[_0xd43e('0x12')],{'as':'Agents','through':_0xd43e('0x32'),'foreignKey':_0xd43e('0x1fa')});db[_0xd43e('0x133')][_0xd43e('0x11c')](db[_0xd43e('0xdf')],{'through':_0xd43e('0x1d2'),'as':_0xd43e('0x153')});db['UserSetting'][_0xd43e('0x14a')](db[_0xd43e('0x12')],{'as':_0xd43e('0x1fb'),'foreignKey':_0xd43e('0x10d'),'onDelete':_0xd43e('0x10c'),'hooks':!![]});db[_0xd43e('0x103')][_0xd43e('0x10b')](db[_0xd43e('0xc2')],{'as':_0xd43e('0xc2'),'onDelete':_0xd43e('0x163')});db[_0xd43e('0x103')][_0xd43e('0x10b')](db[_0xd43e('0x34')],{'as':_0xd43e('0x1fc'),'onDelete':'restrict'});db['CloudProvider']['hasOne'](db[_0xd43e('0x162')],{'as':'Smtp','onDelete':_0xd43e('0x163')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xe899=['VoiceQueues','UserVoiceQueue','MailQueues','ChatQueue','UserFaxQueue','SmsQueue','SmsQueues','WhatsappQueues','UserWhatsappQueue','cm_user_has_lists','ChatWebsite','ChatWebsites','FaxAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','SpiedAgents','ChanSpyId','VoiceContext','Applications','moh_has_sounds','VoiceQueueId','HopperBlacks','TrunkId','TrunkBackupId','IntervalId','Pause','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceQueueReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','ContactId','MailAccountId','CloudProvider','CloudProviderId','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','TemplateId','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','team_has_mail_queues','MailInteractionId','Account','Contact','Owner','mail_interaction_has_tags','Tags','Users','Attachment','Attachments','ChatOfflineMessageId','TagId','ListId','Items','FaxAccountId','Exntensions','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','ThroughTags','Interaction','AttachmentId','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','UserOpenchannelQueue','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','user_has_chat_websites','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','Members','chat_group_has_users','Website','CompanyId','Phones','Hoppers','HopperHistories','FaxInteractions','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','Campaign','CampaignId','OwnerId','All','AutomationAllId','Any','OneAny','AutomationAnyId','Intervals','MailApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','whatsapp_interaction_has_tags','ItemType','ItemTypeId','CmHopperAdditionalPhone','Hopper','CmContactId','Trigger','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','AnalyticFieldReport','Fields','AnalyticMetric','MetricId','SalesforceAccount','SalesforceConfiguration','Configurations','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','AccountId','Subject','Description','Variable','VariableId','SugarcrmConfiguration','SugarcrmField','Field','DeskConfiguration','ZendeskField','ServicenowAccount','ServicenowField','FreshsalesConfiguration','FreshsalesAccount','FromId','ToId','SessionId','ProjectId','FaxQueues','team_has_sms_queues','OpenchannelQueues','VoicePrefixes','TrunkBackup','SquareProject','Lists','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','ToChatQueueId','ToQueue','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToUserId','ToOpenchannelQueueId','ToSmsQueueId','ToSmsAccountId','CustomFields','HopperHistory','Queues','voice_queues_has_cm_lists','Extensions','userProfileId','UserProfileSections','UserProfileSection','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappMessage','WhatsappInteractionId','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','user','exports','../config/environment','sequelize','lodash','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','database','username','password','options','../api/user/user.model','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','Tag','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/trigger/trigger.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','../api/user-setting/user-setting.model','User','UserId','hasOne','UserSetting','cascade','hasMany','Recordings','VoiceQueuesRt','CmHopperFinal','HopperFinals','CmHopperHistory','OpenchannelInteractions','ChatInteraction','SmsInteractions','FaxInteraction','MailInteractions','WhatsappInteractions','belongsTo','belongsToMany','cm_user_has_contacts','user_has_teams','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions'];(function(_0x59ea2c,_0x106c69){var _0xf25149=function(_0xc13aee){while(--_0xc13aee){_0x59ea2c['push'](_0x59ea2c['shift']());}};_0xf25149(++_0x106c69);}(_0xe899,0xda));var _0x9e89=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xe899[_0x3e5086];return _0xfeb102;};'use strict';var config=require(_0x9e89('0x0'));var Sequelize=require(_0x9e89('0x1'));var _=require(_0x9e89('0x2'));var jstz=require('jstz');var timezone=jstz[_0x9e89('0x3')]();config['sequelize']=_[_0x9e89('0x4')](config[_0x9e89('0x1')],{'database':_0x9e89('0x5'),'username':_0x9e89('0x6'),'password':_0x9e89('0x7'),'options':{'host':_0x9e89('0x8'),'port':0xcea,'dialect':_0x9e89('0x9'),'dialectOptions':{'charset':_0x9e89('0xa')},'logging':![],'timezone':timezone[_0x9e89('0xb')](),'define':{'charset':_0x9e89('0xc'),'collate':_0x9e89('0xd')}}});config[_0x9e89('0xe')]=_['defaultsDeep'](config[_0x9e89('0xe')],{'database':'motion2','username':_0x9e89('0x6'),'password':_0x9e89('0x7'),'options':{'host':_0x9e89('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x9e89('0xa')},'logging':![],'timezone':timezone[_0x9e89('0xb')](),'define':{'charset':'utf8','collate':_0x9e89('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x9e89('0xf')],config[_0x9e89('0x1')][_0x9e89('0x10')],config['sequelize'][_0x9e89('0x11')],config['sequelize']['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9e89('0xe')]['database'],config[_0x9e89('0xe')]['username'],config[_0x9e89('0xe')][_0x9e89('0x11')],config[_0x9e89('0xe')][_0x9e89('0x12')])};db['User']=db[_0x9e89('0x1')]['import'](_0x9e89('0x13'));db[_0x9e89('0x14')]=db['sequelize'][_0x9e89('0x15')](_0x9e89('0x16'));db['VoiceContext']=db['sequelize'][_0x9e89('0x15')]('../api/voiceContext/voiceContext.model');db[_0x9e89('0x17')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x18'));db[_0x9e89('0x19')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x1a'));db[_0x9e89('0x1b')]=db[_0x9e89('0x1')]['import'](_0x9e89('0x1c'));db[_0x9e89('0x1d')]=db[_0x9e89('0x1')]['import'](_0x9e89('0x1e'));db[_0x9e89('0x1f')]=db[_0x9e89('0x1')][_0x9e89('0x15')]('../api/screenRecording/screenRecording.model');db[_0x9e89('0x20')]=db['sequelize']['import'](_0x9e89('0x21'));db[_0x9e89('0x22')]=db['sequelize'][_0x9e89('0x15')](_0x9e89('0x23'));db[_0x9e89('0x24')]=db[_0x9e89('0x1')]['import'](_0x9e89('0x25'));db[_0x9e89('0x26')]=db[_0x9e89('0x1')]['import'](_0x9e89('0x27'));db['VoiceAgentReport']=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x28'));db['VoiceQueueReport']=db[_0x9e89('0x1')]['import'](_0x9e89('0x29'));db[_0x9e89('0x2a')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x2b'));db[_0x9e89('0x2c')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x2d'));db['VoiceTransferReport']=db['sequelize'][_0x9e89('0x15')](_0x9e89('0x2e'));db[_0x9e89('0x2f')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x30'));db['UserVoiceQueue']=db[_0x9e89('0x1')][_0x9e89('0x15')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x9e89('0x31')]=db[_0x9e89('0x1')]['import'](_0x9e89('0x32'));db[_0x9e89('0x33')]=db['sequelize']['import'](_0x9e89('0x34'));db['UserFaxQueue']=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x35'));db[_0x9e89('0x36')]=db[_0x9e89('0x1')][_0x9e89('0x15')]('../api/userSmsQueue/userSmsQueue.model');db['UserOpenchannelQueue']=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x37'));db['UserWhatsappQueue']=db[_0x9e89('0x1')]['import']('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x9e89('0x38')]=db['sequelize'][_0x9e89('0x15')]('../api/mailServerIn/mailServerIn.model');db[_0x9e89('0x39')]=db['sequelize']['import'](_0x9e89('0x3a'));db[_0x9e89('0x3b')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x3c'));db[_0x9e89('0x3d')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x3e'));db[_0x9e89('0x3f')]=db['sequelize'][_0x9e89('0x15')]('../api/mailSubstatus/mailSubstatus.model');db[_0x9e89('0x40')]=db['sequelize'][_0x9e89('0x15')](_0x9e89('0x41'));db[_0x9e89('0x42')]=db['sequelize'][_0x9e89('0x15')](_0x9e89('0x43'));db['MailApplication']=db[_0x9e89('0x1')]['import'](_0x9e89('0x44'));db[_0x9e89('0x45')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x46'));db[_0x9e89('0x47')]=db['sequelize'][_0x9e89('0x15')](_0x9e89('0x48'));db[_0x9e89('0x49')]=db[_0x9e89('0x1')][_0x9e89('0x15')]('../api/dashboardItem/dashboardItem.model');db[_0x9e89('0x4a')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x4b'));db[_0x9e89('0x4c')]=db['sequelize'][_0x9e89('0x15')](_0x9e89('0x4d'));db['FaxInteraction']=db[_0x9e89('0x1')][_0x9e89('0x15')]('../api/faxInteraction/faxInteraction.model');db[_0x9e89('0x4e')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x4f'));db[_0x9e89('0x50')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x51'));db[_0x9e89('0x52')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x53'));db[_0x9e89('0x54')]=db[_0x9e89('0x1')][_0x9e89('0x15')]('../api/smsAccount/smsAccount.model');db[_0x9e89('0x55')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x56'));db[_0x9e89('0x57')]=db['sequelize'][_0x9e89('0x15')]('../api/smsInteraction/smsInteraction.model');db[_0x9e89('0x58')]=db[_0x9e89('0x1')][_0x9e89('0x15')]('../api/smsMessage/smsMessage.model');db['SmsQueue']=db[_0x9e89('0x1')]['import'](_0x9e89('0x59'));db[_0x9e89('0x5a')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x5b'));db[_0x9e89('0x5c')]=db[_0x9e89('0x1')][_0x9e89('0x15')]('../api/openchannelApplication/openchannelApplication.model');db[_0x9e89('0x5d')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x5e'));db[_0x9e89('0x5f')]=db[_0x9e89('0x1')][_0x9e89('0x15')]('../api/openchannelMessage/openchannelMessage.model');db[_0x9e89('0x60')]=db['sequelize'][_0x9e89('0x15')](_0x9e89('0x61'));db['ChatWebsite']=db[_0x9e89('0x1')][_0x9e89('0x15')]('../api/chatWebsite/chatWebsite.model');db[_0x9e89('0x62')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x63'));db[_0x9e89('0x64')]=db[_0x9e89('0x1')][_0x9e89('0x15')]('../api/chatApplication/chatApplication.model');db['ChatInteraction']=db[_0x9e89('0x1')]['import'](_0x9e89('0x65'));db[_0x9e89('0x66')]=db['sequelize']['import'](_0x9e89('0x67'));db[_0x9e89('0x68')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x69'));db['ChatQueue']=db['sequelize']['import'](_0x9e89('0x6a'));db[_0x9e89('0x6b')]=db[_0x9e89('0x1')][_0x9e89('0x15')]('../api/chatGroup/chatGroup.model');db[_0x9e89('0x6c')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x6d'));db[_0x9e89('0x6e')]=db[_0x9e89('0x1')][_0x9e89('0x15')]('../api/cmCompany/cmCompany.model');db[_0x9e89('0x6f')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x70'));db[_0x9e89('0x71')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x72'));db[_0x9e89('0x73')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x74'));db['CmHopperFinal']=db[_0x9e89('0x1')]['import'](_0x9e89('0x75'));db['CmHopperHistory']=db['sequelize'][_0x9e89('0x15')](_0x9e89('0x76'));db[_0x9e89('0x77')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x78'));db[_0x9e89('0x79')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x7a'));db[_0x9e89('0x7b')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x7c'));db[_0x9e89('0x7d')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x7e'));db[_0x9e89('0x7f')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x80'));db['Disposition']=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x81'));db[_0x9e89('0x82')]=db[_0x9e89('0x1')][_0x9e89('0x15')]('../api/condition/condition.model');db[_0x9e89('0x83')]=db['sequelize']['import'](_0x9e89('0x84'));db['Pause']=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x85'));db['Cdr']=db[_0x9e89('0x1')]['import'](_0x9e89('0x86'));db[_0x9e89('0x87')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x88'));db[_0x9e89('0x89')]=db['sequelize'][_0x9e89('0x15')](_0x9e89('0x8a'));db[_0x9e89('0x8b')]=db[_0x9e89('0x1')][_0x9e89('0x15')]('../api/sound/sound.model');db[_0x9e89('0x8c')]=db[_0x9e89('0x1')]['import']('../api/tag/tag.model');db[_0x9e89('0x8d')]=db['sequelize'][_0x9e89('0x15')](_0x9e89('0x8e'));db[_0x9e89('0x8f')]=db[_0x9e89('0x1')]['import'](_0x9e89('0x90'));db['CmHopperAdditionalPhone']=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x91'));db[_0x9e89('0x92')]=db[_0x9e89('0x1')][_0x9e89('0x15')]('../api/template/template.model');db['Trigger']=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x93'));db['Variable']=db[_0x9e89('0x1')]['import']('../api/variable/variable.model');db[_0x9e89('0x94')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x95'));db[_0x9e89('0x96')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x97'));db[_0x9e89('0x98')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x99'));db[_0x9e89('0x9a')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x9b'));db['AnalyticExtractedReport']=db[_0x9e89('0x1')]['import'](_0x9e89('0x9c'));db['AnalyticMetric']=db['sequelize']['import'](_0x9e89('0x9d'));db['AnalyticFieldReport']=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x9e'));db['AnalyticTreeReport']=db[_0x9e89('0x1')]['import'](_0x9e89('0x9f'));db['SalesforceAccount']=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0xa0'));db['SalesforceConfiguration']=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0xa1'));db[_0x9e89('0xa2')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0xa3'));db[_0x9e89('0xa4')]=db[_0x9e89('0x1')]['import']('../api/intSugarcrmAccount/intSugarcrmAccount.model');db['SugarcrmConfiguration']=db[_0x9e89('0x1')][_0x9e89('0x15')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db['SugarcrmField']=db[_0x9e89('0x1')]['import'](_0x9e89('0xa5'));db[_0x9e89('0xa6')]=db['sequelize'][_0x9e89('0x15')](_0x9e89('0xa7'));db['DeskConfiguration']=db['sequelize'][_0x9e89('0x15')](_0x9e89('0xa8'));db[_0x9e89('0xa9')]=db[_0x9e89('0x1')][_0x9e89('0x15')]('../api/intDeskField/intDeskField.model');db[_0x9e89('0xaa')]=db[_0x9e89('0x1')]['import'](_0x9e89('0xab'));db[_0x9e89('0xac')]=db['sequelize'][_0x9e89('0x15')](_0x9e89('0xad'));db[_0x9e89('0xae')]=db[_0x9e89('0x1')][_0x9e89('0x15')]('../api/intZohoField/intZohoField.model');db[_0x9e89('0xaf')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0xb0'));db[_0x9e89('0xb1')]=db['sequelize'][_0x9e89('0x15')](_0x9e89('0xb2'));db['ZendeskField']=db[_0x9e89('0x1')]['import']('../api/intZendeskField/intZendeskField.model');db[_0x9e89('0xb3')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0xb4'));db[_0x9e89('0xb5')]=db['sequelize'][_0x9e89('0x15')](_0x9e89('0xb6'));db[_0x9e89('0xb7')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0xb8'));db[_0x9e89('0xb9')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0xba'));db[_0x9e89('0xbb')]=db['sequelize'][_0x9e89('0x15')](_0x9e89('0xbc'));db[_0x9e89('0xbd')]=db['sequelize'][_0x9e89('0x15')]('../api/intVtigerField/intVtigerField.model');db['ServicenowAccount']=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0xbe'));db[_0x9e89('0xbf')]=db['sequelize'][_0x9e89('0x15')](_0x9e89('0xc0'));db['ServicenowField']=db[_0x9e89('0x1')]['import'](_0x9e89('0xc1'));db[_0x9e89('0xc2')]=db['sequelize']['import'](_0x9e89('0xc3'));db[_0x9e89('0xc4')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0xc5'));db[_0x9e89('0xc6')]=db['sequelize'][_0x9e89('0x15')](_0x9e89('0xc7'));db['FreshsalesAccount']=db[_0x9e89('0x1')]['import'](_0x9e89('0xc8'));db['FreshsalesConfiguration']=db[_0x9e89('0x1')]['import'](_0x9e89('0xc9'));db[_0x9e89('0xca')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0xcb'));db[_0x9e89('0x94')]=db['sequelize'][_0x9e89('0x15')](_0x9e89('0x95'));db[_0x9e89('0xcc')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0xcd'));db[_0x9e89('0xce')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0xcf'));db[_0x9e89('0xd0')]=db[_0x9e89('0x1')][_0x9e89('0x15')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x9e89('0xd1')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0xd2'));db[_0x9e89('0xd3')]=db['sequelize'][_0x9e89('0x15')](_0x9e89('0xd4'));db[_0x9e89('0xd5')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0xd6'));db[_0x9e89('0xd7')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0xd8'));db['SquareReport']=db[_0x9e89('0x1')]['import'](_0x9e89('0xd9'));db[_0x9e89('0xda')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0xdb'));db[_0x9e89('0xdc')]=db[_0x9e89('0x1')][_0x9e89('0x15')]('../api/jscriptyProject/jscriptyProject.model');db['Setting']=db[_0x9e89('0x1')][_0x9e89('0x15')]('../api/setting/setting.model');db[_0x9e89('0xdd')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0xde'));db['SquareProject']=db['sequelize'][_0x9e89('0x15')]('../api/squareProject/squareProject.model');db[_0x9e89('0xdf')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0xe0'));db[_0x9e89('0xe1')]=db[_0x9e89('0x1')]['import']('../api/squareMessage/squareMessage.model');db[_0x9e89('0xe2')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0xe3'));db[_0x9e89('0xe4')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0xe5'));db['Campaign']=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0xe6'));db[_0x9e89('0xe7')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0xe8'));db['Attachment']=db[_0x9e89('0x1')]['import'](_0x9e89('0xe9'));db[_0x9e89('0xea')]=db[_0x9e89('0x1')]['import'](_0x9e89('0xeb'));db[_0x9e89('0xec')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0xed'));db['ChatTransferReport']=db[_0x9e89('0x1')][_0x9e89('0x15')]('../api/chatTransferReport/chatTransferReport.model');db[_0x9e89('0xee')]=db[_0x9e89('0x1')]['import'](_0x9e89('0xef'));db[_0x9e89('0xf0')]=db[_0x9e89('0x1')][_0x9e89('0x15')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x9e89('0xf1')]=db['sequelize'][_0x9e89('0x15')](_0x9e89('0xf2'));db[_0x9e89('0xf3')]=db['sequelize'][_0x9e89('0x15')](_0x9e89('0xf4'));db[_0x9e89('0xf5')]=db['sequelize'][_0x9e89('0x15')](_0x9e89('0xf6'));db[_0x9e89('0xf7')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0xf8'));db['UserProfileSection']=db['sequelize']['import']('../api/userProfileSection/userProfileSection.model');db['UserProfileResource']=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0xf9'));db[_0x9e89('0xfa')]=db[_0x9e89('0x1')]['import'](_0x9e89('0xfb'));db[_0x9e89('0xfc')]=db[_0x9e89('0x1')][_0x9e89('0x15')]('../api/whatsappAccount/whatsappAccount.model');db[_0x9e89('0xfd')]=db[_0x9e89('0x1')]['import'](_0x9e89('0xfe'));db[_0x9e89('0xff')]=db[_0x9e89('0x1')][_0x9e89('0x15')]('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x100'));db[_0x9e89('0x101')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x102'));db[_0x9e89('0x103')]=db['sequelize']['import'](_0x9e89('0x104'));db[_0x9e89('0x105')]=db['sequelize'][_0x9e89('0x15')]('../api/whatsappQueue/whatsappQueue.model');db['CloudProvider']=db[_0x9e89('0x1')]['import'](_0x9e89('0x106'));db[_0x9e89('0x107')]=db[_0x9e89('0x1')][_0x9e89('0x15')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x9e89('0x108')]=db[_0x9e89('0x1')]['import'](_0x9e89('0x109'));db[_0x9e89('0x10a')]=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x10b'));db['UserSetting']=db[_0x9e89('0x1')][_0x9e89('0x15')](_0x9e89('0x10c'));db[_0x9e89('0x10d')]['hasOne'](db[_0x9e89('0x20')],{'as':_0x9e89('0x20'),'onDelete':'cascade','foreignKey':_0x9e89('0x10e')});db[_0x9e89('0x10d')][_0x9e89('0x10f')](db[_0x9e89('0x110')],{'as':'userSetting','onDelete':_0x9e89('0x111'),'foreignKey':_0x9e89('0x10e')});db['User'][_0x9e89('0x112')](db[_0x9e89('0x1d')],{'as':_0x9e89('0x113'),'foreignKey':_0x9e89('0x10e')});db[_0x9e89('0x10d')][_0x9e89('0x112')](db[_0x9e89('0x2f')],{'as':_0x9e89('0x114'),'foreignKey':'UserId'});db[_0x9e89('0x10d')][_0x9e89('0x112')](db[_0x9e89('0x17')],{'as':'Extensions','onDelete':_0x9e89('0x111'),'hooks':!![]});db[_0x9e89('0x10d')][_0x9e89('0x112')](db[_0x9e89('0x115')],{'as':_0x9e89('0x116'),'foreignKey':_0x9e89('0x10e')});db[_0x9e89('0x10d')][_0x9e89('0x112')](db[_0x9e89('0x117')],{'as':'HopperHistory','foreignKey':_0x9e89('0x10e')});db[_0x9e89('0x10d')][_0x9e89('0x112')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x9e89('0x10e')});db[_0x9e89('0x10d')][_0x9e89('0x112')](db[_0x9e89('0x5d')],{'as':_0x9e89('0x118'),'foreignKey':_0x9e89('0x10e')});db[_0x9e89('0x10d')][_0x9e89('0x112')](db[_0x9e89('0x119')],{'as':'ChatInteractions','foreignKey':_0x9e89('0x10e')});db[_0x9e89('0x10d')][_0x9e89('0x112')](db['SmsInteraction'],{'as':_0x9e89('0x11a'),'foreignKey':_0x9e89('0x10e')});db[_0x9e89('0x10d')]['hasMany'](db[_0x9e89('0x11b')],{'as':'FaxInteractions','foreignKey':_0x9e89('0x10e')});db[_0x9e89('0x10d')][_0x9e89('0x112')](db[_0x9e89('0x40')],{'as':_0x9e89('0x11c'),'foreignKey':_0x9e89('0x10e')});db[_0x9e89('0x10d')][_0x9e89('0x112')](db[_0x9e89('0xff')],{'as':_0x9e89('0x11d'),'foreignKey':_0x9e89('0x10e')});db['User'][_0x9e89('0x112')](db[_0x9e89('0xfa')],{'as':'UserNotifications','foreignKey':'SenderId'});db[_0x9e89('0x10d')][_0x9e89('0x11e')](db[_0x9e89('0xf7')],{'as':'UserProfile','foreignKey':'userProfileId'});db[_0x9e89('0x10d')]['belongsToMany'](db[_0x9e89('0x6b')],{'as':'Groups','through':'chat_group_has_users'});db[_0x9e89('0x10d')][_0x9e89('0x11f')](db[_0x9e89('0x6f')],{'as':'Contacts','through':_0x9e89('0x120')});db[_0x9e89('0x10d')]['belongsToMany'](db[_0x9e89('0xf3')],{'as':'Lists','through':'cm_user_has_lists'});db[_0x9e89('0x10d')]['belongsToMany'](db[_0x9e89('0xe2')],{'through':_0x9e89('0x121')});db[_0x9e89('0x10d')][_0x9e89('0x11f')](db[_0x9e89('0x40')],{'as':_0x9e89('0x11c'),'through':_0x9e89('0x122')});db['User']['belongsToMany'](db['ChatInteraction'],{'as':_0x9e89('0x123'),'through':_0x9e89('0x124')});db[_0x9e89('0x10d')][_0x9e89('0x11f')](db[_0x9e89('0x11b')],{'as':'FaxInteractions','through':_0x9e89('0x125')});db[_0x9e89('0x10d')]['belongsToMany'](db['SmsInteraction'],{'as':_0x9e89('0x11a'),'through':_0x9e89('0x126')});db['User']['belongsToMany'](db[_0x9e89('0x5d')],{'as':'OpenchannelInteractions','through':_0x9e89('0x127')});db[_0x9e89('0x10d')][_0x9e89('0x11f')](db[_0x9e89('0xff')],{'as':'WhatsappInteractions','through':_0x9e89('0x128')});db[_0x9e89('0x10d')][_0x9e89('0x11f')](db[_0x9e89('0x1b')],{'as':_0x9e89('0x129'),'through':_0x9e89('0x12a'),'required':![]});db[_0x9e89('0x10d')][_0x9e89('0x11f')](db[_0x9e89('0xf5')],{'as':'VoicePrefixes','through':_0x9e89('0x10a'),'required':![]});db[_0x9e89('0x10d')][_0x9e89('0x11f')](db[_0x9e89('0x3d')],{'as':_0x9e89('0x12b'),'through':_0x9e89('0x33'),'required':![]});db[_0x9e89('0x10d')][_0x9e89('0x11f')](db[_0x9e89('0x12c')],{'as':'ChatQueues','through':_0x9e89('0x31'),'required':![],'hooks':!![]});db['User'][_0x9e89('0x11f')](db['FaxQueue'],{'as':'FaxQueues','through':_0x9e89('0x12d'),'required':![]});db[_0x9e89('0x10d')][_0x9e89('0x11f')](db[_0x9e89('0x12e')],{'as':_0x9e89('0x12f'),'through':_0x9e89('0x36'),'required':![]});db['User'][_0x9e89('0x11f')](db[_0x9e89('0x60')],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db['User'][_0x9e89('0x11f')](db[_0x9e89('0x105')],{'as':_0x9e89('0x130'),'through':_0x9e89('0x131'),'required':![]});db[_0x9e89('0x10d')][_0x9e89('0x11f')](db[_0x9e89('0xf3')],{'through':_0x9e89('0x132')});db[_0x9e89('0x10d')][_0x9e89('0x11f')](db[_0x9e89('0x133')],{'as':_0x9e89('0x134'),'through':'user_has_chat_websites'});db['User'][_0x9e89('0x11f')](db[_0x9e89('0x4a')],{'as':_0x9e89('0x135'),'through':'user_has_fax_accounts'});db[_0x9e89('0x10d')][_0x9e89('0x11f')](db[_0x9e89('0x3b')],{'as':'MailAccounts','through':_0x9e89('0x136')});db[_0x9e89('0x10d')][_0x9e89('0x11f')](db['OpenchannelAccount'],{'as':_0x9e89('0x137'),'through':_0x9e89('0x138')});db[_0x9e89('0x10d')][_0x9e89('0x11f')](db['SmsAccount'],{'as':_0x9e89('0x139'),'through':_0x9e89('0x13a')});db[_0x9e89('0x10d')][_0x9e89('0x11f')](db[_0x9e89('0xfc')],{'as':_0x9e89('0x13b'),'through':'user_has_whatsapp_accounts'});db[_0x9e89('0x14')][_0x9e89('0x112')](db[_0x9e89('0x17')],{'as':_0x9e89('0x13c'),'onDelete':'cascade','foreignKey':_0x9e89('0x13d')});db[_0x9e89('0x13e')]['hasMany'](db[_0x9e89('0x17')],{'onDelete':_0x9e89('0x111')});db[_0x9e89('0x17')]['hasMany'](db['VoiceExtension'],{'as':_0x9e89('0x13f'),'onDelete':_0x9e89('0x111')});db[_0x9e89('0x19')]['belongsToMany'](db[_0x9e89('0x8b')],{'as':'Sounds','through':_0x9e89('0x140')});db[_0x9e89('0x1b')]['hasMany'](db[_0x9e89('0x2f')],{'as':'Members','foreignKey':_0x9e89('0x141')});db[_0x9e89('0x1b')][_0x9e89('0x112')](db[_0x9e89('0x71')],{'as':'Hoppers','foreignKey':'VoiceQueueId'});db[_0x9e89('0x1b')]['hasMany'](db[_0x9e89('0x115')],{'as':_0x9e89('0x116'),'foreignKey':_0x9e89('0x141')});db[_0x9e89('0x1b')]['hasMany'](db[_0x9e89('0x117')],{'as':'HopperHistories','foreignKey':_0x9e89('0x141')});db[_0x9e89('0x1b')][_0x9e89('0x112')](db[_0x9e89('0x77')],{'as':'ReportAgentPreview','foreignKey':_0x9e89('0x141')});db[_0x9e89('0x1b')][_0x9e89('0x112')](db['CmHopperBlack'],{'as':_0x9e89('0x142'),'foreignKey':_0x9e89('0x141')});db[_0x9e89('0x1b')][_0x9e89('0x112')](db[_0x9e89('0xd5')],{'as':'JscriptySessions','foreignKey':'VoiceQueueId'});db[_0x9e89('0x1b')][_0x9e89('0x11e')](db[_0x9e89('0x2c')],{'as':_0x9e89('0x2c'),'foreignKey':_0x9e89('0x143')});db[_0x9e89('0x1b')][_0x9e89('0x11e')](db[_0x9e89('0x2c')],{'as':'TrunkBackup','foreignKey':_0x9e89('0x144')});db[_0x9e89('0x1b')][_0x9e89('0x11e')](db[_0x9e89('0x83')],{'as':_0x9e89('0x83'),'foreignKey':_0x9e89('0x145')});db[_0x9e89('0x1b')][_0x9e89('0x11e')](db[_0x9e89('0x146')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x9e89('0x1b')][_0x9e89('0x11f')](db[_0x9e89('0xf3')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db['VoiceQueue'][_0x9e89('0x11f')](db[_0x9e89('0x10d')],{'as':'Agents','through':'UserVoiceQueue'});db['VoiceQueue'][_0x9e89('0x11f')](db['Team'],{'as':_0x9e89('0x147'),'through':_0x9e89('0x107')});db[_0x9e89('0x1b')][_0x9e89('0x11f')](db[_0x9e89('0xf3')],{'as':_0x9e89('0x148'),'through':_0x9e89('0x149')});db['VoiceRecording'][_0x9e89('0x11e')](db['User'],{'as':_0x9e89('0x10d'),'foreignKey':_0x9e89('0x10e')});db[_0x9e89('0x1f')][_0x9e89('0x11e')](db[_0x9e89('0x10d')],{'as':'User','foreignKey':_0x9e89('0x10e')});db['VoiceMail']['hasMany'](db['VoiceMailMessage'],{'as':_0x9e89('0x14a'),'onDelete':'cascade','foreignKey':_0x9e89('0x14b'),'sourceKey':_0x9e89('0x14c')});db[_0x9e89('0x22')]['belongsTo'](db[_0x9e89('0x20')],{'foreignKey':_0x9e89('0x14b'),'targetKey':_0x9e89('0x14c')});db[_0x9e89('0x24')]['hasMany'](db[_0x9e89('0x14d')],{'as':_0x9e89('0x14e'),'foreignKey':_0x9e89('0x14f'),'constraints':![]});db[_0x9e89('0x24')]['hasMany'](db[_0x9e89('0x150')],{'as':_0x9e89('0x151'),'foreignKey':'uniqueid','constraints':![]});db[_0x9e89('0x24')][_0x9e89('0x11e')](db[_0x9e89('0x10d')],{'as':_0x9e89('0x10d'),'foreignKey':'UserId'});db[_0x9e89('0x24')][_0x9e89('0x11e')](db[_0x9e89('0x6f')],{'as':'Contact','foreignKey':_0x9e89('0x152')});db[_0x9e89('0x38')][_0x9e89('0x11e')](db[_0x9e89('0x3b')],{'as':_0x9e89('0x3b'),'foreignKey':_0x9e89('0x153')});db[_0x9e89('0x38')][_0x9e89('0x11e')](db[_0x9e89('0x154')],{'as':_0x9e89('0x154'),'foreignKey':_0x9e89('0x155'),'onDelete':_0x9e89('0x156')});db[_0x9e89('0x39')]['belongsTo'](db[_0x9e89('0x3b')],{'as':_0x9e89('0x3b'),'foreignKey':_0x9e89('0x153')});db[_0x9e89('0x39')][_0x9e89('0x11e')](db[_0x9e89('0x154')],{'as':_0x9e89('0x154'),'foreignKey':_0x9e89('0x155'),'onDelete':_0x9e89('0x156')});db['MailAccount']['hasOne'](db[_0x9e89('0x38')],{'as':_0x9e89('0x157'),'onDelete':_0x9e89('0x111')});db[_0x9e89('0x3b')]['hasOne'](db[_0x9e89('0x39')],{'as':_0x9e89('0x158'),'onDelete':_0x9e89('0x111')});db['MailAccount'][_0x9e89('0x112')](db[_0x9e89('0x159')],{'as':_0x9e89('0x15a'),'foreignKey':_0x9e89('0x153'),'onDelete':_0x9e89('0x111')});db[_0x9e89('0x3b')][_0x9e89('0x112')](db[_0x9e89('0x7f')],{'as':_0x9e89('0x15b'),'foreignKey':_0x9e89('0x153')});db['MailAccount']['hasMany'](db['MailMessage'],{'as':'Messages','foreignKey':_0x9e89('0x153')});db[_0x9e89('0x3b')][_0x9e89('0x112')](db['MailInteraction'],{'as':_0x9e89('0x15c')});db[_0x9e89('0x3b')]['hasMany'](db[_0x9e89('0x15d')],{'as':_0x9e89('0x13f')});db[_0x9e89('0x3b')][_0x9e89('0x11e')](db[_0x9e89('0xf3')],{'as':_0x9e89('0x15e'),'foreignKey':'ListId'});db['MailAccount']['belongsTo'](db['Template'],{'as':_0x9e89('0x92'),'foreignKey':_0x9e89('0x15f')});db['MailAccount'][_0x9e89('0x11e')](db['Pause'],{'as':_0x9e89('0x160'),'foreignKey':_0x9e89('0x161')});db[_0x9e89('0x3b')][_0x9e89('0x11f')](db[_0x9e89('0x10d')],{'as':'Agents','through':_0x9e89('0x136')});db[_0x9e89('0x3d')][_0x9e89('0x11f')](db[_0x9e89('0x10d')],{'as':_0x9e89('0x162'),'through':'UserMailQueue'});db[_0x9e89('0x3d')][_0x9e89('0x11f')](db['Team'],{'through':_0x9e89('0x163'),'as':_0x9e89('0x147')});db[_0x9e89('0x40')]['hasMany'](db[_0x9e89('0x42')],{'as':_0x9e89('0x14a'),'onDelete':_0x9e89('0x111'),'foreignKey':_0x9e89('0x164')});db[_0x9e89('0x40')][_0x9e89('0x11e')](db[_0x9e89('0x3b')],{'as':_0x9e89('0x165'),'foreignKey':_0x9e89('0x153')});db['MailInteraction'][_0x9e89('0x11e')](db['CmContact'],{'as':_0x9e89('0x166'),'foreignKey':_0x9e89('0x152')});db[_0x9e89('0x40')]['belongsTo'](db[_0x9e89('0x10d')],{'as':_0x9e89('0x167'),'foreignKey':_0x9e89('0x10e')});db[_0x9e89('0x40')][_0x9e89('0x11f')](db[_0x9e89('0x8c')],{'through':_0x9e89('0x168'),'as':_0x9e89('0x169')});db[_0x9e89('0x40')][_0x9e89('0x11f')](db[_0x9e89('0x8c')],{'through':'mail_interaction_has_tags','as':'ThroughTags'});db['MailInteraction'][_0x9e89('0x11f')](db[_0x9e89('0x10d')],{'as':_0x9e89('0x16a'),'through':'user_has_mail_interactions','foreignKey':_0x9e89('0x164')});db[_0x9e89('0x42')]['hasMany'](db[_0x9e89('0x16b')],{'as':_0x9e89('0x16c'),'onDelete':_0x9e89('0x111')});db['MailMessage'][_0x9e89('0x11e')](db[_0x9e89('0x10d')],{'as':_0x9e89('0x10d')});db[_0x9e89('0x42')]['belongsTo'](db[_0x9e89('0x6f')],{'onDelete':_0x9e89('0x111'),'as':_0x9e89('0x166')});db[_0x9e89('0x42')][_0x9e89('0x11e')](db[_0x9e89('0x40')],{'as':'Interaction','foreignKey':_0x9e89('0x164')});db[_0x9e89('0x42')]['belongsTo'](db['MailAccount'],{'as':_0x9e89('0x165'),'foreignKey':'MailAccountId'});db[_0x9e89('0x42')]['belongsTo'](db[_0x9e89('0x133')],{'as':_0x9e89('0x133'),'foreignKey':'ChatWebsiteId'});db[_0x9e89('0x42')][_0x9e89('0x11e')](db['ChatOfflineMessage'],{'as':_0x9e89('0x68'),'foreignKey':_0x9e89('0x16d')});db[_0x9e89('0x15d')][_0x9e89('0x11e')](db['User'],{'onDelete':'restrict'});db['MailApplication']['belongsTo'](db['MailQueue'],{'onDelete':_0x9e89('0x156')});db[_0x9e89('0x15d')][_0x9e89('0x11e')](db[_0x9e89('0x3b')],{'onDelete':_0x9e89('0x156')});db[_0x9e89('0x15d')][_0x9e89('0x11e')](db['Interval'],{'onDelete':_0x9e89('0x156'),'foreignKey':_0x9e89('0x145')});db['MailApplication']['belongsTo'](db[_0x9e89('0x8c')],{'onDelete':_0x9e89('0x156'),'foreignKey':_0x9e89('0x16e')});db['MailQueueReport'][_0x9e89('0x11e')](db['MailAccount'],{});db['MailQueueReport']['belongsTo'](db[_0x9e89('0xf3')],{'as':_0x9e89('0x15e'),'foreignKey':_0x9e89('0x16f')});db[_0x9e89('0x45')][_0x9e89('0x11e')](db[_0x9e89('0x6f')],{'as':'Contact','foreignKey':_0x9e89('0x152')});db['MailQueueReport'][_0x9e89('0x11e')](db[_0x9e89('0x40')],{});db[_0x9e89('0x45')][_0x9e89('0x11e')](db['MailMessage'],{});db['MailQueueReport'][_0x9e89('0x11e')](db[_0x9e89('0x10d')],{});db[_0x9e89('0x45')]['belongsTo'](db[_0x9e89('0x3d')],{});db[_0x9e89('0x47')][_0x9e89('0x112')](db[_0x9e89('0x49')],{'as':_0x9e89('0x170'),'onDelete':'cascade'});db[_0x9e89('0x4a')][_0x9e89('0x112')](db[_0x9e89('0x159')],{'as':_0x9e89('0x15a'),'foreignKey':_0x9e89('0x171'),'onDelete':'cascade'});db['FaxAccount']['hasMany'](db['CannedAnswer'],{'as':_0x9e89('0x15b'),'foreignKey':_0x9e89('0x171')});db[_0x9e89('0x4a')][_0x9e89('0x112')](db[_0x9e89('0x11b')],{'as':_0x9e89('0x15c')});db['FaxAccount'][_0x9e89('0x112')](db[_0x9e89('0x4c')],{'as':_0x9e89('0x13f')});db[_0x9e89('0x4a')][_0x9e89('0x112')](db['VoiceExtension'],{'as':_0x9e89('0x172'),'onDelete':'cascade'});db[_0x9e89('0x4a')]['hasMany'](db[_0x9e89('0x4e')],{'as':'Messages'});db[_0x9e89('0x4a')][_0x9e89('0x11e')](db[_0x9e89('0x2c')],{'as':'Trunk'});db[_0x9e89('0x4a')][_0x9e89('0x11e')](db[_0x9e89('0xf3')],{'as':_0x9e89('0x15e'),'foreignKey':_0x9e89('0x16f')});db[_0x9e89('0x4a')][_0x9e89('0x11e')](db[_0x9e89('0x146')],{'as':_0x9e89('0x160'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x9e89('0x4a')][_0x9e89('0x11f')](db[_0x9e89('0x10d')],{'as':_0x9e89('0x162'),'through':_0x9e89('0x173')});db[_0x9e89('0x4c')][_0x9e89('0x11e')](db[_0x9e89('0x10d')],{'onDelete':_0x9e89('0x156')});db[_0x9e89('0x4c')]['belongsTo'](db[_0x9e89('0x50')],{'onDelete':_0x9e89('0x156')});db[_0x9e89('0x4c')]['belongsTo'](db[_0x9e89('0x4a')],{'onDelete':_0x9e89('0x156')});db['FaxApplication'][_0x9e89('0x11e')](db[_0x9e89('0x8c')],{'onDelete':_0x9e89('0x156'),'foreignKey':_0x9e89('0x16e')});db[_0x9e89('0x11b')][_0x9e89('0x112')](db['FaxMessage'],{'as':_0x9e89('0x14a'),'onDelete':'cascade','foreignKey':_0x9e89('0x174')});db[_0x9e89('0x11b')]['belongsTo'](db['FaxAccount'],{'as':_0x9e89('0x165'),'foreignKey':_0x9e89('0x171')});db[_0x9e89('0x11b')][_0x9e89('0x11e')](db[_0x9e89('0x6f')],{'as':_0x9e89('0x166'),'foreignKey':_0x9e89('0x152')});db['FaxInteraction'][_0x9e89('0x11e')](db[_0x9e89('0x10d')],{'as':'Owner','foreignKey':_0x9e89('0x10e')});db[_0x9e89('0x11b')][_0x9e89('0x11f')](db['Tag'],{'through':_0x9e89('0x175'),'as':_0x9e89('0x169')});db[_0x9e89('0x11b')][_0x9e89('0x11f')](db[_0x9e89('0x8c')],{'through':_0x9e89('0x175'),'as':_0x9e89('0x176')});db[_0x9e89('0x11b')]['belongsToMany'](db['User'],{'as':_0x9e89('0x16a'),'through':_0x9e89('0x125'),'foreignKey':_0x9e89('0x174')});db['FaxMessage'][_0x9e89('0x11e')](db[_0x9e89('0x10d')],{'onDelete':'cascade','as':_0x9e89('0x10d')});db[_0x9e89('0x4e')]['belongsTo'](db[_0x9e89('0x11b')],{'as':_0x9e89('0x177'),'foreignKey':_0x9e89('0x174')});db[_0x9e89('0x4e')][_0x9e89('0x11e')](db['CmContact'],{'onDelete':_0x9e89('0x111'),'as':_0x9e89('0x166')});db[_0x9e89('0x4e')][_0x9e89('0x11e')](db['Attachment'],{'as':_0x9e89('0x16b'),'foreignKey':_0x9e89('0x178')});db['FaxMessage'][_0x9e89('0x11e')](db[_0x9e89('0x4a')],{'as':_0x9e89('0x165'),'foreignKey':_0x9e89('0x171')});db[_0x9e89('0x50')]['belongsToMany'](db[_0x9e89('0x10d')],{'as':_0x9e89('0x162'),'through':_0x9e89('0x12d')});db[_0x9e89('0x50')][_0x9e89('0x11f')](db[_0x9e89('0xe2')],{'through':'team_has_fax_queues','as':_0x9e89('0x147')});db[_0x9e89('0x52')]['belongsTo'](db['FaxAccount'],{});db['FaxQueueReport'][_0x9e89('0x11e')](db[_0x9e89('0xf3')],{'as':_0x9e89('0x15e'),'foreignKey':_0x9e89('0x16f')});db[_0x9e89('0x52')]['belongsTo'](db[_0x9e89('0x6f')],{'as':'Contact','foreignKey':'ContactId'});db['FaxQueueReport'][_0x9e89('0x11e')](db[_0x9e89('0x11b')],{});db[_0x9e89('0x52')]['belongsTo'](db[_0x9e89('0x4e')],{});db[_0x9e89('0x52')][_0x9e89('0x11e')](db[_0x9e89('0x10d')],{});db['FaxQueueReport']['belongsTo'](db[_0x9e89('0x50')],{});db[_0x9e89('0x54')][_0x9e89('0x112')](db[_0x9e89('0x159')],{'as':_0x9e89('0x15a'),'foreignKey':_0x9e89('0x179'),'onDelete':'cascade'});db[_0x9e89('0x54')][_0x9e89('0x112')](db[_0x9e89('0x7f')],{'as':_0x9e89('0x15b'),'foreignKey':_0x9e89('0x179')});db[_0x9e89('0x54')][_0x9e89('0x112')](db[_0x9e89('0x58')],{'as':_0x9e89('0x14a'),'foreignKey':_0x9e89('0x179')});db[_0x9e89('0x54')][_0x9e89('0x112')](db[_0x9e89('0x57')],{'as':'Interactions'});db[_0x9e89('0x54')]['hasMany'](db[_0x9e89('0x55')],{'as':'Applications'});db['SmsAccount'][_0x9e89('0x11e')](db[_0x9e89('0xf3')],{'as':_0x9e89('0x15e'),'foreignKey':_0x9e89('0x16f')});db[_0x9e89('0x54')][_0x9e89('0x11e')](db[_0x9e89('0x146')],{'as':_0x9e89('0x160'),'foreignKey':_0x9e89('0x161')});db[_0x9e89('0x54')][_0x9e89('0x11f')](db[_0x9e89('0x10d')],{'as':_0x9e89('0x162'),'through':_0x9e89('0x13a')});db[_0x9e89('0x55')][_0x9e89('0x11e')](db['User'],{'onDelete':_0x9e89('0x156')});db[_0x9e89('0x55')]['belongsTo'](db['SmsQueue'],{'onDelete':_0x9e89('0x156')});db[_0x9e89('0x55')]['belongsTo'](db['SmsAccount'],{'onDelete':'restrict'});db[_0x9e89('0x55')][_0x9e89('0x11e')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x9e89('0x145')});db[_0x9e89('0x55')][_0x9e89('0x11e')](db['Tag'],{'onDelete':_0x9e89('0x156'),'foreignKey':_0x9e89('0x16e')});db[_0x9e89('0x57')][_0x9e89('0x112')](db['SmsMessage'],{'as':_0x9e89('0x14a'),'onDelete':_0x9e89('0x111'),'foreignKey':_0x9e89('0x17a')});db[_0x9e89('0x57')]['belongsTo'](db[_0x9e89('0x54')],{'as':'Account','foreignKey':_0x9e89('0x179')});db[_0x9e89('0x57')][_0x9e89('0x11e')](db[_0x9e89('0x6f')],{'as':_0x9e89('0x166'),'foreignKey':_0x9e89('0x152')});db[_0x9e89('0x57')]['belongsTo'](db[_0x9e89('0x10d')],{'as':_0x9e89('0x167'),'foreignKey':_0x9e89('0x10e')});db['SmsInteraction']['belongsToMany'](db[_0x9e89('0x8c')],{'through':_0x9e89('0x17b'),'as':_0x9e89('0x169')});db['SmsInteraction'][_0x9e89('0x11f')](db[_0x9e89('0x8c')],{'through':_0x9e89('0x17b'),'as':'ThroughTags'});db[_0x9e89('0x57')][_0x9e89('0x11f')](db[_0x9e89('0x10d')],{'as':_0x9e89('0x16a'),'through':'user_has_sms_interactions','foreignKey':_0x9e89('0x17a')});db[_0x9e89('0x58')][_0x9e89('0x11e')](db['User'],{'as':_0x9e89('0x10d')});db[_0x9e89('0x58')][_0x9e89('0x11e')](db['CmContact'],{'onDelete':_0x9e89('0x111'),'as':'Contact'});db['SmsMessage'][_0x9e89('0x11e')](db[_0x9e89('0x57')],{'onDelete':_0x9e89('0x111'),'as':'Interaction','foreignKey':_0x9e89('0x17a')});db[_0x9e89('0x58')]['belongsTo'](db['SmsAccount'],{'as':_0x9e89('0x165'),'foreignKey':'SmsAccountId'});db[_0x9e89('0x12e')][_0x9e89('0x11f')](db['User'],{'as':'Agents','through':_0x9e89('0x36'),'foreignKey':'SmsQueueId'});db[_0x9e89('0x12e')][_0x9e89('0x11f')](db[_0x9e89('0xe2')],{'through':'team_has_sms_queues','as':'Teams'});db[_0x9e89('0x5a')]['hasMany'](db[_0x9e89('0x159')],{'as':_0x9e89('0x15a'),'foreignKey':_0x9e89('0x17c'),'onDelete':_0x9e89('0x111')});db[_0x9e89('0x5a')][_0x9e89('0x112')](db['CannedAnswer'],{'as':_0x9e89('0x15b'),'foreignKey':_0x9e89('0x17c')});db['OpenchannelAccount'][_0x9e89('0x112')](db[_0x9e89('0x5d')],{'as':'Interactions','foreignKey':_0x9e89('0x17c')});db[_0x9e89('0x5a')][_0x9e89('0x112')](db[_0x9e89('0x5f')],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db[_0x9e89('0x5a')][_0x9e89('0x112')](db[_0x9e89('0x5c')],{'as':_0x9e89('0x13f'),'foreignKey':_0x9e89('0x17c')});db['OpenchannelAccount'][_0x9e89('0x11e')](db[_0x9e89('0xf3')],{'as':_0x9e89('0x15e'),'foreignKey':'ListId'});db[_0x9e89('0x5a')][_0x9e89('0x11e')](db['Pause'],{'as':_0x9e89('0x160'),'foreignKey':_0x9e89('0x161')});db[_0x9e89('0x5a')][_0x9e89('0x11f')](db['User'],{'as':'Agents','through':_0x9e89('0x138')});db[_0x9e89('0x5c')][_0x9e89('0x11e')](db[_0x9e89('0x10d')],{'onDelete':_0x9e89('0x156')});db['OpenchannelApplication'][_0x9e89('0x11e')](db[_0x9e89('0x60')],{'onDelete':'restrict','foreignKey':_0x9e89('0x17d')});db['OpenchannelApplication']['belongsTo'](db[_0x9e89('0x5a')],{'onDelete':_0x9e89('0x156'),'foreignKey':_0x9e89('0x17c')});db[_0x9e89('0x5c')][_0x9e89('0x11e')](db[_0x9e89('0x83')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x9e89('0x5c')][_0x9e89('0x11e')](db['Tag'],{'onDelete':_0x9e89('0x156'),'foreignKey':_0x9e89('0x16e')});db[_0x9e89('0x5d')][_0x9e89('0x112')](db[_0x9e89('0x5f')],{'as':_0x9e89('0x14a'),'onDelete':'cascade','foreignKey':_0x9e89('0x17e')});db['OpenchannelInteraction']['belongsTo'](db['OpenchannelAccount'],{'as':_0x9e89('0x165'),'foreignKey':_0x9e89('0x17c')});db[_0x9e89('0x5d')][_0x9e89('0x11e')](db[_0x9e89('0x6f')],{'as':'Contact','foreignKey':_0x9e89('0x152')});db[_0x9e89('0x5d')][_0x9e89('0x11e')](db[_0x9e89('0x10d')],{'as':_0x9e89('0x167'),'foreignKey':'UserId'});db['OpenchannelInteraction'][_0x9e89('0x11f')](db[_0x9e89('0x8c')],{'through':'openchannel_interaction_has_tags','as':_0x9e89('0x169')});db[_0x9e89('0x5d')]['belongsToMany'](db[_0x9e89('0x8c')],{'through':_0x9e89('0x17f'),'as':_0x9e89('0x176')});db[_0x9e89('0x5d')][_0x9e89('0x11f')](db['User'],{'as':_0x9e89('0x16a'),'through':_0x9e89('0x127'),'foreignKey':_0x9e89('0x17e')});db[_0x9e89('0x5f')]['belongsTo'](db[_0x9e89('0x10d')],{'onDelete':_0x9e89('0x111'),'as':_0x9e89('0x10d')});db[_0x9e89('0x5f')]['belongsTo'](db[_0x9e89('0x6f')],{'onDelete':_0x9e89('0x111'),'as':_0x9e89('0x166')});db[_0x9e89('0x5f')][_0x9e89('0x11e')](db[_0x9e89('0x5d')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x9e89('0x17e')});db[_0x9e89('0x5f')][_0x9e89('0x11e')](db[_0x9e89('0x16b')],{'as':_0x9e89('0x16b'),'foreignKey':_0x9e89('0x178')});db['OpenchannelMessage'][_0x9e89('0x11e')](db[_0x9e89('0x5a')],{'as':_0x9e89('0x165'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelQueue'][_0x9e89('0x11f')](db[_0x9e89('0x10d')],{'as':_0x9e89('0x162'),'through':_0x9e89('0x180'),'foreignKey':_0x9e89('0x17d')});db[_0x9e89('0x60')][_0x9e89('0x11f')](db[_0x9e89('0xe2')],{'through':_0x9e89('0x181'),'as':'Teams'});db['ChatWebsite'][_0x9e89('0x112')](db[_0x9e89('0x159')],{'as':_0x9e89('0x15a'),'foreignKey':_0x9e89('0x182'),'onDelete':_0x9e89('0x111')});db[_0x9e89('0x133')][_0x9e89('0x112')](db[_0x9e89('0x7f')],{'as':'Answers','foreignKey':_0x9e89('0x182')});db['ChatWebsite'][_0x9e89('0x112')](db['ChatProactiveAction'],{'as':_0x9e89('0x183')});db[_0x9e89('0x133')][_0x9e89('0x112')](db[_0x9e89('0x119')],{'as':_0x9e89('0x15c')});db[_0x9e89('0x133')]['hasMany'](db[_0x9e89('0x64')],{'as':_0x9e89('0x13f')});db[_0x9e89('0x133')][_0x9e89('0x112')](db[_0x9e89('0x66')],{'as':_0x9e89('0x14a')});db[_0x9e89('0x133')][_0x9e89('0x11e')](db[_0x9e89('0xf3')],{'as':'List','foreignKey':_0x9e89('0x16f')});db[_0x9e89('0x133')][_0x9e89('0x11e')](db[_0x9e89('0x83')],{'as':_0x9e89('0x83'),'foreignKey':_0x9e89('0x145')});db[_0x9e89('0x133')][_0x9e89('0x11e')](db['MailAccount'],{'as':_0x9e89('0x3b'),'foreignKey':_0x9e89('0x153')});db[_0x9e89('0x133')][_0x9e89('0x11e')](db['Pause'],{'as':_0x9e89('0x160'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x9e89('0x133')][_0x9e89('0x11f')](db[_0x9e89('0x10d')],{'as':'Agents','through':_0x9e89('0x184')});db[_0x9e89('0x62')][_0x9e89('0x11e')](db[_0x9e89('0x5a')],{});db[_0x9e89('0x62')][_0x9e89('0x11e')](db[_0x9e89('0xf3')],{'as':'List','foreignKey':'ListId'});db[_0x9e89('0x62')][_0x9e89('0x11e')](db[_0x9e89('0x6f')],{'as':_0x9e89('0x166'),'foreignKey':_0x9e89('0x152')});db[_0x9e89('0x62')][_0x9e89('0x11e')](db[_0x9e89('0x5d')],{});db[_0x9e89('0x62')]['belongsTo'](db[_0x9e89('0x5f')],{});db[_0x9e89('0x62')][_0x9e89('0x11e')](db[_0x9e89('0x10d')],{});db[_0x9e89('0x62')]['belongsTo'](db['OpenchannelQueue'],{});db[_0x9e89('0x64')][_0x9e89('0x11e')](db[_0x9e89('0x10d')],{'as':_0x9e89('0x185'),'foreignKey':'UserId','onDelete':_0x9e89('0x156')});db[_0x9e89('0x64')]['belongsTo'](db['ChatQueue'],{'as':_0x9e89('0x186'),'foreignKey':_0x9e89('0x187'),'onDelete':_0x9e89('0x156')});db[_0x9e89('0x64')]['belongsTo'](db[_0x9e89('0x133')],{'as':'Website','foreignKey':_0x9e89('0x182'),'onDelete':_0x9e89('0x156')});db[_0x9e89('0x64')][_0x9e89('0x11e')](db[_0x9e89('0x8c')],{'onDelete':_0x9e89('0x156'),'foreignKey':'TagId'});db[_0x9e89('0x119')][_0x9e89('0x112')](db[_0x9e89('0x66')],{'as':_0x9e89('0x14a'),'onDelete':_0x9e89('0x111'),'foreignKey':_0x9e89('0x188')});db[_0x9e89('0x119')][_0x9e89('0x11e')](db[_0x9e89('0x133')],{'as':_0x9e89('0x165'),'foreignKey':_0x9e89('0x182')});db[_0x9e89('0x119')][_0x9e89('0x11e')](db[_0x9e89('0x6f')],{'as':_0x9e89('0x166'),'foreignKey':'ContactId'});db[_0x9e89('0x119')]['belongsTo'](db[_0x9e89('0x10d')],{'as':_0x9e89('0x167'),'foreignKey':_0x9e89('0x10e')});db[_0x9e89('0x119')]['belongsToMany'](db[_0x9e89('0x8c')],{'through':_0x9e89('0x189'),'as':'Tags'});db[_0x9e89('0x119')]['belongsToMany'](db[_0x9e89('0x8c')],{'through':'chat_interaction_has_tags','as':_0x9e89('0x176')});db[_0x9e89('0x119')]['belongsToMany'](db['User'],{'as':'Users','through':_0x9e89('0x124'),'foreignKey':_0x9e89('0x188')});db['ChatMessage']['belongsTo'](db[_0x9e89('0x10d')],{'onDelete':_0x9e89('0x111'),'as':_0x9e89('0x10d')});db['ChatMessage'][_0x9e89('0x11e')](db[_0x9e89('0x6f')],{'onDelete':_0x9e89('0x111'),'as':'Contact','foreignKey':_0x9e89('0x152')});db['ChatMessage'][_0x9e89('0x11e')](db[_0x9e89('0x119')],{'onDelete':_0x9e89('0x111'),'as':_0x9e89('0x177'),'foreignKey':_0x9e89('0x188')});db[_0x9e89('0x66')][_0x9e89('0x11e')](db[_0x9e89('0x16b')],{'as':_0x9e89('0x16b'),'foreignKey':_0x9e89('0x178')});db[_0x9e89('0x66')][_0x9e89('0x11e')](db[_0x9e89('0x133')],{'as':'Account','foreignKey':_0x9e89('0x182')});db['ChatOfflineMessage']['hasMany'](db[_0x9e89('0x16b')],{'as':'Attachments','foreignKey':_0x9e89('0x16d'),'onDelete':_0x9e89('0x111'),'hooks':!![]});db['ChatOfflineMessage'][_0x9e89('0x11e')](db[_0x9e89('0x6f')],{'onDelete':_0x9e89('0x111'),'as':'Contact','foreignKey':_0x9e89('0x152')});db['ChatOfflineMessage']['belongsTo'](db[_0x9e89('0x133')],{'as':_0x9e89('0x165'),'foreignKey':'ChatWebsiteId'});db['ChatQueue'][_0x9e89('0x11f')](db['User'],{'as':_0x9e89('0x162'),'through':_0x9e89('0x31'),'hooks':!![]});db[_0x9e89('0x12c')]['belongsToMany'](db[_0x9e89('0xe2')],{'through':_0x9e89('0x18a'),'as':'Teams'});db[_0x9e89('0x6b')][_0x9e89('0x112')](db['ChatInternalMessage'],{'as':_0x9e89('0x14a'),'foreignKey':'ChatGroupId','onDelete':_0x9e89('0x111')});db[_0x9e89('0x6b')][_0x9e89('0x11f')](db[_0x9e89('0x10d')],{'as':_0x9e89('0x18b'),'through':_0x9e89('0x18c')});db[_0x9e89('0x6c')][_0x9e89('0x11e')](db[_0x9e89('0x133')],{'as':_0x9e89('0x18d'),'foreignKey':_0x9e89('0x182')});db[_0x9e89('0x6e')]['hasMany'](db['CmContact'],{'as':'Contacts','foreignKey':_0x9e89('0x18e')});db[_0x9e89('0x6f')][_0x9e89('0x112')](db[_0x9e89('0x8f')],{'as':_0x9e89('0x18f'),'foreignKey':'CmContactId'});db[_0x9e89('0x6f')][_0x9e89('0x112')](db[_0x9e89('0x71')],{'as':_0x9e89('0x190'),'foreignKey':_0x9e89('0x152')});db[_0x9e89('0x6f')][_0x9e89('0x112')](db[_0x9e89('0x115')],{'as':_0x9e89('0x116'),'foreignKey':_0x9e89('0x152')});db[_0x9e89('0x6f')]['hasMany'](db['CmHopperHistory'],{'as':_0x9e89('0x191'),'foreignKey':_0x9e89('0x152')});db[_0x9e89('0x6f')][_0x9e89('0x112')](db[_0x9e89('0x77')],{'as':_0x9e89('0x77'),'foreignKey':_0x9e89('0x152')});db[_0x9e89('0x6f')][_0x9e89('0x112')](db[_0x9e89('0xd5')],{'as':'JscriptySessions','foreignKey':'ContactId'});db[_0x9e89('0x6f')][_0x9e89('0x112')](db[_0x9e89('0x5d')],{'as':_0x9e89('0x118'),'foreignKey':_0x9e89('0x152'),'onDelete':_0x9e89('0x156')});db[_0x9e89('0x6f')][_0x9e89('0x112')](db[_0x9e89('0x119')],{'as':_0x9e89('0x123'),'foreignKey':_0x9e89('0x152'),'onDelete':'restrict'});db['CmContact'][_0x9e89('0x112')](db[_0x9e89('0x57')],{'as':_0x9e89('0x11a'),'foreignKey':_0x9e89('0x152'),'onDelete':_0x9e89('0x156')});db['CmContact']['hasMany'](db[_0x9e89('0x11b')],{'as':_0x9e89('0x192'),'foreignKey':_0x9e89('0x152'),'onDelete':'restrict'});db[_0x9e89('0x6f')][_0x9e89('0x112')](db[_0x9e89('0x40')],{'as':'MailInteractions','foreignKey':_0x9e89('0x152'),'onDelete':_0x9e89('0x156')});db['CmContact'][_0x9e89('0x11e')](db[_0x9e89('0x6e')],{'as':_0x9e89('0x193'),'foreignKey':_0x9e89('0x18e')});db[_0x9e89('0x6f')][_0x9e89('0x11e')](db['CmList'],{'as':_0x9e89('0x15e'),'foreignKey':'ListId','onDelete':_0x9e89('0x111')});db[_0x9e89('0x6f')]['belongsToMany'](db[_0x9e89('0x10d')],{'as':_0x9e89('0x16a'),'through':_0x9e89('0x120')});db['CmContact'][_0x9e89('0x11f')](db[_0x9e89('0x8c')],{'as':_0x9e89('0x169'),'through':_0x9e89('0x194')});db['CmContact'][_0x9e89('0x11f')](db[_0x9e89('0x8c')],{'through':'cm_contact_has_tags','as':_0x9e89('0x176')});db[_0x9e89('0x71')][_0x9e89('0x112')](db['CmHopperAdditionalPhone'],{'as':_0x9e89('0x195'),'foreignKey':_0x9e89('0x196')});db[_0x9e89('0x71')][_0x9e89('0x11e')](db[_0x9e89('0x6f')],{'as':'Contact','foreignKey':_0x9e89('0x152'),'onDelete':_0x9e89('0x111')});db['CmHopper'][_0x9e89('0x11e')](db['CmList'],{'as':_0x9e89('0x15e'),'foreignKey':_0x9e89('0x16f'),'onDelete':'cascade'});db[_0x9e89('0x71')][_0x9e89('0x11e')](db['User'],{'as':'Agent','foreignKey':_0x9e89('0x10e')});db[_0x9e89('0x71')]['belongsTo'](db[_0x9e89('0x1b')],{'as':_0x9e89('0x186'),'foreignKey':_0x9e89('0x141'),'onDelete':'cascade'});db[_0x9e89('0x71')]['belongsTo'](db[_0x9e89('0x197')],{'as':'Campaign','foreignKey':_0x9e89('0x198'),'onDelete':_0x9e89('0x111')});db[_0x9e89('0x71')][_0x9e89('0x11e')](db['User'],{'as':_0x9e89('0x167'),'foreignKey':_0x9e89('0x199')});db[_0x9e89('0x73')][_0x9e89('0x11e')](db[_0x9e89('0x6f')],{'as':_0x9e89('0x166'),'foreignKey':_0x9e89('0x152'),'onDelete':_0x9e89('0x111')});db[_0x9e89('0x73')]['belongsTo'](db['CmList'],{'as':_0x9e89('0x15e'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x9e89('0x73')][_0x9e89('0x11e')](db['VoiceQueue'],{'as':_0x9e89('0x186'),'foreignKey':'VoiceQueueId','onDelete':_0x9e89('0x111')});db[_0x9e89('0x73')][_0x9e89('0x11e')](db['Campaign'],{'as':'Campaign','foreignKey':_0x9e89('0x198'),'onDelete':'cascade'});db[_0x9e89('0x7d')][_0x9e89('0x112')](db[_0x9e89('0x82')],{'as':{'plural':_0x9e89('0x19a'),'singular':'OneAll'},'foreignKey':_0x9e89('0x19b'),'onDelete':_0x9e89('0x111'),'hooks':!![]});db[_0x9e89('0x7d')][_0x9e89('0x112')](db[_0x9e89('0x82')],{'as':{'plural':_0x9e89('0x19c'),'singular':_0x9e89('0x19d')},'foreignKey':_0x9e89('0x19e'),'onDelete':'cascade','hooks':!![]});db[_0x9e89('0x7d')][_0x9e89('0x112')](db['Action'],{'as':'Actions','foreignKey':'AutomationId','onDelete':_0x9e89('0x111'),'hooks':!![]});db[_0x9e89('0x159')][_0x9e89('0x112')](db[_0x9e89('0x159')],{'as':_0x9e89('0x15a'),'foreignKey':'ParentId','onDelete':_0x9e89('0x111')});db[_0x9e89('0x83')][_0x9e89('0x112')](db[_0x9e89('0x83')],{'as':_0x9e89('0x19f'),'foreignKey':_0x9e89('0x145'),'onDelete':_0x9e89('0x111'),'hooks':!![],'required':![]});db[_0x9e89('0x83')][_0x9e89('0x112')](db['VoiceExtension'],{'as':'Extensions','foreignKey':_0x9e89('0x145'),'onDelete':_0x9e89('0x156')});db[_0x9e89('0x83')]['hasMany'](db[_0x9e89('0x15d')],{'as':_0x9e89('0x1a0'),'foreignKey':_0x9e89('0x145')});db[_0x9e89('0x83')]['hasMany'](db[_0x9e89('0x64')],{'as':'ChatApplications','foreignKey':_0x9e89('0x145')});db['Interval'][_0x9e89('0x112')](db[_0x9e89('0x4c')],{'as':_0x9e89('0x1a1'),'foreignKey':_0x9e89('0x145')});db[_0x9e89('0x83')][_0x9e89('0x112')](db[_0x9e89('0x55')],{'as':_0x9e89('0x1a2'),'foreignKey':_0x9e89('0x145')});db[_0x9e89('0x89')][_0x9e89('0x11e')](db[_0x9e89('0x3b')],{});db[_0x9e89('0x89')]['belongsTo'](db[_0x9e89('0x9a')],{'foreignKey':_0x9e89('0x1a3')});db[_0x9e89('0x89')][_0x9e89('0x11e')](db[_0x9e89('0x98')],{'foreignKey':_0x9e89('0x1a4')});db[_0x9e89('0x8b')]['belongsToMany'](db[_0x9e89('0x19')],{'as':'Mohs','through':_0x9e89('0x140'),'onDelete':'restrict'});db['Tag'][_0x9e89('0x11f')](db[_0x9e89('0x6f')],{'through':'cm_contact_has_tags'});db['Tag'][_0x9e89('0x11f')](db[_0x9e89('0x119')],{'through':_0x9e89('0x189')});db[_0x9e89('0x8c')][_0x9e89('0x11f')](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0x9e89('0x8c')][_0x9e89('0x11f')](db['SmsInteraction'],{'through':'sms_interaction_has_tags'});db[_0x9e89('0x8c')][_0x9e89('0x11f')](db['FaxInteraction'],{'through':'fax_interaction_has_tags'});db[_0x9e89('0x8c')][_0x9e89('0x11f')](db[_0x9e89('0x5d')],{'through':_0x9e89('0x17f')});db[_0x9e89('0x8c')][_0x9e89('0x11f')](db[_0x9e89('0xff')],{'through':_0x9e89('0x1a5')});db[_0x9e89('0x8f')]['belongsTo'](db[_0x9e89('0x8d')],{'as':_0x9e89('0x1a6'),'foreignKey':_0x9e89('0x1a7')});db[_0x9e89('0x1a8')][_0x9e89('0x11e')](db[_0x9e89('0x71')],{'as':_0x9e89('0x1a9'),'foreignKey':_0x9e89('0x196')});db[_0x9e89('0x8f')][_0x9e89('0x11e')](db[_0x9e89('0x6f')],{'as':_0x9e89('0x166'),'foreignKey':_0x9e89('0x1aa')});db[_0x9e89('0x1ab')][_0x9e89('0x112')](db[_0x9e89('0x82')],{'as':{'plural':'AllConditions','singular':_0x9e89('0x1ac')},'foreignKey':_0x9e89('0x1ad'),'onDelete':_0x9e89('0x111'),'hooks':!![]});db[_0x9e89('0x1ab')]['hasMany'](db[_0x9e89('0x82')],{'as':{'plural':_0x9e89('0x1ae'),'singular':_0x9e89('0x1af')},'foreignKey':_0x9e89('0x1b0'),'onDelete':'cascade','hooks':!![]});db[_0x9e89('0x1ab')][_0x9e89('0x112')](db[_0x9e89('0x7b')],{'as':_0x9e89('0x1b1'),'foreignKey':_0x9e89('0x1b2'),'onDelete':_0x9e89('0x111'),'hooks':!![]});db[_0x9e89('0x98')]['hasMany'](db[_0x9e89('0x1b3')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x9e89('0x1a4'),'hooks':!![]});db[_0x9e89('0x9a')][_0x9e89('0x112')](db['AnalyticFieldReport'],{'as':_0x9e89('0x1b4'),'onDelete':_0x9e89('0x111'),'foreignKey':'DefaultReportId'});db[_0x9e89('0x1b5')][_0x9e89('0x112')](db[_0x9e89('0x1b3')],{'as':_0x9e89('0x1b4'),'onDelete':_0x9e89('0x111'),'foreignKey':_0x9e89('0x1b6')});db[_0x9e89('0x1b3')][_0x9e89('0x11e')](db['AnalyticMetric'],{'foreignKey':_0x9e89('0x1b6')});db[_0x9e89('0x1b7')][_0x9e89('0x112')](db[_0x9e89('0x1b8')],{'as':_0x9e89('0x1b9'),'onDelete':_0x9e89('0x111'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x9e89('0x112')](db[_0x9e89('0xa2')],{'as':_0x9e89('0x1ba'),'onDelete':_0x9e89('0x111'),'foreignKey':_0x9e89('0x1bb')});db[_0x9e89('0x1b8')][_0x9e89('0x112')](db[_0x9e89('0xa2')],{'as':_0x9e89('0x1bc'),'onDelete':_0x9e89('0x111'),'foreignKey':_0x9e89('0x1bd')});db[_0x9e89('0x1b8')]['hasMany'](db[_0x9e89('0xa2')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x9e89('0x1be')});db['SalesforceConfiguration'][_0x9e89('0x11e')](db[_0x9e89('0x1b7')],{'as':_0x9e89('0x165'),'foreignKey':_0x9e89('0x1bf')});db['SalesforceField'][_0x9e89('0x112')](db['SalesforceField'],{'as':_0x9e89('0x1c0'),'foreignKey':_0x9e89('0x1bb')});db[_0x9e89('0xa2')][_0x9e89('0x112')](db[_0x9e89('0xa2')],{'as':_0x9e89('0x1c1'),'foreignKey':'DescriptionId'});db[_0x9e89('0xa2')][_0x9e89('0x112')](db[_0x9e89('0xa2')],{'as':'Field','foreignKey':_0x9e89('0x1be')});db[_0x9e89('0xa2')][_0x9e89('0x11e')](db[_0x9e89('0x1c2')],{'as':_0x9e89('0x1c2'),'foreignKey':_0x9e89('0x1c3')});db[_0x9e89('0xa4')][_0x9e89('0x112')](db[_0x9e89('0x1c4')],{'as':_0x9e89('0x1b9'),'onDelete':'cascade','foreignKey':_0x9e89('0x1bf')});db['SugarcrmConfiguration'][_0x9e89('0x112')](db[_0x9e89('0x1c5')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x9e89('0x1bb')});db[_0x9e89('0x1c4')][_0x9e89('0x112')](db['SugarcrmField'],{'as':_0x9e89('0x1bc'),'onDelete':_0x9e89('0x111'),'foreignKey':_0x9e89('0x1bd')});db[_0x9e89('0x1c4')]['hasMany'](db[_0x9e89('0x1c5')],{'as':_0x9e89('0x1b4'),'onDelete':_0x9e89('0x111'),'foreignKey':_0x9e89('0x1be')});db[_0x9e89('0x1c4')][_0x9e89('0x11e')](db[_0x9e89('0xa4')],{'as':_0x9e89('0x165'),'foreignKey':_0x9e89('0x1bf')});db['SugarcrmField'][_0x9e89('0x112')](db[_0x9e89('0x1c5')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x9e89('0x1c5')]['hasMany'](db[_0x9e89('0x1c5')],{'as':_0x9e89('0x1c1'),'foreignKey':_0x9e89('0x1bd')});db[_0x9e89('0x1c5')][_0x9e89('0x112')](db[_0x9e89('0x1c5')],{'as':_0x9e89('0x1c6'),'foreignKey':_0x9e89('0x1be')});db[_0x9e89('0x1c5')]['belongsTo'](db[_0x9e89('0x1c2')],{'as':_0x9e89('0x1c2'),'foreignKey':_0x9e89('0x1c3')});db[_0x9e89('0xa6')][_0x9e89('0x112')](db[_0x9e89('0x1c7')],{'as':_0x9e89('0x1b9'),'onDelete':_0x9e89('0x111'),'foreignKey':_0x9e89('0x1bf')});db[_0x9e89('0x1c7')][_0x9e89('0x112')](db[_0x9e89('0xa9')],{'as':_0x9e89('0x1ba'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x9e89('0x1c7')][_0x9e89('0x112')](db[_0x9e89('0xa9')],{'as':_0x9e89('0x1bc'),'onDelete':_0x9e89('0x111'),'foreignKey':_0x9e89('0x1bd')});db[_0x9e89('0x1c7')][_0x9e89('0x112')](db[_0x9e89('0xa9')],{'as':_0x9e89('0x1b4'),'onDelete':'cascade','foreignKey':_0x9e89('0x1be')});db[_0x9e89('0x1c7')][_0x9e89('0x11e')](db[_0x9e89('0xa6')],{'as':_0x9e89('0x165'),'foreignKey':_0x9e89('0x1bf')});db[_0x9e89('0x1c7')][_0x9e89('0x11f')](db[_0x9e89('0x8c')],{'through':'int_desk_configuration_has_tags'});db[_0x9e89('0xa9')]['hasMany'](db[_0x9e89('0xa9')],{'as':'Subject','foreignKey':_0x9e89('0x1bb')});db[_0x9e89('0xa9')][_0x9e89('0x112')](db['DeskField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0x9e89('0xa9')][_0x9e89('0x112')](db['DeskField'],{'as':_0x9e89('0x1c6'),'foreignKey':_0x9e89('0x1be')});db[_0x9e89('0xa9')][_0x9e89('0x11e')](db[_0x9e89('0x1c2')],{'as':_0x9e89('0x1c2'),'foreignKey':'VariableId'});db['ZohoAccount'][_0x9e89('0x112')](db['ZohoConfiguration'],{'as':_0x9e89('0x1b9'),'onDelete':_0x9e89('0x111'),'foreignKey':_0x9e89('0x1bf')});db[_0x9e89('0xac')][_0x9e89('0x112')](db[_0x9e89('0xae')],{'as':_0x9e89('0x1ba'),'onDelete':_0x9e89('0x111'),'foreignKey':'SubjectId'});db[_0x9e89('0xac')][_0x9e89('0x112')](db[_0x9e89('0xae')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x9e89('0x1bd')});db[_0x9e89('0xac')][_0x9e89('0x112')](db[_0x9e89('0xae')],{'as':_0x9e89('0x1b4'),'onDelete':_0x9e89('0x111'),'foreignKey':'FieldId'});db[_0x9e89('0xac')][_0x9e89('0x11e')](db['ZohoAccount'],{'as':_0x9e89('0x165'),'foreignKey':'AccountId'});db[_0x9e89('0xae')][_0x9e89('0x112')](db['ZohoField'],{'as':_0x9e89('0x1c0'),'foreignKey':_0x9e89('0x1bb')});db[_0x9e89('0xae')][_0x9e89('0x112')](db[_0x9e89('0xae')],{'as':_0x9e89('0x1c1'),'foreignKey':'DescriptionId'});db[_0x9e89('0xae')]['hasMany'](db['ZohoField'],{'as':_0x9e89('0x1c6'),'foreignKey':_0x9e89('0x1be')});db[_0x9e89('0xae')][_0x9e89('0x11e')](db[_0x9e89('0x1c2')],{'as':_0x9e89('0x1c2'),'foreignKey':_0x9e89('0x1c3')});db[_0x9e89('0xaf')]['hasMany'](db[_0x9e89('0xb1')],{'as':_0x9e89('0x1b9'),'onDelete':_0x9e89('0x111'),'foreignKey':_0x9e89('0x1bf')});db['ZendeskConfiguration']['hasMany'](db[_0x9e89('0x1c8')],{'as':'Subjects','foreignKey':_0x9e89('0x1bb')});db['ZendeskConfiguration'][_0x9e89('0x112')](db['ZendeskField'],{'as':_0x9e89('0x1bc'),'foreignKey':'DescriptionId'});db[_0x9e89('0xb1')][_0x9e89('0x112')](db['ZendeskField'],{'as':_0x9e89('0x1b4'),'foreignKey':_0x9e89('0x1be')});db[_0x9e89('0xb1')][_0x9e89('0x11e')](db[_0x9e89('0xaf')],{'as':_0x9e89('0x165'),'foreignKey':'AccountId'});db[_0x9e89('0xb1')][_0x9e89('0x11f')](db[_0x9e89('0x8c')],{'through':'int_zendesk_configuration_has_tags'});db[_0x9e89('0x1c8')][_0x9e89('0x112')](db[_0x9e89('0x1c8')],{'as':_0x9e89('0x1c0'),'foreignKey':_0x9e89('0x1bb')});db[_0x9e89('0x1c8')][_0x9e89('0x112')](db[_0x9e89('0x1c8')],{'as':'Description','foreignKey':_0x9e89('0x1bd')});db[_0x9e89('0x1c8')]['hasMany'](db[_0x9e89('0x1c8')],{'as':'Field','foreignKey':'FieldId'});db[_0x9e89('0x1c8')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x9e89('0x1c3')});db[_0x9e89('0xb3')][_0x9e89('0x112')](db[_0x9e89('0xb5')],{'as':'Configurations','onDelete':_0x9e89('0x111'),'foreignKey':_0x9e89('0x1bf')});db[_0x9e89('0xb5')][_0x9e89('0x112')](db[_0x9e89('0xb7')],{'as':_0x9e89('0x1ba'),'onDelete':_0x9e89('0x111'),'foreignKey':_0x9e89('0x1bb')});db[_0x9e89('0xb5')][_0x9e89('0x112')](db['FreshdeskField'],{'as':_0x9e89('0x1bc'),'onDelete':_0x9e89('0x111'),'foreignKey':'DescriptionId'});db[_0x9e89('0xb5')][_0x9e89('0x112')](db[_0x9e89('0xb7')],{'as':'Fields','onDelete':_0x9e89('0x111'),'foreignKey':_0x9e89('0x1be')});db[_0x9e89('0xb5')][_0x9e89('0x11e')](db[_0x9e89('0xb3')],{'as':_0x9e89('0x165'),'foreignKey':_0x9e89('0x1bf')});db['FreshdeskConfiguration'][_0x9e89('0x11f')](db[_0x9e89('0x8c')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x9e89('0xb7')][_0x9e89('0x112')](db[_0x9e89('0xb7')],{'as':'Subject','foreignKey':_0x9e89('0x1bb')});db[_0x9e89('0xb7')]['hasMany'](db[_0x9e89('0xb7')],{'as':_0x9e89('0x1c1'),'foreignKey':_0x9e89('0x1bd')});db['FreshdeskField'][_0x9e89('0x112')](db[_0x9e89('0xb7')],{'as':_0x9e89('0x1c6'),'foreignKey':'FieldId'});db['FreshdeskField'][_0x9e89('0x11e')](db[_0x9e89('0x1c2')],{'as':'Variable','foreignKey':_0x9e89('0x1c3')});db[_0x9e89('0xb9')][_0x9e89('0x112')](db[_0x9e89('0xbb')],{'as':_0x9e89('0x1b9'),'onDelete':_0x9e89('0x111'),'foreignKey':_0x9e89('0x1bf')});db[_0x9e89('0xbb')][_0x9e89('0x112')](db[_0x9e89('0xbd')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x9e89('0xbb')][_0x9e89('0x112')](db[_0x9e89('0xbd')],{'as':_0x9e89('0x1bc'),'foreignKey':_0x9e89('0x1bd')});db['VtigerConfiguration'][_0x9e89('0x112')](db[_0x9e89('0xbd')],{'as':'Fields','foreignKey':_0x9e89('0x1be')});db[_0x9e89('0xbb')][_0x9e89('0x11e')](db[_0x9e89('0xb9')],{'as':_0x9e89('0x165'),'foreignKey':_0x9e89('0x1bf')});db[_0x9e89('0xbd')]['hasMany'](db[_0x9e89('0xbd')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x9e89('0xbd')][_0x9e89('0x112')](db[_0x9e89('0xbd')],{'as':_0x9e89('0x1c1'),'foreignKey':_0x9e89('0x1bd')});db['VtigerField']['hasMany'](db['VtigerField'],{'as':_0x9e89('0x1c6'),'foreignKey':_0x9e89('0x1be')});db['VtigerField'][_0x9e89('0x11e')](db[_0x9e89('0x1c2')],{'as':_0x9e89('0x1c2'),'foreignKey':_0x9e89('0x1c3')});db[_0x9e89('0x1c9')]['hasMany'](db[_0x9e89('0xbf')],{'as':_0x9e89('0x1b9'),'onDelete':_0x9e89('0x111'),'foreignKey':_0x9e89('0x1bf')});db[_0x9e89('0xbf')]['hasMany'](db[_0x9e89('0x1ca')],{'as':_0x9e89('0x1ba'),'foreignKey':'SubjectId'});db[_0x9e89('0xbf')]['hasMany'](db[_0x9e89('0x1ca')],{'as':_0x9e89('0x1bc'),'foreignKey':_0x9e89('0x1bd')});db['ServicenowConfiguration'][_0x9e89('0x112')](db[_0x9e89('0x1ca')],{'as':_0x9e89('0x1b4'),'foreignKey':_0x9e89('0x1be')});db['ServicenowConfiguration'][_0x9e89('0x11e')](db[_0x9e89('0x1c9')],{'as':'Account','foreignKey':'AccountId'});db[_0x9e89('0x1ca')]['hasMany'](db[_0x9e89('0x1ca')],{'as':'Subject','foreignKey':_0x9e89('0x1bb')});db[_0x9e89('0x1ca')][_0x9e89('0x112')](db[_0x9e89('0x1ca')],{'as':_0x9e89('0x1c1'),'foreignKey':_0x9e89('0x1bd')});db[_0x9e89('0x1ca')]['hasMany'](db[_0x9e89('0x1ca')],{'as':_0x9e89('0x1c6'),'foreignKey':_0x9e89('0x1be')});db['ServicenowField'][_0x9e89('0x11e')](db[_0x9e89('0x1c2')],{'as':_0x9e89('0x1c2'),'foreignKey':_0x9e89('0x1c3')});db['Dynamics365Account'][_0x9e89('0x112')](db[_0x9e89('0xc4')],{'as':_0x9e89('0x1b9'),'onDelete':'cascade','foreignKey':_0x9e89('0x1bf')});db['Dynamics365Account'][_0x9e89('0x11e')](db[_0x9e89('0x154')],{'as':_0x9e89('0x154'),'foreignKey':_0x9e89('0x155')});db[_0x9e89('0xc4')][_0x9e89('0x112')](db[_0x9e89('0xc6')],{'as':_0x9e89('0x1ba'),'onDelete':_0x9e89('0x111'),'foreignKey':'SubjectId'});db['Dynamics365Configuration'][_0x9e89('0x112')](db['Dynamics365Field'],{'as':_0x9e89('0x1bc'),'onDelete':_0x9e89('0x111'),'foreignKey':'DescriptionId'});db['Dynamics365Configuration']['hasMany'](db[_0x9e89('0xc6')],{'as':_0x9e89('0x1b4'),'onDelete':_0x9e89('0x111'),'foreignKey':_0x9e89('0x1be')});db[_0x9e89('0xc4')][_0x9e89('0x11e')](db[_0x9e89('0xc2')],{'as':_0x9e89('0x165'),'foreignKey':'AccountId'});db[_0x9e89('0xc6')][_0x9e89('0x112')](db[_0x9e89('0xc6')],{'as':_0x9e89('0x1c0'),'foreignKey':_0x9e89('0x1bb')});db[_0x9e89('0xc6')][_0x9e89('0x112')](db[_0x9e89('0xc6')],{'as':_0x9e89('0x1c1'),'foreignKey':'DescriptionId'});db[_0x9e89('0xc6')][_0x9e89('0x112')](db[_0x9e89('0xc6')],{'as':'Field','foreignKey':_0x9e89('0x1be')});db['Dynamics365Field'][_0x9e89('0x11e')](db[_0x9e89('0x1c2')],{'as':_0x9e89('0x1c2'),'foreignKey':_0x9e89('0x1c3')});db['FreshsalesAccount'][_0x9e89('0x112')](db[_0x9e89('0x1cb')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0x9e89('0x1cb')]['hasMany'](db[_0x9e89('0xca')],{'as':'Subjects','foreignKey':_0x9e89('0x1bb')});db['FreshsalesConfiguration'][_0x9e89('0x112')](db[_0x9e89('0xca')],{'as':'Descriptions','foreignKey':_0x9e89('0x1bd')});db[_0x9e89('0x1cb')][_0x9e89('0x112')](db[_0x9e89('0xca')],{'as':_0x9e89('0x1b4'),'foreignKey':_0x9e89('0x1be')});db[_0x9e89('0x1cb')][_0x9e89('0x11e')](db[_0x9e89('0x1cc')],{'as':_0x9e89('0x165'),'foreignKey':'AccountId'});db[_0x9e89('0xca')][_0x9e89('0x112')](db[_0x9e89('0xca')],{'as':_0x9e89('0x1c0'),'foreignKey':_0x9e89('0x1bb')});db[_0x9e89('0xca')]['hasMany'](db[_0x9e89('0xca')],{'as':_0x9e89('0x1c1'),'foreignKey':_0x9e89('0x1bd')});db['FreshsalesField']['hasMany'](db[_0x9e89('0xca')],{'as':_0x9e89('0x1c6'),'foreignKey':_0x9e89('0x1be')});db[_0x9e89('0xca')][_0x9e89('0x11e')](db[_0x9e89('0x1c2')],{'as':_0x9e89('0x1c2'),'foreignKey':_0x9e89('0x1c3')});db[_0x9e89('0xce')][_0x9e89('0x11e')](db[_0x9e89('0x133')],{});db[_0x9e89('0xce')]['belongsTo'](db[_0x9e89('0xf3')],{'as':_0x9e89('0x15e'),'foreignKey':'ListId'});db['ChatQueueReport']['belongsTo'](db[_0x9e89('0x6f')],{'as':'Contact','foreignKey':_0x9e89('0x152')});db['ChatQueueReport']['belongsTo'](db[_0x9e89('0x119')],{});db['ChatQueueReport'][_0x9e89('0x11e')](db[_0x9e89('0x66')],{});db[_0x9e89('0xce')][_0x9e89('0x11e')](db[_0x9e89('0x10d')],{});db['ChatQueueReport'][_0x9e89('0x11e')](db['ChatQueue'],{});db[_0x9e89('0xd0')]['belongsTo'](db['User'],{'onDelete':_0x9e89('0x111'),'foreignKey':_0x9e89('0x1cd')});db[_0x9e89('0xd0')][_0x9e89('0x11e')](db[_0x9e89('0x10d')],{'onDelete':_0x9e89('0x111'),'foreignKey':_0x9e89('0x1ce')});db[_0x9e89('0xd5')]['hasMany'](db[_0x9e89('0xd3')],{'foreignKey':_0x9e89('0x1cf'),'onDelete':_0x9e89('0x111')});db[_0x9e89('0xd5')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0x9e89('0x1cf'),'onDelete':'cascade'});db[_0x9e89('0xd7')][_0x9e89('0x11e')](db[_0x9e89('0x54')],{});db[_0x9e89('0xd7')]['belongsTo'](db[_0x9e89('0xf3')],{'as':_0x9e89('0x15e'),'foreignKey':'ListId'});db[_0x9e89('0xd7')][_0x9e89('0x11e')](db[_0x9e89('0x6f')],{'as':'Contact','foreignKey':_0x9e89('0x152')});db[_0x9e89('0xd7')]['belongsTo'](db['SmsInteraction'],{});db[_0x9e89('0xd7')][_0x9e89('0x11e')](db[_0x9e89('0x58')],{});db[_0x9e89('0xd7')][_0x9e89('0x11e')](db[_0x9e89('0x10d')],{});db[_0x9e89('0xd7')][_0x9e89('0x11e')](db[_0x9e89('0x12e')],{});db[_0x9e89('0xdc')][_0x9e89('0x112')](db[_0x9e89('0xd5')],{'foreignKey':_0x9e89('0x1d0')});db[_0x9e89('0xdc')][_0x9e89('0x112')](db[_0x9e89('0xd3')],{'foreignKey':_0x9e89('0x1d0')});db[_0x9e89('0xdc')]['hasMany'](db[_0x9e89('0xd1')],{'foreignKey':_0x9e89('0x1d0')});db[_0x9e89('0xe2')]['belongsToMany'](db[_0x9e89('0x10d')],{'as':'Agents','through':'user_has_teams'});db['Team']['belongsToMany'](db[_0x9e89('0x1b')],{'through':'TeamVoiceQueue','as':'VoiceQueues'});db[_0x9e89('0xe2')]['belongsToMany'](db[_0x9e89('0x3d')],{'through':_0x9e89('0x163'),'as':_0x9e89('0x12b')});db[_0x9e89('0xe2')][_0x9e89('0x11f')](db[_0x9e89('0x12c')],{'through':_0x9e89('0x18a'),'as':'ChatQueues'});db[_0x9e89('0xe2')][_0x9e89('0x11f')](db[_0x9e89('0x50')],{'through':'team_has_fax_queues','as':_0x9e89('0x1d1')});db[_0x9e89('0xe2')][_0x9e89('0x11f')](db[_0x9e89('0x12e')],{'through':_0x9e89('0x1d2'),'as':'SmsQueues'});db[_0x9e89('0xe2')][_0x9e89('0x11f')](db[_0x9e89('0x60')],{'through':_0x9e89('0x181'),'as':_0x9e89('0x1d3')});db[_0x9e89('0xe2')][_0x9e89('0x11f')](db['WhatsappQueue'],{'through':'team_has_whatsapp_queues','as':_0x9e89('0x130')});db[_0x9e89('0xe2')][_0x9e89('0x11f')](db['VoicePrefix'],{'through':_0x9e89('0x108'),'as':_0x9e89('0x1d4')});db[_0x9e89('0x197')]['hasMany'](db[_0x9e89('0x71')],{'as':_0x9e89('0x190'),'foreignKey':_0x9e89('0x198')});db[_0x9e89('0x197')][_0x9e89('0x112')](db[_0x9e89('0x115')],{'as':_0x9e89('0x116'),'foreignKey':'CampaignId'});db[_0x9e89('0x197')][_0x9e89('0x112')](db[_0x9e89('0x117')],{'as':'HopperHistories','foreignKey':_0x9e89('0x198')});db[_0x9e89('0x197')][_0x9e89('0x112')](db['CmHopperBlack'],{'as':_0x9e89('0x142'),'foreignKey':_0x9e89('0x198')});db[_0x9e89('0x197')]['belongsTo'](db[_0x9e89('0x2c')],{'as':_0x9e89('0x2c'),'foreignKey':_0x9e89('0x143')});db['Campaign'][_0x9e89('0x11e')](db[_0x9e89('0x2c')],{'as':_0x9e89('0x1d5'),'foreignKey':_0x9e89('0x144')});db[_0x9e89('0x197')]['belongsTo'](db[_0x9e89('0x83')],{'as':_0x9e89('0x83'),'foreignKey':_0x9e89('0x145')});db[_0x9e89('0x197')][_0x9e89('0x11e')](db[_0x9e89('0x1d6')],{'as':'SquareProject','foreignKey':'SquareProjectId'});db['Campaign'][_0x9e89('0x11f')](db['CmList'],{'as':_0x9e89('0x1d7'),'through':_0x9e89('0x1d8')});db['Campaign'][_0x9e89('0x11f')](db[_0x9e89('0xf3')],{'as':_0x9e89('0x148'),'through':_0x9e89('0x1d9')});db[_0x9e89('0x16b')][_0x9e89('0x11e')](db[_0x9e89('0x68')],{'as':_0x9e89('0x68'),'foreignKey':'ChatOfflineMessageId'});db['MailTransferReport'][_0x9e89('0x11e')](db['MailMessage'],{});db[_0x9e89('0xec')]['belongsTo'](db[_0x9e89('0x40')],{});db[_0x9e89('0xec')][_0x9e89('0x11e')](db[_0x9e89('0x3b')],{'foreignKey':_0x9e89('0x1da'),'as':_0x9e89('0x1db')});db[_0x9e89('0xec')]['belongsTo'](db['User'],{'foreignKey':_0x9e89('0x1dc'),'as':_0x9e89('0x1dd')});db[_0x9e89('0xec')][_0x9e89('0x11e')](db['User'],{'foreignKey':'ToUserId','as':_0x9e89('0x1de')});db[_0x9e89('0xec')][_0x9e89('0x11e')](db['MailQueue'],{'foreignKey':_0x9e89('0x1df'),'as':'ToQueue'});db[_0x9e89('0xec')][_0x9e89('0x11e')](db[_0x9e89('0x3b')],{'foreignKey':_0x9e89('0x1e0'),'as':_0x9e89('0x1e1')});db[_0x9e89('0x1e2')][_0x9e89('0x11e')](db['ChatMessage'],{});db[_0x9e89('0x1e2')][_0x9e89('0x11e')](db[_0x9e89('0x119')],{});db[_0x9e89('0x1e2')][_0x9e89('0x11e')](db[_0x9e89('0x133')],{'foreignKey':_0x9e89('0x1e3'),'as':_0x9e89('0x1db')});db[_0x9e89('0x1e2')][_0x9e89('0x11e')](db[_0x9e89('0x10d')],{'foreignKey':_0x9e89('0x1dc'),'as':_0x9e89('0x1dd')});db[_0x9e89('0x1e2')]['belongsTo'](db[_0x9e89('0x10d')],{'foreignKey':'ToUserId','as':_0x9e89('0x1de')});db[_0x9e89('0x1e2')]['belongsTo'](db[_0x9e89('0x12c')],{'foreignKey':_0x9e89('0x1e4'),'as':_0x9e89('0x1e5')});db['ChatTransferReport'][_0x9e89('0x11e')](db[_0x9e89('0x133')],{'foreignKey':_0x9e89('0x1e6'),'as':'ToAccount'});db['FaxTransferReport'][_0x9e89('0x11e')](db['FaxMessage'],{});db[_0x9e89('0xee')][_0x9e89('0x11e')](db[_0x9e89('0x11b')],{});db[_0x9e89('0xee')][_0x9e89('0x11e')](db['FaxAccount'],{'foreignKey':_0x9e89('0x1e7'),'as':_0x9e89('0x1db')});db[_0x9e89('0xee')][_0x9e89('0x11e')](db[_0x9e89('0x10d')],{'foreignKey':'FromUserId','as':_0x9e89('0x1dd')});db[_0x9e89('0xee')][_0x9e89('0x11e')](db[_0x9e89('0x10d')],{'foreignKey':'ToUserId','as':_0x9e89('0x1de')});db['FaxTransferReport'][_0x9e89('0x11e')](db[_0x9e89('0x50')],{'foreignKey':_0x9e89('0x1e8'),'as':_0x9e89('0x1e5')});db['FaxTransferReport'][_0x9e89('0x11e')](db['FaxAccount'],{'foreignKey':_0x9e89('0x1e9'),'as':'ToAccount'});db[_0x9e89('0xf0')][_0x9e89('0x11e')](db['OpenchannelMessage'],{});db['OpenchannelTransferReport'][_0x9e89('0x11e')](db[_0x9e89('0x5d')],{});db[_0x9e89('0xf0')]['belongsTo'](db[_0x9e89('0x5a')],{'foreignKey':_0x9e89('0x1ea'),'as':_0x9e89('0x1db')});db[_0x9e89('0xf0')][_0x9e89('0x11e')](db[_0x9e89('0x10d')],{'foreignKey':_0x9e89('0x1dc'),'as':_0x9e89('0x1dd')});db[_0x9e89('0xf0')]['belongsTo'](db[_0x9e89('0x10d')],{'foreignKey':_0x9e89('0x1eb'),'as':_0x9e89('0x1de')});db[_0x9e89('0xf0')][_0x9e89('0x11e')](db[_0x9e89('0x60')],{'foreignKey':_0x9e89('0x1ec'),'as':_0x9e89('0x1e5')});db[_0x9e89('0xf0')][_0x9e89('0x11e')](db[_0x9e89('0x5a')],{'foreignKey':'ToOpenchannelAccountId','as':_0x9e89('0x1e1')});db[_0x9e89('0xf1')][_0x9e89('0x11e')](db['SmsMessage'],{});db[_0x9e89('0xf1')]['belongsTo'](db[_0x9e89('0x57')],{});db[_0x9e89('0xf1')]['belongsTo'](db['SmsAccount'],{'foreignKey':'FromSmsAccountId','as':_0x9e89('0x1db')});db['SmsTransferReport'][_0x9e89('0x11e')](db[_0x9e89('0x10d')],{'foreignKey':'FromUserId','as':'FromAgent'});db['SmsTransferReport'][_0x9e89('0x11e')](db[_0x9e89('0x10d')],{'foreignKey':'ToUserId','as':_0x9e89('0x1de')});db[_0x9e89('0xf1')][_0x9e89('0x11e')](db[_0x9e89('0x12e')],{'foreignKey':_0x9e89('0x1ed'),'as':_0x9e89('0x1e5')});db[_0x9e89('0xf1')][_0x9e89('0x11e')](db[_0x9e89('0x54')],{'foreignKey':_0x9e89('0x1ee'),'as':_0x9e89('0x1e1')});db['CmList'][_0x9e89('0x112')](db[_0x9e89('0x159')],{'as':_0x9e89('0x15a'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x9e89('0xf3')][_0x9e89('0x112')](db['CmCustomField'],{'as':_0x9e89('0x1ef'),'foreignKey':_0x9e89('0x16f')});db[_0x9e89('0xf3')][_0x9e89('0x112')](db['CmContact'],{'as':'Contacts','onDelete':'cascade','foreignKey':_0x9e89('0x16f')});db[_0x9e89('0xf3')][_0x9e89('0x112')](db[_0x9e89('0x115')],{'as':_0x9e89('0x116'),'foreignKey':'ListId'});db[_0x9e89('0xf3')]['hasMany'](db[_0x9e89('0x117')],{'as':_0x9e89('0x1f0'),'foreignKey':_0x9e89('0x16f')});db[_0x9e89('0xf3')][_0x9e89('0x112')](db['ReportAgentPreview'],{'as':_0x9e89('0x77'),'foreignKey':'ListId'});db[_0x9e89('0xf3')][_0x9e89('0x11f')](db[_0x9e89('0x1b')],{'as':_0x9e89('0x1f1'),'through':_0x9e89('0x1f2')});db['CmList']['belongsToMany'](db['User'],{'as':_0x9e89('0x162'),'through':_0x9e89('0x132')});db[_0x9e89('0xf5')][_0x9e89('0x112')](db['VoiceExtension'],{'as':_0x9e89('0x1f3'),'onDelete':_0x9e89('0x111')});db[_0x9e89('0xf5')][_0x9e89('0x11f')](db[_0x9e89('0x10d')],{'as':'Agents','through':_0x9e89('0x10a')});db[_0x9e89('0xf5')][_0x9e89('0x11f')](db[_0x9e89('0xe2')],{'through':_0x9e89('0x108'),'as':_0x9e89('0x147')});db[_0x9e89('0xf7')][_0x9e89('0x112')](db[_0x9e89('0x10d')],{'as':'Users','foreignKey':_0x9e89('0x1f4')});db[_0x9e89('0xf7')]['hasMany'](db['UserProfileSection'],{'as':_0x9e89('0x1f5'),'foreignKey':_0x9e89('0x1f4'),'onDelete':_0x9e89('0x111')});db[_0x9e89('0x1f6')][_0x9e89('0x112')](db['UserProfileResource'],{'as':_0x9e89('0x1f7'),'foreignKey':_0x9e89('0x1f8'),'onDelete':'cascade'});db['WhatsappAccount'][_0x9e89('0x112')](db[_0x9e89('0x159')],{'as':_0x9e89('0x15a'),'foreignKey':_0x9e89('0x1f9'),'onDelete':_0x9e89('0x111')});db[_0x9e89('0xfc')][_0x9e89('0x112')](db['CannedAnswer'],{'as':_0x9e89('0x15b'),'foreignKey':_0x9e89('0x1f9')});db[_0x9e89('0xfc')][_0x9e89('0x112')](db['WhatsappMessage'],{'as':_0x9e89('0x14a'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x9e89('0x112')](db[_0x9e89('0xff')],{'as':_0x9e89('0x15c')});db[_0x9e89('0xfc')][_0x9e89('0x112')](db[_0x9e89('0xfd')],{'as':'Applications'});db[_0x9e89('0xfc')]['belongsTo'](db[_0x9e89('0xf3')],{'as':_0x9e89('0x15e'),'foreignKey':_0x9e89('0x16f')});db[_0x9e89('0xfc')][_0x9e89('0x11e')](db['Pause'],{'as':_0x9e89('0x160'),'foreignKey':_0x9e89('0x161')});db[_0x9e89('0xfc')]['belongsToMany'](db[_0x9e89('0x10d')],{'as':_0x9e89('0x162'),'through':_0x9e89('0x1fa')});db[_0x9e89('0xfd')][_0x9e89('0x11e')](db[_0x9e89('0x10d')],{'onDelete':_0x9e89('0x156')});db[_0x9e89('0xfd')][_0x9e89('0x11e')](db['WhatsappQueue'],{'onDelete':'restrict'});db[_0x9e89('0xfd')]['belongsTo'](db[_0x9e89('0xfc')],{'onDelete':_0x9e89('0x156')});db[_0x9e89('0xfd')][_0x9e89('0x11e')](db[_0x9e89('0x83')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x9e89('0xfd')][_0x9e89('0x11e')](db[_0x9e89('0x8c')],{'onDelete':_0x9e89('0x156'),'foreignKey':_0x9e89('0x16e')});db['WhatsappInteraction']['hasMany'](db[_0x9e89('0x1fb')],{'as':'Messages','onDelete':_0x9e89('0x111'),'foreignKey':_0x9e89('0x1fc')});db[_0x9e89('0xff')][_0x9e89('0x11e')](db['WhatsappAccount'],{'as':'Account','foreignKey':_0x9e89('0x1f9')});db[_0x9e89('0xff')][_0x9e89('0x11e')](db[_0x9e89('0x6f')],{'as':_0x9e89('0x166'),'foreignKey':_0x9e89('0x152')});db[_0x9e89('0xff')][_0x9e89('0x11e')](db[_0x9e89('0x10d')],{'as':'Owner','foreignKey':'UserId'});db[_0x9e89('0xff')]['belongsToMany'](db[_0x9e89('0x8c')],{'through':_0x9e89('0x1a5'),'as':'Tags'});db[_0x9e89('0xff')][_0x9e89('0x11f')](db[_0x9e89('0x8c')],{'through':'whatsapp_interaction_has_tags','as':_0x9e89('0x176')});db['WhatsappInteraction']['belongsToMany'](db[_0x9e89('0x10d')],{'as':_0x9e89('0x16a'),'through':_0x9e89('0x128'),'foreignKey':_0x9e89('0x1fc')});db['WhatsappMessage'][_0x9e89('0x11e')](db[_0x9e89('0x10d')],{'as':_0x9e89('0x10d')});db[_0x9e89('0x1fb')]['belongsTo'](db[_0x9e89('0x6f')],{'onDelete':_0x9e89('0x111'),'as':_0x9e89('0x166')});db[_0x9e89('0x1fb')][_0x9e89('0x11e')](db['WhatsappInteraction'],{'onDelete':_0x9e89('0x111'),'as':_0x9e89('0x177'),'foreignKey':'WhatsappInteractionId'});db[_0x9e89('0x1fb')]['belongsTo'](db['WhatsappAccount'],{'as':'Account','foreignKey':_0x9e89('0x1f9')});db[_0x9e89('0x101')][_0x9e89('0x11e')](db['WhatsappAccount'],{});db[_0x9e89('0x101')][_0x9e89('0x11e')](db[_0x9e89('0xf3')],{'as':_0x9e89('0x15e'),'foreignKey':_0x9e89('0x16f')});db[_0x9e89('0x101')]['belongsTo'](db['CmContact'],{'as':_0x9e89('0x166'),'foreignKey':_0x9e89('0x152')});db['WhatsappQueueReport'][_0x9e89('0x11e')](db['WhatsappInteraction'],{});db['WhatsappQueueReport'][_0x9e89('0x11e')](db[_0x9e89('0x105')],{});db[_0x9e89('0x101')][_0x9e89('0x11e')](db['WhatsappMessage'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x9e89('0x10d')],{});db[_0x9e89('0x103')][_0x9e89('0x11e')](db[_0x9e89('0x1fb')],{});db[_0x9e89('0x103')][_0x9e89('0x11e')](db['WhatsappInteraction'],{});db[_0x9e89('0x103')][_0x9e89('0x11e')](db[_0x9e89('0xfc')],{'foreignKey':_0x9e89('0x1fd'),'as':'FromAccount'});db[_0x9e89('0x103')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':'ToWhatsappAccountId','as':'ToAccount'});db[_0x9e89('0x103')][_0x9e89('0x11e')](db[_0x9e89('0x105')],{'foreignKey':_0x9e89('0x1fe'),'as':_0x9e89('0x1e5')});db[_0x9e89('0x103')][_0x9e89('0x11e')](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db['WhatsappTransferReport'][_0x9e89('0x11e')](db[_0x9e89('0x10d')],{'foreignKey':_0x9e89('0x1eb'),'as':_0x9e89('0x1de')});db[_0x9e89('0x105')][_0x9e89('0x11f')](db[_0x9e89('0x10d')],{'as':_0x9e89('0x162'),'through':_0x9e89('0x131'),'foreignKey':_0x9e89('0x1ff')});db['WhatsappQueue'][_0x9e89('0x11f')](db[_0x9e89('0xe2')],{'through':_0x9e89('0x200'),'as':_0x9e89('0x147')});db[_0x9e89('0x110')][_0x9e89('0x11e')](db[_0x9e89('0x10d')],{'as':_0x9e89('0x201'),'foreignKey':'UserId','onDelete':_0x9e89('0x111'),'hooks':!![]});db['CloudProvider'][_0x9e89('0x10f')](db['Dynamics365Account'],{'as':_0x9e89('0xc2'),'onDelete':'restrict'});db[_0x9e89('0x154')][_0x9e89('0x10f')](db[_0x9e89('0x38')],{'as':_0x9e89('0x157'),'onDelete':_0x9e89('0x156')});db[_0x9e89('0x154')][_0x9e89('0x10f')](db[_0x9e89('0x39')],{'as':'Smtp','onDelete':_0x9e89('0x156')});module[_0x9e89('0x202')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 66dde23..a4c5408 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b1d=['/api/pm2','/api/webbar','./api/webbar','/apidoc','join','root','/www','static','/demo','/snippet','snippet','3.1.0','/plugins','route','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','setupLoggers','default','use','/api/users','./api/user','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/actions','./api/automation','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/desk/accounts','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/configurations','/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/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/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./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/chatTransferReport','/api/fax/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','/api/system','./api/system'];(function(_0x36909d,_0x2795f1){var _0x1fd29d=function(_0x27d0fa){while(--_0x27d0fa){_0x36909d['push'](_0x36909d['shift']());}};_0x1fd29d(++_0x2795f1);}(_0x0b1d,0x127));var _0xd0b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b1d[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0xd0b1('0x0'));var express=require(_0xd0b1('0x1'));var errors=require(_0xd0b1('0x2'));var config=require(_0xd0b1('0x3'));var setupLoggers=require('./utils/client-side-logger')[_0xd0b1('0x4')];var clientSideLogs=require('./api/client-side-logs');exports[_0xd0b1('0x5')]=function(_0x131c2e){return setupLoggers(_0x131c2e)['then'](function(){_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x7'),require(_0xd0b1('0x8')));_0x131c2e[_0xd0b1('0x6')]('/api/voice/chanspy',require('./api/voiceChanSpy'));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x9'),require(_0xd0b1('0xa')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xb'),require(_0xd0b1('0xc')));_0x131c2e['use'](_0xd0b1('0xd'),require(_0xd0b1('0xe')));_0x131c2e[_0xd0b1('0x6')]('/api/voice/queues',require(_0xd0b1('0xf')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x10'),require(_0xd0b1('0x11')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x12'),require(_0xd0b1('0x13')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x14'),require(_0xd0b1('0x15')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x16'),require('./api/voiceMailMessage'));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x17'),require(_0xd0b1('0x18')));_0x131c2e['use'](_0xd0b1('0x19'),require('./api/voiceDialReport'));_0x131c2e[_0xd0b1('0x6')]('/api/voice/agents/reports',require(_0xd0b1('0x1a')));_0x131c2e['use'](_0xd0b1('0x1b'),require(_0xd0b1('0x1c')));_0x131c2e[_0xd0b1('0x6')]('/api/members/reports',require('./api/memberReport'));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x1d'),require(_0xd0b1('0x1e')));_0x131c2e[_0xd0b1('0x6')]('/api/voice/transfers/reports',require(_0xd0b1('0x1f')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x20'),require(_0xd0b1('0x21')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x22'),require(_0xd0b1('0x23')));_0x131c2e['use'](_0xd0b1('0x24'),require('./api/mailQueue'));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x25'),require(_0xd0b1('0x26')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x27'),require(_0xd0b1('0x28')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x29'),require(_0xd0b1('0x2a')));_0x131c2e['use'](_0xd0b1('0x2b'),require(_0xd0b1('0x2c')));_0x131c2e[_0xd0b1('0x6')]('/api/mail/reports/queue',require('./api/mailQueueReport'));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x2d'),require(_0xd0b1('0x2e')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x2f'),require('./api/dashboardItem'));_0x131c2e['use'](_0xd0b1('0x30'),require(_0xd0b1('0x31')));_0x131c2e[_0xd0b1('0x6')]('/api/fax/applications',require(_0xd0b1('0x32')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x33'),require(_0xd0b1('0x34')));_0x131c2e['use'](_0xd0b1('0x35'),require(_0xd0b1('0x36')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x37'),require('./api/faxQueue'));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x38'),require(_0xd0b1('0x39')));_0x131c2e[_0xd0b1('0x6')]('/api/sms/accounts',require('./api/smsAccount'));_0x131c2e[_0xd0b1('0x6')]('/api/sms/applications',require('./api/smsApplication'));_0x131c2e['use'](_0xd0b1('0x3a'),require('./api/smsInteraction'));_0x131c2e['use'](_0xd0b1('0x3b'),require(_0xd0b1('0x3c')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x3d'),require('./api/smsQueue'));_0x131c2e['use']('/api/openchannel/accounts',require(_0xd0b1('0x3e')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x3f'),require(_0xd0b1('0x40')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x41'),require('./api/openchannelInteraction'));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x42'),require('./api/openchannelMessage'));_0x131c2e['use'](_0xd0b1('0x43'),require(_0xd0b1('0x44')));_0x131c2e[_0xd0b1('0x6')]('/api/chat/websites',require(_0xd0b1('0x45')));_0x131c2e['use'](_0xd0b1('0x46'),require(_0xd0b1('0x47')));_0x131c2e['use'](_0xd0b1('0x48'),require(_0xd0b1('0x49')));_0x131c2e[_0xd0b1('0x6')]('/api/chat/interactions',require('./api/chatInteraction'));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x4a'),require(_0xd0b1('0x4b')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x4c'),require(_0xd0b1('0x4d')));_0x131c2e['use']('/api/chat/queues',require(_0xd0b1('0x4e')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x4f'),require(_0xd0b1('0x50')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x51'),require('./api/chatProactiveAction'));_0x131c2e['use'](_0xd0b1('0x52'),require(_0xd0b1('0x53')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x54'),require(_0xd0b1('0x55')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x56'),require(_0xd0b1('0x57')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x58'),require(_0xd0b1('0x59')));_0x131c2e['use']('/api/cm/hopper_final',require(_0xd0b1('0x5a')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x5b'),require(_0xd0b1('0x5c')));_0x131c2e[_0xd0b1('0x6')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x5d'),require('./api/action'));_0x131c2e[_0xd0b1('0x6')]('/api/automations',require(_0xd0b1('0x5e')));_0x131c2e[_0xd0b1('0x6')]('/api/canned_answers',require('./api/cannedAnswer'));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x5f'),require(_0xd0b1('0x60')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x61'),require(_0xd0b1('0x62')));_0x131c2e[_0xd0b1('0x6')]('/api/intervals',require(_0xd0b1('0x63')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x64'),require(_0xd0b1('0x65')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x66'),require(_0xd0b1('0x67')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x68'),require(_0xd0b1('0x69')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x6a'),require(_0xd0b1('0x6b')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x6c'),require(_0xd0b1('0x6d')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x6e'),require('./api/tag'));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x6f'),require(_0xd0b1('0x70')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x71'),require(_0xd0b1('0x72')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x73'),require(_0xd0b1('0x74')));_0x131c2e[_0xd0b1('0x6')]('/api/templates',require('./api/template'));_0x131c2e['use']('/api/triggers',require('./api/trigger'));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x75'),require(_0xd0b1('0x76')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x77'),require(_0xd0b1('0x78')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x79'),require('./api/integrationReport'));_0x131c2e[_0xd0b1('0x6')]('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x7a'),require('./api/analyticDefaultReport'));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x7b'),require(_0xd0b1('0x7c')));_0x131c2e['use'](_0xd0b1('0x7d'),require(_0xd0b1('0x7e')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x7f'),require(_0xd0b1('0x80')));_0x131c2e[_0xd0b1('0x6')]('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x131c2e['use'](_0xd0b1('0x81'),require(_0xd0b1('0x82')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x83'),require(_0xd0b1('0x84')));_0x131c2e[_0xd0b1('0x6')]('/api/integrations/salesforce/fields',require(_0xd0b1('0x85')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x86'),require(_0xd0b1('0x87')));_0x131c2e['use']('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0x131c2e[_0xd0b1('0x6')]('/api/integrations/sugarcrm/fields',require('./api/intSugarcrmField'));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x88'),require('./api/intDeskAccount'));_0x131c2e[_0xd0b1('0x6')]('/api/integrations/desk/configurations',require(_0xd0b1('0x89')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x8a'),require(_0xd0b1('0x8b')));_0x131c2e['use'](_0xd0b1('0x8c'),require(_0xd0b1('0x8d')));_0x131c2e['use'](_0xd0b1('0x8e'),require(_0xd0b1('0x8f')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x90'),require(_0xd0b1('0x91')));_0x131c2e['use'](_0xd0b1('0x92'),require('./api/intZendeskAccount'));_0x131c2e[_0xd0b1('0x6')]('/api/integrations/zendesk/configurations',require(_0xd0b1('0x93')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x94'),require(_0xd0b1('0x95')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x96'),require(_0xd0b1('0x97')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x98'),require(_0xd0b1('0x99')));_0x131c2e['use'](_0xd0b1('0x9a'),require('./api/intFreshdeskField'));_0x131c2e[_0xd0b1('0x6')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x9b'),require('./api/intVtigerConfiguration'));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x9c'),require(_0xd0b1('0x9d')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x9e'),require(_0xd0b1('0x9f')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xa0'),require(_0xd0b1('0xa1')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xa2'),require(_0xd0b1('0xa3')));_0x131c2e[_0xd0b1('0x6')]('/api/integrations/dynamics365/accounts',require(_0xd0b1('0xa4')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xa5'),require(_0xd0b1('0xa6')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xa7'),require(_0xd0b1('0xa8')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xa9'),require(_0xd0b1('0xaa')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xab'),require(_0xd0b1('0xac')));_0x131c2e['use'](_0xd0b1('0xad'),require(_0xd0b1('0xae')));_0x131c2e[_0xd0b1('0x6')]('/api/networks',require(_0xd0b1('0xaf')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xb0'),require(_0xd0b1('0xb1')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xb2'),require(_0xd0b1('0xb3')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xb4'),require(_0xd0b1('0xb5')));_0x131c2e['use']('/api/jscripty/questions/reports',require(_0xd0b1('0xb6')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xb7'),require(_0xd0b1('0xb8')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xb9'),require(_0xd0b1('0xba')));_0x131c2e['use'](_0xd0b1('0xbb'),require('./api/squareReport'));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xbc'),require(_0xd0b1('0xbd')));_0x131c2e['use'](_0xd0b1('0xbe'),require(_0xd0b1('0xbf')));_0x131c2e['use'](_0xd0b1('0xc0'),require(_0xd0b1('0xc1')));_0x131c2e['use'](_0xd0b1('0xc2'),require(_0xd0b1('0xc3')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xc4'),require(_0xd0b1('0xc5')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xc6'),require(_0xd0b1('0xc7')));_0x131c2e[_0xd0b1('0x6')]('/api/square/messages',require(_0xd0b1('0xc8')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xc9'),require(_0xd0b1('0xca')));_0x131c2e[_0xd0b1('0x6')]('/api/license',require(_0xd0b1('0xcb')));_0x131c2e['use'](_0xd0b1('0xcc'),require(_0xd0b1('0xcd')));_0x131c2e['use'](_0xd0b1('0xce'),require(_0xd0b1('0xcf')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xd0'),require(_0xd0b1('0xd1')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xd2'),require(_0xd0b1('0xd3')));_0x131c2e[_0xd0b1('0x6')]('/api/mail/reports/transfer',require(_0xd0b1('0xd4')));_0x131c2e[_0xd0b1('0x6')]('/api/chat/reports/transfer',require(_0xd0b1('0xd5')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xd6'),require('./api/faxTransferReport'));_0x131c2e['use']('/api/openchannel/reports/transfer',require(_0xd0b1('0xd7')));_0x131c2e['use'](_0xd0b1('0xd8'),require(_0xd0b1('0xd9')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xda'),require(_0xd0b1('0xdb')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xdc'),require(_0xd0b1('0xdd')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xde'),require(_0xd0b1('0xdf')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xe0'),require(_0xd0b1('0xe1')));_0x131c2e['use'](_0xd0b1('0xe2'),require(_0xd0b1('0xe3')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xe4'),require('./api/userNotification'));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xe5'),require('./api/whatsappAccount'));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xe6'),require(_0xd0b1('0xe7')));_0x131c2e['use'](_0xd0b1('0xe8'),require('./api/whatsappInteraction'));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xe9'),require(_0xd0b1('0xea')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xeb'),require(_0xd0b1('0xec')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xed'),require(_0xd0b1('0xee')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xef'),require(_0xd0b1('0xf0')));_0x131c2e['use']('/api/cloudProviders',require('./api/cloudProvider'));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xf1'),require(_0xd0b1('0xf2')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xf3'),require(_0xd0b1('0xf4')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xf5'),require(_0xd0b1('0xf6')));_0x131c2e[_0xd0b1('0x6')]('/api/auth/google',require(_0xd0b1('0xf7')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xf8'),require(_0xd0b1('0xf9')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xfa'),require(_0xd0b1('0xfb')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0xfc'),require('./api/rpc'));_0x131c2e['use'](_0xd0b1('0xfd'),require(_0xd0b1('0xfe')));_0x131c2e['use'](_0xd0b1('0xff'),require(_0xd0b1('0x100')));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x101'),require('./api/pm2'));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x102'),require(_0xd0b1('0x103')));_0x131c2e['use']('/api/logs',clientSideLogs);_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x104'),express['static'](path[_0xd0b1('0x105')](config[_0xd0b1('0x106')],_0xd0b1('0x104'))));_0x131c2e['use'](_0xd0b1('0x107'),express[_0xd0b1('0x108')](path[_0xd0b1('0x105')](config[_0xd0b1('0x106')],_0xd0b1('0x107'))));_0x131c2e[_0xd0b1('0x6')]('/demo',express[_0xd0b1('0x108')](path[_0xd0b1('0x105')](config[_0xd0b1('0x106')],_0xd0b1('0x109'))));_0x131c2e['use'](_0xd0b1('0x10a'),express['static'](path[_0xd0b1('0x105')](config[_0xd0b1('0x106')],_0xd0b1('0x10b'),_0xd0b1('0x10c'))));_0x131c2e[_0xd0b1('0x6')](_0xd0b1('0x10d'),express['static'](path[_0xd0b1('0x105')](config[_0xd0b1('0x106')],'/server/files/plugins')));_0x131c2e[_0xd0b1('0x10e')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xd0b1('0x10f')](errors[0x194]);_0x131c2e[_0xd0b1('0x10e')]('/*')[_0xd0b1('0x10f')](function(_0x120330,_0x1d741d){_0x1d741d[_0xd0b1('0x110')](path[_0xd0b1('0x111')](_0x131c2e[_0xd0b1('0x10f')](_0xd0b1('0x112'))+_0xd0b1('0x113')));});return _0x131c2e;});}; \ No newline at end of file +var _0x7800=['/api/variables','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareMessage','/api/teams','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','./api/authActiveDirectory','/api/jira','/api/version','./api/version','/api/system','./api/system','./api/pm2','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.1.0','/server/files/plugins','route','get','sendFile','resolve','appPath','express','./config/environment','./utils/client-side-logger','setupLoggers','then','/api/users','./api/user','use','./api/voiceChanSpy','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./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/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxQueue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/tags','./api/tag','./api/contactItemType','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/triggers','./api/trigger'];(function(_0x3888bc,_0x3539a2){var _0x59d7c1=function(_0x2bb104){while(--_0x2bb104){_0x3888bc['push'](_0x3888bc['shift']());}};_0x59d7c1(++_0x3539a2);}(_0x7800,0x98));var _0x0780=function(_0x263c0d,_0x42fd26){_0x263c0d=_0x263c0d-0x0;var _0xeb8e1c=_0x7800[_0x263c0d];return _0xeb8e1c;};'use strict';var path=require('path');var express=require(_0x0780('0x0'));var errors=require('./errors');var config=require(_0x0780('0x1'));var setupLoggers=require(_0x0780('0x2'))[_0x0780('0x3')];var clientSideLogs=require('./api/client-side-logs');exports['default']=function(_0x5748e7){return setupLoggers(_0x5748e7)[_0x0780('0x4')](function(){_0x5748e7['use'](_0x0780('0x5'),require(_0x0780('0x6')));_0x5748e7[_0x0780('0x7')]('/api/voice/chanspy',require(_0x0780('0x8')));_0x5748e7[_0x0780('0x7')]('/api/voice/contexts',require('./api/voiceContext'));_0x5748e7[_0x0780('0x7')](_0x0780('0x9'),require('./api/voiceExtension'));_0x5748e7[_0x0780('0x7')](_0x0780('0xa'),require(_0x0780('0xb')));_0x5748e7[_0x0780('0x7')](_0x0780('0xc'),require(_0x0780('0xd')));_0x5748e7[_0x0780('0x7')]('/api/voice/recordings',require('./api/voiceRecording'));_0x5748e7[_0x0780('0x7')](_0x0780('0xe'),require(_0x0780('0xf')));_0x5748e7[_0x0780('0x7')](_0x0780('0x10'),require(_0x0780('0x11')));_0x5748e7['use'](_0x0780('0x12'),require(_0x0780('0x13')));_0x5748e7['use'](_0x0780('0x14'),require(_0x0780('0x15')));_0x5748e7['use']('/api/voice/dials/reports',require(_0x0780('0x16')));_0x5748e7[_0x0780('0x7')](_0x0780('0x17'),require('./api/voiceAgentReport'));_0x5748e7[_0x0780('0x7')](_0x0780('0x18'),require(_0x0780('0x19')));_0x5748e7['use'](_0x0780('0x1a'),require(_0x0780('0x1b')));_0x5748e7['use'](_0x0780('0x1c'),require(_0x0780('0x1d')));_0x5748e7['use'](_0x0780('0x1e'),require('./api/voiceTransferReport'));_0x5748e7[_0x0780('0x7')]('/api/mail/out_servers',require(_0x0780('0x1f')));_0x5748e7[_0x0780('0x7')](_0x0780('0x20'),require(_0x0780('0x21')));_0x5748e7[_0x0780('0x7')](_0x0780('0x22'),require(_0x0780('0x23')));_0x5748e7[_0x0780('0x7')](_0x0780('0x24'),require(_0x0780('0x25')));_0x5748e7['use'](_0x0780('0x26'),require(_0x0780('0x27')));_0x5748e7[_0x0780('0x7')]('/api/mail/messages',require(_0x0780('0x28')));_0x5748e7[_0x0780('0x7')]('/api/mail/applications',require('./api/mailApplication'));_0x5748e7['use'](_0x0780('0x29'),require(_0x0780('0x2a')));_0x5748e7[_0x0780('0x7')](_0x0780('0x2b'),require(_0x0780('0x2c')));_0x5748e7[_0x0780('0x7')](_0x0780('0x2d'),require(_0x0780('0x2e')));_0x5748e7[_0x0780('0x7')](_0x0780('0x2f'),require(_0x0780('0x30')));_0x5748e7[_0x0780('0x7')](_0x0780('0x31'),require(_0x0780('0x32')));_0x5748e7[_0x0780('0x7')](_0x0780('0x33'),require(_0x0780('0x34')));_0x5748e7[_0x0780('0x7')]('/api/fax/messages',require('./api/faxMessage'));_0x5748e7[_0x0780('0x7')]('/api/fax/queues',require(_0x0780('0x35')));_0x5748e7[_0x0780('0x7')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x5748e7['use'](_0x0780('0x36'),require(_0x0780('0x37')));_0x5748e7[_0x0780('0x7')](_0x0780('0x38'),require('./api/smsApplication'));_0x5748e7[_0x0780('0x7')](_0x0780('0x39'),require(_0x0780('0x3a')));_0x5748e7[_0x0780('0x7')](_0x0780('0x3b'),require(_0x0780('0x3c')));_0x5748e7['use'](_0x0780('0x3d'),require('./api/smsQueue'));_0x5748e7[_0x0780('0x7')]('/api/openchannel/accounts',require(_0x0780('0x3e')));_0x5748e7[_0x0780('0x7')](_0x0780('0x3f'),require('./api/openchannelApplication'));_0x5748e7[_0x0780('0x7')](_0x0780('0x40'),require('./api/openchannelInteraction'));_0x5748e7[_0x0780('0x7')](_0x0780('0x41'),require(_0x0780('0x42')));_0x5748e7[_0x0780('0x7')](_0x0780('0x43'),require(_0x0780('0x44')));_0x5748e7[_0x0780('0x7')](_0x0780('0x45'),require(_0x0780('0x46')));_0x5748e7[_0x0780('0x7')](_0x0780('0x47'),require(_0x0780('0x48')));_0x5748e7[_0x0780('0x7')](_0x0780('0x49'),require(_0x0780('0x4a')));_0x5748e7['use'](_0x0780('0x4b'),require(_0x0780('0x4c')));_0x5748e7[_0x0780('0x7')]('/api/chat/messages',require(_0x0780('0x4d')));_0x5748e7[_0x0780('0x7')]('/api/chat/offline_messages',require('./api/chatOfflineMessage'));_0x5748e7[_0x0780('0x7')](_0x0780('0x4e'),require(_0x0780('0x4f')));_0x5748e7[_0x0780('0x7')](_0x0780('0x50'),require(_0x0780('0x51')));_0x5748e7[_0x0780('0x7')]('/api/chat/proactive_actions',require(_0x0780('0x52')));_0x5748e7[_0x0780('0x7')]('/api/cm/companies',require(_0x0780('0x53')));_0x5748e7[_0x0780('0x7')](_0x0780('0x54'),require(_0x0780('0x55')));_0x5748e7[_0x0780('0x7')](_0x0780('0x56'),require(_0x0780('0x57')));_0x5748e7['use']('/api/cm/hopper_black',require('./api/cmHopperBlack'));_0x5748e7['use'](_0x0780('0x58'),require(_0x0780('0x59')));_0x5748e7[_0x0780('0x7')]('/api/cm/hopper_history',require(_0x0780('0x5a')));_0x5748e7['use'](_0x0780('0x5b'),require('./api/cmCustomField'));_0x5748e7['use'](_0x0780('0x5c'),require(_0x0780('0x5d')));_0x5748e7[_0x0780('0x7')](_0x0780('0x5e'),require(_0x0780('0x5f')));_0x5748e7['use']('/api/canned_answers',require(_0x0780('0x60')));_0x5748e7['use'](_0x0780('0x61'),require(_0x0780('0x62')));_0x5748e7['use'](_0x0780('0x63'),require(_0x0780('0x64')));_0x5748e7[_0x0780('0x7')](_0x0780('0x65'),require('./api/interval'));_0x5748e7[_0x0780('0x7')](_0x0780('0x66'),require(_0x0780('0x67')));_0x5748e7[_0x0780('0x7')](_0x0780('0x68'),require('./api/cdr'));_0x5748e7[_0x0780('0x7')](_0x0780('0x69'),require('./api/voiceQueuesLog'));_0x5748e7[_0x0780('0x7')](_0x0780('0x6a'),require(_0x0780('0x6b')));_0x5748e7[_0x0780('0x7')]('/api/sounds',require('./api/sound'));_0x5748e7['use'](_0x0780('0x6c'),require(_0x0780('0x6d')));_0x5748e7['use']('/api/contact_item_types',require(_0x0780('0x6e')));_0x5748e7[_0x0780('0x7')]('/api/cm_contact_has_items',require(_0x0780('0x6f')));_0x5748e7['use'](_0x0780('0x70'),require(_0x0780('0x71')));_0x5748e7[_0x0780('0x7')]('/api/templates',require('./api/template'));_0x5748e7[_0x0780('0x7')](_0x0780('0x72'),require(_0x0780('0x73')));_0x5748e7['use'](_0x0780('0x74'),require('./api/variable'));_0x5748e7[_0x0780('0x7')]('/api/integrations',require(_0x0780('0x75')));_0x5748e7[_0x0780('0x7')](_0x0780('0x76'),require('./api/integrationReport'));_0x5748e7[_0x0780('0x7')](_0x0780('0x77'),require(_0x0780('0x78')));_0x5748e7[_0x0780('0x7')]('/api/analytics/default_reports',require(_0x0780('0x79')));_0x5748e7[_0x0780('0x7')]('/api/analytics/extracted_reports',require(_0x0780('0x7a')));_0x5748e7[_0x0780('0x7')]('/api/analytics/metrics',require(_0x0780('0x7b')));_0x5748e7[_0x0780('0x7')](_0x0780('0x7c'),require(_0x0780('0x7d')));_0x5748e7[_0x0780('0x7')]('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x5748e7[_0x0780('0x7')]('/api/integrations/salesforce/accounts',require(_0x0780('0x7e')));_0x5748e7[_0x0780('0x7')](_0x0780('0x7f'),require(_0x0780('0x80')));_0x5748e7['use'](_0x0780('0x81'),require(_0x0780('0x82')));_0x5748e7['use'](_0x0780('0x83'),require(_0x0780('0x84')));_0x5748e7['use']('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0x5748e7[_0x0780('0x7')]('/api/integrations/sugarcrm/fields',require(_0x0780('0x85')));_0x5748e7['use'](_0x0780('0x86'),require(_0x0780('0x87')));_0x5748e7[_0x0780('0x7')](_0x0780('0x88'),require('./api/intDeskConfiguration'));_0x5748e7[_0x0780('0x7')](_0x0780('0x89'),require(_0x0780('0x8a')));_0x5748e7[_0x0780('0x7')](_0x0780('0x8b'),require(_0x0780('0x8c')));_0x5748e7[_0x0780('0x7')](_0x0780('0x8d'),require(_0x0780('0x8e')));_0x5748e7[_0x0780('0x7')](_0x0780('0x8f'),require(_0x0780('0x90')));_0x5748e7[_0x0780('0x7')](_0x0780('0x91'),require('./api/intZendeskAccount'));_0x5748e7['use'](_0x0780('0x92'),require(_0x0780('0x93')));_0x5748e7['use'](_0x0780('0x94'),require('./api/intZendeskField'));_0x5748e7[_0x0780('0x7')](_0x0780('0x95'),require('./api/intFreshdeskAccount'));_0x5748e7['use'](_0x0780('0x96'),require(_0x0780('0x97')));_0x5748e7[_0x0780('0x7')](_0x0780('0x98'),require('./api/intFreshdeskField'));_0x5748e7['use'](_0x0780('0x99'),require(_0x0780('0x9a')));_0x5748e7[_0x0780('0x7')]('/api/integrations/vtiger/configurations',require(_0x0780('0x9b')));_0x5748e7[_0x0780('0x7')]('/api/integrations/vtiger/fields',require(_0x0780('0x9c')));_0x5748e7['use'](_0x0780('0x9d'),require(_0x0780('0x9e')));_0x5748e7[_0x0780('0x7')](_0x0780('0x9f'),require('./api/intServicenowConfiguration'));_0x5748e7[_0x0780('0x7')](_0x0780('0xa0'),require(_0x0780('0xa1')));_0x5748e7[_0x0780('0x7')](_0x0780('0xa2'),require(_0x0780('0xa3')));_0x5748e7[_0x0780('0x7')](_0x0780('0xa4'),require(_0x0780('0xa5')));_0x5748e7[_0x0780('0x7')](_0x0780('0xa6'),require('./api/intDynamics365Field'));_0x5748e7['use']('/api/integrations/freshsales/accounts',require(_0x0780('0xa7')));_0x5748e7[_0x0780('0x7')](_0x0780('0xa8'),require(_0x0780('0xa9')));_0x5748e7[_0x0780('0x7')](_0x0780('0xaa'),require(_0x0780('0xab')));_0x5748e7['use'](_0x0780('0xac'),require(_0x0780('0xad')));_0x5748e7[_0x0780('0x7')](_0x0780('0xae'),require('./api/chatQueueReport'));_0x5748e7[_0x0780('0x7')](_0x0780('0xaf'),require(_0x0780('0xb0')));_0x5748e7[_0x0780('0x7')](_0x0780('0xb1'),require(_0x0780('0xb2')));_0x5748e7[_0x0780('0x7')](_0x0780('0xb3'),require(_0x0780('0xb4')));_0x5748e7['use'](_0x0780('0xb5'),require(_0x0780('0xb6')));_0x5748e7[_0x0780('0x7')](_0x0780('0xb7'),require(_0x0780('0xb8')));_0x5748e7[_0x0780('0x7')]('/api/square/reports',require(_0x0780('0xb9')));_0x5748e7[_0x0780('0x7')](_0x0780('0xba'),require('./api/squareReportDetail'));_0x5748e7[_0x0780('0x7')](_0x0780('0xbb'),require('./api/jscriptyProject'));_0x5748e7[_0x0780('0x7')](_0x0780('0xbc'),require(_0x0780('0xbd')));_0x5748e7[_0x0780('0x7')](_0x0780('0xbe'),require(_0x0780('0xbf')));_0x5748e7[_0x0780('0x7')](_0x0780('0xc0'),require(_0x0780('0xc1')));_0x5748e7['use'](_0x0780('0xc2'),require('./api/squareRecording'));_0x5748e7[_0x0780('0x7')]('/api/square/messages',require(_0x0780('0xc3')));_0x5748e7[_0x0780('0x7')](_0x0780('0xc4'),require('./api/team'));_0x5748e7[_0x0780('0x7')]('/api/license',require(_0x0780('0xc5')));_0x5748e7[_0x0780('0x7')](_0x0780('0xc6'),require(_0x0780('0xc7')));_0x5748e7[_0x0780('0x7')](_0x0780('0xc8'),require(_0x0780('0xc9')));_0x5748e7[_0x0780('0x7')](_0x0780('0xca'),require(_0x0780('0xcb')));_0x5748e7[_0x0780('0x7')]('/api/plugins',require(_0x0780('0xcc')));_0x5748e7['use'](_0x0780('0xcd'),require(_0x0780('0xce')));_0x5748e7[_0x0780('0x7')](_0x0780('0xcf'),require(_0x0780('0xd0')));_0x5748e7[_0x0780('0x7')]('/api/fax/reports/transfer',require('./api/faxTransferReport'));_0x5748e7[_0x0780('0x7')](_0x0780('0xd1'),require(_0x0780('0xd2')));_0x5748e7['use'](_0x0780('0xd3'),require('./api/smsTransferReport'));_0x5748e7[_0x0780('0x7')](_0x0780('0xd4'),require(_0x0780('0xd5')));_0x5748e7[_0x0780('0x7')](_0x0780('0xd6'),require(_0x0780('0xd7')));_0x5748e7[_0x0780('0x7')]('/api/userProfiles',require('./api/userProfile'));_0x5748e7[_0x0780('0x7')](_0x0780('0xd8'),require(_0x0780('0xd9')));_0x5748e7['use'](_0x0780('0xda'),require(_0x0780('0xdb')));_0x5748e7[_0x0780('0x7')](_0x0780('0xdc'),require(_0x0780('0xdd')));_0x5748e7[_0x0780('0x7')](_0x0780('0xde'),require(_0x0780('0xdf')));_0x5748e7[_0x0780('0x7')]('/api/whatsapp/applications',require(_0x0780('0xe0')));_0x5748e7[_0x0780('0x7')]('/api/whatsapp/interactions',require(_0x0780('0xe1')));_0x5748e7['use'](_0x0780('0xe2'),require(_0x0780('0xe3')));_0x5748e7[_0x0780('0x7')](_0x0780('0xe4'),require(_0x0780('0xe5')));_0x5748e7[_0x0780('0x7')](_0x0780('0xe6'),require(_0x0780('0xe7')));_0x5748e7['use'](_0x0780('0xe8'),require(_0x0780('0xe9')));_0x5748e7[_0x0780('0x7')](_0x0780('0xea'),require(_0x0780('0xeb')));_0x5748e7[_0x0780('0x7')](_0x0780('0xec'),require(_0x0780('0xed')));_0x5748e7['use'](_0x0780('0xee'),require(_0x0780('0xef')));_0x5748e7['use'](_0x0780('0xf0'),require(_0x0780('0xf1')));_0x5748e7[_0x0780('0x7')](_0x0780('0xf2'),require(_0x0780('0xf3')));_0x5748e7[_0x0780('0x7')]('/api/auth/activedirectory',require(_0x0780('0xf4')));_0x5748e7[_0x0780('0x7')](_0x0780('0xf5'),require('./api/jira'));_0x5748e7[_0x0780('0x7')]('/api/rpc',require('./api/rpc'));_0x5748e7[_0x0780('0x7')](_0x0780('0xf6'),require(_0x0780('0xf7')));_0x5748e7[_0x0780('0x7')](_0x0780('0xf8'),require(_0x0780('0xf9')));_0x5748e7['use']('/api/pm2',require(_0x0780('0xfa')));_0x5748e7['use']('/api/webbar',require(_0x0780('0xfb')));_0x5748e7['use'](_0x0780('0xfc'),clientSideLogs);_0x5748e7[_0x0780('0x7')](_0x0780('0xfd'),express[_0x0780('0xfe')](path[_0x0780('0xff')](config[_0x0780('0x100')],_0x0780('0xfd'))));_0x5748e7[_0x0780('0x7')](_0x0780('0x101'),express[_0x0780('0xfe')](path['join'](config[_0x0780('0x100')],_0x0780('0x101'))));_0x5748e7[_0x0780('0x7')](_0x0780('0x102'),express[_0x0780('0xfe')](path[_0x0780('0xff')](config[_0x0780('0x100')],_0x0780('0x102'))));_0x5748e7['use'](_0x0780('0x103'),express['static'](path[_0x0780('0xff')](config['root'],_0x0780('0x104'),_0x0780('0x105'))));_0x5748e7[_0x0780('0x7')]('/plugins',express[_0x0780('0xfe')](path[_0x0780('0xff')](config[_0x0780('0x100')],_0x0780('0x106'))));_0x5748e7[_0x0780('0x107')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x0780('0x108')](errors[0x194]);_0x5748e7['route']('/*')[_0x0780('0x108')](function(_0x424e7e,_0x1dba27){_0x1dba27[_0x0780('0x109')](path[_0x0780('0x10a')](_0x5748e7[_0x0780('0x108')](_0x0780('0x10b'))+'/index.html'));});return _0x5748e7;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 08ea490..8673712 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a9e=['../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/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','error','log','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc'];(function(_0x463a70,_0x13725c){var _0x3c8fe7=function(_0x32a01e){while(--_0x32a01e){_0x463a70['push'](_0x463a70['shift']());}};_0x3c8fe7(++_0x13725c);}(_0x4a9e,0x1ad));var _0xe4a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4a9e[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0xe4a9('0x0'));var _=require(_0xe4a9('0x1'));var config=require(_0xe4a9('0x2'));exports[_0xe4a9('0x3')]=function(){return new Promise(function(_0x5c5cf5,_0x5875b3){var _0x5374dd={};_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x5')));_0x5374dd=_['merge'](_0x5374dd,require(_0xe4a9('0x6')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x7')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x8')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x5374dd=_['merge'](_0x5374dd,require(_0xe4a9('0x9')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x5374dd=_['merge'](_0x5374dd,require(_0xe4a9('0xa')));_0x5374dd=_['merge'](_0x5374dd,require('../api/memberReport/memberReport.rpc'));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0xb')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0xc')));_0x5374dd=_['merge'](_0x5374dd,require(_0xe4a9('0xd')));_0x5374dd=_['merge'](_0x5374dd,require(_0xe4a9('0xe')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0xf')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x10')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x11')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x12')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x13')));_0x5374dd=_['merge'](_0x5374dd,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require('../api/faxAccount/faxAccount.rpc'));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require('../api/faxApplication/faxApplication.rpc'));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require('../api/faxInteraction/faxInteraction.rpc'));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x14')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require('../api/faxQueue/faxQueue.rpc'));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x15')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x16')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require('../api/smsInteraction/smsInteraction.rpc'));_0x5374dd=_['merge'](_0x5374dd,require('../api/smsMessage/smsMessage.rpc'));_0x5374dd=_['merge'](_0x5374dd,require(_0xe4a9('0x17')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x18')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x19')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x1a')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x1b')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require('../api/cmContact/cmContact.rpc'));_0x5374dd=_['merge'](_0x5374dd,require(_0xe4a9('0x1c')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x1d')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x1e')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x1f')));_0x5374dd=_['merge'](_0x5374dd,require(_0xe4a9('0x20')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x21')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x22')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x23')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x24')));_0x5374dd=_['merge'](_0x5374dd,require('../api/trigger/trigger.rpc'));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x25')));_0x5374dd=_['merge'](_0x5374dd,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x5374dd=_['merge'](_0x5374dd,require(_0xe4a9('0x26')));_0x5374dd=_['merge'](_0x5374dd,require(_0xe4a9('0x27')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x28')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x29')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x2a')));_0x5374dd=_['merge'](_0x5374dd,require(_0xe4a9('0x2b')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x2c')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x5374dd=_['merge'](_0x5374dd,require(_0xe4a9('0x2d')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require('../api/squareReport/squareReport.rpc'));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x2e')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require('../api/setting/setting.rpc'));_0x5374dd=_['merge'](_0x5374dd,require('../api/squareOdbc/squareOdbc.rpc'));_0x5374dd=_['merge'](_0x5374dd,require('../api/squareProject/squareProject.rpc'));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x2f')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x30')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require('../api/campaign/campaign.rpc'));_0x5374dd=_['merge'](_0x5374dd,require('../api/attachment/attachment.rpc'));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x31')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x32')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x33')));_0x5374dd=_[_0xe4a9('0x4')](_0x5374dd,require(_0xe4a9('0x34')));_0x5374dd=_['merge'](_0x5374dd,require(_0xe4a9('0x35')));var _0x129468=jayson[_0xe4a9('0x36')](_0x5374dd)['http']();var _0x4755b0=config[_0xe4a9('0x37')][_0xe4a9('0x38')]||config['port']+0x1;var _0x5c0345=config[_0xe4a9('0x37')]['ip']||_0xe4a9('0x39');_0x129468['on'](_0xe4a9('0x3a'),function(_0x5bea5e){return _0x5875b3(_0x5bea5e);});_0x129468[_0xe4a9('0x3')](_0x4755b0,_0x5c0345,function(){console[_0xe4a9('0x3b')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x5c0345,_0x4755b0);require(_0xe4a9('0x3c'))[_0xe4a9('0x3d')]();return _0x5c5cf5(_0xe4a9('0x3e')+_0x5c0345+':'+_0x4755b0);});});}; \ No newline at end of file +var _0x7455=['../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc'];(function(_0x74358,_0x288a67){var _0x3fdb7f=function(_0x19b5ec){while(--_0x19b5ec){_0x74358['push'](_0x74358['shift']());}};_0x3fdb7f(++_0x288a67);}(_0x7455,0x197));var _0x5745=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7455[_0x14add3];return _0x4a174f;};'use strict';var jayson=require('jayson/promise');var _=require(_0x5745('0x0'));var config=require(_0x5745('0x1'));exports[_0x5745('0x2')]=function(){return new Promise(function(_0xf80ddb,_0x3b96dd){var _0x439b69={};_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x4')));_0x439b69=_['merge'](_0x439b69,require(_0x5745('0x5')));_0x439b69=_['merge'](_0x439b69,require(_0x5745('0x6')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x7')));_0x439b69=_['merge'](_0x439b69,require(_0x5745('0x8')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x9')));_0x439b69=_['merge'](_0x439b69,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0xa')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require('../api/memberReport/memberReport.rpc'));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0xb')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0xc')));_0x439b69=_['merge'](_0x439b69,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0xd')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require('../api/mailAccount/mailAccount.rpc'));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0xe')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0xf')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x10')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require('../api/mailApplication/mailApplication.rpc'));_0x439b69=_['merge'](_0x439b69,require(_0x5745('0x11')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require('../api/faxAccount/faxAccount.rpc'));_0x439b69=_['merge'](_0x439b69,require('../api/faxApplication/faxApplication.rpc'));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x12')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require('../api/faxMessage/faxMessage.rpc'));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x13')));_0x439b69=_['merge'](_0x439b69,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x439b69=_[_0x5745('0x3')](_0x439b69,require('../api/smsAccount/smsAccount.rpc'));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x14')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x15')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require('../api/smsQueue/smsQueue.rpc'));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x16')));_0x439b69=_['merge'](_0x439b69,require(_0x5745('0x17')));_0x439b69=_['merge'](_0x439b69,require(_0x5745('0x18')));_0x439b69=_['merge'](_0x439b69,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x19')));_0x439b69=_['merge'](_0x439b69,require('../api/chatInteraction/chatInteraction.rpc'));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x1a')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require('../api/chatQueue/chatQueue.rpc'));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x1b')));_0x439b69=_['merge'](_0x439b69,require(_0x5745('0x1c')));_0x439b69=_['merge'](_0x439b69,require(_0x5745('0x1d')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x1e')));_0x439b69=_['merge'](_0x439b69,require(_0x5745('0x1f')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x439b69=_['merge'](_0x439b69,require('../api/interval/interval.rpc'));_0x439b69=_['merge'](_0x439b69,require(_0x5745('0x20')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x21')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x22')));_0x439b69=_['merge'](_0x439b69,require(_0x5745('0x23')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require('../api/trigger/trigger.rpc'));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x24')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x25')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x26')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x27')));_0x439b69=_['merge'](_0x439b69,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x28')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x29')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x2a')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x2b')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x2c')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x2d')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x439b69=_[_0x5745('0x3')](_0x439b69,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x439b69=_['merge'](_0x439b69,require(_0x5745('0x2e')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x2f')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x30')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x31')));_0x439b69=_['merge'](_0x439b69,require(_0x5745('0x32')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x33')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require('../api/squareMessage/squareMessage.rpc'));_0x439b69=_[_0x5745('0x3')](_0x439b69,require('../api/campaign/campaign.rpc'));_0x439b69=_['merge'](_0x439b69,require('../api/attachment/attachment.rpc'));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x34')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x35')));_0x439b69=_['merge'](_0x439b69,require(_0x5745('0x36')));_0x439b69=_['merge'](_0x439b69,require(_0x5745('0x37')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x38')));_0x439b69=_[_0x5745('0x3')](_0x439b69,require(_0x5745('0x39')));var _0x377cfd=jayson[_0x5745('0x3a')](_0x439b69)['http']();var _0x321ce4=config[_0x5745('0x3b')]['port']||config[_0x5745('0x3c')]+0x1;var _0x4f702d=config[_0x5745('0x3b')]['ip']||_0x5745('0x3d');_0x377cfd['on'](_0x5745('0x3e'),function(_0x7c19a4){return _0x3b96dd(_0x7c19a4);});_0x377cfd[_0x5745('0x2')](_0x321ce4,_0x4f702d,function(){console['log'](_0x5745('0x3f'),_0x4f702d,_0x321ce4);require(_0x5745('0x40'))['default']();return _0xf80ddb(_0x5745('0x41')+_0x4f702d+':'+_0x321ce4);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index d2733e3..2fb6d12 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 _0xdf55=['search','520\x20End\x20of\x20proper','function','substring','no\x20code','replace','indexOf','startsWith','split','length','match','error','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','command','write','prototype','sendRequest','answer','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','format','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','HANGUP','setVariable','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','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','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','lodash','EventEmitter','./reply','call','setEncoding','utf8','setTimeout','headers','emit','ready','toLowerCase','hangup'];(function(_0x2bb24a,_0x9dcdbb){var _0x3efc47=function(_0x2adb76){while(--_0x2adb76){_0x2bb24a['push'](_0x2bb24a['shift']());}};_0x3efc47(++_0x9dcdbb);}(_0xdf55,0x83));var _0x5df5=function(_0x2fb87c,_0x2dee49){_0x2fb87c=_0x2fb87c-0x0;var _0x43038b=_0xdf55[_0x2fb87c];return _0x43038b;};'use strict';var util=require(_0x5df5('0x0'));var _=require(_0x5df5('0x1'));var EventEmitter=require('events')[_0x5df5('0x2')];var AGIReply=require(_0x5df5('0x3'));var AGIError=require('./error');function AGIChannel(_0x3f503b){var _0x773e15=this,_0x381a4c=new AGIReply(),_0x521007=![],_0x289af4={};EventEmitter[_0x5df5('0x4')](_0x773e15);_0x3f503b[_0x5df5('0x5')](_0x5df5('0x6'));_0x3f503b[_0x5df5('0x7')](0x8*0x3c*0x3c*0x3e8);_0x381a4c[_0x5df5('0x5')](_0x5df5('0x6'));_0x381a4c['on'](_0x5df5('0x8'),function(_0x4d43a3){for(var _0x338f2b in _0x4d43a3){_0x773e15[_0x338f2b]=_0x4d43a3[_0x338f2b];}_0x773e15[_0x5df5('0x9')](_0x5df5('0xa'));});_0x381a4c['on']('line',function(_0x52ed26){if(_0x52ed26[_0x5df5('0xb')]()=='hangup'){_0x773e15[_0x5df5('0x9')](_0x5df5('0xc'));return;}if(_0x52ed26['substring'](0x0,0xb)=='520-Invalid'){_0x521007=!![];}if(_0x521007){_0x289af4['rx']+=_0x52ed26+'\x0a';if(_0x52ed26[_0x5df5('0xd')](_0x5df5('0xe'))!=-0x1){_0x521007=![];}}else{_0x289af4['rx']=_0x52ed26;}if(_0x521007){return;}if(typeof _0x289af4['cb']==_0x5df5('0xf')){var _0x4c3d6f=_0x289af4['rx'][_0x5df5('0x10')](0x0,0x3),_0xe8bcd8=null,_0xb4a4fe=null;_0x4c3d6f=parseInt(_0x4c3d6f);if(isNaN(_0x4c3d6f)){_0x289af4['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x5df5('0x11')});return;}if(_0x4c3d6f!=0xc8){_0x289af4['cb'](null,{'code':_0x4c3d6f,'result':-0x1,'extra':'KO'});return;}_0xe8bcd8=_0x289af4['rx'][_0x5df5('0x10')](0x4)[_0x5df5('0x12')]('result=','');if(_0xe8bcd8[_0x5df5('0x13')]('\x20')!=-0x1){_0xe8bcd8=_0xe8bcd8['substr'](0x0,_0xe8bcd8[_0x5df5('0x13')]('\x20'));}if(_[_0x5df5('0x14')](_0xe8bcd8,'-1')){_0xe8bcd8=parseInt(_0xe8bcd8);}_0xb4a4fe=_0x289af4['rx'][_0x5df5('0x15')]('\x20');if(_0xb4a4fe[_0x5df5('0x16')]==0x3){_0xb4a4fe=_0xb4a4fe[0x2][_0x5df5('0x10')](0x1,_0xb4a4fe[0x2]['length']-0x1);}else if(_0xb4a4fe[_0x5df5('0x16')]>0x3){var _0x457205=/\((.+)\)/;var _0x591a19=_0x289af4['rx'][_0x5df5('0x17')](_0x457205);if(_0x591a19){_0xb4a4fe=_0x591a19[0x1];}else{_0xb4a4fe=null;}}else{_0xb4a4fe=null;}_0x289af4['cb'](null,{'code':_0x4c3d6f,'result':_0xe8bcd8,'extra':_0xb4a4fe});}});_0x3f503b['on'](_0x5df5('0x18'),function(_0xb7e1c2){_0x773e15[_0x5df5('0x9')](_0x5df5('0x18'),new AGIError('E_AGI_SOCKET_ERROR',_0xb7e1c2['code']));});_0x3f503b['on'](_0x5df5('0x19'),function(){_0x773e15['emit'](_0x5df5('0x19'),new AGIError(_0x5df5('0x1a')));});_0x3f503b['on'](_0x5df5('0x1b'),function(){_0x773e15[_0x5df5('0x9')](_0x5df5('0x1b'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x3f503b[_0x5df5('0x1c')]();});_0x3f503b[_0x5df5('0x1d')](_0x381a4c);this[_0x5df5('0x1e')]=function(_0x34af1d,_0x28efc8){var _0x34af1d=_0x34af1d||'',_0x28efc8=typeof _0x28efc8==_0x5df5('0xf')?_0x28efc8:new Function();_0x289af4={'tx':_0x34af1d,'rx':'','cb':_0x28efc8};_0x3f503b[_0x5df5('0x1f')](_0x34af1d+'\x0a');},this[_0x5df5('0x19')]=function(){_0x3f503b[_0x5df5('0x1c')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x5df5('0x20')][_0x5df5('0x21')]=function(_0x395f3e){return this['command']['sync'](this,_0x395f3e);};AGIChannel['prototype'][_0x5df5('0x22')]=function(){return this[_0x5df5('0x21')](_0x5df5('0x23'));};AGIChannel[_0x5df5('0x20')][_0x5df5('0x24')]=function(_0x1fd83c,_0x210d20,_0x28723e){_0x1fd83c=_0x1fd83c===undefined?'beep':_0x1fd83c;_0x210d20=_0x210d20===undefined?'5':_0x210d20;_0x28723e=_0x28723e===undefined?'1':_0x28723e;return this[_0x5df5('0x21')](util['format'](_0x5df5('0x25'),_0x1fd83c,_0x210d20*0x3e8,_0x28723e));};AGIChannel[_0x5df5('0x20')]['noop']=function(_0x3854d0){_0x3854d0=_0x3854d0||'NO\x20MESSAGE';return this[_0x5df5('0x21')](util['format'](_0x5df5('0x26'),_0x3854d0));};AGIChannel['prototype'][_0x5df5('0x27')]=function(_0x5793f5,_0x2f91e3){if(_[_0x5df5('0x28')](_0x2f91e3)){return this[_0x5df5('0x21')](util['format'](_0x5df5('0x29'),_0x5793f5,_0x2f91e3[_0x5df5('0x2a')](',')));}return this[_0x5df5('0x21')](util[_0x5df5('0x2b')](_0x5df5('0x29'),_0x5793f5,_0x2f91e3));};AGIChannel[_0x5df5('0x20')][_0x5df5('0x2c')]=function(_0x5b4deb){return this['sendRequest'](util[_0x5df5('0x2b')](_0x5df5('0x2d'),_0x5b4deb));};AGIChannel[_0x5df5('0x20')][_0x5df5('0x2e')]=function(_0x20ee8a){return this[_0x5df5('0x21')](util['format'](_0x5df5('0x2f'),_0x20ee8a));};AGIChannel[_0x5df5('0x20')][_0x5df5('0x30')]=function(_0x3a6b75){return this['sendRequest'](util[_0x5df5('0x2b')]('SET\x20PRIORITY\x20%s',_0x3a6b75));};AGIChannel[_0x5df5('0x20')][_0x5df5('0xc')]=function(){return this['sendRequest'](_0x5df5('0x31'));};AGIChannel['prototype'][_0x5df5('0x32')]=function(_0x44a6d9,_0x4697c2){var _0x120eaf=_['isBoolean'](_0x4697c2)||_[_0x5df5('0x33')](_0x4697c2)?_0x4697c2[_0x5df5('0x34')]():_0x4697c2;return this[_0x5df5('0x21')](util[_0x5df5('0x2b')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x44a6d9,_0x120eaf?_0x120eaf[_0x5df5('0x34')]()[_0x5df5('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x5df5('0x20')][_0x5df5('0x35')]=function(_0x46c501,_0x47f34f){return this[_0x5df5('0x21')](util['format'](_0x5df5('0x36'),_0x46c501,_0x47f34f));};AGIChannel[_0x5df5('0x20')]['sayDigits']=function(_0x690134,_0x217844){return this['sendRequest'](util[_0x5df5('0x2b')](_0x5df5('0x37'),_0x690134,_0x217844));};AGIChannel[_0x5df5('0x20')][_0x5df5('0x38')]=function(_0x235f3e,_0x14949e){return this[_0x5df5('0x21')](util[_0x5df5('0x2b')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x235f3e,_0x14949e));};AGIChannel['prototype'][_0x5df5('0x39')]=function(_0x5b06f4,_0x2f0f06,_0x156a03){_0x2f0f06=_0x2f0f06||this['extension'];_0x156a03=_0x156a03||0x1;this[_0x5df5('0x2c')](_0x5b06f4);this[_0x5df5('0x2e')](_0x2f0f06);this[_0x5df5('0x30')](_0x156a03);return this[_0x5df5('0x3a')](util[_0x5df5('0x2b')](_0x5df5('0x3b'),_0x5b06f4,_0x2f0f06,_0x156a03));};AGIChannel[_0x5df5('0x20')][_0x5df5('0x3c')]=function(_0x5824c3){return this[_0x5df5('0x21')](util['format'](_0x5df5('0x3d'),_0x5824c3));};AGIChannel[_0x5df5('0x20')][_0x5df5('0x3e')]=function(_0x34a8ed,_0x27a11b,_0x4e4b9f,_0x191450,_0x24c1f7,_0x25915f){_0x27a11b=_0x27a11b||'wav';_0x4e4b9f=_0x4e4b9f||'';_0x191450=_0x191450===undefined?-0x1:_0x191450==='-1'?-0x1:_0x191450*0x3e8;_0x24c1f7=_0x24c1f7===undefined?'':'s='+_0x24c1f7;_0x25915f=_0x25915f?_0x5df5('0x3f'):'';return this[_0x5df5('0x21')](util['format'](_0x5df5('0x40'),_0x34a8ed,_0x27a11b,_0x4e4b9f,_0x191450,_0x25915f,_0x24c1f7));};AGIChannel[_0x5df5('0x20')][_0x5df5('0x41')]=function(_0x116ad9,_0x4de416){_0x4de416=_0x4de416||'';return this[_0x5df5('0x21')](util[_0x5df5('0x2b')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x116ad9,_0x4de416));};AGIChannel[_0x5df5('0x20')][_0x5df5('0x42')]=function(_0x35927b){return this['exec'](_0x5df5('0x43'),_0x35927b);};AGIChannel[_0x5df5('0x20')][_0x5df5('0x44')]=function(_0x2724e3){return this['exec'](_0x5df5('0x45'),_0x2724e3);};AGIChannel[_0x5df5('0x20')][_0x5df5('0x18')]=function(_0x3bbb73,_0x14f9ca){this['noop'](util['format'](_0x5df5('0x46'),_0x3bbb73['id'],_0x3bbb73['label'],_0x14f9ca));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x5df5('0x47')]=AGIChannel; \ No newline at end of file +var _0xf39c=['setEncoding','headers','ready','line','toLowerCase','hangup','emit','substring','520-Invalid','520\x20End\x20of\x20proper','function','result=','indexOf','substr','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sendRequest','sync','answer','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','setContext','setExtension','SET\x20EXTENSION\x20%s','HANGUP','setVariable','isBoolean','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','extension','setPriority','noop','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./error','utf8'];(function(_0x1c8412,_0x15456e){var _0xf0f5f1=function(_0x3c4fb7){while(--_0x3c4fb7){_0x1c8412['push'](_0x1c8412['shift']());}};_0xf0f5f1(++_0x15456e);}(_0xf39c,0x16c));var _0xcf39=function(_0x282d96,_0x4f7820){_0x282d96=_0x282d96-0x0;var _0x34a2b1=_0xf39c[_0x282d96];return _0x34a2b1;};'use strict';var util=require(_0xcf39('0x0'));var _=require(_0xcf39('0x1'));var EventEmitter=require(_0xcf39('0x2'))[_0xcf39('0x3')];var AGIReply=require('./reply');var AGIError=require(_0xcf39('0x4'));function AGIChannel(_0x5365f8){var _0x334eb5=this,_0x5dbeeb=new AGIReply(),_0x28b8cb=![],_0x18ddcf={};EventEmitter['call'](_0x334eb5);_0x5365f8['setEncoding'](_0xcf39('0x5'));_0x5365f8['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x5dbeeb[_0xcf39('0x6')](_0xcf39('0x5'));_0x5dbeeb['on'](_0xcf39('0x7'),function(_0x1ff66d){for(var _0x406af6 in _0x1ff66d){_0x334eb5[_0x406af6]=_0x1ff66d[_0x406af6];}_0x334eb5['emit'](_0xcf39('0x8'));});_0x5dbeeb['on'](_0xcf39('0x9'),function(_0x4f5d63){if(_0x4f5d63[_0xcf39('0xa')]()==_0xcf39('0xb')){_0x334eb5[_0xcf39('0xc')](_0xcf39('0xb'));return;}if(_0x4f5d63[_0xcf39('0xd')](0x0,0xb)==_0xcf39('0xe')){_0x28b8cb=!![];}if(_0x28b8cb){_0x18ddcf['rx']+=_0x4f5d63+'\x0a';if(_0x4f5d63['search'](_0xcf39('0xf'))!=-0x1){_0x28b8cb=![];}}else{_0x18ddcf['rx']=_0x4f5d63;}if(_0x28b8cb){return;}if(typeof _0x18ddcf['cb']==_0xcf39('0x10')){var _0x5ec127=_0x18ddcf['rx']['substring'](0x0,0x3),_0x3efbdc=null,_0x4714cc=null;_0x5ec127=parseInt(_0x5ec127);if(isNaN(_0x5ec127)){_0x18ddcf['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x5ec127!=0xc8){_0x18ddcf['cb'](null,{'code':_0x5ec127,'result':-0x1,'extra':'KO'});return;}_0x3efbdc=_0x18ddcf['rx'][_0xcf39('0xd')](0x4)['replace'](_0xcf39('0x11'),'');if(_0x3efbdc[_0xcf39('0x12')]('\x20')!=-0x1){_0x3efbdc=_0x3efbdc[_0xcf39('0x13')](0x0,_0x3efbdc[_0xcf39('0x12')]('\x20'));}if(_[_0xcf39('0x14')](_0x3efbdc,'-1')){_0x3efbdc=parseInt(_0x3efbdc);}_0x4714cc=_0x18ddcf['rx'][_0xcf39('0x15')]('\x20');if(_0x4714cc[_0xcf39('0x16')]==0x3){_0x4714cc=_0x4714cc[0x2]['substring'](0x1,_0x4714cc[0x2]['length']-0x1);}else if(_0x4714cc[_0xcf39('0x16')]>0x3){var _0x42fa71=/\((.+)\)/;var _0x48f9c8=_0x18ddcf['rx']['match'](_0x42fa71);if(_0x48f9c8){_0x4714cc=_0x48f9c8[0x1];}else{_0x4714cc=null;}}else{_0x4714cc=null;}_0x18ddcf['cb'](null,{'code':_0x5ec127,'result':_0x3efbdc,'extra':_0x4714cc});}});_0x5365f8['on'](_0xcf39('0x17'),function(_0x4b0dbc){_0x334eb5[_0xcf39('0xc')](_0xcf39('0x17'),new AGIError(_0xcf39('0x18'),_0x4b0dbc[_0xcf39('0x19')]));});_0x5365f8['on'](_0xcf39('0x1a'),function(){_0x334eb5[_0xcf39('0xc')]('close',new AGIError(_0xcf39('0x1b')));});_0x5365f8['on'](_0xcf39('0x1c'),function(){_0x334eb5['emit'](_0xcf39('0x1c'),new AGIError(_0xcf39('0x1d')));_0x5365f8[_0xcf39('0x1e')]();});_0x5365f8[_0xcf39('0x1f')](_0x5dbeeb);this[_0xcf39('0x20')]=function(_0x220c0d,_0x1760b3){var _0x220c0d=_0x220c0d||'',_0x1760b3=typeof _0x1760b3==_0xcf39('0x10')?_0x1760b3:new Function();_0x18ddcf={'tx':_0x220c0d,'rx':'','cb':_0x1760b3};_0x5365f8['write'](_0x220c0d+'\x0a');},this[_0xcf39('0x1a')]=function(){_0x5365f8['destroy']();};}util[_0xcf39('0x21')](AGIChannel,EventEmitter);AGIChannel[_0xcf39('0x22')][_0xcf39('0x23')]=function(_0x233b72){return this[_0xcf39('0x20')][_0xcf39('0x24')](this,_0x233b72);};AGIChannel['prototype'][_0xcf39('0x25')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0xcf39('0x22')][_0xcf39('0x26')]=function(_0x3e721b,_0x1b7382,_0x2bb111){_0x3e721b=_0x3e721b===undefined?_0xcf39('0x27'):_0x3e721b;_0x1b7382=_0x1b7382===undefined?'5':_0x1b7382;_0x2bb111=_0x2bb111===undefined?'1':_0x2bb111;return this['sendRequest'](util[_0xcf39('0x28')](_0xcf39('0x29'),_0x3e721b,_0x1b7382*0x3e8,_0x2bb111));};AGIChannel[_0xcf39('0x22')]['noop']=function(_0x2fdfa0){_0x2fdfa0=_0x2fdfa0||_0xcf39('0x2a');return this[_0xcf39('0x23')](util[_0xcf39('0x28')](_0xcf39('0x2b'),_0x2fdfa0));};AGIChannel[_0xcf39('0x22')][_0xcf39('0x2c')]=function(_0x20d5c9,_0x4a4d82){if(_[_0xcf39('0x2d')](_0x4a4d82)){return this[_0xcf39('0x23')](util['format']('EXEC\x20%s\x20%s',_0x20d5c9,_0x4a4d82['join'](',')));}return this['sendRequest'](util[_0xcf39('0x28')]('EXEC\x20%s\x20%s',_0x20d5c9,_0x4a4d82));};AGIChannel[_0xcf39('0x22')][_0xcf39('0x2e')]=function(_0x16811c){return this[_0xcf39('0x23')](util[_0xcf39('0x28')]('SET\x20CONTEXT\x20%s',_0x16811c));};AGIChannel[_0xcf39('0x22')][_0xcf39('0x2f')]=function(_0x572958){return this[_0xcf39('0x23')](util[_0xcf39('0x28')](_0xcf39('0x30'),_0x572958));};AGIChannel['prototype']['setPriority']=function(_0x39e9cb){return this[_0xcf39('0x23')](util['format']('SET\x20PRIORITY\x20%s',_0x39e9cb));};AGIChannel[_0xcf39('0x22')][_0xcf39('0xb')]=function(){return this[_0xcf39('0x23')](_0xcf39('0x31'));};AGIChannel['prototype'][_0xcf39('0x32')]=function(_0x673939,_0x5686ac){var _0x1808a4=_[_0xcf39('0x33')](_0x5686ac)||_['isNumber'](_0x5686ac)?_0x5686ac['toString']():_0x5686ac;return this['sendRequest'](util[_0xcf39('0x28')](_0xcf39('0x34'),_0x673939,_0x1808a4?_0x1808a4[_0xcf39('0x35')]()[_0xcf39('0x36')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xcf39('0x22')][_0xcf39('0x37')]=function(_0x4ec14a,_0x39cdcd){return this[_0xcf39('0x23')](util[_0xcf39('0x28')](_0xcf39('0x38'),_0x4ec14a,_0x39cdcd));};AGIChannel['prototype'][_0xcf39('0x39')]=function(_0x46fd2f,_0x19a6ff){return this['sendRequest'](util[_0xcf39('0x28')]('SAY\x20DIGITS\x20%s\x20%s',_0x46fd2f,_0x19a6ff));};AGIChannel[_0xcf39('0x22')]['sayPhonetic']=function(_0x2528e4,_0x49ac16){return this['sendRequest'](util[_0xcf39('0x28')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x2528e4,_0x49ac16));};AGIChannel['prototype']['continueAt']=function(_0x190d43,_0x333b4d,_0x2f240c){_0x333b4d=_0x333b4d||this[_0xcf39('0x3a')];_0x2f240c=_0x2f240c||0x1;this[_0xcf39('0x2e')](_0x190d43);this[_0xcf39('0x2f')](_0x333b4d);this[_0xcf39('0x3b')](_0x2f240c);return this[_0xcf39('0x3c')](util[_0xcf39('0x28')](_0xcf39('0x3d'),_0x190d43,_0x333b4d,_0x2f240c));};AGIChannel['prototype'][_0xcf39('0x3e')]=function(_0x33ca21){return this['sendRequest'](util[_0xcf39('0x28')]('GET\x20VARIABLE\x20\x22%s\x22',_0x33ca21));};AGIChannel[_0xcf39('0x22')][_0xcf39('0x3f')]=function(_0x17544f,_0x102c28,_0x6a0a28,_0x3b6a9,_0xa5f679,_0x8ab9bb){_0x102c28=_0x102c28||_0xcf39('0x40');_0x6a0a28=_0x6a0a28||'';_0x3b6a9=_0x3b6a9===undefined?-0x1:_0x3b6a9==='-1'?-0x1:_0x3b6a9*0x3e8;_0xa5f679=_0xa5f679===undefined?'':'s='+_0xa5f679;_0x8ab9bb=_0x8ab9bb?'BEEP':'';return this['sendRequest'](util[_0xcf39('0x28')](_0xcf39('0x41'),_0x17544f,_0x102c28,_0x6a0a28,_0x3b6a9,_0x8ab9bb,_0xa5f679));};AGIChannel[_0xcf39('0x22')][_0xcf39('0x42')]=function(_0x13ebba,_0x3d555d){_0x3d555d=_0x3d555d||'';return this[_0xcf39('0x23')](util[_0xcf39('0x28')](_0xcf39('0x43'),_0x13ebba,_0x3d555d));};AGIChannel[_0xcf39('0x22')][_0xcf39('0x44')]=function(_0x590bdf){return this[_0xcf39('0x2c')](_0xcf39('0x45'),_0x590bdf);};AGIChannel[_0xcf39('0x22')][_0xcf39('0x46')]=function(_0x451f54){return this['exec']('WAIT',_0x451f54);};AGIChannel[_0xcf39('0x22')][_0xcf39('0x17')]=function(_0x2e8e52,_0xb0871c){this[_0xcf39('0x3c')](util[_0xcf39('0x28')](_0xcf39('0x47'),_0x2e8e52['id'],_0x2e8e52[_0xcf39('0x48')],_0xb0871c));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xcf39('0x49')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 245017d..04d4fa4 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 _0xcc7a=['format','apply','message','name','exports','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push'];(function(_0x5e1e5e,_0x112444){var _0x140a8f=function(_0x1543ce){while(--_0x1543ce){_0x5e1e5e['push'](_0x5e1e5e['shift']());}};_0x140a8f(++_0x112444);}(_0xcc7a,0x9e));var _0xacc7=function(_0x57cc22,_0x2d351f){_0x57cc22=_0x57cc22-0x0;var _0x6f7bdc=_0xcc7a[_0x57cc22];return _0x6f7bdc;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0xacc7('0x0'),'E_AGI_SERVER_ERROR':_0xacc7('0x1'),'E_AGI_SERVER_CLOSE':_0xacc7('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0xacc7('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0xacc7('0x4'),'E_AGI_SOCKET_ERROR':_0xacc7('0x5'),'E_AGI_SOCKET_CLOSE':_0xacc7('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xacc7('0x7'),'E_AGI_COMMAND_EMPTY':_0xacc7('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xacc7('0x9')};function AGIError(_0x13c39f){var _0x13c39f=_0x13c39f||null,_0x2aa02b=_0x2aa02b||[],_0x180068=0x1,_0x1c1f28='';if(!error[_0x13c39f]){_0x13c39f=_0xacc7('0xa');}_0x2aa02b[_0xacc7('0xb')](error[_0x13c39f]);while(arguments[_0x180068]){_0x2aa02b['push'](arguments[_0x180068]);_0x180068++;}_0x1c1f28=util[_0xacc7('0xc')][_0xacc7('0xd')](util,_0x2aa02b);this[_0xacc7('0xe')]=_0x1c1f28;this[_0xacc7('0xf')]=_0x13c39f;}module[_0xacc7('0x10')]=AGIError; \ No newline at end of file +var _0xd5c3=['exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','name'];(function(_0xdd827a,_0x482ad2){var _0x2f46f1=function(_0x221046){while(--_0x221046){_0xdd827a['push'](_0xdd827a['shift']());}};_0x2f46f1(++_0x482ad2);}(_0xd5c3,0x1d2));var _0x3d5c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd5c3[_0x2dafbe];return _0x58a45a;};'use strict';var util=require(_0x3d5c('0x0'));var error={'E_AGI_UNDEFINED':_0x3d5c('0x1'),'E_AGI_ARGUMENT_PORT':_0x3d5c('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x3d5c('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x3d5c('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x3d5c('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x3d5c('0x6'),'E_AGI_COMMAND_EMPTY':_0x3d5c('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x3d5c('0x8'),'E_AGI_IVR_ENTRY':_0x3d5c('0x9')};function AGIError(_0x344888){var _0x344888=_0x344888||null,_0x1f756c=_0x1f756c||[],_0x29c826=0x1,_0x324857='';if(!error[_0x344888]){_0x344888=_0x3d5c('0xa');}_0x1f756c[_0x3d5c('0xb')](error[_0x344888]);while(arguments[_0x29c826]){_0x1f756c[_0x3d5c('0xb')](arguments[_0x29c826]);_0x29c826++;}_0x324857=util[_0x3d5c('0xc')]['apply'](util,_0x1f756c);this['message']=_0x324857;this[_0x3d5c('0xd')]=_0x344888;}module[_0x3d5c('0xe')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index c0587ab..6909dc2 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 _0x6e35=['message','parse','projectUpdate','exports','events','EventEmitter','ioredis','../../config/environment','redis','defaults','localhost','subscribe','agi','emit','E_AGI_SERVER_ERROR'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x6e35,0x7c));var _0x56e3=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x6e35[_0x45d55e];return _0x29812a;};'use strict';var _=require('lodash');var EventEmitter=require(_0x56e3('0x0'))[_0x56e3('0x1')];var Redis=require(_0x56e3('0x2'));var AGIError=require('./error');var config=require(_0x56e3('0x3'));config[_0x56e3('0x4')]=_[_0x56e3('0x5')](config[_0x56e3('0x4')],{'host':_0x56e3('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x56e3('0x4')]);sub[_0x56e3('0x7')](_0x56e3('0x8'),function(_0x32a144){if(_0x32a144)return eventEmitter[_0x56e3('0x9')]('error',new AGIError(_0x56e3('0xa'),_0x32a144));});sub['on'](_0x56e3('0xb'),function(_0x303946,_0x31e511){if(_0x303946!=='agi')return;try{var _0x45584b=JSON[_0x56e3('0xc')](_0x31e511);eventEmitter[_0x56e3('0x9')](_0x56e3('0xd'),_0x45584b);}catch(_0x56bafe){eventEmitter[_0x56e3('0x9')]('error',new AGIError(_0x56e3('0xa'),_0x56bafe));}});module[_0x56e3('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xc2f6=['events','EventEmitter','ioredis','./error','../../config/environment','redis','defaults','localhost','subscribe','emit','error','message','agi','parse','projectUpdate','E_AGI_SERVER_ERROR','exports','lodash'];(function(_0x16cb1e,_0x1cd4f7){var _0xdae673=function(_0x495167){while(--_0x495167){_0x16cb1e['push'](_0x16cb1e['shift']());}};_0xdae673(++_0x1cd4f7);}(_0xc2f6,0x7d));var _0x6c2f=function(_0x48e532,_0x49672b){_0x48e532=_0x48e532-0x0;var _0x17403f=_0xc2f6[_0x48e532];return _0x17403f;};'use strict';var _=require(_0x6c2f('0x0'));var EventEmitter=require(_0x6c2f('0x1'))[_0x6c2f('0x2')];var Redis=require(_0x6c2f('0x3'));var AGIError=require(_0x6c2f('0x4'));var config=require(_0x6c2f('0x5'));config[_0x6c2f('0x6')]=_[_0x6c2f('0x7')](config['redis'],{'host':_0x6c2f('0x8'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x6c2f('0x6')]);sub[_0x6c2f('0x9')]('agi',function(_0x254c55){if(_0x254c55)return eventEmitter[_0x6c2f('0xa')](_0x6c2f('0xb'),new AGIError('E_AGI_SERVER_ERROR',_0x254c55));});sub['on'](_0x6c2f('0xc'),function(_0x54de35,_0x57b7a3){if(_0x54de35!==_0x6c2f('0xd'))return;try{var _0x1cf652=JSON[_0x6c2f('0xe')](_0x57b7a3);eventEmitter[_0x6c2f('0xa')](_0x6c2f('0xf'),_0x1cf652);}catch(_0x1f9561){eventEmitter[_0x6c2f('0xa')](_0x6c2f('0xb'),new AGIError(_0x6c2f('0x10'),_0x1f9561));}});module[_0x6c2f('0x11')]={'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 16ab5f3..52d3e7a 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 _0x8b99=['invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','../../../config/logger','agi','getdigits','getsecretdigits','vertices','prototype','edges','addEdge','numberOfEdges','size','relations','traverseBFS','info','stop\x20traverse','length','condition','split','agicommand','vswitch','target','default','menu'];(function(_0x395a52,_0x41f74f){var _0xbb3d7a=function(_0x59a818){while(--_0x59a818){_0x395a52['push'](_0x395a52['shift']());}};_0xbb3d7a(++_0x41f74f);}(_0x8b99,0x156));var _0x98b9=function(_0x364946,_0x531662){_0x364946=_0x364946-0x0;var _0x134488=_0x8b99[_0x364946];return _0x134488;};'use strict';var _=require('lodash');var logger=require(_0x98b9('0x0'))(_0x98b9('0x1'));var verticesWithRetry=['menu',_0x98b9('0x2'),_0x98b9('0x3')];var Graph=function(){this[_0x98b9('0x4')]={};this['edges']={};this['numberOfEdges']=0x0;};Graph[_0x98b9('0x5')]['addVertex']=function(_0x3ac54e){this[_0x98b9('0x4')][_0x3ac54e['id']]=_0x3ac54e;this[_0x98b9('0x6')][_0x3ac54e['id']]=[];};Graph[_0x98b9('0x5')][_0x98b9('0x7')]=function(_0x58c801,_0x5643b5,_0x5d3645){this[_0x98b9('0x6')][_0x58c801]['push']({'target':_0x5643b5,'condition':_0x5d3645});this[_0x98b9('0x8')]+=0x1;};Graph[_0x98b9('0x5')][_0x98b9('0x9')]=function(){return _[_0x98b9('0x9')](this[_0x98b9('0x4')]);};Graph[_0x98b9('0x5')][_0x98b9('0xa')]=function(){return this['numberOfEdges'];};Graph[_0x98b9('0x5')]['getVertex']=function(_0x40e414){return this[_0x98b9('0x4')][_0x40e414];};Graph[_0x98b9('0x5')][_0x98b9('0xb')]=function(_0x98383b,_0x20eb6a){if(!this['vertices'][_0x98383b]){return logger[_0x98b9('0xc')]('no\x20vertex\x20found');}var _0x127c35=_0x20eb6a(this['vertices'][_0x98383b]);if(!_0x127c35){return logger[_0x98b9('0xc')](_0x98b9('0xd'));}if(this[_0x98b9('0x6')][_0x98383b]['length']===0x0){return logger[_0x98b9('0xc')]('no\x20edge/s\x20available');}for(var _0x4a47b5=0x0,_0x57d5e3=[],_0x2a95ed=![];_0x4a47b5\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','find','handleNotFound','production','initialize','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','listening','connection','lodash','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick'];(function(_0x2aef74,_0x193b61){var _0x1a5857=function(_0x57fdd7){while(--_0x57fdd7){_0x2aef74['push'](_0x2aef74['shift']());}};_0x1a5857(++_0x193b61);}(_0x573d,0x1dc));var _0xd573=function(_0x1a2655,_0x1eb382){_0x1a2655=_0x1a2655-0x0;var _0x4a2665=_0x573d[_0x1a2655];return _0x4a2665;};'use strict';var _=require(_0xd573('0x0'));var syncho=require('syncho');var util=require('util');var config=require(_0xd573('0x1'));var logger=require(_0xd573('0x2'))(_0xd573('0x3'));var utilLicense=require(_0xd573('0x4'));var rpc=require(_0xd573('0x5'));var Project=require('./project');var AGIEmitter=require(_0xd573('0x6'))[_0xd573('0x7')];var projects=[];config[_0xd573('0x3')]=_[_0xd573('0x8')](config[_0xd573('0x3')],{'ip':_0xd573('0x9'),'port':0x11dd});AGIEmitter['on'](_0xd573('0xa'),projectUpdateHandler);function connectionHandler(_0x4154e3){process[_0xd573('0xb')](function(){syncho(function(){try{setChannelVariables(_0x4154e3);agiHandler(_0x4154e3);}catch(_0x1a1e76){logger[_0xd573('0xc')](_0x1a1e76[_0xd573('0xd')]);}});});}function projectUpdateHandler(_0x5ec1c4){try{var _0x1fd09f=_[_0xd573('0xe')](projects,['id',_0x5ec1c4['id']]);if(_0x1fd09f>-0x1){if(_0x5ec1c4[_0xd573('0xf')]===!![]){projects['splice'](_0x1fd09f,0x1);}else{projects[_0x1fd09f]=_0x5ec1c4;}}else{projects[_0xd573('0x10')](_0x5ec1c4);}}catch(_0x377cc7){logger[_0xd573('0xc')](_0x377cc7[_0xd573('0xd')]);}}function listeningHandler(){console[_0xd573('0x11')](_0xd573('0x12'),config[_0xd573('0x3')][_0xd573('0x13')]);logger['info'](util[_0xd573('0x14')](_0xd573('0x15'),config[_0xd573('0x3')]['ip'],config[_0xd573('0x3')][_0xd573('0x13')]));}function errorHandler(_0x156ef7){if(_0x156ef7&&_0x156ef7[_0xd573('0x16')]&&_0x156ef7[_0xd573('0x17')]){logger[_0xd573('0xc')](util[_0xd573('0x14')](_0xd573('0x18'),_0x156ef7['name'],_0x156ef7[_0xd573('0x17')]));}else{logger[_0xd573('0xc')](util['format'](_0xd573('0x19'),_0x156ef7[_0xd573('0xd')]));}}function closeHandler(){logger[_0xd573('0x1a')](util[_0xd573('0x14')](_0xd573('0x1b'),this[_0xd573('0x1c')],this[_0xd573('0x1d')],this[_0xd573('0x1e')],this[_0xd573('0x1f')],this[_0xd573('0x20')]));try{createSquareReport(this);}catch(_0x344bcf){logger['error'](_0x344bcf['stack']);}}function timeoutHandler(){logger[_0xd573('0x1a')](util[_0xd573('0x14')](_0xd573('0x21'),this[_0xd573('0x1c')],this['calleridname'],this['callerid'],this[_0xd573('0x1f')],this['uniqueid']));}function hangupHandler(){logger[_0xd573('0x1a')](util[_0xd573('0x14')](_0xd573('0x22'),this[_0xd573('0x1c')],this[_0xd573('0x1d')],this['callerid'],this[_0xd573('0x1f')],this[_0xd573('0x20')]));this[_0xd573('0x23')]=!![];}function createSquareReport(_0xfdbce0,_0x128ee8){rpc[_0xd573('0x24')](_0xfdbce0)[_0xd573('0x25')](function(_0x45ff01){if(_0x128ee8){_0x128ee8(null,_0x45ff01);}})[_0xd573('0x26')](function(_0x48e0af){if(_0x128ee8){_0x128ee8(null,_0x48e0af);}});}function setChannelVariables(_0x298e6b){for(var _0x2f5ab3 in _0x298e6b){if(_0x298e6b[_0xd573('0x27')](_0x2f5ab3)){if(_0x2f5ab3[_0xd573('0x28')](_0xd573('0x29'))===0x0){_0x298e6b[_0x2f5ab3['substring'](0x4)]=_0x298e6b[_0x2f5ab3];delete _0x298e6b[_0x2f5ab3];}}}}function agiHandler(_0x4676eb){logger[_0xd573('0x2a')](_0xd573('0x2b'),JSON[_0xd573('0x2c')](_0x4676eb,null,0x2));logger['info'](util[_0xd573('0x14')](_0xd573('0x2d'),_0x4676eb['arg_1'],_0x4676eb['calleridname'],_0x4676eb[_0xd573('0x1e')],_0x4676eb[_0xd573('0x1f')],_0x4676eb[_0xd573('0x20')]));_0x4676eb['on'](_0xd573('0xc'),errorHandler);_0x4676eb['on'](_0xd573('0x2e'),closeHandler);_0x4676eb['on'](_0xd573('0x2f'),timeoutHandler);_0x4676eb['evtHangup']=![];_0x4676eb['on']('hangup',hangupHandler);var _0x49f7a6=_[_0xd573('0x30')](projects,[_0xd573('0x16'),_0x4676eb[_0xd573('0x1c')]]);if(!_0x49f7a6)return Project[_0xd573('0x31')](_0x4676eb);if(!_0x49f7a6[_0xd573('0x32')])return Project['handleUnpublished'](_0x4676eb);return Project[_0xd573('0x33')](_0x49f7a6,_0x4676eb);}function main(){var _0x5341a0;return utilLicense['getLicense']()['then'](function(_0x2473d8){if(!_0x2473d8)return;if(_0x2473d8[_0xd573('0x34')]){if(_0x2473d8['callysquare']&&_0x2473d8[_0xd573('0x35')]>0x0){logger[_0xd573('0x1a')](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0x2473d8[_0xd573('0x35')]));_0x5341a0=_0x2473d8[_0xd573('0x35')];}else{logger[_0xd573('0x1a')](_0xd573('0x36'));}}else{logger['info'](_0xd573('0x37'));_0x5341a0=-0x1;}})['then'](function(){return Project[_0xd573('0x38')]();})[_0xd573('0x25')](function(_0x27aede){projects=_0x27aede;return;})['catch'](function(_0x46ae44){logger['error'](_0xd573('0x39'),_0x46ae44[_0xd573('0xd')]);})[_0xd573('0x3a')](function(){var _0x4a1f1c=require('./server')(config[_0xd573('0x3')][_0xd573('0x13')],config[_0xd573('0x3')]['ip'],_0x5341a0);_0x4a1f1c['on']('error',errorHandler);_0x4a1f1c['on'](_0xd573('0x3b'),listeningHandler);_0x4a1f1c['on'](_0xd573('0x3c'),connectionHandler);_0x4a1f1c['on'](_0xd573('0x2e'),closeHandler);});}main(); \ No newline at end of file +var _0x5537=['format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','uniqueid','evtHangup','createSquareReport','then','catch','indexOf','agi_','substring','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find','production','handleUnpublished','initialize','callysquare','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','finally','./server','listening','connection','lodash','util','../../config/license/util','./rpc','./events','EventEmitter','agi','projectUpdate','nextTick','error','stack','deleted','splice','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info'];(function(_0x2f3fce,_0x2bd7a3){var _0x6619d3=function(_0x36309d){while(--_0x36309d){_0x2f3fce['push'](_0x2f3fce['shift']());}};_0x6619d3(++_0x2bd7a3);}(_0x5537,0x1cb));var _0x7553=function(_0xf65da5,_0x8e3312){_0xf65da5=_0xf65da5-0x0;var _0x446149=_0x5537[_0xf65da5];return _0x446149;};'use strict';var _=require(_0x7553('0x0'));var syncho=require('syncho');var util=require(_0x7553('0x1'));var config=require('../../config/environment');var logger=require('../../config/logger')('agi');var utilLicense=require(_0x7553('0x2'));var rpc=require(_0x7553('0x3'));var Project=require('./project');var AGIEmitter=require(_0x7553('0x4'))[_0x7553('0x5')];var projects=[];config[_0x7553('0x6')]=_['defaults'](config['agi'],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x7553('0x7'),projectUpdateHandler);function connectionHandler(_0x16e25a){process[_0x7553('0x8')](function(){syncho(function(){try{setChannelVariables(_0x16e25a);agiHandler(_0x16e25a);}catch(_0x48642f){logger[_0x7553('0x9')](_0x48642f[_0x7553('0xa')]);}});});}function projectUpdateHandler(_0xf22608){try{var _0x14eb8f=_['findIndex'](projects,['id',_0xf22608['id']]);if(_0x14eb8f>-0x1){if(_0xf22608[_0x7553('0xb')]===!![]){projects[_0x7553('0xc')](_0x14eb8f,0x1);}else{projects[_0x14eb8f]=_0xf22608;}}else{projects[_0x7553('0xd')](_0xf22608);}}catch(_0x14e8df){logger[_0x7553('0x9')](_0x14e8df[_0x7553('0xa')]);}}function listeningHandler(){console[_0x7553('0xe')](_0x7553('0xf'),config[_0x7553('0x6')][_0x7553('0x10')]);logger[_0x7553('0x11')](util[_0x7553('0x12')](_0x7553('0x13'),config[_0x7553('0x6')]['ip'],config[_0x7553('0x6')][_0x7553('0x10')]));}function errorHandler(_0x591b78){if(_0x591b78&&_0x591b78[_0x7553('0x14')]&&_0x591b78[_0x7553('0x15')]){logger[_0x7553('0x9')](util[_0x7553('0x12')]('[%s]\x20%s',_0x591b78['name'],_0x591b78[_0x7553('0x15')]));}else{logger[_0x7553('0x9')](util[_0x7553('0x12')]('[ERROR]\x20%s',_0x591b78[_0x7553('0xa')]));}}function closeHandler(){logger[_0x7553('0x11')](util[_0x7553('0x12')](_0x7553('0x16'),this[_0x7553('0x17')],this['calleridname'],this[_0x7553('0x18')],this[_0x7553('0x19')],this['uniqueid']));try{createSquareReport(this);}catch(_0x926e2e){logger[_0x7553('0x9')](_0x926e2e[_0x7553('0xa')]);}}function timeoutHandler(){logger['info'](util[_0x7553('0x12')](_0x7553('0x1a'),this[_0x7553('0x17')],this[_0x7553('0x1b')],this['callerid'],this[_0x7553('0x19')],this[_0x7553('0x1c')]));}function hangupHandler(){logger[_0x7553('0x11')](util[_0x7553('0x12')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x7553('0x17')],this['calleridname'],this[_0x7553('0x18')],this['dnid'],this['uniqueid']));this[_0x7553('0x1d')]=!![];}function createSquareReport(_0x3d6d1a,_0x275e86){rpc[_0x7553('0x1e')](_0x3d6d1a)[_0x7553('0x1f')](function(_0xe80494){if(_0x275e86){_0x275e86(null,_0xe80494);}})[_0x7553('0x20')](function(_0x1087fa){if(_0x275e86){_0x275e86(null,_0x1087fa);}});}function setChannelVariables(_0x15c7ae){for(var _0x523a51 in _0x15c7ae){if(_0x15c7ae['hasOwnProperty'](_0x523a51)){if(_0x523a51[_0x7553('0x21')](_0x7553('0x22'))===0x0){_0x15c7ae[_0x523a51[_0x7553('0x23')](0x4)]=_0x15c7ae[_0x523a51];delete _0x15c7ae[_0x523a51];}}}}function agiHandler(_0x5f633c){logger['debug'](_0x7553('0x24'),JSON[_0x7553('0x25')](_0x5f633c,null,0x2));logger[_0x7553('0x11')](util['format'](_0x7553('0x26'),_0x5f633c[_0x7553('0x17')],_0x5f633c[_0x7553('0x1b')],_0x5f633c[_0x7553('0x18')],_0x5f633c[_0x7553('0x19')],_0x5f633c[_0x7553('0x1c')]));_0x5f633c['on']('error',errorHandler);_0x5f633c['on'](_0x7553('0x27'),closeHandler);_0x5f633c['on'](_0x7553('0x28'),timeoutHandler);_0x5f633c['evtHangup']=![];_0x5f633c['on'](_0x7553('0x29'),hangupHandler);var _0x3ce234=_[_0x7553('0x2a')](projects,[_0x7553('0x14'),_0x5f633c['arg_1']]);if(!_0x3ce234)return Project['handleNotFound'](_0x5f633c);if(!_0x3ce234[_0x7553('0x2b')])return Project[_0x7553('0x2c')](_0x5f633c);return Project[_0x7553('0x2d')](_0x3ce234,_0x5f633c);}function main(){var _0x296b56;return utilLicense['getLicense']()[_0x7553('0x1f')](function(_0x194623){if(!_0x194623)return;if(_0x194623['voice']){if(_0x194623['callysquare']&&_0x194623['callysquare']>0x0){logger[_0x7553('0x11')](util[_0x7553('0x12')]('[LICENSE]\x20CHANNELS:\x20%s',_0x194623[_0x7553('0x2e')]));_0x296b56=_0x194623[_0x7553('0x2e')];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x7553('0x11')](_0x7553('0x2f'));_0x296b56=-0x1;}})[_0x7553('0x1f')](function(){return Project['getAll']();})[_0x7553('0x1f')](function(_0x4a8029){projects=_0x4a8029;return;})[_0x7553('0x20')](function(_0xbe8371){logger[_0x7553('0x9')](_0x7553('0x30'),_0xbe8371[_0x7553('0xa')]);})[_0x7553('0x31')](function(){var _0x5c10a2=require(_0x7553('0x32'))(config[_0x7553('0x6')][_0x7553('0x10')],config[_0x7553('0x6')]['ip'],_0x296b56);_0x5c10a2['on'](_0x7553('0x9'),errorHandler);_0x5c10a2['on'](_0x7553('0x33'),listeningHandler);_0x5c10a2['on'](_0x7553('0x34'),connectionHandler);_0x5c10a2['on'](_0x7553('0x27'),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 6f5608d..b07d141 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 _0x963b=['SendMail','bluebird','jayson/promise','client','http','request','then','error','message','result','catch','sendMailMessage'];(function(_0x321aa7,_0x4e5d3b){var _0x269c6c=function(_0x530d12){while(--_0x530d12){_0x321aa7['push'](_0x321aa7['shift']());}};_0x269c6c(++_0x4e5d3b);}(_0x963b,0x1b1));var _0xb963=function(_0x1e6659,_0x1f860c){_0x1e6659=_0x1e6659-0x0;var _0x4d16e4=_0x963b[_0x1e6659];return _0x4d16e4;};'use strict';var BPromise=require(_0xb963('0x0'));var jayson=require(_0xb963('0x1'));var client=jayson[_0xb963('0x2')][_0xb963('0x3')]({'port':0x232b});function request(_0x5de1e1,_0x54a907){return new BPromise(function(_0x285d65,_0x2bb026){return client[_0xb963('0x4')](_0x5de1e1,_0x54a907)[_0xb963('0x5')](function(_0x4d3655){if(_0x4d3655[_0xb963('0x6')]){return _0x2bb026(_0x4d3655[_0xb963('0x6')][_0xb963('0x7')]);}else{return _0x285d65(_0x4d3655[_0xb963('0x8')]);}})[_0xb963('0x9')](function(_0x29c2ae){return _0x2bb026(_0x29c2ae);});});}exports[_0xb963('0xa')]=function(_0x31b16e,_0x5eda83){return request(_0xb963('0xb'),{'account':_0x31b16e,'message':_0x5eda83});}; \ No newline at end of file +var _0x2751=['error','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request'];(function(_0x33d4b9,_0x1f205c){var _0x498d83=function(_0x21e55f){while(--_0x21e55f){_0x33d4b9['push'](_0x33d4b9['shift']());}};_0x498d83(++_0x1f205c);}(_0x2751,0xe1));var _0x1275=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2751[_0x122ef9];return _0x42fba0;};'use strict';var BPromise=require(_0x1275('0x0'));var jayson=require(_0x1275('0x1'));var client=jayson[_0x1275('0x2')][_0x1275('0x3')]({'port':0x232b});function request(_0x5387da,_0x2704c3){return new BPromise(function(_0xaf2a50,_0x26b1ee){return client[_0x1275('0x4')](_0x5387da,_0x2704c3)['then'](function(_0x30cce3){if(_0x30cce3[_0x1275('0x5')]){return _0x26b1ee(_0x30cce3['error']['message']);}else{return _0xaf2a50(_0x30cce3[_0x1275('0x6')]);}})[_0x1275('0x7')](function(_0xa3d042){return _0x26b1ee(_0xa3d042);});});}exports[_0x1275('0x8')]=function(_0x224920,_0x238a43){return request(_0x1275('0x9'),{'account':_0x224920,'message':_0x238a43});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 54df322..9d179bd 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 _0x4165=['Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','retry','maxRetry','addVertex','omit','mxCell','hasOwnProperty','source','target','addEdge','value','mxGraphModel','root','inspect','production','debug','stringify','info','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','traverseBFS','start','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','toString','callerid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','close','lodash','moment','../../config/logger','./rpc','./mailRpc','./graph','getSquareProjects','catch','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4165,0x119));var _0x5416=function(_0x5d8ac9,_0x3128ad){_0x5d8ac9=_0x5d8ac9-0x0;var _0x432997=_0x4165[_0x5d8ac9];return _0x432997;};'use strict';var _=require(_0x5416('0x0'));var moment=require(_0x5416('0x1'));var parser=require('xml2json');var util=require('util');var logger=require(_0x5416('0x2'))('agi');var rpc=require(_0x5416('0x3'));var mailRpc=require(_0x5416('0x4'));var Graph=require(_0x5416('0x5'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x5416('0x6')]()[_0x5416('0x7')](function(_0xad8ebb){logger[_0x5416('0x8')](_0x5416('0x9'),_0xad8ebb[_0x5416('0xa')]);return[];});}function addVertex(_0xe9f03c,_0x4c43f0,_0x3105ab){_0x4c43f0[_0x5416('0xb')]=_0x3105ab;if(_0x4c43f0['hasOwnProperty'](_0x5416('0xc'))){_0x4c43f0[_0x5416('0xd')]=parseInt(_0x4c43f0['retry'],0xa);}_0xe9f03c[_0x5416('0xe')](_[_0x5416('0xf')](_0x4c43f0,_0x5416('0x10')));}function initGraph(_0x33fb32,_0x179a62){var _0x1265a9=new Graph();for(var _0x50c3c2 in _0x33fb32){if(_0x33fb32[_0x5416('0x11')](_0x50c3c2)){if(_['isArray'](_0x33fb32[_0x50c3c2])){for(var _0x1c5182=0x0;_0x1c5182<_0x33fb32[_0x50c3c2]['length'];_0x1c5182+=0x1){addVertex(_0x1265a9,_0x33fb32[_0x50c3c2][_0x1c5182],_0x50c3c2);}}else{addVertex(_0x1265a9,_0x33fb32[_0x50c3c2],_0x50c3c2);}}}for(var _0x32c39b=0x0;_0x32c39b<_0x179a62['length'];_0x32c39b+=0x1){if(_0x179a62[_0x32c39b][_0x5416('0x12')]&&_0x179a62[_0x32c39b][_0x5416('0x13')]){_0x1265a9[_0x5416('0x14')](_0x179a62[_0x32c39b][_0x5416('0x12')],_0x179a62[_0x32c39b][_0x5416('0x13')],_0x179a62[_0x32c39b][_0x5416('0x15')]);}}return _0x1265a9;}function getRoot(_0x5539ef){return parser['toJson'](_0x5539ef,{'object':!![]})[_0x5416('0x16')][_0x5416('0x17')];}function inspect(_0x2fa9ef){return util[_0x5416('0x18')](_0x2fa9ef,{'showHidden':![],'depth':null});}function initialize(_0x54c29c,_0x24ed37){var _0x104ee9=getRoot(_0x54c29c[_0x5416('0x19')]);if(!_0x104ee9||!_0x104ee9['start'])return;var _0x4f5d65,_0x2f718b,_0x467d53;logger[_0x5416('0x1a')]('root',JSON[_0x5416('0x1b')](_0x104ee9,null,0x2));_0x24ed37['joinAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4f5d65=initGraph(_[_0x5416('0xf')](_0x104ee9,_0x5416('0x10')),_0x104ee9[_0x5416('0x10')]);_0x2f718b=new Vertices(_0x24ed37,rpc,mailRpc);logger[_0x5416('0x1c')](util[_0x5416('0x1d')](_0x5416('0x1e'),_0x24ed37[_0x5416('0x1f')],_0x24ed37[_0x5416('0x20')],_0x24ed37['callerid'],_0x24ed37[_0x5416('0x21')],_0x24ed37['uniqueid']));_0x4f5d65[_0x5416('0x22')](_0x104ee9[_0x5416('0x23')]['id'],function(_0x58af5c){try{_0x58af5c=_0x2f718b[_0x5416('0x24')](_0x58af5c);logger[_0x5416('0x1a')](_0x5416('0x25'),JSON[_0x5416('0x1b')](_0x58af5c,null,0x2));if(_0x58af5c[_0x5416('0xb')]===_0x5416('0x26')){logger[_0x5416('0x1c')](_0x5416('0x27'));_0x24ed37['context']=_0x58af5c[_0x5416('0x28')]||_0x24ed37[_0x5416('0x28')];_0x24ed37[_0x5416('0x29')]=_0x58af5c['extension'];_0x24ed37['priority']=_0x58af5c[_0x5416('0x2a')]?_0x58af5c['priority']-0x1:0x1;return null;}else if(_0x58af5c&&_0x2f718b[_0x58af5c['agicommand']]){_0x467d53=_0x2f718b[_0x58af5c[_0x5416('0xb')]](_0x58af5c);logger[_0x5416('0x1c')](_0x5416('0x2b'),JSON[_0x5416('0x1b')](_0x467d53,null,0x2));if(_0x467d53&&_0x467d53[_0x5416('0x2c')]===AGI_CODE_SUCCESS&&_0x467d53[_0x5416('0x2d')]!==AGI_RESULT_ERROR&&!_0x24ed37[_0x5416('0x2e')]){logger[_0x5416('0x1a')](_0x5416('0x2b'),inspect(_0x467d53));return _[_0x5416('0x2f')](_0x467d53[_0x5416('0x2d')])?null:_0x467d53[_0x5416('0x2d')]['toString']();}else{logger[_0x5416('0x8')](_0x5416('0x2b'),inspect(_0x467d53));return null;}}else{logger[_0x5416('0x8')]('agicommand\x20not\x20found');return null;}}catch(_0x308675){logger['error'](_0x308675[_0x5416('0xa')]);return null;}});if(_0x104ee9[_0x5416('0x30')]){logger[_0x5416('0x1c')](util[_0x5416('0x1d')](_0x5416('0x31'),_0x24ed37['arg_1'],_0x24ed37[_0x5416('0x20')],_0x24ed37['callerid'],_0x24ed37[_0x5416('0x21')],_0x24ed37[_0x5416('0x32')]));_0x4f5d65[_0x5416('0x22')](_0x104ee9['finally']['id'],function(_0x4a6898){try{_0x4a6898=_0x2f718b[_0x5416('0x24')](_0x4a6898);logger[_0x5416('0x1a')](_0x5416('0x25'),JSON[_0x5416('0x1b')](_0x4a6898,null,0x2));if(_0x4a6898&&_0x2f718b[_0x4a6898[_0x5416('0xb')]]){_0x467d53=_0x2f718b[_0x4a6898[_0x5416('0xb')]](_0x4a6898);if(_0x467d53){logger['debug'](_0x5416('0x2b'),inspect(_0x467d53));return _[_0x5416('0x2f')](_0x467d53[_0x5416('0x2d')])?null:_0x467d53[_0x5416('0x2d')][_0x5416('0x33')]();}else{logger[_0x5416('0x8')]('response',inspect(_0x467d53));return null;}}else{logger[_0x5416('0x8')]('agicommand\x20not\x20found');return null;}}catch(_0x5b4307){logger[_0x5416('0x8')](_0x5b4307[_0x5416('0xa')]);return null;}});}logger[_0x5416('0x1c')](util[_0x5416('0x1d')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x24ed37['arg_1'],_0x24ed37['calleridname'],_0x24ed37[_0x5416('0x34')],_0x24ed37[_0x5416('0x21')],_0x24ed37['uniqueid']));logger[_0x5416('0x1c')](util[_0x5416('0x1d')](_0x5416('0x35'),_0x24ed37['context'],_0x24ed37['extension'],parseInt(_0x24ed37[_0x5416('0x2a')],0xa)+0x1));_0x24ed37[_0x5416('0x36')](_0x24ed37[_0x5416('0x28')],_0x24ed37['extension'],parseInt(_0x24ed37[_0x5416('0x2a')],0xa)+0x1);_0x24ed37['close']();}function handleNotFound(_0x59e2f4){logger[_0x5416('0x8')](util[_0x5416('0x1d')](_0x5416('0x37'),_0x59e2f4[_0x5416('0x1f')]));_0x59e2f4[_0x5416('0x36')](_0x59e2f4[_0x5416('0x28')],_0x59e2f4[_0x5416('0x29')],parseInt(_0x59e2f4[_0x5416('0x2a')],0xa)+0x1);_0x59e2f4['close']();}function handleUnpublished(_0xca3b48){logger[_0x5416('0x8')](util['format'](_0x5416('0x38'),_0xca3b48[_0x5416('0x1f')]));_0xca3b48[_0x5416('0x36')](_0xca3b48[_0x5416('0x28')],_0xca3b48[_0x5416('0x29')],parseInt(_0xca3b48[_0x5416('0x2a')],0xa)+0x1);_0xca3b48[_0x5416('0x39')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x1036=['addEdge','value','toJson','root','inspect','start','debug','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','info','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','traverseBFS','clear','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','evtHangup','isUndefined','error','agicommand\x20not\x20found','stack','calleridname','finally','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','close','Project\x20%s\x20not\x20found','continueAt','Project\x20%s\x20not\x20published','lodash','moment','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./graph','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','length','source'];(function(_0x319906,_0x5164de){var _0x412602=function(_0x6e3b85){while(--_0x6e3b85){_0x319906['push'](_0x319906['shift']());}};_0x412602(++_0x5164de);}(_0x1036,0x9c));var _0x6103=function(_0x289824,_0x3b00ec){_0x289824=_0x289824-0x0;var _0x1cd9f8=_0x1036[_0x289824];return _0x1cd9f8;};'use strict';var _=require(_0x6103('0x0'));var moment=require(_0x6103('0x1'));var parser=require(_0x6103('0x2'));var util=require(_0x6103('0x3'));var logger=require(_0x6103('0x4'))(_0x6103('0x5'));var rpc=require(_0x6103('0x6'));var mailRpc=require(_0x6103('0x7'));var Graph=require(_0x6103('0x8'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()['catch'](function(_0x3325b9){logger['error'](_0x6103('0x9'),_0x3325b9['stack']);return[];});}function addVertex(_0x526aa7,_0x155188,_0x4bdc25){_0x155188[_0x6103('0xa')]=_0x4bdc25;if(_0x155188[_0x6103('0xb')](_0x6103('0xc'))){_0x155188['maxRetry']=parseInt(_0x155188['retry'],0xa);}_0x526aa7[_0x6103('0xd')](_[_0x6103('0xe')](_0x155188,_0x6103('0xf')));}function initGraph(_0x2bb487,_0x5a49d5){var _0x50a998=new Graph();for(var _0x46c348 in _0x2bb487){if(_0x2bb487[_0x6103('0xb')](_0x46c348)){if(_['isArray'](_0x2bb487[_0x46c348])){for(var _0x475a88=0x0;_0x475a88<_0x2bb487[_0x46c348][_0x6103('0x10')];_0x475a88+=0x1){addVertex(_0x50a998,_0x2bb487[_0x46c348][_0x475a88],_0x46c348);}}else{addVertex(_0x50a998,_0x2bb487[_0x46c348],_0x46c348);}}}for(var _0x364334=0x0;_0x364334<_0x5a49d5[_0x6103('0x10')];_0x364334+=0x1){if(_0x5a49d5[_0x364334][_0x6103('0x11')]&&_0x5a49d5[_0x364334]['target']){_0x50a998[_0x6103('0x12')](_0x5a49d5[_0x364334]['source'],_0x5a49d5[_0x364334]['target'],_0x5a49d5[_0x364334][_0x6103('0x13')]);}}return _0x50a998;}function getRoot(_0x48736c){return parser[_0x6103('0x14')](_0x48736c,{'object':!![]})['mxGraphModel'][_0x6103('0x15')];}function inspect(_0x21c8a4){return util[_0x6103('0x16')](_0x21c8a4,{'showHidden':![],'depth':null});}function initialize(_0x54de5a,_0x78d983){var _0x1f9d40=getRoot(_0x54de5a['production']);if(!_0x1f9d40||!_0x1f9d40[_0x6103('0x17')])return;var _0x1b8f02,_0x197a1d,_0x261836;logger[_0x6103('0x18')]('root',JSON[_0x6103('0x19')](_0x1f9d40,null,0x2));_0x78d983[_0x6103('0x1a')]=moment()['format'](_0x6103('0x1b'));_0x1b8f02=initGraph(_[_0x6103('0xe')](_0x1f9d40,_0x6103('0xf')),_0x1f9d40[_0x6103('0xf')]);_0x197a1d=new Vertices(_0x78d983,rpc,mailRpc);logger[_0x6103('0x1c')](util[_0x6103('0x1d')](_0x6103('0x1e'),_0x78d983[_0x6103('0x1f')],_0x78d983['calleridname'],_0x78d983[_0x6103('0x20')],_0x78d983[_0x6103('0x21')],_0x78d983[_0x6103('0x22')]));_0x1b8f02[_0x6103('0x23')](_0x1f9d40[_0x6103('0x17')]['id'],function(_0x31c78f){try{_0x31c78f=_0x197a1d[_0x6103('0x24')](_0x31c78f);logger['debug']('vertex',JSON[_0x6103('0x19')](_0x31c78f,null,0x2));if(_0x31c78f[_0x6103('0xa')]==='gotoc'){logger[_0x6103('0x1c')](_0x6103('0x25'));_0x78d983[_0x6103('0x26')]=_0x31c78f[_0x6103('0x26')]||_0x78d983[_0x6103('0x26')];_0x78d983[_0x6103('0x27')]=_0x31c78f[_0x6103('0x27')];_0x78d983['priority']=_0x31c78f[_0x6103('0x28')]?_0x31c78f[_0x6103('0x28')]-0x1:0x1;return null;}else if(_0x31c78f&&_0x197a1d[_0x31c78f[_0x6103('0xa')]]){_0x261836=_0x197a1d[_0x31c78f[_0x6103('0xa')]](_0x31c78f);logger[_0x6103('0x1c')](_0x6103('0x29'),JSON[_0x6103('0x19')](_0x261836,null,0x2));if(_0x261836&&_0x261836['code']===AGI_CODE_SUCCESS&&_0x261836[_0x6103('0x2a')]!==AGI_RESULT_ERROR&&!_0x78d983[_0x6103('0x2b')]){logger['debug'](_0x6103('0x29'),inspect(_0x261836));return _[_0x6103('0x2c')](_0x261836[_0x6103('0x2a')])?null:_0x261836[_0x6103('0x2a')]['toString']();}else{logger[_0x6103('0x2d')]('response',inspect(_0x261836));return null;}}else{logger['error'](_0x6103('0x2e'));return null;}}catch(_0x2fe897){logger['error'](_0x2fe897[_0x6103('0x2f')]);return null;}});if(_0x1f9d40['finally']){logger[_0x6103('0x1c')](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x78d983[_0x6103('0x1f')],_0x78d983[_0x6103('0x30')],_0x78d983['callerid'],_0x78d983[_0x6103('0x21')],_0x78d983[_0x6103('0x22')]));_0x1b8f02[_0x6103('0x23')](_0x1f9d40[_0x6103('0x31')]['id'],function(_0xda45f9){try{_0xda45f9=_0x197a1d[_0x6103('0x24')](_0xda45f9);logger[_0x6103('0x18')](_0x6103('0x32'),JSON['stringify'](_0xda45f9,null,0x2));if(_0xda45f9&&_0x197a1d[_0xda45f9[_0x6103('0xa')]]){_0x261836=_0x197a1d[_0xda45f9[_0x6103('0xa')]](_0xda45f9);if(_0x261836){logger[_0x6103('0x18')](_0x6103('0x29'),inspect(_0x261836));return _[_0x6103('0x2c')](_0x261836[_0x6103('0x2a')])?null:_0x261836[_0x6103('0x2a')][_0x6103('0x33')]();}else{logger[_0x6103('0x2d')]('response',inspect(_0x261836));return null;}}else{logger[_0x6103('0x2d')](_0x6103('0x2e'));return null;}}catch(_0x38d8ce){logger[_0x6103('0x2d')](_0x38d8ce[_0x6103('0x2f')]);return null;}});}logger[_0x6103('0x1c')](util['format'](_0x6103('0x34'),_0x78d983[_0x6103('0x1f')],_0x78d983[_0x6103('0x30')],_0x78d983['callerid'],_0x78d983['dnid'],_0x78d983[_0x6103('0x22')]));logger['info'](util[_0x6103('0x1d')](_0x6103('0x35'),_0x78d983[_0x6103('0x26')],_0x78d983[_0x6103('0x27')],parseInt(_0x78d983[_0x6103('0x28')],0xa)+0x1));_0x78d983['continueAt'](_0x78d983[_0x6103('0x26')],_0x78d983[_0x6103('0x27')],parseInt(_0x78d983['priority'],0xa)+0x1);_0x78d983[_0x6103('0x36')]();}function handleNotFound(_0x6aee1e){logger[_0x6103('0x2d')](util[_0x6103('0x1d')](_0x6103('0x37'),_0x6aee1e[_0x6103('0x1f')]));_0x6aee1e[_0x6103('0x38')](_0x6aee1e['context'],_0x6aee1e['extension'],parseInt(_0x6aee1e['priority'],0xa)+0x1);_0x6aee1e[_0x6103('0x36')]();}function handleUnpublished(_0x436db8){logger[_0x6103('0x2d')](util['format'](_0x6103('0x39'),_0x436db8[_0x6103('0x1f')]));_0x436db8['continueAt'](_0x436db8['context'],_0x436db8[_0x6103('0x27')],parseInt(_0x436db8[_0x6103('0x28')],0xa)+0x1);_0x436db8[_0x6103('0x36')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index b0a5002..b047b26 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 _0xcf84=['stream','Transform','call','_localBuffer','_inBody','prototype','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice','trim','headers','exports','util'];(function(_0xd81173,_0x2c2062){var _0x5a0a66=function(_0x3471cb){while(--_0x3471cb){_0xd81173['push'](_0xd81173['shift']());}};_0x5a0a66(++_0x2c2062);}(_0xcf84,0x175));var _0x4cf8=function(_0x46c8d6,_0x16fa9b){_0x46c8d6=_0x46c8d6-0x0;var _0x2084ec=_0xcf84[_0x46c8d6];return _0x2084ec;};'use strict';var util=require(_0x4cf8('0x0'));var Transform=require(_0x4cf8('0x1'))[_0x4cf8('0x2')];function AGIReply(_0x1281a8){Transform[_0x4cf8('0x3')](this,_0x1281a8);this[_0x4cf8('0x4')]='';this[_0x4cf8('0x5')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x4cf8('0x6')]['_transform']=function(_0x455916,_0x202b11,_0x2d6d19){var _0x55031c='\x0a',_0x5c25ae=['\x0a\x0a',_0x4cf8('0x7')],_0x2002cc=-0x1,_0x4755cd=-0x1,_0x4ea833='',_0x2ca70f=0x0,_0x467050='',_0x15792c='';this[_0x4cf8('0x4')]+=_0x455916[_0x4cf8('0x8')]();_0x467050=this[_0x4cf8('0x4')];if(!this[_0x4cf8('0x5')]){_0x2ca70f=0x0;while(_0x5c25ae[_0x2ca70f]){while((_0x4755cd=_0x467050[_0x4cf8('0x9')](_0x5c25ae[_0x2ca70f]))!=-0x1){_0x4ea833=_0x5c25ae[_0x2ca70f];_0x15792c=_0x467050['substring'](0x0,_0x4755cd);_0x467050=_0x467050[_0x4cf8('0xa')](_0x4755cd+_0x4ea833[_0x4cf8('0xb')]);var _0xf61aa9=_0x15792c[_0x4cf8('0xc')](_0x55031c),_0x15650a=0x0,_0xd15e6b={},_0x29f1cb='',_0x35b483='',_0x17290c=-0x1;while(_0xf61aa9[_0x15650a]){_0x17290c=_0xf61aa9[_0x15650a][_0x4cf8('0x9')](':');if(_0x17290c!=-0x1){_0x29f1cb=_0xf61aa9[_0x15650a][_0x4cf8('0xd')](0x0,_0x17290c)['trim']();_0x35b483=_0xf61aa9[_0x15650a][_0x4cf8('0xd')](_0x17290c+0x1)[_0x4cf8('0xe')]();if(_0x29f1cb['length']>0x0){_0xd15e6b[_0x29f1cb]=_0x35b483;}}else{}_0x15650a++;}this['emit'](_0x4cf8('0xf'),_0xd15e6b);this['_inBody']=!![];}_0x2ca70f++;}this[_0x4cf8('0x4')]=_0x467050;}else{while((_0x2002cc=_0x467050[_0x4cf8('0x9')](_0x55031c))!=-0x1){_0x15792c=_0x467050['substring'](0x0,_0x2002cc);this['emit']('line',_0x15792c);_0x467050=_0x467050[_0x4cf8('0xa')](_0x2002cc+_0x55031c[_0x4cf8('0xb')]);}this['_localBuffer']=_0x467050;}_0x2d6d19();};module[_0x4cf8('0x10')]=AGIReply; \ No newline at end of file +var _0xee5b=['trim','headers','line','exports','util','Transform','_localBuffer','_inBody','inherits','prototype','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','slice'];(function(_0x4a6ee2,_0x4bd476){var _0x82604d=function(_0x2e970c){while(--_0x2e970c){_0x4a6ee2['push'](_0x4a6ee2['shift']());}};_0x82604d(++_0x4bd476);}(_0xee5b,0x1f4));var _0xbee5=function(_0x496262,_0x67a9cb){_0x496262=_0x496262-0x0;var _0x44deff=_0xee5b[_0x496262];return _0x44deff;};'use strict';var util=require(_0xbee5('0x0'));var Transform=require('stream')[_0xbee5('0x1')];function AGIReply(_0x203bba){Transform['call'](this,_0x203bba);this[_0xbee5('0x2')]='';this[_0xbee5('0x3')]=![];}util[_0xbee5('0x4')](AGIReply,Transform);AGIReply[_0xbee5('0x5')]['_transform']=function(_0x5200b1,_0x2e8127,_0x2c0bde){var _0xab6e4d='\x0a',_0x804ab8=['\x0a\x0a',_0xbee5('0x6')],_0x4f5065=-0x1,_0x5505e3=-0x1,_0x53d5b9='',_0x5baf5c=0x0,_0x5536bd='',_0x20c66c='';this[_0xbee5('0x2')]+=_0x5200b1[_0xbee5('0x7')]();_0x5536bd=this['_localBuffer'];if(!this[_0xbee5('0x3')]){_0x5baf5c=0x0;while(_0x804ab8[_0x5baf5c]){while((_0x5505e3=_0x5536bd[_0xbee5('0x8')](_0x804ab8[_0x5baf5c]))!=-0x1){_0x53d5b9=_0x804ab8[_0x5baf5c];_0x20c66c=_0x5536bd[_0xbee5('0x9')](0x0,_0x5505e3);_0x5536bd=_0x5536bd[_0xbee5('0x9')](_0x5505e3+_0x53d5b9[_0xbee5('0xa')]);var _0x1509c7=_0x20c66c['split'](_0xab6e4d),_0x105e16=0x0,_0x17ee3c={},_0xcef158='',_0x48f771='',_0x14e032=-0x1;while(_0x1509c7[_0x105e16]){_0x14e032=_0x1509c7[_0x105e16][_0xbee5('0x8')](':');if(_0x14e032!=-0x1){_0xcef158=_0x1509c7[_0x105e16][_0xbee5('0xb')](0x0,_0x14e032)[_0xbee5('0xc')]();_0x48f771=_0x1509c7[_0x105e16]['slice'](_0x14e032+0x1)['trim']();if(_0xcef158[_0xbee5('0xa')]>0x0){_0x17ee3c[_0xcef158]=_0x48f771;}}else{}_0x105e16++;}this['emit'](_0xbee5('0xd'),_0x17ee3c);this['_inBody']=!![];}_0x5baf5c++;}this[_0xbee5('0x2')]=_0x5536bd;}else{while((_0x4f5065=_0x5536bd[_0xbee5('0x8')](_0xab6e4d))!=-0x1){_0x20c66c=_0x5536bd[_0xbee5('0x9')](0x0,_0x4f5065);this['emit'](_0xbee5('0xe'),_0x20c66c);_0x5536bd=_0x5536bd[_0xbee5('0x9')](_0x4f5065+_0xab6e4d['length']);}this[_0xbee5('0x2')]=_0x5536bd;}_0x2c0bde();};module[_0xbee5('0xf')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 39bbcc1..f46674e 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 _0xbe02=['getPauseById','agentLogin','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','jayson/promise','client','request','then','error','message','result','getSquareProjects','production','ShowSquareProject','getMailAccountById','MailServerOut','Smtp','CloudProvider','getSquareProjectById','name','ShowVoiceQueue','getVariableById','ShowSquareOdbc','dsn','getUserById','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Intervals','getSmsAccountById','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact'];(function(_0x476b5f,_0x1f9952){var _0x5a23d8=function(_0x50b464){while(--_0x50b464){_0x476b5f['push'](_0x476b5f['shift']());}};_0x5a23d8(++_0x1f9952);}(_0xbe02,0x124));var _0x2be0=function(_0x44f5fc,_0x44a60a){_0x44f5fc=_0x44f5fc-0x0;var _0x404b4b=_0xbe02[_0x44f5fc];return _0x404b4b;};'use strict';var _=require('lodash');var moment=require(_0x2be0('0x0'));var jayson=require(_0x2be0('0x1'));var client=jayson[_0x2be0('0x2')]['http']({'port':0x2329});function request(_0x499c2b,_0x1d7a85){return new Promise(function(_0x248e93,_0x506aad){return client[_0x2be0('0x3')](_0x499c2b,_0x1d7a85)[_0x2be0('0x4')](function(_0x443ace){if(_0x443ace[_0x2be0('0x5')]){return _0x506aad(_0x443ace[_0x2be0('0x5')][_0x2be0('0x6')]);}else{return _0x248e93(_0x443ace[_0x2be0('0x7')]);}})['catch'](function(_0xdf1605){return _0x506aad(_0xdf1605);});});}exports[_0x2be0('0x8')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id','name',_0x2be0('0x9')]}});};exports['getSquareProject']=function(_0xebe843){return request(_0x2be0('0xa'),{'options':{'raw':![],'where':{'name':_0xebe843},'attributes':[_0x2be0('0x9')]}});};exports[_0x2be0('0xb')]=function(_0x104667){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x104667},'include':[{'model':_0x2be0('0xc'),'as':_0x2be0('0xd'),'include':[{'model':_0x2be0('0xe'),'as':_0x2be0('0xe')}]}],'attributes':['id','name','email'],'smtp':!![]}});};exports[_0x2be0('0xf')]=function(_0x3baa57){return request(_0x2be0('0xa'),{'options':{'where':{'id':_0x3baa57},'attributes':[_0x2be0('0x10')]}});};exports['getVoiceQueueById']=function(_0x44d709){return request(_0x2be0('0x11'),{'options':{'where':{'id':_0x44d709},'attributes':[_0x2be0('0x10')]}});};exports[_0x2be0('0x12')]=function(_0x818f20){return request('ShowVariable',{'options':{'where':{'id':_0x818f20},'attributes':[_0x2be0('0x10')]}});};exports['getSquareOdbcById']=function(_0x698b89){return request(_0x2be0('0x13'),{'options':{'where':{'id':_0x698b89},'attributes':[_0x2be0('0x14')]}});};exports[_0x2be0('0x15')]=function(_0x3c247e){return request('ShowUser',{'options':{'where':{'id':_0x3c247e},'attributes':[_0x2be0('0x10')]}});};exports['getContactByPhone']=function(_0x473c97){return request(_0x2be0('0x16'),{'options':{'where':{'phone':_0x473c97[_0x2be0('0x17')]},'attributes':['id']}});};exports[_0x2be0('0x18')]=function(_0xc3b92a){return request(_0x2be0('0x19'),{'options':{'where':{'id':_0xc3b92a},'attributes':[_0x2be0('0x10')]}});};exports[_0x2be0('0x1a')]=function(_0x98bad6){return request('ShowSound',{'options':{'where':{'id':_0x98bad6},'attributes':[_0x2be0('0x1b')]}});};exports[_0x2be0('0x1c')]=function(_0x2cba28){return request(_0x2be0('0x1d'),{'options':{'raw':![],'where':{'id':_0x2cba28},'include':[{'model':'Interval','as':_0x2be0('0x1e')}]}});};exports[_0x2be0('0x1f')]=function(_0x55ea94){return request('ShowSmsAccount',{'options':{'where':{'id':_0x55ea94},'attributes':['id',_0x2be0('0x10')]}});};exports['createSmsMessage']=function(_0x20eb86){return request(_0x2be0('0x20'),{'body':_0x20eb86});};exports[_0x2be0('0x21')]=function(_0x4e6e4c){return request(_0x2be0('0x22'),{'body':_0x4e6e4c});};exports[_0x2be0('0x23')]=function(_0xab3a77){return request(_0x2be0('0x24'),{'body':_[_0x2be0('0x25')](_0xab3a77,{'project_name':_0xab3a77[_0x2be0('0x26')],'prev_project_name':_0xab3a77['arg_2']||'','is_subproject':_0xab3a77[_0x2be0('0x27')]?!![]:![],'leaveAt':moment()[_0x2be0('0x28')](_0x2be0('0x29'))})});};exports[_0x2be0('0x2a')]=function(_0x4686ca){return request(_0x2be0('0x2b'),{'body':_0x4686ca});};exports[_0x2be0('0x2c')]=function(_0xb83ebf){return request(_0x2be0('0x2d'),{'body':_0xb83ebf});};exports[_0x2be0('0x2e')]=function(_0x131dfb){return request(_0x2be0('0x2f'),{'options':{'raw':![],'where':{'phone':_0x131dfb[_0x2be0('0x17')],'ListId':_0x131dfb[_0x2be0('0x30')]}}})[_0x2be0('0x4')](function(_0x273df5){if(_0x273df5){return _0x273df5;}return request(_0x2be0('0x31'),{'body':_0x131dfb});});};exports[_0x2be0('0x32')]=function(_0x36d7c7){return request('ShowPause',{'options':{'where':{'id':_0x36d7c7},'attributes':['name']}});};exports[_0x2be0('0x33')]=function(_0x263479,_0x2745b9){return request('LoginUser',{'body':{'interface':_0x2745b9},'options':{'where':_0x263479}});};exports['agentPause']=function(_0x41ad52,_0x53020e,_0x316d9f){return request(_0x2be0('0x34'),{'body':{'type':_0x53020e,'uniqueid':_0x316d9f},'options':{'where':_0x41ad52}});};exports[_0x2be0('0x35')]=function(_0x229d7d){return request(_0x2be0('0x36'),{'body':{},'options':{'where':_0x229d7d}});};exports[_0x2be0('0x37')]=function(_0x44e36b){return request(_0x2be0('0x38'),{'body':{},'options':{'where':_0x44e36b}});}; \ No newline at end of file +var _0x76bb=['CreateCmContact','ShowPause','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','moment','jayson/promise','client','http','request','then','error','message','result','catch','getSquareProjects','GetSquareProjects','name','production','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','getUserById','getContactByPhone','GetContactByPhone','phone','getTrunkById','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact'];(function(_0x1b9805,_0x5f065f){var _0x3ccea0=function(_0x36036b){while(--_0x36036b){_0x1b9805['push'](_0x1b9805['shift']());}};_0x3ccea0(++_0x5f065f);}(_0x76bb,0x16a));var _0xb76b=function(_0x2179f1,_0x21c653){_0x2179f1=_0x2179f1-0x0;var _0x176ec9=_0x76bb[_0x2179f1];return _0x176ec9;};'use strict';var _=require('lodash');var moment=require(_0xb76b('0x0'));var jayson=require(_0xb76b('0x1'));var client=jayson[_0xb76b('0x2')][_0xb76b('0x3')]({'port':0x2329});function request(_0x4cd8bc,_0x3045e6){return new Promise(function(_0x1f5d45,_0x4e5042){return client[_0xb76b('0x4')](_0x4cd8bc,_0x3045e6)[_0xb76b('0x5')](function(_0x5c732e){if(_0x5c732e[_0xb76b('0x6')]){return _0x4e5042(_0x5c732e[_0xb76b('0x6')][_0xb76b('0x7')]);}else{return _0x1f5d45(_0x5c732e[_0xb76b('0x8')]);}})[_0xb76b('0x9')](function(_0x4f0c27){return _0x4e5042(_0x4f0c27);});});}exports[_0xb76b('0xa')]=function(){return request(_0xb76b('0xb'),{'options':{'raw':![],'attributes':['id',_0xb76b('0xc'),_0xb76b('0xd')]}});};exports['getSquareProject']=function(_0x53b43c){return request(_0xb76b('0xe'),{'options':{'raw':![],'where':{'name':_0x53b43c},'attributes':[_0xb76b('0xd')]}});};exports[_0xb76b('0xf')]=function(_0x2ebb61){return request(_0xb76b('0x10'),{'options':{'raw':![],'where':{'id':_0x2ebb61},'include':[{'model':_0xb76b('0x11'),'as':_0xb76b('0x12'),'include':[{'model':_0xb76b('0x13'),'as':'CloudProvider'}]}],'attributes':['id',_0xb76b('0xc'),'email'],'smtp':!![]}});};exports[_0xb76b('0x14')]=function(_0x3f8bc7){return request(_0xb76b('0xe'),{'options':{'where':{'id':_0x3f8bc7},'attributes':[_0xb76b('0xc')]}});};exports['getVoiceQueueById']=function(_0x10a6aa){return request(_0xb76b('0x15'),{'options':{'where':{'id':_0x10a6aa},'attributes':['name']}});};exports[_0xb76b('0x16')]=function(_0x4c642d){return request(_0xb76b('0x17'),{'options':{'where':{'id':_0x4c642d},'attributes':[_0xb76b('0xc')]}});};exports[_0xb76b('0x18')]=function(_0x4618b7){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x4618b7},'attributes':['dsn']}});};exports[_0xb76b('0x19')]=function(_0x1a6b2f){return request('ShowUser',{'options':{'where':{'id':_0x1a6b2f},'attributes':[_0xb76b('0xc')]}});};exports[_0xb76b('0x1a')]=function(_0xe67ff4){return request(_0xb76b('0x1b'),{'options':{'where':{'phone':_0xe67ff4[_0xb76b('0x1c')]},'attributes':['id']}});};exports[_0xb76b('0x1d')]=function(_0x1c4d0a){return request('ShowTrunk',{'options':{'where':{'id':_0x1c4d0a},'attributes':['name']}});};exports[_0xb76b('0x1e')]=function(_0x3c1e38){return request(_0xb76b('0x1f'),{'options':{'where':{'id':_0x3c1e38},'attributes':[_0xb76b('0x20')]}});};exports[_0xb76b('0x21')]=function(_0x5c142d){return request(_0xb76b('0x22'),{'options':{'raw':![],'where':{'id':_0x5c142d},'include':[{'model':'Interval','as':_0xb76b('0x23')}]}});};exports[_0xb76b('0x24')]=function(_0x18dc90){return request(_0xb76b('0x25'),{'options':{'where':{'id':_0x18dc90},'attributes':['id','name']}});};exports[_0xb76b('0x26')]=function(_0x2b4f3f){return request(_0xb76b('0x27'),{'body':_0x2b4f3f});};exports[_0xb76b('0x28')]=function(_0x844a15){return request('CreateSquareDetailsReport',{'body':_0x844a15});};exports[_0xb76b('0x29')]=function(_0x44ec61){return request('CreateSquareReport',{'body':_[_0xb76b('0x2a')](_0x44ec61,{'project_name':_0x44ec61['arg_1'],'prev_project_name':_0x44ec61['arg_2']||'','is_subproject':_0x44ec61[_0xb76b('0x2b')]?!![]:![],'leaveAt':moment()[_0xb76b('0x2c')](_0xb76b('0x2d'))})});};exports[_0xb76b('0x2e')]=function(_0x49f53c){return request(_0xb76b('0x2f'),{'body':_0x49f53c});};exports[_0xb76b('0x30')]=function(_0x1ebda2){return request(_0xb76b('0x31'),{'body':_0x1ebda2});};exports[_0xb76b('0x32')]=function(_0x1cf72b){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x1cf72b[_0xb76b('0x1c')],'ListId':_0x1cf72b['ListId']}}})['then'](function(_0x130263){if(_0x130263){return _0x130263;}return request(_0xb76b('0x33'),{'body':_0x1cf72b});});};exports['getPauseById']=function(_0x5b56e4){return request(_0xb76b('0x34'),{'options':{'where':{'id':_0x5b56e4},'attributes':[_0xb76b('0xc')]}});};exports['agentLogin']=function(_0x2a60db,_0x25189c){return request(_0xb76b('0x35'),{'body':{'interface':_0x25189c},'options':{'where':_0x2a60db}});};exports[_0xb76b('0x36')]=function(_0x5c4469,_0x3425bd,_0x36e586){return request(_0xb76b('0x37'),{'body':{'type':_0x3425bd,'uniqueid':_0x36e586},'options':{'where':_0x5c4469}});};exports[_0xb76b('0x38')]=function(_0x4ee758){return request('UnpauseUser',{'body':{},'options':{'where':_0x4ee758}});};exports[_0xb76b('0x39')]=function(_0x4db2b1){return request(_0xb76b('0x3a'),{'body':{},'options':{'where':_0x4db2b1}});}; \ 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 b8986bf..a892d34 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 _0x90ec=['./polly','./lex'];(function(_0x43841f,_0x4df0c4){var _0x417f61=function(_0x4a354e){while(--_0x4a354e){_0x43841f['push'](_0x43841f['shift']());}};_0x417f61(++_0x4df0c4);}(_0x90ec,0x1d4));var _0xc90e=function(_0x554e66,_0x4c7936){_0x554e66=_0x554e66-0x0;var _0x487a08=_0x90ec[_0x554e66];return _0x487a08;};var polly=require(_0xc90e('0x0'));var lex=require(_0xc90e('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x7fd6=['exports','./polly'];(function(_0x459423,_0x3416a8){var _0x42ed14=function(_0x1d4f69){while(--_0x1d4f69){_0x459423['push'](_0x459423['shift']());}};_0x42ed14(++_0x3416a8);}(_0x7fd6,0x157));var _0x67fd=function(_0x295329,_0x26ca89){_0x295329=_0x295329-0x0;var _0x4f3258=_0x7fd6[_0x295329];return _0x4f3258;};var polly=require(_0x67fd('0x0'));var lex=require('./lex');module[_0x67fd('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 22515b4..058d0c6 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x2936e7,_0x2afa91,_0x27405a,_0x305d85,_0x864539,_0x52b5fb){return lex(_0x2936e7,_0x2afa91,_0x27405a,_0x305d85,_0x864539,_0x52b5fb);}; \ No newline at end of file +var _0x5b02=['exports','./lib/api'];(function(_0xb74ef8,_0x3402cf){var _0x4ff3a4=function(_0x26c5a){while(--_0x26c5a){_0xb74ef8['push'](_0xb74ef8['shift']());}};_0x4ff3a4(++_0x3402cf);}(_0x5b02,0xe9));var _0x25b0=function(_0x4885cd,_0xef6787){_0x4885cd=_0x4885cd-0x0;var _0x169220=_0x5b02[_0x4885cd];return _0x169220;};'use strict';var lex=require(_0x25b0('0x0'));module[_0x25b0('0x1')]=function(_0x428458,_0x1c3295,_0x4ef71c,_0x4cb227,_0x2b5f2d,_0x53493e){return lex(_0x428458,_0x1c3295,_0x4ef71c,_0x4cb227,_0x2b5f2d,_0x53493e);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index 0bc0ce6..80941c5 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(_0x4bae1e,_0xe6d628){var _0x2a1460=function(_0x36b647){while(--_0x36b647){_0x4bae1e['push'](_0x4bae1e['shift']());}};_0x2a1460(++_0xe6d628);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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(_0x5815c6,_0x2cd5d7){var _0x1605f1=function(_0x3b5a11){while(--_0x3b5a11){_0x5815c6['push'](_0x5815c6['shift']());}};_0x1605f1(++_0x2cd5d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 a480519..6d42e6f 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 _0xfa0d=['exports','./lib/api'];(function(_0x4e85ec,_0x2913b6){var _0x1c1ab3=function(_0x2c55b6){while(--_0x2c55b6){_0x4e85ec['push'](_0x4e85ec['shift']());}};_0x1c1ab3(++_0x2913b6);}(_0xfa0d,0xcd));var _0xdfa0=function(_0x5dc7ac,_0x1d5e66){_0x5dc7ac=_0x5dc7ac-0x0;var _0x3852fc=_0xfa0d[_0x5dc7ac];return _0x3852fc;};'use strict';var polly=require(_0xdfa0('0x0'));module[_0xdfa0('0x1')]=function(_0xfdd907,_0x3db41d,_0x122c2b,_0x119c18,_0x175ca,_0x125984,_0x355c71){return polly(_0xfdd907,_0x3db41d,_0x122c2b,_0x119c18,_0x175ca,_0x125984,_0x355c71);}; \ No newline at end of file +var _0xaf8b=['exports','./lib/api'];(function(_0x480f14,_0x36d818){var _0x3c0829=function(_0x33bafc){while(--_0x33bafc){_0x480f14['push'](_0x480f14['shift']());}};_0x3c0829(++_0x36d818);}(_0xaf8b,0x1ab));var _0xbaf8=function(_0x5aa49b,_0x207dd1){_0x5aa49b=_0x5aa49b-0x0;var _0x2239fd=_0xaf8b[_0x5aa49b];return _0x2239fd;};'use strict';var polly=require(_0xbaf8('0x0'));module[_0xbaf8('0x1')]=function(_0x25032d,_0x429f2a,_0x324320,_0x4a5d58,_0x2c53c5,_0x3cbf69,_0xf460f7){return polly(_0x25032d,_0x429f2a,_0x324320,_0x4a5d58,_0x2c53c5,_0x3cbf69,_0xf460f7);}; \ 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 a918666..820cae6 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 _0x8272=['AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','aws-sdk','synthesizeSpeech','writeFile'];(function(_0x26371f,_0x3529d6){var _0x7bf77f=function(_0xaaf7ec){while(--_0xaaf7ec){_0x26371f['push'](_0x26371f['shift']());}};_0x7bf77f(++_0x3529d6);}(_0x8272,0x1d4));var _0x2827=function(_0x311170,_0x5ecf43){_0x311170=_0x311170-0x0;var _0x3b4a19=_0x8272[_0x311170];return _0x3b4a19;};'use strict';var fs=require('fs');var path=require(_0x2827('0x0'));var BPromise=require(_0x2827('0x1'));var rs=require('randomstring');var AWS=require(_0x2827('0x2'));function pollyResult(_0x501d16,_0x57522f,_0x1b4769){return new BPromise(function(_0x99b32f,_0x2803c6){_0x501d16[_0x2827('0x3')](_0x57522f,function(_0x30f38d,_0x5eea04){if(_0x30f38d){_0x2803c6(_0x30f38d);}else if(_0x5eea04){if(_0x5eea04['AudioStream']instanceof Buffer){fs[_0x2827('0x4')](_0x1b4769,_0x5eea04[_0x2827('0x5')],function(_0x12cfd6){if(_0x12cfd6){_0x2803c6(_0x12cfd6);}else{_0x99b32f();}});}else{_0x2803c6(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x2803c6(new Error(_0x2827('0x6')));}});});}module[_0x2827('0x7')]=function(_0x4c6f30,_0xe72a46,_0x5072ea,_0x2305bf,_0x246f37,_0x25b129,_0x50288f){var _0x2f1727=new AWS[(_0x2827('0x8'))]({'accessKeyId':_0x4c6f30,'secretAccessKey':_0xe72a46,'region':_0x5072ea});var _0x24a6cc={'Text':_0x246f37,'TextType':_0x25b129||_0x2827('0x9'),'OutputFormat':_0x2827('0xa'),'VoiceId':_0x2305bf};return pollyResult(_0x2f1727,_0x24a6cc,_0x50288f);}; \ No newline at end of file +var _0xe019=['exports','text','mp3','path','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x3245d4,_0x380f8f){var _0x359f5e=function(_0x1d4890){while(--_0x1d4890){_0x3245d4['push'](_0x3245d4['shift']());}};_0x359f5e(++_0x380f8f);}(_0xe019,0x163));var _0x9e01=function(_0x5d6e8a,_0x169065){_0x5d6e8a=_0x5d6e8a-0x0;var _0x166ece=_0xe019[_0x5d6e8a];return _0x166ece;};'use strict';var fs=require('fs');var path=require(_0x9e01('0x0'));var BPromise=require('bluebird');var rs=require(_0x9e01('0x1'));var AWS=require(_0x9e01('0x2'));function pollyResult(_0x5bc260,_0x1a8b09,_0x260bf0){return new BPromise(function(_0x3adf2c,_0x8d7c0f){_0x5bc260[_0x9e01('0x3')](_0x1a8b09,function(_0xc0baf6,_0x1784b){if(_0xc0baf6){_0x8d7c0f(_0xc0baf6);}else if(_0x1784b){if(_0x1784b[_0x9e01('0x4')]instanceof Buffer){fs[_0x9e01('0x5')](_0x260bf0,_0x1784b[_0x9e01('0x4')],function(_0x50a356){if(_0x50a356){_0x8d7c0f(_0x50a356);}else{_0x3adf2c();}});}else{_0x8d7c0f(new Error(_0x9e01('0x6')));}}else{_0x8d7c0f(new Error(_0x9e01('0x7')));}});});}module[_0x9e01('0x8')]=function(_0x34d201,_0x2281db,_0x338b58,_0x32fd25,_0x30b432,_0x520b5e,_0x1fe329){var _0x360529=new AWS['Polly']({'accessKeyId':_0x34d201,'secretAccessKey':_0x2281db,'region':_0x338b58});var _0x1559bf={'Text':_0x30b432,'TextType':_0x520b5e||_0x9e01('0x9'),'OutputFormat':_0x9e01('0xa'),'VoiceId':_0x32fd25};return pollyResult(_0x360529,_0x1559bf,_0x1fe329);}; \ 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 0ba73ba..805584a 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. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x317fdd,_0x3b038b,_0x3a87a8,_0x52ce90){return asr(_0x317fdd,_0x3b038b,_0x3a87a8);}; \ No newline at end of file +var _0xf04b=['./lib/api'];(function(_0x5cc652,_0x45dd0a){var _0x136031=function(_0x20298c){while(--_0x20298c){_0x5cc652['push'](_0x5cc652['shift']());}};_0x136031(++_0x45dd0a);}(_0xf04b,0x6a));var _0xbf04=function(_0x1c5b3d,_0x53463b){_0x1c5b3d=_0x1c5b3d-0x0;var _0x4f55f7=_0xf04b[_0x1c5b3d];return _0x4f55f7;};'use strict';var asr=require(_0xbf04('0x0'));module['exports']=function(_0x36281f,_0x62d9ab,_0x329ef1,_0x5f361c){return asr(_0x36281f,_0x62d9ab,_0x329ef1);}; \ 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 0570e5c..bbc21cd 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 _0x85b5=['8000','url','bluebird','exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16'];(function(_0x243df1,_0x191379){var _0xdb18ee=function(_0xa19801){while(--_0xa19801){_0x243df1['push'](_0x243df1['shift']());}};_0xdb18ee(++_0x191379);}(_0x85b5,0x7f));var _0x585b=function(_0x4bb223,_0x13ebbe){_0x4bb223=_0x4bb223-0x0;var _0x559caa=_0x85b5[_0x4bb223];return _0x559caa;};'use strict';var url=require(_0x585b('0x0'));var BPromise=require(_0x585b('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x585b('0x2')]=function(_0x4a79cf,_0x18ab39,_0x5a7ff0){return new BPromise(function(_0x4d5064,_0x331fe8){var _0x4f37a9;if(typeof _0x4a79cf!==_0x585b('0x3')||_0x4a79cf[_0x585b('0x4')]===0x0){return _0x331fe8(_0x585b('0x5'));}if(typeof _0x18ab39!=='string'||_0x18ab39[_0x585b('0x4')]===0x0){return _0x331fe8('key\x20should\x20be\x20a\x20string');}if(typeof _0x5a7ff0!==_0x585b('0x6')&&(typeof _0x5a7ff0!==_0x585b('0x3')||_0x5a7ff0[_0x585b('0x4')]===0x0)){return _0x331fe8(_0x585b('0x7'));}try{_0x4f37a9=fs['readFileSync'](_0x4a79cf)[_0x585b('0x8')](_0x585b('0x9'));}catch(_0x430c16){return _0x331fe8(_0x430c16);}return _0x4d5064({'method':_0x585b('0xa'),'uri':host+_0x585b('0xb')+_0x18ab39,'body':{'config':{'encoding':_0x585b('0xc'),'sampleRateHertz':_0x585b('0xd'),'languageCode':_0x5a7ff0},'audio':{'content':_0x4f37a9}},'json':!![]});});}; \ No newline at end of file +var _0x0c6d=['length','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','bluebird','https://speech.googleapis.com','exports','filepath\x20should\x20be\x20a\x20string','string'];(function(_0x105a9d,_0x5a66f3){var _0x17b1b7=function(_0x39f7fb){while(--_0x39f7fb){_0x105a9d['push'](_0x105a9d['shift']());}};_0x17b1b7(++_0x5a66f3);}(_0x0c6d,0xf7));var _0xd0c6=function(_0x5137c6,_0x43a1ea){_0x5137c6=_0x5137c6-0x0;var _0x454ea2=_0x0c6d[_0x5137c6];return _0x454ea2;};'use strict';var url=require('url');var BPromise=require(_0xd0c6('0x0'));var fs=require('fs');var host=_0xd0c6('0x1');module[_0xd0c6('0x2')]=function(_0x42a166,_0x18ccf3,_0x3d5f2b){return new BPromise(function(_0x5790fc,_0x434cdd){var _0x511921;if(typeof _0x42a166!=='string'||_0x42a166['length']===0x0){return _0x434cdd(_0xd0c6('0x3'));}if(typeof _0x18ccf3!==_0xd0c6('0x4')||_0x18ccf3[_0xd0c6('0x5')]===0x0){return _0x434cdd('key\x20should\x20be\x20a\x20string');}if(typeof _0x3d5f2b!==_0xd0c6('0x6')&&(typeof _0x3d5f2b!=='string'||_0x3d5f2b[_0xd0c6('0x5')]===0x0)){return _0x434cdd(_0xd0c6('0x7'));}try{_0x511921=fs[_0xd0c6('0x8')](_0x42a166)[_0xd0c6('0x9')](_0xd0c6('0xa'));}catch(_0x2a1be){return _0x434cdd(_0x2a1be);}return _0x5790fc({'method':_0xd0c6('0xb'),'uri':host+_0xd0c6('0xc')+_0x18ccf3,'body':{'config':{'encoding':_0xd0c6('0xd'),'sampleRateHertz':'8000','languageCode':_0x3d5f2b},'audio':{'content':_0x511921}},'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 9d2a45d..07ba886 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 _0xd006=['./asr','exports'];(function(_0x270b7e,_0x1b380a){var _0x4d039d=function(_0x59f916){while(--_0x59f916){_0x270b7e['push'](_0x270b7e['shift']());}};_0x4d039d(++_0x1b380a);}(_0xd006,0x8a));var _0x6d00=function(_0xfbdff6,_0x2af690){_0xfbdff6=_0xfbdff6-0x0;var _0x4cb9be=_0xd006[_0xfbdff6];return _0x4cb9be;};var asr=require(_0x6d00('0x0'));module[_0x6d00('0x1')]={'asr':asr}; \ No newline at end of file +var _0xa96a=['./asr','exports'];(function(_0x4efd3d,_0x2b9694){var _0x1293f2=function(_0x14b90f){while(--_0x14b90f){_0x4efd3d['push'](_0x4efd3d['shift']());}};_0x1293f2(++_0x2b9694);}(_0xa96a,0x6a));var _0xaa96=function(_0x17812e,_0x429028){_0x17812e=_0x17812e-0x0;var _0x256192=_0xa96a[_0x17812e];return _0x256192;};var asr=require(_0xaa96('0x0'));module[_0xaa96('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 2dbdc5a..8cf7862 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 _0xbc58=['toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','MP3','.mp3','from','audioContent','writeFile','777','unlink','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','stringify','jQ1olc','generic','slice','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','googleASR','asr','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','score','status','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','action','allRequiredParamsPresent','diagnosticInfo','queryResult','fields','end_conversation','fulfillmentText','intent','isFallback','languageCode','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','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','nda','channelData','CustomAction','Data','audiofile','dirName','bluebird','dialogflow','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','parse','./aws','./google','./sestek','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','close','download\x20error','pipe','end','https:','transcode','wav','error\x20convert','info','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','then','chmodSync','split','readFileSync'];(function(_0x5ead4c,_0x2151b6){var _0x2ea307=function(_0x2580c3){while(--_0x2580c3){_0x5ead4c['push'](_0x5ead4c['shift']());}};_0x2ea307(++_0x2151b6);}(_0xbc58,0xe1));var _0x8bc5=function(_0x12ee61,_0x2c2591){_0x12ee61=_0x12ee61-0x0;var _0x474063=_0xbc58[_0x12ee61];return _0x474063;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x8bc5('0x0'));var dialogflow=require(_0x8bc5('0x1'));var fs=require('fs');var http=require('http');var https=require(_0x8bc5('0x2'));var md5=require(_0x8bc5('0x3'));var path=require(_0x8bc5('0x4'));var querystring=require(_0x8bc5('0x5'));var rp=require(_0x8bc5('0x6'));var rs=require(_0x8bc5('0x7'));var sox=require(_0x8bc5('0x8'));var tts=require(_0x8bc5('0x9'));var urlParse=require('url')[_0x8bc5('0xa')];var util=require('util');var aws=require(_0x8bc5('0xb'));var google=require(_0x8bc5('0xc'));var sestek=require(_0x8bc5('0xd'));var tilde=require('./tilde');var logger=require('../../../config/logger')(_0x8bc5('0xe'));var ISPEECH_API=_0x8bc5('0xf');function downloadFile(_0x487e44,_0x215220){return new BPromise(function(_0x34d81b,_0x526794){var _0x1ff087=urlParse(_0x487e44);var _0x376abd=_0x1ff087[_0x8bc5('0x10')]==='https:'?https:http;var _0x5031f3={'host':_0x1ff087[_0x8bc5('0x11')],'path':_0x1ff087[_0x8bc5('0x4')],'headers':{'user-agent':_0x8bc5('0x12')}};_0x376abd[_0x8bc5('0x13')](_0x5031f3,function(_0x3d3907){if(_0x3d3907[_0x8bc5('0x14')]!==0xc8){logger[_0x8bc5('0x15')](_0x8bc5('0x16')+_0x487e44+_0x8bc5('0x17')+_0x3d3907['statusCode']+'\x20('+_0x3d3907[_0x8bc5('0x18')]+')');_0x526794(new Error(_0x8bc5('0x16')+_0x487e44+_0x8bc5('0x17')+_0x3d3907[_0x8bc5('0x14')]+'\x20('+_0x3d3907['statusMessage']+')'));return;}var _0x25451d=fs[_0x8bc5('0x19')](_0x215220);_0x25451d['on'](_0x8bc5('0x1a'),function(){logger['info']('finish\x20download\x20file');_0x25451d[_0x8bc5('0x1b')](_0x34d81b);});_0x25451d['on'](_0x8bc5('0x15'),function(_0x27a6d6){fs['unlink'](_0x215220);logger[_0x8bc5('0x15')](_0x8bc5('0x1c'),_0x27a6d6);_0x526794(_0x27a6d6);});_0x3d3907[_0x8bc5('0x1d')](_0x25451d);})['on'](_0x8bc5('0x15'),function(_0x5487ed){logger[_0x8bc5('0x15')](_0x5487ed);_0x526794(_0x5487ed);})[_0x8bc5('0x1e')]();});}function uploadFile(_0x52ce31){return new BPromise(function(_0x4006af,_0x5e4886){var _0x289ffa=urlParse(_0x52ce31);var _0x43b5d1=_0x289ffa[_0x8bc5('0x10')]===_0x8bc5('0x1f')?https:http;var _0x5bcc2d={'host':_0x289ffa['host'],'path':_0x289ffa['path'],'headers':{'user-agent':_0x8bc5('0x12')}};_0x43b5d1['get'](_0x5bcc2d,function(_0x422fe3){if(_0x422fe3[_0x8bc5('0x14')]!==0xc8){_0x5e4886(new Error('request\x20to\x20'+_0x52ce31+'\x20failed,\x20status\x20code\x20=\x20'+_0x422fe3[_0x8bc5('0x14')]+'\x20('+_0x422fe3[_0x8bc5('0x18')]+')'));return;}var _0x378a81='';_0x422fe3['on']('data',function(_0xf60443){_0x378a81+=_0xf60443;});_0x422fe3['on'](_0x8bc5('0x1e'),function(){_0x4006af(_0x378a81);});})['on'](_0x8bc5('0x15'),function(_0x39b4bb){_0x5e4886(_0x39b4bb);})[_0x8bc5('0x1e')]();});}function convertFile(_0x173e16,_0x4eb549){return new BPromise(function(_0x5d247d,_0x3e575a){var _0x4a5454=sox[_0x8bc5('0x20')](_0x173e16,_0x4eb549,{'sampleRate':0x1f40,'format':_0x8bc5('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4a5454['on'](_0x8bc5('0x15'),function(_0x46584e){logger[_0x8bc5('0x15')](_0x8bc5('0x22'),_0x46584e);_0x3e575a(_0x46584e);});_0x4a5454['on'](_0x8bc5('0x1e'),function(){logger[_0x8bc5('0x23')](_0x8bc5('0x24'));_0x5d247d();});_0x4a5454[_0x8bc5('0x25')]();});}function base64Decode(_0x5138bc,_0x40b662){var _0x203e68=path[_0x8bc5('0x26')](__dirname,_0x8bc5('0x27'),rs[_0x8bc5('0x28')](0x4)+_0x8bc5('0x29'));fs[_0x8bc5('0x2a')](_0x203e68,_0x5138bc,'base64');return convertFile(_0x203e68,_0x40b662)[_0x8bc5('0x2b')](function(){try{fs['unlink'](_0x203e68);fs[_0x8bc5('0x2c')](_0x40b662,'777');}catch(_0x5ae4ca){logger['error'](_0x5ae4ca);}return _0x40b662[_0x8bc5('0x2d')]('.')[0x0];});}function base64Encode(_0x397622){var _0x2e8d04=fs[_0x8bc5('0x2e')](_0x397622);return new Buffer(_0x2e8d04)[_0x8bc5('0x2f')](_0x8bc5('0x30'));}exports[_0x8bc5('0x31')]=function(_0x1870ee,_0x594d28,_0x3d2ca0,_0x9f27d5,_0x3ab8ed,_0x32f1ef){var _0x54fc7c,_0x4bdeb4;var _0x24c9a7=_0x8bc5('0x32');var _0x2117d1='?key='+_0x1870ee;var _0xae9754={};if(_0x594d28===_0x8bc5('0x33')){_0xae9754[_0x8bc5('0x34')]={'ssml':_0x3d2ca0};}else{_0xae9754[_0x8bc5('0x34')]={'text':_0x3d2ca0};};_0xae9754[_0x8bc5('0x35')]={'languageCode':_0x9f27d5,'ssmlGender':_0x3ab8ed};_0xae9754[_0x8bc5('0x36')]={'audioEncoding':_0x8bc5('0x37'),'sampleRateHertz':0x1f40};var _0x56fd94={'url':_0x24c9a7+'text:synthesize'+_0x2117d1,'method':'POST','json':!![],'body':_0xae9754};return rp(_0x56fd94)[_0x8bc5('0x2b')](function(_0x305606){return new BPromise(function(_0x4cd18a,_0x23818e){_0x54fc7c=path[_0x8bc5('0x26')](__dirname,_0x8bc5('0x27'),rs[_0x8bc5('0x28')](0x4)+_0x8bc5('0x38'));var _0x103bb9=Buffer[_0x8bc5('0x39')](_0x305606[_0x8bc5('0x3a')],_0x8bc5('0x30'));return fs[_0x8bc5('0x3b')](_0x54fc7c,_0x103bb9,function(_0x3c6f84){_0x23818e(_0x3c6f84);},function(_0x44fa9e){fs['chmodSync'](_0x54fc7c,_0x8bc5('0x3c'));_0x4cd18a(_0x44fa9e);});});})['then'](function(_0x5b075d){_0x4bdeb4=path[_0x8bc5('0x26')](__dirname,'tmp',rs['generate'](0x4)+_0x8bc5('0x29'));return convertFile(_0x54fc7c,_0x4bdeb4);})[_0x8bc5('0x2b')](function(){try{fs[_0x8bc5('0x3d')](_0x54fc7c);fs[_0x8bc5('0x2c')](_0x4bdeb4,_0x8bc5('0x3c'));}catch(_0x439582){logger[_0x8bc5('0x15')](_0x439582);}logger[_0x8bc5('0x23')](_0x8bc5('0x3e'),_0x4bdeb4['split']('.')[0x0]);return _0x4bdeb4[_0x8bc5('0x2d')]('.')[0x0];});};exports[_0x8bc5('0x3f')]=function(_0x57a97c,_0x7fa63c){var _0x92b7d3=_0x8bc5('0x40');var _0x4ac798,_0x4d6a06;var _0x3e9173;var _0x5b7ad3={'encoding':_0x8bc5('0x41'),'method':_0x8bc5('0x42'),'timeout':0x2710,'url':_0x92b7d3,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON[_0x8bc5('0x43')]([[[_0x8bc5('0x44'),JSON[_0x8bc5('0x43')]([_0x57a97c,_0x7fa63c||'en',![],'null']),null,_0x8bc5('0x45')]]]))};return rp(_0x5b7ad3)[_0x8bc5('0x2b')](function(_0x20570c){try{_0x3e9173=eval(_0x20570c[_0x8bc5('0x46')](0x5))[0x0][0x2];}catch(_0x34a7c1){throw new Error(_0x8bc5('0x47')+_0x20570c[_0x8bc5('0x48')]);}if(!_0x3e9173){if(_0x57a97c[_0x8bc5('0x49')]>0xc8){throw new Error(_0x8bc5('0x4a'));}else{throw new Error(_0x8bc5('0x4b')+_0x7fa63c+'\x22\x20might\x20not\x20exist');}}try{_0x3e9173=eval(_0x3e9173)[0x0];}catch(_0x3a9748){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x35771e=_0x3e9173;_0x4ac798=path[_0x8bc5('0x26')](__dirname,'tmp',rs[_0x8bc5('0x28')](0x4)+_0x8bc5('0x38'));fs[_0x8bc5('0x2a')](_0x4ac798,_0x3e9173,{'encoding':_0x8bc5('0x30')});_0x4d6a06=path[_0x8bc5('0x26')](__dirname,_0x8bc5('0x27'),rs[_0x8bc5('0x28')](0x4)+_0x8bc5('0x29'));return convertFile(_0x4ac798,_0x4d6a06);})[_0x8bc5('0x2b')](function(){try{fs[_0x8bc5('0x3d')](_0x4ac798);fs['chmodSync'](_0x4d6a06,_0x8bc5('0x3c'));}catch(_0x309209){logger['error'](_0x309209);}logger[_0x8bc5('0x23')]('goggleTTS\x20path',_0x4d6a06[_0x8bc5('0x2d')]('.')[0x0]);return _0x4d6a06[_0x8bc5('0x2d')]('.')[0x0];});};exports[_0x8bc5('0x4c')]=function(_0x3c2bfb,_0x195a80,_0x4f7787){return google[_0x8bc5('0x4d')](_0x3c2bfb,_0x195a80,_0x4f7787)[_0x8bc5('0x2b')](function(_0x9a5606){logger[_0x8bc5('0x23')](_0x9a5606[_0x8bc5('0x4e')]);return rp(_0x9a5606);})[_0x8bc5('0x2b')](function(_0x4b4d7b){var _0x497c5a='';var _0x42943d=0x0;try{fs['unlink'](_0x3c2bfb);}catch(_0x2f3887){logger[_0x8bc5('0x15')](_0x2f3887);}if(_0x4b4d7b&&_0x4b4d7b[_0x8bc5('0x4f')]){_0x497c5a=_0x4b4d7b['results'][_0x8bc5('0x50')](function(_0x4f0986){return _0x4f0986&&_0x4f0986[_0x8bc5('0x51')][0x0]&&_0x4f0986[_0x8bc5('0x51')][0x0][_0x8bc5('0x52')]?_0x4f0986['alternatives'][0x0][_0x8bc5('0x52')]:'';})['join']('\x0a');_0x42943d=_0x4b4d7b[_0x8bc5('0x4f')][_0x8bc5('0x50')](function(_0x3ccad4){return _0x3ccad4&&_0x3ccad4[_0x8bc5('0x51')][0x0]&&_0x3ccad4['alternatives'][0x0][_0x8bc5('0x53')]?_0x3ccad4[_0x8bc5('0x51')][0x0][_0x8bc5('0x53')]:0x0;})[_0x8bc5('0x54')]('\x0a');}logger['info']('googleASR\x20transcription',_0x497c5a);logger[_0x8bc5('0x23')](_0x8bc5('0x55'),_0x42943d);return{'transcript':_0x497c5a,'confidence':_0x42943d};})[_0x8bc5('0x56')](function(_0x3f3cdb){logger[_0x8bc5('0x15')](_0x8bc5('0x57'),_0x3f3cdb[_0x8bc5('0x14')],_0x3f3cdb['name'],_0x3f3cdb[_0x8bc5('0x58')]);});};exports[_0x8bc5('0x59')]=function(_0x819372,_0x39fc8d,_0x517cef,_0x2b3369){var _0x222a3b=apiai(_0x39fc8d,{'language':_0x2b3369||'en'});return _0x222a3b[_0x8bc5('0x5a')](_0x517cef,{'sessionId':md5(_0x819372)})['then'](function(_0x27ce32){logger[_0x8bc5('0x23')](JSON[_0x8bc5('0x43')](_0x27ce32));return{'source':_0x27ce32[_0x8bc5('0x5b')][_0x8bc5('0x5c')],'resolvedQuery':_0x27ce32[_0x8bc5('0x5b')][_0x8bc5('0x5d')],'action':_0x27ce32[_0x8bc5('0x5b')]['action'],'actionIncomplete':_0x27ce32[_0x8bc5('0x5b')][_0x8bc5('0x5e')],'speech':_0x27ce32[_0x8bc5('0x5b')][_0x8bc5('0x5f')][_0x8bc5('0x60')],'score':_0x27ce32[_0x8bc5('0x5b')][_0x8bc5('0x61')],'statusCode':_0x27ce32[_0x8bc5('0x62')]['code'],'endConversation':_0x27ce32[_0x8bc5('0x5b')][_0x8bc5('0x63')][_0x8bc5('0x64')]||![],'isFallbackIntent':_0x27ce32['result'][_0x8bc5('0x63')][_0x8bc5('0x65')]};});};exports[_0x8bc5('0x66')]=function(_0x402e5e,_0x25f791,_0x50d8b8,_0x398565,_0x298a4e,_0x45e95b){var _0x4071bd=_0x398565[_0x8bc5('0x67')](/\\n/g,'\x0a');var _0x46b76a={'credentials':{'private_key':_0x4071bd,'client_email':_0x50d8b8}};var _0x542b16=new dialogflow[(_0x8bc5('0x68'))](_0x46b76a);var _0x995edd=_0x542b16[_0x8bc5('0x69')](_0x25f791,md5(_0x402e5e));var _0x4063b2={'session':_0x995edd,'queryInput':{'text':{'text':_0x298a4e,'languageCode':_0x45e95b}}};return _0x542b16['detectIntent'](_0x4063b2)[_0x8bc5('0x2b')](function(_0x491fea){if(_0x491fea&&_0x491fea[_0x8bc5('0x49')]){logger[_0x8bc5('0x23')](_0x8bc5('0x6a'),JSON[_0x8bc5('0x43')](_0x491fea));var _0x169bab=_0x491fea[0x0];if(_0x169bab){var _0xeeb738={'action':_0x169bab['queryResult'][_0x8bc5('0x6b')],'allRequiredParamsPresent':_0x169bab['queryResult'][_0x8bc5('0x6c')],'endConversation':_0x169bab['queryResult'][_0x8bc5('0x6d')]&&_0x169bab[_0x8bc5('0x6e')][_0x8bc5('0x6d')]['fields']?_0x169bab['queryResult']['diagnosticInfo'][_0x8bc5('0x6f')][_0x8bc5('0x70')]['boolValue']:![],'fulfillmentText':_0x169bab[_0x8bc5('0x6e')][_0x8bc5('0x71')],'intentName':_0x169bab[_0x8bc5('0x6e')][_0x8bc5('0x72')]['name'],'intentDisplayName':_0x169bab[_0x8bc5('0x6e')][_0x8bc5('0x72')]['displayName'],'isFallbackIntent':_0x169bab[_0x8bc5('0x6e')][_0x8bc5('0x72')][_0x8bc5('0x73')],'languageCode':_0x169bab[_0x8bc5('0x6e')][_0x8bc5('0x74')],'queryText':_0x169bab[_0x8bc5('0x6e')]['queryText'],'responseId':_0x169bab[_0x8bc5('0x75')],'score':_0x169bab[_0x8bc5('0x6e')][_0x8bc5('0x76')],'speech':_0x169bab[_0x8bc5('0x6e')][_0x8bc5('0x71')],'providerResponse':JSON[_0x8bc5('0x43')](_0x491fea)};return _0xeeb738;}}});};exports['tildeASR']=function(_0x1dfaf8,_0x180cc9,_0x2b804b,_0x529025){return tilde['asr'](_0x1dfaf8,_0x180cc9,_0x2b804b,_0x529025)[_0x8bc5('0x2b')](function(_0x23a267){try{fs['unlink'](_0x1dfaf8);}catch(_0x221c14){logger['error'](_0x221c14);}logger[_0x8bc5('0x23')](_0x8bc5('0x77'),_0x23a267['transcript']);logger['info']('Tilde\x20ASR\x20confidence',_0x23a267[_0x8bc5('0x53')]);return _0x23a267;});};exports[_0x8bc5('0x78')]=function(_0x5a60be,_0x5f14df,_0x4a7417,_0x10cd3a,_0x4e5179,_0x4da1fd){var _0x32e3d5=path[_0x8bc5('0x26')](__dirname,_0x8bc5('0x27'),rs[_0x8bc5('0x28')](0x4)+_0x8bc5('0x38'));var _0x31d4e8;return aws[_0x8bc5('0x79')](_0x5a60be,_0x5f14df,_0x4a7417,_0x10cd3a,_0x4e5179,_0x4da1fd,_0x32e3d5)['then'](function(){_0x31d4e8=path['resolve'](__dirname,_0x8bc5('0x27'),rs[_0x8bc5('0x28')](0x4)+_0x8bc5('0x29'));return convertFile(_0x32e3d5,_0x31d4e8);})[_0x8bc5('0x2b')](function(){try{fs[_0x8bc5('0x3d')](_0x32e3d5);fs['chmodSync'](_0x31d4e8,_0x8bc5('0x3c'));}catch(_0x522e09){logger['error'](_0x522e09);}return _0x31d4e8[_0x8bc5('0x2d')]('.')[0x0];});};exports[_0x8bc5('0x7a')]=function(_0x111139,_0x5bf398,_0x385f93,_0x366222,_0x4e1134,_0x23bf7e){return aws[_0x8bc5('0x7b')](_0x111139,_0x5bf398,_0x385f93,_0x366222,_0x4e1134,_0x23bf7e)[_0x8bc5('0x2b')](function(_0x394352){logger[_0x8bc5('0x23')](JSON['stringify'](_0x394352));return _0x394352;});};exports[_0x8bc5('0x7c')]=function(_0x124311,_0xabb480,_0x4c38f9,_0xb76531){var _0x57f34a=util['format'](_0x8bc5('0x7d'),ISPEECH_API,_0x124311,encodeURIComponent(_0xabb480),_0x4c38f9,_0xb76531);var _0x5ad55e=path[_0x8bc5('0x26')](__dirname,_0x8bc5('0x27'),rs[_0x8bc5('0x28')](0x4)+_0x8bc5('0x38'));var _0x48606f;return downloadFile(_0x57f34a,_0x5ad55e)[_0x8bc5('0x2b')](function(){_0x48606f=path[_0x8bc5('0x26')](__dirname,_0x8bc5('0x27'),rs[_0x8bc5('0x28')](0x4)+_0x8bc5('0x29'));return convertFile(_0x5ad55e,_0x48606f);})[_0x8bc5('0x2b')](function(){try{fs[_0x8bc5('0x3d')](_0x5ad55e);fs['chmodSync'](_0x48606f,_0x8bc5('0x3c'));}catch(_0x575bc1){logger[_0x8bc5('0x15')](_0x575bc1);}return _0x48606f['split']('.')[0x0];});};exports[_0x8bc5('0x7e')]=function(_0x459452,_0x467437,_0x6fc2de,_0x4734f0){var _0x77df6f=util[_0x8bc5('0x7f')](_0x8bc5('0x80'),ISPEECH_API,_0x467437,_0x6fc2de,base64Encode(_0x459452),_0x4734f0?util[_0x8bc5('0x7f')](_0x8bc5('0x81'),encodeURIComponent(_0x4734f0)):'freeform=3');return uploadFile(_0x77df6f)[_0x8bc5('0x2b')](function(_0x4704b5){return querystring['parse'](_0x4704b5);});};exports['sestekNDA']=function(_0x394c03,_0x4c9bfb){return sestek[_0x8bc5('0x82')](_0x394c03,_0x4c9bfb)[_0x8bc5('0x2b')](function(_0x2ccdb3){logger[_0x8bc5('0x23')](JSON['stringify'](_0x2ccdb3));var _0x19172d={'speech':_0x2ccdb3['text'],'action':_0x2ccdb3[_0x8bc5('0x83')]?_0x2ccdb3[_0x8bc5('0x83')][_0x8bc5('0x84')]:undefined,'actiondata':_0x2ccdb3[_0x8bc5('0x83')]?_0x2ccdb3['channelData']['CustomActionData']:undefined};if(_0x2ccdb3[_0x8bc5('0x83')]&&_0x2ccdb3[_0x8bc5('0x83')]['AudioFromTts']){return base64Decode(_0x2ccdb3['channelData']['AudioFromTts'][_0x8bc5('0x85')],path[_0x8bc5('0x26')](__dirname,_0x8bc5('0x27'),rs[_0x8bc5('0x28')](0x4)+'.wav'))[_0x8bc5('0x2b')](function(_0x40363c){_0x19172d[_0x8bc5('0x86')]=_0x40363c;return _0x19172d;});}return _0x19172d;});};exports[_0x8bc5('0x87')]=function(){return __dirname;}; \ No newline at end of file +var _0xd61f=['readFileSync','toString','googleCloudTTS','?key=','ssml','input','voice','audioConfig','MP3','POST','.mp3','from','audioContent','writeFile','chmodSync','then','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','f.req=','stringify','null','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','message','googleDialogflow','result','source','speech','code','metadata','endConversation','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','name','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','ispeechTTS','format','%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','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','http','path','request-promise','randomstring','sox','google-tts-api','url','parse','./aws','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','close','error','download\x20error','pipe','end','protocol','https:','data','transcode','wav','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','unlink','777'];(function(_0x580f82,_0x30981b){var _0x52cc9a=function(_0x477a12){while(--_0x477a12){_0x580f82['push'](_0x580f82['shift']());}};_0x52cc9a(++_0x30981b);}(_0xd61f,0x1e9));var _0xfd61=function(_0x262c30,_0x210c8e){_0x262c30=_0x262c30-0x0;var _0x42bee3=_0xd61f[_0x262c30];return _0x42bee3;};'use strict';var apiai=require(_0xfd61('0x0'));var BPromise=require(_0xfd61('0x1'));var dialogflow=require(_0xfd61('0x2'));var fs=require('fs');var http=require(_0xfd61('0x3'));var https=require('https');var md5=require('md5');var path=require(_0xfd61('0x4'));var querystring=require('querystring');var rp=require(_0xfd61('0x5'));var rs=require(_0xfd61('0x6'));var sox=require(_0xfd61('0x7'));var tts=require(_0xfd61('0x8'));var urlParse=require(_0xfd61('0x9'))[_0xfd61('0xa')];var util=require('util');var aws=require(_0xfd61('0xb'));var google=require(_0xfd61('0xc'));var sestek=require(_0xfd61('0xd'));var tilde=require('./tilde');var logger=require(_0xfd61('0xe'))(_0xfd61('0xf'));var ISPEECH_API=_0xfd61('0x10');function downloadFile(_0x3e0979,_0x5e2808){return new BPromise(function(_0x4ef025,_0x38d034){var _0x26ea3d=urlParse(_0x3e0979);var _0x1f800d=_0x26ea3d['protocol']==='https:'?https:http;var _0x4ad766={'host':_0x26ea3d[_0xfd61('0x11')],'path':_0x26ea3d[_0xfd61('0x4')],'headers':{'user-agent':_0xfd61('0x12')}};_0x1f800d[_0xfd61('0x13')](_0x4ad766,function(_0xed64dd){if(_0xed64dd[_0xfd61('0x14')]!==0xc8){logger['error'](_0xfd61('0x15')+_0x3e0979+_0xfd61('0x16')+_0xed64dd[_0xfd61('0x14')]+'\x20('+_0xed64dd[_0xfd61('0x17')]+')');_0x38d034(new Error('request\x20to\x20'+_0x3e0979+'\x20failed,\x20status\x20code\x20=\x20'+_0xed64dd[_0xfd61('0x14')]+'\x20('+_0xed64dd['statusMessage']+')'));return;}var _0x493279=fs['createWriteStream'](_0x5e2808);_0x493279['on'](_0xfd61('0x18'),function(){logger[_0xfd61('0x19')](_0xfd61('0x1a'));_0x493279[_0xfd61('0x1b')](_0x4ef025);});_0x493279['on'](_0xfd61('0x1c'),function(_0x2946e4){fs['unlink'](_0x5e2808);logger['error'](_0xfd61('0x1d'),_0x2946e4);_0x38d034(_0x2946e4);});_0xed64dd[_0xfd61('0x1e')](_0x493279);})['on']('error',function(_0x28530f){logger[_0xfd61('0x1c')](_0x28530f);_0x38d034(_0x28530f);})[_0xfd61('0x1f')]();});}function uploadFile(_0x419ee0){return new BPromise(function(_0x52e272,_0x18e3b7){var _0x20503e=urlParse(_0x419ee0);var _0x2f8f85=_0x20503e[_0xfd61('0x20')]===_0xfd61('0x21')?https:http;var _0x179969={'host':_0x20503e[_0xfd61('0x11')],'path':_0x20503e['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x2f8f85[_0xfd61('0x13')](_0x179969,function(_0x433d47){if(_0x433d47['statusCode']!==0xc8){_0x18e3b7(new Error(_0xfd61('0x15')+_0x419ee0+_0xfd61('0x16')+_0x433d47[_0xfd61('0x14')]+'\x20('+_0x433d47['statusMessage']+')'));return;}var _0x39a1a8='';_0x433d47['on'](_0xfd61('0x22'),function(_0x476e9c){_0x39a1a8+=_0x476e9c;});_0x433d47['on'](_0xfd61('0x1f'),function(){_0x52e272(_0x39a1a8);});})['on'](_0xfd61('0x1c'),function(_0x50a9e9){_0x18e3b7(_0x50a9e9);})['end']();});}function convertFile(_0x1d51a2,_0x20b57f){return new BPromise(function(_0x85d353,_0x59df9d){var _0x1918cd=sox[_0xfd61('0x23')](_0x1d51a2,_0x20b57f,{'sampleRate':0x1f40,'format':_0xfd61('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1918cd['on'](_0xfd61('0x1c'),function(_0x2ee663){logger[_0xfd61('0x1c')]('error\x20convert',_0x2ee663);_0x59df9d(_0x2ee663);});_0x1918cd['on'](_0xfd61('0x1f'),function(){logger[_0xfd61('0x19')](_0xfd61('0x25'));_0x85d353();});_0x1918cd[_0xfd61('0x26')]();});}function base64Decode(_0x444928,_0x26d04a){var _0x1f4853=path[_0xfd61('0x27')](__dirname,_0xfd61('0x28'),rs[_0xfd61('0x29')](0x4)+_0xfd61('0x2a'));fs[_0xfd61('0x2b')](_0x1f4853,_0x444928,_0xfd61('0x2c'));return convertFile(_0x1f4853,_0x26d04a)['then'](function(){try{fs[_0xfd61('0x2d')](_0x1f4853);fs['chmodSync'](_0x26d04a,_0xfd61('0x2e'));}catch(_0x592ee0){logger['error'](_0x592ee0);}return _0x26d04a['split']('.')[0x0];});}function base64Encode(_0x2d0b41){var _0x461ef9=fs[_0xfd61('0x2f')](_0x2d0b41);return new Buffer(_0x461ef9)[_0xfd61('0x30')](_0xfd61('0x2c'));}exports[_0xfd61('0x31')]=function(_0x1b32a9,_0x4dfd41,_0x5c3b4c,_0x25d1b4,_0x5b5935,_0x40e6dd){var _0x1cd273,_0x51b22f;var _0x184fa7='https://texttospeech.googleapis.com/v1/';var _0x33c596=_0xfd61('0x32')+_0x1b32a9;var _0x308ea9={};if(_0x4dfd41===_0xfd61('0x33')){_0x308ea9['input']={'ssml':_0x5c3b4c};}else{_0x308ea9[_0xfd61('0x34')]={'text':_0x5c3b4c};};_0x308ea9[_0xfd61('0x35')]={'languageCode':_0x25d1b4,'ssmlGender':_0x5b5935};_0x308ea9[_0xfd61('0x36')]={'audioEncoding':_0xfd61('0x37'),'sampleRateHertz':0x1f40};var _0x56d824={'url':_0x184fa7+'text:synthesize'+_0x33c596,'method':_0xfd61('0x38'),'json':!![],'body':_0x308ea9};return rp(_0x56d824)['then'](function(_0x243fa6){return new BPromise(function(_0x59780c,_0x4358c2){_0x1cd273=path[_0xfd61('0x27')](__dirname,'tmp',rs[_0xfd61('0x29')](0x4)+_0xfd61('0x39'));var _0x285e28=Buffer[_0xfd61('0x3a')](_0x243fa6[_0xfd61('0x3b')],_0xfd61('0x2c'));return fs[_0xfd61('0x3c')](_0x1cd273,_0x285e28,function(_0x133e6e){_0x4358c2(_0x133e6e);},function(_0x22f365){fs[_0xfd61('0x3d')](_0x1cd273,'777');_0x59780c(_0x22f365);});});})[_0xfd61('0x3e')](function(_0x42fb55){_0x51b22f=path[_0xfd61('0x27')](__dirname,_0xfd61('0x28'),rs['generate'](0x4)+_0xfd61('0x2a'));return convertFile(_0x1cd273,_0x51b22f);})['then'](function(){try{fs[_0xfd61('0x2d')](_0x1cd273);fs[_0xfd61('0x3d')](_0x51b22f,'777');}catch(_0x375301){logger['error'](_0x375301);}logger[_0xfd61('0x19')]('googleCloudTTS\x20path',_0x51b22f[_0xfd61('0x3f')]('.')[0x0]);return _0x51b22f[_0xfd61('0x3f')]('.')[0x0];});};exports[_0xfd61('0x40')]=function(_0x33796e,_0x153abf){var _0x31ef7e=_0xfd61('0x41');var _0x3915e0,_0x5f0504;var _0x3e1399;var _0x32b4d8={'encoding':_0xfd61('0x42'),'method':_0xfd61('0x38'),'timeout':0x2710,'url':_0x31ef7e,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0xfd61('0x43')+encodeURIComponent(JSON[_0xfd61('0x44')]([[['jQ1olc',JSON[_0xfd61('0x44')]([_0x33796e,_0x153abf||'en',![],_0xfd61('0x45')]),null,'generic']]]))};return rp(_0x32b4d8)[_0xfd61('0x3e')](function(_0x6ac5db){try{_0x3e1399=eval(_0x6ac5db['slice'](0x5))[0x0][0x2];}catch(_0x4b9915){throw new Error(_0xfd61('0x46')+_0x6ac5db[_0xfd61('0x22')]);}if(!_0x3e1399){if(_0x33796e[_0xfd61('0x47')]>0xc8){throw new Error(_0xfd61('0x48'));}else{throw new Error(_0xfd61('0x49')+_0x153abf+_0xfd61('0x4a'));}}try{_0x3e1399=eval(_0x3e1399)[0x0];}catch(_0x1fb441){throw new Error(_0xfd61('0x46')+res[_0xfd61('0x22')]);}const _0x4b2ce7=_0x3e1399;_0x3915e0=path['resolve'](__dirname,_0xfd61('0x28'),rs[_0xfd61('0x29')](0x4)+_0xfd61('0x39'));fs[_0xfd61('0x2b')](_0x3915e0,_0x3e1399,{'encoding':_0xfd61('0x2c')});_0x5f0504=path[_0xfd61('0x27')](__dirname,_0xfd61('0x28'),rs[_0xfd61('0x29')](0x4)+'.wav');return convertFile(_0x3915e0,_0x5f0504);})['then'](function(){try{fs[_0xfd61('0x2d')](_0x3915e0);fs[_0xfd61('0x3d')](_0x5f0504,_0xfd61('0x2e'));}catch(_0x1ac6c0){logger[_0xfd61('0x1c')](_0x1ac6c0);}logger['info'](_0xfd61('0x4b'),_0x5f0504[_0xfd61('0x3f')]('.')[0x0]);return _0x5f0504[_0xfd61('0x3f')]('.')[0x0];});};exports[_0xfd61('0x4c')]=function(_0x282e60,_0x52a05f,_0x2239ca){return google[_0xfd61('0x4d')](_0x282e60,_0x52a05f,_0x2239ca)[_0xfd61('0x3e')](function(_0x1e1cfb){logger[_0xfd61('0x19')](_0x1e1cfb[_0xfd61('0x4e')]);return rp(_0x1e1cfb);})[_0xfd61('0x3e')](function(_0x5c3e37){var _0xa60a07='';var _0x402d80=0x0;try{fs['unlink'](_0x282e60);}catch(_0x10ad6c){logger[_0xfd61('0x1c')](_0x10ad6c);}if(_0x5c3e37&&_0x5c3e37[_0xfd61('0x4f')]){_0xa60a07=_0x5c3e37['results']['map'](function(_0x3dbd42){return _0x3dbd42&&_0x3dbd42['alternatives'][0x0]&&_0x3dbd42[_0xfd61('0x50')][0x0]['transcript']?_0x3dbd42['alternatives'][0x0][_0xfd61('0x51')]:'';})[_0xfd61('0x52')]('\x0a');_0x402d80=_0x5c3e37[_0xfd61('0x4f')][_0xfd61('0x53')](function(_0x4fe50e){return _0x4fe50e&&_0x4fe50e['alternatives'][0x0]&&_0x4fe50e[_0xfd61('0x50')][0x0][_0xfd61('0x54')]?_0x4fe50e[_0xfd61('0x50')][0x0][_0xfd61('0x54')]:0x0;})[_0xfd61('0x52')]('\x0a');}logger['info'](_0xfd61('0x55'),_0xa60a07);logger[_0xfd61('0x19')]('googleASR\x20confidence',_0x402d80);return{'transcript':_0xa60a07,'confidence':_0x402d80};})[_0xfd61('0x56')](function(_0x3d94d0){logger['error'](_0xfd61('0x57'),_0x3d94d0[_0xfd61('0x14')],_0x3d94d0['name'],_0x3d94d0[_0xfd61('0x58')]);});};exports[_0xfd61('0x59')]=function(_0x4223b0,_0x4eaa22,_0x200c1a,_0x53d9a9){var _0x359ad5=apiai(_0x4eaa22,{'language':_0x53d9a9||'en'});return _0x359ad5['textRequest'](_0x200c1a,{'sessionId':md5(_0x4223b0)})['then'](function(_0x22d5ba){logger[_0xfd61('0x19')](JSON['stringify'](_0x22d5ba));return{'source':_0x22d5ba[_0xfd61('0x5a')][_0xfd61('0x5b')],'resolvedQuery':_0x22d5ba[_0xfd61('0x5a')]['resolvedQuery'],'action':_0x22d5ba[_0xfd61('0x5a')]['action'],'actionIncomplete':_0x22d5ba[_0xfd61('0x5a')]['actionIncomplete'],'speech':_0x22d5ba[_0xfd61('0x5a')]['fulfillment'][_0xfd61('0x5c')],'score':_0x22d5ba[_0xfd61('0x5a')]['score'],'statusCode':_0x22d5ba['status'][_0xfd61('0x5d')],'endConversation':_0x22d5ba[_0xfd61('0x5a')][_0xfd61('0x5e')][_0xfd61('0x5f')]||![],'isFallbackIntent':_0x22d5ba['result'][_0xfd61('0x5e')]['isFallbackIntent']};});};exports[_0xfd61('0x60')]=function(_0x267b25,_0x111649,_0x479740,_0x256dbb,_0x41e0b9,_0x2951df){var _0x2959a9=_0x256dbb[_0xfd61('0x61')](/\\n/g,'\x0a');var _0x48e407={'credentials':{'private_key':_0x2959a9,'client_email':_0x479740}};var _0x2dee9a=new dialogflow[(_0xfd61('0x62'))](_0x48e407);var _0x1b0818=_0x2dee9a[_0xfd61('0x63')](_0x111649,md5(_0x267b25));var _0x371e2c={'session':_0x1b0818,'queryInput':{'text':{'text':_0x41e0b9,'languageCode':_0x2951df}}};return _0x2dee9a[_0xfd61('0x64')](_0x371e2c)[_0xfd61('0x3e')](function(_0x24ade3){if(_0x24ade3&&_0x24ade3['length']){logger[_0xfd61('0x19')](_0xfd61('0x65'),JSON[_0xfd61('0x44')](_0x24ade3));var _0x42b6fb=_0x24ade3[0x0];if(_0x42b6fb){var _0x2e909c={'action':_0x42b6fb[_0xfd61('0x66')][_0xfd61('0x67')],'allRequiredParamsPresent':_0x42b6fb['queryResult'][_0xfd61('0x68')],'endConversation':_0x42b6fb['queryResult'][_0xfd61('0x69')]&&_0x42b6fb[_0xfd61('0x66')][_0xfd61('0x69')][_0xfd61('0x6a')]?_0x42b6fb[_0xfd61('0x66')]['diagnosticInfo'][_0xfd61('0x6a')][_0xfd61('0x6b')][_0xfd61('0x6c')]:![],'fulfillmentText':_0x42b6fb[_0xfd61('0x66')][_0xfd61('0x6d')],'intentName':_0x42b6fb[_0xfd61('0x66')][_0xfd61('0x6e')][_0xfd61('0x6f')],'intentDisplayName':_0x42b6fb['queryResult']['intent']['displayName'],'isFallbackIntent':_0x42b6fb['queryResult'][_0xfd61('0x6e')]['isFallback'],'languageCode':_0x42b6fb[_0xfd61('0x66')]['languageCode'],'queryText':_0x42b6fb[_0xfd61('0x66')][_0xfd61('0x70')],'responseId':_0x42b6fb[_0xfd61('0x71')],'score':_0x42b6fb[_0xfd61('0x66')][_0xfd61('0x72')],'speech':_0x42b6fb[_0xfd61('0x66')][_0xfd61('0x6d')],'providerResponse':JSON[_0xfd61('0x44')](_0x24ade3)};return _0x2e909c;}}});};exports['tildeASR']=function(_0x484de5,_0x241d4,_0x33293b,_0x2875db){return tilde[_0xfd61('0x4d')](_0x484de5,_0x241d4,_0x33293b,_0x2875db)[_0xfd61('0x3e')](function(_0x2ff56f){try{fs[_0xfd61('0x2d')](_0x484de5);}catch(_0x180399){logger['error'](_0x180399);}logger[_0xfd61('0x19')](_0xfd61('0x73'),_0x2ff56f[_0xfd61('0x51')]);logger[_0xfd61('0x19')](_0xfd61('0x74'),_0x2ff56f['confidence']);return _0x2ff56f;});};exports[_0xfd61('0x75')]=function(_0x1ebe31,_0x2e55dd,_0x58adf4,_0x18387e,_0x136bb2,_0x46a27c){var _0x2c695c=path['resolve'](__dirname,'tmp',rs[_0xfd61('0x29')](0x4)+_0xfd61('0x39'));var _0x20496e;return aws['polly'](_0x1ebe31,_0x2e55dd,_0x58adf4,_0x18387e,_0x136bb2,_0x46a27c,_0x2c695c)[_0xfd61('0x3e')](function(){_0x20496e=path[_0xfd61('0x27')](__dirname,_0xfd61('0x28'),rs[_0xfd61('0x29')](0x4)+_0xfd61('0x2a'));return convertFile(_0x2c695c,_0x20496e);})['then'](function(){try{fs[_0xfd61('0x2d')](_0x2c695c);fs['chmodSync'](_0x20496e,_0xfd61('0x2e'));}catch(_0x1f0241){logger['error'](_0x1f0241);}return _0x20496e[_0xfd61('0x3f')]('.')[0x0];});};exports[_0xfd61('0x76')]=function(_0x862c4,_0xf49cf1,_0x54ddda,_0x27ab67,_0x4208cf,_0x5be232){return aws[_0xfd61('0x77')](_0x862c4,_0xf49cf1,_0x54ddda,_0x27ab67,_0x4208cf,_0x5be232)['then'](function(_0x23413b){logger[_0xfd61('0x19')](JSON['stringify'](_0x23413b));return _0x23413b;});};exports[_0xfd61('0x78')]=function(_0x451b4a,_0x396a6d,_0x1f6b1d,_0x5f4349){var _0x17c690=util[_0xfd61('0x79')](_0xfd61('0x7a'),ISPEECH_API,_0x451b4a,encodeURIComponent(_0x396a6d),_0x1f6b1d,_0x5f4349);var _0x2a3145=path[_0xfd61('0x27')](__dirname,_0xfd61('0x28'),rs[_0xfd61('0x29')](0x4)+_0xfd61('0x39'));var _0x8999d2;return downloadFile(_0x17c690,_0x2a3145)[_0xfd61('0x3e')](function(){_0x8999d2=path[_0xfd61('0x27')](__dirname,_0xfd61('0x28'),rs[_0xfd61('0x29')](0x4)+_0xfd61('0x2a'));return convertFile(_0x2a3145,_0x8999d2);})[_0xfd61('0x3e')](function(){try{fs[_0xfd61('0x2d')](_0x2a3145);fs[_0xfd61('0x3d')](_0x8999d2,'777');}catch(_0x22b90d){logger[_0xfd61('0x1c')](_0x22b90d);}return _0x8999d2[_0xfd61('0x3f')]('.')[0x0];});};exports['ispeechASR']=function(_0x4719bb,_0x4d4fad,_0x216db8,_0x3b4e93){var _0x3dc1ca=util[_0xfd61('0x79')](_0xfd61('0x7b'),ISPEECH_API,_0x4d4fad,_0x216db8,base64Encode(_0x4719bb),_0x3b4e93?util[_0xfd61('0x79')](_0xfd61('0x7c'),encodeURIComponent(_0x3b4e93)):_0xfd61('0x7d'));return uploadFile(_0x3dc1ca)['then'](function(_0x178b6d){return querystring['parse'](_0x178b6d);});};exports[_0xfd61('0x7e')]=function(_0xe66b75,_0x2217a3){return sestek[_0xfd61('0x7f')](_0xe66b75,_0x2217a3)[_0xfd61('0x3e')](function(_0x59bdec){logger[_0xfd61('0x19')](JSON['stringify'](_0x59bdec));var _0x2025cf={'speech':_0x59bdec[_0xfd61('0x80')],'action':_0x59bdec[_0xfd61('0x81')]?_0x59bdec[_0xfd61('0x81')]['CustomAction']:undefined,'actiondata':_0x59bdec[_0xfd61('0x81')]?_0x59bdec['channelData'][_0xfd61('0x82')]:undefined};if(_0x59bdec[_0xfd61('0x81')]&&_0x59bdec['channelData'][_0xfd61('0x83')]){return base64Decode(_0x59bdec[_0xfd61('0x81')][_0xfd61('0x83')][_0xfd61('0x84')],path['resolve'](__dirname,_0xfd61('0x28'),rs[_0xfd61('0x29')](0x4)+'.wav'))[_0xfd61('0x3e')](function(_0x4ecbcc){_0x2025cf[_0xfd61('0x85')]=_0x4ecbcc;return _0x2025cf;});}return _0x2025cf;});};exports['dirName']=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 9ed66c4..19b1bd1 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 _0x3b7f=['exports','./nda'];(function(_0x557404,_0x1f162){var _0x2fdec8=function(_0x3f4ef2){while(--_0x3f4ef2){_0x557404['push'](_0x557404['shift']());}};_0x2fdec8(++_0x1f162);}(_0x3b7f,0x99));var _0xf3b7=function(_0xfc1680,_0x59384e){_0xfc1680=_0xfc1680-0x0;var _0x1111c0=_0x3b7f[_0xfc1680];return _0x1111c0;};var nda=require(_0xf3b7('0x0'));module[_0xf3b7('0x1')]={'nda':nda}; \ No newline at end of file +var _0x9955=['exports'];(function(_0x1702e1,_0x3a8949){var _0x2bdc8c=function(_0x362a55){while(--_0x362a55){_0x1702e1['push'](_0x1702e1['shift']());}};_0x2bdc8c(++_0x3a8949);}(_0x9955,0xa4));var _0x5995=function(_0xf737af,_0x9be8cb){_0xf737af=_0xf737af-0x0;var _0x2f4a47=_0x9955[_0xf737af];return _0x2f4a47;};var nda=require('./nda');module[_0x5995('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 32c3fc8..960e646 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 _0x1db3=['custom_action','CustomActionData','custom_action_data','info','stringify','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','calleridname','dnid','extension','Bearer\x20','access_token','project','body','channelData','ProjectName','AudioOutputSettings','audio/wav'];(function(_0x50a469,_0x239410){var _0x232555=function(_0x301ecf){while(--_0x301ecf){_0x50a469['push'](_0x50a469['shift']());}};_0x232555(++_0x239410);}(_0x1db3,0x1e5));var _0x31db=function(_0x466743,_0x5a50e0){_0x466743=_0x466743-0x0;var _0x898ddb=_0x1db3[_0x466743];return _0x898ddb;};'use strict';var rp=require('request-promise');var url=require(_0x31db('0x0'));var logger=require(_0x31db('0x1'))(_0x31db('0x2'));module[_0x31db('0x3')]=function(_0x840c38,_0x4537f0){var _0x1888ef={'method':_0x31db('0x4'),'uri':url[_0x31db('0x5')](_0x4537f0[_0x31db('0x6')],_0x31db('0x7')),'form':{'grant_type':_0x31db('0x8'),'username':_0x4537f0[_0x31db('0x9')],'password':_0x4537f0[_0x31db('0x8')]},'json':!![]};return rp(_0x1888ef)[_0x31db('0xa')](function(_0x44e204){var _0x3a431e={'method':_0x31db('0x4'),'uri':url[_0x31db('0x5')](_0x4537f0['ndassistant_url'],_0x31db('0xb')),'body':{'type':_0x4537f0[_0x31db('0xc')]||_0x31db('0xd'),'channelId':_0x31db('0xe'),'conversation':{'id':_0x840c38[_0x31db('0xf')]},'from':{'id':_0x840c38['callerid'],'name':_0x840c38[_0x31db('0x10')]},'recipient':{'id':_0x840c38[_0x31db('0x11')],'name':_0x840c38[_0x31db('0x12')]},'text':_0x4537f0['text'],'channelData':{}},'headers':{'Authorization':_0x31db('0x13')+_0x44e204[_0x31db('0x14')]},'json':!![]};if(_0x4537f0[_0x31db('0x15')]){_0x3a431e[_0x31db('0x16')][_0x31db('0x17')][_0x31db('0x18')]=_0x4537f0['project'];}if(_0x4537f0['ndagenerate_audio']=='1'){_0x3a431e[_0x31db('0x16')]['channelData'][_0x31db('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x31db('0x1a')};}if(_0x4537f0[_0x31db('0x1b')]){_0x3a431e[_0x31db('0x16')][_0x31db('0x17')]['CustomAction']=_0x4537f0['custom_action'];if(_0x4537f0['custom_action_data']){_0x3a431e[_0x31db('0x16')][_0x31db('0x17')][_0x31db('0x1c')]=_0x4537f0[_0x31db('0x1d')];}}logger[_0x31db('0x1e')](JSON[_0x31db('0x1f')](_0x3a431e));return rp(_0x3a431e);});}; \ No newline at end of file +var _0x5e30=['POST','resolve','ndauth_url','/token','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','uniqueid','calleridname','dnid','extension','Bearer\x20','access_token','body','ProjectName','project','ndagenerate_audio','AudioOutputSettings','custom_action','CustomAction','custom_action_data','channelData','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x5e30,0x7b));var _0x05e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e30[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0x05e3('0x0'));var url=require(_0x05e3('0x1'));var logger=require(_0x05e3('0x2'))(_0x05e3('0x3'));module[_0x05e3('0x4')]=function(_0x5c88b3,_0x5136f8){var _0x5675cc={'method':_0x05e3('0x5'),'uri':url[_0x05e3('0x6')](_0x5136f8[_0x05e3('0x7')],_0x05e3('0x8')),'form':{'grant_type':_0x05e3('0x9'),'username':_0x5136f8[_0x05e3('0xa')],'password':_0x5136f8['password']},'json':!![]};return rp(_0x5675cc)['then'](function(_0xa03016){var _0x2eb9fa={'method':'POST','uri':url[_0x05e3('0x6')](_0x5136f8[_0x05e3('0xb')],_0x05e3('0xc')),'body':{'type':_0x5136f8[_0x05e3('0xd')]||'message','channelId':'Nda','conversation':{'id':_0x5c88b3[_0x05e3('0xe')]},'from':{'id':_0x5c88b3['callerid'],'name':_0x5c88b3[_0x05e3('0xf')]},'recipient':{'id':_0x5c88b3[_0x05e3('0x10')],'name':_0x5c88b3[_0x05e3('0x11')]},'text':_0x5136f8['text'],'channelData':{}},'headers':{'Authorization':_0x05e3('0x12')+_0xa03016[_0x05e3('0x13')]},'json':!![]};if(_0x5136f8['project']){_0x2eb9fa[_0x05e3('0x14')]['channelData'][_0x05e3('0x15')]=_0x5136f8[_0x05e3('0x16')];}if(_0x5136f8[_0x05e3('0x17')]=='1'){_0x2eb9fa[_0x05e3('0x14')]['channelData'][_0x05e3('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x5136f8[_0x05e3('0x19')]){_0x2eb9fa['body']['channelData'][_0x05e3('0x1a')]=_0x5136f8[_0x05e3('0x19')];if(_0x5136f8[_0x05e3('0x1b')]){_0x2eb9fa['body'][_0x05e3('0x1c')][_0x05e3('0x1d')]=_0x5136f8[_0x05e3('0x1b')];}}logger[_0x05e3('0x1e')](JSON[_0x05e3('0x1f')](_0x2eb9fa));return rp(_0x2eb9fa);});}; \ 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 efbc060..c6655bf 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 _0xcaae=['./lib/api','exports'];(function(_0x53e3de,_0x13da7b){var _0x7b905b=function(_0x29b56a){while(--_0x29b56a){_0x53e3de['push'](_0x53e3de['shift']());}};_0x7b905b(++_0x13da7b);}(_0xcaae,0xc0));var _0xecaa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcaae[_0x3dd15e];return _0x231fd0;};'use strict';var asr=require(_0xecaa('0x0'));module[_0xecaa('0x1')]=function(_0x4b5e31,_0x3cad28,_0x505fbc,_0x3207e1){return asr(_0x4b5e31,_0x3cad28,_0x505fbc,_0x3207e1);}; \ No newline at end of file +var _0x553f=['exports','./lib/api'];(function(_0x2cb93c,_0x3f29b7){var _0x3ad00d=function(_0x2ff10b){while(--_0x2ff10b){_0x2cb93c['push'](_0x2cb93c['shift']());}};_0x3ad00d(++_0x3f29b7);}(_0x553f,0x195));var _0xf553=function(_0x25d2ee,_0x3ea750){_0x25d2ee=_0x25d2ee-0x0;var _0xa8bca7=_0x553f[_0x25d2ee];return _0xa8bca7;};'use strict';var asr=require(_0xf553('0x0'));module[_0xf553('0x1')]=function(_0x3a1f2f,_0x120393,_0x286196,_0x29a1ab){return asr(_0x3a1f2f,_0x120393,_0x286196,_0x29a1ab);}; \ 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 8bcb646..7ab2234 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 _0xcf0e=['wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','hex','info','Open\x20Tilde\x20ASR\x20socket','stringify','data','send','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','lodash','moment','crypto','../../../../../../config/logger','agi','Tilde\x20URI'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xcf0e,0x13a));var _0xecf0=function(_0x35b18a,_0x6b2fbe){_0x35b18a=_0x35b18a-0x0;var _0x4db1bd=_0xcf0e[_0x35b18a];return _0x4db1bd;};'use strict';var BPromise=require('bluebird');var _=require(_0xecf0('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xecf0('0x1'));var crypto=require(_0xecf0('0x2'));var logger=require(_0xecf0('0x3'))(_0xecf0('0x4'));module['exports']=function(_0x329295,_0x17c62c,_0x89a1d5,_0x233131){return new BPromise(function(_0x1aba89,_0x250297){logger['info'](_0xecf0('0x5'),_0x233131||_0xecf0('0x6'));var _0x589d30=new WebSocket(_0x233131||_0xecf0('0x6'),{'perMessageDeflate':![]});var _0x5c71e0='';var _0x5c0b76='0';var _0x227d50='1';var _0x2bbf6d=_0xecf0('0x7');function _0x25f5a4(_0x512dfe){var _0x34c54b=crypto[_0xecf0('0x8')](_0xecf0('0x9'));_0x34c54b[_0xecf0('0xa')](_0x512dfe);return _0x34c54b['digest'](_0xecf0('0xb'));}function _0x1dc613(){try{logger[_0xecf0('0xc')](_0xecf0('0xd'));var _0x31be4c=moment()['unix']();var _0x53c721=_0x25f5a4(_0x31be4c+_0x17c62c+_0x89a1d5);_0x589d30['send'](JSON[_0xecf0('0xe')]({'appID':_0x17c62c,'timestamp':_0x31be4c,'appKey':_0x53c721}));var _0x8a583b=fs['createReadStream'](_0x329295);_0x8a583b['on'](_0xecf0('0xf'),function(_0xc7beff){_0x589d30[_0xecf0('0x10')](_0xc7beff);});_0x8a583b['on'](_0xecf0('0x11'),function(){_0x589d30[_0xecf0('0x10')](_0xecf0('0x12'));});}catch(_0x58c59f){logger[_0xecf0('0x13')](_0xecf0('0x14'),JSON['stringify'](_0x58c59f));_0x589d30[_0xecf0('0x15')]();}}function _0x38d408(_0x5c6504){try{if(_0x5c6504){var _0x7a2b96=JSON[_0xecf0('0x16')](_0x5c6504);switch(_0x7a2b96[_0xecf0('0x17')]){case 0x0:if(_0x7a2b96[_0xecf0('0x18')]){if(_0x7a2b96[_0xecf0('0x18')][_0xecf0('0x19')]){logger[_0xecf0('0xc')](_0xecf0('0x1a'),JSON[_0xecf0('0xe')](_0x7a2b96[_0xecf0('0x18')][_0xecf0('0x1b')]));_0x5c71e0=_0x7a2b96[_0xecf0('0x18')][_0xecf0('0x1b')][0x0][_0xecf0('0x1c')];_0x5c0b76=_0x7a2b96[_0xecf0('0x18')][_0xecf0('0x1b')][0x0][_0xecf0('0x1d')];_0x227d50='0';_0x2bbf6d=_0xecf0('0x1e');_0x589d30['terminate']();}}break;case 0x1:logger[_0xecf0('0xc')](_0xecf0('0x7'));_0x227d50='1';_0x2bbf6d='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xecf0('0xc')](_0xecf0('0x1f'));_0x227d50='2';_0x2bbf6d=_0xecf0('0x1f');break;case 0x9:logger[_0xecf0('0xc')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x227d50='9';_0x2bbf6d=_0xecf0('0x20');break;case 0xa:logger[_0xecf0('0xc')]('Authentication\x20failed.');_0x227d50='10';_0x2bbf6d=_0xecf0('0x21');break;case 0xb:logger['info'](_0xecf0('0x22'));_0x227d50='11';_0x2bbf6d=_0xecf0('0x22');}}}catch(_0x115e4e){logger[_0xecf0('0x13')](_0xecf0('0x23'),JSON['stringify'](_0x115e4e));_0x589d30['terminate']();}}function _0x49bbf4(){logger[_0xecf0('0xc')]('Close\x20Tilde\x20ASR\x20socket');_0x1aba89({'transcript':_0x5c71e0,'confidence':_0x5c0b76,'status':_0x227d50,'status_message':_0x2bbf6d});}function _0x487c85(_0x1078ba){logger[_0xecf0('0x13')](_0xecf0('0x24'));if(!_['isNil'](_0x1078ba)){logger['error'](_[_0xecf0('0x25')](_0x1078ba)?JSON[_0xecf0('0xe')](_0x1078ba):_0x1078ba);}}_0x589d30['on'](_0xecf0('0x26'),_0x1dc613);_0x589d30['on'](_0xecf0('0x27'),_0x38d408);_0x589d30['on'](_0xecf0('0x11'),_0x49bbf4);_0x589d30['on'](_0xecf0('0x13'),_0x487c85);});}; \ No newline at end of file +var _0x351e=['close','bluebird','lodash','moment','crypto','../../../../../../config/logger','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','send','data','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','result','stringify','transcript','hypotheses','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isObject','open','message'];(function(_0x3130b5,_0x23faf7){var _0xa6d8a3=function(_0x175be7){while(--_0x175be7){_0x3130b5['push'](_0x3130b5['shift']());}};_0xa6d8a3(++_0x23faf7);}(_0x351e,0xba));var _0xe351=function(_0x401620,_0x445233){_0x401620=_0x401620-0x0;var _0x14e3b4=_0x351e[_0x401620];return _0x14e3b4;};'use strict';var BPromise=require(_0xe351('0x0'));var _=require(_0xe351('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xe351('0x2'));var crypto=require(_0xe351('0x3'));var logger=require(_0xe351('0x4'))('agi');module['exports']=function(_0x376b6b,_0x1abbc3,_0x130ccf,_0x416b5f){return new BPromise(function(_0x3e9cd7,_0x52e4a0){logger['info'](_0xe351('0x5'),_0x416b5f||_0xe351('0x6'));var _0x41606d=new WebSocket(_0x416b5f||_0xe351('0x6'),{'perMessageDeflate':![]});var _0x1a4145='';var _0x208b1b='0';var _0x30850b='1';var _0x559e1c=_0xe351('0x7');function _0x54725d(_0x55e8ff){var _0x5ba97b=crypto[_0xe351('0x8')](_0xe351('0x9'));_0x5ba97b[_0xe351('0xa')](_0x55e8ff);return _0x5ba97b['digest'](_0xe351('0xb'));}function _0x1da15b(){try{logger[_0xe351('0xc')](_0xe351('0xd'));var _0x2a0cc3=moment()[_0xe351('0xe')]();var _0x1720e0=_0x54725d(_0x2a0cc3+_0x1abbc3+_0x130ccf);_0x41606d[_0xe351('0xf')](JSON['stringify']({'appID':_0x1abbc3,'timestamp':_0x2a0cc3,'appKey':_0x1720e0}));var _0x5f28e6=fs['createReadStream'](_0x376b6b);_0x5f28e6['on'](_0xe351('0x10'),function(_0x1ee62){_0x41606d[_0xe351('0xf')](_0x1ee62);});_0x5f28e6['on']('close',function(){_0x41606d[_0xe351('0xf')](_0xe351('0x11'));});}catch(_0x27ac61){logger[_0xe351('0x12')](_0xe351('0x13'),JSON['stringify'](_0x27ac61));_0x41606d[_0xe351('0x14')]();}}function _0x577923(_0x53c56a){try{if(_0x53c56a){var _0x52d056=JSON[_0xe351('0x15')](_0x53c56a);switch(_0x52d056['status']){case 0x0:if(_0x52d056[_0xe351('0x16')]){if(_0x52d056[_0xe351('0x16')]['final']){logger[_0xe351('0xc')]('Tilde\x20ASR\x20hypoteses',JSON[_0xe351('0x17')](_0x52d056['result']['hypotheses']));_0x1a4145=_0x52d056['result']['hypotheses'][0x0][_0xe351('0x18')];_0x208b1b=_0x52d056[_0xe351('0x16')][_0xe351('0x19')][0x0][_0xe351('0x1a')];_0x30850b='0';_0x559e1c='Success.';_0x41606d[_0xe351('0x14')]();}}break;case 0x1:logger[_0xe351('0xc')](_0xe351('0x7'));_0x30850b='1';_0x559e1c=_0xe351('0x7');break;case 0x2:logger[_0xe351('0xc')](_0xe351('0x1b'));_0x30850b='2';_0x559e1c=_0xe351('0x1b');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x30850b='9';_0x559e1c=_0xe351('0x1c');break;case 0xa:logger[_0xe351('0xc')]('Authentication\x20failed.');_0x30850b='10';_0x559e1c=_0xe351('0x1d');break;case 0xb:logger[_0xe351('0xc')](_0xe351('0x1e'));_0x30850b='11';_0x559e1c=_0xe351('0x1e');}}}catch(_0xb0f777){logger[_0xe351('0x12')](_0xe351('0x1f'),JSON['stringify'](_0xb0f777));_0x41606d[_0xe351('0x14')]();}}function _0x1f00f5(){logger[_0xe351('0xc')]('Close\x20Tilde\x20ASR\x20socket');_0x3e9cd7({'transcript':_0x1a4145,'confidence':_0x208b1b,'status':_0x30850b,'status_message':_0x559e1c});}function _0x519eff(_0x4459be){logger['error'](_0xe351('0x20'));if(!_['isNil'](_0x4459be)){logger[_0xe351('0x12')](_[_0xe351('0x21')](_0x4459be)?JSON[_0xe351('0x17')](_0x4459be):_0x4459be);}}_0x41606d['on'](_0xe351('0x22'),_0x1da15b);_0x41606d['on'](_0xe351('0x23'),_0x577923);_0x41606d['on'](_0xe351('0x24'),_0x1f00f5);_0x41606d['on'](_0xe351('0x12'),_0x519eff);});}; \ 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 5ab8f26..486cc4b 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 _0x43d6=['./asr','exports'];(function(_0x2a5f5b,_0x1eecda){var _0x5da4e5=function(_0x5a0d85){while(--_0x5a0d85){_0x2a5f5b['push'](_0x2a5f5b['shift']());}};_0x5da4e5(++_0x1eecda);}(_0x43d6,0x176));var _0x643d=function(_0x2da95d,_0x520946){_0x2da95d=_0x2da95d-0x0;var _0x111a21=_0x43d6[_0x2da95d];return _0x111a21;};var asr=require(_0x643d('0x0'));module[_0x643d('0x1')]={'asr':asr}; \ No newline at end of file +var _0xa398=['exports','./asr'];(function(_0x51d078,_0x30f4f5){var _0x4427b8=function(_0x3a1592){while(--_0x3a1592){_0x51d078['push'](_0x51d078['shift']());}};_0x4427b8(++_0x30f4f5);}(_0xa398,0x73));var _0x8a39=function(_0x1a0138,_0x18cdc8){_0x1a0138=_0x1a0138-0x0;var _0x4cab9a=_0xa398[_0x1a0138];return _0x4cab9a;};var asr=require(_0x8a39('0x0'));module[_0x8a39('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index b382a3b..191495c 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9c44[_0x5f09c5];return _0x426ad9;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file +var _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(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'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 e9f51a9..5453568 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 _0xfc75=['providerResponse','DIALOGFLOW_%s','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','streamFile','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','opts','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','getSound','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','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','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','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','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','subject','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sendSMS\x20message','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','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','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','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','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','.wav','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','join','exports','util','lodash','shelljs','odbc','randomstring','request-promise','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawBody','getdigits','channel','mailRpc','prototype','getVariable','rpc','getVariableById','name','catch','getVoiceQueueById','then','getSquareProject','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','Intervals','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','query','info','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','createSquareRecording','calleridname','context','priority','accountcode','dnid','arg_1','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agentPause','callerid','agentUnpause','agent','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','shellCommand','exec','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','MP3','googleTTS','google_tts_language','url','method','number','timeout','PUT','body','headers','parse','rawHeaders','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','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','includes','clone','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','replaceObjectAllVariables','split','extra','result','setVariable','maxRetry','sync','mrcpsynth','MRCPSynth','noop','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','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','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','RECOG_INSTANCE()','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','bot','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','Trying\x20DialogflowV2:\x20%s'];(function(_0x1d8fa1,_0x18d00f){var _0x528467=function(_0x259e18){while(--_0x259e18){_0x1d8fa1['push'](_0x1d8fa1['shift']());}};_0x528467(++_0x18d00f);}(_0xfc75,0xe1));var _0x5fc7=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xfc75[_0x502c7d];return _0x30b7ed;};'use strict';var fs=require('fs');var util=require(_0x5fc7('0x0'));var _=require(_0x5fc7('0x1'));var sh=require(_0x5fc7('0x2'));var odbc=require(_0x5fc7('0x3'))();var rs=require(_0x5fc7('0x4'));var moment=require('moment');var Mustache=require('mustache');var rp=require(_0x5fc7('0x5'));var logger=require('../../config/logger')(_0x5fc7('0x6'));var config=require(_0x5fc7('0x7'));var shared=require(_0x5fc7('0x8'));var scripts=require(_0x5fc7('0x9'));var FILES_PATH=_0x5fc7('0xa');var recursiveMapAttributes=['rawHeaders',_0x5fc7('0xb')];var verticesWithRetry=['menu',_0x5fc7('0xc'),'getsecretdigits'];var AGIVertices=function(_0x5bc5e3,_0x2412b6,_0x5d30b9){this[_0x5fc7('0xd')]=_0x5bc5e3;this['rpc']=_0x2412b6;this[_0x5fc7('0xe')]=_0x5d30b9;};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x10')]=function(_0x483713,_0x2d9b52){this[_0x5fc7('0x11')][_0x5fc7('0x12')](_0x483713)['then'](function(_0x379a0a){_0x2d9b52(null,_0x379a0a?_0x379a0a[_0x5fc7('0x13')]:![]);})[_0x5fc7('0x14')](function(_0x23a387){_0x2d9b52(_0x23a387);});};AGIVertices['prototype']['getVoiceQueue']=function(_0x599c23,_0x53ca56){this[_0x5fc7('0x11')][_0x5fc7('0x15')](_0x599c23)[_0x5fc7('0x16')](function(_0x11e612){_0x53ca56(null,_0x11e612?_0x11e612['name']:![]);})[_0x5fc7('0x14')](function(_0x32d87c){_0x53ca56(_0x32d87c);});};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x17')]=function(_0x51d176,_0x188101){this[_0x5fc7('0x11')]['getSquareProjectById'](_0x51d176)['then'](function(_0x34c1ee){_0x188101(null,_0x34c1ee?_0x34c1ee[_0x5fc7('0x13')]:![]);})[_0x5fc7('0x14')](function(_0x288508){_0x188101(_0x288508);});};AGIVertices['prototype'][_0x5fc7('0x18')]=function(_0x98d164,_0xa61588){this[_0x5fc7('0x11')][_0x5fc7('0x19')](_0x98d164)['then'](function(_0x56d686){_0xa61588(null,_0x56d686?_0x56d686[_0x5fc7('0x1a')]:![]);})[_0x5fc7('0x14')](function(_0x3de163){_0xa61588(_0x3de163);});};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x1b')]=function(_0x26c4ae,_0x31a582){this[_0x5fc7('0x11')]['getUserById'](_0x26c4ae)[_0x5fc7('0x16')](function(_0x5eacf6){_0x31a582(null,_0x5eacf6?_0x5eacf6[_0x5fc7('0x13')]:![]);})[_0x5fc7('0x14')](function(_0x2bd0e5){_0x31a582(_0x2bd0e5);});};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x1c')]=function(_0x51b0f2,_0x3c1c8b){this[_0x5fc7('0x11')][_0x5fc7('0x1d')](_0x51b0f2)[_0x5fc7('0x16')](function(_0x27651f){_0x3c1c8b(null,_0x27651f?_0x27651f[_0x5fc7('0x13')]:![]);})[_0x5fc7('0x14')](function(_0x13752f){_0x3c1c8b(_0x13752f);});};AGIVertices['prototype']['getSound']=function(_0x8dcfab,_0x564981){var _0x423e0f=this;this['rpc'][_0x5fc7('0x1e')](_0x8dcfab)[_0x5fc7('0x16')](function(_0x443b4a){_0x564981(null,_0x443b4a?_0x423e0f[_0x5fc7('0x1f')](_0x443b4a[_0x5fc7('0x20')]):![]);})[_0x5fc7('0x14')](function(_0x186bec){_0x564981(_0x186bec);});};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x21')]=function(_0x52813,_0x58fa14){this[_0x5fc7('0x11')][_0x5fc7('0x22')](_0x52813)[_0x5fc7('0x16')](function(_0x17de2f){_0x58fa14(null,_0x17de2f?_0x17de2f:![]);})[_0x5fc7('0x14')](function(_0x879b91){_0x58fa14(_0x879b91);});};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x23')]=function(_0x453c92,_0x5585c2,_0x5aab0b){this[_0x5fc7('0xe')][_0x5fc7('0x23')](_0x453c92,_0x5585c2)[_0x5fc7('0x16')](function(){_0x5aab0b(null);})[_0x5fc7('0x14')](function(_0x38980b){_0x5aab0b(_0x38980b);});};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x24')]=function(_0x3c81b3,_0x2d6d38){this[_0x5fc7('0x11')][_0x5fc7('0x25')](_0x3c81b3)[_0x5fc7('0x16')](function(_0x4a29ef){if(_0x4a29ef){if(_0x4a29ef['IntervalId']){_0x2d6d38(null,[_0x4a29ef[_0x5fc7('0x26')]]);}else{_0x2d6d38(null,_['map'](_0x4a29ef[_0x5fc7('0x27')],_0x5fc7('0x26')));}}else{_0x2d6d38(null,![]);}})[_0x5fc7('0x14')](function(_0x2e6faf){_0x2d6d38(_0x2e6faf);});};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x1f')]=function(_0x542160){return util['format'](_0x5fc7('0x28'),FILES_PATH,_0x542160);};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x29')]=function(_0x3ccb66,_0x51d758,_0x5357e8){odbc['open'](_0x3ccb66,function(_0x147764){if(_0x147764){logger[_0x5fc7('0x2a')](_0x5fc7('0x2b'),_0x147764);_0x5357e8(_0x147764);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0x5fc7('0x2c')](_0x51d758,function(_0x2e485,_0xac4b1a){if(_0x2e485){logger['info']('Error\x20executing\x20query\x20%s',_0x51d758);_0x5357e8(_0x2e485);}else{logger[_0x5fc7('0x2d')](_0x5fc7('0x2e'),_0x51d758);odbc['close'](function(_0x480fd7){if(_0x480fd7){logger[_0x5fc7('0x2a')](_0x5fc7('0x2f'),_0x480fd7);}_0x5357e8(null,_0xac4b1a);});}});}});};AGIVertices['prototype'][_0x5fc7('0x30')]=function(_0x27ff86,_0x576d9b){this['rpc'][_0x5fc7('0x31')](_0x27ff86)['then'](function(_0xec302a){_0x576d9b(null,_0xec302a?_0xec302a:![]);})['catch'](function(_0x1d7ff2){_0x576d9b(_0x1d7ff2);});};AGIVertices[_0x5fc7('0xf')]['createSmsMessage']=function(_0x1933ea,_0x1cb63a){this['rpc'][_0x5fc7('0x32')](_0x1933ea)[_0x5fc7('0x16')](function(_0x4722fa){_0x1cb63a(null,_0x4722fa);})[_0x5fc7('0x14')](function(_0x4c51d4){_0x1cb63a(_0x4c51d4);});};AGIVertices['prototype'][_0x5fc7('0x33')]=function(_0x3308f9,_0x3fded1,_0x1233d0){this[_0x5fc7('0x11')][_0x5fc7('0x33')]({'uniqueid':this['channel'][_0x5fc7('0x34')],'node':_0x3308f9[_0x5fc7('0x35')],'application':_0x3308f9[_0x5fc7('0x36')],'data':_0x3fded1||null,'project_name':this[_0x5fc7('0xd')]['arg_1'],'callerid':this[_0x5fc7('0xd')]['callerid']})['then'](function(_0x1f9c2e){if(_0x1233d0){_0x1233d0(null,_0x1f9c2e);}})['catch'](function(_0x2df95f){if(_0x1233d0){_0x1233d0(_0x2df95f);}});};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x37')]=function(_0xdfd670,_0x3e1b6c,_0x42666a,_0x2d9ccf){this[_0x5fc7('0x11')][_0x5fc7('0x37')]({'uniqueid':this[_0x5fc7('0xd')][_0x5fc7('0x34')],'callerid':this[_0x5fc7('0xd')]['callerid'],'calleridname':this[_0x5fc7('0xd')][_0x5fc7('0x38')],'context':this[_0x5fc7('0xd')][_0x5fc7('0x39')],'extension':this[_0x5fc7('0xd')]['extension'],'priority':this[_0x5fc7('0xd')][_0x5fc7('0x3a')],'accountcode':this[_0x5fc7('0xd')][_0x5fc7('0x3b')],'dnid':this['channel'][_0x5fc7('0x3c')],'projectName':this[_0x5fc7('0xd')][_0x5fc7('0x3d')],'saveName':_0x3e1b6c,'filename':_0xdfd670['file']||_0x3e1b6c,'savePath':_0x42666a})[_0x5fc7('0x16')](function(_0x487f18){_0x2d9ccf(null,_0x487f18);})[_0x5fc7('0x14')](function(_0x285c48){_0x2d9ccf(_0x285c48);});};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x3e')]=function(_0x34962b,_0x26eb9a,_0xae9898,_0x5a77d4,_0x17454d){this[_0x5fc7('0x11')][_0x5fc7('0x3e')]({'uniqueid':this[_0x5fc7('0xd')][_0x5fc7('0x34')],'body':_0x34962b,'direction':_0x26eb9a,'providerName':_0xae9898,'providerResponse':_0x5a77d4})[_0x5fc7('0x16')](function(_0x4efd37){if(_0x17454d){_0x17454d(null,_0x4efd37);}})[_0x5fc7('0x14')](function(_0x6335bc){if(_0x17454d){_0x17454d(_0x6335bc);}});};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x3f')]=function(_0x1a48b5,_0x31942d){this[_0x5fc7('0x11')][_0x5fc7('0x3f')]({'firstName':_[_0x5fc7('0x40')](_0x1a48b5[_0x5fc7('0x13')])||_[_0x5fc7('0x41')](_0x1a48b5[_0x5fc7('0x13')])?_0x5fc7('0x42')+Math[_0x5fc7('0x43')]():_0x1a48b5[_0x5fc7('0x13')],'lastName':_[_0x5fc7('0x40')](_0x1a48b5[_0x5fc7('0x44')])||_[_0x5fc7('0x41')](_0x1a48b5[_0x5fc7('0x44')])?null:_0x1a48b5[_0x5fc7('0x44')],'phone':_0x1a48b5[_0x5fc7('0x45')],'ListId':_0x1a48b5[_0x5fc7('0x46')],'scheduledat':_0x1a48b5[_0x5fc7('0x47')],'callbackUniqueid':this['channel'][_0x5fc7('0x34')],'tags':_0x5fc7('0x48'),'description':_0x5fc7('0x49')+_0x1a48b5['scheduledAt'][_0x5fc7('0x4a')](),'priority':_0x1a48b5[_0x5fc7('0x4b')]})[_0x5fc7('0x16')](function(_0x1a73c0){_0x31942d(null,_0x1a73c0);})[_0x5fc7('0x14')](function(_0x154ea1){_0x31942d(_0x154ea1);});};AGIVertices['prototype']['getPause']=function(_0x556dd2,_0x22f630){this[_0x5fc7('0x11')][_0x5fc7('0x4c')](_0x556dd2)['then'](function(_0x523144){_0x22f630(null,_0x523144?_0x523144[_0x5fc7('0x13')]:![]);})['catch'](function(_0x14db72){_0x22f630(_0x14db72);});};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x4d')]=function(_0x41c448,_0x1bfd5a,_0x142ce1){var _0x4cb972={'role':'agent'};_0x4cb972[_0x41c448]=this['channel'][_0x5fc7('0x4e')];this[_0x5fc7('0x11')][_0x5fc7('0x4d')](_0x4cb972,_0x1bfd5a,this[_0x5fc7('0xd')][_0x5fc7('0x34')])[_0x5fc7('0x16')](function(_0x22ef0d){_0x142ce1(null,_[_0x5fc7('0x41')](_0x22ef0d)?![]:!![]);})[_0x5fc7('0x14')](function(_0x5ed4e0){logger[_0x5fc7('0x2a')](_0x5ed4e0);_0x142ce1(null,![]);});};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x4f')]=function(_0x20a45d,_0x18a0fd){var _0x35c73b={'role':_0x5fc7('0x50')};_0x35c73b[_0x20a45d]=this[_0x5fc7('0xd')]['callerid'];this['rpc'][_0x5fc7('0x4f')](_0x35c73b)['then'](function(_0x2b6520){_0x18a0fd(null,_[_0x5fc7('0x41')](_0x2b6520)?![]:!![]);})['catch'](function(_0x35d2f6){logger['error'](_0x35d2f6);_0x18a0fd(null,![]);});};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x51')]=function(_0xf3cab1,_0x31b3dd){var _0x9ed8d2={'role':'agent'};_0x9ed8d2[_0xf3cab1]=this[_0x5fc7('0xd')][_0x5fc7('0x4e')];this['rpc'][_0x5fc7('0x51')](_0x9ed8d2)[_0x5fc7('0x16')](function(_0x5b0d7a){_0x31b3dd(null,_[_0x5fc7('0x41')](_0x5b0d7a)?![]:!![]);})['catch'](function(_0x53c0f9){logger['error'](_0x53c0f9);_0x31b3dd(null,![]);});};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x52')]=function(_0x56ab93,_0x26a34c){var _0x16656f={'role':_0x5fc7('0x50')};_0x16656f[_0x56ab93]=this[_0x5fc7('0xd')][_0x5fc7('0x4e')];var _0x1ed46a=_0x56ab93!=_0x5fc7('0x53')?util[_0x5fc7('0x54')](_0x5fc7('0x55'),'LOCAL',this['channel'][_0x5fc7('0x4e')]):undefined;this['rpc'][_0x5fc7('0x52')](_0x16656f,_0x1ed46a)['then'](function(_0xf5554){_0x26a34c(null,_[_0x5fc7('0x41')](_0xf5554)?![]:!![]);})[_0x5fc7('0x14')](function(_0x21a668){logger[_0x5fc7('0x2a')](_0x21a668);_0x26a34c(null,![]);});};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x56')]=function(_0x29fab1,_0x2bd83f){sh[_0x5fc7('0x57')](_['trim'](_0x29fab1),function(_0x295c79,_0x36e283){var _0x2343ec=_0x36e283['replace'](/(\r\n|\n|\r)/gm,'');_0x2bd83f(null,_0x2343ec);});};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x58')]=function(_0x55f99c,_0x2ede0c){scripts[_0x5fc7('0x58')](_0x55f99c[_0x5fc7('0x59')],_0x55f99c[_0x5fc7('0x5a')]||'text',_0x55f99c[_0x5fc7('0x5b')],_0x55f99c['languageCode']||_0x5fc7('0x5c'),_0x55f99c[_0x5fc7('0x5d')]||_0x5fc7('0x5e'),_0x55f99c['audioEncoding']||_0x5fc7('0x5f'))['then'](function(_0x119a5d){_0x2ede0c(null,_0x119a5d);})[_0x5fc7('0x14')](function(_0x1802b2){_0x2ede0c(_0x1802b2);});};AGIVertices['prototype'][_0x5fc7('0x60')]=function(_0x3f3acd,_0x46c44a){scripts[_0x5fc7('0x60')](_0x3f3acd[_0x5fc7('0x5b')],_0x3f3acd[_0x5fc7('0x61')]||'en',0x1)[_0x5fc7('0x16')](function(_0x135191){_0x46c44a(null,_0x135191);})[_0x5fc7('0x14')](function(_0x1d0c54){_0x46c44a(_0x1d0c54);});};AGIVertices[_0x5fc7('0xf')]['restAPI']=function(_0x1db9fd,_0x1c09f3){var _0x297dba={'uri':_0x1db9fd[_0x5fc7('0x62')],'method':_0x1db9fd[_0x5fc7('0x63')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x1db9fd['timeout'])===_0x5fc7('0x64')&&parseInt(_0x1db9fd['timeout'])>=0x1?parseInt(_0x1db9fd[_0x5fc7('0x65')])*0x3e8:0x5*0x3e8};if(_['includes'](['POST',_0x5fc7('0x66')],_0x297dba[_0x5fc7('0x63')]['toUpperCase']())){try{_0x297dba[_0x5fc7('0x67')]=_0x1db9fd[_0x5fc7('0xb')]?JSON['parse'](_0x1db9fd[_0x5fc7('0xb')]):{};}catch(_0x39ebc5){logger['error']('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x39ebc5);}}try{_0x297dba[_0x5fc7('0x68')]=_0x1db9fd['rawHeaders']?JSON[_0x5fc7('0x69')](_0x1db9fd[_0x5fc7('0x6a')]):{};}catch(_0xc2a6b3){logger[_0x5fc7('0x2a')](_0x5fc7('0x6b'),_0xc2a6b3);}if(_0x1db9fd[_0x5fc7('0x6c')]){try{var _0x414f6a=require(_0x1db9fd[_0x5fc7('0x6c')])['sync'](this,_0x297dba);_0x297dba[_0x5fc7('0x6d')]=Mustache[_0x5fc7('0x6e')](_0x1db9fd[_0x5fc7('0x62')],_0x414f6a,{},['$$','$$']);if(_0x297dba[_0x5fc7('0x68')]){_0x297dba[_0x5fc7('0x68')]=JSON[_0x5fc7('0x69')](Mustache[_0x5fc7('0x6e')](JSON[_0x5fc7('0x6f')](_0x297dba[_0x5fc7('0x68')]),_0x414f6a,{},['$$','$$']));}if(_0x297dba['body']){_0x297dba['body']=JSON[_0x5fc7('0x69')](Mustache[_0x5fc7('0x6e')](JSON[_0x5fc7('0x6f')](_0x297dba[_0x5fc7('0x67')]),_0x414f6a,{},['$$','$$']));}}catch(_0x2260ee){logger[_0x5fc7('0x2a')](_0x5fc7('0x70'),_0x2260ee);}}rp(_0x297dba)[_0x5fc7('0x16')](function(_0x42b02d){var _0x3e7db8={'statusCode':_0x42b02d[_0x5fc7('0x71')]||0xc8,'statusMessage':_0x42b02d[_0x5fc7('0x72')]||'OK','headers':_0x42b02d['headers']||{},'body':_0x42b02d['body']||{}};_0x1c09f3(null,_0x3e7db8);})[_0x5fc7('0x14')](function(_0x3e0633){var _0x2f0937={'statusCode':_0x3e0633[_0x5fc7('0x71')]||0x1f4,'statusMessage':_0x3e0633[_0x5fc7('0x73')]||_0x5fc7('0x74'),'headers':_0x3e0633[_0x5fc7('0x75')][_0x5fc7('0x68')]||{},'body':_0x3e0633[_0x5fc7('0x75')]['body']||{}};_0x1c09f3(null,_0x2f0937);});};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x76')]=function(_0x4c0b72,_0x6a3f5){scripts[_0x5fc7('0x76')](this['channel'][_0x5fc7('0x34')],_0x4c0b72[_0x5fc7('0x77')],_0x4c0b72[_0x5fc7('0x5b')],_0x4c0b72[_0x5fc7('0x78')]||'en')[_0x5fc7('0x16')](function(_0x5de36c){_0x6a3f5(null,_0x5de36c);})[_0x5fc7('0x14')](function(_0x465795){_0x6a3f5(_0x465795);});};AGIVertices[_0x5fc7('0xf')]['googleDialogflowV2']=function(_0x313185,_0x10734f){scripts[_0x5fc7('0x79')](this[_0x5fc7('0xd')][_0x5fc7('0x34')],_0x313185[_0x5fc7('0x7a')],_0x313185['client_email'],_0x313185[_0x5fc7('0x7b')],_0x313185[_0x5fc7('0x5b')],_0x313185[_0x5fc7('0x7c')]||'en')[_0x5fc7('0x16')](function(_0x1ee0b8){_0x10734f(null,_0x1ee0b8);})[_0x5fc7('0x14')](function(_0x3d2719){_0x10734f(_0x3d2719);});};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x7d')]=function(_0x47cd6e,_0x4d17f0){scripts[_0x5fc7('0x7d')](this[_0x5fc7('0xd')],_0x47cd6e)[_0x5fc7('0x16')](function(_0x5ee329){_0x4d17f0(null,_0x5ee329);})[_0x5fc7('0x14')](function(_0x3089ae){_0x4d17f0(_0x3089ae);});};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x7e')]=function(_0x14e6f9,_0x43aa2b){scripts[_0x5fc7('0x7e')](_0x14e6f9[_0x5fc7('0x77')],_0x14e6f9['text'],_0x14e6f9[_0x5fc7('0x7f')]||_0x5fc7('0x5c'),_0x14e6f9['speed'])[_0x5fc7('0x16')](function(_0x3e3337){_0x43aa2b(null,_0x3e3337);})[_0x5fc7('0x14')](function(_0x358269){_0x43aa2b(_0x358269);});};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x80')]=function(_0x10cbcd,_0x432ad5,_0x5c26bd){scripts[_0x5fc7('0x80')](_0x432ad5,_0x10cbcd[_0x5fc7('0x77')],_0x10cbcd[_0x5fc7('0x81')]||_0x5fc7('0x5c'),this[_0x5fc7('0x82')](_0x10cbcd[_0x5fc7('0x83')])?_0x10cbcd[_0x5fc7('0x83')]:undefined)[_0x5fc7('0x16')](function(_0x3145dd){_0x5c26bd(null,_0x3145dd);})['catch'](function(_0x512282){_0x5c26bd(_0x512282);});};AGIVertices['prototype'][_0x5fc7('0x84')]=function(_0x1c8f65,_0xf28ed6){scripts[_0x5fc7('0x84')](_0x1c8f65[_0x5fc7('0x85')],_0x1c8f65[_0x5fc7('0x86')],_0x1c8f65[_0x5fc7('0x87')],_0x1c8f65[_0x5fc7('0x88')]||_0x5fc7('0x89'),_0x1c8f65['text'],_0x1c8f65[_0x5fc7('0x8a')]||_0x5fc7('0x5b'))[_0x5fc7('0x16')](function(_0x41e44c){_0xf28ed6(null,_0x41e44c);})[_0x5fc7('0x14')](function(_0x1287fb){_0xf28ed6(_0x1287fb);});};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x8b')]=function(_0x15cdc8,_0x2008e4){scripts[_0x5fc7('0x8b')](this[_0x5fc7('0xd')][_0x5fc7('0x34')],_0x15cdc8[_0x5fc7('0x85')],_0x15cdc8[_0x5fc7('0x86')],_0x15cdc8[_0x5fc7('0x8c')],_0x15cdc8['text'],_0x15cdc8[_0x5fc7('0x8d')])[_0x5fc7('0x16')](function(_0x35c499){_0x2008e4(null,_0x35c499);})['catch'](function(_0x293a5c){_0x2008e4(_0x293a5c);});};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x8e')]=function(_0x328da3,_0xbe1c07,_0x57f32c){scripts[_0x5fc7('0x8e')](_0xbe1c07,_0x328da3[_0x5fc7('0x77')],_0x328da3[_0x5fc7('0x8f')]||'en-US')[_0x5fc7('0x16')](function(_0x49058c){_0x57f32c(null,_0x49058c);})[_0x5fc7('0x14')](function(_0x229a39){_0x57f32c(_0x229a39);});};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x90')]=function(_0x2808d8,_0x2b0e40,_0x5cea2e){scripts['tildeASR'](_0x2b0e40,_0x2808d8[_0x5fc7('0x91')],_0x2808d8['appsecret'],_0x2808d8['uri'])[_0x5fc7('0x16')](function(_0x1aa029){_0x5cea2e(null,_0x1aa029);})[_0x5fc7('0x14')](function(_0x8ba50){_0x5cea2e(_0x8ba50);});};AGIVertices[_0x5fc7('0xf')]['clear']=function(_0x48fdf0){var _0x432c66=_[_0x5fc7('0x92')](verticesWithRetry,_0x48fdf0[_0x5fc7('0x36')])?_0x48fdf0:_[_0x5fc7('0x93')](_0x48fdf0);for(var _0xe30011 in _0x432c66){if(_0x432c66[_0x5fc7('0x94')](_0xe30011)){if(_0x432c66[_0xe30011]&&_[_0x5fc7('0x95')](_0x432c66[_0xe30011])){if(_['includes'](recursiveMapAttributes,_0xe30011)){_0x432c66[_0xe30011]=this['replaceObjectAllVariables'](_0x432c66[_0xe30011]);}else{_0x432c66[_0xe30011]=this[_0x5fc7('0x96')](_0x432c66[_0xe30011]);}}}}return _0x432c66;};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x97')]=function(_0x8d1147){for(var _0x5b6d0a in _0x8d1147){if(_0x8d1147[_0x5fc7('0x94')](_0x5b6d0a)){if(_[_0x5fc7('0x98')](_0x8d1147[_0x5b6d0a])){this[_0x5fc7('0x97')](_0x8d1147[_0x5b6d0a]);}else if(_[_0x5fc7('0x99')](_0x8d1147[_0x5b6d0a])){for(var _0x1dfa30=0x0;_0x1dfa30<_0x8d1147[_0x5b6d0a][_0x5fc7('0x9a')];_0x1dfa30++){this[_0x5fc7('0x97')](_0x8d1147[_0x5b6d0a][_0x1dfa30]);}}else if(_['isString'](_0x8d1147[_0x5b6d0a])){_0x8d1147[_0x5b6d0a]=this['replaceAllVariables'](_0x8d1147[_0x5b6d0a]);}}}};AGIVertices['prototype'][_0x5fc7('0x9b')]=function(_0x16f130,_0x3c0752){for(var _0x13d17b in _0x16f130){if(_0x16f130[_0x5fc7('0x94')](_0x13d17b)){if(_[_0x5fc7('0x98')](_0x16f130[_0x13d17b])){if(!_[_0x5fc7('0x40')](_0x16f130[_0x13d17b])){this[_0x5fc7('0x9b')](_0x16f130[_0x13d17b],util[_0x5fc7('0x54')]('%s.%s',_0x3c0752,_0x13d17b));}}else if(_[_0x5fc7('0x99')](_0x16f130[_0x13d17b])){for(var _0x5bb1b6=0x0;_0x5bb1b6<_0x16f130[_0x13d17b][_0x5fc7('0x9a')];_0x5bb1b6++){this[_0x5fc7('0x9b')](_0x16f130[_0x13d17b][_0x5bb1b6],util[_0x5fc7('0x54')](_0x5fc7('0x9c'),_0x3c0752,_0x13d17b+'['+_0x5bb1b6+']'));}}else{if(!_[_0x5fc7('0x41')](_0x16f130[_0x13d17b])){this[_0x5fc7('0xd')]['setVariable'](util[_0x5fc7('0x54')]('%s.%s',_0x3c0752,_0x13d17b),_0x16f130[_0x13d17b]);}}}}};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x9d')]=function(_0x5b1494){try{var _0x20cb10=JSON[_0x5fc7('0x69')](_0x5b1494);this[_0x5fc7('0x97')](_0x20cb10);return JSON[_0x5fc7('0x6f')](_0x20cb10);}catch(_0x52c5b8){return this[_0x5fc7('0x96')](_0x5b1494);}};AGIVertices[_0x5fc7('0xf')]['replaceAllVariables']=function(_0x1f5d7e){var _0x4ef573=_0x1f5d7e[_0x5fc7('0x9e')]('{');for(var _0x5d91ec=0x1;_0x5d91ec<_0x4ef573[_0x5fc7('0x9a')];_0x5d91ec+=0x1){var _0x575d8f=_0x4ef573[_0x5d91ec]['split']('}');if(_0x575d8f[_0x5fc7('0x9a')]>0x1){_0x1f5d7e=_0x1f5d7e['replaceAll']('{'+_0x575d8f[0x0]+'}',this['channel'][_0x5fc7('0x10')](_0x575d8f[0x0])[_0x5fc7('0x9f')]||_0x575d8f[0x0]);}}if(_0x4ef573['length']===0x1){return _0x1f5d7e[_0x5fc7('0x4a')]();}return this[_0x5fc7('0x96')](_0x1f5d7e);};AGIVertices[_0x5fc7('0xf')]['getAndSetVariable']=function(_0x2b3338,_0x2c14ce){var _0x565117=this[_0x5fc7('0xd')][_0x5fc7('0x10')](_0x2b3338);if(_0x565117[_0x5fc7('0xa0')]===-0x1){return _0x565117;}logger['info'](util[_0x5fc7('0x54')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x2c14ce,_0x565117[_0x5fc7('0x9f')]));return this['channel'][_0x5fc7('0xa1')](_0x2c14ce,_0x565117[_0x5fc7('0x9f')]);};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x82')]=function(_0x40aade){return _0x40aade&&_0x40aade!=='0'&&_0x40aade!=='-1'&&_0x40aade!=='';};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0xa2')]=function(_0x36d7bd){this[_0x5fc7('0x33')][_0x5fc7('0xa3')](this,_0x36d7bd,'-');_0x36d7bd['retry']=_0x36d7bd['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0xa4')]=function(_0x36f5aa){logger['info'](util['format']('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x36f5aa[_0x5fc7('0x35')]));if(!this[_0x5fc7('0x82')](_0x36f5aa[_0x5fc7('0x5b')])){return this[_0x5fc7('0xd')]['noop']('no\x20text\x20configured');}var _0x3d98b2='\x22'+_0x36f5aa['text']+'\x22';if(this[_0x5fc7('0x82')](_0x36f5aa[_0x5fc7('0x75')])){_0x3d98b2+=','+_0x36f5aa[_0x5fc7('0x75')];}var _0x4238ec=this[_0x5fc7('0xd')][_0x5fc7('0x57')](_0x5fc7('0xa5'),_0x3d98b2);if(_0x4238ec[_0x5fc7('0xa0')]===-0x1){return _0x4238ec;}return this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util[_0x5fc7('0x54')]('Executed\x20command\x20MRCPSynth\x20%s',_0x3d98b2));};AGIVertices['prototype']['mrcprecog']=function(_0x6dbc07){logger[_0x5fc7('0x2d')](util['format'](_0x5fc7('0xa7'),_0x6dbc07['label']));if(!this[_0x5fc7('0x82')](_0x6dbc07[_0x5fc7('0xa8')])){return this['channel']['noop'](_0x5fc7('0xa9'));}var _0xd01f6b=_0x6dbc07[_0x5fc7('0xa8')];if(this['isConfigured'](_0x6dbc07['options'])){_0xd01f6b+=','+_0x6dbc07[_0x5fc7('0x75')];}var _0x18bbc8=this[_0x5fc7('0xd')]['exec'](_0x5fc7('0xaa'),_0xd01f6b);if(_0x18bbc8[_0x5fc7('0xa0')]===-0x1){return _0x18bbc8;}var _0x7b688=this[_0x5fc7('0xab')](_0x5fc7('0xac'),_0x5fc7('0xad'));if(_0x7b688['result']===-0x1){return _0x7b688;}var _0x4e2a3f=this[_0x5fc7('0xab')](_0x5fc7('0xae'),_0x5fc7('0xaf'));if(_0x4e2a3f[_0x5fc7('0xa0')]===-0x1){return _0x4e2a3f;}var _0x1163a7=this['getAndSetVariable']('RECOG_INSTANCE()',_0x5fc7('0xb0'));if(_0x1163a7[_0x5fc7('0xa0')]===-0x1){return _0x1163a7;}return this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util[_0x5fc7('0x54')](_0x5fc7('0xb1'),_0xd01f6b));};AGIVertices[_0x5fc7('0xf')]['agi']=function(_0x3ee664){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0xb2'),_0x3ee664['label']));return this['channel'][_0x5fc7('0x6')]([_0x3ee664['command'],_0x3ee664['args']]);};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0xb3')]=function(_0x21c62f){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0xb4'),_0x21c62f[_0x5fc7('0x35')]));if(this[_0x5fc7('0x82')](_0x21c62f['timeout'])){logger[_0x5fc7('0x2d')](util['format'](_0x5fc7('0xb5'),_0x21c62f[_0x5fc7('0x65')]));var _0x3e649f=this['channel'][_0x5fc7('0xb6')](_0x21c62f['timeout']);if(_0x3e649f[_0x5fc7('0xa0')]===-0x1){return _0x3e649f;}}return this[_0x5fc7('0xd')][_0x5fc7('0xb3')]();};AGIVertices[_0x5fc7('0xf')]['callback']=function(_0x2d57a2){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0xb7'),_0x2d57a2['label']));if(!this[_0x5fc7('0x82')](_0x2d57a2[_0x5fc7('0x46')])){return this[_0x5fc7('0xd')]['error'](_0x2d57a2,_0x5fc7('0xb8'));}_0x2d57a2[_0x5fc7('0x47')]=moment();if(this['isConfigured'](_0x2d57a2[_0x5fc7('0xb9')])){_0x2d57a2[_0x5fc7('0x47')]=moment()[_0x5fc7('0xba')](_0x2d57a2[_0x5fc7('0xb9')],_0x5fc7('0xbb'));}if(!this[_0x5fc7('0x82')](_0x2d57a2[_0x5fc7('0x4b')])){_0x2d57a2[_0x5fc7('0x4b')]=0x2;}this[_0x5fc7('0x3f')][_0x5fc7('0xa3')](this,_0x2d57a2);return this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util[_0x5fc7('0x54')](_0x5fc7('0xbc'),_0x2d57a2[_0x5fc7('0x45')],_0x2d57a2[_0x5fc7('0x46')],_0x2d57a2[_0x5fc7('0x47')]));};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0xbd')]=function(_0x20e801){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0xbe'),_0x20e801[_0x5fc7('0x35')]));var _0xdf858a=this[_0x5fc7('0xd')][_0x5fc7('0x57')](_0x20e801[_0x5fc7('0xbf')],_0x20e801['options']);if(_0xdf858a[_0x5fc7('0xa0')]===-0x1){return _0xdf858a;}return this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util[_0x5fc7('0x54')](_0x5fc7('0xc0'),_0x20e801['application'],_0x20e801[_0x5fc7('0x75')]));};AGIVertices['prototype'][_0x5fc7('0xc1')]=function(_0x270585){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0xc2'),_0x270585[_0x5fc7('0x35')]));if(!this['isConfigured'](_0x270585[_0x5fc7('0x5b')])){return this['channel'][_0x5fc7('0xa6')](_0x5fc7('0xc3'));}var _0xed5bc4='\x22'+_0x270585[_0x5fc7('0x5b')]+'\x22';if(this[_0x5fc7('0x82')](_0x270585[_0x5fc7('0x75')])){_0xed5bc4+=','+_0x270585[_0x5fc7('0x75')];}var _0x4dab78=this[_0x5fc7('0xd')][_0x5fc7('0x57')](_0x5fc7('0xa5'),_0xed5bc4);if(_0x4dab78['result']===-0x1){return _0x4dab78;}return this['channel'][_0x5fc7('0xa6')](util['format'](_0x5fc7('0xc4'),_0xed5bc4));};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0xc5')]=function(_0x7cab84){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0xc6'),_0x7cab84['label']));if(!this['isConfigured'](_0x7cab84[_0x5fc7('0x5b')])){return this['channel'][_0x5fc7('0xa6')](_0x5fc7('0xc3'));}var _0x2ff4c7='\x22'+_0x7cab84[_0x5fc7('0x5b')]+'\x22';if(this['isConfigured'](_0x7cab84[_0x5fc7('0x75')])){_0x2ff4c7+=','+_0x7cab84[_0x5fc7('0x75')];}var _0x23b588=this[_0x5fc7('0xd')][_0x5fc7('0x57')]('MRCPSynth',_0x2ff4c7);if(_0x23b588[_0x5fc7('0xa0')]===-0x1){return _0x23b588;}return this['channel']['noop'](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x2ff4c7));};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0xc7')]=function(_0x441455){logger[_0x5fc7('0x2d')](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x441455[_0x5fc7('0x35')]));if(!this[_0x5fc7('0x82')](_0x441455[_0x5fc7('0xa8')])){return this[_0x5fc7('0xd')][_0x5fc7('0xa6')]('no\x20grammar\x20configured');}var _0x2d91a2=_0x441455[_0x5fc7('0xa8')];if(this['isConfigured'](_0x441455[_0x5fc7('0x75')])){_0x2d91a2+=','+_0x441455[_0x5fc7('0x75')];}var _0x488953=this[_0x5fc7('0xd')][_0x5fc7('0x57')]('MRCPRecog',_0x2d91a2);if(_0x488953[_0x5fc7('0xa0')]===-0x1){return _0x488953;}var _0x5c9333=this['getAndSetVariable'](_0x5fc7('0xac'),_0x5fc7('0xc8'));if(_0x5c9333[_0x5fc7('0xa0')]===-0x1){return _0x5c9333;}var _0x574cb0=this[_0x5fc7('0xab')](_0x5fc7('0xae'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x574cb0[_0x5fc7('0xa0')]===-0x1){return _0x574cb0;}var _0x15d284=this['getAndSetVariable'](_0x5fc7('0xc9'),'LUMENVOX_ASR_INSTANCE');if(_0x15d284['result']===-0x1){return _0x15d284;}return this[_0x5fc7('0xd')]['noop'](util[_0x5fc7('0x54')](_0x5fc7('0xb1'),_0x2d91a2));};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0xca')]=function(_0x326c20){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0xcb'),_0x326c20[_0x5fc7('0x35')]));if(!this[_0x5fc7('0x82')](_0x326c20[_0x5fc7('0xa8')])){return this['channel'][_0x5fc7('0xa6')](_0x5fc7('0xa9'));}var _0x3fe61d=_0x326c20[_0x5fc7('0xa8')];if(this[_0x5fc7('0x82')](_0x326c20[_0x5fc7('0x75')])){_0x3fe61d+=','+_0x326c20[_0x5fc7('0x75')];}var _0x290e9b=this[_0x5fc7('0xd')][_0x5fc7('0x57')](_0x5fc7('0xaa'),_0x3fe61d);if(_0x290e9b[_0x5fc7('0xa0')]===-0x1){return _0x290e9b;}var _0x1c4f8d=this[_0x5fc7('0xab')](_0x5fc7('0xac'),_0x5fc7('0xcc'));if(_0x1c4f8d[_0x5fc7('0xa0')]===-0x1){return _0x1c4f8d;}var _0x3fc711=this[_0x5fc7('0xab')](_0x5fc7('0xae'),'SESTEK_ASR_TRANSCRIPT');if(_0x3fc711[_0x5fc7('0xa0')]===-0x1){return _0x3fc711;}var _0x554640=this[_0x5fc7('0xab')](_0x5fc7('0xc9'),_0x5fc7('0xcd'));if(_0x554640['result']===-0x1){return _0x554640;}return this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util[_0x5fc7('0x54')](_0x5fc7('0xb1'),_0x3fe61d));};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0xce')]=function(_0x2225c1){logger['info'](util[_0x5fc7('0x54')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x2225c1[_0x5fc7('0x35')]));if(!this['isConfigured'](_0x2225c1[_0x5fc7('0xcf')])){return this['channel'][_0x5fc7('0x2a')](_0x2225c1,_0x5fc7('0xd0'));}var _0x55712d=this['getSquareOdbc'][_0x5fc7('0xa3')](this,_0x2225c1[_0x5fc7('0xcf')]);if(!_0x55712d){return this[_0x5fc7('0xd')]['error'](_0x2225c1,_0x5fc7('0xd1'));}if(!this['isConfigured'](_0x2225c1[_0x5fc7('0x2c')])){return this[_0x5fc7('0xd')][_0x5fc7('0x2a')](_0x2225c1,_0x5fc7('0xd2'));}var _0x18fbad=_0x2225c1[_0x5fc7('0x2c')][_0x5fc7('0xd3')](/(\r\n|\n|\r)/gm,'\x20');this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util[_0x5fc7('0x54')](_0x5fc7('0xd4'),_0x18fbad));var _0x12962d=this[_0x5fc7('0x29')][_0x5fc7('0xa3')](this,_0x55712d,_0x18fbad);this['createSquareDetailsReport'][_0x5fc7('0xa3')](this,_0x2225c1,_0x18fbad);if(!this[_0x5fc7('0x82')](_0x2225c1[_0x5fc7('0xd5')])){return this[_0x5fc7('0xd')][_0x5fc7('0xa6')](_0x5fc7('0xd6'));}var _0x17a457=this[_0x5fc7('0x10')][_0x5fc7('0xa3')](this,_0x2225c1['variable_id']);if(!_0x17a457){return this['channel'][_0x5fc7('0x2a')](_0x2225c1,_0x5fc7('0xd7'));}var _0x16bc5a=this;_0x12962d[_0x5fc7('0xd8')](function(_0x152277,_0x3a78d5){Object['keys'](_0x152277)[_0x5fc7('0xd8')](function(_0x3595a8){_0x16bc5a[_0x5fc7('0xd')]['setVariable'](util[_0x5fc7('0x54')](_0x5fc7('0xd9'),_0x17a457,_0x3a78d5,_0x3595a8),_0x152277[_0x3595a8]);});});this[_0x5fc7('0xd')]['setVariable'](util['format'](_0x5fc7('0xda'),_0x17a457),_0x12962d[_0x5fc7('0x9a')]);return this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util['format']('variable\x20%s\x20set',_0x17a457));};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0xdb')]=function(_0x355b14){logger['debug'](util[_0x5fc7('0x54')](_0x5fc7('0xdc'),_0x355b14[_0x5fc7('0x35')]));if(!this[_0x5fc7('0x82')](_0x355b14[_0x5fc7('0xdd')])){return this[_0x5fc7('0xd')]['error'](_0x355b14,'no\x20user\x20selected');}var _0x3c8ef5=this['getUser']['sync'](this,_0x355b14[_0x5fc7('0xdd')]);if(!_0x3c8ef5){return this[_0x5fc7('0xd')][_0x5fc7('0x2a')](_0x355b14,_0x5fc7('0xde'));}var _0x4d2b48=this['channel']['exec'](_0x5fc7('0xdf'),[util[_0x5fc7('0x54')](_0x5fc7('0xe0'),_0x3c8ef5),_0x355b14[_0x5fc7('0x65')],_0x355b14['opts'],_0x355b14[_0x5fc7('0x62')]]);if(_0x4d2b48[_0x5fc7('0xa0')]===-0x1){return _0x4d2b48;}return this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util['format'](_0x5fc7('0xe1'),_0x5fc7('0xdf')));};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0xe2')]=function(_0x18b50e){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x18b50e['label']));if(!this[_0x5fc7('0x82')](_0x18b50e[_0x5fc7('0x77')])){return this[_0x5fc7('0xd')][_0x5fc7('0xa6')](_0x5fc7('0xe3'));}if(!this[_0x5fc7('0x82')](_0x18b50e['text'])){return this[_0x5fc7('0xd')][_0x5fc7('0xa6')]('no\x20text\x20configured');}this['channel'][_0x5fc7('0xe4')]=!![];this[_0x5fc7('0x33')](_0x18b50e);this[_0x5fc7('0x3e')](_0x18b50e[_0x5fc7('0x5b')],'in','','');this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util[_0x5fc7('0x54')]('Trying\x20Dialogflow:\x20%s',_0x18b50e['text']));var _0x339953=this[_0x5fc7('0x76')][_0x5fc7('0xa3')](this,_0x18b50e);if(_0x339953){for(var _0x129b6b in _0x339953){if(_0x339953[_0x5fc7('0x94')](_0x129b6b)){this[_0x5fc7('0xd')]['setVariable'](util[_0x5fc7('0x54')]('DIALOGFLOW_%s',_0x129b6b[_0x5fc7('0xe5')]()),_0x339953[_0x129b6b]);}}this[_0x5fc7('0x3e')](_0x339953[_0x5fc7('0xe6')],_0x5fc7('0xe7'),_0x5fc7('0xe2'),'');return this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util['format'](_0x5fc7('0xe8'),_0x339953[_0x5fc7('0xe6')]));}return this['channel'][_0x5fc7('0x2a')](_0x18b50e,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype'][_0x5fc7('0xe9')]=function(_0x49d189){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0xea'),_0x49d189[_0x5fc7('0x35')]));if(!this[_0x5fc7('0x82')](_0x49d189[_0x5fc7('0x7a')])){return this[_0x5fc7('0xd')][_0x5fc7('0xa6')](_0x5fc7('0xeb'));}if(!this[_0x5fc7('0x82')](_0x49d189['client_email'])){return this[_0x5fc7('0xd')][_0x5fc7('0xa6')]('no\x20client_email\x20configured');}if(!this[_0x5fc7('0x82')](_0x49d189['private_key'])){return this['channel']['noop']('no\x20private_key\x20configured');}if(!this[_0x5fc7('0x82')](_0x49d189[_0x5fc7('0x7c')])){return this[_0x5fc7('0xd')][_0x5fc7('0xa6')]('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x49d189[_0x5fc7('0x5b')])){return this[_0x5fc7('0xd')][_0x5fc7('0xa6')](_0x5fc7('0xc3'));}this[_0x5fc7('0xd')][_0x5fc7('0xe4')]=!![];this[_0x5fc7('0x33')](_0x49d189);this[_0x5fc7('0x3e')](_0x49d189['text'],'in','','');this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util[_0x5fc7('0x54')](_0x5fc7('0xec'),_0x49d189[_0x5fc7('0x5b')]));var _0x2c11f3=this['googleDialogflowV2']['sync'](this,_0x49d189);if(_0x2c11f3){for(var _0x412b41 in _0x2c11f3){if(_0x2c11f3['hasOwnProperty'](_0x412b41)){if(_0x412b41!==_0x5fc7('0xed')){this[_0x5fc7('0xd')][_0x5fc7('0xa1')](util['format'](_0x5fc7('0xee'),_0x412b41['toUpperCase']()),_0x2c11f3[_0x412b41]);}}}this['createSquareMessage'](_0x2c11f3[_0x5fc7('0xe6')],_0x5fc7('0xe7'),_0x5fc7('0xe9'),_0x2c11f3[_0x5fc7('0xed')]);return this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util[_0x5fc7('0x54')](_0x5fc7('0xef'),_0x2c11f3[_0x5fc7('0xe6')]));}return this[_0x5fc7('0xd')][_0x5fc7('0x2a')](_0x49d189,_0x5fc7('0xf0'));};AGIVertices[_0x5fc7('0xf')]['sesteknda']=function(_0x198c45){logger['info'](util[_0x5fc7('0x54')](_0x5fc7('0xf1'),_0x198c45[_0x5fc7('0x35')]));if(!this[_0x5fc7('0x82')](_0x198c45['ndauth_url'])){return this['channel'][_0x5fc7('0xa6')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x5fc7('0x82')](_0x198c45[_0x5fc7('0xf2')])){return this['channel'][_0x5fc7('0xa6')](_0x5fc7('0xf3'));}if(!this[_0x5fc7('0x82')](_0x198c45[_0x5fc7('0xf4')])){return this[_0x5fc7('0xd')][_0x5fc7('0xa6')](_0x5fc7('0xf5'));}if(!this['isConfigured'](_0x198c45[_0x5fc7('0xf6')])){return this[_0x5fc7('0xd')][_0x5fc7('0xa6')](_0x5fc7('0xc3'));}this[_0x5fc7('0xd')][_0x5fc7('0xe4')]=!![];this[_0x5fc7('0x33')](_0x198c45);this[_0x5fc7('0x3e')](_0x198c45[_0x5fc7('0x5b')],'in','','');this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util['format'](_0x5fc7('0xf7'),_0x198c45[_0x5fc7('0x5b')]));var _0x35a9f4=this[_0x5fc7('0x7d')]['sync'](this,_0x198c45);if(_0x35a9f4){for(var _0x1c5e71 in _0x35a9f4){if(_0x35a9f4[_0x5fc7('0x94')](_0x1c5e71)){this[_0x5fc7('0xd')]['setVariable'](util['format'](_0x5fc7('0xf8'),_0x1c5e71['toUpperCase']()),_0x35a9f4[_0x1c5e71]);}}this['createSquareMessage'](_0x35a9f4[_0x5fc7('0xe6')],'out',_0x5fc7('0xf9'),'');if(_0x35a9f4[_0x5fc7('0xfa')]){this[_0x5fc7('0xd')]['noop'](util[_0x5fc7('0x54')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x35a9f4[_0x5fc7('0xfa')]));var _0x290ee9=this[_0x5fc7('0xd')][_0x5fc7('0xfb')](_0x35a9f4[_0x5fc7('0xfa')]);try{fs['unlink'](_0x35a9f4[_0x5fc7('0xfa')]+'.wav');}catch(_0x3bde84){logger[_0x5fc7('0x2a')](_0x3bde84);}return _0x290ee9;}else{return this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util[_0x5fc7('0x54')](_0x5fc7('0xfc'),_0x35a9f4[_0x5fc7('0xe6')]));}}return this[_0x5fc7('0xd')][_0x5fc7('0x2a')](_0x198c45,_0x5fc7('0xfd'));};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0xfe')]=function(_0x47b393){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0xff'),_0x47b393[_0x5fc7('0x35')]));return this[_0x5fc7('0xd')][_0x5fc7('0xa6')](_0x5fc7('0xfe'));};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x100')]=function(_0x3da557){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x101'),_0x3da557[_0x5fc7('0x35')]));var _0x348b0f='';if(_0x3da557[_0x5fc7('0x102')]){if(!this[_0x5fc7('0x82')](_0x3da557[_0x5fc7('0x102')])){return this[_0x5fc7('0xd')][_0x5fc7('0x2a')](_0x3da557,_0x5fc7('0x103'));}else{var _0x3795bf=parseInt(_0x3da557[_0x5fc7('0x102')],0xa);if(isNaN(_0x3795bf)){_0x348b0f=_0x3da557['trunk_id'];}else{_0x348b0f=this[_0x5fc7('0x1c')][_0x5fc7('0xa3')](this,_0x3da557[_0x5fc7('0x102')]);if(!_0x348b0f){return this['channel']['error'](_0x3da557,'no\x20trunk\x20found');}}}}else if(_0x3da557['trunk_name']){_0x348b0f=_0x3da557[_0x5fc7('0x104')];}else{return this[_0x5fc7('0xd')][_0x5fc7('0x2a')](_0x3da557,_0x5fc7('0x103'));}var _0x3f3335=this['channel'][_0x5fc7('0x57')]('DIAL',[util['format'](_0x5fc7('0x105'),_0x348b0f,_0x3da557['phone']),_0x3da557['timeout'],_0x3da557[_0x5fc7('0x106')],_0x3da557['url']]);if(_0x3f3335[_0x5fc7('0xa0')]===-0x1){return _0x3f3335;}return this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util[_0x5fc7('0x54')](_0x5fc7('0xe1'),_0x5fc7('0xdf')));};AGIVertices[_0x5fc7('0xf')]['finally']=function(_0x1bbe32){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x107'),_0x1bbe32['label']));return this['channel'][_0x5fc7('0xa6')]('finally');};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0xc')]=function(_0x311e3b){logger['info'](util[_0x5fc7('0x54')](_0x5fc7('0x108'),_0x311e3b[_0x5fc7('0x35')]));if(_0x311e3b[_0x5fc7('0x109')]===0x0){return this['maxRetry'](_0x311e3b);}_0x311e3b[_0x5fc7('0x109')]-=0x1;if(!this[_0x5fc7('0x82')](_0x311e3b[_0x5fc7('0x10a')])){return this[_0x5fc7('0xd')]['error'](_0x311e3b,'no\x20file\x20audio\x20selected');}var _0x2909f4=this[_0x5fc7('0x10b')][_0x5fc7('0xa3')](this,_0x311e3b[_0x5fc7('0x10a')]);if(!_0x2909f4){return this[_0x5fc7('0xd')][_0x5fc7('0x2a')](_0x311e3b,_0x5fc7('0x10c'));}if(!this[_0x5fc7('0x82')](_0x311e3b['variable_id'])){return this[_0x5fc7('0xd')][_0x5fc7('0x2a')](_0x5fc7('0xd6'));}var _0x420688=this['channel'][_0x5fc7('0x10d')](_0x2909f4,_0x311e3b[_0x5fc7('0x10e')],_0x311e3b[_0x5fc7('0x10f')]);var _0x476333=_0x420688[_0x5fc7('0xa0')]?_0x420688[_0x5fc7('0xa0')][_0x5fc7('0x4a')]():'';logger[_0x5fc7('0x2d')](_0x5fc7('0x110'),JSON[_0x5fc7('0x6f')](_0x420688));if(_0x420688[_0x5fc7('0xa0')]===-0x1){this[_0x5fc7('0x33')]['sync'](this,_0x311e3b,_0x476333);return _0x420688;}else if(_0x420688[_0x5fc7('0x9f')]===_0x5fc7('0x65')){_0x420688[_0x5fc7('0xa0')]=_0x476333[_0x5fc7('0x9a')]>=parseInt(_0x311e3b['mindigit'])?'x':'i';}else{_0x420688['result']=_0x476333[_0x5fc7('0x9a')]>=parseInt(_0x311e3b[_0x5fc7('0x111')])&&_0x476333['length']<=parseInt(_0x311e3b[_0x5fc7('0x10f')])?'x':'i';}var _0x1a0897=this[_0x5fc7('0x10')][_0x5fc7('0xa3')](this,_0x311e3b['variable_id']);if(!_0x1a0897){return this[_0x5fc7('0xd')]['error'](_0x311e3b,_0x5fc7('0xd7'));}this[_0x5fc7('0xd')]['setVariable'](_0x1a0897,_0x476333);if(this['isConfigured'](_0x311e3b['hiddendigitsnum'])){var _0x386a6b=parseInt(_0x311e3b[_0x5fc7('0x112')],0xa);var _0x162786=rs['generate']({'charset':'*','length':_0x386a6b});var _0x38d967=_0x476333['length'];if(_0x38d967>0x0){if(_0x38d967>_0x386a6b){this[_0x5fc7('0x33')][_0x5fc7('0xa3')](this,_0x311e3b,_0x311e3b['hiddendigitspos']==='first'?_0x162786+_0x476333['substr'](_0x386a6b):_0x476333['substr'](0x0,_0x38d967-_0x386a6b)+_0x162786);}else{this[_0x5fc7('0x33')][_0x5fc7('0xa3')](this,_0x311e3b,rs[_0x5fc7('0x113')]({'charset':'*','length':_0x38d967}));}}else{this[_0x5fc7('0x33')]['sync'](this,_0x311e3b,'');}}else{this['createSquareDetailsReport'][_0x5fc7('0xa3')](this,_0x311e3b,_0x476333);}return _0x420688;};AGIVertices[_0x5fc7('0xf')]['getsecretdigits']=function(_0x566406){logger['info'](util[_0x5fc7('0x54')](_0x5fc7('0x114'),_0x566406[_0x5fc7('0x35')]));return this['getdigits'](_0x566406);};AGIVertices['prototype'][_0x5fc7('0x115')]=function(_0x5cc71e){logger[_0x5fc7('0x2d')](util['format'](_0x5fc7('0x116'),_0x5cc71e['label']));this['createSquareDetailsReport'][_0x5fc7('0xa3')](this,_0x5cc71e,_0x5cc71e['goalname']);return this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util[_0x5fc7('0x54')]('GOAL\x20%s',_0x5cc71e['goalname']));};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x117')]=function(_0x36a8c2){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x118'),_0x36a8c2[_0x5fc7('0x35')]));if(!this[_0x5fc7('0x82')](_0x36a8c2['aws_access_key_id'])||!this[_0x5fc7('0x82')](_0x36a8c2[_0x5fc7('0x86')])){return this[_0x5fc7('0xd')][_0x5fc7('0xa6')](_0x5fc7('0x119'));}if(!this['isConfigured'](_0x36a8c2[_0x5fc7('0x5b')])){return this['channel'][_0x5fc7('0xa6')](_0x5fc7('0xc3'));}this[_0x5fc7('0xd')]['noop'](util['format']('Trying\x20aws\x20Polly\x20%s',_0x36a8c2['text']));var _0x5445d5=this[_0x5fc7('0x84')][_0x5fc7('0xa3')](this,_0x36a8c2);if(_0x5445d5){this['channel'][_0x5fc7('0xa6')](util[_0x5fc7('0x54')](_0x5fc7('0x11a'),_0x5445d5));var _0x340c79=this[_0x5fc7('0xd')][_0x5fc7('0xfb')](_0x5445d5);try{fs[_0x5fc7('0x11b')](_0x5445d5+'.wav');}catch(_0x27c242){logger['error'](_0x27c242);}return _0x340c79;}return this['channel'][_0x5fc7('0x2a')](_0x36a8c2,_0x5fc7('0x11c'));};AGIVertices['prototype'][_0x5fc7('0x11d')]=function(_0xebd67){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x11e'),_0xebd67[_0x5fc7('0x35')]));if(!this[_0x5fc7('0x82')](_0xebd67[_0x5fc7('0x85')])||!this[_0x5fc7('0x82')](_0xebd67['aws_secret_access_key'])){return this[_0x5fc7('0xd')][_0x5fc7('0xa6')](_0x5fc7('0x119'));}if(!this[_0x5fc7('0x82')](_0xebd67[_0x5fc7('0x8d')])){return this[_0x5fc7('0xd')][_0x5fc7('0xa6')](_0x5fc7('0x11f'));}if(!this[_0x5fc7('0x82')](_0xebd67[_0x5fc7('0x5b')])){return this[_0x5fc7('0xd')][_0x5fc7('0xa6')](_0x5fc7('0xc3'));}this[_0x5fc7('0xd')][_0x5fc7('0xe4')]=!![];this[_0x5fc7('0x33')](_0xebd67);this[_0x5fc7('0x3e')](_0xebd67[_0x5fc7('0x5b')],'in','','');this['channel'][_0x5fc7('0xa6')](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0xebd67[_0x5fc7('0x5b')]));var _0x36de58=this[_0x5fc7('0x8b')]['sync'](this,_0xebd67);if(_0x36de58){for(var _0x17c555 in _0x36de58){if(_0x36de58['hasOwnProperty'](_0x17c555)&&_['isString'](_0x36de58[_0x17c555])){this[_0x5fc7('0xd')][_0x5fc7('0xa1')](util['format'](_0x5fc7('0x120'),_0x17c555[_0x5fc7('0xe5')]()),_0x36de58[_0x17c555]);}}if(_[_0x5fc7('0x41')](_0x36de58[_0x5fc7('0x73')])){return this[_0x5fc7('0xd')][_0x5fc7('0xa6')](_0x5fc7('0x121'));}else{this[_0x5fc7('0x3e')](_0x36de58[_0x5fc7('0x73')],'out',_0x5fc7('0x122'),'');return this[_0x5fc7('0xd')]['noop'](util[_0x5fc7('0x54')]('Amazon\x20Lex\x20Result\x20%s',_0x36de58[_0x5fc7('0x73')]));}}return this['channel']['error'](_0xebd67,_0x5fc7('0x123'));};AGIVertices['prototype'][_0x5fc7('0x124')]=function(_0x157c03){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x125'),_0x157c03[_0x5fc7('0x35')],_0x157c03[_0x5fc7('0x65')]));if(!this[_0x5fc7('0x82')](_0x157c03[_0x5fc7('0x77')])){return this[_0x5fc7('0xd')]['noop'](_0x5fc7('0xe3'));}var _0x46b3f9=_0x5fc7('0x126');var _0xa458b=util[_0x5fc7('0x54')](_0x5fc7('0x127'),FILES_PATH,rs['generate'](0x4));var _0x218d2f=util[_0x5fc7('0x54')]('%s.%s',_0xa458b,_0x46b3f9);var _0x1361ec=!![];if(_0x157c03[_0x5fc7('0x128')]==='NOBEEP'){_0x1361ec=![];}var _0x2bca5e=this[_0x5fc7('0xd')][_0x5fc7('0x129')](_0xa458b,_0x46b3f9,_0x157c03[_0x5fc7('0x12a')],_0x157c03[_0x5fc7('0x65')],undefined,_0x1361ec);if(_0x2bca5e[_0x5fc7('0xa0')]!==-0x1){this[_0x5fc7('0xd')]['noop'](util[_0x5fc7('0x54')](_0x5fc7('0x12b'),_0x218d2f));var _0x402093=this['googleASR'][_0x5fc7('0xa3')](this,_0x157c03,_0x218d2f);if(_0x402093){for(var _0x5a1f60 in _0x402093){if(_0x402093[_0x5fc7('0x94')](_0x5a1f60)){this['channel'][_0x5fc7('0xa1')](util[_0x5fc7('0x54')](_0x5fc7('0x12c'),_0x5a1f60['toUpperCase']()),_0x402093[_0x5a1f60]);}}return this['channel']['noop'](util[_0x5fc7('0x54')](_0x5fc7('0x12d'),JSON[_0x5fc7('0x6f')](_0x402093)));}}return _0x2bca5e;};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x12e')]=function(_0x503bf5){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x12f'),_0x503bf5[_0x5fc7('0x35')]));if(!this['isConfigured'](_0x503bf5[_0x5fc7('0x91')])){return this[_0x5fc7('0xd')][_0x5fc7('0xa6')]('no\x20appid\x20configured');}if(!this[_0x5fc7('0x82')](_0x503bf5['appsecret'])){return this[_0x5fc7('0xd')][_0x5fc7('0xa6')]('no\x20appsecret\x20configured');}var _0x2af597=_0x5fc7('0x126');var _0xb55c27=util[_0x5fc7('0x54')](_0x5fc7('0x127'),FILES_PATH,rs['generate'](0x4));var _0x32e9f2=util['format'](_0x5fc7('0x9c'),_0xb55c27,_0x2af597);var _0x2f5418=!![];if(_0x503bf5[_0x5fc7('0x128')]===_0x5fc7('0x130')){_0x2f5418=![];}var _0x168194=this[_0x5fc7('0xd')][_0x5fc7('0x129')](_0xb55c27,_0x2af597,_0x503bf5[_0x5fc7('0x12a')],_0x503bf5[_0x5fc7('0x65')],undefined,_0x2f5418);if(_0x168194[_0x5fc7('0xa0')]!==-0x1){this['channel']['noop'](util['format'](_0x5fc7('0x131'),_0x32e9f2));var _0x217191=this[_0x5fc7('0x90')]['sync'](this,_0x503bf5,_0x32e9f2);if(_0x217191){for(var _0x40ca02 in _0x217191){if(_0x217191[_0x5fc7('0x94')](_0x40ca02)){this[_0x5fc7('0xd')]['setVariable'](util[_0x5fc7('0x54')](_0x5fc7('0x132'),_0x40ca02[_0x5fc7('0xe5')]()),_0x217191[_0x40ca02]);}}return this['channel'][_0x5fc7('0xa6')](util[_0x5fc7('0x54')]('TildeASR\x20Result\x20%s',JSON[_0x5fc7('0x6f')](_0x217191)));}}return _0x168194;};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x133')]=function(_0x1ca4a2){logger[_0x5fc7('0x2d')](util['format'](_0x5fc7('0x134'),_0x1ca4a2[_0x5fc7('0x35')]));return this['channel'][_0x5fc7('0x135')](_0x1ca4a2['context'],_0x1ca4a2[_0x5fc7('0x136')],_0x1ca4a2[_0x5fc7('0x3a')]);};AGIVertices[_0x5fc7('0xf')]['gotoif']=function(_0x467421){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x137'),_0x467421['label']));if(!this[_0x5fc7('0x82')](_0x467421['condition'])){return this[_0x5fc7('0xd')][_0x5fc7('0x2a')](_0x467421,_0x5fc7('0x138'));}try{var _0x3f9afa=eval(_0x467421[_0x5fc7('0x139')])?_0x5fc7('0x13a'):_0x5fc7('0x13b');this['channel'][_0x5fc7('0xa6')](util[_0x5fc7('0x54')](_0x5fc7('0x13c'),_0x467421['condition'],_0x3f9afa));return{'code':0xc8,'result':_0x3f9afa};}catch(_0x5c6d3c){return{'code':0xc8,'result':_0x5fc7('0x13b')};}};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x13d')]=function(_0x53204b){logger[_0x5fc7('0x2d')](util['format'](_0x5fc7('0x13e'),_0x53204b[_0x5fc7('0x35')]));if(!this[_0x5fc7('0x82')](_0x53204b[_0x5fc7('0x13f')])){return this[_0x5fc7('0xd')][_0x5fc7('0x2a')](_0x53204b,'no\x20interval\x20configured');}var _0x395dcc=this['getIntervals'][_0x5fc7('0xa3')](this,_0x53204b[_0x5fc7('0x13f')]);if(!_0x395dcc){return this[_0x5fc7('0xd')]['error'](_0x53204b,'no\x20intervals\x20found');}for(var _0x511729=0x0;_0x511729<_0x395dcc[_0x5fc7('0x9a')];_0x511729+=0x1){var _0x2fff60=this[_0x5fc7('0xd')]['getVariable'](util[_0x5fc7('0x54')](_0x5fc7('0x140'),_0x395dcc[_0x511729]));if(_0x2fff60[_0x5fc7('0xa0')]===-0x1){return _0x2fff60;}logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x141'),_0x395dcc[_0x511729],_0x2fff60['extra']));if(_0x2fff60['extra']===_0x5fc7('0x13a')){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x141'),_0x395dcc[_0x511729],_0x5fc7('0x13a')));this[_0x5fc7('0xd')]['noop'](util['format'](_0x5fc7('0x141'),_0x395dcc[_0x511729],_0x5fc7('0x13a')));return{'code':0xc8,'result':_0x5fc7('0x13a')};}else{logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x141'),_0x395dcc[_0x511729],'false'));this['channel']['noop'](util[_0x5fc7('0x54')](_0x5fc7('0x141'),_0x395dcc[_0x511729],_0x5fc7('0x13b')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x142')]=function(_0x3d5002){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x143'),_0x3d5002[_0x5fc7('0x35')]));return this['channel'][_0x5fc7('0x142')]();};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x144')]=function(_0x291f69){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x291f69[_0x5fc7('0x35')]));if(!this[_0x5fc7('0x82')](_0x291f69[_0x5fc7('0x77')])){return this['channel'][_0x5fc7('0xa6')](_0x5fc7('0xe3'));}var _0x1ee948=_0x5fc7('0x126');var _0x3b7561=util[_0x5fc7('0x54')]('%s/recordings/%s',FILES_PATH,rs[_0x5fc7('0x113')](0x4));var _0x1e729c=util[_0x5fc7('0x54')](_0x5fc7('0x9c'),_0x3b7561,_0x1ee948);var _0x56b34a=!![];if(_0x291f69[_0x5fc7('0x128')]===_0x5fc7('0x130')){_0x56b34a=![];}var _0x13bde1=this['channel'][_0x5fc7('0x129')](_0x3b7561,_0x1ee948,_0x291f69[_0x5fc7('0x12a')],_0x291f69[_0x5fc7('0x65')],undefined,_0x56b34a);if(_0x13bde1[_0x5fc7('0xa0')]!==-0x1){this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util[_0x5fc7('0x54')](_0x5fc7('0x145'),_0x1e729c));var _0x485e05=this[_0x5fc7('0x80')][_0x5fc7('0xa3')](this,_0x291f69,_0x1e729c);if(_0x485e05){for(var _0x411499 in _0x485e05){if(_0x485e05[_0x5fc7('0x94')](_0x411499)){this[_0x5fc7('0xd')][_0x5fc7('0xa1')](util[_0x5fc7('0x54')](_0x5fc7('0x146'),_0x411499['toUpperCase']()),_0x485e05[_0x411499]);}}return this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util[_0x5fc7('0x54')](_0x5fc7('0x147'),JSON['stringify'](_0x485e05)));}}return _0x13bde1;};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x148')]=function(_0xe822e5){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x149'),_0xe822e5[_0x5fc7('0x35')]));if(!this['isConfigured'](_0xe822e5['key'])){return this[_0x5fc7('0xd')][_0x5fc7('0xa6')]('no\x20key\x20configured');}if(!this[_0x5fc7('0x82')](_0xe822e5[_0x5fc7('0x5b')])){return this['channel'][_0x5fc7('0xa6')](_0x5fc7('0xc3'));}this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util[_0x5fc7('0x54')](_0x5fc7('0x14a'),_0xe822e5[_0x5fc7('0x5b')]));var _0x4d8812=this[_0x5fc7('0x7e')][_0x5fc7('0xa3')](this,_0xe822e5);if(_0x4d8812){this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util[_0x5fc7('0x54')](_0x5fc7('0x145'),_0x4d8812));var _0x3ce98f=this[_0x5fc7('0xd')][_0x5fc7('0xfb')](_0x4d8812,_0xe822e5[_0x5fc7('0x12a')]);try{fs['unlink'](_0x4d8812+'.wav');}catch(_0xf97703){logger[_0x5fc7('0x2a')](_0xf97703);}return _0x3ce98f;}return this['channel'][_0x5fc7('0x2a')](_0xe822e5,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x5fc7('0xf')]['login']=function(_0x2d6814){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x14b'),_0x2d6814[_0x5fc7('0x35')]));if(!this['isConfigured'](_0x2d6814[_0x5fc7('0x14c')])){return this[_0x5fc7('0xd')][_0x5fc7('0x2a')](_0x2d6814,'no\x20find\x20by\x20configured');}logger[_0x5fc7('0x2d')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x5fc7('0xd')]['callerid'],_0x2d6814[_0x5fc7('0x14c')]));var _0xcab051=this[_0x5fc7('0x52')][_0x5fc7('0xa3')](this,_0x2d6814[_0x5fc7('0x14c')]);if(_0xcab051){logger[_0x5fc7('0x2d')](util['format'](_0x5fc7('0x14d'),this[_0x5fc7('0xd')][_0x5fc7('0x4e')],_0x2d6814['findBy']));this[_0x5fc7('0xd')]['noop'](util[_0x5fc7('0x54')](_0x5fc7('0x14d'),this[_0x5fc7('0xd')][_0x5fc7('0x4e')],_0x2d6814[_0x5fc7('0x14c')]));return{'code':0xc8,'result':_0x5fc7('0x14e')};}else{logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x5fc7('0xd')][_0x5fc7('0x4e')],_0x2d6814[_0x5fc7('0x14c')]));this['channel'][_0x5fc7('0xa6')](util['format'](_0x5fc7('0x14f'),this[_0x5fc7('0xd')][_0x5fc7('0x4e')],_0x2d6814[_0x5fc7('0x14c')]));return{'code':0xc8,'result':_0x5fc7('0x150')};}};AGIVertices['prototype']['logout']=function(_0x222050){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x151'),_0x222050[_0x5fc7('0x35')]));if(!this[_0x5fc7('0x82')](_0x222050[_0x5fc7('0x14c')])){return this[_0x5fc7('0xd')][_0x5fc7('0x2a')](_0x222050,_0x5fc7('0x152'));}logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x5fc7('0xd')][_0x5fc7('0x4e')],_0x222050[_0x5fc7('0x14c')]));var _0x2f485f=this['agentLogout'][_0x5fc7('0xa3')](this,_0x222050[_0x5fc7('0x14c')]);if(_0x2f485f){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x14d'),this['channel'][_0x5fc7('0x4e')],_0x222050[_0x5fc7('0x14c')]));this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util[_0x5fc7('0x54')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x5fc7('0xd')][_0x5fc7('0x4e')],_0x222050['findBy']));return{'code':0xc8,'result':_0x5fc7('0x14e')};}else{logger['info'](util[_0x5fc7('0x54')](_0x5fc7('0x14f'),this[_0x5fc7('0xd')][_0x5fc7('0x4e')],_0x222050[_0x5fc7('0x14c')]));this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util[_0x5fc7('0x54')](_0x5fc7('0x14f'),this[_0x5fc7('0xd')][_0x5fc7('0x4e')],_0x222050[_0x5fc7('0x14c')]));return{'code':0xc8,'result':_0x5fc7('0x150')};}};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x153')]=function(_0x1f659f){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x154'),_0x1f659f[_0x5fc7('0x35')]));if(!this[_0x5fc7('0x82')](_0x1f659f['operation'])){return this[_0x5fc7('0xd')][_0x5fc7('0x2a')](_0x1f659f,_0x5fc7('0x155'));}this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util['format'](_0x5fc7('0x156'),_0x1f659f[_0x5fc7('0x157')]));var _0x37534d=eval(_0x1f659f[_0x5fc7('0x157')]);if(!this['isConfigured'](_0x1f659f[_0x5fc7('0xd5')])){return this[_0x5fc7('0xd')][_0x5fc7('0xa6')](_0x5fc7('0xd6'));}var _0x463bc0=this[_0x5fc7('0x10')]['sync'](this,_0x1f659f[_0x5fc7('0xd5')]);if(!_0x463bc0){return this[_0x5fc7('0xd')]['error'](_0x1f659f,_0x5fc7('0xd7'));}if(_[_0x5fc7('0x99')](_0x37534d)){var _0x6dbe6=this;_0x37534d[_0x5fc7('0xd8')](function(_0xa53c1d,_0x4fffd9){_0x6dbe6[_0x5fc7('0xd')][_0x5fc7('0xa1')](util[_0x5fc7('0x54')]('%s[%s]',_0x463bc0,_0x4fffd9),_0xa53c1d);});return this[_0x5fc7('0xd')]['noop'](util[_0x5fc7('0x54')](_0x5fc7('0x158'),_0x463bc0));}else{return this['channel'][_0x5fc7('0xa1')](_0x463bc0,_0x37534d);}};AGIVertices['prototype']['menu']=function(_0x5e3845){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x159'),_0x5e3845[_0x5fc7('0x35')]));if(_0x5e3845[_0x5fc7('0x109')]===0x0){return this['maxRetry'](_0x5e3845);}_0x5e3845[_0x5fc7('0x109')]-=0x1;if(!this[_0x5fc7('0x82')](_0x5e3845[_0x5fc7('0x10a')])){return this[_0x5fc7('0xd')][_0x5fc7('0x2a')](_0x5e3845,_0x5fc7('0x15a'));}var _0x1fa97d=this[_0x5fc7('0x10b')][_0x5fc7('0xa3')](this,_0x5e3845[_0x5fc7('0x10a')]);if(!_0x1fa97d){return this[_0x5fc7('0xd')][_0x5fc7('0x2a')](_0x5e3845,_0x5fc7('0x10c'));}var _0x245754=this[_0x5fc7('0xd')]['getData'](_0x1fa97d,_0x5e3845[_0x5fc7('0x10e')],_0x5e3845[_0x5fc7('0x15b')]);var _0xfee94b=_0x245754[_0x5fc7('0xa0')];if(_0x245754['result']===-0x1){this['createSquareDetailsReport']['sync'](this,_0x5e3845,'-1');return _0x245754;}else if(_0x245754['extra']===_0x5fc7('0x65')){_0x245754[_0x5fc7('0xa0')]=_0x245754[_0x5fc7('0xa0')][_0x5fc7('0x9a')]>0x0?_0x245754[_0x5fc7('0xa0')]:'t';}else if(_[_0x5fc7('0x40')](_0x245754[_0x5fc7('0xa0')])){_0x245754[_0x5fc7('0xa0')]='#';_0xfee94b='#';}if(!this['isConfigured'](_0x5e3845[_0x5fc7('0xd5')])){this[_0x5fc7('0xd')][_0x5fc7('0xa6')](_0x5fc7('0xd6'));}else{var _0x39d06b=this['getVariable']['sync'](this,_0x5e3845[_0x5fc7('0xd5')]);if(!_0x39d06b){return this['channel']['error'](_0x5e3845,'no\x20variable\x20found');}this[_0x5fc7('0xd')]['setVariable'](_0x39d06b,_0xfee94b);}this['createSquareDetailsReport'][_0x5fc7('0xa3')](this,_0x5e3845,_0xfee94b);return _0x245754;};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0xa6')]=function(_0x261396){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x15c'),_0x261396[_0x5fc7('0x35')]));return this[_0x5fc7('0xd')][_0x5fc7('0xa6')](_0x261396[_0x5fc7('0x15d')]||_0x261396[_0x5fc7('0x35')]);};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x15e')]=function(_0x40653e){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x15f'),_0x40653e[_0x5fc7('0x35')]));if(!this['isConfigured'](_0x40653e[_0x5fc7('0x14c')])){return this[_0x5fc7('0xd')][_0x5fc7('0x2a')](_0x40653e,'no\x20find\x20by\x20configured');}logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x160'),this[_0x5fc7('0xd')][_0x5fc7('0x4e')],_0x40653e[_0x5fc7('0x14c')]));var _0x5bd732=this[_0x5fc7('0x161')][_0x5fc7('0xa3')](this,_0x40653e[_0x5fc7('0x162')]);var _0x3e1326=this['agentPause']['sync'](this,_0x40653e['findBy'],_0x5bd732);if(_0x3e1326){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x14d'),this[_0x5fc7('0xd')][_0x5fc7('0x4e')],_0x40653e[_0x5fc7('0x14c')]));this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util[_0x5fc7('0x54')](_0x5fc7('0x14d'),this['channel'][_0x5fc7('0x4e')],_0x40653e[_0x5fc7('0x14c')]));return{'code':0xc8,'result':'success'};}else{logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x14f'),this[_0x5fc7('0xd')][_0x5fc7('0x4e')],_0x40653e['findBy']));this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util[_0x5fc7('0x54')](_0x5fc7('0x14d'),this['channel'][_0x5fc7('0x4e')],_0x40653e[_0x5fc7('0x14c')]));return{'code':0xc8,'result':_0x5fc7('0x150')};}};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x163')]=function(_0x393c6f){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x164'),_0x393c6f['label']));if(!this['isConfigured'](_0x393c6f['file_id'])){return this['channel'][_0x5fc7('0x2a')](_0x393c6f,_0x5fc7('0x15a'));}var _0x2bcfae=this[_0x5fc7('0x10b')]['sync'](this,_0x393c6f['file_id']);if(!_0x2bcfae){return this['channel'][_0x5fc7('0x2a')](_0x393c6f,'no\x20file\x20audio\x20found');}var _0xbfa0f4=this[_0x5fc7('0xd')]['exec'](_0x5fc7('0x165'),[_0x2bcfae,_0x393c6f[_0x5fc7('0x106')]]);if(_0xbfa0f4[_0x5fc7('0xa0')]===-0x1){return _0xbfa0f4;}return this[_0x5fc7('0xd')]['noop'](util[_0x5fc7('0x54')]('Executed\x20command\x20%s\x20%s',_0x5fc7('0x165'),_0x2bcfae));};AGIVertices[_0x5fc7('0xf')]['queue']=function(_0x4fa651){logger['info'](util[_0x5fc7('0x54')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x4fa651[_0x5fc7('0x35')]));if(!this['isConfigured'](_0x4fa651[_0x5fc7('0x166')])){return this[_0x5fc7('0xd')][_0x5fc7('0x2a')](_0x4fa651,_0x5fc7('0x167'));}var _0x5dfee5='';var _0x3cc01c=parseInt(_0x4fa651['queue_id'],0xa);if(isNaN(_0x3cc01c)){_0x5dfee5=_0x4fa651['queue_id'];}else{_0x5dfee5=this[_0x5fc7('0x168')][_0x5fc7('0xa3')](this,_0x4fa651[_0x5fc7('0x166')]);if(!_0x5dfee5){return this[_0x5fc7('0xd')]['error'](_0x4fa651,_0x5fc7('0x169'));}}var _0x3e5969='';if(this[_0x5fc7('0x82')](_0x4fa651['file_id'])){var _0x2b8e75=this[_0x5fc7('0x10b')][_0x5fc7('0xa3')](this,_0x4fa651[_0x5fc7('0x10a')]);if(_0x2b8e75){_0x3e5969=_0x2b8e75;}}this[_0x5fc7('0x33')][_0x5fc7('0xa3')](this,_0x4fa651,_0x5dfee5);if(_0x4fa651[_0x5fc7('0x106')][_0x5fc7('0x16a')]('x')<0x0){_0x4fa651[_0x5fc7('0x106')]+='x';}if(_0x4fa651['opts'][_0x5fc7('0x16a')]('X')<0x0){_0x4fa651[_0x5fc7('0x106')]+='X';}this['channel'][_0x5fc7('0xa1')](_0x5fc7('0x16b'),_0x5dfee5?_0x5dfee5[_0x5fc7('0x16c')]():'');var _0x2d5aa7=this[_0x5fc7('0xd')]['exec'](_0x5fc7('0x16d'),[_0x5dfee5,_0x4fa651['opts'],_0x4fa651[_0x5fc7('0x62')],_0x3e5969,_0x4fa651[_0x5fc7('0x65')],_0x4fa651[_0x5fc7('0x6')],_0x4fa651[_0x5fc7('0x16e')],_0x4fa651[_0x5fc7('0x16f')],'',_0x4fa651[_0x5fc7('0x170')]]);if(_0x2d5aa7['result']===-0x1){return _0x2d5aa7;}return this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util[_0x5fc7('0x54')](_0x5fc7('0xc0'),'QUEUE',_0x5dfee5));};AGIVertices[_0x5fc7('0xf')]['record']=function(_0x3dbb05){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x171'),_0x3dbb05[_0x5fc7('0x35')]));var _0x103850=_0x3dbb05[_0x5fc7('0x172')]||_0x5fc7('0x126');var _0x5d00a3=util[_0x5fc7('0x54')]('%s_%s',this[_0x5fc7('0xd')][_0x5fc7('0x34')],rs[_0x5fc7('0x113')](0x5));var _0x1f3c90=util[_0x5fc7('0x54')]('%s/recordings/%s.%s',FILES_PATH,_0x5d00a3,_0x103850);var _0x48b6ba=util['format']('%s/recordings/%s',FILES_PATH,_0x5d00a3);this[_0x5fc7('0x37')][_0x5fc7('0xa3')](this,_0x3dbb05,_0x5d00a3,_0x1f3c90);this[_0x5fc7('0xd')]['setVariable'](_0x5fc7('0x173'),_0x5d00a3);logger['info'](_0x5fc7('0x174'),_0x48b6ba,_0x103850,_0x3dbb05['escape_digits'],_0x3dbb05[_0x5fc7('0x65')]);return this['channel'][_0x5fc7('0x129')](_0x48b6ba,_0x103850,_0x3dbb05[_0x5fc7('0x175')],_0x3dbb05[_0x5fc7('0x65')],undefined,!![]);};AGIVertices[_0x5fc7('0xf')]['restapi']=function(_0x3785ad){logger['info'](util[_0x5fc7('0x54')](_0x5fc7('0x176'),_0x3785ad[_0x5fc7('0x35')]));if(!this[_0x5fc7('0x82')](_0x3785ad[_0x5fc7('0x62')])){return this[_0x5fc7('0xd')]['noop'](_0x5fc7('0x177'));}var _0x8e26d5=this[_0x5fc7('0x178')][_0x5fc7('0xa3')](this,_0x3785ad);logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x179'),util[_0x5fc7('0x17a')](_0x8e26d5,{'showHidden':![],'depth':null})));if(!this[_0x5fc7('0x82')](_0x3785ad['variable_id'])){return this[_0x5fc7('0xd')][_0x5fc7('0xa6')](_0x5fc7('0x17b'));}var _0x3d025f=this['getVariable']['sync'](this,_0x3785ad[_0x5fc7('0xd5')]);if(!_0x3d025f){return this[_0x5fc7('0xd')]['error'](_0x3785ad,'no\x20variable\x20found');}this['channel'][_0x5fc7('0xa1')](util['format'](_0x5fc7('0x17c'),_0x3d025f),_0x8e26d5[_0x5fc7('0x71')]?_0x8e26d5[_0x5fc7('0x71')]:_0x5fc7('0x17d'));this[_0x5fc7('0xd')][_0x5fc7('0xa1')](util[_0x5fc7('0x54')](_0x5fc7('0x17e'),_0x3d025f),_0x8e26d5['statusMessage']?_0x8e26d5[_0x5fc7('0x72')]:'OK');if(_0x8e26d5[_0x5fc7('0x67')]){try{this[_0x5fc7('0x9b')](_0x8e26d5[_0x5fc7('0x67')],_0x3d025f);}catch(_0x2a8309){logger['error'](util['format'](_0x5fc7('0x17f'),_0x3d025f));}}return this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util['format'](_0x5fc7('0x180'),_0x3d025f));};AGIVertices['prototype'][_0x5fc7('0x181')]=function(_0x35b5b5){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x35b5b5[_0x5fc7('0x35')]));return this['channel'][_0x5fc7('0x182')](_0x35b5b5[_0x5fc7('0x183')][_0x5fc7('0xd3')](/\s+/g,''),_0x35b5b5[_0x5fc7('0x175')]);};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x184')]=function(_0x3820a0){logger['info'](util[_0x5fc7('0x54')](_0x5fc7('0x185'),_0x3820a0[_0x5fc7('0x35')]));return this[_0x5fc7('0xd')][_0x5fc7('0x186')](_0x3820a0[_0x5fc7('0x64')][_0x5fc7('0xd3')](/\s+/g,''),_0x3820a0[_0x5fc7('0x175')]);};AGIVertices[_0x5fc7('0xf')]['sayphonetic']=function(_0x4716b1){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x187'),_0x4716b1[_0x5fc7('0x35')]));return this[_0x5fc7('0xd')]['sayPhonetic'](_0x4716b1[_0x5fc7('0x5b')],_0x4716b1[_0x5fc7('0x175')]);};AGIVertices[_0x5fc7('0xf')]['sendMail']=function(_0x2c4908){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x188'),_0x2c4908[_0x5fc7('0x35')]));if(!this['isConfigured'](_0x2c4908[_0x5fc7('0x189')])){return this['channel'][_0x5fc7('0xa6')](_0x5fc7('0x18a'));}var _0x372007=this[_0x5fc7('0x21')][_0x5fc7('0xa3')](this,_0x2c4908[_0x5fc7('0x189')]);if(!_0x372007||!_0x372007['Smtp']){return this['channel'][_0x5fc7('0x2a')](_0x2c4908,_0x5fc7('0x18b'));}var _0x37751a={'from':util[_0x5fc7('0x54')](_0x5fc7('0x18c'),_0x372007[_0x5fc7('0x13')],_0x372007[_0x5fc7('0x18d')]||_0x372007[_0x5fc7('0x18e')][_0x5fc7('0x18f')]),'to':_0x2c4908['to']||'','cc':_0x2c4908['cc']||'','bcc':_0x2c4908[_0x5fc7('0x190')]||'','subject':_0x2c4908[_0x5fc7('0x191')],'html':_0x2c4908[_0x5fc7('0x5b')],'text':_0x2c4908[_0x5fc7('0x5b')]};if(this[_0x5fc7('0x82')](_0x2c4908[_0x5fc7('0x192')])){}logger[_0x5fc7('0x193')](_0x5fc7('0x194'),JSON[_0x5fc7('0x6f')](_0x37751a));this[_0x5fc7('0x33')][_0x5fc7('0xa3')](this,_0x2c4908,_0x2c4908['account_id']);this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util['format'](_0x5fc7('0x195'),_0x372007[_0x5fc7('0x13')]));this[_0x5fc7('0x23')]['sync'](this,_0x372007[_0x5fc7('0x196')],_0x37751a);return this[_0x5fc7('0xd')]['noop'](_0x5fc7('0x197'));};AGIVertices['prototype'][_0x5fc7('0x198')]=function(_0x26cffd){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x199'),_0x26cffd[_0x5fc7('0x35')]));return this[_0x5fc7('0xd')]['noop'](_0x5fc7('0x19a'));};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x19b')]=function(_0x7334e6){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x19c'),_0x7334e6['label']));if(!this['isConfigured'](_0x7334e6[_0x5fc7('0x19d')])){return this[_0x5fc7('0xd')]['noop'](_0x5fc7('0x19e'));}var _0x132b2b=this[_0x5fc7('0x30')][_0x5fc7('0xa3')](this,_0x7334e6[_0x5fc7('0x19d')]);if(!_0x132b2b){return this[_0x5fc7('0xd')]['error'](_0x7334e6,_0x5fc7('0x19f'));}var _0x3c77e1={'body':_0x7334e6['sms_text'],'phone':_0x7334e6['to']||'','SmsAccountId':_0x132b2b['id']};logger[_0x5fc7('0x193')](_0x5fc7('0x1a0'),JSON['stringify'](_0x3c77e1));this[_0x5fc7('0x33')][_0x5fc7('0xa3')](this,_0x7334e6,_0x7334e6[_0x5fc7('0x19d')]);this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util['format'](_0x5fc7('0x1a1'),_0x132b2b[_0x5fc7('0x13')]));this[_0x5fc7('0x32')][_0x5fc7('0xa3')](this,_0x3c77e1);return this['channel']['noop'](_0x5fc7('0x1a2'));};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x1a3')]=function(_0xf5bbfc){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x1a4'),_0xf5bbfc[_0x5fc7('0x35')]));if(!this[_0x5fc7('0x82')](_0xf5bbfc[_0x5fc7('0xd5')])){return this[_0x5fc7('0xd')][_0x5fc7('0x2a')](_0xf5bbfc,_0x5fc7('0x1a5'));}var _0x214096=this['getVariable']['sync'](this,_0xf5bbfc[_0x5fc7('0xd5')]);if(!_0x214096){return this[_0x5fc7('0xd')][_0x5fc7('0x2a')](_0xf5bbfc,_0x5fc7('0xd7'));}return this[_0x5fc7('0xd')]['setVariable'](_0x214096,_0xf5bbfc[_0x5fc7('0x1a6')]);};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x1a7')]=function(_0x37f789){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')]('Enter\x20in\x20START\x20(%s)\x20block',_0x37f789[_0x5fc7('0x35')]));this[_0x5fc7('0xd')][_0x5fc7('0xa6')](_0x5fc7('0x1a8'));if(_0x37f789[_0x5fc7('0xb3')]==='yes'){this[_0x5fc7('0xd')][_0x5fc7('0xa6')](_0x5fc7('0x1a9'));return this[_0x5fc7('0xd')][_0x5fc7('0xb3')]();}return this['channel']['noop'](_0x5fc7('0x1aa'));};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x1ab')]=function(_0x4adda9){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x1ac'),_0x4adda9['label']));if(!this['isConfigured'](_0x4adda9[_0x5fc7('0x1ad')])){return this[_0x5fc7('0xd')][_0x5fc7('0x2a')](_0x4adda9,_0x5fc7('0x1ae'));}var _0x264a6a=this[_0x5fc7('0x17')]['sync'](this,_0x4adda9[_0x5fc7('0x1ad')]);if(!this[_0x5fc7('0x82')](_0x264a6a)){return this[_0x5fc7('0xd')][_0x5fc7('0x2a')](_0x4adda9,util[_0x5fc7('0x54')](_0x5fc7('0x1af'),_0x4adda9[_0x5fc7('0x1ad')]));}if(_0x264a6a===this[_0x5fc7('0xd')][_0x5fc7('0x3d')]){return this[_0x5fc7('0xd')][_0x5fc7('0x2a')](_0x4adda9,_0x5fc7('0x1b0'));}this[_0x5fc7('0x33')][_0x5fc7('0xa3')](this,_0x4adda9,_0x264a6a);var _0x27392a=this[_0x5fc7('0xd')][_0x5fc7('0x57')](_0x5fc7('0x1b1'),util['format'](_0x5fc7('0x1b2'),config[_0x5fc7('0x6')][_0x5fc7('0x1b3')]||_0x5fc7('0x1b4'),_0x264a6a,this[_0x5fc7('0xd')][_0x5fc7('0x3d')]));if(_0x27392a[_0x5fc7('0xa0')]===-0x1){return _0x27392a;}return this['channel']['noop'](util[_0x5fc7('0x54')]('Executed\x20command\x20%s\x20%s','AGI',_0x264a6a));};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x1b5')]=function(_0x5beacd){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x1b6'),_0x5beacd[_0x5fc7('0x35')]));var _0x139147=this['shellCommand']['sync'](this,_0x5beacd[_0x5fc7('0x1b7')]);this[_0x5fc7('0x33')][_0x5fc7('0xa3')](this,_0x5beacd,_0x5beacd[_0x5fc7('0x1b7')]);if(this[_0x5fc7('0x82')](_0x5beacd[_0x5fc7('0xd5')])){var _0x2ffaae=this['getVariable'][_0x5fc7('0xa3')](this,_0x5beacd[_0x5fc7('0xd5')]);if(_0x2ffaae){this['channel'][_0x5fc7('0xa1')](_0x2ffaae,_0x139147);return this['channel'][_0x5fc7('0xa6')](util[_0x5fc7('0x54')](_0x5fc7('0x1b8'),_0x5beacd[_0x5fc7('0x1b7')],_0x2ffaae));}}return this[_0x5fc7('0xd')]['noop'](util[_0x5fc7('0x54')](_0x5fc7('0x1b9'),_0x5beacd[_0x5fc7('0x1b7')]));};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x1ba')]=function(_0x495906){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x1bb'),_0x495906[_0x5fc7('0x35')]));_0x495906[_0x5fc7('0x5b')]=_0x495906[_0x5fc7('0x5b')][_0x5fc7('0xd3')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x5fc7('0x82')](_0x495906[_0x5fc7('0x59')])){return this['channel'][_0x5fc7('0xa6')](_0x5fc7('0x1bc'));}if(!this[_0x5fc7('0x82')](_0x495906[_0x5fc7('0x5b')])){return this[_0x5fc7('0xd')][_0x5fc7('0xa6')](_0x5fc7('0xc3'));}this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util['format'](_0x5fc7('0x1bd'),_0x495906[_0x5fc7('0x5b')]));var _0x4848fe=this[_0x5fc7('0x58')][_0x5fc7('0xa3')](this,_0x495906);if(_0x4848fe){this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util[_0x5fc7('0x54')](_0x5fc7('0x1be'),_0x4848fe));var _0x28c456=this['channel']['streamFile'](_0x4848fe);try{fs[_0x5fc7('0x11b')](_0x4848fe+_0x5fc7('0x1bf'));}catch(_0x1c6241){logger[_0x5fc7('0x2a')](_0x1c6241);}return _0x28c456;}return this[_0x5fc7('0xd')][_0x5fc7('0x2a')](_0x495906,_0x5fc7('0x1c0'));};AGIVertices[_0x5fc7('0xf')]['tts']=function(_0x1b074a){logger['info'](util[_0x5fc7('0x54')](_0x5fc7('0x1c1'),_0x1b074a[_0x5fc7('0x35')]));_0x1b074a['text']=_0x1b074a[_0x5fc7('0x5b')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x5fc7('0x82')](_0x1b074a[_0x5fc7('0x5b')])){return this['channel'][_0x5fc7('0xa6')](_0x5fc7('0xc3'));}this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util['format'](_0x5fc7('0x1c2'),_0x1b074a[_0x5fc7('0x5b')]));var _0x4f6d91=this[_0x5fc7('0x60')][_0x5fc7('0xa3')](this,_0x1b074a);if(_0x4f6d91){this[_0x5fc7('0xd')]['noop'](util[_0x5fc7('0x54')](_0x5fc7('0x1c3'),_0x4f6d91));var _0x1a6013=this[_0x5fc7('0xd')][_0x5fc7('0xfb')](_0x4f6d91);try{fs[_0x5fc7('0x11b')](_0x4f6d91+'.wav');}catch(_0x42927f){logger[_0x5fc7('0x2a')](_0x42927f);}return _0x1a6013;}return this[_0x5fc7('0xd')]['error'](_0x1b074a,_0x5fc7('0x1c4'));};AGIVertices['prototype']['unpause']=function(_0x3ea6ca){logger[_0x5fc7('0x2d')](util['format'](_0x5fc7('0x1c5'),_0x3ea6ca[_0x5fc7('0x35')]));if(!this['isConfigured'](_0x3ea6ca[_0x5fc7('0x14c')])){return this[_0x5fc7('0xd')]['error'](_0x3ea6ca,_0x5fc7('0x152'));}logger['info'](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x5fc7('0xd')][_0x5fc7('0x4e')],_0x3ea6ca[_0x5fc7('0x14c')]));var _0x15e31b=this[_0x5fc7('0x4f')][_0x5fc7('0xa3')](this,_0x3ea6ca[_0x5fc7('0x14c')]);if(_0x15e31b){logger[_0x5fc7('0x2d')](util['format'](_0x5fc7('0x14d'),this[_0x5fc7('0xd')][_0x5fc7('0x4e')],_0x3ea6ca[_0x5fc7('0x14c')]));this[_0x5fc7('0xd')][_0x5fc7('0xa6')](util[_0x5fc7('0x54')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x5fc7('0xd')][_0x5fc7('0x4e')],_0x3ea6ca[_0x5fc7('0x14c')]));return{'code':0xc8,'result':'success'};}else{logger[_0x5fc7('0x2d')](util['format'](_0x5fc7('0x14f'),this[_0x5fc7('0xd')][_0x5fc7('0x4e')],_0x3ea6ca[_0x5fc7('0x14c')]));this['channel'][_0x5fc7('0xa6')](util[_0x5fc7('0x54')](_0x5fc7('0x14f'),this[_0x5fc7('0xd')]['callerid'],_0x3ea6ca[_0x5fc7('0x14c')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x5fc7('0xf')][_0x5fc7('0x1c6')]=function(_0x126171){logger['info'](util[_0x5fc7('0x54')](_0x5fc7('0x1c7'),_0x126171[_0x5fc7('0x35')]));var _0x2b06a6=this[_0x5fc7('0xd')][_0x5fc7('0x57')](_0x5fc7('0x1c8'),[_0x126171[_0x5fc7('0x1c9')],_0x126171[_0x5fc7('0x75')]]);if(_0x2b06a6['result']===-0x1){return _0x2b06a6;}return this['channel'][_0x5fc7('0xa6')](util[_0x5fc7('0x54')](_0x5fc7('0xc0'),_0x5fc7('0x1c8'),_0x126171[_0x5fc7('0x1c9')]));};AGIVertices['prototype']['vswitch']=function(_0x116758){logger[_0x5fc7('0x2d')](util[_0x5fc7('0x54')](_0x5fc7('0x1ca'),_0x116758['label']));if(!this[_0x5fc7('0x82')](_0x116758[_0x5fc7('0xd5')])){return this[_0x5fc7('0xd')][_0x5fc7('0x2a')](_0x116758,_0x5fc7('0x1a5'));}var _0x507e6d=this['getVariable'][_0x5fc7('0xa3')](this,_0x116758[_0x5fc7('0xd5')]);if(!_0x507e6d){return this['channel']['error'](_0x116758,_0x5fc7('0xd7'));}var _0x315f51=this[_0x5fc7('0xd')][_0x5fc7('0x10')](_0x507e6d);return{'code':0xc8,'result':_0x315f51['extra']?_0x315f51[_0x5fc7('0x9f')]:'-'};};String[_0x5fc7('0xf')][_0x5fc7('0x1cb')]=function(_0x40ada0,_0x5ab1e2){return this[_0x5fc7('0x9e')](_0x40ada0)[_0x5fc7('0x1cc')](_0x5ab1e2);};module[_0x5fc7('0x1cd')]=AGIVertices; \ No newline at end of file +var _0x557d=['Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','opts','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','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','streamFile','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','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','restAPI','Response:','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','template_id','debug','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20no\x20stored','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','replaceAll','join','exports','util','lodash','shelljs','odbc','mustache','request-promise','../../config/environment/shared','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','dsn','getUser','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','label','arg_1','callerid','createSquareRecording','uniqueid','calleridname','context','extension','priority','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','phone','list_id','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','url','method','number','timeout','includes','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','sync','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','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','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','clear','clone','isString','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','length','%s.%s','replaceObjectAllVariables','split','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','createSquareDetailsReport','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INSTANCE()','Enter\x20in\x20AGI\x20(%s)\x20block','agi','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','forEach','keys','setVariable','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda'];(function(_0xcb8cb1,_0x253cb1){var _0x3309a5=function(_0xcc79f){while(--_0xcc79f){_0xcb8cb1['push'](_0xcb8cb1['shift']());}};_0x3309a5(++_0x253cb1);}(_0x557d,0xcb));var _0xd557=function(_0x4ae48c,_0x5bfa54){_0x4ae48c=_0x4ae48c-0x0;var _0x39cdc2=_0x557d[_0x4ae48c];return _0x39cdc2;};'use strict';var fs=require('fs');var util=require(_0xd557('0x0'));var _=require(_0xd557('0x1'));var sh=require(_0xd557('0x2'));var odbc=require(_0xd557('0x3'))();var rs=require('randomstring');var moment=require('moment');var Mustache=require(_0xd557('0x4'));var rp=require(_0xd557('0x5'));var logger=require('../../config/logger')('agi');var config=require('../../config/environment');var shared=require(_0xd557('0x6'));var scripts=require('./scripts');var FILES_PATH=_0xd557('0x7');var recursiveMapAttributes=[_0xd557('0x8'),_0xd557('0x9')];var verticesWithRetry=['menu',_0xd557('0xa'),'getsecretdigits'];var AGIVertices=function(_0x1379a1,_0x550cab,_0x4c7cb8){this[_0xd557('0xb')]=_0x1379a1;this[_0xd557('0xc')]=_0x550cab;this[_0xd557('0xd')]=_0x4c7cb8;};AGIVertices[_0xd557('0xe')][_0xd557('0xf')]=function(_0x13ac24,_0x4a0522){this[_0xd557('0xc')][_0xd557('0x10')](_0x13ac24)[_0xd557('0x11')](function(_0x2fd036){_0x4a0522(null,_0x2fd036?_0x2fd036[_0xd557('0x12')]:![]);})[_0xd557('0x13')](function(_0x1cf73c){_0x4a0522(_0x1cf73c);});};AGIVertices[_0xd557('0xe')][_0xd557('0x14')]=function(_0x413e84,_0x48c933){this[_0xd557('0xc')][_0xd557('0x15')](_0x413e84)[_0xd557('0x11')](function(_0xc64671){_0x48c933(null,_0xc64671?_0xc64671[_0xd557('0x12')]:![]);})[_0xd557('0x13')](function(_0x208348){_0x48c933(_0x208348);});};AGIVertices[_0xd557('0xe')][_0xd557('0x16')]=function(_0x28d212,_0x38e628){this[_0xd557('0xc')][_0xd557('0x17')](_0x28d212)['then'](function(_0x3992be){_0x38e628(null,_0x3992be?_0x3992be[_0xd557('0x12')]:![]);})[_0xd557('0x13')](function(_0x233294){_0x38e628(_0x233294);});};AGIVertices[_0xd557('0xe')]['getSquareOdbc']=function(_0xf2ff6a,_0x4ecf3b){this[_0xd557('0xc')]['getSquareOdbcById'](_0xf2ff6a)['then'](function(_0x23ff28){_0x4ecf3b(null,_0x23ff28?_0x23ff28[_0xd557('0x18')]:![]);})[_0xd557('0x13')](function(_0x3421c2){_0x4ecf3b(_0x3421c2);});};AGIVertices['prototype'][_0xd557('0x19')]=function(_0x497454,_0x246790){this['rpc']['getUserById'](_0x497454)[_0xd557('0x11')](function(_0x48819d){_0x246790(null,_0x48819d?_0x48819d[_0xd557('0x12')]:![]);})[_0xd557('0x13')](function(_0x4aeeb1){_0x246790(_0x4aeeb1);});};AGIVertices[_0xd557('0xe')][_0xd557('0x1a')]=function(_0x549285,_0x4d7b36){this[_0xd557('0xc')][_0xd557('0x1b')](_0x549285)['then'](function(_0x44bd00){_0x4d7b36(null,_0x44bd00?_0x44bd00['name']:![]);})[_0xd557('0x13')](function(_0x462f39){_0x4d7b36(_0x462f39);});};AGIVertices[_0xd557('0xe')][_0xd557('0x1c')]=function(_0x4dfb80,_0x176088){var _0x577e46=this;this['rpc'][_0xd557('0x1d')](_0x4dfb80)[_0xd557('0x11')](function(_0x2bb78d){_0x176088(null,_0x2bb78d?_0x577e46[_0xd557('0x1e')](_0x2bb78d[_0xd557('0x1f')]):![]);})[_0xd557('0x13')](function(_0x14b17b){_0x176088(_0x14b17b);});};AGIVertices[_0xd557('0xe')]['getMailAccount']=function(_0x5b3be1,_0x4fddf0){this[_0xd557('0xc')]['getMailAccountById'](_0x5b3be1)[_0xd557('0x11')](function(_0x4fec06){_0x4fddf0(null,_0x4fec06?_0x4fec06:![]);})[_0xd557('0x13')](function(_0x1fc41a){_0x4fddf0(_0x1fc41a);});};AGIVertices[_0xd557('0xe')][_0xd557('0x20')]=function(_0x27ec83,_0x5c2165,_0x5e490e){this[_0xd557('0xd')][_0xd557('0x20')](_0x27ec83,_0x5c2165)['then'](function(){_0x5e490e(null);})[_0xd557('0x13')](function(_0x2d3542){_0x5e490e(_0x2d3542);});};AGIVertices[_0xd557('0xe')][_0xd557('0x21')]=function(_0x245664,_0x33dcb1){this[_0xd557('0xc')][_0xd557('0x22')](_0x245664)['then'](function(_0x54a72e){if(_0x54a72e){if(_0x54a72e[_0xd557('0x23')]){_0x33dcb1(null,[_0x54a72e[_0xd557('0x24')]]);}else{_0x33dcb1(null,_['map'](_0x54a72e[_0xd557('0x25')],_0xd557('0x24')));}}else{_0x33dcb1(null,![]);}})[_0xd557('0x13')](function(_0x2f7cde){_0x33dcb1(_0x2f7cde);});};AGIVertices[_0xd557('0xe')][_0xd557('0x1e')]=function(_0x6c94e9){return util[_0xd557('0x26')](_0xd557('0x27'),FILES_PATH,_0x6c94e9);};AGIVertices[_0xd557('0xe')][_0xd557('0x28')]=function(_0x4d5dfd,_0x1233ba,_0x3ce461){odbc[_0xd557('0x29')](_0x4d5dfd,function(_0x2c57d2){if(_0x2c57d2){logger['error'](_0xd557('0x2a'),_0x2c57d2);_0x3ce461(_0x2c57d2);}else{logger[_0xd557('0x2b')](_0xd557('0x2c'));odbc[_0xd557('0x2d')](_0x1233ba,function(_0xb3add6,_0x307023){if(_0xb3add6){logger[_0xd557('0x2b')](_0xd557('0x2e'),_0x1233ba);_0x3ce461(_0xb3add6);}else{logger[_0xd557('0x2b')](_0xd557('0x2f'),_0x1233ba);odbc['close'](function(_0x37ad05){if(_0x37ad05){logger[_0xd557('0x30')](_0xd557('0x31'),_0x37ad05);}_0x3ce461(null,_0x307023);});}});}});};AGIVertices[_0xd557('0xe')][_0xd557('0x32')]=function(_0x510158,_0x4ac59e){this[_0xd557('0xc')][_0xd557('0x33')](_0x510158)['then'](function(_0x539936){_0x4ac59e(null,_0x539936?_0x539936:![]);})[_0xd557('0x13')](function(_0x36c264){_0x4ac59e(_0x36c264);});};AGIVertices[_0xd557('0xe')][_0xd557('0x34')]=function(_0x5394d7,_0x1efc24){this[_0xd557('0xc')][_0xd557('0x34')](_0x5394d7)[_0xd557('0x11')](function(_0x4fcf12){_0x1efc24(null,_0x4fcf12);})['catch'](function(_0x375cd7){_0x1efc24(_0x375cd7);});};AGIVertices[_0xd557('0xe')]['createSquareDetailsReport']=function(_0x2c4506,_0x18560e,_0x19e0aa){this[_0xd557('0xc')]['createSquareDetailsReport']({'uniqueid':this['channel']['uniqueid'],'node':_0x2c4506[_0xd557('0x35')],'application':_0x2c4506['agicommand'],'data':_0x18560e||null,'project_name':this['channel'][_0xd557('0x36')],'callerid':this['channel'][_0xd557('0x37')]})[_0xd557('0x11')](function(_0xecc3b5){if(_0x19e0aa){_0x19e0aa(null,_0xecc3b5);}})[_0xd557('0x13')](function(_0x4b511a){if(_0x19e0aa){_0x19e0aa(_0x4b511a);}});};AGIVertices[_0xd557('0xe')][_0xd557('0x38')]=function(_0x1c5425,_0xcec449,_0x53d9d4,_0x5eb3d3){this[_0xd557('0xc')][_0xd557('0x38')]({'uniqueid':this[_0xd557('0xb')][_0xd557('0x39')],'callerid':this[_0xd557('0xb')]['callerid'],'calleridname':this[_0xd557('0xb')][_0xd557('0x3a')],'context':this[_0xd557('0xb')][_0xd557('0x3b')],'extension':this['channel'][_0xd557('0x3c')],'priority':this['channel'][_0xd557('0x3d')],'accountcode':this[_0xd557('0xb')]['accountcode'],'dnid':this[_0xd557('0xb')]['dnid'],'projectName':this[_0xd557('0xb')][_0xd557('0x36')],'saveName':_0xcec449,'filename':_0x1c5425[_0xd557('0x3e')]||_0xcec449,'savePath':_0x53d9d4})[_0xd557('0x11')](function(_0xefc8b3){_0x5eb3d3(null,_0xefc8b3);})[_0xd557('0x13')](function(_0x58da01){_0x5eb3d3(_0x58da01);});};AGIVertices[_0xd557('0xe')][_0xd557('0x3f')]=function(_0x3dd3ea,_0x46c467,_0x41ea55,_0x3baadb,_0x5d1bc2){this['rpc'][_0xd557('0x3f')]({'uniqueid':this[_0xd557('0xb')][_0xd557('0x39')],'body':_0x3dd3ea,'direction':_0x46c467,'providerName':_0x41ea55,'providerResponse':_0x3baadb})[_0xd557('0x11')](function(_0x5e8bac){if(_0x5d1bc2){_0x5d1bc2(null,_0x5e8bac);}})[_0xd557('0x13')](function(_0x4aceea){if(_0x5d1bc2){_0x5d1bc2(_0x4aceea);}});};AGIVertices[_0xd557('0xe')][_0xd557('0x40')]=function(_0x29ac27,_0x3dec80){this[_0xd557('0xc')][_0xd557('0x40')]({'firstName':_[_0xd557('0x41')](_0x29ac27[_0xd557('0x12')])||_[_0xd557('0x42')](_0x29ac27[_0xd557('0x12')])?_0xd557('0x43')+Math['random']():_0x29ac27[_0xd557('0x12')],'lastName':_[_0xd557('0x41')](_0x29ac27['lastName'])||_['isNil'](_0x29ac27[_0xd557('0x44')])?null:_0x29ac27[_0xd557('0x44')],'phone':_0x29ac27[_0xd557('0x45')],'ListId':_0x29ac27[_0xd557('0x46')],'scheduledat':_0x29ac27['scheduledAt'],'callbackUniqueid':this[_0xd557('0xb')][_0xd557('0x39')],'tags':'callback','description':_0xd557('0x47')+_0x29ac27[_0xd557('0x48')][_0xd557('0x49')](),'priority':_0x29ac27[_0xd557('0x4a')]})[_0xd557('0x11')](function(_0x538166){_0x3dec80(null,_0x538166);})[_0xd557('0x13')](function(_0x5575d1){_0x3dec80(_0x5575d1);});};AGIVertices['prototype']['getPause']=function(_0x279d77,_0x56397f){this[_0xd557('0xc')][_0xd557('0x4b')](_0x279d77)[_0xd557('0x11')](function(_0x2cd8d6){_0x56397f(null,_0x2cd8d6?_0x2cd8d6[_0xd557('0x12')]:![]);})[_0xd557('0x13')](function(_0x5b0790){_0x56397f(_0x5b0790);});};AGIVertices['prototype'][_0xd557('0x4c')]=function(_0x44d7b9,_0x41ca6a,_0x4e604a){var _0x3f7533={'role':_0xd557('0x4d')};_0x3f7533[_0x44d7b9]=this[_0xd557('0xb')][_0xd557('0x37')];this[_0xd557('0xc')][_0xd557('0x4c')](_0x3f7533,_0x41ca6a,this[_0xd557('0xb')][_0xd557('0x39')])['then'](function(_0x18d40c){_0x4e604a(null,_['isNil'](_0x18d40c)?![]:!![]);})[_0xd557('0x13')](function(_0x3ccee0){logger[_0xd557('0x30')](_0x3ccee0);_0x4e604a(null,![]);});};AGIVertices[_0xd557('0xe')]['agentUnpause']=function(_0x45958c,_0x432852){var _0x331d14={'role':'agent'};_0x331d14[_0x45958c]=this[_0xd557('0xb')]['callerid'];this['rpc'][_0xd557('0x4e')](_0x331d14)['then'](function(_0xb51d42){_0x432852(null,_['isNil'](_0xb51d42)?![]:!![]);})[_0xd557('0x13')](function(_0x36ebdb){logger['error'](_0x36ebdb);_0x432852(null,![]);});};AGIVertices[_0xd557('0xe')][_0xd557('0x4f')]=function(_0x28d0ea,_0x4b1ef6){var _0x1f9ad2={'role':'agent'};_0x1f9ad2[_0x28d0ea]=this[_0xd557('0xb')][_0xd557('0x37')];this[_0xd557('0xc')][_0xd557('0x4f')](_0x1f9ad2)[_0xd557('0x11')](function(_0x5b5a3b){_0x4b1ef6(null,_['isNil'](_0x5b5a3b)?![]:!![]);})[_0xd557('0x13')](function(_0xd1521){logger[_0xd557('0x30')](_0xd1521);_0x4b1ef6(null,![]);});};AGIVertices[_0xd557('0xe')][_0xd557('0x50')]=function(_0x58e05b,_0xfbaae6){var _0x4b3253={'role':'agent'};_0x4b3253[_0x58e05b]=this['channel'][_0xd557('0x37')];var _0x5d493a=_0x58e05b!=_0xd557('0x51')?util[_0xd557('0x26')](_0xd557('0x52'),'LOCAL',this[_0xd557('0xb')][_0xd557('0x37')]):undefined;this[_0xd557('0xc')][_0xd557('0x50')](_0x4b3253,_0x5d493a)[_0xd557('0x11')](function(_0x123b9a){_0xfbaae6(null,_[_0xd557('0x42')](_0x123b9a)?![]:!![]);})[_0xd557('0x13')](function(_0x3d05ff){logger[_0xd557('0x30')](_0x3d05ff);_0xfbaae6(null,![]);});};AGIVertices[_0xd557('0xe')]['shellCommand']=function(_0x3d612a,_0xb7516b){sh[_0xd557('0x53')](_[_0xd557('0x54')](_0x3d612a),function(_0x158e21,_0x2e9426){var _0x148fe6=_0x2e9426[_0xd557('0x55')](/(\r\n|\n|\r)/gm,'');_0xb7516b(null,_0x148fe6);});};AGIVertices[_0xd557('0xe')][_0xd557('0x56')]=function(_0x3b6ac7,_0x116479){scripts[_0xd557('0x56')](_0x3b6ac7[_0xd557('0x57')],_0x3b6ac7[_0xd557('0x58')]||_0xd557('0x59'),_0x3b6ac7[_0xd557('0x59')],_0x3b6ac7[_0xd557('0x5a')]||_0xd557('0x5b'),_0x3b6ac7[_0xd557('0x5c')]||'MALE',_0x3b6ac7[_0xd557('0x5d')]||_0xd557('0x5e'))[_0xd557('0x11')](function(_0xca360c){_0x116479(null,_0xca360c);})['catch'](function(_0x10d34d){_0x116479(_0x10d34d);});};AGIVertices[_0xd557('0xe')][_0xd557('0x5f')]=function(_0x5e7fc4,_0x6de577){scripts[_0xd557('0x5f')](_0x5e7fc4[_0xd557('0x59')],_0x5e7fc4['google_tts_language']||'en',0x1)['then'](function(_0x35cd48){_0x6de577(null,_0x35cd48);})['catch'](function(_0x551cab){_0x6de577(_0x551cab);});};AGIVertices['prototype']['restAPI']=function(_0x5eef96,_0x3f57b7){var _0x382c6f={'uri':_0x5eef96[_0xd557('0x60')],'method':_0x5eef96[_0xd557('0x61')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x5eef96['timeout'])===_0xd557('0x62')&&parseInt(_0x5eef96['timeout'])>=0x1?parseInt(_0x5eef96[_0xd557('0x63')])*0x3e8:0x5*0x3e8};if(_[_0xd557('0x64')](['POST',_0xd557('0x65')],_0x382c6f[_0xd557('0x61')][_0xd557('0x66')]())){try{_0x382c6f[_0xd557('0x67')]=_0x5eef96['rawBody']?JSON[_0xd557('0x68')](_0x5eef96[_0xd557('0x9')]):{};}catch(_0x13fef7){logger[_0xd557('0x30')](_0xd557('0x69'),_0x13fef7);}}try{_0x382c6f[_0xd557('0x6a')]=_0x5eef96[_0xd557('0x8')]?JSON[_0xd557('0x68')](_0x5eef96[_0xd557('0x8')]):{};}catch(_0x58d3f9){logger['error'](_0xd557('0x6b'),_0x58d3f9);}if(_0x5eef96['computedVariables']){try{var _0x181764=require(_0x5eef96['computedVariables'])[_0xd557('0x6c')](this,_0x382c6f);_0x382c6f['uri']=Mustache[_0xd557('0x6d')](_0x5eef96[_0xd557('0x60')],_0x181764,{},['$$','$$']);if(_0x382c6f[_0xd557('0x6a')]){_0x382c6f['headers']=JSON[_0xd557('0x68')](Mustache[_0xd557('0x6d')](JSON[_0xd557('0x6e')](_0x382c6f[_0xd557('0x6a')]),_0x181764,{},['$$','$$']));}if(_0x382c6f[_0xd557('0x67')]){_0x382c6f[_0xd557('0x67')]=JSON['parse'](Mustache['render'](JSON[_0xd557('0x6e')](_0x382c6f[_0xd557('0x67')]),_0x181764,{},['$$','$$']));}}catch(_0x34de42){logger[_0xd557('0x30')](_0xd557('0x6f'),_0x34de42);}}rp(_0x382c6f)['then'](function(_0x51daba){var _0x29af82={'statusCode':_0x51daba[_0xd557('0x70')]||0xc8,'statusMessage':_0x51daba[_0xd557('0x71')]||'OK','headers':_0x51daba[_0xd557('0x6a')]||{},'body':_0x51daba[_0xd557('0x67')]||{}};_0x3f57b7(null,_0x29af82);})[_0xd557('0x13')](function(_0x167c88){var _0x12f329={'statusCode':_0x167c88['statusCode']||0x1f4,'statusMessage':_0x167c88[_0xd557('0x72')]||_0xd557('0x73'),'headers':_0x167c88[_0xd557('0x74')][_0xd557('0x6a')]||{},'body':_0x167c88[_0xd557('0x74')]['body']||{}};_0x3f57b7(null,_0x12f329);});};AGIVertices[_0xd557('0xe')]['googleDialogflow']=function(_0x210d5b,_0x3493c5){scripts[_0xd557('0x75')](this['channel'][_0xd557('0x39')],_0x210d5b[_0xd557('0x76')],_0x210d5b[_0xd557('0x59')],_0x210d5b['dialogflow_language']||'en')[_0xd557('0x11')](function(_0x4f9705){_0x3493c5(null,_0x4f9705);})[_0xd557('0x13')](function(_0x3c6d9d){_0x3493c5(_0x3c6d9d);});};AGIVertices[_0xd557('0xe')][_0xd557('0x77')]=function(_0x3d43b3,_0x5512a1){scripts['googleDialogflowV2'](this[_0xd557('0xb')]['uniqueid'],_0x3d43b3[_0xd557('0x78')],_0x3d43b3[_0xd557('0x79')],_0x3d43b3[_0xd557('0x7a')],_0x3d43b3[_0xd557('0x59')],_0x3d43b3[_0xd557('0x7b')]||'en')[_0xd557('0x11')](function(_0x40f6ff){_0x5512a1(null,_0x40f6ff);})[_0xd557('0x13')](function(_0x4bcbde){_0x5512a1(_0x4bcbde);});};AGIVertices['prototype'][_0xd557('0x7c')]=function(_0x2f0f12,_0x27e917){scripts[_0xd557('0x7c')](this[_0xd557('0xb')],_0x2f0f12)[_0xd557('0x11')](function(_0x5ef37c){_0x27e917(null,_0x5ef37c);})[_0xd557('0x13')](function(_0x529297){_0x27e917(_0x529297);});};AGIVertices[_0xd557('0xe')]['ispeechTTS']=function(_0x12899c,_0x29dcdd){scripts[_0xd557('0x7d')](_0x12899c['key'],_0x12899c[_0xd557('0x59')],_0x12899c[_0xd557('0x7e')]||_0xd557('0x5b'),_0x12899c[_0xd557('0x7f')])['then'](function(_0x59ff61){_0x29dcdd(null,_0x59ff61);})[_0xd557('0x13')](function(_0x490b2c){_0x29dcdd(_0x490b2c);});};AGIVertices[_0xd557('0xe')][_0xd557('0x80')]=function(_0x15b3e9,_0x3bc725,_0x402fe8){scripts[_0xd557('0x80')](_0x3bc725,_0x15b3e9[_0xd557('0x76')],_0x15b3e9[_0xd557('0x81')]||_0xd557('0x5b'),this[_0xd557('0x82')](_0x15b3e9['model'])?_0x15b3e9[_0xd557('0x83')]:undefined)['then'](function(_0x462237){_0x402fe8(null,_0x462237);})[_0xd557('0x13')](function(_0xb9796f){_0x402fe8(_0xb9796f);});};AGIVertices[_0xd557('0xe')][_0xd557('0x84')]=function(_0x4e963b,_0x28cadf){scripts[_0xd557('0x84')](_0x4e963b[_0xd557('0x85')],_0x4e963b['aws_secret_access_key'],_0x4e963b[_0xd557('0x86')],_0x4e963b[_0xd557('0x87')]||_0xd557('0x88'),_0x4e963b[_0xd557('0x59')],_0x4e963b[_0xd557('0x89')]||'text')[_0xd557('0x11')](function(_0x1eefb8){_0x28cadf(null,_0x1eefb8);})[_0xd557('0x13')](function(_0xeeee17){_0x28cadf(_0xeeee17);});};AGIVertices[_0xd557('0xe')][_0xd557('0x8a')]=function(_0x426ad8,_0x284304){scripts['awsLex'](this[_0xd557('0xb')][_0xd557('0x39')],_0x426ad8[_0xd557('0x85')],_0x426ad8[_0xd557('0x8b')],_0x426ad8['aws_lex_region'],_0x426ad8[_0xd557('0x59')],_0x426ad8[_0xd557('0x8c')])[_0xd557('0x11')](function(_0x5c21f2){_0x284304(null,_0x5c21f2);})[_0xd557('0x13')](function(_0x3773cd){_0x284304(_0x3773cd);});};AGIVertices['prototype'][_0xd557('0x8d')]=function(_0x279a1b,_0x18f9a6,_0x2e2df2){scripts['googleASR'](_0x18f9a6,_0x279a1b['key'],_0x279a1b[_0xd557('0x8e')]||'en-US')[_0xd557('0x11')](function(_0x1cb097){_0x2e2df2(null,_0x1cb097);})[_0xd557('0x13')](function(_0x39b646){_0x2e2df2(_0x39b646);});};AGIVertices[_0xd557('0xe')][_0xd557('0x8f')]=function(_0x4bcd93,_0x4940c9,_0x436207){scripts[_0xd557('0x8f')](_0x4940c9,_0x4bcd93[_0xd557('0x90')],_0x4bcd93[_0xd557('0x91')],_0x4bcd93[_0xd557('0x92')])[_0xd557('0x11')](function(_0x5ef6ba){_0x436207(null,_0x5ef6ba);})[_0xd557('0x13')](function(_0x574d9d){_0x436207(_0x574d9d);});};AGIVertices[_0xd557('0xe')][_0xd557('0x93')]=function(_0x4abc5d){var _0xaf087=_[_0xd557('0x64')](verticesWithRetry,_0x4abc5d['agicommand'])?_0x4abc5d:_[_0xd557('0x94')](_0x4abc5d);for(var _0xa2a1c5 in _0xaf087){if(_0xaf087['hasOwnProperty'](_0xa2a1c5)){if(_0xaf087[_0xa2a1c5]&&_[_0xd557('0x95')](_0xaf087[_0xa2a1c5])){if(_[_0xd557('0x64')](recursiveMapAttributes,_0xa2a1c5)){_0xaf087[_0xa2a1c5]=this['replaceObjectAllVariables'](_0xaf087[_0xa2a1c5]);}else{_0xaf087[_0xa2a1c5]=this[_0xd557('0x96')](_0xaf087[_0xa2a1c5]);}}}}return _0xaf087;};AGIVertices[_0xd557('0xe')][_0xd557('0x97')]=function(_0x19ea84){for(var _0x1229d8 in _0x19ea84){if(_0x19ea84[_0xd557('0x98')](_0x1229d8)){if(_[_0xd557('0x99')](_0x19ea84[_0x1229d8])){this[_0xd557('0x97')](_0x19ea84[_0x1229d8]);}else if(_['isArray'](_0x19ea84[_0x1229d8])){for(var _0x431879=0x0;_0x431879<_0x19ea84[_0x1229d8][_0xd557('0x9a')];_0x431879++){this[_0xd557('0x97')](_0x19ea84[_0x1229d8][_0x431879]);}}else if(_[_0xd557('0x95')](_0x19ea84[_0x1229d8])){_0x19ea84[_0x1229d8]=this['replaceAllVariables'](_0x19ea84[_0x1229d8]);}}}};AGIVertices[_0xd557('0xe')]['saveRestApiResult']=function(_0x40445d,_0x79d33c){for(var _0x353a69 in _0x40445d){if(_0x40445d[_0xd557('0x98')](_0x353a69)){if(_[_0xd557('0x99')](_0x40445d[_0x353a69])){if(!_['isEmpty'](_0x40445d[_0x353a69])){this['saveRestApiResult'](_0x40445d[_0x353a69],util[_0xd557('0x26')](_0xd557('0x9b'),_0x79d33c,_0x353a69));}}else if(_['isArray'](_0x40445d[_0x353a69])){for(var _0x3c0fbf=0x0;_0x3c0fbf<_0x40445d[_0x353a69][_0xd557('0x9a')];_0x3c0fbf++){this['saveRestApiResult'](_0x40445d[_0x353a69][_0x3c0fbf],util[_0xd557('0x26')](_0xd557('0x9b'),_0x79d33c,_0x353a69+'['+_0x3c0fbf+']'));}}else{if(!_[_0xd557('0x42')](_0x40445d[_0x353a69])){this[_0xd557('0xb')]['setVariable'](util[_0xd557('0x26')](_0xd557('0x9b'),_0x79d33c,_0x353a69),_0x40445d[_0x353a69]);}}}}};AGIVertices[_0xd557('0xe')][_0xd557('0x9c')]=function(_0x13faf0){try{var _0x309346=JSON[_0xd557('0x68')](_0x13faf0);this[_0xd557('0x97')](_0x309346);return JSON['stringify'](_0x309346);}catch(_0x51422f){return this[_0xd557('0x96')](_0x13faf0);}};AGIVertices['prototype'][_0xd557('0x96')]=function(_0x4346f6){var _0x2281f6=_0x4346f6[_0xd557('0x9d')]('{');for(var _0x5e74b7=0x1;_0x5e74b7<_0x2281f6[_0xd557('0x9a')];_0x5e74b7+=0x1){var _0x4c8ef6=_0x2281f6[_0x5e74b7][_0xd557('0x9d')]('}');if(_0x4c8ef6[_0xd557('0x9a')]>0x1){_0x4346f6=_0x4346f6['replaceAll']('{'+_0x4c8ef6[0x0]+'}',this['channel'][_0xd557('0xf')](_0x4c8ef6[0x0])[_0xd557('0x9e')]||_0x4c8ef6[0x0]);}}if(_0x2281f6[_0xd557('0x9a')]===0x1){return _0x4346f6[_0xd557('0x49')]();}return this[_0xd557('0x96')](_0x4346f6);};AGIVertices[_0xd557('0xe')][_0xd557('0x9f')]=function(_0x4b1cd3,_0x35539c){var _0x27da8b=this[_0xd557('0xb')][_0xd557('0xf')](_0x4b1cd3);if(_0x27da8b[_0xd557('0xa0')]===-0x1){return _0x27da8b;}logger[_0xd557('0x2b')](util['format'](_0xd557('0xa1'),_0x35539c,_0x27da8b[_0xd557('0x9e')]));return this[_0xd557('0xb')]['setVariable'](_0x35539c,_0x27da8b[_0xd557('0x9e')]);};AGIVertices['prototype'][_0xd557('0x82')]=function(_0x112f5d){return _0x112f5d&&_0x112f5d!=='0'&&_0x112f5d!=='-1'&&_0x112f5d!=='';};AGIVertices['prototype'][_0xd557('0xa2')]=function(_0x14cace){this[_0xd557('0xa3')][_0xd557('0x6c')](this,_0x14cace,'-');_0x14cace[_0xd557('0xa4')]=_0x14cace[_0xd557('0xa2')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x104e6d){logger[_0xd557('0x2b')](util[_0xd557('0x26')](_0xd557('0xa5'),_0x104e6d[_0xd557('0x35')]));if(!this[_0xd557('0x82')](_0x104e6d[_0xd557('0x59')])){return this[_0xd557('0xb')][_0xd557('0xa6')](_0xd557('0xa7'));}var _0x33a691='\x22'+_0x104e6d['text']+'\x22';if(this[_0xd557('0x82')](_0x104e6d[_0xd557('0x74')])){_0x33a691+=','+_0x104e6d[_0xd557('0x74')];}var _0x2a6e84=this[_0xd557('0xb')][_0xd557('0x53')](_0xd557('0xa8'),_0x33a691);if(_0x2a6e84[_0xd557('0xa0')]===-0x1){return _0x2a6e84;}return this[_0xd557('0xb')][_0xd557('0xa6')](util['format'](_0xd557('0xa9'),_0x33a691));};AGIVertices['prototype'][_0xd557('0xaa')]=function(_0x465f22){logger[_0xd557('0x2b')](util[_0xd557('0x26')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x465f22[_0xd557('0x35')]));if(!this['isConfigured'](_0x465f22[_0xd557('0xab')])){return this[_0xd557('0xb')]['noop'](_0xd557('0xac'));}var _0x404ba7=_0x465f22['grammar'];if(this[_0xd557('0x82')](_0x465f22[_0xd557('0x74')])){_0x404ba7+=','+_0x465f22[_0xd557('0x74')];}var _0x2a50a4=this[_0xd557('0xb')]['exec']('MRCPRecog',_0x404ba7);if(_0x2a50a4['result']===-0x1){return _0x2a50a4;}var _0x23285f=this[_0xd557('0x9f')](_0xd557('0xad'),_0xd557('0xae'));if(_0x23285f[_0xd557('0xa0')]===-0x1){return _0x23285f;}var _0x10f810=this['getAndSetVariable']('RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT');if(_0x10f810[_0xd557('0xa0')]===-0x1){return _0x10f810;}var _0xcc891e=this[_0xd557('0x9f')](_0xd557('0xaf'),'MRCP_RECOG_INSTANCE');if(_0xcc891e[_0xd557('0xa0')]===-0x1){return _0xcc891e;}return this[_0xd557('0xb')][_0xd557('0xa6')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x404ba7));};AGIVertices[_0xd557('0xe')]['agi']=function(_0x3e8136){logger[_0xd557('0x2b')](util['format'](_0xd557('0xb0'),_0x3e8136[_0xd557('0x35')]));return this[_0xd557('0xb')][_0xd557('0xb1')]([_0x3e8136[_0xd557('0xb2')],_0x3e8136[_0xd557('0xb3')]]);};AGIVertices['prototype'][_0xd557('0xb4')]=function(_0x4409ae){logger[_0xd557('0x2b')](util[_0xd557('0x26')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x4409ae['label']));if(this[_0xd557('0x82')](_0x4409ae[_0xd557('0x63')])){logger['info'](util[_0xd557('0x26')](_0xd557('0xb5'),_0x4409ae[_0xd557('0x63')]));var _0x285a33=this[_0xd557('0xb')]['wait'](_0x4409ae[_0xd557('0x63')]);if(_0x285a33[_0xd557('0xa0')]===-0x1){return _0x285a33;}}return this['channel'][_0xd557('0xb4')]();};AGIVertices[_0xd557('0xe')][_0xd557('0xb6')]=function(_0x2997ac){logger['info'](util['format'](_0xd557('0xb7'),_0x2997ac['label']));if(!this['isConfigured'](_0x2997ac['list_id'])){return this[_0xd557('0xb')][_0xd557('0x30')](_0x2997ac,_0xd557('0xb8'));}_0x2997ac['scheduledAt']=moment();if(this['isConfigured'](_0x2997ac[_0xd557('0xb9')])){_0x2997ac[_0xd557('0x48')]=moment()[_0xd557('0xba')](_0x2997ac[_0xd557('0xb9')],'minutes');}if(!this[_0xd557('0x82')](_0x2997ac[_0xd557('0x4a')])){_0x2997ac['callback_priority']=0x2;}this[_0xd557('0x40')]['sync'](this,_0x2997ac);return this[_0xd557('0xb')]['noop'](util[_0xd557('0x26')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x2997ac[_0xd557('0x45')],_0x2997ac[_0xd557('0x46')],_0x2997ac[_0xd557('0x48')]));};AGIVertices[_0xd557('0xe')]['custom_app']=function(_0x24e06a){logger[_0xd557('0x2b')](util[_0xd557('0x26')](_0xd557('0xbb'),_0x24e06a[_0xd557('0x35')]));var _0x3e72aa=this[_0xd557('0xb')][_0xd557('0x53')](_0x24e06a[_0xd557('0xbc')],_0x24e06a[_0xd557('0x74')]);if(_0x3e72aa['result']===-0x1){return _0x3e72aa;}return this[_0xd557('0xb')][_0xd557('0xa6')](util[_0xd557('0x26')](_0xd557('0xbd'),_0x24e06a['application'],_0x24e06a[_0xd557('0x74')]));};AGIVertices[_0xd557('0xe')]['lumenvoxtts']=function(_0xbbc4c2){logger[_0xd557('0x2b')](util['format'](_0xd557('0xbe'),_0xbbc4c2[_0xd557('0x35')]));if(!this[_0xd557('0x82')](_0xbbc4c2[_0xd557('0x59')])){return this[_0xd557('0xb')][_0xd557('0xa6')]('no\x20text\x20configured');}var _0x4455ac='\x22'+_0xbbc4c2[_0xd557('0x59')]+'\x22';if(this[_0xd557('0x82')](_0xbbc4c2[_0xd557('0x74')])){_0x4455ac+=','+_0xbbc4c2[_0xd557('0x74')];}var _0x25133f=this[_0xd557('0xb')]['exec'](_0xd557('0xa8'),_0x4455ac);if(_0x25133f[_0xd557('0xa0')]===-0x1){return _0x25133f;}return this[_0xd557('0xb')]['noop'](util[_0xd557('0x26')](_0xd557('0xa9'),_0x4455ac));};AGIVertices[_0xd557('0xe')][_0xd557('0xbf')]=function(_0x169567){logger[_0xd557('0x2b')](util[_0xd557('0x26')](_0xd557('0xc0'),_0x169567[_0xd557('0x35')]));if(!this[_0xd557('0x82')](_0x169567[_0xd557('0x59')])){return this[_0xd557('0xb')][_0xd557('0xa6')](_0xd557('0xa7'));}var _0x2c1ad3='\x22'+_0x169567[_0xd557('0x59')]+'\x22';if(this[_0xd557('0x82')](_0x169567[_0xd557('0x74')])){_0x2c1ad3+=','+_0x169567[_0xd557('0x74')];}var _0x17a261=this[_0xd557('0xb')][_0xd557('0x53')](_0xd557('0xa8'),_0x2c1ad3);if(_0x17a261[_0xd557('0xa0')]===-0x1){return _0x17a261;}return this[_0xd557('0xb')][_0xd557('0xa6')](util[_0xd557('0x26')](_0xd557('0xa9'),_0x2c1ad3));};AGIVertices[_0xd557('0xe')][_0xd557('0xc1')]=function(_0x63dae5){logger[_0xd557('0x2b')](util[_0xd557('0x26')](_0xd557('0xc2'),_0x63dae5[_0xd557('0x35')]));if(!this[_0xd557('0x82')](_0x63dae5[_0xd557('0xab')])){return this[_0xd557('0xb')]['noop']('no\x20grammar\x20configured');}var _0x81587b=_0x63dae5[_0xd557('0xab')];if(this[_0xd557('0x82')](_0x63dae5[_0xd557('0x74')])){_0x81587b+=','+_0x63dae5[_0xd557('0x74')];}var _0x3decae=this[_0xd557('0xb')][_0xd557('0x53')](_0xd557('0xc3'),_0x81587b);if(_0x3decae[_0xd557('0xa0')]===-0x1){return _0x3decae;}var _0x38b804=this['getAndSetVariable'](_0xd557('0xad'),_0xd557('0xc4'));if(_0x38b804['result']===-0x1){return _0x38b804;}var _0x767a9a=this[_0xd557('0x9f')](_0xd557('0xc5'),_0xd557('0xc6'));if(_0x767a9a['result']===-0x1){return _0x767a9a;}var _0x4dc6d0=this['getAndSetVariable']('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x4dc6d0[_0xd557('0xa0')]===-0x1){return _0x4dc6d0;}return this[_0xd557('0xb')][_0xd557('0xa6')](util['format'](_0xd557('0xc7'),_0x81587b));};AGIVertices[_0xd557('0xe')][_0xd557('0xc8')]=function(_0x333c98){logger[_0xd557('0x2b')](util['format'](_0xd557('0xc9'),_0x333c98[_0xd557('0x35')]));if(!this[_0xd557('0x82')](_0x333c98['grammar'])){return this['channel'][_0xd557('0xa6')](_0xd557('0xac'));}var _0x533fac=_0x333c98[_0xd557('0xab')];if(this[_0xd557('0x82')](_0x333c98['options'])){_0x533fac+=','+_0x333c98[_0xd557('0x74')];}var _0x51e467=this[_0xd557('0xb')][_0xd557('0x53')](_0xd557('0xc3'),_0x533fac);if(_0x51e467[_0xd557('0xa0')]===-0x1){return _0x51e467;}var _0x5aea81=this[_0xd557('0x9f')](_0xd557('0xad'),_0xd557('0xca'));if(_0x5aea81[_0xd557('0xa0')]===-0x1){return _0x5aea81;}var _0x51393a=this[_0xd557('0x9f')](_0xd557('0xc5'),'SESTEK_ASR_TRANSCRIPT');if(_0x51393a[_0xd557('0xa0')]===-0x1){return _0x51393a;}var _0x50363b=this['getAndSetVariable'](_0xd557('0xaf'),_0xd557('0xcb'));if(_0x50363b[_0xd557('0xa0')]===-0x1){return _0x50363b;}return this['channel'][_0xd557('0xa6')](util['format'](_0xd557('0xc7'),_0x533fac));};AGIVertices[_0xd557('0xe')][_0xd557('0xcc')]=function(_0x5f31fe){logger[_0xd557('0x2b')](util[_0xd557('0x26')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x5f31fe[_0xd557('0x35')]));if(!this['isConfigured'](_0x5f31fe[_0xd557('0xcd')])){return this[_0xd557('0xb')]['error'](_0x5f31fe,_0xd557('0xce'));}var _0xa66101=this[_0xd557('0xcf')][_0xd557('0x6c')](this,_0x5f31fe[_0xd557('0xcd')]);if(!_0xa66101){return this[_0xd557('0xb')][_0xd557('0x30')](_0x5f31fe,_0xd557('0xd0'));}if(!this['isConfigured'](_0x5f31fe[_0xd557('0x2d')])){return this[_0xd557('0xb')]['error'](_0x5f31fe,_0xd557('0xd1'));}var _0x25acaa=_0x5f31fe[_0xd557('0x2d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xd557('0xb')][_0xd557('0xa6')](util[_0xd557('0x26')](_0xd557('0xd2'),_0x25acaa));var _0x5d19f0=this['getQueryOdbc']['sync'](this,_0xa66101,_0x25acaa);this[_0xd557('0xa3')][_0xd557('0x6c')](this,_0x5f31fe,_0x25acaa);if(!this[_0xd557('0x82')](_0x5f31fe['variable_id'])){return this[_0xd557('0xb')][_0xd557('0xa6')](_0xd557('0xd3'));}var _0x4c93f8=this[_0xd557('0xf')][_0xd557('0x6c')](this,_0x5f31fe[_0xd557('0xd4')]);if(!_0x4c93f8){return this['channel'][_0xd557('0x30')](_0x5f31fe,'no\x20variable\x20found');}var _0x5a117b=this;_0x5d19f0[_0xd557('0xd5')](function(_0x4282f2,_0x1d0ace){Object[_0xd557('0xd6')](_0x4282f2)[_0xd557('0xd5')](function(_0x55487e){_0x5a117b[_0xd557('0xb')]['setVariable'](util[_0xd557('0x26')]('%s[%s][%s]',_0x4c93f8,_0x1d0ace,_0x55487e),_0x4282f2[_0x55487e]);});});this['channel'][_0xd557('0xd7')](util[_0xd557('0x26')]('%s_ROWS_COUNT',_0x4c93f8),_0x5d19f0[_0xd557('0x9a')]);return this[_0xd557('0xb')]['noop'](util[_0xd557('0x26')]('variable\x20%s\x20set',_0x4c93f8));};AGIVertices[_0xd557('0xe')][_0xd557('0xd8')]=function(_0x46a747){logger['debug'](util[_0xd557('0x26')](_0xd557('0xd9'),_0x46a747['label']));if(!this[_0xd557('0x82')](_0x46a747[_0xd557('0xda')])){return this[_0xd557('0xb')]['error'](_0x46a747,'no\x20user\x20selected');}var _0x1a1213=this[_0xd557('0x19')][_0xd557('0x6c')](this,_0x46a747[_0xd557('0xda')]);if(!_0x1a1213){return this[_0xd557('0xb')][_0xd557('0x30')](_0x46a747,_0xd557('0xdb'));}var _0x385019=this[_0xd557('0xb')][_0xd557('0x53')]('DIAL',[util[_0xd557('0x26')]('SIP/%s',_0x1a1213),_0x46a747[_0xd557('0x63')],_0x46a747['opts'],_0x46a747[_0xd557('0x60')]]);if(_0x385019[_0xd557('0xa0')]===-0x1){return _0x385019;}return this[_0xd557('0xb')][_0xd557('0xa6')](util[_0xd557('0x26')](_0xd557('0xdc'),_0xd557('0xdd')));};AGIVertices[_0xd557('0xe')][_0xd557('0xde')]=function(_0x4a91af){logger['info'](util[_0xd557('0x26')](_0xd557('0xdf'),_0x4a91af[_0xd557('0x35')]));if(!this[_0xd557('0x82')](_0x4a91af[_0xd557('0x76')])){return this['channel'][_0xd557('0xa6')](_0xd557('0xe0'));}if(!this['isConfigured'](_0x4a91af[_0xd557('0x59')])){return this['channel']['noop'](_0xd557('0xa7'));}this[_0xd557('0xb')][_0xd557('0xe1')]=!![];this[_0xd557('0xa3')](_0x4a91af);this['createSquareMessage'](_0x4a91af['text'],'in','','');this[_0xd557('0xb')][_0xd557('0xa6')](util[_0xd557('0x26')](_0xd557('0xe2'),_0x4a91af[_0xd557('0x59')]));var _0x420994=this[_0xd557('0x75')][_0xd557('0x6c')](this,_0x4a91af);if(_0x420994){for(var _0x10583c in _0x420994){if(_0x420994[_0xd557('0x98')](_0x10583c)){this[_0xd557('0xb')]['setVariable'](util[_0xd557('0x26')](_0xd557('0xe3'),_0x10583c[_0xd557('0x66')]()),_0x420994[_0x10583c]);}}this[_0xd557('0x3f')](_0x420994[_0xd557('0xe4')],_0xd557('0xe5'),_0xd557('0xde'),'');return this['channel'][_0xd557('0xa6')](util[_0xd557('0x26')]('Dialogflow\x20Result\x20%s',_0x420994['speech']));}return this[_0xd557('0xb')]['error'](_0x4a91af,_0xd557('0xe6'));};AGIVertices[_0xd557('0xe')][_0xd557('0xe7')]=function(_0x12bb7a){logger[_0xd557('0x2b')](util[_0xd557('0x26')](_0xd557('0xe8'),_0x12bb7a[_0xd557('0x35')]));if(!this['isConfigured'](_0x12bb7a[_0xd557('0x78')])){return this[_0xd557('0xb')][_0xd557('0xa6')]('no\x20project_id\x20configured');}if(!this[_0xd557('0x82')](_0x12bb7a[_0xd557('0x79')])){return this[_0xd557('0xb')][_0xd557('0xa6')](_0xd557('0xe9'));}if(!this['isConfigured'](_0x12bb7a[_0xd557('0x7a')])){return this[_0xd557('0xb')][_0xd557('0xa6')]('no\x20private_key\x20configured');}if(!this[_0xd557('0x82')](_0x12bb7a[_0xd557('0x7b')])){return this[_0xd557('0xb')][_0xd557('0xa6')](_0xd557('0xea'));}if(!this[_0xd557('0x82')](_0x12bb7a[_0xd557('0x59')])){return this['channel'][_0xd557('0xa6')](_0xd557('0xa7'));}this[_0xd557('0xb')][_0xd557('0xe1')]=!![];this[_0xd557('0xa3')](_0x12bb7a);this['createSquareMessage'](_0x12bb7a[_0xd557('0x59')],'in','','');this[_0xd557('0xb')][_0xd557('0xa6')](util[_0xd557('0x26')](_0xd557('0xeb'),_0x12bb7a[_0xd557('0x59')]));var _0x24d957=this[_0xd557('0x77')][_0xd557('0x6c')](this,_0x12bb7a);if(_0x24d957){for(var _0x43a4e2 in _0x24d957){if(_0x24d957[_0xd557('0x98')](_0x43a4e2)){if(_0x43a4e2!==_0xd557('0xec')){this[_0xd557('0xb')]['setVariable'](util['format'](_0xd557('0xe3'),_0x43a4e2[_0xd557('0x66')]()),_0x24d957[_0x43a4e2]);}}}this[_0xd557('0x3f')](_0x24d957[_0xd557('0xe4')],'out',_0xd557('0xe7'),_0x24d957['providerResponse']);return this[_0xd557('0xb')][_0xd557('0xa6')](util[_0xd557('0x26')](_0xd557('0xed'),_0x24d957['speech']));}return this[_0xd557('0xb')][_0xd557('0x30')](_0x12bb7a,_0xd557('0xee'));};AGIVertices[_0xd557('0xe')][_0xd557('0xef')]=function(_0x27641b){logger['info'](util['format'](_0xd557('0xf0'),_0x27641b[_0xd557('0x35')]));if(!this['isConfigured'](_0x27641b[_0xd557('0xf1')])){return this[_0xd557('0xb')][_0xd557('0xa6')](_0xd557('0xf2'));}if(!this[_0xd557('0x82')](_0x27641b[_0xd557('0xf3')])){return this[_0xd557('0xb')][_0xd557('0xa6')](_0xd557('0xf4'));}if(!this[_0xd557('0x82')](_0x27641b[_0xd557('0xf5')])){return this[_0xd557('0xb')][_0xd557('0xa6')]('no\x20password\x20configured');}if(!this[_0xd557('0x82')](_0x27641b['ndassistant_url'])){return this[_0xd557('0xb')][_0xd557('0xa6')](_0xd557('0xa7'));}this[_0xd557('0xb')][_0xd557('0xe1')]=!![];this[_0xd557('0xa3')](_0x27641b);this[_0xd557('0x3f')](_0x27641b[_0xd557('0x59')],'in','','');this[_0xd557('0xb')]['noop'](util[_0xd557('0x26')](_0xd557('0xf6'),_0x27641b[_0xd557('0x59')]));var _0xcc171=this['sestekNDA'][_0xd557('0x6c')](this,_0x27641b);if(_0xcc171){for(var _0x368660 in _0xcc171){if(_0xcc171['hasOwnProperty'](_0x368660)){this[_0xd557('0xb')]['setVariable'](util[_0xd557('0x26')]('SESTEK_NDA_%s',_0x368660[_0xd557('0x66')]()),_0xcc171[_0x368660]);}}this[_0xd557('0x3f')](_0xcc171['speech'],_0xd557('0xe5'),_0xd557('0xef'),'');if(_0xcc171[_0xd557('0xf7')]){this[_0xd557('0xb')][_0xd557('0xa6')](util['format'](_0xd557('0xf8'),_0xcc171['audiofile']));var _0x2c1a89=this[_0xd557('0xb')]['streamFile'](_0xcc171[_0xd557('0xf7')]);try{fs[_0xd557('0xf9')](_0xcc171[_0xd557('0xf7')]+_0xd557('0xfa'));}catch(_0x2225ca){logger[_0xd557('0x30')](_0x2225ca);}return _0x2c1a89;}else{return this[_0xd557('0xb')]['noop'](util[_0xd557('0x26')](_0xd557('0xfb'),_0xcc171[_0xd557('0xe4')]));}}return this[_0xd557('0xb')]['error'](_0x27641b,_0xd557('0xfc'));};AGIVertices[_0xd557('0xe')][_0xd557('0xfd')]=function(_0x2ff262){logger[_0xd557('0x2b')](util[_0xd557('0x26')](_0xd557('0xfe'),_0x2ff262['label']));return this[_0xd557('0xb')][_0xd557('0xa6')](_0xd557('0xfd'));};AGIVertices['prototype']['ext_dial']=function(_0x3ddc33){logger['info'](util[_0xd557('0x26')](_0xd557('0xff'),_0x3ddc33[_0xd557('0x35')]));var _0x4b25d0='';if(_0x3ddc33[_0xd557('0x100')]){if(!this[_0xd557('0x82')](_0x3ddc33[_0xd557('0x100')])){return this[_0xd557('0xb')][_0xd557('0x30')](_0x3ddc33,_0xd557('0x101'));}else{var _0xde3053=parseInt(_0x3ddc33[_0xd557('0x100')],0xa);if(isNaN(_0xde3053)){_0x4b25d0=_0x3ddc33[_0xd557('0x100')];}else{_0x4b25d0=this[_0xd557('0x1a')][_0xd557('0x6c')](this,_0x3ddc33[_0xd557('0x100')]);if(!_0x4b25d0){return this[_0xd557('0xb')][_0xd557('0x30')](_0x3ddc33,_0xd557('0x102'));}}}}else if(_0x3ddc33['trunk_name']){_0x4b25d0=_0x3ddc33[_0xd557('0x103')];}else{return this[_0xd557('0xb')]['error'](_0x3ddc33,_0xd557('0x101'));}var _0x4b1c79=this['channel'][_0xd557('0x53')](_0xd557('0xdd'),[util[_0xd557('0x26')]('SIP/%s/%s',_0x4b25d0,_0x3ddc33[_0xd557('0x45')]),_0x3ddc33[_0xd557('0x63')],_0x3ddc33[_0xd557('0x104')],_0x3ddc33['url']]);if(_0x4b1c79['result']===-0x1){return _0x4b1c79;}return this[_0xd557('0xb')][_0xd557('0xa6')](util[_0xd557('0x26')](_0xd557('0xdc'),'DIAL'));};AGIVertices[_0xd557('0xe')][_0xd557('0x105')]=function(_0x498112){logger[_0xd557('0x2b')](util[_0xd557('0x26')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x498112[_0xd557('0x35')]));return this['channel'][_0xd557('0xa6')](_0xd557('0x105'));};AGIVertices['prototype']['getdigits']=function(_0x2cfb02){logger[_0xd557('0x2b')](util['format'](_0xd557('0x106'),_0x2cfb02[_0xd557('0x35')]));if(_0x2cfb02['retry']===0x0){return this['maxRetry'](_0x2cfb02);}_0x2cfb02['retry']-=0x1;if(!this[_0xd557('0x82')](_0x2cfb02[_0xd557('0x107')])){return this[_0xd557('0xb')]['error'](_0x2cfb02,_0xd557('0x108'));}var _0x4c0236=this[_0xd557('0x1c')][_0xd557('0x6c')](this,_0x2cfb02[_0xd557('0x107')]);if(!_0x4c0236){return this['channel'][_0xd557('0x30')](_0x2cfb02,_0xd557('0x109'));}if(!this[_0xd557('0x82')](_0x2cfb02[_0xd557('0xd4')])){return this['channel'][_0xd557('0x30')](_0xd557('0xd3'));}var _0x187904=this[_0xd557('0xb')][_0xd557('0x10a')](_0x4c0236,_0x2cfb02[_0xd557('0x10b')],_0x2cfb02[_0xd557('0x10c')]);var _0x38f67b=_0x187904[_0xd557('0xa0')]?_0x187904[_0xd557('0xa0')][_0xd557('0x49')]():'';logger[_0xd557('0x2b')](_0xd557('0x10d'),JSON['stringify'](_0x187904));if(_0x187904['result']===-0x1){this[_0xd557('0xa3')][_0xd557('0x6c')](this,_0x2cfb02,_0x38f67b);return _0x187904;}else if(_0x187904[_0xd557('0x9e')]===_0xd557('0x63')){_0x187904['result']=_0x38f67b['length']>=parseInt(_0x2cfb02[_0xd557('0x10e')])?'x':'i';}else{_0x187904[_0xd557('0xa0')]=_0x38f67b[_0xd557('0x9a')]>=parseInt(_0x2cfb02[_0xd557('0x10e')])&&_0x38f67b[_0xd557('0x9a')]<=parseInt(_0x2cfb02['maxdigit'])?'x':'i';}var _0x3515c9=this['getVariable'][_0xd557('0x6c')](this,_0x2cfb02['variable_id']);if(!_0x3515c9){return this[_0xd557('0xb')][_0xd557('0x30')](_0x2cfb02,_0xd557('0x10f'));}this[_0xd557('0xb')][_0xd557('0xd7')](_0x3515c9,_0x38f67b);if(this['isConfigured'](_0x2cfb02[_0xd557('0x110')])){var _0x3fa966=parseInt(_0x2cfb02[_0xd557('0x110')],0xa);var _0x553c83=rs[_0xd557('0x111')]({'charset':'*','length':_0x3fa966});var _0x4782ea=_0x38f67b['length'];if(_0x4782ea>0x0){if(_0x4782ea>_0x3fa966){this[_0xd557('0xa3')][_0xd557('0x6c')](this,_0x2cfb02,_0x2cfb02[_0xd557('0x112')]===_0xd557('0x113')?_0x553c83+_0x38f67b[_0xd557('0x114')](_0x3fa966):_0x38f67b['substr'](0x0,_0x4782ea-_0x3fa966)+_0x553c83);}else{this[_0xd557('0xa3')][_0xd557('0x6c')](this,_0x2cfb02,rs[_0xd557('0x111')]({'charset':'*','length':_0x4782ea}));}}else{this[_0xd557('0xa3')]['sync'](this,_0x2cfb02,'');}}else{this[_0xd557('0xa3')][_0xd557('0x6c')](this,_0x2cfb02,_0x38f67b);}return _0x187904;};AGIVertices[_0xd557('0xe')][_0xd557('0x115')]=function(_0x2bf4c0){logger[_0xd557('0x2b')](util[_0xd557('0x26')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x2bf4c0[_0xd557('0x35')]));return this[_0xd557('0xa')](_0x2bf4c0);};AGIVertices['prototype'][_0xd557('0x116')]=function(_0x5accdf){logger[_0xd557('0x2b')](util[_0xd557('0x26')](_0xd557('0x117'),_0x5accdf[_0xd557('0x35')]));this[_0xd557('0xa3')]['sync'](this,_0x5accdf,_0x5accdf[_0xd557('0x118')]);return this[_0xd557('0xb')][_0xd557('0xa6')](util['format'](_0xd557('0x119'),_0x5accdf[_0xd557('0x118')]));};AGIVertices['prototype'][_0xd557('0x11a')]=function(_0x50990e){logger[_0xd557('0x2b')](util[_0xd557('0x26')](_0xd557('0x11b'),_0x50990e['label']));if(!this[_0xd557('0x82')](_0x50990e[_0xd557('0x85')])||!this[_0xd557('0x82')](_0x50990e[_0xd557('0x8b')])){return this[_0xd557('0xb')]['noop'](_0xd557('0x11c'));}if(!this[_0xd557('0x82')](_0x50990e[_0xd557('0x59')])){return this['channel'][_0xd557('0xa6')](_0xd557('0xa7'));}this[_0xd557('0xb')]['noop'](util['format']('Trying\x20aws\x20Polly\x20%s',_0x50990e['text']));var _0x3a03d7=this['awsPolly']['sync'](this,_0x50990e);if(_0x3a03d7){this['channel'][_0xd557('0xa6')](util[_0xd557('0x26')](_0xd557('0x11d'),_0x3a03d7));var _0x53ee43=this[_0xd557('0xb')]['streamFile'](_0x3a03d7);try{fs['unlink'](_0x3a03d7+_0xd557('0xfa'));}catch(_0x2cd865){logger[_0xd557('0x30')](_0x2cd865);}return _0x53ee43;}return this[_0xd557('0xb')][_0xd557('0x30')](_0x50990e,_0xd557('0x11e'));};AGIVertices['prototype']['awslex']=function(_0x422d8b){logger['info'](util[_0xd557('0x26')](_0xd557('0x11f'),_0x422d8b[_0xd557('0x35')]));if(!this[_0xd557('0x82')](_0x422d8b[_0xd557('0x85')])||!this[_0xd557('0x82')](_0x422d8b[_0xd557('0x8b')])){return this[_0xd557('0xb')][_0xd557('0xa6')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xd557('0x82')](_0x422d8b['aws_bot_name'])){return this[_0xd557('0xb')][_0xd557('0xa6')](_0xd557('0x120'));}if(!this['isConfigured'](_0x422d8b['text'])){return this[_0xd557('0xb')]['noop'](_0xd557('0xa7'));}this['channel'][_0xd557('0xe1')]=!![];this[_0xd557('0xa3')](_0x422d8b);this[_0xd557('0x3f')](_0x422d8b[_0xd557('0x59')],'in','','');this[_0xd557('0xb')][_0xd557('0xa6')](util[_0xd557('0x26')]('Trying\x20Amazon\x20Lex:\x20%s',_0x422d8b[_0xd557('0x59')]));var _0x513780=this['awsLex'][_0xd557('0x6c')](this,_0x422d8b);if(_0x513780){for(var _0x2f5273 in _0x513780){if(_0x513780[_0xd557('0x98')](_0x2f5273)&&_[_0xd557('0x95')](_0x513780[_0x2f5273])){this[_0xd557('0xb')][_0xd557('0xd7')](util[_0xd557('0x26')]('AWS_LEX_%s',_0x2f5273['toUpperCase']()),_0x513780[_0x2f5273]);}}if(_['isNil'](_0x513780[_0xd557('0x72')])){return this[_0xd557('0xb')][_0xd557('0xa6')](_0xd557('0x121'));}else{this[_0xd557('0x3f')](_0x513780['message'],_0xd557('0xe5'),_0xd557('0x122'),'');return this[_0xd557('0xb')]['noop'](util[_0xd557('0x26')](_0xd557('0x123'),_0x513780[_0xd557('0x72')]));}}return this['channel'][_0xd557('0x30')](_0x422d8b,_0xd557('0x124'));};AGIVertices['prototype'][_0xd557('0x125')]=function(_0x5df196){logger[_0xd557('0x2b')](util['format'](_0xd557('0x126'),_0x5df196[_0xd557('0x35')],_0x5df196[_0xd557('0x63')]));if(!this[_0xd557('0x82')](_0x5df196[_0xd557('0x76')])){return this['channel'][_0xd557('0xa6')]('no\x20key\x20configured');}var _0x5ae355=_0xd557('0x127');var _0x54c2f1=util[_0xd557('0x26')](_0xd557('0x128'),FILES_PATH,rs[_0xd557('0x111')](0x4));var _0xce1be4=util[_0xd557('0x26')](_0xd557('0x9b'),_0x54c2f1,_0x5ae355);var _0x4ae1ca=!![];if(_0x5df196[_0xd557('0x129')]===_0xd557('0x12a')){_0x4ae1ca=![];}var _0xbf4b94=this[_0xd557('0xb')][_0xd557('0x12b')](_0x54c2f1,_0x5ae355,_0x5df196[_0xd557('0x12c')],_0x5df196[_0xd557('0x63')],undefined,_0x4ae1ca);if(_0xbf4b94[_0xd557('0xa0')]!==-0x1){this['channel']['noop'](util[_0xd557('0x26')]('google\x20%s\x20file\x20created',_0xce1be4));var _0x33261c=this[_0xd557('0x8d')][_0xd557('0x6c')](this,_0x5df196,_0xce1be4);if(_0x33261c){for(var _0x2cad1f in _0x33261c){if(_0x33261c[_0xd557('0x98')](_0x2cad1f)){this['channel'][_0xd557('0xd7')](util['format'](_0xd557('0x12d'),_0x2cad1f[_0xd557('0x66')]()),_0x33261c[_0x2cad1f]);}}return this[_0xd557('0xb')][_0xd557('0xa6')](util[_0xd557('0x26')](_0xd557('0x12e'),JSON[_0xd557('0x6e')](_0x33261c)));}}return _0xbf4b94;};AGIVertices[_0xd557('0xe')][_0xd557('0x12f')]=function(_0x2b934a){logger[_0xd557('0x2b')](util[_0xd557('0x26')](_0xd557('0x130'),_0x2b934a['label']));if(!this[_0xd557('0x82')](_0x2b934a[_0xd557('0x90')])){return this[_0xd557('0xb')][_0xd557('0xa6')](_0xd557('0x131'));}if(!this[_0xd557('0x82')](_0x2b934a['appsecret'])){return this[_0xd557('0xb')][_0xd557('0xa6')](_0xd557('0x132'));}var _0x2de273=_0xd557('0x127');var _0x93556b=util[_0xd557('0x26')]('%s/recordings/%s',FILES_PATH,rs[_0xd557('0x111')](0x4));var _0x3404ab=util['format'](_0xd557('0x9b'),_0x93556b,_0x2de273);var _0x85d5aa=!![];if(_0x2b934a[_0xd557('0x129')]===_0xd557('0x12a')){_0x85d5aa=![];}var _0x44ec2c=this[_0xd557('0xb')][_0xd557('0x12b')](_0x93556b,_0x2de273,_0x2b934a['intKey'],_0x2b934a[_0xd557('0x63')],undefined,_0x85d5aa);if(_0x44ec2c[_0xd557('0xa0')]!==-0x1){this[_0xd557('0xb')]['noop'](util[_0xd557('0x26')](_0xd557('0x133'),_0x3404ab));var _0x5daa21=this[_0xd557('0x8f')][_0xd557('0x6c')](this,_0x2b934a,_0x3404ab);if(_0x5daa21){for(var _0x185304 in _0x5daa21){if(_0x5daa21[_0xd557('0x98')](_0x185304)){this[_0xd557('0xb')][_0xd557('0xd7')](util[_0xd557('0x26')]('TILDE_ASR_%s',_0x185304['toUpperCase']()),_0x5daa21[_0x185304]);}}return this['channel'][_0xd557('0xa6')](util[_0xd557('0x26')](_0xd557('0x134'),JSON[_0xd557('0x6e')](_0x5daa21)));}}return _0x44ec2c;};AGIVertices['prototype']['gotoc']=function(_0x168c78){logger[_0xd557('0x2b')](util[_0xd557('0x26')](_0xd557('0x135'),_0x168c78[_0xd557('0x35')]));return this['channel']['continueAt'](_0x168c78[_0xd557('0x3b')],_0x168c78[_0xd557('0x3c')],_0x168c78[_0xd557('0x3d')]);};AGIVertices[_0xd557('0xe')]['gotoif']=function(_0xb4d504){logger[_0xd557('0x2b')](util[_0xd557('0x26')](_0xd557('0x136'),_0xb4d504[_0xd557('0x35')]));if(!this[_0xd557('0x82')](_0xb4d504['condition'])){return this[_0xd557('0xb')][_0xd557('0x30')](_0xb4d504,_0xd557('0x137'));}try{var _0x328567=eval(_0xb4d504[_0xd557('0x138')])?'true':'false';this[_0xd557('0xb')][_0xd557('0xa6')](util['format'](_0xd557('0x139'),_0xb4d504[_0xd557('0x138')],_0x328567));return{'code':0xc8,'result':_0x328567};}catch(_0x30b64c){return{'code':0xc8,'result':_0xd557('0x13a')};}};AGIVertices['prototype'][_0xd557('0x13b')]=function(_0x176bdc){logger[_0xd557('0x2b')](util['format'](_0xd557('0x13c'),_0x176bdc['label']));if(!this[_0xd557('0x82')](_0x176bdc[_0xd557('0x13d')])){return this[_0xd557('0xb')]['error'](_0x176bdc,_0xd557('0x13e'));}var _0x3e2c3e=this[_0xd557('0x21')][_0xd557('0x6c')](this,_0x176bdc[_0xd557('0x13d')]);if(!_0x3e2c3e){return this[_0xd557('0xb')][_0xd557('0x30')](_0x176bdc,_0xd557('0x13f'));}for(var _0x354465=0x0;_0x354465<_0x3e2c3e[_0xd557('0x9a')];_0x354465+=0x1){var _0x5e87a6=this[_0xd557('0xb')][_0xd557('0xf')](util[_0xd557('0x26')](_0xd557('0x140'),_0x3e2c3e[_0x354465]));if(_0x5e87a6[_0xd557('0xa0')]===-0x1){return _0x5e87a6;}logger[_0xd557('0x2b')](util[_0xd557('0x26')](_0xd557('0x141'),_0x3e2c3e[_0x354465],_0x5e87a6[_0xd557('0x9e')]));if(_0x5e87a6[_0xd557('0x9e')]===_0xd557('0x142')){logger['info'](util[_0xd557('0x26')](_0xd557('0x141'),_0x3e2c3e[_0x354465],'true'));this[_0xd557('0xb')]['noop'](util[_0xd557('0x26')](_0xd557('0x141'),_0x3e2c3e[_0x354465],'true'));return{'code':0xc8,'result':_0xd557('0x142')};}else{logger[_0xd557('0x2b')](util[_0xd557('0x26')](_0xd557('0x141'),_0x3e2c3e[_0x354465],_0xd557('0x13a')));this['channel']['noop'](util[_0xd557('0x26')](_0xd557('0x141'),_0x3e2c3e[_0x354465],_0xd557('0x13a')));}}return{'code':0xc8,'result':_0xd557('0x13a')};};AGIVertices['prototype'][_0xd557('0x143')]=function(_0x58d3fc){logger['info'](util[_0xd557('0x26')](_0xd557('0x144'),_0x58d3fc[_0xd557('0x35')]));return this['channel']['hangup']();};AGIVertices['prototype']['ispeechasr']=function(_0x41b7a6){logger[_0xd557('0x2b')](util[_0xd557('0x26')](_0xd557('0x145'),_0x41b7a6[_0xd557('0x35')]));if(!this[_0xd557('0x82')](_0x41b7a6[_0xd557('0x76')])){return this[_0xd557('0xb')][_0xd557('0xa6')]('no\x20key\x20configured');}var _0x2ff7be=_0xd557('0x127');var _0x3533ce=util[_0xd557('0x26')](_0xd557('0x128'),FILES_PATH,rs['generate'](0x4));var _0x5dfa29=util[_0xd557('0x26')]('%s.%s',_0x3533ce,_0x2ff7be);var _0x65955b=!![];if(_0x41b7a6['beep']===_0xd557('0x12a')){_0x65955b=![];}var _0x4523c1=this[_0xd557('0xb')][_0xd557('0x12b')](_0x3533ce,_0x2ff7be,_0x41b7a6[_0xd557('0x12c')],_0x41b7a6[_0xd557('0x63')],undefined,_0x65955b);if(_0x4523c1[_0xd557('0xa0')]!==-0x1){this[_0xd557('0xb')][_0xd557('0xa6')](util[_0xd557('0x26')](_0xd557('0x146'),_0x5dfa29));var _0x319fb6=this[_0xd557('0x80')][_0xd557('0x6c')](this,_0x41b7a6,_0x5dfa29);if(_0x319fb6){for(var _0x39751a in _0x319fb6){if(_0x319fb6['hasOwnProperty'](_0x39751a)){this[_0xd557('0xb')][_0xd557('0xd7')](util['format'](_0xd557('0x147'),_0x39751a[_0xd557('0x66')]()),_0x319fb6[_0x39751a]);}}return this[_0xd557('0xb')][_0xd557('0xa6')](util[_0xd557('0x26')](_0xd557('0x148'),JSON[_0xd557('0x6e')](_0x319fb6)));}}return _0x4523c1;};AGIVertices[_0xd557('0xe')][_0xd557('0x149')]=function(_0x3f319b){logger[_0xd557('0x2b')](util[_0xd557('0x26')](_0xd557('0x14a'),_0x3f319b[_0xd557('0x35')]));if(!this[_0xd557('0x82')](_0x3f319b['key'])){return this[_0xd557('0xb')]['noop'](_0xd557('0xe0'));}if(!this['isConfigured'](_0x3f319b[_0xd557('0x59')])){return this[_0xd557('0xb')][_0xd557('0xa6')]('no\x20text\x20configured');}this[_0xd557('0xb')][_0xd557('0xa6')](util[_0xd557('0x26')](_0xd557('0x14b'),_0x3f319b[_0xd557('0x59')]));var _0x43a24f=this['ispeechTTS'][_0xd557('0x6c')](this,_0x3f319b);if(_0x43a24f){this['channel'][_0xd557('0xa6')](util[_0xd557('0x26')]('ispeech\x20%s\x20file\x20created',_0x43a24f));var _0x295dbf=this[_0xd557('0xb')][_0xd557('0x14c')](_0x43a24f,_0x3f319b[_0xd557('0x12c')]);try{fs['unlink'](_0x43a24f+_0xd557('0xfa'));}catch(_0x44b62d){logger[_0xd557('0x30')](_0x44b62d);}return _0x295dbf;}return this[_0xd557('0xb')][_0xd557('0x30')](_0x3f319b,_0xd557('0x14d'));};AGIVertices[_0xd557('0xe')]['login']=function(_0x402054){logger['info'](util[_0xd557('0x26')](_0xd557('0x14e'),_0x402054[_0xd557('0x35')]));if(!this['isConfigured'](_0x402054[_0xd557('0x14f')])){return this['channel'][_0xd557('0x30')](_0x402054,_0xd557('0x150'));}logger[_0xd557('0x2b')](util[_0xd557('0x26')](_0xd557('0x151'),this['channel'][_0xd557('0x37')],_0x402054[_0xd557('0x14f')]));var _0x58ec18=this[_0xd557('0x50')][_0xd557('0x6c')](this,_0x402054[_0xd557('0x14f')]);if(_0x58ec18){logger[_0xd557('0x2b')](util[_0xd557('0x26')](_0xd557('0x152'),this[_0xd557('0xb')]['callerid'],_0x402054['findBy']));this[_0xd557('0xb')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xd557('0xb')][_0xd557('0x37')],_0x402054[_0xd557('0x14f')]));return{'code':0xc8,'result':_0xd557('0x153')};}else{logger[_0xd557('0x2b')](util['format'](_0xd557('0x154'),this['channel'][_0xd557('0x37')],_0x402054['findBy']));this['channel'][_0xd557('0xa6')](util[_0xd557('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd557('0xb')][_0xd557('0x37')],_0x402054['findBy']));return{'code':0xc8,'result':_0xd557('0x155')};}};AGIVertices[_0xd557('0xe')][_0xd557('0x156')]=function(_0x238707){logger[_0xd557('0x2b')](util[_0xd557('0x26')](_0xd557('0x157'),_0x238707['label']));if(!this[_0xd557('0x82')](_0x238707['findBy'])){return this[_0xd557('0xb')][_0xd557('0x30')](_0x238707,'no\x20find\x20by\x20configured');}logger[_0xd557('0x2b')](util['format'](_0xd557('0x151'),this[_0xd557('0xb')][_0xd557('0x37')],_0x238707[_0xd557('0x14f')]));var _0x4bec19=this[_0xd557('0x4f')]['sync'](this,_0x238707[_0xd557('0x14f')]);if(_0x4bec19){logger[_0xd557('0x2b')](util[_0xd557('0x26')](_0xd557('0x152'),this[_0xd557('0xb')][_0xd557('0x37')],_0x238707[_0xd557('0x14f')]));this[_0xd557('0xb')][_0xd557('0xa6')](util[_0xd557('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x238707[_0xd557('0x14f')]));return{'code':0xc8,'result':_0xd557('0x153')};}else{logger[_0xd557('0x2b')](util[_0xd557('0x26')](_0xd557('0x154'),this['channel'][_0xd557('0x37')],_0x238707['findBy']));this[_0xd557('0xb')][_0xd557('0xa6')](util[_0xd557('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd557('0xb')][_0xd557('0x37')],_0x238707[_0xd557('0x14f')]));return{'code':0xc8,'result':_0xd557('0x155')};}};AGIVertices['prototype'][_0xd557('0x158')]=function(_0x5d8b0f){logger['info'](util['format'](_0xd557('0x159'),_0x5d8b0f['label']));if(!this[_0xd557('0x82')](_0x5d8b0f[_0xd557('0x15a')])){return this[_0xd557('0xb')]['error'](_0x5d8b0f,_0xd557('0x15b'));}this[_0xd557('0xb')][_0xd557('0xa6')](util[_0xd557('0x26')]('math\x20%s',_0x5d8b0f['operation']));var _0x468452=eval(_0x5d8b0f['operation']);if(!this['isConfigured'](_0x5d8b0f[_0xd557('0xd4')])){return this[_0xd557('0xb')]['noop'](_0xd557('0xd3'));}var _0x25261e=this[_0xd557('0xf')][_0xd557('0x6c')](this,_0x5d8b0f['variable_id']);if(!_0x25261e){return this[_0xd557('0xb')][_0xd557('0x30')](_0x5d8b0f,_0xd557('0x10f'));}if(_['isArray'](_0x468452)){var _0x1be57c=this;_0x468452[_0xd557('0xd5')](function(_0x2d9ca6,_0x1dfeaf){_0x1be57c[_0xd557('0xb')][_0xd557('0xd7')](util[_0xd557('0x26')]('%s[%s]',_0x25261e,_0x1dfeaf),_0x2d9ca6);});return this['channel'][_0xd557('0xa6')](util[_0xd557('0x26')](_0xd557('0x15c'),_0x25261e));}else{return this[_0xd557('0xb')]['setVariable'](_0x25261e,_0x468452);}};AGIVertices[_0xd557('0xe')][_0xd557('0x15d')]=function(_0x11074e){logger[_0xd557('0x2b')](util[_0xd557('0x26')](_0xd557('0x15e'),_0x11074e[_0xd557('0x35')]));if(_0x11074e[_0xd557('0xa4')]===0x0){return this[_0xd557('0xa2')](_0x11074e);}_0x11074e[_0xd557('0xa4')]-=0x1;if(!this[_0xd557('0x82')](_0x11074e[_0xd557('0x107')])){return this[_0xd557('0xb')][_0xd557('0x30')](_0x11074e,'no\x20file\x20audio\x20selected');}var _0x100957=this[_0xd557('0x1c')]['sync'](this,_0x11074e['file_id']);if(!_0x100957){return this[_0xd557('0xb')][_0xd557('0x30')](_0x11074e,_0xd557('0x109'));}var _0x3a944f=this[_0xd557('0xb')][_0xd557('0x10a')](_0x100957,_0x11074e[_0xd557('0x10b')],_0x11074e['digit']);var _0x1805ef=_0x3a944f[_0xd557('0xa0')];if(_0x3a944f[_0xd557('0xa0')]===-0x1){this[_0xd557('0xa3')][_0xd557('0x6c')](this,_0x11074e,'-1');return _0x3a944f;}else if(_0x3a944f['extra']===_0xd557('0x63')){_0x3a944f['result']=_0x3a944f[_0xd557('0xa0')][_0xd557('0x9a')]>0x0?_0x3a944f['result']:'t';}else if(_[_0xd557('0x41')](_0x3a944f[_0xd557('0xa0')])){_0x3a944f[_0xd557('0xa0')]='#';_0x1805ef='#';}if(!this[_0xd557('0x82')](_0x11074e[_0xd557('0xd4')])){this['channel']['noop'](_0xd557('0xd3'));}else{var _0x585534=this[_0xd557('0xf')][_0xd557('0x6c')](this,_0x11074e['variable_id']);if(!_0x585534){return this['channel'][_0xd557('0x30')](_0x11074e,_0xd557('0x10f'));}this[_0xd557('0xb')][_0xd557('0xd7')](_0x585534,_0x1805ef);}this[_0xd557('0xa3')][_0xd557('0x6c')](this,_0x11074e,_0x1805ef);return _0x3a944f;};AGIVertices[_0xd557('0xe')]['noop']=function(_0x59bd6b){logger['info'](util[_0xd557('0x26')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x59bd6b['label']));return this[_0xd557('0xb')][_0xd557('0xa6')](_0x59bd6b[_0xd557('0x15f')]||_0x59bd6b[_0xd557('0x35')]);};AGIVertices[_0xd557('0xe')]['pause']=function(_0x4bff85){logger[_0xd557('0x2b')](util[_0xd557('0x26')](_0xd557('0x160'),_0x4bff85[_0xd557('0x35')]));if(!this['isConfigured'](_0x4bff85[_0xd557('0x14f')])){return this['channel']['error'](_0x4bff85,_0xd557('0x150'));}logger[_0xd557('0x2b')](util[_0xd557('0x26')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x4bff85[_0xd557('0x14f')]));var _0x454cc8=this[_0xd557('0x161')][_0xd557('0x6c')](this,_0x4bff85[_0xd557('0x162')]);var _0x29828b=this['agentPause'][_0xd557('0x6c')](this,_0x4bff85[_0xd557('0x14f')],_0x454cc8);if(_0x29828b){logger[_0xd557('0x2b')](util[_0xd557('0x26')](_0xd557('0x152'),this[_0xd557('0xb')]['callerid'],_0x4bff85[_0xd557('0x14f')]));this['channel'][_0xd557('0xa6')](util['format'](_0xd557('0x152'),this[_0xd557('0xb')][_0xd557('0x37')],_0x4bff85['findBy']));return{'code':0xc8,'result':_0xd557('0x153')};}else{logger[_0xd557('0x2b')](util[_0xd557('0x26')](_0xd557('0x154'),this['channel']['callerid'],_0x4bff85[_0xd557('0x14f')]));this[_0xd557('0xb')]['noop'](util[_0xd557('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd557('0xb')][_0xd557('0x37')],_0x4bff85[_0xd557('0x14f')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xd557('0xe')]['playback']=function(_0x2bd250){logger[_0xd557('0x2b')](util[_0xd557('0x26')](_0xd557('0x163'),_0x2bd250['label']));if(!this[_0xd557('0x82')](_0x2bd250[_0xd557('0x107')])){return this[_0xd557('0xb')][_0xd557('0x30')](_0x2bd250,'no\x20file\x20audio\x20selected');}var _0x5ce576=this[_0xd557('0x1c')][_0xd557('0x6c')](this,_0x2bd250[_0xd557('0x107')]);if(!_0x5ce576){return this[_0xd557('0xb')][_0xd557('0x30')](_0x2bd250,'no\x20file\x20audio\x20found');}var _0x729d57=this[_0xd557('0xb')][_0xd557('0x53')](_0xd557('0x164'),[_0x5ce576,_0x2bd250['opts']]);if(_0x729d57[_0xd557('0xa0')]===-0x1){return _0x729d57;}return this[_0xd557('0xb')][_0xd557('0xa6')](util[_0xd557('0x26')](_0xd557('0xbd'),_0xd557('0x164'),_0x5ce576));};AGIVertices[_0xd557('0xe')][_0xd557('0x165')]=function(_0x4af945){logger[_0xd557('0x2b')](util['format'](_0xd557('0x166'),_0x4af945[_0xd557('0x35')]));if(!this[_0xd557('0x82')](_0x4af945[_0xd557('0x167')])){return this[_0xd557('0xb')][_0xd557('0x30')](_0x4af945,_0xd557('0x168'));}var _0x40503b='';var _0x23a3d3=parseInt(_0x4af945[_0xd557('0x167')],0xa);if(isNaN(_0x23a3d3)){_0x40503b=_0x4af945['queue_id'];}else{_0x40503b=this[_0xd557('0x14')]['sync'](this,_0x4af945[_0xd557('0x167')]);if(!_0x40503b){return this[_0xd557('0xb')][_0xd557('0x30')](_0x4af945,_0xd557('0x169'));}}var _0xe07879='';if(this['isConfigured'](_0x4af945[_0xd557('0x107')])){var _0x1bc799=this[_0xd557('0x1c')]['sync'](this,_0x4af945[_0xd557('0x107')]);if(_0x1bc799){_0xe07879=_0x1bc799;}}this[_0xd557('0xa3')]['sync'](this,_0x4af945,_0x40503b);if(_0x4af945[_0xd557('0x104')][_0xd557('0x16a')]('x')<0x0){_0x4af945[_0xd557('0x104')]+='x';}if(_0x4af945[_0xd557('0x104')][_0xd557('0x16a')]('X')<0x0){_0x4af945[_0xd557('0x104')]+='X';}this[_0xd557('0xb')][_0xd557('0xd7')](_0xd557('0x16b'),_0x40503b?_0x40503b[_0xd557('0x16c')]():'');var _0x6f3d52=this[_0xd557('0xb')][_0xd557('0x53')](_0xd557('0x16d'),[_0x40503b,_0x4af945[_0xd557('0x104')],_0x4af945[_0xd557('0x60')],_0xe07879,_0x4af945['timeout'],_0x4af945[_0xd557('0xb1')],_0x4af945[_0xd557('0x16e')],_0x4af945[_0xd557('0x16f')],'',_0x4af945[_0xd557('0x170')]]);if(_0x6f3d52['result']===-0x1){return _0x6f3d52;}return this['channel']['noop'](util['format'](_0xd557('0xbd'),_0xd557('0x16d'),_0x40503b));};AGIVertices[_0xd557('0xe')]['record']=function(_0x29d676){logger[_0xd557('0x2b')](util[_0xd557('0x26')](_0xd557('0x171'),_0x29d676[_0xd557('0x35')]));var _0x49b70f=_0x29d676[_0xd557('0x172')]||_0xd557('0x127');var _0x439a62=util[_0xd557('0x26')]('%s_%s',this[_0xd557('0xb')][_0xd557('0x39')],rs[_0xd557('0x111')](0x5));var _0x279b4e=util[_0xd557('0x26')]('%s/recordings/%s.%s',FILES_PATH,_0x439a62,_0x49b70f);var _0x19faa=util['format']('%s/recordings/%s',FILES_PATH,_0x439a62);this['createSquareRecording'][_0xd557('0x6c')](this,_0x29d676,_0x439a62,_0x279b4e);this[_0xd557('0xb')][_0xd557('0xd7')]('RECORDING_SAVENAME',_0x439a62);logger[_0xd557('0x2b')](_0xd557('0x173'),_0x19faa,_0x49b70f,_0x29d676[_0xd557('0x174')],_0x29d676[_0xd557('0x63')]);return this['channel'][_0xd557('0x12b')](_0x19faa,_0x49b70f,_0x29d676[_0xd557('0x174')],_0x29d676['timeout'],undefined,!![]);};AGIVertices[_0xd557('0xe')][_0xd557('0x175')]=function(_0x2c8145){logger['info'](util[_0xd557('0x26')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x2c8145['label']));if(!this[_0xd557('0x82')](_0x2c8145[_0xd557('0x60')])){return this['channel']['noop'](_0xd557('0x176'));}var _0x582ac2=this[_0xd557('0x177')]['sync'](this,_0x2c8145);logger['info'](util[_0xd557('0x26')](_0xd557('0x178'),util[_0xd557('0x179')](_0x582ac2,{'showHidden':![],'depth':null})));if(!this[_0xd557('0x82')](_0x2c8145[_0xd557('0xd4')])){return this[_0xd557('0xb')][_0xd557('0xa6')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x19ddfc=this[_0xd557('0xf')][_0xd557('0x6c')](this,_0x2c8145[_0xd557('0xd4')]);if(!_0x19ddfc){return this[_0xd557('0xb')][_0xd557('0x30')](_0x2c8145,_0xd557('0x10f'));}this['channel'][_0xd557('0xd7')](util[_0xd557('0x26')](_0xd557('0x17a'),_0x19ddfc),_0x582ac2[_0xd557('0x70')]?_0x582ac2[_0xd557('0x70')]:_0xd557('0x17b'));this[_0xd557('0xb')][_0xd557('0xd7')](util[_0xd557('0x26')](_0xd557('0x17c'),_0x19ddfc),_0x582ac2['statusMessage']?_0x582ac2['statusMessage']:'OK');if(_0x582ac2[_0xd557('0x67')]){try{this['saveRestApiResult'](_0x582ac2[_0xd557('0x67')],_0x19ddfc);}catch(_0x574f6b){logger['error'](util[_0xd557('0x26')](_0xd557('0x17d'),_0x19ddfc));}}return this[_0xd557('0xb')][_0xd557('0xa6')](util[_0xd557('0x26')]('variable\x20%s\x20set',_0x19ddfc));};AGIVertices[_0xd557('0xe')]['saydigits']=function(_0x4eeeb2){logger[_0xd557('0x2b')](util['format'](_0xd557('0x17e'),_0x4eeeb2[_0xd557('0x35')]));return this[_0xd557('0xb')][_0xd557('0x17f')](_0x4eeeb2[_0xd557('0x180')][_0xd557('0x55')](/\s+/g,''),_0x4eeeb2[_0xd557('0x174')]);};AGIVertices['prototype']['saynumber']=function(_0x3c8122){logger['info'](util[_0xd557('0x26')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x3c8122['label']));return this[_0xd557('0xb')]['sayNumber'](_0x3c8122[_0xd557('0x62')]['replace'](/\s+/g,''),_0x3c8122[_0xd557('0x174')]);};AGIVertices[_0xd557('0xe')]['sayphonetic']=function(_0x475b1e){logger[_0xd557('0x2b')](util[_0xd557('0x26')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x475b1e[_0xd557('0x35')]));return this[_0xd557('0xb')][_0xd557('0x181')](_0x475b1e[_0xd557('0x59')],_0x475b1e[_0xd557('0x174')]);};AGIVertices[_0xd557('0xe')][_0xd557('0x182')]=function(_0x9cc853){logger['info'](util[_0xd557('0x26')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x9cc853[_0xd557('0x35')]));if(!this['isConfigured'](_0x9cc853[_0xd557('0x183')])){return this[_0xd557('0xb')][_0xd557('0xa6')](_0xd557('0x184'));}var _0x38858f=this[_0xd557('0x185')][_0xd557('0x6c')](this,_0x9cc853[_0xd557('0x183')]);if(!_0x38858f||!_0x38858f[_0xd557('0x186')]){return this[_0xd557('0xb')][_0xd557('0x30')](_0x9cc853,'no\x20mail\x20account\x20found');}var _0x15a080={'from':util[_0xd557('0x26')](_0xd557('0x187'),_0x38858f[_0xd557('0x12')],_0x38858f[_0xd557('0x188')]||_0x38858f[_0xd557('0x186')][_0xd557('0x189')]),'to':_0x9cc853['to']||'','cc':_0x9cc853['cc']||'','bcc':_0x9cc853[_0xd557('0x18a')]||'','subject':_0x9cc853[_0xd557('0x18b')],'html':_0x9cc853[_0xd557('0x59')],'text':_0x9cc853[_0xd557('0x59')]};if(this[_0xd557('0x82')](_0x9cc853[_0xd557('0x18c')])){}logger[_0xd557('0x18d')]('sendMail\x20message',JSON[_0xd557('0x6e')](_0x15a080));this['createSquareDetailsReport'][_0xd557('0x6c')](this,_0x9cc853,_0x9cc853[_0xd557('0x183')]);this[_0xd557('0xb')][_0xd557('0xa6')](util[_0xd557('0x26')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x38858f['name']));this[_0xd557('0x20')][_0xd557('0x6c')](this,_0x38858f['smtpOptions'],_0x15a080);return this[_0xd557('0xb')][_0xd557('0xa6')](_0xd557('0x18e'));};AGIVertices['prototype']['sendFax']=function(_0x4f6f99){logger[_0xd557('0x2b')](util[_0xd557('0x26')](_0xd557('0x18f'),_0x4f6f99['label']));return this['channel']['noop']('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xd557('0xe')][_0xd557('0x190')]=function(_0x5f01c3){logger[_0xd557('0x2b')](util[_0xd557('0x26')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x5f01c3[_0xd557('0x35')]));if(!this[_0xd557('0x82')](_0x5f01c3['sms_account_id'])){return this[_0xd557('0xb')][_0xd557('0xa6')](_0xd557('0x191'));}var _0x4c36ac=this[_0xd557('0x32')][_0xd557('0x6c')](this,_0x5f01c3[_0xd557('0x192')]);if(!_0x4c36ac){return this['channel'][_0xd557('0x30')](_0x5f01c3,_0xd557('0x193'));}var _0x96cf30={'body':_0x5f01c3[_0xd557('0x194')],'phone':_0x5f01c3['to']||'','SmsAccountId':_0x4c36ac['id']};logger[_0xd557('0x18d')](_0xd557('0x195'),JSON[_0xd557('0x6e')](_0x96cf30));this[_0xd557('0xa3')][_0xd557('0x6c')](this,_0x5f01c3,_0x5f01c3['sms_account_id']);this[_0xd557('0xb')][_0xd557('0xa6')](util[_0xd557('0x26')](_0xd557('0x196'),_0x4c36ac[_0xd557('0x12')]));this[_0xd557('0x34')][_0xd557('0x6c')](this,_0x96cf30);return this[_0xd557('0xb')]['noop'](_0xd557('0x197'));};AGIVertices[_0xd557('0xe')][_0xd557('0x198')]=function(_0xeb629f){logger[_0xd557('0x2b')](util[_0xd557('0x26')](_0xd557('0x199'),_0xeb629f[_0xd557('0x35')]));if(!this[_0xd557('0x82')](_0xeb629f[_0xd557('0xd4')])){return this['channel'][_0xd557('0x30')](_0xeb629f,'no\x20variable\x20selected');}var _0x3cf10b=this[_0xd557('0xf')][_0xd557('0x6c')](this,_0xeb629f[_0xd557('0xd4')]);if(!_0x3cf10b){return this['channel'][_0xd557('0x30')](_0xeb629f,_0xd557('0x10f'));}return this[_0xd557('0xb')][_0xd557('0xd7')](_0x3cf10b,_0xeb629f[_0xd557('0x19a')]);};AGIVertices[_0xd557('0xe')][_0xd557('0x19b')]=function(_0x501091){logger[_0xd557('0x2b')](util[_0xd557('0x26')](_0xd557('0x19c'),_0x501091[_0xd557('0x35')]));this[_0xd557('0xb')][_0xd557('0xa6')]('START\x20CALLY\x20SQUARE');if(_0x501091[_0xd557('0xb4')]==='yes'){this[_0xd557('0xb')][_0xd557('0xa6')](_0xd557('0x19d'));return this[_0xd557('0xb')][_0xd557('0xb4')]();}return this['channel'][_0xd557('0xa6')](_0xd557('0x19e'));};AGIVertices[_0xd557('0xe')]['subproject']=function(_0x5e3e11){logger[_0xd557('0x2b')](util['format'](_0xd557('0x19f'),_0x5e3e11[_0xd557('0x35')]));if(!this[_0xd557('0x82')](_0x5e3e11[_0xd557('0x1a0')])){return this[_0xd557('0xb')][_0xd557('0x30')](_0x5e3e11,_0xd557('0x1a1'));}var _0x4281d6=this[_0xd557('0x16')][_0xd557('0x6c')](this,_0x5e3e11[_0xd557('0x1a0')]);if(!this[_0xd557('0x82')](_0x4281d6)){return this[_0xd557('0xb')][_0xd557('0x30')](_0x5e3e11,util[_0xd557('0x26')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x5e3e11['project_id']));}if(_0x4281d6===this['channel'][_0xd557('0x36')]){return this['channel'][_0xd557('0x30')](_0x5e3e11,_0xd557('0x1a2'));}this[_0xd557('0xa3')][_0xd557('0x6c')](this,_0x5e3e11,_0x4281d6);var _0x462b6c=this['channel']['exec'](_0xd557('0x1a3'),util[_0xd557('0x26')](_0xd557('0x1a4'),config[_0xd557('0xb1')]['host']||_0xd557('0x1a5'),_0x4281d6,this[_0xd557('0xb')][_0xd557('0x36')]));if(_0x462b6c[_0xd557('0xa0')]===-0x1){return _0x462b6c;}return this[_0xd557('0xb')][_0xd557('0xa6')](util['format']('Executed\x20command\x20%s\x20%s',_0xd557('0x1a3'),_0x4281d6));};AGIVertices[_0xd557('0xe')][_0xd557('0x1a6')]=function(_0x36b28d){logger['info'](util[_0xd557('0x26')](_0xd557('0x1a7'),_0x36b28d[_0xd557('0x35')]));var _0x3e735a=this[_0xd557('0x1a8')]['sync'](this,_0x36b28d[_0xd557('0xb2')]);this[_0xd557('0xa3')][_0xd557('0x6c')](this,_0x36b28d,_0x36b28d['command']);if(this[_0xd557('0x82')](_0x36b28d[_0xd557('0xd4')])){var _0x20b2ce=this[_0xd557('0xf')][_0xd557('0x6c')](this,_0x36b28d[_0xd557('0xd4')]);if(_0x20b2ce){this[_0xd557('0xb')][_0xd557('0xd7')](_0x20b2ce,_0x3e735a);return this[_0xd557('0xb')][_0xd557('0xa6')](util[_0xd557('0x26')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x36b28d['command'],_0x20b2ce));}}return this['channel'][_0xd557('0xa6')](util[_0xd557('0x26')](_0xd557('0x1a9'),_0x36b28d[_0xd557('0xb2')]));};AGIVertices[_0xd557('0xe')]['google_cloud_tts']=function(_0x26e7eb){logger['info'](util[_0xd557('0x26')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x26e7eb[_0xd557('0x35')]));_0x26e7eb['text']=_0x26e7eb[_0xd557('0x59')][_0xd557('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd557('0x82')](_0x26e7eb[_0xd557('0x57')])){return this[_0xd557('0xb')][_0xd557('0xa6')]('no\x20apiKey\x20configured');}if(!this[_0xd557('0x82')](_0x26e7eb['text'])){return this[_0xd557('0xb')][_0xd557('0xa6')]('no\x20text\x20configured');}this['channel'][_0xd557('0xa6')](util[_0xd557('0x26')](_0xd557('0x1aa'),_0x26e7eb['text']));var _0x3edc6d=this[_0xd557('0x56')]['sync'](this,_0x26e7eb);if(_0x3edc6d){this[_0xd557('0xb')]['noop'](util['format'](_0xd557('0x1ab'),_0x3edc6d));var _0x1d28ff=this['channel'][_0xd557('0x14c')](_0x3edc6d);try{fs[_0xd557('0xf9')](_0x3edc6d+_0xd557('0xfa'));}catch(_0x2ced51){logger['error'](_0x2ced51);}return _0x1d28ff;}return this['channel'][_0xd557('0x30')](_0x26e7eb,_0xd557('0x1ac'));};AGIVertices[_0xd557('0xe')][_0xd557('0x1ad')]=function(_0x2c8de5){logger[_0xd557('0x2b')](util['format'](_0xd557('0x1ae'),_0x2c8de5['label']));_0x2c8de5[_0xd557('0x59')]=_0x2c8de5['text'][_0xd557('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd557('0x82')](_0x2c8de5[_0xd557('0x59')])){return this[_0xd557('0xb')][_0xd557('0xa6')](_0xd557('0xa7'));}this[_0xd557('0xb')]['noop'](util['format'](_0xd557('0x1af'),_0x2c8de5[_0xd557('0x59')]));var _0x1d1251=this[_0xd557('0x5f')]['sync'](this,_0x2c8de5);if(_0x1d1251){this[_0xd557('0xb')]['noop'](util['format'](_0xd557('0x1b0'),_0x1d1251));var _0x1f427f=this['channel']['streamFile'](_0x1d1251);try{fs[_0xd557('0xf9')](_0x1d1251+_0xd557('0xfa'));}catch(_0x397dbb){logger[_0xd557('0x30')](_0x397dbb);}return _0x1f427f;}return this[_0xd557('0xb')][_0xd557('0x30')](_0x2c8de5,_0xd557('0x1b1'));};AGIVertices[_0xd557('0xe')]['unpause']=function(_0x488ea3){logger[_0xd557('0x2b')](util['format'](_0xd557('0x1b2'),_0x488ea3['label']));if(!this[_0xd557('0x82')](_0x488ea3['findBy'])){return this[_0xd557('0xb')][_0xd557('0x30')](_0x488ea3,_0xd557('0x150'));}logger['info'](util['format'](_0xd557('0x151'),this[_0xd557('0xb')][_0xd557('0x37')],_0x488ea3[_0xd557('0x14f')]));var _0x3bfd92=this['agentUnpause'][_0xd557('0x6c')](this,_0x488ea3[_0xd557('0x14f')]);if(_0x3bfd92){logger['info'](util[_0xd557('0x26')](_0xd557('0x152'),this['channel'][_0xd557('0x37')],_0x488ea3[_0xd557('0x14f')]));this[_0xd557('0xb')][_0xd557('0xa6')](util[_0xd557('0x26')](_0xd557('0x152'),this['channel'][_0xd557('0x37')],_0x488ea3['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0xd557('0x2b')](util[_0xd557('0x26')](_0xd557('0x154'),this[_0xd557('0xb')][_0xd557('0x37')],_0x488ea3[_0xd557('0x14f')]));this[_0xd557('0xb')][_0xd557('0xa6')](util[_0xd557('0x26')](_0xd557('0x154'),this[_0xd557('0xb')][_0xd557('0x37')],_0x488ea3[_0xd557('0x14f')]));return{'code':0xc8,'result':_0xd557('0x155')};}};AGIVertices[_0xd557('0xe')][_0xd557('0x1b3')]=function(_0x1c6c01){logger['info'](util[_0xd557('0x26')](_0xd557('0x1b4'),_0x1c6c01[_0xd557('0x35')]));var _0x1fb81d=this['channel'][_0xd557('0x53')](_0xd557('0x1b5'),[_0x1c6c01['mailbox'],_0x1c6c01['options']]);if(_0x1fb81d[_0xd557('0xa0')]===-0x1){return _0x1fb81d;}return this[_0xd557('0xb')][_0xd557('0xa6')](util[_0xd557('0x26')](_0xd557('0xbd'),'VOICEMAIL',_0x1c6c01[_0xd557('0x1b6')]));};AGIVertices[_0xd557('0xe')][_0xd557('0x1b7')]=function(_0x2422eb){logger[_0xd557('0x2b')](util[_0xd557('0x26')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x2422eb[_0xd557('0x35')]));if(!this[_0xd557('0x82')](_0x2422eb['variable_id'])){return this[_0xd557('0xb')]['error'](_0x2422eb,'no\x20variable\x20selected');}var _0x4de515=this[_0xd557('0xf')][_0xd557('0x6c')](this,_0x2422eb['variable_id']);if(!_0x4de515){return this['channel']['error'](_0x2422eb,'no\x20variable\x20found');}var _0x4f7110=this[_0xd557('0xb')]['getVariable'](_0x4de515);return{'code':0xc8,'result':_0x4f7110[_0xd557('0x9e')]?_0x4f7110[_0xd557('0x9e')]:'-'};};String[_0xd557('0xe')][_0xd557('0x1b8')]=function(_0x412def,_0x5c1e02){return this[_0xd557('0x9d')](_0x412def)[_0xd557('0x1b9')](_0x5c1e02);};module[_0xd557('0x1ba')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 1626fb4..7c3a648 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 _0x3fe9=['voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','finally','[ACW][START]\x20%s','message','prototype','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','acw','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','moment','../ami','../../../config/logger','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','interface','queue','ACW','mandatoryDisposition','name','mandatoryDispositionPause','Action','QueuePause','then','getAgent'];(function(_0x4d843f,_0x4a4401){var _0x58a99e=function(_0x7c4b86){while(--_0x7c4b86){_0x4d843f['push'](_0x4d843f['shift']());}};_0x58a99e(++_0x4a4401);}(_0x3fe9,0xe6));var _0x93fe=function(_0x40a28a,_0x411bd2){_0x40a28a=_0x40a28a-0x0;var _0x116883=_0x3fe9[_0x40a28a];return _0x116883;};'use strict';var _=require('lodash');var moment=require(_0x93fe('0x0'));var ami=require(_0x93fe('0x1'));var logger=require(_0x93fe('0x2'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x93fe('0x3'));function Acw(_0x30fd2c){this[_0x93fe('0x4')]=_0x30fd2c[_0x93fe('0x4')];this[_0x93fe('0x5')]=_0x30fd2c['agents'];this[_0x93fe('0x6')]=_0x30fd2c[_0x93fe('0x6')];this[_0x93fe('0x7')]={};ami['on'](_0x93fe('0x8'),this[_0x93fe('0x9')][_0x93fe('0xa')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0x93fe('0xa')](this));ami['on'](_0x93fe('0xb'),this[_0x93fe('0xc')][_0x93fe('0xa')](this));ami['on'](_0x93fe('0xd'),this[_0x93fe('0xe')][_0x93fe('0xa')](this));ami['on'](_0x93fe('0xf'),this[_0x93fe('0x10')][_0x93fe('0xa')](this));ami['on'](_0x93fe('0x11'),this[_0x93fe('0x12')]['bind'](this));ami['on'](_0x93fe('0x13'),this[_0x93fe('0x14')][_0x93fe('0xa')](this));}function getDiff(_0x1dbffa){var _0x47d4dc=moment()['milliseconds'](0x0);var _0x47657c=moment(_0x1dbffa)[_0x93fe('0x15')](0x0);return _0x47d4dc[_0x93fe('0x16')](_0x47657c,_0x93fe('0x17'));}Acw['prototype']['startAcw']=function(_0x17fa13){try{var _0x33b23f=this;var _0x5b873e=this[_0x93fe('0x7')][_0x17fa13][_0x93fe('0x18')];var _0x4e702e=this[_0x93fe('0x7')][_0x17fa13][_0x93fe('0x19')];var _0x225486=this['voiceQueues'][_0x4e702e];var _0x1bc86e=![];var _0x4ef137=_0x93fe('0x1a');if(_0x225486[_0x93fe('0x1b')]){if(_0x225486['mandatoryDispositionPause'][_0x93fe('0x1c')]){_0x1bc86e=!![];_0x4ef137=_0x225486[_0x93fe('0x1d')][_0x93fe('0x1c')];}}return ami[_0x93fe('0x1e')]({'action':_0x93fe('0x1f'),'interface':_0x5b873e,'paused':!![],'reason':_0x4ef137})[_0x93fe('0x20')](function(){if(_0x33b23f[_0x93fe('0x5')][_0x5b873e]){return RpcUser[_0x93fe('0x21')](_0x33b23f[_0x93fe('0x5')][_0x5b873e]['id'])['then'](function(_0x44f8c3){if(_0x44f8c3&&!_0x44f8c3[_0x93fe('0x22')]){logger['info'](_0x93fe('0x23'),_0x17fa13,_0x5b873e,_0x4e702e);var _0x11bf0a=_0x33b23f[_0x93fe('0x7')][_0x17fa13][_0x93fe('0x24')]&&_0x33b23f[_0x93fe('0x7')][_0x17fa13][_0x93fe('0x25')]?_0x33b23f[_0x93fe('0x7')][_0x17fa13][_0x93fe('0x25')]:_0x17fa13;return RpcUser[_0x93fe('0x26')](_0x33b23f[_0x93fe('0x5')][_0x5b873e],_0x4ef137,_0x11bf0a)[_0x93fe('0x20')](function(){if(!_0x1bc86e){_0x33b23f['timers'][_0x5b873e]={};logger[_0x93fe('0x27')](_0x93fe('0x28'),_0x17fa13,_0x33b23f['voiceQueues'][_0x4e702e][_0x93fe('0x29')],_0x5b873e,_0x4e702e);_0x33b23f[_0x93fe('0x6')][_0x5b873e][_0x93fe('0x2a')]=setTimeout(_0x33b23f[_0x93fe('0x2b')][_0x93fe('0xa')](_0x33b23f,_0x5b873e),_0x33b23f['voiceQueues'][_0x4e702e]['acwTimeout']*0x3e8);_0x33b23f[_0x93fe('0x6')][_0x5b873e][_0x93fe('0x2c')]=moment()[_0x93fe('0x2d')](_0x93fe('0x2e'));_0x33b23f[_0x93fe('0x6')][_0x5b873e][_0x93fe('0x2f')]=_0x17fa13;_0x33b23f[_0x93fe('0x6')][_0x5b873e][_0x93fe('0x19')]=_0x4e702e;_0x33b23f[_0x93fe('0x6')][_0x5b873e][_0x93fe('0x30')]=function(){var _0x1d5853=getDiff(_0x33b23f[_0x93fe('0x6')][_0x5b873e][_0x93fe('0x2c')]);clearTimeout(_0x33b23f[_0x93fe('0x6')][_0x5b873e][_0x93fe('0x2a')]);_0x33b23f[_0x93fe('0x6')][_0x5b873e][_0x93fe('0x2a')]=![];RpcVoiceAgentReport[_0x93fe('0x31')]({'acwtime':_0x1d5853},_0x33b23f[_0x93fe('0x6')][_0x5b873e]['uniqueid'],_0x5b873e)[_0x93fe('0x20')](function(_0x504df4){logger[_0x93fe('0x27')](_0x93fe('0x32'),_0x17fa13,_0x1d5853,_0x504df4);})[_0x93fe('0x33')](function(_0x227859){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x17fa13,_0x227859);});delete _0x33b23f[_0x93fe('0x6')][_0x5b873e];};}});}else{logger[_0x93fe('0x27')](_0x93fe('0x34'),_0x17fa13,_0x5b873e,_0x4e702e);}});}})[_0x93fe('0x33')](function(){logger[_0x93fe('0x35')](_0x93fe('0x28'),_0x17fa13,_0x33b23f[_0x93fe('0x4')][_0x4e702e][_0x93fe('0x29')],_0x5b873e,_0x4e702e);})[_0x93fe('0x36')](function(){delete _0x33b23f[_0x93fe('0x7')][_0x17fa13];});}catch(_0x52ae7){logger[_0x93fe('0x35')](_0x93fe('0x37'),_0x52ae7[_0x93fe('0x38')]);}};Acw[_0x93fe('0x39')][_0x93fe('0x2b')]=function(_0x410d46){try{var _0x2d54dd=this;if(_0x2d54dd['timers'][_0x410d46]){_0x2d54dd[_0x93fe('0x6')][_0x410d46][_0x93fe('0x2a')]=![];var _0x18c7ff=_0x2d54dd[_0x93fe('0x6')][_0x410d46]['uniqueid'];var _0x3b2915=_0x2d54dd[_0x93fe('0x6')][_0x410d46]['queue'];var _0x211ce5=_0x2d54dd[_0x93fe('0x4')][_0x3b2915]['acwTimeout'];logger[_0x93fe('0x27')]('[%s][TIMER][STOP][AGENT:%s]',_0x18c7ff,_0x410d46);RpcUser[_0x93fe('0x3a')](this[_0x93fe('0x5')][_0x410d46]);RpcVoiceAgentReport['update']({'acwtime':_0x211ce5,'agentacw':!![]},_0x18c7ff,_0x410d46)[_0x93fe('0x20')](function(_0x397cdb){logger[_0x93fe('0x27')]('[%s][UPDATE][ACWTIME:%s]',_0x18c7ff,_0x211ce5,_0x397cdb);})['catch'](function(_0x77a95c){logger[_0x93fe('0x35')]('[%s][UPDATE][ERRORS:%s]',_0x18c7ff,_0x77a95c);});}else{logger[_0x93fe('0x35')](_0x93fe('0x3b'),_0x410d46);if(_0x2d54dd[_0x93fe('0x6')]){logger[_0x93fe('0x27')](_0x93fe('0x3c'),JSON[_0x93fe('0x3d')](_0x2d54dd['timers']));}}}catch(_0x377cf6){logger[_0x93fe('0x35')](_0x93fe('0x3e'),_0x377cf6['message']);}};Acw[_0x93fe('0x39')][_0x93fe('0x9')]=function(_0x192bc1){try{if(this[_0x93fe('0x4')][_0x192bc1[_0x93fe('0x19')]]&&(this[_0x93fe('0x4')][_0x192bc1[_0x93fe('0x19')]]['acw']||this['voiceQueues'][_0x192bc1[_0x93fe('0x19')]]['mandatoryDisposition'])){if(this['agents'][_0x192bc1[_0x93fe('0x18')]]){this[_0x93fe('0x7')][_0x192bc1[_0x93fe('0x2f')]]={'queue':_0x192bc1['queue'],'interface':_0x192bc1[_0x93fe('0x18')],'destlinkedid':_0x192bc1[_0x93fe('0x25')]};}}}catch(_0x4e3091){logger[_0x93fe('0x35')]('[ACW][syncAgentConnect]\x20%s',_0x4e3091[_0x93fe('0x38')]);}};Acw[_0x93fe('0x39')][_0x93fe('0x14')]=function(_0x2d6f28){try{if(this[_0x93fe('0x4')][_0x2d6f28[_0x93fe('0x19')]]&&(this[_0x93fe('0x4')][_0x2d6f28[_0x93fe('0x19')]][_0x93fe('0x3f')]||this[_0x93fe('0x4')][_0x2d6f28[_0x93fe('0x19')]][_0x93fe('0x1b')])){if(this[_0x93fe('0x5')][_0x2d6f28[_0x93fe('0x18')]]){this[_0x93fe('0x7')][_0x2d6f28[_0x93fe('0x2f')]]={'queue':_0x2d6f28[_0x93fe('0x19')],'interface':_0x2d6f28[_0x93fe('0x18')]};}}}catch(_0x4eba0b){logger[_0x93fe('0x35')]('[ACW][syncAgentConnectPreview]\x20%s',_0x4eba0b[_0x93fe('0x38')]);}};Acw[_0x93fe('0x39')][_0x93fe('0x40')]=function(_0x3db024){try{if(this[_0x93fe('0x7')][_0x3db024[_0x93fe('0x2f')]]&&_[_0x93fe('0x41')](this[_0x93fe('0x7')][_0x3db024[_0x93fe('0x2f')]][_0x93fe('0x24')])){logger[_0x93fe('0x27')](_0x93fe('0x42'),_0x3db024[_0x93fe('0x2f')]);this[_0x93fe('0x43')](_0x3db024[_0x93fe('0x2f')]);}else if(this[_0x93fe('0x7')][_0x3db024[_0x93fe('0x44')]]&&_[_0x93fe('0x41')](this[_0x93fe('0x7')][_0x3db024['linkedid']][_0x93fe('0x24')])){logger[_0x93fe('0x27')](_0x93fe('0x45'),_0x3db024[_0x93fe('0x44')]);this[_0x93fe('0x43')](_0x3db024['linkedid']);}}catch(_0x5be9f8){logger[_0x93fe('0x35')](_0x93fe('0x46'),_0x5be9f8[_0x93fe('0x38')]);}};Acw[_0x93fe('0x39')][_0x93fe('0xc')]=function(_0x16ac9e){try{if(this['channels'][_0x16ac9e[_0x93fe('0x2f')]]&&this['channels'][_0x16ac9e['uniqueid']]['attended']){logger[_0x93fe('0x27')](_0x93fe('0x47'),_0x16ac9e[_0x93fe('0x2f')]);this[_0x93fe('0x43')](_0x16ac9e[_0x93fe('0x2f')]);}else if(this[_0x93fe('0x7')][_0x16ac9e[_0x93fe('0x44')]]&&this['channels'][_0x16ac9e[_0x93fe('0x44')]][_0x93fe('0x24')]){logger['info'](_0x93fe('0x48'),_0x16ac9e['linkedid']);this[_0x93fe('0x43')](_0x16ac9e[_0x93fe('0x44')]);}}catch(_0x3248ca){logger[_0x93fe('0x35')](_0x93fe('0x49'),_0x3248ca[_0x93fe('0x38')]);}};Acw[_0x93fe('0x39')][_0x93fe('0x10')]=function(_0x5d8df5){try{if(!_['isNil'](this[_0x93fe('0x7')][_0x5d8df5[_0x93fe('0x4a')]])){this[_0x93fe('0x43')](_0x5d8df5[_0x93fe('0x4a')]);if(this['channels'][_0x5d8df5['secondtransfereruniqueid']]){this[_0x93fe('0x7')][_0x5d8df5['secondtransfereruniqueid']][_0x93fe('0x24')]=!![];this['channels'][_0x5d8df5['transfertargetuniqueid']]=this[_0x93fe('0x7')][_0x5d8df5[_0x93fe('0x4b')]];delete this['channels'][_0x5d8df5[_0x93fe('0x4b')]];}}else if(!_['isNil'](this[_0x93fe('0x7')][_0x5d8df5[_0x93fe('0x4c')]])){this[_0x93fe('0x43')](_0x5d8df5[_0x93fe('0x4c')]);if(this['channels'][_0x5d8df5[_0x93fe('0x4d')]]){this[_0x93fe('0x7')][_0x5d8df5[_0x93fe('0x4d')]]['attended']=!![];this[_0x93fe('0x7')][_0x5d8df5[_0x93fe('0x4a')]]=this[_0x93fe('0x7')][_0x5d8df5[_0x93fe('0x4d')]];delete this[_0x93fe('0x7')][_0x5d8df5[_0x93fe('0x4d')]];}}}catch(_0xa14d7f){logger[_0x93fe('0x35')](_0x93fe('0x4e'),_0xa14d7f['message']);}};Acw[_0x93fe('0x39')]['syncBlindTransfer']=function(_0x1c0eb3){try{if(this[_0x93fe('0x7')][_0x1c0eb3['transfereruniqueid']]){logger['info'](_0x93fe('0x4f'),JSON['stringify'](_0x1c0eb3[_0x93fe('0x50')]));this['startAcw'](_0x1c0eb3[_0x93fe('0x50')]);}else if(this[_0x93fe('0x7')][_0x1c0eb3['transfererlinkedid']]){logger['info'](_0x93fe('0x51'),JSON[_0x93fe('0x3d')](_0x1c0eb3[_0x93fe('0x52')]));this['startAcw'](_0x1c0eb3['transfererlinkedid']);}}catch(_0x1d0cd9){logger[_0x93fe('0x35')](_0x93fe('0x53'),_0x1d0cd9[_0x93fe('0x38')]);}};Acw[_0x93fe('0x39')][_0x93fe('0xe')]=function(_0x5a2112){try{if(this[_0x93fe('0x4')][_0x5a2112[_0x93fe('0x19')]]&&this[_0x93fe('0x4')][_0x5a2112[_0x93fe('0x19')]][_0x93fe('0x54')]===_0x93fe('0x55')){if(this[_0x93fe('0x5')][_0x5a2112[_0x93fe('0x18')]]){logger['info'](_0x93fe('0x56'),_0x5a2112['uniqueid'],_0x5a2112['interface'],_0x5a2112[_0x93fe('0x19')]);return RpcUser['savePause'](this[_0x93fe('0x5')][_0x5a2112['interface']],'Auto-Pause',_0x5a2112[_0x93fe('0x2f')]);}}}catch(_0x39d4eb){logger[_0x93fe('0x35')](_0x93fe('0x57'),_0x39d4eb['message']);}};module['exports']=Acw; \ No newline at end of file +var _0x5365=['then','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','format','uniqueid','updateAcw','lastPauseAt','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','prototype','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','syncAgentConnect','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','syncBlindTransfer','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','moment','../ami','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','startAcw','channels','interface','queue','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid'];(function(_0x490815,_0x28bb61){var _0x1f5f52=function(_0x1997b8){while(--_0x1997b8){_0x490815['push'](_0x490815['shift']());}};_0x1f5f52(++_0x28bb61);}(_0x5365,0x13c));var _0x5536=function(_0x2fb9e8,_0x9d4f2){_0x2fb9e8=_0x2fb9e8-0x0;var _0xc45d8d=_0x5365[_0x2fb9e8];return _0xc45d8d;};'use strict';var _=require('lodash');var moment=require(_0x5536('0x0'));var ami=require(_0x5536('0x1'));var logger=require('../../../config/logger')(_0x5536('0x2'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x5536('0x3'));function Acw(_0x115e57){this[_0x5536('0x4')]=_0x115e57[_0x5536('0x4')];this['agents']=_0x115e57[_0x5536('0x5')];this[_0x5536('0x6')]=_0x115e57[_0x5536('0x6')];this['channels']={};ami['on'](_0x5536('0x7'),this['syncAgentConnect'][_0x5536('0x8')](this));ami['on'](_0x5536('0x9'),this[_0x5536('0xa')][_0x5536('0x8')](this));ami['on'](_0x5536('0xb'),this[_0x5536('0xc')][_0x5536('0x8')](this));ami['on'](_0x5536('0xd'),this[_0x5536('0xe')][_0x5536('0x8')](this));ami['on']('attendedtransfer',this[_0x5536('0xf')]['bind'](this));ami['on'](_0x5536('0x10'),this['syncBlindTransfer'][_0x5536('0x8')](this));ami['on'](_0x5536('0x11'),this[_0x5536('0x12')]['bind'](this));}function getDiff(_0x3c24e6){var _0x3e4239=moment()[_0x5536('0x13')](0x0);var _0x117a0c=moment(_0x3c24e6)[_0x5536('0x13')](0x0);return _0x3e4239[_0x5536('0x14')](_0x117a0c,_0x5536('0x15'));}Acw['prototype'][_0x5536('0x16')]=function(_0x521545){try{var _0xa7e311=this;var _0xdf7e42=this[_0x5536('0x17')][_0x521545][_0x5536('0x18')];var _0x1c0e93=this[_0x5536('0x17')][_0x521545][_0x5536('0x19')];var _0xd8a1e4=this[_0x5536('0x4')][_0x1c0e93];var _0x2f7a24=![];var _0x55fe21='ACW';if(_0xd8a1e4[_0x5536('0x1a')]){if(_0xd8a1e4[_0x5536('0x1b')][_0x5536('0x1c')]){_0x2f7a24=!![];_0x55fe21=_0xd8a1e4['mandatoryDispositionPause'][_0x5536('0x1c')];}}return ami[_0x5536('0x1d')]({'action':_0x5536('0x1e'),'interface':_0xdf7e42,'paused':!![],'reason':_0x55fe21})['then'](function(){if(_0xa7e311['agents'][_0xdf7e42]){return RpcUser['getAgent'](_0xa7e311['agents'][_0xdf7e42]['id'])['then'](function(_0x176aed){if(_0x176aed&&!_0x176aed[_0x5536('0x1f')]){logger[_0x5536('0x20')](_0x5536('0x21'),_0x521545,_0xdf7e42,_0x1c0e93);var _0x5a347f=_0xa7e311[_0x5536('0x17')][_0x521545][_0x5536('0x22')]&&_0xa7e311[_0x5536('0x17')][_0x521545][_0x5536('0x23')]?_0xa7e311['channels'][_0x521545][_0x5536('0x23')]:_0x521545;return RpcUser['savePause'](_0xa7e311[_0x5536('0x5')][_0xdf7e42],_0x55fe21,_0x5a347f)[_0x5536('0x24')](function(){if(!_0x2f7a24){_0xa7e311[_0x5536('0x6')][_0xdf7e42]={};logger[_0x5536('0x20')](_0x5536('0x25'),_0x521545,_0xa7e311['voiceQueues'][_0x1c0e93][_0x5536('0x26')],_0xdf7e42,_0x1c0e93);_0xa7e311[_0x5536('0x6')][_0xdf7e42][_0x5536('0x27')]=setTimeout(_0xa7e311[_0x5536('0x28')][_0x5536('0x8')](_0xa7e311,_0xdf7e42),_0xa7e311[_0x5536('0x4')][_0x1c0e93][_0x5536('0x26')]*0x3e8);_0xa7e311['timers'][_0xdf7e42]['lastPauseAt']=moment()[_0x5536('0x29')]('YYYY-MM-DD\x20HH:mm:ss');_0xa7e311[_0x5536('0x6')][_0xdf7e42][_0x5536('0x2a')]=_0x521545;_0xa7e311['timers'][_0xdf7e42]['queue']=_0x1c0e93;_0xa7e311[_0x5536('0x6')][_0xdf7e42][_0x5536('0x2b')]=function(){var _0x4ae1c6=getDiff(_0xa7e311[_0x5536('0x6')][_0xdf7e42][_0x5536('0x2c')]);clearTimeout(_0xa7e311[_0x5536('0x6')][_0xdf7e42][_0x5536('0x27')]);_0xa7e311[_0x5536('0x6')][_0xdf7e42]['timer']=![];RpcVoiceAgentReport['update']({'acwtime':_0x4ae1c6},_0xa7e311[_0x5536('0x6')][_0xdf7e42][_0x5536('0x2a')],_0xdf7e42)[_0x5536('0x24')](function(_0x35b68c){logger[_0x5536('0x20')](_0x5536('0x2d'),_0x521545,_0x4ae1c6,_0x35b68c);})[_0x5536('0x2e')](function(_0x3a1c26){logger[_0x5536('0x2f')]('[%s][UPDATE][ERRORS:%s]',_0x521545,_0x3a1c26);});delete _0xa7e311[_0x5536('0x6')][_0xdf7e42];};}});}else{logger[_0x5536('0x20')](_0x5536('0x30'),_0x521545,_0xdf7e42,_0x1c0e93);}});}})[_0x5536('0x2e')](function(){logger[_0x5536('0x2f')](_0x5536('0x25'),_0x521545,_0xa7e311[_0x5536('0x4')][_0x1c0e93][_0x5536('0x26')],_0xdf7e42,_0x1c0e93);})[_0x5536('0x31')](function(){delete _0xa7e311[_0x5536('0x17')][_0x521545];});}catch(_0x9bb1b){logger[_0x5536('0x2f')](_0x5536('0x32'),_0x9bb1b[_0x5536('0x33')]);}};Acw[_0x5536('0x34')][_0x5536('0x28')]=function(_0x4ee7d6){try{var _0x19f136=this;if(_0x19f136['timers'][_0x4ee7d6]){_0x19f136[_0x5536('0x6')][_0x4ee7d6]['timer']=![];var _0x4d7bf0=_0x19f136[_0x5536('0x6')][_0x4ee7d6][_0x5536('0x2a')];var _0x3f7720=_0x19f136[_0x5536('0x6')][_0x4ee7d6][_0x5536('0x19')];var _0xad50f=_0x19f136[_0x5536('0x4')][_0x3f7720][_0x5536('0x26')];logger[_0x5536('0x20')](_0x5536('0x35'),_0x4d7bf0,_0x4ee7d6);RpcUser[_0x5536('0x36')](this[_0x5536('0x5')][_0x4ee7d6]);RpcVoiceAgentReport[_0x5536('0x37')]({'acwtime':_0xad50f,'agentacw':!![]},_0x4d7bf0,_0x4ee7d6)[_0x5536('0x24')](function(_0x1cdb0d){logger[_0x5536('0x20')](_0x5536('0x2d'),_0x4d7bf0,_0xad50f,_0x1cdb0d);})['catch'](function(_0x124a66){logger[_0x5536('0x2f')](_0x5536('0x38'),_0x4d7bf0,_0x124a66);});}else{logger[_0x5536('0x2f')](_0x5536('0x39'),_0x4ee7d6);if(_0x19f136[_0x5536('0x6')]){logger[_0x5536('0x20')](_0x5536('0x3a'),JSON[_0x5536('0x3b')](_0x19f136['timers']));}}}catch(_0x22a603){logger['error'](_0x5536('0x3c'),_0x22a603[_0x5536('0x33')]);}};Acw[_0x5536('0x34')][_0x5536('0x3d')]=function(_0x21126b){try{if(this['voiceQueues'][_0x21126b[_0x5536('0x19')]]&&(this['voiceQueues'][_0x21126b[_0x5536('0x19')]][_0x5536('0x2')]||this[_0x5536('0x4')][_0x21126b[_0x5536('0x19')]]['mandatoryDisposition'])){if(this[_0x5536('0x5')][_0x21126b['interface']]){this['channels'][_0x21126b[_0x5536('0x2a')]]={'queue':_0x21126b[_0x5536('0x19')],'interface':_0x21126b[_0x5536('0x18')],'destlinkedid':_0x21126b['destlinkedid']};}}}catch(_0x503d89){logger['error'](_0x5536('0x3e'),_0x503d89[_0x5536('0x33')]);}};Acw[_0x5536('0x34')][_0x5536('0x12')]=function(_0x210945){try{if(this[_0x5536('0x4')][_0x210945['queue']]&&(this[_0x5536('0x4')][_0x210945[_0x5536('0x19')]][_0x5536('0x2')]||this[_0x5536('0x4')][_0x210945[_0x5536('0x19')]][_0x5536('0x1a')])){if(this[_0x5536('0x5')][_0x210945[_0x5536('0x18')]]){this[_0x5536('0x17')][_0x210945[_0x5536('0x2a')]]={'queue':_0x210945[_0x5536('0x19')],'interface':_0x210945[_0x5536('0x18')]};}}}catch(_0x336285){logger[_0x5536('0x2f')](_0x5536('0x3f'),_0x336285[_0x5536('0x33')]);}};Acw['prototype'][_0x5536('0xa')]=function(_0x1d4f19){try{if(this[_0x5536('0x17')][_0x1d4f19[_0x5536('0x2a')]]&&_[_0x5536('0x40')](this[_0x5536('0x17')][_0x1d4f19[_0x5536('0x2a')]][_0x5536('0x22')])){logger[_0x5536('0x20')]('[%s][HANGUP:UNIQUEID]',_0x1d4f19['uniqueid']);this[_0x5536('0x16')](_0x1d4f19[_0x5536('0x2a')]);}else if(this[_0x5536('0x17')][_0x1d4f19[_0x5536('0x41')]]&&_[_0x5536('0x40')](this[_0x5536('0x17')][_0x1d4f19[_0x5536('0x41')]][_0x5536('0x22')])){logger['info'](_0x5536('0x42'),_0x1d4f19['linkedid']);this[_0x5536('0x16')](_0x1d4f19[_0x5536('0x41')]);}}catch(_0x585d13){logger[_0x5536('0x2f')]('[ACW][syncHangupRequest]\x20%s',_0x585d13[_0x5536('0x33')]);}};Acw['prototype'][_0x5536('0xc')]=function(_0x5d3018){try{if(this['channels'][_0x5d3018[_0x5536('0x2a')]]&&this[_0x5536('0x17')][_0x5d3018[_0x5536('0x2a')]][_0x5536('0x22')]){logger['info'](_0x5536('0x43'),_0x5d3018[_0x5536('0x2a')]);this['startAcw'](_0x5d3018[_0x5536('0x2a')]);}else if(this[_0x5536('0x17')][_0x5d3018[_0x5536('0x41')]]&&this[_0x5536('0x17')][_0x5d3018[_0x5536('0x41')]]['attended']){logger['info'](_0x5536('0x44'),_0x5d3018['linkedid']);this[_0x5536('0x16')](_0x5d3018[_0x5536('0x41')]);}}catch(_0x4542ad){logger[_0x5536('0x2f')](_0x5536('0x45'),_0x4542ad[_0x5536('0x33')]);}};Acw['prototype']['syncAttendedTransfer']=function(_0x317915){try{if(!_[_0x5536('0x46')](this[_0x5536('0x17')][_0x317915[_0x5536('0x47')]])){this['startAcw'](_0x317915[_0x5536('0x47')]);if(this[_0x5536('0x17')][_0x317915[_0x5536('0x48')]]){this['channels'][_0x317915['secondtransfereruniqueid']]['attended']=!![];this['channels'][_0x317915[_0x5536('0x49')]]=this[_0x5536('0x17')][_0x317915['secondtransfereruniqueid']];delete this[_0x5536('0x17')][_0x317915[_0x5536('0x48')]];}}else if(!_['isNil'](this['channels'][_0x317915['transfertargetuniqueid']])){this[_0x5536('0x16')](_0x317915[_0x5536('0x49')]);if(this[_0x5536('0x17')][_0x317915[_0x5536('0x4a')]]){this[_0x5536('0x17')][_0x317915[_0x5536('0x4a')]][_0x5536('0x22')]=!![];this[_0x5536('0x17')][_0x317915['transfereeuniqueid']]=this[_0x5536('0x17')][_0x317915[_0x5536('0x4a')]];delete this['channels'][_0x317915['origtransfereruniqueid']];}}}catch(_0x1b7bf2){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0x1b7bf2['message']);}};Acw[_0x5536('0x34')][_0x5536('0x4b')]=function(_0x5c38a7){try{if(this['channels'][_0x5c38a7['transfereruniqueid']]){logger[_0x5536('0x20')](_0x5536('0x4c'),JSON['stringify'](_0x5c38a7['transfereruniqueid']));this[_0x5536('0x16')](_0x5c38a7[_0x5536('0x4d')]);}else if(this[_0x5536('0x17')][_0x5c38a7[_0x5536('0x4e')]]){logger['info'](_0x5536('0x4f'),JSON[_0x5536('0x3b')](_0x5c38a7[_0x5536('0x4e')]));this[_0x5536('0x16')](_0x5c38a7[_0x5536('0x4e')]);}}catch(_0x56fabe){logger[_0x5536('0x2f')](_0x5536('0x50'),_0x56fabe[_0x5536('0x33')]);}};Acw[_0x5536('0x34')]['syncAgentRingNoAnswer']=function(_0x45319b){try{if(this['voiceQueues'][_0x45319b[_0x5536('0x19')]]&&this['voiceQueues'][_0x45319b['queue']][_0x5536('0x51')]===_0x5536('0x52')){if(this['agents'][_0x45319b[_0x5536('0x18')]]){logger[_0x5536('0x20')](_0x5536('0x53'),_0x45319b['uniqueid'],_0x45319b[_0x5536('0x18')],_0x45319b[_0x5536('0x19')]);return RpcUser[_0x5536('0x54')](this[_0x5536('0x5')][_0x45319b[_0x5536('0x18')]],_0x5536('0x55'),_0x45319b[_0x5536('0x2a')]);}}}catch(_0x45963c){logger[_0x5536('0x2f')](_0x5536('0x56'),_0x45963c[_0x5536('0x33')]);}};module[_0x5536('0x57')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 655d643..e41f09c 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 _0xf472=['coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','connect','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','[ami.js][fullybooted]','close','asterisk-manager','bluebird','util','../../config/logger','../../config/environment','asterisk','username','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels'];(function(_0x126d47,_0x217770){var _0x2cf53c=function(_0x154838){while(--_0x154838){_0x126d47['push'](_0x126d47['shift']());}};_0x2cf53c(++_0x217770);}(_0xf472,0x134));var _0x2f47=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf472[_0x321bb2];return _0x9c12ed;};'use strict';var Manager=require(_0x2f47('0x0'));var BPromise=require(_0x2f47('0x1'));var util=require(_0x2f47('0x2'));var logger=require(_0x2f47('0x3'))('ami');var config=require(_0x2f47('0x4'));var ami=new Manager(config[_0x2f47('0x5')]['port'],config[_0x2f47('0x5')]['ip'],config[_0x2f47('0x5')][_0x2f47('0x6')],config[_0x2f47('0x5')]['password'],!![]);ami[_0x2f47('0x7')]();ami[_0x2f47('0x8')]=BPromise[_0x2f47('0x9')](ami[_0x2f47('0xa')]);function error(_0x2a1b1e){logger[_0x2f47('0xb')](util[_0x2f47('0xc')](_0x2f47('0xd'),config[_0x2f47('0x5')][_0x2f47('0x6')],config[_0x2f47('0x5')]['ip'],config[_0x2f47('0x5')][_0x2f47('0xe')],util[_0x2f47('0xf')](_0x2a1b1e,![],null)));}function close(){logger[_0x2f47('0xb')](util[_0x2f47('0xc')](_0x2f47('0x10'),config[_0x2f47('0x5')][_0x2f47('0x6')],config['asterisk']['ip'],config['asterisk'][_0x2f47('0xe')]));}ami[_0x2f47('0x11')]=function(){return function(){return ami[_0x2f47('0x8')]({'action':_0x2f47('0x12')});};};ami[_0x2f47('0x13')]=function(){return function(){return ami[_0x2f47('0x8')]({'action':'devicestatelist'});};};ami[_0x2f47('0x14')]=function(){return function(){return ami[_0x2f47('0x8')]({'action':_0x2f47('0x15')});};};ami[_0x2f47('0x16')]=function(){return function(){return ami[_0x2f47('0x8')]({'action':_0x2f47('0x17')});};};ami[_0x2f47('0x18')]=function(){return function(){return ami[_0x2f47('0x8')]({'action':_0x2f47('0x19')});};};function connect(){logger['info'](util['format'](_0x2f47('0x1a'),config[_0x2f47('0x5')][_0x2f47('0x6')],config[_0x2f47('0x5')]['ip'],config['asterisk'][_0x2f47('0xe')]));ami[_0x2f47('0x1b')]('error',error);ami[_0x2f47('0x1b')]('close',close);}ami['on'](_0x2f47('0x1c'),connect);ami['on']('shutdown',function(_0x1ebfd9){logger[_0x2f47('0x1d')](util[_0x2f47('0xc')](_0x2f47('0x1e'),config[_0x2f47('0x5')][_0x2f47('0x6')],config[_0x2f47('0x5')]['ip'],config['asterisk']['port'],util['inspect'](_0x1ebfd9,![],null)));});ami['on'](_0x2f47('0x1f'),function(){logger[_0x2f47('0x1d')](util['format'](_0x2f47('0x20'),config[_0x2f47('0x5')][_0x2f47('0x6')],config[_0x2f47('0x5')]['ip'],config['asterisk']['port']));return Promise[_0x2f47('0x21')]()[_0x2f47('0x22')](ami[_0x2f47('0x11')]())[_0x2f47('0x22')](ami[_0x2f47('0x13')]())['then'](ami[_0x2f47('0x14')]())[_0x2f47('0x22')](ami[_0x2f47('0x16')]())['then'](ami[_0x2f47('0x18')]())['catch'](function(_0x4b7832){logger[_0x2f47('0xb')](_0x2f47('0x23'),util[_0x2f47('0xf')](_0x4b7832,{'showHidden':![],'depth':null}));});});ami[_0x2f47('0x1b')]('error',error);ami['once'](_0x2f47('0x24'),close);module['exports']=ami; \ No newline at end of file +var _0xc2ad=['exports','asterisk-manager','bluebird','ami','../../config/environment','asterisk','username','password','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','[ami.js][fullybooted]'];(function(_0x5e6cb8,_0x16cf56){var _0x3faeb3=function(_0x1a7355){while(--_0x1a7355){_0x5e6cb8['push'](_0x5e6cb8['shift']());}};_0x3faeb3(++_0x16cf56);}(_0xc2ad,0x155));var _0xdc2a=function(_0x2eb9f9,_0x46d52e){_0x2eb9f9=_0x2eb9f9-0x0;var _0x3a039b=_0xc2ad[_0x2eb9f9];return _0x3a039b;};'use strict';var Manager=require(_0xdc2a('0x0'));var BPromise=require(_0xdc2a('0x1'));var util=require('util');var logger=require('../../config/logger')(_0xdc2a('0x2'));var config=require(_0xdc2a('0x3'));var ami=new Manager(config['asterisk']['port'],config['asterisk']['ip'],config[_0xdc2a('0x4')][_0xdc2a('0x5')],config[_0xdc2a('0x4')][_0xdc2a('0x6')],!![]);ami['keepConnected']();ami[_0xdc2a('0x7')]=BPromise['promisify'](ami[_0xdc2a('0x8')]);function error(_0x554b85){logger[_0xdc2a('0x9')](util[_0xdc2a('0xa')](_0xdc2a('0xb'),config['asterisk']['username'],config['asterisk']['ip'],config['asterisk'][_0xdc2a('0xc')],util['inspect'](_0x554b85,![],null)));}function close(){logger['error'](util[_0xdc2a('0xa')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0xdc2a('0x5')],config[_0xdc2a('0x4')]['ip'],config[_0xdc2a('0x4')]['port']));}ami[_0xdc2a('0xd')]=function(){return function(){return ami['Action']({'action':_0xdc2a('0xe')});};};ami[_0xdc2a('0xf')]=function(){return function(){return ami['Action']({'action':_0xdc2a('0x10')});};};ami[_0xdc2a('0x11')]=function(){return function(){return ami[_0xdc2a('0x7')]({'action':'sippeerstatus'});};};ami[_0xdc2a('0x12')]=function(){return function(){return ami[_0xdc2a('0x7')]({'action':'queuesummary'});};};ami['actionCoreShowChannels']=function(){return function(){return ami['Action']({'action':_0xdc2a('0x13')});};};function connect(){logger[_0xdc2a('0x14')](util[_0xdc2a('0xa')](_0xdc2a('0x15'),config[_0xdc2a('0x4')][_0xdc2a('0x5')],config['asterisk']['ip'],config[_0xdc2a('0x4')][_0xdc2a('0xc')]));ami[_0xdc2a('0x16')](_0xdc2a('0x9'),error);ami[_0xdc2a('0x16')](_0xdc2a('0x17'),close);}ami['on'](_0xdc2a('0x18'),connect);ami['on'](_0xdc2a('0x19'),function(_0x3a0ad8){logger['info'](util[_0xdc2a('0xa')](_0xdc2a('0x1a'),config[_0xdc2a('0x4')][_0xdc2a('0x5')],config['asterisk']['ip'],config[_0xdc2a('0x4')][_0xdc2a('0xc')],util[_0xdc2a('0x1b')](_0x3a0ad8,![],null)));});ami['on'](_0xdc2a('0x1c'),function(){logger[_0xdc2a('0x14')](util[_0xdc2a('0xa')](_0xdc2a('0x1d'),config['asterisk']['username'],config[_0xdc2a('0x4')]['ip'],config[_0xdc2a('0x4')][_0xdc2a('0xc')]));return Promise[_0xdc2a('0x1e')]()['then'](ami[_0xdc2a('0xd')]())[_0xdc2a('0x1f')](ami[_0xdc2a('0xf')]())[_0xdc2a('0x1f')](ami[_0xdc2a('0x11')]())['then'](ami['actionQueueSummary']())[_0xdc2a('0x1f')](ami['actionCoreShowChannels']())['catch'](function(_0x4856ec){logger[_0xdc2a('0x9')](_0xdc2a('0x20'),util['inspect'](_0x4856ec,{'showHidden':![],'depth':null}));});});ami[_0xdc2a('0x16')](_0xdc2a('0x9'),error);ami[_0xdc2a('0x16')](_0xdc2a('0x17'),close);module[_0xdc2a('0x21')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index c75fd66..4f23d42 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 _0x70e0=['catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','then','memberReport','error','rpc','message','result'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x70e0,0x17b));var _0x070e=function(_0x1381df,_0x3301fc){_0x1381df=_0x1381df-0x0;var _0x78eeb0=_0x70e0[_0x1381df];return _0x78eeb0;};'use strict';var jayson=require(_0x070e('0x0'));var BPromise=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('ami');var client=jayson['client'][_0x070e('0x3')]({'port':0x2329});client[_0x070e('0x4')]=function(_0x277d32,_0x2593e5){return new BPromise(function(_0x5c90fc,_0x7bce9b){return client['request'](_0x277d32,_0x2593e5)[_0x070e('0x5')](function(_0x4b041d){logger['debug']('rpc',_0x070e('0x6'),_0x277d32,_0x2593e5,_0x4b041d);if(_0x4b041d[_0x070e('0x7')]){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x4b041d[_0x070e('0x7')][_0x070e('0x9')],_0x2593e5);return _0x7bce9b(_0x4b041d['error']['message']);}else{return _0x5c90fc(_0x4b041d[_0x070e('0xa')]);}})[_0x070e('0xb')](function(_0x12bb37){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x12bb37,_0x2593e5);return _0x7bce9b(_0x12bb37);});});};module[_0x070e('0xc')]=client; \ No newline at end of file +var _0xd8b0=['message','result','catch','exports','jayson/promise','bluebird','http','Request','then','debug','memberReport','error','rpc'];(function(_0x9a51b3,_0x34ac18){var _0x4ca7b1=function(_0x455c6d){while(--_0x455c6d){_0x9a51b3['push'](_0x9a51b3['shift']());}};_0x4ca7b1(++_0x34ac18);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var jayson=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('ami');var client=jayson['client'][_0x0d8b('0x2')]({'port':0x2329});client[_0x0d8b('0x3')]=function(_0x43bca1,_0x364286){return new BPromise(function(_0x8196ed,_0x577834){return client['request'](_0x43bca1,_0x364286)[_0x0d8b('0x4')](function(_0x227c63){logger[_0x0d8b('0x5')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x364286,_0x227c63);if(_0x227c63[_0x0d8b('0x7')]){logger['error'](_0x0d8b('0x8'),_0x0d8b('0x6'),_0x43bca1,_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')],_0x364286);return _0x577834(_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')]);}else{return _0x8196ed(_0x227c63[_0x0d8b('0xa')]);}})[_0x0d8b('0xb')](function(_0x48fa16){logger[_0x0d8b('0x7')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x48fa16,_0x364286);return _0x577834(_0x48fa16);});});};module[_0x0d8b('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index ceda212..2452774 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 _0xb42b=['calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','countabandonedretry','dialAbandonedMaxRetry','VoiceQueueId','swapAdditionalPhones','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','status','stateinterface','pick','idHopper','paused','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','responsetime','getQueue','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','outboundAnswerCallsDay','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','dialGlobalMaxRetry','stateGlobal','createStateFinal','dialMachineRetryFrequency','[rescheduleContact][Machine]','HangupInAMD','membername','AMD','[syncHangupInAMDIvr][createHistory]','MACHINE','countagentrejectretry','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Unknow','running','statusMessage','getQueueCampaignStatusMessage','available','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','online','handlePreviewRecallNotifications','map','user:%s','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','undefined','sequence','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','UserId','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','user:dialPreviewRecallReminder','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','dialQueueOptions','dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','updatedAt','%s%s','XMD-','toUpper','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','dialOriginateCallerIdName','originatecalleridname','extractCalleridName','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','dialOriginateTimeout','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','originate\x20action\x20Error','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','predictiveIntervalAvailable','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dropRate','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','Agent','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]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','dialOrderByScheduledAt','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','[actionOriginate]\x20','checkIsBlackList','tryOriginatePredictive','[handlePredictive][limitChannel]','countReScheduled','[countReScheduled]\x20','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','uuid','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','predictive','syncQueueSummary','../ami','defaults','redis','localhost','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/agentComplete','./models/queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','startPredictive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','syncAgentConnect','bind','queuecallerabandon','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','---------------------------','predictiveIntervalTotalCalls','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','merge','getSeconds','startProgressive','startProgressive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','message','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Interval','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20disactive','[ifTime][Action]','stringify','prototype','isTrunkReachable','format','reachable','SIP/%s','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','push','Action','command','content','indexOf','true','catch','iftime\x20%s,%s','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','loopCampaigns','resetActiveCalls','syncCampaigns','resolve','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','booked','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','Error','queue','uniqueId','uniqueid','ivr','updateOriginated','YYYY-MM-DD\x20HH:mm:ss','agent','agiafterat','dialQueueProject2','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','syncQueueCallerAbandon','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','ListId','CampaignId','[rescheduleContact][Drop]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb42b,0x144));var _0xbb42=function(_0x5b8df8,_0xb6d5b3){_0x5b8df8=_0x5b8df8-0x0;var _0x59f62c=_0xb42b[_0x5b8df8];return _0x59f62c;};'use strict';var util=require(_0xbb42('0x0'));var _=require('lodash');var uuid=require(_0xbb42('0x1'));var moment=require('moment');var rr=require('rr');var Redis=require(_0xbb42('0x2'));var utils=require(_0xbb42('0x3'));var hopperUtils=require(_0xbb42('0x4'));var ut=require(_0xbb42('0x5'));var config=require(_0xbb42('0x6'));var logger=require(_0xbb42('0x7'))('dialer');var loggerBooked=require(_0xbb42('0x7'))('booked');var loggerPredictive=require('../../../config/logger')(_0xbb42('0x8'));var loggerPredictiveCalls=require(_0xbb42('0x7'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xbb42('0x7'))(_0xbb42('0x9'));var ami=require(_0xbb42('0xa'));config['redis']=_[_0xbb42('0xb')](config[_0xbb42('0xc')],{'host':_0xbb42('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbb42('0xc')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0xbb42('0xe'));var RpcSetting=require(_0xbb42('0xf'));var Interval=require(_0xbb42('0x10'));var Action=require(_0xbb42('0x11'));var History=require('./models/history');var Final=require('./models/final');var AgentComplete=require(_0xbb42('0x12'));var QueueCallerAbandon=require(_0xbb42('0x13'));var Hangup=require('./models/hangup');var ipAgi=process[_0xbb42('0x14')][_0xbb42('0x15')]||_0xbb42('0x16');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0xbb42('0x17')]=function(_0x39b25f){this['tail']=this['tail']?this[_0xbb42('0x18')][_0xbb42('0x19')](_0x39b25f):_0x39b25f();};function Dialer(_0x46541d,_0x3ce8ca){this['sequence']=new Sequence();this[_0xbb42('0x1a')]=_0x3ce8ca;this[_0xbb42('0x1b')]=_0x46541d[_0xbb42('0x1b')];this[_0xbb42('0x1c')]=_0x46541d[_0xbb42('0x1c')];this['agents']=_0x46541d[_0xbb42('0x1d')];this[_0xbb42('0x1e')]=_0x46541d[_0xbb42('0x1e')];this[_0xbb42('0x1f')]=config[_0xbb42('0x1f')]||0x2;this[_0xbb42('0x20')]={};this[_0xbb42('0x21')]={};this['contactsId']={};this['uniqueId']={};this['optionPredictive']={};this[_0xbb42('0x22')]={};this['startProgressive']={};this[_0xbb42('0x23')]={};this[_0xbb42('0x24')]={};this[_0xbb42('0x25')]={};this[_0xbb42('0x26')]={};ami['on']('agentconnect',this[_0xbb42('0x27')][_0xbb42('0x28')](this));ami['on'](_0xbb42('0x29'),this['syncQueueCallerAbandon'][_0xbb42('0x28')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0xbb42('0x28')](this));ami['on']('agentcomplete',this[_0xbb42('0x2a')][_0xbb42('0x28')](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0xbb42('0x28')](this));ami['on'](_0xbb42('0x2b'),this[_0xbb42('0x2c')]['bind'](this));ami['on'](_0xbb42('0x2d'),this[_0xbb42('0x2e')]['bind'](this));ami['on'](_0xbb42('0x2f'),this[_0xbb42('0x30')][_0xbb42('0x28')](this));ami['on']('varset',this[_0xbb42('0x31')][_0xbb42('0x28')](this));ami['on'](_0xbb42('0x32'),this[_0xbb42('0x33')]['bind'](this));ami['on']('queuestatuscomplete',this[_0xbb42('0x34')][_0xbb42('0x28')](this));this['loopCampaigns']();this[_0xbb42('0x35')]();RpcSetting[_0xbb42('0x36')]()[_0xbb42('0x37')](function(_0x57a918){previewRecallmeReminderInterval=_0x57a918[_0xbb42('0x38')];});}function isNotNull(_0x108e13){return _0x108e13!==null&&!_[_0xbb42('0x39')](_0x108e13);}function msgResponse(_0x15502c,_0x5a0a89,_0x4fe4fd){return{'action':_0x15502c,'response':_0x5a0a89,'message':_0x4fe4fd,'stack':_0x4fe4fd};}function emit(_0x5045be,_0x4b95b5,_0xbe176){io['to'](_0x5045be)[_0xbb42('0x3a')](_0x4b95b5,_0xbe176);}function emitOutboundVoiceQueueSummary(_0x737cff){if(_0x737cff[_0xbb42('0x3b')]==='outbound'){logger[_0xbb42('0x3c')](_0xbb42('0x3d'),util[_0xbb42('0x3e')](_0x737cff,{'showHidden':![],'depth':null}));emit(util['format'](_0xbb42('0x3f'),_0x737cff[_0xbb42('0x40')]),_0xbb42('0x41'),_0x737cff);}}function checkGetDataPredictive(_0x46e6ae){if(isNotNull(_0x46e6ae)&&!_[_0xbb42('0x42')](_0x46e6ae)){loggerPredictive[_0xbb42('0x43')](_0xbb42('0x44'));loggerPredictive[_0xbb42('0x43')](_0xbb42('0x45'),_0x46e6ae['predictiveIntervalTotalCalls']);loggerPredictive[_0xbb42('0x43')](_0xbb42('0x46'),_0x46e6ae[_0xbb42('0x47')]);loggerPredictive[_0xbb42('0x43')](_0xbb42('0x48'),_0x46e6ae[_0xbb42('0x49')]);loggerPredictive[_0xbb42('0x43')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x46e6ae[_0xbb42('0x4a')]);loggerPredictive[_0xbb42('0x43')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x46e6ae[_0xbb42('0x4b')]);loggerPredictive[_0xbb42('0x43')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x46e6ae[_0xbb42('0x4c')]);loggerPredictive['info'](_0xbb42('0x4d'));if(_0x46e6ae[_0xbb42('0x4e')]>0x0){if(!_['isUndefined'](_0x46e6ae[_0xbb42('0x4c')])&&_0x46e6ae[_0xbb42('0x4c')]>0x0){return!![];}loggerPredictive[_0xbb42('0x43')](_0xbb42('0x4f'));if(!_['isUndefined'](_0x46e6ae['predictiveIntervalAvgHoldtime'])&&_0x46e6ae['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive['info'](_0xbb42('0x50'));}else{loggerPredictive[_0xbb42('0x43')](_0xbb42('0x51'));}}else{loggerPredictive[_0xbb42('0x43')](_0xbb42('0x52'));}return![];}function mergeDataErlangB(_0x726f02){return function(_0x25be18){loggerPredictive['info'](_0xbb42('0x53'));loggerPredictive['info'](_0xbb42('0x54'),_0x25be18[_0xbb42('0x55')]);loggerPredictive[_0xbb42('0x43')](_0xbb42('0x56'),_0x25be18['erlangCallToSecond']);loggerPredictive[_0xbb42('0x43')](_0xbb42('0x57'),_0x25be18[_0xbb42('0x58')]);loggerPredictive[_0xbb42('0x43')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x25be18['erlangBusyFactor']);loggerPredictive[_0xbb42('0x43')](_0xbb42('0x57'),_0x25be18[_0xbb42('0x58')]);loggerPredictive[_0xbb42('0x43')](_0xbb42('0x4d'));_[_0xbb42('0x59')](_0x726f02,_0x25be18);};}function ifInterval(_0x292667,_0x29d077){if(_[_0xbb42('0x39')](_0x29d077)){return![];}return utils[_0xbb42('0x5a')](undefined,_0x29d077)<_0x292667*0x3c;}function clearPredictiveAttributes(_0x203c44){if(_0x203c44[_0xbb42('0x5b')]){_0x203c44[_0xbb42('0x5b')]=undefined;loggerPredictive['debug'](_0x203c44[_0xbb42('0x40')],_0xbb42('0x5c'));}if(_0x203c44[_0xbb42('0x22')]){_0x203c44[_0xbb42('0x22')]=undefined;loggerPredictive[_0xbb42('0x3c')](_0x203c44[_0xbb42('0x40')],'startPredictive\x20value\x20cleared');}if(_0x203c44[_0xbb42('0x5d')]){clearInterval(_0x203c44[_0xbb42('0x5d')]);_0x203c44[_0xbb42('0x5d')]=undefined;loggerPredictive[_0xbb42('0x3c')](_0x203c44[_0xbb42('0x40')],_0xbb42('0x5e'));}}function loggerCatchPredictive(_0x553cd8,_0x2c62fb){return function(_0x4b4ecb){loggerPredictive[_0xbb42('0x5f')](_0x2c62fb[_0xbb42('0x40')],_0x553cd8);loggerPredictive[_0xbb42('0x5f')](_0x4b4ecb[_0xbb42('0x60')]);clearPredictiveAttributes(_0x2c62fb);};}function loggerCatch(_0x5d8dfe){return function(_0x3e79f1){logger[_0xbb42('0x5f')](_0x5d8dfe,util[_0xbb42('0x3e')](_0x3e79f1,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x50d752,_0x30cc98,_0x2934cb){return function(_0x66826c){utils[_0xbb42('0x61')](_0x30cc98,_0x2934cb,0x0);logger['error'](_0x50d752,util[_0xbb42('0x3e')](_0x66826c,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2b3b40){return function(_0x3636d2){if(isNotNull(_0x3636d2)&&isNotNull(_0x3636d2[0x0])){if(_0x3636d2[0x0][_0xbb42('0x62')]>0x0){_0x2b3b40['message']=utils[_0xbb42('0x63')][_0xbb42('0x64')];logger[_0xbb42('0x43')](_0xbb42('0x65')+_0x2b3b40['name'],_0x3636d2[0x0][_0xbb42('0x62')],_0xbb42('0x66'));}else{_0x2b3b40[_0xbb42('0x67')]=utils['CAMPAIGN_STATUS'][_0xbb42('0x68')];logger[_0xbb42('0x43')](_0xbb42('0x69')+_0x2b3b40['name']);}}};}function createObjHistory(_0x426fbd,_0x41571c,_0x1a9066,_0x39f474,_0x29a27c){_0x426fbd['message']=_0x1a9066;var _0x373476=new Action(_0x426fbd,_0x41571c);var _0x377717=new History(_0x373476);_0x377717[_0xbb42('0x6a')]=_0x39f474;_0x377717[_0xbb42('0x6b')]=_0x29a27c;_0x377717[_0xbb42('0x6c')]=_0x373476[_0xbb42('0x6d')];return _0x377717;}function unlockQueueStatus(_0x22cc73,_0x1f6821){setTimeout(function(){if(_[_0xbb42('0x39')](_0x22cc73[_0xbb42('0x6e')])){loggerBooked[_0xbb42('0x5f')](_0xbb42('0x6f'),_0x1f6821);}_0x22cc73[_0xbb42('0x6e')]=!![];loggerBooked[_0xbb42('0x43')](_0xbb42('0x70'),_0x1f6821,JSON['stringify'](_['pick'](_0x22cc73,[_0xbb42('0x40'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x42b800){return function(){if(!isNotNull(_0x42b800['Interval'])){_0x42b800[_0xbb42('0x67')]=utils[_0xbb42('0x63')][_0xbb42('0x71')];throw _0x42b800[_0xbb42('0x40')]+_0xbb42('0x72');}if(!isNotNull(_0x42b800[_0xbb42('0x73')][_0xbb42('0x74')])){_0x42b800[_0xbb42('0x67')]=utils[_0xbb42('0x63')][_0xbb42('0x71')];throw _0x42b800['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xbb42('0x42')](_0x42b800[_0xbb42('0x73')]['Intervals']))){_0x42b800[_0xbb42('0x67')]=utils['CAMPAIGN_STATUS'][_0xbb42('0x71')];throw _0x42b800[_0xbb42('0x40')]+_0xbb42('0x72');}};}function checkIsIVRCampaignActive(_0x11c1b4){return function(){if(!utils[_0xbb42('0x75')](_0x11c1b4)){_0x11c1b4['message']=utils[_0xbb42('0x63')][_0xbb42('0x76')];throw _0x11c1b4[_0xbb42('0x40')]+_0xbb42('0x77');}};}function emitCampaignSummary(_0x51729d){if(utils[_0xbb42('0x78')](_0x51729d)){emit(util['format'](_0xbb42('0x79'),_0x51729d['name']),_0xbb42('0x7a'),_0x51729d);}}function loggerCatchQueueSummary(_0x2c27e4,_0x2b207d){return function(_0x213bdb){clearPredictiveAttributes(_0x2b207d);emitCampaignSummary(_0x2b207d);loggerSyncQueueSummary['debug'](_0x2c27e4,util[_0xbb42('0x3e')](_0x213bdb,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x5340be){if(_0x5340be[_0xbb42('0x7b')]){if(_0x5340be[_0xbb42('0x7c')]===0x0){_0x5340be['sendMessageOneNotActive']=![];_0x5340be[_0xbb42('0x67')]=utils[_0xbb42('0x63')]['INACTIVE'];loggerSyncQueueSummary['debug'](_0xbb42('0x7d'),_0x5340be['name'],_0xbb42('0x7e'));}else{_0x5340be[_0xbb42('0x67')]=utils[_0xbb42('0x63')]['DISACTIVED'];loggerSyncQueueSummary[_0xbb42('0x3c')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x5340be['name'],_0xbb42('0x7f'));}emitCampaignSummary(_0x5340be);}}function myreject(_0x2889f9){return function(_0x15a7be){return _0x2889f9(msgResponse(_0xbb42('0x80'),'Error',JSON[_0xbb42('0x81')](_0x15a7be)));};}Dialer[_0xbb42('0x82')][_0xbb42('0x83')]=function(_0x4e8be8){return!_[_0xbb42('0x39')](_0x4e8be8)&&_0x4e8be8&&!_[_0xbb42('0x39')](_0x4e8be8[_0xbb42('0x40')])&&!_[_0xbb42('0x39')](_0x4e8be8['active'])&&_0x4e8be8['active']&&(this[_0xbb42('0x1e')][util[_0xbb42('0x84')]('SIP/%s',_0x4e8be8[_0xbb42('0x40')])]['status']===_0xbb42('0x85')||this['trunks'][util[_0xbb42('0x84')](_0xbb42('0x86'),_0x4e8be8[_0xbb42('0x40')])]['status']==='unmonitored');};Dialer['prototype']['checkIsTrunkReachable']=function(_0xc5a0fa){var _0x48951a=this;return function(){if(!_0x48951a['isTrunkReachable'](_0xc5a0fa[_0xbb42('0x87')])){if(!_0x48951a['isTrunkReachable'](_0xc5a0fa[_0xbb42('0x88')])){_0xc5a0fa['message']=utils['CAMPAIGN_STATUS'][_0xbb42('0x89')];throw _0xc5a0fa['name']+_0xbb42('0x8a');}}};};Dialer[_0xbb42('0x82')][_0xbb42('0x8b')]=function(_0x46d86b,_0x276806,_0x77f0cb,_0x1e76c8){var _0x23c71b=this;return function(){var _0x24c97b=!![];return _0x23c71b['ifTimeIvr'](_0x46d86b,_0x276806,_0x77f0cb,_0x1e76c8,_0x24c97b);};};Dialer[_0xbb42('0x82')][_0xbb42('0x8c')]=function(_0x3d0406,_0x470035,_0x306fcd,_0x284e53){var _0x3173c0=this;return function(){var _0x443112=![];return _0x3173c0['ifTimeIvr'](_0x3d0406[_0xbb42('0x74')],_0x470035,_0x306fcd,_0x284e53,_0x443112);};};Dialer[_0xbb42('0x82')][_0xbb42('0x8d')]=function(_0x46afe9,_0x7f7325,_0x58e85,_0xabf12a,_0x3386fb){var _0x1052c5=[];return new Promise(function(_0x2b6c0f,_0x2d1135){if(!isNotNull(_0x46afe9)){_0xabf12a[_0xbb42('0x67')]=utils[_0xbb42('0x63')][_0xbb42('0x71')];return _0x2d1135(msgResponse(_0xbb42('0x8e'),_0xbb42('0x8f'),_0x58e85+_0xbb42('0x90')));}if(_[_0xbb42('0x42')](_0x46afe9)){_0xabf12a[_0xbb42('0x67')]=utils[_0xbb42('0x63')]['EMPTY_INTERVAL'];return _0x2d1135(msgResponse(_0xbb42('0x8e'),_0xbb42('0x8f'),_0x58e85+_0xbb42('0x91')));}if(_0x7f7325&&_['isUndefined'](config[_0xbb42('0x92')][_0x7f7325])){_0xabf12a[_0xbb42('0x67')]=utils[_0xbb42('0x63')][_0xbb42('0x93')];return _0x2d1135(msgResponse(_0xbb42('0x8e'),_0xbb42('0x8f'),_0x58e85+_0xbb42('0x94')+_0x7f7325));}if(_['isArray'](_0x46afe9)){for(var _0x32a379=0x0;_0x32a379<_0x46afe9['length'];_0x32a379+=0x1){_0x1052c5[_0xbb42('0x95')](ami[_0xbb42('0x96')]({'action':_0xbb42('0x97'),'command':util[_0xbb42('0x84')]('iftime\x20%s,%s',_0x46afe9[_0x32a379]['interval'],!_[_0xbb42('0x39')](config['timezones'][_0x7f7325])?_0x7f7325:'')})[_0xbb42('0x37')](function(_0x2f46ca){return _0x2f46ca[_0xbb42('0x98')][_0xbb42('0x99')](_0xbb42('0x9a'))>=0x0;})[_0xbb42('0x9b')](myreject(_0x2d1135)));}}else{_0x1052c5['push'](ami[_0xbb42('0x96')]({'action':_0xbb42('0x97'),'command':util[_0xbb42('0x84')](_0xbb42('0x9c'),_0x46afe9,!_['isUndefined'](config[_0xbb42('0x92')][_0x7f7325])?_0x7f7325:'')})[_0xbb42('0x37')](function(_0x284c9e){return _0x284c9e['content'][_0xbb42('0x99')](_0xbb42('0x9a'))>=0x0;})[_0xbb42('0x9b')](myreject(_0x2d1135)));}Promise[_0xbb42('0x9d')](_0x1052c5)[_0xbb42('0x37')](function(_0x36bcb7){var _0x587126=_[_0xbb42('0x9e')](_0x36bcb7);if(_0x587126){return _0x2b6c0f(_0x587126);}else{_0xabf12a['message']=_0x3386fb?utils[_0xbb42('0x63')][_0xbb42('0x9f')]:utils[_0xbb42('0x63')][_0xbb42('0xa0')];return _0x2d1135(msgResponse(_0xbb42('0xa1'),_0xbb42('0x8f'),_0xbb42('0xa2')+_0x3386fb+'\x20'+_0x58e85+_0xbb42('0xa3')+util[_0xbb42('0x3e')](_0x46afe9,{'showHidden':![],'depth':null})+_0xbb42('0xa4')+_0x7f7325));}})[_0xbb42('0x9b')](function(_0x208187){return _0x2d1135(msgResponse(_0xbb42('0x8e'),'Failure',JSON[_0xbb42('0x81')](_0x208187)));});});};Dialer[_0xbb42('0x82')][_0xbb42('0xa5')]=function(){var _0x387863=this;return cmHopper[_0xbb42('0xa6')]({'active':![]},{'where':{'active':!![]}})[_0xbb42('0x37')](function(){setInterval(function(){_0x387863['syncCampaigns']();},0x3e8);});};Dialer[_0xbb42('0x82')][_0xbb42('0xa7')]=function(){var _0x214849=this;var _0x303949;for(var _0x9779f4 in this['campaigns']){if(typeof this[_0xbb42('0x1c')][_0x9779f4]!=='undefined'){_0x303949=this[_0xbb42('0x1c')][_0x9779f4];if(utils[_0xbb42('0x78')](_0x303949)&&utils[_0xbb42('0x75')](_0x303949)){_0x303949[_0xbb42('0x7b')]=!![];Promise[_0xbb42('0xa8')]()[_0xbb42('0x37')](checkIsIVRCampaignActive(_0x303949))[_0xbb42('0x37')](checkInterval(_0x303949))['then'](_0x214849['checkIsTrunkReachable'](_0x303949))['then'](_0x214849['checkIfTime'](_0x303949['dialGlobalInterval'],_0x303949[_0xbb42('0xa9')],_0x303949[_0xbb42('0x40')],_0x303949))[_0xbb42('0x37')](_0x214849['checkIfTimeIntervals'](_0x303949[_0xbb42('0x73')],_0x303949[_0xbb42('0xa9')],_0x303949[_0xbb42('0x40')],_0x303949))[_0xbb42('0x37')](_0x214849[_0xbb42('0xaa')](_0x303949))['catch'](loggerCatchQueueSummary(_0xbb42('0xab'),_0x303949));}else{notSendMessagesCampaign(_0x303949);}}}};Dialer[_0xbb42('0x82')][_0xbb42('0xac')]=function(_0x4754d6){if(_0x4754d6[_0xbb42('0xad')]!==_0xbb42('0x8')){clearPredictiveAttributes(_0x4754d6);}switch(_0x4754d6[_0xbb42('0xad')]){case _0xbb42('0xae'):this[_0xbb42('0xaf')](_0x4754d6,0x1);break;case _0xbb42('0xb0'):this[_0xbb42('0xaf')](_0x4754d6,_0x4754d6[_0xbb42('0xb1')]);break;case _0xbb42('0x8'):this[_0xbb42('0x8')](_0x4754d6);break;case _0xbb42('0xb2'):this[_0xbb42('0xaf')](_0x4754d6,0x1);break;default:logger[_0xbb42('0x5f')](_0xbb42('0xb3'),_0x4754d6['name'],_0xbb42('0xb4'));}};Dialer[_0xbb42('0x82')][_0xbb42('0x8e')]=function(_0x5ea467,_0x18fe37){var _0x5086e1=_0x5ea467[_0xbb42('0xa9')];var _0x3529ca=_0x18fe37?_0x5ea467['dialGlobalInterval']:_0x5ea467[_0xbb42('0x73')][_0xbb42('0x74')];logger[_0xbb42('0xb5')](_0xbb42('0xb6'),_0x3529ca,_0x5086e1,_0x5ea467['name'],util['format'](_0xbb42('0xb7'),_0x5ea467['name'],_0x5ea467['id']));var _0x34cdef=null;return Interval[_0xbb42('0xb8')](_0x3529ca,_0x5086e1)['then'](function(_0x324269){if(_0x324269===!![]){return _0x324269;}else{_0x5ea467[_0xbb42('0x67')]=_0x18fe37?utils['CAMPAIGN_STATUS']['OVERTIME_GLOBAL_INTERVAL']:utils[_0xbb42('0x63')][_0xbb42('0xa0')];_0x34cdef=msgResponse(_0xbb42('0xa1'),'Failure',_0xbb42('0xa2')+_0x18fe37+'\x20'+_0x5ea467[_0xbb42('0x40')]+_0xbb42('0xa3')+util[_0xbb42('0x3e')](_0x3529ca,{'showHidden':![],'depth':null})+_0xbb42('0xa4')+_0x5086e1);}if(_0x34cdef!==null){logger[_0xbb42('0xb5')](_0xbb42('0xb9'),_0x34cdef);_0x34cdef['isGlobal']=_0x18fe37;throw _0x34cdef;}})['catch'](function(_0x37a38e){logger[_0xbb42('0x5f')]('AMI\x20IfTime',_0x37a38e);throw msgResponse(_0xbb42('0x80'),_0xbb42('0xba'),util['inspect'](_0x37a38e,{'showHidden':![],'depth':null}));});};Dialer[_0xbb42('0x82')]['syncAgentConnect']=function(_0x5120d8){if(this[_0xbb42('0x1b')][_0x5120d8[_0xbb42('0xbb')]]){if(this[_0xbb42('0xbc')][_0x5120d8['uniqueid']]&&this[_0xbb42('0xbc')][_0x5120d8[_0xbb42('0xbd')]]['type']!==_0xbb42('0xbe')){this[_0xbb42('0xbf')](this[_0xbb42('0x1b')][_0x5120d8[_0xbb42('0xbb')]]);this[_0xbb42('0xbc')][_0x5120d8[_0xbb42('0xbd')]]['answertime']=moment()[_0xbb42('0x84')](_0xbb42('0xc0'));}}};Dialer[_0xbb42('0x82')]['syncAgentComplete']=function(_0x4ebd0d){var _0x240609=this[_0xbb42('0xbc')][_0x4ebd0d[_0xbb42('0xbd')]];if(this[_0xbb42('0x1b')][_0x4ebd0d['queue']]){if(_0x240609&&_0x240609[_0xbb42('0x3b')]!==_0xbb42('0xbe')){delete this[_0xbb42('0xbc')][_0x4ebd0d['uniqueid']];this['voiceQueues'][_0x4ebd0d['queue']]['outboundAnswerCallsDay']+=0x1;var _0x5f1c7a=new AgentComplete(_0x240609,_0x4ebd0d);if(_0x4ebd0d['reason']===_0xbb42('0xc1')){_0x5f1c7a[_0xbb42('0xc2')]=this['voiceQueues'][_0x4ebd0d[_0xbb42('0xbb')]][_0xbb42('0xc3')]&&this[_0xbb42('0x1b')][_0x4ebd0d[_0xbb42('0xbb')]]['dialAgiAfterHangupAgent']?moment()[_0xbb42('0x84')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0xbb42('0xc4')](_0x5f1c7a)[_0xbb42('0x9b')](loggerCatch(_0xbb42('0xc5')));hopperUtils[_0xbb42('0xc6')](_0x5f1c7a)[_0xbb42('0x9b')](loggerCatch(_0xbb42('0xc7')));}}};Dialer[_0xbb42('0x82')][_0xbb42('0xc8')]=function(_0x2f270b){var _0x54e8eb=this[_0xbb42('0xbc')][_0x2f270b[_0xbb42('0xbd')]];var _0x196d97=this;var _0x43f36e=![];var _0x14c1bf;var _0x5537d6;if(this[_0xbb42('0x1b')][_0x2f270b[_0xbb42('0xbb')]]){if(_0x54e8eb&&_0x54e8eb['type']!=='ivr'){delete this[_0xbb42('0xbc')][_0x2f270b['uniqueid']];this[_0xbb42('0xbf')](this[_0xbb42('0x1b')][_0x2f270b[_0xbb42('0xbb')]]);_0x54e8eb[_0xbb42('0xc9')]=moment()[_0xbb42('0x84')](_0xbb42('0xc0'));var _0x55b4a3=new QueueCallerAbandon(_0x54e8eb,_0x2f270b);if(utils[_0xbb42('0x5a')](_0x54e8eb[_0xbb42('0xc9')],_0x54e8eb['responsetime'])>=_0x54e8eb[_0xbb42('0xca')]){this['voiceQueues'][_0x2f270b[_0xbb42('0xbb')]][_0xbb42('0x49')]+=0x1;this[_0xbb42('0x1b')][_0x2f270b[_0xbb42('0xbb')]][_0xbb42('0xcb')]+=0x1;this['voiceQueues'][_0x2f270b[_0xbb42('0xbb')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x55b4a3[_0xbb42('0x6a')]=0xa;_0x55b4a3['statedesc']=_0xbb42('0xcc');_0x55b4a3[_0xbb42('0xcd')]=_0xbb42('0xce');_0x55b4a3[_0xbb42('0xc2')]=this[_0xbb42('0x1b')][_0x2f270b['queue']][_0xbb42('0xc3')]?moment()[_0xbb42('0x84')](_0xbb42('0xc0')):undefined;_0x55b4a3[_0xbb42('0xcf')]+=0x1;_0x55b4a3[_0xbb42('0xd0')]+=0x1;_0x14c1bf=this[_0xbb42('0x1b')][_0x2f270b[_0xbb42('0xbb')]][_0xbb42('0xd1')];_0x5537d6=this['voiceQueues'][_0x2f270b[_0xbb42('0xbb')]][_0xbb42('0xd2')];hopperUtils[_0xbb42('0xd3')](_0x55b4a3,_0x55b4a3[_0xbb42('0x6a')],_0x54e8eb[_0xbb42('0xd4')])[_0xbb42('0x37')](function(_0x259a72){_0x43f36e=_0x259a72[_0xbb42('0xd5')]==0x1;if(_0x55b4a3['countdropretry']>=_0x196d97[_0xbb42('0x1b')][_0x2f270b[_0xbb42('0xbb')]][_0xbb42('0xd6')]){_0x196d97[_0xbb42('0xd7')](_0x55b4a3,_0x259a72[_0xbb42('0xd5')]);}else{hopperUtils[_0xbb42('0xd8')]({'active':![],'countdropretry':_0x55b4a3[_0xbb42('0xcf')],'scheduledat':moment()[_0xbb42('0xd9')](_0x196d97['voiceQueues'][_0x2f270b['queue']][_0xbb42('0xd1')],_0xbb42('0xda'))[_0xbb42('0x84')](_0xbb42('0xc0')),'ContactId':_0x54e8eb[_0xbb42('0xdb')],'ListId':_0x54e8eb[_0xbb42('0xdc')],'VoiceQueueId':_0x54e8eb['VoiceQueueId']||undefined,'CampaignId':_0x54e8eb[_0xbb42('0xdd')]||undefined})[_0xbb42('0x9b')](loggerCatch(_0xbb42('0xde')));var _0xa2a252=new History(_0x55b4a3);_0xa2a252[_0xbb42('0x6a')]=0xa;_0xa2a252['statedesc']=_0xbb42('0xcc');_0xa2a252[_0xbb42('0x6d')]=moment()[_0xbb42('0x84')](_0xbb42('0xc0'));_0xa2a252[_0xbb42('0x6c')]=_0xa2a252[_0xbb42('0x6d')];_0xa2a252[_0xbb42('0xdf')]=_0x55b4a3[_0xbb42('0xdf')];_0xa2a252['calleridnum']=_0x55b4a3[_0xbb42('0xe0')];hopperUtils[_0xbb42('0xc4')](_0xa2a252)['catch'](loggerCatch(_0xbb42('0xe1')));}})[_0xbb42('0x37')](function(){if(_0x43f36e)hopperUtils['swapAdditionalPhones'](_0x55b4a3,_0x14c1bf,_0x5537d6)[_0xbb42('0x37')](function(){return 0x1;});});}else{this[_0xbb42('0x1b')][_0x2f270b['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xbb42('0x1b')][_0x2f270b[_0xbb42('0xbb')]]['outboundDropCallsDayCallersExit']+=0x1;_0x55b4a3['state']=0xb;_0x55b4a3[_0xbb42('0x6b')]=_0xbb42('0xe2');_0x55b4a3[_0xbb42('0xcd')]=_0xbb42('0xe3');_0x55b4a3['countabandonedretry']+=0x1;_0x55b4a3[_0xbb42('0xd0')]+=0x1;_0x14c1bf=this[_0xbb42('0x1b')][_0x2f270b[_0xbb42('0xbb')]][_0xbb42('0xe4')];_0x5537d6=this[_0xbb42('0x1b')][_0x2f270b[_0xbb42('0xbb')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0xbb42('0xd3')](_0x55b4a3,_0x55b4a3[_0xbb42('0x6a')],_0x54e8eb[_0xbb42('0xd4')])['then'](function(_0x66fdfd){if(_0x55b4a3[_0xbb42('0xe5')]>=_0x196d97[_0xbb42('0x1b')][_0x2f270b[_0xbb42('0xbb')]][_0xbb42('0xe6')]){_0x196d97[_0xbb42('0xd7')](_0x55b4a3,_0x66fdfd['additional']);}else{hopperUtils[_0xbb42('0xd8')]({'active':![],'countabandonedretry':_0x55b4a3[_0xbb42('0xe5')],'scheduledat':moment()[_0xbb42('0xd9')](_0x196d97['voiceQueues'][_0x2f270b[_0xbb42('0xbb')]]['dialAbandonedRetryFrequency'],_0xbb42('0xda'))['format'](_0xbb42('0xc0')),'ContactId':_0x54e8eb['ContactId'],'ListId':_0x54e8eb[_0xbb42('0xdc')],'VoiceQueueId':_0x54e8eb[_0xbb42('0xe7')]||undefined,'CampaignId':_0x54e8eb[_0xbb42('0xdd')]||undefined})[_0xbb42('0x9b')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x5cb8ea=new History(_0x55b4a3);_0x5cb8ea[_0xbb42('0x6a')]=0xb;_0x5cb8ea[_0xbb42('0x6b')]=_0xbb42('0xe2');_0x5cb8ea['starttime']=moment()['format'](_0xbb42('0xc0'));_0x5cb8ea[_0xbb42('0x6c')]=_0x5cb8ea[_0xbb42('0x6d')];_0x5cb8ea[_0xbb42('0xdf')]=_0x55b4a3[_0xbb42('0xdf')];_0x5cb8ea[_0xbb42('0xe0')]=_0x55b4a3[_0xbb42('0xe0')];hopperUtils['createHistory'](_0x5cb8ea)[_0xbb42('0x9b')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0xbb42('0x37')](function(){if(_0x43f36e)hopperUtils[_0xbb42('0xe8')](_0x55b4a3,_0x14c1bf,_0x5537d6)[_0xbb42('0x37')](function(){return 0x1;});});}}}};Dialer[_0xbb42('0x82')][_0xbb42('0x30')]=function(_0xd9a41){if(this[_0xbb42('0x21')][_0xd9a41[_0xbb42('0xbd')]]){this['actions'][_0xd9a41[_0xbb42('0xbd')]][_0xbb42('0xe9')]=_0xd9a41[_0xbb42('0xe9')];}if(this[_0xbb42('0xbc')][_0xd9a41[_0xbb42('0xbd')]]){this['uniqueId'][_0xd9a41[_0xbb42('0xbd')]][_0xbb42('0xe9')]=_0xd9a41[_0xbb42('0xe9')];}};Dialer[_0xbb42('0x82')][_0xbb42('0x33')]=function(_0x5757d0){if(!this['actions'][_0x5757d0[_0xbb42('0xea')]]){return;}var _0x11b1dc=this[_0xbb42('0x1b')][this['actions'][_0x5757d0[_0xbb42('0xea')]][_0xbb42('0xbb')]][_0xbb42('0xeb')]||_0xbb42('0xec');if(_0x11b1dc===_0xbb42('0xed')){if(this[_0xbb42('0x21')][_0x5757d0['actionid']]&&_[_0xbb42('0xee')](this['actions'][_0x5757d0[_0xbb42('0xea')]][_0xbb42('0xef')])&&_0x5757d0[_0xbb42('0xf0')]==='1'&&_0x5757d0['paused']==='0'){if(this[_0xbb42('0x1d')][_0x5757d0[_0xbb42('0xf1')]]){if(!this[_0xbb42('0x1d')][_0x5757d0[_0xbb42('0xf1')]][_0xbb42('0xef')]){this[_0xbb42('0x1d')][_0x5757d0[_0xbb42('0xf1')]][_0xbb42('0xef')]=!![];this[_0xbb42('0x21')][_0x5757d0['actionid']][_0xbb42('0xef')]=!![];this[_0xbb42('0x21')][_0x5757d0[_0xbb42('0xea')]][_0xbb42('0xf1')]=_0x5757d0[_0xbb42('0xf1')];}}}}else if(_0x11b1dc===_0xbb42('0xec')){if(this[_0xbb42('0x21')][_0x5757d0[_0xbb42('0xea')]]){if(this[_0xbb42('0x1d')][_0x5757d0[_0xbb42('0xf1')]]){this[_0xbb42('0x21')][_0x5757d0['actionid']][_0xbb42('0xf1')]=_0x5757d0[_0xbb42('0xf1')];if(_[_0xbb42('0xee')](this['queueBooked'][this['actions'][_0x5757d0[_0xbb42('0xea')]][_0xbb42('0xbb')]])){this[_0xbb42('0x24')][this['actions'][_0x5757d0[_0xbb42('0xea')]][_0xbb42('0xbb')]]=[];}this[_0xbb42('0x24')][this[_0xbb42('0x21')][_0x5757d0['actionid']][_0xbb42('0xbb')]]['push'](_[_0xbb42('0x59')](_[_0xbb42('0xf2')](this['actions'][_0x5757d0[_0xbb42('0xea')]],[_0xbb42('0xf3'),_0xbb42('0xf1')]),{'status':_0x5757d0[_0xbb42('0xf0')],'paused':_0x5757d0[_0xbb42('0xf4')]}));}}}};Dialer[_0xbb42('0x82')]['syncQueueStatusComplete']=function(_0x176935){if(!this['actions'][_0x176935[_0xbb42('0xea')]]){return;}var _0x3d39a8=this;var _0x2650cf=this['voiceQueues'][this['actions'][_0x176935[_0xbb42('0xea')]][_0xbb42('0xbb')]];var _0x405ff0=_0x2650cf[_0xbb42('0xeb')]||_0xbb42('0xec');if(_0x405ff0===_0xbb42('0xed')){if(this[_0xbb42('0x21')][_0x176935['actionid']]&&this['actions'][_0x176935[_0xbb42('0xea')]][_0xbb42('0xf1')]){this[_0xbb42('0x1a')][_0xbb42('0xf5')](this[_0xbb42('0x21')][_0x176935[_0xbb42('0xea')]][_0xbb42('0xf3')],this[_0xbb42('0x21')][_0x176935[_0xbb42('0xea')]][_0xbb42('0xf1')])['catch'](function(_0x56b8da){logger['error'](_0xbb42('0xf6'),util[_0xbb42('0x3e')](_0x56b8da,{'showHidden':![],'depth':null}));})[_0xbb42('0x19')](function(){_0x3d39a8[_0xbb42('0xbf')](_0x3d39a8[_0xbb42('0x1b')][_0x3d39a8[_0xbb42('0x21')][_0x176935[_0xbb42('0xea')]][_0xbb42('0xbb')]]);_0x3d39a8[_0xbb42('0x1d')][_0x3d39a8[_0xbb42('0x21')][_0x176935[_0xbb42('0xea')]][_0xbb42('0xf1')]][_0xbb42('0xef')]=![];delete _0x3d39a8['actions'][_0x176935[_0xbb42('0xea')]];unlockQueueStatus(_0x2650cf);});}else{this[_0xbb42('0xbf')](this[_0xbb42('0x1b')][this[_0xbb42('0x21')][_0x176935['actionid']][_0xbb42('0xbb')]]);hopperUtils[_0xbb42('0xd8')]({'active':![],'ContactId':this[_0xbb42('0x21')][_0x176935['actionid']][_0xbb42('0xdb')],'ListId':this['actions'][_0x176935[_0xbb42('0xea')]]['ListId'],'VoiceQueueId':this[_0xbb42('0x21')][_0x176935[_0xbb42('0xea')]][_0xbb42('0xe7')]||undefined,'CampaignId':this[_0xbb42('0x21')][_0x176935[_0xbb42('0xea')]]['CampaignId']||undefined})[_0xbb42('0x9b')](loggerCatch(_0xbb42('0xf7')));delete this[_0xbb42('0x21')][_0x176935[_0xbb42('0xea')]];unlockQueueStatus(_0x2650cf);}}else if(_0x405ff0===_0xbb42('0xec')){var _0x49356f;if(this[_0xbb42('0x21')][_0x176935[_0xbb42('0xea')]]&&!_[_0xbb42('0x42')](this[_0xbb42('0x24')][this[_0xbb42('0x21')][_0x176935[_0xbb42('0xea')]][_0xbb42('0xbb')]])){if(this[_0xbb42('0x25')][_0x3d39a8[_0xbb42('0x21')][_0x176935['actionid']][_0xbb42('0xbb')]]){this[_0xbb42('0x25')][_0x3d39a8[_0xbb42('0x21')][_0x176935['actionid']][_0xbb42('0xbb')]]=this[_0xbb42('0x25')][this['actions'][_0x176935['actionid']][_0xbb42('0xbb')]]?this[_0xbb42('0x25')][this[_0xbb42('0x21')][_0x176935[_0xbb42('0xea')]]['queue']]:this[_0xbb42('0x24')][this[_0xbb42('0x21')][_0x176935[_0xbb42('0xea')]]['queue']]?this[_0xbb42('0x24')][this[_0xbb42('0x21')][_0x176935[_0xbb42('0xea')]][_0xbb42('0xbb')]][_0xbb42('0xf8')]||0x0:0x0;}this[_0xbb42('0x24')][this[_0xbb42('0x21')][_0x176935[_0xbb42('0xea')]][_0xbb42('0xbb')]][_0xbb42('0xf8')]=this['queueBookedRR'][this[_0xbb42('0x21')][_0x176935[_0xbb42('0xea')]][_0xbb42('0xbb')]];for(var _0x1866b8=0x0;_0x1866b8=_0xdcac3b[_0xbb42('0x11b')]){_0x468b62[_0xbb42('0x11c')](_0x542df9,_0x14527b,_0x51e51f,'reason19\x20machine....');}else{if(_0x542df9[_0xbb42('0x115')]>=_0xdcac3b['dialMachineMaxRetry']){_0x468b62[_0xbb42('0x11d')](_0x542df9,_0x14527b,_0x51e51f,'reason\x2019\x20machine....');}else{hopperUtils[_0xbb42('0xd8')]({'active':![],'countmachineretry':_0x542df9[_0xbb42('0x115')],'scheduledat':moment()[_0xbb42('0xd9')](_0xdcac3b[_0xbb42('0x11e')],_0xbb42('0xda'))[_0xbb42('0x84')](_0xbb42('0xc0')),'ContactId':_0x542df9[_0xbb42('0xdb')],'ListId':_0x542df9['ListId'],'VoiceQueueId':_0x542df9[_0xbb42('0xe7')]||undefined,'CampaignId':_0x542df9[_0xbb42('0xdd')]||undefined})[_0xbb42('0x9b')](loggerCatch(_0xbb42('0x11f')));_0x14527b({'reschedule':0x1});}}});}if(_0x254774[_0xbb42('0x3b')]===_0xbb42('0xbe')&&this[_0xbb42('0x1c')][_0x254774[_0xbb42('0xbb')]][_0xbb42('0x10a')]&&_0x5bdfc6[_0xbb42('0x10b')]==='HANGUP'){delete this['uniqueId'][_0x5bdfc6['uniqueid']];this[_0xbb42('0xbf')](this[_0xbb42('0x1c')][_0x254774['queue']]);_0x428b3b=new Hangup(_0x254774,_0x5bdfc6);_0x428b3b[_0xbb42('0x6a')]=0x12;_0x428b3b['statedesc']=_0xbb42('0x120');_0x428b3b[_0xbb42('0x121')]=_0xbb42('0x122');ami['emit'](_0xbb42('0x10e'),ut[_0xbb42('0x10f')](_0x428b3b,_0xbb42('0x110')));this['saveInDb'](_0x428b3b,_0xbb42('0x123'),'[syncHangupInAMDIvr]');}if(_0x254774[_0xbb42('0x3b')]==='ivr'&&this['campaigns'][_0x254774[_0xbb42('0xbb')]][_0xbb42('0x10a')]&&_0x5bdfc6[_0xbb42('0x10b')]===_0xbb42('0x124')){return new Promise(function(_0x395195,_0x57209d){delete _0x468b62['uniqueId'][_0x5bdfc6['uniqueid']];_0x468b62[_0xbb42('0xbf')](_0x468b62['campaigns'][_0x254774[_0xbb42('0xbb')]]);_0x468b62[_0xbb42('0x1c')][_0x254774[_0xbb42('0xbb')]]['outboundAnswerCallsDay']+=0x1;_0x468b62[_0xbb42('0x1c')][_0x254774[_0xbb42('0xbb')]][_0xbb42('0x10d')]+=0x1;var _0xe7e38c=_0x468b62[_0xbb42('0x1c')][_0x254774[_0xbb42('0xbb')]];var _0xf1ba8b=new Hangup(_0x254774,_0x5bdfc6);_0xf1ba8b['state']=0x13;_0xf1ba8b['statedesc']=_0xbb42('0x114');_0xf1ba8b[_0xbb42('0x121')]=_0xbb42('0x122');_0xf1ba8b['countmachineretry']+=0x1;_0xf1ba8b[_0xbb42('0xd0')]+=0x1;_0xf1ba8b[_0xbb42('0x110')]=!![];ami['emit'](_0xbb42('0x10e'),ut[_0xbb42('0x10f')](_0xf1ba8b,_0xbb42('0x110')));hopperUtils['createHistory'](_0xf1ba8b)['catch'](loggerCatch(_0xbb42('0x116')));if(_0xf1ba8b[_0xbb42('0x117')]+_0xf1ba8b[_0xbb42('0x118')]+_0xf1ba8b[_0xbb42('0x119')]+_0xf1ba8b[_0xbb42('0x11a')]+_0xf1ba8b[_0xbb42('0xcf')]+_0xf1ba8b[_0xbb42('0xe5')]+_0xf1ba8b[_0xbb42('0x115')]+_0xf1ba8b[_0xbb42('0x125')]>=_0xe7e38c[_0xbb42('0x11b')]){_0x468b62[_0xbb42('0x11c')](_0xf1ba8b,_0x395195,_0x57209d,_0xbb42('0x126'));}else{if(_0xf1ba8b[_0xbb42('0x115')]>=_0xe7e38c[_0xbb42('0x127')]){_0x468b62[_0xbb42('0x11d')](_0xf1ba8b,_0x395195,_0x57209d,_0xbb42('0x128'));}else{hopperUtils[_0xbb42('0xd8')]({'active':![],'countmachineretry':_0xf1ba8b['countmachineretry'],'scheduledat':moment()[_0xbb42('0xd9')](_0xe7e38c[_0xbb42('0x11e')],'minutes')[_0xbb42('0x84')](_0xbb42('0xc0')),'ContactId':_0xf1ba8b[_0xbb42('0xdb')],'ListId':_0xf1ba8b['ListId'],'VoiceQueueId':_0xf1ba8b[_0xbb42('0xe7')]||undefined,'CampaignId':_0xf1ba8b['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x395195({'reschedule':0x1});}}});}}};Dialer[_0xbb42('0x82')][_0xbb42('0x2e')]=function(_0x11d2fc){var _0x363128=this['uniqueId'][_0x11d2fc['uniqueid']];var _0x194a94;if(_0x363128&&_0x363128[_0xbb42('0x3b')]==='ivr'){delete this[_0xbb42('0xbc')][_0x11d2fc[_0xbb42('0xbd')]];this[_0xbb42('0xbf')](this[_0xbb42('0x1c')][_0x363128[_0xbb42('0xbb')]]);this[_0xbb42('0x1c')][_0x363128['queue']][_0xbb42('0x129')]+=0x1;_0x194a94=new Hangup(_0x363128,_0x11d2fc);hopperUtils[_0xbb42('0xc4')](_0x194a94)[_0xbb42('0x9b')](loggerCatch(_0xbb42('0x12a')));hopperUtils['moveContactManagedDialer'](_0x194a94)['catch'](loggerCatch(_0xbb42('0x12b')));}if(_0x363128&&_0x363128[_0xbb42('0x3b')]!==_0xbb42('0xbe')&&isNotNull(this['voiceQueues'][_0x363128[_0xbb42('0xbb')]][_0xbb42('0x12c')])){delete this[_0xbb42('0xbc')][_0x11d2fc[_0xbb42('0xbd')]];this['updateOriginated'](this['voiceQueues'][_0x363128['queue']]);this[_0xbb42('0x1b')][_0x363128[_0xbb42('0xbb')]][_0xbb42('0x113')]+=0x1;this[_0xbb42('0x1b')][_0x363128['queue']][_0xbb42('0x10d')]+=0x1;_0x194a94=new Hangup(_0x363128,_0x11d2fc);_0x194a94[_0xbb42('0x6a')]=0x10;_0x194a94['statedesc']=_0xbb42('0x12d');_0x194a94['membername']=_0xbb42('0x12e');hopperUtils[_0xbb42('0xc4')](_0x194a94)[_0xbb42('0x9b')](loggerCatch(_0xbb42('0x12a')));hopperUtils['moveContactManagedDialer'](_0x194a94)[_0xbb42('0x9b')](loggerCatch(_0xbb42('0x12b')));}if(_0x363128&&_0x363128[_0xbb42('0x3b')]!==_0xbb42('0xbe')&&!isNotNull(this[_0xbb42('0x1b')][_0x363128[_0xbb42('0xbb')]][_0xbb42('0x12c')])){delete this[_0xbb42('0xbc')][_0x11d2fc[_0xbb42('0xbd')]];this[_0xbb42('0xbf')](this['voiceQueues'][_0x363128[_0xbb42('0xbb')]]);this[_0xbb42('0x1b')][_0x363128[_0xbb42('0xbb')]]['outboundUnknownCallsDay']+=0x1;_0x194a94=new Hangup(_0x363128,_0x11d2fc);_0x194a94['state']=0xc;_0x194a94[_0xbb42('0x6b')]=_0x11d2fc[_0xbb42('0x12f')];_0x194a94[_0xbb42('0x121')]=_0xbb42('0x130');hopperUtils[_0xbb42('0xc4')](_0x194a94)[_0xbb42('0x9b')](loggerCatch(_0xbb42('0x12a')));hopperUtils['moveContactManagedDialer'](_0x194a94)[_0xbb42('0x9b')](loggerCatch(_0xbb42('0x12b')));}};Dialer[_0xbb42('0x82')][_0xbb42('0x9')]=function(_0x7503b7){var _0x325edc=this;if(!_0x325edc[_0xbb42('0x26')][_0x7503b7['name']]){_0x325edc[_0xbb42('0x26')][_0x7503b7[_0xbb42('0x40')]]={'running':![]};}else if(_0x325edc['queuesSummary'][_0x7503b7[_0xbb42('0x40')]]['running']===!![]){return;}else if(_0x325edc['queuesSummary'][_0x7503b7[_0xbb42('0x40')]][_0xbb42('0x131')]===![]){_0x325edc[_0xbb42('0x26')][_0x7503b7[_0xbb42('0x40')]]['running']=!![];}var _0x492de5=_0x325edc[_0xbb42('0x1b')][_0x7503b7['name']];var _0x174002=_0x492de5[_0xbb42('0x67')]!==utils['CAMPAIGN_STATUS'][_0xbb42('0x76')];var _0xee793d=utils['isPreviewCampaign'](_0x492de5);_0x492de5[_0xbb42('0x132')]=utils[_0xbb42('0x133')](_0x492de5,_0x325edc[_0xbb42('0x1e')]);Promise[_0xbb42('0xa8')]()[_0xbb42('0x37')](function(){if(_0x492de5[_0xbb42('0x132')]===utils['CAMPAIGN_STATUS'][_0xbb42('0x76')]){if(_0x174002){clearPredictiveAttributes(_0x492de5);_0x7503b7[_0xbb42('0x22')]=undefined;_0x7503b7[_0xbb42('0x5b')]=undefined;}if(_0x492de5[_0xbb42('0x132')]===utils[_0xbb42('0x63')][_0xbb42('0x76')]){_0x7503b7[_0xbb42('0x134')]=0x0;_0x7503b7['paused']=0x0;_0x7503b7['inUse']=0x0;_0x7503b7[_0xbb42('0x135')]=0x0;_0x7503b7[_0xbb42('0x136')]=0x0;}}else if(_0x492de5[_0xbb42('0x132')]===utils[_0xbb42('0x63')][_0xbb42('0x137')]&&!_0xee793d){return _0x325edc['ifTime'](_0x492de5,!![])[_0xbb42('0x37')](function(){return _0x325edc[_0xbb42('0x8e')](_0x492de5,![]);})[_0xbb42('0x37')](function(){return _0x325edc[_0xbb42('0xac')](_0x492de5);})[_0xbb42('0x9b')](function(_0x449610){loggerSyncQueueSummary[_0xbb42('0x3c')](_0xbb42('0x138'),util[_0xbb42('0x3e')](_0x449610,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x492de5);});}else{clearPredictiveAttributes(_0x492de5);}})[_0xbb42('0x37')](function(){var _0x466c84=_0x7503b7[_0xbb42('0x139')](_0x492de5);if(_0x466c84||_0x492de5['queueSummaryCountersUpdated']){_0x492de5[_0xbb42('0x13a')]=![];_0x7503b7[_0xbb42('0x13b')](_0x492de5);Object[_0xbb42('0x13c')](_0x492de5,_0x7503b7);emitOutboundVoiceQueueSummary(_0x7503b7);}_0x325edc[_0xbb42('0x26')][_0x492de5['name']]['running']=![];})[_0xbb42('0x9b')](function(_0x142c2b){logger[_0xbb42('0x5f')](_0xbb42('0x138'),util[_0xbb42('0x3e')](_0x142c2b,{'showHidden':![],'depth':null}));_0x325edc[_0xbb42('0x26')][_0x492de5[_0xbb42('0x40')]][_0xbb42('0x131')]=![];});};Dialer[_0xbb42('0x82')][_0xbb42('0x2c')]=_[_0xbb42('0x13d')](function(){var _0x3f2050=_['filter'](this['voiceQueues'],function(_0xffd92d){return _0xffd92d['dialPreviewRecallmeReminder'];});var _0x1faa1a=_['filter'](this[_0xbb42('0x1d')],function(_0x84ab5d){return _0x84ab5d[_0xbb42('0x13e')]&&_0x84ab5d['status']===_0xbb42('0x85');});if(_0x3f2050[_0xbb42('0xf9')]>0x0&&_0x1faa1a[_0xbb42('0xf9')]>0x0){return Promise[_0xbb42('0xa8')]()[_0xbb42('0x37')](cmHopper[_0xbb42('0x13f')](_[_0xbb42('0x140')](_0x3f2050,'id'),previewRecallmeReminderInterval,_[_0xbb42('0x140')](_0x1faa1a,'id')))[_0xbb42('0x37')](function(_0x2e7176){for(var _0x3895b0=0x0;_0x3895b0<_0x2e7176['length'];_0x3895b0++){var _0x18cc81=_0x2e7176[_0x3895b0]['Agent']['name'];if(_0x18cc81)io['to'](util['format'](_0xbb42('0x141'),_0x18cc81))[_0xbb42('0x3a')]('user:dialPreviewRecallReminder',{'hopper':_0x2e7176[_0x3895b0]});}})[_0xbb42('0x9b')](function(_0x25b92a){logger[_0xbb42('0x5f')](_0xbb42('0x142'),_0x25b92a);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xbb42('0x82')][_0xbb42('0x35')]=function(){var _0x2e4e3f=this;setInterval(function(){_0x2e4e3f[_0xbb42('0x143')](_0x2e4e3f['uniqueId'],_0xbb42('0x144'));_0x2e4e3f['clearZombieChannels'](_0x2e4e3f[_0xbb42('0x21')],'[actions]');},0x32c8);};Dialer['prototype']['clearZombieChannels']=function(_0x1541f9,_0x173629){var _0x2b31ad=this;for(var _0x39cab5 in _0x1541f9){if(typeof _0x1541f9[_0x39cab5]!==_0xbb42('0x145')){this[_0xbb42('0x146')][_0xbb42('0x17')](function(){if(!_[_0xbb42('0xee')](_0x1541f9[_0x39cab5])){return ami['Action']({'action':_0xbb42('0xf0'),'channel':_0x1541f9[_0x39cab5][_0xbb42('0xe9')]})[_0xbb42('0x9b')](function(_0x44b82a){if(_0x44b82a['message']===_0xbb42('0x147')){setTimeout(function(){if(_0x1541f9[_0x39cab5]&&_0x1541f9[_0x39cab5][_0xbb42('0x3b')]!==_0xbb42('0xbe')){_0x2b31ad[_0xbb42('0xbf')](_0x2b31ad[_0xbb42('0x1b')][_0x1541f9[_0x39cab5][_0xbb42('0xbb')]]);logger[_0xbb42('0x5f')](_0xbb42('0x148'),_0x173629,_0x39cab5,_0x1541f9[_0x39cab5][_0xbb42('0xbb')]);delete _0x1541f9[_0x39cab5];}if(_0x1541f9[_0x39cab5]&&_0x1541f9[_0x39cab5][_0xbb42('0x3b')]==='ivr'){_0x2b31ad[_0xbb42('0xbf')](_0x2b31ad[_0xbb42('0x1c')][_0x1541f9[_0x39cab5]['queue']]);logger[_0xbb42('0x5f')](_0xbb42('0x149'),_0x173629,_0x39cab5,_0x1541f9[_0x39cab5][_0xbb42('0xbb')]);delete _0x1541f9[_0x39cab5];}},0x2328);}});}});}}};Dialer['prototype'][_0xbb42('0x14a')]=function(_0xcaaa99){return Promise[_0xbb42('0xa8')]()[_0xbb42('0x37')](voiceQueueRt[_0xbb42('0x14a')](_0xcaaa99))['catch'](loggerCatch(_0xbb42('0x14b')));};Dialer[_0xbb42('0x82')][_0xbb42('0xbf')]=function(_0x1c331c){if(!_[_0xbb42('0x39')](_0x1c331c)&&_0x1c331c!==null){if(typeof _0x1c331c[_0xbb42('0x7c')]!==_0xbb42('0x145')){if(_0x1c331c['originated']>0x0){_0x1c331c['originated']-=0x1;}else{logger['error'](_0xbb42('0x14c'));}}}else{logger[_0xbb42('0x5f')](_0xbb42('0x14d'));}};Dialer['prototype'][_0xbb42('0x14e')]=function(_0x142d61,_0x42da1a){var _0x895bcb=this;return function(_0x3fc723){_0x895bcb[_0xbb42('0xbf')](_0x42da1a);logger[_0xbb42('0x5f')](_0x142d61,util[_0xbb42('0x3e')](_0x3fc723,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x499fb3,_0x1b7222,_0x7c7eba){var _0x4cc1fb={'state':0x19,'statedesc':_0xbb42('0x14f')};this[_0xbb42('0xbf')](_0x1b7222);this[_0xbb42('0x111')](_[_0xbb42('0x59')](_0x4cc1fb,_[_0xbb42('0xf2')](_0x7c7eba,['ContactId',_0xbb42('0xdc'),_0xbb42('0x150'),_0xbb42('0xe7'),_0xbb42('0xdd')])),'[emptyContact][createHistory]',_0xbb42('0x151'));logger[_0xbb42('0x5f')](_0x499fb3);};Dialer['prototype'][_0xbb42('0x111')]=function(_0x445069,_0x831dd7,_0x2b1929){hopperUtils[_0xbb42('0xc4')](_0x445069)[_0xbb42('0x9b')](loggerCatch(_0x831dd7));hopperUtils[_0xbb42('0xc6')](_0x445069)[_0xbb42('0x9b')](loggerCatch(_0x2b1929));};Dialer['prototype'][_0xbb42('0xd7')]=function(_0x36663a,_0x302e93){hopperUtils[_0xbb42('0xc4')](_0x36663a)[_0xbb42('0x9b')](loggerCatch(_0xbb42('0xc5')));if(_0x302e93==0x0){hopperUtils[_0xbb42('0xc6')](_0x36663a)[_0xbb42('0x9b')](loggerCatch(_0xbb42('0x152')));}};Dialer['prototype'][_0xbb42('0x142')]=function(_0x997f29){return Promise['resolve']()[_0xbb42('0x37')](cmHopper['handlePreviewRecallNotifications'](_0x997f29['id'],previewRecallmeReminderInterval))[_0xbb42('0x37')](function(_0x26946b){for(var _0x7e12f5=0x0;_0x7e12f5<_0x26946b[_0xbb42('0xf9')];_0x7e12f5++){var _0x2b35ae=_0x26946b[_0x7e12f5]['Agent'][_0xbb42('0x40')];if(_0x2b35ae)io['to'](util['format']('user:%s',_0x2b35ae))[_0xbb42('0x3a')](_0xbb42('0x153'),{'hopper':_0x26946b[_0x7e12f5]});}})[_0xbb42('0x9b')](function(){});};Dialer[_0xbb42('0x82')][_0xbb42('0xaa')]=function(_0x460b19){var _0x473aa8=this;return function(){_0x473aa8[_0xbb42('0x154')](_0x460b19);};};Dialer[_0xbb42('0x82')][_0xbb42('0x155')]=function(_0x4da459,_0x2361c9){var _0x3e168d=this;var _0xbf2f6=uuid['v4']();this[_0xbb42('0x21')][_0xbf2f6]=new Action(_0x4da459,_0x2361c9,_0xbf2f6);return new Promise(function(_0x575351,_0x68b058){if(_[_0xbb42('0x39')](_0x4da459)&&typeof _0x4da459!==_0xbb42('0x156')){return _0x68b058(msgResponse(_0xbb42('0x157'),_0xbb42('0x8f'),_0xbb42('0x158')));}if(_[_0xbb42('0x39')](_0x2361c9[_0xbb42('0x159')])||_0x2361c9['phone']===null){return _0x68b058(msgResponse(_0xbb42('0x157'),_0xbb42('0x8f'),_0xbb42('0x15a')));}var _0x323486={'XMD-CALLERID':_0x3e168d['actions'][_0xbf2f6][_0xbb42('0x15b')](),'XMD-AGI':_0x4da459[_0xbb42('0x12c')]?util[_0xbb42('0x84')](_0xbb42('0x15c'),ipAgi,_0x4da459[_0xbb42('0x12c')]):'NONE','XMD-AGIAFTER':_0x4da459[_0xbb42('0xc3')]?util[_0xbb42('0x84')](_0xbb42('0x15c'),ipAgi,_0x4da459[_0xbb42('0xc3')]):_0xbb42('0x15d'),'XMD-QUEUE':utils[_0xbb42('0x15e')](_0x4da459)?util[_0xbb42('0x84')]('\x22%s,%s%s,,,%s\x22',_0x4da459['name'],_0x4da459[_0xbb42('0x15f')]||'',_0x4da459['dialAgiAfterHangupAgent']?'c':'',_0x4da459[_0xbb42('0xca')]||0x3):'NONE','XMD-CONTACTID':_0x2361c9[_0xbb42('0xdb')],'XMD-CDRTYPE':_0xbb42('0x160'),'CALLERID(all)':_0x3e168d[_0xbb42('0x21')][_0xbf2f6][_0xbb42('0x15b')](),'XMD-AMD':_0x4da459[_0xbb42('0x10a')]?_0xbb42('0x137'):_0xbb42('0x15d'),'XMD-DESTINATION':_0xbb42('0x109')};if(_0x4da459['dialAMDActive']){_0x323486[_0xbb42('0x161')]=_0x4da459[_0xbb42('0x162')]||0x9c4;_0x323486['XMD-AMDGREETING']=_0x4da459[_0xbb42('0x163')]||0x5dc;_0x323486[_0xbb42('0x164')]=_0x4da459[_0xbb42('0x165')]||0x320;_0x323486[_0xbb42('0x166')]=_0x4da459[_0xbb42('0x167')]||0x1388;_0x323486[_0xbb42('0x168')]=_0x4da459[_0xbb42('0x169')]||0x64;_0x323486['XMD-AMDBETWEENWORDSSILENCE']=_0x4da459[_0xbb42('0x16a')]||0x32;_0x323486['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x4da459[_0xbb42('0x16b')]||0x3;_0x323486[_0xbb42('0x16c')]=_0x4da459[_0xbb42('0x16d')]||0x100;_0x323486[_0xbb42('0x16e')]=_0x4da459[_0xbb42('0x16f')]||0x1388;}if(utils[_0xbb42('0x15e')](_0x4da459)){_0x323486[_0xbb42('0x170')]=_0x2361c9[_0xbb42('0xe7')];}else{_0x323486[_0xbb42('0x171')]=_0x2361c9[_0xbb42('0xdd')];}for(var _0x34fda7 in _0x2361c9[_0xbb42('0x172')]){if(typeof _0x2361c9[_0xbb42('0x172')][_0x34fda7]!==_0xbb42('0x145')){if(isNotNull(_0x2361c9['Contact'][_0x34fda7])&&_0x34fda7!=='id'&&_0x34fda7!==_0xbb42('0x173')&&_0x34fda7!=='createdAt'&&_0x34fda7!==_0xbb42('0x174')){_0x323486[util['format'](_0xbb42('0x175'),_0xbb42('0x176'),_[_0xbb42('0x177')](_0x34fda7))]=_0x2361c9[_0xbb42('0x172')][_0x34fda7];}}}var _0x3708aa=_0x3e168d[_0xbb42('0x83')](_0x4da459['Trunk'])?utils[_0xbb42('0x178')](_0x4da459[_0xbb42('0x87')][_0xbb42('0x179')],_0x4da459['dialOriginateCallerIdName'],_0x4da459[_0xbb42('0x17a')]>0x0?utils[_0xbb42('0x17b')](_0x4da459[_0xbb42('0x17c')],_0x4da459[_0xbb42('0x17a')]):_0x4da459[_0xbb42('0x17c')]):utils[_0xbb42('0x178')](_[_0xbb42('0xee')](_0x4da459['TrunkBackup'])?_0x4da459[_0xbb42('0x87')][_0xbb42('0x179')]:_0x4da459[_0xbb42('0x88')][_0xbb42('0x179')],_0x4da459[_0xbb42('0x17d')],_0x4da459[_0xbb42('0x17a')]>0x0?utils[_0xbb42('0x17b')](_0x4da459[_0xbb42('0x17c')],_0x4da459[_0xbb42('0x17a')]):_0x4da459[_0xbb42('0x17c')]);if(_0x3708aa){_0x323486['XMD-ORIGINATECALLERIDNAME']=_0x3e168d['actions'][_0xbf2f6][_0xbb42('0x17e')]=utils[_0xbb42('0x17f')](_0x3708aa);_0x323486['XMD-ORIGINATECALLERIDNUM']=_0x2361c9[_0xbb42('0x159')];}_0x4da459[_0xbb42('0x180')]=_0x323486;return ami[_0xbb42('0x96')]({'actionid':_0xbf2f6,'action':_0xbb42('0x157'),'channel':_0x3e168d['isTrunkReachable'](_0x4da459['Trunk'])?util[_0xbb42('0x84')](_0xbb42('0x181'),_0x4da459[_0xbb42('0x87')]['name'],isNotNull(_0x4da459[_0xbb42('0x182')])?_0x4da459[_0xbb42('0x182')][_0xbb42('0x183')]()||'':'',_0x4da459[_0xbb42('0x184')]>0x0?_0x2361c9[_0xbb42('0x159')][_0xbb42('0x185')](_0x4da459[_0xbb42('0x184')]):_0x2361c9['phone']):util[_0xbb42('0x84')](_0xbb42('0x181'),_['isNil'](_0x4da459[_0xbb42('0x88')])?_0x4da459[_0xbb42('0x87')]['name']:_0x4da459['TrunkBackup'][_0xbb42('0x40')],isNotNull(_0x4da459['dialPrefix'])?_0x4da459[_0xbb42('0x182')]['trim']()||'':'',_0x4da459['dialCutDigit']>0x0?_0x2361c9['phone'][_0xbb42('0x185')](_0x4da459[_0xbb42('0x184')]):_0x2361c9['phone']),'callerid':_0x3708aa,'Exten':_0xbb42('0x109'),'Context':'from-sip','Priority':'1','variable':_0x323486,'timeout':(_0x4da459[_0xbb42('0x186')]||0x1e)*0x3e8,'async':!![],'channelid':_0xbf2f6})[_0xbb42('0x37')](function(_0x194c32){return _0x575351(_0x194c32);})[_0xbb42('0x9b')](function(_0x27ea20){_0x4da459[_0xbb42('0x187')]+=0x1;var _0x562104=new History(_0x3e168d[_0xbb42('0x21')][_0xbf2f6]);logger[_0xbb42('0x5f')](util['format']('[originateError]:\x20%s',JSON[_0xbb42('0x81')](_0x27ea20)));_0x562104[_0xbb42('0x6a')]=0xe;_0x562104[_0xbb42('0x6b')]=_0xbb42('0x188');_0x562104[_0xbb42('0x6d')]=moment()[_0xbb42('0x84')](_0xbb42('0xc0'));_0x562104['endtime']=_0x562104[_0xbb42('0x6d')];hopperUtils['createHistory'](_0x562104)['catch'](loggerCatch('[originate][error]'));_0x3e168d[_0xbb42('0xc6')](_0x562104)['catch'](loggerCatch(_0xbb42('0x189')))[_0xbb42('0x19')](function(){delete _0x3e168d[_0xbb42('0x21')][_0xbf2f6];return _0x68b058(msgResponse(_0xbb42('0x157'),_0xbb42('0xba'),_0xbb42('0x18a')));});});});};Dialer[_0xbb42('0x82')]['checkRetriveMax']=function(_0x272ccf,_0x507123,_0x12a4d7){var _0x22a065=new History(_0x507123);if(_0x22a065['countbusyretry']+_0x22a065[_0xbb42('0x118')]+_0x22a065['countnoanswerretry']+_0x22a065[_0xbb42('0x11a')]+_0x22a065[_0xbb42('0xcf')]+_0x22a065[_0xbb42('0xe5')]+_0x22a065[_0xbb42('0x115')]+_0x22a065[_0xbb42('0x125')]>=_0x12a4d7[_0xbb42('0x11b')]-0x1){return!![];}switch(_0x272ccf){case 0x3:if(_0x22a065['countnoanswerretry']>=_0x12a4d7['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0xbb42('0xd8')]({'active':![],'countnoanswerretry':_0x22a065[_0xbb42('0x119')]+=0x1,'scheduledat':moment()[_0xbb42('0xd9')](_0x12a4d7[_0xbb42('0x18b')],_0xbb42('0xda'))[_0xbb42('0x84')](_0xbb42('0xc0')),'ContactId':_0x22a065[_0xbb42('0xdb')],'ListId':_0x22a065['ListId'],'VoiceQueueId':_0x22a065[_0xbb42('0xe7')]||undefined,'CampaignId':_0x22a065['CampaignId']||undefined})['catch'](loggerCatch(_0xbb42('0x18c')));break;case 0x5:if(_0x22a065['countbusyretry']>=_0x12a4d7[_0xbb42('0x18d')]-0x1){return!![];}hopperUtils[_0xbb42('0xd8')]({'active':![],'countbusyretry':_0x22a065[_0xbb42('0x117')]+=0x1,'scheduledat':moment()[_0xbb42('0xd9')](_0x12a4d7[_0xbb42('0x18e')],'minutes')[_0xbb42('0x84')](_0xbb42('0xc0')),'ContactId':_0x22a065[_0xbb42('0xdb')],'ListId':_0x22a065[_0xbb42('0xdc')],'VoiceQueueId':_0x22a065[_0xbb42('0xe7')]||undefined,'CampaignId':_0x22a065['CampaignId']||undefined})[_0xbb42('0x9b')](loggerCatch(_0xbb42('0x18f')));break;case 0x8:if(_0x22a065[_0xbb42('0x118')]>=_0x12a4d7[_0xbb42('0x190')]-0x1){return!![];}hopperUtils[_0xbb42('0xd8')]({'active':![],'countcongestionretry':_0x22a065[_0xbb42('0x118')]+=0x1,'scheduledat':moment()[_0xbb42('0xd9')](_0x12a4d7['dialCongestionRetryFrequency'],_0xbb42('0xda'))[_0xbb42('0x84')](_0xbb42('0xc0')),'ContactId':_0x22a065[_0xbb42('0xdb')],'ListId':_0x22a065[_0xbb42('0xdc')],'VoiceQueueId':_0x22a065[_0xbb42('0xe7')]||undefined,'CampaignId':_0x22a065['CampaignId']||undefined})[_0xbb42('0x9b')](loggerCatch(_0xbb42('0x191')));break;case 0x0:if(_0x22a065[_0xbb42('0x11a')]>=_0x12a4d7[_0xbb42('0x192')]-0x1){return!![];}else{hopperUtils[_0xbb42('0xd8')]({'active':![],'countnosuchnumberretry':_0x22a065[_0xbb42('0x11a')]+=0x1,'scheduledat':moment()['add'](_0x12a4d7['dialNoSuchNumberRetryFrequency'],_0xbb42('0xda'))[_0xbb42('0x84')](_0xbb42('0xc0')),'ContactId':_0x22a065[_0xbb42('0xdb')],'ListId':_0x22a065[_0xbb42('0xdc')],'VoiceQueueId':_0x22a065[_0xbb42('0xe7')]||undefined,'CampaignId':_0x22a065[_0xbb42('0xdd')]||undefined})[_0xbb42('0x9b')](loggerCatch(_0xbb42('0x193')));}break;case 0xa:if(_0x22a065[_0xbb42('0xcf')]>=_0x12a4d7[_0xbb42('0xd6')]-0x1){return!![];}hopperUtils[_0xbb42('0xd8')]({'active':![],'countdropretry':_0x22a065[_0xbb42('0xcf')]+=0x1,'scheduledat':moment()[_0xbb42('0xd9')](_0x12a4d7[_0xbb42('0xd1')],_0xbb42('0xda'))[_0xbb42('0x84')](_0xbb42('0xc0')),'ContactId':_0x22a065[_0xbb42('0xdb')],'ListId':_0x22a065[_0xbb42('0xdc')],'VoiceQueueId':_0x22a065['VoiceQueueId']||undefined,'CampaignId':_0x22a065[_0xbb42('0xdd')]||undefined})['catch'](loggerCatch(_0xbb42('0xde')));break;case 0xb:if(_0x22a065[_0xbb42('0xe5')]>=_0x12a4d7[_0xbb42('0xe6')]-0x1){return!![];}hopperUtils[_0xbb42('0xd8')]({'active':![],'countabandonedretry':_0x22a065[_0xbb42('0xe5')]+=0x1,'scheduledat':moment()[_0xbb42('0xd9')](_0x12a4d7[_0xbb42('0xe4')],_0xbb42('0xda'))['format'](_0xbb42('0xc0')),'ContactId':_0x22a065[_0xbb42('0xdb')],'ListId':_0x22a065[_0xbb42('0xdc')],'VoiceQueueId':_0x22a065[_0xbb42('0xe7')]||undefined,'CampaignId':_0x22a065[_0xbb42('0xdd')]||undefined})[_0xbb42('0x9b')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x22a065[_0xbb42('0x115')]>=_0x12a4d7['dialMachineMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x22a065[_0xbb42('0x115')]+=0x1,'scheduledat':moment()[_0xbb42('0xd9')](_0x12a4d7[_0xbb42('0x11e')],_0xbb42('0xda'))['format'](_0xbb42('0xc0')),'ContactId':_0x22a065['ContactId'],'ListId':_0x22a065[_0xbb42('0xdc')],'VoiceQueueId':_0x22a065[_0xbb42('0xe7')]||undefined,'CampaignId':_0x22a065[_0xbb42('0xdd')]||undefined})['catch'](loggerCatch(_0xbb42('0x11f')));break;case 0x14:if(_0x22a065[_0xbb42('0x125')]>=_0x12a4d7[_0xbb42('0x194')]-0x1){return!![];}hopperUtils[_0xbb42('0xd8')]({'active':![],'countagentrejectretry':_0x22a065[_0xbb42('0x125')]+=0x1,'scheduledat':moment()['add'](_0x12a4d7[_0xbb42('0x195')],_0xbb42('0xda'))[_0xbb42('0x84')](_0xbb42('0xc0')),'ContactId':_0x22a065[_0xbb42('0xdb')],'ListId':_0x22a065[_0xbb42('0xdc')],'VoiceQueueId':_0x22a065['VoiceQueueId']||undefined,'CampaignId':_0x22a065[_0xbb42('0xdd')]||undefined})[_0xbb42('0x9b')](loggerCatch(_0xbb42('0x196')));break;default:return!![];}};Dialer[_0xbb42('0x82')][_0xbb42('0x105')]=function(_0x6e9438,_0x11eb20,_0x3ea846){var _0x5dcffb=this;var _0x129c62=new History(_0x6e9438);var _0x330a90=![];var _0x2ce0c0;var _0x13475b;return new Promise(function(_0x415c2d,_0x519738){if(_[_0xbb42('0x39')](_0x11eb20)&&typeof _0x11eb20!==_0xbb42('0x156')){return _0x519738(msgResponse(_0xbb42('0x197'),_0xbb42('0x8f'),_0xbb42('0x198')));}if(_[_0xbb42('0x39')](_0x3ea846)&&typeof _0x3ea846!==_0xbb42('0x156')){return _0x519738(msgResponse(_0xbb42('0x197'),_0xbb42('0x8f'),_0xbb42('0x199')));}hopperUtils[_0xbb42('0xd3')](_0x129c62,_0x3ea846[_0xbb42('0x19a')],_0x11eb20)[_0xbb42('0x37')](function(_0x3b5607){if(_0x3b5607[_0xbb42('0xd5')]==0x1)_0x330a90=!![];switch(_0x3ea846[_0xbb42('0x19a')]){case'0':_0x11eb20['outboundNoSuchCallsDay']+=0x1;_0x129c62[_0xbb42('0x6a')]=0x0;_0x129c62[_0xbb42('0x6b')]=_0xbb42('0x19b');_0x129c62[_0xbb42('0x11a')]+=0x1;_0x129c62[_0xbb42('0xd0')]+=0x1;ami[_0xbb42('0x3a')](_0xbb42('0x19c'),ut[_0xbb42('0x10f')](_0x6e9438,_0xbb42('0x19d')));_0x2ce0c0=_0x11eb20['dialNoSuchNumberRetryFrequency'];_0x13475b=_0x11eb20[_0xbb42('0xd2')];hopperUtils['createHistory'](_0x129c62)['catch'](loggerCatch(_0xbb42('0x116')));if(_0x5dcffb[_0xbb42('0x19e')](0x0,_0x6e9438,_0x11eb20)&&!_0x330a90){if(_0x129c62[_0xbb42('0x11a')]>=_0x11eb20[_0xbb42('0x192')]){_0x5dcffb['createStateFinal'](_0x129c62,_0x415c2d,_0x519738,_0xbb42('0x19f'));}else{_0x5dcffb[_0xbb42('0x11c')](_0x129c62,_0x415c2d,_0x519738,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x11eb20['outboundNoAnswerCallsDay']+=0x1;_0x129c62[_0xbb42('0x6a')]=0x3;_0x129c62['statedesc']=_0xbb42('0x1a0');_0x129c62[_0xbb42('0x119')]+=0x1;_0x129c62['countglobal']+=0x1;var _0x4f416a=ut['buildNoAnswerEventPayload'](_0x6e9438,_0x11eb20);ami[_0xbb42('0x3a')](_0xbb42('0x1a1'),_0x4f416a);_0x2ce0c0=_0x11eb20[_0xbb42('0x18b')];_0x13475b=_0x11eb20[_0xbb42('0xd2')];hopperUtils[_0xbb42('0xc4')](_0x129c62)['catch'](loggerCatch(_0xbb42('0x1a2')));if(_0x5dcffb[_0xbb42('0x19e')](0x3,_0x6e9438,_0x11eb20)&&!_0x330a90){if(_0x129c62[_0xbb42('0x119')]>=_0x11eb20[_0xbb42('0x1a3')]){_0x5dcffb[_0xbb42('0x11d')](_0x129c62,_0x415c2d,_0x519738,_0xbb42('0x1a4'));}else{_0x5dcffb['stateGlobal'](_0x129c62,_0x415c2d,_0x519738,_0xbb42('0x1a4'));}}break;case'5':_0x11eb20['outboundBusyCallsDay']+=0x1;_0x129c62[_0xbb42('0x6a')]=0x5;_0x129c62[_0xbb42('0x6b')]=_0xbb42('0x1a5');_0x129c62[_0xbb42('0x117')]+=0x1;_0x129c62['countglobal']+=0x1;ami['emit'](_0xbb42('0x1a6'),ut['buildObj'](_0x6e9438,_0xbb42('0x1a7')));_0x2ce0c0=_0x11eb20[_0xbb42('0x18e')];_0x13475b=_0x11eb20[_0xbb42('0xd2')];hopperUtils[_0xbb42('0xc4')](_0x129c62)['catch'](loggerCatch(_0xbb42('0x1a8')));if(_0x5dcffb[_0xbb42('0x19e')](0x5,_0x6e9438,_0x11eb20)&&!_0x330a90){if(_0x129c62['countbusyretry']>=_0x11eb20[_0xbb42('0x18d')]){_0x5dcffb[_0xbb42('0x11d')](_0x129c62,_0x415c2d,_0x519738,_0xbb42('0x1a9'));}else{_0x5dcffb['stateGlobal'](_0x129c62,_0x415c2d,_0x519738,_0xbb42('0x1a9'));}}break;case'8':_0x11eb20[_0xbb42('0x1aa')]+=0x1;_0x129c62['state']=0x8;_0x129c62[_0xbb42('0x6b')]=_0xbb42('0x1ab');_0x129c62[_0xbb42('0x118')]+=0x1;_0x129c62[_0xbb42('0xd0')]+=0x1;_0x2ce0c0=_0x11eb20['dialCongestionRetryFrequency'];_0x13475b=_0x11eb20[_0xbb42('0xd2')];ami['emit'](_0xbb42('0x1ac'),ut['buildObj'](_0x6e9438,_0xbb42('0x1ad')));hopperUtils[_0xbb42('0xc4')](_0x129c62)[_0xbb42('0x9b')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x5dcffb[_0xbb42('0x19e')](0x8,_0x6e9438,_0x11eb20)&&!_0x330a90){if(_0x129c62[_0xbb42('0x118')]>=_0x11eb20[_0xbb42('0x190')]){_0x5dcffb[_0xbb42('0x11d')](_0x129c62,_0x415c2d,_0x519738,_0xbb42('0x1ae'));}else{_0x5dcffb[_0xbb42('0x11c')](_0x129c62,_0x415c2d,_0x519738,_0xbb42('0x1ae'));}}break;case'11':_0x11eb20[_0xbb42('0x1af')]+=0x1;_0x129c62[_0xbb42('0x6a')]=0xb;_0x129c62['statedesc']=_0xbb42('0xe2');_0x129c62[_0xbb42('0xe5')]+=0x1;_0x129c62[_0xbb42('0xd0')]+=0x1;_0x2ce0c0=_0x11eb20[_0xbb42('0xe4')];_0x13475b=_0x11eb20[_0xbb42('0xd2')];hopperUtils[_0xbb42('0xc4')](_0x129c62)[_0xbb42('0x9b')](loggerCatch(_0xbb42('0x1b0')));if(_0x5dcffb[_0xbb42('0x19e')](0xb,_0x6e9438,_0x11eb20)&&!_0x330a90){if(_0x129c62[_0xbb42('0xe5')]>=_0x11eb20[_0xbb42('0xe6')]){_0x5dcffb[_0xbb42('0x11d')](_0x129c62,_0x415c2d,_0x519738,_0xbb42('0x1b1'));}else{_0x5dcffb[_0xbb42('0x11c')](_0x129c62,_0x415c2d,_0x519738,_0xbb42('0x1b1'));}}break;case'20':_0x11eb20[_0xbb42('0x1b2')]+=0x1;_0x129c62[_0xbb42('0x6a')]=0x14;_0x129c62['statedesc']='AgentReject';_0x129c62['countagentrejectretry']+=0x1;_0x129c62[_0xbb42('0xd0')]+=0x1;_0x2ce0c0=_0x11eb20[_0xbb42('0x195')];_0x13475b=_0x11eb20['callAdditionalPhoneAfterMin'];ami[_0xbb42('0x3a')](_0xbb42('0x1b3'),ut['buildObj'](_0x6e9438,'agentreject'));hopperUtils[_0xbb42('0xc4')](_0x129c62)[_0xbb42('0x9b')](loggerCatch(_0xbb42('0x1b4')));if(_0x5dcffb[_0xbb42('0x19e')](0x14,_0x6e9438,_0x11eb20)&&!_0x330a90){if(_0x129c62[_0xbb42('0x125')]>=_0x11eb20[_0xbb42('0x194')]){_0x5dcffb[_0xbb42('0x11d')](_0x129c62,_0x415c2d,_0x519738,'reason\x2020\x20agentreject');}else{_0x5dcffb[_0xbb42('0x11c')](_0x129c62,_0x415c2d,_0x519738,_0xbb42('0x1b5'));}}break;default:_0x11eb20['outboundUnknownCallsDay']+=0x1;_0x129c62[_0xbb42('0x6a')]=0xc;_0x129c62['statedesc']=_0x3ea846['reason'];_0x2ce0c0=_0x11eb20[_0xbb42('0x195')];_0x13475b=_0x11eb20[_0xbb42('0xd2')];hopperUtils[_0xbb42('0xc4')](_0x129c62)[_0xbb42('0x9b')](loggerCatch(_0xbb42('0x1b6')));if(_0x5dcffb['checkRetriveMax'](_0x3ea846[_0xbb42('0x19a')],_0x6e9438,_0x11eb20)&&!_0x330a90){if(_0x129c62['countbusyretry']+_0x129c62[_0xbb42('0x118')]+_0x129c62[_0xbb42('0x119')]+_0x129c62['countnosuchnumberretry']+_0x129c62[_0xbb42('0xcf')]+_0x129c62['countabandonedretry']+_0x129c62['countmachineretry']+_0x129c62['countagentrejectretry']>=_0x11eb20[_0xbb42('0x11b')]){_0x5dcffb['stateGlobal'](_0x129c62,_0x415c2d,_0x519738,_0x3ea846['reason']);}else{_0x5dcffb[_0xbb42('0x11d')](_0x129c62,_0x415c2d,_0x519738,_0x3ea846[_0xbb42('0x19a')]);}}}})[_0xbb42('0x37')](function(){if(_0x330a90){hopperUtils['swapAdditionalPhones'](_0x129c62,_0x2ce0c0,_0x13475b)[_0xbb42('0x37')](function(){return _0x415c2d(0x1);});}});});};Dialer['prototype'][_0xbb42('0x11c')]=function(_0x52481c,_0x30aa67,_0x381cf2,_0x5a9fd8){var _0x1a8e1d=new Final(_0x52481c);_0x1a8e1d['state']=0xf;_0x1a8e1d['statedesc']=_0xbb42('0x1b7');this[_0xbb42('0x11d')](_0x1a8e1d,_0x30aa67,_0x381cf2,_0x5a9fd8);};Dialer[_0xbb42('0x82')][_0xbb42('0x11d')]=function(_0x5c3412,_0x3d8bf3,_0x41333b,_0x5c5b02){hopperUtils[_0xbb42('0xc6')](_0x5c3412)[_0xbb42('0x37')](function(){return _0x3d8bf3(msgResponse(_0xbb42('0x197'),'Success',_0x5c5b02));})[_0xbb42('0x9b')](function(){return _0x41333b(msgResponse('[moveContactManagedDialer][0]',_0xbb42('0x8f'),_0xbb42('0x1b8')));});};Dialer[_0xbb42('0x82')][_0xbb42('0x8')]=function(_0x4dd6cc){var _0x70828d=_0x4dd6cc[_0xbb42('0x1b9')]/0x64;var _0x5d55da=_0x4dd6cc['outboundDropCallsDayTimeout']/(_0x4dd6cc[_0xbb42('0xcb')]+_0x4dd6cc[_0xbb42('0x113')]);var _0x97ca24=Math[_0xbb42('0x1ba')](_0x4dd6cc['predictiveIntervalAvailable']*(_0x4dd6cc[_0xbb42('0x1bb')]/0x64));var _0x1913a3=Math[_0xbb42('0x1ba')](_0x4dd6cc['predictiveIntervalAvailable']*(_0x4dd6cc['predictiveIntervalMinThreshold']/0x64));var _0x23bf28=_0x4dd6cc[_0xbb42('0x134')]+_0x4dd6cc[_0xbb42('0x135')];var _0x31b7cd=Math[_0xbb42('0x1bc')](_0x4dd6cc[_0xbb42('0x55')]*_0x4dd6cc['erlangAbandonmentRate']*_0x4dd6cc[_0xbb42('0x1bd')]*_0x4dd6cc['predictiveIntervalMultiplicativeFactor']);if(_[_0xbb42('0x39')](_0x4dd6cc[_0xbb42('0x5b')])){if(!_['isUndefined'](_0x4dd6cc[_0xbb42('0x22')])){_0x4dd6cc[_0xbb42('0x22')]=undefined;loggerPredictive[_0xbb42('0x5f')](_0xbb42('0x1be'),_0xbb42('0x1bf'));}if(!_['isUndefined'](_0x4dd6cc['handlePredictive'])){loggerPredictive[_0xbb42('0x5f')](_0xbb42('0x1be'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x4dd6cc[_0xbb42('0x5d')]);_0x4dd6cc[_0xbb42('0x5d')]=undefined;}_0x4dd6cc[_0xbb42('0x5b')]=moment()[_0xbb42('0x84')](_0xbb42('0xc0'));loggerPredictive[_0xbb42('0x43')](_0x4dd6cc[_0xbb42('0x40')],'collection\x20data\x20in\x20progressive\x20at',_0x4dd6cc['startProgressive']);this['handlePower'](_0x4dd6cc,0x1);}else if(ifInterval(_0x4dd6cc[_0xbb42('0x1c0')],_0x4dd6cc[_0xbb42('0x5b')])){this[_0xbb42('0xaf')](_0x4dd6cc,0x1);loggerPredictiveCalls['info'](_0xbb42('0x1c1'),_0x4dd6cc[_0xbb42('0x5b')],_0x4dd6cc['name']);_0x4dd6cc[_0xbb42('0x55')]=0x0;_0x4dd6cc['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x70828d<_0x5d55da&&_0x4dd6cc['dialPredictiveOptimization']==='dropRate'){clearPredictiveAttributes(_0x4dd6cc);loggerPredictive['info'](_0xbb42('0x1c2'),_0xbb42('0x1c3'),_0x5d55da,_0xbb42('0x5b'),_0x4dd6cc[_0xbb42('0x40')]);}else if(_0x31b7cd<_0x4dd6cc[_0xbb42('0x1c4')]&&_0x4dd6cc[_0xbb42('0x1c5')]==='dropRate'){clearPredictiveAttributes(_0x4dd6cc);loggerPredictive['info'](_0xbb42('0x1c6'),_0xbb42('0x1c7'),_0x31b7cd,'Drop\x20in\x20this\x20interval',_0x4dd6cc[_0xbb42('0x1c4')],_0xbb42('0x5b'),_0x4dd6cc[_0xbb42('0x40')]);}else if(!ifInterval(_0x4dd6cc['dialPredictiveInterval'],_0x4dd6cc[_0xbb42('0x5b')])&&_[_0xbb42('0x39')](_0x4dd6cc[_0xbb42('0x22')])&&!_[_0xbb42('0x39')](_0x4dd6cc[_0xbb42('0x5b')])){_0x4dd6cc[_0xbb42('0x22')]=moment()[_0xbb42('0x84')](_0xbb42('0xc0'));loggerPredictive['info'](_0x4dd6cc[_0xbb42('0x40')],_0xbb42('0x1c8'),_0x4dd6cc[_0xbb42('0x22')]);hopperUtils[_0xbb42('0x1c9')](_0x4dd6cc[_0xbb42('0x1c0')])[_0xbb42('0x37')](this[_0xbb42('0x1ca')](_0x4dd6cc))[_0xbb42('0x37')](mergeDataErlangB(_0x4dd6cc))[_0xbb42('0x37')](this[_0xbb42('0x1cb')](_0x4dd6cc))[_0xbb42('0x9b')](loggerCatchPredictive(_0xbb42('0x1cc'),_0x4dd6cc));}else if(!ifInterval(_0x4dd6cc[_0xbb42('0x1c0')],_0x4dd6cc[_0xbb42('0x22')])){_0x4dd6cc['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x4dd6cc['startPredictive']=moment()[_0xbb42('0x84')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x4dd6cc[_0xbb42('0x40')],_0xbb42('0x1cd'),_0x4dd6cc['startPredictive']);clearInterval(_0x4dd6cc['handlePredictive']);_0x4dd6cc[_0xbb42('0x5d')]=undefined;hopperUtils[_0xbb42('0x1c9')](_0x4dd6cc['dialPredictiveInterval'])['then'](this[_0xbb42('0x1ca')](_0x4dd6cc))[_0xbb42('0x37')](mergeDataErlangB(_0x4dd6cc))[_0xbb42('0x37')](this[_0xbb42('0x1cb')](_0x4dd6cc))[_0xbb42('0x9b')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x4dd6cc));}else if(_0x4dd6cc[_0xbb42('0x1ce')]&&_0x23bf28<_0x4dd6cc['predictiveIntervalAvailable']-_0x1913a3){clearPredictiveAttributes(_0x4dd6cc);loggerPredictive[_0xbb42('0x43')](_0x4dd6cc[_0xbb42('0x40')],_0xbb42('0x1cf'),_0x23bf28,_0xbb42('0x1d0'),_0x4dd6cc[_0xbb42('0x1ce')],'-',_0x1913a3,'=',_0x4dd6cc['predictiveIntervalAvailable']-_0x1913a3,')');}else if(_0x4dd6cc[_0xbb42('0x1ce')]&&_0x23bf28>_0x4dd6cc[_0xbb42('0x1ce')]+_0x97ca24){clearPredictiveAttributes(_0x4dd6cc);loggerPredictive[_0xbb42('0x43')](_0x4dd6cc[_0xbb42('0x40')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x23bf28,_0xbb42('0x1d1'),_0x4dd6cc[_0xbb42('0x1ce')],'+',_0x97ca24,'=',_0x4dd6cc[_0xbb42('0x1ce')]+_0x97ca24,')');}};Dialer['prototype'][_0xbb42('0x1ca')]=function(_0x4bb824){var _0x6bce90=this;return function(_0x39405f){return new Promise(function(_0x56e499,_0x4e5bb4){_[_0xbb42('0x59')](_0x4bb824,_0x39405f[0x0]);if(checkGetDataPredictive(_0x39405f[0x0])){var _0x2be988=_0x4bb824[_0xbb42('0x1ce')]=_0x4bb824[_0xbb42('0x135')]+_0x4bb824[_0xbb42('0x134')];var _0x5f4aad=_0x4bb824[_0xbb42('0x1c0')]*0x3c;var _0x2013dc=_0x39405f[0x0][_0xbb42('0x4c')]+_0x39405f[0x0][_0xbb42('0x4b')];var _0x585714=(_0x39405f[0x0][_0xbb42('0x47')]+_0x39405f[0x0][_0xbb42('0x49')]+_0x39405f[0x0][_0xbb42('0x4a')])/_0x39405f[0x0][_0xbb42('0x4e')];_0x4bb824[_0xbb42('0x1bd')]=_0x585714>0x0?_0x585714:0x1;switch(_0x4bb824[_0xbb42('0x1c5')]){case _0xbb42('0x1d2'):var _0x5ed381=_0x4bb824['dialPredictiveOptimizationPercentage']/0x64;return _0x6bce90[_0xbb42('0x1d3')](_0x2be988,_0x5f4aad,_0x2013dc,_0x585714,_0x5ed381)[_0xbb42('0x37')](function(_0x19d9d4){return _0x56e499(_0x19d9d4);});case _0xbb42('0x1d4'):var _0x17e0c5=_0x4bb824[_0xbb42('0x1b9')]/0x64;return _0x6bce90[_0xbb42('0x1d5')](_0x2be988,_0x5f4aad,_0x2013dc,_0x585714,_0x17e0c5)[_0xbb42('0x37')](function(_0x4eef7b){return _0x56e499(_0x4eef7b);});default:return _0x4e5bb4(msgResponse(_0xbb42('0x1d6'),_0xbb42('0x8f'),_0xbb42('0x1d7')));}}else{return _0x4e5bb4(msgResponse(_0xbb42('0x1d6'),_0xbb42('0x8f'),_0xbb42('0x1d8')));}});};};Dialer[_0xbb42('0x82')][_0xbb42('0x1d9')]=function(_0xc81163){var _0x12d6b4=this;return function(_0x2409ce){return new Promise(function(_0x2d2cef,_0x26c45a){_[_0xbb42('0x59')](_0xc81163,_0x2409ce[0x0]);if(checkGetDataPredictive(_0x2409ce[0x0])){loggerPredictive[_0xbb42('0x43')](JSON[_0xbb42('0x81')](_0x2409ce[0x0]));if(_0xc81163[_0xbb42('0x1c5')]===_0xbb42('0x1d2')){return _0x12d6b4[_0xbb42('0x14a')](_0xc81163['id'])[_0xbb42('0x37')](function(_0x3d3da1){var _0x37c695=_0xc81163[_0xbb42('0x1da')]-_0x3d3da1[0x0][_0xbb42('0x1db')];var _0x3b7ac1=_0xc81163['dialPredictiveInterval']*0x3c;var _0x3fbd30=_0x2409ce[0x0][_0xbb42('0x4c')]+_0x2409ce[0x0][_0xbb42('0x4b')];var _0x534f5f=(_0x2409ce[0x0]['predictiveIntervalAnsweredCalls']+_0x2409ce[0x0][_0xbb42('0x49')]+_0x2409ce[0x0][_0xbb42('0x4a')])/_0x2409ce[0x0][_0xbb42('0x4e')];var _0x58310e=_0xc81163[_0xbb42('0x1b9')]/0x64;_0xc81163['predictiveIntervalPauses']=_0x3d3da1[0x0][_0xbb42('0x1db')]||0x0;_0xc81163[_0xbb42('0x1bd')]=_0x534f5f>0x0?_0x534f5f:0x1;return _0x12d6b4[_0xbb42('0x1d3')](_0x37c695,_0x3b7ac1,_0x3fbd30,_0x534f5f,_0x58310e);})['then'](function(_0x5b2751){return _0x2d2cef(_0x5b2751);})[_0xbb42('0x9b')](function(_0x4087b8){return _0x26c45a(msgResponse('[CatchErlangB]',_0xbb42('0x8f'),JSON[_0xbb42('0x81')](_0x4087b8)));});}if(_0xc81163[_0xbb42('0x1c5')]==='agentBusyFactor'){return _0x12d6b4['getVoiceQueueRtPauses'](_0xc81163['id'])[_0xbb42('0x37')](function(_0x32722b){var _0x3960e1=_0xc81163[_0xbb42('0x1da')]-_0x32722b[0x0][_0xbb42('0x1db')];var _0x335925=_0xc81163['dialPredictiveInterval']*0x3c;var _0x31df6a=_0x2409ce[0x0]['predictiveIntervalAvgTalktime']+_0x2409ce[0x0][_0xbb42('0x4b')];var _0x96c805=(_0x2409ce[0x0][_0xbb42('0x47')]+_0x2409ce[0x0][_0xbb42('0x49')]+_0x2409ce[0x0][_0xbb42('0x4a')])/_0x2409ce[0x0][_0xbb42('0x4e')];var _0x4c2df1=_0xc81163[_0xbb42('0x1b9')]/0x64;_0xc81163[_0xbb42('0x1dc')]=_0x32722b[0x0][_0xbb42('0x1db')]||0x0;_0xc81163['predictiveIntervalHitRate']=_0x96c805>0x0?_0x96c805:0x1;return _0x12d6b4[_0xbb42('0x1d5')](_0x3960e1,_0x335925,_0x31df6a,_0x96c805,_0x4c2df1);})[_0xbb42('0x37')](function(_0x11eae3){return _0x2d2cef(_0x11eae3);})[_0xbb42('0x9b')](function(_0x8aa90b){return _0x26c45a(msgResponse(_0xbb42('0x1dd'),'Failure',JSON[_0xbb42('0x81')](_0x8aa90b)));});}}else{return _0x26c45a(msgResponse('[getDataPredictive]',_0xbb42('0x8f'),_0xbb42('0x1d8')));}});};};Dialer[_0xbb42('0x82')][_0xbb42('0x1cb')]=function(_0x94a0dd){var _0x4ba9ab=this;return function(){var _0x44c652=0x0;var _0xb7b83a=Math[_0xbb42('0x1bc')](_0x94a0dd['erlangCallToSecond']*0x3e8);if(_0xb7b83a>0x0){_0xb7b83a=_0xb7b83a<0x64?0x64:_0xb7b83a;loggerPredictive[_0xbb42('0x43')](_0x94a0dd[_0xbb42('0x40')],_0xbb42('0x1de'),_0xb7b83a,_0xbb42('0x1df'));_0x94a0dd['handlePredictive']=setInterval(function(){_0x4ba9ab['handlePredictive'](_0x94a0dd);loggerPredictiveCalls[_0xbb42('0x43')](_0xbb42('0x1e0'),_0x44c652+=0x1);},_0xb7b83a);}else{loggerPredictive['info'](_0x94a0dd[_0xbb42('0x40')],_0xbb42('0x1e1'));}};};Dialer['prototype'][_0xbb42('0x1e2')]=function(_0x214816,_0x5d6ab1){var _0xcb0183=this;return function(_0x36eca2){if(_[_0xbb42('0x42')](_0x36eca2)){if(_[_0xbb42('0xee')](_0x5d6ab1[_0xbb42('0x150')])||!_0x5d6ab1[_0xbb42('0x1e3')]){if(_0x214816[_0xbb42('0xad')]==='booked'){_0x214816[_0xbb42('0x6e')]=_[_0xbb42('0x39')](_0x214816[_0xbb42('0x6e')])?!![]:_0x214816[_0xbb42('0x6e')];var _0x43ed50=uuid['v4']();_0xcb0183['actions'][_0x43ed50]=new Action(_0x214816,_0x5d6ab1,_0x43ed50);loggerBooked[_0xbb42('0x43')]('[booked][checkContactBlack]',_0x43ed50,_0xbb42('0x1e4'),JSON['stringify'](_0x214816[_0xbb42('0x6e')]),_0xbb42('0x1e5'),_0x214816['name']);if(_0x214816[_0xbb42('0x6e')]){_0x214816[_0xbb42('0x6e')]=![];_0xcb0183['queueBooked'][_0xcb0183[_0xbb42('0x21')][_0x43ed50]['queue']]=[];ami[_0xbb42('0x96')]({'actionid':_0x43ed50,'action':_0xbb42('0x1e6'),'queue':_0x214816[_0xbb42('0x40')]})['catch'](function(){_0xcb0183[_0xbb42('0xbf')](_0x214816);hopperUtils[_0xbb42('0xd8')]({'active':![],'ContactId':_0xcb0183[_0xbb42('0x21')][_0x43ed50][_0xbb42('0xdb')],'ListId':_0xcb0183[_0xbb42('0x21')][_0x43ed50]['ListId'],'VoiceQueueId':_0xcb0183[_0xbb42('0x21')][_0x43ed50][_0xbb42('0xe7')]||undefined,'CampaignId':_0xcb0183[_0xbb42('0x21')][_0x43ed50][_0xbb42('0xdd')]||undefined})[_0xbb42('0x9b')](loggerCatch(_0xbb42('0x1e7')));delete _0xcb0183[_0xbb42('0x21')][_0x43ed50];});}else{loggerBooked[_0xbb42('0x43')]('[booked][checkContactBlack][else]',JSON[_0xbb42('0x81')](_0x214816['queueStatusComplete']),_0xbb42('0x1e5'),_0x214816[_0xbb42('0x40')]);_0xcb0183[_0xbb42('0xbf')](_0x214816);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0xcb0183[_0xbb42('0x21')][_0x43ed50][_0xbb42('0xdb')],'ListId':_0xcb0183[_0xbb42('0x21')][_0x43ed50][_0xbb42('0xdc')],'VoiceQueueId':_0xcb0183[_0xbb42('0x21')][_0x43ed50][_0xbb42('0xe7')]||undefined,'CampaignId':_0xcb0183['actions'][_0x43ed50]['CampaignId']||undefined})[_0xbb42('0x9b')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0xcb0183[_0xbb42('0x21')][_0x43ed50];}}else{return _0xcb0183[_0xbb42('0x155')](_0x214816,_0x5d6ab1);}}else{if(utils[_0xbb42('0x5a')](undefined,_0x5d6ab1[_0xbb42('0x1e8')])<_0x214816['dialRecallMeTimeout']*0x3c){if(_0x5d6ab1[_0xbb42('0x1e9')]&&!_0x5d6ab1[_0xbb42('0x1e9')][_0xbb42('0x1ea')]){_0xcb0183[_0xbb42('0x1a')]['run'](_0x5d6ab1['id'])['finally'](function(){_0xcb0183[_0xbb42('0xbf')](_0x214816);});}else{hopperUtils[_0xbb42('0x1eb')]({'active':![]},_0x5d6ab1['id'],0x1)[_0xbb42('0x19')](function(){_0xcb0183[_0xbb42('0xbf')](_0x214816);});}}else{_0x214816[_0xbb42('0x1ec')]+=0x1;_0xcb0183['updateOriginated'](_0x214816);if(_0x214816[_0xbb42('0x1ed')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5d6ab1[_0xbb42('0xdb')],'ListId':_0x5d6ab1['ListId'],'VoiceQueueId':_0x5d6ab1[_0xbb42('0xe7')]||undefined,'CampaignId':_0x5d6ab1[_0xbb42('0xdd')]||undefined})[_0xbb42('0x9b')](loggerCatch(_0xbb42('0x1ee')));hopperUtils[_0xbb42('0xc4')](createObjHistory(_0x214816,_0x5d6ab1,utils[_0xbb42('0x63')][_0xbb42('0x1ef')],0x17,_0xbb42('0x1f0')))[_0xbb42('0x9b')](loggerCatch(_0xbb42('0x1f1')));}else{_0xcb0183['saveInDb'](createObjHistory(_0x214816,_0x5d6ab1,utils[_0xbb42('0x63')][_0xbb42('0x1f2')],0x16,_0xbb42('0x1f3')),_0xbb42('0x1f4'),_0xbb42('0x1f5'));}}}}else{_0x214816[_0xbb42('0x1f6')]+=0x1;_0xcb0183['saveInDb'](createObjHistory(_0x214816,_0x5d6ab1,utils[_0xbb42('0x63')][_0xbb42('0x1f7')],0xd,_0xbb42('0x1f8')),_0xbb42('0x1f9'),_0xbb42('0x1fa'));throw _0xbb42('0x1fb');}};};Dialer[_0xbb42('0x82')][_0xbb42('0x154')]=function(_0x1a7159){var _0x6f3ece=this;var _0x854cc6=_0x1a7159[_0xbb42('0x1fc')]-_0x1a7159['originated']-_0x1a7159['temp'];emitCampaignSummary(_0x1a7159);if(_0x854cc6>0x0){if(_0x854cc6>this['maxNumberOriginate']){_0x854cc6=this[_0xbb42('0x1f')];}_0x1a7159[_0xbb42('0x1fd')]+=_0x854cc6;hopperUtils[_0xbb42('0x1fe')](_0x1a7159['id'],_0x854cc6,_0x1a7159[_0xbb42('0x1ff')],_0x1a7159)[_0xbb42('0x37')](function(_0x45b967){_0x1a7159[_0xbb42('0x1fd')]-=_0x854cc6;_0x1a7159[_0xbb42('0x1fd')]=_0x1a7159[_0xbb42('0x1fd')]>0x0?_0x1a7159[_0xbb42('0x1fd')]:0x0;if(!utils[_0xbb42('0x200')](_0x45b967)){_0x1a7159['message']=utils['CAMPAIGN_STATUS'][_0xbb42('0x68')];logger['info'](_0xbb42('0x201')+_0x1a7159[_0xbb42('0x40')]);}else{_0x1a7159[_0xbb42('0x7c')]+=_0x45b967[_0xbb42('0xf9')];_0x1a7159['message']=utils[_0xbb42('0x63')][_0xbb42('0x202')];for(var _0x3a7970=0x0;_0x3a7970<_0x45b967[_0xbb42('0xf9')];_0x3a7970+=0x1){_0x1a7159[_0xbb42('0x203')]+=0x1;if(_[_0xbb42('0xee')](_0x45b967[_0x3a7970])||_[_0xbb42('0xee')](_0x45b967[_0x3a7970]['Contact'])||_[_0xbb42('0xee')](_0x45b967[_0x3a7970]['phone'])){_0x6f3ece[_0xbb42('0x204')]('[actionOriginate]\x20',_0x1a7159,_0x45b967[_0x3a7970]);}else{hopperUtils[_0xbb42('0x205')](_[_0xbb42('0xf2')](_0x45b967[_0x3a7970],[_0xbb42('0xdd'),_0xbb42('0x159')]))[_0xbb42('0x37')](_0x6f3ece[_0xbb42('0x1e2')](_0x1a7159,_0x45b967[_0x3a7970]))['catch'](_0x6f3ece['loggerHandler'](_0xbb42('0x206'),_0x1a7159));}}}})[_0xbb42('0x9b')](loggerGetContactDialer(_0xbb42('0x207'),_0x1a7159,_0x854cc6));}};Dialer[_0xbb42('0x82')][_0xbb42('0xaf')]=function(_0xa6654a,_0x473114){var _0x39d0cc=this;var _0x2a9e68=[];if(_0x473114<0x1||_0xa6654a[_0xbb42('0xad')]===_0xbb42('0xb2')){_0x473114=0x1;}var _0x9a36e6=Math[_0xbb42('0x1bc')](_0xa6654a[_0xbb42('0x134')]*_0x473114)-_0xa6654a[_0xbb42('0x7c')]-_0xa6654a['temp'];if(_0xa6654a[_0xbb42('0x208')]>0x0){var _0x3334e3=_0xa6654a[_0xbb42('0x208')]-_0xa6654a['originated']-_0xa6654a[_0xbb42('0x135')]-_0xa6654a['temp']-_0xa6654a[_0xbb42('0x136')];if(_0x9a36e6>_0x3334e3){_0x9a36e6=_0x3334e3;}}if(_0x9a36e6>0x0){if(_0xa6654a[_0xbb42('0xad')]==='booked'){_0x9a36e6=0x1;}if(_0x9a36e6>this[_0xbb42('0x1f')]){_0x9a36e6=this[_0xbb42('0x1f')];}_0xa6654a['temp']+=_0x9a36e6;for(var _0x53f248 in this[_0xbb42('0x1d')]){if(typeof this['agents'][_0x53f248]!=='undefined'){if(this[_0xbb42('0x1d')][_0x53f248][_0xbb42('0x6a')]===_0xbb42('0x209')&&this['agents'][_0x53f248][_0xbb42('0xf0')]==='reachable'){_0x2a9e68['push'](this[_0xbb42('0x1d')][_0x53f248]['id']);}}}hopperUtils[_0xbb42('0x20a')](_0xa6654a,_0x2a9e68,_0x9a36e6)[_0xbb42('0x37')](function(_0x5ebdb9){_0xa6654a[_0xbb42('0x1fd')]-=_0x9a36e6;_0xa6654a[_0xbb42('0x1fd')]=_0xa6654a[_0xbb42('0x1fd')]>0x0?_0xa6654a[_0xbb42('0x1fd')]:0x0;if(!utils[_0xbb42('0x200')](_0x5ebdb9)){hopperUtils['countReScheduled'](_0xa6654a)[_0xbb42('0x37')](sendMessageReschedule(_0xa6654a))[_0xbb42('0x9b')](loggerCatch('[countReScheduled]\x20'));}else{_0xa6654a[_0xbb42('0x7c')]+=_0x5ebdb9[_0xbb42('0xf9')];_0xa6654a[_0xbb42('0x67')]=_0xa6654a[_0xbb42('0xad')]===_0xbb42('0xb2')?utils[_0xbb42('0x63')][_0xbb42('0x137')]:utils[_0xbb42('0x63')][_0xbb42('0x202')];for(var _0x18d5ae=0x0;_0x18d5ae<_0x5ebdb9[_0xbb42('0xf9')];_0x18d5ae+=0x1){if(_[_0xbb42('0xee')](_0x5ebdb9[_0x18d5ae])||_[_0xbb42('0xee')](_0x5ebdb9[_0x18d5ae][_0xbb42('0x172')])||_[_0xbb42('0xee')](_0x5ebdb9[_0x18d5ae][_0xbb42('0x159')])){_0x39d0cc[_0xbb42('0x204')](_0xbb42('0x20b'),_0xa6654a,_0x5ebdb9[_0x18d5ae]);}else{hopperUtils[_0xbb42('0x20c')](_['pick'](_0x5ebdb9[_0x18d5ae],[_0xbb42('0xe7'),_0xbb42('0x159')]))[_0xbb42('0x37')](_0x39d0cc[_0xbb42('0x1e2')](_0xa6654a,_0x5ebdb9[_0x18d5ae]))[_0xbb42('0x9b')](_0x39d0cc[_0xbb42('0x14e')](_0xbb42('0x20b'),_0xa6654a));}}}})[_0xbb42('0x9b')](loggerGetContactDialer('[getContactDialer2]',_0xa6654a,_0x9a36e6));}};Dialer['prototype'][_0xbb42('0x5d')]=function(_0x1e7313){if(_0x1e7313[_0xbb42('0x208')]>0x0){var _0xc80d02=_0x1e7313[_0xbb42('0x208')]-_0x1e7313['originated']-_0x1e7313[_0xbb42('0x135')];if(_0xc80d02>0x0){this[_0xbb42('0x20d')](_0x1e7313);}else{loggerPredictiveCalls[_0xbb42('0x43')](_0xbb42('0x20e'));}}else{this[_0xbb42('0x20d')](_0x1e7313);}};Dialer['prototype'][_0xbb42('0x20d')]=function(_0x4bed9a){var _0x457ea2=this;var _0x5cb97e=[];_0x4bed9a['originated']+=0x1;for(var _0x3c7ced in this[_0xbb42('0x1d')]){if(typeof this['agents'][_0x3c7ced]!=='undefined'){if(this[_0xbb42('0x1d')][_0x3c7ced]['state']===_0xbb42('0x209')&&this[_0xbb42('0x1d')][_0x3c7ced][_0xbb42('0xf0')]===_0xbb42('0x85')){_0x5cb97e[_0xbb42('0x95')](this[_0xbb42('0x1d')][_0x3c7ced]['id']);}}}return this['getContactDialer'](_0x4bed9a['id'],_0x5cb97e,0x1,_0x4bed9a[_0xbb42('0x1ff')],_0x4bed9a)['then'](function(_0x4e0934){if(!utils[_0xbb42('0x200')](_0x4e0934)){utils[_0xbb42('0x61')](_0x4bed9a,0x1,0x0);return hopperUtils[_0xbb42('0x20f')](_0x4bed9a)['then'](sendMessageReschedule(_0x4bed9a))[_0xbb42('0x9b')](loggerCatch(_0xbb42('0x210')));}else{_0x4bed9a[_0xbb42('0x67')]=utils[_0xbb42('0x63')][_0xbb42('0x202')];if(_['isNil'](_0x4e0934[0x0])||_[_0xbb42('0xee')](_0x4e0934[0x0][_0xbb42('0x172')])||_['isNil'](_0x4e0934[0x0]['phone'])){_0x457ea2[_0xbb42('0x204')]('[actionOriginate]\x20',_0x4bed9a,_0x4e0934[0x0]);}else{return hopperUtils[_0xbb42('0x20c')](_[_0xbb42('0xf2')](_0x4e0934[0x0],['VoiceQueueId','phone']))[_0xbb42('0x37')](_0x457ea2[_0xbb42('0x1e2')](_0x4bed9a,_0x4e0934[0x0]))[_0xbb42('0x9b')](_0x457ea2[_0xbb42('0x14e')](_0xbb42('0x211'),_0x4bed9a));}}})[_0xbb42('0x9b')](loggerGetContactDialer(_0xbb42('0x212'),_0x4bed9a,0x1));};Dialer[_0xbb42('0x82')]['abandonmentRate']=function(_0x308c31,_0x199533,_0x837c82,_0x437594,_0x3407fd,_0xd34046){loggerPredictive[_0xbb42('0x43')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xbb42('0x43')]('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',_0x308c31);loggerPredictive[_0xbb42('0x43')](_0xbb42('0x213'),_0x199533);loggerPredictive[_0xbb42('0x43')](_0xbb42('0x214'),_0x837c82);loggerPredictive[_0xbb42('0x43')](_0xbb42('0x215'),_0x437594);loggerPredictive[_0xbb42('0x43')](_0xbb42('0x216'),_0x3407fd);loggerPredictive[_0xbb42('0x43')](_0xbb42('0x4d'));return new Promise(function(_0xb3ed63,_0x319d13){if(_0x308c31<=0x0||isNaN(_0x308c31)){return _0x319d13(msgResponse(_0xbb42('0x217'),_0xbb42('0xba'),_0xbb42('0x218')+_0x308c31));}if(_0x837c82<=0x0||isNaN(_0x837c82)){return _0x319d13(msgResponse(_0xbb42('0x217'),'Error',_0xbb42('0x219')+_0x837c82));}if(_0x437594<=0x0||isNaN(_0x437594)){return _0x319d13(msgResponse(_0xbb42('0x217'),_0xbb42('0xba'),_0xbb42('0x21a')+_0x437594));}if(_0x199533<=0x0||isNaN(_0x199533)){return _0x319d13(msgResponse(_0xbb42('0x217'),_0xbb42('0xba'),'interval\x20=\x20'+_0x199533));}if(_0x3407fd<=0x0||isNaN(_0x3407fd)){return _0x319d13(msgResponse(_0xbb42('0x217'),_0xbb42('0xba'),_0xbb42('0x21b')+_0x3407fd));}_0xd34046=_0xd34046||0x0;var _0x2db4c3=0x1/_0x837c82;var _0x3b6d1e=0x0;var _0x527f26=0x0;var _0x9f5cac=0x0;var _0x319935=0x0;for(var _0x4ae0c5=0x0;_0x9f5cac<_0x3407fd;_0x4ae0c5+=0x1){_0x527f26=_0x4ae0c5/_0x199533;_0x3b6d1e=(_0x437594*_0x527f26+_0xd34046)/_0x2db4c3;_0x9f5cac=utils[_0xbb42('0x21c')](_0x3b6d1e,_0x308c31);_0x319935=_0x3b6d1e/_0x308c31*(0x1-utils[_0xbb42('0x21c')](_0x3b6d1e,_0x308c31));}return _0xb3ed63({'erlangCalls':_0x4ae0c5,'erlangCallToSecond':_0x199533/_0x4ae0c5,'erlangAbandonmentRate':_0x9f5cac,'erlangBusyFactor':_0x319935});});};Dialer['prototype'][_0xbb42('0x1d5')]=function(_0x4c7035,_0x5e2f0d,_0x31ca1a,_0x33a9bd,_0x1b228e,_0x142b51){loggerPredictive[_0xbb42('0x43')](_0xbb42('0x21d'));loggerPredictive[_0xbb42('0x43')](_0xbb42('0x21e'),_0x4c7035);loggerPredictive[_0xbb42('0x43')](_0xbb42('0x213'),_0x5e2f0d);loggerPredictive['info'](_0xbb42('0x214'),_0x31ca1a);loggerPredictive[_0xbb42('0x43')](_0xbb42('0x215'),_0x33a9bd);loggerPredictive[_0xbb42('0x43')](_0xbb42('0x21f'),_0x1b228e);loggerPredictive[_0xbb42('0x43')](_0xbb42('0x4d'));return new Promise(function(_0x4da9a4,_0x2e6d04){if(_0x4c7035<=0x0||isNaN(_0x4c7035)){return _0x2e6d04(msgResponse(_0xbb42('0x220'),_0xbb42('0xba'),_0xbb42('0x218')+_0x4c7035));}if(_0x31ca1a<=0x0||isNaN(_0x31ca1a)){return _0x2e6d04(msgResponse(_0xbb42('0x220'),_0xbb42('0xba'),_0xbb42('0x219')+_0x31ca1a));}if(_0x33a9bd<=0x0||isNaN(_0x33a9bd)){return _0x2e6d04(msgResponse(_0xbb42('0x220'),'Error',_0xbb42('0x21a')+_0x33a9bd));}if(_0x5e2f0d<=0x0||isNaN(_0x5e2f0d)){return _0x2e6d04(msgResponse(_0xbb42('0x220'),'Error','interval\x20=\x20'+_0x5e2f0d));}if(_0x1b228e<=0x0||isNaN(_0x1b228e)){return _0x2e6d04(msgResponse(_0xbb42('0x220'),_0xbb42('0xba'),_0xbb42('0x221')+_0x1b228e));}_0x142b51=_0x142b51||0x0;var _0x59cb0c=0x1/_0x31ca1a;var _0x44664c=0x0;var _0x57eeb0=0x0;var _0x1e7e30=0x0;var _0x5d193c=0x0;for(var _0x2c23b9=0x0;_0x5d193c<_0x1b228e;_0x2c23b9+=0x1){_0x57eeb0=_0x2c23b9/_0x5e2f0d;_0x44664c=(_0x33a9bd*_0x57eeb0+_0x142b51)/_0x59cb0c;_0x1e7e30=utils['erlangb'](_0x44664c,_0x4c7035);_0x5d193c=_0x44664c/_0x4c7035*(0x1-utils[_0xbb42('0x21c')](_0x44664c,_0x4c7035));}return _0x4da9a4({'erlangCalls':_0x2c23b9,'erlangCallToSecond':_0x5e2f0d/_0x2c23b9,'erlangAbandonmentRate':_0x1e7e30,'erlangBusyFactor':_0x5d193c});});};module[_0xbb42('0x222')]=Dialer; \ No newline at end of file +var _0x341d=['newexten','varset','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','outbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','voice_queue:save','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','---------------------------','getSeconds','debug','name','startProgressive\x20value\x20cleared','startPredictive','startPredictive\x20value\x20cleared','error','stack','checkContactLowerLimitOriginate','contactsRescheduled','message','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','CAMPAIGN_STATUS','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','isEmpty','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','originated','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','unmonitored','checkIsTrunkReachable','Trunk','TRUNK_NOT_REACHABLE','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','interval','content','indexOf','true','catch','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','loopCampaigns','syncCampaigns','undefined','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','handlePower','power','dialPowerLevel','booked','Queue','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','queue','uniqueid','type','ivr','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','updateOriginated','droptime','responsetime','outboundDropCallsDayTimeout','state','Drop','TIMEOUT','countdropretry','countglobal','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','createHistory','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','dropreason','countabandonedretry','dialAbandonedRetryFrequency','verifyAdditionalPhones','dialAbandonedMaxRetry','ListId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','roundrobin','isNil','agents','stateinterface','locked','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','queueBookedRR','_rr','paused','unlockRR','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','saveInDb','dialAMDActive','MACHINE','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countnosuchnumberretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countbusyretry','countcongestionretry','countagentrejectretry','dialMachineRetryFrequency','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','outboundUnknownCallsDay','cause-txt','Unknow','running','isPreviewCampaign','getQueueCampaignStatusMessage','statusMessage','inUse','talking','ACTIVE','[syncQueueSummary]','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','online','reachable','handlePreviewRecallNotifications','map','Agent','user:%s','clearZombieChannels','[actions]','No\x20such\x20channel','getVoiceQueueRtPauses','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','merge','UserId','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','checkPreviewRecallReminder','handleIvr','object','originate','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','dialQueueTimeout','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','%s%s','toUpper','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','TrunkBackup','callerid','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','trim','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','originate\x20action\x20Error','checkRetriveMax','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','check\x20predictive\x20is\x20not\x20undefine','handlePredictive','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','dialPredictiveInterval','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','dialPredictiveOptimizationPercentage','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','predictiveIntervalPauses','outboundQueuePauses','[CatchErlangB]','erlangCallToSecond','checkContactBlack','recallme','[booked][checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','actionOriginate','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','temp','getContactDialerIvr','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','RUNNING','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','available','dialLimitQueue','not_inuse','countReScheduled','[countReScheduled]\x20','checkIsBlackList','tryOriginatePredictive','getContactDialer','[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','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','util','lodash','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBooked','queuesSummary','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x341d,0x1ea));var _0xd341=function(_0x3315e3,_0x1a3a64){_0x3315e3=_0x3315e3-0x0;var _0x704101=_0x341d[_0x3315e3];return _0x704101;};'use strict';var util=require(_0xd341('0x0'));var _=require(_0xd341('0x1'));var uuid=require('uuid');var moment=require(_0xd341('0x2'));var rr=require('rr');var Redis=require(_0xd341('0x3'));var utils=require(_0xd341('0x4'));var hopperUtils=require(_0xd341('0x5'));var ut=require(_0xd341('0x6'));var config=require(_0xd341('0x7'));var logger=require('../../../config/logger')(_0xd341('0x8'));var loggerBooked=require('../../../config/logger')('booked');var loggerPredictive=require(_0xd341('0x9'))(_0xd341('0xa'));var loggerPredictiveCalls=require(_0xd341('0x9'))(_0xd341('0xb'));var loggerSyncQueueSummary=require(_0xd341('0x9'))(_0xd341('0xc'));var ami=require(_0xd341('0xd'));config[_0xd341('0xe')]=_[_0xd341('0xf')](config[_0xd341('0xe')],{'host':'localhost','port':0x18eb});var io=require(_0xd341('0x10'))(new Redis(config[_0xd341('0xe')]));var cmHopper=require(_0xd341('0x11'));var voiceQueueRt=require(_0xd341('0x12'));var RpcSetting=require(_0xd341('0x13'));var Interval=require('../rpc/interval');var Action=require('./models/action');var History=require(_0xd341('0x14'));var Final=require(_0xd341('0x15'));var AgentComplete=require(_0xd341('0x16'));var QueueCallerAbandon=require(_0xd341('0x17'));var Hangup=require(_0xd341('0x18'));var ipAgi=process[_0xd341('0x19')][_0xd341('0x1a')]||_0xd341('0x1b');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xd341('0x1c')][_0xd341('0x1d')]=function(_0x318c83){this[_0xd341('0x1e')]=this[_0xd341('0x1e')]?this[_0xd341('0x1e')][_0xd341('0x1f')](_0x318c83):_0x318c83();};function Dialer(_0x45d85c,_0x2088c2){this[_0xd341('0x20')]=new Sequence();this[_0xd341('0x21')]=_0x2088c2;this['voiceQueues']=_0x45d85c[_0xd341('0x22')];this[_0xd341('0x23')]=_0x45d85c[_0xd341('0x23')];this['agents']=_0x45d85c['agents'];this[_0xd341('0x24')]=_0x45d85c[_0xd341('0x24')];this[_0xd341('0x25')]=config[_0xd341('0x25')]||0x2;this[_0xd341('0x26')]={};this[_0xd341('0x27')]={};this[_0xd341('0x28')]={};this[_0xd341('0x29')]={};this[_0xd341('0x2a')]={};this['startPredictive']={};this[_0xd341('0x2b')]={};this[_0xd341('0x2c')]={};this[_0xd341('0x2d')]={};this['queueBookedRR']={};this[_0xd341('0x2e')]={};ami['on']('agentconnect',this[_0xd341('0x2f')][_0xd341('0x30')](this));ami['on']('queuecallerabandon',this[_0xd341('0x31')]['bind'](this));ami['on'](_0xd341('0x32'),this[_0xd341('0x33')][_0xd341('0x30')](this));ami['on'](_0xd341('0x34'),this[_0xd341('0x35')][_0xd341('0x30')](this));ami['on'](_0xd341('0x36'),this[_0xd341('0xc')][_0xd341('0x30')](this));ami['on'](_0xd341('0x37'),this[_0xd341('0x38')][_0xd341('0x30')](this));ami['on']('hangup',this['syncHangup'][_0xd341('0x30')](this));ami['on'](_0xd341('0x39'),this['syncNewExten'][_0xd341('0x30')](this));ami['on'](_0xd341('0x3a'),this[_0xd341('0x3b')][_0xd341('0x30')](this));ami['on'](_0xd341('0x3c'),this['syncQueueMember']['bind'](this));ami['on'](_0xd341('0x3d'),this[_0xd341('0x3e')][_0xd341('0x30')](this));this['loopCampaigns']();this[_0xd341('0x3f')]();RpcSetting[_0xd341('0x40')]()[_0xd341('0x41')](function(_0x24e384){previewRecallmeReminderInterval=_0x24e384[_0xd341('0x42')];});}function isNotNull(_0xccfe38){return _0xccfe38!==null&&!_[_0xd341('0x43')](_0xccfe38);}function msgResponse(_0x4dc1a0,_0xdced6d,_0x410979){return{'action':_0x4dc1a0,'response':_0xdced6d,'message':_0x410979,'stack':_0x410979};}function emit(_0x33161f,_0x16cf19,_0x6fb4a0){io['to'](_0x33161f)[_0xd341('0x44')](_0x16cf19,_0x6fb4a0);}function emitOutboundVoiceQueueSummary(_0x3d76e6){if(_0x3d76e6['type']===_0xd341('0x45')){logger['debug'](_0xd341('0x46'),util[_0xd341('0x47')](_0x3d76e6,{'showHidden':![],'depth':null}));emit(util[_0xd341('0x48')](_0xd341('0x49'),_0x3d76e6['name']),_0xd341('0x4a'),_0x3d76e6);}}function checkGetDataPredictive(_0x2536af){if(isNotNull(_0x2536af)&&!_['isEmpty'](_0x2536af)){loggerPredictive[_0xd341('0x4b')](_0xd341('0x4c'));loggerPredictive[_0xd341('0x4b')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2536af[_0xd341('0x4d')]);loggerPredictive[_0xd341('0x4b')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2536af[_0xd341('0x4e')]);loggerPredictive['info'](_0xd341('0x4f'),_0x2536af[_0xd341('0x50')]);loggerPredictive[_0xd341('0x4b')](_0xd341('0x51'),_0x2536af[_0xd341('0x52')]);loggerPredictive[_0xd341('0x4b')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2536af[_0xd341('0x53')]);loggerPredictive[_0xd341('0x4b')](_0xd341('0x54'),_0x2536af[_0xd341('0x55')]);loggerPredictive[_0xd341('0x4b')]('---------------------------');if(_0x2536af[_0xd341('0x4d')]>0x0){if(!_['isUndefined'](_0x2536af['predictiveIntervalAvgTalktime'])&&_0x2536af[_0xd341('0x55')]>0x0){return!![];}loggerPredictive[_0xd341('0x4b')](_0xd341('0x56'));if(!_[_0xd341('0x43')](_0x2536af[_0xd341('0x53')])&&_0x2536af[_0xd341('0x53')]>0x0){return!![];}loggerPredictive[_0xd341('0x4b')](_0xd341('0x57'));}else{loggerPredictive[_0xd341('0x4b')](_0xd341('0x58'));}}else{loggerPredictive[_0xd341('0x4b')](_0xd341('0x59'));}return![];}function mergeDataErlangB(_0x40e679){return function(_0x39ac4e){loggerPredictive['info'](_0xd341('0x5a'));loggerPredictive[_0xd341('0x4b')](_0xd341('0x5b'),_0x39ac4e[_0xd341('0x5c')]);loggerPredictive['info'](_0xd341('0x5d'),_0x39ac4e['erlangCallToSecond']);loggerPredictive[_0xd341('0x4b')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x39ac4e['erlangAbandonmentRate']);loggerPredictive[_0xd341('0x4b')](_0xd341('0x5e'),_0x39ac4e[_0xd341('0x5f')]);loggerPredictive[_0xd341('0x4b')](_0xd341('0x60'),_0x39ac4e[_0xd341('0x61')]);loggerPredictive[_0xd341('0x4b')](_0xd341('0x62'));_['merge'](_0x40e679,_0x39ac4e);};}function ifInterval(_0x37aaf5,_0xaa0057){if(_[_0xd341('0x43')](_0xaa0057)){return![];}return utils[_0xd341('0x63')](undefined,_0xaa0057)<_0x37aaf5*0x3c;}function clearPredictiveAttributes(_0x314f08){if(_0x314f08[_0xd341('0x2b')]){_0x314f08['startProgressive']=undefined;loggerPredictive[_0xd341('0x64')](_0x314f08[_0xd341('0x65')],_0xd341('0x66'));}if(_0x314f08[_0xd341('0x67')]){_0x314f08[_0xd341('0x67')]=undefined;loggerPredictive[_0xd341('0x64')](_0x314f08[_0xd341('0x65')],_0xd341('0x68'));}if(_0x314f08['handlePredictive']){clearInterval(_0x314f08['handlePredictive']);_0x314f08['handlePredictive']=undefined;loggerPredictive[_0xd341('0x64')](_0x314f08[_0xd341('0x65')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x358ca5,_0x78a7dd){return function(_0x5d2c14){loggerPredictive['error'](_0x78a7dd[_0xd341('0x65')],_0x358ca5);loggerPredictive[_0xd341('0x69')](_0x5d2c14[_0xd341('0x6a')]);clearPredictiveAttributes(_0x78a7dd);};}function loggerCatch(_0x479af8){return function(_0x42e2a2){logger['error'](_0x479af8,util['inspect'](_0x42e2a2,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0xf19c64,_0x16d00e,_0x1baf2c){return function(_0xa18cdd){utils[_0xd341('0x6b')](_0x16d00e,_0x1baf2c,0x0);logger[_0xd341('0x69')](_0xf19c64,util['inspect'](_0xa18cdd,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x32c88d){return function(_0x596b65){if(isNotNull(_0x596b65)&&isNotNull(_0x596b65[0x0])){if(_0x596b65[0x0][_0xd341('0x6c')]>0x0){_0x32c88d[_0xd341('0x6d')]=utils['CAMPAIGN_STATUS'][_0xd341('0x6e')];logger['info'](_0xd341('0x6f')+_0x32c88d[_0xd341('0x65')],_0x596b65[0x0][_0xd341('0x6c')],_0xd341('0x70'));}else{_0x32c88d[_0xd341('0x6d')]=utils[_0xd341('0x71')]['NO_AVAILABLE_CONTACTS'];logger[_0xd341('0x4b')]('[getContactDialer2][Empty]'+_0x32c88d['name']);}}};}function createObjHistory(_0x5b832c,_0x4175d3,_0x582f53,_0xef251f,_0x3bc108){_0x5b832c[_0xd341('0x6d')]=_0x582f53;var _0x40d3aa=new Action(_0x5b832c,_0x4175d3);var _0x4ce0a0=new History(_0x40d3aa);_0x4ce0a0['state']=_0xef251f;_0x4ce0a0[_0xd341('0x72')]=_0x3bc108;_0x4ce0a0[_0xd341('0x73')]=_0x40d3aa[_0xd341('0x74')];return _0x4ce0a0;}function unlockQueueStatus(_0x48f5c1,_0x3e421f){setTimeout(function(){if(_[_0xd341('0x43')](_0x48f5c1[_0xd341('0x75')])){loggerBooked['error'](_0xd341('0x76'),_0x3e421f);}_0x48f5c1[_0xd341('0x75')]=!![];loggerBooked[_0xd341('0x4b')](_0xd341('0x77'),_0x3e421f,JSON[_0xd341('0x78')](_[_0xd341('0x79')](_0x48f5c1,[_0xd341('0x65'),_0xd341('0x75')])));},0x1f3);}function checkInterval(_0x358768){return function(){if(!isNotNull(_0x358768[_0xd341('0x7a')])){_0x358768['message']=utils[_0xd341('0x71')][_0xd341('0x7b')];throw _0x358768[_0xd341('0x65')]+_0xd341('0x7c');}if(!isNotNull(_0x358768['Interval']['Intervals'])){_0x358768['message']=utils[_0xd341('0x71')][_0xd341('0x7b')];throw _0x358768[_0xd341('0x65')]+_0xd341('0x7c');}if(!isNotNull(_[_0xd341('0x7d')](_0x358768['Interval']['Intervals']))){_0x358768['message']=utils['CAMPAIGN_STATUS'][_0xd341('0x7b')];throw _0x358768['name']+_0xd341('0x7c');}};}function checkIsIVRCampaignActive(_0x2b8475){return function(){if(!utils['isIVRCampaignActive'](_0x2b8475)){_0x2b8475['message']=utils['CAMPAIGN_STATUS'][_0xd341('0x7e')];throw _0x2b8475[_0xd341('0x65')]+_0xd341('0x7f');}};}function emitCampaignSummary(_0x2c2965){if(utils[_0xd341('0x80')](_0x2c2965)){emit(util[_0xd341('0x48')](_0xd341('0x81'),_0x2c2965[_0xd341('0x65')]),'campaign:save',_0x2c2965);}}function loggerCatchQueueSummary(_0x1c2363,_0x9e7c4a){return function(_0x5afdee){clearPredictiveAttributes(_0x9e7c4a);emitCampaignSummary(_0x9e7c4a);loggerSyncQueueSummary[_0xd341('0x64')](_0x1c2363,util[_0xd341('0x47')](_0x5afdee,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x58b90d){if(_0x58b90d['sendMessageOneNotActive']){if(_0x58b90d[_0xd341('0x82')]===0x0){_0x58b90d[_0xd341('0x83')]=![];_0x58b90d[_0xd341('0x6d')]=utils['CAMPAIGN_STATUS']['INACTIVE'];loggerSyncQueueSummary[_0xd341('0x64')](_0xd341('0x84'),_0x58b90d[_0xd341('0x65')],_0xd341('0x85'));}else{_0x58b90d[_0xd341('0x6d')]=utils['CAMPAIGN_STATUS']['DISACTIVED'];loggerSyncQueueSummary['debug'](_0xd341('0x84'),_0x58b90d[_0xd341('0x65')],_0xd341('0x86'));}emitCampaignSummary(_0x58b90d);}}function myreject(_0x4b3770){return function(_0x4201e4){return _0x4b3770(msgResponse(_0xd341('0x87'),_0xd341('0x88'),JSON[_0xd341('0x78')](_0x4201e4)));};}Dialer[_0xd341('0x1c')][_0xd341('0x89')]=function(_0x1c73e2){return!_['isUndefined'](_0x1c73e2)&&_0x1c73e2&&!_['isUndefined'](_0x1c73e2[_0xd341('0x65')])&&!_[_0xd341('0x43')](_0x1c73e2[_0xd341('0x8a')])&&_0x1c73e2[_0xd341('0x8a')]&&(this[_0xd341('0x24')][util['format'](_0xd341('0x8b'),_0x1c73e2[_0xd341('0x65')])]['status']==='reachable'||this[_0xd341('0x24')][util['format'](_0xd341('0x8b'),_0x1c73e2[_0xd341('0x65')])][_0xd341('0x8c')]===_0xd341('0x8d'));};Dialer[_0xd341('0x1c')][_0xd341('0x8e')]=function(_0x343902){var _0xfd9984=this;return function(){if(!_0xfd9984['isTrunkReachable'](_0x343902[_0xd341('0x8f')])){if(!_0xfd9984[_0xd341('0x89')](_0x343902['TrunkBackup'])){_0x343902[_0xd341('0x6d')]=utils[_0xd341('0x71')][_0xd341('0x90')];throw _0x343902[_0xd341('0x65')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer[_0xd341('0x1c')][_0xd341('0x91')]=function(_0xd8f25,_0x12aa14,_0x5bd43f,_0x537e4e){var _0x4952d3=this;return function(){var _0x280d1f=!![];return _0x4952d3[_0xd341('0x92')](_0xd8f25,_0x12aa14,_0x5bd43f,_0x537e4e,_0x280d1f);};};Dialer[_0xd341('0x1c')][_0xd341('0x93')]=function(_0x3e034d,_0x4c05b3,_0xd2be2a,_0x365c86){var _0x1555c8=this;return function(){var _0x14209e=![];return _0x1555c8[_0xd341('0x92')](_0x3e034d['Intervals'],_0x4c05b3,_0xd2be2a,_0x365c86,_0x14209e);};};Dialer[_0xd341('0x1c')][_0xd341('0x92')]=function(_0x5770d3,_0x2b7b3c,_0x198117,_0x358251,_0x51c731){var _0xb2066a=[];return new Promise(function(_0x18580a,_0x5eca0e){if(!isNotNull(_0x5770d3)){_0x358251[_0xd341('0x6d')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];return _0x5eca0e(msgResponse(_0xd341('0x94'),_0xd341('0x95'),_0x198117+_0xd341('0x96')));}if(_[_0xd341('0x7d')](_0x5770d3)){_0x358251[_0xd341('0x6d')]=utils[_0xd341('0x71')][_0xd341('0x97')];return _0x5eca0e(msgResponse(_0xd341('0x94'),_0xd341('0x95'),_0x198117+'\x20Intervals\x20is\x20empty\x20'));}if(_0x2b7b3c&&_[_0xd341('0x43')](config[_0xd341('0x98')][_0x2b7b3c])){_0x358251['message']=utils['CAMPAIGN_STATUS'][_0xd341('0x99')];return _0x5eca0e(msgResponse(_0xd341('0x94'),_0xd341('0x95'),_0x198117+_0xd341('0x9a')+_0x2b7b3c));}if(_[_0xd341('0x9b')](_0x5770d3)){for(var _0x3c8ff0=0x0;_0x3c8ff0<_0x5770d3[_0xd341('0x9c')];_0x3c8ff0+=0x1){_0xb2066a[_0xd341('0x9d')](ami[_0xd341('0x9e')]({'action':_0xd341('0x9f'),'command':util[_0xd341('0x48')](_0xd341('0xa0'),_0x5770d3[_0x3c8ff0][_0xd341('0xa1')],!_[_0xd341('0x43')](config['timezones'][_0x2b7b3c])?_0x2b7b3c:'')})[_0xd341('0x41')](function(_0x20c9c8){return _0x20c9c8[_0xd341('0xa2')][_0xd341('0xa3')](_0xd341('0xa4'))>=0x0;})[_0xd341('0xa5')](myreject(_0x5eca0e)));}}else{_0xb2066a[_0xd341('0x9d')](ami['Action']({'action':'command','command':util['format']('iftime\x20%s,%s',_0x5770d3,!_[_0xd341('0x43')](config[_0xd341('0x98')][_0x2b7b3c])?_0x2b7b3c:'')})[_0xd341('0x41')](function(_0x4faa58){return _0x4faa58['content']['indexOf']('true')>=0x0;})[_0xd341('0xa5')](myreject(_0x5eca0e)));}Promise['all'](_0xb2066a)[_0xd341('0x41')](function(_0x23e8e0){var _0x41fa3f=_[_0xd341('0xa6')](_0x23e8e0);if(_0x41fa3f){return _0x18580a(_0x41fa3f);}else{_0x358251['message']=_0x51c731?utils[_0xd341('0x71')][_0xd341('0xa7')]:utils[_0xd341('0x71')][_0xd341('0xa8')];return _0x5eca0e(msgResponse(_0xd341('0xa9'),'Failure',_0xd341('0xaa')+_0x51c731+'\x20'+_0x198117+_0xd341('0xab')+util[_0xd341('0x47')](_0x5770d3,{'showHidden':![],'depth':null})+_0xd341('0xac')+_0x2b7b3c));}})[_0xd341('0xa5')](function(_0x5879d5){return _0x5eca0e(msgResponse(_0xd341('0x94'),_0xd341('0x95'),JSON[_0xd341('0x78')](_0x5879d5)));});});};Dialer[_0xd341('0x1c')][_0xd341('0xad')]=function(){var _0x5b0592=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x5b0592[_0xd341('0xae')]();},0x3e8);});};Dialer[_0xd341('0x1c')][_0xd341('0xae')]=function(){var _0x45fce1=this;var _0x1a1f57;for(var _0xea99c1 in this[_0xd341('0x23')]){if(typeof this['campaigns'][_0xea99c1]!==_0xd341('0xaf')){_0x1a1f57=this[_0xd341('0x23')][_0xea99c1];if(utils[_0xd341('0x80')](_0x1a1f57)&&utils['isIVRCampaignActive'](_0x1a1f57)){_0x1a1f57[_0xd341('0x83')]=!![];Promise[_0xd341('0xb0')]()[_0xd341('0x41')](checkIsIVRCampaignActive(_0x1a1f57))[_0xd341('0x41')](checkInterval(_0x1a1f57))[_0xd341('0x41')](_0x45fce1['checkIsTrunkReachable'](_0x1a1f57))[_0xd341('0x41')](_0x45fce1['checkIfTime'](_0x1a1f57[_0xd341('0xb1')],_0x1a1f57[_0xd341('0xb2')],_0x1a1f57[_0xd341('0x65')],_0x1a1f57))[_0xd341('0x41')](_0x45fce1[_0xd341('0x93')](_0x1a1f57[_0xd341('0x7a')],_0x1a1f57[_0xd341('0xb2')],_0x1a1f57['name'],_0x1a1f57))[_0xd341('0x41')](_0x45fce1[_0xd341('0xb3')](_0x1a1f57))[_0xd341('0xa5')](loggerCatchQueueSummary(_0xd341('0xb4'),_0x1a1f57));}else{notSendMessagesCampaign(_0x1a1f57);}}}};Dialer[_0xd341('0x1c')][_0xd341('0xb5')]=function(_0x5e6430){if(_0x5e6430[_0xd341('0xb6')]!==_0xd341('0xa')){clearPredictiveAttributes(_0x5e6430);}switch(_0x5e6430[_0xd341('0xb6')]){case'progressive':this[_0xd341('0xb7')](_0x5e6430,0x1);break;case _0xd341('0xb8'):this[_0xd341('0xb7')](_0x5e6430,_0x5e6430[_0xd341('0xb9')]);break;case _0xd341('0xa'):this[_0xd341('0xa')](_0x5e6430);break;case _0xd341('0xba'):this[_0xd341('0xb7')](_0x5e6430,0x1);break;default:logger[_0xd341('0x69')](_0xd341('0xbb'),_0x5e6430['name'],'method\x20not\x20recognized');}};Dialer[_0xd341('0x1c')][_0xd341('0x94')]=function(_0x22feef,_0x5c8386){var _0x40a589=_0x22feef[_0xd341('0xb2')];var _0x2e0e24=_0x5c8386?_0x22feef[_0xd341('0xb1')]:_0x22feef[_0xd341('0x7a')]['Intervals'];logger[_0xd341('0xbc')](_0xd341('0xbd'),_0x2e0e24,_0x40a589,_0x22feef[_0xd341('0x65')],util['format'](_0xd341('0xbe'),_0x22feef[_0xd341('0x65')],_0x22feef['id']));var _0x4917fe=null;return Interval[_0xd341('0xbf')](_0x2e0e24,_0x40a589)[_0xd341('0x41')](function(_0x1f02d2){if(_0x1f02d2===!![]){return _0x1f02d2;}else{_0x22feef[_0xd341('0x6d')]=_0x5c8386?utils[_0xd341('0x71')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0xd341('0x71')][_0xd341('0xa8')];_0x4917fe=msgResponse('[ifTime][promiseAll]',_0xd341('0x95'),'Global:\x20'+_0x5c8386+'\x20'+_0x22feef['name']+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x2e0e24,{'showHidden':![],'depth':null})+_0xd341('0xac')+_0x40a589);}if(_0x4917fe!==null){logger['silly'](_0xd341('0xc0'),_0x4917fe);_0x4917fe[_0xd341('0xc1')]=_0x5c8386;throw _0x4917fe;}})[_0xd341('0xa5')](function(_0x186442){logger['error']('AMI\x20IfTime',_0x186442);throw msgResponse('[ifTime][Action]','Error',util[_0xd341('0x47')](_0x186442,{'showHidden':![],'depth':null}));});};Dialer[_0xd341('0x1c')][_0xd341('0x2f')]=function(_0x59ea62){if(this[_0xd341('0x22')][_0x59ea62[_0xd341('0xc2')]]){if(this[_0xd341('0x29')][_0x59ea62[_0xd341('0xc3')]]&&this[_0xd341('0x29')][_0x59ea62[_0xd341('0xc3')]][_0xd341('0xc4')]!==_0xd341('0xc5')){this['updateOriginated'](this['voiceQueues'][_0x59ea62[_0xd341('0xc2')]]);this[_0xd341('0x29')][_0x59ea62['uniqueid']][_0xd341('0xc6')]=moment()[_0xd341('0x48')](_0xd341('0xc7'));}}};Dialer[_0xd341('0x1c')][_0xd341('0x35')]=function(_0x5808f8){var _0x1a1816=this[_0xd341('0x29')][_0x5808f8[_0xd341('0xc3')]];if(this[_0xd341('0x22')][_0x5808f8[_0xd341('0xc2')]]){if(_0x1a1816&&_0x1a1816[_0xd341('0xc4')]!=='ivr'){delete this['uniqueId'][_0x5808f8[_0xd341('0xc3')]];this[_0xd341('0x22')][_0x5808f8[_0xd341('0xc2')]][_0xd341('0xc8')]+=0x1;var _0x4a1cad=new AgentComplete(_0x1a1816,_0x5808f8);if(_0x5808f8[_0xd341('0xc9')]===_0xd341('0xca')){_0x4a1cad[_0xd341('0xcb')]=this['voiceQueues'][_0x5808f8[_0xd341('0xc2')]][_0xd341('0xcc')]&&this[_0xd341('0x22')][_0x5808f8[_0xd341('0xc2')]][_0xd341('0xcd')]?moment()[_0xd341('0x48')](_0xd341('0xc7')):undefined;}hopperUtils['createHistory'](_0x4a1cad)['catch'](loggerCatch(_0xd341('0xce')));hopperUtils[_0xd341('0xcf')](_0x4a1cad)['catch'](loggerCatch(_0xd341('0xd0')));}}};Dialer[_0xd341('0x1c')][_0xd341('0x31')]=function(_0x111b91){var _0x2c38b4=this[_0xd341('0x29')][_0x111b91[_0xd341('0xc3')]];var _0x2a2573=this;var _0x3843ec=![];var _0x5d8155;var _0x4a50e8;if(this[_0xd341('0x22')][_0x111b91[_0xd341('0xc2')]]){if(_0x2c38b4&&_0x2c38b4[_0xd341('0xc4')]!==_0xd341('0xc5')){delete this[_0xd341('0x29')][_0x111b91[_0xd341('0xc3')]];this[_0xd341('0xd1')](this[_0xd341('0x22')][_0x111b91[_0xd341('0xc2')]]);_0x2c38b4[_0xd341('0xd2')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x28784c=new QueueCallerAbandon(_0x2c38b4,_0x111b91);if(utils[_0xd341('0x63')](_0x2c38b4[_0xd341('0xd2')],_0x2c38b4[_0xd341('0xd3')])>=_0x2c38b4['dialQueueTimeout']){this[_0xd341('0x22')][_0x111b91[_0xd341('0xc2')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xd341('0x22')][_0x111b91['queue']][_0xd341('0xd4')]+=0x1;this[_0xd341('0x22')][_0x111b91[_0xd341('0xc2')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x28784c[_0xd341('0xd5')]=0xa;_0x28784c[_0xd341('0x72')]=_0xd341('0xd6');_0x28784c['dropreason']=_0xd341('0xd7');_0x28784c[_0xd341('0xcb')]=this['voiceQueues'][_0x111b91[_0xd341('0xc2')]][_0xd341('0xcc')]?moment()[_0xd341('0x48')](_0xd341('0xc7')):undefined;_0x28784c[_0xd341('0xd8')]+=0x1;_0x28784c[_0xd341('0xd9')]+=0x1;_0x5d8155=this[_0xd341('0x22')][_0x111b91[_0xd341('0xc2')]]['dialDropRetryFrequency'];_0x4a50e8=this[_0xd341('0x22')][_0x111b91[_0xd341('0xc2')]][_0xd341('0xda')];hopperUtils['verifyAdditionalPhones'](_0x28784c,_0x28784c[_0xd341('0xd5')],_0x2c38b4[_0xd341('0xdb')])[_0xd341('0x41')](function(_0x2bdaa9){_0x3843ec=_0x2bdaa9[_0xd341('0xdc')]==0x1;if(_0x28784c[_0xd341('0xd8')]>=_0x2a2573[_0xd341('0x22')][_0x111b91['queue']][_0xd341('0xdd')]){_0x2a2573[_0xd341('0xde')](_0x28784c,_0x2bdaa9[_0xd341('0xdc')]);}else{hopperUtils[_0xd341('0xdf')]({'active':![],'countdropretry':_0x28784c[_0xd341('0xd8')],'scheduledat':moment()[_0xd341('0xe0')](_0x2a2573[_0xd341('0x22')][_0x111b91[_0xd341('0xc2')]]['dialDropRetryFrequency'],_0xd341('0xe1'))[_0xd341('0x48')](_0xd341('0xc7')),'ContactId':_0x2c38b4[_0xd341('0xe2')],'ListId':_0x2c38b4['ListId'],'VoiceQueueId':_0x2c38b4[_0xd341('0xe3')]||undefined,'CampaignId':_0x2c38b4[_0xd341('0xe4')]||undefined})['catch'](loggerCatch(_0xd341('0xe5')));var _0x4e5d99=new History(_0x28784c);_0x4e5d99[_0xd341('0xd5')]=0xa;_0x4e5d99[_0xd341('0x72')]='Drop';_0x4e5d99[_0xd341('0x74')]=moment()[_0xd341('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x4e5d99['endtime']=_0x4e5d99['starttime'];_0x4e5d99[_0xd341('0xe6')]=_0x28784c['calleridname'];_0x4e5d99[_0xd341('0xe7')]=_0x28784c[_0xd341('0xe7')];hopperUtils[_0xd341('0xe8')](_0x4e5d99)[_0xd341('0xa5')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0xd341('0x41')](function(){if(_0x3843ec)hopperUtils[_0xd341('0xe9')](_0x28784c,_0x5d8155,_0x4a50e8)['then'](function(){return 0x1;});});}else{this[_0xd341('0x22')][_0x111b91[_0xd341('0xc2')]][_0xd341('0x52')]+=0x1;this[_0xd341('0x22')][_0x111b91[_0xd341('0xc2')]][_0xd341('0xea')]+=0x1;_0x28784c[_0xd341('0xd5')]=0xb;_0x28784c[_0xd341('0x72')]=_0xd341('0xeb');_0x28784c[_0xd341('0xec')]='CALLEREXIT';_0x28784c[_0xd341('0xed')]+=0x1;_0x28784c[_0xd341('0xd9')]+=0x1;_0x5d8155=this['voiceQueues'][_0x111b91[_0xd341('0xc2')]][_0xd341('0xee')];_0x4a50e8=this[_0xd341('0x22')][_0x111b91[_0xd341('0xc2')]][_0xd341('0xda')];hopperUtils[_0xd341('0xef')](_0x28784c,_0x28784c[_0xd341('0xd5')],_0x2c38b4[_0xd341('0xdb')])[_0xd341('0x41')](function(_0x1f9ccf){if(_0x28784c[_0xd341('0xed')]>=_0x2a2573[_0xd341('0x22')][_0x111b91[_0xd341('0xc2')]][_0xd341('0xf0')]){_0x2a2573['queueCallerAbandonCreateState'](_0x28784c,_0x1f9ccf['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x28784c[_0xd341('0xed')],'scheduledat':moment()[_0xd341('0xe0')](_0x2a2573[_0xd341('0x22')][_0x111b91['queue']][_0xd341('0xee')],_0xd341('0xe1'))['format'](_0xd341('0xc7')),'ContactId':_0x2c38b4[_0xd341('0xe2')],'ListId':_0x2c38b4[_0xd341('0xf1')],'VoiceQueueId':_0x2c38b4[_0xd341('0xe3')]||undefined,'CampaignId':_0x2c38b4['CampaignId']||undefined})['catch'](loggerCatch(_0xd341('0xf2')));var _0x464a61=new History(_0x28784c);_0x464a61[_0xd341('0xd5')]=0xb;_0x464a61['statedesc']=_0xd341('0xeb');_0x464a61[_0xd341('0x74')]=moment()['format'](_0xd341('0xc7'));_0x464a61[_0xd341('0x73')]=_0x464a61[_0xd341('0x74')];_0x464a61['calleridname']=_0x28784c[_0xd341('0xe6')];_0x464a61[_0xd341('0xe7')]=_0x28784c[_0xd341('0xe7')];hopperUtils[_0xd341('0xe8')](_0x464a61)[_0xd341('0xa5')](loggerCatch(_0xd341('0xf3')));}})['then'](function(){if(_0x3843ec)hopperUtils[_0xd341('0xe9')](_0x28784c,_0x5d8155,_0x4a50e8)[_0xd341('0x41')](function(){return 0x1;});});}}}};Dialer['prototype']['syncNewExten']=function(_0x19a28a){if(this[_0xd341('0x27')][_0x19a28a[_0xd341('0xc3')]]){this['actions'][_0x19a28a[_0xd341('0xc3')]][_0xd341('0xf4')]=_0x19a28a[_0xd341('0xf4')];}if(this[_0xd341('0x29')][_0x19a28a['uniqueid']]){this[_0xd341('0x29')][_0x19a28a['uniqueid']][_0xd341('0xf4')]=_0x19a28a[_0xd341('0xf4')];}};Dialer[_0xd341('0x1c')]['syncQueueMember']=function(_0x30bd6c){if(!this[_0xd341('0x27')][_0x30bd6c[_0xd341('0xf5')]]){return;}var _0x10c1c6=this[_0xd341('0x22')][this[_0xd341('0x27')][_0x30bd6c['actionid']]['queue']][_0xd341('0xf6')]||_0xd341('0xf7');if(_0x10c1c6===_0xd341('0xf8')){if(this[_0xd341('0x27')][_0x30bd6c[_0xd341('0xf5')]]&&_[_0xd341('0xf9')](this[_0xd341('0x27')][_0x30bd6c[_0xd341('0xf5')]]['locked'])&&_0x30bd6c[_0xd341('0x8c')]==='1'&&_0x30bd6c['paused']==='0'){if(this[_0xd341('0xfa')][_0x30bd6c[_0xd341('0xfb')]]){if(!this[_0xd341('0xfa')][_0x30bd6c[_0xd341('0xfb')]][_0xd341('0xfc')]){this[_0xd341('0xfa')][_0x30bd6c[_0xd341('0xfb')]][_0xd341('0xfc')]=!![];this[_0xd341('0x27')][_0x30bd6c[_0xd341('0xf5')]][_0xd341('0xfc')]=!![];this['actions'][_0x30bd6c['actionid']][_0xd341('0xfb')]=_0x30bd6c[_0xd341('0xfb')];}}}}else if(_0x10c1c6===_0xd341('0xf7')){if(this['actions'][_0x30bd6c[_0xd341('0xf5')]]){if(this[_0xd341('0xfa')][_0x30bd6c[_0xd341('0xfb')]]){this[_0xd341('0x27')][_0x30bd6c[_0xd341('0xf5')]][_0xd341('0xfb')]=_0x30bd6c['stateinterface'];if(_[_0xd341('0xf9')](this[_0xd341('0x2d')][this['actions'][_0x30bd6c[_0xd341('0xf5')]]['queue']])){this[_0xd341('0x2d')][this['actions'][_0x30bd6c[_0xd341('0xf5')]][_0xd341('0xc2')]]=[];}this[_0xd341('0x2d')][this['actions'][_0x30bd6c[_0xd341('0xf5')]][_0xd341('0xc2')]][_0xd341('0x9d')](_['merge'](_[_0xd341('0x79')](this[_0xd341('0x27')][_0x30bd6c[_0xd341('0xf5')]],['idHopper',_0xd341('0xfb')]),{'status':_0x30bd6c['status'],'paused':_0x30bd6c['paused']}));}}}};Dialer[_0xd341('0x1c')][_0xd341('0x3e')]=function(_0x57a2be){if(!this['actions'][_0x57a2be[_0xd341('0xf5')]]){return;}var _0xf475bf=this;var _0x23f718=this['voiceQueues'][this[_0xd341('0x27')][_0x57a2be[_0xd341('0xf5')]][_0xd341('0xc2')]];var _0x33e9b8=_0x23f718[_0xd341('0xf6')]||_0xd341('0xf7');if(_0x33e9b8===_0xd341('0xf8')){if(this[_0xd341('0x27')][_0x57a2be[_0xd341('0xf5')]]&&this[_0xd341('0x27')][_0x57a2be[_0xd341('0xf5')]]['stateinterface']){this[_0xd341('0x21')][_0xd341('0xfd')](this[_0xd341('0x27')][_0x57a2be[_0xd341('0xf5')]][_0xd341('0xfe')],this[_0xd341('0x27')][_0x57a2be['actionid']][_0xd341('0xfb')])['catch'](function(_0xa294b2){logger[_0xd341('0x69')](_0xd341('0xff'),util[_0xd341('0x47')](_0xa294b2,{'showHidden':![],'depth':null}));})[_0xd341('0x1f')](function(){_0xf475bf[_0xd341('0xd1')](_0xf475bf[_0xd341('0x22')][_0xf475bf[_0xd341('0x27')][_0x57a2be[_0xd341('0xf5')]][_0xd341('0xc2')]]);_0xf475bf[_0xd341('0xfa')][_0xf475bf[_0xd341('0x27')][_0x57a2be[_0xd341('0xf5')]]['stateinterface']][_0xd341('0xfc')]=![];delete _0xf475bf['actions'][_0x57a2be[_0xd341('0xf5')]];unlockQueueStatus(_0x23f718);});}else{this[_0xd341('0xd1')](this[_0xd341('0x22')][this[_0xd341('0x27')][_0x57a2be[_0xd341('0xf5')]][_0xd341('0xc2')]]);hopperUtils[_0xd341('0xdf')]({'active':![],'ContactId':this[_0xd341('0x27')][_0x57a2be[_0xd341('0xf5')]][_0xd341('0xe2')],'ListId':this['actions'][_0x57a2be[_0xd341('0xf5')]]['ListId'],'VoiceQueueId':this[_0xd341('0x27')][_0x57a2be[_0xd341('0xf5')]]['VoiceQueueId']||undefined,'CampaignId':this[_0xd341('0x27')][_0x57a2be[_0xd341('0xf5')]]['CampaignId']||undefined})[_0xd341('0xa5')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xd341('0x27')][_0x57a2be['actionid']];unlockQueueStatus(_0x23f718);}}else if(_0x33e9b8==='rrmemory'){var _0x4ce00e;if(this[_0xd341('0x27')][_0x57a2be[_0xd341('0xf5')]]&&!_[_0xd341('0x7d')](this[_0xd341('0x2d')][this[_0xd341('0x27')][_0x57a2be[_0xd341('0xf5')]]['queue']])){if(this[_0xd341('0x100')][_0xf475bf[_0xd341('0x27')][_0x57a2be[_0xd341('0xf5')]]['queue']]){this[_0xd341('0x100')][_0xf475bf['actions'][_0x57a2be[_0xd341('0xf5')]][_0xd341('0xc2')]]=this[_0xd341('0x100')][this[_0xd341('0x27')][_0x57a2be[_0xd341('0xf5')]][_0xd341('0xc2')]]?this[_0xd341('0x100')][this[_0xd341('0x27')][_0x57a2be[_0xd341('0xf5')]][_0xd341('0xc2')]]:this[_0xd341('0x2d')][this[_0xd341('0x27')][_0x57a2be[_0xd341('0xf5')]]['queue']]?this[_0xd341('0x2d')][this[_0xd341('0x27')][_0x57a2be['actionid']][_0xd341('0xc2')]][_0xd341('0x101')]||0x0:0x0;}this[_0xd341('0x2d')][this[_0xd341('0x27')][_0x57a2be[_0xd341('0xf5')]][_0xd341('0xc2')]][_0xd341('0x101')]=this[_0xd341('0x100')][this[_0xd341('0x27')][_0x57a2be[_0xd341('0xf5')]]['queue']];for(var _0x843742=0x0;_0x843742=_0x14aed6[_0xd341('0x123')]){_0x4cd2db[_0xd341('0x124')](_0x4b932e,_0x3f6012,_0x148c68,_0xd341('0x125'));}else{if(_0x4b932e[_0xd341('0x120')]>=_0x14aed6[_0xd341('0x126')]){_0x4cd2db[_0xd341('0x127')](_0x4b932e,_0x3f6012,_0x148c68,_0xd341('0x128'));}else{hopperUtils[_0xd341('0xdf')]({'active':![],'countmachineretry':_0x4b932e[_0xd341('0x120')],'scheduledat':moment()[_0xd341('0xe0')](_0x14aed6['dialMachineRetryFrequency'],_0xd341('0xe1'))[_0xd341('0x48')](_0xd341('0xc7')),'ContactId':_0x4b932e[_0xd341('0xe2')],'ListId':_0x4b932e[_0xd341('0xf1')],'VoiceQueueId':_0x4b932e[_0xd341('0xe3')]||undefined,'CampaignId':_0x4b932e[_0xd341('0xe4')]||undefined})[_0xd341('0xa5')](loggerCatch(_0xd341('0x129')));_0x3f6012({'reschedule':0x1});}}});}if(_0x563ac8[_0xd341('0xc4')]===_0xd341('0xc5')&&this[_0xd341('0x23')][_0x563ac8['queue']][_0xd341('0x11d')]&&_0x1e915a['value']==='HANGUP'){delete this[_0xd341('0x29')][_0x1e915a['uniqueid']];this[_0xd341('0xd1')](this['campaigns'][_0x563ac8[_0xd341('0xc2')]]);_0xaae5bc=new Hangup(_0x563ac8,_0x1e915a);_0xaae5bc['state']=0x12;_0xaae5bc[_0xd341('0x72')]='HangupInAMD';_0xaae5bc[_0xd341('0x117')]=_0xd341('0x118');ami['emit'](_0xd341('0x119'),ut['buildObj'](_0xaae5bc,_0xd341('0x11b')));this[_0xd341('0x11c')](_0xaae5bc,_0xd341('0x12a'),_0xd341('0x12b'));}if(_0x563ac8[_0xd341('0xc4')]==='ivr'&&this[_0xd341('0x23')][_0x563ac8['queue']][_0xd341('0x11d')]&&_0x1e915a[_0xd341('0x113')]===_0xd341('0x11e')){return new Promise(function(_0x3d6140,_0x160612){delete _0x4cd2db[_0xd341('0x29')][_0x1e915a[_0xd341('0xc3')]];_0x4cd2db[_0xd341('0xd1')](_0x4cd2db[_0xd341('0x23')][_0x563ac8[_0xd341('0xc2')]]);_0x4cd2db[_0xd341('0x23')][_0x563ac8[_0xd341('0xc2')]]['outboundAnswerCallsDay']+=0x1;_0x4cd2db['campaigns'][_0x563ac8[_0xd341('0xc2')]][_0xd341('0x115')]+=0x1;var _0x1de2d4=_0x4cd2db['campaigns'][_0x563ac8[_0xd341('0xc2')]];var _0x551747=new Hangup(_0x563ac8,_0x1e915a);_0x551747[_0xd341('0xd5')]=0x13;_0x551747[_0xd341('0x72')]='Machine';_0x551747[_0xd341('0x117')]=_0xd341('0x118');_0x551747[_0xd341('0x120')]+=0x1;_0x551747['countglobal']+=0x1;_0x551747[_0xd341('0x11b')]=!![];ami[_0xd341('0x44')]('custom:amd',ut[_0xd341('0x11a')](_0x551747,_0xd341('0x11b')));hopperUtils[_0xd341('0xe8')](_0x551747)[_0xd341('0xa5')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x551747[_0xd341('0x12c')]+_0x551747[_0xd341('0x12d')]+_0x551747['countnoanswerretry']+_0x551747[_0xd341('0x122')]+_0x551747[_0xd341('0xd8')]+_0x551747[_0xd341('0xed')]+_0x551747[_0xd341('0x120')]+_0x551747[_0xd341('0x12e')]>=_0x1de2d4['dialGlobalMaxRetry']){_0x4cd2db[_0xd341('0x124')](_0x551747,_0x3d6140,_0x160612,_0xd341('0x125'));}else{if(_0x551747[_0xd341('0x120')]>=_0x1de2d4[_0xd341('0x126')]){_0x4cd2db['createStateFinal'](_0x551747,_0x3d6140,_0x160612,_0xd341('0x128'));}else{hopperUtils[_0xd341('0xdf')]({'active':![],'countmachineretry':_0x551747[_0xd341('0x120')],'scheduledat':moment()[_0xd341('0xe0')](_0x1de2d4[_0xd341('0x12f')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x551747[_0xd341('0xe2')],'ListId':_0x551747['ListId'],'VoiceQueueId':_0x551747[_0xd341('0xe3')]||undefined,'CampaignId':_0x551747[_0xd341('0xe4')]||undefined})[_0xd341('0xa5')](loggerCatch(_0xd341('0x129')));_0x3d6140({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xd341('0x130')]=function(_0x146b98){var _0x433e02=this['uniqueId'][_0x146b98[_0xd341('0xc3')]];var _0x1c267a;if(_0x433e02&&_0x433e02[_0xd341('0xc4')]==='ivr'){delete this['uniqueId'][_0x146b98['uniqueid']];this['updateOriginated'](this[_0xd341('0x23')][_0x433e02[_0xd341('0xc2')]]);this[_0xd341('0x23')][_0x433e02[_0xd341('0xc2')]][_0xd341('0x131')]+=0x1;_0x1c267a=new Hangup(_0x433e02,_0x146b98);hopperUtils['createHistory'](_0x1c267a)[_0xd341('0xa5')](loggerCatch(_0xd341('0x132')));hopperUtils[_0xd341('0xcf')](_0x1c267a)[_0xd341('0xa5')](loggerCatch(_0xd341('0x133')));}if(_0x433e02&&_0x433e02['type']!=='ivr'&&isNotNull(this[_0xd341('0x22')][_0x433e02['queue']][_0xd341('0x134')])){delete this['uniqueId'][_0x146b98[_0xd341('0xc3')]];this[_0xd341('0xd1')](this[_0xd341('0x22')][_0x433e02[_0xd341('0xc2')]]);this[_0xd341('0x22')][_0x433e02[_0xd341('0xc2')]][_0xd341('0xc8')]+=0x1;this['voiceQueues'][_0x433e02[_0xd341('0xc2')]][_0xd341('0x115')]+=0x1;_0x1c267a=new Hangup(_0x433e02,_0x146b98);_0x1c267a[_0xd341('0xd5')]=0x10;_0x1c267a['statedesc']='AnswerAGI';_0x1c267a[_0xd341('0x117')]=_0xd341('0x135');hopperUtils[_0xd341('0xe8')](_0x1c267a)[_0xd341('0xa5')](loggerCatch(_0xd341('0x132')));hopperUtils[_0xd341('0xcf')](_0x1c267a)[_0xd341('0xa5')](loggerCatch(_0xd341('0x133')));}if(_0x433e02&&_0x433e02['type']!==_0xd341('0xc5')&&!isNotNull(this[_0xd341('0x22')][_0x433e02[_0xd341('0xc2')]]['dialQueueProject'])){delete this['uniqueId'][_0x146b98['uniqueid']];this[_0xd341('0xd1')](this['voiceQueues'][_0x433e02['queue']]);this[_0xd341('0x22')][_0x433e02[_0xd341('0xc2')]][_0xd341('0x136')]+=0x1;_0x1c267a=new Hangup(_0x433e02,_0x146b98);_0x1c267a['state']=0xc;_0x1c267a['statedesc']=_0x146b98[_0xd341('0x137')];_0x1c267a[_0xd341('0x117')]=_0xd341('0x138');hopperUtils['createHistory'](_0x1c267a)[_0xd341('0xa5')](loggerCatch(_0xd341('0x132')));hopperUtils[_0xd341('0xcf')](_0x1c267a)[_0xd341('0xa5')](loggerCatch('[syncHangupIvr]'));}};Dialer['prototype'][_0xd341('0xc')]=function(_0x4a9c59){var _0x38be35=this;if(!_0x38be35[_0xd341('0x2e')][_0x4a9c59[_0xd341('0x65')]]){_0x38be35[_0xd341('0x2e')][_0x4a9c59['name']]={'running':![]};}else if(_0x38be35[_0xd341('0x2e')][_0x4a9c59['name']][_0xd341('0x139')]===!![]){return;}else if(_0x38be35[_0xd341('0x2e')][_0x4a9c59[_0xd341('0x65')]]['running']===![]){_0x38be35[_0xd341('0x2e')][_0x4a9c59['name']]['running']=!![];}var _0x1c6156=_0x38be35[_0xd341('0x22')][_0x4a9c59['name']];var _0x1420a2=_0x1c6156[_0xd341('0x6d')]!==utils[_0xd341('0x71')][_0xd341('0x7e')];var _0x5425a6=utils[_0xd341('0x13a')](_0x1c6156);_0x1c6156['statusMessage']=utils[_0xd341('0x13b')](_0x1c6156,_0x38be35[_0xd341('0x24')]);Promise[_0xd341('0xb0')]()[_0xd341('0x41')](function(){if(_0x1c6156[_0xd341('0x13c')]===utils[_0xd341('0x71')][_0xd341('0x7e')]){if(_0x1420a2){clearPredictiveAttributes(_0x1c6156);_0x4a9c59[_0xd341('0x67')]=undefined;_0x4a9c59[_0xd341('0x2b')]=undefined;}if(_0x1c6156[_0xd341('0x13c')]===utils[_0xd341('0x71')][_0xd341('0x7e')]){_0x4a9c59['available']=0x0;_0x4a9c59[_0xd341('0x102')]=0x0;_0x4a9c59[_0xd341('0x13d')]=0x0;_0x4a9c59[_0xd341('0x13e')]=0x0;_0x4a9c59['pTalking']=0x0;}}else if(_0x1c6156[_0xd341('0x13c')]===utils[_0xd341('0x71')][_0xd341('0x13f')]&&!_0x5425a6){return _0x38be35[_0xd341('0x94')](_0x1c6156,!![])[_0xd341('0x41')](function(){return _0x38be35['ifTime'](_0x1c6156,![]);})[_0xd341('0x41')](function(){return _0x38be35['checkDialMethod'](_0x1c6156);})[_0xd341('0xa5')](function(_0x26b522){loggerSyncQueueSummary['debug'](_0xd341('0x140'),util[_0xd341('0x47')](_0x26b522,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x1c6156);});}else{clearPredictiveAttributes(_0x1c6156);}})['then'](function(){var _0x5a9945=_0x4a9c59['compareToOutboundQueue'](_0x1c6156);if(_0x5a9945||_0x1c6156[_0xd341('0x141')]){_0x1c6156[_0xd341('0x141')]=![];_0x4a9c59[_0xd341('0x142')](_0x1c6156);Object[_0xd341('0x143')](_0x1c6156,_0x4a9c59);emitOutboundVoiceQueueSummary(_0x4a9c59);}_0x38be35[_0xd341('0x2e')][_0x1c6156[_0xd341('0x65')]][_0xd341('0x139')]=![];})[_0xd341('0xa5')](function(_0xc1ac42){logger[_0xd341('0x69')](_0xd341('0x140'),util['inspect'](_0xc1ac42,{'showHidden':![],'depth':null}));_0x38be35[_0xd341('0x2e')][_0x1c6156[_0xd341('0x65')]]['running']=![];});};Dialer[_0xd341('0x1c')]['syncQueueSummaryComplete']=_[_0xd341('0x144')](function(){var _0xb517a7=_[_0xd341('0x145')](this['voiceQueues'],function(_0x2a7f0c){return _0x2a7f0c[_0xd341('0x146')];});var _0x9b3a97=_['filter'](this[_0xd341('0xfa')],function(_0x5c874e){return _0x5c874e[_0xd341('0x147')]&&_0x5c874e['status']===_0xd341('0x148');});if(_0xb517a7[_0xd341('0x9c')]>0x0&&_0x9b3a97[_0xd341('0x9c')]>0x0){return Promise[_0xd341('0xb0')]()['then'](cmHopper[_0xd341('0x149')](_[_0xd341('0x14a')](_0xb517a7,'id'),previewRecallmeReminderInterval,_[_0xd341('0x14a')](_0x9b3a97,'id')))[_0xd341('0x41')](function(_0x52eb7b){for(var _0x5db282=0x0;_0x5db282<_0x52eb7b['length'];_0x5db282++){var _0x4f7286=_0x52eb7b[_0x5db282][_0xd341('0x14b')][_0xd341('0x65')];if(_0x4f7286)io['to'](util['format'](_0xd341('0x14c'),_0x4f7286))[_0xd341('0x44')]('user:dialPreviewRecallReminder',{'hopper':_0x52eb7b[_0x5db282]});}})[_0xd341('0xa5')](function(_0x2b740f){logger[_0xd341('0x69')]('checkPreviewRecallReminder',_0x2b740f);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0xd341('0x3f')]=function(){var _0x395015=this;setInterval(function(){_0x395015['clearZombieChannels'](_0x395015[_0xd341('0x29')],'[uniqueid]');_0x395015[_0xd341('0x14d')](_0x395015[_0xd341('0x27')],_0xd341('0x14e'));},0x32c8);};Dialer[_0xd341('0x1c')][_0xd341('0x14d')]=function(_0x49a195,_0x3c9707){var _0x496a17=this;for(var _0x23b93b in _0x49a195){if(typeof _0x49a195[_0x23b93b]!=='undefined'){this[_0xd341('0x20')][_0xd341('0x1d')](function(){if(!_[_0xd341('0xf9')](_0x49a195[_0x23b93b])){return ami['Action']({'action':_0xd341('0x8c'),'channel':_0x49a195[_0x23b93b][_0xd341('0xf4')]})[_0xd341('0xa5')](function(_0xdbd0c9){if(_0xdbd0c9[_0xd341('0x6d')]===_0xd341('0x14f')){setTimeout(function(){if(_0x49a195[_0x23b93b]&&_0x49a195[_0x23b93b][_0xd341('0xc4')]!==_0xd341('0xc5')){_0x496a17[_0xd341('0xd1')](_0x496a17[_0xd341('0x22')][_0x49a195[_0x23b93b][_0xd341('0xc2')]]);logger[_0xd341('0x69')]('[Dialer][checkChannel]',_0x3c9707,_0x23b93b,_0x49a195[_0x23b93b][_0xd341('0xc2')]);delete _0x49a195[_0x23b93b];}if(_0x49a195[_0x23b93b]&&_0x49a195[_0x23b93b][_0xd341('0xc4')]==='ivr'){_0x496a17[_0xd341('0xd1')](_0x496a17['campaigns'][_0x49a195[_0x23b93b][_0xd341('0xc2')]]);logger[_0xd341('0x69')]('[Dialer][checkChannel][ivr]',_0x3c9707,_0x23b93b,_0x49a195[_0x23b93b][_0xd341('0xc2')]);delete _0x49a195[_0x23b93b];}},0x2328);}});}});}}};Dialer[_0xd341('0x1c')][_0xd341('0x150')]=function(_0x3821b7){return Promise[_0xd341('0xb0')]()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x3821b7))[_0xd341('0xa5')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0xd341('0x1c')][_0xd341('0xd1')]=function(_0x112f39){if(!_[_0xd341('0x43')](_0x112f39)&&_0x112f39!==null){if(typeof _0x112f39[_0xd341('0x82')]!==_0xd341('0xaf')){if(_0x112f39[_0xd341('0x82')]>0x0){_0x112f39[_0xd341('0x82')]-=0x1;}else{logger[_0xd341('0x69')](_0xd341('0x151'));}}}else{logger['error'](_0xd341('0x152'));}};Dialer[_0xd341('0x1c')]['loggerHandler']=function(_0x21e471,_0x26763b){var _0x5bfdb2=this;return function(_0xd984da){_0x5bfdb2[_0xd341('0xd1')](_0x26763b);logger[_0xd341('0x69')](_0x21e471,util[_0xd341('0x47')](_0xd984da,{'showHidden':![],'depth':null}));};};Dialer[_0xd341('0x1c')]['emptyContact']=function(_0x3bb7f9,_0x4fcf65,_0x1ea693){var _0x2bf1cb={'state':0x19,'statedesc':'notFound'};this['updateOriginated'](_0x4fcf65);this[_0xd341('0x11c')](_[_0xd341('0x153')](_0x2bf1cb,_['pick'](_0x1ea693,[_0xd341('0xe2'),_0xd341('0xf1'),_0xd341('0x154'),_0xd341('0xe3'),_0xd341('0xe4')])),'[emptyContact][createHistory]',_0xd341('0x155'));logger[_0xd341('0x69')](_0x3bb7f9);};Dialer[_0xd341('0x1c')]['saveInDb']=function(_0x28b2a3,_0xbb4698,_0x2c2d50){hopperUtils[_0xd341('0xe8')](_0x28b2a3)[_0xd341('0xa5')](loggerCatch(_0xbb4698));hopperUtils[_0xd341('0xcf')](_0x28b2a3)[_0xd341('0xa5')](loggerCatch(_0x2c2d50));};Dialer[_0xd341('0x1c')]['queueCallerAbandonCreateState']=function(_0x540d33,_0x5b6468){hopperUtils[_0xd341('0xe8')](_0x540d33)[_0xd341('0xa5')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x5b6468==0x0){hopperUtils['moveContactManagedDialer'](_0x540d33)[_0xd341('0xa5')](loggerCatch(_0xd341('0x156')));}};Dialer['prototype'][_0xd341('0x157')]=function(_0x44048c){return Promise['resolve']()['then'](cmHopper[_0xd341('0x149')](_0x44048c['id'],previewRecallmeReminderInterval))[_0xd341('0x41')](function(_0x3083bc){for(var _0x1a63c0=0x0;_0x1a63c0<_0x3083bc[_0xd341('0x9c')];_0x1a63c0++){var _0x24e720=_0x3083bc[_0x1a63c0][_0xd341('0x14b')][_0xd341('0x65')];if(_0x24e720)io['to'](util['format'](_0xd341('0x14c'),_0x24e720))[_0xd341('0x44')]('user:dialPreviewRecallReminder',{'hopper':_0x3083bc[_0x1a63c0]});}})[_0xd341('0xa5')](function(){});};Dialer['prototype']['launchHandleIvr']=function(_0x57f0eb){var _0x45865f=this;return function(){_0x45865f[_0xd341('0x158')](_0x57f0eb);};};Dialer['prototype']['actionOriginate']=function(_0x121c95,_0x5827ff){var _0x2555ae=this;var _0x3395ef=uuid['v4']();this[_0xd341('0x27')][_0x3395ef]=new Action(_0x121c95,_0x5827ff,_0x3395ef);return new Promise(function(_0x5ed757,_0x3d3f65){if(_[_0xd341('0x43')](_0x121c95)&&typeof _0x121c95!==_0xd341('0x159')){return _0x3d3f65(msgResponse(_0xd341('0x15a'),'Failure','voiceQueue\x20is\x20undefine'));}if(_[_0xd341('0x43')](_0x5827ff[_0xd341('0x15b')])||_0x5827ff['phone']===null){return _0x3d3f65(msgResponse(_0xd341('0x15a'),_0xd341('0x95'),_0xd341('0x15c')));}var _0x75e8b1={'XMD-CALLERID':_0x2555ae['actions'][_0x3395ef][_0xd341('0x15d')](),'XMD-AGI':_0x121c95[_0xd341('0x134')]?util['format'](_0xd341('0x15e'),ipAgi,_0x121c95[_0xd341('0x134')]):_0xd341('0x15f'),'XMD-AGIAFTER':_0x121c95['dialQueueProject2']?util[_0xd341('0x48')](_0xd341('0x15e'),ipAgi,_0x121c95[_0xd341('0xcc')]):'NONE','XMD-QUEUE':utils[_0xd341('0x160')](_0x121c95)?util[_0xd341('0x48')]('\x22%s,%s%s,,,%s\x22',_0x121c95['name'],_0x121c95['dialQueueOptions']||'',_0x121c95['dialAgiAfterHangupAgent']?'c':'',_0x121c95[_0xd341('0x161')]||0x3):_0xd341('0x15f'),'XMD-CONTACTID':_0x5827ff['ContactId'],'XMD-CDRTYPE':_0xd341('0x8'),'CALLERID(all)':_0x2555ae[_0xd341('0x27')][_0x3395ef]['getCaller'](),'XMD-AMD':_0x121c95['dialAMDActive']?_0xd341('0x13f'):_0xd341('0x15f'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x121c95[_0xd341('0x11d')]){_0x75e8b1[_0xd341('0x162')]=_0x121c95[_0xd341('0x163')]||0x9c4;_0x75e8b1[_0xd341('0x164')]=_0x121c95[_0xd341('0x165')]||0x5dc;_0x75e8b1[_0xd341('0x166')]=_0x121c95[_0xd341('0x167')]||0x320;_0x75e8b1[_0xd341('0x168')]=_0x121c95['dialAMDTotalAnalysisTime']||0x1388;_0x75e8b1[_0xd341('0x169')]=_0x121c95[_0xd341('0x16a')]||0x64;_0x75e8b1['XMD-AMDBETWEENWORDSSILENCE']=_0x121c95[_0xd341('0x16b')]||0x32;_0x75e8b1[_0xd341('0x16c')]=_0x121c95[_0xd341('0x16d')]||0x3;_0x75e8b1[_0xd341('0x16e')]=_0x121c95[_0xd341('0x16f')]||0x100;_0x75e8b1['XMD-AMDMAXIMUMWORDLENGTH']=_0x121c95[_0xd341('0x170')]||0x1388;}if(utils[_0xd341('0x160')](_0x121c95)){_0x75e8b1[_0xd341('0x171')]=_0x5827ff[_0xd341('0xe3')];}else{_0x75e8b1[_0xd341('0x172')]=_0x5827ff[_0xd341('0xe4')];}for(var _0x30936f in _0x5827ff['Contact']){if(typeof _0x5827ff[_0xd341('0x173')][_0x30936f]!==_0xd341('0xaf')){if(isNotNull(_0x5827ff['Contact'][_0x30936f])&&_0x30936f!=='id'&&_0x30936f!==_0xd341('0x174')&&_0x30936f!==_0xd341('0x175')&&_0x30936f!==_0xd341('0x176')){_0x75e8b1[util['format'](_0xd341('0x177'),'XMD-',_[_0xd341('0x178')](_0x30936f))]=_0x5827ff[_0xd341('0x173')][_0x30936f];}}}var _0x2b942b=_0x2555ae[_0xd341('0x89')](_0x121c95['Trunk'])?utils[_0xd341('0x179')](_0x121c95[_0xd341('0x8f')]['callerid'],_0x121c95[_0xd341('0x17a')],_0x121c95[_0xd341('0x17b')]>0x0?utils['getCallerIdRandom'](_0x121c95[_0xd341('0x17c')],_0x121c95['dialRandomLastDigitCallerIdNumber']):_0x121c95[_0xd341('0x17c')]):utils['getCallerId'](_[_0xd341('0xf9')](_0x121c95[_0xd341('0x17d')])?_0x121c95[_0xd341('0x8f')][_0xd341('0x17e')]:_0x121c95['TrunkBackup']['callerid'],_0x121c95[_0xd341('0x17a')],_0x121c95[_0xd341('0x17b')]>0x0?utils[_0xd341('0x17f')](_0x121c95[_0xd341('0x17c')],_0x121c95[_0xd341('0x17b')]):_0x121c95[_0xd341('0x17c')]);if(_0x2b942b){_0x75e8b1[_0xd341('0x180')]=_0x2555ae[_0xd341('0x27')][_0x3395ef][_0xd341('0x181')]=utils[_0xd341('0x182')](_0x2b942b);_0x75e8b1[_0xd341('0x183')]=_0x5827ff[_0xd341('0x15b')];}_0x121c95['variables']=_0x75e8b1;return ami[_0xd341('0x9e')]({'actionid':_0x3395ef,'action':_0xd341('0x15a'),'channel':_0x2555ae['isTrunkReachable'](_0x121c95[_0xd341('0x8f')])?util[_0xd341('0x48')](_0xd341('0x184'),_0x121c95[_0xd341('0x8f')][_0xd341('0x65')],isNotNull(_0x121c95[_0xd341('0x185')])?_0x121c95[_0xd341('0x185')]['trim']()||'':'',_0x121c95[_0xd341('0x186')]>0x0?_0x5827ff['phone'][_0xd341('0x187')](_0x121c95[_0xd341('0x186')]):_0x5827ff[_0xd341('0x15b')]):util[_0xd341('0x48')]('SIP/%s/%s%s',_[_0xd341('0xf9')](_0x121c95[_0xd341('0x17d')])?_0x121c95['Trunk'][_0xd341('0x65')]:_0x121c95[_0xd341('0x17d')][_0xd341('0x65')],isNotNull(_0x121c95['dialPrefix'])?_0x121c95[_0xd341('0x185')][_0xd341('0x188')]()||'':'',_0x121c95[_0xd341('0x186')]>0x0?_0x5827ff['phone'][_0xd341('0x187')](_0x121c95[_0xd341('0x186')]):_0x5827ff[_0xd341('0x15b')]),'callerid':_0x2b942b,'Exten':_0xd341('0x112'),'Context':_0xd341('0x189'),'Priority':'1','variable':_0x75e8b1,'timeout':(_0x121c95['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x3395ef})[_0xd341('0x41')](function(_0x4fc65b){return _0x5ed757(_0x4fc65b);})[_0xd341('0xa5')](function(_0x349ecc){_0x121c95[_0xd341('0x18a')]+=0x1;var _0x244b06=new History(_0x2555ae[_0xd341('0x27')][_0x3395ef]);logger[_0xd341('0x69')](util[_0xd341('0x48')](_0xd341('0x18b'),JSON[_0xd341('0x78')](_0x349ecc)));_0x244b06[_0xd341('0xd5')]=0xe;_0x244b06[_0xd341('0x72')]='OriginateError';_0x244b06[_0xd341('0x74')]=moment()[_0xd341('0x48')](_0xd341('0xc7'));_0x244b06['endtime']=_0x244b06[_0xd341('0x74')];hopperUtils[_0xd341('0xe8')](_0x244b06)[_0xd341('0xa5')](loggerCatch('[originate][error]'));_0x2555ae['moveContactManagedDialer'](_0x244b06)[_0xd341('0xa5')](loggerCatch('[originate][error]'))[_0xd341('0x1f')](function(){delete _0x2555ae['actions'][_0x3395ef];return _0x3d3f65(msgResponse(_0xd341('0x15a'),_0xd341('0x88'),_0xd341('0x18c')));});});});};Dialer[_0xd341('0x1c')][_0xd341('0x18d')]=function(_0x5db5d4,_0x709ccf,_0x10a0d1){var _0x3874c0=new History(_0x709ccf);if(_0x3874c0[_0xd341('0x12c')]+_0x3874c0[_0xd341('0x12d')]+_0x3874c0[_0xd341('0x18e')]+_0x3874c0[_0xd341('0x122')]+_0x3874c0[_0xd341('0xd8')]+_0x3874c0[_0xd341('0xed')]+_0x3874c0[_0xd341('0x120')]+_0x3874c0[_0xd341('0x12e')]>=_0x10a0d1[_0xd341('0x123')]-0x1){return!![];}switch(_0x5db5d4){case 0x3:if(_0x3874c0[_0xd341('0x18e')]>=_0x10a0d1[_0xd341('0x18f')]-0x1){return!![];}hopperUtils[_0xd341('0xdf')]({'active':![],'countnoanswerretry':_0x3874c0[_0xd341('0x18e')]+=0x1,'scheduledat':moment()['add'](_0x10a0d1[_0xd341('0x190')],'minutes')[_0xd341('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3874c0[_0xd341('0xe2')],'ListId':_0x3874c0[_0xd341('0xf1')],'VoiceQueueId':_0x3874c0[_0xd341('0xe3')]||undefined,'CampaignId':_0x3874c0[_0xd341('0xe4')]||undefined})[_0xd341('0xa5')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x3874c0[_0xd341('0x12c')]>=_0x10a0d1[_0xd341('0x191')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x3874c0['countbusyretry']+=0x1,'scheduledat':moment()[_0xd341('0xe0')](_0x10a0d1[_0xd341('0x192')],_0xd341('0xe1'))[_0xd341('0x48')](_0xd341('0xc7')),'ContactId':_0x3874c0['ContactId'],'ListId':_0x3874c0[_0xd341('0xf1')],'VoiceQueueId':_0x3874c0[_0xd341('0xe3')]||undefined,'CampaignId':_0x3874c0[_0xd341('0xe4')]||undefined})[_0xd341('0xa5')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x3874c0[_0xd341('0x12d')]>=_0x10a0d1[_0xd341('0x193')]-0x1){return!![];}hopperUtils[_0xd341('0xdf')]({'active':![],'countcongestionretry':_0x3874c0[_0xd341('0x12d')]+=0x1,'scheduledat':moment()[_0xd341('0xe0')](_0x10a0d1[_0xd341('0x194')],'minutes')[_0xd341('0x48')](_0xd341('0xc7')),'ContactId':_0x3874c0[_0xd341('0xe2')],'ListId':_0x3874c0[_0xd341('0xf1')],'VoiceQueueId':_0x3874c0[_0xd341('0xe3')]||undefined,'CampaignId':_0x3874c0['CampaignId']||undefined})[_0xd341('0xa5')](loggerCatch(_0xd341('0x195')));break;case 0x0:if(_0x3874c0[_0xd341('0x122')]>=_0x10a0d1[_0xd341('0x196')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x3874c0['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0xd341('0xe0')](_0x10a0d1['dialNoSuchNumberRetryFrequency'],'minutes')['format'](_0xd341('0xc7')),'ContactId':_0x3874c0[_0xd341('0xe2')],'ListId':_0x3874c0['ListId'],'VoiceQueueId':_0x3874c0[_0xd341('0xe3')]||undefined,'CampaignId':_0x3874c0[_0xd341('0xe4')]||undefined})['catch'](loggerCatch(_0xd341('0x197')));}break;case 0xa:if(_0x3874c0[_0xd341('0xd8')]>=_0x10a0d1[_0xd341('0xdd')]-0x1){return!![];}hopperUtils[_0xd341('0xdf')]({'active':![],'countdropretry':_0x3874c0[_0xd341('0xd8')]+=0x1,'scheduledat':moment()['add'](_0x10a0d1[_0xd341('0x198')],_0xd341('0xe1'))[_0xd341('0x48')](_0xd341('0xc7')),'ContactId':_0x3874c0[_0xd341('0xe2')],'ListId':_0x3874c0[_0xd341('0xf1')],'VoiceQueueId':_0x3874c0[_0xd341('0xe3')]||undefined,'CampaignId':_0x3874c0['CampaignId']||undefined})[_0xd341('0xa5')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x3874c0[_0xd341('0xed')]>=_0x10a0d1['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0xd341('0xdf')]({'active':![],'countabandonedretry':_0x3874c0[_0xd341('0xed')]+=0x1,'scheduledat':moment()[_0xd341('0xe0')](_0x10a0d1[_0xd341('0xee')],_0xd341('0xe1'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3874c0[_0xd341('0xe2')],'ListId':_0x3874c0[_0xd341('0xf1')],'VoiceQueueId':_0x3874c0[_0xd341('0xe3')]||undefined,'CampaignId':_0x3874c0['CampaignId']||undefined})[_0xd341('0xa5')](loggerCatch(_0xd341('0xf2')));break;case 0x13:if(_0x3874c0[_0xd341('0x120')]>=_0x10a0d1[_0xd341('0x126')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x3874c0[_0xd341('0x120')]+=0x1,'scheduledat':moment()['add'](_0x10a0d1[_0xd341('0x12f')],_0xd341('0xe1'))[_0xd341('0x48')](_0xd341('0xc7')),'ContactId':_0x3874c0['ContactId'],'ListId':_0x3874c0[_0xd341('0xf1')],'VoiceQueueId':_0x3874c0[_0xd341('0xe3')]||undefined,'CampaignId':_0x3874c0[_0xd341('0xe4')]||undefined})['catch'](loggerCatch(_0xd341('0x129')));break;case 0x14:if(_0x3874c0[_0xd341('0x12e')]>=_0x10a0d1[_0xd341('0x199')]-0x1){return!![];}hopperUtils[_0xd341('0xdf')]({'active':![],'countagentrejectretry':_0x3874c0[_0xd341('0x12e')]+=0x1,'scheduledat':moment()['add'](_0x10a0d1[_0xd341('0x19a')],_0xd341('0xe1'))['format'](_0xd341('0xc7')),'ContactId':_0x3874c0[_0xd341('0xe2')],'ListId':_0x3874c0[_0xd341('0xf1')],'VoiceQueueId':_0x3874c0['VoiceQueueId']||undefined,'CampaignId':_0x3874c0['CampaignId']||undefined})[_0xd341('0xa5')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xd341('0x1c')][_0xd341('0x10d')]=function(_0x35e3d7,_0x53374b,_0x2276f6){var _0x2e3fdc=this;var _0x528d74=new History(_0x35e3d7);var _0x4eb3d7=![];var _0x15dd00;var _0x38898f;return new Promise(function(_0x567d89,_0x247488){if(_['isUndefined'](_0x53374b)&&typeof _0x53374b!==_0xd341('0x159')){return _0x247488(msgResponse('[callProgressDetecting]',_0xd341('0x95'),_0xd341('0x19b')));}if(_['isUndefined'](_0x2276f6)&&typeof _0x2276f6!==_0xd341('0x159')){return _0x247488(msgResponse(_0xd341('0x19c'),_0xd341('0x95'),_0xd341('0x19d')));}hopperUtils[_0xd341('0xef')](_0x528d74,_0x2276f6['reason'],_0x53374b)[_0xd341('0x41')](function(_0x2e46d3){if(_0x2e46d3[_0xd341('0xdc')]==0x1)_0x4eb3d7=!![];switch(_0x2276f6[_0xd341('0xc9')]){case'0':_0x53374b[_0xd341('0x19e')]+=0x1;_0x528d74[_0xd341('0xd5')]=0x0;_0x528d74['statedesc']=_0xd341('0x19f');_0x528d74['countnosuchnumberretry']+=0x1;_0x528d74['countglobal']+=0x1;ami[_0xd341('0x44')](_0xd341('0x1a0'),ut[_0xd341('0x11a')](_0x35e3d7,_0xd341('0x1a1')));_0x15dd00=_0x53374b['dialNoSuchNumberRetryFrequency'];_0x38898f=_0x53374b['callAdditionalPhoneAfterMin'];hopperUtils[_0xd341('0xe8')](_0x528d74)[_0xd341('0xa5')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x2e3fdc[_0xd341('0x18d')](0x0,_0x35e3d7,_0x53374b)&&!_0x4eb3d7){if(_0x528d74[_0xd341('0x122')]>=_0x53374b['dialNoSuchNumberMaxRetry']){_0x2e3fdc[_0xd341('0x127')](_0x528d74,_0x567d89,_0x247488,_0xd341('0x1a2'));}else{_0x2e3fdc[_0xd341('0x124')](_0x528d74,_0x567d89,_0x247488,_0xd341('0x1a2'));}}break;case'3':_0x53374b[_0xd341('0x1a3')]+=0x1;_0x528d74[_0xd341('0xd5')]=0x3;_0x528d74['statedesc']='NoAnswer';_0x528d74['countnoanswerretry']+=0x1;_0x528d74[_0xd341('0xd9')]+=0x1;var _0x191e31=ut[_0xd341('0x1a4')](_0x35e3d7,_0x53374b);ami[_0xd341('0x44')](_0xd341('0x1a5'),_0x191e31);_0x15dd00=_0x53374b[_0xd341('0x190')];_0x38898f=_0x53374b[_0xd341('0xda')];hopperUtils[_0xd341('0xe8')](_0x528d74)[_0xd341('0xa5')](loggerCatch(_0xd341('0x1a6')));if(_0x2e3fdc['checkRetriveMax'](0x3,_0x35e3d7,_0x53374b)&&!_0x4eb3d7){if(_0x528d74['countnoanswerretry']>=_0x53374b[_0xd341('0x18f')]){_0x2e3fdc['createStateFinal'](_0x528d74,_0x567d89,_0x247488,_0xd341('0x1a7'));}else{_0x2e3fdc[_0xd341('0x124')](_0x528d74,_0x567d89,_0x247488,_0xd341('0x1a7'));}}break;case'5':_0x53374b[_0xd341('0x1a8')]+=0x1;_0x528d74[_0xd341('0xd5')]=0x5;_0x528d74[_0xd341('0x72')]=_0xd341('0x1a9');_0x528d74[_0xd341('0x12c')]+=0x1;_0x528d74[_0xd341('0xd9')]+=0x1;ami['emit'](_0xd341('0x1aa'),ut[_0xd341('0x11a')](_0x35e3d7,'busy'));_0x15dd00=_0x53374b['dialBusyRetryFrequency'];_0x38898f=_0x53374b[_0xd341('0xda')];hopperUtils[_0xd341('0xe8')](_0x528d74)[_0xd341('0xa5')](loggerCatch(_0xd341('0x1ab')));if(_0x2e3fdc[_0xd341('0x18d')](0x5,_0x35e3d7,_0x53374b)&&!_0x4eb3d7){if(_0x528d74['countbusyretry']>=_0x53374b['dialBusyMaxRetry']){_0x2e3fdc[_0xd341('0x127')](_0x528d74,_0x567d89,_0x247488,'reason\x205\x20busy');}else{_0x2e3fdc['stateGlobal'](_0x528d74,_0x567d89,_0x247488,_0xd341('0x1ac'));}}break;case'8':_0x53374b[_0xd341('0x1ad')]+=0x1;_0x528d74[_0xd341('0xd5')]=0x8;_0x528d74[_0xd341('0x72')]='Congestion';_0x528d74[_0xd341('0x12d')]+=0x1;_0x528d74['countglobal']+=0x1;_0x15dd00=_0x53374b[_0xd341('0x194')];_0x38898f=_0x53374b[_0xd341('0xda')];ami['emit'](_0xd341('0x1ae'),ut[_0xd341('0x11a')](_0x35e3d7,_0xd341('0x1af')));hopperUtils[_0xd341('0xe8')](_0x528d74)['catch'](loggerCatch(_0xd341('0x1b0')));if(_0x2e3fdc[_0xd341('0x18d')](0x8,_0x35e3d7,_0x53374b)&&!_0x4eb3d7){if(_0x528d74[_0xd341('0x12d')]>=_0x53374b[_0xd341('0x193')]){_0x2e3fdc[_0xd341('0x127')](_0x528d74,_0x567d89,_0x247488,'reason\x208\x20congestion');}else{_0x2e3fdc[_0xd341('0x124')](_0x528d74,_0x567d89,_0x247488,_0xd341('0x1b1'));}}break;case'11':_0x53374b[_0xd341('0x1b2')]+=0x1;_0x528d74[_0xd341('0xd5')]=0xb;_0x528d74[_0xd341('0x72')]=_0xd341('0xeb');_0x528d74['countabandonedretry']+=0x1;_0x528d74[_0xd341('0xd9')]+=0x1;_0x15dd00=_0x53374b['dialAbandonedRetryFrequency'];_0x38898f=_0x53374b[_0xd341('0xda')];hopperUtils[_0xd341('0xe8')](_0x528d74)[_0xd341('0xa5')](loggerCatch(_0xd341('0xf3')));if(_0x2e3fdc[_0xd341('0x18d')](0xb,_0x35e3d7,_0x53374b)&&!_0x4eb3d7){if(_0x528d74[_0xd341('0xed')]>=_0x53374b['dialAbandonedMaxRetry']){_0x2e3fdc[_0xd341('0x127')](_0x528d74,_0x567d89,_0x247488,'reason\x2011\x20abandoned');}else{_0x2e3fdc[_0xd341('0x124')](_0x528d74,_0x567d89,_0x247488,'reason\x2011\x20abandoned');}}break;case'20':_0x53374b[_0xd341('0x1b3')]+=0x1;_0x528d74['state']=0x14;_0x528d74[_0xd341('0x72')]=_0xd341('0x1b4');_0x528d74[_0xd341('0x12e')]+=0x1;_0x528d74['countglobal']+=0x1;_0x15dd00=_0x53374b[_0xd341('0x19a')];_0x38898f=_0x53374b[_0xd341('0xda')];ami['emit'](_0xd341('0x1b5'),ut[_0xd341('0x11a')](_0x35e3d7,_0xd341('0x1b6')));hopperUtils[_0xd341('0xe8')](_0x528d74)['catch'](loggerCatch(_0xd341('0x1b7')));if(_0x2e3fdc[_0xd341('0x18d')](0x14,_0x35e3d7,_0x53374b)&&!_0x4eb3d7){if(_0x528d74['countagentrejectretry']>=_0x53374b[_0xd341('0x199')]){_0x2e3fdc[_0xd341('0x127')](_0x528d74,_0x567d89,_0x247488,_0xd341('0x1b8'));}else{_0x2e3fdc[_0xd341('0x124')](_0x528d74,_0x567d89,_0x247488,'reason\x2020\x20agentreject');}}break;default:_0x53374b['outboundUnknownCallsDay']+=0x1;_0x528d74[_0xd341('0xd5')]=0xc;_0x528d74['statedesc']=_0x2276f6['reason'];_0x15dd00=_0x53374b[_0xd341('0x19a')];_0x38898f=_0x53374b[_0xd341('0xda')];hopperUtils[_0xd341('0xe8')](_0x528d74)['catch'](loggerCatch(_0xd341('0x1b9')));if(_0x2e3fdc[_0xd341('0x18d')](_0x2276f6[_0xd341('0xc9')],_0x35e3d7,_0x53374b)&&!_0x4eb3d7){if(_0x528d74[_0xd341('0x12c')]+_0x528d74[_0xd341('0x12d')]+_0x528d74['countnoanswerretry']+_0x528d74[_0xd341('0x122')]+_0x528d74['countdropretry']+_0x528d74['countabandonedretry']+_0x528d74[_0xd341('0x120')]+_0x528d74['countagentrejectretry']>=_0x53374b[_0xd341('0x123')]){_0x2e3fdc[_0xd341('0x124')](_0x528d74,_0x567d89,_0x247488,_0x2276f6[_0xd341('0xc9')]);}else{_0x2e3fdc[_0xd341('0x127')](_0x528d74,_0x567d89,_0x247488,_0x2276f6[_0xd341('0xc9')]);}}}})[_0xd341('0x41')](function(){if(_0x4eb3d7){hopperUtils[_0xd341('0xe9')](_0x528d74,_0x15dd00,_0x38898f)['then'](function(){return _0x567d89(0x1);});}});});};Dialer[_0xd341('0x1c')]['stateGlobal']=function(_0x4886dd,_0x4cb9a0,_0x4480a3,_0x58b16e){var _0x1aba83=new Final(_0x4886dd);_0x1aba83['state']=0xf;_0x1aba83['statedesc']=_0xd341('0x1ba');this['createStateFinal'](_0x1aba83,_0x4cb9a0,_0x4480a3,_0x58b16e);};Dialer['prototype']['createStateFinal']=function(_0x38017a,_0x3e10ac,_0x3f5137,_0x1d9275){hopperUtils[_0xd341('0xcf')](_0x38017a)[_0xd341('0x41')](function(){return _0x3e10ac(msgResponse(_0xd341('0x19c'),_0xd341('0x10c'),_0x1d9275));})[_0xd341('0xa5')](function(){return _0x3f5137(msgResponse(_0xd341('0x1bb'),_0xd341('0x95'),'contact\x20not\x20moved'));});};Dialer[_0xd341('0x1c')]['predictive']=function(_0x46b92a){var _0x3abbe4=_0x46b92a['dialPredictiveOptimizationPercentage']/0x64;var _0x1a21a3=_0x46b92a[_0xd341('0xd4')]/(_0x46b92a['outboundDropCallsDayTimeout']+_0x46b92a[_0xd341('0xc8')]);var _0x49649c=Math[_0xd341('0x1bc')](_0x46b92a[_0xd341('0x1bd')]*(_0x46b92a[_0xd341('0x1be')]/0x64));var _0x3b4aeb=Math[_0xd341('0x1bc')](_0x46b92a[_0xd341('0x1bd')]*(_0x46b92a[_0xd341('0x1bf')]/0x64));var _0x123ae5=_0x46b92a['available']+_0x46b92a[_0xd341('0x13e')];var _0x461aa3=Math[_0xd341('0x1c0')](_0x46b92a['erlangCalls']*_0x46b92a[_0xd341('0x61')]*_0x46b92a[_0xd341('0x1c1')]*_0x46b92a['predictiveIntervalMultiplicativeFactor']);if(_[_0xd341('0x43')](_0x46b92a['startProgressive'])){if(!_[_0xd341('0x43')](_0x46b92a[_0xd341('0x67')])){_0x46b92a[_0xd341('0x67')]=undefined;loggerPredictive[_0xd341('0x69')]('[startMethodPredictive][StartProgressive]',_0xd341('0x1c2'));}if(!_['isUndefined'](_0x46b92a[_0xd341('0x1c3')])){loggerPredictive[_0xd341('0x69')](_0xd341('0x1c4'),_0xd341('0x1c5'));clearInterval(_0x46b92a[_0xd341('0x1c3')]);_0x46b92a['handlePredictive']=undefined;}_0x46b92a['startProgressive']=moment()[_0xd341('0x48')](_0xd341('0xc7'));loggerPredictive['info'](_0x46b92a[_0xd341('0x65')],'collection\x20data\x20in\x20progressive\x20at',_0x46b92a[_0xd341('0x2b')]);this[_0xd341('0xb7')](_0x46b92a,0x1);}else if(ifInterval(_0x46b92a['dialPredictiveInterval'],_0x46b92a[_0xd341('0x2b')])){this[_0xd341('0xb7')](_0x46b92a,0x1);loggerPredictiveCalls['info'](_0xd341('0x1c6'),_0x46b92a['startProgressive'],_0x46b92a[_0xd341('0x65')]);_0x46b92a['erlangCalls']=0x0;_0x46b92a[_0xd341('0x1c7')]=0x0;}else if(_0x3abbe4<_0x1a21a3&&_0x46b92a[_0xd341('0x1c8')]===_0xd341('0x1c9')){clearPredictiveAttributes(_0x46b92a);loggerPredictive[_0xd341('0x4b')](_0xd341('0x1ca'),_0xd341('0x1cb'),_0x1a21a3,_0xd341('0x2b'),_0x46b92a[_0xd341('0x65')]);}else if(_0x461aa3<_0x46b92a[_0xd341('0x1c7')]&&_0x46b92a[_0xd341('0x1c8')]===_0xd341('0x1c9')){clearPredictiveAttributes(_0x46b92a);loggerPredictive[_0xd341('0x4b')](_0xd341('0x1cc'),_0xd341('0x1cd'),_0x461aa3,_0xd341('0x1ce'),_0x46b92a[_0xd341('0x1c7')],_0xd341('0x2b'),_0x46b92a[_0xd341('0x65')]);}else if(!ifInterval(_0x46b92a['dialPredictiveInterval'],_0x46b92a['startProgressive'])&&_[_0xd341('0x43')](_0x46b92a['startPredictive'])&&!_[_0xd341('0x43')](_0x46b92a[_0xd341('0x2b')])){_0x46b92a[_0xd341('0x67')]=moment()[_0xd341('0x48')](_0xd341('0xc7'));loggerPredictive[_0xd341('0x4b')](_0x46b92a['name'],_0xd341('0x1cf'),_0x46b92a['startPredictive']);hopperUtils[_0xd341('0x1d0')](_0x46b92a[_0xd341('0x1d1')])['then'](this[_0xd341('0x1d2')](_0x46b92a))[_0xd341('0x41')](mergeDataErlangB(_0x46b92a))[_0xd341('0x41')](this['startMethodPredictive'](_0x46b92a))[_0xd341('0xa5')](loggerCatchPredictive(_0xd341('0x1d3'),_0x46b92a));}else if(!ifInterval(_0x46b92a['dialPredictiveInterval'],_0x46b92a[_0xd341('0x67')])){_0x46b92a[_0xd341('0x1c7')]=0x0;_0x46b92a[_0xd341('0x67')]=moment()[_0xd341('0x48')](_0xd341('0xc7'));loggerPredictive['info'](_0x46b92a[_0xd341('0x65')],_0xd341('0x1d4'),_0x46b92a[_0xd341('0x67')]);clearInterval(_0x46b92a[_0xd341('0x1c3')]);_0x46b92a[_0xd341('0x1c3')]=undefined;hopperUtils['avgHandleTime'](_0x46b92a[_0xd341('0x1d1')])[_0xd341('0x41')](this['getDataPredictive'](_0x46b92a))[_0xd341('0x41')](mergeDataErlangB(_0x46b92a))[_0xd341('0x41')](this[_0xd341('0x1d5')](_0x46b92a))[_0xd341('0xa5')](loggerCatchPredictive(_0xd341('0x1d6'),_0x46b92a));}else if(_0x46b92a['predictiveIntervalAvailable']&&_0x123ae5<_0x46b92a[_0xd341('0x1bd')]-_0x3b4aeb){clearPredictiveAttributes(_0x46b92a);loggerPredictive[_0xd341('0x4b')](_0x46b92a[_0xd341('0x65')],_0xd341('0x1d7'),_0x123ae5,_0xd341('0x1d8'),_0x46b92a[_0xd341('0x1bd')],'-',_0x3b4aeb,'=',_0x46b92a['predictiveIntervalAvailable']-_0x3b4aeb,')');}else if(_0x46b92a[_0xd341('0x1bd')]&&_0x123ae5>_0x46b92a[_0xd341('0x1bd')]+_0x49649c){clearPredictiveAttributes(_0x46b92a);loggerPredictive[_0xd341('0x4b')](_0x46b92a[_0xd341('0x65')],_0xd341('0x1d7'),_0x123ae5,_0xd341('0x1d9'),_0x46b92a[_0xd341('0x1bd')],'+',_0x49649c,'=',_0x46b92a[_0xd341('0x1bd')]+_0x49649c,')');}};Dialer[_0xd341('0x1c')]['getDataPredictive']=function(_0x3b3597){var _0xe8ae66=this;return function(_0xd163ba){return new Promise(function(_0x3b1dd1,_0x38bb6c){_[_0xd341('0x153')](_0x3b3597,_0xd163ba[0x0]);if(checkGetDataPredictive(_0xd163ba[0x0])){var _0x11fad6=_0x3b3597[_0xd341('0x1bd')]=_0x3b3597['talking']+_0x3b3597['available'];var _0x1eb674=_0x3b3597[_0xd341('0x1d1')]*0x3c;var _0x5e14e0=_0xd163ba[0x0][_0xd341('0x55')]+_0xd163ba[0x0][_0xd341('0x53')];var _0x406751=(_0xd163ba[0x0][_0xd341('0x4e')]+_0xd163ba[0x0][_0xd341('0x50')]+_0xd163ba[0x0][_0xd341('0x52')])/_0xd163ba[0x0][_0xd341('0x4d')];_0x3b3597['predictiveIntervalHitRate']=_0x406751>0x0?_0x406751:0x1;switch(_0x3b3597[_0xd341('0x1c8')]){case'dropRate':var _0x128c5b=_0x3b3597['dialPredictiveOptimizationPercentage']/0x64;return _0xe8ae66[_0xd341('0x1da')](_0x11fad6,_0x1eb674,_0x5e14e0,_0x406751,_0x128c5b)['then'](function(_0x314362){return _0x3b1dd1(_0x314362);});case _0xd341('0x1db'):var _0x462514=_0x3b3597[_0xd341('0x1dc')]/0x64;return _0xe8ae66[_0xd341('0x1dd')](_0x11fad6,_0x1eb674,_0x5e14e0,_0x406751,_0x462514)['then'](function(_0x172597){return _0x3b1dd1(_0x172597);});default:return _0x38bb6c(msgResponse(_0xd341('0x1de'),_0xd341('0x95'),'Unknown\x20Predictive'));}}else{return _0x38bb6c(msgResponse(_0xd341('0x1de'),_0xd341('0x95'),_0xd341('0x1df')));}});};};Dialer[_0xd341('0x1c')][_0xd341('0x1e0')]=function(_0x21daaf){var _0x3d4aa4=this;return function(_0x396035){return new Promise(function(_0xd43b02,_0x4a5e0f){_[_0xd341('0x153')](_0x21daaf,_0x396035[0x0]);if(checkGetDataPredictive(_0x396035[0x0])){loggerPredictive['info'](JSON[_0xd341('0x78')](_0x396035[0x0]));if(_0x21daaf[_0xd341('0x1c8')]===_0xd341('0x1c9')){return _0x3d4aa4[_0xd341('0x150')](_0x21daaf['id'])[_0xd341('0x41')](function(_0x232533){var _0x2eb177=_0x21daaf[_0xd341('0x1e1')]-_0x232533[0x0]['outboundQueuePauses'];var _0x251994=_0x21daaf[_0xd341('0x1d1')]*0x3c;var _0x241f9f=_0x396035[0x0][_0xd341('0x55')]+_0x396035[0x0][_0xd341('0x53')];var _0x4b44a5=(_0x396035[0x0]['predictiveIntervalAnsweredCalls']+_0x396035[0x0][_0xd341('0x50')]+_0x396035[0x0][_0xd341('0x52')])/_0x396035[0x0][_0xd341('0x4d')];var _0x1d33e5=_0x21daaf[_0xd341('0x1dc')]/0x64;_0x21daaf[_0xd341('0x1e2')]=_0x232533[0x0][_0xd341('0x1e3')]||0x0;_0x21daaf[_0xd341('0x1c1')]=_0x4b44a5>0x0?_0x4b44a5:0x1;return _0x3d4aa4[_0xd341('0x1da')](_0x2eb177,_0x251994,_0x241f9f,_0x4b44a5,_0x1d33e5);})[_0xd341('0x41')](function(_0x2241b6){return _0xd43b02(_0x2241b6);})[_0xd341('0xa5')](function(_0x422249){return _0x4a5e0f(msgResponse(_0xd341('0x1e4'),_0xd341('0x95'),JSON[_0xd341('0x78')](_0x422249)));});}if(_0x21daaf[_0xd341('0x1c8')]===_0xd341('0x1db')){return _0x3d4aa4[_0xd341('0x150')](_0x21daaf['id'])[_0xd341('0x41')](function(_0x340034){var _0xe0f593=_0x21daaf[_0xd341('0x1e1')]-_0x340034[0x0]['outboundQueuePauses'];var _0x47a82d=_0x21daaf[_0xd341('0x1d1')]*0x3c;var _0x68c203=_0x396035[0x0][_0xd341('0x55')]+_0x396035[0x0][_0xd341('0x53')];var _0x5c7af1=(_0x396035[0x0][_0xd341('0x4e')]+_0x396035[0x0][_0xd341('0x50')]+_0x396035[0x0][_0xd341('0x52')])/_0x396035[0x0]['predictiveIntervalTotalCalls'];var _0x16edaa=_0x21daaf[_0xd341('0x1dc')]/0x64;_0x21daaf[_0xd341('0x1e2')]=_0x340034[0x0]['outboundQueuePauses']||0x0;_0x21daaf['predictiveIntervalHitRate']=_0x5c7af1>0x0?_0x5c7af1:0x1;return _0x3d4aa4['busyFactor'](_0xe0f593,_0x47a82d,_0x68c203,_0x5c7af1,_0x16edaa);})['then'](function(_0x178f18){return _0xd43b02(_0x178f18);})[_0xd341('0xa5')](function(_0x285969){return _0x4a5e0f(msgResponse('[CatchErlangB]',_0xd341('0x95'),JSON[_0xd341('0x78')](_0x285969)));});}}else{return _0x4a5e0f(msgResponse('[getDataPredictive]','Failure',_0xd341('0x1df')));}});};};Dialer['prototype'][_0xd341('0x1d5')]=function(_0x129e59){var _0x11ec23=this;return function(){var _0x240946=0x0;var _0x27f68d=Math[_0xd341('0x1c0')](_0x129e59[_0xd341('0x1e5')]*0x3e8);if(_0x27f68d>0x0){_0x27f68d=_0x27f68d<0x64?0x64:_0x27f68d;loggerPredictive['info'](_0x129e59['name'],'one\x20call\x20every:',_0x27f68d,'milliseconds');_0x129e59[_0xd341('0x1c3')]=setInterval(function(){_0x11ec23[_0xd341('0x1c3')](_0x129e59);loggerPredictiveCalls[_0xd341('0x4b')]('[handlePredictive]',_0x240946+=0x1);},_0x27f68d);}else{loggerPredictive[_0xd341('0x4b')](_0x129e59[_0xd341('0x65')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xd341('0x1c')][_0xd341('0x1e6')]=function(_0x215024,_0x13ba10){var _0x44c00c=this;return function(_0x25bfb3){if(_[_0xd341('0x7d')](_0x25bfb3)){if(_[_0xd341('0xf9')](_0x13ba10[_0xd341('0x154')])||!_0x13ba10[_0xd341('0x1e7')]){if(_0x215024[_0xd341('0xb6')]==='booked'){_0x215024[_0xd341('0x75')]=_['isUndefined'](_0x215024['queueStatusComplete'])?!![]:_0x215024[_0xd341('0x75')];var _0x2aa634=uuid['v4']();_0x44c00c[_0xd341('0x27')][_0x2aa634]=new Action(_0x215024,_0x13ba10,_0x2aa634);loggerBooked['info'](_0xd341('0x1e8'),_0x2aa634,'queueStatusComplete:\x20',JSON[_0xd341('0x78')](_0x215024[_0xd341('0x75')]),'Queue:\x20',_0x215024[_0xd341('0x65')]);if(_0x215024[_0xd341('0x75')]){_0x215024['queueStatusComplete']=![];_0x44c00c[_0xd341('0x2d')][_0x44c00c[_0xd341('0x27')][_0x2aa634]['queue']]=[];ami['Action']({'actionid':_0x2aa634,'action':'queuestatus','queue':_0x215024[_0xd341('0x65')]})['catch'](function(){_0x44c00c[_0xd341('0xd1')](_0x215024);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x44c00c[_0xd341('0x27')][_0x2aa634][_0xd341('0xe2')],'ListId':_0x44c00c[_0xd341('0x27')][_0x2aa634][_0xd341('0xf1')],'VoiceQueueId':_0x44c00c[_0xd341('0x27')][_0x2aa634][_0xd341('0xe3')]||undefined,'CampaignId':_0x44c00c[_0xd341('0x27')][_0x2aa634][_0xd341('0xe4')]||undefined})[_0xd341('0xa5')](loggerCatch(_0xd341('0x1e9')));delete _0x44c00c[_0xd341('0x27')][_0x2aa634];});}else{loggerBooked[_0xd341('0x4b')](_0xd341('0x1ea'),JSON[_0xd341('0x78')](_0x215024[_0xd341('0x75')]),_0xd341('0x1eb'),_0x215024[_0xd341('0x65')]);_0x44c00c[_0xd341('0xd1')](_0x215024);hopperUtils[_0xd341('0xdf')]({'active':![],'ContactId':_0x44c00c[_0xd341('0x27')][_0x2aa634][_0xd341('0xe2')],'ListId':_0x44c00c[_0xd341('0x27')][_0x2aa634]['ListId'],'VoiceQueueId':_0x44c00c[_0xd341('0x27')][_0x2aa634][_0xd341('0xe3')]||undefined,'CampaignId':_0x44c00c[_0xd341('0x27')][_0x2aa634][_0xd341('0xe4')]||undefined})[_0xd341('0xa5')](loggerCatch(_0xd341('0x1e9')));delete _0x44c00c[_0xd341('0x27')][_0x2aa634];}}else{return _0x44c00c[_0xd341('0x1ec')](_0x215024,_0x13ba10);}}else{if(utils[_0xd341('0x63')](undefined,_0x13ba10['scheduledat'])<_0x215024['dialRecallMeTimeout']*0x3c){if(_0x13ba10[_0xd341('0x14b')]&&!_0x13ba10[_0xd341('0x14b')][_0xd341('0x1ed')]){_0x44c00c[_0xd341('0x21')][_0xd341('0xfd')](_0x13ba10['id'])[_0xd341('0x1f')](function(){_0x44c00c[_0xd341('0xd1')](_0x215024);});}else{hopperUtils[_0xd341('0x1ee')]({'active':![]},_0x13ba10['id'],0x1)[_0xd341('0x1f')](function(){_0x44c00c[_0xd341('0xd1')](_0x215024);});}}else{_0x215024[_0xd341('0x1ef')]+=0x1;_0x44c00c['updateOriginated'](_0x215024);if(_0x215024[_0xd341('0x1f0')]){hopperUtils[_0xd341('0xdf')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x13ba10[_0xd341('0xe2')],'ListId':_0x13ba10[_0xd341('0xf1')],'VoiceQueueId':_0x13ba10[_0xd341('0xe3')]||undefined,'CampaignId':_0x13ba10['CampaignId']||undefined})[_0xd341('0xa5')](loggerCatch(_0xd341('0x1f1')));hopperUtils[_0xd341('0xe8')](createObjHistory(_0x215024,_0x13ba10,utils[_0xd341('0x71')][_0xd341('0x1f2')],0x17,'RecallInQueue'))[_0xd341('0xa5')](loggerCatch(_0xd341('0x1f3')));}else{_0x44c00c[_0xd341('0x11c')](createObjHistory(_0x215024,_0x13ba10,utils['CAMPAIGN_STATUS'][_0xd341('0x1f4')],0x16,_0xd341('0x1f5')),_0xd341('0x1f6'),'[Originate][HistoryRecallClose]');}}}}else{_0x215024[_0xd341('0x1f7')]+=0x1;_0x44c00c[_0xd341('0x11c')](createObjHistory(_0x215024,_0x13ba10,utils[_0xd341('0x71')][_0xd341('0x1f8')],0xd,_0xd341('0x1f9')),_0xd341('0x1fa'),_0xd341('0x1fb'));throw'inBlackList';}};};Dialer[_0xd341('0x1c')][_0xd341('0x158')]=function(_0x11905e){var _0x28e461=this;var _0x421e8b=_0x11905e[_0xd341('0x1fc')]-_0x11905e['originated']-_0x11905e[_0xd341('0x1fd')];emitCampaignSummary(_0x11905e);if(_0x421e8b>0x0){if(_0x421e8b>this[_0xd341('0x25')]){_0x421e8b=this['maxNumberOriginate'];}_0x11905e[_0xd341('0x1fd')]+=_0x421e8b;hopperUtils[_0xd341('0x1fe')](_0x11905e['id'],_0x421e8b,_0x11905e['dialOrderByScheduledAt'],_0x11905e)['then'](function(_0x5e7ad9){_0x11905e['temp']-=_0x421e8b;_0x11905e[_0xd341('0x1fd')]=_0x11905e['temp']>0x0?_0x11905e[_0xd341('0x1fd')]:0x0;if(!utils[_0xd341('0x1ff')](_0x5e7ad9)){_0x11905e[_0xd341('0x6d')]=utils['CAMPAIGN_STATUS'][_0xd341('0x200')];logger[_0xd341('0x4b')](_0xd341('0x201')+_0x11905e['name']);}else{_0x11905e[_0xd341('0x82')]+=_0x5e7ad9[_0xd341('0x9c')];_0x11905e[_0xd341('0x6d')]=utils['CAMPAIGN_STATUS'][_0xd341('0x202')];for(var _0x493a41=0x0;_0x493a41<_0x5e7ad9[_0xd341('0x9c')];_0x493a41+=0x1){_0x11905e['ivrTotalCallsDays']+=0x1;if(_[_0xd341('0xf9')](_0x5e7ad9[_0x493a41])||_['isNil'](_0x5e7ad9[_0x493a41][_0xd341('0x173')])||_[_0xd341('0xf9')](_0x5e7ad9[_0x493a41][_0xd341('0x15b')])){_0x28e461[_0xd341('0x203')](_0xd341('0x204'),_0x11905e,_0x5e7ad9[_0x493a41]);}else{hopperUtils[_0xd341('0x205')](_[_0xd341('0x79')](_0x5e7ad9[_0x493a41],[_0xd341('0xe4'),'phone']))[_0xd341('0x41')](_0x28e461[_0xd341('0x1e6')](_0x11905e,_0x5e7ad9[_0x493a41]))[_0xd341('0xa5')](_0x28e461[_0xd341('0x206')](_0xd341('0x207'),_0x11905e));}}}})[_0xd341('0xa5')](loggerGetContactDialer(_0xd341('0x208'),_0x11905e,_0x421e8b));}};Dialer[_0xd341('0x1c')][_0xd341('0xb7')]=function(_0x4599b6,_0x15c399){var _0x2cc516=this;var _0x23d13a=[];if(_0x15c399<0x1||_0x4599b6[_0xd341('0xb6')]==='booked'){_0x15c399=0x1;}var _0x208fa4=Math[_0xd341('0x1c0')](_0x4599b6[_0xd341('0x209')]*_0x15c399)-_0x4599b6[_0xd341('0x82')]-_0x4599b6[_0xd341('0x1fd')];if(_0x4599b6[_0xd341('0x20a')]>0x0){var _0x33f737=_0x4599b6[_0xd341('0x20a')]-_0x4599b6[_0xd341('0x82')]-_0x4599b6[_0xd341('0x13e')]-_0x4599b6[_0xd341('0x1fd')]-_0x4599b6['pTalking'];if(_0x208fa4>_0x33f737){_0x208fa4=_0x33f737;}}if(_0x208fa4>0x0){if(_0x4599b6[_0xd341('0xb6')]===_0xd341('0xba')){_0x208fa4=0x1;}if(_0x208fa4>this[_0xd341('0x25')]){_0x208fa4=this['maxNumberOriginate'];}_0x4599b6[_0xd341('0x1fd')]+=_0x208fa4;for(var _0x1f91ef in this['agents']){if(typeof this['agents'][_0x1f91ef]!==_0xd341('0xaf')){if(this[_0xd341('0xfa')][_0x1f91ef][_0xd341('0xd5')]===_0xd341('0x20b')&&this[_0xd341('0xfa')][_0x1f91ef]['status']===_0xd341('0x148')){_0x23d13a[_0xd341('0x9d')](this[_0xd341('0xfa')][_0x1f91ef]['id']);}}}hopperUtils['getContactDialer'](_0x4599b6,_0x23d13a,_0x208fa4)[_0xd341('0x41')](function(_0x1a093f){_0x4599b6[_0xd341('0x1fd')]-=_0x208fa4;_0x4599b6[_0xd341('0x1fd')]=_0x4599b6['temp']>0x0?_0x4599b6[_0xd341('0x1fd')]:0x0;if(!utils[_0xd341('0x1ff')](_0x1a093f)){hopperUtils[_0xd341('0x20c')](_0x4599b6)[_0xd341('0x41')](sendMessageReschedule(_0x4599b6))[_0xd341('0xa5')](loggerCatch(_0xd341('0x20d')));}else{_0x4599b6[_0xd341('0x82')]+=_0x1a093f[_0xd341('0x9c')];_0x4599b6[_0xd341('0x6d')]=_0x4599b6[_0xd341('0xb6')]===_0xd341('0xba')?utils[_0xd341('0x71')]['ACTIVE']:utils[_0xd341('0x71')][_0xd341('0x202')];for(var _0x3a96da=0x0;_0x3a96da<_0x1a093f[_0xd341('0x9c')];_0x3a96da+=0x1){if(_[_0xd341('0xf9')](_0x1a093f[_0x3a96da])||_[_0xd341('0xf9')](_0x1a093f[_0x3a96da][_0xd341('0x173')])||_[_0xd341('0xf9')](_0x1a093f[_0x3a96da][_0xd341('0x15b')])){_0x2cc516['emptyContact'](_0xd341('0x204'),_0x4599b6,_0x1a093f[_0x3a96da]);}else{hopperUtils[_0xd341('0x20e')](_[_0xd341('0x79')](_0x1a093f[_0x3a96da],[_0xd341('0xe3'),'phone']))['then'](_0x2cc516[_0xd341('0x1e6')](_0x4599b6,_0x1a093f[_0x3a96da]))[_0xd341('0xa5')](_0x2cc516[_0xd341('0x206')]('[actionOriginate]\x20',_0x4599b6));}}}})[_0xd341('0xa5')](loggerGetContactDialer('[getContactDialer2]',_0x4599b6,_0x208fa4));}};Dialer[_0xd341('0x1c')]['handlePredictive']=function(_0x39cf66){if(_0x39cf66['dialLimitQueue']>0x0){var _0x521642=_0x39cf66[_0xd341('0x20a')]-_0x39cf66[_0xd341('0x82')]-_0x39cf66['talking'];if(_0x521642>0x0){this['tryOriginatePredictive'](_0x39cf66);}else{loggerPredictiveCalls[_0xd341('0x4b')]('[handlePredictive][limitChannel]');}}else{this[_0xd341('0x20f')](_0x39cf66);}};Dialer['prototype'][_0xd341('0x20f')]=function(_0x250f97){var _0x2a4a9b=this;var _0x3d3d1e=[];_0x250f97[_0xd341('0x82')]+=0x1;for(var _0x1bc4c9 in this[_0xd341('0xfa')]){if(typeof this[_0xd341('0xfa')][_0x1bc4c9]!==_0xd341('0xaf')){if(this[_0xd341('0xfa')][_0x1bc4c9][_0xd341('0xd5')]===_0xd341('0x20b')&&this[_0xd341('0xfa')][_0x1bc4c9][_0xd341('0x8c')]===_0xd341('0x148')){_0x3d3d1e['push'](this[_0xd341('0xfa')][_0x1bc4c9]['id']);}}}return this[_0xd341('0x210')](_0x250f97['id'],_0x3d3d1e,0x1,_0x250f97['dialOrderByScheduledAt'],_0x250f97)[_0xd341('0x41')](function(_0x45eeb1){if(!utils[_0xd341('0x1ff')](_0x45eeb1)){utils[_0xd341('0x6b')](_0x250f97,0x1,0x0);return hopperUtils['countReScheduled'](_0x250f97)[_0xd341('0x41')](sendMessageReschedule(_0x250f97))[_0xd341('0xa5')](loggerCatch('[countReScheduled]\x20'));}else{_0x250f97['message']=utils[_0xd341('0x71')][_0xd341('0x202')];if(_[_0xd341('0xf9')](_0x45eeb1[0x0])||_[_0xd341('0xf9')](_0x45eeb1[0x0][_0xd341('0x173')])||_['isNil'](_0x45eeb1[0x0][_0xd341('0x15b')])){_0x2a4a9b[_0xd341('0x203')](_0xd341('0x204'),_0x250f97,_0x45eeb1[0x0]);}else{return hopperUtils[_0xd341('0x20e')](_[_0xd341('0x79')](_0x45eeb1[0x0],[_0xd341('0xe3'),_0xd341('0x15b')]))['then'](_0x2a4a9b[_0xd341('0x1e6')](_0x250f97,_0x45eeb1[0x0]))[_0xd341('0xa5')](_0x2a4a9b['loggerHandler'](_0xd341('0x211'),_0x250f97));}}})[_0xd341('0xa5')](loggerGetContactDialer(_0xd341('0x212'),_0x250f97,0x1));};Dialer[_0xd341('0x1c')][_0xd341('0x1da')]=function(_0x5cc92f,_0x82c37b,_0x459a18,_0x407d0f,_0x3ffd25,_0x55ef63){loggerPredictive['info'](_0xd341('0x213'));loggerPredictive['info'](_0xd341('0x214'),_0x5cc92f);loggerPredictive[_0xd341('0x4b')](_0xd341('0x215'),_0x82c37b);loggerPredictive[_0xd341('0x4b')](_0xd341('0x216'),_0x459a18);loggerPredictive[_0xd341('0x4b')](_0xd341('0x217'),_0x407d0f);loggerPredictive[_0xd341('0x4b')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3ffd25);loggerPredictive[_0xd341('0x4b')](_0xd341('0x62'));return new Promise(function(_0x3ad183,_0x3bb009){if(_0x5cc92f<=0x0||isNaN(_0x5cc92f)){return _0x3bb009(msgResponse(_0xd341('0x218'),'Error',_0xd341('0x219')+_0x5cc92f));}if(_0x459a18<=0x0||isNaN(_0x459a18)){return _0x3bb009(msgResponse(_0xd341('0x218'),'Error','Ts\x20=\x20'+_0x459a18));}if(_0x407d0f<=0x0||isNaN(_0x407d0f)){return _0x3bb009(msgResponse(_0xd341('0x218'),'Error',_0xd341('0x21a')+_0x407d0f));}if(_0x82c37b<=0x0||isNaN(_0x82c37b)){return _0x3bb009(msgResponse('[abandonmentRate]',_0xd341('0x88'),_0xd341('0x21b')+_0x82c37b));}if(_0x3ffd25<=0x0||isNaN(_0x3ffd25)){return _0x3bb009(msgResponse('[abandonmentRate]','Error',_0xd341('0x21c')+_0x3ffd25));}_0x55ef63=_0x55ef63||0x0;var _0x22907d=0x1/_0x459a18;var _0x8ce297=0x0;var _0x3258ee=0x0;var _0x2e93a5=0x0;var _0x14b009=0x0;for(var _0x3ac485=0x0;_0x2e93a5<_0x3ffd25;_0x3ac485+=0x1){_0x3258ee=_0x3ac485/_0x82c37b;_0x8ce297=(_0x407d0f*_0x3258ee+_0x55ef63)/_0x22907d;_0x2e93a5=utils[_0xd341('0x21d')](_0x8ce297,_0x5cc92f);_0x14b009=_0x8ce297/_0x5cc92f*(0x1-utils[_0xd341('0x21d')](_0x8ce297,_0x5cc92f));}return _0x3ad183({'erlangCalls':_0x3ac485,'erlangCallToSecond':_0x82c37b/_0x3ac485,'erlangAbandonmentRate':_0x2e93a5,'erlangBusyFactor':_0x14b009});});};Dialer[_0xd341('0x1c')][_0xd341('0x1dd')]=function(_0x23c9db,_0x3b3255,_0xbd269f,_0x183e84,_0x382e02,_0x156e1b){loggerPredictive['info'](_0xd341('0x21e'));loggerPredictive[_0xd341('0x4b')](_0xd341('0x214'),_0x23c9db);loggerPredictive[_0xd341('0x4b')](_0xd341('0x215'),_0x3b3255);loggerPredictive[_0xd341('0x4b')](_0xd341('0x216'),_0xbd269f);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x183e84);loggerPredictive[_0xd341('0x4b')](_0xd341('0x21f'),_0x382e02);loggerPredictive[_0xd341('0x4b')]('---------------------------');return new Promise(function(_0x52b8a0,_0x47b177){if(_0x23c9db<=0x0||isNaN(_0x23c9db)){return _0x47b177(msgResponse(_0xd341('0x220'),_0xd341('0x88'),_0xd341('0x219')+_0x23c9db));}if(_0xbd269f<=0x0||isNaN(_0xbd269f)){return _0x47b177(msgResponse(_0xd341('0x220'),'Error',_0xd341('0x221')+_0xbd269f));}if(_0x183e84<=0x0||isNaN(_0x183e84)){return _0x47b177(msgResponse('[busyFactor]',_0xd341('0x88'),_0xd341('0x21a')+_0x183e84));}if(_0x3b3255<=0x0||isNaN(_0x3b3255)){return _0x47b177(msgResponse(_0xd341('0x220'),_0xd341('0x88'),'interval\x20=\x20'+_0x3b3255));}if(_0x382e02<=0x0||isNaN(_0x382e02)){return _0x47b177(msgResponse(_0xd341('0x220'),_0xd341('0x88'),_0xd341('0x222')+_0x382e02));}_0x156e1b=_0x156e1b||0x0;var _0x2e9c44=0x1/_0xbd269f;var _0x4b318a=0x0;var _0x2e1320=0x0;var _0x200675=0x0;var _0x18b093=0x0;for(var _0x16e83d=0x0;_0x18b093<_0x382e02;_0x16e83d+=0x1){_0x2e1320=_0x16e83d/_0x3b3255;_0x4b318a=(_0x183e84*_0x2e1320+_0x156e1b)/_0x2e9c44;_0x200675=utils['erlangb'](_0x4b318a,_0x23c9db);_0x18b093=_0x4b318a/_0x23c9db*(0x1-utils[_0xd341('0x21d')](_0x4b318a,_0x23c9db));}return _0x52b8a0({'erlangCalls':_0x16e83d,'erlangCallToSecond':_0x3b3255/_0x16e83d,'erlangAbandonmentRate':_0x200675,'erlangBusyFactor':_0x18b093});});};module['exports']=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 1260eea..289e983 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 _0x4d90=['voiceQueue','name','Contact','firstName','lastName','number','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','prototype','exports','lodash','isNil','string'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4d90,0x1a1));var _0x04d9=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x4d90[_0x376b45];return _0x2341b3;};'use strict';var util=require('util');var _=require(_0x04d9('0x0'));var moment=require('moment');function checkNameSurname(_0x12ad66,_0x8c1bd0,_0x54d57b){var _0x4f0d1f='';if(!_[_0x04d9('0x1')](_0x8c1bd0)&&'string'===typeof _0x8c1bd0){_0x4f0d1f+=_0x8c1bd0;}if(!_[_0x04d9('0x1')](_0x54d57b)&&_0x04d9('0x2')===typeof _0x54d57b){_0x4f0d1f+='\x20'+_0x54d57b;}if(_0x4f0d1f!==''){return _0x4f0d1f;}return _0x12ad66;}function Action(_0xbba453,_0x41259c,_0x1d42d8){this[_0x04d9('0x3')]=_0xbba453;this['uniqueid']=_0x1d42d8||undefined;this[_0x04d9('0x4')]=checkNameSurname(_0x41259c[_0x04d9('0x5')]['phone'],_0x41259c[_0x04d9('0x5')][_0x04d9('0x6')],_0x41259c['Contact'][_0x04d9('0x7')]);this[_0x04d9('0x8')]=_0x41259c[_0x04d9('0x9')];this[_0x04d9('0xa')]=_0xbba453[_0x04d9('0x4')];this[_0x04d9('0xb')]=_0x41259c[_0x04d9('0xb')]||![];this[_0x04d9('0xc')]=_0xbba453['type'];this[_0x04d9('0xd')]=_0xbba453['dialQueueTimeout']||0x3;this[_0x04d9('0xe')]=_0x41259c[_0x04d9('0xe')];this[_0x04d9('0xf')]=_0x41259c[_0x04d9('0xf')];this['countcongestionretry']=_0x41259c[_0x04d9('0x10')];this[_0x04d9('0x11')]=_0x41259c[_0x04d9('0x11')];this[_0x04d9('0x12')]=_0x41259c[_0x04d9('0x12')];this[_0x04d9('0x13')]=_0x41259c['countdropretry'];this[_0x04d9('0x14')]=_0x41259c[_0x04d9('0x14')];this['countmachineretry']=_0x41259c[_0x04d9('0x15')];this[_0x04d9('0x16')]=_0x41259c['countagentrejectretry'];this[_0x04d9('0x17')]=_0x41259c['ContactId'];this['ListId']=_0x41259c['ListId'];this[_0x04d9('0x18')]=_0x41259c[_0x04d9('0x18')];this[_0x04d9('0x19')]=_0x41259c[_0x04d9('0x19')];this[_0x04d9('0x1a')]=_0x41259c['CampaignId'];this[_0x04d9('0x1b')]=_0x41259c['id'];this[_0x04d9('0x1c')]=_0x41259c['Contact'][_0x04d9('0x6')]||'';this[_0x04d9('0x1d')]=moment()['format'](_0x04d9('0x1e'));this[_0x04d9('0x1f')]=_0x41259c[_0x04d9('0x1f')];this[_0x04d9('0x20')]=_0x41259c[_0x04d9('0x20')];this[_0x04d9('0x21')]=_0x41259c[_0x04d9('0x21')];this['recallme']=_0x41259c[_0x04d9('0x22')];this[_0x04d9('0x23')]='';this['originatecalleridname']='';}Action['prototype'][_0x04d9('0x24')]=function(){return util[_0x04d9('0x25')](_0x04d9('0x26'),this[_0x04d9('0x4')],this[_0x04d9('0x3')][_0x04d9('0x27')]>0x0?this['number']['substring'](this[_0x04d9('0x3')][_0x04d9('0x27')]):this['number']);};Action[_0x04d9('0x28')]['getQueue']=function(){return this[_0x04d9('0xa')];};module[_0x04d9('0x29')]=Action; \ No newline at end of file +var _0xfe41=['originatecalleridname','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','prototype','getQueue','queue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','ContactId','ListId','UserId','CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme'];(function(_0x435df5,_0x405a75){var _0x14576f=function(_0x38b625){while(--_0x38b625){_0x435df5['push'](_0x435df5['shift']());}};_0x14576f(++_0x405a75);}(_0xfe41,0x169));var _0x1fe4=function(_0x338a58,_0x2d5ac5){_0x338a58=_0x338a58-0x0;var _0x92bd1d=_0xfe41[_0x338a58];return _0x92bd1d;};'use strict';var util=require(_0x1fe4('0x0'));var _=require(_0x1fe4('0x1'));var moment=require(_0x1fe4('0x2'));function checkNameSurname(_0x5c1de3,_0x393aca,_0x2ccbde){var _0x4ab231='';if(!_[_0x1fe4('0x3')](_0x393aca)&&_0x1fe4('0x4')===typeof _0x393aca){_0x4ab231+=_0x393aca;}if(!_[_0x1fe4('0x3')](_0x2ccbde)&&_0x1fe4('0x4')===typeof _0x2ccbde){_0x4ab231+='\x20'+_0x2ccbde;}if(_0x4ab231!==''){return _0x4ab231;}return _0x5c1de3;}function Action(_0x882322,_0x4ff7ec,_0x4cfc07){this[_0x1fe4('0x5')]=_0x882322;this[_0x1fe4('0x6')]=_0x4cfc07||undefined;this[_0x1fe4('0x7')]=checkNameSurname(_0x4ff7ec[_0x1fe4('0x8')][_0x1fe4('0x9')],_0x4ff7ec[_0x1fe4('0x8')]['firstName'],_0x4ff7ec[_0x1fe4('0x8')][_0x1fe4('0xa')]);this[_0x1fe4('0xb')]=_0x4ff7ec['phone'];this['queue']=_0x882322[_0x1fe4('0x7')];this['active']=_0x4ff7ec[_0x1fe4('0xc')]||![];this[_0x1fe4('0xd')]=_0x882322['type'];this[_0x1fe4('0xe')]=_0x882322[_0x1fe4('0xe')]||0x3;this[_0x1fe4('0xf')]=_0x4ff7ec[_0x1fe4('0xf')];this['countbusyretry']=_0x4ff7ec[_0x1fe4('0x10')];this[_0x1fe4('0x11')]=_0x4ff7ec['countcongestionretry'];this[_0x1fe4('0x12')]=_0x4ff7ec[_0x1fe4('0x12')];this[_0x1fe4('0x13')]=_0x4ff7ec[_0x1fe4('0x13')];this[_0x1fe4('0x14')]=_0x4ff7ec['countdropretry'];this[_0x1fe4('0x15')]=_0x4ff7ec[_0x1fe4('0x15')];this[_0x1fe4('0x16')]=_0x4ff7ec['countmachineretry'];this['countagentrejectretry']=_0x4ff7ec['countagentrejectretry'];this[_0x1fe4('0x17')]=_0x4ff7ec[_0x1fe4('0x17')];this[_0x1fe4('0x18')]=_0x4ff7ec[_0x1fe4('0x18')];this[_0x1fe4('0x19')]=_0x4ff7ec[_0x1fe4('0x19')];this['VoiceQueueId']=_0x4ff7ec['VoiceQueueId'];this[_0x1fe4('0x1a')]=_0x4ff7ec['CampaignId'];this[_0x1fe4('0x1b')]=_0x4ff7ec['id'];this[_0x1fe4('0x1c')]=_0x4ff7ec[_0x1fe4('0x8')]['firstName']||'';this[_0x1fe4('0x1d')]=moment()['format'](_0x1fe4('0x1e'));this[_0x1fe4('0x1f')]=_0x4ff7ec['callback'];this[_0x1fe4('0x20')]=_0x4ff7ec[_0x1fe4('0x20')];this[_0x1fe4('0x21')]=_0x4ff7ec[_0x1fe4('0x21')];this[_0x1fe4('0x22')]=_0x4ff7ec[_0x1fe4('0x22')];this['originatecalleridnum']='';this[_0x1fe4('0x23')]='';}Action['prototype'][_0x1fe4('0x24')]=function(){return util[_0x1fe4('0x25')](_0x1fe4('0x26'),this[_0x1fe4('0x7')],this['voiceQueue'][_0x1fe4('0x27')]>0x0?this[_0x1fe4('0xb')]['substring'](this[_0x1fe4('0x5')]['dialCutDigit']):this[_0x1fe4('0xb')]);};Action[_0x1fe4('0x28')][_0x1fe4('0x29')]=function(){return this[_0x1fe4('0x2a')];};module[_0x1fe4('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 22372a0..c7feea3 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 _0xa908=['answertime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime'];(function(_0x46729c,_0x948b04){var _0x2318c6=function(_0x5d9190){while(--_0x5d9190){_0x46729c['push'](_0x46729c['shift']());}};_0x2318c6(++_0x948b04);}(_0xa908,0x1f4));var _0x8a90=function(_0x48c9b3,_0x1fb678){_0x48c9b3=_0x48c9b3-0x0;var _0x4c782f=_0xa908[_0x48c9b3];return _0x4c782f;};'use strict';var moment=require('moment');var utils=require('../utils');function AgentComplete(_0x2da4aa,_0x22fa95){this[_0x8a90('0x0')]=0x4;this[_0x8a90('0x1')]=_0x8a90('0x2');this[_0x8a90('0x3')]=_0x2da4aa[_0x8a90('0x3')];this['type']=_0x2da4aa[_0x8a90('0x4')];this[_0x8a90('0x5')]=_0x2da4aa['type']===_0x8a90('0x6')?_0x8a90('0x7'):_0x2da4aa[_0x8a90('0x4')];this[_0x8a90('0x8')]=_0x2da4aa[_0x8a90('0x8')];this[_0x8a90('0x9')]=_0x2da4aa[_0x8a90('0x9')];this[_0x8a90('0xa')]=_0x2da4aa[_0x8a90('0xa')];this[_0x8a90('0xb')]=_0x2da4aa['countbusyretry']+_0x2da4aa[_0x8a90('0x9')]+_0x2da4aa['countnoanswerretry']+_0x2da4aa[_0x8a90('0xc')]+_0x2da4aa['countdropretry']+_0x2da4aa[_0x8a90('0xd')]+_0x2da4aa[_0x8a90('0xe')]+_0x2da4aa[_0x8a90('0xf')];this[_0x8a90('0xc')]=_0x2da4aa['countnosuchnumberretry'];this[_0x8a90('0x10')]=_0x2da4aa[_0x8a90('0x10')];this['countabandonedretry']=_0x2da4aa['countabandonedretry'];this[_0x8a90('0xe')]=_0x2da4aa[_0x8a90('0xe')];this['countagentrejectretry']=_0x2da4aa['countagentrejectretry'];this[_0x8a90('0x11')]=_0x22fa95[_0x8a90('0x11')];this[_0x8a90('0x12')]=_0x2da4aa[_0x8a90('0x13')];this[_0x8a90('0x14')]=_0x2da4aa['number'];this[_0x8a90('0x15')]=_0x2da4aa[_0x8a90('0x15')];this[_0x8a90('0x16')]=_0x2da4aa[_0x8a90('0x16')];this['answertime']=_0x2da4aa['answertime'];this[_0x8a90('0x17')]=moment()['format'](_0x8a90('0x18'));this[_0x8a90('0x19')]=utils[_0x8a90('0x1a')](_0x2da4aa[_0x8a90('0x16')],_0x2da4aa[_0x8a90('0x15')]);this['holdtime']=utils[_0x8a90('0x1a')](_0x2da4aa['answertime'],_0x2da4aa[_0x8a90('0x16')]);this[_0x8a90('0x1b')]=utils['getSeconds'](this[_0x8a90('0x17')],_0x2da4aa[_0x8a90('0x1c')]);this[_0x8a90('0x7')]=_0x22fa95[_0x8a90('0x7')];this[_0x8a90('0x1d')]=_0x22fa95[_0x8a90('0x1d')];this['reason']=_0x22fa95[_0x8a90('0x1e')];this[_0x8a90('0x1f')]=_0x2da4aa[_0x8a90('0x1f')];this['callbackuniqueid']=_0x2da4aa[_0x8a90('0x20')];this[_0x8a90('0x21')]=_0x2da4aa[_0x8a90('0x21')];this[_0x8a90('0x22')]=_0x2da4aa[_0x8a90('0x22')];this['ContactId']=_0x2da4aa[_0x8a90('0x23')];this['ListId']=_0x2da4aa[_0x8a90('0x24')];this[_0x8a90('0x25')]=_0x2da4aa[_0x8a90('0x25')];this[_0x8a90('0x26')]=_0x2da4aa[_0x8a90('0x26')];this['CampaignId']=_0x2da4aa[_0x8a90('0x27')];this[_0x8a90('0x28')]=_0x2da4aa[_0x8a90('0x28')]||'';this[_0x8a90('0x29')]=_0x2da4aa[_0x8a90('0x29')]||'';this['agiafterat']=_0x2da4aa[_0x8a90('0x2a')];}module[_0x8a90('0x2b')]=AgentComplete; \ No newline at end of file +var _0x2419=['campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','statedesc','Answer','type'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2419,0xd3));var _0x9241=function(_0x521391,_0x4edca9){_0x521391=_0x521391-0x0;var _0x283148=_0x2419[_0x521391];return _0x283148;};'use strict';var moment=require('moment');var utils=require(_0x9241('0x0'));function AgentComplete(_0x511654,_0x3a7c36){this['state']=0x4;this[_0x9241('0x1')]=_0x9241('0x2');this['scheduledat']=_0x511654['scheduledat'];this['type']=_0x511654[_0x9241('0x3')];this[_0x9241('0x4')]=_0x511654[_0x9241('0x3')]===_0x9241('0x5')?_0x9241('0x6'):_0x511654[_0x9241('0x3')];this[_0x9241('0x7')]=_0x511654[_0x9241('0x7')];this[_0x9241('0x8')]=_0x511654[_0x9241('0x8')];this[_0x9241('0x9')]=_0x511654[_0x9241('0x9')];this['countglobal']=_0x511654[_0x9241('0x7')]+_0x511654[_0x9241('0x8')]+_0x511654[_0x9241('0x9')]+_0x511654[_0x9241('0xa')]+_0x511654[_0x9241('0xb')]+_0x511654[_0x9241('0xc')]+_0x511654['countmachineretry']+_0x511654['countagentrejectretry'];this[_0x9241('0xa')]=_0x511654['countnosuchnumberretry'];this[_0x9241('0xb')]=_0x511654[_0x9241('0xb')];this[_0x9241('0xc')]=_0x511654[_0x9241('0xc')];this[_0x9241('0xd')]=_0x511654[_0x9241('0xd')];this[_0x9241('0xe')]=_0x511654[_0x9241('0xe')];this[_0x9241('0xf')]=_0x3a7c36[_0x9241('0xf')];this[_0x9241('0x10')]=_0x511654[_0x9241('0x11')];this[_0x9241('0x12')]=_0x511654[_0x9241('0x13')];this[_0x9241('0x14')]=_0x511654[_0x9241('0x14')];this[_0x9241('0x15')]=_0x511654['responsetime'];this[_0x9241('0x16')]=_0x511654[_0x9241('0x16')];this[_0x9241('0x17')]=moment()[_0x9241('0x18')](_0x9241('0x19'));this[_0x9241('0x1a')]=utils[_0x9241('0x1b')](_0x511654[_0x9241('0x15')],_0x511654[_0x9241('0x14')]);this[_0x9241('0x1c')]=utils[_0x9241('0x1b')](_0x511654[_0x9241('0x16')],_0x511654['responsetime']);this['talktime']=utils[_0x9241('0x1b')](this[_0x9241('0x17')],_0x511654[_0x9241('0x16')]);this[_0x9241('0x6')]=_0x3a7c36[_0x9241('0x6')];this[_0x9241('0x1d')]=_0x3a7c36[_0x9241('0x1d')];this[_0x9241('0x1e')]=_0x3a7c36[_0x9241('0x1e')];this[_0x9241('0x1f')]=_0x511654['callback'];this[_0x9241('0x20')]=_0x511654[_0x9241('0x20')];this[_0x9241('0x21')]=_0x511654[_0x9241('0x21')];this[_0x9241('0x22')]=_0x511654[_0x9241('0x22')];this['ContactId']=_0x511654[_0x9241('0x23')];this['ListId']=_0x511654['ListId'];this[_0x9241('0x24')]=_0x511654['UserId'];this[_0x9241('0x25')]=_0x511654[_0x9241('0x25')];this[_0x9241('0x26')]=_0x511654[_0x9241('0x26')];this[_0x9241('0x27')]=_0x511654[_0x9241('0x27')]||'';this[_0x9241('0x28')]=_0x511654[_0x9241('0x28')]||'';this[_0x9241('0x29')]=_0x511654['agiafterat'];}module[_0x9241('0x2a')]=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 4d7127d..27f66db 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 _0x0909=['calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','statedesc','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname'];(function(_0x3d7e48,_0x41acda){var _0x594bd8=function(_0x49a79e){while(--_0x49a79e){_0x3d7e48['push'](_0x3d7e48['shift']());}};_0x594bd8(++_0x41acda);}(_0x0909,0xf9));var _0x9090=function(_0x333d45,_0x580c57){_0x333d45=_0x333d45-0x0;var _0x32cb6c=_0x0909[_0x333d45];return _0x32cb6c;};'use strict';function Final(_0x1733b5){this[_0x9090('0x0')]=_0x1733b5['uniqueid'];this[_0x9090('0x1')]=_0x1733b5[_0x9090('0x1')];this[_0x9090('0x2')]=_0x1733b5['type'];this['campaigntype']=_0x1733b5[_0x9090('0x2')]===_0x9090('0x3')?_0x9090('0x4'):_0x1733b5[_0x9090('0x2')];this[_0x9090('0x5')]=_0x1733b5[_0x9090('0x5')];this[_0x9090('0x6')]=_0x1733b5[_0x9090('0x6')];this['countnoanswerretry']=_0x1733b5[_0x9090('0x7')];this[_0x9090('0x8')]=_0x1733b5[_0x9090('0x5')]+_0x1733b5['countcongestionretry']+_0x1733b5[_0x9090('0x7')]+_0x1733b5[_0x9090('0x9')]+_0x1733b5[_0x9090('0xa')]+_0x1733b5['countabandonedretry']+_0x1733b5[_0x9090('0xb')]+_0x1733b5[_0x9090('0xc')];this[_0x9090('0x9')]=_0x1733b5[_0x9090('0x9')];this['countdropretry']=_0x1733b5['countdropretry'];this[_0x9090('0xd')]=_0x1733b5[_0x9090('0xd')];this[_0x9090('0xb')]=_0x1733b5[_0x9090('0xb')];this[_0x9090('0xc')]=_0x1733b5[_0x9090('0xc')];this[_0x9090('0x4')]=_0x1733b5[_0x9090('0x4')];this[_0x9090('0xe')]=_0x1733b5[_0x9090('0xe')];this[_0x9090('0xf')]=_0x1733b5[_0x9090('0xf')];this[_0x9090('0x10')]=_0x1733b5[_0x9090('0x10')];this[_0x9090('0x11')]=_0x1733b5[_0x9090('0x11')];this[_0x9090('0x12')]=_0x1733b5['responsetime'];this[_0x9090('0x13')]=_0x1733b5[_0x9090('0x13')]||0x0;this['holdtime']=_0x1733b5[_0x9090('0x14')]||0x0;this[_0x9090('0x15')]=_0x1733b5[_0x9090('0x15')]||0x0;this[_0x9090('0x16')]=_0x1733b5[_0x9090('0x16')];this['callbackuniqueid']=_0x1733b5['callbackuniqueid'];this['callbackat']=_0x1733b5[_0x9090('0x17')];this['recallme']=_0x1733b5[_0x9090('0x18')];this[_0x9090('0x19')]=_0x1733b5[_0x9090('0x19')];this['ListId']=_0x1733b5[_0x9090('0x1a')];this['UserId']=_0x1733b5[_0x9090('0x1b')];this[_0x9090('0x1c')]=_0x1733b5[_0x9090('0x1c')];this[_0x9090('0x1d')]=_0x1733b5[_0x9090('0x1d')];this[_0x9090('0x1e')]=_0x1733b5['originatecalleridnum']||'';this[_0x9090('0x1f')]=_0x1733b5[_0x9090('0x1f')]||'';this['state']=_0x1733b5['state'];this['statedesc']=_0x1733b5[_0x9090('0x20')];}module['exports']=Final; \ No newline at end of file +var _0xe272=['exports','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc'];(function(_0x85d5a8,_0x1977be){var _0x20479b=function(_0x125248){while(--_0x125248){_0x85d5a8['push'](_0x85d5a8['shift']());}};_0x20479b(++_0x1977be);}(_0xe272,0x121));var _0x2e27=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xe272[_0xd1d19a];return _0x52a79d;};'use strict';function Final(_0x318779){this[_0x2e27('0x0')]=_0x318779[_0x2e27('0x0')];this[_0x2e27('0x1')]=_0x318779[_0x2e27('0x1')];this[_0x2e27('0x2')]=_0x318779['type'];this['campaigntype']=_0x318779[_0x2e27('0x2')]===_0x2e27('0x3')?_0x2e27('0x4'):_0x318779[_0x2e27('0x2')];this[_0x2e27('0x5')]=_0x318779[_0x2e27('0x5')];this[_0x2e27('0x6')]=_0x318779['countcongestionretry'];this['countnoanswerretry']=_0x318779['countnoanswerretry'];this[_0x2e27('0x7')]=_0x318779[_0x2e27('0x5')]+_0x318779['countcongestionretry']+_0x318779[_0x2e27('0x8')]+_0x318779[_0x2e27('0x9')]+_0x318779[_0x2e27('0xa')]+_0x318779['countabandonedretry']+_0x318779[_0x2e27('0xb')]+_0x318779[_0x2e27('0xc')];this[_0x2e27('0x9')]=_0x318779[_0x2e27('0x9')];this[_0x2e27('0xa')]=_0x318779[_0x2e27('0xa')];this['countabandonedretry']=_0x318779['countabandonedretry'];this[_0x2e27('0xb')]=_0x318779[_0x2e27('0xb')];this['countagentrejectretry']=_0x318779[_0x2e27('0xc')];this[_0x2e27('0x4')]=_0x318779[_0x2e27('0x4')];this[_0x2e27('0xd')]=_0x318779[_0x2e27('0xd')];this[_0x2e27('0xe')]=_0x318779[_0x2e27('0xe')];this['starttime']=_0x318779['starttime'];this[_0x2e27('0xf')]=_0x318779[_0x2e27('0xf')];this['endtime']=_0x318779['responsetime'];this[_0x2e27('0x10')]=_0x318779[_0x2e27('0x10')]||0x0;this['holdtime']=_0x318779[_0x2e27('0x11')]||0x0;this[_0x2e27('0x12')]=_0x318779[_0x2e27('0x12')]||0x0;this[_0x2e27('0x13')]=_0x318779[_0x2e27('0x13')];this[_0x2e27('0x14')]=_0x318779[_0x2e27('0x14')];this['callbackat']=_0x318779[_0x2e27('0x15')];this['recallme']=_0x318779['recallme'];this[_0x2e27('0x16')]=_0x318779[_0x2e27('0x16')];this[_0x2e27('0x17')]=_0x318779[_0x2e27('0x17')];this['UserId']=_0x318779[_0x2e27('0x18')];this[_0x2e27('0x19')]=_0x318779[_0x2e27('0x19')];this[_0x2e27('0x1a')]=_0x318779['CampaignId'];this[_0x2e27('0x1b')]=_0x318779[_0x2e27('0x1b')]||'';this[_0x2e27('0x1c')]=_0x318779[_0x2e27('0x1c')]||'';this[_0x2e27('0x1d')]=_0x318779['state'];this[_0x2e27('0x1e')]=_0x318779[_0x2e27('0x1e')];}module[_0x2e27('0x1f')]=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 17d5799..219a29c 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 _0x4cc8=['holdtime','talktime','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','moment','../utils','state','statedesc','scheduledat','type','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds'];(function(_0x9bce71,_0x49a3b4){var _0x5608bc=function(_0x479d2b){while(--_0x479d2b){_0x9bce71['push'](_0x9bce71['shift']());}};_0x5608bc(++_0x49a3b4);}(_0x4cc8,0x1bc));var _0x84cc=function(_0x30eac4,_0x4e589c){_0x30eac4=_0x30eac4-0x0;var _0x1b0d3e=_0x4cc8[_0x30eac4];return _0x1b0d3e;};'use strict';var moment=require(_0x84cc('0x0'));var utils=require(_0x84cc('0x1'));function Hangup(_0x49650c,_0x274d32){this[_0x84cc('0x2')]=0x4;this[_0x84cc('0x3')]='Answer';this[_0x84cc('0x4')]=_0x49650c[_0x84cc('0x4')];this[_0x84cc('0x5')]=_0x49650c[_0x84cc('0x5')];this['campaigntype']=_0x49650c[_0x84cc('0x5')]===_0x84cc('0x6')?_0x84cc('0x7'):_0x49650c[_0x84cc('0x5')];this['amd']=_0x49650c[_0x84cc('0x8')]||![];this[_0x84cc('0x9')]=_0x49650c[_0x84cc('0x9')];this['countcongestionretry']=_0x49650c[_0x84cc('0xa')];this[_0x84cc('0xb')]=_0x49650c[_0x84cc('0xb')];this[_0x84cc('0xc')]=_0x49650c[_0x84cc('0x9')]+_0x49650c[_0x84cc('0xa')]+_0x49650c[_0x84cc('0xb')]+_0x49650c[_0x84cc('0xd')]+_0x49650c[_0x84cc('0xe')]+_0x49650c[_0x84cc('0xf')]+_0x49650c[_0x84cc('0x10')]+_0x49650c[_0x84cc('0x11')];this[_0x84cc('0xd')]=_0x49650c[_0x84cc('0xd')];this[_0x84cc('0xe')]=_0x49650c['countdropretry'];this[_0x84cc('0xf')]=_0x49650c['countabandonedretry'];this[_0x84cc('0x10')]=_0x49650c[_0x84cc('0x10')];this[_0x84cc('0x11')]=_0x49650c['countagentrejectretry'];this['uniqueid']=_0x274d32[_0x84cc('0x12')];this[_0x84cc('0x13')]=_0x49650c[_0x84cc('0x14')];this['calleridnum']=_0x49650c[_0x84cc('0x15')];this['starttime']=_0x49650c[_0x84cc('0x16')];this[_0x84cc('0x17')]=_0x49650c['responsetime'];this[_0x84cc('0x18')]=moment()[_0x84cc('0x19')](_0x84cc('0x1a'));this[_0x84cc('0x1b')]=utils[_0x84cc('0x1c')](_0x49650c[_0x84cc('0x17')],_0x49650c['starttime']);this[_0x84cc('0x1d')]=0x0;this[_0x84cc('0x1e')]=utils['getSeconds'](this[_0x84cc('0x18')],_0x49650c['responsetime']);this[_0x84cc('0x7')]=_0x49650c[_0x84cc('0x7')];this['membername']=_0x84cc('0x1f');this[_0x84cc('0x20')]=_0x274d32[_0x84cc('0x21')];this[_0x84cc('0x22')]=_0x49650c[_0x84cc('0x22')];this[_0x84cc('0x23')]=_0x49650c[_0x84cc('0x23')];this[_0x84cc('0x24')]=_0x49650c['callbackat'];this[_0x84cc('0x25')]=_0x49650c[_0x84cc('0x25')];this[_0x84cc('0x26')]=_0x49650c[_0x84cc('0x26')];this[_0x84cc('0x27')]=_0x49650c[_0x84cc('0x27')];this['UserId']=_0x49650c[_0x84cc('0x28')];this['VoiceQueueId']=_0x49650c[_0x84cc('0x29')];this['CampaignId']=_0x49650c[_0x84cc('0x2a')];}module['exports']=Hangup; \ No newline at end of file +var _0xb8fb=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat'];(function(_0x32d414,_0x4d23da){var _0x4e0bca=function(_0x15d397){while(--_0x15d397){_0x32d414['push'](_0x32d414['shift']());}};_0x4e0bca(++_0x4d23da);}(_0xb8fb,0xb3));var _0xbb8f=function(_0x2c6c64,_0x59948e){_0x2c6c64=_0x2c6c64-0x0;var _0x40c118=_0xb8fb[_0x2c6c64];return _0x40c118;};'use strict';var moment=require(_0xbb8f('0x0'));var utils=require(_0xbb8f('0x1'));function Hangup(_0x1b4b3d,_0x3599c8){this[_0xbb8f('0x2')]=0x4;this[_0xbb8f('0x3')]=_0xbb8f('0x4');this[_0xbb8f('0x5')]=_0x1b4b3d['scheduledat'];this['type']=_0x1b4b3d[_0xbb8f('0x6')];this['campaigntype']=_0x1b4b3d[_0xbb8f('0x6')]==='outbound'?_0xbb8f('0x7'):_0x1b4b3d[_0xbb8f('0x6')];this[_0xbb8f('0x8')]=_0x1b4b3d[_0xbb8f('0x8')]||![];this[_0xbb8f('0x9')]=_0x1b4b3d['countbusyretry'];this[_0xbb8f('0xa')]=_0x1b4b3d[_0xbb8f('0xa')];this['countnoanswerretry']=_0x1b4b3d['countnoanswerretry'];this['countglobal']=_0x1b4b3d['countbusyretry']+_0x1b4b3d[_0xbb8f('0xa')]+_0x1b4b3d[_0xbb8f('0xb')]+_0x1b4b3d[_0xbb8f('0xc')]+_0x1b4b3d[_0xbb8f('0xd')]+_0x1b4b3d[_0xbb8f('0xe')]+_0x1b4b3d[_0xbb8f('0xf')]+_0x1b4b3d['countagentrejectretry'];this[_0xbb8f('0xc')]=_0x1b4b3d[_0xbb8f('0xc')];this[_0xbb8f('0xd')]=_0x1b4b3d[_0xbb8f('0xd')];this['countabandonedretry']=_0x1b4b3d[_0xbb8f('0xe')];this[_0xbb8f('0xf')]=_0x1b4b3d[_0xbb8f('0xf')];this['countagentrejectretry']=_0x1b4b3d[_0xbb8f('0x10')];this[_0xbb8f('0x11')]=_0x3599c8[_0xbb8f('0x11')];this[_0xbb8f('0x12')]=_0x1b4b3d[_0xbb8f('0x13')];this[_0xbb8f('0x14')]=_0x1b4b3d[_0xbb8f('0x15')];this['starttime']=_0x1b4b3d[_0xbb8f('0x16')];this[_0xbb8f('0x17')]=_0x1b4b3d[_0xbb8f('0x17')];this[_0xbb8f('0x18')]=moment()['format'](_0xbb8f('0x19'));this[_0xbb8f('0x1a')]=utils[_0xbb8f('0x1b')](_0x1b4b3d[_0xbb8f('0x17')],_0x1b4b3d[_0xbb8f('0x16')]);this[_0xbb8f('0x1c')]=0x0;this[_0xbb8f('0x1d')]=utils['getSeconds'](this[_0xbb8f('0x18')],_0x1b4b3d[_0xbb8f('0x17')]);this[_0xbb8f('0x7')]=_0x1b4b3d[_0xbb8f('0x7')];this['membername']=_0xbb8f('0x1e');this[_0xbb8f('0x1f')]=_0x3599c8[_0xbb8f('0x20')];this[_0xbb8f('0x21')]=_0x1b4b3d[_0xbb8f('0x21')];this[_0xbb8f('0x22')]=_0x1b4b3d['callbackuniqueid'];this[_0xbb8f('0x23')]=_0x1b4b3d[_0xbb8f('0x23')];this[_0xbb8f('0x24')]=_0x1b4b3d[_0xbb8f('0x24')];this[_0xbb8f('0x25')]=_0x1b4b3d[_0xbb8f('0x25')];this[_0xbb8f('0x26')]=_0x1b4b3d[_0xbb8f('0x26')];this[_0xbb8f('0x27')]=_0x1b4b3d[_0xbb8f('0x27')];this[_0xbb8f('0x28')]=_0x1b4b3d[_0xbb8f('0x28')];this['CampaignId']=_0x1b4b3d[_0xbb8f('0x29')];}module[_0xbb8f('0x2a')]=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 7705d64..7c712a0 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 _0x8e04=['UserId','CampaignId','originatecalleridnum','originatecalleridname','statedesc','exports','../utils','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','queue','calleridnum','number','starttime','responsetime','endtime','getSeconds','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x1bf89a,_0x2a2949){var _0x198910=function(_0x171142){while(--_0x171142){_0x1bf89a['push'](_0x1bf89a['shift']());}};_0x198910(++_0x2a2949);}(_0x8e04,0x116));var _0x48e0=function(_0x1e0499,_0x2222ed){_0x1e0499=_0x1e0499-0x0;var _0x527766=_0x8e04[_0x1e0499];return _0x527766;};'use strict';var utils=require(_0x48e0('0x0'));function History(_0x538247){this[_0x48e0('0x1')]=_0x538247[_0x48e0('0x1')];this[_0x48e0('0x2')]=_0x538247[_0x48e0('0x2')]||undefined;this['type']=_0x538247[_0x48e0('0x3')];this['campaigntype']=_0x538247[_0x48e0('0x3')]===_0x48e0('0x4')?'queue':_0x538247['type'];this['countbusyretry']=_0x538247[_0x48e0('0x5')];this[_0x48e0('0x6')]=_0x538247['countcongestionretry'];this[_0x48e0('0x7')]=_0x538247[_0x48e0('0x7')];this[_0x48e0('0x8')]=_0x538247[_0x48e0('0x5')]+_0x538247[_0x48e0('0x6')]+_0x538247[_0x48e0('0x7')]+_0x538247[_0x48e0('0x9')]+_0x538247[_0x48e0('0xa')]+_0x538247['countabandonedretry']+_0x538247[_0x48e0('0xb')]+_0x538247['countagentrejectretry'];this['countnosuchnumberretry']=_0x538247['countnosuchnumberretry'];this[_0x48e0('0xa')]=_0x538247['countdropretry'];this[_0x48e0('0xc')]=_0x538247[_0x48e0('0xc')];this[_0x48e0('0xb')]=_0x538247['countmachineretry'];this[_0x48e0('0xd')]=_0x538247[_0x48e0('0xd')];this[_0x48e0('0xe')]=_0x538247[_0x48e0('0xe')];this['calleridname']=_0x538247['name'];this[_0x48e0('0xf')]=_0x538247[_0x48e0('0x10')];this[_0x48e0('0x11')]=_0x538247[_0x48e0('0x11')];this[_0x48e0('0x12')]=_0x538247[_0x48e0('0x12')];this[_0x48e0('0x13')]=_0x538247[_0x48e0('0x12')];this['ringtime']=utils[_0x48e0('0x14')](_0x538247[_0x48e0('0x12')],_0x538247[_0x48e0('0x11')]);this['holdtime']=0x0;this[_0x48e0('0x15')]=0x0;this['callback']=_0x538247[_0x48e0('0x16')];this[_0x48e0('0x17')]=_0x538247[_0x48e0('0x17')];this['callbackat']=_0x538247[_0x48e0('0x18')];this[_0x48e0('0x19')]=_0x538247[_0x48e0('0x19')];this['ContactId']=_0x538247[_0x48e0('0x1a')];this[_0x48e0('0x1b')]=_0x538247['ListId'];this['UserId']=_0x538247[_0x48e0('0x1c')];this['VoiceQueueId']=_0x538247['VoiceQueueId'];this[_0x48e0('0x1d')]=_0x538247['CampaignId'];this[_0x48e0('0x1e')]=_0x538247[_0x48e0('0x1e')]||'';this[_0x48e0('0x1f')]=_0x538247[_0x48e0('0x1f')]||'';this['state']=_0x538247['state'];this[_0x48e0('0x20')]=_0x538247[_0x48e0('0x20')];}module[_0x48e0('0x21')]=History; \ No newline at end of file +var _0x56c7=['countagentrejectretry','countnosuchnumberretry','name','number','starttime','responsetime','endtime','ringtime','getSeconds','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countabandonedretry','countmachineretry'];(function(_0x3a49ed,_0x5942c0){var _0xfc681=function(_0x11d26b){while(--_0x11d26b){_0x3a49ed['push'](_0x3a49ed['shift']());}};_0xfc681(++_0x5942c0);}(_0x56c7,0x1d6));var _0x756c=function(_0x305b20,_0x5e57e9){_0x305b20=_0x305b20-0x0;var _0x26d64a=_0x56c7[_0x305b20];return _0x26d64a;};'use strict';var utils=require('../utils');function History(_0xce1ce8){this[_0x756c('0x0')]=_0xce1ce8[_0x756c('0x0')];this[_0x756c('0x1')]=_0xce1ce8['scheduledat']||undefined;this[_0x756c('0x2')]=_0xce1ce8['type'];this['campaigntype']=_0xce1ce8[_0x756c('0x2')]==='outbound'?_0x756c('0x3'):_0xce1ce8[_0x756c('0x2')];this['countbusyretry']=_0xce1ce8['countbusyretry'];this[_0x756c('0x4')]=_0xce1ce8[_0x756c('0x4')];this[_0x756c('0x5')]=_0xce1ce8[_0x756c('0x5')];this[_0x756c('0x6')]=_0xce1ce8[_0x756c('0x7')]+_0xce1ce8[_0x756c('0x4')]+_0xce1ce8[_0x756c('0x5')]+_0xce1ce8['countnosuchnumberretry']+_0xce1ce8['countdropretry']+_0xce1ce8[_0x756c('0x8')]+_0xce1ce8[_0x756c('0x9')]+_0xce1ce8[_0x756c('0xa')];this['countnosuchnumberretry']=_0xce1ce8[_0x756c('0xb')];this['countdropretry']=_0xce1ce8['countdropretry'];this[_0x756c('0x8')]=_0xce1ce8['countabandonedretry'];this[_0x756c('0x9')]=_0xce1ce8['countmachineretry'];this['countagentrejectretry']=_0xce1ce8[_0x756c('0xa')];this[_0x756c('0x3')]=_0xce1ce8[_0x756c('0x3')];this['calleridname']=_0xce1ce8[_0x756c('0xc')];this['calleridnum']=_0xce1ce8[_0x756c('0xd')];this[_0x756c('0xe')]=_0xce1ce8[_0x756c('0xe')];this['responsetime']=_0xce1ce8[_0x756c('0xf')];this[_0x756c('0x10')]=_0xce1ce8[_0x756c('0xf')];this[_0x756c('0x11')]=utils[_0x756c('0x12')](_0xce1ce8[_0x756c('0xf')],_0xce1ce8[_0x756c('0xe')]);this['holdtime']=0x0;this[_0x756c('0x13')]=0x0;this[_0x756c('0x14')]=_0xce1ce8[_0x756c('0x14')];this[_0x756c('0x15')]=_0xce1ce8['callbackuniqueid'];this['callbackat']=_0xce1ce8['callbackat'];this[_0x756c('0x16')]=_0xce1ce8[_0x756c('0x16')];this[_0x756c('0x17')]=_0xce1ce8[_0x756c('0x17')];this[_0x756c('0x18')]=_0xce1ce8['ListId'];this['UserId']=_0xce1ce8['UserId'];this[_0x756c('0x19')]=_0xce1ce8[_0x756c('0x19')];this[_0x756c('0x1a')]=_0xce1ce8[_0x756c('0x1a')];this[_0x756c('0x1b')]=_0xce1ce8['originatecalleridnum']||'';this[_0x756c('0x1c')]=_0xce1ce8[_0x756c('0x1c')]||'';this['state']=_0xce1ce8[_0x756c('0x1d')];this['statedesc']=_0xce1ce8[_0x756c('0x1e')];}module[_0x756c('0x1f')]=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 c05d249..366c07c 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 _0xff90=['campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','getSeconds','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xff90,0x7b));var _0x0ff9=function(_0x477c0c,_0x48b400){_0x477c0c=_0x477c0c-0x0;var _0x37d540=_0xff90[_0x477c0c];return _0x37d540;};'use strict';var utils=require(_0x0ff9('0x0'));function QueueCallerAbandon(_0x1878ea,_0x5c383a){this[_0x0ff9('0x1')]=_0x1878ea['scheduledat'];this[_0x0ff9('0x2')]=_0x1878ea['type'];this[_0x0ff9('0x3')]=_0x1878ea[_0x0ff9('0x2')]==='outbound'?_0x0ff9('0x4'):_0x1878ea[_0x0ff9('0x2')];this[_0x0ff9('0x5')]=_0x1878ea[_0x0ff9('0x5')];this[_0x0ff9('0x6')]=_0x1878ea[_0x0ff9('0x6')];this[_0x0ff9('0x7')]=_0x1878ea[_0x0ff9('0x7')];this[_0x0ff9('0x8')]=_0x1878ea[_0x0ff9('0x5')]+_0x1878ea[_0x0ff9('0x6')]+_0x1878ea[_0x0ff9('0x7')]+_0x1878ea[_0x0ff9('0x9')]+_0x1878ea[_0x0ff9('0xa')]+_0x1878ea['countabandonedretry']+_0x1878ea[_0x0ff9('0xb')]+_0x1878ea[_0x0ff9('0xc')];this[_0x0ff9('0x9')]=_0x1878ea[_0x0ff9('0x9')];this[_0x0ff9('0xa')]=_0x1878ea['countdropretry'];this[_0x0ff9('0xd')]=_0x1878ea['countabandonedretry'];this[_0x0ff9('0xb')]=_0x1878ea[_0x0ff9('0xb')];this[_0x0ff9('0xc')]=_0x1878ea[_0x0ff9('0xc')];this[_0x0ff9('0xe')]=_0x5c383a[_0x0ff9('0xe')];this[_0x0ff9('0xf')]=_0x1878ea[_0x0ff9('0x10')];this[_0x0ff9('0x11')]=_0x1878ea[_0x0ff9('0x12')];this[_0x0ff9('0x13')]=_0x1878ea[_0x0ff9('0x13')];this[_0x0ff9('0x14')]=_0x1878ea['responsetime'];this[_0x0ff9('0x15')]=_0x1878ea[_0x0ff9('0x15')];this['dropreason']=_0x1878ea['dropreason'];this['endtime']=this['droptime'];this['ringtime']=utils['getSeconds'](_0x1878ea['responsetime'],_0x1878ea[_0x0ff9('0x13')]);this['holdtime']=utils[_0x0ff9('0x16')](this[_0x0ff9('0x15')],_0x1878ea[_0x0ff9('0x14')]);this[_0x0ff9('0x17')]=0x0;this[_0x0ff9('0x4')]=_0x5c383a['queue'];this[_0x0ff9('0x18')]=_0x5c383a[_0x0ff9('0x19')];this[_0x0ff9('0x1a')]=_0x5c383a[_0x0ff9('0x1a')];this[_0x0ff9('0x1b')]=_0x1878ea[_0x0ff9('0x1b')];this[_0x0ff9('0x1c')]=_0x1878ea[_0x0ff9('0x1c')];this[_0x0ff9('0x1d')]=_0x1878ea['callbackat'];this[_0x0ff9('0x1e')]=_0x1878ea[_0x0ff9('0x1e')];this[_0x0ff9('0x1f')]=_0x1878ea[_0x0ff9('0x1f')];this[_0x0ff9('0x20')]=_0x1878ea['ListId'];this[_0x0ff9('0x21')]=_0x1878ea[_0x0ff9('0x21')];this[_0x0ff9('0x22')]=_0x1878ea[_0x0ff9('0x22')];this[_0x0ff9('0x23')]=_0x1878ea[_0x0ff9('0x23')];this['originatecalleridnum']=_0x1878ea[_0x0ff9('0x24')]||'';this[_0x0ff9('0x25')]=_0x1878ea[_0x0ff9('0x25')]||'';this[_0x0ff9('0x26')]=_0x1878ea['agiafterat'];this[_0x0ff9('0x27')]=_0x1878ea[_0x0ff9('0x27')];this[_0x0ff9('0x28')]=_0x1878ea[_0x0ff9('0x28')];}module[_0x0ff9('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0xbce4=['callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countdropretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime','connectedlinename','callbackuniqueid'];(function(_0x4ef8bc,_0x5eb00d){var _0x5d4d56=function(_0x57b3cd){while(--_0x57b3cd){_0x4ef8bc['push'](_0x4ef8bc['shift']());}};_0x5d4d56(++_0x5eb00d);}(_0xbce4,0x83));var _0x4bce=function(_0x3e606d,_0x42af49){_0x3e606d=_0x3e606d-0x0;var _0x30ad20=_0xbce4[_0x3e606d];return _0x30ad20;};'use strict';var utils=require(_0x4bce('0x0'));function QueueCallerAbandon(_0x1e7efb,_0x529eea){this[_0x4bce('0x1')]=_0x1e7efb[_0x4bce('0x1')];this[_0x4bce('0x2')]=_0x1e7efb[_0x4bce('0x2')];this[_0x4bce('0x3')]=_0x1e7efb[_0x4bce('0x2')]===_0x4bce('0x4')?_0x4bce('0x5'):_0x1e7efb['type'];this['countbusyretry']=_0x1e7efb[_0x4bce('0x6')];this[_0x4bce('0x7')]=_0x1e7efb[_0x4bce('0x7')];this[_0x4bce('0x8')]=_0x1e7efb[_0x4bce('0x8')];this[_0x4bce('0x9')]=_0x1e7efb[_0x4bce('0x6')]+_0x1e7efb['countcongestionretry']+_0x1e7efb[_0x4bce('0x8')]+_0x1e7efb[_0x4bce('0xa')]+_0x1e7efb['countdropretry']+_0x1e7efb[_0x4bce('0xb')]+_0x1e7efb['countmachineretry']+_0x1e7efb['countagentrejectretry'];this[_0x4bce('0xa')]=_0x1e7efb[_0x4bce('0xa')];this[_0x4bce('0xc')]=_0x1e7efb[_0x4bce('0xc')];this[_0x4bce('0xb')]=_0x1e7efb[_0x4bce('0xb')];this[_0x4bce('0xd')]=_0x1e7efb[_0x4bce('0xd')];this[_0x4bce('0xe')]=_0x1e7efb[_0x4bce('0xe')];this[_0x4bce('0xf')]=_0x529eea['uniqueid'];this[_0x4bce('0x10')]=_0x1e7efb['name'];this[_0x4bce('0x11')]=_0x1e7efb['number'];this[_0x4bce('0x12')]=_0x1e7efb['starttime'];this[_0x4bce('0x13')]=_0x1e7efb[_0x4bce('0x13')];this[_0x4bce('0x14')]=_0x1e7efb['droptime'];this[_0x4bce('0x15')]=_0x1e7efb['dropreason'];this[_0x4bce('0x16')]=this[_0x4bce('0x14')];this[_0x4bce('0x17')]=utils[_0x4bce('0x18')](_0x1e7efb[_0x4bce('0x13')],_0x1e7efb[_0x4bce('0x12')]);this[_0x4bce('0x19')]=utils[_0x4bce('0x18')](this[_0x4bce('0x14')],_0x1e7efb[_0x4bce('0x13')]);this[_0x4bce('0x1a')]=0x0;this[_0x4bce('0x5')]=_0x529eea['queue'];this['membername']=_0x529eea[_0x4bce('0x1b')];this['reason']=_0x529eea['reason'];this['callback']=_0x1e7efb['callback'];this[_0x4bce('0x1c')]=_0x1e7efb['callbackuniqueid'];this['callbackat']=_0x1e7efb[_0x4bce('0x1d')];this['recallme']=_0x1e7efb[_0x4bce('0x1e')];this[_0x4bce('0x1f')]=_0x1e7efb[_0x4bce('0x1f')];this['ListId']=_0x1e7efb['ListId'];this[_0x4bce('0x20')]=_0x1e7efb[_0x4bce('0x20')];this[_0x4bce('0x21')]=_0x1e7efb['VoiceQueueId'];this[_0x4bce('0x22')]=_0x1e7efb[_0x4bce('0x22')];this[_0x4bce('0x23')]=_0x1e7efb[_0x4bce('0x23')]||'';this[_0x4bce('0x24')]=_0x1e7efb[_0x4bce('0x24')]||'';this['agiafterat']=_0x1e7efb['agiafterat'];this['state']=_0x1e7efb[_0x4bce('0x25')];this[_0x4bce('0x26')]=_0x1e7efb[_0x4bce('0x26')];}module[_0x4bce('0x27')]=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 181768d..a63cbdc 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 _0xd8b0=['moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','[createHistory]','createHistory','util','../../../../config/logger','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]'];(function(_0x13a3ff,_0x1c3457){var _0x28bcb8=function(_0x505ac5){while(--_0x505ac5){_0x13a3ff['push'](_0x13a3ff['shift']());}};_0x28bcb8(++_0x1c3457);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x0d8b('0x0'));var logger=require(_0x0d8b('0x1'))('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x0d8b('0x2'));var cmHopperHistory=require(_0x0d8b('0x3'));function inspectError(_0x43bca1){return util[_0x0d8b('0x4')](_0x43bca1,{'showHidden':![],'depth':null});}function getContactDialer(_0x8196ed,_0x577834,_0x5e15e6){return cmHopper[_0x0d8b('0x5')](_0x8196ed['id'],_0x577834,_0x5e15e6,_0x8196ed[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x4a4470){_0x8196ed[_0x0d8b('0x8')]-=_0x5e15e6;if(_0x8196ed[_0x0d8b('0x8')]<0x0){_0x8196ed['temp']=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xa'),inspectError(_0x4a4470));});}exports[_0x0d8b('0x5')]=getContactDialer;function getContactDialerIvr(_0x1f4800,_0x28ff7f){return cmHopper[_0x0d8b('0xb')](_0x1f4800['id'],_0x28ff7f,_0x1f4800[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x48fa16){_0x1f4800[_0x0d8b('0x8')]-=_0x28ff7f;if(_0x1f4800['temp']<0x0){_0x1f4800[_0x0d8b('0x8')]=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xc'),inspectError(_0x48fa16));});}exports[_0x0d8b('0xb')]=getContactDialerIvr;function countReScheduled(_0x35a07b){return cmHopper[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0x7')](function(_0x31a8cc){logger[_0x0d8b('0x9')](_0x0d8b('0xe'),inspectError(_0x31a8cc));});}exports[_0x0d8b('0xd')]=countReScheduled;function rescheduleContact(_0xe65334){return cmHopper[_0x0d8b('0xf')](_0xe65334)[_0x0d8b('0x7')](function(_0x4f6f21){logger[_0x0d8b('0x9')](_0x0d8b('0x10'),inspectError(_0x4f6f21));});}exports[_0x0d8b('0xf')]=rescheduleContact;function unlockContact(_0xe2e167,_0x2cb03c,_0x5cd485){return cmHopper[_0x0d8b('0x11')](_0xe2e167,_0x2cb03c,_0x5cd485)[_0x0d8b('0x7')](function(_0x2fd0fc){logger[_0x0d8b('0x9')](_0x0d8b('0x12'),inspectError(_0x2fd0fc));});}exports[_0x0d8b('0x11')]=unlockContact;function moveContactManagedDialer(_0x264b39){return cmHopper[_0x0d8b('0x13')](_0x264b39)['catch'](function(_0x27512e){logger[_0x0d8b('0x9')](_0x0d8b('0x14'),inspectError(_0x27512e));});}exports[_0x0d8b('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x24e8ed){return cmHopperBlack[_0x0d8b('0x15')](_0x24e8ed)[_0x0d8b('0x7')](function(_0x352c17){logger['error']('[checkIsBlackList]',inspectError(_0x352c17));});}exports[_0x0d8b('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x54a9a7){return cmHopperBlack['checkIsBlackListIvr'](_0x54a9a7)['catch'](function(_0x238728){logger[_0x0d8b('0x9')](_0x0d8b('0x16'),inspectError(_0x238728));});}exports[_0x0d8b('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x221071,_0x2c64e2,_0x30980c){return cmHopperAdditionalPhone[_0x0d8b('0x18')](_0x221071,_0x2c64e2,_0x30980c)[_0x0d8b('0x7')](function(_0x5e5bc3){logger[_0x0d8b('0x9')](_0x0d8b('0x19'),inspectError(_0x5e5bc3));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xe1ef20,_0x4a0ae4,_0x3dd149){return cmHopperAdditionalPhone[_0x0d8b('0x1a')](_0xe1ef20,_0x4a0ae4,_0x3dd149)[_0x0d8b('0x7')](function(_0x4fe6f9){logger['error'](_0x0d8b('0x1b'),inspectError(_0x4fe6f9));});}exports[_0x0d8b('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x4c05ee){return cmHopperHistory[_0x0d8b('0x1c')](_0x4c05ee)['catch'](function(_0x1b2b59){logger['error'](_0x0d8b('0x1d'),inspectError(_0x1b2b59));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x2ab00d){return cmHopperHistory['createHistory'](_0x2ab00d)[_0x0d8b('0x7')](function(_0x544735){logger[_0x0d8b('0x9')](_0x0d8b('0x1e'),inspectError(_0x544735));});}exports[_0x0d8b('0x1f')]=createHistory; \ No newline at end of file +var _0xb10b=['[createHistory]','util','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialer','[getContactDialerIvr]','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory'];(function(_0x26b62a,_0x527246){var _0x122717=function(_0x588622){while(--_0x588622){_0x26b62a['push'](_0x26b62a['shift']());}};_0x122717(++_0x527246);}(_0xb10b,0x12a));var _0xbb10=function(_0x45bee0,_0x42bf09){_0x45bee0=_0x45bee0-0x0;var _0x1fcfd5=_0xb10b[_0x45bee0];return _0x1fcfd5;};'use strict';var util=require(_0xbb10('0x0'));var logger=require('../../../../config/logger')(_0xbb10('0x1'));var cmHopper=require(_0xbb10('0x2'));var cmHopperAdditionalPhone=require(_0xbb10('0x3'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0xbb10('0x4'));function inspectError(_0x9bbed){return util[_0xbb10('0x5')](_0x9bbed,{'showHidden':![],'depth':null});}function getContactDialer(_0x22320e,_0x49baf4,_0x312b72){return cmHopper['getContactDialer'](_0x22320e['id'],_0x49baf4,_0x312b72,_0x22320e[_0xbb10('0x6')])[_0xbb10('0x7')](function(_0x513741){_0x22320e[_0xbb10('0x8')]-=_0x312b72;if(_0x22320e[_0xbb10('0x8')]<0x0){_0x22320e[_0xbb10('0x8')]=0x0;}logger[_0xbb10('0x9')](_0xbb10('0xa'),inspectError(_0x513741));});}exports[_0xbb10('0xb')]=getContactDialer;function getContactDialerIvr(_0x229887,_0xa3adc8){return cmHopper['getContactDialerIvr'](_0x229887['id'],_0xa3adc8,_0x229887['dialOrderByScheduledAt'])[_0xbb10('0x7')](function(_0x118a74){_0x229887[_0xbb10('0x8')]-=_0xa3adc8;if(_0x229887['temp']<0x0){_0x229887[_0xbb10('0x8')]=0x0;}logger['error'](_0xbb10('0xc'),inspectError(_0x118a74));});}exports[_0xbb10('0xd')]=getContactDialerIvr;function countReScheduled(_0x285009){return cmHopper[_0xbb10('0xe')](_0x285009)[_0xbb10('0x7')](function(_0x147230){logger['error'](_0xbb10('0xf'),inspectError(_0x147230));});}exports[_0xbb10('0xe')]=countReScheduled;function rescheduleContact(_0x45b9d6){return cmHopper[_0xbb10('0x10')](_0x45b9d6)[_0xbb10('0x7')](function(_0x2f2ebf){logger[_0xbb10('0x9')](_0xbb10('0x11'),inspectError(_0x2f2ebf));});}exports[_0xbb10('0x10')]=rescheduleContact;function unlockContact(_0x2b184e,_0x4a2bfc,_0x2eca0f){return cmHopper[_0xbb10('0x12')](_0x2b184e,_0x4a2bfc,_0x2eca0f)[_0xbb10('0x7')](function(_0x42db98){logger[_0xbb10('0x9')](_0xbb10('0x13'),inspectError(_0x42db98));});}exports[_0xbb10('0x12')]=unlockContact;function moveContactManagedDialer(_0x30efc6){return cmHopper[_0xbb10('0x14')](_0x30efc6)[_0xbb10('0x7')](function(_0x48b6e9){logger[_0xbb10('0x9')](_0xbb10('0x15'),inspectError(_0x48b6e9));});}exports[_0xbb10('0x14')]=moveContactManagedDialer;function checkIsBlackList(_0x109908){return cmHopperBlack[_0xbb10('0x16')](_0x109908)[_0xbb10('0x7')](function(_0x4deb49){logger[_0xbb10('0x9')](_0xbb10('0x17'),inspectError(_0x4deb49));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x4c4b0d){return cmHopperBlack[_0xbb10('0x18')](_0x4c4b0d)[_0xbb10('0x7')](function(_0x2e911d){logger[_0xbb10('0x9')](_0xbb10('0x19'),inspectError(_0x2e911d));});}exports[_0xbb10('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x407cb4,_0x436104,_0x7f2377){return cmHopperAdditionalPhone[_0xbb10('0x1a')](_0x407cb4,_0x436104,_0x7f2377)[_0xbb10('0x7')](function(_0x26ad93){logger['error']('[verifyAdditionalPhone]',inspectError(_0x26ad93));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xc93a04,_0x3c5ae7,_0x2c89b9){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0xc93a04,_0x3c5ae7,_0x2c89b9)[_0xbb10('0x7')](function(_0x24d586){logger[_0xbb10('0x9')](_0xbb10('0x1b'),inspectError(_0x24d586));});}exports[_0xbb10('0x1c')]=swapAdditionalPhones;function avgHandleTime(_0x20d946){return cmHopperHistory[_0xbb10('0x1d')](_0x20d946)['catch'](function(_0x3796c7){logger[_0xbb10('0x9')](_0xbb10('0x1e'),inspectError(_0x3796c7));});}exports[_0xbb10('0x1d')]=avgHandleTime;function createHistory(_0x1d30aa){return cmHopperHistory[_0xbb10('0x1f')](_0x1d30aa)['catch'](function(_0x221624){logger['error'](_0xbb10('0x20'),inspectError(_0x221624));});}exports['createHistory']=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 31da492..d32fcee 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 _0x627e=['isIVRCampaignActive','milliseconds','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','originated','Trunk','name','active','isNil','Interval','isEmpty','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','TrunkBackup','includes','INACTIVE','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','DISACTIVED','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','getCallerId','\x5cw{0,','pow','replace','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','lodash','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','DEACTIVATED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','dialActive'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x627e,0x1a7));var _0xe627=function(_0x3216c5,_0x4a19f0){_0x3216c5=_0x3216c5-0x0;var _0x5279cf=_0x627e[_0x3216c5];return _0x5279cf;};'use strict';var _=require(_0xe627('0x0'));var moment=require('moment');var util=require('util');var logger=require(_0xe627('0x1'))(_0xe627('0x2'));var timezones=require(_0xe627('0x3'))[_0xe627('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0xe627('0x5'),'BLACKLIST':_0xe627('0x6'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0xe627('0x7'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0xe627('0x8'),'INACTIVE':_0xe627('0x9'),'NO_AGENTS_LOGGED':_0xe627('0xa'),'NO_AVAILABLE_CONTACTS':_0xe627('0xb'),'NULL_INTERVAL':_0xe627('0xc'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0xe627('0xd'),'QUEUE_RECALL':_0xe627('0xe'),'RECALL_TIMEOUT':_0xe627('0xf'),'RUNNING':_0xe627('0x10'),'UNKNOWN_TIMEZONE':_0xe627('0x11'),'UNREACHABLE_TRUNK':_0xe627('0x12')};exports[_0xe627('0x13')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x56d8b5){return _0x56d8b5[_0xe627('0x14')]===_0xe627('0x15');}exports[_0xe627('0x16')]=isPreviewCampaign;function isIVRCampaign(_0x44eb53){return _0x44eb53[_0xe627('0x17')]===_0xe627('0x18');}exports[_0xe627('0x19')]=isIVRCampaign;function isOutboundQueue(_0x4a4155){return _0x4a4155[_0xe627('0x17')]==='outbound';}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0xa24290){return _0xa24290[_0xe627('0x1a')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x310fea){return _0x310fea['active'];}exports[_0xe627('0x1b')]=isIVRCampaignActive;function getSeconds(_0x24bfaf,_0x1dde84){var _0x41d016=moment(_0x24bfaf)[_0xe627('0x1c')](0x0);var _0x246b9d=moment(_0x1dde84)['milliseconds'](0x0);return _0x41d016['diff'](_0x246b9d,_0xe627('0x1d'));}exports[_0xe627('0x1e')]=getSeconds;function hasQueueCampaignDataChanged(_0x6ee703,_0x5e4e57){var _0x53da69=![];var _0x53e1b8=_0x6ee703[_0xe627('0x14')]!==_0x5e4e57['dialMethod']||_0x6ee703[_0xe627('0x1a')]!==_0x5e4e57[_0xe627('0x1a')]||_0x6ee703[_0xe627('0x1f')]!==_0x5e4e57[_0xe627('0x1f')];var _0x357cf5=_0x6ee703[_0xe627('0x20')]!==_0x5e4e57[_0xe627('0x20')]||_0x6ee703['loggedIn']!==_0x5e4e57[_0xe627('0x21')]||_0x6ee703[_0xe627('0x22')]!==_0x5e4e57[_0xe627('0x22')]||_0x6ee703[_0xe627('0x23')]!==_0x5e4e57['paused']||_0x6ee703['talking']!==_0x5e4e57[_0xe627('0x24')]||_0x6ee703['pTalking']!==_0x5e4e57[_0xe627('0x25')]||_0x6ee703[_0xe627('0x26')]!==_0x5e4e57['waiting']||_0x6ee703['inUse']!==_0x5e4e57['inUse']||_0x6ee703[_0xe627('0x27')]!==_0x5e4e57['originated'];if(_0x6ee703[_0xe627('0x28')]&&_0x5e4e57[_0xe627('0x28')]){_0x53da69=_0x6ee703[_0xe627('0x28')][_0xe627('0x29')]!==_0x5e4e57[_0xe627('0x28')]['name']||_0x6ee703[_0xe627('0x28')][_0xe627('0x2a')]!==_0x5e4e57[_0xe627('0x28')]['active'];}return _0x53e1b8||_0x357cf5||_0x53da69;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x1ac423){var _0x2aba58=null;var _0x771323=_0x1ac423['dialTimezone'];if(_[_0xe627('0x2b')](_0x1ac423['dialGlobalInterval'])||_['isNil'](_0x1ac423[_0xe627('0x2c')])||_[_0xe627('0x2b')](_0x1ac423[_0xe627('0x2c')]['Intervals'])){_0x2aba58=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0xe627('0x2d')](_0x1ac423['dialGlobalInterval'])||_[_0xe627('0x2d')](_0x1ac423[_0xe627('0x2c')]['Intervals'])){_0x2aba58=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x771323&&!timezones[_0x771323]){_0x2aba58=CAMPAIGN_STATUS[_0xe627('0x2e')];}return _0x2aba58;}function checkAnyValidTrunk(_0x557c63,_0x10c8a5){var _0x4a8509=null;var _0x122dc9=_0xe627('0x2f');var _0x42bd02=[_0xe627('0x30'),_0xe627('0x31')];var _0x520a27=!![];if(_0x557c63[_0xe627('0x28')]&&_0x557c63[_0xe627('0x28')][_0xe627('0x2a')]){_0x122dc9+=_0x557c63[_0xe627('0x28')]['name'];_0x4a8509=_0x10c8a5[_0x122dc9];_0x520a27=_0x42bd02['includes'](_0x4a8509['status']);}else if(_0x557c63[_0xe627('0x32')]&&_0x557c63[_0xe627('0x32')][_0xe627('0x2a')]){_0x122dc9+=_0x557c63[_0xe627('0x32')]['name'];_0x4a8509=_0x10c8a5[_0x122dc9];_0x520a27=_0x42bd02[_0xe627('0x33')](_0x4a8509['status']);}return _0x520a27;}function getQueueCampaignStatusMessage(_0x1cad75,_0x1702b7){var _0x77f3da=CAMPAIGN_STATUS[_0xe627('0x5')];var _0x479742=isPreviewCampaign(_0x1cad75);if(!isQueueCampaignActive(_0x1cad75)){if(_0x479742){_0x77f3da=CAMPAIGN_STATUS[_0xe627('0x34')];}else{if(_0x1cad75['originated']===0x0&&_0x1cad75[_0xe627('0x24')]===0x0&&_0x1cad75[_0xe627('0x26')]===0x0&&(_0x1cad75['pTalking']||0x0)===0x0){_0x77f3da=CAMPAIGN_STATUS[_0xe627('0x34')];}else{_0x77f3da=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x1cad75[_0xe627('0x21')]===0x0){_0x77f3da=CAMPAIGN_STATUS[_0xe627('0x35')];}else if(!checkAnyValidTrunk(_0x1cad75,_0x1702b7)){_0x77f3da=CAMPAIGN_STATUS[_0xe627('0x36')];}else if(!isPreviewCampaign(_0x1cad75)){var _0x354ed0=checkAnyValidQueueCampaignInterval(_0x1cad75);if(_0x354ed0){_0x77f3da=_0x354ed0;}}return _0x77f3da;}exports[_0xe627('0x37')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x2e0141){var _0x33c006=CAMPAIGN_STATUS[_0xe627('0x38')];if(_0x2e0141['originated']===0x0&&_0x2e0141['talking']===0x0&&_0x2e0141[_0xe627('0x26')]===0x0&&(_0x2e0141[_0xe627('0x25')]||0x0)===0x0){_0x33c006=CAMPAIGN_STATUS[_0xe627('0x34')];}return _0x33c006;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x1e474f){var _0x19f7da=_0x1e474f[_0xe627('0x39')](/"(.*?)"/);return _0x19f7da?_0x19f7da[0x1]:_0x1e474f;}exports[_0xe627('0x3a')]=extractCalleridName;function getCallerId(_0x1dbf0a,_0x1a8ed3,_0x4fa782){if(!_[_0xe627('0x3b')](_0x4fa782)&&typeof _0x4fa782===_0xe627('0x3c')&&!_['isEmpty'](_0x4fa782)){if(!_[_0xe627('0x3b')](_0x1a8ed3)&&typeof _0x1a8ed3===_0xe627('0x3c')&&!_[_0xe627('0x2d')](_0x1a8ed3)){return util[_0xe627('0x3d')](_0xe627('0x3e'),_0x1a8ed3,_0x4fa782);}return util[_0xe627('0x3d')](_0xe627('0x3e'),_0x4fa782,_0x4fa782);}if(!_[_0xe627('0x3b')](_0x1dbf0a)&&typeof _0x1dbf0a===_0xe627('0x3c')&&!_[_0xe627('0x2d')](_0x1dbf0a)){return _0x1dbf0a;}return'\x22\x22\x20<>';}exports[_0xe627('0x3f')]=getCallerId;function getCallerIdRandom(_0x242353,_0x20a1d4){var _0x411e1e;var _0x1b2f7a;var _0x103ce5;if(_0x20a1d4<=0x0){_0x20a1d4=0x1;}_0x411e1e=new RegExp(_0xe627('0x40')+_0x20a1d4+'}$');_0x1b2f7a=Math[_0xe627('0x41')](0xa,_0x20a1d4-0x1);_0x103ce5=Math[_0xe627('0x41')](0xa,_0x20a1d4)-0x1;return util[_0xe627('0x3d')]('%s',_[_0xe627('0x42')](_0x242353,_0x411e1e,_['random'](_0x1b2f7a,_0x103ce5)[_0xe627('0x43')]()));}exports[_0xe627('0x44')]=getCallerIdRandom;function decrementOriginate(_0x4e168a){if(_0x4e168a['originated']&&_0x4e168a['originated']>0x0){_0x4e168a[_0xe627('0x27')]-=0x1;}else{logger[_0xe627('0x45')](_0xe627('0x46'));}}exports[_0xe627('0x47')]=decrementOriginate;function checkContactEmpty(_0x355640){return _0x355640&&_0x355640[_0xe627('0x48')]>0x0;}exports[_0xe627('0x49')]=checkContactEmpty;function erlangb(_0xcc54da,_0x171e4d){if(_0x171e4d===0x0){return 0x0;}var _0x2cc329=0x1;for(var _0x37f6d1=0x1;_0x37f6d1<=_0x171e4d;_0x37f6d1+=0x1){_0x2cc329=0x1+_0x2cc329*_0x37f6d1/_0xcc54da;}return 0x1/_0x2cc329;}exports[_0xe627('0x4a')]=erlangb;function checkContactLowerLimitOriginate(_0x433e73,_0x175502,_0x577655){if(_0x175502>_0x577655){for(var _0x2467fe=0x0;_0x2467fe<_0x175502-_0x577655;_0x2467fe+=0x1){decrementOriginate(_0x433e73);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate; \ No newline at end of file +var _0x4cab=['dialActive','message','available','loggedIn','loggedInDb','paused','talking','waiting','inUse','originated','Trunk','name','isNil','Interval','Intervals','NULL_INTERVAL','isEmpty','dialGlobalInterval','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','pTalking','DISACTIVED','UNREACHABLE_TRUNK','getQueueCampaignActiveStatusMessage','match','extractCalleridName','string','isUndefined','format','\x22%s\x22\x20<%s>','getCallerId','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','util','../../../../config/logger','dialer','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','isPreviewCampaign','type','isOutboundQueue','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','getSeconds'];(function(_0x5597a0,_0x35c11e){var _0x2fc8d6=function(_0x492dcb){while(--_0x492dcb){_0x5597a0['push'](_0x5597a0['shift']());}};_0x2fc8d6(++_0x35c11e);}(_0x4cab,0x15e));var _0xb4ca=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x4cab[_0x1b828b];return _0x98da1a;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xb4ca('0x0'));var logger=require(_0xb4ca('0x1'))(_0xb4ca('0x2'));var timezones=require('../../../../config/environment/shared')[_0xb4ca('0x3')];var CAMPAIGN_STATUS={'ACTIVE':_0xb4ca('0x4'),'BLACKLIST':_0xb4ca('0x5'),'CONTACTS_RESCHEDULED':_0xb4ca('0x6'),'DEACTIVATED':_0xb4ca('0x7'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0xb4ca('0x8'),'INACTIVE':_0xb4ca('0x9'),'NO_AGENTS_LOGGED':_0xb4ca('0xa'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0xb4ca('0xb'),'QUEUE_RECALL':_0xb4ca('0xc'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0xb4ca('0xd'),'UNREACHABLE_TRUNK':_0xb4ca('0xe')};exports[_0xb4ca('0xf')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x4d9c8b){return _0x4d9c8b[_0xb4ca('0x10')]==='preview';}exports[_0xb4ca('0x11')]=isPreviewCampaign;function isIVRCampaign(_0x855cb9){return _0x855cb9[_0xb4ca('0x12')]==='ivr';}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x1f4b5a){return _0x1f4b5a[_0xb4ca('0x12')]==='outbound';}exports[_0xb4ca('0x13')]=isOutboundQueue;function isQueueCampaignActive(_0x17797e){return _0x17797e['dialActive'];}exports[_0xb4ca('0x14')]=isQueueCampaignActive;function isIVRCampaignActive(_0x339485){return _0x339485[_0xb4ca('0x15')];}exports[_0xb4ca('0x16')]=isIVRCampaignActive;function getSeconds(_0x9575cd,_0x4ed21f){var _0x5ee725=moment(_0x9575cd)[_0xb4ca('0x17')](0x0);var _0x237504=moment(_0x4ed21f)['milliseconds'](0x0);return _0x5ee725['diff'](_0x237504,'seconds');}exports[_0xb4ca('0x18')]=getSeconds;function hasQueueCampaignDataChanged(_0x17b198,_0x7b528d){var _0x52c23a=![];var _0x458e3b=_0x17b198['dialMethod']!==_0x7b528d[_0xb4ca('0x10')]||_0x17b198[_0xb4ca('0x19')]!==_0x7b528d[_0xb4ca('0x19')]||_0x17b198[_0xb4ca('0x1a')]!==_0x7b528d['message'];var _0x27395f=_0x17b198[_0xb4ca('0x1b')]!==_0x7b528d[_0xb4ca('0x1b')]||_0x17b198[_0xb4ca('0x1c')]!==_0x7b528d[_0xb4ca('0x1c')]||_0x17b198['loggedInDb']!==_0x7b528d[_0xb4ca('0x1d')]||_0x17b198[_0xb4ca('0x1e')]!==_0x7b528d[_0xb4ca('0x1e')]||_0x17b198[_0xb4ca('0x1f')]!==_0x7b528d[_0xb4ca('0x1f')]||_0x17b198['pTalking']!==_0x7b528d['pTalking']||_0x17b198[_0xb4ca('0x20')]!==_0x7b528d[_0xb4ca('0x20')]||_0x17b198[_0xb4ca('0x21')]!==_0x7b528d[_0xb4ca('0x21')]||_0x17b198[_0xb4ca('0x22')]!==_0x7b528d[_0xb4ca('0x22')];if(_0x17b198[_0xb4ca('0x23')]&&_0x7b528d['Trunk']){_0x52c23a=_0x17b198['Trunk'][_0xb4ca('0x24')]!==_0x7b528d[_0xb4ca('0x23')]['name']||_0x17b198['Trunk'][_0xb4ca('0x15')]!==_0x7b528d[_0xb4ca('0x23')][_0xb4ca('0x15')];}return _0x458e3b||_0x27395f||_0x52c23a;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x2af10f){var _0x2ee7d8=null;var _0x205218=_0x2af10f['dialTimezone'];if(_['isNil'](_0x2af10f['dialGlobalInterval'])||_[_0xb4ca('0x25')](_0x2af10f[_0xb4ca('0x26')])||_[_0xb4ca('0x25')](_0x2af10f[_0xb4ca('0x26')][_0xb4ca('0x27')])){_0x2ee7d8=CAMPAIGN_STATUS[_0xb4ca('0x28')];}else if(_[_0xb4ca('0x29')](_0x2af10f[_0xb4ca('0x2a')])||_['isEmpty'](_0x2af10f[_0xb4ca('0x26')][_0xb4ca('0x27')])){_0x2ee7d8=CAMPAIGN_STATUS[_0xb4ca('0x2b')];}else if(_0x205218&&!timezones[_0x205218]){_0x2ee7d8=CAMPAIGN_STATUS[_0xb4ca('0x2c')];}return _0x2ee7d8;}function checkAnyValidTrunk(_0xfb39f,_0x2419e0){var _0x321c76=null;var _0x45c67d=_0xb4ca('0x2d');var _0x5ce2f5=[_0xb4ca('0x2e'),_0xb4ca('0x2f')];var _0x2797b4=!![];if(_0xfb39f[_0xb4ca('0x23')]&&_0xfb39f[_0xb4ca('0x23')][_0xb4ca('0x15')]){_0x45c67d+=_0xfb39f[_0xb4ca('0x23')][_0xb4ca('0x24')];_0x321c76=_0x2419e0[_0x45c67d];_0x2797b4=_0x5ce2f5[_0xb4ca('0x30')](_0x321c76[_0xb4ca('0x31')]);}else if(_0xfb39f['TrunkBackup']&&_0xfb39f[_0xb4ca('0x32')][_0xb4ca('0x15')]){_0x45c67d+=_0xfb39f[_0xb4ca('0x32')]['name'];_0x321c76=_0x2419e0[_0x45c67d];_0x2797b4=_0x5ce2f5[_0xb4ca('0x30')](_0x321c76[_0xb4ca('0x31')]);}return _0x2797b4;}function getQueueCampaignStatusMessage(_0x62c813,_0x28ee23){var _0x5fbaa7=CAMPAIGN_STATUS[_0xb4ca('0x4')];var _0x5787bd=isPreviewCampaign(_0x62c813);if(!isQueueCampaignActive(_0x62c813)){if(_0x5787bd){_0x5fbaa7=CAMPAIGN_STATUS[_0xb4ca('0x33')];}else{if(_0x62c813[_0xb4ca('0x22')]===0x0&&_0x62c813['talking']===0x0&&_0x62c813[_0xb4ca('0x20')]===0x0&&(_0x62c813[_0xb4ca('0x34')]||0x0)===0x0){_0x5fbaa7=CAMPAIGN_STATUS[_0xb4ca('0x33')];}else{_0x5fbaa7=CAMPAIGN_STATUS[_0xb4ca('0x35')];}}}else if(_0x62c813[_0xb4ca('0x1c')]===0x0){_0x5fbaa7=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x62c813,_0x28ee23)){_0x5fbaa7=CAMPAIGN_STATUS[_0xb4ca('0x36')];}else if(!isPreviewCampaign(_0x62c813)){var _0x24fd08=checkAnyValidQueueCampaignInterval(_0x62c813);if(_0x24fd08){_0x5fbaa7=_0x24fd08;}}return _0x5fbaa7;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x4872a0){var _0x4f5c77=CAMPAIGN_STATUS[_0xb4ca('0x35')];if(_0x4872a0[_0xb4ca('0x22')]===0x0&&_0x4872a0[_0xb4ca('0x1f')]===0x0&&_0x4872a0['waiting']===0x0&&(_0x4872a0[_0xb4ca('0x34')]||0x0)===0x0){_0x4f5c77=CAMPAIGN_STATUS['INACTIVE'];}return _0x4f5c77;}exports[_0xb4ca('0x37')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x2ca412){var _0x58887=_0x2ca412[_0xb4ca('0x38')](/"(.*?)"/);return _0x58887?_0x58887[0x1]:_0x2ca412;}exports[_0xb4ca('0x39')]=extractCalleridName;function getCallerId(_0x2a21fc,_0x26d33b,_0x4b6fef){if(!_['isUndefined'](_0x4b6fef)&&typeof _0x4b6fef===_0xb4ca('0x3a')&&!_[_0xb4ca('0x29')](_0x4b6fef)){if(!_[_0xb4ca('0x3b')](_0x26d33b)&&typeof _0x26d33b==='string'&&!_[_0xb4ca('0x29')](_0x26d33b)){return util[_0xb4ca('0x3c')]('\x22%s\x22\x20<%s>',_0x26d33b,_0x4b6fef);}return util['format'](_0xb4ca('0x3d'),_0x4b6fef,_0x4b6fef);}if(!_['isUndefined'](_0x2a21fc)&&typeof _0x2a21fc===_0xb4ca('0x3a')&&!_[_0xb4ca('0x29')](_0x2a21fc)){return _0x2a21fc;}return'\x22\x22\x20<>';}exports[_0xb4ca('0x3e')]=getCallerId;function getCallerIdRandom(_0x2eaf6e,_0xee7463){var _0x22ccd2;var _0x351e7b;var _0x391959;if(_0xee7463<=0x0){_0xee7463=0x1;}_0x22ccd2=new RegExp('\x5cw{0,'+_0xee7463+'}$');_0x351e7b=Math[_0xb4ca('0x3f')](0xa,_0xee7463-0x1);_0x391959=Math[_0xb4ca('0x3f')](0xa,_0xee7463)-0x1;return util['format']('%s',_[_0xb4ca('0x40')](_0x2eaf6e,_0x22ccd2,_[_0xb4ca('0x41')](_0x351e7b,_0x391959)[_0xb4ca('0x42')]()));}exports[_0xb4ca('0x43')]=getCallerIdRandom;function decrementOriginate(_0x2f5dee){if(_0x2f5dee['originated']&&_0x2f5dee['originated']>0x0){_0x2f5dee[_0xb4ca('0x22')]-=0x1;}else{logger[_0xb4ca('0x44')](_0xb4ca('0x45'));}}exports[_0xb4ca('0x46')]=decrementOriginate;function checkContactEmpty(_0x46a230){return _0x46a230&&_0x46a230[_0xb4ca('0x47')]>0x0;}exports[_0xb4ca('0x48')]=checkContactEmpty;function erlangb(_0x26f669,_0x4089b3){if(_0x4089b3===0x0){return 0x0;}var _0x32c5a3=0x1;for(var _0x403dda=0x1;_0x403dda<=_0x4089b3;_0x403dda+=0x1){_0x32c5a3=0x1+_0x32c5a3*_0x403dda/_0x26f669;}return 0x1/_0x32c5a3;}exports[_0xb4ca('0x49')]=erlangb;function checkContactLowerLimitOriginate(_0x2b9d09,_0x533c7b,_0x3bfe5d){if(_0x533c7b>_0x3bfe5d){for(var _0x10c63d=0x0;_0x10c63d<_0x533c7b-_0x3bfe5d;_0x10c63d+=0x1){decrementOriginate(_0x2b9d09);}}}exports[_0xb4ca('0x4a')]=checkContactLowerLimitOriginate; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index c45f7cf..22493f3 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(_0x339813,_0x1af39f){var _0x34678e=function(_0x66df61){while(--_0x66df61){_0x339813['push'](_0x339813['shift']());}};_0x34678e(++_0x1af39f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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(_0x1625db,_0x58dc81){var _0x45d1ab=function(_0x31d81f){while(--_0x31d81f){_0x1625db['push'](_0x1625db['shift']());}};_0x45d1ab(++_0x58dc81);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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 9b6486f..039e122 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 _0x89c0=['Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','moment','path','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./channel','./action','../rpc/faxAccount','../rpc/attachment','channels','trunks','newchannel','varset','bind','newstate','newexten','syncNewExten','syncFaxStatus','receivefax','syncReceiveFax','originateresponse','prototype','syncNewchannel','context','from-voip-provider','hasOwnProperty','exten','faxAccounts','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','syncVarSet','variable','syncNewState','channelstate','channelstatedesc','value','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','catch','error','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','then','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','\x20Trunk\x20is\x20not\x20active'];(function(_0xd63e3a,_0x1bd6eb){var _0x19c178=function(_0x56be0d){while(--_0x56be0d){_0xd63e3a['push'](_0xd63e3a['shift']());}};_0x19c178(++_0x1bd6eb);}(_0x89c0,0x173));var _0x089c=function(_0x3ed4e8,_0x3d1911){_0x3ed4e8=_0x3ed4e8-0x0;var _0x5ed8a5=_0x89c0[_0x3ed4e8];return _0x5ed8a5;};'use strict';var util=require(_0x089c('0x0'));var _=require(_0x089c('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x089c('0x2'));var path=require(_0x089c('0x3'));var tiff2pdf=require(_0x089c('0x4'));var gs=require(_0x089c('0x5'));var logger=require('../../../config/logger')(_0x089c('0x6'));var ami=require(_0x089c('0x7'));var rpcDb=require(_0x089c('0x8'));var Channel=require(_0x089c('0x9'));var ut=require('./util/util');var Action=require(_0x089c('0xa'));var faxAccount=require(_0x089c('0xb'));var attachment=require(_0x089c('0xc'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x235ec6){this[_0x089c('0xd')]={};this['faxAccounts']=_0x235ec6['faxAccounts'];this[_0x089c('0xe')]=_0x235ec6[_0x089c('0xe')];this['actions']={};ami['on'](_0x089c('0xf'),this['syncNewchannel']['bind'](this));ami['on'](_0x089c('0x10'),this['syncVarSet'][_0x089c('0x11')](this));ami['on'](_0x089c('0x12'),this['syncNewState'][_0x089c('0x11')](this));ami['on'](_0x089c('0x13'),this[_0x089c('0x14')][_0x089c('0x11')](this));ami['on']('faxstatus',this[_0x089c('0x15')]['bind'](this));ami['on'](_0x089c('0x16'),this[_0x089c('0x17')][_0x089c('0x11')](this));ami['on']('hangup',this['syncHangup'][_0x089c('0x11')](this));ami['on'](_0x089c('0x18'),this['syncOriginateResponse'][_0x089c('0x11')](this));}Fax[_0x089c('0x19')][_0x089c('0x1a')]=function(_0x5868c4){if(_0x5868c4[_0x089c('0x1b')]===_0x089c('0x1c')){for(var _0xa47ea5 in this['faxAccounts']){if(this['faxAccounts'][_0x089c('0x1d')](_0xa47ea5)){if(_0x5868c4[_0x089c('0x1e')]===this[_0x089c('0x1f')][_0xa47ea5]['localstationid']){this[_0x089c('0xd')][_0x5868c4[_0x089c('0x20')]]={};this[_0x089c('0xd')][_0x5868c4['uniqueid']][_0x089c('0x21')]=_0x5868c4[_0x089c('0x21')];this[_0x089c('0xd')][_0x5868c4[_0x089c('0x20')]]['id']=this[_0x089c('0x1f')][_0xa47ea5]['id'];this[_0x089c('0xd')][_0x5868c4[_0x089c('0x20')]]['name']=this[_0x089c('0x1f')][_0xa47ea5][_0x089c('0x22')];logger[_0x089c('0x23')](_0x5868c4[_0x089c('0x20')],_0x089c('0x24'));}}}}if(this[_0x089c('0x25')][_0x5868c4[_0x089c('0x20')]]){this['channels'][_0x5868c4[_0x089c('0x20')]]={};this[_0x089c('0xd')][_0x5868c4[_0x089c('0x20')]]['channel']=_0x5868c4['channel'];logger['info'](_0x5868c4[_0x089c('0x20')],_0x089c('0x24'));}};Fax[_0x089c('0x19')][_0x089c('0x26')]=function(_0x7314a7){if(this[_0x089c('0xd')][_0x7314a7['uniqueid']]){for(var _0x1640c5 in _0x7314a7[_0x089c('0x27')]){if(_0x7314a7[_0x089c('0x27')]['hasOwnProperty'](_0x1640c5)){this[_0x089c('0xd')][_0x7314a7[_0x089c('0x20')]][_0x1640c5]=_0x7314a7['value'];}}}};Fax[_0x089c('0x19')][_0x089c('0x28')]=function(_0x3c2dc8){if(this['channels'][_0x3c2dc8[_0x089c('0x20')]]){this['channels'][_0x3c2dc8[_0x089c('0x20')]][_0x089c('0x29')]=_0x3c2dc8[_0x089c('0x29')];this[_0x089c('0xd')][_0x3c2dc8[_0x089c('0x20')]]['channelstatedesc']=_0x3c2dc8[_0x089c('0x2a')];}};Fax['prototype']['syncNewExten']=function(_0xe550a0){if(this[_0x089c('0xd')][_0xe550a0[_0x089c('0x20')]]){for(var _0x7506e2 in _0xe550a0[_0x089c('0x27')]){if(_0xe550a0[_0x089c('0x27')][_0x089c('0x1d')](_0x7506e2)){this['channels'][_0xe550a0[_0x089c('0x20')]][_0x7506e2]=_0xe550a0[_0x089c('0x2b')];}}}};Fax[_0x089c('0x19')]['syncFaxStatus']=function(_0x2c02c5){if(this['channels'][_0x2c02c5[_0x089c('0x20')]]){this[_0x089c('0xd')][_0x2c02c5['uniqueid']][_0x089c('0x2c')]=_0x2c02c5[_0x089c('0x2c')];this[_0x089c('0xd')][_0x2c02c5[_0x089c('0x20')]][_0x089c('0x2d')]=_0x2c02c5[_0x089c('0x2d')];this[_0x089c('0xd')][_0x2c02c5[_0x089c('0x20')]][_0x089c('0x2e')]=_0x2c02c5['localstationid'];this[_0x089c('0xd')][_0x2c02c5['uniqueid']][_0x089c('0x2f')]=_0x2c02c5[_0x089c('0x2f')];logger[_0x089c('0x23')](_0x2c02c5[_0x089c('0x20')],_0x089c('0x30'));}};Fax[_0x089c('0x19')][_0x089c('0x17')]=function(_0x1751a8){var _0x54ccf0=this;if(this['channels'][_0x1751a8[_0x089c('0x20')]]){var _0x5976d1=this[_0x089c('0xd')][_0x1751a8['uniqueid']]['id'];this['channels'][_0x1751a8[_0x089c('0x20')]]['remotestationid']=_0x1751a8[_0x089c('0x31')];this[_0x089c('0xd')][_0x1751a8[_0x089c('0x20')]][_0x089c('0x32')]=_0x1751a8['pagestransferred'];this['channels'][_0x1751a8[_0x089c('0x20')]][_0x089c('0x2e')]=_0x1751a8[_0x089c('0x2e')];this[_0x089c('0xd')][_0x1751a8[_0x089c('0x20')]]['resolution']=_0x1751a8[_0x089c('0x33')];this[_0x089c('0xd')][_0x1751a8[_0x089c('0x20')]][_0x089c('0x34')]=_0x1751a8[_0x089c('0x34')];this['channels'][_0x1751a8[_0x089c('0x20')]]['filename']=_0x1751a8[_0x089c('0x2f')];this[_0x089c('0xd')][_0x1751a8[_0x089c('0x20')]]['calleridnum']=_0x1751a8[_0x089c('0x35')];if(this[_0x089c('0xd')][_0x1751a8[_0x089c('0x20')]]['pagestransferred']>0x0){tiff2pdf(_0x1751a8['filename'],'/var/opt/motion2/server/files/attachments/',function(_0xd42842){logger['info'](_0x1751a8[_0x089c('0x20')],_0x089c('0x36'),_0xd42842[_0x089c('0x37')]);attachment[_0x089c('0x38')]({'name':path['parse'](_0x1751a8[_0x089c('0x2f')])['name'],'basename':path[_0x089c('0x39')](_0x1751a8[_0x089c('0x2f')])['name']+_0x089c('0x3a'),'type':_0x089c('0x3b')})['then'](function(_0x21f558){faxAccount['notify'](_0x5976d1,{'from':_0x1751a8[_0x089c('0x35')],'mapKey':_0x089c('0x6'),'body':path[_0x089c('0x39')](_0x1751a8[_0x089c('0x2f')])['name']+_0x089c('0x3a'),'AttachmentId':_0x21f558['id']})[_0x089c('0x3c')](function(_0x4c97b7){logger[_0x089c('0x3d')](_0x1751a8[_0x089c('0x20')],'\x20notify\x20',JSON[_0x089c('0x3e')](_0x4c97b7));});})[_0x089c('0x3c')](function(_0x71fb26){logger['error'](_0x1751a8['uniqueid'],_0x089c('0x3f'),JSON['stringify'](_0x71fb26));});});}logger[_0x089c('0x23')](_0x1751a8[_0x089c('0x20')],_0x089c('0x3f'));}};Fax['prototype'][_0x089c('0x40')]=function(_0x222934){if(this[_0x089c('0x25')][_0x222934[_0x089c('0x20')]]){_[_0x089c('0x41')](this[_0x089c('0xd')][_0x222934[_0x089c('0x20')]],_[_0x089c('0x42')](_0x222934,[_0x089c('0x43'),_0x089c('0x44')]));}};function updateStatus(_0x4a6c68){if(_0x4a6c68['AttachmentId']){faxMessage[_0x089c('0x45')](_0x4a6c68[_0x089c('0x46')],{'failMessage':_0x089c('0x47')})['then'](function(_0x144e6e){ut[_0x089c('0x48')](_0x089c('0x49'),_0x144e6e);})[_0x089c('0x3c')](function(_0x221d53){ut[_0x089c('0x48')](_0x089c('0x4a'),_0x221d53);});}else{ut['logger'](_0x089c('0x4b'));}}Fax[_0x089c('0x19')][_0x089c('0x4c')]=function(_0x1f607e,_0x2661ca,_0xcdd395){var _0x34565c=this;var _0x559d08={};if(_0x2661ca){_0x559d08={'read':_0x2661ca};}else{_0x559d08={'failMessage':_0xcdd395};}if(this[_0x089c('0x25')][_0x1f607e][_0x089c('0x46')]){faxMessage[_0x089c('0x45')](this[_0x089c('0x25')][_0x1f607e][_0x089c('0x46')],_0x559d08)[_0x089c('0x4d')](function(_0x39eed7){ut[_0x089c('0x48')]('[Fax][Message][Updated]',_0x39eed7);})['catch'](function(_0x5131fc){ut['logger'](_0x089c('0x4e'),_0x5131fc);})[_0x089c('0x4f')](function(){delete _0x34565c[_0x089c('0xd')][_0x1f607e];delete _0x34565c['actions'][_0x1f607e];});}else{ut[_0x089c('0x48')](_0x089c('0x50'));delete this[_0x089c('0xd')][_0x1f607e];delete this['actions'][_0x1f607e];}};Fax[_0x089c('0x19')][_0x089c('0x51')]=function(_0x2fa74a){var _0x2a73d8=this;if(this[_0x089c('0xd')][_0x2fa74a[_0x089c('0x20')]]){if(this[_0x089c('0x25')][_0x2fa74a['uniqueid']]){this[_0x089c('0xd')][_0x2fa74a[_0x089c('0x20')]]['id']=this['actions'][_0x2fa74a[_0x089c('0x20')]]['id'];this[_0x089c('0xd')][_0x2fa74a[_0x089c('0x20')]][_0x089c('0x22')]=this[_0x089c('0x25')][_0x2fa74a[_0x089c('0x20')]][_0x089c('0x22')];}logger[_0x089c('0x23')](_0x2fa74a[_0x089c('0x20')],this[_0x089c('0x25')][_0x2fa74a[_0x089c('0x20')]]?_0x089c('0x52'):_0x089c('0x53'),JSON[_0x089c('0x3e')](this[_0x089c('0xd')][_0x2fa74a[_0x089c('0x20')]]));if(this[_0x089c('0x25')][_0x2fa74a[_0x089c('0x20')]]){if(this[_0x089c('0xd')][_0x2fa74a[_0x089c('0x20')]][_0x089c('0x54')]>0x0&&this[_0x089c('0xd')][_0x2fa74a[_0x089c('0x20')]]['faxstatus']===_0x089c('0x55')){this[_0x089c('0x4c')](_0x2fa74a[_0x089c('0x20')],!![]);}else{this[_0x089c('0x4c')](_0x2fa74a[_0x089c('0x20')],![],this[_0x089c('0xd')][_0x2fa74a[_0x089c('0x20')]][_0x089c('0x56')]?_0x089c('0x57')+this[_0x089c('0xd')][_0x2fa74a['uniqueid']][_0x089c('0x56')]:_0x089c('0x58'));}}}};Fax['prototype'][_0x089c('0x59')]=function(_0x8ed1da){var _0x347126=this;return new BPromise(function(_0x131b0a,_0x2a578a){_0x347126[_0x089c('0x5a')](_0x8ed1da,_0x347126[_0x089c('0x1f')][_0x8ed1da[_0x089c('0x5b')]])[_0x089c('0x4d')](function(_0x584d96){ut[_0x089c('0x48')](_0x089c('0x5c'),_0x584d96);_0x131b0a(ut[_0x089c('0x37')](_0x089c('0x5d')));})[_0x089c('0x3c')](function(_0x3df324){ut[_0x089c('0x48')]('[Fax][execOriginate][failure]',_0x3df324);updateStatus(_0x8ed1da);_0x2a578a(ut[_0x089c('0x37')](_0x089c('0x5e')));});});};Fax[_0x089c('0x19')]['checkAfterSend']=function(_0x3d3b79){var _0x3683c1=this;return new BPromise(function(_0x53514c,_0x5381fa){var _0x3bd3df=_0x3683c1[_0x089c('0x5f')](_0x3683c1[_0x089c('0x1f')][_0x3d3b79[_0x089c('0x5b')]][_0x089c('0x60')],_0x3d3b79);if(_0x3bd3df[_0x089c('0x61')]){_0x53514c(ut[_0x089c('0x37')](_0x089c('0x62')));}else{_0x5381fa(ut[_0x089c('0x37')](_0x3bd3df['message']));}});};function originate(_0xb21c3,_0x734a0c,_0x1d17b8){return new BPromise(function(_0x785b09,_0x4b4f34){if(_0x1d17b8){var _0x3f13d2=util[_0x089c('0x63')](_0x089c('0x64'),path[_0x089c('0x39')](_0xb21c3['path'])[_0x089c('0x22')],_0xb21c3[_0x089c('0x3')]);gs[_0x089c('0x65')](_0x3f13d2)['then'](function(){_0xb21c3['path']=util[_0x089c('0x63')](_0x089c('0x66'),path[_0x089c('0x39')](_0xb21c3['path'])[_0x089c('0x67')],path[_0x089c('0x39')](_0xb21c3[_0x089c('0x3')])[_0x089c('0x22')]);_0x734a0c[_0x089c('0x68')]=_0xb21c3[_0x089c('0x3')];ut[_0x089c('0x48')](_0x089c('0x69'),'');ami[_0x089c('0x6a')](ut[_0x089c('0x6b')](_0xb21c3,_0x734a0c))[_0x089c('0x4d')](function(_0x58ba29){_0x785b09(_0x58ba29);})[_0x089c('0x3c')](function(_0x534b43){_0x4b4f34(_0x534b43);});})[_0x089c('0x3c')](function(_0x22b708){_0x4b4f34(_0x22b708);});}else{ami[_0x089c('0x6a')](ut[_0x089c('0x6b')](_0xb21c3,_0x734a0c))[_0x089c('0x4d')](function(_0x370303){_0x785b09(_0x370303);})[_0x089c('0x3c')](function(_0x146042){_0x4b4f34(_0x146042);});}});}Fax[_0x089c('0x19')]['execOriginate']=function(_0xd114dc,_0x84ccde){var _0x464f68=this;return new BPromise(function(_0x4bce4f,_0x3bea1a){var _0x39f9b6=uuid['v4']();var _0x108f07=ut[_0x089c('0x6c')](_0xd114dc,_0x84ccde);_0x464f68[_0x089c('0x25')][_0x39f9b6]=new Action(_0x39f9b6,_0x84ccde,_0xd114dc);var _0xd71944=_0x464f68[_0x089c('0x25')][_0x39f9b6];if(path[_0x089c('0x39')](_0xd114dc['path'])[_0x089c('0x6d')]===_0x089c('0x3a')){originate(_0xd71944,_0x108f07,!![])[_0x089c('0x4d')](function(_0x52ebcb){_0x4bce4f(_0x52ebcb);})['catch'](function(_0x2031ea){_0x3bea1a(_0x2031ea);});}else{originate(_0xd71944,_0x108f07,![])['then'](function(_0x57aea0){_0x4bce4f(_0x57aea0);})['catch'](function(_0x42a7ba){_0x3bea1a(_0x42a7ba);});}});};Fax[_0x089c('0x19')][_0x089c('0x6e')]=function(_0x36dcaa){return!_[_0x089c('0x6f')](_0x36dcaa)&&!_['isNil'](_0x36dcaa[_0x089c('0x22')])&&!_[_0x089c('0x6f')](_0x36dcaa['active'])&&_0x36dcaa[_0x089c('0x70')]&&!_[_0x089c('0x6f')](this[_0x089c('0xe')][util[_0x089c('0x63')](_0x089c('0x71'),_0x36dcaa[_0x089c('0x22')])])&&!_['isNil'](this[_0x089c('0xe')][util['format'](_0x089c('0x71'),_0x36dcaa[_0x089c('0x22')])]['status'])&&(this[_0x089c('0xe')][util[_0x089c('0x63')](_0x089c('0x71'),_0x36dcaa['name'])]['status']===_0x089c('0x72')||this[_0x089c('0xe')][util[_0x089c('0x63')](_0x089c('0x71'),_0x36dcaa[_0x089c('0x22')])][_0x089c('0x2d')]===_0x089c('0x73'));};Fax[_0x089c('0x19')][_0x089c('0x5f')]=function(_0x161a3a,_0x28c4cb){if(!this[_0x089c('0x6e')](_0x161a3a)){ut['logger']('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0x089c('0x6f')](_0x161a3a)?'':_0x161a3a[_0x089c('0x22')]+_0x089c('0x74'));return{'isValid':![],'message':_0x089c('0x75')};}if(_['isNil'](_0x28c4cb[_0x089c('0x6')])){ut[_0x089c('0x48')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x089c('0x3e')](_0x28c4cb));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x089c('0x6f')](_0x28c4cb[_0x089c('0x3')])){ut['logger'](_0x089c('0x76'),JSON[_0x089c('0x3e')](_0x28c4cb));return{'isValid':![],'message':_0x089c('0x77')};}return{'isValid':!![],'message':_0x089c('0x78')};};module[_0x089c('0x79')]=Fax; \ No newline at end of file +var _0xadf3=['resolution','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','notify','.pdf','catch','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','reason','update','AttachmentId','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','util','bluebird','uuid','path','tiff2pdf','./util/gs','fax','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','trunks','actions','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','syncNewExten','faxstatus','receivefax','syncReceiveFax','hangup','originateresponse','syncOriginateResponse','prototype','context','faxAccounts','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred'];(function(_0xf73a3e,_0x26d4c3){var _0x43a535=function(_0x14dc3f){while(--_0x14dc3f){_0xf73a3e['push'](_0xf73a3e['shift']());}};_0x43a535(++_0x26d4c3);}(_0xadf3,0x19d));var _0x3adf=function(_0x3ad1d9,_0x4b7f98){_0x3ad1d9=_0x3ad1d9-0x0;var _0xd2066c=_0xadf3[_0x3ad1d9];return _0xd2066c;};'use strict';var util=require(_0x3adf('0x0'));var _=require('lodash');var BPromise=require(_0x3adf('0x1'));var uuid=require(_0x3adf('0x2'));var moment=require('moment');var path=require(_0x3adf('0x3'));var tiff2pdf=require(_0x3adf('0x4'));var gs=require(_0x3adf('0x5'));var logger=require('../../../config/logger')(_0x3adf('0x6'));var ami=require('../ami');var rpcDb=require(_0x3adf('0x7'));var Channel=require(_0x3adf('0x8'));var ut=require(_0x3adf('0x9'));var Action=require(_0x3adf('0xa'));var faxAccount=require(_0x3adf('0xb'));var attachment=require(_0x3adf('0xc'));var faxMessage=require(_0x3adf('0xd'));function Fax(_0x24256e){this[_0x3adf('0xe')]={};this['faxAccounts']=_0x24256e['faxAccounts'];this[_0x3adf('0xf')]=_0x24256e[_0x3adf('0xf')];this[_0x3adf('0x10')]={};ami['on']('newchannel',this[_0x3adf('0x11')][_0x3adf('0x12')](this));ami['on'](_0x3adf('0x13'),this[_0x3adf('0x14')]['bind'](this));ami['on'](_0x3adf('0x15'),this[_0x3adf('0x16')][_0x3adf('0x12')](this));ami['on']('newexten',this[_0x3adf('0x17')][_0x3adf('0x12')](this));ami['on'](_0x3adf('0x18'),this['syncFaxStatus'][_0x3adf('0x12')](this));ami['on'](_0x3adf('0x19'),this[_0x3adf('0x1a')]['bind'](this));ami['on'](_0x3adf('0x1b'),this['syncHangup'][_0x3adf('0x12')](this));ami['on'](_0x3adf('0x1c'),this[_0x3adf('0x1d')][_0x3adf('0x12')](this));}Fax[_0x3adf('0x1e')][_0x3adf('0x11')]=function(_0x5e00e1){if(_0x5e00e1[_0x3adf('0x1f')]==='from-voip-provider'){for(var _0x1bb094 in this['faxAccounts']){if(this[_0x3adf('0x20')][_0x3adf('0x21')](_0x1bb094)){if(_0x5e00e1[_0x3adf('0x22')]===this[_0x3adf('0x20')][_0x1bb094][_0x3adf('0x23')]){this[_0x3adf('0xe')][_0x5e00e1['uniqueid']]={};this[_0x3adf('0xe')][_0x5e00e1[_0x3adf('0x24')]][_0x3adf('0x25')]=_0x5e00e1[_0x3adf('0x25')];this['channels'][_0x5e00e1[_0x3adf('0x24')]]['id']=this[_0x3adf('0x20')][_0x1bb094]['id'];this[_0x3adf('0xe')][_0x5e00e1['uniqueid']][_0x3adf('0x26')]=this[_0x3adf('0x20')][_0x1bb094][_0x3adf('0x26')];logger['info'](_0x5e00e1[_0x3adf('0x24')],'\x20syncNewchannel\x20');}}}}if(this[_0x3adf('0x10')][_0x5e00e1[_0x3adf('0x24')]]){this[_0x3adf('0xe')][_0x5e00e1['uniqueid']]={};this[_0x3adf('0xe')][_0x5e00e1[_0x3adf('0x24')]]['channel']=_0x5e00e1['channel'];logger[_0x3adf('0x27')](_0x5e00e1[_0x3adf('0x24')],_0x3adf('0x28'));}};Fax[_0x3adf('0x1e')][_0x3adf('0x14')]=function(_0x5f55bd){if(this[_0x3adf('0xe')][_0x5f55bd[_0x3adf('0x24')]]){for(var _0x48f90e in _0x5f55bd['variable']){if(_0x5f55bd[_0x3adf('0x29')][_0x3adf('0x21')](_0x48f90e)){this['channels'][_0x5f55bd[_0x3adf('0x24')]][_0x48f90e]=_0x5f55bd[_0x3adf('0x2a')];}}}};Fax[_0x3adf('0x1e')][_0x3adf('0x16')]=function(_0x4ffac9){if(this[_0x3adf('0xe')][_0x4ffac9['uniqueid']]){this[_0x3adf('0xe')][_0x4ffac9[_0x3adf('0x24')]][_0x3adf('0x2b')]=_0x4ffac9[_0x3adf('0x2b')];this[_0x3adf('0xe')][_0x4ffac9['uniqueid']]['channelstatedesc']=_0x4ffac9[_0x3adf('0x2c')];}};Fax['prototype']['syncNewExten']=function(_0x9acfce){if(this[_0x3adf('0xe')][_0x9acfce[_0x3adf('0x24')]]){for(var _0x2186f8 in _0x9acfce[_0x3adf('0x29')]){if(_0x9acfce['variable'][_0x3adf('0x21')](_0x2186f8)){this[_0x3adf('0xe')][_0x9acfce[_0x3adf('0x24')]][_0x2186f8]=_0x9acfce['value'];}}}};Fax['prototype']['syncFaxStatus']=function(_0x304106){if(this[_0x3adf('0xe')][_0x304106[_0x3adf('0x24')]]){this['channels'][_0x304106[_0x3adf('0x24')]][_0x3adf('0x2d')]=_0x304106[_0x3adf('0x2d')];this['channels'][_0x304106['uniqueid']][_0x3adf('0x2e')]=_0x304106[_0x3adf('0x2e')];this[_0x3adf('0xe')][_0x304106[_0x3adf('0x24')]][_0x3adf('0x23')]=_0x304106[_0x3adf('0x23')];this['channels'][_0x304106[_0x3adf('0x24')]][_0x3adf('0x2f')]=_0x304106[_0x3adf('0x2f')];logger['info'](_0x304106['uniqueid'],_0x3adf('0x30'));}};Fax[_0x3adf('0x1e')]['syncReceiveFax']=function(_0x3b9ddc){var _0x512113=this;if(this['channels'][_0x3b9ddc[_0x3adf('0x24')]]){var _0x45ef60=this['channels'][_0x3b9ddc[_0x3adf('0x24')]]['id'];this[_0x3adf('0xe')][_0x3b9ddc[_0x3adf('0x24')]][_0x3adf('0x31')]=_0x3b9ddc[_0x3adf('0x31')];this[_0x3adf('0xe')][_0x3b9ddc[_0x3adf('0x24')]][_0x3adf('0x32')]=_0x3b9ddc[_0x3adf('0x32')];this['channels'][_0x3b9ddc['uniqueid']][_0x3adf('0x23')]=_0x3b9ddc['localstationid'];this[_0x3adf('0xe')][_0x3b9ddc[_0x3adf('0x24')]][_0x3adf('0x33')]=_0x3b9ddc[_0x3adf('0x33')];this[_0x3adf('0xe')][_0x3b9ddc[_0x3adf('0x24')]]['transferrate']=_0x3b9ddc['transferrate'];this[_0x3adf('0xe')][_0x3b9ddc[_0x3adf('0x24')]]['filename']=_0x3b9ddc[_0x3adf('0x2f')];this[_0x3adf('0xe')][_0x3b9ddc['uniqueid']][_0x3adf('0x34')]=_0x3b9ddc[_0x3adf('0x34')];if(this['channels'][_0x3b9ddc['uniqueid']][_0x3adf('0x32')]>0x0){tiff2pdf(_0x3b9ddc[_0x3adf('0x2f')],_0x3adf('0x35'),function(_0x33415e){logger[_0x3adf('0x27')](_0x3b9ddc['uniqueid'],_0x3adf('0x36'),_0x33415e[_0x3adf('0x37')]);attachment[_0x3adf('0x38')]({'name':path[_0x3adf('0x39')](_0x3b9ddc[_0x3adf('0x2f')])['name'],'basename':path[_0x3adf('0x39')](_0x3b9ddc[_0x3adf('0x2f')])[_0x3adf('0x26')]+'.pdf','type':_0x3adf('0x3a')})['then'](function(_0x16779f){faxAccount[_0x3adf('0x3b')](_0x45ef60,{'from':_0x3b9ddc[_0x3adf('0x34')],'mapKey':_0x3adf('0x6'),'body':path['parse'](_0x3b9ddc[_0x3adf('0x2f')])[_0x3adf('0x26')]+_0x3adf('0x3c'),'AttachmentId':_0x16779f['id']})[_0x3adf('0x3d')](function(_0x5c3780){logger['error'](_0x3b9ddc['uniqueid'],_0x3adf('0x3e'),JSON['stringify'](_0x5c3780));});})['catch'](function(_0x4d4894){logger['error'](_0x3b9ddc[_0x3adf('0x24')],'\x20receiveFax\x20',JSON[_0x3adf('0x3f')](_0x4d4894));});});}logger[_0x3adf('0x27')](_0x3b9ddc[_0x3adf('0x24')],_0x3adf('0x40'));}};Fax[_0x3adf('0x1e')][_0x3adf('0x1d')]=function(_0x4d12fe){if(this[_0x3adf('0x10')][_0x4d12fe[_0x3adf('0x24')]]){_[_0x3adf('0x41')](this[_0x3adf('0xe')][_0x4d12fe['uniqueid']],_[_0x3adf('0x42')](_0x4d12fe,['response',_0x3adf('0x43')]));}};function updateStatus(_0x1497c3){if(_0x1497c3['AttachmentId']){faxMessage[_0x3adf('0x44')](_0x1497c3[_0x3adf('0x45')],{'failMessage':_0x3adf('0x46')})[_0x3adf('0x47')](function(_0x5f118f){ut[_0x3adf('0x48')](_0x3adf('0x49'),_0x5f118f);})['catch'](function(_0x24ed1a){ut[_0x3adf('0x48')](_0x3adf('0x4a'),_0x24ed1a);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x3adf('0x1e')]['updateStatus']=function(_0x466d02,_0x29bf5b,_0x407bb9){var _0x875900=this;var _0x2ae315={};if(_0x29bf5b){_0x2ae315={'read':_0x29bf5b};}else{_0x2ae315={'failMessage':_0x407bb9};}if(this['actions'][_0x466d02][_0x3adf('0x45')]){faxMessage[_0x3adf('0x44')](this[_0x3adf('0x10')][_0x466d02][_0x3adf('0x45')],_0x2ae315)[_0x3adf('0x47')](function(_0x572f39){ut[_0x3adf('0x48')](_0x3adf('0x4b'),_0x572f39);})['catch'](function(_0xebf3d){ut['logger'](_0x3adf('0x4c'),_0xebf3d);})[_0x3adf('0x4d')](function(){delete _0x875900[_0x3adf('0xe')][_0x466d02];delete _0x875900[_0x3adf('0x10')][_0x466d02];});}else{ut[_0x3adf('0x48')](_0x3adf('0x4e'));delete this[_0x3adf('0xe')][_0x466d02];delete this[_0x3adf('0x10')][_0x466d02];}};Fax[_0x3adf('0x1e')][_0x3adf('0x4f')]=function(_0x2fc4b5){var _0x47d6c3=this;if(this[_0x3adf('0xe')][_0x2fc4b5[_0x3adf('0x24')]]){if(this[_0x3adf('0x10')][_0x2fc4b5[_0x3adf('0x24')]]){this['channels'][_0x2fc4b5['uniqueid']]['id']=this[_0x3adf('0x10')][_0x2fc4b5[_0x3adf('0x24')]]['id'];this[_0x3adf('0xe')][_0x2fc4b5['uniqueid']][_0x3adf('0x26')]=this[_0x3adf('0x10')][_0x2fc4b5[_0x3adf('0x24')]][_0x3adf('0x26')];}logger[_0x3adf('0x27')](_0x2fc4b5[_0x3adf('0x24')],this['actions'][_0x2fc4b5[_0x3adf('0x24')]]?_0x3adf('0x50'):_0x3adf('0x51'),JSON['stringify'](this[_0x3adf('0xe')][_0x2fc4b5[_0x3adf('0x24')]]));if(this[_0x3adf('0x10')][_0x2fc4b5['uniqueid']]){if(this['channels'][_0x2fc4b5['uniqueid']][_0x3adf('0x52')]>0x0&&this[_0x3adf('0xe')][_0x2fc4b5[_0x3adf('0x24')]]['faxstatus']===_0x3adf('0x53')){this[_0x3adf('0x54')](_0x2fc4b5[_0x3adf('0x24')],!![]);}else{this[_0x3adf('0x54')](_0x2fc4b5[_0x3adf('0x24')],![],this[_0x3adf('0xe')][_0x2fc4b5[_0x3adf('0x24')]][_0x3adf('0x55')]?_0x3adf('0x56')+this[_0x3adf('0xe')][_0x2fc4b5[_0x3adf('0x24')]][_0x3adf('0x55')]:_0x3adf('0x57'));}}}};Fax[_0x3adf('0x1e')]['send']=function(_0x57e55d){var _0xfa4152=this;return new BPromise(function(_0x94b7ac,_0x1c3e1b){_0xfa4152[_0x3adf('0x58')](_0x57e55d,_0xfa4152[_0x3adf('0x20')][_0x57e55d[_0x3adf('0x59')]])[_0x3adf('0x47')](function(_0x4c5b2d){ut[_0x3adf('0x48')]('[Fax][execOriginate][success]',_0x4c5b2d);_0x94b7ac(ut['message'](_0x3adf('0x5a')));})[_0x3adf('0x3d')](function(_0x268a78){ut[_0x3adf('0x48')]('[Fax][execOriginate][failure]',_0x268a78);updateStatus(_0x57e55d);_0x1c3e1b(ut['message'](_0x3adf('0x5b')));});});};Fax[_0x3adf('0x1e')][_0x3adf('0x5c')]=function(_0x41846a){var _0x4797da=this;return new BPromise(function(_0x582ccf,_0x35c943){var _0x2be8e2=_0x4797da[_0x3adf('0x5d')](_0x4797da[_0x3adf('0x20')][_0x41846a[_0x3adf('0x59')]][_0x3adf('0x5e')],_0x41846a);if(_0x2be8e2[_0x3adf('0x5f')]){_0x582ccf(ut[_0x3adf('0x37')]('Trunk\x20Reachable'));}else{_0x35c943(ut[_0x3adf('0x37')](_0x2be8e2[_0x3adf('0x37')]));}});};function originate(_0x3aa076,_0x5966cf,_0x2aef66){return new BPromise(function(_0x1abcd7,_0x568ffa){if(_0x2aef66){var _0x1e52b4=util[_0x3adf('0x60')](_0x3adf('0x61'),path['parse'](_0x3aa076[_0x3adf('0x3')])[_0x3adf('0x26')],_0x3aa076['path']);gs[_0x3adf('0x62')](_0x1e52b4)[_0x3adf('0x47')](function(){_0x3aa076[_0x3adf('0x3')]=util[_0x3adf('0x60')](_0x3adf('0x63'),path['parse'](_0x3aa076[_0x3adf('0x3')])[_0x3adf('0x64')],path['parse'](_0x3aa076[_0x3adf('0x3')])['name']);_0x5966cf[_0x3adf('0x65')]=_0x3aa076[_0x3adf('0x3')];ut[_0x3adf('0x48')](_0x3adf('0x66'),'');ami[_0x3adf('0x67')](ut['variablesAction'](_0x3aa076,_0x5966cf))[_0x3adf('0x47')](function(_0x35d068){_0x1abcd7(_0x35d068);})['catch'](function(_0x2abc74){_0x568ffa(_0x2abc74);});})[_0x3adf('0x3d')](function(_0x4e33df){_0x568ffa(_0x4e33df);});}else{ami[_0x3adf('0x67')](ut['variablesAction'](_0x3aa076,_0x5966cf))['then'](function(_0x8bbc71){_0x1abcd7(_0x8bbc71);})[_0x3adf('0x3d')](function(_0x482df3){_0x568ffa(_0x482df3);});}});}Fax[_0x3adf('0x1e')][_0x3adf('0x58')]=function(_0x126554,_0x162bef){var _0x2a4de1=this;return new BPromise(function(_0x1ca89f,_0xe43565){var _0x35a366=uuid['v4']();var _0x2edc93=ut['addVariables'](_0x126554,_0x162bef);_0x2a4de1[_0x3adf('0x10')][_0x35a366]=new Action(_0x35a366,_0x162bef,_0x126554);var _0x824862=_0x2a4de1['actions'][_0x35a366];if(path['parse'](_0x126554[_0x3adf('0x3')])[_0x3adf('0x68')]===_0x3adf('0x3c')){originate(_0x824862,_0x2edc93,!![])['then'](function(_0x2a601d){_0x1ca89f(_0x2a601d);})['catch'](function(_0x32d63e){_0xe43565(_0x32d63e);});}else{originate(_0x824862,_0x2edc93,![])[_0x3adf('0x47')](function(_0x5dfe11){_0x1ca89f(_0x5dfe11);})[_0x3adf('0x3d')](function(_0xe3f986){_0xe43565(_0xe3f986);});}});};Fax['prototype'][_0x3adf('0x69')]=function(_0x54747c){return!_[_0x3adf('0x6a')](_0x54747c)&&!_[_0x3adf('0x6a')](_0x54747c[_0x3adf('0x26')])&&!_[_0x3adf('0x6a')](_0x54747c[_0x3adf('0x6b')])&&_0x54747c[_0x3adf('0x6b')]&&!_[_0x3adf('0x6a')](this['trunks'][util[_0x3adf('0x60')](_0x3adf('0x6c'),_0x54747c[_0x3adf('0x26')])])&&!_[_0x3adf('0x6a')](this[_0x3adf('0xf')][util['format'](_0x3adf('0x6c'),_0x54747c[_0x3adf('0x26')])]['status'])&&(this[_0x3adf('0xf')][util[_0x3adf('0x60')](_0x3adf('0x6c'),_0x54747c['name'])][_0x3adf('0x2e')]===_0x3adf('0x6d')||this[_0x3adf('0xf')][util['format'](_0x3adf('0x6c'),_0x54747c['name'])]['status']==='unmonitored');};Fax['prototype'][_0x3adf('0x5d')]=function(_0x210592,_0x39e5f1){if(!this[_0x3adf('0x69')](_0x210592)){ut[_0x3adf('0x48')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0x3adf('0x6a')](_0x210592)?'':_0x210592[_0x3adf('0x26')]+_0x3adf('0x6e'));return{'isValid':![],'message':_0x3adf('0x6f')};}if(_[_0x3adf('0x6a')](_0x39e5f1[_0x3adf('0x6')])){ut['logger'](_0x3adf('0x70'),JSON[_0x3adf('0x3f')](_0x39e5f1));return{'isValid':![],'message':_0x3adf('0x71')};}if(_[_0x3adf('0x6a')](_0x39e5f1[_0x3adf('0x3')])){ut[_0x3adf('0x48')](_0x3adf('0x72'),JSON[_0x3adf('0x3f')](_0x39e5f1));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x3adf('0x73')};};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 041f796..f3b9f5e 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 _0xf7f3=['notify','catch','[Notify]\x20','../../../config/logger','preview','lodash','../rpc/faxAccount','inspect'];(function(_0x4b0f78,_0x5068bf){var _0x5f542e=function(_0x2c7fc5){while(--_0x2c7fc5){_0x4b0f78['push'](_0x4b0f78['shift']());}};_0x5f542e(++_0x5068bf);}(_0xf7f3,0x1b3));var _0x3f7f=function(_0x4d8fb2,_0x3cc518){_0x4d8fb2=_0x4d8fb2-0x0;var _0xc399a2=_0xf7f3[_0x4d8fb2];return _0xc399a2;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x3f7f('0x0'))(_0x3f7f('0x1'));var _=require(_0x3f7f('0x2'));var faxAccount=require(_0x3f7f('0x3'));function loggerCatch(_0x4d568b){return function(_0x26fb19){logger['error'](_0x4d568b,util[_0x3f7f('0x4')](_0x26fb19,{'showHidden':![],'depth':null}));};}exports[_0x3f7f('0x5')]=function(_0x549e36,_0x16c308){return BPromise['resolve']()['then'](faxAccount['notify'](_0x549e36,_0x16c308))[_0x3f7f('0x6')](loggerCatch(_0x3f7f('0x7')));}; \ No newline at end of file +var _0xe367=['../rpc/faxAccount','error','inspect','notify','resolve','then','[Notify]\x20','preview','lodash'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xe367,0xcd));var _0x7e36=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xe367[_0x51020b];return _0x371e47;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x7e36('0x0'));var _=require(_0x7e36('0x1'));var faxAccount=require(_0x7e36('0x2'));function loggerCatch(_0x274bc9){return function(_0x51d9b5){logger[_0x7e36('0x3')](_0x274bc9,util[_0x7e36('0x4')](_0x51d9b5,{'showHidden':![],'depth':null}));};}exports[_0x7e36('0x5')]=function(_0x5b8e75,_0x5810d0){return BPromise[_0x7e36('0x6')]()[_0x7e36('0x7')](faxAccount[_0x7e36('0x5')](_0x5b8e75,_0x5810d0))['catch'](loggerCatch(_0x7e36('0x8')));}; \ 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 ad00537..1b06fb6 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 _0xb694=['execute','info','Exec\x20gs','\x20Error\x20:','util','../../../../config/logger','bluebird','child_process','exec'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0xb694,0x16c));var _0x4b69=function(_0xc749a6,_0x1c61c8){_0xc749a6=_0xc749a6-0x0;var _0x2c976a=_0xb694[_0xc749a6];return _0x2c976a;};'use strict';var util=require(_0x4b69('0x0'));var logger=require(_0x4b69('0x1'))('fax');var BPromise=require(_0x4b69('0x2'));var exec=require(_0x4b69('0x3'))[_0x4b69('0x4')];exports[_0x4b69('0x5')]=function(_0x1986b8){return new BPromise(function(_0x508c54,_0x5dfcff){exec(_0x1986b8,function(_0x38aee4,_0x22c194,_0x55618f){logger[_0x4b69('0x6')](_0x4b69('0x7'),_0x22c194);if(_0x38aee4){logger[_0x4b69('0x6')](_0x4b69('0x7'),_0x4b69('0x8'),util['inspect'](_0x38aee4,{'showHidden':![],'depth':null}),_0x22c194,_0x55618f);_0x5dfcff(_0x38aee4);}_0x508c54(_0x22c194);});});}; \ No newline at end of file +var _0xe6b4=['util','fax','bluebird','child_process','exec','execute','Exec\x20gs','info','\x20Error\x20:','inspect'];(function(_0x2885be,_0x4847c2){var _0x410aab=function(_0x2d35de){while(--_0x2d35de){_0x2885be['push'](_0x2885be['shift']());}};_0x410aab(++_0x4847c2);}(_0xe6b4,0x1f4));var _0x4e6b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe6b4[_0x2641f9];return _0x585741;};'use strict';var util=require(_0x4e6b('0x0'));var logger=require('../../../../config/logger')(_0x4e6b('0x1'));var BPromise=require(_0x4e6b('0x2'));var exec=require(_0x4e6b('0x3'))[_0x4e6b('0x4')];exports[_0x4e6b('0x5')]=function(_0x301557){return new BPromise(function(_0x4ba3ff,_0x14f89b){exec(_0x301557,function(_0x50b6ba,_0x279b87,_0x198fc3){logger['info'](_0x4e6b('0x6'),_0x279b87);if(_0x50b6ba){logger[_0x4e6b('0x7')](_0x4e6b('0x6'),_0x4e6b('0x8'),util[_0x4e6b('0x9')](_0x50b6ba,{'showHidden':![],'depth':null}),_0x279b87,_0x198fc3);_0x14f89b(_0x50b6ba);}_0x4ba3ff(_0x279b87);});});}; \ 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 c87f9c5..7bc4c71 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 _0x82e3=['maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','info','addVariables','ecm','headerinfo','minrate'];(function(_0x384b72,_0xbc1ed1){var _0x371713=function(_0x1d6735){while(--_0x1d6735){_0x384b72['push'](_0x384b72['shift']());}};_0x371713(++_0xbc1ed1);}(_0x82e3,0x122));var _0x382e=function(_0x293493,_0x507b91){_0x293493=_0x293493-0x0;var _0x453030=_0x82e3[_0x293493];return _0x453030;};'use strict';var util=require(_0x382e('0x0'));var _=require(_0x382e('0x1'));var moment=require(_0x382e('0x2'));var logger=require(_0x382e('0x3'))(_0x382e('0x4'));exports['message']=function(_0xa82a3b){return{'message':_0xa82a3b};};exports['logger']=function(_0x12611d,_0x55bcd8){logger[_0x382e('0x5')](_0x12611d,util['inspect'](_0x55bcd8,{'showHidden':![],'depth':null}));};exports[_0x382e('0x6')]=function(_0x2a7671,_0x128d3b){var _0x3d4473={'XMF-ECM':_0x128d3b[_0x382e('0x7')],'XMF-HEADERINFO':_0x128d3b[_0x382e('0x8')],'XMF-MINRATE':_0x128d3b[_0x382e('0x9')],'XMF-MAXRATE':_0x128d3b[_0x382e('0xa')],'XMF-MODEM':util[_0x382e('0xb')](_0x382e('0xc'),_0x128d3b[_0x382e('0xd')]),'XMF-GATEWAY':_0x128d3b[_0x382e('0xe')],'XMF-FAXDETECT':_0x128d3b[_0x382e('0xf')],'XMF-T38TIMEOUT':_0x128d3b[_0x382e('0x10')],'XMF-LOCALSTATIONID':_0x128d3b[_0x382e('0x11')],'XMF-PATH':_0x2a7671['path']};return _0x3d4473;};exports[_0x382e('0x12')]=function(_0x503357,_0x20f070){return{'actionid':_0x503357[_0x382e('0x13')],'action':_0x382e('0x14'),'channel':_0x503357[_0x382e('0x15')],'Exten':_0x382e('0x16'),'Context':_0x382e('0x17'),'Priority':'1','callerid':util['format'](_0x382e('0x18'),_0x503357[_0x382e('0x8')]?_0x503357[_0x382e('0x8')]:'',_0x503357[_0x382e('0x11')]),'variable':_0x20f070,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x503357[_0x382e('0x13')]};}; \ No newline at end of file +var _0xb493=['moment','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','\x22%s\x22','gateway','t38timeout','localstationid','variablesAction','originate','channel','xcally-motion-fax','from-sip','format','util'];(function(_0x335a9a,_0x23a909){var _0x3cc723=function(_0x5cce89){while(--_0x5cce89){_0x335a9a['push'](_0x335a9a['shift']());}};_0x3cc723(++_0x23a909);}(_0xb493,0x99));var _0x3b49=function(_0x1b753c,_0x59fe55){_0x1b753c=_0x1b753c-0x0;var _0x4b2078=_0xb493[_0x1b753c];return _0x4b2078;};'use strict';var util=require(_0x3b49('0x0'));var _=require('lodash');var moment=require(_0x3b49('0x1'));var logger=require('../../../../config/logger')(_0x3b49('0x2'));exports[_0x3b49('0x3')]=function(_0x15db00){return{'message':_0x15db00};};exports[_0x3b49('0x4')]=function(_0x8229c8,_0x131e79){logger[_0x3b49('0x5')](_0x8229c8,util[_0x3b49('0x6')](_0x131e79,{'showHidden':![],'depth':null}));};exports[_0x3b49('0x7')]=function(_0x20a770,_0x41d638){var _0x1919c6={'XMF-ECM':_0x41d638[_0x3b49('0x8')],'XMF-HEADERINFO':_0x41d638[_0x3b49('0x9')],'XMF-MINRATE':_0x41d638[_0x3b49('0xa')],'XMF-MAXRATE':_0x41d638[_0x3b49('0xb')],'XMF-MODEM':util['format'](_0x3b49('0xc'),_0x41d638['modem']),'XMF-GATEWAY':_0x41d638[_0x3b49('0xd')],'XMF-FAXDETECT':_0x41d638['faxdetect'],'XMF-T38TIMEOUT':_0x41d638[_0x3b49('0xe')],'XMF-LOCALSTATIONID':_0x41d638[_0x3b49('0xf')],'XMF-PATH':_0x20a770['path']};return _0x1919c6;};exports[_0x3b49('0x10')]=function(_0x110a4e,_0x40706d){return{'actionid':_0x110a4e['uniqueid'],'action':_0x3b49('0x11'),'channel':_0x110a4e[_0x3b49('0x12')],'Exten':_0x3b49('0x13'),'Context':_0x3b49('0x14'),'Priority':'1','callerid':util[_0x3b49('0x15')]('\x22%s\x22\x20<%s>',_0x110a4e[_0x3b49('0x9')]?_0x110a4e['headerinfo']:'',_0x110a4e[_0x3b49('0xf')]),'variable':_0x40706d,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x110a4e['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index ea7474f..9524b08 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 _0xdffe=['listen','sync','[index.js][main]','inspect','util','moment','./realtime','./report','./acw','./trigger','./preview','./rpc/user','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','initVoiceQueues','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initFreshsalesAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initVoiceCallReports','catch','error','[index.js][initParams]'];(function(_0x3ccc64,_0x7293e4){var _0x3599ad=function(_0x15d68a){while(--_0x15d68a){_0x3ccc64['push'](_0x3ccc64['shift']());}};_0x3599ad(++_0x7293e4);}(_0xdffe,0xf4));var _0xedff=function(_0x277208,_0x57ab06){_0x277208=_0x277208-0x0;var _0x3e2c03=_0xdffe[_0x277208];return _0x3e2c03;};'use strict';var util=require(_0xedff('0x0'));var moment=require(_0xedff('0x1'));var server=require('./server');var Realtime=require(_0xedff('0x2'));var Report=require(_0xedff('0x3'));var Acw=require(_0xedff('0x4'));var Trigger=require(_0xedff('0x5'));var Dialer=require('./dialer');var Preview=require(_0xedff('0x6'));var Fax=require('./fax');var user=require(_0xedff('0x7'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xedff('0x8'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xedff('0x9'));var trigger=require(_0xedff('0xa'));var template=require(_0xedff('0xb'));var cmHopperHistory=require(_0xedff('0xc'));var campaign=require(_0xedff('0xd'));var voiceExtension=require(_0xedff('0xe'));var faxAccount=require(_0xedff('0xf'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xedff('0x10'));var freshdesk=require(_0xedff('0x11'));var desk=require(_0xedff('0x12'));var zoho=require(_0xedff('0x13'));var vtiger=require(_0xedff('0x14'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xedff('0x15'))(_0xedff('0x16'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xedff('0x17')](_0xedff('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xedff('0x17')](_0xedff('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xedff('0x19')]()[_0xedff('0x1a')](user[_0xedff('0x1b')]())[_0xedff('0x1a')](realtime[_0xedff('0x1c')]())[_0xedff('0x1a')](user[_0xedff('0x1d')]())[_0xedff('0x1a')](realtime[_0xedff('0x1e')]())[_0xedff('0x1a')](trunk[_0xedff('0x1f')]())[_0xedff('0x1a')](realtime[_0xedff('0x20')]())[_0xedff('0x1a')](voiceQueue['getVoiceQueues']())[_0xedff('0x1a')](realtime[_0xedff('0x21')]())[_0xedff('0x1a')](trigger['getTriggers']())[_0xedff('0x1a')](realtime['initTriggers']())[_0xedff('0x1a')](template['getTemplates']())[_0xedff('0x1a')](realtime['initTemplates']())['then'](zendesk['getZendeskAccounts']())[_0xedff('0x1a')](realtime[_0xedff('0x22')]())[_0xedff('0x1a')](salesforce[_0xedff('0x23')]())[_0xedff('0x1a')](realtime[_0xedff('0x24')]())[_0xedff('0x1a')](sugarcrm[_0xedff('0x25')]())[_0xedff('0x1a')](realtime['initSugarcrmAccounts']())[_0xedff('0x1a')](freshdesk[_0xedff('0x26')]())[_0xedff('0x1a')](realtime['initFreshdeskAccounts']())[_0xedff('0x1a')](desk[_0xedff('0x27')]())['then'](realtime[_0xedff('0x28')]())[_0xedff('0x1a')](zoho[_0xedff('0x29')]())[_0xedff('0x1a')](realtime[_0xedff('0x2a')]())[_0xedff('0x1a')](vtiger['getVtigerAccounts']())[_0xedff('0x1a')](realtime['initVtigerAccounts']())[_0xedff('0x1a')](freshsales['getFreshsalesAccounts']())[_0xedff('0x1a')](realtime[_0xedff('0x2b')]())[_0xedff('0x1a')](servicenow['getServicenowAccounts']())[_0xedff('0x1a')](realtime['initServicenowAccounts']())['then'](dynamics365[_0xedff('0x2c')]())[_0xedff('0x1a')](realtime[_0xedff('0x2d')]())[_0xedff('0x1a')](campaign[_0xedff('0x2e')]())[_0xedff('0x1a')](realtime[_0xedff('0x2f')]())[_0xedff('0x1a')](voiceExtension[_0xedff('0x30')]())[_0xedff('0x1a')](realtime['initVoiceExtensions']())['then'](faxAccount['getFaxAccounts']())[_0xedff('0x1a')](realtime['initFaxAccounts']())[_0xedff('0x1a')](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0xedff('0x1a')](voiceQueueReport[_0xedff('0x31')]())[_0xedff('0x1a')](realtime['initVoiceQueueReports']())[_0xedff('0x1a')](cmHopperHistory[_0xedff('0x32')]())[_0xedff('0x1a')](realtime['initVoiceQueueHopperHistory']())[_0xedff('0x1a')](cmHopperHistory[_0xedff('0x33')]())[_0xedff('0x1a')](realtime['initCampaignHopperHistory']())['then'](voiceCallReport['getVoiceCallReports']())['then'](realtime[_0xedff('0x34')]())[_0xedff('0x35')](function(_0x4ea475){logger[_0xedff('0x36')](_0xedff('0x37'),util['inspect'](_0x4ea475,{'showHidden':![],'depth':null}));});}function main(){return server[_0xedff('0x38')](realtime,preview,fax)[_0xedff('0x1a')](function(){return initRealtime();})[_0xedff('0x1a')](function(){return initParams();})['then'](function(){report[_0xedff('0x39')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x47ddcc){logger[_0xedff('0x36')](_0xedff('0x3a'),util[_0xedff('0x3b')](_0x47ddcc,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x1b05=['ami','get','hour','then','getAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','moment','./server','./report','./acw','./dialer','./preview','./fax','./rpc/user','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./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/servicenow','./rpc/integrations/dynamics365','../../config/logger'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x1b05,0x119));var _0x51b0=function(_0x3cf836,_0x125305){_0x3cf836=_0x3cf836-0x0;var _0x1fbc90=_0x1b05[_0x3cf836];return _0x1fbc90;};'use strict';var util=require(_0x51b0('0x0'));var moment=require(_0x51b0('0x1'));var server=require(_0x51b0('0x2'));var Realtime=require('./realtime');var Report=require(_0x51b0('0x3'));var Acw=require(_0x51b0('0x4'));var Trigger=require('./trigger');var Dialer=require(_0x51b0('0x5'));var Preview=require(_0x51b0('0x6'));var Fax=require(_0x51b0('0x7'));var user=require(_0x51b0('0x8'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x51b0('0x9'));var trunk=require(_0x51b0('0xa'));var trigger=require(_0x51b0('0xb'));var template=require(_0x51b0('0xc'));var cmHopperHistory=require(_0x51b0('0xd'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x51b0('0xe'));var faxAccount=require(_0x51b0('0xf'));var zendesk=require(_0x51b0('0x10'));var salesforce=require(_0x51b0('0x11'));var sugarcrm=require(_0x51b0('0x12'));var freshdesk=require(_0x51b0('0x13'));var desk=require(_0x51b0('0x14'));var zoho=require(_0x51b0('0x15'));var vtiger=require(_0x51b0('0x16'));var freshsales=require(_0x51b0('0x17'));var servicenow=require(_0x51b0('0x18'));var dynamics365=require(_0x51b0('0x19'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x51b0('0x1a'))(_0x51b0('0x1b'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x51b0('0x1c')](_0x51b0('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x51b0('0x1c')](_0x51b0('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0x51b0('0x1e')](user[_0x51b0('0x1f')]())['then'](realtime['initAgents']())[_0x51b0('0x1e')](user[_0x51b0('0x20')]())['then'](realtime[_0x51b0('0x21')]())[_0x51b0('0x1e')](trunk['getTrunks']())[_0x51b0('0x1e')](realtime[_0x51b0('0x22')]())[_0x51b0('0x1e')](voiceQueue[_0x51b0('0x23')]())[_0x51b0('0x1e')](realtime[_0x51b0('0x24')]())[_0x51b0('0x1e')](trigger['getTriggers']())['then'](realtime[_0x51b0('0x25')]())[_0x51b0('0x1e')](template[_0x51b0('0x26')]())[_0x51b0('0x1e')](realtime[_0x51b0('0x27')]())[_0x51b0('0x1e')](zendesk[_0x51b0('0x28')]())['then'](realtime[_0x51b0('0x29')]())[_0x51b0('0x1e')](salesforce[_0x51b0('0x2a')]())[_0x51b0('0x1e')](realtime[_0x51b0('0x2b')]())[_0x51b0('0x1e')](sugarcrm[_0x51b0('0x2c')]())[_0x51b0('0x1e')](realtime[_0x51b0('0x2d')]())[_0x51b0('0x1e')](freshdesk[_0x51b0('0x2e')]())['then'](realtime[_0x51b0('0x2f')]())[_0x51b0('0x1e')](desk[_0x51b0('0x30')]())[_0x51b0('0x1e')](realtime[_0x51b0('0x31')]())[_0x51b0('0x1e')](zoho[_0x51b0('0x32')]())[_0x51b0('0x1e')](realtime[_0x51b0('0x33')]())[_0x51b0('0x1e')](vtiger[_0x51b0('0x34')]())[_0x51b0('0x1e')](realtime[_0x51b0('0x35')]())[_0x51b0('0x1e')](freshsales[_0x51b0('0x36')]())[_0x51b0('0x1e')](realtime[_0x51b0('0x37')]())[_0x51b0('0x1e')](servicenow['getServicenowAccounts']())[_0x51b0('0x1e')](realtime[_0x51b0('0x38')]())[_0x51b0('0x1e')](dynamics365['getDynamics365Accounts']())[_0x51b0('0x1e')](realtime[_0x51b0('0x39')]())[_0x51b0('0x1e')](campaign['getCampaigns']())[_0x51b0('0x1e')](realtime[_0x51b0('0x3a')]())['then'](voiceExtension[_0x51b0('0x3b')]())['then'](realtime[_0x51b0('0x3c')]())[_0x51b0('0x1e')](faxAccount[_0x51b0('0x3d')]())['then'](realtime[_0x51b0('0x3e')]())[_0x51b0('0x1e')](function(){return realtime;});}function initParams(){return Promise['resolve']()['then'](voiceQueueReport[_0x51b0('0x3f')]())[_0x51b0('0x1e')](realtime[_0x51b0('0x40')]())[_0x51b0('0x1e')](cmHopperHistory[_0x51b0('0x41')]())[_0x51b0('0x1e')](realtime[_0x51b0('0x42')]())[_0x51b0('0x1e')](cmHopperHistory[_0x51b0('0x43')]())['then'](realtime[_0x51b0('0x44')]())[_0x51b0('0x1e')](voiceCallReport['getVoiceCallReports']())['then'](realtime[_0x51b0('0x45')]())[_0x51b0('0x46')](function(_0x539192){logger[_0x51b0('0x47')](_0x51b0('0x48'),util[_0x51b0('0x49')](_0x539192,{'showHidden':![],'depth':null}));});}function main(){return server[_0x51b0('0x4a')](realtime,preview,fax)[_0x51b0('0x1e')](function(){return initRealtime();})[_0x51b0('0x1e')](function(){return initParams();})['then'](function(){report[_0x51b0('0x4b')]();setInterval(initRealtime,0x1388);})[_0x51b0('0x46')](function(_0x24c153){logger[_0x51b0('0x47')](_0x51b0('0x4c'),util[_0x51b0('0x49')](_0x24c153,{'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 45404de..765bf4b 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 _0x357c=['updateStatusRealtime','state','toLowerCase','not_inuse','idle','talking','voiceStatus','statePause','toNumber','format','interface','user:%s','emit','user:save','user:presence','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','phone','mobile','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype'];(function(_0xc340b4,_0x5b93a0){var _0x686db8=function(_0x382839){while(--_0x382839){_0xc340b4['push'](_0xc340b4['shift']());}};_0x686db8(++_0x5b93a0);}(_0x357c,0x150));var _0xc357=function(_0x191154,_0x56f74c){_0x191154=_0x191154-0x0;var _0x3dcd73=_0x357c[_0x191154];return _0x3dcd73;};'use strict';var _=require(_0xc357('0x0'));var util=require('util');var moment=require('moment');var md5=require(_0xc357('0x1'));var Redis=require(_0xc357('0x2'));var config=require(_0xc357('0x3'));config[_0xc357('0x4')]=_[_0xc357('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xc357('0x6'))(new Redis(config[_0xc357('0x4')]));function Agent(_0x57cec3){this['id']=_0x57cec3['id']||0x0;this[_0xc357('0x7')]=_0x57cec3[_0xc357('0x7')]||'';this[_0xc357('0x8')]=_0x57cec3[_0xc357('0x8')]||'';this[_0xc357('0x9')]=_0x57cec3[_0xc357('0x9')]||'';this[_0xc357('0xa')]=_0x57cec3[_0xc357('0xa')]||'';this['state']=_0xc357('0xb');this[_0xc357('0xc')]=0x0;this[_0xc357('0xd')]=_0xc357('0xb');this[_0xc357('0xe')]='';this[_0xc357('0xf')]='';this[_0xc357('0x10')]='';this['interface']='';this[_0xc357('0x11')]=_0x57cec3['online']||![];this['voiceStatus']=_0xc357('0xb');this[_0xc357('0x12')]=0x0;this[_0xc357('0x13')]='';this[_0xc357('0x14')]='';this[_0xc357('0x15')]=![];this[_0xc357('0x16')]=![];this[_0xc357('0x1')]='';}Agent[_0xc357('0x17')][_0xc357('0x18')]=function(_0x5c5b48){var _0x952a34;if(_0x5c5b48&&_0x5c5b48[_0xc357('0x19')]){_0x952a34=_0x5c5b48[_0xc357('0x19')][_0xc357('0x1a')]();switch(_0x952a34){case _0xc357('0x1b'):_0x952a34=_0xc357('0x1c');break;case'inuse':_0x952a34=_0xc357('0x1d');break;}}if(_0x952a34&&this[_0xc357('0x1e')]!==_0x952a34||_0x5c5b48[_0xc357('0x1f')]){this[_0xc357('0x12')]=_[_0xc357('0x20')](moment()[_0xc357('0x21')]('x'));}if(_0x952a34){this[_0xc357('0x1e')]=_0x952a34;}var _0x3a3b84={'id':this['id'],'name':this[_0xc357('0x7')],'email':this[_0xc357('0x8')],'accountcode':this['accountcode'],'fullname':this[_0xc357('0xa')],'state':this[_0xc357('0x19')],'stateTime':this[_0xc357('0xc')],'status':this[_0xc357('0xd')],'address':this['address'],'online':this[_0xc357('0x11')],'voiceStatus':this[_0xc357('0x1e')],'voiceStatusTime':this[_0xc357('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0xc357('0x14')],'interface':this[_0xc357('0x22')],'onhold':this[_0xc357('0x15')]};var _0x519ab1=md5(JSON['stringify'](_0x3a3b84));if(this[_0xc357('0x1')]!==_0x519ab1){this[_0xc357('0x1')]=_0x519ab1;io['to'](util[_0xc357('0x21')](_0xc357('0x23'),_0x3a3b84[_0xc357('0x7')]))[_0xc357('0x24')](_0xc357('0x25'),_0x3a3b84);io['emit'](_0xc357('0x26'),_0x3a3b84);}};module[_0xc357('0x27')]=Agent; \ No newline at end of file +var _0xb618=['redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','status','address','phone','mobile','online','voiceStatus','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','not_inuse','inuse','talking','voiceStatusTime','toNumber','format','stateTime','voiceStatusCallerIdNumber','interface','stringify','emit','user:save','user:presence','lodash','util','moment','md5','../../../config/environment'];(function(_0x2c22d2,_0x399ce1){var _0x42988c=function(_0xfa94f4){while(--_0xfa94f4){_0x2c22d2['push'](_0x2c22d2['shift']());}};_0x42988c(++_0x399ce1);}(_0xb618,0x15a));var _0x8b61=function(_0x28f814,_0x1c61e1){_0x28f814=_0x28f814-0x0;var _0x4b39b1=_0xb618[_0x28f814];return _0x4b39b1;};'use strict';var _=require(_0x8b61('0x0'));var util=require(_0x8b61('0x1'));var moment=require(_0x8b61('0x2'));var md5=require(_0x8b61('0x3'));var Redis=require('ioredis');var config=require(_0x8b61('0x4'));config[_0x8b61('0x5')]=_[_0x8b61('0x6')](config[_0x8b61('0x5')],{'host':_0x8b61('0x7'),'port':0x18eb});var io=require(_0x8b61('0x8'))(new Redis(config[_0x8b61('0x5')]));function Agent(_0x3655ae){this['id']=_0x3655ae['id']||0x0;this[_0x8b61('0x9')]=_0x3655ae[_0x8b61('0x9')]||'';this['email']=_0x3655ae[_0x8b61('0xa')]||'';this['accountcode']=_0x3655ae[_0x8b61('0xb')]||'';this[_0x8b61('0xc')]=_0x3655ae['fullname']||'';this[_0x8b61('0xd')]=_0x8b61('0xe');this['stateTime']=0x0;this[_0x8b61('0xf')]=_0x8b61('0xe');this[_0x8b61('0x10')]='';this[_0x8b61('0x11')]='';this[_0x8b61('0x12')]='';this['interface']='';this[_0x8b61('0x13')]=_0x3655ae['online']||![];this[_0x8b61('0x14')]=_0x8b61('0xe');this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x8b61('0x15')]='';this[_0x8b61('0x16')]=![];this[_0x8b61('0x17')]=![];this['md5']='';}Agent[_0x8b61('0x18')][_0x8b61('0x19')]=function(_0x2ff5a1){var _0x5b1869;if(_0x2ff5a1&&_0x2ff5a1['state']){_0x5b1869=_0x2ff5a1[_0x8b61('0xd')]['toLowerCase']();switch(_0x5b1869){case _0x8b61('0x1a'):_0x5b1869='idle';break;case _0x8b61('0x1b'):_0x5b1869=_0x8b61('0x1c');break;}}if(_0x5b1869&&this['voiceStatus']!==_0x5b1869||_0x2ff5a1['statePause']){this[_0x8b61('0x1d')]=_[_0x8b61('0x1e')](moment()[_0x8b61('0x1f')]('x'));}if(_0x5b1869){this[_0x8b61('0x14')]=_0x5b1869;}var _0x32c7fe={'id':this['id'],'name':this[_0x8b61('0x9')],'email':this[_0x8b61('0xa')],'accountcode':this['accountcode'],'fullname':this[_0x8b61('0xc')],'state':this[_0x8b61('0xd')],'stateTime':this[_0x8b61('0x20')],'status':this[_0x8b61('0xf')],'address':this[_0x8b61('0x10')],'online':this[_0x8b61('0x13')],'voiceStatus':this[_0x8b61('0x14')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x8b61('0x21')],'voiceStatusQueue':this[_0x8b61('0x15')],'interface':this[_0x8b61('0x22')],'onhold':this[_0x8b61('0x16')]};var _0xc7ba85=md5(JSON[_0x8b61('0x23')](_0x32c7fe));if(this[_0x8b61('0x3')]!==_0xc7ba85){this[_0x8b61('0x3')]=_0xc7ba85;io['to'](util[_0x8b61('0x1f')]('user:%s',_0x32c7fe['name']))[_0x8b61('0x24')](_0x8b61('0x25'),_0x32c7fe);io[_0x8b61('0x24')](_0x8b61('0x26'),_0x32c7fe);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 382acae..0053bac 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 _0x125e=['ivrTotalCallsDays','message','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','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','campaign','originated','temp','ivrAnswerCallsDay'];(function(_0xd4e399,_0x4a8481){var _0x1186c9=function(_0x48aa19){while(--_0x48aa19){_0xd4e399['push'](_0xd4e399['shift']());}};_0x1186c9(++_0x4a8481);}(_0x125e,0x1cf));var _0xe125=function(_0x48d7aa,_0x52349c){_0x48d7aa=_0x48d7aa-0x0;var _0x138fc6=_0x125e[_0x48d7aa];return _0x138fc6;};'use strict';function Campaign(_0xc82129){this['id']=_0xc82129['id']||0x0;this[_0xe125('0x0')]=_0xc82129['name']||'';this['type']=_0xc82129['type']||_0xe125('0x1');this[_0xe125('0x2')]=0x0;this[_0xe125('0x3')]=0x0;this[_0xe125('0x4')]=0x0;this[_0xe125('0x5')]=0x0;this[_0xe125('0x6')]='';this[_0xe125('0x7')]=!![];this[_0xe125('0x8')]=_0xc82129[_0xe125('0x8')];this[_0xe125('0x9')]=_0xc82129[_0xe125('0x9')];this[_0xe125('0xa')]=_0xc82129['dialTimezone']||null;this[_0xe125('0xb')]=_0xc82129[_0xe125('0xb')]?_0xc82129['dialGlobalInterval']:null;this[_0xe125('0xc')]=_0xc82129[_0xe125('0xc')];this[_0xe125('0xd')]=_0xc82129[_0xe125('0xd')];this[_0xe125('0xe')]=_0xc82129[_0xe125('0xe')]||0x1e;this['dialCongestionMaxRetry']=_0xc82129[_0xe125('0xf')];this[_0xe125('0x10')]=_0xc82129['dialCongestionRetryFrequency'];this[_0xe125('0x11')]=_0xc82129[_0xe125('0x11')];this[_0xe125('0x12')]=_0xc82129[_0xe125('0x12')];this['dialNoAnswerMaxRetry']=_0xc82129[_0xe125('0x13')];this[_0xe125('0x14')]=_0xc82129[_0xe125('0x14')];this[_0xe125('0x15')]=_0xc82129['dialGlobalMaxRetry'];this[_0xe125('0x16')]=_0xc82129[_0xe125('0x16')]||0x3;this[_0xe125('0x17')]=_0xc82129[_0xe125('0x17')]||0x96;this[_0xe125('0x18')]=_0xc82129[_0xe125('0x18')]||0x3;this[_0xe125('0x19')]=_0xc82129[_0xe125('0x19')]||0x96;this[_0xe125('0x1a')]=_0xc82129[_0xe125('0x1a')]||0x3;this[_0xe125('0x1b')]=_0xc82129[_0xe125('0x1b')]||0x96;this['dialMachineMaxRetry']=_0xc82129[_0xe125('0x1c')]||0x3;this[_0xe125('0x1d')]=_0xc82129[_0xe125('0x1d')]||0x96;this[_0xe125('0x1e')]=_0xc82129[_0xe125('0x1e')]||0x3;this[_0xe125('0x1f')]=_0xc82129[_0xe125('0x1f')]||0x96;this[_0xe125('0x20')]=_0xc82129['dialOrderByScheduledAt']||_0xe125('0x21');this[_0xe125('0x22')]=_0xc82129['dialPrefix']||undefined;this[_0xe125('0x23')]=_0xc82129[_0xe125('0x23')]||undefined;this[_0xe125('0x24')]=_0xc82129['dialCutDigit']||undefined;this[_0xe125('0x25')]=_0xc82129['TrunkBackup']?_0xc82129[_0xe125('0x25')]:undefined;this[_0xe125('0x26')]=_0xc82129[_0xe125('0x26')]?_0xc82129[_0xe125('0x26')]:undefined;this[_0xe125('0x27')]=_0xc82129['Interval']?_0xc82129[_0xe125('0x27')]:undefined;this['SquareProject']=_0xc82129[_0xe125('0x28')]?_0xc82129[_0xe125('0x28')]:undefined;this[_0xe125('0x29')]=_0xc82129['SquareProject']?_0xc82129[_0xe125('0x28')][_0xe125('0x0')]:undefined;this['dialAMDActive']=_0xc82129[_0xe125('0x2a')]||![];this[_0xe125('0x2b')]=_0xc82129[_0xe125('0x2b')];this['dialAMDGreeting']=_0xc82129[_0xe125('0x2c')];this['dialAMDAfterGreetingSilence']=_0xc82129[_0xe125('0x2d')];this[_0xe125('0x2e')]=_0xc82129[_0xe125('0x2e')];this[_0xe125('0x2f')]=_0xc82129[_0xe125('0x2f')];this[_0xe125('0x30')]=_0xc82129[_0xe125('0x30')];this['dialAMDMaximumNumberOfWords']=_0xc82129['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0xc82129[_0xe125('0x31')];this[_0xe125('0x32')]=_0xc82129[_0xe125('0x32')];}module[_0xe125('0x33')]=Campaign; \ No newline at end of file +var _0xeb44=['dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency'];(function(_0xc40b9f,_0x17ec1f){var _0x535b9c=function(_0x591b19){while(--_0x591b19){_0xc40b9f['push'](_0xc40b9f['shift']());}};_0x535b9c(++_0x17ec1f);}(_0xeb44,0x134));var _0x4eb4=function(_0x11be7d,_0x58724b){_0x11be7d=_0x11be7d-0x0;var _0x3384b0=_0xeb44[_0x11be7d];return _0x3384b0;};'use strict';function Campaign(_0x1d1f8f){this['id']=_0x1d1f8f['id']||0x0;this[_0x4eb4('0x0')]=_0x1d1f8f[_0x4eb4('0x0')]||'';this[_0x4eb4('0x1')]=_0x1d1f8f[_0x4eb4('0x1')]||_0x4eb4('0x2');this[_0x4eb4('0x3')]=0x0;this['temp']=0x0;this[_0x4eb4('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x4eb4('0x5')]='';this[_0x4eb4('0x6')]=!![];this[_0x4eb4('0x7')]=_0x1d1f8f[_0x4eb4('0x7')];this[_0x4eb4('0x8')]=_0x1d1f8f[_0x4eb4('0x8')];this[_0x4eb4('0x9')]=_0x1d1f8f[_0x4eb4('0x9')]||null;this[_0x4eb4('0xa')]=_0x1d1f8f[_0x4eb4('0xa')]?_0x1d1f8f[_0x4eb4('0xa')]:null;this[_0x4eb4('0xb')]=_0x1d1f8f[_0x4eb4('0xb')];this[_0x4eb4('0xc')]=_0x1d1f8f[_0x4eb4('0xc')];this[_0x4eb4('0xd')]=_0x1d1f8f[_0x4eb4('0xd')]||0x1e;this[_0x4eb4('0xe')]=_0x1d1f8f[_0x4eb4('0xe')];this[_0x4eb4('0xf')]=_0x1d1f8f['dialCongestionRetryFrequency'];this[_0x4eb4('0x10')]=_0x1d1f8f[_0x4eb4('0x10')];this[_0x4eb4('0x11')]=_0x1d1f8f[_0x4eb4('0x11')];this[_0x4eb4('0x12')]=_0x1d1f8f['dialNoAnswerMaxRetry'];this[_0x4eb4('0x13')]=_0x1d1f8f['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x1d1f8f[_0x4eb4('0x14')];this[_0x4eb4('0x15')]=_0x1d1f8f['dialNoSuchNumberMaxRetry']||0x3;this[_0x4eb4('0x16')]=_0x1d1f8f[_0x4eb4('0x16')]||0x96;this['dialDropMaxRetry']=_0x1d1f8f['dialDropMaxRetry']||0x3;this[_0x4eb4('0x17')]=_0x1d1f8f[_0x4eb4('0x17')]||0x96;this['dialAbandonedMaxRetry']=_0x1d1f8f[_0x4eb4('0x18')]||0x3;this[_0x4eb4('0x19')]=_0x1d1f8f[_0x4eb4('0x19')]||0x96;this[_0x4eb4('0x1a')]=_0x1d1f8f[_0x4eb4('0x1a')]||0x3;this[_0x4eb4('0x1b')]=_0x1d1f8f['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x1d1f8f[_0x4eb4('0x1c')]||0x3;this['dialAgentRejectRetryFrequency']=_0x1d1f8f[_0x4eb4('0x1d')]||0x96;this[_0x4eb4('0x1e')]=_0x1d1f8f[_0x4eb4('0x1e')]||'DESC';this[_0x4eb4('0x1f')]=_0x1d1f8f[_0x4eb4('0x1f')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x1d1f8f[_0x4eb4('0x20')]||undefined;this['dialCutDigit']=_0x1d1f8f['dialCutDigit']||undefined;this[_0x4eb4('0x21')]=_0x1d1f8f['TrunkBackup']?_0x1d1f8f[_0x4eb4('0x21')]:undefined;this[_0x4eb4('0x22')]=_0x1d1f8f[_0x4eb4('0x22')]?_0x1d1f8f[_0x4eb4('0x22')]:undefined;this[_0x4eb4('0x23')]=_0x1d1f8f[_0x4eb4('0x23')]?_0x1d1f8f[_0x4eb4('0x23')]:undefined;this[_0x4eb4('0x24')]=_0x1d1f8f[_0x4eb4('0x24')]?_0x1d1f8f['SquareProject']:undefined;this[_0x4eb4('0x25')]=_0x1d1f8f[_0x4eb4('0x24')]?_0x1d1f8f['SquareProject'][_0x4eb4('0x0')]:undefined;this[_0x4eb4('0x26')]=_0x1d1f8f[_0x4eb4('0x26')]||![];this[_0x4eb4('0x27')]=_0x1d1f8f[_0x4eb4('0x27')];this[_0x4eb4('0x28')]=_0x1d1f8f[_0x4eb4('0x28')];this[_0x4eb4('0x29')]=_0x1d1f8f['dialAMDAfterGreetingSilence'];this[_0x4eb4('0x2a')]=_0x1d1f8f[_0x4eb4('0x2a')];this['dialAMDMinWordLength']=_0x1d1f8f[_0x4eb4('0x2b')];this[_0x4eb4('0x2c')]=_0x1d1f8f[_0x4eb4('0x2c')];this[_0x4eb4('0x2d')]=_0x1d1f8f[_0x4eb4('0x2d')];this[_0x4eb4('0x2e')]=_0x1d1f8f[_0x4eb4('0x2e')];this[_0x4eb4('0x2f')]=_0x1d1f8f['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 382bcbb..05002dc 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 _0x3c6a=['context','uniqueid','linkedid','exten','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','monitor','queue','monitors','transfercalleridnum','exports','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode'];(function(_0x281e5e,_0xf320e2){var _0x5a22d2=function(_0x405ff9){while(--_0x405ff9){_0x281e5e['push'](_0x281e5e['shift']());}};_0x5a22d2(++_0xf320e2);}(_0x3c6a,0xd1));var _0xa3c6=function(_0x1d04b5,_0x30792c){_0x1d04b5=_0x1d04b5-0x0;var _0x161342=_0x3c6a[_0x1d04b5];return _0x161342;};'use strict';function Channel(){this['starttime']=null;this[_0xa3c6('0x0')]='';this[_0xa3c6('0x1')]='';this[_0xa3c6('0x2')]=0x0;this[_0xa3c6('0x3')]='';this[_0xa3c6('0x4')]=undefined;this[_0xa3c6('0x5')]=undefined;this[_0xa3c6('0x6')]=0x0;this[_0xa3c6('0x7')]='';this[_0xa3c6('0x8')]=0x0;this[_0xa3c6('0x9')]=0x0;this[_0xa3c6('0xa')]=0x0;this['answered']=![];this[_0xa3c6('0xb')]=null;this[_0xa3c6('0xc')]=null;this[_0xa3c6('0xd')]=![];this[_0xa3c6('0xe')]=![];this[_0xa3c6('0xf')]='';this[_0xa3c6('0x10')]='';this[_0xa3c6('0x11')]=0x0;this[_0xa3c6('0x12')]=0x0;this[_0xa3c6('0x13')]=0x0;this[_0xa3c6('0x14')]=null;this[_0xa3c6('0x15')]=null;this['disposition']=null;this[_0xa3c6('0x16')]=![];this['monitorFilename']=null;this[_0xa3c6('0x17')]=null;this[_0xa3c6('0x18')]=[];this[_0xa3c6('0x19')]=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this['mohtime']=0x0;}module[_0xa3c6('0x1a')]=Channel; \ No newline at end of file +var _0x1af1=['tag','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','exten','answertime','abandoned','lastdata','billableseconds','holdtime','type'];(function(_0xb4d24a,_0x57953e){var _0x1e65b5=function(_0x5a47f9){while(--_0x5a47f9){_0xb4d24a['push'](_0xb4d24a['shift']());}};_0x1e65b5(++_0x57953e);}(_0x1af1,0x133));var _0x11af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1af1[_0x3dd15e];return _0x231fd0;};'use strict';function Channel(){this[_0x11af('0x0')]=null;this[_0x11af('0x1')]='';this[_0x11af('0x2')]='';this[_0x11af('0x3')]=0x0;this[_0x11af('0x4')]='';this[_0x11af('0x5')]=undefined;this[_0x11af('0x6')]=undefined;this[_0x11af('0x7')]=0x0;this[_0x11af('0x8')]='';this[_0x11af('0x9')]=0x0;this['linkedid']=0x0;this[_0x11af('0xa')]=0x0;this['answered']=![];this[_0x11af('0xb')]=null;this['endtime']=null;this['unmanaged']=![];this[_0x11af('0xc')]=![];this['lastapplication']='';this[_0x11af('0xd')]='';this['duration']=0x0;this[_0x11af('0xe')]=0x0;this[_0x11af('0xf')]=0x0;this[_0x11af('0x10')]=null;this[_0x11af('0x11')]=null;this['disposition']=null;this[_0x11af('0x12')]=![];this[_0x11af('0x13')]=null;this[_0x11af('0x14')]=null;this[_0x11af('0x15')]=[];this[_0x11af('0x16')]=undefined;this[_0x11af('0x17')]=undefined;this[_0x11af('0x18')]=undefined;this[_0x11af('0x19')]=0x0;}module[_0x11af('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 1f02e17..5074451 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 _0xc8b8=['exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations'];(function(_0x2f3a46,_0x25335f){var _0x98fa2f=function(_0x377b08){while(--_0x377b08){_0x2f3a46['push'](_0x2f3a46['shift']());}};_0x98fa2f(++_0x25335f);}(_0xc8b8,0x12c));var _0x8c8b=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0xc8b8[_0x4a7631];return _0x1a5a6f;};'use strict';function DeskAccount(_0x4c463a){this['id']=_0x4c463a['id']||0x0;this[_0x8c8b('0x0')]=_0x4c463a[_0x8c8b('0x0')]||'';this[_0x8c8b('0x1')]=_0x4c463a[_0x8c8b('0x1')]||'';this[_0x8c8b('0x2')]=_0x4c463a[_0x8c8b('0x2')]||'';this[_0x8c8b('0x3')]=_0x4c463a[_0x8c8b('0x3')]||'';this['password']=_0x4c463a[_0x8c8b('0x4')]||'';this[_0x8c8b('0x5')]=_0x4c463a[_0x8c8b('0x5')]||'';this[_0x8c8b('0x6')]=_0x4c463a[_0x8c8b('0x6')]||'';this[_0x8c8b('0x7')]=_0x4c463a[_0x8c8b('0x7')]||'';this[_0x8c8b('0x8')]=_0x4c463a[_0x8c8b('0x8')]||'';this[_0x8c8b('0x9')]=_0x4c463a[_0x8c8b('0x9')]||'';this[_0x8c8b('0xa')]=_0x4c463a[_0x8c8b('0xa')]||'';this[_0x8c8b('0xb')]=_0x4c463a[_0x8c8b('0xb')]||{};}module[_0x8c8b('0xc')]=DeskAccount; \ No newline at end of file +var _0x132d=['tokenSecret','type','serverUrl','name','username','remoteUri','authType','password','consumerSecret','token'];(function(_0xcca4,_0x2b6351){var _0x432a4a=function(_0x2388bf){while(--_0x2388bf){_0xcca4['push'](_0xcca4['shift']());}};_0x432a4a(++_0x2b6351);}(_0x132d,0x107));var _0xd132=function(_0x2bed2f,_0x6f4d5f){_0x2bed2f=_0x2bed2f-0x0;var _0x2c70be=_0x132d[_0x2bed2f];return _0x2c70be;};'use strict';function DeskAccount(_0x187a9a){this['id']=_0x187a9a['id']||0x0;this[_0xd132('0x0')]=_0x187a9a[_0xd132('0x0')]||'';this[_0xd132('0x1')]=_0x187a9a[_0xd132('0x1')]||'';this[_0xd132('0x2')]=_0x187a9a[_0xd132('0x2')]||'';this[_0xd132('0x3')]=_0x187a9a['authType']||'';this['password']=_0x187a9a[_0xd132('0x4')]||'';this['consumerKey']=_0x187a9a['consumerKey']||'';this[_0xd132('0x5')]=_0x187a9a[_0xd132('0x5')]||'';this[_0xd132('0x6')]=_0x187a9a[_0xd132('0x6')]||'';this[_0xd132('0x7')]=_0x187a9a['tokenSecret']||'';this[_0xd132('0x8')]=_0x187a9a[_0xd132('0x8')]||'';this[_0xd132('0x9')]=_0x187a9a[_0xd132('0x9')]||'';this['Configurations']=_0x187a9a['Configurations']||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 0269a7e..4bffe79 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 _0x3b67=['remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password'];(function(_0x2bc00e,_0xc847fb){var _0x7f9249=function(_0x44b7f0){while(--_0x44b7f0){_0x2bc00e['push'](_0x2bc00e['shift']());}};_0x7f9249(++_0xc847fb);}(_0x3b67,0x171));var _0x73b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3b67[_0x3dd15e];return _0x231fd0;};'use strict';function Dynamics365Account(_0x5e4ffc){this['id']=_0x5e4ffc['id']||0x0;this[_0x73b6('0x0')]=_0x5e4ffc[_0x73b6('0x0')]||'';this[_0x73b6('0x1')]=_0x5e4ffc[_0x73b6('0x1')]||'';this['password']=_0x5e4ffc[_0x73b6('0x2')]||'';this[_0x73b6('0x3')]=_0x5e4ffc['remoteUri']||'';this[_0x73b6('0x4')]=_0x5e4ffc[_0x73b6('0x4')]||'';this[_0x73b6('0x5')]=_0x5e4ffc[_0x73b6('0x5')]||'';this[_0x73b6('0x6')]=_0x5e4ffc[_0x73b6('0x6')]||{};this[_0x73b6('0x7')]=_0x5e4ffc['serverUrl']||'';this[_0x73b6('0x8')]=_0x5e4ffc['modernAuthentication']||![];this[_0x73b6('0x9')]=_0x5e4ffc[_0x73b6('0x9')]||{};this[_0x73b6('0xa')]=_0x5e4ffc[_0x73b6('0xa')]||{};}module[_0x73b6('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x467a=['modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x271060,_0x3f86b1){var _0x40540b=function(_0x1735a7){while(--_0x1735a7){_0x271060['push'](_0x271060['shift']());}};_0x40540b(++_0x3f86b1);}(_0x467a,0x13c));var _0xa467=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x467a[_0x2dafbe];return _0x58a45a;};'use strict';function Dynamics365Account(_0x1cdd36){this['id']=_0x1cdd36['id']||0x0;this[_0xa467('0x0')]=_0x1cdd36[_0xa467('0x0')]||'';this['username']=_0x1cdd36[_0xa467('0x1')]||'';this[_0xa467('0x2')]=_0x1cdd36['password']||'';this['remoteUri']=_0x1cdd36[_0xa467('0x3')]||'';this[_0xa467('0x4')]=_0x1cdd36[_0xa467('0x4')]||'';this[_0xa467('0x5')]=_0x1cdd36[_0xa467('0x5')]||'';this[_0xa467('0x6')]=_0x1cdd36[_0xa467('0x6')]||{};this[_0xa467('0x7')]=_0x1cdd36[_0xa467('0x7')]||'';this[_0xa467('0x8')]=_0x1cdd36['modernAuthentication']||![];this[_0xa467('0x9')]=_0x1cdd36['Configurations']||{};this[_0xa467('0xa')]=_0x1cdd36[_0xa467('0xa')]||{};}module[_0xa467('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index b063479..3716518 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 _0x2193=['name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','key','exports'];(function(_0x483211,_0x3ebe9e){var _0x46bfdb=function(_0x579bfb){while(--_0x579bfb){_0x483211['push'](_0x483211['shift']());}};_0x46bfdb(++_0x3ebe9e);}(_0x2193,0xee));var _0x3219=function(_0x4cd09d,_0x11f4ca){_0x4cd09d=_0x4cd09d-0x0;var _0x35cdac=_0x2193[_0x4cd09d];return _0x35cdac;};'use strict';function FaxAccount(_0x40456a){this['id']=_0x40456a['id']||0x0;this[_0x3219('0x0')]=_0x40456a[_0x3219('0x0')]||'';this[_0x3219('0x1')]=_0x40456a[_0x3219('0x1')];this[_0x3219('0x2')]=_0x40456a['ecm'];this[_0x3219('0x3')]=_0x40456a[_0x3219('0x3')];this[_0x3219('0x4')]=_0x40456a[_0x3219('0x4')];this[_0x3219('0x5')]=_0x40456a[_0x3219('0x5')]||0x960;this[_0x3219('0x6')]=_0x40456a[_0x3219('0x6')]||0x3840;this['modem']=_0x40456a[_0x3219('0x7')]||_0x3219('0x8');this[_0x3219('0x9')]=_0x40456a['gateway']||'no';this['faxdetect']=_0x40456a[_0x3219('0xa')]||'no';this[_0x3219('0xb')]=_0x40456a[_0x3219('0xb')]||0x1388;this[_0x3219('0xc')]=_0x40456a[_0x3219('0xc')]||_0x3219('0xd');this[_0x3219('0xe')]=_0x40456a[_0x3219('0xe')]?_0x40456a[_0x3219('0xe')]:undefined;this['ListId']=_0x40456a['ListId'];this[_0x3219('0xf')]=_0x40456a[_0x3219('0xf')];}module[_0x3219('0x10')]=FaxAccount; \ No newline at end of file +var _0x4633=['faxdetect','t38timeout','SIP','Trunk','ListId','key','exports','name','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway'];(function(_0x9e2651,_0x13adf6){var _0x41d7b6=function(_0x236dd7){while(--_0x236dd7){_0x9e2651['push'](_0x9e2651['shift']());}};_0x41d7b6(++_0x13adf6);}(_0x4633,0xa7));var _0x3463=function(_0x312978,_0x5cc3e9){_0x312978=_0x312978-0x0;var _0x3c53af=_0x4633[_0x312978];return _0x3c53af;};'use strict';function FaxAccount(_0x4ad9ad){this['id']=_0x4ad9ad['id']||0x0;this['name']=_0x4ad9ad[_0x3463('0x0')]||'';this['description']=_0x4ad9ad['description'];this['ecm']=_0x4ad9ad[_0x3463('0x1')];this['headerinfo']=_0x4ad9ad[_0x3463('0x2')];this[_0x3463('0x3')]=_0x4ad9ad['localstationid'];this['minrate']=_0x4ad9ad[_0x3463('0x4')]||0x960;this[_0x3463('0x5')]=_0x4ad9ad['maxrate']||0x3840;this[_0x3463('0x6')]=_0x4ad9ad[_0x3463('0x6')]||_0x3463('0x7');this['gateway']=_0x4ad9ad[_0x3463('0x8')]||'no';this[_0x3463('0x9')]=_0x4ad9ad[_0x3463('0x9')]||'no';this[_0x3463('0xa')]=_0x4ad9ad[_0x3463('0xa')]||0x1388;this['tech']=_0x4ad9ad['tech']||_0x3463('0xb');this[_0x3463('0xc')]=_0x4ad9ad[_0x3463('0xc')]?_0x4ad9ad[_0x3463('0xc')]:undefined;this[_0x3463('0xd')]=_0x4ad9ad['ListId'];this['key']=_0x4ad9ad[_0x3463('0xe')];}module[_0x3463('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 11d9e64..ebfa4ba 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 _0x2c74=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2c74,0x18a));var _0x42c7=function(_0x1a15cd,_0x1b95c6){_0x1a15cd=_0x1a15cd-0x0;var _0x33f1eb=_0x2c74[_0x1a15cd];return _0x33f1eb;};'use strict';function FreshdeskAccount(_0x5db14d){this['id']=_0x5db14d['id']||0x0;this['name']=_0x5db14d[_0x42c7('0x0')]||'';this['username']=_0x5db14d[_0x42c7('0x1')]||'';this[_0x42c7('0x2')]=_0x5db14d[_0x42c7('0x3')]||'';this[_0x42c7('0x4')]=_0x5db14d[_0x42c7('0x4')]||'';this[_0x42c7('0x5')]=_0x5db14d[_0x42c7('0x5')]||'';this[_0x42c7('0x6')]=_0x5db14d[_0x42c7('0x6')]||{};}module[_0x42c7('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0xf676=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x38a6c6,_0x4062ca){var _0x142f0a=function(_0x1531ce){while(--_0x1531ce){_0x38a6c6['push'](_0x38a6c6['shift']());}};_0x142f0a(++_0x4062ca);}(_0xf676,0x193));var _0x6f67=function(_0x33048a,_0x19e683){_0x33048a=_0x33048a-0x0;var _0x459b03=_0xf676[_0x33048a];return _0x459b03;};'use strict';function FreshdeskAccount(_0x30d8e4){this['id']=_0x30d8e4['id']||0x0;this[_0x6f67('0x0')]=_0x30d8e4['name']||'';this[_0x6f67('0x1')]=_0x30d8e4[_0x6f67('0x1')]||'';this[_0x6f67('0x2')]=_0x30d8e4[_0x6f67('0x3')]||'';this[_0x6f67('0x4')]=_0x30d8e4[_0x6f67('0x4')]||'';this[_0x6f67('0x5')]=_0x30d8e4[_0x6f67('0x5')]||'';this[_0x6f67('0x6')]=_0x30d8e4[_0x6f67('0x6')]||{};}module[_0x6f67('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 7c38072..9b1f3f8 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 _0xc474=['name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x21ded3,_0x323180){var _0x1c220a=function(_0x31793f){while(--_0x31793f){_0x21ded3['push'](_0x21ded3['shift']());}};_0x1c220a(++_0x323180);}(_0xc474,0xfc));var _0x4c47=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xc474[_0x7e2eb0];return _0xd92de4;};'use strict';function FreshsalesAccount(_0x1daf8a){this['id']=_0x1daf8a['id']||0x0;this[_0x4c47('0x0')]=_0x1daf8a[_0x4c47('0x0')]||'';this['username']=_0x1daf8a[_0x4c47('0x1')]||'';this[_0x4c47('0x2')]=_0x1daf8a[_0x4c47('0x3')]||'';this[_0x4c47('0x4')]=_0x1daf8a[_0x4c47('0x4')]||'';this[_0x4c47('0x5')]=_0x1daf8a[_0x4c47('0x5')]||'';this[_0x4c47('0x6')]=_0x1daf8a['Configurations']||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0xdded=['name','username','apiKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x11d47e,_0x797086){var _0x148d43=function(_0x203ee5){while(--_0x203ee5){_0x11d47e['push'](_0x11d47e['shift']());}};_0x148d43(++_0x797086);}(_0xdded,0x17a));var _0xddde=function(_0xed6ddf,_0x5dd72d){_0xed6ddf=_0xed6ddf-0x0;var _0x2cba1c=_0xdded[_0xed6ddf];return _0x2cba1c;};'use strict';function FreshsalesAccount(_0x2b234e){this['id']=_0x2b234e['id']||0x0;this[_0xddde('0x0')]=_0x2b234e[_0xddde('0x0')]||'';this[_0xddde('0x1')]=_0x2b234e[_0xddde('0x1')]||'';this[_0xddde('0x2')]=_0x2b234e['token']||'';this[_0xddde('0x3')]=_0x2b234e[_0xddde('0x3')]||'';this[_0xddde('0x4')]=_0x2b234e[_0xddde('0x4')]||'';this[_0xddde('0x5')]=_0x2b234e[_0xddde('0x5')]||{};}module[_0xddde('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 091502b..b72d89f 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 _0x5e2c=['mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','channel','connectedlinename','accountcode','context','exten','holdtime','assigned','lastAssignedTo','motionChannel','routealias'];(function(_0x3f7fea,_0x2777f6){var _0x5364b1=function(_0x588e9c){while(--_0x588e9c){_0x3f7fea['push'](_0x3f7fea['shift']());}};_0x5364b1(++_0x2777f6);}(_0x5e2c,0x155));var _0xc5e2=function(_0x23c73d,_0x357b21){_0x23c73d=_0x23c73d-0x0;var _0x36ba47=_0x5e2c[_0x23c73d];return _0x36ba47;};'use strict';function QueueReport(){this[_0xc5e2('0x0')]=_0xc5e2('0x1');this[_0xc5e2('0x2')]='';this[_0xc5e2('0x3')]='';this[_0xc5e2('0x4')]='';this[_0xc5e2('0x5')]='';this[_0xc5e2('0x6')]=null;this[_0xc5e2('0x7')]=null;this[_0xc5e2('0x8')]=0x1;this['count']=0x1;this[_0xc5e2('0x9')]=![];this[_0xc5e2('0xa')]=null;this['queuecallercomplete']=![];this['queuecallercompleteAt']=null;this[_0xc5e2('0xb')]=![];this[_0xc5e2('0xc')]=null;this['originalposition']=0x1;this[_0xc5e2('0xd')]='';this['connectedlinenum']='';this[_0xc5e2('0xe')]='';this[_0xc5e2('0xf')]='';this[_0xc5e2('0x10')]='';this[_0xc5e2('0x11')]='';this['priority']='';this[_0xc5e2('0x12')]=0x0;this[_0xc5e2('0x13')]=![];this[_0xc5e2('0x14')]='';this[_0xc5e2('0x15')]='voice';this[_0xc5e2('0x16')]=null;this[_0xc5e2('0x17')]=0x0;this[_0xc5e2('0x18')]={};}module[_0xc5e2('0x19')]=QueueReport; \ No newline at end of file +var _0x0740=['inbound','uniqueid','calleridnum','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','assigned','routealias','type'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x0740,0x1a3));var _0x0074=function(_0x5734fb,_0x2f2e4e){_0x5734fb=_0x5734fb-0x0;var _0x40d296=_0x0740[_0x5734fb];return _0x40d296;};'use strict';function QueueReport(){this[_0x0074('0x0')]=_0x0074('0x1');this[_0x0074('0x2')]='';this[_0x0074('0x3')]='';this['calleridname']='';this['queue']='';this[_0x0074('0x4')]=null;this[_0x0074('0x5')]=null;this['position']=0x1;this[_0x0074('0x6')]=0x1;this[_0x0074('0x7')]=![];this[_0x0074('0x8')]=null;this['queuecallercomplete']=![];this[_0x0074('0x9')]=null;this[_0x0074('0xa')]=![];this[_0x0074('0xb')]=null;this[_0x0074('0xc')]=0x1;this[_0x0074('0xd')]='';this[_0x0074('0xe')]='';this[_0x0074('0xf')]='';this[_0x0074('0x10')]='';this[_0x0074('0x11')]='';this[_0x0074('0x12')]='';this['priority']='';this['holdtime']=0x0;this[_0x0074('0x13')]=![];this['lastAssignedTo']='';this['motionChannel']='voice';this[_0x0074('0x14')]=null;this['mohtime']=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index f27b393..76f0ed2 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 _0x8fcd=['username','password','clientId','clientSecret','type','integrationTab','serverUrl','Configurations','name'];(function(_0x4b9f0d,_0x54a744){var _0x5201f4=function(_0x373efe){while(--_0x373efe){_0x4b9f0d['push'](_0x4b9f0d['shift']());}};_0x5201f4(++_0x54a744);}(_0x8fcd,0xa1));var _0xd8fc=function(_0x250e8e,_0x218ece){_0x250e8e=_0x250e8e-0x0;var _0x11e88f=_0x8fcd[_0x250e8e];return _0x11e88f;};'use strict';function SalesforceAccount(_0x552a5e){this['id']=_0x552a5e['id']||0x0;this[_0xd8fc('0x0')]=_0x552a5e[_0xd8fc('0x0')]||'';this[_0xd8fc('0x1')]=_0x552a5e[_0xd8fc('0x1')]||'';this['remoteUri']=_0x552a5e['remoteUri']||'';this[_0xd8fc('0x2')]=_0x552a5e[_0xd8fc('0x2')]||'';this[_0xd8fc('0x3')]=_0x552a5e[_0xd8fc('0x3')]||'';this[_0xd8fc('0x4')]=_0x552a5e[_0xd8fc('0x4')]||'';this['securityToken']=_0x552a5e['securityToken']||'';this[_0xd8fc('0x5')]=_0x552a5e['type']||_0xd8fc('0x6');this[_0xd8fc('0x7')]=_0x552a5e[_0xd8fc('0x7')]||'';this[_0xd8fc('0x8')]=_0x552a5e['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x46cb=['name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','Configurations','exports'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x46cb,0x84));var _0xb46c=function(_0x570e73,_0x538538){_0x570e73=_0x570e73-0x0;var _0x13134b=_0x46cb[_0x570e73];return _0x13134b;};'use strict';function SalesforceAccount(_0xeb1592){this['id']=_0xeb1592['id']||0x0;this[_0xb46c('0x0')]=_0xeb1592[_0xb46c('0x0')]||'';this[_0xb46c('0x1')]=_0xeb1592['username']||'';this[_0xb46c('0x2')]=_0xeb1592[_0xb46c('0x2')]||'';this[_0xb46c('0x3')]=_0xeb1592[_0xb46c('0x3')]||'';this['clientId']=_0xeb1592[_0xb46c('0x4')]||'';this[_0xb46c('0x5')]=_0xeb1592[_0xb46c('0x5')]||'';this['securityToken']=_0xeb1592[_0xb46c('0x6')]||'';this['type']=_0xeb1592[_0xb46c('0x7')]||_0xb46c('0x8');this['serverUrl']=_0xeb1592['serverUrl']||'';this[_0xb46c('0x9')]=_0xeb1592[_0xb46c('0x9')]||{};}module[_0xb46c('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index ea2303f..25768ad 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 _0x315b=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x315b,0x9a));var _0xb315=function(_0x43d5ab,_0x2b8009){_0x43d5ab=_0x43d5ab-0x0;var _0x2c913c=_0x315b[_0x43d5ab];return _0x2c913c;};'use strict';function ServicenowAccount(_0xe6052e){this['id']=_0xe6052e['id']||0x0;this[_0xb315('0x0')]=_0xe6052e[_0xb315('0x0')]||'';this[_0xb315('0x1')]=_0xe6052e['username']||'';this[_0xb315('0x2')]=_0xe6052e[_0xb315('0x2')]||'';this[_0xb315('0x3')]=_0xe6052e[_0xb315('0x3')]||'';this[_0xb315('0x4')]=_0xe6052e[_0xb315('0x4')]||'';this[_0xb315('0x5')]=_0xe6052e[_0xb315('0x5')]||{};}module[_0xb315('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x9b46=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x40c7f7,_0x42bc78){var _0x479755=function(_0x502b1e){while(--_0x502b1e){_0x40c7f7['push'](_0x40c7f7['shift']());}};_0x479755(++_0x42bc78);}(_0x9b46,0xba));var _0x69b4=function(_0x1c1f3e,_0x665593){_0x1c1f3e=_0x1c1f3e-0x0;var _0x325903=_0x9b46[_0x1c1f3e];return _0x325903;};'use strict';function ServicenowAccount(_0x498103){this['id']=_0x498103['id']||0x0;this['name']=_0x498103[_0x69b4('0x0')]||'';this[_0x69b4('0x1')]=_0x498103[_0x69b4('0x1')]||'';this[_0x69b4('0x2')]=_0x498103[_0x69b4('0x2')]||'';this[_0x69b4('0x3')]=_0x498103[_0x69b4('0x3')]||'';this['serverUrl']=_0x498103[_0x69b4('0x4')]||'';this[_0x69b4('0x5')]=_0x498103['Configurations']||{};}module[_0x69b4('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 5f66488..b7e6a77 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 _0xd405=['remoteUri','serverUrl','Configurations','exports','username','password'];(function(_0x43c63e,_0x38c0c7){var _0x51abc0=function(_0x1021bf){while(--_0x1021bf){_0x43c63e['push'](_0x43c63e['shift']());}};_0x51abc0(++_0x38c0c7);}(_0xd405,0x1d2));var _0x5d40=function(_0x1e381c,_0x47b5b9){_0x1e381c=_0x1e381c-0x0;var _0x9b5ea9=_0xd405[_0x1e381c];return _0x9b5ea9;};'use strict';function SugarcrmAccount(_0x505d13){this['id']=_0x505d13['id']||0x0;this['name']=_0x505d13['name']||'';this['username']=_0x505d13[_0x5d40('0x0')]||'';this[_0x5d40('0x1')]=_0x505d13[_0x5d40('0x1')]||'';this[_0x5d40('0x2')]=_0x505d13[_0x5d40('0x2')]||'';this[_0x5d40('0x3')]=_0x505d13[_0x5d40('0x3')]||'';this[_0x5d40('0x4')]=_0x505d13['Configurations']||{};}module[_0x5d40('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0xd492=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0xafa601,_0x115bf1){var _0x45cadd=function(_0x1e71be){while(--_0x1e71be){_0xafa601['push'](_0xafa601['shift']());}};_0x45cadd(++_0x115bf1);}(_0xd492,0x152));var _0x2d49=function(_0x527a91,_0x10a151){_0x527a91=_0x527a91-0x0;var _0x3a7486=_0xd492[_0x527a91];return _0x3a7486;};'use strict';function SugarcrmAccount(_0x528f4e){this['id']=_0x528f4e['id']||0x0;this[_0x2d49('0x0')]=_0x528f4e[_0x2d49('0x0')]||'';this[_0x2d49('0x1')]=_0x528f4e[_0x2d49('0x1')]||'';this[_0x2d49('0x2')]=_0x528f4e['password']||'';this[_0x2d49('0x3')]=_0x528f4e[_0x2d49('0x3')]||'';this['serverUrl']=_0x528f4e[_0x2d49('0x4')]||'';this[_0x2d49('0x5')]=_0x528f4e['Configurations']||{};}module[_0x2d49('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 7d6e196..7a6bdb2 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 _0xc893=['unknown','stateTime','status','address','exports','name','state'];(function(_0x5dc314,_0x3fd117){var _0x5d16f8=function(_0x2f23e6){while(--_0x2f23e6){_0x5dc314['push'](_0x5dc314['shift']());}};_0x5d16f8(++_0x3fd117);}(_0xc893,0x194));var _0x3c89=function(_0xd4f10f,_0x4f6eda){_0xd4f10f=_0xd4f10f-0x0;var _0x8ca385=_0xc893[_0xd4f10f];return _0x8ca385;};'use strict';function Telephone(_0x59051a){this['id']=_0x59051a['id']||0x0;this[_0x3c89('0x0')]=_0x59051a[_0x3c89('0x0')]||'';this['accountcode']=_0x59051a['accountcode']||'';this[_0x3c89('0x1')]=_0x3c89('0x2');this[_0x3c89('0x3')]=0x0;this[_0x3c89('0x4')]=_0x3c89('0x2');this[_0x3c89('0x5')]='';}module[_0x3c89('0x6')]=Telephone; \ No newline at end of file +var _0xb612=['stateTime','status','exports','name','accountcode','state','unknown'];(function(_0xa7a177,_0x30a749){var _0x58338f=function(_0x5a3854){while(--_0x5a3854){_0xa7a177['push'](_0xa7a177['shift']());}};_0x58338f(++_0x30a749);}(_0xb612,0x1a7));var _0x2b61=function(_0x279732,_0x2c13af){_0x279732=_0x279732-0x0;var _0x576ce2=_0xb612[_0x279732];return _0x576ce2;};'use strict';function Telephone(_0x399d73){this['id']=_0x399d73['id']||0x0;this[_0x2b61('0x0')]=_0x399d73[_0x2b61('0x0')]||'';this[_0x2b61('0x1')]=_0x399d73[_0x2b61('0x1')]||'';this[_0x2b61('0x2')]=_0x2b61('0x3');this[_0x2b61('0x4')]=0x0;this[_0x2b61('0x5')]=_0x2b61('0x3');this['address']='';}module[_0x2b61('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index ad8863c..ab820b6 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(_0x472949,_0x455be7){var _0x3c3e56=function(_0x29cc8b){while(--_0x29cc8b){_0x472949['push'](_0x472949['shift']());}};_0x3c3e56(++_0x455be7);}(_0xb10b,0x12a));var _0xbb10=function(_0x4ce1b9,_0x397a4b){_0x4ce1b9=_0x4ce1b9-0x0;var _0x2bb15d=_0xb10b[_0x4ce1b9];return _0x2bb15d;};'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 _0xb10b=['name','html'];(function(_0x4bf0ba,_0x26dcac){var _0x157d6b=function(_0x2b580b){while(--_0x2b580b){_0x4bf0ba['push'](_0x4bf0ba['shift']());}};_0x157d6b(++_0x26dcac);}(_0xb10b,0x12a));var _0xbb10=function(_0x23118b,_0x562da3){_0x23118b=_0x23118b-0x0;var _0x3636cf=_0xb10b[_0x23118b];return _0x3636cf;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index bc4106c..2cb8465 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 _0x5eb8=['Actions','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x280f4a,_0x2ed8d6){var _0x1bb157=function(_0x37de94){while(--_0x37de94){_0x280f4a['push'](_0x280f4a['shift']());}};_0x1bb157(++_0x2ed8d6);}(_0x5eb8,0xb0));var _0x85eb=function(_0x4239bd,_0x1f310b){_0x4239bd=_0x4239bd-0x0;var _0x21f061=_0x5eb8[_0x4239bd];return _0x21f061;};'use strict';function Trigger(_0x5ea4df){this['id']=_0x5ea4df['id']||0x0;this['name']=_0x5ea4df[_0x85eb('0x0')]||'';this[_0x85eb('0x1')]=_0x5ea4df[_0x85eb('0x1')]||_0x85eb('0x2');this[_0x85eb('0x3')]=_0x5ea4df[_0x85eb('0x3')]||![];this[_0x85eb('0x4')]=_0x5ea4df[_0x85eb('0x4')]||[];this[_0x85eb('0x5')]=_0x5ea4df[_0x85eb('0x5')]||[];this[_0x85eb('0x6')]=_0x5ea4df[_0x85eb('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0x757a=['name','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x3aaa4d,_0x2e7dec){var _0xb0bd1a=function(_0x412962){while(--_0x412962){_0x3aaa4d['push'](_0x3aaa4d['shift']());}};_0xb0bd1a(++_0x2e7dec);}(_0x757a,0xde));var _0xa757=function(_0x18629a,_0x3b3baa){_0x18629a=_0x18629a-0x0;var _0x4f6803=_0x757a[_0x18629a];return _0x4f6803;};'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 diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index ebf889b..1ee1b2d 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 _0x0439=['registrationtime','address','defaultuser','active','name','state','unknown','registry','indexOf','split','port','domain','stateRegistry'];(function(_0x4f879c,_0x434b46){var _0x24bae6=function(_0x47ada6){while(--_0x47ada6){_0x4f879c['push'](_0x4f879c['shift']());}};_0x24bae6(++_0x434b46);}(_0x0439,0xd3));var _0x9043=function(_0x35fa3f,_0x500d59){_0x35fa3f=_0x35fa3f-0x0;var _0x158869=_0x0439[_0x35fa3f];return _0x158869;};'use strict';function Trunk(_0x144d66){this['id']=_0x144d66['id']||0x0;this[_0x9043('0x0')]=_0x144d66['active']||![];this[_0x9043('0x1')]=_0x144d66[_0x9043('0x1')]||'';this[_0x9043('0x2')]=_0x9043('0x3');this['stateTime']=0x0;this['status']=_0x9043('0x3');this['registry']=_0x144d66['registry']&&_0x144d66[_0x9043('0x4')][_0x9043('0x5')](':')?_0x144d66['registry'][_0x9043('0x6')](':')[0x0]:'';this['host']='';this[_0x9043('0x7')]='';this[_0x9043('0x8')]='';this['domainport']='';this['refresh']='';this[_0x9043('0x9')]=_0x9043('0x3');this[_0x9043('0xa')]='';this[_0x9043('0xb')]='';this[_0x9043('0xc')]=_0x144d66[_0x9043('0xc')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0xa6d8=['indexOf','host','port','domain','domainport','refresh','registrationtime','address','defaultuser','exports','active','name','state','unknown','stateTime','status','registry'];(function(_0x3721d8,_0x1bfa47){var _0x341f0b=function(_0x118c58){while(--_0x118c58){_0x3721d8['push'](_0x3721d8['shift']());}};_0x341f0b(++_0x1bfa47);}(_0xa6d8,0x1a2));var _0x8a6d=function(_0x5bbf6a,_0x29460a){_0x5bbf6a=_0x5bbf6a-0x0;var _0x5d051a=_0xa6d8[_0x5bbf6a];return _0x5d051a;};'use strict';function Trunk(_0xcad304){this['id']=_0xcad304['id']||0x0;this[_0x8a6d('0x0')]=_0xcad304[_0x8a6d('0x0')]||![];this[_0x8a6d('0x1')]=_0xcad304[_0x8a6d('0x1')]||'';this[_0x8a6d('0x2')]=_0x8a6d('0x3');this[_0x8a6d('0x4')]=0x0;this[_0x8a6d('0x5')]='unknown';this['registry']=_0xcad304[_0x8a6d('0x6')]&&_0xcad304['registry'][_0x8a6d('0x7')](':')?_0xcad304[_0x8a6d('0x6')]['split'](':')[0x0]:'';this[_0x8a6d('0x8')]='';this[_0x8a6d('0x9')]='';this[_0x8a6d('0xa')]='';this[_0x8a6d('0xb')]='';this[_0x8a6d('0xc')]='';this['stateRegistry']=_0x8a6d('0x3');this[_0x8a6d('0xd')]='';this[_0x8a6d('0xe')]='';this[_0x8a6d('0xf')]=_0xcad304[_0x8a6d('0xf')]||'';}module[_0x8a6d('0x10')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 0545537..0477672 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 _0x7d0a=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x5b8ede,_0xf69201){var _0x4eb76f=function(_0x3cb0bb){while(--_0x3cb0bb){_0x5b8ede['push'](_0x5b8ede['shift']());}};_0x4eb76f(++_0xf69201);}(_0x7d0a,0x90));var _0xa7d0=function(_0x133fc0,_0x1edda8){_0x133fc0=_0x133fc0-0x0;var _0x4ce619=_0x7d0a[_0x133fc0];return _0x4ce619;};'use strict';function voiceExtension(_0x1a8b17){this['id']=_0x1a8b17['id']||0x0;this[_0xa7d0('0x0')]=_0x1a8b17[_0xa7d0('0x0')]||'';this['recordingFormat']=_0x1a8b17[_0xa7d0('0x1')]||_0xa7d0('0x2');this[_0xa7d0('0x3')]=_0x1a8b17[_0xa7d0('0x3')]||![];}module[_0xa7d0('0x4')]=voiceExtension; \ No newline at end of file +var _0x092b=['mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x50ab95,_0x480438){var _0x2c62cd=function(_0x2af369){while(--_0x2af369){_0x50ab95['push'](_0x50ab95['shift']());}};_0x2c62cd(++_0x480438);}(_0x092b,0x142));var _0xb092=function(_0x3d5f7b,_0x42a99b){_0x3d5f7b=_0x3d5f7b-0x0;var _0xc4a45c=_0x092b[_0x3d5f7b];return _0xc4a45c;};'use strict';function voiceExtension(_0x5676e1){this['id']=_0x5676e1['id']||0x0;this['exten']=_0x5676e1[_0xb092('0x0')]||'';this[_0xb092('0x1')]=_0x5676e1[_0xb092('0x1')]||'none';this[_0xb092('0x2')]=_0x5676e1[_0xb092('0x2')]||![];}module[_0xb092('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 185ad7e..f9de2dd 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 _0x1407=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','pTalking','timeout','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','monitor_format','mandatoryDisposition','mandatoryDispositionPause','exports','wav','wav49','fewestcalls','leastrecent','random','ringall','roundrobin','rrmemory','rrordered','name','type','inbound','waiting','total','sumDuration','sumBillable','unmanaged','abandoned','available','busy','invalid','loggedIn','paused','ringInUse','talking','unavailable','acw','acwTimeout','autopause','message','statusMessage','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous'];(function(_0x3662b4,_0x503b4d){var _0x50928c=function(_0x15db69){while(--_0x15db69){_0x3662b4['push'](_0x3662b4['shift']());}};_0x50928c(++_0x503b4d);}(_0x1407,0xd1));var _0x7140=function(_0x21612a,_0x1fb95c){_0x21612a=_0x21612a-0x0;var _0x241f5d=_0x1407[_0x21612a];return _0x241f5d;};'use strict';var monitorFormat={'wav':_0x7140('0x0'),'wav49':_0x7140('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':_0x7140('0x2'),'leastrecent':_0x7140('0x3'),'linear':'linear','random':_0x7140('0x4'),'ringall':_0x7140('0x5'),'rr':_0x7140('0x6'),'rrmemory':_0x7140('0x7'),'rrordered':_0x7140('0x8'),'wrandom':'wrandom'};function VoiceQueue(_0x1955b1){this['id']=_0x1955b1['id']||0x0;this[_0x7140('0x9')]=_0x1955b1[_0x7140('0x9')]||'';this['monitor_format']=_0x1955b1['monitor_format']||'';this[_0x7140('0xa')]=_0x1955b1[_0x7140('0xa')]||_0x7140('0xb');this[_0x7140('0xc')]=0x0;this[_0x7140('0xd')]=0x0;this['answered']=0x0;this[_0x7140('0xe')]=0x0;this['sumHoldTime']=0x0;this[_0x7140('0xf')]=0x0;this[_0x7140('0x10')]=0x0;this[_0x7140('0x11')]=0x0;this[_0x7140('0x12')]=0x0;this[_0x7140('0x13')]=0x0;this['inUse']=0x0;this[_0x7140('0x14')]=0x0;this[_0x7140('0x15')]=0x0;this['notInUse']=0x0;this['onHold']=0x0;this[_0x7140('0x16')]=0x0;this['ringing']=0x0;this[_0x7140('0x17')]=0x0;this[_0x7140('0x18')]=0x0;this[_0x7140('0x19')]=0x0;this['unknown']=0x0;this['acw']=_0x1955b1[_0x7140('0x1a')]||![];this[_0x7140('0x1b')]=_0x1955b1['acwTimeout']||0xa;this[_0x7140('0x1c')]=_0x1955b1['autopause']||'no';this['sendMessageOneNotActive']=!![];this[_0x7140('0x1d')]='';this[_0x7140('0x1e')]='';this['originated']=0x0;this[_0x7140('0x1f')]=0x0;this[_0x7140('0x20')]=_0x1955b1[_0x7140('0x20')]||null;this[_0x7140('0x21')]=_0x1955b1[_0x7140('0x21')]?_0x1955b1[_0x7140('0x21')]:null;this[_0x7140('0x22')]=_0x1955b1[_0x7140('0x22')];this[_0x7140('0x23')]=_0x1955b1['dialMethod']||_0x7140('0x24');this[_0x7140('0x25')]=_0x1955b1['dialLimitChannel']||0x0;this['dialLimitQueue']=_0x1955b1[_0x7140('0x26')]||0x0;this[_0x7140('0x27')]=_0x1955b1['dialPowerLevel']||0x1;this[_0x7140('0x28')]=_0x1955b1[_0x7140('0x28')]||'dropRate';this[_0x7140('0x29')]=_0x1955b1[_0x7140('0x29')]||0.03;this['dialPredictiveInterval']=_0x1955b1[_0x7140('0x2a')]||0x258;this[_0x7140('0x2b')]=_0x1955b1['dialOriginateCallerIdName']||_0x7140('0x2c');this[_0x7140('0x2d')]=_0x1955b1[_0x7140('0x2d')]||_0x7140('0x2c');this[_0x7140('0x2e')]=_0x1955b1[_0x7140('0x2e')]||0x1e;this[_0x7140('0x2f')]=_0x1955b1[_0x7140('0x2f')]||_0x7140('0x30');this[_0x7140('0x31')]=_0x1955b1[_0x7140('0x31')]||0x3;this[_0x7140('0x32')]=_0x1955b1['dialQueueProject']||undefined;this[_0x7140('0x33')]=_0x1955b1[_0x7140('0x33')]||0x3;this['dialCongestionRetryFrequency']=_0x1955b1['dialCongestionRetryFrequency']||0x96;this[_0x7140('0x34')]=_0x1955b1['dialBusyMaxRetry']||0x3;this[_0x7140('0x35')]=_0x1955b1[_0x7140('0x35')]||0x96;this[_0x7140('0x36')]=_0x1955b1[_0x7140('0x36')]||0x3;this[_0x7140('0x37')]=_0x1955b1[_0x7140('0x37')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x1955b1[_0x7140('0x38')]||0x3;this[_0x7140('0x39')]=_0x1955b1[_0x7140('0x39')]||0x96;this['dialDropMaxRetry']=_0x1955b1[_0x7140('0x3a')]||0x3;this[_0x7140('0x3b')]=_0x1955b1[_0x7140('0x3b')]||0x96;this[_0x7140('0x3c')]=_0x1955b1[_0x7140('0x3c')]||0x3;this['dialAbandonedRetryFrequency']=_0x1955b1[_0x7140('0x3d')]||0x96;this['dialMachineMaxRetry']=_0x1955b1['dialMachineMaxRetry']||0x3;this[_0x7140('0x3e')]=_0x1955b1[_0x7140('0x3e')]||0x96;this[_0x7140('0x3f')]=_0x1955b1[_0x7140('0x3f')]||0x3;this[_0x7140('0x40')]=_0x1955b1[_0x7140('0x40')]||0x96;this[_0x7140('0x41')]=_0x1955b1[_0x7140('0x41')]||0x3;this['dialGlobalMaxRetry']=_0x1955b1[_0x7140('0x42')]||0x4;this[_0x7140('0x43')]=_0x1955b1[_0x7140('0x43')]?_0x1955b1['Trunk']:undefined;this[_0x7140('0x44')]=_0x1955b1[_0x7140('0x44')]?_0x1955b1['TrunkBackup']:undefined;this[_0x7140('0x45')]=_0x1955b1[_0x7140('0x45')]||undefined;this[_0x7140('0x46')]=_0x1955b1['Interval']?_0x1955b1[_0x7140('0x46')]:undefined;this[_0x7140('0x47')]=_0x1955b1[_0x7140('0x47')]||_0x7140('0x48');this[_0x7140('0x49')]=_0x1955b1[_0x7140('0x49')]||undefined;this['dialCutDigit']=_0x1955b1['dialCutDigit']||undefined;this[_0x7140('0x4a')]=strategy[_0x1955b1[_0x7140('0x4a')]];this[_0x7140('0x4b')]=!![];this['dialAMDActive']=_0x1955b1[_0x7140('0x4c')]||![];this[_0x7140('0x4d')]=_0x1955b1[_0x7140('0x4d')];this[_0x7140('0x4e')]=_0x1955b1[_0x7140('0x4e')];this[_0x7140('0x4f')]=_0x1955b1[_0x7140('0x4f')];this['dialAMDTotalAnalysisTime']=_0x1955b1['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x1955b1[_0x7140('0x50')];this[_0x7140('0x51')]=_0x1955b1[_0x7140('0x51')];this[_0x7140('0x52')]=_0x1955b1[_0x7140('0x52')];this[_0x7140('0x53')]=_0x1955b1[_0x7140('0x53')];this['dialAMDMaximumWordLength']=_0x1955b1['dialAMDMaximumWordLength'];this[_0x7140('0x54')]=0x0;this[_0x7140('0x55')]=0x0;this[_0x7140('0x56')]=_0x1955b1[_0x7140('0x56')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x7140('0x57')]=0x0;this[_0x7140('0x58')]=0x0;this['outboundCongestionCallsDay']=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x7140('0x59')]=0x0;this[_0x7140('0x5a')]=0x0;this[_0x7140('0x5b')]=0x0;this[_0x7140('0x5c')]=0x0;this[_0x7140('0x5d')]=0x0;this['outboundDropCallsDayACS']=0x0;this['outboundReCallsDay']=0x0;this['outboundAbandonedDay']=0x0;this[_0x7140('0x5e')]=undefined;this[_0x7140('0x5f')]=undefined;this[_0x7140('0x60')]=undefined;this[_0x7140('0x61')]=1.05;this[_0x7140('0x62')]=0x0;this[_0x7140('0x63')]=0x0;this[_0x7140('0x64')]=0x0;this[_0x7140('0x65')]=0x0;this[_0x7140('0x66')]=0x0;this[_0x7140('0x67')]=0x0;this[_0x7140('0x68')]=0x0;this[_0x7140('0x69')]=0x0;this[_0x7140('0x6a')]=_0x1955b1[_0x7140('0x6b')]||0x14;this[_0x7140('0x6c')]=_0x1955b1[_0x7140('0x6b')]||0xa;this[_0x7140('0x6d')]=0x0;this[_0x7140('0x6e')]=0x0;this[_0x7140('0x6f')]=0x1;this[_0x7140('0x70')]=0x0;this[_0x7140('0x71')]=0x0;this[_0x7140('0x72')]=0x0;this[_0x7140('0x73')]=0x0;this['dialRecallMeTimeout']=_0x1955b1[_0x7140('0x74')]||0x1e;this['dialRecallInQueue']=_0x1955b1[_0x7140('0x75')]||![];this[_0x7140('0x76')]=!!_0x1955b1[_0x7140('0x76')]||![];this[_0x7140('0x77')]=!!_0x1955b1[_0x7140('0x77')]||![];this['dialQueueProject2']=_0x1955b1[_0x7140('0x78')]||undefined;this['dialAgiAfterHangupClient']=_0x1955b1[_0x7140('0x79')]||![];this[_0x7140('0x7a')]=_0x1955b1[_0x7140('0x7a')]||![];this['monitor_format']=monitorFormat[_0x1955b1[_0x7140('0x7b')]]?monitorFormat[_0x1955b1[_0x7140('0x7b')]]:undefined;this['mandatoryDisposition']=_0x1955b1[_0x7140('0x7c')]||![];this[_0x7140('0x7d')]=_0x1955b1['mandatoryDispositionPause']?_0x1955b1[_0x7140('0x7d')]:undefined;this['queueSummaryCountersUpdated']=![];}module[_0x7140('0x7e')]=VoiceQueue; \ No newline at end of file +var _0xc144=['paused','ringing','talking','unknown','acw','acwTimeout','sendMessageOneNotActive','statusMessage','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','Trunk','TrunkBackup','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav49','gsm','fewestcalls','leastrecent','linear','random','ringall','roundrobin','rrordered','name','monitor_format','type','inbound','answered','sumDuration','abandoned','inUse','invalid','loggedIn','notInUse'];(function(_0x171813,_0x3af225){var _0x11058c=function(_0xb749ac){while(--_0xb749ac){_0x171813['push'](_0x171813['shift']());}};_0x11058c(++_0x3af225);}(_0xc144,0x1d8));var _0x4c14=function(_0xab9f47,_0x220c4e){_0xab9f47=_0xab9f47-0x0;var _0x582de5=_0xc144[_0xab9f47];return _0x582de5;};'use strict';var monitorFormat={'wav':'wav','wav49':_0x4c14('0x0'),'gsm':_0x4c14('0x1')};var strategy={'fewestcalls':_0x4c14('0x2'),'leastrecent':_0x4c14('0x3'),'linear':_0x4c14('0x4'),'random':_0x4c14('0x5'),'ringall':_0x4c14('0x6'),'rr':_0x4c14('0x7'),'rrmemory':'rrmemory','rrordered':_0x4c14('0x8'),'wrandom':'wrandom'};function VoiceQueue(_0x468f65){this['id']=_0x468f65['id']||0x0;this[_0x4c14('0x9')]=_0x468f65[_0x4c14('0x9')]||'';this['monitor_format']=_0x468f65[_0x4c14('0xa')]||'';this['type']=_0x468f65[_0x4c14('0xb')]||_0x4c14('0xc');this['waiting']=0x0;this['total']=0x0;this[_0x4c14('0xd')]=0x0;this[_0x4c14('0xe')]=0x0;this['sumHoldTime']=0x0;this['sumBillable']=0x0;this['unmanaged']=0x0;this[_0x4c14('0xf')]=0x0;this['available']=0x0;this['busy']=0x0;this[_0x4c14('0x10')]=0x0;this[_0x4c14('0x11')]=0x0;this[_0x4c14('0x12')]=0x0;this[_0x4c14('0x13')]=0x0;this['onHold']=0x0;this[_0x4c14('0x14')]=0x0;this[_0x4c14('0x15')]=0x0;this['ringInUse']=0x0;this[_0x4c14('0x16')]=0x0;this['unavailable']=0x0;this[_0x4c14('0x17')]=0x0;this[_0x4c14('0x18')]=_0x468f65[_0x4c14('0x18')]||![];this[_0x4c14('0x19')]=_0x468f65[_0x4c14('0x19')]||0xa;this['autopause']=_0x468f65['autopause']||'no';this[_0x4c14('0x1a')]=!![];this['message']='';this[_0x4c14('0x1b')]='';this['originated']=0x0;this[_0x4c14('0x1c')]=0x0;this[_0x4c14('0x1d')]=_0x468f65[_0x4c14('0x1d')]||null;this[_0x4c14('0x1e')]=_0x468f65[_0x4c14('0x1e')]?_0x468f65[_0x4c14('0x1e')]:null;this['dialActive']=_0x468f65[_0x4c14('0x1f')];this[_0x4c14('0x20')]=_0x468f65[_0x4c14('0x20')]||_0x4c14('0x21');this[_0x4c14('0x22')]=_0x468f65[_0x4c14('0x22')]||0x0;this[_0x4c14('0x23')]=_0x468f65[_0x4c14('0x23')]||0x0;this['dialPowerLevel']=_0x468f65[_0x4c14('0x24')]||0x1;this[_0x4c14('0x25')]=_0x468f65['dialPredictiveOptimization']||_0x4c14('0x26');this['dialPredictiveOptimizationPercentage']=_0x468f65[_0x4c14('0x27')]||0.03;this[_0x4c14('0x28')]=_0x468f65[_0x4c14('0x28')]||0x258;this[_0x4c14('0x29')]=_0x468f65[_0x4c14('0x29')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x468f65[_0x4c14('0x2a')]||_0x4c14('0x2b');this[_0x4c14('0x2c')]=_0x468f65['dialOriginateTimeout']||0x1e;this[_0x4c14('0x2d')]=_0x468f65['dialQueueOptions']||_0x4c14('0x2e');this['dialQueueTimeout']=_0x468f65[_0x4c14('0x2f')]||0x3;this[_0x4c14('0x30')]=_0x468f65['dialQueueProject']||undefined;this[_0x4c14('0x31')]=_0x468f65[_0x4c14('0x31')]||0x3;this['dialCongestionRetryFrequency']=_0x468f65[_0x4c14('0x32')]||0x96;this[_0x4c14('0x33')]=_0x468f65[_0x4c14('0x33')]||0x3;this[_0x4c14('0x34')]=_0x468f65[_0x4c14('0x34')]||0x96;this[_0x4c14('0x35')]=_0x468f65['dialNoAnswerMaxRetry']||0x3;this[_0x4c14('0x36')]=_0x468f65[_0x4c14('0x36')]||0x96;this[_0x4c14('0x37')]=_0x468f65[_0x4c14('0x37')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x468f65[_0x4c14('0x38')]||0x96;this['dialDropMaxRetry']=_0x468f65[_0x4c14('0x39')]||0x3;this[_0x4c14('0x3a')]=_0x468f65[_0x4c14('0x3a')]||0x96;this[_0x4c14('0x3b')]=_0x468f65[_0x4c14('0x3b')]||0x3;this[_0x4c14('0x3c')]=_0x468f65[_0x4c14('0x3c')]||0x96;this[_0x4c14('0x3d')]=_0x468f65[_0x4c14('0x3d')]||0x3;this[_0x4c14('0x3e')]=_0x468f65[_0x4c14('0x3e')]||0x96;this[_0x4c14('0x3f')]=_0x468f65['dialAgentRejectMaxRetry']||0x3;this[_0x4c14('0x40')]=_0x468f65['dialAgentRejectRetryFrequency']||0x96;this[_0x4c14('0x41')]=_0x468f65[_0x4c14('0x41')]||0x3;this['dialGlobalMaxRetry']=_0x468f65['dialGlobalMaxRetry']||0x4;this[_0x4c14('0x42')]=_0x468f65[_0x4c14('0x42')]?_0x468f65[_0x4c14('0x42')]:undefined;this[_0x4c14('0x43')]=_0x468f65['TrunkBackup']?_0x468f65[_0x4c14('0x43')]:undefined;this['dialPrefix']=_0x468f65['dialPrefix']||undefined;this[_0x4c14('0x44')]=_0x468f65[_0x4c14('0x44')]?_0x468f65['Interval']:undefined;this[_0x4c14('0x45')]=_0x468f65['dialOrderByScheduledAt']||_0x4c14('0x46');this[_0x4c14('0x47')]=_0x468f65[_0x4c14('0x47')]||undefined;this['dialCutDigit']=_0x468f65[_0x4c14('0x48')]||undefined;this[_0x4c14('0x49')]=strategy[_0x468f65[_0x4c14('0x49')]];this['queueStatusComplete']=!![];this['dialAMDActive']=_0x468f65[_0x4c14('0x4a')]||![];this[_0x4c14('0x4b')]=_0x468f65[_0x4c14('0x4b')];this[_0x4c14('0x4c')]=_0x468f65[_0x4c14('0x4c')];this[_0x4c14('0x4d')]=_0x468f65['dialAMDAfterGreetingSilence'];this[_0x4c14('0x4e')]=_0x468f65['dialAMDTotalAnalysisTime'];this[_0x4c14('0x4f')]=_0x468f65[_0x4c14('0x4f')];this[_0x4c14('0x50')]=_0x468f65[_0x4c14('0x50')];this[_0x4c14('0x51')]=_0x468f65[_0x4c14('0x51')];this['dialAMDSilenceThreshold']=_0x468f65['dialAMDSilenceThreshold'];this[_0x4c14('0x52')]=_0x468f65['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this[_0x4c14('0x53')]=0x0;this[_0x4c14('0x54')]=_0x468f65['timeout'];this[_0x4c14('0x55')]=0x0;this[_0x4c14('0x56')]=0x0;this[_0x4c14('0x57')]=0x0;this[_0x4c14('0x58')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x4c14('0x59')]=0x0;this[_0x4c14('0x5a')]=0x0;this[_0x4c14('0x5b')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x4c14('0x5c')]=0x0;this[_0x4c14('0x5d')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x4c14('0x5e')]=0x0;this[_0x4c14('0x5f')]=0x0;this[_0x4c14('0x60')]=undefined;this[_0x4c14('0x61')]=undefined;this[_0x4c14('0x62')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x4c14('0x63')]=0x0;this[_0x4c14('0x64')]=0x0;this[_0x4c14('0x65')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x4c14('0x66')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x4c14('0x67')]=0x0;this[_0x4c14('0x68')]=_0x468f65['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x4c14('0x69')]=_0x468f65[_0x4c14('0x6a')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x4c14('0x6b')]=0x0;this[_0x4c14('0x6c')]=0x1;this[_0x4c14('0x6d')]=0x0;this[_0x4c14('0x6e')]=0x0;this[_0x4c14('0x6f')]=0x0;this[_0x4c14('0x70')]=0x0;this[_0x4c14('0x71')]=_0x468f65[_0x4c14('0x71')]||0x1e;this[_0x4c14('0x72')]=_0x468f65[_0x4c14('0x72')]||![];this[_0x4c14('0x73')]=!!_0x468f65[_0x4c14('0x73')]||![];this['dialPreviewRecallmeReminder']=!!_0x468f65['dialPreviewRecallmeReminder']||![];this[_0x4c14('0x74')]=_0x468f65[_0x4c14('0x74')]||undefined;this[_0x4c14('0x75')]=_0x468f65[_0x4c14('0x75')]||![];this[_0x4c14('0x76')]=_0x468f65['dialAgiAfterHangupAgent']||![];this[_0x4c14('0xa')]=monitorFormat[_0x468f65[_0x4c14('0xa')]]?monitorFormat[_0x468f65[_0x4c14('0xa')]]:undefined;this['mandatoryDisposition']=_0x468f65[_0x4c14('0x77')]||![];this[_0x4c14('0x78')]=_0x468f65[_0x4c14('0x78')]?_0x468f65[_0x4c14('0x78')]:undefined;this[_0x4c14('0x79')]=![];}module[_0x4c14('0x7a')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 82eff62..1ed716d 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 _0x6c7b=['xcally-motion-preview','some','active','updateReportFromOutboundQueue','preview','exports','available','ringing','waiting','answered','loggedIn','loggedInDb','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','paused','sumBillable','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','talking','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','createReport','inUse','loggedin','callers','online','incall','includes','status','keys','length','queue','exten'];(function(_0x295059,_0x5f05f6){var _0x39d62c=function(_0x27d8b3){while(--_0x27d8b3){_0x295059['push'](_0x295059['shift']());}};_0x39d62c(++_0x5f05f6);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x6007fc,_0x2bdec9){_0x6007fc=_0x6007fc-0x0;var _0x4762b8=_0x6c7b[_0x6007fc];return _0x4762b8;};'use strict';var INBOUND_COUNTERS=[_0xb6c7('0x0'),'loggedIn','loggedInDb','paused',_0xb6c7('0x1'),'talking',_0xb6c7('0x2')];var OUTBOUND_COUNTERS=[_0xb6c7('0x0'),_0xb6c7('0x3'),'inUse',_0xb6c7('0x4'),_0xb6c7('0x5'),_0xb6c7('0x6'),_0xb6c7('0x7'),_0xb6c7('0x8'),'outboundBlacklistCallsDay',_0xb6c7('0x9'),_0xb6c7('0xa'),_0xb6c7('0xb'),_0xb6c7('0xc'),_0xb6c7('0xd'),_0xb6c7('0xe'),_0xb6c7('0xf'),_0xb6c7('0x10'),'pTalking','talking',_0xb6c7('0x11'),_0xb6c7('0x12'),_0xb6c7('0x13'),_0xb6c7('0x2')];function VoiceQueueSummary(_0x12e92f){this['id']=_0x12e92f['id'];this[_0xb6c7('0x14')]=_0x12e92f[_0xb6c7('0x14')];this['strategy']=_0x12e92f[_0xb6c7('0x15')];this[_0xb6c7('0x16')]=_0x12e92f[_0xb6c7('0x16')]||0x0;this[_0xb6c7('0x3')]=_0x12e92f[_0xb6c7('0x3')]||0x0;this[_0xb6c7('0x0')]=_0x12e92f[_0xb6c7('0x0')]||0x0;this['busy']=_0x12e92f[_0xb6c7('0x17')]||0x0;this['inUse']=_0x12e92f['inUse']||0x0;this['invalid']=_0x12e92f[_0xb6c7('0x18')]||0x0;this['loggedIn']=_0x12e92f[_0xb6c7('0x4')]||0x0;this[_0xb6c7('0x5')]=_0x12e92f[_0xb6c7('0x5')]||0x0;this[_0xb6c7('0x19')]=_0x12e92f[_0xb6c7('0x19')]||0x0;this[_0xb6c7('0x1a')]=_0x12e92f[_0xb6c7('0x1a')]||0x0;this[_0xb6c7('0x10')]=_0x12e92f[_0xb6c7('0x10')]||0x0;this[_0xb6c7('0x1')]=_0x12e92f[_0xb6c7('0x1')]||0x0;this[_0xb6c7('0x1b')]=_0x12e92f[_0xb6c7('0x1b')];this['sumBillable']=_0x12e92f[_0xb6c7('0x11')];this[_0xb6c7('0x12')]=_0x12e92f['sumDuration'];this[_0xb6c7('0x1c')]=_0x12e92f['sumHoldTime']||0x0;this[_0xb6c7('0x1d')]=_0x12e92f['talking']||0x0;this[_0xb6c7('0x13')]=_0x12e92f['total']||0x0;this[_0xb6c7('0x1e')]=_0x12e92f[_0xb6c7('0x1e')];this['unavailable']=_0x12e92f[_0xb6c7('0x1f')]||0x0;this[_0xb6c7('0x20')]=_0x12e92f[_0xb6c7('0x20')]||0x0;this[_0xb6c7('0x21')]=_0x12e92f[_0xb6c7('0x21')]||0x0;this[_0xb6c7('0x2')]=_0x12e92f['waiting']||0x0;if(_0x12e92f[_0xb6c7('0x1e')]===_0xb6c7('0x22')){this[_0xb6c7('0x23')]=_0x12e92f[_0xb6c7('0x23')]||0x0;this['dialActive']=_0x12e92f[_0xb6c7('0x24')];this[_0xb6c7('0x25')]=_0x12e92f['dialMethod'];this[_0xb6c7('0x26')]=_0x12e92f[_0xb6c7('0x26')];this[_0xb6c7('0x27')]=_0x12e92f[_0xb6c7('0x27')];this['dialOriginateTimeout']=_0x12e92f[_0xb6c7('0x28')];this['dialPrefix']=_0x12e92f[_0xb6c7('0x29')];this[_0xb6c7('0x2a')]=_0x12e92f[_0xb6c7('0x2a')];this['outboundAnswerAgiCallsDay']=_0x12e92f['outboundAnswerAgiCallsDay'];this['outboundAnswerCallsDay']=_0x12e92f[_0xb6c7('0x8')];this[_0xb6c7('0x2b')]=_0x12e92f[_0xb6c7('0x2b')];this[_0xb6c7('0x9')]=_0x12e92f[_0xb6c7('0x9')];this[_0xb6c7('0xa')]=_0x12e92f[_0xb6c7('0xa')];this[_0xb6c7('0x2c')]=_0x12e92f[_0xb6c7('0x2c')];this[_0xb6c7('0x2d')]=_0x12e92f['outboundDropCallsDayCallersExit'];this[_0xb6c7('0x2e')]=_0x12e92f['outboundDropCallsDayTimeout'];this[_0xb6c7('0xb')]=_0x12e92f[_0xb6c7('0xb')];this[_0xb6c7('0xc')]=_0x12e92f[_0xb6c7('0xc')];this[_0xb6c7('0x2f')]=_0x12e92f['outboundOriginateFailureCallsDay'];this['outboundReCallsDay']=_0x12e92f['outboundReCallsDay'];this[_0xb6c7('0xe')]=_0x12e92f[_0xb6c7('0xe')];this['outboundUnknownCallsDay']=_0x12e92f[_0xb6c7('0xf')];this[_0xb6c7('0x30')]=_0x12e92f['predictiveIntervalAnsweredCalls'];this[_0xb6c7('0x31')]=_0x12e92f[_0xb6c7('0x31')];this[_0xb6c7('0x32')]=_0x12e92f[_0xb6c7('0x32')];this[_0xb6c7('0x33')]=_0x12e92f[_0xb6c7('0x33')];this['predictiveIntervalDroppedCallsTimeout']=_0x12e92f[_0xb6c7('0x34')];this[_0xb6c7('0x35')]=_0x12e92f[_0xb6c7('0x35')];this[_0xb6c7('0x36')]=_0x12e92f[_0xb6c7('0x36')];this[_0xb6c7('0x37')]=_0x12e92f[_0xb6c7('0x37')];this['predictiveIntervalMultiplicativeFactor']=_0x12e92f['predictiveIntervalMultiplicativeFactor'];this[_0xb6c7('0x38')]=_0x12e92f[_0xb6c7('0x38')];this[_0xb6c7('0x39')]=_0x12e92f[_0xb6c7('0x39')];this[_0xb6c7('0x3a')]=_0x12e92f[_0xb6c7('0x3a')];this[_0xb6c7('0x6')]=_0x12e92f[_0xb6c7('0x6')];this[_0xb6c7('0x3b')]=_0x12e92f[_0xb6c7('0x3b')];this['erlangCallToSecond']=_0x12e92f[_0xb6c7('0x3c')];this['erlangAbandonmentRate']=_0x12e92f['erlangAbandonmentRate'];this[_0xb6c7('0x3d')]=_0x12e92f['erlangBusyFactor'];this[_0xb6c7('0x3e')]=_0x12e92f[_0xb6c7('0x3e')];this['startProgressive']=_0x12e92f[_0xb6c7('0x3f')];this[_0xb6c7('0x40')]=_0x12e92f[_0xb6c7('0x40')];this[_0xb6c7('0x41')]=_0x12e92f[_0xb6c7('0x41')];}if(_0x12e92f['Trunk']){this['Trunk']={'id':_0x12e92f[_0xb6c7('0x42')]['id'],'name':_0x12e92f[_0xb6c7('0x42')][_0xb6c7('0x14')],'active':_0x12e92f[_0xb6c7('0x42')]['active'],'callerid':_0x12e92f['Trunk'][_0xb6c7('0x43')]};}}VoiceQueueSummary[_0xb6c7('0x44')][_0xb6c7('0x45')]=function(_0x214d04,_0x793060,_0x4eb2c7,_0x4e0888){this['loggedInDb']=0x0;this[_0xb6c7('0x1d')]=0x0;this[_0xb6c7('0x10')]=0x0;this[_0xb6c7('0x20')]=0x0;this['notInUse']=0x0;this[_0xb6c7('0x46')]=0x0;this[_0xb6c7('0x17')]=0x0;this['invalid']=0x0;this[_0xb6c7('0x1f')]=0x0;this[_0xb6c7('0x1')]=0x0;this[_0xb6c7('0x1b')]=0x0;this[_0xb6c7('0x19')]=0x0;if(_0x4eb2c7){if(_0x4eb2c7[_0xb6c7('0x0')]){this['available']=Number(_0x4eb2c7[_0xb6c7('0x0')]);}if(_0x4eb2c7[_0xb6c7('0x47')]){this[_0xb6c7('0x4')]=Number(_0x4eb2c7['loggedin']);}if(_0x4eb2c7['callers']){this[_0xb6c7('0x2')]=Number(_0x4eb2c7[_0xb6c7('0x48')]);}}for(var _0x2f177c=0x0;_0x2f177c<_0x214d04['length'];_0x2f177c++){var _0x4f243a=_0x793060['SIP/'+_0x214d04[_0x2f177c][_0xb6c7('0x14')]];if(_0x4f243a&&_0x4f243a[_0xb6c7('0x49')]){this[_0xb6c7('0x5')]+=0x1;}if(_0x214d04[_0x2f177c][_0xb6c7('0x4a')]==='1'){this[_0xb6c7('0x1d')]+=0x1;}if(_0x214d04[_0x2f177c][_0xb6c7('0x10')]==='1'&&!['2','7','8'][_0xb6c7('0x4b')](_0x214d04[_0x2f177c]['status'])){this[_0xb6c7('0x10')]+=0x1;}switch(_0x214d04[_0x2f177c][_0xb6c7('0x4c')]){case'0':this[_0xb6c7('0x20')]+=0x1;break;case'1':this[_0xb6c7('0x1a')]+=0x1;break;case'2':this[_0xb6c7('0x46')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this[_0xb6c7('0x18')]+=0x1;break;case'5':this[_0xb6c7('0x1f')]+=0x1;break;case'6':this[_0xb6c7('0x1')]+=0x1;break;case'7':this[_0xb6c7('0x1b')]+=0x1;break;case'8':this[_0xb6c7('0x19')]+=0x1;break;}}if(this[_0xb6c7('0x25')]==='booked'){var _0x16b0c2=Object[_0xb6c7('0x4d')](_0x4e0888);for(var _0x2116cb=0x0;_0x2116cb<_0x16b0c2[_0xb6c7('0x4e')];_0x2116cb++){var _0x3153c8=_0x16b0c2[_0x2116cb];var _0x908d7a=_0x4e0888[_0x3153c8];if(_0x908d7a[_0xb6c7('0x4f')]===this['name']&&_0x908d7a['type']==='dialer'&&_0x908d7a[_0xb6c7('0x50')]===_0xb6c7('0x51')){this[_0xb6c7('0x1d')]+=0x1;}}if(this[_0xb6c7('0x1d')]>this[_0xb6c7('0x46')]){this[_0xb6c7('0x1d')]=this['inUse'];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0xb6c7('0x44')]['compareToInboundQueue']=function(_0xf6b6a9){var _0x8c5b9c=![];if(_0xf6b6a9){_0x8c5b9c=INBOUND_COUNTERS[_0xb6c7('0x52')](function(_0x210d50){return this[_0x210d50]!==_0xf6b6a9[_0x210d50];},this);}return _0x8c5b9c;};VoiceQueueSummary[_0xb6c7('0x44')]['compareToOutboundQueue']=function(_0x222c72){var _0x5700dc=![];var _0x3956f2=![];var _0xdfcaa9=![];if(_0x222c72){_0x5700dc=this[_0xb6c7('0x25')]!==_0x222c72[_0xb6c7('0x25')]||this[_0xb6c7('0x24')]!==_0x222c72['dialActive']||this[_0xb6c7('0x40')]!==_0x222c72[_0xb6c7('0x40')]||this[_0xb6c7('0x41')]!==_0x222c72[_0xb6c7('0x41')];_0x3956f2=OUTBOUND_COUNTERS[_0xb6c7('0x52')](function(_0x42a4a8){return this[_0x42a4a8]!==_0x222c72[_0x42a4a8];},this);if(this[_0xb6c7('0x42')]&&_0x222c72[_0xb6c7('0x42')]){_0xdfcaa9=this['Trunk'][_0xb6c7('0x14')]!==_0x222c72[_0xb6c7('0x42')][_0xb6c7('0x14')]||this[_0xb6c7('0x42')][_0xb6c7('0x53')]!==_0x222c72[_0xb6c7('0x42')]['active'];}}return _0x5700dc||_0x3956f2||_0xdfcaa9;};VoiceQueueSummary[_0xb6c7('0x44')][_0xb6c7('0x54')]=function(_0x189a63){this[_0xb6c7('0x3')]=_0x189a63['answered'];this[_0xb6c7('0x40')]=_0x189a63[_0xb6c7('0x40')];this[_0xb6c7('0x41')]=_0x189a63[_0xb6c7('0x41')];this[_0xb6c7('0x6')]=_0x189a63[_0xb6c7('0x6')];this[_0xb6c7('0x7')]=_0x189a63['outboundAbandonedCallsDay'];this[_0xb6c7('0x8')]=_0x189a63[_0xb6c7('0x8')];this[_0xb6c7('0x2b')]=_0x189a63['outboundBlacklistCallsDay'];this[_0xb6c7('0x9')]=_0x189a63[_0xb6c7('0x9')];this[_0xb6c7('0xa')]=_0x189a63[_0xb6c7('0xa')];this[_0xb6c7('0xb')]=_0x189a63['outboundNoAnswerCallsDay'];this[_0xb6c7('0xc')]=_0x189a63[_0xb6c7('0xc')];this[_0xb6c7('0xd')]=_0x189a63[_0xb6c7('0xd')];this[_0xb6c7('0xe')]=_0x189a63[_0xb6c7('0xe')];this['outboundUnknownCallsDay']=_0x189a63[_0xb6c7('0xf')];this[_0xb6c7('0x11')]=_0x189a63['sumBillable'];this[_0xb6c7('0x12')]=_0x189a63[_0xb6c7('0x12')];this['total']=_0x189a63[_0xb6c7('0x13')];if(this[_0xb6c7('0x25')]===_0xb6c7('0x55')){this[_0xb6c7('0x23')]=_0x189a63[_0xb6c7('0x23')];}};module[_0xb6c7('0x56')]=VoiceQueueSummary; \ No newline at end of file +var _0x6f72=['waiting','answered','inUse','outboundAbandonedCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','total','name','strategy','abandoned','available','busy','invalid','onHold','notInUse','ringing','ringInUse','sumDuration','sumHoldTime','type','unavailable','unknown','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','callers','length','SIP/','online','incall','status','booked','keys','dialer','exten','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue','outboundAnswerCallsDay','preview','exports','loggedIn','loggedInDb','paused','talking'];(function(_0x52b19f,_0xe4c367){var _0x11caf2=function(_0x212ef){while(--_0x212ef){_0x52b19f['push'](_0x52b19f['shift']());}};_0x11caf2(++_0xe4c367);}(_0x6f72,0xae));var _0x26f7=function(_0x2ff980,_0xf5e589){_0x2ff980=_0x2ff980-0x0;var _0x3e4a63=_0x6f72[_0x2ff980];return _0x3e4a63;};'use strict';var INBOUND_COUNTERS=['available',_0x26f7('0x0'),_0x26f7('0x1'),_0x26f7('0x2'),'ringing',_0x26f7('0x3'),_0x26f7('0x4')];var OUTBOUND_COUNTERS=['available',_0x26f7('0x5'),_0x26f7('0x6'),'loggedIn',_0x26f7('0x1'),'originated',_0x26f7('0x7'),'outboundAnswerCallsDay',_0x26f7('0x8'),_0x26f7('0x9'),'outboundCongestionCallsDay','outboundNoAnswerCallsDay',_0x26f7('0xa'),_0x26f7('0xb'),_0x26f7('0xc'),_0x26f7('0xd'),_0x26f7('0x2'),_0x26f7('0xe'),_0x26f7('0x3'),_0x26f7('0xf'),'sumDuration',_0x26f7('0x10'),'waiting'];function VoiceQueueSummary(_0x11d2f0){this['id']=_0x11d2f0['id'];this[_0x26f7('0x11')]=_0x11d2f0[_0x26f7('0x11')];this[_0x26f7('0x12')]=_0x11d2f0[_0x26f7('0x12')];this[_0x26f7('0x13')]=_0x11d2f0[_0x26f7('0x13')]||0x0;this[_0x26f7('0x5')]=_0x11d2f0[_0x26f7('0x5')]||0x0;this[_0x26f7('0x14')]=_0x11d2f0[_0x26f7('0x14')]||0x0;this[_0x26f7('0x15')]=_0x11d2f0['busy']||0x0;this[_0x26f7('0x6')]=_0x11d2f0[_0x26f7('0x6')]||0x0;this[_0x26f7('0x16')]=_0x11d2f0[_0x26f7('0x16')]||0x0;this['loggedIn']=_0x11d2f0[_0x26f7('0x0')]||0x0;this['loggedInDb']=_0x11d2f0[_0x26f7('0x1')]||0x0;this[_0x26f7('0x17')]=_0x11d2f0[_0x26f7('0x17')]||0x0;this[_0x26f7('0x18')]=_0x11d2f0['notInUse']||0x0;this['paused']=_0x11d2f0[_0x26f7('0x2')]||0x0;this['ringing']=_0x11d2f0[_0x26f7('0x19')]||0x0;this[_0x26f7('0x1a')]=_0x11d2f0[_0x26f7('0x1a')];this[_0x26f7('0xf')]=_0x11d2f0[_0x26f7('0xf')];this[_0x26f7('0x1b')]=_0x11d2f0[_0x26f7('0x1b')];this[_0x26f7('0x1c')]=_0x11d2f0[_0x26f7('0x1c')]||0x0;this[_0x26f7('0x3')]=_0x11d2f0['talking']||0x0;this[_0x26f7('0x10')]=_0x11d2f0[_0x26f7('0x10')]||0x0;this[_0x26f7('0x1d')]=_0x11d2f0[_0x26f7('0x1d')];this[_0x26f7('0x1e')]=_0x11d2f0[_0x26f7('0x1e')]||0x0;this[_0x26f7('0x1f')]=_0x11d2f0[_0x26f7('0x1f')]||0x0;this[_0x26f7('0x20')]=_0x11d2f0[_0x26f7('0x20')]||0x0;this[_0x26f7('0x4')]=_0x11d2f0['waiting']||0x0;if(_0x11d2f0[_0x26f7('0x1d')]==='outbound'){this['pTalking']=_0x11d2f0[_0x26f7('0xe')]||0x0;this[_0x26f7('0x21')]=_0x11d2f0[_0x26f7('0x21')];this[_0x26f7('0x22')]=_0x11d2f0[_0x26f7('0x22')];this['dialOriginateCallerIdName']=_0x11d2f0[_0x26f7('0x23')];this[_0x26f7('0x24')]=_0x11d2f0[_0x26f7('0x24')];this[_0x26f7('0x25')]=_0x11d2f0[_0x26f7('0x25')];this[_0x26f7('0x26')]=_0x11d2f0['dialPrefix'];this[_0x26f7('0x27')]=_0x11d2f0['temp'];this['outboundAnswerAgiCallsDay']=_0x11d2f0[_0x26f7('0x28')];this['outboundAnswerCallsDay']=_0x11d2f0['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0x11d2f0[_0x26f7('0x8')];this[_0x26f7('0x9')]=_0x11d2f0[_0x26f7('0x9')];this[_0x26f7('0x29')]=_0x11d2f0[_0x26f7('0x29')];this['outboundDropCallsDayACS']=_0x11d2f0[_0x26f7('0x2a')];this['outboundDropCallsDayCallersExit']=_0x11d2f0['outboundDropCallsDayCallersExit'];this['outboundDropCallsDayTimeout']=_0x11d2f0[_0x26f7('0x2b')];this[_0x26f7('0x2c')]=_0x11d2f0[_0x26f7('0x2c')];this[_0x26f7('0xa')]=_0x11d2f0['outboundNoSuchCallsDay'];this['outboundOriginateFailureCallsDay']=_0x11d2f0['outboundOriginateFailureCallsDay'];this[_0x26f7('0xb')]=_0x11d2f0[_0x26f7('0xb')];this['outboundRejectCallsDay']=_0x11d2f0[_0x26f7('0xc')];this[_0x26f7('0xd')]=_0x11d2f0[_0x26f7('0xd')];this[_0x26f7('0x2d')]=_0x11d2f0[_0x26f7('0x2d')];this[_0x26f7('0x2e')]=_0x11d2f0['predictiveIntervalAvgHoldtime'];this[_0x26f7('0x2f')]=_0x11d2f0[_0x26f7('0x2f')];this[_0x26f7('0x30')]=_0x11d2f0['predictiveIntervalDroppedCallsCallersExit'];this[_0x26f7('0x31')]=_0x11d2f0[_0x26f7('0x31')];this['predictiveIntervalErlangCalls']=_0x11d2f0[_0x26f7('0x32')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x11d2f0[_0x26f7('0x33')];this[_0x26f7('0x34')]=_0x11d2f0['predictiveIntervalHitRate'];this[_0x26f7('0x35')]=_0x11d2f0[_0x26f7('0x35')];this[_0x26f7('0x36')]=_0x11d2f0['predictiveIntervalPauses'];this['predictiveIntervalAvailable']=_0x11d2f0[_0x26f7('0x37')];this['predictiveIntervalTotalCalls']=_0x11d2f0[_0x26f7('0x38')];this[_0x26f7('0x39')]=_0x11d2f0[_0x26f7('0x39')];this[_0x26f7('0x3a')]=_0x11d2f0['erlangCalls'];this[_0x26f7('0x3b')]=_0x11d2f0[_0x26f7('0x3b')];this[_0x26f7('0x3c')]=_0x11d2f0[_0x26f7('0x3c')];this[_0x26f7('0x3d')]=_0x11d2f0[_0x26f7('0x3d')];this[_0x26f7('0x3e')]=_0x11d2f0[_0x26f7('0x3e')];this[_0x26f7('0x3f')]=_0x11d2f0[_0x26f7('0x3f')];this[_0x26f7('0x40')]=_0x11d2f0['message'];this[_0x26f7('0x41')]=_0x11d2f0[_0x26f7('0x41')];}if(_0x11d2f0['Trunk']){this[_0x26f7('0x42')]={'id':_0x11d2f0['Trunk']['id'],'name':_0x11d2f0[_0x26f7('0x42')][_0x26f7('0x11')],'active':_0x11d2f0[_0x26f7('0x42')][_0x26f7('0x43')],'callerid':_0x11d2f0[_0x26f7('0x42')][_0x26f7('0x44')]};}}VoiceQueueSummary[_0x26f7('0x45')][_0x26f7('0x46')]=function(_0x478764,_0x130988,_0x1bd16e,_0x2aea16){this['loggedInDb']=0x0;this[_0x26f7('0x3')]=0x0;this['paused']=0x0;this['unknown']=0x0;this[_0x26f7('0x18')]=0x0;this['inUse']=0x0;this['busy']=0x0;this[_0x26f7('0x16')]=0x0;this['unavailable']=0x0;this[_0x26f7('0x19')]=0x0;this[_0x26f7('0x1a')]=0x0;this[_0x26f7('0x17')]=0x0;if(_0x1bd16e){if(_0x1bd16e[_0x26f7('0x14')]){this[_0x26f7('0x14')]=Number(_0x1bd16e[_0x26f7('0x14')]);}if(_0x1bd16e[_0x26f7('0x47')]){this[_0x26f7('0x0')]=Number(_0x1bd16e[_0x26f7('0x47')]);}if(_0x1bd16e[_0x26f7('0x48')]){this['waiting']=Number(_0x1bd16e[_0x26f7('0x48')]);}}for(var _0x14890b=0x0;_0x14890b<_0x478764[_0x26f7('0x49')];_0x14890b++){var _0x4bf2a2=_0x130988[_0x26f7('0x4a')+_0x478764[_0x14890b][_0x26f7('0x11')]];if(_0x4bf2a2&&_0x4bf2a2[_0x26f7('0x4b')]){this[_0x26f7('0x1')]+=0x1;}if(_0x478764[_0x14890b][_0x26f7('0x4c')]==='1'){this[_0x26f7('0x3')]+=0x1;}if(_0x478764[_0x14890b]['paused']==='1'&&!['2','7','8']['includes'](_0x478764[_0x14890b][_0x26f7('0x4d')])){this[_0x26f7('0x2')]+=0x1;}switch(_0x478764[_0x14890b][_0x26f7('0x4d')]){case'0':this[_0x26f7('0x1f')]+=0x1;break;case'1':this[_0x26f7('0x18')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x26f7('0x15')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x26f7('0x1e')]+=0x1;break;case'6':this[_0x26f7('0x19')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0x26f7('0x17')]+=0x1;break;}}if(this['dialMethod']===_0x26f7('0x4e')){var _0x4f4e2b=Object[_0x26f7('0x4f')](_0x2aea16);for(var _0x5d4c93=0x0;_0x5d4c93<_0x4f4e2b[_0x26f7('0x49')];_0x5d4c93++){var _0x37023f=_0x4f4e2b[_0x5d4c93];var _0x121de3=_0x2aea16[_0x37023f];if(_0x121de3['queue']===this[_0x26f7('0x11')]&&_0x121de3[_0x26f7('0x1d')]===_0x26f7('0x50')&&_0x121de3[_0x26f7('0x51')]==='xcally-motion-preview'){this[_0x26f7('0x3')]+=0x1;}}if(this[_0x26f7('0x3')]>this[_0x26f7('0x6')]){this[_0x26f7('0x3')]=this[_0x26f7('0x6')];}this[_0x26f7('0xe')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0x26f7('0x52')]=function(_0xa65a9c){var _0x1f4592=![];if(_0xa65a9c){_0x1f4592=INBOUND_COUNTERS[_0x26f7('0x53')](function(_0x5344c8){return this[_0x5344c8]!==_0xa65a9c[_0x5344c8];},this);}return _0x1f4592;};VoiceQueueSummary['prototype'][_0x26f7('0x54')]=function(_0x2c7918){var _0x4f0223=![];var _0x4394c7=![];var _0x410e8e=![];if(_0x2c7918){_0x4f0223=this[_0x26f7('0x22')]!==_0x2c7918[_0x26f7('0x22')]||this[_0x26f7('0x21')]!==_0x2c7918[_0x26f7('0x21')]||this['message']!==_0x2c7918[_0x26f7('0x40')]||this[_0x26f7('0x41')]!==_0x2c7918[_0x26f7('0x41')];_0x4394c7=OUTBOUND_COUNTERS[_0x26f7('0x53')](function(_0x1adf4e){return this[_0x1adf4e]!==_0x2c7918[_0x1adf4e];},this);if(this[_0x26f7('0x42')]&&_0x2c7918['Trunk']){_0x410e8e=this[_0x26f7('0x42')]['name']!==_0x2c7918['Trunk']['name']||this[_0x26f7('0x42')]['active']!==_0x2c7918[_0x26f7('0x42')][_0x26f7('0x43')];}}return _0x4f0223||_0x4394c7||_0x410e8e;};VoiceQueueSummary['prototype'][_0x26f7('0x55')]=function(_0x29ec12){this[_0x26f7('0x5')]=_0x29ec12[_0x26f7('0x5')];this[_0x26f7('0x40')]=_0x29ec12[_0x26f7('0x40')];this[_0x26f7('0x41')]=_0x29ec12[_0x26f7('0x41')];this[_0x26f7('0x39')]=_0x29ec12['originated'];this[_0x26f7('0x7')]=_0x29ec12['outboundAbandonedCallsDay'];this[_0x26f7('0x56')]=_0x29ec12[_0x26f7('0x56')];this[_0x26f7('0x8')]=_0x29ec12[_0x26f7('0x8')];this['outboundBusyCallsDay']=_0x29ec12[_0x26f7('0x9')];this[_0x26f7('0x29')]=_0x29ec12[_0x26f7('0x29')];this[_0x26f7('0x2c')]=_0x29ec12[_0x26f7('0x2c')];this['outboundNoSuchCallsDay']=_0x29ec12[_0x26f7('0xa')];this[_0x26f7('0xb')]=_0x29ec12['outboundReCallsDay'];this[_0x26f7('0xc')]=_0x29ec12['outboundRejectCallsDay'];this[_0x26f7('0xd')]=_0x29ec12['outboundUnknownCallsDay'];this['sumBillable']=_0x29ec12[_0x26f7('0xf')];this[_0x26f7('0x1b')]=_0x29ec12[_0x26f7('0x1b')];this[_0x26f7('0x10')]=_0x29ec12[_0x26f7('0x10')];if(this['dialMethod']===_0x26f7('0x57')){this['pTalking']=_0x29ec12[_0x26f7('0xe')];}};module[_0x26f7('0x58')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 696981d..0ce995f 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 _0xe676=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x48cdd7,_0x35736d){var _0x368692=function(_0x2e0f3e){while(--_0x2e0f3e){_0x48cdd7['push'](_0x48cdd7['shift']());}};_0x368692(++_0x35736d);}(_0xe676,0x14f));var _0x6e67=function(_0x566bdf,_0x1f4861){_0x566bdf=_0x566bdf-0x0;var _0x331215=_0xe676[_0x566bdf];return _0x331215;};'use strict';function VtigerAccount(_0x1102c1){this['id']=_0x1102c1['id']||0x0;this['name']=_0x1102c1[_0x6e67('0x0')]||'';this[_0x6e67('0x1')]=_0x1102c1[_0x6e67('0x1')]||'';this['accessKey']=_0x1102c1[_0x6e67('0x2')]||'';this[_0x6e67('0x3')]=_0x1102c1[_0x6e67('0x3')]||'';this[_0x6e67('0x4')]=_0x1102c1[_0x6e67('0x4')]||'';this['Configurations']=_0x1102c1[_0x6e67('0x5')]||{};}module[_0x6e67('0x6')]=VtigerAccount; \ No newline at end of file +var _0x19dd=['serverUrl','Configurations','name','username','accessKey','remoteUri'];(function(_0x337631,_0x436102){var _0xcc1f6c=function(_0x2836da){while(--_0x2836da){_0x337631['push'](_0x337631['shift']());}};_0xcc1f6c(++_0x436102);}(_0x19dd,0x1b2));var _0xd19d=function(_0x232f4b,_0x2377bd){_0x232f4b=_0x232f4b-0x0;var _0x2df97f=_0x19dd[_0x232f4b];return _0x2df97f;};'use strict';function VtigerAccount(_0x38df3b){this['id']=_0x38df3b['id']||0x0;this[_0xd19d('0x0')]=_0x38df3b[_0xd19d('0x0')]||'';this[_0xd19d('0x1')]=_0x38df3b[_0xd19d('0x1')]||'';this[_0xd19d('0x2')]=_0x38df3b[_0xd19d('0x2')]||'';this[_0xd19d('0x3')]=_0x38df3b[_0xd19d('0x3')]||'';this[_0xd19d('0x4')]=_0x38df3b[_0xd19d('0x4')]||'';this['Configurations']=_0x38df3b[_0xd19d('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index e6cc47e..a868847 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 _0xb444=['type','integrationTab','serverUrl','Configurations','name','username','password','authType'];(function(_0x30066f,_0x5891c9){var _0x1ad673=function(_0x296b6c){while(--_0x296b6c){_0x30066f['push'](_0x30066f['shift']());}};_0x1ad673(++_0x5891c9);}(_0xb444,0x16c));var _0x4b44=function(_0x37f5db,_0x6a01b8){_0x37f5db=_0x37f5db-0x0;var _0xd4c93b=_0xb444[_0x37f5db];return _0xd4c93b;};'use strict';function ZendeskAccount(_0x3044a7){this['id']=_0x3044a7['id']||0x0;this[_0x4b44('0x0')]=_0x3044a7['name']||'';this[_0x4b44('0x1')]=_0x3044a7['username']||'';this[_0x4b44('0x2')]=_0x3044a7['password']||'';this['token']=_0x3044a7['token']||'';this['remoteUri']=_0x3044a7['remoteUri']||'';this[_0x4b44('0x3')]=_0x3044a7[_0x4b44('0x3')]||'';this[_0x4b44('0x4')]=_0x3044a7[_0x4b44('0x4')]||_0x4b44('0x5');this[_0x4b44('0x6')]=_0x3044a7['serverUrl']||'';this[_0x4b44('0x7')]=_0x3044a7[_0x4b44('0x7')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0xa821=['name','username','password','token','remoteUri','authType','type','serverUrl','Configurations'];(function(_0x4e3b9c,_0x1ba5f4){var _0x3cf031=function(_0x2f1b5d){while(--_0x2f1b5d){_0x4e3b9c['push'](_0x4e3b9c['shift']());}};_0x3cf031(++_0x1ba5f4);}(_0xa821,0x156));var _0x1a82=function(_0x3e5e60,_0x5ed4f0){_0x3e5e60=_0x3e5e60-0x0;var _0x3b7a2b=_0xa821[_0x3e5e60];return _0x3b7a2b;};'use strict';function ZendeskAccount(_0x43775b){this['id']=_0x43775b['id']||0x0;this[_0x1a82('0x0')]=_0x43775b[_0x1a82('0x0')]||'';this[_0x1a82('0x1')]=_0x43775b[_0x1a82('0x1')]||'';this[_0x1a82('0x2')]=_0x43775b[_0x1a82('0x2')]||'';this[_0x1a82('0x3')]=_0x43775b[_0x1a82('0x3')]||'';this['remoteUri']=_0x43775b[_0x1a82('0x4')]||'';this['authType']=_0x43775b[_0x1a82('0x5')]||'';this[_0x1a82('0x6')]=_0x43775b[_0x1a82('0x6')]||'integrationTab';this['serverUrl']=_0x43775b[_0x1a82('0x7')]||'';this['Configurations']=_0x43775b[_0x1a82('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index aa623f3..34b5ca4 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 _0x3350=['name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports'];(function(_0x20d54d,_0x1adc8e){var _0x516e8b=function(_0x2754e1){while(--_0x2754e1){_0x20d54d['push'](_0x20d54d['shift']());}};_0x516e8b(++_0x1adc8e);}(_0x3350,0xd1));var _0x0335=function(_0x1348d0,_0x28b52d){_0x1348d0=_0x1348d0-0x0;var _0x4b2a1d=_0x3350[_0x1348d0];return _0x4b2a1d;};'use strict';function ZohoAccount(_0x41c484){this['id']=_0x41c484['id']||0x0;this[_0x0335('0x0')]=_0x41c484['name']||'';this['description']=_0x41c484[_0x0335('0x1')]||'';this[_0x0335('0x2')]=_0x41c484[_0x0335('0x2')]||'';this['zone']=_0x41c484[_0x0335('0x3')]||'';this[_0x0335('0x4')]=_0x41c484[_0x0335('0x4')]||'';this[_0x0335('0x5')]=_0x41c484['clientSecret']||'';this[_0x0335('0x6')]=_0x41c484[_0x0335('0x6')]||'';this[_0x0335('0x7')]=_0x41c484['code']||'';this[_0x0335('0x8')]=_0x41c484[_0x0335('0x8')]||'';this[_0x0335('0x9')]=_0x41c484[_0x0335('0x9')]||{};}module[_0x0335('0xa')]=ZohoAccount; \ No newline at end of file +var _0xf19f=['name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports'];(function(_0x2bd4f0,_0x398d13){var _0x4e794e=function(_0x59be89){while(--_0x59be89){_0x2bd4f0['push'](_0x2bd4f0['shift']());}};_0x4e794e(++_0x398d13);}(_0xf19f,0xfd));var _0xff19=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0xf19f[_0x31ced5];return _0x10d9e5;};'use strict';function ZohoAccount(_0x1d2857){this['id']=_0x1d2857['id']||0x0;this[_0xff19('0x0')]=_0x1d2857[_0xff19('0x0')]||'';this[_0xff19('0x1')]=_0x1d2857[_0xff19('0x1')]||'';this[_0xff19('0x2')]=_0x1d2857['host']||'';this[_0xff19('0x3')]=_0x1d2857[_0xff19('0x3')]||'';this[_0xff19('0x4')]=_0x1d2857['clientId']||'';this[_0xff19('0x5')]=_0x1d2857[_0xff19('0x5')]||'';this[_0xff19('0x6')]=_0x1d2857[_0xff19('0x6')]||'';this[_0xff19('0x7')]=_0x1d2857[_0xff19('0x7')]||'';this[_0xff19('0x8')]=_0x1d2857[_0xff19('0x8')]||'';this[_0xff19('0x9')]=_0x1d2857[_0xff19('0x9')]||{};}module[_0xff19('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 346d150..90ce7d2 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 _0xfcbb=['name','format','SIP/%s','Contact','firstName','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','type','campaigntype','dialAnswer','membername','Agent'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x4bbba9,_0x58fc76){_0x4bbba9=_0x4bbba9-0x0;var _0x9a2ca5=_0xfcbb[_0x4bbba9];return _0x9a2ca5;};'use strict';var util=require(_0xbfcb('0x0'));var _=require(_0xbfcb('0x1'));var moment=require(_0xbfcb('0x2'));function checkNameSurname(_0x5a1002,_0x5747a4,_0x462349){var _0x280329='';if(!_[_0xbfcb('0x3')](_0x5747a4)&&_0xbfcb('0x4')===typeof _0x5747a4){_0x280329+=_0x5747a4;}if(!_[_0xbfcb('0x3')](_0x462349)&&'string'===typeof _0x462349){_0x280329+='\x20'+_0x462349;}if(_0x280329!==''){return _0x280329;}return _0x5a1002;}function Action(_0x5201d3,_0x32c2aa,_0x4990c,_0x8d4e6a,_0x2df839){this[_0xbfcb('0x5')]=_0x4990c||undefined;this[_0xbfcb('0x6')]=_0x5201d3['id'];this[_0xbfcb('0x7')]=_0x32c2aa['name'];this[_0xbfcb('0x8')]=_0x32c2aa[_0xbfcb('0x8')];this[_0xbfcb('0x9')]='queue';this[_0xbfcb('0xa')]=![];this[_0xbfcb('0xb')]=_[_0xbfcb('0x3')](_0x5201d3[_0xbfcb('0xc')])?undefined:_0x5201d3[_0xbfcb('0xc')][_0xbfcb('0xd')];this['channelAgent']=this[_0xbfcb('0xb')]?util[_0xbfcb('0xe')](_0xbfcb('0xf'),this[_0xbfcb('0xb')]):_0x8d4e6a||undefined;this['calleridname']=checkNameSurname(_0x5201d3[_0xbfcb('0x10')]['phone'],_0x5201d3[_0xbfcb('0x10')][_0xbfcb('0x11')],_0x5201d3[_0xbfcb('0x10')][_0xbfcb('0x12')]);this[_0xbfcb('0x13')]=_0x5201d3[_0xbfcb('0x13')]||![];this[_0xbfcb('0x14')]=_0x5201d3[_0xbfcb('0x15')];this[_0xbfcb('0x16')]=_0x5201d3[_0xbfcb('0x16')];this[_0xbfcb('0x17')]=_0x5201d3[_0xbfcb('0x17')]||0x0;this[_0xbfcb('0x18')]=_0x5201d3[_0xbfcb('0x18')]||0x0;this[_0xbfcb('0x19')]=_0x5201d3[_0xbfcb('0x19')]||0x0;this[_0xbfcb('0x1a')]=(_0x5201d3[_0xbfcb('0x17')]||0x0)+(_0x5201d3[_0xbfcb('0x18')]||0x0)+(_0x5201d3[_0xbfcb('0x19')]||0x0)+(_0x5201d3[_0xbfcb('0x1b')]||0x0)+(_0x5201d3[_0xbfcb('0x1c')]||0x0)+(_0x5201d3['countabandonedretry']||0x0)+(_0x5201d3[_0xbfcb('0x1d')]||0x0)+(_0x5201d3[_0xbfcb('0x1e')]||0x0);this['countnosuchnumberretry']=_0x5201d3[_0xbfcb('0x1b')]||0x0;this[_0xbfcb('0x1c')]=_0x5201d3['countdropretry']||0x0;this['countabandonedretry']=_0x5201d3[_0xbfcb('0x1f')]||0x0;this[_0xbfcb('0x1d')]=_0x5201d3[_0xbfcb('0x1d')]||0x0;this[_0xbfcb('0x1e')]=_0x5201d3[_0xbfcb('0x1e')]||0x0;this['callback']=_0x5201d3[_0xbfcb('0x20')];this[_0xbfcb('0x21')]=_0x5201d3[_0xbfcb('0x21')];this[_0xbfcb('0x22')]=_0x5201d3[_0xbfcb('0x22')];this[_0xbfcb('0x23')]=_0x5201d3[_0xbfcb('0x23')];this[_0xbfcb('0x24')]=_0x5201d3[_0xbfcb('0x24')];this[_0xbfcb('0x25')]=_0x5201d3[_0xbfcb('0x25')];this[_0xbfcb('0x26')]=_[_0xbfcb('0x3')](_0x5201d3[_0xbfcb('0xc')])?_0x5201d3[_0xbfcb('0x26')]:_0x5201d3[_0xbfcb('0xc')]['id'];this['VoiceQueueId']=_0x5201d3[_0xbfcb('0x27')];this[_0xbfcb('0x28')]='';this['originatecalleridname']='';}Action[_0xbfcb('0x29')][_0xbfcb('0x2a')]=function(){return util[_0xbfcb('0xe')](_0xbfcb('0x2b'),this[_0xbfcb('0x2c')],this[_0xbfcb('0x2d')]);};module[_0xbfcb('0x2e')]=Action; \ No newline at end of file +var _0x4bd3=['name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','format','\x22%s\x22\x20<%s>','number','exports','util','moment','isNil','string','idContact','queue'];(function(_0x51a970,_0xcd4a22){var _0xdd4315=function(_0x222142){while(--_0x222142){_0x51a970['push'](_0x51a970['shift']());}};_0xdd4315(++_0xcd4a22);}(_0x4bd3,0x174));var _0x34bd=function(_0x45d3de,_0x3b5c71){_0x45d3de=_0x45d3de-0x0;var _0x272ddc=_0x4bd3[_0x45d3de];return _0x272ddc;};'use strict';var util=require(_0x34bd('0x0'));var _=require('lodash');var moment=require(_0x34bd('0x1'));function checkNameSurname(_0x22a9f9,_0x5369c1,_0x4997bc){var _0x4cad21='';if(!_[_0x34bd('0x2')](_0x5369c1)&&_0x34bd('0x3')===typeof _0x5369c1){_0x4cad21+=_0x5369c1;}if(!_[_0x34bd('0x2')](_0x4997bc)&&'string'===typeof _0x4997bc){_0x4cad21+='\x20'+_0x4997bc;}if(_0x4cad21!==''){return _0x4cad21;}return _0x22a9f9;}function Action(_0x2133c5,_0x2a15a2,_0x5c2a7a,_0x3e8744,_0x213716){this['uniqueid']=_0x5c2a7a||undefined;this[_0x34bd('0x4')]=_0x2133c5['id'];this[_0x34bd('0x5')]=_0x2a15a2[_0x34bd('0x6')];this[_0x34bd('0x7')]=_0x2a15a2[_0x34bd('0x7')];this[_0x34bd('0x8')]='queue';this[_0x34bd('0x9')]=![];this[_0x34bd('0xa')]=_[_0x34bd('0x2')](_0x2133c5[_0x34bd('0xb')])?undefined:_0x2133c5['Agent']['name'];this[_0x34bd('0xc')]=this['membername']?util['format'](_0x34bd('0xd'),this[_0x34bd('0xa')]):_0x3e8744||undefined;this[_0x34bd('0xe')]=checkNameSurname(_0x2133c5[_0x34bd('0xf')][_0x34bd('0x10')],_0x2133c5[_0x34bd('0xf')][_0x34bd('0x11')],_0x2133c5[_0x34bd('0xf')][_0x34bd('0x12')]);this['active']=_0x2133c5[_0x34bd('0x13')]||![];this['calleridnum']=_0x2133c5['phone'];this[_0x34bd('0x14')]=_0x2133c5[_0x34bd('0x14')];this[_0x34bd('0x15')]=_0x2133c5[_0x34bd('0x15')]||0x0;this[_0x34bd('0x16')]=_0x2133c5[_0x34bd('0x16')]||0x0;this[_0x34bd('0x17')]=_0x2133c5[_0x34bd('0x17')]||0x0;this[_0x34bd('0x18')]=(_0x2133c5[_0x34bd('0x15')]||0x0)+(_0x2133c5[_0x34bd('0x16')]||0x0)+(_0x2133c5['countnoanswerretry']||0x0)+(_0x2133c5[_0x34bd('0x19')]||0x0)+(_0x2133c5[_0x34bd('0x1a')]||0x0)+(_0x2133c5[_0x34bd('0x1b')]||0x0)+(_0x2133c5[_0x34bd('0x1c')]||0x0)+(_0x2133c5[_0x34bd('0x1d')]||0x0);this[_0x34bd('0x19')]=_0x2133c5[_0x34bd('0x19')]||0x0;this[_0x34bd('0x1a')]=_0x2133c5[_0x34bd('0x1a')]||0x0;this['countabandonedretry']=_0x2133c5[_0x34bd('0x1b')]||0x0;this[_0x34bd('0x1c')]=_0x2133c5[_0x34bd('0x1c')]||0x0;this[_0x34bd('0x1d')]=_0x2133c5[_0x34bd('0x1d')]||0x0;this['callback']=_0x2133c5['callback'];this['callbackuniqueid']=_0x2133c5['callbackuniqueid'];this[_0x34bd('0x1e')]=_0x2133c5['callbackat'];this[_0x34bd('0x1f')]=_0x2133c5[_0x34bd('0x1f')];this[_0x34bd('0x20')]=_0x2133c5['ContactId'];this[_0x34bd('0x21')]=_0x2133c5[_0x34bd('0x21')];this[_0x34bd('0x22')]=_[_0x34bd('0x2')](_0x2133c5['Agent'])?_0x2133c5[_0x34bd('0x22')]:_0x2133c5[_0x34bd('0xb')]['id'];this[_0x34bd('0x23')]=_0x2133c5[_0x34bd('0x23')];this['originatecalleridnum']='';this[_0x34bd('0x24')]='';}Action[_0x34bd('0x25')]['getCaller']=function(){return util[_0x34bd('0x26')](_0x34bd('0x27'),this[_0x34bd('0xe')],this[_0x34bd('0x28')]);};module[_0x34bd('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index a00778b..0e8307d 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 _0x34e8=['localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangupRequest','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','name','emit','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','paused','INACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','message','CAMPAIGN_STATUS','DEACTIVATED','syncCampaigns','hasOwnProperty','dialMethod','booked','outbound','clearZombieChannels','type','dialActive','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','[clearZombieChannels][talking]','Queue','actions','queue','originated:\x20','stringify','dialAnswer','VoiceQueueId','Action','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[action]','agentReadyId','isNil','length','getDiff','scheduledat','Agent','voicePause','run','then','logger2','[RecallMe]','disableContact','starttime','format','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','createCustomerHistory','[HistoryRecallClose]','[getContactRecallMe]','setMessage','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','[syncHangup][talking][increment]','uniqueid','pTalking:\x20','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','\x20Queue','linkedid','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','outboundNoAnswerCallsDay','countnoanswerretry','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','outboundCongestionCallsDay','countcongestionretry','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','outboundRejectCallsDay','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','custom:agentcalled','called','Calling','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','isTrunkReachable','active','SIP/%s','reachable','unmonitored','unlock','unlockContact','pick','execRun','recallme','isValid','checkIsBlackList','logger','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','dialOriginateCallerIdName','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','variables','[originated][increment]','OriginateError','syncNewExten','syncOriginateResponse','lookAgent','logLookAgent','responsetime','isFailure','custom:agentringnoanswer','rejected','syncHangup','[syncHangup][talking]','cause','statedesc','isUndefined','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destuniqueid','filterKey','keys','addVariable','variable','value','error','inspect','transfertargetlinkedid','transfer','transfererlinkedid','exports','util','lodash','uuid','moment','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','../dialer/utils','redis','defaults'];(function(_0x5e2751,_0x518a55){var _0x139a39=function(_0x4802db){while(--_0x4802db){_0x5e2751['push'](_0x5e2751['shift']());}};_0x139a39(++_0x518a55);}(_0x34e8,0x12c));var _0x834e=function(_0x4ee0ec,_0xeb3765){_0x4ee0ec=_0x4ee0ec-0x0;var _0x590346=_0x34e8[_0x4ee0ec];return _0x590346;};'use strict';var util=require(_0x834e('0x0'));var _=require(_0x834e('0x1'));var uuid=require(_0x834e('0x2'));var moment=require(_0x834e('0x3'));var Redis=require('ioredis');var config=require(_0x834e('0x4'));var logger=require(_0x834e('0x5'))(_0x834e('0x6'));var loggerAction=require(_0x834e('0x5'))(_0x834e('0x7'));var ami=require(_0x834e('0x8'));var rpcDb=require(_0x834e('0x9'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x834e('0xa'));var ut=require('./util/util');var utils=require(_0x834e('0xb'));config[_0x834e('0xc')]=_[_0x834e('0xd')](config[_0x834e('0xc')],{'host':_0x834e('0xe'),'port':0x18eb});var io=require(_0x834e('0xf'))(new Redis(config[_0x834e('0xc')]));var Sequence=function(){};Sequence[_0x834e('0x10')][_0x834e('0x11')]=function(_0x186b3b){this[_0x834e('0x12')]=this[_0x834e('0x12')]?this[_0x834e('0x12')][_0x834e('0x13')](_0x186b3b):_0x186b3b();};function Preview(_0x293514){this[_0x834e('0x14')]=new Sequence();this[_0x834e('0x15')]=_0x293514['voiceQueues'];this[_0x834e('0x16')]=_0x293514[_0x834e('0x16')];this['actions']={};this[_0x834e('0x17')]=_0x293514[_0x834e('0x17')];this[_0x834e('0x18')]=0x0;ami['on'](_0x834e('0x19'),this['syncOriginateResponse'][_0x834e('0x1a')](this));ami['on'](_0x834e('0x1b'),this['syncHangup'][_0x834e('0x1a')](this));ami['on']('hanguprequest',this[_0x834e('0x1c')][_0x834e('0x1a')](this));ami['on']('dialend',this[_0x834e('0x1d')][_0x834e('0x1a')](this));ami['on'](_0x834e('0x1e'),this['syncNewExten'][_0x834e('0x1a')](this));ami['on'](_0x834e('0x1f'),this[_0x834e('0x20')][_0x834e('0x1a')](this));ami['on'](_0x834e('0x21'),this[_0x834e('0x22')][_0x834e('0x1a')](this));ami['on']('blindtransfer',this[_0x834e('0x23')][_0x834e('0x1a')](this));this[_0x834e('0x24')](this[_0x834e('0x15')]);}function emit(_0x4ab05d,_0x45a630,_0x62f8f1){io['to'](_0x4ab05d)['emit'](_0x45a630,_0x62f8f1);}function emitVoiceQueueChannelRemove(_0x1b4bdf){logger[_0x834e('0x25')](_0x834e('0x26'),JSON['stringify'](_0x1b4bdf));emit(util['format'](_0x834e('0x27'),_0x1b4bdf[_0x834e('0x28')]),'voice_queue_channel:remove',_0x1b4bdf);io[_0x834e('0x29')](_0x834e('0x2a'),_0x1b4bdf);}function notSendMessagesQueue(_0x58f4fd){if(_0x58f4fd[_0x834e('0x2b')]){if(_0x58f4fd[_0x834e('0x2c')]===0x0&&_0x58f4fd[_0x834e('0x2d')]===0x0){_0x58f4fd['sendMessageOneNotActive']=![];_0x58f4fd[_0x834e('0x2e')]=0x0;_0x58f4fd[_0x834e('0x2f')]=0x0;_0x58f4fd['message']=utils['CAMPAIGN_STATUS'][_0x834e('0x30')];ut['logger'](_0x834e('0x31'),_0x58f4fd[_0x834e('0x28')]+_0x834e('0x32'));}else{_0x58f4fd[_0x834e('0x33')]=utils[_0x834e('0x34')][_0x834e('0x35')];ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x58f4fd['name']+'\x20is\x20deactivated');}}}Preview[_0x834e('0x10')][_0x834e('0x24')]=function(){var _0x106d6a=this;setInterval(function(){_0x106d6a['syncCampaigns']();},0x7cf);};Preview[_0x834e('0x10')][_0x834e('0x36')]=function(){var _0x1f3671=this[_0x834e('0x15')];this[_0x834e('0x18')]+=0x1;for(var _0x390119 in _0x1f3671){if(_0x1f3671[_0x834e('0x37')](_0x390119)&&(_0x1f3671[_0x390119][_0x834e('0x38')]===_0x834e('0x6')||_0x1f3671[_0x390119]['dialMethod']===_0x834e('0x39'))&&_0x1f3671[_0x390119]['type']===_0x834e('0x3a')){if(this[_0x834e('0x18')]>0x7){this[_0x834e('0x18')]=0x0;this[_0x834e('0x3b')]();}}if(_0x1f3671[_0x834e('0x37')](_0x390119)&&_0x1f3671[_0x390119][_0x834e('0x38')]===_0x834e('0x6')&&_0x1f3671[_0x390119][_0x834e('0x3c')]===_0x834e('0x3a')){if(_0x1f3671[_0x390119][_0x834e('0x3d')]){this['setMessage'](_0x1f3671[_0x390119]);if(_0x1f3671[_0x390119][_0x834e('0x3e')])this[_0x834e('0x3f')](_0x1f3671[_0x390119]);}else{notSendMessagesQueue(_0x1f3671[_0x390119]);}}}};Preview[_0x834e('0x10')][_0x834e('0x40')]=function(_0x595cc0){var _0x3f88ad=this;this[_0x834e('0x14')]['enqueue'](function(){if(!_['isNil'](_0x3f88ad['actions'][_0x595cc0])){loggerAction[_0x834e('0x25')](_0x834e('0x41'),_0x595cc0,_0x834e('0x42'),_0x3f88ad[_0x834e('0x43')][_0x595cc0][_0x834e('0x44')],_0x834e('0x45'),JSON['stringify'](_0x3f88ad[_0x834e('0x15')][_0x3f88ad['actions'][_0x595cc0][_0x834e('0x44')]][_0x834e('0x2c')]),'pTalking:\x20',JSON[_0x834e('0x46')](_0x3f88ad[_0x834e('0x15')][_0x3f88ad['actions'][_0x595cc0]['queue']][_0x834e('0x2d')]),JSON[_0x834e('0x46')](_0x3f88ad[_0x834e('0x43')][_0x595cc0][_0x834e('0x47')]),JSON[_0x834e('0x46')](_['pick'](_0x3f88ad[_0x834e('0x43')][_0x595cc0],['contactId','UserId',_0x834e('0x48'),'ListId'])));return ami[_0x834e('0x49')]({'action':_0x834e('0x4a'),'channel':_0x3f88ad[_0x834e('0x43')][_0x595cc0][_0x834e('0x4b')]})[_0x834e('0x4c')](function(_0x574ea8){if(_0x574ea8[_0x834e('0x33')]===_0x834e('0x4d')){setTimeout(function(){if(_0x3f88ad[_0x834e('0x43')][_0x595cc0]){ut['updateOriginated'](_0x3f88ad[_0x834e('0x15')][_0x3f88ad[_0x834e('0x43')][_0x595cc0]['queue']],_0x834e('0x4e'));if(_0x3f88ad['actions'][_0x595cc0][_0x834e('0x47')]===!![]){ut[_0x834e('0x4f')](_0x3f88ad['campaignsPreview'][_0x3f88ad['actions'][_0x595cc0][_0x834e('0x44')]],_0x834e('0x4e'));ut[_0x834e('0x50')](_0x834e('0x51')+_0x595cc0,_0x3f88ad[_0x834e('0x43')][_0x595cc0][_0x834e('0x44')]);}ut[_0x834e('0x50')]('[Dialer][checkChannel][Preview]'+_0x595cc0,_0x3f88ad[_0x834e('0x43')][_0x595cc0]['queue']);delete _0x3f88ad[_0x834e('0x43')][_0x595cc0];}},0x2328);}});}});};Preview['prototype'][_0x834e('0x3b')]=function(){var _0x5a5807=this;loggerAction[_0x834e('0x25')](_0x834e('0x52'),_['size'](this[_0x834e('0x43')]));for(var _0x3f2321 in this[_0x834e('0x43')]){if(_0x5a5807[_0x834e('0x43')][_0x834e('0x37')](_0x3f2321)){_0x5a5807[_0x834e('0x40')](_0x3f2321);}}};Preview[_0x834e('0x10')][_0x834e('0x3f')]=function(_0x5dc63b){var _0x279ea1=this;rpcDb['getContactRecallMe'](_0x5dc63b['id'],ut[_0x834e('0x53')](this[_0x834e('0x17')]))['then'](function(_0x112306){if(!_[_0x834e('0x54')](_0x112306)){for(var _0x25b035=0x0;_0x25b035<_0x112306[_0x834e('0x55')];_0x25b035+=0x1){if(ut[_0x834e('0x56')](_0x112306[_0x25b035][_0x834e('0x57')])<_0x5dc63b['dialRecallMeTimeout']*0x3c){if(_0x112306[_0x25b035]['Agent']&&!_0x112306[_0x25b035][_0x834e('0x58')][_0x834e('0x59')]){_0x279ea1[_0x834e('0x5a')](_0x112306[_0x25b035]['id'])[_0x834e('0x5b')](ut[_0x834e('0x5c')](_0x834e('0x5d')))[_0x834e('0x4c')](ut[_0x834e('0x5c')](_0x834e('0x5d')));}else{rpcDb[_0x834e('0x5e')](_0x112306[_0x25b035]['id']);}}else{var _0xf02f0d=new Action(_0x112306[_0x25b035],_0x5dc63b);_0xf02f0d[_0x834e('0x5f')]=moment()[_0x834e('0x60')](_0x834e('0x61'));_0x5dc63b[_0x834e('0x62')]+=0x1;ut[_0x834e('0x63')](_0xf02f0d,0x17,_0x834e('0x64'));if(_0x5dc63b[_0x834e('0x65')]){rpcDb[_0x834e('0x66')](ut[_0x834e('0x67')](_0x112306[_0x25b035]));rpcDb['createCustomerHistory'](_0xf02f0d,_0x834e('0x68'));}else{ut[_0x834e('0x63')](_0xf02f0d,0x16,'RecallFailedTimeout');rpcDb[_0x834e('0x69')](_0xf02f0d,_0x834e('0x6a'));rpcDb['createCustomerFinal'](_0xf02f0d,_0x834e('0x6a'));}}}}})[_0x834e('0x4c')](ut[_0x834e('0x5c')](_0x834e('0x6b')));};Preview[_0x834e('0x10')][_0x834e('0x6c')]=function(_0x4549ba){_0x4549ba['sendMessageOneNotActive']=!![];if(ut[_0x834e('0x6d')](_0x4549ba[_0x834e('0x6e')])){_0x4549ba[_0x834e('0x33')]=utils[_0x834e('0x34')][_0x834e('0x6f')];}else if(!ut[_0x834e('0x70')](_0x4549ba[_0x834e('0x3d')])){_0x4549ba[_0x834e('0x33')]=utils['CAMPAIGN_STATUS'][_0x834e('0x30')];}else if(!this['isTrunkReachable'](_0x4549ba[_0x834e('0x71')])){if(!this['isTrunkReachable'](_0x4549ba[_0x834e('0x72')])){_0x4549ba['message']=utils['CAMPAIGN_STATUS'][_0x834e('0x73')];}else{_0x4549ba[_0x834e('0x33')]=utils['CAMPAIGN_STATUS']['ACTIVE'];}}else{_0x4549ba[_0x834e('0x33')]=utils[_0x834e('0x34')][_0x834e('0x74')];}};Preview[_0x834e('0x10')][_0x834e('0x75')]=function(_0x315858,_0x3d3f2b,_0x4273f1){var _0x528e66=this;var _0x142334=this[_0x834e('0x43')][_0x3d3f2b];var _0x5d5ac2=this[_0x834e('0x15')][_0x142334['queue']];var _0x3e58ef;var _0x45eceb=![];var _0x5160c4=0x2;var _0x41ef86=0x3;if(_0x5d5ac2){switch(_0x4273f1){case'1':_0x5d5ac2[_0x834e('0x76')]+=0x1;_0x142334[_0x834e('0x77')]+=0x1;_0x142334[_0x834e('0x78')]=ut['totalGlobal'](_0x142334);ut[_0x834e('0x63')](_0x142334,0x0,_0x834e('0x79'));ami[_0x834e('0x29')]('custom:agentnosuchnumber',ut[_0x834e('0x7a')](_0x142334,_0x834e('0x7b')));rpcDb[_0x834e('0x69')](_0x142334,_0x834e('0x7c'));_0x528e66[_0x834e('0x7d')](_0x142334,'0',_0x5d5ac2)[_0x834e('0x5b')](function(_0x3a1426){_0x45eceb=_0x3a1426[_0x834e('0x7e')]==0x1;_0x5160c4=_0x5d5ac2[_0x834e('0x7f')];_0x41ef86=_0x5d5ac2[_0x834e('0x80')];if(!_0x45eceb){if(ut[_0x834e('0x81')](_0x142334)>=_0x5d5ac2[_0x834e('0x82')]){_0x3e58ef=ut[_0x834e('0x83')](_0x142334,0xf,_0x834e('0x84'));rpcDb[_0x834e('0x85')](_0x3e58ef,_0x834e('0x86'));}else{if(_0x142334[_0x834e('0x77')]>=_0x5d5ac2[_0x834e('0x87')]){rpcDb[_0x834e('0x85')](_0x142334,_0x834e('0x86'));}else{rpcDb[_0x834e('0x88')](ut[_0x834e('0x89')](_0x142334,'countnosuchnumberretry',_0x5d5ac2[_0x834e('0x7f')]),_0x142334[_0x834e('0x8a')],_0x142334[_0x834e('0x8b')]);}}delete this[_0x834e('0x43')][_0x315858['linkedid']];}else{_0x142334[_0x834e('0x77')]++;logger['info']('actioncountonusuch',_0x142334[_0x834e('0x77')]);logger[_0x834e('0x25')]('id',_0x142334[_0x834e('0x8c')]);_0x528e66[_0x834e('0x8d')]({'id':_0x142334[_0x834e('0x8c')],'field':{'countnosuchnumberretry':_0x142334[_0x834e('0x77')]}})[_0x834e('0x5b')](function(){_0x528e66[_0x834e('0x8e')](_0x142334,_0x5160c4,_0x41ef86)['then'](function(){});});}});break;case _0x834e('0x8f'):var _0x5a99e6=moment()[_0x834e('0x60')](_0x834e('0x61'));_0x142334['responsetime']=_0x5a99e6;_0x142334['answertime']=_0x5a99e6;_0x142334[_0x834e('0x47')]=!![];_0x5d5ac2[_0x834e('0x2d')]+=0x1;logger[_0x834e('0x25')](_0x834e('0x90'),_0x142334[_0x834e('0x91')],'\x20Queue',_0x5d5ac2[_0x834e('0x28')],_0x834e('0x92'),_0x5d5ac2[_0x834e('0x2d')]);ami[_0x834e('0x29')](_0x834e('0x93'),ut[_0x834e('0x7a')](_0x142334,_0x834e('0x94'),this[_0x834e('0x15')][_0x142334[_0x834e('0x44')]]));if(_0x5d5ac2[_0x834e('0x95')]){ami['emit'](_0x834e('0x96'),ut[_0x834e('0x97')](_0x142334));}break;case'16':ami[_0x834e('0x29')](_0x834e('0x98'),ut['buildObj'](_0x142334,_0x834e('0x99'),this['campaignsPreview'][_0x142334['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x142334,_0x834e('0x99')));_0x5d5ac2[_0x834e('0x9a')]+=0x1;_0x5d5ac2['total']+=0x1;_0x5d5ac2[_0x834e('0x9b')]+=0x1;ut[_0x834e('0x4f')](_0x5d5ac2,'[16]');_0x142334[_0x834e('0x78')]=ut[_0x834e('0x81')](_0x142334);ut['logCustomer'](_0x142334,0x4,'Answer');rpcDb[_0x834e('0x69')](_0x142334,_0x834e('0x9c'));rpcDb[_0x834e('0x85')](_0x142334,_0x834e('0x9d'));rpcDb[_0x834e('0x9e')](_0x142334);_0x5d5ac2['sumDuration']+=_0x142334[_0x834e('0x9f')];_0x5d5ac2['sumBillable']+=_0x142334[_0x834e('0x9f')];logger[_0x834e('0x25')](_0x834e('0xa0'),_0x142334['uniqueid'],_0x834e('0xa1'),_0x5d5ac2[_0x834e('0x28')],'pTalking:\x20',_0x5d5ac2[_0x834e('0x2d')]);delete this[_0x834e('0x43')][_0x315858[_0x834e('0xa2')]];break;case'BUSY':_0x5d5ac2[_0x834e('0xa3')]+=0x1;_0x142334[_0x834e('0xa4')]+=0x1;_0x142334[_0x834e('0x78')]=ut[_0x834e('0x81')](_0x142334);ut[_0x834e('0x63')](_0x142334,0x5,_0x834e('0xa5'));_0x5160c4=_0x5d5ac2[_0x834e('0xa6')];_0x41ef86=_0x5d5ac2[_0x834e('0x80')];ami[_0x834e('0x29')](_0x834e('0xa7'),ut['buildObj'](_0x142334,'busy'));rpcDb['createCustomerHistory'](_0x142334,_0x834e('0xa8'));_0x528e66[_0x834e('0x7d')](_0x142334,'5',_0x5d5ac2)[_0x834e('0x5b')](function(_0x37fa2c){_0x45eceb=_0x37fa2c[_0x834e('0x7e')]==0x1;if(!_0x45eceb){if(ut['totalGlobal'](_0x142334)>=_0x5d5ac2['dialGlobalMaxRetry']){_0x3e58ef=ut[_0x834e('0x83')](_0x142334,0xf,_0x834e('0x84'));rpcDb[_0x834e('0x85')](_0x3e58ef,_0x834e('0xa9'));}else{if(_0x142334[_0x834e('0xa4')]>=_0x5d5ac2['dialBusyMaxRetry']){rpcDb[_0x834e('0x85')](_0x142334,_0x834e('0xa8'));}else{rpcDb[_0x834e('0x88')](ut['scheduledAt'](_0x142334,_0x834e('0xa4'),_0x5d5ac2[_0x834e('0xa6')]),_0x142334[_0x834e('0x8a')],_0x142334[_0x834e('0x8b')]);}}}else{_0x142334[_0x834e('0xa4')]++;_0x528e66['incrementPreviewCounters']({'id':_0x142334['idContact'],'field':{'countbusyretry':_0x142334[_0x834e('0xa4')]}})[_0x834e('0x5b')](function(){_0x528e66['swapAdditionalPhones'](_0x142334,_0x5160c4,_0x41ef86)[_0x834e('0x5b')](function(){});});}});break;case'NOANSWER':_0x5d5ac2[_0x834e('0xaa')]+=0x1;_0x142334[_0x834e('0xab')]+=0x1;_0x142334[_0x834e('0x78')]=ut['totalGlobal'](_0x142334);ut[_0x834e('0x63')](_0x142334,0x3,'NoAnswer');_0x5160c4=_0x5d5ac2['dialNoAnswerRetryFrequency'];_0x41ef86=_0x5d5ac2['callAdditionalPhoneAfterMin'];var _0x6735e6=ut[_0x834e('0xac')](_0x142334,_0x5d5ac2);ami[_0x834e('0x29')](_0x834e('0xad'),_0x6735e6);rpcDb[_0x834e('0x69')](_0x142334,_0x834e('0xae'));_0x528e66[_0x834e('0x7d')](_0x142334,'3',_0x5d5ac2)[_0x834e('0x5b')](function(_0x17e61a){_0x45eceb=_0x17e61a['additional']==0x1;if(!_0x45eceb){if(ut[_0x834e('0x81')](_0x142334)>=_0x5d5ac2['dialGlobalMaxRetry']){_0x3e58ef=ut[_0x834e('0x83')](_0x142334,0xf,_0x834e('0x84'));rpcDb[_0x834e('0x85')](_0x3e58ef,_0x834e('0xaf'));}else{if(_0x142334[_0x834e('0xab')]>=_0x5d5ac2[_0x834e('0xb0')]){rpcDb['createCustomerFinal'](_0x142334,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x834e('0x88')](ut[_0x834e('0x89')](_0x142334,'countnoanswerretry',_0x5d5ac2[_0x834e('0xb1')]),_0x142334[_0x834e('0x8a')],_0x142334[_0x834e('0x8b')]);}}}else{_0x142334[_0x834e('0xab')]++;_0x528e66[_0x834e('0x8d')]({'id':_0x142334['idContact'],'field':{'countnoanswerretry':_0x142334[_0x834e('0xab')]}})[_0x834e('0x5b')](function(){_0x528e66['swapAdditionalPhones'](_0x142334,_0x5160c4,_0x41ef86)['then'](function(){});});}});break;case'CONGESTION':_0x5d5ac2[_0x834e('0xb2')]+=0x1;_0x142334[_0x834e('0xb3')]+=0x1;_0x142334['countglobal']=ut[_0x834e('0x81')](_0x142334);ut[_0x834e('0x63')](_0x142334,0x8,'Congestion');_0x5160c4=_0x5d5ac2[_0x834e('0xb4')];_0x41ef86=_0x5d5ac2['callAdditionalPhoneAfterMin'];ami['emit'](_0x834e('0xb5'),ut[_0x834e('0x7a')](_0x142334,_0x834e('0xb6')));rpcDb[_0x834e('0x69')](_0x142334,'[callProgressDetectingCustomer][logCongestion]');_0x528e66[_0x834e('0x7d')](_0x142334,'8',_0x5d5ac2)[_0x834e('0x5b')](function(_0x260934){_0x45eceb=_0x260934[_0x834e('0x7e')]==0x1;if(!_0x45eceb){if(ut[_0x834e('0x81')](_0x142334)>=_0x5d5ac2[_0x834e('0x82')]){_0x3e58ef=ut[_0x834e('0x83')](_0x142334,0xf,_0x834e('0x84'));rpcDb[_0x834e('0x85')](_0x3e58ef,_0x834e('0xb7'));}else{if(_0x142334[_0x834e('0xb3')]>=_0x5d5ac2[_0x834e('0xb8')]){rpcDb[_0x834e('0x85')](_0x142334,_0x834e('0xb9'));}else{rpcDb[_0x834e('0x88')](ut[_0x834e('0x89')](_0x142334,_0x834e('0xb3'),_0x5d5ac2[_0x834e('0xa6')]),_0x142334[_0x834e('0x8a')],_0x142334[_0x834e('0x8b')]);}}}else{_0x142334[_0x834e('0xb3')]++;_0x528e66[_0x834e('0x8d')]({'id':_0x142334['idContact'],'field':{'countcongestionretry':_0x142334[_0x834e('0xb3')]}})[_0x834e('0x5b')](function(){_0x528e66[_0x834e('0x8e')](_0x142334,_0x5160c4,_0x41ef86)[_0x834e('0x5b')](function(){});});}});break;case _0x834e('0xba'):_0x5d5ac2[_0x834e('0xbb')]+=0x1;_0x142334[_0x834e('0xbc')]+=0x1;_0x142334[_0x834e('0x78')]=ut[_0x834e('0x81')](_0x142334);ut['logCustomer'](_0x142334,0x14,'AgentReject');_0x5160c4=_0x5d5ac2['dialAgentRejectRetryFrequency'];_0x41ef86=_0x5d5ac2[_0x834e('0x80')];ami['emit'](_0x834e('0xbd'),ut[_0x834e('0x7a')](_0x142334,_0x834e('0xbe')));rpcDb['createCustomerHistory'](_0x142334,_0x834e('0xbf'));_0x528e66[_0x834e('0x7d')](_0x142334,'20',_0x5d5ac2)[_0x834e('0x5b')](function(_0x1594ef){_0x45eceb=_0x1594ef[_0x834e('0x7e')]==0x1;if(!_0x45eceb){if(ut[_0x834e('0x81')](_0x142334)>=_0x5d5ac2['dialGlobalMaxRetry']){_0x3e58ef=ut[_0x834e('0x83')](_0x142334,0x14,_0x834e('0xc0'));rpcDb[_0x834e('0x85')](_0x3e58ef,_0x834e('0xc1'));}else{if(_0x142334[_0x834e('0xbc')]>=_0x5d5ac2['dialAgentRejectMaxRetry']){rpcDb['createCustomerFinal'](_0x142334,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut[_0x834e('0x89')](_0x142334,_0x834e('0xbc'),_0x5d5ac2['dialAgentRejectRetryFrequency']),_0x142334[_0x834e('0x8a')],_0x142334[_0x834e('0x8b')]);}}}else{_0x142334['countnoanswerretry']++;_0x528e66[_0x834e('0x8d')]({'id':_0x142334[_0x834e('0x8c')],'field':{'countnoanswerretry':_0x142334[_0x834e('0xab')]}})[_0x834e('0x5b')](function(){_0x528e66[_0x834e('0x8e')](_0x142334,_0x5160c4,_0x41ef86)[_0x834e('0x5b')](function(){});});}});break;case'ABANDONED':_0x5d5ac2['outboundAbandonedCallsDay']+=0x1;_0x142334[_0x834e('0xc2')]+=0x1;_0x142334[_0x834e('0x78')]=ut[_0x834e('0x81')](_0x142334);ut['logCustomer'](_0x142334,0xb,_0x834e('0xc3'));rpcDb[_0x834e('0x69')](_0x142334,'[callProgressDetectingCustomer][logAbandoned]');_0x528e66[_0x834e('0x7d')](_0x142334,'11',_0x5d5ac2)[_0x834e('0x5b')](function(_0x216d1f){_0x45eceb=_0x216d1f[_0x834e('0x7e')]==0x1;if(!_0x45eceb){if(ut['totalGlobal'](_0x142334)>=_0x5d5ac2[_0x834e('0x82')]){_0x3e58ef=ut['cloneAction'](_0x142334,0xf,'Global');rpcDb[_0x834e('0x85')](_0x3e58ef,_0x834e('0xc4'));}else{if(_0x142334[_0x834e('0xc5')]>=_0x5d5ac2[_0x834e('0xc6')]){rpcDb[_0x834e('0x85')](_0x142334,_0x834e('0xc4'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x142334,_0x834e('0xc2'),_0x5d5ac2[_0x834e('0xc7')]),_0x142334[_0x834e('0x8a')],_0x142334[_0x834e('0x8b')]);}}}else{_0x142334[_0x834e('0xab')]++;_0x528e66[_0x834e('0x8d')]({'id':_0x142334[_0x834e('0x8c')],'field':{'countnoanswerretry':_0x142334['countnoanswerretry']}})[_0x834e('0x5b')](function(){_0x528e66[_0x834e('0x8e')](_0x142334,_0x5160c4,_0x41ef86)['then'](function(){});});}});break;case'18':_0x5d5ac2[_0x834e('0xc8')]+=0x1;_0x142334[_0x834e('0xc9')]+=0x1;_0x142334[_0x834e('0x78')]=ut[_0x834e('0x81')](_0x142334);ut[_0x834e('0x63')](_0x142334,0x12,_0x315858[_0x834e('0xca')]||_0x315858[_0x834e('0xcb')]);ami[_0x834e('0x29')](_0x834e('0xcc'),ut[_0x834e('0x7a')](_0x142334,_0x834e('0xcd')));rpcDb[_0x834e('0x69')](_0x142334,_0x834e('0xce'));_0x528e66[_0x834e('0x7d')](_0x142334,'18',_0x5d5ac2)['then'](function(_0x5f1e3b){_0x45eceb=_0x5f1e3b[_0x834e('0x7e')]==0x1;if(!_0x45eceb){if(ut['totalGlobal'](_0x142334)>=_0x5d5ac2[_0x834e('0x82')]){_0x3e58ef=ut['cloneAction'](_0x142334,0x12,_0x834e('0x84'));rpcDb['createCustomerFinal'](_0x3e58ef,_0x834e('0xce'));}else{rpcDb['createCustomerFinal'](_0x142334,_0x834e('0xce'));}}else{_0x142334[_0x834e('0xab')]++;_0x528e66[_0x834e('0x8d')]({'id':_0x142334[_0x834e('0x8c')],'field':{'countnoanswerretry':_0x142334['countnoanswerretry']}})[_0x834e('0x5b')](function(){_0x528e66[_0x834e('0x8e')](_0x142334,_0x5160c4,_0x41ef86)[_0x834e('0x5b')](function(){});});}});delete this[_0x834e('0x43')][_0x315858[_0x834e('0xa2')]];break;case'19':_0x5d5ac2[_0x834e('0xc8')]+=0x1;_0x142334[_0x834e('0x78')]=ut[_0x834e('0x81')](_0x142334);ut[_0x834e('0x63')](_0x142334,0x13,_0x315858[_0x834e('0xca')]||_0x315858[_0x834e('0xcb')]);ami[_0x834e('0x29')](_0x834e('0xcc'),ut[_0x834e('0x7a')](_0x142334,_0x834e('0xcd')));rpcDb[_0x834e('0x69')](_0x142334,_0x834e('0xcf'));_0x528e66['verifyAdditionalPhones'](_0x142334,'18',_0x5d5ac2)['then'](function(_0x2df814){_0x45eceb=_0x2df814[_0x834e('0x7e')]==0x1;if(!_0x45eceb){if(ut[_0x834e('0x81')](_0x142334)>=_0x5d5ac2[_0x834e('0x82')]){_0x3e58ef=ut[_0x834e('0x83')](_0x142334,0xf,_0x834e('0x84'));rpcDb[_0x834e('0x85')](_0x3e58ef,_0x834e('0xcf'));}else{rpcDb[_0x834e('0x85')](_0x142334,_0x834e('0xcf'));}}else{_0x142334[_0x834e('0xab')]++;_0x528e66[_0x834e('0x8d')]({'id':_0x142334['idContact'],'field':{'countnoanswerretry':_0x142334[_0x834e('0xab')]}})['then'](function(){_0x528e66[_0x834e('0x8e')](_0x142334,_0x5160c4,_0x41ef86)[_0x834e('0x5b')](function(){});});}});delete this[_0x834e('0x43')][_0x315858['linkedid']];break;default:if(_0x142334[_0x834e('0x47')]){ut[_0x834e('0x4f')](_0x5d5ac2,'[default]');ut['loggerError'](_0x834e('0xd0')+_0x5d5ac2[_0x834e('0x28')],_0x315858);}_0x5d5ac2['outboundUnknownCallsDay']+=0x1;_0x142334[_0x834e('0x78')]=ut[_0x834e('0x81')](_0x142334);ut[_0x834e('0x63')](_0x142334,0xc,_0x315858[_0x834e('0xca')]||_0x315858[_0x834e('0xcb')]);_0x5160c4=_0x5d5ac2['dialAgentRejectRetryFrequency'];_0x41ef86=_0x5d5ac2['callAdditionalPhoneAfterMin'];rpcDb[_0x834e('0x69')](_0x142334,'[callProgressDetectingCustomer][logUnknown]');_0x528e66['verifyAdditionalPhones'](_0x142334,'20',_0x5d5ac2)['then'](function(_0xac9d00){_0x45eceb=_0xac9d00[_0x834e('0x7e')]==0x1;if(!_0x45eceb){if(ut['totalGlobal'](_0x142334)>=_0x5d5ac2[_0x834e('0x82')]){_0x3e58ef=ut[_0x834e('0x83')](_0x142334,0xf,_0x834e('0x84'));rpcDb[_0x834e('0x85')](_0x3e58ef,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x834e('0x85')](_0x142334,_0x834e('0xd1'));}delete this[_0x834e('0x43')][_0x315858['linkedid']];}else{_0x528e66[_0x834e('0x8e')](_0x142334,_0x5160c4,_0x41ef86)['then'](function(){});}});}if(!(_0x142334[_0x834e('0x47')]&&_0x4273f1==='16')){ut['updateOriginated'](_0x5d5ac2,_0x834e('0xd2'));logger[_0x834e('0x25')]('[originated][decrement][callProgressDetectingCustomer]',_0x142334[_0x834e('0x91')],_0x834e('0xa1'),_0x5d5ac2[_0x834e('0x28')],_0x834e('0x45'),_0x5d5ac2[_0x834e('0x2c')]);}if(_0x4273f1!==_0x834e('0x8f')){delete this['actions'][_0x315858[_0x834e('0xa2')]];delete this[_0x834e('0x43')][_0x315858[_0x834e('0xd3')]];}_0x5d5ac2[_0x834e('0xd4')]=!![];}};Preview[_0x834e('0x10')][_0x834e('0xd5')]=function(_0x5d3c6d,_0x448420,_0x490a57){if(_['isUndefined'](_0x448420)&&_0x834e('0xd6')!==typeof _0x448420){return;}if(_['isUndefined'](_0x490a57)&&'object'!==typeof _0x490a57){return;}switch(_0x490a57[_0x834e('0xd7')]){case'0':ut[_0x834e('0xd8')](_0x5d3c6d,0x0,_0x834e('0x79'));rpcDb[_0x834e('0xd9')](_0x5d3c6d,_0x834e('0xda'));break;case'3':ut[_0x834e('0xd8')](_0x5d3c6d,0x3,_0x834e('0xdb'));rpcDb[_0x834e('0xd9')](_0x5d3c6d,_0x834e('0xdc'));break;case'5':ut[_0x834e('0xd8')](_0x5d3c6d,0x5,_0x834e('0xa5'));rpcDb[_0x834e('0xd9')](_0x5d3c6d,_0x834e('0xdd'));break;case'8':ut[_0x834e('0xd8')](_0x5d3c6d,0x8,'Congestion');rpcDb[_0x834e('0xd9')](_0x5d3c6d,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x834e('0xd8')](_0x5d3c6d,0x16,_0x834e('0xde'));rpcDb[_0x834e('0xd9')](_0x5d3c6d,_0x834e('0xdf'));break;default:ut['logAgent'](_0x5d3c6d,0xc,_0x490a57['reason']);rpcDb[_0x834e('0xd9')](_0x5d3c6d,_0x834e('0xe0'));}ut['updateOriginated'](_0x448420,_0x834e('0xe1'));logger[_0x834e('0x25')]('[originated][decrement][callProgressDetectingAgent]',_0x5d3c6d[_0x834e('0x91')],_0x834e('0xa1'),_0x448420[_0x834e('0x28')],_0x834e('0x45'),_0x448420['originated']);delete this['actions'][_0x5d3c6d['uniqueid']];};Preview['prototype'][_0x834e('0x7d')]=function(_0x3c4847,_0x47891e,_0x41ba0c){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x3c4847,_0x47891e,_0x41ba0c)[_0x834e('0x4c')](logger[_0x834e('0x25')](_0x834e('0xe2')));};Preview[_0x834e('0x10')][_0x834e('0x8e')]=function(_0xfa6cdb,_0x3c775f,_0x4fc61d){return cmHopperAdditionalPhone[_0x834e('0x8e')](_0xfa6cdb,_0x3c775f,_0x4fc61d)[_0x834e('0x4c')](logger['info'](_0x834e('0xe3')));};Preview[_0x834e('0x10')]['incrementPreviewCounters']=function(_0x486c18){return Promise['resolve']()[_0x834e('0x5b')](cmHopperAdditionalPhone[_0x834e('0x8d')](_0x486c18))[_0x834e('0x4c')](logger['info'](_0x834e('0xe4')));};Preview[_0x834e('0x10')][_0x834e('0xe5')]=function(_0x17e729,_0x4b4f7c,_0xad7b72,_0x19cb0b,_0x13af70){var _0x8804a8=this;return new Promise(function(_0x102640,_0x48b6c4){if(_['isNil'](_0x4b4f7c)||_[_0x834e('0x54')](_0x4b4f7c[_0x834e('0xe6')])||_[_0x834e('0x54')](_0x4b4f7c[_0x834e('0xe7')])||_[_0x834e('0x54')](_0x4b4f7c[_0x834e('0x48')])){_0x48b6c4(ut[_0x834e('0x33')](_0x834e('0xe8'),_0x19cb0b,_0x13af70));return;}var _0x38151c=uuid['v4']();var _0x97a4b2=_0x8804a8[_0x834e('0x15')][_0x4b4f7c[_0x834e('0x42')][_0x834e('0x28')]];var _0x4b12cd=_0xad7b72?_0x8804a8[_0x834e('0x17')][_0xad7b72]['id']:undefined;_0x8804a8[_0x834e('0x43')][_0x38151c]=new Action(_0x4b4f7c,_0x97a4b2,_0x38151c,_0xad7b72,_0x4b12cd);var _0x3f5b2e=_0x8804a8[_0x834e('0x43')][_0x38151c];_0x3f5b2e['unlockAgent']=_0x19cb0b;_0x3f5b2e['activeContact']=_0x13af70;_0x3f5b2e['lookAgent']=_0xad7b72;if(_[_0x834e('0xe9')](_0x17e729)){_0x8804a8[_0x834e('0xea')](_0x3f5b2e,_0x97a4b2,_0x4b4f7c,_0xad7b72)[_0x834e('0x5b')](function(_0x23d7e6){logger[_0x834e('0x25')](_0x834e('0xeb'),_0x834e('0xec')+_0x3f5b2e[_0x834e('0x44')]+'\x20IdHopper:\x20'+_0x3f5b2e['idContact'],JSON['stringify'](_0x23d7e6));ami['emit'](_0x834e('0xed'),ut[_0x834e('0x7a')](_0x3f5b2e,_0x834e('0xee'),_0x8804a8[_0x834e('0x15')][_0x3f5b2e[_0x834e('0x44')]]));_0x102640(ut[_0x834e('0x33')](_0x834e('0xef')));})[_0x834e('0x4c')](function(_0x33757d){ut['logger']('[Preview][execCall][failure]',_0x33757d);_0x48b6c4(ut['message']('Call\x20failed',_0x19cb0b,_0x13af70));});}else{_0x97a4b2[_0x834e('0xf0')]+=0x1;ut[_0x834e('0xf1')](_0x3f5b2e);rpcDb[_0x834e('0xf2')](_0x3f5b2e,_0x834e('0xf3'));delete _0x8804a8[_0x834e('0x43')][_0x38151c];_0x48b6c4(ut[_0x834e('0x33')](_0x834e('0xf4'),_0x19cb0b,_0x13af70));}});};Preview[_0x834e('0x10')][_0x834e('0xf5')]=function(_0xcd64c2){return!_[_0x834e('0x54')](_0xcd64c2)&&!_[_0x834e('0x54')](_0xcd64c2[_0x834e('0x28')])&&!_[_0x834e('0x54')](_0xcd64c2[_0x834e('0xf6')])&&_0xcd64c2[_0x834e('0xf6')]&&!_['isNil'](this[_0x834e('0x16')][util['format'](_0x834e('0xf7'),_0xcd64c2[_0x834e('0x28')])])&&!_[_0x834e('0x54')](this['trunks'][util[_0x834e('0x60')](_0x834e('0xf7'),_0xcd64c2['name'])]['status'])&&(this[_0x834e('0x16')][util[_0x834e('0x60')](_0x834e('0xf7'),_0xcd64c2[_0x834e('0x28')])][_0x834e('0x4a')]===_0x834e('0xf8')||this[_0x834e('0x16')][util[_0x834e('0x60')]('SIP/%s',_0xcd64c2[_0x834e('0x28')])][_0x834e('0x4a')]===_0x834e('0xf9'));};Preview[_0x834e('0x10')][_0x834e('0x5a')]=function(_0x614e15,_0x17aaae){return this['execRun'](_0x614e15,_0x17aaae)[_0x834e('0x5b')](function(_0x59e298){return _['pick'](_0x59e298,[_0x834e('0x33')]);})[_0x834e('0x4c')](function(_0x4b16fa){if(_0x4b16fa[_0x834e('0xfa')]){rpcDb[_0x834e('0xfb')](_0x614e15);}if(_0x4b16fa['active']){rpcDb[_0x834e('0x5e')](_0x614e15);}throw _[_0x834e('0xfc')](_0x4b16fa,['message']);});};Preview['prototype'][_0x834e('0xfd')]=function(_0x2ec9f1,_0x4e6525){var _0x58a935=this;var _0x269ff6,_0xa496aa;return rpcDb['getContactPreview'](_0x2ec9f1)['then'](function(_0x495352){if(!_['isNil'](_0x495352[0x0])){_0xa496aa=_0x495352[0x0][_0x834e('0xfe')]?![]:!![];_0x269ff6=_0x495352[0x0]['recallme']?!![]:![];_0x269ff6=_0x4e6525?!![]:_0x269ff6;}var _0x3be4c3=_0x58a935['validateContact'](_0x495352);if(_0x3be4c3[_0x834e('0xff')]){rpcDb[_0x834e('0x100')](_[_0x834e('0xfc')](_0x495352[0x0],[_0x834e('0x48'),'phone']))[_0x834e('0x5b')](function(_0x446d89){_0x58a935[_0x834e('0xe5')](_0x446d89,_0x495352[0x0],_0x4e6525,_0xa496aa,_0x269ff6)[_0x834e('0x5b')](function(_0x3a3a6c){return _0x3a3a6c;})[_0x834e('0x4c')](function(_0x3d8abb){throw _0x3d8abb;});})[_0x834e('0x4c')](function(_0x464ae6){ut[_0x834e('0x101')]('[Preview][checkIsBlackList]',_0x464ae6);throw ut[_0x834e('0x33')]('Call\x20unsuccessful',_0xa496aa,_0x269ff6);});}else{throw ut[_0x834e('0x33')](_0x3be4c3[_0x834e('0x33')],_0xa496aa,_0x269ff6);}})[_0x834e('0x4c')](function(_0x31a7ae){ut[_0x834e('0x101')]('[Preview][getContactPreview]',_0x31a7ae);throw ut[_0x834e('0x33')]('Call\x20unsuccessful',![],!![]);});};Preview['prototype'][_0x834e('0x102')]=function(_0x30ecb9){if(_[_0x834e('0x54')](_0x30ecb9)||_['isEmpty'](_0x30ecb9)||!_[_0x834e('0x54')](_0x30ecb9[0x0][_0x834e('0x58')])&&_[_0x834e('0x54')](_0x30ecb9[0x0][_0x834e('0x58')][_0x834e('0x28')])){ut[_0x834e('0x101')](_0x834e('0x103'),_0x30ecb9);return{'isValid':![],'message':_0x834e('0x104')};}var _0x125787=this[_0x834e('0x15')][_0x30ecb9[0x0][_0x834e('0x42')]['name']];_0x125787[_0x834e('0x33')]=utils[_0x834e('0x34')][_0x834e('0x74')];if(_[_0x834e('0x54')](_0x125787)){ut[_0x834e('0x101')](_0x834e('0x105'),_0x125787);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x834e('0xf5')](_0x125787[_0x834e('0x71')])){ut[_0x834e('0x101')](_0x834e('0x106'),_0x834e('0x107')+_0x125787[_0x834e('0x28')]+_0x834e('0x108'));if(!this[_0x834e('0xf5')](_0x125787[_0x834e('0x72')])){ut[_0x834e('0x101')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x125787['name']+_0x834e('0x109'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x834e('0x70')](_0x125787[_0x834e('0x3d')])){ut[_0x834e('0x101')](_0x834e('0x10a'),_0x125787[_0x834e('0x28')]+_0x834e('0x10b'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x125787[_0x834e('0x28')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview['prototype'][_0x834e('0xea')]=function(_0x3b9429,_0x52cdd5,_0x5cb379,_0x494e08){var _0x2515f6=this;return new Promise(function(_0x45c8e6,_0x3512d8){var _0x5e0bfe=_0x3b9429[_0x834e('0x91')];var _0x21cb1d=_0x2515f6[_0x834e('0xf5')](_0x52cdd5[_0x834e('0x71')])?util[_0x834e('0x60')](_0x834e('0x10c'),_0x52cdd5['Trunk']['name'],_['isNil'](_0x52cdd5['dialPrefix'])?'':_0x52cdd5[_0x834e('0x10d')][_0x834e('0x10e')]()||'',_0x52cdd5[_0x834e('0x10f')]>0x0?_0x5cb379[_0x834e('0xe7')][_0x834e('0x110')](_0x52cdd5[_0x834e('0x10f')]):_0x5cb379[_0x834e('0xe7')]):util[_0x834e('0x60')](_0x834e('0x10c'),_[_0x834e('0x54')](_0x52cdd5[_0x834e('0x72')])?_0x52cdd5[_0x834e('0x71')][_0x834e('0x28')]:_0x52cdd5[_0x834e('0x72')][_0x834e('0x28')],_['isNil'](_0x52cdd5['dialPrefix'])?'':_0x52cdd5[_0x834e('0x10d')][_0x834e('0x10e')]()||'',_0x52cdd5[_0x834e('0x10f')]>0x0?_0x5cb379['phone'][_0x834e('0x110')](_0x52cdd5[_0x834e('0x10f')]):_0x5cb379[_0x834e('0xe7')]);var _0x431f18=_0x2515f6[_0x834e('0xf5')](_0x52cdd5[_0x834e('0x71')])?ut[_0x834e('0x111')](_0x52cdd5[_0x834e('0x71')][_0x834e('0x112')],_0x52cdd5['dialOriginateCallerIdName'],_0x52cdd5[_0x834e('0x113')]>0x0?ut[_0x834e('0x114')](_0x52cdd5[_0x834e('0x115')],_0x52cdd5[_0x834e('0x113')]):_0x52cdd5['dialOriginateCallerIdNumber']):ut[_0x834e('0x111')](_[_0x834e('0x54')](_0x52cdd5[_0x834e('0x72')])?_0x52cdd5[_0x834e('0x71')][_0x834e('0x112')]:_0x52cdd5[_0x834e('0x72')][_0x834e('0x112')],_0x52cdd5[_0x834e('0x116')],_0x52cdd5[_0x834e('0x113')]>0x0?ut['getCallerIdRandom'](_0x52cdd5[_0x834e('0x115')],_0x52cdd5['dialRandomLastDigitCallerIdNumber']):_0x52cdd5[_0x834e('0x115')]);if(_0x431f18){_0x3b9429['originatecalleridname']=ut[_0x834e('0x117')](_0x431f18);_0x3b9429[_0x834e('0x118')]=ut[_0x834e('0x119')](_0x431f18);}var _0x2d2268=ut[_0x834e('0x11a')](_0x52cdd5,_0x5cb379,_0x21cb1d,_0x431f18,_0x5e0bfe,_0x3b9429);_['merge'](_0x3b9429,ut[_0x834e('0x11b')](_0x2d2268));_0x3b9429[_0x834e('0x5f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x52cdd5[_0x834e('0x11c')]=_0x2d2268;var _0x4db3c5=ut['variablesAction'](_0x3b9429,_0x52cdd5,_0x2d2268,_0x3b9429['activeContact'],_0x494e08);return ami[_0x834e('0x49')](_0x4db3c5)[_0x834e('0x5b')](function(_0xbd9400){_0x52cdd5[_0x834e('0x2c')]+=0x1;logger[_0x834e('0x25')](_0x834e('0x11d'),_0x5e0bfe,_0x834e('0xa1'),_0x52cdd5['name'],_0x834e('0x45'),_0x52cdd5[_0x834e('0x2c')]);_0x45c8e6(_0xbd9400);})['catch'](function(_0x5df60f){ut[_0x834e('0xd8')](_0x3b9429,0xe,_0x834e('0x11e'));rpcDb['createAgentHistory'](_0x3b9429,'[originateFailure][logOriginateFailure]');_0x3512d8(_0x5df60f);});});};Preview[_0x834e('0x10')][_0x834e('0x11f')]=function(_0x42305c){if(this['actions'][_0x42305c[_0x834e('0xa2')]]){this[_0x834e('0x43')][_0x42305c[_0x834e('0xa2')]]['channel']=_0x42305c[_0x834e('0x4b')];}};Preview['prototype'][_0x834e('0x120')]=function(_0x1debf7){var _0x3a1328=this;var _0x10971d=this[_0x834e('0x43')][_0x1debf7['actionid']];if(_0x10971d){if(_0x10971d[_0x834e('0x121')]&&this[_0x834e('0x17')][_0x10971d[_0x834e('0x121')]]){ut[_0x834e('0x122')](_0x10971d,this[_0x834e('0x17')][_0x10971d['lookAgent']]['name'],this[_0x834e('0x17')][_0x10971d[_0x834e('0x121')]]['id']);}var _0x13d670=_['clone'](_0x10971d);_0x13d670[_0x834e('0x123')]=moment()[_0x834e('0x60')](_0x834e('0x61'));var _0x386b73=_0x3a1328['campaignsPreview'][_0x10971d[_0x834e('0x44')]];if(ut[_0x834e('0x124')](_0x1debf7['response'])){if(_0x10971d[_0x834e('0x8a')]){rpcDb[_0x834e('0xfb')](_0x10971d[_0x834e('0x8c')]);}if(_0x10971d[_0x834e('0x8b')]){rpcDb['disableContact'](_0x10971d[_0x834e('0x8c')]);}ami['emit'](_0x834e('0x125'),ut[_0x834e('0x7a')](_0x10971d,_0x834e('0x126'),this[_0x834e('0x15')][_0x10971d[_0x834e('0x44')]]));this[_0x834e('0xd5')](_0x13d670,_0x386b73,_0x1debf7);}else{_0x10971d['starttime']=moment()['format'](_0x834e('0x61'));ut[_0x834e('0xd8')](_0x13d670,0x4,'Answer');rpcDb[_0x834e('0xd9')](_0x13d670,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x834e('0x10')][_0x834e('0x127')]=function(_0x319d6c){var _0x151b58=this[_0x834e('0x43')][_0x319d6c[_0x834e('0xa2')]];var _0x36836f;if(_0x151b58){_0x36836f=this['campaignsPreview'][_0x151b58[_0x834e('0x44')]];logger[_0x834e('0x25')](_0x834e('0x128'),_0x319d6c[_0x834e('0xa2')],_0x834e('0xa1'),_0x36836f['name'],_0x834e('0x92'),_0x36836f[_0x834e('0x2d')]);}if(this[_0x834e('0x43')][_0x319d6c['linkedid']]&&_0x319d6c['linkedid']!==_0x319d6c['uniqueid']){if(_0x319d6c[_0x834e('0x129')]==='16'&&this[_0x834e('0x43')][_0x319d6c[_0x834e('0xa2')]][_0x834e('0x47')]){this[_0x834e('0x75')](_0x319d6c,_0x319d6c[_0x834e('0xa2')],_0x319d6c[_0x834e('0x129')]);}else if(this[_0x834e('0x43')][_0x319d6c[_0x834e('0xa2')]][_0x834e('0x47')]){logger[_0x834e('0x25')]('[syncHangup][talking][cause]',_0x319d6c[_0x834e('0xa2')],_0x319d6c[_0x834e('0x129')],_0x834e('0xa1'),_0x36836f[_0x834e('0x28')],_0x834e('0x92'),_0x36836f[_0x834e('0x2d')]);this[_0x834e('0x75')](_0x319d6c,_0x319d6c[_0x834e('0xa2')],_0x319d6c['cause']);}}else if(_0x151b58&&_[_0x834e('0x54')](_0x151b58[_0x834e('0x12a')])&&_0x36836f['dialQueueProject']&&_0x319d6c[_0x834e('0xa2')]===_0x319d6c[_0x834e('0x91')]&&_[_0x834e('0x54')](_0x319d6c[_0x834e('0xd7')])&&_0x319d6c['cause']==='16'&&_0x319d6c['channelstate']==='6'&&_[_0x834e('0x12b')](_0x151b58['transfer'])){if(_0x151b58[_0x834e('0x8a')]){rpcDb[_0x834e('0xfb')](_0x151b58[_0x834e('0x8c')]);}if(_0x151b58[_0x834e('0x8b')]){rpcDb[_0x834e('0x5e')](_0x151b58['idContact']);}_0x319d6c[_0x834e('0xd7')]='22';this['callProgressDetectingAgent'](_0x151b58,_0x36836f,_0x319d6c);}else if(_0x151b58&&_0x151b58['transfer']){if(_0x319d6c[_0x834e('0x129')]==='16'&&this[_0x834e('0x43')][_0x319d6c[_0x834e('0xa2')]][_0x834e('0x47')]){logger[_0x834e('0x25')](_0x834e('0x12c'),_0x319d6c['linkedid'],_0x319d6c[_0x834e('0x129')],_0x834e('0xa1'),_0x36836f['name'],_0x834e('0x92'),_0x36836f[_0x834e('0x2d')]);this['callProgressDetectingCustomer'](_0x319d6c,_0x319d6c[_0x834e('0xa2')],_0x319d6c[_0x834e('0x129')]);}else if(this['actions'][_0x319d6c[_0x834e('0xa2')]][_0x834e('0x47')]){logger[_0x834e('0x25')](_0x834e('0x12d'),_0x319d6c[_0x834e('0xa2')],_0x319d6c[_0x834e('0x129')],_0x834e('0xa1'),_0x36836f[_0x834e('0x28')],_0x834e('0x92'),_0x36836f[_0x834e('0x2d')]);this['callProgressDetectingCustomer'](_0x319d6c,_0x319d6c[_0x834e('0xa2')],_0x319d6c[_0x834e('0x129')]);}}};Preview[_0x834e('0x10')][_0x834e('0x1d')]=function(_0x371767){if(this[_0x834e('0x43')][_0x371767[_0x834e('0xd3')]]&&_0x371767[_0x834e('0xd3')]!==_0x371767[_0x834e('0x12e')]){this[_0x834e('0x75')](_0x371767,_0x371767[_0x834e('0xd3')],_0x371767[_0x834e('0xcb')]);}};Preview['prototype'][_0x834e('0x1c')]=function(_0x1cd122){if(this['actions'][_0x1cd122['linkedid']]&&_0x1cd122['linkedid']!==_0x1cd122[_0x834e('0x91')]&&!this[_0x834e('0x43')][_0x1cd122[_0x834e('0xa2')]][_0x834e('0x47')]){if(_0x1cd122[_0x834e('0x129')]==='1'){this[_0x834e('0x75')](_0x1cd122,_0x1cd122[_0x834e('0xa2')],_0x1cd122['cause']);}}};Preview['prototype']['addVariable']=function(_0x47947b,_0x684a97,_0x3c8fc2){if(this[_0x834e('0x43')][_0x47947b]){if(_['isNil'](this['actions'][_0x47947b]['variables'])){this[_0x834e('0x43')][_0x47947b]['variables']={};}this['actions'][_0x47947b][_0x834e('0x11c')][_0x684a97]=_0x3c8fc2;}};Preview[_0x834e('0x10')][_0x834e('0x20')]=function(_0x1acdbd){try{if(!_[_0x834e('0x54')](_0x1acdbd)){if(ut[_0x834e('0x12f')](_[_0x834e('0x130')](_0x1acdbd['variable'])[0x0])){this[_0x834e('0x131')](_0x1acdbd[_0x834e('0x91')],_[_0x834e('0x130')](_0x1acdbd[_0x834e('0x132')])[0x0],_0x1acdbd[_0x834e('0x133')]);}}}catch(_0x488f82){logger[_0x834e('0x134')]('[syncVarSet][Preview]',util[_0x834e('0x135')](_0x488f82,{'showHidden':![],'depth':null}));}};Preview[_0x834e('0x10')][_0x834e('0x22')]=function(_0x57714a){if(_0x57714a){if(this['actions'][_0x57714a['transfertargetlinkedid']]){this['actions'][_0x57714a[_0x834e('0x136')]][_0x834e('0x137')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x20d61c){if(_0x20d61c){if(this[_0x834e('0x43')][_0x20d61c[_0x834e('0x138')]]){this['actions'][_0x20d61c[_0x834e('0x138')]][_0x834e('0x137')]=!![];}}};module[_0x834e('0x139')]=Preview; \ No newline at end of file +var _0x00bb=['swapAdditionalPhones','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','rescheduleContact','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','outboundAbandonedCallsDay','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[incrementPreviewCounters]\x20','checkInBlack','Contact','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','[Blacklist][error]','active','SIP/%s','status','reachable','unmonitored','run','execRun','pick','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','callerid','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','variables','variablesAction','[originated][increment]','[originateFailure][logOriginateFailure]','actionid','lookAgent','logLookAgent','clone','isFailure','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','statedesc','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','addVariable','syncVarSet','filterKey','keys','variable','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','ioredis','../../../config/logger','preview','actionPreview','../ami','./util/util','../dialer/utils','redis','defaults','localhost','prototype','enqueue','tail','finally','voiceQueues','trunks','actions','agents','originateresponse','syncOriginateResponse','hangup','syncHangup','syncHangupRequest','syncDialEnd','bind','newexten','syncNewExten','varset','syncAttendedTransfer','blindtransfer','syncBlindTransfer','campaignsPreview','emit','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','pTalking','available','paused','INACTIVE','\x20is\x20not\x20active','message','CAMPAIGN_STATUS','DEACTIVATED','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','name','syncCampaigns','clockClearZombieChannels','hasOwnProperty','dialMethod','booked','outbound','clearZombieChannels','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','info','Queue','queue','originated:\x20','stringify','dialAnswer','contactId','UserId','VoiceQueueId','ListId','Action','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','catch','loggedIn','NO_AGENTS_LOGGED','isTrunkReachable','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','unlockAgent','activeContact','actioncountonusuch','idContact','incrementPreviewCounters','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','[syncHangup][talking][increment]','custom:agentconnect','acw','custom:agentConnectPreview','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','decrementTalkink','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','uniqueid','\x20Queue','pTalking:\x20','linkedid','BUSY','outboundBusyCallsDay','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','dialBusyRetryFrequency'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x00bb[_0x4fc9e6];return _0x551d28;};'use strict';var util=require(_0xb00b('0x0'));var _=require(_0xb00b('0x1'));var uuid=require(_0xb00b('0x2'));var moment=require('moment');var Redis=require(_0xb00b('0x3'));var config=require('../../../config/environment');var logger=require(_0xb00b('0x4'))(_0xb00b('0x5'));var loggerAction=require('../../../config/logger')(_0xb00b('0x6'));var ami=require(_0xb00b('0x7'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require('./action');var ut=require(_0xb00b('0x8'));var utils=require(_0xb00b('0x9'));config[_0xb00b('0xa')]=_[_0xb00b('0xb')](config[_0xb00b('0xa')],{'host':_0xb00b('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xb00b('0xd')][_0xb00b('0xe')]=function(_0x5851d4){this[_0xb00b('0xf')]=this[_0xb00b('0xf')]?this['tail'][_0xb00b('0x10')](_0x5851d4):_0x5851d4();};function Preview(_0x5a63ed){this['sequence']=new Sequence();this['campaignsPreview']=_0x5a63ed[_0xb00b('0x11')];this[_0xb00b('0x12')]=_0x5a63ed[_0xb00b('0x12')];this[_0xb00b('0x13')]={};this[_0xb00b('0x14')]=_0x5a63ed[_0xb00b('0x14')];this['clockClearZombieChannels']=0x0;ami['on'](_0xb00b('0x15'),this[_0xb00b('0x16')]['bind'](this));ami['on'](_0xb00b('0x17'),this[_0xb00b('0x18')]['bind'](this));ami['on']('hanguprequest',this[_0xb00b('0x19')]['bind'](this));ami['on']('dialend',this[_0xb00b('0x1a')][_0xb00b('0x1b')](this));ami['on'](_0xb00b('0x1c'),this[_0xb00b('0x1d')]['bind'](this));ami['on'](_0xb00b('0x1e'),this['syncVarSet'][_0xb00b('0x1b')](this));ami['on']('attendedtransfer',this[_0xb00b('0x1f')]['bind'](this));ami['on'](_0xb00b('0x20'),this[_0xb00b('0x21')]['bind'](this));this['loopCampaigns'](this[_0xb00b('0x22')]);}function emit(_0x4a334b,_0x1344c4,_0x43da66){io['to'](_0x4a334b)[_0xb00b('0x23')](_0x1344c4,_0x43da66);}function emitVoiceQueueChannelRemove(_0x3501af){logger['info'](_0xb00b('0x24'),JSON['stringify'](_0x3501af));emit(util[_0xb00b('0x25')](_0xb00b('0x26'),_0x3501af['name']),_0xb00b('0x27'),_0x3501af);io[_0xb00b('0x23')]('voice_queue_presence:remove',_0x3501af);}function notSendMessagesQueue(_0x3ab3cc){if(_0x3ab3cc[_0xb00b('0x28')]){if(_0x3ab3cc['originated']===0x0&&_0x3ab3cc[_0xb00b('0x29')]===0x0){_0x3ab3cc[_0xb00b('0x28')]=![];_0x3ab3cc[_0xb00b('0x2a')]=0x0;_0x3ab3cc[_0xb00b('0x2b')]=0x0;_0x3ab3cc['message']=utils['CAMPAIGN_STATUS'][_0xb00b('0x2c')];ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x3ab3cc['name']+_0xb00b('0x2d'));}else{_0x3ab3cc[_0xb00b('0x2e')]=utils[_0xb00b('0x2f')][_0xb00b('0x30')];ut[_0xb00b('0x31')](_0xb00b('0x32'),_0x3ab3cc[_0xb00b('0x33')]+'\x20is\x20deactivated');}}}Preview[_0xb00b('0xd')]['loopCampaigns']=function(){var _0x450129=this;setInterval(function(){_0x450129[_0xb00b('0x34')]();},0x7cf);};Preview[_0xb00b('0xd')]['syncCampaigns']=function(){var _0x2fc11a=this[_0xb00b('0x22')];this[_0xb00b('0x35')]+=0x1;for(var _0x183233 in _0x2fc11a){if(_0x2fc11a[_0xb00b('0x36')](_0x183233)&&(_0x2fc11a[_0x183233][_0xb00b('0x37')]===_0xb00b('0x5')||_0x2fc11a[_0x183233][_0xb00b('0x37')]===_0xb00b('0x38'))&&_0x2fc11a[_0x183233]['type']===_0xb00b('0x39')){if(this[_0xb00b('0x35')]>0x7){this['clockClearZombieChannels']=0x0;this[_0xb00b('0x3a')]();}}if(_0x2fc11a[_0xb00b('0x36')](_0x183233)&&_0x2fc11a[_0x183233]['dialMethod']===_0xb00b('0x5')&&_0x2fc11a[_0x183233]['type']===_0xb00b('0x39')){if(_0x2fc11a[_0x183233][_0xb00b('0x3b')]){this[_0xb00b('0x3c')](_0x2fc11a[_0x183233]);if(_0x2fc11a[_0x183233][_0xb00b('0x3d')])this[_0xb00b('0x3e')](_0x2fc11a[_0x183233]);}else{notSendMessagesQueue(_0x2fc11a[_0x183233]);}}}};Preview[_0xb00b('0xd')][_0xb00b('0x3f')]=function(_0x594840){var _0x57e8f9=this;this['sequence'][_0xb00b('0xe')](function(){if(!_[_0xb00b('0x40')](_0x57e8f9[_0xb00b('0x13')][_0x594840])){loggerAction[_0xb00b('0x41')]('[clearZombieChannels][talking]',_0x594840,_0xb00b('0x42'),_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x43')],_0xb00b('0x44'),JSON[_0xb00b('0x45')](_0x57e8f9[_0xb00b('0x22')][_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x43')]]['originated']),'pTalking:\x20',JSON[_0xb00b('0x45')](_0x57e8f9['campaignsPreview'][_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x43')]][_0xb00b('0x29')]),JSON[_0xb00b('0x45')](_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x46')]),JSON[_0xb00b('0x45')](_['pick'](_0x57e8f9[_0xb00b('0x13')][_0x594840],[_0xb00b('0x47'),_0xb00b('0x48'),_0xb00b('0x49'),_0xb00b('0x4a')])));return ami[_0xb00b('0x4b')]({'action':'status','channel':_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x4c')]})['catch'](function(_0x17ff34){if(_0x17ff34[_0xb00b('0x2e')]===_0xb00b('0x4d')){setTimeout(function(){if(_0x57e8f9[_0xb00b('0x13')][_0x594840]){ut[_0xb00b('0x4e')](_0x57e8f9['campaignsPreview'][_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x43')]],_0xb00b('0x4f'));if(_0x57e8f9[_0xb00b('0x13')][_0x594840]['dialAnswer']===!![]){ut['decrementTalkink'](_0x57e8f9[_0xb00b('0x22')][_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x43')]],_0xb00b('0x4f'));ut[_0xb00b('0x50')](_0xb00b('0x51')+_0x594840,_0x57e8f9[_0xb00b('0x13')][_0x594840]['queue']);}ut[_0xb00b('0x50')](_0xb00b('0x52')+_0x594840,_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x43')]);delete _0x57e8f9[_0xb00b('0x13')][_0x594840];}},0x2328);}});}});};Preview[_0xb00b('0xd')][_0xb00b('0x3a')]=function(){var _0x974a29=this;loggerAction[_0xb00b('0x41')](_0xb00b('0x53'),_[_0xb00b('0x54')](this[_0xb00b('0x13')]));for(var _0x577bad in this[_0xb00b('0x13')]){if(_0x974a29[_0xb00b('0x13')][_0xb00b('0x36')](_0x577bad)){_0x974a29[_0xb00b('0x3f')](_0x577bad);}}};Preview[_0xb00b('0xd')][_0xb00b('0x3e')]=function(_0xd97f49){var _0x1b4f09=this;rpcDb[_0xb00b('0x55')](_0xd97f49['id'],ut[_0xb00b('0x56')](this[_0xb00b('0x14')]))[_0xb00b('0x57')](function(_0x5dbe00){if(!_['isNil'](_0x5dbe00)){for(var _0x47c6c0=0x0;_0x47c6c0<_0x5dbe00[_0xb00b('0x58')];_0x47c6c0+=0x1){if(ut[_0xb00b('0x59')](_0x5dbe00[_0x47c6c0]['scheduledat'])<_0xd97f49[_0xb00b('0x5a')]*0x3c){if(_0x5dbe00[_0x47c6c0][_0xb00b('0x5b')]&&!_0x5dbe00[_0x47c6c0][_0xb00b('0x5b')][_0xb00b('0x5c')]){_0x1b4f09['run'](_0x5dbe00[_0x47c6c0]['id'])['then'](ut[_0xb00b('0x5d')](_0xb00b('0x5e')))['catch'](ut['logger2'](_0xb00b('0x5e')));}else{rpcDb[_0xb00b('0x5f')](_0x5dbe00[_0x47c6c0]['id']);}}else{var _0x4e0be4=new Action(_0x5dbe00[_0x47c6c0],_0xd97f49);_0x4e0be4[_0xb00b('0x60')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xd97f49['outboundReCallsDay']+=0x1;ut[_0xb00b('0x61')](_0x4e0be4,0x17,'RecallInQueue');if(_0xd97f49[_0xb00b('0x62')]){rpcDb[_0xb00b('0x63')](ut[_0xb00b('0x64')](_0x5dbe00[_0x47c6c0]));rpcDb[_0xb00b('0x65')](_0x4e0be4,_0xb00b('0x66'));}else{ut[_0xb00b('0x61')](_0x4e0be4,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0x4e0be4,_0xb00b('0x67'));rpcDb[_0xb00b('0x68')](_0x4e0be4,'[HistoryRecallClose]');}}}}})[_0xb00b('0x69')](ut[_0xb00b('0x5d')]('[getContactRecallMe]'));};Preview[_0xb00b('0xd')][_0xb00b('0x3c')]=function(_0x3b5d82){_0x3b5d82['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0x3b5d82[_0xb00b('0x6a')])){_0x3b5d82[_0xb00b('0x2e')]=utils[_0xb00b('0x2f')][_0xb00b('0x6b')];}else if(!ut['isActive'](_0x3b5d82[_0xb00b('0x3b')])){_0x3b5d82[_0xb00b('0x2e')]=utils['CAMPAIGN_STATUS']['INACTIVE'];}else if(!this[_0xb00b('0x6c')](_0x3b5d82['Trunk'])){if(!this[_0xb00b('0x6c')](_0x3b5d82[_0xb00b('0x6d')])){_0x3b5d82[_0xb00b('0x2e')]=utils[_0xb00b('0x2f')][_0xb00b('0x6e')];}else{_0x3b5d82[_0xb00b('0x2e')]=utils['CAMPAIGN_STATUS'][_0xb00b('0x6f')];}}else{_0x3b5d82['message']=utils[_0xb00b('0x2f')][_0xb00b('0x6f')];}};Preview[_0xb00b('0xd')]['callProgressDetectingCustomer']=function(_0x248335,_0x25f1f6,_0x4ba53a){var _0x598a55=this;var _0x24e826=this[_0xb00b('0x13')][_0x25f1f6];var _0x219b74=this[_0xb00b('0x22')][_0x24e826[_0xb00b('0x43')]];var _0x279467;var _0x347949=![];var _0x3a0b90=0x2;var _0x4c3067=0x3;if(_0x219b74){switch(_0x4ba53a){case'1':_0x219b74[_0xb00b('0x70')]+=0x1;_0x24e826[_0xb00b('0x71')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut['totalGlobal'](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0x0,_0xb00b('0x73'));ami[_0xb00b('0x23')](_0xb00b('0x74'),ut[_0xb00b('0x75')](_0x24e826,'nosuchnumber'));rpcDb[_0xb00b('0x65')](_0x24e826,_0xb00b('0x76'));_0x598a55[_0xb00b('0x77')](_0x24e826,'0',_0x219b74)[_0xb00b('0x57')](function(_0x4b1e5f){_0x347949=_0x4b1e5f[_0xb00b('0x78')]==0x1;_0x3a0b90=_0x219b74[_0xb00b('0x79')];_0x4c3067=_0x219b74[_0xb00b('0x7a')];if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0xf,_0xb00b('0x7e'));rpcDb['createCustomerFinal'](_0x279467,_0xb00b('0x7f'));}else{if(_0x24e826['countnosuchnumberretry']>=_0x219b74[_0xb00b('0x80')]){rpcDb['createCustomerFinal'](_0x24e826,_0xb00b('0x7f'));}else{rpcDb['rescheduleContact'](ut[_0xb00b('0x81')](_0x24e826,'countnosuchnumberretry',_0x219b74[_0xb00b('0x79')]),_0x24e826[_0xb00b('0x82')],_0x24e826[_0xb00b('0x83')]);}}delete this['actions'][_0x248335['linkedid']];}else{_0x24e826['countnosuchnumberretry']++;logger[_0xb00b('0x41')](_0xb00b('0x84'),_0x24e826[_0xb00b('0x71')]);logger['info']('id',_0x24e826[_0xb00b('0x85')]);_0x598a55[_0xb00b('0x86')]({'id':_0x24e826[_0xb00b('0x85')],'field':{'countnosuchnumberretry':_0x24e826[_0xb00b('0x71')]}})[_0xb00b('0x57')](function(){_0x598a55['swapAdditionalPhones'](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});break;case _0xb00b('0x87'):var _0x5622a4=moment()[_0xb00b('0x25')](_0xb00b('0x88'));_0x24e826[_0xb00b('0x89')]=_0x5622a4;_0x24e826['answertime']=_0x5622a4;_0x24e826['dialAnswer']=!![];_0x219b74[_0xb00b('0x29')]+=0x1;logger[_0xb00b('0x41')](_0xb00b('0x8a'),_0x24e826['uniqueid'],'\x20Queue',_0x219b74['name'],'pTalking:\x20',_0x219b74[_0xb00b('0x29')]);ami['emit'](_0xb00b('0x8b'),ut[_0xb00b('0x75')](_0x24e826,'connect',this[_0xb00b('0x22')][_0x24e826[_0xb00b('0x43')]]));if(_0x219b74[_0xb00b('0x8c')]){ami[_0xb00b('0x23')](_0xb00b('0x8d'),ut['buildAcw'](_0x24e826));}break;case'16':ami[_0xb00b('0x23')](_0xb00b('0x8e'),ut[_0xb00b('0x75')](_0x24e826,_0xb00b('0x8f'),this[_0xb00b('0x22')][_0x24e826[_0xb00b('0x43')]]));emitVoiceQueueChannelRemove(ut[_0xb00b('0x75')](_0x24e826,'complete'));_0x219b74[_0xb00b('0x90')]+=0x1;_0x219b74[_0xb00b('0x91')]+=0x1;_0x219b74[_0xb00b('0x92')]+=0x1;ut[_0xb00b('0x93')](_0x219b74,_0xb00b('0x94'));_0x24e826[_0xb00b('0x72')]=ut[_0xb00b('0x7b')](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0x4,'Answer');rpcDb[_0xb00b('0x65')](_0x24e826,_0xb00b('0x95'));rpcDb[_0xb00b('0x68')](_0x24e826,_0xb00b('0x96'));rpcDb[_0xb00b('0x97')](_0x24e826);_0x219b74[_0xb00b('0x98')]+=_0x24e826[_0xb00b('0x99')];_0x219b74[_0xb00b('0x9a')]+=_0x24e826['talktime'];logger[_0xb00b('0x41')](_0xb00b('0x9b'),_0x24e826[_0xb00b('0x9c')],_0xb00b('0x9d'),_0x219b74[_0xb00b('0x33')],_0xb00b('0x9e'),_0x219b74[_0xb00b('0x29')]);delete this['actions'][_0x248335[_0xb00b('0x9f')]];break;case _0xb00b('0xa0'):_0x219b74[_0xb00b('0xa1')]+=0x1;_0x24e826[_0xb00b('0xa2')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut[_0xb00b('0x7b')](_0x24e826);ut['logCustomer'](_0x24e826,0x5,_0xb00b('0xa3'));_0x3a0b90=_0x219b74['dialBusyRetryFrequency'];_0x4c3067=_0x219b74[_0xb00b('0x7a')];ami['emit'](_0xb00b('0xa4'),ut[_0xb00b('0x75')](_0x24e826,_0xb00b('0xa5')));rpcDb['createCustomerHistory'](_0x24e826,'[callProgressDetectingCustomer][logBusy]');_0x598a55[_0xb00b('0x77')](_0x24e826,'5',_0x219b74)[_0xb00b('0x57')](function(_0x33a483){_0x347949=_0x33a483[_0xb00b('0x78')]==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0xf,_0xb00b('0x7e'));rpcDb[_0xb00b('0x68')](_0x279467,_0xb00b('0xa6'));}else{if(_0x24e826[_0xb00b('0xa2')]>=_0x219b74[_0xb00b('0xa7')]){rpcDb[_0xb00b('0x68')](_0x24e826,_0xb00b('0xa8'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x24e826,_0xb00b('0xa2'),_0x219b74[_0xb00b('0xa9')]),_0x24e826['unlockAgent'],_0x24e826['activeContact']);}}}else{_0x24e826[_0xb00b('0xa2')]++;_0x598a55[_0xb00b('0x86')]({'id':_0x24e826[_0xb00b('0x85')],'field':{'countbusyretry':_0x24e826['countbusyretry']}})[_0xb00b('0x57')](function(){_0x598a55[_0xb00b('0xaa')](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});break;case _0xb00b('0xab'):_0x219b74[_0xb00b('0xac')]+=0x1;_0x24e826[_0xb00b('0xad')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut['totalGlobal'](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0x3,'NoAnswer');_0x3a0b90=_0x219b74[_0xb00b('0xae')];_0x4c3067=_0x219b74[_0xb00b('0x7a')];var _0x545dfd=ut[_0xb00b('0xaf')](_0x24e826,_0x219b74);ami[_0xb00b('0x23')](_0xb00b('0xb0'),_0x545dfd);rpcDb[_0xb00b('0x65')](_0x24e826,_0xb00b('0xb1'));_0x598a55[_0xb00b('0x77')](_0x24e826,'3',_0x219b74)[_0xb00b('0x57')](function(_0x2423b2){_0x347949=_0x2423b2[_0xb00b('0x78')]==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0xf,'Global');rpcDb[_0xb00b('0x68')](_0x279467,_0xb00b('0xb2'));}else{if(_0x24e826[_0xb00b('0xad')]>=_0x219b74[_0xb00b('0xb3')]){rpcDb['createCustomerFinal'](_0x24e826,_0xb00b('0xb1'));}else{rpcDb[_0xb00b('0xb4')](ut[_0xb00b('0x81')](_0x24e826,_0xb00b('0xad'),_0x219b74[_0xb00b('0xae')]),_0x24e826['unlockAgent'],_0x24e826[_0xb00b('0x83')]);}}}else{_0x24e826[_0xb00b('0xad')]++;_0x598a55[_0xb00b('0x86')]({'id':_0x24e826[_0xb00b('0x85')],'field':{'countnoanswerretry':_0x24e826['countnoanswerretry']}})[_0xb00b('0x57')](function(){_0x598a55['swapAdditionalPhones'](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});break;case _0xb00b('0xb5'):_0x219b74[_0xb00b('0xb6')]+=0x1;_0x24e826[_0xb00b('0xb7')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut[_0xb00b('0x7b')](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0x8,_0xb00b('0xb8'));_0x3a0b90=_0x219b74[_0xb00b('0xb9')];_0x4c3067=_0x219b74[_0xb00b('0x7a')];ami[_0xb00b('0x23')]('custom:agentcongestion',ut[_0xb00b('0x75')](_0x24e826,_0xb00b('0xba')));rpcDb[_0xb00b('0x65')](_0x24e826,_0xb00b('0xbb'));_0x598a55['verifyAdditionalPhones'](_0x24e826,'8',_0x219b74)[_0xb00b('0x57')](function(_0xb27b8b){_0x347949=_0xb27b8b['additional']==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74['dialGlobalMaxRetry']){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0xf,_0xb00b('0x7e'));rpcDb[_0xb00b('0x68')](_0x279467,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x24e826[_0xb00b('0xb7')]>=_0x219b74[_0xb00b('0xbc')]){rpcDb[_0xb00b('0x68')](_0x24e826,_0xb00b('0xbb'));}else{rpcDb[_0xb00b('0xb4')](ut[_0xb00b('0x81')](_0x24e826,_0xb00b('0xb7'),_0x219b74[_0xb00b('0xa9')]),_0x24e826[_0xb00b('0x82')],_0x24e826['activeContact']);}}}else{_0x24e826['countcongestionretry']++;_0x598a55[_0xb00b('0x86')]({'id':_0x24e826[_0xb00b('0x85')],'field':{'countcongestionretry':_0x24e826[_0xb00b('0xb7')]}})[_0xb00b('0x57')](function(){_0x598a55['swapAdditionalPhones'](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});break;case _0xb00b('0xbd'):_0x219b74['outboundRejectCallsDay']+=0x1;_0x24e826[_0xb00b('0xbe')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut[_0xb00b('0x7b')](_0x24e826);ut['logCustomer'](_0x24e826,0x14,_0xb00b('0xbf'));_0x3a0b90=_0x219b74[_0xb00b('0xc0')];_0x4c3067=_0x219b74['callAdditionalPhoneAfterMin'];ami[_0xb00b('0x23')](_0xb00b('0xc1'),ut[_0xb00b('0x75')](_0x24e826,_0xb00b('0xc2')));rpcDb[_0xb00b('0x65')](_0x24e826,_0xb00b('0xc3'));_0x598a55[_0xb00b('0x77')](_0x24e826,'20',_0x219b74)[_0xb00b('0x57')](function(_0x55ea09){_0x347949=_0x55ea09[_0xb00b('0x78')]==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0x14,'AgentReject');rpcDb[_0xb00b('0x68')](_0x279467,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x24e826[_0xb00b('0xbe')]>=_0x219b74['dialAgentRejectMaxRetry']){rpcDb[_0xb00b('0x68')](_0x24e826,_0xb00b('0xc4'));}else{rpcDb[_0xb00b('0xb4')](ut[_0xb00b('0x81')](_0x24e826,_0xb00b('0xbe'),_0x219b74['dialAgentRejectRetryFrequency']),_0x24e826[_0xb00b('0x82')],_0x24e826[_0xb00b('0x83')]);}}}else{_0x24e826['countnoanswerretry']++;_0x598a55[_0xb00b('0x86')]({'id':_0x24e826['idContact'],'field':{'countnoanswerretry':_0x24e826[_0xb00b('0xad')]}})[_0xb00b('0x57')](function(){_0x598a55[_0xb00b('0xaa')](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});break;case'ABANDONED':_0x219b74[_0xb00b('0xc5')]+=0x1;_0x24e826[_0xb00b('0xc6')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut[_0xb00b('0x7b')](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0xb,'Abandoned');rpcDb['createCustomerHistory'](_0x24e826,_0xb00b('0xc7'));_0x598a55[_0xb00b('0x77')](_0x24e826,'11',_0x219b74)[_0xb00b('0x57')](function(_0x2d5652){_0x347949=_0x2d5652[_0xb00b('0x78')]==0x1;if(!_0x347949){if(ut['totalGlobal'](_0x24e826)>=_0x219b74['dialGlobalMaxRetry']){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0xf,_0xb00b('0x7e'));rpcDb[_0xb00b('0x68')](_0x279467,_0xb00b('0xc7'));}else{if(_0x24e826[_0xb00b('0xc8')]>=_0x219b74[_0xb00b('0xc9')]){rpcDb[_0xb00b('0x68')](_0x24e826,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xb00b('0xb4')](ut['scheduledAt'](_0x24e826,_0xb00b('0xc6'),_0x219b74['dialAbandonedRetryFrequency']),_0x24e826[_0xb00b('0x82')],_0x24e826[_0xb00b('0x83')]);}}}else{_0x24e826[_0xb00b('0xad')]++;_0x598a55[_0xb00b('0x86')]({'id':_0x24e826[_0xb00b('0x85')],'field':{'countnoanswerretry':_0x24e826[_0xb00b('0xad')]}})[_0xb00b('0x57')](function(){_0x598a55[_0xb00b('0xaa')](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});break;case'18':_0x219b74[_0xb00b('0xca')]+=0x1;_0x24e826[_0xb00b('0xcb')]+=0x1;_0x24e826['countglobal']=ut[_0xb00b('0x7b')](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0x12,_0x248335[_0xb00b('0xcc')]||_0x248335[_0xb00b('0xcd')]);ami['emit'](_0xb00b('0xce'),ut[_0xb00b('0x75')](_0x24e826,'amd'));rpcDb[_0xb00b('0x65')](_0x24e826,'[callProgressDetectingCustomer][hangupInAMD]');_0x598a55[_0xb00b('0x77')](_0x24e826,'18',_0x219b74)[_0xb00b('0x57')](function(_0x49fe3f){_0x347949=_0x49fe3f[_0xb00b('0x78')]==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0x12,_0xb00b('0x7e'));rpcDb[_0xb00b('0x68')](_0x279467,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0xb00b('0x68')](_0x24e826,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x24e826[_0xb00b('0xad')]++;_0x598a55[_0xb00b('0x86')]({'id':_0x24e826[_0xb00b('0x85')],'field':{'countnoanswerretry':_0x24e826[_0xb00b('0xad')]}})['then'](function(){_0x598a55[_0xb00b('0xaa')](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});delete this[_0xb00b('0x13')][_0x248335['linkedid']];break;case'19':_0x219b74[_0xb00b('0xca')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut[_0xb00b('0x7b')](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0x13,_0x248335['cause-txt']||_0x248335[_0xb00b('0xcd')]);ami[_0xb00b('0x23')](_0xb00b('0xce'),ut[_0xb00b('0x75')](_0x24e826,_0xb00b('0xcf')));rpcDb[_0xb00b('0x65')](_0x24e826,'[callProgressDetectingCustomer][machine]');_0x598a55['verifyAdditionalPhones'](_0x24e826,'18',_0x219b74)[_0xb00b('0x57')](function(_0x23d306){_0x347949=_0x23d306[_0xb00b('0x78')]==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut['cloneAction'](_0x24e826,0xf,_0xb00b('0x7e'));rpcDb[_0xb00b('0x68')](_0x279467,_0xb00b('0xd0'));}else{rpcDb[_0xb00b('0x68')](_0x24e826,_0xb00b('0xd0'));}}else{_0x24e826[_0xb00b('0xad')]++;_0x598a55['incrementPreviewCounters']({'id':_0x24e826[_0xb00b('0x85')],'field':{'countnoanswerretry':_0x24e826[_0xb00b('0xad')]}})[_0xb00b('0x57')](function(){_0x598a55[_0xb00b('0xaa')](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});delete this[_0xb00b('0x13')][_0x248335[_0xb00b('0x9f')]];break;default:if(_0x24e826[_0xb00b('0x46')]){ut[_0xb00b('0x93')](_0x219b74,_0xb00b('0xd1'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x219b74[_0xb00b('0x33')],_0x248335);}_0x219b74[_0xb00b('0xca')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut['totalGlobal'](_0x24e826);ut['logCustomer'](_0x24e826,0xc,_0x248335['cause-txt']||_0x248335[_0xb00b('0xcd')]);_0x3a0b90=_0x219b74[_0xb00b('0xc0')];_0x4c3067=_0x219b74[_0xb00b('0x7a')];rpcDb['createCustomerHistory'](_0x24e826,_0xb00b('0xd2'));_0x598a55[_0xb00b('0x77')](_0x24e826,'20',_0x219b74)[_0xb00b('0x57')](function(_0x142674){_0x347949=_0x142674['additional']==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0xf,_0xb00b('0x7e'));rpcDb[_0xb00b('0x68')](_0x279467,_0xb00b('0xd3'));}else{rpcDb[_0xb00b('0x68')](_0x24e826,_0xb00b('0xd3'));}delete this['actions'][_0x248335[_0xb00b('0x9f')]];}else{_0x598a55[_0xb00b('0xaa')](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});}});}if(!(_0x24e826[_0xb00b('0x46')]&&_0x4ba53a==='16')){ut[_0xb00b('0x4e')](_0x219b74,_0xb00b('0xd4'));logger[_0xb00b('0x41')](_0xb00b('0xd5'),_0x24e826['uniqueid'],_0xb00b('0x9d'),_0x219b74[_0xb00b('0x33')],_0xb00b('0x44'),_0x219b74[_0xb00b('0xd6')]);}if(_0x4ba53a!=='ANSWER'){delete this[_0xb00b('0x13')][_0x248335[_0xb00b('0x9f')]];delete this[_0xb00b('0x13')][_0x248335[_0xb00b('0xd7')]];}_0x219b74[_0xb00b('0xd8')]=!![];}};Preview[_0xb00b('0xd')][_0xb00b('0xd9')]=function(_0x3184de,_0x48ac4b,_0x5f0fab){if(_[_0xb00b('0xda')](_0x48ac4b)&&_0xb00b('0xdb')!==typeof _0x48ac4b){return;}if(_[_0xb00b('0xda')](_0x5f0fab)&&'object'!==typeof _0x5f0fab){return;}switch(_0x5f0fab[_0xb00b('0xdc')]){case'0':ut[_0xb00b('0xdd')](_0x3184de,0x0,_0xb00b('0x73'));rpcDb['createAgentHistory'](_0x3184de,_0xb00b('0xde'));break;case'3':ut[_0xb00b('0xdd')](_0x3184de,0x3,_0xb00b('0xdf'));rpcDb['createAgentHistory'](_0x3184de,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xb00b('0xdd')](_0x3184de,0x5,'Busy');rpcDb[_0xb00b('0xe0')](_0x3184de,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x3184de,0x8,_0xb00b('0xb8'));rpcDb[_0xb00b('0xe0')](_0x3184de,_0xb00b('0xe1'));break;case'22':ut[_0xb00b('0xdd')](_0x3184de,0x16,_0xb00b('0xe2'));rpcDb['createAgentHistory'](_0x3184de,_0xb00b('0xe3'));break;default:ut['logAgent'](_0x3184de,0xc,_0x5f0fab['reason']);rpcDb[_0xb00b('0xe0')](_0x3184de,_0xb00b('0xe1'));}ut[_0xb00b('0x4e')](_0x48ac4b,_0xb00b('0xe4'));logger[_0xb00b('0x41')](_0xb00b('0xe5'),_0x3184de['uniqueid'],_0xb00b('0x9d'),_0x48ac4b['name'],_0xb00b('0x44'),_0x48ac4b[_0xb00b('0xd6')]);delete this[_0xb00b('0x13')][_0x3184de['uniqueid']];};Preview[_0xb00b('0xd')][_0xb00b('0x77')]=function(_0x20790f,_0x3dc8d2,_0x5d224c){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x20790f,_0x3dc8d2,_0x5d224c)[_0xb00b('0x69')](logger['info']('[verifyAdditionalPhone]\x20'));};Preview[_0xb00b('0xd')]['swapAdditionalPhones']=function(_0x505ae2,_0x2fecca,_0x330bc7){return cmHopperAdditionalPhone[_0xb00b('0xaa')](_0x505ae2,_0x2fecca,_0x330bc7)[_0xb00b('0x69')](logger['info']('[swapAdditionalPhone]\x20'));};Preview[_0xb00b('0xd')][_0xb00b('0x86')]=function(_0x9facaf){return Promise['resolve']()['then'](cmHopperAdditionalPhone[_0xb00b('0x86')](_0x9facaf))['catch'](logger['info'](_0xb00b('0xe6')));};Preview['prototype'][_0xb00b('0xe7')]=function(_0x481671,_0x1b751e,_0x5712fd,_0x3de808,_0x3289aa){var _0x1ec560=this;return new Promise(function(_0x54498c,_0x442b28){if(_['isNil'](_0x1b751e)||_[_0xb00b('0x40')](_0x1b751e[_0xb00b('0xe8')])||_['isNil'](_0x1b751e['phone'])||_['isNil'](_0x1b751e['VoiceQueueId'])){_0x442b28(ut[_0xb00b('0x2e')]('Contact\x20is\x20undefined',_0x3de808,_0x3289aa));return;}var _0x134d17=uuid['v4']();var _0x5ad4d4=_0x1ec560[_0xb00b('0x22')][_0x1b751e[_0xb00b('0x42')][_0xb00b('0x33')]];var _0x44b2f1=_0x5712fd?_0x1ec560[_0xb00b('0x14')][_0x5712fd]['id']:undefined;_0x1ec560['actions'][_0x134d17]=new Action(_0x1b751e,_0x5ad4d4,_0x134d17,_0x5712fd,_0x44b2f1);var _0x8292fe=_0x1ec560[_0xb00b('0x13')][_0x134d17];_0x8292fe[_0xb00b('0x82')]=_0x3de808;_0x8292fe[_0xb00b('0x83')]=_0x3289aa;_0x8292fe['lookAgent']=_0x5712fd;if(_['isEmpty'](_0x481671)){_0x1ec560[_0xb00b('0xe9')](_0x8292fe,_0x5ad4d4,_0x1b751e,_0x5712fd)[_0xb00b('0x57')](function(_0x181393){logger[_0xb00b('0x41')](_0xb00b('0xea'),_0xb00b('0xeb')+_0x8292fe[_0xb00b('0x43')]+_0xb00b('0xec')+_0x8292fe[_0xb00b('0x85')],JSON['stringify'](_0x181393));ami[_0xb00b('0x23')](_0xb00b('0xed'),ut['buildObj'](_0x8292fe,_0xb00b('0xee'),_0x1ec560['campaignsPreview'][_0x8292fe[_0xb00b('0x43')]]));_0x54498c(ut[_0xb00b('0x2e')]('Calling'));})['catch'](function(_0x32264a){ut[_0xb00b('0x31')](_0xb00b('0xef'),_0x32264a);_0x442b28(ut['message'](_0xb00b('0xf0'),_0x3de808,_0x3289aa));});}else{_0x5ad4d4[_0xb00b('0xf1')]+=0x1;ut[_0xb00b('0xf2')](_0x8292fe);rpcDb['createHistory'](_0x8292fe,_0xb00b('0xf3'));delete _0x1ec560['actions'][_0x134d17];_0x442b28(ut['message']('Contact\x20in\x20black\x20List',_0x3de808,_0x3289aa));}});};Preview[_0xb00b('0xd')]['isTrunkReachable']=function(_0x1b8d45){return!_[_0xb00b('0x40')](_0x1b8d45)&&!_['isNil'](_0x1b8d45['name'])&&!_[_0xb00b('0x40')](_0x1b8d45[_0xb00b('0xf4')])&&_0x1b8d45['active']&&!_[_0xb00b('0x40')](this[_0xb00b('0x12')][util[_0xb00b('0x25')](_0xb00b('0xf5'),_0x1b8d45[_0xb00b('0x33')])])&&!_[_0xb00b('0x40')](this['trunks'][util[_0xb00b('0x25')](_0xb00b('0xf5'),_0x1b8d45['name'])][_0xb00b('0xf6')])&&(this['trunks'][util['format'](_0xb00b('0xf5'),_0x1b8d45['name'])][_0xb00b('0xf6')]===_0xb00b('0xf7')||this[_0xb00b('0x12')][util['format']('SIP/%s',_0x1b8d45['name'])][_0xb00b('0xf6')]===_0xb00b('0xf8'));};Preview['prototype'][_0xb00b('0xf9')]=function(_0x18e86f,_0x3aa8c0){return this[_0xb00b('0xfa')](_0x18e86f,_0x3aa8c0)[_0xb00b('0x57')](function(_0x166ff5){return _[_0xb00b('0xfb')](_0x166ff5,[_0xb00b('0x2e')]);})['catch'](function(_0x1b097a){if(_0x1b097a[_0xb00b('0xfc')]){rpcDb[_0xb00b('0xfd')](_0x18e86f);}if(_0x1b097a['active']){rpcDb['disableContact'](_0x18e86f);}throw _['pick'](_0x1b097a,[_0xb00b('0x2e')]);});};Preview[_0xb00b('0xd')][_0xb00b('0xfa')]=function(_0x4bc6df,_0x399902){var _0x34985d=this;var _0x2057d1,_0xdee547;return rpcDb[_0xb00b('0xfe')](_0x4bc6df)['then'](function(_0x1674ab){if(!_['isNil'](_0x1674ab[0x0])){_0xdee547=_0x1674ab[0x0][_0xb00b('0xff')]?![]:!![];_0x2057d1=_0x1674ab[0x0][_0xb00b('0xff')]?!![]:![];_0x2057d1=_0x399902?!![]:_0x2057d1;}var _0xde6b5=_0x34985d[_0xb00b('0x100')](_0x1674ab);if(_0xde6b5[_0xb00b('0x101')]){rpcDb[_0xb00b('0x102')](_['pick'](_0x1674ab[0x0],[_0xb00b('0x49'),_0xb00b('0x103')]))[_0xb00b('0x57')](function(_0x278d9e){_0x34985d[_0xb00b('0xe7')](_0x278d9e,_0x1674ab[0x0],_0x399902,_0xdee547,_0x2057d1)[_0xb00b('0x57')](function(_0x26cd15){return _0x26cd15;})[_0xb00b('0x69')](function(_0xd2f1ba){throw _0xd2f1ba;});})[_0xb00b('0x69')](function(_0x5f1258){ut[_0xb00b('0x31')](_0xb00b('0x104'),_0x5f1258);throw ut['message'](_0xb00b('0x105'),_0xdee547,_0x2057d1);});}else{throw ut['message'](_0xde6b5['message'],_0xdee547,_0x2057d1);}})['catch'](function(_0x384a16){ut['logger'](_0xb00b('0x106'),_0x384a16);throw ut[_0xb00b('0x2e')](_0xb00b('0x105'),![],!![]);});};Preview[_0xb00b('0xd')][_0xb00b('0x100')]=function(_0x116ced){if(_[_0xb00b('0x40')](_0x116ced)||_[_0xb00b('0x107')](_0x116ced)||!_[_0xb00b('0x40')](_0x116ced[0x0][_0xb00b('0x5b')])&&_[_0xb00b('0x40')](_0x116ced[0x0][_0xb00b('0x5b')][_0xb00b('0x33')])){ut[_0xb00b('0x31')]('[Preview][validateContact][Empty\x20Contact]',_0x116ced);return{'isValid':![],'message':_0xb00b('0x108')};}var _0x15f9cd=this[_0xb00b('0x22')][_0x116ced[0x0][_0xb00b('0x42')][_0xb00b('0x33')]];_0x15f9cd['message']=utils[_0xb00b('0x2f')][_0xb00b('0x6f')];if(_['isNil'](_0x15f9cd)){ut['logger'](_0xb00b('0x109'),_0x15f9cd);return{'isValid':![],'message':_0xb00b('0x10a')};}if(!this[_0xb00b('0x6c')](_0x15f9cd[_0xb00b('0x10b')])){ut[_0xb00b('0x31')](_0xb00b('0x10c'),_0xb00b('0x10d')+_0x15f9cd[_0xb00b('0x33')]+_0xb00b('0x10e'));if(!this[_0xb00b('0x6c')](_0x15f9cd[_0xb00b('0x6d')])){ut['logger'](_0xb00b('0x10c'),_0x15f9cd['name']+_0xb00b('0x10f'));return{'isValid':![],'message':_0xb00b('0x110')};}}if(!ut[_0xb00b('0x111')](_0x15f9cd[_0xb00b('0x3b')])){ut[_0xb00b('0x31')](_0xb00b('0x112'),_0x15f9cd['name']+_0xb00b('0x113'));return{'isValid':![],'message':_0xb00b('0x10d')+_0x15f9cd[_0xb00b('0x33')]+_0xb00b('0x113')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xb00b('0xd')][_0xb00b('0xe9')]=function(_0x58dbf6,_0x199ba1,_0x16cca9,_0x3c57b2){var _0xca4a87=this;return new Promise(function(_0x456515,_0x26145a){var _0x31fa5b=_0x58dbf6[_0xb00b('0x9c')];var _0x1ba141=_0xca4a87['isTrunkReachable'](_0x199ba1[_0xb00b('0x10b')])?util[_0xb00b('0x25')]('SIP/%s/%s%s',_0x199ba1[_0xb00b('0x10b')][_0xb00b('0x33')],_[_0xb00b('0x40')](_0x199ba1[_0xb00b('0x114')])?'':_0x199ba1[_0xb00b('0x114')][_0xb00b('0x115')]()||'',_0x199ba1[_0xb00b('0x116')]>0x0?_0x16cca9[_0xb00b('0x103')][_0xb00b('0x117')](_0x199ba1[_0xb00b('0x116')]):_0x16cca9[_0xb00b('0x103')]):util['format'](_0xb00b('0x118'),_[_0xb00b('0x40')](_0x199ba1[_0xb00b('0x6d')])?_0x199ba1['Trunk'][_0xb00b('0x33')]:_0x199ba1[_0xb00b('0x6d')][_0xb00b('0x33')],_[_0xb00b('0x40')](_0x199ba1['dialPrefix'])?'':_0x199ba1[_0xb00b('0x114')][_0xb00b('0x115')]()||'',_0x199ba1['dialCutDigit']>0x0?_0x16cca9['phone'][_0xb00b('0x117')](_0x199ba1[_0xb00b('0x116')]):_0x16cca9['phone']);var _0x1256a8=_0xca4a87['isTrunkReachable'](_0x199ba1['Trunk'])?ut[_0xb00b('0x119')](_0x199ba1['Trunk']['callerid'],_0x199ba1[_0xb00b('0x11a')],_0x199ba1[_0xb00b('0x11b')]>0x0?ut[_0xb00b('0x11c')](_0x199ba1[_0xb00b('0x11d')],_0x199ba1[_0xb00b('0x11b')]):_0x199ba1[_0xb00b('0x11d')]):ut[_0xb00b('0x119')](_[_0xb00b('0x40')](_0x199ba1[_0xb00b('0x6d')])?_0x199ba1[_0xb00b('0x10b')][_0xb00b('0x11e')]:_0x199ba1[_0xb00b('0x6d')][_0xb00b('0x11e')],_0x199ba1[_0xb00b('0x11a')],_0x199ba1['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xb00b('0x11c')](_0x199ba1[_0xb00b('0x11d')],_0x199ba1['dialRandomLastDigitCallerIdNumber']):_0x199ba1[_0xb00b('0x11d')]);if(_0x1256a8){_0x58dbf6['originatecalleridname']=ut[_0xb00b('0x11f')](_0x1256a8);_0x58dbf6[_0xb00b('0x120')]=ut[_0xb00b('0x121')](_0x1256a8);}var _0x5657ee=ut[_0xb00b('0x122')](_0x199ba1,_0x16cca9,_0x1ba141,_0x1256a8,_0x31fa5b,_0x58dbf6);_[_0xb00b('0x123')](_0x58dbf6,ut['toLowerVariables'](_0x5657ee));_0x58dbf6[_0xb00b('0x60')]=moment()[_0xb00b('0x25')](_0xb00b('0x88'));_0x199ba1[_0xb00b('0x124')]=_0x5657ee;var _0x57bfab=ut[_0xb00b('0x125')](_0x58dbf6,_0x199ba1,_0x5657ee,_0x58dbf6[_0xb00b('0x83')],_0x3c57b2);return ami[_0xb00b('0x4b')](_0x57bfab)['then'](function(_0x571811){_0x199ba1['originated']+=0x1;logger[_0xb00b('0x41')](_0xb00b('0x126'),_0x31fa5b,_0xb00b('0x9d'),_0x199ba1[_0xb00b('0x33')],_0xb00b('0x44'),_0x199ba1[_0xb00b('0xd6')]);_0x456515(_0x571811);})[_0xb00b('0x69')](function(_0x39b4c6){ut[_0xb00b('0xdd')](_0x58dbf6,0xe,'OriginateError');rpcDb['createAgentHistory'](_0x58dbf6,_0xb00b('0x127'));_0x26145a(_0x39b4c6);});});};Preview[_0xb00b('0xd')]['syncNewExten']=function(_0x42fdce){if(this['actions'][_0x42fdce[_0xb00b('0x9f')]]){this['actions'][_0x42fdce[_0xb00b('0x9f')]][_0xb00b('0x4c')]=_0x42fdce['channel'];}};Preview[_0xb00b('0xd')][_0xb00b('0x16')]=function(_0x5573c9){var _0x44767a=this;var _0x4d4dbe=this[_0xb00b('0x13')][_0x5573c9[_0xb00b('0x128')]];if(_0x4d4dbe){if(_0x4d4dbe[_0xb00b('0x129')]&&this[_0xb00b('0x14')][_0x4d4dbe[_0xb00b('0x129')]]){ut[_0xb00b('0x12a')](_0x4d4dbe,this[_0xb00b('0x14')][_0x4d4dbe[_0xb00b('0x129')]][_0xb00b('0x33')],this[_0xb00b('0x14')][_0x4d4dbe['lookAgent']]['id']);}var _0x4cff99=_[_0xb00b('0x12b')](_0x4d4dbe);_0x4cff99['responsetime']=moment()[_0xb00b('0x25')]('YYYY-MM-DD\x20HH:mm:ss');var _0x198536=_0x44767a[_0xb00b('0x22')][_0x4d4dbe['queue']];if(ut[_0xb00b('0x12c')](_0x5573c9['response'])){if(_0x4d4dbe[_0xb00b('0x82')]){rpcDb[_0xb00b('0xfd')](_0x4d4dbe['idContact']);}if(_0x4d4dbe[_0xb00b('0x83')]){rpcDb[_0xb00b('0x5f')](_0x4d4dbe[_0xb00b('0x85')]);}ami[_0xb00b('0x23')](_0xb00b('0x12d'),ut['buildObj'](_0x4d4dbe,_0xb00b('0x12e'),this[_0xb00b('0x22')][_0x4d4dbe['queue']]));this['callProgressDetectingAgent'](_0x4cff99,_0x198536,_0x5573c9);}else{_0x4d4dbe[_0xb00b('0x60')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x4cff99,0x4,_0xb00b('0x12f'));rpcDb[_0xb00b('0xe0')](_0x4cff99,_0xb00b('0x130'));}}};Preview[_0xb00b('0xd')]['syncHangup']=function(_0xcaefbd){var _0x482fc4=this[_0xb00b('0x13')][_0xcaefbd[_0xb00b('0x9f')]];var _0x22f2f6;if(_0x482fc4){_0x22f2f6=this[_0xb00b('0x22')][_0x482fc4['queue']];logger[_0xb00b('0x41')](_0xb00b('0x131'),_0xcaefbd['linkedid'],_0xb00b('0x9d'),_0x22f2f6[_0xb00b('0x33')],_0xb00b('0x9e'),_0x22f2f6['pTalking']);}if(this['actions'][_0xcaefbd[_0xb00b('0x9f')]]&&_0xcaefbd[_0xb00b('0x9f')]!==_0xcaefbd[_0xb00b('0x9c')]){if(_0xcaefbd[_0xb00b('0x132')]==='16'&&this[_0xb00b('0x13')][_0xcaefbd[_0xb00b('0x9f')]][_0xb00b('0x46')]){this['callProgressDetectingCustomer'](_0xcaefbd,_0xcaefbd['linkedid'],_0xcaefbd[_0xb00b('0x132')]);}else if(this['actions'][_0xcaefbd['linkedid']][_0xb00b('0x46')]){logger[_0xb00b('0x41')]('[syncHangup][talking][cause]',_0xcaefbd[_0xb00b('0x9f')],_0xcaefbd[_0xb00b('0x132')],_0xb00b('0x9d'),_0x22f2f6['name'],_0xb00b('0x9e'),_0x22f2f6[_0xb00b('0x29')]);this[_0xb00b('0x133')](_0xcaefbd,_0xcaefbd[_0xb00b('0x9f')],_0xcaefbd[_0xb00b('0x132')]);}}else if(_0x482fc4&&_[_0xb00b('0x40')](_0x482fc4[_0xb00b('0x134')])&&_0x22f2f6['dialQueueProject']&&_0xcaefbd[_0xb00b('0x9f')]===_0xcaefbd[_0xb00b('0x9c')]&&_['isNil'](_0xcaefbd['reason'])&&_0xcaefbd['cause']==='16'&&_0xcaefbd[_0xb00b('0x135')]==='6'&&_[_0xb00b('0xda')](_0x482fc4[_0xb00b('0x136')])){if(_0x482fc4[_0xb00b('0x82')]){rpcDb[_0xb00b('0xfd')](_0x482fc4[_0xb00b('0x85')]);}if(_0x482fc4[_0xb00b('0x83')]){rpcDb['disableContact'](_0x482fc4['idContact']);}_0xcaefbd[_0xb00b('0xdc')]='22';this[_0xb00b('0xd9')](_0x482fc4,_0x22f2f6,_0xcaefbd);}else if(_0x482fc4&&_0x482fc4['transfer']){if(_0xcaefbd[_0xb00b('0x132')]==='16'&&this[_0xb00b('0x13')][_0xcaefbd['linkedid']][_0xb00b('0x46')]){logger['info'](_0xb00b('0x137'),_0xcaefbd['linkedid'],_0xcaefbd['cause'],'\x20Queue',_0x22f2f6[_0xb00b('0x33')],_0xb00b('0x9e'),_0x22f2f6[_0xb00b('0x29')]);this[_0xb00b('0x133')](_0xcaefbd,_0xcaefbd['linkedid'],_0xcaefbd[_0xb00b('0x132')]);}else if(this[_0xb00b('0x13')][_0xcaefbd[_0xb00b('0x9f')]][_0xb00b('0x46')]){logger[_0xb00b('0x41')](_0xb00b('0x138'),_0xcaefbd[_0xb00b('0x9f')],_0xcaefbd[_0xb00b('0x132')],_0xb00b('0x9d'),_0x22f2f6[_0xb00b('0x33')],'pTalking:\x20',_0x22f2f6['pTalking']);this[_0xb00b('0x133')](_0xcaefbd,_0xcaefbd[_0xb00b('0x9f')],_0xcaefbd[_0xb00b('0x132')]);}}};Preview[_0xb00b('0xd')][_0xb00b('0x1a')]=function(_0x1e0206){if(this[_0xb00b('0x13')][_0x1e0206[_0xb00b('0xd7')]]&&_0x1e0206[_0xb00b('0xd7')]!==_0x1e0206['destuniqueid']){this[_0xb00b('0x133')](_0x1e0206,_0x1e0206[_0xb00b('0xd7')],_0x1e0206[_0xb00b('0xcd')]);}};Preview[_0xb00b('0xd')]['syncHangupRequest']=function(_0x45ad1f){if(this[_0xb00b('0x13')][_0x45ad1f[_0xb00b('0x9f')]]&&_0x45ad1f[_0xb00b('0x9f')]!==_0x45ad1f[_0xb00b('0x9c')]&&!this[_0xb00b('0x13')][_0x45ad1f[_0xb00b('0x9f')]][_0xb00b('0x46')]){if(_0x45ad1f[_0xb00b('0x132')]==='1'){this['callProgressDetectingCustomer'](_0x45ad1f,_0x45ad1f['linkedid'],_0x45ad1f[_0xb00b('0x132')]);}}};Preview[_0xb00b('0xd')][_0xb00b('0x139')]=function(_0x121451,_0x2e9604,_0x19fce8){if(this[_0xb00b('0x13')][_0x121451]){if(_['isNil'](this[_0xb00b('0x13')][_0x121451][_0xb00b('0x124')])){this[_0xb00b('0x13')][_0x121451][_0xb00b('0x124')]={};}this[_0xb00b('0x13')][_0x121451][_0xb00b('0x124')][_0x2e9604]=_0x19fce8;}};Preview['prototype'][_0xb00b('0x13a')]=function(_0x1ec1c7){try{if(!_['isNil'](_0x1ec1c7)){if(ut[_0xb00b('0x13b')](_[_0xb00b('0x13c')](_0x1ec1c7[_0xb00b('0x13d')])[0x0])){this[_0xb00b('0x139')](_0x1ec1c7[_0xb00b('0x9c')],_[_0xb00b('0x13c')](_0x1ec1c7['variable'])[0x0],_0x1ec1c7['value']);}}}catch(_0x465238){logger['error']('[syncVarSet][Preview]',util['inspect'](_0x465238,{'showHidden':![],'depth':null}));}};Preview[_0xb00b('0xd')][_0xb00b('0x1f')]=function(_0x5a400c){if(_0x5a400c){if(this['actions'][_0x5a400c[_0xb00b('0x13e')]]){this[_0xb00b('0x13')][_0x5a400c[_0xb00b('0x13e')]][_0xb00b('0x136')]=!![];}}};Preview[_0xb00b('0xd')][_0xb00b('0x21')]=function(_0x3fd141){if(_0x3fd141){if(this[_0xb00b('0x13')][_0x3fd141[_0xb00b('0x13f')]]){this[_0xb00b('0x13')][_0x3fd141[_0xb00b('0x13f')]]['transfer']=!![];}}};module[_0xb00b('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 a1dff93..062f3ed 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 _0x6483=['createHistory','catch','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird','../../../config/logger','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','[createHistory]\x20','resolve','then'];(function(_0x51c36c,_0x5a6a97){var _0x8cf065=function(_0x2d9065){while(--_0x2d9065){_0x51c36c['push'](_0x51c36c['shift']());}};_0x8cf065(++_0x5a6a97);}(_0x6483,0x94));var _0x3648=function(_0x51d907,_0xe2e53e){_0x51d907=_0x51d907-0x0;var _0x3058b3=_0x6483[_0x51d907];return _0x3058b3;};'use strict';var util=require(_0x3648('0x0'));var BPromise=require(_0x3648('0x1'));var logger=require(_0x3648('0x2'))('preview');var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x3648('0x3'));var agentReportPreview=require(_0x3648('0x4'));var voiceQueueReport=require(_0x3648('0x5'));function loggerCatch(_0x4ef527){return function(_0x448926){logger[_0x3648('0x6')](_0x4ef527,util[_0x3648('0x7')](_0x448926,{'showHidden':![],'depth':null}));};}function create(_0x2f9d11){return cmHopperHistory['createHistory'](_0x2f9d11)['catch'](loggerCatch(_0x3648('0x8')));}function createAgent(_0x171482){return BPromise[_0x3648('0x9')]()[_0x3648('0xa')](agentReportPreview[_0x3648('0xb')](_0x171482))['catch'](loggerCatch(_0x3648('0x8')));}function moveContact(_0x14e9bb){return cmHopper['moveContactManagedDialer'](_0x14e9bb,!![])[_0x3648('0xc')](loggerCatch(_0x3648('0xd')));}exports[_0x3648('0xe')]=function(_0x30090b){return cmHopperBlack['checkIsBlackList'](_0x30090b)[_0x3648('0xc')](loggerCatch(_0x3648('0xf')));};exports[_0x3648('0x10')]=function(_0x258f46){return BPromise[_0x3648('0x9')]()[_0x3648('0xa')](cmHopper['getContactPreview'](_0x258f46))[_0x3648('0xc')](loggerCatch(_0x3648('0x11')));};exports[_0x3648('0xb')]=function(_0x355463,_0x4cef8e){create(_0x355463)[_0x3648('0xc')](loggerCatch(_0x4cef8e));moveContact(_0x355463)[_0x3648('0xc')](loggerCatch(_0x4cef8e));};exports['createAgentHistory']=function(_0x372a0f,_0x40cc51){createAgent(_0x372a0f)[_0x3648('0xc')](loggerCatch(_0x40cc51));};exports[_0x3648('0x12')]=function(_0xe94861,_0x36515a){create(_0xe94861)[_0x3648('0xc')](loggerCatch(_0x36515a));};exports[_0x3648('0x13')]=function(_0x25c486,_0x593ac4){moveContact(_0x25c486)[_0x3648('0xc')](loggerCatch(_0x593ac4));};exports[_0x3648('0x14')]=function(_0x82b9e0,_0x2fea8d,_0x3604b2){if(_0x2fea8d){_0x82b9e0['UserId']=null;}if(_0x3604b2){_0x82b9e0[_0x3648('0x15')]=![];}return cmHopper[_0x3648('0x14')](_0x82b9e0)['catch'](loggerCatch('[rescheduleContact]\x20'));};exports[_0x3648('0x16')]=function(_0xebe0a1){return cmHopper['countReScheduled'](_0xebe0a1)[_0x3648('0xc')](loggerCatch(_0x3648('0x17')));};exports['unlockContact']=function(_0x57837f){return cmHopper[_0x3648('0x18')]({'UserId':null},_0x57837f,0x1)[_0x3648('0xc')](loggerCatch(_0x3648('0x19')));};exports[_0x3648('0x1a')]=function(_0x640e99){return cmHopper['unlockContact']({'active':![]},_0x640e99,0x1)[_0x3648('0xc')](loggerCatch(_0x3648('0x1b')));};exports[_0x3648('0x1c')]=function(_0x45170f){var _0x170651={};_0x170651[_0x3648('0x1d')]=_0x45170f[_0x3648('0x1d')];_0x170651[_0x3648('0x1e')]=_0x45170f[_0x3648('0x1e')];_0x170651['calleridnum']=_0x45170f['calleridnum'];_0x170651[_0x3648('0x1f')]=_0x45170f['calleridname'];_0x170651[_0x3648('0x20')]=_0x45170f['queue'];_0x170651[_0x3648('0x21')]=_0x45170f['answertime'];_0x170651[_0x3648('0x22')]=_0x45170f[_0x3648('0x23')];_0x170651[_0x3648('0x24')]=0x1;_0x170651[_0x3648('0x25')]=_0x45170f[_0x3648('0x26')];_0x170651['connectedlinename']=_0x45170f[_0x3648('0x27')];_0x170651[_0x3648('0x28')]=_0x3648('0x29');_0x170651[_0x3648('0x2a')]=_0x3648('0x2b');_0x170651[_0x3648('0x2c')]=0x0;_0x170651[_0x3648('0x2d')]=0x1;_0x170651[_0x3648('0x2e')]=_0x45170f['membername'];_0x170651[_0x3648('0x2f')]=_0x3648('0x30');return BPromise['resolve']()[_0x3648('0xa')](voiceQueueReport[_0x3648('0x31')](_0x170651))[_0x3648('0xc')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x3648('0x32')]=function(_0x496c9c,_0x3e68a2){return BPromise[_0x3648('0x9')]()[_0x3648('0xa')](cmHopper[_0x3648('0x32')](_0x496c9c,_0x3e68a2))[_0x3648('0xc')](loggerCatch(_0x3648('0x33')));};exports[_0x3648('0x34')]=function(_0x1b2d9e){return cmHopper[_0x3648('0x14')](_0x1b2d9e,!![],!![])[_0x3648('0xc')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0xaace=['active','[rescheduleContact]\x20','countReScheduled','unlockContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','then','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','resolve','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','createAgentHistory','createCustomerFinal','rescheduleContact','UserId'];(function(_0x38c6ff,_0x442ac9){var _0xfbea01=function(_0x28ad7c){while(--_0x28ad7c){_0x38c6ff['push'](_0x38c6ff['shift']());}};_0xfbea01(++_0x442ac9);}(_0xaace,0x122));var _0xeaac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaace[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xeaac('0x0'));var BPromise=require(_0xeaac('0x1'));var logger=require(_0xeaac('0x2'))(_0xeaac('0x3'));var cmHopper=require(_0xeaac('0x4'));var cmHopperHistory=require(_0xeaac('0x5'));var cmHopperBlack=require(_0xeaac('0x6'));var agentReportPreview=require(_0xeaac('0x7'));var voiceQueueReport=require(_0xeaac('0x8'));function loggerCatch(_0x4a6ee0){return function(_0x561bdd){logger[_0xeaac('0x9')](_0x4a6ee0,util[_0xeaac('0xa')](_0x561bdd,{'showHidden':![],'depth':null}));};}function create(_0x2fa6d8){return cmHopperHistory[_0xeaac('0xb')](_0x2fa6d8)[_0xeaac('0xc')](loggerCatch(_0xeaac('0xd')));}function createAgent(_0x4192af){return BPromise[_0xeaac('0xe')]()['then'](agentReportPreview[_0xeaac('0xb')](_0x4192af))['catch'](loggerCatch(_0xeaac('0xd')));}function moveContact(_0x1c238f){return cmHopper['moveContactManagedDialer'](_0x1c238f,!![])[_0xeaac('0xc')](loggerCatch(_0xeaac('0xf')));}exports['checkIsBlackList']=function(_0x2f048d){return cmHopperBlack[_0xeaac('0x10')](_0x2f048d)['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports[_0xeaac('0x11')]=function(_0x940a8){return BPromise[_0xeaac('0xe')]()['then'](cmHopper[_0xeaac('0x11')](_0x940a8))['catch'](loggerCatch('[getContactPreview]\x20'));};exports[_0xeaac('0xb')]=function(_0x5d9700,_0x31054a){create(_0x5d9700)[_0xeaac('0xc')](loggerCatch(_0x31054a));moveContact(_0x5d9700)[_0xeaac('0xc')](loggerCatch(_0x31054a));};exports[_0xeaac('0x12')]=function(_0x497363,_0x2e5e2c){createAgent(_0x497363)[_0xeaac('0xc')](loggerCatch(_0x2e5e2c));};exports['createCustomerHistory']=function(_0x8f8b57,_0x4018a6){create(_0x8f8b57)[_0xeaac('0xc')](loggerCatch(_0x4018a6));};exports[_0xeaac('0x13')]=function(_0x446a33,_0x3d2be1){moveContact(_0x446a33)[_0xeaac('0xc')](loggerCatch(_0x3d2be1));};exports[_0xeaac('0x14')]=function(_0x2f3ee7,_0x2e3f06,_0x2dcf7b){if(_0x2e3f06){_0x2f3ee7[_0xeaac('0x15')]=null;}if(_0x2dcf7b){_0x2f3ee7[_0xeaac('0x16')]=![];}return cmHopper[_0xeaac('0x14')](_0x2f3ee7)['catch'](loggerCatch(_0xeaac('0x17')));};exports[_0xeaac('0x18')]=function(_0x2968ed){return cmHopper[_0xeaac('0x18')](_0x2968ed)[_0xeaac('0xc')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x3fcd28){return cmHopper[_0xeaac('0x19')]({'UserId':null},_0x3fcd28,0x1)['catch'](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x26741e){return cmHopper[_0xeaac('0x19')]({'active':![]},_0x26741e,0x1)[_0xeaac('0xc')](loggerCatch(_0xeaac('0x1a')));};exports['crateCustomerReportQueue']=function(_0x440039){var _0xf62edf={};_0xf62edf[_0xeaac('0x1b')]=_0x440039[_0xeaac('0x1b')];_0xf62edf[_0xeaac('0x1c')]=_0x440039['uniqueid'];_0xf62edf[_0xeaac('0x1d')]=_0x440039[_0xeaac('0x1d')];_0xf62edf[_0xeaac('0x1e')]=_0x440039[_0xeaac('0x1e')];_0xf62edf[_0xeaac('0x1f')]=_0x440039[_0xeaac('0x1f')];_0xf62edf[_0xeaac('0x20')]=_0x440039[_0xeaac('0x21')];_0xf62edf[_0xeaac('0x22')]=_0x440039[_0xeaac('0x21')];_0xf62edf[_0xeaac('0x23')]=0x1;_0xf62edf['queuecallercompleteAt']=_0x440039[_0xeaac('0x24')];_0xf62edf['connectedlinename']=_0x440039[_0xeaac('0x25')];_0xf62edf[_0xeaac('0x26')]=_0xeaac('0x27');_0xf62edf[_0xeaac('0x28')]=_0xeaac('0x29');_0xf62edf[_0xeaac('0x2a')]=0x0;_0xf62edf[_0xeaac('0x2b')]=0x1;_0xf62edf[_0xeaac('0x2c')]=_0x440039[_0xeaac('0x25')];_0xf62edf[_0xeaac('0x2d')]=_0xeaac('0x2e');return BPromise[_0xeaac('0xe')]()[_0xeaac('0x2f')](voiceQueueReport['create'](_0xf62edf))['catch'](loggerCatch(_0xeaac('0x30')));};exports[_0xeaac('0x31')]=function(_0x156b9d,_0x5b6f84){return BPromise['resolve']()[_0xeaac('0x2f')](cmHopper['getContactRecallMe'](_0x156b9d,_0x5b6f84))['catch'](loggerCatch(_0xeaac('0x32')));};exports[_0xeaac('0x33')]=function(_0x2ffbbd){return cmHopper['rescheduleContact'](_0x2ffbbd,!![],!![])[_0xeaac('0xc')](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 3efdbab..360e59b 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 _0xccdf=['[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','BOOKED','uniqueid','originate','channelAgent','xcally-motion-preview','timeout','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','queue','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','interface','agentReadyId','not_inuse','status','reachable','milliseconds','diff','seconds','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','scheduledat','countbusyretry','callback','callbackuniqueid','sipcallid','xmd-voicequeueid','xmd-queue','xmd-dialurl','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','noanswer','variables','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','logger','info','inspect','loggerError','logger2','getCallerId','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','Contact','tags','%s%s','XMD-','toLowerVariables','hasOwnProperty','toLower','originated','error'];(function(_0x561975,_0x1d64fc){var _0x15b7f5=function(_0x43bfc1){while(--_0x43bfc1){_0x561975['push'](_0x561975['shift']());}};_0x15b7f5(++_0x1d64fc);}(_0xccdf,0x192));var _0xfccd=function(_0x9d654b,_0x23810e){_0x9d654b=_0x9d654b-0x0;var _0x579053=_0xccdf[_0x9d654b];return _0x579053;};'use strict';var util=require(_0xfccd('0x0'));var _=require(_0xfccd('0x1'));var moment=require(_0xfccd('0x2'));var logger=require(_0xfccd('0x3'))(_0xfccd('0x4'));var ipAgi=process[_0xfccd('0x5')][_0xfccd('0x6')]||_0xfccd('0x7');var utils=require(_0xfccd('0x8'));exports['loggerCatch']=function(_0x1cc86c){return function(_0x414262){logger['error'](_0x1cc86c,util['inspect'](_0x414262,{'showHidden':![],'depth':null}));};};exports[_0xfccd('0x9')]=function(_0x3cdb0e,_0xdf4e0e){logger[_0xfccd('0xa')](_0x3cdb0e,util[_0xfccd('0xb')](_0xdf4e0e,{'showHidden':![],'depth':null}));};exports[_0xfccd('0xc')]=function(_0x737c32,_0x3d033e){logger['error'](_0x737c32,util[_0xfccd('0xb')](_0x3d033e,{'showHidden':![],'depth':null}));};exports[_0xfccd('0xd')]=function(_0x289bed){return function(_0x1f3c33){logger[_0xfccd('0xa')](_0x289bed,util[_0xfccd('0xb')](_0x1f3c33,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x10fecd,_0x537889,_0x18eee3){return{'message':_0x10fecd,'unlock':_0x537889,'active':_0x18eee3};};exports[_0xfccd('0xe')]=function(_0x4c78f6,_0x4630d2,_0x4898f2){if(!_[_0xfccd('0xf')](_0x4898f2)&&'string'===typeof _0x4898f2&&!_[_0xfccd('0x10')](_0x4898f2)){if(!_['isUndefined'](_0x4630d2)&&_0xfccd('0x11')===typeof _0x4630d2&&!_[_0xfccd('0x10')](_0x4630d2)){return util[_0xfccd('0x12')](_0xfccd('0x13'),_0x4630d2,_0x4898f2);}return util[_0xfccd('0x12')](_0xfccd('0x13'),_0x4898f2,_0x4898f2);}if(!_[_0xfccd('0xf')](_0x4c78f6)&&'string'===typeof _0x4c78f6&&!_[_0xfccd('0x10')](_0x4c78f6)){return _0x4c78f6;}return'\x22\x22\x20<>';};exports[_0xfccd('0x14')]=function(_0x139b73){if(_[_0xfccd('0x15')](_0x139b73)){return![];}return _0x139b73;};exports[_0xfccd('0x16')]=function(_0x5469b9,_0x330662,_0x414d18,_0x4021bc,_0x46b893,_0x166433){var _0x5887c6={'XMD-QUEUE':_0x330662[_0xfccd('0x17')]?_0x330662[_0xfccd('0x17')][_0xfccd('0x18')]:'','XMD-CALLERID':_0x4021bc,'XMD-CALLERID-PREVIEW':_0x166433?util['format'](_0xfccd('0x13'),_0x166433[_0xfccd('0x19')],_0x166433[_0xfccd('0x1a')]):_0x4021bc,'XMD-DIALID':_0x46b893,'XMD-CONTACTID':_0x330662[_0xfccd('0x1b')],'XMD-CDRTYPE':_0xfccd('0x1c'),'CALLERID(all)':_0x4021bc,'XMD-VOICEQUEUEID':_0x330662[_0xfccd('0x1d')],'XMD-DIALCHANNEL':_0x414d18,'XMD-DIALTIMEOUT':_0x5469b9[_0xfccd('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0xfccd('0x12')](_0xfccd('0x1f'),_0x5469b9[_0xfccd('0x20')]?'g':'',_[_0xfccd('0x10')](_0x5469b9[_0xfccd('0x21')])?'':_0xfccd('0x22')),'XMD-DIALURL':_0x5469b9[_0xfccd('0x23')]||'','XMD-AGI':_0x5469b9[_0xfccd('0x24')]?util[_0xfccd('0x12')](_0xfccd('0x25'),ipAgi,_0x5469b9[_0xfccd('0x24')]):'NONE','XMD-AGIAFTER':_0x5469b9[_0xfccd('0x20')]?util[_0xfccd('0x12')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5469b9[_0xfccd('0x20')]):_0xfccd('0x26'),'XMD-ORIGINATECALLERIDNUM':_0x166433?_0x166433[_0xfccd('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x166433?_0x166433[_0xfccd('0x28')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0xfccd('0x29')};if(!_['isEmpty'](_0x5469b9[_0xfccd('0x21')])){_0x5887c6[util[_0xfccd('0x12')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x5469b9[_0xfccd('0x21')];_0x5887c6[util[_0xfccd('0x12')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x46b893;}if(_0x330662&&_0x330662[_0xfccd('0x2a')]){for(var _0x4764f7 in _0x330662['Contact']){if(_0x330662[_0xfccd('0x2a')]['hasOwnProperty'](_0x4764f7)){if(!_[_0xfccd('0x15')](_0x330662[_0xfccd('0x2a')][_0x4764f7])&&_0x4764f7!=='id'&&_0x4764f7!==_0xfccd('0x2b')&&_0x4764f7!=='createdAt'&&_0x4764f7!=='updatedAt'){_0x5887c6[util[_0xfccd('0x12')](_0xfccd('0x2c'),_0xfccd('0x2d'),_['toUpper'](_0x4764f7))]=_0x330662[_0xfccd('0x2a')][_0x4764f7];}}}}return _0x5887c6;};exports[_0xfccd('0x2e')]=function(_0xc3cbae){var _0x449a80={};for(var _0xa4b0bf in _0xc3cbae){if(_0xc3cbae[_0xfccd('0x2f')](_0xa4b0bf)){_0x449a80[util[_0xfccd('0x12')]('%s',_[_0xfccd('0x30')](_0xa4b0bf))]=_0xc3cbae[_0xa4b0bf];}}return{'variables':_0x449a80};};exports['updateOriginated']=function(_0x5851ca,_0x436b0c){if(!_[_0xfccd('0x15')](_0x5851ca)){if(_0x5851ca[_0xfccd('0x2f')](_0xfccd('0x31'))){if(_0x5851ca[_0xfccd('0x31')]>0x0){_0x5851ca[_0xfccd('0x31')]-=0x1;}else{logger[_0xfccd('0x32')](_0xfccd('0x33'),_0x436b0c);}}}else{logger[_0xfccd('0x32')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x436b0c);}};exports[_0xfccd('0x34')]=function(_0x14b442){var _0xb7436d=moment()[_0xfccd('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x14b442[_0xfccd('0x35')]=0xd;_0x14b442[_0xfccd('0x36')]=_0xfccd('0x37');_0x14b442[_0xfccd('0x38')]=_0xb7436d;_0x14b442[_0xfccd('0x39')]=_0xb7436d;_0x14b442[_0xfccd('0x3a')]=_0xb7436d;};exports[_0xfccd('0x3b')]=function(_0x52a56c,_0x2725c4,_0x4e46c7){var _0x33e0a7=moment()['format'](_0xfccd('0x3c'));_0x52a56c['state']=_0x2725c4;_0x52a56c[_0xfccd('0x36')]=_0x4e46c7;_0x52a56c[_0xfccd('0x39')]=_0x33e0a7;_0x52a56c[_0xfccd('0x3d')]=utils[_0xfccd('0x3e')](_0x52a56c[_0xfccd('0x39')],_0x52a56c[_0xfccd('0x38')]);};exports[_0xfccd('0x3f')]=function(_0x221cfd,_0x56bf4a,_0xc9350d){_0x221cfd[_0xfccd('0x40')]=_0x56bf4a;_0x221cfd[_0xfccd('0x41')]=_0xc9350d;};exports[_0xfccd('0x42')]=function(_0x3beadd,_0x569dc1,_0x5cf972){var _0x3a8d3c=moment()[_0xfccd('0x12')](_0xfccd('0x3c'));_0x3beadd['state']=_0x569dc1;_0x3beadd['statedesc']=_0x5cf972;_0x3beadd[_0xfccd('0x39')]=_0x3beadd['responsetime']?_0x3beadd[_0xfccd('0x39')]:_0x3a8d3c;_0x3beadd[_0xfccd('0x3a')]=_0x3beadd[_0xfccd('0x3a')]?_0x3beadd[_0xfccd('0x3a')]:_0x3a8d3c;_0x3beadd['ringtime']=utils['getSeconds'](_0x3beadd[_0xfccd('0x39')]||0x0,_0x3beadd[_0xfccd('0x38')]||0x0);_0x3beadd[_0xfccd('0x43')]=_0x3beadd[_0xfccd('0x44')]?utils[_0xfccd('0x3e')](_0x3beadd['endtime'],_0x3beadd[_0xfccd('0x44')]):0x0;};exports[_0xfccd('0x45')]=function(_0x28cfce){return _0x28cfce===_0xfccd('0x46');};exports[_0xfccd('0x47')]=function(_0x360fe9,_0x8f649a,_0x5e92c3,_0x4ed4a7,_0x1f6241){var _0x46ffe7=_0x4ed4a7?'RECALL':_0x360fe9[_0xfccd('0x19')];_0x46ffe7=_0x1f6241?_0xfccd('0x48'):_0x46ffe7;return{'actionid':_0x360fe9[_0xfccd('0x49')],'action':_0xfccd('0x4a'),'channel':_0x360fe9[_0xfccd('0x4b')],'callerid':util['format'](_0xfccd('0x13'),_0x46ffe7,_0x360fe9[_0xfccd('0x1a')]),'Exten':_0xfccd('0x4c'),'Context':'from-sip','Priority':'1','variable':_0x5e92c3,'timeout':(_0x8f649a[_0xfccd('0x4d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x360fe9[_0xfccd('0x49')]};};exports['totalGlobal']=function(_0x578955){return _0x578955['countbusyretry']+_0x578955[_0xfccd('0x4e')]+_0x578955[_0xfccd('0x4f')]+_0x578955[_0xfccd('0x50')]+_0x578955[_0xfccd('0x51')];};exports[_0xfccd('0x52')]=function(_0x363b05){var _0x1be370=_[_0xfccd('0x53')](_0x363b05);_0x1be370[_0xfccd('0x35')]=0xf;_0x1be370[_0xfccd('0x36')]=_0xfccd('0x54');return _0x1be370;};exports[_0xfccd('0x55')]=function(_0x517b9f,_0x3d87bf,_0x499a3d){var _0x5d71dc={};_0x5d71dc[_0x3d87bf]=_0x517b9f[_0x3d87bf];_0x5d71dc[_0xfccd('0x56')]=![];_0x5d71dc['scheduledat']=moment()['add'](_0x499a3d,_0xfccd('0x57'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5d71dc[_0xfccd('0x1b')]=_0x517b9f[_0xfccd('0x1b')];_0x5d71dc[_0xfccd('0x58')]=_0x517b9f[_0xfccd('0x58')];_0x5d71dc[_0xfccd('0x1d')]=_0x517b9f[_0xfccd('0x1d')]||undefined;return _0x5d71dc;};exports[_0xfccd('0x59')]=function(_0x40cda9,_0x1934df){if(!_['isNil'](_0x40cda9)){if(_0x40cda9[_0xfccd('0x5a')]>0x0){_0x40cda9['pTalking']-=0x1;}else{logger['error'](_0x1934df,_0xfccd('0x5b'));}}else{logger['error'](_0x1934df,_0xfccd('0x5c'));}};exports[_0xfccd('0x5d')]=function(_0x6333cb){if(_0x6333cb<=0x0){return!![];}return![];};function buildObj(_0x363f06,_0x4d4781,_0x2e2655){_0x363f06['lastevent']=_0x4d4781;_0x363f06[_0xfccd('0x18')]=_0x363f06[_0xfccd('0x5e')];_0x363f06['interface']=_0x363f06[_0xfccd('0x4b')];_0x363f06[_0xfccd('0x5f')]=_0xfccd('0x60');if(_0x2e2655){_0x363f06[_0xfccd('0x61')]=_0x2e2655['mandatoryDisposition'];}return _0x363f06;}exports[_0xfccd('0x62')]=buildObj;exports[_0xfccd('0x63')]=function(_0x49c9cc){var _0x580cdc={};_0x580cdc[_0xfccd('0x5e')]=_0x49c9cc[_0xfccd('0x5e')];_0x580cdc[_0xfccd('0x64')]=_0x49c9cc[_0xfccd('0x4b')];_0x580cdc['uniqueid']=_0x49c9cc[_0xfccd('0x49')];return _0x580cdc;};exports[_0xfccd('0x65')]=function(_0x33b03b){var _0x13a40a=[];for(var _0xb7421e in _0x33b03b){if(_0x33b03b[_0xfccd('0x2f')](_0xb7421e)){if(!_[_0xfccd('0x15')](_0x33b03b[_0xb7421e])&&_0x33b03b[_0xb7421e]['state']===_0xfccd('0x66')&&_0x33b03b[_0xb7421e][_0xfccd('0x67')]===_0xfccd('0x68')){_0x13a40a['push'](_0x33b03b[_0xb7421e]['id']);}}}return _0x13a40a;};exports['getDiff']=function(_0x342756){var _0x5202d3=moment()[_0xfccd('0x69')](0x0);var _0x211d37=moment(_0x342756)[_0xfccd('0x69')](0x0);return _0x5202d3[_0xfccd('0x6a')](_0x211d37,_0xfccd('0x6b'));};exports[_0xfccd('0x6c')]=function(_0x24bdd2){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x24bdd2[_0xfccd('0x1b')],'ListId':_0x24bdd2[_0xfccd('0x58')],'VoiceQueueId':_0x24bdd2[_0xfccd('0x1d')]||undefined,'CampaignId':_0x24bdd2[_0xfccd('0x6d')]||undefined};};exports[_0xfccd('0x6e')]=function(_0xb7995d){if(_0xb7995d==='uniqueid'||_0xb7995d===_0xfccd('0x6f')||_0xb7995d===_0xfccd('0x5e')||_0xb7995d===_0xfccd('0x70')||_0xb7995d===_0xfccd('0x71')||_0xb7995d===_0xfccd('0x72')||_0xb7995d===_0xfccd('0x40')||_0xb7995d===_0xfccd('0x4b')||_0xb7995d===_0xfccd('0x19')||_0xb7995d===_0xfccd('0x56')||_0xb7995d==='calleridnum'||_0xb7995d===_0xfccd('0x73')||_0xb7995d===_0xfccd('0x74')||_0xb7995d==='countcongestionretry'||_0xb7995d===_0xfccd('0x4f')||_0xb7995d==='countglobal'||_0xb7995d===_0xfccd('0x75')||_0xb7995d===_0xfccd('0x76')||_0xb7995d==='callbackat'||_0xb7995d==='recallme'||_0xb7995d===_0xfccd('0x1b')||_0xb7995d===_0xfccd('0x58')||_0xb7995d===_0xfccd('0x41')||_0xb7995d===_0xfccd('0x1d')||_0xb7995d===_0xfccd('0x77')||_0xb7995d===_0xfccd('0x78')||_0xb7995d===_0xfccd('0x79')||_0xb7995d==='xmd-phone'||_0xb7995d==='xmd-listid'||_0xb7995d===_0xfccd('0x7a')||_0xb7995d==='xmd-dialtimeout'||_0xb7995d===_0xfccd('0x7b')||_0xb7995d==='xmd-dialid'||_0xb7995d===_0xfccd('0x7c')||_0xb7995d===_0xfccd('0x7d')||_0xb7995d==='xmd-cdrtype'||_0xb7995d===_0xfccd('0x7e')||_0xb7995d===_0xfccd('0x7f')||_0xb7995d===_0xfccd('0x80')||_0xb7995d===_0xfccd('0x81')||_0xb7995d===_0xfccd('0x82')||_0xb7995d==='rtpaudioqosjitter'||_0xb7995d===_0xfccd('0x83')||_0xb7995d==='rtpaudioqosloss'||_0xb7995d==='rtpaudioqoslossbridged'||_0xb7995d===_0xfccd('0x84')||_0xb7995d===_0xfccd('0x85')||_0xb7995d==='rtpaudioqos'||_0xb7995d===_0xfccd('0x82')||_0xb7995d===_0xfccd('0x86')||_0xb7995d==='rtpaudioqosjitterbridged'||_0xb7995d===_0xfccd('0x87')||_0xb7995d===_0xfccd('0x88')||_0xb7995d===_0xfccd('0x84')||_0xb7995d===_0xfccd('0x85')||_0xb7995d===_0xfccd('0x89')||_0xb7995d===_0xfccd('0x8a')||_0xb7995d===_0xfccd('0x35')||_0xb7995d===_0xfccd('0x36')){return![];}return!![];};exports[_0xfccd('0x8b')]=function(_0x5c3307,_0x2f6a06){var _0x328a63,_0x451259,_0x556e53;if(_0x2f6a06<=0x0){_0x2f6a06=0x1;}_0x328a63=new RegExp(_0xfccd('0x8c')+_0x2f6a06+'}$');_0x451259=Math[_0xfccd('0x8d')](0xa,_0x2f6a06-0x1);_0x556e53=Math[_0xfccd('0x8d')](0xa,_0x2f6a06)-0x1;return util[_0xfccd('0x12')]('%s',_[_0xfccd('0x8e')](_0x5c3307,_0x328a63,_['random'](_0x451259,_0x556e53)));};exports[_0xfccd('0x8f')]=function(_0x295522){var _0x17b91a=_0x295522[_0xfccd('0x90')](/"(.*?)"/);return _0x17b91a?_0x17b91a[0x1]:_0x295522;};exports[_0xfccd('0x91')]=function(_0x3f69c9){var _0xeb8666=_0x3f69c9[_0xfccd('0x90')](/<(.*?)>/);return _0xeb8666?_0xeb8666[0x1]:_0x3f69c9;};function buildNoAnswerEventPayload(_0x2eaa99,_0x7b6895){var _0x53c852=buildObj(_0x2eaa99,_0xfccd('0x92'));if(!_[_0xfccd('0x10')](_0x7b6895[_0xfccd('0x93')])){Object['keys'](_0x7b6895[_0xfccd('0x93')])[_0xfccd('0x94')](function(_0x3f51ac){_0x53c852[_0x3f51ac[_0xfccd('0x95')]()]=_0x7b6895[_0xfccd('0x93')][_0x3f51ac];});}return _0x53c852;}exports[_0xfccd('0x96')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xec2e=['127.0.0.1','../../dialer/utils','loggerCatch','inspect','logger','info','loggerError','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','VoiceQueueId','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','%s%s','XMD-','toLowerVariables','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','error','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','endtime','logAgent','responsetime','getSeconds','UserId','logCustomer','talktime','isFailure','Failure','channelAgent','from-sip','timeout','uniqueid','totalGlobal','countcongestionretry','countnoanswerretry','clone','Global','scheduledAt','active','scheduledat','minutes','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','name','queue','interface','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','milliseconds','diff','seconds','createBody','idContact','campaigntype','dialAnswer','membername','countglobal','callbackuniqueid','recallme','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI'];(function(_0x5646bc,_0x51ca71){var _0x37d217=function(_0x3d4d50){while(--_0x3d4d50){_0x5646bc['push'](_0x5646bc['shift']());}};_0x37d217(++_0x51ca71);}(_0xec2e,0x82));var _0xeec2=function(_0x52f868,_0x4b8187){_0x52f868=_0x52f868-0x0;var _0x5113e0=_0xec2e[_0x52f868];return _0x5113e0;};'use strict';var util=require('util');var _=require(_0xeec2('0x0'));var moment=require(_0xeec2('0x1'));var logger=require(_0xeec2('0x2'))(_0xeec2('0x3'));var ipAgi=process[_0xeec2('0x4')][_0xeec2('0x5')]||_0xeec2('0x6');var utils=require(_0xeec2('0x7'));exports[_0xeec2('0x8')]=function(_0x40032f){return function(_0x15f46b){logger['error'](_0x40032f,util[_0xeec2('0x9')](_0x15f46b,{'showHidden':![],'depth':null}));};};exports[_0xeec2('0xa')]=function(_0x215698,_0x396187){logger[_0xeec2('0xb')](_0x215698,util[_0xeec2('0x9')](_0x396187,{'showHidden':![],'depth':null}));};exports[_0xeec2('0xc')]=function(_0x472311,_0x31210a){logger['error'](_0x472311,util[_0xeec2('0x9')](_0x31210a,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x243d48){return function(_0x284e69){logger['info'](_0x243d48,util[_0xeec2('0x9')](_0x284e69,{'showHidden':![],'depth':null}));};};exports[_0xeec2('0xd')]=function(_0x5367d3,_0x21480d,_0x5446f9){return{'message':_0x5367d3,'unlock':_0x21480d,'active':_0x5446f9};};exports['getCallerId']=function(_0x3ff7f6,_0xf893a,_0x2507c8){if(!_[_0xeec2('0xe')](_0x2507c8)&&_0xeec2('0xf')===typeof _0x2507c8&&!_[_0xeec2('0x10')](_0x2507c8)){if(!_['isUndefined'](_0xf893a)&&_0xeec2('0xf')===typeof _0xf893a&&!_[_0xeec2('0x10')](_0xf893a)){return util[_0xeec2('0x11')]('\x22%s\x22\x20<%s>',_0xf893a,_0x2507c8);}return util['format'](_0xeec2('0x12'),_0x2507c8,_0x2507c8);}if(!_[_0xeec2('0xe')](_0x3ff7f6)&&'string'===typeof _0x3ff7f6&&!_[_0xeec2('0x10')](_0x3ff7f6)){return _0x3ff7f6;}return _0xeec2('0x13');};exports[_0xeec2('0x14')]=function(_0xc9a91b){if(_[_0xeec2('0x15')](_0xc9a91b)){return![];}return _0xc9a91b;};exports[_0xeec2('0x16')]=function(_0x54f915,_0x36b832,_0x26def8,_0x18bff8,_0x1b3c03,_0xb7575){var _0x2b5987={'XMD-QUEUE':_0x36b832[_0xeec2('0x17')]?_0x36b832['Queue']['name']:'','XMD-CALLERID':_0x18bff8,'XMD-CALLERID-PREVIEW':_0xb7575?util[_0xeec2('0x11')](_0xeec2('0x12'),_0xb7575[_0xeec2('0x18')],_0xb7575[_0xeec2('0x19')]):_0x18bff8,'XMD-DIALID':_0x1b3c03,'XMD-CONTACTID':_0x36b832[_0xeec2('0x1a')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x18bff8,'XMD-VOICEQUEUEID':_0x36b832[_0xeec2('0x1b')],'XMD-DIALCHANNEL':_0x26def8,'XMD-DIALTIMEOUT':_0x54f915['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xeec2('0x11')]('\x22rtTxX%s%s\x22',_0x54f915[_0xeec2('0x1c')]?'g':'',_[_0xeec2('0x10')](_0x54f915[_0xeec2('0x1d')])?'':_0xeec2('0x1e')),'XMD-DIALURL':_0x54f915[_0xeec2('0x1f')]||'','XMD-AGI':_0x54f915['dialQueueProject']?util[_0xeec2('0x11')](_0xeec2('0x20'),ipAgi,_0x54f915[_0xeec2('0x21')]):_0xeec2('0x22'),'XMD-AGIAFTER':_0x54f915['dialQueueProject2']?util['format'](_0xeec2('0x20'),ipAgi,_0x54f915[_0xeec2('0x1c')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0xb7575?_0xb7575[_0xeec2('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0xb7575?_0xb7575[_0xeec2('0x24')]:'','XMD-DESTINATION':_0xeec2('0x25'),'SIPADDHEADER':_0xeec2('0x26')};if(!_[_0xeec2('0x10')](_0x54f915[_0xeec2('0x1d')])){_0x2b5987[util[_0xeec2('0x11')]('%s',_0xeec2('0x27'))]=_0x54f915[_0xeec2('0x1d')];_0x2b5987[util[_0xeec2('0x11')]('%s',_0xeec2('0x28'))]=_0x1b3c03;}if(_0x36b832&&_0x36b832[_0xeec2('0x29')]){for(var _0x18a605 in _0x36b832[_0xeec2('0x29')]){if(_0x36b832[_0xeec2('0x29')]['hasOwnProperty'](_0x18a605)){if(!_['isNil'](_0x36b832['Contact'][_0x18a605])&&_0x18a605!=='id'&&_0x18a605!=='tags'&&_0x18a605!=='createdAt'&&_0x18a605!=='updatedAt'){_0x2b5987[util[_0xeec2('0x11')](_0xeec2('0x2a'),_0xeec2('0x2b'),_['toUpper'](_0x18a605))]=_0x36b832[_0xeec2('0x29')][_0x18a605];}}}}return _0x2b5987;};exports[_0xeec2('0x2c')]=function(_0x481bb2){var _0x1c8b40={};for(var _0xfdb456 in _0x481bb2){if(_0x481bb2[_0xeec2('0x2d')](_0xfdb456)){_0x1c8b40[util[_0xeec2('0x11')]('%s',_['toLower'](_0xfdb456))]=_0x481bb2[_0xfdb456];}}return{'variables':_0x1c8b40};};exports['updateOriginated']=function(_0x46597d,_0xa8419c){if(!_['isNil'](_0x46597d)){if(_0x46597d[_0xeec2('0x2d')](_0xeec2('0x2e'))){if(_0x46597d[_0xeec2('0x2e')]>0x0){_0x46597d[_0xeec2('0x2e')]-=0x1;}else{logger['error'](_0xeec2('0x2f'),_0xa8419c);}}}else{logger[_0xeec2('0x30')](_0xeec2('0x31'),_0xa8419c);}};exports[_0xeec2('0x32')]=function(_0xdfa362){var _0x7c0323=moment()[_0xeec2('0x11')](_0xeec2('0x33'));_0xdfa362[_0xeec2('0x34')]=0xd;_0xdfa362[_0xeec2('0x35')]=_0xeec2('0x36');_0xdfa362[_0xeec2('0x37')]=_0x7c0323;_0xdfa362['responsetime']=_0x7c0323;_0xdfa362[_0xeec2('0x38')]=_0x7c0323;};exports[_0xeec2('0x39')]=function(_0x33a2a0,_0x4333c5,_0x3c5da9){var _0xdb593a=moment()['format'](_0xeec2('0x33'));_0x33a2a0['state']=_0x4333c5;_0x33a2a0[_0xeec2('0x35')]=_0x3c5da9;_0x33a2a0[_0xeec2('0x3a')]=_0xdb593a;_0x33a2a0['ringtime']=utils[_0xeec2('0x3b')](_0x33a2a0[_0xeec2('0x3a')],_0x33a2a0[_0xeec2('0x37')]);};exports['logLookAgent']=function(_0xf00ad,_0x28b4cc,_0x3fb47c){_0xf00ad['membername']=_0x28b4cc;_0xf00ad[_0xeec2('0x3c')]=_0x3fb47c;};exports[_0xeec2('0x3d')]=function(_0x5516a6,_0x34b8ea,_0x305dd2){var _0x28accc=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5516a6[_0xeec2('0x34')]=_0x34b8ea;_0x5516a6[_0xeec2('0x35')]=_0x305dd2;_0x5516a6[_0xeec2('0x3a')]=_0x5516a6['responsetime']?_0x5516a6[_0xeec2('0x3a')]:_0x28accc;_0x5516a6['endtime']=_0x5516a6[_0xeec2('0x38')]?_0x5516a6[_0xeec2('0x38')]:_0x28accc;_0x5516a6['ringtime']=utils['getSeconds'](_0x5516a6[_0xeec2('0x3a')]||0x0,_0x5516a6[_0xeec2('0x37')]||0x0);_0x5516a6[_0xeec2('0x3e')]=_0x5516a6['answertime']?utils[_0xeec2('0x3b')](_0x5516a6[_0xeec2('0x38')],_0x5516a6['answertime']):0x0;};exports[_0xeec2('0x3f')]=function(_0x5c6aff){return _0x5c6aff===_0xeec2('0x40');};exports['variablesAction']=function(_0xed9ab6,_0x14b3f3,_0x227de3,_0x25e652,_0x4655f4){var _0x1a1097=_0x25e652?'RECALL':_0xed9ab6['calleridname'];_0x1a1097=_0x4655f4?'BOOKED':_0x1a1097;return{'actionid':_0xed9ab6['uniqueid'],'action':'originate','channel':_0xed9ab6[_0xeec2('0x41')],'callerid':util[_0xeec2('0x11')](_0xeec2('0x12'),_0x1a1097,_0xed9ab6[_0xeec2('0x19')]),'Exten':_0xeec2('0x25'),'Context':_0xeec2('0x42'),'Priority':'1','variable':_0x227de3,'timeout':(_0x14b3f3[_0xeec2('0x43')]||0x1e)*0x3e8,'async':!![],'channelid':_0xed9ab6[_0xeec2('0x44')]};};exports[_0xeec2('0x45')]=function(_0x46b205){return _0x46b205['countbusyretry']+_0x46b205[_0xeec2('0x46')]+_0x46b205[_0xeec2('0x47')]+_0x46b205['countagentrejectretry']+_0x46b205['countnosuchnumberretry'];};exports['cloneAction']=function(_0x4f7e51){var _0x50805d=_[_0xeec2('0x48')](_0x4f7e51);_0x50805d[_0xeec2('0x34')]=0xf;_0x50805d[_0xeec2('0x35')]=_0xeec2('0x49');return _0x50805d;};exports[_0xeec2('0x4a')]=function(_0x50e95b,_0x4278c4,_0x5b2f04){var _0x3b2965={};_0x3b2965[_0x4278c4]=_0x50e95b[_0x4278c4];_0x3b2965[_0xeec2('0x4b')]=![];_0x3b2965[_0xeec2('0x4c')]=moment()['add'](_0x5b2f04,_0xeec2('0x4d'))[_0xeec2('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x3b2965[_0xeec2('0x1a')]=_0x50e95b[_0xeec2('0x1a')];_0x3b2965[_0xeec2('0x4e')]=_0x50e95b[_0xeec2('0x4e')];_0x3b2965[_0xeec2('0x1b')]=_0x50e95b['VoiceQueueId']||undefined;return _0x3b2965;};exports['decrementTalkink']=function(_0x24892d,_0x1d584c){if(!_['isNil'](_0x24892d)){if(_0x24892d[_0xeec2('0x4f')]>0x0){_0x24892d[_0xeec2('0x4f')]-=0x1;}else{logger[_0xeec2('0x30')](_0x1d584c,_0xeec2('0x50'));}}else{logger[_0xeec2('0x30')](_0x1d584c,_0xeec2('0x51'));}};exports['IsNotLoggedIn']=function(_0x5180d4){if(_0x5180d4<=0x0){return!![];}return![];};function buildObj(_0x57ee7e,_0x368be1,_0x454f39){_0x57ee7e[_0xeec2('0x52')]=_0x368be1;_0x57ee7e[_0xeec2('0x53')]=_0x57ee7e[_0xeec2('0x54')];_0x57ee7e[_0xeec2('0x55')]=_0x57ee7e[_0xeec2('0x41')];_0x57ee7e['motionChannel']=_0xeec2('0x56');if(_0x454f39){_0x57ee7e[_0xeec2('0x57')]=_0x454f39['mandatoryDisposition'];}return _0x57ee7e;}exports['buildObj']=buildObj;exports[_0xeec2('0x58')]=function(_0x5e7cbc){var _0x1aae6b={};_0x1aae6b['queue']=_0x5e7cbc['queue'];_0x1aae6b[_0xeec2('0x55')]=_0x5e7cbc[_0xeec2('0x41')];_0x1aae6b[_0xeec2('0x44')]=_0x5e7cbc[_0xeec2('0x44')];return _0x1aae6b;};exports[_0xeec2('0x59')]=function(_0x7db79f){var _0x4a6dff=[];for(var _0x24724d in _0x7db79f){if(_0x7db79f[_0xeec2('0x2d')](_0x24724d)){if(!_[_0xeec2('0x15')](_0x7db79f[_0x24724d])&&_0x7db79f[_0x24724d]['state']===_0xeec2('0x5a')&&_0x7db79f[_0x24724d][_0xeec2('0x5b')]==='reachable'){_0x4a6dff['push'](_0x7db79f[_0x24724d]['id']);}}}return _0x4a6dff;};exports['getDiff']=function(_0x9a901a){var _0x34414b=moment()[_0xeec2('0x5c')](0x0);var _0x4ce477=moment(_0x9a901a)['milliseconds'](0x0);return _0x34414b[_0xeec2('0x5d')](_0x4ce477,_0xeec2('0x5e'));};exports[_0xeec2('0x5f')]=function(_0xec6373){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xec6373[_0xeec2('0x1a')],'ListId':_0xec6373[_0xeec2('0x4e')],'VoiceQueueId':_0xec6373[_0xeec2('0x1b')]||undefined,'CampaignId':_0xec6373['CampaignId']||undefined};};exports['filterKey']=function(_0x454f4e){if(_0x454f4e===_0xeec2('0x44')||_0x454f4e===_0xeec2('0x60')||_0x454f4e==='queue'||_0x454f4e==='type'||_0x454f4e===_0xeec2('0x61')||_0x454f4e===_0xeec2('0x62')||_0x454f4e===_0xeec2('0x63')||_0x454f4e===_0xeec2('0x41')||_0x454f4e===_0xeec2('0x18')||_0x454f4e===_0xeec2('0x4b')||_0x454f4e===_0xeec2('0x19')||_0x454f4e===_0xeec2('0x4c')||_0x454f4e==='countbusyretry'||_0x454f4e===_0xeec2('0x46')||_0x454f4e===_0xeec2('0x47')||_0x454f4e===_0xeec2('0x64')||_0x454f4e==='callback'||_0x454f4e===_0xeec2('0x65')||_0x454f4e==='callbackat'||_0x454f4e===_0xeec2('0x66')||_0x454f4e===_0xeec2('0x1a')||_0x454f4e===_0xeec2('0x4e')||_0x454f4e===_0xeec2('0x3c')||_0x454f4e===_0xeec2('0x1b')||_0x454f4e===_0xeec2('0x67')||_0x454f4e==='xmd-voicequeueid'||_0x454f4e===_0xeec2('0x68')||_0x454f4e===_0xeec2('0x69')||_0x454f4e===_0xeec2('0x6a')||_0x454f4e===_0xeec2('0x6b')||_0x454f4e===_0xeec2('0x6c')||_0x454f4e===_0xeec2('0x6d')||_0x454f4e===_0xeec2('0x6e')||_0x454f4e===_0xeec2('0x6f')||_0x454f4e===_0xeec2('0x70')||_0x454f4e==='xmd-cdrtype'||_0x454f4e===_0xeec2('0x71')||_0x454f4e===_0xeec2('0x72')||_0x454f4e===_0xeec2('0x73')||_0x454f4e===_0xeec2('0x74')||_0x454f4e===_0xeec2('0x75')||_0x454f4e===_0xeec2('0x76')||_0x454f4e==='rtpaudioqosjitterbridged'||_0x454f4e===_0xeec2('0x77')||_0x454f4e===_0xeec2('0x78')||_0x454f4e===_0xeec2('0x79')||_0x454f4e===_0xeec2('0x7a')||_0x454f4e===_0xeec2('0x74')||_0x454f4e==='rtpaudioqosbridged'||_0x454f4e===_0xeec2('0x76')||_0x454f4e==='rtpaudioqosjitterbridged'||_0x454f4e===_0xeec2('0x77')||_0x454f4e===_0xeec2('0x78')||_0x454f4e==='rtpaudioqosrtt'||_0x454f4e===_0xeec2('0x7a')||_0x454f4e===_0xeec2('0x7b')||_0x454f4e==='bridgepvtcallid'||_0x454f4e===_0xeec2('0x34')||_0x454f4e===_0xeec2('0x35')){return![];}return!![];};exports[_0xeec2('0x7c')]=function(_0x4d83e2,_0x2521cc){var _0x52990b,_0x5e6c42,_0x15106d;if(_0x2521cc<=0x0){_0x2521cc=0x1;}_0x52990b=new RegExp('\x5cw{0,'+_0x2521cc+'}$');_0x5e6c42=Math[_0xeec2('0x7d')](0xa,_0x2521cc-0x1);_0x15106d=Math['pow'](0xa,_0x2521cc)-0x1;return util[_0xeec2('0x11')]('%s',_[_0xeec2('0x7e')](_0x4d83e2,_0x52990b,_[_0xeec2('0x7f')](_0x5e6c42,_0x15106d)));};exports[_0xeec2('0x80')]=function(_0x45c22d){var _0x372689=_0x45c22d[_0xeec2('0x81')](/"(.*?)"/);return _0x372689?_0x372689[0x1]:_0x45c22d;};exports[_0xeec2('0x82')]=function(_0x45bc1e){var _0x396082=_0x45bc1e['match'](/<(.*?)>/);return _0x396082?_0x396082[0x1]:_0x45bc1e;};function buildNoAnswerEventPayload(_0x1614fa,_0x4c9e7a){var _0x5a1103=buildObj(_0x1614fa,_0xeec2('0x83'));if(!_[_0xeec2('0x10')](_0x4c9e7a[_0xeec2('0x84')])){Object[_0xeec2('0x85')](_0x4c9e7a['variables'])[_0xeec2('0x86')](function(_0xccd2fe){_0x5a1103[_0xccd2fe[_0xeec2('0x87')]()]=_0x4c9e7a[_0xeec2('0x84')][_0xccd2fe];});}return _0x5a1103;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 52b2747..64370dc 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 _0x2416=['boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string'];(function(_0x4c0a0e,_0x2e4b1a){var _0x284bd0=function(_0x3b4f3d){while(--_0x3b4f3d){_0x4c0a0e['push'](_0x4c0a0e['shift']());}};_0x284bd0(++_0x2e4b1a);}(_0x2416,0x94));var _0x6241=function(_0x4f3944,_0x3d3a83){_0x4f3944=_0x4f3944-0x0;var _0xcf0458=_0x2416[_0x4f3944];return _0xcf0458;};'use strict';exports[_0x6241('0x0')]={'queue':{'type':_0x6241('0x1'),'required':!![]},'interface':{'type':_0x6241('0x1'),'required':!![]},'membername':{'type':_0x6241('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x6241('0x2'),'required':![]}};exports[_0x6241('0x3')]={'queue':{'type':_0x6241('0x1'),'required':!![]},'interface':{'type':_0x6241('0x1'),'required':!![]}};exports[_0x6241('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x6241('0x1'),'required':![]}};exports[_0x6241('0x5')]={'module':{'type':_0x6241('0x1'),'required':![]}};exports[_0x6241('0x6')]={'uniqueid':{'type':_0x6241('0x1'),'required':!![]}};exports[_0x6241('0x7')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':'string'},'format':{'type':_0x6241('0x1')},'mixmonitorid':{'type':_0x6241('0x1')}};exports[_0x6241('0x8')]={'uniqueid':{'type':_0x6241('0x1'),'required':!![]}};exports[_0x6241('0x9')]={'uniqueid':{'type':_0x6241('0x1'),'required':!![]},'exten':{'type':_0x6241('0x1'),'required':!![]},'context':{'type':_0x6241('0x1')}}; \ No newline at end of file +var _0x6906=['queueremove','queuepause','boolean','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0x6906,0x76));var _0x6690=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x6906[_0x3b380d];return _0x54502b;};'use strict';exports[_0x6690('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x6690('0x1'),'required':!![]},'membername':{'type':_0x6690('0x1'),'required':!![]},'penalty':{'type':_0x6690('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x6690('0x3')]={'queue':{'type':_0x6690('0x1'),'required':!![]},'interface':{'type':_0x6690('0x1'),'required':!![]}};exports[_0x6690('0x4')]={'interface':{'type':_0x6690('0x1'),'required':!![]},'paused':{'type':_0x6690('0x5')},'reason':{'type':_0x6690('0x1'),'required':![]}};exports[_0x6690('0x6')]={'module':{'type':_0x6690('0x1'),'required':![]}};exports[_0x6690('0x7')]={'uniqueid':{'type':_0x6690('0x1'),'required':!![]}};exports[_0x6690('0x8')]={'uniqueid':{'type':_0x6690('0x1'),'required':!![]},'filename':{'type':_0x6690('0x1')},'format':{'type':_0x6690('0x1')},'mixmonitorid':{'type':'string'}};exports[_0x6690('0x9')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x6690('0xa')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':'string','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 a73e70f..ab35fad 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['initTriggers','triggers','initTemplates','initZendeskAccounts','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','total','answered','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','agents','length','isUndefined','mergeFromDatabase','initTelephones','initTrunks'];(function(_0x5d8168,_0x5b94c7){var _0x17e069=function(_0x1c8e16){while(--_0x1c8e16){_0x5d8168['push'](_0x5d8168['shift']());}};_0x17e069(++_0x5b94c7);}(_0xdb28,0x106));var _0x8db2=function(_0x34c3ed,_0x12b7b3){_0x34c3ed=_0x34c3ed-0x0;var _0xb57bff=_0xdb28[_0x34c3ed];return _0xb57bff;};'use strict';var _=require(_0x8db2('0x0'));var moment=require(_0x8db2('0x1'));var util=require(_0x8db2('0x2'));var Agent=require(_0x8db2('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x8db2('0x4'));var VoiceQueue=require(_0x8db2('0x5'));var Trigger=require(_0x8db2('0x6'));var Template=require(_0x8db2('0x7'));var Campaign=require(_0x8db2('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x8db2('0x9'));var SalesforceAccount=require(_0x8db2('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x8db2('0xb'));var DeskAccount=require(_0x8db2('0xc'));var VtigerAccount=require(_0x8db2('0xd'));var ServicenowAccount=require(_0x8db2('0xe'));var Dynamics365Account=require(_0x8db2('0xf'));var FreshsalesAccount=require(_0x8db2('0x10'));var FaxAccount=require(_0x8db2('0x11'));function Realtime(){this['agents']={};this[_0x8db2('0x12')]={};this[_0x8db2('0x13')]={};this[_0x8db2('0x14')]={};this['triggers']={};this[_0x8db2('0x15')]={};this[_0x8db2('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x8db2('0x17')]={};this[_0x8db2('0x18')]={};this[_0x8db2('0x19')]={};this[_0x8db2('0x1a')]={};this[_0x8db2('0x1b')]={};this['settings']={};this['zendeskAccounts']={};this[_0x8db2('0x1c')]={};this[_0x8db2('0x1d')]={};this[_0x8db2('0x1e')]={};this[_0x8db2('0x1f')]={};this[_0x8db2('0x20')]={};this[_0x8db2('0x21')]={};this[_0x8db2('0x22')]={};this[_0x8db2('0x23')]={};this[_0x8db2('0x24')]={};this[_0x8db2('0x25')]={};}function freeIsNotKey(_0x5489a9,_0x13b0f5,_0x24da1b){var _0x48101e=_[_0x8db2('0x26')](_0x5489a9,function(_0x44957d){return _0x44957d[_0x24da1b];});for(var _0x21db8c in _0x13b0f5){if(_0x13b0f5[_0x8db2('0x27')](_0x21db8c)){if(!_0x48101e[_0x21db8c]){delete _0x13b0f5[_0x21db8c];}}}}function freeIsNotKeySip(_0x2efd06,_0x46ce14){var _0x51d60d=_['mapKeys'](_0x2efd06,function(_0x77789){return util[_0x8db2('0x28')](_0x8db2('0x29'),_0x77789[_0x8db2('0x2a')]);});for(var _0x58562e in _0x46ce14){if(_0x46ce14[_0x8db2('0x27')](_0x58562e)){if(!_0x51d60d[_0x58562e]){delete _0x46ce14[_0x58562e];}}}}function freeIsNotKeyAgent(_0x36a9ff,_0x260940){var _0x297ba3=_[_0x8db2('0x26')](_0x36a9ff,function(_0x597260){var _0x124467=_[_0x8db2('0x2b')](_0x597260[_0x8db2('0x2c')])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x597260[_0x8db2('0x2a')]):_0x597260[_0x8db2('0x2c')];return _0x124467;});for(var _0x5c6614 in _0x260940){if(_0x260940[_0x8db2('0x27')](_0x5c6614)){if(!_0x297ba3[_0x5c6614]){delete _0x260940[_0x5c6614];}}}}function clearVoiceCallReports(_0x4f6516){_0x4f6516['total']=0x0;_0x4f6516['answered']=0x0;_0x4f6516['sumHoldTime']=0x0;_0x4f6516[_0x8db2('0x2d')]=0x0;_0x4f6516[_0x8db2('0x2e')]=0x0;}function clearCampaigns(_0x3be281){if(!_[_0x8db2('0x2f')](_0x3be281)){for(var _0x145328 in _0x3be281){if(_0x3be281[_0x8db2('0x27')](_0x145328)){_0x3be281[_0x145328]['ivrTotalCallsDays']=0x0;_0x3be281[_0x145328][_0x8db2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x372311){if(!_[_0x8db2('0x2f')](_0x372311)){for(var _0x8b7cec in _0x372311){if(_0x372311['hasOwnProperty'](_0x8b7cec)){_0x372311[_0x8b7cec][_0x8db2('0x31')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x32')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x33')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x34')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x35')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2e')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x37')]=0x0;_0x372311[_0x8b7cec]['outboundBusyCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x38')]=0x0;_0x372311[_0x8b7cec]['outboundNoSuchCallsDay']=0x0;_0x372311[_0x8b7cec]['outboundUnknownCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x39')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3a')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3b')]=0x0;_0x372311[_0x8b7cec]['outboundOriginateFailureCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3c')]=0x0;_0x372311[_0x8b7cec]['outboundReCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3e')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x35d337,_0x1a460b){for(var _0x4df530 in _0x1a460b){if(_0x35d337['hasOwnProperty'](_0x4df530)){_0x35d337[_0x4df530]=_0x1a460b[_0x4df530];}}};Realtime[_0x8db2('0x3f')][_0x8db2('0x40')]=function(){var _0xc884a=this;return function(_0x2a2d65){if(_0x2a2d65){freeIsNotKeyAgent(_0x2a2d65,_0xc884a[_0x8db2('0x41')]);for(var _0xd39848=0x0,_0x101711={};_0xd39848<_0x2a2d65[_0x8db2('0x42')];_0xd39848+=0x1){_0x101711=_0x2a2d65[_0xd39848];var _0x46e0c8=_[_0x8db2('0x2b')](_0x101711['interface'])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x101711['name']):_0x101711[_0x8db2('0x2c')];if(_[_0x8db2('0x43')](_0xc884a['agents'][_0x46e0c8])){_0xc884a['agents'][_0x46e0c8]=new Agent(_0x101711);}else{_0xc884a[_0x8db2('0x44')](_0xc884a['agents'][_0x46e0c8],_0x101711);}}}return _0xc884a[_0x8db2('0x41')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x45')]=function(){var _0x22c896=this;return function(_0x5cc419){if(_0x5cc419){freeIsNotKeySip(_0x5cc419,_0x22c896[_0x8db2('0x12')]);for(var _0x5e34e0=0x0,_0x227a08={};_0x5e34e0<_0x5cc419[_0x8db2('0x42')];_0x5e34e0+=0x1){_0x227a08=_0x5cc419[_0x5e34e0];if(_[_0x8db2('0x43')](_0x22c896[_0x8db2('0x12')][util['format']('SIP/%s',_0x227a08[_0x8db2('0x2a')])])){_0x22c896[_0x8db2('0x12')][util['format'](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])]=new Telephone(_0x227a08);}else{_0x22c896[_0x8db2('0x44')](_0x22c896['telephones'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])],_0x227a08);}}}return _0x22c896[_0x8db2('0x12')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x46')]=function(){var _0x380046=this;return function(_0x1575ea){if(_0x1575ea){freeIsNotKeySip(_0x1575ea,_0x380046[_0x8db2('0x13')]);for(var _0x63c561=0x0,_0x21cf7c={};_0x63c561<_0x1575ea[_0x8db2('0x42')];_0x63c561+=0x1){_0x21cf7c=_0x1575ea[_0x63c561];if(_[_0x8db2('0x43')](_0x380046['trunks'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c['name'])])){_0x380046['trunks'][util[_0x8db2('0x28')]('SIP/%s',_0x21cf7c[_0x8db2('0x2a')])]=new Trunk(_0x21cf7c);}else{_0x380046[_0x8db2('0x44')](_0x380046[_0x8db2('0x13')][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c[_0x8db2('0x2a')])],_0x21cf7c);}}}return _0x380046[_0x8db2('0x13')];};};Realtime['prototype'][_0x8db2('0x47')]=function(){var _0x3d44de=this;return function(_0x40c69e){if(_0x40c69e){freeIsNotKey(_0x40c69e,_0x3d44de[_0x8db2('0x48')],'id');for(var _0x482b26=0x0,_0x424c27={};_0x482b26<_0x40c69e[_0x8db2('0x42')];_0x482b26+=0x1){_0x424c27=_0x40c69e[_0x482b26];if(_[_0x8db2('0x43')](_0x3d44de[_0x8db2('0x48')][_0x424c27['id']])){_0x3d44de['triggers'][_0x424c27['id']]=new Trigger(_0x424c27);}else{_0x3d44de[_0x8db2('0x44')](_0x3d44de['triggers'][_0x424c27['id']],_0x424c27);}}}return _0x3d44de[_0x8db2('0x48')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x49')]=function(){var _0x4d2164=this;return function(_0x4b0e72){if(_0x4b0e72){freeIsNotKey(_0x4b0e72,_0x4d2164[_0x8db2('0x16')],'id');for(var _0x47c556=0x0,_0x173cc7={};_0x47c556<_0x4b0e72[_0x8db2('0x42')];_0x47c556+=0x1){_0x173cc7=_0x4b0e72[_0x47c556];if(_[_0x8db2('0x43')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']])){_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']]=new Template(_0x173cc7);}else{_0x4d2164[_0x8db2('0x44')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']],_0x173cc7);}}}return _0x4d2164[_0x8db2('0x16')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4a')]=function(){var _0x1362ed=this;return function(_0x36f9d6){if(_0x36f9d6){freeIsNotKey(_0x36f9d6,_0x1362ed['zendeskAccounts'],'id');for(var _0x449109=0x0,_0x2ada52={};_0x449109<_0x36f9d6[_0x8db2('0x42')];_0x449109+=0x1){_0x2ada52=_0x36f9d6[_0x449109];if(_[_0x8db2('0x43')](_0x1362ed['zendeskAccounts'][_0x2ada52['id']])){_0x1362ed['zendeskAccounts'][_0x2ada52['id']]=new ZendeskAccount(_0x2ada52);}else{_0x1362ed[_0x8db2('0x44')](_0x1362ed[_0x8db2('0x4b')][_0x2ada52['id']],_0x2ada52);}}}return _0x1362ed[_0x8db2('0x4b')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x494d6e=this;return function(_0x44ac56){if(_0x44ac56){freeIsNotKey(_0x44ac56,_0x494d6e[_0x8db2('0x1c')],'id');for(var _0x55c7dd=0x0,_0x383fa1={};_0x55c7dd<_0x44ac56[_0x8db2('0x42')];_0x55c7dd+=0x1){_0x383fa1=_0x44ac56[_0x55c7dd];if(_[_0x8db2('0x43')](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']])){_0x494d6e['salesforceAccounts'][_0x383fa1['id']]=new SalesforceAccount(_0x383fa1);}else{_0x494d6e['mergeFromDatabase'](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']],_0x383fa1);}}}return _0x494d6e[_0x8db2('0x1c')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4c')]=function(){var _0x3daed6=this;return function(_0x2bf408){if(_0x2bf408){freeIsNotKey(_0x2bf408,_0x3daed6[_0x8db2('0x1e')],'id');for(var _0x3ca2a7=0x0,_0x4187d6={};_0x3ca2a7<_0x2bf408[_0x8db2('0x42')];_0x3ca2a7+=0x1){_0x4187d6=_0x2bf408[_0x3ca2a7];if(_[_0x8db2('0x43')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']])){_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']]=new FreshdeskAccount(_0x4187d6);}else{_0x3daed6[_0x8db2('0x44')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']],_0x4187d6);}}}return _0x3daed6['freshdeskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4d')]=function(){var _0x579317=this;return function(_0x27b644){if(_0x27b644){freeIsNotKey(_0x27b644,_0x579317[_0x8db2('0x1f')],'id');for(var _0x3af298=0x0,_0x547215={};_0x3af298<_0x27b644[_0x8db2('0x42')];_0x3af298+=0x1){_0x547215=_0x27b644[_0x3af298];if(_[_0x8db2('0x43')](_0x579317[_0x8db2('0x1f')][_0x547215['id']])){_0x579317[_0x8db2('0x1f')][_0x547215['id']]=new ZohoAccount(_0x547215);}else{_0x579317[_0x8db2('0x44')](_0x579317['zohoAccounts'][_0x547215['id']],_0x547215);}}}return _0x579317[_0x8db2('0x1f')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4e')]=function(){var _0x58bb60=this;return function(_0x1e7d1a){if(_0x1e7d1a){freeIsNotKey(_0x1e7d1a,_0x58bb60[_0x8db2('0x20')],'id');for(var _0x33dddd=0x0,_0x7b0de8={};_0x33dddd<_0x1e7d1a[_0x8db2('0x42')];_0x33dddd+=0x1){_0x7b0de8=_0x1e7d1a[_0x33dddd];if(_[_0x8db2('0x43')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']])){_0x58bb60['deskAccounts'][_0x7b0de8['id']]=new DeskAccount(_0x7b0de8);}else{_0x58bb60[_0x8db2('0x44')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']],_0x7b0de8);}}}return _0x58bb60['deskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4f')]=function(){var _0x533e41=this;return function(_0x107bbe){if(_0x107bbe){freeIsNotKey(_0x107bbe,_0x533e41[_0x8db2('0x1d')],'id');for(var _0x63e8f7=0x0,_0x30f4f3={};_0x63e8f7<_0x107bbe[_0x8db2('0x42')];_0x63e8f7+=0x1){_0x30f4f3=_0x107bbe[_0x63e8f7];if(_[_0x8db2('0x43')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']])){_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']]=new SugarcrmAccount(_0x30f4f3);}else{_0x533e41[_0x8db2('0x44')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']],_0x30f4f3);}}}return _0x533e41[_0x8db2('0x1d')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x50')]=function(){var _0x1ce89f=this;return function(_0x64ec90){if(_0x64ec90){freeIsNotKey(_0x64ec90,_0x1ce89f[_0x8db2('0x21')],'id');for(var _0x4a20a7=0x0,_0xe0c3e={};_0x4a20a7<_0x64ec90[_0x8db2('0x42')];_0x4a20a7+=0x1){_0xe0c3e=_0x64ec90[_0x4a20a7];if(_[_0x8db2('0x43')](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']])){_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']]=new VtigerAccount(_0xe0c3e);}else{_0x1ce89f['mergeFromDatabase'](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']],_0xe0c3e);}}}return _0x1ce89f[_0x8db2('0x21')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x51')]=function(){var _0x2ad70f=this;return function(_0x348da8){if(_0x348da8){freeIsNotKey(_0x348da8,_0x2ad70f[_0x8db2('0x22')],'id');for(var _0x2c7b04=0x0,_0x24cfe9={};_0x2c7b04<_0x348da8[_0x8db2('0x42')];_0x2c7b04+=0x1){_0x24cfe9=_0x348da8[_0x2c7b04];if(_[_0x8db2('0x43')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']])){_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']]=new ServicenowAccount(_0x24cfe9);}else{_0x2ad70f[_0x8db2('0x44')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']],_0x24cfe9);}}}return _0x2ad70f[_0x8db2('0x22')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x52')]=function(){var _0x5a719f=this;return function(_0x3273dd){if(_0x3273dd){freeIsNotKey(_0x3273dd,_0x5a719f['dynamics365Accounts'],'id');for(var _0x364176=0x0,_0x570c53={};_0x364176<_0x3273dd[_0x8db2('0x42')];_0x364176+=0x1){_0x570c53=_0x3273dd[_0x364176];if(_[_0x8db2('0x43')](_0x5a719f[_0x8db2('0x23')][_0x570c53['id']])){_0x5a719f[_0x8db2('0x23')][_0x570c53['id']]=new Dynamics365Account(_0x570c53);}else{_0x5a719f[_0x8db2('0x44')](_0x5a719f['dynamics365Accounts'][_0x570c53['id']],_0x570c53);}}}return _0x5a719f['dynamics365Accounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x53')]=function(){var _0x21ec87=this;return function(_0x3ba1d2){if(_0x3ba1d2){freeIsNotKey(_0x3ba1d2,_0x21ec87[_0x8db2('0x24')],'id');for(var _0x1f28d2=0x0,_0x3e3de3={};_0x1f28d2<_0x3ba1d2[_0x8db2('0x42')];_0x1f28d2+=0x1){_0x3e3de3=_0x3ba1d2[_0x1f28d2];if(_['isUndefined'](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']])){_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']]=new FreshsalesAccount(_0x3e3de3);}else{_0x21ec87[_0x8db2('0x44')](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']],_0x3e3de3);}}}return _0x21ec87[_0x8db2('0x24')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x54')]=function(){var _0x20caf0=this;return function(_0x4938bb){for(var _0x54318c=0x0;_0x54318c<_0x4938bb[_0x8db2('0x42')];_0x54318c+=0x1){_[_0x8db2('0x55')](_0x20caf0[_0x8db2('0x14')][_0x4938bb[_0x54318c][_0x8db2('0x2a')]],_0x4938bb[_0x54318c]);}return _0x20caf0[_0x8db2('0x14')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x3611da=this;return function(_0x364807){clearVoiceQueues(_0x3611da['voiceQueues']);if(_0x364807){_0x364807=_[_0x8db2('0x56')](_0x364807,_0x8db2('0x57'));for(var _0x1ab84c in _0x364807){if(_0x364807['hasOwnProperty'](_0x1ab84c)){for(var _0x26523b=0x0;_0x26523b<_0x364807[_0x1ab84c][_0x8db2('0x42')];_0x26523b+=0x1){var _0x2cf731=_0x364807[_0x1ab84c][_0x26523b]['queue'];if(_0x3611da[_0x8db2('0x14')][_0x2cf731]){if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x58')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x33')]+=0x1;}if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x59')]){_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x34')]+=0x1;}_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x35')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallerleaveAt'])['diff'](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;if(_0x26523b===_0x364807[_0x1ab84c]['length']-0x1){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5c')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5d')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5e')])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x31')]+=0x1;if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x60')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x32')]+=0x1;_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x2e')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallercompleteAt'])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x61')]),'seconds')||0x0;}}else{_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x35')]||0x0;}}}}}}return _0x3611da[_0x8db2('0x14')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x62')]=function(){var _0x242379=this;return function(_0x31a095){clearVoiceCallReports(_0x242379[_0x8db2('0x63')]);if(_0x31a095){for(var _0x3ac0fa=0x0;_0x3ac0fa<_0x31a095[_0x8db2('0x42')];_0x3ac0fa+=0x1){_0x242379['outbound']['total']+=0x1;_0x242379[_0x8db2('0x63')]['sumDuration']+=_0x31a095[_0x3ac0fa][_0x8db2('0x64')];if(_0x31a095[_0x3ac0fa][_0x8db2('0x65')]===_0x8db2('0x66')){_0x242379['outbound'][_0x8db2('0x32')]+=0x1;_0x242379[_0x8db2('0x63')][_0x8db2('0x35')]+=_0x31a095[_0x3ac0fa]['duration']-_0x31a095[_0x3ac0fa][_0x8db2('0x67')]||0x0;_0x242379[_0x8db2('0x63')][_0x8db2('0x2e')]+=_0x31a095[_0x3ac0fa][_0x8db2('0x67')];}}}return _0x242379['outbound'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x68')]=function(){var _0x299640=this;return function(_0x1edb1a){if(_0x1edb1a){freeIsNotKey(_0x1edb1a,_0x299640[_0x8db2('0x15')],_0x8db2('0x2a'));for(var _0x1aadfb=0x0,_0x3682bf={};_0x1aadfb<_0x1edb1a[_0x8db2('0x42')];_0x1aadfb+=0x1){_0x3682bf=_0x1edb1a[_0x1aadfb];if(_[_0x8db2('0x43')](_0x299640[_0x8db2('0x15')][_0x3682bf['name']])){_0x299640[_0x8db2('0x15')][_0x3682bf[_0x8db2('0x2a')]]=new Campaign(_0x3682bf);}else{_0x299640[_0x8db2('0x44')](_0x299640['campaigns'][_0x3682bf['name']],_0x3682bf);_0x299640['campaigns'][_0x3682bf[_0x8db2('0x2a')]][_0x8db2('0x69')]=_0x3682bf[_0x8db2('0x6a')]?_0x3682bf[_0x8db2('0x6a')][_0x8db2('0x2a')]:undefined;}}}return _0x299640[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6b')]=function(){var _0x3b1929=this;return function(_0x37cf6d){if(_0x37cf6d){freeIsNotKey(_0x37cf6d,_0x3b1929[_0x8db2('0x17')],'id');for(var _0x4d0ff6=0x0,_0x360a06={};_0x4d0ff6<_0x37cf6d[_0x8db2('0x42')];_0x4d0ff6+=0x1){_0x360a06=_0x37cf6d[_0x4d0ff6];if(_[_0x8db2('0x43')](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']])){_0x3b1929['voiceExtensions'][_0x360a06['id']]=new VoiceExtension(_0x360a06);}else{_0x3b1929['mergeFromDatabase'](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']],_0x360a06);}}}return _0x3b1929[_0x8db2('0x17')];};};Realtime['prototype'][_0x8db2('0x6c')]=function(){var _0x121f31=this;return function(_0x9132b4){clearCampaigns(_0x121f31['campaigns']);for(var _0x5dc46c=0x0;_0x5dc46c<_0x9132b4['length'];_0x5dc46c+=0x1){_[_0x8db2('0x55')](_0x121f31[_0x8db2('0x15')][_0x9132b4[_0x5dc46c][_0x8db2('0x2a')]],_0x9132b4[_0x5dc46c]);}return _0x121f31[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')]['initFaxAccounts']=function(){var _0x30930a=this;return function(_0x5e349c){if(_0x5e349c){freeIsNotKey(_0x5e349c,_0x30930a[_0x8db2('0x25')],'id');for(var _0x353101=0x0,_0xa083b1={};_0x353101<_0x5e349c[_0x8db2('0x42')];_0x353101+=0x1){_0xa083b1=_0x5e349c[_0x353101];if(_[_0x8db2('0x43')](_0x30930a['faxAccounts'][_0xa083b1['id']])){_0x30930a['faxAccounts'][_0xa083b1['id']]=new FaxAccount(_0xa083b1);}else{_0x30930a[_0x8db2('0x44')](_0x30930a['faxAccounts'][_0xa083b1['id']],_0xa083b1);}}}return _0x30930a[_0x8db2('0x25')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6d')]=function(){var _0x1e7bc2=this;return function(_0x2b7224){if(_0x2b7224){freeIsNotKey(_0x2b7224,_0x1e7bc2[_0x8db2('0x14')],'name');for(var _0x19f9a0=0x0,_0x222ea2={};_0x19f9a0<_0x2b7224[_0x8db2('0x42')];_0x19f9a0+=0x1){_0x222ea2=_0x2b7224[_0x19f9a0];if(_['isUndefined'](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]])){_0x1e7bc2['voiceQueues'][_0x222ea2[_0x8db2('0x2a')]]=new VoiceQueue(_0x222ea2);}else{_0x1e7bc2[_0x8db2('0x44')](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]],_0x222ea2);}}}return _0x1e7bc2[_0x8db2('0x14')];};};module[_0x8db2('0x6e')]=Realtime; \ No newline at end of file +var _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(_0x550832,_0xc90caa){var _0x216d51=function(_0x52e7f6){while(--_0x52e7f6){_0x550832['push'](_0x550832['shift']());}};_0x216d51(++_0xc90caa);}(_0xadb5,0xad));var _0x5adb=function(_0x59571a,_0xb390dd){_0x59571a=_0x59571a-0x0;var _0x2e014a=_0xadb5[_0x59571a];return _0x2e014a;};'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 diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 0135e91..e710f26 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 _0x7628=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0x18cbf6,_0x474e1e){var _0x1183fa=function(_0x2a02ab){while(--_0x2a02ab){_0x18cbf6['push'](_0x18cbf6['shift']());}};_0x1183fa(++_0x474e1e);}(_0x7628,0xd6));var _0x8762=function(_0xeec92d,_0xb36d87){_0xeec92d=_0xeec92d-0x0;var _0x3f4059=_0x7628[_0xeec92d];return _0x3f4059;};'use strict';function mergeDBDataToRealtime(_0x51a3d4,_0x2a2d69){var _0xc5853c=Object[_0x8762('0x0')]({},_0x51a3d4);for(var _0x494ccb in _0x2a2d69){if(_0xc5853c[_0x8762('0x1')](_0x494ccb)){_0xc5853c[_0x494ccb]=_0x2a2d69[_0x494ccb];}}return _0xc5853c;}exports[_0x8762('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x1c50=['assign','hasOwnProperty','mergeDBDataToRealtime'];(function(_0x33dde2,_0x4b214a){var _0x5d55ef=function(_0x10268b){while(--_0x10268b){_0x33dde2['push'](_0x33dde2['shift']());}};_0x5d55ef(++_0x4b214a);}(_0x1c50,0xf3));var _0x01c5=function(_0x2622d2,_0xaf12f9){_0x2622d2=_0x2622d2-0x0;var _0x52ddb9=_0x1c50[_0x2622d2];return _0x52ddb9;};'use strict';function mergeDBDataToRealtime(_0x1dc234,_0x3b152f){var _0x22f001=Object[_0x01c5('0x0')]({},_0x1dc234);for(var _0x51c2f2 in _0x3b152f){if(_0x22f001[_0x01c5('0x1')](_0x51c2f2)){_0x22f001[_0x51c2f2]=_0x3b152f[_0x51c2f2];}}return _0x22f001;}exports[_0x01c5('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 063a565..d18076b 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 _0x22c9=['name','isNil','find','interface','format','prototype','connectedlinenum','lastAssignedTo','SIP/%s','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','voiceQueueReport','match','keys','length','channel','split','getAgentByInternal','calleridnum','outbound','internal','voiceCallReport','destination','exten','type','dialer','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','ANSWERED','\x22%s\x22\x20<%s>','calleridname','linkedid','transfers','transfereelinkedid','uniqueid','getCallType','UserId','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','membername','xcally-motion-dialer','forEach','create','voiceDialReport','startsWith','indexOf','mobile','phone','substring','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../rpc/voiceCallReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./userReport','realtime','agents','telephones','sync','xdr','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','accountcode'];(function(_0x46a1a0,_0x13e5a6){var _0x1a5c65=function(_0x3e11b8){while(--_0x3e11b8){_0x46a1a0['push'](_0x46a1a0['shift']());}};_0x1a5c65(++_0x13e5a6);}(_0x22c9,0x153));var _0x922c=function(_0x3a91dc,_0x2bff89){_0x3a91dc=_0x3a91dc-0x0;var _0x7afc54=_0x22c9[_0x3a91dc];return _0x7afc54;};'use strict';var _=require(_0x922c('0x0'));var moment=require(_0x922c('0x1'));var util=require(_0x922c('0x2'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x922c('0x3'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x922c('0x4'));var RpcVoiceRecording=require(_0x922c('0x5'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x922c('0x6'));var VoiceCallReport=require(_0x922c('0x7'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x922c('0x8'));function Report(_0x355f30){this[_0x922c('0x9')]=_0x355f30;this[_0x922c('0xa')]=_0x355f30[_0x922c('0xa')];this[_0x922c('0xb')]=_0x355f30[_0x922c('0xb')];}Report['prototype'][_0x922c('0xc')]=function(_0x55c820){var _0x2e93a2=new VoiceQueueReport(this[_0x922c('0x9')]);var _0x34a830=new VoiceAgentReport(this[_0x922c('0x9')]);var _0x35c5eb=new VoiceDialReport(this[_0x922c('0x9')]);var _0x2908ca=new VoiceCallReport(this[_0x922c('0x9')]);var _0x261d26=new UserReport(this[_0x922c('0x9')]);if(config[_0x922c('0xd')]&&config[_0x922c('0xd')]['disabled']){ami['on']('custom:voiceQueueReport',this['voiceQueueReport'][_0x922c('0xe')](this));ami['on'](_0x922c('0xf'),this['voiceCallReport']['bind'](this));ami['on'](_0x922c('0x10'),this[_0x922c('0x11')]['bind'](this));ami['on'](_0x922c('0x12'),this['voiceDialReport'][_0x922c('0xe')](this));ami['on'](_0x922c('0x13'),this[_0x922c('0x14')][_0x922c('0xe')](this));ami['on'](_0x922c('0x15'),this[_0x922c('0x16')][_0x922c('0xe')](this));}};Report['prototype'][_0x922c('0x17')]=function(_0x3064a2){var _0x1bde45;_0x1bde45=_['find'](this[_0x922c('0xa')],function(_0x22e66f){return _0x22e66f[_0x922c('0x18')]==_0x3064a2||_0x22e66f[_0x922c('0x19')]==_0x3064a2;});if(_[_0x922c('0x1a')](_0x1bde45)){var _0xa5337c=_[_0x922c('0x1b')](this[_0x922c('0xb')],function(_0x35b2b2){return _0x35b2b2[_0x922c('0x18')]==_0x3064a2||_0x35b2b2['name']==_0x3064a2;});if(_0xa5337c){_0x1bde45=_['find'](this[_0x922c('0xa')],function(_0x120da2){return _0x120da2[_0x922c('0x1c')]==util[_0x922c('0x1d')]('SIP/%s',_0xa5337c[_0x922c('0x19')]);});}}return _0x1bde45;};Report[_0x922c('0x1e')]['voiceQueueReport']=function(_0x286ced){for(var _0x48435f=0x0;_0x48435f<_0x286ced['length'];_0x48435f+=0x1){var _0x2326b2=this[_0x922c('0x17')](_0x286ced[_0x48435f][_0x922c('0x1f')]);if(_0x2326b2){_0x286ced[_0x48435f][_0x922c('0x18')]=_0x2326b2['accountcode'];_0x286ced[_0x48435f]['assigned']=!![];_0x286ced[_0x48435f][_0x922c('0x20')]=_0x2326b2['name'];_0x286ced[_0x48435f][_0x922c('0x1c')]=_[_0x922c('0x1a')](_0x2326b2[_0x922c('0x1c')])?util[_0x922c('0x1d')](_0x922c('0x21'),_0x2326b2[_0x922c('0x19')]):_0x2326b2[_0x922c('0x1c')];if(_0x286ced[_0x48435f][_0x922c('0x22')]){_0x286ced[_0x48435f]['queuecallercompleteAt']=moment()[_0x922c('0x1d')](_0x922c('0x23'));}if(_0x286ced[_0x48435f][_0x922c('0x24')]){_0x286ced[_0x48435f][_0x922c('0x25')]=moment()[_0x922c('0x1d')](_0x922c('0x23'));}RpcMemberReport[_0x922c('0x26')](_0x286ced[_0x48435f]);}RpcVoiceQueueReport['create'](_0x286ced[_0x48435f]);}};function extractCalleridNumber(_0x260049){var _0x1aa578=_0x260049[_0x922c('0x27')](/<(.*?)>/);return _0x1aa578?_0x1aa578[0x1]:_0x260049;}Report[_0x922c('0x1e')]['getAgentByInternal']=function(_0x2ef795){for(var _0x1b91a8=0x0;_0x1b91a8','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','UserId'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xc8fb,0xc0));var _0xbc8f=function(_0x1ec3e3,_0x1b1301){_0x1ec3e3=_0x1ec3e3-0x0;var _0x45178d=_0xc8fb[_0x1ec3e3];return _0x45178d;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xbc8f('0x0'));var config=require(_0xbc8f('0x1'));var ami=require(_0xbc8f('0x2'));var RpcVoiceAgentReport=require(_0xbc8f('0x3'));var RpcVoiceCallReport=require(_0xbc8f('0x4'));var RpcVoiceDialReport=require(_0xbc8f('0x5'));var RpcMemberReport=require(_0xbc8f('0x6'));var RpcVoiceQueueReport=require(_0xbc8f('0x7'));var RpcVoiceRecording=require(_0xbc8f('0x8'));var RpcVoiceTransferReport=require(_0xbc8f('0x9'));var VoiceQueueReport=require(_0xbc8f('0xa'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xbc8f('0xb'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require('./userReport');function Report(_0x3a85b5){this[_0xbc8f('0xc')]=_0x3a85b5;this[_0xbc8f('0xd')]=_0x3a85b5['agents'];this[_0xbc8f('0xe')]=_0x3a85b5['telephones'];}Report[_0xbc8f('0xf')][_0xbc8f('0x10')]=function(_0x19eeed){var _0x5087a6=new VoiceQueueReport(this[_0xbc8f('0xc')]);var _0x21a20b=new VoiceAgentReport(this[_0xbc8f('0xc')]);var _0x5eee8b=new VoiceDialReport(this[_0xbc8f('0xc')]);var _0x2ba14a=new VoiceCallReport(this['realtime']);var _0x50bd53=new UserReport(this['realtime']);if(config[_0xbc8f('0x11')]&&config[_0xbc8f('0x11')][_0xbc8f('0x12')]){ami['on'](_0xbc8f('0x13'),this[_0xbc8f('0x14')][_0xbc8f('0x15')](this));ami['on']('custom:voiceCallReport',this[_0xbc8f('0x16')][_0xbc8f('0x15')](this));ami['on'](_0xbc8f('0x17'),this[_0xbc8f('0x18')][_0xbc8f('0x15')](this));ami['on']('custom:voiceDialReport',this[_0xbc8f('0x19')][_0xbc8f('0x15')](this));ami['on'](_0xbc8f('0x1a'),this[_0xbc8f('0x1b')][_0xbc8f('0x15')](this));ami['on'](_0xbc8f('0x1c'),this[_0xbc8f('0x1d')][_0xbc8f('0x15')](this));}};Report[_0xbc8f('0xf')][_0xbc8f('0x1e')]=function(_0x1de202){var _0x381771;_0x381771=_[_0xbc8f('0x1f')](this[_0xbc8f('0xd')],function(_0x5ed0e6){return _0x5ed0e6[_0xbc8f('0x20')]==_0x1de202||_0x5ed0e6['name']==_0x1de202;});if(_[_0xbc8f('0x21')](_0x381771)){var _0x51eebf=_[_0xbc8f('0x1f')](this[_0xbc8f('0xe')],function(_0x2f05af){return _0x2f05af[_0xbc8f('0x20')]==_0x1de202||_0x2f05af[_0xbc8f('0x22')]==_0x1de202;});if(_0x51eebf){_0x381771=_['find'](this['agents'],function(_0x38a574){return _0x38a574[_0xbc8f('0x23')]==util['format'](_0xbc8f('0x24'),_0x51eebf[_0xbc8f('0x22')]);});}}return _0x381771;};Report[_0xbc8f('0xf')][_0xbc8f('0x14')]=function(_0x4861bf){for(var _0x5a0352=0x0;_0x5a0352<_0x4861bf[_0xbc8f('0x25')];_0x5a0352+=0x1){var _0x33f180=this[_0xbc8f('0x1e')](_0x4861bf[_0x5a0352][_0xbc8f('0x26')]);if(_0x33f180){_0x4861bf[_0x5a0352][_0xbc8f('0x20')]=_0x33f180[_0xbc8f('0x20')];_0x4861bf[_0x5a0352][_0xbc8f('0x27')]=!![];_0x4861bf[_0x5a0352][_0xbc8f('0x28')]=_0x33f180['name'];_0x4861bf[_0x5a0352][_0xbc8f('0x23')]=_[_0xbc8f('0x21')](_0x33f180[_0xbc8f('0x23')])?util[_0xbc8f('0x29')](_0xbc8f('0x24'),_0x33f180['name']):_0x33f180[_0xbc8f('0x23')];if(_0x4861bf[_0x5a0352][_0xbc8f('0x2a')]){_0x4861bf[_0x5a0352][_0xbc8f('0x2b')]=moment()[_0xbc8f('0x29')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x4861bf[_0x5a0352][_0xbc8f('0x2c')]){_0x4861bf[_0x5a0352][_0xbc8f('0x2d')]=moment()[_0xbc8f('0x29')](_0xbc8f('0x2e'));}RpcMemberReport[_0xbc8f('0x14')](_0x4861bf[_0x5a0352]);}RpcVoiceQueueReport[_0xbc8f('0x2f')](_0x4861bf[_0x5a0352]);}};function extractCalleridNumber(_0x284bb5){var _0x1514e0=_0x284bb5[_0xbc8f('0x30')](/<(.*?)>/);return _0x1514e0?_0x1514e0[0x1]:_0x284bb5;}Report[_0xbc8f('0xf')]['getAgentByInternal']=function(_0x5ab4c5){for(var _0x10b6aa=0x0;_0x10b6aa0x0?!![]:![];if(!_0x2d6d60){return this[_0x0061('0x19')](this[_0x0061('0x15')][_0x0061('0x6f')]);}};VoiceQueueReport[_0x0061('0x3a')][_0x0061('0x1b')]=function(_0x5ed8c5){var _0x2d9c77=this[_0x0061('0x15')]['id'];if(this[_0x0061('0x15')][_0x0061('0x63')][_0x2d9c77]&&this[_0x0061('0x15')][_0x0061('0x63')][_0x2d9c77][_0x5ed8c5[_0x0061('0x62')]]){this[_0x0061('0x15')][_0x0061('0x63')][_0x2d9c77][_0x5ed8c5[_0x0061('0x62')]][_0x0061('0x11')][_0x0061('0x70')](_0x5ed8c5);}};VoiceQueueReport[_0x0061('0x3a')][_0x0061('0x17')]=function(_0x171e27){var _0xc7043a=this;try{if(this[_0x0061('0x71')](_0x171e27)&&this['isNotNull'](_0x171e27[_0x0061('0x58')])){logger[_0x0061('0x53')](_0x0061('0x72'),util[_0x0061('0x45')](_0x171e27,{'showHidden':![],'depth':null}));var _0x5d8980=this[_0x0061('0x49')][_0x171e27['queue']];if(_0x5d8980){logger[_0x0061('0x73')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x5d8980[_0x0061('0x5d')]);this[_0x0061('0x15')][_0x0061('0x65')][_0x5d8980['name']]={'summaryEvent':_0x171e27};this[_0x0061('0x15')][_0x0061('0x6e')]+=0x1;return ami[_0x0061('0x3e')]({'action':_0x0061('0x63'),'queue':_0x5d8980[_0x0061('0x5d')]})[_0x0061('0x74')](function(_0x5ccd95){if(!_0xc7043a[_0x0061('0x15')][_0x0061('0x63')][_0x171e27['actionid']]){_0xc7043a[_0x0061('0x15')][_0x0061('0x63')][_0x171e27['actionid']]={};}_0xc7043a[_0x0061('0x15')][_0x0061('0x63')][_0x171e27['actionid']][_0x5ccd95['actionid']]={'queue':_0x5d8980['name'],'agents':[]};})[_0x0061('0x41')](function(_0x475f8b){throw _0x475f8b;});}}}catch(_0x44cdce){logger[_0x0061('0x44')](_0x0061('0x64'),util['inspect'](_0x44cdce,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0061('0x3a')][_0x0061('0x19')]=function(_0x3c0f9b){if(this['summary'][_0x0061('0x6e')]>0x0){this[_0x0061('0x15')][_0x0061('0x6f')]=_0x3c0f9b;return;}logger[_0x0061('0x53')](_0x0061('0x75'),util['inspect'](_0x3c0f9b,{'showHidden':![],'depth':null}));this[_0x0061('0x15')]=initializeSummary();ami['emit']('custom:queuesummarycomplete',{});};VoiceQueueReport[_0x0061('0x3a')][_0x0061('0x1f')]=function(_0x15c7da){try{if(this[_0x0061('0x71')](_0x15c7da)){logger[_0x0061('0x53')](_0x0061('0x76'),_0x15c7da['uniqueid'],util['inspect'](_0x15c7da,{'showHidden':![],'depth':null}));if(_[_0x0061('0x5f')](this[_0x0061('0xf')][_0x15c7da['uniqueid']])){this[_0x0061('0xf')][_0x15c7da['uniqueid']]=[];}if(_['isUndefined'](this[_0x0061('0x12')][_0x15c7da['uniqueid']])){this[_0x0061('0x12')][_0x15c7da[_0x0061('0x77')]]={};}var _0x1fff5f=new QueueReport();_0x1fff5f[_0x0061('0x58')]=_0x15c7da[_0x0061('0x58')];_0x1fff5f[_0x0061('0x5b')]=this['voiceQueues'][_0x1fff5f['queue']]&&this[_0x0061('0x49')][_0x1fff5f[_0x0061('0x58')]][_0x0061('0x5b')]?this['voiceQueues'][_0x1fff5f[_0x0061('0x58')]][_0x0061('0x5b')]||'inbound':_0x0061('0x6b');_0x1fff5f['queuecallerjoinAt']=moment()['format'](_0x0061('0x78'));_0x1fff5f[_0x0061('0x79')]=_0x15c7da[_0x0061('0x79')];_0x1fff5f['count']=_0x15c7da[_0x0061('0x7a')];_0x1fff5f[_0x0061('0x77')]=_0x15c7da[_0x0061('0x77')];_0x1fff5f[_0x0061('0x7b')]=this[_0x0061('0x12')][_0x15c7da[_0x0061('0x77')]][_0x0061('0x7b')];logger[_0x0061('0x73')](_0x0061('0x7c'),_0x1fff5f[_0x0061('0x58')],_0x1fff5f[_0x0061('0x5b')]);_[_0x0061('0x7d')](_0x1fff5f,_[_0x0061('0x7e')](_0x15c7da,_[_0x0061('0x7f')](_0x1fff5f)));this[_0x0061('0xf')][_0x15c7da[_0x0061('0x77')]]['push'](_0x1fff5f);this[_0x0061('0x12')][_0x15c7da[_0x0061('0x77')]]=_0x1fff5f;this[_0x0061('0x4c')](_0x1fff5f,_0x0061('0x1e'));}}catch(_0x16335c){logger[_0x0061('0x44')](_0x0061('0x76'),_0x15c7da['uniqueid'],util[_0x0061('0x45')](_0x16335c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0061('0x3a')][_0x0061('0x80')]=function(_0x2581c4){try{if(this[_0x0061('0x71')](_0x2581c4)){logger[_0x0061('0x53')]('[%s][voiceQueueReport][queuecallerabandon]',_0x2581c4[_0x0061('0x77')],util[_0x0061('0x45')](_0x2581c4,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x2581c4[_0x0061('0x77')]]){var _0xe032e4=_[_0x0061('0x81')](this['queueReports'][_0x2581c4[_0x0061('0x77')]]);_0xe032e4[_0x0061('0x82')]=![];_0xe032e4[_0x0061('0x83')]=null;_0xe032e4['holdtime']=_0x2581c4[_0x0061('0x84')];_0xe032e4[_0x0061('0x85')]=_0x2581c4[_0x0061('0x85')];_0xe032e4[_0x0061('0x86')]=!![];_0xe032e4['queuecallerabandonAt']=moment()[_0x0061('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0xe032e4['queuecallerexitreason']=_0x0061('0x87');_0xe032e4[_0x0061('0x88')]=null;logger['info'](_0x0061('0x89'),_0xe032e4[_0x0061('0x58')],_0xe032e4[_0x0061('0x5b')]);this['channels'][_0x2581c4[_0x0061('0x77')]]=_0xe032e4;this[_0x0061('0x4a')](_0xe032e4,_0x0061('0x86'));}}}catch(_0x3ea01b){logger[_0x0061('0x44')]('[%s][voiceQueueReport][queuecallerabandon]',_0x2581c4[_0x0061('0x77')],util[_0x0061('0x45')](_0x3ea01b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0061('0x3a')][_0x0061('0x21')]=function(_0x1331eb){try{if(this['isNotNull'](_0x1331eb)){logger['debug'](_0x0061('0x8a'),_0x1331eb['uniqueid'],util[_0x0061('0x45')](_0x1331eb,{'showHidden':![],'depth':null}));if(this[_0x0061('0xf')][_0x1331eb[_0x0061('0x77')]]){var _0x3995e4=_[_0x0061('0x81')](this['queueReports'][_0x1331eb['uniqueid']]);_0x3995e4[_0x0061('0x8b')]=moment()['format'](_0x0061('0x78'));_0x3995e4['connectedlinenum']=_0x1331eb['connectedlinenum'];_0x3995e4['connectedlinename']=_0x1331eb['connectedlinename'];logger['info'](_0x0061('0x8c'),_0x3995e4['queue'],_0x3995e4[_0x0061('0x5b')],_0x1331eb['connectedlinenum'],_0x1331eb[_0x0061('0x8d')]);this['channels'][_0x1331eb[_0x0061('0x77')]]=_0x3995e4;this[_0x0061('0x4c')](_0x3995e4,_0x0061('0x20'));}}}catch(_0x542cf5){logger[_0x0061('0x44')](_0x0061('0x8a'),_0x1331eb[_0x0061('0x77')],util[_0x0061('0x45')](_0x542cf5,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0061('0x8e')]=function(_0x2ac186){try{if(this[_0x0061('0x71')](_0x2ac186)){logger['debug']('[%s][voiceQueueReport][agentconnect]',_0x2ac186[_0x0061('0x77')],util['inspect'](_0x2ac186,{'showHidden':![],'depth':null}));if(this[_0x0061('0xf')][_0x2ac186[_0x0061('0x77')]]){var _0x5042b1=_['last'](this[_0x0061('0xf')][_0x2ac186[_0x0061('0x77')]]);_0x5042b1[_0x0061('0x82')]=!![];_0x5042b1['queuecallerexitreason']=_0x0061('0x8f');logger[_0x0061('0x73')](_0x0061('0x90'),_0x5042b1[_0x0061('0x58')],_0x5042b1['type']);}}}catch(_0x1af8ee){logger[_0x0061('0x44')](_0x0061('0x91'),_0x2ac186[_0x0061('0x77')],util[_0x0061('0x45')](_0x1af8ee,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0061('0x3a')][_0x0061('0x23')]=function(_0x419481){try{if(this['isNotNull'](_0x419481)){logger['debug'](_0x0061('0x92'),_0x419481[_0x0061('0x77')],util[_0x0061('0x45')](_0x419481,{'showHidden':![],'depth':null}));if(this[_0x0061('0xf')][_0x419481[_0x0061('0x77')]]){var _0x5d99f2=_[_0x0061('0x81')](this[_0x0061('0xf')][_0x419481[_0x0061('0x77')]]);_0x5d99f2[_0x0061('0x86')]=![];_0x5d99f2[_0x0061('0x93')]=null;_0x5d99f2[_0x0061('0x94')]=!![];_0x5d99f2[_0x0061('0x88')]=_0x419481[_0x0061('0x95')];_0x5d99f2[_0x0061('0x84')]=_0x419481['holdtime'];_0x5d99f2[_0x0061('0x82')]=!![];_0x5d99f2[_0x0061('0x96')]=![];_0x5d99f2[_0x0061('0x97')]=null;if(!_0x5d99f2[_0x0061('0x98')]){if(_0x419481[_0x0061('0x99')]==_0x0061('0x98')){_0x5d99f2[_0x0061('0x55')]=_0x0061('0x9a');logger[_0x0061('0x73')](_0x0061('0x9b'),_0x5d99f2[_0x0061('0x58')],_0x5d99f2[_0x0061('0x5b')]);}else{if(_[_0x0061('0x9c')](_0x419481[_0x0061('0x40')]['toLowerCase'](),_0x0061('0x9d'))){if(this[_0x0061('0xf')][_0x419481[_0x0061('0x9e')]]){var _0x40d603=_[_0x0061('0x81')](this[_0x0061('0xf')][_0x419481['linkedid']]);_0x40d603[_0x0061('0x82')]=![];_0x40d603[_0x0061('0x96')]=!![];_0x40d603[_0x0061('0x97')]=moment(_0x5d99f2['queuecallerjoinAt'])['add'](_0x419481[_0x0061('0x84')],'seconds')[_0x0061('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x40d603[_0x0061('0x55')]=_0x0061('0x9f');_0x40d603[_0x0061('0x98')]=!![];_0x40d603[_0x0061('0xa0')]=_0x0061('0xa1');_0x40d603['transferexten']=_0x419481[_0x0061('0xa2')];_0x40d603['transferuniqueid']=_0x419481[_0x0061('0x77')];logger['info'](_0x0061('0xa3'),_0x40d603[_0x0061('0x58')],_0x40d603[_0x0061('0x5b')]);var _0xf51219=this[_0x0061('0xf')][_0x419481[_0x0061('0x9e')]];this[_0x0061('0xf')][_0x419481['linkedid']]=this[_0x0061('0xf')][_0x419481['uniqueid']];this['queueReports'][_0x419481['uniqueid']]=_0xf51219;}}else{_0x5d99f2['queuecallerexitreason']='COMPLETEDBY'+_0x419481[_0x0061('0x99')][_0x0061('0xa4')]();logger[_0x0061('0x73')](_0x0061('0xa5'),_0x5d99f2[_0x0061('0x58')],_0x5d99f2['type'],_0x5d99f2['queuecallerexitreason']);}}}this[_0x0061('0x12')][_0x419481[_0x0061('0x77')]]=_0x5d99f2;this[_0x0061('0x4a')](_0x5d99f2,_0x0061('0x22'));}}}catch(_0x307bc5){logger[_0x0061('0x44')]('[%s][voiceQueueReport][agentcomplete]',_0x419481[_0x0061('0x77')],util[_0x0061('0x45')](_0x307bc5,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0061('0xa6')]=function(_0x3ef2e5){try{if(this[_0x0061('0x71')](_0x3ef2e5)){logger[_0x0061('0x53')]('[%s][voiceQueueReport][varset]',_0x3ef2e5[_0x0061('0x77')],util[_0x0061('0x45')](_0x3ef2e5,{'showHidden':![],'depth':null}));this[_0x0061('0xa7')](_0x3ef2e5[_0x0061('0x77')],_[_0x0061('0x7f')](_0x3ef2e5['variable'])[0x0],_0x3ef2e5[_0x0061('0xa8')]);if(this[_0x0061('0xf')][_0x3ef2e5[_0x0061('0x77')]]){var _0x34a9f3=_['last'](this[_0x0061('0xf')][_0x3ef2e5[_0x0061('0x77')]]);if(_0x34a9f3){if(this[_0x0061('0x71')](_0x3ef2e5['variable'])&&this[_0x0061('0x71')](_0x3ef2e5['variable'][_0x0061('0x63')])){switch(_0x3ef2e5[_0x0061('0xa8')]){case _0x0061('0xa9'):_0x34a9f3['queuecallerexit']=![];_0x34a9f3[_0x0061('0x97')]=null;break;case _0x0061('0xaa'):_0x34a9f3['lastevent']=_0x0061('0xab');_0x34a9f3['queuecallerexit']=!![];_0x34a9f3[_0x0061('0x97')]=moment()[_0x0061('0x57')](_0x0061('0x78'));_0x34a9f3[_0x0061('0x8b')]=moment()[_0x0061('0x57')](_0x0061('0x78'));logger[_0x0061('0x53')](_0x0061('0xac'),_0x3ef2e5[_0x0061('0x77')],util[_0x0061('0x45')](_0x34a9f3,{'showHidden':![],'depth':null}));ami['emit'](_0x0061('0xad'),_0x34a9f3);break;default:_0x34a9f3[_0x0061('0x96')]=!![];_0x34a9f3[_0x0061('0x97')]=moment()['format'](_0x0061('0x78'));_0x34a9f3[_0x0061('0x8b')]=moment()['format'](_0x0061('0x78'));}_0x34a9f3[_0x0061('0x86')]=![];_0x34a9f3['queuecallerabandonAt']=null;_0x34a9f3[_0x0061('0x55')]=_0x3ef2e5['value'];this[_0x0061('0x12')][_0x3ef2e5['uniqueid']]=_0x34a9f3;this[_0x0061('0x4a')](_0x34a9f3,_0x0061('0x25'));}else if(this[_0x0061('0x71')](_0x3ef2e5[_0x0061('0xae')])&&this[_0x0061('0x71')](_0x3ef2e5[_0x0061('0xae')][_0x0061('0xaf')])){if(!_0x34a9f3[_0x0061('0x86')]){_0x34a9f3[_0x0061('0x96')]=!![];_0x34a9f3[_0x0061('0x97')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x34a9f3[_0x0061('0x55')]=_0x0061('0xb0');_0x34a9f3[_0x0061('0x8b')]=moment()[_0x0061('0x57')](_0x0061('0x78'));this[_0x0061('0x12')][_0x3ef2e5[_0x0061('0x77')]]=_0x34a9f3;}}logger[_0x0061('0x73')](_0x0061('0xb1'),_0x3ef2e5[_0x0061('0x77')],_0x34a9f3[_0x0061('0x58')],_0x34a9f3['type'],_['keys'](_0x3ef2e5[_0x0061('0xae')])[0x0],_0x3ef2e5[_0x0061('0xa8')]);_0x34a9f3[_0x0061('0x16')]=this[_0x0061('0x16')][_0x3ef2e5[_0x0061('0x77')]];}}}}catch(_0x1bc586){logger['error'](_0x0061('0xb2'),_0x3ef2e5['uniqueid'],util[_0x0061('0x45')](_0x1bc586,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0061('0x3a')][_0x0061('0xa7')]=function(_0x26bc29,_0x57bffc,_0x27f0d3){var _0x15079e=[_0x0061('0xb3'),_0x0061('0xb4'),_0x0061('0xb5'),_0x0061('0xb6'),'rtpaudioqosloss',_0x0061('0xb7'),_0x0061('0xb8'),'rtpaudioqosrttbridged','sipcallid',_0x0061('0xb9'),'bridgepeer',_0x0061('0xba'),_0x0061('0xbb'),_0x0061('0xbc'),_0x0061('0xbd'),_0x0061('0xbe'),_0x0061('0x95'),_0x0061('0xbf'),_0x0061('0xc0')];if(!_[_0x0061('0x3d')](_0x57bffc)&&!_[_0x0061('0xc1')](_0x15079e,_0x57bffc)){if(_[_0x0061('0x5f')](this[_0x0061('0x16')][_0x26bc29])){this[_0x0061('0x16')][_0x26bc29]={};}this['variables'][_0x26bc29][_0x57bffc]=_0x27f0d3;}};VoiceQueueReport[_0x0061('0x3a')][_0x0061('0xc2')]=function(_0x27e039,_0x349a5b,_0x2e4335){var _0x2250ec={};for(var _0x62c64c=0x0;_0x62c64c0x0?!![]:![];if(!_0x553576){return this['syncQueueSummaryComplete'](this[_0xeb9a('0x13')][_0xeb9a('0x6f')]);}};VoiceQueueReport[_0xeb9a('0x37')][_0xeb9a('0x70')]=function(_0x38a168){var _0x327687=this[_0xeb9a('0x13')]['id'];if(this['summary'][_0xeb9a('0x65')][_0x327687]&&this[_0xeb9a('0x13')][_0xeb9a('0x65')][_0x327687][_0x38a168[_0xeb9a('0x66')]]){this['summary']['queuestatus'][_0x327687][_0x38a168[_0xeb9a('0x66')]][_0xeb9a('0xe')][_0xeb9a('0x71')](_0x38a168);}};VoiceQueueReport[_0xeb9a('0x37')][_0xeb9a('0x16')]=function(_0x3e49e9){var _0x5aa1d7=this;try{if(this['isNotNull'](_0x3e49e9)&&this[_0xeb9a('0x5e')](_0x3e49e9['queue'])){logger[_0xeb9a('0x4b')](_0xeb9a('0x72'),util[_0xeb9a('0x45')](_0x3e49e9,{'showHidden':![],'depth':null}));var _0x23115d=this[_0xeb9a('0x11')][_0x3e49e9['queue']];if(_0x23115d){logger[_0xeb9a('0x73')](_0xeb9a('0x74'),_0x23115d['name']);this['summary']['queues'][_0x23115d[_0xeb9a('0x5c')]]={'summaryEvent':_0x3e49e9};this[_0xeb9a('0x13')][_0xeb9a('0x6e')]+=0x1;return ami[_0xeb9a('0x3c')]({'action':_0xeb9a('0x65'),'queue':_0x23115d['name']})[_0xeb9a('0x64')](function(_0x57c2da){if(!_0x5aa1d7[_0xeb9a('0x13')][_0xeb9a('0x65')][_0x3e49e9[_0xeb9a('0x66')]]){_0x5aa1d7['summary'][_0xeb9a('0x65')][_0x3e49e9['actionid']]={};}_0x5aa1d7['summary'][_0xeb9a('0x65')][_0x3e49e9[_0xeb9a('0x66')]][_0x57c2da[_0xeb9a('0x66')]]={'queue':_0x23115d[_0xeb9a('0x5c')],'agents':[]};})[_0xeb9a('0x61')](function(_0x5a8ca7){throw _0x5a8ca7;});}}}catch(_0x50451f){logger[_0xeb9a('0x41')](_0xeb9a('0x67'),util['inspect'](_0x50451f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xeb9a('0x37')]['syncQueueSummaryComplete']=function(_0x376bd7){if(this[_0xeb9a('0x13')][_0xeb9a('0x6e')]>0x0){this[_0xeb9a('0x13')][_0xeb9a('0x6f')]=_0x376bd7;return;}logger[_0xeb9a('0x4b')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0xeb9a('0x45')](_0x376bd7,{'showHidden':![],'depth':null}));this[_0xeb9a('0x13')]=initializeSummary();ami[_0xeb9a('0x49')](_0xeb9a('0x75'),{});};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x561789){try{if(this[_0xeb9a('0x5e')](_0x561789)){logger[_0xeb9a('0x4b')](_0xeb9a('0x76'),_0x561789[_0xeb9a('0x4e')],util[_0xeb9a('0x45')](_0x561789,{'showHidden':![],'depth':null}));if(_[_0xeb9a('0x5f')](this[_0xeb9a('0xc')][_0x561789[_0xeb9a('0x4e')]])){this[_0xeb9a('0xc')][_0x561789[_0xeb9a('0x4e')]]=[];}if(_[_0xeb9a('0x5f')](this[_0xeb9a('0xf')][_0x561789['uniqueid']])){this[_0xeb9a('0xf')][_0x561789['uniqueid']]={};}var _0x53ae42=new QueueReport();_0x53ae42[_0xeb9a('0x4f')]=_0x561789['queue'];_0x53ae42['type']=this[_0xeb9a('0x11')][_0x53ae42[_0xeb9a('0x4f')]]&&this['voiceQueues'][_0x53ae42[_0xeb9a('0x4f')]][_0xeb9a('0x59')]?this['voiceQueues'][_0x53ae42[_0xeb9a('0x4f')]][_0xeb9a('0x59')]||_0xeb9a('0x5a'):_0xeb9a('0x5a');_0x53ae42[_0xeb9a('0x77')]=moment()[_0xeb9a('0x54')](_0xeb9a('0x78'));_0x53ae42[_0xeb9a('0x79')]=_0x561789[_0xeb9a('0x79')];_0x53ae42[_0xeb9a('0x7a')]=_0x561789[_0xeb9a('0x7a')];_0x53ae42['uniqueid']=_0x561789[_0xeb9a('0x4e')];_0x53ae42['routealias']=this[_0xeb9a('0xf')][_0x561789[_0xeb9a('0x4e')]][_0xeb9a('0x7b')];logger[_0xeb9a('0x73')](_0xeb9a('0x7c'),_0x53ae42[_0xeb9a('0x4f')],_0x53ae42[_0xeb9a('0x59')]);_[_0xeb9a('0x7d')](_0x53ae42,_[_0xeb9a('0x7e')](_0x561789,_[_0xeb9a('0x7f')](_0x53ae42)));this[_0xeb9a('0xc')][_0x561789['uniqueid']][_0xeb9a('0x71')](_0x53ae42);this[_0xeb9a('0xf')][_0x561789['uniqueid']]=_0x53ae42;this[_0xeb9a('0x4a')](_0x53ae42,'queuecallerjoin');}}catch(_0x246193){logger[_0xeb9a('0x41')](_0xeb9a('0x76'),_0x561789[_0xeb9a('0x4e')],util[_0xeb9a('0x45')](_0x246193,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xeb9a('0x37')][_0xeb9a('0x80')]=function(_0x1cace3){try{if(this[_0xeb9a('0x5e')](_0x1cace3)){logger[_0xeb9a('0x4b')]('[%s][voiceQueueReport][queuecallerabandon]',_0x1cace3[_0xeb9a('0x4e')],util[_0xeb9a('0x45')](_0x1cace3,{'showHidden':![],'depth':null}));if(this[_0xeb9a('0xc')][_0x1cace3[_0xeb9a('0x4e')]]){var _0x117a0f=_['last'](this[_0xeb9a('0xc')][_0x1cace3[_0xeb9a('0x4e')]]);_0x117a0f['queuecallercomplete']=![];_0x117a0f[_0xeb9a('0x81')]=null;_0x117a0f['holdtime']=_0x1cace3['holdtime'];_0x117a0f[_0xeb9a('0x82')]=_0x1cace3[_0xeb9a('0x82')];_0x117a0f[_0xeb9a('0x1e')]=!![];_0x117a0f[_0xeb9a('0x83')]=moment()[_0xeb9a('0x54')](_0xeb9a('0x78'));_0x117a0f['queuecallerexitreason']='ABANDONED';_0x117a0f[_0xeb9a('0x84')]=null;logger[_0xeb9a('0x73')](_0xeb9a('0x85'),_0x117a0f[_0xeb9a('0x4f')],_0x117a0f[_0xeb9a('0x59')]);this['channels'][_0x1cace3[_0xeb9a('0x4e')]]=_0x117a0f;this[_0xeb9a('0x86')](_0x117a0f,'queuecallerabandon');}}}catch(_0x5a5af9){logger[_0xeb9a('0x41')](_0xeb9a('0x87'),_0x1cace3['uniqueid'],util[_0xeb9a('0x45')](_0x5a5af9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xeb9a('0x37')][_0xeb9a('0x20')]=function(_0x3e7f5a){try{if(this['isNotNull'](_0x3e7f5a)){logger['debug'](_0xeb9a('0x88'),_0x3e7f5a[_0xeb9a('0x4e')],util['inspect'](_0x3e7f5a,{'showHidden':![],'depth':null}));if(this[_0xeb9a('0xc')][_0x3e7f5a['uniqueid']]){var _0x4f892b=_[_0xeb9a('0x89')](this['queueReports'][_0x3e7f5a[_0xeb9a('0x4e')]]);_0x4f892b[_0xeb9a('0x8a')]=moment()[_0xeb9a('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0x4f892b['connectedlinenum']=_0x3e7f5a[_0xeb9a('0x8b')];_0x4f892b[_0xeb9a('0x8c')]=_0x3e7f5a[_0xeb9a('0x8c')];logger[_0xeb9a('0x73')](_0xeb9a('0x8d'),_0x4f892b[_0xeb9a('0x4f')],_0x4f892b[_0xeb9a('0x59')],_0x3e7f5a[_0xeb9a('0x8b')],_0x3e7f5a[_0xeb9a('0x8c')]);this[_0xeb9a('0xf')][_0x3e7f5a[_0xeb9a('0x4e')]]=_0x4f892b;this[_0xeb9a('0x4a')](_0x4f892b,_0xeb9a('0x1f'));}}}catch(_0x253ebb){logger['error']('[%s][voiceQueueReport][queuecallerleave]',_0x3e7f5a['uniqueid'],util[_0xeb9a('0x45')](_0x253ebb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xeb9a('0x37')][_0xeb9a('0x23')]=function(_0x470263){try{if(this[_0xeb9a('0x5e')](_0x470263)){logger[_0xeb9a('0x4b')](_0xeb9a('0x8e'),_0x470263[_0xeb9a('0x4e')],util[_0xeb9a('0x45')](_0x470263,{'showHidden':![],'depth':null}));if(this[_0xeb9a('0xc')][_0x470263[_0xeb9a('0x4e')]]){var _0x480f15=_['last'](this['queueReports'][_0x470263[_0xeb9a('0x4e')]]);_0x480f15['queuecallercomplete']=!![];_0x480f15[_0xeb9a('0x8f')]=_0xeb9a('0x90');logger['info'](_0xeb9a('0x91'),_0x480f15[_0xeb9a('0x4f')],_0x480f15[_0xeb9a('0x59')]);}}}catch(_0x1c07cf){logger['error'](_0xeb9a('0x8e'),_0x470263[_0xeb9a('0x4e')],util[_0xeb9a('0x45')](_0x1c07cf,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xeb9a('0x22')]=function(_0x11c1ed){try{if(this[_0xeb9a('0x5e')](_0x11c1ed)){logger[_0xeb9a('0x4b')]('[%s][voiceQueueReport][agentcomplete]',_0x11c1ed[_0xeb9a('0x4e')],util[_0xeb9a('0x45')](_0x11c1ed,{'showHidden':![],'depth':null}));if(this[_0xeb9a('0xc')][_0x11c1ed[_0xeb9a('0x4e')]]){var _0x1b0212=_[_0xeb9a('0x89')](this[_0xeb9a('0xc')][_0x11c1ed[_0xeb9a('0x4e')]]);_0x1b0212[_0xeb9a('0x1e')]=![];_0x1b0212[_0xeb9a('0x83')]=null;_0x1b0212['assigned']=!![];_0x1b0212['lastAssignedTo']=_0x11c1ed['membername'];_0x1b0212['holdtime']=_0x11c1ed[_0xeb9a('0x92')];_0x1b0212['queuecallercomplete']=!![];_0x1b0212[_0xeb9a('0x93')]=![];_0x1b0212[_0xeb9a('0x94')]=null;if(!_0x1b0212['transfer']){if(_0x11c1ed[_0xeb9a('0x95')]=='transfer'){_0x1b0212['queuecallerexitreason']=_0xeb9a('0x96');logger['info'](_0xeb9a('0x97'),_0x1b0212['queue'],_0x1b0212['type']);}else{if(_['startsWith'](_0x11c1ed['channel']['toLowerCase'](),_0xeb9a('0x98'))){if(this[_0xeb9a('0xc')][_0x11c1ed[_0xeb9a('0x99')]]){var _0xcdfbd0=_[_0xeb9a('0x89')](this[_0xeb9a('0xc')][_0x11c1ed['linkedid']]);_0xcdfbd0['queuecallercomplete']=![];_0xcdfbd0['queuecallerexit']=!![];_0xcdfbd0['queuecallerexitAt']=moment(_0x1b0212[_0xeb9a('0x77')])[_0xeb9a('0x9a')](_0x11c1ed[_0xeb9a('0x92')],_0xeb9a('0x9b'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0xcdfbd0['queuecallerexitreason']='FORWARDTRANSFER';_0xcdfbd0['transfer']=!![];_0xcdfbd0['transfertype']=_0xeb9a('0x9c');_0xcdfbd0['transferexten']=_0x11c1ed['destexten'];_0xcdfbd0[_0xeb9a('0x9d')]=_0x11c1ed['uniqueid'];logger[_0xeb9a('0x73')](_0xeb9a('0x9e'),_0xcdfbd0[_0xeb9a('0x4f')],_0xcdfbd0[_0xeb9a('0x59')]);var _0x3cabf0=this[_0xeb9a('0xc')][_0x11c1ed[_0xeb9a('0x99')]];this[_0xeb9a('0xc')][_0x11c1ed[_0xeb9a('0x99')]]=this[_0xeb9a('0xc')][_0x11c1ed[_0xeb9a('0x4e')]];this['queueReports'][_0x11c1ed[_0xeb9a('0x4e')]]=_0x3cabf0;}}else{_0x1b0212[_0xeb9a('0x8f')]=_0xeb9a('0x9f')+_0x11c1ed[_0xeb9a('0x95')][_0xeb9a('0xa0')]();logger[_0xeb9a('0x73')](_0xeb9a('0xa1'),_0x1b0212[_0xeb9a('0x4f')],_0x1b0212[_0xeb9a('0x59')],_0x1b0212[_0xeb9a('0x8f')]);}}}this[_0xeb9a('0xf')][_0x11c1ed['uniqueid']]=_0x1b0212;this[_0xeb9a('0x86')](_0x1b0212,'agentcomplete');}}}catch(_0x43a996){logger[_0xeb9a('0x41')](_0xeb9a('0xa2'),_0x11c1ed[_0xeb9a('0x4e')],util[_0xeb9a('0x45')](_0x43a996,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xeb9a('0x37')][_0xeb9a('0x25')]=function(_0x368695){try{if(this['isNotNull'](_0x368695)){logger[_0xeb9a('0x4b')](_0xeb9a('0xa3'),_0x368695['uniqueid'],util['inspect'](_0x368695,{'showHidden':![],'depth':null}));this[_0xeb9a('0xa4')](_0x368695['uniqueid'],_[_0xeb9a('0x7f')](_0x368695['variable'])[0x0],_0x368695['value']);if(this['queueReports'][_0x368695[_0xeb9a('0x4e')]]){var _0x2888df=_['last'](this['queueReports'][_0x368695[_0xeb9a('0x4e')]]);if(_0x2888df){if(this['isNotNull'](_0x368695['variable'])&&this[_0xeb9a('0x5e')](_0x368695[_0xeb9a('0xa5')][_0xeb9a('0x65')])){switch(_0x368695[_0xeb9a('0xa6')]){case _0xeb9a('0xa7'):_0x2888df[_0xeb9a('0x93')]=![];_0x2888df[_0xeb9a('0x94')]=null;break;case _0xeb9a('0xa8'):_0x2888df[_0xeb9a('0xa9')]='timeout';_0x2888df[_0xeb9a('0x93')]=!![];_0x2888df['queuecallerexitAt']=moment()['format'](_0xeb9a('0x78'));_0x2888df[_0xeb9a('0x8a')]=moment()['format'](_0xeb9a('0x78'));logger[_0xeb9a('0x4b')](_0xeb9a('0xaa'),_0x368695['uniqueid'],util[_0xeb9a('0x45')](_0x2888df,{'showHidden':![],'depth':null}));ami[_0xeb9a('0x49')]('custom:timeout',_0x2888df);break;default:_0x2888df[_0xeb9a('0x93')]=!![];_0x2888df['queuecallerexitAt']=moment()[_0xeb9a('0x54')](_0xeb9a('0x78'));_0x2888df[_0xeb9a('0x8a')]=moment()[_0xeb9a('0x54')](_0xeb9a('0x78'));}_0x2888df[_0xeb9a('0x1e')]=![];_0x2888df[_0xeb9a('0x83')]=null;_0x2888df[_0xeb9a('0x8f')]=_0x368695[_0xeb9a('0xa6')];this[_0xeb9a('0xf')][_0x368695['uniqueid']]=_0x2888df;this[_0xeb9a('0x86')](_0x2888df,_0xeb9a('0x24'));}else if(this[_0xeb9a('0x5e')](_0x368695[_0xeb9a('0xa5')])&&this[_0xeb9a('0x5e')](_0x368695[_0xeb9a('0xa5')][_0xeb9a('0xab')])){if(!_0x2888df[_0xeb9a('0x1e')]){_0x2888df[_0xeb9a('0x93')]=!![];_0x2888df[_0xeb9a('0x94')]=moment()['format'](_0xeb9a('0x78'));_0x2888df[_0xeb9a('0x8f')]=_0xeb9a('0xac');_0x2888df[_0xeb9a('0x8a')]=moment()[_0xeb9a('0x54')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xeb9a('0xf')][_0x368695['uniqueid']]=_0x2888df;}}logger[_0xeb9a('0x73')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x368695[_0xeb9a('0x4e')],_0x2888df[_0xeb9a('0x4f')],_0x2888df[_0xeb9a('0x59')],_[_0xeb9a('0x7f')](_0x368695[_0xeb9a('0xa5')])[0x0],_0x368695[_0xeb9a('0xa6')]);_0x2888df[_0xeb9a('0x14')]=this[_0xeb9a('0x14')][_0x368695[_0xeb9a('0x4e')]];}}}}catch(_0x545236){logger['error'](_0xeb9a('0xa3'),_0x368695['uniqueid'],util[_0xeb9a('0x45')](_0x545236,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xeb9a('0xa4')]=function(_0x285f7d,_0x26f496,_0x180ae4){var _0x10abb9=[_0xeb9a('0xad'),_0xeb9a('0xae'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0xeb9a('0xaf'),'rtpaudioqoslossbridged',_0xeb9a('0xb0'),_0xeb9a('0xb1'),'sipcallid','sipuri',_0xeb9a('0xb2'),_0xeb9a('0xb3'),'membercalls',_0xeb9a('0xb4'),_0xeb9a('0xb5'),'memberlastcall',_0xeb9a('0xb6'),_0xeb9a('0xb7'),'memberrealtime'];if(!_[_0xeb9a('0x3b')](_0x26f496)&&!_[_0xeb9a('0xb8')](_0x10abb9,_0x26f496)){if(_[_0xeb9a('0x5f')](this[_0xeb9a('0x14')][_0x285f7d])){this[_0xeb9a('0x14')][_0x285f7d]={};}this[_0xeb9a('0x14')][_0x285f7d][_0x26f496]=_0x180ae4;}};VoiceQueueReport[_0xeb9a('0x37')][_0xeb9a('0xb9')]=function(_0x26cd26,_0x5992b7,_0x1c9e60){var _0x2fa51b={};for(var _0x9d6ac6=0x0;_0x9d6ac6=0x0?moment(_0x1c6e05[_0xce09('0x17')])['diff'](_0x1c6e05[_0xce09('0x16')],_0xce09('0xf')):null,'data1':_0xce09('0x18'),'data2':_0x1c6e05[_0xce09('0x12')],'data3':_0x1c6e05[_0xce09('0x11')],'data4':_0x1c6e05[_0xce09('0x19')]||null,'role':_0xce09('0x1a'),'internal':_0x1c6e05[_0xce09('0x12')]?_[_0xce09('0x1b')](_0x1c6e05[_0xce09('0x12')]):undefined,'uniqueid':_0x1c6e05['uniqueid']},'log':_0xce09('0x7')});}; \ No newline at end of file +var _0x3608=['TALKING','starttime','endtime','dialstring','agent','toNumber','moment','lodash','util','../client','queuecallercompleteAt','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','SIP/%s','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','accountcode','uniqueid','voiceDialReport','membername'];(function(_0x45cdb5,_0xcb0472){var _0xe8719f=function(_0x3c5f10){while(--_0x3c5f10){_0x45cdb5['push'](_0x45cdb5['shift']());}};_0xe8719f(++_0xcb0472);}(_0x3608,0x76));var _0x8360=function(_0x2df7dd,_0x420022){_0x2df7dd=_0x2df7dd-0x0;var _0x5064b1=_0x3608[_0x2df7dd];return _0x5064b1;};'use strict';var moment=require(_0x8360('0x0'));var _=require(_0x8360('0x1'));var util=require(_0x8360('0x2'));var client=require(_0x8360('0x3'));exports['voiceQueueReport']=function(_0x47a57e){var _0x583f38=_0x47a57e[_0x8360('0x4')]||_0x47a57e['queuecallerexitAt'];return client['Request'](_0x8360('0x5'),{'body':{'channel':_0x8360('0x6'),'membername':_0x47a57e[_0x8360('0x7')],'interface':_[_0x8360('0x8')](_0x47a57e[_0x8360('0x9')])?util[_0x8360('0xa')](_0x8360('0xb'),_0x47a57e[_0x8360('0x7')]):_0x47a57e[_0x8360('0x9')],'type':'TALKING','enterAt':_0x47a57e[_0x8360('0xc')],'exitAt':_0x583f38,'duration':moment(_0x583f38)[_0x8360('0xd')](_0x47a57e[_0x8360('0xc')],_0x8360('0xe')),'data1':_0x8360('0xf'),'data2':_0x47a57e[_0x8360('0x10')],'data3':_0x47a57e[_0x8360('0x11')],'data4':null,'data5':_0x47a57e['queue'],'role':'agent','internal':_0x47a57e[_0x8360('0x12')]?_['toNumber'](_0x47a57e[_0x8360('0x12')]):undefined,'uniqueid':_0x47a57e[_0x8360('0x13')]},'log':'CreateMemberReport'});};exports[_0x8360('0x14')]=function(_0x45f23a){return client['Request']('CreateMemberReport',{'body':{'channel':_0x8360('0x6'),'membername':_0x45f23a[_0x8360('0x15')],'interface':_0x45f23a[_0x8360('0x9')],'type':_0x8360('0x16'),'enterAt':_0x45f23a[_0x8360('0x17')],'exitAt':_0x45f23a[_0x8360('0x18')],'duration':moment(_0x45f23a[_0x8360('0x18')])[_0x8360('0xd')](_0x45f23a[_0x8360('0x17')],_0x8360('0xe'))>=0x0?moment(_0x45f23a[_0x8360('0x18')])[_0x8360('0xd')](_0x45f23a[_0x8360('0x17')],_0x8360('0xe')):null,'data1':'outbound','data2':_0x45f23a[_0x8360('0x12')],'data3':_0x45f23a[_0x8360('0x11')],'data4':_0x45f23a[_0x8360('0x19')]||null,'role':_0x8360('0x1a'),'internal':_0x45f23a[_0x8360('0x12')]?_[_0x8360('0x1b')](_0x45f23a[_0x8360('0x12')]):undefined,'uniqueid':_0x45f23a[_0x8360('0x13')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index b5178fd..0bd5c3b 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 _0xae24=['ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','Request'];(function(_0x52a82e,_0x173dcd){var _0x25b416=function(_0x457422){while(--_0x457422){_0x52a82e['push'](_0x52a82e['shift']());}};_0x25b416(++_0x173dcd);}(_0xae24,0x180));var _0x4ae2=function(_0x7db900,_0x5a88c8){_0x7db900=_0x7db900-0x0;var _0x1c0edc=_0xae24[_0x7db900];return _0x1c0edc;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0x4ae2('0x0')](_0x4ae2('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x4ae2('0x2'),_0x4ae2('0x3')]},'log':_0x4ae2('0x4')});}; \ No newline at end of file +var _0xcce8=['GetSettings','../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x74f906,_0x16ba8c){var _0x10531a=function(_0x3b3535){while(--_0x3b3535){_0x74f906['push'](_0x74f906['shift']());}};_0x10531a(++_0x16ba8c);}(_0xcce8,0x1a5));var _0x8cce=function(_0xc050c3,_0x12a439){_0xc050c3=_0xc050c3-0x0;var _0x55e0d5=_0xcce8[_0xc050c3];return _0x55e0d5;};'use strict';var client=require(_0x8cce('0x0'));exports[_0x8cce('0x1')]=function(){return client[_0x8cce('0x2')](_0x8cce('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x8cce('0x4'),_0x8cce('0x5')]},'log':_0x8cce('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 37fe7b9..bb66da5 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 _0x0de3=['Request','GetTemplate','name','html','../client','getTemplates'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x0de3,0x184));var _0x30de=function(_0x37b9c8,_0x19e1e8){_0x37b9c8=_0x37b9c8-0x0;var _0xa3b96e=_0x0de3[_0x37b9c8];return _0xa3b96e;};'use strict';var client=require(_0x30de('0x0'));exports[_0x30de('0x1')]=function(_0x5318e3){return function(_0x243896){return client[_0x30de('0x2')](_0x30de('0x3'),{'options':{'raw':!![],'attributes':['id',_0x30de('0x4'),_0x30de('0x5')]},'log':_0x30de('0x3')});};}; \ No newline at end of file +var _0x7215=['GetTemplate','html','../client','getTemplates','Request'];(function(_0x4c5c97,_0x4f85bf){var _0xd5d2cb=function(_0x1e6100){while(--_0x1e6100){_0x4c5c97['push'](_0x4c5c97['shift']());}};_0xd5d2cb(++_0x4f85bf);}(_0x7215,0x138));var _0x5721=function(_0x250602,_0x2ff70e){_0x250602=_0x250602-0x0;var _0x52aa48=_0x7215[_0x250602];return _0x52aa48;};'use strict';var client=require(_0x5721('0x0'));exports[_0x5721('0x1')]=function(_0x58d68a){return function(_0x4e245e){return client[_0x5721('0x2')](_0x5721('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0x5721('0x4')]},'log':_0x5721('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index e3c0697..c15f101 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 _0x5a97=['Request','GetTrigger','channel','Condition','AllConditions','field','value','AnyConditions','operator','Action','Actions','action','data1','data2','data4','data5','data7','../client','getTriggers'];(function(_0x326ff8,_0x386842){var _0x33a9a6=function(_0xe415b0){while(--_0xe415b0){_0x326ff8['push'](_0x326ff8['shift']());}};_0x33a9a6(++_0x386842);}(_0x5a97,0x70));var _0x75a9=function(_0x42a5eb,_0x3c42a1){_0x42a5eb=_0x42a5eb-0x0;var _0x4aa77b=_0x5a97[_0x42a5eb];return _0x4aa77b;};'use strict';var client=require(_0x75a9('0x0'));exports[_0x75a9('0x1')]=function(_0x5b2bfd){return function(_0x119a82){return client[_0x75a9('0x2')](_0x75a9('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x75a9('0x4'),'status'],'include':[{'model':_0x75a9('0x5'),'as':_0x75a9('0x6'),'attributes':['id',_0x75a9('0x7'),'operator',_0x75a9('0x8')]},{'model':'Condition','as':_0x75a9('0x9'),'attributes':['id',_0x75a9('0x7'),_0x75a9('0xa'),_0x75a9('0x8')]},{'model':_0x75a9('0xb'),'as':_0x75a9('0xc'),'attributes':['id',_0x75a9('0xd'),_0x75a9('0xe'),_0x75a9('0xf'),'data3',_0x75a9('0x10'),_0x75a9('0x11'),'data6',_0x75a9('0x12')]}]},'log':_0x75a9('0x3')});};}; \ No newline at end of file +var _0xba73=['AnyConditions','operator','Action','Actions','data1','data2','data3','data4','data5','data6','data7','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','field','value'];(function(_0x29ac4f,_0x56f797){var _0xbf1f6c=function(_0x431aca){while(--_0x431aca){_0x29ac4f['push'](_0x29ac4f['shift']());}};_0xbf1f6c(++_0x56f797);}(_0xba73,0x131));var _0x3ba7=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xba73[_0x346737];return _0x1ade2e;};'use strict';var client=require('../client');exports[_0x3ba7('0x0')]=function(_0x1c5841){return function(_0x571708){return client[_0x3ba7('0x1')](_0x3ba7('0x2'),{'options':{'raw':![],'attributes':['id',_0x3ba7('0x3'),_0x3ba7('0x4'),_0x3ba7('0x5')],'include':[{'model':_0x3ba7('0x6'),'as':_0x3ba7('0x7'),'attributes':['id',_0x3ba7('0x8'),'operator',_0x3ba7('0x9')]},{'model':_0x3ba7('0x6'),'as':_0x3ba7('0xa'),'attributes':['id',_0x3ba7('0x8'),_0x3ba7('0xb'),_0x3ba7('0x9')]},{'model':_0x3ba7('0xc'),'as':_0x3ba7('0xd'),'attributes':['id','action',_0x3ba7('0xe'),_0x3ba7('0xf'),_0x3ba7('0x10'),_0x3ba7('0x11'),_0x3ba7('0x12'),_0x3ba7('0x13'),_0x3ba7('0x14')]}]},'log':_0x3ba7('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index e8c5cfc..1f5abe6 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 _0x455d=['Request','name','registry','defaultuser','GetTrunk'];(function(_0x48a836,_0xa1d010){var _0x249dc8=function(_0x2a95a0){while(--_0x2a95a0){_0x48a836['push'](_0x48a836['shift']());}};_0x249dc8(++_0xa1d010);}(_0x455d,0x190));var _0xd455=function(_0x13aac0,_0x10e853){_0x13aac0=_0x13aac0-0x0;var _0x58466a=_0x455d[_0x13aac0];return _0x58466a;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x1f4dd1){return function(_0x191e5a){return client[_0xd455('0x0')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xd455('0x1'),_0xd455('0x2'),_0xd455('0x3')]},'log':_0xd455('0x4')});};}; \ No newline at end of file +var _0xa8eb=['name','defaultuser','../client','Request','GetTrunk'];(function(_0x276167,_0x21086e){var _0x27a866=function(_0xa47f17){while(--_0xa47f17){_0x276167['push'](_0x276167['shift']());}};_0x27a866(++_0x21086e);}(_0xa8eb,0x179));var _0xba8e=function(_0x5ed8f8,_0x245c75){_0x5ed8f8=_0x5ed8f8-0x0;var _0x1eddd2=_0xa8eb[_0x5ed8f8];return _0x1eddd2;};'use strict';var client=require(_0xba8e('0x0'));exports['getTrunks']=function(_0x26595f){return function(_0x5757ad){return client[_0xba8e('0x1')](_0xba8e('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xba8e('0x3'),'registry',_0xba8e('0x4')]},'log':_0xba8e('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 04fd4a2..587eee7 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x153738,_0xe704c1){var _0x3028d9=function(_0x47afa0){while(--_0x47afa0){_0x153738['push'](_0x153738['shift']());}};_0x3028d9(++_0xe704c1);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file +var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xe706,0xa3));var _0x6e70=function(_0x599318,_0x319486){_0x599318=_0x599318-0x0;var _0x7b06fa=_0xe706[_0x599318];return _0x7b06fa;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 1926dab..fbc3ef3 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 _0x9161=['../client','create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x474d1c,_0x2bf69b){var _0x13e2cb=function(_0x53fe43){while(--_0x53fe43){_0x474d1c['push'](_0x474d1c['shift']());}};_0x13e2cb(++_0x2bf69b);}(_0x9161,0x186));var _0x1916=function(_0x42d22b,_0x4d1186){_0x42d22b=_0x42d22b-0x0;var _0x36796d=_0x9161[_0x42d22b];return _0x36796d;};'use strict';var client=require(_0x1916('0x0'));exports[_0x1916('0x1')]=function(_0x1628b3){return client[_0x1916('0x2')]('CreateVoiceAgentReport',{'body':_0x1628b3,'log':_0x1916('0x3')});};exports[_0x1916('0x4')]=function(_0x1c6592,_0x5d3c6e,_0xaf4d96){return client[_0x1916('0x2')]('UpdateVoiceAgentReport',{'body':_0x1c6592,'options':{'where':{'uniqueid':_0x5d3c6e,'interface':_0xaf4d96,'agentcomplete':!![]}},'log':_0x1916('0x5')});}; \ No newline at end of file +var _0xfc37=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x47571a,_0x4e4352){var _0x1dd34d=function(_0x48ecd0){while(--_0x48ecd0){_0x47571a['push'](_0x47571a['shift']());}};_0x1dd34d(++_0x4e4352);}(_0xfc37,0x165));var _0x7fc3=function(_0x495d52,_0x568f11){_0x495d52=_0x495d52-0x0;var _0x589830=_0xfc37[_0x495d52];return _0x589830;};'use strict';var client=require(_0x7fc3('0x0'));exports[_0x7fc3('0x1')]=function(_0x31fe5f){return client[_0x7fc3('0x2')](_0x7fc3('0x3'),{'body':_0x31fe5f,'log':_0x7fc3('0x3')});};exports[_0x7fc3('0x4')]=function(_0x40cda8,_0x2f7e5f,_0xc63989){return client[_0x7fc3('0x2')](_0x7fc3('0x5'),{'body':_0x40cda8,'options':{'where':{'uniqueid':_0x2f7e5f,'interface':_0xc63989,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 433ce65..2ae03e6 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 _0xa49d=['GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','../client','Request','merge','calleridnum','context','callerid','DOCUMENTATION'];(function(_0x154705,_0x4f7338){var _0xc84768=function(_0x3db077){while(--_0x3db077){_0x154705['push'](_0x154705['shift']());}};_0xc84768(++_0x4f7338);}(_0xa49d,0xf3));var _0xda49=function(_0x201b36,_0x5622a1){_0x201b36=_0x201b36-0x0;var _0xaf48a6=_0xa49d[_0x201b36];return _0xaf48a6;};'use strict';var moment=require(_0xda49('0x0'));var util=require(_0xda49('0x1'));var _=require('lodash');var client=require(_0xda49('0x2'));exports['create']=function(_0x19866e){return client[_0xda49('0x3')]('CreateVoiceCallReport',{'body':_[_0xda49('0x4')](_0x19866e,{'source':_0x19866e[_0xda49('0x5')],'destinationcontext':_0x19866e[_0xda49('0x6')],'callerid':_0x19866e[_0xda49('0x7')],'amaflags':_0xda49('0x8')}),'log':'CreateVoiceCallReport'});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0xda49('0x9'),{'options':{'where':{'type':[_0xda49('0xa')],'createdAt':{'$between':[moment()[_0xda49('0xb')](_0xda49('0xc'))[_0xda49('0xd')](_0xda49('0xe')),moment()[_0xda49('0xf')](_0xda49('0xc'))[_0xda49('0xd')](_0xda49('0xe'))]}},'attributes':[_0xda49('0x10'),_0xda49('0x11'),_0xda49('0x12'),_0xda49('0x13')]},'log':_0xda49('0x14')});};}; \ No newline at end of file +var _0x1388=['endOf','format','YYYY-MM-DD\x20HH:mm:ss','type','duration','billableseconds','moment','util','create','Request','CreateVoiceCallReport','merge','calleridnum','context','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','day'];(function(_0x3fb5eb,_0x5947a6){var _0x481291=function(_0x74e4e){while(--_0x74e4e){_0x3fb5eb['push'](_0x3fb5eb['shift']());}};_0x481291(++_0x5947a6);}(_0x1388,0xb1));var _0x8138=function(_0x4cfd4a,_0x340a41){_0x4cfd4a=_0x4cfd4a-0x0;var _0x42a03c=_0x1388[_0x4cfd4a];return _0x42a03c;};'use strict';var moment=require(_0x8138('0x0'));var util=require(_0x8138('0x1'));var _=require('lodash');var client=require('../client');exports[_0x8138('0x2')]=function(_0x437ccf){return client[_0x8138('0x3')](_0x8138('0x4'),{'body':_[_0x8138('0x5')](_0x437ccf,{'source':_0x437ccf[_0x8138('0x6')],'destinationcontext':_0x437ccf[_0x8138('0x7')],'callerid':_0x437ccf['callerid'],'amaflags':_0x8138('0x8')}),'log':_0x8138('0x4')});};exports[_0x8138('0x9')]=function(){return function(){return client[_0x8138('0x3')](_0x8138('0xa'),{'options':{'where':{'type':[_0x8138('0xb')],'createdAt':{'$between':[moment()['startOf'](_0x8138('0xc'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x8138('0xd')](_0x8138('0xc'))[_0x8138('0xe')](_0x8138('0xf'))]}},'attributes':[_0x8138('0x10'),'disposition',_0x8138('0x11'),_0x8138('0x12')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 8591c85..2e33f30 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 _0x5e13=['../client','create','CreateVoiceDialReport'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x5e13,0x17d));var _0x35e1=function(_0x141dd8,_0x48363d){_0x141dd8=_0x141dd8-0x0;var _0x348080=_0x5e13[_0x141dd8];return _0x348080;};'use strict';var client=require(_0x35e1('0x0'));exports[_0x35e1('0x1')]=function(_0x5762f9){return client['Request'](_0x35e1('0x2'),{'body':_0x5762f9,'log':_0x35e1('0x2')});}; \ No newline at end of file +var _0xe91b=['Request','CreateVoiceDialReport','../client','create'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xe91b,0xc6));var _0xbe91=function(_0xa1e3ca,_0x559022){_0xa1e3ca=_0xa1e3ca-0x0;var _0x5005ab=_0xe91b[_0xa1e3ca];return _0x5005ab;};'use strict';var client=require(_0xbe91('0x0'));exports[_0xbe91('0x1')]=function(_0x381f9f){return client[_0xbe91('0x2')]('CreateVoiceDialReport',{'body':_0x381f9f,'log':_0xbe91('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 6ab74dc..5018635 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 _0x6f0d=['getVoiceExtensions','Request','GetVoiceExtension','exten'];(function(_0x3db2c6,_0x2e9c6a){var _0x4876fd=function(_0x3e8146){while(--_0x3e8146){_0x3db2c6['push'](_0x3db2c6['shift']());}};_0x4876fd(++_0x2e9c6a);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x39aef8,_0x3baee9){_0x39aef8=_0x39aef8-0x0;var _0x24ccd6=_0x6f0d[_0x39aef8];return _0x24ccd6;};'use strict';var client=require('../client');exports[_0xd6f0('0x0')]=function(){return function(){return client[_0xd6f0('0x1')](_0xd6f0('0x2'),{'options':{'raw':!![],'attributes':['id',_0xd6f0('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xd6f0('0x0')});};}; \ No newline at end of file +var _0x9c2c=['recordingFormat','../client','getVoiceExtensions'];(function(_0x5b7788,_0x309ae5){var _0x573871=function(_0x5c79fd){while(--_0x5c79fd){_0x5b7788['push'](_0x5b7788['shift']());}};_0x573871(++_0x309ae5);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xc9c2('0x0'));exports[_0xc9c2('0x1')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten',_0xc9c2('0x2')],'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 627d072..4be7273 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 _0xea26=['strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallInQueue','dialOrderByScheduledAt'];(function(_0x321cff,_0x271a66){var _0x331c4=function(_0x3846e8){while(--_0x3846e8){_0x321cff['push'](_0x321cff['shift']());}};_0x331c4(++_0x271a66);}(_0xea26,0x170));var _0x6ea2=function(_0x146c16,_0x48baf4){_0x146c16=_0x146c16-0x0;var _0x4c38de=_0xea26[_0x146c16];return _0x4c38de;};'use strict';var client=require(_0x6ea2('0x0'));exports[_0x6ea2('0x1')]=function(){return function(){return client[_0x6ea2('0x2')](_0x6ea2('0x3'),{'options':{'raw':![],'attributes':['id',_0x6ea2('0x4'),_0x6ea2('0x5'),'acwTimeout',_0x6ea2('0x6'),'monitor_format','type',_0x6ea2('0x7'),_0x6ea2('0x8'),_0x6ea2('0x9'),'dialLimitQueue',_0x6ea2('0xa'),_0x6ea2('0xb'),_0x6ea2('0xc'),'dialPredictiveInterval',_0x6ea2('0xd'),'dialOriginateCallerIdNumber',_0x6ea2('0xe'),'dialQueueOptions',_0x6ea2('0xf'),_0x6ea2('0x10'),_0x6ea2('0x11'),_0x6ea2('0x12'),_0x6ea2('0x13'),_0x6ea2('0x14'),_0x6ea2('0x15'),_0x6ea2('0x16'),_0x6ea2('0x17'),_0x6ea2('0x18'),_0x6ea2('0x19'),_0x6ea2('0x1a'),_0x6ea2('0x1b'),'dialAMDActive',_0x6ea2('0x1c'),'dialAMDGreeting',_0x6ea2('0x1d'),_0x6ea2('0x1e'),_0x6ea2('0x1f'),_0x6ea2('0x20'),_0x6ea2('0x21'),_0x6ea2('0x22'),'dialAMDMaximumWordLength',_0x6ea2('0x23'),'dialRecallMeTimeout',_0x6ea2('0x24'),_0x6ea2('0x25'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format',_0x6ea2('0x26'),_0x6ea2('0x27'),_0x6ea2('0x28'),_0x6ea2('0x29'),'dialNoSuchNumberRetryFrequency',_0x6ea2('0x2a'),'dialDropRetryFrequency',_0x6ea2('0x2b'),_0x6ea2('0x2c'),_0x6ea2('0x2d'),_0x6ea2('0x2e'),'dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0x6ea2('0x2f'),_0x6ea2('0x30'),_0x6ea2('0x31')],'include':[{'model':_0x6ea2('0x32'),'as':_0x6ea2('0x32'),'attributes':['id',_0x6ea2('0x4'),_0x6ea2('0x33'),_0x6ea2('0x34')]},{'model':_0x6ea2('0x35'),'as':_0x6ea2('0x36'),'attributes':['id',_0x6ea2('0x4')]},{'model':_0x6ea2('0x32'),'as':_0x6ea2('0x37'),'attributes':['id',_0x6ea2('0x4'),_0x6ea2('0x33'),_0x6ea2('0x34')]},{'model':_0x6ea2('0x38'),'as':_0x6ea2('0x38'),'attributes':['id',_0x6ea2('0x4')],'include':[{'model':_0x6ea2('0x38'),'as':'Intervals','attributes':['id',_0x6ea2('0x4'),_0x6ea2('0x39')]}]}]},'log':_0x6ea2('0x1')});};}; \ No newline at end of file +var _0xa321=['dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','Pause','mandatoryDispositionPause','TrunkBackup','active','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject'];(function(_0x1214f8,_0x18b942){var _0x3db3f8=function(_0x5284a7){while(--_0x5284a7){_0x1214f8['push'](_0x1214f8['shift']());}};_0x3db3f8(++_0x18b942);}(_0xa321,0x101));var _0x1a32=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xa321[_0x487b0c];return _0x1adbdc;};'use strict';var client=require(_0x1a32('0x0'));exports[_0x1a32('0x1')]=function(){return function(){return client[_0x1a32('0x2')](_0x1a32('0x3'),{'options':{'raw':![],'attributes':['id',_0x1a32('0x4'),_0x1a32('0x5'),_0x1a32('0x6'),_0x1a32('0x7'),_0x1a32('0x8'),_0x1a32('0x9'),'dialActive',_0x1a32('0xa'),_0x1a32('0xb'),_0x1a32('0xc'),_0x1a32('0xd'),_0x1a32('0xe'),_0x1a32('0xf'),_0x1a32('0x10'),_0x1a32('0x11'),_0x1a32('0x12'),_0x1a32('0x13'),_0x1a32('0x14'),_0x1a32('0x15'),_0x1a32('0x16'),_0x1a32('0x17'),_0x1a32('0x18'),_0x1a32('0x19'),_0x1a32('0x1a'),_0x1a32('0x1b'),_0x1a32('0x1c'),_0x1a32('0x1d'),_0x1a32('0x1e'),_0x1a32('0x1f'),_0x1a32('0x20'),_0x1a32('0x21'),'dialAMDActive',_0x1a32('0x22'),_0x1a32('0x23'),'dialAMDAfterGreetingSilence',_0x1a32('0x24'),_0x1a32('0x25'),'dialAMDBetweenWordsSilence',_0x1a32('0x26'),_0x1a32('0x27'),_0x1a32('0x28'),_0x1a32('0x29'),_0x1a32('0x2a'),_0x1a32('0x2b'),'dialOrderByScheduledAt',_0x1a32('0x2c'),_0x1a32('0x2d'),_0x1a32('0x2e'),_0x1a32('0x8'),'strategy',_0x1a32('0x2f'),_0x1a32('0x30'),'dialNoSuchNumberMaxRetry',_0x1a32('0x31'),_0x1a32('0x32'),_0x1a32('0x33'),_0x1a32('0x34'),_0x1a32('0x35'),_0x1a32('0x36'),_0x1a32('0x37'),_0x1a32('0x38'),_0x1a32('0x39'),'mandatoryDisposition',_0x1a32('0x3a'),_0x1a32('0x3b'),_0x1a32('0x3c'),_0x1a32('0x3d')],'include':[{'model':_0x1a32('0x3e'),'as':_0x1a32('0x3e'),'attributes':['id',_0x1a32('0x4'),_0x1a32('0x3f'),'active']},{'model':_0x1a32('0x40'),'as':_0x1a32('0x41'),'attributes':['id',_0x1a32('0x4')]},{'model':'Trunk','as':_0x1a32('0x42'),'attributes':['id',_0x1a32('0x4'),_0x1a32('0x3f'),_0x1a32('0x43')]},{'model':_0x1a32('0x44'),'as':_0x1a32('0x44'),'attributes':['id',_0x1a32('0x4')],'include':[{'model':'Interval','as':_0x1a32('0x45'),'attributes':['id',_0x1a32('0x4'),'interval']}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 3dd264f..a7ff22d 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(_0x3ed49d,_0xddccc6){var _0x4c7524=function(_0x547383){while(--_0x547383){_0x3ed49d['push'](_0x3ed49d['shift']());}};_0x4c7524(++_0xddccc6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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(_0x369c70,_0x5892f0){var _0xb7e463=function(_0x3822c8){while(--_0x3822c8){_0x369c70['push'](_0x369c70['shift']());}};_0xb7e463(++_0x5892f0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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 04db798..8457c44 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 _0x84d4=['GetVoiceQueueRtPauses','Request'];(function(_0x588a8b,_0x33467a){var _0x46835e=function(_0x41c74e){while(--_0x41c74e){_0x588a8b['push'](_0x588a8b['shift']());}};_0x46835e(++_0x33467a);}(_0x84d4,0xa3));var _0x484d=function(_0x56a60a,_0xf4c330){_0x56a60a=_0x56a60a-0x0;var _0x5c4057=_0x84d4[_0x56a60a];return _0x5c4057;};'use strict';var client=require('../client');exports['getVoiceQueueRtPauses']=function(_0x4d8dba){return function(){return client[_0x484d('0x0')](_0x484d('0x1'),{'options':{'where':{'VoiceQueueId':_0x4d8dba,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x658d=['getVoiceQueueRtPauses','GetVoiceQueueRtPauses','../client'];(function(_0x4c1ae7,_0x51a14a){var _0x70a7f9=function(_0x27b0b3){while(--_0x27b0b3){_0x4c1ae7['push'](_0x4c1ae7['shift']());}};_0x70a7f9(++_0x51a14a);}(_0x658d,0x128));var _0xd658=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x658d[_0x167cc1];return _0x10bc4b;};'use strict';var client=require(_0xd658('0x0'));exports[_0xd658('0x1')]=function(_0x3fc6c9){return function(){return client['Request'](_0xd658('0x2'),{'options':{'where':{'VoiceQueueId':_0x3fc6c9,'paused':!![]},'raw':!![]},'log':_0xd658('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index fa61e2b..c028d33 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x3ed189,_0x96c6d0){var _0x5eb671=function(_0x90bdbd){while(--_0x90bdbd){_0x3ed189['push'](_0x3ed189['shift']());}};_0x5eb671(++_0x96c6d0);}(_0x7a54,0x106));var _0x47a5=function(_0x555234,_0x87d5c9){_0x555234=_0x555234-0x0;var _0x9611bb=_0x7a54[_0x555234];return _0x9611bb;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x229907,_0x25dfc4){var _0x7df92d=function(_0x5947e3){while(--_0x5947e3){_0x229907['push'](_0x229907['shift']());}};_0x7df92d(++_0x25dfc4);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 1d5fdc9..a4b6e18 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 _0xca4a=['origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','../client','transfers','blindTransfer','result','transferercalleridname','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','context','extension','blind','CreateVoiceTransferReport','Request','origtransfererchannel'];(function(_0x20cf10,_0x465f55){var _0x53fe52=function(_0x1c2fb2){while(--_0x1c2fb2){_0x20cf10['push'](_0x20cf10['shift']());}};_0x53fe52(++_0x465f55);}(_0xca4a,0x196));var _0xaca4=function(_0x1026ff,_0x1ece0c){_0x1026ff=_0x1026ff-0x0;var _0x19cc2c=_0xca4a[_0x1026ff];return _0x19cc2c;};'use strict';var client=require(_0xaca4('0x0'));exports[_0xaca4('0x1')]={};exports[_0xaca4('0x2')]=function(_0xf0698c){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0xf0698c[_0xaca4('0x3')],'transfererchannel':_0xf0698c['transfererchannel'],'transferercalleridnum':_0xf0698c['transferercalleridnum'],'transferercalleridname':_0xf0698c[_0xaca4('0x4')],'transfererconnectedlinenum':_0xf0698c['transfererconnectedlinenum'],'transfererconnectedlinename':_0xf0698c['transfererconnectedlinename'],'transfereraccountcode':_0xf0698c[_0xaca4('0x5')],'transferercontext':_0xf0698c[_0xaca4('0x6')],'transfererexten':_0xf0698c['transfererexten'],'transfererlinkedid':_0xf0698c[_0xaca4('0x7')],'transfereechannel':_0xf0698c[_0xaca4('0x8')],'transfereecalleridnum':_0xf0698c[_0xaca4('0x9')],'transfereecalleridname':_0xf0698c[_0xaca4('0xa')],'transfereeconnectedlinenum':_0xf0698c[_0xaca4('0xb')],'transfereeconnectedlinename':_0xf0698c[_0xaca4('0xc')],'transfereeaccountcode':_0xf0698c[_0xaca4('0xd')],'transfereecontext':_0xf0698c[_0xaca4('0xe')],'transfereeexten':_0xf0698c['transfereeexten'],'transfereelinkedid':_0xf0698c[_0xaca4('0xf')],'isexternal':_0xf0698c[_0xaca4('0x10')],'context':_0xf0698c[_0xaca4('0x11')],'extension':_0xf0698c[_0xaca4('0x12')],'type':_0xaca4('0x13')},'log':_0xaca4('0x14')});};exports['attendedTransfer']=function(_0x59260b){return client[_0xaca4('0x15')](_0xaca4('0x14'),{'body':{'result':_0x59260b['result'],'transfererchannel':_0x59260b[_0xaca4('0x16')],'transferercalleridnum':_0x59260b['origtransferercalleridnum'],'transferercalleridname':_0x59260b[_0xaca4('0x17')],'transfererconnectedlinenum':_0x59260b[_0xaca4('0x18')],'transfererconnectedlinename':_0x59260b[_0xaca4('0x19')],'transfereraccountcode':_0x59260b[_0xaca4('0x1a')],'transferercontext':_0x59260b[_0xaca4('0x1b')],'transfererexten':_0x59260b[_0xaca4('0x1c')],'transfererlinkedid':_0x59260b[_0xaca4('0x1d')],'transfereechannel':_0x59260b['transfertargetchannel'],'transfereecalleridnum':_0x59260b[_0xaca4('0x1e')],'transfereecalleridname':_0x59260b[_0xaca4('0x1f')],'transfereeconnectedlinenum':_0x59260b[_0xaca4('0x20')],'transfereeconnectedlinename':_0x59260b[_0xaca4('0x21')],'transfereeaccountcode':_0x59260b[_0xaca4('0x22')],'transfereecontext':_0x59260b['transfertargetcontext'],'transfereeexten':_0x59260b[_0xaca4('0x23')],'transfereelinkedid':_0x59260b[_0xaca4('0x24')],'isexternal':_0x59260b['isexternal'],'context':_0x59260b['origtransferercontext'],'extension':_0x59260b[_0xaca4('0x25')],'type':_0xaca4('0x26')},'log':_0xaca4('0x14')});}; \ No newline at end of file +var _0xbe75=['transferercontext','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','blind','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','../client','transfers','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereraccountcode'];(function(_0x2c8721,_0x3fc894){var _0x418aa0=function(_0x4f3da7){while(--_0x4f3da7){_0x2c8721['push'](_0x2c8721['shift']());}};_0x418aa0(++_0x3fc894);}(_0xbe75,0x1a5));var _0x5be7=function(_0x40eb34,_0x573c32){_0x40eb34=_0x40eb34-0x0;var _0x4bcb07=_0xbe75[_0x40eb34];return _0x4bcb07;};'use strict';var client=require(_0x5be7('0x0'));exports[_0x5be7('0x1')]={};exports['blindTransfer']=function(_0x369ba8){return client['Request'](_0x5be7('0x2'),{'body':{'result':_0x369ba8[_0x5be7('0x3')],'transfererchannel':_0x369ba8['transfererchannel'],'transferercalleridnum':_0x369ba8[_0x5be7('0x4')],'transferercalleridname':_0x369ba8[_0x5be7('0x5')],'transfererconnectedlinenum':_0x369ba8[_0x5be7('0x6')],'transfererconnectedlinename':_0x369ba8['transfererconnectedlinename'],'transfereraccountcode':_0x369ba8[_0x5be7('0x7')],'transferercontext':_0x369ba8[_0x5be7('0x8')],'transfererexten':_0x369ba8['transfererexten'],'transfererlinkedid':_0x369ba8['transfererlinkedid'],'transfereechannel':_0x369ba8['transfereechannel'],'transfereecalleridnum':_0x369ba8[_0x5be7('0x9')],'transfereecalleridname':_0x369ba8['transfereecalleridname'],'transfereeconnectedlinenum':_0x369ba8[_0x5be7('0xa')],'transfereeconnectedlinename':_0x369ba8[_0x5be7('0xb')],'transfereeaccountcode':_0x369ba8[_0x5be7('0xc')],'transfereecontext':_0x369ba8['transfereecontext'],'transfereeexten':_0x369ba8[_0x5be7('0xd')],'transfereelinkedid':_0x369ba8[_0x5be7('0xe')],'isexternal':_0x369ba8[_0x5be7('0xf')],'context':_0x369ba8[_0x5be7('0x10')],'extension':_0x369ba8['extension'],'type':_0x5be7('0x11')},'log':_0x5be7('0x2')});};exports['attendedTransfer']=function(_0x230493){return client['Request'](_0x5be7('0x2'),{'body':{'result':_0x230493[_0x5be7('0x3')],'transfererchannel':_0x230493[_0x5be7('0x12')],'transferercalleridnum':_0x230493[_0x5be7('0x13')],'transferercalleridname':_0x230493[_0x5be7('0x14')],'transfererconnectedlinenum':_0x230493[_0x5be7('0x15')],'transfererconnectedlinename':_0x230493[_0x5be7('0x16')],'transfereraccountcode':_0x230493['origtransfereraccountcode'],'transferercontext':_0x230493[_0x5be7('0x17')],'transfererexten':_0x230493['secondtransfererexten'],'transfererlinkedid':_0x230493[_0x5be7('0x18')],'transfereechannel':_0x230493[_0x5be7('0x19')],'transfereecalleridnum':_0x230493['transfertargetcalleridnum'],'transfereecalleridname':_0x230493['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x230493[_0x5be7('0x1a')],'transfereeconnectedlinename':_0x230493[_0x5be7('0x1b')],'transfereeaccountcode':_0x230493['transfertargetaccountcode'],'transfereecontext':_0x230493[_0x5be7('0x1c')],'transfereeexten':_0x230493[_0x5be7('0x1d')],'transfereelinkedid':_0x230493[_0x5be7('0x1e')],'isexternal':_0x230493[_0x5be7('0xf')],'context':_0x230493[_0x5be7('0x1f')],'extension':_0x230493[_0x5be7('0x20')],'type':'attended'},'log':_0x5be7('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index e795b24..97062f4 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 _0xdbf5=['outbound','includes','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','exten','context','agents','telephones','trunks','outboundChannels','run','event','Event\x20name\x20mandatory','emit','send','checkAfterSend','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','moment','../../../config/environment','../properties','../ami','../model/voiceQueueSummary','listen','%s/%s','SIP','name','timers','updateAcw','updateStatusRealtime','QueuePause','asterisk','ami\x20disconnected','join','pick','keys','reload','module','action','then','message','catch','isConnected','error','command','Command','Action','content','voiceQueues','hasOwnProperty','push','length','find','undefined','values','channels','username','voicechannel','validate','map','uniqueid','channel','format','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','%s.%s','stop','StopMixMonitor\x20Success','queueChannels','type','inbound'];(function(_0x3102ab,_0x481c69){var _0x232720=function(_0x47cdf5){while(--_0x47cdf5){_0x3102ab['push'](_0x3102ab['shift']());}};_0x232720(++_0x481c69);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x2b1a5c,_0x4e3f8e){_0x2b1a5c=_0x2b1a5c-0x0;var _0x3f16a7=_0xdbf5[_0x2b1a5c];return _0x3f16a7;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var jayson=require('jayson/promise');var schema=require('validate');var moment=require(_0x5dbf('0x1'));var config=require(_0x5dbf('0x2'));var properties=require(_0x5dbf('0x3'));var ami=require(_0x5dbf('0x4'));var VoiceQueueSummary=require(_0x5dbf('0x5'));exports[_0x5dbf('0x6')]=function(_0x776036,_0x1decd2,_0x3f8628){return new Promise(function(_0x3f8222,_0x209b7d){var _0x88128e={'QueuePause':function(_0x93e657){return new Promise(function(_0x52b039){var _0x134810=util['format'](_0x5dbf('0x7'),_0x5dbf('0x8'),_0x93e657[_0x5dbf('0x9')]);if(_0x776036[_0x5dbf('0xa')]&&_0x776036['timers'][_0x134810]&&_0x776036[_0x5dbf('0xa')][_0x134810]['timer']){_0x776036['timers'][_0x134810][_0x5dbf('0xb')]();}if(_0x776036['agents'][_0x134810]){_0x776036['agents'][_0x134810][_0x5dbf('0xc')]({'statePause':_0x93e657['pause']?!![]:![]});}_0x52b039({'code':0xc8,'message':_0x5dbf('0xd')});});},'Reload':function(_0x2bb7ed){var _0x1453a9=this;return new Promise(function(_0x7cb848,_0x14493a){if(ami['isConnected']()==![]){return _0x14493a(_0x1453a9['error'](0x1f4,[config[_0x5dbf('0xe')]['ip'],config[_0x5dbf('0xe')]['username'],_0x5dbf('0xf')][_0x5dbf('0x10')]('\x20')));}_0x2bb7ed=_[_0x5dbf('0x11')](_0x2bb7ed,_[_0x5dbf('0x12')](properties[_0x5dbf('0x13')][_0x5dbf('0x14')]));_0x2bb7ed[_0x5dbf('0x15')]='Reload';return ami['Action'](_0x2bb7ed)[_0x5dbf('0x16')](function(_0xc4cb1c){_0x7cb848({'code':0xc8,'message':_0xc4cb1c[_0x5dbf('0x17')]});})[_0x5dbf('0x18')](function(_0x20c2b0){_0x14493a(_0x1453a9['error'](0x1f5,_0x20c2b0[_0x5dbf('0x17')]));});});},'Command':function(_0x4dd03c){var _0x565efa=this;return new Promise(function(_0x577ca2,_0x23d1e7){if(ami[_0x5dbf('0x19')]()==![]){return _0x23d1e7(_0x565efa[_0x5dbf('0x1a')](0x1f4,[config[_0x5dbf('0xe')]['ip'],config[_0x5dbf('0xe')]['username'],_0x5dbf('0xf')]['join']('\x20')));}_0x4dd03c=_[_0x5dbf('0x11')](_0x4dd03c,_0x5dbf('0x1b'));_0x4dd03c[_0x5dbf('0x15')]=_0x5dbf('0x1c');return ami[_0x5dbf('0x1d')](_0x4dd03c)[_0x5dbf('0x16')](function(_0x58085e){_0x577ca2({'code':0xc8,'message':_0x58085e[_0x5dbf('0x1e')]});})[_0x5dbf('0x18')](function(_0x2d3e1b){_0x23d1e7(_0x565efa[_0x5dbf('0x1a')](0x1f5,_0x2d3e1b[_0x5dbf('0x17')]));});});},'VoiceQueues':function(){return new Promise(function(_0x226b93){var _0x290456=[];for(var _0x20ab1b in _0x776036[_0x5dbf('0x1f')]){if(_0x776036[_0x5dbf('0x1f')][_0x5dbf('0x20')](_0x20ab1b)){var _0x232c77=_0x776036[_0x5dbf('0x1f')][_0x20ab1b];var _0x407741=new VoiceQueueSummary(_0x232c77);_0x290456[_0x5dbf('0x21')](_0x407741);}}_0x226b93({'count':_0x290456[_0x5dbf('0x22')],'rows':_0x290456});});},'UpdateVoiceQueue':function(_0x466985){return new Promise(function(_0x3f8341,_0x159e61){var _0x22ec42=_[_0x5dbf('0x23')](_0x776036[_0x5dbf('0x1f')],{'id':parseInt(_0x466985['id'])});var _0x21cd00=_['omit'](_0x466985,['id']);if(_0x22ec42){for(var _0x2f71eb in _0x21cd00){if(typeof _0x21cd00[_0x2f71eb]!==_0x5dbf('0x24')&&typeof _0x22ec42[_0x2f71eb]!==_0x5dbf('0x24')){_0x22ec42[_0x2f71eb]=_0x21cd00[_0x2f71eb];}}_0x3f8341(_0x22ec42);}else{_0x159e61();}});},'VoiceChannels':function(){return new Promise(function(_0x1fb9a7){var _0x38825a=_[_0x5dbf('0x25')](_0x776036[_0x5dbf('0x26')]);_0x1fb9a7({'count':_0x38825a[_0x5dbf('0x22')],'rows':_0x38825a});});},'VoiceChannelMixMonitor':function(_0x406ce6){var _0x273b63=this;return new Promise(function(_0x294dd7,_0x50a307){if(ami['isConnected']()==![]){return _0x50a307(_0x273b63[_0x5dbf('0x1a')](0x1f4,[config[_0x5dbf('0xe')]['ip'],config[_0x5dbf('0xe')][_0x5dbf('0x27')],_0x5dbf('0xf')]['join']('\x20')));}var _0x5cc3f1=schema(properties[_0x5dbf('0x28')])[_0x5dbf('0x29')](_0x406ce6);if(_0x5cc3f1['length']>0x0){return _0x50a307(_0x273b63[_0x5dbf('0x1a')](0x1f4,_[_0x5dbf('0x2a')](_0x5cc3f1,_0x5dbf('0x17'))[_0x5dbf('0x10')](',\x20')));}var _0x27e058=_['find'](_0x776036[_0x5dbf('0x26')],{'uniqueid':_0x406ce6[_0x5dbf('0x2b')]});if(_0x27e058&&_0x27e058[_0x5dbf('0x2c')]){var _0x273577=util[_0x5dbf('0x2d')]('%s.%s',_0x406ce6[_0x5dbf('0x2e')]||_0x406ce6[_0x5dbf('0x2b')],_0x406ce6[_0x5dbf('0x2d')]||_0x5dbf('0x2f'));return ami['Action']({'action':_0x5dbf('0x30'),'channel':_0x27e058[_0x5dbf('0x2c')],'file':_0x273577,'options':_0x5dbf('0x31')})[_0x5dbf('0x16')](function(_0x3e309a){var _0x843d9a=_[_0x5dbf('0x23')](_0x27e058[_0x5dbf('0x32')],{'filename':_0x5dbf('0x33')+_0x273577[_0x5dbf('0x34')]()});if(_[_0x5dbf('0x35')](_0x843d9a)){_0x27e058['monitors'][_0x5dbf('0x21')]({'filename':_0x5dbf('0x33')+_0x273577[_0x5dbf('0x34')](),'createdAt':moment()['format'](_0x5dbf('0x36')),'mixmonitorid':_0x3e309a[_0x5dbf('0x37')],'status':_0x5dbf('0x38')});}else{_0x843d9a['mixmonitorid']=_0x3e309a[_0x5dbf('0x37')];_0x843d9a[_0x5dbf('0x39')]=_0x5dbf('0x38');}_0x294dd7({'code':0xc8,'message':[_0x406ce6['uniqueid'],_0x5dbf('0x3a'),_0x3e309a[_0x5dbf('0x37')]][_0x5dbf('0x10')]('\x20'),'mixmonitorid':_0x3e309a[_0x5dbf('0x37')]});})[_0x5dbf('0x18')](function(_0x6ebcc6){_0x50a307(_0x273b63[_0x5dbf('0x1a')](0x1f5,[_0x406ce6[_0x5dbf('0x2b')],_0x6ebcc6['message']['toLowerCase']()]['join']('\x20')));});}else{return _0x50a307(_0x273b63['error'](0x1f5,_0x5dbf('0x3b')));}});},'VoiceChannelStopMixMonitor':function(_0x21122d){var _0x54e5e7=this;return new Promise(function(_0x3ef0eb,_0x229abf){if(ami['isConnected']()==![]){return _0x229abf(_0x54e5e7[_0x5dbf('0x1a')](0x1f4,[config[_0x5dbf('0xe')]['ip'],config[_0x5dbf('0xe')][_0x5dbf('0x27')],_0x5dbf('0xf')][_0x5dbf('0x10')]('\x20')));}var _0x2745df=schema(properties[_0x5dbf('0x28')])[_0x5dbf('0x29')](_0x21122d);if(_0x2745df[_0x5dbf('0x22')]>0x0){return _0x229abf(_0x54e5e7['error'](0x1f4,_[_0x5dbf('0x2a')](_0x2745df,_0x5dbf('0x17'))[_0x5dbf('0x10')](',\x20')));}var _0x50880d=_[_0x5dbf('0x23')](_0x776036[_0x5dbf('0x26')],{'uniqueid':_0x21122d[_0x5dbf('0x2b')]});if(_0x50880d){return Promise[_0x5dbf('0x3c')]()['then'](function(){if(_0x50880d[_0x5dbf('0x2c')]){return ami['Action']({'action':_0x5dbf('0x3d'),'channel':_0x50880d[_0x5dbf('0x2c')],'mixmonitorid':_0x21122d[_0x5dbf('0x37')]})[_0x5dbf('0x18')](function(){});}})['then'](function(){if(_0x50880d['destinationchannel']){return ami[_0x5dbf('0x1d')]({'action':_0x5dbf('0x3d'),'channel':_0x50880d[_0x5dbf('0x3e')],'mixmonitorid':_0x21122d['mixmonitorid']})[_0x5dbf('0x18')](function(){});}})['then'](function(){var _0x4d8df1=_['find'](_0x50880d['monitors'],{'mixmonitorid':_0x21122d[_0x5dbf('0x37')]});if(_0x4d8df1){_0x4d8df1[_0x5dbf('0x39')]='stop';}})[_0x5dbf('0x16')](function(){var _0x3ba5cb=util['format'](_0x5dbf('0x3f'),_0x21122d[_0x5dbf('0x2e')]||_0x21122d['uniqueid'],_0x21122d[_0x5dbf('0x2d')]||'wav');var _0x5ab862=_[_0x5dbf('0x23')](_0x50880d[_0x5dbf('0x32')],{'filename':_0x5dbf('0x33')+_0x3ba5cb['toLowerCase']()});if(_0x5ab862){_0x5ab862['status']=_0x5dbf('0x40');}})[_0x5dbf('0x16')](function(){_0x3ef0eb({'code':0xc8,'message':[_0x21122d[_0x5dbf('0x2b')],_0x5dbf('0x41')][_0x5dbf('0x10')]('\x20')});})[_0x5dbf('0x18')](function(_0x3b49c6){_0x229abf(_0x54e5e7[_0x5dbf('0x1a')](0x1f5,[_0x21122d['uniqueid'],_0x3b49c6[_0x5dbf('0x17')][_0x5dbf('0x34')]()][_0x5dbf('0x10')]('\x20')));});}else{return _0x229abf(_0x54e5e7[_0x5dbf('0x1a')](0x1f5,_0x5dbf('0x3b')));}});},'VoiceQueuesChannels':function(_0x3cc286){var _0x328dc5=this;return new Promise(function(_0x59f825){var _0x1b0b13=_['values'](_0x776036[_0x5dbf('0x42')]);var _0x1a5d82={'count':_0x1b0b13[_0x5dbf('0x22')],'rows':_0x1b0b13};if(_0x3cc286&&_0x3cc286[_0x5dbf('0x43')]){if(![_0x5dbf('0x44'),_0x5dbf('0x45')][_0x5dbf('0x46')](_0x3cc286['type'])){return _0x209b7d(_0x328dc5['error'](0x190,'Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound'));}var _0x1e1876=_[_0x5dbf('0x47')](_0x1b0b13,function(_0x36a787){return _0x36a787['type']===_0x3cc286['type'];});_0x1a5d82[_0x5dbf('0x48')]=_0x1e1876[_0x5dbf('0x22')];_0x1a5d82[_0x5dbf('0x49')]=_0x1e1876;}_0x59f825(_0x1a5d82);});},'VoiceQueuesChannel':function(_0x5d70cc){var _0x2c9876=this;return new Promise(function(_0x56633d,_0x3ce224){var _0x37f16f=schema(properties[_0x5dbf('0x4a')])['validate'](_0x5d70cc);if(_0x37f16f['length']>0x0){return _0x3ce224(_0x2c9876[_0x5dbf('0x1a')](0x1f4,_[_0x5dbf('0x2a')](_0x37f16f,_0x5dbf('0x17'))[_0x5dbf('0x10')](',\x20')));}var _0x4c034f=_[_0x5dbf('0x23')](_0x776036[_0x5dbf('0x42')],{'uniqueid':_0x5d70cc['uniqueid']});if(_0x4c034f){_0x56633d(_0x4c034f);}else{return _0x3ce224(_0x2c9876['error'](0x1f5,_0x5dbf('0x3b')));}});},'VoiceQueuesChannelHangup':function(_0x14bdb1){var _0x197e8c=this;return new Promise(function(_0x20ee69,_0x3e13cb){if(ami[_0x5dbf('0x19')]()==![]){return _0x3e13cb(_0x197e8c['error'](0x1f4,[config[_0x5dbf('0xe')]['ip'],config['asterisk']['username'],'ami\x20disconnected'][_0x5dbf('0x10')]('\x20')));}var _0x5f2005=schema(properties[_0x5dbf('0x4b')])[_0x5dbf('0x29')](_0x14bdb1);if(_0x5f2005[_0x5dbf('0x22')]>0x0){return _0x3e13cb(_0x197e8c[_0x5dbf('0x1a')](0x1f4,_[_0x5dbf('0x2a')](_0x5f2005,_0x5dbf('0x17'))[_0x5dbf('0x10')](',\x20')));}var _0x100d83=_[_0x5dbf('0x23')](_0x776036[_0x5dbf('0x42')],{'uniqueid':_0x14bdb1[_0x5dbf('0x2b')]});if(_0x100d83&&_0x100d83[_0x5dbf('0x2c')]){return ami[_0x5dbf('0x1d')]({'action':_0x5dbf('0x4c'),'channel':_0x100d83[_0x5dbf('0x2c')]})['then'](function(_0x3fbc3d){_0x20ee69({'code':0xc8,'message':[_0x14bdb1['uniqueid'],_0x3fbc3d[_0x5dbf('0x17')][_0x5dbf('0x34')]()][_0x5dbf('0x10')]('\x20')});})[_0x5dbf('0x18')](function(_0x5a975a){_0x3e13cb(_0x197e8c[_0x5dbf('0x1a')](0x1f5,[_0x14bdb1[_0x5dbf('0x2b')],_0x5a975a[_0x5dbf('0x17')][_0x5dbf('0x34')]()][_0x5dbf('0x10')]('\x20')));});}else{return _0x3e13cb(_0x197e8c[_0x5dbf('0x1a')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x5ccda4){var _0x3e5a96=this;return new Promise(function(_0x3b0465,_0x18bc53){if(ami[_0x5dbf('0x19')]()==![]){return _0x18bc53(_0x3e5a96[_0x5dbf('0x1a')](0x1f4,[config[_0x5dbf('0xe')]['ip'],config[_0x5dbf('0xe')][_0x5dbf('0x27')],_0x5dbf('0xf')][_0x5dbf('0x10')]('\x20')));}var _0x2997a8=schema(properties['voicequeuechannelredirect'])['validate'](_0x5ccda4);if(_0x2997a8[_0x5dbf('0x22')]>0x0){return _0x18bc53(_0x3e5a96[_0x5dbf('0x1a')](0x1f4,_[_0x5dbf('0x2a')](_0x2997a8,_0x5dbf('0x17'))[_0x5dbf('0x10')](',\x20')));}var _0x377d52=_[_0x5dbf('0x23')](_0x776036[_0x5dbf('0x42')],{'uniqueid':_0x5ccda4[_0x5dbf('0x2b')]});if(_0x377d52&&_0x377d52['channel']){return ami['Action']({'action':'Redirect','channel':_0x377d52['channel'],'exten':_0x5ccda4[_0x5dbf('0x4d')],'context':_0x5ccda4[_0x5dbf('0x4e')]||_0x377d52[_0x5dbf('0x4e')],'priority':0x1})[_0x5dbf('0x16')](function(_0x29c4d9){_0x3b0465({'code':0xc8,'message':[_0x5ccda4[_0x5dbf('0x2b')],_0x29c4d9['message']['toLowerCase']()][_0x5dbf('0x10')]('\x20')});})[_0x5dbf('0x18')](function(_0x5e84ab){_0x18bc53(_0x3e5a96[_0x5dbf('0x1a')](0x1f5,[_0x5ccda4[_0x5dbf('0x2b')],_0x5e84ab[_0x5dbf('0x17')][_0x5dbf('0x34')]()]['join']('\x20')));});}else{return _0x18bc53(_0x3e5a96[_0x5dbf('0x1a')](0x1f5,_0x5dbf('0x3b')));}});},'Agents':function(_0x131100){return new Promise(function(_0x1afaff){var _0x2aed16=_['values'](_0x776036[_0x5dbf('0x4f')]);if(_0x131100&&_0x131100['id']){var _0x3fce29=_[_0x5dbf('0x23')](_0x2aed16,function(_0x242e02){return _0x242e02['id']===_0x131100['id'];});_0x1afaff(_0x3fce29);}else{_0x1afaff({'count':_0x2aed16['length'],'rows':_0x2aed16});}});},'Telephones':function(){return new Promise(function(_0x11db7e){var _0x5b75a2=_[_0x5dbf('0x25')](_0x776036[_0x5dbf('0x50')]);_0x11db7e({'count':_0x5b75a2[_0x5dbf('0x22')],'rows':_0x5b75a2});});},'Trunks':function(){return new Promise(function(_0x5f2d67){var _0x46db8d=_[_0x5dbf('0x25')](_0x776036[_0x5dbf('0x51')]);_0x5f2d67({'count':_0x46db8d[_0x5dbf('0x22')],'rows':_0x46db8d});});},'OutboundChannels':function(){return new Promise(function(_0x50db0b){var _0x1f9d2d=_[_0x5dbf('0x25')](_0x776036[_0x5dbf('0x52')]);_0x50db0b({'count':_0x1f9d2d[_0x5dbf('0x22')],'rows':_0x1f9d2d});});},'Outbound':function(){return new Promise(function(_0x392a9b){_0x392a9b(_0x776036[_0x5dbf('0x45')]);});},'Campaigns':function(){return new Promise(function(_0x560d62){var _0x1efc21=_[_0x5dbf('0x25')](_0x776036['campaigns']);_0x560d62({'count':_0x1efc21[_0x5dbf('0x22')],'rows':_0x1efc21});});},'VoiceQueuesPreview':function(_0x2754bb){var _0x1a71fe=this;return new Promise(function(_0x3457de,_0x252be1){_0x1decd2[_0x5dbf('0x53')](_0x2754bb['id'])[_0x5dbf('0x16')](function(_0xdc4439){_0x3457de({'code':0xc8,'message':_0xdc4439[_0x5dbf('0x17')]});})[_0x5dbf('0x18')](function(_0x1fa250){_0x252be1(_0x1a71fe[_0x5dbf('0x1a')](0x1f4,_0x1fa250[_0x5dbf('0x17')]));});});},'EventManager':function(_0x248c1d){var _0x19f5ab=this;return new Promise(function(_0x37c1a3,_0x542667){if(!_0x248c1d[_0x5dbf('0x54')]){return _0x542667(_0x19f5ab[_0x5dbf('0x1a')](0x1f4,_0x5dbf('0x55')));}ami[_0x5dbf('0x56')]('custom:'+_0x248c1d[_0x5dbf('0x54')],_0x248c1d[_0x5dbf('0x17')]);_0x37c1a3({'code':0xc8,'message':_0x248c1d});});},'FaxAccounts':function(){return new Promise(function(_0x29a71a){var _0x42df4d=_[_0x5dbf('0x25')](_0x776036['faxAccounts']);_0x29a71a({'count':_0x42df4d[_0x5dbf('0x22')],'rows':_0x42df4d});});},'SendFax':function(_0x1ba14c){var _0x4e0117=this;return new Promise(function(_0x5d02f7,_0x3dac55){_0x3f8628[_0x5dbf('0x57')](_0x1ba14c)[_0x5dbf('0x16')](function(_0x8ca7de){_0x5d02f7({'code':0xc8,'message':_0x8ca7de[_0x5dbf('0x17')]});})[_0x5dbf('0x18')](function(_0x22339b){_0x3dac55(_0x4e0117['error'](0x1f4,_0x22339b[_0x5dbf('0x17')]));});});},'CheckAfterSend':function(_0x3b01c0){var _0x25c831=this;return new Promise(function(_0x1dd5b4,_0x39e600){_0x3f8628[_0x5dbf('0x58')](_0x3b01c0)['then'](function(_0x625875){_0x1dd5b4({'code':0xc8,'message':_0x625875[_0x5dbf('0x17')]});})[_0x5dbf('0x18')](function(_0x2c5a6e){_0x39e600(_0x25c831[_0x5dbf('0x1a')](0x1f4,_0x2c5a6e['message']));});});}};var _0x2ef784=jayson['server'](_0x88128e)['http']();_0x2ef784['on']('error',function(_0x496306){return _0x209b7d(_0x496306);});_0x2ef784[_0x5dbf('0x6')](0x232a,_0x5dbf('0x59'),function(){console[_0x5dbf('0x5a')](_0x5dbf('0x5b'),0x232a);return _0x3f8222(_0x5dbf('0x5c')+0x232a);});});}; \ No newline at end of file +var _0x032e=['voicequeuechannelhangup','Hangup','Redirect','exten','context','telephones','outboundChannels','campaigns','event','custom:','faxAccounts','send','checkAfterSend','http','log','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','keys','reload','module','action','Reload','Action','message','catch','command','Command','then','content','voiceQueues','hasOwnProperty','push','omit','undefined','values','channels','length','uniqueid','%s.%s','filename','MixMonitor','ai(mixmonitorid)','find','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','voicechannel','map','resolve','channel','StopMixMonitor','destinationchannel','wav','stop','StopMixMonitor\x20Success','queueChannels','type','inbound','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','count','rows','voicequeuechannel'];(function(_0x5411a8,_0x36ddb1){var _0x2c047c=function(_0x235fbf){while(--_0x235fbf){_0x5411a8['push'](_0x5411a8['shift']());}};_0x2c047c(++_0x36ddb1);}(_0x032e,0x124));var _0xe032=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x032e[_0x433a86];return _0x23000c;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var jayson=require(_0xe032('0x1'));var schema=require(_0xe032('0x2'));var moment=require('moment');var config=require('../../../config/environment');var properties=require(_0xe032('0x3'));var ami=require(_0xe032('0x4'));var VoiceQueueSummary=require(_0xe032('0x5'));exports[_0xe032('0x6')]=function(_0x306f3d,_0x420020,_0x2ba8a0){return new Promise(function(_0x33ad0b,_0x37432f){var _0x1576c8={'QueuePause':function(_0x3289b0){return new Promise(function(_0xd84027){var _0xaf3907=util[_0xe032('0x7')](_0xe032('0x8'),_0xe032('0x9'),_0x3289b0[_0xe032('0xa')]);if(_0x306f3d[_0xe032('0xb')]&&_0x306f3d['timers'][_0xaf3907]&&_0x306f3d[_0xe032('0xb')][_0xaf3907][_0xe032('0xc')]){_0x306f3d[_0xe032('0xb')][_0xaf3907][_0xe032('0xd')]();}if(_0x306f3d[_0xe032('0xe')][_0xaf3907]){_0x306f3d[_0xe032('0xe')][_0xaf3907][_0xe032('0xf')]({'statePause':_0x3289b0['pause']?!![]:![]});}_0xd84027({'code':0xc8,'message':_0xe032('0x10')});});},'Reload':function(_0x266d71){var _0x28c2b6=this;return new Promise(function(_0x1a53ab,_0x4aee44){if(ami[_0xe032('0x11')]()==![]){return _0x4aee44(_0x28c2b6[_0xe032('0x12')](0x1f4,[config[_0xe032('0x13')]['ip'],config[_0xe032('0x13')][_0xe032('0x14')],_0xe032('0x15')][_0xe032('0x16')]('\x20')));}_0x266d71=_['pick'](_0x266d71,_[_0xe032('0x17')](properties[_0xe032('0x18')][_0xe032('0x19')]));_0x266d71[_0xe032('0x1a')]=_0xe032('0x1b');return ami[_0xe032('0x1c')](_0x266d71)['then'](function(_0x155f72){_0x1a53ab({'code':0xc8,'message':_0x155f72[_0xe032('0x1d')]});})[_0xe032('0x1e')](function(_0x41d2a5){_0x4aee44(_0x28c2b6[_0xe032('0x12')](0x1f5,_0x41d2a5['message']));});});},'Command':function(_0x4b644b){var _0x484e6c=this;return new Promise(function(_0x15475c,_0x505d8c){if(ami[_0xe032('0x11')]()==![]){return _0x505d8c(_0x484e6c[_0xe032('0x12')](0x1f4,[config[_0xe032('0x13')]['ip'],config[_0xe032('0x13')][_0xe032('0x14')],_0xe032('0x15')][_0xe032('0x16')]('\x20')));}_0x4b644b=_['pick'](_0x4b644b,_0xe032('0x1f'));_0x4b644b[_0xe032('0x1a')]=_0xe032('0x20');return ami[_0xe032('0x1c')](_0x4b644b)[_0xe032('0x21')](function(_0x33d89a){_0x15475c({'code':0xc8,'message':_0x33d89a[_0xe032('0x22')]});})[_0xe032('0x1e')](function(_0x499da5){_0x505d8c(_0x484e6c['error'](0x1f5,_0x499da5['message']));});});},'VoiceQueues':function(){return new Promise(function(_0x4ef536){var _0x2568ce=[];for(var _0x302559 in _0x306f3d[_0xe032('0x23')]){if(_0x306f3d[_0xe032('0x23')][_0xe032('0x24')](_0x302559)){var _0x36ece7=_0x306f3d[_0xe032('0x23')][_0x302559];var _0x4dcbf1=new VoiceQueueSummary(_0x36ece7);_0x2568ce[_0xe032('0x25')](_0x4dcbf1);}}_0x4ef536({'count':_0x2568ce['length'],'rows':_0x2568ce});});},'UpdateVoiceQueue':function(_0x189ed4){return new Promise(function(_0x1af097,_0x3106aa){var _0x2a521b=_['find'](_0x306f3d['voiceQueues'],{'id':parseInt(_0x189ed4['id'])});var _0x3e2575=_[_0xe032('0x26')](_0x189ed4,['id']);if(_0x2a521b){for(var _0x469290 in _0x3e2575){if(typeof _0x3e2575[_0x469290]!==_0xe032('0x27')&&typeof _0x2a521b[_0x469290]!=='undefined'){_0x2a521b[_0x469290]=_0x3e2575[_0x469290];}}_0x1af097(_0x2a521b);}else{_0x3106aa();}});},'VoiceChannels':function(){return new Promise(function(_0x541aa8){var _0x4fe00e=_[_0xe032('0x28')](_0x306f3d[_0xe032('0x29')]);_0x541aa8({'count':_0x4fe00e[_0xe032('0x2a')],'rows':_0x4fe00e});});},'VoiceChannelMixMonitor':function(_0x707b){var _0x50db2d=this;return new Promise(function(_0x3b93e3,_0x236da9){if(ami[_0xe032('0x11')]()==![]){return _0x236da9(_0x50db2d[_0xe032('0x12')](0x1f4,[config[_0xe032('0x13')]['ip'],config['asterisk'][_0xe032('0x14')],_0xe032('0x15')][_0xe032('0x16')]('\x20')));}var _0x2cc18c=schema(properties['voicechannel'])[_0xe032('0x2')](_0x707b);if(_0x2cc18c['length']>0x0){return _0x236da9(_0x50db2d[_0xe032('0x12')](0x1f4,_['map'](_0x2cc18c,_0xe032('0x1d'))['join'](',\x20')));}var _0x2c1ec0=_['find'](_0x306f3d[_0xe032('0x29')],{'uniqueid':_0x707b[_0xe032('0x2b')]});if(_0x2c1ec0&&_0x2c1ec0['channel']){var _0x3e3598=util[_0xe032('0x7')](_0xe032('0x2c'),_0x707b[_0xe032('0x2d')]||_0x707b['uniqueid'],_0x707b[_0xe032('0x7')]||'wav');return ami[_0xe032('0x1c')]({'action':_0xe032('0x2e'),'channel':_0x2c1ec0['channel'],'file':_0x3e3598,'options':_0xe032('0x2f')})[_0xe032('0x21')](function(_0x4a4447){var _0x3efdef=_[_0xe032('0x30')](_0x2c1ec0[_0xe032('0x31')],{'filename':_0xe032('0x32')+_0x3e3598[_0xe032('0x33')]()});if(_[_0xe032('0x34')](_0x3efdef)){_0x2c1ec0[_0xe032('0x31')][_0xe032('0x25')]({'filename':_0xe032('0x32')+_0x3e3598[_0xe032('0x33')](),'createdAt':moment()[_0xe032('0x7')](_0xe032('0x35')),'mixmonitorid':_0x4a4447[_0xe032('0x36')],'status':_0xe032('0x37')});}else{_0x3efdef[_0xe032('0x36')]=_0x4a4447[_0xe032('0x36')];_0x3efdef[_0xe032('0x38')]='rec';}_0x3b93e3({'code':0xc8,'message':[_0x707b[_0xe032('0x2b')],'MixMonitor\x20Success',_0x4a4447[_0xe032('0x36')]][_0xe032('0x16')]('\x20'),'mixmonitorid':_0x4a4447[_0xe032('0x36')]});})[_0xe032('0x1e')](function(_0x468d47){_0x236da9(_0x50db2d['error'](0x1f5,[_0x707b[_0xe032('0x2b')],_0x468d47['message'][_0xe032('0x33')]()]['join']('\x20')));});}else{return _0x236da9(_0x50db2d[_0xe032('0x12')](0x1f5,_0xe032('0x39')));}});},'VoiceChannelStopMixMonitor':function(_0x2644a1){var _0x236198=this;return new Promise(function(_0x4dc836,_0x477360){if(ami['isConnected']()==![]){return _0x477360(_0x236198[_0xe032('0x12')](0x1f4,[config[_0xe032('0x13')]['ip'],config[_0xe032('0x13')][_0xe032('0x14')],'ami\x20disconnected']['join']('\x20')));}var _0x45345d=schema(properties[_0xe032('0x3a')])['validate'](_0x2644a1);if(_0x45345d[_0xe032('0x2a')]>0x0){return _0x477360(_0x236198[_0xe032('0x12')](0x1f4,_[_0xe032('0x3b')](_0x45345d,_0xe032('0x1d'))[_0xe032('0x16')](',\x20')));}var _0x4dafef=_[_0xe032('0x30')](_0x306f3d[_0xe032('0x29')],{'uniqueid':_0x2644a1[_0xe032('0x2b')]});if(_0x4dafef){return Promise[_0xe032('0x3c')]()[_0xe032('0x21')](function(){if(_0x4dafef[_0xe032('0x3d')]){return ami[_0xe032('0x1c')]({'action':_0xe032('0x3e'),'channel':_0x4dafef['channel'],'mixmonitorid':_0x2644a1['mixmonitorid']})[_0xe032('0x1e')](function(){});}})['then'](function(){if(_0x4dafef[_0xe032('0x3f')]){return ami[_0xe032('0x1c')]({'action':_0xe032('0x3e'),'channel':_0x4dafef[_0xe032('0x3f')],'mixmonitorid':_0x2644a1[_0xe032('0x36')]})[_0xe032('0x1e')](function(){});}})[_0xe032('0x21')](function(){var _0x4659c8=_[_0xe032('0x30')](_0x4dafef['monitors'],{'mixmonitorid':_0x2644a1[_0xe032('0x36')]});if(_0x4659c8){_0x4659c8['status']='stop';}})[_0xe032('0x21')](function(){var _0x2583e9=util[_0xe032('0x7')](_0xe032('0x2c'),_0x2644a1['filename']||_0x2644a1[_0xe032('0x2b')],_0x2644a1[_0xe032('0x7')]||_0xe032('0x40'));var _0x39ffb7=_[_0xe032('0x30')](_0x4dafef[_0xe032('0x31')],{'filename':_0xe032('0x32')+_0x2583e9['toLowerCase']()});if(_0x39ffb7){_0x39ffb7[_0xe032('0x38')]=_0xe032('0x41');}})['then'](function(){_0x4dc836({'code':0xc8,'message':[_0x2644a1[_0xe032('0x2b')],_0xe032('0x42')][_0xe032('0x16')]('\x20')});})[_0xe032('0x1e')](function(_0x1c509c){_0x477360(_0x236198[_0xe032('0x12')](0x1f5,[_0x2644a1[_0xe032('0x2b')],_0x1c509c[_0xe032('0x1d')][_0xe032('0x33')]()][_0xe032('0x16')]('\x20')));});}else{return _0x477360(_0x236198[_0xe032('0x12')](0x1f5,_0xe032('0x39')));}});},'VoiceQueuesChannels':function(_0x11beda){var _0x2f8114=this;return new Promise(function(_0x4eabfc){var _0x1c8b32=_['values'](_0x306f3d[_0xe032('0x43')]);var _0x36ec12={'count':_0x1c8b32[_0xe032('0x2a')],'rows':_0x1c8b32};if(_0x11beda&&_0x11beda[_0xe032('0x44')]){if(![_0xe032('0x45'),_0xe032('0x46')][_0xe032('0x47')](_0x11beda[_0xe032('0x44')])){return _0x37432f(_0x2f8114[_0xe032('0x12')](0x190,_0xe032('0x48')));}var _0x1b9012=_['filter'](_0x1c8b32,function(_0x414b73){return _0x414b73[_0xe032('0x44')]===_0x11beda['type'];});_0x36ec12[_0xe032('0x49')]=_0x1b9012['length'];_0x36ec12[_0xe032('0x4a')]=_0x1b9012;}_0x4eabfc(_0x36ec12);});},'VoiceQueuesChannel':function(_0x1f2422){var _0x20f25b=this;return new Promise(function(_0x414243,_0x467d0c){var _0x5f11f9=schema(properties[_0xe032('0x4b')])[_0xe032('0x2')](_0x1f2422);if(_0x5f11f9[_0xe032('0x2a')]>0x0){return _0x467d0c(_0x20f25b[_0xe032('0x12')](0x1f4,_[_0xe032('0x3b')](_0x5f11f9,_0xe032('0x1d'))[_0xe032('0x16')](',\x20')));}var _0x5c0423=_[_0xe032('0x30')](_0x306f3d[_0xe032('0x43')],{'uniqueid':_0x1f2422[_0xe032('0x2b')]});if(_0x5c0423){_0x414243(_0x5c0423);}else{return _0x467d0c(_0x20f25b[_0xe032('0x12')](0x1f5,_0xe032('0x39')));}});},'VoiceQueuesChannelHangup':function(_0x42c0d7){var _0x2c07e4=this;return new Promise(function(_0x3a8adb,_0x80d181){if(ami['isConnected']()==![]){return _0x80d181(_0x2c07e4[_0xe032('0x12')](0x1f4,[config[_0xe032('0x13')]['ip'],config[_0xe032('0x13')]['username'],_0xe032('0x15')][_0xe032('0x16')]('\x20')));}var _0x49a8bd=schema(properties[_0xe032('0x4c')])[_0xe032('0x2')](_0x42c0d7);if(_0x49a8bd[_0xe032('0x2a')]>0x0){return _0x80d181(_0x2c07e4[_0xe032('0x12')](0x1f4,_[_0xe032('0x3b')](_0x49a8bd,_0xe032('0x1d'))[_0xe032('0x16')](',\x20')));}var _0x202d8f=_[_0xe032('0x30')](_0x306f3d[_0xe032('0x43')],{'uniqueid':_0x42c0d7[_0xe032('0x2b')]});if(_0x202d8f&&_0x202d8f['channel']){return ami[_0xe032('0x1c')]({'action':_0xe032('0x4d'),'channel':_0x202d8f[_0xe032('0x3d')]})[_0xe032('0x21')](function(_0x3d7a3f){_0x3a8adb({'code':0xc8,'message':[_0x42c0d7['uniqueid'],_0x3d7a3f[_0xe032('0x1d')]['toLowerCase']()][_0xe032('0x16')]('\x20')});})[_0xe032('0x1e')](function(_0x26d358){_0x80d181(_0x2c07e4[_0xe032('0x12')](0x1f5,[_0x42c0d7[_0xe032('0x2b')],_0x26d358[_0xe032('0x1d')][_0xe032('0x33')]()][_0xe032('0x16')]('\x20')));});}else{return _0x80d181(_0x2c07e4[_0xe032('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x54711e){var _0x5c516a=this;return new Promise(function(_0x221473,_0x3c534b){if(ami[_0xe032('0x11')]()==![]){return _0x3c534b(_0x5c516a[_0xe032('0x12')](0x1f4,[config[_0xe032('0x13')]['ip'],config[_0xe032('0x13')]['username'],_0xe032('0x15')][_0xe032('0x16')]('\x20')));}var _0x1018d4=schema(properties['voicequeuechannelredirect'])[_0xe032('0x2')](_0x54711e);if(_0x1018d4['length']>0x0){return _0x3c534b(_0x5c516a[_0xe032('0x12')](0x1f4,_[_0xe032('0x3b')](_0x1018d4,'message')['join'](',\x20')));}var _0x542fcd=_[_0xe032('0x30')](_0x306f3d['queueChannels'],{'uniqueid':_0x54711e['uniqueid']});if(_0x542fcd&&_0x542fcd[_0xe032('0x3d')]){return ami[_0xe032('0x1c')]({'action':_0xe032('0x4e'),'channel':_0x542fcd['channel'],'exten':_0x54711e[_0xe032('0x4f')],'context':_0x54711e['context']||_0x542fcd[_0xe032('0x50')],'priority':0x1})[_0xe032('0x21')](function(_0x3b9dee){_0x221473({'code':0xc8,'message':[_0x54711e[_0xe032('0x2b')],_0x3b9dee[_0xe032('0x1d')][_0xe032('0x33')]()][_0xe032('0x16')]('\x20')});})[_0xe032('0x1e')](function(_0xc18f6f){_0x3c534b(_0x5c516a[_0xe032('0x12')](0x1f5,[_0x54711e[_0xe032('0x2b')],_0xc18f6f['message'][_0xe032('0x33')]()][_0xe032('0x16')]('\x20')));});}else{return _0x3c534b(_0x5c516a['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x228df8){return new Promise(function(_0xffd314){var _0x3b89b8=_[_0xe032('0x28')](_0x306f3d[_0xe032('0xe')]);if(_0x228df8&&_0x228df8['id']){var _0x23922e=_['find'](_0x3b89b8,function(_0x163aab){return _0x163aab['id']===_0x228df8['id'];});_0xffd314(_0x23922e);}else{_0xffd314({'count':_0x3b89b8[_0xe032('0x2a')],'rows':_0x3b89b8});}});},'Telephones':function(){return new Promise(function(_0x4fe7a6){var _0x97e141=_[_0xe032('0x28')](_0x306f3d[_0xe032('0x51')]);_0x4fe7a6({'count':_0x97e141['length'],'rows':_0x97e141});});},'Trunks':function(){return new Promise(function(_0x3e893b){var _0x3e63b3=_[_0xe032('0x28')](_0x306f3d['trunks']);_0x3e893b({'count':_0x3e63b3['length'],'rows':_0x3e63b3});});},'OutboundChannels':function(){return new Promise(function(_0xdd691c){var _0x529c5f=_[_0xe032('0x28')](_0x306f3d[_0xe032('0x52')]);_0xdd691c({'count':_0x529c5f[_0xe032('0x2a')],'rows':_0x529c5f});});},'Outbound':function(){return new Promise(function(_0x168dae){_0x168dae(_0x306f3d[_0xe032('0x46')]);});},'Campaigns':function(){return new Promise(function(_0x443fcc){var _0x5a893f=_[_0xe032('0x28')](_0x306f3d[_0xe032('0x53')]);_0x443fcc({'count':_0x5a893f[_0xe032('0x2a')],'rows':_0x5a893f});});},'VoiceQueuesPreview':function(_0x5b5ab9){var _0x2467ea=this;return new Promise(function(_0x48e9c9,_0x14c811){_0x420020['run'](_0x5b5ab9['id'])[_0xe032('0x21')](function(_0xa9d9a4){_0x48e9c9({'code':0xc8,'message':_0xa9d9a4[_0xe032('0x1d')]});})['catch'](function(_0x325925){_0x14c811(_0x2467ea[_0xe032('0x12')](0x1f4,_0x325925[_0xe032('0x1d')]));});});},'EventManager':function(_0x11ddd4){var _0x29de94=this;return new Promise(function(_0x2a2c98,_0x57b321){if(!_0x11ddd4[_0xe032('0x54')]){return _0x57b321(_0x29de94[_0xe032('0x12')](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0xe032('0x55')+_0x11ddd4[_0xe032('0x54')],_0x11ddd4[_0xe032('0x1d')]);_0x2a2c98({'code':0xc8,'message':_0x11ddd4});});},'FaxAccounts':function(){return new Promise(function(_0x3a06c0){var _0x33dd57=_['values'](_0x306f3d[_0xe032('0x56')]);_0x3a06c0({'count':_0x33dd57['length'],'rows':_0x33dd57});});},'SendFax':function(_0xbd3ae2){var _0x5b594d=this;return new Promise(function(_0x7106c5,_0xac9584){_0x2ba8a0[_0xe032('0x57')](_0xbd3ae2)[_0xe032('0x21')](function(_0x644b58){_0x7106c5({'code':0xc8,'message':_0x644b58[_0xe032('0x1d')]});})['catch'](function(_0x2b8435){_0xac9584(_0x5b594d['error'](0x1f4,_0x2b8435['message']));});});},'CheckAfterSend':function(_0x485458){var _0x37f53b=this;return new Promise(function(_0x22728c,_0x50cd07){_0x2ba8a0[_0xe032('0x58')](_0x485458)['then'](function(_0x5f42b1){_0x22728c({'code':0xc8,'message':_0x5f42b1[_0xe032('0x1d')]});})[_0xe032('0x1e')](function(_0x577f56){_0x50cd07(_0x37f53b['error'](0x1f4,_0x577f56[_0xe032('0x1d')]));});});}};var _0x476120=jayson['server'](_0x1576c8)[_0xe032('0x59')]();_0x476120['on'](_0xe032('0x12'),function(_0x1a0f96){return _0x37432f(_0x1a0f96);});_0x476120[_0xe032('0x6')](0x232a,'127.0.0.1',function(){console[_0xe032('0x5a')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x33ad0b(_0xe032('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 b0cb2be..626781f 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 _0x232f=['scheduledAt','union','resolve','then','getContacts','length','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','format','trigger:%s','action','toLowerCase','bluebird','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','info','stringify','emit','exec','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','destcalleridnum','calleridnum','routeId','firstName','lastName','mobile'];(function(_0x5848e1,_0x57cb47){var _0xb6069b=function(_0x4c38c1){while(--_0x4c38c1){_0x5848e1['push'](_0x5848e1['shift']());}};_0xb6069b(++_0x57cb47);}(_0x232f,0x7a));var _0xf232=function(_0xc4dbc9,_0x1aa6b6){_0xc4dbc9=_0xc4dbc9-0x0;var _0x531773=_0x232f[_0xc4dbc9];return _0x531773;};'use strict';var _=require('lodash');var BPromise=require(_0xf232('0x0'));var Redis=require(_0xf232('0x1'));var util=require('util');var config=require(_0xf232('0x2'));var logger=require(_0xf232('0x3'))('trigger');var cmContactRpc=require('../../rpc/cmContact');config[_0xf232('0x4')]=_[_0xf232('0x5')](config[_0xf232('0x4')],{'host':_0xf232('0x6'),'port':0x18eb});var io=require(_0xf232('0x7'))(new Redis(config['redis']));function emit(_0x483231,_0x540538,_0x5b14cd,_0x1597f5,_0x39e87b){logger[_0xf232('0x8')]('[CM][%s][%s]',_0x483231,_0x540538['id'],_0x5b14cd,_0x1597f5,JSON[_0xf232('0x9')](_0x39e87b));io['to'](_0x5b14cd)[_0xf232('0xa')](_0x1597f5,_0x39e87b);}exports[_0xf232('0xb')]=function(_0x5e43f1,_0xd0e10e,_0x359b47,_0x4e12a6){var _0x32cae0,_0x51deec;var _0x31f70a={};var _0x4a6373;var _0x7af7ca=Number(_0x359b47['data1']);var _0x5464f9=_0x359b47['data2']?Boolean(Number(_0x359b47[_0xf232('0xc')])):![];var _0x4db010;var _0xa59259=![];if(!_[_0xf232('0xd')](_0x359b47['data5'])){if(_0x359b47[_0xf232('0xe')]=='1')_0xa59259=!![];}if(!_0xa59259){if(_0x4e12a6[_0xf232('0xf')]){_0x31f70a['id']=_0x4e12a6[_0xf232('0xf')];}}if(!_0x31f70a['id']){_0x31f70a[_0xf232('0x10')]=_0x7af7ca;_0x4db010=_0x359b47[_0xf232('0x11')]&&_0x359b47[_0xf232('0x11')]!=='0'?_0x359b47[_0xf232('0x11')][_0xf232('0x12')](','):[_0xf232('0x13')];_0x31f70a[_0xf232('0x14')]=_[_0xf232('0x15')](_0x4db010,function(_0x42d8de){var _0x416a2d={};_0x416a2d[_0x42d8de]=_0x4e12a6['routeId']?_0x4e12a6[_0xf232('0x16')]:_0x4e12a6[_0xf232('0x17')];return _0x416a2d;});_0x4a6373=_0x4e12a6[_0xf232('0x18')]?_0x4e12a6[_0xf232('0x16')]:_0x4e12a6[_0xf232('0x17')];}var _0xf4fdbf=['id',_0xf232('0x19'),_0xf232('0x1a'),_0xf232('0x13'),_0xf232('0x1b'),'fax',_0xf232('0x10'),'createdAt',_0xf232('0x1c'),'updatedAt'];var _0x4f26ca=_[_0xf232('0x1d')](_0xf4fdbf,_0x4db010);BPromise[_0xf232('0x1e')]()[_0xf232('0x1f')](cmContactRpc[_0xf232('0x20')]({'attributes':_0x4f26ca,'where':_0x31f70a,'phone':_0x4a6373}))[_0xf232('0x1f')](function(_0x58d697){_0x51deec=_0x58d697;if(!_['isEmpty'](_0x51deec)){if(_0x51deec[_0xf232('0x21')]===0x1){_0x32cae0=_0x51deec[0x0];logger[_0xf232('0x8')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x4e12a6['uniqueid'],_0xd0e10e['id'],_0x32cae0['id']);}else{logger['info'](_0xf232('0x22'),_0x4e12a6[_0xf232('0x23')],_0xd0e10e['id'],_['map'](_0x51deec,'id')[_0xf232('0x24')](','));}return;}else{logger['info']('[CM][%s][%s]\x20Contact\x20not\x20found',_0x4e12a6[_0xf232('0x23')],_0xd0e10e['id']);var _0x18f304={'ListId':_0x7af7ca};var _0xc1577f=_0x359b47['data4']&&_0x359b47[_0xf232('0x25')]!=='0'?_0x359b47['data4']:_0xf232('0x13');if(_0x5464f9){logger[_0xf232('0x8')](_0xf232('0x26'),_0x4e12a6[_0xf232('0x23')],_0xd0e10e['id']);_0x18f304[_0xc1577f]=_['isNil'](_0x4e12a6[_0xf232('0x18')])?_0x4e12a6['calleridnum']:_0x4e12a6['destcalleridnum'];if(_[_0xf232('0xd')](_0x4e12a6[_0xf232('0x18')])){_0x18f304[_0xf232('0x19')]=_0x4e12a6[_0xf232('0x27')]&&_0x4e12a6[_0xf232('0x27')]!==_0xf232('0x28')?_0x4e12a6[_0xf232('0x27')]:_0xf232('0x29');}else{_0x18f304[_0xf232('0x19')]=_0x4e12a6[_0xf232('0x2a')]&&_0x4e12a6[_0xf232('0x2a')]!==_0xf232('0x28')?_0x4e12a6[_0xf232('0x2a')]:_0xf232('0x29');}return BPromise[_0xf232('0x1e')]()[_0xf232('0x1f')](cmContactRpc[_0xf232('0x2b')](_0x18f304))[_0xf232('0x1f')](function(_0x9b561f){_0x32cae0=_0x9b561f;_0x51deec[_0xf232('0x2c')](_0x9b561f);if(_0x32cae0){logger[_0xf232('0x8')](_0xf232('0x2d'),_0x4e12a6[_0xf232('0x23')],_0xd0e10e['id'],_0x32cae0['id']);}return;});}else{logger[_0xf232('0x8')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x4e12a6[_0xf232('0x23')],_0xd0e10e['id']);_0x18f304[_0xc1577f]=_['isNil'](_0x4e12a6['routeId'])?_0x4e12a6[_0xf232('0x17')]:_0x4e12a6[_0xf232('0x16')];if(_[_0xf232('0xd')](_0x4e12a6[_0xf232('0x18')])){_0x18f304['firstName']=_0x4e12a6[_0xf232('0x27')]&&_0x4e12a6[_0xf232('0x27')]!==_0xf232('0x28')?_0x4e12a6[_0xf232('0x27')]:'Unknown';}else{_0x18f304['firstName']=_0x4e12a6['destcalleridname']&&_0x4e12a6['destcalleridname']!==_0xf232('0x28')?_0x4e12a6[_0xf232('0x2a')]:_0xf232('0x29');}_0x32cae0=_0x18f304;_0x51deec[_0xf232('0x2c')](_0x18f304);return;}}})[_0xf232('0x1f')](function(){if(_0x5e43f1){emit(_0x4e12a6['uniqueid'],_0xd0e10e,util[_0xf232('0x2e')]('user:%s',_0x5e43f1['name']),util[_0xf232('0x2e')](_0xf232('0x2f'),_0x359b47[_0xf232('0x30')][_0xf232('0x31')]()),{'evt':_['merge'](_0x4e12a6,{'autoCreate':_0x5464f9}),'contact':_0x32cae0===undefined?{}:_0x32cae0,'contacts':_0x51deec[_0xf232('0x21')]===0x0?undefined:_0x51deec});}});}; \ No newline at end of file +var _0xf211=['phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','ListId','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','util','../../../../config/environment','trigger','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','data1','data2','data5','xmd-contactid','data3','split'];(function(_0x56c22a,_0x3b0b7f){var _0x572548=function(_0x2e15e2){while(--_0x2e15e2){_0x56c22a['push'](_0x56c22a['shift']());}};_0x572548(++_0x3b0b7f);}(_0xf211,0x198));var _0x1f21=function(_0x310dc2,_0x2299c4){_0x310dc2=_0x310dc2-0x0;var _0x24980f=_0xf211[_0x310dc2];return _0x24980f;};'use strict';var _=require(_0x1f21('0x0'));var BPromise=require(_0x1f21('0x1'));var Redis=require('ioredis');var util=require(_0x1f21('0x2'));var config=require(_0x1f21('0x3'));var logger=require('../../../../config/logger')(_0x1f21('0x4'));var cmContactRpc=require('../../rpc/cmContact');config[_0x1f21('0x5')]=_[_0x1f21('0x6')](config[_0x1f21('0x5')],{'host':_0x1f21('0x7'),'port':0x18eb});var io=require(_0x1f21('0x8'))(new Redis(config['redis']));function emit(_0x49282d,_0x3345a9,_0x100282,_0x1dab05,_0x343b54){logger[_0x1f21('0x9')](_0x1f21('0xa'),_0x49282d,_0x3345a9['id'],_0x100282,_0x1dab05,JSON[_0x1f21('0xb')](_0x343b54));io['to'](_0x100282)[_0x1f21('0xc')](_0x1dab05,_0x343b54);}exports['exec']=function(_0x587575,_0x521a34,_0x255a0f,_0x3f0fd7){var _0x38e22c,_0x178e7d;var _0x2ddb0f={};var _0x1ef292;var _0x4d2ed1=Number(_0x255a0f[_0x1f21('0xd')]);var _0x406916=_0x255a0f[_0x1f21('0xe')]?Boolean(Number(_0x255a0f[_0x1f21('0xe')])):![];var _0x15c480;var _0x30c6d4=![];if(!_['isNil'](_0x255a0f['data5'])){if(_0x255a0f[_0x1f21('0xf')]=='1')_0x30c6d4=!![];}if(!_0x30c6d4){if(_0x3f0fd7[_0x1f21('0x10')]){_0x2ddb0f['id']=_0x3f0fd7['xmd-contactid'];}}if(!_0x2ddb0f['id']){_0x2ddb0f['ListId']=_0x4d2ed1;_0x15c480=_0x255a0f[_0x1f21('0x11')]&&_0x255a0f['data3']!=='0'?_0x255a0f[_0x1f21('0x11')][_0x1f21('0x12')](','):[_0x1f21('0x13')];_0x2ddb0f[_0x1f21('0x14')]=_[_0x1f21('0x15')](_0x15c480,function(_0x4db5db){var _0x234d11={};_0x234d11[_0x4db5db]=_0x3f0fd7[_0x1f21('0x16')]?_0x3f0fd7[_0x1f21('0x17')]:_0x3f0fd7[_0x1f21('0x18')];return _0x234d11;});_0x1ef292=_0x3f0fd7[_0x1f21('0x16')]?_0x3f0fd7[_0x1f21('0x17')]:_0x3f0fd7[_0x1f21('0x18')];}var _0x2adca4=['id',_0x1f21('0x19'),_0x1f21('0x1a'),_0x1f21('0x13'),_0x1f21('0x1b'),_0x1f21('0x1c'),_0x1f21('0x1d'),_0x1f21('0x1e'),_0x1f21('0x1f'),_0x1f21('0x20')];var _0x55f970=_[_0x1f21('0x21')](_0x2adca4,_0x15c480);BPromise[_0x1f21('0x22')]()[_0x1f21('0x23')](cmContactRpc[_0x1f21('0x24')]({'attributes':_0x55f970,'where':_0x2ddb0f,'phone':_0x1ef292}))['then'](function(_0x38f657){_0x178e7d=_0x38f657;if(!_[_0x1f21('0x25')](_0x178e7d)){if(_0x178e7d[_0x1f21('0x26')]===0x1){_0x38e22c=_0x178e7d[0x0];logger[_0x1f21('0x9')](_0x1f21('0x27'),_0x3f0fd7[_0x1f21('0x28')],_0x521a34['id'],_0x38e22c['id']);}else{logger[_0x1f21('0x9')](_0x1f21('0x29'),_0x3f0fd7['uniqueid'],_0x521a34['id'],_[_0x1f21('0x15')](_0x178e7d,'id')[_0x1f21('0x2a')](','));}return;}else{logger[_0x1f21('0x9')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x3f0fd7[_0x1f21('0x28')],_0x521a34['id']);var _0xa6c67f={'ListId':_0x4d2ed1};var _0x2b71c3=_0x255a0f[_0x1f21('0x2b')]&&_0x255a0f['data4']!=='0'?_0x255a0f[_0x1f21('0x2b')]:_0x1f21('0x13');if(_0x406916){logger['info'](_0x1f21('0x2c'),_0x3f0fd7['uniqueid'],_0x521a34['id']);_0xa6c67f[_0x2b71c3]=_['isNil'](_0x3f0fd7[_0x1f21('0x16')])?_0x3f0fd7[_0x1f21('0x18')]:_0x3f0fd7[_0x1f21('0x17')];if(_[_0x1f21('0x2d')](_0x3f0fd7[_0x1f21('0x16')])){_0xa6c67f[_0x1f21('0x19')]=_0x3f0fd7['calleridname']&&_0x3f0fd7[_0x1f21('0x2e')]!==''?_0x3f0fd7['calleridname']:_0x1f21('0x2f');}else{_0xa6c67f[_0x1f21('0x19')]=_0x3f0fd7[_0x1f21('0x30')]&&_0x3f0fd7[_0x1f21('0x30')]!==''?_0x3f0fd7[_0x1f21('0x30')]:'Unknown';}return BPromise[_0x1f21('0x22')]()['then'](cmContactRpc[_0x1f21('0x31')](_0xa6c67f))['then'](function(_0x126781){_0x38e22c=_0x126781;_0x178e7d[_0x1f21('0x32')](_0x126781);if(_0x38e22c){logger['info'](_0x1f21('0x33'),_0x3f0fd7[_0x1f21('0x28')],_0x521a34['id'],_0x38e22c['id']);}return;});}else{logger[_0x1f21('0x9')](_0x1f21('0x34'),_0x3f0fd7[_0x1f21('0x28')],_0x521a34['id']);_0xa6c67f[_0x2b71c3]=_['isNil'](_0x3f0fd7['routeId'])?_0x3f0fd7[_0x1f21('0x18')]:_0x3f0fd7[_0x1f21('0x17')];if(_[_0x1f21('0x2d')](_0x3f0fd7[_0x1f21('0x16')])){_0xa6c67f[_0x1f21('0x19')]=_0x3f0fd7[_0x1f21('0x2e')]&&_0x3f0fd7[_0x1f21('0x2e')]!==_0x1f21('0x35')?_0x3f0fd7[_0x1f21('0x2e')]:_0x1f21('0x2f');}else{_0xa6c67f[_0x1f21('0x19')]=_0x3f0fd7[_0x1f21('0x30')]&&_0x3f0fd7[_0x1f21('0x30')]!==_0x1f21('0x35')?_0x3f0fd7[_0x1f21('0x30')]:_0x1f21('0x2f');}_0x38e22c=_0xa6c67f;_0x178e7d[_0x1f21('0x32')](_0xa6c67f);return;}}})[_0x1f21('0x23')](function(){if(_0x587575){emit(_0x3f0fd7[_0x1f21('0x28')],_0x521a34,util[_0x1f21('0x36')](_0x1f21('0x37'),_0x587575[_0x1f21('0x38')]),util[_0x1f21('0x36')](_0x1f21('0x39'),_0x255a0f[_0x1f21('0x3a')][_0x1f21('0x3b')]()),{'evt':_[_0x1f21('0x3c')](_0x3f0fd7,{'autoCreate':_0x406916}),'contact':_0x38e22c===undefined?{}:_0x38e22c,'contacts':_0x178e7d[_0x1f21('0x26')]===0x0?undefined:_0x178e7d});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 636c1ae..87a2c3c 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 _0x73a8=['format','name','trigger:%s:%s','jscripty','trigger:%s','user:%s','exec','integration','queue','routeId','urlforward','script','parse','query','replace','channel','AllConditions','every','checkConditions','AnyConditions','some','field','chat','ChatWebsiteId','operator','value','AccountId','message','event','agent','lastevent','mailSubstatus','null','substatus','offlineMessage','created','equals','exports','lodash','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/logger','trigger','../ami','redis','defaults','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','bind','custom:agentconnect','syncCustomEvent','custom:agentringnoanswer','custom:agentcomplete','custom:agentnoanswer','custom:agentbusy','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','custom:dialconnect','custom:dialend','syncAgentDial','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:offlineMessage','prototype','emit','info','stringify','clone','motionChannel','undefined','voice','interface','hasOwnProperty','status','checkTrigger','merge','variables','Actions','length','action','toLowerCase','motionbar','browser','data1','TemplateId','data2','html','render','template\x20not\x20found','url','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','windowHeight','data6','600','winArguments'];(function(_0x3048ee,_0x8a6dc3){var _0x429a4a=function(_0x10c011){while(--_0x10c011){_0x3048ee['push'](_0x3048ee['shift']());}};_0x429a4a(++_0x8a6dc3);}(_0x73a8,0x12a));var _0x873a=function(_0x3cb8dc,_0x191435){_0x3cb8dc=_0x3cb8dc-0x0;var _0x46f678=_0x73a8[_0x3cb8dc];return _0x46f678;};'use strict';var util=require('util');var _=require(_0x873a('0x0'));var url=require('url');var Mustache=require(_0x873a('0x1'));var Redis=require(_0x873a('0x2'));var urlforward=require(_0x873a('0x3'));var integration=require(_0x873a('0x4'));var cmContact=require(_0x873a('0x5'));var script=require(_0x873a('0x6'));var config=require('../../../config/environment');var logger=require(_0x873a('0x7'))(_0x873a('0x8'));var ami=require(_0x873a('0x9'));config[_0x873a('0xa')]=_[_0x873a('0xb')](config[_0x873a('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var operators={'equals':function(_0x187e30,_0x12a0cc){return _0x187e30==_0x12a0cc;},'not_equals':function(_0x33add6,_0x50c1c4){return _0x33add6!=_0x50c1c4;}};var barAndWebActions=[_0x873a('0xc'),'url',_0x873a('0xd')];function Trigger(_0x25b935){this[_0x873a('0xe')]=_0x25b935['triggers'];this[_0x873a('0xf')]=_0x25b935[_0x873a('0xf')];this[_0x873a('0x10')]=_0x25b935[_0x873a('0x10')];this[_0x873a('0x11')]=_0x25b935[_0x873a('0x11')];this[_0x873a('0x12')]=_0x25b935['voiceExtensions'];this[_0x873a('0x13')]=_0x25b935[_0x873a('0x13')];this[_0x873a('0x14')]=_0x25b935[_0x873a('0x14')];this[_0x873a('0x15')]=_0x25b935[_0x873a('0x15')];this[_0x873a('0x16')]=_0x25b935['sugarcrmAccounts'];this[_0x873a('0x17')]=_0x25b935[_0x873a('0x17')];this[_0x873a('0x18')]=_0x25b935[_0x873a('0x18')];this[_0x873a('0x19')]=_0x25b935[_0x873a('0x19')];this['servicenowAccounts']=_0x25b935[_0x873a('0x1a')];this[_0x873a('0x1b')]=_0x25b935['dynamics365Accounts'];this[_0x873a('0x1c')]=_0x25b935[_0x873a('0x1c')];this[_0x873a('0x1d')]={'zendesk':this[_0x873a('0x13')],'salesforce':this[_0x873a('0x15')],'freshdesk':this[_0x873a('0x14')],'sugarcrm':this[_0x873a('0x16')],'zoho':this[_0x873a('0x17')],'desk':this['deskAccounts'],'vtiger':this[_0x873a('0x19')],'dynamics365':this[_0x873a('0x1b')],'freshsales':this[_0x873a('0x1c')],'servicenow':this['servicenowAccounts']};ami['on'](_0x873a('0x1e'),this['syncCustomEvent'][_0x873a('0x1f')](this));ami['on'](_0x873a('0x20'),this[_0x873a('0x21')][_0x873a('0x1f')](this));ami['on'](_0x873a('0x22'),this['syncCustomEvent'][_0x873a('0x1f')](this));ami['on'](_0x873a('0x23'),this[_0x873a('0x21')]['bind'](this));ami['on']('custom:agentnosuchnumber',this['syncCustomEvent'][_0x873a('0x1f')](this));ami['on'](_0x873a('0x24'),this[_0x873a('0x21')][_0x873a('0x1f')](this));ami['on'](_0x873a('0x25'),this[_0x873a('0x21')][_0x873a('0x1f')](this));ami['on']('custom:agentcongestion',this['syncCustomEvent']['bind'](this));ami['on'](_0x873a('0x26'),this[_0x873a('0x21')][_0x873a('0x1f')](this));ami['on'](_0x873a('0x27'),this[_0x873a('0x21')][_0x873a('0x1f')](this));ami['on'](_0x873a('0x28'),this[_0x873a('0x21')]['bind'](this));ami['on'](_0x873a('0x29'),this[_0x873a('0x21')][_0x873a('0x1f')](this));ami['on'](_0x873a('0x2a'),this['syncAgentDial']['bind'](this));ami['on'](_0x873a('0x2b'),this['syncAgentDial'][_0x873a('0x1f')](this));ami['on'](_0x873a('0x2c'),this[_0x873a('0x2d')][_0x873a('0x1f')](this));ami['on'](_0x873a('0x2e'),this[_0x873a('0x21')]['bind'](this));ami['on'](_0x873a('0x2f'),this[_0x873a('0x21')]['bind'](this));ami['on']('custom:substatus',this['syncCustomEvent'][_0x873a('0x1f')](this));ami['on'](_0x873a('0x30'),this[_0x873a('0x21')][_0x873a('0x1f')](this));ami['on'](_0x873a('0x31'),this[_0x873a('0x21')][_0x873a('0x1f')](this));ami['on'](_0x873a('0x32'),this['syncCustomEvent'][_0x873a('0x1f')](this));ami['on']('custom:rejectmessage',this[_0x873a('0x21')]['bind'](this));ami['on'](_0x873a('0x33'),this[_0x873a('0x21')][_0x873a('0x1f')](this));}Trigger[_0x873a('0x34')][_0x873a('0x35')]=function(_0x1eecfc,_0x28a393,_0xdf1df3){logger[_0x873a('0x36')](_0x1eecfc,_0x28a393,JSON[_0x873a('0x37')](_0xdf1df3));io['to'](_0x1eecfc)[_0x873a('0x35')](_0x28a393,_0xdf1df3);};Trigger[_0x873a('0x34')][_0x873a('0x21')]=function(_0x6e234b){var _0x3f9f0b=_[_0x873a('0x38')](_0x6e234b);if(typeof _0x3f9f0b[_0x873a('0x39')]===_0x873a('0x3a')){_0x3f9f0b['motionChannel']=_0x873a('0x3b');}this['checkTriggers'](_0x3f9f0b);};Trigger[_0x873a('0x34')][_0x873a('0x2d')]=function(_0xaf8381){if(this[_0x873a('0xf')][_0xaf8381[_0x873a('0x3c')]]){this[_0x873a('0x21')](_0xaf8381);}};Trigger[_0x873a('0x34')]['checkTriggers']=function(_0x5aa6a1){var _0x4ae787;for(var _0x13c74b in this[_0x873a('0xe')]){if(this[_0x873a('0xe')][_0x873a('0x3d')](_0x13c74b)){if(this[_0x873a('0xe')][_0x13c74b][_0x873a('0x3e')]){_0x4ae787=this[_0x873a('0x3f')](this[_0x873a('0xe')][_0x13c74b],_0x5aa6a1);if(_0x4ae787){_[_0x873a('0x40')](_0x5aa6a1,_0x5aa6a1[_0x873a('0x41')]);for(var _0x2a6fe5=0x0,_0x56e07b,_0x55eb5c,_0x9ae941;_0x2a6fe50x0){_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 +var _0x9957=['Motion','CTI','concat','Tags','/api/v2/users/%d','Descriptions','%s/customers/%d/cases','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','Desk\x20account\x20type\x20not\x20recognized','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','integrationTab','newTab','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','The\x20Ticket\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','desk','defaults','redis','localhost','socket.io-emitter','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','remoteUri','then','total_entries','find','_embedded','entries','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','[HTTP]','stringify','GET','password','authType','token','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','includes','string','picklist','type','nameField','customField','content','idField','custom_fields','variable','variableName','customVariable','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x41a24f,_0x42f07f){var _0x40db02=function(_0x221576){while(--_0x221576){_0x41a24f['push'](_0x41a24f['shift']());}};_0x40db02(++_0x42f07f);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var rp=require(_0x7995('0x1'));var md5=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));config['redis']=_[_0x7995('0x8')](config[_0x7995('0x9')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x9')]));function emit(_0x326741,_0x4996ca,_0x465276){io['to'](_0x326741)[_0x7995('0xc')](_0x4996ca,_0x465276);}var headers={'Content-Type':'application/json','Accept':_0x7995('0xd')};function getUser(_0x3116fb,_0x18c8a3){if(intUtil[_0x7995('0xe')](_0x18c8a3)===!![]){logger[_0x7995('0xf')](_0x7995('0x10'),_0x18c8a3);return request({'uri':util[_0x7995('0x11')]('%s/users',_0x3116fb[_0x7995('0x12')])})[_0x7995('0x13')](function(_0x581f22){if(_0x581f22[_0x7995('0x14')]){return _[_0x7995('0x15')](_0x581f22[_0x7995('0x16')][_0x7995('0x17')],{'email':_0x18c8a3});}})[_0x7995('0x13')](function(_0x23999f){if(_0x23999f){logger[_0x7995('0xf')]('Agent\x20found!');return _0x23999f;}else{logger['info'](_0x7995('0x18'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb[_0x7995('0x12')])});}});}else{logger[_0x7995('0xf')](_0x7995('0x1a'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb['remoteUri'])});}}function request(_0x2eeacc){logger['debug'](_0x7995('0x1b'),JSON[_0x7995('0x1c')](_0x2eeacc));return rp(_[_0x7995('0x8')](_0x2eeacc,{'method':_0x7995('0x1d'),'headers':headers,'json':!![]}));}function getAuth(_0x1e1415){var _0x37a7d4;if(_0x1e1415['authType']==='basic'){_0x37a7d4=util[_0x7995('0x11')]('%s:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x1e')]);}else if(_0x1e1415[_0x7995('0x1f')]==='token'){_0x37a7d4=util[_0x7995('0x11')]('%s/token:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x20')]);}return util[_0x7995('0x11')](_0x7995('0x21'),new Buffer(_0x37a7d4)[_0x7995('0x22')](_0x7995('0x23')));}function getEndUser(_0x1c278a,_0x5d40ae,_0x32a09a){logger[_0x7995('0xf')](_0x7995('0x24'),_0x32a09a);return request({'uri':util[_0x7995('0x11')](_0x7995('0x25'),_0x1c278a[_0x7995('0x12')]),'qs':{'phone':_0x32a09a}})[_0x7995('0x13')](function(_0x472195){if(_0x472195['total_entries']){logger[_0x7995('0xf')](_0x7995('0x26'));return _0x472195[_0x7995('0x16')][_0x7995('0x17')][0x0];}else{logger[_0x7995('0xf')](_0x7995('0x27'));return request({'uri':util['format'](_0x7995('0x28'),_0x1c278a['remoteUri']),'method':_0x7995('0x29'),'body':{'first_name':_0x5d40ae,'title':_0x5d40ae,'phone_numbers':[{'type':_0x7995('0x2a'),'value':_0x32a09a}]}});}});}function getTags(_0xf16cc2,_0x132a42){var _0x11c1eb=[];if(_0xf16cc2&&_0xf16cc2['length']>0x0){_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 diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index e8d2ce4..7ede9a6 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 _0x2451=['Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','request-promise','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','remoteUri','CloudProvider','data7','tenantId','data2','data5','clientId','password','then','catch','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','email','userEmail','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','length','toLowerCase','outbound','destcalleridnum','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','enduserId','calleridnum','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','string','picklist','type','nameField','customField','idField','indexOf','ticketType','incident','POST','incidents','assign','getString','Subjects','Descriptions','Fields','callDirection','queue','phonecalls','ticketId','format','user:%s','emit','trigger:browser:url','modernAuthentication','stripTrailingSlash','serverUrl','unmanaged','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','openNewTab'];(function(_0x4fc348,_0x35d4f9){var _0x433c43=function(_0x5db994){while(--_0x5db994){_0x4fc348['push'](_0x4fc348['shift']());}};_0x433c43(++_0x35d4f9);}(_0x2451,0x1b5));var _0x1245=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0x2451[_0x4dcc2d];return _0x1bbd79;};'use strict';var _=require('lodash');var rp=require(_0x1245('0x0'));var util=require('util');var intUtil=require(_0x1245('0x1'));var md5=require(_0x1245('0x2'));var Redis=require(_0x1245('0x3'));var logger=require(_0x1245('0x4'))(_0x1245('0x5'));var config=require(_0x1245('0x6'));config['redis']=_['defaults'](config[_0x1245('0x7')],{'host':_0x1245('0x8'),'port':0x18eb});var io=require(_0x1245('0x9'))(new Redis(config[_0x1245('0x7')]));function getAuthToken(_0x5d1683,_0x2bfcfd,_0xa680e0){if(_0x5d1683['modernAuthentication']){_0x5d1683[_0x1245('0xa')]=_0x5d1683[_0x1245('0xb')][_0x1245('0xc')];_0x5d1683[_0x1245('0xd')]=_0x5d1683[_0x1245('0xb')][_0x1245('0xe')];return Promise['resolve'](_0x5d1683[_0x1245('0xb')][_0x1245('0xf')]);}var _0x16aac8={'method':'POST','uri':_0x2bfcfd,'form':{'client_id':_0x5d1683[_0x1245('0x10')],'resource':_0x5d1683[_0x1245('0xa')],'username':_0x5d1683['username'],'password':_0x5d1683[_0x1245('0x11')],'grant_type':'password','client_secret':_0x5d1683['clientSecret']},'json':!![]};return rp(_0x16aac8)[_0x1245('0x12')](function(_0x39c365){return _0x39c365['access_token'];})[_0x1245('0x13')](function(_0x1e2fc9){logger['error']('['+[_0xa680e0[_0x1245('0x14')]()]+_0x1245('0x15'));return _0x1e2fc9[_0x1245('0x16')];});}function getUser(_0x418bd0,_0x50d62d,_0x1c313c,_0x2ada75,_0x4b5327,_0x9f0bcb){return new Promise(function(_0x314589,_0x906dac){return getAuthToken(_0x50d62d,_0x2ada75,_0x9f0bcb)[_0x1245('0x12')](function(_0x5024a4){var _0x543fa4={'method':_0x1245('0x17'),'uri':_0x4b5327+_0x1245('0x18'),'headers':{'Authorization':_0x1245('0x19')+_0x5024a4,'OData-Version':_0x1245('0x1a')},'json':!![]};return rp(_0x543fa4);})[_0x1245('0x12')](function(_0x31b074){var _0x4af212=_0x31b074[_0x1245('0x1b')];var _0x2e9da2=![];var _0x5948ae=null;if(!_[_0x1245('0x1c')](_0x1c313c)){if(intUtil['validateEmail'](_0x1c313c[_0x1245('0x1d')])){_0x418bd0[_0x1245('0x1e')]=_0x1c313c['email'];for(_0x5948ae=0x0;_0x5948ae<_0x4af212['length'];_0x5948ae++){if(_0x4af212[_0x5948ae][_0x1245('0x1f')]===_0x1c313c[_0x1245('0x1d')]&&!_0x4af212[_0x5948ae]['isdisabled']){_0x2e9da2=!![];logger[_0x1245('0x20')]('['+[_0x9f0bcb[_0x1245('0x14')]()]+_0x1245('0x21')+_0x4af212[_0x5948ae][_0x1245('0x22')]+'!');_0x418bd0[_0x1245('0x23')]=_0x4af212[_0x5948ae][_0x1245('0x22')];}}}}if(!_0x2e9da2){logger[_0x1245('0x20')]('['+[_0x9f0bcb[_0x1245('0x14')]()]+_0x1245('0x24'));_0x418bd0[_0x1245('0x1e')]=_0x50d62d[_0x1245('0x25')];for(_0x5948ae=0x0;_0x5948ae<_0x4af212[_0x1245('0x26')];_0x5948ae++){if(_0x4af212[_0x5948ae][_0x1245('0x1f')]===_0x50d62d['username']){_0x418bd0['userId']=_0x4af212[_0x5948ae][_0x1245('0x22')];}}}_0x314589(_0x418bd0);})[_0x1245('0x13')](function(_0x59c2c4){_0x906dac(_0x59c2c4[_0x1245('0x16')]);});});}function createEndUser(_0x1148a4,_0x510f70,_0x3ecdf0,_0x6f8264,_0x537043,_0x4d20e1,_0x16e222){return new Promise(function(_0x4955c2,_0x575b09){return getAuthToken(_0x510f70,_0x3ecdf0,_0x4d20e1)[_0x1245('0x12')](function(_0x4335f8){var _0x211ae4=_0x4d20e1[_0x1245('0x27')]()===_0x1245('0x28')?_0x537043[_0x1245('0x29')]:_0x537043['calleridnum'];var _0x1e5af3={'method':'POST','uri':_0x6f8264+'contacts','body':{'fullname':_0x211ae4,'firstname':_0x211ae4,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x1245('0x2a')+_0x1148a4[_0x1245('0x23')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x4335f8,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x1e5af3[_0x1245('0x2b')][_0x16e222]=_0x211ae4;return rp(_0x1e5af3);})[_0x1245('0x12')](function(_0x13e9d7){var _0x3594c3=_0x13e9d7[_0x1245('0x2c')][_0x1245('0x2d')];var _0x46fab2=_0x3594c3[_0x1245('0x2e')](_0x3594c3['lastIndexOf']('(')+0x1,_0x3594c3[_0x1245('0x2f')](')'));_0x1148a4[_0x1245('0x30')]=_0x46fab2;_0x4955c2(_0x1148a4);})[_0x1245('0x13')](function(_0x14ff0b){_0x575b09(_0x14ff0b[_0x1245('0x16')]);});});}function getEndUser(_0x841be8,_0x4fa615,_0x3d1d82,_0x162eed,_0x85f646,_0x2b7e5a,_0x2af845,_0xa36f05){var _0xdb6ed3=_0x2b7e5a['toLowerCase']()===_0x1245('0x28')?_0x85f646[_0x1245('0x29')]:_0x85f646[_0x1245('0x31')];return getAuthToken(_0x4fa615,_0x3d1d82,_0x2b7e5a)[_0x1245('0x12')](function(_0x5d570b){_0xa36f05=_0xa36f05?_0xa36f05:_0x1245('0x32');var _0x1a2942={'method':'GET','uri':_0x162eed+_0x1245('0x33')+_0xa36f05+_0x1245('0x34')+_0xa36f05+_0x1245('0x35')+_0xdb6ed3[_0x1245('0x36')]('+',_0x1245('0x37'))+'\x27','headers':{'Authorization':_0x1245('0x19')+_0x5d570b,'If-None-Match':null,'OData-Version':_0x1245('0x1a')},'json':!![]};return rp(_0x1a2942);})[_0x1245('0x12')](function(_0xe6676e){var _0x19e6dc=![];if(!_0xe6676e)return _0x19e6dc;var _0x552114=_0xe6676e[_0x1245('0x1b')];for(var _0xe7647d=0x0;_0xe7647d<_0x552114[_0x1245('0x26')];_0xe7647d++){if(_0x552114[_0xe7647d][_0xa36f05]===_0xdb6ed3){_0x19e6dc=!![];_0x841be8[_0x1245('0x30')]=_0x552114[_0xe7647d][_0x1245('0x38')];}}return _0x19e6dc;})['then'](function(_0x2b43f3){if(_0x2b43f3)return _0x841be8;if(_0x2af845===_0x1245('0x39')){logger[_0x1245('0x20')]('['+[_0x2b7e5a[_0x1245('0x14')]()]+_0x1245('0x3a'));return _0x841be8;}return createEndUser(_0x841be8,_0x4fa615,_0x3d1d82,_0x162eed,_0x85f646,_0x2b7e5a,_0xa36f05)['then'](function(_0x23ae46){logger[_0x1245('0x20')]('['+[_0x2b7e5a[_0x1245('0x14')]()]+']\x20Enduser\x20created!',_0x23ae46[_0x1245('0x30')]);return _0x23ae46;});});}function getCustomFields(_0x288e5f,_0x4994a0,_0x3e1962){var _0x1a52a9={};if(_0x288e5f[_0x1245('0x26')]>0x0){_[_0x1245('0x3b')](_0x288e5f,function(_0x411d09){if(_['includes']([_0x1245('0x3c'),_0x1245('0x3d')],_0x411d09[_0x1245('0x3e')])&&_0x411d09[_0x1245('0x3f')]&&!_0x411d09[_0x1245('0x40')]){var _0x3b87d7=_0x411d09[_0x1245('0x41')][_0x1245('0x27')]();var _0x37d63b=_0x3b87d7[_0x1245('0x2e')](0x0,_0x3b87d7[_0x1245('0x42')]('_'));var _0x208af5=_0x3b87d7[_0x1245('0x2e')](_0x3b87d7[_0x1245('0x42')]('_')+0x1);if(_0x37d63b===_0x3e1962){_0x1a52a9[_0x208af5]=_0x411d09['content'];}}});}return _0x1a52a9;}function getTicket(_0x12defe,_0x538828,_0x545d65,_0x31126e,_0x4502b5,_0x442007,_0x41fd72){return new Promise(function(_0x402ada,_0x27aa77){var _0x5e2110;return getAuthToken(_0x538828,_0x545d65,_0x41fd72)[_0x1245('0x12')](function(_0x2ebbdb){if(_0x442007[_0x1245('0x43')]===_0x1245('0x44')){_0x5e2110={'method':_0x1245('0x45'),'uri':_0x31126e+_0x1245('0x46'),'body':Object[_0x1245('0x47')]({},{'title':intUtil[_0x1245('0x48')](_0x442007[_0x1245('0x49')],_0x4502b5,'\x20'),'description':intUtil[_0x1245('0x48')](_0x442007[_0x1245('0x4a')],_0x4502b5,'\x0a'),'customerid_contact@odata.bind':_0x12defe[_0x1245('0x30')]?'/contacts('+_0x12defe['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x12defe[_0x1245('0x23')]+')','caseorigincode':'1'},getCustomFields(_0x442007[_0x1245('0x4b')],_0x4502b5,_0x442007[_0x1245('0x43')])),'headers':{'Authorization':_0x1245('0x19')+_0x2ebbdb,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x442007[_0x1245('0x43')]==='phonecall'){var _0x73484a=_0x12defe[_0x1245('0x30')]?[{'partyid_systemuser@odata.bind':_0x1245('0x2a')+_0x12defe['userId']+')','participationtypemask':_0x12defe[_0x1245('0x4c')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x12defe[_0x1245('0x30')]+')','participationtypemask':_0x12defe[_0x1245('0x4c')]===_0x1245('0x4d')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x12defe[_0x1245('0x23')]+')','participationtypemask':_0x12defe[_0x1245('0x4c')]===_0x1245('0x4d')?0x2:0x1}];_0x5e2110={'method':_0x1245('0x45'),'uri':_0x31126e+_0x1245('0x4e'),'body':Object['assign']({},{'subject':intUtil[_0x1245('0x48')](_0x442007[_0x1245('0x49')],_0x4502b5,'\x20'),'phonenumber':String(_0x4502b5[_0x1245('0x31')]),'description':intUtil[_0x1245('0x48')](_0x442007[_0x1245('0x4a')],_0x4502b5,'\x0a'),'regardingobjectid_contact@odata.bind':_0x12defe[_0x1245('0x30')]?'/contacts('+_0x12defe[_0x1245('0x30')]+')':undefined,'ownerid@odata.bind':_0x1245('0x2a')+_0x12defe[_0x1245('0x23')]+')','directioncode':_0x12defe[_0x1245('0x4c')]===_0x1245('0x4d')?![]:!![],'phonecall_activity_parties':_0x73484a},getCustomFields(_0x442007[_0x1245('0x4b')],_0x4502b5,_0x442007[_0x1245('0x43')])),'headers':{'Authorization':_0x1245('0x19')+_0x2ebbdb,'OData-Version':_0x1245('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5e2110);})[_0x1245('0x12')](function(_0x2fc5ff){var _0x30eb7e=_0x2fc5ff[_0x1245('0x2c')][_0x1245('0x2d')];var _0x2a53a5=_0x30eb7e[_0x1245('0x2e')](_0x30eb7e[_0x1245('0x2f')]('(')+0x1,_0x30eb7e[_0x1245('0x2f')](')'));_0x12defe[_0x1245('0x4f')]=_0x2a53a5;_0x402ada(_0x12defe);})[_0x1245('0x13')](function(_0x4b4a8a){_0x27aa77(_0x4b4a8a[_0x1245('0x16')]);});});}function emit(_0x7d08cb,_0x356d62,_0x43ef5a,_0x136f10){var _0x492c12={'uri':util[_0x1245('0x50')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x7d08cb,_0x43ef5a,_0x136f10)};io['to'](util[_0x1245('0x50')](_0x1245('0x51'),_0x356d62))[_0x1245('0x52')](_0x1245('0x53'),_0x492c12);}exports['cs']=function(_0x31bbde,_0x10d438,_0x4521a6,_0x243fc3,_0x343ed6,_0x1a9436,_0x25bd80,_0x50385a){var _0x48e477={};_0x1a9436[_0x1245('0xa')]=_0x1a9436[_0x1245('0x54')]?intUtil[_0x1245('0x55')](_0x1a9436['CloudProvider'][_0x1245('0xc')]):intUtil['stripTrailingSlash'](_0x1a9436[_0x1245('0xa')]);_0x1a9436['serverUrl']=intUtil[_0x1245('0x55')](_0x1a9436[_0x1245('0x56')]);_0x48e477[_0x1245('0x4c')]=_0x50385a===_0x1245('0x4d')||_0x50385a===_0x1245('0x57')?'queue':'outbound';var _0xc79de0=_0x1a9436[_0x1245('0x54')]?util['format']('%s/api/data/v9.0/',_0x1a9436[_0x1245('0xb')][_0x1245('0xc')]):util['format']('%s/api/data/v9.0/',_0x1a9436['remoteUri']);var _0x53995c=util['format'](_0x1245('0x58'),_0x1a9436[_0x1245('0xd')]);var _0x12613e=util['format'](_0x1245('0x59'),_0x1a9436[_0x1245('0x56')],_0x10d438[_0x1245('0x5a')],md5(_0x10d438[_0x1245('0x5a')]));if(_0x343ed6&&_0x343ed6[_0x1245('0x5b')]){logger[_0x1245('0x20')]('[QUEUE]',_0x1245('0x5c'));_0x10d438[_0x1245('0x5d')]=_0x12613e;}else if(_0x25bd80&&_0x25bd80[_0x1245('0x5e')]&&_0x25bd80[_0x1245('0x5e')]!==_0x1245('0x5f')){logger[_0x1245('0x20')](_0x1245('0x60'),_0x1245('0x5c'));_0x10d438[_0x1245('0x5d')]=_0x12613e;}else{_0x10d438[_0x1245('0x5d')]='';}return getUser(_0x48e477,_0x1a9436,_0x243fc3,_0x53995c,_0xc79de0,_0x50385a)['then'](function(_0x13409c){logger[_0x1245('0x20')]('['+_0x50385a[_0x1245('0x14')]()+']\x20The\x20User\x20ID\x20is:',_0x13409c[_0x1245('0x23')]);logger['info']('['+_0x50385a[_0x1245('0x14')]()+']\x20The\x20User\x20email\x20is:',_0x13409c[_0x1245('0x1e')]);return getEndUser(_0x13409c,_0x1a9436,_0x53995c,_0xc79de0,_0x10d438,_0x50385a,_0x4521a6[_0x1245('0x61')],_0x4521a6[_0x1245('0x62')]);})[_0x1245('0x12')](function(_0x2e5f94){logger[_0x1245('0x20')]('['+_0x50385a[_0x1245('0x14')]()+_0x1245('0x63'),_0x2e5f94['enduserId']);logger[_0x1245('0x20')]('['+_0x50385a['toUpperCase']()+_0x1245('0x64'),_0x10d438['calleridnum']);return getTicket(_0x2e5f94,_0x1a9436,_0x53995c,_0xc79de0,_0x10d438,_0x4521a6,_0x50385a);})[_0x1245('0x12')](function(_0x4e4c35){logger[_0x1245('0x20')](util[_0x1245('0x50')]('['+_0x50385a[_0x1245('0x14')]()+_0x1245('0x65'),_0x4521a6[_0x1245('0x43')],_0x4e4c35['ticketId']));logger['info'](util[_0x1245('0x50')]('['+_0x50385a['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x50385a));if(_0x50385a!==_0x1245('0x57')&&_0x4521a6[_0x1245('0x66')]){logger['info']('['+_0x50385a[_0x1245('0x14')]()+']',_0x1245('0x67'));emit(_0x1a9436[_0x1245('0xa')],_0x243fc3[_0x1245('0x68')],_0x4521a6['ticketType'],_0x4e4c35['ticketId']);}})[_0x1245('0x13')](function(_0xa0b831){logger[_0x1245('0x69')]('['+_0x50385a[_0x1245('0x14')]()+_0x1245('0x6a'),_0xa0b831[_0x1245('0x16')]);console['error'](_0x1245('0x6b'),_0xa0b831);});}; \ No newline at end of file +var _0x9125=['userEmail','internalemailaddress','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','length','message','toLowerCase','outbound','calleridnum','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','enduserId','destcalleridnum','telephone1','GET','contacts?$select=','\x20eq\x20\x27','contactid',']\x20Enduser\x20created!','forEach','includes','string','picklist','nameField','idField','indexOf','content','incident','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','phonecall','queue','callDirection','phonecalls','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','data7','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','util','./util','md5','ioredis','../../../../config/logger','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','tenantId','data2','resolve','data5','POST','clientId','password','clientSecret','then','access_token','catch','error',']\x20Wrong\x20credentials!','Bearer\x20','4.0','value','isNil','validateEmail','email'];(function(_0x1810c7,_0x1ad306){var _0x3d4b7a=function(_0x2f92f3){while(--_0x2f92f3){_0x1810c7['push'](_0x1810c7['shift']());}};_0x3d4b7a(++_0x1ad306);}(_0x9125,0xb9));var _0x5912=function(_0x1e928b,_0x7cb412){_0x1e928b=_0x1e928b-0x0;var _0x3e26c3=_0x9125[_0x1e928b];return _0x3e26c3;};'use strict';var _=require(_0x5912('0x0'));var rp=require('request-promise');var util=require(_0x5912('0x1'));var intUtil=require(_0x5912('0x2'));var md5=require(_0x5912('0x3'));var Redis=require(_0x5912('0x4'));var logger=require(_0x5912('0x5'))('dynamics365');var config=require('../../../../config/environment');config[_0x5912('0x6')]=_['defaults'](config[_0x5912('0x6')],{'host':_0x5912('0x7'),'port':0x18eb});var io=require(_0x5912('0x8'))(new Redis(config[_0x5912('0x6')]));function getAuthToken(_0x33ff30,_0x41594a,_0x427770){if(_0x33ff30[_0x5912('0x9')]){_0x33ff30[_0x5912('0xa')]=_0x33ff30[_0x5912('0xb')]['data7'];_0x33ff30[_0x5912('0xc')]=_0x33ff30[_0x5912('0xb')][_0x5912('0xd')];return Promise[_0x5912('0xe')](_0x33ff30[_0x5912('0xb')][_0x5912('0xf')]);}var _0xfc9597={'method':_0x5912('0x10'),'uri':_0x41594a,'form':{'client_id':_0x33ff30[_0x5912('0x11')],'resource':_0x33ff30[_0x5912('0xa')],'username':_0x33ff30['username'],'password':_0x33ff30[_0x5912('0x12')],'grant_type':_0x5912('0x12'),'client_secret':_0x33ff30[_0x5912('0x13')]},'json':!![]};return rp(_0xfc9597)[_0x5912('0x14')](function(_0x4acfbd){return _0x4acfbd[_0x5912('0x15')];})[_0x5912('0x16')](function(_0x49697e){logger[_0x5912('0x17')]('['+[_0x427770['toUpperCase']()]+_0x5912('0x18'));return _0x49697e['message'];});}function getUser(_0x2d2a84,_0xafa94d,_0x576dd7,_0x4873b5,_0x19717f,_0x3654ba){return new Promise(function(_0x1a2f60,_0x379e9f){return getAuthToken(_0xafa94d,_0x4873b5,_0x3654ba)[_0x5912('0x14')](function(_0x4d705a){var _0x1d935e={'method':'GET','uri':_0x19717f+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x5912('0x19')+_0x4d705a,'OData-Version':_0x5912('0x1a')},'json':!![]};return rp(_0x1d935e);})[_0x5912('0x14')](function(_0x9fda52){var _0x28da0b=_0x9fda52[_0x5912('0x1b')];var _0x5ef2af=![];var _0x1db47c=null;if(!_[_0x5912('0x1c')](_0x576dd7)){if(intUtil[_0x5912('0x1d')](_0x576dd7[_0x5912('0x1e')])){_0x2d2a84[_0x5912('0x1f')]=_0x576dd7[_0x5912('0x1e')];for(_0x1db47c=0x0;_0x1db47c<_0x28da0b['length'];_0x1db47c++){if(_0x28da0b[_0x1db47c][_0x5912('0x20')]===_0x576dd7[_0x5912('0x1e')]&&!_0x28da0b[_0x1db47c][_0x5912('0x21')]){_0x5ef2af=!![];logger[_0x5912('0x22')]('['+[_0x3654ba[_0x5912('0x23')]()]+_0x5912('0x24')+_0x28da0b[_0x1db47c][_0x5912('0x25')]+'!');_0x2d2a84[_0x5912('0x26')]=_0x28da0b[_0x1db47c]['systemuserid'];}}}}if(!_0x5ef2af){logger[_0x5912('0x22')]('['+[_0x3654ba['toUpperCase']()]+_0x5912('0x27'));_0x2d2a84[_0x5912('0x1f')]=_0xafa94d[_0x5912('0x28')];for(_0x1db47c=0x0;_0x1db47c<_0x28da0b[_0x5912('0x29')];_0x1db47c++){if(_0x28da0b[_0x1db47c][_0x5912('0x20')]===_0xafa94d[_0x5912('0x28')]){_0x2d2a84[_0x5912('0x26')]=_0x28da0b[_0x1db47c][_0x5912('0x25')];}}}_0x1a2f60(_0x2d2a84);})[_0x5912('0x16')](function(_0x2477ea){_0x379e9f(_0x2477ea[_0x5912('0x2a')]);});});}function createEndUser(_0x585e07,_0x4cb9d1,_0x143fa1,_0x278fa7,_0x5a7b07,_0x13d91c,_0x1bec17){return new Promise(function(_0xa4c926,_0x47c042){return getAuthToken(_0x4cb9d1,_0x143fa1,_0x13d91c)[_0x5912('0x14')](function(_0x32fe48){var _0x4ac42e=_0x13d91c[_0x5912('0x2b')]()===_0x5912('0x2c')?_0x5a7b07['destcalleridnum']:_0x5a7b07[_0x5912('0x2d')];var _0x419826={'method':_0x5912('0x10'),'uri':_0x278fa7+'contacts','body':{'fullname':_0x4ac42e,'firstname':_0x4ac42e,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x5912('0x2e')+_0x585e07[_0x5912('0x26')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x32fe48,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x419826[_0x5912('0x2f')][_0x1bec17]=_0x4ac42e;return rp(_0x419826);})[_0x5912('0x14')](function(_0x3b01c4){var _0x36529b=_0x3b01c4[_0x5912('0x30')][_0x5912('0x31')];var _0x1c5324=_0x36529b[_0x5912('0x32')](_0x36529b[_0x5912('0x33')]('(')+0x1,_0x36529b['lastIndexOf'](')'));_0x585e07[_0x5912('0x34')]=_0x1c5324;_0xa4c926(_0x585e07);})[_0x5912('0x16')](function(_0x1de72a){_0x47c042(_0x1de72a[_0x5912('0x2a')]);});});}function getEndUser(_0x1b7ac9,_0x448b76,_0x4c1e04,_0x5c74f4,_0x4dad06,_0x13fb08,_0x5b6c1d,_0x3a1fca){var _0x1a50ab=_0x13fb08[_0x5912('0x2b')]()===_0x5912('0x2c')?_0x4dad06[_0x5912('0x35')]:_0x4dad06[_0x5912('0x2d')];return getAuthToken(_0x448b76,_0x4c1e04,_0x13fb08)[_0x5912('0x14')](function(_0x309e37){_0x3a1fca=_0x3a1fca?_0x3a1fca:_0x5912('0x36');var _0x2224a0={'method':_0x5912('0x37'),'uri':_0x5c74f4+_0x5912('0x38')+_0x3a1fca+'&$filter='+_0x3a1fca+_0x5912('0x39')+_0x1a50ab['replace']('+','%2b')+'\x27','headers':{'Authorization':_0x5912('0x19')+_0x309e37,'If-None-Match':null,'OData-Version':_0x5912('0x1a')},'json':!![]};return rp(_0x2224a0);})[_0x5912('0x14')](function(_0x1a8b32){var _0x46940e=![];if(!_0x1a8b32)return _0x46940e;var _0x1b891b=_0x1a8b32[_0x5912('0x1b')];for(var _0x5c44cc=0x0;_0x5c44cc<_0x1b891b[_0x5912('0x29')];_0x5c44cc++){if(_0x1b891b[_0x5c44cc][_0x3a1fca]===_0x1a50ab){_0x46940e=!![];_0x1b7ac9[_0x5912('0x34')]=_0x1b891b[_0x5c44cc][_0x5912('0x3a')];}}return _0x46940e;})[_0x5912('0x14')](function(_0x555bda){if(_0x555bda)return _0x1b7ac9;if(_0x5b6c1d==='nothing'){logger[_0x5912('0x22')]('['+[_0x13fb08['toUpperCase']()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x1b7ac9;}return createEndUser(_0x1b7ac9,_0x448b76,_0x4c1e04,_0x5c74f4,_0x4dad06,_0x13fb08,_0x3a1fca)['then'](function(_0x46500d){logger[_0x5912('0x22')]('['+[_0x13fb08[_0x5912('0x23')]()]+_0x5912('0x3b'),_0x46500d[_0x5912('0x34')]);return _0x46500d;});});}function getCustomFields(_0x59845e,_0x1ffa80,_0x56c940){var _0xfe5adb={};if(_0x59845e[_0x5912('0x29')]>0x0){_[_0x5912('0x3c')](_0x59845e,function(_0x1c4470){if(_[_0x5912('0x3d')]([_0x5912('0x3e'),_0x5912('0x3f')],_0x1c4470['type'])&&_0x1c4470[_0x5912('0x40')]&&!_0x1c4470['customField']){var _0x180ceb=_0x1c4470[_0x5912('0x41')]['toLowerCase']();var _0x3e0893=_0x180ceb['substring'](0x0,_0x180ceb['indexOf']('_'));var _0x45d25a=_0x180ceb[_0x5912('0x32')](_0x180ceb[_0x5912('0x42')]('_')+0x1);if(_0x3e0893===_0x56c940){_0xfe5adb[_0x45d25a]=_0x1c4470[_0x5912('0x43')];}}});}return _0xfe5adb;}function getTicket(_0x53f181,_0x18c349,_0x5086b6,_0xdd8684,_0x12a061,_0x3668d6,_0x17cc4b){return new Promise(function(_0x4f7d37,_0x469e6b){var _0x109b58;return getAuthToken(_0x18c349,_0x5086b6,_0x17cc4b)['then'](function(_0x5cf1ad){if(_0x3668d6['ticketType']===_0x5912('0x44')){_0x109b58={'method':_0x5912('0x10'),'uri':_0xdd8684+'incidents','body':Object[_0x5912('0x45')]({},{'title':intUtil[_0x5912('0x46')](_0x3668d6[_0x5912('0x47')],_0x12a061,'\x20'),'description':intUtil[_0x5912('0x46')](_0x3668d6[_0x5912('0x48')],_0x12a061,'\x0a'),'customerid_contact@odata.bind':_0x53f181[_0x5912('0x34')]?_0x5912('0x49')+_0x53f181[_0x5912('0x34')]+')':undefined,'ownerid@odata.bind':_0x5912('0x2e')+_0x53f181[_0x5912('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x3668d6[_0x5912('0x4a')],_0x12a061,_0x3668d6['ticketType'])),'headers':{'Authorization':_0x5912('0x19')+_0x5cf1ad,'OData-Version':_0x5912('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3668d6[_0x5912('0x4b')]===_0x5912('0x4c')){var _0x2971fb=_0x53f181[_0x5912('0x34')]?[{'partyid_systemuser@odata.bind':_0x5912('0x2e')+_0x53f181[_0x5912('0x26')]+')','participationtypemask':_0x53f181['callDirection']===_0x5912('0x4d')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x53f181[_0x5912('0x34')]+')','participationtypemask':_0x53f181[_0x5912('0x4e')]===_0x5912('0x4d')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x5912('0x2e')+_0x53f181[_0x5912('0x26')]+')','participationtypemask':_0x53f181[_0x5912('0x4e')]===_0x5912('0x4d')?0x2:0x1}];_0x109b58={'method':_0x5912('0x10'),'uri':_0xdd8684+_0x5912('0x4f'),'body':Object[_0x5912('0x45')]({},{'subject':intUtil[_0x5912('0x46')](_0x3668d6[_0x5912('0x47')],_0x12a061,'\x20'),'phonenumber':String(_0x12a061[_0x5912('0x2d')]),'description':intUtil[_0x5912('0x46')](_0x3668d6[_0x5912('0x48')],_0x12a061,'\x0a'),'regardingobjectid_contact@odata.bind':_0x53f181['enduserId']?'/contacts('+_0x53f181[_0x5912('0x34')]+')':undefined,'ownerid@odata.bind':_0x5912('0x2e')+_0x53f181[_0x5912('0x26')]+')','directioncode':_0x53f181[_0x5912('0x4e')]===_0x5912('0x4d')?![]:!![],'phonecall_activity_parties':_0x2971fb},getCustomFields(_0x3668d6['Fields'],_0x12a061,_0x3668d6['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x5cf1ad,'OData-Version':_0x5912('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x109b58);})['then'](function(_0x308868){var _0x26ffe5=_0x308868['headers']['odata-entityid'];var _0x8f24e3=_0x26ffe5[_0x5912('0x32')](_0x26ffe5['lastIndexOf']('(')+0x1,_0x26ffe5['lastIndexOf'](')'));_0x53f181[_0x5912('0x50')]=_0x8f24e3;_0x4f7d37(_0x53f181);})[_0x5912('0x16')](function(_0xc365e3){_0x469e6b(_0xc365e3[_0x5912('0x2a')]);});});}function emit(_0x511dc8,_0x3db87e,_0x189590,_0x2e93ad){var _0x373e5c={'uri':util[_0x5912('0x51')](_0x5912('0x52'),_0x511dc8,_0x189590,_0x2e93ad)};io['to'](util[_0x5912('0x51')](_0x5912('0x53'),_0x3db87e))[_0x5912('0x54')]('trigger:browser:url',_0x373e5c);}exports['cs']=function(_0x22fb11,_0x1f1c88,_0x2fb19f,_0x3d4f1c,_0x4920d5,_0x5f5ad7,_0x158b75,_0x273fca){var _0x14e217={};_0x5f5ad7[_0x5912('0xa')]=_0x5f5ad7[_0x5912('0x9')]?intUtil[_0x5912('0x55')](_0x5f5ad7[_0x5912('0xb')][_0x5912('0x56')]):intUtil[_0x5912('0x55')](_0x5f5ad7[_0x5912('0xa')]);_0x5f5ad7[_0x5912('0x57')]=intUtil[_0x5912('0x55')](_0x5f5ad7['serverUrl']);_0x14e217[_0x5912('0x4e')]=_0x273fca===_0x5912('0x4d')||_0x273fca===_0x5912('0x58')?_0x5912('0x4d'):'outbound';var _0x37ad54=_0x5f5ad7[_0x5912('0x9')]?util[_0x5912('0x51')](_0x5912('0x59'),_0x5f5ad7[_0x5912('0xb')][_0x5912('0x56')]):util[_0x5912('0x51')]('%s/api/data/v9.0/',_0x5f5ad7[_0x5912('0xa')]);var _0x1b0e47=util[_0x5912('0x51')](_0x5912('0x5a'),_0x5f5ad7[_0x5912('0xc')]);var _0x260d34=util[_0x5912('0x51')](_0x5912('0x5b'),_0x5f5ad7[_0x5912('0x57')],_0x1f1c88[_0x5912('0x5c')],md5(_0x1f1c88[_0x5912('0x5c')]));if(_0x4920d5&&_0x4920d5[_0x5912('0x5d')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x1f1c88[_0x5912('0x5e')]=_0x260d34;}else if(_0x158b75&&_0x158b75[_0x5912('0x5f')]&&_0x158b75[_0x5912('0x5f')]!=='none'){logger['info'](_0x5912('0x60'),_0x5912('0x61'));_0x1f1c88['recordingURL']=_0x260d34;}else{_0x1f1c88[_0x5912('0x5e')]='';}return getUser(_0x14e217,_0x5f5ad7,_0x3d4f1c,_0x1b0e47,_0x37ad54,_0x273fca)[_0x5912('0x14')](function(_0xbaf547){logger[_0x5912('0x22')]('['+_0x273fca[_0x5912('0x23')]()+']\x20The\x20User\x20ID\x20is:',_0xbaf547[_0x5912('0x26')]);logger['info']('['+_0x273fca[_0x5912('0x23')]()+_0x5912('0x62'),_0xbaf547['userEmail']);return getEndUser(_0xbaf547,_0x5f5ad7,_0x1b0e47,_0x37ad54,_0x1f1c88,_0x273fca,_0x2fb19f[_0x5912('0x63')],_0x2fb19f[_0x5912('0x64')]);})[_0x5912('0x14')](function(_0x4612d0){logger[_0x5912('0x22')]('['+_0x273fca[_0x5912('0x23')]()+_0x5912('0x65'),_0x4612d0['enduserId']);logger[_0x5912('0x22')]('['+_0x273fca[_0x5912('0x23')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x1f1c88['calleridnum']);return getTicket(_0x4612d0,_0x5f5ad7,_0x1b0e47,_0x37ad54,_0x1f1c88,_0x2fb19f,_0x273fca);})[_0x5912('0x14')](function(_0x2a97c6){logger['info'](util[_0x5912('0x51')]('['+_0x273fca[_0x5912('0x23')]()+_0x5912('0x66'),_0x2fb19f[_0x5912('0x4b')],_0x2a97c6[_0x5912('0x50')]));logger[_0x5912('0x22')](util['format']('['+_0x273fca['toUpperCase']()+_0x5912('0x67'),_0x273fca));if(_0x273fca!==_0x5912('0x58')&&_0x2fb19f[_0x5912('0x68')]){logger[_0x5912('0x22')]('['+_0x273fca['toUpperCase']()+']',_0x5912('0x69'));emit(_0x5f5ad7[_0x5912('0xa')],_0x3d4f1c['name'],_0x2fb19f['ticketType'],_0x2a97c6[_0x5912('0x50')]);}})['catch'](function(_0xa6cd21){logger[_0x5912('0x17')]('['+_0x273fca[_0x5912('0x23')]()+_0x5912('0x6a'),_0xa6cd21['message']);console[_0x5912('0x17')](_0x5912('0x6b'),_0xa6cd21);});}; \ 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 de4ad25..31f69ce 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 _0xdf6c=['POST','then','Ticket\x20created!','%s/api/v2/agents','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','idField','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','md5','util','ioredis','./util','../../../../config/logger','freshdesk','redis','defaults','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','value','%s/api/v2/tickets','remoteUri'];(function(_0x26ae05,_0x53e7ea){var _0x1e8338=function(_0x241a59){while(--_0x241a59){_0x26ae05['push'](_0x26ae05['shift']());}};_0x1e8338(++_0x53e7ea);}(_0xdf6c,0x160));var _0xcdf6=function(_0x446a34,_0x9ff1f7){_0x446a34=_0x446a34-0x0;var _0xbd09d2=_0xdf6c[_0x446a34];return _0xbd09d2;};'use strict';var _=require(_0xcdf6('0x0'));var rp=require('request-promise');var md5=require(_0xcdf6('0x1'));var util=require(_0xcdf6('0x2'));var Redis=require(_0xcdf6('0x3'));var intUtil=require(_0xcdf6('0x4'));var config=require('../../../../config/environment');var logger=require(_0xcdf6('0x5'))(_0xcdf6('0x6'));config[_0xcdf6('0x7')]=_[_0xcdf6('0x8')](config[_0xcdf6('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xcdf6('0x9'))(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x36796e,_0x485a77,_0x20bed2){io['to'](_0x36796e)[_0xcdf6('0xa')](_0x485a77,_0x20bed2);}function getTicket(_0x3b72f7,_0x55595f,_0x48130f,_0x3327fc,_0x9922e0){logger[_0xcdf6('0xb')](_0xcdf6('0xc'));var _0x1faf06=_['merge']({'responder_id':_0x55595f['id'],'requester_id':_0x48130f['id'],'name':util[_0xcdf6('0xd')](_0xcdf6('0xe'),_0x9922e0['calleridname']),'phone':_0x9922e0[_0xcdf6('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xcdf6('0x10')](_0x3327fc[_0xcdf6('0x11')],_0x9922e0,'\x20'),'description':intUtil['getString'](_0x3327fc[_0xcdf6('0x12')],_0x9922e0,_0xcdf6('0x13')),'tags':getTags(_0x3327fc[_0xcdf6('0x14')],_0xcdf6('0x15'))},getCustomFields(_0x3327fc[_0xcdf6('0x16')],_0x9922e0));_0x1faf06[_0xcdf6('0x17')]=_[_0xcdf6('0x18')](_['keyBy'](_0x1faf06['custom_fields'],'id'),_0xcdf6('0x19'));return request({'uri':util[_0xcdf6('0xd')](_0xcdf6('0x1a'),_0x3b72f7[_0xcdf6('0x1b')]),'method':_0xcdf6('0x1c'),'body':_0x1faf06})[_0xcdf6('0x1d')](function(_0x38d77e){logger[_0xcdf6('0xb')](_0xcdf6('0x1e'));return _0x38d77e;});}function getUser(_0x2d35a5,_0x41a05d){if(intUtil['validateEmail'](_0x41a05d)){return request({'uri':util[_0xcdf6('0xd')](_0xcdf6('0x1f'),_0x2d35a5['remoteUri']),'qs':{'email':_0x41a05d}})[_0xcdf6('0x1d')](function(_0x805c2a){if(_0x805c2a['length']){logger['info'](_0xcdf6('0x20'));return _['find'](_0x805c2a,function(_0x340964){return _0x340964[_0xcdf6('0x21')][_0xcdf6('0x22')]===_0x41a05d;});}else{logger[_0xcdf6('0xb')](_0xcdf6('0x23'));return request({'uri':util['format'](_0xcdf6('0x24'),_0x2d35a5[_0xcdf6('0x1b')])})[_0xcdf6('0x1d')](function(_0x44e15c){logger[_0xcdf6('0xb')](_0xcdf6('0x25'));return _0x44e15c;});}});}else{logger[_0xcdf6('0xb')](_0xcdf6('0x26'));return request({'uri':util[_0xcdf6('0xd')](_0xcdf6('0x24'),_0x2d35a5[_0xcdf6('0x1b')])})[_0xcdf6('0x1d')](function(_0x4bc8c5){logger[_0xcdf6('0xb')](_0xcdf6('0x25'));return _0x4bc8c5;});}}function getEndUser(_0x1b84a6,_0x5de4f1,_0x135d15){logger['info'](_0xcdf6('0x27'),_0x135d15);return request({'uri':util['format']('%s/api/v2/contacts',_0x1b84a6['remoteUri']),'qs':{'phone':_0x135d15}})['then'](function(_0x49acfc){if(_0x49acfc[_0xcdf6('0x28')]){logger[_0xcdf6('0xb')](_0xcdf6('0x29'));return _['find'](_0x49acfc,{'phone':_0x135d15});}else{logger[_0xcdf6('0xb')](_0xcdf6('0x2a'));return request({'uri':util[_0xcdf6('0xd')](_0xcdf6('0x2b'),_0x1b84a6['remoteUri']),'method':'POST','body':{'name':_0x5de4f1,'phone':_0x135d15}})[_0xcdf6('0x1d')](function(_0x57df76){logger[_0xcdf6('0xb')](_0xcdf6('0x2c'));return _0x57df76;});}});}function getAuth(_0x4245de){return util[_0xcdf6('0xd')](_0xcdf6('0x2d'),new Buffer(_0x4245de[_0xcdf6('0x2e')]+':X')[_0xcdf6('0x2f')]('base64'));}function request(_0x4bc65d){logger[_0xcdf6('0x30')](_0xcdf6('0x31'),JSON[_0xcdf6('0x32')](_0x4bc65d));return rp(_[_0xcdf6('0x8')](_0x4bc65d,{'method':_0xcdf6('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x389c38,_0x42e100){var _0x1bcdda=[];if(_0x389c38&&_0x389c38[_0xcdf6('0x28')]>0x0){_0x1bcdda=_[_0xcdf6('0x34')](_0x389c38,_0x42e100);}return _0x1bcdda;}function getCustomFields(_0x2de176,_0xbab999){var _0xc15d29=[];var _0x344fdd={'custom_fields':[]};if(_0x2de176[_0xcdf6('0x28')]>0x0){_[_0xcdf6('0x35')](_0x2de176,function(_0x467ac8){if(_[_0xcdf6('0x36')]([_0xcdf6('0x37'),_0xcdf6('0x38')],_0x467ac8['type'])&&_0x467ac8[_0xcdf6('0x39')]&&!_0x467ac8[_0xcdf6('0x3a')]){_0x344fdd[_0x467ac8[_0xcdf6('0x39')][_0xcdf6('0x3b')]()]=_0x467ac8[_0xcdf6('0x3c')]['toString']();}else if(_[_0xcdf6('0x36')]([_0xcdf6('0x37'),_0xcdf6('0x38')],_0x467ac8[_0xcdf6('0x3d')])&&_0x467ac8[_0xcdf6('0x3e')]&&_0x467ac8[_0xcdf6('0x3a')]){_0x344fdd[_0xcdf6('0x17')][_0xcdf6('0x3f')]({'id':_0x467ac8[_0xcdf6('0x3e')],'value':_0x467ac8['content'][_0xcdf6('0x2f')]()});}else if(_0x467ac8[_0xcdf6('0x3d')]===_0xcdf6('0x40')&&_0x467ac8[_0xcdf6('0x41')]&&_0x467ac8[_0xcdf6('0x3e')]&&_0x467ac8['customField']){_0xbab999[_0x467ac8[_0xcdf6('0x41')]]&&_0x344fdd[_0xcdf6('0x17')][_0xcdf6('0x3f')]({'id':_0x467ac8['idField'],'value':_0xbab999[_0x467ac8[_0xcdf6('0x41')]][_0xcdf6('0x2f')]()});}else if(_0x467ac8['type']===_0xcdf6('0x42')&&_0x467ac8[_0xcdf6('0x43')]&&_0x467ac8[_0xcdf6('0x43')][_0xcdf6('0x15')]&&_0x467ac8[_0xcdf6('0x3e')]&&_0x467ac8['customField']){_0xbab999[_0x467ac8[_0xcdf6('0x43')][_0xcdf6('0x15')][_0xcdf6('0x3b')]()]&&_0x344fdd[_0xcdf6('0x17')][_0xcdf6('0x3f')]({'id':_0x467ac8[_0xcdf6('0x3e')],'value':_0xbab999[_0x467ac8['Variable'][_0xcdf6('0x15')][_0xcdf6('0x3b')]()][_0xcdf6('0x2f')]()});}});}return _0x344fdd;}exports[_0xcdf6('0x44')]=function(_0x32bd99,_0xfb9ea7,_0x501782,_0x43201b,_0x23c745,_0x349b90){var _0x1b4577,_0x2e4881;_0x349b90[_0xcdf6('0x1b')]=intUtil[_0xcdf6('0x45')](_0x349b90['remoteUri']);_0x349b90[_0xcdf6('0x46')]=intUtil['stripTrailingSlash'](_0x349b90[_0xcdf6('0x46')]);if(_0x23c745&&_0x23c745['monitor_format']){logger[_0xcdf6('0xb')](_0xcdf6('0x47'),'Recording\x20is\x20enabled!');_0xfb9ea7[_0xcdf6('0x48')]=util[_0xcdf6('0xd')](_0xcdf6('0x49'),_0x349b90[_0xcdf6('0x46')],_0xfb9ea7[_0xcdf6('0x4a')],md5(_0xfb9ea7[_0xcdf6('0x4a')]));}else{_0xfb9ea7[_0xcdf6('0x48')]='';}headers[_0xcdf6('0x4b')]=getAuth(_0x349b90);return getUser(_0x349b90,_0x43201b[_0xcdf6('0x22')])[_0xcdf6('0x1d')](function(_0x7c6044){_0x1b4577=_0x7c6044;logger[_0xcdf6('0xb')](_0xcdf6('0x4c'),_0x1b4577['id']);return getEndUser(_0x349b90,_0xfb9ea7['calleridname'],_0xfb9ea7[_0xcdf6('0xf')]);})[_0xcdf6('0x1d')](function(_0x43cf0d){_0x2e4881=_0x43cf0d;logger['info'](_0xcdf6('0x4d'),_0x2e4881['id']);return getTicket(_0x349b90,_0x1b4577,_0x2e4881,_0x501782,_0xfb9ea7);})[_0xcdf6('0x1d')](function(_0x4d2ffc){if(_0x4d2ffc&&_0x4d2ffc['id']){logger[_0xcdf6('0xb')]('Ticket\x20created!');logger[_0xcdf6('0xb')]('The\x20Ticket\x20ID\x20is:',_0x4d2ffc['id']);logger['info'](_0xcdf6('0x47'),_0xcdf6('0x4e'));emit(util[_0xcdf6('0xd')](_0xcdf6('0x4f'),_0x43201b['name']),_0xcdf6('0x50'),{'uri':util[_0xcdf6('0xd')](_0xcdf6('0x51'),_0x349b90[_0xcdf6('0x1b')],_0x4d2ffc['id'])});}})[_0xcdf6('0x52')](function(_0x431281){logger[_0xcdf6('0x53')]('[QUEUE]',JSON['stringify'](_0x431281));});};exports['outbound']=function(_0x5b074c,_0xda6c40,_0x4c9c7d,_0x351c25,_0x25bc38,_0x5edc8c,_0xb034e6){var _0x2b65cf,_0x493f75;_0x5edc8c[_0xcdf6('0x1b')]=intUtil[_0xcdf6('0x45')](_0x5edc8c[_0xcdf6('0x1b')]);_0x5edc8c['serverUrl']=intUtil['stripTrailingSlash'](_0x5edc8c[_0xcdf6('0x46')]);if(_0xb034e6&&_0xb034e6[_0xcdf6('0x54')]&&_0xb034e6[_0xcdf6('0x54')]!==_0xcdf6('0x55')){logger[_0xcdf6('0xb')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0xda6c40['recordingURL']=util[_0xcdf6('0xd')](_0xcdf6('0x49'),_0x5edc8c['serverUrl'],_0xda6c40[_0xcdf6('0x4a')],md5(_0xda6c40[_0xcdf6('0x4a')]));}headers[_0xcdf6('0x4b')]=getAuth(_0x5edc8c);return getUser(_0x5edc8c,_0x351c25[_0xcdf6('0x22')])['then'](function(_0x29e60d){_0x2b65cf=_0x29e60d;logger['info']('The\x20User\x20ID\x20is:',_0x2b65cf['id']);return getEndUser(_0x5edc8c,_0xda6c40[_0xcdf6('0x56')],_0xda6c40[_0xcdf6('0x57')]);})[_0xcdf6('0x1d')](function(_0x200517){_0x493f75=_0x200517;logger[_0xcdf6('0xb')](_0xcdf6('0x4d'),_0x493f75['id']);return getTicket(_0x5edc8c,_0x2b65cf,_0x493f75,_0x4c9c7d,_0xda6c40);})['then'](function(_0x77a580){if(_0x77a580&&_0x77a580['id']){logger[_0xcdf6('0xb')](_0xcdf6('0x1e'));logger['info'](_0xcdf6('0x58'),_0x77a580['id']);logger['info'](_0xcdf6('0x59'),_0xcdf6('0x4e'));emit(util['format']('user:%s',_0x351c25[_0xcdf6('0x15')]),_0xcdf6('0x50'),{'uri':util[_0xcdf6('0xd')](_0xcdf6('0x51'),_0x5edc8c[_0xcdf6('0x1b')],_0x77a580['id'])});}})[_0xcdf6('0x52')](function(_0x51de36){logger['error']('[OUTBOUND]',JSON['stringify'](_0x51de36));});};exports[_0xcdf6('0x5a')]=function(_0x113731,_0x4ebc89,_0x4350bb,_0x4c3a67,_0x203feb,_0x4e87d9){var _0x535460,_0x4f508d;_0x4e87d9[_0xcdf6('0x1b')]=intUtil['stripTrailingSlash'](_0x4e87d9['remoteUri']);_0x4e87d9[_0xcdf6('0x46')]=intUtil['stripTrailingSlash'](_0x4e87d9[_0xcdf6('0x46')]);if(_0x203feb&&_0x203feb[_0xcdf6('0x5b')]){logger[_0xcdf6('0xb')]('['+_0x4ebc89[_0xcdf6('0x5c')][_0xcdf6('0x5d')]()+']',_0xcdf6('0x5e'));_0x4ebc89[_0xcdf6('0x48')]=util[_0xcdf6('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4e87d9['serverUrl'],_0x4ebc89['uniqueid'],md5(_0x4ebc89[_0xcdf6('0x4a')]));}else{_0x4ebc89[_0xcdf6('0x48')]='';}headers[_0xcdf6('0x4b')]=getAuth(_0x4e87d9);return getUser(_0x4e87d9,'')[_0xcdf6('0x1d')](function(_0x866154){_0x535460=_0x866154;logger['info'](_0xcdf6('0x4c'),_0x535460['id']);return getEndUser(_0x4e87d9,_0x4ebc89['calleridname'],_0x4ebc89[_0xcdf6('0xf')]);})[_0xcdf6('0x1d')](function(_0x128e07){_0x4f508d=_0x128e07;logger[_0xcdf6('0xb')](_0xcdf6('0x4d'),_0x4f508d['id']);return getTicket(_0x4e87d9,_0x535460,_0x4f508d,_0x4350bb,_0x4ebc89);})[_0xcdf6('0x1d')](function(_0x4f62e2){if(_0x4f62e2){logger['info'](_0xcdf6('0x1e'));logger[_0xcdf6('0xb')](_0xcdf6('0x58'),_0x4f62e2['id']);}})['catch'](function(_0xedd90f){logger[_0xcdf6('0x53')]('['+_0x4ebc89[_0xcdf6('0x5c')][_0xcdf6('0x5d')]()+']',JSON[_0xcdf6('0x32')](_0xedd90f));});}; \ No newline at end of file +var _0x48d4=['unmanaged','lastevent','toUpperCase','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','calleridname','calleridnum','getString','Subjects','
','name','Fields','custom_fields','mapValues','value','format','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','apiKey','toString','stringify','map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','idField','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Ticket\x20ID\x20is:','catch'];(function(_0x5dcdca,_0x1f2b6c){var _0x9ad7a1=function(_0x59311f){while(--_0x59311f){_0x5dcdca['push'](_0x5dcdca['shift']());}};_0x9ad7a1(++_0x1f2b6c);}(_0x48d4,0x167));var _0x448d=function(_0x42dde7,_0x108cab){_0x42dde7=_0x42dde7-0x0;var _0x13fc94=_0x48d4[_0x42dde7];return _0x13fc94;};'use strict';var _=require(_0x448d('0x0'));var rp=require(_0x448d('0x1'));var md5=require('md5');var util=require(_0x448d('0x2'));var Redis=require(_0x448d('0x3'));var intUtil=require(_0x448d('0x4'));var config=require(_0x448d('0x5'));var logger=require(_0x448d('0x6'))(_0x448d('0x7'));config[_0x448d('0x8')]=_['defaults'](config['redis'],{'host':_0x448d('0x9'),'port':0x18eb});var io=require(_0x448d('0xa'))(new Redis(config['redis']));var headers={'Content-Type':_0x448d('0xb'),'Accept':_0x448d('0xb')};function emit(_0x269a7b,_0x3f8132,_0x180b96){io['to'](_0x269a7b)['emit'](_0x3f8132,_0x180b96);}function getTicket(_0x11f918,_0x534d1c,_0x5df2eb,_0x1e529a,_0x3c0794){logger[_0x448d('0xc')](_0x448d('0xd'));var _0x4ae3ed=_[_0x448d('0xe')]({'responder_id':_0x534d1c['id'],'requester_id':_0x5df2eb['id'],'name':util['format']('Caller\x20-\x20%s',_0x3c0794[_0x448d('0xf')]),'phone':_0x3c0794[_0x448d('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x448d('0x11')](_0x1e529a[_0x448d('0x12')],_0x3c0794,'\x20'),'description':intUtil[_0x448d('0x11')](_0x1e529a['Descriptions'],_0x3c0794,_0x448d('0x13')),'tags':getTags(_0x1e529a['Tags'],_0x448d('0x14'))},getCustomFields(_0x1e529a[_0x448d('0x15')],_0x3c0794));_0x4ae3ed[_0x448d('0x16')]=_[_0x448d('0x17')](_['keyBy'](_0x4ae3ed[_0x448d('0x16')],'id'),_0x448d('0x18'));return request({'uri':util[_0x448d('0x19')](_0x448d('0x1a'),_0x11f918[_0x448d('0x1b')]),'method':_0x448d('0x1c'),'body':_0x4ae3ed})[_0x448d('0x1d')](function(_0x9858db){logger['info'](_0x448d('0x1e'));return _0x9858db;});}function getUser(_0x4ea6ba,_0x385d5a){if(intUtil[_0x448d('0x1f')](_0x385d5a)){return request({'uri':util['format'](_0x448d('0x20'),_0x4ea6ba[_0x448d('0x1b')]),'qs':{'email':_0x385d5a}})[_0x448d('0x1d')](function(_0x45c7fd){if(_0x45c7fd[_0x448d('0x21')]){logger['info']('Agent\x20found!');return _[_0x448d('0x22')](_0x45c7fd,function(_0x7aab3e){return _0x7aab3e[_0x448d('0x23')][_0x448d('0x24')]===_0x385d5a;});}else{logger['info'](_0x448d('0x25'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x4ea6ba['remoteUri'])})[_0x448d('0x1d')](function(_0x19b6fd){logger[_0x448d('0xc')](_0x448d('0x26'));return _0x19b6fd;});}});}else{logger['info'](_0x448d('0x27'));return request({'uri':util[_0x448d('0x19')](_0x448d('0x28'),_0x4ea6ba[_0x448d('0x1b')])})['then'](function(_0x3446ce){logger['info']('Admin\x20account\x20selected.');return _0x3446ce;});}}function getEndUser(_0x23bd7f,_0x464fbe,_0x464f76){logger[_0x448d('0xc')](_0x448d('0x29'),_0x464f76);return request({'uri':util[_0x448d('0x19')](_0x448d('0x2a'),_0x23bd7f[_0x448d('0x1b')]),'qs':{'phone':_0x464f76}})[_0x448d('0x1d')](function(_0x2436a6){if(_0x2436a6[_0x448d('0x21')]){logger[_0x448d('0xc')](_0x448d('0x2b'));return _[_0x448d('0x22')](_0x2436a6,{'phone':_0x464f76});}else{logger[_0x448d('0xc')](_0x448d('0x2c'));return request({'uri':util[_0x448d('0x19')](_0x448d('0x2a'),_0x23bd7f['remoteUri']),'method':_0x448d('0x1c'),'body':{'name':_0x464fbe,'phone':_0x464f76}})[_0x448d('0x1d')](function(_0x5b2ab4){logger[_0x448d('0xc')]('Enduser\x20created.');return _0x5b2ab4;});}});}function getAuth(_0x65f911){return util[_0x448d('0x19')]('Basic\x20%s',new Buffer(_0x65f911[_0x448d('0x2d')]+':X')[_0x448d('0x2e')]('base64'));}function request(_0x5a3577){logger['debug']('[HTTP]',JSON[_0x448d('0x2f')](_0x5a3577));return rp(_['defaults'](_0x5a3577,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x27f785,_0x19439d){var _0x358667=[];if(_0x27f785&&_0x27f785[_0x448d('0x21')]>0x0){_0x358667=_[_0x448d('0x30')](_0x27f785,_0x19439d);}return _0x358667;}function getCustomFields(_0x44a356,_0x15c985){var _0x27fe42=[];var _0x3afa9b={'custom_fields':[]};if(_0x44a356[_0x448d('0x21')]>0x0){_[_0x448d('0x31')](_0x44a356,function(_0x27f554){if(_[_0x448d('0x32')]([_0x448d('0x33'),_0x448d('0x34')],_0x27f554['type'])&&_0x27f554[_0x448d('0x35')]&&!_0x27f554[_0x448d('0x36')]){_0x3afa9b[_0x27f554[_0x448d('0x35')][_0x448d('0x37')]()]=_0x27f554[_0x448d('0x38')][_0x448d('0x2e')]();}else if(_[_0x448d('0x32')]([_0x448d('0x33'),_0x448d('0x34')],_0x27f554[_0x448d('0x39')])&&_0x27f554[_0x448d('0x3a')]&&_0x27f554[_0x448d('0x36')]){_0x3afa9b[_0x448d('0x16')][_0x448d('0x3b')]({'id':_0x27f554[_0x448d('0x3a')],'value':_0x27f554[_0x448d('0x38')]['toString']()});}else if(_0x27f554[_0x448d('0x39')]===_0x448d('0x3c')&&_0x27f554[_0x448d('0x3d')]&&_0x27f554['idField']&&_0x27f554[_0x448d('0x36')]){_0x15c985[_0x27f554[_0x448d('0x3d')]]&&_0x3afa9b[_0x448d('0x16')][_0x448d('0x3b')]({'id':_0x27f554[_0x448d('0x3a')],'value':_0x15c985[_0x27f554[_0x448d('0x3d')]]['toString']()});}else if(_0x27f554[_0x448d('0x39')]===_0x448d('0x3e')&&_0x27f554[_0x448d('0x3f')]&&_0x27f554[_0x448d('0x3f')][_0x448d('0x14')]&&_0x27f554[_0x448d('0x3a')]&&_0x27f554[_0x448d('0x36')]){_0x15c985[_0x27f554[_0x448d('0x3f')][_0x448d('0x14')][_0x448d('0x37')]()]&&_0x3afa9b[_0x448d('0x16')][_0x448d('0x3b')]({'id':_0x27f554[_0x448d('0x3a')],'value':_0x15c985[_0x27f554[_0x448d('0x3f')]['name'][_0x448d('0x37')]()][_0x448d('0x2e')]()});}});}return _0x3afa9b;}exports[_0x448d('0x40')]=function(_0x59e5d4,_0x2bb226,_0x412489,_0x677042,_0x3f72f0,_0x5a77ce){var _0xfd1078,_0x29ef67;_0x5a77ce[_0x448d('0x1b')]=intUtil[_0x448d('0x41')](_0x5a77ce[_0x448d('0x1b')]);_0x5a77ce[_0x448d('0x42')]=intUtil['stripTrailingSlash'](_0x5a77ce[_0x448d('0x42')]);if(_0x3f72f0&&_0x3f72f0[_0x448d('0x43')]){logger[_0x448d('0xc')](_0x448d('0x44'),_0x448d('0x45'));_0x2bb226[_0x448d('0x46')]=util[_0x448d('0x19')](_0x448d('0x47'),_0x5a77ce[_0x448d('0x42')],_0x2bb226[_0x448d('0x48')],md5(_0x2bb226[_0x448d('0x48')]));}else{_0x2bb226[_0x448d('0x46')]='';}headers[_0x448d('0x49')]=getAuth(_0x5a77ce);return getUser(_0x5a77ce,_0x677042[_0x448d('0x24')])[_0x448d('0x1d')](function(_0x394a33){_0xfd1078=_0x394a33;logger['info'](_0x448d('0x4a'),_0xfd1078['id']);return getEndUser(_0x5a77ce,_0x2bb226['calleridname'],_0x2bb226[_0x448d('0x10')]);})[_0x448d('0x1d')](function(_0x4ea399){_0x29ef67=_0x4ea399;logger[_0x448d('0xc')](_0x448d('0x4b'),_0x29ef67['id']);return getTicket(_0x5a77ce,_0xfd1078,_0x29ef67,_0x412489,_0x2bb226);})[_0x448d('0x1d')](function(_0xb1f1cc){if(_0xb1f1cc&&_0xb1f1cc['id']){logger['info'](_0x448d('0x1e'));logger[_0x448d('0xc')]('The\x20Ticket\x20ID\x20is:',_0xb1f1cc['id']);logger[_0x448d('0xc')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x448d('0x19')](_0x448d('0x4c'),_0x677042[_0x448d('0x14')]),_0x448d('0x4d'),{'uri':util[_0x448d('0x19')](_0x448d('0x4e'),_0x5a77ce[_0x448d('0x1b')],_0xb1f1cc['id'])});}})['catch'](function(_0x3f4d10){logger[_0x448d('0x4f')](_0x448d('0x44'),JSON[_0x448d('0x2f')](_0x3f4d10));});};exports['outbound']=function(_0x82a309,_0x2aa1bb,_0x251363,_0x5ea164,_0x5086eb,_0x398378,_0xe5b094){var _0x40644c,_0x5f5d9c;_0x398378[_0x448d('0x1b')]=intUtil[_0x448d('0x41')](_0x398378[_0x448d('0x1b')]);_0x398378['serverUrl']=intUtil[_0x448d('0x41')](_0x398378['serverUrl']);if(_0xe5b094&&_0xe5b094[_0x448d('0x50')]&&_0xe5b094['recordingFormat']!==_0x448d('0x51')){logger[_0x448d('0xc')](_0x448d('0x52'),_0x448d('0x45'));_0x2aa1bb['recordingURL']=util[_0x448d('0x19')](_0x448d('0x47'),_0x398378[_0x448d('0x42')],_0x2aa1bb[_0x448d('0x48')],md5(_0x2aa1bb['uniqueid']));}headers[_0x448d('0x49')]=getAuth(_0x398378);return getUser(_0x398378,_0x5ea164[_0x448d('0x24')])[_0x448d('0x1d')](function(_0xaed084){_0x40644c=_0xaed084;logger[_0x448d('0xc')](_0x448d('0x4a'),_0x40644c['id']);return getEndUser(_0x398378,_0x2aa1bb[_0x448d('0x53')],_0x2aa1bb['destcalleridnum']);})[_0x448d('0x1d')](function(_0x275f45){_0x5f5d9c=_0x275f45;logger[_0x448d('0xc')](_0x448d('0x4b'),_0x5f5d9c['id']);return getTicket(_0x398378,_0x40644c,_0x5f5d9c,_0x251363,_0x2aa1bb);})[_0x448d('0x1d')](function(_0x58d971){if(_0x58d971&&_0x58d971['id']){logger[_0x448d('0xc')]('Ticket\x20created!');logger[_0x448d('0xc')](_0x448d('0x54'),_0x58d971['id']);logger['info'](_0x448d('0x52'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x448d('0x19')]('user:%s',_0x5ea164[_0x448d('0x14')]),'trigger:browser:url',{'uri':util[_0x448d('0x19')](_0x448d('0x4e'),_0x398378['remoteUri'],_0x58d971['id'])});}})[_0x448d('0x55')](function(_0x5c4ad3){logger['error']('[OUTBOUND]',JSON[_0x448d('0x2f')](_0x5c4ad3));});};exports[_0x448d('0x56')]=function(_0x454004,_0x5523c9,_0x226de2,_0x51d1a1,_0x276f0f,_0xf11189){var _0x2c114b,_0x2bd804;_0xf11189['remoteUri']=intUtil[_0x448d('0x41')](_0xf11189['remoteUri']);_0xf11189[_0x448d('0x42')]=intUtil['stripTrailingSlash'](_0xf11189[_0x448d('0x42')]);if(_0x276f0f&&_0x276f0f[_0x448d('0x43')]){logger[_0x448d('0xc')]('['+_0x5523c9[_0x448d('0x57')][_0x448d('0x58')]()+']',_0x448d('0x45'));_0x5523c9[_0x448d('0x46')]=util[_0x448d('0x19')](_0x448d('0x47'),_0xf11189[_0x448d('0x42')],_0x5523c9[_0x448d('0x48')],md5(_0x5523c9[_0x448d('0x48')]));}else{_0x5523c9[_0x448d('0x46')]='';}headers[_0x448d('0x49')]=getAuth(_0xf11189);return getUser(_0xf11189,'')[_0x448d('0x1d')](function(_0x591297){_0x2c114b=_0x591297;logger[_0x448d('0xc')](_0x448d('0x4a'),_0x2c114b['id']);return getEndUser(_0xf11189,_0x5523c9[_0x448d('0xf')],_0x5523c9['calleridnum']);})[_0x448d('0x1d')](function(_0x38a71a){_0x2bd804=_0x38a71a;logger['info'](_0x448d('0x4b'),_0x2bd804['id']);return getTicket(_0xf11189,_0x2c114b,_0x2bd804,_0x226de2,_0x5523c9);})['then'](function(_0x593037){if(_0x593037){logger['info'](_0x448d('0x1e'));logger[_0x448d('0xc')](_0x448d('0x54'),_0x593037['id']);}})['catch'](function(_0x993a9){logger['error']('['+_0x5523c9[_0x448d('0x57')]['toUpperCase']()+']',JSON[_0x448d('0x2f')](_0x993a9));});}; \ 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 5a18b76..f229522 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 _0xd7ff=['contactNumber','mobile_number','endUserId','work_number','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','Subjects','getString','Descriptions','add','ticketId','task','/contacts/','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','lodash','request-promise','md5','util','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','email','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','agentEmail','length','userId','Admin\x20selected','userEmail','/api/lookup?q=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s'];(function(_0x4778a0,_0x45fafb){var _0x3b7ec5=function(_0x888e7f){while(--_0x888e7f){_0x4778a0['push'](_0x4778a0['shift']());}};_0x3b7ec5(++_0x45fafb);}(_0xd7ff,0x124));var _0xfd7f=function(_0x2a86c1,_0x1c0ce2){_0x2a86c1=_0x2a86c1-0x0;var _0x595f62=_0xd7ff[_0x2a86c1];return _0x595f62;};'use strict';var _=require(_0xfd7f('0x0'));var rp=require(_0xfd7f('0x1'));var md5=require(_0xfd7f('0x2'));var util=require(_0xfd7f('0x3'));var moment=require('moment');var Promise=require(_0xfd7f('0x4'));var Redis=require(_0xfd7f('0x5'));var intUtil=require(_0xfd7f('0x6'));var config=require(_0xfd7f('0x7'));var logger=require(_0xfd7f('0x8'))('freshsales');config[_0xfd7f('0x9')]=_[_0xfd7f('0xa')](config[_0xfd7f('0x9')],{'host':_0xfd7f('0xb'),'port':0x18eb});var io=require(_0xfd7f('0xc'))(new Redis(config['redis']));function getAdminId(_0x4cda83,_0x81114f,_0x22678a,_0x197245){return new Promise(function(_0x1fab5d,_0x503ad9){var _0x3abb22=![];var _0x20516f={'method':_0xfd7f('0xd'),'uri':_0x197245+_0xfd7f('0xe'),'json':!![]};_0x20516f[_0xfd7f('0xf')]=_0x22678a;logger[_0xfd7f('0x10')](_0xfd7f('0x11'));return rp(_0x20516f)[_0xfd7f('0x12')](function(_0x18eab7){if(_0x18eab7){var _0x29dfe6=_0x18eab7[_0xfd7f('0x13')];var _0x324307=null;for(_0x324307=0x0;_0x324307<_0x29dfe6['length'];_0x324307++){if(_0x29dfe6[_0x324307][_0xfd7f('0x14')]===_0x4cda83[_0xfd7f('0x15')]){_0x4cda83['adminId']=_0x29dfe6[_0x324307]['id'];_0x3abb22=!![];}}if(_0x3abb22){logger[_0xfd7f('0x10')](_0xfd7f('0x16'),_0x4cda83[_0xfd7f('0x17')]);_0x1fab5d(_0x4cda83);}else{_0x503ad9({'statusCode':0x194,'message':_0xfd7f('0x18')});}}else{_0x503ad9({'statusCode':0x194,'message':_0xfd7f('0x18')});}})[_0xfd7f('0x19')](function(_0x754585){logger[_0xfd7f('0x1a')]('['+[_0x81114f[_0xfd7f('0x1b')]()]+']',_0x754585[_0xfd7f('0x1c')]);_0x503ad9(_0x754585);});});}function getUser(_0x770ae0,_0x703e23,_0x1c3740){return function(_0x1f56a3){return new Promise(function(_0x1f390e,_0x3e041c){var _0x477ced={'method':'GET','uri':_0x1c3740+'/api/selector/owners','json':!![]};_0x477ced[_0xfd7f('0xf')]=_0x703e23;logger['info']('Getting\x20user\x20list');return rp(_0x477ced)[_0xfd7f('0x12')](function(_0x2b7ea2){if(_0x2b7ea2){var _0x52960a=_0x2b7ea2[_0xfd7f('0x13')];var _0x343bd8=![];var _0x489070=null;if(_0x1f56a3[_0xfd7f('0x1d')]!==null){logger['info']('Getting\x20user\x20with\x20email',_0x1f56a3[_0xfd7f('0x1d')]);_0x1f56a3['userEmail']=_0x1f56a3[_0xfd7f('0x1d')];for(_0x489070=0x0;_0x489070<_0x52960a[_0xfd7f('0x1e')];_0x489070++){if(_0x52960a[_0x489070]['email']===_0x1f56a3[_0xfd7f('0x1d')]){_0x343bd8=!![];_0x1f56a3[_0xfd7f('0x1f')]=_0x52960a[_0x489070]['id'];logger['info']('User\x20found:',_0x1f56a3[_0xfd7f('0x1f')]);}}}if(!_0x343bd8){logger['info'](_0xfd7f('0x20'));_0x1f56a3[_0xfd7f('0x21')]=_0x1f56a3['adminEmail'];_0x1f56a3[_0xfd7f('0x1f')]=_0x1f56a3[_0xfd7f('0x17')];_0x343bd8=!![];}if(_0x343bd8){_0x1f390e(_0x1f56a3);}else{_0x3e041c({'statusCode':0x194,'message':_0xfd7f('0x18')});}}else{_0x3e041c({'statusCode':0x194,'message':_0xfd7f('0x18')});}})['catch'](function(_0x1dfb45){logger['error']('['+[_0x770ae0['toUpperCase']()]+']',_0x1dfb45[_0xfd7f('0x1c')]);_0x3e041c(_0x1dfb45);});});};}function searchContact(_0x352769,_0x19d187,_0x445496,_0x4bc333){return new Promise(function(_0x46bcec,_0x5e217d){var _0x4fab31={'method':_0xfd7f('0xd'),'headers':_0x19d187,'uri':_0x352769+_0xfd7f('0x22')+_0x4bc333+'&f='+_0x445496+_0xfd7f('0x23'),'json':!![]};rp(_0x4fab31)['then'](function(_0x182781){var _0x56b335=_[_0xfd7f('0x24')](_0x182781[_0xfd7f('0x25')]['contacts'],[_0x445496,_0x4bc333]);_0x46bcec(_0x56b335);})[_0xfd7f('0x19')](function(_0x51d53d){_0x5e217d(_0x51d53d);});});}function getEndUser(_0x30bcf3,_0x3ea392,_0x2e9adf){return function(_0x86653d){return new Promise(function(_0x4bafbd,_0x100287){logger[_0xfd7f('0x10')](util[_0xfd7f('0x26')](_0xfd7f('0x27'),_0x86653d[_0xfd7f('0x28')]));searchContact(_0x2e9adf,_0x3ea392,_0xfd7f('0x29'),_0x86653d[_0xfd7f('0x28')])[_0xfd7f('0x12')](function(_0x1c8719){if(_0x1c8719){_0x86653d[_0xfd7f('0x2a')]=_0x1c8719['id'];logger[_0xfd7f('0x10')]('Contact\x20found\x20mobile_number:',_0x86653d['endUserId']);return _0x4bafbd(_0x86653d);}searchContact(_0x2e9adf,_0x3ea392,_0xfd7f('0x2b'),_0x86653d['contactNumber'])[_0xfd7f('0x12')](function(_0x2ad18f){if(_0x2ad18f){_0x86653d[_0xfd7f('0x2a')]=_0x2ad18f['id'];logger[_0xfd7f('0x10')]('Contact\x20found\x20work_number:',_0x86653d['endUserId']);return _0x4bafbd(_0x86653d);}createEndUser(_0x86653d,_0x30bcf3,_0x3ea392,_0x2e9adf)[_0xfd7f('0x12')](function(_0xfa7547){logger[_0xfd7f('0x10')](_0xfd7f('0x2c'),_0xfa7547[_0xfd7f('0x2a')]);return _0x4bafbd(_0xfa7547);});});})[_0xfd7f('0x19')](function(_0x2e7a6c){_0x100287(_0x2e7a6c);});});};}function createEndUser(_0x2f5818,_0x3c0db3,_0x5eed2d,_0x29fd45){return new Promise(function(_0x1cbf2e,_0x5750ed){var _0x1a2c1a=moment();var _0x326b15={'method':_0xfd7f('0x2d'),'uri':_0x29fd45+'/api/contacts','body':{'contact':{'last_name':_0x2f5818[_0xfd7f('0x28')],'work_number':_0x2f5818[_0xfd7f('0x28')],'mobile_number':_0x2f5818['contactNumber'],'owner_id':_0x2f5818['userId'],'created_at':_0x1a2c1a[_0xfd7f('0x26')](_0xfd7f('0x2e'))}},'json':!![]};_0x326b15[_0xfd7f('0xf')]=_0x5eed2d;logger[_0xfd7f('0x10')](_0xfd7f('0x2f'));return rp(_0x326b15)['then'](function(_0x16c5e5){_0x2f5818[_0xfd7f('0x2a')]=_0x16c5e5[_0xfd7f('0x30')]['id'];_0x1cbf2e(_0x2f5818);})[_0xfd7f('0x19')](function(_0x3e3db7){logger[_0xfd7f('0x1a')]('['+[_0x3c0db3['toUpperCase']()]+']',_0x3e3db7[_0xfd7f('0x1c')]);_0x5750ed(_0x3e3db7[_0xfd7f('0x1c')]);});});}function getTicket(_0x459ad4,_0x42a06f,_0x4e3c98,_0x4d79d1,_0x2e3224){return function(_0x548b4a){logger['info'](_0xfd7f('0x31'));return new Promise(function(_0x21f281,_0x8ef9ad){var _0x3ddcf0=moment();var _0xce40d4={'method':_0xfd7f('0x2d'),'uri':_0x4e3c98+_0xfd7f('0x32'),'body':{'title':intUtil['getString'](_0x4d79d1[_0xfd7f('0x33')],_0x2e3224,'\x20'),'description':intUtil[_0xfd7f('0x34')](_0x4d79d1[_0xfd7f('0x35')],_0x2e3224,'\x0a'),'owner_id':_0x548b4a[_0xfd7f('0x1f')],'creater_id':_0x548b4a[_0xfd7f('0x17')],'targetable_id':_0x548b4a[_0xfd7f('0x2a')],'targetable_type':'Contact','created_at':_0x3ddcf0['format'](_0xfd7f('0x2e')),'due_date':_0x3ddcf0[_0xfd7f('0x36')](0x1e,'m')[_0xfd7f('0x26')](_0xfd7f('0x2e'))},'json':!![]};_0xce40d4[_0xfd7f('0xf')]=_0x42a06f;return rp(_0xce40d4)['then'](function(_0x1381c2){_0x548b4a[_0xfd7f('0x37')]=_0x1381c2[_0xfd7f('0x38')]['id'];logger[_0xfd7f('0x10')]('Task\x20created:',_0x548b4a[_0xfd7f('0x37')]);_0x21f281(_0x548b4a);})[_0xfd7f('0x19')](function(_0x106a1a){logger[_0xfd7f('0x1a')]('['+[_0x459ad4[_0xfd7f('0x1b')]()]+']',_0x106a1a[_0xfd7f('0x1c')]);_0x8ef9ad(_0x106a1a[_0xfd7f('0x1c')]);});});};}function emit(_0x1a5fe5,_0x118500,_0x3a1bac){var _0x4416d5={'uri':_0x1a5fe5+_0xfd7f('0x39')+_0x3a1bac};io['to'](util[_0xfd7f('0x26')]('user:%s',_0x118500))[_0xfd7f('0x3a')](_0xfd7f('0x3b'),_0x4416d5);}exports['cs']=function(_0x19a0e7,_0x3a559b,_0x4d1039,_0x51af57,_0x396839,_0x37429d,_0x1ef36f,_0x265750){var _0x4ee878={};var _0x490996={'Authorization':_0xfd7f('0x3c')+_0x37429d[_0xfd7f('0x3d')]};_0x37429d[_0xfd7f('0x3e')]=intUtil[_0xfd7f('0x3f')](_0x37429d[_0xfd7f('0x3e')]);_0x37429d[_0xfd7f('0x40')]=intUtil[_0xfd7f('0x3f')](_0x37429d[_0xfd7f('0x40')]);var _0x2cbc1f=_0x37429d[_0xfd7f('0x3e')];_0x4ee878[_0xfd7f('0x15')]=_0x37429d['username'];_0x4ee878[_0xfd7f('0x28')]=_0x265750[_0xfd7f('0x41')]()==='outbound'?_0x3a559b[_0xfd7f('0x42')]:_0x3a559b[_0xfd7f('0x43')];_0x4ee878[_0xfd7f('0x44')]=_0x265750===_0xfd7f('0x45')||_0x265750===_0xfd7f('0x46')?_0xfd7f('0x45'):_0xfd7f('0x47');if(_0x51af57){_0x4ee878[_0xfd7f('0x1d')]=_0x51af57[_0xfd7f('0x14')];}var _0xf1f13=util[_0xfd7f('0x26')](_0xfd7f('0x48'),_0x37429d[_0xfd7f('0x40')],_0x3a559b[_0xfd7f('0x49')],md5(_0x3a559b[_0xfd7f('0x49')]));if(_0x396839&&_0x396839[_0xfd7f('0x4a')]){logger[_0xfd7f('0x10')](_0xfd7f('0x4b'),_0xfd7f('0x4c'));_0x3a559b[_0xfd7f('0x4d')]=_0xf1f13;}else if(_0x1ef36f&&_0x1ef36f[_0xfd7f('0x4e')]&&_0x1ef36f[_0xfd7f('0x4e')]!==_0xfd7f('0x4f')){logger[_0xfd7f('0x10')]('[OUTBOUND]',_0xfd7f('0x4c'));_0x3a559b[_0xfd7f('0x4d')]=_0xf1f13;}else{_0x3a559b[_0xfd7f('0x4d')]='';}return getAdminId(_0x4ee878,_0x265750,_0x490996,_0x2cbc1f)[_0xfd7f('0x12')](getUser(_0x265750,_0x490996,_0x2cbc1f))['then'](getEndUser(_0x265750,_0x490996,_0x2cbc1f))['then'](getTicket(_0x265750,_0x490996,_0x2cbc1f,_0x4d1039,_0x3a559b))[_0xfd7f('0x12')](function(_0x6f9412){logger['info'](util[_0xfd7f('0x26')](_0xfd7f('0x50'),_0x6f9412['ticketId']));if(_0x265750!==_0xfd7f('0x46')){logger[_0xfd7f('0x10')]('['+[_0x265750['toUpperCase']()]+']',_0xfd7f('0x51'));emit(_0x2cbc1f,_0x51af57[_0xfd7f('0x52')],_0x6f9412[_0xfd7f('0x2a')]);}})['catch'](function(_0x37b136){logger['error']('['+[_0x265750[_0xfd7f('0x1b')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x37b136,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9f66=['adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','message','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','toUpperCase','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','endUserId','work_number','contactNumber','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','task','Task\x20created:','user:%s','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail'];(function(_0xe818fc,_0x321099){var _0x194d41=function(_0x5af855){while(--_0x5af855){_0xe818fc['push'](_0xe818fc['shift']());}};_0x194d41(++_0x321099);}(_0x9f66,0x8e));var _0x69f6=function(_0x323fff,_0x38f93e){_0x323fff=_0x323fff-0x0;var _0x326de5=_0x9f66[_0x323fff];return _0x326de5;};'use strict';var _=require(_0x69f6('0x0'));var rp=require(_0x69f6('0x1'));var md5=require(_0x69f6('0x2'));var util=require(_0x69f6('0x3'));var moment=require('moment');var Promise=require('bluebird');var Redis=require(_0x69f6('0x4'));var intUtil=require(_0x69f6('0x5'));var config=require(_0x69f6('0x6'));var logger=require(_0x69f6('0x7'))(_0x69f6('0x8'));config[_0x69f6('0x9')]=_[_0x69f6('0xa')](config[_0x69f6('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x69f6('0xb'))(new Redis(config[_0x69f6('0x9')]));function getAdminId(_0x16c15a,_0xe75248,_0x58397c,_0x3101b7){return new Promise(function(_0x1540db,_0x282843){var _0x143a72=![];var _0x521bbf={'method':_0x69f6('0xc'),'uri':_0x3101b7+_0x69f6('0xd'),'json':!![]};_0x521bbf[_0x69f6('0xe')]=_0x58397c;logger[_0x69f6('0xf')](_0x69f6('0x10'));return rp(_0x521bbf)[_0x69f6('0x11')](function(_0x36d402){if(_0x36d402){var _0x33a6c2=_0x36d402[_0x69f6('0x12')];var _0x2a0d48=null;for(_0x2a0d48=0x0;_0x2a0d48<_0x33a6c2[_0x69f6('0x13')];_0x2a0d48++){if(_0x33a6c2[_0x2a0d48][_0x69f6('0x14')]===_0x16c15a[_0x69f6('0x15')]){_0x16c15a[_0x69f6('0x16')]=_0x33a6c2[_0x2a0d48]['id'];_0x143a72=!![];}}if(_0x143a72){logger[_0x69f6('0xf')](_0x69f6('0x17'),_0x16c15a[_0x69f6('0x16')]);_0x1540db(_0x16c15a);}else{_0x282843({'statusCode':0x194,'message':_0x69f6('0x18')});}}else{_0x282843({'statusCode':0x194,'message':_0x69f6('0x18')});}})[_0x69f6('0x19')](function(_0x2b2ee9){logger[_0x69f6('0x1a')]('['+[_0xe75248['toUpperCase']()]+']',_0x2b2ee9[_0x69f6('0x1b')]);_0x282843(_0x2b2ee9);});});}function getUser(_0x9f0633,_0x80631d,_0x22f382){return function(_0x5cef3f){return new Promise(function(_0x180599,_0x5d0280){var _0x219804={'method':_0x69f6('0xc'),'uri':_0x22f382+_0x69f6('0xd'),'json':!![]};_0x219804['headers']=_0x80631d;logger[_0x69f6('0xf')]('Getting\x20user\x20list');return rp(_0x219804)[_0x69f6('0x11')](function(_0x178d04){if(_0x178d04){var _0x47e33b=_0x178d04[_0x69f6('0x12')];var _0x10731a=![];var _0x482e83=null;if(_0x5cef3f[_0x69f6('0x1c')]!==null){logger[_0x69f6('0xf')](_0x69f6('0x1d'),_0x5cef3f[_0x69f6('0x1c')]);_0x5cef3f[_0x69f6('0x1e')]=_0x5cef3f[_0x69f6('0x1c')];for(_0x482e83=0x0;_0x482e83<_0x47e33b['length'];_0x482e83++){if(_0x47e33b[_0x482e83]['email']===_0x5cef3f[_0x69f6('0x1c')]){_0x10731a=!![];_0x5cef3f[_0x69f6('0x1f')]=_0x47e33b[_0x482e83]['id'];logger[_0x69f6('0xf')](_0x69f6('0x20'),_0x5cef3f['userId']);}}}if(!_0x10731a){logger[_0x69f6('0xf')](_0x69f6('0x21'));_0x5cef3f[_0x69f6('0x1e')]=_0x5cef3f[_0x69f6('0x15')];_0x5cef3f[_0x69f6('0x1f')]=_0x5cef3f[_0x69f6('0x16')];_0x10731a=!![];}if(_0x10731a){_0x180599(_0x5cef3f);}else{_0x5d0280({'statusCode':0x194,'message':_0x69f6('0x18')});}}else{_0x5d0280({'statusCode':0x194,'message':_0x69f6('0x18')});}})[_0x69f6('0x19')](function(_0x457bd3){logger['error']('['+[_0x9f0633[_0x69f6('0x22')]()]+']',_0x457bd3[_0x69f6('0x1b')]);_0x5d0280(_0x457bd3);});});};}function searchContact(_0x2e200c,_0x2bbaa7,_0x25b10b,_0x812375){return new Promise(function(_0x2704d5,_0x2604a7){var _0xbffcc9={'method':_0x69f6('0xc'),'headers':_0x2bbaa7,'uri':_0x2e200c+'/api/lookup?q='+_0x812375+_0x69f6('0x23')+_0x25b10b+_0x69f6('0x24'),'json':!![]};rp(_0xbffcc9)[_0x69f6('0x11')](function(_0x1d5d68){var _0x5908d4=_[_0x69f6('0x25')](_0x1d5d68['contacts'][_0x69f6('0x26')],[_0x25b10b,_0x812375]);_0x2704d5(_0x5908d4);})[_0x69f6('0x19')](function(_0x5dc0fd){_0x2604a7(_0x5dc0fd);});});}function getEndUser(_0x5e4ac0,_0x3e75cc,_0x24e6db){return function(_0x403466){return new Promise(function(_0x372330,_0xb23127){logger[_0x69f6('0xf')](util[_0x69f6('0x27')](_0x69f6('0x28'),_0x403466['contactNumber']));searchContact(_0x24e6db,_0x3e75cc,_0x69f6('0x29'),_0x403466['contactNumber'])[_0x69f6('0x11')](function(_0x52bc07){if(_0x52bc07){_0x403466[_0x69f6('0x2a')]=_0x52bc07['id'];logger['info']('Contact\x20found\x20mobile_number:',_0x403466[_0x69f6('0x2a')]);return _0x372330(_0x403466);}searchContact(_0x24e6db,_0x3e75cc,_0x69f6('0x2b'),_0x403466[_0x69f6('0x2c')])[_0x69f6('0x11')](function(_0x12255a){if(_0x12255a){_0x403466[_0x69f6('0x2a')]=_0x12255a['id'];logger[_0x69f6('0xf')]('Contact\x20found\x20work_number:',_0x403466[_0x69f6('0x2a')]);return _0x372330(_0x403466);}createEndUser(_0x403466,_0x5e4ac0,_0x3e75cc,_0x24e6db)[_0x69f6('0x11')](function(_0x53195d){logger['info']('Contact\x20created:',_0x53195d[_0x69f6('0x2a')]);return _0x372330(_0x53195d);});});})[_0x69f6('0x19')](function(_0x31a9be){_0xb23127(_0x31a9be);});});};}function createEndUser(_0x5b7054,_0x3c106c,_0x18d3da,_0x150495){return new Promise(function(_0xaa5f03,_0x1a2462){var _0x4cd6b1=moment();var _0x5b8716={'method':_0x69f6('0x2d'),'uri':_0x150495+_0x69f6('0x2e'),'body':{'contact':{'last_name':_0x5b7054[_0x69f6('0x2c')],'work_number':_0x5b7054[_0x69f6('0x2c')],'mobile_number':_0x5b7054[_0x69f6('0x2c')],'owner_id':_0x5b7054['userId'],'created_at':_0x4cd6b1['format'](_0x69f6('0x2f'))}},'json':!![]};_0x5b8716[_0x69f6('0xe')]=_0x18d3da;logger[_0x69f6('0xf')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x5b8716)[_0x69f6('0x11')](function(_0xabae69){_0x5b7054['endUserId']=_0xabae69['contact']['id'];_0xaa5f03(_0x5b7054);})[_0x69f6('0x19')](function(_0xa54521){logger['error']('['+[_0x3c106c[_0x69f6('0x22')]()]+']',_0xa54521[_0x69f6('0x1b')]);_0x1a2462(_0xa54521[_0x69f6('0x1b')]);});});}function getTicket(_0x560c34,_0x23d093,_0x27db6a,_0x233b10,_0x1b9316){return function(_0x1072b3){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x448902,_0x42b626){var _0xd5b8cb=moment();var _0x368101={'method':_0x69f6('0x2d'),'uri':_0x27db6a+_0x69f6('0x30'),'body':{'title':intUtil[_0x69f6('0x31')](_0x233b10[_0x69f6('0x32')],_0x1b9316,'\x20'),'description':intUtil['getString'](_0x233b10[_0x69f6('0x33')],_0x1b9316,'\x0a'),'owner_id':_0x1072b3[_0x69f6('0x1f')],'creater_id':_0x1072b3[_0x69f6('0x16')],'targetable_id':_0x1072b3[_0x69f6('0x2a')],'targetable_type':_0x69f6('0x34'),'created_at':_0xd5b8cb[_0x69f6('0x27')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0xd5b8cb[_0x69f6('0x35')](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x368101['headers']=_0x23d093;return rp(_0x368101)[_0x69f6('0x11')](function(_0x4227ac){_0x1072b3[_0x69f6('0x36')]=_0x4227ac[_0x69f6('0x37')]['id'];logger[_0x69f6('0xf')](_0x69f6('0x38'),_0x1072b3[_0x69f6('0x36')]);_0x448902(_0x1072b3);})[_0x69f6('0x19')](function(_0x92822a){logger['error']('['+[_0x560c34[_0x69f6('0x22')]()]+']',_0x92822a[_0x69f6('0x1b')]);_0x42b626(_0x92822a[_0x69f6('0x1b')]);});});};}function emit(_0x5e94f8,_0x4a79ed,_0x96b2c7){var _0x44f4a8={'uri':_0x5e94f8+'/contacts/'+_0x96b2c7};io['to'](util[_0x69f6('0x27')](_0x69f6('0x39'),_0x4a79ed))['emit'](_0x69f6('0x3a'),_0x44f4a8);}exports['cs']=function(_0x50c0b3,_0x391326,_0x40488d,_0x39b5c6,_0x538809,_0x3009a7,_0x409047,_0xf3f835){var _0x9dab2a={};var _0x5897f5={'Authorization':_0x69f6('0x3b')+_0x3009a7[_0x69f6('0x3c')]};_0x3009a7[_0x69f6('0x3d')]=intUtil[_0x69f6('0x3e')](_0x3009a7[_0x69f6('0x3d')]);_0x3009a7[_0x69f6('0x3f')]=intUtil[_0x69f6('0x3e')](_0x3009a7[_0x69f6('0x3f')]);var _0x30d2ae=_0x3009a7[_0x69f6('0x3d')];_0x9dab2a['adminEmail']=_0x3009a7['username'];_0x9dab2a[_0x69f6('0x2c')]=_0xf3f835[_0x69f6('0x40')]()===_0x69f6('0x41')?_0x391326[_0x69f6('0x42')]:_0x391326[_0x69f6('0x43')];_0x9dab2a[_0x69f6('0x44')]=_0xf3f835==='queue'||_0xf3f835==='unmanaged'?'queue':'outbound';if(_0x39b5c6){_0x9dab2a[_0x69f6('0x1c')]=_0x39b5c6['email'];}var _0x3bb711=util[_0x69f6('0x27')](_0x69f6('0x45'),_0x3009a7[_0x69f6('0x3f')],_0x391326[_0x69f6('0x46')],md5(_0x391326['uniqueid']));if(_0x538809&&_0x538809[_0x69f6('0x47')]){logger[_0x69f6('0xf')]('[QUEUE]',_0x69f6('0x48'));_0x391326[_0x69f6('0x49')]=_0x3bb711;}else if(_0x409047&&_0x409047[_0x69f6('0x4a')]&&_0x409047['recordingFormat']!==_0x69f6('0x4b')){logger[_0x69f6('0xf')](_0x69f6('0x4c'),'Recording\x20is\x20enabled!');_0x391326[_0x69f6('0x49')]=_0x3bb711;}else{_0x391326[_0x69f6('0x49')]='';}return getAdminId(_0x9dab2a,_0xf3f835,_0x5897f5,_0x30d2ae)[_0x69f6('0x11')](getUser(_0xf3f835,_0x5897f5,_0x30d2ae))[_0x69f6('0x11')](getEndUser(_0xf3f835,_0x5897f5,_0x30d2ae))[_0x69f6('0x11')](getTicket(_0xf3f835,_0x5897f5,_0x30d2ae,_0x40488d,_0x391326))[_0x69f6('0x11')](function(_0xc8a324){logger[_0x69f6('0xf')](util['format'](_0x69f6('0x4d'),_0xc8a324[_0x69f6('0x36')]));if(_0xf3f835!==_0x69f6('0x4e')){logger['info']('['+[_0xf3f835['toUpperCase']()]+']',_0x69f6('0x4f'));emit(_0x30d2ae,_0x39b5c6[_0x69f6('0x50')],_0xc8a324[_0x69f6('0x2a')]);}})[_0x69f6('0x19')](function(_0x5c8885){logger[_0x69f6('0x1a')]('['+[_0xf3f835[_0x69f6('0x22')]()]+_0x69f6('0x51'),util['inspect'](_0x5c8885,{'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 63d2b7c..af60f0d 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 _0xed20=['freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','vtiger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./freshsales','zendesk','sugarcrm','freshdesk','zoho','desk','dynamics365'];(function(_0x48d1b7,_0x1b7aa5){var _0x2c7509=function(_0x4393eb){while(--_0x4393eb){_0x48d1b7['push'](_0x48d1b7['shift']());}};_0x2c7509(++_0x1b7aa5);}(_0xed20,0xce));var _0x0ed2=function(_0x580a17,_0xbaae01){_0x580a17=_0x580a17-0x0;var _0x5b8dfd=_0xed20[_0x580a17];return _0x5b8dfd;};'use strict';var _=require(_0x0ed2('0x0'));var util=require(_0x0ed2('0x1'));var zendesk=require(_0x0ed2('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0x0ed2('0x3'));var freshdesk=require(_0x0ed2('0x4'));var zoho=require(_0x0ed2('0x5'));var desk=require(_0x0ed2('0x6'));var vtiger=require(_0x0ed2('0x7'));var servicenow=require(_0x0ed2('0x8'));var dynamics365=require('./dynamics365');var freshsales=require(_0x0ed2('0x9'));var integrations=[_0x0ed2('0xa'),'salesforce',_0x0ed2('0xb'),_0x0ed2('0xc'),_0x0ed2('0xd'),_0x0ed2('0xe'),'vtiger',_0x0ed2('0xf'),_0x0ed2('0x10'),_0x0ed2('0x11')];exports[_0x0ed2('0x12')]=function(_0x48f0aa,_0x4d6fe2,_0x36bd70,_0x1a3885,_0x245e65,_0x14689b){if(_0x36bd70){if(_[_0x0ed2('0x13')](integrations,_0x48f0aa[_0x0ed2('0x14')][_0x0ed2('0x15')]())){try{var _0x191b26=null;var _0x3cc6b4='';var _0x342768=_0x36bd70[_0x48f0aa[_0x0ed2('0x14')][_0x0ed2('0x15')]()];if(_0x342768){var _0x52c70b=_0x342768[_0x48f0aa[_0x0ed2('0x16')]];if(_0x52c70b){var _0x3b0f4b=_[_0x0ed2('0x17')](_0x52c70b[_0x0ed2('0x18')],{'id':parseInt(_0x48f0aa[_0x0ed2('0x19')],0xa)});if(_0x3b0f4b){if(_0x1a3885){if(_0x245e65&&_0x4d6fe2['queue']){_0x3cc6b4=_0x0ed2('0x1a');}else if(_0x4d6fe2[_0x0ed2('0x1b')]){_0x3cc6b4=_0x0ed2('0x1c');}else{console['log'](_0x0ed2('0x1d'),_0x4d6fe2);}}else{_0x3cc6b4='unmanaged';}switch(_0x48f0aa[_0x0ed2('0x14')][_0x0ed2('0x15')]()){case _0x0ed2('0xa'):zendesk[_0x3cc6b4](_0x48f0aa,_0x4d6fe2,_0x3b0f4b,_0x1a3885,_0x245e65,_0x52c70b,_0x14689b);break;case'salesforce':salesforce[_0x3cc6b4](_0x48f0aa,_0x4d6fe2,_0x3b0f4b,_0x1a3885,_0x245e65,_0x52c70b,_0x14689b);break;case'sugarcrm':sugarcrm[_0x3cc6b4](_0x48f0aa,_0x4d6fe2,_0x3b0f4b,_0x1a3885,_0x245e65,_0x52c70b,_0x14689b);break;case _0x0ed2('0xc'):freshdesk[_0x3cc6b4](_0x48f0aa,_0x4d6fe2,_0x3b0f4b,_0x1a3885,_0x245e65,_0x52c70b,_0x14689b);break;case _0x0ed2('0xd'):zoho[_0x3cc6b4](_0x48f0aa,_0x4d6fe2,_0x3b0f4b,_0x1a3885,_0x245e65,_0x52c70b,_0x14689b);break;case'desk':desk[_0x3cc6b4](_0x48f0aa,_0x4d6fe2,_0x3b0f4b,_0x1a3885,_0x245e65,_0x52c70b,_0x14689b);break;case _0x0ed2('0x1e'):vtiger[_0x3cc6b4](_0x48f0aa,_0x4d6fe2,_0x3b0f4b,_0x1a3885,_0x245e65,_0x52c70b,_0x14689b);break;case'freshsales':freshsales['cs'](_0x48f0aa,_0x4d6fe2,_0x3b0f4b,_0x1a3885,_0x245e65,_0x52c70b,_0x14689b,_0x3cc6b4);break;case _0x0ed2('0x11'):servicenow['cs'](_0x48f0aa,_0x4d6fe2,_0x3b0f4b,_0x1a3885,_0x245e65,_0x52c70b,_0x14689b,_0x3cc6b4);break;case _0x0ed2('0xf'):dynamics365['cs'](_0x48f0aa,_0x4d6fe2,_0x3b0f4b,_0x1a3885,_0x245e65,_0x52c70b,_0x14689b,_0x3cc6b4);break;default:console['log']('unknown\x20integration');}}else{_0x191b26=require('../../../../config/logger')(_0x48f0aa[_0x0ed2('0x14')][_0x0ed2('0x15')]());_0x191b26[_0x0ed2('0x1f')](_0x0ed2('0x20'),util[_0x0ed2('0x21')](_0x0ed2('0x22'),_0x48f0aa[_0x0ed2('0x14')]['toLowerCase'](),_0x48f0aa['data3']));}}else{_0x191b26=require(_0x0ed2('0x23'))(_0x48f0aa[_0x0ed2('0x14')][_0x0ed2('0x15')]());_0x191b26[_0x0ed2('0x1f')](_0x0ed2('0x20'),util[_0x0ed2('0x21')](_0x0ed2('0x24'),_0x48f0aa[_0x0ed2('0x14')]['toLowerCase'](),_0x48f0aa[_0x0ed2('0x16')]));}}else{}}catch(_0x24983e){console[_0x0ed2('0x1f')](_0x24983e);}}}}; \ No newline at end of file +var _0x8009=['[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./sugarcrm','./freshdesk','./desk','./servicenow','./dynamics365','salesforce','sugarcrm','freshdesk','zoho','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','data3','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','zendesk','desk','unknown\x20integration','error'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x8009,0x19c));var _0x9800=function(_0x3d2fb4,_0x2b3019){_0x3d2fb4=_0x3d2fb4-0x0;var _0xe52e4=_0x8009[_0x3d2fb4];return _0xe52e4;};'use strict';var _=require(_0x9800('0x0'));var util=require(_0x9800('0x1'));var zendesk=require(_0x9800('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0x9800('0x3'));var freshdesk=require(_0x9800('0x4'));var zoho=require('./zoho');var desk=require(_0x9800('0x5'));var vtiger=require('./vtiger');var servicenow=require(_0x9800('0x6'));var dynamics365=require(_0x9800('0x7'));var freshsales=require('./freshsales');var integrations=['zendesk',_0x9800('0x8'),_0x9800('0x9'),_0x9800('0xa'),_0x9800('0xb'),'desk',_0x9800('0xc'),_0x9800('0xd'),_0x9800('0xe'),_0x9800('0xf')];exports[_0x9800('0x10')]=function(_0x33665b,_0x37d5fd,_0x5c5f81,_0x57dda3,_0x543395,_0x28dedd){if(_0x5c5f81){if(_[_0x9800('0x11')](integrations,_0x33665b[_0x9800('0x12')][_0x9800('0x13')]())){try{var _0x30d2a3=null;var _0x272dc7='';var _0x5534ea=_0x5c5f81[_0x33665b[_0x9800('0x12')][_0x9800('0x13')]()];if(_0x5534ea){var _0x2d5a02=_0x5534ea[_0x33665b[_0x9800('0x14')]];if(_0x2d5a02){var _0x5edc79=_[_0x9800('0x15')](_0x2d5a02['Configurations'],{'id':parseInt(_0x33665b[_0x9800('0x16')],0xa)});if(_0x5edc79){if(_0x57dda3){if(_0x543395&&_0x37d5fd['queue']){_0x272dc7='queue';}else if(_0x37d5fd[_0x9800('0x17')]){_0x272dc7=_0x9800('0x18');}else{console[_0x9800('0x19')](_0x9800('0x1a'),_0x37d5fd);}}else{_0x272dc7=_0x9800('0x1b');}switch(_0x33665b[_0x9800('0x12')][_0x9800('0x13')]()){case _0x9800('0x1c'):zendesk[_0x272dc7](_0x33665b,_0x37d5fd,_0x5edc79,_0x57dda3,_0x543395,_0x2d5a02,_0x28dedd);break;case _0x9800('0x8'):salesforce[_0x272dc7](_0x33665b,_0x37d5fd,_0x5edc79,_0x57dda3,_0x543395,_0x2d5a02,_0x28dedd);break;case _0x9800('0x9'):sugarcrm[_0x272dc7](_0x33665b,_0x37d5fd,_0x5edc79,_0x57dda3,_0x543395,_0x2d5a02,_0x28dedd);break;case _0x9800('0xa'):freshdesk[_0x272dc7](_0x33665b,_0x37d5fd,_0x5edc79,_0x57dda3,_0x543395,_0x2d5a02,_0x28dedd);break;case _0x9800('0xb'):zoho[_0x272dc7](_0x33665b,_0x37d5fd,_0x5edc79,_0x57dda3,_0x543395,_0x2d5a02,_0x28dedd);break;case _0x9800('0x1d'):desk[_0x272dc7](_0x33665b,_0x37d5fd,_0x5edc79,_0x57dda3,_0x543395,_0x2d5a02,_0x28dedd);break;case'vtiger':vtiger[_0x272dc7](_0x33665b,_0x37d5fd,_0x5edc79,_0x57dda3,_0x543395,_0x2d5a02,_0x28dedd);break;case _0x9800('0xe'):freshsales['cs'](_0x33665b,_0x37d5fd,_0x5edc79,_0x57dda3,_0x543395,_0x2d5a02,_0x28dedd,_0x272dc7);break;case _0x9800('0xf'):servicenow['cs'](_0x33665b,_0x37d5fd,_0x5edc79,_0x57dda3,_0x543395,_0x2d5a02,_0x28dedd,_0x272dc7);break;case _0x9800('0xd'):dynamics365['cs'](_0x33665b,_0x37d5fd,_0x5edc79,_0x57dda3,_0x543395,_0x2d5a02,_0x28dedd,_0x272dc7);break;default:console['log'](_0x9800('0x1e'));}}else{_0x30d2a3=require('../../../../config/logger')(_0x33665b['data1'][_0x9800('0x13')]());_0x30d2a3[_0x9800('0x1f')](_0x9800('0x20'),util['format'](_0x9800('0x21'),_0x33665b[_0x9800('0x12')][_0x9800('0x13')](),_0x33665b[_0x9800('0x16')]));}}else{_0x30d2a3=require(_0x9800('0x22'))(_0x33665b[_0x9800('0x12')][_0x9800('0x13')]());_0x30d2a3[_0x9800('0x1f')](_0x9800('0x20'),util[_0x9800('0x23')](_0x9800('0x24'),_0x33665b[_0x9800('0x12')][_0x9800('0x13')](),_0x33665b['data2']));}}else{}}catch(_0x5b4bf8){console[_0x9800('0x1f')](_0x5b4bf8);}}}}; \ 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 25206cd..7f4eeae 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 _0x7643=['merge','additionalSearchLead','$or','additionalSearchAccount','Account','Contact','Lead','first','Phone','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','Caller\x20-\x20%s','Company','format','upperFirst','string','picklist','idField','content','toString','variableName','customVariable','Variable','name','securityToken','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','[QUEUE]','outbound','recordingFormat','[OUTBOUND]','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','newTab','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase','lodash','moment','bluebird','md5','jsforce','util','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','assign','Descriptions','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','ticketType','Case','ContactId','AccountId','leadId','info','sobject','create','isNil','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact'];(function(_0x421c56,_0x4efd00){var _0x49b244=function(_0x5cd079){while(--_0x5cd079){_0x421c56['push'](_0x421c56['shift']());}};_0x49b244(++_0x4efd00);}(_0x7643,0x1be));var _0x3764=function(_0x345705,_0x2829c1){_0x345705=_0x345705-0x0;var _0x22c250=_0x7643[_0x345705];return _0x22c250;};'use strict';var _=require(_0x3764('0x0'));var rp=require('request-promise');var moment=require(_0x3764('0x1'));var BPromise=require(_0x3764('0x2'));var md5=require(_0x3764('0x3'));var jsforce=require(_0x3764('0x4'));var util=require(_0x3764('0x5'));var Redis=require('ioredis');var intUtil=require(_0x3764('0x6'));var config=require(_0x3764('0x7'));var logger=require(_0x3764('0x8'))('salesforce');config[_0x3764('0x9')]=_[_0x3764('0xa')](config[_0x3764('0x9')],{'host':_0x3764('0xb'),'port':0x18eb});var io=require(_0x3764('0xc'))(new Redis(config[_0x3764('0x9')]));function emit(_0x51943d,_0x272e1b,_0x5576b2){io['to'](_0x51943d)[_0x3764('0xd')](_0x272e1b,_0x5576b2);}function getTicket(_0x2a050b,_0x54efa1,_0x14f931,_0x448c01,_0x4c6385,_0x37fc16,_0x31d732,_0x386ec7){var _0x4dd6bf=Object[_0x3764('0xe')]({},{'OwnerId':_0x54efa1['id'],'Subject':intUtil['getString'](_0x448c01['Subjects'],_0x4c6385,'\x20'),'Description':intUtil['getString'](_0x448c01[_0x3764('0xf')],_0x4c6385,'\x0a')},getCustomFields(_0x37fc16,_0x4c6385));if(_0x14f931){if(_0x448c01['ticketType']===_0x3764('0x10')){_0x4dd6bf[_0x3764('0x11')]=moment[_0x3764('0x12')]();_0x4dd6bf[_0x3764('0x13')]=![];_0x4dd6bf[_0x3764('0x14')]=![];if(_0x14f931[_0x3764('0x15')]===_0x3764('0x16')||_0x14f931[_0x3764('0x15')]===_0x3764('0x17')){_0x4dd6bf[_0x3764('0x18')]=_0x14f931['id'];}else if(_0x14f931[_0x3764('0x15')]===_0x3764('0x19')){_0x4dd6bf[_0x3764('0x1a')]=_0x14f931['id'];}}else if(_0x448c01[_0x3764('0x1b')]===_0x3764('0x1c')){if(_0x14f931[_0x3764('0x15')]==='contact'){_0x4dd6bf[_0x3764('0x1d')]=_0x14f931['id'];}else if(_0x14f931[_0x3764('0x15')]===_0x3764('0x19')){_0x4dd6bf[_0x3764('0x1e')]=_0x14f931['id'];}else if(_0x14f931[_0x3764('0x15')]===_0x3764('0x17')&&_0x448c01[_0x3764('0x1f')]){_0x4dd6bf[_0x448c01['leadId']]=_0x14f931['id'];}else{logger[_0x3764('0x20')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x31d732[_0x3764('0x21')](_0x448c01[_0x3764('0x1b')])[_0x3764('0x22')](_0x4dd6bf);}function getUser(_0x4a80a1,_0x2feaa9,_0x15e74d){if(!_[_0x3764('0x23')](_0x2feaa9)&&intUtil['validateEmail'](_0x2feaa9)){var _0x5cc362={'Email':_0x2feaa9};var _0x1e0c74={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x15e74d['sobject'](_0x3764('0x24'))[_0x3764('0x25')](_0x5cc362,_0x1e0c74)[_0x3764('0x26')]()[_0x3764('0x27')](function(_0x5ace71){if(_0x5ace71[_0x3764('0x28')]){var _0x4705fd=_[_0x3764('0x25')](_0x5ace71,function(_0x290201){return _0x290201[_0x3764('0x29')]===_0x2feaa9;});if(_0x4705fd){logger[_0x3764('0x20')](_0x3764('0x2a'),_0x2feaa9);return BPromise[_0x3764('0x2b')]({'id':_0x4705fd['Id'],'name':_0x4705fd[_0x3764('0x2c')]});}}else{logger[_0x3764('0x20')](_0x3764('0x2d'),_0x2feaa9);return _0x15e74d[_0x3764('0x2e')]()['then'](function(_0x275f2a){return BPromise[_0x3764('0x2b')]({'id':_0x275f2a[_0x3764('0x2f')],'name':_0x275f2a[_0x3764('0x30')]});});}});}else{logger[_0x3764('0x20')](_0x3764('0x2d'),_0x2feaa9);return _0x15e74d['identity']()[_0x3764('0x27')](function(_0x369df2){return BPromise[_0x3764('0x2b')]({'id':_0x369df2[_0x3764('0x2f')],'name':_0x369df2['display_name']});});}}function getEndUser(_0x395707,_0x18688d,_0x4aa26d,_0x49070e,_0x1bb872){var _0x483c8c={'$or':{'Phone':_0x49070e}};var _0x436448={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x3764('0x2b')]()[_0x3764('0x27')](function(){logger[_0x3764('0x20')](_0x3764('0x31'),_0x49070e,_0x18688d[_0x3764('0x32')]);switch(_0x18688d[_0x3764('0x32')]){case _0x3764('0x33'):var _0x375146=_[_0x3764('0x34')](_0x483c8c);if(_0x18688d[_0x3764('0x35')]){var _0x326c25={};_0x326c25[_0x18688d['additionalSearchContact']]=_0x49070e;_[_0x3764('0x36')](_0x375146['$or'],_0x326c25);}return _0x1bb872[_0x3764('0x21')]('Contact')[_0x3764('0x25')](_0x375146,_0x436448)[_0x3764('0x26')]()['then'](function(_0x4ee99f){if(_0x4ee99f&&_0x4ee99f[_0x3764('0x28')]){return _0x4ee99f;}else{var _0x4684b2=_[_0x3764('0x34')](_0x483c8c);if(_0x18688d[_0x3764('0x37')]){var _0x2fcbd2={};_0x2fcbd2[_0x18688d[_0x3764('0x37')]]=_0x49070e;_[_0x3764('0x36')](_0x4684b2[_0x3764('0x38')],_0x2fcbd2);}return _0x1bb872[_0x3764('0x21')]('Lead')[_0x3764('0x25')](_0x4684b2,_0x436448);}});case'account_contact_lead':var _0x5343b1=_['cloneDeep'](_0x483c8c);if(_0x18688d[_0x3764('0x39')]){var _0x326c25={};_0x326c25[_0x18688d['additionalSearchAccount']]=_0x49070e;_[_0x3764('0x36')](_0x5343b1[_0x3764('0x38')],_0x326c25);}return _0x1bb872[_0x3764('0x21')](_0x3764('0x3a'))[_0x3764('0x25')](_0x5343b1,_0x436448)[_0x3764('0x26')]()['then'](function(_0x5f48d5){if(_0x5f48d5&&_0x5f48d5[_0x3764('0x28')]){return _0x5f48d5;}else{var _0x1fdff8=_[_0x3764('0x34')](_0x483c8c);if(_0x18688d[_0x3764('0x35')]){var _0x23fefd={};_0x23fefd[_0x18688d[_0x3764('0x35')]]=_0x49070e;_[_0x3764('0x36')](_0x1fdff8['$or'],_0x23fefd);}return _0x1bb872['sobject'](_0x3764('0x3b'))['find'](_0x1fdff8,_0x436448)[_0x3764('0x27')](function(_0xa3bd05){if(_0xa3bd05&&_0xa3bd05[_0x3764('0x28')]){return _0xa3bd05;}else{var _0x17bc11=_[_0x3764('0x34')](_0x483c8c);if(_0x18688d[_0x3764('0x37')]){var _0x540b52={};_0x540b52[_0x18688d['additionalSearchLead']]=_0x49070e;_[_0x3764('0x36')](_0x17bc11[_0x3764('0x38')],_0x540b52);}return _0x1bb872[_0x3764('0x21')]('Lead')[_0x3764('0x25')](_0x17bc11,_0x436448);}});}});case _0x3764('0x16'):var _0x375146=_[_0x3764('0x34')](_0x483c8c);if(_0x18688d[_0x3764('0x35')]){var _0x326c25={};_0x326c25[_0x18688d[_0x3764('0x35')]]=_0x49070e;_['merge'](_0x375146[_0x3764('0x38')],_0x326c25);}return _0x1bb872[_0x3764('0x21')](_0x3764('0x3b'))[_0x3764('0x25')](_0x375146,_0x436448)[_0x3764('0x26')]();case _0x3764('0x17'):var _0x3e05e7=_[_0x3764('0x34')](_0x483c8c);if(_0x18688d[_0x3764('0x37')]){var _0x326c25={};_0x326c25[_0x18688d[_0x3764('0x37')]]=_0x49070e;_[_0x3764('0x36')](_0x3e05e7[_0x3764('0x38')],_0x326c25);}return _0x1bb872[_0x3764('0x21')](_0x3764('0x3c'))[_0x3764('0x25')](_0x3e05e7,_0x436448);case _0x3764('0x19'):var _0x5343b1=_['cloneDeep'](_0x483c8c);if(_0x18688d[_0x3764('0x39')]){var _0x326c25={};_0x326c25[_0x18688d[_0x3764('0x39')]]=_0x49070e;_[_0x3764('0x36')](_0x5343b1[_0x3764('0x38')],_0x326c25);}return _0x1bb872[_0x3764('0x21')](_0x3764('0x3a'))['find'](_0x5343b1,_0x436448);default:return null;}})[_0x3764('0x27')](function(_0x3c6824){if(_0x3c6824&&_0x3c6824['length']){var _0x28cf49=_[_0x3764('0x3d')](_0x3c6824);if(_0x28cf49){return BPromise['resolve']({'id':_0x28cf49['Id'],'name':_0x28cf49[_0x3764('0x2c')],'phone':_0x28cf49[_0x3764('0x3e')],'endUserType':_0x28cf49['attributes'][_0x3764('0x3f')][_0x3764('0x40')]()});}}})[_0x3764('0x27')](function(_0x10cb8c){if(_0x10cb8c){logger['info'](_0x3764('0x41'),_0x10cb8c[_0x3764('0x15')],_0x49070e);return BPromise[_0x3764('0x2b')](_0x10cb8c);}else{logger[_0x3764('0x20')](_0x3764('0x42'),_0x49070e);var _0x6a9de7={'Phone':_0x49070e};if(_0x18688d[_0x3764('0x43')]){if(_0x18688d[_0x3764('0x43')]===_0x3764('0x16')){logger['info'](_0x3764('0x44'),_0x49070e,_0x18688d[_0x3764('0x43')]);_0x6a9de7[_0x3764('0x45')]=_0x4aa26d!==_0x3764('0x46')?_0x4aa26d:util['format'](_0x3764('0x47'),_0x49070e);}else if(_0x18688d['moduleCreate']==='lead'){logger[_0x3764('0x20')](_0x3764('0x44'),_0x49070e,_0x18688d[_0x3764('0x43')]);_0x6a9de7[_0x3764('0x45')]=_0x4aa26d!==_0x3764('0x46')?_0x4aa26d:util['format']('Caller\x20-\x20%s',_0x49070e);_0x6a9de7[_0x3764('0x48')]='No\x20Company';}else if(_0x18688d['moduleCreate']===_0x3764('0x19')){logger[_0x3764('0x20')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x49070e,_0x18688d['moduleCreate']);_0x6a9de7[_0x3764('0x2c')]=_0x4aa26d!==''?_0x4aa26d:util[_0x3764('0x49')]('Caller\x20-\x20%s',_0x49070e);}else{return null;}}return _0x1bb872[_0x3764('0x21')](_[_0x3764('0x4a')](_0x18688d[_0x3764('0x43')]))['create'](_0x6a9de7)[_0x3764('0x27')](function(_0x52376f){return BPromise[_0x3764('0x2b')]({'id':_0x52376f['id'],'endUserType':_0x18688d[_0x3764('0x43')]});});}});}function getCustomFields(_0x135f43,_0x1f46ac){var _0x3c5d35={};if(_0x135f43[_0x3764('0x28')]>0x0){_['forEach'](_0x135f43,function(_0x4699a3){if(_['includes']([_0x3764('0x4b'),_0x3764('0x4c')],_0x4699a3[_0x3764('0x3f')])&&_0x4699a3[_0x3764('0x4d')]){_0x3c5d35[_0x4699a3[_0x3764('0x4d')]]=_0x4699a3[_0x3764('0x4e')][_0x3764('0x4f')]();}else if(_0x4699a3[_0x3764('0x3f')]==='variable'&&_0x4699a3[_0x3764('0x50')]&&_0x4699a3[_0x3764('0x4d')]){_0x1f46ac[_0x4699a3[_0x3764('0x50')]]&&(_0x3c5d35[_0x4699a3[_0x3764('0x4d')]]=_0x1f46ac[_0x4699a3[_0x3764('0x50')]][_0x3764('0x4f')]());}else if(_0x4699a3[_0x3764('0x3f')]===_0x3764('0x51')&&_0x4699a3['Variable']&&_0x4699a3[_0x3764('0x52')][_0x3764('0x53')]&&_0x4699a3['idField']){_0x1f46ac[_0x4699a3[_0x3764('0x52')][_0x3764('0x53')][_0x3764('0x40')]()]&&(_0x3c5d35[_0x4699a3[_0x3764('0x4d')]]=_0x1f46ac[_0x4699a3[_0x3764('0x52')]['name'][_0x3764('0x40')]()][_0x3764('0x4f')]());}});}return _0x3c5d35;}function getConnection(_0x12d5be){var _0x1a2bfb=_0x12d5be['password']['concat'](_0x12d5be[_0x3764('0x54')]);var _0x2a2624=new jsforce['Connection']({'oauth2':{'loginUrl':_0x12d5be['remoteUri']||_0x3764('0x55'),'clientId':_0x12d5be[_0x3764('0x56')],'clientSecret':_0x12d5be[_0x3764('0x57')]}});return _0x2a2624[_0x3764('0x58')](_0x12d5be[_0x3764('0x59')],_0x1a2bfb)[_0x3764('0x27')](function(){logger[_0x3764('0x20')](_0x3764('0x5a'));return _0x2a2624;});}exports[_0x3764('0x5b')]=function(_0x40b5f7,_0x129589,_0x4d48e7,_0x3128f3,_0x214280,_0x337e6e){var _0x104fb9,_0x36b227,_0x2a121c,_0x129f12;_0x337e6e[_0x3764('0x5c')]=intUtil[_0x3764('0x5d')](_0x337e6e[_0x3764('0x5c')]);_0x337e6e[_0x3764('0x5e')]=intUtil[_0x3764('0x5d')](_0x337e6e[_0x3764('0x5e')]);if(_0x214280&&_0x214280[_0x3764('0x5f')]){logger[_0x3764('0x20')]('[QUEUE]',_0x3764('0x60'));_0x129589[_0x3764('0x61')]=util[_0x3764('0x49')](_0x3764('0x62'),_0x337e6e[_0x3764('0x5c')],_0x129589[_0x3764('0x63')],md5(_0x129589[_0x3764('0x63')]));}else{_0x129589[_0x3764('0x61')]='';}return getConnection(_0x337e6e)[_0x3764('0x27')](function(_0x21e56c){_0x129f12=_0x21e56c;return getUser(_0x337e6e,_0x3128f3[_0x3764('0x64')],_0x129f12);})[_0x3764('0x27')](function(_0x536036){_0x104fb9=_0x536036;return getEndUser(_0x337e6e,_0x4d48e7,_0x129589[_0x3764('0x65')],_0x129589[_0x3764('0x66')],_0x129f12);})[_0x3764('0x27')](function(_0x2d9ccb){_0x36b227=_0x2d9ccb;return getTicket(_0x337e6e,_0x104fb9,_0x36b227,_0x4d48e7,_0x129589,_0x4d48e7[_0x3764('0x67')],_0x129f12,_0x3764('0x5b'));})[_0x3764('0x27')](function(_0x312a7e){_0x2a121c=_0x312a7e;logger[_0x3764('0x20')](_0x3764('0x68'),_0x2a121c['id']);logger[_0x3764('0x20')](_0x3764('0x69'),_0x2a121c['id'],_0x3128f3[_0x3764('0x53')],_0x337e6e[_0x3764('0x3f')]);switch(_0x337e6e['type']){case'integrationTab':emit(util[_0x3764('0x49')]('user:%s',_0x3128f3[_0x3764('0x53')]),_0x3764('0x6a'),{'recordId':_0x2a121c['id']});break;case'newTab':emit(util[_0x3764('0x49')](_0x3764('0x6b'),_0x3128f3['name']),_0x3764('0x6c'),{'uri':util[_0x3764('0x49')](_0x3764('0x6d'),_0x129f12[_0x3764('0x6e')],_0x2a121c['id'])});break;default:logger[_0x3764('0x6f')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x3764('0x70')](function(_0x352161){logger[_0x3764('0x6f')](_0x3764('0x71'),_0x352161);});};exports[_0x3764('0x72')]=function(_0x580ead,_0xb02df3,_0x382c43,_0x6c8263,_0xd96167,_0x49cd21,_0x3e7677){var _0x25ec5e,_0x1376d7,_0x43aa1d,_0x186a80;_0x49cd21[_0x3764('0x5c')]=intUtil['stripTrailingSlash'](_0x49cd21['serverUrl']);_0x49cd21['remoteUri']=intUtil['stripTrailingSlash'](_0x49cd21[_0x3764('0x5e')]);if(_0x3e7677&&_0x3e7677[_0x3764('0x73')]&&_0x3e7677[_0x3764('0x73')]!=='none'){logger[_0x3764('0x20')](_0x3764('0x74'),_0x3764('0x60'));_0xb02df3['recordingURL']=util[_0x3764('0x49')](_0x3764('0x62'),_0x49cd21[_0x3764('0x5c')],_0xb02df3[_0x3764('0x63')],md5(_0xb02df3[_0x3764('0x63')]));}return getConnection(_0x49cd21)[_0x3764('0x27')](function(_0x2afa8b){_0x186a80=_0x2afa8b;return getUser(_0x49cd21,_0x6c8263[_0x3764('0x64')],_0x186a80);})[_0x3764('0x27')](function(_0x4df8d6){_0x25ec5e=_0x4df8d6;return getEndUser(_0x49cd21,_0x382c43,_0xb02df3[_0x3764('0x75')],_0xb02df3['destcalleridnum'],_0x186a80);})['then'](function(_0x201aea){_0x1376d7=_0x201aea;return getTicket(_0x49cd21,_0x25ec5e,_0x1376d7,_0x382c43,_0xb02df3,_0x382c43['Fields'],_0x186a80,_0x3764('0x72'));})[_0x3764('0x27')](function(_0x36d0ee){_0x43aa1d=_0x36d0ee;logger[_0x3764('0x20')](_0x3764('0x76'),_0x43aa1d['id']);logger[_0x3764('0x20')](_0x3764('0x77'),_0x43aa1d['id'],_0x6c8263[_0x3764('0x53')],_0x49cd21[_0x3764('0x3f')]);switch(_0x49cd21[_0x3764('0x3f')]){case _0x3764('0x78'):emit(util['format']('user:%s',_0x6c8263[_0x3764('0x53')]),_0x3764('0x6a'),{'recordId':_0x43aa1d['id']});break;case _0x3764('0x79'):emit(util[_0x3764('0x49')](_0x3764('0x6b'),_0x6c8263[_0x3764('0x53')]),_0x3764('0x6c'),{'uri':util['format'](_0x3764('0x6d'),_0x186a80['instanceUrl'],_0x43aa1d['id'])});break;default:logger[_0x3764('0x6f')](_0x3764('0x74'),_0x3764('0x7a'));}})[_0x3764('0x70')](function(_0x1469ff){logger[_0x3764('0x6f')](_0x3764('0x74'),_0x1469ff);});};exports['unmanaged']=function(_0x162fc2,_0x27b8e9,_0x19cdf7,_0x4b91f0,_0x2d454c,_0x2381ca){var _0x390696,_0x55fd22,_0x8fb0b5,_0x490b7e;_0x2381ca[_0x3764('0x5c')]=intUtil[_0x3764('0x5d')](_0x2381ca[_0x3764('0x5c')]);_0x2381ca[_0x3764('0x5e')]=intUtil[_0x3764('0x5d')](_0x2381ca[_0x3764('0x5e')]);if(_0x2d454c&&_0x2d454c[_0x3764('0x5f')]){logger[_0x3764('0x20')]('['+_0x27b8e9['lastevent']['toUpperCase']()+']',_0x3764('0x60'));_0x27b8e9['recordingURL']=util[_0x3764('0x49')](_0x3764('0x62'),_0x2381ca['serverUrl'],_0x27b8e9[_0x3764('0x63')],md5(_0x27b8e9[_0x3764('0x63')]));}else{_0x27b8e9['recordingURL']='';}return getConnection(_0x2381ca)[_0x3764('0x27')](function(_0x36530d){_0x490b7e=_0x36530d;if(!_[_0x3764('0x23')](_0x4b91f0)){return getUser(_0x2381ca,_0x4b91f0['name'],_0x490b7e);}else{return getUser(_0x2381ca,null,_0x490b7e);}})['then'](function(_0x474da4){_0x390696=_0x474da4;return getEndUser(_0x2381ca,_0x19cdf7,_0x27b8e9[_0x3764('0x65')],_0x27b8e9[_0x3764('0x66')],_0x490b7e);})['then'](function(_0x58d2e8){_0x55fd22=_0x58d2e8;return getTicket(_0x2381ca,_0x390696,_0x55fd22,_0x19cdf7,_0x27b8e9,_0x19cdf7['Fields'],_0x490b7e);})['then'](function(_0x41eb13){_0x8fb0b5=_0x41eb13;logger[_0x3764('0x20')]('['+_0x27b8e9[_0x3764('0x7b')][_0x3764('0x7c')]()+']\x20Ticket\x20%s\x20created.',_0x8fb0b5['id']);logger[_0x3764('0x20')]('['+_0x27b8e9['lastevent']['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x2381ca['type']);})[_0x3764('0x70')](function(_0x13aefa){logger[_0x3764('0x6f')]('['+_0x27b8e9[_0x3764('0x7b')]['toUpperCase']()+']',_0x13aefa);});}; \ No newline at end of file +var _0x8dcc=['ActivityDate','utc','IsReminderSet','endUserType','contact','lead','WhoId','account','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','then','length','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','Connection','https://login.salesforce.com','clientId','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','remoteUri','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','instanceUrl','error','catch','outbound','recordingFormat','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','integrationTab','%s/%s/e','[OUTBOUND]','unmanaged','monitor_format','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','salesforce','defaults','localhost','redis','emit','getString','Subjects','Descriptions','ticketType','Task'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x8dcc,0x1e6));var _0xc8dc=function(_0x90bbb3,_0x5139b6){_0x90bbb3=_0x90bbb3-0x0;var _0x2ea8fd=_0x8dcc[_0x90bbb3];return _0x2ea8fd;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0xc8dc('0x0'));var BPromise=require(_0xc8dc('0x1'));var md5=require(_0xc8dc('0x2'));var jsforce=require(_0xc8dc('0x3'));var util=require(_0xc8dc('0x4'));var Redis=require(_0xc8dc('0x5'));var intUtil=require(_0xc8dc('0x6'));var config=require(_0xc8dc('0x7'));var logger=require('../../../../config/logger')(_0xc8dc('0x8'));config['redis']=_[_0xc8dc('0x9')](config['redis'],{'host':_0xc8dc('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc8dc('0xb')]));function emit(_0x4aab58,_0x40239a,_0x18f406){io['to'](_0x4aab58)[_0xc8dc('0xc')](_0x40239a,_0x18f406);}function getTicket(_0x2ba46c,_0x402b6a,_0x3c0a95,_0x321057,_0x3d740e,_0xd5873f,_0x3993a1,_0x4e1618){var _0x1b7231=Object['assign']({},{'OwnerId':_0x402b6a['id'],'Subject':intUtil[_0xc8dc('0xd')](_0x321057[_0xc8dc('0xe')],_0x3d740e,'\x20'),'Description':intUtil[_0xc8dc('0xd')](_0x321057[_0xc8dc('0xf')],_0x3d740e,'\x0a')},getCustomFields(_0xd5873f,_0x3d740e));if(_0x3c0a95){if(_0x321057[_0xc8dc('0x10')]===_0xc8dc('0x11')){_0x1b7231[_0xc8dc('0x12')]=moment[_0xc8dc('0x13')]();_0x1b7231[_0xc8dc('0x14')]=![];_0x1b7231['IsRecurrence']=![];if(_0x3c0a95[_0xc8dc('0x15')]===_0xc8dc('0x16')||_0x3c0a95[_0xc8dc('0x15')]===_0xc8dc('0x17')){_0x1b7231[_0xc8dc('0x18')]=_0x3c0a95['id'];}else if(_0x3c0a95[_0xc8dc('0x15')]===_0xc8dc('0x19')){_0x1b7231['WhatId']=_0x3c0a95['id'];}}else if(_0x321057['ticketType']===_0xc8dc('0x1a')){if(_0x3c0a95[_0xc8dc('0x15')]==='contact'){_0x1b7231[_0xc8dc('0x1b')]=_0x3c0a95['id'];}else if(_0x3c0a95['endUserType']==='account'){_0x1b7231[_0xc8dc('0x1c')]=_0x3c0a95['id'];}else if(_0x3c0a95[_0xc8dc('0x15')]===_0xc8dc('0x17')&&_0x321057[_0xc8dc('0x1d')]){_0x1b7231[_0x321057[_0xc8dc('0x1d')]]=_0x3c0a95['id'];}else{logger[_0xc8dc('0x1e')](_0xc8dc('0x1f'));}}}return _0x3993a1[_0xc8dc('0x20')](_0x321057[_0xc8dc('0x10')])[_0xc8dc('0x21')](_0x1b7231);}function getUser(_0x548452,_0x398cea,_0x52ab8c){if(!_[_0xc8dc('0x22')](_0x398cea)&&intUtil[_0xc8dc('0x23')](_0x398cea)){var _0x51a941={'Email':_0x398cea};var _0x15af18={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x52ab8c['sobject'](_0xc8dc('0x24'))[_0xc8dc('0x25')](_0x51a941,_0x15af18)[_0xc8dc('0x26')]()[_0xc8dc('0x27')](function(_0x4b4ea6){if(_0x4b4ea6[_0xc8dc('0x28')]){var _0x325b5a=_[_0xc8dc('0x25')](_0x4b4ea6,function(_0x583c55){return _0x583c55[_0xc8dc('0x29')]===_0x398cea;});if(_0x325b5a){logger['info']('Agent\x20%s\x20found.',_0x398cea);return BPromise[_0xc8dc('0x2a')]({'id':_0x325b5a['Id'],'name':_0x325b5a[_0xc8dc('0x2b')]});}}else{logger[_0xc8dc('0x1e')](_0xc8dc('0x2c'),_0x398cea);return _0x52ab8c[_0xc8dc('0x2d')]()[_0xc8dc('0x27')](function(_0x26efab){return BPromise[_0xc8dc('0x2a')]({'id':_0x26efab[_0xc8dc('0x2e')],'name':_0x26efab[_0xc8dc('0x2f')]});});}});}else{logger[_0xc8dc('0x1e')](_0xc8dc('0x2c'),_0x398cea);return _0x52ab8c[_0xc8dc('0x2d')]()[_0xc8dc('0x27')](function(_0x116eba){return BPromise[_0xc8dc('0x2a')]({'id':_0x116eba[_0xc8dc('0x2e')],'name':_0x116eba['display_name']});});}}function getEndUser(_0x467356,_0x4af547,_0x3eca81,_0x27f86f,_0x312b5c){var _0x57ddc7={'$or':{'Phone':_0x27f86f}};var _0x11679e={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xc8dc('0x2a')]()['then'](function(){logger[_0xc8dc('0x1e')](_0xc8dc('0x30'),_0x27f86f,_0x4af547[_0xc8dc('0x31')]);switch(_0x4af547[_0xc8dc('0x31')]){case'contact_lead':var _0x57a33d=_[_0xc8dc('0x32')](_0x57ddc7);if(_0x4af547['additionalSearchContact']){var _0x4c69de={};_0x4c69de[_0x4af547[_0xc8dc('0x33')]]=_0x27f86f;_[_0xc8dc('0x34')](_0x57a33d[_0xc8dc('0x35')],_0x4c69de);}return _0x312b5c['sobject'](_0xc8dc('0x36'))[_0xc8dc('0x25')](_0x57a33d,_0x11679e)['execute']()[_0xc8dc('0x27')](function(_0x917930){if(_0x917930&&_0x917930[_0xc8dc('0x28')]){return _0x917930;}else{var _0x3e2278=_[_0xc8dc('0x32')](_0x57ddc7);if(_0x4af547[_0xc8dc('0x37')]){var _0x208dc5={};_0x208dc5[_0x4af547[_0xc8dc('0x37')]]=_0x27f86f;_['merge'](_0x3e2278[_0xc8dc('0x35')],_0x208dc5);}return _0x312b5c[_0xc8dc('0x20')](_0xc8dc('0x38'))[_0xc8dc('0x25')](_0x3e2278,_0x11679e);}});case _0xc8dc('0x39'):var _0x5dbec1=_[_0xc8dc('0x32')](_0x57ddc7);if(_0x4af547[_0xc8dc('0x3a')]){var _0x4c69de={};_0x4c69de[_0x4af547['additionalSearchAccount']]=_0x27f86f;_['merge'](_0x5dbec1[_0xc8dc('0x35')],_0x4c69de);}return _0x312b5c['sobject']('Account')[_0xc8dc('0x25')](_0x5dbec1,_0x11679e)[_0xc8dc('0x26')]()[_0xc8dc('0x27')](function(_0x4e46af){if(_0x4e46af&&_0x4e46af[_0xc8dc('0x28')]){return _0x4e46af;}else{var _0x542498=_['cloneDeep'](_0x57ddc7);if(_0x4af547[_0xc8dc('0x33')]){var _0x4ec993={};_0x4ec993[_0x4af547[_0xc8dc('0x33')]]=_0x27f86f;_[_0xc8dc('0x34')](_0x542498['$or'],_0x4ec993);}return _0x312b5c[_0xc8dc('0x20')]('Contact')[_0xc8dc('0x25')](_0x542498,_0x11679e)[_0xc8dc('0x27')](function(_0x1dd6c9){if(_0x1dd6c9&&_0x1dd6c9['length']){return _0x1dd6c9;}else{var _0x2b7cb3=_[_0xc8dc('0x32')](_0x57ddc7);if(_0x4af547[_0xc8dc('0x37')]){var _0x3d7c46={};_0x3d7c46[_0x4af547[_0xc8dc('0x37')]]=_0x27f86f;_[_0xc8dc('0x34')](_0x2b7cb3['$or'],_0x3d7c46);}return _0x312b5c[_0xc8dc('0x20')](_0xc8dc('0x38'))[_0xc8dc('0x25')](_0x2b7cb3,_0x11679e);}});}});case _0xc8dc('0x16'):var _0x57a33d=_[_0xc8dc('0x32')](_0x57ddc7);if(_0x4af547[_0xc8dc('0x33')]){var _0x4c69de={};_0x4c69de[_0x4af547[_0xc8dc('0x33')]]=_0x27f86f;_[_0xc8dc('0x34')](_0x57a33d[_0xc8dc('0x35')],_0x4c69de);}return _0x312b5c[_0xc8dc('0x20')](_0xc8dc('0x36'))[_0xc8dc('0x25')](_0x57a33d,_0x11679e)[_0xc8dc('0x26')]();case _0xc8dc('0x17'):var _0x3ff965=_[_0xc8dc('0x32')](_0x57ddc7);if(_0x4af547[_0xc8dc('0x37')]){var _0x4c69de={};_0x4c69de[_0x4af547[_0xc8dc('0x37')]]=_0x27f86f;_['merge'](_0x3ff965[_0xc8dc('0x35')],_0x4c69de);}return _0x312b5c[_0xc8dc('0x20')](_0xc8dc('0x38'))[_0xc8dc('0x25')](_0x3ff965,_0x11679e);case'account':var _0x5dbec1=_[_0xc8dc('0x32')](_0x57ddc7);if(_0x4af547[_0xc8dc('0x3a')]){var _0x4c69de={};_0x4c69de[_0x4af547['additionalSearchAccount']]=_0x27f86f;_[_0xc8dc('0x34')](_0x5dbec1[_0xc8dc('0x35')],_0x4c69de);}return _0x312b5c[_0xc8dc('0x20')](_0xc8dc('0x3b'))[_0xc8dc('0x25')](_0x5dbec1,_0x11679e);default:return null;}})[_0xc8dc('0x27')](function(_0x3577d0){if(_0x3577d0&&_0x3577d0[_0xc8dc('0x28')]){var _0x356069=_[_0xc8dc('0x3c')](_0x3577d0);if(_0x356069){return BPromise['resolve']({'id':_0x356069['Id'],'name':_0x356069[_0xc8dc('0x2b')],'phone':_0x356069[_0xc8dc('0x3d')],'endUserType':_0x356069['attributes']['type']['toLowerCase']()});}}})[_0xc8dc('0x27')](function(_0x515bfb){if(_0x515bfb){logger['info'](_0xc8dc('0x3e'),_0x515bfb[_0xc8dc('0x15')],_0x27f86f);return BPromise[_0xc8dc('0x2a')](_0x515bfb);}else{logger['info'](_0xc8dc('0x3f'),_0x27f86f);var _0x704ea3={'Phone':_0x27f86f};if(_0x4af547[_0xc8dc('0x40')]){if(_0x4af547[_0xc8dc('0x40')]===_0xc8dc('0x16')){logger['info'](_0xc8dc('0x41'),_0x27f86f,_0x4af547[_0xc8dc('0x40')]);_0x704ea3['LastName']=_0x3eca81!==_0xc8dc('0x42')?_0x3eca81:util[_0xc8dc('0x43')](_0xc8dc('0x44'),_0x27f86f);}else if(_0x4af547[_0xc8dc('0x40')]===_0xc8dc('0x17')){logger[_0xc8dc('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x27f86f,_0x4af547['moduleCreate']);_0x704ea3['LastName']=_0x3eca81!==_0xc8dc('0x42')?_0x3eca81:util[_0xc8dc('0x43')](_0xc8dc('0x44'),_0x27f86f);_0x704ea3[_0xc8dc('0x45')]=_0xc8dc('0x46');}else if(_0x4af547[_0xc8dc('0x40')]===_0xc8dc('0x19')){logger[_0xc8dc('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x27f86f,_0x4af547['moduleCreate']);_0x704ea3[_0xc8dc('0x2b')]=_0x3eca81!==_0xc8dc('0x42')?_0x3eca81:util[_0xc8dc('0x43')](_0xc8dc('0x44'),_0x27f86f);}else{return null;}}return _0x312b5c[_0xc8dc('0x20')](_[_0xc8dc('0x47')](_0x4af547[_0xc8dc('0x40')]))['create'](_0x704ea3)[_0xc8dc('0x27')](function(_0x569aea){return BPromise['resolve']({'id':_0x569aea['id'],'endUserType':_0x4af547[_0xc8dc('0x40')]});});}});}function getCustomFields(_0x35cb94,_0x13575c){var _0x1fe03d={};if(_0x35cb94[_0xc8dc('0x28')]>0x0){_[_0xc8dc('0x48')](_0x35cb94,function(_0x41c5e3){if(_[_0xc8dc('0x49')]([_0xc8dc('0x4a'),_0xc8dc('0x4b')],_0x41c5e3[_0xc8dc('0x4c')])&&_0x41c5e3[_0xc8dc('0x4d')]){_0x1fe03d[_0x41c5e3['idField']]=_0x41c5e3[_0xc8dc('0x4e')][_0xc8dc('0x4f')]();}else if(_0x41c5e3[_0xc8dc('0x4c')]===_0xc8dc('0x50')&&_0x41c5e3[_0xc8dc('0x51')]&&_0x41c5e3[_0xc8dc('0x4d')]){_0x13575c[_0x41c5e3[_0xc8dc('0x51')]]&&(_0x1fe03d[_0x41c5e3['idField']]=_0x13575c[_0x41c5e3['variableName']][_0xc8dc('0x4f')]());}else if(_0x41c5e3[_0xc8dc('0x4c')]===_0xc8dc('0x52')&&_0x41c5e3[_0xc8dc('0x53')]&&_0x41c5e3[_0xc8dc('0x53')][_0xc8dc('0x54')]&&_0x41c5e3[_0xc8dc('0x4d')]){_0x13575c[_0x41c5e3[_0xc8dc('0x53')][_0xc8dc('0x54')]['toLowerCase']()]&&(_0x1fe03d[_0x41c5e3[_0xc8dc('0x4d')]]=_0x13575c[_0x41c5e3[_0xc8dc('0x53')][_0xc8dc('0x54')][_0xc8dc('0x55')]()][_0xc8dc('0x4f')]());}});}return _0x1fe03d;}function getConnection(_0x4c7b80){var _0x7d01d0=_0x4c7b80['password']['concat'](_0x4c7b80['securityToken']);var _0x4710d2=new jsforce[(_0xc8dc('0x56'))]({'oauth2':{'loginUrl':_0x4c7b80['remoteUri']||_0xc8dc('0x57'),'clientId':_0x4c7b80[_0xc8dc('0x58')],'clientSecret':_0x4c7b80[_0xc8dc('0x59')]}});return _0x4710d2[_0xc8dc('0x5a')](_0x4c7b80[_0xc8dc('0x5b')],_0x7d01d0)['then'](function(){logger[_0xc8dc('0x1e')]('Connection\x20established.');return _0x4710d2;});}exports[_0xc8dc('0x5c')]=function(_0x4b5427,_0x1e8220,_0x872b61,_0x2bdd5b,_0x4735ea,_0x239d30){var _0x2af231,_0xe7e653,_0x256c7d,_0x3476bd;_0x239d30[_0xc8dc('0x5d')]=intUtil[_0xc8dc('0x5e')](_0x239d30['serverUrl']);_0x239d30[_0xc8dc('0x5f')]=intUtil[_0xc8dc('0x5e')](_0x239d30[_0xc8dc('0x5f')]);if(_0x4735ea&&_0x4735ea['monitor_format']){logger['info']('[QUEUE]',_0xc8dc('0x60'));_0x1e8220[_0xc8dc('0x61')]=util[_0xc8dc('0x43')](_0xc8dc('0x62'),_0x239d30[_0xc8dc('0x5d')],_0x1e8220[_0xc8dc('0x63')],md5(_0x1e8220[_0xc8dc('0x63')]));}else{_0x1e8220['recordingURL']='';}return getConnection(_0x239d30)[_0xc8dc('0x27')](function(_0x455f6e){_0x3476bd=_0x455f6e;return getUser(_0x239d30,_0x2bdd5b[_0xc8dc('0x64')],_0x3476bd);})[_0xc8dc('0x27')](function(_0x7862dc){_0x2af231=_0x7862dc;return getEndUser(_0x239d30,_0x872b61,_0x1e8220[_0xc8dc('0x65')],_0x1e8220[_0xc8dc('0x66')],_0x3476bd);})[_0xc8dc('0x27')](function(_0x2525c3){_0xe7e653=_0x2525c3;return getTicket(_0x239d30,_0x2af231,_0xe7e653,_0x872b61,_0x1e8220,_0x872b61[_0xc8dc('0x67')],_0x3476bd,_0xc8dc('0x5c'));})[_0xc8dc('0x27')](function(_0xdb5778){_0x256c7d=_0xdb5778;logger[_0xc8dc('0x1e')](_0xc8dc('0x68'),_0x256c7d['id']);logger[_0xc8dc('0x1e')](_0xc8dc('0x69'),_0x256c7d['id'],_0x2bdd5b[_0xc8dc('0x54')],_0x239d30[_0xc8dc('0x4c')]);switch(_0x239d30['type']){case'integrationTab':emit(util[_0xc8dc('0x43')](_0xc8dc('0x6a'),_0x2bdd5b[_0xc8dc('0x54')]),_0xc8dc('0x6b'),{'recordId':_0x256c7d['id']});break;case _0xc8dc('0x6c'):emit(util[_0xc8dc('0x43')](_0xc8dc('0x6a'),_0x2bdd5b['name']),_0xc8dc('0x6d'),{'uri':util[_0xc8dc('0x43')]('%s/%s/e',_0x3476bd[_0xc8dc('0x6e')],_0x256c7d['id'])});break;default:logger[_0xc8dc('0x6f')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xc8dc('0x70')](function(_0x23d3a7){logger['error']('[QUEUE]',_0x23d3a7);});};exports[_0xc8dc('0x71')]=function(_0x4e77f3,_0x19c25f,_0x419e37,_0x5c05b7,_0x395ed6,_0x3d327e,_0x4d5f08){var _0x42bfec,_0x32777d,_0x981f8b,_0x11426e;_0x3d327e[_0xc8dc('0x5d')]=intUtil[_0xc8dc('0x5e')](_0x3d327e['serverUrl']);_0x3d327e[_0xc8dc('0x5f')]=intUtil[_0xc8dc('0x5e')](_0x3d327e[_0xc8dc('0x5f')]);if(_0x4d5f08&&_0x4d5f08[_0xc8dc('0x72')]&&_0x4d5f08[_0xc8dc('0x72')]!=='none'){logger[_0xc8dc('0x1e')]('[OUTBOUND]',_0xc8dc('0x60'));_0x19c25f[_0xc8dc('0x61')]=util['format'](_0xc8dc('0x62'),_0x3d327e[_0xc8dc('0x5d')],_0x19c25f['uniqueid'],md5(_0x19c25f[_0xc8dc('0x63')]));}return getConnection(_0x3d327e)[_0xc8dc('0x27')](function(_0x3516ea){_0x11426e=_0x3516ea;return getUser(_0x3d327e,_0x5c05b7[_0xc8dc('0x64')],_0x11426e);})['then'](function(_0x5879d6){_0x42bfec=_0x5879d6;return getEndUser(_0x3d327e,_0x419e37,_0x19c25f['destcalleridname'],_0x19c25f[_0xc8dc('0x73')],_0x11426e);})['then'](function(_0x5a2f12){_0x32777d=_0x5a2f12;return getTicket(_0x3d327e,_0x42bfec,_0x32777d,_0x419e37,_0x19c25f,_0x419e37[_0xc8dc('0x67')],_0x11426e,_0xc8dc('0x71'));})['then'](function(_0x2d6efe){_0x981f8b=_0x2d6efe;logger[_0xc8dc('0x1e')](_0xc8dc('0x74'),_0x981f8b['id']);logger[_0xc8dc('0x1e')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x981f8b['id'],_0x5c05b7['name'],_0x3d327e[_0xc8dc('0x4c')]);switch(_0x3d327e[_0xc8dc('0x4c')]){case _0xc8dc('0x75'):emit(util['format'](_0xc8dc('0x6a'),_0x5c05b7[_0xc8dc('0x54')]),'trigger:salesforce:display',{'recordId':_0x981f8b['id']});break;case _0xc8dc('0x6c'):emit(util['format'](_0xc8dc('0x6a'),_0x5c05b7['name']),_0xc8dc('0x6d'),{'uri':util[_0xc8dc('0x43')](_0xc8dc('0x76'),_0x11426e[_0xc8dc('0x6e')],_0x981f8b['id'])});break;default:logger[_0xc8dc('0x6f')](_0xc8dc('0x77'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xc8dc('0x70')](function(_0x2757ce){logger['error'](_0xc8dc('0x77'),_0x2757ce);});};exports[_0xc8dc('0x78')]=function(_0x4a8583,_0x40125a,_0x51b10c,_0x5de428,_0x225581,_0x36052b){var _0x589e3e,_0x318b0b,_0x452642,_0x35a083;_0x36052b[_0xc8dc('0x5d')]=intUtil[_0xc8dc('0x5e')](_0x36052b[_0xc8dc('0x5d')]);_0x36052b['remoteUri']=intUtil[_0xc8dc('0x5e')](_0x36052b[_0xc8dc('0x5f')]);if(_0x225581&&_0x225581[_0xc8dc('0x79')]){logger[_0xc8dc('0x1e')]('['+_0x40125a[_0xc8dc('0x7a')][_0xc8dc('0x7b')]()+']',_0xc8dc('0x60'));_0x40125a[_0xc8dc('0x61')]=util[_0xc8dc('0x43')](_0xc8dc('0x62'),_0x36052b[_0xc8dc('0x5d')],_0x40125a[_0xc8dc('0x63')],md5(_0x40125a['uniqueid']));}else{_0x40125a[_0xc8dc('0x61')]='';}return getConnection(_0x36052b)[_0xc8dc('0x27')](function(_0xa2ccf2){_0x35a083=_0xa2ccf2;if(!_[_0xc8dc('0x22')](_0x5de428)){return getUser(_0x36052b,_0x5de428['name'],_0x35a083);}else{return getUser(_0x36052b,null,_0x35a083);}})['then'](function(_0x5548b8){_0x589e3e=_0x5548b8;return getEndUser(_0x36052b,_0x51b10c,_0x40125a[_0xc8dc('0x65')],_0x40125a['calleridnum'],_0x35a083);})[_0xc8dc('0x27')](function(_0x43596f){_0x318b0b=_0x43596f;return getTicket(_0x36052b,_0x589e3e,_0x318b0b,_0x51b10c,_0x40125a,_0x51b10c['Fields'],_0x35a083);})[_0xc8dc('0x27')](function(_0x16204d){_0x452642=_0x16204d;logger['info']('['+_0x40125a['lastevent'][_0xc8dc('0x7b')]()+_0xc8dc('0x7c'),_0x452642['id']);logger['info']('['+_0x40125a['lastevent'][_0xc8dc('0x7b')]()+_0xc8dc('0x7d'),_0x36052b[_0xc8dc('0x4c')]);})[_0xc8dc('0x70')](function(_0x11f342){logger[_0xc8dc('0x6f')]('['+_0x40125a[_0xc8dc('0x7a')][_0xc8dc('0x7b')]()+']',_0x11f342);});}; \ 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 bc5f5ef..df948de 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 _0xfa59=['sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','util','md5','./util','../../../../config/environment','servicenow','redis','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','active','userId','sys_id','adminId','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','picklist','type','nameField','toLowerCase','content','toString','customField','idField','variable','variableName','customVariable','Variable',']\x20getTicket\x20input\x20crm','incident','assign','getString','Subjects','Descriptions','Fields','ticketId','ticketNumber',']\x20getTicket\x20crm','?sysparm_query=name%3D','Incident','Incident\x20-\x20','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','name','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password'];(function(_0x5e4ecd,_0x46f430){var _0x27eb9e=function(_0x8e1b33){while(--_0x8e1b33){_0x5e4ecd['push'](_0x5e4ecd['shift']());}};_0x27eb9e(++_0x46f430);}(_0xfa59,0x82));var _0x9fa5=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xfa59[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x9fa5('0x0'));var Promise=require(_0x9fa5('0x1'));var rp=require('request-promise');var util=require(_0x9fa5('0x2'));var md5=require(_0x9fa5('0x3'));var Redis=require('ioredis');var intUtil=require(_0x9fa5('0x4'));var config=require(_0x9fa5('0x5'));var logger=require('../../../../config/logger')(_0x9fa5('0x6'));config[_0x9fa5('0x7')]=_['defaults'](config['redis'],{'host':_0x9fa5('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9fa5('0x7')]));function getAdminUser(_0x4f1941,_0x3fe2d8,_0x415323,_0x2c3fc3,_0x193130,_0x428335){return new Promise(function(_0x3469a9,_0x1ef1ac){var _0x137117={'method':_0x9fa5('0x9'),'uri':_0x2c3fc3+_0x9fa5('0xa')+'&'+_0x193130+'&'+_0x428335,'auth':_0x3fe2d8,'json':!![]};return rp(_0x137117)[_0x9fa5('0xb')](function(_0x44c7d8){if(_0x44c7d8[_0x9fa5('0xc')][_0x9fa5('0xd')]>0x0){_0x415323['adminId']=_0x44c7d8[_0x9fa5('0xc')][0x0]['sys_id'];}logger[_0x9fa5('0xe')]('['+[_0x4f1941[_0x9fa5('0xf')]()]+_0x9fa5('0x10'),_0x415323);_0x3469a9(_0x415323);})[_0x9fa5('0x11')](function(_0x12f94a){logger[_0x9fa5('0x12')]('['+[_0x4f1941['toUpperCase']()]+']',_0x12f94a[_0x9fa5('0x13')]);_0x1ef1ac(_0x12f94a['message']);});});}function getUser(_0x26d5c8,_0x4ed343,_0x229a7f,_0x58bdfa,_0x4622c1){return function(_0x4e2e3b){logger[_0x9fa5('0xe')]('['+[_0x26d5c8[_0x9fa5('0xf')]()]+_0x9fa5('0x14'),_0x4e2e3b);return new Promise(function(_0x298200,_0xf36465){if(intUtil['validateEmail'](_0x4e2e3b[_0x9fa5('0x15')])){var _0xbd4bcb={'method':'GET','uri':_0x229a7f+_0x9fa5('0x16')+_0x4e2e3b[_0x9fa5('0x15')]+'&'+_0x58bdfa+'&'+_0x4622c1,'auth':_0x4ed343,'json':!![]};logger['info']('['+[_0x26d5c8[_0x9fa5('0xf')]()]+_0x9fa5('0x17'),_0xbd4bcb);return rp(_0xbd4bcb)[_0x9fa5('0xb')](function(_0x4a7b82){logger['info']('['+[_0x26d5c8[_0x9fa5('0xf')]()]+'],\x20getUser\x20entity',_0x4a7b82);if(_0x4a7b82[_0x9fa5('0xc')][_0x9fa5('0xd')]>0x0&&String(_0x4a7b82[_0x9fa5('0xc')][0x0][_0x9fa5('0x18')])==='true'){_0x4e2e3b[_0x9fa5('0x19')]=_0x4a7b82[_0x9fa5('0xc')][0x0][_0x9fa5('0x1a')];}else{_0x4e2e3b['userId']=_0x4e2e3b[_0x9fa5('0x1b')];_0x4e2e3b[_0x9fa5('0x15')]=_0x4e2e3b[_0x9fa5('0x1c')];}logger[_0x9fa5('0xe')]('['+[_0x26d5c8[_0x9fa5('0xf')]()]+'],\x20getUser\x20crm',_0x4e2e3b);_0x298200(_0x4e2e3b);})[_0x9fa5('0x11')](function(_0x3598cd){logger[_0x9fa5('0x12')]('['+[_0x26d5c8[_0x9fa5('0xf')]()]+']',_0x3598cd[_0x9fa5('0x13')]);_0xf36465(_0x3598cd['message']);});}else{logger[_0x9fa5('0xe')]('['+[_0x26d5c8[_0x9fa5('0xf')]()]+_0x9fa5('0x1d'));_0x4e2e3b[_0x9fa5('0x19')]=_0x4e2e3b[_0x9fa5('0x1b')];_0x4e2e3b[_0x9fa5('0x15')]=_0x4e2e3b[_0x9fa5('0x1c')];_0x298200(_0x4e2e3b);}});};}function createEndUser(_0x3fbce4,_0x48f805,_0x12a3c5,_0x47b739,_0x537233){logger['info']('['+[_0x3fbce4[_0x9fa5('0xf')]()]+_0x9fa5('0x1e'),_0x12a3c5);return new Promise(function(_0x22717d,_0x1069c1){var _0x474073={'method':_0x9fa5('0x1f'),'uri':_0x47b739+_0x9fa5('0x20')+_0x537233,'body':{'user_name':_0x12a3c5[_0x9fa5('0x21')],'roles':_0x9fa5('0x22'),'first_name':_0x12a3c5['endUserNumber'],'active':'true','date_format':_0x9fa5('0x23'),'phone':_0x12a3c5[_0x9fa5('0x21')]},'auth':_0x48f805,'json':!![]};return rp(_0x474073)['then'](function(_0x4ba7dd){logger['info']('['+[_0x3fbce4[_0x9fa5('0xf')]()]+'],\x20EndUser\x20schema',_0x4ba7dd[_0x9fa5('0xc')]);_0x12a3c5[_0x9fa5('0x24')]=_0x4ba7dd[_0x9fa5('0xc')][_0x9fa5('0x1a')];_0x22717d(_0x12a3c5);})[_0x9fa5('0x11')](function(_0x5dee32){logger['error']('['+[_0x3fbce4[_0x9fa5('0xf')]()]+']',_0x5dee32[_0x9fa5('0x13')]);_0x1069c1(_0x5dee32['message']);});});}function getEndUser(_0x54dd9c,_0x5d7025,_0x5c7576,_0x3dde2b,_0x2e61f2){return function(_0x4983ca){logger[_0x9fa5('0xe')]('['+[_0x54dd9c[_0x9fa5('0xf')]()]+_0x9fa5('0x25'),_0x4983ca);return new Promise(function(_0xe268c5,_0xd53107){var _0x3f47d8={'method':'GET','uri':_0x5c7576+_0x9fa5('0x26')+_0x4983ca[_0x9fa5('0x21')]+'&'+_0x3dde2b+'&'+_0x2e61f2,'auth':_0x5d7025,'json':!![]};return rp(_0x3f47d8)[_0x9fa5('0xb')](function(_0x5b3855){if(_0x5b3855[_0x9fa5('0xc')][_0x9fa5('0xd')]>0x0){_0x4983ca['endUserId']=_0x5b3855['result'][0x0][_0x9fa5('0x1a')];logger[_0x9fa5('0xe')]('['+[_0x54dd9c[_0x9fa5('0xf')]()]+_0x9fa5('0x27'),_0x4983ca);_0xe268c5(_0x4983ca);}else{return createEndUser(_0x54dd9c,_0x5d7025,_0x4983ca,_0x5c7576,_0x3dde2b)[_0x9fa5('0xb')](function(_0x3a2192){logger[_0x9fa5('0xe')]('['+[_0x54dd9c['toUpperCase']()]+_0x9fa5('0x28'),_0x3a2192);_0xe268c5(_0x3a2192);});}})['catch'](function(_0x3cee7d){logger[_0x9fa5('0x12')]('['+[_0x54dd9c[_0x9fa5('0xf')]()]+']',_0x3cee7d[_0x9fa5('0x13')]);_0xd53107(_0x3cee7d['message']);});});};}function getCustomFields(_0x25fad9,_0x3e4024){var _0x147dd4={};if(_0x25fad9['length']>0x0){_['forEach'](_0x25fad9,function(_0x577fda){if(_[_0x9fa5('0x29')]([_0x9fa5('0x2a'),_0x9fa5('0x2b')],_0x577fda[_0x9fa5('0x2c')])&&_0x577fda[_0x9fa5('0x2d')]&&!_0x577fda['customField']){_0x147dd4[_0x577fda[_0x9fa5('0x2d')][_0x9fa5('0x2e')]()]=_0x577fda[_0x9fa5('0x2f')][_0x9fa5('0x30')]();}else if(_[_0x9fa5('0x29')]([_0x9fa5('0x2a'),_0x9fa5('0x2b')],_0x577fda['type'])&&_0x577fda['idField']&&_0x577fda[_0x9fa5('0x31')]){_0x147dd4[_0x577fda[_0x9fa5('0x32')][_0x9fa5('0x2e')]()]=_0x577fda[_0x9fa5('0x2f')][_0x9fa5('0x30')]();}else if(_0x577fda[_0x9fa5('0x2c')]===_0x9fa5('0x33')&&_0x577fda[_0x9fa5('0x34')]&&_0x577fda[_0x9fa5('0x32')]&&_0x577fda[_0x9fa5('0x31')]){_0x147dd4[_0x577fda[_0x9fa5('0x32')][_0x9fa5('0x2e')]()]=_0x3e4024[_0x577fda[_0x9fa5('0x34')]][_0x9fa5('0x30')]();}else if(_0x577fda[_0x9fa5('0x2c')]===_0x9fa5('0x35')&&_0x577fda['Variable']&&_0x577fda[_0x9fa5('0x36')]['name']&&_0x577fda[_0x9fa5('0x32')]&&_0x577fda['customField']){_0x147dd4[_0x577fda[_0x9fa5('0x32')][_0x9fa5('0x2e')]()]=_0x3e4024[_0x577fda['Variable']['name'][_0x9fa5('0x2e')]()][_0x9fa5('0x30')]();}});}return _0x147dd4;}function getTicket(_0x4896b7,_0x309c47,_0x2561f3,_0x17f5e5,_0x5476b1,_0x113c7f){return function(_0x534bc8){logger['info']('['+[_0x4896b7[_0x9fa5('0xf')]()]+_0x9fa5('0x37'),_0x534bc8);return new Promise(function(_0x36769a,_0x100284){var _0x533010=_0x4896b7['toLowerCase']()==='outbound'?_0x534bc8[_0x9fa5('0x19')]:_0x534bc8[_0x9fa5('0x24')];var _0xb26115={'method':'POST','uri':_0x2561f3+_0x9fa5('0x38')+'?'+_0x113c7f,'body':Object[_0x9fa5('0x39')]({},{'active':'true','caller_id':_0x533010,'assigned_to':_0x534bc8['userId'],'short_description':intUtil[_0x9fa5('0x3a')](_0x17f5e5[_0x9fa5('0x3b')],_0x5476b1,'\x20'),'description':intUtil[_0x9fa5('0x3a')](_0x17f5e5[_0x9fa5('0x3c')],_0x5476b1,'\x0a')},getCustomFields(_0x17f5e5[_0x9fa5('0x3d')],_0x5476b1)),'auth':_0x309c47,'json':!![]};return rp(_0xb26115)[_0x9fa5('0xb')](function(_0x171b35){logger['info']('['+[_0x4896b7['toUpperCase']()]+']\x20POST\x20incident\x20entity\x20schema',_0x171b35[_0x9fa5('0xc')]);_0x534bc8[_0x9fa5('0x3e')]=_0x171b35['result'][_0x9fa5('0x1a')];_0x534bc8[_0x9fa5('0x3f')]=_0x171b35[_0x9fa5('0xc')]['number'];logger[_0x9fa5('0xe')]('['+[_0x4896b7[_0x9fa5('0xf')]()]+_0x9fa5('0x40'),_0x534bc8);_0x36769a(_0x534bc8);})[_0x9fa5('0x11')](function(_0x372669){logger[_0x9fa5('0x12')]('['+[_0x4896b7[_0x9fa5('0xf')]()]+']',_0x372669[_0x9fa5('0x13')]);_0x100284(_0x372669[_0x9fa5('0x13')]);});});};}function createRemoteTag(_0xe880dd,_0x480335,_0xd3360e,_0x3f8bd5){return new Promise(function(_0x241c55,_0x3315ad){var _0x516a79={'method':_0x9fa5('0x1f'),'uri':_0xd3360e+'label'+'?'+_0x3f8bd5,'body':{'short_description':_0xe880dd,'global':!![],'active':!![],'name':_0xe880dd},'auth':_0x480335,'json':!![]};return rp(_0x516a79)[_0x9fa5('0xb')](function(_0x5d3acd){var _0x4f3435=_0x5d3acd[_0x9fa5('0xc')][_0x9fa5('0x1a')];_0x241c55(_0x4f3435);});});}function getRemoteTag(_0x105692,_0x3b27f0,_0x2a27ed,_0x3b665f,_0x153bb2){return new Promise(function(_0x926b37,_0x5b4129){var _0x150898={'method':_0x9fa5('0x9'),'uri':_0x2a27ed+'label'+_0x9fa5('0x41')+_0x105692+'&'+_0x3b665f,'auth':_0x3b27f0,'json':!![]};return rp(_0x150898)[_0x9fa5('0xb')](function(_0x168d42){if(_0x168d42['result']['length']>0x0){var _0x147d60=_0x168d42[_0x9fa5('0xc')][0x0][_0x9fa5('0x1a')];_0x926b37(_0x147d60);}else{return createRemoteTag(_0x105692,_0x3b27f0,_0x2a27ed,_0x3b665f)['then'](function(_0x39c5ea){_0x926b37(_0x39c5ea);});}});});}function assignTagToIncident(_0x595ac4,_0x102f22,_0x3c0791,_0x826a25,_0x41fd6e){return new Promise(function(_0x2adb5b,_0x42b8da){var _0x1ccc6a={'method':_0x9fa5('0x1f'),'uri':_0x3c0791+'label_entry'+'?'+_0x41fd6e,'body':{'label':_0x595ac4,'table':'incident','id_type':_0x9fa5('0x42'),'table_key':_0x826a25[_0x9fa5('0x3e')],'title':_0x9fa5('0x43')+_0x826a25[_0x9fa5('0x3f')],'id_display':_0x826a25[_0x9fa5('0x3f')]},'auth':_0x102f22,'json':!![]};return rp(_0x1ccc6a)[_0x9fa5('0xb')](function(_0xbfd059){_0x2adb5b();})[_0x9fa5('0x11')](function(){_0x2adb5b();});});}function manageTags(_0x544479,_0x89270f,_0x4e24b9,_0x4a46df,_0x3499f8,_0xe88496,_0x4d9975){return new Promise(function(_0x128b16,_0x1a7a54){var _0x2ccf78=[];_0x89270f[_0x9fa5('0x44')](function(_0x503044){_0x2ccf78[_0x9fa5('0x45')](getRemoteTag(_0x503044,_0x4e24b9,_0x4a46df,_0xe88496,_0x4d9975));});return Promise[_0x9fa5('0x46')](_0x2ccf78)[_0x9fa5('0xb')](function(_0x2eaa5b){if(_0x2eaa5b[_0x9fa5('0xd')]){logger[_0x9fa5('0xe')]('['+[_0x544479['toUpperCase']()]+_0x9fa5('0x47'),_0x2eaa5b);var _0x27ddc7=[];_0x2eaa5b[_0x9fa5('0x44')](function(_0x4c4ca8){_0x27ddc7[_0x9fa5('0x45')](assignTagToIncident(_0x4c4ca8,_0x4e24b9,_0x4a46df,_0x3499f8,_0xe88496));});return Promise[_0x9fa5('0x46')](_0x27ddc7)[_0x9fa5('0xb')](function(){_0x128b16();})[_0x9fa5('0x11')](function(){_0x128b16();});}else{_0x128b16();}});});}function getTags(_0x59a84c,_0x48990a,_0x5c7eed,_0x5bedaf,_0x237fdb,_0x57204e){return function(_0x4975b0){return new Promise(function(_0x2a7ceb,_0x4a4f63){var _0x48a00b=[];var _0x1fd216=_0x5bedaf[_0x9fa5('0x48')];if(_0x1fd216&&_0x1fd216['length']>0x0){_0x48a00b=_[_0x9fa5('0x49')](_0x1fd216,_0x9fa5('0x4a'));}if(_0x48a00b[_0x9fa5('0xd')]>0x0){return manageTags(_0x59a84c,_0x48a00b,_0x48990a,_0x5c7eed,_0x4975b0,_0x237fdb,_0x57204e)[_0x9fa5('0xb')](function(){_0x2a7ceb(_0x4975b0);});}else{_0x2a7ceb(_0x4975b0);}});};}function emit(_0x5ad5ed,_0x36a7a4,_0x486eb6){var _0x5599e0='%26sysparm_record_target%3Dincident'+_0x9fa5('0x4b')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x9fa5('0x4c');var _0x1e2cf9={'uri':_0x5ad5ed+_0x9fa5('0x4d')+_0x486eb6+_0x5599e0};io['to'](util[_0x9fa5('0x4e')](_0x9fa5('0x4f'),_0x36a7a4))[_0x9fa5('0x50')](_0x9fa5('0x51'),_0x1e2cf9);}exports['cs']=function(_0x4ca888,_0x343c47,_0x459d97,_0x3e541a,_0x1e3510,_0x14dd92,_0x386290,_0x141fb3){var _0x2ddc25={};var _0x32706e={'user':_0x14dd92[_0x9fa5('0x52')],'pass':_0x14dd92[_0x9fa5('0x53')]};var _0x264bf2=_0x9fa5('0x54');var _0x1db2a4=_0x9fa5('0x55');_0x14dd92[_0x9fa5('0x56')]=intUtil[_0x9fa5('0x57')](_0x14dd92[_0x9fa5('0x56')]);_0x14dd92[_0x9fa5('0x58')]=intUtil['stripTrailingSlash'](_0x14dd92[_0x9fa5('0x58')]);var _0x2c7955=util[_0x9fa5('0x4e')](_0x9fa5('0x59'),_0x14dd92[_0x9fa5('0x56')]);_0x2ddc25[_0x9fa5('0x15')]=!_[_0x9fa5('0x5a')](_0x3e541a)?_0x3e541a[_0x9fa5('0x5b')]:null;_0x2ddc25[_0x9fa5('0x1c')]=_0x14dd92['email'];_0x2ddc25[_0x9fa5('0x21')]=_0x141fb3[_0x9fa5('0x2e')]()==='outbound'?_0x343c47[_0x9fa5('0x5c')]:_0x343c47[_0x9fa5('0x5d')];_0x2ddc25[_0x9fa5('0x5e')]=_0x141fb3==='queue'||_0x141fb3==='unmanaged'?'queue':'outbound';var _0x38b5f6=util[_0x9fa5('0x4e')](_0x9fa5('0x5f'),_0x14dd92[_0x9fa5('0x58')],_0x343c47['uniqueid'],md5(_0x343c47['uniqueid']));if(_0x1e3510&&_0x1e3510[_0x9fa5('0x60')]){logger[_0x9fa5('0xe')](_0x9fa5('0x61'),_0x9fa5('0x62'));_0x343c47['recordingURL']=_0x38b5f6;}else if(_0x386290&&_0x386290[_0x9fa5('0x63')]&&_0x386290[_0x9fa5('0x63')]!=='none'){logger['info'](_0x9fa5('0x64'),_0x9fa5('0x62'));_0x343c47['recordingURL']=_0x38b5f6;}else{_0x343c47['recordingURL']='';}return getAdminUser(_0x141fb3,_0x32706e,_0x2ddc25,_0x2c7955,_0x1db2a4,_0x264bf2)[_0x9fa5('0xb')](getUser(_0x141fb3,_0x32706e,_0x2c7955,_0x1db2a4,_0x264bf2))[_0x9fa5('0xb')](getEndUser(_0x141fb3,_0x32706e,_0x2c7955,_0x1db2a4,_0x264bf2))[_0x9fa5('0xb')](getTicket(_0x141fb3,_0x32706e,_0x2c7955,_0x459d97,_0x343c47,_0x1db2a4))[_0x9fa5('0xb')](function(_0x3614a6){logger[_0x9fa5('0xe')](util[_0x9fa5('0x4e')](_0x9fa5('0x65'),_0x3614a6['ticketId']));logger[_0x9fa5('0xe')](util[_0x9fa5('0x4e')](_0x9fa5('0x66'),_0x141fb3));if(_0x141fb3!==_0x9fa5('0x67')){logger[_0x9fa5('0xe')]('['+[_0x141fb3[_0x9fa5('0xf')]()]+']',_0x9fa5('0x68'));emit(_0x14dd92[_0x9fa5('0x56')],_0x3e541a[_0x9fa5('0x4a')],_0x3614a6[_0x9fa5('0x3e')]);}})[_0x9fa5('0x11')](function(_0x45e7b0){logger[_0x9fa5('0x12')]('['+[_0x141fb3['toUpperCase']()]+_0x9fa5('0x69'),util[_0x9fa5('0x6a')](_0x45e7b0,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0201=['all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','Tags','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','ioredis','./util','socket.io-emitter','redis','GET','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','result','sys_id','info','],\x20getAdminUser\x20crm','catch','error','message','toUpperCase','],\x20getUser\x20input\x20crm','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','POST','sys_user?','endUserNumber','user','System','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','toString','string','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','Incident','Incident\x20-\x20'];(function(_0x32d443,_0x48cf49){var _0x454ac3=function(_0x544980){while(--_0x544980){_0x32d443['push'](_0x32d443['shift']());}};_0x454ac3(++_0x48cf49);}(_0x0201,0x8a));var _0x1020=function(_0x58ddbf,_0x2e663b){_0x58ddbf=_0x58ddbf-0x0;var _0x1bab56=_0x0201[_0x58ddbf];return _0x1bab56;};'use strict';var _=require(_0x1020('0x0'));var Promise=require(_0x1020('0x1'));var rp=require(_0x1020('0x2'));var util=require(_0x1020('0x3'));var md5=require('md5');var Redis=require(_0x1020('0x4'));var intUtil=require(_0x1020('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('servicenow');config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1020('0x6'))(new Redis(config[_0x1020('0x7')]));function getAdminUser(_0x31c8d8,_0xd0d0d1,_0x456f4c,_0x229a3e,_0x3137f7,_0x274883){return new Promise(function(_0xa4f243,_0x4ce23d){var _0x581b8e={'method':_0x1020('0x8'),'uri':_0x229a3e+_0x1020('0x9')+'&'+_0x3137f7+'&'+_0x274883,'auth':_0xd0d0d1,'json':!![]};return rp(_0x581b8e)[_0x1020('0xa')](function(_0x2a69c6){if(_0x2a69c6['result'][_0x1020('0xb')]>0x0){_0x456f4c[_0x1020('0xc')]=_0x2a69c6[_0x1020('0xd')][0x0][_0x1020('0xe')];}logger[_0x1020('0xf')]('['+[_0x31c8d8['toUpperCase']()]+_0x1020('0x10'),_0x456f4c);_0xa4f243(_0x456f4c);})[_0x1020('0x11')](function(_0x3c562c){logger[_0x1020('0x12')]('['+[_0x31c8d8['toUpperCase']()]+']',_0x3c562c[_0x1020('0x13')]);_0x4ce23d(_0x3c562c[_0x1020('0x13')]);});});}function getUser(_0x3068bb,_0x3a87d7,_0x2ef947,_0x51c279,_0xc32abe){return function(_0x233f10){logger[_0x1020('0xf')]('['+[_0x3068bb[_0x1020('0x14')]()]+_0x1020('0x15'),_0x233f10);return new Promise(function(_0x4de33c,_0x116314){if(intUtil[_0x1020('0x16')](_0x233f10[_0x1020('0x17')])){var _0x23ba87={'method':_0x1020('0x8'),'uri':_0x2ef947+'sys_user?sysparm_query=email%3D'+_0x233f10[_0x1020('0x17')]+'&'+_0x51c279+'&'+_0xc32abe,'auth':_0x3a87d7,'json':!![]};logger['info']('['+[_0x3068bb[_0x1020('0x14')]()]+_0x1020('0x18'),_0x23ba87);return rp(_0x23ba87)[_0x1020('0xa')](function(_0x56b29c){logger[_0x1020('0xf')]('['+[_0x3068bb['toUpperCase']()]+'],\x20getUser\x20entity',_0x56b29c);if(_0x56b29c[_0x1020('0xd')][_0x1020('0xb')]>0x0&&String(_0x56b29c[_0x1020('0xd')][0x0][_0x1020('0x19')])===_0x1020('0x1a')){_0x233f10[_0x1020('0x1b')]=_0x56b29c[_0x1020('0xd')][0x0]['sys_id'];}else{_0x233f10[_0x1020('0x1b')]=_0x233f10[_0x1020('0xc')];_0x233f10[_0x1020('0x17')]=_0x233f10[_0x1020('0x1c')];}logger[_0x1020('0xf')]('['+[_0x3068bb[_0x1020('0x14')]()]+_0x1020('0x1d'),_0x233f10);_0x4de33c(_0x233f10);})[_0x1020('0x11')](function(_0x305c0a){logger['error']('['+[_0x3068bb[_0x1020('0x14')]()]+']',_0x305c0a['message']);_0x116314(_0x305c0a[_0x1020('0x13')]);});}else{logger[_0x1020('0xf')]('['+[_0x3068bb['toUpperCase']()]+_0x1020('0x1e'));_0x233f10[_0x1020('0x1b')]=_0x233f10[_0x1020('0xc')];_0x233f10['userEmail']=_0x233f10[_0x1020('0x1c')];_0x4de33c(_0x233f10);}});};}function createEndUser(_0xe2e2e3,_0x5f4184,_0x1371b4,_0xcddb8a,_0x2ab3fc){logger[_0x1020('0xf')]('['+[_0xe2e2e3[_0x1020('0x14')]()]+'],\x20createEndUser\x20input\x20crm',_0x1371b4);return new Promise(function(_0x31f501,_0x5b823d){var _0xc938ad={'method':_0x1020('0x1f'),'uri':_0xcddb8a+_0x1020('0x20')+_0x2ab3fc,'body':{'user_name':_0x1371b4[_0x1020('0x21')],'roles':_0x1020('0x22'),'first_name':_0x1371b4[_0x1020('0x21')],'active':_0x1020('0x1a'),'date_format':_0x1020('0x23'),'phone':_0x1371b4[_0x1020('0x21')]},'auth':_0x5f4184,'json':!![]};return rp(_0xc938ad)['then'](function(_0x27f7c2){logger[_0x1020('0xf')]('['+[_0xe2e2e3[_0x1020('0x14')]()]+'],\x20EndUser\x20schema',_0x27f7c2[_0x1020('0xd')]);_0x1371b4[_0x1020('0x24')]=_0x27f7c2[_0x1020('0xd')][_0x1020('0xe')];_0x31f501(_0x1371b4);})[_0x1020('0x11')](function(_0x28444e){logger[_0x1020('0x12')]('['+[_0xe2e2e3[_0x1020('0x14')]()]+']',_0x28444e['message']);_0x5b823d(_0x28444e[_0x1020('0x13')]);});});}function getEndUser(_0x13c638,_0x140728,_0x3457d9,_0x1a35bb,_0x3ed5da){return function(_0x3761d6){logger[_0x1020('0xf')]('['+[_0x13c638['toUpperCase']()]+_0x1020('0x25'),_0x3761d6);return new Promise(function(_0x3de15e,_0x10c79a){var _0x430ee2={'method':_0x1020('0x8'),'uri':_0x3457d9+_0x1020('0x26')+_0x3761d6[_0x1020('0x21')]+'&'+_0x1a35bb+'&'+_0x3ed5da,'auth':_0x140728,'json':!![]};return rp(_0x430ee2)['then'](function(_0x598756){if(_0x598756['result'][_0x1020('0xb')]>0x0){_0x3761d6[_0x1020('0x24')]=_0x598756[_0x1020('0xd')][0x0]['sys_id'];logger[_0x1020('0xf')]('['+[_0x13c638[_0x1020('0x14')]()]+'],\x20getEndUser\x20crm',_0x3761d6);_0x3de15e(_0x3761d6);}else{return createEndUser(_0x13c638,_0x140728,_0x3761d6,_0x3457d9,_0x1a35bb)[_0x1020('0xa')](function(_0xd80606){logger['info']('['+[_0x13c638[_0x1020('0x14')]()]+_0x1020('0x27'),_0xd80606);_0x3de15e(_0xd80606);});}})[_0x1020('0x11')](function(_0x2fcce8){logger[_0x1020('0x12')]('['+[_0x13c638[_0x1020('0x14')]()]+']',_0x2fcce8['message']);_0x10c79a(_0x2fcce8['message']);});});};}function getCustomFields(_0x4a2d37,_0x346dc3){var _0x59e80b={};if(_0x4a2d37[_0x1020('0xb')]>0x0){_[_0x1020('0x28')](_0x4a2d37,function(_0x32c8cd){if(_[_0x1020('0x29')](['string',_0x1020('0x2a')],_0x32c8cd[_0x1020('0x2b')])&&_0x32c8cd[_0x1020('0x2c')]&&!_0x32c8cd[_0x1020('0x2d')]){_0x59e80b[_0x32c8cd[_0x1020('0x2c')][_0x1020('0x2e')]()]=_0x32c8cd[_0x1020('0x2f')][_0x1020('0x30')]();}else if(_[_0x1020('0x29')]([_0x1020('0x31'),_0x1020('0x2a')],_0x32c8cd['type'])&&_0x32c8cd[_0x1020('0x32')]&&_0x32c8cd[_0x1020('0x2d')]){_0x59e80b[_0x32c8cd[_0x1020('0x32')][_0x1020('0x2e')]()]=_0x32c8cd[_0x1020('0x2f')][_0x1020('0x30')]();}else if(_0x32c8cd['type']===_0x1020('0x33')&&_0x32c8cd[_0x1020('0x34')]&&_0x32c8cd[_0x1020('0x32')]&&_0x32c8cd['customField']){_0x59e80b[_0x32c8cd[_0x1020('0x32')][_0x1020('0x2e')]()]=_0x346dc3[_0x32c8cd[_0x1020('0x34')]][_0x1020('0x30')]();}else if(_0x32c8cd['type']===_0x1020('0x35')&&_0x32c8cd[_0x1020('0x36')]&&_0x32c8cd[_0x1020('0x36')]['name']&&_0x32c8cd[_0x1020('0x32')]&&_0x32c8cd[_0x1020('0x2d')]){_0x59e80b[_0x32c8cd['idField'][_0x1020('0x2e')]()]=_0x346dc3[_0x32c8cd[_0x1020('0x36')][_0x1020('0x37')][_0x1020('0x2e')]()][_0x1020('0x30')]();}});}return _0x59e80b;}function getTicket(_0x2ec4f2,_0x29dc60,_0xfe6bca,_0x1f4f5a,_0x36da69,_0x59b072){return function(_0x49fe62){logger[_0x1020('0xf')]('['+[_0x2ec4f2[_0x1020('0x14')]()]+_0x1020('0x38'),_0x49fe62);return new Promise(function(_0x584d49,_0x4daa55){var _0x559e57=_0x2ec4f2[_0x1020('0x2e')]()===_0x1020('0x39')?_0x49fe62['userId']:_0x49fe62['endUserId'];var _0x4ae4d1={'method':_0x1020('0x1f'),'uri':_0xfe6bca+_0x1020('0x3a')+'?'+_0x59b072,'body':Object[_0x1020('0x3b')]({},{'active':_0x1020('0x1a'),'caller_id':_0x559e57,'assigned_to':_0x49fe62[_0x1020('0x1b')],'short_description':intUtil['getString'](_0x1f4f5a['Subjects'],_0x36da69,'\x20'),'description':intUtil[_0x1020('0x3c')](_0x1f4f5a['Descriptions'],_0x36da69,'\x0a')},getCustomFields(_0x1f4f5a[_0x1020('0x3d')],_0x36da69)),'auth':_0x29dc60,'json':!![]};return rp(_0x4ae4d1)[_0x1020('0xa')](function(_0x11ffd3){logger[_0x1020('0xf')]('['+[_0x2ec4f2['toUpperCase']()]+_0x1020('0x3e'),_0x11ffd3[_0x1020('0xd')]);_0x49fe62[_0x1020('0x3f')]=_0x11ffd3[_0x1020('0xd')][_0x1020('0xe')];_0x49fe62[_0x1020('0x40')]=_0x11ffd3['result'][_0x1020('0x41')];logger[_0x1020('0xf')]('['+[_0x2ec4f2[_0x1020('0x14')]()]+']\x20getTicket\x20crm',_0x49fe62);_0x584d49(_0x49fe62);})['catch'](function(_0x233213){logger[_0x1020('0x12')]('['+[_0x2ec4f2[_0x1020('0x14')]()]+']',_0x233213[_0x1020('0x13')]);_0x4daa55(_0x233213[_0x1020('0x13')]);});});};}function createRemoteTag(_0x5d16a8,_0x13e67f,_0x58cd86,_0xce3fd6){return new Promise(function(_0x5cbc14,_0x375f49){var _0x58dd04={'method':_0x1020('0x1f'),'uri':_0x58cd86+'label'+'?'+_0xce3fd6,'body':{'short_description':_0x5d16a8,'global':!![],'active':!![],'name':_0x5d16a8},'auth':_0x13e67f,'json':!![]};return rp(_0x58dd04)[_0x1020('0xa')](function(_0xa81ef9){var _0x198b35=_0xa81ef9[_0x1020('0xd')]['sys_id'];_0x5cbc14(_0x198b35);});});}function getRemoteTag(_0x9a209b,_0x4fd5e8,_0x1e99d4,_0x3bf152,_0x3dff7b){return new Promise(function(_0x25def8,_0x5a6cee){var _0x34ca69={'method':'GET','uri':_0x1e99d4+_0x1020('0x42')+_0x1020('0x43')+_0x9a209b+'&'+_0x3bf152,'auth':_0x4fd5e8,'json':!![]};return rp(_0x34ca69)['then'](function(_0x91bd8f){if(_0x91bd8f['result'][_0x1020('0xb')]>0x0){var _0x106fde=_0x91bd8f[_0x1020('0xd')][0x0][_0x1020('0xe')];_0x25def8(_0x106fde);}else{return createRemoteTag(_0x9a209b,_0x4fd5e8,_0x1e99d4,_0x3bf152)[_0x1020('0xa')](function(_0x1758ea){_0x25def8(_0x1758ea);});}});});}function assignTagToIncident(_0x10fdea,_0x59c1af,_0x8d47c,_0x5903d9,_0x3b8ccb){return new Promise(function(_0x23e9d8,_0x10b69c){var _0x3df45b={'method':_0x1020('0x1f'),'uri':_0x8d47c+'label_entry'+'?'+_0x3b8ccb,'body':{'label':_0x10fdea,'table':_0x1020('0x3a'),'id_type':_0x1020('0x44'),'table_key':_0x5903d9[_0x1020('0x3f')],'title':_0x1020('0x45')+_0x5903d9[_0x1020('0x40')],'id_display':_0x5903d9['ticketNumber']},'auth':_0x59c1af,'json':!![]};return rp(_0x3df45b)[_0x1020('0xa')](function(_0x4e3805){_0x23e9d8();})[_0x1020('0x11')](function(){_0x23e9d8();});});}function manageTags(_0x2c0826,_0x586a45,_0x9ece17,_0x2183b2,_0x320a67,_0x36b6f8,_0x1a6d56){return new Promise(function(_0x3a3d60,_0x26d88a){var _0x3eefec=[];_0x586a45[_0x1020('0x28')](function(_0x22d905){_0x3eefec['push'](getRemoteTag(_0x22d905,_0x9ece17,_0x2183b2,_0x36b6f8,_0x1a6d56));});return Promise[_0x1020('0x46')](_0x3eefec)[_0x1020('0xa')](function(_0x40a5dd){if(_0x40a5dd[_0x1020('0xb')]){logger['info']('['+[_0x2c0826['toUpperCase']()]+_0x1020('0x47'),_0x40a5dd);var _0x4b4b8d=[];_0x40a5dd[_0x1020('0x28')](function(_0x944626){_0x4b4b8d[_0x1020('0x48')](assignTagToIncident(_0x944626,_0x9ece17,_0x2183b2,_0x320a67,_0x36b6f8));});return Promise[_0x1020('0x46')](_0x4b4b8d)[_0x1020('0xa')](function(){_0x3a3d60();})[_0x1020('0x11')](function(){_0x3a3d60();});}else{_0x3a3d60();}});});}function getTags(_0x47a7a1,_0x5c95e0,_0x1c8255,_0x3f0ac2,_0x2398d5,_0x5baa28){return function(_0x566728){return new Promise(function(_0x4b2d92,_0x570776){var _0x49a2f4=[];var _0x294b18=_0x3f0ac2[_0x1020('0x49')];if(_0x294b18&&_0x294b18[_0x1020('0xb')]>0x0){_0x49a2f4=_['map'](_0x294b18,_0x1020('0x37'));}if(_0x49a2f4[_0x1020('0xb')]>0x0){return manageTags(_0x47a7a1,_0x49a2f4,_0x5c95e0,_0x1c8255,_0x566728,_0x2398d5,_0x5baa28)[_0x1020('0xa')](function(){_0x4b2d92(_0x566728);});}else{_0x4b2d92(_0x566728);}});};}function emit(_0x5696a7,_0x7fa968,_0x42c260){var _0x330df4='%26sysparm_record_target%3Dincident'+_0x1020('0x4a')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x1020('0x4b');var _0x276310={'uri':_0x5696a7+_0x1020('0x4c')+_0x42c260+_0x330df4};io['to'](util[_0x1020('0x4d')](_0x1020('0x4e'),_0x7fa968))['emit'](_0x1020('0x4f'),_0x276310);}exports['cs']=function(_0x394257,_0x45faa6,_0x87717b,_0x2f9a7b,_0x1f9d39,_0x3286bb,_0x5eee81,_0x1be9e3){var _0x928351={};var _0x567fb1={'user':_0x3286bb[_0x1020('0x50')],'pass':_0x3286bb[_0x1020('0x51')]};var _0x352fb6=_0x1020('0x52');var _0x5083b0=_0x1020('0x53');_0x3286bb[_0x1020('0x54')]=intUtil[_0x1020('0x55')](_0x3286bb[_0x1020('0x54')]);_0x3286bb[_0x1020('0x56')]=intUtil['stripTrailingSlash'](_0x3286bb['serverUrl']);var _0xe8fd89=util[_0x1020('0x4d')](_0x1020('0x57'),_0x3286bb['remoteUri']);_0x928351['userEmail']=!_[_0x1020('0x58')](_0x2f9a7b)?_0x2f9a7b[_0x1020('0x59')]:null;_0x928351['adminEmail']=_0x3286bb['email'];_0x928351[_0x1020('0x21')]=_0x1be9e3[_0x1020('0x2e')]()===_0x1020('0x39')?_0x45faa6[_0x1020('0x5a')]:_0x45faa6[_0x1020('0x5b')];_0x928351['callDirection']=_0x1be9e3===_0x1020('0x5c')||_0x1be9e3===_0x1020('0x5d')?_0x1020('0x5c'):_0x1020('0x39');var _0x4b656d=util[_0x1020('0x4d')](_0x1020('0x5e'),_0x3286bb['serverUrl'],_0x45faa6[_0x1020('0x5f')],md5(_0x45faa6[_0x1020('0x5f')]));if(_0x1f9d39&&_0x1f9d39[_0x1020('0x60')]){logger[_0x1020('0xf')]('[QUEUE]','Recording\x20is\x20enabled!');_0x45faa6[_0x1020('0x61')]=_0x4b656d;}else if(_0x5eee81&&_0x5eee81['recordingFormat']&&_0x5eee81[_0x1020('0x62')]!=='none'){logger[_0x1020('0xf')]('[OUTBOUND]',_0x1020('0x63'));_0x45faa6[_0x1020('0x61')]=_0x4b656d;}else{_0x45faa6[_0x1020('0x61')]='';}return getAdminUser(_0x1be9e3,_0x567fb1,_0x928351,_0xe8fd89,_0x5083b0,_0x352fb6)[_0x1020('0xa')](getUser(_0x1be9e3,_0x567fb1,_0xe8fd89,_0x5083b0,_0x352fb6))[_0x1020('0xa')](getEndUser(_0x1be9e3,_0x567fb1,_0xe8fd89,_0x5083b0,_0x352fb6))[_0x1020('0xa')](getTicket(_0x1be9e3,_0x567fb1,_0xe8fd89,_0x87717b,_0x45faa6,_0x5083b0))['then'](function(_0x3d6166){logger[_0x1020('0xf')](util['format'](_0x1020('0x64'),_0x3d6166[_0x1020('0x3f')]));logger['info'](util[_0x1020('0x4d')](_0x1020('0x65'),_0x1be9e3));if(_0x1be9e3!==_0x1020('0x5d')){logger[_0x1020('0xf')]('['+[_0x1be9e3[_0x1020('0x14')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x3286bb['remoteUri'],_0x2f9a7b[_0x1020('0x37')],_0x3d6166['ticketId']);}})['catch'](function(_0x3eb51a){logger[_0x1020('0x12')]('['+[_0x1be9e3[_0x1020('0x14')]()]+_0x1020('0x66'),util[_0x1020('0x67')](_0x3eb51a,{'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 754bb60..b33fbfe 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 _0x5b0c=['slice','replace','duration_hours','duration_minutes','Contacts','direction','length','forEach','variableName','push','set_entry','JSON','stringify','Calls','format','apiKey','toString','base64','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','entry_list','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','customField','nameField','toLowerCase','idField','variable','custom_fields','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','contacts','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','unmanaged','uri','%s/service/v4_1/rest.php','lastevent','recordingURL','isNil','calleridnum','toUpperCase','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','created_by','description','date_start'];(function(_0x271060,_0x3f86b1){var _0x40540b=function(_0x1735a7){while(--_0x1735a7){_0x271060['push'](_0x271060['shift']());}};_0x40540b(++_0x3f86b1);}(_0x5b0c,0x68));var _0xc5b0=function(_0x10b434,_0x521745){_0x10b434=_0x10b434-0x0;var _0x31050b=_0x5b0c[_0x10b434];return _0x31050b;};'use strict';var _=require(_0xc5b0('0x0'));var rp=require(_0xc5b0('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require(_0xc5b0('0x2'));var Redis=require(_0xc5b0('0x3'));var intUtil=require(_0xc5b0('0x4'));var config=require(_0xc5b0('0x5'));var logger=require(_0xc5b0('0x6'))(_0xc5b0('0x7'));config[_0xc5b0('0x8')]=_['defaults'](config[_0xc5b0('0x8')],{'host':_0xc5b0('0x9'),'port':0x18eb});var io=require(_0xc5b0('0xa'))(new Redis(config[_0xc5b0('0x8')]));var def={'method':_0xc5b0('0xb'),'json':!![]};function emit(_0x554266,_0x51a2a4,_0x36ad54){io['to'](_0x554266)[_0xc5b0('0xc')](_0x51a2a4,_0x36ad54);}function getTicket(_0x28f2fd,_0x2498fc,_0x5cbf6d,_0x50518f,_0x42fcc4,_0x30714b,_0x23e277,_0x4d3d3b){logger[_0xc5b0('0xd')](_0xc5b0('0xe'));var _0x532150=new Date();var _0x2fd924=[{'name':_0xc5b0('0xf'),'value':intUtil[_0xc5b0('0x10')](_0x50518f[_0xc5b0('0x11')],_0x42fcc4,'\x20')},{'name':'assigned_user_id','value':_0x2498fc['id']},{'name':_0xc5b0('0x12'),'value':_0x2498fc['id']},{'name':_0xc5b0('0x13'),'value':intUtil[_0xc5b0('0x10')](_0x50518f['Descriptions'],_0x42fcc4,'\x0a')},{'name':_0xc5b0('0x14'),'value':_0x532150['toISOString']()[_0xc5b0('0x15')](0x0,0x13)[_0xc5b0('0x16')]('T','\x20')},{'name':_0xc5b0('0x17'),'value':'0'},{'name':_0xc5b0('0x18'),'value':'15'},{'name':'parent_id','value':_0x5cbf6d['id']},{'name':'parent_type','value':_0xc5b0('0x19')},{'name':'parent_name','value':_0x5cbf6d['name']},{'name':_0xc5b0('0x1a'),'value':_0x4d3d3b}];if(_0x30714b[_0xc5b0('0x1b')]){_[_0xc5b0('0x1c')](_0x30714b,function(_0x554039){if(_0x42fcc4[_0x554039[_0xc5b0('0x1d')]]){_0x2fd924[_0xc5b0('0x1e')]({'name':_0x554039['idField'],'value':_0x42fcc4[_0x554039[_0xc5b0('0x1d')]]});}});}return request({'form':{'method':_0xc5b0('0x1f'),'input_type':_0xc5b0('0x20'),'response_type':'JSON','rest_data':JSON[_0xc5b0('0x21')]({'session':_0x23e277['id'],'module_name':_0xc5b0('0x22'),'name_value_list':_0x2fd924})}});}function getAuth(_0x11c0a3){return util[_0xc5b0('0x23')]('Basic\x20%s',new Buffer(_0x11c0a3[_0xc5b0('0x24')]+':X')[_0xc5b0('0x25')](_0xc5b0('0x26')));}function getServerInfo(_0x4efdb9){return request({'form':{'method':_0xc5b0('0x27'),'input_type':'JSON','response_type':_0xc5b0('0x20'),'rest_data':JSON[_0xc5b0('0x21')]({'session':_0x4efdb9['id']})}});}function getUser(_0x50363d,_0x7de334,_0x34e35a){if(!_['isNil'](_0x7de334)){logger['info'](_0xc5b0('0x28'),_0x7de334);return request({'form':{'method':_0xc5b0('0x29'),'input_type':_0xc5b0('0x20'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x34e35a['id'],'module_name':_0xc5b0('0x2a'),'query':util[_0xc5b0('0x23')](_0xc5b0('0x2b'),_0x7de334),'order_by':'','offset':'0','select_fields':['id','name',_0xc5b0('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x8954a6){if(_0x8954a6['entry_list'][_0xc5b0('0x1b')]){var _0x105b1a=_['find'](_0x8954a6['entry_list'],function(_0x8003c2){return _0x8003c2[_0xc5b0('0x2d')][_0xc5b0('0x2c')][_0xc5b0('0x2e')]===_0x7de334;});if(_0x105b1a){logger[_0xc5b0('0xd')]('Agent\x20found!');return BPromise[_0xc5b0('0x2f')]({'id':_0x105b1a[_0xc5b0('0x2d')]['id'][_0xc5b0('0x2e')],'name':_0x105b1a['name_value_list'][_0xc5b0('0xf')][_0xc5b0('0x2e')]});}}logger[_0xc5b0('0xd')](_0xc5b0('0x30'));return BPromise[_0xc5b0('0x2f')]({'id':_0x34e35a[_0xc5b0('0x2d')][_0xc5b0('0x31')][_0xc5b0('0x2e')],'name':_0x34e35a['name_value_list'][_0xc5b0('0x2c')][_0xc5b0('0x2e')]});});}else{logger[_0xc5b0('0xd')](_0xc5b0('0x32'));return BPromise[_0xc5b0('0x2f')]({'id':_0x34e35a[_0xc5b0('0x2d')][_0xc5b0('0x31')]['value'],'name':_0x34e35a[_0xc5b0('0x2d')][_0xc5b0('0x2c')][_0xc5b0('0x2e')]});}}function getEndUser(_0x13bd2a,_0x391466,_0x551665,_0xa606bb){logger[_0xc5b0('0xd')](_0xc5b0('0x33'),_0x551665);return request({'form':{'method':'get_entry_list','input_type':_0xc5b0('0x20'),'response_type':_0xc5b0('0x20'),'rest_data':JSON['stringify']({'session':_0xa606bb['id'],'module_name':_0xc5b0('0x19'),'query':util[_0xc5b0('0x23')](_0xc5b0('0x34'),_0x551665),'order_by':'','offset':'0','select_fields':['id',_0xc5b0('0xf'),_0xc5b0('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc5b0('0x36')](function(_0x125cbe){if(_0x125cbe[_0xc5b0('0x37')][_0xc5b0('0x1b')]){var _0x2e5c9e=_[_0xc5b0('0x38')](_0x125cbe[_0xc5b0('0x37')],function(_0x5a0722){return _0x5a0722[_0xc5b0('0x2d')]['phone_home'][_0xc5b0('0x2e')]===_0x551665;});if(_0x2e5c9e){logger[_0xc5b0('0xd')](_0xc5b0('0x39'));return BPromise[_0xc5b0('0x2f')]({'id':_0x2e5c9e[_0xc5b0('0x2d')]['id']['value'],'name':_0x2e5c9e['name_value_list'][_0xc5b0('0xf')]['value'],'phone':_0x2e5c9e['name_value_list'][_0xc5b0('0x35')][_0xc5b0('0x2e')]});}}else{logger[_0xc5b0('0xd')](_0xc5b0('0x3a'));return request({'form':{'method':'set_entry','input_type':_0xc5b0('0x20'),'response_type':_0xc5b0('0x20'),'rest_data':JSON['stringify']({'session':_0xa606bb['id'],'module_name':_0xc5b0('0x19'),'name_value_list':[{'name':_0xc5b0('0x3b'),'value':_0x391466!==''?_0x391466:util[_0xc5b0('0x23')](_0xc5b0('0x3c'),_0x551665)},{'name':_0xc5b0('0x35'),'value':_0x551665}]})}})['then'](function(_0x2d1495){logger['info'](_0xc5b0('0x3d'));return BPromise[_0xc5b0('0x2f')]({'id':_0x2d1495['id'],'name':_0x2d1495[_0xc5b0('0x37')][_0xc5b0('0x3b')][_0xc5b0('0x2e')],'phone':_0x2d1495['entry_list']['phone_home'][_0xc5b0('0x2e')]});});}});}function request(_0x3ef361){logger[_0xc5b0('0x3e')](_0xc5b0('0x3f'),JSON[_0xc5b0('0x21')](_0x3ef361));return rp(_[_0xc5b0('0x40')](def,_0x3ef361));}function getTags(_0x3a8a8d,_0x2031b0){var _0x52916e=[];if(_0x3a8a8d&&_0x3a8a8d[_0xc5b0('0x1b')]>0x0){_0x52916e=_[_0xc5b0('0x41')](_0x3a8a8d,_0x2031b0);}return _0x52916e;}function getCustomFields(_0x8be504,_0x1e6bc7){var _0x42ad48=[];var _0xb263e8={'custom_fields':[]};if(_0x8be504[_0xc5b0('0x1b')]>0x0){_['forEach'](_0x8be504,function(_0xfec533){if(_0xfec533[_0xc5b0('0x42')]===_0xc5b0('0x43')&&_0xfec533['nameField']&&!_0xfec533[_0xc5b0('0x44')]){_0xb263e8[_0xfec533[_0xc5b0('0x45')][_0xc5b0('0x46')]()]=_0xfec533['content'][_0xc5b0('0x25')]();}else if(_0xfec533[_0xc5b0('0x42')]==='string'&&_0xfec533[_0xc5b0('0x47')]&&_0xfec533[_0xc5b0('0x44')]){_0xb263e8['custom_fields'][_0xc5b0('0x1e')]({'id':_0xfec533[_0xc5b0('0x47')],'value':_0xfec533['content'][_0xc5b0('0x25')]()});}else if(_0xfec533[_0xc5b0('0x42')]===_0xc5b0('0x48')&&_0xfec533['variableName']&&_0xfec533[_0xc5b0('0x47')]&&_0xfec533[_0xc5b0('0x44')]){_0x1e6bc7[_0xfec533['variableName']]&&_0xb263e8[_0xc5b0('0x49')]['push']({'id':_0xfec533['idField'],'value':_0x1e6bc7[_0xfec533[_0xc5b0('0x1d')]][_0xc5b0('0x25')]()});}else if(_0xfec533['type']==='customVariable'&&_0xfec533['Variable']&&_0xfec533['Variable'][_0xc5b0('0xf')]&&_0xfec533['idField']&&_0xfec533[_0xc5b0('0x44')]){_0x1e6bc7[_0xfec533[_0xc5b0('0x4a')][_0xc5b0('0xf')]['toLowerCase']()]&&_0xb263e8[_0xc5b0('0x49')][_0xc5b0('0x1e')]({'id':_0xfec533['idField'],'value':_0x1e6bc7[_0xfec533[_0xc5b0('0x4a')][_0xc5b0('0xf')]['toLowerCase']()][_0xc5b0('0x25')]()});}});}return _0xb263e8;}function getConnection(_0xff4723){return request({'method':_0xc5b0('0xb'),'form':{'method':_0xc5b0('0x4b'),'input_type':_0xc5b0('0x20'),'response_type':_0xc5b0('0x20'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0xff4723[_0xc5b0('0x4c')],'password':_0xff4723[_0xc5b0('0x4d')],'encryption':_0xc5b0('0x4e')},'application':_0xc5b0('0x4f')})}})['then'](function(_0x11dc09){var _0x2ac649=_0x11dc09;if(_0x2ac649['id']){def[_0xc5b0('0x50')]=_0x2ac649['id'];return BPromise[_0xc5b0('0x2f')](_0x2ac649);}else{throw new Error(util['format'](_0xc5b0('0x51'),_0xff4723['id']));}});}function setRelationship(_0x473d45,_0x31c27a,_0x35c0b3,_0x3d310d){return request({'form':{'method':_0xc5b0('0x52'),'input_type':_0xc5b0('0x20'),'response_type':_0xc5b0('0x20'),'rest_data':JSON[_0xc5b0('0x21')]({'session':_0x473d45['id'],'module_name':'Calls','module_id':_0x35c0b3['id'],'link_field_name':_0x3d310d,'related_ids':[_0x31c27a['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xc5b0('0x53')]=function(_0x35d2e0,_0x51e16b,_0x1aac01,_0x3d75ae,_0x18eefb,_0x36a5f0){var _0x3cec99,_0x4318db,_0x115903,_0x2b50a1;_0x36a5f0[_0xc5b0('0x54')]=intUtil[_0xc5b0('0x55')](_0x36a5f0['remoteUri']);_0x36a5f0[_0xc5b0('0x56')]=intUtil[_0xc5b0('0x55')](_0x36a5f0['serverUrl']);def['uri']=util[_0xc5b0('0x23')]('%s/service/v4_1/rest.php',_0x36a5f0[_0xc5b0('0x54')]);if(_0x18eefb&&_0x18eefb[_0xc5b0('0x57')]){logger['info'](_0xc5b0('0x58'),_0xc5b0('0x59'));_0x51e16b['recordingURL']=util[_0xc5b0('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x36a5f0[_0xc5b0('0x56')],_0x51e16b[_0xc5b0('0x5a')],md5(_0x51e16b[_0xc5b0('0x5a')]));}else{_0x51e16b['recordingURL']='';}return getConnection(_0x36a5f0)[_0xc5b0('0x36')](function(_0x42ceee){_0x2b50a1=_0x42ceee;return getUser(_0x36a5f0,_0x3d75ae[_0xc5b0('0xf')],_0x2b50a1);})[_0xc5b0('0x36')](function(_0x1c3900){_0x3cec99=_0x1c3900;logger[_0xc5b0('0xd')]('The\x20User\x20ID\x20is:',_0x3cec99['id']);return getEndUser(_0x36a5f0,_0x51e16b[_0xc5b0('0x5b')],_0x51e16b['calleridnum'],_0x2b50a1);})[_0xc5b0('0x36')](function(_0x556a93){_0x4318db=_0x556a93;logger[_0xc5b0('0xd')](_0xc5b0('0x5c'),_0x4318db['id']);return getTicket(_0x36a5f0,_0x3cec99,_0x4318db,_0x1aac01,_0x51e16b,_0x1aac01[_0xc5b0('0x5d')],_0x2b50a1,_0xc5b0('0x5e'));})[_0xc5b0('0x36')](function(_0x58d8f1){_0x115903=_0x58d8f1;logger[_0xc5b0('0xd')](_0xc5b0('0x5f'));logger[_0xc5b0('0xd')](_0xc5b0('0x60'),_0x115903['id']);return setRelationship(_0x2b50a1,_0x3cec99,_0x115903,_0xc5b0('0x61'));})[_0xc5b0('0x36')](function(){return setRelationship(_0x2b50a1,_0x4318db,_0x115903,'contacts');})[_0xc5b0('0x36')](function(){return getServerInfo(_0x2b50a1);})[_0xc5b0('0x36')](function(_0x245cff){var _0x391b61=parseInt(_0x245cff[_0xc5b0('0x62')]['charAt'](0x0));var _0x434469=util[_0xc5b0('0x23')](_0xc5b0('0x63'),_0x36a5f0[_0xc5b0('0x54')],_0x115903['id']);if(_0x391b61>0x6){_0x434469=util[_0xc5b0('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x36a5f0[_0xc5b0('0x54')],_0x115903['id']);}logger[_0xc5b0('0xd')]('[QUEUE]',_0xc5b0('0x64'));emit(util[_0xc5b0('0x23')](_0xc5b0('0x65'),_0x3d75ae['name']),_0xc5b0('0x66'),{'uri':_0x434469});})[_0xc5b0('0x67')](function(_0x292d42){logger[_0xc5b0('0x68')](_0xc5b0('0x58'),JSON['stringify'](_0x292d42));});};exports[_0xc5b0('0x69')]=function(_0x5cecb1,_0x555f65,_0xdd3c20,_0x472239,_0x2eeebc,_0x412e1f,_0x46da28){var _0x5cb609,_0x370582,_0x8b8e93,_0x223c9c;_0x412e1f[_0xc5b0('0x54')]=intUtil[_0xc5b0('0x55')](_0x412e1f[_0xc5b0('0x54')]);_0x412e1f[_0xc5b0('0x56')]=intUtil[_0xc5b0('0x55')](_0x412e1f[_0xc5b0('0x56')]);def['uri']=util['format']('%s/service/v4_1/rest.php',_0x412e1f[_0xc5b0('0x54')]);if(_0x46da28&&_0x46da28[_0xc5b0('0x6a')]&&_0x46da28[_0xc5b0('0x6a')]!==_0xc5b0('0x6b')){logger[_0xc5b0('0xd')](_0xc5b0('0x6c'),'Recording\x20is\x20enabled!');_0x555f65['recordingURL']=util[_0xc5b0('0x23')](_0xc5b0('0x6d'),_0x412e1f['serverUrl'],_0x555f65[_0xc5b0('0x5a')],md5(_0x555f65['uniqueid']));}return getConnection(_0x412e1f)[_0xc5b0('0x36')](function(_0x138517){_0x223c9c=_0x138517;return getUser(_0x412e1f,_0x472239[_0xc5b0('0xf')],_0x223c9c);})[_0xc5b0('0x36')](function(_0x4cfec4){_0x5cb609=_0x4cfec4;logger[_0xc5b0('0xd')](_0xc5b0('0x6e'),_0x5cb609['id']);return getEndUser(_0x412e1f,_0x555f65[_0xc5b0('0x6f')],_0x555f65[_0xc5b0('0x70')],_0x223c9c);})[_0xc5b0('0x36')](function(_0x28fce1){_0x370582=_0x28fce1;logger[_0xc5b0('0xd')](_0xc5b0('0x5c'),_0x370582['id']);return getTicket(_0x412e1f,_0x5cb609,_0x370582,_0xdd3c20,_0x555f65,_0xdd3c20['Fields'],_0x223c9c,_0xc5b0('0x71'));})['then'](function(_0x476481){_0x8b8e93=_0x476481;logger[_0xc5b0('0xd')](_0xc5b0('0x5f'));logger[_0xc5b0('0xd')](_0xc5b0('0x60'),_0x8b8e93['id']);return setRelationship(_0x223c9c,_0x5cb609,_0x8b8e93,_0xc5b0('0x61'));})[_0xc5b0('0x36')](function(){return setRelationship(_0x223c9c,_0x370582,_0x8b8e93,_0xc5b0('0x72'));})[_0xc5b0('0x36')](function(){return getServerInfo(_0x223c9c);})[_0xc5b0('0x36')](function(_0x1b1152){var _0x44826c=parseInt(_0x1b1152[_0xc5b0('0x62')][_0xc5b0('0x73')](0x0));var _0x514898=util[_0xc5b0('0x23')](_0xc5b0('0x63'),_0x412e1f[_0xc5b0('0x54')],_0x8b8e93['id']);if(_0x44826c>0x6){_0x514898=util[_0xc5b0('0x23')](_0xc5b0('0x74'),_0x412e1f['remoteUri'],_0x8b8e93['id']);}logger['info'](_0xc5b0('0x6c'),_0xc5b0('0x64'));emit(util[_0xc5b0('0x23')]('user:%s',_0x472239[_0xc5b0('0xf')]),_0xc5b0('0x66'),{'uri':_0x514898});})[_0xc5b0('0x67')](function(_0x2de54d){logger[_0xc5b0('0x68')]('[OUTBOUND]',JSON['stringify'](_0x2de54d));});};exports[_0xc5b0('0x75')]=function(_0x208646,_0xfb1809,_0x1a2f6a,_0x5becd7,_0x20a29c,_0x4b27a6){var _0x5c7844,_0x360782,_0x3fc1e5,_0x5a8952;_0x4b27a6[_0xc5b0('0x54')]=intUtil[_0xc5b0('0x55')](_0x4b27a6[_0xc5b0('0x54')]);_0x4b27a6['serverUrl']=intUtil[_0xc5b0('0x55')](_0x4b27a6['serverUrl']);def[_0xc5b0('0x76')]=util[_0xc5b0('0x23')](_0xc5b0('0x77'),_0x4b27a6['remoteUri']);if(_0x20a29c&&_0x20a29c[_0xc5b0('0x57')]){logger[_0xc5b0('0xd')]('['+_0xfb1809[_0xc5b0('0x78')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0xfb1809[_0xc5b0('0x79')]=util['format'](_0xc5b0('0x6d'),_0x4b27a6[_0xc5b0('0x56')],_0xfb1809['uniqueid'],md5(_0xfb1809[_0xc5b0('0x5a')]));}else{_0xfb1809['recordingURL']='';}return getConnection(_0x4b27a6)['then'](function(_0x3995a7){_0x5a8952=_0x3995a7;if(!_[_0xc5b0('0x7a')](_0x5becd7)){return getUser(_0x4b27a6,_0x5becd7[_0xc5b0('0xf')],_0x5a8952);}else{return getUser(_0x4b27a6,null,_0x5a8952);}})[_0xc5b0('0x36')](function(_0x529da6){_0x5c7844=_0x529da6;logger[_0xc5b0('0xd')](_0xc5b0('0x6e'),_0x5c7844['id']);return getEndUser(_0x4b27a6,_0xfb1809['calleridname'],_0xfb1809[_0xc5b0('0x7b')],_0x5a8952);})['then'](function(_0x36026a){_0x360782=_0x36026a;logger[_0xc5b0('0xd')]('The\x20Enduser\x20ID\x20is:',_0x360782['id']);return getTicket(_0x4b27a6,_0x5c7844,_0x360782,_0x1a2f6a,_0xfb1809,_0x1a2f6a['Fields'],_0x5a8952,_0xc5b0('0x5e'));})[_0xc5b0('0x36')](function(_0xcd304a){_0x3fc1e5=_0xcd304a;logger[_0xc5b0('0xd')](_0xc5b0('0x5f'));logger[_0xc5b0('0xd')](_0xc5b0('0x60'),_0x3fc1e5['id']);return setRelationship(_0x5a8952,_0x5c7844,_0x3fc1e5,'users');})[_0xc5b0('0x36')](function(){return setRelationship(_0x5a8952,_0x360782,_0x3fc1e5,'contacts');})[_0xc5b0('0x36')](function(){return getServerInfo(_0x5a8952);})[_0xc5b0('0x67')](function(_0x3f13c4){logger['error']('['+_0xfb1809[_0xc5b0('0x78')][_0xc5b0('0x7c')]()+']',JSON[_0xc5b0('0x21')](_0x3f13c4));});}; \ No newline at end of file +var _0x8906=['find','entry_list','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Contacts','phone_home','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','first_name','debug','[HTTP]','map','type','string','nameField','customField','content','toString','custom_fields','variable','customVariable','Variable','toLowerCase','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','remoteUri','serverUrl','stripTrailingSlash','uri','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','charAt','unmanaged','%s/service/v4_1/rest.php','toUpperCase','Recording\x20is\x20enabled!','lastevent','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','POST','info','name','getString','Subjects','assigned_user_id','description','Descriptions','date_start','toISOString','slice','parent_id','parent_type','parent_name','direction','length','variableName','push','idField','set_entry','JSON','stringify','format','apiKey','get_server_info','isNil','Getting\x20agent\x20with\x20name','Employees','user_name'];(function(_0x44eb51,_0x2498f1){var _0x565da8=function(_0x4283de){while(--_0x4283de){_0x44eb51['push'](_0x44eb51['shift']());}};_0x565da8(++_0x2498f1);}(_0x8906,0x1ad));var _0x6890=function(_0x429620,_0x24cc86){_0x429620=_0x429620-0x0;var _0x2cfb64=_0x8906[_0x429620];return _0x2cfb64;};'use strict';var _=require(_0x6890('0x0'));var rp=require(_0x6890('0x1'));var BPromise=require('bluebird');var md5=require(_0x6890('0x2'));var util=require(_0x6890('0x3'));var Redis=require(_0x6890('0x4'));var intUtil=require('./util');var config=require(_0x6890('0x5'));var logger=require(_0x6890('0x6'))(_0x6890('0x7'));config['redis']=_['defaults'](config[_0x6890('0x8')],{'host':_0x6890('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6890('0x8')]));var def={'method':_0x6890('0xa'),'json':!![]};function emit(_0x4ce73c,_0x590df3,_0x50a83b){io['to'](_0x4ce73c)['emit'](_0x590df3,_0x50a83b);}function getTicket(_0x35c53c,_0x5e19b3,_0x48b826,_0x25c2a4,_0x39e174,_0x4018c4,_0x3ad54e,_0x45993b){logger[_0x6890('0xb')]('Creating\x20new\x20ticket...');var _0x38edbf=new Date();var _0x1b943d=[{'name':_0x6890('0xc'),'value':intUtil[_0x6890('0xd')](_0x25c2a4[_0x6890('0xe')],_0x39e174,'\x20')},{'name':_0x6890('0xf'),'value':_0x5e19b3['id']},{'name':'created_by','value':_0x5e19b3['id']},{'name':_0x6890('0x10'),'value':intUtil[_0x6890('0xd')](_0x25c2a4[_0x6890('0x11')],_0x39e174,'\x0a')},{'name':_0x6890('0x12'),'value':_0x38edbf[_0x6890('0x13')]()[_0x6890('0x14')](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x6890('0x15'),'value':_0x48b826['id']},{'name':_0x6890('0x16'),'value':'Contacts'},{'name':_0x6890('0x17'),'value':_0x48b826[_0x6890('0xc')]},{'name':_0x6890('0x18'),'value':_0x45993b}];if(_0x4018c4[_0x6890('0x19')]){_['forEach'](_0x4018c4,function(_0x25ae28){if(_0x39e174[_0x25ae28[_0x6890('0x1a')]]){_0x1b943d[_0x6890('0x1b')]({'name':_0x25ae28[_0x6890('0x1c')],'value':_0x39e174[_0x25ae28[_0x6890('0x1a')]]});}});}return request({'form':{'method':_0x6890('0x1d'),'input_type':_0x6890('0x1e'),'response_type':_0x6890('0x1e'),'rest_data':JSON[_0x6890('0x1f')]({'session':_0x3ad54e['id'],'module_name':'Calls','name_value_list':_0x1b943d})}});}function getAuth(_0x2cd3d8){return util[_0x6890('0x20')]('Basic\x20%s',new Buffer(_0x2cd3d8[_0x6890('0x21')]+':X')['toString']('base64'));}function getServerInfo(_0x21d454){return request({'form':{'method':_0x6890('0x22'),'input_type':_0x6890('0x1e'),'response_type':_0x6890('0x1e'),'rest_data':JSON[_0x6890('0x1f')]({'session':_0x21d454['id']})}});}function getUser(_0x9be5e2,_0x4f282c,_0x2e5a52){if(!_[_0x6890('0x23')](_0x4f282c)){logger[_0x6890('0xb')](_0x6890('0x24'),_0x4f282c);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x6890('0x1f')]({'session':_0x2e5a52['id'],'module_name':_0x6890('0x25'),'query':util[_0x6890('0x20')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x4f282c),'order_by':'','offset':'0','select_fields':['id',_0x6890('0xc'),_0x6890('0x26')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x2c1231){if(_0x2c1231['entry_list'][_0x6890('0x19')]){var _0x521ad7=_[_0x6890('0x27')](_0x2c1231[_0x6890('0x28')],function(_0x2a632e){return _0x2a632e['name_value_list']['user_name'][_0x6890('0x29')]===_0x4f282c;});if(_0x521ad7){logger['info'](_0x6890('0x2a'));return BPromise[_0x6890('0x2b')]({'id':_0x521ad7[_0x6890('0x2c')]['id']['value'],'name':_0x521ad7[_0x6890('0x2c')]['name'][_0x6890('0x29')]});}}logger[_0x6890('0xb')](_0x6890('0x2d'));return BPromise[_0x6890('0x2b')]({'id':_0x2e5a52[_0x6890('0x2c')]['user_id']['value'],'name':_0x2e5a52['name_value_list']['user_name'][_0x6890('0x29')]});});}else{logger[_0x6890('0xb')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x2e5a52[_0x6890('0x2c')][_0x6890('0x2e')][_0x6890('0x29')],'name':_0x2e5a52[_0x6890('0x2c')][_0x6890('0x26')]['value']});}}function getEndUser(_0x2c8b60,_0x114d62,_0x2de3ed,_0x43929d){logger[_0x6890('0xb')]('Searching\x20enduser\x20with\x20phone',_0x2de3ed);return request({'form':{'method':'get_entry_list','input_type':_0x6890('0x1e'),'response_type':'JSON','rest_data':JSON[_0x6890('0x1f')]({'session':_0x43929d['id'],'module_name':_0x6890('0x2f'),'query':util[_0x6890('0x20')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x2de3ed),'order_by':'','offset':'0','select_fields':['id',_0x6890('0xc'),_0x6890('0x30')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x6890('0x31')](function(_0x275a5d){if(_0x275a5d[_0x6890('0x28')]['length']){var _0x2a2dd5=_[_0x6890('0x27')](_0x275a5d[_0x6890('0x28')],function(_0x399e74){return _0x399e74[_0x6890('0x2c')][_0x6890('0x30')][_0x6890('0x29')]===_0x2de3ed;});if(_0x2a2dd5){logger[_0x6890('0xb')](_0x6890('0x32'));return BPromise[_0x6890('0x2b')]({'id':_0x2a2dd5[_0x6890('0x2c')]['id'][_0x6890('0x29')],'name':_0x2a2dd5[_0x6890('0x2c')][_0x6890('0xc')][_0x6890('0x29')],'phone':_0x2a2dd5[_0x6890('0x2c')]['phone_home'][_0x6890('0x29')]});}}else{logger[_0x6890('0xb')](_0x6890('0x33'));return request({'form':{'method':_0x6890('0x1d'),'input_type':_0x6890('0x1e'),'response_type':_0x6890('0x1e'),'rest_data':JSON[_0x6890('0x1f')]({'session':_0x43929d['id'],'module_name':_0x6890('0x2f'),'name_value_list':[{'name':'first_name','value':_0x114d62!==_0x6890('0x34')?_0x114d62:util[_0x6890('0x20')](_0x6890('0x35'),_0x2de3ed)},{'name':_0x6890('0x30'),'value':_0x2de3ed}]})}})[_0x6890('0x31')](function(_0x657ecd){logger[_0x6890('0xb')]('Enduser\x20created.');return BPromise[_0x6890('0x2b')]({'id':_0x657ecd['id'],'name':_0x657ecd[_0x6890('0x28')][_0x6890('0x36')]['value'],'phone':_0x657ecd[_0x6890('0x28')]['phone_home']['value']});});}});}function request(_0x40ccfa){logger[_0x6890('0x37')](_0x6890('0x38'),JSON['stringify'](_0x40ccfa));return rp(_['merge'](def,_0x40ccfa));}function getTags(_0x1bcbb4,_0xd59d4c){var _0x341f12=[];if(_0x1bcbb4&&_0x1bcbb4[_0x6890('0x19')]>0x0){_0x341f12=_[_0x6890('0x39')](_0x1bcbb4,_0xd59d4c);}return _0x341f12;}function getCustomFields(_0x4a79db,_0x2c4015){var _0x5743f2=[];var _0x3e9b1f={'custom_fields':[]};if(_0x4a79db[_0x6890('0x19')]>0x0){_['forEach'](_0x4a79db,function(_0x4b3f19){if(_0x4b3f19[_0x6890('0x3a')]===_0x6890('0x3b')&&_0x4b3f19[_0x6890('0x3c')]&&!_0x4b3f19[_0x6890('0x3d')]){_0x3e9b1f[_0x4b3f19[_0x6890('0x3c')]['toLowerCase']()]=_0x4b3f19[_0x6890('0x3e')][_0x6890('0x3f')]();}else if(_0x4b3f19[_0x6890('0x3a')]===_0x6890('0x3b')&&_0x4b3f19['idField']&&_0x4b3f19[_0x6890('0x3d')]){_0x3e9b1f[_0x6890('0x40')][_0x6890('0x1b')]({'id':_0x4b3f19[_0x6890('0x1c')],'value':_0x4b3f19['content'][_0x6890('0x3f')]()});}else if(_0x4b3f19[_0x6890('0x3a')]===_0x6890('0x41')&&_0x4b3f19['variableName']&&_0x4b3f19['idField']&&_0x4b3f19[_0x6890('0x3d')]){_0x2c4015[_0x4b3f19[_0x6890('0x1a')]]&&_0x3e9b1f['custom_fields']['push']({'id':_0x4b3f19[_0x6890('0x1c')],'value':_0x2c4015[_0x4b3f19[_0x6890('0x1a')]][_0x6890('0x3f')]()});}else if(_0x4b3f19[_0x6890('0x3a')]===_0x6890('0x42')&&_0x4b3f19['Variable']&&_0x4b3f19[_0x6890('0x43')][_0x6890('0xc')]&&_0x4b3f19['idField']&&_0x4b3f19[_0x6890('0x3d')]){_0x2c4015[_0x4b3f19[_0x6890('0x43')][_0x6890('0xc')][_0x6890('0x44')]()]&&_0x3e9b1f[_0x6890('0x40')][_0x6890('0x1b')]({'id':_0x4b3f19[_0x6890('0x1c')],'value':_0x2c4015[_0x4b3f19[_0x6890('0x43')][_0x6890('0xc')][_0x6890('0x44')]()][_0x6890('0x3f')]()});}});}return _0x3e9b1f;}function getConnection(_0x450749){return request({'method':_0x6890('0xa'),'form':{'method':_0x6890('0x45'),'input_type':_0x6890('0x1e'),'response_type':'JSON','rest_data':JSON[_0x6890('0x1f')]({'user_auth':{'user_name':_0x450749['username'],'password':_0x450749[_0x6890('0x46')],'encryption':_0x6890('0x47')},'application':_0x6890('0x48')})}})['then'](function(_0x27cd2e){var _0x1e957e=_0x27cd2e;if(_0x1e957e['id']){def[_0x6890('0x49')]=_0x1e957e['id'];return BPromise[_0x6890('0x2b')](_0x1e957e);}else{throw new Error(util[_0x6890('0x20')](_0x6890('0x4a'),_0x450749['id']));}});}function setRelationship(_0x1919f1,_0x5f25f9,_0x5db5ff,_0x147d3c){return request({'form':{'method':_0x6890('0x4b'),'input_type':_0x6890('0x1e'),'response_type':'JSON','rest_data':JSON[_0x6890('0x1f')]({'session':_0x1919f1['id'],'module_name':_0x6890('0x4c'),'module_id':_0x5db5ff['id'],'link_field_name':_0x147d3c,'related_ids':[_0x5f25f9['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x4cccf2,_0x41ee91,_0x45de6e,_0x55bb18,_0x192971,_0x2cbfa8){var _0x1b6668,_0x49742c,_0x4483b8,_0x3a9650;_0x2cbfa8[_0x6890('0x4d')]=intUtil['stripTrailingSlash'](_0x2cbfa8[_0x6890('0x4d')]);_0x2cbfa8[_0x6890('0x4e')]=intUtil[_0x6890('0x4f')](_0x2cbfa8[_0x6890('0x4e')]);def[_0x6890('0x50')]=util['format']('%s/service/v4_1/rest.php',_0x2cbfa8[_0x6890('0x4d')]);if(_0x192971&&_0x192971[_0x6890('0x51')]){logger['info'](_0x6890('0x52'),'Recording\x20is\x20enabled!');_0x41ee91['recordingURL']=util['format'](_0x6890('0x53'),_0x2cbfa8[_0x6890('0x4e')],_0x41ee91[_0x6890('0x54')],md5(_0x41ee91[_0x6890('0x54')]));}else{_0x41ee91[_0x6890('0x55')]='';}return getConnection(_0x2cbfa8)[_0x6890('0x31')](function(_0x2484f8){_0x3a9650=_0x2484f8;return getUser(_0x2cbfa8,_0x55bb18[_0x6890('0xc')],_0x3a9650);})[_0x6890('0x31')](function(_0x3b6d7c){_0x1b6668=_0x3b6d7c;logger[_0x6890('0xb')](_0x6890('0x56'),_0x1b6668['id']);return getEndUser(_0x2cbfa8,_0x41ee91[_0x6890('0x57')],_0x41ee91[_0x6890('0x58')],_0x3a9650);})[_0x6890('0x31')](function(_0x17bb9e){_0x49742c=_0x17bb9e;logger[_0x6890('0xb')](_0x6890('0x59'),_0x49742c['id']);return getTicket(_0x2cbfa8,_0x1b6668,_0x49742c,_0x45de6e,_0x41ee91,_0x45de6e[_0x6890('0x5a')],_0x3a9650,_0x6890('0x5b'));})[_0x6890('0x31')](function(_0x224341){_0x4483b8=_0x224341;logger['info'](_0x6890('0x5c'));logger[_0x6890('0xb')](_0x6890('0x5d'),_0x4483b8['id']);return setRelationship(_0x3a9650,_0x1b6668,_0x4483b8,_0x6890('0x5e'));})[_0x6890('0x31')](function(){return setRelationship(_0x3a9650,_0x49742c,_0x4483b8,_0x6890('0x5f'));})[_0x6890('0x31')](function(){return getServerInfo(_0x3a9650);})['then'](function(_0x53e738){var _0x2fba69=parseInt(_0x53e738[_0x6890('0x60')]['charAt'](0x0));var _0x4b68fb=util[_0x6890('0x20')](_0x6890('0x61'),_0x2cbfa8[_0x6890('0x4d')],_0x4483b8['id']);if(_0x2fba69>0x6){_0x4b68fb=util[_0x6890('0x20')](_0x6890('0x62'),_0x2cbfa8[_0x6890('0x4d')],_0x4483b8['id']);}logger[_0x6890('0xb')](_0x6890('0x52'),_0x6890('0x63'));emit(util[_0x6890('0x20')](_0x6890('0x64'),_0x55bb18[_0x6890('0xc')]),_0x6890('0x65'),{'uri':_0x4b68fb});})[_0x6890('0x66')](function(_0x4c6603){logger[_0x6890('0x67')](_0x6890('0x52'),JSON[_0x6890('0x1f')](_0x4c6603));});};exports[_0x6890('0x68')]=function(_0x37e0ba,_0x6a87c1,_0x1cceef,_0x289fc9,_0x433fae,_0x3c6c80,_0x24c81d){var _0x16d3e7,_0x202e05,_0x25d9dd,_0x1ac290;_0x3c6c80[_0x6890('0x4d')]=intUtil['stripTrailingSlash'](_0x3c6c80['remoteUri']);_0x3c6c80[_0x6890('0x4e')]=intUtil[_0x6890('0x4f')](_0x3c6c80[_0x6890('0x4e')]);def[_0x6890('0x50')]=util['format']('%s/service/v4_1/rest.php',_0x3c6c80[_0x6890('0x4d')]);if(_0x24c81d&&_0x24c81d[_0x6890('0x69')]&&_0x24c81d[_0x6890('0x69')]!==_0x6890('0x6a')){logger['info'](_0x6890('0x6b'),'Recording\x20is\x20enabled!');_0x6a87c1[_0x6890('0x55')]=util[_0x6890('0x20')](_0x6890('0x53'),_0x3c6c80[_0x6890('0x4e')],_0x6a87c1['uniqueid'],md5(_0x6a87c1['uniqueid']));}return getConnection(_0x3c6c80)[_0x6890('0x31')](function(_0x4a164c){_0x1ac290=_0x4a164c;return getUser(_0x3c6c80,_0x289fc9[_0x6890('0xc')],_0x1ac290);})[_0x6890('0x31')](function(_0x1c5ca2){_0x16d3e7=_0x1c5ca2;logger[_0x6890('0xb')]('The\x20User\x20ID\x20is:',_0x16d3e7['id']);return getEndUser(_0x3c6c80,_0x6a87c1[_0x6890('0x6c')],_0x6a87c1[_0x6890('0x6d')],_0x1ac290);})[_0x6890('0x31')](function(_0x5ce428){_0x202e05=_0x5ce428;logger[_0x6890('0xb')](_0x6890('0x59'),_0x202e05['id']);return getTicket(_0x3c6c80,_0x16d3e7,_0x202e05,_0x1cceef,_0x6a87c1,_0x1cceef[_0x6890('0x5a')],_0x1ac290,_0x6890('0x6e'));})[_0x6890('0x31')](function(_0x2c3a0c){_0x25d9dd=_0x2c3a0c;logger[_0x6890('0xb')](_0x6890('0x5c'));logger[_0x6890('0xb')](_0x6890('0x5d'),_0x25d9dd['id']);return setRelationship(_0x1ac290,_0x16d3e7,_0x25d9dd,_0x6890('0x5e'));})[_0x6890('0x31')](function(){return setRelationship(_0x1ac290,_0x202e05,_0x25d9dd,_0x6890('0x5f'));})[_0x6890('0x31')](function(){return getServerInfo(_0x1ac290);})[_0x6890('0x31')](function(_0x3356cb){var _0x138ce8=parseInt(_0x3356cb[_0x6890('0x60')][_0x6890('0x6f')](0x0));var _0xd3c0f7=util[_0x6890('0x20')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x3c6c80[_0x6890('0x4d')],_0x25d9dd['id']);if(_0x138ce8>0x6){_0xd3c0f7=util[_0x6890('0x20')](_0x6890('0x62'),_0x3c6c80[_0x6890('0x4d')],_0x25d9dd['id']);}logger[_0x6890('0xb')](_0x6890('0x6b'),_0x6890('0x63'));emit(util['format'](_0x6890('0x64'),_0x289fc9['name']),_0x6890('0x65'),{'uri':_0xd3c0f7});})[_0x6890('0x66')](function(_0x59e47d){logger['error'](_0x6890('0x6b'),JSON['stringify'](_0x59e47d));});};exports[_0x6890('0x70')]=function(_0x11b1fa,_0x5a92b1,_0x4893ad,_0x53a3ce,_0x53fd73,_0x271066){var _0x34b3a4,_0x5492f9,_0x5d0a72,_0x266ac0;_0x271066[_0x6890('0x4d')]=intUtil[_0x6890('0x4f')](_0x271066[_0x6890('0x4d')]);_0x271066[_0x6890('0x4e')]=intUtil[_0x6890('0x4f')](_0x271066[_0x6890('0x4e')]);def[_0x6890('0x50')]=util[_0x6890('0x20')](_0x6890('0x71'),_0x271066[_0x6890('0x4d')]);if(_0x53fd73&&_0x53fd73[_0x6890('0x51')]){logger[_0x6890('0xb')]('['+_0x5a92b1['lastevent'][_0x6890('0x72')]()+']',_0x6890('0x73'));_0x5a92b1[_0x6890('0x55')]=util[_0x6890('0x20')](_0x6890('0x53'),_0x271066[_0x6890('0x4e')],_0x5a92b1[_0x6890('0x54')],md5(_0x5a92b1[_0x6890('0x54')]));}else{_0x5a92b1['recordingURL']='';}return getConnection(_0x271066)['then'](function(_0x5b47fc){_0x266ac0=_0x5b47fc;if(!_[_0x6890('0x23')](_0x53a3ce)){return getUser(_0x271066,_0x53a3ce[_0x6890('0xc')],_0x266ac0);}else{return getUser(_0x271066,null,_0x266ac0);}})[_0x6890('0x31')](function(_0x5a6589){_0x34b3a4=_0x5a6589;logger[_0x6890('0xb')](_0x6890('0x56'),_0x34b3a4['id']);return getEndUser(_0x271066,_0x5a92b1[_0x6890('0x57')],_0x5a92b1[_0x6890('0x58')],_0x266ac0);})[_0x6890('0x31')](function(_0x5df79f){_0x5492f9=_0x5df79f;logger[_0x6890('0xb')](_0x6890('0x59'),_0x5492f9['id']);return getTicket(_0x271066,_0x34b3a4,_0x5492f9,_0x4893ad,_0x5a92b1,_0x4893ad[_0x6890('0x5a')],_0x266ac0,'Inbound');})[_0x6890('0x31')](function(_0x3b5e7f){_0x5d0a72=_0x3b5e7f;logger[_0x6890('0xb')](_0x6890('0x5c'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x5d0a72['id']);return setRelationship(_0x266ac0,_0x34b3a4,_0x5d0a72,_0x6890('0x5e'));})['then'](function(){return setRelationship(_0x266ac0,_0x5492f9,_0x5d0a72,_0x6890('0x5f'));})[_0x6890('0x31')](function(){return getServerInfo(_0x266ac0);})[_0x6890('0x66')](function(_0x70d644){logger[_0x6890('0x67')]('['+_0x5a92b1[_0x6890('0x74')][_0x6890('0x72')]()+']',JSON[_0x6890('0x1f')](_0x70d644));});}; \ 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 8538622..f4abf76 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 _0x25f6=['customVariable','Variable','name','toLowerCase','keyValue','keyType','string','%s:\x20%s','key','keyContent','join','stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','sortBy','length','type','push','content','variable','variableName','toString'];(function(_0x43dcd9,_0x46c400){var _0x385d33=function(_0x3c9949){while(--_0x3c9949){_0x43dcd9['push'](_0x43dcd9['shift']());}};_0x385d33(++_0x46c400);}(_0x25f6,0x98));var _0x625f=function(_0x47b1a9,_0x14e74f){_0x47b1a9=_0x47b1a9-0x0;var _0x1be6e2=_0x25f6[_0x47b1a9];return _0x1be6e2;};'use strict';var _=require(_0x625f('0x0'));var util=require(_0x625f('0x1'));exports['getString']=function(_0x26ebb3,_0x202be9,_0x3050ec){var _0x18881a=[];if(_0x26ebb3['length']>0x0){var _0x5e562c=_[_0x625f('0x2')](_0x26ebb3,['id']);for(var _0x2c81cd=0x0;_0x2c81cd<_0x5e562c[_0x625f('0x3')];_0x2c81cd++){var _0x16c9d7=_0x5e562c[_0x2c81cd];if(_0x16c9d7[_0x625f('0x4')]==='string'){_0x18881a[_0x625f('0x5')](_0x16c9d7[_0x625f('0x6')]);}else if(_0x16c9d7[_0x625f('0x4')]===_0x625f('0x7')&&_0x16c9d7[_0x625f('0x8')]){_0x202be9[_0x16c9d7[_0x625f('0x8')]]&&_0x18881a['push'](_0x202be9[_0x16c9d7[_0x625f('0x8')]][_0x625f('0x9')]());}else if(_0x16c9d7['type']===_0x625f('0xa')&&_0x16c9d7['Variable']&&_0x16c9d7[_0x625f('0xb')][_0x625f('0xc')]){_0x202be9[_0x16c9d7[_0x625f('0xb')]['name'][_0x625f('0xd')]()]&&_0x18881a['push'](_0x202be9[_0x16c9d7['Variable']['name'][_0x625f('0xd')]()][_0x625f('0x9')]());}else if(_0x16c9d7['type']===_0x625f('0xe')){if(_0x16c9d7[_0x625f('0xf')]===_0x625f('0x10')&&_0x16c9d7['key']){_0x18881a[_0x625f('0x5')](util['format'](_0x625f('0x11'),_0x16c9d7[_0x625f('0x12')],_0x16c9d7[_0x625f('0x13')]));}else if(_0x16c9d7['keyType']===_0x625f('0x7')&&_0x16c9d7['variableName']&&_0x16c9d7[_0x625f('0x12')]){_0x202be9[_0x16c9d7['variableName']]&&_0x18881a[_0x625f('0x5')](util['format'](_0x625f('0x11'),_0x16c9d7['key'],_0x202be9[_0x16c9d7[_0x625f('0x8')]]));}else if(_0x16c9d7[_0x625f('0xf')]===_0x625f('0xa')&&_0x16c9d7['Variable']&&_0x16c9d7[_0x625f('0xb')][_0x625f('0xc')]&&_0x16c9d7[_0x625f('0x12')]){_0x202be9[_0x16c9d7['Variable'][_0x625f('0xc')][_0x625f('0xd')]()]&&_0x18881a[_0x625f('0x5')](util['format']('%s:\x20%s',_0x16c9d7['key'],_0x202be9[_0x16c9d7[_0x625f('0xb')][_0x625f('0xc')]['toLowerCase']()]));}}}}return _0x18881a[_0x625f('0x14')](_0x3050ec);};exports[_0x625f('0x15')]=function(_0x339c68){var _0xbf34e5=_0x339c68['slice'](-0x1);if(_0xbf34e5==='/'){_0x339c68=_0x339c68[_0x625f('0x16')](0x0,_0x339c68[_0x625f('0x17')](_0xbf34e5));}return _0x339c68;};exports[_0x625f('0x18')]=function(_0x5248ce){if(!_[_0x625f('0x19')](_0x5248ce)&&_0x5248ce!==''){var _0x3d4ead=/^(([^<>()\[\]\\.,;:\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 _0x3d4ead[_0x625f('0x1a')](String(_0x5248ce)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0xe17f=['%s:\x20%s','keyContent','join','stripTrailingSlash','slice','lastIndexOf','validateEmail','isNil','test','lodash','util','length','sortBy','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xe17f,0x191));var _0xfe17=function(_0x2661a5,_0x383a0b){_0x2661a5=_0x2661a5-0x0;var _0x1c5597=_0xe17f[_0x2661a5];return _0x1c5597;};'use strict';var _=require(_0xfe17('0x0'));var util=require(_0xfe17('0x1'));exports['getString']=function(_0x295163,_0x558e8a,_0x261615){var _0x58fe08=[];if(_0x295163[_0xfe17('0x2')]>0x0){var _0x2a9a68=_[_0xfe17('0x3')](_0x295163,['id']);for(var _0x456bf6=0x0;_0x456bf6<_0x2a9a68[_0xfe17('0x2')];_0x456bf6++){var _0x28e7df=_0x2a9a68[_0x456bf6];if(_0x28e7df[_0xfe17('0x4')]===_0xfe17('0x5')){_0x58fe08[_0xfe17('0x6')](_0x28e7df[_0xfe17('0x7')]);}else if(_0x28e7df['type']===_0xfe17('0x8')&&_0x28e7df[_0xfe17('0x9')]){_0x558e8a[_0x28e7df[_0xfe17('0x9')]]&&_0x58fe08[_0xfe17('0x6')](_0x558e8a[_0x28e7df[_0xfe17('0x9')]][_0xfe17('0xa')]());}else if(_0x28e7df[_0xfe17('0x4')]===_0xfe17('0xb')&&_0x28e7df[_0xfe17('0xc')]&&_0x28e7df['Variable'][_0xfe17('0xd')]){_0x558e8a[_0x28e7df[_0xfe17('0xc')][_0xfe17('0xd')][_0xfe17('0xe')]()]&&_0x58fe08[_0xfe17('0x6')](_0x558e8a[_0x28e7df[_0xfe17('0xc')]['name'][_0xfe17('0xe')]()]['toString']());}else if(_0x28e7df[_0xfe17('0x4')]===_0xfe17('0xf')){if(_0x28e7df[_0xfe17('0x10')]==='string'&&_0x28e7df[_0xfe17('0x11')]){_0x58fe08[_0xfe17('0x6')](util[_0xfe17('0x12')](_0xfe17('0x13'),_0x28e7df['key'],_0x28e7df[_0xfe17('0x14')]));}else if(_0x28e7df['keyType']==='variable'&&_0x28e7df[_0xfe17('0x9')]&&_0x28e7df['key']){_0x558e8a[_0x28e7df[_0xfe17('0x9')]]&&_0x58fe08[_0xfe17('0x6')](util[_0xfe17('0x12')]('%s:\x20%s',_0x28e7df[_0xfe17('0x11')],_0x558e8a[_0x28e7df['variableName']]));}else if(_0x28e7df['keyType']===_0xfe17('0xb')&&_0x28e7df['Variable']&&_0x28e7df[_0xfe17('0xc')][_0xfe17('0xd')]&&_0x28e7df[_0xfe17('0x11')]){_0x558e8a[_0x28e7df[_0xfe17('0xc')]['name'][_0xfe17('0xe')]()]&&_0x58fe08['push'](util[_0xfe17('0x12')](_0xfe17('0x13'),_0x28e7df['key'],_0x558e8a[_0x28e7df[_0xfe17('0xc')]['name'][_0xfe17('0xe')]()]));}}}}return _0x58fe08[_0xfe17('0x15')](_0x261615);};exports[_0xfe17('0x16')]=function(_0x220146){var _0x3a2f93=_0x220146[_0xfe17('0x17')](-0x1);if(_0x3a2f93==='/'){_0x220146=_0x220146['substring'](0x0,_0x220146[_0xfe17('0x18')](_0x3a2f93));}return _0x220146;};exports[_0xfe17('0x19')]=function(_0x4a434e){if(!_[_0xfe17('0x1a')](_0x4a434e)&&_0x4a434e!==''){var _0x8cb98f=/^(([^<>()\[\]\\.,;:\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 _0x8cb98f[_0xfe17('0x1b')](String(_0x4a434e)[_0xfe17('0xe')]());}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 704f507..3ac0aa6 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(_0x1b8396,_0x191315){var _0x3f29c=function(_0x22cdd7){while(--_0x22cdd7){_0x1b8396['push'](_0x1b8396['shift']());}};_0x3f29c(++_0x191315);}(_0x9c44,0x178));var _0x49c4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9c44[_0x5f1391];return _0x50ebe3;};'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 _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(_0x34f04f,_0x4961ce){var _0x3ac958=function(_0x4eee05){while(--_0x4eee05){_0x34f04f['push'](_0x34f04f['shift']());}};_0x3ac958(++_0x4961ce);}(_0x9c44,0x178));var _0x49c4=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x9c44[_0x279d37];return _0x530173;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index aa608f1..c72c066 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 _0xb177=['customVariable','Variable','name','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','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','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','/api/v2','unmanaged','toUpperCase','inspect','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','stringify','defaults','GET','map','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','custom_fields','push','idField','variable','variableName'];(function(_0x365c20,_0x30762e){var _0xc679bb=function(_0x42133d){while(--_0x42133d){_0x365c20['push'](_0x365c20['shift']());}};_0xc679bb(++_0x30762e);}(_0xb177,0x9a));var _0x7b17=function(_0x19258e,_0x64ecd0){_0x19258e=_0x19258e-0x0;var _0x587312=_0xb177[_0x19258e];return _0x587312;};'use strict';var _=require(_0x7b17('0x0'));var rp=require(_0x7b17('0x1'));var md5=require('md5');var util=require(_0x7b17('0x2'));var Redis=require(_0x7b17('0x3'));var intUtil=require(_0x7b17('0x4'));var config=require(_0x7b17('0x5'));var logger=require(_0x7b17('0x6'))(_0x7b17('0x7'));config[_0x7b17('0x8')]=_['defaults'](config[_0x7b17('0x8')],{'host':_0x7b17('0x9'),'port':0x18eb});var io=require(_0x7b17('0xa'))(new Redis(config['redis']));function emit(_0x10774b,_0x344fce,_0x21765e){io['to'](_0x10774b)['emit'](_0x344fce,_0x21765e);}var headers={'Content-Type':_0x7b17('0xb'),'Accept':'application/json'};function getTicket(_0x471272,_0x165918,_0xa252ff,_0x753eda,_0x3476be){logger[_0x7b17('0xc')](_0x7b17('0xd'));return request({'uri':util[_0x7b17('0xe')](_0x7b17('0xf'),_0x471272[_0x7b17('0x10')]),'method':_0x7b17('0x11'),'body':{'ticket':_[_0x7b17('0x12')]({'requester_id':_0xa252ff['id'],'submitter_id':_0x165918?_0x165918['id']:undefined,'assignee_id':_0x165918?_0x165918['id']:undefined,'tags':getTags(_0x753eda[_0x7b17('0x13')],'name'),'subject':intUtil[_0x7b17('0x14')](_0x753eda[_0x7b17('0x15')],_0x3476be,'\x20'),'description':intUtil[_0x7b17('0x14')](_0x753eda[_0x7b17('0x16')],_0x3476be,'\x0a'),'comment':{'public':![],'body':intUtil[_0x7b17('0x14')](_0x753eda[_0x7b17('0x16')],_0x3476be,'\x0a')}},getCustomFields(_0x753eda[_0x7b17('0x17')],_0x3476be))}})[_0x7b17('0x18')](function(_0x9d4c7f){logger['info'](_0x7b17('0x19'));return _0x9d4c7f['ticket'];});}function getUser(_0x3a4a36,_0x4f7e73){if(intUtil['validateEmail'](_0x4f7e73)){logger['info'](_0x7b17('0x1a'),_0x4f7e73);return request({'uri':util[_0x7b17('0xe')](_0x7b17('0x1b'),_0x3a4a36[_0x7b17('0x10')]),'qs':{'query':util[_0x7b17('0xe')](_0x7b17('0x1c'),_0x4f7e73)}})[_0x7b17('0x18')](function(_0x1c9a2a){if(_0x1c9a2a[_0x7b17('0x1d')]){logger[_0x7b17('0xc')](_0x7b17('0x1e'));return _[_0x7b17('0x1f')](_0x1c9a2a[_0x7b17('0x20')],{'email':_0x4f7e73,'role':_0x7b17('0x21')});}else{logger[_0x7b17('0xc')](_0x7b17('0x22'));return request({'uri':util[_0x7b17('0xe')](_0x7b17('0x23'),_0x3a4a36[_0x7b17('0x10')])})[_0x7b17('0x18')](function(_0x2b2c3a){logger[_0x7b17('0xc')](_0x7b17('0x24'));return _0x2b2c3a[_0x7b17('0x25')];});}});}else{logger['info'](_0x7b17('0x22'));return request({'uri':util['format'](_0x7b17('0x23'),_0x3a4a36[_0x7b17('0x10')])})[_0x7b17('0x18')](function(_0x2f1474){logger[_0x7b17('0xc')](_0x7b17('0x24'));return _0x2f1474[_0x7b17('0x25')];});}}function getEndUser(_0x392ea7,_0x44b9d3,_0x2e2f9a){logger['info'](_0x7b17('0x26'),_0x2e2f9a);return request({'uri':util['format']('%s/search.json',_0x392ea7[_0x7b17('0x10')]),'qs':{'query':util[_0x7b17('0xe')](_0x7b17('0x27'),_0x2e2f9a)}})[_0x7b17('0x18')](function(_0x160ebc){var _0x20a54d;if(_0x160ebc[_0x7b17('0x20')][_0x7b17('0x28')]){_0x160ebc[_0x7b17('0x20')]=_['filter'](_0x160ebc[_0x7b17('0x20')],{'suspended':![],'role':_0x7b17('0x29')});if(_0x160ebc[_0x7b17('0x20')][_0x7b17('0x28')]){_0x20a54d=_[_0x7b17('0x2a')](_0x160ebc[_0x7b17('0x20')]);}}if(_0x20a54d){logger[_0x7b17('0xc')]('Enduser\x20found!');return _0x20a54d;}else{logger['info'](_0x7b17('0x2b'));return request({'uri':util[_0x7b17('0xe')]('%s/users.json',_0x392ea7[_0x7b17('0x10')]),'method':_0x7b17('0x11'),'body':{'user':{'role':'end-user','name':util[_0x7b17('0xe')]('Caller\x20-\x20%s',_0x44b9d3||_0x2e2f9a),'phone':_0x2e2f9a}}})['then'](function(_0x4910cb){logger['info'](_0x7b17('0x2c'));return _0x4910cb[_0x7b17('0x25')];});}});}function getAuth(_0x37d9b8){var _0x3f2b6d;if(_0x37d9b8[_0x7b17('0x2d')]===_0x7b17('0x2e')){_0x3f2b6d=util[_0x7b17('0xe')](_0x7b17('0x2f'),_0x37d9b8[_0x7b17('0x30')],_0x37d9b8[_0x7b17('0x2e')]);}else if(_0x37d9b8[_0x7b17('0x2d')]===_0x7b17('0x31')){_0x3f2b6d=util['format'](_0x7b17('0x32'),_0x37d9b8[_0x7b17('0x30')],_0x37d9b8[_0x7b17('0x31')]);}return util['format'](_0x7b17('0x33'),new Buffer(_0x3f2b6d)[_0x7b17('0x34')](_0x7b17('0x35')));}function request(_0x5494eb){logger[_0x7b17('0x36')]('[HTTP]',JSON[_0x7b17('0x37')](_0x5494eb));return rp(_[_0x7b17('0x38')](_0x5494eb,{'method':_0x7b17('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x11bad5,_0x26ae6b){var _0x134060=[];if(_0x11bad5&&_0x11bad5[_0x7b17('0x28')]>0x0){_0x134060=_[_0x7b17('0x3a')](_0x11bad5,_0x26ae6b);}return _0x134060;}function getCustomFields(_0x326ece,_0x4bccfc){var _0x5915ad=[];var _0x48ec16={'custom_fields':[]};if(_0x326ece['length']>0x0){_[_0x7b17('0x3b')](_0x326ece,function(_0x322fb1){if(_[_0x7b17('0x3c')](['string',_0x7b17('0x3d')],_0x322fb1[_0x7b17('0x3e')])&&_0x322fb1[_0x7b17('0x3f')]&&!_0x322fb1[_0x7b17('0x40')]){_0x48ec16[_0x322fb1[_0x7b17('0x3f')][_0x7b17('0x41')]()]=_0x322fb1[_0x7b17('0x42')][_0x7b17('0x34')]();}else if(_['includes'](['string','picklist'],_0x322fb1[_0x7b17('0x3e')])&&_0x322fb1['idField']&&_0x322fb1[_0x7b17('0x40')]){_0x48ec16[_0x7b17('0x43')][_0x7b17('0x44')]({'id':_0x322fb1[_0x7b17('0x45')],'value':_0x322fb1[_0x7b17('0x42')]['toString']()});}else if(_0x322fb1[_0x7b17('0x3e')]===_0x7b17('0x46')&&_0x322fb1[_0x7b17('0x47')]&&_0x322fb1[_0x7b17('0x45')]&&_0x322fb1['customField']){_0x4bccfc[_0x322fb1['variableName']]&&_0x48ec16[_0x7b17('0x43')]['push']({'id':_0x322fb1['idField'],'value':_0x4bccfc[_0x322fb1[_0x7b17('0x47')]][_0x7b17('0x34')]()});}else if(_0x322fb1[_0x7b17('0x3e')]===_0x7b17('0x48')&&_0x322fb1[_0x7b17('0x49')]&&_0x322fb1['Variable'][_0x7b17('0x4a')]&&_0x322fb1['idField']&&_0x322fb1[_0x7b17('0x40')]){_0x4bccfc[_0x322fb1['Variable'][_0x7b17('0x4a')]['toLowerCase']()]&&_0x48ec16[_0x7b17('0x43')][_0x7b17('0x44')]({'id':_0x322fb1['idField'],'value':_0x4bccfc[_0x322fb1['Variable'][_0x7b17('0x4a')][_0x7b17('0x41')]()][_0x7b17('0x34')]()});}});}return _0x48ec16;}exports[_0x7b17('0x4b')]=function(_0x1c9b38,_0x15ef24,_0x3a80cd,_0x2dab3f,_0x236e5d,_0x4e3f52){var _0x461e57,_0x49df34;_0x4e3f52[_0x7b17('0x10')]=intUtil[_0x7b17('0x4c')](_0x4e3f52[_0x7b17('0x10')]);_0x4e3f52[_0x7b17('0x4d')]=intUtil['stripTrailingSlash'](_0x4e3f52['serverUrl']);if(_0x236e5d&&_0x236e5d[_0x7b17('0x4e')]){logger[_0x7b17('0xc')](_0x7b17('0x4f'),_0x7b17('0x50'));_0x15ef24[_0x7b17('0x51')]=util['format'](_0x7b17('0x52'),_0x4e3f52[_0x7b17('0x4d')],_0x15ef24[_0x7b17('0x53')],md5(_0x15ef24[_0x7b17('0x53')]));}else{_0x15ef24[_0x7b17('0x51')]='';}headers[_0x7b17('0x54')]=getAuth(_0x4e3f52);return getUser(_0x4e3f52,_0x2dab3f[_0x7b17('0x55')])[_0x7b17('0x18')](function(_0x3c69d5){_0x461e57=_0x3c69d5;logger['info'](_0x7b17('0x56'),_0x461e57['id']);return getEndUser(_0x4e3f52,_0x15ef24[_0x7b17('0x57')],_0x15ef24[_0x7b17('0x58')]);})[_0x7b17('0x18')](function(_0x1b776e){_0x49df34=_0x1b776e;logger[_0x7b17('0xc')](_0x7b17('0x59'),_0x49df34['id']);return getTicket(_0x4e3f52,_0x461e57,_0x49df34,_0x3a80cd,_0x15ef24);})[_0x7b17('0x18')](function(_0x1bdf09){if(_0x1bdf09){logger[_0x7b17('0xc')](_0x7b17('0x5a'),_0x1bdf09['id']);switch(_0x4e3f52[_0x7b17('0x3e')]){case _0x7b17('0x5b'):logger['info'](_0x7b17('0x4f'),_0x7b17('0x5c'));return request({'uri':util[_0x7b17('0xe')](_0x7b17('0x5d'),_0x4e3f52[_0x7b17('0x10')],_0x461e57['id'],_0x1bdf09['id']),'method':_0x7b17('0x11')});case _0x7b17('0x5e'):logger['info']('[QUEUE]',_0x7b17('0x5f'));emit(util[_0x7b17('0xe')](_0x7b17('0x60'),_0x2dab3f[_0x7b17('0x4a')]),_0x7b17('0x61'),{'uri':util[_0x7b17('0xe')](_0x7b17('0x62'),_0x4e3f52[_0x7b17('0x10')][_0x7b17('0x63')]('/api/v2',''),_0x1bdf09['id'])});break;default:logger[_0x7b17('0x64')](_0x7b17('0x4f'),_0x7b17('0x65'));}}})[_0x7b17('0x66')](function(_0x418616){logger[_0x7b17('0x64')](_0x7b17('0x67'),util['inspect'](_0x418616,{'showHidden':!![],'depth':null}));});};exports[_0x7b17('0x68')]=function(_0x3a0af7,_0x3af582,_0x5ece67,_0x19ecb0,_0x37bdde,_0x64d366,_0x5ca188){var _0x39318b,_0x4f7768;_0x64d366['remoteUri']=intUtil['stripTrailingSlash'](_0x64d366['remoteUri']);_0x64d366[_0x7b17('0x4d')]=intUtil['stripTrailingSlash'](_0x64d366[_0x7b17('0x4d')]);if(_0x5ca188&&_0x5ca188[_0x7b17('0x69')]&&_0x5ca188[_0x7b17('0x69')]!==_0x7b17('0x6a')){logger[_0x7b17('0xc')](_0x7b17('0x6b'),_0x7b17('0x50'));_0x3af582['recordingURL']=util[_0x7b17('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x64d366[_0x7b17('0x4d')],_0x3af582[_0x7b17('0x53')],md5(_0x3af582['uniqueid']));}headers['Authorization']=getAuth(_0x64d366);return getUser(_0x64d366,_0x19ecb0[_0x7b17('0x55')])[_0x7b17('0x18')](function(_0x30c5e0){_0x39318b=_0x30c5e0;logger[_0x7b17('0xc')]('The\x20User\x20ID\x20is:',_0x39318b['id']);return getEndUser(_0x64d366,_0x3af582['destcalleridname'],_0x3af582[_0x7b17('0x6c')]);})[_0x7b17('0x18')](function(_0x3fc8e5){_0x4f7768=_0x3fc8e5;logger[_0x7b17('0xc')](_0x7b17('0x59'),_0x4f7768['id']);return getTicket(_0x64d366,_0x39318b,_0x4f7768,_0x5ece67,_0x3af582);})[_0x7b17('0x18')](function(_0x47403a){if(_0x47403a){logger[_0x7b17('0xc')](_0x7b17('0x5a'),_0x47403a['id']);switch(_0x64d366[_0x7b17('0x3e')]){case'integrationTab':logger[_0x7b17('0xc')](_0x7b17('0x6b'),_0x7b17('0x5c'));return request({'uri':util[_0x7b17('0xe')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x64d366[_0x7b17('0x10')],_0x39318b['id'],_0x47403a['id']),'method':'POST'});case _0x7b17('0x5e'):logger['info'](_0x7b17('0x6b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x7b17('0x60'),_0x19ecb0[_0x7b17('0x4a')]),_0x7b17('0x61'),{'uri':util['format'](_0x7b17('0x62'),_0x64d366[_0x7b17('0x10')][_0x7b17('0x63')](_0x7b17('0x6d'),''),_0x47403a['id'])});break;default:logger[_0x7b17('0x64')](_0x7b17('0x6b'),_0x7b17('0x65'));}}})[_0x7b17('0x66')](function(_0x133e0d){logger[_0x7b17('0x64')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x133e0d,{'showHidden':!![],'depth':null}));});};exports[_0x7b17('0x6e')]=function(_0x36d555,_0x4982b5,_0x3d1e57,_0x36288a,_0xa7465c,_0x55dc00){var _0x4d8c19,_0xaed10;_0x55dc00[_0x7b17('0x10')]=intUtil[_0x7b17('0x4c')](_0x55dc00[_0x7b17('0x10')]);_0x55dc00['serverUrl']=intUtil[_0x7b17('0x4c')](_0x55dc00[_0x7b17('0x4d')]);if(_0xa7465c&&_0xa7465c[_0x7b17('0x4e')]){logger[_0x7b17('0xc')]('['+_0x4982b5['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x4982b5['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x55dc00[_0x7b17('0x4d')],_0x4982b5[_0x7b17('0x53')],md5(_0x4982b5[_0x7b17('0x53')]));}else{_0x4982b5[_0x7b17('0x51')]='';}headers[_0x7b17('0x54')]=getAuth(_0x55dc00);return getUser(_0x55dc00)[_0x7b17('0x18')](function(_0xaac60d){_0x4d8c19=_0xaac60d;logger[_0x7b17('0xc')]('The\x20User\x20ID\x20is:',_0x4d8c19['id']);return getEndUser(_0x55dc00,_0x4982b5['calleridname'],_0x4982b5[_0x7b17('0x58')]);})[_0x7b17('0x18')](function(_0x2f8047){_0xaed10=_0x2f8047;logger[_0x7b17('0xc')](_0x7b17('0x59'),_0xaed10['id']);return getTicket(_0x55dc00,_0x4d8c19,_0xaed10,_0x3d1e57,_0x4982b5);})[_0x7b17('0x18')](function(_0x546de0){if(_0x546de0){logger['info']('The\x20Ticket\x20ID\x20is:',_0x546de0['id']);}})['catch'](function(_0x46c946){logger['error']('['+_0x4982b5['lastevent'][_0x7b17('0x6f')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x7b17('0x70')](_0x46c946,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x05e7=['%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','debug','stringify','GET','map','forEach','includes','string','picklist','type','nameField','content','idField','customField','custom_fields','variable','variableName','customVariable','Variable','toLowerCase','push','serverUrl','stripTrailingSlash','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','email','destcalleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','user:%s','error','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','ioredis','./util','../../../../config/logger','redis','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','Tags','name','Subjects','getString','Descriptions','Fields','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','then','count','Agent\x20found!','find','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','filter','end-user','length','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x05e7,0xb5));var _0x705e=function(_0x95743f,_0x178f68){_0x95743f=_0x95743f-0x0;var _0xfb4b3c=_0x05e7[_0x95743f];return _0xfb4b3c;};'use strict';var _=require('lodash');var rp=require(_0x705e('0x0'));var md5=require(_0x705e('0x1'));var util=require('util');var Redis=require(_0x705e('0x2'));var intUtil=require(_0x705e('0x3'));var config=require('../../../../config/environment');var logger=require(_0x705e('0x4'))('zendesk');config[_0x705e('0x5')]=_[_0x705e('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x705e('0x7'))(new Redis(config[_0x705e('0x5')]));function emit(_0x5a7e41,_0x493367,_0x4f4857){io['to'](_0x5a7e41)[_0x705e('0x8')](_0x493367,_0x4f4857);}var headers={'Content-Type':_0x705e('0x9'),'Accept':'application/json'};function getTicket(_0x17e1ba,_0x3c51e7,_0x11b912,_0x612244,_0x590418){logger[_0x705e('0xa')](_0x705e('0xb'));return request({'uri':util[_0x705e('0xc')](_0x705e('0xd'),_0x17e1ba[_0x705e('0xe')]),'method':_0x705e('0xf'),'body':{'ticket':_['merge']({'requester_id':_0x11b912['id'],'submitter_id':_0x3c51e7?_0x3c51e7['id']:undefined,'assignee_id':_0x3c51e7?_0x3c51e7['id']:undefined,'tags':getTags(_0x612244[_0x705e('0x10')],_0x705e('0x11')),'subject':intUtil['getString'](_0x612244[_0x705e('0x12')],_0x590418,'\x20'),'description':intUtil[_0x705e('0x13')](_0x612244[_0x705e('0x14')],_0x590418,'\x0a'),'comment':{'public':![],'body':intUtil[_0x705e('0x13')](_0x612244[_0x705e('0x14')],_0x590418,'\x0a')}},getCustomFields(_0x612244[_0x705e('0x15')],_0x590418))}})['then'](function(_0x1c5a3b){logger['info'](_0x705e('0x16'));return _0x1c5a3b[_0x705e('0x17')];});}function getUser(_0xde4bbe,_0x147583){if(intUtil[_0x705e('0x18')](_0x147583)){logger[_0x705e('0xa')](_0x705e('0x19'),_0x147583);return request({'uri':util['format'](_0x705e('0x1a'),_0xde4bbe['remoteUri']),'qs':{'query':util[_0x705e('0xc')]('type:user\x20role:agent\x20email:%s',_0x147583)}})[_0x705e('0x1b')](function(_0x2c65aa){if(_0x2c65aa[_0x705e('0x1c')]){logger['info'](_0x705e('0x1d'));return _[_0x705e('0x1e')](_0x2c65aa[_0x705e('0x1f')],{'email':_0x147583,'role':_0x705e('0x20')});}else{logger[_0x705e('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x705e('0x21'),_0xde4bbe[_0x705e('0xe')])})['then'](function(_0x775860){logger[_0x705e('0xa')](_0x705e('0x22'));return _0x775860[_0x705e('0x23')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x705e('0xc')]('%s/users/me.json',_0xde4bbe['remoteUri'])})[_0x705e('0x1b')](function(_0x1e10ef){logger[_0x705e('0xa')](_0x705e('0x22'));return _0x1e10ef['user'];});}}function getEndUser(_0x5d852f,_0x18e13a,_0x292d65){logger[_0x705e('0xa')](_0x705e('0x24'),_0x292d65);return request({'uri':util[_0x705e('0xc')]('%s/search.json',_0x5d852f[_0x705e('0xe')]),'qs':{'query':util['format'](_0x705e('0x25'),_0x292d65)}})['then'](function(_0x2931e2){var _0x545cac;if(_0x2931e2[_0x705e('0x1f')]['length']){_0x2931e2['results']=_[_0x705e('0x26')](_0x2931e2['results'],{'suspended':![],'role':_0x705e('0x27')});if(_0x2931e2['results'][_0x705e('0x28')]){_0x545cac=_[_0x705e('0x29')](_0x2931e2[_0x705e('0x1f')]);}}if(_0x545cac){logger[_0x705e('0xa')]('Enduser\x20found!');return _0x545cac;}else{logger[_0x705e('0xa')](_0x705e('0x2a'));return request({'uri':util[_0x705e('0xc')](_0x705e('0x2b'),_0x5d852f[_0x705e('0xe')]),'method':'POST','body':{'user':{'role':_0x705e('0x27'),'name':util['format'](_0x705e('0x2c'),_0x18e13a||_0x292d65),'phone':_0x292d65}}})['then'](function(_0xb1fca0){logger['info'](_0x705e('0x2d'));return _0xb1fca0[_0x705e('0x23')];});}});}function getAuth(_0x28603a){var _0x41b545;if(_0x28603a[_0x705e('0x2e')]===_0x705e('0x2f')){_0x41b545=util[_0x705e('0xc')](_0x705e('0x30'),_0x28603a[_0x705e('0x31')],_0x28603a['password']);}else if(_0x28603a[_0x705e('0x2e')]===_0x705e('0x32')){_0x41b545=util[_0x705e('0xc')](_0x705e('0x33'),_0x28603a[_0x705e('0x31')],_0x28603a['token']);}return util[_0x705e('0xc')](_0x705e('0x34'),new Buffer(_0x41b545)[_0x705e('0x35')]('base64'));}function request(_0x4bb15d){logger[_0x705e('0x36')]('[HTTP]',JSON[_0x705e('0x37')](_0x4bb15d));return rp(_['defaults'](_0x4bb15d,{'method':_0x705e('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x526b86,_0x48f2fe){var _0x4b62c9=[];if(_0x526b86&&_0x526b86['length']>0x0){_0x4b62c9=_[_0x705e('0x39')](_0x526b86,_0x48f2fe);}return _0x4b62c9;}function getCustomFields(_0x3d5213,_0x4b28b4){var _0x467868=[];var _0x15ff1f={'custom_fields':[]};if(_0x3d5213[_0x705e('0x28')]>0x0){_[_0x705e('0x3a')](_0x3d5213,function(_0xc34e2e){if(_[_0x705e('0x3b')]([_0x705e('0x3c'),_0x705e('0x3d')],_0xc34e2e[_0x705e('0x3e')])&&_0xc34e2e[_0x705e('0x3f')]&&!_0xc34e2e['customField']){_0x15ff1f[_0xc34e2e[_0x705e('0x3f')]['toLowerCase']()]=_0xc34e2e[_0x705e('0x40')]['toString']();}else if(_[_0x705e('0x3b')](['string',_0x705e('0x3d')],_0xc34e2e['type'])&&_0xc34e2e[_0x705e('0x41')]&&_0xc34e2e[_0x705e('0x42')]){_0x15ff1f[_0x705e('0x43')]['push']({'id':_0xc34e2e[_0x705e('0x41')],'value':_0xc34e2e['content']['toString']()});}else if(_0xc34e2e['type']===_0x705e('0x44')&&_0xc34e2e[_0x705e('0x45')]&&_0xc34e2e[_0x705e('0x41')]&&_0xc34e2e[_0x705e('0x42')]){_0x4b28b4[_0xc34e2e[_0x705e('0x45')]]&&_0x15ff1f[_0x705e('0x43')]['push']({'id':_0xc34e2e[_0x705e('0x41')],'value':_0x4b28b4[_0xc34e2e[_0x705e('0x45')]][_0x705e('0x35')]()});}else if(_0xc34e2e[_0x705e('0x3e')]===_0x705e('0x46')&&_0xc34e2e[_0x705e('0x47')]&&_0xc34e2e['Variable']['name']&&_0xc34e2e[_0x705e('0x41')]&&_0xc34e2e[_0x705e('0x42')]){_0x4b28b4[_0xc34e2e[_0x705e('0x47')][_0x705e('0x11')][_0x705e('0x48')]()]&&_0x15ff1f['custom_fields'][_0x705e('0x49')]({'id':_0xc34e2e[_0x705e('0x41')],'value':_0x4b28b4[_0xc34e2e[_0x705e('0x47')][_0x705e('0x11')][_0x705e('0x48')]()]['toString']()});}});}return _0x15ff1f;}exports['queue']=function(_0x46dfc2,_0x339f0d,_0x3a8878,_0x5b8acb,_0x5267b9,_0x2ed97c){var _0x19c1ad,_0x2d0984;_0x2ed97c[_0x705e('0xe')]=intUtil['stripTrailingSlash'](_0x2ed97c[_0x705e('0xe')]);_0x2ed97c[_0x705e('0x4a')]=intUtil[_0x705e('0x4b')](_0x2ed97c[_0x705e('0x4a')]);if(_0x5267b9&&_0x5267b9['monitor_format']){logger[_0x705e('0xa')]('[QUEUE]',_0x705e('0x4c'));_0x339f0d['recordingURL']=util[_0x705e('0xc')](_0x705e('0x4d'),_0x2ed97c[_0x705e('0x4a')],_0x339f0d[_0x705e('0x4e')],md5(_0x339f0d['uniqueid']));}else{_0x339f0d[_0x705e('0x4f')]='';}headers[_0x705e('0x50')]=getAuth(_0x2ed97c);return getUser(_0x2ed97c,_0x5b8acb['email'])['then'](function(_0xd7b849){_0x19c1ad=_0xd7b849;logger[_0x705e('0xa')](_0x705e('0x51'),_0x19c1ad['id']);return getEndUser(_0x2ed97c,_0x339f0d[_0x705e('0x52')],_0x339f0d['calleridnum']);})[_0x705e('0x1b')](function(_0x51ea84){_0x2d0984=_0x51ea84;logger[_0x705e('0xa')](_0x705e('0x53'),_0x2d0984['id']);return getTicket(_0x2ed97c,_0x19c1ad,_0x2d0984,_0x3a8878,_0x339f0d);})[_0x705e('0x1b')](function(_0x1eb1d7){if(_0x1eb1d7){logger['info']('The\x20Ticket\x20ID\x20is:',_0x1eb1d7['id']);switch(_0x2ed97c[_0x705e('0x3e')]){case'integrationTab':logger[_0x705e('0xa')](_0x705e('0x54'),_0x705e('0x55'));return request({'uri':util[_0x705e('0xc')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x2ed97c[_0x705e('0xe')],_0x19c1ad['id'],_0x1eb1d7['id']),'method':'POST'});case _0x705e('0x56'):logger[_0x705e('0xa')](_0x705e('0x54'),_0x705e('0x57'));emit(util[_0x705e('0xc')]('user:%s',_0x5b8acb['name']),_0x705e('0x58'),{'uri':util['format'](_0x705e('0x59'),_0x2ed97c[_0x705e('0xe')][_0x705e('0x5a')](_0x705e('0x5b'),''),_0x1eb1d7['id'])});break;default:logger['error'](_0x705e('0x54'),_0x705e('0x5c'));}}})[_0x705e('0x5d')](function(_0x2c260d){logger['error'](_0x705e('0x5e'),util[_0x705e('0x5f')](_0x2c260d,{'showHidden':!![],'depth':null}));});};exports[_0x705e('0x60')]=function(_0x14682d,_0x3b6d53,_0x537256,_0x52f8dc,_0x283acb,_0xcd613e,_0x23af62){var _0x5df8dd,_0x3e7b6d;_0xcd613e[_0x705e('0xe')]=intUtil[_0x705e('0x4b')](_0xcd613e[_0x705e('0xe')]);_0xcd613e[_0x705e('0x4a')]=intUtil[_0x705e('0x4b')](_0xcd613e[_0x705e('0x4a')]);if(_0x23af62&&_0x23af62[_0x705e('0x61')]&&_0x23af62[_0x705e('0x61')]!=='none'){logger[_0x705e('0xa')](_0x705e('0x62'),'Recording\x20is\x20enabled!');_0x3b6d53[_0x705e('0x4f')]=util[_0x705e('0xc')](_0x705e('0x4d'),_0xcd613e[_0x705e('0x4a')],_0x3b6d53[_0x705e('0x4e')],md5(_0x3b6d53[_0x705e('0x4e')]));}headers[_0x705e('0x50')]=getAuth(_0xcd613e);return getUser(_0xcd613e,_0x52f8dc[_0x705e('0x63')])[_0x705e('0x1b')](function(_0x2bc7cd){_0x5df8dd=_0x2bc7cd;logger[_0x705e('0xa')]('The\x20User\x20ID\x20is:',_0x5df8dd['id']);return getEndUser(_0xcd613e,_0x3b6d53['destcalleridname'],_0x3b6d53[_0x705e('0x64')]);})['then'](function(_0x2c0c01){_0x3e7b6d=_0x2c0c01;logger[_0x705e('0xa')](_0x705e('0x53'),_0x3e7b6d['id']);return getTicket(_0xcd613e,_0x5df8dd,_0x3e7b6d,_0x537256,_0x3b6d53);})[_0x705e('0x1b')](function(_0x3441e4){if(_0x3441e4){logger['info'](_0x705e('0x65'),_0x3441e4['id']);switch(_0xcd613e[_0x705e('0x3e')]){case _0x705e('0x66'):logger[_0x705e('0xa')](_0x705e('0x62'),_0x705e('0x55'));return request({'uri':util[_0x705e('0xc')](_0x705e('0x67'),_0xcd613e[_0x705e('0xe')],_0x5df8dd['id'],_0x3441e4['id']),'method':_0x705e('0xf')});case _0x705e('0x56'):logger[_0x705e('0xa')](_0x705e('0x62'),_0x705e('0x57'));emit(util[_0x705e('0xc')](_0x705e('0x68'),_0x52f8dc['name']),_0x705e('0x58'),{'uri':util[_0x705e('0xc')](_0x705e('0x59'),_0xcd613e[_0x705e('0xe')]['replace']('/api/v2',''),_0x3441e4['id'])});break;default:logger[_0x705e('0x69')](_0x705e('0x62'),_0x705e('0x5c'));}}})[_0x705e('0x5d')](function(_0xbc142d){logger[_0x705e('0x69')](_0x705e('0x6a'),util[_0x705e('0x5f')](_0xbc142d,{'showHidden':!![],'depth':null}));});};exports[_0x705e('0x6b')]=function(_0x195e37,_0x5c2fe8,_0x27b1e7,_0x31cbc0,_0x496937,_0x4ab404){var _0x3bb0be,_0x27e204;_0x4ab404[_0x705e('0xe')]=intUtil['stripTrailingSlash'](_0x4ab404[_0x705e('0xe')]);_0x4ab404[_0x705e('0x4a')]=intUtil['stripTrailingSlash'](_0x4ab404['serverUrl']);if(_0x496937&&_0x496937[_0x705e('0x6c')]){logger['info']('['+_0x5c2fe8[_0x705e('0x6d')][_0x705e('0x6e')]()+']','Recording\x20is\x20enabled!');_0x5c2fe8[_0x705e('0x4f')]=util[_0x705e('0xc')](_0x705e('0x4d'),_0x4ab404['serverUrl'],_0x5c2fe8[_0x705e('0x4e')],md5(_0x5c2fe8[_0x705e('0x4e')]));}else{_0x5c2fe8['recordingURL']='';}headers[_0x705e('0x50')]=getAuth(_0x4ab404);return getUser(_0x4ab404)[_0x705e('0x1b')](function(_0x37e26a){_0x3bb0be=_0x37e26a;logger[_0x705e('0xa')](_0x705e('0x51'),_0x3bb0be['id']);return getEndUser(_0x4ab404,_0x5c2fe8['calleridname'],_0x5c2fe8['calleridnum']);})[_0x705e('0x1b')](function(_0x33fa12){_0x27e204=_0x33fa12;logger['info'](_0x705e('0x53'),_0x27e204['id']);return getTicket(_0x4ab404,_0x3bb0be,_0x27e204,_0x27b1e7,_0x5c2fe8);})['then'](function(_0x177742){if(_0x177742){logger[_0x705e('0xa')](_0x705e('0x65'),_0x177742['id']);}})[_0x705e('0x5d')](function(_0x180aa6){logger[_0x705e('0x69')]('['+_0x5c2fe8[_0x705e('0x6d')][_0x705e('0x6e')]()+']'+_0x705e('0x6f'),util[_0x705e('0x5f')](_0x180aa6,{'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 a68fd92..3b2f811 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 _0x3d4f=['expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','refresh_token','add','seconds','catch','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','then','isArrayLikeObject','findIndex','users','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','error','The\x20failing\x20result\x20is','enduserType','https://www.zohoapis.','startCase','role','first_name','last_name','data','code','SUCCESS','details','moduleCreate','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','Contacts','Leads','nothing','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Creating\x20new\x20call...','Owner','profile','administrator','Subject','getString','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','mm:ss','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','complete','Call_Result','Answered','rejected','Rejected','abandoned','Abandoned','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','Zoho-oauthtoken\x20','Call\x20created!','err','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','email','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','unmanaged','toUpperCase','lodash','request-promise','md5','util','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','includes','picklist','type','idField','content','variable','variableName','toString','customVariable','Variable','toLowerCase','name','indexOf','split','isNil','isBefore'];(function(_0x2ad008,_0x45c253){var _0x4538cf=function(_0xe143e4){while(--_0xe143e4){_0x2ad008['push'](_0x2ad008['shift']());}};_0x4538cf(++_0x45c253);}(_0x3d4f,0x1bb));var _0xf3d4=function(_0xed01eb,_0x275edb){_0xed01eb=_0xed01eb-0x0;var _0x25b9de=_0x3d4f[_0xed01eb];return _0x25b9de;};'use strict';var _=require(_0xf3d4('0x0'));var rp=require(_0xf3d4('0x1'));var md5=require(_0xf3d4('0x2'));var util=require(_0xf3d4('0x3'));var intUtil=require(_0xf3d4('0x4'));var moment=require('moment');var Redis=require(_0xf3d4('0x5'));var BPromise=require(_0xf3d4('0x6'));var config=require(_0xf3d4('0x7'));var logger=require(_0xf3d4('0x8'))('zoho');config[_0xf3d4('0x9')]=_[_0xf3d4('0xa')](config[_0xf3d4('0x9')],{'host':_0xf3d4('0xb'),'port':0x18eb});var io=require(_0xf3d4('0xc'))(new Redis(config[_0xf3d4('0x9')]));function emit(_0x5ccf61,_0x3ee9f3,_0xfad1ce){io['to'](_0x5ccf61)[_0xf3d4('0xd')](_0x3ee9f3,_0xfad1ce);}function request(_0x321bae){logger[_0xf3d4('0xe')](_0xf3d4('0xf'),JSON[_0xf3d4('0x10')](_0x321bae));return rp(_0x321bae);}function getCustomFields(_0x2e3e4e,_0x238a3c){var _0x3d113e={};if(_0x2e3e4e[_0xf3d4('0x11')]>0x0){_['forEach'](_0x2e3e4e,function(_0x56acd7){if(_[_0xf3d4('0x12')](['string',_0xf3d4('0x13')],_0x56acd7[_0xf3d4('0x14')])&&_0x56acd7[_0xf3d4('0x15')]){_0x3d113e[_0x56acd7[_0xf3d4('0x15')]]=_0x56acd7[_0xf3d4('0x16')]['toString']();}else if(_0x56acd7[_0xf3d4('0x14')]===_0xf3d4('0x17')&&_0x56acd7['variableName']&&_0x56acd7[_0xf3d4('0x15')]&&_0x238a3c[_0x56acd7[_0xf3d4('0x18')]]){_0x3d113e[_0x56acd7[_0xf3d4('0x15')]]=_0x238a3c[_0x56acd7[_0xf3d4('0x18')]][_0xf3d4('0x19')]();}else if(_0x56acd7['type']===_0xf3d4('0x1a')&&_0x56acd7[_0xf3d4('0x1b')]&&_0x56acd7[_0xf3d4('0x1b')]['name']&&_0x56acd7['idField']&&_0x238a3c[_0x56acd7['Variable']['name'][_0xf3d4('0x1c')]()]){_0x3d113e[_0x56acd7[_0xf3d4('0x15')]]=_0x238a3c[_0x56acd7[_0xf3d4('0x1b')][_0xf3d4('0x1d')][_0xf3d4('0x1c')]()][_0xf3d4('0x19')]();}});}return _0x3d113e;}function getName(_0x5e2258){if(_0x5e2258[_0xf3d4('0x1e')]('\x20')>0x0){var _0x4cfcbb=_0x5e2258[_0xf3d4('0x1f')](/ (.+)/);if(_0x4cfcbb[0x1]){return _0x4cfcbb;}}return[_0x5e2258,_0x5e2258];}var accountsTokens={};function getAccessToken(_0x36d2aa){return new Promise(function(_0x4299d4,_0x116274){if(!_[_0xf3d4('0x20')](accountsTokens[_0x36d2aa['id']])&&!_[_0xf3d4('0x20')](accountsTokens[_0x36d2aa['id']]['access_token'])){if(moment()[_0xf3d4('0x21')](accountsTokens[_0x36d2aa['id']][_0xf3d4('0x22')])){_0x4299d4(accountsTokens[_0x36d2aa['id']][_0xf3d4('0x23')]);}}var _0x4028d8;switch(_0x36d2aa[_0xf3d4('0x24')]){case'US':_0x4028d8=_0xf3d4('0x25');break;case'AU':_0x4028d8=_0xf3d4('0x26');break;case'EU':_0x4028d8=_0xf3d4('0x27');break;case'IN':_0x4028d8=_0xf3d4('0x28');break;case'CN':_0x4028d8=_0xf3d4('0x29');break;default:_0x4028d8=_0xf3d4('0x27');break;}var _0x5c67bf={'method':_0xf3d4('0x2a'),'uri':_0x4028d8+_0xf3d4('0x2b'),'qs':{'refresh_token':_0x36d2aa['refreshToken'],'client_id':_0x36d2aa[_0xf3d4('0x2c')],'client_secret':_0x36d2aa['clientSecret'],'grant_type':_0xf3d4('0x2d')},'json':!![]};return rp(_0x5c67bf)['then'](function(_0x3453ac){accountsTokens[_0x36d2aa['id']]={'access_token':_0x3453ac[_0xf3d4('0x23')],'expires_in':moment()[_0xf3d4('0x2e')](_0x3453ac['expires_in'],_0xf3d4('0x2f'))};_0x4299d4(_0x3453ac['access_token']);})[_0xf3d4('0x30')](function(_0x4dcf1e){logger['error'](_0xf3d4('0x31'),_0x4dcf1e[_0xf3d4('0x32')]);_0x116274(_0x4dcf1e);});});}function getUser(_0x178234,_0x9d074c,_0x55cc7e,_0x533393){logger[_0xf3d4('0x33')](_0xf3d4('0x34'));return request({'method':_0xf3d4('0x35'),'uri':util[_0xf3d4('0x36')](_0xf3d4('0x37'),_0x9d074c),'qs':{'type':_0xf3d4('0x38')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x178234},'json':!![]})[_0xf3d4('0x39')](function(_0x1e4798){if(_0x1e4798['users']){var _0x4d4647=-0x1;if(_[_0xf3d4('0x3a')](_0x1e4798['users'])){if(!_[_0xf3d4('0x20')](_0x533393)){_0x4d4647=_[_0xf3d4('0x3b')](_0x1e4798[_0xf3d4('0x3c')],function(_0x4349b9){return _0x4349b9['email']===_0x533393;});}if(_0x4d4647>=0x0){logger[_0xf3d4('0x33')](_0xf3d4('0x3d'));}else{logger[_0xf3d4('0x33')](_0xf3d4('0x3e'));_0x4d4647=_[_0xf3d4('0x3b')](_0x1e4798[_0xf3d4('0x3c')],function(_0x4ae6d3){return _0x4ae6d3['profile'][_0xf3d4('0x1d')]===_0xf3d4('0x3f');});}return _0x1e4798[_0xf3d4('0x3c')][_0x4d4647];}else{if(_0x1e4798['user']['profile']['name']===_0xf3d4('0x3f')){logger['info']('Using\x20the\x20admin\x20account!');user=_0x1e4798[_0xf3d4('0x40')];return user;}else{logger[_0xf3d4('0x41')](_0xf3d4('0x42'),JSON[_0xf3d4('0x10')](_0x1e4798));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x1e4798));}}}else{logger[_0xf3d4('0x41')](_0xf3d4('0x42'),JSON[_0xf3d4('0x10')](_0x1e4798));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x1e4798));}})[_0xf3d4('0x30')](function(_0x500dfd){console[_0xf3d4('0x41')](_0x500dfd);});}function getZohoUser(_0x4147ed,_0x1d3c6d){return new BPromise(function(_0x5cd8c7,_0xcceb7f){request(_0x4147ed)['then'](function(_0x9e0eab){var _0x48d2e9=null;if(_0x9e0eab){_0x48d2e9=_0x9e0eab['data'][0x0];_0x48d2e9[_0xf3d4('0x43')]=_0x1d3c6d;}_0x5cd8c7(_0x48d2e9);})[_0xf3d4('0x30')](function(_0x9a2779){_0xcceb7f(_0x9a2779);});});}function createEndUser(_0x1ce9a6,_0x3f8954,_0x44496c,_0x2201a5,_0x566137,_0x493dde){var _0x44496c=getName(_0x44496c);return request({'method':'POST','uri':_0xf3d4('0x44')+_0x3f8954+'/crm/v2/'+_[_0xf3d4('0x45')](_0x493dde['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x44496c[0x1],'First_Name':_0x44496c[0x0],'Phone':_0x2201a5,'Owner':{'name':!_['isNil'](_0x566137['role'][_0xf3d4('0x1d')])?_0x566137[_0xf3d4('0x46')][_0xf3d4('0x1d')]:!_[_0xf3d4('0x20')](_0x566137[_0xf3d4('0x47')])?_0x566137[_0xf3d4('0x47')]+'\x20'+_0x566137['last_name']:_0x566137[_0xf3d4('0x48')],'id':_0x566137['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1ce9a6},'json':!![]})[_0xf3d4('0x39')](function(_0x426c32){if(_0x426c32&&_0x426c32[_0xf3d4('0x49')][0x0][_0xf3d4('0x4a')]===_0xf3d4('0x4b')){var _0x1b1875=_0x426c32[_0xf3d4('0x49')][0x0][_0xf3d4('0x4c')];_0x1b1875[_0xf3d4('0x43')]=_[_0xf3d4('0x45')](_0x493dde[_0xf3d4('0x4d')])+'s';return _0x1b1875;}logger[_0xf3d4('0x41')](_0xf3d4('0x42'),JSON['stringify'](data));throw new Error(_0xf3d4('0x4e')+JSON[_0xf3d4('0x10')](data));})['catch'](function(_0x236aa7){console[_0xf3d4('0x4f')](_0xf3d4('0x50'),_0x236aa7);});}function getEndUser(_0x389ae4,_0x3f2ce9,_0x37e25f,_0x5a703d,_0x55751c,_0x31ab2a,_0x1c90a0){var _0x3d8fd1={'method':'GET','uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x389ae4},'json':!![]};switch(_0x1c90a0['moduleSearch']){case _0xf3d4('0x51'):_0x3d8fd1[_0xf3d4('0x52')]=_0xf3d4('0x44')+_0x3f2ce9+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x55751c+'))';return getZohoUser(_0x3d8fd1,_0xf3d4('0x53'))[_0xf3d4('0x39')](function(_0x158466){if(_0x158466)return _0x158466;_0x3d8fd1[_0xf3d4('0x52')]=_0xf3d4('0x44')+_0x3f2ce9+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x55751c+'))';return getZohoUser(_0x3d8fd1,_0xf3d4('0x54'))[_0xf3d4('0x39')](function(_0x5749c9){if(_0x5749c9)return _0x5749c9;if(_0x1c90a0['moduleCreate']!=_0xf3d4('0x55')){return createEndUser(_0x389ae4,_0x3f2ce9,_0x5a703d,_0x55751c,_0x31ab2a,_0x1c90a0);}else{return{};}});});break;case'contact':_0x3d8fd1[_0xf3d4('0x52')]='https://www.zohoapis.'+_0x3f2ce9+_0xf3d4('0x56')+_0x55751c+'))';return getZohoUser(_0x3d8fd1,_0xf3d4('0x53'))[_0xf3d4('0x39')](function(_0x40c2a0){if(_0x40c2a0)return _0x40c2a0;if(_0x1c90a0[_0xf3d4('0x4d')]!=_0xf3d4('0x55')){return createEndUser(_0x389ae4,_0x3f2ce9,_0x5a703d,_0x55751c,_0x31ab2a,_0x1c90a0);}else{return{};}});break;case _0xf3d4('0x57'):_0x3d8fd1[_0xf3d4('0x52')]=_0xf3d4('0x44')+_0x3f2ce9+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x55751c+'))';return getZohoUser(_0x3d8fd1,'Leads')[_0xf3d4('0x39')](function(_0x383188){if(_0x383188)return _0x383188;if(_0x1c90a0[_0xf3d4('0x4d')]!=_0xf3d4('0x55')){return createEndUser(_0x389ae4,_0x3f2ce9,_0x5a703d,_0x55751c,_0x31ab2a,_0x1c90a0);}else{return{};}});break;}}function getCall(_0x59c80d,_0x1e6604,_0x1b2fd4,_0x235544,_0x55bbd5,_0xe6cab9,_0x2b1973,_0x3ea74b){logger[_0xf3d4('0x33')](_0xf3d4('0x58'));var _0x16a468={};_0x16a468[_0xf3d4('0x59')]={'name':!_[_0xf3d4('0x20')](_0x235544[_0xf3d4('0x46')][_0xf3d4('0x1d')])&&!_[_0xf3d4('0x20')](_0x235544['profile'][_0xf3d4('0x1d')])&&_0x235544[_0xf3d4('0x5a')][_0xf3d4('0x1d')]===_0xf3d4('0x5b')?_0x235544[_0xf3d4('0x46')]['name']:!_[_0xf3d4('0x20')](_0x235544[_0xf3d4('0x47')])?_0x235544[_0xf3d4('0x47')]+'\x20'+_0x235544[_0xf3d4('0x48')]:_0x235544['last_name'],'id':_0x235544['id']};_0x16a468[_0xf3d4('0x5c')]=intUtil[_0xf3d4('0x5d')](_0xe6cab9['Subjects'],_0x2b1973,'\x20');_0x16a468[_0xf3d4('0x5e')]=intUtil[_0xf3d4('0x5d')](_0xe6cab9[_0xf3d4('0x5f')],_0x2b1973,'\x0a');if(_0x55bbd5[_0xf3d4('0x43')]===_0xf3d4('0x53')){_0x16a468[_0xf3d4('0x60')]={'name':!_['isNil'](_0x55bbd5['Full_Name'])?_0x55bbd5[_0xf3d4('0x61')]:!_[_0xf3d4('0x20')](_0x55bbd5[_0xf3d4('0x62')])?_0x55bbd5[_0xf3d4('0x62')]+'\x20'+_0x55bbd5['Last_Name']:_0x55bbd5[_0xf3d4('0x63')],'id':_0x55bbd5['id']};}if(_0x55bbd5['enduserType']===_0xf3d4('0x54')){_0x16a468[_0xf3d4('0x64')]={'name':!_[_0xf3d4('0x20')](_0x55bbd5[_0xf3d4('0x61')])?_0x55bbd5[_0xf3d4('0x61')]:!_[_0xf3d4('0x20')](_0x55bbd5[_0xf3d4('0x62')])?_0x55bbd5['First_Name']+'\x20'+_0x55bbd5['Last_Name']:_0x55bbd5[_0xf3d4('0x63')],'id':_0x55bbd5['id']};_0x16a468[_0xf3d4('0x65')]=_['startCase'](_0x55bbd5[_0xf3d4('0x43')]);}if(_0x2b1973[_0xf3d4('0x66')]){_0x16a468['Call_Duration']=moment[_0xf3d4('0x67')](parseInt(_0x2b1973['talktime'])*0x3e8)[_0xf3d4('0x36')](_0xf3d4('0x68'));}else if(_0x2b1973[_0xf3d4('0x69')]&&_0x2b1973[_0xf3d4('0x6a')]){_0x16a468[_0xf3d4('0x6b')]=moment[_0xf3d4('0x67')](moment(_0x2b1973[_0xf3d4('0x6a')],_0xf3d4('0x6c'))[_0xf3d4('0x6d')](moment(_0x2b1973[_0xf3d4('0x6e')],_0xf3d4('0x6c'))))[_0xf3d4('0x36')]('mm:ss');}switch(_0x2b1973[_0xf3d4('0x6f')]){case _0xf3d4('0x70'):_0x16a468['Call_Result']='Called';break;case _0xf3d4('0x71'):case'connect':_0x16a468[_0xf3d4('0x72')]=_0xf3d4('0x73');break;case _0xf3d4('0x74'):_0x16a468[_0xf3d4('0x72')]=_0xf3d4('0x75');break;case _0xf3d4('0x76'):_0x16a468[_0xf3d4('0x72')]=_0xf3d4('0x77');break;case'timeout':_0x16a468[_0xf3d4('0x72')]=_0xf3d4('0x78');default:}_0x16a468[_0xf3d4('0x79')]=(_0x3ea74b===_0xf3d4('0x7a')?moment(_0x2b1973['starttime'])[_0xf3d4('0x36')](_0xf3d4('0x6c')):moment(_0x2b1973['agentcalledAt'])['format'](_0xf3d4('0x6c')))||moment()[_0xf3d4('0x36')]('YYYY-MM-DDTHH:mm:ss');_0x16a468[_0xf3d4('0x7b')]=_0x3ea74b||_0xf3d4('0x7c');_0x16a468=_[_0xf3d4('0x7d')](_0x16a468,getCustomFields(_0xe6cab9['Fields'],_0x2b1973));return request({'method':_0xf3d4('0x2a'),'uri':_0xf3d4('0x44')+_0x1e6604+'/crm/v2/Calls','headers':{'Authorization':_0xf3d4('0x7e')+_0x59c80d},'body':{'data':[_0x16a468]},'json':!![]})[_0xf3d4('0x39')](function(_0x52fa28){if(_0x52fa28&&_0x52fa28[_0xf3d4('0x49')][0x0][_0xf3d4('0x4a')]===_0xf3d4('0x4b')){logger[_0xf3d4('0x33')](_0xf3d4('0x7f'));return{'id':_0x52fa28['data'][0x0][_0xf3d4('0x4c')]['id']};}})['catch'](function(_0x5324c0){logger[_0xf3d4('0x33')](_0xf3d4('0x80'),_0x5324c0[_0xf3d4('0x32')]);console[_0xf3d4('0x4f')]('err',_0x5324c0);});}exports['queue']=function(_0x2ac5d7,_0x4dd9b5,_0x13cd68,_0x56ef13,_0x2df095,_0x24dfb0){var _0x36437a,_0x3d7f81,_0x4219e8;_0x24dfb0['host']=intUtil[_0xf3d4('0x81')](_0x24dfb0[_0xf3d4('0x82')]);_0x24dfb0['serverUrl']=intUtil[_0xf3d4('0x81')](_0x24dfb0[_0xf3d4('0x83')]);if(_0x2df095&&_0x2df095[_0xf3d4('0x84')]){logger[_0xf3d4('0x33')](_0xf3d4('0x85'),'Recording\x20is\x20enabled!');_0x4dd9b5[_0xf3d4('0x86')]=_0x24dfb0[_0xf3d4('0x83')]+_0xf3d4('0x87')+_0x4dd9b5[_0xf3d4('0x88')]+_0xf3d4('0x89')+md5(_0x4dd9b5[_0xf3d4('0x88')]);}else{_0x4dd9b5[_0xf3d4('0x86')]='';}var _0x69ff84=_0x24dfb0['host']===_0xf3d4('0x8a')?'eu':_0xf3d4('0x8b');return getAccessToken(_0x24dfb0)[_0xf3d4('0x39')](function(_0x1c02e9){_0x4219e8=_0x1c02e9;return getUser(_0x4219e8,_0x69ff84,_0x24dfb0,_0x56ef13['email']);})[_0xf3d4('0x39')](function(_0x21f25f){_0x36437a=_0x21f25f;logger[_0xf3d4('0x33')](_0xf3d4('0x8c'),_0x36437a['id']);return getEndUser(_0x4219e8,_0x69ff84,_0x24dfb0,_0x4dd9b5[_0xf3d4('0x8d')],_0x4dd9b5[_0xf3d4('0x8e')],_0x36437a,_0x13cd68);})[_0xf3d4('0x39')](function(_0x4839d3){_0x3d7f81=_0x4839d3;return getCall(_0x4219e8,_0x69ff84,_0x24dfb0,_0x36437a,_0x3d7f81,_0x13cd68,_0x4dd9b5,_0xf3d4('0x7c'));})[_0xf3d4('0x39')](function(_0x41a6ed){if(_0x41a6ed){logger[_0xf3d4('0x33')]('The\x20Call\x20ID\x20is:',_0x41a6ed['id']);logger['info'](_0xf3d4('0x85'),_0xf3d4('0x8f'));emit(util[_0xf3d4('0x36')](_0xf3d4('0x90'),_0x56ef13['name']),_0xf3d4('0x91'),{'uri':_0xf3d4('0x92')+_0x24dfb0[_0xf3d4('0x82')]+_0xf3d4('0x93')+_0x41a6ed['id']});}})[_0xf3d4('0x30')](function(_0x3bb274){logger[_0xf3d4('0x41')](_0xf3d4('0x85'),JSON['stringify'](_0x3bb274));});};exports['outbound']=function(_0x93ac44,_0x31de36,_0x544388,_0x3d7a42,_0x126667,_0x4055df,_0x4dd599){var _0x102339,_0x59d2f1,_0x183494;_0x4055df[_0xf3d4('0x82')]=intUtil[_0xf3d4('0x81')](_0x4055df[_0xf3d4('0x82')]);_0x4055df['serverUrl']=intUtil[_0xf3d4('0x81')](_0x4055df['serverUrl']);if(_0x4dd599&&_0x4dd599['recordingFormat']&&_0x4dd599[_0xf3d4('0x94')]!==_0xf3d4('0x95')){logger[_0xf3d4('0x33')](_0xf3d4('0x96'),_0xf3d4('0x97'));_0x31de36[_0xf3d4('0x86')]=_0x4055df['serverUrl']+_0xf3d4('0x87')+_0x31de36['uniqueid']+_0xf3d4('0x89')+md5(_0x31de36[_0xf3d4('0x88')]);}var _0x3955e2=_0x4055df[_0xf3d4('0x82')]==='zoho.eu'?'eu':_0xf3d4('0x8b');return getAccessToken(_0x4055df)['then'](function(_0x5ed975){_0x183494=_0x5ed975;return getUser(_0x183494,_0x3955e2,_0x4055df,_0x3d7a42[_0xf3d4('0x98')]);})['then'](function(_0x11fa44){_0x102339=_0x11fa44;logger[_0xf3d4('0x33')](_0xf3d4('0x8c'),_0x102339['id']);return getEndUser(_0x183494,_0x3955e2,_0x4055df,_0x31de36[_0xf3d4('0x99')],_0x31de36[_0xf3d4('0x9a')],_0x102339,_0x544388);})[_0xf3d4('0x39')](function(_0x1f8fd6){_0x59d2f1=_0x1f8fd6;return getCall(_0x183494,_0x3955e2,_0x4055df,_0x102339,_0x59d2f1,_0x544388,_0x31de36,_0xf3d4('0x9b'));})[_0xf3d4('0x39')](function(_0x39393c){if(_0x39393c){logger[_0xf3d4('0x33')](_0xf3d4('0x9c'),_0x39393c['id']);logger[_0xf3d4('0x33')](_0xf3d4('0x96'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xf3d4('0x90'),_0x3d7a42[_0xf3d4('0x1d')]),_0xf3d4('0x91'),{'uri':'https://crm.'+_0x4055df['host']+_0xf3d4('0x93')+_0x39393c['id']});}})['catch'](function(_0x5355cc){logger[_0xf3d4('0x41')]('[OUTBOUND]',JSON[_0xf3d4('0x10')](_0x5355cc));});};exports[_0xf3d4('0x9d')]=function(_0x28c97b,_0x524bcd,_0x50959e,_0xdea049,_0x27702c,_0x2aeae8){var _0x4db509,_0x443b91,_0x36bde8;_0x2aeae8[_0xf3d4('0x82')]=intUtil[_0xf3d4('0x81')](_0x2aeae8[_0xf3d4('0x82')]);_0x2aeae8[_0xf3d4('0x83')]=intUtil['stripTrailingSlash'](_0x2aeae8[_0xf3d4('0x83')]);if(_0x27702c&&_0x27702c['monitor_format']){logger[_0xf3d4('0x33')]('['+_0x524bcd[_0xf3d4('0x6f')][_0xf3d4('0x9e')]()+']',_0xf3d4('0x97'));_0x524bcd[_0xf3d4('0x86')]=_0x2aeae8['serverUrl']+_0xf3d4('0x87')+_0x524bcd[_0xf3d4('0x88')]+_0xf3d4('0x89')+md5(_0x524bcd[_0xf3d4('0x88')]);}else{_0x524bcd[_0xf3d4('0x86')]='';}var _0x427427=_0x2aeae8['host']===_0xf3d4('0x8a')?'eu':_0xf3d4('0x8b');return getAccessToken(_0x2aeae8)[_0xf3d4('0x39')](function(_0x1f6e6b){_0x36bde8=_0x1f6e6b;return getUser(_0x36bde8,_0x427427,_0x2aeae8);})[_0xf3d4('0x39')](function(_0x144bfa){_0x4db509=_0x144bfa;logger[_0xf3d4('0x33')](_0xf3d4('0x8c'),_0x4db509['id']);return getEndUser(_0x36bde8,_0x427427,_0x2aeae8,_0x524bcd['calleridname'],_0x524bcd[_0xf3d4('0x8e')],_0x4db509,_0x50959e);})['then'](function(_0x5621ba){_0x443b91=_0x5621ba;return getCall(_0x36bde8,_0x427427,_0x2aeae8,_0x4db509,_0x443b91,_0x50959e,_0x524bcd,_0xf3d4('0x7c'));})[_0xf3d4('0x39')](function(_0x10bc25){if(_0x10bc25){logger[_0xf3d4('0x33')]('The\x20Call\x20ID\x20is:',_0x10bc25['id']);}})[_0xf3d4('0x30')](function(_0xf6c5ca){logger[_0xf3d4('0x41')]('['+_0x524bcd[_0xf3d4('0x6f')][_0xf3d4('0x9e')]()+']',JSON[_0xf3d4('0x10')](_0xf6c5ca));});}; \ No newline at end of file +var _0x4c63=['Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','first_name','last_name','code','details','log','CREATE\x20ERROR','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...','role','administrator','Subject','getString','Descriptions','enduserType','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','answertime','endtime','YYYY-MM-DDTHH:mm:ss','starttime','mm:ss','lastevent','called','Call_Result','complete','rejected','abandoned','Abandoned','Timeout','Call_Start_Time','outbound','agentcalledAt','Inbound','merge','Fields','SUCCESS','Call\x20created!','err','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','destcalleridname','Outbound','unmanaged','toUpperCase','lodash','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','[HTTP]','stringify','includes','picklist','type','idField','content','variableName','customVariable','Variable','name','toLowerCase','toString','indexOf','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','isNil','findIndex','email','Agent\x20found!','info'];(function(_0x3e19f2,_0x263ac8){var _0x57ad87=function(_0x47b811){while(--_0x47b811){_0x3e19f2['push'](_0x3e19f2['shift']());}};_0x57ad87(++_0x263ac8);}(_0x4c63,0xf2));var _0x34c6=function(_0x36b3aa,_0x3096d7){_0x36b3aa=_0x36b3aa-0x0;var _0x829dd3=_0x4c63[_0x36b3aa];return _0x829dd3;};'use strict';var _=require(_0x34c6('0x0'));var rp=require('request-promise');var md5=require(_0x34c6('0x1'));var util=require(_0x34c6('0x2'));var intUtil=require(_0x34c6('0x3'));var moment=require(_0x34c6('0x4'));var Redis=require(_0x34c6('0x5'));var BPromise=require(_0x34c6('0x6'));var config=require(_0x34c6('0x7'));var logger=require(_0x34c6('0x8'))(_0x34c6('0x9'));config[_0x34c6('0xa')]=_[_0x34c6('0xb')](config[_0x34c6('0xa')],{'host':_0x34c6('0xc'),'port':0x18eb});var io=require(_0x34c6('0xd'))(new Redis(config['redis']));function emit(_0x46883f,_0x5a7c20,_0x129fb1){io['to'](_0x46883f)['emit'](_0x5a7c20,_0x129fb1);}function request(_0x3f2790){logger['debug'](_0x34c6('0xe'),JSON[_0x34c6('0xf')](_0x3f2790));return rp(_0x3f2790);}function getCustomFields(_0x435bc3,_0x5d0de1){var _0x4b8283={};if(_0x435bc3['length']>0x0){_['forEach'](_0x435bc3,function(_0x15a40b){if(_[_0x34c6('0x10')](['string',_0x34c6('0x11')],_0x15a40b[_0x34c6('0x12')])&&_0x15a40b['idField']){_0x4b8283[_0x15a40b[_0x34c6('0x13')]]=_0x15a40b[_0x34c6('0x14')]['toString']();}else if(_0x15a40b[_0x34c6('0x12')]==='variable'&&_0x15a40b['variableName']&&_0x15a40b[_0x34c6('0x13')]&&_0x5d0de1[_0x15a40b[_0x34c6('0x15')]]){_0x4b8283[_0x15a40b['idField']]=_0x5d0de1[_0x15a40b['variableName']]['toString']();}else if(_0x15a40b['type']===_0x34c6('0x16')&&_0x15a40b[_0x34c6('0x17')]&&_0x15a40b[_0x34c6('0x17')][_0x34c6('0x18')]&&_0x15a40b['idField']&&_0x5d0de1[_0x15a40b[_0x34c6('0x17')]['name'][_0x34c6('0x19')]()]){_0x4b8283[_0x15a40b[_0x34c6('0x13')]]=_0x5d0de1[_0x15a40b[_0x34c6('0x17')][_0x34c6('0x18')][_0x34c6('0x19')]()][_0x34c6('0x1a')]();}});}return _0x4b8283;}function getName(_0x5fe241){if(_0x5fe241[_0x34c6('0x1b')]('\x20')>0x0){var _0x19fb24=_0x5fe241['split'](/ (.+)/);if(_0x19fb24[0x1]){return _0x19fb24;}}return[_0x5fe241,_0x5fe241];}var accountsTokens={};function getAccessToken(_0x37e6d9){return new Promise(function(_0x42a868,_0x108624){if(!_['isNil'](accountsTokens[_0x37e6d9['id']])&&!_['isNil'](accountsTokens[_0x37e6d9['id']][_0x34c6('0x1c')])){if(moment()[_0x34c6('0x1d')](accountsTokens[_0x37e6d9['id']][_0x34c6('0x1e')])){_0x42a868(accountsTokens[_0x37e6d9['id']][_0x34c6('0x1c')]);}}var _0x4db037;switch(_0x37e6d9[_0x34c6('0x1f')]){case'US':_0x4db037=_0x34c6('0x20');break;case'AU':_0x4db037=_0x34c6('0x21');break;case'EU':_0x4db037=_0x34c6('0x22');break;case'IN':_0x4db037=_0x34c6('0x23');break;case'CN':_0x4db037=_0x34c6('0x24');break;default:_0x4db037=_0x34c6('0x22');break;}var _0xbecf4b={'method':_0x34c6('0x25'),'uri':_0x4db037+'/oauth/v2/token','qs':{'refresh_token':_0x37e6d9[_0x34c6('0x26')],'client_id':_0x37e6d9[_0x34c6('0x27')],'client_secret':_0x37e6d9[_0x34c6('0x28')],'grant_type':'refresh_token'},'json':!![]};return rp(_0xbecf4b)['then'](function(_0x109b9f){accountsTokens[_0x37e6d9['id']]={'access_token':_0x109b9f[_0x34c6('0x1c')],'expires_in':moment()[_0x34c6('0x29')](_0x109b9f[_0x34c6('0x1e')],_0x34c6('0x2a'))};_0x42a868(_0x109b9f['access_token']);})[_0x34c6('0x2b')](function(_0x16603c){logger[_0x34c6('0x2c')](_0x34c6('0x2d'),_0x16603c[_0x34c6('0x2e')]);_0x108624(_0x16603c);});});}function getUser(_0x4ecf64,_0x5fd795,_0x4d77fc,_0x49d09f){logger['info']('Search\x20user');return request({'method':_0x34c6('0x2f'),'uri':util[_0x34c6('0x30')](_0x34c6('0x31'),_0x5fd795),'qs':{'type':_0x34c6('0x32')},'headers':{'Authorization':_0x34c6('0x33')+_0x4ecf64},'json':!![]})[_0x34c6('0x34')](function(_0x438ef3){if(_0x438ef3[_0x34c6('0x35')]){var _0x4a1058=-0x1;if(_[_0x34c6('0x36')](_0x438ef3[_0x34c6('0x35')])){if(!_[_0x34c6('0x37')](_0x49d09f)){_0x4a1058=_[_0x34c6('0x38')](_0x438ef3[_0x34c6('0x35')],function(_0x2b8b92){return _0x2b8b92[_0x34c6('0x39')]===_0x49d09f;});}if(_0x4a1058>=0x0){logger['info'](_0x34c6('0x3a'));}else{logger[_0x34c6('0x3b')](_0x34c6('0x3c'));_0x4a1058=_[_0x34c6('0x38')](_0x438ef3[_0x34c6('0x35')],function(_0x157059){return _0x157059[_0x34c6('0x3d')]['name']===_0x34c6('0x3e');});}return _0x438ef3['users'][_0x4a1058];}else{if(_0x438ef3[_0x34c6('0x3f')][_0x34c6('0x3d')][_0x34c6('0x18')]===_0x34c6('0x3e')){logger[_0x34c6('0x3b')]('Using\x20the\x20admin\x20account!');user=_0x438ef3['user'];return user;}else{logger['error'](_0x34c6('0x40'),JSON[_0x34c6('0xf')](_0x438ef3));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x34c6('0xf')](_0x438ef3));}}}else{logger[_0x34c6('0x2c')](_0x34c6('0x40'),JSON[_0x34c6('0xf')](_0x438ef3));throw new Error(_0x34c6('0x41')+JSON[_0x34c6('0xf')](_0x438ef3));}})[_0x34c6('0x2b')](function(_0x21cf75){console[_0x34c6('0x2c')](_0x21cf75);});}function getZohoUser(_0x8b93fb,_0x45bdf8){return new BPromise(function(_0x29387a,_0x13ce85){request(_0x8b93fb)['then'](function(_0x36511d){var _0x2ccca6=null;if(_0x36511d){_0x2ccca6=_0x36511d[_0x34c6('0x42')][0x0];_0x2ccca6['enduserType']=_0x45bdf8;}_0x29387a(_0x2ccca6);})[_0x34c6('0x2b')](function(_0x178af2){_0x13ce85(_0x178af2);});});}function createEndUser(_0x562b98,_0x3016e8,_0x1c7048,_0x653c4e,_0x52c007,_0x2ac58c){var _0x1c7048=getName(_0x1c7048);return request({'method':'POST','uri':_0x34c6('0x43')+_0x3016e8+_0x34c6('0x44')+_[_0x34c6('0x45')](_0x2ac58c[_0x34c6('0x46')])+'s','body':{'data':[{'Last_Name':_0x1c7048[0x1],'First_Name':_0x1c7048[0x0],'Phone':_0x653c4e,'Owner':{'name':!_[_0x34c6('0x37')](_0x52c007['role'][_0x34c6('0x18')])?_0x52c007['role'][_0x34c6('0x18')]:!_['isNil'](_0x52c007['first_name'])?_0x52c007[_0x34c6('0x47')]+'\x20'+_0x52c007[_0x34c6('0x48')]:_0x52c007['last_name'],'id':_0x52c007['id']}}]},'headers':{'Authorization':_0x34c6('0x33')+_0x562b98},'json':!![]})[_0x34c6('0x34')](function(_0xd4bb6c){if(_0xd4bb6c&&_0xd4bb6c[_0x34c6('0x42')][0x0][_0x34c6('0x49')]==='SUCCESS'){var _0x339760=_0xd4bb6c[_0x34c6('0x42')][0x0][_0x34c6('0x4a')];_0x339760['enduserType']=_[_0x34c6('0x45')](_0x2ac58c[_0x34c6('0x46')])+'s';return _0x339760;}logger[_0x34c6('0x2c')](_0x34c6('0x40'),JSON['stringify'](data));throw new Error('Error:\x20'+JSON['stringify'](data));})[_0x34c6('0x2b')](function(_0xbf8f21){console[_0x34c6('0x4b')](_0x34c6('0x4c'),_0xbf8f21);});}function getEndUser(_0x4b3b53,_0x96a145,_0x2e770d,_0x2160fd,_0x847dde,_0x269cc3,_0x1aed60){var _0x1abd97={'method':_0x34c6('0x2f'),'uri':'','headers':{'Authorization':_0x34c6('0x33')+_0x4b3b53},'json':!![]};switch(_0x1aed60['moduleSearch']){case _0x34c6('0x4d'):_0x1abd97[_0x34c6('0x4e')]=_0x34c6('0x43')+_0x96a145+_0x34c6('0x4f')+_0x847dde+'))';return getZohoUser(_0x1abd97,_0x34c6('0x50'))['then'](function(_0x2100a1){if(_0x2100a1)return _0x2100a1;_0x1abd97[_0x34c6('0x4e')]='https://www.zohoapis.'+_0x96a145+_0x34c6('0x51')+_0x847dde+'))';return getZohoUser(_0x1abd97,_0x34c6('0x52'))['then'](function(_0x4ec94a){if(_0x4ec94a)return _0x4ec94a;if(_0x1aed60['moduleCreate']!=_0x34c6('0x53')){return createEndUser(_0x4b3b53,_0x96a145,_0x2160fd,_0x847dde,_0x269cc3,_0x1aed60);}else{return{};}});});break;case _0x34c6('0x54'):_0x1abd97[_0x34c6('0x4e')]='https://www.zohoapis.'+_0x96a145+_0x34c6('0x4f')+_0x847dde+'))';return getZohoUser(_0x1abd97,_0x34c6('0x50'))[_0x34c6('0x34')](function(_0x5f2524){if(_0x5f2524)return _0x5f2524;if(_0x1aed60[_0x34c6('0x46')]!=_0x34c6('0x53')){return createEndUser(_0x4b3b53,_0x96a145,_0x2160fd,_0x847dde,_0x269cc3,_0x1aed60);}else{return{};}});break;case _0x34c6('0x55'):_0x1abd97[_0x34c6('0x4e')]=_0x34c6('0x43')+_0x96a145+_0x34c6('0x51')+_0x847dde+'))';return getZohoUser(_0x1abd97,'Leads')[_0x34c6('0x34')](function(_0x411286){if(_0x411286)return _0x411286;if(_0x1aed60[_0x34c6('0x46')]!='nothing'){return createEndUser(_0x4b3b53,_0x96a145,_0x2160fd,_0x847dde,_0x269cc3,_0x1aed60);}else{return{};}});break;}}function getCall(_0x1eda18,_0x19a9a4,_0x56ce3b,_0x1b8377,_0x5d3c61,_0x503ab0,_0x47ec46,_0x158a8a){logger['info'](_0x34c6('0x56'));var _0x187cfc={};_0x187cfc['Owner']={'name':!_[_0x34c6('0x37')](_0x1b8377[_0x34c6('0x57')][_0x34c6('0x18')])&&!_[_0x34c6('0x37')](_0x1b8377['profile'][_0x34c6('0x18')])&&_0x1b8377[_0x34c6('0x3d')][_0x34c6('0x18')]===_0x34c6('0x58')?_0x1b8377[_0x34c6('0x57')][_0x34c6('0x18')]:!_[_0x34c6('0x37')](_0x1b8377['first_name'])?_0x1b8377[_0x34c6('0x47')]+'\x20'+_0x1b8377[_0x34c6('0x48')]:_0x1b8377[_0x34c6('0x48')],'id':_0x1b8377['id']};_0x187cfc[_0x34c6('0x59')]=intUtil[_0x34c6('0x5a')](_0x503ab0['Subjects'],_0x47ec46,'\x20');_0x187cfc['Description']=intUtil['getString'](_0x503ab0[_0x34c6('0x5b')],_0x47ec46,'\x0a');if(_0x5d3c61[_0x34c6('0x5c')]===_0x34c6('0x50')){_0x187cfc[_0x34c6('0x5d')]={'name':!_[_0x34c6('0x37')](_0x5d3c61['Full_Name'])?_0x5d3c61[_0x34c6('0x5e')]:!_['isNil'](_0x5d3c61[_0x34c6('0x5f')])?_0x5d3c61[_0x34c6('0x5f')]+'\x20'+_0x5d3c61[_0x34c6('0x60')]:_0x5d3c61['Last_Name'],'id':_0x5d3c61['id']};}if(_0x5d3c61[_0x34c6('0x5c')]==='Leads'){_0x187cfc[_0x34c6('0x61')]={'name':!_[_0x34c6('0x37')](_0x5d3c61[_0x34c6('0x5e')])?_0x5d3c61[_0x34c6('0x5e')]:!_[_0x34c6('0x37')](_0x5d3c61[_0x34c6('0x5f')])?_0x5d3c61['First_Name']+'\x20'+_0x5d3c61[_0x34c6('0x60')]:_0x5d3c61[_0x34c6('0x60')],'id':_0x5d3c61['id']};_0x187cfc[_0x34c6('0x62')]=_[_0x34c6('0x45')](_0x5d3c61['enduserType']);}if(_0x47ec46['talktime']){_0x187cfc[_0x34c6('0x63')]=moment[_0x34c6('0x64')](parseInt(_0x47ec46['talktime'])*0x3e8)[_0x34c6('0x30')]('mm:ss');}else if(_0x47ec46[_0x34c6('0x65')]&&_0x47ec46[_0x34c6('0x66')]){_0x187cfc[_0x34c6('0x63')]=moment[_0x34c6('0x64')](moment(_0x47ec46[_0x34c6('0x66')],_0x34c6('0x67'))['diff'](moment(_0x47ec46[_0x34c6('0x68')],_0x34c6('0x67'))))[_0x34c6('0x30')](_0x34c6('0x69'));}switch(_0x47ec46[_0x34c6('0x6a')]){case _0x34c6('0x6b'):_0x187cfc[_0x34c6('0x6c')]='Called';break;case _0x34c6('0x6d'):case'connect':_0x187cfc[_0x34c6('0x6c')]='Answered';break;case _0x34c6('0x6e'):_0x187cfc[_0x34c6('0x6c')]='Rejected';break;case _0x34c6('0x6f'):_0x187cfc[_0x34c6('0x6c')]=_0x34c6('0x70');break;case'timeout':_0x187cfc[_0x34c6('0x6c')]=_0x34c6('0x71');default:}_0x187cfc[_0x34c6('0x72')]=(_0x158a8a===_0x34c6('0x73')?moment(_0x47ec46[_0x34c6('0x68')])[_0x34c6('0x30')](_0x34c6('0x67')):moment(_0x47ec46[_0x34c6('0x74')])[_0x34c6('0x30')](_0x34c6('0x67')))||moment()[_0x34c6('0x30')]('YYYY-MM-DDTHH:mm:ss');_0x187cfc['Call_Type']=_0x158a8a||_0x34c6('0x75');_0x187cfc=_[_0x34c6('0x76')](_0x187cfc,getCustomFields(_0x503ab0[_0x34c6('0x77')],_0x47ec46));return request({'method':_0x34c6('0x25'),'uri':_0x34c6('0x43')+_0x19a9a4+'/crm/v2/Calls','headers':{'Authorization':_0x34c6('0x33')+_0x1eda18},'body':{'data':[_0x187cfc]},'json':!![]})[_0x34c6('0x34')](function(_0x4dbc25){if(_0x4dbc25&&_0x4dbc25[_0x34c6('0x42')][0x0][_0x34c6('0x49')]===_0x34c6('0x78')){logger['info'](_0x34c6('0x79'));return{'id':_0x4dbc25[_0x34c6('0x42')][0x0][_0x34c6('0x4a')]['id']};}})[_0x34c6('0x2b')](function(_0x4d2e32){logger[_0x34c6('0x3b')](_0x34c6('0x7a'),_0x4d2e32['stack']);console['log'](_0x34c6('0x7a'),_0x4d2e32);});}exports['queue']=function(_0x553e57,_0x4e567d,_0xded031,_0x50f044,_0x84a85d,_0x50aff4){var _0x42a8ad,_0x266453,_0x10ac61;_0x50aff4[_0x34c6('0x7b')]=intUtil[_0x34c6('0x7c')](_0x50aff4[_0x34c6('0x7b')]);_0x50aff4['serverUrl']=intUtil['stripTrailingSlash'](_0x50aff4[_0x34c6('0x7d')]);if(_0x84a85d&&_0x84a85d[_0x34c6('0x7e')]){logger[_0x34c6('0x3b')]('[QUEUE]',_0x34c6('0x7f'));_0x4e567d[_0x34c6('0x80')]=_0x50aff4[_0x34c6('0x7d')]+_0x34c6('0x81')+_0x4e567d[_0x34c6('0x82')]+_0x34c6('0x83')+md5(_0x4e567d[_0x34c6('0x82')]);}else{_0x4e567d['recordingURL']='';}var _0x41731f=_0x50aff4['host']===_0x34c6('0x84')?'eu':_0x34c6('0x85');return getAccessToken(_0x50aff4)[_0x34c6('0x34')](function(_0x1f1fe0){_0x10ac61=_0x1f1fe0;return getUser(_0x10ac61,_0x41731f,_0x50aff4,_0x50f044[_0x34c6('0x39')]);})[_0x34c6('0x34')](function(_0x45b6b5){_0x42a8ad=_0x45b6b5;logger[_0x34c6('0x3b')](_0x34c6('0x86'),_0x42a8ad['id']);return getEndUser(_0x10ac61,_0x41731f,_0x50aff4,_0x4e567d[_0x34c6('0x87')],_0x4e567d[_0x34c6('0x88')],_0x42a8ad,_0xded031);})[_0x34c6('0x34')](function(_0x3c247a){_0x266453=_0x3c247a;return getCall(_0x10ac61,_0x41731f,_0x50aff4,_0x42a8ad,_0x266453,_0xded031,_0x4e567d,_0x34c6('0x75'));})[_0x34c6('0x34')](function(_0x2fd7ed){if(_0x2fd7ed){logger['info'](_0x34c6('0x89'),_0x2fd7ed['id']);logger[_0x34c6('0x3b')](_0x34c6('0x8a'),_0x34c6('0x8b'));emit(util[_0x34c6('0x30')](_0x34c6('0x8c'),_0x50f044[_0x34c6('0x18')]),_0x34c6('0x8d'),{'uri':_0x34c6('0x8e')+_0x50aff4[_0x34c6('0x7b')]+_0x34c6('0x8f')+_0x2fd7ed['id']});}})[_0x34c6('0x2b')](function(_0x5e1d1a){logger['error'](_0x34c6('0x8a'),JSON[_0x34c6('0xf')](_0x5e1d1a));});};exports['outbound']=function(_0x168c5e,_0x1266de,_0x1f38c0,_0x769d81,_0x32880f,_0x1d5ca4,_0x49ffc6){var _0x4d26b5,_0x5b12a8,_0x114247;_0x1d5ca4[_0x34c6('0x7b')]=intUtil[_0x34c6('0x7c')](_0x1d5ca4[_0x34c6('0x7b')]);_0x1d5ca4[_0x34c6('0x7d')]=intUtil['stripTrailingSlash'](_0x1d5ca4[_0x34c6('0x7d')]);if(_0x49ffc6&&_0x49ffc6[_0x34c6('0x90')]&&_0x49ffc6[_0x34c6('0x90')]!==_0x34c6('0x91')){logger['info'](_0x34c6('0x92'),'Recording\x20is\x20enabled!');_0x1266de['recordingURL']=_0x1d5ca4[_0x34c6('0x7d')]+_0x34c6('0x81')+_0x1266de[_0x34c6('0x82')]+_0x34c6('0x83')+md5(_0x1266de[_0x34c6('0x82')]);}var _0x266c6d=_0x1d5ca4[_0x34c6('0x7b')]===_0x34c6('0x84')?'eu':_0x34c6('0x85');return getAccessToken(_0x1d5ca4)['then'](function(_0x457aa3){_0x114247=_0x457aa3;return getUser(_0x114247,_0x266c6d,_0x1d5ca4,_0x769d81[_0x34c6('0x39')]);})[_0x34c6('0x34')](function(_0x1737db){_0x4d26b5=_0x1737db;logger[_0x34c6('0x3b')](_0x34c6('0x86'),_0x4d26b5['id']);return getEndUser(_0x114247,_0x266c6d,_0x1d5ca4,_0x1266de[_0x34c6('0x93')],_0x1266de['destcalleridnum'],_0x4d26b5,_0x1f38c0);})['then'](function(_0x54ac2b){_0x5b12a8=_0x54ac2b;return getCall(_0x114247,_0x266c6d,_0x1d5ca4,_0x4d26b5,_0x5b12a8,_0x1f38c0,_0x1266de,_0x34c6('0x94'));})[_0x34c6('0x34')](function(_0x2f51b1){if(_0x2f51b1){logger[_0x34c6('0x3b')]('The\x20Call\x20ID\x20is:',_0x2f51b1['id']);logger[_0x34c6('0x3b')](_0x34c6('0x92'),_0x34c6('0x8b'));emit(util[_0x34c6('0x30')](_0x34c6('0x8c'),_0x769d81[_0x34c6('0x18')]),'trigger:browser:url',{'uri':_0x34c6('0x8e')+_0x1d5ca4[_0x34c6('0x7b')]+_0x34c6('0x8f')+_0x2f51b1['id']});}})[_0x34c6('0x2b')](function(_0x2b6b13){logger[_0x34c6('0x2c')](_0x34c6('0x92'),JSON['stringify'](_0x2b6b13));});};exports[_0x34c6('0x95')]=function(_0x2f793a,_0x2739aa,_0x17dafd,_0x4ec4c9,_0xfa557f,_0x311096){var _0x475ade,_0x2c2442,_0x1de848;_0x311096[_0x34c6('0x7b')]=intUtil['stripTrailingSlash'](_0x311096[_0x34c6('0x7b')]);_0x311096[_0x34c6('0x7d')]=intUtil[_0x34c6('0x7c')](_0x311096[_0x34c6('0x7d')]);if(_0xfa557f&&_0xfa557f['monitor_format']){logger[_0x34c6('0x3b')]('['+_0x2739aa['lastevent']['toUpperCase']()+']',_0x34c6('0x7f'));_0x2739aa[_0x34c6('0x80')]=_0x311096[_0x34c6('0x7d')]+'/api/voice/recordings/'+_0x2739aa[_0x34c6('0x82')]+'/downloads?type=uniqueid&token='+md5(_0x2739aa['uniqueid']);}else{_0x2739aa['recordingURL']='';}var _0x3db942=_0x311096[_0x34c6('0x7b')]==='zoho.eu'?'eu':_0x34c6('0x85');return getAccessToken(_0x311096)['then'](function(_0x459677){_0x1de848=_0x459677;return getUser(_0x1de848,_0x3db942,_0x311096);})[_0x34c6('0x34')](function(_0x5537a6){_0x475ade=_0x5537a6;logger[_0x34c6('0x3b')]('The\x20User\x20ID\x20is:',_0x475ade['id']);return getEndUser(_0x1de848,_0x3db942,_0x311096,_0x2739aa[_0x34c6('0x87')],_0x2739aa[_0x34c6('0x88')],_0x475ade,_0x17dafd);})[_0x34c6('0x34')](function(_0xe03413){_0x2c2442=_0xe03413;return getCall(_0x1de848,_0x3db942,_0x311096,_0x475ade,_0x2c2442,_0x17dafd,_0x2739aa,_0x34c6('0x75'));})[_0x34c6('0x34')](function(_0x4b71fb){if(_0x4b71fb){logger[_0x34c6('0x3b')](_0x34c6('0x89'),_0x4b71fb['id']);}})[_0x34c6('0x2b')](function(_0x3b80ac){logger[_0x34c6('0x2c')]('['+_0x2739aa[_0x34c6('0x6a')][_0x34c6('0x96')]()+']',JSON['stringify'](_0x3b80ac));});}; \ 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 cbd384c..15cf645 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 _0xefbc=['shelljs','mustache','trigger','data2','Script','render','data3','exec','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util'];(function(_0x1f3190,_0x3eff53){var _0x95e95f=function(_0xcbb102){while(--_0xcbb102){_0x1f3190['push'](_0x1f3190['shift']());}};_0x95e95f(++_0x3eff53);}(_0xefbc,0x1cd));var _0xcefb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xefbc[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xcefb('0x0'));var sh=require(_0xcefb('0x1'));var Mustache=require(_0xcefb('0x2'));var logger=require('../../../../config/logger')(_0xcefb('0x3'));exports['exec']=function(_0xfb582e,_0x59a3fe){var _0x2c480e=_0xfb582e[_0xcefb('0x4')]?_0xfb582e['data2']:_0xcefb('0x5');var _0x36ad4f=_0xfb582e['data3']?Mustache[_0xcefb('0x6')](_0xfb582e[_0xcefb('0x7')],_0x59a3fe):_0x59a3fe;sh[_0xcefb('0x8')](_0x36ad4f,function(_0x52bc18,_0x4e4efb,_0x1de86f){if(_0x52bc18!==0x0){logger[_0xcefb('0x9')](util[_0xcefb('0xa')](_0xcefb('0xb'),_0x2c480e,_0x36ad4f,_0x52bc18,_0x1de86f));}else{logger[_0xcefb('0xc')](util['format'](_0xcefb('0xd'),_0x2c480e,_0x36ad4f,_0x4e4efb));}});}; \ No newline at end of file +var _0xa78d=['format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','../../../../config/logger','trigger','exec','data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info'];(function(_0xa0f9e1,_0x409b3d){var _0x432ee9=function(_0x1b28f9){while(--_0x1b28f9){_0xa0f9e1['push'](_0xa0f9e1['shift']());}};_0x432ee9(++_0x409b3d);}(_0xa78d,0xd3));var _0xda78=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0xa78d[_0x22b68a];return _0x1ac67a;};'use strict';var util=require(_0xda78('0x0'));var sh=require('shelljs');var Mustache=require('mustache');var logger=require(_0xda78('0x1'))(_0xda78('0x2'));exports[_0xda78('0x3')]=function(_0x5d1319,_0x1598ce){var _0x31cbf4=_0x5d1319[_0xda78('0x4')]?_0x5d1319[_0xda78('0x4')]:_0xda78('0x5');var _0x1bcb5c=_0x5d1319['data3']?Mustache['render'](_0x5d1319[_0xda78('0x6')],_0x1598ce):_0x1598ce;sh[_0xda78('0x3')](_0x1bcb5c,function(_0x24924e,_0x5c3e2b,_0x36318d){if(_0x24924e!==0x0){logger['error'](util['format'](_0xda78('0x7'),_0x31cbf4,_0x1bcb5c,_0x24924e,_0x36318d));}else{logger[_0xda78('0x8')](util[_0xda78('0x9')](_0xda78('0xa'),_0x31cbf4,_0x1bcb5c,_0x5c3e2b));}});}; \ 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 56700c3..6812d67 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 _0x3753=['data5','number','parse','render','data6','error','DELETE','PUT','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','data2'];(function(_0x7ee859,_0x2b5fc0){var _0x383111=function(_0x1aba8b){while(--_0x1aba8b){_0x7ee859['push'](_0x7ee859['shift']());}};_0x383111(++_0x2b5fc0);}(_0x3753,0x7a));var _0x3375=function(_0x51b9d2,_0x412548){_0x51b9d2=_0x51b9d2-0x0;var _0x2d36e8=_0x3753[_0x51b9d2];return _0x2d36e8;};'use strict';var rp=require(_0x3375('0x0'));var util=require(_0x3375('0x1'));var _=require(_0x3375('0x2'));var Mustache=require(_0x3375('0x3'));var logger=require(_0x3375('0x4'))(_0x3375('0x5'));exports[_0x3375('0x6')]=function(_0x52f818,_0x373f43){var _0x1199ff,_0x93a50f;var _0x69b84={'method':_0x52f818[_0x3375('0x7')][_0x3375('0x8')](),'uri':Mustache['render'](_0x52f818[_0x3375('0x9')],_0x373f43),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x52f818[_0x3375('0xa')])===_0x3375('0xb')&&parseInt(_0x52f818[_0x3375('0xa')])>=0x1&&parseInt(_0x52f818['data5'])<=0xa?parseInt(_0x52f818[_0x3375('0xa')])*0x3e8:0x5*0x3e8};try{_0x69b84['headers']=_0x52f818['data6']?JSON[_0x3375('0xc')](Mustache[_0x3375('0xd')](_0x52f818[_0x3375('0xe')],_0x373f43)):{};}catch(_0x13191f){logger[_0x3375('0xf')](_0x13191f['stack']);}switch(_0x52f818[_0x3375('0x7')][_0x3375('0x8')]()){case'GET':case _0x3375('0x10'):_0x1199ff=null;_0x69b84['qs']=_0x373f43;break;case'POST':case _0x3375('0x11'):if(_0x52f818['data7']){try{_0x1199ff=JSON['parse'](Mustache[_0x3375('0xd')](_0x52f818['data7'],_0x373f43));_0x69b84['body']=_0x1199ff;}catch(_0x5c361a){logger[_0x3375('0xf')](_0x5c361a[_0x3375('0x12')]);logger[_0x3375('0xf')](_0x3375('0x13'));}}else{_0x1199ff=_0x373f43;_0x69b84[_0x3375('0x14')]=_0x1199ff;}break;}logger[_0x3375('0x15')](util[_0x3375('0x16')](_0x3375('0x17'),_0x52f818[_0x3375('0x7')],_0x52f818[_0x3375('0x9')],JSON[_0x3375('0x18')](_0x69b84)));rp(_0x69b84)[_0x3375('0x19')](function(_0x3e5eca){_0x1199ff=!_[_0x3375('0x1a')](_0x1199ff)?_0x3375('0x1b')+_0x1199ff:'';_0x93a50f=typeof _0x3e5eca['body']===_0x3375('0x1c')?JSON['stringify'](_0x3e5eca[_0x3375('0x14')]):_0x3e5eca[_0x3375('0x14')];logger['info'](util[_0x3375('0x16')](_0x3375('0x1d'),_0x52f818[_0x3375('0x7')],_0x52f818[_0x3375('0x9')],_0x3e5eca['statusCode'],_0x93a50f));})['catch'](function(_0x5442c5){logger['error'](util['format'](_0x3375('0x1e'),_0x52f818[_0x3375('0x7')],_0x52f818['data2'],_0x5442c5[_0x3375('0x1f')],_0x5442c5['name'],_0x5442c5[_0x3375('0x20')]));});}; \ No newline at end of file +var _0x9bc4=['stack','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','isNil',',\x20request\x20body:\x20','info','data2','statusCode','catch','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','number','data5','headers','data6','render','error','GET','POST','PUT','data7','parse','body'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x9bc4,0x14b));var _0x49bc=function(_0xf5cdac,_0x1648fd){_0xf5cdac=_0xf5cdac-0x0;var _0x4a23f1=_0x9bc4[_0xf5cdac];return _0x4a23f1;};'use strict';var rp=require(_0x49bc('0x0'));var util=require(_0x49bc('0x1'));var _=require(_0x49bc('0x2'));var Mustache=require(_0x49bc('0x3'));var logger=require(_0x49bc('0x4'))(_0x49bc('0x5'));exports[_0x49bc('0x6')]=function(_0x1ab011,_0x32a8e5){var _0x5b1f36,_0x167b26;var _0x591fff={'method':_0x1ab011[_0x49bc('0x7')][_0x49bc('0x8')](),'uri':Mustache['render'](_0x1ab011['data2'],_0x32a8e5),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1ab011['data5'])===_0x49bc('0x9')&&parseInt(_0x1ab011[_0x49bc('0xa')])>=0x1&&parseInt(_0x1ab011[_0x49bc('0xa')])<=0xa?parseInt(_0x1ab011['data5'])*0x3e8:0x5*0x3e8};try{_0x591fff[_0x49bc('0xb')]=_0x1ab011[_0x49bc('0xc')]?JSON['parse'](Mustache[_0x49bc('0xd')](_0x1ab011['data6'],_0x32a8e5)):{};}catch(_0x7a8148){logger[_0x49bc('0xe')](_0x7a8148['stack']);}switch(_0x1ab011[_0x49bc('0x7')][_0x49bc('0x8')]()){case _0x49bc('0xf'):case'DELETE':_0x5b1f36=null;_0x591fff['qs']=_0x32a8e5;break;case _0x49bc('0x10'):case _0x49bc('0x11'):if(_0x1ab011[_0x49bc('0x12')]){try{_0x5b1f36=JSON[_0x49bc('0x13')](Mustache[_0x49bc('0xd')](_0x1ab011[_0x49bc('0x12')],_0x32a8e5));_0x591fff[_0x49bc('0x14')]=_0x5b1f36;}catch(_0x4fe797){logger[_0x49bc('0xe')](_0x4fe797[_0x49bc('0x15')]);logger['error']('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x5b1f36=_0x32a8e5;_0x591fff[_0x49bc('0x14')]=_0x5b1f36;}break;}logger['info'](util[_0x49bc('0x16')](_0x49bc('0x17'),_0x1ab011[_0x49bc('0x7')],_0x1ab011['data2'],JSON[_0x49bc('0x18')](_0x591fff)));rp(_0x591fff)['then'](function(_0x383afe){_0x5b1f36=!_[_0x49bc('0x19')](_0x5b1f36)?_0x49bc('0x1a')+_0x5b1f36:'';_0x167b26=typeof _0x383afe[_0x49bc('0x14')]==='object'?JSON['stringify'](_0x383afe[_0x49bc('0x14')]):_0x383afe['body'];logger[_0x49bc('0x1b')](util['format']('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x1ab011['data1'],_0x1ab011[_0x49bc('0x1c')],_0x383afe[_0x49bc('0x1d')],_0x167b26));})[_0x49bc('0x1e')](function(_0x28a3ad){logger['error'](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x1ab011[_0x49bc('0x7')],_0x1ab011['data2'],_0x28a3ad[_0x49bc('0x1d')],_0x28a3ad['name'],_0x28a3ad[_0x49bc('0x1f')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 90a2dab..b6f4b14 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 _0x6f80=['exports','jayson/promise','bluebird','routing','client','http','Request','request','then','debug','error','rpc','message','result','catch'];(function(_0x32d456,_0x2a5201){var _0x557946=function(_0xf10bfb){while(--_0xf10bfb){_0x32d456['push'](_0x32d456['shift']());}};_0x557946(++_0x2a5201);}(_0x6f80,0x13c));var _0x06f8=function(_0x194bef,_0x1309bf){_0x194bef=_0x194bef-0x0;var _0x297f5b=_0x6f80[_0x194bef];return _0x297f5b;};'use strict';var jayson=require(_0x06f8('0x0'));var BPromise=require(_0x06f8('0x1'));var logger=require('../../config/logger')(_0x06f8('0x2'));var client=jayson[_0x06f8('0x3')][_0x06f8('0x4')]({'port':0x2329});client[_0x06f8('0x5')]=function(_0x33da6f,_0x239f77){return new BPromise(function(_0x39a670,_0x217776){return client[_0x06f8('0x6')](_0x33da6f,_0x239f77)[_0x06f8('0x7')](function(_0x2449ca){logger[_0x06f8('0x8')]('rpc',_0x06f8('0x2'),_0x33da6f,_0x239f77,_0x2449ca);if(_0x2449ca['error']){logger[_0x06f8('0x9')](_0x06f8('0xa'),_0x06f8('0x2'),_0x33da6f,_0x2449ca[_0x06f8('0x9')]['message'],_0x239f77);return _0x217776(_0x2449ca['error'][_0x06f8('0xb')]);}else{return _0x39a670(_0x2449ca[_0x06f8('0xc')]);}})[_0x06f8('0xd')](function(_0x35ea81){logger['error']('rpc',_0x06f8('0x2'),_0x33da6f,_0x35ea81,_0x239f77);return _0x217776(_0x35ea81);});});};module[_0x06f8('0xe')]=client; \ No newline at end of file +var _0xf4ff=['routing','client','http','Request','then','rpc','error','message','result','exports','jayson/promise','bluebird','../../config/logger'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf4ff,0x135));var _0xff4f=function(_0x4d0f7b,_0x3b9981){_0x4d0f7b=_0x4d0f7b-0x0;var _0x37ed34=_0xf4ff[_0x4d0f7b];return _0x37ed34;};'use strict';var jayson=require(_0xff4f('0x0'));var BPromise=require(_0xff4f('0x1'));var logger=require(_0xff4f('0x2'))(_0xff4f('0x3'));var client=jayson[_0xff4f('0x4')][_0xff4f('0x5')]({'port':0x2329});client[_0xff4f('0x6')]=function(_0x2315d2,_0x443f99){return new BPromise(function(_0x12f8ba,_0xea7135){return client['request'](_0x2315d2,_0x443f99)[_0xff4f('0x7')](function(_0x5e7a42){logger['debug'](_0xff4f('0x8'),_0xff4f('0x3'),_0x2315d2,_0x443f99,_0x5e7a42);if(_0x5e7a42[_0xff4f('0x9')]){logger[_0xff4f('0x9')](_0xff4f('0x8'),_0xff4f('0x3'),_0x2315d2,_0x5e7a42[_0xff4f('0x9')][_0xff4f('0xa')],_0x443f99);return _0xea7135(_0x5e7a42[_0xff4f('0x9')]['message']);}else{return _0x12f8ba(_0x5e7a42[_0xff4f('0xb')]);}})['catch'](function(_0x513b73){logger[_0xff4f('0x9')]('rpc',_0xff4f('0x3'),_0x2315d2,_0x513b73,_0x443f99);return _0xea7135(_0x513b73);});});};module[_0xff4f('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 582f738..96b9d13 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 _0xec8c=['then','getMailAccounts','initMailAccounts','mailAccounts','listen','getSettings','loginMailFrequency','error','./server','./realtime','./lib/email','../../config/logger','email','resolve'];(function(_0x179b7b,_0x57b44d){var _0x5eea20=function(_0x5582aa){while(--_0x5582aa){_0x179b7b['push'](_0x179b7b['shift']());}};_0x5eea20(++_0x57b44d);}(_0xec8c,0x190));var _0xcec8=function(_0x2331f8,_0x446a3a){_0x2331f8=_0x2331f8-0x0;var _0x244773=_0xec8c[_0x2331f8];return _0x244773;};'use strict';var server=require(_0xcec8('0x0'));var Realtime=require(_0xcec8('0x1'));var EmailChannel=require(_0xcec8('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var logger=require(_0xcec8('0x3'))(_0xcec8('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xcec8('0x5')]()[_0xcec8('0x6')](mailAccount[_0xcec8('0x7')]())['then'](realtime[_0xcec8('0x8')]())[_0xcec8('0x6')](function(){email['refresh'](realtime[_0xcec8('0x9')]);return realtime;});}function main(){return server[_0xcec8('0xa')](realtime,email)[_0xcec8('0x6')](function(){return initRealtime();})[_0xcec8('0x6')](function(){return setting[_0xcec8('0xb')]();})[_0xcec8('0x6')](function(_0x6de4ca){return setInterval(initRealtime,_0x6de4ca[_0xcec8('0xc')]*0x3e8);})['catch'](function(_0x538dc2){logger[_0xcec8('0xd')]('Email\x20service\x20initialization',_0x538dc2);});}main(); \ No newline at end of file +var _0x1fb2=['./server','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','initMailAccounts','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization'];(function(_0x44474f,_0x431580){var _0x427d97=function(_0x53f7d4){while(--_0x53f7d4){_0x44474f['push'](_0x44474f['shift']());}};_0x427d97(++_0x431580);}(_0x1fb2,0x1ef));var _0x21fb=function(_0x53d69d,_0x15cc2d){_0x53d69d=_0x53d69d-0x0;var _0x3aace8=_0x1fb2[_0x53d69d];return _0x3aace8;};'use strict';var server=require(_0x21fb('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x21fb('0x1'));var mailAccount=require(_0x21fb('0x2'));var setting=require(_0x21fb('0x3'));var logger=require(_0x21fb('0x4'))(_0x21fb('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x21fb('0x6')]()['then'](mailAccount['getMailAccounts']())[_0x21fb('0x7')](realtime[_0x21fb('0x8')]())[_0x21fb('0x7')](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x21fb('0x9')](realtime,email)[_0x21fb('0x7')](function(){return initRealtime();})[_0x21fb('0x7')](function(){return setting[_0x21fb('0xa')]();})[_0x21fb('0x7')](function(_0x68cec6){return setInterval(initRealtime,_0x68cec6[_0x21fb('0xb')]*0x3e8);})[_0x21fb('0xc')](function(_0x479e11){logger[_0x21fb('0xd')](_0x21fb('0xe'),_0x479e11);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 2b69282..a881e03 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 _0x6b6d=['hasOwnProperty','active','service','custom','provider','imapAccounts','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','handleImapError','isNil','connected','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','info','Mail\x20accepted\x20from\x20routing','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','verifySmtp','Smtp','verify','catch','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','email','redis','defaults','localhost','socket.io-emitter','./imap','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','smtp','emit','key','status','messageStatus','Imap','total','stringify','mailAccount:update','prototype','refresh'];(function(_0x50da8d,_0x282e16){var _0x2f624b=function(_0x15fed1){while(--_0x15fed1){_0x50da8d['push'](_0x50da8d['shift']());}};_0x2f624b(++_0x282e16);}(_0x6b6d,0x97));var _0xd6b6=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x6b6d[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0xd6b6('0x0'));var moment=require(_0xd6b6('0x1'));var BPromise=require(_0xd6b6('0x2'));var md5=require(_0xd6b6('0x3'));var Redis=require(_0xd6b6('0x4'));var config=require(_0xd6b6('0x5'));var logger=require('../../../config/logger')(_0xd6b6('0x6'));config[_0xd6b6('0x7')]=_[_0xd6b6('0x8')](config[_0xd6b6('0x7')],{'host':_0xd6b6('0x9'),'port':0x18eb});var io=require(_0xd6b6('0xa'))(new Redis(config['redis']));var EmailImap=require(_0xd6b6('0xb'));var EmailSmtp=require('./smtp');var mailAccount=require(_0xd6b6('0xc'));var md5Accounts={};function EmailChannel(_0xdabc42){logger['info'](_0xd6b6('0xd'));this[_0xd6b6('0xe')]=_0xdabc42[_0xd6b6('0xe')];this['imapAccounts']={};this[_0xd6b6('0xf')]=new EmailSmtp();}EmailChannel['prototype'][_0xd6b6('0x10')]=function(_0x3c3e32){var _0x3a999e=this[_0xd6b6('0xe')][_0x3c3e32];var _0x3f1cc8={'id':_0x3a999e['id'],'name':_0x3a999e['name'],'key':_0x3a999e[_0xd6b6('0x11')],'active':_0x3a999e['active'],'Imap':{'status':_0x3a999e['Imap'][_0xd6b6('0x12')],'messageStatus':_0x3a999e['Imap'][_0xd6b6('0x13')],'total':_0x3a999e[_0xd6b6('0x14')][_0xd6b6('0x15')]}};if(_['isNil'](md5Accounts[_0x3c3e32])){md5Accounts[_0x3c3e32]={};}var _0x23e047=md5(JSON[_0xd6b6('0x16')](_0x3f1cc8));if(md5Accounts[_0x3c3e32][_0xd6b6('0x3')]!==_0x23e047){md5Accounts[_0x3c3e32]['md5']=_0x23e047;io[_0xd6b6('0x10')](_0xd6b6('0x17'),_0x3f1cc8);}};EmailChannel[_0xd6b6('0x18')][_0xd6b6('0x19')]=function(_0x3601cc){for(var _0x3991a2 in _0x3601cc){if(_0x3601cc[_0xd6b6('0x1a')](_0x3991a2)){if(_0x3601cc[_0x3991a2][_0xd6b6('0x14')]&&_0x3601cc[_0x3991a2][_0xd6b6('0x1b')]){var _0x4d42ae=_0x3601cc[_0x3991a2][_0xd6b6('0x14')];if(!_0x4d42ae[_0xd6b6('0x1c')]&&_0x3601cc[_0x3991a2]['provider']!==_0xd6b6('0x1d'))_0x4d42ae['service']=_0x3601cc[_0x3991a2][_0xd6b6('0x1e')];if(!this[_0xd6b6('0x1f')]['hasOwnProperty'](_0x4d42ae['id'])){this[_0xd6b6('0x1f')][_0x4d42ae['id']]=new EmailImap(_0x4d42ae,_0x3601cc[_0x3991a2]['email']);this[_0xd6b6('0x1f')][_0x4d42ae['id']]['on'](_0xd6b6('0x20'),this[_0xd6b6('0x21')][_0xd6b6('0x22')](this,_0x3991a2));this['imapAccounts'][_0x4d42ae['id']]['on'](_0xd6b6('0x6'),this[_0xd6b6('0x23')][_0xd6b6('0x22')](this,_0x3991a2));this[_0xd6b6('0x1f')][_0x4d42ae['id']]['on'](_0xd6b6('0x24'),this[_0xd6b6('0x25')]['bind'](this,_0x3991a2));this[_0xd6b6('0x1f')][_0x4d42ae['id']]['on']('error',this[_0xd6b6('0x26')][_0xd6b6('0x22')](this,_0x3991a2));}}else{if(_[_0xd6b6('0x27')](this[_0xd6b6('0xe')][_0x3991a2]['Imap'])){this['mailAccounts'][_0x3991a2][_0xd6b6('0x14')]={};}this[_0xd6b6('0xe')][_0x3991a2][_0xd6b6('0x14')][_0xd6b6('0x12')]='disabled';this[_0xd6b6('0xe')][_0x3991a2]['Imap']['messageStatus']='';this[_0xd6b6('0x10')](_0x3991a2);}}}};EmailChannel[_0xd6b6('0x18')][_0xd6b6('0x21')]=function(_0x4d45b5,_0x363f58){if(this[_0xd6b6('0xe')][_0x4d45b5]){this['mailAccounts'][_0x4d45b5][_0xd6b6('0x14')][_0xd6b6('0x12')]=_0xd6b6('0x28');this[_0xd6b6('0xe')][_0x4d45b5][_0xd6b6('0x14')]['messageStatus']=_0x363f58[_0xd6b6('0x29')];if(_0x363f58['messages']){this['mailAccounts'][_0x4d45b5][_0xd6b6('0x14')][_0xd6b6('0x15')]=_0x363f58[_0xd6b6('0x2a')]['total'];}return this['emit'](_0x4d45b5);}};EmailChannel[_0xd6b6('0x18')][_0xd6b6('0x23')]=function(_0x458dbb,_0x1716cc){logger['info'](_0xd6b6('0x2b'),_0x1716cc[_0xd6b6('0x2c')],_0x1716cc[_0xd6b6('0x2d')],_0x1716cc[_0xd6b6('0x2e')],_0x458dbb);if(this[_0xd6b6('0xe')][_0x458dbb]){return mailAccount[_0xd6b6('0x2f')](_0x458dbb,_0x1716cc)[_0xd6b6('0x30')](function(_0x47be5f){if(_0x47be5f){logger[_0xd6b6('0x31')](_0xd6b6('0x32'));}})['catch'](function(_0x3270b3){logger[_0xd6b6('0x33')](_0xd6b6('0x34'),JSON[_0xd6b6('0x16')](_0x3270b3));});}};EmailChannel[_0xd6b6('0x18')]['handleImapEnd']=function(_0x1e5369){if(this[_0xd6b6('0xe')][_0x1e5369]&&this[_0xd6b6('0xe')][_0x1e5369][_0xd6b6('0x14')]){if(this[_0xd6b6('0x1f')][this[_0xd6b6('0xe')][_0x1e5369][_0xd6b6('0x14')]['id']]){delete this['imapAccounts'][this[_0xd6b6('0xe')][_0x1e5369][_0xd6b6('0x14')]['id']];}this[_0xd6b6('0xe')][_0x1e5369][_0xd6b6('0x14')]['lastSync']=moment();this[_0xd6b6('0x10')](_0x1e5369);}};EmailChannel[_0xd6b6('0x18')][_0xd6b6('0x26')]=function(_0x1692e4,_0x112344){if(this['mailAccounts'][_0x1692e4]){this[_0xd6b6('0xe')][_0x1692e4][_0xd6b6('0x14')][_0xd6b6('0x12')]=_0xd6b6('0x33');this[_0xd6b6('0xe')][_0x1692e4][_0xd6b6('0x14')]['messageStatus']=_0x112344;return this[_0xd6b6('0x10')](_0x1692e4);}};EmailChannel[_0xd6b6('0x18')][_0xd6b6('0x35')]=function(_0x8ab815,_0x3d218d){return this['smtp']['send'](_0x8ab815,_0x3d218d);};EmailChannel['prototype'][_0xd6b6('0x36')]=function(_0x2f144c){var _0x50c8f5=this;if(this['mailAccounts'][_0x2f144c['id']]){if(_['isNil'](this[_0xd6b6('0xe')][_0x2f144c['id']][_0xd6b6('0x37')])){this[_0xd6b6('0xe')][_0x2f144c['id']][_0xd6b6('0x37')]={};}this['mailAccounts'][_0x2f144c['id']][_0xd6b6('0x37')]['lastSync']=moment();return new BPromise(function(_0x4198bc,_0x263fbf){return _0x50c8f5['smtp'][_0xd6b6('0x38')](_0x2f144c)[_0xd6b6('0x30')](function(_0x3c39a4){_0x50c8f5[_0xd6b6('0xe')][_0x2f144c['id']][_0xd6b6('0x37')][_0xd6b6('0x12')]='verified';_0x50c8f5[_0xd6b6('0xe')][_0x2f144c['id']]['Smtp']['messageStatus']='';_0x50c8f5[_0xd6b6('0x10')](_0x2f144c['id']);_0x4198bc(_0x3c39a4);})[_0xd6b6('0x39')](function(_0x54e9b4){_0x50c8f5[_0xd6b6('0xe')][_0x2f144c['id']][_0xd6b6('0x37')][_0xd6b6('0x12')]='error';_0x50c8f5[_0xd6b6('0xe')][_0x2f144c['id']][_0xd6b6('0x37')][_0xd6b6('0x13')]=_0x54e9b4;_0x50c8f5[_0xd6b6('0x10')](_0x2f144c['id']);_0x263fbf(_0x54e9b4);});});}return this[_0xd6b6('0xf')][_0xd6b6('0x38')](_0x2f144c);};module[_0xd6b6('0x3a')]=EmailChannel; \ No newline at end of file +var _0xb758=['Smtp','verify','verified','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','total','isNil','md5','service','provider','custom','hasOwnProperty','email','box','handleImapBox','bind','end','handleImapEnd','error','handleImapError','messageStatus','connected','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','sendMail','send','verifySmtp'];(function(_0x1889b0,_0x21be93){var _0x238187=function(_0x53671a){while(--_0x53671a){_0x1889b0['push'](_0x1889b0['shift']());}};_0x238187(++_0x21be93);}(_0xb758,0x1dc));var _0x8b75=function(_0x528575,_0x2e067d){_0x528575=_0x528575-0x0;var _0x3063b7=_0xb758[_0x528575];return _0x3063b7;};'use strict';var _=require(_0x8b75('0x0'));var moment=require(_0x8b75('0x1'));var BPromise=require('bluebird');var md5=require('md5');var Redis=require(_0x8b75('0x2'));var config=require(_0x8b75('0x3'));var logger=require(_0x8b75('0x4'))('email');config[_0x8b75('0x5')]=_[_0x8b75('0x6')](config['redis'],{'host':_0x8b75('0x7'),'port':0x18eb});var io=require(_0x8b75('0x8'))(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require(_0x8b75('0x9'));var mailAccount=require(_0x8b75('0xa'));var md5Accounts={};function EmailChannel(_0x1d7a7a){logger['info'](_0x8b75('0xb'));this[_0x8b75('0xc')]=_0x1d7a7a[_0x8b75('0xc')];this[_0x8b75('0xd')]={};this[_0x8b75('0xe')]=new EmailSmtp();}EmailChannel[_0x8b75('0xf')][_0x8b75('0x10')]=function(_0x11a305){var _0x1047be=this[_0x8b75('0xc')][_0x11a305];var _0x5f526a={'id':_0x1047be['id'],'name':_0x1047be[_0x8b75('0x11')],'key':_0x1047be[_0x8b75('0x12')],'active':_0x1047be[_0x8b75('0x13')],'Imap':{'status':_0x1047be[_0x8b75('0x14')][_0x8b75('0x15')],'messageStatus':_0x1047be[_0x8b75('0x14')]['messageStatus'],'total':_0x1047be[_0x8b75('0x14')][_0x8b75('0x16')]}};if(_[_0x8b75('0x17')](md5Accounts[_0x11a305])){md5Accounts[_0x11a305]={};}var _0x584220=md5(JSON['stringify'](_0x5f526a));if(md5Accounts[_0x11a305][_0x8b75('0x18')]!==_0x584220){md5Accounts[_0x11a305]['md5']=_0x584220;io[_0x8b75('0x10')]('mailAccount:update',_0x5f526a);}};EmailChannel[_0x8b75('0xf')]['refresh']=function(_0x2e39f8){for(var _0x2b3f00 in _0x2e39f8){if(_0x2e39f8['hasOwnProperty'](_0x2b3f00)){if(_0x2e39f8[_0x2b3f00][_0x8b75('0x14')]&&_0x2e39f8[_0x2b3f00]['active']){var _0x578cab=_0x2e39f8[_0x2b3f00]['Imap'];if(!_0x578cab[_0x8b75('0x19')]&&_0x2e39f8[_0x2b3f00][_0x8b75('0x1a')]!==_0x8b75('0x1b'))_0x578cab[_0x8b75('0x19')]=_0x2e39f8[_0x2b3f00][_0x8b75('0x1a')];if(!this[_0x8b75('0xd')][_0x8b75('0x1c')](_0x578cab['id'])){this[_0x8b75('0xd')][_0x578cab['id']]=new EmailImap(_0x578cab,_0x2e39f8[_0x2b3f00][_0x8b75('0x1d')]);this['imapAccounts'][_0x578cab['id']]['on'](_0x8b75('0x1e'),this[_0x8b75('0x1f')][_0x8b75('0x20')](this,_0x2b3f00));this[_0x8b75('0xd')][_0x578cab['id']]['on'](_0x8b75('0x1d'),this['handleImapEmail'][_0x8b75('0x20')](this,_0x2b3f00));this[_0x8b75('0xd')][_0x578cab['id']]['on'](_0x8b75('0x21'),this[_0x8b75('0x22')][_0x8b75('0x20')](this,_0x2b3f00));this[_0x8b75('0xd')][_0x578cab['id']]['on'](_0x8b75('0x23'),this[_0x8b75('0x24')][_0x8b75('0x20')](this,_0x2b3f00));}}else{if(_[_0x8b75('0x17')](this[_0x8b75('0xc')][_0x2b3f00][_0x8b75('0x14')])){this['mailAccounts'][_0x2b3f00][_0x8b75('0x14')]={};}this[_0x8b75('0xc')][_0x2b3f00][_0x8b75('0x14')][_0x8b75('0x15')]='disabled';this[_0x8b75('0xc')][_0x2b3f00][_0x8b75('0x14')][_0x8b75('0x25')]='';this[_0x8b75('0x10')](_0x2b3f00);}}}};EmailChannel['prototype'][_0x8b75('0x1f')]=function(_0x3cb5c2,_0x2c8ef5){if(this[_0x8b75('0xc')][_0x3cb5c2]){this[_0x8b75('0xc')][_0x3cb5c2][_0x8b75('0x14')][_0x8b75('0x15')]=_0x8b75('0x26');this[_0x8b75('0xc')][_0x3cb5c2]['Imap'][_0x8b75('0x25')]=_0x2c8ef5[_0x8b75('0x11')];if(_0x2c8ef5[_0x8b75('0x27')]){this[_0x8b75('0xc')][_0x3cb5c2]['Imap'][_0x8b75('0x16')]=_0x2c8ef5['messages'][_0x8b75('0x16')];}return this[_0x8b75('0x10')](_0x3cb5c2);}};EmailChannel[_0x8b75('0xf')]['handleImapEmail']=function(_0x1cd94d,_0x28a431){logger[_0x8b75('0x28')](_0x8b75('0x29'),_0x28a431[_0x8b75('0x2a')],_0x28a431[_0x8b75('0x2b')],_0x28a431[_0x8b75('0x2c')],_0x1cd94d);if(this[_0x8b75('0xc')][_0x1cd94d]){return mailAccount[_0x8b75('0x2d')](_0x1cd94d,_0x28a431)[_0x8b75('0x2e')](function(_0x10de45){if(_0x10de45){logger['info'](_0x8b75('0x2f'));}})[_0x8b75('0x30')](function(_0x98426a){logger['error'](_0x8b75('0x31'),JSON[_0x8b75('0x32')](_0x98426a));});}};EmailChannel[_0x8b75('0xf')][_0x8b75('0x22')]=function(_0x5efaf1){if(this[_0x8b75('0xc')][_0x5efaf1]&&this['mailAccounts'][_0x5efaf1][_0x8b75('0x14')]){if(this[_0x8b75('0xd')][this[_0x8b75('0xc')][_0x5efaf1][_0x8b75('0x14')]['id']]){delete this[_0x8b75('0xd')][this[_0x8b75('0xc')][_0x5efaf1][_0x8b75('0x14')]['id']];}this[_0x8b75('0xc')][_0x5efaf1][_0x8b75('0x14')][_0x8b75('0x33')]=moment();this['emit'](_0x5efaf1);}};EmailChannel[_0x8b75('0xf')][_0x8b75('0x24')]=function(_0x156de4,_0x6e680f){if(this['mailAccounts'][_0x156de4]){this[_0x8b75('0xc')][_0x156de4][_0x8b75('0x14')][_0x8b75('0x15')]=_0x8b75('0x23');this[_0x8b75('0xc')][_0x156de4]['Imap'][_0x8b75('0x25')]=_0x6e680f;return this[_0x8b75('0x10')](_0x156de4);}};EmailChannel['prototype'][_0x8b75('0x34')]=function(_0x3174d0,_0x1d1e87){return this['smtp'][_0x8b75('0x35')](_0x3174d0,_0x1d1e87);};EmailChannel[_0x8b75('0xf')][_0x8b75('0x36')]=function(_0x1ab251){var _0x37beb5=this;if(this[_0x8b75('0xc')][_0x1ab251['id']]){if(_[_0x8b75('0x17')](this[_0x8b75('0xc')][_0x1ab251['id']][_0x8b75('0x37')])){this['mailAccounts'][_0x1ab251['id']][_0x8b75('0x37')]={};}this[_0x8b75('0xc')][_0x1ab251['id']][_0x8b75('0x37')]['lastSync']=moment();return new BPromise(function(_0x50d59d,_0x5d16c3){return _0x37beb5['smtp'][_0x8b75('0x38')](_0x1ab251)[_0x8b75('0x2e')](function(_0x4a8017){_0x37beb5[_0x8b75('0xc')][_0x1ab251['id']][_0x8b75('0x37')][_0x8b75('0x15')]=_0x8b75('0x39');_0x37beb5[_0x8b75('0xc')][_0x1ab251['id']][_0x8b75('0x37')][_0x8b75('0x25')]='';_0x37beb5[_0x8b75('0x10')](_0x1ab251['id']);_0x50d59d(_0x4a8017);})['catch'](function(_0x212e68){_0x37beb5[_0x8b75('0xc')][_0x1ab251['id']]['Smtp']['status']=_0x8b75('0x23');_0x37beb5[_0x8b75('0xc')][_0x1ab251['id']][_0x8b75('0x37')]['messageStatus']=_0x212e68;_0x37beb5['emit'](_0x1ab251['id']);_0x5d16c3(_0x212e68);});});}return this[_0x8b75('0xe')][_0x8b75('0x38')](_0x1ab251);};module[_0x8b75('0x3a')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 9e6d617..2672cbd 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 _0x8d78=['getAccount','handleReady','bind','error','handleError','connect','prototype','connTimeout','authTimeout','user','modernAuthentication','generateXOAuth2Token','CloudProvider','password','anonymous@xcally.com','host','port','tls','autotls','required','openBox','handleOpenBox','emit','box','handleCloseBox','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','once','handleFetchError','closeBox','attributes','handleMessageAttributes','end','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','handleFetchEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','simpleParser','iconv','./utils','../../../config/logger','email','mailbox','account'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x8d78,0x1ce));var _0x88d7=function(_0x4d20eb,_0x37377b){_0x4d20eb=_0x4d20eb-0x0;var _0x75d65d=_0x8d78[_0x4d20eb];return _0x75d65d;};'use strict';var _=require(_0x88d7('0x0'));var util=require(_0x88d7('0x1'));var Imap=require(_0x88d7('0x2'));var simpleParser=require('mailparser')[_0x88d7('0x3')];var Iconv=require(_0x88d7('0x4'))['Iconv'];var EventEmitter=require('events')['EventEmitter'];var utils=require(_0x88d7('0x5'));var logger=require(_0x88d7('0x6'))(_0x88d7('0x7'));function EmailImap(_0x211c1f,_0x96b60f){this[_0x88d7('0x8')]=_0x211c1f[_0x88d7('0x8')];this[_0x88d7('0x9')]=this[_0x88d7('0xa')](_0x211c1f,_0x96b60f);this[_0x88d7('0x2')]=new Imap(this[_0x88d7('0x9')]);this[_0x88d7('0x2')]['once']('ready',this[_0x88d7('0xb')][_0x88d7('0xc')](this));this[_0x88d7('0x2')]['once']('end',this['handleEnd'][_0x88d7('0xc')](this));this[_0x88d7('0x2')]['on'](_0x88d7('0xd'),this[_0x88d7('0xe')][_0x88d7('0xc')](this));this[_0x88d7('0x2')][_0x88d7('0xf')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x88d7('0x10')][_0x88d7('0xa')]=function(_0x21a62c,_0x38ec07){var _0x16dcdf={'connTimeout':_0x21a62c[_0x88d7('0x11')]?_0x21a62c['connTimeout']*0x3e8:0x2710,'authTimeout':_0x21a62c[_0x88d7('0x12')]?_0x21a62c[_0x88d7('0x12')]*0x3e8:0x1388};if(_0x21a62c['service']){_0x16dcdf['user']=_0x21a62c[_0x88d7('0x13')];if(_0x21a62c[_0x88d7('0x14')]){_0x16dcdf['xoauth2']=utils[_0x88d7('0x15')](_0x21a62c[_0x88d7('0x16')]['data5'],_0x21a62c[_0x88d7('0x13')]);}else{_0x16dcdf[_0x88d7('0x17')]=_0x21a62c[_0x88d7('0x17')];}}else{if(_0x21a62c['authentication']){_0x16dcdf[_0x88d7('0x13')]=_0x21a62c[_0x88d7('0x13')];_0x16dcdf[_0x88d7('0x17')]=_0x21a62c[_0x88d7('0x17')];}}_0x16dcdf[_0x88d7('0x7')]=_0x38ec07||_0x21a62c[_0x88d7('0x13')]||_0x88d7('0x18');_0x16dcdf[_0x88d7('0x19')]=_0x21a62c['host'];_0x16dcdf[_0x88d7('0x1a')]=_0x21a62c[_0x88d7('0x1a')]||0x3e1;if(_0x21a62c['tls']){_0x16dcdf[_0x88d7('0x1b')]=!![];}else{_0x16dcdf[_0x88d7('0x1b')]=![];_0x16dcdf[_0x88d7('0x1c')]=_0x88d7('0x1d');}return _0x16dcdf;};EmailImap[_0x88d7('0x10')][_0x88d7('0xb')]=function(){this[_0x88d7('0x2')][_0x88d7('0x1e')](this[_0x88d7('0x8')],![],this[_0x88d7('0x1f')][_0x88d7('0xc')](this));};EmailImap[_0x88d7('0x10')]['handleOpenBox']=function(_0x594051,_0x10697f){if(_0x594051){this['handleError'](_0x594051,!![]);}else{this[_0x88d7('0x20')](_0x88d7('0x21'),_0x10697f);this['readUnseen']();}};EmailImap['prototype'][_0x88d7('0x22')]=function(_0x152768){if(_0x152768){this['handleError'](_0x152768,!![]);}else{this[_0x88d7('0x2')]['end']();}};EmailImap[_0x88d7('0x10')][_0x88d7('0x23')]=function(){this[_0x88d7('0x2')][_0x88d7('0x24')]([_0x88d7('0x25')],this[_0x88d7('0x26')][_0x88d7('0xc')](this));};EmailImap[_0x88d7('0x10')]['handleReadUnseen']=function(_0x209172,_0x23d5b2){if(_0x209172){this['handleError'](_0x209172,!![]);}else{if(_0x23d5b2[_0x88d7('0x27')]){try{var _0x1b0090=this['imap'][_0x88d7('0x28')](_0x23d5b2,{'bodies':'','markSeen':!![]});_0x1b0090['on'](_0x88d7('0x29'),this[_0x88d7('0x2a')][_0x88d7('0xc')](this));_0x1b0090[_0x88d7('0x2b')]('error',this[_0x88d7('0x2c')][_0x88d7('0xc')](this));_0x1b0090[_0x88d7('0x2b')]('end',this['handleFetchEnd'][_0x88d7('0xc')](this));}catch(_0x221101){logger[_0x88d7('0xd')](_0x221101);}}else{this[_0x88d7('0x2')][_0x88d7('0x2d')](!![],this['handleCloseBox'][_0x88d7('0xc')](this));}}};EmailImap[_0x88d7('0x10')][_0x88d7('0x2a')]=function(_0x45fc81){_0x45fc81['on']('body',this['handleMessageBody'][_0x88d7('0xc')](this));_0x45fc81[_0x88d7('0x2b')](_0x88d7('0x2e'),this[_0x88d7('0x2f')]['bind'](this));_0x45fc81[_0x88d7('0x2b')](_0x88d7('0x30'),this[_0x88d7('0x31')][_0x88d7('0xc')](this));};EmailImap[_0x88d7('0x10')][_0x88d7('0x32')]=function(_0x37eb60){simpleParser(_0x37eb60,{'Iconv':Iconv},this[_0x88d7('0x33')]['bind'](this));};EmailImap['prototype']['handleMessageAttributes']=function(){};EmailImap[_0x88d7('0x10')][_0x88d7('0x31')]=function(){};EmailImap[_0x88d7('0x10')]['handleSimpleParser']=function(_0x448469,_0x279fe2){if(_0x448469){logger['error'](_0x448469);}else{var _0x2f79cf=this;utils[_0x88d7('0x34')](this[_0x88d7('0x9')],_0x279fe2,function(_0x35825c){_0x2f79cf['emit'](_0x88d7('0x7'),_0x35825c);});}};EmailImap[_0x88d7('0x10')][_0x88d7('0x35')]=function(){this[_0x88d7('0x2')][_0x88d7('0x2d')](!![],this[_0x88d7('0x22')]['bind'](this));};EmailImap[_0x88d7('0x10')][_0x88d7('0x2c')]=function(_0x453b95){this[_0x88d7('0xe')](_0x453b95);this[_0x88d7('0x2')][_0x88d7('0x2d')](!![],this[_0x88d7('0x22')][_0x88d7('0xc')](this));};EmailImap[_0x88d7('0x10')]['handleEnd']=function(){this[_0x88d7('0x20')](_0x88d7('0x30'));};EmailImap[_0x88d7('0x10')][_0x88d7('0xe')]=function(_0x46632f,_0x182385){logger['error'](_0x88d7('0xe'),this[_0x88d7('0x9')][_0x88d7('0x7')],JSON[_0x88d7('0x36')](_0x46632f));var _0x1605ec='';if(_0x46632f){if(_0x46632f['textCode']){_0x1605ec=_0x46632f[_0x88d7('0x37')];}else{for(var _0x9fb30 in _0x46632f){if(_0x46632f[_0x88d7('0x38')](_0x9fb30)){_0x1605ec+=_[_0x88d7('0x39')](_0x9fb30)+':\x20'+_0x46632f[_0x9fb30]+'\x0a';}}}}if(_0x182385){this['imap']['end']();}else{this['emit'](_0x88d7('0xd'),_0x1605ec);this[_0x88d7('0x20')](_0x88d7('0x30'));}};module[_0x88d7('0x3a')]=EmailImap; \ No newline at end of file +var _0x5cd3=['once','end','handleEnd','error','handleError','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','host','port','tls','autotls','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','handleCloseBox','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','email','mailbox','account','getAccount','handleReady','bind'];(function(_0x3b56c0,_0xe100d8){var _0x377efe=function(_0x181589){while(--_0x181589){_0x3b56c0['push'](_0x3b56c0['shift']());}};_0x377efe(++_0xe100d8);}(_0x5cd3,0x65));var _0x35cd=function(_0x59dd54,_0x495d0a){_0x59dd54=_0x59dd54-0x0;var _0x1025d3=_0x5cd3[_0x59dd54];return _0x1025d3;};'use strict';var _=require(_0x35cd('0x0'));var util=require('util');var Imap=require(_0x35cd('0x1'));var simpleParser=require(_0x35cd('0x2'))[_0x35cd('0x3')];var Iconv=require(_0x35cd('0x4'))[_0x35cd('0x5')];var EventEmitter=require(_0x35cd('0x6'))[_0x35cd('0x7')];var utils=require(_0x35cd('0x8'));var logger=require('../../../config/logger')(_0x35cd('0x9'));function EmailImap(_0x3308a1,_0x2c3c1e){this['mailbox']=_0x3308a1[_0x35cd('0xa')];this[_0x35cd('0xb')]=this[_0x35cd('0xc')](_0x3308a1,_0x2c3c1e);this['imap']=new Imap(this[_0x35cd('0xb')]);this[_0x35cd('0x1')]['once']('ready',this[_0x35cd('0xd')][_0x35cd('0xe')](this));this[_0x35cd('0x1')][_0x35cd('0xf')](_0x35cd('0x10'),this[_0x35cd('0x11')]['bind'](this));this['imap']['on'](_0x35cd('0x12'),this[_0x35cd('0x13')][_0x35cd('0xe')](this));this[_0x35cd('0x1')]['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x35cd('0x14')][_0x35cd('0xc')]=function(_0x3ad599,_0x3873a8){var _0xbbcda4={'connTimeout':_0x3ad599[_0x35cd('0x15')]?_0x3ad599[_0x35cd('0x15')]*0x3e8:0x2710,'authTimeout':_0x3ad599['authTimeout']?_0x3ad599[_0x35cd('0x16')]*0x3e8:0x1388};if(_0x3ad599[_0x35cd('0x17')]){_0xbbcda4['user']=_0x3ad599[_0x35cd('0x18')];if(_0x3ad599[_0x35cd('0x19')]){_0xbbcda4[_0x35cd('0x1a')]=utils[_0x35cd('0x1b')](_0x3ad599[_0x35cd('0x1c')][_0x35cd('0x1d')],_0x3ad599[_0x35cd('0x18')]);}else{_0xbbcda4['password']=_0x3ad599['password'];}}else{if(_0x3ad599['authentication']){_0xbbcda4['user']=_0x3ad599['user'];_0xbbcda4[_0x35cd('0x1e')]=_0x3ad599[_0x35cd('0x1e')];}}_0xbbcda4[_0x35cd('0x9')]=_0x3873a8||_0x3ad599[_0x35cd('0x18')]||'anonymous@xcally.com';_0xbbcda4[_0x35cd('0x1f')]=_0x3ad599['host'];_0xbbcda4[_0x35cd('0x20')]=_0x3ad599[_0x35cd('0x20')]||0x3e1;if(_0x3ad599[_0x35cd('0x21')]){_0xbbcda4[_0x35cd('0x21')]=!![];}else{_0xbbcda4[_0x35cd('0x21')]=![];_0xbbcda4[_0x35cd('0x22')]='required';}return _0xbbcda4;};EmailImap[_0x35cd('0x14')][_0x35cd('0xd')]=function(){this[_0x35cd('0x1')]['openBox'](this[_0x35cd('0xa')],![],this['handleOpenBox']['bind'](this));};EmailImap[_0x35cd('0x14')]['handleOpenBox']=function(_0x2c40c0,_0x4178f0){if(_0x2c40c0){this[_0x35cd('0x13')](_0x2c40c0,!![]);}else{this[_0x35cd('0x23')](_0x35cd('0x24'),_0x4178f0);this[_0x35cd('0x25')]();}};EmailImap[_0x35cd('0x14')]['handleCloseBox']=function(_0x14442b){if(_0x14442b){this[_0x35cd('0x13')](_0x14442b,!![]);}else{this[_0x35cd('0x1')]['end']();}};EmailImap['prototype'][_0x35cd('0x25')]=function(){this[_0x35cd('0x1')][_0x35cd('0x26')]([_0x35cd('0x27')],this[_0x35cd('0x28')]['bind'](this));};EmailImap[_0x35cd('0x14')][_0x35cd('0x28')]=function(_0x5757d3,_0x10b6ff){if(_0x5757d3){this['handleError'](_0x5757d3,!![]);}else{if(_0x10b6ff[_0x35cd('0x29')]){try{var _0x48b576=this[_0x35cd('0x1')][_0x35cd('0x2a')](_0x10b6ff,{'bodies':'','markSeen':!![]});_0x48b576['on']('message',this['handleFetchMessage']['bind'](this));_0x48b576[_0x35cd('0xf')]('error',this[_0x35cd('0x2b')][_0x35cd('0xe')](this));_0x48b576[_0x35cd('0xf')](_0x35cd('0x10'),this[_0x35cd('0x2c')][_0x35cd('0xe')](this));}catch(_0x3b4675){logger['error'](_0x3b4675);}}else{this[_0x35cd('0x1')][_0x35cd('0x2d')](!![],this['handleCloseBox'][_0x35cd('0xe')](this));}}};EmailImap[_0x35cd('0x14')][_0x35cd('0x2e')]=function(_0x3a5379){_0x3a5379['on']('body',this[_0x35cd('0x2f')][_0x35cd('0xe')](this));_0x3a5379[_0x35cd('0xf')](_0x35cd('0x30'),this[_0x35cd('0x31')][_0x35cd('0xe')](this));_0x3a5379[_0x35cd('0xf')](_0x35cd('0x10'),this['handleMessageEnd'][_0x35cd('0xe')](this));};EmailImap[_0x35cd('0x14')][_0x35cd('0x2f')]=function(_0x2eb5bb){simpleParser(_0x2eb5bb,{'Iconv':Iconv},this[_0x35cd('0x32')][_0x35cd('0xe')](this));};EmailImap[_0x35cd('0x14')][_0x35cd('0x31')]=function(){};EmailImap['prototype'][_0x35cd('0x33')]=function(){};EmailImap[_0x35cd('0x14')]['handleSimpleParser']=function(_0x1924b1,_0x4dbc92){if(_0x1924b1){logger[_0x35cd('0x12')](_0x1924b1);}else{var _0x552d01=this;utils['parser'](this['account'],_0x4dbc92,function(_0x51fad9){_0x552d01[_0x35cd('0x23')](_0x35cd('0x9'),_0x51fad9);});}};EmailImap[_0x35cd('0x14')][_0x35cd('0x2c')]=function(){this['imap'][_0x35cd('0x2d')](!![],this[_0x35cd('0x34')][_0x35cd('0xe')](this));};EmailImap[_0x35cd('0x14')][_0x35cd('0x2b')]=function(_0x3f3e1e){this['handleError'](_0x3f3e1e);this[_0x35cd('0x1')][_0x35cd('0x2d')](!![],this[_0x35cd('0x34')]['bind'](this));};EmailImap[_0x35cd('0x14')]['handleEnd']=function(){this['emit'](_0x35cd('0x10'));};EmailImap[_0x35cd('0x14')][_0x35cd('0x13')]=function(_0x3e7672,_0x4db87c){logger[_0x35cd('0x12')]('handleError',this[_0x35cd('0xb')]['email'],JSON[_0x35cd('0x35')](_0x3e7672));var _0x112630='';if(_0x3e7672){if(_0x3e7672['textCode']){_0x112630=_0x3e7672[_0x35cd('0x36')];}else{for(var _0x2a823a in _0x3e7672){if(_0x3e7672[_0x35cd('0x37')](_0x2a823a)){_0x112630+=_[_0x35cd('0x38')](_0x2a823a)+':\x20'+_0x3e7672[_0x2a823a]+'\x0a';}}}}if(_0x4db87c){this[_0x35cd('0x1')][_0x35cd('0x10')]();}else{this[_0x35cd('0x23')](_0x35cd('0x12'),_0x112630);this[_0x35cd('0x23')](_0x35cd('0x10'));}};module[_0x35cd('0x39')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 0b980c6..038d11f 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 _0x3cf7=['exports','nodemailer','nodemailer-plugin-inline-base64','prototype','createTransport','use','compile','sendMail','toString','verify','Not\x20verifired'];(function(_0x51d092,_0x400f47){var _0x12a2c6=function(_0x63489f){while(--_0x63489f){_0x51d092['push'](_0x51d092['shift']());}};_0x12a2c6(++_0x400f47);}(_0x3cf7,0x1e5));var _0x73cf=function(_0x2af160,_0x765b1){_0x2af160=_0x2af160-0x0;var _0x439d67=_0x3cf7[_0x2af160];return _0x439d67;};'use strict';var nodemailer=require(_0x73cf('0x0'));var inlineBase64=require(_0x73cf('0x1'));function EmailSmtp(){}EmailSmtp[_0x73cf('0x2')]['send']=function(_0x3461f4,_0x5b0cc1){return new Promise(function(_0x303461,_0x599d7b){var _0x44548f=nodemailer[_0x73cf('0x3')](_0x3461f4);_0x44548f[_0x73cf('0x4')](_0x73cf('0x5'),inlineBase64());_0x44548f[_0x73cf('0x6')](_0x5b0cc1,function(_0x10386b,_0x586ffd){if(_0x10386b){_0x599d7b(_0x10386b[_0x73cf('0x7')]());}else{_0x303461(_0x586ffd);}});});};EmailSmtp[_0x73cf('0x2')][_0x73cf('0x8')]=function(_0x303be2){return new Promise(function(_0x1dfe5d,_0x2509e8){var _0x4f1ab4=nodemailer['createTransport'](_0x303be2);_0x4f1ab4[_0x73cf('0x8')](function(_0x8dec16,_0x546817){if(_0x8dec16){_0x2509e8(_0x8dec16[_0x73cf('0x7')]());}else{if(_0x546817){_0x1dfe5d(_0x546817);}else{_0x2509e8(_0x73cf('0x9'));}}});});};module[_0x73cf('0xa')]=EmailSmtp; \ No newline at end of file +var _0x9def=['nodemailer-plugin-inline-base64','prototype','send','compile','sendMail','verify','exports','nodemailer'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x9def,0x167));var _0xf9de=function(_0x5e947e,_0x19ccc8){_0x5e947e=_0x5e947e-0x0;var _0x3a8c3b=_0x9def[_0x5e947e];return _0x3a8c3b;};'use strict';var nodemailer=require(_0xf9de('0x0'));var inlineBase64=require(_0xf9de('0x1'));function EmailSmtp(){}EmailSmtp[_0xf9de('0x2')][_0xf9de('0x3')]=function(_0x35fc6b,_0x5acd02){return new Promise(function(_0x2f55f4,_0x43639f){var _0x591d02=nodemailer['createTransport'](_0x35fc6b);_0x591d02['use'](_0xf9de('0x4'),inlineBase64());_0x591d02[_0xf9de('0x5')](_0x5acd02,function(_0x26859d,_0x450171){if(_0x26859d){_0x43639f(_0x26859d['toString']());}else{_0x2f55f4(_0x450171);}});});};EmailSmtp[_0xf9de('0x2')][_0xf9de('0x6')]=function(_0x3cc15f){return new Promise(function(_0x48cf90,_0x1e3337){var _0xf622ec=nodemailer['createTransport'](_0x3cc15f);_0xf622ec['verify'](function(_0x3019c2,_0x10ec04){if(_0x3019c2){_0x1e3337(_0x3019c2['toString']());}else{if(_0x10ec04){_0x48cf90(_0x10ec04);}else{_0x1e3337('Not\x20verifired');}}});});};module[_0xf9de('0x7')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 9d720dc..2403435 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 _0xfa01=['YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','Attachments','Title','Data','

Empty\x20message

','generateXOAuth2Token','user=','utf-8','toString','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','@xcally.com','name','substring','length','Anonymous','split','pop','address','isEmpty','anonymous','generate','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','0x1?_0xee8f['slice'](0x0,-0x1)['join']('\x20'):_0x13b240['name'];}return _0x1fa0('0xf');}function getLastName(_0x9f861){var _0x308530=_['head'](_0x9f861[_0x1fa0('0xa')]);if(_0x308530&&_0x308530[_0x1fa0('0xc')]){var _0x4d305a=_0x308530['name'][_0x1fa0('0x10')](/\s+/);return _0x4d305a[_0x1fa0('0xe')]>0x1?_0x4d305a[_0x1fa0('0x11')]():'';}return'';}function getMails(_0x2703e2,_0xd4611d){var _0x52b417='';for(var _0x2ef30d=0x0;_0x2ef30d<_0xd4611d[_0x1fa0('0xa')][_0x1fa0('0xe')];_0x2ef30d+=0x1){if(_0xd4611d[_0x1fa0('0xa')][_0x2ef30d][_0x1fa0('0x12')]!==_0x2703e2){if(!_[_0x1fa0('0x13')](_0x52b417)){_0x52b417+=',';}_0x52b417+=_0xd4611d[_0x1fa0('0xa')][_0x2ef30d]['name']||_0xd4611d['value'][_0x2ef30d][_0x1fa0('0x12')]||'';_0x52b417+='\x20<';_0x52b417+=_0xd4611d['value'][_0x2ef30d][_0x1fa0('0x12')]?_0xd4611d['value'][_0x2ef30d][_0x1fa0('0x12')]:_0x1fa0('0x14')+random[_0x1fa0('0x15')](0x6)+_0x1fa0('0xb');_0x52b417+='>';}}return _0x52b417;}function parseEmail(_0x273a8d,_0x20340d,_0x43015b){if(_0x20340d[_0x1fa0('0x16')]){var _0x19b15d=/)<[^<]*)*<\/script>/gi;while(_0x19b15d[_0x1fa0('0x17')](_0x20340d['html'])){_0x20340d['html']=_0x20340d[_0x1fa0('0x16')][_0x1fa0('0x18')](_0x19b15d,'');}if(_0x20340d[_0x1fa0('0x16')][_0x1fa0('0x19')](_0x1fa0('0x1a'))){var _0x1dd727=[];_0x20340d[_0x1fa0('0x1b')]['forEach'](_0xedfd90=>{_0x1dd727[_0x1fa0('0x1c')](_0xedfd90[_0x1fa0('0x1d')]);});var _0x30f2a4=/]+>/g;var _0x17eb21=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x37ca18=_0x20340d[_0x1fa0('0x16')][_0x1fa0('0x18')](_0x17eb21,'_SRC');var _0x594031=_0x37ca18['replace'](_0x30f2a4,_0x1fa0('0x1e'));for(let _0x49cb0a=0x0;_0x49cb0a<_0x1dd727[_0x1fa0('0xe')];_0x49cb0a++){var _0x3f1c8a=_0x594031['replace'](_0x1fa0('0x1e'),_0x1fa0('0x1f')+_0x1dd727[_0x49cb0a]+_0x1fa0('0x20'));_0x594031=_0x3f1c8a;}_0x20340d[_0x1fa0('0x16')]=_0x594031;}_0x43015b[_0x1fa0('0x21')]=_0x20340d[_0x1fa0('0x16')];}else{_0x43015b[_0x1fa0('0x21')]=_0x20340d['textAsHtml'];}if(_0x43015b[_0x1fa0('0x21')]){_0x43015b[_0x1fa0('0x21')]=_0x43015b['body']['replace'](/0x0){var _0x18719d=[_0x1fa0('0x32'),_0x1fa0('0x33'),_0x1fa0('0x34')];for(var _0x822575=0x0;_0x822575<_0x20340d[_0x1fa0('0x31')]['length'];_0x822575++){var _0x1d4049=_['indexOf'](_0x18719d,_0x20340d['headerLines'][_0x822575]['line']);if(_0x1d4049>=0x0){_0x43015b[_0x1fa0('0x35')]=!![];}}}return _0x43015b;}exports[_0x1fa0('0x36')]=function(_0x164ae9,_0x4b236c,_0x96d5b0){var _0x314be6={'from':getAddress(_0x4b236c[_0x1fa0('0x37')]),'firstName':getFirstName(_0x4b236c['from']),'lastName':getLastName(_0x4b236c[_0x1fa0('0x37')]),'mapKey':_0x1fa0('0x7'),'message':{'from':getMails(_0x164ae9['email'],_0x4b236c['from']),'to':_0x164ae9[_0x1fa0('0x7')],'cc':'','subject':_0x4b236c[_0x1fa0('0x38')]||'','messageId':_0x4b236c[_0x1fa0('0x39')],'inReplyTo':_0x4b236c[_0x1fa0('0x3a')],'sentAt':moment(_0x4b236c[_0x1fa0('0x3b')])['format'](_0x1fa0('0x3c')),'attach':![],'attachments':[]}};if(!_0x4b236c[_0x1fa0('0x16')]&&!_0x4b236c[_0x1fa0('0x3d')]){var _0x219ec0=_[_0x1fa0('0x3e')](_0x4b236c[_0x1fa0('0x1b')],{'contentType':_0x1fa0('0x3f')});if(_0x219ec0[_0x1fa0('0xe')]){logger[_0x1fa0('0x40')](util[_0x1fa0('0x29')](_0x1fa0('0x41'),_0x4b236c[_0x1fa0('0x39')]));tnef[_0x1fa0('0x42')](_[_0x1fa0('0x43')](_0x219ec0)['content'],function(_0x508883,_0x1ca178){if(_0x1ca178){_0x4b236c[_0x1fa0('0x16')]=_0x1ca178[_0x1fa0('0x44')]||'

Empty\x20message

';if(_0x1ca178[_0x1fa0('0x45')]){for(var _0x421503=0x0;_0x421503<_0x1ca178[_0x1fa0('0x45')][_0x1fa0('0xe')];_0x421503++){var _0x5ddcdb=_0x1ca178[_0x1fa0('0x45')][_0x421503];_0x314be6[_0x1fa0('0x23')][_0x1fa0('0x1b')]['push']({'filename':_0x5ddcdb[_0x1fa0('0x46')],'content':Buffer[_0x1fa0('0x37')](_0x5ddcdb[_0x1fa0('0x47')])});}}}_0x96d5b0(parseEmail(_0x164ae9,_0x4b236c,_0x314be6));});}else{_0x4b236c[_0x1fa0('0x16')]=_0x1fa0('0x48');_0x96d5b0(parseEmail(_0x164ae9,_0x4b236c,_0x314be6));}}else{_0x96d5b0(parseEmail(_0x164ae9,_0x4b236c,_0x314be6));}};exports[_0x1fa0('0x49')]=function(_0x92cb18,_0x5cee4a){var _0x13704b=[_0x1fa0('0x4a')+(_0x5cee4a||''),'auth=Bearer\x20'+_0x92cb18,'',''];return Buffer[_0x1fa0('0x37')](_0x13704b[_0x1fa0('0x2c')](''),_0x1fa0('0x4b'))[_0x1fa0('0x4c')]('base64');}; \ No newline at end of file +var _0x28cb=['../../../config/environment','head','address','generate','@xcally.com','value','name','substring','indexOf','length','slice','join','split','pop','anonymous','html','includes','','body','Empty\x20message

','Attachments','Title','generateXOAuth2Token','user=','utf-8','toString','lodash','moment','randomstring','util','node-tnef','../../../config/logger','email'];(function(_0x5837b2,_0x404be4){var _0x56435d=function(_0x2f5d4d){while(--_0x2f5d4d){_0x5837b2['push'](_0x5837b2['shift']());}};_0x56435d(++_0x404be4);}(_0x28cb,0xce));var _0xb28c=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x28cb[_0x3511d3];return _0x5d6321;};'use strict';var _=require(_0xb28c('0x0'));var moment=require(_0xb28c('0x1'));var random=require(_0xb28c('0x2'));var fs=require('fs');var path=require('path');var util=require(_0xb28c('0x3'));var tnef=require(_0xb28c('0x4'));var logger=require(_0xb28c('0x5'))(_0xb28c('0x6'));var config=require(_0xb28c('0x7'));function getAddress(_0x34184b){var _0x8fc7ba=_[_0xb28c('0x8')](_0x34184b['value']);return _0x8fc7ba&&_0x8fc7ba[_0xb28c('0x9')]?_0x8fc7ba[_0xb28c('0x9')]:'anonymous'+random[_0xb28c('0xa')](0x6)+_0xb28c('0xb');}function getFirstName(_0x56291b){var _0x4174ba=_[_0xb28c('0x8')](_0x56291b[_0xb28c('0xc')]);if(_0x4174ba&&_0x4174ba[_0xb28c('0xd')]){if(_0x4174ba['name']==_0x4174ba['address']){return _0x4174ba[_0xb28c('0xd')][_0xb28c('0xe')](0x0,_0x4174ba[_0xb28c('0xd')][_0xb28c('0xf')]('@'));}var _0x422cf9=_0x4174ba['name']['split'](/\s+/);return _0x422cf9[_0xb28c('0x10')]>0x1?_0x422cf9[_0xb28c('0x11')](0x0,-0x1)[_0xb28c('0x12')]('\x20'):_0x4174ba['name'];}return'Anonymous';}function getLastName(_0x2e578f){var _0x3d19bb=_['head'](_0x2e578f[_0xb28c('0xc')]);if(_0x3d19bb&&_0x3d19bb['name']){var _0x467af0=_0x3d19bb[_0xb28c('0xd')][_0xb28c('0x13')](/\s+/);return _0x467af0[_0xb28c('0x10')]>0x1?_0x467af0[_0xb28c('0x14')]():'';}return'';}function getMails(_0x338983,_0x4ac793){var _0x103b2d='';for(var _0x51feb1=0x0;_0x51feb1<_0x4ac793[_0xb28c('0xc')][_0xb28c('0x10')];_0x51feb1+=0x1){if(_0x4ac793[_0xb28c('0xc')][_0x51feb1][_0xb28c('0x9')]!==_0x338983){if(!_['isEmpty'](_0x103b2d)){_0x103b2d+=',';}_0x103b2d+=_0x4ac793['value'][_0x51feb1]['name']||_0x4ac793[_0xb28c('0xc')][_0x51feb1]['address']||'';_0x103b2d+='\x20<';_0x103b2d+=_0x4ac793[_0xb28c('0xc')][_0x51feb1][_0xb28c('0x9')]?_0x4ac793[_0xb28c('0xc')][_0x51feb1][_0xb28c('0x9')]:_0xb28c('0x15')+random[_0xb28c('0xa')](0x6)+_0xb28c('0xb');_0x103b2d+='>';}}return _0x103b2d;}function parseEmail(_0x2fb1cf,_0x561237,_0x17d832){if(_0x561237[_0xb28c('0x16')]){var _0xc8345b=/)<[^<]*)*<\/script>/gi;while(_0xc8345b['test'](_0x561237[_0xb28c('0x16')])){_0x561237[_0xb28c('0x16')]=_0x561237['html']['replace'](_0xc8345b,'');}if(_0x561237[_0xb28c('0x16')][_0xb28c('0x17')](_0xb28c('0x18'))){var _0x39cca9=[];_0x561237[_0xb28c('0x19')][_0xb28c('0x1a')](_0x180fdb=>{_0x39cca9[_0xb28c('0x1b')](_0x180fdb['filename']);});var _0x5c8033=/]+>/g;var _0x445fdf=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5594f5=_0x561237[_0xb28c('0x16')][_0xb28c('0x1c')](_0x445fdf,'_SRC');var _0x3c5b2e=_0x5594f5[_0xb28c('0x1c')](_0x5c8033,_0xb28c('0x1d'));for(let _0x3587c4=0x0;_0x3587c4<_0x39cca9[_0xb28c('0x10')];_0x3587c4++){var _0x146bb5=_0x3c5b2e[_0xb28c('0x1c')](_0xb28c('0x1d'),'\x20[Attachment:\x20'+_0x39cca9[_0x3587c4]+_0xb28c('0x1e'));_0x3c5b2e=_0x146bb5;}_0x561237['html']=_0x3c5b2e;}_0x17d832['body']=_0x561237[_0xb28c('0x16')];}else{_0x17d832[_0xb28c('0x1f')]=_0x561237['textAsHtml'];}if(_0x17d832[_0xb28c('0x1f')]){_0x17d832[_0xb28c('0x1f')]=_0x17d832[_0xb28c('0x1f')][_0xb28c('0x1c')](/0x0){var _0x15b8bb=[_0xb28c('0x31'),'X-Auto-Response-Suppress:\x20All',_0xb28c('0x32')];for(var _0x48424d=0x0;_0x48424d<_0x561237[_0xb28c('0x30')]['length'];_0x48424d++){var _0x478e87=_['indexOf'](_0x15b8bb,_0x561237[_0xb28c('0x30')][_0x48424d][_0xb28c('0x33')]);if(_0x478e87>=0x0){_0x17d832[_0xb28c('0x34')]=!![];}}}return _0x17d832;}exports[_0xb28c('0x35')]=function(_0x511f12,_0x48b470,_0x57cd9f){var _0x3d3410={'from':getAddress(_0x48b470[_0xb28c('0x36')]),'firstName':getFirstName(_0x48b470[_0xb28c('0x36')]),'lastName':getLastName(_0x48b470['from']),'mapKey':_0xb28c('0x6'),'message':{'from':getMails(_0x511f12['email'],_0x48b470[_0xb28c('0x36')]),'to':_0x511f12['email'],'cc':'','subject':_0x48b470[_0xb28c('0x37')]||'','messageId':_0x48b470[_0xb28c('0x38')],'inReplyTo':_0x48b470['inReplyTo'],'sentAt':moment(_0x48b470[_0xb28c('0x39')])[_0xb28c('0x28')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x48b470[_0xb28c('0x16')]&&!_0x48b470[_0xb28c('0x3a')]){var _0x38a5c8=_[_0xb28c('0x3b')](_0x48b470[_0xb28c('0x19')],{'contentType':_0xb28c('0x3c')});if(_0x38a5c8['length']){logger[_0xb28c('0x3d')](util[_0xb28c('0x28')](_0xb28c('0x3e'),_0x48b470[_0xb28c('0x38')]));tnef[_0xb28c('0x3f')](_['first'](_0x38a5c8)['content'],function(_0x157e55,_0x1b1b34){if(_0x1b1b34){_0x48b470['html']=_0x1b1b34['BodyHTML']||_0xb28c('0x40');if(_0x1b1b34['Attachments']){for(var _0x25e34e=0x0;_0x25e34e<_0x1b1b34[_0xb28c('0x41')][_0xb28c('0x10')];_0x25e34e++){var _0xeef56=_0x1b1b34[_0xb28c('0x41')][_0x25e34e];_0x3d3410[_0xb28c('0x21')]['attachments'][_0xb28c('0x1b')]({'filename':_0xeef56[_0xb28c('0x42')],'content':Buffer['from'](_0xeef56['Data'])});}}}_0x57cd9f(parseEmail(_0x511f12,_0x48b470,_0x3d3410));});}else{_0x48b470[_0xb28c('0x16')]=_0xb28c('0x40');_0x57cd9f(parseEmail(_0x511f12,_0x48b470,_0x3d3410));}}else{_0x57cd9f(parseEmail(_0x511f12,_0x48b470,_0x3d3410));}};exports[_0xb28c('0x43')]=function(_0x4f190e,_0x4b6057){var _0x2691fd=[_0xb28c('0x44')+(_0x4b6057||''),'auth=Bearer\x20'+_0x4f190e,'',''];return Buffer['from'](_0x2691fd[_0xb28c('0x12')](''),_0xb28c('0x45'))[_0xb28c('0x46')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 6f980dc..9eed77c 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 _0x37ef=['active','Imap','Smtp','exports','lodash','name','Service','key','SERV'];(function(_0xf00c1f,_0xb8aec3){var _0x5a41fc=function(_0xb51dbb){while(--_0xb51dbb){_0xf00c1f['push'](_0xf00c1f['shift']());}};_0x5a41fc(++_0xb8aec3);}(_0x37ef,0x16c));var _0xf37e=function(_0x243c94,_0x156778){_0x243c94=_0x243c94-0x0;var _0x33624f=_0x37ef[_0x243c94];return _0x33624f;};'use strict';var _=require(_0xf37e('0x0'));function MailAccount(_0x3ffce4){this['id']=_0x3ffce4['id']||0x0;this[_0xf37e('0x1')]=_0x3ffce4[_0xf37e('0x1')]||_0xf37e('0x2');this['key']=_0x3ffce4[_0xf37e('0x3')]||_0xf37e('0x4');this[_0xf37e('0x5')]=_0x3ffce4[_0xf37e('0x5')]||![];this['Imap']=_0x3ffce4[_0xf37e('0x6')]||[];this[_0xf37e('0x7')]=_0x3ffce4[_0xf37e('0x7')]||[];}module[_0xf37e('0x8')]=MailAccount; \ No newline at end of file +var _0x56fd=['SERV','active','Imap','Smtp','exports','name','key'];(function(_0x4d0373,_0x3ad5ea){var _0x2f301d=function(_0x372302){while(--_0x372302){_0x4d0373['push'](_0x4d0373['shift']());}};_0x2f301d(++_0x3ad5ea);}(_0x56fd,0x101));var _0xd56f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x56fd[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');function MailAccount(_0x47d69c){this['id']=_0x47d69c['id']||0x0;this[_0xd56f('0x0')]=_0x47d69c['name']||'Service';this[_0xd56f('0x1')]=_0x47d69c[_0xd56f('0x1')]||_0xd56f('0x2');this[_0xd56f('0x3')]=_0x47d69c['active']||![];this[_0xd56f('0x4')]=_0x47d69c[_0xd56f('0x4')]||[];this[_0xd56f('0x5')]=_0x47d69c['Smtp']||[];}module[_0xd56f('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 163c270..85f7b57 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 _0x572d=['mailAccounts','mapKeys','hasOwnProperty','prototype','initMailAccounts','length','isUndefined','merge','exports','lodash','../model/mailAccount'];(function(_0x2c6a0d,_0x28a135){var _0x4f9bde=function(_0x2e0f3d){while(--_0x2e0f3d){_0x2c6a0d['push'](_0x2c6a0d['shift']());}};_0x4f9bde(++_0x28a135);}(_0x572d,0x174));var _0xd572=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x572d[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xd572('0x0'));var MailAccount=require(_0xd572('0x1'));var Realtime=function(){this[_0xd572('0x2')]={};};function freeIsNotKey(_0x400f90,_0x5cb1f9,_0x49e860){var _0xdaa4e3=_[_0xd572('0x3')](_0x400f90,function(_0x24cfc7,_0x14a201){return _0x24cfc7[_0x49e860];});for(var _0x3747b9 in _0x5cb1f9){if(_0x5cb1f9[_0xd572('0x4')](_0x3747b9)){if(!_0xdaa4e3[_0x3747b9]){delete _0x5cb1f9[_0x3747b9];}}}}Realtime[_0xd572('0x5')]['mergeFromDatabase']=function(_0x302ffc,_0x1433d2){for(var _0x833363 in _0x1433d2){if(_0x302ffc[_0xd572('0x4')](_0x833363)){_0x302ffc[_0x833363]=_0x1433d2[_0x833363];}}};Realtime[_0xd572('0x5')][_0xd572('0x6')]=function(){var _0x2e0104=this;return function(_0x2c25cf){if(_0x2c25cf){freeIsNotKey(_0x2c25cf,_0x2e0104[_0xd572('0x2')],'id');for(var _0xb481b2=0x0,_0x502d78={},_0x324a4a={};_0xb481b2<_0x2c25cf[_0xd572('0x7')];_0xb481b2+=0x1){_0x502d78=_0x2c25cf[_0xb481b2];if(_[_0xd572('0x8')](_0x2e0104[_0xd572('0x2')][_0x502d78['id']])){_0x2e0104[_0xd572('0x2')][_0x502d78['id']]=new MailAccount(_0x502d78);}else{_[_0xd572('0x9')](_0x2e0104['mailAccounts'][_0x502d78['id']],_0x502d78);}}}return _0x2e0104[_0xd572('0x2')];};};module[_0xd572('0xa')]=Realtime; \ No newline at end of file +var _0x9f77=['prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','merge','mailAccounts','mapKeys','hasOwnProperty'];(function(_0x525f73,_0x5cf7e6){var _0xbc7f27=function(_0x28c9c3){while(--_0x28c9c3){_0x525f73['push'](_0x525f73['shift']());}};_0xbc7f27(++_0x5cf7e6);}(_0x9f77,0x1b6));var _0x79f7=function(_0x2b08ea,_0x28ad45){_0x2b08ea=_0x2b08ea-0x0;var _0x46474d=_0x9f77[_0x2b08ea];return _0x46474d;};'use strict';var _=require('lodash');var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x79f7('0x0')]={};};function freeIsNotKey(_0x14a7dd,_0x3bd5eb,_0x302de0){var _0x6372d9=_[_0x79f7('0x1')](_0x14a7dd,function(_0x4dbf91,_0x5d36c4){return _0x4dbf91[_0x302de0];});for(var _0x53af1c in _0x3bd5eb){if(_0x3bd5eb[_0x79f7('0x2')](_0x53af1c)){if(!_0x6372d9[_0x53af1c]){delete _0x3bd5eb[_0x53af1c];}}}}Realtime[_0x79f7('0x3')][_0x79f7('0x4')]=function(_0x3d4dcc,_0x21d6c7){for(var _0x4bc861 in _0x21d6c7){if(_0x3d4dcc[_0x79f7('0x2')](_0x4bc861)){_0x3d4dcc[_0x4bc861]=_0x21d6c7[_0x4bc861];}}};Realtime['prototype'][_0x79f7('0x5')]=function(){var _0x180e1d=this;return function(_0x148a29){if(_0x148a29){freeIsNotKey(_0x148a29,_0x180e1d['mailAccounts'],'id');for(var _0xe6fbf2=0x0,_0x2afed9={},_0x5bcb3a={};_0xe6fbf2<_0x148a29[_0x79f7('0x6')];_0xe6fbf2+=0x1){_0x2afed9=_0x148a29[_0xe6fbf2];if(_[_0x79f7('0x7')](_0x180e1d[_0x79f7('0x0')][_0x2afed9['id']])){_0x180e1d[_0x79f7('0x0')][_0x2afed9['id']]=new MailAccount(_0x2afed9);}else{_[_0x79f7('0x8')](_0x180e1d[_0x79f7('0x0')][_0x2afed9['id']],_0x2afed9);}}}return _0x180e1d[_0x79f7('0x0')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 2b89444..80048ea 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 _0xb96d=['service','email','ListId','TemplateId','MailServerIn','Imap','name','data5','MailServerOut','Smtp','CloudProvider','getMailAccount','notify','NotifyMailAccount','getMailAccounts','Request','GetMailAccount','provider'];(function(_0x49c095,_0x5815b7){var _0x3a2006=function(_0x1d03c5){while(--_0x1d03c5){_0x49c095['push'](_0x49c095['shift']());}};_0x3a2006(++_0x5815b7);}(_0xb96d,0x9e));var _0xdb96=function(_0x1aba25,_0x1faed1){_0x1aba25=_0x1aba25-0x0;var _0x47d997=_0xb96d[_0x1aba25];return _0x47d997;};'use strict';var client=require('../client');exports[_0xdb96('0x0')]=function(){return function(){return client[_0xdb96('0x1')](_0xdb96('0x2'),{'options':{'attributes':['id','name',_0xdb96('0x3'),_0xdb96('0x4'),_0xdb96('0x5'),'active','key',_0xdb96('0x6'),_0xdb96('0x7')],'raw':![],'include':[{'model':_0xdb96('0x8'),'as':_0xdb96('0x9'),'include':[{'model':'CloudProvider','attributes':['id',_0xdb96('0xa'),_0xdb96('0x4'),'type',_0xdb96('0xb')],'as':'CloudProvider'}]},{'model':_0xdb96('0xc'),'as':_0xdb96('0xd'),'include':[{'model':'CloudProvider','attributes':['id',_0xdb96('0xa'),_0xdb96('0x4'),'type',_0xdb96('0xb')],'as':_0xdb96('0xe')}]}]},'log':_0xdb96('0xf')});};};exports[_0xdb96('0x10')]=function(_0x47c94d,_0xa18db8){return client[_0xdb96('0x1')](_0xdb96('0x11'),{'account':{'id':_0x47c94d},'body':_0xa18db8,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0xfd20=['TemplateId','MailServerIn','Imap','service','type','data5','CloudProvider','MailServerOut','Smtp','notify','Request','NotifyMailAccount','getMailAccounts','name','provider','email','key','ListId'];(function(_0x1d66d3,_0x5df4ab){var _0x4e1775=function(_0x882329){while(--_0x882329){_0x1d66d3['push'](_0x1d66d3['shift']());}};_0x4e1775(++_0x5df4ab);}(_0xfd20,0x66));var _0x0fd2=function(_0x4cfc1d,_0x2c0927){_0x4cfc1d=_0x4cfc1d-0x0;var _0x1c01a0=_0xfd20[_0x4cfc1d];return _0x1c01a0;};'use strict';var client=require('../client');exports[_0x0fd2('0x0')]=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id',_0x0fd2('0x1'),_0x0fd2('0x2'),'service',_0x0fd2('0x3'),'active',_0x0fd2('0x4'),_0x0fd2('0x5'),_0x0fd2('0x6')],'raw':![],'include':[{'model':_0x0fd2('0x7'),'as':_0x0fd2('0x8'),'include':[{'model':'CloudProvider','attributes':['id','name',_0x0fd2('0x9'),_0x0fd2('0xa'),_0x0fd2('0xb')],'as':_0x0fd2('0xc')}]},{'model':_0x0fd2('0xd'),'as':_0x0fd2('0xe'),'include':[{'model':_0x0fd2('0xc'),'attributes':['id','name',_0x0fd2('0x9'),_0x0fd2('0xa'),'data5'],'as':_0x0fd2('0xc')}]}]},'log':'getMailAccount'});};};exports[_0x0fd2('0xf')]=function(_0x2222c4,_0x42ea5c){return client[_0x0fd2('0x10')](_0x0fd2('0x11'),{'account':{'id':_0x2222c4},'body':_0x42ea5c,'log':_0x0fd2('0x11')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 34473a5..8ffa850 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 _0xee33=['ShowSetting','loginMailFrequency','GetSettings','../client','getSettings','Request'];(function(_0x708535,_0xbd6bbf){var _0x55247d=function(_0x405cd7){while(--_0x405cd7){_0x708535['push'](_0x708535['shift']());}};_0x55247d(++_0xbd6bbf);}(_0xee33,0xa5));var _0x3ee3=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xee33[_0x102e37];return _0x35a07c;};'use strict';var client=require(_0x3ee3('0x0'));exports[_0x3ee3('0x1')]=function(){return client[_0x3ee3('0x2')](_0x3ee3('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3ee3('0x4')]},'log':_0x3ee3('0x5')});}; \ No newline at end of file +var _0x7446=['ShowSetting','loginMailFrequency','../client','getSettings'];(function(_0x4e8d1f,_0x3d69f9){var _0x1badc8=function(_0x47a205){while(--_0x47a205){_0x4e8d1f['push'](_0x4e8d1f['shift']());}};_0x1badc8(++_0x3d69f9);}(_0x7446,0x16a));var _0x6744=function(_0x1060bf,_0x3a6714){_0x1060bf=_0x1060bf-0x0;var _0x29a948=_0x7446[_0x1060bf];return _0x29a948;};'use strict';var client=require(_0x6744('0x0'));exports[_0x6744('0x1')]=function(){return client['Request'](_0x6744('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x6744('0x3')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 33d7fd8..715c701 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(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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 7319b69..4290e95 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 _0x5d88=['sticky-session','ioredis','../../config/environment','createServer','timeout','listen','socket.io','websocket','polling','defaults','redis','localhost','adapter','socket.io-redis','default','../../config/socketio','../../config/express','../../routes','once','log','port','exports','lodash','http'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x5d88,0x14e));var _0x85d8=function(_0x42e083,_0x204d47){_0x42e083=_0x42e083-0x0;var _0x57b25f=_0x5d88[_0x42e083];return _0x57b25f;};'use strict';var _=require(_0x85d8('0x0'));var http=require(_0x85d8('0x1'));var express=require('express');var sticky=require(_0x85d8('0x2'));var Redis=require(_0x85d8('0x3'));var config=require(_0x85d8('0x4'));var app=express();var server=http[_0x85d8('0x5')](app);server[_0x85d8('0x6')]=0xdbba0;if(sticky[_0x85d8('0x7')](server,config['port'])){var socketio=require(_0x85d8('0x8'))(server,{'transports':[_0x85d8('0x9'),_0x85d8('0xa')]});config['redis']=_[_0x85d8('0xb')](config[_0x85d8('0xc')],{'host':_0x85d8('0xd'),'port':0x18eb});socketio[_0x85d8('0xe')](require(_0x85d8('0xf'))({'pubClient':new Redis(config[_0x85d8('0xc')]),'subClient':new Redis(config[_0x85d8('0xc')])}));require('../../config/triggers')[_0x85d8('0x10')]();require(_0x85d8('0x11'))[_0x85d8('0x10')](socketio);require(_0x85d8('0x12'))[_0x85d8('0x10')](app);require(_0x85d8('0x13'))[_0x85d8('0x10')](app);}else{server[_0x85d8('0x14')]('listening',function(){console[_0x85d8('0x15')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x85d8('0x16')]);});}exports=module[_0x85d8('0x17')]=app; \ No newline at end of file +var _0xe3ee=['Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','ioredis','../../config/environment','timeout','listen','port','socket.io','polling','redis','localhost','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','log'];(function(_0x3d7ebf,_0x20b6e8){var _0x3fe0d7=function(_0x2701bd){while(--_0x2701bd){_0x3d7ebf['push'](_0x3d7ebf['shift']());}};_0x3fe0d7(++_0x20b6e8);}(_0xe3ee,0x162));var _0xee3e=function(_0x54ff19,_0x5757f2){_0x54ff19=_0x54ff19-0x0;var _0x31fbac=_0xe3ee[_0x54ff19];return _0x31fbac;};'use strict';var _=require(_0xee3e('0x0'));var http=require(_0xee3e('0x1'));var express=require('express');var sticky=require('sticky-session');var Redis=require(_0xee3e('0x2'));var config=require(_0xee3e('0x3'));var app=express();var server=http['createServer'](app);server[_0xee3e('0x4')]=0xdbba0;if(sticky[_0xee3e('0x5')](server,config[_0xee3e('0x6')])){var socketio=require(_0xee3e('0x7'))(server,{'transports':['websocket',_0xee3e('0x8')]});config[_0xee3e('0x9')]=_['defaults'](config[_0xee3e('0x9')],{'host':_0xee3e('0xa'),'port':0x18eb});socketio['adapter'](require(_0xee3e('0xb'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config['redis'])}));require(_0xee3e('0xc'))[_0xee3e('0xd')]();require(_0xee3e('0xe'))[_0xee3e('0xd')](socketio);require(_0xee3e('0xf'))[_0xee3e('0xd')](app);require(_0xee3e('0x10'))[_0xee3e('0xd')](app);}else{server[_0xee3e('0x11')](_0xee3e('0x12'),function(){console[_0xee3e('0x13')](_0xee3e('0x14'),config[_0xee3e('0x6')]);});}exports=module[_0xee3e('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index a3f825d..41e684c 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 _0x765b=['client','http','Request','request','then','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x350188,_0x4a8627){var _0x20ddb0=function(_0x5af728){while(--_0x5af728){_0x350188['push'](_0x350188['shift']());}};_0x20ddb0(++_0x4a8627);}(_0x765b,0x137));var _0xb765=function(_0x41d02a,_0x355e19){_0x41d02a=_0x41d02a-0x0;var _0x4c3983=_0x765b[_0x41d02a];return _0x4c3983;};'use strict';var jayson=require(_0xb765('0x0'));var BPromise=require(_0xb765('0x1'));var logger=require(_0xb765('0x2'))(_0xb765('0x3'));var client=jayson[_0xb765('0x4')][_0xb765('0x5')]({'port':0x2329});client[_0xb765('0x6')]=function(_0x4c5f34,_0x3082ca){return new BPromise(function(_0x9d4115,_0x557bae){return client[_0xb765('0x7')](_0x4c5f34,_0x3082ca)[_0xb765('0x8')](function(_0xfe300e){logger['debug'](_0xb765('0x9'),'routing',_0x4c5f34,_0x3082ca,_0xfe300e);if(_0xfe300e['error']){logger[_0xb765('0xa')](_0xb765('0x9'),'routing',_0x4c5f34,_0xfe300e[_0xb765('0xa')][_0xb765('0xb')],_0x3082ca);return _0x557bae(_0xfe300e[_0xb765('0xa')]['message']);}else{return _0x9d4115(_0xfe300e[_0xb765('0xc')]);}})[_0xb765('0xd')](function(_0x1f0ce2){logger[_0xb765('0xa')]('rpc',_0xb765('0x3'),_0x4c5f34,_0x1f0ce2,_0x3082ca);return _0x557bae(_0x1f0ce2);});});};module[_0xb765('0xe')]=client; \ No newline at end of file +var _0x69b9=['error','message','result','catch','exports','bluebird','client','http','Request','debug','rpc','routing'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x69b9,0xdd));var _0x969b=function(_0x4cbac4,_0xd048c9){_0x4cbac4=_0x4cbac4-0x0;var _0x49203b=_0x69b9[_0x4cbac4];return _0x49203b;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x969b('0x0'));var logger=require('../../config/logger')('routing');var client=jayson[_0x969b('0x1')][_0x969b('0x2')]({'port':0x2329});client[_0x969b('0x3')]=function(_0x5649df,_0x2a2c76){return new BPromise(function(_0x385d11,_0x445832){return client['request'](_0x5649df,_0x2a2c76)['then'](function(_0x2426c6){logger[_0x969b('0x4')](_0x969b('0x5'),_0x969b('0x6'),_0x5649df,_0x2a2c76,_0x2426c6);if(_0x2426c6[_0x969b('0x7')]){logger['error']('rpc','routing',_0x5649df,_0x2426c6[_0x969b('0x7')]['message'],_0x2a2c76);return _0x445832(_0x2426c6[_0x969b('0x7')][_0x969b('0x8')]);}else{return _0x385d11(_0x2426c6[_0x969b('0x9')]);}})[_0x969b('0xa')](function(_0x2273de){logger[_0x969b('0x7')](_0x969b('0x5'),'routing',_0x5649df,_0x2273de,_0x2a2c76);return _0x445832(_0x2273de);});});};module[_0x969b('0xb')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index ecec213..621e735 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 _0x9359=['getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','listen','catch','log','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','getAgents','initAgents','then','getIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x9359,0x1dc));var _0x9935=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9359[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require('bluebird');var server=require(_0x9935('0x0'));var Realtime=require(_0x9935('0x1'));var user=require(_0x9935('0x2'));var interval=require(_0x9935('0x3'));var openchannelQueue=require(_0x9935('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x9935('0x5'));var faxQueue=require(_0x9935('0x6'));var whatsappQueue=require(_0x9935('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x9935('0x8')]()['then'](user[_0x9935('0x9')]())['then'](realtime[_0x9935('0xa')]())[_0x9935('0xb')](interval[_0x9935('0xc')]())[_0x9935('0xb')](realtime['initIntervals']())[_0x9935('0xb')](openchannelQueue[_0x9935('0xd')]())['then'](realtime['initOpenchannelQueues']())[_0x9935('0xb')](chatQueue[_0x9935('0xe')]())[_0x9935('0xb')](realtime[_0x9935('0xf')]())[_0x9935('0xb')](smsQueue[_0x9935('0x10')]())[_0x9935('0xb')](realtime[_0x9935('0x11')]())['then'](mailQueue[_0x9935('0x12')]())[_0x9935('0xb')](realtime[_0x9935('0x13')]())[_0x9935('0xb')](faxQueue[_0x9935('0x14')]())[_0x9935('0xb')](realtime[_0x9935('0x15')]())[_0x9935('0xb')](whatsappQueue['getWhatsappQueues']())['then'](realtime[_0x9935('0x16')]())[_0x9935('0xb')](function(){return realtime;});}function main(){return server[_0x9935('0x17')](realtime)[_0x9935('0xb')](function(_0x1bde8b){return initRealtime();})[_0x9935('0xb')](function(_0x3ab717){return setInterval(initRealtime,0x1388);})[_0x9935('0x18')](function(_0x6d1c7a){console[_0x9935('0x19')](_0x6d1c7a);});}main(); \ No newline at end of file +var _0xa831=['listen','log','bluebird','./server','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','initAgents','then','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues'];(function(_0x24f18b,_0x71b965){var _0x290399=function(_0x1e126a){while(--_0x1e126a){_0x24f18b['push'](_0x24f18b['shift']());}};_0x290399(++_0x71b965);}(_0xa831,0x1dd));var _0x1a83=function(_0x5341ff,_0x1de6df){_0x5341ff=_0x5341ff-0x0;var _0x53be58=_0xa831[_0x5341ff];return _0x53be58;};'use strict';var BPromise=require(_0x1a83('0x0'));var server=require(_0x1a83('0x1'));var Realtime=require('./realtime');var user=require(_0x1a83('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x1a83('0x3'));var chatQueue=require(_0x1a83('0x4'));var smsQueue=require(_0x1a83('0x5'));var mailQueue=require(_0x1a83('0x6'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x1a83('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x1a83('0x8')]()['then'](user['getAgents']())['then'](realtime[_0x1a83('0x9')]())[_0x1a83('0xa')](interval[_0x1a83('0xb')]())[_0x1a83('0xa')](realtime[_0x1a83('0xc')]())[_0x1a83('0xa')](openchannelQueue['getOpenchannelQueues']())[_0x1a83('0xa')](realtime[_0x1a83('0xd')]())[_0x1a83('0xa')](chatQueue[_0x1a83('0xe')]())[_0x1a83('0xa')](realtime['initChatQueues']())[_0x1a83('0xa')](smsQueue[_0x1a83('0xf')]())[_0x1a83('0xa')](realtime[_0x1a83('0x10')]())[_0x1a83('0xa')](mailQueue[_0x1a83('0x11')]())[_0x1a83('0xa')](realtime[_0x1a83('0x12')]())['then'](faxQueue[_0x1a83('0x13')]())[_0x1a83('0xa')](realtime[_0x1a83('0x14')]())[_0x1a83('0xa')](whatsappQueue[_0x1a83('0x15')]())[_0x1a83('0xa')](realtime[_0x1a83('0x16')]())[_0x1a83('0xa')](function(){return realtime;});}function main(){return server[_0x1a83('0x17')](realtime)[_0x1a83('0xa')](function(_0xe03227){return initRealtime();})['then'](function(_0x17b502){return setInterval(initRealtime,0x1388);})['catch'](function(_0x38a8f6){console[_0x1a83('0x18')](_0x38a8f6);});}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 aa03cf5..7806996 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 _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1261,0x144));var _0x1126=function(_0x31c796,_0x2e3c7f){_0x31c796=_0x31c796-0x0;var _0x128356=_0x1261[_0x31c796];return _0x128356;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file +var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x399719,_0x232b0f){var _0x1bd3e9=function(_0x2fad56){while(--_0x2fad56){_0x399719['push'](_0x399719['shift']());}};_0x1bd3e9(++_0x232b0f);}(_0x326f,0xd1));var _0xf326=function(_0x4f4484,_0x28dc23){_0x4f4484=_0x4f4484-0x0;var _0x3a3bb1=_0x326f[_0x4f4484];return _0x3a3bb1;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};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 5d0f37e..61a0b28 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 _0xe9ce=['message','catch','sendMailMessage','SendMail','bluebird','jayson/promise','then','error'];(function(_0xee2b01,_0x2bb78e){var _0x598107=function(_0x4be3c6){while(--_0x4be3c6){_0xee2b01['push'](_0xee2b01['shift']());}};_0x598107(++_0x2bb78e);}(_0xe9ce,0x1b4));var _0xee9c=function(_0x438bf8,_0x18ce5f){_0x438bf8=_0x438bf8-0x0;var _0x9aad1a=_0xe9ce[_0x438bf8];return _0x9aad1a;};'use strict';var BPromise=require(_0xee9c('0x0'));var jayson=require(_0xee9c('0x1'));var client=jayson['client']['http']({'port':0x232b});function request(_0x2382eb,_0x477242){return new BPromise(function(_0x52cc33,_0x53d51f){return client['request'](_0x2382eb,_0x477242)[_0xee9c('0x2')](function(_0x4f88a7){if(_0x4f88a7['error']){return _0x53d51f(_0x4f88a7[_0xee9c('0x3')][_0xee9c('0x4')]);}else{return _0x52cc33(_0x4f88a7['result']);}})[_0xee9c('0x5')](function(_0x2c5350){return _0x53d51f(_0x2c5350);});});}exports[_0xee9c('0x6')]=function(_0x152e5d,_0x39239e){return request(_0xee9c('0x7'),{'account':_0x152e5d,'message':_0x39239e});}; \ No newline at end of file +var _0x0e57=['error','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','request','then'];(function(_0x3a4397,_0x13e650){var _0x1a8c44=function(_0x46713f){while(--_0x46713f){_0x3a4397['push'](_0x3a4397['shift']());}};_0x1a8c44(++_0x13e650);}(_0x0e57,0x95));var _0x70e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0e57[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x70e5('0x0'));var jayson=require(_0x70e5('0x1'));var client=jayson['client']['http']({'port':0x232b});function request(_0x5c563c,_0x5c9eea){return new BPromise(function(_0x2830ae,_0x2e7193){return client[_0x70e5('0x2')](_0x5c563c,_0x5c9eea)[_0x70e5('0x3')](function(_0x434ad5){if(_0x434ad5[_0x70e5('0x4')]){return _0x2e7193(_0x434ad5[_0x70e5('0x4')]['message']);}else{return _0x2830ae(_0x434ad5[_0x70e5('0x5')]);}})[_0x70e5('0x6')](function(_0x3b5719){return _0x2e7193(_0x3b5719);});});}exports[_0x70e5('0x7')]=function(_0x3798e1,_0x3afe11){return request(_0x70e5('0x8'),{'account':_0x3798e1,'message':_0x3afe11});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index c69fb8a..fd3e5d2 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 _0x89a8=['smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','fax','sms','length','Status','StatusTime','toNumber','format','smsStatus','chatWaitingInteractions','faxWaitingInteractions','stringify','emit','user:save','lodash','md5','defaults','redis','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime'];(function(_0x43d16c,_0x2b5447){var _0x208cce=function(_0x371720){while(--_0x371720){_0x43d16c['push'](_0x43d16c['shift']());}};_0x208cce(++_0x2b5447);}(_0x89a8,0x65));var _0x889a=function(_0x3d86bf,_0x189cfa){_0x3d86bf=_0x3d86bf-0x0;var _0x40bfba=_0x89a8[_0x3d86bf];return _0x40bfba;};'use strict';var _=require(_0x889a('0x0'));var moment=require('moment');var md5=require(_0x889a('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0x889a('0x2')](config[_0x889a('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x889a('0x4'))(new Redis(config['redis']));function Agent(_0x590144){this['id']=_0x590144['id']||0x0;this[_0x889a('0x5')]=_0x590144['name']||'';this[_0x889a('0x6')]=_0x590144['online']||!![];this[_0x889a('0x7')]=_0x590144[_0x889a('0x7')]||![];this[_0x889a('0x8')]=_0x590144['chatPause']||![];this[_0x889a('0x9')]=_0x590144[_0x889a('0x9')]||![];this[_0x889a('0xa')]=_0x590144[_0x889a('0xa')]||![];this[_0x889a('0xb')]=_0x590144[_0x889a('0xb')]||![];this[_0x889a('0xc')]=_0x590144[_0x889a('0xc')]||![];this[_0x889a('0xd')]=_0x889a('0xe');this[_0x889a('0xf')]=0x0;this[_0x889a('0x10')]=_0x590144[_0x889a('0x10')]||0x0;this[_0x889a('0x11')]=0x0;this[_0x889a('0x12')]=_0x889a('0xe');this[_0x889a('0x13')]=0x0;this[_0x889a('0x14')]=_0x590144['mailCapacity']||0x0;this[_0x889a('0x15')]=0x0;this[_0x889a('0x16')]='unknown';this[_0x889a('0x17')]=0x0;this[_0x889a('0x18')]=_0x590144[_0x889a('0x18')]||0x0;this[_0x889a('0x19')]=0x0;this['smsStatus']=_0x889a('0xe');this[_0x889a('0x1a')]=0x0;this[_0x889a('0x1b')]=_0x590144[_0x889a('0x1b')]||0x0;this[_0x889a('0x1c')]=0x0;this[_0x889a('0x1d')]=_0x889a('0xe');this[_0x889a('0x1e')]=0x0;this['whatsappCapacity']=_0x590144[_0x889a('0x1f')]||0x0;this[_0x889a('0x20')]=0x0;this[_0x889a('0x21')]=_0x889a('0xe');this[_0x889a('0x22')]=0x0;this[_0x889a('0x23')]=_0x590144[_0x889a('0x23')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x889a('0x24')]=![];this[_0x889a('0x25')]=undefined;this['md5']='';this['chatWaitingInteractions']={};this['faxWaitingInteractions']={};this[_0x889a('0x26')]={};this[_0x889a('0x27')]={};this[_0x889a('0x28')]={};this[_0x889a('0x29')]={};this[_0x889a('0x2a')]();}Agent[_0x889a('0x2b')][_0x889a('0x2c')]=function(_0x48fd79){if(this[_0x48fd79+_0x889a('0x2d')]>0x0){if(this[_0x48fd79+'Capacity']>0x0&&this[_0x48fd79+_0x889a('0x2d')]>=this[_0x48fd79+_0x889a('0x2e')]){return _0x889a('0x2f');}else{return _0x889a('0x30');}}else{return _0x889a('0x31');}};Agent[_0x889a('0x2b')][_0x889a('0x2a')]=function(){var _0xbe6ac5=[_0x889a('0x32'),'chat','openchannel',_0x889a('0x33'),_0x889a('0x34'),'whatsapp'];for(var _0x3b575f=0x0;_0x3b575f<_0xbe6ac5[_0x889a('0x35')];_0x3b575f+=0x1){var _0x4fef66=this[_0x889a('0x2c')](_0xbe6ac5[_0x3b575f]);if(this[_0xbe6ac5[_0x3b575f]+_0x889a('0x36')]!==_0x4fef66){this[_0xbe6ac5[_0x3b575f]+_0x889a('0x37')]=_[_0x889a('0x38')](moment()[_0x889a('0x39')]('x'));}this[_0xbe6ac5[_0x3b575f]+_0x889a('0x36')]=_0x4fef66;}var _0x1c8be6={'id':this['id'],'name':this[_0x889a('0x5')],'online':this[_0x889a('0x6')],'voicePause':this[_0x889a('0x7')],'chatPause':this[_0x889a('0x8')],'mailPause':this[_0x889a('0x9')],'smsPause':this[_0x889a('0xb')],'faxPause':this[_0x889a('0xa')],'openchannelPause':this[_0x889a('0xc')],'chatStatus':this[_0x889a('0xd')],'chatStatusTime':this[_0x889a('0xf')],'chatCapacity':this[_0x889a('0x10')],'chatCurrentCapacity':this[_0x889a('0x11')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x889a('0x13')],'mailCapacity':this[_0x889a('0x14')],'mailCurrentCapacity':this[_0x889a('0x15')],'faxStatus':this[_0x889a('0x16')],'faxStatusTime':this[_0x889a('0x17')],'faxCapacity':this[_0x889a('0x18')],'faxCurrentCapacity':this[_0x889a('0x19')],'smsStatus':this[_0x889a('0x3a')],'smsStatusTime':this[_0x889a('0x1a')],'smsCapacity':this[_0x889a('0x1b')],'smsCurrentCapacity':this[_0x889a('0x1c')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x889a('0x1e')],'whatsappCapacity':this[_0x889a('0x1f')],'whatsappCurrentCapacity':this[_0x889a('0x20')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x889a('0x23')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x889a('0x24')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x889a('0x3b')],'faxWaitingInteractions':this[_0x889a('0x3c')],'mailWaitingInteractions':this[_0x889a('0x26')],'openchannelWaitingInteractions':this[_0x889a('0x27')],'smsWaitingInteractions':this[_0x889a('0x28')],'whatsappWaitingInteractions':this[_0x889a('0x29')]};var _0x2e99c0=md5(JSON[_0x889a('0x3d')](_0x1c8be6));if(this[_0x889a('0x1')]!==_0x2e99c0){this[_0x889a('0x1')]=_0x2e99c0;io[_0x889a('0x3e')](_0x889a('0x3f'),_0x1c8be6);}};module['exports']=Agent; \ No newline at end of file +var _0x654b=['mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','md5','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','Capacity','maxcapacity','working','idle','mail','chat','fax','sms','whatsapp','Status','toNumber','chatStatus','chatStatusTime','chatCapacity','emit','user:save','exports','defaults','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity'];(function(_0xe2057,_0x90980){var _0x25f2ed=function(_0x1185ce){while(--_0x1185ce){_0xe2057['push'](_0xe2057['shift']());}};_0x25f2ed(++_0x90980);}(_0x654b,0xa9));var _0xb654=function(_0x55ff21,_0x1540f0){_0x55ff21=_0x55ff21-0x0;var _0x4baf37=_0x654b[_0x55ff21];return _0x4baf37;};'use strict';var _=require('lodash');var moment=require('moment');var md5=require('md5');var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0xb654('0x0')](config[_0xb654('0x1')],{'host':_0xb654('0x2'),'port':0x18eb});var io=require(_0xb654('0x3'))(new Redis(config[_0xb654('0x1')]));function Agent(_0x56760a){this['id']=_0x56760a['id']||0x0;this[_0xb654('0x4')]=_0x56760a[_0xb654('0x4')]||'';this[_0xb654('0x5')]=_0x56760a['online']||!![];this[_0xb654('0x6')]=_0x56760a[_0xb654('0x6')]||![];this['chatPause']=_0x56760a[_0xb654('0x7')]||![];this[_0xb654('0x8')]=_0x56760a[_0xb654('0x8')]||![];this[_0xb654('0x9')]=_0x56760a[_0xb654('0x9')]||![];this[_0xb654('0xa')]=_0x56760a[_0xb654('0xa')]||![];this[_0xb654('0xb')]=_0x56760a[_0xb654('0xb')]||![];this['chatStatus']=_0xb654('0xc');this['chatStatusTime']=0x0;this['chatCapacity']=_0x56760a['chatCapacity']||0x0;this[_0xb654('0xd')]=0x0;this[_0xb654('0xe')]='unknown';this[_0xb654('0xf')]=0x0;this[_0xb654('0x10')]=_0x56760a[_0xb654('0x10')]||0x0;this[_0xb654('0x11')]=0x0;this[_0xb654('0x12')]=_0xb654('0xc');this[_0xb654('0x13')]=0x0;this[_0xb654('0x14')]=_0x56760a[_0xb654('0x14')]||0x0;this[_0xb654('0x15')]=0x0;this[_0xb654('0x16')]=_0xb654('0xc');this[_0xb654('0x17')]=0x0;this['smsCapacity']=_0x56760a[_0xb654('0x18')]||0x0;this[_0xb654('0x19')]=0x0;this[_0xb654('0x1a')]=_0xb654('0xc');this[_0xb654('0x1b')]=0x0;this[_0xb654('0x1c')]=_0x56760a['whatsappCapacity']||0x0;this[_0xb654('0x1d')]=0x0;this[_0xb654('0x1e')]=_0xb654('0xc');this[_0xb654('0x1f')]=0x0;this['openchannelCapacity']=_0x56760a[_0xb654('0x20')]||0x0;this[_0xb654('0x21')]=0x0;this[_0xb654('0x22')]=![];this[_0xb654('0x23')]=undefined;this[_0xb654('0x24')]='';this[_0xb654('0x25')]={};this[_0xb654('0x26')]={};this[_0xb654('0x27')]={};this[_0xb654('0x28')]={};this['smsWaitingInteractions']={};this[_0xb654('0x29')]={};this[_0xb654('0x2a')]();}Agent[_0xb654('0x2b')][_0xb654('0x2c')]=function(_0x4ef248){if(this[_0x4ef248+'CurrentCapacity']>0x0){if(this[_0x4ef248+_0xb654('0x2d')]>0x0&&this[_0x4ef248+'CurrentCapacity']>=this[_0x4ef248+'Capacity']){return _0xb654('0x2e');}else{return _0xb654('0x2f');}}else{return _0xb654('0x30');}};Agent['prototype'][_0xb654('0x2a')]=function(){var _0x550973=[_0xb654('0x31'),_0xb654('0x32'),'openchannel',_0xb654('0x33'),_0xb654('0x34'),_0xb654('0x35')];for(var _0x3a4d22=0x0;_0x3a4d22<_0x550973['length'];_0x3a4d22+=0x1){var _0x4acaaa=this[_0xb654('0x2c')](_0x550973[_0x3a4d22]);if(this[_0x550973[_0x3a4d22]+_0xb654('0x36')]!==_0x4acaaa){this[_0x550973[_0x3a4d22]+'StatusTime']=_[_0xb654('0x37')](moment()['format']('x'));}this[_0x550973[_0x3a4d22]+_0xb654('0x36')]=_0x4acaaa;}var _0x39044d={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0xb654('0x6')],'chatPause':this[_0xb654('0x7')],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this[_0xb654('0x9')],'openchannelPause':this[_0xb654('0xb')],'chatStatus':this[_0xb654('0x38')],'chatStatusTime':this[_0xb654('0x39')],'chatCapacity':this[_0xb654('0x3a')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xb654('0xe')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xb654('0x10')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xb654('0x13')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xb654('0x15')],'smsStatus':this[_0xb654('0x16')],'smsStatusTime':this[_0xb654('0x17')],'smsCapacity':this[_0xb654('0x18')],'smsCurrentCapacity':this[_0xb654('0x19')],'whatsappStatus':this[_0xb654('0x1a')],'whatsappStatusTime':this[_0xb654('0x1b')],'whatsappCapacity':this[_0xb654('0x1c')],'whatsappCurrentCapacity':this[_0xb654('0x1d')],'openchannelStatus':this[_0xb654('0x1e')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0xb654('0x20')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xb654('0x22')],'busyQueue':this[_0xb654('0x23')],'chatWaitingInteractions':this[_0xb654('0x25')],'faxWaitingInteractions':this[_0xb654('0x26')],'mailWaitingInteractions':this[_0xb654('0x27')],'openchannelWaitingInteractions':this[_0xb654('0x28')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this[_0xb654('0x29')]};var _0x3032cc=md5(JSON['stringify'](_0x39044d));if(this['md5']!==_0x3032cc){this[_0xb654('0x24')]=_0x3032cc;io[_0xb654('0x3b')](_0xb654('0x3c'),_0x39044d);}};module[_0xb654('0x3d')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 4c6742c..b20164c 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 _0x12d3=['ioredis','../../../config/environment','redis','defaults','name','timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5'];(function(_0x34f4e3,_0x5ea27d){var _0x4abd77=function(_0x34ba45){while(--_0x34ba45){_0x34f4e3['push'](_0x34f4e3['shift']());}};_0x4abd77(++_0x5ea27d);}(_0x12d3,0x178));var _0x312d=function(_0x48ac6a,_0x531b49){_0x48ac6a=_0x48ac6a-0x0;var _0xc4dd41=_0x12d3[_0x48ac6a];return _0xc4dd41;};'use strict';var _=require(_0x312d('0x0'));var md5=require(_0x312d('0x1'));var util=require('util');var Redis=require(_0x312d('0x2'));var config=require(_0x312d('0x3'));config[_0x312d('0x4')]=_[_0x312d('0x5')](config[_0x312d('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x312d('0x4')]));function ChatQueue(_0x5c1482){this['id']=_0x5c1482['id']||0x0;this[_0x312d('0x6')]=_0x5c1482[_0x312d('0x6')]||'';this[_0x312d('0x7')]=_0x5c1482[_0x312d('0x7')]||0xa;this['strategy']=_0x5c1482['strategy']||_0x312d('0x8');this[_0x312d('0x9')]=_0x5c1482['Agents'];this[_0x312d('0xa')]={};this[_0x312d('0xb')]=0x0;this['md5']='';this[_0x312d('0xc')]();this[_0x312d('0xd')]();}ChatQueue[_0x312d('0xe')][_0x312d('0xc')]=function(){var _0x2d7be6=this['mapAgentsId'][_0x312d('0xf')];this[_0x312d('0xa')]=_[_0x312d('0x10')](this[_0x312d('0x9')],'id');this['mapAgentsId'][_0x312d('0xf')]=_0x2d7be6;};ChatQueue[_0x312d('0xe')][_0x312d('0xd')]=function(){this[_0x312d('0x11')]=0x0;this[_0x312d('0x12')]=0x0;for(var _0x4f4677=0x0;_0x4f4677=0x0?this[_0x312d('0x14')]:0x0;var _0x49abdd={'id':this['id'],'available':this[_0x312d('0x14')],'loggedIn':this[_0x312d('0x11')],'name':this[_0x312d('0x6')],'paused':this[_0x312d('0x12')],'waiting':this[_0x312d('0xb')]};var _0x51f4a9=md5(JSON[_0x312d('0x15')](_0x49abdd));if(this[_0x312d('0x1')]!==_0x51f4a9){this['md5']=_0x51f4a9;io['to'](util[_0x312d('0x16')](_0x312d('0x17'),_0x49abdd[_0x312d('0x6')]))[_0x312d('0x18')](_0x312d('0x19'),_0x49abdd);}};module[_0x312d('0x1a')]=ChatQueue; \ No newline at end of file +var _0xe0d1=['localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','online','chatPause','available','stringify','format','chat:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','redis'];(function(_0xb4d947,_0x16b719){var _0x8c85d0=function(_0x2cb6fc){while(--_0x2cb6fc){_0xb4d947['push'](_0xb4d947['shift']());}};_0x8c85d0(++_0x16b719);}(_0xe0d1,0x14b));var _0x1e0d=function(_0x354164,_0x4c30de){_0x354164=_0x354164-0x0;var _0x5db9a8=_0xe0d1[_0x354164];return _0x5db9a8;};'use strict';var _=require(_0x1e0d('0x0'));var md5=require(_0x1e0d('0x1'));var util=require(_0x1e0d('0x2'));var Redis=require('ioredis');var config=require(_0x1e0d('0x3'));config[_0x1e0d('0x4')]=_['defaults'](config['redis'],{'host':_0x1e0d('0x5'),'port':0x18eb});var io=require(_0x1e0d('0x6'))(new Redis(config[_0x1e0d('0x4')]));function ChatQueue(_0xb604bb){this['id']=_0xb604bb['id']||0x0;this['name']=_0xb604bb[_0x1e0d('0x7')]||'';this['timeout']=_0xb604bb[_0x1e0d('0x8')]||0xa;this[_0x1e0d('0x9')]=_0xb604bb[_0x1e0d('0x9')]||'beepall';this[_0x1e0d('0xa')]=_0xb604bb[_0x1e0d('0xa')];this[_0x1e0d('0xb')]={};this[_0x1e0d('0xc')]=0x0;this[_0x1e0d('0x1')]='';this[_0x1e0d('0xd')]();this[_0x1e0d('0xe')]();}ChatQueue[_0x1e0d('0xf')][_0x1e0d('0xd')]=function(){var _0x267b41=this[_0x1e0d('0xb')][_0x1e0d('0x10')];this[_0x1e0d('0xb')]=_[_0x1e0d('0x11')](this[_0x1e0d('0xa')],'id');this['mapAgentsId'][_0x1e0d('0x10')]=_0x267b41;};ChatQueue['prototype'][_0x1e0d('0xe')]=function(){this[_0x1e0d('0x12')]=0x0;this[_0x1e0d('0x13')]=0x0;for(var _0x1bfbf9=0x0;_0x1bfbf9=0x0?this[_0x1e0d('0x16')]:0x0;var _0x4742c7={'id':this['id'],'available':this['available'],'loggedIn':this[_0x1e0d('0x12')],'name':this[_0x1e0d('0x7')],'paused':this[_0x1e0d('0x13')],'waiting':this[_0x1e0d('0xc')]};var _0x1782d6=md5(JSON[_0x1e0d('0x17')](_0x4742c7));if(this[_0x1e0d('0x1')]!==_0x1782d6){this['md5']=_0x1782d6;io['to'](util[_0x1e0d('0x18')](_0x1e0d('0x19'),_0x4742c7['name']))[_0x1e0d('0x1a')]('chat_queue:save',_0x4742c7);}};module[_0x1e0d('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 047bfe1..1264e28 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 _0x7f00=['online','available','paused','format','fax:queue:%s','emit','fax_queue:save','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','map','prototype','updateRealtime','loggedIn','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7f00,0x146));var _0x07f0=function(_0x33314d,_0x499628){_0x33314d=_0x33314d-0x0;var _0x4ffe8e=_0x7f00[_0x33314d];return _0x4ffe8e;};'use strict';var _=require(_0x07f0('0x0'));var md5=require(_0x07f0('0x1'));var util=require('util');var Redis=require(_0x07f0('0x2'));var config=require(_0x07f0('0x3'));config[_0x07f0('0x4')]=_[_0x07f0('0x5')](config[_0x07f0('0x4')],{'host':_0x07f0('0x6'),'port':0x18eb});var io=require(_0x07f0('0x7'))(new Redis(config[_0x07f0('0x4')]));function FaxQueue(_0x486c40){this['id']=_0x486c40['id']||0x0;this[_0x07f0('0x8')]=_0x486c40[_0x07f0('0x8')]||'';this['timeout']=_0x486c40[_0x07f0('0x9')]||0xa;this['strategy']=_0x486c40[_0x07f0('0xa')]||_0x07f0('0xb');this[_0x07f0('0xc')]=_0x486c40[_0x07f0('0xc')];this[_0x07f0('0xd')]={};this[_0x07f0('0xe')]=0x0;this[_0x07f0('0x1')]='';this[_0x07f0('0xf')]();this['updateRealtime']();}FaxQueue['prototype'][_0x07f0('0xf')]=function(){var _0x5850b0=this['mapAgentsId'][_0x07f0('0x10')];this[_0x07f0('0xd')]=_[_0x07f0('0x11')](this[_0x07f0('0xc')],'id');this[_0x07f0('0xd')][_0x07f0('0x10')]=_0x5850b0;};FaxQueue[_0x07f0('0x12')][_0x07f0('0x13')]=function(){this[_0x07f0('0x14')]=0x0;this['paused']=0x0;for(var _0x178e33=0x0;_0x178e33=0x0?this['available']:0x0;var _0x2d0084={'id':this['id'],'available':this[_0x07f0('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x07f0('0x8')],'paused':this[_0x07f0('0x18')],'waiting':this[_0x07f0('0xe')]};var _0x58d8d1=md5(JSON['stringify'](_0x2d0084));if(this[_0x07f0('0x1')]!==_0x58d8d1){this[_0x07f0('0x1')]=_0x58d8d1;io['to'](util[_0x07f0('0x19')](_0x07f0('0x1a'),_0x2d0084[_0x07f0('0x8')]))[_0x07f0('0x1b')](_0x07f0('0x1c'),_0x2d0084);}};module['exports']=FaxQueue; \ No newline at end of file +var _0xa865=['exports','lodash','md5','util','ioredis','redis','defaults','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','prototype','map','loggedIn','length','online','paused','available','stringify','format','emit','fax_queue:save'];(function(_0x24ac51,_0x2145ba){var _0x13a5fe=function(_0x402e80){while(--_0x402e80){_0x24ac51['push'](_0x24ac51['shift']());}};_0x13a5fe(++_0x2145ba);}(_0xa865,0x97));var _0x5a86=function(_0x230c9f,_0x22831f){_0x230c9f=_0x230c9f-0x0;var _0x288a9c=_0xa865[_0x230c9f];return _0x288a9c;};'use strict';var _=require(_0x5a86('0x0'));var md5=require(_0x5a86('0x1'));var util=require(_0x5a86('0x2'));var Redis=require(_0x5a86('0x3'));var config=require('../../../config/environment');config[_0x5a86('0x4')]=_[_0x5a86('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5a86('0x4')]));function FaxQueue(_0x1ac3f0){this['id']=_0x1ac3f0['id']||0x0;this[_0x5a86('0x6')]=_0x1ac3f0[_0x5a86('0x6')]||'';this[_0x5a86('0x7')]=_0x1ac3f0[_0x5a86('0x7')]||0xa;this[_0x5a86('0x8')]=_0x1ac3f0[_0x5a86('0x8')]||'beepall';this[_0x5a86('0x9')]=_0x1ac3f0[_0x5a86('0x9')];this[_0x5a86('0xa')]={};this[_0x5a86('0xb')]=0x0;this[_0x5a86('0x1')]='';this[_0x5a86('0xc')]();this['updateRealtime']();}FaxQueue[_0x5a86('0xd')][_0x5a86('0xc')]=function(){var _0x114587=this[_0x5a86('0xa')]['_rr'];this[_0x5a86('0xa')]=_[_0x5a86('0xe')](this[_0x5a86('0x9')],'id');this[_0x5a86('0xa')]['_rr']=_0x114587;};FaxQueue[_0x5a86('0xd')]['updateRealtime']=function(){this[_0x5a86('0xf')]=0x0;this['paused']=0x0;for(var _0x4795f7=0x0;_0x4795f7=0x0?this[_0x5a86('0x13')]:0x0;var _0x5c6093={'id':this['id'],'available':this[_0x5a86('0x13')],'loggedIn':this['loggedIn'],'name':this[_0x5a86('0x6')],'paused':this[_0x5a86('0x12')],'waiting':this['waiting']};var _0xcd9542=md5(JSON[_0x5a86('0x14')](_0x5c6093));if(this[_0x5a86('0x1')]!==_0xcd9542){this[_0x5a86('0x1')]=_0xcd9542;io['to'](util[_0x5a86('0x15')]('fax:queue:%s',_0x5c6093[_0x5a86('0x6')]))[_0x5a86('0x16')](_0x5a86('0x17'),_0x5c6093);}};module[_0x5a86('0x18')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index a169b7f..9630dfb 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 _0x093c=['name','Intervals','exports'];(function(_0x2ff7c6,_0x56bd3d){var _0x3f9e41=function(_0x4677f8){while(--_0x4677f8){_0x2ff7c6['push'](_0x2ff7c6['shift']());}};_0x3f9e41(++_0x56bd3d);}(_0x093c,0x72));var _0xc093=function(_0x2cdf5b,_0xd7fc9e){_0x2cdf5b=_0x2cdf5b-0x0;var _0x393369=_0x093c[_0x2cdf5b];return _0x393369;};'use strict';function Interval(_0x4bb09e){this['id']=_0x4bb09e['id']||0x0;this[_0xc093('0x0')]=_0x4bb09e['name']||'';this[_0xc093('0x1')]=_0x4bb09e[_0xc093('0x1')]||{};}module[_0xc093('0x2')]=Interval; \ No newline at end of file +var _0x8979=['name','Intervals','exports'];(function(_0x247a5e,_0x40b75d){var _0x16e004=function(_0x4e38c7){while(--_0x4e38c7){_0x247a5e['push'](_0x247a5e['shift']());}};_0x16e004(++_0x40b75d);}(_0x8979,0x123));var _0x9897=function(_0x472772,_0x2ed865){_0x472772=_0x472772-0x0;var _0x551db8=_0x8979[_0x472772];return _0x551db8;};'use strict';function Interval(_0xbbb9e1){this['id']=_0xbbb9e1['id']||0x0;this[_0x9897('0x0')]=_0xbbb9e1[_0x9897('0x0')]||'';this['Intervals']=_0xbbb9e1[_0x9897('0x1')]||{};}module[_0x9897('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 04a6e9c..e0d567b 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 _0xbc10=['util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr','paused','length','online','loggedIn','mailPause','available','stringify','format','emit','lodash','md5'];(function(_0x1a946e,_0x14d21a){var _0x1cf702=function(_0x251b78){while(--_0x251b78){_0x1a946e['push'](_0x1a946e['shift']());}};_0x1cf702(++_0x14d21a);}(_0xbc10,0x76));var _0x0bc1=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xbc10[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x0bc1('0x0'));var md5=require(_0x0bc1('0x1'));var util=require(_0x0bc1('0x2'));var Redis=require(_0x0bc1('0x3'));var config=require(_0x0bc1('0x4'));config[_0x0bc1('0x5')]=_[_0x0bc1('0x6')](config[_0x0bc1('0x5')],{'host':_0x0bc1('0x7'),'port':0x18eb});var io=require(_0x0bc1('0x8'))(new Redis(config['redis']));function MailQueue(_0x4aac26){this['id']=_0x4aac26['id']||0x0;this['name']=_0x4aac26[_0x0bc1('0x9')]||'';this[_0x0bc1('0xa')]=_0x4aac26[_0x0bc1('0xa')]||0xa;this[_0x0bc1('0xb')]=_0x4aac26['strategy']||_0x0bc1('0xc');this['Agents']=_0x4aac26[_0x0bc1('0xd')];this['mapAgentsId']={};this[_0x0bc1('0xe')]=0x0;this[_0x0bc1('0x1')]='';this[_0x0bc1('0xf')]();this[_0x0bc1('0x10')]();}MailQueue[_0x0bc1('0x11')][_0x0bc1('0xf')]=function(){var _0x12cd9c=this[_0x0bc1('0x12')]['_rr'];this[_0x0bc1('0x12')]=_[_0x0bc1('0x13')](this[_0x0bc1('0xd')],'id');this[_0x0bc1('0x12')][_0x0bc1('0x14')]=_0x12cd9c;};MailQueue[_0x0bc1('0x11')][_0x0bc1('0x10')]=function(){this['loggedIn']=0x0;this[_0x0bc1('0x15')]=0x0;for(var _0xbb9a9b=0x0;_0xbb9a9b=0x0?this[_0x0bc1('0x1a')]:0x0;var _0x21250f={'id':this['id'],'available':this[_0x0bc1('0x1a')],'loggedIn':this[_0x0bc1('0x18')],'name':this[_0x0bc1('0x9')],'paused':this[_0x0bc1('0x15')],'waiting':this[_0x0bc1('0xe')]};var _0x59b05b=md5(JSON[_0x0bc1('0x1b')](_0x21250f));if(this['md5']!==_0x59b05b){this[_0x0bc1('0x1')]=_0x59b05b;io['to'](util[_0x0bc1('0x1c')]('mail:queue:%s',_0x21250f[_0x0bc1('0x9')]))[_0x0bc1('0x1d')]('mail_queue:save',_0x21250f);}};module['exports']=MailQueue; \ No newline at end of file +var _0x088b=['waiting','updateRouting','updateRealtime','map','_rr','loggedIn','online','mailPause','available','stringify','format','emit','mail_queue:save','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x485c5b,_0x3bdac4){var _0x5798c7=function(_0x346001){while(--_0x346001){_0x485c5b['push'](_0x485c5b['shift']());}};_0x5798c7(++_0x3bdac4);}(_0x088b,0xa9));var _0xb088=function(_0x48bc0d,_0x30becd){_0x48bc0d=_0x48bc0d-0x0;var _0x35f641=_0x088b[_0x48bc0d];return _0x35f641;};'use strict';var _=require('lodash');var md5=require(_0xb088('0x0'));var util=require('util');var Redis=require(_0xb088('0x1'));var config=require(_0xb088('0x2'));config[_0xb088('0x3')]=_[_0xb088('0x4')](config[_0xb088('0x3')],{'host':_0xb088('0x5'),'port':0x18eb});var io=require(_0xb088('0x6'))(new Redis(config[_0xb088('0x3')]));function MailQueue(_0x562cb2){this['id']=_0x562cb2['id']||0x0;this[_0xb088('0x7')]=_0x562cb2[_0xb088('0x7')]||'';this[_0xb088('0x8')]=_0x562cb2['timeout']||0xa;this[_0xb088('0x9')]=_0x562cb2[_0xb088('0x9')]||_0xb088('0xa');this[_0xb088('0xb')]=_0x562cb2[_0xb088('0xb')];this[_0xb088('0xc')]={};this[_0xb088('0xd')]=0x0;this[_0xb088('0x0')]='';this[_0xb088('0xe')]();this[_0xb088('0xf')]();}MailQueue['prototype'][_0xb088('0xe')]=function(){var _0x47fd3c=this[_0xb088('0xc')]['_rr'];this['mapAgentsId']=_[_0xb088('0x10')](this['Agents'],'id');this['mapAgentsId'][_0xb088('0x11')]=_0x47fd3c;};MailQueue['prototype'][_0xb088('0xf')]=function(){this[_0xb088('0x12')]=0x0;this['paused']=0x0;for(var _0x5a8b1b=0x0;_0x5a8b1b=0x0?this[_0xb088('0x15')]:0x0;var _0x3d46ab={'id':this['id'],'available':this['available'],'loggedIn':this[_0xb088('0x12')],'name':this[_0xb088('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0xcb4768=md5(JSON[_0xb088('0x16')](_0x3d46ab));if(this[_0xb088('0x0')]!==_0xcb4768){this[_0xb088('0x0')]=_0xcb4768;io['to'](util[_0xb088('0x17')]('mail:queue:%s',_0x3d46ab[_0xb088('0x7')]))[_0xb088('0x18')](_0xb088('0x19'),_0x3d46ab);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index cb8bacf..bdcff38 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xc4aa[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xc4aa[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index d1f2fca..2f99397 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 _0xfa2f=['loggedIn','smsPause','paused','available','stringify','format','sms:queue:%s','sms_queue:save','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','_rr','map','prototype','length','online'];(function(_0x1c7b5f,_0x192c73){var _0x3df0cf=function(_0x10b782){while(--_0x10b782){_0x1c7b5f['push'](_0x1c7b5f['shift']());}};_0x3df0cf(++_0x192c73);}(_0xfa2f,0xe8));var _0xffa2=function(_0x206b08,_0x8cebf2){_0x206b08=_0x206b08-0x0;var _0x51cfea=_0xfa2f[_0x206b08];return _0x51cfea;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xffa2('0x0'));var Redis=require('ioredis');var config=require(_0xffa2('0x1'));config[_0xffa2('0x2')]=_[_0xffa2('0x3')](config['redis'],{'host':_0xffa2('0x4'),'port':0x18eb});var io=require(_0xffa2('0x5'))(new Redis(config[_0xffa2('0x2')]));function SmsQueue(_0x14787c){this['id']=_0x14787c['id']||0x0;this[_0xffa2('0x6')]=_0x14787c[_0xffa2('0x6')]||'';this[_0xffa2('0x7')]=_0x14787c['timeout']||0xa;this['strategy']=_0x14787c[_0xffa2('0x8')]||_0xffa2('0x9');this[_0xffa2('0xa')]=_0x14787c[_0xffa2('0xa')];this[_0xffa2('0xb')]={};this[_0xffa2('0xc')]=0x0;this[_0xffa2('0xd')]='';this['updateRouting']();this[_0xffa2('0xe')]();}SmsQueue['prototype']['updateRouting']=function(){var _0x2eb5bb=this[_0xffa2('0xb')][_0xffa2('0xf')];this[_0xffa2('0xb')]=_[_0xffa2('0x10')](this['Agents'],'id');this[_0xffa2('0xb')][_0xffa2('0xf')]=_0x2eb5bb;};SmsQueue[_0xffa2('0x11')][_0xffa2('0xe')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x32e54e=0x0;_0x32e54e=0x0?this[_0xffa2('0x17')]:0x0;var _0x2ae03f={'id':this['id'],'available':this[_0xffa2('0x17')],'loggedIn':this[_0xffa2('0x14')],'name':this[_0xffa2('0x6')],'paused':this[_0xffa2('0x16')],'waiting':this[_0xffa2('0xc')]};var _0xc10cfb=md5(JSON[_0xffa2('0x18')](_0x2ae03f));if(this[_0xffa2('0xd')]!==_0xc10cfb){this['md5']=_0xc10cfb;io['to'](util[_0xffa2('0x19')](_0xffa2('0x1a'),_0x2ae03f[_0xffa2('0x6')]))['emit'](_0xffa2('0x1b'),_0x2ae03f);}};module['exports']=SmsQueue; \ No newline at end of file +var _0xe739=['sms_queue:save','lodash','util','ioredis','../../../config/environment','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','prototype','loggedIn','paused','length','smsPause','available','stringify','md5','format'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0xe739,0x105));var _0x9e73=function(_0x4955c0,_0x328ba4){_0x4955c0=_0x4955c0-0x0;var _0x3d26eb=_0xe739[_0x4955c0];return _0x3d26eb;};'use strict';var _=require(_0x9e73('0x0'));var md5=require('md5');var util=require(_0x9e73('0x1'));var Redis=require(_0x9e73('0x2'));var config=require(_0x9e73('0x3'));config['redis']=_['defaults'](config['redis'],{'host':_0x9e73('0x4'),'port':0x18eb});var io=require(_0x9e73('0x5'))(new Redis(config[_0x9e73('0x6')]));function SmsQueue(_0x2b0acc){this['id']=_0x2b0acc['id']||0x0;this['name']=_0x2b0acc[_0x9e73('0x7')]||'';this[_0x9e73('0x8')]=_0x2b0acc[_0x9e73('0x8')]||0xa;this['strategy']=_0x2b0acc[_0x9e73('0x9')]||_0x9e73('0xa');this[_0x9e73('0xb')]=_0x2b0acc[_0x9e73('0xb')];this[_0x9e73('0xc')]={};this[_0x9e73('0xd')]=0x0;this['md5']='';this[_0x9e73('0xe')]();this['updateRealtime']();}SmsQueue['prototype'][_0x9e73('0xe')]=function(){var _0x530e27=this[_0x9e73('0xc')][_0x9e73('0xf')];this[_0x9e73('0xc')]=_['map'](this[_0x9e73('0xb')],'id');this[_0x9e73('0xc')][_0x9e73('0xf')]=_0x530e27;};SmsQueue[_0x9e73('0x10')]['updateRealtime']=function(){this[_0x9e73('0x11')]=0x0;this[_0x9e73('0x12')]=0x0;for(var _0x3a7bd5=0x0;_0x3a7bd5=0x0?this['available']:0x0;var _0x4dabb2={'id':this['id'],'available':this[_0x9e73('0x15')],'loggedIn':this[_0x9e73('0x11')],'name':this[_0x9e73('0x7')],'paused':this[_0x9e73('0x12')],'waiting':this[_0x9e73('0xd')]};var _0x398a0d=md5(JSON[_0x9e73('0x16')](_0x4dabb2));if(this[_0x9e73('0x17')]!==_0x398a0d){this[_0x9e73('0x17')]=_0x398a0d;io['to'](util[_0x9e73('0x18')]('sms:queue:%s',_0x4dabb2[_0x9e73('0x7')]))['emit'](_0x9e73('0x19'),_0x4dabb2);}};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 c463c50..3ac1489 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 _0x9e6d=['format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','waiting','md5','updateRealtime','prototype','updateRouting','mapAgentsId','_rr','loggedIn','paused','online','whatsappPause','available','stringify'];(function(_0x538771,_0x4f7ae5){var _0x747cd0=function(_0x375558){while(--_0x375558){_0x538771['push'](_0x538771['shift']());}};_0x747cd0(++_0x4f7ae5);}(_0x9e6d,0x11d));var _0xd9e6=function(_0x1d0cfa,_0x52607b){_0x1d0cfa=_0x1d0cfa-0x0;var _0x1f31be=_0x9e6d[_0x1d0cfa];return _0x1f31be;};'use strict';var _=require(_0xd9e6('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xd9e6('0x1'));var config=require(_0xd9e6('0x2'));config[_0xd9e6('0x3')]=_[_0xd9e6('0x4')](config[_0xd9e6('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xd9e6('0x5'))(new Redis(config[_0xd9e6('0x3')]));function WhatsappQueue(_0x3d6f6e){this['id']=_0x3d6f6e['id']||0x0;this[_0xd9e6('0x6')]=_0x3d6f6e[_0xd9e6('0x6')]||'';this['timeout']=_0x3d6f6e[_0xd9e6('0x7')]||0xa;this[_0xd9e6('0x8')]=_0x3d6f6e[_0xd9e6('0x8')]||'beepall';this[_0xd9e6('0x9')]=_0x3d6f6e[_0xd9e6('0x9')];this['mapAgentsId']={};this[_0xd9e6('0xa')]=0x0;this[_0xd9e6('0xb')]='';this['updateRouting']();this[_0xd9e6('0xc')]();}WhatsappQueue[_0xd9e6('0xd')][_0xd9e6('0xe')]=function(){var _0x3bf863=this[_0xd9e6('0xf')]['_rr'];this[_0xd9e6('0xf')]=_['map'](this['Agents'],'id');this[_0xd9e6('0xf')][_0xd9e6('0x10')]=_0x3bf863;};WhatsappQueue[_0xd9e6('0xd')][_0xd9e6('0xc')]=function(){this[_0xd9e6('0x11')]=0x0;this[_0xd9e6('0x12')]=0x0;for(var _0xee4378=0x0;_0xee4378=0x0?this[_0xd9e6('0x15')]:0x0;var _0x5a590f={'id':this['id'],'available':this[_0xd9e6('0x15')],'loggedIn':this[_0xd9e6('0x11')],'name':this[_0xd9e6('0x6')],'paused':this['paused'],'waiting':this[_0xd9e6('0xa')]};var _0x27ef3b=md5(JSON[_0xd9e6('0x16')](_0x5a590f));if(this['md5']!==_0x27ef3b){this[_0xd9e6('0xb')]=_0x27ef3b;io['to'](util[_0xd9e6('0x17')](_0xd9e6('0x18'),_0x5a590f[_0xd9e6('0x6')]))[_0xd9e6('0x19')](_0xd9e6('0x1a'),_0x5a590f);}};module[_0xd9e6('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0x9038=['exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRealtime','prototype','updateRouting','_rr','mapAgentsId','map','loggedIn','paused','online','available','waiting','stringify','emit','whatsapp_queue:save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9038,0x1a5));var _0x8903=function(_0x511aa5,_0x3b3dc4){_0x511aa5=_0x511aa5-0x0;var _0x4539ad=_0x9038[_0x511aa5];return _0x4539ad;};'use strict';var _=require('lodash');var md5=require(_0x8903('0x0'));var util=require(_0x8903('0x1'));var Redis=require(_0x8903('0x2'));var config=require(_0x8903('0x3'));config[_0x8903('0x4')]=_[_0x8903('0x5')](config[_0x8903('0x4')],{'host':_0x8903('0x6'),'port':0x18eb});var io=require(_0x8903('0x7'))(new Redis(config[_0x8903('0x4')]));function WhatsappQueue(_0x29cf63){this['id']=_0x29cf63['id']||0x0;this[_0x8903('0x8')]=_0x29cf63[_0x8903('0x8')]||'';this[_0x8903('0x9')]=_0x29cf63['timeout']||0xa;this[_0x8903('0xa')]=_0x29cf63[_0x8903('0xa')]||_0x8903('0xb');this['Agents']=_0x29cf63[_0x8903('0xc')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x8903('0x0')]='';this['updateRouting']();this[_0x8903('0xd')]();}WhatsappQueue[_0x8903('0xe')][_0x8903('0xf')]=function(){var _0xa91e87=this['mapAgentsId'][_0x8903('0x10')];this[_0x8903('0x11')]=_[_0x8903('0x12')](this[_0x8903('0xc')],'id');this['mapAgentsId'][_0x8903('0x10')]=_0xa91e87;};WhatsappQueue[_0x8903('0xe')][_0x8903('0xd')]=function(){this[_0x8903('0x13')]=0x0;this[_0x8903('0x14')]=0x0;for(var _0x3476fe=0x0;_0x3476fe=0x0?this[_0x8903('0x16')]:0x0;var _0x279ccf={'id':this['id'],'available':this[_0x8903('0x16')],'loggedIn':this[_0x8903('0x13')],'name':this[_0x8903('0x8')],'paused':this['paused'],'waiting':this[_0x8903('0x17')]};var _0xda937e=md5(JSON[_0x8903('0x18')](_0x279ccf));if(this[_0x8903('0x0')]!==_0xda937e){this['md5']=_0xda937e;io['to'](util['format']('whatsapp:queue:%s',_0x279ccf[_0x8903('0x8')]))[_0x8903('0x19')](_0x8903('0x1a'),_0x279ccf);}};module[_0x8903('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 227996d..2e5e09a 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(_0x3e4912,_0x56327b){var _0x281f7b=function(_0x337314){while(--_0x337314){_0x3e4912['push'](_0x3e4912['shift']());}};_0x281f7b(++_0x56327b);}(_0xb10b,0x12a));var _0xbb10=function(_0x5b9d3a,_0x1f1842){_0x5b9d3a=_0x5b9d3a-0x0;var _0x383375=_0xb10b[_0x5b9d3a];return _0x383375;};'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(_0x4c95ec,_0x280e75){var _0x4caf06=function(_0x1e31ab){while(--_0x1e31ab){_0x4c95ec['push'](_0x4c95ec['shift']());}};_0x4caf06(++_0x280e75);}(_0xb10b,0x12a));var _0xbb10=function(_0x2ddb6d,_0x25d45b){_0x2ddb6d=_0x2ddb6d-0x0;var _0x56c103=_0xb10b[_0x2ddb6d];return _0x56c103;};'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 ccfe516..92da5a1 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 _0x380a=['addTagsToChatInteraction','../client','update','Request','addTags','AddTagsToChatInteraction'];(function(_0x3e478c,_0x152670){var _0x29ef89=function(_0x3d0d77){while(--_0x3d0d77){_0x3e478c['push'](_0x3e478c['shift']());}};_0x29ef89(++_0x152670);}(_0x380a,0x14b));var _0xa380=function(_0x220720,_0x10d6b4){_0x220720=_0x220720-0x0;var _0x20f9a7=_0x380a[_0x220720];return _0x20f9a7;};'use strict';var client=require(_0xa380('0x0'));exports[_0xa380('0x1')]=function(_0x2fc041,_0x3f4867){return client[_0xa380('0x2')]('UpdateChatInteraction',{'body':_0x3f4867,'options':{'where':{'id':_0x2fc041}},'log':'updateChatInteraction'});};exports[_0xa380('0x3')]=function(_0xd13ccb,_0x2b5c51){return client[_0xa380('0x2')](_0xa380('0x4'),{'body':_0x2b5c51,'options':{'where':{'id':_0xd13ccb}},'log':_0xa380('0x5')});}; \ No newline at end of file +var _0x4d70=['../client','Request','UpdateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4d70,0x136));var _0x04d7=function(_0x498acf,_0x5183ac){_0x498acf=_0x498acf-0x0;var _0x2a1d12=_0x4d70[_0x498acf];return _0x2a1d12;};'use strict';var client=require(_0x04d7('0x0'));exports['update']=function(_0x192566,_0x2f6ba5){return client[_0x04d7('0x1')](_0x04d7('0x2'),{'body':_0x2f6ba5,'options':{'where':{'id':_0x192566}},'log':'updateChatInteraction'});};exports[_0x04d7('0x3')]=function(_0x45f628,_0x4920ea){return client[_0x04d7('0x1')](_0x04d7('0x4'),{'body':_0x4920ea,'options':{'where':{'id':_0x45f628}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index af00272..0c4b696 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 _0x1514=['Request','CreateChatMessage'];(function(_0x5906af,_0x587e48){var _0x165d8b=function(_0x57c117){while(--_0x57c117){_0x5906af['push'](_0x5906af['shift']());}};_0x165d8b(++_0x587e48);}(_0x1514,0x72));var _0x4151=function(_0x3b1398,_0x1cf2c9){_0x3b1398=_0x3b1398-0x0;var _0x336d1a=_0x1514[_0x3b1398];return _0x336d1a;};'use strict';var client=require('../client');exports['create']=function(_0x2f4b70){return client[_0x4151('0x0')](_0x4151('0x1'),{'body':_0x2f4b70,'log':'createChatMessage'});}; \ No newline at end of file +var _0x2fd8=['Request','CreateChatMessage','createChatMessage','../client','create'];(function(_0x3f9807,_0x56b121){var _0xe5d31f=function(_0x50c0d8){while(--_0x50c0d8){_0x3f9807['push'](_0x3f9807['shift']());}};_0xe5d31f(++_0x56b121);}(_0x2fd8,0x157));var _0x82fd=function(_0x3d16c2,_0x2702bc){_0x3d16c2=_0x3d16c2-0x0;var _0x267bc7=_0x2fd8[_0x3d16c2];return _0x267bc7;};'use strict';var client=require(_0x82fd('0x0'));exports[_0x82fd('0x1')]=function(_0x1bacbc){return client[_0x82fd('0x2')](_0x82fd('0x3'),{'body':_0x1bacbc,'log':_0x82fd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index faeb427..0b9e423 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 _0xf9d5=['Agents','online','getChatQueues','Request','name','timeout','strategy','User'];(function(_0x38f70,_0x47a0f6){var _0x81fa37=function(_0x340f57){while(--_0x340f57){_0x38f70['push'](_0x38f70['shift']());}};_0x81fa37(++_0x47a0f6);}(_0xf9d5,0x122));var _0x5f9d=function(_0x3ebeca,_0x349ec2){_0x3ebeca=_0x3ebeca-0x0;var _0xd86f9e=_0xf9d5[_0x3ebeca];return _0xd86f9e;};'use strict';var client=require('../client');exports[_0x5f9d('0x0')]=function(){return function(){return client[_0x5f9d('0x1')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x5f9d('0x2'),_0x5f9d('0x3'),_0x5f9d('0x4')],'include':[{'model':_0x5f9d('0x5'),'as':_0x5f9d('0x6'),'attributes':['id',_0x5f9d('0x2'),_0x5f9d('0x7'),'chatPause']}]},'log':_0x5f9d('0x0')});};}; \ No newline at end of file +var _0x5162=['name','online','chatPause','../client','timeout','strategy','User','Agents'];(function(_0x3136a0,_0x446c5c){var _0x7483d5=function(_0xe4adea){while(--_0xe4adea){_0x3136a0['push'](_0x3136a0['shift']());}};_0x7483d5(++_0x446c5c);}(_0x5162,0x103));var _0x2516=function(_0x406fbb,_0x1093e5){_0x406fbb=_0x406fbb-0x0;var _0x8e921d=_0x5162[_0x406fbb];return _0x8e921d;};'use strict';var client=require(_0x2516('0x0'));exports['getChatQueues']=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id','name',_0x2516('0x1'),_0x2516('0x2')],'include':[{'model':_0x2516('0x3'),'as':_0x2516('0x4'),'attributes':['id',_0x2516('0x5'),_0x2516('0x6'),_0x2516('0x7')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 71856da..72b835e 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(_0x3005ae,_0x44dbe5){var _0x182c38=function(_0x57e3e8){while(--_0x57e3e8){_0x3005ae['push'](_0x3005ae['shift']());}};_0x182c38(++_0x44dbe5);}(_0x3685,0xf8));var _0x5368=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3685[_0x20a584];return _0x4b41a8;};'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 _0x50c1=['DESC','../client','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x524996,_0x4b9012){var _0x2bb426=function(_0x44aeb1){while(--_0x44aeb1){_0x524996['push'](_0x524996['shift']());}};_0x2bb426(++_0x4b9012);}(_0x50c1,0x1a5));var _0x150c=function(_0x1fc108,_0x1fe1b5){_0x1fc108=_0x1fc108-0x0;var _0x15a7ec=_0x50c1[_0x1fc108];return _0x15a7ec;};'use strict';var client=require(_0x150c('0x0'));exports['create']=function(_0x47d48d){return client[_0x150c('0x1')](_0x150c('0x2'),{'body':_0x47d48d,'log':_0x150c('0x2')});};exports[_0x150c('0x3')]=function(_0x24cd1b,_0x18c0bd){return client[_0x150c('0x1')](_0x150c('0x4'),{'body':_0x18c0bd,'options':{'where':{'uniqueid':_0x24cd1b},'order':[['id',_0x150c('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index e668ecd..8fce687 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x5dff45,_0x10cae1){var _0x33a904=function(_0x49bc33){while(--_0x49bc33){_0x5dff45['push'](_0x5dff45['shift']());}};_0x33a904(++_0x10cae1);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x5b8052,_0x57c477){var _0x1f7025=function(_0x3ac0d1){while(--_0x3ac0d1){_0x5b8052['push'](_0x5b8052['shift']());}};_0x1f7025(++_0x57c477);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 313704a..d44daa3 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 _0x07a9=['createFaxMessage','../client','Request','CreateFaxMessage'];(function(_0x33bd99,_0xc5f114){var _0x2c253c=function(_0x43a6d0){while(--_0x43a6d0){_0x33bd99['push'](_0x33bd99['shift']());}};_0x2c253c(++_0xc5f114);}(_0x07a9,0x1b1));var _0x907a=function(_0x5c48c2,_0x43c3da){_0x5c48c2=_0x5c48c2-0x0;var _0x25e6bf=_0x07a9[_0x5c48c2];return _0x25e6bf;};'use strict';var client=require(_0x907a('0x0'));exports['create']=function(_0x341483){return client[_0x907a('0x1')](_0x907a('0x2'),{'body':_0x341483,'log':_0x907a('0x3')});}; \ No newline at end of file +var _0xc662=['Request','CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x301021,_0x4f0387){var _0x2e9251=function(_0x108f13){while(--_0x108f13){_0x301021['push'](_0x301021['shift']());}};_0x2e9251(++_0x4f0387);}(_0xc662,0x170));var _0x2c66=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xc662[_0x47e7cb];return _0x2a8874;};'use strict';var client=require(_0x2c66('0x0'));exports[_0x2c66('0x1')]=function(_0x4c46cc){return client[_0x2c66('0x2')](_0x2c66('0x3'),{'body':_0x4c46cc,'log':_0x2c66('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index dc1380b..ff06e32 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 _0x9f04=['../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','Agents','faxPause'];(function(_0x28c7ae,_0x49f978){var _0x2cd8dd=function(_0x3d074f){while(--_0x3d074f){_0x28c7ae['push'](_0x28c7ae['shift']());}};_0x2cd8dd(++_0x49f978);}(_0x9f04,0x15f));var _0x49f0=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x9f04[_0x2c91e9];return _0x13f0ff;};'use strict';var client=require(_0x49f0('0x0'));exports[_0x49f0('0x1')]=function(){return function(){return client[_0x49f0('0x2')](_0x49f0('0x3'),{'options':{'raw':![],'attributes':['id',_0x49f0('0x4'),_0x49f0('0x5'),_0x49f0('0x6')],'include':[{'model':'User','as':_0x49f0('0x7'),'attributes':['id','name','online',_0x49f0('0x8')]}]},'log':_0x49f0('0x1')});};}; \ No newline at end of file +var _0x37f7=['online','faxPause','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User','Agents'];(function(_0x1a1546,_0x427fbc){var _0x4d1dba=function(_0x1de810){while(--_0x1de810){_0x1a1546['push'](_0x1a1546['shift']());}};_0x4d1dba(++_0x427fbc);}(_0x37f7,0x8e));var _0x737f=function(_0x439593,_0x588227){_0x439593=_0x439593-0x0;var _0x296ef7=_0x37f7[_0x439593];return _0x296ef7;};'use strict';var client=require('../client');exports[_0x737f('0x0')]=function(){return function(){return client[_0x737f('0x1')](_0x737f('0x2'),{'options':{'raw':![],'attributes':['id',_0x737f('0x3'),_0x737f('0x4'),_0x737f('0x5')],'include':[{'model':_0x737f('0x6'),'as':_0x737f('0x7'),'attributes':['id',_0x737f('0x3'),_0x737f('0x8'),_0x737f('0x9')]}]},'log':_0x737f('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index e3e1d3e..61d8a8e 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 _0x26ee=['Request','UpdateFaxQueueReport','../client','CreateFaxQueueReport'];(function(_0x1b3f91,_0x2d7894){var _0xcbf3a1=function(_0x2be7af){while(--_0x2be7af){_0x1b3f91['push'](_0x1b3f91['shift']());}};_0xcbf3a1(++_0x2d7894);}(_0x26ee,0x162));var _0xe26e=function(_0x3fc6fe,_0x274be0){_0x3fc6fe=_0x3fc6fe-0x0;var _0x50fdaf=_0x26ee[_0x3fc6fe];return _0x50fdaf;};'use strict';var client=require(_0xe26e('0x0'));exports['create']=function(_0x5d25e0){return client['Request'](_0xe26e('0x1'),{'body':_0x5d25e0,'log':_0xe26e('0x1')});};exports['update']=function(_0xa5ab50,_0xc70269){return client[_0xe26e('0x2')](_0xe26e('0x3'),{'body':_0xc70269,'options':{'where':{'uniqueid':_0xa5ab50},'order':[['id','DESC']],'limit':0x1},'log':_0xe26e('0x3')});}; \ No newline at end of file +var _0x68e1=['../client','create','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC'];(function(_0x4c660c,_0x4f03e4){var _0x55eaf7=function(_0x333520){while(--_0x333520){_0x4c660c['push'](_0x4c660c['shift']());}};_0x55eaf7(++_0x4f03e4);}(_0x68e1,0x180));var _0x168e=function(_0x45ed88,_0x1413bf){_0x45ed88=_0x45ed88-0x0;var _0x199ff3=_0x68e1[_0x45ed88];return _0x199ff3;};'use strict';var client=require(_0x168e('0x0'));exports[_0x168e('0x1')]=function(_0x36cdec){return client['Request'](_0x168e('0x2'),{'body':_0x36cdec,'log':_0x168e('0x2')});};exports[_0x168e('0x3')]=function(_0x44c3d3,_0x30e37e){return client['Request'](_0x168e('0x4'),{'body':_0x30e37e,'options':{'where':{'uniqueid':_0x44c3d3},'order':[['id',_0x168e('0x5')]],'limit':0x1},'log':_0x168e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 8b9346e..afef038 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 _0x789a=['Request','name','Interval','Intervals','interval','getIntervals','../client'];(function(_0x7b62cf,_0x591b3d){var _0x19545f=function(_0xb13edd){while(--_0xb13edd){_0x7b62cf['push'](_0x7b62cf['shift']());}};_0x19545f(++_0x591b3d);}(_0x789a,0x12c));var _0xa789=function(_0x4a80df,_0x597722){_0x4a80df=_0x4a80df-0x0;var _0x1473dd=_0x789a[_0x4a80df];return _0x1473dd;};'use strict';var client=require(_0xa789('0x0'));exports['getIntervals']=function(){return function(){return client[_0xa789('0x1')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xa789('0x2')],'include':[{'model':_0xa789('0x3'),'as':_0xa789('0x4'),'attributes':['id',_0xa789('0x2'),_0xa789('0x5')]}]},'log':_0xa789('0x6')});};}; \ No newline at end of file +var _0xd122=['Request','name','Interval','Intervals','../client','getIntervals'];(function(_0x45c8f5,_0x18b017){var _0x248f5b=function(_0x1570bb){while(--_0x1570bb){_0x45c8f5['push'](_0x45c8f5['shift']());}};_0x248f5b(++_0x18b017);}(_0xd122,0x7c));var _0x2d12=function(_0xace89,_0x1de0d3){_0xace89=_0xace89-0x0;var _0x41d1c5=_0xd122[_0xace89];return _0x41d1c5;};'use strict';var client=require(_0x2d12('0x0'));exports[_0x2d12('0x1')]=function(){return function(){return client[_0x2d12('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x2d12('0x3')],'include':[{'model':_0x2d12('0x4'),'as':_0x2d12('0x5'),'attributes':['id',_0x2d12('0x3'),'interval']}]},'log':_0x2d12('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 8752a87..8c5e5cc 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 _0x0b0e=['Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x163cd0,_0x461c03){var _0x166213=function(_0x450910){while(--_0x450910){_0x163cd0['push'](_0x163cd0['shift']());}};_0x166213(++_0x461c03);}(_0x0b0e,0x187));var _0xe0b0=function(_0xd413a4,_0x3120fe){_0xd413a4=_0xd413a4-0x0;var _0x9170f4=_0x0b0e[_0xd413a4];return _0x9170f4;};'use strict';var client=require(_0xe0b0('0x0'));exports['update']=function(_0xc416e3,_0x536e9b){return client[_0xe0b0('0x1')](_0xe0b0('0x2'),{'body':_0x536e9b,'options':{'where':{'id':_0xc416e3}},'log':_0xe0b0('0x3')});};exports[_0xe0b0('0x4')]=function(_0x28040c,_0x38a058){return client[_0xe0b0('0x1')](_0xe0b0('0x5'),{'body':_0x38a058,'options':{'where':{'id':_0x28040c}},'log':_0xe0b0('0x6')});}; \ No newline at end of file +var _0x33af=['addTags','AddTagsToMailInteraction','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x318840,_0x561b1e){var _0x223da4=function(_0x510071){while(--_0x510071){_0x318840['push'](_0x318840['shift']());}};_0x223da4(++_0x561b1e);}(_0x33af,0xec));var _0xf33a=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x33af[_0x4baae2];return _0x1a2285;};'use strict';var client=require('../client');exports[_0xf33a('0x0')]=function(_0x54b114,_0x2137be){return client[_0xf33a('0x1')](_0xf33a('0x2'),{'body':_0x2137be,'options':{'where':{'id':_0x54b114}},'log':_0xf33a('0x3')});};exports[_0xf33a('0x4')]=function(_0x25f156,_0x4c734e){return client[_0xf33a('0x1')](_0xf33a('0x5'),{'body':_0x4c734e,'options':{'where':{'id':_0x25f156}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index e2813be..1b60316 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 _0x996b=['CreateMailMessage','../client','create','Request'];(function(_0x16dbfd,_0x2f9431){var _0x382254=function(_0x19dade){while(--_0x19dade){_0x16dbfd['push'](_0x16dbfd['shift']());}};_0x382254(++_0x2f9431);}(_0x996b,0x9d));var _0xb996=function(_0x27b66a,_0x3da51e){_0x27b66a=_0x27b66a-0x0;var _0x4ea2f3=_0x996b[_0x27b66a];return _0x4ea2f3;};'use strict';var client=require(_0xb996('0x0'));exports[_0xb996('0x1')]=function(_0x4c15a3){return client[_0xb996('0x2')](_0xb996('0x3'),{'body':_0x4c15a3,'log':'createMailMessage'});}; \ No newline at end of file +var _0xa78e=['../client','create','Request','createMailMessage'];(function(_0x14ca7c,_0x58c436){var _0x47a76e=function(_0x487d5c){while(--_0x487d5c){_0x14ca7c['push'](_0x14ca7c['shift']());}};_0x47a76e(++_0x58c436);}(_0xa78e,0x124));var _0xea78=function(_0x35055e,_0x45902e){_0x35055e=_0x35055e-0x0;var _0xe9834e=_0xa78e[_0x35055e];return _0xe9834e;};'use strict';var client=require(_0xea78('0x0'));exports[_0xea78('0x1')]=function(_0x523637){return client[_0xea78('0x2')]('CreateMailMessage',{'body':_0x523637,'log':_0xea78('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index a62f91d..6eec98a 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 _0x7e47=['Request','GetMailQueue','name','timeout','mailPause','getMailQueues'];(function(_0x214910,_0x191913){var _0xa7b5fc=function(_0x231c7a){while(--_0x231c7a){_0x214910['push'](_0x214910['shift']());}};_0xa7b5fc(++_0x191913);}(_0x7e47,0x19d));var _0x77e4=function(_0x1335ea,_0x4f39d7){_0x1335ea=_0x1335ea-0x0;var _0x5eafa4=_0x7e47[_0x1335ea];return _0x5eafa4;};'use strict';var client=require('../client');exports[_0x77e4('0x0')]=function(){return function(){return client[_0x77e4('0x1')](_0x77e4('0x2'),{'options':{'raw':![],'attributes':['id',_0x77e4('0x3'),_0x77e4('0x4'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0x77e4('0x3'),'online',_0x77e4('0x5')]}]},'log':_0x77e4('0x0')});};}; \ No newline at end of file +var _0xc198=['User','online','mailPause','../client','getMailQueues','Request','GetMailQueue','name','strategy'];(function(_0x27ebfc,_0x120069){var _0x1e70c3=function(_0x2a5309){while(--_0x2a5309){_0x27ebfc['push'](_0x27ebfc['shift']());}};_0x1e70c3(++_0x120069);}(_0xc198,0xc9));var _0x8c19=function(_0x501b14,_0x55ecb4){_0x501b14=_0x501b14-0x0;var _0x2e2917=_0xc198[_0x501b14];return _0x2e2917;};'use strict';var client=require(_0x8c19('0x0'));exports[_0x8c19('0x1')]=function(){return function(){return client[_0x8c19('0x2')](_0x8c19('0x3'),{'options':{'raw':![],'attributes':['id',_0x8c19('0x4'),'timeout',_0x8c19('0x5')],'include':[{'model':_0x8c19('0x6'),'as':'Agents','attributes':['id','name',_0x8c19('0x7'),_0x8c19('0x8')]}]},'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 a541309..45382aa 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 _0x5e8f=['CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client','create','Request'];(function(_0x500ffe,_0x318d11){var _0x3b1c6e=function(_0x2a8380){while(--_0x2a8380){_0x500ffe['push'](_0x500ffe['shift']());}};_0x3b1c6e(++_0x318d11);}(_0x5e8f,0xac));var _0xf5e8=function(_0x4db46b,_0xadcb1a){_0x4db46b=_0x4db46b-0x0;var _0x565be8=_0x5e8f[_0x4db46b];return _0x565be8;};'use strict';var client=require(_0xf5e8('0x0'));exports[_0xf5e8('0x1')]=function(_0x41a063){return client[_0xf5e8('0x2')](_0xf5e8('0x3'),{'body':_0x41a063,'log':_0xf5e8('0x3')});};exports[_0xf5e8('0x4')]=function(_0x519964,_0x5bb253){return client[_0xf5e8('0x2')](_0xf5e8('0x5'),{'body':_0x5bb253,'options':{'where':{'uniqueid':_0x519964},'order':[['id',_0xf5e8('0x6')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0xbaa5=['../client','create','Request','CreateMailQueueReport','update','DESC','UpdateMailQueueReport'];(function(_0x34674e,_0x1cb456){var _0x5845fd=function(_0x30d755){while(--_0x30d755){_0x34674e['push'](_0x34674e['shift']());}};_0x5845fd(++_0x1cb456);}(_0xbaa5,0x1d5));var _0x5baa=function(_0x37e75c,_0x4b222e){_0x37e75c=_0x37e75c-0x0;var _0x1d5c68=_0xbaa5[_0x37e75c];return _0x1d5c68;};'use strict';var client=require(_0x5baa('0x0'));exports[_0x5baa('0x1')]=function(_0x22068a){return client[_0x5baa('0x2')](_0x5baa('0x3'),{'body':_0x22068a,'log':_0x5baa('0x3')});};exports[_0x5baa('0x4')]=function(_0x26cde5,_0x443d2d){return client[_0x5baa('0x2')]('UpdateMailQueueReport',{'body':_0x443d2d,'options':{'where':{'uniqueid':_0x26cde5},'order':[['id',_0x5baa('0x5')]],'limit':0x1},'log':_0x5baa('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 38489e9..2aba518 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 _0x6f28=['../client','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x468edb,_0x3100ea){var _0x194fe2=function(_0x2f8ea6){while(--_0x2f8ea6){_0x468edb['push'](_0x468edb['shift']());}};_0x194fe2(++_0x3100ea);}(_0x6f28,0x196));var _0x86f2=function(_0xce93c,_0x555be5){_0xce93c=_0xce93c-0x0;var _0x230720=_0x6f28[_0xce93c];return _0x230720;};'use strict';var client=require(_0x86f2('0x0'));exports[_0x86f2('0x1')]=function(_0x126f3a,_0x485b33){return client['Request'](_0x86f2('0x2'),{'body':_0x485b33,'options':{'where':{'id':_0x126f3a}},'log':_0x86f2('0x3')});};exports[_0x86f2('0x4')]=function(_0x5c9839,_0x5a3b9b){return client['Request'](_0x86f2('0x5'),{'body':_0x5a3b9b,'options':{'where':{'id':_0x5c9839}},'log':_0x86f2('0x6')});}; \ No newline at end of file +var _0x2df8=['UpdateOpenchannelInteraction','update','Request'];(function(_0x4c8497,_0x2021fc){var _0xb9303c=function(_0x2ea962){while(--_0x2ea962){_0x4c8497['push'](_0x4c8497['shift']());}};_0xb9303c(++_0x2021fc);}(_0x2df8,0x6a));var _0x82df=function(_0x34ce23,_0x2c518e){_0x34ce23=_0x34ce23-0x0;var _0x13681f=_0x2df8[_0x34ce23];return _0x13681f;};'use strict';var client=require('../client');exports[_0x82df('0x0')]=function(_0x3c3a82,_0x620045){return client[_0x82df('0x1')](_0x82df('0x2'),{'body':_0x620045,'options':{'where':{'id':_0x3c3a82}},'log':'updateOpenchannelInteraction'});};exports['addTags']=function(_0x550d6f,_0x392855){return client[_0x82df('0x1')]('AddTagsToOpenchannelInteraction',{'body':_0x392855,'options':{'where':{'id':_0x550d6f}},'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 2b0db20..820c107 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 _0x49d8=['createOpenchannelMessage','../client','Request'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x49d8,0xd3));var _0x849d=function(_0x2c5aba,_0x2da432){_0x2c5aba=_0x2c5aba-0x0;var _0x2c8c15=_0x49d8[_0x2c5aba];return _0x2c8c15;};'use strict';var client=require(_0x849d('0x0'));exports['create']=function(_0x52e2c8){return client[_0x849d('0x1')]('CreateOpenchannelMessage',{'body':_0x52e2c8,'log':_0x849d('0x2')});}; \ No newline at end of file +var _0x0bd4=['Request','CreateOpenchannelMessage','createOpenchannelMessage','../client','create'];(function(_0x4bccda,_0x4252a8){var _0x2d4c53=function(_0x5df70a){while(--_0x5df70a){_0x4bccda['push'](_0x4bccda['shift']());}};_0x2d4c53(++_0x4252a8);}(_0x0bd4,0x1ca));var _0x40bd=function(_0x4b2b03,_0xbf34ee){_0x4b2b03=_0x4b2b03-0x0;var _0x1bf0ed=_0x0bd4[_0x4b2b03];return _0x1bf0ed;};'use strict';var client=require(_0x40bd('0x0'));exports[_0x40bd('0x1')]=function(_0x16736e){return client[_0x40bd('0x2')](_0x40bd('0x3'),{'body':_0x16736e,'log':_0x40bd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 5a8c8da..0b4ee63 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 _0x19b6=['name','User','Agents','../client','getOpenchannelQueues','Request'];(function(_0x3e7462,_0x59c8e1){var _0x203ee4=function(_0x188444){while(--_0x188444){_0x3e7462['push'](_0x3e7462['shift']());}};_0x203ee4(++_0x59c8e1);}(_0x19b6,0x1e9));var _0x619b=function(_0x383627,_0x5be16e){_0x383627=_0x383627-0x0;var _0x2c16a0=_0x19b6[_0x383627];return _0x2c16a0;};'use strict';var client=require(_0x619b('0x0'));exports[_0x619b('0x1')]=function(){return function(){return client[_0x619b('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x619b('0x3'),'timeout','strategy'],'include':[{'model':_0x619b('0x4'),'as':_0x619b('0x5'),'attributes':['id',_0x619b('0x3'),'online','openchannelPause']}]},'log':_0x619b('0x1')});};}; \ No newline at end of file +var _0x4be8=['name','timeout','strategy','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue'];(function(_0x25e109,_0x6ab24c){var _0xc0f7d6=function(_0x2fb92b){while(--_0x2fb92b){_0x25e109['push'](_0x25e109['shift']());}};_0xc0f7d6(++_0x6ab24c);}(_0x4be8,0x17f));var _0x84be=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x4be8[_0x59c301];return _0x3866b9;};'use strict';var client=require(_0x84be('0x0'));exports[_0x84be('0x1')]=function(){return function(){return client[_0x84be('0x2')](_0x84be('0x3'),{'options':{'raw':![],'attributes':['id',_0x84be('0x4'),_0x84be('0x5'),_0x84be('0x6')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x84be('0x4'),_0x84be('0x7'),_0x84be('0x8')]}]},'log':_0x84be('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index adcb56b..1d8252f 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 _0x98d2=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create','Request'];(function(_0x7275e9,_0x321fa5){var _0x17b99d=function(_0x54af41){while(--_0x54af41){_0x7275e9['push'](_0x7275e9['shift']());}};_0x17b99d(++_0x321fa5);}(_0x98d2,0xb3));var _0x298d=function(_0x4629ed,_0x59ef85){_0x4629ed=_0x4629ed-0x0;var _0x52ca04=_0x98d2[_0x4629ed];return _0x52ca04;};'use strict';var client=require(_0x298d('0x0'));exports[_0x298d('0x1')]=function(_0x375c15){return client[_0x298d('0x2')](_0x298d('0x3'),{'body':_0x375c15,'log':_0x298d('0x3')});};exports[_0x298d('0x4')]=function(_0x2abdc1,_0x183db7){return client['Request'](_0x298d('0x5'),{'body':_0x183db7,'options':{'where':{'uniqueid':_0x2abdc1},'order':[['id',_0x298d('0x6')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x205d=['DESC','../client','create','CreateOpenchannelQueueReport','update','Request','UpdateOpenchannelQueueReport'];(function(_0x4f152e,_0x35162a){var _0x9b2c79=function(_0x152076){while(--_0x152076){_0x4f152e['push'](_0x4f152e['shift']());}};_0x9b2c79(++_0x35162a);}(_0x205d,0xf6));var _0xd205=function(_0xfc36d8,_0x233b0b){_0xfc36d8=_0xfc36d8-0x0;var _0x234f42=_0x205d[_0xfc36d8];return _0x234f42;};'use strict';var client=require(_0xd205('0x0'));exports[_0xd205('0x1')]=function(_0x11d0ff){return client['Request']('CreateOpenchannelQueueReport',{'body':_0x11d0ff,'log':_0xd205('0x2')});};exports[_0xd205('0x3')]=function(_0x3f3c23,_0x4bc52b){return client[_0xd205('0x4')](_0xd205('0x5'),{'body':_0x4bc52b,'options':{'where':{'uniqueid':_0x3f3c23},'order':[['id',_0xd205('0x6')]],'limit':0x1},'log':_0xd205('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index f536343..191b19d 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 _0x5697=['Request','../client'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x5697,0x1b5));var _0x7569=function(_0x1a8ff0,_0x20788d){_0x1a8ff0=_0x1a8ff0-0x0;var _0x3588bf=_0x5697[_0x1a8ff0];return _0x3588bf;};'use strict';var client=require(_0x7569('0x0'));exports['update']=function(_0x394228,_0x3541f6){return client[_0x7569('0x1')]('UpdateSmsInteraction',{'body':_0x3541f6,'options':{'where':{'id':_0x394228}},'log':'updateSmsInteraction'});};exports['addTags']=function(_0x499e06,_0x48340f){return client[_0x7569('0x1')]('AddTagsToSmsInteraction',{'body':_0x48340f,'options':{'where':{'id':_0x499e06}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x1247=['../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x1247,0xb6));var _0x7124=function(_0x1304c6,_0x6bb485){_0x1304c6=_0x1304c6-0x0;var _0x2e6654=_0x1247[_0x1304c6];return _0x2e6654;};'use strict';var client=require(_0x7124('0x0'));exports[_0x7124('0x1')]=function(_0x498325,_0x4d37c0){return client[_0x7124('0x2')](_0x7124('0x3'),{'body':_0x4d37c0,'options':{'where':{'id':_0x498325}},'log':_0x7124('0x4')});};exports['addTags']=function(_0x3bdce3,_0x3ab32e){return client[_0x7124('0x2')](_0x7124('0x5'),{'body':_0x3ab32e,'options':{'where':{'id':_0x3bdce3}},'log':_0x7124('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 8113030..9da9050 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 _0x38f7=['create','Request','CreateSmsMessage','createSmsMessage','../client'];(function(_0x50f376,_0x18b03f){var _0x3e5d6f=function(_0x5d92bb){while(--_0x5d92bb){_0x50f376['push'](_0x50f376['shift']());}};_0x3e5d6f(++_0x18b03f);}(_0x38f7,0x135));var _0x738f=function(_0x1952e2,_0x45e58b){_0x1952e2=_0x1952e2-0x0;var _0x249cc8=_0x38f7[_0x1952e2];return _0x249cc8;};'use strict';var client=require(_0x738f('0x0'));exports[_0x738f('0x1')]=function(_0x54f078){return client[_0x738f('0x2')](_0x738f('0x3'),{'body':_0x54f078,'log':_0x738f('0x4')});}; \ No newline at end of file +var _0xe4cb=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0xe039c,_0x10192a){var _0x450db7=function(_0x44e4ca){while(--_0x44e4ca){_0xe039c['push'](_0xe039c['shift']());}};_0x450db7(++_0x10192a);}(_0xe4cb,0x16a));var _0xbe4c=function(_0x59bf40,_0xa0353){_0x59bf40=_0x59bf40-0x0;var _0xb51f68=_0xe4cb[_0x59bf40];return _0xb51f68;};'use strict';var client=require(_0xbe4c('0x0'));exports[_0xbe4c('0x1')]=function(_0x2c5b93){return client[_0xbe4c('0x2')](_0xbe4c('0x3'),{'body':_0x2c5b93,'log':_0xbe4c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 7a75fc6..6f4120b 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 _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x3c0252,_0x12a568){var _0x372b55=function(_0x5a938e){while(--_0x5a938e){_0x3c0252['push'](_0x3c0252['shift']());}};_0x372b55(++_0x12a568);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x37c07d,_0xdbdb5f){_0x37c07d=_0x37c07d-0x0;var _0x10dadc=_0xcb91[_0x37c07d];return _0x10dadc;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0xfd4cd3,_0x3e4ac9){var _0x448ebd=function(_0x17d75e){while(--_0x17d75e){_0xfd4cd3['push'](_0xfd4cd3['shift']());}};_0x448ebd(++_0x3e4ac9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index f4b6a86..c687000 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x295458,_0x2051a9){var _0x3ee559=function(_0x13bf1f){while(--_0x13bf1f){_0x295458['push'](_0x295458['shift']());}};_0x3ee559(++_0x2051a9);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file +var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x73d817,_0x54eed1){var _0x178cf8=function(_0x3cdf24){while(--_0x3cdf24){_0x73d817['push'](_0x73d817['shift']());}};_0x178cf8(++_0x54eed1);}(_0x008c,0x188));var _0xc008=function(_0x5678c2,_0xd8cb89){_0x5678c2=_0x5678c2-0x0;var _0x263105=_0x008c[_0x5678c2];return _0x263105;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 374245e..84b4170 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(_0x18f1ae,_0x144729){var _0x3e33e3=function(_0x548e91){while(--_0x548e91){_0x18f1ae['push'](_0x18f1ae['shift']());}};_0x3e33e3(++_0x144729);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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(_0x3afece,_0x112b15){var _0x1dcdc2=function(_0x513a2c){while(--_0x513a2c){_0x3afece['push'](_0x3afece['shift']());}};_0x1dcdc2(++_0x112b15);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 8f954a2..e759315 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 _0x1883=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1883,0xab));var _0x3188=function(_0x3a5b8c,_0x2edf4e){_0x3a5b8c=_0x3a5b8c-0x0;var _0x266560=_0x1883[_0x3a5b8c];return _0x266560;};'use strict';var client=require(_0x3188('0x0'));exports[_0x3188('0x1')]=function(_0x1ffcc1,_0x45f858){return client[_0x3188('0x2')](_0x3188('0x3'),{'body':_0x45f858,'options':{'where':{'id':_0x1ffcc1}},'log':_0x3188('0x4')});};exports[_0x3188('0x5')]=function(_0x1c7c86,_0x44afb8){return client[_0x3188('0x2')](_0x3188('0x6'),{'body':_0x44afb8,'options':{'where':{'id':_0x1c7c86}},'log':_0x3188('0x7')});}; \ No newline at end of file +var _0x199c=['updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','Request','UpdateWhatsappInteraction'];(function(_0x587dd0,_0x273922){var _0x56f153=function(_0x27fb33){while(--_0x27fb33){_0x587dd0['push'](_0x587dd0['shift']());}};_0x56f153(++_0x273922);}(_0x199c,0x1d8));var _0xc199=function(_0xfcba87,_0x221462){_0xfcba87=_0xfcba87-0x0;var _0x58e4b1=_0x199c[_0xfcba87];return _0x58e4b1;};'use strict';var client=require('../client');exports['update']=function(_0x240cb4,_0x3fdf87){return client[_0xc199('0x0')](_0xc199('0x1'),{'body':_0x3fdf87,'options':{'where':{'id':_0x240cb4}},'log':_0xc199('0x2')});};exports[_0xc199('0x3')]=function(_0x3f06cc,_0x1eecc2){return client['Request'](_0xc199('0x4'),{'body':_0x1eecc2,'options':{'where':{'id':_0x3f06cc}},'log':_0xc199('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 5e69447..7f6aacf 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 _0x93cc=['../client','create','Request'];(function(_0x60912b,_0x4e90ee){var _0xd25e4c=function(_0x2f4403){while(--_0x2f4403){_0x60912b['push'](_0x60912b['shift']());}};_0xd25e4c(++_0x4e90ee);}(_0x93cc,0x132));var _0xc93c=function(_0x5f293a,_0x159fa4){_0x5f293a=_0x5f293a-0x0;var _0x13763c=_0x93cc[_0x5f293a];return _0x13763c;};'use strict';var client=require(_0xc93c('0x0'));exports[_0xc93c('0x1')]=function(_0x55e8da){return client[_0xc93c('0x2')]('CreateWhatsappMessage',{'body':_0x55e8da,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xa6f0=['Request','createWhatsappMessage'];(function(_0x281c44,_0x367e13){var _0x44b209=function(_0x255bca){while(--_0x255bca){_0x281c44['push'](_0x281c44['shift']());}};_0x44b209(++_0x367e13);}(_0xa6f0,0x10a));var _0x0a6f=function(_0x329203,_0x16453a){_0x329203=_0x329203-0x0;var _0xa1be8c=_0xa6f0[_0x329203];return _0xa1be8c;};'use strict';var client=require('../client');exports['create']=function(_0x482cb5){return client[_0x0a6f('0x0')]('CreateWhatsappMessage',{'body':_0x482cb5,'log':_0x0a6f('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 15205dc..ca659ca 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 _0x344f=['getWhatsappQueues','Request','GetWhatsappQueue','timeout','strategy','Agents','name','online','whatsappPause','../client'];(function(_0x21f6b2,_0x491db7){var _0x4a2b5a=function(_0x946132){while(--_0x946132){_0x21f6b2['push'](_0x21f6b2['shift']());}};_0x4a2b5a(++_0x491db7);}(_0x344f,0xef));var _0xf344=function(_0x3f3e62,_0x5dce0e){_0x3f3e62=_0x3f3e62-0x0;var _0x5b5549=_0x344f[_0x3f3e62];return _0x5b5549;};'use strict';var client=require(_0xf344('0x0'));exports[_0xf344('0x1')]=function(){return function(){return client[_0xf344('0x2')](_0xf344('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xf344('0x4'),_0xf344('0x5')],'include':[{'model':'User','as':_0xf344('0x6'),'attributes':['id',_0xf344('0x7'),_0xf344('0x8'),_0xf344('0x9')]}]},'log':_0xf344('0x1')});};}; \ No newline at end of file +var _0xfe17=['timeout','strategy','User','Agents','getWhatsappQueues','GetWhatsappQueue','name'];(function(_0x11accf,_0x5cf3e3){var _0x43de4c=function(_0x1897e5){while(--_0x1897e5){_0x11accf['push'](_0x11accf['shift']());}};_0x43de4c(++_0x5cf3e3);}(_0xfe17,0x170));var _0x7fe1=function(_0xb40cd3,_0x33b6b5){_0xb40cd3=_0xb40cd3-0x0;var _0x5b733d=_0xfe17[_0xb40cd3];return _0x5b733d;};'use strict';var client=require('../client');exports[_0x7fe1('0x0')]=function(){return function(){return client['Request'](_0x7fe1('0x1'),{'options':{'raw':![],'attributes':['id',_0x7fe1('0x2'),_0x7fe1('0x3'),_0x7fe1('0x4')],'include':[{'model':_0x7fe1('0x5'),'as':_0x7fe1('0x6'),'attributes':['id',_0x7fe1('0x2'),'online','whatsappPause']}]},'log':_0x7fe1('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 69f6f5e..7b44268 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 _0xe06b=['CreateWhatsappQueueReport','Request','UpdateWhatsappQueueReport','DESC','create'];(function(_0x34199e,_0x4d431a){var _0x14b5ab=function(_0x4c8554){while(--_0x4c8554){_0x34199e['push'](_0x34199e['shift']());}};_0x14b5ab(++_0x4d431a);}(_0xe06b,0xcc));var _0xbe06=function(_0x21e562,_0x488fcd){_0x21e562=_0x21e562-0x0;var _0x5e620d=_0xe06b[_0x21e562];return _0x5e620d;};'use strict';var client=require('../client');exports[_0xbe06('0x0')]=function(_0x2401c5){return client['Request'](_0xbe06('0x1'),{'body':_0x2401c5,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0x1f885e,_0xe1fa28){return client[_0xbe06('0x2')](_0xbe06('0x3'),{'body':_0xe1fa28,'options':{'where':{'uniqueid':_0x1f885e},'order':[['id',_0xbe06('0x4')]],'limit':0x1},'log':_0xbe06('0x3')});}; \ No newline at end of file +var _0x5c7a=['../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0x54dda3,_0x3667e3){var _0xf617d5=function(_0x216a4a){while(--_0x216a4a){_0x54dda3['push'](_0x54dda3['shift']());}};_0xf617d5(++_0x3667e3);}(_0x5c7a,0xcb));var _0xa5c7=function(_0x545a3a,_0x3123aa){_0x545a3a=_0x545a3a-0x0;var _0x5a5493=_0x5c7a[_0x545a3a];return _0x5a5493;};'use strict';var client=require(_0xa5c7('0x0'));exports[_0xa5c7('0x1')]=function(_0x215416){return client[_0xa5c7('0x2')](_0xa5c7('0x3'),{'body':_0x215416,'log':_0xa5c7('0x3')});};exports[_0xa5c7('0x4')]=function(_0x502aa5,_0x58b4c5){return client[_0xa5c7('0x2')](_0xa5c7('0x5'),{'body':_0x58b4c5,'options':{'where':{'uniqueid':_0x502aa5},'order':[['id',_0xa5c7('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ 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 7a34386..b09417c 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 _0x3d47=['lodash','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','timeout','channel','rules','end','close','complete','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate'];(function(_0x1acd3b,_0x333177){var _0x3318f7=function(_0x23f8a3){while(--_0x23f8a3){_0x1acd3b['push'](_0x1acd3b['shift']());}};_0x3318f7(++_0x333177);}(_0x3d47,0x1df));var _0x73d4=function(_0x3ae8ad,_0x34cf0f){_0x3ae8ad=_0x3ae8ad-0x0;var _0xbf5ec3=_0x3d47[_0x3ae8ad];return _0xbf5ec3;};'use strict';var schema=require(_0x73d4('0x0'));var _=require(_0x73d4('0x1'));var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0x73d4('0x2'))(_0x73d4('0x3'));var strategy=require(_0x73d4('0x4'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x73d4('0x5')},'timeout':{'type':'number','message':_0x73d4('0x6')}});function writeLog(_0x185dd0,_0x1a2e79,_0x72bc3d){return logger[_0x73d4('0x7')](util[_0x73d4('0x8')](_0x73d4('0x9'),_0x185dd0,_0x1a2e79[_0x73d4('0xa')],_0x72bc3d));}function handleFindAgent(_0x2f260a){return function(_0x3d6228){return _0x3d6228[_0x73d4('0xa')][_0x73d4('0xb')]()===_0x2f260a[_0x73d4('0xb')]();};}exports[_0x73d4('0xc')]=function(_0x3262c0,_0x40ed56,_0x28695d,_0x129f62){return function(_0xe9fae){try{var _0x2c8aab={'name':_0x40ed56[0x0],'timeout':_0x40ed56[0x1]};var _0x4cbfae=queue[_0x73d4('0x0')](_0x2c8aab,{'typecast':!![]});if(_0x4cbfae[_0x73d4('0xd')]){logger[_0x73d4('0xe')](_0x73d4('0xf'),_0x3262c0,_[_0x73d4('0x10')](_0x4cbfae,_0x73d4('0x11'))[_0x73d4('0x12')](',\x20'));_0xe9fae[_0x73d4('0x13')]();}else{var _0x59b919=_[_0x73d4('0x14')](_0x28695d['agents'],handleFindAgent(_0x2c8aab[_0x73d4('0xa')]));if(_0x59b919){var _0x345bbd=(_0x2c8aab[_0x73d4('0x15')]||0xa)*0x3e8;var _0x8370aa,_0x44fd4e;var _0x4eb2a3=seqqueue['createQueue'](_0x345bbd);_0x4eb2a3['id']=_0x3262c0;_0x4eb2a3['atimeout']=_0x345bbd;_0x4eb2a3['channel']=_0x129f62[_0x73d4('0x16')];writeLog(_0x3262c0,_0x59b919,util[_0x73d4('0x8')]('START:%s',_0x345bbd));_0x28695d[_0x73d4('0x17')][_0x3262c0]['on'](_0x73d4('0x18'),function(){logger[_0x73d4('0x7')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x3262c0);clearTimeout(_0x44fd4e);_0x44fd4e=undefined;_0x4eb2a3[_0x73d4('0x19')]();if(_0x28695d['rules'][_0x3262c0]){delete _0x28695d['rules'][_0x3262c0];}_0xe9fae['stop']();});_0x28695d['rules'][_0x3262c0]['on'](_0x73d4('0x1a'),function(){if(_0x28695d[_0x73d4('0x17')][_0x3262c0]){delete _0x28695d[_0x73d4('0x17')][_0x3262c0];}});_0x44fd4e=setTimeout(function(){logger[_0x73d4('0x7')](_0x73d4('0x1b'),_0x3262c0);clearTimeout(_0x44fd4e);_0x4eb2a3['close']();_0xe9fae['next']();},_0x345bbd);strategy[_0x73d4('0x1c')](_0x4eb2a3,_0x59b919,_0x28695d,_0x129f62);}else{logger[_0x73d4('0xe')](_0x73d4('0x1d'),_0x3262c0,_0x2c8aab[_0x73d4('0xa')]);_0xe9fae[_0x73d4('0x13')]();}}}catch(_0x3d47d5){console['log'](_0x3d47d5);logger[_0x73d4('0xe')](_0x73d4('0x1e'),_0x3262c0,_0x3d47d5[_0x73d4('0x1f')]);_0xe9fae['stop']();}};}; \ No newline at end of file +var _0x7d1d=['toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','message','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','stop','complete','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x7d1d,0x1af));var _0xd7d1=function(_0x3c22e0,_0x1dc6ea){_0x3c22e0=_0x3c22e0-0x0;var _0x215811=_0x7d1d[_0x3c22e0];return _0x215811;};'use strict';var schema=require(_0xd7d1('0x0'));var _=require(_0xd7d1('0x1'));var util=require(_0xd7d1('0x2'));var seqqueue=require(_0xd7d1('0x3'));var logger=require(_0xd7d1('0x4'))(_0xd7d1('0x5'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0xd7d1('0x6'),'required':!![],'message':_0xd7d1('0x7')},'timeout':{'type':_0xd7d1('0x8'),'message':_0xd7d1('0x9')}});function writeLog(_0x1d7428,_0xcdf9ff,_0x10ab0c){return logger[_0xd7d1('0xa')](util['format'](_0xd7d1('0xb'),_0x1d7428,_0xcdf9ff[_0xd7d1('0xc')],_0x10ab0c));}function handleFindAgent(_0x47c232){return function(_0xddfa72){return _0xddfa72[_0xd7d1('0xc')]['toLowerCase']()===_0x47c232[_0xd7d1('0xd')]();};}exports[_0xd7d1('0xe')]=function(_0x187634,_0x55dc8f,_0x545e4b,_0x48a987){return function(_0x1a0ca0){try{var _0x12504e={'name':_0x55dc8f[0x0],'timeout':_0x55dc8f[0x1]};var _0x15bfa8=queue[_0xd7d1('0x0')](_0x12504e,{'typecast':!![]});if(_0x15bfa8[_0xd7d1('0xf')]){logger[_0xd7d1('0x10')](_0xd7d1('0x11'),_0x187634,_['map'](_0x15bfa8,_0xd7d1('0x12'))['join'](',\x20'));_0x1a0ca0['stop']();}else{var _0x101986=_[_0xd7d1('0x13')](_0x545e4b[_0xd7d1('0x14')],handleFindAgent(_0x12504e[_0xd7d1('0xc')]));if(_0x101986){var _0x589109=(_0x12504e[_0xd7d1('0x15')]||0xa)*0x3e8;var _0x124167,_0x2fb585;var _0x326ce0=seqqueue[_0xd7d1('0x16')](_0x589109);_0x326ce0['id']=_0x187634;_0x326ce0[_0xd7d1('0x17')]=_0x589109;_0x326ce0[_0xd7d1('0x18')]=_0x48a987[_0xd7d1('0x18')];writeLog(_0x187634,_0x101986,util['format'](_0xd7d1('0x19'),_0x589109));_0x545e4b[_0xd7d1('0x1a')][_0x187634]['on'](_0xd7d1('0x1b'),function(){logger[_0xd7d1('0xa')](_0xd7d1('0x1c'),_0x187634);clearTimeout(_0x2fb585);_0x2fb585=undefined;_0x326ce0['close']();if(_0x545e4b[_0xd7d1('0x1a')][_0x187634]){delete _0x545e4b[_0xd7d1('0x1a')][_0x187634];}_0x1a0ca0[_0xd7d1('0x1d')]();});_0x545e4b[_0xd7d1('0x1a')][_0x187634]['on'](_0xd7d1('0x1e'),function(){if(_0x545e4b[_0xd7d1('0x1a')][_0x187634]){delete _0x545e4b['rules'][_0x187634];}});_0x2fb585=setTimeout(function(){logger[_0xd7d1('0xa')]('[%s][AGENT]\x20ROUTING\x20END',_0x187634);clearTimeout(_0x2fb585);_0x326ce0[_0xd7d1('0x1f')]();_0x1a0ca0[_0xd7d1('0x20')]();},_0x589109);strategy[_0xd7d1('0x21')](_0x326ce0,_0x101986,_0x545e4b,_0x48a987);}else{logger[_0xd7d1('0x10')](_0xd7d1('0x22'),_0x187634,_0x12504e['name']);_0x1a0ca0[_0xd7d1('0x1d')]();}}}catch(_0x10b213){console[_0xd7d1('0x23')](_0x10b213);logger[_0xd7d1('0x10')](_0xd7d1('0x24'),_0x187634,_0x10b213['stack']);_0x1a0ca0['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 39f6410..86c82e5 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 _0xf4ab=['stop','LexRuntime','message','postText','next','providerName','amazonlex','providerResponse','dialogState','Failed','lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','contact','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','body','getMustacheRender','Message','then','[%s][AMAZONLEX]\x20%s','catch','error','stringify','finally'];(function(_0xc71285,_0x267c83){var _0x2f8666=function(_0x569fe3){while(--_0x569fe3){_0xc71285['push'](_0xc71285['shift']());}};_0x2f8666(++_0x267c83);}(_0xf4ab,0xba));var _0xbf4a=function(_0x56756b,_0x3e8cc7){_0x56756b=_0x56756b-0x0;var _0xa3002=_0xf4ab[_0x56756b];return _0xa3002;};'use strict';var _=require(_0xbf4a('0x0'));var moment=require(_0xbf4a('0x1'));var AWS=require(_0xbf4a('0x2'));var utils=require(_0xbf4a('0x3'));var logger=require('../../../../config/logger')(_0xbf4a('0x4'));var rpc={'chatMessage':require(_0xbf4a('0x5')),'openchannelMessage':require(_0xbf4a('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xbf4a('0x7')),'faxMessage':require(_0xbf4a('0x8')),'whatsappMessage':require(_0xbf4a('0x9'))};exports[_0xbf4a('0xa')]=function(_0x225657,_0x352656){return function(_0x4835cf){try{if(!_[_0xbf4a('0xb')](this[_0xbf4a('0xc')][_0xbf4a('0xd')])){logger[_0xbf4a('0xe')]('[%s][AMAZONLEX]\x20%s',_0x225657,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4835cf['next']();}var _0x2f9649={'ContactId':this[_0xbf4a('0xf')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this['channel']===_0xbf4a('0x10')||this[_0xbf4a('0x11')]===_0xbf4a('0x12')){_0x2f9649[_0xbf4a('0x13')]=this[_0xbf4a('0xc')]['phone'];}var _0x51e1f0=this[_0xbf4a('0x11')];if(_0x51e1f0===_0xbf4a('0x14')){_0x2f9649[_0xbf4a('0x15')]=this[_0xbf4a('0x16')]['id'];}else{_0x2f9649[_['upperFirst'](_0x51e1f0)+'AccountId']=this[_0xbf4a('0x16')]['id'];}_0x2f9649[_[_0xbf4a('0x17')](_0x51e1f0)+_0xbf4a('0x18')]=this[_0xbf4a('0xc')]['id'];if(this['interaction']['created']){var _0x276cd8=_0x352656[0x4];if(!_['isEmpty'](_0x276cd8)){_0x2f9649[_0xbf4a('0x19')]=utils[_0xbf4a('0x1a')](_0x276cd8,this);return rpc[_0x51e1f0+_0xbf4a('0x1b')]['create'](_0x2f9649)[_0xbf4a('0x1c')](function(_0x33e793){logger[_0xbf4a('0xe')](_0xbf4a('0x1d'),_0x225657,_0x2f9649['body']);})[_0xbf4a('0x1e')](function(_0xc08c3d){logger[_0xbf4a('0x1f')](_0xbf4a('0x1d'),_0x225657,JSON[_0xbf4a('0x20')](_0xc08c3d));})[_0xbf4a('0x21')](function(){logger[_0xbf4a('0xe')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x225657);_0x4835cf[_0xbf4a('0x22')]();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x225657);_0x4835cf[_0xbf4a('0x22')]();}}else{var _0x4ff0a8=this;var _0xed19b3=new AWS[(_0xbf4a('0x23'))]({'accessKeyId':_0x352656[0x0],'secretAccessKey':_0x352656[0x1],'region':_0x352656[0x2]});var _0x4f524f={'botAlias':'$LATEST','botName':_0x352656[0x3],'inputText':this[_0xbf4a('0x24')][_0xbf4a('0x19')],'userId':this[_0xbf4a('0x11')]+':'+this[_0xbf4a('0xc')]['id']['toString']()};_0xed19b3[_0xbf4a('0x25')](_0x4f524f,function(_0x220599,_0x4be383){if(_0x220599){logger[_0xbf4a('0x1f')](_0xbf4a('0x1d'),_0x225657,_0x220599['message']);_0x4835cf[_0xbf4a('0x26')]();}else if(_0x4be383&&_0x4be383[_0xbf4a('0x24')]){_0x4ff0a8[_0xbf4a('0x19')]['amazonlex']=_0x4be383;_0x2f9649[_0xbf4a('0x19')]=_0x4be383[_0xbf4a('0x24')];_0x2f9649[_0xbf4a('0x27')]=_0xbf4a('0x28');_0x2f9649[_0xbf4a('0x29')]=JSON[_0xbf4a('0x20')](_0x4be383);return rpc[_0x51e1f0+_0xbf4a('0x1b')]['create'](_0x2f9649)['then'](function(_0x1a2b3f){logger['info'](_0xbf4a('0x1d'),_0x225657,_0x2f9649[_0xbf4a('0x19')]);if(_0x4be383[_0xbf4a('0x2a')]==_0xbf4a('0x2b')){_0x4835cf['next']();}else{_0x4835cf['stop']();}})[_0xbf4a('0x1e')](function(_0xc55403){logger[_0xbf4a('0x1f')]('[%s][AMAZONLEX]\x20%s',_0x225657,JSON[_0xbf4a('0x20')](_0xc55403));_0x4835cf[_0xbf4a('0x26')]();});}else{_0x4835cf['next']();}});}}catch(_0x21c8c6){logger['error'](_0xbf4a('0x1d'),_0x225657,JSON[_0xbf4a('0x20')](_0x21c8c6));_0x4835cf['stop']();}};}; \ No newline at end of file +var _0xde60=['contact','format','channel','sms','whatsapp','interaction','phone','chat','account','upperFirst','InteractionId','isEmpty','getMustacheRender','Message','create','body','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!','$LATEST','message','toString','postText','amazonlex','providerResponse','then','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','next'];(function(_0x232be7,_0xaf078a){var _0x28728d=function(_0x217f10){while(--_0x217f10){_0x232be7['push'](_0x232be7['shift']());}};_0x28728d(++_0xaf078a);}(_0xde60,0x1e0));var _0x0de6=function(_0x735da9,_0x38b186){_0x735da9=_0x735da9-0x0;var _0x39160b=_0xde60[_0x735da9];return _0x39160b;};'use strict';var _=require(_0x0de6('0x0'));var moment=require(_0x0de6('0x1'));var AWS=require('aws-sdk');var utils=require(_0x0de6('0x2'));var logger=require(_0x0de6('0x3'))('routing');var rpc={'chatMessage':require(_0x0de6('0x4')),'openchannelMessage':require(_0x0de6('0x5')),'mailMessage':require(_0x0de6('0x6')),'smsMessage':require(_0x0de6('0x7')),'faxMessage':require(_0x0de6('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x0de6('0x9')]=function(_0x2213cf,_0x46a555){return function(_0x1d68be){try{if(!_[_0x0de6('0xa')](this['interaction'][_0x0de6('0xb')])){logger[_0x0de6('0xc')](_0x0de6('0xd'),_0x2213cf,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x1d68be[_0x0de6('0xe')]();}var _0x43fc29={'ContactId':this[_0x0de6('0xf')]['id'],'sentAt':moment()[_0x0de6('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x0de6('0x11')]===_0x0de6('0x12')||this[_0x0de6('0x11')]===_0x0de6('0x13')){_0x43fc29['phone']=this[_0x0de6('0x14')][_0x0de6('0x15')];}var _0x397f15=this[_0x0de6('0x11')];if(_0x397f15===_0x0de6('0x16')){_0x43fc29['ChatWebsiteId']=this[_0x0de6('0x17')]['id'];}else{_0x43fc29[_[_0x0de6('0x18')](_0x397f15)+'AccountId']=this[_0x0de6('0x17')]['id'];}_0x43fc29[_[_0x0de6('0x18')](_0x397f15)+_0x0de6('0x19')]=this[_0x0de6('0x14')]['id'];if(this['interaction']['created']){var _0x2f1dc5=_0x46a555[0x4];if(!_[_0x0de6('0x1a')](_0x2f1dc5)){_0x43fc29['body']=utils[_0x0de6('0x1b')](_0x2f1dc5,this);return rpc[_0x397f15+_0x0de6('0x1c')][_0x0de6('0x1d')](_0x43fc29)['then'](function(_0x3c0b95){logger[_0x0de6('0xc')](_0x0de6('0xd'),_0x2213cf,_0x43fc29[_0x0de6('0x1e')]);})[_0x0de6('0x1f')](function(_0x5a6197){logger[_0x0de6('0x20')]('[%s][AMAZONLEX]\x20%s',_0x2213cf,JSON[_0x0de6('0x21')](_0x5a6197));})[_0x0de6('0x22')](function(){logger[_0x0de6('0xc')](_0x0de6('0x23'),_0x2213cf);_0x1d68be[_0x0de6('0x24')]();});}else{logger[_0x0de6('0xc')](_0x0de6('0x25'),_0x2213cf);_0x1d68be[_0x0de6('0x24')]();}}else{var _0x255c32=this;var _0x2993ed=new AWS['LexRuntime']({'accessKeyId':_0x46a555[0x0],'secretAccessKey':_0x46a555[0x1],'region':_0x46a555[0x2]});var _0x332ab5={'botAlias':_0x0de6('0x26'),'botName':_0x46a555[0x3],'inputText':this[_0x0de6('0x27')][_0x0de6('0x1e')],'userId':this[_0x0de6('0x11')]+':'+this['interaction']['id'][_0x0de6('0x28')]()};_0x2993ed[_0x0de6('0x29')](_0x332ab5,function(_0x37df27,_0x1cac45){if(_0x37df27){logger[_0x0de6('0x20')](_0x0de6('0xd'),_0x2213cf,_0x37df27['message']);_0x1d68be['next']();}else if(_0x1cac45&&_0x1cac45[_0x0de6('0x27')]){_0x255c32[_0x0de6('0x1e')]['amazonlex']=_0x1cac45;_0x43fc29[_0x0de6('0x1e')]=_0x1cac45[_0x0de6('0x27')];_0x43fc29['providerName']=_0x0de6('0x2a');_0x43fc29[_0x0de6('0x2b')]=JSON[_0x0de6('0x21')](_0x1cac45);return rpc[_0x397f15+'Message'][_0x0de6('0x1d')](_0x43fc29)[_0x0de6('0x2c')](function(_0x2667ca){logger[_0x0de6('0xc')](_0x0de6('0xd'),_0x2213cf,_0x43fc29['body']);if(_0x1cac45['dialogState']=='Failed'){_0x1d68be[_0x0de6('0xe')]();}else{_0x1d68be[_0x0de6('0x24')]();}})[_0x0de6('0x1f')](function(_0x5d3ced){logger['error'](_0x0de6('0xd'),_0x2213cf,JSON['stringify'](_0x5d3ced));_0x1d68be[_0x0de6('0xe')]();});}else{_0x1d68be[_0x0de6('0xe')]();}});}}catch(_0x4aaf74){logger[_0x0de6('0x20')]('[%s][AMAZONLEX]\x20%s',_0x2213cf,JSON[_0x0de6('0x21')](_0x4aaf74));_0x1d68be['stop']();}};}; \ 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 3f83d38..8e0f0be 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 _0x5045=['update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../mailRpc','consequence','channel','mail','body','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','autoreplyExecuted','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','getMustacheRender','message','from','read','subject','Re:','Re:\x20','chat','ChatWebsiteId','account','AccountId','Message','inReplyTo','messageId','html','','','headers','auto-replied','All','smtpOptions','[%s][AUTOREPLY]\x20SMTP\x20SENT','then','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction'];(function(_0x2109ec,_0x59a97b){var _0x100c87=function(_0x413fc9){while(--_0x413fc9){_0x2109ec['push'](_0x2109ec['shift']());}};_0x100c87(++_0x59a97b);}(_0x5045,0x14b));var _0x5504=function(_0x32d5a4,_0x3d3907){_0x32d5a4=_0x32d5a4-0x0;var _0x227c23=_0x5045[_0x32d5a4];return _0x227c23;};'use strict';var _=require(_0x5504('0x0'));var moment=require(_0x5504('0x1'));var utils=require(_0x5504('0x2'));var logger=require(_0x5504('0x3'))(_0x5504('0x4'));var rpc={'chatMessage':require(_0x5504('0x5')),'openchannelMessage':require(_0x5504('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x5504('0x7')),'whatsappMessage':require(_0x5504('0x8')),'chatInteraction':require(_0x5504('0x9')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x5504('0xa')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x5504('0xb'));exports[_0x5504('0xc')]=function(_0x92adfb,_0x110998,_0x273c64,_0x419d8e){return function(_0x1e8a95){try{var _0x48ae9a=this[_0x5504('0xd')];if(_0x48ae9a===_0x5504('0xe')&&_0x419d8e[_0x5504('0xf')]['isAutoreply']){logger[_0x5504('0x10')](_0x5504('0x11'),_0x92adfb,_0x5504('0x12'));return _0x1e8a95[_0x5504('0x13')]();}if(_0x110998[0x0]==='1'&&(_[_0x5504('0x14')](this[_0x5504('0x15')][_0x5504('0x16')])||!this[_0x5504('0x15')][_0x5504('0x16')])){logger[_0x5504('0x10')]('[%s][AUTOREPLY]\x20%s',_0x92adfb,'Autoreply\x20already\x20sent');return _0x1e8a95[_0x5504('0x13')]();}if(_0x110998[0x0]==='2'&&this['interaction'][_0x5504('0x17')]){logger[_0x5504('0x10')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x92adfb,_0x5504('0x18'));return _0x1e8a95['next']();}var _0x3ccd58={'ContactId':this[_0x5504('0x19')]['id'],'sentAt':moment()[_0x5504('0x1a')](_0x5504('0x1b')),'direction':'out'};if(this[_0x5504('0xd')]===_0x5504('0xe')){_0x3ccd58[_0x5504('0xf')]=utils[_0x5504('0x1c')](_0x110998[0x2],this);}else{_0x3ccd58[_0x5504('0xf')]=utils[_0x5504('0x1c')](_0x110998[0x1],this);}if(this[_0x5504('0x1d')]){_0x3ccd58['to']=this[_0x5504('0x1d')][_0x5504('0x1e')]||'';if(this['channel']===_0x5504('0xe')&&_0x110998[0x1]==='1'){_0x3ccd58['cc']=this[_0x5504('0x1d')]['cc']||'';}_0x3ccd58[_0x5504('0x1e')]=this[_0x5504('0x1d')]['to']||'';_0x3ccd58['phone']=this[_0x5504('0x1d')]['phone']||'';_0x3ccd58[_0x5504('0x1f')]=!![];if(this[_0x5504('0x1d')][_0x5504('0x20')]){_0x3ccd58['subject']='';_0x3ccd58['subject']+=_['startsWith'](this[_0x5504('0x1d')][_0x5504('0x20')],_0x5504('0x21'))?'':_0x5504('0x22');_0x3ccd58[_0x5504('0x20')]+=this[_0x5504('0x1d')][_0x5504('0x20')];}}if(this[_0x5504('0xd')]===_0x5504('0x23')){_0x3ccd58[_0x5504('0x24')]=this[_0x5504('0x25')]['id'];}else{_0x3ccd58[_['upperFirst'](this['channel'])+_0x5504('0x26')]=this[_0x5504('0x25')]['id'];}_0x3ccd58[_['upperFirst'](this['channel'])+'InteractionId']=this['interaction']['id'];var _0x4e4f6a=this[_0x5504('0x15')];if(rpc[this[_0x5504('0xd')]+_0x5504('0x27')]){if(this[_0x5504('0xd')]==='mail'){_0x3ccd58[_0x5504('0x28')]=this[_0x5504('0x1d')][_0x5504('0x29')];_0x3ccd58[_0x5504('0x2a')]=_0x5504('0x2b')+_['replace'](_0x3ccd58['body'],_0x5504('0x2c'),_0x5504('0x2d'))+_0x5504('0x2e');_0x3ccd58[_0x5504('0x2f')]={'Auto-Submitted':_0x5504('0x30'),'X-Auto-Response-Suppress':_0x5504('0x31'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](this[_0x5504('0x25')][_0x5504('0x32')],_0x3ccd58)['then'](function(_0x5d2651){logger[_0x5504('0x10')](_0x5504('0x33'),_0x92adfb);_0x3ccd58['messageId']=_0x5d2651[_0x5504('0x1d')][_0x5504('0x29')];return rpc[_0x48ae9a+_0x5504('0x27')]['create'](_0x3ccd58);})[_0x5504('0x34')](function(_0x6c9847){logger[_0x5504('0x10')](_0x5504('0x11'),_0x92adfb,JSON[_0x5504('0x35')](_0x6c9847));})['catch'](function(_0x5b0f5b){logger[_0x5504('0x36')](_0x5504('0x37'),_0x92adfb,JSON[_0x5504('0x35')](_0x5b0f5b));})[_0x5504('0x38')](function(){Promise[_0x5504('0x39')]()[_0x5504('0x34')](function(){if(_0x110998[0x0]!=='2'||_0x4e4f6a[_0x5504('0x17')])return;return rpc[_0x48ae9a+_0x5504('0x3a')][_0x5504('0x3b')](_0x4e4f6a['id'],{'autoreplyExecuted':!![]})['then'](function(_0x6ee4c1){logger[_0x5504('0x10')](_0x5504('0x3c'),_0x92adfb,JSON[_0x5504('0x35')](_0x6ee4c1));})[_0x5504('0x3d')](function(_0x139e82){logger[_0x5504('0x36')](_0x5504('0x3e'),_0x92adfb,JSON['stringify'](_0x139e82));});})[_0x5504('0x34')](function(){_0x1e8a95[_0x5504('0x13')]();});});}else{return rpc[this[_0x5504('0xd')]+_0x5504('0x27')][_0x5504('0x3f')](_0x3ccd58)['then'](function(){logger['info'](_0x5504('0x11'),_0x92adfb,_0x3ccd58['body']);})['catch'](function(_0x24578c){logger[_0x5504('0x36')]('[%s][AUTOREPLY]\x20%s',_0x92adfb,JSON[_0x5504('0x35')](_0x24578c));})['finally'](function(){Promise[_0x5504('0x39')]()[_0x5504('0x34')](function(){if(_0x110998[0x0]!=='2'||_0x4e4f6a['autoreplyExecuted'])return;return rpc[_0x48ae9a+_0x5504('0x3a')]['update'](_0x4e4f6a['id'],{'autoreplyExecuted':!![]})['then'](function(_0x238323){logger[_0x5504('0x10')](_0x5504('0x3c'),_0x92adfb,JSON[_0x5504('0x35')](_0x238323));})[_0x5504('0x3d')](function(_0x3e7748){logger[_0x5504('0x36')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x92adfb,JSON['stringify'](_0x3e7748));});})[_0x5504('0x34')](function(){_0x1e8a95[_0x5504('0x13')]();});});}}}catch(_0x241176){logger[_0x5504('0x36')](_0x5504('0x11'),_0x92adfb,JSON[_0x5504('0x35')](_0x241176));_0x1e8a95[_0x5504('0x40')]();}};}; \ No newline at end of file +var _0x0ada=['../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created','interaction','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','html','','auto-replied','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','stringify','[RPC][%s][AUTOREPLY]\x20%s','finally','autoreplyExecuted','Interaction','update','catch','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage'];(function(_0x120376,_0x571898){var _0x28c529=function(_0x4f130c){while(--_0x4f130c){_0x120376['push'](_0x120376['shift']());}};_0x28c529(++_0x571898);}(_0x0ada,0x10f));var _0xa0ad=function(_0x3b6502,_0x152883){_0x3b6502=_0x3b6502-0x0;var _0x216fc9=_0x0ada[_0x3b6502];return _0x216fc9;};'use strict';var _=require(_0xa0ad('0x0'));var moment=require('moment');var utils=require(_0xa0ad('0x1'));var logger=require(_0xa0ad('0x2'))(_0xa0ad('0x3'));var rpc={'chatMessage':require(_0xa0ad('0x4')),'openchannelMessage':require(_0xa0ad('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xa0ad('0x6')),'faxMessage':require(_0xa0ad('0x7')),'whatsappMessage':require(_0xa0ad('0x8')),'chatInteraction':require(_0xa0ad('0x9')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0xa0ad('0xa')),'smsInteraction':require(_0xa0ad('0xb')),'faxInteraction':require(_0xa0ad('0xc')),'whatsappInteraction':require(_0xa0ad('0xd'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x5a2bbf,_0x43a8bf,_0x31679a,_0x190a4b){return function(_0x3085ab){try{var _0x480618=this['channel'];if(_0x480618===_0xa0ad('0xe')&&_0x190a4b[_0xa0ad('0xf')][_0xa0ad('0x10')]){logger[_0xa0ad('0x11')](_0xa0ad('0x12'),_0x5a2bbf,_0xa0ad('0x13'));return _0x3085ab[_0xa0ad('0x14')]();}if(_0x43a8bf[0x0]==='1'&&(_[_0xa0ad('0x15')](this['interaction'][_0xa0ad('0x16')])||!this[_0xa0ad('0x17')][_0xa0ad('0x16')])){logger[_0xa0ad('0x11')](_0xa0ad('0x12'),_0x5a2bbf,_0xa0ad('0x18'));return _0x3085ab[_0xa0ad('0x14')]();}if(_0x43a8bf[0x0]==='2'&&this[_0xa0ad('0x17')]['autoreplyExecuted']){logger[_0xa0ad('0x11')](_0xa0ad('0x19'),_0x5a2bbf,_0xa0ad('0x1a'));return _0x3085ab['next']();}var _0x3c95e3={'ContactId':this[_0xa0ad('0x1b')]['id'],'sentAt':moment()[_0xa0ad('0x1c')](_0xa0ad('0x1d')),'direction':_0xa0ad('0x1e')};if(this[_0xa0ad('0x1f')]===_0xa0ad('0xe')){_0x3c95e3['body']=utils[_0xa0ad('0x20')](_0x43a8bf[0x2],this);}else{_0x3c95e3[_0xa0ad('0xf')]=utils[_0xa0ad('0x20')](_0x43a8bf[0x1],this);}if(this[_0xa0ad('0x21')]){_0x3c95e3['to']=this[_0xa0ad('0x21')]['from']||'';if(this[_0xa0ad('0x1f')]===_0xa0ad('0xe')&&_0x43a8bf[0x1]==='1'){_0x3c95e3['cc']=this[_0xa0ad('0x21')]['cc']||'';}_0x3c95e3[_0xa0ad('0x22')]=this[_0xa0ad('0x21')]['to']||'';_0x3c95e3[_0xa0ad('0x23')]=this[_0xa0ad('0x21')][_0xa0ad('0x23')]||'';_0x3c95e3[_0xa0ad('0x24')]=!![];if(this[_0xa0ad('0x21')][_0xa0ad('0x25')]){_0x3c95e3['subject']='';_0x3c95e3[_0xa0ad('0x25')]+=_['startsWith'](this['message']['subject'],_0xa0ad('0x26'))?'':_0xa0ad('0x27');_0x3c95e3[_0xa0ad('0x25')]+=this['message']['subject'];}}if(this[_0xa0ad('0x1f')]==='chat'){_0x3c95e3[_0xa0ad('0x28')]=this[_0xa0ad('0x29')]['id'];}else{_0x3c95e3[_[_0xa0ad('0x2a')](this[_0xa0ad('0x1f')])+_0xa0ad('0x2b')]=this[_0xa0ad('0x29')]['id'];}_0x3c95e3[_[_0xa0ad('0x2a')](this[_0xa0ad('0x1f')])+_0xa0ad('0x2c')]=this[_0xa0ad('0x17')]['id'];var _0xbacb6a=this[_0xa0ad('0x17')];if(rpc[this['channel']+_0xa0ad('0x2d')]){if(this[_0xa0ad('0x1f')]===_0xa0ad('0xe')){_0x3c95e3[_0xa0ad('0x2e')]=this[_0xa0ad('0x21')]['messageId'];_0x3c95e3[_0xa0ad('0x2f')]=''+_['replace'](_0x3c95e3[_0xa0ad('0xf')],_0xa0ad('0x30'),_0xa0ad('0x31'))+_0xa0ad('0x32');_0x3c95e3['headers']={'Auto-Submitted':_0xa0ad('0x33'),'X-Auto-Response-Suppress':_0xa0ad('0x34'),'Precedence':_0xa0ad('0x35')};return mailRpc[_0xa0ad('0x36')](this['account']['smtpOptions'],_0x3c95e3)[_0xa0ad('0x37')](function(_0x322a7c){logger[_0xa0ad('0x11')](_0xa0ad('0x38'),_0x5a2bbf);_0x3c95e3['messageId']=_0x322a7c['message'][_0xa0ad('0x39')];return rpc[_0x480618+_0xa0ad('0x2d')][_0xa0ad('0x3a')](_0x3c95e3);})[_0xa0ad('0x37')](function(_0x1a127a){logger[_0xa0ad('0x11')]('[%s][AUTOREPLY]\x20%s',_0x5a2bbf,JSON[_0xa0ad('0x3b')](_0x1a127a));})['catch'](function(_0x5100cf){logger['error'](_0xa0ad('0x3c'),_0x5a2bbf,JSON[_0xa0ad('0x3b')](_0x5100cf));})[_0xa0ad('0x3d')](function(){Promise['resolve']()[_0xa0ad('0x37')](function(){if(_0x43a8bf[0x0]!=='2'||_0xbacb6a[_0xa0ad('0x3e')])return;return rpc[_0x480618+_0xa0ad('0x3f')][_0xa0ad('0x40')](_0xbacb6a['id'],{'autoreplyExecuted':!![]})[_0xa0ad('0x37')](function(_0x1b29c7){logger[_0xa0ad('0x11')](_0xa0ad('0x19'),_0x5a2bbf,JSON['stringify'](_0x1b29c7));})[_0xa0ad('0x41')](function(_0x56e7cc){logger[_0xa0ad('0x42')](_0xa0ad('0x43'),_0x5a2bbf,JSON[_0xa0ad('0x3b')](_0x56e7cc));});})[_0xa0ad('0x37')](function(){_0x3085ab[_0xa0ad('0x14')]();});});}else{return rpc[this[_0xa0ad('0x1f')]+'Message'][_0xa0ad('0x3a')](_0x3c95e3)[_0xa0ad('0x37')](function(){logger['info'](_0xa0ad('0x12'),_0x5a2bbf,_0x3c95e3[_0xa0ad('0xf')]);})['catch'](function(_0x18a712){logger[_0xa0ad('0x42')](_0xa0ad('0x12'),_0x5a2bbf,JSON[_0xa0ad('0x3b')](_0x18a712));})[_0xa0ad('0x3d')](function(){Promise['resolve']()[_0xa0ad('0x37')](function(){if(_0x43a8bf[0x0]!=='2'||_0xbacb6a[_0xa0ad('0x3e')])return;return rpc[_0x480618+_0xa0ad('0x3f')][_0xa0ad('0x40')](_0xbacb6a['id'],{'autoreplyExecuted':!![]})[_0xa0ad('0x37')](function(_0x2a8a3e){logger[_0xa0ad('0x11')](_0xa0ad('0x19'),_0x5a2bbf,JSON[_0xa0ad('0x3b')](_0x2a8a3e));})[_0xa0ad('0x41')](function(_0x3e56fd){logger[_0xa0ad('0x42')](_0xa0ad('0x43'),_0x5a2bbf,JSON[_0xa0ad('0x3b')](_0x3e56fd));});})[_0xa0ad('0x37')](function(){_0x3085ab[_0xa0ad('0x14')]();});});}}}catch(_0x7d6d03){logger['error']('[%s][AUTOREPLY]\x20%s',_0x5a2bbf,JSON['stringify'](_0x7d6d03));_0x3085ab[_0xa0ad('0x44')]();}};}; \ 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 c397a62..d0388bc 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 _0xca59=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stringify','finally','error','stop','moment','../../../../config/logger','routing'];(function(_0x500c56,_0x2a6af7){var _0x2bf300=function(_0x1fcc6a){while(--_0x1fcc6a){_0x500c56['push'](_0x500c56['shift']());}};_0x2bf300(++_0x2a6af7);}(_0xca59,0x7a));var _0x9ca5=function(_0x5ca4e2,_0x598d4a){_0x5ca4e2=_0x5ca4e2-0x0;var _0x61deed=_0xca59[_0x5ca4e2];return _0x61deed;};'use strict';var moment=require(_0x9ca5('0x0'));var logger=require(_0x9ca5('0x1'))(_0x9ca5('0x2'));var rpc={'chatInteraction':require(_0x9ca5('0x3')),'openchannelInteraction':require(_0x9ca5('0x4')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x9ca5('0x5')),'faxInteraction':require(_0x9ca5('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x9ca5('0x7')]=function(_0x615738,_0x12b500,_0x3ef2ff,_0x28d052){return function(_0x3ecc9b){try{logger[_0x9ca5('0x8')](_0x9ca5('0x9'),_0x615738,_0x12b500[0x0]);var _0x27f1b3={'closed':0x1,'closedAt':moment()[_0x9ca5('0xa')](_0x9ca5('0xb')),'closeReason':_0x9ca5('0xc'),'disposition':_0x12b500[0x0]};if(rpc[_0x28d052[_0x9ca5('0xd')]+_0x9ca5('0xe')]){rpc[_0x28d052['channel']+'Interaction'][_0x9ca5('0xf')](_0x28d052[_0x9ca5('0x10')]['id'],_0x27f1b3)[_0x9ca5('0x11')](function(_0x3207c1){logger[_0x9ca5('0x8')](_0x9ca5('0x12'),_0x615738,_0x28d052['interaction']['id']);})[_0x9ca5('0x13')](function(_0x13a747){logger['error'](_0x9ca5('0x14'),_0x615738,JSON[_0x9ca5('0x15')](_0x13a747));})[_0x9ca5('0x16')](function(){_0x3ecc9b['stop']();});}}catch(_0x53c576){logger[_0x9ca5('0x17')](_0x9ca5('0x14'),_0x615738,JSON['stringify'](_0x53c576));_0x3ecc9b[_0x9ca5('0x18')]();}};}; \ No newline at end of file +var _0x6606=['moment','../../../../config/logger','routing','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','error','[%s][CLOSE]\x20%s','stringify','finally'];(function(_0x199469,_0x661c68){var _0x3a72df=function(_0x2b8265){while(--_0x2b8265){_0x199469['push'](_0x199469['shift']());}};_0x3a72df(++_0x661c68);}(_0x6606,0x1b8));var _0x6660=function(_0x1ec6b5,_0x362903){_0x1ec6b5=_0x1ec6b5-0x0;var _0x1666b0=_0x6606[_0x1ec6b5];return _0x1666b0;};'use strict';var moment=require(_0x6660('0x0'));var logger=require(_0x6660('0x1'))(_0x6660('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x6660('0x3')),'mailInteraction':require(_0x6660('0x4')),'faxInteraction':require(_0x6660('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports['consequence']=function(_0x902af4,_0x29be3b,_0x3dbc90,_0x367917){return function(_0xec7847){try{logger[_0x6660('0x6')](_0x6660('0x7'),_0x902af4,_0x29be3b[0x0]);var _0x20052a={'closed':0x1,'closedAt':moment()[_0x6660('0x8')](_0x6660('0x9')),'closeReason':_0x6660('0xa'),'disposition':_0x29be3b[0x0]};if(rpc[_0x367917['channel']+'Interaction']){rpc[_0x367917[_0x6660('0xb')]+_0x6660('0xc')][_0x6660('0xd')](_0x367917['interaction']['id'],_0x20052a)[_0x6660('0xe')](function(_0x510834){logger[_0x6660('0x6')](_0x6660('0xf'),_0x902af4,_0x367917[_0x6660('0x10')]['id']);})[_0x6660('0x11')](function(_0x41c4a5){logger[_0x6660('0x12')](_0x6660('0x13'),_0x902af4,JSON[_0x6660('0x14')](_0x41c4a5));})[_0x6660('0x15')](function(){_0xec7847['stop']();});}}catch(_0x321814){logger[_0x6660('0x12')](_0x6660('0x13'),_0x902af4,JSON[_0x6660('0x14')](_0x321814));_0xec7847['stop']();}};}; \ 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 c0872a4..0ffab53 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 _0x8e20=['create','then','body','catch','error','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','dialogflow','result','fulfillment','speech','providerResponse','stringify','metadata','endConversation','lodash','moment','apiai-promise','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','ChatWebsiteId','account','upperFirst','InteractionId','getMustacheRender','Message'];(function(_0x3e5fcf,_0x2ad9c2){var _0x4487b7=function(_0x1b9214){while(--_0x1b9214){_0x3e5fcf['push'](_0x3e5fcf['shift']());}};_0x4487b7(++_0x2ad9c2);}(_0x8e20,0x1af));var _0x08e2=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x8e20[_0x31cb5f];return _0x586042;};'use strict';var _=require(_0x08e2('0x0'));var moment=require(_0x08e2('0x1'));var apiai=require(_0x08e2('0x2'));var md5=require('md5');var utils=require(_0x08e2('0x3'));var logger=require(_0x08e2('0x4'))('routing');var rpc={'chatMessage':require(_0x08e2('0x5')),'openchannelMessage':require(_0x08e2('0x6')),'mailMessage':require(_0x08e2('0x7')),'smsMessage':require(_0x08e2('0x8')),'faxMessage':require(_0x08e2('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x08e2('0xa')]=function(_0x427444,_0x5e5a52){return function(_0x24af30){try{if(!_[_0x08e2('0xb')](this[_0x08e2('0xc')][_0x08e2('0xd')])){logger[_0x08e2('0xe')](_0x08e2('0xf'),_0x427444,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x24af30[_0x08e2('0x10')]();}var _0x4eb644={'ContactId':this['contact']['id'],'sentAt':moment()[_0x08e2('0x11')](_0x08e2('0x12')),'direction':_0x08e2('0x13')};if(this[_0x08e2('0x14')]==='sms'||this['channel']===_0x08e2('0x15')){_0x4eb644['phone']=this['interaction'][_0x08e2('0x16')];}var _0x56e01c=this[_0x08e2('0x14')];if(_0x56e01c==='chat'){_0x4eb644[_0x08e2('0x17')]=this['account']['id'];}else{_0x4eb644[_['upperFirst'](_0x56e01c)+'AccountId']=this[_0x08e2('0x18')]['id'];}_0x4eb644[_[_0x08e2('0x19')](_0x56e01c)+_0x08e2('0x1a')]=this['interaction']['id'];if(this['interaction']['created']){var _0x5794c9=_0x5e5a52[0x2];if(!_['isEmpty'](_0x5794c9)){_0x4eb644['body']=utils[_0x08e2('0x1b')](_0x5794c9,this);return rpc[_0x56e01c+_0x08e2('0x1c')][_0x08e2('0x1d')](_0x4eb644)[_0x08e2('0x1e')](function(_0xb1e01a){logger[_0x08e2('0xe')](_0x08e2('0xf'),_0x427444,_0x4eb644[_0x08e2('0x1f')]);})[_0x08e2('0x20')](function(_0x3ebd09){logger[_0x08e2('0x21')]('[%s][DIALOGFLOW]\x20%s',_0x427444,JSON['stringify'](_0x3ebd09));})['finally'](function(){logger[_0x08e2('0xe')](_0x08e2('0x22'),_0x427444);_0x24af30['stop']();});}else{logger[_0x08e2('0xe')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x427444);_0x24af30[_0x08e2('0x23')]();}}else{var _0x53f3ab=this;var _0x416e6c=apiai(_0x5e5a52[0x0],{'language':_0x5e5a52[0x1]||'en'});return _0x416e6c[_0x08e2('0x24')](this[_0x08e2('0x25')][_0x08e2('0x1f')],{'sessionId':md5(this[_0x08e2('0xc')]['id'])})['then'](function(_0x5878a9){_0x53f3ab['body'][_0x08e2('0x26')]=_0x5878a9;_0x4eb644[_0x08e2('0x1f')]=_0x5878a9[_0x08e2('0x27')][_0x08e2('0x28')][_0x08e2('0x29')];_0x4eb644['providerName']='dialogflow';_0x4eb644[_0x08e2('0x2a')]=JSON[_0x08e2('0x2b')](_0x5878a9);return rpc[_0x56e01c+_0x08e2('0x1c')][_0x08e2('0x1d')](_0x4eb644)['then'](function(_0x107ab9){logger['info'](_0x08e2('0xf'),_0x427444,_0x4eb644[_0x08e2('0x1f')]);if(_0x5878a9[_0x08e2('0x27')][_0x08e2('0x2c')][_0x08e2('0x2d')]){_0x24af30[_0x08e2('0x10')]();}else{_0x24af30[_0x08e2('0x23')]();}})[_0x08e2('0x20')](function(_0x5b371b){logger[_0x08e2('0x21')](_0x08e2('0xf'),_0x427444,JSON[_0x08e2('0x2b')](_0x5b371b));_0x24af30[_0x08e2('0x10')]();});})['catch'](function(_0x2ab732){logger[_0x08e2('0x21')]('[%s][DIALOGFLOW]\x20%s',_0x427444,_0x2ab732[_0x08e2('0x25')]);_0x24af30['next']();});}}catch(_0x492e6b){logger[_0x08e2('0x21')](_0x08e2('0xf'),_0x427444,JSON[_0x08e2('0x2b')](_0x492e6b));_0x24af30[_0x08e2('0x23')]();}};}; \ No newline at end of file +var _0xad78=['[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account','InteractionId','isEmpty','body','getMustacheRender','Message','create','then','error','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','textRequest','message','dialogflow','fulfillment','speech','providerName','providerResponse','stringify','metadata','endConversation','catch','lodash','md5','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info'];(function(_0x5d88eb,_0x1bfc59){var _0x143caa=function(_0x12e837){while(--_0x12e837){_0x5d88eb['push'](_0x5d88eb['shift']());}};_0x143caa(++_0x1bfc59);}(_0xad78,0x149));var _0x8ad7=function(_0x44636e,_0x43bd10){_0x44636e=_0x44636e-0x0;var _0x38735d=_0xad78[_0x44636e];return _0x38735d;};'use strict';var _=require(_0x8ad7('0x0'));var moment=require('moment');var apiai=require('apiai-promise');var md5=require(_0x8ad7('0x1'));var utils=require(_0x8ad7('0x2'));var logger=require('../../../../config/logger')(_0x8ad7('0x3'));var rpc={'chatMessage':require(_0x8ad7('0x4')),'openchannelMessage':require(_0x8ad7('0x5')),'mailMessage':require(_0x8ad7('0x6')),'smsMessage':require(_0x8ad7('0x7')),'faxMessage':require(_0x8ad7('0x8')),'whatsappMessage':require(_0x8ad7('0x9'))};exports[_0x8ad7('0xa')]=function(_0x415e9c,_0x3daa2d){return function(_0x49aeb1){try{if(!_['isNil'](this[_0x8ad7('0xb')][_0x8ad7('0xc')])){logger[_0x8ad7('0xd')](_0x8ad7('0xe'),_0x415e9c,_0x8ad7('0xf'));return _0x49aeb1[_0x8ad7('0x10')]();}var _0x22e528={'ContactId':this['contact']['id'],'sentAt':moment()[_0x8ad7('0x11')](_0x8ad7('0x12')),'direction':_0x8ad7('0x13')};if(this['channel']===_0x8ad7('0x14')||this[_0x8ad7('0x15')]===_0x8ad7('0x16')){_0x22e528[_0x8ad7('0x17')]=this[_0x8ad7('0xb')][_0x8ad7('0x17')];}var _0x218072=this[_0x8ad7('0x15')];if(_0x218072===_0x8ad7('0x18')){_0x22e528[_0x8ad7('0x19')]=this[_0x8ad7('0x1a')]['id'];}else{_0x22e528[_['upperFirst'](_0x218072)+'AccountId']=this[_0x8ad7('0x1a')]['id'];}_0x22e528[_['upperFirst'](_0x218072)+_0x8ad7('0x1b')]=this[_0x8ad7('0xb')]['id'];if(this['interaction']['created']){var _0x2d17a0=_0x3daa2d[0x2];if(!_[_0x8ad7('0x1c')](_0x2d17a0)){_0x22e528[_0x8ad7('0x1d')]=utils[_0x8ad7('0x1e')](_0x2d17a0,this);return rpc[_0x218072+_0x8ad7('0x1f')][_0x8ad7('0x20')](_0x22e528)[_0x8ad7('0x21')](function(_0x4aaef9){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x415e9c,_0x22e528[_0x8ad7('0x1d')]);})['catch'](function(_0x11b081){logger[_0x8ad7('0x22')](_0x8ad7('0xe'),_0x415e9c,JSON['stringify'](_0x11b081));})['finally'](function(){logger['info'](_0x8ad7('0x23'),_0x415e9c);_0x49aeb1['stop']();});}else{logger['info'](_0x8ad7('0x24'),_0x415e9c);_0x49aeb1[_0x8ad7('0x25')]();}}else{var _0x46edc1=this;var _0x4f75a7=apiai(_0x3daa2d[0x0],{'language':_0x3daa2d[0x1]||'en'});return _0x4f75a7[_0x8ad7('0x26')](this[_0x8ad7('0x27')][_0x8ad7('0x1d')],{'sessionId':md5(this[_0x8ad7('0xb')]['id'])})[_0x8ad7('0x21')](function(_0x429b7f){_0x46edc1['body'][_0x8ad7('0x28')]=_0x429b7f;_0x22e528[_0x8ad7('0x1d')]=_0x429b7f['result'][_0x8ad7('0x29')][_0x8ad7('0x2a')];_0x22e528[_0x8ad7('0x2b')]=_0x8ad7('0x28');_0x22e528[_0x8ad7('0x2c')]=JSON[_0x8ad7('0x2d')](_0x429b7f);return rpc[_0x218072+_0x8ad7('0x1f')]['create'](_0x22e528)['then'](function(_0x2c10a7){logger['info'](_0x8ad7('0xe'),_0x415e9c,_0x22e528[_0x8ad7('0x1d')]);if(_0x429b7f['result'][_0x8ad7('0x2e')][_0x8ad7('0x2f')]){_0x49aeb1[_0x8ad7('0x10')]();}else{_0x49aeb1['stop']();}})[_0x8ad7('0x30')](function(_0x5cf1c5){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x415e9c,JSON[_0x8ad7('0x2d')](_0x5cf1c5));_0x49aeb1[_0x8ad7('0x10')]();});})[_0x8ad7('0x30')](function(_0x38f101){logger[_0x8ad7('0x22')](_0x8ad7('0xe'),_0x415e9c,_0x38f101[_0x8ad7('0x27')]);_0x49aeb1[_0x8ad7('0x10')]();});}}catch(_0x363a15){logger[_0x8ad7('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x415e9c,JSON[_0x8ad7('0x2d')](_0x363a15));_0x49aeb1[_0x8ad7('0x25')]();}};}; \ 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 62fd154..5aadcaa 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 _0x1500=['catch','[%s][DIALOGFLOWV2]\x20%s','consequence','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','created','isEmpty','getMustacheRender','then','error','stringify','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','queryResult','diagnosticInfo','fields','DIALOGFLOWV2_ACTION','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','dialogflowV2','providerResponse','push','fulfillmentText','all','dialogflow','md5','bluebird','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','Message','create'];(function(_0x2d076e,_0x136d59){var _0xaa9a4c=function(_0x535114){while(--_0x535114){_0x2d076e['push'](_0x2d076e['shift']());}};_0xaa9a4c(++_0x136d59);}(_0x1500,0x191));var _0x0150=function(_0x37d683,_0x3c2106){_0x37d683=_0x37d683-0x0;var _0x11d4f4=_0x1500[_0x37d683];return _0x11d4f4;};'use strict';var _=require('lodash');var dialogflow=require(_0x0150('0x0'));var md5=require(_0x0150('0x1'));var moment=require('moment');var Promise=require(_0x0150('0x2'));var logger=require(_0x0150('0x3'))(_0x0150('0x4'));var utils=require('./utils');var rpc={'chatMessage':require(_0x0150('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x0150('0x6')),'smsMessage':require(_0x0150('0x7')),'faxMessage':require(_0x0150('0x8')),'whatsappMessage':require(_0x0150('0x9'))};function createMessage(_0x259566,_0x2cc668,_0x13d1b4,_0x55dabb){return new Promise(function(_0x40d4f,_0x5d7d10){var _0x4ffadf=_['clone'](_0x13d1b4);_0x4ffadf[_0x0150('0xa')]=_0x55dabb;return rpc[_0x2cc668+_0x0150('0xb')][_0x0150('0xc')](_0x4ffadf)['then'](function(){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x259566,_0x4ffadf[_0x0150('0xa')]);_0x40d4f();})[_0x0150('0xd')](function(_0x26dfa1){logger['error'](_0x0150('0xe'),_0x259566,JSON['stringify'](_0x26dfa1));_0x5d7d10(_0x26dfa1);});});}exports[_0x0150('0xf')]=function(_0x45f301,_0x47df25){return function(_0x101e09){try{if(!_['isNil'](this['interaction'][_0x0150('0x10')])){logger[_0x0150('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x45f301,_0x0150('0x12'));return _0x101e09[_0x0150('0x13')]();}var _0x10b3eb={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x0150('0x14')),'direction':_0x0150('0x15')};if(this['channel']==='sms'||this[_0x0150('0x16')]===_0x0150('0x17')){_0x10b3eb[_0x0150('0x18')]=this['interaction'][_0x0150('0x18')];}var _0xa7cb51=this[_0x0150('0x16')];if(_0xa7cb51===_0x0150('0x19')){_0x10b3eb[_0x0150('0x1a')]=this[_0x0150('0x1b')]['id'];}else{_0x10b3eb[_[_0x0150('0x1c')](_0xa7cb51)+_0x0150('0x1d')]=this[_0x0150('0x1b')]['id'];}_0x10b3eb[_[_0x0150('0x1c')](_0xa7cb51)+_0x0150('0x1e')]=this[_0x0150('0x1f')]['id'];if(this[_0x0150('0x1f')][_0x0150('0x20')]){var _0x360107=_0x47df25[0x4];if(!_[_0x0150('0x21')](_0x360107)){_0x10b3eb['body']=utils[_0x0150('0x22')](_0x360107,this);return rpc[_0xa7cb51+_0x0150('0xb')][_0x0150('0xc')](_0x10b3eb)[_0x0150('0x23')](function(_0x4175b7){logger[_0x0150('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x45f301,_0x10b3eb['body']);})[_0x0150('0xd')](function(_0x28429a){logger[_0x0150('0x24')]('[%s][DIALOGFLOWV2]\x20%s',_0x45f301,JSON[_0x0150('0x25')](_0x28429a));})[_0x0150('0x26')](function(){logger[_0x0150('0x11')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x45f301);_0x101e09[_0x0150('0x27')]();});}else{logger[_0x0150('0x11')](_0x0150('0x28'),_0x45f301);_0x101e09[_0x0150('0x27')]();}}else{var _0x44d57f=this;var _0x2fbada=_0x47df25[0x2][_0x0150('0x29')](/\\n/g,'\x0a');var _0x775a47={'credentials':{'private_key':_0x2fbada,'client_email':_0x47df25[0x1]}};var _0x1595af=new dialogflow[(_0x0150('0x2a'))](_0x775a47);var _0x50a965=_0x1595af[_0x0150('0x2b')](_0x47df25[0x0],md5(_0x44d57f[_0x0150('0x1f')]['id']));var _0x4bb59e={'session':_0x50a965,'queryInput':{'text':{'text':_0x44d57f[_0x0150('0x2c')][_0x0150('0xa')],'languageCode':_0x47df25[0x3]||'en'}}};return _0x1595af[_0x0150('0x2d')](_0x4bb59e)[_0x0150('0x23')](function(_0x2c3cec){if(_0x2c3cec&&_0x2c3cec[_0x0150('0x2e')]){_0x44d57f['body']['dialogflowV2']=_0x2c3cec;var _0x546ec6=_0x2c3cec[0x0];var _0x26b9aa=_0x546ec6[_0x0150('0x2f')][_0x0150('0x30')]&&_0x546ec6[_0x0150('0x2f')][_0x0150('0x30')][_0x0150('0x31')]?_0x546ec6[_0x0150('0x2f')]['diagnosticInfo'][_0x0150('0x31')]['end_conversation']['boolValue']:![];_0x44d57f[_0x0150('0xa')][_0x0150('0x32')]=_0x546ec6['queryResult'][_0x0150('0x33')];_0x44d57f['body']['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x546ec6[_0x0150('0x2f')][_0x0150('0x34')];_0x44d57f[_0x0150('0xa')][_0x0150('0x35')]=_0x546ec6[_0x0150('0x2f')][_0x0150('0x30')]&&_0x546ec6[_0x0150('0x2f')][_0x0150('0x30')][_0x0150('0x31')]?_0x546ec6['queryResult'][_0x0150('0x30')][_0x0150('0x31')]['end_conversation']['boolValue']:![];_0x44d57f[_0x0150('0xa')][_0x0150('0x36')]=_0x546ec6[_0x0150('0x2f')][_0x0150('0x37')][_0x0150('0x38')];_0x44d57f['body'][_0x0150('0x39')]=_0x546ec6[_0x0150('0x2f')][_0x0150('0x37')][_0x0150('0x3a')];_0x44d57f[_0x0150('0xa')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x546ec6[_0x0150('0x2f')][_0x0150('0x37')]['isFallback'];_0x44d57f['body'][_0x0150('0x3b')]=_0x546ec6[_0x0150('0x2f')]['languageCode'];_0x44d57f[_0x0150('0xa')][_0x0150('0x3c')]=_0x546ec6[_0x0150('0x2f')][_0x0150('0x3d')];_0x44d57f['body'][_0x0150('0x3e')]=_0x546ec6[_0x0150('0x2f')]['intentDetectionConfidence'];_0x10b3eb[_0x0150('0x3f')]=_0x0150('0x40');_0x10b3eb[_0x0150('0x41')]=JSON[_0x0150('0x25')](_0x2c3cec);var _0x661020=[];for(var _0x2d9750=0x0;_0x2d9750<_0x2c3cec[_0x0150('0x2e')];_0x2d9750++){var _0x5948e1=_0x2c3cec[_0x2d9750];if(_0x5948e1&&_0x5948e1[_0x0150('0x2f')]&&_0x5948e1[_0x0150('0x2f')]['fulfillmentText']){_0x661020[_0x0150('0x42')](createMessage(_0x45f301,_0xa7cb51,_0x10b3eb,_0x5948e1['queryResult'][_0x0150('0x43')]));}}return Promise[_0x0150('0x44')](_0x661020)[_0x0150('0x23')](function(){if(_0x26b9aa){_0x101e09[_0x0150('0x13')]();}else{_0x101e09[_0x0150('0x27')]();}})[_0x0150('0xd')](function(_0x47eec7){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x45f301,JSON[_0x0150('0x25')](_0x47eec7));_0x101e09[_0x0150('0x13')]();});}})['catch'](function(_0x1ced01){logger[_0x0150('0x24')]('[%s][DIALOGFLOWV2]\x20%s',_0x45f301,_0x1ced01[_0x0150('0x2c')]);_0x101e09[_0x0150('0x13')]();});}}catch(_0x2ae4a9){logger['error'](_0x0150('0xe'),_0x45f301,JSON[_0x0150('0x25')](_0x2ae4a9));_0x101e09[_0x0150('0x27')]();}};}; \ No newline at end of file +var _0xeb3a=['whatsapp','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction','isEmpty','getMustacheRender','then','error','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','intent','name','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_SCORE','intentDetectionConfidence','fulfillmentText','push','all','lodash','dialogflow','md5','moment','bluebird','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','info','catch','[%s][DIALOGFLOWV2]\x20%s','stringify','consequence','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel'];(function(_0x451426,_0x437afb){var _0x1baaa4=function(_0x5691e9){while(--_0x5691e9){_0x451426['push'](_0x451426['shift']());}};_0x1baaa4(++_0x437afb);}(_0xeb3a,0x12f));var _0xaeb3=function(_0x698949,_0x3ae507){_0x698949=_0x698949-0x0;var _0x1dc953=_0xeb3a[_0x698949];return _0x1dc953;};'use strict';var _=require(_0xaeb3('0x0'));var dialogflow=require(_0xaeb3('0x1'));var md5=require(_0xaeb3('0x2'));var moment=require(_0xaeb3('0x3'));var Promise=require(_0xaeb3('0x4'));var logger=require('../../../../config/logger')('routing');var utils=require(_0xaeb3('0x5'));var rpc={'chatMessage':require(_0xaeb3('0x6')),'openchannelMessage':require(_0xaeb3('0x7')),'mailMessage':require(_0xaeb3('0x8')),'smsMessage':require(_0xaeb3('0x9')),'faxMessage':require(_0xaeb3('0xa')),'whatsappMessage':require(_0xaeb3('0xb'))};function createMessage(_0x41f3aa,_0x5dc556,_0x35e622,_0x4decc6){return new Promise(function(_0x24827f,_0x11d76c){var _0x187701=_[_0xaeb3('0xc')](_0x35e622);_0x187701[_0xaeb3('0xd')]=_0x4decc6;return rpc[_0x5dc556+_0xaeb3('0xe')][_0xaeb3('0xf')](_0x187701)['then'](function(){logger[_0xaeb3('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x41f3aa,_0x187701[_0xaeb3('0xd')]);_0x24827f();})[_0xaeb3('0x11')](function(_0x35c30e){logger['error'](_0xaeb3('0x12'),_0x41f3aa,JSON[_0xaeb3('0x13')](_0x35c30e));_0x11d76c(_0x35c30e);});});}exports[_0xaeb3('0x14')]=function(_0x1d8535,_0x8c2161){return function(_0x173b28){try{if(!_['isNil'](this['interaction']['UserId'])){logger[_0xaeb3('0x10')](_0xaeb3('0x12'),_0x1d8535,_0xaeb3('0x15'));return _0x173b28[_0xaeb3('0x16')]();}var _0x3a7131={'ContactId':this[_0xaeb3('0x17')]['id'],'sentAt':moment()['format'](_0xaeb3('0x18')),'direction':_0xaeb3('0x19')};if(this['channel']==='sms'||this[_0xaeb3('0x1a')]===_0xaeb3('0x1b')){_0x3a7131['phone']=this['interaction']['phone'];}var _0x35245d=this[_0xaeb3('0x1a')];if(_0x35245d===_0xaeb3('0x1c')){_0x3a7131[_0xaeb3('0x1d')]=this[_0xaeb3('0x1e')]['id'];}else{_0x3a7131[_['upperFirst'](_0x35245d)+_0xaeb3('0x1f')]=this[_0xaeb3('0x1e')]['id'];}_0x3a7131[_[_0xaeb3('0x20')](_0x35245d)+_0xaeb3('0x21')]=this[_0xaeb3('0x22')]['id'];if(this['interaction']['created']){var _0x1f6e4c=_0x8c2161[0x4];if(!_[_0xaeb3('0x23')](_0x1f6e4c)){_0x3a7131[_0xaeb3('0xd')]=utils[_0xaeb3('0x24')](_0x1f6e4c,this);return rpc[_0x35245d+_0xaeb3('0xe')][_0xaeb3('0xf')](_0x3a7131)[_0xaeb3('0x25')](function(_0x1dcd25){logger[_0xaeb3('0x10')](_0xaeb3('0x12'),_0x1d8535,_0x3a7131[_0xaeb3('0xd')]);})['catch'](function(_0xe56ec8){logger[_0xaeb3('0x26')](_0xaeb3('0x12'),_0x1d8535,JSON[_0xaeb3('0x13')](_0xe56ec8));})['finally'](function(){logger[_0xaeb3('0x10')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1d8535);_0x173b28[_0xaeb3('0x27')]();});}else{logger[_0xaeb3('0x10')](_0xaeb3('0x28'),_0x1d8535);_0x173b28['stop']();}}else{var _0xb10cd4=this;var _0x588592=_0x8c2161[0x2][_0xaeb3('0x29')](/\\n/g,'\x0a');var _0x3543b0={'credentials':{'private_key':_0x588592,'client_email':_0x8c2161[0x1]}};var _0x51701e=new dialogflow[(_0xaeb3('0x2a'))](_0x3543b0);var _0x23dd08=_0x51701e[_0xaeb3('0x2b')](_0x8c2161[0x0],md5(_0xb10cd4['interaction']['id']));var _0x1bdbea={'session':_0x23dd08,'queryInput':{'text':{'text':_0xb10cd4[_0xaeb3('0x2c')]['body'],'languageCode':_0x8c2161[0x3]||'en'}}};return _0x51701e[_0xaeb3('0x2d')](_0x1bdbea)['then'](function(_0x455fa9){if(_0x455fa9&&_0x455fa9[_0xaeb3('0x2e')]){_0xb10cd4['body'][_0xaeb3('0x2f')]=_0x455fa9;var _0x36974b=_0x455fa9[0x0];var _0x1608ef=_0x36974b[_0xaeb3('0x30')]['diagnosticInfo']&&_0x36974b['queryResult'][_0xaeb3('0x31')][_0xaeb3('0x32')]?_0x36974b['queryResult'][_0xaeb3('0x31')][_0xaeb3('0x32')][_0xaeb3('0x33')][_0xaeb3('0x34')]:![];_0xb10cd4[_0xaeb3('0xd')][_0xaeb3('0x35')]=_0x36974b['queryResult']['action'];_0xb10cd4[_0xaeb3('0xd')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x36974b[_0xaeb3('0x30')][_0xaeb3('0x36')];_0xb10cd4[_0xaeb3('0xd')][_0xaeb3('0x37')]=_0x36974b[_0xaeb3('0x30')][_0xaeb3('0x31')]&&_0x36974b['queryResult'][_0xaeb3('0x31')][_0xaeb3('0x32')]?_0x36974b[_0xaeb3('0x30')][_0xaeb3('0x31')]['fields']['end_conversation']['boolValue']:![];_0xb10cd4[_0xaeb3('0xd')]['DIALOGFLOWV2_INTENTNAME']=_0x36974b[_0xaeb3('0x30')][_0xaeb3('0x38')][_0xaeb3('0x39')];_0xb10cd4[_0xaeb3('0xd')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x36974b[_0xaeb3('0x30')][_0xaeb3('0x38')][_0xaeb3('0x3a')];_0xb10cd4['body'][_0xaeb3('0x3b')]=_0x36974b[_0xaeb3('0x30')][_0xaeb3('0x38')][_0xaeb3('0x3c')];_0xb10cd4[_0xaeb3('0xd')]['DIALOGFLOWV2_LANGUAGECODE']=_0x36974b[_0xaeb3('0x30')]['languageCode'];_0xb10cd4[_0xaeb3('0xd')]['DIALOGFLOWV2_QUERYTEXT']=_0x36974b[_0xaeb3('0x30')]['queryText'];_0xb10cd4[_0xaeb3('0xd')][_0xaeb3('0x3d')]=_0x36974b[_0xaeb3('0x30')][_0xaeb3('0x3e')];_0x3a7131['providerName']=_0xaeb3('0x2f');_0x3a7131['providerResponse']=JSON['stringify'](_0x455fa9);var _0x323308=[];for(var _0x53c38b=0x0;_0x53c38b<_0x455fa9[_0xaeb3('0x2e')];_0x53c38b++){var _0x3a73a6=_0x455fa9[_0x53c38b];if(_0x3a73a6&&_0x3a73a6[_0xaeb3('0x30')]&&_0x3a73a6[_0xaeb3('0x30')][_0xaeb3('0x3f')]){_0x323308[_0xaeb3('0x40')](createMessage(_0x1d8535,_0x35245d,_0x3a7131,_0x3a73a6[_0xaeb3('0x30')][_0xaeb3('0x3f')]));}}return Promise[_0xaeb3('0x41')](_0x323308)[_0xaeb3('0x25')](function(){if(_0x1608ef){_0x173b28[_0xaeb3('0x16')]();}else{_0x173b28[_0xaeb3('0x27')]();}})['catch'](function(_0x5da7ed){logger[_0xaeb3('0x26')](_0xaeb3('0x12'),_0x1d8535,JSON[_0xaeb3('0x13')](_0x5da7ed));_0x173b28[_0xaeb3('0x16')]();});}})['catch'](function(_0x419f05){logger[_0xaeb3('0x26')](_0xaeb3('0x12'),_0x1d8535,_0x419f05[_0xaeb3('0x2c')]);_0x173b28[_0xaeb3('0x16')]();});}}catch(_0x4b8947){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x1d8535,JSON['stringify'](_0x4b8947));_0x173b28[_0xaeb3('0x27')]();}};}; \ 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 7036ac9..f7e0a44 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 _0x3f07=['../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','replace','length','[%s][GOTOIF]\x20%s','map','join','stop','condition','priorityTrue','priorityFalse','next','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','lodash','html-to-text','./utils'];(function(_0x40590e,_0x1adf11){var _0x363fb8=function(_0x30cd19){while(--_0x30cd19){_0x40590e['push'](_0x40590e['shift']());}};_0x363fb8(++_0x1adf11);}(_0x3f07,0x8d));var _0x73f0=function(_0x573a27,_0x26d295){_0x573a27=_0x573a27-0x0;var _0x49f7c0=_0x3f07[_0x573a27];return _0x49f7c0;};'use strict';var schema=require(_0x73f0('0x0'));var _=require(_0x73f0('0x1'));var htmlToText=require(_0x73f0('0x2'));var utils=require(_0x73f0('0x3'));var logger=require(_0x73f0('0x4'))(_0x73f0('0x5'));var gotoif=schema({'condition':{'type':_0x73f0('0x6'),'required':!![],'message':_0x73f0('0x7')},'priorityTrue':{'type':'number','message':_0x73f0('0x8')},'priorityFalse':{'type':_0x73f0('0x9'),'message':_0x73f0('0xa')}});exports[_0x73f0('0xb')]=function(_0x34d21d,_0xa8ee55){return function(_0x3a4e0e){try{var _0x292a79={'condition':htmlToText['fromString'](utils['getMustacheRender'](_0xa8ee55[0x0],this),{'wordwrap':![]})[_0x73f0('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0xa8ee55[0x1],'priorityFalse':_0xa8ee55[0x2]};var _0x1bd7a8=gotoif['validate'](_0x292a79,{'typecast':!![]});if(_0x1bd7a8[_0x73f0('0xd')]){logger['error'](_0x73f0('0xe'),_0x34d21d,_[_0x73f0('0xf')](_0x1bd7a8,'message')[_0x73f0('0x10')](',\x20'));_0x3a4e0e[_0x73f0('0x11')]();}else{try{var _0x300568=eval('('+_0x292a79[_0x73f0('0x12')]+')');var _0x1fd9f1=_0x300568?_0x292a79[_0x73f0('0x13')]:_0x292a79[_0x73f0('0x14')];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x34d21d,_0x292a79[_0x73f0('0x12')],_0x300568,_0x1fd9f1||_0x73f0('0x15'));if(_0x1fd9f1){var _0x11fee9=_['findIndex'](_0x3a4e0e[_0x73f0('0x16')](),{'p':_0x1fd9f1});if(_0x11fee9>=0x0){logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x34d21d,_0x1fd9f1||'next',_0x11fee9);_0x3a4e0e[_0x73f0('0x15')](_0x11fee9);}else{logger[_0x73f0('0x17')](_0x73f0('0x18'),_0x34d21d,_0x1fd9f1||_0x73f0('0x15'));_0x3a4e0e[_0x73f0('0x11')]();}}else{_0x3a4e0e[_0x73f0('0x15')]();}}catch(_0xeaf1fa){logger[_0x73f0('0x19')](_0x73f0('0x1a'),_0x34d21d,_0xeaf1fa[_0x73f0('0x1b')]);_0x3a4e0e[_0x73f0('0x11')]();}}}catch(_0x3ada6d){logger['error'](_0x73f0('0xe'),_0x34d21d,JSON[_0x73f0('0x1c')](_0x3ada6d));_0x3a4e0e['stop']();}};}; \ No newline at end of file +var _0x19ab=['join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','next','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','lodash','html-to-text','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','fromString','replace','length','error','[%s][GOTOIF]\x20%s','map'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x19ab,0x12b));var _0xb19a=function(_0x47d44c,_0x31da6b){_0x47d44c=_0x47d44c-0x0;var _0x333a30=_0x19ab[_0x47d44c];return _0x333a30;};'use strict';var schema=require(_0xb19a('0x0'));var _=require(_0xb19a('0x1'));var htmlToText=require(_0xb19a('0x2'));var utils=require('./utils');var logger=require(_0xb19a('0x3'))(_0xb19a('0x4'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0xb19a('0x5')},'priorityTrue':{'type':'number','message':_0xb19a('0x6')},'priorityFalse':{'type':'number','message':'priority\x20false\x20is\x20a\x20number'}});exports['consequence']=function(_0x2f389c,_0x280ad1){return function(_0x39b28e){try{var _0x34f8d0={'condition':htmlToText[_0xb19a('0x7')](utils['getMustacheRender'](_0x280ad1[0x0],this),{'wordwrap':![]})[_0xb19a('0x8')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x280ad1[0x1],'priorityFalse':_0x280ad1[0x2]};var _0x28b5c2=gotoif['validate'](_0x34f8d0,{'typecast':!![]});if(_0x28b5c2[_0xb19a('0x9')]){logger[_0xb19a('0xa')](_0xb19a('0xb'),_0x2f389c,_[_0xb19a('0xc')](_0x28b5c2,'message')[_0xb19a('0xd')](',\x20'));_0x39b28e[_0xb19a('0xe')]();}else{try{var _0x28ef15=eval('('+_0x34f8d0[_0xb19a('0xf')]+')');var _0x575255=_0x28ef15?_0x34f8d0[_0xb19a('0x10')]:_0x34f8d0[_0xb19a('0x11')];logger[_0xb19a('0x12')](_0xb19a('0x13'),_0x2f389c,_0x34f8d0['condition'],_0x28ef15,_0x575255||'next');if(_0x575255){var _0x143492=_[_0xb19a('0x14')](_0x39b28e[_0xb19a('0x15')](),{'p':_0x575255});if(_0x143492>=0x0){logger[_0xb19a('0x12')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x2f389c,_0x575255||_0xb19a('0x16'),_0x143492);_0x39b28e[_0xb19a('0x16')](_0x143492);}else{logger[_0xb19a('0x12')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x2f389c,_0x575255||'next');_0x39b28e['stop']();}}else{_0x39b28e['next']();}}catch(_0x4291f5){logger[_0xb19a('0xa')](_0xb19a('0x17'),_0x2f389c,_0x4291f5[_0xb19a('0x18')]);_0x39b28e[_0xb19a('0xe')]();}}}catch(_0x5f1927){logger[_0xb19a('0xa')](_0xb19a('0xb'),_0x2f389c,JSON[_0xb19a('0x19')](_0x5f1927));_0x39b28e['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index fc186eb..1d55b89 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 _0x68d7=['rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','number','consequence','length','error','[%s][GOTOP]\x20%s','map','message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex'];(function(_0x4ed7a4,_0x5f466b){var _0x59b81c=function(_0x4ba3fa){while(--_0x4ba3fa){_0x4ed7a4['push'](_0x4ed7a4['shift']());}};_0x59b81c(++_0x5f466b);}(_0x68d7,0x1d0));var _0x768d=function(_0x493802,_0x29657e){_0x493802=_0x493802-0x0;var _0x47dfc2=_0x68d7[_0x493802];return _0x47dfc2;};'use strict';var schema=require(_0x768d('0x0'));var _=require(_0x768d('0x1'));var logger=require(_0x768d('0x2'))(_0x768d('0x3'));var gotop=schema({'priority':{'type':_0x768d('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x768d('0x5')]=function(_0xf0ebca,_0x134523){return function(_0x3de569){try{var _0x1d23cd={'priority':_0x134523[0x0]};var _0x54e6fa=gotop[_0x768d('0x0')](_0x1d23cd,{'typecast':!![]});if(_0x54e6fa[_0x768d('0x6')]){logger[_0x768d('0x7')](_0x768d('0x8'),_0xf0ebca,_[_0x768d('0x9')](_0x54e6fa,_0x768d('0xa'))['join'](',\x20'));_0x3de569[_0x768d('0xb')]();}else{logger[_0x768d('0xc')](_0x768d('0xd'),_0xf0ebca,_0x1d23cd[_0x768d('0xe')]);if(_0x1d23cd[_0x768d('0xe')]){var _0xf11c07=_[_0x768d('0xf')](_0x3de569[_0x768d('0x10')](),{'p':_0x1d23cd[_0x768d('0xe')]});if(_0xf11c07>=0x0){logger[_0x768d('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0xf0ebca,_0x1d23cd[_0x768d('0xe')]||_0x768d('0x11'),_0xf11c07);_0x3de569[_0x768d('0x11')](_0xf11c07);}else{logger[_0x768d('0xc')](_0x768d('0x12'),_0xf0ebca,_0x1d23cd['priority']||_0x768d('0x11'));_0x3de569[_0x768d('0xb')]();}}else{_0x3de569[_0x768d('0x11')]();}}}catch(_0x4ecd46){logger['error'](_0x768d('0x8'),_0xf0ebca,JSON[_0x768d('0x13')](_0x4ecd46));_0x3de569['stop']();}};}; \ No newline at end of file +var _0xd99b=['map','message','join','stop','info','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xd99b,0xa3));var _0xbd99=function(_0x138fce,_0x304267){_0x138fce=_0x138fce-0x0;var _0x593cb0=_0xd99b[_0x138fce];return _0x593cb0;};'use strict';var schema=require(_0xbd99('0x0'));var _=require('lodash');var logger=require(_0xbd99('0x1'))(_0xbd99('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xbd99('0x3')}});exports[_0xbd99('0x4')]=function(_0x6c1af,_0x15a979){return function(_0x249da1){try{var _0x5dbb92={'priority':_0x15a979[0x0]};var _0xad5198=gotop[_0xbd99('0x0')](_0x5dbb92,{'typecast':!![]});if(_0xad5198[_0xbd99('0x5')]){logger[_0xbd99('0x6')](_0xbd99('0x7'),_0x6c1af,_[_0xbd99('0x8')](_0xad5198,_0xbd99('0x9'))[_0xbd99('0xa')](',\x20'));_0x249da1[_0xbd99('0xb')]();}else{logger[_0xbd99('0xc')]('[%s][GOTOP]\x20priority\x20%s',_0x6c1af,_0x5dbb92['priority']);if(_0x5dbb92[_0xbd99('0xd')]){var _0x1cdbf8=_['findIndex'](_0x249da1[_0xbd99('0xe')](),{'p':_0x5dbb92[_0xbd99('0xd')]});if(_0x1cdbf8>=0x0){logger['info'](_0xbd99('0xf'),_0x6c1af,_0x5dbb92[_0xbd99('0xd')]||_0xbd99('0x10'),_0x1cdbf8);_0x249da1[_0xbd99('0x10')](_0x1cdbf8);}else{logger[_0xbd99('0xc')](_0xbd99('0x11'),_0x6c1af,_0x5dbb92['priority']||_0xbd99('0x10'));_0x249da1[_0xbd99('0xb')]();}}else{_0x249da1['next']();}}}catch(_0x5079db){logger[_0xbd99('0x6')](_0xbd99('0x7'),_0x6c1af,JSON[_0xbd99('0x12')](_0x5079db));_0x249da1['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 1c8a1ab..d6cc257 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 _0x93e6=['lodash','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','create','info','[%s][MESSAGE]\x20%s','body','next','catch','stringify','stop','error'];(function(_0xfbe06e,_0x2fb7ab){var _0x24e5b6=function(_0x48569f){while(--_0x48569f){_0xfbe06e['push'](_0xfbe06e['shift']());}};_0x24e5b6(++_0x2fb7ab);}(_0x93e6,0x11e));var _0x693e=function(_0x30e228,_0x1dd9ba){_0x30e228=_0x30e228-0x0;var _0x27d19a=_0x93e6[_0x30e228];return _0x27d19a;};'use strict';var _=require(_0x693e('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x693e('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x693e('0x2')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x693e('0x3')),'faxMessage':require(_0x693e('0x4')),'whatsappMessage':require(_0x693e('0x5'))};exports['consequence']=function(_0x1d2b99,_0x388eb6){return function(_0x2569a4){try{var _0x520113={'body':utils['getMustacheRender'](_0x388eb6[0x0],this),'ContactId':this['contact']['id']};if(this[_0x693e('0x6')]==='chat'){_0x520113[_0x693e('0x7')]=this[_0x693e('0x8')]['id'];}else{_0x520113[_[_0x693e('0x9')](this['channel'])+_0x693e('0xa')]=this['account']['id'];}_0x520113[_[_0x693e('0x9')](this['channel'])+_0x693e('0xb')]=this['interaction']['id'];if(rpc[this['channel']+_0x693e('0xc')]){return rpc[this[_0x693e('0x6')]+_0x693e('0xc')][_0x693e('0xd')](_0x520113)['then'](function(_0x256143){logger[_0x693e('0xe')](_0x693e('0xf'),_0x1d2b99,_0x520113[_0x693e('0x10')]);_0x2569a4[_0x693e('0x11')]();})[_0x693e('0x12')](function(_0x3e44ba){logger['error'](_0x693e('0xf'),_0x1d2b99,JSON[_0x693e('0x13')](_0x3e44ba));_0x2569a4[_0x693e('0x14')]();});}}catch(_0x54d946){logger[_0x693e('0x15')](_0x693e('0xf'),_0x1d2b99,JSON[_0x693e('0x13')](_0x54d946));_0x2569a4[_0x693e('0x14')]();}};}; \ No newline at end of file +var _0x2182=['Message','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat','ChatWebsiteId','account','upperFirst','AccountId','channel','interaction'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2182,0xea));var _0x2218=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2182[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x2218('0x0'));var utils=require(_0x2218('0x1'));var logger=require(_0x2218('0x2'))(_0x2218('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x2218('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x2218('0x5')),'faxMessage':require(_0x2218('0x6')),'whatsappMessage':require(_0x2218('0x7'))};exports[_0x2218('0x8')]=function(_0xf3271d,_0x1e2df1){return function(_0x199cb3){try{var _0x22eab9={'body':utils[_0x2218('0x9')](_0x1e2df1[0x0],this),'ContactId':this[_0x2218('0xa')]['id']};if(this['channel']===_0x2218('0xb')){_0x22eab9[_0x2218('0xc')]=this[_0x2218('0xd')]['id'];}else{_0x22eab9[_[_0x2218('0xe')](this['channel'])+_0x2218('0xf')]=this[_0x2218('0xd')]['id'];}_0x22eab9[_[_0x2218('0xe')](this[_0x2218('0x10')])+'InteractionId']=this[_0x2218('0x11')]['id'];if(rpc[this[_0x2218('0x10')]+_0x2218('0x12')]){return rpc[this[_0x2218('0x10')]+_0x2218('0x12')]['create'](_0x22eab9)[_0x2218('0x13')](function(_0x5d7d24){logger[_0x2218('0x14')](_0x2218('0x15'),_0xf3271d,_0x22eab9[_0x2218('0x16')]);_0x199cb3[_0x2218('0x17')]();})[_0x2218('0x18')](function(_0x27fde4){logger[_0x2218('0x19')](_0x2218('0x15'),_0xf3271d,JSON[_0x2218('0x1a')](_0x27fde4));_0x199cb3[_0x2218('0x1b')]();});}}catch(_0x466d80){logger[_0x2218('0x19')](_0x2218('0x15'),_0xf3271d,JSON[_0x2218('0x1a')](_0x466d80));_0x199cb3[_0x2218('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 fe134e1..7a70fc9 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 _0x7ba1=['getMustacheRender','next','error','[%s][NOOP]\x20%s','stringify','stop','./utils','routing','consequence','info'];(function(_0xc2b459,_0x52da01){var _0x42da7a=function(_0x2e6e33){while(--_0x2e6e33){_0xc2b459['push'](_0xc2b459['shift']());}};_0x42da7a(++_0x52da01);}(_0x7ba1,0xc4));var _0x17ba=function(_0x20bad0,_0x3fe18d){_0x20bad0=_0x20bad0-0x0;var _0x32da47=_0x7ba1[_0x20bad0];return _0x32da47;};'use strict';var utils=require(_0x17ba('0x0'));var logger=require('../../../../config/logger')(_0x17ba('0x1'));exports[_0x17ba('0x2')]=function(_0x378fbf,_0x354ec3){return function(_0x2f2cca){try{logger[_0x17ba('0x3')]('[%s][NOOP]\x20%s',_0x378fbf,utils[_0x17ba('0x4')](_0x354ec3[0x0],this));_0x2f2cca[_0x17ba('0x5')]();}catch(_0x1bb920){logger[_0x17ba('0x6')](_0x17ba('0x7'),_0x378fbf,JSON[_0x17ba('0x8')](_0x1bb920));_0x2f2cca[_0x17ba('0x9')]();}};}; \ No newline at end of file +var _0xc3de=['routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','stringify','stop','./utils','../../../../config/logger'];(function(_0x26da08,_0x30429f){var _0x73eb9d=function(_0x3149dd){while(--_0x3149dd){_0x26da08['push'](_0x26da08['shift']());}};_0x73eb9d(++_0x30429f);}(_0xc3de,0x130));var _0xec3d=function(_0x56c075,_0x33dfe9){_0x56c075=_0x56c075-0x0;var _0x304258=_0xc3de[_0x56c075];return _0x304258;};'use strict';var utils=require(_0xec3d('0x0'));var logger=require(_0xec3d('0x1'))(_0xec3d('0x2'));exports[_0xec3d('0x3')]=function(_0xe552e0,_0x36f0c9){return function(_0x35c7f5){try{logger[_0xec3d('0x4')](_0xec3d('0x5'),_0xe552e0,utils[_0xec3d('0x6')](_0x36f0c9[0x0],this));_0x35c7f5['next']();}catch(_0xf01107){logger['error'](_0xec3d('0x5'),_0xe552e0,JSON[_0xec3d('0x7')](_0xf01107));_0x35c7f5[_0xec3d('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 3e741aa..f90a095 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 _0x5991=['upperFirst','channel','QueueId','MessageId','message','AccountId','WebsiteId','info','name','create','catch','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','QueueReport','error','update\x20queue\x20report','update','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','next','strategy','rrmemory','beepall','log','stack','validate','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','./strategy','redis','defaults','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','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list'];(function(_0x1d6da1,_0x4ad243){var _0x561a1b=function(_0x1a5ea1){while(--_0x1a5ea1){_0x1d6da1['push'](_0x1d6da1['shift']());}};_0x561a1b(++_0x4ad243);}(_0x5991,0x162));var _0x1599=function(_0x5a369d,_0x140b74){_0x5a369d=_0x5a369d-0x0;var _0x22cfba=_0x5991[_0x5a369d];return _0x22cfba;};'use strict';var schema=require(_0x1599('0x0'));var _=require(_0x1599('0x1'));var util=require(_0x1599('0x2'));var seqqueue=require(_0x1599('0x3'));var moment=require('moment');var Redis=require(_0x1599('0x4'));var config=require(_0x1599('0x5'));var logger=require(_0x1599('0x6'))('routing');var strategy=require(_0x1599('0x7'));config[_0x1599('0x8')]=_[_0x1599('0x9')](config[_0x1599('0x8')],{'host':_0x1599('0xa'),'port':0x18eb});var io=require(_0x1599('0xb'))(new Redis(config[_0x1599('0x8')]));var attributes=['id','queue_id',_0x1599('0xc'),_0x1599('0xd'),_0x1599('0xe'),_0x1599('0xf')];function emit(_0x1fd4ac,_0x8ba360,_0x337295){io['to'](_0x1fd4ac)[_0x1599('0x10')](_0x8ba360,_0x337295);}function emitChannelQueueInteraction(_0x2c995f,_0x213a0c,_0x53c350,_0xfdcdf5,_0x50f199,_0xd0c0a8,_0xa771af,_0x4435ec){var _0x242648=_[_0x1599('0x11')](_0x53c350);_0x242648[_0x1599('0x12')]=_0x4435ec;_0x242648[_0x1599('0xd')]=_0x213a0c;_0x242648[_0x1599('0xc')]=_0xfdcdf5;_0x242648['id']=_0x50f199;if(_0xd0c0a8){attributes[_0x1599('0x13')](_[_0x1599('0x14')](_0x2c995f)+_0x1599('0x15'));_0xa771af[util[_0x1599('0x16')](_0x1599('0x17'),_0x2c995f)][_0x50f199]=_[_0x1599('0x18')](_0x242648,attributes);}else{delete _0xa771af[util['format'](_0x1599('0x17'),_0x2c995f)][_0x50f199];}emit(util[_0x1599('0x16')](_0x1599('0x19'),_0x2c995f,_0x213a0c),util['format'](_0x1599('0x1a'),_0x2c995f,_0xd0c0a8?_0x1599('0x1b'):'remove'),_[_0x1599('0x18')](_0x242648,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x1599('0x1c')),'chatQueueReport':require(_0x1599('0x1d')),'smsQueueReport':require(_0x1599('0x1e')),'faxQueueReport':require(_0x1599('0x1f')),'whatsappQueueReport':require(_0x1599('0x20'))};var queue=schema({'name':{'type':_0x1599('0x21'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x1599('0x22'),'message':_0x1599('0x23')}});function startRouting(_0x56fc85,_0x26a8eb,_0x527885,_0x3b170c){if(_0x56fc85&&_0x26a8eb&&_0x527885){_0x26a8eb[_0x1599('0x24')]+=0x1;var _0x14c0eb={'uniqueid':_0x56fc85,'from':_0x527885['body']?_0x527885[_0x1599('0x25')]['from']:'','joinAt':moment()['format'](_0x1599('0x26')),'ContactId':_0x527885[_0x1599('0x27')]?_0x527885['contact']['id']:null,'ListId':_0x527885[_0x1599('0x28')]?_0x527885[_0x1599('0x28')]['id']:null};_0x14c0eb[_[_0x1599('0x29')](_0x527885[_0x1599('0x2a')])+_0x1599('0x2b')]=_0x26a8eb['id']||null;_0x14c0eb[_['upperFirst'](_0x527885[_0x1599('0x2a')])+_0x1599('0x15')]=_0x527885['interaction']?_0x527885['interaction']['id']:null;_0x14c0eb[_['upperFirst'](_0x527885[_0x1599('0x2a')])+_0x1599('0x2c')]=_0x527885[_0x1599('0x2d')]?_0x527885[_0x1599('0x2d')]['id']:null;_0x14c0eb[_[_0x1599('0x29')](_0x527885[_0x1599('0x2a')])+(_0x527885[_0x1599('0x2a')]!=='chat'?_0x1599('0x2e'):_0x1599('0x2f'))]=_0x527885[_0x1599('0xc')]?_0x527885[_0x1599('0xc')]['id']:null;logger[_0x1599('0x30')](util['format']('[%s][START:QUEUE][NAME:%s]',_0x56fc85,_0x26a8eb[_0x1599('0x31')]));emitChannelQueueInteraction(_0x527885['channel'],_0x26a8eb[_0x1599('0x31')],_0x14c0eb,_0x527885[_0x1599('0xc')][_0x1599('0x31')],_0x527885[_0x1599('0x2d')]['id'],!![],_0x3b170c,_0x26a8eb['id']);if(rpc[_0x527885[_0x1599('0x2a')]+'QueueReport']){return rpc[_0x527885[_0x1599('0x2a')]+'QueueReport'][_0x1599('0x32')](_0x14c0eb)[_0x1599('0x33')](function(_0x10feef){logger['error'](_0x1599('0x34'));});}}}function stopRouting(_0x32c63f,_0x533268,_0x2bf0d2,_0x4cc151){if(_0x32c63f&&_0x533268){_0x533268[_0x1599('0x24')]-=0x1;var _0x31deca={'leaveAt':moment()[_0x1599('0x16')](_0x1599('0x26')),'acceptAt':moment()[_0x1599('0x16')](_0x1599('0x26')),'reason':_0x1599('0x35')};logger[_0x1599('0x30')](util[_0x1599('0x16')](_0x1599('0x36'),_0x32c63f,_0x533268['name']));emitChannelQueueInteraction(_0x2bf0d2['channel'],_0x533268[_0x1599('0x31')],_0x2bf0d2[_0x1599('0x25')],_0x2bf0d2[_0x1599('0xc')][_0x1599('0x31')],_0x2bf0d2[_0x1599('0x2d')]['id'],![],_0x4cc151,_0x533268['id']);if(rpc[_0x2bf0d2[_0x1599('0x2a')]+_0x1599('0x37')]){return rpc[_0x2bf0d2[_0x1599('0x2a')]+_0x1599('0x37')]['update'](_0x32c63f,_0x31deca)[_0x1599('0x33')](function(_0xfae2f3){logger[_0x1599('0x38')](_0x1599('0x39'));});}}}function endRouting(_0x11bdab,_0x32ec53,_0x4239f1,_0x5041c5){if(_0x11bdab&&_0x32ec53){_0x32ec53[_0x1599('0x24')]-=0x1;var _0x446a29={'leaveAt':moment()[_0x1599('0x16')](_0x1599('0x26')),'exitAt':moment()[_0x1599('0x16')](_0x1599('0x26')),'reason':'timeout'};logger[_0x1599('0x30')](util[_0x1599('0x16')]('[%s][END:QUEUE][NAME:%s]',_0x11bdab,_0x32ec53[_0x1599('0x31')]));emitChannelQueueInteraction(_0x4239f1[_0x1599('0x2a')],_0x32ec53[_0x1599('0x31')],_0x4239f1[_0x1599('0x25')],_0x4239f1[_0x1599('0xc')]['name'],_0x4239f1[_0x1599('0x2d')]['id'],![],_0x5041c5);if(rpc[_0x4239f1['channel']+_0x1599('0x37')]){return rpc[_0x4239f1[_0x1599('0x2a')]+_0x1599('0x37')][_0x1599('0x3a')](_0x11bdab,_0x446a29)['catch'](function(_0x44208b){logger['error'](_0x1599('0x39'));});}}}function handleFindQueue(_0x33bc91){return function(_0x52b0c9){return _0x52b0c9[_0x1599('0x31')][_0x1599('0x3b')]()===_0x33bc91[_0x1599('0x3b')]();};}exports['consequence']=function(_0x2845cf,_0x51dba4,_0x2420fc,_0x4106b4){return function(_0x286c05){try{var _0x4d2cc3={'name':_0x51dba4[0x0],'timeout':_0x51dba4[0x1]};var _0x4fc7fd=queue[_0x1599('0x0')](_0x4d2cc3,{'typecast':!![]});if(_0x4fc7fd[_0x1599('0x3c')]){logger[_0x1599('0x38')](_0x1599('0x3d'),_0x2845cf,_[_0x1599('0x3e')](_0x4fc7fd,_0x1599('0x2d'))[_0x1599('0x3f')](',\x20'));_0x286c05[_0x1599('0x40')]();}else{var _0x380f50=_[_0x1599('0x41')](_0x2420fc[_0x4106b4[_0x1599('0x2a')]+_0x1599('0x42')],handleFindQueue(_0x4d2cc3['name']));if(_0x380f50){startRouting(_0x2845cf,_0x380f50,_0x4106b4,_0x2420fc);var _0x170436=(_0x380f50['timeout']||0xa)*0x3e8;var _0x2b2894=(_0x4d2cc3['timeout']||0x14)*0x3e8;var _0xa518b2;if(_0x170436>_0x2b2894){_0x2b2894=_0x170436;}var _0x4019b5=seqqueue[_0x1599('0x43')](_0x170436);_0x4019b5['id']=_0x2845cf;_0x4019b5['atimeout']=_0x170436;_0x4019b5[_0x1599('0x44')]=_0x2b2894;_0x4019b5[_0x1599('0x2a')]=_0x4106b4['channel'];_0x2420fc[_0x1599('0x45')][_0x2845cf]['on'](_0x1599('0x46'),function(){logger[_0x1599('0x30')](_0x1599('0x47'),_0x2845cf);stopRouting(_0x2845cf,_0x380f50,_0x4106b4,_0x2420fc);clearTimeout(_0xa518b2);_0xa518b2=undefined;_0x4019b5['close'](!![]);if(_0x2420fc[_0x1599('0x45')][_0x2845cf]){delete _0x2420fc[_0x1599('0x45')][_0x2845cf];}_0x286c05[_0x1599('0x40')]();});_0x2420fc['rules'][_0x2845cf]['on']('complete',function(){if(_0x2420fc['rules'][_0x2845cf]){delete _0x2420fc[_0x1599('0x45')][_0x2845cf];}});_0xa518b2=setTimeout(function(){logger[_0x1599('0x30')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x2845cf);endRouting(_0x2845cf,_0x380f50,_0x4106b4,_0x2420fc);clearTimeout(_0xa518b2);_0x4019b5[_0x1599('0x48')](!![]);_0x286c05[_0x1599('0x49')]();},_0x2b2894);switch(_0x380f50[_0x1599('0x4a')]){case'rrmemory':strategy[_0x1599('0x4b')](_0x4019b5,_0x380f50,_0x2420fc,_0x4106b4);break;default:strategy[_0x1599('0x4c')](_0x4019b5,_0x380f50,_0x2420fc,_0x4106b4);}}else{logger[_0x1599('0x38')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x2845cf,_0x4d2cc3['name']);_0x286c05[_0x1599('0x40')]();}}}catch(_0x572a82){console[_0x1599('0x4d')](_0x572a82);logger[_0x1599('0x38')](_0x1599('0x3d'),_0x2845cf,_0x572a82[_0x1599('0x4e')]);_0x286c05[_0x1599('0x40')]();}};}; \ No newline at end of file +var _0x720d=['create','error','create\x20queue\x20report','accepted','update','catch','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','map','join','stop','find','Queues','timeout','createQueue','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','next','strategy','rrmemory','beepall','log','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/logger','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','clone','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','%s:queue:%s','save','remove','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x720d,0x1b1));var _0xd720=function(_0x8bfc33,_0x25509f){_0x8bfc33=_0x8bfc33-0x0;var _0x52862a=_0x720d[_0x8bfc33];return _0x52862a;};'use strict';var schema=require(_0xd720('0x0'));var _=require(_0xd720('0x1'));var util=require(_0xd720('0x2'));var seqqueue=require(_0xd720('0x3'));var moment=require(_0xd720('0x4'));var Redis=require(_0xd720('0x5'));var config=require('../../../../config/environment');var logger=require(_0xd720('0x6'))(_0xd720('0x7'));var strategy=require(_0xd720('0x8'));config[_0xd720('0x9')]=_['defaults'](config['redis'],{'host':_0xd720('0xa'),'port':0x18eb});var io=require(_0xd720('0xb'))(new Redis(config[_0xd720('0x9')]));var attributes=['id',_0xd720('0xc'),_0xd720('0xd'),_0xd720('0xe'),_0xd720('0xf'),_0xd720('0x10')];function emit(_0x2d3f5b,_0x5071fd,_0x44f44a){io['to'](_0x2d3f5b)['emit'](_0x5071fd,_0x44f44a);}function emitChannelQueueInteraction(_0x2e0dd4,_0x35635f,_0xf0bf3,_0x5b5302,_0x2ae3a1,_0x43c830,_0x3828b2,_0x7f781b){var _0x51e17b=_[_0xd720('0x11')](_0xf0bf3);_0x51e17b[_0xd720('0xc')]=_0x7f781b;_0x51e17b[_0xd720('0xe')]=_0x35635f;_0x51e17b[_0xd720('0xd')]=_0x5b5302;_0x51e17b['id']=_0x2ae3a1;if(_0x43c830){attributes[_0xd720('0x12')](_[_0xd720('0x13')](_0x2e0dd4)+_0xd720('0x14'));_0x3828b2[util[_0xd720('0x15')](_0xd720('0x16'),_0x2e0dd4)][_0x2ae3a1]=_['pick'](_0x51e17b,attributes);}else{delete _0x3828b2[util[_0xd720('0x15')](_0xd720('0x16'),_0x2e0dd4)][_0x2ae3a1];}emit(util['format'](_0xd720('0x17'),_0x2e0dd4,_0x35635f),util[_0xd720('0x15')]('%s_queue_waiting_interaction:%s',_0x2e0dd4,_0x43c830?_0xd720('0x18'):_0xd720('0x19')),_[_0xd720('0x1a')](_0x51e17b,attributes));}var rpc={'openchannelQueueReport':require(_0xd720('0x1b')),'mailQueueReport':require(_0xd720('0x1c')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xd720('0x1d')),'faxQueueReport':require(_0xd720('0x1e')),'whatsappQueueReport':require(_0xd720('0x1f'))};var queue=schema({'name':{'type':_0xd720('0x20'),'required':!![],'message':_0xd720('0x21')},'timeout':{'type':_0xd720('0x22'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x288363,_0x5a9e7e,_0x2ee749,_0x728f85){if(_0x288363&&_0x5a9e7e&&_0x2ee749){_0x5a9e7e[_0xd720('0x23')]+=0x1;var _0x50464c={'uniqueid':_0x288363,'from':_0x2ee749['body']?_0x2ee749[_0xd720('0x24')][_0xd720('0xf')]:'','joinAt':moment()[_0xd720('0x15')](_0xd720('0x25')),'ContactId':_0x2ee749[_0xd720('0x26')]?_0x2ee749[_0xd720('0x26')]['id']:null,'ListId':_0x2ee749['list']?_0x2ee749[_0xd720('0x27')]['id']:null};_0x50464c[_[_0xd720('0x28')](_0x2ee749[_0xd720('0x29')])+_0xd720('0x2a')]=_0x5a9e7e['id']||null;_0x50464c[_[_0xd720('0x28')](_0x2ee749[_0xd720('0x29')])+_0xd720('0x14')]=_0x2ee749[_0xd720('0x2b')]?_0x2ee749[_0xd720('0x2b')]['id']:null;_0x50464c[_[_0xd720('0x28')](_0x2ee749[_0xd720('0x29')])+_0xd720('0x2c')]=_0x2ee749[_0xd720('0x2d')]?_0x2ee749[_0xd720('0x2d')]['id']:null;_0x50464c[_[_0xd720('0x28')](_0x2ee749[_0xd720('0x29')])+(_0x2ee749['channel']!==_0xd720('0x2e')?_0xd720('0x2f'):_0xd720('0x30'))]=_0x2ee749[_0xd720('0xd')]?_0x2ee749['account']['id']:null;logger[_0xd720('0x31')](util[_0xd720('0x15')](_0xd720('0x32'),_0x288363,_0x5a9e7e[_0xd720('0x33')]));emitChannelQueueInteraction(_0x2ee749[_0xd720('0x29')],_0x5a9e7e[_0xd720('0x33')],_0x50464c,_0x2ee749['account'][_0xd720('0x33')],_0x2ee749[_0xd720('0x2d')]['id'],!![],_0x728f85,_0x5a9e7e['id']);if(rpc[_0x2ee749[_0xd720('0x29')]+_0xd720('0x34')]){return rpc[_0x2ee749['channel']+_0xd720('0x34')][_0xd720('0x35')](_0x50464c)['catch'](function(_0x3e02e0){logger[_0xd720('0x36')](_0xd720('0x37'));});}}}function stopRouting(_0x4ac19b,_0xade0d9,_0x22fa81,_0x37d882){if(_0x4ac19b&&_0xade0d9){_0xade0d9[_0xd720('0x23')]-=0x1;var _0xcbdfea={'leaveAt':moment()['format'](_0xd720('0x25')),'acceptAt':moment()[_0xd720('0x15')](_0xd720('0x25')),'reason':_0xd720('0x38')};logger[_0xd720('0x31')](util[_0xd720('0x15')]('[%s][STOP:QUEUE][NAME:%s]',_0x4ac19b,_0xade0d9['name']));emitChannelQueueInteraction(_0x22fa81['channel'],_0xade0d9[_0xd720('0x33')],_0x22fa81[_0xd720('0x24')],_0x22fa81[_0xd720('0xd')]['name'],_0x22fa81[_0xd720('0x2d')]['id'],![],_0x37d882,_0xade0d9['id']);if(rpc[_0x22fa81[_0xd720('0x29')]+_0xd720('0x34')]){return rpc[_0x22fa81[_0xd720('0x29')]+_0xd720('0x34')][_0xd720('0x39')](_0x4ac19b,_0xcbdfea)[_0xd720('0x3a')](function(_0x2c5b5e){logger[_0xd720('0x36')](_0xd720('0x3b'));});}}}function endRouting(_0x7bc77d,_0x501bee,_0x254763,_0x5d8b80){if(_0x7bc77d&&_0x501bee){_0x501bee['waiting']-=0x1;var _0x2187f1={'leaveAt':moment()[_0xd720('0x15')](_0xd720('0x25')),'exitAt':moment()[_0xd720('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger[_0xd720('0x31')](util[_0xd720('0x15')](_0xd720('0x3c'),_0x7bc77d,_0x501bee[_0xd720('0x33')]));emitChannelQueueInteraction(_0x254763[_0xd720('0x29')],_0x501bee['name'],_0x254763[_0xd720('0x24')],_0x254763[_0xd720('0xd')]['name'],_0x254763[_0xd720('0x2d')]['id'],![],_0x5d8b80);if(rpc[_0x254763['channel']+_0xd720('0x34')]){return rpc[_0x254763['channel']+'QueueReport'][_0xd720('0x39')](_0x7bc77d,_0x2187f1)['catch'](function(_0x5ab34d){logger[_0xd720('0x36')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x294a8e){return function(_0x73dc2e){return _0x73dc2e['name'][_0xd720('0x3d')]()===_0x294a8e[_0xd720('0x3d')]();};}exports[_0xd720('0x3e')]=function(_0x3748b0,_0x24e7ed,_0x1f9df9,_0x9998b5){return function(_0x363d27){try{var _0x5f5b66={'name':_0x24e7ed[0x0],'timeout':_0x24e7ed[0x1]};var _0x4abecf=queue[_0xd720('0x0')](_0x5f5b66,{'typecast':!![]});if(_0x4abecf[_0xd720('0x3f')]){logger[_0xd720('0x36')]('[%s][QUEUE]\x20%s',_0x3748b0,_[_0xd720('0x40')](_0x4abecf,_0xd720('0x2d'))[_0xd720('0x41')](',\x20'));_0x363d27[_0xd720('0x42')]();}else{var _0xacdf32=_[_0xd720('0x43')](_0x1f9df9[_0x9998b5['channel']+_0xd720('0x44')],handleFindQueue(_0x5f5b66['name']));if(_0xacdf32){startRouting(_0x3748b0,_0xacdf32,_0x9998b5,_0x1f9df9);var _0x3107d3=(_0xacdf32[_0xd720('0x45')]||0xa)*0x3e8;var _0x4291a8=(_0x5f5b66[_0xd720('0x45')]||0x14)*0x3e8;var _0x3758ec;if(_0x3107d3>_0x4291a8){_0x4291a8=_0x3107d3;}var _0x31a403=seqqueue[_0xd720('0x46')](_0x3107d3);_0x31a403['id']=_0x3748b0;_0x31a403[_0xd720('0x47')]=_0x3107d3;_0x31a403['qtimeout']=_0x4291a8;_0x31a403['channel']=_0x9998b5[_0xd720('0x29')];_0x1f9df9[_0xd720('0x48')][_0x3748b0]['on'](_0xd720('0x49'),function(){logger['info'](_0xd720('0x4a'),_0x3748b0);stopRouting(_0x3748b0,_0xacdf32,_0x9998b5,_0x1f9df9);clearTimeout(_0x3758ec);_0x3758ec=undefined;_0x31a403['close'](!![]);if(_0x1f9df9[_0xd720('0x48')][_0x3748b0]){delete _0x1f9df9[_0xd720('0x48')][_0x3748b0];}_0x363d27[_0xd720('0x42')]();});_0x1f9df9[_0xd720('0x48')][_0x3748b0]['on'](_0xd720('0x4b'),function(){if(_0x1f9df9[_0xd720('0x48')][_0x3748b0]){delete _0x1f9df9[_0xd720('0x48')][_0x3748b0];}});_0x3758ec=setTimeout(function(){logger[_0xd720('0x31')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x3748b0);endRouting(_0x3748b0,_0xacdf32,_0x9998b5,_0x1f9df9);clearTimeout(_0x3758ec);_0x31a403['close'](!![]);_0x363d27[_0xd720('0x4c')]();},_0x4291a8);switch(_0xacdf32[_0xd720('0x4d')]){case _0xd720('0x4e'):strategy[_0xd720('0x4e')](_0x31a403,_0xacdf32,_0x1f9df9,_0x9998b5);break;default:strategy[_0xd720('0x4f')](_0x31a403,_0xacdf32,_0x1f9df9,_0x9998b5);}}else{logger[_0xd720('0x36')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x3748b0,_0x5f5b66['name']);_0x363d27['stop']();}}}catch(_0x3d1cfe){console[_0xd720('0x50')](_0x3d1cfe);logger[_0xd720('0x36')]('[%s][QUEUE]\x20%s',_0x3748b0,_0x3d1cfe['stack']);_0x363d27[_0xd720('0x42')]();}};}; \ 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 1e130fc..5676e11 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 _0x3937=['prototype','handleDrained','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','channel','busy','showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','notificationId','squeue','agent','realtime','routing','push','handleRun','bind','timeout','handleTimeout'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x3937,0xbf));var _0x7393=function(_0x3d1716,_0x3091cc){_0x3d1716=_0x3d1716-0x0;var _0x30cfdd=_0x3937[_0x3d1716];return _0x30cfdd;};'use strict';var _=require(_0x7393('0x0'));var uuid=require('uuid');var util=require(_0x7393('0x1'));var logger=require(_0x7393('0x2'))('routing');var Agent=function(_0x45cd02,_0x503841,_0x224468,_0x4c9c71){this[_0x7393('0x3')]=uuid['v4']();this[_0x7393('0x4')]=_0x45cd02;this[_0x7393('0x5')]=_0x503841;this[_0x7393('0x6')]=_0x224468;this[_0x7393('0x7')]=_0x4c9c71;this[_0x7393('0x4')][_0x7393('0x8')](this[_0x7393('0x9')][_0x7393('0xa')](this),this['handleTimeout']['bind'](this));this[_0x7393('0x4')]['on'](_0x7393('0xb'),this[_0x7393('0xc')]['bind'](this));this[_0x7393('0x4')]['on']('drained',this['handleDrained']['bind'](this));};Agent['prototype'][_0x7393('0x8')]=function(){this[_0x7393('0x4')][_0x7393('0x8')](this['handleRun'][_0x7393('0xa')](this),this[_0x7393('0xc')][_0x7393('0xa')](this));};Agent[_0x7393('0xd')][_0x7393('0xe')]=function(){this[_0x7393('0xc')](!![]);};Agent[_0x7393('0xd')][_0x7393('0x9')]=function(){logger[_0x7393('0xf')]('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this[_0x7393('0x5')]['id']);if(_['isNil'](this['realtime']['agents'][this[_0x7393('0x5')]['id']])){logger['debug'](_0x7393('0x10'),this[_0x7393('0x4')]['id'],this['agent']['id']);setTimeout(this[_0x7393('0x8')]['bind'](this),0x3e8);}else{if(this['routing'][_0x7393('0x11')]||util[_0x7393('0x12')](this[_0x7393('0x4')]['id'],this[_0x7393('0x6')][_0x7393('0x13')][this[_0x7393('0x5')]['id']],this[_0x7393('0x4')][_0x7393('0x14')],![])){this['realtime']['agents'][this[_0x7393('0x5')]['id']][_0x7393('0x15')]=!![];this[_0x7393('0x6')][_0x7393('0x13')][this[_0x7393('0x5')]['id']]['busyQueue']=undefined;util['saveWaitingNotification'](this['realtime'],this[_0x7393('0x7')],this['agent'],this['squeue'][_0x7393('0x14')]);util[_0x7393('0x16')](this['notificationId'],this[_0x7393('0x4')]['id'],this[_0x7393('0x6')][_0x7393('0x13')][this[_0x7393('0x5')]['id']],null,this[_0x7393('0x7')]);util[_0x7393('0x17')](this[_0x7393('0x4')]['id'],this[_0x7393('0x6')][_0x7393('0x13')][this[_0x7393('0x5')]['id']],_0x7393('0x18')+(this[_0x7393('0x7')][_0x7393('0x11')]?':FORCED':''));}else{logger[_0x7393('0xf')](_0x7393('0x19'),this[_0x7393('0x4')]['id'],this[_0x7393('0x5')]['id']);setTimeout(this[_0x7393('0x8')][_0x7393('0xa')](this),0x3e8);}}};Agent['prototype'][_0x7393('0xc')]=function(_0x4befa4){if(_[_0x7393('0x1a')](this['realtime'][_0x7393('0x13')][this[_0x7393('0x5')]['id']])){return logger[_0x7393('0xf')](_0x7393('0x10'),this[_0x7393('0x4')]['id'],this[_0x7393('0x5')]['id']);}else{logger[_0x7393('0xf')](_0x7393('0x1b'),this[_0x7393('0x4')]['id'],this[_0x7393('0x5')]['id']);util[_0x7393('0x1c')](this[_0x7393('0x3')],this['squeue']['id'],this['realtime'][_0x7393('0x13')][this['agent']['id']],null,this[_0x7393('0x7')]);this['realtime'][_0x7393('0x13')][this['agent']['id']][_0x7393('0x15')]=![];this[_0x7393('0x6')][_0x7393('0x13')][this[_0x7393('0x5')]['id']][_0x7393('0x1d')]=undefined;util[_0x7393('0x1e')](this[_0x7393('0x6')],this[_0x7393('0x7')],this[_0x7393('0x5')],this[_0x7393('0x4')]['channel']);util[_0x7393('0x17')](this['squeue']['id'],this[_0x7393('0x6')]['agents'][this[_0x7393('0x5')]['id']],_0x4befa4?_0x7393('0x1f'):_0x7393('0x20'));}if(!_0x4befa4){setTimeout(this[_0x7393('0x8')][_0x7393('0xa')](this),0x3e8);}};function agent(_0x487a9b,_0x14ee6e,_0x596f49,_0x434333){return new Agent(_0x487a9b,_0x14ee6e,_0x596f49,_0x434333);}module[_0x7393('0x21')]=agent; \ No newline at end of file +var _0x7dfd=['notificationId','squeue','agent','realtime','push','handleRun','handleTimeout','bind','timeout','drained','prototype','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','forcedOwnership','isAgentAvailable','agents','channel','busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','removeWaitingNotification','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','routing'];(function(_0x46b90d,_0xd6e4c0){var _0xf7e8df=function(_0x4e6d83){while(--_0x4e6d83){_0x46b90d['push'](_0x46b90d['shift']());}};_0xf7e8df(++_0xd6e4c0);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7df('0x0'));var uuid=require(_0xd7df('0x1'));var util=require(_0xd7df('0x2'));var logger=require(_0xd7df('0x3'))(_0xd7df('0x4'));var Agent=function(_0x28c3c9,_0x176418,_0x38eee7,_0x3ef231){this[_0xd7df('0x5')]=uuid['v4']();this[_0xd7df('0x6')]=_0x28c3c9;this[_0xd7df('0x7')]=_0x176418;this[_0xd7df('0x8')]=_0x38eee7;this[_0xd7df('0x4')]=_0x3ef231;this[_0xd7df('0x6')][_0xd7df('0x9')](this[_0xd7df('0xa')]['bind'](this),this[_0xd7df('0xb')][_0xd7df('0xc')](this));this[_0xd7df('0x6')]['on'](_0xd7df('0xd'),this['handleTimeout'][_0xd7df('0xc')](this));this['squeue']['on'](_0xd7df('0xe'),this['handleDrained'][_0xd7df('0xc')](this));};Agent[_0xd7df('0xf')][_0xd7df('0x9')]=function(){this[_0xd7df('0x6')][_0xd7df('0x9')](this[_0xd7df('0xa')][_0xd7df('0xc')](this),this[_0xd7df('0xb')][_0xd7df('0xc')](this));};Agent[_0xd7df('0xf')][_0xd7df('0x10')]=function(){this[_0xd7df('0xb')](!![]);};Agent[_0xd7df('0xf')][_0xd7df('0xa')]=function(){logger[_0xd7df('0x11')](_0xd7df('0x12'),this[_0xd7df('0x6')]['id'],this['agent']['id']);if(_[_0xd7df('0x13')](this[_0xd7df('0x8')]['agents'][this[_0xd7df('0x7')]['id']])){logger[_0xd7df('0x11')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xd7df('0x6')]['id'],this[_0xd7df('0x7')]['id']);setTimeout(this[_0xd7df('0x9')]['bind'](this),0x3e8);}else{if(this[_0xd7df('0x4')][_0xd7df('0x14')]||util[_0xd7df('0x15')](this['squeue']['id'],this[_0xd7df('0x8')][_0xd7df('0x16')][this[_0xd7df('0x7')]['id']],this['squeue'][_0xd7df('0x17')],![])){this['realtime'][_0xd7df('0x16')][this['agent']['id']][_0xd7df('0x18')]=!![];this[_0xd7df('0x8')][_0xd7df('0x16')][this['agent']['id']][_0xd7df('0x19')]=undefined;util['saveWaitingNotification'](this[_0xd7df('0x8')],this[_0xd7df('0x4')],this[_0xd7df('0x7')],this[_0xd7df('0x6')][_0xd7df('0x17')]);util[_0xd7df('0x1a')](this[_0xd7df('0x5')],this['squeue']['id'],this['realtime'][_0xd7df('0x16')][this[_0xd7df('0x7')]['id']],null,this[_0xd7df('0x4')]);util[_0xd7df('0x1b')](this[_0xd7df('0x6')]['id'],this[_0xd7df('0x8')][_0xd7df('0x16')][this[_0xd7df('0x7')]['id']],_0xd7df('0x1c')+(this['routing'][_0xd7df('0x14')]?_0xd7df('0x1d'):''));}else{logger[_0xd7df('0x11')](_0xd7df('0x1e'),this[_0xd7df('0x6')]['id'],this[_0xd7df('0x7')]['id']);setTimeout(this[_0xd7df('0x9')][_0xd7df('0xc')](this),0x3e8);}}};Agent['prototype']['handleTimeout']=function(_0x52b56a){if(_['isNil'](this['realtime'][_0xd7df('0x16')][this['agent']['id']])){return logger[_0xd7df('0x11')](_0xd7df('0x1f'),this['squeue']['id'],this[_0xd7df('0x7')]['id']);}else{logger[_0xd7df('0x11')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xd7df('0x6')]['id'],this[_0xd7df('0x7')]['id']);util[_0xd7df('0x20')](this[_0xd7df('0x5')],this[_0xd7df('0x6')]['id'],this[_0xd7df('0x8')]['agents'][this[_0xd7df('0x7')]['id']],null,this[_0xd7df('0x4')]);this[_0xd7df('0x8')][_0xd7df('0x16')][this[_0xd7df('0x7')]['id']][_0xd7df('0x18')]=![];this[_0xd7df('0x8')][_0xd7df('0x16')][this[_0xd7df('0x7')]['id']][_0xd7df('0x19')]=undefined;util[_0xd7df('0x21')](this['realtime'],this['routing'],this[_0xd7df('0x7')],this['squeue'][_0xd7df('0x17')]);util[_0xd7df('0x1b')](this[_0xd7df('0x6')]['id'],this[_0xd7df('0x8')]['agents'][this['agent']['id']],_0x52b56a?'STOP':_0xd7df('0x22'));}if(!_0x52b56a){setTimeout(this[_0xd7df('0x9')]['bind'](this),0x3e8);}};function agent(_0x27c57c,_0x1a8b40,_0x4bda0e,_0x574567){return new Agent(_0x27c57c,_0x1a8b40,_0x4bda0e,_0x574567);}module['exports']=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 5f56f3c..e48002d 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 _0xe39d=['removeWaitingNotification','exports','lodash','./util','../../../../../config/logger','realtime','push','handleRun','bind','handleTimeout','timeout','squeue','drained','handleDrained','prototype','isNil','queue','length','Agents','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','busyQueue','name','saveWaitingNotification','routing','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','notificationId','STOP','TIMEOUT','busy'];(function(_0x189ad2,_0x47be83){var _0x2ef8ab=function(_0xa7e20){while(--_0xa7e20){_0x189ad2['push'](_0x189ad2['shift']());}};_0x2ef8ab(++_0x47be83);}(_0xe39d,0x9a));var _0xde39=function(_0x5e2a6e,_0x3d490d){_0x5e2a6e=_0x5e2a6e-0x0;var _0x42c5c0=_0xe39d[_0x5e2a6e];return _0x42c5c0;};'use strict';var _=require(_0xde39('0x0'));var uuid=require('uuid');var util=require(_0xde39('0x1'));var logger=require(_0xde39('0x2'))('routing');var Beepall=function(_0x2c0d02,_0x7d9dc4,_0x842214,_0x38b060){this['notificationId']=uuid['v4']();this['squeue']=_0x2c0d02;this['queue']=_0x7d9dc4;this[_0xde39('0x3')]=_0x842214;this['routing']=_0x38b060;this['squeue'][_0xde39('0x4')](this[_0xde39('0x5')][_0xde39('0x6')](this),this[_0xde39('0x7')][_0xde39('0x6')](this));this['squeue']['on'](_0xde39('0x8'),this[_0xde39('0x7')][_0xde39('0x6')](this));this[_0xde39('0x9')]['on'](_0xde39('0xa'),this[_0xde39('0xb')][_0xde39('0x6')](this));};Beepall['prototype'][_0xde39('0x4')]=function(){this['squeue'][_0xde39('0x4')](this[_0xde39('0x5')][_0xde39('0x6')](this),this[_0xde39('0x7')][_0xde39('0x6')](this));};Beepall[_0xde39('0xc')][_0xde39('0xb')]=function(){this[_0xde39('0x7')](!![]);};Beepall[_0xde39('0xc')]['handleRun']=function(){var _0x3a57a1=!![];if(!_[_0xde39('0xd')](this[_0xde39('0xe')])&&!_[_0xde39('0xd')](this[_0xde39('0xe')]['Agents'])&&this[_0xde39('0xe')]['Agents']['length']>0x0){for(var _0x162a60=0x0,_0x30e3cb;_0x162a600x0){for(var _0x54b66e=0x0,_0x4a111b;_0x54b66e0x0&&_0x51a2ed[_0x5b26c8+_0x7a22('0x24')]>=_0x51a2ed[_0x5b26c8+_0x7a22('0x22')]){writeLog(_0x191550,_0x51a2ed,_0x5b26c8[_0x7a22('0x25')]()+_0x7a22('0x26'));return![];}}return!![];};exports[_0x7a22('0x27')]=function(_0x4c9bbe,_0xb92ed,_0x467a6a,_0x4013f0,_0x1e652b){return sendNotification(!![],_0x4c9bbe,_0xb92ed,_0x467a6a,_0x4013f0,_0x1e652b);};exports[_0x7a22('0x28')]=function(_0x2574c7,_0x3969f2,_0x2b2a01,_0x332a50,_0x27bf7e){return sendNotification(![],_0x2574c7,_0x3969f2,_0x2b2a01,_0x332a50,_0x27bf7e);};exports['checkWaitingNotifications']=function(_0x328f31,_0x2dbf65,_0x4daaae){var _0x47e0af=_0x2dbf65[_0x7a22('0x29')][_0x7a22('0x2a')];if(!_0x47e0af&&_0x4daaae){_0x47e0af=_0x4daaae['id'];}var _0x1f37c7=_[_0x7a22('0x2b')](_0x328f31[_0x2dbf65[_0x7a22('0x2c')]+'QueuesWaitingInteractions'],function(_0x354430){var _0x42a66b=_[_0x7a22('0x2d')](_0x2dbf65[_0x7a22('0x2c')])+_0x7a22('0x2e');return _0x354430[_0x42a66b]===_0x2dbf65[_0x7a22('0x29')]['id'];});if(!_0x1f37c7&&_0x47e0af){_0x1f37c7=_['some'](_0x328f31[_0x7a22('0x2f')][_0x47e0af][_0x2dbf65[_0x7a22('0x2c')]+_0x7a22('0x30')],function(_0x38895d){return _0x38895d['id']===_0x2dbf65[_0x7a22('0x29')]['id'];});}return _0x1f37c7;};exports[_0x7a22('0x31')]=function(_0x777b4,_0x17919a,_0x1ee821,_0x1ae412){_0x777b4[_0x7a22('0x2f')][_0x1ee821['id']][_0x1ae412+_0x7a22('0x30')][_0x17919a['message']['id']]={'id':_0x17919a['interaction']['id']};};exports[_0x7a22('0x32')]=function(_0x148534,_0x4e43e5,_0x2b8308,_0x1365da){delete _0x148534[_0x7a22('0x2f')][_0x2b8308['id']][_0x1365da+_0x7a22('0x30')][_0x4e43e5[_0x7a22('0x17')]['id']];};exports[_0x7a22('0x33')]=writeLog; \ No newline at end of file +var _0x010b=['name','account','notificationSound','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','emit','notification:%s','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','PAUSE','hasOwnProperty','Capacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','interaction','UserId','some','channel','QueuesWaitingInteractions','capitalize','InteractionId','agents','WaitingInteractions','saveWaitingNotification','writeLog','lodash','../utils','../../../../../config/environment','../../../../../config/logger','defaults','redis','localhost','format','user:save','split','\x20interaction'];(function(_0x51dc97,_0x469010){var _0x32f1c=function(_0x51c0ec){while(--_0x51c0ec){_0x51dc97['push'](_0x51dc97['shift']());}};_0x32f1c(++_0x469010);}(_0x010b,0x168));var _0xb010=function(_0x1d980d,_0x4a03fe){_0x1d980d=_0x1d980d-0x0;var _0xb200d8=_0x010b[_0x1d980d];return _0xb200d8;};'use strict';var _=require(_0xb010('0x0'));var util=require('util');var utils=require(_0xb010('0x1'));var Redis=require('ioredis');var config=require(_0xb010('0x2'));var logger=require(_0xb010('0x3'))('routing');config['redis']=_[_0xb010('0x4')](config[_0xb010('0x5')],{'host':_0xb010('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb010('0x5')]));function sendNotification(_0x131f41,_0x3fb7cf,_0x404534,_0x50ddd3,_0x106225,_0x488a10){io['to'](util[_0xb010('0x7')]('user:%s',_0x50ddd3['name']))['emit'](_0xb010('0x8'),_0x50ddd3);var _0x4da6d6=_0x488a10||{};var _0x836c12=_0x404534[_0xb010('0x9')]('.');var _0x28ddf5={'uniqueid':_0x3fb7cf,'channel':_0x836c12[0x0],'id':_0x836c12[0x1],'title':_0x836c12[0x0]+_0xb010('0xa'),'interactionId':_0x836c12[0x2],'queue':_0x106225?_0x106225[_0xb010('0xb')]:null,'sound':_0x4da6d6[_0xb010('0xc')][_0xb010('0xd')],'shake':_0x4da6d6['account']['notificationShake']};try{if(!_0x4da6d6[_0xb010('0xe')]){_0x4da6d6[_0xb010('0xe')]={};}if(_0x106225){_0x4da6d6[_0xb010('0xe')][_0xb010('0xf')]=_0x106225;}else if(_0x4da6d6['body'][_0xb010('0xf')]){delete _0x4da6d6[_0xb010('0xe')][_0xb010('0xf')];}_0x28ddf5[_0xb010('0x10')]=utils[_0xb010('0x11')](_0x4da6d6[_0xb010('0xc')][_0xb010('0x12')],_0x4da6d6);}catch(_0x4ff83d){_0x28ddf5[_0xb010('0x10')]=_0xb010('0x13');logger[_0xb010('0x14')](util[_0xb010('0x7')](_0xb010('0x15'),_0x3fb7cf,_0x4ff83d[_0xb010('0x16')]));}io['to'](util[_0xb010('0x7')]('user:%s',_0x50ddd3['name']))[_0xb010('0x17')](util[_0xb010('0x7')](_0xb010('0x18'),_0x131f41?_0xb010('0x19'):_0xb010('0x1a')),_0x28ddf5);}function writeLog(_0x5ca76d,_0x40c1e4,_0x511f0c){return logger[_0xb010('0x1b')](util[_0xb010('0x7')](_0xb010('0x1c'),_0x5ca76d,_0x40c1e4[_0xb010('0xb')],_0x511f0c));}exports[_0xb010('0x1d')]=function(_0x3c0d82,_0x48d8fb,_0x2e9344,_0x134933){if(_0x48d8fb[_0xb010('0x1e')]){writeLog(_0x3c0d82,_0x48d8fb,_0xb010('0x1f'));return![];}if(!_0x48d8fb[_0xb010('0x20')]){writeLog(_0x3c0d82,_0x48d8fb,_0xb010('0x21'));return![];}if(_0x48d8fb[_0x2e9344+'Pause']){writeLog(_0x3c0d82,_0x48d8fb,_0xb010('0x22'));return![];}if(_0x134933&&_0x48d8fb[_0xb010('0x23')](_0x2e9344+_0xb010('0x24'))&&_0x48d8fb[_0xb010('0x23')](_0x2e9344+'CurrentCapacity')){if(_0x48d8fb[_0x2e9344+'Capacity']>0x0&&_0x48d8fb[_0x2e9344+'CurrentCapacity']>=_0x48d8fb[_0x2e9344+'Capacity']){writeLog(_0x3c0d82,_0x48d8fb,_0x2e9344[_0xb010('0x25')]()+_0xb010('0x26'));return![];}}return!![];};exports[_0xb010('0x27')]=function(_0x283816,_0x4476a6,_0x50aa55,_0xcde956,_0x7672db){return sendNotification(!![],_0x283816,_0x4476a6,_0x50aa55,_0xcde956,_0x7672db);};exports[_0xb010('0x28')]=function(_0x3e4e35,_0x1175c4,_0x42a14a,_0x21c5a3,_0x559274){return sendNotification(![],_0x3e4e35,_0x1175c4,_0x42a14a,_0x21c5a3,_0x559274);};exports[_0xb010('0x29')]=function(_0x511fcb,_0x325314,_0x2e53c1){var _0x5cba74=_0x325314[_0xb010('0x2a')][_0xb010('0x2b')];if(!_0x5cba74&&_0x2e53c1){_0x5cba74=_0x2e53c1['id'];}var _0x301ed3=_[_0xb010('0x2c')](_0x511fcb[_0x325314[_0xb010('0x2d')]+_0xb010('0x2e')],function(_0x3c94b9){var _0x3779aa=_[_0xb010('0x2f')](_0x325314[_0xb010('0x2d')])+_0xb010('0x30');return _0x3c94b9[_0x3779aa]===_0x325314['interaction']['id'];});if(!_0x301ed3&&_0x5cba74){_0x301ed3=_['some'](_0x511fcb[_0xb010('0x31')][_0x5cba74][_0x325314['channel']+_0xb010('0x32')],function(_0x17d0dc){return _0x17d0dc['id']===_0x325314[_0xb010('0x2a')]['id'];});}return _0x301ed3;};exports[_0xb010('0x33')]=function(_0x4b96cb,_0x17522a,_0x5ce189,_0x1bb9cd){_0x4b96cb[_0xb010('0x31')][_0x5ce189['id']][_0x1bb9cd+_0xb010('0x32')][_0x17522a['message']['id']]={'id':_0x17522a[_0xb010('0x2a')]['id']};};exports['removeWaitingNotification']=function(_0x274cc9,_0x3f2bd4,_0x3f7c73,_0xc5ba45){delete _0x274cc9[_0xb010('0x31')][_0x3f7c73['id']][_0xc5ba45+_0xb010('0x32')][_0x3f2bd4['message']['id']];};exports[_0xb010('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 4a02bdd..3f406e1 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 _0xbd50=['message','join','info','next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','[%s][SYSTEM]\x20%s','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error'];(function(_0x224dda,_0x16d0f9){var _0x2987ac=function(_0x3b1033){while(--_0x3b1033){_0x224dda['push'](_0x224dda['shift']());}};_0x2987ac(++_0x16d0f9);}(_0xbd50,0x196));var _0x0bd5=function(_0x214d37,_0x123f64){_0x214d37=_0x214d37-0x0;var _0x94a78=_0xbd50[_0x214d37];return _0x94a78;};'use strict';var schema=require(_0x0bd5('0x0'));var sh=require(_0x0bd5('0x1'));var _=require(_0x0bd5('0x2'));var utils=require('./utils');var logger=require(_0x0bd5('0x3'))(_0x0bd5('0x4'));var system=schema({'command':{'type':_0x0bd5('0x5'),'required':!![],'message':_0x0bd5('0x6')}});exports[_0x0bd5('0x7')]=function(_0x4c17ee,_0x558e89){return function(_0x560cf1){try{var _0x376024={'command':_0x558e89[0x0]};var _0x2ef1d0=system[_0x0bd5('0x0')](_0x376024,{'typecast':!![]});if(_0x2ef1d0[_0x0bd5('0x8')]){logger[_0x0bd5('0x9')]('[%s][SYSTEM]\x20%s',_0x4c17ee,_['map'](_0x2ef1d0,_0x0bd5('0xa'))[_0x0bd5('0xb')](',\x20'));logger[_0x0bd5('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x4c17ee);_0x560cf1[_0x0bd5('0xd')]();}else{var _0x2fa7d1=this;var _0x519bc6=utils[_0x0bd5('0xe')](_0x558e89[0x0],this);logger[_0x0bd5('0xc')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x4c17ee,_0x519bc6);sh[_0x0bd5('0xf')](_[_0x0bd5('0x10')](_0x519bc6),function(_0x1aa818,_0x5f49ee){logger[_0x0bd5('0xc')](_0x0bd5('0x11'),_0x4c17ee,_0x1aa818);if(_0x1aa818==0x0){var _0x2f9588=_0x5f49ee[_0x0bd5('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x0bd5('0x13')](_0x558e89[0x1])||_[_0x0bd5('0x14')](_0x558e89[0x1])){logger[_0x0bd5('0xc')](_0x0bd5('0x15'),_0x4c17ee);_0x2fa7d1['body'][_0x558e89[0x1]]=_0x2f9588;}else{logger[_0x0bd5('0xc')](_0x0bd5('0x16'),_0x4c17ee,_0x558e89[0x1],_0x2f9588);_0x2fa7d1['body'][_0x558e89[0x1]]=_0x2f9588;}}_0x560cf1[_0x0bd5('0xd')]();});}}catch(_0x23ef4e){logger[_0x0bd5('0x9')](_0x0bd5('0x17'),_0x4c17ee,_['isObject'](_0x23ef4e)?JSON[_0x0bd5('0x18')](_0x23ef4e):_0x23ef4e);logger[_0x0bd5('0xc')](_0x0bd5('0x19'),_0x4c17ee);_0x560cf1[_0x0bd5('0xd')]();}};}; \ No newline at end of file +var _0x2445=['routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','next','stringify','validate','shelljs','lodash'];(function(_0x236227,_0xb44846){var _0x224ecb=function(_0x1ab9bd){while(--_0x1ab9bd){_0x236227['push'](_0x236227['shift']());}};_0x224ecb(++_0xb44846);}(_0x2445,0xfa));var _0x5244=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x2445[_0x12f688];return _0x59c3de;};'use strict';var schema=require(_0x5244('0x0'));var sh=require(_0x5244('0x1'));var _=require(_0x5244('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x5244('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':_0x5244('0x4')}});exports['consequence']=function(_0x35ebd0,_0x5451fe){return function(_0x3ce83d){try{var _0x3ffc72={'command':_0x5451fe[0x0]};var _0x3d8be8=system[_0x5244('0x0')](_0x3ffc72,{'typecast':!![]});if(_0x3d8be8[_0x5244('0x5')]){logger[_0x5244('0x6')](_0x5244('0x7'),_0x35ebd0,_[_0x5244('0x8')](_0x3d8be8,'message')[_0x5244('0x9')](',\x20'));logger[_0x5244('0xa')](_0x5244('0xb'),_0x35ebd0);_0x3ce83d['next']();}else{var _0x44754b=this;var _0x145fb2=utils[_0x5244('0xc')](_0x5451fe[0x0],this);logger[_0x5244('0xa')](_0x5244('0xd'),_0x35ebd0,_0x145fb2);sh[_0x5244('0xe')](_[_0x5244('0xf')](_0x145fb2),function(_0x20acad,_0x293a70){logger[_0x5244('0xa')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x35ebd0,_0x20acad);if(_0x20acad==0x0){var _0xe66a80=_0x293a70[_0x5244('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0x5244('0x11')](_0x5451fe[0x1])||_[_0x5244('0x12')](_0x5451fe[0x1])){logger[_0x5244('0xa')](_0x5244('0x13'),_0x35ebd0);_0x44754b[_0x5244('0x14')][_0x5451fe[0x1]]=_0xe66a80;}else{logger[_0x5244('0xa')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x35ebd0,_0x5451fe[0x1],_0xe66a80);_0x44754b['body'][_0x5451fe[0x1]]=_0xe66a80;}}_0x3ce83d[_0x5244('0x15')]();});}}catch(_0x4eab25){logger[_0x5244('0x6')]('[%s][SYSTEM]\x20%s',_0x35ebd0,_['isObject'](_0x4eab25)?JSON[_0x5244('0x16')](_0x4eab25):_0x4eab25);logger[_0x5244('0xa')](_0x5244('0xb'),_0x35ebd0);_0x3ce83d[_0x5244('0x15')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 057689e..77698e8 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 _0x1088=['../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','interaction','stringify','info','next','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction'];(function(_0x4893e1,_0xa54be0){var _0x528cd1=function(_0xe5cd3f){while(--_0xe5cd3f){_0x4893e1['push'](_0x4893e1['shift']());}};_0x528cd1(++_0xa54be0);}(_0x1088,0x10b));var _0x8108=function(_0x257b00,_0x3658be){_0x257b00=_0x257b00-0x0;var _0x247e16=_0x1088[_0x257b00];return _0x247e16;};'use strict';var schema=require(_0x8108('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x8108('0x1')),'openchannelInteraction':require(_0x8108('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x8108('0x3')),'faxInteraction':require(_0x8108('0x4')),'whatsappInteraction':require(_0x8108('0x5'))};var logger=require(_0x8108('0x6'))('routing');var tag=schema({'tag':{'type':_0x8108('0x7'),'required':!![],'message':_0x8108('0x8')}});exports[_0x8108('0x9')]=function(_0x4ed095,_0x1ede26,_0x2df44b,_0x5dda32){return function(_0x56d31a){try{var _0x4f3eb6={'tag':_0x1ede26[0x0]};var _0x41b7af=tag[_0x8108('0x0')](_0x4f3eb6,{'typecast':!![]});if(_0x41b7af[_0x8108('0xa')]){logger[_0x8108('0xb')](_0x8108('0xc'),_0x4ed095,_['map'](_0x41b7af,'message')[_0x8108('0xd')](',\x20'));logger['info'](_0x8108('0xe'),_0x4ed095);_0x56d31a['next']();}else{var _0x5cc787={'ids':[_0x1ede26[0x0]]};if(rpc[_0x5dda32[_0x8108('0xf')]+_0x8108('0x10')]){rpc[_0x5dda32['channel']+_0x8108('0x10')]['addTags'](_0x5dda32[_0x8108('0x11')]['id'],_0x5cc787)['then'](function(_0x5e1bca){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x4ed095,_0x1ede26[0x1],_0x5dda32[_0x8108('0xf')],_0x5dda32['interaction']['id']);})['catch'](function(_0x4432a3){logger[_0x8108('0xb')](_0x8108('0xc'),_0x4ed095,JSON[_0x8108('0x12')](_0x4432a3));logger[_0x8108('0x13')](_0x8108('0xe'),_0x4ed095);})['finally'](function(){_0x56d31a[_0x8108('0x14')]();});}}}catch(_0x546c3e){logger[_0x8108('0xb')](_0x8108('0xc'),_0x4ed095,_['isObject'](_0x546c3e)?JSON[_0x8108('0x12')](_0x546c3e):_0x546c3e);logger[_0x8108('0x13')](_0x8108('0xe'),_0x4ed095);_0x56d31a[_0x8108('0x14')]();}};}; \ No newline at end of file +var _0xec97=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','stringify','finally','[%s][TAG]\x20%s','isObject','validate','lodash'];(function(_0x2f6519,_0x3abf6e){var _0x5da39a=function(_0x85f6bc){while(--_0x85f6bc){_0x2f6519['push'](_0x2f6519['shift']());}};_0x5da39a(++_0x3abf6e);}(_0xec97,0x12a));var _0x7ec9=function(_0x39e8f5,_0x21462f){_0x39e8f5=_0x39e8f5-0x0;var _0x568054=_0xec97[_0x39e8f5];return _0x568054;};'use strict';var schema=require(_0x7ec9('0x0'));var _=require(_0x7ec9('0x1'));var rpc={'chatInteraction':require(_0x7ec9('0x2')),'openchannelInteraction':require(_0x7ec9('0x3')),'smsInteraction':require(_0x7ec9('0x4')),'mailInteraction':require(_0x7ec9('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x7ec9('0x6'))};var logger=require(_0x7ec9('0x7'))(_0x7ec9('0x8'));var tag=schema({'tag':{'type':_0x7ec9('0x9'),'required':!![],'message':_0x7ec9('0xa')}});exports[_0x7ec9('0xb')]=function(_0x1cb1bc,_0x10a88e,_0x5e8273,_0x16837b){return function(_0x600b5f){try{var _0x9833a7={'tag':_0x10a88e[0x0]};var _0x78ec82=tag[_0x7ec9('0x0')](_0x9833a7,{'typecast':!![]});if(_0x78ec82[_0x7ec9('0xc')]){logger[_0x7ec9('0xd')]('[%s][TAG]\x20%s',_0x1cb1bc,_[_0x7ec9('0xe')](_0x78ec82,_0x7ec9('0xf'))[_0x7ec9('0x10')](',\x20'));logger['info'](_0x7ec9('0x11'),_0x1cb1bc);_0x600b5f[_0x7ec9('0x12')]();}else{var _0x422eb6={'ids':[_0x10a88e[0x0]]};if(rpc[_0x16837b[_0x7ec9('0x13')]+_0x7ec9('0x14')]){rpc[_0x16837b[_0x7ec9('0x13')]+_0x7ec9('0x14')][_0x7ec9('0x15')](_0x16837b['interaction']['id'],_0x422eb6)[_0x7ec9('0x16')](function(_0x197d8b){logger[_0x7ec9('0x17')](_0x7ec9('0x18'),_0x1cb1bc,_0x10a88e[0x1],_0x16837b['channel'],_0x16837b[_0x7ec9('0x19')]['id']);})['catch'](function(_0x3616f9){logger[_0x7ec9('0xd')]('[%s][TAG]\x20%s',_0x1cb1bc,JSON[_0x7ec9('0x1a')](_0x3616f9));logger[_0x7ec9('0x17')](_0x7ec9('0x11'),_0x1cb1bc);})[_0x7ec9('0x1b')](function(){_0x600b5f['next']();});}}}catch(_0x33ce0c){logger['error'](_0x7ec9('0x1c'),_0x1cb1bc,_[_0x7ec9('0x1d')](_0x33ce0c)?JSON['stringify'](_0x33ce0c):_0x33ce0c);logger[_0x7ec9('0x17')](_0x7ec9('0x11'),_0x1cb1bc);_0x600b5f[_0x7ec9('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 29a97ba..d441d3c 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 _0xc3d6=['../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','urlOnAnswer','?params=','jsonrpc','method','login','push','params','stringify','utf8','POST','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','[%s][TVOX]\x20%s','isObject','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise'];(function(_0x4e501e,_0x3f3f07){var _0x49a913=function(_0x4b157b){while(--_0x4b157b){_0x4e501e['push'](_0x4e501e['shift']());}};_0x49a913(++_0x3f3f07);}(_0xc3d6,0x65));var _0x6c3d=function(_0xdc9597,_0x2f9320){_0xdc9597=_0xdc9597-0x0;var _0x2fa32c=_0xc3d6[_0xdc9597];return _0x2fa32c;};'use strict';var rp=require(_0x6c3d('0x0'));var logger=require(_0x6c3d('0x1'))(_0x6c3d('0x2'));var _=require(_0x6c3d('0x3'));var arr=[];exports[_0x6c3d('0x4')]=function(_0x4ec42d,_0x56353b){return function(_0x3bc7bb){var _0x203856=_0x56353b[0xa];var _0x136d80=_0x56353b[0xb];var _0x3c1ae3=_0x56353b[0xc];var _0x5be4a5=_0x56353b[0xd];var _0x4738d9=_0x56353b[0xe];var _0x456da6=_0x56353b[0xf][_0x6c3d('0x5')](/\n/g,_0x6c3d('0x6'));var _0x138f69=_0x56353b[0x10][_0x6c3d('0x5')](/\n/g,'\x20');if(!arr[_0x6c3d('0x7')](_0x136d80)){arr['push'](_0x136d80);var _0x444a0f=_0x56353b[0x3];var _0x5eb373=_0x56353b[0x4];var _0x37ad4c=_0x56353b[0x1];var _0x480063=_0x56353b[0x0];var _0x3c0072={};_0x3c0072[_0x6c3d('0x8')]=_0x56353b[0x8]+_0x6c3d('0x9')+_0x3c1ae3+'|'+_0x203856+'|'+_0x5be4a5+'|'+_0x136d80+'|'+_0x4738d9;_0x3c0072['urlOnRing']=_0x56353b[0x7]+_0x6c3d('0x9')+_0x3c1ae3+'|'+_0x203856+'|'+_0x5be4a5+'|'+_0x136d80+'|'+_0x4738d9+'|'+_0x456da6+'|'+_0x138f69;_0x3c0072['title']=_0x56353b[0x9];var _0x2fe275={};_0x2fe275[_0x6c3d('0xa')]='2.0';_0x2fe275[_0x6c3d('0xb')]=_0x6c3d('0xc');var _0x541816=[];_0x541816['push'](_0x56353b[0x2]);_0x541816[_0x6c3d('0xd')](_0x56353b[0x5]);_0x541816[_0x6c3d('0xd')](_0x56353b[0x6]);_0x2fe275[_0x6c3d('0xe')]=_0x541816;_0x2fe275['id']=0x1;var _0x56ae26=JSON[_0x6c3d('0xf')](_0x2fe275);var _0x45dc08={'encoding':_0x6c3d('0x10'),'method':_0x6c3d('0x11'),'timeout':0x2710,'url':_0x444a0f,'headers':{'Content-Type':'application/json-rpc'},'body':_0x56ae26};return rp(_0x45dc08)[_0x6c3d('0x12')](function(_0x91acc3){const _0x161182=JSON[_0x6c3d('0x13')](_0x91acc3);if(!_0x161182[_0x6c3d('0x14')][_0x6c3d('0x15')]){throw new Error(_0x6c3d('0x16'));}var _0x1d49a5=_0x136d80;var _0x3add15=_0x6c3d('0x17')+_0x37ad4c+_0x6c3d('0x18')+_0x480063+_0x6c3d('0x19')+_0x1d49a5+_0x6c3d('0x1a')+JSON[_0x6c3d('0xf')](_0x3c0072);var _0x538902=_0x5eb373+'?'+_0x3add15;return rp(_0x538902);})[_0x6c3d('0x12')](function(_0x1ace98){logger['info'](_0x6c3d('0x1b'),_0x4ec42d,_0x1ace98);_0x3bc7bb[_0x6c3d('0x1c')]();})[_0x6c3d('0x1d')](function(_0x55068a){logger['error'](_0x6c3d('0x1e'),_0x4ec42d,_[_0x6c3d('0x1f')](_0x55068a)?JSON['stringify'](_0x55068a):_0x55068a);_0x3bc7bb[_0x6c3d('0x1c')]();});}else{logger[_0x6c3d('0x20')](_0x6c3d('0x21'),_0x4ec42d);_0x3bc7bb['next']();}};}; \ No newline at end of file +var _0xe398=['Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&sessionId=','&data=','info','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','consequence','replace','includes','push','urlOnAnswer','?params=','urlOnRing','jsonrpc','2.0','login','params','stringify','utf8','POST','then','parse','result'];(function(_0x2ed90d,_0x1460ff){var _0x2fa50c=function(_0xc3a9a6){while(--_0xc3a9a6){_0x2ed90d['push'](_0x2ed90d['shift']());}};_0x2fa50c(++_0x1460ff);}(_0xe398,0x8c));var _0x8e39=function(_0x17974f,_0x431507){_0x17974f=_0x17974f-0x0;var _0x4a1c51=_0xe398[_0x17974f];return _0x4a1c51;};'use strict';var rp=require(_0x8e39('0x0'));var logger=require(_0x8e39('0x1'))(_0x8e39('0x2'));var _=require('lodash');var arr=[];exports[_0x8e39('0x3')]=function(_0x13334,_0x1448ae){return function(_0x42eaf8){var _0x21b64d=_0x1448ae[0xa];var _0x3b880a=_0x1448ae[0xb];var _0x4fc9f0=_0x1448ae[0xc];var _0x5704fe=_0x1448ae[0xd];var _0x1bb288=_0x1448ae[0xe];var _0xab6b40=_0x1448ae[0xf][_0x8e39('0x4')](/\n/g,'\x20-\x20');var _0x204a6a=_0x1448ae[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x8e39('0x5')](_0x3b880a)){arr[_0x8e39('0x6')](_0x3b880a);var _0x4d9c33=_0x1448ae[0x3];var _0x4027b2=_0x1448ae[0x4];var _0x15c969=_0x1448ae[0x1];var _0x3458a2=_0x1448ae[0x0];var _0x164250={};_0x164250[_0x8e39('0x7')]=_0x1448ae[0x8]+_0x8e39('0x8')+_0x4fc9f0+'|'+_0x21b64d+'|'+_0x5704fe+'|'+_0x3b880a+'|'+_0x1bb288;_0x164250[_0x8e39('0x9')]=_0x1448ae[0x7]+_0x8e39('0x8')+_0x4fc9f0+'|'+_0x21b64d+'|'+_0x5704fe+'|'+_0x3b880a+'|'+_0x1bb288+'|'+_0xab6b40+'|'+_0x204a6a;_0x164250['title']=_0x1448ae[0x9];var _0x26ae04={};_0x26ae04[_0x8e39('0xa')]=_0x8e39('0xb');_0x26ae04['method']=_0x8e39('0xc');var _0x255104=[];_0x255104[_0x8e39('0x6')](_0x1448ae[0x2]);_0x255104[_0x8e39('0x6')](_0x1448ae[0x5]);_0x255104['push'](_0x1448ae[0x6]);_0x26ae04[_0x8e39('0xd')]=_0x255104;_0x26ae04['id']=0x1;var _0x1dfa43=JSON[_0x8e39('0xe')](_0x26ae04);var _0x2483af={'encoding':_0x8e39('0xf'),'method':_0x8e39('0x10'),'timeout':0x2710,'url':_0x4d9c33,'headers':{'Content-Type':'application/json-rpc'},'body':_0x1dfa43};return rp(_0x2483af)[_0x8e39('0x11')](function(_0x100bdd){const _0x546c6a=JSON[_0x8e39('0x12')](_0x100bdd);if(!_0x546c6a[_0x8e39('0x13')]['logged']){throw new Error(_0x8e39('0x14'));}var _0x22ac5c=_0x3b880a;var _0x1aa99a=_0x8e39('0x15')+_0x15c969+'&serviceId='+_0x3458a2+_0x8e39('0x16')+_0x22ac5c+_0x8e39('0x17')+JSON[_0x8e39('0xe')](_0x164250);var _0x39a97c=_0x4027b2+'?'+_0x1aa99a;return rp(_0x39a97c);})[_0x8e39('0x11')](function(_0x3da94e){logger[_0x8e39('0x18')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x13334,_0x3da94e);_0x42eaf8[_0x8e39('0x19')]();})[_0x8e39('0x1a')](function(_0x1ef275){logger[_0x8e39('0x1b')](_0x8e39('0x1c'),_0x13334,_[_0x8e39('0x1d')](_0x1ef275)?JSON['stringify'](_0x1ef275):_0x1ef275);_0x42eaf8['stop']();});}else{logger[_0x8e39('0x18')](_0x8e39('0x1e'),_0x13334);_0x42eaf8[_0x8e39('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 03f38cc..f3d5404 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x1ea0d9,_0x5cb711){var _0x52ebcd=function(_0x5c1b29){while(--_0x5c1b29){_0x1ea0d9['push'](_0x1ea0d9['shift']());}};_0x52ebcd(++_0x5cb711);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x4db4e5,_0x55bf6f){var _0x7e80a1=function(_0xf9b1d6){while(--_0xf9b1d6){_0x4db4e5['push'](_0x4db4e5['shift']());}};_0x7e80a1(++_0x55bf6f);}(_0xe706,0xa3));var _0x6e70=function(_0x57c601,_0x3293a2){_0x57c601=_0x57c601-0x0;var _0x10d301=_0xe706[_0x57c601];return _0x10d301;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index a4c4ea8..a3c4efc 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 _0x234c=['name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','rules','channel','interaction','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','push','slice','dialogflow','split','dialogflowv2','amazonlex','message','TagId','tvox','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','matchPath','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','emit','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','paused','waiting','mailQueues'];(function(_0x4e917c,_0x463a85){var _0x4e8db1=function(_0x3307d0){while(--_0x3307d0){_0x4e917c['push'](_0x4e917c['shift']());}};_0x4e8db1(++_0x463a85);}(_0x234c,0x7d));var _0xc234=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x234c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc234('0x0'));var util=require(_0xc234('0x1'));var path=require(_0xc234('0x2'));var fs=require('fs');var jayson=require(_0xc234('0x3'));var BPromise=require(_0xc234('0x4'));var utils=require(_0xc234('0x5'));var sUtils=require(_0xc234('0x6'));var logger=require(_0xc234('0x7'))(_0xc234('0x8'));var rpc={'openchannelQueueReport':require(_0xc234('0x9')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xc234('0xa')),'smsQueueReport':require(_0xc234('0xb')),'faxQueueReport':require(_0xc234('0xc')),'whatsappQueueReport':require(_0xc234('0xd'))};var RuleEngine=require(_0xc234('0xe'));function getId(_0x22f84a,_0x52dee3,_0x30ab3f){return util[_0xc234('0xf')](_0xc234('0x10'),_0x22f84a,_0x52dee3||0x0,_0x30ab3f||0x0);}function getIntervals(_0x116362,_0x509e4b){var _0x36cc26=[];if(!_[_0xc234('0x11')](_0x509e4b[_0xc234('0x12')])&&!_[_0xc234('0x11')](_0x116362[_0x509e4b[_0xc234('0x12')]])&&!_['isNil'](_0x116362[_0x509e4b[_0xc234('0x12')]][_0xc234('0x13')])){_0x36cc26=_['map'](_0x116362[_0x509e4b[_0xc234('0x12')]][_0xc234('0x13')],_0xc234('0x14'));}else if(!_[_0xc234('0x11')](_0x509e4b[_0xc234('0x14')])){_0x36cc26=[_0x509e4b[_0xc234('0x14')]];}return _0x36cc26;}exports[_0xc234('0x15')]=function(_0x1dd3d7){_0x1dd3d7[_0xc234('0x16')]={};return new BPromise(function(_0x15f78a,_0xa5b69d){var _0x1ebc47={'Start':function(_0x160e9b){var _0x25be7d=this;return new Promise(function(_0x227a92,_0x45f976){if(_0x160e9b){try{var _0x23d1bf=[];var _0x204221=getId(_0x160e9b[_0xc234('0x17')],_0x160e9b['message']?_0x160e9b['message']['id']:0x0,_0x160e9b[_0xc234('0x18')]?_0x160e9b[_0xc234('0x18')]['id']:0x0);var _0xcb623c=sUtils['checkWaitingNotifications'](_0x1dd3d7,_0x160e9b);if(!_0xcb623c&&_0x160e9b[_0xc234('0x19')]&&_['isArray'](_0x160e9b['applications'])&&_0x160e9b[_0xc234('0x19')]['length']){for(var _0x21e3f9=0x0;_0x21e3f9<_0x160e9b[_0xc234('0x19')][_0xc234('0x1a')];_0x21e3f9+=0x1){var _0x4b779a=_0x160e9b['applications'][_0x21e3f9];if(fs[_0xc234('0x1b')](path[_0xc234('0x1c')](__dirname,'applications',_0x4b779a[_0xc234('0x1d')]+_0xc234('0x1e')))){var _0x473b07=[];switch(_0x4b779a[_0xc234('0x1d')][_0xc234('0x1f')]()){case _0xc234('0x20'):var _0x5434b6=_0x4b779a[_0xc234('0x21')]['split'](',');if(_0x160e9b[_0xc234('0x17')]==='mail'){_0x473b07[_0xc234('0x22')](_0x5434b6[0x0]);_0x473b07[_0xc234('0x22')](_0x5434b6[0x1]);_0x473b07[_0xc234('0x22')](_0x5434b6[_0xc234('0x23')](0x2,_0x5434b6['length'])[_0xc234('0x1c')](','));}else{_0x473b07[_0xc234('0x22')](_0x5434b6[0x0]);_0x473b07[_0xc234('0x22')](_0x5434b6[_0xc234('0x23')](0x1,_0x5434b6[_0xc234('0x1a')])[_0xc234('0x1c')](','));}break;case _0xc234('0x24'):var _0x3a7342=_0x4b779a[_0xc234('0x21')][_0xc234('0x25')](',');_0x473b07[_0xc234('0x22')](_0x3a7342[0x0]);_0x473b07[_0xc234('0x22')](_0x3a7342[0x1]);_0x473b07['push'](_0x3a7342[_0xc234('0x23')](0x2,_0x3a7342[_0xc234('0x1a')])[_0xc234('0x1c')](','));break;case _0xc234('0x26'):var _0x3f582b=_0x4b779a['appdata']['split'](',');_0x473b07[_0xc234('0x22')](_0x3f582b[0x0]);_0x473b07['push'](_0x3f582b[0x1]);_0x473b07[_0xc234('0x22')](_0x3f582b[0x2]);_0x473b07[_0xc234('0x22')](_0x3f582b[0x3]);_0x473b07['push'](_0x3f582b[_0xc234('0x23')](0x4,_0x3f582b['length'])[_0xc234('0x1c')](','));break;case _0xc234('0x27'):var _0x18667e=_0x4b779a[_0xc234('0x21')][_0xc234('0x25')](',');_0x473b07['push'](_0x18667e[0x0]);_0x473b07[_0xc234('0x22')](_0x18667e[0x1]);_0x473b07[_0xc234('0x22')](_0x18667e[0x2]);_0x473b07[_0xc234('0x22')](_0x18667e[0x3]);_0x473b07[_0xc234('0x22')](_0x18667e[_0xc234('0x23')](0x4,_0x18667e['length'])[_0xc234('0x1c')](','));break;case _0xc234('0x28'):_0x473b07[_0xc234('0x22')](_0x4b779a['appdata']);break;case'tag':_0x473b07['push'](_0x4b779a[_0xc234('0x29')]);_0x473b07[_0xc234('0x22')](_0x4b779a['appdata']);break;case _0xc234('0x2a'):var _0x350fea=utils['getMustacheRender'](_0x160e9b[_0xc234('0x2b')][_0xc234('0x2c')],_0x160e9b);var _0x357973=_0x4b779a[_0xc234('0x21')][_0xc234('0x25')](',');_0x473b07[_0xc234('0x22')](_0x357973[0x0]);_0x473b07[_0xc234('0x22')](_0x357973[0x1]);_0x473b07[_0xc234('0x22')](_0x357973[0x2]);_0x473b07['push'](_0x357973[0x3]);_0x473b07[_0xc234('0x22')](_0x357973[0x4]);_0x473b07['push'](_0x357973[0x5]);_0x473b07[_0xc234('0x22')](_0x357973[0x6]);_0x473b07['push'](_0x357973[0x7]);_0x473b07[_0xc234('0x22')](_0x357973[0x8]);_0x473b07[_0xc234('0x22')](_0x357973[0x9]);_0x473b07[_0xc234('0x22')](_0x357973[0xa]);_0x473b07[_0xc234('0x22')](_0x160e9b[_0xc234('0x18')]['id']);_0x473b07[_0xc234('0x22')](_0x160e9b['message']['id']);_0x473b07[_0xc234('0x22')](_0x4b779a[_0xc234('0x2d')]);_0x473b07[_0xc234('0x22')](_0x160e9b['interaction'][_0xc234('0x2e')]);_0x473b07[_0xc234('0x22')](_0x160e9b[_0xc234('0x2f')][_0xc234('0x2f')]);_0x473b07[_0xc234('0x22')](_0x350fea);break;default:_0x473b07=_[_0xc234('0x11')](_0x4b779a['appdata'])?[]:_0x4b779a[_0xc234('0x21')][_0xc234('0x25')](',');}var _0x5ceb3b={'id':util[_0xc234('0xf')](_0xc234('0x30'),_0x204221,_0x4b779a['id'],_0x4b779a['app']),'condition':require(_0xc234('0x31'))[_0xc234('0x32')](_0x204221,getIntervals(_0x1dd3d7[_0xc234('0x33')],_0x4b779a),_0x1dd3d7),'consequence':require(_0xc234('0x34')+_0x4b779a[_0xc234('0x1d')])[_0xc234('0x35')](_0x204221,_0x473b07,_0x1dd3d7,_0x160e9b),'p':_0x4b779a[_0xc234('0x36')]||0x0};logger[_0xc234('0x37')](_0xc234('0x38'),_0x5ceb3b['id'],_0xc234('0x39'),getIntervals(_0x1dd3d7['intervals'],_0x4b779a)[_0xc234('0x1c')](_0xc234('0x3a')));_0x23d1bf[_0xc234('0x22')](_0x5ceb3b);}else{logger['error'](_0xc234('0x3b'),path[_0xc234('0x1c')](__dirname,_0xc234('0x19'),_0x4b779a['app']+_0xc234('0x1e')));}}_0x1dd3d7[_0xc234('0x16')][_0x204221]=new RuleEngine(_0x23d1bf);_0x1dd3d7[_0xc234('0x16')][_0x204221]['execute'](_0x160e9b,function(_0x3431c4){logger[_0xc234('0x37')](_0xc234('0x3c'),JSON['stringify'](_0x3431c4[_0xc234('0x3d')]));if(_0x1dd3d7[_0xc234('0x16')][_0x204221]){_0x1dd3d7['rules'][_0x204221]['emit'](_0xc234('0x3e'));}});return _0x227a92({'code':0xc8,'message':_0x160e9b});}else{if(_0xcb623c){logger[_0xc234('0x37')](util[_0xc234('0xf')](_0xc234('0x3f'),_0x204221));}else{logger[_0xc234('0x37')](_0xc234('0x40'));}return _0x227a92({'code':0xc8,'message':_0x160e9b});}}catch(_0x233a45){logger[_0xc234('0x41')](_0x233a45[_0xc234('0x42')]);return _0x45f976(_0x25be7d['error'](0x1f4,_0x233a45));}}return _0x45f976(_0xc234('0x43'));});},'AcceptMessage':function(_0x46d8e6){var _0x19124d=this;return new Promise(function(_0x2b2e9d,_0x4e2922){if(_0x46d8e6[_0xc234('0x44')]&&_0x46d8e6[_0xc234('0x44')]['id']){if(_0x1dd3d7[_0xc234('0x45')][_0x46d8e6[_0xc234('0x44')]['id']]){_0x1dd3d7['agents'][_0x46d8e6[_0xc234('0x44')]['id']][_0xc234('0x46')]=![];_0x1dd3d7[_0xc234('0x45')][_0x46d8e6['agent']['id']][_0xc234('0x47')]=undefined;}}if(_0x46d8e6[_0xc234('0x28')]&&_0x46d8e6[_0xc234('0x28')]['id']){try{var _0x496883=getId(_0x46d8e6[_0xc234('0x17')],_0x46d8e6[_0xc234('0x28')]?_0x46d8e6['message']['id']:0x0,_0x46d8e6['interaction']?_0x46d8e6[_0xc234('0x18')]['id']:0x0);if(_0x1dd3d7[_0xc234('0x16')][_0x496883]){_0x1dd3d7[_0xc234('0x16')][_0x496883][_0xc234('0x48')](_0xc234('0x49'));if(rpc[_0x46d8e6[_0xc234('0x17')]+'QueueReport']){rpc[_0x46d8e6[_0xc234('0x17')]+_0xc234('0x4a')][_0xc234('0x4b')](_0x496883,{'UserId':_0x46d8e6[_0xc234('0x28')]['UserId']})[_0xc234('0x4c')](function(){logger['error'](_0xc234('0x4d'));});}}return _0x2b2e9d({'code':0xc8,'message':_0x46d8e6});}catch(_0x5b6cc2){logger['error'](_0x5b6cc2['stack']);return _0x4e2922(_0x19124d[_0xc234('0x41')](0x1f4,_0x5b6cc2));}}logger[_0xc234('0x41')]('message\x20is\x20empty');return _0x4e2922(_0x19124d[_0xc234('0x41')](0x1f4,_0xc234('0x4e')));});},'RejectMessage':function(_0x563f0b){var _0xbf6764=this;return new Promise(function(_0x4994a1,_0x397bce){if(_0x563f0b['agent']&&_0x563f0b['agent']['id']){try{if(_0x1dd3d7[_0xc234('0x45')][_0x563f0b[_0xc234('0x44')]['id']]){_0x1dd3d7[_0xc234('0x45')][_0x563f0b[_0xc234('0x44')]['id']][_0xc234('0x46')]=![];_0x1dd3d7[_0xc234('0x45')][_0x563f0b[_0xc234('0x44')]['id']]['busyQueue']=undefined;}return _0x4994a1({'code':0xc8,'message':_0x563f0b});}catch(_0xea4e9f){logger[_0xc234('0x41')](_0xea4e9f['stack']);return _0x397bce(_0xbf6764[_0xc234('0x41')](0x1f4,_0xea4e9f));}}logger['error'](_0xc234('0x4e'));return _0x397bce(_0xbf6764[_0xc234('0x41')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x5df3cf){var _0x5e9dc4=this;return new Promise(function(_0x4be1ee,_0x2e2b68){if(_0x5df3cf[_0xc234('0x17')]&&_0x5df3cf[_0xc234('0x18')]&&_0x5df3cf[_0xc234('0x18')]['id']){try{var _0x33845d=getId(_0x5df3cf[_0xc234('0x17')],_0x5df3cf[_0xc234('0x28')]?_0x5df3cf[_0xc234('0x28')]['id']:0x0,_0x5df3cf[_0xc234('0x18')]?_0x5df3cf['interaction']['id']:0x0);if(_0x1dd3d7[_0xc234('0x16')][_0x33845d]){_0x1dd3d7[_0xc234('0x16')][_0x33845d]['emit'](_0xc234('0x49'));}return _0x4be1ee({'code':0xc8,'message':_0x5df3cf});}catch(_0x509346){logger['error'](_0x509346[_0xc234('0x42')]);return _0x2e2b68(_0x5e9dc4[_0xc234('0x41')](0x1f4,_0x509346));}}logger[_0xc234('0x41')](_0xc234('0x4e'));return _0x2e2b68(_0x5e9dc4[_0xc234('0x41')](0x1f4,_0xc234('0x4e')));});},'AgentCapacity':function(_0x4a5d52){var _0x20e36b=this;return new Promise(function(_0x8a9641,_0x52eca9){if(_0x1dd3d7['agents'][_0xc234('0x4f')](_0x4a5d52['id'])){for(var _0x5873ff in _0x4a5d52[_0xc234('0x50')]){if(_0x4a5d52['capacity'][_0xc234('0x4f')](_0x5873ff)){if(_0x1dd3d7['agents'][_0x4a5d52['id']]['hasOwnProperty'](_0x5873ff+_0xc234('0x51'))){_0x1dd3d7[_0xc234('0x45')][_0x4a5d52['id']][_0x5873ff+_0xc234('0x51')]=parseInt(_0x4a5d52[_0xc234('0x50')][_0x5873ff],0xa);}}}_0x1dd3d7['agents'][_0x4a5d52['id']][_0xc234('0x52')]();return _0x8a9641({'code':0xc8,'message':_0x1dd3d7[_0xc234('0x45')][_0x4a5d52['id']]});}else{return _0x52eca9(_0x20e36b[_0xc234('0x41')](0x1f4,_0xc234('0x53')));}});},'Agents':function(_0x21f857){return new Promise(function(_0x4852bc){var _0x19ff82=_[_0xc234('0x54')](_0x1dd3d7[_0xc234('0x45')]);if(_0x21f857&&_0x21f857['id']){var _0x31f090=_['find'](_0x19ff82,function(_0x55cf21){return _0x55cf21['id']===_0x21f857['id'];});_0x4852bc(_0x31f090);}else{_0x4852bc({'count':_0x19ff82[_0xc234('0x1a')],'rows':_0x19ff82});}});},'ChatQueues':function(){return new Promise(function(_0x2fd15b){var _0x53c933=[];for(var _0x1d643c in _0x1dd3d7[_0xc234('0x55')]){if(_0x1dd3d7[_0xc234('0x55')]['hasOwnProperty'](_0x1d643c)){var _0x25e4db=_0x1dd3d7[_0xc234('0x55')][_0x1d643c];var _0x2adbce={'id':_0x25e4db['id'],'available':_0x25e4db[_0xc234('0x56')],'loggedIn':_0x25e4db[_0xc234('0x57')],'name':_0x25e4db['name'],'paused':_0x25e4db[_0xc234('0x58')],'waiting':_0x25e4db[_0xc234('0x59')]};_0x53c933[_0xc234('0x22')](_0x2adbce);}}_0x2fd15b({'count':_0x53c933[_0xc234('0x1a')],'rows':_0x53c933});});},'MailQueues':function(){return new Promise(function(_0x5c5dc9){var _0xa197cb=[];for(var _0x21b660 in _0x1dd3d7[_0xc234('0x5a')]){if(_0x1dd3d7[_0xc234('0x5a')][_0xc234('0x4f')](_0x21b660)){var _0x21cb24=_0x1dd3d7['mailQueues'][_0x21b660];var _0x4b1802={'id':_0x21cb24['id'],'available':_0x21cb24[_0xc234('0x56')],'loggedIn':_0x21cb24[_0xc234('0x57')],'name':_0x21cb24[_0xc234('0x5b')],'paused':_0x21cb24[_0xc234('0x58')],'waiting':_0x21cb24[_0xc234('0x59')]};_0xa197cb[_0xc234('0x22')](_0x4b1802);}}_0x5c5dc9({'count':_0xa197cb[_0xc234('0x1a')],'rows':_0xa197cb});});},'OpenchannelQueues':function(){return new Promise(function(_0x36ac7f){var _0x44d37d=[];for(var _0x4ae6d3 in _0x1dd3d7[_0xc234('0x5c')]){if(_0x1dd3d7[_0xc234('0x5c')][_0xc234('0x4f')](_0x4ae6d3)){var _0x1425f6=_0x1dd3d7[_0xc234('0x5c')][_0x4ae6d3];var _0x16070e={'id':_0x1425f6['id'],'available':_0x1425f6[_0xc234('0x56')],'loggedIn':_0x1425f6[_0xc234('0x57')],'name':_0x1425f6['name'],'paused':_0x1425f6[_0xc234('0x58')],'waiting':_0x1425f6[_0xc234('0x59')]};_0x44d37d[_0xc234('0x22')](_0x16070e);}}_0x36ac7f({'count':_0x44d37d[_0xc234('0x1a')],'rows':_0x44d37d});});},'SmsQueues':function(){return new Promise(function(_0x5dd31a){var _0x1ff943=[];for(var _0x5e604f in _0x1dd3d7[_0xc234('0x5d')]){if(_0x1dd3d7[_0xc234('0x5d')][_0xc234('0x4f')](_0x5e604f)){var _0x5c4752=_0x1dd3d7[_0xc234('0x5d')][_0x5e604f];var _0x580ead={'id':_0x5c4752['id'],'available':_0x5c4752[_0xc234('0x56')],'loggedIn':_0x5c4752[_0xc234('0x57')],'name':_0x5c4752[_0xc234('0x5b')],'paused':_0x5c4752[_0xc234('0x58')],'waiting':_0x5c4752[_0xc234('0x59')]};_0x1ff943[_0xc234('0x22')](_0x580ead);}}_0x5dd31a({'count':_0x1ff943['length'],'rows':_0x1ff943});});},'FaxQueues':function(){return new Promise(function(_0x70494e){var _0x377c4b=[];for(var _0x50d494 in _0x1dd3d7['faxQueues']){if(_0x1dd3d7[_0xc234('0x5e')][_0xc234('0x4f')](_0x50d494)){var _0x56cb36=_0x1dd3d7['faxQueues'][_0x50d494];var _0x38d748={'id':_0x56cb36['id'],'available':_0x56cb36[_0xc234('0x56')],'loggedIn':_0x56cb36[_0xc234('0x57')],'name':_0x56cb36[_0xc234('0x5b')],'paused':_0x56cb36['paused'],'waiting':_0x56cb36[_0xc234('0x59')]};_0x377c4b['push'](_0x38d748);}}_0x70494e({'count':_0x377c4b[_0xc234('0x1a')],'rows':_0x377c4b});});},'WhatsappQueues':function(){return new Promise(function(_0x1cd83f){var _0xec998f=[];for(var _0x54aef6 in _0x1dd3d7[_0xc234('0x5f')]){if(_0x1dd3d7[_0xc234('0x5f')][_0xc234('0x4f')](_0x54aef6)){var _0x205b78=_0x1dd3d7[_0xc234('0x5f')][_0x54aef6];var _0x30675f={'id':_0x205b78['id'],'available':_0x205b78[_0xc234('0x56')],'loggedIn':_0x205b78[_0xc234('0x57')],'name':_0x205b78['name'],'paused':_0x205b78[_0xc234('0x58')],'waiting':_0x205b78[_0xc234('0x59')]};_0xec998f[_0xc234('0x22')](_0x30675f);}}_0x1cd83f({'count':_0xec998f[_0xc234('0x1a')],'rows':_0xec998f});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x2b8f67){var _0x23ce69=_[_0xc234('0x54')](_0x1dd3d7[_0xc234('0x60')]);_0x2b8f67({'count':_0x23ce69[_0xc234('0x1a')],'rows':_0x23ce69});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x561dc7){var _0x2c6576=_[_0xc234('0x54')](_0x1dd3d7[_0xc234('0x61')]);_0x561dc7({'count':_0x2c6576[_0xc234('0x1a')],'rows':_0x2c6576});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x2b0b44){var _0x408e9a=_[_0xc234('0x54')](_0x1dd3d7[_0xc234('0x62')]);_0x2b0b44({'count':_0x408e9a['length'],'rows':_0x408e9a});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x32d59a){var _0x5af069=_[_0xc234('0x54')](_0x1dd3d7[_0xc234('0x63')]);_0x32d59a({'count':_0x5af069[_0xc234('0x1a')],'rows':_0x5af069});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x3a580a){var _0x2558bb=_[_0xc234('0x54')](_0x1dd3d7['faxQueuesWaitingInteractions']);_0x3a580a({'count':_0x2558bb['length'],'rows':_0x2558bb});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x17956e){var _0x20e3db=_[_0xc234('0x54')](_0x1dd3d7[_0xc234('0x64')]);_0x17956e({'count':_0x20e3db[_0xc234('0x1a')],'rows':_0x20e3db});});}};var _0x197ebb=jayson[_0xc234('0x65')](_0x1ebc47)[_0xc234('0x66')]();_0x197ebb['on'](_0xc234('0x41'),function(_0x2b00be){logger['error'](JSON[_0xc234('0x67')](_0x2b00be));return _0xa5b69d(_0x2b00be);});_0x197ebb[_0xc234('0x15')](0x232c,_0xc234('0x68'),function(){console[_0xc234('0x69')](_0xc234('0x6a'),0x232c);return _0x15f78a(_0xc234('0x6b')+0x232c);});});}; \ No newline at end of file +var _0xb4c1=['channel','message','interaction','checkWaitingNotifications','applications','length','existsSync','join','autoreply','appdata','split','mail','push','slice','dialogflow','dialogflowv2','TagId','tvox','account','notificationTemplate','ChatWebsiteId','body','%s:%s:%s','./interval','condition','intervals','./applications/','app','consequence','priority','\x20|\x20','error','.js','execute','info','Applications\x20executed','stringify','matchPath','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','busy','busyQueue','emit','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agents','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules'];(function(_0x5c2bec,_0x4a4ca1){var _0x497e4f=function(_0xe9d8d2){while(--_0xe9d8d2){_0x5c2bec['push'](_0x5c2bec['shift']());}};_0x497e4f(++_0x4a4ca1);}(_0xb4c1,0xba));var _0x1b4c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb4c1[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x1b4c('0x0'));var path=require(_0x1b4c('0x1'));var fs=require('fs');var jayson=require(_0x1b4c('0x2'));var BPromise=require('bluebird');var utils=require(_0x1b4c('0x3'));var sUtils=require(_0x1b4c('0x4'));var logger=require(_0x1b4c('0x5'))(_0x1b4c('0x6'));var rpc={'openchannelQueueReport':require(_0x1b4c('0x7')),'mailQueueReport':require(_0x1b4c('0x8')),'chatQueueReport':require(_0x1b4c('0x9')),'smsQueueReport':require(_0x1b4c('0xa')),'faxQueueReport':require(_0x1b4c('0xb')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x1b4c('0xc'));function getId(_0x3d386e,_0x39ee28,_0x1bfba1){return util[_0x1b4c('0xd')](_0x1b4c('0xe'),_0x3d386e,_0x39ee28||0x0,_0x1bfba1||0x0);}function getIntervals(_0x468ca3,_0x22f588){var _0x1e6281=[];if(!_[_0x1b4c('0xf')](_0x22f588[_0x1b4c('0x10')])&&!_[_0x1b4c('0xf')](_0x468ca3[_0x22f588[_0x1b4c('0x10')]])&&!_[_0x1b4c('0xf')](_0x468ca3[_0x22f588[_0x1b4c('0x10')]][_0x1b4c('0x11')])){_0x1e6281=_[_0x1b4c('0x12')](_0x468ca3[_0x22f588[_0x1b4c('0x10')]][_0x1b4c('0x11')],_0x1b4c('0x13'));}else if(!_[_0x1b4c('0xf')](_0x22f588[_0x1b4c('0x13')])){_0x1e6281=[_0x22f588[_0x1b4c('0x13')]];}return _0x1e6281;}exports[_0x1b4c('0x14')]=function(_0x51fb93){_0x51fb93[_0x1b4c('0x15')]={};return new BPromise(function(_0x89c73b,_0x52c782){var _0x243d51={'Start':function(_0x754134){var _0xe5e34b=this;return new Promise(function(_0x4dd9f3,_0x4a4dac){if(_0x754134){try{var _0x1a3922=[];var _0x2ff603=getId(_0x754134[_0x1b4c('0x16')],_0x754134[_0x1b4c('0x17')]?_0x754134[_0x1b4c('0x17')]['id']:0x0,_0x754134[_0x1b4c('0x18')]?_0x754134[_0x1b4c('0x18')]['id']:0x0);var _0x5d13f8=sUtils[_0x1b4c('0x19')](_0x51fb93,_0x754134);if(!_0x5d13f8&&_0x754134[_0x1b4c('0x1a')]&&_['isArray'](_0x754134[_0x1b4c('0x1a')])&&_0x754134[_0x1b4c('0x1a')]['length']){for(var _0x1578c1=0x0;_0x1578c1<_0x754134[_0x1b4c('0x1a')][_0x1b4c('0x1b')];_0x1578c1+=0x1){var _0x5bc814=_0x754134['applications'][_0x1578c1];if(fs[_0x1b4c('0x1c')](path[_0x1b4c('0x1d')](__dirname,_0x1b4c('0x1a'),_0x5bc814['app']+'.js'))){var _0x39f47e=[];switch(_0x5bc814['app']['toLowerCase']()){case _0x1b4c('0x1e'):var _0x194dfa=_0x5bc814[_0x1b4c('0x1f')][_0x1b4c('0x20')](',');if(_0x754134[_0x1b4c('0x16')]===_0x1b4c('0x21')){_0x39f47e[_0x1b4c('0x22')](_0x194dfa[0x0]);_0x39f47e['push'](_0x194dfa[0x1]);_0x39f47e['push'](_0x194dfa[_0x1b4c('0x23')](0x2,_0x194dfa[_0x1b4c('0x1b')])[_0x1b4c('0x1d')](','));}else{_0x39f47e[_0x1b4c('0x22')](_0x194dfa[0x0]);_0x39f47e[_0x1b4c('0x22')](_0x194dfa['slice'](0x1,_0x194dfa[_0x1b4c('0x1b')])['join'](','));}break;case _0x1b4c('0x24'):var _0x4a3c4a=_0x5bc814[_0x1b4c('0x1f')][_0x1b4c('0x20')](',');_0x39f47e[_0x1b4c('0x22')](_0x4a3c4a[0x0]);_0x39f47e['push'](_0x4a3c4a[0x1]);_0x39f47e[_0x1b4c('0x22')](_0x4a3c4a['slice'](0x2,_0x4a3c4a[_0x1b4c('0x1b')])['join'](','));break;case _0x1b4c('0x25'):var _0x55f614=_0x5bc814[_0x1b4c('0x1f')][_0x1b4c('0x20')](',');_0x39f47e['push'](_0x55f614[0x0]);_0x39f47e[_0x1b4c('0x22')](_0x55f614[0x1]);_0x39f47e[_0x1b4c('0x22')](_0x55f614[0x2]);_0x39f47e[_0x1b4c('0x22')](_0x55f614[0x3]);_0x39f47e[_0x1b4c('0x22')](_0x55f614['slice'](0x4,_0x55f614['length'])['join'](','));break;case'amazonlex':var _0x5693e4=_0x5bc814[_0x1b4c('0x1f')]['split'](',');_0x39f47e[_0x1b4c('0x22')](_0x5693e4[0x0]);_0x39f47e['push'](_0x5693e4[0x1]);_0x39f47e[_0x1b4c('0x22')](_0x5693e4[0x2]);_0x39f47e['push'](_0x5693e4[0x3]);_0x39f47e['push'](_0x5693e4[_0x1b4c('0x23')](0x4,_0x5693e4[_0x1b4c('0x1b')])[_0x1b4c('0x1d')](','));break;case _0x1b4c('0x17'):_0x39f47e[_0x1b4c('0x22')](_0x5bc814[_0x1b4c('0x1f')]);break;case'tag':_0x39f47e['push'](_0x5bc814[_0x1b4c('0x26')]);_0x39f47e[_0x1b4c('0x22')](_0x5bc814[_0x1b4c('0x1f')]);break;case _0x1b4c('0x27'):var _0x5ebdbf=utils['getMustacheRender'](_0x754134[_0x1b4c('0x28')][_0x1b4c('0x29')],_0x754134);var _0x2553ce=_0x5bc814['appdata']['split'](',');_0x39f47e[_0x1b4c('0x22')](_0x2553ce[0x0]);_0x39f47e[_0x1b4c('0x22')](_0x2553ce[0x1]);_0x39f47e[_0x1b4c('0x22')](_0x2553ce[0x2]);_0x39f47e[_0x1b4c('0x22')](_0x2553ce[0x3]);_0x39f47e['push'](_0x2553ce[0x4]);_0x39f47e[_0x1b4c('0x22')](_0x2553ce[0x5]);_0x39f47e[_0x1b4c('0x22')](_0x2553ce[0x6]);_0x39f47e[_0x1b4c('0x22')](_0x2553ce[0x7]);_0x39f47e[_0x1b4c('0x22')](_0x2553ce[0x8]);_0x39f47e['push'](_0x2553ce[0x9]);_0x39f47e[_0x1b4c('0x22')](_0x2553ce[0xa]);_0x39f47e['push'](_0x754134[_0x1b4c('0x18')]['id']);_0x39f47e['push'](_0x754134[_0x1b4c('0x17')]['id']);_0x39f47e[_0x1b4c('0x22')](_0x5bc814[_0x1b4c('0x2a')]);_0x39f47e[_0x1b4c('0x22')](_0x754134[_0x1b4c('0x18')]['ContactId']);_0x39f47e[_0x1b4c('0x22')](_0x754134[_0x1b4c('0x2b')][_0x1b4c('0x2b')]);_0x39f47e['push'](_0x5ebdbf);break;default:_0x39f47e=_[_0x1b4c('0xf')](_0x5bc814[_0x1b4c('0x1f')])?[]:_0x5bc814[_0x1b4c('0x1f')][_0x1b4c('0x20')](',');}var _0x5dd8ef={'id':util[_0x1b4c('0xd')](_0x1b4c('0x2c'),_0x2ff603,_0x5bc814['id'],_0x5bc814['app']),'condition':require(_0x1b4c('0x2d'))[_0x1b4c('0x2e')](_0x2ff603,getIntervals(_0x51fb93[_0x1b4c('0x2f')],_0x5bc814),_0x51fb93),'consequence':require(_0x1b4c('0x30')+_0x5bc814[_0x1b4c('0x31')])[_0x1b4c('0x32')](_0x2ff603,_0x39f47e,_0x51fb93,_0x754134),'p':_0x5bc814[_0x1b4c('0x33')]||0x0};logger['info']('Push\x20new\x20rule',_0x5dd8ef['id'],'on\x20interval',getIntervals(_0x51fb93[_0x1b4c('0x2f')],_0x5bc814)[_0x1b4c('0x1d')](_0x1b4c('0x34')));_0x1a3922[_0x1b4c('0x22')](_0x5dd8ef);}else{logger[_0x1b4c('0x35')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,'applications',_0x5bc814['app']+_0x1b4c('0x36')));}}_0x51fb93[_0x1b4c('0x15')][_0x2ff603]=new RuleEngine(_0x1a3922);_0x51fb93[_0x1b4c('0x15')][_0x2ff603][_0x1b4c('0x37')](_0x754134,function(_0x36abbb){logger[_0x1b4c('0x38')](_0x1b4c('0x39'),JSON[_0x1b4c('0x3a')](_0x36abbb[_0x1b4c('0x3b')]));if(_0x51fb93['rules'][_0x2ff603]){_0x51fb93[_0x1b4c('0x15')][_0x2ff603]['emit'](_0x1b4c('0x3c'));}});return _0x4dd9f3({'code':0xc8,'message':_0x754134});}else{if(_0x5d13f8){logger[_0x1b4c('0x38')](util[_0x1b4c('0xd')](_0x1b4c('0x3d'),_0x2ff603));}else{logger['info'](_0x1b4c('0x3e'));}return _0x4dd9f3({'code':0xc8,'message':_0x754134});}}catch(_0x1e6591){logger['error'](_0x1e6591[_0x1b4c('0x3f')]);return _0x4a4dac(_0xe5e34b[_0x1b4c('0x35')](0x1f4,_0x1e6591));}}return _0x4a4dac(_0x1b4c('0x40'));});},'AcceptMessage':function(_0x1adac9){var _0x2d1b90=this;return new Promise(function(_0x4cab8a,_0x16d599){if(_0x1adac9[_0x1b4c('0x41')]&&_0x1adac9[_0x1b4c('0x41')]['id']){if(_0x51fb93['agents'][_0x1adac9[_0x1b4c('0x41')]['id']]){_0x51fb93['agents'][_0x1adac9[_0x1b4c('0x41')]['id']][_0x1b4c('0x42')]=![];_0x51fb93['agents'][_0x1adac9[_0x1b4c('0x41')]['id']][_0x1b4c('0x43')]=undefined;}}if(_0x1adac9['message']&&_0x1adac9[_0x1b4c('0x17')]['id']){try{var _0x22e5fb=getId(_0x1adac9['channel'],_0x1adac9[_0x1b4c('0x17')]?_0x1adac9[_0x1b4c('0x17')]['id']:0x0,_0x1adac9['interaction']?_0x1adac9[_0x1b4c('0x18')]['id']:0x0);if(_0x51fb93[_0x1b4c('0x15')][_0x22e5fb]){_0x51fb93[_0x1b4c('0x15')][_0x22e5fb][_0x1b4c('0x44')](_0x1b4c('0x45'));if(rpc[_0x1adac9[_0x1b4c('0x16')]+'QueueReport']){rpc[_0x1adac9[_0x1b4c('0x16')]+_0x1b4c('0x46')][_0x1b4c('0x47')](_0x22e5fb,{'UserId':_0x1adac9['message'][_0x1b4c('0x48')]})[_0x1b4c('0x49')](function(){logger[_0x1b4c('0x35')](_0x1b4c('0x4a'));});}}return _0x4cab8a({'code':0xc8,'message':_0x1adac9});}catch(_0x534929){logger[_0x1b4c('0x35')](_0x534929[_0x1b4c('0x3f')]);return _0x16d599(_0x2d1b90[_0x1b4c('0x35')](0x1f4,_0x534929));}}logger[_0x1b4c('0x35')](_0x1b4c('0x4b'));return _0x16d599(_0x2d1b90['error'](0x1f4,_0x1b4c('0x4b')));});},'RejectMessage':function(_0x2b7736){var _0x1be00e=this;return new Promise(function(_0x1c7cb6,_0x1c0834){if(_0x2b7736['agent']&&_0x2b7736[_0x1b4c('0x41')]['id']){try{if(_0x51fb93[_0x1b4c('0x4c')][_0x2b7736['agent']['id']]){_0x51fb93[_0x1b4c('0x4c')][_0x2b7736['agent']['id']]['busy']=![];_0x51fb93[_0x1b4c('0x4c')][_0x2b7736[_0x1b4c('0x41')]['id']][_0x1b4c('0x43')]=undefined;}return _0x1c7cb6({'code':0xc8,'message':_0x2b7736});}catch(_0x57ec01){logger[_0x1b4c('0x35')](_0x57ec01['stack']);return _0x1c0834(_0x1be00e['error'](0x1f4,_0x57ec01));}}logger[_0x1b4c('0x35')](_0x1b4c('0x4b'));return _0x1c0834(_0x1be00e[_0x1b4c('0x35')](0x1f4,_0x1b4c('0x4b')));});},'AbandonInteraction':function(_0x28479d){var _0x538f24=this;return new Promise(function(_0x2e11e5,_0x1ac49c){if(_0x28479d[_0x1b4c('0x16')]&&_0x28479d[_0x1b4c('0x18')]&&_0x28479d[_0x1b4c('0x18')]['id']){try{var _0x541201=getId(_0x28479d[_0x1b4c('0x16')],_0x28479d[_0x1b4c('0x17')]?_0x28479d['message']['id']:0x0,_0x28479d[_0x1b4c('0x18')]?_0x28479d[_0x1b4c('0x18')]['id']:0x0);if(_0x51fb93[_0x1b4c('0x15')][_0x541201]){_0x51fb93['rules'][_0x541201][_0x1b4c('0x44')](_0x1b4c('0x45'));}return _0x2e11e5({'code':0xc8,'message':_0x28479d});}catch(_0x47ea84){logger['error'](_0x47ea84[_0x1b4c('0x3f')]);return _0x1ac49c(_0x538f24[_0x1b4c('0x35')](0x1f4,_0x47ea84));}}logger[_0x1b4c('0x35')](_0x1b4c('0x4b'));return _0x1ac49c(_0x538f24[_0x1b4c('0x35')](0x1f4,_0x1b4c('0x4b')));});},'AgentCapacity':function(_0x32b5b1){var _0x142f35=this;return new Promise(function(_0x2e5d02,_0x1bd4e4){if(_0x51fb93[_0x1b4c('0x4c')][_0x1b4c('0x4d')](_0x32b5b1['id'])){for(var _0x239d8b in _0x32b5b1[_0x1b4c('0x4e')]){if(_0x32b5b1['capacity'][_0x1b4c('0x4d')](_0x239d8b)){if(_0x51fb93[_0x1b4c('0x4c')][_0x32b5b1['id']][_0x1b4c('0x4d')](_0x239d8b+_0x1b4c('0x4f'))){_0x51fb93[_0x1b4c('0x4c')][_0x32b5b1['id']][_0x239d8b+_0x1b4c('0x4f')]=parseInt(_0x32b5b1['capacity'][_0x239d8b],0xa);}}}_0x51fb93[_0x1b4c('0x4c')][_0x32b5b1['id']][_0x1b4c('0x50')]();return _0x2e5d02({'code':0xc8,'message':_0x51fb93[_0x1b4c('0x4c')][_0x32b5b1['id']]});}else{return _0x1bd4e4(_0x142f35[_0x1b4c('0x35')](0x1f4,_0x1b4c('0x51')));}});},'Agents':function(_0x1bf5b1){return new Promise(function(_0x330295){var _0x42431d=_[_0x1b4c('0x52')](_0x51fb93[_0x1b4c('0x4c')]);if(_0x1bf5b1&&_0x1bf5b1['id']){var _0x30353f=_['find'](_0x42431d,function(_0x3a7f1d){return _0x3a7f1d['id']===_0x1bf5b1['id'];});_0x330295(_0x30353f);}else{_0x330295({'count':_0x42431d[_0x1b4c('0x1b')],'rows':_0x42431d});}});},'ChatQueues':function(){return new Promise(function(_0x43c872){var _0x1c1eb5=[];for(var _0x2b6082 in _0x51fb93[_0x1b4c('0x53')]){if(_0x51fb93[_0x1b4c('0x53')]['hasOwnProperty'](_0x2b6082)){var _0x40af55=_0x51fb93[_0x1b4c('0x53')][_0x2b6082];var _0x11110f={'id':_0x40af55['id'],'available':_0x40af55[_0x1b4c('0x54')],'loggedIn':_0x40af55[_0x1b4c('0x55')],'name':_0x40af55[_0x1b4c('0x56')],'paused':_0x40af55[_0x1b4c('0x57')],'waiting':_0x40af55[_0x1b4c('0x58')]};_0x1c1eb5['push'](_0x11110f);}}_0x43c872({'count':_0x1c1eb5[_0x1b4c('0x1b')],'rows':_0x1c1eb5});});},'MailQueues':function(){return new Promise(function(_0x153932){var _0x1ec47c=[];for(var _0x17e6ac in _0x51fb93['mailQueues']){if(_0x51fb93['mailQueues'][_0x1b4c('0x4d')](_0x17e6ac)){var _0xb8ec9f=_0x51fb93['mailQueues'][_0x17e6ac];var _0x4eacb2={'id':_0xb8ec9f['id'],'available':_0xb8ec9f[_0x1b4c('0x54')],'loggedIn':_0xb8ec9f[_0x1b4c('0x55')],'name':_0xb8ec9f[_0x1b4c('0x56')],'paused':_0xb8ec9f[_0x1b4c('0x57')],'waiting':_0xb8ec9f[_0x1b4c('0x58')]};_0x1ec47c[_0x1b4c('0x22')](_0x4eacb2);}}_0x153932({'count':_0x1ec47c[_0x1b4c('0x1b')],'rows':_0x1ec47c});});},'OpenchannelQueues':function(){return new Promise(function(_0x101ae4){var _0x5b7e53=[];for(var _0xb2b818 in _0x51fb93['openchannelQueues']){if(_0x51fb93['openchannelQueues']['hasOwnProperty'](_0xb2b818)){var _0x47d976=_0x51fb93[_0x1b4c('0x59')][_0xb2b818];var _0x281066={'id':_0x47d976['id'],'available':_0x47d976[_0x1b4c('0x54')],'loggedIn':_0x47d976['loggedIn'],'name':_0x47d976[_0x1b4c('0x56')],'paused':_0x47d976[_0x1b4c('0x57')],'waiting':_0x47d976[_0x1b4c('0x58')]};_0x5b7e53[_0x1b4c('0x22')](_0x281066);}}_0x101ae4({'count':_0x5b7e53[_0x1b4c('0x1b')],'rows':_0x5b7e53});});},'SmsQueues':function(){return new Promise(function(_0x51bdf8){var _0x18c0cf=[];for(var _0x157d11 in _0x51fb93[_0x1b4c('0x5a')]){if(_0x51fb93[_0x1b4c('0x5a')][_0x1b4c('0x4d')](_0x157d11)){var _0x5cdf73=_0x51fb93[_0x1b4c('0x5a')][_0x157d11];var _0x16692d={'id':_0x5cdf73['id'],'available':_0x5cdf73[_0x1b4c('0x54')],'loggedIn':_0x5cdf73[_0x1b4c('0x55')],'name':_0x5cdf73[_0x1b4c('0x56')],'paused':_0x5cdf73[_0x1b4c('0x57')],'waiting':_0x5cdf73[_0x1b4c('0x58')]};_0x18c0cf[_0x1b4c('0x22')](_0x16692d);}}_0x51bdf8({'count':_0x18c0cf[_0x1b4c('0x1b')],'rows':_0x18c0cf});});},'FaxQueues':function(){return new Promise(function(_0x4d1583){var _0x2ac930=[];for(var _0x11486b in _0x51fb93[_0x1b4c('0x5b')]){if(_0x51fb93[_0x1b4c('0x5b')]['hasOwnProperty'](_0x11486b)){var _0x1515e4=_0x51fb93[_0x1b4c('0x5b')][_0x11486b];var _0x2958af={'id':_0x1515e4['id'],'available':_0x1515e4[_0x1b4c('0x54')],'loggedIn':_0x1515e4[_0x1b4c('0x55')],'name':_0x1515e4['name'],'paused':_0x1515e4[_0x1b4c('0x57')],'waiting':_0x1515e4[_0x1b4c('0x58')]};_0x2ac930[_0x1b4c('0x22')](_0x2958af);}}_0x4d1583({'count':_0x2ac930['length'],'rows':_0x2ac930});});},'WhatsappQueues':function(){return new Promise(function(_0x7169d){var _0x192a94=[];for(var _0x305632 in _0x51fb93[_0x1b4c('0x5c')]){if(_0x51fb93[_0x1b4c('0x5c')][_0x1b4c('0x4d')](_0x305632)){var _0x49e89a=_0x51fb93[_0x1b4c('0x5c')][_0x305632];var _0x230528={'id':_0x49e89a['id'],'available':_0x49e89a[_0x1b4c('0x54')],'loggedIn':_0x49e89a['loggedIn'],'name':_0x49e89a[_0x1b4c('0x56')],'paused':_0x49e89a[_0x1b4c('0x57')],'waiting':_0x49e89a[_0x1b4c('0x58')]};_0x192a94[_0x1b4c('0x22')](_0x230528);}}_0x7169d({'count':_0x192a94[_0x1b4c('0x1b')],'rows':_0x192a94});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x52be24){var _0x4f6ee3=_[_0x1b4c('0x52')](_0x51fb93[_0x1b4c('0x5d')]);_0x52be24({'count':_0x4f6ee3[_0x1b4c('0x1b')],'rows':_0x4f6ee3});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x15f6ef){var _0x5a3ed2=_[_0x1b4c('0x52')](_0x51fb93[_0x1b4c('0x5e')]);_0x15f6ef({'count':_0x5a3ed2['length'],'rows':_0x5a3ed2});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x217107){var _0x542f96=_['values'](_0x51fb93[_0x1b4c('0x5f')]);_0x217107({'count':_0x542f96[_0x1b4c('0x1b')],'rows':_0x542f96});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x2d4a8b){var _0x321af5=_[_0x1b4c('0x52')](_0x51fb93[_0x1b4c('0x60')]);_0x2d4a8b({'count':_0x321af5['length'],'rows':_0x321af5});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x2b1725){var _0x5bc3d1=_[_0x1b4c('0x52')](_0x51fb93['faxQueuesWaitingInteractions']);_0x2b1725({'count':_0x5bc3d1[_0x1b4c('0x1b')],'rows':_0x5bc3d1});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x547e18){var _0x3859f9=_[_0x1b4c('0x52')](_0x51fb93[_0x1b4c('0x61')]);_0x547e18({'count':_0x3859f9[_0x1b4c('0x1b')],'rows':_0x3859f9});});}};var _0x3ef448=jayson[_0x1b4c('0x62')](_0x243d51)[_0x1b4c('0x63')]();_0x3ef448['on'](_0x1b4c('0x35'),function(_0x10cffa){logger[_0x1b4c('0x35')](JSON[_0x1b4c('0x3a')](_0x10cffa));return _0x52c782(_0x10cffa);});_0x3ef448[_0x1b4c('0x14')](0x232c,_0x1b4c('0x64'),function(){console[_0x1b4c('0x65')](_0x1b4c('0x66'),0x232c);return _0x89c73b(_0x1b4c('0x67')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index cb25396..118fb37 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 _0x6f9b=['rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','indexOf','catch','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','stack','bluebird','lodash','routing','client','request','then','error','message','result','condition'];(function(_0x11a903,_0xba2aeb){var _0x447dbb=function(_0x2868f2){while(--_0x2868f2){_0x11a903['push'](_0x11a903['shift']());}};_0x447dbb(++_0xba2aeb);}(_0x6f9b,0x16f));var _0xb6f9=function(_0xdf66d4,_0x8cca53){_0xdf66d4=_0xdf66d4-0x0;var _0x499c6d=_0x6f9b[_0xdf66d4];return _0x499c6d;};'use strict';var util=require('util');var BPromise=require(_0xb6f9('0x0'));var jayson=require('jayson/promise');var _=require(_0xb6f9('0x1'));var logger=require('../../../config/logger')(_0xb6f9('0x2'));var client=jayson[_0xb6f9('0x3')]['http']({'port':0x232a});function request(_0x3b0a1b,_0x51139c){return new BPromise(function(_0x101ff8,_0x1468d3){return client[_0xb6f9('0x4')](_0x3b0a1b,_0x51139c)[_0xb6f9('0x5')](function(_0x4dbb48){if(_0x4dbb48[_0xb6f9('0x6')]){return _0x1468d3(_0x4dbb48[_0xb6f9('0x6')][_0xb6f9('0x7')]);}else{return _0x101ff8(_0x4dbb48[_0xb6f9('0x8')]);}})['catch'](function(_0x216931){return _0x1468d3(_0x216931);});});}exports[_0xb6f9('0x9')]=function(_0x4e652a,_0x135adf,_0x474f7f){return function(_0x2f0d42){if(_0x474f7f[_0xb6f9('0xa')]&&!_0x474f7f['rules'][_0x4e652a]){logger[_0xb6f9('0xb')](_0xb6f9('0xc'),_0x4e652a);return _0x2f0d42[_0xb6f9('0xd')]();}var _0x5154c9=[];for(var _0x104788=0x0;_0x104788<_0x135adf[_0xb6f9('0xe')];_0x104788+=0x1){_0x5154c9[_0xb6f9('0xf')](request(_0xb6f9('0x10'),{'command':util[_0xb6f9('0x11')](_0xb6f9('0x12'),_0x135adf[_0x104788])})[_0xb6f9('0x5')](function(_0x207656){return _0x207656&&_0x207656[_0xb6f9('0x7')]&&_0x207656[_0xb6f9('0x7')][_0xb6f9('0x13')]('true')>=0x0?!![]:![];})[_0xb6f9('0x14')](function(_0x1b0d87){logger[_0xb6f9('0x6')](_0xb6f9('0x15'),_0x4e652a,_0x135adf[_0x104788]);}));}BPromise[_0xb6f9('0x16')](_0x5154c9)[_0xb6f9('0x5')](function(_0x3a0cf0){var _0x350bed=_['some'](_0x3a0cf0);logger[_0xb6f9('0xb')](_0xb6f9('0x17'),_0x4e652a,_0x135adf[_0xb6f9('0x18')]('\x20|\x20'),_0x350bed);_0x2f0d42[_0xb6f9('0x19')](_0x350bed);})[_0xb6f9('0x14')](function(_0x5a4779){console[_0xb6f9('0x1a')](_0x5a4779);logger[_0xb6f9('0x6')](_0xb6f9('0x17'),_0x4e652a,_0x135adf[_0xb6f9('0x18')](_0xb6f9('0x1b')),_0x5a4779[_0xb6f9('0x1c')]);_0x2f0d42[_0xb6f9('0xd')]();});};}; \ No newline at end of file +var _0xeb5a=['bluebird','jayson/promise','lodash','routing','client','http','request','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','iftime\x20%s','indexOf','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','stack','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb5a,0x1bf));var _0xaeb5=function(_0x4176cc,_0x35766d){_0x4176cc=_0x4176cc-0x0;var _0x4e5532=_0xeb5a[_0x4176cc];return _0x4e5532;};'use strict';var util=require(_0xaeb5('0x0'));var BPromise=require(_0xaeb5('0x1'));var jayson=require(_0xaeb5('0x2'));var _=require(_0xaeb5('0x3'));var logger=require('../../../config/logger')(_0xaeb5('0x4'));var client=jayson[_0xaeb5('0x5')][_0xaeb5('0x6')]({'port':0x232a});function request(_0x30a632,_0x3827ab){return new BPromise(function(_0x54a5c9,_0xf60152){return client[_0xaeb5('0x7')](_0x30a632,_0x3827ab)[_0xaeb5('0x8')](function(_0x4d36ad){if(_0x4d36ad[_0xaeb5('0x9')]){return _0xf60152(_0x4d36ad[_0xaeb5('0x9')][_0xaeb5('0xa')]);}else{return _0x54a5c9(_0x4d36ad[_0xaeb5('0xb')]);}})[_0xaeb5('0xc')](function(_0x6eef57){return _0xf60152(_0x6eef57);});});}exports[_0xaeb5('0xd')]=function(_0x4078cd,_0x165145,_0xd13b11){return function(_0x2bd060){if(_0xd13b11[_0xaeb5('0xe')]&&!_0xd13b11[_0xaeb5('0xe')][_0x4078cd]){logger[_0xaeb5('0xf')](_0xaeb5('0x10'),_0x4078cd);return _0x2bd060[_0xaeb5('0x11')]();}var _0x357a50=[];for(var _0x240055=0x0;_0x240055<_0x165145[_0xaeb5('0x12')];_0x240055+=0x1){_0x357a50[_0xaeb5('0x13')](request('Command',{'command':util['format'](_0xaeb5('0x14'),_0x165145[_0x240055])})[_0xaeb5('0x8')](function(_0x18f5c4){return _0x18f5c4&&_0x18f5c4['message']&&_0x18f5c4[_0xaeb5('0xa')][_0xaeb5('0x15')]('true')>=0x0?!![]:![];})[_0xaeb5('0xc')](function(_0x13a085){logger[_0xaeb5('0x9')](_0xaeb5('0x16'),_0x4078cd,_0x165145[_0x240055]);}));}BPromise[_0xaeb5('0x17')](_0x357a50)[_0xaeb5('0x8')](function(_0x522e53){var _0x1170a8=_['some'](_0x522e53);logger['info'](_0xaeb5('0x18'),_0x4078cd,_0x165145['join']('\x20|\x20'),_0x1170a8);_0x2bd060['when'](_0x1170a8);})[_0xaeb5('0xc')](function(_0x5eb4f5){console['log'](_0x5eb4f5);logger['error'](_0xaeb5('0x18'),_0x4078cd,_0x165145[_0xaeb5('0x19')](_0xaeb5('0x1a')),_0x5eb4f5[_0xaeb5('0x1b')]);_0x2bd060[_0xaeb5('0x11')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index cb55c8a..60162e8 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 _0xd64b=['[%s][agents][attendedtransfer]','origtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','complete','lodash','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','calleridnum','connectedlinenum','lastevent','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acwtime','acwTimeout','request','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','reason','timeout','ringtime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','connect','talktime','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','diffTime','agentcompleteAt','agentconnectAt','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten'];(function(_0x551ac3,_0x90ddc5){var _0x4fe50b=function(_0x36dae2){while(--_0x36dae2){_0x551ac3['push'](_0x551ac3['shift']());}};_0x4fe50b(++_0x90ddc5);}(_0xd64b,0xc1));var _0xbd64=function(_0x3fa4bd,_0x14a72d){_0x3fa4bd=_0x3fa4bd-0x0;var _0x358c95=_0xd64b[_0x3fa4bd];return _0x358c95;};'use strict';var _=require(_0xbd64('0x0'));var util=require('util');var utils=require(_0xbd64('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x4bfb7c,_0x30b9b3){utils[_0xbd64('0x2')](util[_0xbd64('0x3')](_0xbd64('0x4'),_0x4bfb7c[_0xbd64('0x5')],_0x4bfb7c['channel'],_0x4bfb7c['queue'],_0x4bfb7c['membername'],_0x4bfb7c['interface'],_0x4bfb7c[_0xbd64('0x6')],_0x4bfb7c[_0xbd64('0x7')],_0x4bfb7c[_0xbd64('0x8')]));if(_0x4bfb7c[_0xbd64('0x9')]){utils[_0xbd64('0xa')](_0x4bfb7c[_0xbd64('0x9')])[_0xbd64('0xb')](function(_0x5d32b8){if(_0x5d32b8){_0x4bfb7c['type']=_0x5d32b8[_0xbd64('0xc')];_0x4bfb7c[_0xbd64('0xd')]=_0x4bfb7c[_0xbd64('0xe')]?_0x5d32b8['acw']:![];_0x4bfb7c[_0xbd64('0xf')]=_0x4bfb7c[_0xbd64('0xd')]?_0x5d32b8[_0xbd64('0x10')]:0x0;}utils[_0xbd64('0x11')]('CreateVoiceAgentReport',_0x4bfb7c);});}else{utils[_0xbd64('0x11')]('CreateVoiceAgentReport',_0x4bfb7c);}if(_0x30b9b3){delete transfers[_0x4bfb7c[_0xbd64('0x5')]];}else{delete agents[_0x4bfb7c[_0xbd64('0x12')]];}}exports[_0xbd64('0x13')]=function(_0x2183e2){try{utils[_0xbd64('0x14')](util[_0xbd64('0x3')](_0xbd64('0x15'),_0x2183e2[_0xbd64('0x5')]),_0x2183e2);agents[_0x2183e2[_0xbd64('0x12')]]=_0x2183e2;agents[_0x2183e2['destuniqueid']][_0xbd64('0x16')]=utils[_0xbd64('0x17')]();agents[_0x2183e2[_0xbd64('0x12')]][_0xbd64('0x8')]=_0xbd64('0x18');agents[_0x2183e2['destuniqueid']][_0xbd64('0x7')]=null;agents[_0x2183e2['destuniqueid']][_0xbd64('0x19')]=null;utils[_0xbd64('0x2')](util[_0xbd64('0x3')](_0xbd64('0x1a'),_0x2183e2[_0xbd64('0x5')],agents[_0x2183e2[_0xbd64('0x12')]][_0xbd64('0x1b')],_0x2183e2[_0xbd64('0x12')]));}catch(_0x5d3b00){utils[_0xbd64('0x1c')](util[_0xbd64('0x3')]('[%s][agents][agentcalled]',_0x2183e2['uniqueid']),_0x5d3b00);}};exports[_0xbd64('0x1d')]=function(_0x42b328){try{if(!_[_0xbd64('0x1e')](agents[_0x42b328[_0xbd64('0x12')]])){utils[_0xbd64('0x14')](util[_0xbd64('0x3')]('[%s][agents][agentringnoanswer]',_0x42b328['uniqueid']),_0x42b328);utils[_0xbd64('0x2')](util[_0xbd64('0x3')](_0xbd64('0x1f'),_0x42b328[_0xbd64('0x5')],agents[_0x42b328['destuniqueid']]['membername'],_0x42b328[_0xbd64('0x12')]));agents[_0x42b328['destuniqueid']][_0xbd64('0x1d')]=!![];agents[_0x42b328['destuniqueid']][_0xbd64('0x20')]=utils[_0xbd64('0x17')]();agents[_0x42b328[_0xbd64('0x12')]][_0xbd64('0x8')]='timeout';agents[_0x42b328[_0xbd64('0x12')]][_0xbd64('0x21')]=_0xbd64('0x22');agents[_0x42b328[_0xbd64('0x12')]]['holdtime']=_0x42b328['ringtime']?parseInt(_0x42b328[_0xbd64('0x23')])/0x3e8:0x0;agents[_0x42b328['destuniqueid']]['talktime']=0x0;unanswered[_0xbd64('0x24')](_0x42b328['destuniqueid']);}}catch(_0x3cf5b7){utils['error'](util[_0xbd64('0x3')]('[%s][agents][agentringnoanswer]',_0x42b328[_0xbd64('0x5')]),_0x3cf5b7);}};exports[_0xbd64('0x25')]=function(_0x3be63a){try{_[_0xbd64('0x26')](agents,function(_0x306f19,_0x207ffc){if(_0x306f19['uniqueid']==_0x3be63a[_0xbd64('0x5')]&&!_[_0xbd64('0x27')](unanswered,_0x306f19[_0xbd64('0x12')])){utils[_0xbd64('0x14')](util[_0xbd64('0x3')](_0xbd64('0x28'),_0x3be63a['uniqueid']),_0x3be63a);utils['info'](util[_0xbd64('0x3')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x3be63a[_0xbd64('0x5')],_0x306f19[_0xbd64('0x1b')],_0x306f19['destuniqueid']));_0x306f19['agentringnoanswer']=!![];_0x306f19[_0xbd64('0x20')]=utils['now']();_0x306f19['lastevent']=_0xbd64('0x29');_0x306f19[_0xbd64('0x21')]=_0xbd64('0x29');_0x306f19['holdtime']=_0x3be63a[_0xbd64('0x2a')];_0x306f19['talktime']=0x0;writeDB(_0x306f19);}});}catch(_0x1fc9cf){utils[_0xbd64('0x1c')](util[_0xbd64('0x3')](_0xbd64('0x28'),_0x3be63a[_0xbd64('0x5')]),_0x1fc9cf);}};exports[_0xbd64('0x2b')]=function(_0x513339){try{if(agents[_0x513339['destuniqueid']]){utils[_0xbd64('0x14')](util[_0xbd64('0x3')](_0xbd64('0x2c'),_0x513339[_0xbd64('0x5')]),_0x513339);utils[_0xbd64('0x2')](util[_0xbd64('0x3')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x513339['uniqueid'],agents[_0x513339[_0xbd64('0x12')]][_0xbd64('0x1b')],_0x513339[_0xbd64('0x12')]));agents[_0x513339['destuniqueid']]['agentconnectAt']=utils[_0xbd64('0x17')]();agents[_0x513339['destuniqueid']][_0xbd64('0x7')]=_0x513339['connectedlinenum'];agents[_0x513339[_0xbd64('0x12')]][_0xbd64('0x19')]=_0x513339['connectedlinename'];agents[_0x513339[_0xbd64('0x12')]]['holdtime']=_0x513339['ringtime'];agents[_0x513339[_0xbd64('0x12')]][_0xbd64('0x8')]=_0xbd64('0x2d');_['forIn'](agents,function(_0x540e2a,_0x5d6bcf){if(_0x540e2a[_0xbd64('0x12')]!=_0x513339[_0xbd64('0x12')]&&_0x540e2a['uniqueid']==_0x513339[_0xbd64('0x5')]){_0x540e2a[_0xbd64('0x2e')]=0x0;_0x540e2a[_0xbd64('0x2a')]=_0x513339[_0xbd64('0x23')];_0x540e2a['agentringnoanswer']=!![];_0x540e2a['agentringnoanswerAt']=utils[_0xbd64('0x17')]();_0x540e2a['lastevent']='answered_elsewhere';_0x540e2a[_0xbd64('0x21')]=_0xbd64('0x2f');_0x540e2a[_0xbd64('0x30')]=_0x513339[_0xbd64('0x12')];_0x540e2a[_0xbd64('0x31')]=_0x513339[_0xbd64('0x1b')];writeDB(_0x540e2a);}});}}catch(_0x247775){utils[_0xbd64('0x1c')](util['format'](_0xbd64('0x2c'),_0x513339[_0xbd64('0x5')]),_0x247775);}};exports['agentcomplete']=function(_0x41b27a){try{if(!_[_0xbd64('0x1e')](agents[_0x41b27a[_0xbd64('0x12')]])){utils[_0xbd64('0x14')](util[_0xbd64('0x3')](_0xbd64('0x32'),_0x41b27a[_0xbd64('0x5')]),_0x41b27a);utils['info'](util[_0xbd64('0x3')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x41b27a[_0xbd64('0x5')],agents[_0x41b27a['destuniqueid']][_0xbd64('0x1b')],_0x41b27a[_0xbd64('0x12')]));agents[_0x41b27a[_0xbd64('0x12')]]['agentcomplete']=!![];agents[_0x41b27a[_0xbd64('0x12')]]['agentcompleteAt']=utils['now']();agents[_0x41b27a['destuniqueid']][_0xbd64('0x2e')]=utils[_0xbd64('0x33')](agents[_0x41b27a[_0xbd64('0x12')]][_0xbd64('0x34')],agents[_0x41b27a[_0xbd64('0x12')]][_0xbd64('0x35')]);agents[_0x41b27a[_0xbd64('0x12')]]['reason']=_0x41b27a[_0xbd64('0x21')];agents[_0x41b27a[_0xbd64('0x12')]][_0xbd64('0x8')]='complete';writeDB(agents[_0x41b27a[_0xbd64('0x12')]]);}}catch(_0x436f36){utils[_0xbd64('0x1c')](util[_0xbd64('0x3')](_0xbd64('0x32'),_0x41b27a['uniqueid']),_0x436f36);}};exports[_0xbd64('0x36')]=function(_0x1a9ec8){try{if(!_[_0xbd64('0x1e')](agents[_0x1a9ec8[_0xbd64('0x37')]])){utils['debug'](util['format'](_0xbd64('0x38'),_0x1a9ec8[_0xbd64('0x5')]),_0x1a9ec8);utils[_0xbd64('0x2')](util[_0xbd64('0x3')](_0xbd64('0x39'),_0x1a9ec8[_0xbd64('0x5')],agents[_0x1a9ec8[_0xbd64('0x37')]][_0xbd64('0x1b')],agents[_0x1a9ec8[_0xbd64('0x37')]][_0xbd64('0x5')]));agents[_0x1a9ec8[_0xbd64('0x37')]][_0xbd64('0x3a')]=!![];agents[_0x1a9ec8[_0xbd64('0x37')]][_0xbd64('0x3b')]=_0xbd64('0x3c');agents[_0x1a9ec8['transfereruniqueid']][_0xbd64('0x3d')]=_0x1a9ec8['extension'];agents[_0x1a9ec8['transfereruniqueid']]['transferuniqueid']=agents[_0x1a9ec8['transfereruniqueid']][_0xbd64('0x5')];}}catch(_0x2f56df){utils['error'](util[_0xbd64('0x3')](_0xbd64('0x38'),_0x1a9ec8[_0xbd64('0x5')]),_0x2f56df);}};exports['attendedtransfer']=function(_0x2c42fd){try{utils[_0xbd64('0x14')](util[_0xbd64('0x3')](_0xbd64('0x3e'),_0x2c42fd[_0xbd64('0x3f')]),_0x2c42fd);if(_0x2c42fd[_0xbd64('0x3f')]==_0x2c42fd['origtransfererlinkedid']){if(!_['isNil'](agents[_0x2c42fd['secondtransfereruniqueid']])){utils[_0xbd64('0x2')](util[_0xbd64('0x3')](_0xbd64('0x40'),_0x2c42fd[_0xbd64('0x3f')],agents[_0x2c42fd['secondtransfereruniqueid']][_0xbd64('0x1b')]));agents[_0x2c42fd[_0xbd64('0x41')]][_0xbd64('0x3a')]=!![];agents[_0x2c42fd[_0xbd64('0x41')]][_0xbd64('0x3b')]=_0xbd64('0x42');agents[_0x2c42fd['secondtransfereruniqueid']][_0xbd64('0x3d')]=_0x2c42fd[_0xbd64('0x43')];agents[_0x2c42fd[_0xbd64('0x41')]][_0xbd64('0x44')]=_0x2c42fd[_0xbd64('0x3f')];}if(_0x2c42fd[_0xbd64('0x45')]&&agents[_0x2c42fd[_0xbd64('0x45')]]){agents[_0x2c42fd[_0xbd64('0x45')]][_0xbd64('0x46')]=0x1;transfers[_0x2c42fd[_0xbd64('0x45')]]=_[_0xbd64('0x47')](agents[_0x2c42fd[_0xbd64('0x45')]]);transfers[_0x2c42fd['transfereeuniqueid']]['calleridnum']=agents[_0x2c42fd[_0xbd64('0x41')]][_0xbd64('0x6')];transfers[_0x2c42fd['transfereeuniqueid']]['calleridname']=agents[_0x2c42fd[_0xbd64('0x41')]][_0xbd64('0x48')];transfers[_0x2c42fd['transfereeuniqueid']][_0xbd64('0x16')]=utils[_0xbd64('0x17')]();transfers[_0x2c42fd[_0xbd64('0x45')]][_0xbd64('0x35')]=utils[_0xbd64('0x17')]();transfers[_0x2c42fd[_0xbd64('0x45')]][_0xbd64('0x2a')]=0x0;transfers[_0x2c42fd[_0xbd64('0x45')]][_0xbd64('0x46')]=0x2;}}else if(_0x2c42fd['secondtransfereruniqueid']==_0x2c42fd[_0xbd64('0x49')]){if(!_[_0xbd64('0x1e')](agents[_0x2c42fd[_0xbd64('0x3f')]])){utils['info'](util[_0xbd64('0x3')](_0xbd64('0x40'),_0x2c42fd['origtransfereruniqueid'],agents[_0x2c42fd[_0xbd64('0x3f')]][_0xbd64('0x1b')]));agents[_0x2c42fd[_0xbd64('0x3f')]][_0xbd64('0x3a')]=!![];agents[_0x2c42fd[_0xbd64('0x3f')]][_0xbd64('0x3b')]='ATTENDED';agents[_0x2c42fd[_0xbd64('0x3f')]][_0xbd64('0x3d')]=_0x2c42fd[_0xbd64('0x4a')];agents[_0x2c42fd[_0xbd64('0x3f')]]['transferuniqueid']=_0x2c42fd[_0xbd64('0x41')];}if(_0x2c42fd[_0xbd64('0x4b')]&&agents[_0x2c42fd['transfertargetuniqueid']]){agents[_0x2c42fd[_0xbd64('0x4b')]]['agententerreason']=0x1;transfers[_0x2c42fd[_0xbd64('0x4b')]]=_[_0xbd64('0x47')](agents[_0x2c42fd[_0xbd64('0x4b')]]);transfers[_0x2c42fd[_0xbd64('0x4b')]]['calleridnum']=agents[_0x2c42fd[_0xbd64('0x3f')]][_0xbd64('0x6')];transfers[_0x2c42fd[_0xbd64('0x4b')]][_0xbd64('0x48')]=agents[_0x2c42fd[_0xbd64('0x3f')]][_0xbd64('0x48')];transfers[_0x2c42fd['transfertargetuniqueid']]['agentcalledAt']=utils['now']();transfers[_0x2c42fd[_0xbd64('0x4b')]][_0xbd64('0x35')]=utils[_0xbd64('0x17')]();transfers[_0x2c42fd[_0xbd64('0x4b')]][_0xbd64('0x2a')]=0x0;transfers[_0x2c42fd[_0xbd64('0x4b')]]['agententerreason']=0x2;}}}catch(_0x30eddc){utils[_0xbd64('0x1c')](util[_0xbd64('0x3')](_0xbd64('0x3e'),_0x2c42fd[_0xbd64('0x3f')]),_0x30eddc);}};exports[_0xbd64('0x4c')]=function(_0x2f3516){try{utils[_0xbd64('0x14')](util[_0xbd64('0x3')](_0xbd64('0x4d'),_0x2f3516[_0xbd64('0x5')]),_0x2f3516);if(agents[_0x2f3516[_0xbd64('0x5')]]&&agents[_0x2f3516['uniqueid']]['reason']===_0xbd64('0x22')){if(_0x2f3516[_0xbd64('0x4e')]==='21'){agents[_0x2f3516[_0xbd64('0x5')]]['reason']=_0xbd64('0x4f');agents[_0x2f3516['uniqueid']][_0xbd64('0x8')]=_0xbd64('0x4f');}utils[_0xbd64('0x2')](util[_0xbd64('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x2f3516[_0xbd64('0x5')],agents[_0x2f3516['uniqueid']][_0xbd64('0x1b')],agents[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x21')],agents[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x8')]));writeDB(agents[_0x2f3516['uniqueid']]);var _0x43780f=unanswered[_0xbd64('0x50')](_0x2f3516['uniqueid']);if(_0x43780f>-0x1){unanswered[_0xbd64('0x51')](_0x43780f,0x1);}}if(transfers[_0x2f3516[_0xbd64('0x5')]]){transfers[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0xe')]=!![];transfers[_0x2f3516['uniqueid']][_0xbd64('0x34')]=utils['now']();transfers[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x2e')]=utils[_0xbd64('0x33')](transfers[_0x2f3516['uniqueid']]['agentcompleteAt'],transfers[_0x2f3516['uniqueid']]['agentconnectAt']);transfers[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x21')]=_0xbd64('0x52');transfers[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x8')]='complete';utils[_0xbd64('0x2')](util[_0xbd64('0x3')](_0xbd64('0x53'),_0x2f3516[_0xbd64('0x5')],transfers[_0x2f3516[_0xbd64('0x5')]]['membername'],transfers[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x21')],transfers[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x8')]));writeDB(transfers[_0x2f3516['uniqueid']],!![]);}if(agents[_0x2f3516['uniqueid']]&&agents[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x35')]){agents[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0xe')]=!![];agents[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x34')]=utils[_0xbd64('0x17')]();agents[_0x2f3516[_0xbd64('0x5')]]['talktime']=utils[_0xbd64('0x33')](agents[_0x2f3516['uniqueid']][_0xbd64('0x34')],agents[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x35')]);agents[_0x2f3516['uniqueid']][_0xbd64('0x21')]=agents[_0x2f3516['uniqueid']]['transfer']?_0xbd64('0x3a'):_0xbd64('0x52');agents[_0x2f3516[_0xbd64('0x5')]]['lastevent']=_0xbd64('0x54');utils[_0xbd64('0x2')](util[_0xbd64('0x3')](_0xbd64('0x53'),_0x2f3516['uniqueid'],agents[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x1b')],agents[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x21')],agents[_0x2f3516[_0xbd64('0x5')]][_0xbd64('0x8')]));writeDB(agents[_0x2f3516[_0xbd64('0x5')]]);}}catch(_0x439bbd){utils[_0xbd64('0x1c')](util[_0xbd64('0x3')](_0xbd64('0x4d'),_0x2f3516[_0xbd64('0x5')]),_0x439bbd);}}; \ 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(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x370088,_0x398682){_0x370088=_0x370088-0x0;var _0x19512b=_0x9ffd[_0x370088];return _0x19512b;};'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 4221b40..84d1230 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 _0x3457=['error','musiconholdstartAt','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','toLowerCase','cdr','split','substring','lastIndexOf','includes','noop','execif','NO\x20ANSWER','FAILED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','channel','queue','membername','calleridnum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','recording','newchannel','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','[%s][calls][newstate]','isNil','channelstate','systemanswertime','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','ANSWERED','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','diffTime','endtime','starttime','billableseconds','attendedtransfer','localtwolinkedid','debug','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','destinationchannel'];(function(_0x25acd3,_0xb73a00){var _0x5c037f=function(_0x333cfe){while(--_0x333cfe){_0x25acd3['push'](_0x25acd3['shift']());}};_0x5c037f(++_0xb73a00);}(_0x3457,0x93));var _0x7345=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3457[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var transfers=require('./transfers.controller');var dispositions=[_0x7345('0x0'),_0x7345('0x1'),_0x7345('0x1'),_0x7345('0x0'),_0x7345('0x0'),_0x7345('0x0'),'ANSWERED',_0x7345('0x2'),'FAILED','FAILED','FAILED'];var channels={};function writeDB(_0x1bd5c1){var _0x4385b3;if(transfers[_0x7345('0x3')][_0x1bd5c1[_0x7345('0x4')]]){_0x4385b3=_0x1bd5c1[_0x7345('0x4')];_0x1bd5c1[_0x7345('0x4')]=transfers['blinds'][_0x1bd5c1[_0x7345('0x4')]][_0x7345('0x5')];}utils[_0x7345('0x6')](util[_0x7345('0x7')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1bd5c1[_0x7345('0x4')],_0x1bd5c1[_0x7345('0x8')],_0x1bd5c1[_0x7345('0x9')],_0x1bd5c1[_0x7345('0xa')],_0x1bd5c1['interface'],_0x1bd5c1[_0x7345('0xb')],_0x1bd5c1['connectedlinenum'],_0x1bd5c1[_0x7345('0xc')]));if(_0x1bd5c1[_0x7345('0xd')]){utils[_0x7345('0xe')](_0x1bd5c1['accountcode'])[_0x7345('0xf')](function(_0x1257b5){if(_0x1257b5){_0x1bd5c1[_0x7345('0x10')]=_0x1257b5['id'];}utils[_0x7345('0x11')](_0x7345('0x12'),_0x1bd5c1);});}else{utils[_0x7345('0x11')]('CreateVoiceCallReport',_0x1bd5c1);}if(channels[_0x1bd5c1[_0x7345('0x4')]]){delete channels[_0x1bd5c1[_0x7345('0x4')]];}else if(_0x4385b3&&channels[_0x4385b3]){if(!transfers[_0x7345('0x3')][_0x4385b3][_0x7345('0x13')])delete transfers[_0x7345('0x3')][_0x4385b3];delete channels[_0x4385b3];}}exports[_0x7345('0x14')]=function(_0x778581){try{utils['debug'](util[_0x7345('0x7')](_0x7345('0x15'),_0x778581['uniqueid']),_0x778581);if(_0x778581[_0x7345('0x4')]==_0x778581['linkedid']&&_0x778581[_0x7345('0x8')]!=_0x7345('0x16')){utils[_0x7345('0x6')](util[_0x7345('0x7')](_0x7345('0x17'),_0x778581[_0x7345('0x4')],_0x778581['context'],_0x778581[_0x7345('0x18')]));channels[_0x778581[_0x7345('0x4')]]={'uniqueid':_0x778581[_0x7345('0x4')],'accountcode':_0x778581[_0x7345('0xd')],'source':_0x778581[_0x7345('0xb')],'destination':_0x778581['exten'],'destinationcontext':_0x778581[_0x7345('0x19')],'channel':_0x778581[_0x7345('0x8')],'starttime':utils[_0x7345('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x7345('0x0'),'amaflags':'DOCUMENTATION'};}}catch(_0x58e1b1){utils['error'](util[_0x7345('0x7')](_0x7345('0x15'),_0x778581[_0x7345('0x4')]),_0x58e1b1);}};exports['newstate']=function(_0x4eddb3){try{utils['debug'](util['format'](_0x7345('0x1b'),_0x4eddb3[_0x7345('0x4')]),_0x4eddb3);if(!_[_0x7345('0x1c')](channels[_0x4eddb3[_0x7345('0x4')]])&&_0x4eddb3[_0x7345('0x1d')]==0x6){utils['info'](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x4eddb3[_0x7345('0x4')],_0x4eddb3[_0x7345('0x19')],_0x4eddb3[_0x7345('0x8')]));if(_['isNil'](channels[_0x4eddb3[_0x7345('0x4')]][_0x7345('0x1e')])){channels[_0x4eddb3[_0x7345('0x4')]][_0x7345('0x1e')]=utils['now']();}}else if(!_[_0x7345('0x1c')](channels[_0x4eddb3[_0x7345('0x1f')]])&&_0x4eddb3[_0x7345('0x1d')]==0x6&&_0x4eddb3[_0x7345('0x19')]!=_0x7345('0x20')){utils[_0x7345('0x6')](util[_0x7345('0x7')](_0x7345('0x21'),_0x4eddb3[_0x7345('0x4')],_0x4eddb3[_0x7345('0x1f')],_0x4eddb3[_0x7345('0x19')],_0x4eddb3[_0x7345('0x8')]));channels[_0x4eddb3['linkedid']][_0x7345('0xd')]=_0x4eddb3[_0x7345('0xd')];channels[_0x4eddb3[_0x7345('0x1f')]]['destinationchannel']=_0x4eddb3[_0x7345('0x8')];if(_[_0x7345('0x1c')](channels[_0x4eddb3[_0x7345('0x1f')]][_0x7345('0x22')])){channels[_0x4eddb3[_0x7345('0x1f')]][_0x7345('0x22')]=utils[_0x7345('0x1a')]();}channels[_0x4eddb3['linkedid']][_0x7345('0x23')]=dispositions[_[_0x7345('0x24')](_0x4eddb3['channelstate'])]||_0x7345('0x25');}}catch(_0x7a5f29){utils['error'](util['format'](_0x7345('0x1b'),_0x4eddb3['uniqueid']),_0x7a5f29);}};exports[_0x7345('0x26')]=function(_0x16038f){try{if(!_[_0x7345('0x1c')](channels[_0x16038f[_0x7345('0x4')]])){utils['debug'](util[_0x7345('0x7')](_0x7345('0x27'),_0x16038f['uniqueid']),_0x16038f);if(_[_0x7345('0x1c')](channels[_0x16038f[_0x7345('0x4')]]['callerid'])){channels[_0x16038f['uniqueid']][_0x7345('0x28')]=_0x16038f[_0x7345('0x29')]+'\x20<'+_0x16038f[_0x7345('0xb')]+'>';}utils[_0x7345('0x6')](util[_0x7345('0x7')](_0x7345('0x2a'),_0x16038f['uniqueid'],channels[_0x16038f[_0x7345('0x4')]][_0x7345('0x28')],_0x16038f[_0x7345('0x2b')]));channels[_0x16038f[_0x7345('0x4')]]['endtime']=utils[_0x7345('0x1a')]();channels[_0x16038f[_0x7345('0x4')]]['duration']=utils[_0x7345('0x2c')](channels[_0x16038f[_0x7345('0x4')]][_0x7345('0x2d')],channels[_0x16038f[_0x7345('0x4')]][_0x7345('0x2e')]);channels[_0x16038f[_0x7345('0x4')]][_0x7345('0x2f')]=channels[_0x16038f[_0x7345('0x4')]]['answertime']?utils['diffTime'](channels[_0x16038f['uniqueid']][_0x7345('0x2d')],channels[_0x16038f[_0x7345('0x4')]][_0x7345('0x22')]):0x0;writeDB(channels[_0x16038f[_0x7345('0x4')]]);}}catch(_0xae10d){utils['error'](util[_0x7345('0x7')](_0x7345('0x27'),_0x16038f[_0x7345('0x4')]),_0xae10d);}};exports[_0x7345('0x30')]=function(_0x343dee){try{if(!_[_0x7345('0x1c')](channels[_0x343dee[_0x7345('0x31')]])){utils[_0x7345('0x32')](util[_0x7345('0x7')](_0x7345('0x33'),_0x343dee[_0x7345('0x34')]),_0x343dee);if(channels[_0x343dee['localtwolinkedid']]['channel']==_0x343dee[_0x7345('0x35')]){utils[_0x7345('0x6')](util[_0x7345('0x7')](_0x7345('0x36'),_0x343dee[_0x7345('0x34')],_0x343dee[_0x7345('0x31')],_0x343dee[_0x7345('0x37')]));channels[_0x343dee['localtwolinkedid']]['destinationchannel']=_0x343dee['secondtransfererchannel'];channels[_0x343dee[_0x7345('0x31')]][_0x7345('0x38')]=_0x7345('0x39');}else if(channels[_0x343dee[_0x7345('0x31')]]['channel']=_0x343dee[_0x7345('0x3a')]){utils[_0x7345('0x6')](util[_0x7345('0x7')](_0x7345('0x36'),_0x343dee['origtransfereruniqueid'],_0x343dee['localtwolinkedid'],_0x343dee[_0x7345('0x3b')]));channels[_0x343dee[_0x7345('0x31')]][_0x7345('0x3c')]=_0x343dee[_0x7345('0x3b')];channels[_0x343dee[_0x7345('0x31')]]['userfield']=_0x7345('0x39');}}}catch(_0x10f373){utils[_0x7345('0x3d')](util['format'](_0x7345('0x33'),_0x343dee['origtransfereruniqueid']),_0x10f373);}};exports['musiconholdstart']=function(_0x4eead1){try{if(!_[_0x7345('0x1c')](channels[_0x4eead1[_0x7345('0x4')]])){utils['debug'](util['format']('[%s][calls][musiconholdstart]',_0x4eead1['uniqueid']),_0x4eead1);channels[_0x4eead1[_0x7345('0x4')]][_0x7345('0x3e')]=utils[_0x7345('0x1a')]();utils[_0x7345('0x6')](util['format']('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x4eead1[_0x7345('0x4')],channels[_0x4eead1[_0x7345('0x4')]][_0x7345('0x3e')]));}}catch(_0x3bbed7){utils[_0x7345('0x3d')](util[_0x7345('0x7')](_0x7345('0x3f'),_0x4eead1[_0x7345('0x4')]),_0x3bbed7);}};exports[_0x7345('0x40')]=function(_0x5c2e85){try{if(!_[_0x7345('0x1c')](channels[_0x5c2e85[_0x7345('0x4')]])){utils[_0x7345('0x32')](util[_0x7345('0x7')](_0x7345('0x41'),_0x5c2e85[_0x7345('0x4')]),_0x5c2e85);if(!_[_0x7345('0x1c')](channels[_0x5c2e85[_0x7345('0x4')]]['musiconholdstartAt'])){channels[_0x5c2e85[_0x7345('0x4')]][_0x7345('0x42')]+=utils[_0x7345('0x2c')](utils['now'](),channels[_0x5c2e85['uniqueid']][_0x7345('0x3e')]);utils[_0x7345('0x6')](util[_0x7345('0x7')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x5c2e85[_0x7345('0x4')],channels[_0x5c2e85[_0x7345('0x4')]][_0x7345('0x42')]));delete channels[_0x5c2e85[_0x7345('0x4')]][_0x7345('0x3e')];}}}catch(_0x2bd3cc){utils[_0x7345('0x3d')](util['format'](_0x7345('0x41'),_0x5c2e85[_0x7345('0x4')]),_0x2bd3cc);}};exports['varset']=function(_0x295a36){try{if(!_[_0x7345('0x1c')](channels[_0x295a36[_0x7345('0x4')]])){utils[_0x7345('0x32')](util[_0x7345('0x7')](_0x7345('0x43'),_0x295a36['uniqueid']),_0x295a36);if(!_['isNil'](_0x295a36['variable'][_0x7345('0x44')])){utils[_0x7345('0x6')](util[_0x7345('0x7')](_0x7345('0x45'),_0x295a36[_0x7345('0x4')],_0x295a36['value']));channels[_0x295a36['uniqueid']][_0x7345('0x46')]=_0x295a36[_0x7345('0x47')];}if(!_[_0x7345('0x1c')](_0x295a36[_0x7345('0x48')][_0x7345('0x49')])){utils[_0x7345('0x6')](util[_0x7345('0x7')](_0x7345('0x4a'),_0x295a36[_0x7345('0x4')],_0x295a36[_0x7345('0x47')]));channels[_0x295a36['uniqueid']]['destination']=_0x295a36[_0x7345('0x47')];channels[_0x295a36['uniqueid']]['callerid']='\x22'+_0x295a36[_0x7345('0x47')]+_0x7345('0x4b')+_0x295a36['value']+'>';}if(!_[_0x7345('0x1c')](_0x295a36['variable'][_0x7345('0x4c')])||!_[_0x7345('0x1c')](_0x295a36[_0x7345('0x48')][_0x7345('0x4d')])){utils[_0x7345('0x6')](util[_0x7345('0x7')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x295a36[_0x7345('0x4')],!_[_0x7345('0x1c')](_0x295a36[_0x7345('0x48')][_0x7345('0x4c')])?'xmd-callerid-preview':_0x7345('0x4d'),_0x295a36[_0x7345('0x47')]));channels[_0x295a36[_0x7345('0x4')]][_0x7345('0x28')]=_0x295a36[_0x7345('0x47')];}if(!_['isNil'](_0x295a36[_0x7345('0x48')][_0x7345('0x4e')])||!_[_0x7345('0x1c')](_0x295a36[_0x7345('0x48')][_0x7345('0x4f')])){utils[_0x7345('0x6')](util['format'](_0x7345('0x50'),_0x295a36[_0x7345('0x4')],!_['isNil'](_0x295a36[_0x7345('0x48')][_0x7345('0x4e')])?_0x7345('0x4e'):_0x7345('0x4f'),_0x295a36['value']));channels[_0x295a36['uniqueid']][_0x7345('0x51')]=_0x7345('0x52');channels[_0x295a36['uniqueid']][_0x7345('0x53')]=_0x295a36['value'];channels[_0x295a36['uniqueid']]['queue']=!![];}if(!_['isNil'](_0x295a36[_0x7345('0x48')][_0x7345('0x54')])){utils[_0x7345('0x6')](util[_0x7345('0x7')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x295a36['uniqueid'],_0x295a36[_0x7345('0x47')]));channels[_0x295a36[_0x7345('0x4')]]['ContactId']=_0x295a36['value'];}if(!_[_0x7345('0x1c')](_0x295a36['variable']['xmd-cdrtype'])){utils[_0x7345('0x6')](util[_0x7345('0x7')](_0x7345('0x55'),_0x295a36[_0x7345('0x4')],_0x295a36[_0x7345('0x47')]));channels[_0x295a36['uniqueid']][_0x7345('0x56')]=_0x295a36[_0x7345('0x47')];}if(!_[_0x7345('0x1c')](_0x295a36[_0x7345('0x48')][_0x7345('0x57')])){utils[_0x7345('0x6')](util['format']('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x295a36['uniqueid'],_0x295a36['value']));channels[_0x295a36[_0x7345('0x4')]]['routeid']=_0x295a36[_0x7345('0x47')];}if(!_['isNil'](_0x295a36[_0x7345('0x48')][_0x7345('0x58')])){utils[_0x7345('0x6')](util['format'](_0x7345('0x59'),_0x295a36[_0x7345('0x4')],_0x295a36['value']));channels[_0x295a36['uniqueid']][_0x7345('0x58')]=_0x295a36[_0x7345('0x47')];}}}catch(_0x46c67b){utils[_0x7345('0x3d')](util['format'](_0x7345('0x43'),_0x295a36[_0x7345('0x4')]),_0x46c67b);}};exports[_0x7345('0x5a')]=function(_0x13d885){try{if(!_[_0x7345('0x1c')](channels[_0x13d885[_0x7345('0x4')]])){utils[_0x7345('0x32')](util[_0x7345('0x7')](_0x7345('0x5b'),_0x13d885[_0x7345('0x4')]),_0x13d885);utils[_0x7345('0x6')](util[_0x7345('0x7')](_0x7345('0x5c'),_0x13d885[_0x7345('0x4')],_0x13d885[_0x7345('0x5d')],_0x13d885[_0x7345('0x5e')]));if(_0x13d885[_0x7345('0x5d')]['toLowerCase']()==_0x7345('0x5f')&&_['startsWith'](_0x13d885[_0x7345('0x5e')][_0x7345('0x60')](),_0x7345('0x61'))){var _0x2f0c0=_0x13d885[_0x7345('0x5e')][_0x7345('0x62')]('=');var _0x8d2e09=_0x2f0c0[0x0][_0x7345('0x63')](_0x2f0c0[0x0][_0x7345('0x64')]('(')+0x1,_0x2f0c0[0x0][_0x7345('0x64')](')'));var _0x307bd9=_0x2f0c0[0x1];channels[_0x13d885[_0x7345('0x4')]][_0x8d2e09]=_0x307bd9;}if(!_[_0x7345('0x65')](['hangup',_0x7345('0x66'),_0x7345('0x67'),_0x7345('0x5f'),'gotoif'],_0x13d885['application']['toLowerCase']())){channels[_0x13d885[_0x7345('0x4')]][_0x7345('0x51')]=_0x13d885[_0x7345('0x5d')];channels[_0x13d885[_0x7345('0x4')]][_0x7345('0x53')]=_0x13d885[_0x7345('0x5e')];}}}catch(_0x4d60ef){utils[_0x7345('0x3d')](util[_0x7345('0x7')]('[%s][calls][newexten]',_0x13d885['uniqueid']),_0x4d60ef);}}; \ No newline at end of file +var _0xc051=['calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','recording','newchannel','debug','[%s][calls][newchannel]','linkedid','channel','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','endtime','billableseconds','diffTime','answertime','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','localtwolinkedid','userfield','transfertargetchannel','origtransfererchannel','_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','xmd-originatecalleridnum','value','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','xmd-callerid','xmcs-queue','xmd-queue','lastapplication','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]','application','appdata','toLowerCase','set','startsWith','cdr','lastIndexOf','includes','execif','lastdata','[%s][calls][newexten]','lodash','util','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','interface'];(function(_0x39d89b,_0x413243){var _0x477b21=function(_0x5ea8bf){while(--_0x5ea8bf){_0x39d89b['push'](_0x39d89b['shift']());}};_0x477b21(++_0x413243);}(_0xc051,0xb5));var _0x1c05=function(_0x436017,_0x47c412){_0x436017=_0x436017-0x0;var _0x50ed01=_0xc051[_0x436017];return _0x50ed01;};'use strict';var _=require(_0x1c05('0x0'));var util=require(_0x1c05('0x1'));var utils=require('./utils');var transfers=require('./transfers.controller');var dispositions=[_0x1c05('0x2'),_0x1c05('0x3'),_0x1c05('0x3'),_0x1c05('0x2'),'NO\x20ANSWER',_0x1c05('0x2'),_0x1c05('0x4'),_0x1c05('0x5'),_0x1c05('0x3'),_0x1c05('0x3'),_0x1c05('0x3')];var channels={};function writeDB(_0x3a9ba8){var _0x44d233;if(transfers[_0x1c05('0x6')][_0x3a9ba8['uniqueid']]){_0x44d233=_0x3a9ba8[_0x1c05('0x7')];_0x3a9ba8[_0x1c05('0x7')]=transfers[_0x1c05('0x6')][_0x3a9ba8[_0x1c05('0x7')]]['transfereeuniqueid'];}utils[_0x1c05('0x8')](util[_0x1c05('0x9')](_0x1c05('0xa'),_0x3a9ba8[_0x1c05('0x7')],_0x3a9ba8['channel'],_0x3a9ba8[_0x1c05('0xb')],_0x3a9ba8['membername'],_0x3a9ba8[_0x1c05('0xc')],_0x3a9ba8[_0x1c05('0xd')],_0x3a9ba8[_0x1c05('0xe')],_0x3a9ba8[_0x1c05('0xf')]));if(_0x3a9ba8[_0x1c05('0x10')]){utils[_0x1c05('0x11')](_0x3a9ba8[_0x1c05('0x10')])[_0x1c05('0x12')](function(_0x4de1c8){if(_0x4de1c8){_0x3a9ba8[_0x1c05('0x13')]=_0x4de1c8['id'];}utils[_0x1c05('0x14')](_0x1c05('0x15'),_0x3a9ba8);});}else{utils['request'](_0x1c05('0x15'),_0x3a9ba8);}if(channels[_0x3a9ba8[_0x1c05('0x7')]]){delete channels[_0x3a9ba8[_0x1c05('0x7')]];}else if(_0x44d233&&channels[_0x44d233]){if(!transfers['blinds'][_0x44d233][_0x1c05('0x16')])delete transfers['blinds'][_0x44d233];delete channels[_0x44d233];}}exports[_0x1c05('0x17')]=function(_0x439aa5){try{utils[_0x1c05('0x18')](util[_0x1c05('0x9')](_0x1c05('0x19'),_0x439aa5['uniqueid']),_0x439aa5);if(_0x439aa5[_0x1c05('0x7')]==_0x439aa5[_0x1c05('0x1a')]&&_0x439aa5[_0x1c05('0x1b')]!='OutgoingSpoolFailed'){utils[_0x1c05('0x8')](util[_0x1c05('0x9')](_0x1c05('0x1c'),_0x439aa5['uniqueid'],_0x439aa5[_0x1c05('0x1d')],_0x439aa5[_0x1c05('0x1e')]));channels[_0x439aa5['uniqueid']]={'uniqueid':_0x439aa5['uniqueid'],'accountcode':_0x439aa5[_0x1c05('0x10')],'source':_0x439aa5['calleridnum'],'destination':_0x439aa5['exten'],'destinationcontext':_0x439aa5['context'],'channel':_0x439aa5[_0x1c05('0x1b')],'starttime':utils[_0x1c05('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x1c05('0x20')};}}catch(_0x357401){utils[_0x1c05('0x21')](util[_0x1c05('0x9')]('[%s][calls][newchannel]',_0x439aa5[_0x1c05('0x7')]),_0x357401);}};exports[_0x1c05('0x22')]=function(_0x3ed2bc){try{utils[_0x1c05('0x18')](util[_0x1c05('0x9')](_0x1c05('0x23'),_0x3ed2bc['uniqueid']),_0x3ed2bc);if(!_[_0x1c05('0x24')](channels[_0x3ed2bc[_0x1c05('0x7')]])&&_0x3ed2bc[_0x1c05('0x25')]==0x6){utils[_0x1c05('0x8')](util[_0x1c05('0x9')](_0x1c05('0x26'),_0x3ed2bc[_0x1c05('0x7')],_0x3ed2bc['context'],_0x3ed2bc[_0x1c05('0x1b')]));if(_[_0x1c05('0x24')](channels[_0x3ed2bc[_0x1c05('0x7')]]['systemanswertime'])){channels[_0x3ed2bc['uniqueid']][_0x1c05('0x27')]=utils[_0x1c05('0x1f')]();}}else if(!_[_0x1c05('0x24')](channels[_0x3ed2bc[_0x1c05('0x1a')]])&&_0x3ed2bc[_0x1c05('0x25')]==0x6&&_0x3ed2bc[_0x1c05('0x1d')]!=_0x1c05('0x28')){utils[_0x1c05('0x8')](util[_0x1c05('0x9')](_0x1c05('0x29'),_0x3ed2bc[_0x1c05('0x7')],_0x3ed2bc[_0x1c05('0x1a')],_0x3ed2bc[_0x1c05('0x1d')],_0x3ed2bc[_0x1c05('0x1b')]));channels[_0x3ed2bc['linkedid']][_0x1c05('0x10')]=_0x3ed2bc['accountcode'];channels[_0x3ed2bc['linkedid']][_0x1c05('0x2a')]=_0x3ed2bc[_0x1c05('0x1b')];if(_[_0x1c05('0x24')](channels[_0x3ed2bc[_0x1c05('0x1a')]]['answertime'])){channels[_0x3ed2bc[_0x1c05('0x1a')]]['answertime']=utils[_0x1c05('0x1f')]();}channels[_0x3ed2bc['linkedid']][_0x1c05('0x2b')]=dispositions[_[_0x1c05('0x2c')](_0x3ed2bc[_0x1c05('0x25')])]||_0x1c05('0x4');}}catch(_0x230f48){utils[_0x1c05('0x21')](util[_0x1c05('0x9')](_0x1c05('0x23'),_0x3ed2bc[_0x1c05('0x7')]),_0x230f48);}};exports[_0x1c05('0x2d')]=function(_0x2f6c3a){try{if(!_[_0x1c05('0x24')](channels[_0x2f6c3a[_0x1c05('0x7')]])){utils[_0x1c05('0x18')](util[_0x1c05('0x9')](_0x1c05('0x2e'),_0x2f6c3a[_0x1c05('0x7')]),_0x2f6c3a);if(_[_0x1c05('0x24')](channels[_0x2f6c3a['uniqueid']][_0x1c05('0x2f')])){channels[_0x2f6c3a[_0x1c05('0x7')]]['callerid']=_0x2f6c3a['calleridname']+'\x20<'+_0x2f6c3a[_0x1c05('0xd')]+'>';}utils[_0x1c05('0x8')](util[_0x1c05('0x9')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x2f6c3a[_0x1c05('0x7')],channels[_0x2f6c3a[_0x1c05('0x7')]][_0x1c05('0x2f')],_0x2f6c3a['cause-txt']));channels[_0x2f6c3a[_0x1c05('0x7')]][_0x1c05('0x30')]=utils[_0x1c05('0x1f')]();channels[_0x2f6c3a['uniqueid']]['duration']=utils['diffTime'](channels[_0x2f6c3a['uniqueid']][_0x1c05('0x30')],channels[_0x2f6c3a['uniqueid']]['starttime']);channels[_0x2f6c3a[_0x1c05('0x7')]][_0x1c05('0x31')]=channels[_0x2f6c3a[_0x1c05('0x7')]]['answertime']?utils[_0x1c05('0x32')](channels[_0x2f6c3a[_0x1c05('0x7')]][_0x1c05('0x30')],channels[_0x2f6c3a[_0x1c05('0x7')]][_0x1c05('0x33')]):0x0;writeDB(channels[_0x2f6c3a[_0x1c05('0x7')]]);}}catch(_0x1cc1eb){utils[_0x1c05('0x21')](util['format'](_0x1c05('0x2e'),_0x2f6c3a[_0x1c05('0x7')]),_0x1cc1eb);}};exports['attendedtransfer']=function(_0x4b6ae4){try{if(!_[_0x1c05('0x24')](channels[_0x4b6ae4['localtwolinkedid']])){utils[_0x1c05('0x18')](util[_0x1c05('0x9')](_0x1c05('0x34'),_0x4b6ae4[_0x1c05('0x35')]),_0x4b6ae4);if(channels[_0x4b6ae4['localtwolinkedid']][_0x1c05('0x1b')]==_0x4b6ae4['transfereechannel']){utils['info'](util[_0x1c05('0x9')](_0x1c05('0x36'),_0x4b6ae4[_0x1c05('0x35')],_0x4b6ae4['localtwolinkedid'],_0x4b6ae4[_0x1c05('0x37')]));channels[_0x4b6ae4['localtwolinkedid']][_0x1c05('0x2a')]=_0x4b6ae4['secondtransfererchannel'];channels[_0x4b6ae4[_0x1c05('0x38')]][_0x1c05('0x39')]='_attended';}else if(channels[_0x4b6ae4[_0x1c05('0x38')]][_0x1c05('0x1b')]=_0x4b6ae4[_0x1c05('0x3a')]){utils[_0x1c05('0x8')](util[_0x1c05('0x9')](_0x1c05('0x36'),_0x4b6ae4[_0x1c05('0x35')],_0x4b6ae4[_0x1c05('0x38')],_0x4b6ae4[_0x1c05('0x3b')]));channels[_0x4b6ae4['localtwolinkedid']][_0x1c05('0x2a')]=_0x4b6ae4[_0x1c05('0x3b')];channels[_0x4b6ae4[_0x1c05('0x38')]]['userfield']=_0x1c05('0x3c');}}}catch(_0x20efb2){utils[_0x1c05('0x21')](util[_0x1c05('0x9')](_0x1c05('0x34'),_0x4b6ae4[_0x1c05('0x35')]),_0x20efb2);}};exports[_0x1c05('0x3d')]=function(_0x7df08e){try{if(!_[_0x1c05('0x24')](channels[_0x7df08e[_0x1c05('0x7')]])){utils[_0x1c05('0x18')](util['format'](_0x1c05('0x3e'),_0x7df08e['uniqueid']),_0x7df08e);channels[_0x7df08e[_0x1c05('0x7')]][_0x1c05('0x3f')]=utils[_0x1c05('0x1f')]();utils['info'](util[_0x1c05('0x9')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x7df08e[_0x1c05('0x7')],channels[_0x7df08e[_0x1c05('0x7')]][_0x1c05('0x3f')]));}}catch(_0x8bf796){utils[_0x1c05('0x21')](util[_0x1c05('0x9')](_0x1c05('0x3e'),_0x7df08e[_0x1c05('0x7')]),_0x8bf796);}};exports[_0x1c05('0x40')]=function(_0x518c5c){try{if(!_[_0x1c05('0x24')](channels[_0x518c5c[_0x1c05('0x7')]])){utils[_0x1c05('0x18')](util[_0x1c05('0x9')](_0x1c05('0x41'),_0x518c5c[_0x1c05('0x7')]),_0x518c5c);if(!_[_0x1c05('0x24')](channels[_0x518c5c[_0x1c05('0x7')]][_0x1c05('0x3f')])){channels[_0x518c5c[_0x1c05('0x7')]][_0x1c05('0x42')]+=utils[_0x1c05('0x32')](utils[_0x1c05('0x1f')](),channels[_0x518c5c[_0x1c05('0x7')]][_0x1c05('0x3f')]);utils[_0x1c05('0x8')](util[_0x1c05('0x9')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x518c5c[_0x1c05('0x7')],channels[_0x518c5c['uniqueid']][_0x1c05('0x42')]));delete channels[_0x518c5c[_0x1c05('0x7')]]['musiconholdstartAt'];}}}catch(_0x4077d9){utils[_0x1c05('0x21')](util[_0x1c05('0x9')](_0x1c05('0x41'),_0x518c5c[_0x1c05('0x7')]),_0x4077d9);}};exports['varset']=function(_0x45b9ff){try{if(!_['isNil'](channels[_0x45b9ff[_0x1c05('0x7')]])){utils['debug'](util[_0x1c05('0x9')]('[%s][calls][varset]',_0x45b9ff[_0x1c05('0x7')]),_0x45b9ff);if(!_[_0x1c05('0x24')](_0x45b9ff['variable'][_0x1c05('0x43')])){utils[_0x1c05('0x8')](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x45b9ff[_0x1c05('0x7')],_0x45b9ff[_0x1c05('0x44')]));channels[_0x45b9ff[_0x1c05('0x7')]]['source']=_0x45b9ff[_0x1c05('0x44')];}if(!_['isNil'](_0x45b9ff[_0x1c05('0x45')][_0x1c05('0x46')])){utils[_0x1c05('0x8')](util['format'](_0x1c05('0x47'),_0x45b9ff[_0x1c05('0x7')],_0x45b9ff[_0x1c05('0x44')]));channels[_0x45b9ff['uniqueid']][_0x1c05('0x48')]=_0x45b9ff['value'];channels[_0x45b9ff[_0x1c05('0x7')]][_0x1c05('0x2f')]='\x22'+_0x45b9ff['value']+'\x22\x20<'+_0x45b9ff[_0x1c05('0x44')]+'>';}if(!_[_0x1c05('0x24')](_0x45b9ff[_0x1c05('0x45')][_0x1c05('0x49')])||!_[_0x1c05('0x24')](_0x45b9ff['variable'][_0x1c05('0x4a')])){utils[_0x1c05('0x8')](util[_0x1c05('0x9')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x45b9ff['uniqueid'],!_[_0x1c05('0x24')](_0x45b9ff[_0x1c05('0x45')]['xmd-callerid-preview'])?_0x1c05('0x49'):'xmd-callerid',_0x45b9ff[_0x1c05('0x44')]));channels[_0x45b9ff[_0x1c05('0x7')]][_0x1c05('0x2f')]=_0x45b9ff[_0x1c05('0x44')];}if(!_[_0x1c05('0x24')](_0x45b9ff[_0x1c05('0x45')]['xmd-queue'])||!_['isNil'](_0x45b9ff[_0x1c05('0x45')][_0x1c05('0x4b')])){utils['info'](util[_0x1c05('0x9')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x45b9ff['uniqueid'],!_[_0x1c05('0x24')](_0x45b9ff['variable'][_0x1c05('0x4c')])?_0x1c05('0x4c'):'xmcs-queue',_0x45b9ff[_0x1c05('0x44')]));channels[_0x45b9ff[_0x1c05('0x7')]][_0x1c05('0x4d')]=_0x1c05('0x4e');channels[_0x45b9ff['uniqueid']]['lastdata']=_0x45b9ff['value'];channels[_0x45b9ff[_0x1c05('0x7')]]['queue']=!![];}if(!_[_0x1c05('0x24')](_0x45b9ff[_0x1c05('0x45')][_0x1c05('0x4f')])){utils[_0x1c05('0x8')](util[_0x1c05('0x9')](_0x1c05('0x50'),_0x45b9ff[_0x1c05('0x7')],_0x45b9ff['value']));channels[_0x45b9ff[_0x1c05('0x7')]]['ContactId']=_0x45b9ff[_0x1c05('0x44')];}if(!_[_0x1c05('0x24')](_0x45b9ff[_0x1c05('0x45')]['xmd-cdrtype'])){utils[_0x1c05('0x8')](util[_0x1c05('0x9')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x45b9ff[_0x1c05('0x7')],_0x45b9ff[_0x1c05('0x44')]));channels[_0x45b9ff[_0x1c05('0x7')]][_0x1c05('0x51')]=_0x45b9ff['value'];}if(!_[_0x1c05('0x24')](_0x45b9ff['variable'][_0x1c05('0x52')])){utils['info'](util[_0x1c05('0x9')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x45b9ff[_0x1c05('0x7')],_0x45b9ff['value']));channels[_0x45b9ff['uniqueid']][_0x1c05('0x53')]=_0x45b9ff['value'];}if(!_[_0x1c05('0x24')](_0x45b9ff[_0x1c05('0x45')][_0x1c05('0x54')])){utils['info'](util[_0x1c05('0x9')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x45b9ff['uniqueid'],_0x45b9ff['value']));channels[_0x45b9ff['uniqueid']]['sipcallid']=_0x45b9ff[_0x1c05('0x44')];}}}catch(_0x347540){utils[_0x1c05('0x21')](util['format'](_0x1c05('0x55'),_0x45b9ff[_0x1c05('0x7')]),_0x347540);}};exports['newexten']=function(_0x3d5582){try{if(!_['isNil'](channels[_0x3d5582['uniqueid']])){utils[_0x1c05('0x18')](util[_0x1c05('0x9')]('[%s][calls][newexten]',_0x3d5582[_0x1c05('0x7')]),_0x3d5582);utils[_0x1c05('0x8')](util[_0x1c05('0x9')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x3d5582[_0x1c05('0x7')],_0x3d5582[_0x1c05('0x56')],_0x3d5582[_0x1c05('0x57')]));if(_0x3d5582[_0x1c05('0x56')][_0x1c05('0x58')]()==_0x1c05('0x59')&&_[_0x1c05('0x5a')](_0x3d5582[_0x1c05('0x57')][_0x1c05('0x58')](),_0x1c05('0x5b'))){var _0x1fd224=_0x3d5582[_0x1c05('0x57')]['split']('=');var _0x4e8185=_0x1fd224[0x0]['substring'](_0x1fd224[0x0][_0x1c05('0x5c')]('(')+0x1,_0x1fd224[0x0][_0x1c05('0x5c')](')'));var _0x2675c5=_0x1fd224[0x1];channels[_0x3d5582['uniqueid']][_0x4e8185]=_0x2675c5;}if(!_[_0x1c05('0x5d')]([_0x1c05('0x2d'),'noop',_0x1c05('0x5e'),_0x1c05('0x59'),'gotoif'],_0x3d5582['application']['toLowerCase']())){channels[_0x3d5582[_0x1c05('0x7')]][_0x1c05('0x4d')]=_0x3d5582[_0x1c05('0x56')];channels[_0x3d5582[_0x1c05('0x7')]][_0x1c05('0x5f')]=_0x3d5582[_0x1c05('0x57')];}}}catch(_0x6397dd){utils[_0x1c05('0x21')](util['format'](_0x1c05('0x60'),_0x3d5582[_0x1c05('0x7')]),_0x6397dd);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 1a31c3e..20c055e 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 _0x1d2b=['[core]\x20connected','shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','[core]\x20close','managerevent','./utils','connect','info'];(function(_0x494452,_0x5b9635){var _0x456e08=function(_0xf79cd4){while(--_0xf79cd4){_0x494452['push'](_0x494452['shift']());}};_0x456e08(++_0x5b9635);}(_0x1d2b,0x105));var _0xb1d2=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x1d2b[_0x40ac5e];return _0x2839d6;};'use strict';var utils=require(_0xb1d2('0x0'));exports[_0xb1d2('0x1')]=function(){utils[_0xb1d2('0x2')](_0xb1d2('0x3'));};exports[_0xb1d2('0x4')]=function(){utils['info']('[core]\x20shutdown');};exports[_0xb1d2('0x5')]=function(){utils[_0xb1d2('0x2')](_0xb1d2('0x6'));};exports[_0xb1d2('0x7')]=function(_0x3a824d){utils[_0xb1d2('0x7')](_0xb1d2('0x8'),_0x3a824d);};exports['close']=function(){utils['info'](_0xb1d2('0x9'));};exports[_0xb1d2('0xa')]=function(_0x1139cd){}; \ No newline at end of file +var _0x875d=['managerevent','./utils','connect','info','[core]\x20connected','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error'];(function(_0x594e00,_0x2b26e5){var _0x393663=function(_0xd47c49){while(--_0xd47c49){_0x594e00['push'](_0x594e00['shift']());}};_0x393663(++_0x2b26e5);}(_0x875d,0x191));var _0xd875=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x875d[_0xd0b415];return _0x2bdf2c;};'use strict';var utils=require(_0xd875('0x0'));exports[_0xd875('0x1')]=function(){utils[_0xd875('0x2')](_0xd875('0x3'));};exports['shutdown']=function(){utils[_0xd875('0x2')](_0xd875('0x4'));};exports[_0xd875('0x5')]=function(){utils['info'](_0xd875('0x6'));};exports[_0xd875('0x7')]=function(_0x24d049){utils['error'](_0xd875('0x8'),_0x24d049);};exports['close']=function(){utils['info']('[core]\x20close');};exports[_0xd875('0x9')]=function(_0x3449d4){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 5717193..31dbd6d 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 _0x013c=['[%s][dials][newexten]','appdata','application','toLowerCase','set','startsWith','cdr(routeid)','split','error','varset','isNil','variable','outboundrouteid','value','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','connect','hangup','[%s][dials][hangup]','cause-txt','complete','duration','diffTime','endtime','answertime','lodash','util','info','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','newexten','debug'];(function(_0x8eb69,_0x5d5ef1){var _0x37ed44=function(_0x4c311f){while(--_0x4c311f){_0x8eb69['push'](_0x8eb69['shift']());}};_0x37ed44(++_0x5d5ef1);}(_0x013c,0x173));var _0xc013=function(_0x5bd4f6,_0xf4e45c){_0x5bd4f6=_0x5bd4f6-0x0;var _0x33a165=_0x013c[_0x5bd4f6];return _0x33a165;};'use strict';var _=require(_0xc013('0x0'));var util=require(_0xc013('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x15e3c1){utils[_0xc013('0x2')](util[_0xc013('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x15e3c1[_0xc013('0x4')],_0x15e3c1[_0xc013('0x5')],_0x15e3c1[_0xc013('0x6')],_0x15e3c1[_0xc013('0x7')],_0x15e3c1[_0xc013('0x8')],_0x15e3c1[_0xc013('0x9')]));utils[_0xc013('0xa')]('CreateVoiceDialReport',_0x15e3c1);delete dials[_0x15e3c1[_0xc013('0x4')]];}exports[_0xc013('0xb')]=function(_0x51c2d7){try{utils[_0xc013('0xc')](util[_0xc013('0x3')](_0xc013('0xd'),_0x51c2d7[_0xc013('0x4')]),_0x51c2d7);utils[_0xc013('0x2')](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x51c2d7[_0xc013('0x4')],_0x51c2d7['application'],_0x51c2d7[_0xc013('0xe')]));if(_0x51c2d7[_0xc013('0xf')][_0xc013('0x10')]()==_0xc013('0x11')&&_[_0xc013('0x12')](_0x51c2d7[_0xc013('0xe')]['toLowerCase'](),_0xc013('0x13'))){var _0xad59f8=_0x51c2d7[_0xc013('0xe')][_0xc013('0x14')]('=');dials[_0x51c2d7['uniqueid']]={'routeId':_0xad59f8[0x1]};}}catch(_0x540bc1){utils[_0xc013('0x15')](util[_0xc013('0x3')](_0xc013('0xd'),_0x51c2d7[_0xc013('0x4')]),_0x540bc1);}};exports[_0xc013('0x16')]=function(_0x2f02de){try{utils[_0xc013('0xc')](util[_0xc013('0x3')]('[%s][dials][varset]',_0x2f02de[_0xc013('0x4')]),_0x2f02de);if(!_[_0xc013('0x17')](_0x2f02de[_0xc013('0x18')][_0xc013('0x19')])){utils['info'](util[_0xc013('0x3')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x2f02de['uniqueid'],_0x2f02de[_0xc013('0x1a')]));dials[_0x2f02de[_0xc013('0x4')]]={'routeId':_0x2f02de['value']};}}catch(_0x54509c){utils[_0xc013('0x15')](util[_0xc013('0x3')](_0xc013('0x1b'),_0x2f02de[_0xc013('0x4')]),_0x54509c);}};exports[_0xc013('0x1c')]=function(_0x5da47f){try{if(!_[_0xc013('0x17')](dials[_0x5da47f[_0xc013('0x4')]])){utils[_0xc013('0xc')](util['format'](_0xc013('0x1d'),_0x5da47f['uniqueid']),_0x5da47f);dials[_0x5da47f['uniqueid']]=_[_0xc013('0x1e')](dials[_0x5da47f[_0xc013('0x4')]],_0x5da47f);dials[_0x5da47f[_0xc013('0x4')]][_0xc013('0x1f')]=utils[_0xc013('0x20')]();dials[_0x5da47f[_0xc013('0x4')]][_0xc013('0x21')]=_0xc013('0x22');utils['info'](util['format'](_0xc013('0x23'),_0x5da47f[_0xc013('0x4')],dials[_0x5da47f[_0xc013('0x4')]][_0xc013('0x1f')]));}}catch(_0x31ad61){utils[_0xc013('0x15')](util[_0xc013('0x3')]('[%s][dials][dialbegin]',_0x5da47f['uniqueid']),_0x31ad61);}};exports[_0xc013('0x24')]=function(_0x40a404){try{if(!_[_0xc013('0x17')](dials[_0x40a404[_0xc013('0x4')]])){utils[_0xc013('0xc')](util[_0xc013('0x3')](_0xc013('0x25'),_0x40a404[_0xc013('0x4')]),_0x40a404);dials[_0x40a404['uniqueid']][_0xc013('0x9')]=_0x40a404[_0xc013('0x9')];if(_0x40a404[_0xc013('0x9')]==_0xc013('0x26')){dials[_0x40a404[_0xc013('0x4')]]=_[_0xc013('0x1e')](dials[_0x40a404[_0xc013('0x4')]],_0x40a404);dials[_0x40a404[_0xc013('0x4')]]['answertime']=utils[_0xc013('0x20')]();dials[_0x40a404[_0xc013('0x4')]][_0xc013('0x21')]=_0xc013('0x27');utils[_0xc013('0x2')](util[_0xc013('0x3')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x40a404[_0xc013('0x4')],_0x40a404[_0xc013('0x9')],dials[_0x40a404[_0xc013('0x4')]]['answertime']));}else{utils[_0xc013('0x2')](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0x40a404[_0xc013('0x4')],_0x40a404[_0xc013('0x9')]));}}}catch(_0x5d5130){utils[_0xc013('0x15')](util[_0xc013('0x3')]('[%s][dials][dialend]',_0x40a404[_0xc013('0x4')]),_0x5d5130);}};exports[_0xc013('0x28')]=function(_0x4788a4){try{if(!_[_0xc013('0x17')](dials[_0x4788a4[_0xc013('0x4')]])){utils[_0xc013('0xc')](util[_0xc013('0x3')](_0xc013('0x29'),_0x4788a4['uniqueid']),_0x4788a4);utils['info'](util[_0xc013('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x4788a4['uniqueid'],_0x4788a4['calleridnum'],_0x4788a4['calleridname'],_0x4788a4[_0xc013('0x2a')]));dials[_0x4788a4[_0xc013('0x4')]]=_['assign'](dials[_0x4788a4[_0xc013('0x4')]],{'endtime':utils[_0xc013('0x20')](),'lastevent':_0xc013('0x2b')});dials[_0x4788a4[_0xc013('0x4')]][_0xc013('0x2c')]=utils[_0xc013('0x2d')](dials[_0x4788a4[_0xc013('0x4')]][_0xc013('0x2e')],dials[_0x4788a4[_0xc013('0x4')]][_0xc013('0x1f')]);dials[_0x4788a4[_0xc013('0x4')]]['holdtime']=utils['diffTime'](dials[_0x4788a4[_0xc013('0x4')]][_0xc013('0x2f')]||dials[_0x4788a4['uniqueid']][_0xc013('0x2e')],dials[_0x4788a4[_0xc013('0x4')]][_0xc013('0x1f')]);dials[_0x4788a4[_0xc013('0x4')]]['billableseconds']=dials[_0x4788a4[_0xc013('0x4')]][_0xc013('0x2f')]?utils[_0xc013('0x2d')](dials[_0x4788a4['uniqueid']]['endtime'],dials[_0x4788a4[_0xc013('0x4')]][_0xc013('0x2f')]):0x0;writeDB(dials[_0x4788a4[_0xc013('0x4')]]);}}catch(_0x151728){utils[_0xc013('0x15')](util[_0xc013('0x3')]('[%s][dials][hangup]',_0x4788a4['uniqueid']),_0x151728);}}; \ No newline at end of file +var _0x2d00=['channel','dialstring','calleridnum','connectedlinenum','CreateVoiceDialReport','newexten','debug','format','[%s][dials][newexten]','application','appdata','toLowerCase','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','dialstatus','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','duration','endtime','diffTime','billableseconds','lodash','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid'];(function(_0xbf2674,_0x330e49){var _0x13a65a=function(_0x11c096){while(--_0x11c096){_0xbf2674['push'](_0xbf2674['shift']());}};_0x13a65a(++_0x330e49);}(_0x2d00,0xef));var _0x02d0=function(_0x4c0989,_0x6bc56d){_0x4c0989=_0x4c0989-0x0;var _0x3bcd00=_0x2d00[_0x4c0989];return _0x3bcd00;};'use strict';var _=require(_0x02d0('0x0'));var util=require(_0x02d0('0x1'));var utils=require(_0x02d0('0x2'));var dials={};function writeDB(_0x80826e){utils[_0x02d0('0x3')](util['format'](_0x02d0('0x4'),_0x80826e[_0x02d0('0x5')],_0x80826e[_0x02d0('0x6')],_0x80826e[_0x02d0('0x7')],_0x80826e[_0x02d0('0x8')],_0x80826e[_0x02d0('0x9')],_0x80826e['dialstatus']));utils['request'](_0x02d0('0xa'),_0x80826e);delete dials[_0x80826e[_0x02d0('0x5')]];}exports[_0x02d0('0xb')]=function(_0x8b01a3){try{utils[_0x02d0('0xc')](util[_0x02d0('0xd')](_0x02d0('0xe'),_0x8b01a3[_0x02d0('0x5')]),_0x8b01a3);utils[_0x02d0('0x3')](util[_0x02d0('0xd')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x8b01a3['uniqueid'],_0x8b01a3[_0x02d0('0xf')],_0x8b01a3[_0x02d0('0x10')]));if(_0x8b01a3[_0x02d0('0xf')][_0x02d0('0x11')]()=='set'&&_['startsWith'](_0x8b01a3[_0x02d0('0x10')][_0x02d0('0x11')](),_0x02d0('0x12'))){var _0x43e29f=_0x8b01a3[_0x02d0('0x10')][_0x02d0('0x13')]('=');dials[_0x8b01a3[_0x02d0('0x5')]]={'routeId':_0x43e29f[0x1]};}}catch(_0xd46f06){utils[_0x02d0('0x14')](util[_0x02d0('0xd')](_0x02d0('0xe'),_0x8b01a3[_0x02d0('0x5')]),_0xd46f06);}};exports[_0x02d0('0x15')]=function(_0x347b31){try{utils[_0x02d0('0xc')](util[_0x02d0('0xd')](_0x02d0('0x16'),_0x347b31[_0x02d0('0x5')]),_0x347b31);if(!_[_0x02d0('0x17')](_0x347b31['variable']['outboundrouteid'])){utils[_0x02d0('0x3')](util['format'](_0x02d0('0x18'),_0x347b31['uniqueid'],_0x347b31['value']));dials[_0x347b31[_0x02d0('0x5')]]={'routeId':_0x347b31[_0x02d0('0x19')]};}}catch(_0x5d1770){utils[_0x02d0('0x14')](util[_0x02d0('0xd')](_0x02d0('0x16'),_0x347b31[_0x02d0('0x5')]),_0x5d1770);}};exports[_0x02d0('0x1a')]=function(_0x1018aa){try{if(!_[_0x02d0('0x17')](dials[_0x1018aa[_0x02d0('0x5')]])){utils[_0x02d0('0xc')](util[_0x02d0('0xd')](_0x02d0('0x1b'),_0x1018aa['uniqueid']),_0x1018aa);dials[_0x1018aa[_0x02d0('0x5')]]=_[_0x02d0('0x1c')](dials[_0x1018aa['uniqueid']],_0x1018aa);dials[_0x1018aa[_0x02d0('0x5')]][_0x02d0('0x1d')]=utils['now']();dials[_0x1018aa['uniqueid']][_0x02d0('0x1e')]=_0x02d0('0x1f');utils[_0x02d0('0x3')](util['format'](_0x02d0('0x20'),_0x1018aa[_0x02d0('0x5')],dials[_0x1018aa[_0x02d0('0x5')]]['starttime']));}}catch(_0x21eb9b){utils[_0x02d0('0x14')](util[_0x02d0('0xd')]('[%s][dials][dialbegin]',_0x1018aa[_0x02d0('0x5')]),_0x21eb9b);}};exports[_0x02d0('0x21')]=function(_0x1e2ed2){try{if(!_[_0x02d0('0x17')](dials[_0x1e2ed2[_0x02d0('0x5')]])){utils['debug'](util[_0x02d0('0xd')](_0x02d0('0x22'),_0x1e2ed2[_0x02d0('0x5')]),_0x1e2ed2);dials[_0x1e2ed2[_0x02d0('0x5')]][_0x02d0('0x23')]=_0x1e2ed2[_0x02d0('0x23')];if(_0x1e2ed2[_0x02d0('0x23')]=='ANSWER'){dials[_0x1e2ed2[_0x02d0('0x5')]]=_[_0x02d0('0x1c')](dials[_0x1e2ed2[_0x02d0('0x5')]],_0x1e2ed2);dials[_0x1e2ed2[_0x02d0('0x5')]]['answertime']=utils['now']();dials[_0x1e2ed2[_0x02d0('0x5')]]['lastevent']=_0x02d0('0x24');utils['info'](util['format'](_0x02d0('0x25'),_0x1e2ed2[_0x02d0('0x5')],_0x1e2ed2[_0x02d0('0x23')],dials[_0x1e2ed2[_0x02d0('0x5')]][_0x02d0('0x26')]));}else{utils[_0x02d0('0x3')](util[_0x02d0('0xd')](_0x02d0('0x27'),_0x1e2ed2['uniqueid'],_0x1e2ed2[_0x02d0('0x23')]));}}}catch(_0xcc4860){utils['error'](util[_0x02d0('0xd')]('[%s][dials][dialend]',_0x1e2ed2['uniqueid']),_0xcc4860);}};exports[_0x02d0('0x28')]=function(_0x17ccc9){try{if(!_[_0x02d0('0x17')](dials[_0x17ccc9[_0x02d0('0x5')]])){utils[_0x02d0('0xc')](util[_0x02d0('0xd')](_0x02d0('0x29'),_0x17ccc9[_0x02d0('0x5')]),_0x17ccc9);utils['info'](util[_0x02d0('0xd')](_0x02d0('0x2a'),_0x17ccc9['uniqueid'],_0x17ccc9['calleridnum'],_0x17ccc9[_0x02d0('0x2b')],_0x17ccc9[_0x02d0('0x2c')]));dials[_0x17ccc9[_0x02d0('0x5')]]=_[_0x02d0('0x1c')](dials[_0x17ccc9[_0x02d0('0x5')]],{'endtime':utils['now'](),'lastevent':'complete'});dials[_0x17ccc9[_0x02d0('0x5')]][_0x02d0('0x2d')]=utils['diffTime'](dials[_0x17ccc9[_0x02d0('0x5')]][_0x02d0('0x2e')],dials[_0x17ccc9['uniqueid']]['starttime']);dials[_0x17ccc9[_0x02d0('0x5')]]['holdtime']=utils[_0x02d0('0x2f')](dials[_0x17ccc9[_0x02d0('0x5')]]['answertime']||dials[_0x17ccc9[_0x02d0('0x5')]][_0x02d0('0x2e')],dials[_0x17ccc9[_0x02d0('0x5')]]['starttime']);dials[_0x17ccc9['uniqueid']][_0x02d0('0x30')]=dials[_0x17ccc9[_0x02d0('0x5')]]['answertime']?utils[_0x02d0('0x2f')](dials[_0x17ccc9[_0x02d0('0x5')]][_0x02d0('0x2e')],dials[_0x17ccc9[_0x02d0('0x5')]][_0x02d0('0x26')]):0x0;writeDB(dials[_0x17ccc9['uniqueid']]);}}catch(_0x46b0c3){utils['error'](util[_0x02d0('0xd')](_0x02d0('0x29'),_0x17ccc9[_0x02d0('0x5')]),_0x46b0c3);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index db55ab5..f65ffed 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 _0x3481=['production','local','asterisk','port','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./recordings.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','devicestatechange','debug','device','format','[%s][index][devicestatechange]','agentcalled','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','util','xdr','disabled','env'];(function(_0x57d766,_0x3ef42e){var _0xebb485=function(_0x3ea6b1){while(--_0x3ea6b1){_0x57d766['push'](_0x57d766['shift']());}};_0xebb485(++_0x3ef42e);}(_0x3481,0xc6));var _0x1348=function(_0x514129,_0xcb03fb){_0x514129=_0x514129-0x0;var _0x672ea9=_0x3481[_0x514129];return _0x672ea9;};var AsteriskManager=require('asterisk-manager');var config=require(_0x1348('0x0'));var utils=require(_0x1348('0x1'));var util=require(_0x1348('0x2'));var isXDREnabled=config[_0x1348('0x3')]&&config[_0x1348('0x3')][_0x1348('0x4')]?!config[_0x1348('0x3')]['disabled']:!![];var isProduction=config[_0x1348('0x5')]===_0x1348('0x6')||![];var isLocalAsterisk=config[_0x1348('0x3')]&&config['xdr'][_0x1348('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x1348('0x8')][_0x1348('0x9')],config['asterisk']['ip'],config[_0x1348('0x8')]['username'],config['asterisk'][_0x1348('0xa')],!![]);ami[_0x1348('0xb')]();if(!isXDREnabled){utils[_0x1348('0xc')](_0x1348('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x1348('0xc')](_0x1348('0xe'));}else{var agents=require(_0x1348('0xf'));var calls=require(_0x1348('0x10'));var queues=require('./queues.controller');var recordings=require(_0x1348('0x11'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0x1348('0x12'));var core=require(_0x1348('0x13'));ami['on'](_0x1348('0x14'),core[_0x1348('0x14')]);ami['on'](_0x1348('0x15'),core[_0x1348('0x15')]);ami['on'](_0x1348('0x16'),core[_0x1348('0x16')]);ami['on'](_0x1348('0x17'),core[_0x1348('0x17')]);ami['on'](_0x1348('0x18'),core[_0x1348('0x18')]);ami['on']('managerevent',core['managerevent']);ami['on'](_0x1348('0x19'),function(_0x5708ae){try{utils[_0x1348('0x1a')](util['format']('[%s][index][devicestatechange]',_0x5708ae[_0x1348('0x1b')]),_0x5708ae);members[_0x1348('0x19')](_0x5708ae);}catch(_0x3f5686){utils[_0x1348('0x17')](util[_0x1348('0x1c')](_0x1348('0x1d'),_0x5708ae[_0x1348('0x1b')]),_0x3f5686);}});ami['on'](_0x1348('0x1e'),function(_0x32ba6e){try{utils['debug'](util[_0x1348('0x1c')]('[%s][index][agentcalled]',_0x32ba6e[_0x1348('0x1f')]),_0x32ba6e);agents[_0x1348('0x1e')](_0x32ba6e);}catch(_0x2780e8){utils['error'](util[_0x1348('0x1c')](_0x1348('0x20'),_0x32ba6e[_0x1348('0x1f')]),_0x2780e8);}});ami['on'](_0x1348('0x21'),function(_0x5b13b9){try{utils[_0x1348('0x1a')](util['format'](_0x1348('0x22'),_0x5b13b9[_0x1348('0x1f')]),_0x5b13b9);agents[_0x1348('0x21')](_0x5b13b9);}catch(_0x8ef773){utils[_0x1348('0x17')](util['format'](_0x1348('0x22'),_0x5b13b9[_0x1348('0x1f')]),_0x8ef773);}});ami['on'](_0x1348('0x23'),function(_0x1c3723){try{utils[_0x1348('0x1a')](util[_0x1348('0x1c')]('[%s][index][agentconnect]',_0x1c3723[_0x1348('0x1f')]),_0x1c3723);agents[_0x1348('0x23')](_0x1c3723);queues[_0x1348('0x23')](_0x1c3723);}catch(_0x595a0a){utils['error'](util[_0x1348('0x1c')](_0x1348('0x24'),_0x1c3723[_0x1348('0x1f')]),_0x595a0a);}});ami['on'](_0x1348('0x25'),function(_0x242a30){try{utils['debug'](util['format'](_0x1348('0x26'),_0x242a30[_0x1348('0x1f')]),_0x242a30);agents[_0x1348('0x25')](_0x242a30);queues[_0x1348('0x25')](_0x242a30);members[_0x1348('0x25')](_0x242a30);}catch(_0x605385){utils[_0x1348('0x17')](util[_0x1348('0x1c')]('[%s][index][agentcomplete]',_0x242a30[_0x1348('0x1f')]),_0x605385);}});ami['on'](_0x1348('0x27'),function(_0x44203a){try{utils[_0x1348('0x1a')](util[_0x1348('0x1c')](_0x1348('0x28'),_0x44203a['uniqueid']),_0x44203a);agents[_0x1348('0x27')](_0x44203a);queues[_0x1348('0x27')](_0x44203a);}catch(_0x32b376){utils[_0x1348('0x17')](util[_0x1348('0x1c')](_0x1348('0x28'),_0x44203a['uniqueid']),_0x32b376);}});ami['on']('queuecallerjoin',function(_0x406455){try{utils[_0x1348('0x1a')](util[_0x1348('0x1c')](_0x1348('0x29'),_0x406455['uniqueid']),_0x406455);queues[_0x1348('0x2a')](_0x406455);recordings['queuecallerjoin'](_0x406455);}catch(_0x208014){utils[_0x1348('0x17')](util[_0x1348('0x1c')]('[%s][index][queuecallerjoin]',_0x406455[_0x1348('0x1f')]),_0x208014);}});ami['on'](_0x1348('0x2b'),function(_0x57090b){try{utils[_0x1348('0x1a')](util[_0x1348('0x1c')]('[%s][index][queuecallerleave]',_0x57090b[_0x1348('0x1f')]),_0x57090b);queues['queuecallerleave'](_0x57090b);}catch(_0x4a1287){utils[_0x1348('0x17')](util['format']('[%s][index][queuecallerleave]',_0x57090b[_0x1348('0x1f')]),_0x4a1287);}});ami['on'](_0x1348('0x2c'),function(_0x3ccf75){try{utils['debug'](util[_0x1348('0x1c')]('[%s][index][musiconholdstart]',_0x3ccf75['uniqueid']),_0x3ccf75);queues[_0x1348('0x2c')](_0x3ccf75);calls[_0x1348('0x2c')](_0x3ccf75);}catch(_0x5275b1){utils[_0x1348('0x17')](util[_0x1348('0x1c')](_0x1348('0x2d'),_0x3ccf75[_0x1348('0x1f')]),_0x5275b1);}});ami['on'](_0x1348('0x2e'),function(_0x4f1a47){try{utils[_0x1348('0x1a')](util[_0x1348('0x1c')](_0x1348('0x2f'),_0x4f1a47[_0x1348('0x1f')]),_0x4f1a47);queues[_0x1348('0x2e')](_0x4f1a47);calls[_0x1348('0x2e')](_0x4f1a47);}catch(_0x36b4f8){utils[_0x1348('0x17')](util[_0x1348('0x1c')](_0x1348('0x2f'),_0x4f1a47[_0x1348('0x1f')]),_0x36b4f8);}});ami['on']('newstate',function(_0x4942f){try{utils[_0x1348('0x1a')](util['format'](_0x1348('0x30'),_0x4942f[_0x1348('0x1f')]),_0x4942f);calls[_0x1348('0x31')](_0x4942f);recordings[_0x1348('0x31')](_0x4942f);}catch(_0x41ad41){utils[_0x1348('0x17')](util[_0x1348('0x1c')](_0x1348('0x30'),_0x4942f[_0x1348('0x1f')]),_0x41ad41);}});ami['on'](_0x1348('0x32'),function(_0xd4d089){try{utils[_0x1348('0x1a')](util[_0x1348('0x1c')](_0x1348('0x33'),_0xd4d089[_0x1348('0x1f')]),_0xd4d089);calls[_0x1348('0x32')](_0xd4d089);recordings[_0x1348('0x32')](_0xd4d089);dials['hangup'](_0xd4d089);agents['hangup'](_0xd4d089);queues[_0x1348('0x32')](_0xd4d089);}catch(_0x5db379){utils['error'](util[_0x1348('0x1c')](_0x1348('0x33'),_0xd4d089[_0x1348('0x1f')]),_0x5db379);}});ami['on'](_0x1348('0x34'),function(_0x32967a){try{utils['debug'](util['format'](_0x1348('0x35'),_0x32967a['uniqueid']),_0x32967a);members[_0x1348('0x34')](_0x32967a);}catch(_0x22c2ad){utils[_0x1348('0x17')](util[_0x1348('0x1c')]('[%s][index][cdr]',_0x32967a[_0x1348('0x1f')]),_0x22c2ad);}});ami['on']('blindtransfer',function(_0x80e406){try{utils[_0x1348('0x1a')](util[_0x1348('0x1c')]('[%s][index][blindtransfer]',_0x80e406[_0x1348('0x1f')]),_0x80e406);queues[_0x1348('0x36')](_0x80e406);agents[_0x1348('0x36')](_0x80e406);transfers[_0x1348('0x36')](_0x80e406);recordings['blindtransfer'](_0x80e406);}catch(_0x334a61){utils[_0x1348('0x17')](util['format'](_0x1348('0x37'),_0x80e406['uniqueid']),_0x334a61);}});ami['on'](_0x1348('0x38'),function(_0x1e67ce){try{utils['debug'](util[_0x1348('0x1c')](_0x1348('0x39'),_0x1e67ce[_0x1348('0x3a')]),_0x1e67ce);queues[_0x1348('0x38')](_0x1e67ce);transfers[_0x1348('0x38')](_0x1e67ce);agents['attendedtransfer'](_0x1e67ce);calls['attendedtransfer'](_0x1e67ce);}catch(_0x2c90a8){utils[_0x1348('0x17')](util[_0x1348('0x1c')](_0x1348('0x39'),_0x1e67ce[_0x1348('0x3a')]),_0x2c90a8);}});ami['on'](_0x1348('0x3b'),function(_0x3ca500){try{utils[_0x1348('0x1a')](util[_0x1348('0x1c')]('[%s][index][varset]',_0x3ca500['uniqueid']),_0x3ca500);queues['varset'](_0x3ca500);recordings[_0x1348('0x3b')](_0x3ca500);calls[_0x1348('0x3b')](_0x3ca500);dials[_0x1348('0x3b')](_0x3ca500);}catch(_0x5736ea){utils[_0x1348('0x17')](util[_0x1348('0x1c')](_0x1348('0x3c'),_0x3ca500[_0x1348('0x1f')]),_0x5736ea);}});ami['on'](_0x1348('0x3d'),function(_0x57f663){try{utils[_0x1348('0x1a')](util[_0x1348('0x1c')]('[%s][index][newexten]',_0x57f663['uniqueid']),_0x57f663);calls[_0x1348('0x3d')](_0x57f663);recordings[_0x1348('0x3d')](_0x57f663);dials[_0x1348('0x3d')](_0x57f663);}catch(_0x4e1c45){utils[_0x1348('0x17')](util[_0x1348('0x1c')]('[%s][index][newexten]',_0x57f663[_0x1348('0x1f')]),_0x4e1c45);}});ami['on'](_0x1348('0x3e'),function(_0x4de032){try{utils[_0x1348('0x1a')](util[_0x1348('0x1c')](_0x1348('0x3f'),_0x4de032[_0x1348('0x1f')]),_0x4de032);calls[_0x1348('0x3e')](_0x4de032);recordings[_0x1348('0x3e')](_0x4de032);}catch(_0x5e51c3){utils['error'](util['format'](_0x1348('0x3f'),_0x4de032[_0x1348('0x1f')]),_0x5e51c3);}});ami['on'](_0x1348('0x40'),function(_0x27e6bd){try{utils['debug'](util[_0x1348('0x1c')]('[%s][index][dialbegin]',_0x27e6bd[_0x1348('0x1f')]),_0x27e6bd);dials[_0x1348('0x40')](_0x27e6bd);}catch(_0x4477d4){utils[_0x1348('0x17')](util[_0x1348('0x1c')](_0x1348('0x41'),_0x27e6bd['uniqueid']),_0x4477d4);}});ami['on'](_0x1348('0x42'),function(_0x2d6ac7){try{utils['debug'](util['format']('[%s][index][dialend]',_0x2d6ac7['uniqueid']),_0x2d6ac7);dials[_0x1348('0x42')](_0x2d6ac7);}catch(_0x73538b){utils[_0x1348('0x17')](util['format'](_0x1348('0x43'),_0x2d6ac7[_0x1348('0x1f')]),_0x73538b);}});} \ No newline at end of file +var _0xb0e6=['./core.controller','connect','shutdown','error','close','managerevent','devicestatechange','debug','format','device','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','env','production','local','asterisk','port','username','password','keepConnected','info','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller'];(function(_0x548f68,_0x2db63e){var _0x1adf80=function(_0x5b08e6){while(--_0x5b08e6){_0x548f68['push'](_0x548f68['shift']());}};_0x1adf80(++_0x2db63e);}(_0xb0e6,0x145));var _0x6b0e=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xb0e6[_0x46698a];return _0x356db0;};var AsteriskManager=require(_0x6b0e('0x0'));var config=require(_0x6b0e('0x1'));var utils=require(_0x6b0e('0x2'));var util=require(_0x6b0e('0x3'));var isXDREnabled=config[_0x6b0e('0x4')]&&config[_0x6b0e('0x4')]['disabled']?!config['xdr']['disabled']:!![];var isProduction=config[_0x6b0e('0x5')]===_0x6b0e('0x6')||![];var isLocalAsterisk=config[_0x6b0e('0x4')]&&config[_0x6b0e('0x4')][_0x6b0e('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x6b0e('0x8')][_0x6b0e('0x9')],config[_0x6b0e('0x8')]['ip'],config[_0x6b0e('0x8')][_0x6b0e('0xa')],config[_0x6b0e('0x8')][_0x6b0e('0xb')],!![]);ami[_0x6b0e('0xc')]();if(!isXDREnabled){utils['info']('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x6b0e('0xd')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x6b0e('0xe'));var calls=require(_0x6b0e('0xf'));var queues=require('./queues.controller');var recordings=require(_0x6b0e('0x10'));var members=require(_0x6b0e('0x11'));var dials=require(_0x6b0e('0x12'));var transfers=require(_0x6b0e('0x13'));var core=require(_0x6b0e('0x14'));ami['on'](_0x6b0e('0x15'),core['connect']);ami['on'](_0x6b0e('0x16'),core[_0x6b0e('0x16')]);ami['on']('fullybooted',core['fullybooted']);ami['on'](_0x6b0e('0x17'),core['error']);ami['on']('close',core[_0x6b0e('0x18')]);ami['on'](_0x6b0e('0x19'),core['managerevent']);ami['on'](_0x6b0e('0x1a'),function(_0x4ef40d){try{utils[_0x6b0e('0x1b')](util[_0x6b0e('0x1c')]('[%s][index][devicestatechange]',_0x4ef40d[_0x6b0e('0x1d')]),_0x4ef40d);members[_0x6b0e('0x1a')](_0x4ef40d);}catch(_0x68d1a){utils[_0x6b0e('0x17')](util[_0x6b0e('0x1c')](_0x6b0e('0x1e'),_0x4ef40d['device']),_0x68d1a);}});ami['on'](_0x6b0e('0x1f'),function(_0x2218ff){try{utils[_0x6b0e('0x1b')](util[_0x6b0e('0x1c')](_0x6b0e('0x20'),_0x2218ff[_0x6b0e('0x21')]),_0x2218ff);agents[_0x6b0e('0x1f')](_0x2218ff);}catch(_0x178144){utils[_0x6b0e('0x17')](util[_0x6b0e('0x1c')](_0x6b0e('0x20'),_0x2218ff[_0x6b0e('0x21')]),_0x178144);}});ami['on'](_0x6b0e('0x22'),function(_0x329862){try{utils[_0x6b0e('0x1b')](util[_0x6b0e('0x1c')](_0x6b0e('0x23'),_0x329862[_0x6b0e('0x21')]),_0x329862);agents[_0x6b0e('0x22')](_0x329862);}catch(_0x473fc8){utils[_0x6b0e('0x17')](util[_0x6b0e('0x1c')](_0x6b0e('0x23'),_0x329862['uniqueid']),_0x473fc8);}});ami['on']('agentconnect',function(_0x29c05c){try{utils[_0x6b0e('0x1b')](util[_0x6b0e('0x1c')](_0x6b0e('0x24'),_0x29c05c[_0x6b0e('0x21')]),_0x29c05c);agents[_0x6b0e('0x25')](_0x29c05c);queues['agentconnect'](_0x29c05c);}catch(_0x397da1){utils['error'](util['format'](_0x6b0e('0x24'),_0x29c05c[_0x6b0e('0x21')]),_0x397da1);}});ami['on'](_0x6b0e('0x26'),function(_0x10d0c3){try{utils[_0x6b0e('0x1b')](util[_0x6b0e('0x1c')](_0x6b0e('0x27'),_0x10d0c3[_0x6b0e('0x21')]),_0x10d0c3);agents['agentcomplete'](_0x10d0c3);queues['agentcomplete'](_0x10d0c3);members['agentcomplete'](_0x10d0c3);}catch(_0x285c56){utils[_0x6b0e('0x17')](util['format'](_0x6b0e('0x27'),_0x10d0c3[_0x6b0e('0x21')]),_0x285c56);}});ami['on'](_0x6b0e('0x28'),function(_0x42c285){try{utils['debug'](util['format'](_0x6b0e('0x29'),_0x42c285[_0x6b0e('0x21')]),_0x42c285);agents[_0x6b0e('0x28')](_0x42c285);queues['queuecallerabandon'](_0x42c285);}catch(_0x242530){utils[_0x6b0e('0x17')](util[_0x6b0e('0x1c')](_0x6b0e('0x29'),_0x42c285['uniqueid']),_0x242530);}});ami['on'](_0x6b0e('0x2a'),function(_0x2b60d0){try{utils[_0x6b0e('0x1b')](util[_0x6b0e('0x1c')](_0x6b0e('0x2b'),_0x2b60d0[_0x6b0e('0x21')]),_0x2b60d0);queues['queuecallerjoin'](_0x2b60d0);recordings['queuecallerjoin'](_0x2b60d0);}catch(_0x31d8c6){utils[_0x6b0e('0x17')](util['format'](_0x6b0e('0x2b'),_0x2b60d0[_0x6b0e('0x21')]),_0x31d8c6);}});ami['on'](_0x6b0e('0x2c'),function(_0xccab20){try{utils[_0x6b0e('0x1b')](util[_0x6b0e('0x1c')](_0x6b0e('0x2d'),_0xccab20[_0x6b0e('0x21')]),_0xccab20);queues[_0x6b0e('0x2c')](_0xccab20);}catch(_0x4b3a1b){utils[_0x6b0e('0x17')](util[_0x6b0e('0x1c')](_0x6b0e('0x2d'),_0xccab20[_0x6b0e('0x21')]),_0x4b3a1b);}});ami['on'](_0x6b0e('0x2e'),function(_0x3a0a98){try{utils[_0x6b0e('0x1b')](util[_0x6b0e('0x1c')](_0x6b0e('0x2f'),_0x3a0a98['uniqueid']),_0x3a0a98);queues[_0x6b0e('0x2e')](_0x3a0a98);calls[_0x6b0e('0x2e')](_0x3a0a98);}catch(_0x4bf4ff){utils[_0x6b0e('0x17')](util['format']('[%s][index][musiconholdstart]',_0x3a0a98[_0x6b0e('0x21')]),_0x4bf4ff);}});ami['on'](_0x6b0e('0x30'),function(_0x22aa86){try{utils[_0x6b0e('0x1b')](util[_0x6b0e('0x1c')](_0x6b0e('0x31'),_0x22aa86['uniqueid']),_0x22aa86);queues[_0x6b0e('0x30')](_0x22aa86);calls[_0x6b0e('0x30')](_0x22aa86);}catch(_0x430548){utils[_0x6b0e('0x17')](util[_0x6b0e('0x1c')](_0x6b0e('0x31'),_0x22aa86['uniqueid']),_0x430548);}});ami['on'](_0x6b0e('0x32'),function(_0x5e0417){try{utils[_0x6b0e('0x1b')](util['format']('[%s][index][newstate]',_0x5e0417['uniqueid']),_0x5e0417);calls[_0x6b0e('0x32')](_0x5e0417);recordings[_0x6b0e('0x32')](_0x5e0417);}catch(_0x1e8fe3){utils['error'](util[_0x6b0e('0x1c')](_0x6b0e('0x33'),_0x5e0417[_0x6b0e('0x21')]),_0x1e8fe3);}});ami['on']('hangup',function(_0x9a7cf8){try{utils['debug'](util[_0x6b0e('0x1c')]('[%s][index][hangup]',_0x9a7cf8['uniqueid']),_0x9a7cf8);calls['hangup'](_0x9a7cf8);recordings['hangup'](_0x9a7cf8);dials['hangup'](_0x9a7cf8);agents[_0x6b0e('0x34')](_0x9a7cf8);queues[_0x6b0e('0x34')](_0x9a7cf8);}catch(_0x3b9be3){utils[_0x6b0e('0x17')](util['format'](_0x6b0e('0x35'),_0x9a7cf8[_0x6b0e('0x21')]),_0x3b9be3);}});ami['on'](_0x6b0e('0x36'),function(_0x13f316){try{utils[_0x6b0e('0x1b')](util['format']('[%s][index][cdr]',_0x13f316['uniqueid']),_0x13f316);members[_0x6b0e('0x36')](_0x13f316);}catch(_0x3e2983){utils['error'](util['format']('[%s][index][cdr]',_0x13f316[_0x6b0e('0x21')]),_0x3e2983);}});ami['on']('blindtransfer',function(_0x11663c){try{utils[_0x6b0e('0x1b')](util[_0x6b0e('0x1c')]('[%s][index][blindtransfer]',_0x11663c[_0x6b0e('0x21')]),_0x11663c);queues['blindtransfer'](_0x11663c);agents[_0x6b0e('0x37')](_0x11663c);transfers[_0x6b0e('0x37')](_0x11663c);recordings[_0x6b0e('0x37')](_0x11663c);}catch(_0xe10059){utils[_0x6b0e('0x17')](util[_0x6b0e('0x1c')]('[%s][index][blindtransfer]',_0x11663c[_0x6b0e('0x21')]),_0xe10059);}});ami['on'](_0x6b0e('0x38'),function(_0x52e0c){try{utils[_0x6b0e('0x1b')](util['format'](_0x6b0e('0x39'),_0x52e0c[_0x6b0e('0x3a')]),_0x52e0c);queues[_0x6b0e('0x38')](_0x52e0c);transfers[_0x6b0e('0x38')](_0x52e0c);agents[_0x6b0e('0x38')](_0x52e0c);calls[_0x6b0e('0x38')](_0x52e0c);}catch(_0x47494c){utils[_0x6b0e('0x17')](util[_0x6b0e('0x1c')]('[%s][index][attendedtransfer]',_0x52e0c[_0x6b0e('0x3a')]),_0x47494c);}});ami['on'](_0x6b0e('0x3b'),function(_0xa35f29){try{utils[_0x6b0e('0x1b')](util[_0x6b0e('0x1c')](_0x6b0e('0x3c'),_0xa35f29['uniqueid']),_0xa35f29);queues[_0x6b0e('0x3b')](_0xa35f29);recordings[_0x6b0e('0x3b')](_0xa35f29);calls[_0x6b0e('0x3b')](_0xa35f29);dials[_0x6b0e('0x3b')](_0xa35f29);}catch(_0x3c2aa3){utils[_0x6b0e('0x17')](util[_0x6b0e('0x1c')](_0x6b0e('0x3c'),_0xa35f29[_0x6b0e('0x21')]),_0x3c2aa3);}});ami['on'](_0x6b0e('0x3d'),function(_0x1666c0){try{utils[_0x6b0e('0x1b')](util[_0x6b0e('0x1c')](_0x6b0e('0x3e'),_0x1666c0[_0x6b0e('0x21')]),_0x1666c0);calls[_0x6b0e('0x3d')](_0x1666c0);recordings[_0x6b0e('0x3d')](_0x1666c0);dials[_0x6b0e('0x3d')](_0x1666c0);}catch(_0x3f5b4b){utils[_0x6b0e('0x17')](util[_0x6b0e('0x1c')](_0x6b0e('0x3e'),_0x1666c0['uniqueid']),_0x3f5b4b);}});ami['on'](_0x6b0e('0x3f'),function(_0x505921){try{utils[_0x6b0e('0x1b')](util[_0x6b0e('0x1c')](_0x6b0e('0x40'),_0x505921[_0x6b0e('0x21')]),_0x505921);calls[_0x6b0e('0x3f')](_0x505921);recordings[_0x6b0e('0x3f')](_0x505921);}catch(_0x401566){utils[_0x6b0e('0x17')](util[_0x6b0e('0x1c')](_0x6b0e('0x40'),_0x505921[_0x6b0e('0x21')]),_0x401566);}});ami['on'](_0x6b0e('0x41'),function(_0xeb09b7){try{utils[_0x6b0e('0x1b')](util[_0x6b0e('0x1c')](_0x6b0e('0x42'),_0xeb09b7[_0x6b0e('0x21')]),_0xeb09b7);dials[_0x6b0e('0x41')](_0xeb09b7);}catch(_0x377dbd){utils[_0x6b0e('0x17')](util[_0x6b0e('0x1c')](_0x6b0e('0x43'),_0xeb09b7['uniqueid']),_0x377dbd);}});ami['on']('dialend',function(_0x32d578){try{utils[_0x6b0e('0x1b')](util['format'](_0x6b0e('0x44'),_0x32d578['uniqueid']),_0x32d578);dials['dialend'](_0x32d578);}catch(_0x59dc1b){utils[_0x6b0e('0x17')](util[_0x6b0e('0x1c')](_0x6b0e('0x44'),_0x32d578[_0x6b0e('0x21')]),_0x59dc1b);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 8708973..5b215fa 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 _0xfa7a=['split','then','catch','error','[%s][members][writeDB]','some','devicestatechange','debug','uniqueid','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','device','state','INUSE','BUSY','voice','now','isNil','exitAt','duration','diffTime','enterAt','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','data1','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','data3','lodash','util','./utils','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','type','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName'];(function(_0x1d046a,_0x30db41){var _0x2c0b0c=function(_0x30a3c5){while(--_0x30a3c5){_0x1d046a['push'](_0x1d046a['shift']());}};_0x2c0b0c(++_0x30db41);}(_0xfa7a,0x1ed));var _0xafa7=function(_0x40c4e4,_0x1b9fcd){_0x40c4e4=_0x40c4e4-0x0;var _0x5c4113=_0xfa7a[_0x40c4e4];return _0x5c4113;};'use strict';var _=require(_0xafa7('0x0'));var util=require(_0xafa7('0x1'));var utils=require(_0xafa7('0x2'));var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x336c0e){utils[_0xafa7('0x3')](util[_0xafa7('0x4')](_0xafa7('0x5'),_0x336c0e['uniqueid'],_0x336c0e[_0xafa7('0x6')],_0x336c0e[_0xafa7('0x7')],_0x336c0e[_0xafa7('0x8')],_0x336c0e[_0xafa7('0x9')],_0x336c0e[_0xafa7('0xa')]));if(_0x336c0e[_0xafa7('0x6')]){utils[_0xafa7('0xb')](_0x336c0e[_0xafa7('0x6')])['then'](function(_0x141f50){if(_0x141f50){_0x336c0e['membername']=_0x141f50[_0xafa7('0xc')];_0x336c0e[_0xafa7('0xd')]=_0x141f50['internal'];utils[_0xafa7('0xe')](_0xafa7('0xf'),_0x336c0e);}else{utils[_0xafa7('0x10')](_0x336c0e[_0xafa7('0x6')][_0xafa7('0x11')]('/')[0x1])[_0xafa7('0x12')](function(_0x15f5e1){if(_0x15f5e1){_0x336c0e[_0xafa7('0x9')]=_0x15f5e1['name'];_0x336c0e['internal']=_0x15f5e1[_0xafa7('0xd')];utils['request'](_0xafa7('0xf'),_0x336c0e);}});}})[_0xafa7('0x13')](function(_0x5f1101){utils[_0xafa7('0x14')](util['format'](_0xafa7('0x15'),_0x336c0e['uniqueid']),_0x5f1101);});}delete members[_0x336c0e[_0xafa7('0x6')]];}function startsWith(_0x7660e2,_0x4e6986){return _[_0xafa7('0x16')](_0x7660e2,function(_0x52c4e3){return _['startsWith'](_0x4e6986,_0x52c4e3);});}exports[_0xafa7('0x17')]=function(_0x58c121){try{utils[_0xafa7('0x18')](util['format']('[%s][members][devicestatechange]',members[_0x58c121['device']]?members[_0x58c121['device']][_0xafa7('0x19')]:_0x58c121['device']),_0x58c121);utils[_0xafa7('0x3')](util[_0xafa7('0x4')](_0xafa7('0x1a'),members[_0x58c121['device']]?members[_0x58c121[_0xafa7('0x1b')]]['uniqueid']:_0x58c121[_0xafa7('0x1b')],_0x58c121['state'],_0x58c121[_0xafa7('0x1b')]));switch(_0x58c121[_0xafa7('0x1c')]){case _0xafa7('0x1d'):case _0xafa7('0x1e'):if(!startsWith(exclude,_0x58c121['device'])){members[_0x58c121['device']]={'channel':_0xafa7('0x1f'),'interface':_0x58c121[_0xafa7('0x1b')],'type':'TALKING','enterAt':utils[_0xafa7('0x20')](),'role':'agent'};}break;case'NOT_INUSE':if(!_[_0xafa7('0x21')](members[_0x58c121['device']])){members[_0x58c121[_0xafa7('0x1b')]][_0xafa7('0x22')]=utils[_0xafa7('0x20')]();members[_0x58c121[_0xafa7('0x1b')]][_0xafa7('0x23')]=utils[_0xafa7('0x24')](members[_0x58c121['device']][_0xafa7('0x22')],members[_0x58c121[_0xafa7('0x1b')]][_0xafa7('0x25')]);if(members[_0x58c121['device']]['uniqueid']){writeDB(members[_0x58c121[_0xafa7('0x1b')]]);}}break;default:break;}}catch(_0x33bd34){utils[_0xafa7('0x14')](util[_0xafa7('0x4')](_0xafa7('0x26'),members[_0x58c121['device']]?members[_0x58c121[_0xafa7('0x1b')]]['uniqueid']:_0x58c121[_0xafa7('0x1b')]),_0x33bd34);}};exports[_0xafa7('0x27')]=function(_0x75522c){try{if(!_['isNil'](members[_0x75522c[_0xafa7('0x6')]])){utils['debug'](util[_0xafa7('0x4')](_0xafa7('0x28'),_0x75522c[_0xafa7('0x19')]),_0x75522c);utils['info'](util[_0xafa7('0x4')](_0xafa7('0x29'),_0x75522c[_0xafa7('0x19')],_0x75522c[_0xafa7('0x6')],_0x75522c['queue']));members[_0x75522c[_0xafa7('0x6')]]=_[_0xafa7('0x2a')](members[_0x75522c[_0xafa7('0x6')]],{'data4':_0x75522c[_0xafa7('0x2b')],'uniqueid':_0x75522c[_0xafa7('0x19')]});}}catch(_0xa496cc){utils[_0xafa7('0x14')](util[_0xafa7('0x4')](_0xafa7('0x28'),_0x75522c[_0xafa7('0x19')]),_0xa496cc);}};exports[_0xafa7('0x2c')]=function(_0x288423){try{utils['debug'](util['format']('[%s][members][cdr]',_0x288423[_0xafa7('0x19')]),_0x288423);if(_0x288423['channel']){var _0x29ea03=_0x288423[_0xafa7('0x7')][_0xafa7('0x11')]('-')[0x0];if(!_[_0xafa7('0x21')](members[_0x29ea03])){members[_0x29ea03]=_[_0xafa7('0x2a')](members[_0x29ea03],{'data1':members[_0x29ea03][_0xafa7('0x2d')]||_0x288423[_0xafa7('0xa')],'data2':members[_0x29ea03][_0xafa7('0x8')]||_0x288423[_0xafa7('0x2e')],'data3':members[_0x29ea03]['data3']||_0x288423[_0xafa7('0x2f')],'uniqueid':members[_0x29ea03][_0xafa7('0x19')]||_0x288423[_0xafa7('0x19')]});utils['info'](util[_0xafa7('0x4')](_0xafa7('0x30'),_0x288423[_0xafa7('0x19')],members[_0x29ea03][_0xafa7('0x2d')],members[_0x29ea03][_0xafa7('0x8')],members[_0x29ea03]['data3']));if(members[_0x29ea03][_0xafa7('0x22')]){writeDB(members[_0x29ea03]);}}}if(_0x288423[_0xafa7('0x31')]){var _0x2d5ccf=_0x288423[_0xafa7('0x31')]['split']('-')[0x0];if(!_[_0xafa7('0x21')](members[_0x2d5ccf])){members[_0x2d5ccf]=_[_0xafa7('0x2a')](members[_0x2d5ccf],{'data1':members[_0x2d5ccf][_0xafa7('0x2d')]||_0x288423[_0xafa7('0xa')],'data2':members[_0x2d5ccf][_0xafa7('0x8')]||_0x288423['source'],'data3':members[_0x2d5ccf][_0xafa7('0x32')]||_0x288423[_0xafa7('0x2f')],'uniqueid':members[_0x2d5ccf][_0xafa7('0x19')]||_0x288423[_0xafa7('0x19')]});utils[_0xafa7('0x3')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x288423[_0xafa7('0x19')],members[_0x2d5ccf][_0xafa7('0x2d')],members[_0x2d5ccf][_0xafa7('0x8')],members[_0x2d5ccf][_0xafa7('0x32')]));if(members[_0x2d5ccf]['exitAt']){writeDB(members[_0x2d5ccf]);}}}}catch(_0x471702){utils[_0xafa7('0x14')](util[_0xafa7('0x4')]('[%s][members][cdr]',_0x288423[_0xafa7('0x19')]),_0x471702);}}; \ No newline at end of file +var _0x6fad=['[%s][members][devicestatechange]','debug','[%s][members][agentcomplete]','info','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','[%s][members][cdr]','assign','data1','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','source','lodash','util','./utils','Local/_attended@transfer','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','data2','membername','type','name','internal','getUserByName','split','then','CreateMemberReport','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','exitAt','duration','diffTime'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6fad,0x174));var _0xd6fa=function(_0x4d389d,_0xec145d){_0x4d389d=_0x4d389d-0x0;var _0x22bd25=_0x6fad[_0x4d389d];return _0x22bd25;};'use strict';var _=require(_0xd6fa('0x0'));var util=require(_0xd6fa('0x1'));var utils=require(_0xd6fa('0x2'));var members={};var exclude=[_0xd6fa('0x3'),'Queue:'];function writeDB(_0x2f5f9b){utils['info'](util[_0xd6fa('0x4')](_0xd6fa('0x5'),_0x2f5f9b[_0xd6fa('0x6')],_0x2f5f9b[_0xd6fa('0x7')],_0x2f5f9b['channel'],_0x2f5f9b[_0xd6fa('0x8')],_0x2f5f9b[_0xd6fa('0x9')],_0x2f5f9b[_0xd6fa('0xa')]));if(_0x2f5f9b[_0xd6fa('0x7')]){utils['getUserByInterface'](_0x2f5f9b[_0xd6fa('0x7')])['then'](function(_0x92911b){if(_0x92911b){_0x2f5f9b[_0xd6fa('0x9')]=_0x92911b[_0xd6fa('0xb')];_0x2f5f9b[_0xd6fa('0xc')]=_0x92911b[_0xd6fa('0xc')];utils['request']('CreateMemberReport',_0x2f5f9b);}else{utils[_0xd6fa('0xd')](_0x2f5f9b[_0xd6fa('0x7')][_0xd6fa('0xe')]('/')[0x1])[_0xd6fa('0xf')](function(_0x3dd6bb){if(_0x3dd6bb){_0x2f5f9b['membername']=_0x3dd6bb['name'];_0x2f5f9b[_0xd6fa('0xc')]=_0x3dd6bb['internal'];utils['request'](_0xd6fa('0x10'),_0x2f5f9b);}});}})[_0xd6fa('0x11')](function(_0x1bcecd){utils[_0xd6fa('0x12')](util[_0xd6fa('0x4')](_0xd6fa('0x13'),_0x2f5f9b[_0xd6fa('0x6')]),_0x1bcecd);});}delete members[_0x2f5f9b[_0xd6fa('0x7')]];}function startsWith(_0x45f777,_0x5b853a){return _[_0xd6fa('0x14')](_0x45f777,function(_0x4082c5){return _[_0xd6fa('0x15')](_0x5b853a,_0x4082c5);});}exports[_0xd6fa('0x16')]=function(_0x47e70a){try{utils['debug'](util['format']('[%s][members][devicestatechange]',members[_0x47e70a['device']]?members[_0x47e70a[_0xd6fa('0x17')]]['uniqueid']:_0x47e70a[_0xd6fa('0x17')]),_0x47e70a);utils['info'](util[_0xd6fa('0x4')](_0xd6fa('0x18'),members[_0x47e70a[_0xd6fa('0x17')]]?members[_0x47e70a[_0xd6fa('0x17')]][_0xd6fa('0x6')]:_0x47e70a[_0xd6fa('0x17')],_0x47e70a[_0xd6fa('0x19')],_0x47e70a[_0xd6fa('0x17')]));switch(_0x47e70a[_0xd6fa('0x19')]){case _0xd6fa('0x1a'):case _0xd6fa('0x1b'):if(!startsWith(exclude,_0x47e70a[_0xd6fa('0x17')])){members[_0x47e70a[_0xd6fa('0x17')]]={'channel':_0xd6fa('0x1c'),'interface':_0x47e70a[_0xd6fa('0x17')],'type':_0xd6fa('0x1d'),'enterAt':utils[_0xd6fa('0x1e')](),'role':_0xd6fa('0x1f')};}break;case _0xd6fa('0x20'):if(!_['isNil'](members[_0x47e70a['device']])){members[_0x47e70a[_0xd6fa('0x17')]][_0xd6fa('0x21')]=utils[_0xd6fa('0x1e')]();members[_0x47e70a[_0xd6fa('0x17')]][_0xd6fa('0x22')]=utils[_0xd6fa('0x23')](members[_0x47e70a['device']][_0xd6fa('0x21')],members[_0x47e70a[_0xd6fa('0x17')]]['enterAt']);if(members[_0x47e70a[_0xd6fa('0x17')]][_0xd6fa('0x6')]){writeDB(members[_0x47e70a[_0xd6fa('0x17')]]);}}break;default:break;}}catch(_0x47b073){utils[_0xd6fa('0x12')](util[_0xd6fa('0x4')](_0xd6fa('0x24'),members[_0x47e70a[_0xd6fa('0x17')]]?members[_0x47e70a[_0xd6fa('0x17')]][_0xd6fa('0x6')]:_0x47e70a[_0xd6fa('0x17')]),_0x47b073);}};exports['agentcomplete']=function(_0x2a59c0){try{if(!_['isNil'](members[_0x2a59c0[_0xd6fa('0x7')]])){utils[_0xd6fa('0x25')](util['format'](_0xd6fa('0x26'),_0x2a59c0[_0xd6fa('0x6')]),_0x2a59c0);utils[_0xd6fa('0x27')](util[_0xd6fa('0x4')](_0xd6fa('0x28'),_0x2a59c0[_0xd6fa('0x6')],_0x2a59c0[_0xd6fa('0x7')],_0x2a59c0[_0xd6fa('0x29')]));members[_0x2a59c0[_0xd6fa('0x7')]]=_['assign'](members[_0x2a59c0[_0xd6fa('0x7')]],{'data4':_0x2a59c0[_0xd6fa('0x29')],'uniqueid':_0x2a59c0['uniqueid']});}}catch(_0x27b9ed){utils[_0xd6fa('0x12')](util[_0xd6fa('0x4')](_0xd6fa('0x26'),_0x2a59c0[_0xd6fa('0x6')]),_0x27b9ed);}};exports[_0xd6fa('0x2a')]=function(_0x3c6af2){try{utils[_0xd6fa('0x25')](util[_0xd6fa('0x4')](_0xd6fa('0x2b'),_0x3c6af2[_0xd6fa('0x6')]),_0x3c6af2);if(_0x3c6af2['channel']){var _0x2d934d=_0x3c6af2['channel'][_0xd6fa('0xe')]('-')[0x0];if(!_['isNil'](members[_0x2d934d])){members[_0x2d934d]=_[_0xd6fa('0x2c')](members[_0x2d934d],{'data1':members[_0x2d934d][_0xd6fa('0x2d')]||_0x3c6af2['type'],'data2':members[_0x2d934d][_0xd6fa('0x8')]||_0x3c6af2['source'],'data3':members[_0x2d934d][_0xd6fa('0x2e')]||_0x3c6af2[_0xd6fa('0x2f')],'uniqueid':members[_0x2d934d][_0xd6fa('0x6')]||_0x3c6af2['uniqueid']});utils['info'](util[_0xd6fa('0x4')](_0xd6fa('0x30'),_0x3c6af2[_0xd6fa('0x6')],members[_0x2d934d]['data1'],members[_0x2d934d][_0xd6fa('0x8')],members[_0x2d934d][_0xd6fa('0x2e')]));if(members[_0x2d934d][_0xd6fa('0x21')]){writeDB(members[_0x2d934d]);}}}if(_0x3c6af2[_0xd6fa('0x31')]){var _0x2bd852=_0x3c6af2[_0xd6fa('0x31')][_0xd6fa('0xe')]('-')[0x0];if(!_['isNil'](members[_0x2bd852])){members[_0x2bd852]=_[_0xd6fa('0x2c')](members[_0x2bd852],{'data1':members[_0x2bd852][_0xd6fa('0x2d')]||_0x3c6af2[_0xd6fa('0xa')],'data2':members[_0x2bd852][_0xd6fa('0x8')]||_0x3c6af2[_0xd6fa('0x32')],'data3':members[_0x2bd852][_0xd6fa('0x2e')]||_0x3c6af2[_0xd6fa('0x2f')],'uniqueid':members[_0x2bd852][_0xd6fa('0x6')]||_0x3c6af2['uniqueid']});utils[_0xd6fa('0x27')](util[_0xd6fa('0x4')](_0xd6fa('0x30'),_0x3c6af2[_0xd6fa('0x6')],members[_0x2bd852][_0xd6fa('0x2d')],members[_0x2bd852][_0xd6fa('0x8')],members[_0x2bd852][_0xd6fa('0x2e')]));if(members[_0x2bd852][_0xd6fa('0x21')]){writeDB(members[_0x2bd852]);}}}}catch(_0x141f13){utils['error'](util[_0xd6fa('0x4')](_0xd6fa('0x2b'),_0x3c6af2[_0xd6fa('0x6')]),_0x141f13);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index efb25b6..3815829 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 _0x7c35=['variable','queuestatus','toUpperCase','CONTINUE','queuecallerexitAt','queuecallerexitreason','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerabandonAt','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','queuecallerleave','diffTime','queuecallerleaveAt','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','[%s][queues][agentcomplete]','assigned','queuecallercompleteAt','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','[%s][queues][attendedtransfer]','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfereruniqueid','origtransfererexten','ATTENDED','transfereelinkedid','queuecallerenterreason','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','clone','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]','./utils','info','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][varset]'];(function(_0x8b8564,_0x162976){var _0x360c61=function(_0x164cc9){while(--_0x164cc9){_0x8b8564['push'](_0x8b8564['shift']());}};_0x360c61(++_0x162976);}(_0x7c35,0xab));var _0x57c3=function(_0x3b49d9,_0x56d7e6){_0x3b49d9=_0x3b49d9-0x0;var _0x51b418=_0x7c35[_0x3b49d9];return _0x51b418;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x57c3('0x0'));var queues={};function writeDB(_0x5ef0b0){utils[_0x57c3('0x1')](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x5ef0b0[_0x57c3('0x2')],_0x5ef0b0[_0x57c3('0x3')],_0x5ef0b0['queue'],_0x5ef0b0[_0x57c3('0x4')],_0x5ef0b0[_0x57c3('0x5')],_0x5ef0b0[_0x57c3('0x6')],_0x5ef0b0['queuecallerexitreason']));if(_0x5ef0b0[_0x57c3('0x7')]){utils[_0x57c3('0x8')](_0x5ef0b0[_0x57c3('0x7')])[_0x57c3('0x9')](function(_0xa28f54){if(_0xa28f54){_0x5ef0b0['type']=_0xa28f54[_0x57c3('0xa')];}utils[_0x57c3('0xb')](_0x57c3('0xc'),_0x5ef0b0);});}else{utils[_0x57c3('0xb')](_0x57c3('0xc'),_0x5ef0b0);}if(_0x5ef0b0[_0x57c3('0xd')]){delete queues[_0x5ef0b0['transfereduniqueid']];}else{delete queues[_0x5ef0b0[_0x57c3('0x2')]];}}exports[_0x57c3('0xe')]=function(_0x425200){try{utils[_0x57c3('0xf')](util[_0x57c3('0x10')](_0x57c3('0x11'),_0x425200[_0x57c3('0x2')]),_0x425200);utils[_0x57c3('0x1')](util[_0x57c3('0x10')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x425200['uniqueid'],_0x425200[_0x57c3('0x7')],_0x425200[_0x57c3('0x12')]));queues[_0x425200[_0x57c3('0x2')]]=_[_0x57c3('0x13')](_0x425200,{'originalposition':_0x425200['position'],'queuecallerjoinAt':utils[_0x57c3('0x14')](),'mohtime':0x0});}catch(_0x197c8a){utils[_0x57c3('0x15')](util[_0x57c3('0x10')]('[%s][queues][queuecallerjoin]',_0x425200[_0x57c3('0x2')]),_0x197c8a);}};exports[_0x57c3('0x16')]=function(_0xe5380a){try{if(!_[_0x57c3('0x17')](queues[_0xe5380a[_0x57c3('0x2')]])){utils[_0x57c3('0xf')](util[_0x57c3('0x10')](_0x57c3('0x18'),_0xe5380a[_0x57c3('0x2')]),_0xe5380a);if(queues[_0xe5380a[_0x57c3('0x2')]]['queuecallerleaveAt']){if(!queues[_0xe5380a[_0x57c3('0x2')]][_0x57c3('0x19')]&&!queues[_0xe5380a[_0x57c3('0x2')]][_0x57c3('0x1a')]){queues[_0xe5380a['uniqueid']][_0x57c3('0x1b')]=!![];queues[_0xe5380a[_0x57c3('0x2')]]['queuecallercompleteAt']=utils[_0x57c3('0x14')]();queues[_0xe5380a[_0x57c3('0x2')]]['queuecallerexitreason']=_0x57c3('0x1c');}utils[_0x57c3('0x1')](util[_0x57c3('0x10')](_0x57c3('0x1d'),_0xe5380a[_0x57c3('0x2')],queues[_0xe5380a[_0x57c3('0x2')]][_0x57c3('0x1e')],queues[_0xe5380a[_0x57c3('0x2')]]['queuecallerexitreason']));writeDB(queues[_0xe5380a[_0x57c3('0x2')]]);}else if(queues[_0xe5380a[_0x57c3('0x2')]][_0x57c3('0xd')]){utils[_0x57c3('0x1')](util[_0x57c3('0x10')](_0x57c3('0x1f'),_0xe5380a[_0x57c3('0x2')],queues[_0xe5380a[_0x57c3('0x2')]][_0x57c3('0x1e')],queues[_0xe5380a[_0x57c3('0x2')]][_0x57c3('0xd')]));queues[queues[_0xe5380a[_0x57c3('0x2')]][_0x57c3('0xd')]]=queues[_0xe5380a[_0x57c3('0x2')]];queues[queues[_0xe5380a[_0x57c3('0x2')]][_0x57c3('0xd')]]['queuecallerenterreason']=0x2;delete queues[_0xe5380a['uniqueid']];}}}catch(_0x10fc60){utils[_0x57c3('0x15')](util[_0x57c3('0x10')](_0x57c3('0x18'),_0xe5380a[_0x57c3('0x2')]),_0x10fc60);}};exports['varset']=function(_0x3c55c8){try{utils['debug'](util[_0x57c3('0x10')](_0x57c3('0x20'),_0x3c55c8[_0x57c3('0x2')]),_0x3c55c8);if(!_[_0x57c3('0x17')](_0x3c55c8[_0x57c3('0x21')][_0x57c3('0x22')])&&_0x3c55c8['value'][_0x57c3('0x23')]()!==_0x57c3('0x24')){if(!_[_0x57c3('0x17')](queues[_0x3c55c8[_0x57c3('0x2')]])){queues[_0x3c55c8[_0x57c3('0x2')]]['queuecallerabandon']=![];queues[_0x3c55c8[_0x57c3('0x2')]]['queuecallerabandonAt']=null;queues[_0x3c55c8[_0x57c3('0x2')]][_0x57c3('0x1a')]=!![];queues[_0x3c55c8[_0x57c3('0x2')]][_0x57c3('0x25')]=utils['now']();queues[_0x3c55c8['uniqueid']][_0x57c3('0x26')]=_0x3c55c8[_0x57c3('0x27')]['toUpperCase']();utils[_0x57c3('0x1')](util[_0x57c3('0x10')](_0x57c3('0x28'),_0x3c55c8[_0x57c3('0x2')],queues[_0x3c55c8[_0x57c3('0x2')]][_0x57c3('0x1e')],_0x3c55c8[_0x57c3('0x27')],queues[_0x3c55c8[_0x57c3('0x2')]]['queuecallerexitreason']));writeDB(queues[_0x3c55c8[_0x57c3('0x2')]]);}}else if(!_[_0x57c3('0x17')](_0x3c55c8[_0x57c3('0x21')][_0x57c3('0x29')])){if(!_[_0x57c3('0x17')](queues[_0x3c55c8['uniqueid']])&&!queues[_0x3c55c8[_0x57c3('0x2')]][_0x57c3('0x19')]){queues[_0x3c55c8['uniqueid']][_0x57c3('0x19')]=![];queues[_0x3c55c8[_0x57c3('0x2')]]['queuecallerabandonAt']=null;queues[_0x3c55c8['uniqueid']][_0x57c3('0x1a')]=!![];queues[_0x3c55c8['uniqueid']]['queuecallerexitAt']=utils[_0x57c3('0x14')]();queues[_0x3c55c8[_0x57c3('0x2')]][_0x57c3('0x26')]=_0x57c3('0x2a');utils['info'](util[_0x57c3('0x10')](_0x57c3('0x2b'),_0x3c55c8[_0x57c3('0x2')],queues[_0x3c55c8[_0x57c3('0x2')]][_0x57c3('0x1e')],_0x3c55c8[_0x57c3('0x27')],queues[_0x3c55c8[_0x57c3('0x2')]][_0x57c3('0x26')]));}}}catch(_0x1fc340){utils['error'](util[_0x57c3('0x10')]('[%s][queues][varset]',_0x3c55c8[_0x57c3('0x2')]),_0x1fc340);}};exports[_0x57c3('0x19')]=function(_0x373353){try{if(!_[_0x57c3('0x17')](queues[_0x373353[_0x57c3('0x2')]])){utils[_0x57c3('0xf')](util[_0x57c3('0x10')](_0x57c3('0x2c'),_0x373353[_0x57c3('0x2')]),_0x373353);queues[_0x373353[_0x57c3('0x2')]][_0x57c3('0x1a')]=![];queues[_0x373353[_0x57c3('0x2')]]['queuecallerexitAt']=null;queues[_0x373353[_0x57c3('0x2')]][_0x57c3('0x19')]=!![];queues[_0x373353['uniqueid']][_0x57c3('0x2d')]=utils[_0x57c3('0x14')]();queues[_0x373353[_0x57c3('0x2')]][_0x57c3('0x26')]='ABANDONED';utils[_0x57c3('0x1')](util[_0x57c3('0x10')](_0x57c3('0x2e'),_0x373353['uniqueid'],queues[_0x373353[_0x57c3('0x2')]][_0x57c3('0x1e')],queues[_0x373353[_0x57c3('0x2')]][_0x57c3('0x26')]));}}catch(_0x33bad9){utils[_0x57c3('0x15')](util[_0x57c3('0x10')](_0x57c3('0x2c'),_0x373353[_0x57c3('0x2')]),_0x33bad9);}};exports['queuecallerleave']=function(_0x4ce671){try{if(!_[_0x57c3('0x17')](queues[_0x4ce671[_0x57c3('0x2')]])){utils[_0x57c3('0xf')](util[_0x57c3('0x10')](_0x57c3('0x2f'),_0x4ce671[_0x57c3('0x2')]),_0x4ce671);utils['info'](util[_0x57c3('0x10')](_0x57c3('0x30'),_0x4ce671[_0x57c3('0x2')],queues[_0x4ce671[_0x57c3('0x2')]][_0x57c3('0x1e')],_0x4ce671['connectedlinenum'],_0x4ce671['connectedlinename']));queues[_0x4ce671[_0x57c3('0x2')]][_0x57c3('0x31')]=!![];queues[_0x4ce671[_0x57c3('0x2')]]['queuecallerleaveAt']=utils[_0x57c3('0x14')]();queues[_0x4ce671['uniqueid']]['holdtime']=utils[_0x57c3('0x32')](queues[_0x4ce671['uniqueid']][_0x57c3('0x33')],queues[_0x4ce671[_0x57c3('0x2')]][_0x57c3('0x34')]);queues[_0x4ce671[_0x57c3('0x2')]][_0x57c3('0x12')]=_0x4ce671['position'];queues[_0x4ce671[_0x57c3('0x2')]][_0x57c3('0x35')]=_0x4ce671[_0x57c3('0x35')];queues[_0x4ce671[_0x57c3('0x2')]]['connectedlinenum']=_0x4ce671['connectedlinenum'];queues[_0x4ce671[_0x57c3('0x2')]]['connectedlinename']=_0x4ce671[_0x57c3('0x36')];}}catch(_0x6705f){utils['error'](util[_0x57c3('0x10')](_0x57c3('0x2f'),_0x4ce671[_0x57c3('0x2')]),_0x6705f);}};exports[_0x57c3('0x37')]=function(_0x270d14){try{if(!_[_0x57c3('0x17')](queues[_0x270d14['uniqueid']])){utils[_0x57c3('0xf')](util[_0x57c3('0x10')](_0x57c3('0x38'),_0x270d14[_0x57c3('0x2')]),_0x270d14);utils['info'](util[_0x57c3('0x10')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x270d14['uniqueid'],queues[_0x270d14['uniqueid']]['name'],_0x270d14[_0x57c3('0x39')],_0x270d14[_0x57c3('0x3a')]));queues[_0x270d14[_0x57c3('0x2')]]['queuecallerabandon']=![];queues[_0x270d14[_0x57c3('0x2')]][_0x57c3('0x19')]=![];queues[_0x270d14[_0x57c3('0x2')]][_0x57c3('0x2d')]=null;queues[_0x270d14[_0x57c3('0x2')]][_0x57c3('0x1a')]=![];queues[_0x270d14[_0x57c3('0x2')]][_0x57c3('0x26')]=null;queues[_0x270d14[_0x57c3('0x2')]][_0x57c3('0x25')]=null;queues[_0x270d14[_0x57c3('0x2')]]['assigned']=!![];queues[_0x270d14[_0x57c3('0x2')]][_0x57c3('0x6')]=_0x270d14['destaccountcode'];queues[_0x270d14[_0x57c3('0x2')]]['lastAssignedTo']=_0x270d14['membername'];}}catch(_0x518d45){utils[_0x57c3('0x15')](util[_0x57c3('0x10')](_0x57c3('0x38'),_0x270d14['uniqueid']),_0x518d45);}};exports['agentcomplete']=function(_0x1b2df0){try{if(!_[_0x57c3('0x17')](queues[_0x1b2df0[_0x57c3('0x2')]])){if(queues[_0x1b2df0[_0x57c3('0x2')]][_0x57c3('0x33')]){utils['debug'](util[_0x57c3('0x10')](_0x57c3('0x3b'),_0x1b2df0[_0x57c3('0x2')]),_0x1b2df0);queues[_0x1b2df0[_0x57c3('0x2')]]['queuecallerabandon']=![];queues[_0x1b2df0['uniqueid']][_0x57c3('0x19')]=![];queues[_0x1b2df0['uniqueid']]['queuecallerabandonAt']=null;queues[_0x1b2df0[_0x57c3('0x2')]][_0x57c3('0x1a')]=![];queues[_0x1b2df0[_0x57c3('0x2')]][_0x57c3('0x25')]=null;queues[_0x1b2df0[_0x57c3('0x2')]][_0x57c3('0x3c')]=!![];queues[_0x1b2df0[_0x57c3('0x2')]][_0x57c3('0x4')]=_0x1b2df0[_0x57c3('0x39')];queues[_0x1b2df0[_0x57c3('0x2')]]['queuecallercomplete']=!![];queues[_0x1b2df0[_0x57c3('0x2')]][_0x57c3('0x3d')]=utils[_0x57c3('0x14')]();if(_0x1b2df0['reason']==_0x57c3('0x3e')){if(!queues[_0x1b2df0[_0x57c3('0x2')]][_0x57c3('0x3e')]){queues[_0x1b2df0['uniqueid']][_0x57c3('0x26')]=_0x57c3('0x3f');}}else{queues[_0x1b2df0[_0x57c3('0x2')]][_0x57c3('0x26')]=_0x57c3('0x40')+_0x1b2df0[_0x57c3('0x41')][_0x57c3('0x23')]();}utils[_0x57c3('0x1')](util[_0x57c3('0x10')](_0x57c3('0x42'),_0x1b2df0[_0x57c3('0x2')],queues[_0x1b2df0[_0x57c3('0x2')]][_0x57c3('0x1e')],_0x1b2df0[_0x57c3('0x39')],queues[_0x1b2df0[_0x57c3('0x2')]][_0x57c3('0x26')]));writeDB(queues[_0x1b2df0[_0x57c3('0x2')]]);}}}catch(_0x4dca89){utils[_0x57c3('0x15')](util[_0x57c3('0x10')](_0x57c3('0x3b'),_0x1b2df0[_0x57c3('0x2')]),_0x4dca89);}};exports[_0x57c3('0x43')]=function(_0x29f99c){try{if(!_[_0x57c3('0x17')](queues[_0x29f99c[_0x57c3('0x44')]])){utils[_0x57c3('0xf')](util[_0x57c3('0x10')]('[%s][queues][blindtransfer]',_0x29f99c[_0x57c3('0x2')]),_0x29f99c);queues[_0x29f99c[_0x57c3('0x44')]][_0x57c3('0x3e')]=!![];queues[_0x29f99c[_0x57c3('0x44')]][_0x57c3('0x45')]='BLIND';queues[_0x29f99c[_0x57c3('0x44')]][_0x57c3('0x46')]=_0x29f99c[_0x57c3('0x47')];queues[_0x29f99c[_0x57c3('0x44')]][_0x57c3('0x48')]=_0x29f99c['transfereeuniqueid'];queues[_0x29f99c[_0x57c3('0x44')]][_0x57c3('0x26')]=_0x57c3('0x49');utils[_0x57c3('0x1')](util[_0x57c3('0x10')](_0x57c3('0x4a'),_0x29f99c['uniqueid'],queues[_0x29f99c[_0x57c3('0x44')]][_0x57c3('0x1e')],_0x29f99c[_0x57c3('0x44')],_0x29f99c[_0x57c3('0x47')]));}}catch(_0x25ae56){utils['error'](util[_0x57c3('0x10')](_0x57c3('0x4b'),_0x29f99c[_0x57c3('0x2')]),_0x25ae56);}};exports['attendedtransfer']=function(_0x11a7a7){try{utils[_0x57c3('0xf')](util[_0x57c3('0x10')](_0x57c3('0x4c'),_0x11a7a7['origtransfereruniqueid']),_0x11a7a7);if(_0x11a7a7['origtransfereruniqueid']==_0x11a7a7[_0x57c3('0x4d')]){if(!_[_0x57c3('0x17')](queues[_0x11a7a7[_0x57c3('0x4e')]])){utils['info'](util['format'](_0x57c3('0x4f'),_0x11a7a7[_0x57c3('0x50')],queues[_0x11a7a7[_0x57c3('0x4e')]][_0x57c3('0x1e')],_0x11a7a7[_0x57c3('0x51')]));queues[_0x11a7a7[_0x57c3('0x4e')]][_0x57c3('0x3e')]=!![];queues[_0x11a7a7['secondtransfererlinkedid']][_0x57c3('0x45')]=_0x57c3('0x52');queues[_0x11a7a7[_0x57c3('0x4e')]][_0x57c3('0x46')]=_0x11a7a7[_0x57c3('0x51')];queues[_0x11a7a7[_0x57c3('0x4e')]][_0x57c3('0x48')]=_0x11a7a7[_0x57c3('0x50')];queues[_0x11a7a7[_0x57c3('0x4e')]][_0x57c3('0x26')]='ATTENDEDTRANSFER';}if(!_[_0x57c3('0x17')](queues[_0x11a7a7['origtransfererlinkedid']])){if(_0x11a7a7[_0x57c3('0x53')]&&queues[_0x11a7a7['transfereelinkedid']]){queues[_0x11a7a7['transfereelinkedid']][_0x57c3('0x54')]=0x1;queues[_0x11a7a7[_0x57c3('0x44')]]=_['clone'](queues[_0x11a7a7[_0x57c3('0x53')]]);queues[_0x11a7a7[_0x57c3('0x44')]]['transfereduniqueid']=_0x11a7a7['transfertargetuniqueid'];queues[_0x11a7a7[_0x57c3('0x44')]][_0x57c3('0x54')]=0x2;queues[_0x11a7a7[_0x57c3('0x44')]]['calleridnum']=queues[_0x11a7a7[_0x57c3('0x4e')]][_0x57c3('0x5')];queues[_0x11a7a7['transfereeuniqueid']][_0x57c3('0x55')]=queues[_0x11a7a7[_0x57c3('0x4e')]][_0x57c3('0x55')];queues[_0x11a7a7['transfereeuniqueid']][_0x57c3('0x34')]=utils[_0x57c3('0x14')]();queues[_0x11a7a7['transfereeuniqueid']]['queuecallerleaveAt']=utils[_0x57c3('0x14')]();queues[_0x11a7a7['transfereeuniqueid']][_0x57c3('0x56')]=0x0;queues[_0x11a7a7[_0x57c3('0x44')]][_0x57c3('0x57')]=0x0;utils[_0x57c3('0x1')](util[_0x57c3('0x10')](_0x57c3('0x58'),_0x11a7a7['origtransfereruniqueid'],queues[_0x11a7a7[_0x57c3('0x44')]][_0x57c3('0x1e')],queues[_0x11a7a7[_0x57c3('0x44')]]['calleridnum'],queues[_0x11a7a7[_0x57c3('0x44')]][_0x57c3('0x55')]));}else{utils['info'](util[_0x57c3('0x10')](_0x57c3('0x59'),_0x11a7a7[_0x57c3('0x50')],queues[_0x11a7a7['origtransfererlinkedid']][_0x57c3('0x1e')],_0x11a7a7[_0x57c3('0x4e')]));queues[_0x11a7a7[_0x57c3('0x4d')]][_0x57c3('0xd')]=_0x11a7a7[_0x57c3('0x4e')];}}}else if(_0x11a7a7[_0x57c3('0x5a')]==_0x11a7a7[_0x57c3('0x4e')]){if(!_[_0x57c3('0x17')](queues[_0x11a7a7[_0x57c3('0x4d')]])){utils[_0x57c3('0x1')](util[_0x57c3('0x10')](_0x57c3('0x5b'),_0x11a7a7['origtransfereruniqueid'],queues[_0x11a7a7[_0x57c3('0x4d')]][_0x57c3('0x1e')],_0x11a7a7['secondtransfereruniqueid'],_0x11a7a7['secondtransfererexten']));queues[_0x11a7a7['origtransfererlinkedid']]['transfer']=!![];queues[_0x11a7a7['origtransfererlinkedid']][_0x57c3('0x45')]='ATTENDED';queues[_0x11a7a7[_0x57c3('0x4d')]][_0x57c3('0x46')]=_0x11a7a7[_0x57c3('0x5c')];queues[_0x11a7a7[_0x57c3('0x4d')]][_0x57c3('0x48')]=_0x11a7a7[_0x57c3('0x5a')];queues[_0x11a7a7['origtransfererlinkedid']][_0x57c3('0x26')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x11a7a7[_0x57c3('0x4e')]])){if(_0x11a7a7[_0x57c3('0x5d')]&&queues[_0x11a7a7[_0x57c3('0x5d')]]){queues[_0x11a7a7['transfertargetlinkedid']][_0x57c3('0x54')]=0x1;queues[_0x11a7a7['transfertargetuniqueid']]=_[_0x57c3('0x5e')](queues[_0x11a7a7[_0x57c3('0x5d')]]);queues[_0x11a7a7[_0x57c3('0x5f')]][_0x57c3('0xd')]=_0x11a7a7[_0x57c3('0x5f')];queues[_0x11a7a7[_0x57c3('0x5f')]]['queuecallerenterreason']=0x2;queues[_0x11a7a7[_0x57c3('0x5f')]][_0x57c3('0x5')]=queues[_0x11a7a7[_0x57c3('0x4d')]][_0x57c3('0x5')];queues[_0x11a7a7['transfertargetuniqueid']][_0x57c3('0x55')]=queues[_0x11a7a7[_0x57c3('0x4d')]]['calleridname'];queues[_0x11a7a7[_0x57c3('0x5f')]][_0x57c3('0x34')]=utils['now']();queues[_0x11a7a7[_0x57c3('0x5f')]][_0x57c3('0x33')]=utils['now']();queues[_0x11a7a7[_0x57c3('0x5f')]]['holdtime']=0x0;queues[_0x11a7a7[_0x57c3('0x5f')]]['mohtime']=0x0;utils[_0x57c3('0x1')](util[_0x57c3('0x10')](_0x57c3('0x60'),_0x11a7a7[_0x57c3('0x50')],queues[_0x11a7a7[_0x57c3('0x5f')]][_0x57c3('0x1e')],queues[_0x11a7a7[_0x57c3('0x5f')]][_0x57c3('0xd')],queues[_0x11a7a7[_0x57c3('0x5f')]][_0x57c3('0x5')],queues[_0x11a7a7[_0x57c3('0x5f')]][_0x57c3('0x55')]));}else{utils[_0x57c3('0x1')](util[_0x57c3('0x10')](_0x57c3('0x59'),_0x11a7a7[_0x57c3('0x50')],queues[_0x11a7a7[_0x57c3('0x4e')]][_0x57c3('0x1e')],_0x11a7a7['origtransfererlinkedid']));queues[_0x11a7a7[_0x57c3('0x4e')]]['transfereduniqueid']=_0x11a7a7[_0x57c3('0x4d')];}}}}catch(_0x210664){utils[_0x57c3('0x15')](util['format'](_0x57c3('0x4c'),_0x11a7a7[_0x57c3('0x50')]),_0x210664);}};exports[_0x57c3('0x61')]=function(_0x5719d8){try{if(!_['isNil'](queues[_0x5719d8['uniqueid']])){utils['debug'](util[_0x57c3('0x10')](_0x57c3('0x62'),_0x5719d8[_0x57c3('0x2')]),_0x5719d8);queues[_0x5719d8[_0x57c3('0x2')]][_0x57c3('0x63')]=utils[_0x57c3('0x14')]();utils['info'](util[_0x57c3('0x10')](_0x57c3('0x64'),_0x5719d8[_0x57c3('0x2')],queues[_0x5719d8[_0x57c3('0x2')]]['name'],queues[_0x5719d8[_0x57c3('0x2')]][_0x57c3('0x63')]));}}catch(_0x2425dc){utils[_0x57c3('0x15')](util[_0x57c3('0x10')](_0x57c3('0x62'),_0x5719d8[_0x57c3('0x2')]),_0x2425dc);}};exports['musiconholdstop']=function(_0x5cab91){try{if(!_[_0x57c3('0x17')](queues[_0x5cab91[_0x57c3('0x2')]])){if(!_[_0x57c3('0x17')](queues[_0x5cab91[_0x57c3('0x2')]]['musiconholdstartAt'])){utils[_0x57c3('0xf')](util[_0x57c3('0x10')](_0x57c3('0x65'),_0x5cab91[_0x57c3('0x2')]),_0x5cab91);queues[_0x5cab91['uniqueid']]['mohtime']+=utils[_0x57c3('0x32')](utils[_0x57c3('0x14')](),queues[_0x5cab91[_0x57c3('0x2')]][_0x57c3('0x63')]);utils['info'](util[_0x57c3('0x10')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x5cab91[_0x57c3('0x2')],queues[_0x5cab91[_0x57c3('0x2')]][_0x57c3('0x1e')],queues[_0x5cab91[_0x57c3('0x2')]]['mohtime']));delete queues[_0x5cab91[_0x57c3('0x2')]][_0x57c3('0x63')];}}}catch(_0x5ebbf5){utils[_0x57c3('0x15')](util[_0x57c3('0x10')](_0x57c3('0x65'),_0x5cab91[_0x57c3('0x2')]),_0x5ebbf5);}}; \ No newline at end of file +var _0x3e5c=['secondtransfererexten','transfertargetlinkedid','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','lodash','util','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','queue','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','hangup','isNil','debug','[%s][queues][hangup]','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','info','name','queuecallerenterreason','varset','queuestatus','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','now','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','value','variable','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','queuecallerleave','holdtime','queuecallerleaveAt','queuecallerjoinAt','count','connectedlinename','[%s][queues][agentconnect]','destaccountcode','assigned','membername','agentcomplete','queuecallercomplete','transfer','TRANSFER','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferexten','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER'];(function(_0x3a4938,_0x2d38bc){var _0x2ce7ca=function(_0x269969){while(--_0x269969){_0x3a4938['push'](_0x3a4938['shift']());}};_0x2ce7ca(++_0x2d38bc);}(_0x3e5c,0x70));var _0xc3e5=function(_0x5ca726,_0x5ee330){_0x5ca726=_0x5ca726-0x0;var _0x2c5c8a=_0x3e5c[_0x5ca726];return _0x2c5c8a;};'use strict';var _=require(_0xc3e5('0x0'));var util=require(_0xc3e5('0x1'));var utils=require(_0xc3e5('0x2'));var queues={};function writeDB(_0x5e0240){utils['info'](util[_0xc3e5('0x3')](_0xc3e5('0x4'),_0x5e0240[_0xc3e5('0x5')],_0x5e0240[_0xc3e5('0x6')],_0x5e0240['queue'],_0x5e0240[_0xc3e5('0x7')],_0x5e0240[_0xc3e5('0x8')],_0x5e0240[_0xc3e5('0x9')],_0x5e0240[_0xc3e5('0xa')]));if(_0x5e0240['queue']){utils[_0xc3e5('0xb')](_0x5e0240[_0xc3e5('0xc')])['then'](function(_0x77b057){if(_0x77b057){_0x5e0240[_0xc3e5('0xd')]=_0x77b057[_0xc3e5('0xd')];}utils[_0xc3e5('0xe')](_0xc3e5('0xf'),_0x5e0240);});}else{utils[_0xc3e5('0xe')]('CreateVoiceQueueReport',_0x5e0240);}if(_0x5e0240[_0xc3e5('0x10')]){delete queues[_0x5e0240[_0xc3e5('0x10')]];}else{delete queues[_0x5e0240[_0xc3e5('0x5')]];}}exports[_0xc3e5('0x11')]=function(_0x8c50d7){try{utils['debug'](util[_0xc3e5('0x3')](_0xc3e5('0x12'),_0x8c50d7[_0xc3e5('0x5')]),_0x8c50d7);utils['info'](util[_0xc3e5('0x3')](_0xc3e5('0x13'),_0x8c50d7[_0xc3e5('0x5')],_0x8c50d7[_0xc3e5('0xc')],_0x8c50d7[_0xc3e5('0x14')]));queues[_0x8c50d7[_0xc3e5('0x5')]]=_[_0xc3e5('0x15')](_0x8c50d7,{'originalposition':_0x8c50d7[_0xc3e5('0x14')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x15f7e8){utils[_0xc3e5('0x16')](util[_0xc3e5('0x3')](_0xc3e5('0x12'),_0x8c50d7[_0xc3e5('0x5')]),_0x15f7e8);}};exports[_0xc3e5('0x17')]=function(_0x30b164){try{if(!_[_0xc3e5('0x18')](queues[_0x30b164[_0xc3e5('0x5')]])){utils[_0xc3e5('0x19')](util[_0xc3e5('0x3')](_0xc3e5('0x1a'),_0x30b164[_0xc3e5('0x5')]),_0x30b164);if(queues[_0x30b164[_0xc3e5('0x5')]]['queuecallerleaveAt']){if(!queues[_0x30b164[_0xc3e5('0x5')]]['queuecallerabandon']&&!queues[_0x30b164[_0xc3e5('0x5')]]['queuecallerexit']){queues[_0x30b164[_0xc3e5('0x5')]]['queuecallercomplete']=!![];queues[_0x30b164[_0xc3e5('0x5')]][_0xc3e5('0x1b')]=utils['now']();queues[_0x30b164[_0xc3e5('0x5')]][_0xc3e5('0xa')]='COMPLETEDBYAGENT';}utils['info'](util['format'](_0xc3e5('0x1c'),_0x30b164[_0xc3e5('0x5')],queues[_0x30b164[_0xc3e5('0x5')]]['name'],queues[_0x30b164['uniqueid']][_0xc3e5('0xa')]));writeDB(queues[_0x30b164[_0xc3e5('0x5')]]);}else if(queues[_0x30b164[_0xc3e5('0x5')]][_0xc3e5('0x10')]){utils[_0xc3e5('0x1d')](util[_0xc3e5('0x3')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x30b164['uniqueid'],queues[_0x30b164[_0xc3e5('0x5')]][_0xc3e5('0x1e')],queues[_0x30b164['uniqueid']]['transfereduniqueid']));queues[queues[_0x30b164[_0xc3e5('0x5')]]['transfereduniqueid']]=queues[_0x30b164['uniqueid']];queues[queues[_0x30b164[_0xc3e5('0x5')]]['transfereduniqueid']][_0xc3e5('0x1f')]=0x2;delete queues[_0x30b164[_0xc3e5('0x5')]];}}}catch(_0x3933e6){utils[_0xc3e5('0x16')](util['format']('[%s][queues][hangup]',_0x30b164[_0xc3e5('0x5')]),_0x3933e6);}};exports[_0xc3e5('0x20')]=function(_0x1c3ebd){try{utils[_0xc3e5('0x19')](util[_0xc3e5('0x3')]('[%s][queues][varset]',_0x1c3ebd[_0xc3e5('0x5')]),_0x1c3ebd);if(!_[_0xc3e5('0x18')](_0x1c3ebd['variable'][_0xc3e5('0x21')])&&_0x1c3ebd['value'][_0xc3e5('0x22')]()!==_0xc3e5('0x23')){if(!_[_0xc3e5('0x18')](queues[_0x1c3ebd[_0xc3e5('0x5')]])){queues[_0x1c3ebd['uniqueid']][_0xc3e5('0x24')]=![];queues[_0x1c3ebd['uniqueid']][_0xc3e5('0x25')]=null;queues[_0x1c3ebd[_0xc3e5('0x5')]][_0xc3e5('0x26')]=!![];queues[_0x1c3ebd[_0xc3e5('0x5')]][_0xc3e5('0x27')]=utils[_0xc3e5('0x28')]();queues[_0x1c3ebd[_0xc3e5('0x5')]][_0xc3e5('0xa')]=_0x1c3ebd['value']['toUpperCase']();utils[_0xc3e5('0x1d')](util[_0xc3e5('0x3')](_0xc3e5('0x29'),_0x1c3ebd['uniqueid'],queues[_0x1c3ebd[_0xc3e5('0x5')]][_0xc3e5('0x1e')],_0x1c3ebd[_0xc3e5('0x2a')],queues[_0x1c3ebd[_0xc3e5('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x1c3ebd[_0xc3e5('0x5')]]);}}else if(!_['isNil'](_0x1c3ebd[_0xc3e5('0x2b')][_0xc3e5('0x2c')])){if(!_[_0xc3e5('0x18')](queues[_0x1c3ebd[_0xc3e5('0x5')]])&&!queues[_0x1c3ebd[_0xc3e5('0x5')]][_0xc3e5('0x24')]){queues[_0x1c3ebd[_0xc3e5('0x5')]]['queuecallerabandon']=![];queues[_0x1c3ebd['uniqueid']]['queuecallerabandonAt']=null;queues[_0x1c3ebd[_0xc3e5('0x5')]][_0xc3e5('0x26')]=!![];queues[_0x1c3ebd[_0xc3e5('0x5')]][_0xc3e5('0x27')]=utils['now']();queues[_0x1c3ebd[_0xc3e5('0x5')]][_0xc3e5('0xa')]=_0xc3e5('0x2d');utils[_0xc3e5('0x1d')](util['format'](_0xc3e5('0x2e'),_0x1c3ebd['uniqueid'],queues[_0x1c3ebd[_0xc3e5('0x5')]][_0xc3e5('0x1e')],_0x1c3ebd['value'],queues[_0x1c3ebd[_0xc3e5('0x5')]][_0xc3e5('0xa')]));}}}catch(_0x11d2a8){utils['error'](util['format'](_0xc3e5('0x2f'),_0x1c3ebd[_0xc3e5('0x5')]),_0x11d2a8);}};exports[_0xc3e5('0x24')]=function(_0x30b871){try{if(!_[_0xc3e5('0x18')](queues[_0x30b871[_0xc3e5('0x5')]])){utils[_0xc3e5('0x19')](util[_0xc3e5('0x3')]('[%s][queues][queuecallerabandon]',_0x30b871[_0xc3e5('0x5')]),_0x30b871);queues[_0x30b871[_0xc3e5('0x5')]]['queuecallerexit']=![];queues[_0x30b871['uniqueid']][_0xc3e5('0x27')]=null;queues[_0x30b871[_0xc3e5('0x5')]][_0xc3e5('0x24')]=!![];queues[_0x30b871[_0xc3e5('0x5')]][_0xc3e5('0x25')]=utils[_0xc3e5('0x28')]();queues[_0x30b871['uniqueid']][_0xc3e5('0xa')]='ABANDONED';utils[_0xc3e5('0x1d')](util[_0xc3e5('0x3')](_0xc3e5('0x30'),_0x30b871[_0xc3e5('0x5')],queues[_0x30b871['uniqueid']][_0xc3e5('0x1e')],queues[_0x30b871[_0xc3e5('0x5')]]['queuecallerexitreason']));}}catch(_0x47509b){utils[_0xc3e5('0x16')](util['format'](_0xc3e5('0x31'),_0x30b871[_0xc3e5('0x5')]),_0x47509b);}};exports['queuecallerleave']=function(_0x4745f5){try{if(!_[_0xc3e5('0x18')](queues[_0x4745f5['uniqueid']])){utils[_0xc3e5('0x19')](util[_0xc3e5('0x3')](_0xc3e5('0x32'),_0x4745f5[_0xc3e5('0x5')]),_0x4745f5);utils[_0xc3e5('0x1d')](util[_0xc3e5('0x3')](_0xc3e5('0x33'),_0x4745f5[_0xc3e5('0x5')],queues[_0x4745f5[_0xc3e5('0x5')]][_0xc3e5('0x1e')],_0x4745f5[_0xc3e5('0x34')],_0x4745f5['connectedlinename']));queues[_0x4745f5['uniqueid']][_0xc3e5('0x35')]=!![];queues[_0x4745f5[_0xc3e5('0x5')]]['queuecallerleaveAt']=utils['now']();queues[_0x4745f5['uniqueid']][_0xc3e5('0x36')]=utils['diffTime'](queues[_0x4745f5[_0xc3e5('0x5')]][_0xc3e5('0x37')],queues[_0x4745f5[_0xc3e5('0x5')]][_0xc3e5('0x38')]);queues[_0x4745f5[_0xc3e5('0x5')]][_0xc3e5('0x14')]=_0x4745f5['position'];queues[_0x4745f5[_0xc3e5('0x5')]][_0xc3e5('0x39')]=_0x4745f5[_0xc3e5('0x39')];queues[_0x4745f5[_0xc3e5('0x5')]][_0xc3e5('0x34')]=_0x4745f5[_0xc3e5('0x34')];queues[_0x4745f5[_0xc3e5('0x5')]][_0xc3e5('0x3a')]=_0x4745f5[_0xc3e5('0x3a')];}}catch(_0x478520){utils[_0xc3e5('0x16')](util['format'](_0xc3e5('0x32'),_0x4745f5[_0xc3e5('0x5')]),_0x478520);}};exports['agentconnect']=function(_0x443ad1){try{if(!_['isNil'](queues[_0x443ad1[_0xc3e5('0x5')]])){utils['debug'](util[_0xc3e5('0x3')](_0xc3e5('0x3b'),_0x443ad1[_0xc3e5('0x5')]),_0x443ad1);utils[_0xc3e5('0x1d')](util[_0xc3e5('0x3')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x443ad1[_0xc3e5('0x5')],queues[_0x443ad1[_0xc3e5('0x5')]]['name'],_0x443ad1['membername'],_0x443ad1[_0xc3e5('0x3c')]));queues[_0x443ad1['uniqueid']][_0xc3e5('0x24')]=![];queues[_0x443ad1['uniqueid']][_0xc3e5('0x24')]=![];queues[_0x443ad1['uniqueid']][_0xc3e5('0x25')]=null;queues[_0x443ad1[_0xc3e5('0x5')]][_0xc3e5('0x26')]=![];queues[_0x443ad1[_0xc3e5('0x5')]]['queuecallerexitreason']=null;queues[_0x443ad1[_0xc3e5('0x5')]]['queuecallerexitAt']=null;queues[_0x443ad1[_0xc3e5('0x5')]][_0xc3e5('0x3d')]=!![];queues[_0x443ad1[_0xc3e5('0x5')]]['accountcode']=_0x443ad1['destaccountcode'];queues[_0x443ad1[_0xc3e5('0x5')]][_0xc3e5('0x7')]=_0x443ad1[_0xc3e5('0x3e')];}}catch(_0xed8caf){utils['error'](util['format'](_0xc3e5('0x3b'),_0x443ad1[_0xc3e5('0x5')]),_0xed8caf);}};exports[_0xc3e5('0x3f')]=function(_0x3ec9ad){try{if(!_[_0xc3e5('0x18')](queues[_0x3ec9ad['uniqueid']])){if(queues[_0x3ec9ad[_0xc3e5('0x5')]][_0xc3e5('0x37')]){utils[_0xc3e5('0x19')](util[_0xc3e5('0x3')]('[%s][queues][agentcomplete]',_0x3ec9ad[_0xc3e5('0x5')]),_0x3ec9ad);queues[_0x3ec9ad['uniqueid']][_0xc3e5('0x24')]=![];queues[_0x3ec9ad[_0xc3e5('0x5')]][_0xc3e5('0x24')]=![];queues[_0x3ec9ad[_0xc3e5('0x5')]][_0xc3e5('0x25')]=null;queues[_0x3ec9ad['uniqueid']][_0xc3e5('0x26')]=![];queues[_0x3ec9ad[_0xc3e5('0x5')]][_0xc3e5('0x27')]=null;queues[_0x3ec9ad[_0xc3e5('0x5')]][_0xc3e5('0x3d')]=!![];queues[_0x3ec9ad[_0xc3e5('0x5')]][_0xc3e5('0x7')]=_0x3ec9ad[_0xc3e5('0x3e')];queues[_0x3ec9ad['uniqueid']][_0xc3e5('0x40')]=!![];queues[_0x3ec9ad['uniqueid']]['queuecallercompleteAt']=utils[_0xc3e5('0x28')]();if(_0x3ec9ad['reason']==_0xc3e5('0x41')){if(!queues[_0x3ec9ad[_0xc3e5('0x5')]][_0xc3e5('0x41')]){queues[_0x3ec9ad['uniqueid']][_0xc3e5('0xa')]=_0xc3e5('0x42');}}else{queues[_0x3ec9ad[_0xc3e5('0x5')]]['queuecallerexitreason']='COMPLETEDBY'+_0x3ec9ad[_0xc3e5('0x43')][_0xc3e5('0x22')]();}utils[_0xc3e5('0x1d')](util['format'](_0xc3e5('0x44'),_0x3ec9ad[_0xc3e5('0x5')],queues[_0x3ec9ad[_0xc3e5('0x5')]][_0xc3e5('0x1e')],_0x3ec9ad[_0xc3e5('0x3e')],queues[_0x3ec9ad[_0xc3e5('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x3ec9ad[_0xc3e5('0x5')]]);}}}catch(_0x49f327){utils[_0xc3e5('0x16')](util['format'](_0xc3e5('0x45'),_0x3ec9ad[_0xc3e5('0x5')]),_0x49f327);}};exports['blindtransfer']=function(_0x2df337){try{if(!_['isNil'](queues[_0x2df337[_0xc3e5('0x46')]])){utils[_0xc3e5('0x19')](util[_0xc3e5('0x3')](_0xc3e5('0x47'),_0x2df337[_0xc3e5('0x5')]),_0x2df337);queues[_0x2df337[_0xc3e5('0x46')]][_0xc3e5('0x41')]=!![];queues[_0x2df337['transfereeuniqueid']][_0xc3e5('0x48')]='BLIND';queues[_0x2df337['transfereeuniqueid']][_0xc3e5('0x49')]=_0x2df337[_0xc3e5('0x4a')];queues[_0x2df337[_0xc3e5('0x46')]][_0xc3e5('0x4b')]=_0x2df337[_0xc3e5('0x46')];queues[_0x2df337[_0xc3e5('0x46')]][_0xc3e5('0xa')]=_0xc3e5('0x4c');utils[_0xc3e5('0x1d')](util[_0xc3e5('0x3')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x2df337[_0xc3e5('0x5')],queues[_0x2df337[_0xc3e5('0x46')]][_0xc3e5('0x1e')],_0x2df337['transfereeuniqueid'],_0x2df337[_0xc3e5('0x4a')]));}}catch(_0x2e7291){utils['error'](util['format']('[%s][queues][blindtransfer]',_0x2df337[_0xc3e5('0x5')]),_0x2e7291);}};exports[_0xc3e5('0x4d')]=function(_0x1a6acf){try{utils[_0xc3e5('0x19')](util[_0xc3e5('0x3')](_0xc3e5('0x4e'),_0x1a6acf[_0xc3e5('0x4f')]),_0x1a6acf);if(_0x1a6acf[_0xc3e5('0x4f')]==_0x1a6acf[_0xc3e5('0x50')]){if(!_['isNil'](queues[_0x1a6acf[_0xc3e5('0x51')]])){utils[_0xc3e5('0x1d')](util[_0xc3e5('0x3')](_0xc3e5('0x52'),_0x1a6acf['origtransfereruniqueid'],queues[_0x1a6acf['secondtransfererlinkedid']][_0xc3e5('0x1e')],_0x1a6acf[_0xc3e5('0x53')]));queues[_0x1a6acf['secondtransfererlinkedid']][_0xc3e5('0x41')]=!![];queues[_0x1a6acf['secondtransfererlinkedid']]['transfertype']='ATTENDED';queues[_0x1a6acf[_0xc3e5('0x51')]][_0xc3e5('0x49')]=_0x1a6acf[_0xc3e5('0x53')];queues[_0x1a6acf[_0xc3e5('0x51')]][_0xc3e5('0x4b')]=_0x1a6acf['origtransfereruniqueid'];queues[_0x1a6acf[_0xc3e5('0x51')]][_0xc3e5('0xa')]=_0xc3e5('0x54');}if(!_[_0xc3e5('0x18')](queues[_0x1a6acf[_0xc3e5('0x50')]])){if(_0x1a6acf['transfereelinkedid']&&queues[_0x1a6acf['transfereelinkedid']]){queues[_0x1a6acf[_0xc3e5('0x55')]][_0xc3e5('0x1f')]=0x1;queues[_0x1a6acf[_0xc3e5('0x46')]]=_[_0xc3e5('0x56')](queues[_0x1a6acf[_0xc3e5('0x55')]]);queues[_0x1a6acf['transfereeuniqueid']][_0xc3e5('0x10')]=_0x1a6acf[_0xc3e5('0x57')];queues[_0x1a6acf[_0xc3e5('0x46')]][_0xc3e5('0x1f')]=0x2;queues[_0x1a6acf[_0xc3e5('0x46')]][_0xc3e5('0x8')]=queues[_0x1a6acf['secondtransfererlinkedid']][_0xc3e5('0x8')];queues[_0x1a6acf[_0xc3e5('0x46')]]['calleridname']=queues[_0x1a6acf[_0xc3e5('0x51')]][_0xc3e5('0x58')];queues[_0x1a6acf[_0xc3e5('0x46')]][_0xc3e5('0x38')]=utils[_0xc3e5('0x28')]();queues[_0x1a6acf['transfereeuniqueid']][_0xc3e5('0x37')]=utils[_0xc3e5('0x28')]();queues[_0x1a6acf['transfereeuniqueid']][_0xc3e5('0x36')]=0x0;queues[_0x1a6acf[_0xc3e5('0x46')]][_0xc3e5('0x59')]=0x0;utils['info'](util[_0xc3e5('0x3')](_0xc3e5('0x5a'),_0x1a6acf[_0xc3e5('0x4f')],queues[_0x1a6acf['transfereeuniqueid']][_0xc3e5('0x1e')],queues[_0x1a6acf['transfereeuniqueid']]['calleridnum'],queues[_0x1a6acf[_0xc3e5('0x46')]][_0xc3e5('0x58')]));}else{utils['info'](util[_0xc3e5('0x3')](_0xc3e5('0x5b'),_0x1a6acf[_0xc3e5('0x4f')],queues[_0x1a6acf[_0xc3e5('0x50')]][_0xc3e5('0x1e')],_0x1a6acf[_0xc3e5('0x51')]));queues[_0x1a6acf['origtransfererlinkedid']][_0xc3e5('0x10')]=_0x1a6acf[_0xc3e5('0x51')];}}}else if(_0x1a6acf[_0xc3e5('0x5c')]==_0x1a6acf['secondtransfererlinkedid']){if(!_[_0xc3e5('0x18')](queues[_0x1a6acf[_0xc3e5('0x50')]])){utils[_0xc3e5('0x1d')](util[_0xc3e5('0x3')](_0xc3e5('0x5d'),_0x1a6acf[_0xc3e5('0x4f')],queues[_0x1a6acf['origtransfererlinkedid']][_0xc3e5('0x1e')],_0x1a6acf['secondtransfereruniqueid'],_0x1a6acf[_0xc3e5('0x5e')]));queues[_0x1a6acf['origtransfererlinkedid']]['transfer']=!![];queues[_0x1a6acf[_0xc3e5('0x50')]][_0xc3e5('0x48')]='ATTENDED';queues[_0x1a6acf[_0xc3e5('0x50')]][_0xc3e5('0x49')]=_0x1a6acf[_0xc3e5('0x5e')];queues[_0x1a6acf[_0xc3e5('0x50')]][_0xc3e5('0x4b')]=_0x1a6acf[_0xc3e5('0x5c')];queues[_0x1a6acf[_0xc3e5('0x50')]]['queuecallerexitreason']=_0xc3e5('0x54');}if(!_[_0xc3e5('0x18')](queues[_0x1a6acf[_0xc3e5('0x51')]])){if(_0x1a6acf[_0xc3e5('0x5f')]&&queues[_0x1a6acf[_0xc3e5('0x5f')]]){queues[_0x1a6acf['transfertargetlinkedid']][_0xc3e5('0x1f')]=0x1;queues[_0x1a6acf[_0xc3e5('0x57')]]=_[_0xc3e5('0x56')](queues[_0x1a6acf[_0xc3e5('0x5f')]]);queues[_0x1a6acf[_0xc3e5('0x57')]][_0xc3e5('0x10')]=_0x1a6acf['transfertargetuniqueid'];queues[_0x1a6acf[_0xc3e5('0x57')]]['queuecallerenterreason']=0x2;queues[_0x1a6acf['transfertargetuniqueid']][_0xc3e5('0x8')]=queues[_0x1a6acf[_0xc3e5('0x50')]][_0xc3e5('0x8')];queues[_0x1a6acf[_0xc3e5('0x57')]][_0xc3e5('0x58')]=queues[_0x1a6acf['origtransfererlinkedid']][_0xc3e5('0x58')];queues[_0x1a6acf[_0xc3e5('0x57')]][_0xc3e5('0x38')]=utils[_0xc3e5('0x28')]();queues[_0x1a6acf[_0xc3e5('0x57')]][_0xc3e5('0x37')]=utils['now']();queues[_0x1a6acf[_0xc3e5('0x57')]][_0xc3e5('0x36')]=0x0;queues[_0x1a6acf[_0xc3e5('0x57')]]['mohtime']=0x0;utils[_0xc3e5('0x1d')](util[_0xc3e5('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x1a6acf[_0xc3e5('0x4f')],queues[_0x1a6acf['transfertargetuniqueid']][_0xc3e5('0x1e')],queues[_0x1a6acf['transfertargetuniqueid']][_0xc3e5('0x10')],queues[_0x1a6acf[_0xc3e5('0x57')]][_0xc3e5('0x8')],queues[_0x1a6acf['transfertargetuniqueid']][_0xc3e5('0x58')]));}else{utils['info'](util[_0xc3e5('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x1a6acf[_0xc3e5('0x4f')],queues[_0x1a6acf[_0xc3e5('0x51')]]['name'],_0x1a6acf[_0xc3e5('0x50')]));queues[_0x1a6acf[_0xc3e5('0x51')]][_0xc3e5('0x10')]=_0x1a6acf[_0xc3e5('0x50')];}}}}catch(_0x153f7d){utils[_0xc3e5('0x16')](util[_0xc3e5('0x3')](_0xc3e5('0x4e'),_0x1a6acf['origtransfereruniqueid']),_0x153f7d);}};exports[_0xc3e5('0x60')]=function(_0x1cda02){try{if(!_[_0xc3e5('0x18')](queues[_0x1cda02['uniqueid']])){utils[_0xc3e5('0x19')](util[_0xc3e5('0x3')](_0xc3e5('0x61'),_0x1cda02['uniqueid']),_0x1cda02);queues[_0x1cda02[_0xc3e5('0x5')]][_0xc3e5('0x62')]=utils[_0xc3e5('0x28')]();utils[_0xc3e5('0x1d')](util[_0xc3e5('0x3')](_0xc3e5('0x63'),_0x1cda02['uniqueid'],queues[_0x1cda02['uniqueid']][_0xc3e5('0x1e')],queues[_0x1cda02[_0xc3e5('0x5')]][_0xc3e5('0x62')]));}}catch(_0x12b2a1){utils[_0xc3e5('0x16')](util[_0xc3e5('0x3')](_0xc3e5('0x61'),_0x1cda02[_0xc3e5('0x5')]),_0x12b2a1);}};exports[_0xc3e5('0x64')]=function(_0x10bcf6){try{if(!_['isNil'](queues[_0x10bcf6[_0xc3e5('0x5')]])){if(!_[_0xc3e5('0x18')](queues[_0x10bcf6[_0xc3e5('0x5')]][_0xc3e5('0x62')])){utils[_0xc3e5('0x19')](util[_0xc3e5('0x3')](_0xc3e5('0x65'),_0x10bcf6['uniqueid']),_0x10bcf6);queues[_0x10bcf6['uniqueid']][_0xc3e5('0x59')]+=utils[_0xc3e5('0x66')](utils[_0xc3e5('0x28')](),queues[_0x10bcf6[_0xc3e5('0x5')]][_0xc3e5('0x62')]);utils['info'](util[_0xc3e5('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x10bcf6[_0xc3e5('0x5')],queues[_0x10bcf6[_0xc3e5('0x5')]]['name'],queues[_0x10bcf6[_0xc3e5('0x5')]][_0xc3e5('0x59')]));delete queues[_0x10bcf6[_0xc3e5('0x5')]][_0xc3e5('0x62')];}}}catch(_0x425d34){utils['error'](util[_0xc3e5('0x3')](_0xc3e5('0x65'),_0x10bcf6[_0xc3e5('0x5')]),_0x425d34);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index b19e5e5..429fdc6 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 _0x44a4=['appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','lodash','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','blinds','uniqueid','transfereeuniqueid','accountcode','getUserByInternal','then','name','UserId','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','error','newstate','debug','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','find','monitors','push','hangup','[%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]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application'];(function(_0x4f8d61,_0x29eff0){var _0x3bc078=function(_0x4c7203){while(--_0x4c7203){_0x4f8d61['push'](_0x4f8d61['shift']());}};_0x3bc078(++_0x29eff0);}(_0x44a4,0xa2));var _0x444a=function(_0x25fcc8,_0xecf8ab){_0x25fcc8=_0x25fcc8-0x0;var _0x3575c5=_0x44a4[_0x25fcc8];return _0x3575c5;};'use strict';var _=require(_0x444a('0x0'));var util=require(_0x444a('0x1'));var utils=require(_0x444a('0x2'));var transfers=require(_0x444a('0x3'));var recordings={};function writeDB(_0x3fd677){var _0x1a36d6;utils[_0x444a('0x4')](util[_0x444a('0x5')](_0x444a('0x6'),_0x3fd677['uniqueid']));if(transfers[_0x444a('0x7')][_0x3fd677[_0x444a('0x8')]]){_0x1a36d6=_0x3fd677[_0x444a('0x8')];_0x3fd677['uniqueid']=transfers[_0x444a('0x7')][_0x3fd677[_0x444a('0x8')]][_0x444a('0x9')];}if(_0x3fd677[_0x444a('0xa')]){utils[_0x444a('0xb')](_0x3fd677[_0x444a('0xa')])[_0x444a('0xc')](function(_0x554c23){if(_0x554c23){_0x3fd677['membername']=_0x554c23[_0x444a('0xd')];_0x3fd677[_0x444a('0xe')]=_0x554c23['id'];}utils['request'](_0x444a('0xf'),_0x3fd677);});}else{utils['request']('CreateVoiceRecording',_0x3fd677);}if(_0x1a36d6)delete transfers[_0x444a('0x7')][_0x1a36d6];}exports[_0x444a('0x10')]=function(_0x532a39){try{utils['debug'](util['format'](_0x444a('0x11'),_0x532a39['uniqueid']),_0x532a39);if(_0x532a39[_0x444a('0x8')]==_0x532a39[_0x444a('0x12')]){utils['info'](util[_0x444a('0x5')](_0x444a('0x13'),_0x532a39[_0x444a('0x8')],_0x532a39['context'],_0x532a39['exten']));recordings[_0x532a39[_0x444a('0x8')]]={'uniqueid':_0x532a39[_0x444a('0x8')],'accountcode':_0x532a39[_0x444a('0xa')],'exten':_0x532a39[_0x444a('0x14')],'context':_0x532a39[_0x444a('0x15')],'channel':_0x532a39['channel'],'monitors':[]};}}catch(_0x5d5e20){utils[_0x444a('0x16')](util[_0x444a('0x5')]('[%s][recordings][newchannel]',_0x532a39[_0x444a('0x8')]),_0x5d5e20);}};exports[_0x444a('0x17')]=function(_0x53dd82){try{utils[_0x444a('0x18')](util['format'](_0x444a('0x19'),_0x53dd82[_0x444a('0x8')]),_0x53dd82);if(!_[_0x444a('0x1a')](recordings[_0x53dd82[_0x444a('0x8')]])&&_0x53dd82[_0x444a('0x1b')]==0x6){utils[_0x444a('0x4')](util[_0x444a('0x5')](_0x444a('0x1c'),_0x53dd82[_0x444a('0x8')],_0x53dd82[_0x444a('0x15')],_0x53dd82[_0x444a('0x1d')]));}else if(!_[_0x444a('0x1a')](recordings[_0x53dd82[_0x444a('0x12')]])&&_0x53dd82[_0x444a('0x1b')]==0x6&&_0x53dd82[_0x444a('0x15')]!='transfer'){utils[_0x444a('0x4')](util[_0x444a('0x5')](_0x444a('0x1e'),_0x53dd82[_0x444a('0x8')],_0x53dd82[_0x444a('0x12')],_0x53dd82[_0x444a('0x15')],_0x53dd82['channel']));recordings[_0x53dd82[_0x444a('0x12')]][_0x444a('0xa')]=_0x53dd82['accountcode'];}}catch(_0x3c7641){utils[_0x444a('0x16')](util[_0x444a('0x5')](_0x444a('0x19'),_0x53dd82['uniqueid']),_0x3c7641);}};exports['varset']=function(_0x2662c0){try{if(!_['isNil'](_0x2662c0[_0x444a('0x1f')])&&!_[_0x444a('0x1a')](_0x2662c0['variable'][_0x444a('0x20')])){utils[_0x444a('0x18')](util['format'](_0x444a('0x21'),_0x2662c0[_0x444a('0x8')]),_0x2662c0);utils[_0x444a('0x4')](util[_0x444a('0x5')](_0x444a('0x22'),_0x2662c0['uniqueid'],_0x2662c0[_0x444a('0x1f')],_0x2662c0[_0x444a('0x23')]));if(_[_0x444a('0x24')](_0x2662c0[_0x444a('0x23')],_0x444a('0x25'))){_0x2662c0[_0x444a('0x23')]=_0x2662c0[_0x444a('0x23')][_0x444a('0x26')]('.wav49','.WAV');}if(recordings[_0x2662c0[_0x444a('0x12')]]){var _0xfc3f10=_[_0x444a('0x27')](recordings[_0x2662c0['linkedid']]['monitors'],{'value':_0x2662c0[_0x444a('0x23')]});if(_[_0x444a('0x1a')](_0xfc3f10)){recordings[_0x2662c0[_0x444a('0x12')]][_0x444a('0x28')][_0x444a('0x29')]({'value':_0x2662c0['value']});}}}}catch(_0x47475f){utils[_0x444a('0x16')](util[_0x444a('0x5')](_0x444a('0x21'),_0x2662c0[_0x444a('0x8')]),_0x47475f);}};exports[_0x444a('0x2a')]=function(_0x5467d5){try{if(!_[_0x444a('0x1a')](recordings[_0x5467d5[_0x444a('0x8')]])){utils[_0x444a('0x18')](util[_0x444a('0x5')](_0x444a('0x2b'),_0x5467d5[_0x444a('0x8')]),_0x5467d5);utils[_0x444a('0x4')](util[_0x444a('0x5')](_0x444a('0x2c'),_0x5467d5[_0x444a('0x8')],_0x5467d5['calleridnum'],_0x5467d5[_0x444a('0x2d')],_0x5467d5[_0x444a('0x2e')]));recordings[_0x5467d5[_0x444a('0x8')]][_0x444a('0x2f')]=_0x5467d5['calleridnum'];recordings[_0x5467d5[_0x444a('0x8')]][_0x444a('0x2d')]=_0x5467d5['calleridname'];recordings[_0x5467d5[_0x444a('0x8')]]['connectedlinenum']=_0x5467d5[_0x444a('0x30')];recordings[_0x5467d5[_0x444a('0x8')]][_0x444a('0x31')]=_0x5467d5[_0x444a('0x31')];if(recordings[_0x5467d5[_0x444a('0x8')]]['type']==_0x444a('0x32')&&recordings[_0x5467d5[_0x444a('0x8')]]['accountcode']){recordings[_0x5467d5[_0x444a('0x8')]]['connectedlinenum']=recordings[_0x5467d5['uniqueid']][_0x444a('0xa')];recordings[_0x5467d5[_0x444a('0x8')]][_0x444a('0x31')]='';}recordings[_0x5467d5[_0x444a('0x8')]][_0x444a('0x28')][_0x444a('0x33')](function(_0x441623){var _0x441e79=_[_0x444a('0x34')](recordings[_0x5467d5[_0x444a('0x8')]]);_0x441e79[_0x444a('0x23')]=_0x441623[_0x444a('0x23')];writeDB(_0x441e79);});delete recordings[_0x5467d5['uniqueid']];}}catch(_0x3eed06){utils[_0x444a('0x16')](util[_0x444a('0x5')](_0x444a('0x2b'),_0x5467d5[_0x444a('0x8')]),_0x3eed06);}};exports[_0x444a('0x35')]=function(_0x159264){try{if(!_[_0x444a('0x1a')](recordings[_0x159264[_0x444a('0x8')]])){utils['debug'](util[_0x444a('0x5')](_0x444a('0x36'),_0x159264['uniqueid']),_0x159264);utils[_0x444a('0x4')](util[_0x444a('0x5')](_0x444a('0x37'),_0x159264[_0x444a('0x8')],_0x159264[_0x444a('0x38')],_0x159264[_0x444a('0x39')]));if(_0x159264[_0x444a('0x38')][_0x444a('0x3a')]()==_0x444a('0x3b')&&_[_0x444a('0x3c')](_0x159264[_0x444a('0x39')][_0x444a('0x3a')](),'cdr')){var _0x247f11=_0x159264['appdata'][_0x444a('0x3d')]('=');var _0x389b25=_0x247f11[0x0][_0x444a('0x3e')](_0x247f11[0x0][_0x444a('0x3f')]('(')+0x1,_0x247f11[0x0]['lastIndexOf'](')'));var _0x3529d5=_0x247f11[0x1];recordings[_0x159264[_0x444a('0x8')]][_0x389b25]=_0x3529d5;}}}catch(_0x293a08){utils[_0x444a('0x16')](util['format']('[%s][recordings][newexten]',_0x159264[_0x444a('0x8')]),_0x293a08);}};exports['queuecallerjoin']=function(_0x46e500){try{if(!_[_0x444a('0x1a')](recordings[_0x46e500[_0x444a('0x8')]])){utils[_0x444a('0x18')](util[_0x444a('0x5')](_0x444a('0x40'),_0x46e500[_0x444a('0x8')]),_0x46e500);utils['info'](util[_0x444a('0x5')](_0x444a('0x41'),_0x46e500['uniqueid'],_0x46e500[_0x444a('0x42')]));recordings[_0x46e500[_0x444a('0x8')]][_0x444a('0x42')]=_0x46e500[_0x444a('0x42')];}}catch(_0xd54ffb){utils['error'](util[_0x444a('0x5')]('[%s][recordings][queuecallerjoin]',_0x46e500[_0x444a('0x8')]),_0xd54ffb);}};exports['blindtransfer']=function(_0x59695c){try{utils[_0x444a('0x18')](util[_0x444a('0x5')](_0x444a('0x43'),_0x59695c[_0x444a('0x8')]),_0x59695c);utils[_0x444a('0x4')](util['format'](_0x444a('0x44'),_0x59695c['uniqueid'],_0x59695c['transferercalleridnum'],_0x59695c[_0x444a('0x45')],_0x59695c[_0x444a('0x46')],_0x59695c[_0x444a('0x47')]));if(recordings[_0x59695c[_0x444a('0x48')]]&&transfers[_0x444a('0x7')][_0x59695c[_0x444a('0x48')]]){transfers[_0x444a('0x7')][_0x59695c[_0x444a('0x48')]]['recording']=!![];}}catch(_0x57abf9){utils[_0x444a('0x16')](util[_0x444a('0x5')](_0x444a('0x43'),_0x59695c['uniqueid']),_0x57abf9);}}; \ No newline at end of file +var _0x3937=['request','CreateVoiceRecording','debug','format','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','newstate','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','isNil','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','monitors','push','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','[%s][recordings][newexten]','application','toLowerCase','startsWith','appdata','cdr','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','transferercalleridnum','transferercalleridname','transfereecalleridname','transfereruniqueid','recording','[%s][recordings][blindtransfer]','util','./transfers.controller','info','[%s][recordings][writeDB]','blinds','uniqueid','transfereeuniqueid','getUserByInternal','accountcode','then','membername','name','UserId'];(function(_0x5c338d,_0x2c9274){var _0x28f8f5=function(_0x3b0562){while(--_0x3b0562){_0x5c338d['push'](_0x5c338d['shift']());}};_0x28f8f5(++_0x2c9274);}(_0x3937,0xc2));var _0x7393=function(_0x59bf43,_0x545ba8){_0x59bf43=_0x59bf43-0x0;var _0x236cd9=_0x3937[_0x59bf43];return _0x236cd9;};'use strict';var _=require('lodash');var util=require(_0x7393('0x0'));var utils=require('./utils');var transfers=require(_0x7393('0x1'));var recordings={};function writeDB(_0x42010a){var _0x5d68b5;utils[_0x7393('0x2')](util['format'](_0x7393('0x3'),_0x42010a['uniqueid']));if(transfers[_0x7393('0x4')][_0x42010a[_0x7393('0x5')]]){_0x5d68b5=_0x42010a[_0x7393('0x5')];_0x42010a['uniqueid']=transfers[_0x7393('0x4')][_0x42010a['uniqueid']][_0x7393('0x6')];}if(_0x42010a['accountcode']){utils[_0x7393('0x7')](_0x42010a[_0x7393('0x8')])[_0x7393('0x9')](function(_0x5ec89a){if(_0x5ec89a){_0x42010a[_0x7393('0xa')]=_0x5ec89a[_0x7393('0xb')];_0x42010a[_0x7393('0xc')]=_0x5ec89a['id'];}utils[_0x7393('0xd')](_0x7393('0xe'),_0x42010a);});}else{utils[_0x7393('0xd')](_0x7393('0xe'),_0x42010a);}if(_0x5d68b5)delete transfers[_0x7393('0x4')][_0x5d68b5];}exports['newchannel']=function(_0x79df3a){try{utils[_0x7393('0xf')](util[_0x7393('0x10')](_0x7393('0x11'),_0x79df3a[_0x7393('0x5')]),_0x79df3a);if(_0x79df3a[_0x7393('0x5')]==_0x79df3a['linkedid']){utils[_0x7393('0x2')](util[_0x7393('0x10')](_0x7393('0x12'),_0x79df3a[_0x7393('0x5')],_0x79df3a[_0x7393('0x13')],_0x79df3a[_0x7393('0x14')]));recordings[_0x79df3a[_0x7393('0x5')]]={'uniqueid':_0x79df3a[_0x7393('0x5')],'accountcode':_0x79df3a[_0x7393('0x8')],'exten':_0x79df3a[_0x7393('0x14')],'context':_0x79df3a[_0x7393('0x13')],'channel':_0x79df3a['channel'],'monitors':[]};}}catch(_0x21d50f){utils[_0x7393('0x15')](util['format'](_0x7393('0x11'),_0x79df3a[_0x7393('0x5')]),_0x21d50f);}};exports[_0x7393('0x16')]=function(_0x50c05a){try{utils[_0x7393('0xf')](util[_0x7393('0x10')]('[%s][recordings][newstate]',_0x50c05a['uniqueid']),_0x50c05a);if(!_['isNil'](recordings[_0x50c05a[_0x7393('0x5')]])&&_0x50c05a[_0x7393('0x17')]==0x6){utils[_0x7393('0x2')](util[_0x7393('0x10')](_0x7393('0x18'),_0x50c05a['uniqueid'],_0x50c05a[_0x7393('0x13')],_0x50c05a[_0x7393('0x19')]));}else if(!_[_0x7393('0x1a')](recordings[_0x50c05a[_0x7393('0x1b')]])&&_0x50c05a[_0x7393('0x17')]==0x6&&_0x50c05a['context']!=_0x7393('0x1c')){utils['info'](util[_0x7393('0x10')](_0x7393('0x1d'),_0x50c05a[_0x7393('0x5')],_0x50c05a[_0x7393('0x1b')],_0x50c05a[_0x7393('0x13')],_0x50c05a[_0x7393('0x19')]));recordings[_0x50c05a[_0x7393('0x1b')]][_0x7393('0x8')]=_0x50c05a[_0x7393('0x8')];}}catch(_0x2051cb){utils[_0x7393('0x15')](util[_0x7393('0x10')]('[%s][recordings][newstate]',_0x50c05a[_0x7393('0x5')]),_0x2051cb);}};exports['varset']=function(_0x14d9ce){try{if(!_[_0x7393('0x1a')](_0x14d9ce['variable'])&&!_[_0x7393('0x1a')](_0x14d9ce['variable'][_0x7393('0x1e')])){utils[_0x7393('0xf')](util[_0x7393('0x10')](_0x7393('0x1f'),_0x14d9ce[_0x7393('0x5')]),_0x14d9ce);utils[_0x7393('0x2')](util[_0x7393('0x10')](_0x7393('0x20'),_0x14d9ce[_0x7393('0x5')],_0x14d9ce['variable'],_0x14d9ce[_0x7393('0x21')]));if(_[_0x7393('0x22')](_0x14d9ce[_0x7393('0x21')],_0x7393('0x23'))){_0x14d9ce[_0x7393('0x21')]=_0x14d9ce['value'][_0x7393('0x24')](_0x7393('0x23'),_0x7393('0x25'));}if(recordings[_0x14d9ce['linkedid']]){var _0x27a508=_['find'](recordings[_0x14d9ce[_0x7393('0x1b')]][_0x7393('0x26')],{'value':_0x14d9ce[_0x7393('0x21')]});if(_['isNil'](_0x27a508)){recordings[_0x14d9ce[_0x7393('0x1b')]][_0x7393('0x26')][_0x7393('0x27')]({'value':_0x14d9ce[_0x7393('0x21')]});}}}}catch(_0x3f8a85){utils[_0x7393('0x15')](util[_0x7393('0x10')](_0x7393('0x1f'),_0x14d9ce['uniqueid']),_0x3f8a85);}};exports['hangup']=function(_0xd9dcd4){try{if(!_['isNil'](recordings[_0xd9dcd4['uniqueid']])){utils[_0x7393('0xf')](util[_0x7393('0x10')](_0x7393('0x28'),_0xd9dcd4[_0x7393('0x5')]),_0xd9dcd4);utils[_0x7393('0x2')](util[_0x7393('0x10')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0xd9dcd4[_0x7393('0x5')],_0xd9dcd4[_0x7393('0x29')],_0xd9dcd4[_0x7393('0x2a')],_0xd9dcd4[_0x7393('0x2b')]));recordings[_0xd9dcd4[_0x7393('0x5')]]['calleridnum']=_0xd9dcd4[_0x7393('0x29')];recordings[_0xd9dcd4[_0x7393('0x5')]][_0x7393('0x2a')]=_0xd9dcd4[_0x7393('0x2a')];recordings[_0xd9dcd4[_0x7393('0x5')]][_0x7393('0x2c')]=_0xd9dcd4[_0x7393('0x2c')];recordings[_0xd9dcd4[_0x7393('0x5')]][_0x7393('0x2d')]=_0xd9dcd4[_0x7393('0x2d')];if(recordings[_0xd9dcd4[_0x7393('0x5')]][_0x7393('0x2e')]==_0x7393('0x2f')&&recordings[_0xd9dcd4['uniqueid']][_0x7393('0x8')]){recordings[_0xd9dcd4['uniqueid']][_0x7393('0x2c')]=recordings[_0xd9dcd4[_0x7393('0x5')]][_0x7393('0x8')];recordings[_0xd9dcd4['uniqueid']][_0x7393('0x2d')]='';}recordings[_0xd9dcd4['uniqueid']][_0x7393('0x26')][_0x7393('0x30')](function(_0x5e060c){var _0x436290=_['clone'](recordings[_0xd9dcd4[_0x7393('0x5')]]);_0x436290[_0x7393('0x21')]=_0x5e060c[_0x7393('0x21')];writeDB(_0x436290);});delete recordings[_0xd9dcd4[_0x7393('0x5')]];}}catch(_0x16e569){utils['error'](util[_0x7393('0x10')]('[%s][recordings][hangup]',_0xd9dcd4[_0x7393('0x5')]),_0x16e569);}};exports[_0x7393('0x31')]=function(_0x370e26){try{if(!_[_0x7393('0x1a')](recordings[_0x370e26['uniqueid']])){utils[_0x7393('0xf')](util[_0x7393('0x10')](_0x7393('0x32'),_0x370e26[_0x7393('0x5')]),_0x370e26);utils[_0x7393('0x2')](util[_0x7393('0x10')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x370e26[_0x7393('0x5')],_0x370e26[_0x7393('0x33')],_0x370e26['appdata']));if(_0x370e26[_0x7393('0x33')][_0x7393('0x34')]()=='set'&&_[_0x7393('0x35')](_0x370e26[_0x7393('0x36')][_0x7393('0x34')](),_0x7393('0x37'))){var _0x1d1e4d=_0x370e26[_0x7393('0x36')]['split']('=');var _0x1f35a8=_0x1d1e4d[0x0][_0x7393('0x38')](_0x1d1e4d[0x0][_0x7393('0x39')]('(')+0x1,_0x1d1e4d[0x0][_0x7393('0x39')](')'));var _0x1cc19c=_0x1d1e4d[0x1];recordings[_0x370e26[_0x7393('0x5')]][_0x1f35a8]=_0x1cc19c;}}}catch(_0x659549){utils[_0x7393('0x15')](util[_0x7393('0x10')](_0x7393('0x32'),_0x370e26[_0x7393('0x5')]),_0x659549);}};exports[_0x7393('0x3a')]=function(_0x58b4d8){try{if(!_['isNil'](recordings[_0x58b4d8[_0x7393('0x5')]])){utils[_0x7393('0xf')](util['format'](_0x7393('0x3b'),_0x58b4d8[_0x7393('0x5')]),_0x58b4d8);utils['info'](util['format'](_0x7393('0x3c'),_0x58b4d8[_0x7393('0x5')],_0x58b4d8[_0x7393('0x3d')]));recordings[_0x58b4d8[_0x7393('0x5')]][_0x7393('0x3d')]=_0x58b4d8['queue'];}}catch(_0xd45a13){utils[_0x7393('0x15')](util[_0x7393('0x10')](_0x7393('0x3b'),_0x58b4d8['uniqueid']),_0xd45a13);}};exports[_0x7393('0x3e')]=function(_0x3cb6a5){try{utils[_0x7393('0xf')](util[_0x7393('0x10')]('[%s][recordings][blindtransfer]',_0x3cb6a5[_0x7393('0x5')]),_0x3cb6a5);utils[_0x7393('0x2')](util['format']('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x3cb6a5['uniqueid'],_0x3cb6a5[_0x7393('0x3f')],_0x3cb6a5[_0x7393('0x40')],_0x3cb6a5['transfereecalleridnum'],_0x3cb6a5[_0x7393('0x41')]));if(recordings[_0x3cb6a5[_0x7393('0x42')]]&&transfers[_0x7393('0x4')][_0x3cb6a5[_0x7393('0x42')]]){transfers['blinds'][_0x3cb6a5[_0x7393('0x42')]][_0x7393('0x43')]=!![];}}catch(_0x3b120a){utils[_0x7393('0x15')](util[_0x7393('0x10')](_0x7393('0x44'),_0x3cb6a5[_0x7393('0x5')]),_0x3b120a);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 0bd21a9..ddfc4b8 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 _0xfb51=['transfereecalleridnum','transfereecalleridname','attendedtransfer','debug','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','error','[%s][transfers][attendedtransfer]','lodash','util','format','type','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blinds','blindtransfer','[%s][transfers][blindtransfer]','info','transferercalleridnum','transferercalleridname'];(function(_0x359513,_0x30f896){var _0x4aa572=function(_0x341775){while(--_0x341775){_0x359513['push'](_0x359513['shift']());}};_0x4aa572(++_0x30f896);}(_0xfb51,0x1a0));var _0x1fb5=function(_0x568d32,_0x25edf9){_0x568d32=_0x568d32-0x0;var _0x59d096=_0xfb51[_0x568d32];return _0x59d096;};'use strict';var _=require(_0x1fb5('0x0'));var util=require(_0x1fb5('0x1'));var utils=require('./utils');function writeDB(_0x43d30f){utils['info'](util[_0x1fb5('0x2')]('[%s][transfers][writeDB]\x20type:%s',_0x43d30f[_0x1fb5('0x3')]==='attended'?_0x43d30f[_0x1fb5('0x4')]:_0x43d30f[_0x1fb5('0x5')],_0x43d30f[_0x1fb5('0x3')]));utils['request'](_0x1fb5('0x6'),_0x43d30f);}exports[_0x1fb5('0x7')]={};exports[_0x1fb5('0x8')]=function(_0x4e6502){try{utils['debug'](util[_0x1fb5('0x2')](_0x1fb5('0x9'),_0x4e6502[_0x1fb5('0x5')]),_0x4e6502);utils[_0x1fb5('0xa')](util['format']('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x4e6502[_0x1fb5('0x5')],_0x4e6502[_0x1fb5('0xb')],_0x4e6502[_0x1fb5('0xc')],_0x4e6502[_0x1fb5('0xd')],_0x4e6502[_0x1fb5('0xe')]));_0x4e6502[_0x1fb5('0x3')]='blind';exports[_0x1fb5('0x7')][_0x4e6502['transfereruniqueid']]=_0x4e6502;writeDB(_0x4e6502);}catch(_0x4482ec){utils['error'](util[_0x1fb5('0x2')](_0x1fb5('0x9'),_0x4e6502[_0x1fb5('0x5')]),_0x4482ec);}};exports[_0x1fb5('0xf')]=function(_0x18aaf5){try{utils[_0x1fb5('0x10')](util[_0x1fb5('0x2')]('[%s][transfers][attendedtransfer]',_0x18aaf5[_0x1fb5('0x4')]),_0x18aaf5);utils[_0x1fb5('0xa')](util['format'](_0x1fb5('0x11'),_0x18aaf5['origtransfereruniqueid'],_0x18aaf5[_0x1fb5('0x12')],_0x18aaf5[_0x1fb5('0x13')],_0x18aaf5[_0x1fb5('0x14')],_0x18aaf5['transfertargetcalleridname']));_0x18aaf5=_[_0x1fb5('0x15')](_0x18aaf5,{'transfererchannel':_0x18aaf5[_0x1fb5('0x16')],'transferercalleridnum':_0x18aaf5[_0x1fb5('0x12')],'transferercalleridname':_0x18aaf5[_0x1fb5('0x13')],'transfererconnectedlinenum':_0x18aaf5['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x18aaf5[_0x1fb5('0x17')],'transfereraccountcode':_0x18aaf5[_0x1fb5('0x18')],'transferercontext':_0x18aaf5['secondtransferercontext'],'transfererexten':_0x18aaf5[_0x1fb5('0x19')],'transfererlinkedid':_0x18aaf5[_0x1fb5('0x1a')],'context':_0x18aaf5[_0x1fb5('0x1b')],'extension':_0x18aaf5[_0x1fb5('0x1c')],'type':_0x1fb5('0x1d')});if(_[_0x1fb5('0x1e')](_0x18aaf5['transfereechannel'])){_0x18aaf5=_[_0x1fb5('0x15')](_0x18aaf5,{'transfereechannel':_0x18aaf5[_0x1fb5('0x1f')],'transfereecalleridnum':_0x18aaf5[_0x1fb5('0x14')],'transfereecalleridname':_0x18aaf5[_0x1fb5('0x20')],'transfereeconnectedlinenum':_0x18aaf5['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x18aaf5[_0x1fb5('0x21')],'transfereeaccountcode':_0x18aaf5[_0x1fb5('0x22')],'transfereecontext':_0x18aaf5[_0x1fb5('0x23')],'transfereeexten':_0x18aaf5[_0x1fb5('0x24')],'transfereelinkedid':_0x18aaf5['transfertargetlinkedid']});}writeDB(_0x18aaf5);}catch(_0x30a28e){utils[_0x1fb5('0x25')](util[_0x1fb5('0x2')](_0x1fb5('0x26'),_0x18aaf5[_0x1fb5('0x4')]),_0x30a28e);}}; \ No newline at end of file +var _0x93e9=['transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','blind','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum'];(function(_0x3ee8e,_0x7b7547){var _0x3ef9b7=function(_0x274fee){while(--_0x274fee){_0x3ee8e['push'](_0x3ee8e['shift']());}};_0x3ef9b7(++_0x7b7547);}(_0x93e9,0x137));var _0x993e=function(_0x20498d,_0x12b87f){_0x20498d=_0x20498d-0x0;var _0xb34430=_0x93e9[_0x20498d];return _0xb34430;};'use strict';var _=require('lodash');var util=require(_0x993e('0x0'));var utils=require(_0x993e('0x1'));function writeDB(_0x353db7){utils['info'](util[_0x993e('0x2')](_0x993e('0x3'),_0x353db7[_0x993e('0x4')]==='attended'?_0x353db7['origtransfereruniqueid']:_0x353db7['uniqueid'],_0x353db7['type']));utils[_0x993e('0x5')](_0x993e('0x6'),_0x353db7);}exports['blinds']={};exports[_0x993e('0x7')]=function(_0x4a73d9){try{utils[_0x993e('0x8')](util[_0x993e('0x2')](_0x993e('0x9'),_0x4a73d9[_0x993e('0xa')]),_0x4a73d9);utils[_0x993e('0xb')](util[_0x993e('0x2')](_0x993e('0xc'),_0x4a73d9[_0x993e('0xa')],_0x4a73d9[_0x993e('0xd')],_0x4a73d9[_0x993e('0xe')],_0x4a73d9[_0x993e('0xf')],_0x4a73d9['transfereecalleridname']));_0x4a73d9[_0x993e('0x4')]=_0x993e('0x10');exports['blinds'][_0x4a73d9[_0x993e('0x11')]]=_0x4a73d9;writeDB(_0x4a73d9);}catch(_0x14496d){utils[_0x993e('0x12')](util[_0x993e('0x2')](_0x993e('0x9'),_0x4a73d9[_0x993e('0xa')]),_0x14496d);}};exports[_0x993e('0x13')]=function(_0x5b049d){try{utils[_0x993e('0x8')](util[_0x993e('0x2')](_0x993e('0x14'),_0x5b049d[_0x993e('0x15')]),_0x5b049d);utils['info'](util['format']('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x5b049d[_0x993e('0x15')],_0x5b049d[_0x993e('0x16')],_0x5b049d[_0x993e('0x17')],_0x5b049d[_0x993e('0x18')],_0x5b049d[_0x993e('0x19')]));_0x5b049d=_[_0x993e('0x1a')](_0x5b049d,{'transfererchannel':_0x5b049d[_0x993e('0x1b')],'transferercalleridnum':_0x5b049d[_0x993e('0x16')],'transferercalleridname':_0x5b049d[_0x993e('0x17')],'transfererconnectedlinenum':_0x5b049d['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x5b049d[_0x993e('0x1c')],'transfereraccountcode':_0x5b049d[_0x993e('0x1d')],'transferercontext':_0x5b049d['secondtransferercontext'],'transfererexten':_0x5b049d[_0x993e('0x1e')],'transfererlinkedid':_0x5b049d[_0x993e('0x1f')],'context':_0x5b049d[_0x993e('0x20')],'extension':_0x5b049d[_0x993e('0x21')],'type':_0x993e('0x22')});if(_[_0x993e('0x23')](_0x5b049d[_0x993e('0x24')])){_0x5b049d=_[_0x993e('0x1a')](_0x5b049d,{'transfereechannel':_0x5b049d[_0x993e('0x25')],'transfereecalleridnum':_0x5b049d['transfertargetcalleridnum'],'transfereecalleridname':_0x5b049d[_0x993e('0x19')],'transfereeconnectedlinenum':_0x5b049d[_0x993e('0x26')],'transfereeconnectedlinename':_0x5b049d[_0x993e('0x27')],'transfereeaccountcode':_0x5b049d[_0x993e('0x28')],'transfereecontext':_0x5b049d['transfertargetcontext'],'transfereeexten':_0x5b049d[_0x993e('0x29')],'transfereelinkedid':_0x5b049d['transfertargetlinkedid']});}writeDB(_0x5b049d);}catch(_0x371170){utils[_0x993e('0x12')](util['format'](_0x993e('0x14'),_0x5b049d[_0x993e('0x15')]),_0x371170);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 9808d93..0467aa2 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 _0x517b=['acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','notfound','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','now','isAfter','isBefore','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','found','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw'];(function(_0x112147,_0x4e692e){var _0x3ba744=function(_0x191b87){while(--_0x191b87){_0x112147['push'](_0x112147['shift']());}};_0x3ba744(++_0x4e692e);}(_0x517b,0xff));var _0xb517=function(_0x14fe8d,_0x500c74){_0x14fe8d=_0x14fe8d-0x0;var _0x1d179a=_0x517b[_0x14fe8d];return _0x1d179a;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var moment=require(_0xb517('0x0'));var util=require(_0xb517('0x1'));var client=jayson[_0xb517('0x2')][_0xb517('0x3')]({'port':0x2329});var logger=require(_0xb517('0x4'))(_0xb517('0x5'));exports[_0xb517('0x6')]=function(_0x27e870,_0x5be34f){logger[_0xb517('0x6')](_0x27e870,_0x5be34f?util[_0xb517('0x7')](_0x5be34f,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0xe41f15,_0x4f55f7){logger[_0xb517('0x8')](_0xe41f15,_0x4f55f7?util[_0xb517('0x7')](_0x4f55f7,{'showHidden':![],'depth':null}):'');};exports[_0xb517('0x9')]=function(_0xde0e96,_0x59279d){logger[_0xb517('0x9')](_0xde0e96,_0x59279d?util['inspect'](_0x59279d,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x3aa3f3,_0xcc23ca){return client[_0xb517('0xa')](_0x3aa3f3,{'body':_0xcc23ca})[_0xb517('0xb')](function(_0x28bbdd){logger[_0xb517('0x8')](_0xb517('0xc'),_0x3aa3f3,_0x28bbdd?util[_0xb517('0x7')](_0x28bbdd,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x3352a0){logger[_0xb517('0x9')](_0xb517('0xc'),_0x3aa3f3,_0x3352a0?util[_0xb517('0x7')](_0x3352a0,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3d2432){return client[_0xb517('0xa')](_0xb517('0xd'),{'options':{'raw':!![],'attributes':['id',_0xb517('0xe'),_0xb517('0xf'),_0xb517('0x10')],'where':_0x3d2432,'limit':0x1}})[_0xb517('0xb')](function(_0xa71c55){logger['debug'](_0xb517('0x11'),JSON[_0xb517('0x12')](_0x3d2432),_0xa71c55?util[_0xb517('0x7')](_0xa71c55,{'showHidden':![],'depth':null}):'');return _0xa71c55[_0xb517('0x13')][_0xb517('0x14')]?_0xa71c55[_0xb517('0x13')][0x0]:null;});}exports[_0xb517('0x15')]=function(_0x519a40){return new BPromise(function(_0x229adc,_0x38de0e){if(_0x519a40){return getUser({'internal':_0x519a40})[_0xb517('0xb')](function(_0x3ef0cf){logger['info']('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x519a40,_0x3ef0cf?_0xb517('0x16'):'notfound');return _0x229adc(_0x3ef0cf);})[_0xb517('0x17')](function(_0x44c2f7){logger['error'](_0xb517('0x18'),_0x44c2f7?util[_0xb517('0x7')](_0x44c2f7,{'showHidden':![],'depth':null}):'');return _0x229adc(null);});}return _0x229adc(null);});};exports[_0xb517('0x19')]=function(_0x598dc3){return new BPromise(function(_0x1e1e1a,_0x2c7ddd){if(_0x598dc3){return getUser({'interface':_0x598dc3})['then'](function(_0xd6d8ad){logger[_0xb517('0x6')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x598dc3,_0xd6d8ad?_0xb517('0x16'):'notfound');return _0x1e1e1a(_0xd6d8ad);})[_0xb517('0x17')](function(_0x8dfcda){logger['error'](_0xb517('0x1a'),_0x8dfcda?util[_0xb517('0x7')](_0x8dfcda,{'showHidden':![],'depth':null}):'');return _0x1e1e1a(null);});}return _0x1e1e1a(null);});};exports['getUserByName']=function(_0x5e9051){return new BPromise(function(_0x529cc9,_0x28fbdc){if(_0x5e9051){return getUser({'name':_0x5e9051})['then'](function(_0x11b6b8){logger[_0xb517('0x6')](_0xb517('0x1b'),_0x5e9051,_0x11b6b8?'found':'notfound');return _0x529cc9(_0x11b6b8);})[_0xb517('0x17')](function(_0x26c93){logger['error'](_0xb517('0x1c'),_0x26c93?util[_0xb517('0x7')](_0x26c93,{'showHidden':![],'depth':null}):'');return _0x529cc9(null);});}return _0x529cc9(null);});};exports[_0xb517('0x1d')]=function(_0x99a076){return new BPromise(function(_0x25d967,_0x467101){if(_0x99a076){return client[_0xb517('0xa')](_0xb517('0x1e'),{'options':{'raw':!![],'attributes':['id',_0xb517('0xf'),_0xb517('0x1f'),_0xb517('0x20'),_0xb517('0x21')],'where':{'name':_0x99a076},'limit':0x1}})[_0xb517('0xb')](function(_0xc467dd){logger['debug'](_0xb517('0x22'),_0x99a076,_0xc467dd?util[_0xb517('0x7')](_0xc467dd,{'showHidden':![],'depth':null}):'');logger['info'](_0xb517('0x23'),_0x99a076,_0xc467dd?_0xb517('0x16'):_0xb517('0x24'));return _0x25d967(_0xc467dd['result'][_0xb517('0x14')]?_0xc467dd[_0xb517('0x13')][0x0]:null);})[_0xb517('0x17')](function(_0x25a99d){logger[_0xb517('0x9')](_0xb517('0x25'),_0x25a99d?util[_0xb517('0x7')](_0x25a99d,{'showHidden':![],'depth':null}):'');return _0x25d967(null);});}return _0x25d967(null);});};exports[_0xb517('0x26')]=function(_0x4dd1bb,_0x9e4dcd){return moment(_0x4dd1bb)[_0xb517('0x27')](_0x9e4dcd,_0xb517('0x28'))[_0xb517('0x29')](_0xb517('0x2a'));};exports[_0xb517('0x2b')]=function(_0xd22cd3,_0xbf9020){return moment(_0xd22cd3)[_0xb517('0x2c')](_0xbf9020,_0xb517('0x28'))[_0xb517('0x29')](_0xb517('0x2a'));};exports['diffTime']=function(_0x1d1ca8,_0x4eec5a){return moment(_0x1d1ca8)['diff'](moment(_0x4eec5a),_0xb517('0x28'));};exports['sumTime']=function(_0x391b7d,_0x3222a8){return parseInt(_0x391b7d,0xa)+parseInt(_0x3222a8,0xa);};exports[_0xb517('0x2d')]=function(){return moment()[_0xb517('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xb517('0x2e')]=function(_0x331773,_0x2cb82a){if(_0x2cb82a){return moment(_0x331773)['isAfter'](_0x2cb82a);}return!![];};exports['isBefore']=function(_0x2b877a,_0x52805e){if(_0x52805e){return moment(_0x2b877a)[_0xb517('0x2f')](_0x52805e);}else if(_0x2b877a){return!![];}return![];}; \ No newline at end of file +var _0xa75c=['now','isAfter','isBefore','bluebird','moment','util','client','http','../../config/logger','info','inspect','debug','error','request','then','catch','[utils][request]\x20name:%s','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]','getUserByName','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','YYYY-MM-DD\x20HH:mm:ss','format','diffTime','diff','seconds'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa75c,0x183));var _0xca75=function(_0x3a4318,_0x13c6eb){_0x3a4318=_0x3a4318-0x0;var _0x36d746=_0xa75c[_0x3a4318];return _0x36d746;};'use strict';var BPromise=require(_0xca75('0x0'));var jayson=require('jayson/promise');var moment=require(_0xca75('0x1'));var util=require(_0xca75('0x2'));var client=jayson[_0xca75('0x3')][_0xca75('0x4')]({'port':0x2329});var logger=require(_0xca75('0x5'))('xdr');exports['info']=function(_0x43605a,_0x113796){logger[_0xca75('0x6')](_0x43605a,_0x113796?util[_0xca75('0x7')](_0x113796,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x4a4d13,_0x10d7d9){logger[_0xca75('0x8')](_0x4a4d13,_0x10d7d9?util[_0xca75('0x7')](_0x10d7d9,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x3da6e7,_0x51667a){logger[_0xca75('0x9')](_0x3da6e7,_0x51667a?util[_0xca75('0x7')](_0x51667a,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x4dd8d0,_0x1300f8){return client[_0xca75('0xa')](_0x4dd8d0,{'body':_0x1300f8})[_0xca75('0xb')](function(_0x106940){logger[_0xca75('0x8')]('[utils][request]\x20name:%s',_0x4dd8d0,_0x106940?util[_0xca75('0x7')](_0x106940,{'showHidden':![],'depth':null}):'');})[_0xca75('0xc')](function(_0x87580a){logger[_0xca75('0x9')](_0xca75('0xd'),_0x4dd8d0,_0x87580a?util['inspect'](_0x87580a,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1a418e){return client[_0xca75('0xa')](_0xca75('0xe'),{'options':{'raw':!![],'attributes':['id',_0xca75('0xf'),_0xca75('0x10'),_0xca75('0x11')],'where':_0x1a418e,'limit':0x1}})[_0xca75('0xb')](function(_0x55c0a3){logger[_0xca75('0x8')](_0xca75('0x12'),JSON[_0xca75('0x13')](_0x1a418e),_0x55c0a3?util['inspect'](_0x55c0a3,{'showHidden':![],'depth':null}):'');return _0x55c0a3[_0xca75('0x14')][_0xca75('0x15')]?_0x55c0a3[_0xca75('0x14')][0x0]:null;});}exports[_0xca75('0x16')]=function(_0x2afc87){return new BPromise(function(_0x57136e,_0x449b06){if(_0x2afc87){return getUser({'internal':_0x2afc87})[_0xca75('0xb')](function(_0x40fd0f){logger['info'](_0xca75('0x17'),_0x2afc87,_0x40fd0f?_0xca75('0x18'):_0xca75('0x19'));return _0x57136e(_0x40fd0f);})[_0xca75('0xc')](function(_0x174193){logger[_0xca75('0x9')]('[utils][getUserByInternal]',_0x174193?util[_0xca75('0x7')](_0x174193,{'showHidden':![],'depth':null}):'');return _0x57136e(null);});}return _0x57136e(null);});};exports[_0xca75('0x1a')]=function(_0x2befe8){return new BPromise(function(_0x592c01,_0x2d8784){if(_0x2befe8){return getUser({'interface':_0x2befe8})[_0xca75('0xb')](function(_0x29e9ab){logger['info'](_0xca75('0x1b'),_0x2befe8,_0x29e9ab?_0xca75('0x18'):_0xca75('0x19'));return _0x592c01(_0x29e9ab);})[_0xca75('0xc')](function(_0x49c5ed){logger['error'](_0xca75('0x1c'),_0x49c5ed?util[_0xca75('0x7')](_0x49c5ed,{'showHidden':![],'depth':null}):'');return _0x592c01(null);});}return _0x592c01(null);});};exports[_0xca75('0x1d')]=function(_0x292c69){return new BPromise(function(_0x59f53e,_0x81e2e2){if(_0x292c69){return getUser({'name':_0x292c69})[_0xca75('0xb')](function(_0x2349d1){logger[_0xca75('0x6')]('[utils][getUserByName]\x20name:%s\x20%s',_0x292c69,_0x2349d1?_0xca75('0x18'):_0xca75('0x19'));return _0x59f53e(_0x2349d1);})[_0xca75('0xc')](function(_0x41e2c5){logger[_0xca75('0x9')]('[utils][getUserByName]',_0x41e2c5?util[_0xca75('0x7')](_0x41e2c5,{'showHidden':![],'depth':null}):'');return _0x59f53e(null);});}return _0x59f53e(null);});};exports[_0xca75('0x1e')]=function(_0x2f23d4){return new BPromise(function(_0x1a5955,_0x5e94fd){if(_0x2f23d4){return client[_0xca75('0xa')](_0xca75('0x1f'),{'options':{'raw':!![],'attributes':['id',_0xca75('0x10'),_0xca75('0x20'),_0xca75('0x21'),_0xca75('0x22')],'where':{'name':_0x2f23d4},'limit':0x1}})[_0xca75('0xb')](function(_0x4e584f){logger[_0xca75('0x8')](_0xca75('0x23'),_0x2f23d4,_0x4e584f?util[_0xca75('0x7')](_0x4e584f,{'showHidden':![],'depth':null}):'');logger['info'](_0xca75('0x24'),_0x2f23d4,_0x4e584f?_0xca75('0x18'):_0xca75('0x19'));return _0x1a5955(_0x4e584f['result'][_0xca75('0x15')]?_0x4e584f['result'][0x0]:null);})[_0xca75('0xc')](function(_0x5594bf){logger[_0xca75('0x9')](_0xca75('0x25'),_0x5594bf?util['inspect'](_0x5594bf,{'showHidden':![],'depth':null}):'');return _0x1a5955(null);});}return _0x1a5955(null);});};exports[_0xca75('0x26')]=function(_0x8b6a2,_0x2f0718){return moment(_0x8b6a2)[_0xca75('0x27')](_0x2f0718,'seconds')['format'](_0xca75('0x28'));};exports['subtractTime']=function(_0x3c0b46,_0x4fdf5d){return moment(_0x3c0b46)['subtract'](_0x4fdf5d,'seconds')[_0xca75('0x29')](_0xca75('0x28'));};exports[_0xca75('0x2a')]=function(_0x2a19f9,_0x271654){return moment(_0x2a19f9)[_0xca75('0x2b')](moment(_0x271654),_0xca75('0x2c'));};exports['sumTime']=function(_0xebbd92,_0x27a6ca){return parseInt(_0xebbd92,0xa)+parseInt(_0x27a6ca,0xa);};exports[_0xca75('0x2d')]=function(){return moment()['format'](_0xca75('0x28'));};exports[_0xca75('0x2e')]=function(_0x5cab70,_0x42b6ac){if(_0x42b6ac){return moment(_0x5cab70)[_0xca75('0x2e')](_0x42b6ac);}return!![];};exports[_0xca75('0x2f')]=function(_0x39bb14,_0x5045eb){if(_0x5045eb){return moment(_0x39bb14)[_0xca75('0x2f')](_0x5045eb);}else if(_0x39bb14){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 fc48e56..c99827b 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 _0x4b61=['headers','x-forwarded-for','connection','url','responseTime','name','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','remoteAddress','statusCode','other','agent_id','agent_name','setupLoggers','fs-extra','lodash','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','role','ensureDir','then','user','data','catch','api','auth','set','client-side-logger','logger','body','\x20body=%s','format','method'];(function(_0x190ff6,_0x515cfd){var _0x5356d2=function(_0x2cf77c){while(--_0x2cf77c){_0x190ff6['push'](_0x190ff6['shift']());}};_0x5356d2(++_0x515cfd);}(_0x4b61,0x69));var _0x14b6=function(_0x19efbc,_0x10b7d7){_0x19efbc=_0x19efbc-0x0;var _0x205c5e=_0x4b61[_0x19efbc];return _0x205c5e;};var fs=require(_0x14b6('0x0'));var _=require(_0x14b6('0x1'));var ewinston=require('express-winston');var path=require(_0x14b6('0x2'));var util=require(_0x14b6('0x3'));var fileLogger=require(_0x14b6('0x4'))[_0x14b6('0x5')];var safeTemplate=require(_0x14b6('0x6'))[_0x14b6('0x7')];var maskSensitiveData=require(_0x14b6('0x8'))[_0x14b6('0x9')];function ClientSideLogger(){function _0x1cb946(_0x10ceb2){var _0x419fc7=path[_0x14b6('0xa')](_0x14b6('0xb'),_0x14b6('0xc'),_0x14b6('0xd'));var _0x26e9f0=path[_0x14b6('0xa')](_0x14b6('0xe'),_0x10ceb2[_0x14b6('0xf')]+'-'+_0x10ceb2['name']);return fs[_0x14b6('0x10')](path[_0x14b6('0xa')](_0x419fc7,_0x26e9f0))[_0x14b6('0x11')](function(){var _0x389d0e=fileLogger('client',path[_0x14b6('0xa')](_0x419fc7,_0x26e9f0));return _0x389d0e;})['catch'](function(_0x289438){throw _0x289438;});}this[_0x14b6('0xc')]=function(_0x32817a,_0x1f970b,_0x197c1c,_0x33120b){return _0x1cb946(_0x32817a[_0x14b6('0x12')])['then'](function(_0x1704d5){var _0x20116a=_0x1704d5[_0x1f970b];return _0x20116a;})['then'](function(_0x1e8f1c){var _0x4926d7=_0x32817a[_0x14b6('0x12')]?_0x32817a[_0x14b6('0x12')]['id']:'no-user';var _0x54eb77=_0x33120b[_0x14b6('0x13')];var _0x1bfbbb=_0x33120b['timestamp'];var _0x50e9a2=new Date(Number(_0x1bfbbb));return _0x1e8f1c(_0x4926d7,_0x50e9a2,_0x197c1c,_0x54eb77);})[_0x14b6('0x14')](function(_0x21343f){fileLogger(_0x14b6('0xe'))['error'](_0x21343f);});};}function setupLoggers(_0xa26e85){return new Promise(function(_0x1efae7){var _0x31172b=new ClientSideLogger();var _0x442201=fileLogger(_0x14b6('0x15'));var _0x240c5d=fileLogger(_0x14b6('0x16'));_0xa26e85[_0x14b6('0x17')](_0x14b6('0x18'),_0x31172b);_0xa26e85['use'](ewinston[_0x14b6('0x19')]({'winstonInstance':_0x442201,'meta':![],'statusLevels':!![],'msg':function(_0x32d516,_0x32c8f1){var _0x5f5bc8='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_['isEmpty'](_0x32d516[_0x14b6('0x1a')])){_0x5f5bc8+=_0x14b6('0x1b');var _0x537dca=_0x32d516[_0x14b6('0x1a')];maskSensitiveData(_0x537dca);}return safeTemplate(util[_0x14b6('0x1c')](_0x5f5bc8,_0x32d516[_0x14b6('0x1d')],_0x32d516[_0x14b6('0x1e')][_0x14b6('0x1f')]?_0x32d516[_0x14b6('0x1e')][_0x14b6('0x1f')]:_0x32d516[_0x14b6('0x20')]['remoteAddress']||_0x32d516['ip'],_0x32d516[_0x14b6('0x21')],_0x32c8f1['statusCode'],_0x32c8f1[_0x14b6('0x22')],_0x32d516[_0x14b6('0x12')]?_0x32d516[_0x14b6('0x12')]['id']:null,_0x32d516[_0x14b6('0x12')]?_0x32d516[_0x14b6('0x12')][_0x14b6('0x23')]:null,_0x32d516[_0x14b6('0x12')]?_0x32d516[_0x14b6('0x12')][_0x14b6('0xf')]:null,_0x537dca?util[_0x14b6('0x24')](_0x537dca,![],null):''));}}));_0xa26e85['use'](ewinston[_0x14b6('0x19')]({'winstonInstance':_0x240c5d,'meta':![],'statusLevels':!![],'msg':function(_0x5959aa,_0x426f15){var _0x509013=_0x14b6('0x25');if(_0x5959aa[_0x14b6('0x1a')]&&_0x5959aa[_0x14b6('0x1a')][_0x14b6('0x26')]&&_0x5959aa['body']['agent_id']){_0x509013='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x14b6('0x1c')](_0x509013,_0x5959aa[_0x14b6('0x1d')],_0x5959aa[_0x14b6('0x1e')][_0x14b6('0x1f')]?_0x5959aa[_0x14b6('0x1e')][_0x14b6('0x1f')]:_0x5959aa[_0x14b6('0x20')][_0x14b6('0x27')]||_0x5959aa['ip'],_0x5959aa[_0x14b6('0x21')],_0x426f15[_0x14b6('0x28')],_0x426f15['responseTime'],_0x5959aa[_0x14b6('0x12')]?_0x5959aa[_0x14b6('0x12')]['id']:null,_0x5959aa[_0x14b6('0x12')]?_0x5959aa[_0x14b6('0x12')][_0x14b6('0x23')]:null,_0x5959aa[_0x14b6('0x12')]?_0x5959aa[_0x14b6('0x12')]['role']:null,_0x5959aa[_0x14b6('0x1a')]&&_0x5959aa[_0x14b6('0x1a')]['device']?_0x5959aa['body'][_0x14b6('0x26')]:_0x14b6('0x29'),_0x5959aa[_0x14b6('0x1a')]&&_0x5959aa['body'][_0x14b6('0x2a')]?_0x5959aa['body'][_0x14b6('0x2a')]:'',_0x5959aa['body']&&_0x5959aa[_0x14b6('0x1a')]['agent_name']?_0x5959aa[_0x14b6('0x1a')][_0x14b6('0x2b')]:'');},'ignoreRoute':function(_0x4d319c){var _0x70c071=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x70c071['test'](_0x4d319c[_0x14b6('0x21')]);}}));return _0x1efae7();});}exports[_0x14b6('0x2c')]=setupLoggers; \ No newline at end of file +var _0x5ebd=['responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','url','agent_name','test','setupLoggers','fs-extra','lodash','path','util','./loggers','fileLogger','./mask-sensitive-data','maskSensitiveData','join','/var','xcally','client','role','name','ensureDir','then','catch','user','no-user','timestamp','api','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','headers','x-forwarded-for','connection','statusCode'];(function(_0x2e64c5,_0x2da1f7){var _0x265a78=function(_0x3bf823){while(--_0x3bf823){_0x2e64c5['push'](_0x2e64c5['shift']());}};_0x265a78(++_0x2da1f7);}(_0x5ebd,0x173));var _0xd5eb=function(_0x25a7ec,_0xd03926){_0x25a7ec=_0x25a7ec-0x0;var _0x41675b=_0x5ebd[_0x25a7ec];return _0x41675b;};var fs=require(_0xd5eb('0x0'));var _=require(_0xd5eb('0x1'));var ewinston=require('express-winston');var path=require(_0xd5eb('0x2'));var util=require(_0xd5eb('0x3'));var fileLogger=require(_0xd5eb('0x4'))[_0xd5eb('0x5')];var safeTemplate=require('./safe-template')['safeTemplate'];var maskSensitiveData=require(_0xd5eb('0x6'))[_0xd5eb('0x7')];function ClientSideLogger(){function _0x4a8648(_0x3d084e){var _0x53522a=path[_0xd5eb('0x8')](_0xd5eb('0x9'),'log',_0xd5eb('0xa'));var _0x571d35=path[_0xd5eb('0x8')](_0xd5eb('0xb'),_0x3d084e[_0xd5eb('0xc')]+'-'+_0x3d084e[_0xd5eb('0xd')]);return fs[_0xd5eb('0xe')](path[_0xd5eb('0x8')](_0x53522a,_0x571d35))[_0xd5eb('0xf')](function(){var _0x136731=fileLogger('client',path['join'](_0x53522a,_0x571d35));return _0x136731;})[_0xd5eb('0x10')](function(_0x3bec07){throw _0x3bec07;});}this['log']=function(_0x107f3d,_0x105af9,_0x248e34,_0xd50628){return _0x4a8648(_0x107f3d[_0xd5eb('0x11')])[_0xd5eb('0xf')](function(_0x9fe7df){var _0x11f1cf=_0x9fe7df[_0x105af9];return _0x11f1cf;})[_0xd5eb('0xf')](function(_0x5df35a){var _0xff8ff2=_0x107f3d['user']?_0x107f3d[_0xd5eb('0x11')]['id']:_0xd5eb('0x12');var _0x45615c=_0xd50628['data'];var _0x208313=_0xd50628[_0xd5eb('0x13')];var _0x503bc8=new Date(Number(_0x208313));return _0x5df35a(_0xff8ff2,_0x503bc8,_0x248e34,_0x45615c);})['catch'](function(_0x1ebcde){fileLogger(_0xd5eb('0xb'))['error'](_0x1ebcde);});};}function setupLoggers(_0x16502e){return new Promise(function(_0x4a738b){var _0xd6b40c=new ClientSideLogger();var _0x41af64=fileLogger(_0xd5eb('0x14'));var _0x2e5d73=fileLogger(_0xd5eb('0x15'));_0x16502e[_0xd5eb('0x16')](_0xd5eb('0x17'),_0xd6b40c);_0x16502e[_0xd5eb('0x18')](ewinston[_0xd5eb('0x19')]({'winstonInstance':_0x41af64,'meta':![],'statusLevels':!![],'msg':function(_0x251cb3,_0x28aba9){var _0x2a3e37=_0xd5eb('0x1a');if(!_[_0xd5eb('0x1b')](_0x251cb3[_0xd5eb('0x1c')])){_0x2a3e37+=_0xd5eb('0x1d');var _0x2329fb=_0x251cb3[_0xd5eb('0x1c')];maskSensitiveData(_0x2329fb);}return safeTemplate(util['format'](_0x2a3e37,_0x251cb3['method'],_0x251cb3[_0xd5eb('0x1e')][_0xd5eb('0x1f')]?_0x251cb3[_0xd5eb('0x1e')][_0xd5eb('0x1f')]:_0x251cb3[_0xd5eb('0x20')]['remoteAddress']||_0x251cb3['ip'],_0x251cb3['url'],_0x28aba9[_0xd5eb('0x21')],_0x28aba9[_0xd5eb('0x22')],_0x251cb3[_0xd5eb('0x11')]?_0x251cb3['user']['id']:null,_0x251cb3[_0xd5eb('0x11')]?_0x251cb3[_0xd5eb('0x11')][_0xd5eb('0xd')]:null,_0x251cb3[_0xd5eb('0x11')]?_0x251cb3[_0xd5eb('0x11')][_0xd5eb('0xc')]:null,_0x2329fb?util[_0xd5eb('0x23')](_0x2329fb,![],null):''));}}));_0x16502e[_0xd5eb('0x18')](ewinston['logger']({'winstonInstance':_0x2e5d73,'meta':![],'statusLevels':!![],'msg':function(_0x1bfbd7,_0x59b3c6){var _0x390733=_0xd5eb('0x24');if(_0x1bfbd7['body']&&_0x1bfbd7['body'][_0xd5eb('0x25')]&&_0x1bfbd7[_0xd5eb('0x1c')][_0xd5eb('0x26')]){_0x390733=_0xd5eb('0x27');}return util['format'](_0x390733,_0x1bfbd7[_0xd5eb('0x28')],_0x1bfbd7[_0xd5eb('0x1e')]['x-forwarded-for']?_0x1bfbd7[_0xd5eb('0x1e')]['x-forwarded-for']:_0x1bfbd7[_0xd5eb('0x20')]['remoteAddress']||_0x1bfbd7['ip'],_0x1bfbd7[_0xd5eb('0x29')],_0x59b3c6[_0xd5eb('0x21')],_0x59b3c6[_0xd5eb('0x22')],_0x1bfbd7[_0xd5eb('0x11')]?_0x1bfbd7[_0xd5eb('0x11')]['id']:null,_0x1bfbd7[_0xd5eb('0x11')]?_0x1bfbd7[_0xd5eb('0x11')][_0xd5eb('0xd')]:null,_0x1bfbd7[_0xd5eb('0x11')]?_0x1bfbd7[_0xd5eb('0x11')]['role']:null,_0x1bfbd7[_0xd5eb('0x1c')]&&_0x1bfbd7[_0xd5eb('0x1c')][_0xd5eb('0x25')]?_0x1bfbd7[_0xd5eb('0x1c')]['device']:'other',_0x1bfbd7[_0xd5eb('0x1c')]&&_0x1bfbd7[_0xd5eb('0x1c')]['agent_id']?_0x1bfbd7[_0xd5eb('0x1c')][_0xd5eb('0x26')]:'',_0x1bfbd7[_0xd5eb('0x1c')]&&_0x1bfbd7['body'][_0xd5eb('0x2a')]?_0x1bfbd7[_0xd5eb('0x1c')][_0xd5eb('0x2a')]:'');},'ignoreRoute':function(_0x54e654){var _0x2ebe06=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2ebe06[_0xd5eb('0x2b')](_0x54e654[_0xd5eb('0x29')]);}}));return _0x4a738b();});}exports[_0xd5eb('0x2c')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index ab5a52c..546384a 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3702=['MMM','monthCompare','guess','test','isMoment','split','length','iftime','lodash','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','map','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','clone','hours','minutes','isBefore','day','isBetween','timeCompare','format','includes','dowCompare','date','max','min','domCompare'];(function(_0x77fd25,_0x226ea2){var _0xe14528=function(_0x1551d5){while(--_0x1551d5){_0x77fd25['push'](_0x77fd25['shift']());}};_0xe14528(++_0x226ea2);}(_0x3702,0x98));var _0x2370=function(_0x575772,_0x438f3a){_0x575772=_0x575772-0x0;var _0x1353a5=_0x3702[_0x575772];return _0x1353a5;};var _=require(_0x2370('0x0'));var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x23ca6f){return _0x23ca6f[_0x2370('0x1')];})[_0x2370('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x2370('0x3');var EINVALID_DATE=_0x2370('0x4');function throwIfDateNotValid(_0x39dbfc){if(!_0x39dbfc['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x3cb96d){var _0x4a8dd5=_0x3cb96d['split'](':')[_0x2370('0x5')](function(_0x389f9d){return parseInt(_0x389f9d,0xa);});var _0x24de90=_0x4a8dd5[0x0];var _0x316574=_0x4a8dd5[0x1];if(_0x24de90<0x0||_0x24de90>0x17||_0x316574<0x0||_0x316574>0x3b){throw new Error(EINVALID_DATE);}return[_0x24de90,_0x316574];}function circularDoWInterval(_0x1755b2,_0x36fb40){if(_0x1755b2===_0x36fb40){return[_0x1755b2];}else{var _0x21ed1f=moment['locale']();moment[_0x2370('0x6')]('en');var _0x1424bc=moment[_0x2370('0x7')]()[_0x2370('0x5')](function(_0x3f90d0){return _0x3f90d0[_0x2370('0x8')]();});moment[_0x2370('0x6')](_0x21ed1f);var _0x27a683=_0x1424bc['indexOf'](_0x1755b2);var _0x249dba=_0x1424bc[_0x2370('0x9')](_0x36fb40);if(_0x249dba>_0x27a683){return _0x1424bc['slice'](_0x27a683,_0x249dba+0x1);}else{var _0x503eb3=_0x1424bc[_0x2370('0xa')](0x0,_0x249dba+0x1);var _0x3bc9ec=_0x1424bc[_0x2370('0xa')](_0x27a683);return _0x3bc9ec[_0x2370('0xb')](_0x503eb3);}}}module[_0x2370('0xc')][_0x2370('0xd')]=circularDoWInterval;function circularMonthInterval(_0x1fcc58,_0x4ba710){if(_0x1fcc58===_0x4ba710){return[_0x1fcc58];}else{var _0x2a05b0=moment['locale']();moment[_0x2370('0x6')]('en');var _0x75acab=moment['monthsShort']()[_0x2370('0x5')](function(_0x144ed0){return _0x144ed0[_0x2370('0x8')]();});moment['locale'](_0x2a05b0);var _0x3e8a4d=_0x75acab[_0x2370('0x9')](_0x1fcc58);var _0x539614=_0x75acab[_0x2370('0x9')](_0x4ba710);if(_0x539614>_0x3e8a4d){return _0x75acab[_0x2370('0xa')](_0x3e8a4d,_0x539614+0x1);}else{var _0x4851a9=_0x75acab[_0x2370('0xa')](0x0,_0x539614+0x1);var _0x21e541=_0x75acab[_0x2370('0xa')](_0x3e8a4d);return _0x21e541[_0x2370('0xb')](_0x4851a9);}}}module['exports']['circularMonthInterval']=circularMonthInterval;function parseDom(_0x6912f2){var _0x30d935=parseInt(_0x6912f2,0xa);if(_0x30d935<0x1||_0x30d935>0x1f){throw new Error(EINVALID_DATE);}return _0x30d935;}function timeCompare(_0x4afedf,_0x577825,_0x571551){var _0x57ac1c=_0x4afedf[_0x2370('0xe')]();var _0x308f5f=extractTime(_0x577825);var _0x317db3=_0x308f5f[0x0];var _0x2a5990=_0x308f5f[0x1];var _0x495ba9=_0x4afedf[_0x2370('0xe')]()[_0x2370('0xf')](_0x317db3)[_0x2370('0x10')](_0x2a5990);throwIfDateNotValid(_0x495ba9);var _0x299b24=extractTime(_0x571551);var _0x377467=_0x299b24[0x0];var _0x568f62=_0x299b24[0x1];var _0x4eb3df=_0x4afedf[_0x2370('0xe')]()[_0x2370('0xf')](_0x377467)[_0x2370('0x10')](_0x568f62);throwIfDateNotValid(_0x4eb3df);if(_0x4eb3df[_0x2370('0x11')](_0x495ba9)){var _0x171f8c=_0x57ac1c[_0x2370('0xe')]()['startOf'](_0x2370('0x12'));var _0x274f84=_0x57ac1c[_0x2370('0xe')]()['endOf'](_0x2370('0x12'));return _0x57ac1c[_0x2370('0x13')](_0x495ba9,_0x274f84,undefined,'[]')||_0x57ac1c[_0x2370('0x13')](_0x171f8c,_0x4eb3df,undefined,'[]');}else{return _0x57ac1c[_0x2370('0x13')](_0x495ba9,_0x4eb3df,undefined,'[]');}}module['exports'][_0x2370('0x14')]=timeCompare;function dowCompare(_0x39661c,_0x5bdc6d,_0x3c27d9){var _0x91a0ee=_0x39661c[_0x2370('0x6')]('en')[_0x2370('0x15')]('ddd')[_0x2370('0x8')]();return circularDoWInterval(_0x5bdc6d,_0x3c27d9)[_0x2370('0x16')](_0x91a0ee);}module[_0x2370('0xc')][_0x2370('0x17')]=dowCompare;function domCompare(_0x169ec9,_0x34e947,_0x1ad7aa){var _0x59fa1c=_0x169ec9[_0x2370('0x18')]();if(_0x34e947===_0x1ad7aa){return _0x59fa1c===_0x34e947;}else{var _0x583902=_0x169ec9['daysInMonth']();var _0x21cd47=_0x34e947<_0x1ad7aa;let _0x604173=![];var _0x349e7e=0x0;var _0x21eb5d=0x0;if(_0x21cd47){_0x349e7e=Math[_0x2370('0x19')](0x1,_0x34e947);_0x21eb5d=Math[_0x2370('0x1a')](_0x1ad7aa,_0x583902);_0x604173=_0x59fa1c>=_0x349e7e&&_0x59fa1c<=_0x21eb5d;}else{_0x349e7e=Math[_0x2370('0x1a')](_0x34e947,_0x583902);_0x21eb5d=Math['max'](0x1,_0x1ad7aa);_0x604173=_0x59fa1c>=_0x349e7e||_0x59fa1c<=_0x21eb5d;}return _0x604173;}}module[_0x2370('0xc')][_0x2370('0x1b')]=domCompare;function monthCompare(_0xc9006,_0x44c6e3,_0x423b5d){var _0x35dc64=_0xc9006['locale']('en')[_0x2370('0x15')](_0x2370('0x1c'))[_0x2370('0x8')]();return circularMonthInterval(_0x44c6e3,_0x423b5d)[_0x2370('0x16')](_0x35dc64);}module['exports'][_0x2370('0x1d')]=monthCompare;function iftime(_0x52b5e7,_0x408748=moment['tz'][_0x2370('0x1e')](),_0x24a9eb=moment()){if(!validateRx[_0x2370('0x1f')](_0x52b5e7)){throw new Error(EINVALID_STRING);}else{var _0x45eec7=(moment[_0x2370('0x20')](_0x24a9eb)?_0x24a9eb['clone']():moment(_0x24a9eb))['tz'](_0x408748)['locale']('en');throwIfDateNotValid(_0x45eec7);var _0x31f423=_0x52b5e7['split'](',');var _0x233f35=_0x31f423[0x0];var _0x4eadac=_0x31f423[0x1];var _0x4f8119=_0x31f423[0x2];var _0x203d44=_0x31f423[0x3];let _0x56ddcb=!![];if(_0x233f35!=='*'){var _0x120247=_0x233f35[_0x2370('0x21')]('-');var _0x5b50b7=_['padStart'](_0x120247[0x0],0x5,'0');var _0x483dfc=_0x120247['length']===0x2?_['padStart'](_0x120247[0x1],0x5,'0'):_0x5b50b7;_0x56ddcb=timeCompare(_0x45eec7,_0x5b50b7,_0x483dfc);}let _0x410e2c=!![];if(_0x4eadac!=='*'){var _0x4d9bd9=_0x4eadac[_0x2370('0x21')]('-');var _0x2ed784=_0x4d9bd9[0x0];var _0x1a1617=_0x4d9bd9[_0x2370('0x22')]===0x2?_0x4d9bd9[0x1]:_0x2ed784;_0x410e2c=dowCompare(_0x45eec7,_0x2ed784,_0x1a1617);}let _0x3ee336=!![];if(_0x4f8119!=='*'){var _0x49a810=_0x4f8119[_0x2370('0x21')]('-');var _0x260185=parseDom(_0x49a810[0x0]);var _0x588f6a=_0x49a810[_0x2370('0x22')]===0x2?parseDom(_0x49a810[0x1]):_0x260185;_0x3ee336=domCompare(_0x45eec7,_0x260185,_0x588f6a);}let _0x417bea=!![];if(_0x203d44!=='*'){var _0x4d9c62=_0x203d44['split']('-');var _0x510f47=_0x4d9c62[0x0];var _0x45c294=_0x4d9c62[_0x2370('0x22')]===0x2?_0x4d9c62[0x1]:_0x4d9c62[0x0];_0x417bea=monthCompare(_0x45eec7,_0x510f47,_0x45c294);}return _0x56ddcb&&_0x410e2c&&_0x3ee336&&_0x417bea;}}module[_0x2370('0xc')][_0x2370('0x23')]=iftime; \ No newline at end of file +var _0xd179=['iftime','lodash','moment-timezone','map','join','Date\x20not\x20valid','split','locale','weekdaysShort','indexOf','slice','concat','exports','monthsShort','toLowerCase','clone','minutes','hours','startOf','day','isBetween','format','ddd','includes','dowCompare','daysInMonth','max','min','domCompare','MMM','monthCompare','guess','test','isMoment','padStart','length'];(function(_0x364a36,_0x1e2677){var _0x5cd6fa=function(_0x58d692){while(--_0x58d692){_0x364a36['push'](_0x364a36['shift']());}};_0x5cd6fa(++_0x1e2677);}(_0xd179,0x18d));var _0x9d17=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xd179[_0xd1d19a];return _0x52a79d;};var _=require(_0x9d17('0x0'));var moment=require(_0x9d17('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][_0x9d17('0x2')](function(_0xc2cec9){return _0xc2cec9['source'];})[_0x9d17('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE=_0x9d17('0x4');function throwIfDateNotValid(_0xca5a75){if(!_0xca5a75['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x3de798){var _0x5e0b98=_0x3de798[_0x9d17('0x5')](':')[_0x9d17('0x2')](function(_0x3199f5){return parseInt(_0x3199f5,0xa);});var _0x4b5344=_0x5e0b98[0x0];var _0x58ac29=_0x5e0b98[0x1];if(_0x4b5344<0x0||_0x4b5344>0x17||_0x58ac29<0x0||_0x58ac29>0x3b){throw new Error(EINVALID_DATE);}return[_0x4b5344,_0x58ac29];}function circularDoWInterval(_0x22e668,_0x5ac6ee){if(_0x22e668===_0x5ac6ee){return[_0x22e668];}else{var _0x5c8e96=moment[_0x9d17('0x6')]();moment[_0x9d17('0x6')]('en');var _0x35d11f=moment[_0x9d17('0x7')]()[_0x9d17('0x2')](function(_0x500fc6){return _0x500fc6['toLowerCase']();});moment[_0x9d17('0x6')](_0x5c8e96);var _0x296915=_0x35d11f[_0x9d17('0x8')](_0x22e668);var _0xf3314b=_0x35d11f[_0x9d17('0x8')](_0x5ac6ee);if(_0xf3314b>_0x296915){return _0x35d11f['slice'](_0x296915,_0xf3314b+0x1);}else{var _0x4ae640=_0x35d11f[_0x9d17('0x9')](0x0,_0xf3314b+0x1);var _0x2d3dcb=_0x35d11f[_0x9d17('0x9')](_0x296915);return _0x2d3dcb[_0x9d17('0xa')](_0x4ae640);}}}module[_0x9d17('0xb')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x27143,_0x185d87){if(_0x27143===_0x185d87){return[_0x27143];}else{var _0x200875=moment[_0x9d17('0x6')]();moment[_0x9d17('0x6')]('en');var _0x2d7666=moment[_0x9d17('0xc')]()[_0x9d17('0x2')](function(_0x3d09ca){return _0x3d09ca[_0x9d17('0xd')]();});moment['locale'](_0x200875);var _0x2908c5=_0x2d7666[_0x9d17('0x8')](_0x27143);var _0x488d6a=_0x2d7666['indexOf'](_0x185d87);if(_0x488d6a>_0x2908c5){return _0x2d7666['slice'](_0x2908c5,_0x488d6a+0x1);}else{var _0x4d9386=_0x2d7666['slice'](0x0,_0x488d6a+0x1);var _0x981b12=_0x2d7666[_0x9d17('0x9')](_0x2908c5);return _0x981b12[_0x9d17('0xa')](_0x4d9386);}}}module['exports']['circularMonthInterval']=circularMonthInterval;function parseDom(_0x465a4e){var _0x5e1800=parseInt(_0x465a4e,0xa);if(_0x5e1800<0x1||_0x5e1800>0x1f){throw new Error(EINVALID_DATE);}return _0x5e1800;}function timeCompare(_0x44afce,_0x46309b,_0x535c21){var _0x32d93f=_0x44afce[_0x9d17('0xe')]();var _0x245c3d=extractTime(_0x46309b);var _0x2824c5=_0x245c3d[0x0];var _0x1d09d7=_0x245c3d[0x1];var _0x2e51d8=_0x44afce[_0x9d17('0xe')]()['hours'](_0x2824c5)[_0x9d17('0xf')](_0x1d09d7);throwIfDateNotValid(_0x2e51d8);var _0x13891a=extractTime(_0x535c21);var _0x2f4df2=_0x13891a[0x0];var _0x4dae8e=_0x13891a[0x1];var _0x52f605=_0x44afce[_0x9d17('0xe')]()[_0x9d17('0x10')](_0x2f4df2)['minutes'](_0x4dae8e);throwIfDateNotValid(_0x52f605);if(_0x52f605['isBefore'](_0x2e51d8)){var _0x5bfe15=_0x32d93f[_0x9d17('0xe')]()[_0x9d17('0x11')](_0x9d17('0x12'));var _0x106673=_0x32d93f['clone']()['endOf'](_0x9d17('0x12'));return _0x32d93f[_0x9d17('0x13')](_0x2e51d8,_0x106673,undefined,'[]')||_0x32d93f['isBetween'](_0x5bfe15,_0x52f605,undefined,'[]');}else{return _0x32d93f[_0x9d17('0x13')](_0x2e51d8,_0x52f605,undefined,'[]');}}module[_0x9d17('0xb')]['timeCompare']=timeCompare;function dowCompare(_0xfb7435,_0x3eaf12,_0x3bd96c){var _0x4446b0=_0xfb7435['locale']('en')[_0x9d17('0x14')](_0x9d17('0x15'))[_0x9d17('0xd')]();return circularDoWInterval(_0x3eaf12,_0x3bd96c)[_0x9d17('0x16')](_0x4446b0);}module[_0x9d17('0xb')][_0x9d17('0x17')]=dowCompare;function domCompare(_0x30bd55,_0x1d940f,_0x197535){var _0x35af16=_0x30bd55['date']();if(_0x1d940f===_0x197535){return _0x35af16===_0x1d940f;}else{var _0x169b2a=_0x30bd55[_0x9d17('0x18')]();var _0x4623cc=_0x1d940f<_0x197535;let _0x2976c2=![];var _0x2888d2=0x0;var _0x13ae0a=0x0;if(_0x4623cc){_0x2888d2=Math[_0x9d17('0x19')](0x1,_0x1d940f);_0x13ae0a=Math[_0x9d17('0x1a')](_0x197535,_0x169b2a);_0x2976c2=_0x35af16>=_0x2888d2&&_0x35af16<=_0x13ae0a;}else{_0x2888d2=Math[_0x9d17('0x1a')](_0x1d940f,_0x169b2a);_0x13ae0a=Math[_0x9d17('0x19')](0x1,_0x197535);_0x2976c2=_0x35af16>=_0x2888d2||_0x35af16<=_0x13ae0a;}return _0x2976c2;}}module[_0x9d17('0xb')][_0x9d17('0x1b')]=domCompare;function monthCompare(_0x515ab6,_0x25944d,_0x37bd53){var _0x191799=_0x515ab6[_0x9d17('0x6')]('en')['format'](_0x9d17('0x1c'))[_0x9d17('0xd')]();return circularMonthInterval(_0x25944d,_0x37bd53)['includes'](_0x191799);}module[_0x9d17('0xb')][_0x9d17('0x1d')]=monthCompare;function iftime(_0x4b6605,_0x42a9a7=moment['tz'][_0x9d17('0x1e')](),_0x58c2b5=moment()){if(!validateRx[_0x9d17('0x1f')](_0x4b6605)){throw new Error(EINVALID_STRING);}else{var _0x807927=(moment[_0x9d17('0x20')](_0x58c2b5)?_0x58c2b5[_0x9d17('0xe')]():moment(_0x58c2b5))['tz'](_0x42a9a7)['locale']('en');throwIfDateNotValid(_0x807927);var _0x91b5da=_0x4b6605[_0x9d17('0x5')](',');var _0x397b87=_0x91b5da[0x0];var _0xa2f181=_0x91b5da[0x1];var _0x5ce874=_0x91b5da[0x2];var _0x36547e=_0x91b5da[0x3];let _0x3dd214=!![];if(_0x397b87!=='*'){var _0x521dac=_0x397b87[_0x9d17('0x5')]('-');var _0xb3c4bb=_[_0x9d17('0x21')](_0x521dac[0x0],0x5,'0');var _0x45aea5=_0x521dac['length']===0x2?_[_0x9d17('0x21')](_0x521dac[0x1],0x5,'0'):_0xb3c4bb;_0x3dd214=timeCompare(_0x807927,_0xb3c4bb,_0x45aea5);}let _0x1138be=!![];if(_0xa2f181!=='*'){var _0x240757=_0xa2f181[_0x9d17('0x5')]('-');var _0x497271=_0x240757[0x0];var _0x18e96e=_0x240757[_0x9d17('0x22')]===0x2?_0x240757[0x1]:_0x497271;_0x1138be=dowCompare(_0x807927,_0x497271,_0x18e96e);}let _0x451319=!![];if(_0x5ce874!=='*'){var _0xdcbaec=_0x5ce874['split']('-');var _0x2aabc7=parseDom(_0xdcbaec[0x0]);var _0x46a286=_0xdcbaec[_0x9d17('0x22')]===0x2?parseDom(_0xdcbaec[0x1]):_0x2aabc7;_0x451319=domCompare(_0x807927,_0x2aabc7,_0x46a286);}let _0x4f3d6b=!![];if(_0x36547e!=='*'){var _0x4da695=_0x36547e[_0x9d17('0x5')]('-');var _0x56c4f0=_0x4da695[0x0];var _0x5f3e72=_0x4da695[_0x9d17('0x22')]===0x2?_0x4da695[0x1]:_0x4da695[0x0];_0x4f3d6b=monthCompare(_0x807927,_0x56c4f0,_0x5f3e72);}return _0x3dd214&&_0x1138be&&_0x451319&&_0x4f3d6b;}}module[_0x9d17('0xb')][_0x9d17('0x23')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 944e82d..d186504 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8c2=['stringify','transports','Console','Logger','%s-%s','error','File','warn','consoleLogger','path','util','winston','debugLevel','info','redBG\x20white','red','white','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','length'];(function(_0x476b00,_0x250877){var _0x44ec8e=function(_0xec6b23){while(--_0xec6b23){_0x476b00['push'](_0x476b00['shift']());}};_0x44ec8e(++_0x250877);}(_0xa8c2,0x171));var _0x2a8c=function(_0x5a709c,_0x1e6cfe){_0x5a709c=_0x5a709c-0x0;var _0x719025=_0xa8c2[_0x5a709c];return _0x719025;};'use strict';var path=require(_0x2a8c('0x0'));var util=require(_0x2a8c('0x1'));var moment=require('moment');var winston=require(_0x2a8c('0x2'));var config=require('../config/environment');var debugLevel=config[_0x2a8c('0x3')]?config[_0x2a8c('0x3')]['toLowerCase']():_0x2a8c('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':_0x2a8c('0x5'),'error':_0x2a8c('0x6'),'warn':'bold\x20yellow','info':_0x2a8c('0x7'),'print':'bold\x20white','success':'bold\x20green','http':_0x2a8c('0x8'),'verbose':_0x2a8c('0x9'),'debug':_0x2a8c('0xa'),'silly':_0x2a8c('0xb')};winston[_0x2a8c('0xc')](XC_LOG_COLORS);function getLogFileName(_0x2f2d71,_0x2aa38f,_0x43e9c){var _0x335ada=_0x2f2d71||_0x2a8c('0xd');return path['join'](_0x335ada,util[_0x2a8c('0xe')](_0x2a8c('0xf'),_0x2aa38f,_0x43e9c));}function formatter(_0x58fc35,_0x337e82){_0x337e82[_0x2a8c('0x10')]=_0x337e82['message'][_0x2a8c('0x11')](/@@{/g,_0x2a8c('0x12'))[_0x2a8c('0x11')](/}@@/g,_0x2a8c('0x13'))[_0x2a8c('0x11')](/@{/g,'{{')[_0x2a8c('0x11')](/}@/g,'}}');return util[_0x2a8c('0xe')](_0x2a8c('0x14'),moment()[_0x2a8c('0xe')](_0x2a8c('0x15')),_0x337e82[_0x2a8c('0x16')][_0x2a8c('0x17')](),_0x58fc35,_0x337e82[_0x2a8c('0x10')]);}function fileFormat(_0x43e2d3,_0x26065f){_0x26065f['message']=_0x26065f[_0x2a8c('0x10')]['replace'](/@@{/g,_0x2a8c('0x12'))['replace'](/}@@/g,_0x2a8c('0x13'))['replace'](/@{/g,'{{')[_0x2a8c('0x11')](/}@/g,'}}');var _0x5ae4a7=_0x26065f[_0x2a8c('0x18')]&&Object[_0x2a8c('0x19')](_0x26065f[_0x2a8c('0x18')])[_0x2a8c('0x1a')]?'\x0a\x09'+JSON[_0x2a8c('0x1b')](_0x26065f[_0x2a8c('0x18')]):'';return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x2a8c('0xe')](_0x2a8c('0x15')),_0x26065f['level'][_0x2a8c('0x17')](),_0x43e2d3,_0x26065f[_0x2a8c('0x10')],_0x5ae4a7);}function consoleLogger(){var _0x19b175=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x2a8c('0x1c'))][(_0x2a8c('0x1d'))]({'level':'warn','json':![],'formatter':function(_0x5bd7e7){return formatter('',_0x5bd7e7);}})]});return _0x19b175;}function fileLogger(_0x3b9331,_0x3440d6){var _0x3b28a4=new winston[(_0x2a8c('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x2a8c('0x1c'))]['File']({'name':util[_0x2a8c('0xe')](_0x2a8c('0x1f'),_0x3b9331,'error'),'filename':getLogFileName(_0x3440d6,_0x3b9331,_0x2a8c('0x20')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x32080b){return fileFormat(_0x3b9331,_0x32080b);}}),new winston[(_0x2a8c('0x1c'))][(_0x2a8c('0x21'))]({'name':util[_0x2a8c('0xe')](_0x2a8c('0x1f'),_0x3b9331,debugLevel),'filename':getLogFileName(_0x3440d6,_0x3b9331,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x41fe1f){return fileFormat(_0x3b9331,_0x41fe1f);}}),new winston[(_0x2a8c('0x1c'))][(_0x2a8c('0x1d'))]({'level':_0x2a8c('0x22'),'json':![],'formatter':function(_0x31d107){return fileFormat(_0x3b9331,_0x31d107);}})]});return _0x3b28a4;}exports[_0x2a8c('0x23')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file +var _0x6620=['path','util','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','message','replace','{{{','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','length','Logger','Console','transports','File','%s-%s','error','warn','consoleLogger','fileLogger'];(function(_0x35f4f3,_0x437876){var _0x5e9941=function(_0x15ed37){while(--_0x15ed37){_0x35f4f3['push'](_0x35f4f3['shift']());}};_0x5e9941(++_0x437876);}(_0x6620,0xea));var _0x0662=function(_0x43028b,_0x46246d){_0x43028b=_0x43028b-0x0;var _0x9396b8=_0x6620[_0x43028b];return _0x9396b8;};'use strict';var path=require(_0x0662('0x0'));var util=require(_0x0662('0x1'));var moment=require('moment');var winston=require('winston');var config=require(_0x0662('0x2'));var debugLevel=config[_0x0662('0x3')]?config['debugLevel'][_0x0662('0x4')]():_0x0662('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x0662('0x6'),'error':_0x0662('0x7'),'warn':_0x0662('0x8'),'info':_0x0662('0x9'),'print':_0x0662('0xa'),'success':_0x0662('0xb'),'http':_0x0662('0xc'),'verbose':_0x0662('0xd'),'debug':_0x0662('0xe'),'silly':_0x0662('0xf')};winston[_0x0662('0x10')](XC_LOG_COLORS);function getLogFileName(_0x36d7d5,_0x28c3b1,_0x3ecde4){var _0x47aae0=_0x36d7d5||_0x0662('0x11');return path['join'](_0x47aae0,util['format']('%s-%s.log',_0x28c3b1,_0x3ecde4));}function formatter(_0x157926,_0x440ae0){_0x440ae0[_0x0662('0x12')]=_0x440ae0[_0x0662('0x12')][_0x0662('0x13')](/@@{/g,_0x0662('0x14'))['replace'](/}@@/g,_0x0662('0x15'))['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x0662('0x16')](_0x0662('0x17'),moment()[_0x0662('0x16')](_0x0662('0x18')),_0x440ae0[_0x0662('0x19')][_0x0662('0x1a')](),_0x157926,_0x440ae0[_0x0662('0x12')]);}function fileFormat(_0x7ced99,_0x45be44){_0x45be44['message']=_0x45be44[_0x0662('0x12')]['replace'](/@@{/g,_0x0662('0x14'))[_0x0662('0x13')](/}@@/g,_0x0662('0x15'))['replace'](/@{/g,'{{')[_0x0662('0x13')](/}@/g,'}}');var _0x4cb0d8=_0x45be44[_0x0662('0x1b')]&&Object[_0x0662('0x1c')](_0x45be44[_0x0662('0x1b')])[_0x0662('0x1d')]?'\x0a\x09'+JSON['stringify'](_0x45be44['meta']):'';return util[_0x0662('0x16')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x0662('0x16')](_0x0662('0x18')),_0x45be44[_0x0662('0x19')]['toUpperCase'](),_0x7ced99,_0x45be44['message'],_0x4cb0d8);}function consoleLogger(){var _0x46d92f=new winston[(_0x0662('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x0662('0x1f'))]({'level':'warn','json':![],'formatter':function(_0x2e23e1){return formatter('',_0x2e23e1);}})]});return _0x46d92f;}function fileLogger(_0x60e455,_0x5ee89e){var _0x36e11b=new winston[(_0x0662('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x0662('0x20'))][(_0x0662('0x21'))]({'name':util[_0x0662('0x16')](_0x0662('0x22'),_0x60e455,_0x0662('0x23')),'filename':getLogFileName(_0x5ee89e,_0x60e455,'error'),'level':_0x0662('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xd720a1){return fileFormat(_0x60e455,_0xd720a1);}}),new winston['transports'][(_0x0662('0x21'))]({'name':util[_0x0662('0x16')](_0x0662('0x22'),_0x60e455,debugLevel),'filename':getLogFileName(_0x5ee89e,_0x60e455,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x24e108){return fileFormat(_0x60e455,_0x24e108);}}),new winston['transports'][(_0x0662('0x1f'))]({'level':_0x0662('0x24'),'json':![],'formatter':function(_0x3b93e8){return fileFormat(_0x60e455,_0x3b93e8);}})]});return _0x36e11b;}exports[_0x0662('0x25')]=consoleLogger;exports[_0x0662('0x26')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 7593ede..ee88697 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 _0x1a85=['isString','@@{','replace','}@@','includes','exports','maskSensitiveData','password','newPassword','apiKey','street','phone','mobile','email','clientSecret','code','accessKey','token','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length'];(function(_0xaaf2e2,_0x19d28a){var _0x28bc36=function(_0x53bdb5){while(--_0x53bdb5){_0xaaf2e2['push'](_0xaaf2e2['shift']());}};_0x28bc36(++_0x19d28a);}(_0x1a85,0x178));var _0x51a8=function(_0x228a4a,_0x23d65e){_0x228a4a=_0x228a4a-0x0;var _0x3d3937=_0x1a85[_0x228a4a];return _0x3d3937;};var _=require('lodash');var sensitiveFields=['username',_0x51a8('0x0'),_0x51a8('0x1'),_0x51a8('0x2'),'firstName','lastName',_0x51a8('0x3'),_0x51a8('0x4'),_0x51a8('0x5'),'fax',_0x51a8('0x6'),'clientId',_0x51a8('0x7'),'securityToken',_0x51a8('0x8'),_0x51a8('0x9'),'tenantId',_0x51a8('0xa'),'channelSecret','accessToken',_0x51a8('0xb'),_0x51a8('0xc'),_0x51a8('0xd'),_0x51a8('0xe'),_0x51a8('0xf'),_0x51a8('0x10'),_0x51a8('0x11'),_0x51a8('0x12'),_0x51a8('0x13'),_0x51a8('0x14'),_0x51a8('0x15'),_0x51a8('0x16'),_0x51a8('0x17'),_0x51a8('0x18'),_0x51a8('0x19'),_0x51a8('0x1a'),_0x51a8('0x1b'),'localstationid',_0x51a8('0x1c'),_0x51a8('0x1d'),_0x51a8('0x1e'),'oldPassword'];function maskSensitiveData(_0xf4eb6e){const _0x547d40=/(?!^)[\s\S](?!$)/g;if(_[_0x51a8('0x1f')](_0xf4eb6e)){for(const _0x2b8d37 in _0xf4eb6e){if(_[_0x51a8('0x20')](_0xf4eb6e[_0x2b8d37])){for(let _0x2b0521=0x0;_0x2b0521<_0xf4eb6e[_0x2b8d37][_0x51a8('0x21')];_0x2b0521++){maskSensitiveData(_0xf4eb6e[_0x2b8d37][_0x2b0521]);}}else if(_[_0x51a8('0x1f')](_0xf4eb6e[_0x2b8d37])){maskSensitiveData(_0xf4eb6e[_0x2b8d37]);}else if(_[_0x51a8('0x22')](_0xf4eb6e[_0x2b8d37])){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](/{{{/g,_0x51a8('0x23'))[_0x51a8('0x24')](/}}}/g,_0x51a8('0x25'))[_0x51a8('0x24')](/{{/g,'@{')[_0x51a8('0x24')](/}}/g,'}@');if(_[_0x51a8('0x26')](sensitiveFields,_0x2b8d37)){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](_0x547d40,'*');}}}}}module[_0x51a8('0x27')][_0x51a8('0x28')]=maskSensitiveData; \ No newline at end of file +var _0xadb5=['exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','street','phone','mobile','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridnum'];(function(_0xbdf0de,_0x139344){var _0x590248=function(_0x7798fa){while(--_0x7798fa){_0xbdf0de['push'](_0xbdf0de['shift']());}};_0x590248(++_0x139344);}(_0xadb5,0xad));var _0x5adb=function(_0x210fb1,_0x3a1f89){_0x210fb1=_0x210fb1-0x0;var _0x4ee917=_0xadb5[_0x210fb1];return _0x4ee917;};var _=require('lodash');var sensitiveFields=[_0x5adb('0x0'),'password',_0x5adb('0x1'),_0x5adb('0x2'),_0x5adb('0x3'),'lastName',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6'),'fax',_0x5adb('0x7'),_0x5adb('0x8'),_0x5adb('0x9'),_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc'),_0x5adb('0xd'),_0x5adb('0xe'),_0x5adb('0xf'),_0x5adb('0x10'),_0x5adb('0x11'),_0x5adb('0x12'),_0x5adb('0x13'),_0x5adb('0x14'),'membername','calleridname',_0x5adb('0x15'),_0x5adb('0x16'),_0x5adb('0x17'),'clientEmail',_0x5adb('0x18'),'accesskeyid',_0x5adb('0x19'),'key',_0x5adb('0x1a'),_0x5adb('0x1b'),_0x5adb('0x1c'),'localstationid',_0x5adb('0x1d'),_0x5adb('0x1e'),_0x5adb('0x1f'),'oldPassword'];function maskSensitiveData(_0x2312de){const _0x518823=/(?!^)[\s\S](?!$)/g;if(_[_0x5adb('0x20')](_0x2312de)){for(const _0x42a482 in _0x2312de){if(_[_0x5adb('0x21')](_0x2312de[_0x42a482])){for(let _0x304784=0x0;_0x304784<_0x2312de[_0x42a482][_0x5adb('0x22')];_0x304784++){maskSensitiveData(_0x2312de[_0x42a482][_0x304784]);}}else if(_[_0x5adb('0x20')](_0x2312de[_0x42a482])){maskSensitiveData(_0x2312de[_0x42a482]);}else if(_[_0x5adb('0x23')](_0x2312de[_0x42a482])){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](/{{{/g,_0x5adb('0x25'))['replace'](/}}}/g,_0x5adb('0x26'))['replace'](/{{/g,'@{')[_0x5adb('0x24')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x42a482)){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](_0x518823,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 94df0c0..7d18340 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 _0x9c00=['isPlainObject','exports','safeTemplate','lodash','replace','isArray','map'];(function(_0x42c118,_0x197006){var _0x112ebd=function(_0x337411){while(--_0x337411){_0x42c118['push'](_0x42c118['shift']());}};_0x112ebd(++_0x197006);}(_0x9c00,0x1a0));var _0x09c0=function(_0x29b2d0,_0x73bf4b){_0x29b2d0=_0x29b2d0-0x0;var _0x4af937=_0x9c00[_0x29b2d0];return _0x4af937;};var _=require(_0x09c0('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x170d8b){return _0x170d8b==='{{'?'{\x20{\x20':'\x20}\x20}';}function safeTemplate(_0xe0d293){var _0x8c9907=_0xe0d293;if(typeof _0xe0d293==='string'){_0x8c9907=_0xe0d293[_0x09c0('0x1')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x09c0('0x2')](_0xe0d293)){_0x8c9907=_0xe0d293[_0x09c0('0x3')](function(_0x2fd03e){return safeTemplate(_0x2fd03e);});}else if(_[_0x09c0('0x4')](_0xe0d293)){_0x8c9907=Object['keys'](_0xe0d293)['reduce'](function(_0x1f3d7e,_0x17d11f){_0x1f3d7e[_0x17d11f]=safeTemplate(_0xe0d293[_0x17d11f]);return _0x1f3d7e;},{});}return _0x8c9907;}module[_0x09c0('0x5')][_0x09c0('0x6')]=safeTemplate; \ No newline at end of file +var _0x4fc2=['reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','map','keys'];(function(_0x8cac34,_0x1c5c1a){var _0x54a344=function(_0x4b1399){while(--_0x4b1399){_0x8cac34['push'](_0x8cac34['shift']());}};_0x54a344(++_0x1c5c1a);}(_0x4fc2,0x111));var _0x24fc=function(_0x110d59,_0x50c4fb){_0x110d59=_0x110d59-0x0;var _0x2fce64=_0x4fc2[_0x110d59];return _0x2fce64;};var _=require(_0x24fc('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2b05a5){return _0x2b05a5==='{{'?_0x24fc('0x1'):_0x24fc('0x2');}function safeTemplate(_0x5aaa74){var _0x365c56=_0x5aaa74;if(typeof _0x5aaa74===_0x24fc('0x3')){_0x365c56=_0x5aaa74[_0x24fc('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x5aaa74)){_0x365c56=_0x5aaa74[_0x24fc('0x5')](function(_0x3772eb){return safeTemplate(_0x3772eb);});}else if(_['isPlainObject'](_0x5aaa74)){_0x365c56=Object[_0x24fc('0x6')](_0x5aaa74)[_0x24fc('0x7')](function(_0x4889f4,_0x115851){_0x4889f4[_0x115851]=safeTemplate(_0x5aaa74[_0x115851]);return _0x4889f4;},{});}return _0x365c56;}module[_0x24fc('0x8')][_0x24fc('0x9')]=safeTemplate; \ No newline at end of file